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-input.js
DELETED
|
@@ -1,451 +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 Input ]\n*/\n\n:host {\n width: 100%;\n margin-bottom: var(--wje-input-margin-bottom);\n display: block;\n\n .wrapper {\n display: flex;\n width: 100%;\n flex-direction: column;\n }\n .native-input {\n .input-wrapper {\n flex-wrap: wrap;\n display: flex;\n width: 100%;\n position: relative;\n box-sizing: border-box;\n\n label {\n width: 100%;\n }\n }\n &.default {\n background-color: var(--wje-input-background-color);\n font-family: var(--wje-input-font-family);\n position: relative;\n border-radius: var(--wje-input-border-radius);\n border-width: var(--wje-input-border-width);\n border-style: var(--wje-input-border-style);\n border-color: var(--wje-input-border-color);\n padding-inline: 0;\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n transition: background-color 0.2s ease;\n cursor: text;\n .input-wrapper {\n padding-inline: 0.5rem;\n }\n &.focused {\n border-color: var(--wje-input-border-color-focus) !important;\n label {\n opacity: 0.67;\n font-size: 12px;\n letter-spacing: normal;\n }\n }\n input {\n border: none;\n height: 25px;\n min-height: 25px;\n padding: 0;\n margin-top: -4px;\n background: none;\n box-shadow: none;\n width: 100%;\n }\n label {\n margin: 0;\n display: block;\n opacity: 1;\n cursor: text;\n transition: opacity 0.2s ease;\n line-height: var(--wje-input-line-height);\n &.fade {\n opacity: 0.5;\n font-size: 12px;\n letter-spacing: normal;\n }\n }\n ::slotted([slot='start']) {\n border-left: none;\n border-top: none;\n border-bottom: none;\n }\n\n ::slotted([slot='end']) {\n border-right: none;\n border-top: none;\n border-bottom: none;\n }\n }\n &.standard {\n font-family: var(--wje-input-font-family);\n position: relative;\n border-radius: var(--wje-input-border-radius);\n padding-inline: 0;\n padding-top: 0;\n padding-bottom: 0;\n transition: background-color 0.2s ease;\n cursor: text;\n &.focused {\n input {\n border-color: var(--wje-input-border-color-focus) !important;\n }\n }\n input {\n background-color: var(--wje-input-background-color);\n display: block;\n min-height: 32px;\n padding-inline: 0.5rem;\n padding-top: 0;\n padding-bottom: 0;\n /*background: none;*/\n box-shadow: none;\n width: 100%;\n box-sizing: border-box;\n border-radius: var(--wje-input-border-radius);\n border-width: var(--wje-input-border-width);\n border-style: var(--wje-input-border-style);\n border-color: var(--wje-input-border-color);\n }\n label {\n margin: 0;\n display: inline-block;\n opacity: 1;\n cursor: text;\n transition: opacity 0.2s ease;\n line-height: var(--wje-input-line-height);\n }\n .input-wrapper {\n flex-wrap: nowrap;\n &:hover .clear {\n visibility: visible;\n }\n }\n ::slotted([slot='start']) {\n border-right: none;\n border-radius: var(--wje-input-border-radius) 0 0 var(--wje-input-border-radius);\n }\n\n ::slotted([slot='end']) {\n border-left: none;\n border-radius: 0 var(--wje-input-border-radius) var(--wje-input-border-radius) 0;\n }\n\n &.has-start input {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n\n &.has-end input {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n .error-message {\n position: static;\n\n background: transparent;\n padding: 0.25rem 0;\n left: auto;\n transform: none;\n color: var(--wje-input-color-invalid);\n font-size: 12px;\n line-height: normal;\n }\n }\n }\n}\n\n.clear {\n visibility: hidden;\n position: absolute;\n right: 0;\n top: 3px;\n --wje-padding-top: 0.25rem;\n --wje-padding-start: 0.25rem;\n --wje-padding-end: 0.25rem;\n --wje-padding-bottom: 0.25rem;\n --wje-button-margin-inline: 0 0.25rem;\n}\n\n:host([required]) .input-wrapper::after {\n color: var(--wje-input-color-invalid);\n content: '*';\n font-family: var(--wje-force-mac-font-family);\n font-size: 20px;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n:host([required]) .standard .input-wrapper::after {\n top: 0;\n}\n\n:host([invalid]) {\n .error-message {\n display: block;\n }\n .default {\n label {\n opacity: 1 !important;\n color: var(--wje-input-color-invalid) !important;\n animation-name: shake;\n animation-duration: 0.4s;\n animation-iteration-count: 1;\n }\n }\n}\n\n::slotted([slot='start']),\n::slotted([slot='end']) {\n display: flex;\n align-items: center;\n border-width: var(--wje-input-border-width);\n border-style: var(--wje-input-border-style);\n border-color: var(--wje-input-border-color);\n padding-inline: var(--wje-input-slot-padding-inline);\n}\n\n/*\n .options-show is a class that is added to the host element when the select options are shown\n */\n:host(.options-show) ::slotted([slot='start']) {\n border-bottom-left-radius: 0 !important;\n}\n\n:host(.options-show) ::slotted([slot='end']) {\n border-bottom-right-radius: 0 !important;\n}\n\nslot[name='start'],\nslot[name='end'] {\n display: flex;\n}\n\nslot[name='error'] {\n display: none;\n margin-inline: 0.5rem;\n}\n\n:host([invalid]) slot[name='error'] {\n display: block;\n}\n\ninput {\n background-color: var(--wje-input-background-color);\n border-width: var(--wje-input-border-width);\n border-style: var(--wje-input-border-style);\n border-color: var(--wje-input-border-color);\n font-family: var(--wje-input-font-family);\n color: var(--wje-input-color);\n appearance: none;\n outline: 0;\n padding: 0.25rem 0.5rem;\n line-height: var(--wje-input-line-height);\n font-size: 14px;\n font-weight: normal;\n vertical-align: middle;\n min-height: 32px;\n}\n\n.error-message {\n display: none;\n position: absolute;\n max-width: 100%;\n min-width: auto;\n border-radius: 50px;\n background: black;\n padding: 0.25rem 0.5rem;\n top: 0;\n left: 50%;\n transform: translate(-50%, -75%);\n color: white;\n font-size: 12px;\n width: max-content;\n line-height: normal;\n}\n\n@keyframes shake {\n 8%,\n 41% {\n transform: translateX(-4px);\n }\n 25%,\n 58% {\n transform: translateX(4px);\n }\n 75% {\n transform: translateX(-2px);\n }\n 92% {\n transform: translateX(2px);\n }\n 0%,\n 100% {\n transform: translateX(0);\n }\n}\n";
|
|
6
|
-
class Input extends WJElement {
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of Input.
|
|
9
|
-
*/
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
__publicField(this, "observeFunction", (mutations) => {
|
|
13
|
-
mutations.forEach((mutation) => {
|
|
14
|
-
if (mutation.type === "attributes") {
|
|
15
|
-
const attributeName = mutation.attributeName;
|
|
16
|
-
const oldValue = mutation.oldValue;
|
|
17
|
-
const newValue = this.getAttribute(attributeName);
|
|
18
|
-
console.log(`Attribute ${attributeName} changed from ${oldValue} to ${newValue}`);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
this.refresh();
|
|
22
|
-
});
|
|
23
|
-
/**
|
|
24
|
-
* The class name of the input element.
|
|
25
|
-
* @type {string}
|
|
26
|
-
*/
|
|
27
|
-
__publicField(this, "className", "Input");
|
|
28
|
-
this.invalid = false;
|
|
29
|
-
this.pristine = true;
|
|
30
|
-
this.internals = this.attachInternals();
|
|
31
|
-
this.observer = new MutationObserver(this.observeFunction);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Setter for the value attribute.
|
|
35
|
-
* @param {string} value The value to set.
|
|
36
|
-
*/
|
|
37
|
-
set value(value) {
|
|
38
|
-
this.internals.setFormValue(value);
|
|
39
|
-
if (this.input) this.input.value = value;
|
|
40
|
-
this.pristine = false;
|
|
41
|
-
this._value = value;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Getter for the value attribute.
|
|
45
|
-
* @returns {string} The value of the attribute.
|
|
46
|
-
*/
|
|
47
|
-
get value() {
|
|
48
|
-
var _a;
|
|
49
|
-
return ((_a = this.input) == null ? void 0 : _a.value) ?? this._value ?? "";
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Getter for the customErrorDisplay attribute.
|
|
53
|
-
* @returns {boolean} Whether the attribute is present.
|
|
54
|
-
*/
|
|
55
|
-
get customErrorDisplay() {
|
|
56
|
-
return this.hasAttribute("custom-error-display");
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Getter for the validateOnChange attribute.
|
|
60
|
-
* @returns {boolean} Whether the attribute is present.
|
|
61
|
-
*/
|
|
62
|
-
get validateOnChange() {
|
|
63
|
-
return this.hasAttribute("validate-on-change");
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Getter for the invalid attribute.
|
|
67
|
-
* @returns {boolean} Whether the attribute is present.
|
|
68
|
-
*/
|
|
69
|
-
get invalid() {
|
|
70
|
-
return this.hasAttribute("invalid");
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Setter for the invalid attribute.
|
|
74
|
-
* @param {boolean} isInvalid Whether the input is invalid.
|
|
75
|
-
*/
|
|
76
|
-
set invalid(isInvalid) {
|
|
77
|
-
if (isInvalid) this.setAttribute("invalid", "");
|
|
78
|
-
else this.removeAttribute("invalid");
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Getter for the form attribute.
|
|
82
|
-
* @returns {HTMLFormElement} The form the input is associated with.
|
|
83
|
-
*/
|
|
84
|
-
get form() {
|
|
85
|
-
return this.internals.form;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Getter for the name attribute.
|
|
89
|
-
* @returns {string} The name of the input element.
|
|
90
|
-
*/
|
|
91
|
-
get name() {
|
|
92
|
-
return this.getAttribute("name");
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Getter for the type attribute.
|
|
96
|
-
* @returns {string} The type of the input element.
|
|
97
|
-
*/
|
|
98
|
-
get type() {
|
|
99
|
-
return this.localName;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Getter for the validity attribute.
|
|
103
|
-
* @returns {ValidityState} The validity state of the input.
|
|
104
|
-
*/
|
|
105
|
-
get validity() {
|
|
106
|
-
return this.internals.validity;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Getter for the validationMessage attribute.
|
|
110
|
-
* @returns {string} The validation message of the input element.
|
|
111
|
-
*/
|
|
112
|
-
get validationMessage() {
|
|
113
|
-
return this.internals.validationMessage;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Getter for the willValidate attribute.
|
|
117
|
-
* @returns {boolean} Whether the input will be validated.
|
|
118
|
-
*/
|
|
119
|
-
get willValidate() {
|
|
120
|
-
return this.internals.willValidate;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* @summary Getter for the defaultValue attribute.
|
|
124
|
-
* This method retrieves the 'value' attribute of the custom input element.
|
|
125
|
-
* The 'value' attribute represents the default value of the input element.
|
|
126
|
-
* If the 'value' attribute is not set, it returns an empty string.
|
|
127
|
-
* @returns {string} The default value of the input element.
|
|
128
|
-
*/
|
|
129
|
-
get defaultValue() {
|
|
130
|
-
return this.getAttribute("value") ?? "";
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* @summary Setter for the defaultValue attribute.
|
|
134
|
-
* This method sets the 'value' attribute of the custom input element to the provided value.
|
|
135
|
-
* The 'value' attribute represents the default value of the input element.
|
|
136
|
-
* @param {string} value The value to set as the default value.
|
|
137
|
-
*/
|
|
138
|
-
set defaultValue(value) {
|
|
139
|
-
this.setAttribute("value", value);
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Getter for the cssStyleSheet attribute.
|
|
143
|
-
* @returns {CSSStyleSheet} The CSS style sheet of the input element.
|
|
144
|
-
*/
|
|
145
|
-
static get cssStyleSheet() {
|
|
146
|
-
return styles;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Getter for the observedAttributes attribute of the input element.
|
|
150
|
-
* @returns {Array} The attributes to observe for changes.
|
|
151
|
-
*/
|
|
152
|
-
static get observedAttributes() {
|
|
153
|
-
return [];
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Sets up the attributes for the input.
|
|
157
|
-
*/
|
|
158
|
-
setupAttributes() {
|
|
159
|
-
this.isShadowRoot = "open";
|
|
160
|
-
if (this.pristine) {
|
|
161
|
-
this.value = this.defaultValue;
|
|
162
|
-
this.pristine = false;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
beforeDraw() {
|
|
166
|
-
this.observer.disconnect();
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Draws the input element.
|
|
170
|
-
* @returns {DocumentFragment} The drawn input.
|
|
171
|
-
*/
|
|
172
|
-
draw() {
|
|
173
|
-
let hasSlotStart = this.hasSlot(this, "start");
|
|
174
|
-
let hasSlotEnd = this.hasSlot(this, "end");
|
|
175
|
-
let hasSlotError = this.hasSlot(this, "error");
|
|
176
|
-
let fragment = document.createDocumentFragment();
|
|
177
|
-
let native = document.createElement("div");
|
|
178
|
-
native.setAttribute("part", "native");
|
|
179
|
-
native.classList.add("native-input", this.variant || "default");
|
|
180
|
-
if (this.hasAttribute("invalid")) native.classList.add("has-error");
|
|
181
|
-
let wrapper = document.createElement("div");
|
|
182
|
-
wrapper.classList.add("wrapper");
|
|
183
|
-
let inputWrapper = document.createElement("div");
|
|
184
|
-
inputWrapper.setAttribute("part", "wrapper");
|
|
185
|
-
inputWrapper.classList.add("input-wrapper");
|
|
186
|
-
let label = document.createElement("label");
|
|
187
|
-
label.innerText = this.label;
|
|
188
|
-
if (this.value && !this.hasAttribute("error")) label.classList.add("fade");
|
|
189
|
-
let input = document.createElement("input");
|
|
190
|
-
input.setAttribute("type", "text");
|
|
191
|
-
input.setAttribute("part", "input");
|
|
192
|
-
input.setAttribute("value", this.value || "");
|
|
193
|
-
input.classList.add("form-control");
|
|
194
|
-
const attributes = Array.from(this.attributes).map((attr) => attr.name);
|
|
195
|
-
attributes.forEach((attr) => {
|
|
196
|
-
if (this.hasAttribute(attr)) {
|
|
197
|
-
input.setAttribute(attr, this[attr] || "");
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
let error = document.createElement("div");
|
|
201
|
-
error.classList.add("error-message");
|
|
202
|
-
error.setAttribute("part", "error");
|
|
203
|
-
let errorSlot = null;
|
|
204
|
-
if (hasSlotError) {
|
|
205
|
-
errorSlot = document.createElement("slot");
|
|
206
|
-
errorSlot.setAttribute("name", "error");
|
|
207
|
-
if (this.hasAttribute("error-inline")) {
|
|
208
|
-
native.appendChild(errorSlot);
|
|
209
|
-
} else {
|
|
210
|
-
error.appendChild(errorSlot);
|
|
211
|
-
wrapper.appendChild(error);
|
|
212
|
-
}
|
|
213
|
-
} else {
|
|
214
|
-
wrapper.appendChild(error);
|
|
215
|
-
}
|
|
216
|
-
let start = null;
|
|
217
|
-
if (hasSlotStart) {
|
|
218
|
-
start = document.createElement("slot");
|
|
219
|
-
start.setAttribute("name", "start");
|
|
220
|
-
start.setAttribute("part", "start");
|
|
221
|
-
}
|
|
222
|
-
let end = null;
|
|
223
|
-
if (hasSlotEnd) {
|
|
224
|
-
end = document.createElement("slot");
|
|
225
|
-
end.setAttribute("name", "end");
|
|
226
|
-
end.setAttribute("part", "end");
|
|
227
|
-
}
|
|
228
|
-
if (hasSlotStart) {
|
|
229
|
-
inputWrapper.appendChild(start);
|
|
230
|
-
native.classList.add("has-start");
|
|
231
|
-
}
|
|
232
|
-
if (this.variant === "standard") {
|
|
233
|
-
if (this.label) native.appendChild(label);
|
|
234
|
-
} else {
|
|
235
|
-
inputWrapper.appendChild(label);
|
|
236
|
-
}
|
|
237
|
-
inputWrapper.appendChild(input);
|
|
238
|
-
wrapper.appendChild(inputWrapper);
|
|
239
|
-
native.appendChild(wrapper);
|
|
240
|
-
if (this.hasAttribute("clearable")) {
|
|
241
|
-
this.clear = document.createElement("wje-button");
|
|
242
|
-
this.clear.classList.add("clear");
|
|
243
|
-
this.clear.setAttribute("fill", "link");
|
|
244
|
-
this.clear.setAttribute("part", "clear");
|
|
245
|
-
let clearIcon = document.createElement("wje-icon");
|
|
246
|
-
clearIcon.setAttribute("name", "x");
|
|
247
|
-
this.clear.appendChild(clearIcon);
|
|
248
|
-
inputWrapper.appendChild(this.clear);
|
|
249
|
-
}
|
|
250
|
-
if (hasSlotEnd) {
|
|
251
|
-
inputWrapper.appendChild(end);
|
|
252
|
-
native.classList.add("has-end");
|
|
253
|
-
}
|
|
254
|
-
fragment.appendChild(native);
|
|
255
|
-
this.native = native;
|
|
256
|
-
this.labelElement = label;
|
|
257
|
-
this.input = input;
|
|
258
|
-
this.errorMessage = error;
|
|
259
|
-
return fragment;
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Runs after the input is drawn to the DOM.
|
|
263
|
-
*/
|
|
264
|
-
afterDraw() {
|
|
265
|
-
this.input.addEventListener("focus", (e) => {
|
|
266
|
-
this.labelElement.classList.add("fade");
|
|
267
|
-
this.native.classList.add("focused");
|
|
268
|
-
});
|
|
269
|
-
this.input.addEventListener("blur", (e) => {
|
|
270
|
-
this.native.classList.remove("focused");
|
|
271
|
-
if (!e.target.value) this.labelElement.classList.remove("fade");
|
|
272
|
-
});
|
|
273
|
-
this.input.addEventListener("input", (e) => {
|
|
274
|
-
this.validateInput();
|
|
275
|
-
if (this.validateOnChange) {
|
|
276
|
-
this.pristine = false;
|
|
277
|
-
this.propagateValidation();
|
|
278
|
-
}
|
|
279
|
-
this.input.classList.remove("pristine");
|
|
280
|
-
this.labelElement.classList.add("fade");
|
|
281
|
-
const clone = new e.constructor(e.type, e);
|
|
282
|
-
this.dispatchEvent(clone);
|
|
283
|
-
event.dispatchCustomEvent(this, "wje-input:input", {
|
|
284
|
-
value: this.input.value
|
|
285
|
-
});
|
|
286
|
-
this.value = this.input.value;
|
|
287
|
-
});
|
|
288
|
-
this.addEventListener("invalid", (e) => {
|
|
289
|
-
this.invalid = true;
|
|
290
|
-
this.pristine = false;
|
|
291
|
-
this.showInvalidMessage();
|
|
292
|
-
if (this.customErrorDisplay) {
|
|
293
|
-
e.preventDefault();
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
this.addEventListener("focus", () => this.input.focus());
|
|
297
|
-
if (this.clear) {
|
|
298
|
-
this.clear.addEventListener("wje-button:click", (e) => {
|
|
299
|
-
this.input.value = "";
|
|
300
|
-
event.dispatchCustomEvent(this.clear, "wje-input:clear");
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
this.validateInput();
|
|
304
|
-
if (this.hasAttribute("invalid")) {
|
|
305
|
-
this.showInvalidMessage();
|
|
306
|
-
}
|
|
307
|
-
this.observer.observe(this, {
|
|
308
|
-
attributes: true,
|
|
309
|
-
// Watch for attribute changes
|
|
310
|
-
attributeOldValue: true
|
|
311
|
-
// Keep track of the old value of attributes
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
componentCleanup() {
|
|
315
|
-
this.observer.disconnect();
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* @summary Displays the validation message for the input.
|
|
319
|
-
* If the input has a slot named 'error', it sets the text content of the element with attribute 'error-message' inside the slot to the validation message.
|
|
320
|
-
* If the input does not have an 'error' slot, it sets the text content of the errorMessage property to the validation message.
|
|
321
|
-
*/
|
|
322
|
-
showInvalidMessage() {
|
|
323
|
-
let hasSlotError = this.hasSlot(this, "error");
|
|
324
|
-
if (hasSlotError) {
|
|
325
|
-
const slot = this.querySelector("[slot='error']");
|
|
326
|
-
let errorMessage = slot.querySelector("[error-message]");
|
|
327
|
-
if (!errorMessage) {
|
|
328
|
-
const error = document.createElement("div");
|
|
329
|
-
error.setAttribute("error-message", "");
|
|
330
|
-
slot.appendChild(error);
|
|
331
|
-
errorMessage = error;
|
|
332
|
-
}
|
|
333
|
-
errorMessage.textContent = this.internals.validationMessage;
|
|
334
|
-
} else {
|
|
335
|
-
this.errorMessage.textContent = this.internals.validationMessage;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* @summary Validates the input.
|
|
340
|
-
* This method checks the validity state of the input. If the input is not valid, it iterates over the validity state object.
|
|
341
|
-
* For each invalid state, it constructs an attribute name and checks if the input has this attribute.
|
|
342
|
-
* If the input has the attribute, it sets the validation error to the state and the error message to the attribute value.
|
|
343
|
-
* If the input does not have the attribute, it sets the error message to the default validation message of the input.
|
|
344
|
-
* It then sets the validity in the form internals to an object with the validation error as key and true as value, and the error message.
|
|
345
|
-
* If the input is valid, it sets the validity in the form internals to an empty object.
|
|
346
|
-
*/
|
|
347
|
-
validateInput() {
|
|
348
|
-
const validState = this.input.validity;
|
|
349
|
-
if (!validState.valid) {
|
|
350
|
-
for (let state in validState) {
|
|
351
|
-
const attr = `message-${state.toString()}`;
|
|
352
|
-
if (validState[state]) {
|
|
353
|
-
this.validationError = state.toString();
|
|
354
|
-
let errorMessage = this.message;
|
|
355
|
-
if (!this.hasAttribute("message"))
|
|
356
|
-
errorMessage = this.hasAttribute(attr) ? this.getAttribute(attr) : this.input.validationMessage;
|
|
357
|
-
this.internals.setValidity({ [this.validationError]: true }, errorMessage);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
} else {
|
|
361
|
-
this.internals.setValidity({});
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* @summary Propagates the validation state of the input.
|
|
366
|
-
* This method sets the 'invalid' property of the input based on its 'pristine' state and its internal validity state.
|
|
367
|
-
* If the input is invalid and the 'customErrorDisplay' property is true, it dispatches an 'invalid' event.
|
|
368
|
-
*/
|
|
369
|
-
propagateValidation() {
|
|
370
|
-
this.invalid = !this.pristine && !this.internals.validity.valid;
|
|
371
|
-
if (this.invalid && this.customErrorDisplay) {
|
|
372
|
-
this.dispatchEvent(new Event("invalid"));
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Checks whether the input has a slot.
|
|
377
|
-
* @param {HTMLElement} el The element to check.
|
|
378
|
-
* @param {string} slotName The name of the slot to check for.
|
|
379
|
-
* @returns {boolean} Whether the input has the slot.
|
|
380
|
-
*/
|
|
381
|
-
hasSlot(el, slotName = null) {
|
|
382
|
-
let selector = slotName ? `[slot="${slotName}"]` : "[slot]";
|
|
383
|
-
return el.querySelectorAll(selector).length > 0 ? true : false;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* @summary Callback function that is called when the custom element is associated with a form.
|
|
387
|
-
* This function adds an event listener to the form's submit event, which validates the input and propagates the validation.
|
|
388
|
-
* @param {HTMLFormElement} form The form the custom element is associated with.
|
|
389
|
-
*/
|
|
390
|
-
formAssociatedCallback(form) {
|
|
391
|
-
form == null ? void 0 : form.addEventListener("submit", () => {
|
|
392
|
-
this.validateInput();
|
|
393
|
-
this.propagateValidation();
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* The formResetCallback method is a built-in lifecycle callback that gets called when a form gets reset.
|
|
398
|
-
* This method is responsible for resetting the value of the custom input element to its default value.
|
|
399
|
-
* It also resets the form value and validity state in the form internals.
|
|
400
|
-
* @function
|
|
401
|
-
*/
|
|
402
|
-
formResetCallback() {
|
|
403
|
-
this.value = this.defaultValue;
|
|
404
|
-
this.internals.setFormValue(this.defaultValue);
|
|
405
|
-
this.internals.setValidity({});
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* The formStateRestoreCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is restored.
|
|
409
|
-
* This method is responsible for restoring the value of the custom input element to its saved state.
|
|
410
|
-
* It also restores the form value and validity state in the form internals to their saved states.
|
|
411
|
-
* @param {object} state The saved state of the custom input element.
|
|
412
|
-
* @function
|
|
413
|
-
*/
|
|
414
|
-
formStateRestoreCallback(state) {
|
|
415
|
-
this.value = state.value;
|
|
416
|
-
this.internals.setFormValue(state.value);
|
|
417
|
-
this.internals.setValidity({});
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* The formStateSaveCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is saved.
|
|
421
|
-
* This method is responsible for saving the value of the custom input element.
|
|
422
|
-
* @returns {object} The saved state of the custom input element.
|
|
423
|
-
* @function
|
|
424
|
-
*/
|
|
425
|
-
formStateSaveCallback() {
|
|
426
|
-
return {
|
|
427
|
-
value: this.value
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* The formDisabledCallback method is a built-in lifecycle callback that gets called when the disabled state of a form-associated custom element changes.
|
|
432
|
-
* This method is not implemented yet.
|
|
433
|
-
* @param {boolean} disabled The new disabled state of the custom input element.
|
|
434
|
-
* @function
|
|
435
|
-
*/
|
|
436
|
-
formDisabledCallback(disabled) {
|
|
437
|
-
console.warn("formDisabledCallback not implemented yet");
|
|
438
|
-
}
|
|
439
|
-
// dispatchEvent(e) {
|
|
440
|
-
// return false;
|
|
441
|
-
// }
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Whether the input is associated with a form.
|
|
445
|
-
* @type {boolean}
|
|
446
|
-
*/
|
|
447
|
-
__publicField(Input, "formAssociated", true);
|
|
448
|
-
Input.define("wje-input", Input);
|
|
449
|
-
export {
|
|
450
|
-
Input as default
|
|
451
|
-
};
|
package/dist/wje-item.js
DELETED
|
@@ -1,87 +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 Item ]\n*/\n\n:host {\n display: block;\n position: relative;\n align-items: center;\n justify-content: space-between;\n outline: none;\n color: var(--wje-item-color);\n text-align: initial;\n text-decoration: none;\n overflow: hidden;\n box-sizing: border-box;\n width: 100%;\n}\n\n.item-native {\n border-radius: var(--wje-item-border-radius);\n padding-top: var(--wje-item-padding-top);\n padding-bottom: var(--wje-item-padding-bottom);\n padding-inline: var(--wje-item-padding-start) var(--wje-item-padding-end);\n margin: 0;\n display: flex;\n position: relative;\n align-items: inherit;\n justify-content: inherit;\n width: 100%;\n min-height: var(--wje-item-min-height);\n transition: var(--wje-item-transition);\n outline: none;\n background: var(--wje-item-background);\n overflow: inherit;\n box-sizing: border-box;\n z-index: 1;\n text-decoration: none;\n color: var(--wje-item-color);\n\n .item-inner {\n margin: 0;\n padding: var(--wje-item-inner-padding-top) var(--wje-item-inner-padding-end)\n var(--wje-item-inner-padding-bottom) var(--wje-item-inner-padding-start);\n\n display: flex;\n position: relative;\n\n flex: 1 1 0;\n flex-direction: inherit;\n align-items: inherit;\n align-self: stretch;\n\n min-height: inherit;\n\n border-width: var(--wje-item-border-width);\n border-style: var(--wje-item-border-style);\n border-color: var(--wje-item-border-color);\n\n box-shadow: var(--wje-item-inner-box-shadow);\n overflow: inherit;\n box-sizing: border-box;\n\n .input-wrapper {\n display: flex;\n flex: 1 1 0;\n flex-direction: inherit;\n align-items: inherit;\n align-self: stretch;\n text-overflow: ellipsis;\n overflow: inherit;\n box-sizing: border-box;\n }\n }\n\n .item-bottom {\n padding: 0 var(--wje-item-inner-padding-end) 0 var(--wje-item-padding-start);\n display: flex;\n justify-content: space-between;\n }\n}\n\n@media (any-hover: hover) {\n :host(:hover) .item-native {\n color: var(--wje-item-color);\n\n :after {\n transition: var(--wje-item-transition);\n z-index: -1;\n inset: 0;\n position: absolute;\n content: '';\n background: var(--wje-item-background-hover);\n opacity: 0.7;\n }\n }\n}\n\nbutton,\na {\n cursor: pointer;\n user-select: none;\n -webkit-user-drag: none;\n}\n\n::slotted([slot='start']) {\n margin-inline: 0 1rem;\n}\n\n::slotted(wje-label:not([slot='end'])) {\n flex: 1 1 0;\n}\n";
|
|
6
|
-
class Item extends WJElement {
|
|
7
|
-
/**
|
|
8
|
-
* Item constructor for the class.
|
|
9
|
-
*/
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
/**
|
|
13
|
-
* Returns the CSS styles for the component.
|
|
14
|
-
* @type {string}
|
|
15
|
-
*/
|
|
16
|
-
__publicField(this, "className", "Item");
|
|
17
|
-
/**
|
|
18
|
-
* Determines if the given element or any of its ancestors matches the specified selector.
|
|
19
|
-
* @param {string} selector The CSS selector to match against the element's ancestors.
|
|
20
|
-
* @param {HTMLElement} el The element from which to start the search.
|
|
21
|
-
* @returns {boolean} - Returns `true` if the element or one of its ancestors matches the selector; otherwise, `false`.
|
|
22
|
-
*/
|
|
23
|
-
__publicField(this, "hostContext", (selector, el) => {
|
|
24
|
-
return el.closest(selector) !== null;
|
|
25
|
-
});
|
|
26
|
-
this.labelColorStyles = {};
|
|
27
|
-
this.itemStyles = /* @__PURE__ */ new Map();
|
|
28
|
-
this.inheritedAriaAttributes = {};
|
|
29
|
-
this.multipleInputs = false;
|
|
30
|
-
this.focusable = true;
|
|
31
|
-
this.button = false;
|
|
32
|
-
this.detailIcon = ``;
|
|
33
|
-
this.disabled = false;
|
|
34
|
-
this.counter = false;
|
|
35
|
-
this.routerDirection = "forward";
|
|
36
|
-
this.type = "button";
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Returns the CSS styles for the component.
|
|
40
|
-
* @returns {boolean}
|
|
41
|
-
*/
|
|
42
|
-
isClickable() {
|
|
43
|
-
return this.hasAttribute("href") || this.button;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Returns the CSS styles for the component.
|
|
47
|
-
* @static
|
|
48
|
-
* @returns {object} styles
|
|
49
|
-
*/
|
|
50
|
-
static get cssStyleSheet() {
|
|
51
|
-
return styles;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Sets up the attributes for the component.
|
|
55
|
-
*/
|
|
56
|
-
setupAttributes() {
|
|
57
|
-
this.isShadowRoot = "open";
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Draws the component for the item.
|
|
61
|
-
* @returns {DocumentFragment}
|
|
62
|
-
*/
|
|
63
|
-
draw() {
|
|
64
|
-
const TagType = this.isClickable() ? this.hasAttribute("href") === void 0 ? "button" : "a" : "div";
|
|
65
|
-
if (this.hostContext("wje-list", this)) {
|
|
66
|
-
this.classList.add("wje-item-list");
|
|
67
|
-
}
|
|
68
|
-
return `<${TagType} class="item-native" part="native">
|
|
69
|
-
<slot name="start"></slot>
|
|
70
|
-
<div class="item-inner">
|
|
71
|
-
<div class="input-wrapper" part="inner">
|
|
72
|
-
<slot></slot>
|
|
73
|
-
</div>
|
|
74
|
-
<slot name="end"></slot>
|
|
75
|
-
</div>
|
|
76
|
-
<div class="item-highlight"></div>
|
|
77
|
-
</${TagType}>
|
|
78
|
-
<div class="item-bottom">
|
|
79
|
-
<slot name="error"></slot>
|
|
80
|
-
<slot name="helper"></slot>
|
|
81
|
-
</div>`;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
Item.define("wje-item", Item);
|
|
85
|
-
export {
|
|
86
|
-
Item as default
|
|
87
|
-
};
|