wcs-core 4.2.0 → 5.0.0
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/dist/cjs/{accessibility-e99b032d.js → accessibility-c0c4e648.js} +8 -2
- package/dist/cjs/accessibility-c0c4e648.js.map +1 -0
- package/dist/cjs/button-interface-044a8a8a.js +12 -0
- package/dist/cjs/button-interface-044a8a8a.js.map +1 -0
- package/dist/cjs/grid-pagination-3511fdfa.js +111 -0
- package/dist/cjs/grid-pagination-3511fdfa.js.map +1 -0
- package/dist/cjs/{helpers-4a14051a.js → helpers-6280db6e.js} +75 -2
- package/dist/cjs/helpers-6280db6e.js.map +1 -0
- package/dist/cjs/{index-ca67a6dc.js → index-749d999e.js} +4 -1
- package/dist/cjs/index-749d999e.js.map +1 -0
- package/dist/cjs/{isEqual-9ea7ee49.js → keyboard-event-1cad4036.js} +77 -1
- package/dist/cjs/keyboard-event-1cad4036.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{select-arrow-c9583ea9.js → select-arrow-8169c0cb.js} +2 -2
- package/dist/cjs/{select-arrow-c9583ea9.js.map → select-arrow-8169c0cb.js.map} +1 -1
- package/dist/cjs/wcs-accordion-content.cjs.entry.js +1 -1
- package/dist/cjs/wcs-accordion-header.cjs.entry.js +1 -1
- package/dist/cjs/wcs-accordion-panel.cjs.entry.js +2 -2
- package/dist/cjs/wcs-accordion.cjs.entry.js +1 -1
- package/dist/cjs/wcs-action-bar.cjs.entry.js +1 -1
- package/dist/cjs/wcs-app.cjs.entry.js +1 -1
- package/dist/cjs/wcs-badge.cjs.entry.js +3 -2
- package/dist/cjs/wcs-badge.cjs.entry.js.map +1 -1
- package/dist/cjs/{wcs-button.cjs.entry.js → wcs-button_2.cjs.entry.js} +21 -12
- package/dist/cjs/wcs-button_2.cjs.entry.js.map +1 -0
- package/dist/cjs/wcs-card-body.cjs.entry.js +1 -1
- package/dist/cjs/wcs-card.cjs.entry.js +1 -1
- package/dist/cjs/wcs-checkbox.cjs.entry.js +5 -2
- package/dist/cjs/wcs-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-com-nav-category.cjs.entry.js +2 -2
- package/dist/cjs/wcs-com-nav-submenu.cjs.entry.js +2 -2
- package/dist/cjs/wcs-com-nav.cjs.entry.js +2 -2
- package/dist/cjs/wcs-counter.cjs.entry.js +16 -6
- package/dist/cjs/wcs-counter.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-divider.cjs.entry.js +1 -1
- package/dist/cjs/wcs-dropdown-divider.cjs.entry.js +1 -1
- package/dist/cjs/wcs-dropdown-divider.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-dropdown-header.cjs.entry.js +1 -1
- package/dist/cjs/wcs-dropdown-header.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-dropdown-item.cjs.entry.js +2 -2
- package/dist/cjs/wcs-dropdown-item.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-dropdown.cjs.entry.js +12 -6
- package/dist/cjs/wcs-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-editable-field.cjs.entry.js +18 -3
- package/dist/cjs/wcs-editable-field.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-error_2.cjs.entry.js +36 -2
- package/dist/cjs/wcs-error_2.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-field-content.cjs.entry.js +1 -1
- package/dist/cjs/wcs-field-label.cjs.entry.js +1 -1
- package/dist/cjs/wcs-field.cjs.entry.js +1 -1
- package/dist/cjs/wcs-footer.cjs.entry.js +1 -1
- package/dist/cjs/wcs-galactic-menu.cjs.entry.js +2 -2
- package/dist/cjs/wcs-galactic.cjs.entry.js +1 -1
- package/dist/cjs/wcs-grid-column.cjs.entry.js +25 -4
- package/dist/cjs/wcs-grid-column.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-grid-custom-cell.cjs.entry.js +1 -1
- package/dist/cjs/wcs-grid-pagination.cjs.entry.js +2 -2
- package/dist/cjs/wcs-grid.cjs.entry.js +320 -65
- package/dist/cjs/wcs-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-header.cjs.entry.js +1 -1
- package/dist/cjs/wcs-hint.cjs.entry.js +1 -1
- package/dist/cjs/wcs-horizontal-stepper.cjs.entry.js +1 -1
- package/dist/cjs/wcs-icon.cjs.entry.js +1 -1
- package/dist/cjs/wcs-input.cjs.entry.js +15 -15
- package/dist/cjs/wcs-input.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-label.cjs.entry.js +1 -1
- package/dist/cjs/wcs-label.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-list-item-properties.cjs.entry.js +1 -1
- package/dist/cjs/wcs-list-item-property.cjs.entry.js +1 -1
- package/dist/cjs/wcs-list-item.cjs.entry.js +1 -1
- package/dist/cjs/wcs-mat-icon.cjs.entry.js +2 -2
- package/dist/cjs/wcs-mat-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-modal.cjs.entry.js +35 -5
- package/dist/cjs/wcs-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-native-select.cjs.entry.js +6 -3
- package/dist/cjs/wcs-native-select.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-nav-item.cjs.entry.js +2 -2
- package/dist/cjs/wcs-nav.cjs.entry.js +1 -1
- package/dist/cjs/wcs-progress-bar.cjs.entry.js +4 -6
- package/dist/cjs/wcs-progress-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-progress-radial.cjs.entry.js +14 -6
- package/dist/cjs/wcs-progress-radial.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-radio-group.cjs.entry.js +22 -15
- package/dist/cjs/wcs-radio-group.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-radio.cjs.entry.js +14 -7
- package/dist/cjs/wcs-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-select_2.cjs.entry.js +603 -111
- package/dist/cjs/wcs-select_2.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-skeleton-circle.cjs.entry.js +1 -1
- package/dist/cjs/wcs-skeleton-rectangle.cjs.entry.js +1 -1
- package/dist/cjs/wcs-skeleton-text.cjs.entry.js +1 -1
- package/dist/cjs/wcs-switch.cjs.entry.js +5 -2
- package/dist/cjs/wcs-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-tab.cjs.entry.js +4 -1
- package/dist/cjs/wcs-tab.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-tabs.cjs.entry.js +4 -4
- package/dist/cjs/wcs-tabs.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-textarea.cjs.entry.js +13 -11
- package/dist/cjs/wcs-textarea.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/wcs.cjs.js +2 -2
- package/dist/collection/components/badge/badge-interface.js.map +1 -1
- package/dist/collection/components/badge/badge.css +19 -1
- package/dist/collection/components/badge/badge.js +24 -0
- package/dist/collection/components/badge/badge.js.map +1 -1
- package/dist/collection/components/button/button.css +1 -1
- package/dist/collection/components/checkbox/checkbox.js +34 -1
- package/dist/collection/components/checkbox/checkbox.js.map +1 -1
- package/dist/collection/components/counter/counter.css +6 -1
- package/dist/collection/components/counter/counter.js +61 -3
- package/dist/collection/components/counter/counter.js.map +1 -1
- package/dist/collection/components/dropdown/dropdown.css +15 -4
- package/dist/collection/components/dropdown/dropdown.js +37 -1
- package/dist/collection/components/dropdown/dropdown.js.map +1 -1
- package/dist/collection/components/dropdown-divider/dropdown-divider.js +3 -0
- package/dist/collection/components/dropdown-divider/dropdown-divider.js.map +1 -1
- package/dist/collection/components/dropdown-header/dropdown-header.js +4 -0
- package/dist/collection/components/dropdown-header/dropdown-header.js.map +1 -1
- package/dist/collection/components/dropdown-item/dropdown-item.js +5 -1
- package/dist/collection/components/dropdown-item/dropdown-item.js.map +1 -1
- package/dist/collection/components/editable-field/editable-field.js +17 -2
- package/dist/collection/components/editable-field/editable-field.js.map +1 -1
- package/dist/collection/components/error/error.js +1 -1
- package/dist/collection/components/error/error.js.map +1 -1
- package/dist/collection/components/form-field/form-field.js +31 -0
- package/dist/collection/components/form-field/form-field.js.map +1 -1
- package/dist/collection/components/grid/grid-interface.js.map +1 -1
- package/dist/collection/components/grid/grid-keyboard-event.js +52 -0
- package/dist/collection/components/grid/grid-keyboard-event.js.map +1 -0
- package/dist/collection/components/grid/grid.css +5 -0
- package/dist/collection/components/grid/grid.js +265 -29
- package/dist/collection/components/grid/grid.js.map +1 -1
- package/dist/collection/components/grid-column/grid-column.css +5 -0
- package/dist/collection/components/grid-column/grid-column.js +60 -1
- package/dist/collection/components/grid-column/grid-column.js.map +1 -1
- package/dist/collection/components/grid-column/grid-sort-arrow.js +1 -1
- package/dist/collection/components/grid-column/grid-sort-arrow.js.map +1 -1
- package/dist/collection/components/grid-pagination/grid-pagination-arrow.js +32 -23
- package/dist/collection/components/grid-pagination/grid-pagination-arrow.js.map +1 -1
- package/dist/collection/components/grid-pagination/grid-pagination.css +17 -0
- package/dist/collection/components/grid-pagination/grid-pagination.js +1 -1
- package/dist/collection/components/grid-pagination/grid-pagination.js.map +1 -1
- package/dist/collection/components/input/input.js +64 -28
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/collection/components/label/label.js.map +1 -1
- package/dist/collection/components/mat-icon/mat-icon.js +1 -1
- package/dist/collection/components/mat-icon/mat-icon.js.map +1 -1
- package/dist/collection/components/modal/modal.css +2 -2
- package/dist/collection/components/modal/modal.js +73 -2
- package/dist/collection/components/modal/modal.js.map +1 -1
- package/dist/collection/components/native-select/native-select.css +6 -5
- package/dist/collection/components/native-select/native-select.js +29 -0
- package/dist/collection/components/native-select/native-select.js.map +1 -1
- package/dist/collection/components/progress-bar/progress-bar.css +12 -11
- package/dist/collection/components/progress-bar/progress-bar.js +22 -13
- package/dist/collection/components/progress-bar/progress-bar.js.map +1 -1
- package/dist/collection/components/progress-radial/progress-radial.css +5 -0
- package/dist/collection/components/progress-radial/progress-radial.js +18 -7
- package/dist/collection/components/progress-radial/progress-radial.js.map +1 -1
- package/dist/collection/components/radio/radio.css +8 -16
- package/dist/collection/components/radio/radio.js +12 -5
- package/dist/collection/components/radio/radio.js.map +1 -1
- package/dist/collection/components/radio-group/radio-group.js +50 -13
- package/dist/collection/components/radio-group/radio-group.js.map +1 -1
- package/dist/collection/components/select/select-interface.js +10 -0
- package/dist/collection/components/select/select-interface.js.map +1 -1
- package/dist/collection/components/select/select-keyboard-event.js +306 -0
- package/dist/collection/components/select/select-keyboard-event.js.map +1 -0
- package/dist/collection/components/select/select.css +59 -6
- package/dist/collection/components/select/select.js +435 -111
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/select-option/select-option.css +15 -0
- package/dist/collection/components/select-option/select-option.js +30 -5
- package/dist/collection/components/select-option/select-option.js.map +1 -1
- package/dist/collection/components/switch/switch.js +34 -1
- package/dist/collection/components/switch/switch.js.map +1 -1
- package/dist/collection/components/tab/tab.css +7 -0
- package/dist/collection/components/tab/tab.js +11 -1
- package/dist/collection/components/tab/tab.js.map +1 -1
- package/dist/collection/components/tabs/tabs.js +7 -3
- package/dist/collection/components/tabs/tabs.js.map +1 -1
- package/dist/collection/components/textarea/textarea.css +8 -3
- package/dist/collection/components/textarea/textarea.js +41 -12
- package/dist/collection/components/textarea/textarea.js.map +1 -1
- package/dist/collection/utils/accessibility.js +7 -1
- package/dist/collection/utils/accessibility.js.map +1 -1
- package/dist/collection/utils/helpers.js +76 -1
- package/dist/collection/utils/helpers.js.map +1 -1
- package/dist/collection/utils/keyboard-event.js +74 -0
- package/dist/collection/utils/keyboard-event.js.map +1 -0
- package/dist/collection/utils/mutable-aria-attribute.js +4 -0
- package/dist/collection/utils/mutable-aria-attribute.js.map +1 -0
- package/dist/esm/{accessibility-ffa12842.js → accessibility-64feea8a.js} +8 -2
- package/dist/esm/accessibility-64feea8a.js.map +1 -0
- package/dist/esm/button-interface-c21c265f.js +9 -0
- package/dist/esm/button-interface-c21c265f.js.map +1 -0
- package/dist/esm/grid-pagination-f7b01e2e.js +109 -0
- package/dist/esm/grid-pagination-f7b01e2e.js.map +1 -0
- package/dist/esm/{helpers-1d55b67f.js → helpers-a21ae7d0.js} +75 -3
- package/dist/esm/helpers-a21ae7d0.js.map +1 -0
- package/dist/esm/{index-dc4d96d4.js → index-4f282598.js} +4 -1
- package/dist/esm/index-4f282598.js.map +1 -0
- package/dist/esm/{isEqual-20881bca.js → keyboard-event-ba3d20e7.js} +77 -2
- package/dist/esm/keyboard-event-ba3d20e7.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{select-arrow-81d069f7.js → select-arrow-28e8687b.js} +2 -2
- package/dist/esm/{select-arrow-81d069f7.js.map → select-arrow-28e8687b.js.map} +1 -1
- package/dist/esm/wcs-accordion-content.entry.js +1 -1
- package/dist/esm/wcs-accordion-header.entry.js +1 -1
- package/dist/esm/wcs-accordion-panel.entry.js +2 -2
- package/dist/esm/wcs-accordion.entry.js +1 -1
- package/dist/esm/wcs-action-bar.entry.js +1 -1
- package/dist/esm/wcs-app.entry.js +1 -1
- package/dist/esm/wcs-badge.entry.js +3 -2
- package/dist/esm/wcs-badge.entry.js.map +1 -1
- package/dist/esm/{wcs-button.entry.js → wcs-button_2.entry.js} +19 -11
- package/dist/esm/wcs-button_2.entry.js.map +1 -0
- package/dist/esm/wcs-card-body.entry.js +1 -1
- package/dist/esm/wcs-card.entry.js +1 -1
- package/dist/esm/wcs-checkbox.entry.js +5 -2
- package/dist/esm/wcs-checkbox.entry.js.map +1 -1
- package/dist/esm/wcs-com-nav-category.entry.js +2 -2
- package/dist/esm/wcs-com-nav-submenu.entry.js +2 -2
- package/dist/esm/wcs-com-nav.entry.js +2 -2
- package/dist/esm/wcs-counter.entry.js +16 -6
- package/dist/esm/wcs-counter.entry.js.map +1 -1
- package/dist/esm/wcs-divider.entry.js +1 -1
- package/dist/esm/wcs-dropdown-divider.entry.js +1 -1
- package/dist/esm/wcs-dropdown-divider.entry.js.map +1 -1
- package/dist/esm/wcs-dropdown-header.entry.js +1 -1
- package/dist/esm/wcs-dropdown-header.entry.js.map +1 -1
- package/dist/esm/wcs-dropdown-item.entry.js +2 -2
- package/dist/esm/wcs-dropdown-item.entry.js.map +1 -1
- package/dist/esm/wcs-dropdown.entry.js +12 -6
- package/dist/esm/wcs-dropdown.entry.js.map +1 -1
- package/dist/esm/wcs-editable-field.entry.js +18 -3
- package/dist/esm/wcs-editable-field.entry.js.map +1 -1
- package/dist/esm/wcs-error_2.entry.js +36 -2
- package/dist/esm/wcs-error_2.entry.js.map +1 -1
- package/dist/esm/wcs-field-content.entry.js +1 -1
- package/dist/esm/wcs-field-label.entry.js +1 -1
- package/dist/esm/wcs-field.entry.js +1 -1
- package/dist/esm/wcs-footer.entry.js +1 -1
- package/dist/esm/wcs-galactic-menu.entry.js +2 -2
- package/dist/esm/wcs-galactic.entry.js +1 -1
- package/dist/esm/wcs-grid-column.entry.js +25 -4
- package/dist/esm/wcs-grid-column.entry.js.map +1 -1
- package/dist/esm/wcs-grid-custom-cell.entry.js +1 -1
- package/dist/esm/wcs-grid-pagination.entry.js +2 -2
- package/dist/esm/wcs-grid.entry.js +282 -27
- package/dist/esm/wcs-grid.entry.js.map +1 -1
- package/dist/esm/wcs-header.entry.js +1 -1
- package/dist/esm/wcs-hint.entry.js +1 -1
- package/dist/esm/wcs-horizontal-stepper.entry.js +1 -1
- package/dist/esm/wcs-icon.entry.js +1 -1
- package/dist/esm/wcs-input.entry.js +15 -15
- package/dist/esm/wcs-input.entry.js.map +1 -1
- package/dist/esm/wcs-label.entry.js +1 -1
- package/dist/esm/wcs-label.entry.js.map +1 -1
- package/dist/esm/wcs-list-item-properties.entry.js +1 -1
- package/dist/esm/wcs-list-item-property.entry.js +1 -1
- package/dist/esm/wcs-list-item.entry.js +1 -1
- package/dist/esm/wcs-mat-icon.entry.js +2 -2
- package/dist/esm/wcs-mat-icon.entry.js.map +1 -1
- package/dist/esm/wcs-modal.entry.js +35 -5
- package/dist/esm/wcs-modal.entry.js.map +1 -1
- package/dist/esm/wcs-native-select.entry.js +6 -3
- package/dist/esm/wcs-native-select.entry.js.map +1 -1
- package/dist/esm/wcs-nav-item.entry.js +2 -2
- package/dist/esm/wcs-nav.entry.js +1 -1
- package/dist/esm/wcs-progress-bar.entry.js +4 -6
- package/dist/esm/wcs-progress-bar.entry.js.map +1 -1
- package/dist/esm/wcs-progress-radial.entry.js +14 -6
- package/dist/esm/wcs-progress-radial.entry.js.map +1 -1
- package/dist/esm/wcs-radio-group.entry.js +22 -15
- package/dist/esm/wcs-radio-group.entry.js.map +1 -1
- package/dist/esm/wcs-radio.entry.js +14 -7
- package/dist/esm/wcs-radio.entry.js.map +1 -1
- package/dist/esm/wcs-select_2.entry.js +602 -110
- package/dist/esm/wcs-select_2.entry.js.map +1 -1
- package/dist/esm/wcs-skeleton-circle.entry.js +1 -1
- package/dist/esm/wcs-skeleton-rectangle.entry.js +1 -1
- package/dist/esm/wcs-skeleton-text.entry.js +1 -1
- package/dist/esm/wcs-switch.entry.js +5 -2
- package/dist/esm/wcs-switch.entry.js.map +1 -1
- package/dist/esm/wcs-tab.entry.js +4 -1
- package/dist/esm/wcs-tab.entry.js.map +1 -1
- package/dist/esm/wcs-tabs.entry.js +4 -4
- package/dist/esm/wcs-tabs.entry.js.map +1 -1
- package/dist/esm/wcs-textarea.entry.js +13 -11
- package/dist/esm/wcs-textarea.entry.js.map +1 -1
- package/dist/esm/wcs-tooltip.entry.js +1 -1
- package/dist/esm/wcs.js +3 -3
- package/dist/types/components/badge/badge-interface.d.ts +2 -0
- package/dist/types/components/badge/badge.d.ts +5 -1
- package/dist/types/components/checkbox/checkbox.d.ts +4 -1
- package/dist/types/components/counter/counter.d.ts +8 -1
- package/dist/types/components/dropdown/dropdown.d.ts +10 -1
- package/dist/types/components/dropdown-divider/dropdown-divider.d.ts +3 -0
- package/dist/types/components/dropdown-header/dropdown-header.d.ts +4 -0
- package/dist/types/components/dropdown-item/dropdown-item.d.ts +7 -0
- package/dist/types/components/editable-field/editable-field.d.ts +7 -0
- package/dist/types/components/form-field/form-field.d.ts +4 -0
- package/dist/types/components/grid/grid-interface.d.ts +14 -2
- package/dist/types/components/grid/grid-keyboard-event.d.ts +16 -0
- package/dist/types/components/grid/grid.d.ts +59 -4
- package/dist/types/components/grid-column/grid-column.d.ts +17 -0
- package/dist/types/components/input/input.d.ts +40 -17
- package/dist/types/components/modal/modal.d.ts +37 -1
- package/dist/types/components/native-select/native-select.d.ts +3 -1
- package/dist/types/components/progress-bar/progress-bar.d.ts +8 -3
- package/dist/types/components/progress-radial/progress-radial.d.ts +12 -0
- package/dist/types/components/radio/radio.d.ts +3 -0
- package/dist/types/components/radio-group/radio-group.d.ts +3 -1
- package/dist/types/components/select/select-interface.d.ts +12 -0
- package/dist/types/components/select/select-keyboard-event.d.ts +38 -0
- package/dist/types/components/select/select.d.ts +76 -15
- package/dist/types/components/select-option/select-option.d.ts +10 -4
- package/dist/types/components/switch/switch.d.ts +4 -1
- package/dist/types/components/tab/tab.d.ts +3 -0
- package/dist/types/components/tabs/tabs.d.ts +4 -0
- package/dist/types/components/textarea/textarea.d.ts +8 -4
- package/dist/types/components.d.ts +357 -55
- package/dist/types/utils/accessibility.d.ts +4 -0
- package/dist/types/utils/helpers.d.ts +12 -1
- package/dist/types/utils/keyboard-event.d.ts +13 -0
- package/dist/types/utils/mutable-aria-attribute.d.ts +5 -0
- package/dist/wcs/{p-7a3f70da.entry.js → p-00f6a79a.entry.js} +2 -2
- package/dist/wcs/{p-ee453b6e.entry.js → p-016e4dd9.entry.js} +2 -2
- package/dist/wcs/p-0ae177cf.js +2 -0
- package/dist/wcs/p-0ae177cf.js.map +1 -0
- package/dist/wcs/{p-f06f48f3.entry.js → p-0d02d9e4.entry.js} +2 -2
- package/dist/wcs/p-0d02d9e4.entry.js.map +1 -0
- package/dist/wcs/{p-30d8f9c3.entry.js → p-11ab4ffc.entry.js} +2 -2
- package/dist/wcs/p-13548191.entry.js +2 -0
- package/dist/wcs/p-13548191.entry.js.map +1 -0
- package/dist/wcs/p-13ffe5f3.entry.js +2 -0
- package/dist/wcs/p-13ffe5f3.entry.js.map +1 -0
- package/dist/wcs/{p-dfddec76.entry.js → p-17442a2f.entry.js} +2 -2
- package/dist/wcs/p-1d49a02e.entry.js +2 -0
- package/dist/wcs/p-1d49a02e.entry.js.map +1 -0
- package/dist/wcs/{p-d6c3e615.js → p-24611014.js} +2 -2
- package/dist/wcs/p-250b3794.entry.js +2 -0
- package/dist/wcs/{p-91b3e4b5.entry.js.map → p-250b3794.entry.js.map} +1 -1
- package/dist/wcs/{p-292ca644.entry.js → p-2d62b3dd.entry.js} +2 -2
- package/dist/wcs/{p-d6b3f742.entry.js → p-33a5594d.entry.js} +2 -2
- package/dist/wcs/p-33a570ee.js +2 -0
- package/dist/wcs/p-33a570ee.js.map +1 -0
- package/dist/wcs/{p-e86c6cbb.entry.js → p-34079054.entry.js} +2 -2
- package/dist/wcs/{p-e86c6cbb.entry.js.map → p-34079054.entry.js.map} +1 -1
- package/dist/wcs/{p-257b15b9.entry.js → p-36e83879.entry.js} +2 -2
- package/dist/wcs/p-44410e32.entry.js +2 -0
- package/dist/wcs/p-44410e32.entry.js.map +1 -0
- package/dist/wcs/{p-7269272f.entry.js → p-46184d47.entry.js} +2 -2
- package/dist/wcs/p-46975b1e.entry.js +2 -0
- package/dist/wcs/p-46975b1e.entry.js.map +1 -0
- package/dist/wcs/{p-4a9f8e94.entry.js → p-46d56c4e.entry.js} +3 -3
- package/dist/wcs/{p-fc3f5b53.entry.js → p-4820154c.entry.js} +2 -2
- package/dist/wcs/p-49b0de03.entry.js +2 -0
- package/dist/wcs/p-49b0de03.entry.js.map +1 -0
- package/dist/wcs/{p-ff9967eb.entry.js → p-4af68f13.entry.js} +2 -2
- package/dist/wcs/{p-1f8c73eb.entry.js → p-5f0ab1dc.entry.js} +2 -2
- package/dist/wcs/p-5f0ab1dc.entry.js.map +1 -0
- package/dist/wcs/p-5f3e6b0c.entry.js +2 -0
- package/dist/wcs/p-5f3e6b0c.entry.js.map +1 -0
- package/dist/wcs/{p-50dce764.entry.js → p-61b934a7.entry.js} +2 -2
- package/dist/wcs/p-64855188.js +2 -0
- package/dist/wcs/p-64855188.js.map +1 -0
- package/dist/wcs/p-680b107c.entry.js +2 -0
- package/dist/wcs/p-68d654da.js +2 -0
- package/dist/wcs/p-68d654da.js.map +1 -0
- package/dist/wcs/p-69d1223c.js +3 -0
- package/dist/wcs/p-69d1223c.js.map +1 -0
- package/dist/wcs/p-6f538b67.entry.js +2 -0
- package/dist/wcs/p-6f538b67.entry.js.map +1 -0
- package/dist/wcs/p-7c145ed0.entry.js +2 -0
- package/dist/wcs/p-7c145ed0.entry.js.map +1 -0
- package/dist/wcs/p-8724a296.entry.js +2 -0
- package/dist/wcs/p-8724a296.entry.js.map +1 -0
- package/dist/wcs/{p-d084dd61.entry.js → p-88b1cdfe.entry.js} +2 -2
- package/dist/wcs/{p-c7494651.entry.js → p-8ff7e463.entry.js} +2 -2
- package/dist/wcs/p-90a7fd68.entry.js +2 -0
- package/dist/wcs/p-90a7fd68.entry.js.map +1 -0
- package/dist/wcs/{p-cfcacc44.entry.js → p-914aa964.entry.js} +2 -2
- package/dist/wcs/p-93fcef08.entry.js +2 -0
- package/dist/wcs/p-93fcef08.entry.js.map +1 -0
- package/dist/wcs/{p-429bd9fb.entry.js → p-9b1c73b3.entry.js} +2 -2
- package/dist/wcs/p-9cc48d75.js +2 -0
- package/dist/wcs/p-9cc48d75.js.map +1 -0
- package/dist/wcs/p-a3518f66.entry.js +2 -0
- package/dist/wcs/p-a361d9f1.entry.js +2 -0
- package/dist/wcs/{p-31a8d23f.entry.js → p-a85208ca.entry.js} +2 -2
- package/dist/wcs/{p-d3f1cafe.entry.js → p-b91323fc.entry.js} +2 -2
- package/dist/wcs/{p-47d8ece5.entry.js → p-bd4029f8.entry.js} +2 -2
- package/dist/wcs/{p-e348058b.entry.js → p-bed4e3ce.entry.js} +2 -2
- package/dist/wcs/{p-f489793d.entry.js → p-c261353f.entry.js} +2 -2
- package/dist/wcs/p-c261353f.entry.js.map +1 -0
- package/dist/wcs/p-c3227f01.entry.js +2 -0
- package/dist/wcs/p-c3227f01.entry.js.map +1 -0
- package/dist/wcs/{p-810aff71.entry.js → p-c38adf4b.entry.js} +2 -2
- package/dist/wcs/{p-2185bf8b.entry.js → p-c6a8c6f9.entry.js} +2 -2
- package/dist/wcs/p-c9478849.entry.js +2 -0
- package/dist/wcs/p-c9478849.entry.js.map +1 -0
- package/dist/wcs/p-ce3ef5d0.entry.js +2 -0
- package/dist/wcs/p-ce3ef5d0.entry.js.map +1 -0
- package/dist/wcs/{p-54e29233.entry.js → p-ce40b012.entry.js} +2 -2
- package/dist/wcs/{p-54e29233.entry.js.map → p-ce40b012.entry.js.map} +1 -1
- package/dist/wcs/p-d6c482fc.entry.js +2 -0
- package/dist/wcs/p-d6c482fc.entry.js.map +1 -0
- package/dist/wcs/{p-1e43122f.entry.js → p-d84cee70.entry.js} +2 -2
- package/dist/wcs/p-d895b92c.entry.js +16 -0
- package/dist/wcs/p-d895b92c.entry.js.map +1 -0
- package/dist/wcs/p-dca2f42c.entry.js +2 -0
- package/dist/wcs/{p-7519a270.entry.js → p-e0d5908a.entry.js} +2 -2
- package/dist/wcs/{p-a5cd4c07.entry.js → p-e487ff2c.entry.js} +2 -2
- package/dist/wcs/p-e487ff2c.entry.js.map +1 -0
- package/dist/wcs/{p-3b1fc676.entry.js → p-e52c11e4.entry.js} +2 -2
- package/dist/wcs/{p-0ede0c37.entry.js → p-e7661047.entry.js} +2 -2
- package/dist/wcs/p-ea6e33ee.entry.js +2 -0
- package/dist/wcs/{p-cc03627c.entry.js → p-f7ce4e0d.entry.js} +2 -2
- package/dist/wcs/{p-b6160b7c.entry.js → p-faf04401.entry.js} +2 -2
- package/dist/wcs/p-fc1767ae.entry.js +2 -0
- package/dist/wcs/p-fc1767ae.entry.js.map +1 -0
- package/dist/wcs/p-feebc469.entry.js +2 -0
- package/dist/wcs/p-feebc469.entry.js.map +1 -0
- package/dist/wcs/wcs.css +1 -1
- package/dist/wcs/wcs.esm.js +1 -1
- package/dist/wcs/wcs.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/accessibility-e99b032d.js.map +0 -1
- package/dist/cjs/grid-pagination-4b55c908.js +0 -101
- package/dist/cjs/grid-pagination-4b55c908.js.map +0 -1
- package/dist/cjs/helpers-4a14051a.js.map +0 -1
- package/dist/cjs/index-ca67a6dc.js.map +0 -1
- package/dist/cjs/isEqual-9ea7ee49.js.map +0 -1
- package/dist/cjs/wcs-button.cjs.entry.js.map +0 -1
- package/dist/cjs/wcs-spinner.cjs.entry.js +0 -22
- package/dist/cjs/wcs-spinner.cjs.entry.js.map +0 -1
- package/dist/esm/accessibility-ffa12842.js.map +0 -1
- package/dist/esm/grid-pagination-41354861.js +0 -99
- package/dist/esm/grid-pagination-41354861.js.map +0 -1
- package/dist/esm/helpers-1d55b67f.js.map +0 -1
- package/dist/esm/index-dc4d96d4.js.map +0 -1
- package/dist/esm/isEqual-20881bca.js.map +0 -1
- package/dist/esm/wcs-button.entry.js.map +0 -1
- package/dist/esm/wcs-spinner.entry.js +0 -18
- package/dist/esm/wcs-spinner.entry.js.map +0 -1
- package/dist/wcs/p-02b95dbf.entry.js +0 -2
- package/dist/wcs/p-02b95dbf.entry.js.map +0 -1
- package/dist/wcs/p-0f8db386.js +0 -2
- package/dist/wcs/p-0f8db386.js.map +0 -1
- package/dist/wcs/p-17630eea.entry.js +0 -2
- package/dist/wcs/p-1f8c73eb.entry.js.map +0 -1
- package/dist/wcs/p-269d244c.entry.js +0 -2
- package/dist/wcs/p-269d244c.entry.js.map +0 -1
- package/dist/wcs/p-2f63d6c5.entry.js +0 -2
- package/dist/wcs/p-2f63d6c5.entry.js.map +0 -1
- package/dist/wcs/p-39821dd2.entry.js +0 -2
- package/dist/wcs/p-39821dd2.entry.js.map +0 -1
- package/dist/wcs/p-3dc6b507.js +0 -2
- package/dist/wcs/p-3dc6b507.js.map +0 -1
- package/dist/wcs/p-463667c9.entry.js +0 -2
- package/dist/wcs/p-475ac7c5.js +0 -2
- package/dist/wcs/p-475ac7c5.js.map +0 -1
- package/dist/wcs/p-4ffe4539.entry.js +0 -2
- package/dist/wcs/p-4ffe4539.entry.js.map +0 -1
- package/dist/wcs/p-57560d7d.entry.js +0 -2
- package/dist/wcs/p-57560d7d.entry.js.map +0 -1
- package/dist/wcs/p-61cab06f.entry.js +0 -2
- package/dist/wcs/p-61cab06f.entry.js.map +0 -1
- package/dist/wcs/p-627bbb6a.entry.js +0 -2
- package/dist/wcs/p-627bbb6a.entry.js.map +0 -1
- package/dist/wcs/p-6de70331.entry.js +0 -2
- package/dist/wcs/p-6de70331.entry.js.map +0 -1
- package/dist/wcs/p-747a5962.entry.js +0 -2
- package/dist/wcs/p-8181f8cd.js +0 -2
- package/dist/wcs/p-8181f8cd.js.map +0 -1
- package/dist/wcs/p-8c4ed883.entry.js +0 -2
- package/dist/wcs/p-8c4ed883.entry.js.map +0 -1
- package/dist/wcs/p-8d57835f.entry.js +0 -2
- package/dist/wcs/p-8fed8b1c.entry.js +0 -2
- package/dist/wcs/p-8fed8b1c.entry.js.map +0 -1
- package/dist/wcs/p-91b3e4b5.entry.js +0 -2
- package/dist/wcs/p-9910fedd.entry.js +0 -2
- package/dist/wcs/p-9910fedd.entry.js.map +0 -1
- package/dist/wcs/p-9d798de4.entry.js +0 -2
- package/dist/wcs/p-9d798de4.entry.js.map +0 -1
- package/dist/wcs/p-9ecdeaf9.entry.js +0 -2
- package/dist/wcs/p-9ecdeaf9.entry.js.map +0 -1
- package/dist/wcs/p-a2df3a49.js +0 -3
- package/dist/wcs/p-a2df3a49.js.map +0 -1
- package/dist/wcs/p-a5cd4c07.entry.js.map +0 -1
- package/dist/wcs/p-ac106663.entry.js +0 -2
- package/dist/wcs/p-ac106663.entry.js.map +0 -1
- package/dist/wcs/p-cb90bc3a.entry.js +0 -2
- package/dist/wcs/p-cb90bc3a.entry.js.map +0 -1
- package/dist/wcs/p-cdd172b4.entry.js +0 -2
- package/dist/wcs/p-d5a0e271.entry.js +0 -2
- package/dist/wcs/p-d5a0e271.entry.js.map +0 -1
- package/dist/wcs/p-ec84d6fd.entry.js +0 -16
- package/dist/wcs/p-ec84d6fd.entry.js.map +0 -1
- package/dist/wcs/p-ed3132be.entry.js +0 -2
- package/dist/wcs/p-ed3132be.entry.js.map +0 -1
- package/dist/wcs/p-f06f48f3.entry.js.map +0 -1
- package/dist/wcs/p-f20b9024.entry.js +0 -2
- package/dist/wcs/p-f20b9024.entry.js.map +0 -1
- package/dist/wcs/p-f489793d.entry.js.map +0 -1
- /package/dist/wcs/{p-7a3f70da.entry.js.map → p-00f6a79a.entry.js.map} +0 -0
- /package/dist/wcs/{p-ee453b6e.entry.js.map → p-016e4dd9.entry.js.map} +0 -0
- /package/dist/wcs/{p-30d8f9c3.entry.js.map → p-11ab4ffc.entry.js.map} +0 -0
- /package/dist/wcs/{p-dfddec76.entry.js.map → p-17442a2f.entry.js.map} +0 -0
- /package/dist/wcs/{p-d6c3e615.js.map → p-24611014.js.map} +0 -0
- /package/dist/wcs/{p-292ca644.entry.js.map → p-2d62b3dd.entry.js.map} +0 -0
- /package/dist/wcs/{p-d6b3f742.entry.js.map → p-33a5594d.entry.js.map} +0 -0
- /package/dist/wcs/{p-257b15b9.entry.js.map → p-36e83879.entry.js.map} +0 -0
- /package/dist/wcs/{p-7269272f.entry.js.map → p-46184d47.entry.js.map} +0 -0
- /package/dist/wcs/{p-4a9f8e94.entry.js.map → p-46d56c4e.entry.js.map} +0 -0
- /package/dist/wcs/{p-fc3f5b53.entry.js.map → p-4820154c.entry.js.map} +0 -0
- /package/dist/wcs/{p-ff9967eb.entry.js.map → p-4af68f13.entry.js.map} +0 -0
- /package/dist/wcs/{p-50dce764.entry.js.map → p-61b934a7.entry.js.map} +0 -0
- /package/dist/wcs/{p-17630eea.entry.js.map → p-680b107c.entry.js.map} +0 -0
- /package/dist/wcs/{p-d084dd61.entry.js.map → p-88b1cdfe.entry.js.map} +0 -0
- /package/dist/wcs/{p-c7494651.entry.js.map → p-8ff7e463.entry.js.map} +0 -0
- /package/dist/wcs/{p-cfcacc44.entry.js.map → p-914aa964.entry.js.map} +0 -0
- /package/dist/wcs/{p-429bd9fb.entry.js.map → p-9b1c73b3.entry.js.map} +0 -0
- /package/dist/wcs/{p-8d57835f.entry.js.map → p-a3518f66.entry.js.map} +0 -0
- /package/dist/wcs/{p-463667c9.entry.js.map → p-a361d9f1.entry.js.map} +0 -0
- /package/dist/wcs/{p-31a8d23f.entry.js.map → p-a85208ca.entry.js.map} +0 -0
- /package/dist/wcs/{p-d3f1cafe.entry.js.map → p-b91323fc.entry.js.map} +0 -0
- /package/dist/wcs/{p-47d8ece5.entry.js.map → p-bd4029f8.entry.js.map} +0 -0
- /package/dist/wcs/{p-e348058b.entry.js.map → p-bed4e3ce.entry.js.map} +0 -0
- /package/dist/wcs/{p-810aff71.entry.js.map → p-c38adf4b.entry.js.map} +0 -0
- /package/dist/wcs/{p-2185bf8b.entry.js.map → p-c6a8c6f9.entry.js.map} +0 -0
- /package/dist/wcs/{p-1e43122f.entry.js.map → p-d84cee70.entry.js.map} +0 -0
- /package/dist/wcs/{p-747a5962.entry.js.map → p-dca2f42c.entry.js.map} +0 -0
- /package/dist/wcs/{p-7519a270.entry.js.map → p-e0d5908a.entry.js.map} +0 -0
- /package/dist/wcs/{p-3b1fc676.entry.js.map → p-e52c11e4.entry.js.map} +0 -0
- /package/dist/wcs/{p-0ede0c37.entry.js.map → p-e7661047.entry.js.map} +0 -0
- /package/dist/wcs/{p-cdd172b4.entry.js.map → p-ea6e33ee.entry.js.map} +0 -0
- /package/dist/wcs/{p-cc03627c.entry.js.map → p-f7ce4e0d.entry.js.map} +0 -0
- /package/dist/wcs/{p-b6160b7c.entry.js.map → p-faf04401.entry.js.map} +0 -0
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const helpers = require('./helpers-
|
|
5
|
+
const index = require('./index-749d999e.js');
|
|
6
|
+
const helpers = require('./helpers-6280db6e.js');
|
|
7
7
|
|
|
8
8
|
const WcsInputSizeValues = ['s', 'm', 'l']; // as const keyword is used to infer and preserve the exact literal values of an array or object.
|
|
9
9
|
function isWcsInputSize(size) {
|
|
@@ -31,6 +31,9 @@ const Input = class {
|
|
|
31
31
|
}
|
|
32
32
|
this.wcsInput.emit(ev);
|
|
33
33
|
};
|
|
34
|
+
this.onChange = (_) => {
|
|
35
|
+
this.wcsChange.emit({ value: this.nativeInput.value });
|
|
36
|
+
};
|
|
34
37
|
this.onBlur = (ev) => {
|
|
35
38
|
this.hasFocus = false;
|
|
36
39
|
this.focusChanged();
|
|
@@ -111,15 +114,8 @@ const Input = class {
|
|
|
111
114
|
debounceChanged() {
|
|
112
115
|
this.wcsChange = helpers.debounceEvent(this.wcsChange, this.debounce);
|
|
113
116
|
}
|
|
114
|
-
/**
|
|
115
|
-
* Update the native input element when the value changes
|
|
116
|
-
*/
|
|
117
|
-
valueChanged() {
|
|
118
|
-
var _a;
|
|
119
|
-
this.wcsChange.emit({ value: (_a = this.value) === null || _a === void 0 ? void 0 : _a.toString() });
|
|
120
|
-
}
|
|
121
117
|
componentWillLoad() {
|
|
122
|
-
this.inheritedAttributes = helpers.inheritAttributes(this.el, ['
|
|
118
|
+
this.inheritedAttributes = Object.assign(Object.assign({}, helpers.inheritAriaAttributes(this.el)), helpers.inheritAttributes(this.el, ['tabindex', 'title']));
|
|
123
119
|
if (!isWcsInputSize(this.size)) {
|
|
124
120
|
console.error(`Invalid size value for wcs-input : "${this.size}". Must be one of "${WcsInputSizeValues.join(', ')}"`);
|
|
125
121
|
this.size = "m"; // Default fallback value
|
|
@@ -165,13 +161,18 @@ const Input = class {
|
|
|
165
161
|
getInputElement() {
|
|
166
162
|
return Promise.resolve(this.nativeInput);
|
|
167
163
|
}
|
|
164
|
+
async setAriaAttribute(attr, value) {
|
|
165
|
+
if (this.nativeInput) {
|
|
166
|
+
this.nativeInput.setAttribute(attr, value);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
168
169
|
shouldClearOnEdit() {
|
|
169
170
|
const { type, clearOnEdit } = this;
|
|
170
171
|
return (clearOnEdit === undefined)
|
|
171
172
|
? type === 'password'
|
|
172
173
|
: clearOnEdit;
|
|
173
174
|
}
|
|
174
|
-
|
|
175
|
+
getValueAsString() {
|
|
175
176
|
return typeof this.value === 'number' ? this.value.toString() :
|
|
176
177
|
(this.value || '').toString();
|
|
177
178
|
}
|
|
@@ -182,7 +183,7 @@ const Input = class {
|
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
hasValue() {
|
|
185
|
-
return this.
|
|
186
|
+
return this.getValueAsString().length > 0;
|
|
186
187
|
}
|
|
187
188
|
passwordRevealIconClick() {
|
|
188
189
|
this.passwordReveal = !this.passwordReveal;
|
|
@@ -191,19 +192,18 @@ const Input = class {
|
|
|
191
192
|
this.iconPassword = this.passwordReveal ? 'visibility_off' : 'visibility';
|
|
192
193
|
}
|
|
193
194
|
render() {
|
|
194
|
-
const value = this.
|
|
195
|
+
const value = this.getValueAsString();
|
|
195
196
|
const labelId = this.inputId + '-lbl';
|
|
196
197
|
const label = helpers.findItemLabel(this.el);
|
|
197
198
|
if (label) {
|
|
198
199
|
label.id = labelId;
|
|
199
200
|
}
|
|
200
|
-
return (index.h(index.Host, { "aria-disabled": this.disabled ? 'true' : null, "data-has-prefix": !!this.prefixLabel, "data-has-suffix": !!this.suffixLabel }, this.prefixLabel ? (index.h("span", { class: "prefix", part: "prefix" }, this.prefixLabel)) : null, this.icon ? (index.h("wcs-mat-icon", { icon: this.icon, size: "m" })) : null, index.h("input", Object.assign({ class: "native-input", ref: input => this.nativeInput = input, "aria-labelledby": label ? labelId : null, disabled: this.disabled, accept: this.accept, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, multiple: this.multiple, name: this.name, pattern: this.pattern, placeholder: this.placeholder || '', readOnly: this.readonly, required: this.required, spellcheck: this.spellcheck, step: this.step, type: this.passwordReveal ? 'text' : this.type, value: value, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeydown }, this.inheritedAttributes)), this.type === "password" ? (index.h("wcs-mat-icon", { class: "toggle_password", icon: this.iconPassword, size: "m", onClick: () => this.passwordRevealIconClick() })) : null, this.suffixLabel ? (index.h("span", { class: "suffix", part: "suffix" }, this.suffixLabel)) : null));
|
|
201
|
+
return (index.h(index.Host, { "aria-disabled": this.disabled ? 'true' : null, "data-has-prefix": !!this.prefixLabel, "data-has-suffix": !!this.suffixLabel }, this.prefixLabel ? (index.h("span", { class: "prefix", part: "prefix" }, this.prefixLabel)) : null, this.icon ? (index.h("wcs-mat-icon", { icon: this.icon, size: "m" })) : null, index.h("input", Object.assign({ class: "native-input", ref: input => this.nativeInput = input, "aria-labelledby": label ? labelId : null, disabled: this.disabled, accept: this.accept, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, multiple: this.multiple, name: this.name, pattern: this.pattern, placeholder: this.placeholder || '', readOnly: this.readonly, required: this.required, spellcheck: this.spellcheck, step: this.step, type: this.passwordReveal ? 'text' : this.type, value: value, onInput: this.onInput, onChange: this.onChange, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeydown }, this.inheritedAttributes)), this.type === "password" ? (index.h("wcs-mat-icon", { class: "toggle_password", icon: this.iconPassword, size: "m", onClick: () => this.passwordRevealIconClick() })) : null, this.suffixLabel ? (index.h("span", { class: "suffix", part: "suffix" }, this.suffixLabel)) : null));
|
|
201
202
|
}
|
|
202
203
|
static get delegatesFocus() { return true; }
|
|
203
204
|
get el() { return index.getElement(this); }
|
|
204
205
|
static get watchers() { return {
|
|
205
206
|
"debounce": ["debounceChanged"],
|
|
206
|
-
"value": ["valueChanged"],
|
|
207
207
|
"passwordReveal": ["onPasswordRevealChange"]
|
|
208
208
|
}; }
|
|
209
209
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"wcs-input.entry.cjs.js","mappings":";;;;;;;AAeO,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;SAI3C,cAAc,CAAC,IAAY;;EAEvC,OAAO,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC7C;;ACtBA,MAAM,QAAQ,GAAG,myHAAmyH;;MCkBvyH,KAAK;;;;;;;IAEN,YAAO,GAAG,aAAa,QAAQ,EAAE,EAAE,CAAC;IACpC,qBAAgB,GAAG,KAAK,CAAC;IACzB,wBAAmB,GAAyB,EAAE,CAAC;IAC/C,iBAAY,GAAG,YAAY,CAAC;IAqR5B,YAAO,GAAG,CAAC,EAAS;MACxB,MAAM,KAAK,GAAG,EAAE,CAAC,MAAiC,CAAC;MACnD,IAAI,KAAK,EAAE;QACP,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;OAClC;MACD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAmB,CAAC,CAAC;KAC3C,CAAA;IAEO,WAAM,GAAG,CAAC,EAAc;MAC5B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;MACtB,IAAI,CAAC,YAAY,EAAE,CAAC;MAEpB,IAAI,IAAI,CAAC,eAAe,EAAE;QACtB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;OACzB;KACJ,CAAA;IAEO,YAAO,GAAG,CAAC,EAAc;MAC7B,IAAI,CA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AC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,SAAS,EAAE,IAAI,CAAC,SAAS,IACrB,IAAI,CAAC,mBAAmB,EAC9B,EACD,IAAI,CAAC,IAAI,KAAK,UAAU,IAAIA,0BAAc,KAAK,EAAC,iBAAiB,EAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,EAAC,GAAG,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,uBAAuB,EAAE,GAAiB,IAAI,IAAI,EAC3K,IAAI,CAAC,WAAW,IAAIA,kBAAM,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,IAAE,IAAI,CAAC,WAAW,CAAQ,IAAI,IAAI,CACtF,EACT;GACL;;;;;;;;;AAGL,IAAI,QAAQ,GAAG,CAAC,CAAC;;;;;","names":["debounceEvent","inheritAttributes","findItemLabel","h","Host"],"sources":["./src/components/input/input-interface.ts","./src/components/input/input.scss?tag=wcs-input&encapsulation=shadow","./src/components/input/input.tsx"],"sourcesContent":["// From: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete\nimport { WcsSize } from '../../shared-types';\n\nexport type AutocompleteTypes = (\n | 'on' | 'off' | 'name' | 'honorific-prefix' | 'given-name' | 'additional-name' | 'family-name' | 'honorific-suffix'\n | 'nickname' | 'email' | 'username' | 'new-password' | 'current-password' | 'one-time-code' | 'organization-title' | 'organization'\n | 'street-address' | 'address-line1' | 'address-line2' | 'address-line3' | 'address-level4' | 'address-level3' | 'address-level2'\n | 'address-level1' | 'country' | 'country-name' | 'postal-code' | 'cc-name' | 'cc-given-name' | 'cc-additional-name' | 'cc-family-name'\n | 'cc-family-name' | 'cc-number' | 'cc-exp' | 'cc-exp-month' | 'cc-exp-year' | 'cc-csc' | 'cc-type' | 'transaction-currency' | 'transaction-amount'\n | 'language' | 'bday' | 'bday-day' | 'bday-month' | 'bday-year' | 'sex' | 'tel' | 'tel-country-code' | 'tel-national' | 'tel-area-code' | 'tel-local'\n | 'tel-extension' | 'impp' | 'url' | 'photo');\n\nexport type TextFieldTypes = 'date' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'url' | 'time' | 'week' | 'month' | 'datetime-local' | 'file';\n\n\nexport const WcsInputSizeValues = ['s', 'm', 'l'] as const; // as const keyword is used to infer and preserve the exact literal values of an array or object.\n\nexport type WcsInputSize = Extract<WcsSize, typeof WcsInputSizeValues[number]>;\n\nexport function isWcsInputSize(size: string): size is WcsInputSize {\n // @ts-ignore : ignore size type, as it is checked with WcsInputSizeValues\n return WcsInputSizeValues.includes(size);\n}\n\nexport interface InputChangeEventDetail {\n value: string | undefined | null;\n}\n","@import '../../style/focus-outline.scss';\n\n:host {\n --wcs-input-icon-color: var(--wcs-text-medium);\n --wcs-internal-input-border-radius-left: var(--wcs-input-border-radius-left, var(--wcs-border-radius));\n --wcs-internal-input-border-radius-right: var(--wcs-input-border-radius-right, var(--wcs-border-radius));\n --wcs-internal-input-border-width: 2px;\n display: flex;\n width: 100%;\n height: var(--wcs-input-host-height);\n box-sizing: border-box;\n border-radius: var(--wcs-internal-input-border-radius-left) var(--wcs-internal-input-border-radius-right) var(--wcs-internal-input-border-radius-right) var(--wcs-internal-input-border-radius-left);\n background-color: var(--wcs-light);\n border: var(--wcs-internal-input-border-width) solid var(--wcs-light);\n background-clip: padding-box;\n\n ::placeholder {\n font-weight: 400;\n font-style: italic;\n }\n\n input {\n overflow: hidden;\n min-height: var(--wcs-size-xs);\n width: 100%;\n background-color: transparent;\n font-family: var(--wcs-font-sans-serif);\n color: var(--wcs-primary);\n font-weight: var(--wcs-font-weight-form-value) !important;\n border: none;\n padding: 0 calc(var(--wcs-padding) - var(--wcs-internal-input-border-width));\n font-size: var(--wcs-input-font-size, 1rem);\n line-height: 1.5;\n }\n\n input:focus {\n box-shadow: none;\n outline: 0;\n }\n\n wcs-mat-icon {\n position: relative;\n margin-left: 8px;\n margin-right: -8px;\n }\n\n .toggle_password {\n cursor: pointer;\n margin-left: -8px;\n margin-right: 8px;\n }\n\n\n .prefix, .suffix {\n color: var(--wcs-white);\n display: flex;\n white-space: nowrap;\n align-items: center;\n font-size: var(--wcs-input-font-size, 1rem);\n padding: 0 calc(var(--wcs-padding) / 2);\n font-weight: var(--wcs-font-weight-form-value) !important;\n background-color: var(--wcs-text-disabled);\n }\n\n .prefix {\n border-radius: var(--wcs-internal-input-border-radius-left) 0 0 var(--wcs-internal-input-border-radius-left);\n margin: calc(-1 * var(--wcs-internal-input-border-width)) 0 calc(-1 * var(--wcs-internal-input-border-width)) calc(-1 * var(--wcs-internal-input-border-width));\n border-left: solid var(--wcs-internal-input-border-width) transparent;\n border-top: solid var(--wcs-internal-input-border-width) transparent;\n border-bottom: solid var(--wcs-internal-input-border-width) transparent;\n }\n\n .suffix {\n border-radius: 0 var(--wcs-internal-input-border-radius-right) var(--wcs-internal-input-border-radius-right) 0;\n margin: calc(-1 * var(--wcs-internal-input-border-width)) calc(-1 * var(--wcs-internal-input-border-width)) calc(-1 * var(--wcs-internal-input-border-width)) 0px;\n border-right: solid var(--wcs-internal-input-border-width) transparent;\n border-top: solid var(--wcs-internal-input-border-width) transparent;\n border-bottom: solid var(--wcs-internal-input-border-width) transparent;\n }\n}\n\n:host([size=l]) {\n --wcs-input-host-height: var(--wcs-size-l);\n --wcs-input-font-size: 1.0625rem;\n}\n\n:host([size=m]) { // Default\n --wcs-input-host-height: var(--wcs-size-m);\n --wcs-input-font-size: 1rem;\n}\n\n:host([size=s]) {\n --wcs-input-host-height: var(--wcs-size-s);\n --wcs-input-font-size: 0.9375rem;\n}\n\n:host([state=error]) {\n border-color: var(--wcs-red) !important;\n}\n\n:host([data-has-prefix]) {\n input {\n padding-left: calc(var(--wcs-padding) / 2);\n }\n}\n\n:host([data-has-suffix]) {\n input {\n padding-left: calc(var(--wcs-padding) / 2);\n }\n}\n\n:host([disabled]) {\n input {\n color: var(--wcs-text-disabled);\n cursor: not-allowed;\n }\n\n .prefix, .suffix {\n color: var(--wcs-light);\n }\n}\n\n:host(:focus-within) {\n border: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n\n .prefix {\n border-left: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-top: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-bottom: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n }\n\n .suffix {\n border-right: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-top: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-bottom: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n }\n\n wcs-mat-icon {\n color: var(--wcs-primary);\n }\n}\n","import {\n Build, Component,\n ComponentInterface, Element, Event, EventEmitter, h, Host, Method, Prop,\n State, Watch\n} from '@stencil/core';\nimport { debounceEvent, findItemLabel, inheritAttributes } from '../../utils/helpers';\nimport {\n AutocompleteTypes, InputChangeEventDetail, isWcsInputSize, TextFieldTypes, WcsInputSize, WcsInputSizeValues\n} from './input-interface';\n\n/**\n * Mainly inspired from Ionic Input Component\n */\n@Component({\n tag: 'wcs-input',\n styleUrl: 'input.scss',\n shadow: {delegatesFocus: true},\n})\nexport class Input implements ComponentInterface {\n private nativeInput?: HTMLInputElement;\n private inputId = `wcs-input-${inputIds++}`;\n private didBlurAfterEdit = false;\n private inheritedAttributes: { [k: string]: any } = {};\n private iconPassword = \"visibility\";\n\n\n /**\n * This is required for a WebKit bug which requires us to\n * blur and focus an input to properly focus the input in\n * an item with delegatesFocus. It will no longer be needed\n * with iOS 14.\n *\n * @internal\n */\n @Prop() fireFocusEvents = true;\n\n @State() private hasFocus = false;\n\n @State() private passwordReveal = false;\n\n @Element() private el!: HTMLElement;\n\n /**\n * If the value of the type attribute is `\"file\"`, then this attribute will indicate the types of files that the server accepts, otherwise it will be ignored. The value must be a comma-separated list of unique content type specifiers.\n */\n @Prop() accept?: string;\n\n /**\n * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.\n * Available options: `\"off\"`, `\"none\"`, `\"on\"`, `\"sentences\"`, `\"words\"`, `\"characters\"`.\n */\n @Prop() autocapitalize = 'off';\n\n /**\n * Indicates whether the value of the control can be automatically completed by the browser.\n */\n @Prop() autocomplete: AutocompleteTypes = 'off';\n\n /**\n * Whether auto correction should be enabled when the user is entering/editing the text value.\n */\n @Prop() autocorrect: 'on' | 'off' = 'off';\n\n /**\n * This Boolean attribute lets you specify that a form control should have input focus when the page loads.\n */\n @Prop() autofocus = false;\n\n /**\n * If `true`, a clear icon will appear in the input when there is a value. Clicking it clears the input.\n */\n @Prop() clearInput = false;\n\n /**\n * If `true`, the value will be cleared after focus upon edit. Defaults to `true` when `type` is `\"password\"`, `false` for all other types.\n */\n @Prop() clearOnEdit?: boolean;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger the `wcsChange` event after each keystroke. This also impacts form bindings such as `ngModel` or `v-model`.\n */\n @Prop() debounce = 0;\n\n /**\n * Prefix displayed before the text field contents. This is not included in the value.\n */\n @Prop() prefixLabel: string;\n\n /**\n * Suffix displayed after the text field contents. This is not included in the value.\n */\n @Prop() suffixLabel: string;\n\n @Watch('debounce')\n protected debounceChanged() {\n this.wcsChange = debounceEvent(this.wcsChange, this.debounce);\n }\n\n /**\n * If `true`, the user cannot interact with the input.\n */\n @Prop() disabled = false;\n\n /**\n * A hint to the browser for which enter key to display.\n * Possible values: `\"enter\"`, `\"done\"`, `\"go\"`, `\"next\"`,\n * `\"previous\"`, `\"search\"`, and `\"send\"`.\n */\n @Prop() enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';\n\n /**\n * Specify the size (height) of the input.\n */\n @Prop({reflect: true}) size: WcsInputSize = 'm';\n\n /**\n * Name of the material icon to add to the input\n */\n @Prop() icon: string;\n\n /**\n * A hint to the browser for which keyboard to display.\n * Possible values: `\"none\"`, `\"text\"`, `\"tel\"`, `\"url\"`,\n * `\"email\"`, `\"numeric\"`, `\"decimal\"`, and `\"search\"`.\n */\n @Prop() inputmode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\n /**\n * The maximum value, which must not be less than its minimum (min attribute) value.\n */\n @Prop() max?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the maximum number of characters that the user can enter.\n */\n @Prop() maxlength?: number;\n\n /**\n * The minimum value, which must not be greater than its maximum (max attribute) value.\n */\n @Prop() min?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the minimum number of characters that the user can enter.\n */\n @Prop() minlength?: number;\n\n /**\n * If `true`, the user can enter more than one value. This attribute applies when the type attribute is set to `\"email\"` or `\"file\"`, otherwise it is ignored.\n */\n @Prop() multiple?: boolean;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * A regular expression that the value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, `\"date\"`, or `\"password\"`, otherwise it is ignored. When the type attribute is `\"date\"`, `pattern` will only be used in browsers that do not support the `\"date\"` input type natively. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date for more information.\n */\n @Prop() pattern?: string;\n\n /**\n * Instructional text that shows before the input has a value.\n */\n @Prop() placeholder?: string | null;\n\n /**\n * If `true`, the user cannot modify the value.\n */\n @Prop() readonly = false;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * If `true`, the element will have its spelling and grammar checked.\n */\n @Prop() spellcheck = false;\n\n /**\n * Specifies the state of the input. By default the input is in an normal state but you can to set it to 'error' state if the data given by the user is not valid.\n */\n @Prop({reflect: true}) state: 'initial' | 'error' = 'initial';\n\n /**\n * Works with the min and max attributes to limit the increments at which a value can be set.\n * Possible values are: `\"any\"` or a positive floating point number.\n */\n @Prop() step?: string;\n\n /**\n * The type of control to display. The default type is text.\n */\n @Prop() type: TextFieldTypes = 'text';\n\n /**\n * The value of the input.\n */\n @Prop({mutable: true}) value?: string | number | null = '';\n\n /**\n * Emitted when a keyboard input occurred.\n */\n @Event() wcsInput!: EventEmitter<KeyboardEvent>;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() wcsChange!: EventEmitter<InputChangeEventDetail>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() wcsBlur!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() wcsFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n this.wcsChange.emit({value: this.value?.toString()});\n }\n\n componentWillLoad() {\n this.inheritedAttributes = inheritAttributes(this.el, ['aria-label', 'tabindex', 'title']);\n\n if (!isWcsInputSize(this.size)) {\n console.error(`Invalid size value for wcs-input : \"${this.size}\". Must be one of \"${WcsInputSizeValues.join(', ')}\"`);\n this.size = \"m\"; // Default fallback value\n }\n }\n\n connectedCallback() {\n this.debounceChanged();\n if (Build.isBrowser) {\n document.dispatchEvent(new CustomEvent('wcsInputDidLoad', {\n detail: this.el\n }));\n }\n }\n\n disconnectedCallback() {\n if (Build.isBrowser) {\n document.dispatchEvent(new CustomEvent('wcsInputDidUnload', {\n detail: this.el\n }));\n }\n }\n\n /**\n * @deprecated use the native focus method instead \n * Sets focus on the native `input` in `wcs-input`.\n */\n @Method()\n async setFocus() {\n if (this.nativeInput) {\n this.nativeInput.focus();\n }\n }\n\n /**\n * Sets blur on the native `input` in `wcs-input`. Use this method instead of the global\n * `input.blur()`.\n * @internal\n */\n @Method()\n async setBlur() {\n if (this.nativeInput) {\n this.nativeInput.blur();\n }\n }\n\n /**\n * Returns the native `<input>` element used under the hood.\n */\n @Method()\n getInputElement(): Promise<HTMLInputElement> {\n return Promise.resolve(this.nativeInput!);\n }\n\n private shouldClearOnEdit() {\n const {type, clearOnEdit} = this;\n return (clearOnEdit === undefined)\n ? type === 'password'\n : clearOnEdit;\n }\n\n private getValue(): string {\n return typeof this.value === 'number' ? this.value.toString() :\n (this.value || '').toString();\n }\n\n private onInput = (ev: Event) => {\n const input = ev.target as HTMLInputElement | null;\n if (input) {\n this.value = input.value || '';\n }\n this.wcsInput.emit(ev as KeyboardEvent);\n }\n\n private onBlur = (ev: FocusEvent) => {\n this.hasFocus = false;\n this.focusChanged();\n\n if (this.fireFocusEvents) {\n this.wcsBlur.emit(ev);\n }\n }\n\n private onFocus = (ev: FocusEvent) => {\n this.hasFocus = true;\n this.focusChanged();\n\n if (this.fireFocusEvents) {\n this.wcsFocus.emit(ev);\n }\n }\n\n private onKeydown = (ev: KeyboardEvent) => {\n if (this.shouldClearOnEdit()) {\n // Did the input value change after it was blurred and edited?\n // Do not clear if user is hitting Enter to submit form\n if (this.didBlurAfterEdit && this.hasValue() && ev.key !== 'Enter') {\n // Clear the input\n this.clearTextInput();\n }\n\n // Reset the flag\n this.didBlurAfterEdit = false;\n }\n }\n\n private clearTextInput = (ev?: Event) => {\n if (this.clearInput && !this.readonly && !this.disabled && ev) {\n ev.preventDefault();\n ev.stopPropagation();\n\n // Attempt to focus input again after pressing clear button\n this.setFocus();\n }\n\n this.value = '';\n\n /**\n * This is needed for clearOnEdit\n * Otherwise the value will not be cleared\n * if user is inside the input\n */\n if (this.nativeInput) {\n this.nativeInput.value = '';\n }\n }\n\n private focusChanged() {\n // If clearOnEdit is enabled and the input blurred but has a value, set a flag\n if (!this.hasFocus && this.shouldClearOnEdit() && this.hasValue()) {\n this.didBlurAfterEdit = true;\n }\n }\n\n private hasValue(): boolean {\n return this.getValue().length > 0;\n }\n\n private passwordRevealIconClick(): void {\n this.passwordReveal = !this.passwordReveal;\n }\n\n @Watch('passwordReveal')\n onPasswordRevealChange(): void {\n this.iconPassword = this.passwordReveal ? 'visibility_off' : 'visibility';\n }\n\n render() {\n const value = this.getValue();\n const labelId = this.inputId + '-lbl';\n const label = findItemLabel(this.el);\n if (label) {\n label.id = labelId;\n }\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n data-has-prefix={!!this.prefixLabel}\n data-has-suffix={!!this.suffixLabel}\n >\n {this.prefixLabel ? (<span class=\"prefix\" part=\"prefix\">{this.prefixLabel}</span>) : null}\n {this.icon ? (<wcs-mat-icon icon={this.icon} size=\"m\"></wcs-mat-icon>) : null}\n <input\n class=\"native-input\"\n ref={input => this.nativeInput = input}\n aria-labelledby={label ? labelId : null}\n disabled={this.disabled}\n accept={this.accept}\n autoCapitalize={this.autocapitalize}\n autoComplete={this.autocomplete}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n enterKeyHint={this.enterkeyhint}\n inputMode={this.inputmode}\n min={this.min}\n max={this.max}\n minLength={this.minlength}\n maxLength={this.maxlength}\n multiple={this.multiple}\n name={this.name}\n pattern={this.pattern}\n placeholder={this.placeholder || ''}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n step={this.step}\n type={this.passwordReveal ? 'text' : this.type}\n value={value}\n onInput={this.onInput}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n onKeyDown={this.onKeydown}\n {...this.inheritedAttributes}\n />\n {this.type === \"password\" ? (<wcs-mat-icon class=\"toggle_password\" icon={this.iconPassword} size=\"m\" onClick={() => this.passwordRevealIconClick()}></wcs-mat-icon>) : null}\n {this.suffixLabel ? (<span class=\"suffix\" part=\"suffix\">{this.suffixLabel}</span>) : null}\n </Host>\n );\n }\n}\n\nlet inputIds = 0;\n"],"version":3}
|
|
1
|
+
{"file":"wcs-input.entry.cjs.js","mappings":";;;;;;;AAeO,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;SAI3C,cAAc,CAAC,IAAY;;EAEvC,OAAO,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC7C;;ACtBA,MAAM,QAAQ,GAAG,myHAAmyH;;MC+BvyH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E,OAAO,EAAE,MAAM,IAAI,CAAC,uBAAuB,EAAE,GAAiB,IAAI,IAAI,EAC3K,IAAI,CAAC,WAAW,IAAIA,kBAAM,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,IAAE,IAAI,CAAC,WAAW,CAAQ,IAAI,IAAI,CACtF,EACT;GACL;;;;;;;;AAGL,IAAI,QAAQ,GAAG,CAAC,CAAC;;;;;","names":["debounceEvent","inheritAriaAttributes","inheritAttributes","findItemLabel","h","Host"],"sources":["./src/components/input/input-interface.ts","./src/components/input/input.scss?tag=wcs-input&encapsulation=shadow","./src/components/input/input.tsx"],"sourcesContent":["// From: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete\nimport { WcsSize } from '../../shared-types';\n\nexport type AutocompleteTypes = (\n | 'on' | 'off' | 'name' | 'honorific-prefix' | 'given-name' | 'additional-name' | 'family-name' | 'honorific-suffix'\n | 'nickname' | 'email' | 'username' | 'new-password' | 'current-password' | 'one-time-code' | 'organization-title' | 'organization'\n | 'street-address' | 'address-line1' | 'address-line2' | 'address-line3' | 'address-level4' | 'address-level3' | 'address-level2'\n | 'address-level1' | 'country' | 'country-name' | 'postal-code' | 'cc-name' | 'cc-given-name' | 'cc-additional-name' | 'cc-family-name'\n | 'cc-family-name' | 'cc-number' | 'cc-exp' | 'cc-exp-month' | 'cc-exp-year' | 'cc-csc' | 'cc-type' | 'transaction-currency' | 'transaction-amount'\n | 'language' | 'bday' | 'bday-day' | 'bday-month' | 'bday-year' | 'sex' | 'tel' | 'tel-country-code' | 'tel-national' | 'tel-area-code' | 'tel-local'\n | 'tel-extension' | 'impp' | 'url' | 'photo');\n\nexport type TextFieldTypes = 'date' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'url' | 'time' | 'week' | 'month' | 'datetime-local' | 'file';\n\n\nexport const WcsInputSizeValues = ['s', 'm', 'l'] as const; // as const keyword is used to infer and preserve the exact literal values of an array or object.\n\nexport type WcsInputSize = Extract<WcsSize, typeof WcsInputSizeValues[number]>;\n\nexport function isWcsInputSize(size: string): size is WcsInputSize {\n // @ts-ignore : ignore size type, as it is checked with WcsInputSizeValues\n return WcsInputSizeValues.includes(size);\n}\n\nexport interface InputChangeEventDetail {\n value: string | undefined | null;\n}\n","@import '../../style/focus-outline.scss';\n\n:host {\n --wcs-input-icon-color: var(--wcs-text-medium);\n --wcs-internal-input-border-radius-left: var(--wcs-input-border-radius-left, var(--wcs-border-radius));\n --wcs-internal-input-border-radius-right: var(--wcs-input-border-radius-right, var(--wcs-border-radius));\n --wcs-internal-input-border-width: 2px;\n display: flex;\n width: 100%;\n height: var(--wcs-input-host-height);\n box-sizing: border-box;\n border-radius: var(--wcs-internal-input-border-radius-left) var(--wcs-internal-input-border-radius-right) var(--wcs-internal-input-border-radius-right) var(--wcs-internal-input-border-radius-left);\n background-color: var(--wcs-light);\n border: var(--wcs-internal-input-border-width) solid var(--wcs-light);\n background-clip: padding-box;\n\n ::placeholder {\n font-weight: 400;\n font-style: italic;\n }\n\n input {\n overflow: hidden;\n min-height: var(--wcs-size-xs);\n width: 100%;\n background-color: transparent;\n font-family: var(--wcs-font-sans-serif);\n color: var(--wcs-primary);\n font-weight: var(--wcs-font-weight-form-value) !important;\n border: none;\n padding: 0 calc(var(--wcs-padding) - var(--wcs-internal-input-border-width));\n font-size: var(--wcs-input-font-size, 1rem);\n line-height: 1.5;\n }\n\n input:focus {\n box-shadow: none;\n outline: 0;\n }\n\n wcs-mat-icon {\n position: relative;\n margin-left: 8px;\n margin-right: -8px;\n }\n\n .toggle_password {\n cursor: pointer;\n margin-left: -8px;\n margin-right: 8px;\n }\n\n\n .prefix, .suffix {\n color: var(--wcs-white);\n display: flex;\n white-space: nowrap;\n align-items: center;\n font-size: var(--wcs-input-font-size, 1rem);\n padding: 0 calc(var(--wcs-padding) / 2);\n font-weight: var(--wcs-font-weight-form-value) !important;\n background-color: var(--wcs-text-disabled);\n }\n\n .prefix {\n border-radius: var(--wcs-internal-input-border-radius-left) 0 0 var(--wcs-internal-input-border-radius-left);\n margin: calc(-1 * var(--wcs-internal-input-border-width)) 0 calc(-1 * var(--wcs-internal-input-border-width)) calc(-1 * var(--wcs-internal-input-border-width));\n border-left: solid var(--wcs-internal-input-border-width) transparent;\n border-top: solid var(--wcs-internal-input-border-width) transparent;\n border-bottom: solid var(--wcs-internal-input-border-width) transparent;\n }\n\n .suffix {\n border-radius: 0 var(--wcs-internal-input-border-radius-right) var(--wcs-internal-input-border-radius-right) 0;\n margin: calc(-1 * var(--wcs-internal-input-border-width)) calc(-1 * var(--wcs-internal-input-border-width)) calc(-1 * var(--wcs-internal-input-border-width)) 0px;\n border-right: solid var(--wcs-internal-input-border-width) transparent;\n border-top: solid var(--wcs-internal-input-border-width) transparent;\n border-bottom: solid var(--wcs-internal-input-border-width) transparent;\n }\n}\n\n:host([size=l]) {\n --wcs-input-host-height: var(--wcs-size-l);\n --wcs-input-font-size: 1.0625rem;\n}\n\n:host([size=m]) { // Default\n --wcs-input-host-height: var(--wcs-size-m);\n --wcs-input-font-size: 1rem;\n}\n\n:host([size=s]) {\n --wcs-input-host-height: var(--wcs-size-s);\n --wcs-input-font-size: 0.9375rem;\n}\n\n:host([state=error]) {\n border-color: var(--wcs-red) !important;\n}\n\n:host([data-has-prefix]) {\n input {\n padding-left: calc(var(--wcs-padding) / 2);\n }\n}\n\n:host([data-has-suffix]) {\n input {\n padding-left: calc(var(--wcs-padding) / 2);\n }\n}\n\n:host([disabled]) {\n input {\n color: var(--wcs-text-disabled);\n cursor: not-allowed;\n }\n\n .prefix, .suffix {\n color: var(--wcs-light);\n }\n}\n\n:host(:focus-within) {\n border: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n\n .prefix {\n border-left: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-top: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-bottom: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n }\n\n .suffix {\n border-right: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-top: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-bottom: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n }\n\n wcs-mat-icon {\n color: var(--wcs-primary);\n }\n}\n","import {\n Build, Component,\n ComponentInterface, Element, Event, EventEmitter, h, Host, Method, Prop,\n State, Watch\n} from '@stencil/core';\nimport { debounceEvent, findItemLabel, inheritAriaAttributes, inheritAttributes } from '../../utils/helpers';\nimport {\n AutocompleteTypes, InputChangeEventDetail, isWcsInputSize, TextFieldTypes, WcsInputSize, WcsInputSizeValues\n} from './input-interface';\nimport { AriaAttributeName, MutableAriaAttribute } from \"../../utils/mutable-aria-attribute\";\n\n/**\n * The input component is a form control that accepts a single line of text.\n * Implementation mainly inspired from Ionic Input Component.\n *\n *\n * <details>\n * <summary>Accessibility guidelines 💡</summary>\n * > - Provide a `<wcs-label>` next to the input\n * > - Use the `disabled` prop to add the HTML `disabled` attribute to the `input`\n * > - Use the `readonly` prop to add the HTML `readonly` attribute to the `input`\n * > - Use the `autofocus` prop to add the HTML `autofocus` attribute to the `input`. Use it if you want your input focus\n * automatically when the page load\n * > - Adapt the `type` to lets user enter information more easily (_ex: `type=\"number\"` for an input which only accept numbers entry_)\n * </details>\n */\n@Component({\n tag: 'wcs-input',\n styleUrl: 'input.scss',\n shadow: {delegatesFocus: true},\n})\nexport class Input implements ComponentInterface, MutableAriaAttribute {\n private nativeInput?: HTMLInputElement;\n private inputId = `wcs-input-${inputIds++}`;\n private didBlurAfterEdit = false;\n private inheritedAttributes: { [k: string]: any } = {};\n private iconPassword = \"visibility\";\n\n\n /**\n * This is required for a WebKit bug which requires us to\n * blur and focus an input to properly focus the input in\n * an item with delegatesFocus. It will no longer be needed\n * with iOS 14.\n *\n * @internal\n */\n @Prop() fireFocusEvents = true;\n\n @State() private hasFocus = false;\n\n @State() private passwordReveal = false;\n\n @Element() private el!: HTMLElement;\n\n /**\n * If the value of the type attribute is `\"file\"`, then this attribute will indicate the types of files that the\n * server accepts, otherwise it will be ignored. The value must be a comma-separated list of unique content type specifiers.\n */\n @Prop() accept?: string;\n\n /**\n * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.\n * Available options: `\"off\"`, `\"none\"`, `\"on\"`, `\"sentences\"`, `\"words\"`, `\"characters\"`.\n */\n @Prop() autocapitalize = 'off';\n\n /**\n * Indicates whether the value of the control can be automatically completed by the browser.\n */\n @Prop() autocomplete: AutocompleteTypes = 'off';\n\n /**\n * Whether auto correction should be enabled when the user is entering/editing the text value.\n */\n @Prop() autocorrect: 'on' | 'off' = 'off';\n\n /**\n * This Boolean attribute lets you specify that a form control should have input focus when the page loads.\n */\n @Prop() autofocus = false;\n\n /**\n * If `true`, a clear icon will appear in the input when there is a value. Clicking it clears the input.\n */\n @Prop() clearInput = false;\n\n /**\n * If `true`, the value will be cleared after focus upon edit.\n * Defaults to `true` when `type` is `\"password\"`, `false` for all other types.\n */\n @Prop() clearOnEdit?: boolean;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger the `wcsChange` event after each keystroke.\n * This also impacts form bindings such as `ngModel` or `v-model`.\n */\n @Prop() debounce = 0;\n\n /**\n * Prefix displayed before the text field contents. This is not included in the value.\n */\n @Prop() prefixLabel: string;\n\n /**\n * Suffix displayed after the text field contents. This is not included in the value.\n */\n @Prop() suffixLabel: string;\n\n @Watch('debounce')\n protected debounceChanged() {\n this.wcsChange = debounceEvent(this.wcsChange, this.debounce);\n }\n\n /**\n * If `true`, the user cannot interact with the input.\n */\n @Prop() disabled = false;\n\n /**\n * A hint to the browser for which enter key to display.\n * Possible values: `\"enter\"`, `\"done\"`, `\"go\"`, `\"next\"`,\n * `\"previous\"`, `\"search\"`, and `\"send\"`.\n */\n @Prop() enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';\n\n /**\n * Specify the size (height) of the input.\n */\n @Prop({reflect: true}) size: WcsInputSize = 'm';\n\n /**\n * Name of the material icon to add to the input\n */\n @Prop() icon: string;\n\n /**\n * A hint to the browser for which keyboard to display.\n * Possible values: `\"none\"`, `\"text\"`, `\"tel\"`, `\"url\"`,\n * `\"email\"`, `\"numeric\"`, `\"decimal\"`, and `\"search\"`.\n */\n @Prop() inputmode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\n /**\n * The maximum value, which must not be less than its minimum (min attribute) value.\n */\n @Prop() max?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute\n * specifies the maximum number of characters that the user can enter.\n */\n @Prop() maxlength?: number;\n\n /**\n * The minimum value, which must not be greater than its maximum (max attribute) value.\n */\n @Prop() min?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute\n * specifies the minimum number of characters that the user can enter.\n */\n @Prop() minlength?: number;\n\n /**\n * If `true`, the user can enter more than one value. This attribute applies when the type attribute is set to\n * `\"email\"` or `\"file\"`, otherwise it is ignored.\n */\n @Prop() multiple?: boolean;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * A regular expression that the value is checked against. The pattern must match the entire value, not just some\n * subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value\n * of the type attribute is `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, `\"date\"`, or `\"password\"`, otherwise\n * it is ignored. When the type attribute is `\"date\"`, `pattern` will only be used in browsers that do not support\n * the `\"date\"` input type natively. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date for\n * more information.\n */\n @Prop() pattern?: string;\n\n /**\n * Instructional text that shows before the input has a value.\n */\n @Prop() placeholder?: string | null;\n\n /**\n * If `true`, the user cannot modify the value.\n */\n @Prop() readonly = false;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * If `true`, the element will have its spelling and grammar checked.\n */\n @Prop() spellcheck = false;\n\n /**\n * Specifies the state of the input. By default the input is in an normal state but you can to set it to 'error'\n * state if the data given by the user is not valid.\n */\n @Prop({reflect: true}) state: 'initial' | 'error' = 'initial';\n\n /**\n * Works with the min and max attributes to limit the increments at which a value can be set.\n * Possible values are: `\"any\"` or a positive floating point number.\n */\n @Prop() step?: string;\n\n /**\n * The type of control to display. The default type is text.\n */\n @Prop() type: TextFieldTypes = 'text';\n\n /**\n * The value of the input.\n */\n @Prop({mutable: true}) value?: string | number | null = '';\n\n /**\n * Emitted when a keyboard input occurred. See https://developer.mozilla.org/en-US/docs/Web/Events/input\n */\n @Event() wcsInput!: EventEmitter<KeyboardEvent>;\n\n /**\n * Emitted when the value has changed. See https://developer.mozilla.org/en-US/docs/Web/Events/change\n */\n @Event() wcsChange!: EventEmitter<InputChangeEventDetail>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() wcsBlur!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() wcsFocus!: EventEmitter<FocusEvent>;\n\n componentWillLoad() {\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.el),\n ...inheritAttributes(this.el, ['tabindex', 'title'])\n };\n\n if (!isWcsInputSize(this.size)) {\n console.error(`Invalid size value for wcs-input : \"${this.size}\". Must be one of \"${WcsInputSizeValues.join(', ')}\"`);\n this.size = \"m\"; // Default fallback value\n }\n }\n\n connectedCallback() {\n this.debounceChanged();\n if (Build.isBrowser) {\n document.dispatchEvent(new CustomEvent('wcsInputDidLoad', {\n detail: this.el\n }));\n }\n }\n\n disconnectedCallback() {\n if (Build.isBrowser) {\n document.dispatchEvent(new CustomEvent('wcsInputDidUnload', {\n detail: this.el\n }));\n }\n }\n\n /**\n * @deprecated use the native focus method instead\n * Sets focus on the native `input` in `wcs-input`.\n */\n @Method()\n async setFocus() {\n if (this.nativeInput) {\n this.nativeInput.focus();\n }\n }\n\n /**\n * Sets blur on the native `input` in `wcs-input`. Use this method instead of the global\n * `input.blur()`.\n * @internal\n */\n @Method()\n async setBlur() {\n if (this.nativeInput) {\n this.nativeInput.blur();\n }\n }\n\n /**\n * Returns the native `<input>` element used under the hood.\n */\n @Method()\n getInputElement(): Promise<HTMLInputElement> {\n return Promise.resolve(this.nativeInput!);\n }\n\n @Method()\n async setAriaAttribute(attr: AriaAttributeName, value: string) {\n if (this.nativeInput) {\n this.nativeInput.setAttribute(attr, value);\n }\n }\n\n private shouldClearOnEdit() {\n const {type, clearOnEdit} = this;\n return (clearOnEdit === undefined)\n ? type === 'password'\n : clearOnEdit;\n }\n\n private getValueAsString(): string {\n return typeof this.value === 'number' ? this.value.toString() :\n (this.value || '').toString();\n }\n\n private onInput = (ev: Event) => {\n const input = ev.target as HTMLInputElement | null;\n if (input) {\n this.value = input.value || '';\n }\n this.wcsInput.emit(ev as KeyboardEvent);\n }\n\n private onChange = (_: Event) => {\n this.wcsChange.emit({value: this.nativeInput.value});\n }\n\n private onBlur = (ev: FocusEvent) => {\n this.hasFocus = false;\n this.focusChanged();\n\n if (this.fireFocusEvents) {\n this.wcsBlur.emit(ev);\n }\n }\n\n private onFocus = (ev: FocusEvent) => {\n this.hasFocus = true;\n this.focusChanged();\n\n if (this.fireFocusEvents) {\n this.wcsFocus.emit(ev);\n }\n }\n\n private onKeydown = (ev: KeyboardEvent) => {\n if (this.shouldClearOnEdit()) {\n // Did the input value change after it was blurred and edited?\n // Do not clear if user is hitting Enter to submit form\n if (this.didBlurAfterEdit && this.hasValue() && ev.key !== 'Enter') {\n // Clear the input\n this.clearTextInput();\n }\n\n // Reset the flag\n this.didBlurAfterEdit = false;\n }\n }\n\n private clearTextInput = (ev?: Event) => {\n if (this.clearInput && !this.readonly && !this.disabled && ev) {\n ev.preventDefault();\n ev.stopPropagation();\n\n // Attempt to focus input again after pressing clear button\n this.setFocus();\n }\n\n this.value = '';\n\n /**\n * This is needed for clearOnEdit\n * Otherwise the value will not be cleared\n * if user is inside the input\n */\n if (this.nativeInput) {\n this.nativeInput.value = '';\n }\n }\n\n private focusChanged() {\n // If clearOnEdit is enabled and the input blurred but has a value, set a flag\n if (!this.hasFocus && this.shouldClearOnEdit() && this.hasValue()) {\n this.didBlurAfterEdit = true;\n }\n }\n\n private hasValue(): boolean {\n return this.getValueAsString().length > 0;\n }\n\n private passwordRevealIconClick(): void {\n this.passwordReveal = !this.passwordReveal;\n }\n\n @Watch('passwordReveal')\n onPasswordRevealChange(): void {\n this.iconPassword = this.passwordReveal ? 'visibility_off' : 'visibility';\n }\n\n render() {\n const value = this.getValueAsString();\n const labelId = this.inputId + '-lbl';\n const label = findItemLabel(this.el);\n if (label) {\n label.id = labelId;\n }\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n data-has-prefix={!!this.prefixLabel}\n data-has-suffix={!!this.suffixLabel}\n >\n {this.prefixLabel ? (<span class=\"prefix\" part=\"prefix\">{this.prefixLabel}</span>) : null}\n {this.icon ? (<wcs-mat-icon icon={this.icon} size=\"m\"></wcs-mat-icon>) : null}\n <input\n class=\"native-input\"\n ref={input => this.nativeInput = input}\n aria-labelledby={label ? labelId : null}\n disabled={this.disabled}\n accept={this.accept}\n autoCapitalize={this.autocapitalize}\n autoComplete={this.autocomplete}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n enterKeyHint={this.enterkeyhint}\n inputMode={this.inputmode}\n min={this.min}\n max={this.max}\n minLength={this.minlength}\n maxLength={this.maxlength}\n multiple={this.multiple}\n name={this.name}\n pattern={this.pattern}\n placeholder={this.placeholder || ''}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n step={this.step}\n type={this.passwordReveal ? 'text' : this.type}\n value={value}\n onInput={this.onInput}\n onChange={this.onChange}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n onKeyDown={this.onKeydown}\n {...this.inheritedAttributes}\n />\n {this.type === \"password\" ? (<wcs-mat-icon class=\"toggle_password\" icon={this.iconPassword} size=\"m\" onClick={() => this.passwordRevealIconClick()}></wcs-mat-icon>) : null}\n {this.suffixLabel ? (<span class=\"suffix\" part=\"suffix\">{this.suffixLabel}</span>) : null}\n </Host>\n );\n }\n}\n\nlet inputIds = 0;\n"],"version":3}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-749d999e.js');
|
|
6
6
|
|
|
7
7
|
const labelCss = ":host{font-weight:500;margin-bottom:8px}:host([required])>label::after{font-weight:500;color:var(--wcs-red);content:\" *\"}label{display:inline-block}label ::slotted(wcs-mat-icon){display:inline;vertical-align:middle;margin-left:calc(var(--wcs-base-margin) / 2)}";
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"wcs-label.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,QAAQ,GAAG,wQAAwQ;;MCO5Q,KAAK;;;oBAEH,KAAK;;EAEhB,MAAM;IACF,QACIA,QAACC,UAAI,IAAC,IAAI,EAAC,OAAO,IACdD,uBACIA,qBAAQ,CACJ,CACL,EACT;GACL;;;;;;","names":["h","Host"],"sources":["./src/components/label/label.scss?tag=wcs-label&encapsulation=shadow","./src/components/label/label.tsx"],"sourcesContent":[":host {\n font-weight: 500;\n margin-bottom: 8px;\n}\n\n:host([required]) > label::after {\n font-weight: 500;\n color: var(--wcs-red);\n content: ' *';\n}\n\nlabel {\n display: inline-block;\n\n // Add margin before tooltip icon\n ::slotted(wcs-mat-icon) {\n display: inline;\n vertical-align: middle;\n margin-left: calc(var(--wcs-base-margin) / 2);\n }\n}\n","import { Component, ComponentInterface, h, Host, Prop } from '@stencil/core';\n\n@Component({\n tag: 'wcs-label',\n styleUrl: 'label.scss',\n shadow: true,\n})\nexport class Label implements ComponentInterface {\n @Prop({ reflect: true })\n required = false;\n\n render() {\n return (\n <Host slot=\"label\">\n <label>\n <slot />\n </label>\n </Host>\n );\n }\n}"],"version":3}
|
|
1
|
+
{"file":"wcs-label.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,QAAQ,GAAG,wQAAwQ;;MCO5Q,KAAK;;;oBAEH,KAAK;;EAEhB,MAAM;IACF,QACIA,QAACC,UAAI,IAAC,IAAI,EAAC,OAAO,IACdD,uBACIA,qBAAQ,CACJ,CACL,EACT;GACL;;;;;;","names":["h","Host"],"sources":["./src/components/label/label.scss?tag=wcs-label&encapsulation=shadow","./src/components/label/label.tsx"],"sourcesContent":[":host {\n font-weight: 500;\n margin-bottom: 8px;\n}\n\n:host([required]) > label::after {\n font-weight: 500;\n color: var(--wcs-red);\n content: ' *';\n}\n\nlabel {\n display: inline-block;\n\n // Add margin before tooltip icon\n ::slotted(wcs-mat-icon) {\n display: inline;\n vertical-align: middle;\n margin-left: calc(var(--wcs-base-margin) / 2);\n }\n}\n","import { Component, ComponentInterface, h, Host, Prop } from '@stencil/core';\n\n@Component({\n tag: 'wcs-label',\n styleUrl: 'label.scss',\n shadow: true,\n})\nexport class Label implements ComponentInterface {\n @Prop({ reflect: true })\n required = false;\n\n render() {\n return (\n <Host slot=\"label\">\n <label>\n <slot />\n </label>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-749d999e.js');
|
|
6
6
|
|
|
7
7
|
const listItemPropertiesCss = ":host{margin-bottom:2px;display:block}::slotted(*:first-of-type){padding-right:1.25rem !important;padding-left:0 !important}::slotted(*:last-of-type){padding-right:0 !important;padding-left:1.25rem !important;border-right:none !important}::slotted(*){padding-right:1.25rem;padding-left:1.25rem;border-right:solid 2px var(--wcs-text-disabled)}";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-749d999e.js');
|
|
6
6
|
|
|
7
7
|
const listItemCss = ":host{padding:var(--wcs-padding);border:solid 1px var(--wcs-text-light);display:flex;margin-bottom:-1px;background-color:var(--wcs-white)}:host(:hover){background-color:var(--wcs-light);transition:0.175s}:host([activated]){background-color:var(--wcs-light)}::slotted([slot=title]){color:var(--wcs-gray);font-weight:700;line-height:1.2;font-family:inherit;margin-bottom:0.5rem}::slotted([slot=icon]){color:var(--wcs-gray-light);margin-right:16px}::slotted([slot=actions]){margin-left:8px}.content{display:flex;flex-direction:column;flex-grow:1}.header{display:flex;justify-content:space-between}";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-749d999e.js');
|
|
6
6
|
|
|
7
7
|
const matIconCss = ":host{display:flex;flex-direction:column;justify-content:center}:host .size-s{font-size:18px !important}:host .size-m{font-size:24px !important}:host .size-l{font-size:36px !important}:host .size-xl{font-size:48px !important}:host .material-icons{font-family:\"Material Icons\";font-weight:normal;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-feature-settings:\"liga\";-webkit-font-smoothing:antialiased}:host .material-icons-outlined{font-family:\"Material Icons Outlined\";font-weight:normal;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-feature-settings:\"liga\";-webkit-font-smoothing:antialiased}:host .material-icons-two-tone{--google-font-color-materialiconstwotone:none;font-family:\"Material Icons Two Tone\";font-weight:normal;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-feature-settings:\"liga\";-webkit-font-smoothing:antialiased}:host .material-icons-round{font-family:\"Material Icons Round\";font-weight:normal;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-feature-settings:\"liga\";-webkit-font-smoothing:antialiased}:host .material-icons-sharp{font-family:\"Material Icons Sharp\";font-weight:normal;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-feature-settings:\"liga\";-webkit-font-smoothing:antialiased}";
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ const MatIcon = class {
|
|
|
21
21
|
this.family = 'filled';
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
|
-
return (index.h(index.Host, null, index.h("i", { class: ICON_FAMILY_CLASS_NAME[this.family] + ' size-' + this.size }, this.icon)));
|
|
24
|
+
return (index.h(index.Host, null, index.h("i", { "aria-hidden": "true", class: ICON_FAMILY_CLASS_NAME[this.family] + ' size-' + this.size }, this.icon)));
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
MatIcon.style = matIconCss;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"wcs-mat-icon.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,UAAU,GAAG,u0DAAu0D;;ACG11D,MAAM,sBAAsB,GAAuC;EAC/D,MAAM,EAAE,gBAAgB;EACxB,QAAQ,EAAE,yBAAyB;EACnC,OAAO,EAAE,yBAAyB;EAClC,OAAO,EAAE,sBAAsB;EAC/B,KAAK,EAAE,sBAAsB;CAChC,CAAA;
|
|
1
|
+
{"file":"wcs-mat-icon.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,UAAU,GAAG,u0DAAu0D;;ACG11D,MAAM,sBAAsB,GAAuC;EAC/D,MAAM,EAAE,gBAAgB;EACxB,QAAQ,EAAE,yBAAyB;EACnC,OAAO,EAAE,yBAAyB;EAClC,OAAO,EAAE,sBAAsB;EAC/B,KAAK,EAAE,sBAAsB;CAChC,CAAA;MAOY,OAAO;;;;gBAQiB,GAAG;kBAIC,QAAQ;;EAE7C,MAAM;IACF,QACIA,QAACC,UAAI,QACDD,8BAAe,MAAM,EAAC,KAAK,EAAE,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAC,IAAI,IAClF,IAAI,CAAC,IAAI,CACV,CACD,EACT;GACL;;;;;;","names":["h","Host"],"sources":["./src/components/mat-icon/mat-icon.scss?tag=wcs-mat-icon&encapsulation=shadow","./src/components/mat-icon/mat-icon.tsx"],"sourcesContent":["@use 'mat-icon-google-stylesheets';\n\n:host {\n display: flex;\n flex-direction: column;\n justify-content: center;\n\n .size-s {\n font-size: 18px !important;\n }\n\n .size-m {\n font-size: 24px !important;\n }\n\n .size-l {\n font-size: 36px !important;\n }\n\n .size-xl {\n font-size: 48px !important;\n }\n\n @include mat-icon-google-stylesheets.material-icons-classes\n}\n","import { Component, ComponentInterface, h, Host, Prop } from '@stencil/core';\nimport { MaterialIconFamily, MaterialIconSize } from './mat-icon-interface';\n\nconst ICON_FAMILY_CLASS_NAME: Record<MaterialIconFamily, string> = {\n filled: 'material-icons',\n outlined: 'material-icons-outlined',\n twotone: 'material-icons-two-tone',\n rounded: 'material-icons-round',\n sharp: 'material-icons-sharp'\n}\n\n@Component({\n tag: 'wcs-mat-icon',\n styleUrl: 'mat-icon.scss',\n shadow: true\n})\nexport class MatIcon implements ComponentInterface {\n /**\n * Use the icon name from Material Icons\n */\n @Prop() icon: string;\n /**\n * Size of the icon\n */\n @Prop() size: MaterialIconSize = 'm';\n /**\n * Family of the icon\n */\n @Prop() family: MaterialIconFamily = 'filled';\n\n render() {\n return (\n <Host>\n <i aria-hidden=\"true\" class={ICON_FAMILY_CLASS_NAME[this.family] + ' size-' + this.size}>\n {this.icon}\n </i>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const accessibility = require('./accessibility-
|
|
7
|
-
const helpers = require('./helpers-
|
|
5
|
+
const index = require('./index-749d999e.js');
|
|
6
|
+
const accessibility = require('./accessibility-c0c4e648.js');
|
|
7
|
+
const helpers = require('./helpers-6280db6e.js');
|
|
8
8
|
|
|
9
|
-
const modalCss = "wcs-modal{z-index:999;position:fixed;top:0;bottom:0;left:0;right:0;display:none;background:rgba(0, 0, 0, 0.4)}wcs-modal[show]{display:flex;height:100vh;width:100vw;align-items:center;justify-content:center}wcs-modal[without-backdrop]{background-color:unset}wcs-modal[without-backdrop] .wcs-modal-container{border:solid 1px var(--wcs-text-light)}.wcs-modal-container{max-height:var(--wcs-modal-max-height, 80%);background-color:#fff;display:grid;grid-template-columns:100%;grid-template-rows:auto 1fr auto;box-sizing:border-box;pointer-events:auto;background-clip:padding-box;border:0 solid rgba(0, 0, 0, 0.2);border-radius:0.4375rem;z-index:20000;padding:1.375rem 1.875rem 1.875rem 1.875rem}.wcs-modal-container[data-size=s]{width:288px}.wcs-modal-container[data-size=m]{width:480px}.wcs-modal-container[data-size=l]{width:864px}.wcs-modal-container[data-size=xl]{width:1200px}.wcs-modal-header{margin-bottom:8px;display:flex;align-items:center;justify-content:space-between}.wcs-modal-header
|
|
9
|
+
const modalCss = "wcs-modal{z-index:999;position:fixed;top:0;bottom:0;left:0;right:0;display:none;background:rgba(0, 0, 0, 0.4)}wcs-modal[show]{display:flex;height:100vh;width:100vw;align-items:center;justify-content:center}wcs-modal[without-backdrop]{background-color:unset}wcs-modal[without-backdrop] .wcs-modal-container{border:solid 1px var(--wcs-text-light)}.wcs-modal-container{max-height:var(--wcs-modal-max-height, 80%);background-color:#fff;display:grid;grid-template-columns:100%;grid-template-rows:auto 1fr auto;box-sizing:border-box;pointer-events:auto;background-clip:padding-box;border:0 solid rgba(0, 0, 0, 0.2);border-radius:0.4375rem;z-index:20000;padding:1.375rem 1.875rem 1.875rem 1.875rem}.wcs-modal-container[data-size=s]{width:288px}.wcs-modal-container[data-size=m]{width:480px}.wcs-modal-container[data-size=l]{width:864px}.wcs-modal-container[data-size=xl]{width:1200px}.wcs-modal-header{margin-bottom:8px;display:flex;align-items:center;justify-content:space-between}.wcs-modal-header h1{font-size:24px;font-weight:400;margin:0}.wcs-modal-content{font-weight:400;font-size:16px;overflow-y:var(--wcs-modal-overflow-y, auto)}.wcs-modal-actions{margin-top:20px;display:flex;justify-content:flex-end}";
|
|
10
10
|
|
|
11
11
|
const Modal = class {
|
|
12
12
|
constructor(hostRef) {
|
|
@@ -24,11 +24,26 @@ const Modal = class {
|
|
|
24
24
|
* @private
|
|
25
25
|
*/
|
|
26
26
|
this.showAttributeChangedMarker = false;
|
|
27
|
+
/**
|
|
28
|
+
* This attribute is used to determine if the modal has been closed for the first time since its last activation.
|
|
29
|
+
* It is set to 'true' when the modal is first closed, and will be reset to 'false' when the modal is shown again.
|
|
30
|
+
* This state is important for accessibility reasons in order to focus the modal trigger element (like the button
|
|
31
|
+
* which controls the modal)
|
|
32
|
+
*
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
this.hasBeenClosedBefore = false;
|
|
27
36
|
this.withoutBackdrop = false;
|
|
28
37
|
this.show = false;
|
|
29
38
|
this.showCloseButton = false;
|
|
30
39
|
this.size = 'm';
|
|
31
40
|
this.hideActions = false;
|
|
41
|
+
this.modalTriggerControlsId = undefined;
|
|
42
|
+
}
|
|
43
|
+
componentWillLoad() {
|
|
44
|
+
if (!this.modalTriggerControlsId) {
|
|
45
|
+
console.warn('wcs-modal: You must provide the modal-trigger-controls-id attribute to the modal to make it to work properly');
|
|
46
|
+
}
|
|
32
47
|
}
|
|
33
48
|
componentDidLoad() {
|
|
34
49
|
this.updateFocusableElements();
|
|
@@ -43,8 +58,23 @@ const Modal = class {
|
|
|
43
58
|
}
|
|
44
59
|
onShowChange() {
|
|
45
60
|
if (this.show) {
|
|
61
|
+
this.hasBeenClosedBefore = false;
|
|
46
62
|
this.showAttributeChangedMarker = true;
|
|
47
63
|
}
|
|
64
|
+
else {
|
|
65
|
+
// if we already made actions when the modal was firstly closed, we do nothing
|
|
66
|
+
if (this.hasBeenClosedBefore) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
this.hasBeenClosedBefore = true;
|
|
70
|
+
if (this.modalTriggerControlsId) {
|
|
71
|
+
const modalTriggerControlsHtmlElement = document.getElementById(this.modalTriggerControlsId);
|
|
72
|
+
if (!modalTriggerControlsHtmlElement) {
|
|
73
|
+
console.warn(`wcs-modal: Element with id '${this.modalTriggerControlsId}' could not be found`);
|
|
74
|
+
}
|
|
75
|
+
modalTriggerControlsHtmlElement === null || modalTriggerControlsHtmlElement === void 0 ? void 0 : modalTriggerControlsHtmlElement.focus();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
48
78
|
}
|
|
49
79
|
updateFocusableElements() {
|
|
50
80
|
const focusableElements = Array.from(this.el.querySelectorAll('*'))
|
|
@@ -86,7 +116,7 @@ const Modal = class {
|
|
|
86
116
|
}
|
|
87
117
|
render() {
|
|
88
118
|
const modalTitleId = `wcs-modal-title-${this.modalId}`;
|
|
89
|
-
return (index.h(index.Host, null, index.h("div", { class: "wcs-modal-container", "data-size": this.size, "aria-modal": true, role: "dialog", "aria-labelledby": modalTitleId }, index.h("div", { class: "wcs-modal-header" }, index.h("
|
|
119
|
+
return (index.h(index.Host, null, index.h("div", { class: "wcs-modal-container", "data-size": this.size, "aria-modal": true, role: "dialog", "aria-labelledby": modalTitleId }, index.h("div", { class: "wcs-modal-header" }, index.h("h1", { id: modalTitleId }, index.h("slot", { name: "header" })), this.showCloseButton && (index.h("wcs-button", { shape: "round", mode: "clear", class: "wcs-dark", onClick: ($event) => this.onCloseButtonClick($event) }, index.h("wcs-mat-icon", { icon: "close" })))), index.h("div", { class: "wcs-modal-content" }, index.h("slot", { onSlotchange: () => this.handleSlotContentChange() })), !this.hideActions && (index.h("div", { class: "wcs-modal-actions" }, index.h("slot", { name: "actions" }))))));
|
|
90
120
|
}
|
|
91
121
|
get el()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IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,UAAU,EAC3C,OAAO,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAC5DA,0BAAc,IAAI,EAAC,OAAO,GAAgB,CACjC,CAAC,CAGhB,EACNA,iBAAK,KAAK,EAAC,mBAAmB,IAC1BA,kBAAM,YAAY,EAAE,MAAM,IAAI,CAAC,uBAAuB,EAAE,GAAS,CAC/D,EACL,CAAC,IAAI,CAAC,WAAW,KACdA,iBAAK,KAAK,EAAC,mBAAmB,IAC1BA,kBAAM,IAAI,EAAC,SAAS,GAAQ,CAC1B,CAAC,CAET,CACH,EACT;GACL;;;;;;AAGL,IAAI,QAAQ,GAAG,CAAC,CAAC;;;;;","names":["isFocusable","isTabKey","isElementFocused","h","Host"],"sources":["./src/components/modal/modal.scss?tag=wcs-modal","./src/components/modal/modal.tsx"],"sourcesContent":["wcs-modal {\n z-index: 999;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: rgba(0, 0, 0, 0.4);\n}\n\nwcs-modal[show] {\n display: flex;\n height: 100vh;\n width: 100vw;\n align-items: center;\n justify-content: center;\n}\n\n/**\nBackdrop\n */\nwcs-modal[without-backdrop] {\n background-color: unset;\n\n .wcs-modal-container {\n border: solid 1px var(--wcs-text-light);\n }\n}\n\n/**\nModal window\n */\n.wcs-modal-container {\n max-height: var(--wcs-modal-max-height, 80%);\n background-color: #fff;\n display: grid;\n grid-template-columns: 100%;\n grid-template-rows: auto 1fr auto;\n box-sizing: border-box;\n pointer-events: auto;\n background-clip: padding-box;\n border: 0 solid rgba(0, 0, 0, 0.2);\n border-radius: 0.4375rem;\n z-index: 20000;\n padding: 1.375rem 1.875rem 1.875rem 1.875rem;\n}\n\n.wcs-modal-container[data-size=s] {\n width: 288px;\n}\n\n.wcs-modal-container[data-size=m] {\n width: 480px;\n}\n\n.wcs-modal-container[data-size=l] {\n width: 864px;\n}\n\n.wcs-modal-container[data-size=xl] {\n width: 1200px;\n}\n\n.wcs-modal-header {\n h5 {\n font-size: 24px;\n font-weight: 400;\n margin: 0;\n }\n\n margin-bottom: 8px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n.wcs-modal-content {\n font-weight: 400;\n font-size: 16px;\n overflow-y: auto;\n}\n\n.wcs-modal-actions {\n margin-top: 20px;\n display: flex;\n justify-content: flex-end;\n}\n","import {\n Element,\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n ComponentInterface, \n Watch\n} from '@stencil/core';\nimport { ModalSize } from './modal-interface';\nimport { isElementFocused, isFocusable } from \"../../utils/accessibility\";\nimport { isTabKey } from \"../../utils/helpers\";\n\n@Component({\n tag: 'wcs-modal',\n styleUrl: 'modal.scss',\n shadow: false,\n})\nexport class Modal implements ComponentInterface {\n @Element() el: HTMLElement;\n\n /**\n * Specifies whether the component should display a backdrop on the entire page\n */\n @Prop({reflect: true}) withoutBackdrop: boolean = false;\n\n /**\n * Displays the modal\n */\n @Prop({reflect: true}) show: boolean = false;\n\n /**\n * Triggered when the user leaves the dialog with the closing button.\n */\n @Event() wcsDialogClosed: EventEmitter<void>;\n\n /**\n * Specifies whether the component should display a close button.\n * if false, it won't close the modal when the escape key is pressed.\n */\n @Prop({reflect: true}) showCloseButton: boolean = false;\n\n /**\n * There are multiple sizes for modals. The default size is medium (m), however other sizes are available. Select the\n * size best suited for the content and screen size displaying the modal. Remember to test responsiveness.\n */\n @Prop() size: ModalSize = 'm';\n\n /**\n * Specifies whether the component should hide the actions slot or not\n */\n @Prop({reflect: true}) hideActions: boolean = false;\n\n /**\n * Give an unique id\n * @private\n */\n private modalId: number = modalIds++;\n\n private firstFocusableElement: HTMLElement;\n private lastFocusableElement: HTMLElement;\n /**\n * This attribute is used to determine whether the show attribute has changed since the last rendering. \n * This allows us to call the focus method on the first element of the modal when the show attribute changes to true. \n * This call is made in the componentDidRender method\n * @private\n */\n private showAttributeChangedMarker: boolean = false;\n\n componentDidLoad() {\n this.updateFocusableElements();\n }\n\n componentDidRender() {\n this.updateFocusableElements();\n if (this.showAttributeChangedMarker) {\n this.showAttributeChangedMarker = false;\n this.firstFocusableElement?.focus();\n }\n }\n \n @Watch(\"show\")\n onShowChange() {\n if(this.show) {\n this.showAttributeChangedMarker = true;\n }\n }\n\n private updateFocusableElements() {\n const focusableElements = Array.from(this.el.querySelectorAll('*'))\n .filter(element => isFocusable(element));\n\n this.firstFocusableElement = focusableElements.length > 0 && focusableElements[0] as HTMLElement;\n this.lastFocusableElement = focusableElements.length > 0 && focusableElements[focusableElements.length - 1] as HTMLElement;\n }\n \n private close() {\n // If the modal isn't shown, we don't do anything\n if (this.show) {\n this.show = false;\n this.wcsDialogClosed.emit();\n }\n }\n\n @Listen('keydown', {target: 'document'})\n onKeyDown(event: KeyboardEvent) {\n if (this.show && this.showCloseButton && event.key === 'Escape') {\n this.close();\n }\n\n if (this.show) {\n const firstElement = this.firstFocusableElement;\n const lastElement = this.lastFocusableElement;\n\n if (isTabKey(event)) {\n if (event.shiftKey && isElementFocused(firstElement)) {\n event.preventDefault();\n lastElement.focus();\n } else if (!event.shiftKey && isElementFocused(lastElement)) {\n event.preventDefault();\n firstElement.focus();\n }\n }\n }\n }\n\n private onCloseButtonClick(_: MouseEvent) {\n this.close();\n }\n\n private handleSlotContentChange() {\n this.updateFocusableElements();\n }\n\n render() {\n const modalTitleId = `wcs-modal-title-${this.modalId}`;\n return (\n <Host>\n <div class=\"wcs-modal-container\"\n data-size={this.size}\n aria-modal={true}\n role={\"dialog\"}\n aria-labelledby={modalTitleId}\n >\n <div class=\"wcs-modal-header\">\n <h5 id={modalTitleId}>\n <slot name=\"header\"></slot>\n </h5>\n {this.showCloseButton && (\n <wcs-button shape=\"round\" mode=\"clear\" class=\"wcs-dark\"\n onClick={($event) => this.onCloseButtonClick($event)}>\n <wcs-mat-icon icon=\"close\"></wcs-mat-icon>\n </wcs-button>)\n }\n\n </div>\n <div class=\"wcs-modal-content\">\n <slot onSlotchange={() => this.handleSlotContentChange()}></slot>\n </div>\n {!this.hideActions && (\n <div class=\"wcs-modal-actions\">\n <slot name=\"actions\"></slot>\n </div>)\n }\n </div>\n </Host>\n );\n }\n}\n\nlet modalIds = 0;\n"],"version":3}
|
|
1
|
+
{"file":"wcs-modal.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,QAAQ,GAAG,srCAAsrC;;MC0C1rC,KAAK;;;;;;;;IA6CN,YAAO,GAAW,QAAQ,EAAE,CAAC;;;;;;;IAU7B,+BAA0B,GAAY,KAAK,CAAC;;;;;;;;;IAS5C,wBAAmB,GAAY,KAAK,CAAC;2BA1DK,KAAK;gBAKD,KAAK;2BAWT,KAAK;gBAM7B,GAAG;uBAKiB,KAAK;;;EAiCnD,iBAAiB;IACb,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE;MAC9B,OAAO,CAAC,IAAI,CAAC,8GAA8G,CAAC,CAAC;KAChI;GACJ;EAED,gBAAgB;IACZ,IAAI,CAAC,uBAAuB,EAAE,CAAC;GAClC;EAED,kBAAkB;;IACd,IAAI,CAAC,uBAAuB,EAAE,CAAC;IAC/B,IAAI,IAAI,CAAC,0BAA0B,EAAE;MACjC,IAAI,CAAC,0BAA0B,GAAG,KAAK,CAAC;MACxC,MAAA,IAAI,CAAC,qBAAqB,0CAAE,KAAK,EAAE,CAAC;KACvC;GACJ;EAGD,YAAY;IACR,IAAG,IAAI,CAAC,IAAI,EAAE;MACV,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;MACjC,IAAI,CAAC,0BAA0B,GAAG,IAAI,CAAC;KAC1C;SAAM;;MAEH,IAAG,IAAI,CAAC,mBAAmB,EAAE;QACzB,OAAO;OACV;MAED,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;MAEhC,IAAG,IAAI,CAAC,sBAAsB,EAAE;QAC5B,MAAM,+BAA+B,GAAG,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;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ey","isElementFocused","h","Host"],"sources":["./src/components/modal/modal.scss?tag=wcs-modal","./src/components/modal/modal.tsx"],"sourcesContent":["wcs-modal {\n z-index: 999;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: rgba(0, 0, 0, 0.4);\n}\n\nwcs-modal[show] {\n display: flex;\n height: 100vh;\n width: 100vw;\n align-items: center;\n justify-content: center;\n}\n\n/**\nBackdrop\n */\nwcs-modal[without-backdrop] {\n background-color: unset;\n\n .wcs-modal-container {\n border: solid 1px var(--wcs-text-light);\n }\n}\n\n/**\nModal window\n */\n.wcs-modal-container {\n max-height: var(--wcs-modal-max-height, 80%);\n background-color: #fff;\n display: grid;\n grid-template-columns: 100%;\n grid-template-rows: auto 1fr auto;\n box-sizing: border-box;\n pointer-events: auto;\n background-clip: padding-box;\n border: 0 solid rgba(0, 0, 0, 0.2);\n border-radius: 0.4375rem;\n z-index: 20000;\n padding: 1.375rem 1.875rem 1.875rem 1.875rem;\n}\n\n.wcs-modal-container[data-size=s] {\n width: 288px;\n}\n\n.wcs-modal-container[data-size=m] {\n width: 480px;\n}\n\n.wcs-modal-container[data-size=l] {\n width: 864px;\n}\n\n.wcs-modal-container[data-size=xl] {\n width: 1200px;\n}\n\n.wcs-modal-header {\n h1 {\n font-size: 24px;\n font-weight: 400;\n margin: 0;\n }\n\n margin-bottom: 8px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n.wcs-modal-content {\n font-weight: 400;\n font-size: 16px;\n overflow-y: var(--wcs-modal-overflow-y, auto);\n}\n\n.wcs-modal-actions {\n margin-top: 20px;\n display: flex;\n justify-content: flex-end;\n}\n","import {\n Element,\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n ComponentInterface, \n Watch\n} from '@stencil/core';\nimport { ModalSize } from './modal-interface';\nimport { isElementFocused, isFocusable } from \"../../utils/accessibility\";\nimport { isTabKey } from \"../../utils/helpers\";\n\n/**\n * The modal component (also named dialog or popup) is an interface element that appears on top of the page content.\n * Use it to show a message, a confirmation dialog, or any other content like forms.\n *\n * <details>\n * <summary>Accessibility guidelines 💡</summary>\n * > - Modal element has `role=\"dialog\"` and `aria-modal=\"true\"`\n * > - Keyboard navigation is trapped inside the modal\n * > - It is mandatory to set the `modal-trigger-controls-id` to the id of the element that opens the dialog, in order\n * > to focus it upon dialog dismissal.\n * > - The modal can be closed at any time by pressing the Escape key.\n * >\n * > - More info : https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/\n * </details>\n *\n * @cssprop --wcs-modal-max-height - Max height of the main container\n * @cssprop --wcs-modal-overflow-y - Overflow-y of the content\n * @slot <no-name> Main container slot\n * @slot header Header container slot (for title)\n * @slot actions Actions container slot (for buttons)\n */\n@Component({\n tag: 'wcs-modal',\n styleUrl: 'modal.scss',\n shadow: false,\n})\nexport class Modal implements ComponentInterface {\n @Element() private el: HTMLElement;\n\n /**\n * Specifies whether the component should display a backdrop on the entire page\n */\n @Prop({reflect: true}) withoutBackdrop: boolean = false;\n\n /**\n * Displays the modal\n */\n @Prop({reflect: true, mutable: true}) show: boolean = false;\n\n /**\n * Triggered when the user leaves the dialog with the closing button.\n */\n @Event() wcsDialogClosed: EventEmitter<void>;\n\n /**\n * Specifies whether the component should display a close button.\n * if false, it won't close the modal when the escape key is pressed.\n */\n @Prop({reflect: true}) showCloseButton: boolean = false;\n\n /**\n * There are multiple sizes for modals. The default size is medium (m), however other sizes are available. Select the\n * size best suited for the content and screen size displaying the modal. Remember to test responsiveness.\n */\n @Prop() size: ModalSize = 'm';\n\n /**\n * Specifies whether the component should hide the actions slot or not\n */\n @Prop({reflect: true}) hideActions: boolean = false;\n\n /**\n * Specifies which element id controls the modal\n * @private\n */\n @Prop() modalTriggerControlsId: string;\n\n /**\n * Give an unique id\n * @private\n */\n private modalId: number = modalIds++;\n\n private firstFocusableElement: HTMLElement;\n private lastFocusableElement: HTMLElement;\n /**\n * This attribute is used to determine whether the show attribute has changed since the last rendering. \n * This allows us to call the focus method on the first element of the modal when the show attribute changes to true. \n * This call is made in the componentDidRender method\n * @private\n */\n private showAttributeChangedMarker: boolean = false;\n /**\n * This attribute is used to determine if the modal has been closed for the first time since its last activation.\n * It is set to 'true' when the modal is first closed, and will be reset to 'false' when the modal is shown again.\n * This state is important for accessibility reasons in order to focus the modal trigger element (like the button \n * which controls the modal)\n *\n * @private\n */\n private hasBeenClosedBefore: boolean = false;\n\n componentWillLoad(): Promise<void> | void {\n if (!this.modalTriggerControlsId) {\n console.warn('wcs-modal: You must provide the modal-trigger-controls-id attribute to the modal to make it to work properly');\n }\n }\n\n componentDidLoad() {\n this.updateFocusableElements();\n }\n\n componentDidRender() {\n this.updateFocusableElements();\n if (this.showAttributeChangedMarker) {\n this.showAttributeChangedMarker = false;\n this.firstFocusableElement?.focus();\n }\n }\n \n @Watch(\"show\")\n onShowChange() {\n if(this.show) {\n this.hasBeenClosedBefore = false;\n this.showAttributeChangedMarker = true;\n } else {\n // if we already made actions when the modal was firstly closed, we do nothing\n if(this.hasBeenClosedBefore) {\n return;\n }\n \n this.hasBeenClosedBefore = true;\n\n if(this.modalTriggerControlsId) {\n const modalTriggerControlsHtmlElement = document.getElementById(this.modalTriggerControlsId);\n if(!modalTriggerControlsHtmlElement) {\n console.warn(`wcs-modal: Element with id '${this.modalTriggerControlsId}' could not be found`);\n }\n modalTriggerControlsHtmlElement?.focus();\n }\n }\n }\n\n private updateFocusableElements() {\n const focusableElements = Array.from(this.el.querySelectorAll('*'))\n .filter(element => isFocusable(element));\n\n this.firstFocusableElement = focusableElements.length > 0 && focusableElements[0] as HTMLElement;\n this.lastFocusableElement = focusableElements.length > 0 && focusableElements[focusableElements.length - 1] as HTMLElement;\n }\n \n private close() {\n // If the modal isn't shown, we don't do anything\n if (this.show) {\n this.show = false;\n this.wcsDialogClosed.emit();\n }\n }\n\n @Listen('keydown', {target: 'document'})\n onKeyDown(event: KeyboardEvent) {\n if (this.show && this.showCloseButton && event.key === 'Escape') {\n this.close();\n }\n\n if (this.show) {\n const firstElement = this.firstFocusableElement;\n const lastElement = this.lastFocusableElement;\n\n if (isTabKey(event)) {\n if (event.shiftKey && isElementFocused(firstElement)) {\n event.preventDefault();\n lastElement.focus();\n } else if (!event.shiftKey && isElementFocused(lastElement)) {\n event.preventDefault();\n firstElement.focus();\n }\n }\n }\n }\n\n private onCloseButtonClick(_: MouseEvent) {\n this.close();\n }\n\n private handleSlotContentChange() {\n this.updateFocusableElements();\n }\n\n render() {\n const modalTitleId = `wcs-modal-title-${this.modalId}`;\n return (\n <Host>\n <div class=\"wcs-modal-container\"\n data-size={this.size}\n aria-modal={true}\n role={\"dialog\"}\n aria-labelledby={modalTitleId}\n >\n <div class=\"wcs-modal-header\">\n <h1 id={modalTitleId}>\n <slot name=\"header\"></slot>\n </h1>\n {this.showCloseButton && (\n <wcs-button shape=\"round\" mode=\"clear\" class=\"wcs-dark\"\n onClick={($event) => this.onCloseButtonClick($event)}>\n <wcs-mat-icon icon=\"close\"></wcs-mat-icon>\n </wcs-button>)\n }\n\n </div>\n <div class=\"wcs-modal-content\">\n <slot onSlotchange={() => this.handleSlotContentChange()}></slot>\n </div>\n {!this.hideActions && (\n <div class=\"wcs-modal-actions\">\n <slot name=\"actions\"></slot>\n </div>)\n }\n </div>\n </Host>\n );\n }\n}\n\nlet modalIds = 0;\n"],"version":3}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const selectArrow = require('./select-arrow-
|
|
5
|
+
const index = require('./index-749d999e.js');
|
|
6
|
+
const selectArrow = require('./select-arrow-8169c0cb.js');
|
|
7
7
|
|
|
8
|
-
const nativeSelectCss = ":host{box-sizing:border-box}::slotted(select){box-sizing:border-box;-moz-appearance:none !important;-webkit-appearance:none !important;appearance:none !important;--wcs-select-native-ligther-percentage:40;--wcs-select-native-border-radius:var(--wcs-border-radius);--wcs-select-native-background-color:var(--wcs-light);--wcs-select-native-placeholder-color:var(--wcs-text-medium);--wcs-select-native-value-color:var(--wcs-primary);--wcs-select-native-border-color:transparent;--wcs-select-native-overlay-max-height:360px;--wcs-select-native-border-width:
|
|
8
|
+
const nativeSelectCss = ":host{box-sizing:border-box}::slotted(select){box-sizing:border-box;-moz-appearance:none !important;-webkit-appearance:none !important;appearance:none !important;--wcs-select-native-ligther-percentage:40;--wcs-select-native-border-radius:var(--wcs-border-radius);--wcs-select-native-background-color:var(--wcs-light);--wcs-select-native-placeholder-color:var(--wcs-text-medium);--wcs-select-native-value-color:var(--wcs-primary);--wcs-select-native-border-color:transparent;--wcs-select-native-overlay-max-height:360px;--wcs-select-native-border-width:1px;background-color:var(--wcs-select-native-background-color);color:var(--wcs-select-native-color);border-radius:var(--wcs-border-radius);border:none;outline:none;user-select:none;cursor:pointer;line-height:1.5;font-size:1rem;max-width:100%;flex-grow:1;padding-right:calc(var(--wcs-base-margin) * 2 + 24px);padding-left:calc(var(--wcs-base-margin) * 2)}::slotted(select:disabled){cursor:not-allowed;color:var(--wcs-text-disabled)}:host([data-disabled]) .select-wrapper .arrow-container .arrow{fill:var(--wcs-text-medium)}:host([data-size=m]) ::slotted(select){height:var(--wcs-size-m)}:host([data-size=l]) ::slotted(select){height:var(--wcs-size-l)}::slotted(select:focus-visible){outline:2px dashed var(--wcs-primary);outline-offset:0;border-radius:var(--wcs-select-border-radius);border-radius:var(--wcs-select-native-border-radius)}.select-wrapper{position:relative;display:flex;flex-wrap:nowrap}svg{flex-shrink:0}.arrow{fill:var(--wcs-primary)}.arrow-container{pointer-events:none;display:flex;align-items:center;vertical-align:center;position:absolute;top:0;bottom:0;right:calc(var(--wcs-padding) - 1px);margin:auto 0}";
|
|
9
9
|
|
|
10
10
|
const NativeSelect = class {
|
|
11
11
|
constructor(hostRef) {
|
|
@@ -15,6 +15,9 @@ const NativeSelect = class {
|
|
|
15
15
|
this.expanded = false;
|
|
16
16
|
this.disabled = undefined;
|
|
17
17
|
}
|
|
18
|
+
async setAriaAttribute(attr, value) {
|
|
19
|
+
this.selectElement.setAttribute(attr, value);
|
|
20
|
+
}
|
|
18
21
|
componentWillLoad() {
|
|
19
22
|
this.selectElement = this.el.querySelector('select');
|
|
20
23
|
if (!this.selectElement)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"wcs-native-select.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,eAAe,GAAG,0nDAA0nD;;MCyCroD,YAAY;;;IAoBJ,2CAAsC,GAAG,CAAC,UAAU,CAAC,CAAC;gBAXpB,GAAG;oBAIjB,KAAK;;;EAS1C,iBAAiB;IACb,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,CAAC,IAAI,CAAC,aAAa;MAAE,MAAM,IAAI,KAAK,CAAC,iGAAiG,CAAC,CAAC;IAE5I,IAAI,CAAC,sBAAsB,EAAE,CAAC;;;;IAK9B,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,QAAQ,EAAE;MAC1C,IAAI,CAAC,sBAAsB,EAAE,CAAC;KACjC,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,GAAG,IAAI,gBAAgB,CAAC,SAAS;MAC1C,MAAM,oBAAoB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,IAAI,CAAC,sCAAsC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;MACrI,IAAI,oBAAoB,EAAE;QACtB,IAAI,CAAC,oCAAoC,EAAE,CAAC;OAC/C;;;;MAKD,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,KAAK,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/D,IAAI,CAAC,aAAa,EAAE,CAAC;OACxB;KACJ,CAAC,CAAC;IACH,IAAI,CAAC,oCAAoC,EAAE,C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AC,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM;MACjD,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAC;MAClC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;QAClB,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC;OAChC;KACJ,CAAC,CAAC;GACN;EAEO,oCAAoC;;IACxC,IAAI,CAAC,QAAQ,GAAG,MAAA,IAAI,CAAC,aAAa,0CAAE,YAAY,CAAC,UAAU,CAAC,CAAC;GAChE;EAED,oBAAoB;;IAChB,MAAA,IAAI,CAAC,QAAQ,0CAAE,UAAU,EAAE,CAAC;IAC5B,MAAA,IAAI,CAAC,aAAa,0CAAE,mBAAmB,CAAC,QAAQ,EAAE;MAC9C,IAAI,CAAC,sBAAsB,EAAE,CAAC;KACjC,CAAC,CAAC;GACN;;;;EAMD,MAAM,YAAY;;;;;IAKd,IAAI,CAAC,aAAa,EAAE,CAAC;GACxB;EAED,MAAM;IACF,QACIA,QAACC,UAAI,IAAC,KAAK,EAAE,GAAG,IAAI,CAAC,QAAQ,GAAG,UAAU,GAAG,EAAE,EAAE,mBAAiB,IAAI,CAAC,QAAQ,eAAa,IAAI,CAAC,IAAI,IACjGD,iBAAK,KAAK,EAAC,gBAAgB,IACvBA,qBAAa,EACbA,iBAAK,KAAK,EAAC,iBAAiB,IACxBA,QAACE,uBAAW,IAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,GAAgB,CAC5C,CACJ,CACH,EACT;GACL;;;;;;;","names":["h","Host","SelectArrow"],"sources":["./src/components/native-select/native-select.scss?tag=wcs-native-select&encapsulation=shadow","./src/components/native-select/native-select.tsx"],"sourcesContent":["// TODO: voir pour mettre en commun avec le style du composant personnalisée\n@import '../../style/focus-outline.scss';\n\n:host {\n box-sizing: border-box;\n}\n\n::slotted(select) {\n box-sizing: border-box;\n -moz-appearance:none !important;\n -webkit-appearance: none !important;\n appearance: none !important;\n\n --wcs-select-native-ligther-percentage: 40;\n --wcs-select-native-border-radius: var(--wcs-border-radius);\n --wcs-select-native-background-color: var(--wcs-light);\n --wcs-select-native-placeholder-color: var(--wcs-text-medium);\n --wcs-select-native-value-color: var(--wcs-primary);\n --wcs-select-native-border-color: transparent;\n --wcs-select-native-overlay-max-height: 360px;\n --wcs-select-native-border-width: 2px;\n\n background-color: var(--wcs-select-native-background-color);\n\n color: var(--wcs-select-native-color);\n\n border-radius: var(--wcs-border-radius);\n border: none;\n\n outline: none;\n user-select: none;\n cursor: pointer;\n line-height: 1.5;\n font-size: 1rem;\n\n max-width: 100%;\n flex-grow: 1;\n padding-right: calc((var(--wcs-base-margin) * 2) + 24px);\n padding-left: calc(var(--wcs-base-margin) * 2);\n}\n\n::slotted(select:disabled) {\n cursor: not-allowed;\n color: var(--wcs-text-disabled);\n}\n\n:host([data-disabled]) {\n .select-wrapper {\n .arrow-container {\n .arrow {\n fill: var(--wcs-text-medium);\n }\n }\n }\n}\n\n:host([data-size=m]) {\n ::slotted(select) {\n height: var(--wcs-size-m);\n }\n}\n\n:host([data-size=l]) {\n ::slotted(select) {\n height: var(--wcs-size-l);\n }\n}\n\n::slotted(select:focus) {\n background-clip: padding-box;\n box-shadow: inset 0 0 0 var(--wcs-select-native-border-width) var(--wcs-primary);\n background-color: var(--wcs-white);\n}\n\n.select-wrapper {\n position: relative;\n\n display: flex;\n flex-wrap: nowrap;\n}\n\n// So the arrow on the right doesn't shrink when text overflows.\nsvg {\n flex-shrink: 0;\n}\n\n.arrow {\n fill: var(--wcs-primary);\n}\n\n.arrow-container {\n pointer-events: none;\n display: flex;\n align-items: center;\n vertical-align: center;\n\n position: absolute;\n top: 0;\n bottom: 0;\n right: calc(var(--wcs-padding) - 1px);\n margin: auto 0;\n}\n","import { Component, h, ComponentInterface, State, Prop, Host, Element, Method } from '@stencil/core';\nimport { SelectArrow } from '../select/select-arrow';\nimport { WcsSize } from \"../../shared-types\";\n\nexport type WcsNativeSelectSize = Extract<WcsSize, 'l' | 'm'>; // todo: move into common file with custom select\n\n/**\n * The `wcs-native-select` component is designed to accept a native `<select>` element as a slotted child. This choice\n * allows developers to bind the `<select>` element using the framework of their choice, without the need to re-expose all the\n * properties of the `<select>` and `<option>` elements in this component.\n *\n * The component wraps the native `<select>` element and provides custom styles and behavior, while preserving the native\n * functionality and accessibility.\n *\n * ### ✅ Guidance\n *\n * - To have a placeholder, you must have an option as child which has `selected` attribute and `disabled`\n * attribute. You can add the `hidden` attribute to don't show the placeholder option in the options overlay.\n *\n * ### Example usage\n *\n * ```html\n * <wcs-native-select>\n * <select>\n * <option value=\"option1\">Option 1</option>\n * <option value=\"option2\">Option 2</option>\n * <option value=\"option3\">Option 3</option>\n * </select>\n * </wcs-native-select>\n * ```\n *\n * ### Note\n * - We did not find a way to detect when the select is reset, if you want to apply the placeholder style when the\n * select is reset, you have to call the `updateStyles()` method manually.\n * - It is strongly recommended to use select-native when you don't have to support the multi-selection feature\n */\n@Component({\n tag: 'wcs-native-select',\n styleUrl: 'native-select.scss',\n shadow: true\n})\nexport class NativeSelect implements ComponentInterface {\n /**\n * The `size` property controls the size of the slotted `select` element by adjusting its padding.\n * There are two possible size options:\n * - 'm': medium size\n * - 'l': large size\n *\n * The default value is 'm'.\n */\n @Prop({reflect: true}) size: WcsNativeSelectSize = 'm';\n\n @Element() private el!: HTMLWcsNativeSelectElement;\n\n @State() private expanded: boolean = false;\n @State() private disabled: boolean;\n\n private selectElement: HTMLSelectElement;\n private observer: MutationObserver;\n\n\n private readonly SLOTTED_SELECT_TRACKED_ATTRIBUTES_LIST = ['disabled'];\n\n componentWillLoad() {\n this.selectElement = this.el.querySelector('select');\n if (!this.selectElement) throw new Error(\"wcs-native-select must be used with a native slotted select, please refer to the documentation.\");\n\n this.onSelectedOptionChange();\n\n /**\n * We use an event listener to apply the default style to the select when user chose an active option\n */\n this.selectElement.addEventListener('change', () => {\n this.onSelectedOptionChange();\n });\n\n this.observer = new MutationObserver(mutations => {\n const hasSpiedAttrMutation = mutations.filter(m => this.SLOTTED_SELECT_TRACKED_ATTRIBUTES_LIST.includes(m.attributeName)).length > 0;\n if (hasSpiedAttrMutation) {\n this.updateHostAttributeWithSlottedSelect();\n }\n\n // A workaround to detect when the select is reset by using a class change on the select element. For example\n // angular add/remove ng-pristine and ng-dirty classes on the form controls when the form is reset.\n // Not the best solution but it works since we cannot detect the reset event on the native select element.\n if (mutations.filter(m => m.attributeName === 'class').length > 0) {\n this._updateStyles();\n }\n });\n this.updateHostAttributeWithSlottedSelect();\n this.observer.observe(this.selectElement, {attributes: true});\n }\n\n private onSelectedOptionChange(): void {\n this._updateStyles();\n }\n\n private _updateStyles() {\n if (this.isPlaceholderOptionSelected()) {\n this.applyPlaceholderStylesOnNativeSlottedSelectElement();\n } else {\n this.applySelectedOptionStylesOnNativeSlottedSelectElement();\n }\n }\n\n private isPlaceholderOptionSelected() {\n return Array.from(this.selectElement.options).filter(o => o.selected)[0]?.disabled == true;\n }\n\n /**\n * This method should always unset all styles modified by the `applyPlaceholderStylesOnNativeSlottedSelectElement()`\n * @private\n */\n private applySelectedOptionStylesOnNativeSlottedSelectElement() {\n this.selectElement.style.color = \"var(--wcs-primary)\";\n this.selectElement.style.fontStyle = 'normal';\n this.selectElement.style.fontWeight = '500';\n Array.from(this.selectElement.options).forEach(option => {\n option.style.fontStyle = 'normal';\n if (!option.disabled) {\n option.style.color = \"black\";\n }\n });\n }\n\n /**\n * This method apply styles when the placeholder is shown.\n *\n * We use javascript because we cannot achieve that behaviour in pure css when the native select is not required\n * @private\n */\n private applyPlaceholderStylesOnNativeSlottedSelectElement() {\n this.selectElement.style.color = \"var(--wcs-text-medium)\";\n this.selectElement.style.fontWeight = '400';\n this.selectElement.style.fontStyle = 'italic';\n Array.from(this.selectElement.options).forEach(option => {\n option.style.fontStyle = 'normal';\n if (!option.disabled) {\n option.style.color = \"black\";\n }\n });\n }\n\n private updateHostAttributeWithSlottedSelect() {\n this.disabled = this.selectElement?.hasAttribute('disabled');\n }\n\n disconnectedCallback() {\n this.observer?.disconnect();\n this.selectElement?.removeEventListener(\"change\", () => {\n this.onSelectedOptionChange();\n });\n }\n\n /**\n * Use this method to force the component to update its styles. It can be useful when the select is reset (with a placeholder).\n */\n @Method()\n async updateStyles() {\n // Note : we try to automatically detect if the select is reset with the onreset event and with a mutation\n // observer on the select element. But it seems that the onreset event is not fired when the select is reset.\n // and the mutation observer is not fired when the select is reset with the reset() method on the form.\n // So we have to let the user call this method manually when he reset the select.\n this._updateStyles();\n }\n\n render() {\n return (\n <Host class={`${this.expanded ? 'expanded' : ''}`} data-disabled={this.disabled} data-size={this.size}>\n <div class=\"select-wrapper\">\n <slot></slot>\n <div class=\"arrow-container\">\n <SelectArrow up={this.expanded}></SelectArrow>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"wcs-native-select.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,eAAe,GAAG,8oDAA8oD;;MC0CzpD,YAAY;;;IAkBJ,2CAAsC,GAAG,CAAC,UAAU,CAAC,CAAC;gBATpB,GAAG;oBAGjB,KAAK;;;EAU1C,MAAM,gBAAgB,CAAC,IAAuB,EAAE,KAAa;IACzD,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;GAChD;EAGD,iBAAiB;IACb,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,CAAC,IAAI,CAAC,aAAa;MAAE,MAAM,IAAI,KAAK,CAAC,iGAAiG,CAAC,CAAC;IAE5I,IAAI,CAAC,sBAAsB,EAAE,CAAC;;;;IAK9B,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,QAAQ,EAAE;MAC1C,IAAI,CAAC,sBAAsB,EAAE,CAAC;KACjC,CAAC,C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C,UAAI,IAAC,KAAK,EAAE,GAAG,IAAI,CAAC,QAAQ,GAAG,UAAU,GAAG,EAAE,EAAE,mBAAiB,IAAI,CAAC,QAAQ,eAAa,IAAI,CAAC,IAAI,IACjGD,iBAAK,KAAK,EAAC,gBAAgB,IACvBA,qBAAa,EACbA,iBAAK,KAAK,EAAC,iBAAiB,IACxBA,QAACE,uBAAW,IAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,GAAgB,CAC5C,CACJ,CACH,EACT;GACL;;;;;;;","names":["h","Host","SelectArrow"],"sources":["./src/components/native-select/native-select.scss?tag=wcs-native-select&encapsulation=shadow","./src/components/native-select/native-select.tsx"],"sourcesContent":["@import '../../style/focus-outline.scss';\n\n:host {\n box-sizing: border-box;\n}\n\n::slotted(select) {\n box-sizing: border-box;\n -moz-appearance:none !important;\n -webkit-appearance: none !important;\n appearance: none !important;\n\n --wcs-select-native-ligther-percentage: 40;\n --wcs-select-native-border-radius: var(--wcs-border-radius);\n --wcs-select-native-background-color: var(--wcs-light);\n --wcs-select-native-placeholder-color: var(--wcs-text-medium);\n --wcs-select-native-value-color: var(--wcs-primary);\n --wcs-select-native-border-color: transparent;\n --wcs-select-native-overlay-max-height: 360px;\n --wcs-select-native-border-width: 1px;\n\n background-color: var(--wcs-select-native-background-color);\n\n color: var(--wcs-select-native-color);\n\n border-radius: var(--wcs-border-radius);\n border: none;\n\n outline: none;\n user-select: none;\n cursor: pointer;\n line-height: 1.5;\n font-size: 1rem;\n\n max-width: 100%;\n flex-grow: 1;\n padding-right: calc((var(--wcs-base-margin) * 2) + 24px);\n padding-left: calc(var(--wcs-base-margin) * 2);\n}\n\n::slotted(select:disabled) {\n cursor: not-allowed;\n color: var(--wcs-text-disabled);\n}\n\n:host([data-disabled]) {\n .select-wrapper {\n .arrow-container {\n .arrow {\n fill: var(--wcs-text-medium);\n }\n }\n }\n}\n\n:host([data-size=m]) {\n ::slotted(select) {\n height: var(--wcs-size-m);\n }\n}\n\n:host([data-size=l]) {\n ::slotted(select) {\n height: var(--wcs-size-l);\n }\n}\n\n::slotted(select:focus-visible) {\n @include focus-outline($border-radius: var(--wcs-select-border-radius), $outline-offset: 0);\n border-radius: var(--wcs-select-native-border-radius);\n}\n\n.select-wrapper {\n position: relative;\n\n display: flex;\n flex-wrap: nowrap;\n}\n\n// So the arrow on the right doesn't shrink when text overflows.\nsvg {\n flex-shrink: 0;\n}\n\n.arrow {\n fill: var(--wcs-primary);\n}\n\n.arrow-container {\n pointer-events: none;\n display: flex;\n align-items: center;\n vertical-align: center;\n\n position: absolute;\n top: 0;\n bottom: 0;\n right: calc(var(--wcs-padding) - 1px);\n margin: auto 0;\n}\n","import { Component, h, ComponentInterface, State, Prop, Host, Element, Method } from '@stencil/core';\nimport { SelectArrow } from '../select/select-arrow';\nimport { WcsSize } from \"../../shared-types\";\nimport { AriaAttributeName, MutableAriaAttribute } from \"../../utils/mutable-aria-attribute\";\n\nexport type WcsNativeSelectSize = Extract<WcsSize, 'l' | 'm'>; // todo: move into common file with custom select\n\n/**\n * The `wcs-native-select` component is designed to accept a native `<select>` element as a slotted child. This choice\n * allows developers to bind the `<select>` element using the framework of their choice, without the need to re-expose all the\n * properties of the `<select>` and `<option>` elements in this component.\n *\n * The component wraps the native `<select>` element and provides custom styles and behavior, while preserving the native\n * functionality and accessibility.\n *\n * ### ✅ Guidance\n *\n * - To have a placeholder, you must have an option as child which has `selected` attribute and `disabled`\n * attribute. You can add the `hidden` attribute to don't show the placeholder option in the options overlay.\n *\n * ### Example usage\n *\n * ```html\n * <wcs-native-select>\n * <select>\n * <option value=\"option1\">Option 1</option>\n * <option value=\"option2\">Option 2</option>\n * <option value=\"option3\">Option 3</option>\n * </select>\n * </wcs-native-select>\n * ```\n *\n * ### Note\n * - We did not find a way to detect when the select is reset, if you want to apply the placeholder style when the\n * select is reset, you have to call the `updateStyles()` method manually.\n * - It is strongly recommended to use select-native when you don't have to support the multi-selection feature\n */\n@Component({\n tag: 'wcs-native-select',\n styleUrl: 'native-select.scss',\n shadow: true\n})\nexport class NativeSelect implements ComponentInterface, MutableAriaAttribute {\n /**\n * The `size` property controls the size of the slotted `select` element by adjusting its padding.\n * There are two possible size options:\n * - 'm': medium size\n * - 'l': large size\n *\n * The default value is 'm'.\n */\n @Prop({reflect: true}) size: WcsNativeSelectSize = 'm';\n @Element() private el!: HTMLWcsNativeSelectElement;\n\n @State() private expanded: boolean = false;\n\n @State() private disabled: boolean;\n private selectElement: HTMLSelectElement;\n\n private observer: MutationObserver;\n private readonly SLOTTED_SELECT_TRACKED_ATTRIBUTES_LIST = ['disabled'];\n\n\n @Method()\n async setAriaAttribute(attr: AriaAttributeName, value: string) {\n this.selectElement.setAttribute(attr, value);\n }\n\n\n componentWillLoad() {\n this.selectElement = this.el.querySelector('select');\n if (!this.selectElement) throw new Error(\"wcs-native-select must be used with a native slotted select, please refer to the documentation.\");\n\n this.onSelectedOptionChange();\n\n /**\n * We use an event listener to apply the default style to the select when user chose an active option\n */\n this.selectElement.addEventListener('change', () => {\n this.onSelectedOptionChange();\n });\n\n this.observer = new MutationObserver(mutations => {\n const hasSpiedAttrMutation = mutations.filter(m => this.SLOTTED_SELECT_TRACKED_ATTRIBUTES_LIST.includes(m.attributeName)).length > 0;\n if (hasSpiedAttrMutation) {\n this.updateHostAttributeWithSlottedSelect();\n }\n\n // A workaround to detect when the select is reset by using a class change on the select element. For example\n // angular add/remove ng-pristine and ng-dirty classes on the form controls when the form is reset.\n // Not the best solution but it works since we cannot detect the reset event on the native select element.\n if (mutations.filter(m => m.attributeName === 'class').length > 0) {\n this._updateStyles();\n }\n });\n this.updateHostAttributeWithSlottedSelect();\n this.observer.observe(this.selectElement, {attributes: true});\n }\n\n private onSelectedOptionChange(): void {\n this._updateStyles();\n }\n\n private _updateStyles() {\n if (this.isPlaceholderOptionSelected()) {\n this.applyPlaceholderStylesOnNativeSlottedSelectElement();\n } else {\n this.applySelectedOptionStylesOnNativeSlottedSelectElement();\n }\n }\n\n private isPlaceholderOptionSelected() {\n return Array.from(this.selectElement.options).filter(o => o.selected)[0]?.disabled == true;\n }\n\n /**\n * This method should always unset all styles modified by the `applyPlaceholderStylesOnNativeSlottedSelectElement()`\n * @private\n */\n private applySelectedOptionStylesOnNativeSlottedSelectElement() {\n this.selectElement.style.color = \"var(--wcs-primary)\";\n this.selectElement.style.fontStyle = 'normal';\n this.selectElement.style.fontWeight = '500';\n Array.from(this.selectElement.options).forEach(option => {\n option.style.fontStyle = 'normal';\n if (!option.disabled) {\n option.style.color = \"black\";\n }\n });\n }\n\n /**\n * This method apply styles when the placeholder is shown.\n *\n * We use javascript because we cannot achieve that behaviour in pure css when the native select is not required\n * @private\n */\n private applyPlaceholderStylesOnNativeSlottedSelectElement() {\n this.selectElement.style.color = \"var(--wcs-text-medium)\";\n this.selectElement.style.fontWeight = '400';\n this.selectElement.style.fontStyle = 'italic';\n Array.from(this.selectElement.options).forEach(option => {\n option.style.fontStyle = 'normal';\n if (!option.disabled) {\n option.style.color = \"black\";\n }\n });\n }\n\n private updateHostAttributeWithSlottedSelect() {\n this.disabled = this.selectElement?.hasAttribute('disabled');\n }\n\n disconnectedCallback() {\n this.observer?.disconnect();\n this.selectElement?.removeEventListener(\"change\", () => {\n this.onSelectedOptionChange();\n });\n }\n\n /**\n * Use this method to force the component to update its styles. It can be useful when the select is reset (with a placeholder).\n */\n @Method()\n async updateStyles() {\n // Note : we try to automatically detect if the select is reset with the onreset event and with a mutation\n // observer on the select element. But it seems that the onreset event is not fired when the select is reset.\n // and the mutation observer is not fired when the select is reset with the reset() method on the form.\n // So we have to let the user call this method manually when he reset the select.\n this._updateStyles();\n }\n\n render() {\n return (\n <Host class={`${this.expanded ? 'expanded' : ''}`} data-disabled={this.disabled} data-size={this.size}>\n <div class=\"select-wrapper\">\n <slot></slot>\n <div class=\"arrow-container\">\n <SelectArrow up={this.expanded}></SelectArrow>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const helpers = require('./helpers-
|
|
5
|
+
const index = require('./index-749d999e.js');
|
|
6
|
+
const helpers = require('./helpers-6280db6e.js');
|
|
7
7
|
|
|
8
8
|
const navItemCss = "wcs-nav-item{display:block;cursor:pointer}wcs-nav-item a{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;text-align:center;background-color:transparent;border:none;text-decoration:none;transition:color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;height:5rem;font-size:0.75rem;color:var(--wcs-contrast)}wcs-nav-item a:not(.active){border-bottom:1px solid rgba(255, 255, 255, 0.2)}@media (max-width: 1199px){wcs-nav-item a{display:flex;flex:1;height:3.25rem;font-size:0.625rem;color:var(--wcs-text-medium)}}wcs-nav-item a:focus{outline:none}@media (max-width: 1199px){wcs-nav-item:focus-within{outline:2px dashed var(--wcs-primary);outline-offset:1px;border-radius:0.1rem}}@media (min-width: 1200px){wcs-nav-item:focus-within{outline:2px dashed var(--wcs-white);outline-offset:-2px;border-radius:0.1rem}}wcs-nav-item i{margin-bottom:0.5rem;display:inline-block}@media (max-width: 1199px){wcs-nav-item i{margin-bottom:0.25rem;display:inline-block}}@media (min-width: 1200px){wcs-nav-item[slot=bottom] a{border-top:1px solid rgba(255, 255, 255, 0.2);border-bottom:none}}.wcs-nav-item-text{font-weight:500}.active,wcs-nav-item:hover,wcs-nav-item:focus-within{background-blend-mode:multiply;background-color:rgba(0, 0, 0, 0.15);}@media (max-width: 1199px){.active,wcs-nav-item:hover,wcs-nav-item:focus-within{background-color:unset}.active a,wcs-nav-item:hover a,wcs-nav-item:focus-within a{color:var(--wcs-primary)}}";
|
|
9
9
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-749d999e.js');
|
|
6
6
|
|
|
7
7
|
const navCss = "nav{background-image:linear-gradient(0deg, var(--wcs-primary), var(--wcs-primary));display:flex;z-index:1055;flex-direction:column;width:6.25rem;height:100%}@media (max-width: 1199px){nav{flex-direction:row;background-image:linear-gradient(0deg, var(--wcs-light), var(--wcs-light));border-top:1px solid #d8d8d8;bottom:0;width:100%;height:3.25rem}}@media (max-width: 1199px){::slotted(wcs-nav-item){flex:1}}@media (min-width: 1200px){slot[name=bottom],wcs-nav-item:not([slot=bottom])+wcs-nav-item[slot=bottom]{display:block;margin-top:auto}}";
|
|
8
8
|
|