@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
|
@@ -26,6 +26,7 @@ import { timePickerListStyles } from "./time-picker-list.styles.js";
|
|
|
26
26
|
import { renderTimePickerList } from "./time-picker-list.js";
|
|
27
27
|
import { resolveDurationMs, resolveEasing, } from "../../../utils/motion.utils.js";
|
|
28
28
|
import { mediaBelow } from "../../../breakpoints.js";
|
|
29
|
+
import { isImplicitSubmissionKey, submitImplicitly, } from "../../../utils/implicit-submission.utils.js";
|
|
29
30
|
/**
|
|
30
31
|
* Tag name of the time-picker component.
|
|
31
32
|
*/
|
|
@@ -81,14 +82,15 @@ const EunomiaTimePickerMixinBase = LocalizableMixin(AnchorPositionMixin(FieldApp
|
|
|
81
82
|
* @prop {boolean} [readonly=false] - Whether the field is read only
|
|
82
83
|
* @prop {boolean} [required=false] - Whether the field is required
|
|
83
84
|
* @prop {boolean} [hideError=false] - Whether the errors are hidden. The hint stays visible
|
|
85
|
+
* @prop {boolean} [invalid=false] - Shows the field as invalid without any message, for an error displayed elsewhere
|
|
84
86
|
* @prop {string} [error] - An error computed outside the field, by the form or by the server. While set, the field is invalid and shows this message right away
|
|
85
87
|
* @prop {Array<Validators<Date | null>>} validators - The list of custom validation rules applied to the value
|
|
86
88
|
* @prop {string} [applyLabel='Apply'] - The label of the mobile modal's confirm button
|
|
87
89
|
* @attr {string} [apply-label='Apply'] - The label of the mobile modal's confirm button
|
|
88
|
-
* @prop {string} [cancelLabel
|
|
89
|
-
* @attr {string} [cancel-label
|
|
90
|
-
* @prop {string} [
|
|
91
|
-
* @attr {string} [
|
|
90
|
+
* @prop {string} [cancelLabel] - The label of the mobile modal's cancel button. Defaults to the localized string for the current locale (English: "Cancel")
|
|
91
|
+
* @attr {string} [cancel-label] - The label of the mobile modal's cancel button. Defaults to the localized string for the current locale (English: "Cancel")
|
|
92
|
+
* @prop {string} [clockLabel] - The accessible label of the trailing clock button. Defaults to the localized string for the current locale (English: "Open clock")
|
|
93
|
+
* @attr {string} [clock-label] - The accessible label of the trailing clock button. Defaults to the localized string for the current locale (English: "Open clock")
|
|
92
94
|
* @prop {string} [hourPlaceholder='hh'] - The placeholder shown in the empty hour segment
|
|
93
95
|
* @attr {string} [hour-placeholder='hh'] - The placeholder shown in the empty hour segment
|
|
94
96
|
* @prop {string} [minutePlaceholder='mm'] - The placeholder shown in the empty minute segment
|
|
@@ -119,8 +121,25 @@ const EunomiaTimePickerMixinBase = LocalizableMixin(AnchorPositionMixin(FieldApp
|
|
|
119
121
|
* @element eun-time-picker
|
|
120
122
|
*/
|
|
121
123
|
let EunomiaTimePicker = class EunomiaTimePicker extends EunomiaTimePickerMixinBase {
|
|
124
|
+
/**
|
|
125
|
+
* The default value applied on connection and form reset. Overrides the
|
|
126
|
+
* `defaultValue` accessor inherited from `FormMixin` only to swap its
|
|
127
|
+
* attribute converter — the mixin's generic one always splits
|
|
128
|
+
* `default-value` on commas, which would silently produce the wrong thing
|
|
129
|
+
* for a `Date` ; matches `eun-date-picker`'s identical override. The
|
|
130
|
+
* actual get/set logic (applying the default when the field resets)
|
|
131
|
+
* still comes from `FormMixin` itself, via `super`.
|
|
132
|
+
* @default-value-format an ISO 8601 date-time string
|
|
133
|
+
*/
|
|
134
|
+
get defaultValue() {
|
|
135
|
+
return super.defaultValue;
|
|
136
|
+
}
|
|
137
|
+
set defaultValue(value) {
|
|
138
|
+
// @ts-expect-error — see comment above ; FormMixin's real setter exists.
|
|
139
|
+
super.defaultValue = value;
|
|
140
|
+
}
|
|
122
141
|
constructor() {
|
|
123
|
-
super(
|
|
142
|
+
super();
|
|
124
143
|
/**
|
|
125
144
|
* The minute column's increment step, and which minute values the mobile
|
|
126
145
|
* wheel enumerates (e.g. `15` only ever shows/lands on `:00`/`:15`/`:30`/
|
|
@@ -168,16 +187,6 @@ let EunomiaTimePicker = class EunomiaTimePicker extends EunomiaTimePickerMixinBa
|
|
|
168
187
|
* @default Apply
|
|
169
188
|
*/
|
|
170
189
|
this.applyLabel = "Apply";
|
|
171
|
-
/**
|
|
172
|
-
* Label of the mobile modal's cancel button.
|
|
173
|
-
* @default Cancel
|
|
174
|
-
*/
|
|
175
|
-
this.cancelLabel = "Cancel";
|
|
176
|
-
/**
|
|
177
|
-
* Accessible label of the trailing clock button.
|
|
178
|
-
* @default Open clock
|
|
179
|
-
*/
|
|
180
|
-
this.ariaLabelClock = "Open clock";
|
|
181
190
|
/**
|
|
182
191
|
* Placeholder shown in the empty hour segment.
|
|
183
192
|
* @default hh
|
|
@@ -199,6 +208,25 @@ let EunomiaTimePicker = class EunomiaTimePicker extends EunomiaTimePickerMixinBa
|
|
|
199
208
|
* @internal
|
|
200
209
|
*/
|
|
201
210
|
this.isOpen = false;
|
|
211
|
+
/**
|
|
212
|
+
* Submits the owning form on Enter in one of the field's segments, as a
|
|
213
|
+
* native time input does, since the browser never does it from a
|
|
214
|
+
* shadow root. Left alone while the panel is open, and on keys a
|
|
215
|
+
* segment already handles, such as Enter toggling the AM/PM segment.
|
|
216
|
+
* @private
|
|
217
|
+
*/
|
|
218
|
+
this.handleImplicitSubmission = (event) => {
|
|
219
|
+
const form = this.internals.form;
|
|
220
|
+
const origin = event.composedPath()[0];
|
|
221
|
+
if (!form ||
|
|
222
|
+
this.isOpen ||
|
|
223
|
+
!(origin instanceof Element && origin.matches(".segment")) ||
|
|
224
|
+
!isImplicitSubmissionKey(event)) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
event.preventDefault();
|
|
228
|
+
submitImplicitly(form);
|
|
229
|
+
};
|
|
202
230
|
/**
|
|
203
231
|
* Whether the mobile modal is open.
|
|
204
232
|
* @internal
|
|
@@ -411,23 +439,7 @@ let EunomiaTimePicker = class EunomiaTimePicker extends EunomiaTimePickerMixinBa
|
|
|
411
439
|
break;
|
|
412
440
|
}
|
|
413
441
|
};
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* The default value applied on connection and form reset. Overrides the
|
|
417
|
-
* `defaultValue` accessor inherited from `FormMixin` only to swap its
|
|
418
|
-
* attribute converter — the mixin's generic one always splits
|
|
419
|
-
* `default-value` on commas, which would silently produce the wrong thing
|
|
420
|
-
* for a `Date` ; matches `eun-date-picker`'s identical override. The
|
|
421
|
-
* actual get/set logic (applying the default when the field resets)
|
|
422
|
-
* still comes from `FormMixin` itself, via `super`.
|
|
423
|
-
* @default-value-format an ISO 8601 date-time string
|
|
424
|
-
*/
|
|
425
|
-
get defaultValue() {
|
|
426
|
-
return super.defaultValue;
|
|
427
|
-
}
|
|
428
|
-
set defaultValue(value) {
|
|
429
|
-
// @ts-expect-error — see comment above ; FormMixin's real setter exists.
|
|
430
|
-
super.defaultValue = value;
|
|
442
|
+
this.addEventListener("keydown", this.handleImplicitSubmission);
|
|
431
443
|
}
|
|
432
444
|
/**
|
|
433
445
|
* Lifecycle hook called before an update, ahead of render. Keeps the
|
|
@@ -482,6 +494,14 @@ let EunomiaTimePicker = class EunomiaTimePicker extends EunomiaTimePickerMixinBa
|
|
|
482
494
|
this.setAttribute("aria-invalid", String(this.showError));
|
|
483
495
|
}
|
|
484
496
|
}
|
|
497
|
+
/**
|
|
498
|
+
* The host is never a tab stop of its own : sequential navigation goes
|
|
499
|
+
* straight to the controls inside, in both directions, and
|
|
500
|
+
* {@link focus} covers a direct call on the host.
|
|
501
|
+
*/
|
|
502
|
+
get hostTabStop() {
|
|
503
|
+
return false;
|
|
504
|
+
}
|
|
485
505
|
/**
|
|
486
506
|
* Returns the first segment element to focus/anchor on validation errors.
|
|
487
507
|
*
|
|
@@ -905,7 +925,8 @@ let EunomiaTimePicker = class EunomiaTimePicker extends EunomiaTimePickerMixinBa
|
|
|
905
925
|
<div
|
|
906
926
|
class="segment-group"
|
|
907
927
|
role="group"
|
|
908
|
-
aria-label=${this.label ??
|
|
928
|
+
aria-label=${this.label ?? this.dictionary.timePicker.time}
|
|
929
|
+
aria-describedby=${this.description?.length ? "description" : nothing}
|
|
909
930
|
>
|
|
910
931
|
${order.map((kind, index) => {
|
|
911
932
|
const previous = order[index - 1];
|
|
@@ -924,7 +945,7 @@ let EunomiaTimePicker = class EunomiaTimePicker extends EunomiaTimePickerMixinBa
|
|
|
924
945
|
<button
|
|
925
946
|
type="button"
|
|
926
947
|
id="clock-trigger"
|
|
927
|
-
aria-label=${this.
|
|
948
|
+
aria-label=${this.clockLabel ?? this.dictionary.timePicker.openClock}
|
|
928
949
|
aria-haspopup=${this.panelMode === "list" ? "listbox" : "dialog"}
|
|
929
950
|
aria-expanded=${this.isOpen || this.isModalOpen ? "true" : "false"}
|
|
930
951
|
?disabled=${this.disabled}
|
|
@@ -1035,7 +1056,7 @@ let EunomiaTimePicker = class EunomiaTimePicker extends EunomiaTimePickerMixinBa
|
|
|
1035
1056
|
?open=${this.isModalOpen}
|
|
1036
1057
|
.closeable=${false}
|
|
1037
1058
|
confirm-label=${this.applyLabel}
|
|
1038
|
-
cancel-label=${this.cancelLabel}
|
|
1059
|
+
cancel-label=${this.cancelLabel ?? this.dictionary.common.cancel}
|
|
1039
1060
|
aria-label=${this.label ?? this.dictionary.timePicker.selectATime}
|
|
1040
1061
|
@eunconfirm=${this.handleModalConfirm}
|
|
1041
1062
|
@euncancel=${this.handleModalCancel}
|
|
@@ -1053,7 +1074,7 @@ let EunomiaTimePicker = class EunomiaTimePicker extends EunomiaTimePickerMixinBa
|
|
|
1053
1074
|
id="cancel"
|
|
1054
1075
|
@click=${() => this.modalEl?.cancel()}
|
|
1055
1076
|
>
|
|
1056
|
-
${this.cancelLabel}
|
|
1077
|
+
${this.cancelLabel ?? this.dictionary.common.cancel}
|
|
1057
1078
|
</eun-button>
|
|
1058
1079
|
<eun-button id="confirm" @click=${() => this.modalEl?.confirm()}>
|
|
1059
1080
|
${this.applyLabel}
|
|
@@ -1113,8 +1134,8 @@ __decorate([
|
|
|
1113
1134
|
property({ attribute: "cancel-label" })
|
|
1114
1135
|
], EunomiaTimePicker.prototype, "cancelLabel", void 0);
|
|
1115
1136
|
__decorate([
|
|
1116
|
-
property({ attribute: "
|
|
1117
|
-
], EunomiaTimePicker.prototype, "
|
|
1137
|
+
property({ attribute: "clock-label" })
|
|
1138
|
+
], EunomiaTimePicker.prototype, "clockLabel", void 0);
|
|
1118
1139
|
__decorate([
|
|
1119
1140
|
property({ attribute: "hour-placeholder" })
|
|
1120
1141
|
], EunomiaTimePicker.prototype, "hourPlaceholder", void 0);
|
|
@@ -194,7 +194,7 @@ let EunomiaAnimate = class EunomiaAnimate extends LitElement {
|
|
|
194
194
|
*/
|
|
195
195
|
EunomiaAnimate.styles = animateStyles;
|
|
196
196
|
__decorate([
|
|
197
|
-
property({ reflect: true })
|
|
197
|
+
property({ reflect: true, useDefault: true })
|
|
198
198
|
], EunomiaAnimate.prototype, "animation", void 0);
|
|
199
199
|
__decorate([
|
|
200
200
|
property({ type: Number })
|
|
@@ -20,11 +20,11 @@ const base = css `
|
|
|
20
20
|
transition-property: none;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
:host([animation="fade"]) {
|
|
23
|
+
:host(:is([animation="fade"], :not([animation]))) {
|
|
24
24
|
opacity: 0;
|
|
25
25
|
transition-property: opacity;
|
|
26
26
|
}
|
|
27
|
-
:host([animation="fade"][in-view]) {
|
|
27
|
+
:host(:is([animation="fade"], :not([animation]))[in-view]) {
|
|
28
28
|
opacity: 1;
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -64,7 +64,7 @@ let EunomiaDivider = class EunomiaDivider extends LitElement {
|
|
|
64
64
|
*/
|
|
65
65
|
EunomiaDivider.styles = dividerStyles;
|
|
66
66
|
__decorate([
|
|
67
|
-
property({ reflect: true })
|
|
67
|
+
property({ reflect: true, useDefault: true })
|
|
68
68
|
], EunomiaDivider.prototype, "orientation", void 0);
|
|
69
69
|
EunomiaDivider = __decorate([
|
|
70
70
|
customElement(EunomiaDividerTagName)
|
|
@@ -170,7 +170,7 @@ __decorate([
|
|
|
170
170
|
property()
|
|
171
171
|
], EunomiaLoader.prototype, "label", void 0);
|
|
172
172
|
__decorate([
|
|
173
|
-
property({ reflect: true })
|
|
173
|
+
property({ reflect: true, useDefault: true })
|
|
174
174
|
], EunomiaLoader.prototype, "variant", void 0);
|
|
175
175
|
__decorate([
|
|
176
176
|
property({ hasChanged: () => false })
|
|
@@ -182,7 +182,7 @@ __decorate([
|
|
|
182
182
|
property({ type: Boolean, reflect: true })
|
|
183
183
|
], EunomiaLoader.prototype, "sticky", void 0);
|
|
184
184
|
__decorate([
|
|
185
|
-
property({ attribute: "sticky-position", reflect: true })
|
|
185
|
+
property({ attribute: "sticky-position", reflect: true, useDefault: true })
|
|
186
186
|
], EunomiaLoader.prototype, "stickyPosition", void 0);
|
|
187
187
|
EunomiaLoader = __decorate([
|
|
188
188
|
customElement(EunomiaLoaderTagName)
|
|
@@ -19,9 +19,9 @@ const base = css `
|
|
|
19
19
|
font-size: var(--_size);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
:host([variant="dots"]) span,
|
|
23
|
-
:host([variant="dots"]) span::before,
|
|
24
|
-
:host([variant="dots"]) span::after {
|
|
22
|
+
:host(:is([variant="dots"], :not([variant]))) span,
|
|
23
|
+
:host(:is([variant="dots"], :not([variant]))) span::before,
|
|
24
|
+
:host(:is([variant="dots"], :not([variant]))) span::after {
|
|
25
25
|
border-radius: 50%;
|
|
26
26
|
width: 0.5em;
|
|
27
27
|
height: 0.5em;
|
|
@@ -30,22 +30,22 @@ const base = css `
|
|
|
30
30
|
animation: eun-loader-fade 1.4s infinite ease-in-out;
|
|
31
31
|
animation-fill-mode: both;
|
|
32
32
|
}
|
|
33
|
-
:host([variant="dots"]) span {
|
|
33
|
+
:host(:is([variant="dots"], :not([variant]))) span {
|
|
34
34
|
position: relative;
|
|
35
35
|
margin: 0 0.75em;
|
|
36
36
|
animation-delay: -0.16s;
|
|
37
37
|
}
|
|
38
|
-
:host([variant="dots"]) span::before,
|
|
39
|
-
:host([variant="dots"]) span::after {
|
|
38
|
+
:host(:is([variant="dots"], :not([variant]))) span::before,
|
|
39
|
+
:host(:is([variant="dots"], :not([variant]))) span::after {
|
|
40
40
|
content: "";
|
|
41
41
|
position: absolute;
|
|
42
42
|
top: 0;
|
|
43
43
|
}
|
|
44
|
-
:host([variant="dots"]) span::before {
|
|
44
|
+
:host(:is([variant="dots"], :not([variant]))) span::before {
|
|
45
45
|
left: -0.75em;
|
|
46
46
|
animation-delay: -0.32s;
|
|
47
47
|
}
|
|
48
|
-
:host([variant="dots"]) span::after {
|
|
48
|
+
:host(:is([variant="dots"], :not([variant]))) span::after {
|
|
49
49
|
left: 0.75em;
|
|
50
50
|
}
|
|
51
51
|
@keyframes eun-loader-fade {
|
|
@@ -77,9 +77,9 @@ const base = css `
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
@media (prefers-reduced-motion: reduce) {
|
|
80
|
-
:host([variant="dots"]) span,
|
|
81
|
-
:host([variant="dots"]) span::before,
|
|
82
|
-
:host([variant="dots"]) span::after {
|
|
80
|
+
:host(:is([variant="dots"], :not([variant]))) span,
|
|
81
|
+
:host(:is([variant="dots"], :not([variant]))) span::before,
|
|
82
|
+
:host(:is([variant="dots"], :not([variant]))) span::after {
|
|
83
83
|
animation-duration: 2.8s;
|
|
84
84
|
}
|
|
85
85
|
:host([variant="spinner"]) span {
|
|
@@ -140,7 +140,9 @@ const bar = css `
|
|
|
140
140
|
z-index: var(--loader-bar-z-index, 10);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
:host(
|
|
143
|
+
:host(
|
|
144
|
+
[variant="bar"][sticky]:is([sticky-position="top"], :not([sticky-position]))
|
|
145
|
+
) {
|
|
144
146
|
top: var(--loader-bar-sticky-offset, 0);
|
|
145
147
|
}
|
|
146
148
|
|
|
@@ -82,7 +82,7 @@ let EunomiaSkeleton = class EunomiaSkeleton extends LitElement {
|
|
|
82
82
|
*/
|
|
83
83
|
EunomiaSkeleton.styles = skeletonStyles;
|
|
84
84
|
__decorate([
|
|
85
|
-
property({ reflect: true })
|
|
85
|
+
property({ reflect: true, useDefault: true })
|
|
86
86
|
], EunomiaSkeleton.prototype, "variant", void 0);
|
|
87
87
|
__decorate([
|
|
88
88
|
property()
|
|
@@ -64,10 +64,10 @@ declare const EunomiaCarousel_base: import("../../../utils/constructor.type.js")
|
|
|
64
64
|
* @prop {boolean} [showArrows=true] - Shows the previous and next buttons
|
|
65
65
|
* @prop {boolean} [showDots=true] - Shows the pagination dots
|
|
66
66
|
* @attr {string} aria-label - The accessible name for the carousel region. Defaults to Carousel, and is recommended whenever a page has more than one carousel, or its purpose isn't already clear from a preceding heading
|
|
67
|
-
* @prop {string} [
|
|
68
|
-
* @attr {string} [
|
|
69
|
-
* @prop {string} [
|
|
70
|
-
* @attr {string} [
|
|
67
|
+
* @prop {string} [previousLabel] - The accessible label of the previous control. Defaults to the localized string for the current locale (English: "Previous slide")
|
|
68
|
+
* @attr {string} [previous-label] - The accessible label of the previous control. Defaults to the localized string for the current locale (English: "Previous slide")
|
|
69
|
+
* @prop {string} [nextLabel] - The accessible label of the next control. Defaults to the localized string for the current locale (English: "Next slide")
|
|
70
|
+
* @attr {string} [next-label] - The accessible label of the next control. Defaults to the localized string for the current locale (English: "Next slide")
|
|
71
71
|
* @fires {SlideChangeEvent} eunslidechange - Fired once the active slide settles on a new index
|
|
72
72
|
* @cssprop [--carousel-visible-slides] - Sets how many slides are shown at once, overriding visibleSlides. Meant to be changed from your own media or container queries, so the slide count follows the available space without any script
|
|
73
73
|
* @cssprop [--carousel-scroll-step] - Sets how many slides a previous, next, or dot click advances by, overriding scrollStep. Read again whenever the carousel resizes
|
|
@@ -210,13 +210,13 @@ export declare class EunomiaCarousel extends EunomiaCarousel_base {
|
|
|
210
210
|
* dictionary when unset, so it follows `locale` automatically.
|
|
211
211
|
* @default {i18n:carousel.previous}
|
|
212
212
|
*/
|
|
213
|
-
|
|
213
|
+
previousLabel?: string;
|
|
214
214
|
/**
|
|
215
215
|
* Accessible label of the Next control. Resolved from the locale
|
|
216
216
|
* dictionary when unset, so it follows `locale` automatically.
|
|
217
217
|
* @default {i18n:carousel.next}
|
|
218
218
|
*/
|
|
219
|
-
|
|
219
|
+
nextLabel?: string;
|
|
220
220
|
/**
|
|
221
221
|
* Index of the currently active slide (see {@link ACTIVE_SLIDE_CLASS}).
|
|
222
222
|
* @internal
|
|
@@ -369,6 +369,29 @@ export declare class EunomiaCarousel extends EunomiaCarousel_base {
|
|
|
369
369
|
* @private
|
|
370
370
|
*/
|
|
371
371
|
private getTrackInset;
|
|
372
|
+
/**
|
|
373
|
+
* Whether the track lays out right to left. Slides then start from the
|
|
374
|
+
* track's right edge and `scrollLeft` runs from `0` down to negative
|
|
375
|
+
* values, so every scroll measurement goes through the logical helpers
|
|
376
|
+
* below instead of reading `left`/`scrollLeft` directly.
|
|
377
|
+
* @private
|
|
378
|
+
*/
|
|
379
|
+
private isRtl;
|
|
380
|
+
/**
|
|
381
|
+
* How far the track has scrolled from its inline start, always positive
|
|
382
|
+
* whatever the direction.
|
|
383
|
+
* @private
|
|
384
|
+
*/
|
|
385
|
+
private getScrollProgress;
|
|
386
|
+
/**
|
|
387
|
+
* Distance from the track's inline-start edge to a rect's own
|
|
388
|
+
* inline-start edge (`left` in LTR, `right` in RTL), positive toward the
|
|
389
|
+
* end of the track.
|
|
390
|
+
* @param rect the measured element's rect.
|
|
391
|
+
* @param trackRect the track's own rect.
|
|
392
|
+
* @private
|
|
393
|
+
*/
|
|
394
|
+
private getInlineStartOffset;
|
|
372
395
|
/**
|
|
373
396
|
* The highest valid slide index a page can start on, without leaving
|
|
374
397
|
* empty space at the end of the track. Measured from the slides' actual
|
|
@@ -563,7 +586,8 @@ export declare class EunomiaCarousel extends EunomiaCarousel_base {
|
|
|
563
586
|
private updateFromScrollPosition;
|
|
564
587
|
/**
|
|
565
588
|
* Handles keyboard navigation on the track : arrow keys page by
|
|
566
|
-
* `scrollStep`, Home/End jump to the bounds.
|
|
589
|
+
* `scrollStep`, Home/End jump to the bounds. Right to left, the arrows
|
|
590
|
+
* swap so each one still moves toward the side it points to.
|
|
567
591
|
*
|
|
568
592
|
* @param event the native keyboard event.
|
|
569
593
|
* @private
|
|
@@ -54,10 +54,10 @@ const ACTIVE_SLIDE_CLASS = "eun-carousel-active-slide";
|
|
|
54
54
|
* @prop {boolean} [showArrows=true] - Shows the previous and next buttons
|
|
55
55
|
* @prop {boolean} [showDots=true] - Shows the pagination dots
|
|
56
56
|
* @attr {string} aria-label - The accessible name for the carousel region. Defaults to Carousel, and is recommended whenever a page has more than one carousel, or its purpose isn't already clear from a preceding heading
|
|
57
|
-
* @prop {string} [
|
|
58
|
-
* @attr {string} [
|
|
59
|
-
* @prop {string} [
|
|
60
|
-
* @attr {string} [
|
|
57
|
+
* @prop {string} [previousLabel] - The accessible label of the previous control. Defaults to the localized string for the current locale (English: "Previous slide")
|
|
58
|
+
* @attr {string} [previous-label] - The accessible label of the previous control. Defaults to the localized string for the current locale (English: "Previous slide")
|
|
59
|
+
* @prop {string} [nextLabel] - The accessible label of the next control. Defaults to the localized string for the current locale (English: "Next slide")
|
|
60
|
+
* @attr {string} [next-label] - The accessible label of the next control. Defaults to the localized string for the current locale (English: "Next slide")
|
|
61
61
|
* @fires {SlideChangeEvent} eunslidechange - Fired once the active slide settles on a new index
|
|
62
62
|
* @cssprop [--carousel-visible-slides] - Sets how many slides are shown at once, overriding visibleSlides. Meant to be changed from your own media or container queries, so the slide count follows the available space without any script
|
|
63
63
|
* @cssprop [--carousel-scroll-step] - Sets how many slides a previous, next, or dot click advances by, overriding scrollStep. Read again whenever the carousel resizes
|
|
@@ -428,6 +428,37 @@ let EunomiaCarousel = class EunomiaCarousel extends LocalizableMixin(LitElement)
|
|
|
428
428
|
}
|
|
429
429
|
return Number.parseFloat(getComputedStyle(this.trackEl).paddingLeft) || 0;
|
|
430
430
|
}
|
|
431
|
+
/**
|
|
432
|
+
* Whether the track lays out right to left. Slides then start from the
|
|
433
|
+
* track's right edge and `scrollLeft` runs from `0` down to negative
|
|
434
|
+
* values, so every scroll measurement goes through the logical helpers
|
|
435
|
+
* below instead of reading `left`/`scrollLeft` directly.
|
|
436
|
+
* @private
|
|
437
|
+
*/
|
|
438
|
+
isRtl() {
|
|
439
|
+
return !!this.trackEl && getComputedStyle(this.trackEl).direction === "rtl";
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* How far the track has scrolled from its inline start, always positive
|
|
443
|
+
* whatever the direction.
|
|
444
|
+
* @private
|
|
445
|
+
*/
|
|
446
|
+
getScrollProgress() {
|
|
447
|
+
return this.trackEl ? Math.abs(this.trackEl.scrollLeft) : 0;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Distance from the track's inline-start edge to a rect's own
|
|
451
|
+
* inline-start edge (`left` in LTR, `right` in RTL), positive toward the
|
|
452
|
+
* end of the track.
|
|
453
|
+
* @param rect the measured element's rect.
|
|
454
|
+
* @param trackRect the track's own rect.
|
|
455
|
+
* @private
|
|
456
|
+
*/
|
|
457
|
+
getInlineStartOffset(rect, trackRect) {
|
|
458
|
+
return this.isRtl()
|
|
459
|
+
? trackRect.right - rect.right
|
|
460
|
+
: rect.left - trackRect.left;
|
|
461
|
+
}
|
|
431
462
|
/**
|
|
432
463
|
* Number of pagination dots, derived from how many `scrollStep`-sized
|
|
433
464
|
* jumps it takes to cover every slide. Rounds up so a trailing partial
|
|
@@ -493,16 +524,16 @@ let EunomiaCarousel = class EunomiaCarousel extends LocalizableMixin(LitElement)
|
|
|
493
524
|
}
|
|
494
525
|
const track = this.trackEl;
|
|
495
526
|
const trackRect = track.getBoundingClientRect();
|
|
496
|
-
const
|
|
527
|
+
const maxScroll = Math.max(0, track.scrollWidth - track.clientWidth);
|
|
528
|
+
const scrolled = this.getScrollProgress();
|
|
497
529
|
const inset = this.getTrackInset();
|
|
498
530
|
let max = 0;
|
|
499
531
|
let closestDistance = Infinity;
|
|
500
532
|
this.slides.forEach((slide, index) => {
|
|
501
|
-
const slideStart = slide.getBoundingClientRect()
|
|
502
|
-
|
|
503
|
-
track.scrollLeft -
|
|
533
|
+
const slideStart = this.getInlineStartOffset(slide.getBoundingClientRect(), trackRect) +
|
|
534
|
+
scrolled -
|
|
504
535
|
inset;
|
|
505
|
-
const distance = Math.abs(slideStart -
|
|
536
|
+
const distance = Math.abs(slideStart - maxScroll);
|
|
506
537
|
if (distance < closestDistance) {
|
|
507
538
|
closestDistance = distance;
|
|
508
539
|
max = index;
|
|
@@ -613,8 +644,9 @@ let EunomiaCarousel = class EunomiaCarousel extends LocalizableMixin(LitElement)
|
|
|
613
644
|
? ((index % (max + 1)) + (max + 1)) % (max + 1)
|
|
614
645
|
: Math.max(0, Math.min(index, max));
|
|
615
646
|
if (!this.centerSnap && target === max) {
|
|
647
|
+
const maxScroll = this.trackEl.scrollWidth - this.trackEl.clientWidth;
|
|
616
648
|
this.trackEl.scrollTo({
|
|
617
|
-
left: this.
|
|
649
|
+
left: this.isRtl() ? -maxScroll : maxScroll,
|
|
618
650
|
behavior: this.scrollBehavior(),
|
|
619
651
|
});
|
|
620
652
|
return;
|
|
@@ -712,27 +744,20 @@ let EunomiaCarousel = class EunomiaCarousel extends LocalizableMixin(LitElement)
|
|
|
712
744
|
}
|
|
713
745
|
const trackRect = this.trackEl.getBoundingClientRect();
|
|
714
746
|
const reference = this.centerSnap
|
|
715
|
-
? trackRect.
|
|
716
|
-
:
|
|
747
|
+
? trackRect.width / 2
|
|
748
|
+
: this.getTrackInset();
|
|
717
749
|
let closestIndex = 0;
|
|
718
750
|
let closestDistance = Infinity;
|
|
719
751
|
this.slides.forEach((slide, index) => {
|
|
720
752
|
const rect = slide.getBoundingClientRect();
|
|
721
|
-
const
|
|
753
|
+
const start = this.getInlineStartOffset(rect, trackRect);
|
|
754
|
+
const point = this.centerSnap ? start + rect.width / 2 : start;
|
|
722
755
|
const distance = Math.abs(point - reference);
|
|
723
756
|
if (distance < closestDistance) {
|
|
724
757
|
closestDistance = distance;
|
|
725
758
|
closestIndex = index;
|
|
726
759
|
}
|
|
727
760
|
});
|
|
728
|
-
// At the true scroll end, the nearest slide to `reference` can sit past
|
|
729
|
-
// `measureMaxIndex`'s result — e.g. when the slide count doesn't evenly
|
|
730
|
-
// divide into pages, the flush-end scroll position (see the `target ===
|
|
731
|
-
// max` branch in `goToIndex`) reveals a trailing slide that ends up
|
|
732
|
-
// closer to `reference` than the officially "reachable" last page. Left
|
|
733
|
-
// unclamped, `currentIndex` would exceed `maxIndex`, which breaks the
|
|
734
|
-
// pagination dot lookup (no dot matches) and gets `previous()` stuck,
|
|
735
|
-
// since it re-targets that same last-page scroll position every time.
|
|
736
761
|
this.maxIndex = this.measureMaxIndex();
|
|
737
762
|
closestIndex = Math.min(closestIndex, this.maxIndex);
|
|
738
763
|
this.slides.forEach((slide, index) => {
|
|
@@ -740,17 +765,21 @@ let EunomiaCarousel = class EunomiaCarousel extends LocalizableMixin(LitElement)
|
|
|
740
765
|
});
|
|
741
766
|
const changedIndex = closestIndex !== this.currentIndex;
|
|
742
767
|
this.currentIndex = closestIndex;
|
|
743
|
-
const
|
|
768
|
+
const scrolled = this.getScrollProgress();
|
|
744
769
|
const maxScroll = this.trackEl.scrollWidth - this.trackEl.clientWidth;
|
|
745
|
-
|
|
746
|
-
|
|
770
|
+
const startFade = scrolled > 1 ? "1" : "0";
|
|
771
|
+
const endFade = scrolled < maxScroll - 1 ? "1" : "0";
|
|
772
|
+
const rtl = this.isRtl();
|
|
773
|
+
this.style.setProperty("--_showLeftFade", rtl ? endFade : startFade);
|
|
774
|
+
this.style.setProperty("--_showRightFade", rtl ? startFade : endFade);
|
|
747
775
|
if (changedIndex) {
|
|
748
776
|
this.scheduleAnnounce();
|
|
749
777
|
}
|
|
750
778
|
}
|
|
751
779
|
/**
|
|
752
780
|
* Handles keyboard navigation on the track : arrow keys page by
|
|
753
|
-
* `scrollStep`, Home/End jump to the bounds.
|
|
781
|
+
* `scrollStep`, Home/End jump to the bounds. Right to left, the arrows
|
|
782
|
+
* swap so each one still moves toward the side it points to.
|
|
754
783
|
*
|
|
755
784
|
* @param event the native keyboard event.
|
|
756
785
|
* @private
|
|
@@ -759,11 +788,21 @@ let EunomiaCarousel = class EunomiaCarousel extends LocalizableMixin(LitElement)
|
|
|
759
788
|
switch (event.key) {
|
|
760
789
|
case "ArrowLeft":
|
|
761
790
|
event.preventDefault();
|
|
762
|
-
this.
|
|
791
|
+
if (this.isRtl()) {
|
|
792
|
+
this.next();
|
|
793
|
+
}
|
|
794
|
+
else {
|
|
795
|
+
this.previous();
|
|
796
|
+
}
|
|
763
797
|
break;
|
|
764
798
|
case "ArrowRight":
|
|
765
799
|
event.preventDefault();
|
|
766
|
-
this.
|
|
800
|
+
if (this.isRtl()) {
|
|
801
|
+
this.previous();
|
|
802
|
+
}
|
|
803
|
+
else {
|
|
804
|
+
this.next();
|
|
805
|
+
}
|
|
767
806
|
break;
|
|
768
807
|
case "Home":
|
|
769
808
|
event.preventDefault();
|
|
@@ -822,8 +861,8 @@ let EunomiaCarousel = class EunomiaCarousel extends LocalizableMixin(LitElement)
|
|
|
822
861
|
id=${direction}
|
|
823
862
|
class="nav"
|
|
824
863
|
aria-label=${isPrev
|
|
825
|
-
? (this.
|
|
826
|
-
: (this.
|
|
864
|
+
? (this.previousLabel ?? this.dictionary.carousel.previous)
|
|
865
|
+
: (this.nextLabel ?? this.dictionary.carousel.next)}
|
|
827
866
|
aria-controls="track"
|
|
828
867
|
?disabled=${disabled}
|
|
829
868
|
@click=${() => (isPrev ? this.previous() : this.next())}
|
|
@@ -892,10 +931,10 @@ let EunomiaCarousel = class EunomiaCarousel extends LocalizableMixin(LitElement)
|
|
|
892
931
|
*/
|
|
893
932
|
EunomiaCarousel.styles = carouselStyles;
|
|
894
933
|
__decorate([
|
|
895
|
-
property({ reflect: true })
|
|
934
|
+
property({ reflect: true, useDefault: true })
|
|
896
935
|
], EunomiaCarousel.prototype, "layout", void 0);
|
|
897
936
|
__decorate([
|
|
898
|
-
property({ reflect: true, attribute: "nav-placement" })
|
|
937
|
+
property({ reflect: true, attribute: "nav-placement", useDefault: true })
|
|
899
938
|
], EunomiaCarousel.prototype, "navPlacement", void 0);
|
|
900
939
|
__decorate([
|
|
901
940
|
property({ type: Number, attribute: "responsive-breakpoint" })
|
|
@@ -931,11 +970,11 @@ __decorate([
|
|
|
931
970
|
property({ type: Boolean, attribute: "show-dots" })
|
|
932
971
|
], EunomiaCarousel.prototype, "showDots", void 0);
|
|
933
972
|
__decorate([
|
|
934
|
-
property({ attribute: "
|
|
935
|
-
], EunomiaCarousel.prototype, "
|
|
973
|
+
property({ attribute: "previous-label" })
|
|
974
|
+
], EunomiaCarousel.prototype, "previousLabel", void 0);
|
|
936
975
|
__decorate([
|
|
937
|
-
property({ attribute: "
|
|
938
|
-
], EunomiaCarousel.prototype, "
|
|
976
|
+
property({ attribute: "next-label" })
|
|
977
|
+
], EunomiaCarousel.prototype, "nextLabel", void 0);
|
|
939
978
|
__decorate([
|
|
940
979
|
state()
|
|
941
980
|
], EunomiaCarousel.prototype, "currentIndex", void 0);
|
|
@@ -282,11 +282,14 @@ const base = css `
|
|
|
282
282
|
.nav eun-icon {
|
|
283
283
|
pointer-events: none;
|
|
284
284
|
}
|
|
285
|
+
:host(:dir(rtl)) .nav eun-icon {
|
|
286
|
+
transform: scaleX(-1);
|
|
287
|
+
}
|
|
285
288
|
#prev {
|
|
286
|
-
|
|
289
|
+
inset-inline-start: var(--eun-space-s, 8px);
|
|
287
290
|
}
|
|
288
291
|
#next {
|
|
289
|
-
|
|
292
|
+
inset-inline-end: var(--eun-space-s, 8px);
|
|
290
293
|
}
|
|
291
294
|
#viewport .nav {
|
|
292
295
|
box-shadow: var(--carousel-nav-shadow, 0 2px 10px rgba(15, 23, 42, 0.18));
|