@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
|
@@ -7,6 +7,7 @@ import { FormLabelMixinInterface } from "../../../mixins/form-label.mixin.js";
|
|
|
7
7
|
import { FieldAppearanceMixinInterface } from "../../../mixins/field-appearance.mixin.js";
|
|
8
8
|
import { AnchorPositionMixinInterface } from "../../../mixins/anchor-position.mixin.js";
|
|
9
9
|
import { Constructor } from "../../../utils/constructor.type.js";
|
|
10
|
+
import { LocalizableMixinInterface } from "../../../mixins/localizable.mixin.js";
|
|
10
11
|
/**
|
|
11
12
|
* Tag name of the phone input component.
|
|
12
13
|
*/
|
|
@@ -16,7 +17,7 @@ export declare const EunomiaInputPhoneTagName = "eun-input-phone";
|
|
|
16
17
|
* interface element.
|
|
17
18
|
* @internal
|
|
18
19
|
*/
|
|
19
|
-
type EunomiaInputPhoneBase = LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface<string> & FormMixinInterface<string> & FormLabelMixinInterface & FieldAppearanceMixinInterface & AnchorPositionMixinInterface;
|
|
20
|
+
type EunomiaInputPhoneBase = LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface<string> & FormMixinInterface<string> & FormLabelMixinInterface & FieldAppearanceMixinInterface & AnchorPositionMixinInterface & LocalizableMixinInterface;
|
|
20
21
|
declare const EunomiaInputPhoneMixinBase: Constructor<EunomiaInputPhoneBase>;
|
|
21
22
|
/**
|
|
22
23
|
* A phone number field rendered in two adjacent parts: a compact country
|
|
@@ -55,6 +56,7 @@ declare const EunomiaInputPhoneMixinBase: Constructor<EunomiaInputPhoneBase>;
|
|
|
55
56
|
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
56
57
|
* @prop {boolean} [required=false] - Whether the field is required
|
|
57
58
|
* @prop {boolean} [hideError=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
|
|
58
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
|
|
59
61
|
* @prop {Array<Validators<string>>} validators - The list of validation rules applied to the field value
|
|
60
62
|
* @prop {string} [placeholder] - The placeholder shown when the field is empty. Defaults to a generic formatted digit pattern, not a real per-country example, when unset
|
|
@@ -62,8 +64,8 @@ declare const EunomiaInputPhoneMixinBase: Constructor<EunomiaInputPhoneBase>;
|
|
|
62
64
|
* @attr {string} [country-search-placeholder='Search a country…'] - The placeholder of the search field inside the country dropdown
|
|
63
65
|
* @prop {string} [noResultsLabel='No results'] - Text displayed in the dropdown when no country matches the search
|
|
64
66
|
* @attr {string} [no-results-label='No results'] - Text displayed in the dropdown when no country matches the search
|
|
65
|
-
* @prop {string} [
|
|
66
|
-
* @attr {string} [
|
|
67
|
+
* @prop {string} [countrySelectorLabel] - The accessible label of the leading country selector button. Defaults to the localized string for the current locale (English: "Select a country")
|
|
68
|
+
* @attr {string} [country-selector-label] - The accessible label of the leading country selector button. Defaults to the localized string for the current locale (English: "Select a country")
|
|
67
69
|
* @fires {ChangeEvent} eunchange - Fired on every value change
|
|
68
70
|
* @cssprop [--field-background] - Sets the background color of the field
|
|
69
71
|
* @cssprop [--field-border-color] - Sets the border color of the field
|
|
@@ -139,9 +141,9 @@ export declare class EunomiaInputPhone extends EunomiaInputPhoneMixinBase {
|
|
|
139
141
|
noResultsLabel: string;
|
|
140
142
|
/**
|
|
141
143
|
* Accessible label of the leading country-selector button.
|
|
142
|
-
*
|
|
144
|
+
* Falls back to the localized string for the current locale when unset.
|
|
143
145
|
*/
|
|
144
|
-
|
|
146
|
+
countrySelectorLabel?: string;
|
|
145
147
|
/**
|
|
146
148
|
* The raw national digits currently typed (no dial code, no separators) —
|
|
147
149
|
* *including* a leading trunk "0" if the user typed one, kept exactly as
|
|
@@ -211,6 +213,15 @@ export declare class EunomiaInputPhone extends EunomiaInputPhoneMixinBase {
|
|
|
211
213
|
* @internal
|
|
212
214
|
*/
|
|
213
215
|
private triggerPointerDownAt?;
|
|
216
|
+
constructor();
|
|
217
|
+
/**
|
|
218
|
+
* Submits the owning form on Enter in the number field, as a native text
|
|
219
|
+
* input does, since the browser never does it from a shadow root.
|
|
220
|
+
* Listened to on the host so the country list's own Enter handling is
|
|
221
|
+
* never mistaken for it.
|
|
222
|
+
* @private
|
|
223
|
+
*/
|
|
224
|
+
private readonly handleImplicitSubmission;
|
|
214
225
|
connectedCallback(): void;
|
|
215
226
|
/**
|
|
216
227
|
* Lifecycle hook called when the element is disconnected from the DOM.
|
|
@@ -268,6 +279,12 @@ export declare class EunomiaInputPhone extends EunomiaInputPhoneMixinBase {
|
|
|
268
279
|
* @param _changedProperties - Map of changed properties
|
|
269
280
|
*/
|
|
270
281
|
protected updated(_changedProperties: PropertyValues): void;
|
|
282
|
+
/**
|
|
283
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
284
|
+
* straight to the controls inside, in both directions, and
|
|
285
|
+
* {@link focus} covers a direct call on the host.
|
|
286
|
+
*/
|
|
287
|
+
protected get hostTabStop(): boolean;
|
|
271
288
|
/**
|
|
272
289
|
* Returns the field element to focus/anchor on validation errors.
|
|
273
290
|
*
|
|
@@ -8,6 +8,7 @@ var EunomiaInputPhone_1;
|
|
|
8
8
|
import { customElement, property, query, state } from "lit/decorators.js";
|
|
9
9
|
import { html, LitElement, nothing } from "lit";
|
|
10
10
|
import { classMap } from "lit/directives/class-map.js";
|
|
11
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
11
12
|
import { DisabledMixin, } from "../../../mixins/disabled.mixin.js";
|
|
12
13
|
import { ReadonlyMixin, } from "../../../mixins/readonly.mixin.js";
|
|
13
14
|
import { ValidatorsMixin, } from "../../../mixins/validators.mixin.js";
|
|
@@ -21,6 +22,8 @@ import { inputPhoneStyles } from "./input-phone.styles.js";
|
|
|
21
22
|
import { isWebKit } from "../../../utils/browser.utils.js";
|
|
22
23
|
import { COUNTRY_DIAL_CODES, formatNationalNumber, fromE164, getCountryName, getDialCode, getNationalLength, stripTrunkPrefix, getFlagEmoji, toE164, } from "./input-phone.type.js";
|
|
23
24
|
import { resolveDurationMs, resolveEasing, } from "../../../utils/motion.utils.js";
|
|
25
|
+
import { LocalizableMixin, } from "../../../mixins/localizable.mixin.js";
|
|
26
|
+
import { isImplicitSubmissionKey, submitImplicitly, } from "../../../utils/implicit-submission.utils.js";
|
|
24
27
|
/**
|
|
25
28
|
* Tag name of the phone input component.
|
|
26
29
|
*/
|
|
@@ -63,7 +66,7 @@ const TRIGGER_POINTER_DOWN_WINDOW_MS = 100;
|
|
|
63
66
|
* @internal
|
|
64
67
|
*/
|
|
65
68
|
const Base = DisabledMixin(ValidatorsMixin(LitElement));
|
|
66
|
-
const EunomiaInputPhoneMixinBase = AnchorPositionMixin(FieldAppearanceMixin(FormLabelMixin(ReadonlyMixin(FormMixin(Base)))));
|
|
69
|
+
const EunomiaInputPhoneMixinBase = LocalizableMixin(AnchorPositionMixin(FieldAppearanceMixin(FormLabelMixin(ReadonlyMixin(FormMixin(Base))))));
|
|
67
70
|
/**
|
|
68
71
|
* A phone number field rendered in two adjacent parts: a compact country
|
|
69
72
|
* selector, showing only the flag, on the leading side, and the phone
|
|
@@ -101,6 +104,7 @@ const EunomiaInputPhoneMixinBase = AnchorPositionMixin(FieldAppearanceMixin(Form
|
|
|
101
104
|
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
102
105
|
* @prop {boolean} [required=false] - Whether the field is required
|
|
103
106
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
107
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
104
108
|
* @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
|
|
105
109
|
* @prop {Array<Validators<string>>} validators - The list of validation rules applied to the field value
|
|
106
110
|
* @prop {string} [placeholder] - The placeholder shown when the field is empty. Defaults to a generic formatted digit pattern, not a real per-country example, when unset
|
|
@@ -108,8 +112,8 @@ const EunomiaInputPhoneMixinBase = AnchorPositionMixin(FieldAppearanceMixin(Form
|
|
|
108
112
|
* @attr {string} [country-search-placeholder='Search a country…'] - The placeholder of the search field inside the country dropdown
|
|
109
113
|
* @prop {string} [noResultsLabel='No results'] - Text displayed in the dropdown when no country matches the search
|
|
110
114
|
* @attr {string} [no-results-label='No results'] - Text displayed in the dropdown when no country matches the search
|
|
111
|
-
* @prop {string} [
|
|
112
|
-
* @attr {string} [
|
|
115
|
+
* @prop {string} [countrySelectorLabel] - The accessible label of the leading country selector button. Defaults to the localized string for the current locale (English: "Select a country")
|
|
116
|
+
* @attr {string} [country-selector-label] - The accessible label of the leading country selector button. Defaults to the localized string for the current locale (English: "Select a country")
|
|
113
117
|
* @fires {ChangeEvent} eunchange - Fired on every value change
|
|
114
118
|
* @cssprop [--field-background] - Sets the background color of the field
|
|
115
119
|
* @cssprop [--field-border-color] - Sets the border color of the field
|
|
@@ -136,7 +140,7 @@ const EunomiaInputPhoneMixinBase = AnchorPositionMixin(FieldAppearanceMixin(Form
|
|
|
136
140
|
*/
|
|
137
141
|
let EunomiaInputPhone = EunomiaInputPhone_1 = class EunomiaInputPhone extends EunomiaInputPhoneMixinBase {
|
|
138
142
|
constructor() {
|
|
139
|
-
super(
|
|
143
|
+
super();
|
|
140
144
|
/**
|
|
141
145
|
* Hides the leading country-selector part entirely. `country` can still
|
|
142
146
|
* be set programmatically, with no picker UI to change it.
|
|
@@ -158,11 +162,6 @@ let EunomiaInputPhone = EunomiaInputPhone_1 = class EunomiaInputPhone extends Eu
|
|
|
158
162
|
* @default No results
|
|
159
163
|
*/
|
|
160
164
|
this.noResultsLabel = "No results";
|
|
161
|
-
/**
|
|
162
|
-
* Accessible label of the leading country-selector button.
|
|
163
|
-
* @default Select a country
|
|
164
|
-
*/
|
|
165
|
-
this.ariaLabelCountrySelector = "Select a country";
|
|
166
165
|
/**
|
|
167
166
|
* The raw national digits currently typed (no dial code, no separators) —
|
|
168
167
|
* *including* a leading trunk "0" if the user typed one, kept exactly as
|
|
@@ -189,6 +188,23 @@ let EunomiaInputPhone = EunomiaInputPhone_1 = class EunomiaInputPhone extends Eu
|
|
|
189
188
|
* @internal
|
|
190
189
|
*/
|
|
191
190
|
this.highlightedIndex = -1;
|
|
191
|
+
/**
|
|
192
|
+
* Submits the owning form on Enter in the number field, as a native text
|
|
193
|
+
* input does, since the browser never does it from a shadow root.
|
|
194
|
+
* Listened to on the host so the country list's own Enter handling is
|
|
195
|
+
* never mistaken for it.
|
|
196
|
+
* @private
|
|
197
|
+
*/
|
|
198
|
+
this.handleImplicitSubmission = (event) => {
|
|
199
|
+
const form = this.internals.form;
|
|
200
|
+
if (!form ||
|
|
201
|
+
event.composedPath()[0] !== this.fieldEl ||
|
|
202
|
+
!isImplicitSubmissionKey(event)) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
submitImplicitly(form);
|
|
207
|
+
};
|
|
192
208
|
/**
|
|
193
209
|
* Closes the dropdown when the browser window itself loses focus (e.g.
|
|
194
210
|
* Alt-Tab to another application). The Popover API's own light-dismiss
|
|
@@ -267,6 +283,7 @@ let EunomiaInputPhone = EunomiaInputPhone_1 = class EunomiaInputPhone extends Eu
|
|
|
267
283
|
this.unanchorFloatingElement();
|
|
268
284
|
this.unobserveAnchorVisibility();
|
|
269
285
|
};
|
|
286
|
+
this.addEventListener("keydown", this.handleImplicitSubmission);
|
|
270
287
|
}
|
|
271
288
|
connectedCallback() {
|
|
272
289
|
super.connectedCallback?.();
|
|
@@ -341,6 +358,14 @@ let EunomiaInputPhone = EunomiaInputPhone_1 = class EunomiaInputPhone extends Eu
|
|
|
341
358
|
?.scrollIntoView({ block: "nearest" });
|
|
342
359
|
}
|
|
343
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
363
|
+
* straight to the controls inside, in both directions, and
|
|
364
|
+
* {@link focus} covers a direct call on the host.
|
|
365
|
+
*/
|
|
366
|
+
get hostTabStop() {
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
344
369
|
/**
|
|
345
370
|
* Returns the field element to focus/anchor on validation errors.
|
|
346
371
|
*
|
|
@@ -635,7 +660,8 @@ let EunomiaInputPhone = EunomiaInputPhone_1 = class EunomiaInputPhone extends Eu
|
|
|
635
660
|
aria-haspopup="listbox"
|
|
636
661
|
aria-expanded=${this.isOpen}
|
|
637
662
|
aria-controls="listbox"
|
|
638
|
-
aria-label=${this.
|
|
663
|
+
aria-label=${this.countrySelectorLabel ??
|
|
664
|
+
this.dictionary.inputPhone.selectCountry}
|
|
639
665
|
?disabled=${this.disabled || this.readonly}
|
|
640
666
|
@pointerdown=${this.handleTriggerPointerDown}
|
|
641
667
|
@click=${this.handleTriggerClick}
|
|
@@ -662,7 +688,8 @@ let EunomiaInputPhone = EunomiaInputPhone_1 = class EunomiaInputPhone extends Eu
|
|
|
662
688
|
<ul
|
|
663
689
|
id="listbox"
|
|
664
690
|
role="listbox"
|
|
665
|
-
aria-label=${this.
|
|
691
|
+
aria-label=${this.countrySelectorLabel ??
|
|
692
|
+
this.dictionary.inputPhone.selectCountry}
|
|
666
693
|
popover="auto"
|
|
667
694
|
@toggle=${this.handlePopoverToggle}
|
|
668
695
|
>
|
|
@@ -739,6 +766,7 @@ let EunomiaInputPhone = EunomiaInputPhone_1 = class EunomiaInputPhone extends Eu
|
|
|
739
766
|
placeholder=${this.effectivePlaceholder}
|
|
740
767
|
?disabled=${this.disabled}
|
|
741
768
|
?readonly=${this.readonly}
|
|
769
|
+
aria-label=${ifDefined(this.label)}
|
|
742
770
|
aria-describedby=${hasDescription ? "description" : nothing}
|
|
743
771
|
aria-invalid=${this.showError}
|
|
744
772
|
@input=${this.handlePhoneInput}
|
|
@@ -793,8 +821,8 @@ __decorate([
|
|
|
793
821
|
property({ attribute: "no-results-label" })
|
|
794
822
|
], EunomiaInputPhone.prototype, "noResultsLabel", void 0);
|
|
795
823
|
__decorate([
|
|
796
|
-
property({ attribute: "
|
|
797
|
-
], EunomiaInputPhone.prototype, "
|
|
824
|
+
property({ attribute: "country-selector-label" })
|
|
825
|
+
], EunomiaInputPhone.prototype, "countrySelectorLabel", void 0);
|
|
798
826
|
__decorate([
|
|
799
827
|
state()
|
|
800
828
|
], EunomiaInputPhone.prototype, "nationalDigits", void 0);
|
|
@@ -23,6 +23,7 @@ export declare const EunomiaRadioCardTagName = "eun-radio-card";
|
|
|
23
23
|
* @prop {boolean} [disabled=false] - Whether the card is disabled
|
|
24
24
|
* @prop {boolean} [readonly=false] - Whether the card is read only
|
|
25
25
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
26
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
26
27
|
* @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
|
|
27
28
|
* @attr {boolean} [hide-error=false] - Whether the error message is hidden. The hint stays visible
|
|
28
29
|
* @prop {boolean} [required=false] - Whether a selection is required
|
|
@@ -34,6 +34,7 @@ export const EunomiaRadioCardTagName = "eun-radio-card";
|
|
|
34
34
|
* @prop {boolean} [disabled=false] - Whether the card is disabled
|
|
35
35
|
* @prop {boolean} [readonly=false] - Whether the card 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
|
|
@@ -33,6 +33,7 @@ declare const EunomiaRadioList_base: import("../../../utils/constructor.type.js"
|
|
|
33
33
|
* @prop {string} [defaultValue] - The value reselected when the list connects, and restored on form reset
|
|
34
34
|
* @attr {string} [default-value] - The value reselected when the list connects, and restored on form reset
|
|
35
35
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
36
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
36
37
|
* @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
|
|
37
38
|
* @attr {boolean} [hide-error=false] - Whether the errors are hidden. The hint stays visible
|
|
38
39
|
* @prop {Array<import('../../../types/form-validators.type.js').Validators<string | undefined>>} validators - A list of validation rules applied to the group's selected value
|
|
@@ -53,6 +54,11 @@ export declare class EunomiaRadioList extends EunomiaRadioList_base {
|
|
|
53
54
|
* @readonly
|
|
54
55
|
*/
|
|
55
56
|
static readonly styles: import("lit").CSSResult[];
|
|
57
|
+
/**
|
|
58
|
+
* Every change is a complete choice, so its error shows right away.
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
errorOnChange: boolean;
|
|
56
62
|
/**
|
|
57
63
|
* Configuration options for the component Shadow DOM
|
|
58
64
|
* @internal
|
|
@@ -110,8 +116,7 @@ export declare class EunomiaRadioList extends EunomiaRadioList_base {
|
|
|
110
116
|
* Assigns `name`/`id` to every child, applies a `default-value` selection
|
|
111
117
|
* once the slotted children actually exist (see `handleSlotChange` for
|
|
112
118
|
* why this can't rely on `FormMixin`'s own `defaultValue` setter alone),
|
|
113
|
-
*
|
|
114
|
-
* markup, and sets up the initial roving `tabindex`.
|
|
119
|
+
* and sets up the initial roving `tabindex`.
|
|
115
120
|
*
|
|
116
121
|
* The roving `tabindex` is applied only once every child's own first
|
|
117
122
|
* update has settled — each `eun-radio` is itself a `DisabledMixin` user,
|
|
@@ -130,6 +135,17 @@ export declare class EunomiaRadioList extends EunomiaRadioList_base {
|
|
|
130
135
|
* Cleans up event listeners.
|
|
131
136
|
*/
|
|
132
137
|
disconnectedCallback(): void;
|
|
138
|
+
/**
|
|
139
|
+
* Whether the group's own `disabled`/`readonly` changed in a way to pass
|
|
140
|
+
* on to every child : always once set, but not for the initial `false`,
|
|
141
|
+
* which would otherwise re-enable a child disabled on its own.
|
|
142
|
+
*
|
|
143
|
+
* @param changed - The changed properties of the update.
|
|
144
|
+
* @param name - The property to check.
|
|
145
|
+
* @returns true when the children should take the group's value.
|
|
146
|
+
* @private
|
|
147
|
+
*/
|
|
148
|
+
private isGroupChange;
|
|
133
149
|
/**
|
|
134
150
|
* Lifecycle hook called whenever reactive properties change.
|
|
135
151
|
* @param _changedProperties - Map of changed properties
|
|
@@ -155,8 +171,8 @@ export declare class EunomiaRadioList extends EunomiaRadioList_base {
|
|
|
155
171
|
*/
|
|
156
172
|
private handleKeydown;
|
|
157
173
|
/**
|
|
158
|
-
* Applies the roving `tabindex` : the checked child (or the first
|
|
159
|
-
* none is checked yet) is the group's single tab stop, matching a native
|
|
174
|
+
* Applies the roving `tabindex` : the checked child (or the first enabled
|
|
175
|
+
* one, if none is checked yet) is the group's single tab stop, matching a native
|
|
160
176
|
* `radiogroup`'s "one tab stop, arrows move focus" behavior.
|
|
161
177
|
* @private
|
|
162
178
|
*/
|
|
@@ -170,7 +186,7 @@ export declare class EunomiaRadioList extends EunomiaRadioList_base {
|
|
|
170
186
|
private readonly handleChangeEvent;
|
|
171
187
|
/**
|
|
172
188
|
* Checks the given child, unchecking every other one, updates the roving
|
|
173
|
-
* `tabindex
|
|
189
|
+
* `tabindex`, and re-validates the group.
|
|
174
190
|
*
|
|
175
191
|
* @param item the child to activate
|
|
176
192
|
* @param focus whether to also move DOM focus onto it (arrow-key navigation)
|
|
@@ -190,8 +206,8 @@ export declare class EunomiaRadioList extends EunomiaRadioList_base {
|
|
|
190
206
|
private sendChangeEvent;
|
|
191
207
|
/**
|
|
192
208
|
* Handler called when slot content changes.
|
|
193
|
-
* Propagates the group `name` and assigns a stable `id`
|
|
194
|
-
*
|
|
209
|
+
* Propagates the group `name` and assigns a stable `id` to every child
|
|
210
|
+
* radio.
|
|
195
211
|
*
|
|
196
212
|
* @private
|
|
197
213
|
*/
|
|
@@ -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
|