wcs-core 3.0.0 → 4.0.1
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 +7 -0
- package/dist/cjs/{grid-pagination-ff65e0ff.js → grid-pagination-4b55c908.js} +1 -2
- package/dist/cjs/grid-pagination-4b55c908.js.map +1 -0
- package/dist/cjs/{helpers-11518d4f.js → helpers-4a14051a.js} +41 -1
- package/dist/cjs/helpers-4a14051a.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/wcs-action-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-app.cjs.entry.js +0 -1
- package/dist/cjs/wcs-app.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-button.cjs.entry.js +17 -3
- package/dist/cjs/wcs-button.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-checkbox.cjs.entry.js +0 -1
- package/dist/cjs/wcs-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-com-nav-category.cjs.entry.js +1 -1
- package/dist/cjs/wcs-com-nav-category.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-com-nav-submenu.cjs.entry.js +1 -1
- package/dist/cjs/wcs-com-nav-submenu.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-com-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-counter.cjs.entry.js +130 -0
- package/dist/cjs/wcs-counter.cjs.entry.js.map +1 -0
- package/dist/cjs/wcs-dropdown-item.cjs.entry.js +1 -1
- package/dist/cjs/wcs-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/wcs-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-editable-field.cjs.entry.js +16 -3
- package/dist/cjs/wcs-editable-field.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-error_2.cjs.entry.js +1 -1
- package/dist/cjs/wcs-error_2.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-field.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-footer.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-galactic-menu.cjs.entry.js +1 -1
- package/dist/cjs/wcs-galactic-menu.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-galactic.cjs.entry.js +0 -1
- package/dist/cjs/wcs-galactic.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-grid-column.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-grid-pagination.cjs.entry.js +1 -1
- package/dist/cjs/wcs-grid.cjs.entry.js +1 -1
- package/dist/cjs/wcs-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-header.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-hint.cjs.entry.js +3 -3
- package/dist/cjs/wcs-hint.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-horizontal-stepper.cjs.entry.js +0 -1
- package/dist/cjs/wcs-horizontal-stepper.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-input.cjs.entry.js +14 -4
- package/dist/cjs/wcs-input.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-native-select.cjs.entry.js +102 -0
- package/dist/cjs/wcs-native-select.cjs.entry.js.map +1 -0
- package/dist/cjs/wcs-nav-item.cjs.entry.js +1 -1
- package/dist/cjs/wcs-radio-group.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-radio.cjs.entry.js +3 -3
- package/dist/cjs/wcs-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-select_2.cjs.entry.js +229 -72
- package/dist/cjs/wcs-select_2.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-switch.cjs.entry.js +0 -1
- package/dist/cjs/wcs-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-tab.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-tabs.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-textarea.cjs.entry.js +5 -3
- package/dist/cjs/wcs-textarea.cjs.entry.js.map +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 +2 -0
- package/dist/collection/components/action-bar/action-bar.js.map +1 -1
- package/dist/collection/components/app/app.js +0 -1
- package/dist/collection/components/app/app.js.map +1 -1
- package/dist/collection/components/button/button-interface.js +5 -1
- package/dist/collection/components/button/button-interface.js.map +1 -1
- package/dist/collection/components/button/button.css +28 -20
- package/dist/collection/components/button/button.js +54 -5
- package/dist/collection/components/button/button.js.map +1 -1
- package/dist/collection/components/checkbox/checkbox.js +0 -1
- package/dist/collection/components/checkbox/checkbox.js.map +1 -1
- package/dist/collection/components/com-nav/com-nav.js.map +1 -1
- package/dist/collection/components/com-nav-category/com-nav-category.js.map +1 -1
- package/dist/collection/components/com-nav-submenu/com-nav-submenu.js.map +1 -1
- package/dist/collection/components/counter/counter-interface.js +6 -0
- package/dist/collection/components/counter/counter-interface.js.map +1 -0
- package/dist/collection/components/counter/counter.css +93 -0
- package/dist/collection/components/counter/counter.js +293 -0
- package/dist/collection/components/counter/counter.js.map +1 -0
- package/dist/collection/components/dropdown/dropdown.js +1 -1
- package/dist/collection/components/dropdown/dropdown.js.map +1 -1
- package/dist/collection/components/editable-field/editable-field-interface.js +5 -1
- package/dist/collection/components/editable-field/editable-field-interface.js.map +1 -1
- package/dist/collection/components/editable-field/editable-field.css +21 -6
- package/dist/collection/components/editable-field/editable-field.js +33 -2
- package/dist/collection/components/editable-field/editable-field.js.map +1 -1
- package/dist/collection/components/field/field.js +4 -0
- package/dist/collection/components/field/field.js.map +1 -1
- package/dist/collection/components/footer/footer.js +5 -0
- package/dist/collection/components/footer/footer.js.map +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 +0 -1
- package/dist/collection/components/galactic/galactic.js.map +1 -1
- package/dist/collection/components/galactic-menu/galactic-menu.js.map +1 -1
- package/dist/collection/components/grid/grid.js.map +1 -1
- package/dist/collection/components/grid-column/grid-column.js.map +1 -1
- package/dist/collection/components/grid-pagination/grid-pagination.js +0 -1
- package/dist/collection/components/grid-pagination/grid-pagination.js.map +1 -1
- package/dist/collection/components/header/header.js +5 -0
- package/dist/collection/components/header/header.js.map +1 -1
- package/dist/collection/components/hint/hint.js +2 -2
- package/dist/collection/components/hint/hint.js.map +1 -1
- package/dist/collection/components/horizontal-stepper/horizontal-stepper.js +0 -2
- package/dist/collection/components/horizontal-stepper/horizontal-stepper.js.map +1 -1
- package/dist/collection/components/input/input-interface.js +5 -1
- package/dist/collection/components/input/input-interface.js.map +1 -1
- package/dist/collection/components/input/input.css +21 -4
- package/dist/collection/components/input/input.js +30 -19
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/collection/components/native-select/native-select.component.js +153 -0
- package/dist/collection/components/native-select/native-select.component.js.map +1 -0
- package/dist/collection/components/native-select/native-select.css +78 -0
- package/dist/collection/components/radio/radio.component.js +1 -1
- package/dist/collection/components/radio/radio.component.js.map +1 -1
- package/dist/collection/components/radio/radio.css +15 -4
- package/dist/collection/components/radio-group/radio-group.js.map +1 -1
- package/dist/collection/components/select/select-interface.js +5 -1
- package/dist/collection/components/select/select-interface.js.map +1 -1
- package/dist/collection/components/select/select.css +41 -37
- package/dist/collection/components/select/select.js +233 -68
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/select-option/select-option.css +3 -0
- package/dist/collection/components/select-option/select-option.js +25 -3
- package/dist/collection/components/select-option/select-option.js.map +1 -1
- package/dist/collection/components/switch/switch.js +0 -1
- package/dist/collection/components/switch/switch.js.map +1 -1
- package/dist/collection/components/tab/tab.js.map +1 -1
- package/dist/collection/components/tabs/tabs.js.map +1 -1
- package/dist/collection/components/textarea/textarea.css +3 -1
- package/dist/collection/components/textarea/textarea.js +23 -1
- package/dist/collection/components/textarea/textarea.js.map +1 -1
- package/dist/collection/components/tooltip/tooltip.js.map +1 -1
- package/dist/collection/index.js +3 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/shared-types.js +2 -0
- package/dist/collection/shared-types.js.map +1 -0
- package/dist/collection/utils/helpers.js +30 -0
- package/dist/collection/utils/helpers.js.map +1 -1
- package/dist/esm/{grid-pagination-62f9fbbc.js → grid-pagination-41354861.js} +2 -3
- package/dist/esm/grid-pagination-41354861.js.map +1 -0
- package/dist/esm/{helpers-e9b73aad.js → helpers-1f7170dd.js} +32 -2
- package/dist/esm/helpers-1f7170dd.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/wcs-action-bar.entry.js.map +1 -1
- package/dist/esm/wcs-app.entry.js +1 -2
- package/dist/esm/wcs-app.entry.js.map +1 -1
- package/dist/esm/wcs-button.entry.js +17 -3
- package/dist/esm/wcs-button.entry.js.map +1 -1
- package/dist/esm/wcs-checkbox.entry.js +1 -2
- package/dist/esm/wcs-checkbox.entry.js.map +1 -1
- package/dist/esm/wcs-com-nav-category.entry.js +1 -1
- package/dist/esm/wcs-com-nav-category.entry.js.map +1 -1
- package/dist/esm/wcs-com-nav-submenu.entry.js +1 -1
- package/dist/esm/wcs-com-nav-submenu.entry.js.map +1 -1
- package/dist/esm/wcs-com-nav.entry.js.map +1 -1
- package/dist/esm/wcs-counter.entry.js +126 -0
- package/dist/esm/wcs-counter.entry.js.map +1 -0
- package/dist/esm/wcs-dropdown-item.entry.js +1 -1
- package/dist/esm/wcs-dropdown.entry.js +1 -1
- package/dist/esm/wcs-dropdown.entry.js.map +1 -1
- package/dist/esm/wcs-editable-field.entry.js +16 -3
- package/dist/esm/wcs-editable-field.entry.js.map +1 -1
- package/dist/esm/wcs-error_2.entry.js +1 -1
- package/dist/esm/wcs-error_2.entry.js.map +1 -1
- package/dist/esm/wcs-field.entry.js.map +1 -1
- package/dist/esm/wcs-footer.entry.js.map +1 -1
- package/dist/esm/wcs-galactic-menu.entry.js +1 -1
- package/dist/esm/wcs-galactic-menu.entry.js.map +1 -1
- package/dist/esm/wcs-galactic.entry.js +1 -2
- package/dist/esm/wcs-galactic.entry.js.map +1 -1
- package/dist/esm/wcs-grid-column.entry.js.map +1 -1
- package/dist/esm/wcs-grid-pagination.entry.js +1 -1
- package/dist/esm/wcs-grid.entry.js +1 -1
- package/dist/esm/wcs-grid.entry.js.map +1 -1
- package/dist/esm/wcs-header.entry.js.map +1 -1
- package/dist/esm/wcs-hint.entry.js +3 -3
- package/dist/esm/wcs-hint.entry.js.map +1 -1
- package/dist/esm/wcs-horizontal-stepper.entry.js +0 -1
- package/dist/esm/wcs-horizontal-stepper.entry.js.map +1 -1
- package/dist/esm/wcs-input.entry.js +14 -4
- package/dist/esm/wcs-input.entry.js.map +1 -1
- package/dist/esm/wcs-native-select.entry.js +98 -0
- package/dist/esm/wcs-native-select.entry.js.map +1 -0
- package/dist/esm/wcs-nav-item.entry.js +1 -1
- package/dist/esm/wcs-radio-group.entry.js.map +1 -1
- package/dist/esm/wcs-radio.entry.js +3 -3
- package/dist/esm/wcs-radio.entry.js.map +1 -1
- package/dist/esm/wcs-select_2.entry.js +229 -72
- package/dist/esm/wcs-select_2.entry.js.map +1 -1
- package/dist/esm/wcs-switch.entry.js +1 -2
- package/dist/esm/wcs-switch.entry.js.map +1 -1
- package/dist/esm/wcs-tab.entry.js.map +1 -1
- package/dist/esm/wcs-tabs.entry.js.map +1 -1
- package/dist/esm/wcs-textarea.entry.js +5 -3
- package/dist/esm/wcs-textarea.entry.js.map +1 -1
- package/dist/esm/wcs-tooltip.entry.js.map +1 -1
- package/dist/esm/wcs.js +1 -1
- package/dist/types/components/action-bar/action-bar.d.ts +2 -2
- package/dist/types/components/app/app.d.ts +0 -1
- package/dist/types/components/button/button-interface.d.ts +5 -1
- package/dist/types/components/button/button.d.ts +16 -7
- package/dist/types/components/checkbox/checkbox.d.ts +0 -1
- package/dist/types/components/com-nav/com-nav.d.ts +4 -4
- package/dist/types/components/com-nav-category/com-nav-category.d.ts +2 -2
- package/dist/types/components/com-nav-submenu/com-nav-submenu.d.ts +2 -2
- package/dist/types/components/counter/counter-interface.d.ts +7 -0
- package/dist/types/components/counter/counter.d.ts +67 -0
- package/dist/types/components/dropdown/dropdown.d.ts +2 -2
- package/dist/types/components/editable-field/editable-field-interface.d.ts +4 -0
- package/dist/types/components/editable-field/editable-field.d.ts +10 -13
- package/dist/types/components/field/field.d.ts +4 -0
- package/dist/types/components/footer/footer.d.ts +5 -0
- package/dist/types/components/form-field/form-field.d.ts +4 -4
- package/dist/types/components/galactic/galactic.d.ts +0 -1
- package/dist/types/components/galactic-menu/galactic-menu.d.ts +2 -2
- package/dist/types/components/grid/grid.d.ts +4 -4
- package/dist/types/components/grid-column/grid-column.d.ts +1 -1
- package/dist/types/components/grid-pagination/grid-pagination.d.ts +0 -1
- package/dist/types/components/header/header.d.ts +5 -0
- package/dist/types/components/hint/hint.d.ts +4 -1
- package/dist/types/components/horizontal-stepper/horizontal-stepper.d.ts +2 -4
- package/dist/types/components/input/input-interface.d.ts +4 -0
- package/dist/types/components/input/input.d.ts +8 -8
- package/dist/types/components/native-select/native-select.component.d.ts +56 -0
- package/dist/types/components/radio/radio.component.d.ts +1 -1
- package/dist/types/components/radio-group/radio-group.d.ts +1 -1
- package/dist/types/components/select/select-interface.d.ts +4 -0
- package/dist/types/components/select/select.d.ts +32 -20
- package/dist/types/components/select-option/select-option.d.ts +9 -3
- package/dist/types/components/switch/switch.d.ts +0 -1
- package/dist/types/components/tabs/tabs.d.ts +3 -3
- package/dist/types/components/textarea/textarea.d.ts +10 -2
- package/dist/types/components/tooltip/tooltip.d.ts +1 -2
- package/dist/types/components.d.ts +242 -22
- package/dist/types/index.d.ts +2 -0
- package/dist/types/shared-types.d.ts +10 -0
- package/dist/types/utils/helpers.d.ts +10 -0
- package/dist/wcs/p-029eb12a.entry.js +2 -0
- package/dist/wcs/p-029eb12a.entry.js.map +1 -0
- package/dist/wcs/p-069555a1.entry.js.map +1 -1
- package/dist/wcs/p-07b8cd36.entry.js.map +1 -1
- package/dist/wcs/p-12ac2547.js +2 -0
- package/dist/wcs/p-12ac2547.js.map +1 -0
- package/dist/wcs/p-1e43122f.entry.js.map +1 -1
- package/dist/wcs/p-26c4c983.entry.js +2 -0
- package/dist/wcs/p-26c4c983.entry.js.map +1 -0
- package/dist/wcs/p-26e7de5c.entry.js +16 -0
- package/dist/wcs/p-26e7de5c.entry.js.map +1 -0
- package/dist/wcs/p-31a8d23f.entry.js +2 -0
- package/dist/wcs/{p-d11c66d4.entry.js.map → p-31a8d23f.entry.js.map} +1 -1
- package/dist/wcs/p-463667c9.entry.js +2 -0
- package/dist/wcs/p-475ac7c5.js +2 -0
- package/dist/wcs/p-475ac7c5.js.map +1 -0
- package/dist/wcs/p-47d8ece5.entry.js.map +1 -1
- package/dist/wcs/p-4a9f8e94.entry.js.map +1 -1
- package/dist/wcs/p-4b2d8a6d.entry.js +2 -0
- package/dist/wcs/p-4b2d8a6d.entry.js.map +1 -0
- package/dist/wcs/{p-c7b42bae.entry.js → p-4b4d53e2.entry.js} +2 -2
- package/dist/wcs/p-50dce764.entry.js.map +1 -1
- package/dist/wcs/{p-8762cf93.entry.js → p-554ca93c.entry.js} +2 -2
- package/dist/wcs/p-627bbb6a.entry.js.map +1 -1
- package/dist/wcs/p-64dd7356.entry.js.map +1 -1
- package/dist/wcs/p-6acbf38a.entry.js +2 -0
- package/dist/wcs/{p-7d7472e2.entry.js.map → p-6acbf38a.entry.js.map} +1 -1
- package/dist/wcs/{p-6f921d57.entry.js → p-732b2faa.entry.js} +2 -2
- package/dist/wcs/p-732b2faa.entry.js.map +1 -0
- package/dist/wcs/{p-587fea23.entry.js → p-966a241e.entry.js} +2 -2
- package/dist/wcs/p-966a241e.entry.js.map +1 -0
- package/dist/wcs/p-9ecdeaf9.entry.js +2 -0
- package/dist/wcs/p-9ecdeaf9.entry.js.map +1 -0
- package/dist/wcs/p-a24fa4f4.entry.js +2 -0
- package/dist/wcs/p-a24fa4f4.entry.js.map +1 -0
- package/dist/wcs/p-a5cd4c07.entry.js +2 -0
- package/dist/wcs/{p-8bb19e58.entry.js.map → p-a5cd4c07.entry.js.map} +1 -1
- package/dist/wcs/p-b229a91c.entry.js +2 -0
- package/dist/wcs/p-b229a91c.entry.js.map +1 -0
- package/dist/wcs/{p-d998e112.entry.js → p-b6cd196d.entry.js} +2 -2
- package/dist/wcs/{p-d998e112.entry.js.map → p-b6cd196d.entry.js.map} +1 -1
- package/dist/wcs/p-b856f2f6.entry.js +2 -0
- package/dist/wcs/p-b856f2f6.entry.js.map +1 -0
- package/dist/wcs/{p-274232e6.entry.js → p-bcb8b731.entry.js} +2 -2
- package/dist/wcs/p-bcb8b731.entry.js.map +1 -0
- package/dist/wcs/p-d2da0c9f.entry.js +2 -0
- package/dist/wcs/p-d2da0c9f.entry.js.map +1 -0
- package/dist/wcs/p-d3f1cafe.entry.js.map +1 -1
- package/dist/wcs/p-d6b3f742.entry.js +2 -0
- package/dist/wcs/p-d6b3f742.entry.js.map +1 -0
- package/dist/wcs/p-ee453b6e.entry.js +2 -0
- package/dist/wcs/p-ee453b6e.entry.js.map +1 -0
- package/dist/wcs/p-f386bb8b.entry.js.map +1 -1
- package/dist/wcs/{p-e4dcd310.entry.js → p-f82e7a61.entry.js} +2 -2
- package/dist/wcs/{p-e4dcd310.entry.js.map → p-f82e7a61.entry.js.map} +1 -1
- package/dist/wcs/p-fc3f5b53.entry.js.map +1 -1
- package/dist/wcs/wcs.css +1 -1
- package/dist/wcs/wcs.esm.js +1 -1
- package/dist/wcs/wcs.esm.js.map +1 -1
- package/package.json +17 -12
- package/dist/cjs/grid-pagination-ff65e0ff.js.map +0 -1
- package/dist/cjs/helpers-11518d4f.js.map +0 -1
- package/dist/esm/grid-pagination-62f9fbbc.js.map +0 -1
- package/dist/esm/helpers-e9b73aad.js.map +0 -1
- package/dist/wcs/p-111ae1af.entry.js +0 -2
- package/dist/wcs/p-111ae1af.entry.js.map +0 -1
- package/dist/wcs/p-14e04d5e.entry.js +0 -2
- package/dist/wcs/p-14e04d5e.entry.js.map +0 -1
- package/dist/wcs/p-274232e6.entry.js.map +0 -1
- package/dist/wcs/p-2920b759.entry.js +0 -16
- package/dist/wcs/p-2920b759.entry.js.map +0 -1
- package/dist/wcs/p-3e370f48.entry.js +0 -2
- package/dist/wcs/p-49e66081.entry.js +0 -2
- package/dist/wcs/p-49e66081.entry.js.map +0 -1
- package/dist/wcs/p-504fb24e.entry.js +0 -2
- package/dist/wcs/p-504fb24e.entry.js.map +0 -1
- package/dist/wcs/p-5140269d.entry.js +0 -2
- package/dist/wcs/p-5140269d.entry.js.map +0 -1
- package/dist/wcs/p-587fea23.entry.js.map +0 -1
- package/dist/wcs/p-62db1219.js +0 -2
- package/dist/wcs/p-62db1219.js.map +0 -1
- package/dist/wcs/p-6f921d57.entry.js.map +0 -1
- package/dist/wcs/p-7d7472e2.entry.js +0 -2
- package/dist/wcs/p-89b3550b.entry.js +0 -2
- package/dist/wcs/p-89b3550b.entry.js.map +0 -1
- package/dist/wcs/p-8bb19e58.entry.js +0 -2
- package/dist/wcs/p-9157466f.entry.js +0 -2
- package/dist/wcs/p-9157466f.entry.js.map +0 -1
- package/dist/wcs/p-d11c66d4.entry.js +0 -2
- package/dist/wcs/p-d218509e.entry.js +0 -2
- package/dist/wcs/p-d218509e.entry.js.map +0 -1
- package/dist/wcs/p-dc57a5f7.js +0 -2
- package/dist/wcs/p-dc57a5f7.js.map +0 -1
- /package/dist/wcs/{p-3e370f48.entry.js.map → p-463667c9.entry.js.map} +0 -0
- /package/dist/wcs/{p-c7b42bae.entry.js.map → p-4b4d53e2.entry.js.map} +0 -0
- /package/dist/wcs/{p-8762cf93.entry.js.map → p-554ca93c.entry.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"wcs-input.entry.js","mappings":";;;AAAA,MAAM,QAAQ,GAAG,y+GAAy+G;;MCkB7+G,KAAK;;;;;;;IAEN,YAAO,GAAG,aAAa,QAAQ,EAAE,EAAE,CAAC;IACpC,qBAAgB,GAAG,KAAK,CAAC;IACzB,wBAAmB,GAAyB,EAAE,CAAC;IAC/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I,CAAC,WAAW,IAAI,EAAE,EACnC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,cAAc,GAAG,MAAM,GAAG,IAAI,CAAC,IAAI,EAC9C,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,SAAS,EAAE,IAAI,CAAC,SAAS,IACrB,IAAI,CAAC,mBAAmB,EAC9B,EACD,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,oBAAc,KAAK,EAAC,iBAAiB,EAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,EAAC,GAAG,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,uBAAuB,EAAE,GAAiB,IAAI,IAAI,EAC3K,IAAI,CAAC,WAAW,IAAI,YAAM,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,IAAE,IAAI,CAAC,WAAW,CAAQ,IAAI,IAAI,CACtF,EACT;GACL;;;;;;;;;AAGL,IAAI,QAAQ,GAAG,CAAC,CAAC;;;;;","names":[],"sources":["./src/components/input/input.scss?tag=wcs-input&encapsulation=shadow","./src/components/input/input.tsx"],"sourcesContent":["@import '../../style/focus-outline.scss';\n\n:host {\n --wcs-input-icon-color: var(--wcs-text-medium);\n --wcs-internal-input-border-radius-left: var(--wcs-input-border-radius-left, var(--wcs-border-radius));\n --wcs-internal-input-border-radius-right: var(--wcs-input-border-radius-right, var(--wcs-border-radius));\n --wcs-internal-input-border-width: 2px;\n display: flex;\n width: 100%;\n border-radius: var(--wcs-internal-input-border-radius-left) var(--wcs-internal-input-border-radius-right) var(--wcs-internal-input-border-radius-right) var(--wcs-internal-input-border-radius-left);\n background-color: var(--wcs-light);\n border: var(--wcs-internal-input-border-width) solid var(--wcs-light);\n background-clip: padding-box;\n\n ::placeholder {\n font-weight: 400;\n font-style: italic;\n }\n\n input {\n overflow: hidden;\n box-sizing: border-box;\n min-height: 24px;\n width: 100%;\n background-color: transparent;\n font-family: var(--wcs-font-sans-serif);\n color: var(--wcs-primary);\n font-weight: var(--wcs-font-weight-form-value) !important;\n border: none;\n // On divise --wcs-internal-input-border-width par deux car la valeur du padding est appliquée en haut et en bas\n padding: calc(calc(var(--wcs-padding) / 2) - calc(var(--wcs-internal-input-border-width) / 2)) calc(var(--wcs-padding) - var(--wcs-internal-input-border-width));\n font-size: 1rem;\n line-height: 1.5;\n }\n\n input:focus {\n box-shadow: none;\n outline: 0;\n }\n\n wcs-mat-icon {\n position: relative;\n margin-left: 8px;\n margin-right: -8px;\n }\n\n .toggle_password {\n cursor: pointer;\n margin-left: -8px;\n margin-right: 8px;\n }\n\n\n .prefix, .suffix {\n color: var(--wcs-white);\n display: flex;\n white-space: nowrap;\n align-items: center;\n padding: 0 calc(var(--wcs-padding) / 2);\n font-weight: var(--wcs-font-weight-form-value) !important;\n background-color: var(--wcs-text-disabled);\n }\n\n .prefix {\n border-radius: var(--wcs-internal-input-border-radius-left) 0 0 var(--wcs-internal-input-border-radius-left);\n margin: calc(-1 * var(--wcs-internal-input-border-width)) 0 calc(-1 * var(--wcs-internal-input-border-width)) calc(-1 * var(--wcs-internal-input-border-width));\n border-left: solid var(--wcs-internal-input-border-width) transparent;\n border-top: solid var(--wcs-internal-input-border-width) transparent;\n border-bottom: solid var(--wcs-internal-input-border-width) transparent;\n }\n\n .suffix {\n border-radius: 0 var(--wcs-internal-input-border-radius-right) var(--wcs-internal-input-border-radius-right) 0;\n margin: calc(-1 * var(--wcs-internal-input-border-width)) calc(-1 * var(--wcs-internal-input-border-width)) calc(-1 * var(--wcs-internal-input-border-width)) 0px;\n border-right: solid var(--wcs-internal-input-border-width) transparent;\n border-top: solid var(--wcs-internal-input-border-width) transparent;\n border-bottom: solid var(--wcs-internal-input-border-width) transparent;\n }\n}\n\n:host([state=error]) {\n border-color: var(--wcs-red) !important;\n}\n\n:host([data-has-prefix]) {\n input {\n padding-left: calc(var(--wcs-padding) / 2);\n }\n}\n\n:host([data-has-suffix]) {\n input {\n padding-left: calc(var(--wcs-padding) / 2);\n }\n}\n\n:host([disabled]) {\n input {\n color: var(--wcs-text-disabled);\n cursor: not-allowed;\n }\n\n .prefix, .suffix {\n color: var(--wcs-light);\n }\n}\n\n:host(:focus-within) {\n border: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n\n .prefix {\n border-left: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-top: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-bottom: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n }\n\n .suffix {\n border-right: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-top: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-bottom: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n }\n\n wcs-mat-icon {\n color: var(--wcs-primary);\n }\n}\n","import {\n Build, Component,\n ComponentInterface, Element, Event, EventEmitter, h, Host, Method, Prop,\n State, Watch\n} from '@stencil/core';\nimport { debounceEvent, findItemLabel, inheritAttributes } from '../../utils/helpers';\nimport {\n AutocompleteTypes, InputChangeEventDetail, TextFieldTypes\n} from './input-interface';\n\n/**\n * Mainly inspired from Ionic Input Component\n */\n@Component({\n tag: 'wcs-input',\n styleUrl: 'input.scss',\n shadow: {delegatesFocus: true},\n})\nexport class Input implements ComponentInterface {\n private nativeInput?: HTMLInputElement;\n private inputId = `wcs-input-${inputIds++}`;\n private didBlurAfterEdit = false;\n private inheritedAttributes: { [k: string]: any } = {};\n private iconPassword = \"visibility\";\n\n\n /**\n * This is required for a WebKit bug which requires us to\n * blur and focus an input to properly focus the input in\n * an item with delegatesFocus. It will no longer be needed\n * with iOS 14.\n *\n * @internal\n */\n @Prop() fireFocusEvents = true;\n\n @State() hasFocus = false;\n\n @State() passwordReveal = false;\n\n @Element() el!: HTMLElement;\n\n /**\n * If the value of the type attribute is `\"file\"`, then this attribute will indicate the types of files that the server accepts, otherwise it will be ignored. The value must be a comma-separated list of unique content type specifiers.\n */\n @Prop() accept?: string;\n\n /**\n * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.\n * Available options: `\"off\"`, `\"none\"`, `\"on\"`, `\"sentences\"`, `\"words\"`, `\"characters\"`.\n */\n @Prop() autocapitalize = 'off';\n\n /**\n * Indicates whether the value of the control can be automatically completed by the browser.\n */\n @Prop() autocomplete: AutocompleteTypes = 'off';\n\n /**\n * Whether auto correction should be enabled when the user is entering/editing the text value.\n */\n @Prop() autocorrect: 'on' | 'off' = 'off';\n\n /**\n * This Boolean attribute lets you specify that a form control should have input focus when the page loads.\n */\n @Prop() autofocus = false;\n\n /**\n * If `true`, a clear icon will appear in the input when there is a value. Clicking it clears the input.\n */\n @Prop() clearInput = false;\n\n /**\n * If `true`, the value will be cleared after focus upon edit. Defaults to `true` when `type` is `\"password\"`, `false` for all other types.\n */\n @Prop() clearOnEdit?: boolean;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger the `wcsChange` event after each keystroke. This also impacts form bindings such as `ngModel` or `v-model`.\n */\n @Prop() debounce = 0;\n\n /**\n * Prefix displayed before the text field contents. This is not included in the value.\n */\n @Prop() prefixLabel: string;\n\n /**\n * Suffix displayed after the text field contents. This is not included in the value.\n */\n @Prop() suffixLabel: string;\n\n @Watch('debounce')\n protected debounceChanged() {\n this.wcsChange = debounceEvent(this.wcsChange, this.debounce);\n }\n\n /**\n * If `true`, the user cannot interact with the input.\n */\n @Prop() disabled = false;\n\n /**\n * A hint to the browser for which enter key to display.\n * Possible values: `\"enter\"`, `\"done\"`, `\"go\"`, `\"next\"`,\n * `\"previous\"`, `\"search\"`, and `\"send\"`.\n */\n @Prop() enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';\n\n /**\n * Name of the material icon to add to the input\n */\n @Prop() icon: string;\n\n /**\n * A hint to the browser for which keyboard to display.\n * Possible values: `\"none\"`, `\"text\"`, `\"tel\"`, `\"url\"`,\n * `\"email\"`, `\"numeric\"`, `\"decimal\"`, and `\"search\"`.\n */\n @Prop() inputmode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\n /**\n * The maximum value, which must not be less than its minimum (min attribute) value.\n */\n @Prop() max?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the maximum number of characters that the user can enter.\n */\n @Prop() maxlength?: number;\n\n /**\n * The minimum value, which must not be greater than its maximum (max attribute) value.\n */\n @Prop() min?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the minimum number of characters that the user can enter.\n */\n @Prop() minlength?: number;\n\n /**\n * If `true`, the user can enter more than one value. This attribute applies when the type attribute is set to `\"email\"` or `\"file\"`, otherwise it is ignored.\n */\n @Prop() multiple?: boolean;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * A regular expression that the value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, `\"date\"`, or `\"password\"`, otherwise it is ignored. When the type attribute is `\"date\"`, `pattern` will only be used in browsers that do not support the `\"date\"` input type natively. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date for more information.\n */\n @Prop() pattern?: string;\n\n /**\n * Instructional text that shows before the input has a value.\n */\n @Prop() placeholder?: string | null;\n\n /**\n * If `true`, the user cannot modify the value.\n */\n @Prop() readonly = false;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * If `true`, the element will have its spelling and grammar checked.\n */\n @Prop() spellcheck = false;\n\n /**\n * Specifies the state of the input. By default the input is in an normal state but you can to set it to 'error' state if the data given by the user is not valid.\n */\n @Prop({reflect: true}) state: 'initial' | 'error' = 'initial';\n\n /**\n * Works with the min and max attributes to limit the increments at which a value can be set.\n * Possible values are: `\"any\"` or a positive floating point number.\n */\n @Prop() step?: string;\n\n /**\n * The initial size of the control. This value is in pixels unless the value of the type attribute is `\"text\"` or `\"password\"`, in which case it is an integer number of characters. This attribute applies only when the `type` attribute is set to `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, or `\"password\"`, otherwise it is ignored.\n */\n @Prop() size?: number;\n\n /**\n * The type of control to display. The default type is text.\n */\n @Prop() type: TextFieldTypes = 'text';\n\n /**\n * The value of the input.\n */\n @Prop({mutable: true}) value?: string | number | null = '';\n\n /**\n * Emitted when a keyboard input occurred.\n */\n @Event() wcsInput!: EventEmitter<KeyboardEvent>;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() wcsChange!: EventEmitter<InputChangeEventDetail>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() wcsBlur!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() wcsFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n this.wcsChange.emit({value: this.value?.toString()});\n }\n\n componentWillLoad() {\n this.inheritedAttributes = inheritAttributes(this.el, ['aria-label', 'tabindex', 'title']);\n }\n\n connectedCallback() {\n this.debounceChanged();\n if (Build.isBrowser) {\n document.dispatchEvent(new CustomEvent('wcsInputDidLoad', {\n detail: this.el\n }));\n }\n }\n\n disconnectedCallback() {\n if (Build.isBrowser) {\n document.dispatchEvent(new CustomEvent('wcsInputDidUnload', {\n detail: this.el\n }));\n }\n }\n\n /**\n * @deprecated use the native focus method instead\n *\n * Sets focus on the native `input` in `wcs-input`. Use this method instead of the global\n * `input.focus()`.\n */\n @Method()\n async setFocus() {\n if (this.nativeInput) {\n this.nativeInput.focus();\n }\n }\n\n /**\n * Sets blur on the native `input` in `wcs-input`. Use this method instead of the global\n * `input.blur()`.\n * @internal\n */\n @Method()\n async setBlur() {\n if (this.nativeInput) {\n this.nativeInput.blur();\n }\n }\n\n /**\n * Returns the native `<input>` element used under the hood.\n */\n @Method()\n getInputElement(): Promise<HTMLInputElement> {\n return Promise.resolve(this.nativeInput!);\n }\n\n private shouldClearOnEdit() {\n const {type, clearOnEdit} = this;\n return (clearOnEdit === undefined)\n ? type === 'password'\n : clearOnEdit;\n }\n\n private getValue(): string {\n return typeof this.value === 'number' ? this.value.toString() :\n (this.value || '').toString();\n }\n\n private onInput = (ev: Event) => {\n const input = ev.target as HTMLInputElement | null;\n if (input) {\n this.value = input.value || '';\n }\n this.wcsInput.emit(ev as KeyboardEvent);\n }\n\n private onBlur = (ev: FocusEvent) => {\n this.hasFocus = false;\n this.focusChanged();\n\n if (this.fireFocusEvents) {\n this.wcsBlur.emit(ev);\n }\n }\n\n private onFocus = (ev: FocusEvent) => {\n this.hasFocus = true;\n this.focusChanged();\n\n if (this.fireFocusEvents) {\n this.wcsFocus.emit(ev);\n }\n }\n\n private onKeydown = (ev: KeyboardEvent) => {\n if (this.shouldClearOnEdit()) {\n // Did the input value change after it was blurred and edited?\n // Do not clear if user is hitting Enter to submit form\n if (this.didBlurAfterEdit && this.hasValue() && ev.key !== 'Enter') {\n // Clear the input\n this.clearTextInput();\n }\n\n // Reset the flag\n this.didBlurAfterEdit = false;\n }\n }\n\n private clearTextInput = (ev?: Event) => {\n if (this.clearInput && !this.readonly && !this.disabled && ev) {\n ev.preventDefault();\n ev.stopPropagation();\n\n // Attempt to focus input again after pressing clear button\n this.setFocus();\n }\n\n this.value = '';\n\n /**\n * This is needed for clearOnEdit\n * Otherwise the value will not be cleared\n * if user is inside the input\n */\n if (this.nativeInput) {\n this.nativeInput.value = '';\n }\n }\n\n private focusChanged() {\n // If clearOnEdit is enabled and the input blurred but has a value, set a flag\n if (!this.hasFocus && this.shouldClearOnEdit() && this.hasValue()) {\n this.didBlurAfterEdit = true;\n }\n }\n\n private hasValue(): boolean {\n return this.getValue().length > 0;\n }\n\n private passwordRevealIconClick(): void {\n this.passwordReveal = !this.passwordReveal;\n }\n\n @Watch('passwordReveal')\n onPasswordRevealChange(): void {\n this.iconPassword = this.passwordReveal ? 'visibility_off' : 'visibility';\n }\n\n render() {\n const value = this.getValue();\n const labelId = this.inputId + '-lbl';\n const label = findItemLabel(this.el);\n if (label) {\n label.id = labelId;\n }\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n data-has-prefix={!!this.prefixLabel}\n data-has-suffix={!!this.suffixLabel}\n >\n {this.prefixLabel ? (<span class=\"prefix\" part=\"prefix\">{this.prefixLabel}</span>) : null}\n {this.icon ? (<wcs-mat-icon icon={this.icon} size=\"m\"></wcs-mat-icon>) : null}\n <input\n class=\"native-input\"\n ref={input => this.nativeInput = input}\n aria-labelledby={label ? labelId : null}\n disabled={this.disabled}\n accept={this.accept}\n autoCapitalize={this.autocapitalize}\n autoComplete={this.autocomplete}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n enterKeyHint={this.enterkeyhint}\n inputMode={this.inputmode}\n min={this.min}\n max={this.max}\n minLength={this.minlength}\n maxLength={this.maxlength}\n multiple={this.multiple}\n name={this.name}\n pattern={this.pattern}\n placeholder={this.placeholder || ''}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n step={this.step}\n size={this.size}\n type={this.passwordReveal ? 'text' : this.type}\n value={value}\n onInput={this.onInput}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n onKeyDown={this.onKeydown}\n {...this.inheritedAttributes}\n />\n {this.type === \"password\" ? (<wcs-mat-icon class=\"toggle_password\" icon={this.iconPassword} size=\"m\" onClick={() => this.passwordRevealIconClick()}></wcs-mat-icon>) : null}\n {this.suffixLabel ? (<span class=\"suffix\" part=\"suffix\">{this.suffixLabel}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AAC,YAAY,EAAE,IAAI,EAAC,GAAG,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,uBAAuB,EAAE,GAAiB,IAAI,IAAI,EAC3K,IAAI,CAAC,WAAW,IAAI,YAAM,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,IAAE,IAAI,CAAC,WAAW,CAAQ,IAAI,IAAI,CACtF,EACT;GACL;;;;;;;;;AAGL,IAAI,QAAQ,GAAG,CAAC,CAAC;;;;;","names":[],"sources":["./src/components/input/input-interface.ts","./src/components/input/input.scss?tag=wcs-input&encapsulation=shadow","./src/components/input/input.tsx"],"sourcesContent":["// From: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete\nimport { WcsSize } from '../../shared-types';\n\nexport type AutocompleteTypes = (\n | 'on' | 'off' | 'name' | 'honorific-prefix' | 'given-name' | 'additional-name' | 'family-name' | 'honorific-suffix'\n | 'nickname' | 'email' | 'username' | 'new-password' | 'current-password' | 'one-time-code' | 'organization-title' | 'organization'\n | 'street-address' | 'address-line1' | 'address-line2' | 'address-line3' | 'address-level4' | 'address-level3' | 'address-level2'\n | 'address-level1' | 'country' | 'country-name' | 'postal-code' | 'cc-name' | 'cc-given-name' | 'cc-additional-name' | 'cc-family-name'\n | 'cc-family-name' | 'cc-number' | 'cc-exp' | 'cc-exp-month' | 'cc-exp-year' | 'cc-csc' | 'cc-type' | 'transaction-currency' | 'transaction-amount'\n | 'language' | 'bday' | 'bday-day' | 'bday-month' | 'bday-year' | 'sex' | 'tel' | 'tel-country-code' | 'tel-national' | 'tel-area-code' | 'tel-local'\n | 'tel-extension' | 'impp' | 'url' | 'photo');\n\nexport type TextFieldTypes = 'date' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'url' | 'time' | 'week' | 'month' | 'datetime-local' | 'file';\n\n\nexport const WcsInputSizeValues = ['s', 'm', 'l'] as const; // as const keyword is used to infer and preserve the exact literal values of an array or object.\n\nexport type WcsInputSize = Extract<WcsSize, typeof WcsInputSizeValues[number]>;\n\nexport function isWcsInputSize(size: string): size is WcsInputSize {\n // @ts-ignore : ignore size type, as it is checked with WcsInputSizeValues\n return WcsInputSizeValues.includes(size);\n}\n\nexport interface InputChangeEventDetail {\n value: string | undefined | null;\n}\n","@import '../../style/focus-outline.scss';\n\n:host {\n --wcs-input-icon-color: var(--wcs-text-medium);\n --wcs-internal-input-border-radius-left: var(--wcs-input-border-radius-left, var(--wcs-border-radius));\n --wcs-internal-input-border-radius-right: var(--wcs-input-border-radius-right, var(--wcs-border-radius));\n --wcs-internal-input-border-width: 2px;\n display: flex;\n width: 100%;\n height: var(--wcs-input-host-height);\n box-sizing: border-box;\n border-radius: var(--wcs-internal-input-border-radius-left) var(--wcs-internal-input-border-radius-right) var(--wcs-internal-input-border-radius-right) var(--wcs-internal-input-border-radius-left);\n background-color: var(--wcs-light);\n border: var(--wcs-internal-input-border-width) solid var(--wcs-light);\n background-clip: padding-box;\n\n ::placeholder {\n font-weight: 400;\n font-style: italic;\n }\n\n input {\n overflow: hidden;\n min-height: var(--wcs-size-xs);\n width: 100%;\n background-color: transparent;\n font-family: var(--wcs-font-sans-serif);\n color: var(--wcs-primary);\n font-weight: var(--wcs-font-weight-form-value) !important;\n border: none;\n padding: 0 calc(var(--wcs-padding) - var(--wcs-internal-input-border-width));\n font-size: var(--wcs-input-font-size, 1rem);\n line-height: 1.5;\n }\n\n input:focus {\n box-shadow: none;\n outline: 0;\n }\n\n wcs-mat-icon {\n position: relative;\n margin-left: 8px;\n margin-right: -8px;\n }\n\n .toggle_password {\n cursor: pointer;\n margin-left: -8px;\n margin-right: 8px;\n }\n\n\n .prefix, .suffix {\n color: var(--wcs-white);\n display: flex;\n white-space: nowrap;\n align-items: center;\n font-size: var(--wcs-input-font-size, 1rem);\n padding: 0 calc(var(--wcs-padding) / 2);\n font-weight: var(--wcs-font-weight-form-value) !important;\n background-color: var(--wcs-text-disabled);\n }\n\n .prefix {\n border-radius: var(--wcs-internal-input-border-radius-left) 0 0 var(--wcs-internal-input-border-radius-left);\n margin: calc(-1 * var(--wcs-internal-input-border-width)) 0 calc(-1 * var(--wcs-internal-input-border-width)) calc(-1 * var(--wcs-internal-input-border-width));\n border-left: solid var(--wcs-internal-input-border-width) transparent;\n border-top: solid var(--wcs-internal-input-border-width) transparent;\n border-bottom: solid var(--wcs-internal-input-border-width) transparent;\n }\n\n .suffix {\n border-radius: 0 var(--wcs-internal-input-border-radius-right) var(--wcs-internal-input-border-radius-right) 0;\n margin: calc(-1 * var(--wcs-internal-input-border-width)) calc(-1 * var(--wcs-internal-input-border-width)) calc(-1 * var(--wcs-internal-input-border-width)) 0px;\n border-right: solid var(--wcs-internal-input-border-width) transparent;\n border-top: solid var(--wcs-internal-input-border-width) transparent;\n border-bottom: solid var(--wcs-internal-input-border-width) transparent;\n }\n}\n\n:host([size=l]) {\n --wcs-input-host-height: var(--wcs-size-l);\n --wcs-input-font-size: 1.0625rem;\n}\n\n:host([size=m]) { // Default\n --wcs-input-host-height: var(--wcs-size-m);\n --wcs-input-font-size: 1rem;\n}\n\n:host([size=s]) {\n --wcs-input-host-height: var(--wcs-size-s);\n --wcs-input-font-size: 0.9375rem;\n}\n\n:host([state=error]) {\n border-color: var(--wcs-red) !important;\n}\n\n:host([data-has-prefix]) {\n input {\n padding-left: calc(var(--wcs-padding) / 2);\n }\n}\n\n:host([data-has-suffix]) {\n input {\n padding-left: calc(var(--wcs-padding) / 2);\n }\n}\n\n:host([disabled]) {\n input {\n color: var(--wcs-text-disabled);\n cursor: not-allowed;\n }\n\n .prefix, .suffix {\n color: var(--wcs-light);\n }\n}\n\n:host(:focus-within) {\n border: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n\n .prefix {\n border-left: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-top: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-bottom: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n }\n\n .suffix {\n border-right: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-top: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n border-bottom: dashed var(--wcs-internal-input-border-width) var(--wcs-primary);\n }\n\n wcs-mat-icon {\n color: var(--wcs-primary);\n }\n}\n","import {\n Build, Component,\n ComponentInterface, Element, Event, EventEmitter, h, Host, Method, Prop,\n State, Watch\n} from '@stencil/core';\nimport { debounceEvent, findItemLabel, inheritAttributes } from '../../utils/helpers';\nimport {\n AutocompleteTypes, InputChangeEventDetail, isWcsInputSize, TextFieldTypes, WcsInputSize, WcsInputSizeValues\n} from './input-interface';\n\n/**\n * Mainly inspired from Ionic Input Component\n */\n@Component({\n tag: 'wcs-input',\n styleUrl: 'input.scss',\n shadow: {delegatesFocus: true},\n})\nexport class Input implements ComponentInterface {\n private nativeInput?: HTMLInputElement;\n private inputId = `wcs-input-${inputIds++}`;\n private didBlurAfterEdit = false;\n private inheritedAttributes: { [k: string]: any } = {};\n private iconPassword = \"visibility\";\n\n\n /**\n * This is required for a WebKit bug which requires us to\n * blur and focus an input to properly focus the input in\n * an item with delegatesFocus. It will no longer be needed\n * with iOS 14.\n *\n * @internal\n */\n @Prop() fireFocusEvents = true;\n\n @State() private hasFocus = false;\n\n @State() private passwordReveal = false;\n\n @Element() private el!: HTMLElement;\n\n /**\n * If the value of the type attribute is `\"file\"`, then this attribute will indicate the types of files that the server accepts, otherwise it will be ignored. The value must be a comma-separated list of unique content type specifiers.\n */\n @Prop() accept?: string;\n\n /**\n * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.\n * Available options: `\"off\"`, `\"none\"`, `\"on\"`, `\"sentences\"`, `\"words\"`, `\"characters\"`.\n */\n @Prop() autocapitalize = 'off';\n\n /**\n * Indicates whether the value of the control can be automatically completed by the browser.\n */\n @Prop() autocomplete: AutocompleteTypes = 'off';\n\n /**\n * Whether auto correction should be enabled when the user is entering/editing the text value.\n */\n @Prop() autocorrect: 'on' | 'off' = 'off';\n\n /**\n * This Boolean attribute lets you specify that a form control should have input focus when the page loads.\n */\n @Prop() autofocus = false;\n\n /**\n * If `true`, a clear icon will appear in the input when there is a value. Clicking it clears the input.\n */\n @Prop() clearInput = false;\n\n /**\n * If `true`, the value will be cleared after focus upon edit. Defaults to `true` when `type` is `\"password\"`, `false` for all other types.\n */\n @Prop() clearOnEdit?: boolean;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger the `wcsChange` event after each keystroke. This also impacts form bindings such as `ngModel` or `v-model`.\n */\n @Prop() debounce = 0;\n\n /**\n * Prefix displayed before the text field contents. This is not included in the value.\n */\n @Prop() prefixLabel: string;\n\n /**\n * Suffix displayed after the text field contents. This is not included in the value.\n */\n @Prop() suffixLabel: string;\n\n @Watch('debounce')\n protected debounceChanged() {\n this.wcsChange = debounceEvent(this.wcsChange, this.debounce);\n }\n\n /**\n * If `true`, the user cannot interact with the input.\n */\n @Prop() disabled = false;\n\n /**\n * A hint to the browser for which enter key to display.\n * Possible values: `\"enter\"`, `\"done\"`, `\"go\"`, `\"next\"`,\n * `\"previous\"`, `\"search\"`, and `\"send\"`.\n */\n @Prop() enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';\n\n /**\n * Specify the size (height) of the input.\n */\n @Prop({reflect: true}) size: WcsInputSize = 'm';\n\n /**\n * Name of the material icon to add to the input\n */\n @Prop() icon: string;\n\n /**\n * A hint to the browser for which keyboard to display.\n * Possible values: `\"none\"`, `\"text\"`, `\"tel\"`, `\"url\"`,\n * `\"email\"`, `\"numeric\"`, `\"decimal\"`, and `\"search\"`.\n */\n @Prop() inputmode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\n /**\n * The maximum value, which must not be less than its minimum (min attribute) value.\n */\n @Prop() max?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the maximum number of characters that the user can enter.\n */\n @Prop() maxlength?: number;\n\n /**\n * The minimum value, which must not be greater than its maximum (max attribute) value.\n */\n @Prop() min?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the minimum number of characters that the user can enter.\n */\n @Prop() minlength?: number;\n\n /**\n * If `true`, the user can enter more than one value. This attribute applies when the type attribute is set to `\"email\"` or `\"file\"`, otherwise it is ignored.\n */\n @Prop() multiple?: boolean;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * A regular expression that the value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, `\"date\"`, or `\"password\"`, otherwise it is ignored. When the type attribute is `\"date\"`, `pattern` will only be used in browsers that do not support the `\"date\"` input type natively. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date for more information.\n */\n @Prop() pattern?: string;\n\n /**\n * Instructional text that shows before the input has a value.\n */\n @Prop() placeholder?: string | null;\n\n /**\n * If `true`, the user cannot modify the value.\n */\n @Prop() readonly = false;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * If `true`, the element will have its spelling and grammar checked.\n */\n @Prop() spellcheck = false;\n\n /**\n * Specifies the state of the input. By default the input is in an normal state but you can to set it to 'error' state if the data given by the user is not valid.\n */\n @Prop({reflect: true}) state: 'initial' | 'error' = 'initial';\n\n /**\n * Works with the min and max attributes to limit the increments at which a value can be set.\n * Possible values are: `\"any\"` or a positive floating point number.\n */\n @Prop() step?: string;\n\n /**\n * The type of control to display. The default type is text.\n */\n @Prop() type: TextFieldTypes = 'text';\n\n /**\n * The value of the input.\n */\n @Prop({mutable: true}) value?: string | number | null = '';\n\n /**\n * Emitted when a keyboard input occurred.\n */\n @Event() wcsInput!: EventEmitter<KeyboardEvent>;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() wcsChange!: EventEmitter<InputChangeEventDetail>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() wcsBlur!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() wcsFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n this.wcsChange.emit({value: this.value?.toString()});\n }\n\n componentWillLoad() {\n this.inheritedAttributes = inheritAttributes(this.el, ['aria-label', 'tabindex', 'title']);\n\n if (!isWcsInputSize(this.size)) {\n console.error(`Invalid size value for wcs-input : \"${this.size}\". Must be one of \"${WcsInputSizeValues.join(', ')}\"`);\n this.size = \"m\"; // Default fallback value\n }\n }\n\n connectedCallback() {\n this.debounceChanged();\n if (Build.isBrowser) {\n document.dispatchEvent(new CustomEvent('wcsInputDidLoad', {\n detail: this.el\n }));\n }\n }\n\n disconnectedCallback() {\n if (Build.isBrowser) {\n document.dispatchEvent(new CustomEvent('wcsInputDidUnload', {\n detail: this.el\n }));\n }\n }\n\n /**\n * @deprecated use the native focus method instead\n *\n * Sets focus on the native `input` in `wcs-input`. Use this method instead of the global\n * `input.focus()`.\n */\n @Method()\n async setFocus() {\n if (this.nativeInput) {\n this.nativeInput.focus();\n }\n }\n\n /**\n * Sets blur on the native `input` in `wcs-input`. Use this method instead of the global\n * `input.blur()`.\n * @internal\n */\n @Method()\n async setBlur() {\n if (this.nativeInput) {\n this.nativeInput.blur();\n }\n }\n\n /**\n * Returns the native `<input>` element used under the hood.\n */\n @Method()\n getInputElement(): Promise<HTMLInputElement> {\n return Promise.resolve(this.nativeInput!);\n }\n\n private shouldClearOnEdit() {\n const {type, clearOnEdit} = this;\n return (clearOnEdit === undefined)\n ? type === 'password'\n : clearOnEdit;\n }\n\n private getValue(): string {\n return typeof this.value === 'number' ? this.value.toString() :\n (this.value || '').toString();\n }\n\n private onInput = (ev: Event) => {\n const input = ev.target as HTMLInputElement | null;\n if (input) {\n this.value = input.value || '';\n }\n this.wcsInput.emit(ev as KeyboardEvent);\n }\n\n private onBlur = (ev: FocusEvent) => {\n this.hasFocus = false;\n this.focusChanged();\n\n if (this.fireFocusEvents) {\n this.wcsBlur.emit(ev);\n }\n }\n\n private onFocus = (ev: FocusEvent) => {\n this.hasFocus = true;\n this.focusChanged();\n\n if (this.fireFocusEvents) {\n this.wcsFocus.emit(ev);\n }\n }\n\n private onKeydown = (ev: KeyboardEvent) => {\n if (this.shouldClearOnEdit()) {\n // Did the input value change after it was blurred and edited?\n // Do not clear if user is hitting Enter to submit form\n if (this.didBlurAfterEdit && this.hasValue() && ev.key !== 'Enter') {\n // Clear the input\n this.clearTextInput();\n }\n\n // Reset the flag\n this.didBlurAfterEdit = false;\n }\n }\n\n private clearTextInput = (ev?: Event) => {\n if (this.clearInput && !this.readonly && !this.disabled && ev) {\n ev.preventDefault();\n ev.stopPropagation();\n\n // Attempt to focus input again after pressing clear button\n this.setFocus();\n }\n\n this.value = '';\n\n /**\n * This is needed for clearOnEdit\n * Otherwise the value will not be cleared\n * if user is inside the input\n */\n if (this.nativeInput) {\n this.nativeInput.value = '';\n }\n }\n\n private focusChanged() {\n // If clearOnEdit is enabled and the input blurred but has a value, set a flag\n if (!this.hasFocus && this.shouldClearOnEdit() && this.hasValue()) {\n this.didBlurAfterEdit = true;\n }\n }\n\n private hasValue(): boolean {\n return this.getValue().length > 0;\n }\n\n private passwordRevealIconClick(): void {\n this.passwordReveal = !this.passwordReveal;\n }\n\n @Watch('passwordReveal')\n onPasswordRevealChange(): void {\n this.iconPassword = this.passwordReveal ? 'visibility_off' : 'visibility';\n }\n\n render() {\n const value = this.getValue();\n const labelId = this.inputId + '-lbl';\n const label = findItemLabel(this.el);\n if (label) {\n label.id = labelId;\n }\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n data-has-prefix={!!this.prefixLabel}\n data-has-suffix={!!this.suffixLabel}\n >\n {this.prefixLabel ? (<span class=\"prefix\" part=\"prefix\">{this.prefixLabel}</span>) : null}\n {this.icon ? (<wcs-mat-icon icon={this.icon} size=\"m\"></wcs-mat-icon>) : null}\n <input\n class=\"native-input\"\n ref={input => this.nativeInput = input}\n aria-labelledby={label ? labelId : null}\n disabled={this.disabled}\n accept={this.accept}\n autoCapitalize={this.autocapitalize}\n autoComplete={this.autocomplete}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n enterKeyHint={this.enterkeyhint}\n inputMode={this.inputmode}\n min={this.min}\n max={this.max}\n minLength={this.minlength}\n maxLength={this.maxlength}\n multiple={this.multiple}\n name={this.name}\n pattern={this.pattern}\n placeholder={this.placeholder || ''}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n step={this.step}\n type={this.passwordReveal ? 'text' : this.type}\n value={value}\n onInput={this.onInput}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n onKeyDown={this.onKeydown}\n {...this.inheritedAttributes}\n />\n {this.type === \"password\" ? (<wcs-mat-icon class=\"toggle_password\" icon={this.iconPassword} size=\"m\" onClick={() => this.passwordRevealIconClick()}></wcs-mat-icon>) : null}\n {this.suffixLabel ? (<span class=\"suffix\" part=\"suffix\">{this.suffixLabel}</span>) : null}\n </Host>\n );\n }\n}\n\nlet inputIds = 0;\n"],"version":3}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement } from './index-dc4d96d4.js';
|
|
2
|
+
import { S as SelectArrow } from './select-arrow-81d069f7.js';
|
|
3
|
+
|
|
4
|
+
const nativeSelectCss = ":host{width:100%;box-sizing:border-box}::slotted(select){box-sizing:border-box;-moz-appearance:none !important;-webkit-appearance:none !important;appearance:none !important;--wcs-select-native-ligther-percentage:40;--wcs-select-native-border-radius:var(--wcs-border-radius);--wcs-select-native-background-color:var(--wcs-light);--wcs-select-native-placeholder-color:var(--wcs-text-medium);--wcs-select-native-value-color:var(--wcs-primary);--wcs-select-native-border-color:transparent;--wcs-select-native-overlay-max-height:360px;--wcs-select-native-border-width:2px;background-color:var(--wcs-select-native-background-color);color:var(--wcs-select-native-color);border-radius:var(--wcs-border-radius);border:none;outline:none;user-select:none;cursor:pointer;line-height:1.5;font-size:1rem;width:100%;padding-right:calc(var(--wcs-base-margin) * 2);padding-left:calc(var(--wcs-base-margin) * 2)}::slotted(select:disabled){cursor:not-allowed;color:var(--wcs-text-disabled)}:host([data-disabled]) .select-wrapper .arrow-container .arrow{fill:var(--wcs-text-medium)}:host([data-size=m]) ::slotted(select){height:var(--wcs-size-m)}:host([data-size=l]) ::slotted(select){height:var(--wcs-size-l)}::slotted(select:focus){background-clip:padding-box;box-shadow:inset 0 0 0 var(--wcs-select-native-border-width) var(--wcs-blue);background-color:var(--wcs-white)}.select-wrapper{position:relative}svg{flex-shrink:0}.arrow{fill:var(--wcs-primary)}.arrow-container{pointer-events:none;display:flex;align-items:center;vertical-align:center;position:absolute;top:0;bottom:0;right:calc(var(--wcs-padding) - 1px);margin:auto 0}";
|
|
5
|
+
|
|
6
|
+
const NativeSelect = class {
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
this.SLOTTED_SELECT_TRACKED_ATTRIBUTES_LIST = ['disabled'];
|
|
10
|
+
this.size = 'm';
|
|
11
|
+
this.expanded = false;
|
|
12
|
+
this.disabled = undefined;
|
|
13
|
+
}
|
|
14
|
+
componentWillLoad() {
|
|
15
|
+
this.selectElement = this.el.querySelector('select');
|
|
16
|
+
if (!this.selectElement)
|
|
17
|
+
throw new Error("wcs-native-select must be used with a native slotted select, please refer to the documentation.");
|
|
18
|
+
this.onSelectedOptionChange();
|
|
19
|
+
/**
|
|
20
|
+
* We use an event listener to apply the default style to the select when user chose an active option
|
|
21
|
+
*/
|
|
22
|
+
this.selectElement.addEventListener('change', () => {
|
|
23
|
+
this.onSelectedOptionChange();
|
|
24
|
+
});
|
|
25
|
+
this.observer = new MutationObserver(mutations => {
|
|
26
|
+
const hasSpiedAttrMutation = mutations.filter(m => this.SLOTTED_SELECT_TRACKED_ATTRIBUTES_LIST.includes(m.attributeName)).length > 0;
|
|
27
|
+
if (hasSpiedAttrMutation) {
|
|
28
|
+
this.updateHostAttributeWithSlottedSelect();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
this.updateHostAttributeWithSlottedSelect();
|
|
32
|
+
this.observer.observe(this.selectElement, { attributes: true });
|
|
33
|
+
}
|
|
34
|
+
onSelectedOptionChange() {
|
|
35
|
+
if (this.isPlaceholderOptionSelected()) {
|
|
36
|
+
this.applyPlaceholderStylesOnNativeSlottedSelectElement();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.applySelectedOptionStylesOnNativeSlottedSelectElement();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
isPlaceholderOptionSelected() {
|
|
43
|
+
var _a;
|
|
44
|
+
return ((_a = Array.from(this.selectElement.options).filter(o => o.selected)[0]) === null || _a === void 0 ? void 0 : _a.disabled) == true;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* This method should always unset all styles modified by the `applyPlaceholderStylesOnNativeSlottedSelectElement()`
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
applySelectedOptionStylesOnNativeSlottedSelectElement() {
|
|
51
|
+
this.selectElement.style.color = "var(--wcs-blue)";
|
|
52
|
+
this.selectElement.style.fontStyle = 'normal';
|
|
53
|
+
this.selectElement.style.fontWeight = '500';
|
|
54
|
+
Array.from(this.selectElement.options).forEach(option => {
|
|
55
|
+
option.style.fontStyle = 'normal';
|
|
56
|
+
if (!option.disabled) {
|
|
57
|
+
option.style.color = "black";
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* This method apply styles when the placeholder is shown.
|
|
63
|
+
*
|
|
64
|
+
* We use javascript because we cannot achieve that behaviour in pure css when the native select is not required
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
applyPlaceholderStylesOnNativeSlottedSelectElement() {
|
|
68
|
+
this.selectElement.style.color = "var(--wcs-text-medium)";
|
|
69
|
+
this.selectElement.style.fontWeight = '400';
|
|
70
|
+
this.selectElement.style.fontStyle = 'italic';
|
|
71
|
+
Array.from(this.selectElement.options).forEach(option => {
|
|
72
|
+
option.style.fontStyle = 'normal';
|
|
73
|
+
if (!option.disabled) {
|
|
74
|
+
option.style.color = "black";
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
updateHostAttributeWithSlottedSelect() {
|
|
79
|
+
var _a;
|
|
80
|
+
this.disabled = (_a = this.selectElement) === null || _a === void 0 ? void 0 : _a.hasAttribute('disabled');
|
|
81
|
+
}
|
|
82
|
+
disconnectedCallback() {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
85
|
+
(_b = this.selectElement) === null || _b === void 0 ? void 0 : _b.removeEventListener("change", () => {
|
|
86
|
+
this.onSelectedOptionChange();
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
render() {
|
|
90
|
+
return (h(Host, { class: `${this.expanded ? 'expanded' : ''}`, "data-disabled": this.disabled, "data-size": this.size }, h("div", { class: "select-wrapper" }, h("slot", null), h("div", { class: "arrow-container" }, h(SelectArrow, { up: this.expanded })))));
|
|
91
|
+
}
|
|
92
|
+
get el() { return getElement(this); }
|
|
93
|
+
};
|
|
94
|
+
NativeSelect.style = nativeSelectCss;
|
|
95
|
+
|
|
96
|
+
export { NativeSelect as wcs_native_select };
|
|
97
|
+
|
|
98
|
+
//# sourceMappingURL=wcs-native-select.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"wcs-native-select.entry.js","mappings":";;;AAAA,MAAM,eAAe,GAAG,6kDAA6kD;;MC+BxlD,YAAY;;;IAoBJ,2CAAsC,GAAG,CAAC,UAAU,CAAC,CAAC;gBAXlB,GAAG;oBAInB,KAAK;;;EAS1C,iBAAiB;IACb,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC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C,QAAQ,GAAG,UAAU,GAAG,EAAE,EAAE,mBAAiB,IAAI,CAAC,QAAQ,eAAa,IAAI,CAAC,IAAI,IACjG,WAAK,KAAK,EAAC,gBAAgB,IACvB,eAAa,EACb,WAAK,KAAK,EAAC,iBAAiB,IACxB,EAAC,WAAW,IAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,GAAgB,CAC5C,CACJ,CACH,EACT;GACL;;;;;;;","names":[],"sources":["./src/components/native-select/native-select.scss?tag=wcs-native-select&encapsulation=shadow","./src/components/native-select/native-select.component.tsx"],"sourcesContent":["// TODO: voir pour mettre en commun avec le style du composant personnalisée\n@import '../../style/focus-outline.scss';\n\n:host {\n width: 100%;\n box-sizing: border-box;\n}\n\n::slotted(select) {\n box-sizing: border-box;\n -moz-appearance:none !important;\n -webkit-appearance: none !important;\n appearance: none !important;\n\n --wcs-select-native-ligther-percentage: 40;\n --wcs-select-native-border-radius: var(--wcs-border-radius);\n --wcs-select-native-background-color: var(--wcs-light);\n --wcs-select-native-placeholder-color: var(--wcs-text-medium);\n --wcs-select-native-value-color: var(--wcs-primary);\n --wcs-select-native-border-color: transparent;\n --wcs-select-native-overlay-max-height: 360px;\n --wcs-select-native-border-width: 2px;\n\n background-color: var(--wcs-select-native-background-color);\n\n color: var(--wcs-select-native-color);\n\n border-radius: var(--wcs-border-radius);\n border: none;\n\n outline: none;\n user-select: none;\n cursor: pointer;\n line-height: 1.5;\n font-size: 1rem;\n width: 100%;\n padding-right: calc(var(--wcs-base-margin) * 2);\n padding-left: calc(var(--wcs-base-margin) * 2);\n}\n\n::slotted(select:disabled) {\n cursor: not-allowed;\n color: var(--wcs-text-disabled);\n}\n\n:host([data-disabled]) {\n .select-wrapper {\n .arrow-container {\n .arrow {\n fill: var(--wcs-text-medium);\n }\n }\n }\n}\n\n:host([data-size=m]) {\n ::slotted(select) {\n height: var(--wcs-size-m);\n }\n}\n\n:host([data-size=l]) {\n ::slotted(select) {\n height: var(--wcs-size-l);\n }\n}\n\n::slotted(select:focus) {\n background-clip: padding-box;\n box-shadow: inset 0 0 0 var(--wcs-select-native-border-width) var(--wcs-blue);\n background-color: var(--wcs-white);\n}\n\n.select-wrapper {\n position: relative;\n}\n\n// So the arrow on the right doesn't shrink when text overflows.\nsvg {\n flex-shrink: 0;\n}\n\n.arrow {\n fill: var(--wcs-primary);\n}\n\n.arrow-container {\n pointer-events: none;\n display: flex;\n align-items: center;\n vertical-align: center;\n\n position: absolute;\n top: 0;\n bottom: 0;\n right: calc(var(--wcs-padding) - 1px);\n margin: auto 0;\n}\n","import { Component, h, ComponentInterface, State, Prop, Host, Element } from '@stencil/core';\nimport { SelectArrow } from '../select/select-arrow';\nimport { WcsSize } from \"../../shared-types\";\n\nexport type WcsNativeSelectSize = Extract<WcsSize, 'l' | 'm'>; // todo: move into common file with custom select\n\n\n\n/**\n * The `wcs-native-select` component is designed to accept a native <select> element as a slotted child. This choice\n * allows developers to bind the <select> element using the framework of their choice, without the need to re-expose all the\n * properties of the <select> and <option> elements in this component.\n *\n * The component wraps the native <select> element and provides custom styles and behavior, while preserving the native\n * functionality and accessibility.\n *\n * Example usage:\n *\n * <wcs-native-select>\n * <select>\n * <option value=\"option1\">Option 1</option>\n * <option value=\"option2\">Option 2</option>\n * <option value=\"option3\">Option 3</option>\n * </select>\n * </wcs-native-select>\n */\n@Component({\n tag: 'wcs-native-select',\n styleUrl: 'native-select.scss',\n shadow: true\n})\nexport class NativeSelect implements ComponentInterface {\n /**\n * The `size` property controls the size of the slotted `select` element by adjusting its padding.\n * There are two possible size options:\n * - 'm': medium size\n * - 'l': large size\n *\n * The default value is 'm'.\n */\n @Prop({ reflect: true }) size: WcsNativeSelectSize = 'm';\n\n @Element() private el!: HTMLWcsNativeSelectElement;\n\n @State() private expanded: boolean = false;\n @State() private disabled: boolean;\n\n private selectElement: HTMLSelectElement;\n private observer: MutationObserver;\n\n\n private readonly SLOTTED_SELECT_TRACKED_ATTRIBUTES_LIST = ['disabled'];\n\n componentWillLoad() {\n this.selectElement = this.el.querySelector('select');\n if (!this.selectElement) throw new Error(\"wcs-native-select must be used with a native slotted select, please refer to the documentation.\");\n\n this.onSelectedOptionChange();\n\n /**\n * We use an event listener to apply the default style to the select when user chose an active option\n */\n this.selectElement.addEventListener('change', () => {\n this.onSelectedOptionChange();\n });\n\n this.observer = new MutationObserver(mutations => {\n const hasSpiedAttrMutation = mutations.filter(m => this.SLOTTED_SELECT_TRACKED_ATTRIBUTES_LIST.includes(m.attributeName)).length > 0;\n if (hasSpiedAttrMutation) {\n this.updateHostAttributeWithSlottedSelect();\n }\n });\n this.updateHostAttributeWithSlottedSelect();\n this.observer.observe(this.selectElement, {attributes: true});\n }\n\n private onSelectedOptionChange(): void {\n if (this.isPlaceholderOptionSelected()) {\n this.applyPlaceholderStylesOnNativeSlottedSelectElement();\n } else {\n this.applySelectedOptionStylesOnNativeSlottedSelectElement();\n }\n }\n\n private isPlaceholderOptionSelected() {\n return Array.from(this.selectElement.options).filter(o => o.selected)[0]?.disabled == true;\n }\n\n /**\n * This method should always unset all styles modified by the `applyPlaceholderStylesOnNativeSlottedSelectElement()`\n * @private\n */\n private applySelectedOptionStylesOnNativeSlottedSelectElement() {\n this.selectElement.style.color = \"var(--wcs-blue)\";\n this.selectElement.style.fontStyle = 'normal';\n this.selectElement.style.fontWeight = '500';\n Array.from(this.selectElement.options).forEach(option => {\n option.style.fontStyle = 'normal';\n if (!option.disabled) {\n option.style.color = \"black\";\n }\n });\n }\n\n /**\n * This method apply styles when the placeholder is shown.\n *\n * We use javascript because we cannot achieve that behaviour in pure css when the native select is not required\n * @private\n */\n private applyPlaceholderStylesOnNativeSlottedSelectElement() {\n this.selectElement.style.color = \"var(--wcs-text-medium)\";\n this.selectElement.style.fontWeight = '400';\n this.selectElement.style.fontStyle = 'italic';\n Array.from(this.selectElement.options).forEach(option => {\n option.style.fontStyle = 'normal';\n if (!option.disabled) {\n option.style.color = \"black\";\n }\n });\n }\n\n private updateHostAttributeWithSlottedSelect() {\n this.disabled = this.selectElement?.hasAttribute('disabled');\n }\n\n disconnectedCallback() {\n this.observer?.disconnect();\n this.selectElement?.removeEventListener(\"change\", () => {\n this.onSelectedOptionChange();\n });\n }\n\n render() {\n return (\n <Host class={`${this.expanded ? 'expanded' : ''}`} data-disabled={this.disabled} data-size={this.size}>\n <div class=\"select-wrapper\">\n <slot></slot>\n <div class=\"arrow-container\">\n <SelectArrow up={this.expanded}></SelectArrow>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, g as getElement } from './index-dc4d96d4.js';
|
|
2
|
-
import { a as isEnterKey } from './helpers-
|
|
2
|
+
import { a as isEnterKey } from './helpers-1f7170dd.js';
|
|
3
3
|
|
|
4
4
|
const navItemCss = "wcs-nav-item{display:block;cursor:pointer}wcs-nav-item a{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;text-align:center;background-color:transparent;border:none;text-decoration:none;transition:color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;height:5rem;font-size:0.75rem;color:var(--wcs-contrast)}wcs-nav-item a:not(.active){border-bottom:1px solid rgba(255, 255, 255, 0.2)}@media (max-width: 1199px){wcs-nav-item a{display:flex;flex:1;height:3.25rem;font-size:0.625rem;color:var(--wcs-text-medium)}}wcs-nav-item a:focus{outline:none}@media (max-width: 1199px){wcs-nav-item:focus-within{outline:2px dashed var(--wcs-primary);outline-offset:1px;border-radius:0.1rem}}@media (min-width: 1200px){wcs-nav-item:focus-within{outline:2px dashed var(--wcs-white);outline-offset:-2px;border-radius:0.1rem}}wcs-nav-item i{margin-bottom:0.5rem;display:inline-block}@media (max-width: 1199px){wcs-nav-item i{margin-bottom:0.25rem;display:inline-block}}@media (min-width: 1200px){wcs-nav-item[slot=bottom] a{border-top:1px solid rgba(255, 255, 255, 0.2);border-bottom:none}}.wcs-nav-item-text{font-weight:500}.active,wcs-nav-item:hover,wcs-nav-item:focus-within{background-blend-mode:multiply;background-color:rgba(0, 0, 0, 0.15);}@media (max-width: 1199px){.active,wcs-nav-item:hover,wcs-nav-item:focus-within{background-color:unset}.active a,wcs-nav-item:hover a,wcs-nav-item:focus-within a{color:var(--wcs-primary)}}";
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"wcs-radio-group.entry.js","mappings":";;AAAA,MAAM,aAAa,GAAG,miBAAmiB;;MCoB5iB,UAAU;;;;;;gBAG2C,OAAO;;EAOrE,oBAAoB,CAAC,QAAa;IAC9B,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;GAC3C;EAED,gBAAgB;IACZ,IAAI,IAAI,CAAC,KAAK,EAAE;MACZ,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;KAC7C;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE;MACtD,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;QAC/B,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;OAC3B;KACJ;GACJ;EAED,IAAY,OAAO;IACf,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC;QAClB,IAAwC;QACxC,IAAI,KAAK,IAAI;UACT,IAAI,CAAC,gBAAgB,EAA2B;UAChD,EAAE,CAAC;GAChB;EAGD,qBAAqB,CAAC,KAAoC;IACtD,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACnD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;MAChB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;KAC5B,CAAC,CAAA;GACL;EAEO,kBAAkB,CAAC,KAAa,EAAE,aAAsB;IAC5D,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;MAC/B,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK,EAAE;QACxB,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;OACrC;WAAM;QACH,IAAI,aAAa,EAAE;UACf,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;SACtC;OACJ;KACJ;GACJ;EAED,MAAM;IACF,QACI,EAAC,IAAI,QACD,YAAM,IAAI,EAAC,QAAQ,GAAE,CAClB,EACT;GACL;;;;;;;;;;","names":[],"sources":["./src/components/radio-group/radio-group.scss?tag=wcs-radio-group&encapsulation=shadow","./src/components/radio-group/radio-group.tsx"],"sourcesContent":[":host {\n display: flex;\n}\n\n:host([mode=radio]) {\n flex-direction: column;\n\n ::slotted([slot=option]:first-child) {\n margin-top: 0;\n }\n\n ::slotted([slot=option]:last-child) {\n margin-bottom: 0;\n }\n\n ::slotted([slot=options]) {\n margin-top: calc(var(--wcs-base-margin) / 2);\n margin-bottom: calc(var(--wcs-base-margin) / 2);\n }\n}\n\n:host([mode=option]) {\n display: inline-flex;\n flex-direction: row;\n padding: calc(var(--wcs-base-margin) / 4);\n background-color: #4d4f53;\n border-radius: 0.6875rem;\n}\n\n:host([mode=horizontal]) {\n justify-content: space-between;\n}\n","import {\n Component,\n ComponentInterface,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n Watch\n} from '@stencil/core';\nimport { RadioGroupChangeEventDetail, RadioGroupMode } from './radio-group-interface';\nimport { RadioChosedEvent } from '../radio/radio-interface';\n\n@Component({\n tag: 'wcs-radio-group',\n styleUrl: 'radio-group.scss',\n shadow: true\n})\nexport class RadioGroup implements ComponentInterface {\n @Prop() value: any | any[] | undefined | null;\n @Prop({reflect: true, mutable: false}) name;\n @Prop({reflect: true, mutable: false}) mode: RadioGroupMode = 'radio';\n @Element() el!: HTMLWcsRadioGroupElement;\n\n /** Emitted when the value has changed. */\n @Event() wcsChange!: EventEmitter<RadioGroupChangeEventDetail>;\n\n @Watch('value')\n onValueChangeHandler(newValue: any) {\n this.updateOptionsState(newValue, true);\n }\n\n componentDidLoad() {\n if (this.value) {\n this.updateOptionsState(this.value, true);\n }\n if (this.mode === 'option' || this.mode === 'horizontal') {\n for (const option of this.options) {\n option.mode = this.mode;\n }\n }\n }\n\n private get options(): HTMLWcsRadioElement[] {\n const opts = this.el.querySelectorAll('wcs-radio');\n const slot = this.el.querySelector('slot');\n return opts.length !== 0\n ? opts as unknown as HTMLWcsRadioElement[]\n : slot !== null\n ? slot.assignedElements() as HTMLWcsRadioElement[]\n : [];\n }\n\n @Listen('wcsRadioClick')\n selectedOptionChanged(event: CustomEvent<RadioChosedEvent>) {\n this.updateOptionsState(event.detail.value, false);\n this.wcsChange.emit({\n value: event.detail.value\n })\n }\n\n private updateOptionsState(value: string, markAsChecked: boolean) {\n for (const option of this.options) {\n if (option.value !== value) {\n option.removeAttribute('checked');\n } else {\n if (markAsChecked) {\n option.setAttribute('checked', '');\n }\n }\n }\n }\n\n render() {\n return (\n <Host>\n <slot name=\"option\"/>\n </Host>\n );\n }\n\n}\n"],"version":3}
|
|
1
|
+
{"file":"wcs-radio-group.entry.js","mappings":";;AAAA,MAAM,aAAa,GAAG,miBAAmiB;;MCoB5iB,UAAU;;;;;;gBAG2C,OAAO;;EAOrE,oBAAoB,CAAC,QAAa;IAC9B,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;GAC3C;EAED,gBAAgB;IACZ,IAAI,IAAI,CAAC,KAAK,EAAE;MACZ,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;KAC7C;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE;MACtD,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;QAC/B,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;OAC3B;KACJ;GACJ;EAED,IAAY,OAAO;IACf,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC;QAClB,IAAwC;QACxC,IAAI,KAAK,IAAI;UACT,IAAI,CAAC,gBAAgB,EAA2B;UAChD,EAAE,CAAC;GAChB;EAGD,qBAAqB,CAAC,KAAoC;IACtD,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACnD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;MAChB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;KAC5B,CAAC,CAAA;GACL;EAEO,kBAAkB,CAAC,KAAa,EAAE,aAAsB;IAC5D,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;MAC/B,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK,EAAE;QACxB,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;OACrC;WAAM;QACH,IAAI,aAAa,EAAE;UACf,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;SACtC;OACJ;KACJ;GACJ;EAED,MAAM;IACF,QACI,EAAC,IAAI,QACD,YAAM,IAAI,EAAC,QAAQ,GAAE,CAClB,EACT;GACL;;;;;;;;;;","names":[],"sources":["./src/components/radio-group/radio-group.scss?tag=wcs-radio-group&encapsulation=shadow","./src/components/radio-group/radio-group.tsx"],"sourcesContent":[":host {\n display: flex;\n}\n\n:host([mode=radio]) {\n flex-direction: column;\n\n ::slotted([slot=option]:first-child) {\n margin-top: 0;\n }\n\n ::slotted([slot=option]:last-child) {\n margin-bottom: 0;\n }\n\n ::slotted([slot=options]) {\n margin-top: calc(var(--wcs-base-margin) / 2);\n margin-bottom: calc(var(--wcs-base-margin) / 2);\n }\n}\n\n:host([mode=option]) {\n display: inline-flex;\n flex-direction: row;\n padding: calc(var(--wcs-base-margin) / 4);\n background-color: #4d4f53;\n border-radius: 0.6875rem;\n}\n\n:host([mode=horizontal]) {\n justify-content: space-between;\n}\n","import {\n Component,\n ComponentInterface,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n Watch\n} from '@stencil/core';\nimport { RadioGroupChangeEventDetail, RadioGroupMode } from './radio-group-interface';\nimport { RadioChosedEvent } from '../radio/radio-interface';\n\n@Component({\n tag: 'wcs-radio-group',\n styleUrl: 'radio-group.scss',\n shadow: true\n})\nexport class RadioGroup implements ComponentInterface {\n @Prop() value: any | any[] | undefined | null;\n @Prop({reflect: true, mutable: false}) name;\n @Prop({reflect: true, mutable: false}) mode: RadioGroupMode = 'radio';\n @Element() private el!: HTMLWcsRadioGroupElement;\n\n /** Emitted when the value has changed. */\n @Event() wcsChange!: EventEmitter<RadioGroupChangeEventDetail>;\n\n @Watch('value')\n onValueChangeHandler(newValue: any) {\n this.updateOptionsState(newValue, true);\n }\n\n componentDidLoad() {\n if (this.value) {\n this.updateOptionsState(this.value, true);\n }\n if (this.mode === 'option' || this.mode === 'horizontal') {\n for (const option of this.options) {\n option.mode = this.mode;\n }\n }\n }\n\n private get options(): HTMLWcsRadioElement[] {\n const opts = this.el.querySelectorAll('wcs-radio');\n const slot = this.el.querySelector('slot');\n return opts.length !== 0\n ? opts as unknown as HTMLWcsRadioElement[]\n : slot !== null\n ? slot.assignedElements() as HTMLWcsRadioElement[]\n : [];\n }\n\n @Listen('wcsRadioClick')\n selectedOptionChanged(event: CustomEvent<RadioChosedEvent>) {\n this.updateOptionsState(event.detail.value, false);\n this.wcsChange.emit({\n value: event.detail.value\n })\n }\n\n private updateOptionsState(value: string, markAsChecked: boolean) {\n for (const option of this.options) {\n if (option.value !== value) {\n option.removeAttribute('checked');\n } else {\n if (markAsChecked) {\n option.setAttribute('checked', '');\n }\n }\n }\n }\n\n render() {\n return (\n <Host>\n <slot name=\"option\"/>\n </Host>\n );\n }\n\n}\n"],"version":3}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-dc4d96d4.js';
|
|
2
|
-
import { i as isSpaceKey, a as isEnterKey } from './helpers-
|
|
2
|
+
import { i as isSpaceKey, a as isEnterKey } from './helpers-1f7170dd.js';
|
|
3
3
|
|
|
4
|
-
const radioCss = ":host([mode=radio]
|
|
4
|
+
const radioCss = ":host{width:fit-content}:host([mode=radio]:focus-within){transition:none;outline:2px dashed var(--wcs-primary);outline-offset:0;border-radius:0.5rem}:host([mode=horizontal]:focus-within){transition:none;outline:2px dashed var(--wcs-primary);outline-offset:2px;border-radius:0.5rem}:host([mode=radio]) input,:host([mode=horizontal]) input{position:absolute;opacity:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}:host([mode=radio]) label,:host([mode=horizontal]) label{margin-bottom:0;color:var(--wcs-text-medium);background-color:transparent;font-weight:500 !important;display:inline-block}:host([mode=radio]) label:before,:host([mode=horizontal]) label:before{border-radius:50%;border:2px solid var(--wcs-text-disabled);position:relative;width:1.125rem;height:1.125rem;pointer-events:none;content:\"\";background-color:var(--wcs-white)}:host([mode=radio]) label:after,:host([mode=horizontal]) label:after{transition:0.175s ease-in-out;position:relative;width:1.125rem;height:1.125rem;content:\"\";background:no-repeat 50%/50% 50%}:host([disabled]) label{color:var(--wcs-text-disabled);cursor:not-allowed}:host(:not([disabled])) label{cursor:pointer}:host([mode=radio][checked]) label,:host([mode=horizontal][checked]) label{color:var(--wcs-primary)}:host([mode=radio][checked]) label:before,:host([mode=horizontal][checked]) label:before{border-color:var(--wcs-primary);background-color:var(--wcs-primary)}:host([mode=radio]:hover):not([disabled]) label,:host([mode=horizontal]:hover):not([disabled]) label{color:var(--wcs-primary)}:host([mode=radio]:hover):not([disabled]) label:before,:host([mode=horizontal]:hover):not([disabled]) label:before{border-color:var(--wcs-primary)}:host([mode=radio]) label{padding:0.125rem 0.125rem 0 0;border:none;transition:0.175s ease-in-out}:host([mode=radio]) label:before{transition:0.175s ease-in-out;margin-right:var(--wcs-base-margin);display:inline-block;top:3px;box-sizing:border-box}:host([mode=horizontal]) label:before{transition:background-color 0.175s ease-in-out;margin:auto auto var(--wcs-base-margin);display:block}:host([mode=option]){padding:var(--wcs-base-margin) calc(var(--wcs-base-margin) / 2);font-weight:500 !important}:host([mode=option]) input{position:absolute;z-index:-1;opacity:0;box-sizing:border-box;padding:0}:host([mode=option]) label{padding:5px calc(2 * var(--wcs-base-margin));margin-bottom:0;color:var(--wcs-white);white-space:nowrap;border-radius:0.4375rem}:host([mode=option]:focus-within) label{outline:2px dashed var(--wcs-white);outline-offset:0.1rem;border-radius:0.4375rem}:host([mode=option][checked]) label{font-weight:500 !important;color:var(--wcs-primary);background-color:var(--wcs-white)}";
|
|
5
5
|
|
|
6
6
|
const Radio = class {
|
|
7
7
|
constructor(hostRef) {
|
|
@@ -41,7 +41,7 @@ const Radio = class {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
render() {
|
|
44
|
-
return (h(Host, { slot: "option" }, h("input", { id: this.inputId, type: "radio", value: this.value, checked: this.checked, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : null, "aria-checked": `${this.checked}
|
|
44
|
+
return (h(Host, { slot: "option" }, h("input", { id: this.inputId, type: "radio", value: this.value, checked: this.checked, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : null, "aria-checked": `${this.checked}` }), h("label", { htmlFor: `${this.inputId}` }, this.label)));
|
|
45
45
|
}
|
|
46
46
|
get el() { return getElement(this); }
|
|
47
47
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,IAAI,CAAC,OAAO,EAChB,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,mBACR,IAAI,CAAC,QAAQ,GAAG,MAAM,GAAG,IAAI,kBAC9B,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,EACtC,aAAO,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,IAAG,IAAI,CAAC,KAAK,CAAS,CACpD,EACT;GACL;;;AAGL,IAAI,cAAc,GAAG,CAAC,CAAC;;;;;","names":[],"sources":["./src/components/radio/radio.scss?tag=wcs-radio&encapsulation=shadow","./src/components/radio/radio.component.tsx"],"sourcesContent":["@import '../../style/focus-outline.scss';\n\n:host {\n width: fit-content;\n}\n\n:host([mode=radio]:focus-within) {\n transition: none;\n @include focus-outline($border-radius: 0.5rem, $outline-offset: 0);\n}\n\n:host([mode=horizontal]:focus-within) {\n transition: none;\n @include focus-outline($border-radius: 0.5rem, $outline-offset: 2px);\n}\n\n:host([mode=radio]),\n:host([mode=horizontal]) {\n input {\n position: absolute;\n opacity: 0;\n height: 1px;\n width: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n }\n\n label {\n margin-bottom: 0;\n color: var(--wcs-text-medium);\n background-color: transparent;\n font-weight: 500 !important;\n display: inline-block;\n\n &:before {\n border-radius: 50%;\n border: 2px solid var(--wcs-text-disabled);\n position: relative;\n width: 1.125rem;\n height: 1.125rem;\n pointer-events: none;\n content: \"\";\n background-color: var(--wcs-white);\n }\n\n &:after {\n transition: 0.175s ease-in-out;\n position: relative;\n width: 1.125rem;\n height: 1.125rem;\n content: \"\";\n background: no-repeat 50% / 50% 50%;\n }\n }\n}\n\n:host([disabled]) {\n label {\n color: var(--wcs-text-disabled);\n cursor: not-allowed;\n }\n}\n\n:host(:not([disabled])) {\n label {\n cursor: pointer;\n }\n}\n\n:host([mode=radio][checked]),\n:host([mode=horizontal][checked]) {\n label {\n color: var(--wcs-primary);\n\n &:before {\n border-color: var(--wcs-primary);\n background-color: var(--wcs-primary);\n }\n }\n}\n\n:host([mode=radio]:hover):not([disabled]),\n:host([mode=horizontal]:hover):not([disabled]) {\n label {\n color: var(--wcs-primary);\n\n &:before {\n border-color: var(--wcs-primary);\n }\n }\n}\n\n:host([mode=radio]) {\n label {\n padding: 0.125rem 0.125rem 0 0;\n border: none;\n transition: 0.175s ease-in-out;\n\n &:before {\n transition: 0.175s ease-in-out;\n margin-right: var(--wcs-base-margin);\n display: inline-block;\n top: 3px;\n box-sizing: border-box;\n }\n }\n}\n\n:host([mode=horizontal]) {\n label {\n &:before {\n transition: background-color 0.175s ease-in-out;\n margin: auto auto var(--wcs-base-margin);\n display: block;\n\n }\n }\n}\n\n:host([mode=option]) {\n padding: var(--wcs-base-margin) calc(var(--wcs-base-margin) / 2);\n font-weight: 500 !important;\n\n input {\n position: absolute;\n z-index: -1;\n opacity: 0;\n box-sizing: border-box;\n padding: 0;\n }\n\n label {\n padding: 5px calc(2 * var(--wcs-base-margin));\n margin-bottom: 0;\n color: var(--wcs-white);\n white-space: nowrap;\n border-radius: 0.4375rem;\n }\n}\n\n:host([mode=option]:focus-within) {\n label {\n @include focus-outline(var(--wcs-white), 0.4375rem, 0.1rem);\n }\n}\n\n:host([mode=option][checked]) {\n label {\n font-weight: 500 !important;\n color: var(--wcs-primary);\n background-color: var(--wcs-white);\n }\n}\n","import { Component, ComponentInterface, h, Host, Prop, Element, Event, EventEmitter, Listen } from '@stencil/core';\nimport { RadioChosedEvent } from './radio-interface';\nimport { RadioGroupMode } from '../radio-group/radio-group-interface';\nimport { isEnterKey, isSpaceKey } from '../../utils/helpers';\n\n@Component({\n tag: 'wcs-radio',\n styleUrl: 'radio.scss',\n shadow: true\n})\nexport class Radio implements ComponentInterface {\n private inputId = `wcs-rb-${radioButtonIds++}`;\n private inputEl: HTMLInputElement;\n @Element() private el!: HTMLWcsRadioElement;\n @Prop({ reflect: true, mutable: false }) mode: RadioGroupMode = 'radio';\n\n @Prop({ mutable: true, reflect: true }) value: any | any[] | undefined | null;\n @Prop({ mutable: true, reflect: true }) label: string;\n /**\n * If `true`, the radio is selected.\n */\n @Prop({mutable: true, reflect: true}) checked = false;\n /**\n * If `true`, the user cannot interact with the radio.\n */\n @Prop({ mutable: true }) disabled = false;\n // FIXME renommer l'évènement c'est pas un onclick mais un onchange\n @Event({eventName: 'wcsRadioClick' }) wcsRadioClick: EventEmitter<RadioChosedEvent>\n\n @Listen('keydown')\n onKeyDown(_event: KeyboardEvent) {\n if ((isSpaceKey(_event) || isEnterKey(_event)) && !this.el.checked) {\n this.el.checked = true;\n this.emitRadioChangeEvent();\n }\n }\n\n componentWillLoad(): Promise<void> | void {\n if (this.value === undefined) {\n // If no value was given we use the text content instead.\n this.value = this.el.innerText || '';\n }\n }\n\n componentDidLoad() {\n this.inputEl = this.el.shadowRoot.querySelector('input');\n this.inputEl.addEventListener('change', _ => {\n this.emitRadioChangeEvent();\n this.checked = true;\n })\n }\n\n emitRadioChangeEvent() {\n this.wcsRadioClick.emit({\n label: this.label,\n source: this.el,\n value: this.value\n });\n }\n\n render() {\n return (\n <Host slot=\"option\">\n <input\n id={this.inputId}\n type=\"radio\"\n value={this.value}\n checked={this.checked}\n disabled={this.disabled}\n aria-disabled={this.disabled ? 'true' : null}\n aria-checked={`${this.checked}`}/>\n <label htmlFor={`${this.inputId}`}>{this.label}</label>\n </Host>\n );\n }\n}\n\nlet radioButtonIds = 0;\n"],"version":3}
|