@eunomia/elements 1.0.0-beta.6 → 1.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cdn/components/chunks/{chunk-KDN4O5W2.js → chunk-32L2QYWQ.js} +5 -5
- package/dist/cdn/components/chunks/{chunk-JYIIWN2P.js → chunk-36KLGY6U.js} +8 -8
- package/dist/cdn/components/chunks/chunk-3BMACIDO.js +1 -0
- package/dist/cdn/components/chunks/{chunk-2Y2EU2CI.js → chunk-3UUZM7X2.js} +1 -1
- package/dist/cdn/components/chunks/chunk-55PUDL7D.js +109 -0
- package/dist/cdn/components/chunks/chunk-5LA5DQMP.js +1 -0
- package/dist/cdn/components/chunks/chunk-5LXGJVJR.js +1 -0
- package/dist/cdn/components/chunks/{chunk-ZKZV2YG5.js → chunk-5XPOGBPL.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-LMVW522V.js → chunk-62RLISRD.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-PMPSJG5V.js → chunk-6FYW5TQU.js} +3 -3
- package/dist/cdn/components/chunks/chunk-6TIEBY34.js +1 -0
- package/dist/cdn/components/chunks/{chunk-MOMYII3P.js → chunk-AH2SKZ7T.js} +14 -1
- package/dist/cdn/components/chunks/chunk-AK2DIJX7.js +1 -0
- package/dist/cdn/components/chunks/chunk-B5XMGWM7.js +10 -0
- package/dist/cdn/components/chunks/chunk-GVS6IUKC.js +1 -0
- package/dist/cdn/components/chunks/chunk-GWLD2I3P.js +8 -0
- package/dist/cdn/components/chunks/{chunk-UDVB4LAE.js → chunk-I4ERDXSM.js} +5 -3
- package/dist/cdn/components/chunks/{chunk-QZ5SHR3I.js → chunk-J3SZBXM6.js} +2 -2
- package/dist/cdn/components/chunks/chunk-JAGZL7JH.js +1 -0
- package/dist/cdn/components/chunks/{chunk-VYFR364B.js → chunk-LD35BFNK.js} +18 -17
- package/dist/cdn/components/chunks/{chunk-XDPRWUKN.js → chunk-MQQJ6DID.js} +1 -1
- package/dist/cdn/components/chunks/chunk-P6LGU3FT.js +1 -0
- package/dist/cdn/components/chunks/chunk-QL5GSW2A.js +1 -0
- package/dist/cdn/components/chunks/{chunk-UYZR4JXZ.js → chunk-QSZO4GIH.js} +45 -9
- package/dist/cdn/components/chunks/{chunk-7KKWYPHY.js → chunk-QXQ25SQS.js} +21 -19
- package/dist/cdn/components/chunks/{chunk-SZYEBMG6.js → chunk-QYB6Z6FG.js} +5 -5
- package/dist/cdn/components/chunks/{chunk-RIFF2D2F.js → chunk-RGC3I6MK.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-L2ADCEN7.js → chunk-SVGWCKWT.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-N6ZW5CDN.js → chunk-TCSB2MLU.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-MQQ4BGVJ.js → chunk-TFTRCIIK.js} +7 -6
- package/dist/cdn/components/chunks/chunk-TLBXTBMM.js +46 -0
- package/dist/cdn/components/chunks/chunk-UVHVQRPT.js +1 -0
- package/dist/cdn/components/chunks/chunk-WIUERJII.js +1 -0
- package/dist/cdn/components/chunks/chunk-WW4BTWMH.js +1 -0
- package/dist/cdn/components/eun-alert.js +13 -6
- package/dist/cdn/components/eun-animate.js +6 -6
- package/dist/cdn/components/eun-badge.js +1 -1
- package/dist/cdn/components/eun-button.js +1 -1
- package/dist/cdn/components/eun-calendar.js +2 -2
- package/dist/cdn/components/eun-card.js +4 -4
- package/dist/cdn/components/eun-carousel.js +26 -22
- package/dist/cdn/components/eun-check-card.js +1 -1
- package/dist/cdn/components/eun-checkbox-list.js +11 -8
- package/dist/cdn/components/eun-checkbox.js +1 -1
- package/dist/cdn/components/eun-chip.js +17 -11
- package/dist/cdn/components/eun-collapse.js +1 -1
- package/dist/cdn/components/eun-color-picker.js +74 -69
- package/dist/cdn/components/eun-counter.js +16 -14
- package/dist/cdn/components/eun-date-picker.js +67 -63
- package/dist/cdn/components/eun-description-list.js +2 -2
- package/dist/cdn/components/eun-divider.js +3 -3
- package/dist/cdn/components/eun-drawer.js +21 -22
- package/dist/cdn/components/eun-dropdown-button.js +1 -1
- package/dist/cdn/components/eun-dropdown-item.js +3 -3
- package/dist/cdn/components/eun-fab.js +2 -2
- package/dist/cdn/components/eun-icon.js +1 -1
- package/dist/cdn/components/eun-image-card.js +1 -1
- package/dist/cdn/components/eun-image-carousel.js +10 -10
- package/dist/cdn/components/eun-infinite-list.js +1 -1
- package/dist/cdn/components/eun-input-file.js +21 -21
- package/dist/cdn/components/eun-input-phone.js +16 -12
- package/dist/cdn/components/eun-input.js +1 -1
- package/dist/cdn/components/eun-link.js +59 -13
- package/dist/cdn/components/eun-loader.js +1 -1
- package/dist/cdn/components/eun-modal.js +33 -23
- package/dist/cdn/components/eun-pagination.js +16 -16
- package/dist/cdn/components/eun-password-strength.js +14 -10
- package/dist/cdn/components/eun-radio-card.js +1 -1
- package/dist/cdn/components/eun-radio-list.js +11 -8
- package/dist/cdn/components/eun-radio.js +1 -1
- package/dist/cdn/components/eun-rating.js +276 -0
- package/dist/cdn/components/eun-scheduler-event-editor.js +11 -11
- package/dist/cdn/components/eun-scheduler-event.js +1 -1
- package/dist/cdn/components/eun-scheduler.js +28 -28
- package/dist/cdn/components/eun-search.js +36 -32
- package/dist/cdn/components/eun-select.js +27 -27
- package/dist/cdn/components/eun-sidebar.js +73 -26
- package/dist/cdn/components/eun-skeleton.js +1 -1
- package/dist/cdn/components/eun-slider.js +3 -3
- package/dist/cdn/components/eun-sliding-card.js +1 -1
- package/dist/cdn/components/eun-step.js +5 -4
- package/dist/cdn/components/eun-stepper.js +30 -30
- package/dist/cdn/components/eun-switch.js +1 -1
- package/dist/cdn/components/eun-tab-group.js +4 -4
- package/dist/cdn/components/eun-tab-panel.js +1 -1
- package/dist/cdn/components/eun-tab.js +1 -1
- package/dist/cdn/components/eun-table-action-bar.js +1 -1
- package/dist/cdn/components/eun-table.js +2 -2
- package/dist/cdn/components/eun-tag.js +3 -3
- package/dist/cdn/components/eun-textarea.js +36 -28
- package/dist/cdn/components/eun-time-picker.js +31 -28
- package/dist/cdn/components/eun-toast.js +24 -15
- package/dist/cdn/components/eun-toggle-group.js +75 -37
- package/dist/cdn/components/eun-toggle-item.js +9 -9
- package/dist/cdn/components/eun-toggle.js +2 -2
- package/dist/cdn/components/eun-toolbar.js +22 -22
- package/dist/cdn/components/eun-tooltip.js +6 -6
- package/dist/cdn/styles/eunomia-themes.css +1 -1
- package/dist/cdn/styles/themes/mixins/eunomia-neutrals.mixin.scss +6 -2
- package/dist/cdn/styles/themes/prebuilt-themes/eunomia/eunomia-dark.mixin.scss +6 -2
- package/dist/cdn/styles/themes/prebuilt-themes/eunomia/eunomia.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/fire/eunomia-fire-dark.mixin.scss +6 -2
- package/dist/cdn/styles/themes/prebuilt-themes/fire/eunomia-fire.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/forest/eunomia-forest-dark.mixin.scss +6 -2
- package/dist/cdn/styles/themes/prebuilt-themes/forest/eunomia-forest.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/gold/eunomia-gold-dark.mixin.scss +6 -2
- package/dist/cdn/styles/themes/prebuilt-themes/gold/eunomia-gold.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/ocean/eunomia-ocean-dark.mixin.scss +6 -2
- package/dist/cdn/styles/themes/prebuilt-themes/ocean/eunomia-ocean.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/salmon/eunomia-salmon-dark.mixin.scss +6 -2
- package/dist/cdn/styles/themes/prebuilt-themes/salmon/eunomia-salmon.theme.css +1 -1
- package/dist/cdn/styles/themes/prebuilt-themes/violet/eunomia-violet-dark.mixin.scss +6 -2
- package/dist/cdn/styles/themes/prebuilt-themes/violet/eunomia-violet.theme.css +1 -1
- package/dist/components/action/button/button.d.ts +4 -3
- package/dist/components/action/button/button.js +6 -9
- package/dist/components/action/button/button.styles.js +13 -8
- package/dist/components/action/dropdown-button/dropdown-button.d.ts +4 -6
- package/dist/components/action/dropdown-button/dropdown-button.js +16 -13
- package/dist/components/action/dropdown-button/dropdown-item.d.ts +10 -2
- package/dist/components/action/dropdown-button/dropdown-item.js +24 -9
- package/dist/components/action/link/link.d.ts +10 -1
- package/dist/components/action/link/link.js +13 -1
- package/dist/components/action/link/link.styles.js +50 -3
- package/dist/components/action/toggle/toggle-group.d.ts +12 -2
- package/dist/components/action/toggle/toggle-group.js +18 -3
- package/dist/components/action/toggle/toggle-group.styles.js +58 -20
- package/dist/components/action/toggle/toggle-item.js +1 -3
- package/dist/components/action/toggle/toggle-item.styles.js +7 -7
- package/dist/components/action/toggle/toggle.js +1 -1
- package/dist/components/alert/alert/alert.d.ts +9 -7
- package/dist/components/alert/alert/alert.js +11 -14
- package/dist/components/alert/alert/alert.styles.js +9 -2
- package/dist/components/alert/drawer/drawer.d.ts +30 -5
- package/dist/components/alert/drawer/drawer.js +48 -13
- package/dist/components/alert/drawer/drawer.styles.js +7 -7
- package/dist/components/alert/modal/modal.d.ts +35 -10
- package/dist/components/alert/modal/modal.js +55 -28
- package/dist/components/alert/modal/modal.styles.js +17 -6
- package/dist/components/alert/toast/toast.d.ts +7 -5
- package/dist/components/alert/toast/toast.js +12 -15
- package/dist/components/alert/toast/toast.styles.js +18 -9
- package/dist/components/content/badge/badge.js +2 -2
- package/dist/components/content/card/card.js +1 -1
- package/dist/components/content/card/card.styles.js +2 -2
- package/dist/components/content/chip/chip.d.ts +4 -4
- package/dist/components/content/chip/chip.js +11 -10
- package/dist/components/content/chip/chip.styles.js +9 -3
- package/dist/components/content/description-list/description-list.js +3 -3
- package/dist/components/content/icon/icon.d.ts +3 -0
- package/dist/components/content/icon/icon.js +3 -0
- package/dist/components/content/icon/icon.style.d.ts +2 -0
- package/dist/components/content/icon/icon.style.js +4 -0
- package/dist/components/content/image-carousel/image-carousel.d.ts +12 -12
- package/dist/components/content/image-carousel/image-carousel.js +29 -28
- package/dist/components/content/password-strength/password-strength.d.ts +21 -6
- package/dist/components/content/password-strength/password-strength.js +37 -16
- package/dist/components/content/password-strength/password-strength.styles.js +4 -0
- package/dist/components/content/tag/tag.js +2 -2
- package/dist/components/content/tooltip/tooltip.d.ts +16 -9
- package/dist/components/content/tooltip/tooltip.js +31 -15
- package/dist/components/content/tooltip/tooltip.styles.js +1 -1
- package/dist/components/form/checkbox/check-card.d.ts +1 -0
- package/dist/components/form/checkbox/check-card.js +1 -0
- package/dist/components/form/checkbox/checkbox-list.d.ts +17 -0
- package/dist/components/form/checkbox/checkbox-list.js +39 -10
- package/dist/components/form/checkbox/checkbox.d.ts +1 -0
- package/dist/components/form/checkbox/checkbox.js +3 -1
- package/dist/components/form/checkbox/checkbox.styles.js +3 -2
- package/dist/components/form/color-picker/color-picker.d.ts +47 -28
- package/dist/components/form/color-picker/color-picker.js +73 -51
- package/dist/components/form/color-picker/color-picker.styles.js +14 -1
- package/dist/components/form/counter/counter.d.ts +24 -18
- package/dist/components/form/counter/counter.js +61 -61
- package/dist/components/form/counter/counter.styles.js +6 -4
- package/dist/components/form/date-picker/date-picker.d.ts +33 -7
- package/dist/components/form/date-picker/date-picker.js +82 -56
- package/dist/components/form/date-picker/date-picker.styles.js +9 -6
- package/dist/components/form/input/input.d.ts +43 -39
- package/dist/components/form/input/input.js +91 -110
- package/dist/components/form/input-file/input-file.d.ts +26 -13
- package/dist/components/form/input-file/input-file.js +35 -35
- package/dist/components/form/input-file/input-file.styles.js +4 -4
- package/dist/components/form/input-phone/input-phone.d.ts +28 -5
- package/dist/components/form/input-phone/input-phone.js +47 -13
- package/dist/components/form/input-phone/input-phone.styles.js +6 -3
- package/dist/components/form/radio/radio-card.d.ts +1 -0
- package/dist/components/form/radio/radio-card.js +1 -0
- package/dist/components/form/radio/radio-list.d.ts +23 -7
- package/dist/components/form/radio/radio-list.js +47 -22
- package/dist/components/form/radio/radio.d.ts +1 -0
- package/dist/components/form/radio/radio.js +1 -0
- package/dist/components/form/rating/rating.d.ts +349 -0
- package/dist/components/form/rating/rating.js +665 -0
- package/dist/components/form/rating/rating.styles.d.ts +1 -0
- package/dist/components/form/rating/rating.styles.js +213 -0
- package/dist/components/form/search/search.d.ts +72 -18
- package/dist/components/form/search/search.js +135 -72
- package/dist/components/form/search/search.styles.js +2 -0
- package/dist/components/form/select/select.d.ts +29 -10
- package/dist/components/form/select/select.js +65 -41
- package/dist/components/form/shared-styles/field.styles.js +45 -8
- package/dist/components/form/shared-styles/listbox.styles.js +15 -1
- package/dist/components/form/slider/slider.d.ts +7 -8
- package/dist/components/form/slider/slider.js +9 -12
- package/dist/components/form/switch/switch.d.ts +1 -0
- package/dist/components/form/switch/switch.js +1 -0
- package/dist/components/form/textarea/textarea.d.ts +90 -23
- package/dist/components/form/textarea/textarea.js +194 -44
- package/dist/components/form/textarea/textarea.styles.js +3 -0
- package/dist/components/form/time-picker/time-picker-columns.d.ts +2 -2
- package/dist/components/form/time-picker/time-picker-columns.js +8 -8
- package/dist/components/form/time-picker/time-picker.d.ts +30 -9
- package/dist/components/form/time-picker/time-picker.js +66 -40
- package/dist/components/form/time-picker/time-picker.styles.js +7 -5
- package/dist/components/layout/animate/animate.js +3 -2
- package/dist/components/layout/animate/animate.styles.js +2 -2
- package/dist/components/layout/divider/divider.js +1 -1
- package/dist/components/layout/divider/divider.styles.js +1 -1
- package/dist/components/loader/loader/loader.js +2 -2
- package/dist/components/loader/loader/loader.styles.js +14 -12
- package/dist/components/loader/skeleton/skeleton.js +1 -1
- package/dist/components/navigation/carousel/carousel.d.ts +32 -9
- package/dist/components/navigation/carousel/carousel.js +88 -41
- package/dist/components/navigation/carousel/carousel.styles.js +10 -6
- package/dist/components/navigation/pagination/pagination.d.ts +23 -21
- package/dist/components/navigation/pagination/pagination.js +30 -53
- package/dist/components/navigation/sidebar/sidebar.d.ts +113 -65
- package/dist/components/navigation/sidebar/sidebar.js +161 -118
- package/dist/components/navigation/sidebar/sidebar.styles.d.ts +1 -1
- package/dist/components/navigation/sidebar/sidebar.styles.js +74 -24
- package/dist/components/navigation/stepper/step.js +9 -8
- package/dist/components/navigation/stepper/stepper.d.ts +1 -3
- package/dist/components/navigation/stepper/stepper.js +15 -26
- package/dist/components/navigation/tabs/tab-group/tab-group.js +2 -2
- package/dist/components/navigation/tabs/tab-group/tab-group.styles.js +2 -2
- package/dist/components/navigation/toolbar/toolbar.d.ts +23 -13
- package/dist/components/navigation/toolbar/toolbar.js +28 -35
- package/dist/components/navigation/toolbar/toolbar.styles.js +18 -17
- package/dist/events/select.event.d.ts +3 -2
- package/dist/events/select.event.js +2 -1
- package/dist/features/scheduler/calendar/calendar.js +1 -1
- package/dist/features/scheduler/scheduler/scheduler.d.ts +7 -7
- package/dist/features/scheduler/scheduler/scheduler.js +15 -24
- package/dist/features/scheduler/scheduler-event/scheduler-event.js +3 -3
- package/dist/features/scheduler/scheduler-event/scheduler-event.styles.js +1 -1
- package/dist/features/scheduler/scheduler-event-editor/scheduler-event-editor.d.ts +6 -4
- package/dist/features/scheduler/scheduler-event-editor/scheduler-event-editor.js +7 -8
- package/dist/features/table/table/table.js +1 -1
- package/dist/features/table/table-action-bar/table-action-bar.js +2 -2
- package/dist/i18n/en.d.ts +68 -0
- package/dist/i18n/en.js +68 -0
- package/dist/i18n/fr.js +68 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -0
- package/dist/mixins/button.mixin.d.ts +1 -1
- package/dist/mixins/button.mixin.js +9 -6
- package/dist/mixins/check.mixin.js +11 -10
- package/dist/mixins/dialog-surface.mixin.d.ts +8 -0
- package/dist/mixins/disabled.mixin.d.ts +5 -0
- package/dist/mixins/disabled.mixin.js +21 -1
- package/dist/mixins/editable.mixin.js +28 -5
- package/dist/mixins/field-appearance.mixin.js +3 -2
- package/dist/mixins/field-size.mixin.d.ts +19 -0
- package/dist/mixins/field-size.mixin.js +33 -0
- package/dist/mixins/form.mixin.d.ts +4 -0
- package/dist/mixins/form.mixin.js +87 -13
- package/dist/mixins/localizable.mixin.d.ts +1 -1
- package/dist/mixins/localizable.mixin.js +1 -1
- package/dist/mixins/radio.mixin.js +11 -10
- package/dist/mixins/readonly.mixin.d.ts +2 -1
- package/dist/mixins/readonly.mixin.js +10 -3
- package/dist/mixins/rounded.mixin.d.ts +18 -0
- package/dist/mixins/rounded.mixin.js +32 -0
- package/dist/ssr/alert-ssr.css +187 -0
- package/dist/ssr/badge-ssr.css +67 -0
- package/dist/ssr/breadcrumb-ssr.css +41 -0
- package/dist/ssr/button-ssr.css +5 -5
- package/dist/ssr/card-ssr.css +27 -15
- package/dist/ssr/carousel-ssr.css +247 -0
- package/dist/ssr/checkbox-ssr.css +67 -0
- package/dist/ssr/chip-ssr.css +250 -0
- package/dist/ssr/collapse-ssr.css +180 -0
- package/dist/ssr/field-ssr.css +202 -0
- package/dist/ssr/icon-ssr.css +266 -0
- package/dist/ssr/image-carousel-ssr.css +34 -0
- package/dist/ssr/links-ssr.css +44 -1
- package/dist/ssr/pagination-ssr.css +4 -0
- package/dist/ssr/rating-ssr.css +254 -0
- package/dist/ssr/sidebar-ssr.css +102 -3
- package/dist/ssr/skeleton-ssr.css +63 -0
- package/dist/ssr/tabs-ssr.css +129 -0
- package/dist/ssr/toggle-group-ssr.css +233 -0
- package/dist/ssr/toolbar-ssr.css +81 -2
- package/dist/types/variant.type.d.ts +4 -1
- package/dist/utils/boolean.utils.d.ts +14 -0
- package/dist/utils/boolean.utils.js +20 -0
- package/dist/utils/dropdown-menu.utils.d.ts +1 -1
- package/dist/utils/focusable-elements.utils.d.ts +12 -0
- package/dist/utils/focusable-elements.utils.js +26 -0
- package/dist/utils/implicit-submission.utils.d.ts +18 -0
- package/dist/utils/implicit-submission.utils.js +79 -0
- package/dist/utils/input-modality.utils.d.ts +13 -0
- package/dist/utils/input-modality.utils.js +34 -0
- package/dist/utils/listbox-options.utils.d.ts +11 -0
- package/dist/utils/listbox-options.utils.js +41 -3
- package/dist/utils/theme-generator.utils.d.ts +8 -2
- package/dist/utils/theme-generator.utils.js +30 -9
- package/package.json +26 -7
- package/styles/themes/mixins/eunomia-neutrals.mixin.scss +6 -2
- package/styles/themes/prebuilt-themes/eunomia/eunomia-dark.mixin.scss +6 -2
- package/styles/themes/prebuilt-themes/fire/eunomia-fire-dark.mixin.scss +6 -2
- package/styles/themes/prebuilt-themes/forest/eunomia-forest-dark.mixin.scss +6 -2
- package/styles/themes/prebuilt-themes/gold/eunomia-gold-dark.mixin.scss +6 -2
- package/styles/themes/prebuilt-themes/ocean/eunomia-ocean-dark.mixin.scss +6 -2
- package/styles/themes/prebuilt-themes/salmon/eunomia-salmon-dark.mixin.scss +6 -2
- package/styles/themes/prebuilt-themes/violet/eunomia-violet-dark.mixin.scss +6 -2
- package/dist/cdn/components/chunks/chunk-4PI6RDUS.js +0 -1
- package/dist/cdn/components/chunks/chunk-6VK6SHCG.js +0 -1
- package/dist/cdn/components/chunks/chunk-A3X4KD2X.js +0 -1
- package/dist/cdn/components/chunks/chunk-BQFJR2UP.js +0 -110
- package/dist/cdn/components/chunks/chunk-G5SBDQQ3.js +0 -1
- package/dist/cdn/components/chunks/chunk-KSZRQRN4.js +0 -1
- package/dist/cdn/components/chunks/chunk-PE4DAXHQ.js +0 -3
- package/dist/cdn/components/chunks/chunk-RS7TWEMQ.js +0 -1
- package/dist/cdn/components/chunks/chunk-UDOZRIJZ.js +0 -1
- package/dist/cdn/components/chunks/chunk-VOTRXBDS.js +0 -38
|
@@ -5,8 +5,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { customElement, property, query } from "lit/decorators.js";
|
|
8
|
-
import { html, LitElement } from "lit";
|
|
8
|
+
import { html, LitElement, nothing } from "lit";
|
|
9
9
|
import { classMap } from "lit/directives/class-map.js";
|
|
10
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
11
|
import { FormLabelMixin } from "../../../mixins/form-label.mixin.js";
|
|
11
12
|
import { FormMixin, hasErrorDisplayChange, } from "../../../mixins/form.mixin.js";
|
|
12
13
|
import { DisabledMixin } from "../../../mixins/disabled.mixin.js";
|
|
@@ -81,6 +82,7 @@ const Base = DisabledMixin(ValidatorsMixin(LitElement));
|
|
|
81
82
|
* @prop {string} [defaultValue] - The value reselected when the list connects, and restored on form reset
|
|
82
83
|
* @attr {string} [default-value] - The value reselected when the list connects, and restored on form reset
|
|
83
84
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
85
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
84
86
|
* @prop {string} [error] - An error computed outside the field, by the form or by the server. While set, the field is invalid and shows this message right away
|
|
85
87
|
* @attr {boolean} [hide-error=false] - Whether the errors are hidden. The hint stays visible
|
|
86
88
|
* @prop {Array<import('../../../types/form-validators.type.js').Validators<string | undefined>>} validators - A list of validation rules applied to the group's selected value
|
|
@@ -95,6 +97,11 @@ const Base = DisabledMixin(ValidatorsMixin(LitElement));
|
|
|
95
97
|
let EunomiaRadioList = class EunomiaRadioList extends FormLabelMixin(ReadonlyMixin(FormMixin(Base))) {
|
|
96
98
|
constructor() {
|
|
97
99
|
super(...arguments);
|
|
100
|
+
/**
|
|
101
|
+
* Every change is a complete choice, so its error shows right away.
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
this.errorOnChange = true;
|
|
98
105
|
/**
|
|
99
106
|
* Indicates whether the elements into the list should be displayed inline.
|
|
100
107
|
* @default false
|
|
@@ -169,8 +176,7 @@ let EunomiaRadioList = class EunomiaRadioList extends FormLabelMixin(ReadonlyMix
|
|
|
169
176
|
* Assigns `name`/`id` to every child, applies a `default-value` selection
|
|
170
177
|
* once the slotted children actually exist (see `handleSlotChange` for
|
|
171
178
|
* why this can't rely on `FormMixin`'s own `defaultValue` setter alone),
|
|
172
|
-
*
|
|
173
|
-
* markup, and sets up the initial roving `tabindex`.
|
|
179
|
+
* and sets up the initial roving `tabindex`.
|
|
174
180
|
*
|
|
175
181
|
* The roving `tabindex` is applied only once every child's own first
|
|
176
182
|
* update has settled — each `eun-radio` is itself a `DisabledMixin` user,
|
|
@@ -192,9 +198,6 @@ let EunomiaRadioList = class EunomiaRadioList extends FormLabelMixin(ReadonlyMix
|
|
|
192
198
|
this.sendChangeEvent();
|
|
193
199
|
}
|
|
194
200
|
void Promise.all(this.fields.map((field) => field.updateComplete)).then(() => {
|
|
195
|
-
if (this.active && this.optionsList) {
|
|
196
|
-
this.optionsList.setAttribute("aria-activedescendant", this.active.id);
|
|
197
|
-
}
|
|
198
201
|
this.setFocus();
|
|
199
202
|
this.checkValidity(this.value);
|
|
200
203
|
});
|
|
@@ -218,19 +221,32 @@ let EunomiaRadioList = class EunomiaRadioList extends FormLabelMixin(ReadonlyMix
|
|
|
218
221
|
this.removeEventListener("keydown", this.handleKeydown);
|
|
219
222
|
super.disconnectedCallback?.();
|
|
220
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Whether the group's own `disabled`/`readonly` changed in a way to pass
|
|
226
|
+
* on to every child : always once set, but not for the initial `false`,
|
|
227
|
+
* which would otherwise re-enable a child disabled on its own.
|
|
228
|
+
*
|
|
229
|
+
* @param changed - The changed properties of the update.
|
|
230
|
+
* @param name - The property to check.
|
|
231
|
+
* @returns true when the children should take the group's value.
|
|
232
|
+
* @private
|
|
233
|
+
*/
|
|
234
|
+
isGroupChange(changed, name) {
|
|
235
|
+
return changed.has(name) && (this[name] || changed.get(name) !== undefined);
|
|
236
|
+
}
|
|
221
237
|
/**
|
|
222
238
|
* Lifecycle hook called whenever reactive properties change.
|
|
223
239
|
* @param _changedProperties - Map of changed properties
|
|
224
240
|
*/
|
|
225
241
|
updated(_changedProperties) {
|
|
226
242
|
super.updated(_changedProperties);
|
|
227
|
-
if (
|
|
243
|
+
if (this.isGroupChange(_changedProperties, "disabled")) {
|
|
228
244
|
this.fields.forEach((field) => {
|
|
229
245
|
field.disabled = this.disabled;
|
|
230
246
|
});
|
|
231
247
|
this.setFocus();
|
|
232
248
|
}
|
|
233
|
-
if (
|
|
249
|
+
if (this.isGroupChange(_changedProperties, "readonly")) {
|
|
234
250
|
this.fields.forEach((field) => {
|
|
235
251
|
field.readonly = this.readonly;
|
|
236
252
|
});
|
|
@@ -243,9 +259,6 @@ let EunomiaRadioList = class EunomiaRadioList extends FormLabelMixin(ReadonlyMix
|
|
|
243
259
|
field.validationRequested = showError;
|
|
244
260
|
});
|
|
245
261
|
}
|
|
246
|
-
if (_changedProperties.has("label") && !this.hasAttribute("aria-label")) {
|
|
247
|
-
this.setAttribute("aria-label", `${this.label}. ${this.instructions ?? ""}`);
|
|
248
|
-
}
|
|
249
262
|
if (_changedProperties.has("name")) {
|
|
250
263
|
this.fields.forEach((field) => {
|
|
251
264
|
field.name = this.name;
|
|
@@ -313,8 +326,8 @@ let EunomiaRadioList = class EunomiaRadioList extends FormLabelMixin(ReadonlyMix
|
|
|
313
326
|
this.setActive(enabled[activeIndex], true);
|
|
314
327
|
}
|
|
315
328
|
/**
|
|
316
|
-
* Applies the roving `tabindex` : the checked child (or the first
|
|
317
|
-
* none is checked yet) is the group's single tab stop, matching a native
|
|
329
|
+
* Applies the roving `tabindex` : the checked child (or the first enabled
|
|
330
|
+
* one, if none is checked yet) is the group's single tab stop, matching a native
|
|
318
331
|
* `radiogroup`'s "one tab stop, arrows move focus" behavior.
|
|
319
332
|
* @private
|
|
320
333
|
*/
|
|
@@ -328,14 +341,15 @@ let EunomiaRadioList = class EunomiaRadioList extends FormLabelMixin(ReadonlyMix
|
|
|
328
341
|
if (this.readonly || this.disabled) {
|
|
329
342
|
return;
|
|
330
343
|
}
|
|
331
|
-
const toFocus = this.active ??
|
|
344
|
+
const toFocus = this.active ??
|
|
345
|
+
this.fields.find((field) => !field.disabled && !field.readonly);
|
|
332
346
|
if (toFocus && !toFocus.disabled && !toFocus.readonly) {
|
|
333
347
|
toFocus.setAttribute("tabindex", "0");
|
|
334
348
|
}
|
|
335
349
|
}
|
|
336
350
|
/**
|
|
337
351
|
* Checks the given child, unchecking every other one, updates the roving
|
|
338
|
-
* `tabindex
|
|
352
|
+
* `tabindex`, and re-validates the group.
|
|
339
353
|
*
|
|
340
354
|
* @param item the child to activate
|
|
341
355
|
* @param focus whether to also move DOM focus onto it (arrow-key navigation)
|
|
@@ -345,7 +359,6 @@ let EunomiaRadioList = class EunomiaRadioList extends FormLabelMixin(ReadonlyMix
|
|
|
345
359
|
if (this.disabled || this.readonly || !item || !this.optionsList) {
|
|
346
360
|
return;
|
|
347
361
|
}
|
|
348
|
-
this.optionsList.setAttribute("aria-activedescendant", item.id);
|
|
349
362
|
if (focus) {
|
|
350
363
|
item.focus();
|
|
351
364
|
}
|
|
@@ -378,8 +391,8 @@ let EunomiaRadioList = class EunomiaRadioList extends FormLabelMixin(ReadonlyMix
|
|
|
378
391
|
}
|
|
379
392
|
/**
|
|
380
393
|
* Handler called when slot content changes.
|
|
381
|
-
* Propagates the group `name` and assigns a stable `id`
|
|
382
|
-
*
|
|
394
|
+
* Propagates the group `name` and assigns a stable `id` to every child
|
|
395
|
+
* radio.
|
|
383
396
|
*
|
|
384
397
|
* @private
|
|
385
398
|
*/
|
|
@@ -394,17 +407,29 @@ let EunomiaRadioList = class EunomiaRadioList extends FormLabelMixin(ReadonlyMix
|
|
|
394
407
|
* @returns The rendered template
|
|
395
408
|
*/
|
|
396
409
|
render() {
|
|
410
|
+
const description = this.renderDescription();
|
|
411
|
+
const describedBy = [
|
|
412
|
+
this.instructions ? "group-instructions" : "",
|
|
413
|
+
description === nothing ? "" : "description",
|
|
414
|
+
]
|
|
415
|
+
.filter(Boolean)
|
|
416
|
+
.join(" ") || undefined;
|
|
397
417
|
return html `
|
|
398
|
-
<fieldset id="fieldset">
|
|
418
|
+
<fieldset id="fieldset" role="presentation">
|
|
399
419
|
<div id="legend">${this.renderFormLabels("options")}</div>
|
|
420
|
+
${this.instructions
|
|
421
|
+
? html `<span id="group-instructions" hidden
|
|
422
|
+
>${this.instructions}</span
|
|
423
|
+
>`
|
|
424
|
+
: nothing}
|
|
400
425
|
<div
|
|
401
426
|
id="options"
|
|
402
427
|
part="options"
|
|
403
428
|
role="radiogroup"
|
|
404
429
|
class=${classMap({ inline: this.inline })}
|
|
405
430
|
?disabled=${this.disabled}
|
|
406
|
-
aria-
|
|
407
|
-
aria-describedby
|
|
431
|
+
aria-label=${ifDefined(this.label)}
|
|
432
|
+
aria-describedby=${ifDefined(describedBy)}
|
|
408
433
|
aria-disabled=${this.disabled ? "true" : "false"}
|
|
409
434
|
aria-readonly=${this.readonly ? "true" : "false"}
|
|
410
435
|
aria-required=${this.required ? "true" : "false"}
|
|
@@ -412,7 +437,7 @@ let EunomiaRadioList = class EunomiaRadioList extends FormLabelMixin(ReadonlyMix
|
|
|
412
437
|
>
|
|
413
438
|
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
414
439
|
</div>
|
|
415
|
-
${
|
|
440
|
+
${description}
|
|
416
441
|
</fieldset>
|
|
417
442
|
`;
|
|
418
443
|
}
|
|
@@ -34,6 +34,7 @@ declare const EunomiaRadioMixinBase: Constructor<EunomiaRadioBase>;
|
|
|
34
34
|
* @prop {boolean} [disabled=false] - Whether the radio is disabled
|
|
35
35
|
* @prop {boolean} [readonly=false] - Whether the radio is read only
|
|
36
36
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
37
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
37
38
|
* @prop {string} [error] - An error computed outside the field, by the form or by the server. While set, the field is invalid and shows this message right away
|
|
38
39
|
* @attr {boolean} [hide-error=false] - Whether the error message is hidden. The hint stays visible
|
|
39
40
|
* @prop {boolean} [required=false] - Whether a selection is required
|
|
@@ -37,6 +37,7 @@ const EunomiaRadioMixinBase = RadioMixin(ReadonlyMixin(FormMixin(DisabledMixin(V
|
|
|
37
37
|
* @prop {boolean} [disabled=false] - Whether the radio is disabled
|
|
38
38
|
* @prop {boolean} [readonly=false] - Whether the radio is read only
|
|
39
39
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
40
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
40
41
|
* @prop {string} [error] - An error computed outside the field, by the form or by the server. While set, the field is invalid and shows this message right away
|
|
41
42
|
* @attr {boolean} [hide-error=false] - Whether the error message is hidden. The hint stays visible
|
|
42
43
|
* @prop {boolean} [required=false] - Whether a selection is required
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { LitElement, PropertyValues, TemplateResult } from "lit";
|
|
2
|
+
import { DisabledMixinInterface } from "../../../mixins/disabled.mixin.js";
|
|
3
|
+
import { ReadonlyMixinInterface } from "../../../mixins/readonly.mixin.js";
|
|
4
|
+
import { ValidatorsMixinInterface } from "../../../mixins/validators.mixin.js";
|
|
5
|
+
import { FormMixinInterface } from "../../../mixins/form.mixin.js";
|
|
6
|
+
import { FormLabelMixinInterface } from "../../../mixins/form-label.mixin.js";
|
|
7
|
+
import { LocalizableMixinInterface } from "../../../mixins/localizable.mixin.js";
|
|
8
|
+
import { EunomiaIconName } from "../../content/icon/icon.type.js";
|
|
9
|
+
import { Constructor } from "../../../utils/constructor.type.js";
|
|
10
|
+
/**
|
|
11
|
+
* Tag name of the rating component.
|
|
12
|
+
*/
|
|
13
|
+
export declare const EunomiaRatingTagName = "eun-rating";
|
|
14
|
+
/**
|
|
15
|
+
* The granularity a rating can be picked at: whole icons, or halves.
|
|
16
|
+
*/
|
|
17
|
+
export type EunomiaRatingStep = 1 | 0.5;
|
|
18
|
+
/**
|
|
19
|
+
* Type of the rating base used to declare every necessary Mixin interface elements.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
type EunomiaRatingBase = LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface<number | undefined> & FormMixinInterface<number | undefined> & FormLabelMixinInterface & LocalizableMixinInterface;
|
|
23
|
+
declare const EunomiaRatingMixinBase: Constructor<EunomiaRatingBase>;
|
|
24
|
+
/**
|
|
25
|
+
* A rating shown as a row of icons, stars by default, that someone fills to
|
|
26
|
+
* give a score, or that simply displays one, such as a product's average
|
|
27
|
+
* review.
|
|
28
|
+
*
|
|
29
|
+
* Picking a score renders one native radio button per possible value,
|
|
30
|
+
* grouped in a radio group, so assistive technology announces each option
|
|
31
|
+
* as "3 out of 5", and the field takes part in forms like every other one.
|
|
32
|
+
* With displayOnly, the icons are rendered as a single image whose
|
|
33
|
+
* accessible name reads the score, such as "Rating: 4.5 out of 5".
|
|
34
|
+
*
|
|
35
|
+
* @slot [label] - Custom label content, falling back to the label property. Not rendered while displayOnly is set
|
|
36
|
+
* @slot [instructions] - Custom instructions content, falling back to the instructions property. Not rendered while displayOnly is set
|
|
37
|
+
* @prop {string} label - The title label of the field. While displayOnly is set, it isn't shown and starts the accessible name instead
|
|
38
|
+
* @prop {string} instructions - Instructions displayed below the label
|
|
39
|
+
* @prop {string} name - The field name
|
|
40
|
+
* @prop {number} value - The current rating. Empty when nothing is picked yet
|
|
41
|
+
* @prop {number} defaultValue - The rating applied when the field connects, and restored on form reset
|
|
42
|
+
* @attr {number} [default-value] - The rating applied when the field connects, and restored on form reset
|
|
43
|
+
* @prop {number} [max=5] - The number of icons, which is also the highest rating
|
|
44
|
+
* @prop {1 | 0.5} [step=1] - Whether a rating is picked by whole icons or by halves
|
|
45
|
+
* @prop {boolean} [displayOnly=false] - Only displays the rating, which can then be any decimal value, such as an average
|
|
46
|
+
* @attr {boolean} [display-only=false] - Only displays the rating, which can then be any decimal value, such as an average
|
|
47
|
+
* @prop {boolean} [clearable=false] - Shows a button that removes the rating, once one is picked
|
|
48
|
+
* @prop {string} [clearLabel] - The accessible label of the clear button. Defaults to the localized string for the current locale (English: "Clear rating")
|
|
49
|
+
* @attr {string} [clear-label] - The accessible label of the clear button
|
|
50
|
+
* @prop {import('../../content/icon/icon.type.js').EunomiaIconName} [icon='star'] - The icon drawn for the filled part of the rating
|
|
51
|
+
* @prop {import('../../content/icon/icon.type.js').EunomiaIconName} [emptyIcon='star_border'] - The icon drawn for the empty part of the rating. Keep its shape different from icon, so the rating doesn't rely on color alone
|
|
52
|
+
* @attr {import('../../content/icon/icon.type.js').EunomiaIconName} [empty-icon='star_border'] - The icon drawn for the empty part of the rating
|
|
53
|
+
* @prop {string} [locale] - The language of the accessible labels and of the decimal separator. Defaults to the shared default locale
|
|
54
|
+
* @prop {boolean} [disabled=false] - Whether the field is disabled
|
|
55
|
+
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
56
|
+
* @prop {boolean} [required=false] - Whether a rating must be picked
|
|
57
|
+
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
58
|
+
* @attr {boolean} [hide-error=false] - Whether the errors are hidden. The hint stays visible
|
|
59
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
60
|
+
* @prop {string} [error] - An error computed outside the field, by the form or by the server. While set, the field is invalid and shows this message right away
|
|
61
|
+
* @prop {string} hint - A short message displayed under the field
|
|
62
|
+
* @prop {Array<import('../../../types/form-validators.type.js').Validators<number | undefined>>} validators - The list of validation rules applied to the rating
|
|
63
|
+
* @fires {ChangeEvent} eunchange - Fired whenever the rating is picked, changed or cleared
|
|
64
|
+
* @cssprop [--rating-size] - Sets the width and height of each icon
|
|
65
|
+
* @cssprop [--rating-gap] - Sets the space between two icons
|
|
66
|
+
* @cssprop [--rating-color] - Sets the color of the filled icons
|
|
67
|
+
* @cssprop [--rating-empty-color] - Sets the color of the empty icons
|
|
68
|
+
* @cssprop [--rating-error-color] - Sets the color of the error message, and of the empty icons while in error
|
|
69
|
+
* @cssprop [--rating-hint-color] - Sets the color of the hint message
|
|
70
|
+
* @cssprop [--rating-focus-outline-color] - Sets the color of the focus outline drawn around the focused icon and the clear button
|
|
71
|
+
* @cssprop [--field-label-font-size] - Sets the font size of the label
|
|
72
|
+
* @cssprop [--field-message-font-size] - Sets the font size of the hint, error messages and instructions
|
|
73
|
+
* @element eun-rating
|
|
74
|
+
*/
|
|
75
|
+
export declare class EunomiaRating extends EunomiaRatingMixinBase {
|
|
76
|
+
/**
|
|
77
|
+
* Styles to import to the component.
|
|
78
|
+
*
|
|
79
|
+
* @static
|
|
80
|
+
* @internal
|
|
81
|
+
* @readonly
|
|
82
|
+
*/
|
|
83
|
+
static readonly styles: import("lit").CSSResult[];
|
|
84
|
+
/**
|
|
85
|
+
* Every change is a complete choice, so its error shows right away.
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
errorOnChange: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* The number of icons, which is also the highest rating.
|
|
91
|
+
* @default 5
|
|
92
|
+
*/
|
|
93
|
+
max: number;
|
|
94
|
+
/**
|
|
95
|
+
* Whether a rating is picked by whole icons or by halves. Any other value
|
|
96
|
+
* falls back to `1`.
|
|
97
|
+
* @default 1
|
|
98
|
+
*/
|
|
99
|
+
step: EunomiaRatingStep;
|
|
100
|
+
/**
|
|
101
|
+
* Only displays the rating, which can then be any decimal value, such as
|
|
102
|
+
* an average. The field is then neither focusable nor editable.
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
displayOnly: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Shows a button that removes the rating, once one is picked.
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
clearable: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* The accessible label of the clear button. Defaults to the localized
|
|
113
|
+
* string for the current locale.
|
|
114
|
+
*/
|
|
115
|
+
clearLabel?: string;
|
|
116
|
+
/**
|
|
117
|
+
* The icon drawn for the filled part of the rating.
|
|
118
|
+
* @default star
|
|
119
|
+
*/
|
|
120
|
+
icon: EunomiaIconName;
|
|
121
|
+
/**
|
|
122
|
+
* The icon drawn for the empty part of the rating. Its shape differs from
|
|
123
|
+
* {@link icon} by default, so the rating never relies on color alone.
|
|
124
|
+
* @default star_border
|
|
125
|
+
*/
|
|
126
|
+
emptyIcon: EunomiaIconName;
|
|
127
|
+
/**
|
|
128
|
+
* The rating previewed while a mouse hovers the icons.
|
|
129
|
+
* @internal
|
|
130
|
+
*/
|
|
131
|
+
private hoverValue?;
|
|
132
|
+
/**
|
|
133
|
+
* The current rating, `undefined` while nothing is picked. Overrides the
|
|
134
|
+
* accessor inherited from `FormMixin` to give it a `Number` converter, as
|
|
135
|
+
* `eun-slider` does, and to clamp every assignment within `0`/`max` : `0`
|
|
136
|
+
* or less means no rating. Snapping to `step` happens in
|
|
137
|
+
* {@link willUpdate}, once `displayOnly` is known, since a displayed
|
|
138
|
+
* average keeps its exact decimals.
|
|
139
|
+
*/
|
|
140
|
+
get value(): number | undefined;
|
|
141
|
+
set value(value: number | undefined);
|
|
142
|
+
/**
|
|
143
|
+
* The rating applied on connection and form reset. Overrides the accessor
|
|
144
|
+
* inherited from `FormMixin` for the same reason as {@link value}.
|
|
145
|
+
*/
|
|
146
|
+
get defaultValue(): number | undefined;
|
|
147
|
+
set defaultValue(value: number | undefined);
|
|
148
|
+
/**
|
|
149
|
+
* The radio group element.
|
|
150
|
+
* @internal
|
|
151
|
+
*/
|
|
152
|
+
private readonly itemsEl?;
|
|
153
|
+
/**
|
|
154
|
+
* The number of icons drawn, `max` rounded to a whole number of at least
|
|
155
|
+
* one.
|
|
156
|
+
* @private
|
|
157
|
+
*/
|
|
158
|
+
private get count();
|
|
159
|
+
/**
|
|
160
|
+
* The step actually applied, `step` restricted to `1` or `0.5`.
|
|
161
|
+
* @private
|
|
162
|
+
*/
|
|
163
|
+
private get resolvedStep();
|
|
164
|
+
/**
|
|
165
|
+
* Clamps a value within `0`/`max`, turning anything empty, invalid, or at
|
|
166
|
+
* `0` or below into `undefined`.
|
|
167
|
+
*
|
|
168
|
+
* @param value the value to clamp.
|
|
169
|
+
* @returns the clamped value.
|
|
170
|
+
* @private
|
|
171
|
+
*/
|
|
172
|
+
private clamp;
|
|
173
|
+
/**
|
|
174
|
+
* Clamps a value, then snaps it to the nearest `step` unless the rating
|
|
175
|
+
* is only displayed.
|
|
176
|
+
*
|
|
177
|
+
* @param value the value to normalize.
|
|
178
|
+
* @returns the normalized value.
|
|
179
|
+
* @private
|
|
180
|
+
*/
|
|
181
|
+
private snap;
|
|
182
|
+
/**
|
|
183
|
+
* Formats a number in the current locale, such as `4,5` in French.
|
|
184
|
+
*
|
|
185
|
+
* @param value the number to format.
|
|
186
|
+
* @returns the formatted number.
|
|
187
|
+
* @private
|
|
188
|
+
*/
|
|
189
|
+
private format;
|
|
190
|
+
/**
|
|
191
|
+
* The accessible text of a value, such as "3 out of 5".
|
|
192
|
+
*
|
|
193
|
+
* @param value the value to describe.
|
|
194
|
+
* @returns the localized text.
|
|
195
|
+
* @private
|
|
196
|
+
*/
|
|
197
|
+
private valueText;
|
|
198
|
+
/**
|
|
199
|
+
* The radio input matching a value, if rendered.
|
|
200
|
+
*
|
|
201
|
+
* @param value the value to look for.
|
|
202
|
+
* @returns the matching radio input.
|
|
203
|
+
* @private
|
|
204
|
+
*/
|
|
205
|
+
private radioFor;
|
|
206
|
+
/**
|
|
207
|
+
* The value of the group's single tab stop: the current rating, or the
|
|
208
|
+
* lowest one while nothing is picked.
|
|
209
|
+
* @private
|
|
210
|
+
*/
|
|
211
|
+
private get tabStopValue();
|
|
212
|
+
/**
|
|
213
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
214
|
+
* straight to the radio group inside, in both directions, and
|
|
215
|
+
* {@link focus} covers a direct call on the host.
|
|
216
|
+
*/
|
|
217
|
+
protected get hostTabStop(): boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Returns the radio to focus on validation errors.
|
|
220
|
+
*
|
|
221
|
+
* @returns the group's tab stop, if rendered.
|
|
222
|
+
*/
|
|
223
|
+
getFocusAnchor(): HTMLElement | undefined;
|
|
224
|
+
/**
|
|
225
|
+
* Focuses the group's tab stop.
|
|
226
|
+
*/
|
|
227
|
+
focus(options?: FocusOptions): void;
|
|
228
|
+
/**
|
|
229
|
+
* Applies a value picked by the user, and notifies consumers when it
|
|
230
|
+
* actually changed.
|
|
231
|
+
*
|
|
232
|
+
* @param value the picked value, `undefined` to clear the rating.
|
|
233
|
+
* @private
|
|
234
|
+
*/
|
|
235
|
+
private pick;
|
|
236
|
+
/**
|
|
237
|
+
* Whether the user can't change the rating right now.
|
|
238
|
+
* @private
|
|
239
|
+
*/
|
|
240
|
+
private get locked();
|
|
241
|
+
/**
|
|
242
|
+
* The value under the pointer : the whole icon, or its first half while
|
|
243
|
+
* `step` is `0.5`, mirrored in a right-to-left layout. The gap after an
|
|
244
|
+
* icon counts as that whole icon, so moving across the row never empties
|
|
245
|
+
* the hover preview between two icons.
|
|
246
|
+
*
|
|
247
|
+
* @param event the pointer event.
|
|
248
|
+
* @returns the value under the pointer, if over or past an icon.
|
|
249
|
+
* @private
|
|
250
|
+
*/
|
|
251
|
+
private valueAtPointer;
|
|
252
|
+
/**
|
|
253
|
+
* Picks the value under the pointer. The radios themselves ignore the
|
|
254
|
+
* pointer, so a whole icon stays one target even while `step` is `0.5`.
|
|
255
|
+
*
|
|
256
|
+
* @param event the click event.
|
|
257
|
+
* @private
|
|
258
|
+
*/
|
|
259
|
+
private readonly handleClick;
|
|
260
|
+
/**
|
|
261
|
+
* Previews the value under a mouse pointer.
|
|
262
|
+
*
|
|
263
|
+
* @param event the pointer event.
|
|
264
|
+
* @private
|
|
265
|
+
*/
|
|
266
|
+
private readonly handlePointerMove;
|
|
267
|
+
/**
|
|
268
|
+
* Ends the hover preview.
|
|
269
|
+
* @private
|
|
270
|
+
*/
|
|
271
|
+
private readonly handlePointerLeave;
|
|
272
|
+
/**
|
|
273
|
+
* Applies a radio checked natively, by Space or by assistive technology.
|
|
274
|
+
*
|
|
275
|
+
* @param event the native change event.
|
|
276
|
+
* @private
|
|
277
|
+
*/
|
|
278
|
+
private readonly handleChange;
|
|
279
|
+
/**
|
|
280
|
+
* Keeps a radio from being checked while readonly, since the HTML
|
|
281
|
+
* `readonly` attribute has no effect on radios.
|
|
282
|
+
*
|
|
283
|
+
* @param event the click event dispatched on a radio.
|
|
284
|
+
* @private
|
|
285
|
+
*/
|
|
286
|
+
private readonly handleRadioClick;
|
|
287
|
+
/**
|
|
288
|
+
* Moves the rating with the arrow keys, Home and End, without wrapping
|
|
289
|
+
* around as native radios do, and blocks every change while readonly.
|
|
290
|
+
*
|
|
291
|
+
* @param event the keyboard event.
|
|
292
|
+
* @private
|
|
293
|
+
*/
|
|
294
|
+
private readonly handleKeydown;
|
|
295
|
+
/**
|
|
296
|
+
* Removes the rating, then moves focus to the group, since the clear
|
|
297
|
+
* button disappears with it.
|
|
298
|
+
* @private
|
|
299
|
+
*/
|
|
300
|
+
private readonly handleClear;
|
|
301
|
+
/**
|
|
302
|
+
* Snaps the value to `step` and keeps it within `max` whenever either of
|
|
303
|
+
* them, the value, or `displayOnly` changes. Done before render so the
|
|
304
|
+
* correction lands in the update already in progress, and before
|
|
305
|
+
* `FormMixin` validates the value.
|
|
306
|
+
*
|
|
307
|
+
* @param changed the changed properties.
|
|
308
|
+
*/
|
|
309
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
310
|
+
/**
|
|
311
|
+
* Renders one icon, its empty shape with the filled one clipped on top.
|
|
312
|
+
*
|
|
313
|
+
* @param fill how much of the icon is filled, from `0` to `1`.
|
|
314
|
+
* @returns the rendered icon.
|
|
315
|
+
* @private
|
|
316
|
+
*/
|
|
317
|
+
private renderIcon;
|
|
318
|
+
/**
|
|
319
|
+
* Renders the radio of one value, with the ring drawn around its area
|
|
320
|
+
* while it has keyboard focus.
|
|
321
|
+
*
|
|
322
|
+
* @param value the value of the radio.
|
|
323
|
+
* @returns the rendered radio.
|
|
324
|
+
* @private
|
|
325
|
+
*/
|
|
326
|
+
private renderRadio;
|
|
327
|
+
/**
|
|
328
|
+
* Renders the rating as a single image, its accessible name reading the
|
|
329
|
+
* score.
|
|
330
|
+
* @private
|
|
331
|
+
*/
|
|
332
|
+
private renderDisplay;
|
|
333
|
+
/**
|
|
334
|
+
* Renders the clear button, once a rating is picked and can be changed.
|
|
335
|
+
* @private
|
|
336
|
+
*/
|
|
337
|
+
private renderClear;
|
|
338
|
+
/**
|
|
339
|
+
* Renders the rating template.
|
|
340
|
+
* @returns The rendered HTML template
|
|
341
|
+
*/
|
|
342
|
+
render(): TemplateResult;
|
|
343
|
+
}
|
|
344
|
+
declare global {
|
|
345
|
+
interface HTMLElementTagNameMap {
|
|
346
|
+
[EunomiaRatingTagName]: EunomiaRating;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
export {};
|