2.13.43 • Published 3 days ago

@salla.sa/twilight-components v2.13.43

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
3 days ago

Overview

Twilight comes with a ready-designed and styled set of web components for Salla stores. For example, ready components to display the login form, product availability section, search bar, localization menu, and many more. Twilight JS Web Components are a collection of high-level building blocks and reusable web components that can be built together to swiftly develop the UI for custom Salla Themes, governed by clear guidelines.

Getting Started

JS Web Components were built from the ground up to be simple to learn and use, with various thoughtfully constructed user interface components. Its complete compatibility with the themes' structure and architecture makes it easy to customize, as the documentation explains.

List of Twilight JS Web Components

Below is a list of the ready-made Twilight JS Web Components which can be used easily. Following, in this part of the document, each component is explained in detail.

Every web component comes with a list of properties and events that make that component customizable. Besides, each web component uses methods from the Twilight JS SDK to fetch any needed data from the backend.

ComponentCode TagDescription
Add Productsalla-add-product-buttonAllows controllability over button text labels and behaviors based on the product-status and product-type properties.
Advertisementsalla-advertisementDisplays Advertisment items inclduing icons, URLs, target, description
Buttonsalla-buttonShows a customizable button, in terms of size, color, style, status, position etc..
Breadcrumbsalla-breadcrumbNavigational helper and hierarchy for pages where they are used as a high-level representation of where users have navigated
Cart Summarysalla-cart-summaryShows the icon of the shopping cart with a small circle badge indicating the number of items in the cart.
Color Pickersalla-color-pickerAllows selection of a color using a variety of input methods.
Comment Formsalla-comment-formDisplays a comment form for specific products or pages
Commentssalla-commentsAllows user to enter textual contents as a comment for Product or Page
Conditional Fieldssalla-conditional-fieldsAllows for hiding / displaying certain features in a product, such as size.
Count Downsalla-count-downShows the amount of time left until a given date.
Date Time Pickersalla-datetime-pickerAllows users to select both date and time with the same control.
File Uploadsalla-file-uploadAllows the user to allow uploading a file or a number of files.
Filterssalla-filtersAllows the user to filter the data in a variety of ways.
Giftingsalla-giftingDisplay items as gifts, which can be used after the customer has completed a purchase.
Infinite Scrollsalla-infinite-scrollAllows for infinite scrolling to load content continuously as the user scrolls down a page.
Installmentsalla-installmentShows a block area for the available installment payment options provided for a specific product.
List Tilesalla-list-tileUsed to display listing items in a tile form.
Loadingsalla-loadingUsed to convey that some data is currently loading to the user.
Localizationsalla-localization-modalShows the menu for the store's available languages and currencies.
Loginsalla-login-modalDisplays the login form, which prompts a user for their credentials in order to authenticate their access.
Loyaltysalla-loyaltyDisplay a popup that represents the Loyalty program.
Mapsalla-mapDisplays geographical maps from various sources with multiple layers, and interaction through events.
Menusalla-menuNavigation drawer that slides in from the side of the current view.
Modalsalla-modalDisplays a dialog box or pop-up window on top of the current page.
Notificationssalla-notificationsDisplays messages to notify users with a specific information.
Offersalla-offer-modalShows a list of products with an offer given by the store admin.
Placeholdersalla-placeholderReserves space for content that soon will appear in a layout.
Product Availabilitysalla-product-availabilityShow the "Notify availability" option as a button for the registered customer
Product Cardsalla-product-cardContains content and actions about a single subject in a card display mode.
Product Listsalla-product-listDisplays a group of related products with some of information, such as products' names, prices, and other relevant information in an organized way.
Product Optionssalla-product-optionsShows customizable product fields before proceeding to ordering
Product Size Guidesalla-product-size-guideEnables the merchant to add product measurements of height, weight, depth and other metrics.
Products Slidersalla-products-sliderNavigates horizontally through a group of related products.
Progress barsalla-progress-barDisplays a progress bar indicating that data processing is underway.
Quantity Inputsalla-quantity-inputAllows the customer to use a counter to specify the needed quantity of a specific product.
Quick Ordersalla-quick-orderAllows the customer to quickly checkout and pay for products.
Quick Buysalla-quick-buyAllows for placing the Quick Buy button for a quickly checkout and pay for products.
Ratingsalla-rating-modalDisplays the rating scale for a store, product, or shipping company.
Rating Starssalla-rating-starsDisplays a form of rating scale using a star glyph.
Scopessalla-scopesShows a list of scopes (branches) owned by the store
Searchsalla-searchShows a search box, field, or bar.
Selectsalla-selectAllow selection from a particular dropdown list.salla-sheetBaseline layout foudnation for other components to be set on.
Skeletonsalla-skeletonDisplays an indication to the user that something is coming but not yet available.
Slidersalla-sliderGathers numerical user data by reflecting a range of values along a bar.
Social Sharesalla-social-shareDisplays a menu with social media platforms.
Swipersalla-swiperModern touch slider to display a list of items.
Tabssalla-tabsMakes it possible to have several panes inside a single view.
Tel Inputsalla-tel-inputShows a field for entering a telephone number, with country key/code prefix.
User Menusalla-user-menuShows a navigation menu list with links.
User Profilesalla-user-profileDisplays the user information which be customised to display information such as Name, Email, Phone Number.
User Settingssalla-user-settingsAllows the user to manage their account settings.
Verifysalla-verifyShows fields for verifying email/mobile of users by sending OTP verification code.

Benefits

Clean, simple, and standardized.

Developers will follow standards and let users fall in love with the user experience with ready-made components and beautiful (yet changeable) themes. Developers can use a stylistic guideline and functional designs to create huge Themes with UI Component modules.

Using Twilight JS SDK

Twilight Web Components are using the Twilight JS SDK, which allows communication between the frontend and backend using specific REST API.

Ecosystem

Twilight Web Components are maintained by a full-time core team and a large community of developers and contributors. This is because Twilight helps developers collaborate.

Things to know:

It's worth noting that the Tailwind CSS Framework is the default foundation for the Twilight web components.There is a possibility that future plans may include other CSS frameworks.

Installation

To use the components, developers need to load a CSS file and some JavaScript. The CSS file includes the fonts and design tokens.

Twilight Themes

In case of using the Twilight web components inside the Twilight themes, the developer doesn't need to includes the Twilight web components in your bundle or inside the html, Twilight theme engine will inject the latest version of Twilight web components in the page

Bundler/ES modules

The developer needs to install both of the node.js and Tailwind CSS, then installing the Twiligh web components by performing one of the following commands:

npm install @salla.sa/twilight-components --save
yarn add @salla.sa/twilight-components

After that, inside the javascript codebase, developer may do import as follows:

import {
  applyPolyfills, 
  defineCustomElements as TwilightWebComponents
} from '@salla.sa/twilight-components/loader';

applyPolyfills().then(() => {
    TwilightWebComponents(window);
});

HTML/CDN

Another approach for loading the Twilight Web Components isby using the version hosted on the CDN. The components can be loaded via <script> tags in the head of the HTML document

<script
  type="module"
  src="https://unpkg.com/@salla.sa/twilight-components@latest/dist/twilight-components/twilight-components.esm.js"
></script>

JIT Enabled

Tailwind added a just-in-time compiler, which generates styles as the developer writes the theme rather than generating everything in advance at initial build time.

Since JIT mode generates your CSS on-demand by scanning your template files, it’s crucial that you configure the content option in your tailwind.config.d.ts file with all of your template paths, otherwise your CSS will be empty

...
  content: [
    // theme views
    "views/**/*.twig",
    // list of classes which required by twilight web components
    "node_modules/@salla.sa/twilight-tailwind-theme/safe-list-css.txt"
  ],
...

Previously, as mentioned that the file tailwind.config.d.ts is already bundled with the Twilight starter theme files.

Usage

After installation, Components can be easily added in the basic HTML markup, as shown in the following example:

// Salla Button component
<salla-button fill="outline" color="dark">Hello World 👋</salla-button>

// Salla Telephone Input component
<salla-tel-input onclick="telInput.isValid()" country-code="sa"
   country-key="+966" mobile="555555555">

// Salla Product Availability component
<salla-product-availability channels="sms,mobile,email" is-subscribed="false">
</salla-product-availability>

Events

We recommend using DOM events, but we also provide custom events to help with specific event kinds. All custom events are always documented on their own documentation page for each component.

// Save reference to the modal component below
var modal = document.querySelector("salla-modal");

// Listen for open events
modal.addEventListener("modalVisibilityChanged", function (isOpened) {
    console.log("Modal Opened");
});

Moreover, developers can detect when a component has been loaded, as Twilight registers its components using the standard Web Components API's CustomElementsRegistry object. This object also provides a whenDefined function, which takes a component name and returns a promise. When the component is defined, the promise will be fulfilled:

window.customElements.whenDefined("salla-button").then(() => {
    console.log("Salla Button is defined!");
});

Support

The team is always here to help you. Happen to face an issue? Want to report a bug? You can submit one here on Github using the Issue Tracker. If you still have any questions, please contact us via the Telegram Bot or join in the Global Developer Community on Telegram.

Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Credits

License

The MIT License (MIT). Please see License File for more information.

2.13.43

3 days ago

2.13.42

4 days ago

2.13.41

4 days ago

2.13.40

7 days ago

2.13.39

10 days ago

2.13.38

13 days ago

2.13.37

14 days ago

2.13.36

25 days ago

2.13.35

27 days ago

2.13.34

28 days ago

2.13.33

1 month ago

2.13.32

1 month ago

2.13.31

1 month ago

2.13.30

2 months ago

2.13.29

2 months ago

2.13.28

2 months ago

2.13.27

2 months ago

2.13.26

2 months ago

2.13.25

2 months ago

2.13.24

2 months ago

2.13.23

3 months ago

2.13.21-alpha.0

3 months ago

2.13.22

3 months ago

2.13.21

3 months ago

2.13.22-alpha.0

3 months ago

2.13.20

3 months ago

2.13.19

3 months ago

2.13.18

3 months ago

2.13.17

3 months ago

2.13.16

3 months ago

2.13.15

3 months ago

2.13.14

3 months ago

2.13.13

3 months ago

2.13.12

3 months ago

2.13.11

3 months ago

2.13.10

3 months ago

2.13.2

3 months ago

2.12.77

4 months ago

2.12.75

4 months ago

2.12.74

5 months ago

2.12.73

5 months ago

2.12.72

5 months ago

2.12.71

5 months ago

2.12.69

5 months ago

2.12.68

5 months ago

2.12.50-alpha.1

7 months ago

2.12.50-alpha.0

7 months ago

2.12.49

7 months ago

2.12.48

7 months ago

2.12.47

7 months ago

2.12.46

7 months ago

2.12.45

8 months ago

2.12.44

8 months ago

2.12.43

8 months ago

2.12.42

8 months ago

2.12.41

8 months ago

2.12.40

8 months ago

2.12.39

8 months ago

2.12.38

8 months ago

2.12.37

8 months ago

2.12.36

8 months ago

2.12.35

9 months ago

2.12.34

9 months ago

2.12.32

9 months ago

2.12.31

9 months ago

2.12.30

9 months ago

2.12.66

5 months ago

2.12.65

5 months ago

2.12.64

5 months ago

2.12.63

6 months ago

2.12.61

6 months ago

2.12.60

6 months ago

2.12.59

6 months ago

2.12.58

6 months ago

2.12.57

6 months ago

2.12.56

6 months ago

2.12.55

6 months ago

2.12.54

6 months ago

2.12.53

6 months ago

2.12.52

6 months ago

2.12.51

6 months ago

2.12.50

6 months ago

2.12.29

9 months ago

2.12.27

9 months ago

2.12.26

9 months ago

2.12.25

9 months ago

2.12.24

9 months ago

2.12.23

9 months ago

2.12.22

9 months ago

2.12.21

9 months ago

2.12.20

9 months ago

2.12.19

9 months ago

2.12.18

9 months ago

2.12.17

9 months ago

2.12.16

10 months ago

2.12.15

10 months ago

2.12.14

10 months ago

2.12.13

10 months ago

2.12.12

10 months ago

2.11.123

12 months ago

2.11.124

12 months ago

2.11.125

12 months ago

2.11.126

12 months ago

2.11.127

12 months ago

2.11.128

12 months ago

2.12.11

10 months ago

2.12.10

11 months ago

2.12.0

11 months ago

2.12.9

11 months ago

2.12.7

11 months ago

2.12.8

11 months ago

2.12.5

11 months ago

2.12.6

11 months ago

2.12.3

11 months ago

2.12.4

11 months ago

2.12.1

11 months ago

2.12.2

11 months ago

2.11.100

1 year ago

2.11.101

1 year ago

2.11.102

1 year ago

2.11.103

1 year ago

2.11.104

1 year ago

2.11.105

1 year ago

2.11.106

1 year ago

2.11.107

1 year ago

2.11.108

1 year ago

2.11.109

1 year ago

2.11.110

1 year ago

2.11.111

1 year ago

2.11.112

1 year ago

2.11.113

1 year ago

2.11.114

1 year ago

2.11.115

1 year ago

2.11.116

1 year ago

2.11.117

1 year ago

2.11.118

1 year ago

2.11.119

1 year ago

2.11.120

1 year ago

2.11.121

1 year ago

2.11.122

1 year ago

2.11.91

1 year ago

2.11.92

1 year ago

2.11.93

1 year ago

2.11.94

1 year ago

2.11.95

1 year ago

2.11.96

1 year ago

2.11.97

1 year ago

2.11.98

1 year ago

2.11.99

1 year ago

2.11.80

1 year ago

2.11.81

1 year ago

2.11.82

1 year ago

2.11.83

1 year ago

2.11.84

1 year ago

2.11.85

1 year ago

2.11.86

1 year ago

2.11.87

1 year ago

2.11.88

1 year ago

2.11.89

1 year ago

2.11.90

1 year ago

2.11.67

1 year ago

2.11.69

1 year ago

2.11.70

1 year ago

2.11.71

1 year ago

2.11.72

1 year ago

2.11.73

1 year ago

2.11.74

1 year ago

2.11.75

1 year ago

2.11.76

1 year ago

2.11.77

1 year ago

2.11.78

1 year ago

2.11.79

1 year ago

2.11.11

1 year ago

2.11.12

1 year ago

2.11.13

1 year ago

2.11.14

1 year ago

2.11.15

1 year ago

2.11.16

1 year ago

2.11.17

1 year ago

2.11.18

1 year ago

2.11.19

1 year ago

2.11.60

1 year ago

2.11.61

1 year ago

2.11.62

1 year ago

2.11.63

1 year ago

2.11.64

1 year ago

2.11.65

1 year ago

2.11.66

1 year ago

2.11.41

1 year ago

2.11.42

1 year ago

2.11.43

1 year ago

2.11.44

1 year ago

2.11.45

1 year ago

2.11.46

1 year ago

2.11.47

1 year ago

2.11.48

1 year ago

2.11.49

1 year ago

2.11.50

1 year ago

2.11.51

1 year ago

2.11.52

1 year ago

2.11.53

1 year ago

2.11.54

1 year ago

2.11.55

1 year ago

2.11.57

1 year ago

2.11.58

1 year ago

2.11.59

1 year ago

2.11.20

1 year ago

2.11.21

1 year ago

2.11.22

1 year ago

2.11.23

1 year ago

2.11.24

1 year ago

2.11.25

1 year ago

2.11.26

1 year ago

2.11.27

1 year ago

2.11.28

1 year ago

2.11.29

1 year ago

2.11.30

1 year ago

2.11.31

1 year ago

2.11.32

1 year ago

2.11.33

1 year ago

2.11.34

1 year ago

2.11.35

1 year ago

2.11.36

1 year ago

2.11.37

1 year ago

2.11.38

1 year ago

2.11.39

1 year ago

2.11.10

1 year ago

2.11.9

1 year ago

2.11.8

1 year ago

2.11.7

1 year ago

2.11.6

1 year ago

2.11.5

1 year ago

2.11.4

1 year ago

2.11.3

1 year ago

2.11.2

1 year ago

2.11.1

1 year ago

2.11.0

1 year ago

2.10.7

1 year ago

2.10.6

1 year ago

2.10.5

1 year ago

2.10.4

1 year ago

2.10.3

1 year ago

2.10.2

1 year ago

2.10.1

1 year ago

2.10.0

1 year ago

2.9.49

1 year ago

2.9.48

1 year ago

2.9.46

1 year ago

2.9.45

1 year ago

2.9.44

1 year ago

2.9.43

2 years ago

2.9.42

2 years ago

2.9.41

2 years ago

2.9.40

2 years ago

2.9.39

2 years ago

2.9.38

2 years ago

2.9.37

2 years ago

2.9.36

2 years ago

2.9.35

2 years ago

2.9.34

2 years ago

2.9.33

2 years ago

2.9.32

2 years ago

2.9.31

2 years ago

2.9.30

2 years ago

2.9.29

2 years ago

2.9.28

2 years ago

2.9.27

2 years ago

2.9.26

2 years ago

2.9.25

2 years ago

2.9.24

2 years ago

2.9.23

2 years ago

2.9.22

2 years ago

2.9.21

2 years ago

2.9.20

2 years ago

2.9.19

2 years ago

2.9.13

2 years ago

2.9.12

2 years ago

2.9.11

2 years ago

2.9.10

2 years ago

2.9.9

2 years ago

2.9.8

2 years ago

2.9.7

2 years ago

2.9.6

2 years ago

2.9.5

2 years ago

2.9.3

2 years ago

2.9.2

2 years ago

2.9.1

2 years ago

2.9.0

2 years ago

1.6.15

2 years ago

1.6.15-alpha.20

2 years ago

1.6.15-alpha.19

2 years ago

1.6.15-alpha.18

2 years ago

1.6.15-alpha.17

2 years ago

1.6.15-alpha.16

2 years ago

1.6.15-alpha.15

2 years ago

1.6.15-alpha.14

2 years ago

1.6.15-alpha.13

2 years ago

1.6.15-alpha.12

2 years ago

1.6.15-alpha.11

2 years ago

1.6.15-alpha.10

2 years ago

1.6.15-alpha.9

2 years ago

1.6.15-alpha.8

2 years ago

1.6.15-alpha.7

2 years ago

1.6.15-alpha.6

2 years ago

1.6.15-alpha.5

2 years ago

1.6.15-alpha.4

2 years ago

1.6.15-alpha.3

2 years ago

1.6.15-alpha.2

2 years ago

1.6.15-alpha.1

2 years ago

1.6.15-alpha.0

2 years ago

1.6.14

2 years ago

1.6.13

2 years ago

1.6.12

2 years ago

1.6.11

2 years ago

1.6.10

2 years ago

1.6.9

2 years ago

1.6.8

2 years ago

1.6.7

2 years ago

1.6.6

2 years ago

1.6.5

2 years ago

1.6.4

2 years ago

1.6.3

2 years ago

1.6.2

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.6.0-alpha.0

2 years ago

1.5.14

2 years ago

1.5.13

2 years ago

1.5.12

2 years ago

1.5.11

2 years ago

1.5.10

2 years ago

1.5.9

2 years ago

1.5.8

2 years ago

1.5.7

2 years ago

1.5.6

2 years ago

1.5.3

2 years ago

1.5.2

2 years ago

1.5.0

2 years ago

1.4.21

2 years ago

1.4.20

2 years ago

1.4.19

2 years ago

1.4.18

2 years ago

1.4.17

2 years ago

1.4.12

2 years ago

1.4.11

2 years ago

1.4.10

2 years ago

1.4.8

2 years ago

1.4.9

2 years ago

1.4.7

2 years ago

1.4.6

2 years ago

1.4.5

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.0.160

2 years ago

1.0.159

2 years ago

1.0.158

2 years ago

1.0.157

2 years ago

1.0.156

2 years ago

1.0.155

2 years ago

1.0.154

2 years ago

1.0.153

2 years ago

1.0.152

2 years ago

1.0.151

2 years ago

1.0.150

2 years ago

1.0.149

2 years ago

1.0.148

2 years ago

1.0.147

2 years ago

1.0.146

2 years ago

1.0.145

2 years ago

1.0.144

2 years ago

1.0.143

2 years ago

1.0.142

2 years ago

1.0.141

2 years ago

1.0.140

2 years ago

1.0.139

2 years ago

1.0.138

2 years ago

1.0.137

2 years ago

1.0.136

2 years ago

1.0.135

2 years ago

1.0.133

2 years ago

1.0.132

2 years ago

1.0.131

2 years ago

1.0.130

2 years ago

1.0.121

2 years ago

1.0.118

2 years ago

1.0.108

2 years ago

1.0.107

2 years ago

1.0.104

2 years ago

1.0.100

2 years ago

1.0.99

2 years ago

1.0.98

2 years ago

1.0.97

2 years ago

1.0.96

2 years ago

1.0.95

2 years ago

1.0.94

2 years ago

1.0.93

2 years ago

1.0.92

2 years ago

1.0.91

2 years ago

1.0.90

2 years ago

1.0.89

2 years ago

1.0.88

2 years ago

1.0.87

2 years ago

1.0.86

2 years ago

1.0.85

2 years ago

1.0.84

2 years ago

1.0.83

2 years ago

1.0.82

2 years ago

1.0.81

2 years ago

1.0.80

2 years ago

1.0.79

2 years ago

1.0.78

2 years ago

1.0.77

2 years ago

1.0.76

2 years ago

1.0.75

2 years ago

1.0.74

2 years ago

1.0.73

2 years ago

1.0.72

2 years ago

1.0.71

2 years ago

1.0.69

2 years ago

1.0.68

2 years ago

1.0.67

2 years ago

1.0.66

2 years ago

1.0.65

2 years ago

1.0.64

2 years ago

1.0.63

2 years ago

1.0.62

2 years ago

1.0.61

2 years ago

1.0.60

2 years ago

1.0.58

2 years ago

1.0.57

2 years ago

1.0.56

2 years ago

1.0.55

2 years ago

1.0.54

2 years ago

1.0.53

2 years ago

1.0.52

2 years ago

1.0.51

2 years ago

1.0.50

2 years ago

1.0.49

2 years ago

1.0.48

2 years ago

1.0.47

2 years ago

1.0.46

2 years ago

1.0.45

2 years ago

1.0.44

2 years ago

1.0.43

2 years ago

1.0.42

2 years ago

1.0.41

2 years ago

1.0.40

2 years ago

1.0.39

2 years ago

1.0.38

2 years ago

1.0.37

2 years ago

1.0.36

2 years ago

1.0.35

2 years ago

1.0.34

2 years ago

1.0.33

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago