wj-elements 0.1.134 → 0.1.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/dist/dark.css +0 -223
- package/dist/infinite-scroll.element-XVJukzjy.js +0 -271
- package/dist/light.css +0 -530
- package/dist/list.element-Ce1vIm1O.js +0 -49
- package/dist/localize.js +0 -67
- package/dist/packages/index.d.ts +0 -98
- package/dist/packages/localize/localize.d.ts +0 -17
- package/dist/packages/translations/en-GB.d.ts +0 -13
- package/dist/packages/translations/sk-SK.d.ts +0 -13
- package/dist/packages/utils/animations.d.ts +0 -2
- package/dist/packages/utils/date.d.ts +0 -1
- package/dist/packages/utils/element-utils.d.ts +0 -46
- package/dist/packages/utils/event.d.ts +0 -67
- package/dist/packages/utils/localize.d.ts +0 -4
- package/dist/packages/utils/permissions-api.d.ts +0 -34
- package/dist/packages/utils/utils.d.ts +0 -1
- package/dist/packages/utils/wje-import-firefox.d.ts +0 -0
- package/dist/packages/utils/wje-import.d.ts +0 -0
- package/dist/packages/wje-accordion/accordion.d.ts +0 -2
- package/dist/packages/wje-accordion/accordion.element.d.ts +0 -72
- package/dist/packages/wje-accordion-item/accordion-item.d.ts +0 -2
- package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +0 -40
- package/dist/packages/wje-animation/animation.d.ts +0 -2
- package/dist/packages/wje-animation/animation.element.d.ts +0 -153
- package/dist/packages/wje-animation/animation.test.d.ts +0 -1
- package/dist/packages/wje-aside/aside.d.ts +0 -2
- package/dist/packages/wje-aside/aside.element.d.ts +0 -31
- package/dist/packages/wje-avatar/avatar.d.ts +0 -2
- package/dist/packages/wje-avatar/avatar.element.d.ts +0 -37
- package/dist/packages/wje-avatar/service/service.d.ts +0 -40
- package/dist/packages/wje-badge/badge.d.ts +0 -2
- package/dist/packages/wje-badge/badge.element.d.ts +0 -35
- package/dist/packages/wje-badge/badge.test.d.ts +0 -1
- package/dist/packages/wje-breadcrumb/breadcrumb.d.ts +0 -2
- package/dist/packages/wje-breadcrumb/breadcrumb.element.d.ts +0 -80
- package/dist/packages/wje-breadcrumbs/breadcrumbs.d.ts +0 -2
- package/dist/packages/wje-breadcrumbs/breadcrumbs.element.d.ts +0 -97
- package/dist/packages/wje-breadcrumbs/breadcrumbs.test.d.ts +0 -1
- package/dist/packages/wje-button/button.d.ts +0 -2
- package/dist/packages/wje-button/button.element.d.ts +0 -173
- package/dist/packages/wje-button/button.test.d.ts +0 -1
- package/dist/packages/wje-button-group/button-group.d.ts +0 -2
- package/dist/packages/wje-button-group/button-group.element.d.ts +0 -39
- package/dist/packages/wje-card/card.d.ts +0 -2
- package/dist/packages/wje-card/card.element.d.ts +0 -29
- package/dist/packages/wje-card-content/card-content.d.ts +0 -2
- package/dist/packages/wje-card-content/card-content.element.d.ts +0 -22
- package/dist/packages/wje-card-controls/card-controls.d.ts +0 -2
- package/dist/packages/wje-card-controls/card-controls.element.d.ts +0 -23
- package/dist/packages/wje-card-header/card-header.d.ts +0 -2
- package/dist/packages/wje-card-header/card-header.element.d.ts +0 -22
- package/dist/packages/wje-card-subtitle/card-subtitle.d.ts +0 -2
- package/dist/packages/wje-card-subtitle/card-subtitle.element.d.ts +0 -30
- package/dist/packages/wje-card-title/card-title.d.ts +0 -2
- package/dist/packages/wje-card-title/card-title.element.d.ts +0 -32
- package/dist/packages/wje-carousel/carousel.d.ts +0 -2
- package/dist/packages/wje-carousel/carousel.element.d.ts +0 -146
- package/dist/packages/wje-carousel-item/carousel-item.d.ts +0 -2
- package/dist/packages/wje-carousel-item/carousel-item.element.d.ts +0 -38
- package/dist/packages/wje-checkbox/checkbox.d.ts +0 -2
- package/dist/packages/wje-checkbox/checkbox.element.d.ts +0 -171
- package/dist/packages/wje-chip/chip.d.ts +0 -2
- package/dist/packages/wje-chip/chip.element.d.ts +0 -29
- package/dist/packages/wje-col/col.d.ts +0 -2
- package/dist/packages/wje-col/col.element.d.ts +0 -16
- package/dist/packages/wje-color-picker/color-picker.d.ts +0 -2
- package/dist/packages/wje-color-picker/color-picker.element.d.ts +0 -187
- package/dist/packages/wje-container/container.d.ts +0 -2
- package/dist/packages/wje-container/container.element.d.ts +0 -31
- package/dist/packages/wje-copy-button/copy-button.d.ts +0 -2
- package/dist/packages/wje-copy-button/copy-button.element.d.ts +0 -89
- package/dist/packages/wje-copy-button/service/service.d.ts +0 -12
- package/dist/packages/wje-dialog/dialog.d.ts +0 -2
- package/dist/packages/wje-dialog/dialog.element.d.ts +0 -116
- package/dist/packages/wje-divider/divider.d.ts +0 -2
- package/dist/packages/wje-divider/divider.element.d.ts +0 -32
- package/dist/packages/wje-dropdown/dropdown.d.ts +0 -2
- package/dist/packages/wje-dropdown/dropdown.element.d.ts +0 -85
- package/dist/packages/wje-element/element.d.ts +0 -313
- package/dist/packages/wje-element/service/universal-service.d.ts +0 -18
- package/dist/packages/wje-file-upload/file-upload.d.ts +0 -2
- package/dist/packages/wje-file-upload/file-upload.element.d.ts +0 -191
- package/dist/packages/wje-file-upload/service/service.d.ts +0 -70
- package/dist/packages/wje-file-upload-item/file-upload-item.d.ts +0 -2
- package/dist/packages/wje-file-upload-item/file-upload-item.element.d.ts +0 -62
- package/dist/packages/wje-footer/footer.d.ts +0 -2
- package/dist/packages/wje-footer/footer.element.d.ts +0 -28
- package/dist/packages/wje-form/form.d.ts +0 -2
- package/dist/packages/wje-form/form.element.d.ts +0 -28
- package/dist/packages/wje-format-digital/format-digital.d.ts +0 -2
- package/dist/packages/wje-format-digital/format-digital.element.d.ts +0 -87
- package/dist/packages/wje-format-digital/format-digital.test.d.ts +0 -1
- package/dist/packages/wje-grid/grid.d.ts +0 -2
- package/dist/packages/wje-grid/grid.element.d.ts +0 -26
- package/dist/packages/wje-header/header.d.ts +0 -2
- package/dist/packages/wje-header/header.element.d.ts +0 -35
- package/dist/packages/wje-icon/icon.d.ts +0 -2
- package/dist/packages/wje-icon/icon.element.d.ts +0 -40
- package/dist/packages/wje-icon/service/service.d.ts +0 -11
- package/dist/packages/wje-icon-picker/icon-picker.d.ts +0 -2
- package/dist/packages/wje-icon-picker/icon-picker.element.d.ts +0 -197
- package/dist/packages/wje-img/img.d.ts +0 -2
- package/dist/packages/wje-img/img.element.d.ts +0 -30
- package/dist/packages/wje-img-comparer/img-comparer.d.ts +0 -2
- package/dist/packages/wje-img-comparer/img-comparer.element.d.ts +0 -60
- package/dist/packages/wje-img-comparer/service/service.d.ts +0 -1
- package/dist/packages/wje-infinite-scroll/infinite-scroll.d.ts +0 -2
- package/dist/packages/wje-infinite-scroll/infinite-scroll.element.d.ts +0 -134
- package/dist/packages/wje-input/input.d.ts +0 -2
- package/dist/packages/wje-input/input.element.d.ts +0 -204
- package/dist/packages/wje-input-file/input-file.d.ts +0 -2
- package/dist/packages/wje-input-file/input-file.element.d.ts +0 -50
- package/dist/packages/wje-item/item.d.ts +0 -2
- package/dist/packages/wje-item/item.element.d.ts +0 -68
- package/dist/packages/wje-kanban/kanban.d.ts +0 -2
- package/dist/packages/wje-kanban/kanban.element.d.ts +0 -183
- package/dist/packages/wje-label/label.d.ts +0 -2
- package/dist/packages/wje-label/label.element.d.ts +0 -34
- package/dist/packages/wje-list/list.d.ts +0 -2
- package/dist/packages/wje-list/list.element.d.ts +0 -31
- package/dist/packages/wje-main/main.d.ts +0 -2
- package/dist/packages/wje-main/main.element.d.ts +0 -30
- package/dist/packages/wje-masonry/masonry.d.ts +0 -2
- package/dist/packages/wje-masonry/masonry.element.d.ts +0 -114
- package/dist/packages/wje-masonry/service/service.d.ts +0 -32
- package/dist/packages/wje-menu/menu.d.ts +0 -2
- package/dist/packages/wje-menu/menu.element.d.ts +0 -47
- package/dist/packages/wje-menu-button/menu-button.d.ts +0 -2
- package/dist/packages/wje-menu-button/menu-button.element.d.ts +0 -34
- package/dist/packages/wje-menu-item/menu-item.d.ts +0 -2
- package/dist/packages/wje-menu-item/menu-item.element.d.ts +0 -139
- package/dist/packages/wje-menu-label/menu-label.d.ts +0 -2
- package/dist/packages/wje-menu-label/menu-label.element.d.ts +0 -39
- package/dist/packages/wje-option/option.d.ts +0 -2
- package/dist/packages/wje-option/option.element.d.ts +0 -59
- package/dist/packages/wje-options/options.d.ts +0 -2
- package/dist/packages/wje-options/options.element.d.ts +0 -180
- package/dist/packages/wje-orgchart/orgchart.d.ts +0 -2
- package/dist/packages/wje-orgchart/orgchart.element.d.ts +0 -24
- package/dist/packages/wje-orgchart-group/orgchart-group.d.ts +0 -2
- package/dist/packages/wje-orgchart-group/orgchart-group.element.d.ts +0 -28
- package/dist/packages/wje-orgchart-item/orgchart-item.d.ts +0 -2
- package/dist/packages/wje-orgchart-item/orgchart-item.element.d.ts +0 -49
- package/dist/packages/wje-panel/panel.d.ts +0 -2
- package/dist/packages/wje-panel/panel.element.d.ts +0 -34
- package/dist/packages/wje-popup/popup.d.ts +0 -2
- package/dist/packages/wje-popup/popup.element.d.ts +0 -93
- package/dist/packages/wje-progress-bar/progress-bar.d.ts +0 -2
- package/dist/packages/wje-progress-bar/progress-bar.element.d.ts +0 -96
- package/dist/packages/wje-qr-code/qr-code.d.ts +0 -2
- package/dist/packages/wje-qr-code/qr-code.element.d.ts +0 -33
- package/dist/packages/wje-radio/radio.d.ts +0 -2
- package/dist/packages/wje-radio/radio.element.d.ts +0 -53
- package/dist/packages/wje-radio-group/radio-group.d.ts +0 -2
- package/dist/packages/wje-radio-group/radio-group.element.d.ts +0 -137
- package/dist/packages/wje-rate/rate.d.ts +0 -2
- package/dist/packages/wje-rate/rate.element.d.ts +0 -156
- package/dist/packages/wje-relative-time/relative-time.d.ts +0 -2
- package/dist/packages/wje-relative-time/relative-time.element.d.ts +0 -55
- package/dist/packages/wje-relative-time/relative-time.test.d.ts +0 -1
- package/dist/packages/wje-reorder/reorder.d.ts +0 -2
- package/dist/packages/wje-reorder/reorder.element.d.ts +0 -119
- package/dist/packages/wje-reorder-dropzone/reorder-dropzone.d.ts +0 -2
- package/dist/packages/wje-reorder-dropzone/reorder-dropzone.element.d.ts +0 -23
- package/dist/packages/wje-reorder-handle/reorder-handle.d.ts +0 -2
- package/dist/packages/wje-reorder-handle/reorder-handle.element.d.ts +0 -75
- package/dist/packages/wje-reorder-item/reorder-item.d.ts +0 -2
- package/dist/packages/wje-reorder-item/reorder-item.element.d.ts +0 -24
- package/dist/packages/wje-route/route.d.ts +0 -2
- package/dist/packages/wje-route/route.element.d.ts +0 -22
- package/dist/packages/wje-router/router.d.ts +0 -2
- package/dist/packages/wje-router/router.element.d.ts +0 -39
- package/dist/packages/wje-router-link/router-link.d.ts +0 -2
- package/dist/packages/wje-router-link/router-link.element.d.ts +0 -31
- package/dist/packages/wje-router-outlet/router-outlet.d.ts +0 -2
- package/dist/packages/wje-router-outlet/router-outlet.element.d.ts +0 -15
- package/dist/packages/wje-row/row.d.ts +0 -2
- package/dist/packages/wje-row/row.element.d.ts +0 -23
- package/dist/packages/wje-select/select.d.ts +0 -2
- package/dist/packages/wje-select/select.element.d.ts +0 -315
- package/dist/packages/wje-slider/slider.d.ts +0 -2
- package/dist/packages/wje-slider/slider.element.d.ts +0 -103
- package/dist/packages/wje-split-view/service/service.d.ts +0 -1
- package/dist/packages/wje-split-view/split-view.d.ts +0 -2
- package/dist/packages/wje-split-view/split-view.element.d.ts +0 -66
- package/dist/packages/wje-status/status.d.ts +0 -2
- package/dist/packages/wje-status/status.element.d.ts +0 -26
- package/dist/packages/wje-step/step.d.ts +0 -2
- package/dist/packages/wje-step/step.element.d.ts +0 -23
- package/dist/packages/wje-stepper/stepper.d.ts +0 -2
- package/dist/packages/wje-stepper/stepper.element.d.ts +0 -78
- package/dist/packages/wje-store/default-store-actions.d.ts +0 -20
- package/dist/packages/wje-store/pubsub.d.ts +0 -21
- package/dist/packages/wje-store/store.d.ts +0 -153
- package/dist/packages/wje-tab/tab.d.ts +0 -2
- package/dist/packages/wje-tab/tab.element.d.ts +0 -41
- package/dist/packages/wje-tab-group/tab-group.d.ts +0 -2
- package/dist/packages/wje-tab-group/tab-group.element.d.ts +0 -67
- package/dist/packages/wje-tab-panel/tab-panel.d.ts +0 -2
- package/dist/packages/wje-tab-panel/tab-panel.element.d.ts +0 -23
- package/dist/packages/wje-textarea/textarea.d.ts +0 -2
- package/dist/packages/wje-textarea/textarea.element.d.ts +0 -176
- package/dist/packages/wje-thumbnail/thumbnail.d.ts +0 -2
- package/dist/packages/wje-thumbnail/thumbnail.element.d.ts +0 -31
- package/dist/packages/wje-timeline/timeline.d.ts +0 -2
- package/dist/packages/wje-timeline/timeline.element.d.ts +0 -25
- package/dist/packages/wje-timeline-item/timeline-item.d.ts +0 -2
- package/dist/packages/wje-timeline-item/timeline-item.element.d.ts +0 -27
- package/dist/packages/wje-toast/toast.d.ts +0 -2
- package/dist/packages/wje-toast/toast.element.d.ts +0 -173
- package/dist/packages/wje-toast/toast.test.d.ts +0 -1
- package/dist/packages/wje-toggle/toggle.d.ts +0 -2
- package/dist/packages/wje-toggle/toggle.element.d.ts +0 -65
- package/dist/packages/wje-toolbar/toolbar.d.ts +0 -2
- package/dist/packages/wje-toolbar/toolbar.element.d.ts +0 -39
- package/dist/packages/wje-toolbar-action/toolbar-action.d.ts +0 -2
- package/dist/packages/wje-toolbar-action/toolbar-action.element.d.ts +0 -35
- package/dist/packages/wje-tooltip/tooltip.d.ts +0 -2
- package/dist/packages/wje-tooltip/tooltip.element.d.ts +0 -71
- package/dist/packages/wje-visually-hidden/visually-hidden.d.ts +0 -2
- package/dist/packages/wje-visually-hidden/visually-hidden.element.d.ts +0 -29
- package/dist/popup.element-tyYxow0p.js +0 -1622
- package/dist/router-links-CJnOdbas.js +0 -149
- package/dist/styles.css +0 -849
- package/dist/wje-accordion-item.js +0 -112
- package/dist/wje-accordion.js +0 -121
- package/dist/wje-animation.js +0 -4323
- package/dist/wje-aside.js +0 -54
- package/dist/wje-avatar.js +0 -89
- package/dist/wje-badge.js +0 -70
- package/dist/wje-breadcrumb.js +0 -194
- package/dist/wje-breadcrumbs.js +0 -139
- package/dist/wje-button-group.js +0 -84
- package/dist/wje-button.js +0 -351
- package/dist/wje-card-content.js +0 -47
- package/dist/wje-card-controls.js +0 -47
- package/dist/wje-card-header.js +0 -47
- package/dist/wje-card-subtitle.js +0 -54
- package/dist/wje-card-title.js +0 -54
- package/dist/wje-card.js +0 -55
- package/dist/wje-carousel-item.js +0 -62
- package/dist/wje-carousel.js +0 -379
- package/dist/wje-checkbox.js +0 -539
- package/dist/wje-chip.js +0 -75
- package/dist/wje-col.js +0 -37
- package/dist/wje-color-picker.js +0 -1338
- package/dist/wje-container.js +0 -55
- package/dist/wje-copy-button.js +0 -217
- package/dist/wje-dialog.js +0 -248
- package/dist/wje-divider.js +0 -54
- package/dist/wje-dropdown.js +0 -193
- package/dist/wje-element.js +0 -966
- package/dist/wje-fetchAndParseCSS.js +0 -59
- package/dist/wje-file-upload-item.js +0 -133
- package/dist/wje-file-upload.js +0 -546
- package/dist/wje-footer.js +0 -51
- package/dist/wje-form.js +0 -52
- package/dist/wje-format-digital.js +0 -145
- package/dist/wje-grid.js +0 -53
- package/dist/wje-header.js +0 -55
- package/dist/wje-icon-picker.js +0 -348
- package/dist/wje-icon.js +0 -190
- package/dist/wje-img-comparer.js +0 -130
- package/dist/wje-img.js +0 -71
- package/dist/wje-infinite-scroll.js +0 -5
- package/dist/wje-input-file.js +0 -110
- package/dist/wje-input.js +0 -451
- package/dist/wje-item.js +0 -87
- package/dist/wje-kanban.js +0 -461
- package/dist/wje-label.js +0 -52
- package/dist/wje-list.js +0 -5
- package/dist/wje-main.js +0 -51
- package/dist/wje-masonry.js +0 -266
- package/dist/wje-master.js +0 -342
- package/dist/wje-menu-button.js +0 -59
- package/dist/wje-menu-item.js +0 -544
- package/dist/wje-menu-label.js +0 -54
- package/dist/wje-menu.js +0 -71
- package/dist/wje-option.js +0 -111
- package/dist/wje-options.js +0 -341
- package/dist/wje-orgchart-group.js +0 -71
- package/dist/wje-orgchart-item.js +0 -97
- package/dist/wje-orgchart.js +0 -48
- package/dist/wje-popup.js +0 -5
- package/dist/wje-progress-bar.js +0 -212
- package/dist/wje-qr-code.js +0 -2891
- package/dist/wje-radio-group.js +0 -227
- package/dist/wje-radio.js +0 -105
- package/dist/wje-rate.js +0 -299
- package/dist/wje-relative-time.js +0 -114
- package/dist/wje-reorder-dropzone.js +0 -48
- package/dist/wje-reorder-handle.js +0 -217
- package/dist/wje-reorder-item.js +0 -60
- package/dist/wje-reorder.js +0 -280
- package/dist/wje-route.js +0 -42
- package/dist/wje-router-link.js +0 -63
- package/dist/wje-router-outlet.js +0 -191
- package/dist/wje-routerx.js +0 -1436
- package/dist/wje-row.js +0 -48
- package/dist/wje-select.js +0 -629
- package/dist/wje-slider.js +0 -220
- package/dist/wje-sliding-container.js +0 -477
- package/dist/wje-split-view.js +0 -152
- package/dist/wje-status.js +0 -60
- package/dist/wje-step.js +0 -49
- package/dist/wje-stepper.js +0 -230
- package/dist/wje-store.js +0 -387
- package/dist/wje-tab-group.js +0 -136
- package/dist/wje-tab-panel.js +0 -45
- package/dist/wje-tab.js +0 -58
- package/dist/wje-textarea.js +0 -372
- package/dist/wje-thumbnail.js +0 -53
- package/dist/wje-toast.js +0 -333
- package/dist/wje-toggle.js +0 -124
- package/dist/wje-toolbar-action.js +0 -71
- package/dist/wje-toolbar.js +0 -62
- package/dist/wje-tooltip.js +0 -165
- package/dist/wje-visually-hidden.js +0 -54
package/dist/wje-toast.js
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import WJElement, { WjElementUtils, event } from "./wje-element.js";
|
|
5
|
-
const styles = "/*\n[ WJ Toast ]\n*/\n\n:host {\n position: relative;\n z-index: 9999;\n width: 300px;\n margin: 0.5rem 0;\n display: none;\n}\n\n:host([open]) {\n display: block;\n}\n\n.native-toast {\n display: flex;\n align-items: center;\n padding: 1rem;\n overflow: hidden;\n margin: 0;\n border-width: 1px;\n border-style: solid;\n border-radius: var(--wje-border-radius-large);\n position: relative;\n\n &.has-media slot[name='media'] {\n flex: 0 0 1.5rem;\n width: 1.5rem;\n display: flex;\n margin-right: 0.5rem;\n justify-content: center;\n }\n\n .content {\n font-size: var(--wje-font-size-small);\n .headline {\n font-size: var(--wje-font-size);\n font-weight: var(--wje-font-weight-bold);\n }\n }\n\n wje-button {\n --wje-button-margin-inline: auto 0;\n margin-left: auto !important;\n }\n\n .countdown {\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n height: 4px;\n .countdown-bar {\n height: 100%;\n }\n }\n}\n\n:host([position='top']) {\n animation: slideDown 0.3s ease-out forwards;\n top: 1rem;\n left: auto;\n right: auto;\n}\n\n:host::part(icon) {\n margin-right: 0.5rem;\n}\n\n@keyframes slideDown {\n 0% {\n transform: translateY(-100%);\n }\n 100% {\n transform: translateY(0);\n }\n}\n\n/*PRIMARY*/\n:host([color='primary']) .native-toast {\n background-color: var(--wje-color-primary-1);\n color: var(--wje-color-primary-9);\n border-color: var(--wje-color-primary-3);\n}\n\n/*COMPLETE*/\n:host([color='complete']) .native-toast {\n background-color: var(--wje-color-complete-1);\n color: var(--wje-color-complete-9);\n border-color: var(--wje-color-complete-3);\n}\n\n/*SUCCESS*/\n:host([color='success']) .native-toast {\n background-color: var(--wje-color-success-1);\n color: var(--wje-color-success-9);\n border-color: var(--wje-color-success-3);\n}\n\n/*WARNING*/\n:host([color='warning']) .native-toast {\n background-color: var(--wje-color-warning-1);\n color: var(--wje-color-warning-11);\n border-color: var(--wje-color-warning-3);\n}\n\n/*DANGER*/\n:host([color='danger']) .native-toast {\n background-color: var(--wje-color-danger-1);\n color: var(--wje-color-danger-9);\n border-color: var(--wje-color-danger-3);\n}\n\n/*INFO*/\n:host([color='info']) .native-toast {\n background-color: var(--wje-color-info-1);\n color: var(--wje-color-info-11);\n border-color: var(--wje-color-info-4);\n}\n\n/*CONTRAST*/\n:host([color='contrast']) .native-toast {\n background-color: var(--wje-color-contrast-2);\n color: var(--wje-color-contrast-9);\n border-color: var(--wje-color-contrast-3);\n}\n\n/*PRIMARY*/\n:host([color='primary']) .countdown-bar {\n background-color: var(--wje-color-primary-9);\n}\n\n/*COMPLETE*/\n:host([color='complete']) .countdown-bar {\n background-color: var(--wje-color-complete-9);\n}\n\n/*SUCCESS*/\n:host([color='success']) .countdown-bar {\n background-color: var(--wje-color-success-9);\n}\n\n/*WARNING*/\n:host([color='warning']) .countdown-bar {\n background-color: var(--wje-color-warning-9);\n}\n\n/*DANGER*/\n:host([color='danger']) .countdown-bar {\n background-color: var(--wje-color-danger-9);\n}\n\n/*INFO*/\n:host([color='info']) .countdown-bar {\n background-color: var(--wje-color-info-9);\n}\n\n/*CONTRAST*/\n:host([color='contrast']) .countdown-bar {\n background-color: var(--wje-color-contrast-9);\n}\n";
|
|
6
|
-
class Toast extends WJElement {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of Toast.
|
|
9
|
-
*/
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
/**
|
|
13
|
-
* The class name for the component.
|
|
14
|
-
* @type {string}
|
|
15
|
-
*/
|
|
16
|
-
__publicField(this, "className", "Toast");
|
|
17
|
-
/**
|
|
18
|
-
* Asynchronously shows the toast notification.
|
|
19
|
-
* This method sets the `open` property to `true` and dispatches the
|
|
20
|
-
* `wje-toast:after-show` custom event. If the toast is already open,
|
|
21
|
-
* the method returns `undefined`.
|
|
22
|
-
*/
|
|
23
|
-
__publicField(this, "show", () => {
|
|
24
|
-
if (this.open) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
this.open = true;
|
|
28
|
-
event.dispatchCustomEvent(this, "wje-toast:after-show");
|
|
29
|
-
});
|
|
30
|
-
/**
|
|
31
|
-
* Asynchronously hides the toast notification.
|
|
32
|
-
* This method sets the `open` property to `false` and dispatches the
|
|
33
|
-
* `wje-toast:after-hide` custom event. If the toast is already hidden,
|
|
34
|
-
* the method returns `undefined`.
|
|
35
|
-
*/
|
|
36
|
-
__publicField(this, "hide", () => {
|
|
37
|
-
if (!this.open) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
this.open = false;
|
|
41
|
-
event.dispatchCustomEvent(this, "wje-toast:after-hide");
|
|
42
|
-
});
|
|
43
|
-
/**
|
|
44
|
-
* Pauses the countdown animation and stops the timer.
|
|
45
|
-
*/
|
|
46
|
-
__publicField(this, "pause", () => {
|
|
47
|
-
var _a;
|
|
48
|
-
(_a = this.countdownAnimation) == null ? void 0 : _a.pause();
|
|
49
|
-
this.stopTimer();
|
|
50
|
-
});
|
|
51
|
-
/**
|
|
52
|
-
* Resumes the countdown animation and resumes the timer.
|
|
53
|
-
*/
|
|
54
|
-
__publicField(this, "resume", () => {
|
|
55
|
-
var _a;
|
|
56
|
-
(_a = this.countdownAnimation) == null ? void 0 : _a.play();
|
|
57
|
-
this.resumeTimer();
|
|
58
|
-
});
|
|
59
|
-
/**
|
|
60
|
-
* Asynchronously starts the toast notification.
|
|
61
|
-
* This method appends the toast notification to the document body and
|
|
62
|
-
* shows the toast notification. The method returns a promise that
|
|
63
|
-
* resolves when the toast notification is shown.
|
|
64
|
-
* @returns {Promise<unknown>}
|
|
65
|
-
*/
|
|
66
|
-
__publicField(this, "start", () => {
|
|
67
|
-
return new Promise((resolve) => {
|
|
68
|
-
let stack = document.body.querySelector(".wje-toast-stack");
|
|
69
|
-
if (stack) {
|
|
70
|
-
this.toastStack = stack;
|
|
71
|
-
}
|
|
72
|
-
if (this.toastStack.parentElement === null) {
|
|
73
|
-
document.body.append(this.toastStack);
|
|
74
|
-
}
|
|
75
|
-
this.toastStack.append(this);
|
|
76
|
-
this.show();
|
|
77
|
-
this.addEventListener("wje-toast:after-hide", this.removeChildAndStack);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
this.toastStack = Object.assign(document.createElement("div"), { className: "wje-toast-stack" });
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Set headline value of the toast.
|
|
84
|
-
* @param value
|
|
85
|
-
*/
|
|
86
|
-
set headline(value) {
|
|
87
|
-
this.setAttribute("headline", value);
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Get headline value of the toast.
|
|
91
|
-
* @returns {string}
|
|
92
|
-
*/
|
|
93
|
-
get headline() {
|
|
94
|
-
return this.getAttribute("headline");
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Set open value of the toast.
|
|
98
|
-
* @param value
|
|
99
|
-
*/
|
|
100
|
-
set open(value) {
|
|
101
|
-
this.removeAttribute("open");
|
|
102
|
-
if (WjElementUtils.stringToBoolean(value)) this.setAttribute("open", value);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Get open value of the toast.
|
|
106
|
-
* @returns {boolean}
|
|
107
|
-
*/
|
|
108
|
-
get open() {
|
|
109
|
-
return this.hasAttribute("open");
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Set duration value of the toast.
|
|
113
|
-
* @param value
|
|
114
|
-
*/
|
|
115
|
-
set duration(value) {
|
|
116
|
-
this.setAttribute("duration", value);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Get duration value of the toast.
|
|
120
|
-
* @returns {number}
|
|
121
|
-
*/
|
|
122
|
-
get duration() {
|
|
123
|
-
return +this.getAttribute("duration");
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Set closable value of the toast.
|
|
127
|
-
* @param value
|
|
128
|
-
*/
|
|
129
|
-
set closable(value) {
|
|
130
|
-
this.setAttribute("closable", value || "");
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Get closable value of the toast.
|
|
134
|
-
* @returns {boolean}
|
|
135
|
-
*/
|
|
136
|
-
get closable() {
|
|
137
|
-
return this.hasAttribute("closable");
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Set color value of the toast.
|
|
141
|
-
* @param value
|
|
142
|
-
*/
|
|
143
|
-
set color(value) {
|
|
144
|
-
this.setAttribute("color", value);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Get color value of the toast.
|
|
148
|
-
* @returns {string}
|
|
149
|
-
*/
|
|
150
|
-
get color() {
|
|
151
|
-
return this.getAttribute("color");
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Set countdown value of the toast.
|
|
155
|
-
* @param value
|
|
156
|
-
*/
|
|
157
|
-
set countdown(value) {
|
|
158
|
-
if (value) this.setAttribute("countdown", value);
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Get countdown value of the toast.
|
|
162
|
-
* @returns {boolean}
|
|
163
|
-
*/
|
|
164
|
-
get countdown() {
|
|
165
|
-
return this.hasAttribute("countdown");
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Set icon value of the toast.
|
|
169
|
-
* @param value
|
|
170
|
-
*/
|
|
171
|
-
set icon(value) {
|
|
172
|
-
this.setAttribute("icon", value);
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Get icon value of the toast.
|
|
176
|
-
* @returns {string}
|
|
177
|
-
*/
|
|
178
|
-
get icon() {
|
|
179
|
-
return this.getAttribute("icon");
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Returns the CSS stylesheet for the component.
|
|
183
|
-
* @static
|
|
184
|
-
* @returns {CSSStyleSheet} The CSS stylesheet
|
|
185
|
-
*/
|
|
186
|
-
static get cssStyleSheet() {
|
|
187
|
-
return styles;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Setup attributes for the Button element.
|
|
191
|
-
*/
|
|
192
|
-
setupAttributes() {
|
|
193
|
-
this.isShadowRoot = "open";
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Draw method for the toast notification.
|
|
197
|
-
* @returns {object} Document fragment
|
|
198
|
-
*/
|
|
199
|
-
draw() {
|
|
200
|
-
let fragment = document.createDocumentFragment();
|
|
201
|
-
let native = document.createElement("div");
|
|
202
|
-
native.setAttribute("part", "native");
|
|
203
|
-
native.classList.add("native-toast");
|
|
204
|
-
let mediaSlot = document.createElement("slot");
|
|
205
|
-
mediaSlot.setAttribute("name", "media");
|
|
206
|
-
mediaSlot.classList.add("media");
|
|
207
|
-
mediaSlot.addEventListener("slotchange", () => {
|
|
208
|
-
if (WjElementUtils.hasSlotContent(this.context, "media")) {
|
|
209
|
-
mediaSlot.parentElement.classList.add("has-media");
|
|
210
|
-
} else {
|
|
211
|
-
mediaSlot.parentElement.classList.remove("has-media");
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
let content = document.createElement("div");
|
|
215
|
-
content.classList.add("content");
|
|
216
|
-
content.innerHTML = `<div class="headline">${this.headline}</div><div class="message"><slot></slot></div>`;
|
|
217
|
-
let iconX = document.createElement("wje-icon");
|
|
218
|
-
iconX.setAttribute("name", "x");
|
|
219
|
-
let closeBtn = document.createElement("wje-button");
|
|
220
|
-
closeBtn.setAttribute("fill", "link");
|
|
221
|
-
closeBtn.setAttribute("color", this.color);
|
|
222
|
-
closeBtn.setAttribute("size", "small");
|
|
223
|
-
closeBtn.classList.add("close");
|
|
224
|
-
let countdownEl = document.createElement("div");
|
|
225
|
-
countdownEl.classList.add("countdown");
|
|
226
|
-
let countdownBar = document.createElement("div");
|
|
227
|
-
countdownBar.classList.add("countdown-bar");
|
|
228
|
-
closeBtn.appendChild(iconX);
|
|
229
|
-
countdownEl.appendChild(countdownBar);
|
|
230
|
-
if (this.hasAttribute("icon") && this.icon) {
|
|
231
|
-
let icon = document.createElement("wje-icon");
|
|
232
|
-
icon.setAttribute("name", this.icon);
|
|
233
|
-
icon.setAttribute("color", this.color);
|
|
234
|
-
icon.setAttribute("slot", "media");
|
|
235
|
-
icon.setAttribute("part", "icon");
|
|
236
|
-
this.appendChild(icon);
|
|
237
|
-
}
|
|
238
|
-
native.appendChild(mediaSlot);
|
|
239
|
-
native.appendChild(content);
|
|
240
|
-
if (this.closable) native.appendChild(closeBtn);
|
|
241
|
-
if (this.hasAttribute("countdown")) native.appendChild(countdownEl);
|
|
242
|
-
fragment.appendChild(native);
|
|
243
|
-
this.closeBtn = closeBtn;
|
|
244
|
-
this.countdownBar = countdownBar;
|
|
245
|
-
return fragment;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* After draw method for the toast notification.
|
|
249
|
-
*/
|
|
250
|
-
afterDraw() {
|
|
251
|
-
this.closeBtn.addEventListener("wje-button:click", this.hide);
|
|
252
|
-
this.addEventListener("mouseenter", this.pause);
|
|
253
|
-
this.addEventListener("mouseleave", this.resume);
|
|
254
|
-
if (this.hasAttribute("countdown")) {
|
|
255
|
-
const startWidth = "100%";
|
|
256
|
-
const endWidth = "0";
|
|
257
|
-
this.countdownAnimation = this.countdownBar.animate([{ width: startWidth }, { width: endWidth }], {
|
|
258
|
-
duration: this.duration,
|
|
259
|
-
easing: "linear"
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
if (this.duration > 0) {
|
|
263
|
-
this.remainingTime = this.duration;
|
|
264
|
-
this.startTimer();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Before disconnect method
|
|
269
|
-
* This method is called before the element is disconnected from the document.
|
|
270
|
-
*/
|
|
271
|
-
beforeDisconnect() {
|
|
272
|
-
this.closeBtn.removeEventListener("wje-button:click", this.hide);
|
|
273
|
-
this.removeEventListener("wje-toast:after-hide", this.removeChildAndStack);
|
|
274
|
-
this.removeEventListener("mouseenter", this.pause);
|
|
275
|
-
this.removeEventListener("mouseleave", this.resume);
|
|
276
|
-
clearTimeout(this.timeoutID);
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Starts the timer.
|
|
280
|
-
* This method sets the `startTime` property to the current time and sets
|
|
281
|
-
* the `timeoutID` property to the ID of the timeout. The method also
|
|
282
|
-
* dispatches the `wje-toast:after-hide` custom event when the timeout
|
|
283
|
-
* expires.
|
|
284
|
-
*/
|
|
285
|
-
startTimer() {
|
|
286
|
-
this.startTime = Date.now();
|
|
287
|
-
if (this.timeoutID) {
|
|
288
|
-
clearTimeout(this.timeoutID);
|
|
289
|
-
}
|
|
290
|
-
this.timeoutID = window.setTimeout(() => {
|
|
291
|
-
this.hide();
|
|
292
|
-
}, this.remainingTime);
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Stops the timer.
|
|
296
|
-
* This method clears the timeout and calculates the remaining time.
|
|
297
|
-
* The method is called when the toast notification is paused.
|
|
298
|
-
*/
|
|
299
|
-
stopTimer() {
|
|
300
|
-
if (this.timeoutID) {
|
|
301
|
-
window.clearTimeout(this.timeoutID);
|
|
302
|
-
}
|
|
303
|
-
const elapsedTime = Date.now() - this.startTime;
|
|
304
|
-
this.remainingTime -= elapsedTime;
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Resumes the timer.
|
|
308
|
-
* This method resumes the timer if the remaining time is greater
|
|
309
|
-
* than zero. The method is called when the toast notification is resumed.
|
|
310
|
-
*/
|
|
311
|
-
resumeTimer() {
|
|
312
|
-
if (this.remainingTime > 0) {
|
|
313
|
-
this.startTimer();
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Removes the toast notification and the toast stack.
|
|
318
|
-
*
|
|
319
|
-
* This method removes the toast notification from the toast stack and
|
|
320
|
-
* removes the toast stack from the document body if the toast stack is
|
|
321
|
-
* empty.
|
|
322
|
-
*/
|
|
323
|
-
removeChildAndStack() {
|
|
324
|
-
this.toastStack.removeChild(this);
|
|
325
|
-
if (this.toastStack.querySelector("wje-toast") === null) {
|
|
326
|
-
this.toastStack.remove();
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
Toast.define("wje-toast", Toast);
|
|
331
|
-
export {
|
|
332
|
-
Toast as default
|
|
333
|
-
};
|
package/dist/wje-toggle.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import WJElement, { event } from "./wje-element.js";
|
|
5
|
-
const styles = "/*\n[ WJ Toggle ]\n*/\n\n:host {\n --wje-toggle-color-base: var(--wje-color-contrast-3);\n --wje-toggle-width: 30px;\n --wje-toggle-height: 18px;\n --wje-toggle-border-radius: 50px;\n --wje-toggle-handle-width: 13px;\n --wje-toggle-handle-height: 13px;\n --wje-toggle-handle-border-radius: 9px;\n --wje-toggle-handle-color: #fff;\n --wje-toggle-handle-shadow: 1px 0 1px 0.5px rgba(0, 0, 0, 0.12), 2px 4px 6px rgba(0, 0, 0, 0.2);\n --wje-toggle-handle-shadow-checked: 1px 1px 0 rgba(0, 0, 0, 0.08), -3px 3px 6px rgba(0, 0, 0, 0.3);\n --wje-toggle-duration: 250ms;\n --wje-toggle-curve: cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n:host([color='primary']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-primary-9) !important;\n}\n\n:host([color='complete']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-complete-9);\n}\n\n:host([color='success']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-success-9) !important;\n}\n\n:host([color='warning']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-warning-9);\n}\n\n:host([color='danger']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-danger-9);\n}\n\n:host([color='info']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-info-9);\n}\n\n.native-toggle {\n display: flex;\n}\n\nlabel {\n display: flex;\n cursor: pointer;\n align-items: center;\n user-select: none;\n .label-wrapper {\n width: var(--wje-toggle-width) !important;\n min-width: var(--wje-toggle-width);\n height: var(--wje-toggle-height);\n position: relative;\n display: flex;\n align-items: center;\n &:before {\n content: '';\n position: absolute;\n cursor: pointer;\n width: 100%;\n height: 100%;\n top: auto;\n left: 0;\n background: var(--wje-toggle-color-base);\n background-size: 300%;\n background-position: right;\n border-radius: var(--wje-toggle-border-radius);\n border: none;\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);\n transition:\n background calc(var(--wje-toggle-duration) + (var(--wje-toggle-duration) * 0.24)),\n box-shadow var(--wje-toggle-duration);\n transition-timing-function: var(--wje-toggle-curve);\n }\n &:after {\n content: '';\n position: absolute;\n transform: translateX(0%);\n background: var(--wje-toggle-handle-color);\n width: var(--wje-toggle-handle-width);\n height: var(--wje-toggle-handle-height);\n border-radius: var(--wje-toggle-handle-border-radius);\n top: auto;\n left: 2px;\n box-shadow: var(--wje-toggle-handle-shadow);\n transition: transform, box-shadow;\n transition-duration: var(--wje-toggle-duration);\n transition-timing-function: var(--wje-toggle-curve);\n }\n }\n}\ninput[type='checkbox'][disabled] {\n & + label {\n cursor: not-allowed !important;\n color: var(--wje-color-contrast-9);\n opacity: 0.58;\n\n &:before {\n cursor: not-allowed !important;\n }\n }\n}\n\ninput[type='checkbox'] {\n position: absolute;\n z-index: -1;\n opacity: 0;\n &:checked {\n & + label {\n .label-wrapper:before {\n background-position: left;\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);\n }\n .label-wrapper:after {\n transform: translateX(calc(var(--wje-toggle-width) - var(--wje-toggle-handle-width) - 4px));\n box-shadow: var(--wje-toggle-handle-shadow-checked);\n }\n }\n }\n &:focus {\n & + label {\n .label-wrapper:before {\n outline: none !important;\n box-shadow:\n inset 0 0 0 1px rgba(0, 0, 0, 0.12),\n 0 0 0 0 #78c8fe;\n }\n }\n }\n &[disabled]:active {\n & + label {\n .label-wrapper:after {\n transform: scaleX(1.1);\n transform-origin: center left;\n transition: transform step-start;\n }\n }\n }\n &:checked {\n &[disabled]:active {\n & + label {\n .label-wrapper:after {\n transform: translateX(calc(100% - 6px)) scaleX(1.1);\n transform-origin: center right;\n }\n }\n }\n }\n &:hover {\n &:active {\n & + label {\n .label-wrapper:before {\n background-color: transparent;\n }\n }\n }\n }\n}\n\n:host .text {\n margin-inline: 0.5rem 0;\n}\n\n/*Placememt*/\n:host([placement='end']) {\n label {\n width: 100%;\n }\n .text {\n margin-inline: 0 0.5rem;\n width: 100%;\n }\n}\n\nslot {\n display: flex;\n align-items: center;\n width: 100%;\n}\n";
|
|
6
|
-
class Toggle extends WJElement {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of Toggle.
|
|
9
|
-
*/
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
/**
|
|
13
|
-
* Set color attribute for the toggle element.
|
|
14
|
-
* @type {string}
|
|
15
|
-
*/
|
|
16
|
-
__publicField(this, "className", "Toggle");
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Set checked attribute for the toggle element.
|
|
20
|
-
*/
|
|
21
|
-
set disabled(value) {
|
|
22
|
-
if (value) this.setAttribute("disabled", "");
|
|
23
|
-
else this.removeAttribute("disabled");
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Get checked attribute for the toggle element.
|
|
27
|
-
* @returns {boolean} true if the toggle is disabled, false otherwise
|
|
28
|
-
*/
|
|
29
|
-
get disabled() {
|
|
30
|
-
return this.hasAttribute("disabled");
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Set checked attribute for the toggle element.
|
|
34
|
-
*/
|
|
35
|
-
set checked(value) {
|
|
36
|
-
if (value) this.setAttribute("checked", "");
|
|
37
|
-
else this.removeAttribute("checked");
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Get checked attribute for the toggle element.
|
|
41
|
-
* @returns {boolean} true if the toggle is checked, false otherwise
|
|
42
|
-
*/
|
|
43
|
-
get checked() {
|
|
44
|
-
return this.hasAttribute("checked");
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Get CSS stylesheet for the Button element.
|
|
48
|
-
* @static
|
|
49
|
-
* @returns {CSSStyleSheet} styles - The CSS stylesheet for the Button element.
|
|
50
|
-
*/
|
|
51
|
-
static get cssStyleSheet() {
|
|
52
|
-
return styles;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Get observed attributes for the toggle element.
|
|
56
|
-
* @returns {string[]}
|
|
57
|
-
*/
|
|
58
|
-
static get observedAttributes() {
|
|
59
|
-
return ["checked", "disabled"];
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Set up the attributes for the toggle element.
|
|
63
|
-
*/
|
|
64
|
-
setupAttributes() {
|
|
65
|
-
this.isShadowRoot = "open";
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Draw the toggle element for the component.
|
|
69
|
-
*/
|
|
70
|
-
draw() {
|
|
71
|
-
let fragment = document.createDocumentFragment();
|
|
72
|
-
let element = document.createElement("div");
|
|
73
|
-
element.setAttribute("part", "native");
|
|
74
|
-
element.classList.add("native-toggle");
|
|
75
|
-
let input = document.createElement("input");
|
|
76
|
-
input.setAttribute("part", "input");
|
|
77
|
-
input.setAttribute("type", "checkbox");
|
|
78
|
-
input.setAttribute("name", this.name);
|
|
79
|
-
input.setAttribute("id", "input");
|
|
80
|
-
input.checked = this.hasAttribute("checked");
|
|
81
|
-
input.disabled = this.hasAttribute("disabled");
|
|
82
|
-
let label = document.createElement("label");
|
|
83
|
-
label.setAttribute("for", "input");
|
|
84
|
-
let labelWrapper = document.createElement("div");
|
|
85
|
-
labelWrapper.setAttribute("part", "toggle");
|
|
86
|
-
labelWrapper.classList.add("label-wrapper");
|
|
87
|
-
let text = document.createElement("div");
|
|
88
|
-
text.classList.add("text");
|
|
89
|
-
text.innerHTML = "<slot></slot>";
|
|
90
|
-
if (this.color) this.classList.add("wje-color-" + this.color, "wje-color");
|
|
91
|
-
element.appendChild(input);
|
|
92
|
-
element.appendChild(label);
|
|
93
|
-
if (this.placement === "end") {
|
|
94
|
-
element.classList.add("end");
|
|
95
|
-
label.appendChild(text);
|
|
96
|
-
label.appendChild(labelWrapper);
|
|
97
|
-
} else {
|
|
98
|
-
label.appendChild(labelWrapper);
|
|
99
|
-
label.appendChild(text);
|
|
100
|
-
}
|
|
101
|
-
fragment.appendChild(element);
|
|
102
|
-
this.input = input;
|
|
103
|
-
return fragment;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* After draw method for the toggle element to add event listeners for the input element after the element is drawn.
|
|
107
|
-
*/
|
|
108
|
-
afterDraw() {
|
|
109
|
-
if (!this.disabled) {
|
|
110
|
-
this.input.addEventListener("input", (e) => {
|
|
111
|
-
this.checked = e.target.checked;
|
|
112
|
-
event.dispatchCustomEvent(this, "wje-toggle:input");
|
|
113
|
-
});
|
|
114
|
-
this.input.addEventListener("change", (e) => {
|
|
115
|
-
this.checked = e.target.checked;
|
|
116
|
-
event.dispatchCustomEvent(this, "wje-toggle:change");
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
Toggle.define("wje-toggle", Toggle);
|
|
122
|
-
export {
|
|
123
|
-
Toggle as default
|
|
124
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import WJElement from "./wje-element.js";
|
|
5
|
-
const styles = "/*\n[ WJ Toolbar Action ]\n*/\n\n:host {\n .native-toolbar-action {\n display: flex;\n }\n}\n";
|
|
6
|
-
class ToolbarAction extends WJElement {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of ToolbarAction.
|
|
9
|
-
*/
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
/**
|
|
13
|
-
* The class name for the component.
|
|
14
|
-
* @type {string}
|
|
15
|
-
*/
|
|
16
|
-
__publicField(this, "className", "ToolbarAction");
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Returns the CSS stylesheet for the component.
|
|
20
|
-
* @static
|
|
21
|
-
* @returns {CSSStyleSheet} The CSS stylesheet
|
|
22
|
-
*/
|
|
23
|
-
static get cssStyleSheet() {
|
|
24
|
-
return styles;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Returns the list of observed attributes.
|
|
28
|
-
* @static
|
|
29
|
-
* @returns {Array} An empty array
|
|
30
|
-
*/
|
|
31
|
-
static get observedAttributes() {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Sets up the attributes for the component.
|
|
36
|
-
*/
|
|
37
|
-
setupAttributes() {
|
|
38
|
-
this.isShadowRoot = "open";
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Draws the component for the toolbar action.
|
|
42
|
-
* @returns {object} Document fragment
|
|
43
|
-
*/
|
|
44
|
-
draw() {
|
|
45
|
-
let fragment = document.createDocumentFragment();
|
|
46
|
-
let maxItems = +this.maxItems || 0;
|
|
47
|
-
let actions = this.getActions();
|
|
48
|
-
let slot = document.createElement("slot");
|
|
49
|
-
let element = document.createElement("div");
|
|
50
|
-
element.setAttribute("part", "native");
|
|
51
|
-
element.classList.add("native-toolbar-action");
|
|
52
|
-
const shouldCollapse = maxItems !== 0 && actions.length > maxItems;
|
|
53
|
-
if (shouldCollapse) {
|
|
54
|
-
element = document.createElement("wje-dropdown");
|
|
55
|
-
}
|
|
56
|
-
element.appendChild(slot);
|
|
57
|
-
fragment.appendChild(element);
|
|
58
|
-
return fragment;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Returns the actions for the toolbar action.
|
|
62
|
-
* @returns {Array} An array of wje-button elements
|
|
63
|
-
*/
|
|
64
|
-
getActions() {
|
|
65
|
-
return Array.from(this.querySelectorAll("wje-button"));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
ToolbarAction.define("wje-toolbar-action", ToolbarAction);
|
|
69
|
-
export {
|
|
70
|
-
ToolbarAction as default
|
|
71
|
-
};
|
package/dist/wje-toolbar.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import WJElement from "./wje-element.js";
|
|
5
|
-
const styles = "/*\n[ WJ Toolbar ]\n*/\n\n:host {\n --wje-toolbar-background: var(--wje-background);\n --wje-toolbar-height: auto;\n --wje-toolbar-min-height: 70px;\n --wje-toolbar-padding-top: 1rem;\n --wje-toolbar-padding-bottom: 1rem;\n --wje-toolbar-padding-inline: 1.5rem;\n --wje-toolbar-border-color: var(--wje-border-color);\n --wje-toolbar-top: 0;\n width: 100%;\n height: var(--wje-toolbar-height);\n}\n\n.native-toolbar {\n background-color: var(--wje-toolbar-background);\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n justify-content: flex-start;\n border-bottom: 1px solid var(--wje-toolbar-border-color);\n padding-inline: var(--wje-toolbar-padding-inline);\n padding-top: var(--wje-toolbar-padding-top);\n padding-bottom: var(--wje-toolbar-padding-bottom);\n box-shadow: 0 10px 30px 0 rgba(82, 63, 105, 0.05);\n}\n\n::slotted {\n grid-column: span 4;\n}\n\n::slotted([slot='start']) {\n margin-right: auto;\n}\n\n:host([sticky]) {\n position: sticky;\n top: var(--wje-toolbar-top);\n z-index: 99;\n}\n";
|
|
6
|
-
class Toolbar extends WJElement {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of Toolbar.
|
|
9
|
-
*/
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
/**
|
|
13
|
-
* The class name for the component.
|
|
14
|
-
* @type {string}
|
|
15
|
-
*/
|
|
16
|
-
__publicField(this, "className", "Toolbar");
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Returns the CSS stylesheet for the component.
|
|
20
|
-
* @static
|
|
21
|
-
* @returns {CSSStyleSheet} The CSS stylesheet
|
|
22
|
-
*/
|
|
23
|
-
static get cssStyleSheet() {
|
|
24
|
-
return styles;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Returns the list of observed attributes.
|
|
28
|
-
* @static
|
|
29
|
-
* @returns {Array} An empty array
|
|
30
|
-
*/
|
|
31
|
-
static get observedAttributes() {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Sets up the attributes for the component.
|
|
36
|
-
*/
|
|
37
|
-
setupAttributes() {
|
|
38
|
-
this.isShadowRoot = "open";
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Draws the component for the toolbar.
|
|
42
|
-
* @returns {object} Document fragment
|
|
43
|
-
*/
|
|
44
|
-
draw() {
|
|
45
|
-
let fragment = document.createDocumentFragment();
|
|
46
|
-
let native = document.createElement("div");
|
|
47
|
-
native.setAttribute("part", "native");
|
|
48
|
-
native.classList.add("native-toolbar");
|
|
49
|
-
let start = document.createElement("slot");
|
|
50
|
-
start.setAttribute("name", "start");
|
|
51
|
-
let end = document.createElement("slot");
|
|
52
|
-
end.setAttribute("name", "end");
|
|
53
|
-
native.appendChild(start);
|
|
54
|
-
native.appendChild(end);
|
|
55
|
-
fragment.appendChild(native);
|
|
56
|
-
return fragment;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
Toolbar.define("wje-toolbar", Toolbar);
|
|
60
|
-
export {
|
|
61
|
-
Toolbar as default
|
|
62
|
-
};
|