@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
|
@@ -17,6 +17,8 @@ import { ChangeEvent } from "../../../events/change.event.js";
|
|
|
17
17
|
import { formLabelsStyles } from "../shared-styles/form-labels.styles.js";
|
|
18
18
|
import { counterStyles } from "./counter.styles.js";
|
|
19
19
|
import { pickValidity } from "../../../utils/validity.utils.js";
|
|
20
|
+
import { LocalizableMixin, } from "../../../mixins/localizable.mixin.js";
|
|
21
|
+
import { isImplicitSubmissionKey, submitImplicitly, } from "../../../utils/implicit-submission.utils.js";
|
|
20
22
|
/**
|
|
21
23
|
* Tag name of the counter component.
|
|
22
24
|
*/
|
|
@@ -26,7 +28,7 @@ export const EunomiaCounterTagName = "eun-counter";
|
|
|
26
28
|
* @internal
|
|
27
29
|
*/
|
|
28
30
|
const Base = DisabledMixin(ValidatorsMixin(LitElement));
|
|
29
|
-
const EunomiaCounterMixinBase = FieldAppearanceMixin(FormLabelMixin(ReadonlyMixin(FormMixin(Base))));
|
|
31
|
+
const EunomiaCounterMixinBase = LocalizableMixin(FieldAppearanceMixin(FormLabelMixin(ReadonlyMixin(FormMixin(Base)))));
|
|
30
32
|
/**
|
|
31
33
|
* A numeric field with increment and decrement buttons, built on a native
|
|
32
34
|
* number input.
|
|
@@ -45,13 +47,14 @@ const EunomiaCounterMixinBase = FieldAppearanceMixin(FormLabelMixin(ReadonlyMixi
|
|
|
45
47
|
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
46
48
|
* @prop {boolean} [required=false] - Whether the field is required
|
|
47
49
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
50
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
48
51
|
* @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
|
|
49
52
|
* @attr {boolean} [hide-error=false] - Whether the errors are hidden
|
|
50
53
|
* @prop {Array<import('../../../types/form-validators.type.js').Validators<number>>} validators - The list of validation rules applied to the field value
|
|
51
|
-
* @prop {string} [
|
|
52
|
-
* @attr {string} [
|
|
53
|
-
* @prop {string} [
|
|
54
|
-
* @attr {string} [
|
|
54
|
+
* @prop {string} [incrementLabel] - The accessible label of the increment button. Defaults to the localized string for the current locale (English: "Increase value")
|
|
55
|
+
* @attr {string} [increment-label] - The accessible label of the increment button. Defaults to the localized string for the current locale (English: "Increase value")
|
|
56
|
+
* @prop {string} [decrementLabel] - The accessible label of the decrement button. Defaults to the localized string for the current locale (English: "Decrease value")
|
|
57
|
+
* @attr {string} [decrement-label] - The accessible label of the decrement button. Defaults to the localized string for the current locale (English: "Decrease value")
|
|
55
58
|
* @fires {ChangeEvent} eunchange - Fired on every value change
|
|
56
59
|
* @cssprop [--counter-background] - Sets the background color of the field
|
|
57
60
|
* @cssprop [--counter-border-color] - Sets the border color of the field
|
|
@@ -70,50 +73,6 @@ const EunomiaCounterMixinBase = FieldAppearanceMixin(FormLabelMixin(ReadonlyMixi
|
|
|
70
73
|
* @element eun-counter
|
|
71
74
|
*/
|
|
72
75
|
let EunomiaCounter = class EunomiaCounter extends EunomiaCounterMixinBase {
|
|
73
|
-
constructor() {
|
|
74
|
-
super(...arguments);
|
|
75
|
-
/**
|
|
76
|
-
* The amount the value changes on every increment/decrement.
|
|
77
|
-
* @default 1
|
|
78
|
-
*/
|
|
79
|
-
this.step = 1;
|
|
80
|
-
/**
|
|
81
|
-
* Accessible label of the increment button.
|
|
82
|
-
* @default Increase value
|
|
83
|
-
*/
|
|
84
|
-
this.ariaLabelIncrement = "Increase value";
|
|
85
|
-
/**
|
|
86
|
-
* Accessible label of the decrement button.
|
|
87
|
-
* @default Decrease value
|
|
88
|
-
*/
|
|
89
|
-
this.ariaLabelDecrement = "Decrease value";
|
|
90
|
-
/**
|
|
91
|
-
* Redirects focus to the native field whenever the host itself receives
|
|
92
|
-
* it. See `eun-input`'s identical pattern : the host stays in the tab
|
|
93
|
-
* order (`DisabledMixin`) rather than being excluded via `tabindex="-1"`,
|
|
94
|
-
* which broke Tab from reaching the field entirely for this
|
|
95
|
-
* form-associated component, instead of just skipping the host.
|
|
96
|
-
* @private
|
|
97
|
-
*/
|
|
98
|
-
this.handleHostFocus = () => {
|
|
99
|
-
this.fieldEl?.focus();
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* Reads native HTML constraint validation from the underlying field
|
|
103
|
-
* element (`required`, `min`, `max`, `step`, `badInput`).
|
|
104
|
-
*
|
|
105
|
-
* @returns validity state and optional message.
|
|
106
|
-
*/
|
|
107
|
-
this.checkLocalValidators = () => {
|
|
108
|
-
return pickValidity(this.fieldEl, [
|
|
109
|
-
"valueMissing",
|
|
110
|
-
"rangeUnderflow",
|
|
111
|
-
"rangeOverflow",
|
|
112
|
-
"stepMismatch",
|
|
113
|
-
"badInput",
|
|
114
|
-
]);
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
76
|
/**
|
|
118
77
|
* The current numeric value, `undefined` while empty (e.g. after the
|
|
119
78
|
* field is cleared by the user). Overrides the `value` accessor
|
|
@@ -151,13 +110,52 @@ let EunomiaCounter = class EunomiaCounter extends EunomiaCounterMixinBase {
|
|
|
151
110
|
// @ts-expect-error — see comment above ; FormMixin's real setter exists.
|
|
152
111
|
super.defaultValue = value;
|
|
153
112
|
}
|
|
154
|
-
|
|
155
|
-
super
|
|
156
|
-
|
|
113
|
+
constructor() {
|
|
114
|
+
super();
|
|
115
|
+
/**
|
|
116
|
+
* The amount the value changes on every increment/decrement.
|
|
117
|
+
* @default 1
|
|
118
|
+
*/
|
|
119
|
+
this.step = 1;
|
|
120
|
+
/**
|
|
121
|
+
* Submits the owning form on Enter in the field, as a native number
|
|
122
|
+
* input does, since the browser never does it from a shadow root.
|
|
123
|
+
* @private
|
|
124
|
+
*/
|
|
125
|
+
this.handleImplicitSubmission = (event) => {
|
|
126
|
+
const form = this.internals.form;
|
|
127
|
+
if (!form ||
|
|
128
|
+
event.composedPath()[0] !== this.fieldEl ||
|
|
129
|
+
!isImplicitSubmissionKey(event)) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
submitImplicitly(form);
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Reads native HTML constraint validation from the underlying field
|
|
137
|
+
* element (`required`, `min`, `max`, `step`, `badInput`).
|
|
138
|
+
*
|
|
139
|
+
* @returns validity state and optional message.
|
|
140
|
+
*/
|
|
141
|
+
this.checkLocalValidators = () => {
|
|
142
|
+
return pickValidity(this.fieldEl, [
|
|
143
|
+
"valueMissing",
|
|
144
|
+
"rangeUnderflow",
|
|
145
|
+
"rangeOverflow",
|
|
146
|
+
"stepMismatch",
|
|
147
|
+
"badInput",
|
|
148
|
+
]);
|
|
149
|
+
};
|
|
150
|
+
this.addEventListener("keydown", this.handleImplicitSubmission);
|
|
157
151
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
152
|
+
/**
|
|
153
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
154
|
+
* straight to the controls inside, in both directions, and
|
|
155
|
+
* {@link focus} covers a direct call on the host.
|
|
156
|
+
*/
|
|
157
|
+
get hostTabStop() {
|
|
158
|
+
return false;
|
|
161
159
|
}
|
|
162
160
|
/**
|
|
163
161
|
* Returns the field element to focus/anchor on validation errors.
|
|
@@ -299,7 +297,7 @@ let EunomiaCounter = class EunomiaCounter extends EunomiaCounterMixinBase {
|
|
|
299
297
|
type="button"
|
|
300
298
|
id="decrement"
|
|
301
299
|
tabindex="-1"
|
|
302
|
-
aria-label=${this.
|
|
300
|
+
aria-label=${this.decrementLabel ?? this.dictionary.counter.decrement}
|
|
303
301
|
?disabled=${!canDecrement}
|
|
304
302
|
@click=${() => this.stepBy(-1)}
|
|
305
303
|
>
|
|
@@ -326,7 +324,7 @@ let EunomiaCounter = class EunomiaCounter extends EunomiaCounterMixinBase {
|
|
|
326
324
|
type="button"
|
|
327
325
|
id="increment"
|
|
328
326
|
tabindex="-1"
|
|
329
|
-
aria-label=${this.
|
|
327
|
+
aria-label=${this.incrementLabel ?? this.dictionary.counter.increment}
|
|
330
328
|
?disabled=${!canIncrement}
|
|
331
329
|
@click=${() => this.stepBy(1)}
|
|
332
330
|
>
|
|
@@ -371,11 +369,11 @@ __decorate([
|
|
|
371
369
|
property({ type: Number })
|
|
372
370
|
], EunomiaCounter.prototype, "step", void 0);
|
|
373
371
|
__decorate([
|
|
374
|
-
property({ attribute: "
|
|
375
|
-
], EunomiaCounter.prototype, "
|
|
372
|
+
property({ attribute: "increment-label" })
|
|
373
|
+
], EunomiaCounter.prototype, "incrementLabel", void 0);
|
|
376
374
|
__decorate([
|
|
377
|
-
property({ attribute: "
|
|
378
|
-
], EunomiaCounter.prototype, "
|
|
375
|
+
property({ attribute: "decrement-label" })
|
|
376
|
+
], EunomiaCounter.prototype, "decrementLabel", void 0);
|
|
379
377
|
__decorate([
|
|
380
378
|
property({ type: Number })
|
|
381
379
|
// @ts-expect-error — see comment above ; real getter returns `U | undefined`.
|
|
@@ -64,12 +64,13 @@ declare const EunomiaDatePickerMixinBase: Constructor<EunomiaDatePickerBase>;
|
|
|
64
64
|
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
65
65
|
* @prop {boolean} [required=false] - Whether the field is required
|
|
66
66
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
67
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
67
68
|
* @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
|
|
68
69
|
* @prop {Array<Validators<Date | null>>} validators - The list of custom validation rules applied to the value
|
|
69
70
|
* @prop {string} [todayLabel='Today'] - The label of the day grid's jump to today shortcut. Only shown with day granularity
|
|
70
71
|
* @prop {string} [applyLabel='Apply'] - The label of the mobile modal's confirm button
|
|
71
|
-
* @prop {string} [cancelLabel
|
|
72
|
-
* @prop {string} [
|
|
72
|
+
* @prop {string} [cancelLabel] - The label of the mobile modal's cancel button. Defaults to the localized string for the current locale (English: "Cancel")
|
|
73
|
+
* @prop {string} [calendarLabel] - The accessible label of the trailing calendar button. Defaults to the localized string for the current locale (English: "Open calendar")
|
|
73
74
|
* @prop {string} [dayPlaceholder='jj'] - The placeholder shown in the empty day segment
|
|
74
75
|
* @prop {string} [monthPlaceholder='mm'] - The placeholder shown in the empty month segment
|
|
75
76
|
* @prop {string} [yearPlaceholder='yyyy'] - The placeholder shown in the empty year segment
|
|
@@ -121,6 +122,11 @@ export declare class EunomiaDatePicker extends EunomiaDatePickerMixinBase {
|
|
|
121
122
|
* @readonly
|
|
122
123
|
*/
|
|
123
124
|
static readonly styles: (import("lit").CSSResult | import("lit").CSSResult[])[];
|
|
125
|
+
/**
|
|
126
|
+
* Every change is a complete choice, so its error shows right away.
|
|
127
|
+
* @internal
|
|
128
|
+
*/
|
|
129
|
+
errorOnChange: boolean;
|
|
124
130
|
/**
|
|
125
131
|
* Whether a single value or a start/end range is picked.
|
|
126
132
|
* @default single
|
|
@@ -254,14 +260,14 @@ export declare class EunomiaDatePicker extends EunomiaDatePickerMixinBase {
|
|
|
254
260
|
applyLabel: string;
|
|
255
261
|
/**
|
|
256
262
|
* Label of the mobile modal's cancel button.
|
|
257
|
-
*
|
|
263
|
+
* Falls back to the localized string for the current locale when unset.
|
|
258
264
|
*/
|
|
259
|
-
cancelLabel
|
|
265
|
+
cancelLabel?: string;
|
|
260
266
|
/**
|
|
261
267
|
* Accessible label of the trailing calendar button.
|
|
262
|
-
*
|
|
268
|
+
* Falls back to the localized string for the current locale when unset.
|
|
263
269
|
*/
|
|
264
|
-
|
|
270
|
+
calendarLabel?: string;
|
|
265
271
|
/**
|
|
266
272
|
* Placeholder shown in the empty day segment.
|
|
267
273
|
* @default jj
|
|
@@ -443,6 +449,15 @@ export declare class EunomiaDatePicker extends EunomiaDatePickerMixinBase {
|
|
|
443
449
|
* {@link defaultRangeValue} to `rangeValue` the same way for
|
|
444
450
|
* `mode="range"`, which `FormMixin` has no knowledge of.
|
|
445
451
|
*/
|
|
452
|
+
constructor();
|
|
453
|
+
/**
|
|
454
|
+
* Submits the owning form on Enter in one of the field's segments, as a
|
|
455
|
+
* native date input does, since the browser never does it from a
|
|
456
|
+
* shadow root. Left alone while the panel is open, and on keys a
|
|
457
|
+
* segment already handles, such as Enter toggling the AM/PM segment.
|
|
458
|
+
* @private
|
|
459
|
+
*/
|
|
460
|
+
private readonly handleImplicitSubmission;
|
|
446
461
|
connectedCallback(): void;
|
|
447
462
|
/**
|
|
448
463
|
* Resets the field to its default on a native form `reset()`.
|
|
@@ -513,6 +528,12 @@ export declare class EunomiaDatePicker extends EunomiaDatePickerMixinBase {
|
|
|
513
528
|
* @returns validity state and optional message.
|
|
514
529
|
*/
|
|
515
530
|
buildCommonValidators: () => Validity;
|
|
531
|
+
/**
|
|
532
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
533
|
+
* straight to the controls inside, in both directions, and
|
|
534
|
+
* {@link focus} covers a direct call on the host.
|
|
535
|
+
*/
|
|
536
|
+
protected get hostTabStop(): boolean;
|
|
516
537
|
/**
|
|
517
538
|
* Returns the first segment field to focus/anchor on validation errors.
|
|
518
539
|
*
|
|
@@ -35,6 +35,7 @@ import { isDisabledDay, renderDatePickerDayGrid, } from "./date-picker-day-grid.
|
|
|
35
35
|
import { isDisabledMonth, renderDatePickerMonthGrid, } from "./date-picker-month-grid.js";
|
|
36
36
|
import { getYearPageStart, isDisabledYear, renderDatePickerYearGrid, } from "./date-picker-year-grid.js";
|
|
37
37
|
import { resolveDurationMs, resolveEasing, } from "../../../utils/motion.utils.js";
|
|
38
|
+
import { isImplicitSubmissionKey, submitImplicitly, } from "../../../utils/implicit-submission.utils.js";
|
|
38
39
|
/**
|
|
39
40
|
* Tag name of the date-picker component.
|
|
40
41
|
*/
|
|
@@ -99,12 +100,13 @@ const EunomiaDatePickerMixinBase = LocalizableMixin(AnchorPositionMixin(FieldApp
|
|
|
99
100
|
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
100
101
|
* @prop {boolean} [required=false] - Whether the field is required
|
|
101
102
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
103
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
102
104
|
* @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
|
|
103
105
|
* @prop {Array<Validators<Date | null>>} validators - The list of custom validation rules applied to the value
|
|
104
106
|
* @prop {string} [todayLabel='Today'] - The label of the day grid's jump to today shortcut. Only shown with day granularity
|
|
105
107
|
* @prop {string} [applyLabel='Apply'] - The label of the mobile modal's confirm button
|
|
106
|
-
* @prop {string} [cancelLabel
|
|
107
|
-
* @prop {string} [
|
|
108
|
+
* @prop {string} [cancelLabel] - The label of the mobile modal's cancel button. Defaults to the localized string for the current locale (English: "Cancel")
|
|
109
|
+
* @prop {string} [calendarLabel] - The accessible label of the trailing calendar button. Defaults to the localized string for the current locale (English: "Open calendar")
|
|
108
110
|
* @prop {string} [dayPlaceholder='jj'] - The placeholder shown in the empty day segment
|
|
109
111
|
* @prop {string} [monthPlaceholder='mm'] - The placeholder shown in the empty month segment
|
|
110
112
|
* @prop {string} [yearPlaceholder='yyyy'] - The placeholder shown in the empty year segment
|
|
@@ -148,8 +150,37 @@ const EunomiaDatePickerMixinBase = LocalizableMixin(AnchorPositionMixin(FieldApp
|
|
|
148
150
|
* @element eun-date-picker
|
|
149
151
|
*/
|
|
150
152
|
let EunomiaDatePicker = EunomiaDatePicker_1 = class EunomiaDatePicker extends EunomiaDatePickerMixinBase {
|
|
153
|
+
/**
|
|
154
|
+
* The default value applied on connection and form reset, in `single`
|
|
155
|
+
* mode. Overrides the `defaultValue` accessor inherited from `FormMixin`
|
|
156
|
+
* only to swap its attribute converter : the mixin's generic one always
|
|
157
|
+
* splits `default-value` on commas (appropriate for e.g. a multi-select's
|
|
158
|
+
* array value), which would silently produce the wrong thing for a
|
|
159
|
+
* `Date`. The actual get/set logic (applying the default when the field
|
|
160
|
+
* resets) still comes from `FormMixin` itself, via `super`.
|
|
161
|
+
* @default-value-format yyyy-mm-dd
|
|
162
|
+
*/
|
|
163
|
+
get defaultValue() {
|
|
164
|
+
return super.defaultValue;
|
|
165
|
+
}
|
|
166
|
+
set defaultValue(value) {
|
|
167
|
+
// @ts-expect-error — see comment above ; FormMixin's real setter exists.
|
|
168
|
+
super.defaultValue = value;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Lifecycle callback triggered when the component is connected to the
|
|
172
|
+
* DOM. `FormMixin`'s own `connectedCallback` already applies
|
|
173
|
+
* `defaultValue` to `value` for `mode="single"` ; this applies
|
|
174
|
+
* {@link defaultRangeValue} to `rangeValue` the same way for
|
|
175
|
+
* `mode="range"`, which `FormMixin` has no knowledge of.
|
|
176
|
+
*/
|
|
151
177
|
constructor() {
|
|
152
|
-
super(
|
|
178
|
+
super();
|
|
179
|
+
/**
|
|
180
|
+
* Every change is a complete choice, so its error shows right away.
|
|
181
|
+
* @internal
|
|
182
|
+
*/
|
|
183
|
+
this.errorOnChange = true;
|
|
153
184
|
/**
|
|
154
185
|
* Whether a single value or a start/end range is picked.
|
|
155
186
|
* @default single
|
|
@@ -229,16 +260,6 @@ let EunomiaDatePicker = EunomiaDatePicker_1 = class EunomiaDatePicker extends Eu
|
|
|
229
260
|
* @default Apply
|
|
230
261
|
*/
|
|
231
262
|
this.applyLabel = "Apply";
|
|
232
|
-
/**
|
|
233
|
-
* Label of the mobile modal's cancel button.
|
|
234
|
-
* @default Cancel
|
|
235
|
-
*/
|
|
236
|
-
this.cancelLabel = "Cancel";
|
|
237
|
-
/**
|
|
238
|
-
* Accessible label of the trailing calendar button.
|
|
239
|
-
* @default Open calendar
|
|
240
|
-
*/
|
|
241
|
-
this.ariaLabelCalendar = "Open calendar";
|
|
242
263
|
/**
|
|
243
264
|
* Placeholder shown in the empty day segment.
|
|
244
265
|
* @default jj
|
|
@@ -360,6 +381,25 @@ let EunomiaDatePicker = EunomiaDatePicker_1 = class EunomiaDatePicker extends Eu
|
|
|
360
381
|
minute: "",
|
|
361
382
|
period: "",
|
|
362
383
|
};
|
|
384
|
+
/**
|
|
385
|
+
* Submits the owning form on Enter in one of the field's segments, as a
|
|
386
|
+
* native date input does, since the browser never does it from a
|
|
387
|
+
* shadow root. Left alone while the panel is open, and on keys a
|
|
388
|
+
* segment already handles, such as Enter toggling the AM/PM segment.
|
|
389
|
+
* @private
|
|
390
|
+
*/
|
|
391
|
+
this.handleImplicitSubmission = (event) => {
|
|
392
|
+
const form = this.internals.form;
|
|
393
|
+
const origin = event.composedPath()[0];
|
|
394
|
+
if (!form ||
|
|
395
|
+
this.isOpen ||
|
|
396
|
+
!(origin instanceof Element && origin.matches(".segment")) ||
|
|
397
|
+
!isImplicitSubmissionKey(event)) {
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
event.preventDefault();
|
|
401
|
+
submitImplicitly(form);
|
|
402
|
+
};
|
|
363
403
|
/**
|
|
364
404
|
* Reads local validation state : a partially/invalidly typed segment
|
|
365
405
|
* group reports as invalid, matching native constraint validation's
|
|
@@ -978,31 +1018,8 @@ let EunomiaDatePicker = EunomiaDatePicker_1 = class EunomiaDatePicker extends Eu
|
|
|
978
1018
|
break;
|
|
979
1019
|
}
|
|
980
1020
|
};
|
|
1021
|
+
this.addEventListener("keydown", this.handleImplicitSubmission);
|
|
981
1022
|
}
|
|
982
|
-
/**
|
|
983
|
-
* The default value applied on connection and form reset, in `single`
|
|
984
|
-
* mode. Overrides the `defaultValue` accessor inherited from `FormMixin`
|
|
985
|
-
* only to swap its attribute converter : the mixin's generic one always
|
|
986
|
-
* splits `default-value` on commas (appropriate for e.g. a multi-select's
|
|
987
|
-
* array value), which would silently produce the wrong thing for a
|
|
988
|
-
* `Date`. The actual get/set logic (applying the default when the field
|
|
989
|
-
* resets) still comes from `FormMixin` itself, via `super`.
|
|
990
|
-
* @default-value-format yyyy-mm-dd
|
|
991
|
-
*/
|
|
992
|
-
get defaultValue() {
|
|
993
|
-
return super.defaultValue;
|
|
994
|
-
}
|
|
995
|
-
set defaultValue(value) {
|
|
996
|
-
// @ts-expect-error — see comment above ; FormMixin's real setter exists.
|
|
997
|
-
super.defaultValue = value;
|
|
998
|
-
}
|
|
999
|
-
/**
|
|
1000
|
-
* Lifecycle callback triggered when the component is connected to the
|
|
1001
|
-
* DOM. `FormMixin`'s own `connectedCallback` already applies
|
|
1002
|
-
* `defaultValue` to `value` for `mode="single"` ; this applies
|
|
1003
|
-
* {@link defaultRangeValue} to `rangeValue` the same way for
|
|
1004
|
-
* `mode="range"`, which `FormMixin` has no knowledge of.
|
|
1005
|
-
*/
|
|
1006
1023
|
connectedCallback() {
|
|
1007
1024
|
super.connectedCallback?.();
|
|
1008
1025
|
if (this.mode === "range" && this.defaultRangeValue) {
|
|
@@ -1096,6 +1113,14 @@ let EunomiaDatePicker = EunomiaDatePicker_1 = class EunomiaDatePicker extends Eu
|
|
|
1096
1113
|
this.setAttribute("aria-invalid", String(this.showError));
|
|
1097
1114
|
}
|
|
1098
1115
|
}
|
|
1116
|
+
/**
|
|
1117
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
1118
|
+
* straight to the controls inside, in both directions, and
|
|
1119
|
+
* {@link focus} covers a direct call on the host.
|
|
1120
|
+
*/
|
|
1121
|
+
get hostTabStop() {
|
|
1122
|
+
return false;
|
|
1123
|
+
}
|
|
1099
1124
|
/**
|
|
1100
1125
|
* Returns the first segment field to focus/anchor on validation errors.
|
|
1101
1126
|
*
|
|
@@ -2033,6 +2058,7 @@ let EunomiaDatePicker = EunomiaDatePicker_1 = class EunomiaDatePicker extends Eu
|
|
|
2033
2058
|
data-target=${target}
|
|
2034
2059
|
role="group"
|
|
2035
2060
|
aria-label=${groupLabel}
|
|
2061
|
+
aria-describedby=${this.description?.length ? "description" : nothing}
|
|
2036
2062
|
>
|
|
2037
2063
|
${order.map((kind, index) => html `
|
|
2038
2064
|
${index > 0
|
|
@@ -2073,7 +2099,7 @@ let EunomiaDatePicker = EunomiaDatePicker_1 = class EunomiaDatePicker extends Eu
|
|
|
2073
2099
|
maxlength=${maxLength}
|
|
2074
2100
|
size=${maxLength}
|
|
2075
2101
|
placeholder=${this.placeholderFor(kind)}
|
|
2076
|
-
aria-label=${
|
|
2102
|
+
aria-label=${this.dictionary.datePicker[kind]}
|
|
2077
2103
|
.value=${values[kind]}
|
|
2078
2104
|
?disabled=${this.disabled}
|
|
2079
2105
|
?readonly=${this.readonly}
|
|
@@ -2232,15 +2258,16 @@ let EunomiaDatePicker = EunomiaDatePicker_1 = class EunomiaDatePicker extends Eu
|
|
|
2232
2258
|
${this.mode === "single"
|
|
2233
2259
|
? this.renderSegmentGroup("value", this.label ?? this.headingFor())
|
|
2234
2260
|
: html `
|
|
2235
|
-
${this.renderSegmentGroup("start",
|
|
2261
|
+
${this.renderSegmentGroup("start", this.dictionary.datePicker.startDate)}
|
|
2236
2262
|
<span class="range-separator" aria-hidden="true">–</span>
|
|
2237
|
-
${this.renderSegmentGroup("end",
|
|
2263
|
+
${this.renderSegmentGroup("end", this.dictionary.datePicker.endDate)}
|
|
2238
2264
|
`}
|
|
2239
2265
|
${this.isWithTimeActive() ? this.renderTimeSegmentGroup() : nothing}
|
|
2240
2266
|
<button
|
|
2241
2267
|
type="button"
|
|
2242
2268
|
id="calendar-trigger"
|
|
2243
|
-
aria-label=${this.
|
|
2269
|
+
aria-label=${this.calendarLabel ??
|
|
2270
|
+
this.dictionary.datePicker.openCalendar}
|
|
2244
2271
|
aria-haspopup="dialog"
|
|
2245
2272
|
aria-expanded=${this.isOpen || this.isModalOpen ? "true" : "false"}
|
|
2246
2273
|
?disabled=${this.disabled}
|
|
@@ -2389,7 +2416,7 @@ let EunomiaDatePicker = EunomiaDatePicker_1 = class EunomiaDatePicker extends Eu
|
|
|
2389
2416
|
id="popover-cancel"
|
|
2390
2417
|
@click=${this.handlePopoverCancel}
|
|
2391
2418
|
>
|
|
2392
|
-
${this.cancelLabel}
|
|
2419
|
+
${this.cancelLabel ?? this.dictionary.common.cancel}
|
|
2393
2420
|
</eun-button>
|
|
2394
2421
|
<eun-button id="popover-apply" @click=${this.handlePopoverApply}>
|
|
2395
2422
|
${this.applyLabel}
|
|
@@ -2415,7 +2442,7 @@ let EunomiaDatePicker = EunomiaDatePicker_1 = class EunomiaDatePicker extends Eu
|
|
|
2415
2442
|
?open=${this.isModalOpen}
|
|
2416
2443
|
.closeable=${false}
|
|
2417
2444
|
confirm-label=${this.applyLabel}
|
|
2418
|
-
cancel-label=${this.cancelLabel}
|
|
2445
|
+
cancel-label=${this.cancelLabel ?? this.dictionary.common.cancel}
|
|
2419
2446
|
aria-label=${this.label ?? this.headingFor()}
|
|
2420
2447
|
@eunconfirm=${this.handleModalConfirm}
|
|
2421
2448
|
@euncancel=${this.handleModalCancel}
|
|
@@ -2441,7 +2468,7 @@ let EunomiaDatePicker = EunomiaDatePicker_1 = class EunomiaDatePicker extends Eu
|
|
|
2441
2468
|
id="cancel"
|
|
2442
2469
|
@click=${() => this.modalEl?.cancel()}
|
|
2443
2470
|
>
|
|
2444
|
-
${this.cancelLabel}
|
|
2471
|
+
${this.cancelLabel ?? this.dictionary.common.cancel}
|
|
2445
2472
|
</eun-button>
|
|
2446
2473
|
<eun-button id="confirm" @click=${() => this.modalEl?.confirm()}>
|
|
2447
2474
|
${this.applyLabel}
|
|
@@ -2478,10 +2505,10 @@ EunomiaDatePicker.styles = [
|
|
|
2478
2505
|
*/
|
|
2479
2506
|
EunomiaDatePicker.SWIPE_THRESHOLD_PX = 40;
|
|
2480
2507
|
__decorate([
|
|
2481
|
-
property({ reflect: true })
|
|
2508
|
+
property({ reflect: true, useDefault: true })
|
|
2482
2509
|
], EunomiaDatePicker.prototype, "mode", void 0);
|
|
2483
2510
|
__decorate([
|
|
2484
|
-
property({ reflect: true })
|
|
2511
|
+
property({ reflect: true, useDefault: true })
|
|
2485
2512
|
], EunomiaDatePicker.prototype, "granularity", void 0);
|
|
2486
2513
|
__decorate([
|
|
2487
2514
|
property({
|
|
@@ -2541,8 +2568,8 @@ __decorate([
|
|
|
2541
2568
|
property({ attribute: "cancel-label" })
|
|
2542
2569
|
], EunomiaDatePicker.prototype, "cancelLabel", void 0);
|
|
2543
2570
|
__decorate([
|
|
2544
|
-
property({ attribute: "
|
|
2545
|
-
], EunomiaDatePicker.prototype, "
|
|
2571
|
+
property({ attribute: "calendar-label" })
|
|
2572
|
+
], EunomiaDatePicker.prototype, "calendarLabel", void 0);
|
|
2546
2573
|
__decorate([
|
|
2547
2574
|
property({ attribute: "day-placeholder" })
|
|
2548
2575
|
], EunomiaDatePicker.prototype, "dayPlaceholder", void 0);
|
|
@@ -2668,12 +2695,6 @@ function todaysSegmentPart(kind) {
|
|
|
2668
2695
|
return today.getDate();
|
|
2669
2696
|
}
|
|
2670
2697
|
}
|
|
2671
|
-
/**
|
|
2672
|
-
* @private
|
|
2673
|
-
*/
|
|
2674
|
-
function capitalize(value) {
|
|
2675
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
2676
|
-
}
|
|
2677
2698
|
/**
|
|
2678
2699
|
* Parses an ISO (`yyyy-mm-dd`) date string, as used by the `default-value`
|
|
2679
2700
|
* and `default-range-value` attributes. Returns `null` for an empty or
|
|
@@ -8,6 +8,7 @@ import { EditableMixinInterface } from "../../../mixins/editable.mixin.js";
|
|
|
8
8
|
import { FieldAppearanceMixinInterface } from "../../../mixins/field-appearance.mixin.js";
|
|
9
9
|
import { EunomiaIconName } from "../../content/icon/icon.type.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 input component.
|
|
13
14
|
*/
|
|
@@ -20,7 +21,7 @@ export type EunomiaInputType = "text" | "email" | "number" | "tel" | "url" | "se
|
|
|
20
21
|
* Type of the input base used to declare every necessary Mixin interface elements.
|
|
21
22
|
* @internal
|
|
22
23
|
*/
|
|
23
|
-
type EunomiaInputBase = LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface<string> & FormMixinInterface<string> & EditableMixinInterface & FormLabelMixinInterface & FieldAppearanceMixinInterface;
|
|
24
|
+
type EunomiaInputBase = LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface<string> & FormMixinInterface<string> & EditableMixinInterface & FormLabelMixinInterface & FieldAppearanceMixinInterface & LocalizableMixinInterface;
|
|
24
25
|
declare const EunomiaInputMixinBase: Constructor<EunomiaInputBase>;
|
|
25
26
|
/**
|
|
26
27
|
* A single-line text field, supporting several native input types.
|
|
@@ -38,6 +39,7 @@ declare const EunomiaInputMixinBase: Constructor<EunomiaInputBase>;
|
|
|
38
39
|
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
39
40
|
* @prop {boolean} [required=false] - Whether the field is required
|
|
40
41
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
42
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
41
43
|
* @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
|
|
42
44
|
* @prop {Array<Validators<string>>} validators - The list of validation rules applied to the field value
|
|
43
45
|
* @prop {EunomiaIconName} icon - An optional leading icon
|
|
@@ -51,12 +53,12 @@ declare const EunomiaInputMixinBase: Constructor<EunomiaInputBase>;
|
|
|
51
53
|
* @prop {string} min - The native minimum constraint forwarded to the field
|
|
52
54
|
* @prop {string} max - The native maximum constraint forwarded to the field
|
|
53
55
|
* @prop {string} step - The native step constraint forwarded to the field
|
|
54
|
-
* @prop {string} [emptyValueLabel
|
|
55
|
-
* @prop {string} [confirmLabel
|
|
56
|
-
* @prop {string} [cancelLabel
|
|
57
|
-
* @prop {string} [
|
|
58
|
-
* @prop {string} [
|
|
59
|
-
* @prop {string} [
|
|
56
|
+
* @prop {string} [emptyValueLabel] - Text displayed in place of the value when readonly and empty. Defaults to the localized string for the current locale (English: "No value set")
|
|
57
|
+
* @prop {string} [confirmLabel] - The label of the confirm button in edit mode. Defaults to the localized string for the current locale (English: "Save")
|
|
58
|
+
* @prop {string} [cancelLabel] - The label of the cancel button in edit mode. Defaults to the localized string for the current locale (English: "Cancel")
|
|
59
|
+
* @prop {string} [clearLabel] - The accessible label of the clear button. Defaults to the localized string for the current locale (English: "Clear field")
|
|
60
|
+
* @prop {string} [showPasswordLabel] - The accessible label of the show password button. Defaults to the localized string for the current locale (English: "Show password")
|
|
61
|
+
* @prop {string} [hidePasswordLabel] - The accessible label of the hide password button. Defaults to the localized string for the current locale (English: "Hide password")
|
|
60
62
|
* @fires {ChangeEvent} eunchange - Fired on every value change
|
|
61
63
|
* @fires {CommitEvent} euncommit - Fired when an edit is confirmed in readonlyAvailable mode
|
|
62
64
|
* @cssprop [--field-background] - Sets the background color of the field
|
|
@@ -149,34 +151,34 @@ export declare class EunomiaInput extends EunomiaInputMixinBase {
|
|
|
149
151
|
step?: string;
|
|
150
152
|
/**
|
|
151
153
|
* Text displayed in place of the value when readonly and empty.
|
|
152
|
-
*
|
|
154
|
+
* Falls back to the localized string for the current locale when unset.
|
|
153
155
|
*/
|
|
154
|
-
emptyValueLabel
|
|
156
|
+
emptyValueLabel?: string;
|
|
155
157
|
/**
|
|
156
158
|
* Label of the confirm button in edit mode.
|
|
157
|
-
*
|
|
159
|
+
* Falls back to the localized string for the current locale when unset.
|
|
158
160
|
*/
|
|
159
|
-
confirmLabel
|
|
161
|
+
confirmLabel?: string;
|
|
160
162
|
/**
|
|
161
163
|
* Label of the cancel button in edit mode.
|
|
162
|
-
*
|
|
164
|
+
* Falls back to the localized string for the current locale when unset.
|
|
163
165
|
*/
|
|
164
|
-
cancelLabel
|
|
166
|
+
cancelLabel?: string;
|
|
165
167
|
/**
|
|
166
168
|
* Accessible label of the clear button.
|
|
167
|
-
*
|
|
169
|
+
* Falls back to the localized string for the current locale when unset.
|
|
168
170
|
*/
|
|
169
|
-
|
|
171
|
+
clearLabel?: string;
|
|
170
172
|
/**
|
|
171
173
|
* Accessible label of the show-password button.
|
|
172
|
-
*
|
|
174
|
+
* Falls back to the localized string for the current locale when unset.
|
|
173
175
|
*/
|
|
174
|
-
|
|
176
|
+
showPasswordLabel?: string;
|
|
175
177
|
/**
|
|
176
178
|
* Accessible label of the hide-password button.
|
|
177
|
-
*
|
|
179
|
+
* Falls back to the localized string for the current locale when unset.
|
|
178
180
|
*/
|
|
179
|
-
|
|
181
|
+
hidePasswordLabel?: string;
|
|
180
182
|
/**
|
|
181
183
|
* Whether the password's plain value is currently revealed.
|
|
182
184
|
* @internal
|
|
@@ -213,28 +215,25 @@ export declare class EunomiaInput extends EunomiaInputMixinBase {
|
|
|
213
215
|
* @protected
|
|
214
216
|
*/
|
|
215
217
|
protected focusTarget(): HTMLElement | undefined;
|
|
218
|
+
constructor();
|
|
219
|
+
/**
|
|
220
|
+
* Submits the owning form on Enter in the field, as a native text input
|
|
221
|
+
* does, since the browser never does it from a shadow root. Listened to
|
|
222
|
+
* on the host so a handler inside, such as `eun-search` picking a
|
|
223
|
+
* suggestion, can claim the key first. Skipped while editing in
|
|
224
|
+
* `readonlyAvailable` mode, whose own buttons confirm the edit.
|
|
225
|
+
* @private
|
|
226
|
+
*/
|
|
227
|
+
private readonly handleImplicitSubmission;
|
|
228
|
+
/**
|
|
229
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
230
|
+
* straight to the native field inside, in both directions, and
|
|
231
|
+
* {@link focus} covers a direct call on the host.
|
|
232
|
+
*/
|
|
233
|
+
protected get hostTabStop(): boolean;
|
|
216
234
|
/**
|
|
217
235
|
* Lifecycle hook called whenever reactive properties change. Focuses the
|
|
218
|
-
* field when entering edit mode
|
|
219
|
-
* after every `disabled` change.
|
|
220
|
-
*
|
|
221
|
-
* `DisabledMixin` puts a real `tabindex="0"` on the host so Tab still
|
|
222
|
-
* reaches it while enabled — appropriate for a component whose host
|
|
223
|
-
* *is* the sole interactive surface, but this one always has its own
|
|
224
|
-
* focusable native field nested inside instead, and keeping the host
|
|
225
|
-
* itself as a *second*, independent tab stop right next to it broke
|
|
226
|
-
* Shift+Tab : landing back on the host is a genuine stop of its own as
|
|
227
|
-
* far as the browser's own backward sequential-navigation is concerned,
|
|
228
|
-
* and redirecting focus straight back into the field from there (this
|
|
229
|
-
* class's previous approach) fights that navigation mid-flight, leaving
|
|
230
|
-
* focus stranded on the host with nothing focused inside it. Removing
|
|
231
|
-
* the attribute instead lets sequential focus navigation descend
|
|
232
|
-
* straight into the field on its own, correctly in both directions, with
|
|
233
|
-
* no separate host stop and no redirect involved at all — this class's
|
|
234
|
-
* own `focus()` method (see below) covers a direct, explicit call on the
|
|
235
|
-
* host, the one case that genuinely still needs one. The disabled case
|
|
236
|
-
* still gets an explicit `-1` so a disabled field is skipped entirely
|
|
237
|
-
* rather than becoming its own (empty) stop.
|
|
236
|
+
* field when entering edit mode.
|
|
238
237
|
*
|
|
239
238
|
* @param _changedProperties - Map of changed properties
|
|
240
239
|
*/
|