@eunomia/elements 1.0.0-beta.6 → 1.0.0-beta.7
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-JYIIWN2P.js → chunk-36KLGY6U.js} +8 -8
- package/dist/cdn/components/chunks/chunk-3BMACIDO.js +1 -0
- package/dist/cdn/components/chunks/{chunk-KDN4O5W2.js → chunk-3PNGQEG4.js} +3 -3
- 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-AK2DIJX7.js +1 -0
- package/dist/cdn/components/chunks/chunk-B5XMGWM7.js +10 -0
- package/dist/cdn/components/chunks/chunk-BVASCT2V.js +109 -0
- package/dist/cdn/components/chunks/{chunk-VYFR364B.js → chunk-DGI7TKCU.js} +14 -9
- 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-MOMYII3P.js → chunk-LVKMAHMU.js} +10 -0
- package/dist/cdn/components/chunks/{chunk-XDPRWUKN.js → chunk-MQQJ6DID.js} +1 -1
- package/dist/cdn/components/chunks/{chunk-SZYEBMG6.js → chunk-PXF554MD.js} +1 -1
- package/dist/cdn/components/chunks/chunk-QL5GSW2A.js +1 -0
- package/dist/cdn/components/chunks/{chunk-7KKWYPHY.js → chunk-QXQ25SQS.js} +21 -19
- package/dist/cdn/components/chunks/{chunk-L2ADCEN7.js → chunk-SVGWCKWT.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-WW4BTWMH.js +1 -0
- package/dist/cdn/components/chunks/{chunk-2Y2EU2CI.js → chunk-Z3OFIE7S.js} +1 -1
- package/dist/cdn/components/eun-alert.js +13 -6
- package/dist/cdn/components/eun-animate.js +3 -3
- 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 +21 -18
- 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 +3 -3
- package/dist/cdn/components/eun-color-picker.js +60 -68
- package/dist/cdn/components/eun-counter.js +10 -10
- package/dist/cdn/components/eun-date-picker.js +47 -46
- 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 +5 -5
- package/dist/cdn/components/eun-dropdown-button.js +1 -1
- 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 +10 -9
- package/dist/cdn/components/eun-input.js +1 -1
- package/dist/cdn/components/eun-link.js +2 -2
- package/dist/cdn/components/eun-loader.js +1 -1
- package/dist/cdn/components/eun-modal.js +13 -13
- 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 +10 -10
- 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 +19 -21
- package/dist/cdn/components/eun-select.js +27 -27
- package/dist/cdn/components/eun-sidebar.js +10 -8
- 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 +25 -25
- 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.js +1 -1
- package/dist/cdn/components/eun-table-action-bar.js +1 -1
- package/dist/cdn/components/eun-table.js +1 -1
- package/dist/cdn/components/eun-tag.js +3 -3
- package/dist/cdn/components/eun-textarea.js +39 -34
- package/dist/cdn/components/eun-time-picker.js +15 -14
- package/dist/cdn/components/eun-toast.js +19 -10
- package/dist/cdn/components/eun-toggle-group.js +6 -4
- package/dist/cdn/components/eun-toggle-item.js +1 -1
- package/dist/cdn/components/eun-toggle.js +2 -2
- package/dist/cdn/components/eun-toolbar.js +5 -5
- package/dist/cdn/components/eun-tooltip.js +3 -3
- package/dist/components/action/button/button.d.ts +2 -1
- package/dist/components/action/button/button.js +3 -2
- package/dist/components/action/button/button.styles.js +10 -5
- package/dist/components/action/dropdown-button/dropdown-button.js +10 -5
- package/dist/components/action/toggle/toggle-group.js +1 -1
- package/dist/components/action/toggle/toggle-group.styles.js +4 -2
- 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 +5 -5
- package/dist/components/alert/drawer/drawer.js +8 -12
- package/dist/components/alert/drawer/drawer.styles.js +1 -1
- package/dist/components/alert/modal/modal.d.ts +10 -10
- package/dist/components/alert/modal/modal.js +13 -25
- package/dist/components/alert/toast/toast.d.ts +7 -5
- package/dist/components/alert/toast/toast.js +9 -13
- package/dist/components/alert/toast/toast.styles.js +15 -6
- 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 +8 -8
- 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 +24 -24
- 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.js +3 -3
- 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 +41 -28
- package/dist/components/form/color-picker/color-picker.js +66 -50
- package/dist/components/form/color-picker/color-picker.styles.js +1 -1
- package/dist/components/form/counter/counter.d.ts +22 -18
- package/dist/components/form/counter/counter.js +59 -61
- package/dist/components/form/date-picker/date-picker.d.ts +27 -6
- package/dist/components/form/date-picker/date-picker.js +75 -54
- package/dist/components/form/input/input.d.ts +38 -39
- package/dist/components/form/input/input.js +85 -109
- 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 +22 -5
- package/dist/components/form/input-phone/input-phone.js +41 -13
- 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 +8 -8
- package/dist/components/form/search/search.js +23 -41
- package/dist/components/form/select/select.d.ts +23 -10
- package/dist/components/form/select/select.js +59 -41
- package/dist/components/form/shared-styles/listbox.styles.js +10 -0
- 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 +89 -23
- package/dist/components/form/textarea/textarea.js +192 -43
- 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 +24 -8
- package/dist/components/form/time-picker/time-picker.js +59 -38
- package/dist/components/layout/animate/animate.js +1 -1
- 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 +31 -7
- package/dist/components/navigation/carousel/carousel.js +74 -35
- package/dist/components/navigation/carousel/carousel.styles.js +5 -2
- 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 +15 -13
- package/dist/components/navigation/sidebar/sidebar.js +21 -33
- package/dist/components/navigation/sidebar/sidebar.styles.js +5 -3
- package/dist/components/navigation/stepper/step.js +9 -8
- package/dist/components/navigation/stepper/stepper.js +12 -5
- 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 +13 -13
- package/dist/components/navigation/toolbar/toolbar.js +20 -34
- 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 +6 -7
- 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 +2 -0
- package/dist/index.js +1 -0
- package/dist/mixins/button.mixin.js +3 -2
- package/dist/mixins/check.mixin.js +11 -10
- 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/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/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/card-ssr.css +27 -15
- package/dist/ssr/carousel-ssr.css +238 -0
- package/dist/ssr/checkbox-ssr.css +67 -0
- package/dist/ssr/chip-ssr.css +242 -0
- package/dist/ssr/collapse-ssr.css +151 -0
- package/dist/ssr/field-ssr.css +163 -0
- package/dist/ssr/icon-ssr.css +266 -0
- package/dist/ssr/image-carousel-ssr.css +24 -0
- package/dist/ssr/links-ssr.css +7 -1
- package/dist/ssr/pagination-ssr.css +4 -0
- package/dist/ssr/rating-ssr.css +254 -0
- package/dist/ssr/sidebar-ssr.css +9 -1
- package/dist/ssr/skeleton-ssr.css +63 -0
- package/dist/ssr/tabs-ssr.css +129 -0
- package/dist/ssr/toggle-group-ssr.css +182 -0
- package/dist/ssr/toolbar-ssr.css +31 -2
- package/dist/utils/implicit-submission.utils.d.ts +18 -0
- package/dist/utils/implicit-submission.utils.js +79 -0
- package/dist/utils/listbox-options.utils.d.ts +11 -0
- package/dist/utils/listbox-options.utils.js +41 -3
- package/package.json +26 -7
- package/dist/cdn/components/chunks/chunk-4PI6RDUS.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-VOTRXBDS.js +0 -38
|
@@ -8,6 +8,7 @@ import { EditableMixinInterface } from "../../../mixins/editable.mixin.js";
|
|
|
8
8
|
import { FieldAppearanceMixinInterface } from "../../../mixins/field-appearance.mixin.js";
|
|
9
9
|
import { AnchorPositionMixinInterface } from "../../../mixins/anchor-position.mixin.js";
|
|
10
10
|
import { Constructor } from "../../../utils/constructor.type.js";
|
|
11
|
+
import { LocalizableMixinInterface } from "../../../mixins/localizable.mixin.js";
|
|
11
12
|
/**
|
|
12
13
|
* Tag name of the color picker component.
|
|
13
14
|
*/
|
|
@@ -17,7 +18,7 @@ export declare const EunomiaColorPickerTagName = "eun-color-picker";
|
|
|
17
18
|
* interface elements.
|
|
18
19
|
* @internal
|
|
19
20
|
*/
|
|
20
|
-
type EunomiaColorPickerBase = LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface<string> & FormMixinInterface<string> & EditableMixinInterface & FormLabelMixinInterface & FieldAppearanceMixinInterface & AnchorPositionMixinInterface;
|
|
21
|
+
type EunomiaColorPickerBase = LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface<string> & FormMixinInterface<string> & EditableMixinInterface & FormLabelMixinInterface & FieldAppearanceMixinInterface & AnchorPositionMixinInterface & LocalizableMixinInterface;
|
|
21
22
|
declare const EunomiaColorPickerMixinBase: Constructor<EunomiaColorPickerBase>;
|
|
22
23
|
/**
|
|
23
24
|
* A field for picking a color, as a `#rrggbb` hex string. Declare preset
|
|
@@ -62,12 +63,13 @@ declare const EunomiaColorPickerMixinBase: Constructor<EunomiaColorPickerBase>;
|
|
|
62
63
|
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
63
64
|
* @prop {boolean} [required=false] - Whether a color is required
|
|
64
65
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
66
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
65
67
|
* @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
|
|
66
68
|
* @prop {Array<Validators<string>>} validators - The list of validation rules applied to the field value
|
|
67
69
|
* @prop {boolean} [readonlyAvailable=false] - Whether the field can switch between a static display and an editable one
|
|
68
70
|
* @attr {boolean} [readonly-available=false] - Whether the field can switch between a static display and an editable one
|
|
69
|
-
* @prop {string} [emptyValueLabel
|
|
70
|
-
* @attr {string} [empty-value-label
|
|
71
|
+
* @prop {string} [emptyValueLabel] - Text displayed in place of the value when empty. Defaults to the localized string for the current locale (English: "No color selected")
|
|
72
|
+
* @attr {string} [empty-value-label] - Text displayed in place of the value when empty. Defaults to the localized string for the current locale (English: "No color selected")
|
|
71
73
|
* @prop {string} [swatchesLabel='Presets'] - Heading shown above the preset swatches, while any are declared
|
|
72
74
|
* @attr {string} [swatches-label='Presets'] - Heading shown above the preset swatches
|
|
73
75
|
* @prop {string} [customLabel='Custom'] - Heading shown above the custom color row
|
|
@@ -76,10 +78,10 @@ declare const EunomiaColorPickerMixinBase: Constructor<EunomiaColorPickerBase>;
|
|
|
76
78
|
* @attr {string} [native-input-label='Pick a custom color'] - Accessible label for the native OS color picker
|
|
77
79
|
* @prop {string} [hexInputLabel='Hex color'] - Accessible label for the hex text input
|
|
78
80
|
* @attr {string} [hex-input-label='Hex color'] - Accessible label for the hex text input
|
|
79
|
-
* @prop {string} [confirmLabel
|
|
80
|
-
* @attr {string} [confirm-label
|
|
81
|
-
* @prop {string} [cancelLabel
|
|
82
|
-
* @attr {string} [cancel-label
|
|
81
|
+
* @prop {string} [confirmLabel] - The label of the confirm button in edit mode. Defaults to the localized string for the current locale (English: "Confirm")
|
|
82
|
+
* @attr {string} [confirm-label] - The label of the confirm button in edit mode. Defaults to the localized string for the current locale (English: "Confirm")
|
|
83
|
+
* @prop {string} [cancelLabel] - The label of the cancel button in edit mode. Defaults to the localized string for the current locale (English: "Cancel")
|
|
84
|
+
* @attr {string} [cancel-label] - The label of the cancel button in edit mode. Defaults to the localized string for the current locale (English: "Cancel")
|
|
83
85
|
* @prop {boolean} [noAnimation=false] - Disables the dropdown panel's open and close height transition, on top of the automatic reduced motion handling
|
|
84
86
|
* @attr {boolean} [no-animation=false] - Disables the dropdown panel's open and close height transition
|
|
85
87
|
* @prop {boolean} [swatchOnly=false] - Renders as a native input type="color" styled as a plain swatch, with no panel, no presets, and no hex input at all — only the browser/OS's own color picker. Presets declared as option children are ignored while this is set
|
|
@@ -137,9 +139,9 @@ export declare class EunomiaColorPicker extends EunomiaColorPickerMixinBase {
|
|
|
137
139
|
set defaultValue(rawValue: string | undefined);
|
|
138
140
|
/**
|
|
139
141
|
* Text displayed in place of the value when empty.
|
|
140
|
-
*
|
|
142
|
+
* Falls back to the localized string for the current locale when unset.
|
|
141
143
|
*/
|
|
142
|
-
emptyValueLabel
|
|
144
|
+
emptyValueLabel?: string;
|
|
143
145
|
/**
|
|
144
146
|
* Heading shown above the preset swatches, while any are declared.
|
|
145
147
|
* @default Presets
|
|
@@ -162,14 +164,14 @@ export declare class EunomiaColorPicker extends EunomiaColorPickerMixinBase {
|
|
|
162
164
|
hexInputLabel: string;
|
|
163
165
|
/**
|
|
164
166
|
* Label of the confirm button in edit mode.
|
|
165
|
-
*
|
|
167
|
+
* Falls back to the localized string for the current locale when unset.
|
|
166
168
|
*/
|
|
167
|
-
confirmLabel
|
|
169
|
+
confirmLabel?: string;
|
|
168
170
|
/**
|
|
169
171
|
* Label of the cancel button in edit mode.
|
|
170
|
-
*
|
|
172
|
+
* Falls back to the localized string for the current locale when unset.
|
|
171
173
|
*/
|
|
172
|
-
cancelLabel
|
|
174
|
+
cancelLabel?: string;
|
|
173
175
|
/**
|
|
174
176
|
* Disables the dropdown panel's open/close height transition, both set
|
|
175
177
|
* explicitly and whenever the browser reports `prefers-reduced-motion:
|
|
@@ -198,7 +200,7 @@ export declare class EunomiaColorPicker extends EunomiaColorPickerMixinBase {
|
|
|
198
200
|
* opposite trade-off from `swatchOnly`. The leading native color swatch
|
|
199
201
|
* that normally sits before the trigger button is gone entirely (the
|
|
200
202
|
* button itself shows a plain decorative swatch instead), and the panel
|
|
201
|
-
* drops its hex input, leaving only the preset
|
|
203
|
+
* drops its hex input, leaving only the preset listbox : nothing
|
|
202
204
|
* outside the curated palette is reachable at all, not even by typing a
|
|
203
205
|
* hex value. Has no effect without at least one `option` declared —
|
|
204
206
|
* with none, {@link renderInlineCustomField} already offers nothing but
|
|
@@ -210,7 +212,7 @@ export declare class EunomiaColorPicker extends EunomiaColorPickerMixinBase {
|
|
|
210
212
|
presetsOnly: boolean;
|
|
211
213
|
/**
|
|
212
214
|
* Renders the declared `option` presets directly as the field itself,
|
|
213
|
-
* the exact swatch
|
|
215
|
+
* the exact swatch listbox {@link renderPresets} already renders
|
|
214
216
|
* inside the panel, just in place of a trigger button and a panel to
|
|
215
217
|
* open. No native color swatch, no hex input, no button, no popover of
|
|
216
218
|
* any kind, since there is nothing left for one to open. Takes priority
|
|
@@ -235,6 +237,13 @@ export declare class EunomiaColorPicker extends EunomiaColorPickerMixinBase {
|
|
|
235
237
|
* @internal
|
|
236
238
|
*/
|
|
237
239
|
private hexDraft;
|
|
240
|
+
/**
|
|
241
|
+
* The preset swatch last moved to with the keyboard, which holds the
|
|
242
|
+
* swatches' single tab stop ; `-1` until then, leaving it on the selected
|
|
243
|
+
* swatch (or the first one).
|
|
244
|
+
* @internal
|
|
245
|
+
*/
|
|
246
|
+
private presetFocusIndex;
|
|
238
247
|
/**
|
|
239
248
|
* The field's trigger : a `<button>` opening the panel, or, while
|
|
240
249
|
* {@link swatchOnly}, the native `<input type="color">` itself (no
|
|
@@ -316,6 +325,12 @@ export declare class EunomiaColorPicker extends EunomiaColorPickerMixinBase {
|
|
|
316
325
|
* `eun-select` uses for its own search text vs. `value`.
|
|
317
326
|
*/
|
|
318
327
|
protected willUpdate(_changedProperties: PropertyValues): void;
|
|
328
|
+
/**
|
|
329
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
330
|
+
* straight to the controls inside, in both directions, and
|
|
331
|
+
* {@link focus} covers a direct call on the host.
|
|
332
|
+
*/
|
|
333
|
+
protected get hostTabStop(): boolean;
|
|
319
334
|
/**
|
|
320
335
|
* Returns the field element to focus/anchor on validation errors.
|
|
321
336
|
*/
|
|
@@ -423,13 +438,11 @@ export declare class EunomiaColorPicker extends EunomiaColorPickerMixinBase {
|
|
|
423
438
|
/**
|
|
424
439
|
* Moves focus among preset swatches on Arrow/Home/End, without picking
|
|
425
440
|
* anything : browsing the palette with the keyboard is deliberately
|
|
426
|
-
* non-destructive,
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
* {@link renderSwatchRadiogroup}), so this is an alternative to Tab/
|
|
432
|
-
* Shift+Tab for moving between them, not the only way to reach one.
|
|
441
|
+
* non-destructive, as a listbox whose selection doesn't follow focus.
|
|
442
|
+
* Picking only ever happens through an explicit activation instead, a
|
|
443
|
+
* click or an Enter/Space press, both already wired through the button's
|
|
444
|
+
* own native `click` handling. The swatches share a single Tab stop,
|
|
445
|
+
* which follows the focus (see {@link renderSwatchListbox}).
|
|
433
446
|
* @param event the native keyboard event.
|
|
434
447
|
* @param index the index of the swatch that received the key press.
|
|
435
448
|
* @private
|
|
@@ -491,28 +504,28 @@ export declare class EunomiaColorPicker extends EunomiaColorPickerMixinBase {
|
|
|
491
504
|
*/
|
|
492
505
|
private renderReadonlyDisplay;
|
|
493
506
|
/**
|
|
494
|
-
* Renders the preset swatch
|
|
507
|
+
* Renders the preset swatch listbox, while any presets are declared.
|
|
495
508
|
* @param presets the parsed preset options.
|
|
496
509
|
* @returns the rendered template.
|
|
497
510
|
* @private
|
|
498
511
|
*/
|
|
499
512
|
private renderPresets;
|
|
500
513
|
/**
|
|
501
|
-
* Renders the preset swatch
|
|
514
|
+
* Renders the preset swatch listbox itself, shared between
|
|
502
515
|
* {@link renderPresets} (inside the panel, under its own "Presets"
|
|
503
516
|
* heading) and {@link renderInlinePresetsField} (as the whole field,
|
|
504
517
|
* with no heading of its own since the field's own label already names
|
|
505
518
|
* it).
|
|
506
519
|
* @param presets the preset options to render.
|
|
507
|
-
* @param ariaLabel the
|
|
520
|
+
* @param ariaLabel the listbox's accessible name.
|
|
508
521
|
* @param hasDescription whether a hint/error `#description` is being
|
|
509
522
|
* rendered alongside the field, so it can be wired to `aria-describedby`
|
|
510
|
-
* directly on the
|
|
523
|
+
* directly on the listbox ; only relevant when it stands in for the
|
|
511
524
|
* whole field on its own, see {@link renderInlinePresetsField}.
|
|
512
525
|
* @returns the rendered template.
|
|
513
526
|
* @private
|
|
514
527
|
*/
|
|
515
|
-
private
|
|
528
|
+
private renderSwatchListbox;
|
|
516
529
|
/**
|
|
517
530
|
* Renders the panel's hex row : a plain hex text input, nothing else.
|
|
518
531
|
* The native OS color picker never lives inside the panel — it's always
|
|
@@ -528,7 +541,7 @@ export declare class EunomiaColorPicker extends EunomiaColorPickerMixinBase {
|
|
|
528
541
|
private renderHexRow;
|
|
529
542
|
/**
|
|
530
543
|
* Renders the declared `option` presets directly as the field itself,
|
|
531
|
-
* the same swatch
|
|
544
|
+
* the same swatch listbox {@link renderPresets} renders inside the
|
|
532
545
|
* panel, just in place of a trigger button and a panel to open at all.
|
|
533
546
|
* Used whenever {@link presetsInline} is set and at least one preset is
|
|
534
547
|
* declared (see {@link render}).
|
|
@@ -24,6 +24,7 @@ import { isWebKit } from "../../../utils/browser.utils.js";
|
|
|
24
24
|
import { normalizeHexColor } from "../../../utils/color.utils.js";
|
|
25
25
|
import { parseListboxOptions, } from "../../../utils/listbox-options.utils.js";
|
|
26
26
|
import { resolveDurationMs, resolveEasing, } from "../../../utils/motion.utils.js";
|
|
27
|
+
import { LocalizableMixin, } from "../../../mixins/localizable.mixin.js";
|
|
27
28
|
/**
|
|
28
29
|
* Tag name of the color picker component.
|
|
29
30
|
*/
|
|
@@ -33,7 +34,7 @@ export const EunomiaColorPickerTagName = "eun-color-picker";
|
|
|
33
34
|
* @internal
|
|
34
35
|
*/
|
|
35
36
|
const Base = DisabledMixin(ValidatorsMixin(LitElement));
|
|
36
|
-
const EunomiaColorPickerMixinBase = AnchorPositionMixin(FieldAppearanceMixin(FormLabelMixin(ReadonlyMixin(EditableMixin(FormMixin(Base))))));
|
|
37
|
+
const EunomiaColorPickerMixinBase = LocalizableMixin(AnchorPositionMixin(FieldAppearanceMixin(FormLabelMixin(ReadonlyMixin(EditableMixin(FormMixin(Base)))))));
|
|
37
38
|
/**
|
|
38
39
|
* A field for picking a color, as a `#rrggbb` hex string. Declare preset
|
|
39
40
|
* swatches as light DOM `option` children, exactly like `eun-select` does
|
|
@@ -77,12 +78,13 @@ const EunomiaColorPickerMixinBase = AnchorPositionMixin(FieldAppearanceMixin(For
|
|
|
77
78
|
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
78
79
|
* @prop {boolean} [required=false] - Whether a color is required
|
|
79
80
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
81
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
80
82
|
* @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
|
|
81
83
|
* @prop {Array<Validators<string>>} validators - The list of validation rules applied to the field value
|
|
82
84
|
* @prop {boolean} [readonlyAvailable=false] - Whether the field can switch between a static display and an editable one
|
|
83
85
|
* @attr {boolean} [readonly-available=false] - Whether the field can switch between a static display and an editable one
|
|
84
|
-
* @prop {string} [emptyValueLabel
|
|
85
|
-
* @attr {string} [empty-value-label
|
|
86
|
+
* @prop {string} [emptyValueLabel] - Text displayed in place of the value when empty. Defaults to the localized string for the current locale (English: "No color selected")
|
|
87
|
+
* @attr {string} [empty-value-label] - Text displayed in place of the value when empty. Defaults to the localized string for the current locale (English: "No color selected")
|
|
86
88
|
* @prop {string} [swatchesLabel='Presets'] - Heading shown above the preset swatches, while any are declared
|
|
87
89
|
* @attr {string} [swatches-label='Presets'] - Heading shown above the preset swatches
|
|
88
90
|
* @prop {string} [customLabel='Custom'] - Heading shown above the custom color row
|
|
@@ -91,10 +93,10 @@ const EunomiaColorPickerMixinBase = AnchorPositionMixin(FieldAppearanceMixin(For
|
|
|
91
93
|
* @attr {string} [native-input-label='Pick a custom color'] - Accessible label for the native OS color picker
|
|
92
94
|
* @prop {string} [hexInputLabel='Hex color'] - Accessible label for the hex text input
|
|
93
95
|
* @attr {string} [hex-input-label='Hex color'] - Accessible label for the hex text input
|
|
94
|
-
* @prop {string} [confirmLabel
|
|
95
|
-
* @attr {string} [confirm-label
|
|
96
|
-
* @prop {string} [cancelLabel
|
|
97
|
-
* @attr {string} [cancel-label
|
|
96
|
+
* @prop {string} [confirmLabel] - The label of the confirm button in edit mode. Defaults to the localized string for the current locale (English: "Confirm")
|
|
97
|
+
* @attr {string} [confirm-label] - The label of the confirm button in edit mode. Defaults to the localized string for the current locale (English: "Confirm")
|
|
98
|
+
* @prop {string} [cancelLabel] - The label of the cancel button in edit mode. Defaults to the localized string for the current locale (English: "Cancel")
|
|
99
|
+
* @attr {string} [cancel-label] - The label of the cancel button in edit mode. Defaults to the localized string for the current locale (English: "Cancel")
|
|
98
100
|
* @prop {boolean} [noAnimation=false] - Disables the dropdown panel's open and close height transition, on top of the automatic reduced motion handling
|
|
99
101
|
* @attr {boolean} [no-animation=false] - Disables the dropdown panel's open and close height transition
|
|
100
102
|
* @prop {boolean} [swatchOnly=false] - Renders as a native input type="color" styled as a plain swatch, with no panel, no presets, and no hex input at all — only the browser/OS's own color picker. Presets declared as option children are ignored while this is set
|
|
@@ -134,11 +136,6 @@ const EunomiaColorPickerMixinBase = AnchorPositionMixin(FieldAppearanceMixin(For
|
|
|
134
136
|
let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixinBase {
|
|
135
137
|
constructor() {
|
|
136
138
|
super(...arguments);
|
|
137
|
-
/**
|
|
138
|
-
* Text displayed in place of the value when empty.
|
|
139
|
-
* @default No color selected
|
|
140
|
-
*/
|
|
141
|
-
this.emptyValueLabel = "No color selected";
|
|
142
139
|
/**
|
|
143
140
|
* Heading shown above the preset swatches, while any are declared.
|
|
144
141
|
* @default Presets
|
|
@@ -159,16 +156,6 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
159
156
|
* @default Hex color
|
|
160
157
|
*/
|
|
161
158
|
this.hexInputLabel = "Hex color";
|
|
162
|
-
/**
|
|
163
|
-
* Label of the confirm button in edit mode.
|
|
164
|
-
* @default Confirm
|
|
165
|
-
*/
|
|
166
|
-
this.confirmLabel = "Confirm";
|
|
167
|
-
/**
|
|
168
|
-
* Label of the cancel button in edit mode.
|
|
169
|
-
* @default Cancel
|
|
170
|
-
*/
|
|
171
|
-
this.cancelLabel = "Cancel";
|
|
172
159
|
/**
|
|
173
160
|
* Disables the dropdown panel's open/close height transition, both set
|
|
174
161
|
* explicitly and whenever the browser reports `prefers-reduced-motion:
|
|
@@ -197,7 +184,7 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
197
184
|
* opposite trade-off from `swatchOnly`. The leading native color swatch
|
|
198
185
|
* that normally sits before the trigger button is gone entirely (the
|
|
199
186
|
* button itself shows a plain decorative swatch instead), and the panel
|
|
200
|
-
* drops its hex input, leaving only the preset
|
|
187
|
+
* drops its hex input, leaving only the preset listbox : nothing
|
|
201
188
|
* outside the curated palette is reachable at all, not even by typing a
|
|
202
189
|
* hex value. Has no effect without at least one `option` declared —
|
|
203
190
|
* with none, {@link renderInlineCustomField} already offers nothing but
|
|
@@ -209,7 +196,7 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
209
196
|
this.presetsOnly = false;
|
|
210
197
|
/**
|
|
211
198
|
* Renders the declared `option` presets directly as the field itself,
|
|
212
|
-
* the exact swatch
|
|
199
|
+
* the exact swatch listbox {@link renderPresets} already renders
|
|
213
200
|
* inside the panel, just in place of a trigger button and a panel to
|
|
214
201
|
* open. No native color swatch, no hex input, no button, no popover of
|
|
215
202
|
* any kind, since there is nothing left for one to open. Takes priority
|
|
@@ -234,6 +221,13 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
234
221
|
* @internal
|
|
235
222
|
*/
|
|
236
223
|
this.hexDraft = "";
|
|
224
|
+
/**
|
|
225
|
+
* The preset swatch last moved to with the keyboard, which holds the
|
|
226
|
+
* swatches' single tab stop ; `-1` until then, leaving it on the selected
|
|
227
|
+
* swatch (or the first one).
|
|
228
|
+
* @internal
|
|
229
|
+
*/
|
|
230
|
+
this.presetFocusIndex = -1;
|
|
237
231
|
/**
|
|
238
232
|
* Reacts to the dropdown panel's native `toggle` event : the single
|
|
239
233
|
* source of truth for open/close state. The panel is `popover="auto"`,
|
|
@@ -382,7 +376,10 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
382
376
|
if (this.ariaLabel) {
|
|
383
377
|
return this.ariaLabel;
|
|
384
378
|
}
|
|
385
|
-
return this.swatchOnly
|
|
379
|
+
return this.swatchOnly
|
|
380
|
+
? this.value ||
|
|
381
|
+
(this.emptyValueLabel ?? this.dictionary.colorPicker.noColor)
|
|
382
|
+
: undefined;
|
|
386
383
|
}
|
|
387
384
|
/**
|
|
388
385
|
* Lifecycle hook called when the element is connected to the DOM.
|
|
@@ -413,6 +410,14 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
413
410
|
this.hexDraft = this.value ?? "";
|
|
414
411
|
}
|
|
415
412
|
}
|
|
413
|
+
/**
|
|
414
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
415
|
+
* straight to the controls inside, in both directions, and
|
|
416
|
+
* {@link focus} covers a direct call on the host.
|
|
417
|
+
*/
|
|
418
|
+
get hostTabStop() {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
416
421
|
/**
|
|
417
422
|
* Returns the field element to focus/anchor on validation errors.
|
|
418
423
|
*/
|
|
@@ -549,6 +554,7 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
549
554
|
* @private
|
|
550
555
|
*/
|
|
551
556
|
handleSelect(value) {
|
|
557
|
+
this.presetFocusIndex = -1;
|
|
552
558
|
this.value = value;
|
|
553
559
|
this.hexDraft = value;
|
|
554
560
|
this.dispatchEvent(new ChangeEvent(this.value));
|
|
@@ -557,13 +563,11 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
557
563
|
/**
|
|
558
564
|
* Moves focus among preset swatches on Arrow/Home/End, without picking
|
|
559
565
|
* anything : browsing the palette with the keyboard is deliberately
|
|
560
|
-
* non-destructive,
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
*
|
|
565
|
-
* {@link renderSwatchRadiogroup}), so this is an alternative to Tab/
|
|
566
|
-
* Shift+Tab for moving between them, not the only way to reach one.
|
|
566
|
+
* non-destructive, as a listbox whose selection doesn't follow focus.
|
|
567
|
+
* Picking only ever happens through an explicit activation instead, a
|
|
568
|
+
* click or an Enter/Space press, both already wired through the button's
|
|
569
|
+
* own native `click` handling. The swatches share a single Tab stop,
|
|
570
|
+
* which follows the focus (see {@link renderSwatchListbox}).
|
|
567
571
|
* @param event the native keyboard event.
|
|
568
572
|
* @param index the index of the swatch that received the key press.
|
|
569
573
|
* @private
|
|
@@ -590,6 +594,7 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
590
594
|
return;
|
|
591
595
|
}
|
|
592
596
|
event.preventDefault();
|
|
597
|
+
this.presetFocusIndex = nextIndex;
|
|
593
598
|
this.presetButtonEls[nextIndex]?.focus();
|
|
594
599
|
}
|
|
595
600
|
/**
|
|
@@ -650,7 +655,7 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
650
655
|
rounded
|
|
651
656
|
type="button"
|
|
652
657
|
@click=${this.handleConfirmClick}
|
|
653
|
-
>${this.confirmLabel}</eun-button
|
|
658
|
+
>${this.confirmLabel ?? this.dictionary.common.confirm}</eun-button
|
|
654
659
|
>
|
|
655
660
|
<eun-button
|
|
656
661
|
class="cancel"
|
|
@@ -659,7 +664,7 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
659
664
|
rounded
|
|
660
665
|
type="button"
|
|
661
666
|
@click=${this.handleCancelClick}
|
|
662
|
-
>${this.cancelLabel}</eun-button
|
|
667
|
+
>${this.cancelLabel ?? this.dictionary.common.cancel}</eun-button
|
|
663
668
|
>
|
|
664
669
|
</div>
|
|
665
670
|
`;
|
|
@@ -687,14 +692,16 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
687
692
|
? nothing
|
|
688
693
|
: html `
|
|
689
694
|
<span class=${classMap({ empty: !this.value })}
|
|
690
|
-
>${this.value ||
|
|
695
|
+
>${this.value ||
|
|
696
|
+
(this.emptyValueLabel ??
|
|
697
|
+
this.dictionary.colorPicker.noColor)}</span
|
|
691
698
|
>
|
|
692
699
|
`}
|
|
693
700
|
</div>
|
|
694
701
|
`;
|
|
695
702
|
}
|
|
696
703
|
/**
|
|
697
|
-
* Renders the preset swatch
|
|
704
|
+
* Renders the preset swatch listbox, while any presets are declared.
|
|
698
705
|
* @param presets the parsed preset options.
|
|
699
706
|
* @returns the rendered template.
|
|
700
707
|
* @private
|
|
@@ -703,43 +710,47 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
703
710
|
return html `
|
|
704
711
|
<div>
|
|
705
712
|
<span id="swatches-label">${this.swatchesLabel}</span>
|
|
706
|
-
${this.
|
|
713
|
+
${this.renderSwatchListbox(presets, this.swatchesLabel, false)}
|
|
707
714
|
</div>
|
|
708
715
|
`;
|
|
709
716
|
}
|
|
710
717
|
/**
|
|
711
|
-
* Renders the preset swatch
|
|
718
|
+
* Renders the preset swatch listbox itself, shared between
|
|
712
719
|
* {@link renderPresets} (inside the panel, under its own "Presets"
|
|
713
720
|
* heading) and {@link renderInlinePresetsField} (as the whole field,
|
|
714
721
|
* with no heading of its own since the field's own label already names
|
|
715
722
|
* it).
|
|
716
723
|
* @param presets the preset options to render.
|
|
717
|
-
* @param ariaLabel the
|
|
724
|
+
* @param ariaLabel the listbox's accessible name.
|
|
718
725
|
* @param hasDescription whether a hint/error `#description` is being
|
|
719
726
|
* rendered alongside the field, so it can be wired to `aria-describedby`
|
|
720
|
-
* directly on the
|
|
727
|
+
* directly on the listbox ; only relevant when it stands in for the
|
|
721
728
|
* whole field on its own, see {@link renderInlinePresetsField}.
|
|
722
729
|
* @returns the rendered template.
|
|
723
730
|
* @private
|
|
724
731
|
*/
|
|
725
|
-
|
|
732
|
+
renderSwatchListbox(presets, ariaLabel, hasDescription) {
|
|
733
|
+
const selectedIndex = presets.findIndex((preset) => preset.value === this.value);
|
|
734
|
+
const tabStop = this.presetFocusIndex >= 0 && this.presetFocusIndex < presets.length
|
|
735
|
+
? this.presetFocusIndex
|
|
736
|
+
: Math.max(selectedIndex, 0);
|
|
726
737
|
return html `
|
|
727
738
|
<div
|
|
728
739
|
id="swatches"
|
|
729
|
-
role="
|
|
740
|
+
role="listbox"
|
|
730
741
|
aria-label=${ifDefined(ariaLabel)}
|
|
731
742
|
aria-describedby=${hasDescription ? "description" : nothing}
|
|
732
743
|
>
|
|
733
744
|
${presets.map((preset, index) => {
|
|
734
|
-
const
|
|
745
|
+
const selected = index === selectedIndex;
|
|
735
746
|
return html `
|
|
736
747
|
<button
|
|
737
748
|
type="button"
|
|
738
749
|
class="swatch-button"
|
|
739
|
-
role="
|
|
740
|
-
aria-
|
|
750
|
+
role="option"
|
|
751
|
+
aria-selected=${selected ? "true" : "false"}
|
|
741
752
|
aria-label=${preset.label}
|
|
742
|
-
tabindex
|
|
753
|
+
tabindex=${index === tabStop ? "0" : "-1"}
|
|
743
754
|
style="--_optionColor: ${preset.value}"
|
|
744
755
|
@click=${() => this.handleSelect(preset.value)}
|
|
745
756
|
@keydown=${(event) => this.handlePresetKeydown(event, index)}
|
|
@@ -792,7 +803,7 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
792
803
|
}
|
|
793
804
|
/**
|
|
794
805
|
* Renders the declared `option` presets directly as the field itself,
|
|
795
|
-
* the same swatch
|
|
806
|
+
* the same swatch listbox {@link renderPresets} renders inside the
|
|
796
807
|
* panel, just in place of a trigger button and a panel to open at all.
|
|
797
808
|
* Used whenever {@link presetsInline} is set and at least one preset is
|
|
798
809
|
* declared (see {@link render}).
|
|
@@ -804,7 +815,7 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
804
815
|
renderInlinePresetsField(hasDescription) {
|
|
805
816
|
return html `
|
|
806
817
|
<div id="field-wrapper">
|
|
807
|
-
${this.
|
|
818
|
+
${this.renderSwatchListbox(this.presets, this.triggerAccessibleLabel, hasDescription)}
|
|
808
819
|
</div>
|
|
809
820
|
${this.readonlyAvailable ? this.renderEditActions() : nothing}
|
|
810
821
|
`;
|
|
@@ -907,7 +918,7 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
907
918
|
<button
|
|
908
919
|
type="button"
|
|
909
920
|
id="field"
|
|
910
|
-
aria-haspopup="
|
|
921
|
+
aria-haspopup="dialog"
|
|
911
922
|
aria-expanded=${this.isOpen}
|
|
912
923
|
aria-label=${ifDefined(this.triggerAccessibleLabel)}
|
|
913
924
|
aria-describedby=${hasDescription ? "description" : nothing}
|
|
@@ -927,7 +938,8 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
927
938
|
`
|
|
928
939
|
: nothing}
|
|
929
940
|
<span id="value-text" class=${classMap({ empty: !this.value })}>
|
|
930
|
-
${this.value ||
|
|
941
|
+
${this.value ||
|
|
942
|
+
(this.emptyValueLabel ?? this.dictionary.colorPicker.noColor)}
|
|
931
943
|
</span>
|
|
932
944
|
<span
|
|
933
945
|
id="field-arrow"
|
|
@@ -940,6 +952,7 @@ let EunomiaColorPicker = class EunomiaColorPicker extends EunomiaColorPickerMixi
|
|
|
940
952
|
${this.readonlyAvailable ? this.renderEditActions() : nothing}
|
|
941
953
|
<div
|
|
942
954
|
id="listbox"
|
|
955
|
+
role="dialog"
|
|
943
956
|
popover="auto"
|
|
944
957
|
aria-label=${ifDefined(this.label)}
|
|
945
958
|
@toggle=${this.handlePopoverToggle}
|
|
@@ -1083,6 +1096,9 @@ __decorate([
|
|
|
1083
1096
|
__decorate([
|
|
1084
1097
|
state()
|
|
1085
1098
|
], EunomiaColorPicker.prototype, "hexDraft", void 0);
|
|
1099
|
+
__decorate([
|
|
1100
|
+
state()
|
|
1101
|
+
], EunomiaColorPicker.prototype, "presetFocusIndex", void 0);
|
|
1086
1102
|
__decorate([
|
|
1087
1103
|
query("#field")
|
|
1088
1104
|
], EunomiaColorPicker.prototype, "fieldEl", void 0);
|
|
@@ -105,7 +105,7 @@ const colorPicker = css `
|
|
|
105
105
|
outline var(--eun-duration-m, 200ms) var(--eun-easing-out, ease-out),
|
|
106
106
|
border var(--eun-duration-m, 200ms) var(--eun-easing-out, ease-out);
|
|
107
107
|
}
|
|
108
|
-
.swatch-button[aria-
|
|
108
|
+
.swatch-button[aria-selected="true"] .swatch {
|
|
109
109
|
border-color: var(--eun-color-primary-500, #3d6fff);
|
|
110
110
|
border-width: calc(var(--eun-border-width-m, 1.5px) * 2);
|
|
111
111
|
}
|
|
@@ -6,6 +6,7 @@ import { FormMixinInterface } from "../../../mixins/form.mixin.js";
|
|
|
6
6
|
import { FormLabelMixinInterface } from "../../../mixins/form-label.mixin.js";
|
|
7
7
|
import { FieldAppearanceMixinInterface } from "../../../mixins/field-appearance.mixin.js";
|
|
8
8
|
import { Constructor } from "../../../utils/constructor.type.js";
|
|
9
|
+
import { LocalizableMixinInterface } from "../../../mixins/localizable.mixin.js";
|
|
9
10
|
/**
|
|
10
11
|
* Tag name of the counter component.
|
|
11
12
|
*/
|
|
@@ -14,7 +15,7 @@ export declare const EunomiaCounterTagName = "eun-counter";
|
|
|
14
15
|
* Type of the counter base used to declare every necessary Mixin interface elements.
|
|
15
16
|
* @internal
|
|
16
17
|
*/
|
|
17
|
-
type EunomiaCounterBase = LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface<number> & FormMixinInterface<number> & FormLabelMixinInterface & FieldAppearanceMixinInterface;
|
|
18
|
+
type EunomiaCounterBase = LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface<number> & FormMixinInterface<number> & FormLabelMixinInterface & FieldAppearanceMixinInterface & LocalizableMixinInterface;
|
|
18
19
|
declare const EunomiaCounterMixinBase: Constructor<EunomiaCounterBase>;
|
|
19
20
|
/**
|
|
20
21
|
* A numeric field with increment and decrement buttons, built on a native
|
|
@@ -34,13 +35,14 @@ declare const EunomiaCounterMixinBase: Constructor<EunomiaCounterBase>;
|
|
|
34
35
|
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
35
36
|
* @prop {boolean} [required=false] - Whether the field is required
|
|
36
37
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
38
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
37
39
|
* @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
40
|
* @attr {boolean} [hide-error=false] - Whether the errors are hidden
|
|
39
41
|
* @prop {Array<import('../../../types/form-validators.type.js').Validators<number>>} validators - The list of validation rules applied to the field value
|
|
40
|
-
* @prop {string} [
|
|
41
|
-
* @attr {string} [
|
|
42
|
-
* @prop {string} [
|
|
43
|
-
* @attr {string} [
|
|
42
|
+
* @prop {string} [incrementLabel] - The accessible label of the increment button. Defaults to the localized string for the current locale (English: "Increase value")
|
|
43
|
+
* @attr {string} [increment-label] - The accessible label of the increment button. Defaults to the localized string for the current locale (English: "Increase value")
|
|
44
|
+
* @prop {string} [decrementLabel] - The accessible label of the decrement button. Defaults to the localized string for the current locale (English: "Decrease value")
|
|
45
|
+
* @attr {string} [decrement-label] - The accessible label of the decrement button. Defaults to the localized string for the current locale (English: "Decrease value")
|
|
44
46
|
* @fires {ChangeEvent} eunchange - Fired on every value change
|
|
45
47
|
* @cssprop [--counter-background] - Sets the background color of the field
|
|
46
48
|
* @cssprop [--counter-border-color] - Sets the border color of the field
|
|
@@ -81,14 +83,14 @@ export declare class EunomiaCounter extends EunomiaCounterMixinBase {
|
|
|
81
83
|
step: number;
|
|
82
84
|
/**
|
|
83
85
|
* Accessible label of the increment button.
|
|
84
|
-
*
|
|
86
|
+
* Falls back to the localized string for the current locale when unset.
|
|
85
87
|
*/
|
|
86
|
-
|
|
88
|
+
incrementLabel?: string;
|
|
87
89
|
/**
|
|
88
90
|
* Accessible label of the decrement button.
|
|
89
|
-
*
|
|
91
|
+
* Falls back to the localized string for the current locale when unset.
|
|
90
92
|
*/
|
|
91
|
-
|
|
93
|
+
decrementLabel?: string;
|
|
92
94
|
/**
|
|
93
95
|
* The current numeric value, `undefined` while empty (e.g. after the
|
|
94
96
|
* field is cleared by the user). Overrides the `value` accessor
|
|
@@ -121,17 +123,13 @@ export declare class EunomiaCounter extends EunomiaCounterMixinBase {
|
|
|
121
123
|
* @readonly
|
|
122
124
|
*/
|
|
123
125
|
private readonly fieldEl?;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
*
|
|
128
|
-
* it. See `eun-input`'s identical pattern : the host stays in the tab
|
|
129
|
-
* order (`DisabledMixin`) rather than being excluded via `tabindex="-1"`,
|
|
130
|
-
* which broke Tab from reaching the field entirely for this
|
|
131
|
-
* form-associated component, instead of just skipping the host.
|
|
126
|
+
constructor();
|
|
127
|
+
/**
|
|
128
|
+
* Submits the owning form on Enter in the field, as a native number
|
|
129
|
+
* input does, since the browser never does it from a shadow root.
|
|
132
130
|
* @private
|
|
133
131
|
*/
|
|
134
|
-
private
|
|
132
|
+
private readonly handleImplicitSubmission;
|
|
135
133
|
/**
|
|
136
134
|
* Reads native HTML constraint validation from the underlying field
|
|
137
135
|
* element (`required`, `min`, `max`, `step`, `badInput`).
|
|
@@ -139,6 +137,12 @@ export declare class EunomiaCounter extends EunomiaCounterMixinBase {
|
|
|
139
137
|
* @returns validity state and optional message.
|
|
140
138
|
*/
|
|
141
139
|
checkLocalValidators: () => Validity;
|
|
140
|
+
/**
|
|
141
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
142
|
+
* straight to the controls inside, in both directions, and
|
|
143
|
+
* {@link focus} covers a direct call on the host.
|
|
144
|
+
*/
|
|
145
|
+
protected get hostTabStop(): boolean;
|
|
142
146
|
/**
|
|
143
147
|
* Returns the field element to focus/anchor on validation errors.
|
|
144
148
|
*
|