wcs-core 7.2.2 → 7.4.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 +11 -9
- package/design-tokens/dist/sncf-groupe-root-scoped.css +227 -227
- package/design-tokens/dist/sncf-groupe.css +227 -227
- package/design-tokens/dist/sncf-holding-root-scoped.css +227 -227
- package/design-tokens/dist/sncf-holding.css +227 -227
- package/design-tokens/dist/sncf-reseau-root-scoped.css +227 -227
- package/design-tokens/dist/sncf-reseau.css +227 -227
- package/design-tokens/dist/sncf-voyageurs-root-scoped.css +242 -242
- package/design-tokens/dist/sncf-voyageurs.css +242 -242
- package/dist/cjs/accessibility-5f681a74.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{popper-8d6e7fca.js → popper-1b61df21.js} +10 -17
- package/dist/cjs/popper-1b61df21.js.map +1 -0
- 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-accordion.cjs.entry.js +2 -1
- package/dist/cjs/wcs-accordion.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/wcs-breadcrumb.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-checkbox.cjs.entry.js +3 -2
- package/dist/cjs/wcs-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-chip.cjs.entry.js +102 -0
- package/dist/cjs/wcs-chip.cjs.entry.js.map +1 -0
- package/dist/cjs/wcs-com-nav-item.cjs.entry.js +1 -1
- package/dist/cjs/wcs-com-nav-item.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-com-nav.cjs.entry.js +3 -3
- package/dist/cjs/wcs-com-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/wcs-error_3.cjs.entry.js +1 -1
- package/dist/cjs/wcs-error_3.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-galactic-menu.cjs.entry.js +1 -1
- package/dist/cjs/wcs-grid.cjs.entry.js +5 -4
- package/dist/cjs/wcs-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-horizontal-stepper.cjs.entry.js +3 -2
- package/dist/cjs/wcs-horizontal-stepper.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-select_2.cjs.entry.js +59 -24
- package/dist/cjs/wcs-select_2.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-tabs.cjs.entry.js +1 -1
- package/dist/cjs/wcs-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/wcs.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/accordion/accordion.e2e.playwright.js +183 -0
- package/dist/collection/components/accordion/accordion.e2e.playwright.js.map +1 -0
- package/dist/collection/components/accordion/accordion.js +2 -1
- package/dist/collection/components/accordion/accordion.js.map +1 -1
- package/dist/collection/components/accordion-panel/accordion-panel.js +3 -3
- package/dist/collection/components/accordion-panel/accordion-panel.js.map +1 -1
- package/dist/collection/components/alert/alert.e2e.playwright.js +125 -0
- package/dist/collection/components/alert/alert.e2e.playwright.js.map +1 -0
- package/dist/collection/components/alert-drawer/alert-drawer.e2e.playwright.js +107 -0
- package/dist/collection/components/alert-drawer/alert-drawer.e2e.playwright.js.map +1 -0
- package/dist/collection/components/breadcrumb/breadcrumb.e2e.playwright.js +188 -0
- package/dist/collection/components/breadcrumb/breadcrumb.e2e.playwright.js.map +1 -0
- package/dist/collection/components/breadcrumb/breadcrumb.js +2 -2
- package/dist/collection/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/collection/components/button/button.e2e.playwright.js +26 -0
- package/dist/collection/components/button/button.e2e.playwright.js.map +1 -0
- package/dist/collection/components/button/button.js +1 -1
- package/dist/collection/components/checkbox/checkbox.css +3 -0
- package/dist/collection/components/checkbox/checkbox.e2e.playwright.js +39 -0
- package/dist/collection/components/checkbox/checkbox.e2e.playwright.js.map +1 -0
- package/dist/collection/components/checkbox/checkbox.js +21 -2
- package/dist/collection/components/checkbox/checkbox.js.map +1 -1
- package/dist/collection/components/chip/chip-interface.js +2 -0
- package/dist/collection/components/chip/chip-interface.js.map +1 -0
- package/dist/collection/components/chip/chip.css +220 -0
- package/dist/collection/components/chip/chip.e2e.playwright.js +190 -0
- package/dist/collection/components/chip/chip.e2e.playwright.js.map +1 -0
- package/dist/collection/components/chip/chip.js +341 -0
- package/dist/collection/components/chip/chip.js.map +1 -0
- package/dist/collection/components/com-nav/com-nav.css +15 -0
- package/dist/collection/components/com-nav/{com-nav.e2e.js → com-nav.e2e.playwright.js} +60 -44
- package/dist/collection/components/com-nav/com-nav.e2e.playwright.js.map +1 -0
- package/dist/collection/components/com-nav/com-nav.js +3 -3
- package/dist/collection/components/com-nav/com-nav.js.map +1 -1
- package/dist/collection/components/com-nav-category/com-nav-category.js +1 -1
- package/dist/collection/components/com-nav-item/com-nav-item.css +2 -2
- package/dist/collection/components/com-nav-submenu/com-nav-submenu.js +1 -1
- package/dist/collection/components/counter/counter.e2e.playwright.js +187 -0
- package/dist/collection/components/counter/counter.e2e.playwright.js.map +1 -0
- package/dist/collection/components/counter/counter.js +1 -1
- package/dist/collection/components/dropdown/dropdown.e2e.playwright.js +320 -0
- package/dist/collection/components/dropdown/dropdown.e2e.playwright.js.map +1 -0
- package/dist/collection/components/dropdown/dropdown.js +1 -1
- package/dist/collection/components/editable-field/editable-field.e2e.playwright.js +156 -0
- package/dist/collection/components/editable-field/editable-field.e2e.playwright.js.map +1 -0
- package/dist/collection/components/form-field/form-field.e2e.playwright.js +104 -0
- package/dist/collection/components/form-field/form-field.e2e.playwright.js.map +1 -0
- package/dist/collection/components/galactic-menu/galactic-menu.js +1 -1
- package/dist/collection/components/grid/grid.e2e.playwright.js +153 -0
- package/dist/collection/components/grid/grid.e2e.playwright.js.map +1 -0
- package/dist/collection/components/grid/grid.js +6 -5
- package/dist/collection/components/grid/grid.js.map +1 -1
- package/dist/collection/components/grid-column/grid-column.js +1 -1
- package/dist/collection/components/grid-pagination/grid-pagination.js +1 -1
- package/dist/collection/components/header/header.js +1 -1
- package/dist/collection/components/horizontal-stepper/horizontal-step.js +2 -1
- package/dist/collection/components/horizontal-stepper/horizontal-step.js.map +1 -1
- package/dist/collection/components/horizontal-stepper/horizontal-stepper-interface.js.map +1 -1
- package/dist/collection/components/horizontal-stepper/horizontal-stepper.js +5 -1
- 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.e2e.playwright.js +157 -0
- package/dist/collection/components/input/input.e2e.playwright.js.map +1 -0
- package/dist/collection/components/input/input.js +2 -2
- package/dist/collection/components/label/label.css +4 -6
- package/dist/collection/components/label/label.js +1 -1
- package/dist/collection/components/mat-icon/mat-icon.js +1 -1
- package/dist/collection/components/modal/modal.css +4 -0
- package/dist/collection/components/modal/modal.e2e.playwright.js +35 -0
- package/dist/collection/components/modal/modal.e2e.playwright.js.map +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.js +1 -1
- package/dist/collection/components/nav/nav.js +1 -1
- package/dist/collection/components/progress-bar/progress-bar.js +1 -1
- package/dist/collection/components/progress-radial/progress-radial.js +1 -1
- package/dist/collection/components/radio/radio.js +1 -1
- package/dist/collection/components/radio-group/radio-group.e2e.playwright.js +231 -0
- package/dist/collection/components/radio-group/radio-group.e2e.playwright.js.map +1 -0
- package/dist/collection/components/radio-group/radio-group.js +1 -1
- package/dist/collection/components/select/select.e2e.playwright.js +1702 -0
- package/dist/collection/components/select/select.e2e.playwright.js.map +1 -0
- package/dist/collection/components/select/select.js +49 -20
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/select-option/select-option.js +3 -3
- package/dist/collection/components/select-option/select-option.js.map +1 -1
- package/dist/collection/components/switch/switch.e2e.playwright.js +40 -0
- package/dist/collection/components/switch/switch.e2e.playwright.js.map +1 -0
- package/dist/collection/components/switch/switch.js +1 -1
- package/dist/collection/components/tabs/tabs.e2e.playwright.js +205 -0
- package/dist/collection/components/tabs/tabs.e2e.playwright.js.map +1 -0
- package/dist/collection/components/tabs/tabs.js +1 -1
- package/dist/collection/components/textarea/textarea.e2e.playwright.js +133 -0
- package/dist/collection/components/textarea/textarea.e2e.playwright.js.map +1 -0
- package/dist/collection/components/textarea/textarea.js +1 -1
- package/dist/collection/utils/accessibility.js +16 -0
- package/dist/collection/utils/accessibility.js.map +1 -1
- package/dist/collection/utils/playwright/test-expect.js +2 -0
- package/dist/collection/utils/playwright/test-expect.js.map +1 -0
- package/dist/collection/utils/playwright/test.js +16 -0
- package/dist/collection/utils/playwright/test.js.map +1 -0
- package/dist/esm/accessibility-069640cf.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{popper-e491c314.js → popper-ac238961.js} +10 -17
- package/dist/esm/popper-ac238961.js.map +1 -0
- 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-accordion.entry.js +2 -1
- package/dist/esm/wcs-accordion.entry.js.map +1 -1
- package/dist/esm/wcs-breadcrumb.entry.js +1 -1
- package/dist/esm/wcs-breadcrumb.entry.js.map +1 -1
- package/dist/esm/wcs-checkbox.entry.js +3 -2
- package/dist/esm/wcs-checkbox.entry.js.map +1 -1
- package/dist/esm/wcs-chip.entry.js +98 -0
- package/dist/esm/wcs-chip.entry.js.map +1 -0
- package/dist/esm/wcs-com-nav-item.entry.js +1 -1
- package/dist/esm/wcs-com-nav-item.entry.js.map +1 -1
- package/dist/esm/wcs-com-nav.entry.js +3 -3
- package/dist/esm/wcs-com-nav.entry.js.map +1 -1
- package/dist/esm/wcs-dropdown.entry.js +1 -1
- package/dist/esm/wcs-error_3.entry.js +1 -1
- package/dist/esm/wcs-error_3.entry.js.map +1 -1
- package/dist/esm/wcs-galactic-menu.entry.js +1 -1
- package/dist/esm/wcs-grid.entry.js +5 -4
- package/dist/esm/wcs-grid.entry.js.map +1 -1
- package/dist/esm/wcs-horizontal-stepper.entry.js +3 -2
- package/dist/esm/wcs-horizontal-stepper.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-select_2.entry.js +59 -24
- package/dist/esm/wcs-select_2.entry.js.map +1 -1
- package/dist/esm/wcs-tabs.entry.js +1 -1
- package/dist/esm/wcs-tooltip.entry.js +1 -1
- package/dist/esm/wcs.js +1 -1
- package/dist/types/components/accordion/accordion.e2e.playwright.d.ts +1 -0
- package/dist/types/components/accordion-panel/accordion-panel.d.ts +5 -0
- package/dist/types/components/alert/alert.e2e.playwright.d.ts +1 -0
- package/dist/types/components/alert-drawer/alert-drawer.e2e.playwright.d.ts +1 -0
- package/dist/types/components/breadcrumb/breadcrumb.e2e.playwright.d.ts +1 -0
- package/dist/types/components/button/button.e2e.playwright.d.ts +1 -0
- package/dist/types/components/checkbox/checkbox.d.ts +4 -0
- package/dist/types/components/checkbox/checkbox.e2e.playwright.d.ts +1 -0
- package/dist/types/components/chip/chip-interface.d.ts +4 -0
- package/dist/types/components/chip/chip.d.ts +132 -0
- package/dist/types/components/chip/chip.e2e.playwright.d.ts +1 -0
- package/dist/types/components/com-nav/com-nav.e2e.playwright.d.ts +1 -0
- package/dist/types/components/counter/counter.e2e.playwright.d.ts +1 -0
- package/dist/types/components/dropdown/dropdown.e2e.playwright.d.ts +1 -0
- package/dist/types/components/editable-field/editable-field.e2e.playwright.d.ts +1 -0
- package/dist/types/components/form-field/form-field.e2e.playwright.d.ts +1 -0
- package/dist/types/components/grid/grid.e2e.playwright.d.ts +1 -0
- package/dist/types/components/horizontal-stepper/horizontal-stepper-interface.d.ts +2 -0
- package/dist/types/components/horizontal-stepper/horizontal-stepper.d.ts +4 -0
- package/dist/types/components/input/input.e2e.playwright.d.ts +1 -0
- package/dist/types/components/modal/modal.e2e.playwright.d.ts +1 -0
- package/dist/types/components/radio-group/radio-group.e2e.playwright.d.ts +1 -0
- package/dist/types/components/select/select.d.ts +7 -1
- package/dist/types/components/select/select.e2e.playwright.d.ts +1 -0
- package/dist/types/components/switch/switch.e2e.playwright.d.ts +1 -0
- package/dist/types/components/tabs/tabs.e2e.playwright.d.ts +1 -0
- package/dist/types/components/textarea/textarea.e2e.playwright.d.ts +1 -0
- package/dist/types/components.d.ts +354 -0
- package/dist/types/utils/accessibility.d.ts +7 -0
- package/dist/types/utils/playwright/test-expect.d.ts +33 -0
- package/dist/types/utils/playwright/test.d.ts +7 -0
- package/dist/wcs/{p-8e9bd0f1.entry.js → p-0326f834.entry.js} +2 -2
- package/dist/wcs/{p-8e9bd0f1.entry.js.map → p-0326f834.entry.js.map} +1 -1
- package/dist/wcs/p-2221bf0c.entry.js +16 -0
- package/dist/wcs/p-2221bf0c.entry.js.map +1 -0
- package/dist/wcs/p-4ae08567.entry.js +2 -0
- package/dist/wcs/p-4ae08567.entry.js.map +1 -0
- package/dist/wcs/p-4e2d6227.entry.js +2 -0
- package/dist/wcs/p-4e2d6227.entry.js.map +1 -0
- package/dist/wcs/p-828b45b4.entry.js +2 -0
- package/dist/wcs/p-828b45b4.entry.js.map +1 -0
- package/dist/wcs/p-8332a7e3.entry.js +2 -0
- package/dist/wcs/p-8332a7e3.entry.js.map +1 -0
- package/dist/wcs/p-990698a7.entry.js +2 -0
- package/dist/wcs/p-990698a7.entry.js.map +1 -0
- package/dist/wcs/{p-ec383729.entry.js → p-9b76b8e6.entry.js} +2 -2
- package/dist/wcs/{p-ec383729.entry.js.map → p-9b76b8e6.entry.js.map} +1 -1
- package/dist/wcs/{p-1f593d06.entry.js → p-abd8d5a0.entry.js} +2 -2
- package/dist/wcs/{p-622f7403.entry.js → p-c6f8c45c.entry.js} +2 -2
- package/dist/wcs/{p-a94e685c.entry.js → p-db7ba599.entry.js} +2 -2
- package/dist/wcs/p-e1fb3625.js +2 -0
- package/dist/wcs/p-e1fb3625.js.map +1 -0
- package/dist/wcs/p-ed3b0709.entry.js +2 -0
- package/dist/wcs/p-ed3b0709.entry.js.map +1 -0
- package/dist/wcs/{p-6c6079ee.entry.js → p-f2eeb249.entry.js} +2 -2
- package/dist/wcs/{p-6c6079ee.entry.js.map → p-f2eeb249.entry.js.map} +1 -1
- package/dist/wcs/{p-a956dc84.entry.js → p-f2f7595e.entry.js} +2 -2
- package/dist/wcs/{p-a956dc84.entry.js.map → p-f2f7595e.entry.js.map} +1 -1
- package/dist/wcs/p-fb2751c2.js.map +1 -1
- package/dist/wcs/p-fbd68522.entry.js +2 -0
- package/dist/wcs/p-fbd68522.entry.js.map +1 -0
- package/dist/wcs/{p-8c2605fd.entry.js → p-fe303f58.entry.js} +2 -2
- package/dist/wcs/wcs.esm.js +1 -1
- package/dist/wcs/wcs.esm.js.map +1 -1
- package/package.json +18 -24
- package/dist/cjs/popper-8d6e7fca.js.map +0 -1
- package/dist/collection/components/alert/alert.e2e.js +0 -142
- package/dist/collection/components/alert/alert.e2e.js.map +0 -1
- package/dist/collection/components/alert-drawer/alert-drawer.e2e.js +0 -111
- package/dist/collection/components/alert-drawer/alert-drawer.e2e.js.map +0 -1
- package/dist/collection/components/breadcrumb/breadcrumb.e2e.js +0 -223
- package/dist/collection/components/breadcrumb/breadcrumb.e2e.js.map +0 -1
- package/dist/collection/components/button/button.e2e.js +0 -25
- package/dist/collection/components/button/button.e2e.js.map +0 -1
- package/dist/collection/components/checkbox/checkbox.e2e.js +0 -45
- package/dist/collection/components/checkbox/checkbox.e2e.js.map +0 -1
- package/dist/collection/components/com-nav/com-nav.e2e.js.map +0 -1
- package/dist/collection/components/counter/counter.e2e.js +0 -206
- package/dist/collection/components/counter/counter.e2e.js.map +0 -1
- package/dist/collection/components/dropdown/dropdown.e2e.js +0 -156
- package/dist/collection/components/dropdown/dropdown.e2e.js.map +0 -1
- package/dist/collection/components/editable-field/editable-field.e2e.js +0 -176
- package/dist/collection/components/editable-field/editable-field.e2e.js.map +0 -1
- package/dist/collection/components/form-field/form-field.e2e.js +0 -122
- package/dist/collection/components/form-field/form-field.e2e.js.map +0 -1
- package/dist/collection/components/grid/grid.e2e.js +0 -147
- package/dist/collection/components/grid/grid.e2e.js.map +0 -1
- package/dist/collection/components/input/input.e2e.js +0 -152
- package/dist/collection/components/input/input.e2e.js.map +0 -1
- package/dist/collection/components/modal/modal.e2e.js +0 -36
- package/dist/collection/components/modal/modal.e2e.js.map +0 -1
- package/dist/collection/components/radio-group/radio-group.e2e.js +0 -239
- package/dist/collection/components/radio-group/radio-group.e2e.js.map +0 -1
- package/dist/collection/components/select/select.e2e.js +0 -1081
- package/dist/collection/components/select/select.e2e.js.map +0 -1
- package/dist/collection/components/switch/switch.e2e.js +0 -45
- package/dist/collection/components/switch/switch.e2e.js.map +0 -1
- package/dist/collection/components/tabs/tabs.e2e.js +0 -207
- package/dist/collection/components/tabs/tabs.e2e.js.map +0 -1
- package/dist/collection/components/textarea/textarea.e2e.js +0 -132
- package/dist/collection/components/textarea/textarea.e2e.js.map +0 -1
- package/dist/collection/utils/tests.js +0 -23
- package/dist/collection/utils/tests.js.map +0 -1
- package/dist/esm/popper-e491c314.js.map +0 -1
- package/dist/types/utils/tests.d.ts +0 -4
- package/dist/wcs/p-02f31010.entry.js +0 -2
- package/dist/wcs/p-02f31010.entry.js.map +0 -1
- package/dist/wcs/p-0dd07842.entry.js +0 -2
- package/dist/wcs/p-0dd07842.entry.js.map +0 -1
- package/dist/wcs/p-0f864e86.js +0 -2
- package/dist/wcs/p-0f864e86.js.map +0 -1
- package/dist/wcs/p-1244daa0.entry.js +0 -2
- package/dist/wcs/p-1244daa0.entry.js.map +0 -1
- package/dist/wcs/p-1fbe0328.entry.js +0 -2
- package/dist/wcs/p-1fbe0328.entry.js.map +0 -1
- package/dist/wcs/p-4fb2d985.entry.js +0 -2
- package/dist/wcs/p-4fb2d985.entry.js.map +0 -1
- package/dist/wcs/p-b94a09b6.entry.js +0 -16
- package/dist/wcs/p-b94a09b6.entry.js.map +0 -1
- package/dist/wcs/p-fd187bce.entry.js +0 -2
- package/dist/wcs/p-fd187bce.entry.js.map +0 -1
- /package/dist/wcs/{p-1f593d06.entry.js.map → p-abd8d5a0.entry.js.map} +0 -0
- /package/dist/wcs/{p-622f7403.entry.js.map → p-c6f8c45c.entry.js.map} +0 -0
- /package/dist/wcs/{p-a94e685c.entry.js.map → p-db7ba599.entry.js.map} +0 -0
- /package/dist/wcs/{p-8c2605fd.entry.js.map → p-fe303f58.entry.js.map} +0 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* The chip component is a small, interactive element that can be used to represent an input, filter, or tag.
|
|
4
|
+
* It can be in one of two modes: 'selectable' or 'dismissible'.
|
|
5
|
+
* - In 'selectable' mode, the chip can be selected or deselected, and emits an event when clicked.
|
|
6
|
+
* - In 'dismissible' mode, the chip can be dismissed (removed) by clicking a dismiss icon, and emits an event when the dismiss icon is clicked.
|
|
7
|
+
*
|
|
8
|
+
* @cssprop --wcs-chip-height - Height of the chip
|
|
9
|
+
* @cssprop --wcs-chip-font-size - Font size of the chip text
|
|
10
|
+
* @cssprop --wcs-chip-font-weight - Font weight of the chip text
|
|
11
|
+
*
|
|
12
|
+
* @cssprop --wcs-chip-focus-outline-border-width - Border width of the chip focus outline
|
|
13
|
+
*
|
|
14
|
+
* @cssprop --wcs-chip-padding-vertical - Vertical padding (top - bottom) of the chip
|
|
15
|
+
* @cssprop --wcs-chip-padding-horizontal - Horizontal padding (left - right) of the chip
|
|
16
|
+
* @cssprop --wcs-chip-padding-horizontal-dismissible - Horizontal padding (left - right) of the chip with 'dismissible' mode
|
|
17
|
+
*
|
|
18
|
+
* @cssprop --wcs-chip-selectable-background-color - Background color of the chip with 'selectable' mode in default state
|
|
19
|
+
* @cssprop --wcs-chip-selectable-background-color-pressed - Background color of the chip with 'selectable' mode when pressed
|
|
20
|
+
* @cssprop --wcs-chip-selectable-background-color-hover - Background color of the chip with 'selectable' mode when hovered
|
|
21
|
+
* @cssprop --wcs-chip-selectable-background-color-selected - Background color of the chip with 'selectable' mode when selected
|
|
22
|
+
* @cssprop --wcs-chip-selectable-background-color-selected-hover - Background color of the chip with 'selectable' mode when selected and hovered
|
|
23
|
+
* @cssprop --wcs-chip-selectable-background-color-selected-pressed - Background color of the chip with 'selectable' mode when selected and pressed
|
|
24
|
+
* @cssprop --wcs-chip-selectable-background-color-selected-disabled - Background color of the chip with 'selectable' mode when selected and disabled
|
|
25
|
+
*
|
|
26
|
+
* @cssprop --wcs-chip-selectable-color - Text color of the chip with 'selectable' mode in default state
|
|
27
|
+
* @cssprop --wcs-chip-selectable-color-hover - Text color of the chip with 'selectable' mode when hovered
|
|
28
|
+
* @cssprop --wcs-chip-selectable-color-pressed - Text color of the chip with 'selectable' mode when pressed
|
|
29
|
+
* @cssprop --wcs-chip-selectable-color-disabled - Text color of the chip with 'selectable' mode when disabled
|
|
30
|
+
* @cssprop --wcs-chip-selectable-color-selected - Text color of the chip with 'selectable' mode when selected
|
|
31
|
+
* @cssprop --wcs-chip-selectable-color-selected-hover - Text color of the chip with 'selectable' mode when selected and hovered
|
|
32
|
+
* @cssprop --wcs-chip-selectable-color-selected-pressed - Text color of the chip with 'selectable' mode when selected and pressed
|
|
33
|
+
*
|
|
34
|
+
* @cssprop --wcs-chip-border-radius - Border radius of the chip
|
|
35
|
+
* @cssprop --wcs-chip-border-line-width - Border line width of the chip
|
|
36
|
+
* @cssprop --wcs-chip-selectable-border-color - Border color of the chip with 'selectable' mode in default state
|
|
37
|
+
* @cssprop --wcs-chip-selectable-border-color-hover - Border color of the chip with 'selectable' mode when hovered
|
|
38
|
+
* @cssprop --wcs-chip-selectable-border-color-pressed - Border color of the chip with 'selectable' mode when pressed
|
|
39
|
+
* @cssprop --wcs-chip-selectable-border-color-disabled - Border color of the chip with 'selectable' mode when disabled
|
|
40
|
+
*
|
|
41
|
+
* @cssprop --wcs-chip-selectable-content-gap - Gap between content elements in chip with 'selectable' mode
|
|
42
|
+
* @cssprop --wcs-chip-selectable-focus-outline-color - Focus outline color of the chip with 'selectable' mode
|
|
43
|
+
*
|
|
44
|
+
* @cssprop --wcs-chip-dismissible-content-gap - Gap between content elements in chip with 'dismissible' mode
|
|
45
|
+
* @cssprop --wcs-chip-dismissible-padding-right - Right padding of the chip with 'dismissible' mode
|
|
46
|
+
* @cssprop --wcs-chip-dismissible-button-outline-radius - Outline radius of the button for the chip with 'dismissible' mode
|
|
47
|
+
*
|
|
48
|
+
* @cssprop --wcs-chip-dismissible-primary-focus-outline-color - Focus outline color of the chip with 'dismissible' mode and 'primary' variant
|
|
49
|
+
* @cssprop --wcs-chip-dismissible-primary-border-color - Border color of the chip with 'dismissible' mode and 'primary' variant
|
|
50
|
+
* @cssprop --wcs-chip-dismissible-primary-border-color-disabled - Border color of the chip with 'dismissible' mode and 'primary' variant when disabled
|
|
51
|
+
* @cssprop --wcs-chip-dismissible-primary-color - Text color of the chip with 'dismissible' mode and 'primary' variant
|
|
52
|
+
* @cssprop --wcs-chip-dismissible-primary-color-hover - Text color of the chip with 'dismissible' mode and 'primary' variant when hovered
|
|
53
|
+
* @cssprop --wcs-chip-dismissible-primary-color-pressed - Text color of the chip with 'dismissible' mode and 'primary' variant when pressed
|
|
54
|
+
* @cssprop --wcs-chip-dismissible-primary-color-disabled - Text color of the chip with 'dismissible' mode and 'primary' variant when disabled
|
|
55
|
+
* @cssprop --wcs-chip-dismissible-primary-background-color - Background color of the chip with 'dismissible' mode and 'primary' variant
|
|
56
|
+
* @cssprop --wcs-chip-dismissible-primary-background-color-hover - Background color of the chip with 'dismissible' mode and 'primary' variant when hovered
|
|
57
|
+
* @cssprop --wcs-chip-dismissible-primary-background-color-pressed - Background color of the chip with 'dismissible' mode and 'primary' variant when pressed
|
|
58
|
+
* @cssprop --wcs-chip-dismissible-primary-background-color-disabled - Background color of the chip with 'dismissible' mode and 'primary' variant when disabled
|
|
59
|
+
*
|
|
60
|
+
* @cssprop --wcs-chip-dismissible-secondary-button-focus-outline-color - Button focus outline color of the chip with 'dismissible' mode and 'secondary' variant
|
|
61
|
+
* @cssprop --wcs-chip-dismissible-secondary-border-color - Border color of the chip with 'dismissible' mode and 'secondary' variant
|
|
62
|
+
* @cssprop --wcs-chip-dismissible-secondary-border-color-disabled - Border color of the chip with 'dismissible' mode and 'secondary' variant when disabled
|
|
63
|
+
* @cssprop --wcs-chip-dismissible-secondary-color - Text color of the chip with 'dismissible' mode and 'secondary' variant
|
|
64
|
+
* @cssprop --wcs-chip-dismissible-secondary-color-disabled - Text color of the chip with 'dismissible' mode and 'secondary' variant when disabled
|
|
65
|
+
* @cssprop --wcs-chip-dismissible-secondary-background-color - Background color of the chip with 'dismissible' mode and 'secondary' variant
|
|
66
|
+
* @cssprop --wcs-chip-dismissible-secondary-button-background-color - Button background color of the chip with 'dismissible' mode and 'secondary' variant
|
|
67
|
+
* @cssprop --wcs-chip-dismissible-secondary-button-background-color-hover - Button background color of the chip with 'dismissible' mode and 'secondary' variant when hovered
|
|
68
|
+
* @cssprop --wcs-chip-dismissible-secondary-button-background-color-pressed - Button background color of the chip with 'dismissible' mode and 'secondary' variant when pressed
|
|
69
|
+
* @cssprop --wcs-chip-dismissible-secondary-button-background-color-disabled - Button background color of the chip with 'dismissible' mode and 'secondary' variant when disabled
|
|
70
|
+
*/
|
|
71
|
+
export class Chip {
|
|
72
|
+
constructor() {
|
|
73
|
+
this.handleDismiss = (event) => {
|
|
74
|
+
if (this.disabled || this.mode !== 'dismissible') {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
event.stopPropagation(); // Prevent the click event from bubbling up to the chip click handler
|
|
78
|
+
this.dismiss();
|
|
79
|
+
};
|
|
80
|
+
this.value = undefined;
|
|
81
|
+
this.label = undefined;
|
|
82
|
+
this.selected = false;
|
|
83
|
+
this.open = true;
|
|
84
|
+
this.disabled = false;
|
|
85
|
+
this.variant = 'primary';
|
|
86
|
+
this.mode = 'selectable';
|
|
87
|
+
}
|
|
88
|
+
select() {
|
|
89
|
+
this.selected = !this.selected; // Toggle the selected state
|
|
90
|
+
this.wcsChipSelectChange.emit({ value: this.value, selected: this.selected });
|
|
91
|
+
}
|
|
92
|
+
dismiss() {
|
|
93
|
+
this.open = false;
|
|
94
|
+
this.wcsChipDismiss.emit({ value: this.value });
|
|
95
|
+
this.focusNextChip();
|
|
96
|
+
}
|
|
97
|
+
focusNextChip() {
|
|
98
|
+
let currentElement = this.el.nextElementSibling;
|
|
99
|
+
while (currentElement) {
|
|
100
|
+
if (this.isActionableChip(currentElement)) {
|
|
101
|
+
this.focusChip(currentElement);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
currentElement = currentElement.nextElementSibling;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
isActionableChip(element) {
|
|
108
|
+
return element instanceof HTMLElement
|
|
109
|
+
&& element.tagName === 'WCS-CHIP'
|
|
110
|
+
&& !element.disabled;
|
|
111
|
+
}
|
|
112
|
+
focusChip(chip) {
|
|
113
|
+
var _a, _b;
|
|
114
|
+
if (chip.mode === 'selectable') {
|
|
115
|
+
chip.focus();
|
|
116
|
+
}
|
|
117
|
+
else if (chip.mode === 'dismissible') {
|
|
118
|
+
(_b = (_a = chip.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('button')) === null || _b === void 0 ? void 0 : _b.focus();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
handleClick() {
|
|
122
|
+
if (this.disabled || this.mode !== 'selectable') {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
this.select();
|
|
126
|
+
}
|
|
127
|
+
;
|
|
128
|
+
handleKeydown(ev) {
|
|
129
|
+
if (this.disabled) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (this.mode === 'selectable') {
|
|
133
|
+
if (ev.key === 'Enter' || ev.key === ' ') {
|
|
134
|
+
this.select();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
else if (this.mode === 'dismissible') {
|
|
138
|
+
if (ev.key === 'Delete' || ev.key === 'Backspace') {
|
|
139
|
+
this.dismiss();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
render() {
|
|
144
|
+
const commonProps = {
|
|
145
|
+
'aria-disabled': this.disabled ? 'true' : null
|
|
146
|
+
};
|
|
147
|
+
if (this.mode === 'selectable') {
|
|
148
|
+
return (h(Host, Object.assign({}, commonProps, { role: "checkbox", "aria-checked": this.selected ? 'true' : 'false', tabindex: this.disabled ? -1 : 0, onClick: this.handleClick.bind(this), onKeyDown: this.handleKeydown.bind(this) }), this.selected && (h("svg", { class: "check-icon", "aria-hidden": "true", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M23.712 8.3011L8.0292 23.7157C7.6356 24.095 6.9984 24.095 6.6264 23.7157L0.288 17.4955C-0.096 17.1226 -0.096 16.496 0.288 16.1192L2.1552 14.2739C2.5536 13.9036 3.1776 13.9036 3.5532 14.2739L6.6264 17.2764C6.9984 17.6583 7.6356 17.6583 8.0292 17.2764L20.4384 5.08081C20.8236 4.70662 21.4536 4.70662 21.8364 5.08081L23.712 6.91841C24.096 7.29516 24.096 7.91923 23.712 8.3011Z", fill: "white" }))), h("span", null, this.label)));
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
return (h(Host, Object.assign({}, commonProps), h("span", null, this.label), h("button", { "aria-label": `Supprimer ${this.label}`, disabled: this.disabled, onClick: this.handleDismiss.bind(this), onKeyDown: this.handleKeydown.bind(this) }, h("svg", { class: "dismiss-icon", "aria-hidden": "true", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M14.2656 12.0298L19.588 6.72176C20.1908 6.12119 20.1061 5.05213 19.5034 4.45043C18.9006 3.84986 17.914 3.84986 17.3112 4.45043L11.9887 9.7596L6.66743 4.45043C6.06351 3.84986 5.07691 3.84986 4.47412 4.45043C3.87132 5.05213 3.82843 6.07942 4.43122 6.68112L9.75365 11.9892L4.43122 17.2983C3.82843 17.8989 3.87132 18.9262 4.47412 19.5279C5.07691 20.1296 6.10527 20.1702 6.70807 19.5685L12.0305 14.2605L17.3112 19.5279C17.914 20.1296 18.9006 20.1296 19.5034 19.5279C20.1061 18.9262 20.149 17.8989 19.5462 17.2983L14.2656 12.0298Z", fill: "currentColor" })))));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
static get is() { return "wcs-chip"; }
|
|
155
|
+
static get encapsulation() { return "shadow"; }
|
|
156
|
+
static get originalStyleUrls() {
|
|
157
|
+
return {
|
|
158
|
+
"$": ["chip.scss"]
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
static get styleUrls() {
|
|
162
|
+
return {
|
|
163
|
+
"$": ["chip.css"]
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
static get properties() {
|
|
167
|
+
return {
|
|
168
|
+
"value": {
|
|
169
|
+
"type": "string",
|
|
170
|
+
"mutable": false,
|
|
171
|
+
"complexType": {
|
|
172
|
+
"original": "string",
|
|
173
|
+
"resolved": "string",
|
|
174
|
+
"references": {}
|
|
175
|
+
},
|
|
176
|
+
"required": false,
|
|
177
|
+
"optional": false,
|
|
178
|
+
"docs": {
|
|
179
|
+
"tags": [],
|
|
180
|
+
"text": "Unique value representing the chip identifier in events."
|
|
181
|
+
},
|
|
182
|
+
"attribute": "value",
|
|
183
|
+
"reflect": false
|
|
184
|
+
},
|
|
185
|
+
"label": {
|
|
186
|
+
"type": "string",
|
|
187
|
+
"mutable": false,
|
|
188
|
+
"complexType": {
|
|
189
|
+
"original": "string",
|
|
190
|
+
"resolved": "string",
|
|
191
|
+
"references": {}
|
|
192
|
+
},
|
|
193
|
+
"required": false,
|
|
194
|
+
"optional": false,
|
|
195
|
+
"docs": {
|
|
196
|
+
"tags": [],
|
|
197
|
+
"text": "Text label displayed on the chip."
|
|
198
|
+
},
|
|
199
|
+
"attribute": "label",
|
|
200
|
+
"reflect": false
|
|
201
|
+
},
|
|
202
|
+
"selected": {
|
|
203
|
+
"type": "boolean",
|
|
204
|
+
"mutable": false,
|
|
205
|
+
"complexType": {
|
|
206
|
+
"original": "boolean",
|
|
207
|
+
"resolved": "boolean",
|
|
208
|
+
"references": {}
|
|
209
|
+
},
|
|
210
|
+
"required": false,
|
|
211
|
+
"optional": false,
|
|
212
|
+
"docs": {
|
|
213
|
+
"tags": [],
|
|
214
|
+
"text": "If `true`, the chip is selected.\nThis property is only used in 'selectable' mode."
|
|
215
|
+
},
|
|
216
|
+
"attribute": "selected",
|
|
217
|
+
"reflect": true,
|
|
218
|
+
"defaultValue": "false"
|
|
219
|
+
},
|
|
220
|
+
"open": {
|
|
221
|
+
"type": "boolean",
|
|
222
|
+
"mutable": false,
|
|
223
|
+
"complexType": {
|
|
224
|
+
"original": "boolean",
|
|
225
|
+
"resolved": "boolean",
|
|
226
|
+
"references": {}
|
|
227
|
+
},
|
|
228
|
+
"required": false,
|
|
229
|
+
"optional": false,
|
|
230
|
+
"docs": {
|
|
231
|
+
"tags": [],
|
|
232
|
+
"text": "If `true`, the chip is open.\nThis property is used to control the visibility of the chip in the dismissible mode.\nWhen the user clicks the dismiss icon, this property automatically becomes `false`, hiding the chip."
|
|
233
|
+
},
|
|
234
|
+
"attribute": "open",
|
|
235
|
+
"reflect": true,
|
|
236
|
+
"defaultValue": "true"
|
|
237
|
+
},
|
|
238
|
+
"disabled": {
|
|
239
|
+
"type": "boolean",
|
|
240
|
+
"mutable": false,
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "boolean",
|
|
243
|
+
"resolved": "boolean",
|
|
244
|
+
"references": {}
|
|
245
|
+
},
|
|
246
|
+
"required": false,
|
|
247
|
+
"optional": false,
|
|
248
|
+
"docs": {
|
|
249
|
+
"tags": [],
|
|
250
|
+
"text": "If `true`, the chip is disabled.\nThe chip will not respond to click events and will not emit any events.\nThis property is used in both 'selectable' and 'dismissible' modes."
|
|
251
|
+
},
|
|
252
|
+
"attribute": "disabled",
|
|
253
|
+
"reflect": true,
|
|
254
|
+
"defaultValue": "false"
|
|
255
|
+
},
|
|
256
|
+
"variant": {
|
|
257
|
+
"type": "string",
|
|
258
|
+
"mutable": false,
|
|
259
|
+
"complexType": {
|
|
260
|
+
"original": "WcsChipVariant",
|
|
261
|
+
"resolved": "\"primary\" | \"secondary\"",
|
|
262
|
+
"references": {
|
|
263
|
+
"WcsChipVariant": {
|
|
264
|
+
"location": "import",
|
|
265
|
+
"path": "./chip-interface",
|
|
266
|
+
"id": "src/components/chip/chip-interface.ts::WcsChipVariant"
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
"required": false,
|
|
271
|
+
"optional": false,
|
|
272
|
+
"docs": {
|
|
273
|
+
"tags": [],
|
|
274
|
+
"text": "Defines the visual style of the chip for the dismissible mode."
|
|
275
|
+
},
|
|
276
|
+
"attribute": "variant",
|
|
277
|
+
"reflect": true,
|
|
278
|
+
"defaultValue": "'primary'"
|
|
279
|
+
},
|
|
280
|
+
"mode": {
|
|
281
|
+
"type": "string",
|
|
282
|
+
"mutable": false,
|
|
283
|
+
"complexType": {
|
|
284
|
+
"original": "WcsChipMode",
|
|
285
|
+
"resolved": "\"dismissible\" | \"selectable\"",
|
|
286
|
+
"references": {
|
|
287
|
+
"WcsChipMode": {
|
|
288
|
+
"location": "import",
|
|
289
|
+
"path": "./chip-interface",
|
|
290
|
+
"id": "src/components/chip/chip-interface.ts::WcsChipMode"
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"required": false,
|
|
295
|
+
"optional": false,
|
|
296
|
+
"docs": {
|
|
297
|
+
"tags": [],
|
|
298
|
+
"text": "Defines the mode of the chip.\nCan be 'selectable' or 'dismissible'.\n- 'selectable': The chip can be selected and emits an event when clicked.\n- 'dismissible': The chip can be dismissed (removed) and emits an event when the dismiss icon is clicked."
|
|
299
|
+
},
|
|
300
|
+
"attribute": "mode",
|
|
301
|
+
"reflect": true,
|
|
302
|
+
"defaultValue": "'selectable'"
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
static get events() {
|
|
307
|
+
return [{
|
|
308
|
+
"method": "wcsChipSelectChange",
|
|
309
|
+
"name": "wcsChipSelectChange",
|
|
310
|
+
"bubbles": true,
|
|
311
|
+
"cancelable": true,
|
|
312
|
+
"composed": true,
|
|
313
|
+
"docs": {
|
|
314
|
+
"tags": [],
|
|
315
|
+
"text": "Emitted when the chip is clicked in 'selectable' mode."
|
|
316
|
+
},
|
|
317
|
+
"complexType": {
|
|
318
|
+
"original": "{ value: string; selected: boolean }",
|
|
319
|
+
"resolved": "{ value: string; selected: boolean; }",
|
|
320
|
+
"references": {}
|
|
321
|
+
}
|
|
322
|
+
}, {
|
|
323
|
+
"method": "wcsChipDismiss",
|
|
324
|
+
"name": "wcsChipDismiss",
|
|
325
|
+
"bubbles": true,
|
|
326
|
+
"cancelable": true,
|
|
327
|
+
"composed": true,
|
|
328
|
+
"docs": {
|
|
329
|
+
"tags": [],
|
|
330
|
+
"text": "Emitted when the dismiss icon is clicked in 'dismissible' mode."
|
|
331
|
+
},
|
|
332
|
+
"complexType": {
|
|
333
|
+
"original": "{ value: string }",
|
|
334
|
+
"resolved": "{ value: string; }",
|
|
335
|
+
"references": {}
|
|
336
|
+
}
|
|
337
|
+
}];
|
|
338
|
+
}
|
|
339
|
+
static get elementRef() { return "el"; }
|
|
340
|
+
}
|
|
341
|
+
//# sourceMappingURL=chip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chip.js","sourceRoot":"","sources":["../../../src/components/chip/chip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE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AAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAClF,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,4BAA4B;wBAC/C,YACI,CAAC,EAAC,8gBAA8gB,EAChhB,IAAI,EAAC,cAAc,GAAG,CACxB,CACD,CACN,CACV,CAAC;QACN,CAAC;IACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, ComponentInterface, EventEmitter, Prop, Event, Element, Host, h } from '@stencil/core';\nimport { WcsChipMode, WcsChipVariant } from './chip-interface';\n\n/**\n * The chip component is a small, interactive element that can be used to represent an input, filter, or tag.\n * It can be in one of two modes: 'selectable' or 'dismissible'.\n * - In 'selectable' mode, the chip can be selected or deselected, and emits an event when clicked.\n * - In 'dismissible' mode, the chip can be dismissed (removed) by clicking a dismiss icon, and emits an event when the dismiss icon is clicked.\n *\n * @cssprop --wcs-chip-height - Height of the chip\n * @cssprop --wcs-chip-font-size - Font size of the chip text\n * @cssprop --wcs-chip-font-weight - Font weight of the chip text\n *\n * @cssprop --wcs-chip-focus-outline-border-width - Border width of the chip focus outline\n *\n * @cssprop --wcs-chip-padding-vertical - Vertical padding (top - bottom) of the chip\n * @cssprop --wcs-chip-padding-horizontal - Horizontal padding (left - right) of the chip\n * @cssprop --wcs-chip-padding-horizontal-dismissible - Horizontal padding (left - right) of the chip with 'dismissible' mode\n *\n * @cssprop --wcs-chip-selectable-background-color - Background color of the chip with 'selectable' mode in default state\n * @cssprop --wcs-chip-selectable-background-color-pressed - Background color of the chip with 'selectable' mode when pressed\n * @cssprop --wcs-chip-selectable-background-color-hover - Background color of the chip with 'selectable' mode when hovered\n * @cssprop --wcs-chip-selectable-background-color-selected - Background color of the chip with 'selectable' mode when selected\n * @cssprop --wcs-chip-selectable-background-color-selected-hover - Background color of the chip with 'selectable' mode when selected and hovered\n * @cssprop --wcs-chip-selectable-background-color-selected-pressed - Background color of the chip with 'selectable' mode when selected and pressed\n * @cssprop --wcs-chip-selectable-background-color-selected-disabled - Background color of the chip with 'selectable' mode when selected and disabled\n *\n * @cssprop --wcs-chip-selectable-color - Text color of the chip with 'selectable' mode in default state\n * @cssprop --wcs-chip-selectable-color-hover - Text color of the chip with 'selectable' mode when hovered\n * @cssprop --wcs-chip-selectable-color-pressed - Text color of the chip with 'selectable' mode when pressed\n * @cssprop --wcs-chip-selectable-color-disabled - Text color of the chip with 'selectable' mode when disabled\n * @cssprop --wcs-chip-selectable-color-selected - Text color of the chip with 'selectable' mode when selected\n * @cssprop --wcs-chip-selectable-color-selected-hover - Text color of the chip with 'selectable' mode when selected and hovered\n * @cssprop --wcs-chip-selectable-color-selected-pressed - Text color of the chip with 'selectable' mode when selected and pressed\n *\n * @cssprop --wcs-chip-border-radius - Border radius of the chip\n * @cssprop --wcs-chip-border-line-width - Border line width of the chip\n * @cssprop --wcs-chip-selectable-border-color - Border color of the chip with 'selectable' mode in default state\n * @cssprop --wcs-chip-selectable-border-color-hover - Border color of the chip with 'selectable' mode when hovered\n * @cssprop --wcs-chip-selectable-border-color-pressed - Border color of the chip with 'selectable' mode when pressed\n * @cssprop --wcs-chip-selectable-border-color-disabled - Border color of the chip with 'selectable' mode when disabled\n *\n * @cssprop --wcs-chip-selectable-content-gap - Gap between content elements in chip with 'selectable' mode\n * @cssprop --wcs-chip-selectable-focus-outline-color - Focus outline color of the chip with 'selectable' mode\n *\n * @cssprop --wcs-chip-dismissible-content-gap - Gap between content elements in chip with 'dismissible' mode\n * @cssprop --wcs-chip-dismissible-padding-right - Right padding of the chip with 'dismissible' mode\n * @cssprop --wcs-chip-dismissible-button-outline-radius - Outline radius of the button for the chip with 'dismissible' mode\n *\n * @cssprop --wcs-chip-dismissible-primary-focus-outline-color - Focus outline color of the chip with 'dismissible' mode and 'primary' variant\n * @cssprop --wcs-chip-dismissible-primary-border-color - Border color of the chip with 'dismissible' mode and 'primary' variant\n * @cssprop --wcs-chip-dismissible-primary-border-color-disabled - Border color of the chip with 'dismissible' mode and 'primary' variant when disabled\n * @cssprop --wcs-chip-dismissible-primary-color - Text color of the chip with 'dismissible' mode and 'primary' variant\n * @cssprop --wcs-chip-dismissible-primary-color-hover - Text color of the chip with 'dismissible' mode and 'primary' variant when hovered\n * @cssprop --wcs-chip-dismissible-primary-color-pressed - Text color of the chip with 'dismissible' mode and 'primary' variant when pressed\n * @cssprop --wcs-chip-dismissible-primary-color-disabled - Text color of the chip with 'dismissible' mode and 'primary' variant when disabled\n * @cssprop --wcs-chip-dismissible-primary-background-color - Background color of the chip with 'dismissible' mode and 'primary' variant\n * @cssprop --wcs-chip-dismissible-primary-background-color-hover - Background color of the chip with 'dismissible' mode and 'primary' variant when hovered\n * @cssprop --wcs-chip-dismissible-primary-background-color-pressed - Background color of the chip with 'dismissible' mode and 'primary' variant when pressed\n * @cssprop --wcs-chip-dismissible-primary-background-color-disabled - Background color of the chip with 'dismissible' mode and 'primary' variant when disabled\n *\n * @cssprop --wcs-chip-dismissible-secondary-button-focus-outline-color - Button focus outline color of the chip with 'dismissible' mode and 'secondary' variant\n * @cssprop --wcs-chip-dismissible-secondary-border-color - Border color of the chip with 'dismissible' mode and 'secondary' variant\n * @cssprop --wcs-chip-dismissible-secondary-border-color-disabled - Border color of the chip with 'dismissible' mode and 'secondary' variant when disabled\n * @cssprop --wcs-chip-dismissible-secondary-color - Text color of the chip with 'dismissible' mode and 'secondary' variant\n * @cssprop --wcs-chip-dismissible-secondary-color-disabled - Text color of the chip with 'dismissible' mode and 'secondary' variant when disabled\n * @cssprop --wcs-chip-dismissible-secondary-background-color - Background color of the chip with 'dismissible' mode and 'secondary' variant\n * @cssprop --wcs-chip-dismissible-secondary-button-background-color - Button background color of the chip with 'dismissible' mode and 'secondary' variant\n * @cssprop --wcs-chip-dismissible-secondary-button-background-color-hover - Button background color of the chip with 'dismissible' mode and 'secondary' variant when hovered\n * @cssprop --wcs-chip-dismissible-secondary-button-background-color-pressed - Button background color of the chip with 'dismissible' mode and 'secondary' variant when pressed\n * @cssprop --wcs-chip-dismissible-secondary-button-background-color-disabled - Button background color of the chip with 'dismissible' mode and 'secondary' variant when disabled\n */\n@Component({\n tag: 'wcs-chip',\n styleUrl: 'chip.scss',\n shadow: true\n})\nexport class Chip implements ComponentInterface {\n @Element() el!: HTMLWcsChipElement;\n /**\n * Unique value representing the chip identifier in events.\n */\n @Prop() value: string;\n\n /**\n * Text label displayed on the chip.\n */\n @Prop() label: string;\n\n /**\n * If `true`, the chip is selected.\n * This property is only used in 'selectable' mode.\n */\n @Prop({ reflect: true }) selected = false;\n\n /**\n * If `true`, the chip is open.\n * This property is used to control the visibility of the chip in the dismissible mode.\n * When the user clicks the dismiss icon, this property automatically becomes `false`, hiding the chip.\n */\n @Prop({ reflect: true }) open = true;\n\n /**\n * If `true`, the chip is disabled.\n * The chip will not respond to click events and will not emit any events.\n * This property is used in both 'selectable' and 'dismissible' modes.\n */\n @Prop({ reflect: true }) disabled = false;\n\n /**\n * Defines the visual style of the chip for the dismissible mode.\n */\n @Prop({ reflect: true }) variant: WcsChipVariant = 'primary';\n\n /**\n * Defines the mode of the chip.\n * Can be 'selectable' or 'dismissible'.\n * - 'selectable': The chip can be selected and emits an event when clicked.\n * - 'dismissible': The chip can be dismissed (removed) and emits an event when the dismiss icon is clicked.\n */\n @Prop({ reflect: true }) mode: WcsChipMode = 'selectable';\n\n /**\n * Emitted when the chip is clicked in 'selectable' mode.\n */\n @Event() wcsChipSelectChange: EventEmitter<{ value: string; selected: boolean }>;\n\n /**\n * Emitted when the dismiss icon is clicked in 'dismissible' mode.\n */\n @Event() wcsChipDismiss: EventEmitter<{ value: string }>;\n\n\n private select() {\n this.selected = !this.selected; // Toggle the selected state\n this.wcsChipSelectChange.emit({ value: this.value, selected: this.selected });\n }\n\n private dismiss() {\n this.open = false;\n this.wcsChipDismiss.emit({ value: this.value });\n this.focusNextChip();\n }\n\n private focusNextChip(): void {\n let currentElement = this.el.nextElementSibling;\n\n while (currentElement) {\n if (this.isActionableChip(currentElement)) {\n this.focusChip(currentElement as HTMLWcsChipElement);\n return;\n }\n currentElement = currentElement.nextElementSibling;\n }\n }\n\n private isActionableChip(element: Element | null): element is HTMLWcsChipElement {\n return element instanceof HTMLElement\n && element.tagName === 'WCS-CHIP'\n && !(element as HTMLWcsChipElement).disabled;\n }\n\n private focusChip(chip: HTMLWcsChipElement): void {\n if (chip.mode === 'selectable') {\n chip.focus();\n } else if (chip.mode === 'dismissible') {\n chip.shadowRoot?.querySelector('button')?.focus();\n }\n }\n\n private handleClick() {\n if (this.disabled || this.mode !== 'selectable') {\n return;\n }\n this.select();\n };\n\n private handleDismiss = (event: Event) => {\n if (this.disabled || this.mode !== 'dismissible') {\n return;\n }\n event.stopPropagation(); // Prevent the click event from bubbling up to the chip click handler\n this.dismiss();\n };\n\n private handleKeydown(ev) {\n if (this.disabled) {\n return;\n }\n if (this.mode === 'selectable') {\n if (ev.key === 'Enter' || ev.key === ' ') {\n this.select();\n }\n } else if (this.mode === 'dismissible') {\n if (ev.key === 'Delete' || ev.key === 'Backspace') {\n this.dismiss();\n }\n }\n }\n\n render() {\n const commonProps = {\n 'aria-disabled': this.disabled ? 'true' : null\n };\n\n if (this.mode === 'selectable') {\n return (\n <Host\n {...commonProps}\n role=\"checkbox\"\n aria-checked={this.selected ? 'true' : 'false'}\n tabindex={this.disabled ? -1 : 0}\n onClick={this.handleClick.bind(this)}\n onKeyDown={this.handleKeydown.bind(this)}\n >\n {this.selected && (\n <svg class=\"check-icon\" aria-hidden=\"true\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\"\n fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M23.712 8.3011L8.0292 23.7157C7.6356 24.095 6.9984 24.095 6.6264 23.7157L0.288 17.4955C-0.096 17.1226 -0.096 16.496 0.288 16.1192L2.1552 14.2739C2.5536 13.9036 3.1776 13.9036 3.5532 14.2739L6.6264 17.2764C6.9984 17.6583 7.6356 17.6583 8.0292 17.2764L20.4384 5.08081C20.8236 4.70662 21.4536 4.70662 21.8364 5.08081L23.712 6.91841C24.096 7.29516 24.096 7.91923 23.712 8.3011Z\"\n fill=\"white\" />\n </svg>\n )}\n <span>{this.label}</span>\n </Host>\n );\n } else {\n return (\n <Host\n {...commonProps}\n >\n <span>{this.label}</span>\n <button\n aria-label={`Supprimer ${this.label}`}\n disabled={this.disabled}\n onClick={this.handleDismiss.bind(this)}\n onKeyDown={this.handleKeydown.bind(this)}\n >\n <svg class=\"dismiss-icon\" aria-hidden=\"true\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\"\n fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M14.2656 12.0298L19.588 6.72176C20.1908 6.12119 20.1061 5.05213 19.5034 4.45043C18.9006 3.84986 17.914 3.84986 17.3112 4.45043L11.9887 9.7596L6.66743 4.45043C6.06351 3.84986 5.07691 3.84986 4.47412 4.45043C3.87132 5.05213 3.82843 6.07942 4.43122 6.68112L9.75365 11.9892L4.43122 17.2983C3.82843 17.8989 3.87132 18.9262 4.47412 19.5279C5.07691 20.1296 6.10527 20.1702 6.70807 19.5685L12.0305 14.2605L17.3112 19.5279C17.914 20.1296 18.9006 20.1296 19.5034 19.5279C20.1061 18.9262 20.149 17.8989 19.5462 17.2983L14.2656 12.0298Z\"\n fill=\"currentColor\" />\n </svg>\n </button>\n </Host>\n );\n }\n }\n}\n\n"]}
|
|
@@ -61,6 +61,21 @@
|
|
|
61
61
|
line-height: var(--wcs-com-nav-app-name-line-height);
|
|
62
62
|
color: var(--wcs-com-nav-app-name-color);
|
|
63
63
|
}
|
|
64
|
+
:host .app-name ::slotted(a) {
|
|
65
|
+
user-select: none;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
text-decoration: none;
|
|
68
|
+
color: inherit;
|
|
69
|
+
font-weight: inherit;
|
|
70
|
+
}
|
|
71
|
+
:host .app-name ::slotted(a:focus-visible) {
|
|
72
|
+
outline: none;
|
|
73
|
+
}
|
|
74
|
+
:host .app-name:focus-within {
|
|
75
|
+
outline: var(--wcs-semantic-border-width-large) dashed var(--wcs-com-nav-focus-outline-color);
|
|
76
|
+
outline-offset: var(--wcs-semantic-spacing-small);
|
|
77
|
+
border-radius: 0.1rem;
|
|
78
|
+
}
|
|
64
79
|
:host .menu-bar {
|
|
65
80
|
display: none;
|
|
66
81
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
beforeEach(async () => {
|
|
1
|
+
import { setWcsContent } from "../../utils/playwright/test";
|
|
2
|
+
import { test } from "@stencil/playwright";
|
|
3
|
+
import { expect } from "@playwright/test";
|
|
4
|
+
test.describe('Com nav', () => {
|
|
5
|
+
test.describe('Keyboard navigation', () => {
|
|
6
|
+
test.describe('Mobile menu', () => {
|
|
7
|
+
test.beforeEach(async ({ page }) => {
|
|
8
8
|
// Given
|
|
9
|
-
|
|
10
|
-
await page.setViewport({
|
|
9
|
+
await page.setViewportSize({
|
|
11
10
|
width: 320,
|
|
12
11
|
height: 480,
|
|
13
12
|
});
|
|
@@ -65,49 +64,67 @@ describe('Com nav', () => {
|
|
|
65
64
|
</wcs-com-nav>
|
|
66
65
|
`);
|
|
67
66
|
});
|
|
68
|
-
|
|
69
|
-
// Given the content is set in beforeEach method
|
|
67
|
+
test('should open menu when press Enter key on mobile menu icon', async ({ page }) => {
|
|
70
68
|
// When
|
|
71
|
-
const menuIcon =
|
|
69
|
+
const menuIcon = page.locator('wcs-com-nav #mobile-menu-icon');
|
|
72
70
|
await menuIcon.focus();
|
|
73
|
-
await page.keyboard.press(
|
|
71
|
+
await page.keyboard.press('Enter');
|
|
74
72
|
await page.waitForChanges();
|
|
75
73
|
// Then
|
|
76
|
-
const menu =
|
|
77
|
-
expect(menu).
|
|
78
|
-
expect(menu).toHaveAttribute('data-mobile-open');
|
|
74
|
+
const menu = page.locator('wcs-com-nav .mobile-overlay');
|
|
75
|
+
await expect(menu).toHaveAttribute('data-mobile-open');
|
|
79
76
|
});
|
|
80
|
-
|
|
77
|
+
test('should open menu when press Space key on mobile menu icon', async ({ page }) => {
|
|
78
|
+
// When
|
|
79
|
+
const menuIcon = page.locator('wcs-com-nav #mobile-menu-icon');
|
|
80
|
+
await menuIcon.focus();
|
|
81
|
+
await page.keyboard.press('Space');
|
|
82
|
+
await page.waitForChanges();
|
|
83
|
+
// Then
|
|
84
|
+
const menu = page.locator('wcs-com-nav .mobile-overlay');
|
|
85
|
+
await expect(menu).toHaveAttribute('data-mobile-open');
|
|
86
|
+
});
|
|
87
|
+
test('should close menu when it opens and press Enter key on mobile menu icon', async ({ page }) => {
|
|
81
88
|
// Given
|
|
82
|
-
|
|
83
|
-
const menuIcon = await page.find('wcs-com-nav >>> #mobile-menu-icon');
|
|
89
|
+
const menuIcon = page.locator('wcs-com-nav #mobile-menu-icon');
|
|
84
90
|
await menuIcon.focus();
|
|
85
|
-
await page.keyboard.press(
|
|
86
|
-
// Wait for menu to open
|
|
91
|
+
await page.keyboard.press('Enter');
|
|
87
92
|
await page.waitForChanges();
|
|
88
93
|
// Close the menu
|
|
89
|
-
await page.keyboard.press(
|
|
94
|
+
await page.keyboard.press('Enter');
|
|
90
95
|
await page.waitForChanges();
|
|
91
96
|
// Then
|
|
92
|
-
const menu =
|
|
93
|
-
expect(menu).not.toHaveAttribute('data-mobile-open');
|
|
97
|
+
const menu = page.locator('wcs-com-nav .mobile-overlay');
|
|
98
|
+
await expect(menu).not.toHaveAttribute('data-mobile-open');
|
|
94
99
|
});
|
|
95
|
-
|
|
100
|
+
test('should close menu when it opens and press Space key on mobile menu icon', async ({ page }) => {
|
|
96
101
|
// Given
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
await
|
|
102
|
+
const menuIcon = page.locator('wcs-com-nav #mobile-menu-icon');
|
|
103
|
+
await menuIcon.focus();
|
|
104
|
+
await page.keyboard.press('Space');
|
|
105
|
+
await page.waitForChanges();
|
|
106
|
+
// Close the menu
|
|
107
|
+
await page.keyboard.press('Space');
|
|
108
|
+
await page.waitForChanges();
|
|
109
|
+
// Then
|
|
110
|
+
const menu = page.locator('wcs-com-nav .mobile-overlay');
|
|
111
|
+
await expect(menu).not.toHaveAttribute('data-mobile-open');
|
|
112
|
+
});
|
|
113
|
+
test('should be touchable on mobile and open the menu', async ({ page }) => {
|
|
114
|
+
// Given
|
|
115
|
+
const menuIcon = page.locator('wcs-com-nav #mobile-menu-icon');
|
|
116
|
+
await menuIcon.click();
|
|
117
|
+
await page.waitForChanges();
|
|
100
118
|
// Then
|
|
101
|
-
const menu =
|
|
102
|
-
expect(menu).
|
|
103
|
-
expect(menu).toHaveAttribute('data-mobile-open');
|
|
119
|
+
const menu = page.locator('wcs-com-nav .mobile-overlay');
|
|
120
|
+
await expect(menu).toHaveAttribute('data-mobile-open');
|
|
104
121
|
});
|
|
105
|
-
|
|
122
|
+
test('should close menu when it opens and press escape key anywhere', async ({ page }) => {
|
|
106
123
|
// Given
|
|
107
|
-
|
|
108
|
-
const menuIcon = await page.find('wcs-com-nav >>> #mobile-menu-icon');
|
|
124
|
+
const menuIcon = page.locator('wcs-com-nav #mobile-menu-icon');
|
|
109
125
|
await menuIcon.focus();
|
|
110
126
|
await page.keyboard.press('Enter');
|
|
127
|
+
await page.waitForChanges();
|
|
111
128
|
// When
|
|
112
129
|
// Navigate on menu
|
|
113
130
|
await page.keyboard.press('Tab');
|
|
@@ -116,24 +133,23 @@ describe('Com nav', () => {
|
|
|
116
133
|
await page.keyboard.press('Escape');
|
|
117
134
|
await page.waitForChanges();
|
|
118
135
|
// Then
|
|
119
|
-
const menu =
|
|
120
|
-
expect(menu).not.toHaveAttribute('data-mobile-open');
|
|
136
|
+
const menu = page.locator('wcs-com-nav .mobile-overlay');
|
|
137
|
+
await expect(menu).not.toHaveAttribute('data-mobile-open');
|
|
121
138
|
});
|
|
122
|
-
|
|
139
|
+
test('should close the mobile menu when clicking on a wcs-com-nav-item', async ({ page }) => {
|
|
123
140
|
// Given
|
|
124
|
-
const menuIcon =
|
|
125
|
-
await menuIcon.
|
|
126
|
-
// Wait for menu to open
|
|
141
|
+
const menuIcon = page.locator('wcs-com-nav #mobile-menu-icon');
|
|
142
|
+
await menuIcon.click();
|
|
127
143
|
await page.waitForChanges();
|
|
128
144
|
// When
|
|
129
|
-
const navItem =
|
|
145
|
+
const navItem = page.locator('#com-nav-item-last-item');
|
|
130
146
|
await navItem.click();
|
|
131
147
|
await page.waitForChanges();
|
|
132
148
|
// Then
|
|
133
|
-
const menu =
|
|
134
|
-
expect(menu).not.toHaveAttribute('data-mobile-open');
|
|
149
|
+
const menu = page.locator('wcs-com-nav .mobile-overlay');
|
|
150
|
+
await expect(menu).not.toHaveAttribute('data-mobile-open');
|
|
135
151
|
});
|
|
136
152
|
});
|
|
137
153
|
});
|
|
138
154
|
});
|
|
139
|
-
//# sourceMappingURL=com-nav.e2e.js.map
|
|
155
|
+
//# sourceMappingURL=com-nav.e2e.playwright.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"com-nav.e2e.playwright.js","sourceRoot":"","sources":["../../../src/components/com-nav/com-nav.e2e.playwright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAW,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IAC1B,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACtC,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;YAC9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,cAAc,EAAE,CAAC;gBAE5B,OAAO;gBACP,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;gBACzD,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;YAC/D,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,kEAAkE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAqB,EAAE,EAAE;gBAC3G,QAAQ;gBACR,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,+BAA+B,CAAC,CAAC;gBAC/D,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACvB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;gBAE5B,OAAO;gBACP,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;gBACxD,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;gBACtB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;gBAE5B,OAAO;gBACP,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;gBACzD,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;YAC/D,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["import { setWcsContent } from '../../utils/playwright/test';\nimport { test, E2EPage } from \"@stencil/playwright\";\n\nimport { expect } from \"@playwright/test\";\n\ntest.describe('Com nav', () => {\n test.describe('Keyboard navigation', () => {\n test.describe('Mobile menu', () => {\n test.beforeEach(async ({ page }: { page: E2EPage }) => {\n // Given\n await page.setViewportSize({\n width: 320,\n height: 480,\n });\n\n await setWcsContent(page, `\n <wcs-com-nav app-name=\"App Test\">\n <wcs-com-nav-submenu label=\"Sous menu\" panel-title=\"Sous Menu\"\n panel-description=\"Nullam id dolor id nibh ultricies vehicula ut id elit. Cras mattis consectetur purus sit amet fermentum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.\">\n <wcs-com-nav-item>\n <a href=\"#\">Loisirs & Tourisme</a>\n </wcs-com-nav-item>\n <wcs-com-nav-item>\n <a href=\"#\">Toutes les lignes</a>\n </wcs-com-nav-item>\n <wcs-com-nav-item>\n <a href=\"#\">Services mobiles</a>\n </wcs-com-nav-item>\n <wcs-com-nav-item>\n <a href=\"#\">Au quotidien</a>\n </wcs-com-nav-item>\n <wcs-com-nav-item>\n <a href=\"#\">Le réseau</a>\n </wcs-com-nav-item>\n </wcs-com-nav-submenu>\n <wcs-com-nav-submenu label=\"Autre sous menu\" panel-title=\"Autre Sous Menu\"\n panel-description=\"Un autre sous menu avec des catégories. Cras mattis consectetur purus sit amet fermentum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.\">\n <wcs-com-nav-item>\n <a href=\"#\">Le réseau</a>\n </wcs-com-nav-item>\n <wcs-com-nav-category label=\"Une catégorie\">\n <wcs-com-nav-item>\n <a href=\"#\">Services mobiles text plus long</a>\n </wcs-com-nav-item>\n <wcs-com-nav-item>\n <a href=\"#\">Au quotidien</a>\n </wcs-com-nav-item>\n <wcs-com-nav-item>\n <a href=\"#\">Le réseau</a>\n </wcs-com-nav-item>\n </wcs-com-nav-category>\n <wcs-com-nav-category label=\"Une catégorie\">\n <wcs-com-nav-item>\n <a href=\"#\">1</a>\n </wcs-com-nav-item>\n <wcs-com-nav-item>\n <a href=\"#\">2</a>\n </wcs-com-nav-item>\n </wcs-com-nav-category>\n </wcs-com-nav-submenu>\n <wcs-com-nav-item id=\"com-nav-item-last-item\">\n <a href=\"https://sncf.com\" target=\"_blank\">Ressource externe</a>\n </wcs-com-nav-item>\n <div slot=\"actions\">\n <wcs-button mode=\"clear\" class=\"wcs-dark\">Connexion</wcs-button>\n </div>\n </wcs-com-nav>\n `);\n });\n\n test('should open menu when press Enter key on mobile menu icon', async ({ page }: { page: E2EPage }) => {\n // When\n const menuIcon = page.locator('wcs-com-nav #mobile-menu-icon');\n await menuIcon.focus();\n await page.keyboard.press('Enter');\n await page.waitForChanges();\n\n // Then\n const menu = page.locator('wcs-com-nav .mobile-overlay');\n await expect(menu).toHaveAttribute('data-mobile-open');\n });\n\n test('should open menu when press Space key on mobile menu icon', async ({ page }: { page: E2EPage }) => {\n // When\n const menuIcon = page.locator('wcs-com-nav #mobile-menu-icon');\n await menuIcon.focus();\n await page.keyboard.press('Space');\n await page.waitForChanges();\n\n // Then\n const menu = page.locator('wcs-com-nav .mobile-overlay');\n await expect(menu).toHaveAttribute('data-mobile-open');\n });\n\n test('should close menu when it opens and press Enter key on mobile menu icon', async ({ page }: { page: E2EPage }) => {\n // Given\n const menuIcon = page.locator('wcs-com-nav #mobile-menu-icon');\n await menuIcon.focus();\n await page.keyboard.press('Enter');\n await page.waitForChanges();\n\n // Close the menu\n await page.keyboard.press('Enter');\n await page.waitForChanges();\n\n // Then\n const menu = page.locator('wcs-com-nav .mobile-overlay');\n await expect(menu).not.toHaveAttribute('data-mobile-open');\n });\n\n test('should close menu when it opens and press Space key on mobile menu icon', async ({ page }: { page: E2EPage }) => {\n // Given\n const menuIcon = page.locator('wcs-com-nav #mobile-menu-icon');\n await menuIcon.focus();\n await page.keyboard.press('Space');\n await page.waitForChanges();\n\n // Close the menu\n await page.keyboard.press('Space');\n await page.waitForChanges();\n\n // Then\n const menu = page.locator('wcs-com-nav .mobile-overlay');\n await expect(menu).not.toHaveAttribute('data-mobile-open');\n });\n\n test('should be touchable on mobile and open the menu', async ({ page }: { page: E2EPage }) => {\n // Given\n const menuIcon = page.locator('wcs-com-nav #mobile-menu-icon');\n await menuIcon.click();\n await page.waitForChanges();\n\n // Then\n const menu = page.locator('wcs-com-nav .mobile-overlay');\n await expect(menu).toHaveAttribute('data-mobile-open');\n });\n\n test('should close menu when it opens and press escape key anywhere', async ({ page }: { page: E2EPage }) => {\n // Given\n const menuIcon = page.locator('wcs-com-nav #mobile-menu-icon');\n await menuIcon.focus();\n await page.keyboard.press('Enter');\n await page.waitForChanges();\n\n // When\n // Navigate on menu\n await page.keyboard.press('Tab');\n await page.keyboard.press('Tab');\n await page.keyboard.press('Tab');\n await page.keyboard.press('Escape');\n await page.waitForChanges();\n\n // Then\n const menu = page.locator('wcs-com-nav .mobile-overlay');\n await expect(menu).not.toHaveAttribute('data-mobile-open');\n });\n\n test('should close the mobile menu when clicking on a wcs-com-nav-item', async ({ page }: { page: E2EPage }) => {\n // Given\n const menuIcon = page.locator('wcs-com-nav #mobile-menu-icon');\n await menuIcon.click();\n await page.waitForChanges();\n\n // When\n const navItem = page.locator('#com-nav-item-last-item');\n await navItem.click();\n await page.waitForChanges();\n\n // Then\n const menu = page.locator('wcs-com-nav .mobile-overlay');\n await expect(menu).not.toHaveAttribute('data-mobile-open');\n });\n });\n });\n});\n"]}
|
|
@@ -78,11 +78,11 @@ export class ComNav {
|
|
|
78
78
|
}
|
|
79
79
|
render() {
|
|
80
80
|
const menuAriaLabel = this.inheritedAttributes['aria-label'] || undefined;
|
|
81
|
-
return (h(Host, { key: 'b39ff3dbd6d304ad0252e0fcfd2e0c5716b666db' }, h("div", { key: 'f84b73c9cee6295a7776576afeb61b65b71ea34e', class: "container" }, h("div", { key: 'a39b867e9d102abb4e4c13503a544681cd9b7fd8', class: "container-left" }, h("div", { key: '49db5dd80f097a9b2ccaf39fc64be9f6100108be', class: "app-name" }, this.appName, h("slot", { key: '
|
|
81
|
+
return (h(Host, { key: 'b39ff3dbd6d304ad0252e0fcfd2e0c5716b666db' }, h("div", { key: 'f84b73c9cee6295a7776576afeb61b65b71ea34e', class: "container" }, h("div", { key: 'a39b867e9d102abb4e4c13503a544681cd9b7fd8', class: "container-left" }, h("div", { key: '49db5dd80f097a9b2ccaf39fc64be9f6100108be', class: "app-name" }, this.appName, h("slot", { key: '3cfe05e6e510826ffd2168e6edc3380bc92ad459', name: "app-name" })), this.currentActiveSizing === 'desktop' ?
|
|
82
82
|
h("nav", Object.assign({ role: "navigation" }, this.inheritedAttributes), h("div", { class: "menu-bar", role: "list" }, this.currentActiveSizing === 'desktop'
|
|
83
83
|
? h("slot", null)
|
|
84
84
|
: null))
|
|
85
|
-
: null), h("div", { key: '
|
|
85
|
+
: null), h("div", { key: '83496cccd32eec07f5a508dbf36b591442e668e2', class: "container-right" }, h("slot", { key: 'cf68946afcefa0b77fb57019f9734e5ff1e763aa', name: "actions" }), this.currentActiveSizing === 'mobile' ?
|
|
86
86
|
h("nav", Object.assign({ id: "wcs-com-nav-mobile-menu", role: "navigation" }, this.inheritedAttributes), h("button", { id: "mobile-menu-icon", "aria-label": menuAriaLabel, "aria-expanded": this.mobileMenuOpen ? "true" : "false", "aria-controls": "wcs-com-nav-mobile-menu", onClick: () => this.mobileMenuIconClick() }), this.currentActiveSizing === 'mobile'
|
|
87
87
|
? h("div", { class: "mobile-overlay", "data-mobile-open": this.mobileMenuOpen, role: "list" }, h("slot", null))
|
|
88
88
|
: null)
|
|
@@ -143,7 +143,7 @@ export class ComNav {
|
|
|
143
143
|
"signature": "(attr: AriaAttributeName, value: string | null | undefined) => Promise<void>",
|
|
144
144
|
"parameters": [{
|
|
145
145
|
"name": "attr",
|
|
146
|
-
"type": "
|
|
146
|
+
"type": "`aria-${string}` | \"role\"",
|
|
147
147
|
"docs": ""
|
|
148
148
|
}, {
|
|
149
149
|
"name": "value",
|