@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
|
@@ -20,6 +20,8 @@ import { ChangeEvent } from "../../../events/change.event.js";
|
|
|
20
20
|
import { formLabelsStyles } from "../shared-styles/form-labels.styles.js";
|
|
21
21
|
import { inputStyles } from "./input.styles.js";
|
|
22
22
|
import { pickValidity } from "../../../utils/validity.utils.js";
|
|
23
|
+
import { isImplicitSubmissionKey, submitImplicitly, } from "../../../utils/implicit-submission.utils.js";
|
|
24
|
+
import { LocalizableMixin, } from "../../../mixins/localizable.mixin.js";
|
|
23
25
|
/**
|
|
24
26
|
* Tag name of the input component.
|
|
25
27
|
*/
|
|
@@ -29,7 +31,7 @@ export const EunomiaInputTagName = "eun-input";
|
|
|
29
31
|
* @internal
|
|
30
32
|
*/
|
|
31
33
|
const Base = DisabledMixin(ValidatorsMixin(LitElement));
|
|
32
|
-
const EunomiaInputMixinBase = FieldAppearanceMixin(FormLabelMixin(ReadonlyMixin(EditableMixin(FormMixin(Base)))));
|
|
34
|
+
const EunomiaInputMixinBase = LocalizableMixin(FieldAppearanceMixin(FormLabelMixin(ReadonlyMixin(EditableMixin(FormMixin(Base))))));
|
|
33
35
|
/**
|
|
34
36
|
* A single-line text field, supporting several native input types.
|
|
35
37
|
*
|
|
@@ -46,6 +48,7 @@ const EunomiaInputMixinBase = FieldAppearanceMixin(FormLabelMixin(ReadonlyMixin(
|
|
|
46
48
|
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
47
49
|
* @prop {boolean} [required=false] - Whether the field is required
|
|
48
50
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
51
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
49
52
|
* @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
|
|
50
53
|
* @prop {Array<Validators<string>>} validators - The list of validation rules applied to the field value
|
|
51
54
|
* @prop {EunomiaIconName} icon - An optional leading icon
|
|
@@ -59,12 +62,12 @@ const EunomiaInputMixinBase = FieldAppearanceMixin(FormLabelMixin(ReadonlyMixin(
|
|
|
59
62
|
* @prop {string} min - The native minimum constraint forwarded to the field
|
|
60
63
|
* @prop {string} max - The native maximum constraint forwarded to the field
|
|
61
64
|
* @prop {string} step - The native step constraint forwarded to the field
|
|
62
|
-
* @prop {string} [emptyValueLabel
|
|
63
|
-
* @prop {string} [confirmLabel
|
|
64
|
-
* @prop {string} [cancelLabel
|
|
65
|
-
* @prop {string} [
|
|
66
|
-
* @prop {string} [
|
|
67
|
-
* @prop {string} [
|
|
65
|
+
* @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")
|
|
66
|
+
* @prop {string} [confirmLabel] - The label of the confirm button in edit mode. Defaults to the localized string for the current locale (English: "Save")
|
|
67
|
+
* @prop {string} [cancelLabel] - The label of the cancel button in edit mode. Defaults to the localized string for the current locale (English: "Cancel")
|
|
68
|
+
* @prop {string} [clearLabel] - The accessible label of the clear button. Defaults to the localized string for the current locale (English: "Clear field")
|
|
69
|
+
* @prop {string} [showPasswordLabel] - The accessible label of the show password button. Defaults to the localized string for the current locale (English: "Show password")
|
|
70
|
+
* @prop {string} [hidePasswordLabel] - The accessible label of the hide password button. Defaults to the localized string for the current locale (English: "Hide password")
|
|
68
71
|
* @fires {ChangeEvent} eunchange - Fired on every value change
|
|
69
72
|
* @fires {CommitEvent} euncommit - Fired when an edit is confirmed in readonlyAvailable mode
|
|
70
73
|
* @cssprop [--field-background] - Sets the background color of the field
|
|
@@ -89,8 +92,40 @@ const EunomiaInputMixinBase = FieldAppearanceMixin(FormLabelMixin(ReadonlyMixin(
|
|
|
89
92
|
* @element eun-input
|
|
90
93
|
*/
|
|
91
94
|
let EunomiaInput = class EunomiaInput extends EunomiaInputMixinBase {
|
|
95
|
+
/**
|
|
96
|
+
* The default value applied on connection and form reset. Overrides the
|
|
97
|
+
* `defaultValue` accessor inherited from `FormMixin` only to drop its
|
|
98
|
+
* generic attribute converter, which always splits `default-value` on
|
|
99
|
+
* commas (appropriate for an array-valued field, not this component's
|
|
100
|
+
* plain `string` value) — `default-value="foo,bar"` would otherwise be
|
|
101
|
+
* parsed as `['foo', 'bar']` and silently assigned to a `string`-typed
|
|
102
|
+
* `value`. The actual get/set logic still comes from `FormMixin` itself,
|
|
103
|
+
* via `super`.
|
|
104
|
+
*/
|
|
105
|
+
get defaultValue() {
|
|
106
|
+
return super.defaultValue;
|
|
107
|
+
}
|
|
108
|
+
set defaultValue(value) {
|
|
109
|
+
// `FormMixinInterface.defaultValue` is declared getter-only (the
|
|
110
|
+
// mixin's real class has a working setter too — the interface used to
|
|
111
|
+
// type this component's base just omits it), so TS treats this as
|
|
112
|
+
// read-only even though it's correct and necessary at runtime.
|
|
113
|
+
// @ts-expect-error — see comment above ; FormMixin's real setter exists.
|
|
114
|
+
super.defaultValue = value;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The element a direct `.focus()` call on the host actually focuses.
|
|
118
|
+
* Defaults to the native field ; overridden by a subclass whose real,
|
|
119
|
+
* visible focusable proxy is something else — e.g. `eun-search`'s
|
|
120
|
+
* `panel` mode, whose native field lives inside a closed modal and isn't
|
|
121
|
+
* a valid focus target until it's open.
|
|
122
|
+
* @protected
|
|
123
|
+
*/
|
|
124
|
+
focusTarget() {
|
|
125
|
+
return this.fieldEl;
|
|
126
|
+
}
|
|
92
127
|
constructor() {
|
|
93
|
-
super(
|
|
128
|
+
super();
|
|
94
129
|
/**
|
|
95
130
|
* The native input type to apply.
|
|
96
131
|
* @default text
|
|
@@ -106,36 +141,6 @@ let EunomiaInput = class EunomiaInput extends EunomiaInputMixinBase {
|
|
|
106
141
|
* @default off
|
|
107
142
|
*/
|
|
108
143
|
this.autocomplete = "off";
|
|
109
|
-
/**
|
|
110
|
-
* Text displayed in place of the value when readonly and empty.
|
|
111
|
-
* @default No value set
|
|
112
|
-
*/
|
|
113
|
-
this.emptyValueLabel = "No value set";
|
|
114
|
-
/**
|
|
115
|
-
* Label of the confirm button in edit mode.
|
|
116
|
-
* @default Save
|
|
117
|
-
*/
|
|
118
|
-
this.confirmLabel = "Save";
|
|
119
|
-
/**
|
|
120
|
-
* Label of the cancel button in edit mode.
|
|
121
|
-
* @default Cancel
|
|
122
|
-
*/
|
|
123
|
-
this.cancelLabel = "Cancel";
|
|
124
|
-
/**
|
|
125
|
-
* Accessible label of the clear button.
|
|
126
|
-
* @default Clear field
|
|
127
|
-
*/
|
|
128
|
-
this.ariaLabelClear = "Clear field";
|
|
129
|
-
/**
|
|
130
|
-
* Accessible label of the show-password button.
|
|
131
|
-
* @default Show password
|
|
132
|
-
*/
|
|
133
|
-
this.ariaLabelShowPassword = "Show password";
|
|
134
|
-
/**
|
|
135
|
-
* Accessible label of the hide-password button.
|
|
136
|
-
* @default Hide password
|
|
137
|
-
*/
|
|
138
|
-
this.ariaLabelHidePassword = "Hide password";
|
|
139
144
|
/**
|
|
140
145
|
* Whether the password's plain value is currently revealed.
|
|
141
146
|
* @internal
|
|
@@ -150,6 +155,25 @@ let EunomiaInput = class EunomiaInput extends EunomiaInputMixinBase {
|
|
|
150
155
|
this.handleIconSlotChange = () => {
|
|
151
156
|
this.requestUpdate();
|
|
152
157
|
};
|
|
158
|
+
/**
|
|
159
|
+
* Submits the owning form on Enter in the field, as a native text input
|
|
160
|
+
* does, since the browser never does it from a shadow root. Listened to
|
|
161
|
+
* on the host so a handler inside, such as `eun-search` picking a
|
|
162
|
+
* suggestion, can claim the key first. Skipped while editing in
|
|
163
|
+
* `readonlyAvailable` mode, whose own buttons confirm the edit.
|
|
164
|
+
* @private
|
|
165
|
+
*/
|
|
166
|
+
this.handleImplicitSubmission = (event) => {
|
|
167
|
+
const form = this.internals.form;
|
|
168
|
+
if (!form ||
|
|
169
|
+
event.composedPath()[0] !== this.fieldEl ||
|
|
170
|
+
!isImplicitSubmissionKey(event) ||
|
|
171
|
+
(this.readonlyAvailable && this.editing)) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
submitImplicitly(form);
|
|
176
|
+
};
|
|
153
177
|
/**
|
|
154
178
|
* Reads native HTML constraint validation from the underlying field element
|
|
155
179
|
* (`required`, `minlength`, `maxlength`, `pattern`, `min`, `max`, `type="email"`, etc.).
|
|
@@ -169,61 +193,19 @@ let EunomiaInput = class EunomiaInput extends EunomiaInputMixinBase {
|
|
|
169
193
|
"badInput",
|
|
170
194
|
]);
|
|
171
195
|
};
|
|
196
|
+
this.addEventListener("keydown", this.handleImplicitSubmission);
|
|
172
197
|
}
|
|
173
198
|
/**
|
|
174
|
-
* The
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
* commas (appropriate for an array-valued field, not this component's
|
|
178
|
-
* plain `string` value) — `default-value="foo,bar"` would otherwise be
|
|
179
|
-
* parsed as `['foo', 'bar']` and silently assigned to a `string`-typed
|
|
180
|
-
* `value`. The actual get/set logic still comes from `FormMixin` itself,
|
|
181
|
-
* via `super`.
|
|
199
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
200
|
+
* straight to the native field inside, in both directions, and
|
|
201
|
+
* {@link focus} covers a direct call on the host.
|
|
182
202
|
*/
|
|
183
|
-
get
|
|
184
|
-
return
|
|
185
|
-
}
|
|
186
|
-
set defaultValue(value) {
|
|
187
|
-
// `FormMixinInterface.defaultValue` is declared getter-only (the
|
|
188
|
-
// mixin's real class has a working setter too — the interface used to
|
|
189
|
-
// type this component's base just omits it), so TS treats this as
|
|
190
|
-
// read-only even though it's correct and necessary at runtime.
|
|
191
|
-
// @ts-expect-error — see comment above ; FormMixin's real setter exists.
|
|
192
|
-
super.defaultValue = value;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* The element a direct `.focus()` call on the host actually focuses.
|
|
196
|
-
* Defaults to the native field ; overridden by a subclass whose real,
|
|
197
|
-
* visible focusable proxy is something else — e.g. `eun-search`'s
|
|
198
|
-
* `panel` mode, whose native field lives inside a closed modal and isn't
|
|
199
|
-
* a valid focus target until it's open.
|
|
200
|
-
* @protected
|
|
201
|
-
*/
|
|
202
|
-
focusTarget() {
|
|
203
|
-
return this.fieldEl;
|
|
203
|
+
get hostTabStop() {
|
|
204
|
+
return false;
|
|
204
205
|
}
|
|
205
206
|
/**
|
|
206
207
|
* Lifecycle hook called whenever reactive properties change. Focuses the
|
|
207
|
-
* field when entering edit mode
|
|
208
|
-
* after every `disabled` change.
|
|
209
|
-
*
|
|
210
|
-
* `DisabledMixin` puts a real `tabindex="0"` on the host so Tab still
|
|
211
|
-
* reaches it while enabled — appropriate for a component whose host
|
|
212
|
-
* *is* the sole interactive surface, but this one always has its own
|
|
213
|
-
* focusable native field nested inside instead, and keeping the host
|
|
214
|
-
* itself as a *second*, independent tab stop right next to it broke
|
|
215
|
-
* Shift+Tab : landing back on the host is a genuine stop of its own as
|
|
216
|
-
* far as the browser's own backward sequential-navigation is concerned,
|
|
217
|
-
* and redirecting focus straight back into the field from there (this
|
|
218
|
-
* class's previous approach) fights that navigation mid-flight, leaving
|
|
219
|
-
* focus stranded on the host with nothing focused inside it. Removing
|
|
220
|
-
* the attribute instead lets sequential focus navigation descend
|
|
221
|
-
* straight into the field on its own, correctly in both directions, with
|
|
222
|
-
* no separate host stop and no redirect involved at all — this class's
|
|
223
|
-
* own `focus()` method (see below) covers a direct, explicit call on the
|
|
224
|
-
* host, the one case that genuinely still needs one. The disabled case
|
|
225
|
-
* still gets an explicit `-1` so a disabled field is skipped entirely
|
|
226
|
-
* rather than becoming its own (empty) stop.
|
|
208
|
+
* field when entering edit mode.
|
|
227
209
|
*
|
|
228
210
|
* @param _changedProperties - Map of changed properties
|
|
229
211
|
*/
|
|
@@ -232,14 +214,6 @@ let EunomiaInput = class EunomiaInput extends EunomiaInputMixinBase {
|
|
|
232
214
|
if (_changedProperties.has("editing") && this.editing) {
|
|
233
215
|
this.fieldEl?.focus();
|
|
234
216
|
}
|
|
235
|
-
if (_changedProperties.has("disabled")) {
|
|
236
|
-
if (this.disabled) {
|
|
237
|
-
this.setAttribute("tabindex", "-1");
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
this.removeAttribute("tabindex");
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
217
|
}
|
|
244
218
|
/**
|
|
245
219
|
* Returns the field element to focus/anchor on validation errors.
|
|
@@ -304,7 +278,9 @@ let EunomiaInput = class EunomiaInput extends EunomiaInputMixinBase {
|
|
|
304
278
|
@keydown=${(event) => (event.key === "Enter" || event.key === " ") && this.startEdit()}
|
|
305
279
|
>
|
|
306
280
|
<span class=${classMap({ empty: !hasValue })}
|
|
307
|
-
>${hasValue
|
|
281
|
+
>${hasValue
|
|
282
|
+
? this.value
|
|
283
|
+
: (this.emptyValueLabel ?? this.dictionary.common.noValue)}</span
|
|
308
284
|
>
|
|
309
285
|
</div>
|
|
310
286
|
`;
|
|
@@ -397,7 +373,7 @@ let EunomiaInput = class EunomiaInput extends EunomiaInputMixinBase {
|
|
|
397
373
|
type="button"
|
|
398
374
|
id="clear"
|
|
399
375
|
@click=${this.handleClear}
|
|
400
|
-
aria-label=${this.
|
|
376
|
+
aria-label=${this.clearLabel ?? this.dictionary.input.clear}
|
|
401
377
|
tabindex="-1"
|
|
402
378
|
>
|
|
403
379
|
<eun-icon name="cancel" size="16"></eun-icon>
|
|
@@ -409,10 +385,10 @@ let EunomiaInput = class EunomiaInput extends EunomiaInputMixinBase {
|
|
|
409
385
|
id="password-toggle"
|
|
410
386
|
@click=${this.togglePasswordVisibility}
|
|
411
387
|
aria-label=${this.showPassword
|
|
412
|
-
? this.
|
|
413
|
-
: this.
|
|
388
|
+
? (this.hidePasswordLabel ?? this.dictionary.input.hidePassword)
|
|
389
|
+
: (this.showPasswordLabel ??
|
|
390
|
+
this.dictionary.input.showPassword)}
|
|
414
391
|
aria-pressed=${this.showPassword}
|
|
415
|
-
tabindex="-1"
|
|
416
392
|
>
|
|
417
393
|
<eun-icon
|
|
418
394
|
name=${this.showPassword ? "visibility_off" : "visibility"}
|
|
@@ -432,7 +408,7 @@ let EunomiaInput = class EunomiaInput extends EunomiaInputMixinBase {
|
|
|
432
408
|
rounded
|
|
433
409
|
type="button"
|
|
434
410
|
@click=${this.confirmEdit}
|
|
435
|
-
>${this.confirmLabel}</eun-button
|
|
411
|
+
>${this.confirmLabel ?? this.dictionary.common.save}</eun-button
|
|
436
412
|
>
|
|
437
413
|
<eun-button
|
|
438
414
|
class="cancel"
|
|
@@ -441,7 +417,7 @@ let EunomiaInput = class EunomiaInput extends EunomiaInputMixinBase {
|
|
|
441
417
|
rounded
|
|
442
418
|
type="button"
|
|
443
419
|
@click=${this.cancelEdit}
|
|
444
|
-
>${this.cancelLabel}</eun-button
|
|
420
|
+
>${this.cancelLabel ?? this.dictionary.common.cancel}</eun-button
|
|
445
421
|
>
|
|
446
422
|
</div>
|
|
447
423
|
`)}
|
|
@@ -483,7 +459,7 @@ EunomiaInput.styles = [
|
|
|
483
459
|
formLabelsStyles.hintMessages,
|
|
484
460
|
];
|
|
485
461
|
__decorate([
|
|
486
|
-
property({ reflect: true })
|
|
462
|
+
property({ reflect: true, useDefault: true })
|
|
487
463
|
], EunomiaInput.prototype, "type", void 0);
|
|
488
464
|
__decorate([
|
|
489
465
|
property({ attribute: "default-value" })
|
|
@@ -528,14 +504,14 @@ __decorate([
|
|
|
528
504
|
property({ attribute: "cancel-label" })
|
|
529
505
|
], EunomiaInput.prototype, "cancelLabel", void 0);
|
|
530
506
|
__decorate([
|
|
531
|
-
property({ attribute: "
|
|
532
|
-
], EunomiaInput.prototype, "
|
|
507
|
+
property({ attribute: "clear-label" })
|
|
508
|
+
], EunomiaInput.prototype, "clearLabel", void 0);
|
|
533
509
|
__decorate([
|
|
534
|
-
property({ attribute: "
|
|
535
|
-
], EunomiaInput.prototype, "
|
|
510
|
+
property({ attribute: "show-password-label" })
|
|
511
|
+
], EunomiaInput.prototype, "showPasswordLabel", void 0);
|
|
536
512
|
__decorate([
|
|
537
|
-
property({ attribute: "
|
|
538
|
-
], EunomiaInput.prototype, "
|
|
513
|
+
property({ attribute: "hide-password-label" })
|
|
514
|
+
], EunomiaInput.prototype, "hidePasswordLabel", void 0);
|
|
539
515
|
__decorate([
|
|
540
516
|
state()
|
|
541
517
|
], EunomiaInput.prototype, "showPassword", void 0);
|
|
@@ -5,6 +5,7 @@ import { ValidatorsMixinInterface } from "../../../mixins/validators.mixin.js";
|
|
|
5
5
|
import { FormMixinInterface } from "../../../mixins/form.mixin.js";
|
|
6
6
|
import { FormLabelMixinInterface } from "../../../mixins/form-label.mixin.js";
|
|
7
7
|
import { Constructor } from "../../../utils/constructor.type.js";
|
|
8
|
+
import { LocalizableMixinInterface } from "../../../mixins/localizable.mixin.js";
|
|
8
9
|
/**
|
|
9
10
|
* Tag name of the input-file component.
|
|
10
11
|
*/
|
|
@@ -18,7 +19,7 @@ export type EunomiaInputFileKind = "image" | "file";
|
|
|
18
19
|
* Type of the input-file base used to declare every necessary Mixin interface elements.
|
|
19
20
|
* @internal
|
|
20
21
|
*/
|
|
21
|
-
type EunomiaInputFileBase = LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface<File[]> & FormMixinInterface<File[]> & FormLabelMixinInterface;
|
|
22
|
+
type EunomiaInputFileBase = LitElement & DisabledMixinInterface & ReadonlyMixinInterface & ValidatorsMixinInterface<File[]> & FormMixinInterface<File[]> & FormLabelMixinInterface & LocalizableMixinInterface;
|
|
22
23
|
declare const EunomiaInputFileMixinBase: Constructor<EunomiaInputFileBase>;
|
|
23
24
|
/**
|
|
24
25
|
* A file upload field with a dropzone, showing image thumbnails or generic
|
|
@@ -38,24 +39,25 @@ declare const EunomiaInputFileMixinBase: Constructor<EunomiaInputFileBase>;
|
|
|
38
39
|
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
39
40
|
* @prop {boolean} [required=false] - Whether at least one file 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<import('../../../types/form-validators.type.js').Validators<File[]>>} validators - The list of validation rules applied to the field value
|
|
43
45
|
* @prop {string} [dropLabel='Drag and drop files here, or'] - Static text displayed in the dropzone
|
|
44
46
|
* @attr {string} [drop-label='Drag and drop files here, or'] - Static text displayed in the dropzone
|
|
45
47
|
* @prop {string} [browseLabel='browse files'] - The visible text of the dropzone's browse link
|
|
46
48
|
* @attr {string} [browse-label='browse files'] - The visible text of the dropzone's browse link
|
|
47
|
-
* @prop {string} [
|
|
48
|
-
* @attr {string} [
|
|
49
|
-
* @prop {string} [
|
|
50
|
-
* @attr {string} [
|
|
49
|
+
* @prop {string} [removeLabel] - The accessible label of each item's remove button. Defaults to the localized string for the current locale (English: "Remove file")
|
|
50
|
+
* @attr {string} [remove-label] - The accessible label of each item's remove button. Defaults to the localized string for the current locale (English: "Remove file")
|
|
51
|
+
* @prop {string} [selectLabel] - The accessible label prefix of each item's checkbox. Defaults to the localized string for the current locale (English: "Select file")
|
|
52
|
+
* @attr {string} [select-label] - The accessible label prefix of each item's checkbox. Defaults to the localized string for the current locale (English: "Select file")
|
|
51
53
|
* @prop {string} [removeAllLabel='Remove all'] - The label of the always-available bulk clear action
|
|
52
54
|
* @attr {string} [remove-all-label='Remove all'] - The label of the always-available bulk clear action
|
|
53
55
|
* @prop {string} [selectAllLabel='Select all'] - The label of the selection toolbar's select-all checkbox
|
|
54
56
|
* @attr {string} [select-all-label='Select all'] - The label of the selection toolbar's select-all checkbox
|
|
55
57
|
* @prop {string} [deleteSelectedLabel='Delete selected'] - The label of the selection toolbar's bulk delete button
|
|
56
58
|
* @attr {string} [delete-selected-label='Delete selected'] - The label of the selection toolbar's bulk delete button
|
|
57
|
-
* @prop {string} [
|
|
58
|
-
* @attr {string} [
|
|
59
|
+
* @prop {string} [openLabel] - Appended to each item's accessible name. Defaults to the localized string for the current locale (English: "Open in a new tab")
|
|
60
|
+
* @attr {string} [open-label] - Appended to each item's accessible name. Defaults to the localized string for the current locale (English: "Open in a new tab")
|
|
59
61
|
* @fires {ChangeEvent} eunchange - Fired whenever the selected files change
|
|
60
62
|
* @fires {FileRejectEvent} eunfilereject - Fired whenever one or more offered files are rejected, for the wrong type or exceeding the size or count limit
|
|
61
63
|
* @cssprop [--input-file-border-color] - Sets the border color of the dropzone
|
|
@@ -85,6 +87,11 @@ export declare class EunomiaInputFile extends EunomiaInputFileMixinBase {
|
|
|
85
87
|
* @internal
|
|
86
88
|
*/
|
|
87
89
|
static styles: CSSResultGroup;
|
|
90
|
+
/**
|
|
91
|
+
* Every change is a complete choice, so its error shows right away.
|
|
92
|
+
* @internal
|
|
93
|
+
*/
|
|
94
|
+
errorOnChange: boolean;
|
|
88
95
|
/**
|
|
89
96
|
* Accepted content kind: image thumbnails vs. generic file rows.
|
|
90
97
|
* @default image
|
|
@@ -128,15 +135,15 @@ export declare class EunomiaInputFile extends EunomiaInputFileMixinBase {
|
|
|
128
135
|
/**
|
|
129
136
|
* Accessible label prefix of each item's remove button (suffixed with the
|
|
130
137
|
* file name).
|
|
131
|
-
*
|
|
138
|
+
* Falls back to the localized string for the current locale when unset.
|
|
132
139
|
*/
|
|
133
|
-
|
|
140
|
+
removeLabel?: string;
|
|
134
141
|
/**
|
|
135
142
|
* Accessible label prefix of each item's checkbox (suffixed with the file
|
|
136
143
|
* name), when `selectable`.
|
|
137
|
-
*
|
|
144
|
+
* Falls back to the localized string for the current locale when unset.
|
|
138
145
|
*/
|
|
139
|
-
|
|
146
|
+
selectLabel?: string;
|
|
140
147
|
/**
|
|
141
148
|
* Label of the always-available bulk clear action, shown once at least one
|
|
142
149
|
* file is present.
|
|
@@ -157,9 +164,9 @@ export declare class EunomiaInputFile extends EunomiaInputFileMixinBase {
|
|
|
157
164
|
/**
|
|
158
165
|
* Appended to each item's accessible name (its primary action is opening
|
|
159
166
|
* the file in a new tab).
|
|
160
|
-
*
|
|
167
|
+
* Falls back to the localized string for the current locale when unset.
|
|
161
168
|
*/
|
|
162
|
-
|
|
169
|
+
openLabel?: string;
|
|
163
170
|
/**
|
|
164
171
|
* Whether a drag carrying files is currently over the host — reflected so
|
|
165
172
|
* `:host([dragging])` can drive the dropzone's highlight.
|
|
@@ -223,6 +230,12 @@ export declare class EunomiaInputFile extends EunomiaInputFileMixinBase {
|
|
|
223
230
|
* @param changedProperties - Map of changed properties
|
|
224
231
|
*/
|
|
225
232
|
protected updated(changedProperties: PropertyValues): void;
|
|
233
|
+
/**
|
|
234
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
235
|
+
* straight to the controls inside, in both directions, and
|
|
236
|
+
* {@link focus} covers a direct call on the host.
|
|
237
|
+
*/
|
|
238
|
+
protected get hostTabStop(): boolean;
|
|
226
239
|
/**
|
|
227
240
|
* Returns the element to focus/anchor on validation errors.
|
|
228
241
|
*
|
|
@@ -17,6 +17,7 @@ import { ChangeEvent } from "../../../events/change.event.js";
|
|
|
17
17
|
import { FileRejectEvent, } from "../../../events/file-reject.event.js";
|
|
18
18
|
import { formLabelsStyles } from "../shared-styles/form-labels.styles.js";
|
|
19
19
|
import { inputFileStyles } from "./input-file.styles.js";
|
|
20
|
+
import { LocalizableMixin, } from "../../../mixins/localizable.mixin.js";
|
|
20
21
|
/**
|
|
21
22
|
* Tag name of the input-file component.
|
|
22
23
|
*/
|
|
@@ -26,7 +27,7 @@ export const EunomiaInputFileTagName = "eun-input-file";
|
|
|
26
27
|
* @internal
|
|
27
28
|
*/
|
|
28
29
|
const Base = DisabledMixin(ValidatorsMixin(LitElement));
|
|
29
|
-
const EunomiaInputFileMixinBase = FormLabelMixin(ReadonlyMixin(FormMixin(Base)));
|
|
30
|
+
const EunomiaInputFileMixinBase = LocalizableMixin(FormLabelMixin(ReadonlyMixin(FormMixin(Base))));
|
|
30
31
|
/**
|
|
31
32
|
* A file upload field with a dropzone, showing image thumbnails or generic
|
|
32
33
|
* file rows for the selected files.
|
|
@@ -45,24 +46,25 @@ const EunomiaInputFileMixinBase = FormLabelMixin(ReadonlyMixin(FormMixin(Base)))
|
|
|
45
46
|
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
46
47
|
* @prop {boolean} [required=false] - Whether at least one file is required
|
|
47
48
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
49
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
48
50
|
* @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
51
|
* @prop {Array<import('../../../types/form-validators.type.js').Validators<File[]>>} validators - The list of validation rules applied to the field value
|
|
50
52
|
* @prop {string} [dropLabel='Drag and drop files here, or'] - Static text displayed in the dropzone
|
|
51
53
|
* @attr {string} [drop-label='Drag and drop files here, or'] - Static text displayed in the dropzone
|
|
52
54
|
* @prop {string} [browseLabel='browse files'] - The visible text of the dropzone's browse link
|
|
53
55
|
* @attr {string} [browse-label='browse files'] - The visible text of the dropzone's browse link
|
|
54
|
-
* @prop {string} [
|
|
55
|
-
* @attr {string} [
|
|
56
|
-
* @prop {string} [
|
|
57
|
-
* @attr {string} [
|
|
56
|
+
* @prop {string} [removeLabel] - The accessible label of each item's remove button. Defaults to the localized string for the current locale (English: "Remove file")
|
|
57
|
+
* @attr {string} [remove-label] - The accessible label of each item's remove button. Defaults to the localized string for the current locale (English: "Remove file")
|
|
58
|
+
* @prop {string} [selectLabel] - The accessible label prefix of each item's checkbox. Defaults to the localized string for the current locale (English: "Select file")
|
|
59
|
+
* @attr {string} [select-label] - The accessible label prefix of each item's checkbox. Defaults to the localized string for the current locale (English: "Select file")
|
|
58
60
|
* @prop {string} [removeAllLabel='Remove all'] - The label of the always-available bulk clear action
|
|
59
61
|
* @attr {string} [remove-all-label='Remove all'] - The label of the always-available bulk clear action
|
|
60
62
|
* @prop {string} [selectAllLabel='Select all'] - The label of the selection toolbar's select-all checkbox
|
|
61
63
|
* @attr {string} [select-all-label='Select all'] - The label of the selection toolbar's select-all checkbox
|
|
62
64
|
* @prop {string} [deleteSelectedLabel='Delete selected'] - The label of the selection toolbar's bulk delete button
|
|
63
65
|
* @attr {string} [delete-selected-label='Delete selected'] - The label of the selection toolbar's bulk delete button
|
|
64
|
-
* @prop {string} [
|
|
65
|
-
* @attr {string} [
|
|
66
|
+
* @prop {string} [openLabel] - Appended to each item's accessible name. Defaults to the localized string for the current locale (English: "Open in a new tab")
|
|
67
|
+
* @attr {string} [open-label] - Appended to each item's accessible name. Defaults to the localized string for the current locale (English: "Open in a new tab")
|
|
66
68
|
* @fires {ChangeEvent} eunchange - Fired whenever the selected files change
|
|
67
69
|
* @fires {FileRejectEvent} eunfilereject - Fired whenever one or more offered files are rejected, for the wrong type or exceeding the size or count limit
|
|
68
70
|
* @cssprop [--input-file-border-color] - Sets the border color of the dropzone
|
|
@@ -87,6 +89,11 @@ const EunomiaInputFileMixinBase = FormLabelMixin(ReadonlyMixin(FormMixin(Base)))
|
|
|
87
89
|
let EunomiaInputFile = class EunomiaInputFile extends EunomiaInputFileMixinBase {
|
|
88
90
|
constructor() {
|
|
89
91
|
super(...arguments);
|
|
92
|
+
/**
|
|
93
|
+
* Every change is a complete choice, so its error shows right away.
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
this.errorOnChange = true;
|
|
90
97
|
/**
|
|
91
98
|
* Accepted content kind: image thumbnails vs. generic file rows.
|
|
92
99
|
* @default image
|
|
@@ -113,18 +120,6 @@ let EunomiaInputFile = class EunomiaInputFile extends EunomiaInputFileMixinBase
|
|
|
113
120
|
* @default browse files
|
|
114
121
|
*/
|
|
115
122
|
this.browseLabel = "browse files";
|
|
116
|
-
/**
|
|
117
|
-
* Accessible label prefix of each item's remove button (suffixed with the
|
|
118
|
-
* file name).
|
|
119
|
-
* @default Remove file
|
|
120
|
-
*/
|
|
121
|
-
this.ariaLabelRemove = "Remove file";
|
|
122
|
-
/**
|
|
123
|
-
* Accessible label prefix of each item's checkbox (suffixed with the file
|
|
124
|
-
* name), when `selectable`.
|
|
125
|
-
* @default Select file
|
|
126
|
-
*/
|
|
127
|
-
this.ariaLabelSelect = "Select file";
|
|
128
123
|
/**
|
|
129
124
|
* Label of the always-available bulk clear action, shown once at least one
|
|
130
125
|
* file is present.
|
|
@@ -142,12 +137,6 @@ let EunomiaInputFile = class EunomiaInputFile extends EunomiaInputFileMixinBase
|
|
|
142
137
|
* @default Delete selected
|
|
143
138
|
*/
|
|
144
139
|
this.deleteSelectedLabel = "Delete selected";
|
|
145
|
-
/**
|
|
146
|
-
* Appended to each item's accessible name (its primary action is opening
|
|
147
|
-
* the file in a new tab).
|
|
148
|
-
* @default Open in a new tab
|
|
149
|
-
*/
|
|
150
|
-
this.ariaLabelOpen = "Open in a new tab";
|
|
151
140
|
/**
|
|
152
141
|
* Whether a drag carrying files is currently over the host — reflected so
|
|
153
142
|
* `:host([dragging])` can drive the dropzone's highlight.
|
|
@@ -293,6 +282,14 @@ let EunomiaInputFile = class EunomiaInputFile extends EunomiaInputFileMixinBase
|
|
|
293
282
|
}
|
|
294
283
|
}
|
|
295
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
287
|
+
* straight to the controls inside, in both directions, and
|
|
288
|
+
* {@link focus} covers a direct call on the host.
|
|
289
|
+
*/
|
|
290
|
+
get hostTabStop() {
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
296
293
|
/**
|
|
297
294
|
* Returns the element to focus/anchor on validation errors.
|
|
298
295
|
*
|
|
@@ -622,7 +619,8 @@ let EunomiaInputFile = class EunomiaInputFile extends EunomiaInputFileMixinBase
|
|
|
622
619
|
class="item"
|
|
623
620
|
role="button"
|
|
624
621
|
tabindex=${this.disabled ? "-1" : "0"}
|
|
625
|
-
aria-label="${file.name} — ${this.
|
|
622
|
+
aria-label="${file.name} — ${this.openLabel ??
|
|
623
|
+
this.dictionary.inputFile.open}"
|
|
626
624
|
@click=${() => !this.disabled && this.openFile(file)}
|
|
627
625
|
@keydown=${(event) => this.handleItemKeydown(event, file)}
|
|
628
626
|
>
|
|
@@ -630,7 +628,8 @@ let EunomiaInputFile = class EunomiaInputFile extends EunomiaInputFileMixinBase
|
|
|
630
628
|
<input
|
|
631
629
|
type="checkbox"
|
|
632
630
|
class="item-checkbox"
|
|
633
|
-
aria-label="${this.
|
|
631
|
+
aria-label="${this.selectLabel ??
|
|
632
|
+
this.dictionary.inputFile.select} ${file.name}"
|
|
634
633
|
.checked=${isSelected}
|
|
635
634
|
?disabled=${this.disabled || this.readonly}
|
|
636
635
|
@click=${(event) => event.stopPropagation()}
|
|
@@ -653,7 +652,8 @@ let EunomiaInputFile = class EunomiaInputFile extends EunomiaInputFileMixinBase
|
|
|
653
652
|
<button
|
|
654
653
|
type="button"
|
|
655
654
|
class="item-remove"
|
|
656
|
-
aria-label="${this.
|
|
655
|
+
aria-label="${this.removeLabel ??
|
|
656
|
+
this.dictionary.inputFile.remove} ${file.name}"
|
|
657
657
|
?disabled=${this.disabled || this.readonly}
|
|
658
658
|
@click=${(event) => {
|
|
659
659
|
event.stopPropagation();
|
|
@@ -742,7 +742,7 @@ EunomiaInputFile.styles = [
|
|
|
742
742
|
formLabelsStyles.hintMessages,
|
|
743
743
|
];
|
|
744
744
|
__decorate([
|
|
745
|
-
property({ reflect: true })
|
|
745
|
+
property({ reflect: true, useDefault: true })
|
|
746
746
|
], EunomiaInputFile.prototype, "kind", void 0);
|
|
747
747
|
__decorate([
|
|
748
748
|
property()
|
|
@@ -766,11 +766,11 @@ __decorate([
|
|
|
766
766
|
property({ attribute: "browse-label" })
|
|
767
767
|
], EunomiaInputFile.prototype, "browseLabel", void 0);
|
|
768
768
|
__decorate([
|
|
769
|
-
property({ attribute: "
|
|
770
|
-
], EunomiaInputFile.prototype, "
|
|
769
|
+
property({ attribute: "remove-label" })
|
|
770
|
+
], EunomiaInputFile.prototype, "removeLabel", void 0);
|
|
771
771
|
__decorate([
|
|
772
|
-
property({ attribute: "
|
|
773
|
-
], EunomiaInputFile.prototype, "
|
|
772
|
+
property({ attribute: "select-label" })
|
|
773
|
+
], EunomiaInputFile.prototype, "selectLabel", void 0);
|
|
774
774
|
__decorate([
|
|
775
775
|
property({ attribute: "remove-all-label" })
|
|
776
776
|
], EunomiaInputFile.prototype, "removeAllLabel", void 0);
|
|
@@ -781,8 +781,8 @@ __decorate([
|
|
|
781
781
|
property({ attribute: "delete-selected-label" })
|
|
782
782
|
], EunomiaInputFile.prototype, "deleteSelectedLabel", void 0);
|
|
783
783
|
__decorate([
|
|
784
|
-
property({ attribute: "
|
|
785
|
-
], EunomiaInputFile.prototype, "
|
|
784
|
+
property({ attribute: "open-label" })
|
|
785
|
+
], EunomiaInputFile.prototype, "openLabel", void 0);
|
|
786
786
|
__decorate([
|
|
787
787
|
property({ type: Boolean, reflect: true })
|
|
788
788
|
], EunomiaInputFile.prototype, "dragging", void 0);
|
|
@@ -196,7 +196,7 @@ const base = css `
|
|
|
196
196
|
display: grid;
|
|
197
197
|
gap: var(--_gap);
|
|
198
198
|
}
|
|
199
|
-
:host([kind="image"]) #items {
|
|
199
|
+
:host(:is([kind="image"], :not([kind]))) #items {
|
|
200
200
|
grid-template-columns: repeat(
|
|
201
201
|
auto-fill,
|
|
202
202
|
minmax(var(--_thumbnailSize), 1fr)
|
|
@@ -219,7 +219,7 @@ const base = css `
|
|
|
219
219
|
.item:focus-visible {
|
|
220
220
|
outline: 1px solid var(--_focusIndicator);
|
|
221
221
|
}
|
|
222
|
-
:host([kind="image"]) .item {
|
|
222
|
+
:host(:is([kind="image"], :not([kind]))) .item {
|
|
223
223
|
aspect-ratio: 1 / 1;
|
|
224
224
|
overflow: hidden;
|
|
225
225
|
align-items: stretch;
|
|
@@ -258,7 +258,7 @@ const base = css `
|
|
|
258
258
|
.item-checkbox {
|
|
259
259
|
flex: none;
|
|
260
260
|
}
|
|
261
|
-
:host([kind="image"]) .item-checkbox {
|
|
261
|
+
:host(:is([kind="image"], :not([kind]))) .item-checkbox {
|
|
262
262
|
position: absolute;
|
|
263
263
|
top: var(--eun-space-xs, 4px);
|
|
264
264
|
left: var(--eun-space-xs, 4px);
|
|
@@ -284,7 +284,7 @@ const base = css `
|
|
|
284
284
|
:host([kind="file"]) .item-remove:hover {
|
|
285
285
|
color: var(--_textColor);
|
|
286
286
|
}
|
|
287
|
-
:host([kind="image"]) .item-remove {
|
|
287
|
+
:host(:is([kind="image"], :not([kind]))) .item-remove {
|
|
288
288
|
position: absolute;
|
|
289
289
|
top: var(--eun-space-xs, 4px);
|
|
290
290
|
right: var(--eun-space-xs, 4px);
|