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-slider.js
DELETED
|
@@ -1,220 +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 = ":host {\n --wje-slider-track-height: 0.25rem;\n --wje-slider-color: var(--wje-color-primary-9); /* Predvolená farba */\n --wje-slider-thumb-color: var(--wje-color-primary-9); /* Farba tiahla */\n --wje-slider-thumb-border: none; /* Predvolene žiadny border */\n --wje-slider-thumb-shadow: none; /* Tieň vo výchozom stave */\n --wje-slider-thumb-shadow-active: color-mix(in hsl, var(--wje-color-contrast-4) 60%, white) 0 0 0 7px;\n --wje-slider-track-color: var(--wje-color-contrast-4); /* Farba tracku */\n\n position: relative;\n display: flex;\n align-items: center;\n max-width: 100%;\n}\n\n.native-slider {\n display: flex;\n position: relative;\n flex-grow: 1;\n align-items: center;\n height: inherit;\n}\n\n.slider {\n display: flex;\n align-items: center;\n position: relative;\n flex: 1 1 0%;\n width: 100%;\n height: var(--height);\n contain: size layout style;\n cursor: grab;\n touch-action: pan-y;\n}\n\ninput[type='range'] {\n -webkit-appearance: none;\n width: 100%;\n height: var(--wje-slider-track-height);\n margin: 0;\n border-radius: 5px;\n background-size: 70% 100%;\n background-repeat: no-repeat;\n background-color: var(--wje-slider-track-color);\n background-image: linear-gradient(var(--wje-slider-color), var(--wje-slider-color));\n}\n\ninput[type='range']::-webkit-slider-thumb {\n -webkit-appearance: none;\n height: 18px;\n width: 18px;\n border-radius: 50%;\n border: var(--wje-slider-thumb-border); /* Nastaviteľný border (predvolený: none) */\n background: var(--wje-slider-thumb-color); /* Farba tiahla */\n box-shadow: var(--wje-slider-thumb-shadow); /* Tieň vo výchozom stave */\n cursor: ew-resize;\n transition: background 0.3s ease-in-out, border 0.3s ease-in-out;\n}\n\ninput[type='range']::-moz-range-thumb {\n height: 18px;\n width: 18px;\n border-radius: 50%;\n border: var(--wje-slider-thumb-border); /* Nastaviteľný border (predvolený: none) */\n background: var(--wje-slider-thumb-color); /* Farba tiahla */\n box-shadow: var(--wje-slider-thumb-shadow); /* Tieň vo výchozom stave */\n cursor: pointer;\n transition: background 0.3s ease-in-out, border 0.3s ease-in-out;\n}\n\ninput[type='range']::-ms-thumb {\n height: 18px;\n width: 18px;\n border-radius: 50%;\n border: var(--wje-slider-thumb-border); /* Nastaviteľný border (predvolený: none) */\n background: var(--wje-slider-thumb-color); /* Farba tiahla */\n box-shadow: var(--wje-slider-thumb-shadow); /* Tieň vo výchozom stave */\n cursor: ew-resize;\n transition: background 0.3s ease-in-out, border 0.3s ease-in-out;\n}\n\ninput[type='range']::-webkit-slider-thumb:active,\ninput[type='range']::-moz-range-thumb:active,\ninput[type='range']::-ms-thumb:active {\n box-shadow: var(--wje-slider-thumb-shadow-active); /* Tieň pri aktívnom stave */\n}\n\ninput[type='range']::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n box-shadow: none;\n border: none;\n background: transparent;\n}\n\ninput[type='range']::-moz-range-track {\n -webkit-appearance: none;\n box-shadow: none;\n border: none;\n background: transparent;\n}\n\ninput[type='range']::-ms-track {\n -webkit-appearance: none;\n box-shadow: none;\n border: none;\n background: transparent;\n}\n\ninput[type='range'][color='primary'] {\n --wje-slider-color: var(--wje-color-primary-9);\n --wje-slider-thumb-color: var(--wje-color-primary-9);\n}\n\ninput[type='range'][color='success'] {\n --wje-slider-color: var(--wje-color-success-9);\n --wje-slider-thumb-color: var(--wje-color-success-9);\n}\n\ninput[type='range'][color='complete'] {\n --wje-slider-color: var(--wje-color-complete-9);\n --wje-slider-thumb-color: var(--wje-color-complete-9);\n}\n\ninput[type='range'][color='danger'] {\n --wje-slider-color: var(--wje-color-danger-9);\n --wje-slider-thumb-color: var(--wje-color-danger-9);\n}\n\ninput[type='range'][color='warning'] {\n --wje-slider-color: var(--wje-color-warning-9);\n --wje-slider-thumb-color: var(--wje-color-warning-9);\n}\n\ninput[type='range'][color='dark'] {\n --wje-slider-color: var(--wje-color-contrast-11);\n --wje-slider-thumb-color: var(--wje-color-contrast-11);\n}\n\ndatalist {\n display: flex;\n justify-content: space-between;\n height: auto;\n overflow: hidden;\n margin-top: 16px;\n\n option::before {\n content: '';\n display: block;\n width: 0;\n height: auto;\n padding-left: 3px;\n text-indent: 0;\n }\n}\n\noutput {\n position: absolute;\n background: var(--wje-color-contrast-11);\n color: var(--wje-color-contrast-0);\n top: -46px;\n padding: 4px 8px;\n border-radius: 4px;\n}\n\n::slotted([slot='label']) {\n margin-inline: 0 0.5rem;\n font-size: var(--wje-font-size);\n}\n\n::slotted([slot='start']) {\n margin-inline: 0rem 0.75rem;\n}\n\n::slotted([slot='end']) {\n margin-inline: 0.75rem 0rem;\n}";
|
|
6
|
-
class Slider extends WJElement {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of Slider.
|
|
9
|
-
* @class
|
|
10
|
-
*/
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
__publicField(this, "className", "Slider");
|
|
14
|
-
/**
|
|
15
|
-
* Sets the handle position of the slider.
|
|
16
|
-
*/
|
|
17
|
-
__publicField(this, "setHandlePosition", () => {
|
|
18
|
-
this.input.style.backgroundSize = this.getPercentage(this.input.min, this.input.max, this.input.value) + "% 100%";
|
|
19
|
-
});
|
|
20
|
-
/**
|
|
21
|
-
* Updates the position and content of a bubble element based on the input value.
|
|
22
|
-
*
|
|
23
|
-
* This function calculates the position of the bubble using the percentage representation
|
|
24
|
-
* of the input's current value relative to its minimum and maximum bounds. It then adjusts
|
|
25
|
-
* the bubble's left position dynamically for aesthetic purposes and updates its displayed
|
|
26
|
-
* content to reflect the current input value.
|
|
27
|
-
*
|
|
28
|
-
* The function relies on the following elements:
|
|
29
|
-
* - `this.input`: Represents the input element with properties `min`, `max`, and `value`.
|
|
30
|
-
* - `this.output`: Represents the bubble element to be positioned and updated.
|
|
31
|
-
*
|
|
32
|
-
* The left positioning of the bubble ensures precise alignment with the input value indicator.
|
|
33
|
-
*/
|
|
34
|
-
__publicField(this, "setBubble", () => {
|
|
35
|
-
let newValue = this.getPercentage(this.input.min, this.input.max, this.input.value);
|
|
36
|
-
this.output.style.left = `calc(${newValue}% + (${8 - newValue * 0.15}px) - ${this.output.offsetWidth / 2}px)`;
|
|
37
|
-
this.output.innerHTML = this.input.value;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Sets the value of the slider.
|
|
42
|
-
* @param {number} value The value to set.
|
|
43
|
-
*/
|
|
44
|
-
set value(value) {
|
|
45
|
-
this.setAttribute("value", value);
|
|
46
|
-
if (this.input) {
|
|
47
|
-
this.input.value = value;
|
|
48
|
-
this.setHandlePosition();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Returns the value of the slider.
|
|
53
|
-
* @returns {number} The value of the slider input.
|
|
54
|
-
*/
|
|
55
|
-
get value() {
|
|
56
|
-
return this.getAttribute("value") || 0;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Sets the minimum value of the slider.
|
|
60
|
-
* @param {number} value The minimum value to set.
|
|
61
|
-
*/
|
|
62
|
-
set min(value) {
|
|
63
|
-
this.setAttribute("min", value);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Returns the minimum value of the slider.
|
|
67
|
-
* @returns {number} The minimum value of the slider.
|
|
68
|
-
*/
|
|
69
|
-
get min() {
|
|
70
|
-
return this.getAttribute("min") || 0;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Sets the maximum value of the slider.
|
|
74
|
-
* @param {number} value The maximum value to set.
|
|
75
|
-
*/
|
|
76
|
-
set max(value) {
|
|
77
|
-
this.setAttribute("max", value);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Returns the maximum value of the slider.
|
|
81
|
-
* @returns {number} The maximum value of the slider.
|
|
82
|
-
*/
|
|
83
|
-
get max() {
|
|
84
|
-
return this.getAttribute("max") || 100;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Sets the step value of the slider.
|
|
88
|
-
* @param {number} value The step value to set.
|
|
89
|
-
*/
|
|
90
|
-
set step(value) {
|
|
91
|
-
this.setAttribute("step", value);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Returns the step value of the slider.
|
|
95
|
-
* @returns {number} The step value of the slider.
|
|
96
|
-
*/
|
|
97
|
-
get step() {
|
|
98
|
-
return this.getAttribute("step") || 1;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Returns the CSS styles for the component.
|
|
102
|
-
* @static
|
|
103
|
-
* @returns {CSSStyleSheet}
|
|
104
|
-
*/
|
|
105
|
-
static get cssStyleSheet() {
|
|
106
|
-
return styles;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Returns the list of attributes to observe for changes.
|
|
110
|
-
* @static
|
|
111
|
-
* @returns {Array<string>}
|
|
112
|
-
*/
|
|
113
|
-
static get observedAttributes() {
|
|
114
|
-
return ["max"];
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Sets up the attributes for the component.
|
|
118
|
-
*/
|
|
119
|
-
setupAttributes() {
|
|
120
|
-
this.isShadowRoot = "open";
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Draws the component for the slider.
|
|
124
|
-
* @returns {DocumentFragment}
|
|
125
|
-
*/
|
|
126
|
-
draw() {
|
|
127
|
-
let fragment = document.createDocumentFragment();
|
|
128
|
-
let element = document.createElement("div");
|
|
129
|
-
element.className = "native-slider";
|
|
130
|
-
element.setAttribute("part", "native");
|
|
131
|
-
let slider = document.createElement("div");
|
|
132
|
-
slider.className = "slider";
|
|
133
|
-
let label = document.createElement("slot");
|
|
134
|
-
label.name = "label";
|
|
135
|
-
let start = document.createElement("slot");
|
|
136
|
-
start.name = "start";
|
|
137
|
-
let end = document.createElement("slot");
|
|
138
|
-
end.name = "end";
|
|
139
|
-
let output = document.createElement("output");
|
|
140
|
-
output.setAttribute("for", "slider");
|
|
141
|
-
output.id = "output";
|
|
142
|
-
output.setAttribute("hidden", "");
|
|
143
|
-
let input = document.createElement("input");
|
|
144
|
-
input.type = "range";
|
|
145
|
-
input.min = this.min;
|
|
146
|
-
input.max = this.max;
|
|
147
|
-
input.step = this.step;
|
|
148
|
-
input.value = this.value;
|
|
149
|
-
input.id = "slider";
|
|
150
|
-
input.name = "slider";
|
|
151
|
-
input.part = "slider";
|
|
152
|
-
input.setAttribute("autocomplete", "off");
|
|
153
|
-
input.setAttribute("color", this.color || "");
|
|
154
|
-
input.addEventListener("input", null, (e) => {
|
|
155
|
-
this.setHandlePosition(e.target);
|
|
156
|
-
});
|
|
157
|
-
slider.appendChild(input);
|
|
158
|
-
if (this.hasAttribute("bubble")) {
|
|
159
|
-
slider.appendChild(output);
|
|
160
|
-
}
|
|
161
|
-
element.appendChild(label);
|
|
162
|
-
element.appendChild(start);
|
|
163
|
-
element.appendChild(slider);
|
|
164
|
-
element.appendChild(end);
|
|
165
|
-
fragment.appendChild(element);
|
|
166
|
-
this.input = input;
|
|
167
|
-
this.output = output;
|
|
168
|
-
return fragment;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Handles the post-rendering logic for a custom slider component. This method performs the following tasks:
|
|
172
|
-
* - Sets the position of the handle.
|
|
173
|
-
* - Displays a bubble indicator with the current value, if the slider has a "bubble" attribute.
|
|
174
|
-
* - Dispatches initialization, movement, and change custom events for the slider input element.
|
|
175
|
-
* - Updates the bubble position and value dynamically on input changes.
|
|
176
|
-
* @returns {void} This method does not return a value.
|
|
177
|
-
*/
|
|
178
|
-
afterDraw() {
|
|
179
|
-
this.setHandlePosition();
|
|
180
|
-
if (this.hasAttribute("bubble")) {
|
|
181
|
-
this.output.innerHTML = this.input.value;
|
|
182
|
-
this.output.removeAttribute("hidden");
|
|
183
|
-
setTimeout(this.setBubble, 50);
|
|
184
|
-
}
|
|
185
|
-
event.dispatchCustomEvent(this.input, "wje-slider:init", {
|
|
186
|
-
value: this.input.value,
|
|
187
|
-
output: this.output
|
|
188
|
-
});
|
|
189
|
-
event.addListener(this.input, "input", null, (e) => {
|
|
190
|
-
this.value = e.target.value;
|
|
191
|
-
event.dispatchCustomEvent(this.input, "wje-slider:move", {
|
|
192
|
-
value: e.target.value,
|
|
193
|
-
output: this.output
|
|
194
|
-
});
|
|
195
|
-
if (this.hasAttribute("bubble")) {
|
|
196
|
-
this.setBubble();
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
event.addListener(this.input, "change", null, (e) => {
|
|
200
|
-
event.dispatchCustomEvent(this.input, "wje-slider:change", {
|
|
201
|
-
value: e.target.value,
|
|
202
|
-
output: this.output
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Calculates the percentage of a value within a given range.
|
|
208
|
-
* @param {number} min The minimum value of the range.
|
|
209
|
-
* @param {number} max The maximum value of the range.
|
|
210
|
-
* @param {number} [value] The current value within the range. Defaults to 0 if not provided.
|
|
211
|
-
* @returns {number} The calculated percentage as a number between 0 and 100. Returns 0 if the range is invalid.
|
|
212
|
-
*/
|
|
213
|
-
getPercentage(min, max, value = 0) {
|
|
214
|
-
return Number((value - min) * 100 / (max - min)) || 0;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
Slider.define("wje-slider", Slider);
|
|
218
|
-
export {
|
|
219
|
-
Slider as default
|
|
220
|
-
};
|
|
@@ -1,477 +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 = ":host {\n display: block;\n z-index: 1000;\n /* make css property for width height position and if it is on top lef bottom right */\n}\n\n.sliding-container-wrapper {\n height: 100%;\n position: relative;\n overflow: hidden;\n}\n\n.native-sliding-container {\n overflow: auto;\n}\n";
|
|
6
|
-
class SlidingContainer extends WJElement {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of SlidingContainer.
|
|
9
|
-
*
|
|
10
|
-
* @constructor
|
|
11
|
-
*/
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
__publicField(this, "className", "SlidingContainer");
|
|
15
|
-
/**
|
|
16
|
-
* Triggers the event based on the target element.
|
|
17
|
-
* If the target element is different from the last caller, it refreshes the children by calling the `open` method.
|
|
18
|
-
* If the target element is the same as the last caller, it toggles the state by calling the `toggle` method.
|
|
19
|
-
* @param {Event} e - The event object.
|
|
20
|
-
*/
|
|
21
|
-
__publicField(this, "triggerEvent", async (e) => {
|
|
22
|
-
if (this._lastCaller && this._lastCaller !== e.composedPath()[0]) {
|
|
23
|
-
await this.open(e);
|
|
24
|
-
} else {
|
|
25
|
-
await this.toggle(e);
|
|
26
|
-
}
|
|
27
|
-
this._lastCaller = e.composedPath()[0];
|
|
28
|
-
});
|
|
29
|
-
this._isOpen = false;
|
|
30
|
-
this._lastCaller = null;
|
|
31
|
-
this._resizeObserver = new ResizeObserver((entries) => {
|
|
32
|
-
for (let entry of entries) {
|
|
33
|
-
if (entry.contentBoxSize) {
|
|
34
|
-
if (this.drawingStatus < 3) return;
|
|
35
|
-
if (this.screenBreakPoint && window.innerWidth <= this.screenBreakPoint) {
|
|
36
|
-
if (this.variant !== "over") {
|
|
37
|
-
this.variant = "over";
|
|
38
|
-
} else {
|
|
39
|
-
this.checkForVariant(this.variant);
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
if (this.variant !== "in-place") {
|
|
43
|
-
this.variant = "in-place";
|
|
44
|
-
} else {
|
|
45
|
-
this.checkForVariant(this.variant);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
this._resizeObserver.observe(document.documentElement);
|
|
52
|
-
}
|
|
53
|
-
set maxWidth(value) {
|
|
54
|
-
this.setAttribute("max-width", value);
|
|
55
|
-
}
|
|
56
|
-
get maxWidth() {
|
|
57
|
-
return this.getAttribute("max-width") ?? "auto";
|
|
58
|
-
}
|
|
59
|
-
set maxHeight(value) {
|
|
60
|
-
this.setAttribute("max-height", value);
|
|
61
|
-
}
|
|
62
|
-
get maxHeight() {
|
|
63
|
-
return this.getAttribute("max-height") ?? "auto";
|
|
64
|
-
}
|
|
65
|
-
set trigger(value) {
|
|
66
|
-
this.setAttribute("trigger", value);
|
|
67
|
-
}
|
|
68
|
-
get trigger() {
|
|
69
|
-
return this.getAttribute("trigger") ?? "sliding-container";
|
|
70
|
-
}
|
|
71
|
-
set direction(value) {
|
|
72
|
-
this.setAttribute("direction", value);
|
|
73
|
-
}
|
|
74
|
-
get direction() {
|
|
75
|
-
return this.getAttribute("direction") ?? "right";
|
|
76
|
-
}
|
|
77
|
-
set removeChildAfterClose(value) {
|
|
78
|
-
this.setAttribute("remove-child-after-close", value);
|
|
79
|
-
}
|
|
80
|
-
get removeChildAfterClose() {
|
|
81
|
-
return this.hasAttribute("remove-child-after-close") ?? false;
|
|
82
|
-
}
|
|
83
|
-
set variant(value) {
|
|
84
|
-
this.setAttribute("variant", value);
|
|
85
|
-
}
|
|
86
|
-
get variant() {
|
|
87
|
-
return this.getAttribute("variant") ?? "in-place";
|
|
88
|
-
}
|
|
89
|
-
get screenBreakPoint() {
|
|
90
|
-
return this.getAttribute("screen-break-point");
|
|
91
|
-
}
|
|
92
|
-
set screenBreakPoint(value) {
|
|
93
|
-
this.setAttribute("screen-break-point", value);
|
|
94
|
-
}
|
|
95
|
-
get animationDuration() {
|
|
96
|
-
return this.getAttribute("animation-duration") ?? "500";
|
|
97
|
-
}
|
|
98
|
-
set animationDuration(value) {
|
|
99
|
-
this.setAttribute("animation-duration", value);
|
|
100
|
-
}
|
|
101
|
-
get animationEasing() {
|
|
102
|
-
return this.getAttribute("animation-easing") ?? "linear";
|
|
103
|
-
}
|
|
104
|
-
set animationEasing(value) {
|
|
105
|
-
this.setAttribute("animation-easing", value);
|
|
106
|
-
}
|
|
107
|
-
get hasOpacity() {
|
|
108
|
-
return this.hasAttribute("has-opacity") ?? false;
|
|
109
|
-
}
|
|
110
|
-
get addToHeight() {
|
|
111
|
-
return this.getAttribute("add-to-height") ?? "0";
|
|
112
|
-
}
|
|
113
|
-
set addToHeight(value) {
|
|
114
|
-
this.setAttribute("add-to-height", value);
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Returns the observed attributes for the component.
|
|
118
|
-
* @returns {string[]}
|
|
119
|
-
*/
|
|
120
|
-
static get observedAttributes() {
|
|
121
|
-
return [
|
|
122
|
-
"max-width",
|
|
123
|
-
"max-height",
|
|
124
|
-
"trigger",
|
|
125
|
-
"direction",
|
|
126
|
-
"variant",
|
|
127
|
-
"screen-break-point",
|
|
128
|
-
"remove-child-after-close",
|
|
129
|
-
"animation-duration",
|
|
130
|
-
"animation-easing",
|
|
131
|
-
"has-opacity"
|
|
132
|
-
];
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Returns the CSS styles for the component.
|
|
136
|
-
*
|
|
137
|
-
* @static
|
|
138
|
-
* @returns {CSSStyleSheet}
|
|
139
|
-
*/
|
|
140
|
-
static get cssStyleSheet() {
|
|
141
|
-
return styles;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Sets up the attributes for the component.
|
|
145
|
-
*/
|
|
146
|
-
setupAttributes() {
|
|
147
|
-
this.isShadowRoot = "open";
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Draws the component.
|
|
151
|
-
*
|
|
152
|
-
* @param {Object} context - The context for drawing.
|
|
153
|
-
* @param {Object} store - The store for drawing.
|
|
154
|
-
* @param {Object} params - The parameters for drawing.
|
|
155
|
-
* @returns {DocumentFragment}
|
|
156
|
-
*/
|
|
157
|
-
draw(context, store, params) {
|
|
158
|
-
let fragment = document.createDocumentFragment();
|
|
159
|
-
this.style.position = "relative";
|
|
160
|
-
this.style.height = "100%";
|
|
161
|
-
this.style.right = "unset";
|
|
162
|
-
this.style.left = "unset";
|
|
163
|
-
this.wrapperDiv = document.createElement("div");
|
|
164
|
-
this.wrapperDiv.classList.add("sliding-container-wrapper");
|
|
165
|
-
this.transparentDiv = document.createElement("div");
|
|
166
|
-
this.transparentDiv.classList.add("sliding-container-transparent");
|
|
167
|
-
if (this._isOpen) {
|
|
168
|
-
this.transparentDiv.style.width = this.maxWidth;
|
|
169
|
-
}
|
|
170
|
-
let native = document.createElement("div");
|
|
171
|
-
native.style.position = "absolute";
|
|
172
|
-
native.style.width = 0;
|
|
173
|
-
if (this.hasOpacity) {
|
|
174
|
-
native.style.opacity = 0;
|
|
175
|
-
}
|
|
176
|
-
if (this._isOpen) {
|
|
177
|
-
native.style.width = this.maxWidth;
|
|
178
|
-
if (this.hasOpacity) {
|
|
179
|
-
native.style.opacity = 1;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
native.style.height = "100%";
|
|
183
|
-
native.classList.add("native-sliding-container");
|
|
184
|
-
native.setAttribute("part", "sliding-container");
|
|
185
|
-
if (this.direction === "right") {
|
|
186
|
-
native.style.right = 0;
|
|
187
|
-
} else {
|
|
188
|
-
native.style.left = 0;
|
|
189
|
-
}
|
|
190
|
-
let slot = document.createElement("slot");
|
|
191
|
-
const nativeInner = document.createElement("div");
|
|
192
|
-
nativeInner.classList.add("native-sliding-container-inner");
|
|
193
|
-
nativeInner.style.height = "100%";
|
|
194
|
-
nativeInner.style.position = "absolute";
|
|
195
|
-
nativeInner.style.width = this.maxWidth;
|
|
196
|
-
nativeInner.appendChild(slot);
|
|
197
|
-
nativeInner.appendChild(this.getCloseButton());
|
|
198
|
-
native.appendChild(nativeInner);
|
|
199
|
-
this.wrapperDiv.appendChild(this.transparentDiv);
|
|
200
|
-
this.wrapperDiv.appendChild(native);
|
|
201
|
-
fragment.appendChild(this.wrapperDiv);
|
|
202
|
-
this.nativeElement = native;
|
|
203
|
-
return fragment;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Creates and returns a close button element.
|
|
207
|
-
* @returns {HTMLElement} The close button element.
|
|
208
|
-
*/
|
|
209
|
-
getCloseButton() {
|
|
210
|
-
let closeButton = document.createElement("wje-button");
|
|
211
|
-
closeButton.setAttribute("part", "close-button");
|
|
212
|
-
closeButton.style.position = "absolute";
|
|
213
|
-
closeButton.style.top = "0";
|
|
214
|
-
closeButton.style.right = "0";
|
|
215
|
-
closeButton.style.zIndex = "1000";
|
|
216
|
-
let icon = document.createElement("wje-icon");
|
|
217
|
-
icon.setAttribute("slot", "icon-only");
|
|
218
|
-
icon.setAttribute("name", "x");
|
|
219
|
-
closeButton.appendChild(icon);
|
|
220
|
-
closeButton.addEventListener("click", () => {
|
|
221
|
-
this.close();
|
|
222
|
-
});
|
|
223
|
-
return closeButton;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Executes before drawing the element.
|
|
227
|
-
*/
|
|
228
|
-
beforeDraw() {
|
|
229
|
-
var _a, _b;
|
|
230
|
-
(_a = this.animation) == null ? void 0 : _a.cancel();
|
|
231
|
-
(_b = this.nativeAnimation) == null ? void 0 : _b.cancel();
|
|
232
|
-
document.removeEventListener(this.trigger, this.triggerEvent);
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Performs actions after the element is drawn on the screen.
|
|
236
|
-
* Attaches an event listener to the document based on the specified trigger.
|
|
237
|
-
* Sets the variant to "over" if the document width is smaller than the screen break point.
|
|
238
|
-
* Calls the checkForVariant method with the current variant.
|
|
239
|
-
* @returns {Promise<void>} A promise that resolves after the actions are completed.
|
|
240
|
-
*/
|
|
241
|
-
afterDraw() {
|
|
242
|
-
document.addEventListener(this.trigger, this.triggerEvent);
|
|
243
|
-
if (this.screenBreakPoint && window.innerWidth <= this.screenBreakPoint) {
|
|
244
|
-
this.variant = "over";
|
|
245
|
-
}
|
|
246
|
-
this.checkForVariant(this.variant);
|
|
247
|
-
}
|
|
248
|
-
getParentElement() {
|
|
249
|
-
let parentElement = this.parentElement;
|
|
250
|
-
if (!parentElement) {
|
|
251
|
-
parentElement = this.getRootNode().host;
|
|
252
|
-
}
|
|
253
|
-
return parentElement;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Checks for a specific variant and applies corresponding styles.
|
|
257
|
-
*
|
|
258
|
-
* @param {string} variant - The variant to check for.
|
|
259
|
-
*/
|
|
260
|
-
checkForVariant(variant) {
|
|
261
|
-
if (variant === "over") {
|
|
262
|
-
this.style.position = "fixed";
|
|
263
|
-
let computentStyleOfParent = window.getComputedStyle(this.getParentElement());
|
|
264
|
-
let parentElementBoundingbox = this.getParentElement().getBoundingClientRect();
|
|
265
|
-
let heightOfParrentElement = parseFloat(computentStyleOfParent.height);
|
|
266
|
-
let topOfParrentElement = parseFloat(computentStyleOfParent.top);
|
|
267
|
-
this.style.height = heightOfParrentElement + +this.addToHeight + "px";
|
|
268
|
-
this.wrapperDiv.style.height = heightOfParrentElement + +this.addToHeight + "px";
|
|
269
|
-
this.style.top = topOfParrentElement + "px";
|
|
270
|
-
const leftSibling = this.previousElementSibling;
|
|
271
|
-
const rightSibling = this.nextElementSibling;
|
|
272
|
-
const leftSiblingBoundingbox = leftSibling == null ? void 0 : leftSibling.getBoundingClientRect();
|
|
273
|
-
const rightSiblingBoundingbox = rightSibling == null ? void 0 : rightSibling.getBoundingClientRect();
|
|
274
|
-
if (this.direction === "right") {
|
|
275
|
-
if (leftSiblingBoundingbox) {
|
|
276
|
-
this.style.left = leftSiblingBoundingbox.left + leftSiblingBoundingbox.width + "px";
|
|
277
|
-
} else {
|
|
278
|
-
this.style.left = parentElementBoundingbox.left + "px";
|
|
279
|
-
}
|
|
280
|
-
} else {
|
|
281
|
-
if (rightSiblingBoundingbox) {
|
|
282
|
-
this.style.right = window.innerWidth - rightSiblingBoundingbox.left + "px";
|
|
283
|
-
} else {
|
|
284
|
-
this.style.right = window.innerWidth - (parentElementBoundingbox.left + parentElementBoundingbox.width) + "px";
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Executes before the element is opened.
|
|
291
|
-
*/
|
|
292
|
-
beforeOpen(event) {
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Callback function called after the element is opened.
|
|
296
|
-
*/
|
|
297
|
-
afterOpen(event) {
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Executes before closing the element.
|
|
301
|
-
*/
|
|
302
|
-
beforeClose(event) {
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Callback function that is called after the container is closed.
|
|
306
|
-
*/
|
|
307
|
-
afterClose(event) {
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Animates the transition of the element's width from 0 to the maximum width or vice versa.
|
|
311
|
-
* @returns {Promise<void>} A promise that resolves when the animation is complete.
|
|
312
|
-
*/
|
|
313
|
-
doAnimateTransition() {
|
|
314
|
-
var _a, _b, _c, _d;
|
|
315
|
-
const options = {
|
|
316
|
-
delay: 0,
|
|
317
|
-
endDelay: 0,
|
|
318
|
-
fill: "forwards",
|
|
319
|
-
duration: +this.animationDuration,
|
|
320
|
-
iterationStart: 0,
|
|
321
|
-
iterations: 1,
|
|
322
|
-
direction: "normal",
|
|
323
|
-
easing: this.animationEasing
|
|
324
|
-
};
|
|
325
|
-
if (this.animation && ((_b = (_a = this.animation) == null ? void 0 : _a.effect) == null ? void 0 : _b.target) !== this.transparentDiv) {
|
|
326
|
-
this.animation.cancel();
|
|
327
|
-
this.animation = null;
|
|
328
|
-
}
|
|
329
|
-
if (this.nativeAnimation && ((_d = (_c = this.nativeAnimation) == null ? void 0 : _c.effect) == null ? void 0 : _d.target) !== this.nativeElement) {
|
|
330
|
-
this.nativeAnimation.cancel();
|
|
331
|
-
this.nativeAnimation = null;
|
|
332
|
-
}
|
|
333
|
-
if (!this._isOpen) {
|
|
334
|
-
if (this.animation && this.nativeAnimation) {
|
|
335
|
-
this.animation.reverse();
|
|
336
|
-
this.nativeAnimation.reverse();
|
|
337
|
-
} else {
|
|
338
|
-
this.animation = this.transparentDiv.animate(
|
|
339
|
-
[
|
|
340
|
-
{
|
|
341
|
-
width: 0
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
width: this.maxWidth
|
|
345
|
-
}
|
|
346
|
-
],
|
|
347
|
-
options
|
|
348
|
-
);
|
|
349
|
-
this.nativeAnimation = this.nativeElement.animate(
|
|
350
|
-
[
|
|
351
|
-
{
|
|
352
|
-
...this.hasOpacity ? { opacity: 0 } : {},
|
|
353
|
-
width: 0
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
...this.hasOpacity ? { opacity: 1 } : {},
|
|
357
|
-
width: this.maxWidth
|
|
358
|
-
}
|
|
359
|
-
],
|
|
360
|
-
options
|
|
361
|
-
);
|
|
362
|
-
}
|
|
363
|
-
} else {
|
|
364
|
-
if (this.animation && this.nativeAnimation) {
|
|
365
|
-
this.animation.reverse();
|
|
366
|
-
this.nativeAnimation.reverse();
|
|
367
|
-
} else {
|
|
368
|
-
this.animation = this.transparentDiv.animate(
|
|
369
|
-
[
|
|
370
|
-
{
|
|
371
|
-
width: this.maxWidth
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
width: 0
|
|
375
|
-
}
|
|
376
|
-
],
|
|
377
|
-
options
|
|
378
|
-
);
|
|
379
|
-
this.nativeAnimation = this.nativeElement.animate(
|
|
380
|
-
[
|
|
381
|
-
{
|
|
382
|
-
...this.hasOpacity ? { opacity: 1 } : {},
|
|
383
|
-
width: this.maxWidth
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
...this.hasOpacity ? { opacity: 0 } : {},
|
|
387
|
-
width: 0
|
|
388
|
-
}
|
|
389
|
-
],
|
|
390
|
-
options
|
|
391
|
-
);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
return new Promise((resolve, reject) => {
|
|
395
|
-
this.animation.onfinish = () => {
|
|
396
|
-
this._isOpen = !this._isOpen;
|
|
397
|
-
resolve();
|
|
398
|
-
};
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* Opens the container with an animation.
|
|
403
|
-
* @returns {Promise<void>} A promise that resolves when the container is opened.
|
|
404
|
-
*/
|
|
405
|
-
async open(event) {
|
|
406
|
-
await Promise.resolve(this.beforeOpen(event)).then(async () => {
|
|
407
|
-
if (!this._isOpen) {
|
|
408
|
-
this.dispatchEvent(
|
|
409
|
-
new CustomEvent("wje-sliding-container:beforeOpen", {
|
|
410
|
-
bubbles: true,
|
|
411
|
-
composed: true
|
|
412
|
-
})
|
|
413
|
-
);
|
|
414
|
-
await this.doAnimateTransition();
|
|
415
|
-
await Promise.resolve(this.afterOpen(event)).then(() => {
|
|
416
|
-
this.dispatchEvent(
|
|
417
|
-
new CustomEvent("wje-sliding-container:open", {
|
|
418
|
-
bubbles: true,
|
|
419
|
-
composed: true
|
|
420
|
-
})
|
|
421
|
-
);
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Closes the animation container.
|
|
428
|
-
*
|
|
429
|
-
* @returns {Promise<void>} A promise that resolves when the container is closed.
|
|
430
|
-
*/
|
|
431
|
-
async close(event) {
|
|
432
|
-
await Promise.resolve(this.beforeClose(event)).then(async () => {
|
|
433
|
-
if (this._isOpen) {
|
|
434
|
-
this.dispatchEvent(
|
|
435
|
-
new CustomEvent("wje-sliding-container:beforeClose", {
|
|
436
|
-
bubbles: true,
|
|
437
|
-
composed: true
|
|
438
|
-
})
|
|
439
|
-
);
|
|
440
|
-
await this.doAnimateTransition();
|
|
441
|
-
await Promise.resolve(this.afterClose(event)).then(() => {
|
|
442
|
-
if (this.removeChildAfterClose) {
|
|
443
|
-
this.childNodes.forEach((child) => {
|
|
444
|
-
child.remove();
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
this.dispatchEvent(
|
|
448
|
-
new CustomEvent("wje-sliding-container:close", {
|
|
449
|
-
bubbles: true,
|
|
450
|
-
composed: true
|
|
451
|
-
})
|
|
452
|
-
);
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Toggles the state of the element.
|
|
459
|
-
* If the element is open, it will be closed. If it is closed, it will be opened.
|
|
460
|
-
* @returns {Promise<void>} A promise that resolves when the toggle operation is complete.
|
|
461
|
-
*/
|
|
462
|
-
async toggle(event) {
|
|
463
|
-
if (this._isOpen) {
|
|
464
|
-
await this.close(event);
|
|
465
|
-
} else {
|
|
466
|
-
await this.open(event);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
componentCleanup() {
|
|
470
|
-
this._resizeObserver.disconnect();
|
|
471
|
-
this._resizeObserver = null;
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
SlidingContainer.define("wje-sliding-container", SlidingContainer);
|
|
475
|
-
export {
|
|
476
|
-
SlidingContainer as default
|
|
477
|
-
};
|