wcs-core 7.1.0 → 7.2.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/README.md +1 -11
- package/design-tokens/dist/sncf-groupe-root-scoped.css +590 -0
- package/design-tokens/dist/sncf-groupe.css +590 -0
- package/design-tokens/dist/sncf-groupe.json +10693 -0
- package/design-tokens/dist/sncf-holding-root-scoped.css +426 -425
- package/design-tokens/dist/sncf-holding.css +426 -425
- package/design-tokens/dist/sncf-holding.json +26 -3
- package/design-tokens/dist/sncf-reseau-root-scoped.css +465 -465
- package/design-tokens/dist/sncf-reseau.css +465 -465
- package/design-tokens/dist/sncf-voyageurs-root-scoped.css +383 -383
- package/design-tokens/dist/sncf-voyageurs.css +383 -383
- package/dist/cjs/{grid-pagination-e4f29c78.js → grid-pagination-4505d7b6.js} +25 -5
- package/dist/cjs/grid-pagination-4505d7b6.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/wcs-accordion-panel.cjs.entry.js +1 -1
- package/dist/cjs/wcs-accordion-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-action-bar.cjs.entry.js +1 -1
- package/dist/cjs/wcs-action-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-alert-drawer.cjs.entry.js +99 -0
- package/dist/cjs/wcs-alert-drawer.cjs.entry.js.map +1 -0
- package/dist/cjs/wcs-alert.cjs.entry.js +121 -0
- package/dist/cjs/wcs-alert.cjs.entry.js.map +1 -0
- package/dist/cjs/wcs-app.cjs.entry.js +3 -3
- package/dist/cjs/wcs-badge.cjs.entry.js +2 -2
- package/dist/cjs/wcs-badge.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-breadcrumb-item.cjs.entry.js +1 -1
- package/dist/cjs/wcs-breadcrumb-item.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/wcs-button_2.cjs.entry.js +3 -8
- package/dist/cjs/wcs-button_2.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-card-body.cjs.entry.js +9 -2
- package/dist/cjs/wcs-card-body.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-card-content.cjs.entry.js +22 -0
- package/dist/cjs/wcs-card-content.cjs.entry.js.map +1 -0
- package/dist/cjs/wcs-card-footer.cjs.entry.js +22 -0
- package/dist/cjs/wcs-card-footer.cjs.entry.js.map +1 -0
- package/dist/cjs/wcs-card-header.cjs.entry.js +22 -0
- package/dist/cjs/wcs-card-header.cjs.entry.js.map +1 -0
- package/dist/cjs/wcs-card-media.cjs.entry.js +29 -0
- package/dist/cjs/wcs-card-media.cjs.entry.js.map +1 -0
- package/dist/cjs/wcs-card.cjs.entry.js +30 -2
- package/dist/cjs/wcs-card.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-checkbox.cjs.entry.js +1 -1
- 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-item.cjs.entry.js +1 -1
- 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 +2 -12
- 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-header.cjs.entry.js +1 -1
- package/dist/cjs/wcs-dropdown-item.cjs.entry.js +1 -1
- package/dist/cjs/wcs-dropdown.cjs.entry.js +1 -6
- package/dist/cjs/wcs-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-editable-field.cjs.entry.js +2 -2
- package/dist/cjs/wcs-editable-field.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-error_3.cjs.entry.js +3 -3
- package/dist/cjs/wcs-error_3.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 +1 -1
- 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 +1 -1
- package/dist/cjs/wcs-grid.cjs.entry.js +12 -4
- package/dist/cjs/wcs-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-header.cjs.entry.js +2 -2
- package/dist/cjs/wcs-header.cjs.entry.js.map +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-horizontal-stepper.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-icon.cjs.entry.js +1 -1
- package/dist/cjs/wcs-input.cjs.entry.js +2 -12
- package/dist/cjs/wcs-input.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 +1 -1
- package/dist/cjs/wcs-mat-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-modal.cjs.entry.js +2 -2
- package/dist/cjs/wcs-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-native-select.cjs.entry.js +2 -2
- package/dist/cjs/wcs-native-select.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-nav-item.cjs.entry.js +1 -1
- package/dist/cjs/wcs-nav.cjs.entry.js +2 -2
- package/dist/cjs/wcs-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-progress-bar.cjs.entry.js +3 -3
- package/dist/cjs/wcs-progress-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-progress-radial.cjs.entry.js +2 -2
- package/dist/cjs/wcs-progress-radial.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/wcs-radio.cjs.entry.js +1 -1
- package/dist/cjs/wcs-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-select_2.cjs.entry.js +18 -11
- 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 +1 -1
- package/dist/cjs/wcs-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-tab.cjs.entry.js +1 -1
- package/dist/cjs/wcs-tabs.cjs.entry.js +149 -6
- package/dist/cjs/wcs-tabs.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-textarea.cjs.entry.js +1 -1
- 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-tooltip.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +6 -0
- package/dist/collection/components/accordion-panel/accordion-panel.js +1 -1
- package/dist/collection/components/accordion-panel/accordion-panel.js.map +1 -1
- package/dist/collection/components/action-bar/action-bar.js +1 -1
- package/dist/collection/components/action-bar/action-bar.js.map +1 -1
- package/dist/collection/components/alert/alert-interface.js +2 -0
- package/dist/collection/components/alert/alert-interface.js.map +1 -0
- package/dist/collection/components/alert/alert.css +115 -0
- package/dist/collection/components/alert/alert.e2e.js +142 -0
- package/dist/collection/components/alert/alert.e2e.js.map +1 -0
- package/dist/collection/components/alert/alert.js +257 -0
- package/dist/collection/components/alert/alert.js.map +1 -0
- package/dist/collection/components/alert-drawer/alert-drawer-interface.js +2 -0
- package/dist/collection/components/alert-drawer/alert-drawer-interface.js.map +1 -0
- package/dist/collection/components/alert-drawer/alert-drawer.css +103 -0
- package/dist/collection/components/alert-drawer/alert-drawer.e2e.js +111 -0
- package/dist/collection/components/alert-drawer/alert-drawer.e2e.js.map +1 -0
- package/dist/collection/components/alert-drawer/alert-drawer.js +237 -0
- package/dist/collection/components/alert-drawer/alert-drawer.js.map +1 -0
- package/dist/collection/components/app/app.js +3 -3
- package/dist/collection/components/badge/badge.css +4 -1
- package/dist/collection/components/badge/badge.js +1 -1
- package/dist/collection/components/breadcrumb/breadcrumb.js +1 -1
- package/dist/collection/components/breadcrumb-item/breadcrumb-item.js +1 -1
- package/dist/collection/components/breadcrumb-item/breadcrumb-item.js.map +1 -1
- package/dist/collection/components/button/button-interface.js +1 -5
- package/dist/collection/components/button/button-interface.js.map +1 -1
- package/dist/collection/components/button/button.css +2 -2
- package/dist/collection/components/button/button.js +1 -6
- package/dist/collection/components/button/button.js.map +1 -1
- package/dist/collection/components/card/card-interface.js.map +1 -1
- package/dist/collection/components/card/card.css +10 -0
- package/dist/collection/components/card/card.js +62 -1
- package/dist/collection/components/card/card.js.map +1 -1
- package/dist/collection/components/card-body/card-body.css +12 -1
- package/dist/collection/components/card-body/card-body.js +52 -2
- package/dist/collection/components/card-body/card-body.js.map +1 -1
- package/dist/collection/components/card-content/card-content.css +12 -0
- package/dist/collection/components/card-content/card-content.js +30 -0
- package/dist/collection/components/card-content/card-content.js.map +1 -0
- package/dist/collection/components/card-footer/card-footer.css +7 -0
- package/dist/collection/components/card-footer/card-footer.js +25 -0
- package/dist/collection/components/card-footer/card-footer.js.map +1 -0
- package/dist/collection/components/card-header/card-header.css +28 -0
- package/dist/collection/components/card-header/card-header.js +32 -0
- package/dist/collection/components/card-header/card-header.js.map +1 -0
- package/dist/collection/components/card-media/card-media.css +21 -0
- package/dist/collection/components/card-media/card-media.js +77 -0
- package/dist/collection/components/card-media/card-media.js.map +1 -0
- package/dist/collection/components/checkbox/checkbox.js +1 -1
- package/dist/collection/components/checkbox/checkbox.js.map +1 -1
- package/dist/collection/components/com-nav/com-nav.js +2 -2
- package/dist/collection/components/com-nav-category/com-nav-category.js +2 -2
- package/dist/collection/components/com-nav-item/com-nav-item.js +1 -1
- package/dist/collection/components/com-nav-submenu/com-nav-submenu.js +2 -2
- package/dist/collection/components/counter/counter-interface.js +1 -5
- package/dist/collection/components/counter/counter-interface.js.map +1 -1
- package/dist/collection/components/counter/counter.css +4 -1
- package/dist/collection/components/counter/counter.js +1 -6
- package/dist/collection/components/counter/counter.js.map +1 -1
- package/dist/collection/components/divider/divider.js +1 -1
- package/dist/collection/components/dropdown/dropdown.js +2 -7
- package/dist/collection/components/dropdown/dropdown.js.map +1 -1
- package/dist/collection/components/dropdown-divider/dropdown-divider.js +1 -1
- package/dist/collection/components/dropdown-header/dropdown-header.js +1 -1
- package/dist/collection/components/dropdown-item/dropdown-item.js +1 -1
- package/dist/collection/components/editable-field/editable-field.css +3 -0
- package/dist/collection/components/editable-field/editable-field.js +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/field/field.js +1 -1
- package/dist/collection/components/field-content/field-content.js +1 -1
- package/dist/collection/components/field-label/field-label.js +1 -1
- package/dist/collection/components/footer/footer.js +1 -1
- package/dist/collection/components/form-field/form-field.js +1 -1
- package/dist/collection/components/form-field/form-field.js.map +1 -1
- package/dist/collection/components/galactic/galactic.js +1 -1
- package/dist/collection/components/galactic-menu/galactic-menu.js +2 -2
- package/dist/collection/components/grid/grid.js +30 -5
- package/dist/collection/components/grid/grid.js.map +1 -1
- package/dist/collection/components/grid-column/grid-column.js +3 -3
- package/dist/collection/components/grid-column/grid-column.js.map +1 -1
- package/dist/collection/components/grid-custom-cell/grid-custom-cell.js +1 -1
- package/dist/collection/components/grid-pagination/grid-pagination-arrow.js +2 -2
- package/dist/collection/components/grid-pagination/grid-pagination-arrow.js.map +1 -1
- package/dist/collection/components/grid-pagination/grid-pagination.js +22 -2
- package/dist/collection/components/grid-pagination/grid-pagination.js.map +1 -1
- package/dist/collection/components/header/header.css +9 -1
- package/dist/collection/components/header/header.js +2 -1
- package/dist/collection/components/header/header.js.map +1 -1
- package/dist/collection/components/hint/hint.js +1 -1
- package/dist/collection/components/horizontal-stepper/horizontal-stepper.js +2 -2
- package/dist/collection/components/horizontal-stepper/horizontal-stepper.js.map +1 -1
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/input/input-interface.js +1 -5
- package/dist/collection/components/input/input-interface.js.map +1 -1
- package/dist/collection/components/input/input.css +4 -0
- package/dist/collection/components/input/input.js +3 -8
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/collection/components/label/label.js +1 -1
- package/dist/collection/components/label/label.js.map +1 -1
- package/dist/collection/components/list-item/list-item.js +1 -1
- package/dist/collection/components/list-item-properties/list-item-properties.js +1 -1
- package/dist/collection/components/list-item-property/list-item-property.js +1 -1
- package/dist/collection/components/mat-icon/mat-icon.js +2 -2
- package/dist/collection/components/mat-icon/mat-icon.js.map +1 -1
- package/dist/collection/components/modal/modal-interface.js.map +1 -1
- package/dist/collection/components/modal/modal.css +1 -0
- package/dist/collection/components/modal/modal.js +2 -2
- package/dist/collection/components/modal/modal.js.map +1 -1
- package/dist/collection/components/native-select/native-select.css +2 -2
- package/dist/collection/components/native-select/native-select.js +2 -2
- package/dist/collection/components/native-select/native-select.js.map +1 -1
- package/dist/collection/components/nav/nav.css +2 -0
- package/dist/collection/components/nav/nav.js +1 -1
- package/dist/collection/components/nav-item/nav-item.js +1 -1
- package/dist/collection/components/progress-bar/progress-bar.css +2 -2
- package/dist/collection/components/progress-bar/progress-bar.js +3 -3
- package/dist/collection/components/progress-bar/progress-bar.js.map +1 -1
- package/dist/collection/components/progress-radial/progress-radial.js +3 -3
- package/dist/collection/components/progress-radial/progress-radial.js.map +1 -1
- package/dist/collection/components/radio/radio.js +1 -1
- package/dist/collection/components/radio/radio.js.map +1 -1
- package/dist/collection/components/radio-group/radio-group.js +1 -1
- package/dist/collection/components/select/select.css +1 -1
- package/dist/collection/components/select/select.js +16 -9
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/select-option/select-option.js +2 -2
- package/dist/collection/components/select-option/select-option.js.map +1 -1
- package/dist/collection/components/skeleton-circle/skeleton-circle.js +1 -1
- package/dist/collection/components/skeleton-rectangle/skeleton-rectangle.js +1 -1
- package/dist/collection/components/skeleton-text/skeleton-text.js +1 -1
- package/dist/collection/components/spinner/spinner.js +1 -1
- package/dist/collection/components/switch/switch.js +1 -1
- package/dist/collection/components/switch/switch.js.map +1 -1
- package/dist/collection/components/tab/tab.js +1 -1
- package/dist/collection/components/tabs/tabs.css +104 -1
- package/dist/collection/components/tabs/tabs.js +180 -5
- package/dist/collection/components/tabs/tabs.js.map +1 -1
- package/dist/collection/components/textarea/textarea.js +3 -3
- package/dist/collection/components/textarea/textarea.js.map +1 -1
- package/dist/collection/components/tooltip/tooltip.js +2 -2
- package/dist/collection/components/tooltip/tooltip.js.map +1 -1
- package/dist/esm/{grid-pagination-976a86e9.js → grid-pagination-731726a6.js} +25 -5
- package/dist/esm/grid-pagination-731726a6.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/wcs-accordion-panel.entry.js +1 -1
- package/dist/esm/wcs-accordion-panel.entry.js.map +1 -1
- package/dist/esm/wcs-action-bar.entry.js +1 -1
- package/dist/esm/wcs-action-bar.entry.js.map +1 -1
- package/dist/esm/wcs-alert-drawer.entry.js +95 -0
- package/dist/esm/wcs-alert-drawer.entry.js.map +1 -0
- package/dist/esm/wcs-alert.entry.js +117 -0
- package/dist/esm/wcs-alert.entry.js.map +1 -0
- package/dist/esm/wcs-app.entry.js +3 -3
- package/dist/esm/wcs-badge.entry.js +2 -2
- package/dist/esm/wcs-badge.entry.js.map +1 -1
- package/dist/esm/wcs-breadcrumb-item.entry.js +1 -1
- package/dist/esm/wcs-breadcrumb-item.entry.js.map +1 -1
- package/dist/esm/wcs-breadcrumb.entry.js +1 -1
- package/dist/esm/wcs-button_2.entry.js +3 -8
- package/dist/esm/wcs-button_2.entry.js.map +1 -1
- package/dist/esm/wcs-card-body.entry.js +10 -3
- package/dist/esm/wcs-card-body.entry.js.map +1 -1
- package/dist/esm/wcs-card-content.entry.js +18 -0
- package/dist/esm/wcs-card-content.entry.js.map +1 -0
- package/dist/esm/wcs-card-footer.entry.js +18 -0
- package/dist/esm/wcs-card-footer.entry.js.map +1 -0
- package/dist/esm/wcs-card-header.entry.js +18 -0
- package/dist/esm/wcs-card-header.entry.js.map +1 -0
- package/dist/esm/wcs-card-media.entry.js +25 -0
- package/dist/esm/wcs-card-media.entry.js.map +1 -0
- package/dist/esm/wcs-card.entry.js +31 -3
- package/dist/esm/wcs-card.entry.js.map +1 -1
- package/dist/esm/wcs-checkbox.entry.js +1 -1
- 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-item.entry.js +1 -1
- 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 +2 -12
- 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-header.entry.js +1 -1
- package/dist/esm/wcs-dropdown-item.entry.js +1 -1
- package/dist/esm/wcs-dropdown.entry.js +1 -6
- package/dist/esm/wcs-dropdown.entry.js.map +1 -1
- package/dist/esm/wcs-editable-field.entry.js +2 -2
- package/dist/esm/wcs-editable-field.entry.js.map +1 -1
- package/dist/esm/wcs-error_3.entry.js +3 -3
- package/dist/esm/wcs-error_3.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 +1 -1
- 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 +1 -1
- package/dist/esm/wcs-grid.entry.js +12 -4
- package/dist/esm/wcs-grid.entry.js.map +1 -1
- package/dist/esm/wcs-header.entry.js +2 -2
- package/dist/esm/wcs-header.entry.js.map +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-horizontal-stepper.entry.js.map +1 -1
- package/dist/esm/wcs-icon.entry.js +1 -1
- package/dist/esm/wcs-input.entry.js +2 -12
- package/dist/esm/wcs-input.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 +1 -1
- package/dist/esm/wcs-mat-icon.entry.js.map +1 -1
- package/dist/esm/wcs-modal.entry.js +2 -2
- package/dist/esm/wcs-modal.entry.js.map +1 -1
- package/dist/esm/wcs-native-select.entry.js +2 -2
- package/dist/esm/wcs-native-select.entry.js.map +1 -1
- package/dist/esm/wcs-nav-item.entry.js +1 -1
- package/dist/esm/wcs-nav.entry.js +2 -2
- package/dist/esm/wcs-nav.entry.js.map +1 -1
- package/dist/esm/wcs-progress-bar.entry.js +3 -3
- package/dist/esm/wcs-progress-bar.entry.js.map +1 -1
- package/dist/esm/wcs-progress-radial.entry.js +2 -2
- package/dist/esm/wcs-progress-radial.entry.js.map +1 -1
- package/dist/esm/wcs-radio-group.entry.js +1 -1
- package/dist/esm/wcs-radio.entry.js +1 -1
- package/dist/esm/wcs-radio.entry.js.map +1 -1
- package/dist/esm/wcs-select_2.entry.js +18 -11
- 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 +1 -1
- package/dist/esm/wcs-switch.entry.js.map +1 -1
- package/dist/esm/wcs-tab.entry.js +1 -1
- package/dist/esm/wcs-tabs.entry.js +149 -6
- package/dist/esm/wcs-tabs.entry.js.map +1 -1
- package/dist/esm/wcs-textarea.entry.js +1 -1
- package/dist/esm/wcs-textarea.entry.js.map +1 -1
- package/dist/esm/wcs-tooltip.entry.js +1 -1
- package/dist/esm/wcs-tooltip.entry.js.map +1 -1
- package/dist/esm/wcs.js +1 -1
- package/dist/types/components/alert/alert-interface.d.ts +11 -0
- package/dist/types/components/alert/alert.d.ts +79 -0
- package/dist/types/components/alert-drawer/alert-drawer-interface.d.ts +1 -0
- package/dist/types/components/alert-drawer/alert-drawer.d.ts +83 -0
- package/dist/types/components/button/button-interface.d.ts +1 -3
- package/dist/types/components/card/card-interface.d.ts +1 -0
- package/dist/types/components/card/card.d.ts +18 -1
- package/dist/types/components/card-body/card-body.d.ts +9 -0
- package/dist/types/components/card-content/card-content.d.ts +14 -0
- package/dist/types/components/card-footer/card-footer.d.ts +9 -0
- package/dist/types/components/card-header/card-header.d.ts +16 -0
- package/dist/types/components/card-media/card-media.d.ts +20 -0
- package/dist/types/components/counter/counter-interface.d.ts +1 -3
- package/dist/types/components/grid/grid.d.ts +4 -0
- package/dist/types/components/grid-pagination/grid-pagination.d.ts +6 -1
- package/dist/types/components/header/header.d.ts +1 -0
- package/dist/types/components/input/input-interface.d.ts +1 -3
- package/dist/types/components/mat-icon/mat-icon.d.ts +1 -1
- package/dist/types/components/modal/modal-interface.d.ts +2 -1
- package/dist/types/components/select/select.d.ts +7 -1
- package/dist/types/components/tabs/tabs.d.ts +55 -0
- package/dist/types/components.d.ts +571 -6
- package/dist/wcs/{p-9c012aae.entry.js → p-0424e545.entry.js} +2 -2
- package/dist/wcs/{p-50523b53.entry.js → p-0758d22e.entry.js} +2 -2
- package/dist/wcs/p-0b8157e7.entry.js +2 -0
- package/dist/wcs/p-0dd07842.entry.js +2 -0
- package/dist/wcs/p-0dd07842.entry.js.map +1 -0
- package/dist/wcs/{p-9554196c.entry.js → p-1244daa0.entry.js} +2 -2
- package/dist/wcs/{p-96bff8fe.entry.js → p-18fa39f4.entry.js} +2 -2
- package/dist/wcs/{p-96bff8fe.entry.js.map → p-18fa39f4.entry.js.map} +1 -1
- package/dist/wcs/p-1ba616c2.entry.js +2 -0
- package/dist/wcs/p-1ba616c2.entry.js.map +1 -0
- package/dist/wcs/p-1e7ea63c.entry.js +2 -0
- package/dist/wcs/p-1e7ea63c.entry.js.map +1 -0
- package/dist/wcs/p-1f593d06.entry.js +2 -0
- package/dist/wcs/p-1f593d06.entry.js.map +1 -0
- package/dist/wcs/{p-4dc52a25.entry.js → p-1fbe0328.entry.js} +2 -2
- package/dist/wcs/p-1fbe0328.entry.js.map +1 -0
- package/dist/wcs/{p-c2d35aa6.entry.js → p-204f2722.entry.js} +9 -9
- package/dist/wcs/p-204f2722.entry.js.map +1 -0
- package/dist/wcs/{p-37800935.entry.js → p-27b438c0.entry.js} +2 -2
- package/dist/wcs/{p-0ffdfc10.entry.js → p-352e1f99.entry.js} +2 -2
- package/dist/wcs/{p-3cfa1c4b.entry.js → p-367946fe.entry.js} +2 -2
- package/dist/wcs/p-3823f54e.entry.js +2 -0
- package/dist/wcs/{p-a7891233.entry.js → p-3a18535f.entry.js} +2 -2
- package/dist/wcs/p-41b946b2.entry.js +2 -0
- package/dist/wcs/p-41b946b2.entry.js.map +1 -0
- package/dist/wcs/{p-4661290b.entry.js → p-496115a5.entry.js} +2 -2
- package/dist/wcs/{p-4661290b.entry.js.map → p-496115a5.entry.js.map} +1 -1
- package/dist/wcs/p-4fb2d985.entry.js +2 -0
- package/dist/wcs/{p-9243a323.entry.js.map → p-4fb2d985.entry.js.map} +1 -1
- package/dist/wcs/{p-d895ffb4.entry.js → p-5202b323.entry.js} +2 -2
- package/dist/wcs/{p-ca8f3677.entry.js → p-53a395a9.entry.js} +2 -2
- package/dist/wcs/{p-ca8f3677.entry.js.map → p-53a395a9.entry.js.map} +1 -1
- package/dist/wcs/p-5607246c.entry.js +2 -0
- package/dist/wcs/p-5607246c.entry.js.map +1 -0
- package/dist/wcs/p-580b3142.entry.js +2 -0
- package/dist/wcs/p-5da0534f.entry.js +2 -0
- package/dist/wcs/p-5da0534f.entry.js.map +1 -0
- package/dist/wcs/p-5e8fff73.entry.js +2 -0
- package/dist/wcs/p-5e8fff73.entry.js.map +1 -0
- package/dist/wcs/{p-dddcd685.entry.js → p-622f7403.entry.js} +2 -2
- package/dist/wcs/p-637ec45a.entry.js +2 -0
- package/dist/wcs/p-637ec45a.entry.js.map +1 -0
- package/dist/wcs/p-6aededc6.entry.js +2 -0
- package/dist/wcs/p-6aededc6.entry.js.map +1 -0
- package/dist/wcs/p-6c6079ee.entry.js +2 -0
- package/dist/wcs/{p-76c92e22.entry.js.map → p-6c6079ee.entry.js.map} +1 -1
- package/dist/wcs/{p-e5c057c4.entry.js → p-781a956e.entry.js} +2 -2
- package/dist/wcs/p-7de847e0.entry.js +2 -0
- package/dist/wcs/p-8152d360.entry.js +2 -0
- package/dist/wcs/p-8152d360.entry.js.map +1 -0
- package/dist/wcs/{p-294732f7.entry.js → p-850fa9c9.entry.js} +2 -2
- package/dist/wcs/{p-796e690d.entry.js → p-86ec9ead.entry.js} +2 -2
- package/dist/wcs/{p-796e690d.entry.js.map → p-86ec9ead.entry.js.map} +1 -1
- package/dist/wcs/p-8c2605fd.entry.js +2 -0
- package/dist/wcs/p-8c2605fd.entry.js.map +1 -0
- package/dist/wcs/{p-16dd21cf.entry.js → p-8e9bd0f1.entry.js} +2 -2
- package/dist/wcs/p-98a8b806.entry.js +2 -0
- package/dist/wcs/p-98a8b806.entry.js.map +1 -0
- package/dist/wcs/p-9c73744c.entry.js +2 -0
- package/dist/wcs/p-9c73744c.entry.js.map +1 -0
- package/dist/wcs/p-9fd3366c.entry.js +2 -0
- package/dist/wcs/p-9fd3366c.entry.js.map +1 -0
- package/dist/wcs/p-a0f6ef30.entry.js +2 -0
- package/dist/wcs/p-a0f6ef30.entry.js.map +1 -0
- package/dist/wcs/{p-5bf73e05.entry.js → p-a94e685c.entry.js} +2 -2
- package/dist/wcs/{p-5bf73e05.entry.js.map → p-a94e685c.entry.js.map} +1 -1
- package/dist/wcs/{p-7d665a7e.entry.js → p-a956dc84.entry.js} +2 -2
- package/dist/wcs/p-a956dc84.entry.js.map +1 -0
- package/dist/wcs/{p-5d5f50ed.entry.js → p-aadf37e7.entry.js} +2 -2
- package/dist/wcs/{p-6b06d2e7.entry.js → p-ad286030.entry.js} +2 -2
- package/dist/wcs/p-ad5192cd.entry.js +2 -0
- package/dist/wcs/{p-dd60a6db.entry.js → p-b0a6eec6.entry.js} +2 -2
- package/dist/wcs/{p-dd60a6db.entry.js.map → p-b0a6eec6.entry.js.map} +1 -1
- package/dist/wcs/{p-9ad23e83.entry.js → p-b28b2fba.entry.js} +2 -2
- package/dist/wcs/p-b28b2fba.entry.js.map +1 -0
- package/dist/wcs/{p-29f5b974.entry.js → p-bc009574.entry.js} +2 -2
- package/dist/wcs/{p-29f5b974.entry.js.map → p-bc009574.entry.js.map} +1 -1
- package/dist/wcs/p-c211a5d1.entry.js +2 -0
- package/dist/wcs/{p-206c01d5.entry.js → p-c261eaf9.entry.js} +2 -2
- package/dist/wcs/p-c261eaf9.entry.js.map +1 -0
- package/dist/wcs/p-c5bad0b8.js +2 -0
- package/dist/wcs/p-c5bad0b8.js.map +1 -0
- package/dist/wcs/p-c7812760.entry.js +2 -0
- package/dist/wcs/{p-694724a2.entry.js → p-c84ae00d.entry.js} +2 -2
- package/dist/wcs/p-cad10435.entry.js +2 -0
- package/dist/wcs/{p-13e50077.entry.js.map → p-cad10435.entry.js.map} +1 -1
- package/dist/wcs/p-cbbca016.entry.js +2 -0
- package/dist/wcs/p-cbbca016.entry.js.map +1 -0
- package/dist/wcs/{p-619e1110.entry.js → p-cbda74f6.entry.js} +2 -2
- package/dist/wcs/{p-21b964cd.entry.js → p-d27d4a53.entry.js} +2 -2
- package/dist/wcs/p-d27d4a53.entry.js.map +1 -0
- package/dist/wcs/p-dfb52a1c.entry.js +2 -0
- package/dist/wcs/p-dfb52a1c.entry.js.map +1 -0
- package/dist/wcs/{p-6f5d570a.entry.js → p-dff8641e.entry.js} +2 -2
- package/dist/wcs/p-e26c19e5.entry.js +2 -0
- package/dist/wcs/{p-d9525519.entry.js → p-e56b9ce2.entry.js} +2 -2
- package/dist/wcs/p-ec383729.entry.js +2 -0
- package/dist/wcs/p-ec383729.entry.js.map +1 -0
- package/dist/wcs/p-f929b66f.entry.js +2 -0
- package/dist/wcs/p-f929b66f.entry.js.map +1 -0
- package/dist/wcs/{p-da4636fa.entry.js → p-fd187bce.entry.js} +2 -2
- package/dist/wcs/{p-b96f4921.entry.js → p-fdeae83e.entry.js} +2 -2
- package/dist/wcs/wcs.esm.js +1 -1
- package/dist/wcs/wcs.esm.js.map +1 -1
- package/package.json +5 -2
- package/dist/cjs/button-interface-629f3563.js +0 -12
- package/dist/cjs/button-interface-629f3563.js.map +0 -1
- package/dist/cjs/grid-pagination-e4f29c78.js.map +0 -1
- package/dist/esm/button-interface-dc5ddd51.js +0 -9
- package/dist/esm/button-interface-dc5ddd51.js.map +0 -1
- package/dist/esm/grid-pagination-976a86e9.js.map +0 -1
- package/dist/wcs/p-13090618.entry.js +0 -2
- package/dist/wcs/p-13090618.entry.js.map +0 -1
- package/dist/wcs/p-13e50077.entry.js +0 -2
- package/dist/wcs/p-1438530e.entry.js +0 -2
- package/dist/wcs/p-1438530e.entry.js.map +0 -1
- package/dist/wcs/p-206c01d5.entry.js.map +0 -1
- package/dist/wcs/p-21b964cd.entry.js.map +0 -1
- package/dist/wcs/p-21d2f06f.entry.js +0 -2
- package/dist/wcs/p-21d2f06f.entry.js.map +0 -1
- package/dist/wcs/p-258855a1.entry.js +0 -2
- package/dist/wcs/p-258855a1.entry.js.map +0 -1
- package/dist/wcs/p-2adf00be.entry.js +0 -2
- package/dist/wcs/p-2adf00be.entry.js.map +0 -1
- package/dist/wcs/p-388e6d75.entry.js +0 -2
- package/dist/wcs/p-388e6d75.entry.js.map +0 -1
- package/dist/wcs/p-43d70995.entry.js +0 -2
- package/dist/wcs/p-43d70995.entry.js.map +0 -1
- package/dist/wcs/p-4dc52a25.entry.js.map +0 -1
- package/dist/wcs/p-550012c2.entry.js +0 -2
- package/dist/wcs/p-5974be61.entry.js +0 -2
- package/dist/wcs/p-5974be61.entry.js.map +0 -1
- package/dist/wcs/p-5de993d7.entry.js +0 -2
- package/dist/wcs/p-5de993d7.entry.js.map +0 -1
- package/dist/wcs/p-71db0ed5.entry.js +0 -2
- package/dist/wcs/p-76c92e22.entry.js +0 -2
- package/dist/wcs/p-7d665a7e.entry.js.map +0 -1
- package/dist/wcs/p-8fcceaf1.js +0 -2
- package/dist/wcs/p-8fcceaf1.js.map +0 -1
- package/dist/wcs/p-9243a323.entry.js +0 -2
- package/dist/wcs/p-94aa269f.entry.js +0 -2
- package/dist/wcs/p-94aa269f.entry.js.map +0 -1
- package/dist/wcs/p-96195d9a.entry.js +0 -2
- package/dist/wcs/p-96195d9a.entry.js.map +0 -1
- package/dist/wcs/p-9ad23e83.entry.js.map +0 -1
- package/dist/wcs/p-9dc3f9a5.entry.js +0 -2
- package/dist/wcs/p-9dc3f9a5.entry.js.map +0 -1
- package/dist/wcs/p-9eb66fa9.entry.js +0 -2
- package/dist/wcs/p-ab49926d.entry.js +0 -2
- package/dist/wcs/p-ab49926d.entry.js.map +0 -1
- package/dist/wcs/p-b2080509.entry.js +0 -2
- package/dist/wcs/p-c2d35aa6.entry.js.map +0 -1
- package/dist/wcs/p-c6a28b79.js +0 -2
- package/dist/wcs/p-c6a28b79.js.map +0 -1
- package/dist/wcs/p-c752b85a.entry.js +0 -2
- package/dist/wcs/p-d443d419.entry.js +0 -2
- package/dist/wcs/p-e36b2ad1.entry.js +0 -2
- package/dist/wcs/p-f87636f6.entry.js +0 -2
- package/dist/wcs/p-f87636f6.entry.js.map +0 -1
- package/dist/wcs/p-fc115de4.entry.js +0 -2
- /package/dist/wcs/{p-9c012aae.entry.js.map → p-0424e545.entry.js.map} +0 -0
- /package/dist/wcs/{p-50523b53.entry.js.map → p-0758d22e.entry.js.map} +0 -0
- /package/dist/wcs/{p-e36b2ad1.entry.js.map → p-0b8157e7.entry.js.map} +0 -0
- /package/dist/wcs/{p-9554196c.entry.js.map → p-1244daa0.entry.js.map} +0 -0
- /package/dist/wcs/{p-37800935.entry.js.map → p-27b438c0.entry.js.map} +0 -0
- /package/dist/wcs/{p-0ffdfc10.entry.js.map → p-352e1f99.entry.js.map} +0 -0
- /package/dist/wcs/{p-3cfa1c4b.entry.js.map → p-367946fe.entry.js.map} +0 -0
- /package/dist/wcs/{p-c752b85a.entry.js.map → p-3823f54e.entry.js.map} +0 -0
- /package/dist/wcs/{p-a7891233.entry.js.map → p-3a18535f.entry.js.map} +0 -0
- /package/dist/wcs/{p-d895ffb4.entry.js.map → p-5202b323.entry.js.map} +0 -0
- /package/dist/wcs/{p-b2080509.entry.js.map → p-580b3142.entry.js.map} +0 -0
- /package/dist/wcs/{p-dddcd685.entry.js.map → p-622f7403.entry.js.map} +0 -0
- /package/dist/wcs/{p-e5c057c4.entry.js.map → p-781a956e.entry.js.map} +0 -0
- /package/dist/wcs/{p-550012c2.entry.js.map → p-7de847e0.entry.js.map} +0 -0
- /package/dist/wcs/{p-294732f7.entry.js.map → p-850fa9c9.entry.js.map} +0 -0
- /package/dist/wcs/{p-16dd21cf.entry.js.map → p-8e9bd0f1.entry.js.map} +0 -0
- /package/dist/wcs/{p-5d5f50ed.entry.js.map → p-aadf37e7.entry.js.map} +0 -0
- /package/dist/wcs/{p-6b06d2e7.entry.js.map → p-ad286030.entry.js.map} +0 -0
- /package/dist/wcs/{p-fc115de4.entry.js.map → p-ad5192cd.entry.js.map} +0 -0
- /package/dist/wcs/{p-9eb66fa9.entry.js.map → p-c211a5d1.entry.js.map} +0 -0
- /package/dist/wcs/{p-d443d419.entry.js.map → p-c7812760.entry.js.map} +0 -0
- /package/dist/wcs/{p-694724a2.entry.js.map → p-c84ae00d.entry.js.map} +0 -0
- /package/dist/wcs/{p-619e1110.entry.js.map → p-cbda74f6.entry.js.map} +0 -0
- /package/dist/wcs/{p-6f5d570a.entry.js.map → p-dff8641e.entry.js.map} +0 -0
- /package/dist/wcs/{p-71db0ed5.entry.js.map → p-e26c19e5.entry.js.map} +0 -0
- /package/dist/wcs/{p-d9525519.entry.js.map → p-e56b9ce2.entry.js.map} +0 -0
- /package/dist/wcs/{p-da4636fa.entry.js.map → p-fd187bce.entry.js.map} +0 -0
- /package/dist/wcs/{p-b96f4921.entry.js.map → p-fdeae83e.entry.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"counter.js","sourceRoot":"","sources":["../../../src/components/counter/counter.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACW,OAAO,EAC3B,KAAK,EAEL,CAAC,EACD,IAAI,EAAE,MAAM,EACZ,IAAI,EACJ,KAAK,EACL,KAAK,EACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,qBAAqB,EACrB,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,EACP,+BAA+B,EAC/B,oBAAoB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAA4B,gBAAgB,EAAkB,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGvH,MAAM,uBAAuB,GAAG,CAAC,UAAU,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AC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,mBAC7B,IAAI,CAAC,KAAK,oBACT,IAAI,CAAC,KAAK,mBACX,IAAI,CAAC,GAAG,mBACR,IAAI,CAAC,GAAG,gBACX,IAAI,CAAC,KAAK,IAClB,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,cAAc,CAAQ;oBAChE,6DAAM,EAAE,EAAC,YAAY,EACf,KAAK,EAAC,UAAU,EAChB,MAAM,uBACM,MAAM,IAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,IAAI,CAAQ,CAC/D;gBACN,mEAAY,KAAK,EAAC,aAAa,EACnB,KAAK,EAAC,OAAO,EACb,IAAI,EAAC,GAAG,EACR,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,EACrC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAC3C,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,GAAG;oBAC1D,qEAAc,IAAI,EAAC,KAAK,EAAC,IAAI,EAAC,GAAG,GAAgB,CACxC,CACX,CACH,CACV,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n ComponentInterface, Element,\n Event,\n EventEmitter,\n h,\n Host, Method,\n Prop,\n State,\n Watch\n} from '@stencil/core';\nimport {\n inheritAriaAttributes,\n inheritAttributes,\n isEndKey,\n isHomeKey,\n isKeydown,\n isKeyup,\n parseCssTimeValueToMilliseconds,\n setOrRemoveAttribute\n} from '../../utils/helpers';\nimport { CounterChangeEventDetail, isWcsCounterSize, WcsCounterSize, WcsCounterSizeValues } from './counter-interface';\nimport { AriaAttributeName, MutableAriaAttribute } from \"../../utils/mutable-aria-attribute\";\n\nconst COUNTER_INHERITED_ATTRS = ['tabindex', 'title'];\n\n\n/**\n * Counter component, meant to be used for small range of values (e.g : 0 - 5).<br>\n * For larger or specific ranges, please use [wcs-input (type number)](.?path=/docs/components-input--documentation)\n * \n * @cssprop --wcs-counter-border-radius - Border radius of the counter\n * \n * @cssprop --wcs-counter-value-color-default - Default color of the value \n * @cssprop --wcs-counter-value-color-disabled - Color of the text when the counter is disabled\n * @cssprop --wcs-counter-font-weight - Font weight of the value\n * \n * @cssprop --wcs-counter-height-m - Height medium of the counter\n * @cssprop --wcs-counter-height-l - Height large of the counter\n * @cssprop --wcs-counter-font-size-m - Font size medium of the counter\n * @cssprop --wcs-counter-font-size-l - Font size large of the counter\n * @cssprop --wcs-counter-padding-m - Padding medium of the counter\n * @cssprop --wcs-counter-padding-l - Padding large of the counter\n * \n * @cssprop --wcs-counter-background-color - Background color of the counter\n * @cssprop --wcs-counter-gap - Gap between the buttons and the label\n * @cssprop --wcs-counter-gap-size-m - Gap between the buttons and the label when the size is M\n * @cssprop --wcs-counter-gap-size-l - Gap between the buttons and the label when the size is L\n * @cssprop --wcs-counter-outline-color-focus - Color of the focus outline\n *\n * @cssprop --wcs-counter-transition-duration - Duration of the animation\n * \n */\n@Component({\n tag: 'wcs-counter',\n styleUrl: 'counter.scss',\n shadow: {\n delegatesFocus: true\n },\n})\nexport class Counter implements ComponentInterface, MutableAriaAttribute {\n @Element() private el!: HTMLElement;\n private spinButton!: HTMLSpanElement;\n private counterContainer!: HTMLDivElement;\n private inheritedAttributes: { [k: string]: any } = {};\n\n /**\n * Default animation duration, in milliseconds\n * @private\n */\n private ANIMATION_DURATION = 150;\n\n /**\n * Specify the size (height) of the counter.\n */\n @Prop({reflect: true}) size: WcsCounterSize = 'm';\n\n /**\n * The label of the counter.<br/>\n * e.g. Number of passengers, train carriages, railroad tracks...\n */\n @Prop({mutable: false}) label!: string;\n\n /**\n * Specify whether the counter is disabled or not.\n */\n @Prop({ reflect: true }) disabled = false;\n\n /**\n * The minimum value of the counter.\n * If the value of the min attribute isn't set, then the element has no minimum value.\n */\n @Prop({mutable: true}) min?: number;\n\n /**\n * The maximum value of the counter.\n * If the value of the max attribute isn't set, then the element has no maximum value.\n */\n @Prop({mutable: true}) max?: number;\n\n /**\n * Defines by how much the counter will be incremented or decremented.\n */\n @Prop({mutable: true}) step: number = 1;\n\n /**\n * Emitted when the value of the counter has changed.\n */\n @Event() wcsChange!: EventEmitter<CounterChangeEventDetail>;\n\n /**\n * The current value of the counter.\n */\n @Prop({mutable: true}) value!: number;\n\n /**\n * Only for animation and display purpose\n */\n @State() private displayedValue: number;\n\n private animateRunning = false;\n\n /**\n * Emitted when the counter loses focus.\n */\n @Event() wcsBlur!: EventEmitter<FocusEvent>;\n\n componentWillLoad() {\n this.handleValueChange();\n\n if (!isWcsCounterSize(this.size)) {\n console.warn(`Invalid size value for wcs-counter : \"${this.size}\". Must be one of \"${WcsCounterSizeValues.join(', ')}\"`);\n this.size = \"m\"; // Default fallback value\n }\n\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.el),\n ...inheritAttributes(this.el, COUNTER_INHERITED_ATTRS),\n };\n }\n \n componentDidRender() {\n this.ANIMATION_DURATION = parseCssTimeValueToMilliseconds(window.getComputedStyle(this.el).getPropertyValue('--wcs-counter-transition-duration') ?? '150ms') ?? 150;\n }\n\n @Method()\n async setAriaAttribute(attr: AriaAttributeName, value: string | null | undefined) {\n setOrRemoveAttribute(this.spinButton, attr, value);\n }\n \n /**\n * Current value change => handle event and interval\n */\n @Watch('value')\n valueChange(newVal: any, oldVal: any) {\n if(oldVal === newVal) return;\n\n this.handleValueChange();\n }\n\n private handleValueChange() {\n this.setMinimumIfValueIsUndefinedOrNull();\n this.ensureValueIsNotOutOfMinMax();\n this.updateDisplayValueIfNoAnimationRunning();\n }\n\n private updateDisplayValueIfNoAnimationRunning() {\n if (!this.animateRunning) {\n this.displayedValue = this.value;\n }\n }\n\n private ensureValueIsNotOutOfMinMax() {\n if (this.max !== undefined && this.value > this.max) {\n this.value = this.max;\n } else if (this.min !== undefined && this.value < this.min) {\n this.value = this.min;\n }\n }\n\n private setMinimumIfValueIsUndefinedOrNull() {\n if (this.value === undefined || this.value === null) {\n this.value = this.min ?? 0;\n }\n }\n\n onKeyDown(_event: KeyboardEvent) {\n if (this.disabled) return; \n \n if (isKeyup(_event)) {\n _event.preventDefault();\n this.handleIncrement()\n }\n if (isKeydown(_event)) {\n _event.preventDefault();\n this.handleDecrement()\n }\n if (isHomeKey(_event)) {\n _event.preventDefault();\n if (this.min != null) {\n this.value = this.min;\n this.displayedValue = this.value;\n this.notifyChange();\n }\n }\n if (isEndKey(_event)) {\n _event.preventDefault();\n if (this.max != null) {\n this.value = this.max;\n this.displayedValue = this.value;\n this.notifyChange();\n }\n }\n }\n\n private notifyChange() {\n this.wcsChange.emit({\n value: this.value\n });\n }\n \n private handleDecrement = () => {\n if (this.disabled) return;\n if (this.min === undefined || this.value > this.min) {\n // we set animateRunning here to prevent the watch method on value prop from affecting the displayed value\n // before the animation runs.\n this.animateRunning = true; \n this.value -= this.step;\n this.notifyChange();\n this.animate('up');\n }\n };\n\n private handleIncrement = () => {\n if (this.disabled) return;\n if (this.max === undefined || this.value < this.max) {\n // we set animateRunning here to prevent the watch method on value prop from affecting the displayed value\n // before the animation runs.\n this.animateRunning = true; \n this.value += this.step;\n this.notifyChange();\n this.animate('down');\n }\n };\n\n private animate = (direction: 'up' | 'down'): void => {\n // In case someone call animate function, we want ensured that animateRunning is set to true to prevent other \n // method to mutate the displayedValue.\n this.animateRunning = true; \n\n const outliers = Array.from(this.counterContainer.children)\n .filter((span: HTMLSpanElement) => span.classList.contains('outliers'));\n\n this.counterContainer.classList.add('animate-' + direction);\n outliers.forEach((span: HTMLSpanElement) => {\n span.hidden = false;\n });\n setTimeout(() => {\n this.counterContainer.classList.remove('animate-' + direction);\n outliers.forEach((span: HTMLSpanElement) => {\n span.hidden = true;\n });\n this.displayedValue = this.value;\n\n this.animateRunning = false;\n }, this.ANIMATION_DURATION - 20);\n }\n\n render() {\n return (\n <Host>\n <div class=\"counter\">\n <wcs-button class=\"wcs-primary\"\n shape=\"round\"\n size=\"s\"\n tabindex={-1}\n onClick={() => this.handleDecrement()}\n onBlur={(event) => this.wcsBlur.emit(event)}\n disabled={this.disabled || this.value === this.min}>\n <wcs-mat-icon icon=\"remove\" size=\"s\"></wcs-mat-icon> \n </wcs-button>\n <div class=\"counter-container\" ref={input => this.counterContainer = input}>\n <span id=\"outlier-down\"\n class=\"outliers\"\n hidden\n aria-hidden=\"true\">{this.displayedValue - this.step}</span>\n <span tabindex={this.disabled ? -1 : 0}\n role=\"spinbutton\"\n ref={(el) => this.spinButton = el}\n class=\"current-value\"\n onBlur={(event) => this.wcsBlur.emit(event)}\n onKeyDown={(event) => this.onKeyDown(event)}\n aria-disabled={this.disabled ? 'true' : null}\n aria-valuenow={this.value}\n aria-valuetext={this.value}\n aria-valuemin={this.min}\n aria-valuemax={this.max}\n aria-label={this.label}\n {...this.inheritedAttributes}>{this.displayedValue}</span>\n <span id=\"outlier-up\"\n class=\"outliers\"\n hidden\n aria-hidden=\"true\">{this.displayedValue + this.step}</span>\n </div>\n <wcs-button class=\"wcs-primary\"\n shape=\"round\"\n size=\"s\"\n tabindex={-1}\n onClick={() => this.handleIncrement()}\n onBlur={(event) => this.wcsBlur.emit(event)}\n disabled={this.disabled || this.value === this.max}>\n <wcs-mat-icon icon=\"add\" size=\"s\"></wcs-mat-icon>\n </wcs-button>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"counter.js","sourceRoot":"","sources":["../../../src/components/counter/counter.tsx"],"names":[],"mapp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\n Watch\n} from '@stencil/core';\nimport {\n inheritAriaAttributes,\n inheritAttributes,\n isEndKey,\n isHomeKey,\n isKeydown,\n isKeyup,\n parseCssTimeValueToMilliseconds,\n setOrRemoveAttribute\n} from '../../utils/helpers';\nimport { CounterChangeEventDetail, WcsCounterSize } from './counter-interface';\nimport { AriaAttributeName, MutableAriaAttribute } from \"../../utils/mutable-aria-attribute\";\n\nconst COUNTER_INHERITED_ATTRS = ['tabindex', 'title'];\n\n\n/**\n * Counter component, meant to be used for small range of values (e.g : 0 - 5).<br>\n * For larger or specific ranges, please use [wcs-input (type number)](.?path=/docs/components-input--documentation)\n * \n * @cssprop --wcs-counter-border-radius - Border radius of the counter\n * \n * @cssprop --wcs-counter-value-color-default - Default color of the value \n * @cssprop --wcs-counter-value-color-disabled - Color of the text when the counter is disabled\n * @cssprop --wcs-counter-font-weight - Font weight of the value\n * \n * @cssprop --wcs-counter-height-m - Height medium of the counter\n * @cssprop --wcs-counter-height-l - Height large of the counter\n * @cssprop --wcs-counter-font-size-m - Font size medium of the counter\n * @cssprop --wcs-counter-font-size-l - Font size large of the counter\n * @cssprop --wcs-counter-padding-m - Padding medium of the counter\n * @cssprop --wcs-counter-padding-l - Padding large of the counter\n * \n * @cssprop --wcs-counter-background-color - Background color of the counter\n * @cssprop --wcs-counter-gap - Gap between the buttons and the label\n * @cssprop --wcs-counter-gap-size-m - Gap between the buttons and the label when the size is M\n * @cssprop --wcs-counter-gap-size-l - Gap between the buttons and the label when the size is L\n * @cssprop --wcs-counter-outline-color-focus - Color of the focus outline\n *\n * @cssprop --wcs-counter-transition-duration - Duration of the animation\n * \n */\n@Component({\n tag: 'wcs-counter',\n styleUrl: 'counter.scss',\n shadow: {\n delegatesFocus: true\n },\n})\nexport class Counter implements ComponentInterface, MutableAriaAttribute {\n @Element() private el!: HTMLElement;\n private spinButton!: HTMLSpanElement;\n private counterContainer!: HTMLDivElement;\n private inheritedAttributes: { [k: string]: any } = {};\n\n /**\n * Default animation duration, in milliseconds\n * @private\n */\n private ANIMATION_DURATION = 150;\n\n /**\n * Specify the size (height) of the counter.\n */\n @Prop({reflect: true}) size: WcsCounterSize = 'm';\n\n /**\n * The label of the counter.<br/>\n * e.g. Number of passengers, train carriages, railroad tracks...\n */\n @Prop({mutable: false}) label!: string;\n\n /**\n * Specify whether the counter is disabled or not.\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * The minimum value of the counter.\n * If the value of the min attribute isn't set, then the element has no minimum value.\n */\n @Prop({mutable: true}) min?: number;\n\n /**\n * The maximum value of the counter.\n * If the value of the max attribute isn't set, then the element has no maximum value.\n */\n @Prop({mutable: true}) max?: number;\n\n /**\n * Defines by how much the counter will be incremented or decremented.\n */\n @Prop({mutable: true}) step: number = 1;\n\n /**\n * Emitted when the value of the counter has changed.\n */\n @Event() wcsChange!: EventEmitter<CounterChangeEventDetail>;\n\n /**\n * The current value of the counter.\n */\n @Prop({mutable: true}) value!: number;\n\n /**\n * Only for animation and display purpose\n */\n @State() private displayedValue: number;\n\n private animateRunning: boolean = false;\n\n /**\n * Emitted when the counter loses focus.\n */\n @Event() wcsBlur!: EventEmitter<FocusEvent>;\n\n componentWillLoad() {\n this.handleValueChange();\n\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.el),\n ...inheritAttributes(this.el, COUNTER_INHERITED_ATTRS),\n };\n }\n \n componentDidRender() {\n this.ANIMATION_DURATION = parseCssTimeValueToMilliseconds(window.getComputedStyle(this.el).getPropertyValue('--wcs-counter-transition-duration') ?? '150ms') ?? 150;\n }\n\n @Method()\n async setAriaAttribute(attr: AriaAttributeName, value: string | null | undefined) {\n setOrRemoveAttribute(this.spinButton, attr, value);\n }\n \n /**\n * Current value change => handle event and interval\n */\n @Watch('value')\n valueChange(newVal: any, oldVal: any) {\n if(oldVal === newVal) return;\n\n this.handleValueChange();\n }\n\n private handleValueChange() {\n this.setMinimumIfValueIsUndefinedOrNull();\n this.ensureValueIsNotOutOfMinMax();\n this.updateDisplayValueIfNoAnimationRunning();\n }\n\n private updateDisplayValueIfNoAnimationRunning() {\n if (!this.animateRunning) {\n this.displayedValue = this.value;\n }\n }\n\n private ensureValueIsNotOutOfMinMax() {\n if (this.max !== undefined && this.value > this.max) {\n this.value = this.max;\n } else if (this.min !== undefined && this.value < this.min) {\n this.value = this.min;\n }\n }\n\n private setMinimumIfValueIsUndefinedOrNull() {\n if (this.value === undefined || this.value === null) {\n this.value = this.min ?? 0;\n }\n }\n\n onKeyDown(_event: KeyboardEvent) {\n if (this.disabled) return; \n \n if (isKeyup(_event)) {\n _event.preventDefault();\n this.handleIncrement()\n }\n if (isKeydown(_event)) {\n _event.preventDefault();\n this.handleDecrement()\n }\n if (isHomeKey(_event)) {\n _event.preventDefault();\n if (this.min != null) {\n this.value = this.min;\n this.displayedValue = this.value;\n this.notifyChange();\n }\n }\n if (isEndKey(_event)) {\n _event.preventDefault();\n if (this.max != null) {\n this.value = this.max;\n this.displayedValue = this.value;\n this.notifyChange();\n }\n }\n }\n\n private notifyChange() {\n this.wcsChange.emit({\n value: this.value\n });\n }\n \n private handleDecrement = () => {\n if (this.disabled) return;\n if (this.min === undefined || this.value > this.min) {\n // we set animateRunning here to prevent the watch method on value prop from affecting the displayed value\n // before the animation runs.\n this.animateRunning = true; \n this.value -= this.step;\n this.notifyChange();\n this.animate('up');\n }\n };\n\n private handleIncrement = () => {\n if (this.disabled) return;\n if (this.max === undefined || this.value < this.max) {\n // we set animateRunning here to prevent the watch method on value prop from affecting the displayed value\n // before the animation runs.\n this.animateRunning = true; \n this.value += this.step;\n this.notifyChange();\n this.animate('down');\n }\n };\n\n private animate = (direction: 'up' | 'down'): void => {\n // In case someone call animate function, we want ensured that animateRunning is set to true to prevent other \n // method to mutate the displayedValue.\n this.animateRunning = true; \n\n const outliers = Array.from(this.counterContainer.children)\n .filter((span: HTMLSpanElement) => span.classList.contains('outliers'));\n\n this.counterContainer.classList.add('animate-' + direction);\n outliers.forEach((span: HTMLSpanElement) => {\n span.hidden = false;\n });\n setTimeout(() => {\n this.counterContainer.classList.remove('animate-' + direction);\n outliers.forEach((span: HTMLSpanElement) => {\n span.hidden = true;\n });\n this.displayedValue = this.value;\n\n this.animateRunning = false;\n }, this.ANIMATION_DURATION - 20);\n }\n\n render() {\n return (\n <Host>\n <div class=\"counter\">\n <wcs-button class=\"wcs-primary\"\n shape=\"round\"\n size=\"s\"\n tabindex={-1}\n onClick={() => this.handleDecrement()}\n onBlur={(event) => this.wcsBlur.emit(event)}\n disabled={this.disabled || this.value === this.min}>\n <wcs-mat-icon icon=\"remove\" size=\"s\"></wcs-mat-icon> \n </wcs-button>\n <div class=\"counter-container\" ref={input => this.counterContainer = input}>\n <span id=\"outlier-down\"\n class=\"outliers\"\n hidden\n aria-hidden=\"true\">{this.displayedValue - this.step}</span>\n <span tabindex={this.disabled ? -1 : 0}\n role=\"spinbutton\"\n ref={(el) => this.spinButton = el}\n class=\"current-value\"\n onBlur={(event) => this.wcsBlur.emit(event)}\n onKeyDown={(event) => this.onKeyDown(event)}\n aria-disabled={this.disabled ? 'true' : null}\n aria-valuenow={this.value}\n aria-valuetext={this.value}\n aria-valuemin={this.min}\n aria-valuemax={this.max}\n aria-label={this.label}\n {...this.inheritedAttributes}>{this.displayedValue}</span>\n <span id=\"outlier-up\"\n class=\"outliers\"\n hidden\n aria-hidden=\"true\">{this.displayedValue + this.step}</span>\n </div>\n <wcs-button class=\"wcs-primary\"\n shape=\"round\"\n size=\"s\"\n tabindex={-1}\n onClick={() => this.handleIncrement()}\n onBlur={(event) => this.wcsBlur.emit(event)}\n disabled={this.disabled || this.value === this.max}>\n <wcs-mat-icon icon=\"add\" size=\"s\"></wcs-mat-icon>\n </wcs-button>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -7,7 +7,7 @@ import { h, Host } from "@stencil/core";
|
|
|
7
7
|
*/
|
|
8
8
|
export class Divider {
|
|
9
9
|
render() {
|
|
10
|
-
return (h(Host, { key: '
|
|
10
|
+
return (h(Host, { key: 'cf4452e90a52e1bb419fec0db2d9c0838ad7b134' }));
|
|
11
11
|
}
|
|
12
12
|
static get is() { return "wcs-divider"; }
|
|
13
13
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import { SelectArrow } from "../select/select-arrow";
|
|
3
|
-
import { isWcsButtonSize, WcsButtonSizeValues } from "../button/button-interface";
|
|
4
3
|
import { createPopper } from "@popperjs/core";
|
|
5
4
|
import { clickTargetIsElementOrChildren, inheritAriaAttributes, inheritAttributes, setOrRemoveAttribute } from "../../utils/helpers";
|
|
6
5
|
import { getActionForKeyboardEvent } from "./dropdown-keyboard-event";
|
|
@@ -50,10 +49,6 @@ export class Dropdown {
|
|
|
50
49
|
this.expanded = false;
|
|
51
50
|
}
|
|
52
51
|
componentDidLoad() {
|
|
53
|
-
if (!isWcsButtonSize(this.size)) {
|
|
54
|
-
console.warn(`Invalid size value for wcs-dropdown : "${this.size}". Must be one of "${WcsButtonSizeValues.join(', ')}"`);
|
|
55
|
-
this.size = "m"; // Default fallback value
|
|
56
|
-
}
|
|
57
52
|
this.popper = createPopper(this.wcsButton, this.popoverDiv, {
|
|
58
53
|
placement: this.placement,
|
|
59
54
|
modifiers: [
|
|
@@ -203,7 +198,7 @@ export class Dropdown {
|
|
|
203
198
|
this.inheritedAttributes = Object.assign(Object.assign({}, inheritAriaAttributes(this.el)), inheritAttributes(this.el, DROPDOWN_INHERITED_ATTRS));
|
|
204
199
|
}
|
|
205
200
|
render() {
|
|
206
|
-
return (h(Host, { key: '
|
|
201
|
+
return (h(Host, { key: '96be2f9df0a80b4d6c88cf15419ff29cb001c695' }, h("button", Object.assign({ key: '562456822837e6ff61ed23569335e42ad4e36df9', id: "dropdown-button", "aria-controls": "menu", disabled: this.disabled, "aria-haspopup": "true", role: "button", "aria-expanded": this.expanded ? 'true' : 'false', ref: el => this.nativeButton = el, onClick: ($event) => this.onButtonClick($event), onBlur: ($event) => $event.stopImmediatePropagation() }, this.inheritedAttributes), "Dropdown"), h("wcs-button", { key: '66348725409b810219dd1bd4658611c63bbb5eb8', mode: this.mode, shape: this.shape, disabled: this.disabled, size: this.size, ref: el => this.wcsButton = el, "aria-hidden": "true", tabindex: -1, onClick: ($event) => this.onButtonClick($event), onBlur: (e) => e.stopImmediatePropagation() }, h("div", { key: '028e06637e35ecc14b66cf74fba32dc59d58121a', class: "wcs-button-content-wrapper" }, h("slot", { key: '7f7e2db54f9b5d3a20588c48c1d3fd6750187017', name: "placeholder" }), this.noArrow ? null : (h(SelectArrow, { up: this.expanded })))), h("div", { key: '7f6f4efe22cab63033b3e7775791856ed8e1b921', class: (this.expanded ? 'show ' : '') + 'popover', id: "menu", role: "menu", "aria-labelledby": "dropdown-button", tabindex: -1, ref: el => this.popoverDiv = el }, h("div", { key: 'ca7ce6adea1005d7126d4ae060ada55e9d3b6d70', role: "presentation", id: "arrow", "data-popper-arrow": true }), h("div", { key: '0f2a9e15df898550117743f855e7ee0746157ab1', role: "presentation", class: "container" }, h("slot", { key: '688fd29a894bae8aee4c848a9b07380c95302ca2', name: "item" }, h("span", { key: 'a80c902d26d7afed58e8a17646dac92473042fa4', id: "is-empty" }))))));
|
|
207
202
|
}
|
|
208
203
|
static get is() { return "wcs-dropdown"; }
|
|
209
204
|
static get encapsulation() { return "shadow"; }
|
|
@@ -235,7 +230,7 @@ export class Dropdown {
|
|
|
235
230
|
"text": "Hides the arrow in the button"
|
|
236
231
|
},
|
|
237
232
|
"attribute": "no-arrow",
|
|
238
|
-
"reflect":
|
|
233
|
+
"reflect": true,
|
|
239
234
|
"defaultValue": "false"
|
|
240
235
|
},
|
|
241
236
|
"mode": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.js","sourceRoot":"","sources":["../../../src/components/dropdown/dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,E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AAO,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,EACjD,EAAE,EAAC,MAAM,EACT,IAAI,EAAC,MAAM,qBACK,iBAAiB,EACjC,QAAQ,EAAE,CAAC,CAAC,EACZ,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,EAAE;gBAChC,4DAAK,IAAI,EAAC,cAAc,EAAC,EAAE,EAAC,OAAO,8BAAoB;gBACvD,4DAAK,IAAI,EAAC,cAAc,EAAC,KAAK,EAAC,WAAW;oBACtC,6DAAM,IAAI,EAAC,MAAM;wBACb,6DAAM,EAAE,EAAE,UAAU,GAAS,CAC1B,CACL,CACJ,CACH,CACV,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, ComponentInterface, Element, h, Host, Listen, Method, Prop, State, Watch } from '@stencil/core';\nimport { SelectArrow } from '../select/select-arrow';\nimport {\n isWcsButtonSize,\n WcsButtonMode,\n WcsButtonShape,\n WcsButtonSize,\n WcsButtonSizeValues\n} from '../button/button-interface';\nimport { createPopper, Instance } from '@popperjs/core';\nimport { WcsDropdownPlacement } from './dropdown-interface';\nimport {\n clickTargetIsElementOrChildren,\n inheritAriaAttributes,\n inheritAttributes,\n setOrRemoveAttribute\n} from '../../utils/helpers';\nimport { getActionForKeyboardEvent, KeyboardEventAssociatedAction } from \"./dropdown-keyboard-event\";\nimport { AriaAttributeName, MutableAriaAttribute } from \"../../utils/mutable-aria-attribute\";\n\nconst DROPDOWN_INHERITED_ATTRS = ['tabindex'];\n\n/**\n * The dropdown component use a wcs-button under the hood, so you can use the same css classes as the button to style the\n * dropdown.\n * \n * @slot placeholder - The slot containing the placeholder displayed in button\n * @slot item - The slot container the list of `wcs-dropdown-item` elements\n * \n * @cssprop --wcs-dropdown-outline-color-focus - Outline color of dropdown when focus it\n * \n * @cssprop --wcs-dropdown-plain-arrow-color - Color of the arrow indicator when the dropdown is plain\n * @cssprop --wcs-dropdown-stroked-arrow-color - Color of the arrow indicator when the dropdown is stroked\n * @cssprop --wcs-dropdown-clear-arrow-color - Color of the arrow indicator when the dropdown is not filled\n * @cssprop --wcs-dropdown-arrow-color-disabled - Base color of the arrow indicator when the dropdown is disabled\n * \n * @cssprop --wcs-dropdown-padding-empty - Padding of and empty dropdown\n * \n * @cssprop --wcs-dropdown-overlay-padding - Defines the vertical padding inside the dropdown overlay\n * @cssprop --wcs-dropdown-overlay-max-height - Specifies the maximum height of the dropdown overlay\n * @cssprop --wcs-dropdown-overlay-background-color - Determines the background color of the dropdown overlay\n * @cssprop --wcs-dropdown-overlay-border-width - Sets the border width of the dropdown overlay\n * @cssprop --wcs-dropdown-overlay-border-radius - Defines the border radius of the dropdown overlay\n * @cssprop --wcs-dropdown-overlay-border-color - Specifies the border color of the dropdown overlay\n */\n@Component({\n tag: 'wcs-dropdown',\n styleUrl: 'dropdown.scss',\n shadow: {\n delegatesFocus: true\n }\n})\nexport class Dropdown implements ComponentInterface, MutableAriaAttribute {\n @Element() private el: HTMLWcsDropdownElement;\n private inheritedAttributes: { [k: string]: any } = {};\n\n /**\n * This button is visually hidden. It used to carry all aria attributes and acts as the controller of the menu.\n * The wcs-button could not handle the aria-controls and aria-activedescendant attributes because of the IDREF\n * not passing from a shadow-dom through another.\n * @private\n */\n private nativeButton!: HTMLButtonElement;\n\n /**\n * This button is shown on the user interface, and visually receives focus and catch click events. \n * It is hidden to screen readers since the native button carries all the aria informations.\n * @private\n */\n private wcsButton!: HTMLWcsButtonElement;\n\n /**\n * This div is shown on the user interface when the dropdown is expanded.\n * @private\n */\n private popoverDiv!: HTMLDivElement;\n\n /** Hides the arrow in the button */\n @Prop() noArrow: boolean = false;\n\n /** Dropdown's button mode */\n @Prop() mode: WcsButtonMode = 'stroked';\n\n /** Dropdown's button shape */\n @Prop() shape: WcsButtonShape = 'normal';\n \n /** Dropdown's button size */\n @Prop() size: WcsButtonSize = 'm';\n\n /** Specifies whether the dropdown button is clickable or not */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** placement of the dropdown's popover */\n @Prop() placement: WcsDropdownPlacement = 'bottom-end';\n\n @State() private expanded = false;\n\n\n private popper: Instance;\n \n private lastFocusedItemElement: HTMLWcsDropdownItemElement | null;\n \n private get items(): HTMLWcsDropdownItemElement[] {\n return Array.from(this.el.querySelectorAll('wcs-dropdown-item'));\n }\n\n @Watch('placement')\n protected placementChange() {\n this.popper.setOptions({\n ...this.popper.state.options,\n placement: this.placement\n }).then(_ => this.popper.update());\n }\n \n @Listen('blur')\n onBlur() {\n this.clearLastFocusedItem();\n this.expanded = false;\n }\n\n componentDidLoad() {\n if (!isWcsButtonSize(this.size)) {\n console.warn(`Invalid size value for wcs-dropdown : \"${this.size}\". Must be one of \"${WcsButtonSizeValues.join(', ')}\"`);\n this.size = \"m\"; // Default fallback value\n }\n\n this.popper = createPopper(this.wcsButton, this.popoverDiv, {\n placement: this.placement,\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 8]\n }\n }\n ]\n });\n\n this.fixForFirefoxBelow63();\n }\n\n private fixForFirefoxBelow63() {\n // If the items appear out of the slot we place them back\n const items = this.el.querySelectorAll('wcs-dropdown-item');\n const container = this.el.querySelector('.container');\n if (items.length > 0 && container) {\n items.forEach(i => {\n this.el.removeChild(i);\n container.appendChild(i);\n });\n }\n }\n\n private onButtonClick(_: MouseEvent): void {\n this.clearLastFocusedItem();\n this.expanded = !this.expanded;\n \n if (this.expanded) {\n this.focusItem(0);\n }\n }\n\n @Listen('click', {target: 'window'})\n onWindowClickEvent(event: MouseEvent) {\n const clickedOnDropdownOrChildren = clickTargetIsElementOrChildren(event, this.el);\n if (this.expanded && !clickedOnDropdownOrChildren) {\n this.expanded = false;\n }\n }\n\n @Listen('wcsDropdownItemClick')\n dropdownItemClick(_: CustomEvent<void>) {\n this.expanded = false;\n this.nativeButton.focus();\n }\n\n @Listen('keydown')\n onKeyDown(_event: KeyboardEvent): void {\n const currentState = this.expanded ? 'opened' : 'closed';\n const actionsFromKeyboardEvents: KeyboardEventAssociatedAction[] = getActionForKeyboardEvent(_event, currentState);\n\n // If we have at least one associated actions, we prevent the default behavior of the event. \n // Except if the action is a focus move (we have to handle the preventDefault behavior ourselves in the action implementation)\n if (actionsFromKeyboardEvents.length != 0) {\n _event.preventDefault();\n }\n\n for (const actionFromKeyboardEvent of actionsFromKeyboardEvents) {\n this.doActionFromKeyboardEventAssociatedAction(actionFromKeyboardEvent);\n }\n }\n \n @Method()\n async setAriaAttribute(attr: AriaAttributeName, value: string | null | undefined) {\n setOrRemoveAttribute(this.nativeButton, attr, value);\n }\n\n doActionFromKeyboardEventAssociatedAction(actionFromKeyboardEvent: KeyboardEventAssociatedAction) {\n switch (actionFromKeyboardEvent.kind) {\n case 'OpenMenu':\n this.expanded = true;\n this.focusItem(0);\n break;\n case 'CloseMenu':\n this.expanded = false;\n this.nativeButton.focus();\n break;\n case 'ClearFocus':\n this.clearLastFocusedItem();\n break;\n case 'FocusItem':\n switch (actionFromKeyboardEvent.target) {\n case 'previous':\n this.focusClosestItem('previous');\n break;\n case 'next':\n this.focusClosestItem('next');\n break;\n case 'first':\n this.focusItem(0);\n break;\n case 'last':\n this.focusItem(this.items.length - 1);\n break;\n default:\n break;\n }\n break;\n default:\n break;\n }\n }\n\n /**\n * Removes the focus and tabindex 0 of the last focused item if any.\n * @private\n */\n private clearLastFocusedItem() {\n if (this.lastFocusedItemElement) {\n this.lastFocusedItemElement.tabIndex = -1;\n this.lastFocusedItemElement = null;\n }\n }\n \n private focusItem(indexToFocus: number) {\n this.clearLastFocusedItem();\n this.lastFocusedItemElement = this.items[indexToFocus];\n if (this.lastFocusedItemElement) {\n this.lastFocusedItemElement.tabIndex = 0;\n requestAnimationFrame(() => {\n this.lastFocusedItemElement?.focus();\n });\n }\n }\n \n private focusClosestItem(direction: 'next' | 'previous'): void {\n const indexToFocus = this.getClosestActiveItemIndexForDirection(direction);\n if (indexToFocus === -1) return;\n \n this.focusItem(indexToFocus);\n }\n \n private getClosestActiveItemIndexForDirection(direction: 'next' | 'previous'): number {\n const items = this.items;\n let currentIndex = Array.from(items).indexOf(this.lastFocusedItemElement);\n\n const MIN_INDEX = 0;\n const MAX_INDEX = items.length - 1;\n\n if (direction === 'next' && currentIndex < MAX_INDEX) {\n currentIndex++;\n } else if (direction === 'previous' && currentIndex > MIN_INDEX) {\n currentIndex--;\n } else {\n // Used to scroll through items infinitely with keyboard\n if (direction === 'next' && currentIndex >= MAX_INDEX) {\n currentIndex = 0;\n }\n if (direction === 'previous' && currentIndex === MIN_INDEX) {\n currentIndex = MAX_INDEX;\n }\n }\n \n return currentIndex;\n }\n\n componentDidRender() {\n if (this.popper) {\n this.popper.update();\n }\n }\n\n componentWillLoad(): Promise<void> | void {\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.el),\n ...inheritAttributes(this.el, DROPDOWN_INHERITED_ATTRS),\n };\n }\n \n render() {\n return (\n <Host>\n <button id=\"dropdown-button\"\n aria-controls=\"menu\"\n disabled={this.disabled}\n aria-haspopup=\"true\"\n role=\"button\"\n aria-expanded={this.expanded ? 'true' : 'false'}\n ref={el => this.nativeButton = el}\n onClick={($event) => this.onButtonClick($event)}\n onBlur={($event) => $event.stopImmediatePropagation()}\n {...this.inheritedAttributes}>Dropdown</button>\n <wcs-button mode={this.mode} shape={this.shape} disabled={this.disabled} size={this.size}\n ref={el => this.wcsButton = el}\n aria-hidden=\"true\"\n tabindex={-1}\n onClick={($event) => this.onButtonClick($event)}\n onBlur={(e) => e.stopImmediatePropagation()}>\n <div class=\"wcs-button-content-wrapper\">\n <slot name=\"placeholder\"/>\n {this.noArrow ? null : (<SelectArrow up={this.expanded}/>)}\n </div>\n </wcs-button>\n <div class={(this.expanded ? 'show ' : '') + 'popover'}\n id=\"menu\"\n role=\"menu\"\n aria-labelledby=\"dropdown-button\"\n tabindex={-1}\n ref={el => this.popoverDiv = el}>\n <div role=\"presentation\" id=\"arrow\" data-popper-arrow/>\n <div role=\"presentation\" class=\"container\">\n <slot name=\"item\">\n <span id={\"is-empty\"}></span>\n </slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"dropdown.js","sourceRoot":"","sources":["../../../src/components/dropdown/dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACpH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,OAAO,EAAE,YAAY,EAAY,MAAM,gBAAgB,CAAC;AAExD,OAAO,EACH,8BAA8B,EAC9B,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,yBAAyB,EAAiC,MAAM,2BAA2B,CAAC;AAGrG,MAAM,wBAAwB,GAAG,CAAC,UAAU,CAAC,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAQH,MAAM,OAAO,QAAQ;;QAET,wBAAmB,GAAyB,EAAE,CAAC;uBAwBX,KAAK;oBAGnB,SAAS;qBAGP,QAAQ;oBAGV,GAAG;wBAGY,KAAK;yBAGR,YAAY;wBAEjB,KAAK;;IAO1C,IAAY,KAAK;QACb,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACrE,CAAC;IAGS,eAAe;QACrB,IAAI,CAAC,MAAM,CAAC,UAAU,iCACf,IAAI,C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AAC,EAAC,WAAW,IAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,GAAG,CAAC,CACxD,CACG;YACb,4DAAK,KAAK,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,EACjD,EAAE,EAAC,MAAM,EACT,IAAI,EAAC,MAAM,qBACK,iBAAiB,EACjC,QAAQ,EAAE,CAAC,CAAC,EACZ,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,EAAE;gBAChC,4DAAK,IAAI,EAAC,cAAc,EAAC,EAAE,EAAC,OAAO,8BAAoB;gBACvD,4DAAK,IAAI,EAAC,cAAc,EAAC,KAAK,EAAC,WAAW;oBACtC,6DAAM,IAAI,EAAC,MAAM;wBACb,6DAAM,EAAE,EAAE,UAAU,GAAS,CAC1B,CACL,CACJ,CACH,CACV,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, ComponentInterface, Element, h, Host, Listen, Method, Prop, State, Watch } from '@stencil/core';\nimport { SelectArrow } from '../select/select-arrow';\nimport {\n WcsButtonMode,\n WcsButtonShape,\n WcsButtonSize,\n} from '../button/button-interface';\nimport { createPopper, Instance } from '@popperjs/core';\nimport { WcsDropdownPlacement } from './dropdown-interface';\nimport {\n clickTargetIsElementOrChildren,\n inheritAriaAttributes,\n inheritAttributes,\n setOrRemoveAttribute\n} from '../../utils/helpers';\nimport { getActionForKeyboardEvent, KeyboardEventAssociatedAction } from \"./dropdown-keyboard-event\";\nimport { AriaAttributeName, MutableAriaAttribute } from \"../../utils/mutable-aria-attribute\";\n\nconst DROPDOWN_INHERITED_ATTRS = ['tabindex'];\n\n/**\n * The dropdown component use a wcs-button under the hood, so you can use the same css classes as the button to style the\n * dropdown.\n * \n * @slot placeholder - The slot containing the placeholder displayed in button\n * @slot item - The slot container the list of `wcs-dropdown-item` elements\n * \n * @cssprop --wcs-dropdown-outline-color-focus - Outline color of dropdown when focus it\n * \n * @cssprop --wcs-dropdown-plain-arrow-color - Color of the arrow indicator when the dropdown is plain\n * @cssprop --wcs-dropdown-stroked-arrow-color - Color of the arrow indicator when the dropdown is stroked\n * @cssprop --wcs-dropdown-clear-arrow-color - Color of the arrow indicator when the dropdown is not filled\n * @cssprop --wcs-dropdown-arrow-color-disabled - Base color of the arrow indicator when the dropdown is disabled\n * \n * @cssprop --wcs-dropdown-padding-empty - Padding of and empty dropdown\n * \n * @cssprop --wcs-dropdown-overlay-padding - Defines the vertical padding inside the dropdown overlay\n * @cssprop --wcs-dropdown-overlay-max-height - Specifies the maximum height of the dropdown overlay\n * @cssprop --wcs-dropdown-overlay-background-color - Determines the background color of the dropdown overlay\n * @cssprop --wcs-dropdown-overlay-border-width - Sets the border width of the dropdown overlay\n * @cssprop --wcs-dropdown-overlay-border-radius - Defines the border radius of the dropdown overlay\n * @cssprop --wcs-dropdown-overlay-border-color - Specifies the border color of the dropdown overlay\n */\n@Component({\n tag: 'wcs-dropdown',\n styleUrl: 'dropdown.scss',\n shadow: {\n delegatesFocus: true\n }\n})\nexport class Dropdown implements ComponentInterface, MutableAriaAttribute {\n @Element() private el: HTMLWcsDropdownElement;\n private inheritedAttributes: { [k: string]: any } = {};\n\n /**\n * This button is visually hidden. It used to carry all aria attributes and acts as the controller of the menu.\n * The wcs-button could not handle the aria-controls and aria-activedescendant attributes because of the IDREF\n * not passing from a shadow-dom through another.\n * @private\n */\n private nativeButton!: HTMLButtonElement;\n\n /**\n * This button is shown on the user interface, and visually receives focus and catch click events. \n * It is hidden to screen readers since the native button carries all the aria informations.\n * @private\n */\n private wcsButton!: HTMLWcsButtonElement;\n\n /**\n * This div is shown on the user interface when the dropdown is expanded.\n * @private\n */\n private popoverDiv!: HTMLDivElement;\n\n /** Hides the arrow in the button */\n @Prop({ reflect: true }) noArrow: boolean = false;\n\n /** Dropdown's button mode */\n @Prop() mode: WcsButtonMode = 'stroked';\n\n /** Dropdown's button shape */\n @Prop() shape: WcsButtonShape = 'normal';\n \n /** Dropdown's button size */\n @Prop() size: WcsButtonSize = 'm';\n\n /** Specifies whether the dropdown button is clickable or not */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** placement of the dropdown's popover */\n @Prop() placement: WcsDropdownPlacement = 'bottom-end';\n\n @State() private expanded: boolean = false;\n\n\n private popper: Instance;\n \n private lastFocusedItemElement: HTMLWcsDropdownItemElement | null;\n \n private get items(): HTMLWcsDropdownItemElement[] {\n return Array.from(this.el.querySelectorAll('wcs-dropdown-item'));\n }\n\n @Watch('placement')\n protected placementChange() {\n this.popper.setOptions({\n ...this.popper.state.options,\n placement: this.placement\n }).then(_ => this.popper.update());\n }\n \n @Listen('blur')\n onBlur() {\n this.clearLastFocusedItem();\n this.expanded = false;\n }\n\n componentDidLoad() {\n this.popper = createPopper(this.wcsButton, this.popoverDiv, {\n placement: this.placement,\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 8]\n }\n }\n ]\n });\n\n this.fixForFirefoxBelow63();\n }\n\n private fixForFirefoxBelow63() {\n // If the items appear out of the slot we place them back\n const items = this.el.querySelectorAll('wcs-dropdown-item');\n const container = this.el.querySelector('.container');\n if (items.length > 0 && container) {\n items.forEach(i => {\n this.el.removeChild(i);\n container.appendChild(i);\n });\n }\n }\n\n private onButtonClick(_: MouseEvent): void {\n this.clearLastFocusedItem();\n this.expanded = !this.expanded;\n \n if (this.expanded) {\n this.focusItem(0);\n }\n }\n\n @Listen('click', {target: 'window'})\n onWindowClickEvent(event: MouseEvent) {\n const clickedOnDropdownOrChildren = clickTargetIsElementOrChildren(event, this.el);\n if (this.expanded && !clickedOnDropdownOrChildren) {\n this.expanded = false;\n }\n }\n\n @Listen('wcsDropdownItemClick')\n dropdownItemClick(_: CustomEvent<void>) {\n this.expanded = false;\n this.nativeButton.focus();\n }\n\n @Listen('keydown')\n onKeyDown(_event: KeyboardEvent): void {\n const currentState = this.expanded ? 'opened' : 'closed';\n const actionsFromKeyboardEvents: KeyboardEventAssociatedAction[] = getActionForKeyboardEvent(_event, currentState);\n\n // If we have at least one associated actions, we prevent the default behavior of the event. \n // Except if the action is a focus move (we have to handle the preventDefault behavior ourselves in the action implementation)\n if (actionsFromKeyboardEvents.length != 0) {\n _event.preventDefault();\n }\n\n for (const actionFromKeyboardEvent of actionsFromKeyboardEvents) {\n this.doActionFromKeyboardEventAssociatedAction(actionFromKeyboardEvent);\n }\n }\n \n @Method()\n async setAriaAttribute(attr: AriaAttributeName, value: string | null | undefined) {\n setOrRemoveAttribute(this.nativeButton, attr, value);\n }\n\n doActionFromKeyboardEventAssociatedAction(actionFromKeyboardEvent: KeyboardEventAssociatedAction) {\n switch (actionFromKeyboardEvent.kind) {\n case 'OpenMenu':\n this.expanded = true;\n this.focusItem(0);\n break;\n case 'CloseMenu':\n this.expanded = false;\n this.nativeButton.focus();\n break;\n case 'ClearFocus':\n this.clearLastFocusedItem();\n break;\n case 'FocusItem':\n switch (actionFromKeyboardEvent.target) {\n case 'previous':\n this.focusClosestItem('previous');\n break;\n case 'next':\n this.focusClosestItem('next');\n break;\n case 'first':\n this.focusItem(0);\n break;\n case 'last':\n this.focusItem(this.items.length - 1);\n break;\n default:\n break;\n }\n break;\n default:\n break;\n }\n }\n\n /**\n * Removes the focus and tabindex 0 of the last focused item if any.\n * @private\n */\n private clearLastFocusedItem() {\n if (this.lastFocusedItemElement) {\n this.lastFocusedItemElement.tabIndex = -1;\n this.lastFocusedItemElement = null;\n }\n }\n \n private focusItem(indexToFocus: number) {\n this.clearLastFocusedItem();\n this.lastFocusedItemElement = this.items[indexToFocus];\n if (this.lastFocusedItemElement) {\n this.lastFocusedItemElement.tabIndex = 0;\n requestAnimationFrame(() => {\n this.lastFocusedItemElement?.focus();\n });\n }\n }\n \n private focusClosestItem(direction: 'next' | 'previous'): void {\n const indexToFocus = this.getClosestActiveItemIndexForDirection(direction);\n if (indexToFocus === -1) return;\n \n this.focusItem(indexToFocus);\n }\n \n private getClosestActiveItemIndexForDirection(direction: 'next' | 'previous'): number {\n const items = this.items;\n let currentIndex = Array.from(items).indexOf(this.lastFocusedItemElement);\n\n const MIN_INDEX = 0;\n const MAX_INDEX = items.length - 1;\n\n if (direction === 'next' && currentIndex < MAX_INDEX) {\n currentIndex++;\n } else if (direction === 'previous' && currentIndex > MIN_INDEX) {\n currentIndex--;\n } else {\n // Used to scroll through items infinitely with keyboard\n if (direction === 'next' && currentIndex >= MAX_INDEX) {\n currentIndex = 0;\n }\n if (direction === 'previous' && currentIndex === MIN_INDEX) {\n currentIndex = MAX_INDEX;\n }\n }\n \n return currentIndex;\n }\n\n componentDidRender() {\n if (this.popper) {\n this.popper.update();\n }\n }\n\n componentWillLoad(): Promise<void> | void {\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.el),\n ...inheritAttributes(this.el, DROPDOWN_INHERITED_ATTRS),\n };\n }\n \n render() {\n return (\n <Host>\n <button id=\"dropdown-button\"\n aria-controls=\"menu\"\n disabled={this.disabled}\n aria-haspopup=\"true\"\n role=\"button\"\n aria-expanded={this.expanded ? 'true' : 'false'}\n ref={el => this.nativeButton = el}\n onClick={($event) => this.onButtonClick($event)}\n onBlur={($event) => $event.stopImmediatePropagation()}\n {...this.inheritedAttributes}>Dropdown</button>\n <wcs-button mode={this.mode} shape={this.shape} disabled={this.disabled} size={this.size}\n ref={el => this.wcsButton = el}\n aria-hidden=\"true\"\n tabindex={-1}\n onClick={($event) => this.onButtonClick($event)}\n onBlur={(e) => e.stopImmediatePropagation()}>\n <div class=\"wcs-button-content-wrapper\">\n <slot name=\"placeholder\"/>\n {this.noArrow ? null : (<SelectArrow up={this.expanded}/>)}\n </div>\n </wcs-button>\n <div class={(this.expanded ? 'show ' : '') + 'popover'}\n id=\"menu\"\n role=\"menu\"\n aria-labelledby=\"dropdown-button\"\n tabindex={-1}\n ref={el => this.popoverDiv = el}>\n <div role=\"presentation\" id=\"arrow\" data-popper-arrow/>\n <div role=\"presentation\" class=\"container\">\n <slot name=\"item\">\n <span id={\"is-empty\"}></span>\n </slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n\n"]}
|
|
@@ -8,7 +8,7 @@ import { h, Host } from "@stencil/core";
|
|
|
8
8
|
*/
|
|
9
9
|
export class DropdownDivider {
|
|
10
10
|
render() {
|
|
11
|
-
return (h(Host, { key: '
|
|
11
|
+
return (h(Host, { key: '52d90154f003445f1d62badde51df437a38d6f19', slot: "item", tabindex: "-1", "aria-hidden": "true" }));
|
|
12
12
|
}
|
|
13
13
|
static get is() { return "wcs-dropdown-divider"; }
|
|
14
14
|
static get encapsulation() { return "shadow"; }
|
|
@@ -12,7 +12,7 @@ import { h, Host } from "@stencil/core";
|
|
|
12
12
|
*/
|
|
13
13
|
export class DropdownHeader {
|
|
14
14
|
render() {
|
|
15
|
-
return (h(Host, { key: '
|
|
15
|
+
return (h(Host, { key: 'a9f4cf33ebcc666bd3f703c3d51d17b655f28ed8', slot: "item", tabindex: "-1" }, h("slot", { key: 'ccabe9a8805d48d8b2bec9326b5aaa1b6338f06b' })));
|
|
16
16
|
}
|
|
17
17
|
static get is() { return "wcs-dropdown-header"; }
|
|
18
18
|
static get encapsulation() { return "shadow"; }
|
|
@@ -31,7 +31,7 @@ export class DropdownItem {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
render() {
|
|
34
|
-
return (h(Host, { key: '
|
|
34
|
+
return (h(Host, { key: '70e0767afe5fe295df4292e356db89d555fa71a3', slot: "item", role: "menuitem", tabindex: "-1" }, h("slot", { key: '11cd674f89784aec6bfa1ba4d15f0fb0f25d976e' })));
|
|
35
35
|
}
|
|
36
36
|
static get is() { return "wcs-dropdown-item"; }
|
|
37
37
|
static get originalStyleUrls() {
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
--wcs-editable-field-padding-horizontal-m: var(--wcs-semantic-spacing-large);
|
|
26
26
|
--wcs-editable-field-padding-horizontal-l: var(--wcs-semantic-spacing-large);
|
|
27
27
|
--wcs-editable-field-icon-color-readonly: var(--wcs-semantic-color-text-tertiary);
|
|
28
|
+
--wcs-editable-field-host-padding: var(--wcs-editable-field-padding-vertical-m) var(--wcs-editable-field-padding-horizontal-m);
|
|
29
|
+
--wcs-editable-field-host-height: var(--wcs-editable-field-height-m);
|
|
30
|
+
--wcs-editable-field-font-size: var(--wcs-editable-field-font-size-m);
|
|
28
31
|
display: block;
|
|
29
32
|
}
|
|
30
33
|
:host .display-none {
|
|
@@ -302,7 +302,7 @@ export class EditableField {
|
|
|
302
302
|
}
|
|
303
303
|
render() {
|
|
304
304
|
const { formattedValue, formattedValueText, formattedCurrentValue } = this.formatValues();
|
|
305
|
-
return (h(Host, { key: '
|
|
305
|
+
return (h(Host, { key: '81f6b6b92cd0a6f60a0eb4fbdb781a42863d4478' }, h("div", { key: '1278b7794e0127f1f2bc819d246712d55a139abd', class: "label" }, this.label), h("button", { key: '6049a936d198c5ee68db9a29466b82dc0ca55fa2', type: "button", class: 'display-container ' + (this.currentState !== EditableComponentState.DISPLAY ? 'display-none' : ''), onClick: () => this.onDisplayContainerClick(), ref: (el) => this.editModeBtn = el, "aria-label": `${EDIT_ARIA_LABEL} ${this.label} ${formattedValueText}` }, formattedValue, h("wcs-mat-icon", { key: '97020f20f553553b1e3a866d6d2ad274504b1bc9', icon: "edit", size: "s" }), this.readonly ? this.getReadonlySvgIcon() : null), h("div", { key: '17c58773fdaa738eef36c20545815ff10c35c5eb', class: 'load-container ' + (this.currentState !== EditableComponentState.LOAD ? 'display-none' : '') }, formattedCurrentValue, h("wcs-spinner", { key: 'b2ef7dd52a95d0604cd74368a17cf26283a663a9' })), h("wcs-form-field", { key: '38891efe6c9c119ad7d261f31edba4b4e5e3ae71', "is-error": this.isError, class: 'edit-container ' + (this.currentState !== EditableComponentState.EDIT ? 'display-none' : '') }, h("wcs-label", { key: '80ff051b722d175932c4cf56410f8c4081fe4cb8', class: "visually-hidden" }, this.label), h("slot", { key: '4e8592e8283ce75e629f61dafd609c59cd5fbbc0' }), this.isError && this.errorMsg
|
|
306
306
|
? h("wcs-error", null, this.errorMsg)
|
|
307
307
|
: null)));
|
|
308
308
|
}
|
|
@@ -15,7 +15,7 @@ import { h, Host } from "@stencil/core";
|
|
|
15
15
|
*/
|
|
16
16
|
export class Label {
|
|
17
17
|
render() {
|
|
18
|
-
return (h(Host, { key: '
|
|
18
|
+
return (h(Host, { key: '7dffcb3487f7210c5c9a45af709fc942a1410679', role: "alert", slot: "error" }, h("slot", { key: '251fbdc26fe58be4296328c4ebaed77329c6c507' })));
|
|
19
19
|
}
|
|
20
20
|
static get is() { return "wcs-error"; }
|
|
21
21
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/components/error/error.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEvE;;;;;;;;;;;;;GAaG;AAMH,MAAM,OAAO,KAAK;IACd,MAAM;QACF,OAAO,CACH,EAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/components/error/error.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEvE;;;;;;;;;;;;;GAaG;AAMH,MAAM,OAAO,KAAK;IACd,MAAM;QACF,OAAO,CACH,EAAC,IAAI,qDAAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO;YAC3B,8DAAQ,CACL,CACV,CAAC;IACN,CAAC;;;;;;;;;CACJ","sourcesContent":["import { Component, ComponentInterface, h, Host } from '@stencil/core';\n\n/**\n * The `wcs-error` should always be wrapped in a `wcs-form-field`.\n * It is used to display a red message under the field indicating an incorrect user input.\n * \n * ## Accessibility guidelines 💡\n * - Provide a relevant error message to inform the users what they should change to make the field valid\n * - Always add the error icon, to ensure the visual indication of the error state other than the color\n * - `aria-description` will be automatically added to the field for screen readers\n * - `aria-invalid=\"true\"` will be automatically added to the field for screen readers\n * \n * @cssprop --wcs-error-color - Color of the text\n * @cssprop --wcs-error-font-size - Font size\n * @cssprop --wcs-error-font-weight - Font weight\n */\n@Component({\n tag: 'wcs-error',\n styleUrl: 'error.scss',\n shadow: true,\n})\nexport class Label implements ComponentInterface {\n render() {\n return (\n <Host role=\"alert\" slot=\"error\">\n <slot />\n </Host>\n );\n }\n}\n"]}
|
|
@@ -21,7 +21,7 @@ import { h, Host, } from "@stencil/core";
|
|
|
21
21
|
*/
|
|
22
22
|
export class Field {
|
|
23
23
|
render() {
|
|
24
|
-
return (h(Host, { key: '
|
|
24
|
+
return (h(Host, { key: 'ae0a6c7224dc199cd6cd342d77878bfff17aa49b' }, h("slot", { key: '408c146f3e6bfa1868964a29934494215627fb59', name: "label" }), h("slot", { key: '9c2151491f6acc4a5a6da36676e21e8dee6f156a', name: "content" })));
|
|
25
25
|
}
|
|
26
26
|
static get is() { return "wcs-field"; }
|
|
27
27
|
static get encapsulation() { return "shadow"; }
|
|
@@ -9,7 +9,7 @@ import { h, Host } from "@stencil/core";
|
|
|
9
9
|
*/
|
|
10
10
|
export class FieldContent {
|
|
11
11
|
render() {
|
|
12
|
-
return (h(Host, { key: '
|
|
12
|
+
return (h(Host, { key: '251b9ccc1b13766b287f356dfc51d6a953ad0a5e', slot: "content" }, h("slot", { key: 'ee7d55bf47c0f468829e99a26a0fe340fbafcc9f' })));
|
|
13
13
|
}
|
|
14
14
|
static get is() { return "wcs-field-content"; }
|
|
15
15
|
static get encapsulation() { return "shadow"; }
|
|
@@ -9,7 +9,7 @@ import { h, Host, } from "@stencil/core";
|
|
|
9
9
|
*/
|
|
10
10
|
export class FieldLabel {
|
|
11
11
|
render() {
|
|
12
|
-
return (h(Host, { key: '
|
|
12
|
+
return (h(Host, { key: 'a051b09993d67bf56b087d86ba433caf1bdbb7a6', slot: "label" }, h("slot", { key: '6044b728151fd48878f555d3db3e0754f31b7e51' })));
|
|
13
13
|
}
|
|
14
14
|
static get is() { return "wcs-field-label"; }
|
|
15
15
|
static get encapsulation() { return "shadow"; }
|
|
@@ -20,7 +20,7 @@ import { h, Host } from "@stencil/core";
|
|
|
20
20
|
*/
|
|
21
21
|
export class Footer {
|
|
22
22
|
render() {
|
|
23
|
-
return (h(Host, { key: '
|
|
23
|
+
return (h(Host, { key: '6fe975235d6de2793e55e8d10860649b5684c093' }, h("footer", { key: '80b0ff721eedab3e4cc00fd2484a638718fc8b13', role: "contentinfo" }, h("div", { key: 'f7d676d79f4d8780736e3a28e3e4b2aa1f0786e1', class: "container" }, h("div", { key: 'e1f9ea823133d972d3eb2bc8e7eaa18558448a73' }, h("slot", { key: 'd7177b9e98ac24ad39008669de01899e71c27079' })), h("div", { key: '849ceafdd459f24b672e1f68edf86ffd4fcce733', class: "end" }, h("div", { key: '7077861e872bbb50e7e5de0c968fe2222e9bf7d7', class: "end-left" }, h("slot", { key: 'dded653e62bf683e0514c51b06e55ccb44f70c54', name: "end-left" })), h("div", { key: 'ec25d2a5f84cb477eaa6a63de4df6ce6e9db07c5', class: "end-right" }, h("slot", { key: '4201096294b44a29f74112c2acaa2163f9ecfcb9', name: "end-right" })))))));
|
|
24
24
|
}
|
|
25
25
|
static get is() { return "wcs-footer"; }
|
|
26
26
|
static get encapsulation() { return "shadow"; }
|
|
@@ -188,7 +188,7 @@ export class FormField {
|
|
|
188
188
|
if (this.hasPrefix) {
|
|
189
189
|
classes += ' has-prefix';
|
|
190
190
|
}
|
|
191
|
-
return (h(Host, { key: '
|
|
191
|
+
return (h(Host, { key: 'd8a5d2023add393b0a31173351a3d16d9fa0b1a6', class: classes }, h("slot", { key: '3f347f4dce239c0106fbbe52bdc217fa37c05d01', name: "label" }), h("div", { key: 'd6cb92104d72530059ecb9a383ff832afb0c2141', class: "input-container" }, h("slot", { key: '8be28f721ff351d41dced80c97c0e34337703d0e', name: "prefix" }), h("slot", { key: 'cc58d463877a1e8513736a987286e965870e096d', onSlotchange: () => this.onFormInputSlotChange() }), h("slot", { key: '898709cfcf0ae1cd43dabd55547d62199d6230c9', name: "suffix" })), isError ? (h("slot", { name: "error" })) : '', h("slot", { key: 'aaf2d35dfbdfda47b440f96d7f9aa22cb09f6a06', name: "messages" })));
|
|
192
192
|
}
|
|
193
193
|
onFormInputSlotChange() {
|
|
194
194
|
this.initSpiedElement();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field.js","sourceRoot":"","sources":["../../../src/components/form-field/form-field.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAMH,MAAM,OAAO,SAAS;;uBAM8B,KAAK;yBAExB,KAAK;yBACL,KAAK;;;IAKlC,iBAAiB;QACb,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;QACjE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IACrE,CAAC;IAED,gBAAgB;QACZ,IAAI,CAA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AAC;IAChC,CAAC;IAED,MAAM;QACF,IAAI,OAAO,GAAG,EAAE,CAAC;QACjB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,OAAO,IAAI,aAAa,CAAC;QAC7B,CAAC;QACD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,OAAO,IAAI,aAAa,CAAC;QAC7B,CAAC;QACD,OAAO,CACH,EAAC,IAAI,qDAAC,KAAK,EAAE,OAAO;YAChB,6DAAM,IAAI,EAAC,OAAO,GAAE;YACpB,4DAAK,KAAK,EAAC,iBAAiB;gBACxB,6DAAM,IAAI,EAAC,QAAQ,GAAE;gBACrB,6DAAM,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,qBAAqB,EAAE,GAAG;gBACzD,6DAAM,IAAI,EAAC,QAAQ,GAAE,CACnB;YAEF,OAAO,CAAC,CAAC,CAAC,CAAC,YAAM,IAAI,EAAC,OAAO,GAAE,CAAC,CAAC,CAAC,CAAC,EAAE;YAEzC,6DAAM,IAAI,EAAC,UAAU,GAAE,CACpB,CACV,CAAC;IACN,CAAC;IAEO,qBAAqB;QACzB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,oBAAoB,EAAE,CAAA;QAC3B,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAChC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, ComponentInterface, Element, h, Host, Prop, State, Watch } from '@stencil/core';\nimport { isMutableAriaAttribute } from \"../../utils/mutable-aria-attribute\";\nimport { normalizeWhitespace } from '../../utils/helpers';\nimport { isControlComponentWithLabel } from \"../../utils/control-component-interface\";\n\n/**\n * Form field component wraps the native input element and add some more functionality on top of it.\n *\n * You can use the `wcs-form-field` to wrap any of these components :\n * - `wcs-input`\n * - `wcs-textarea`\n * - `wcs-radio-group`\n * - `wcs-switch`\n * - `wcs-checkbox`\n * - `wcs-native-select`\n * - `wcs-select`\n * - `wcs-counter`\n *\n * For non-supported slotted component, you can use the `required` attribute on the wrapped component to tell the\n * form-field that it is required. It will add a red star after the label of the form field.\n * \n * ## Accessibility guidelines 💡\n * - Each form control should be identified with a unique `wcs-label`\n * - Don't forget to add form validation to make sure the data is correctly formatted\n * - If the `wcs-label` is required, the form control must have the `required` HTML attribute and vice-versa (this is normally automatically set)\n * - The form should not be submittable if at least one required form control is not filled\n * - Hints are optional and should only be used to add extra information\n * - Additional aria attributes put on `<wcs-form-field>` won't inherit onto the native component : you must use the `setAriaAttribute` method.\n * \n * @slot label - Automatically filled when a `wcs-label` is provided\n * @slot <no-name> - The main slot containing the wrapped component\n * @slot prefix - (Optional) Display a component as prefix. See \"Prefix Suffix Group\" story for more info.\n * @slot suffix - (Optional) Display a component as suffix. See \"Prefix Suffix Group\" story for more info.\n * @slot error - Automatically filled when a `wcs-error` is provided\n * @slot messages - Automatically filled when a `wcs-hint` is provided\n *\n * @cssprop --wcs-form-field-gap - Defines the spacing between the label, input control, and hint messages.\n * @cssprop --wcs-form-field-prefix-suffix-border-radius - Sets the border radius for both prefix and suffix elements.\n * \n * @cssprop --wcs-form-field-prefix-background-color-default - Background color default for prefix elements\n * @cssprop --wcs-form-field-prefix-background-color-disabled - Background color for prefix elements when disabled\n * @cssprop --wcs-form-field-prefix-background-color-hover - Background color for prefix elements when hovered\n * @cssprop --wcs-form-field-prefix-border-color-default - Defines the default border color for prefix\n * @cssprop --wcs-form-field-prefix-border-color-focus - Sets the border color for prefix elements when focused.\n * @cssprop --wcs-form-field-prefix-border-color-disabled - Determines the border color for prefix elements when disabled.\n * \n * @cssprop --wcs-form-field-prefix-icon-color - Specifies the color of icons within prefix elements.\n * @cssprop --wcs-form-field-prefix-value-color - Sets the color of values within prefix elements.\n * @cssprop --wcs-form-field-prefix-placeholder-color - Defines the placeholder text color within prefix elements.\n * @cssprop --wcs-form-field-prefix-color-disabled - Determines the text color for prefix elements when disabled.\n */\n@Component({\n tag: 'wcs-form-field',\n styleUrl: 'form-field.scss',\n shadow: true,\n})\nexport class FormField implements ComponentInterface {\n @Element() private el!: HTMLWcsFormFieldElement;\n\n /**\n * Specifies whether the form field is in an error state. Displays the field border in red and the message contained in the wcs-error component\n */\n @Prop({mutable: true, reflect: true}) isError = false;\n\n @State() private hasPrefix = false;\n @State() private hasSuffix = false;\n @State() private spiedElement: Element;\n\n private observer: MutationObserver;\n\n componentWillLoad() {\n this.hasSuffix = this.el.querySelector('[slot=suffix]') !== null;\n this.hasPrefix = this.el.querySelector('[slot=prefix]') !== null;\n }\n\n componentDidLoad() {\n this.initSpiedElement();\n this.addRequiredMarkerToLabel();\n this.updateErrorStateOnInput(this.isError);\n }\n\n @Watch('isError')\n // @ts-ignore\n private isErrorChange(newValue: boolean) {\n this.updateErrorStateOnInput(newValue);\n this.updateAriaAttributes();\n }\n\n private updateErrorStateOnInput(newValue: boolean) {\n if (this.spiedElementIsOfType('wcs-input', 'wcs-textarea')) {\n if (newValue) {\n this.spiedElement.setAttribute('state', 'error');\n } else {\n this.spiedElement.setAttribute('state', 'initial');\n }\n }\n }\n\n /**\n * This function return true if the form field contains an element with tagName matches a value of the types param\n * @param types\n * @private\n */\n private spiedElementIsOfType(...types: string[]): boolean {\n for (const type of types) {\n if (this.spiedElement?.tagName === type.toUpperCase()) return true;\n }\n return false\n }\n\n\n private addRequiredMarkerToLabel() {\n // TODO: deprecate this in favor of the 'required' component attribute\n const label = this.el.querySelector('wcs-label');\n this.observer = new MutationObserver(mutations => {\n const requiredAttMutation = mutations.filter(m => m.attributeName === 'required')[0];\n if (requiredAttMutation) {\n this.updateLabelRequiredFlag(this.spiedElement?.hasAttribute('required'), label);\n }\n });\n if (this.spiedElement) {\n this.observer.observe(this.spiedElement, {attributes: true});\n }\n\n const isRequired = this.spiedElement?.hasAttribute('required');\n this.updateLabelRequiredFlag(isRequired, label);\n }\n\n\n private initSpiedElement() {\n const SUPPORTED_COMPONENTS = ['wcs-input', 'wcs-select', 'wcs-native-select', 'wcs-textarea', 'wcs-radio-group', 'wcs-switch', 'wcs-checkbox', 'wcs-native-select', 'wcs-counter'];\n\n this.spiedElement = (this.el.shadowRoot.querySelector('slot:not([name])') as HTMLSlotElement)\n ?.assignedElements()\n .filter(n => [...SUPPORTED_COMPONENTS, 'SLOT'].map(x => x.toUpperCase()).indexOf(n.nodeName) !== -1)[0];\n\n // If the component is used in another web component\n if (this.spiedElement?.tagName === 'SLOT') {\n this.spiedElement = ((this.spiedElement as HTMLSlotElement)\n .assignedElements()\n .filter(n => SUPPORTED_COMPONENTS.map(x => x.toUpperCase()).indexOf(n.nodeName) !== -1)[0]) as HTMLElement;\n }\n\n if (!this.spiedElement) {\n // tslint:disable-next-line:no-console\n console.warn('Form-field component support only ' + SUPPORTED_COMPONENTS.toString() + '. Some features may not work with the provided component.');\n return;\n }\n }\n \n private async updateAriaAttributes(): Promise<void> {\n if (isMutableAriaAttribute(this.spiedElement)) {\n const ariaLabelParts: string[] = [];\n if (isControlComponentWithLabel(this.spiedElement)) {\n const innerLabel = await this.spiedElement.getLabel();\n const combinedLabel = `${this.label || ''} ${innerLabel || ''}`.trim();\n if(combinedLabel) {\n ariaLabelParts.push(normalizeWhitespace(combinedLabel));\n }\n } else {\n if(this.label) {\n ariaLabelParts.push(normalizeWhitespace(this.label));\n }\n }\n\n if(this.description) {\n ariaLabelParts.push(normalizeWhitespace(this.description));\n }\n \n // Sur les autres DS, généralement seul l'erreur est affichée et pas avec la description\n if(this.isError) {\n this.spiedElement.setAriaAttribute('aria-invalid', 'true');\n if(this.error) {\n ariaLabelParts.push(normalizeWhitespace(this.error));\n }\n } else {\n this.spiedElement.setAriaAttribute('aria-invalid', 'false');\n }\n\n this.spiedElement.setAriaAttribute('aria-label', ariaLabelParts.length > 0 ? ariaLabelParts.join(' ') : null);\n }\n }\n \n private get label(): string | null {\n return this.el.querySelector('wcs-label')?.textContent || null;\n }\n \n private get description(): string | null {\n return this.el.querySelector('wcs-hint')?.textContent || null;\n }\n \n private get error(): string | null {\n return this.el.querySelector('wcs-error')?.textContent || null;\n }\n\n private updateLabelRequiredFlag(isRequired: boolean, label: Element) {\n if (isRequired && label) {\n label.setAttribute('required', 'true');\n } else if (!isRequired && label) {\n label.removeAttribute('required');\n }\n }\n\n disconnectedCallback() {\n this.observer?.disconnect();\n }\n\n render() {\n let classes = '';\n const isError = this.isError;\n\n if (this.hasSuffix) {\n classes += ' has-suffix';\n }\n if (this.hasPrefix) {\n classes += ' has-prefix';\n }\n return (\n <Host class={classes}>\n <slot name=\"label\"/>\n <div class=\"input-container\">\n <slot name=\"prefix\"/>\n <slot onSlotchange={() => this.onFormInputSlotChange()}/>\n <slot name=\"suffix\"/>\n </div>\n {\n isError ? (<slot name=\"error\"/>) : ''\n }\n <slot name=\"messages\"/>\n </Host>\n );\n }\n\n private onFormInputSlotChange() {\n this.initSpiedElement();\n this.updateAriaAttributes()\n this.addRequiredMarkerToLabel();\n this.updateErrorStateOnInput(this.isError);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"form-field.js","sourceRoot":"","sources":["../../../src/components/form-field/form-field.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAMH,MAAM,OAAO,SAAS;;uBAMuC,KAAK;yBAExB,KAAK;yBACL,KAAK;;;IAK3C,iBAAiB;QAC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component, ComponentInterface, Element, h, Host, Prop, State, Watch } from '@stencil/core';\nimport { isMutableAriaAttribute } from \"../../utils/mutable-aria-attribute\";\nimport { normalizeWhitespace } from '../../utils/helpers';\nimport { isControlComponentWithLabel } from \"../../utils/control-component-interface\";\n\n/**\n * Form field component wraps the native input element and add some more functionality on top of it.\n *\n * You can use the `wcs-form-field` to wrap any of these components :\n * - `wcs-input`\n * - `wcs-textarea`\n * - `wcs-radio-group`\n * - `wcs-switch`\n * - `wcs-checkbox`\n * - `wcs-native-select`\n * - `wcs-select`\n * - `wcs-counter`\n *\n * For non-supported slotted component, you can use the `required` attribute on the wrapped component to tell the\n * form-field that it is required. It will add a red star after the label of the form field.\n * \n * ## Accessibility guidelines 💡\n * - Each form control should be identified with a unique `wcs-label`\n * - Don't forget to add form validation to make sure the data is correctly formatted\n * - If the `wcs-label` is required, the form control must have the `required` HTML attribute and vice-versa (this is normally automatically set)\n * - The form should not be submittable if at least one required form control is not filled\n * - Hints are optional and should only be used to add extra information\n * - Additional aria attributes put on `<wcs-form-field>` won't inherit onto the native component : you must use the `setAriaAttribute` method.\n * \n * @slot label - Automatically filled when a `wcs-label` is provided\n * @slot <no-name> - The main slot containing the wrapped component\n * @slot prefix - (Optional) Display a component as prefix. See \"Prefix Suffix Group\" story for more info.\n * @slot suffix - (Optional) Display a component as suffix. See \"Prefix Suffix Group\" story for more info.\n * @slot error - Automatically filled when a `wcs-error` is provided\n * @slot messages - Automatically filled when a `wcs-hint` is provided\n *\n * @cssprop --wcs-form-field-gap - Defines the spacing between the label, input control, and hint messages.\n * @cssprop --wcs-form-field-prefix-suffix-border-radius - Sets the border radius for both prefix and suffix elements.\n * \n * @cssprop --wcs-form-field-prefix-background-color-default - Background color default for prefix elements\n * @cssprop --wcs-form-field-prefix-background-color-disabled - Background color for prefix elements when disabled\n * @cssprop --wcs-form-field-prefix-background-color-hover - Background color for prefix elements when hovered\n * @cssprop --wcs-form-field-prefix-border-color-default - Defines the default border color for prefix\n * @cssprop --wcs-form-field-prefix-border-color-focus - Sets the border color for prefix elements when focused.\n * @cssprop --wcs-form-field-prefix-border-color-disabled - Determines the border color for prefix elements when disabled.\n * \n * @cssprop --wcs-form-field-prefix-icon-color - Specifies the color of icons within prefix elements.\n * @cssprop --wcs-form-field-prefix-value-color - Sets the color of values within prefix elements.\n * @cssprop --wcs-form-field-prefix-placeholder-color - Defines the placeholder text color within prefix elements.\n * @cssprop --wcs-form-field-prefix-color-disabled - Determines the text color for prefix elements when disabled.\n */\n@Component({\n tag: 'wcs-form-field',\n styleUrl: 'form-field.scss',\n shadow: true,\n})\nexport class FormField implements ComponentInterface {\n @Element() private el!: HTMLWcsFormFieldElement;\n\n /**\n * Specifies whether the form field is in an error state. Displays the field border in red and the message contained in the wcs-error component\n */\n @Prop({mutable: true, reflect: true}) isError: boolean = false;\n\n @State() private hasPrefix: boolean = false;\n @State() private hasSuffix: boolean = false;\n @State() private spiedElement: Element;\n\n private observer: MutationObserver;\n\n componentWillLoad() {\n this.hasSuffix = this.el.querySelector('[slot=suffix]') !== null;\n this.hasPrefix = this.el.querySelector('[slot=prefix]') !== null;\n }\n\n componentDidLoad() {\n this.initSpiedElement();\n this.addRequiredMarkerToLabel();\n this.updateErrorStateOnInput(this.isError);\n }\n\n @Watch('isError')\n // @ts-ignore\n private isErrorChange(newValue: boolean) {\n this.updateErrorStateOnInput(newValue);\n this.updateAriaAttributes();\n }\n\n private updateErrorStateOnInput(newValue: boolean) {\n if (this.spiedElementIsOfType('wcs-input', 'wcs-textarea')) {\n if (newValue) {\n this.spiedElement.setAttribute('state', 'error');\n } else {\n this.spiedElement.setAttribute('state', 'initial');\n }\n }\n }\n\n /**\n * This function return true if the form field contains an element with tagName matches a value of the types param\n * @param types\n * @private\n */\n private spiedElementIsOfType(...types: string[]): boolean {\n for (const type of types) {\n if (this.spiedElement?.tagName === type.toUpperCase()) return true;\n }\n return false\n }\n\n\n private addRequiredMarkerToLabel() {\n // TODO: deprecate this in favor of the 'required' component attribute\n const label = this.el.querySelector('wcs-label');\n this.observer = new MutationObserver(mutations => {\n const requiredAttMutation = mutations.filter(m => m.attributeName === 'required')[0];\n if (requiredAttMutation) {\n this.updateLabelRequiredFlag(this.spiedElement?.hasAttribute('required'), label);\n }\n });\n if (this.spiedElement) {\n this.observer.observe(this.spiedElement, {attributes: true});\n }\n\n const isRequired = this.spiedElement?.hasAttribute('required');\n this.updateLabelRequiredFlag(isRequired, label);\n }\n\n\n private initSpiedElement() {\n const SUPPORTED_COMPONENTS = ['wcs-input', 'wcs-select', 'wcs-native-select', 'wcs-textarea', 'wcs-radio-group', 'wcs-switch', 'wcs-checkbox', 'wcs-native-select', 'wcs-counter'];\n\n this.spiedElement = (this.el.shadowRoot.querySelector('slot:not([name])') as HTMLSlotElement)\n ?.assignedElements()\n .filter(n => [...SUPPORTED_COMPONENTS, 'SLOT'].map(x => x.toUpperCase()).indexOf(n.nodeName) !== -1)[0];\n\n // If the component is used in another web component\n if (this.spiedElement?.tagName === 'SLOT') {\n this.spiedElement = ((this.spiedElement as HTMLSlotElement)\n .assignedElements()\n .filter(n => SUPPORTED_COMPONENTS.map(x => x.toUpperCase()).indexOf(n.nodeName) !== -1)[0]) as HTMLElement;\n }\n\n if (!this.spiedElement) {\n // tslint:disable-next-line:no-console\n console.warn('Form-field component support only ' + SUPPORTED_COMPONENTS.toString() + '. Some features may not work with the provided component.');\n return;\n }\n }\n \n private async updateAriaAttributes(): Promise<void> {\n if (isMutableAriaAttribute(this.spiedElement)) {\n const ariaLabelParts: string[] = [];\n if (isControlComponentWithLabel(this.spiedElement)) {\n const innerLabel = await this.spiedElement.getLabel();\n const combinedLabel = `${this.label || ''} ${innerLabel || ''}`.trim();\n if(combinedLabel) {\n ariaLabelParts.push(normalizeWhitespace(combinedLabel));\n }\n } else {\n if(this.label) {\n ariaLabelParts.push(normalizeWhitespace(this.label));\n }\n }\n\n if(this.description) {\n ariaLabelParts.push(normalizeWhitespace(this.description));\n }\n \n // Sur les autres DS, généralement seul l'erreur est affichée et pas avec la description\n if(this.isError) {\n this.spiedElement.setAriaAttribute('aria-invalid', 'true');\n if(this.error) {\n ariaLabelParts.push(normalizeWhitespace(this.error));\n }\n } else {\n this.spiedElement.setAriaAttribute('aria-invalid', 'false');\n }\n\n this.spiedElement.setAriaAttribute('aria-label', ariaLabelParts.length > 0 ? ariaLabelParts.join(' ') : null);\n }\n }\n \n private get label(): string | null {\n return this.el.querySelector('wcs-label')?.textContent || null;\n }\n \n private get description(): string | null {\n return this.el.querySelector('wcs-hint')?.textContent || null;\n }\n \n private get error(): string | null {\n return this.el.querySelector('wcs-error')?.textContent || null;\n }\n\n private updateLabelRequiredFlag(isRequired: boolean, label: Element) {\n if (isRequired && label) {\n label.setAttribute('required', 'true');\n } else if (!isRequired && label) {\n label.removeAttribute('required');\n }\n }\n\n disconnectedCallback() {\n this.observer?.disconnect();\n }\n\n render() {\n let classes = '';\n const isError = this.isError;\n\n if (this.hasSuffix) {\n classes += ' has-suffix';\n }\n if (this.hasPrefix) {\n classes += ' has-prefix';\n }\n return (\n <Host class={classes}>\n <slot name=\"label\"/>\n <div class=\"input-container\">\n <slot name=\"prefix\"/>\n <slot onSlotchange={() => this.onFormInputSlotChange()}/>\n <slot name=\"suffix\"/>\n </div>\n {\n isError ? (<slot name=\"error\"/>) : ''\n }\n <slot name=\"messages\"/>\n </Host>\n );\n }\n\n private onFormInputSlotChange() {\n this.initSpiedElement();\n this.updateAriaAttributes()\n this.addRequiredMarkerToLabel();\n this.updateErrorStateOnInput(this.isError);\n }\n}\n"]}
|
|
@@ -21,7 +21,7 @@ export class Galactic {
|
|
|
21
21
|
this.show = false;
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
|
-
return (h(Host, { key: '
|
|
24
|
+
return (h(Host, { key: 'bcede9aa03d2014887eeaa4d5728d57c32a69de2' }, h("div", { key: '2d031655b20b592b77e2227a195f15535071c069', class: "container" }, h("div", { key: '1d3a345c56925946f5b39ad9edaad7ee927343cc', class: "logo-container" }, h("img", { key: '3f7e9a0a7df3a954d21e328da562189771baf8a8', src: SNCF_BASE64_SVG_LOGO, id: "sncf-logo", alt: "SNCF" }), h("span", { key: '68c00801e7f2564930d6a5f77fc6f45511a321cf' }, this.text)), h("div", { key: '3724b08dca457a9be21ecb84925ed3fea4e49f95', class: "actions-container" }, h("slot", { key: '572f4ca9036c737a579f2c58ec113cada4dd421c' })))));
|
|
25
25
|
}
|
|
26
26
|
static get is() { return "wcs-galactic"; }
|
|
27
27
|
static get encapsulation() { return "shadow"; }
|
|
@@ -71,9 +71,9 @@ export class Galactic {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
render() {
|
|
74
|
-
return (h(Host, { key: '
|
|
74
|
+
return (h(Host, { key: 'bc460c17b222723b8cc037042cc758f8ca0e50ec' }, h("span", { key: 'd324ff624a9e5c9f6984134d4091986cac11f18b' }, this.text), h("button", Object.assign({ key: '7b0160174a249b30e082b9b2a77aca334ee6256a', "aria-haspopup": "true", "aria-controls": "menu", ref: el => {
|
|
75
75
|
this.menuButton = el;
|
|
76
|
-
}, "aria-expanded": this.showPopoverMenu ? "true" : "false" }, this.inheritedAttributes, { onClick: _ => this.toggleMenu() }), h("wcs-mat-icon", { key: '
|
|
76
|
+
}, "aria-expanded": this.showPopoverMenu ? "true" : "false" }, this.inheritedAttributes, { onClick: _ => this.toggleMenu() }), h("wcs-mat-icon", { key: '96b20053845f5490791ea278c2444392ba630600', id: "toggle-menu-icon", icon: "more_horiz", size: "m" })), h("span", { key: '6f959f220edbf293fe6922f7aaeaab0f213bf736', id: "menu", role: "menu", "data-show": this.showPopoverMenu }, h("div", { key: '6a05e468d65252ecbb57b421a53be0a0a1974f98', id: "arrow", "data-popper-arrow": true }), h("slot", { key: 'c9398cbb856d836820ac1cddf3113710eeaff5fb' }))));
|
|
77
77
|
}
|
|
78
78
|
static get is() { return "wcs-galactic-menu"; }
|
|
79
79
|
static get encapsulation() { return "shadow"; }
|
|
@@ -89,6 +89,14 @@ export class Grid {
|
|
|
89
89
|
onBlur(event) {
|
|
90
90
|
this.wcsBlur.emit(event);
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Set focus on the first cell of the grid
|
|
94
|
+
*/
|
|
95
|
+
async focusFirstCell() {
|
|
96
|
+
var _a;
|
|
97
|
+
this.cursorPosition = { col: this.selectionConfig === 'none' ? 0 : 1, row: 1 };
|
|
98
|
+
(_a = this.getElementToFocusAtCursorPosition()) === null || _a === void 0 ? void 0 : _a.focus();
|
|
99
|
+
}
|
|
92
100
|
/**
|
|
93
101
|
* If selectionConfig is different from `none`, that means that an extra column for radio or checkbox is rendered
|
|
94
102
|
* in the table.
|
|
@@ -497,12 +505,12 @@ export class Grid {
|
|
|
497
505
|
}
|
|
498
506
|
render() {
|
|
499
507
|
var _a, _b, _c, _d;
|
|
500
|
-
return (h(Host, { key: '
|
|
508
|
+
return (h(Host, { key: '98d13e7497ec9d9ecd3e149b3f6986e16bc5cc2a' }, h("table", Object.assign({ key: 'a44825cf71ff284a5204e9d922c0eba2c2ca23f4', role: "grid", ref: (el) => (this.nativeTable = el), "aria-rowcount": !this.loading && ((_a = this.rows) === null || _a === void 0 ? void 0 : _a.length), "aria-colcount": !this.loading && this.totalDisplayedColumnCount() }, this.inheritedAttributes), h("thead", { key: '336578d350ae8082a19fa6798af35f2fdd015ff9' }, h("tr", { key: 'fdb38402ea5c58dd77dad7df2ef97d54c521123c', "aria-rowindex": "1" }, this.selectionConfig === 'none' ? ''
|
|
501
509
|
: h("th", { class: "wcs-grid-selection-column" }, this.selectionConfig === 'single' ? '' :
|
|
502
510
|
h("wcs-checkbox", { tabIndex: ((_b = this.cursorPosition) === null || _b === void 0 ? void 0 : _b.col) === 0
|
|
503
|
-
&& ((_c = this.cursorPosition) === null || _c === void 0 ? void 0 : _c.row) === 0 ? 0 : -1, part: "all-rows-checkbox", checked: this.allRowsAreSelected(), onWcsChange: this.selectAllRows.bind(this) })), h("slot", { key: '
|
|
511
|
+
&& ((_c = this.cursorPosition) === null || _c === void 0 ? void 0 : _c.row) === 0 ? 0 : -1, part: "all-rows-checkbox", checked: this.allRowsAreSelected(), onWcsChange: this.selectAllRows.bind(this) })), h("slot", { key: '2d68b72fac0251dab9f519cf84c25c96262c193b', name: "grid-column" }))), h("tbody", { key: '4156e796ac5a81170b5dba011159f8e6bb7a7e60' }, this.loading
|
|
504
512
|
? h("tr", { "aria-busy": "true" }, h("td", { colSpan: this.totalColumnCount(), class: "loading" }, h("wcs-spinner", null)))
|
|
505
|
-
: (_d = this.rows) === null || _d === void 0 ? void 0 : _d.filter(row => this.serverMode || !this.paginationEl || row.page === this.paginationEl.currentPage).map((row, index) => this.renderRow(row, index)))), h("slot", { key: '
|
|
513
|
+
: (_d = this.rows) === null || _d === void 0 ? void 0 : _d.filter(row => this.serverMode || !this.paginationEl || row.page === this.paginationEl.currentPage).map((row, index) => this.renderRow(row, index)))), h("slot", { key: 'c683eb883707ffbd1fed22d86ececb595f70c2c0', name: "grid-pagination" })));
|
|
506
514
|
}
|
|
507
515
|
/**
|
|
508
516
|
* Returns the row with all mapped cells inside.
|
|
@@ -560,7 +568,7 @@ export class Grid {
|
|
|
560
568
|
"text": "Manage sort and pagination with a backend server when set to `true`"
|
|
561
569
|
},
|
|
562
570
|
"attribute": "server-mode",
|
|
563
|
-
"reflect":
|
|
571
|
+
"reflect": true,
|
|
564
572
|
"defaultValue": "false"
|
|
565
573
|
},
|
|
566
574
|
"data": {
|
|
@@ -593,7 +601,7 @@ export class Grid {
|
|
|
593
601
|
"text": "Flag to display a spinner during data loading"
|
|
594
602
|
},
|
|
595
603
|
"attribute": "loading",
|
|
596
|
-
"reflect":
|
|
604
|
+
"reflect": true
|
|
597
605
|
},
|
|
598
606
|
"selectionConfig": {
|
|
599
607
|
"type": "string",
|
|
@@ -790,6 +798,23 @@ export class Grid {
|
|
|
790
798
|
}
|
|
791
799
|
static get methods() {
|
|
792
800
|
return {
|
|
801
|
+
"focusFirstCell": {
|
|
802
|
+
"complexType": {
|
|
803
|
+
"signature": "() => Promise<void>",
|
|
804
|
+
"parameters": [],
|
|
805
|
+
"references": {
|
|
806
|
+
"Promise": {
|
|
807
|
+
"location": "global",
|
|
808
|
+
"id": "global::Promise"
|
|
809
|
+
}
|
|
810
|
+
},
|
|
811
|
+
"return": "Promise<void>"
|
|
812
|
+
},
|
|
813
|
+
"docs": {
|
|
814
|
+
"text": "Set focus on the first cell of the grid",
|
|
815
|
+
"tags": []
|
|
816
|
+
}
|
|
817
|
+
},
|
|
793
818
|
"setAriaAttribute": {
|
|
794
819
|
"complexType": {
|
|
795
820
|
"signature": "(attr: AriaAttributeName, value: string | null | undefined) => Promise<void>",
|