@lmvz-ds/components 0.35.2 → 0.36.1
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/CHANGELOG.md +18 -0
- package/assets/icons/calendar.svg +7 -0
- package/cjs/{aria-validation-controller-BC0Eaiv4.js → aria-validation-controller-Do0uEK4t.js} +1 -1
- package/cjs/aria.constants-DPK5mQEL.js +65 -0
- package/cjs/{directional-focus-controller-DBat-oF7.js → directional-focus-controller-8Xd_7MHT.js} +3 -1
- package/cjs/{element-activation-controller-BHqCUgQv.js → element-activation-controller-DzTUocEO.js} +1 -1
- package/cjs/{element.util-CRS_YJ59.js → element.util-BlhcwmfR.js} +8 -54
- package/cjs/{index-TGsVZNDP.js → index-BgvZ4y-3.js} +12 -0
- package/cjs/lmvz-action-list.cjs.entry.js +5 -4
- package/cjs/lmvz-action.cjs.entry.js +1 -1
- package/cjs/lmvz-button-group.cjs.entry.js +3 -2
- package/cjs/lmvz-button_2.cjs.entry.js +6 -5
- package/cjs/lmvz-card.cjs.entry.js +1 -1
- package/cjs/lmvz-checkbox.cjs.entry.js +40 -6
- package/cjs/lmvz-chip.cjs.entry.js +2 -2
- package/cjs/lmvz-components.cjs.js +2 -2
- package/cjs/lmvz-datepicker.cjs.entry.js +2771 -0
- package/cjs/lmvz-header_2.cjs.entry.js +7 -6
- package/cjs/lmvz-input.cjs.entry.js +71 -15
- package/cjs/lmvz-link.cjs.entry.js +2 -2
- package/cjs/lmvz-menuitem.cjs.entry.js +6 -5
- package/cjs/lmvz-message.cjs.entry.js +2 -2
- package/cjs/lmvz-modal.cjs.entry.js +5 -4
- package/cjs/lmvz-popover.cjs.entry.js +25 -10
- package/cjs/lmvz-radio.cjs.entry.js +63 -5
- package/cjs/lmvz-select.cjs.entry.js +425 -18
- package/cjs/lmvz-snackbar.cjs.entry.js +2 -2
- package/cjs/lmvz-spinner.cjs.entry.js +2 -2
- package/cjs/lmvz-tab.cjs.entry.js +2 -2
- package/cjs/lmvz-tabs.cjs.entry.js +5 -4
- package/cjs/lmvz-toggle.cjs.entry.js +7 -4
- package/cjs/loader.cjs.js +2 -2
- package/collection/assets/icons/calendar.svg +7 -0
- package/collection/collection-manifest.json +1 -0
- package/collection/components/lmvz-checkbox/lmvz-checkbox.css +4 -2
- package/collection/components/lmvz-checkbox/lmvz-checkbox.js +68 -8
- package/collection/components/lmvz-datepicker/lmvz-datepicker.css +161 -0
- package/collection/components/lmvz-datepicker/lmvz-datepicker.js +1002 -0
- package/collection/components/lmvz-datepicker/lmvz-datepicker.utils.js +189 -0
- package/collection/components/lmvz-datepicker/test/lmvz-datepicker.utils.unit.js +300 -0
- package/collection/components/lmvz-header/lmvz-header.js +1 -1
- package/collection/components/lmvz-icon/lmvz-icon.js +1 -1
- package/collection/components/lmvz-input/lmvz-input.css +1 -1
- package/collection/components/lmvz-input/lmvz-input.js +85 -12
- package/collection/components/lmvz-link/lmvz-link.js +1 -1
- package/collection/components/lmvz-menuitem/lmvz-menuitem.js +1 -1
- package/collection/components/lmvz-message/lmvz-message.js +1 -1
- package/collection/components/lmvz-modal/lmvz-modal.js +1 -1
- package/collection/components/lmvz-popover/lmvz-popover.css +1 -1
- package/collection/components/lmvz-popover/lmvz-popover.js +50 -6
- package/collection/components/lmvz-radio/lmvz-radio.js +77 -9
- package/collection/components/lmvz-select/lmvz-select.css +96 -34
- package/collection/components/lmvz-select/lmvz-select.js +412 -21
- package/collection/components/lmvz-snackbar/lmvz-snackbar.js +1 -1
- package/collection/components/lmvz-spinner/lmvz-spinner.js +1 -1
- package/collection/components/lmvz-tab/lmvz-tab.js +1 -1
- package/collection/components/lmvz-tabs/lmvz-tabs.js +1 -1
- package/collection/components/lmvz-toggle/lmvz-toggle.js +21 -1
- package/collection/integration/header-integration/header-integration.js +1 -1
- package/collection/styles/fragments/_focus-within.css +2 -2
- package/collection/utils/aria/aria.constants.js +7 -0
- package/collection/utils/aria/directional-focus-controller.js +3 -1
- package/collection/utils/aria/listbox-controller.js +154 -0
- package/collection/utils/element/element.util.js +5 -0
- package/collection/utils/radio/radio-group-controller.js +17 -0
- package/components/index.d.ts +2 -0
- package/components/index.d.ts.bak +2 -0
- package/components/index.js +1 -1
- package/components/lmvz-action-list.js +1 -1
- package/components/lmvz-action.js +1 -1
- package/components/lmvz-button-group.js +1 -1
- package/components/lmvz-button.js +1 -1
- package/components/lmvz-card.js +1 -1
- package/components/lmvz-checkbox.js +1 -1
- package/components/lmvz-chip.js +1 -1
- package/components/lmvz-datepicker.d.ts +11 -0
- package/components/lmvz-datepicker.d.ts.bak +11 -0
- package/components/lmvz-datepicker.js +1 -0
- package/components/lmvz-header.js +1 -1
- package/components/lmvz-icon.js +1 -1
- package/components/lmvz-input.js +1 -1
- package/components/lmvz-link.js +1 -1
- package/components/lmvz-menuitem.js +1 -1
- package/components/lmvz-message.js +1 -1
- package/components/lmvz-modal.js +1 -1
- package/components/lmvz-popover.js +1 -1
- package/components/lmvz-radio.js +1 -1
- package/components/lmvz-select.js +1 -1
- package/components/lmvz-snackbar.js +1 -1
- package/components/lmvz-spinner.js +1 -1
- package/components/lmvz-tab.js +1 -1
- package/components/lmvz-tabs.js +1 -1
- package/components/lmvz-toggle.js +1 -1
- package/components/{p-Chj7BuUZ.js → p--FDdvoIg.js} +1 -1
- package/components/{p-CFTmV4XZ.js → p-BAj4FkUt.js} +1 -1
- package/components/p-BApwCp0R.js +1 -0
- package/components/{p-CxLd309t.js → p-BLMXiDE0.js} +1 -1
- package/components/{p-DGg7OzDl.js → p-BPYBmylI.js} +1 -1
- package/components/p-BhALzK62.js +1 -0
- package/components/{p-B_rnXUwq.js → p-Bnri3fEI.js} +1 -1
- package/components/p-C-pRMuMh.js +1 -0
- package/components/p-C5gRiLRR.js +1 -0
- package/components/{p-D5FL8n1q.js → p-CrQCHVKL.js} +1 -1
- package/components/p-DqdrUt_G.js +1 -0
- package/components/{p-CgK6-SEe.js → p-diOze8wI.js} +1 -1
- package/esm/{aria-validation-controller-BvOU1BO8.js → aria-validation-controller-Cp6pofER.js} +1 -1
- package/esm/aria.constants-DIyiticz.js +62 -0
- package/esm/{directional-focus-controller-DgAdCZrG.js → directional-focus-controller-QukTTWBE.js} +3 -1
- package/esm/{element-activation-controller-7PNSl6io.js → element-activation-controller-dxJZKMag.js} +1 -1
- package/esm/{element.util-BFcYfHYq.js → element.util-3ydVsxUW.js} +7 -54
- package/esm/{index-BPeerEwm.js → index-BOXP1Vx0.js} +12 -1
- package/esm/lmvz-action-list.entry.js +5 -4
- package/esm/lmvz-action.entry.js +1 -1
- package/esm/lmvz-button-group.entry.js +3 -2
- package/esm/lmvz-button_2.entry.js +6 -5
- package/esm/lmvz-card.entry.js +1 -1
- package/esm/lmvz-checkbox.entry.js +40 -6
- package/esm/lmvz-chip.entry.js +2 -2
- package/esm/lmvz-components.js +3 -3
- package/esm/lmvz-datepicker.entry.js +2769 -0
- package/esm/lmvz-header_2.entry.js +7 -6
- package/esm/lmvz-input.entry.js +71 -15
- package/esm/lmvz-link.entry.js +2 -2
- package/esm/lmvz-menuitem.entry.js +6 -5
- package/esm/lmvz-message.entry.js +2 -2
- package/esm/lmvz-modal.entry.js +5 -4
- package/esm/lmvz-popover.entry.js +25 -10
- package/esm/lmvz-radio.entry.js +63 -5
- package/esm/lmvz-select.entry.js +425 -18
- package/esm/lmvz-snackbar.entry.js +2 -2
- package/esm/lmvz-spinner.entry.js +2 -2
- package/esm/lmvz-tab.entry.js +2 -2
- package/esm/lmvz-tabs.entry.js +5 -4
- package/esm/lmvz-toggle.entry.js +7 -4
- package/esm/loader.js +3 -3
- package/hydrate/index.js +3474 -75
- package/hydrate/index.mjs +3474 -75
- package/lmvz-components/lmvz-components.esm.js +1 -1
- package/lmvz-components/{p-eb62d4af.entry.js → p-0af0211a.entry.js} +1 -1
- package/lmvz-components/{p-5bbbcfc0.entry.js → p-0f65d001.entry.js} +1 -1
- package/lmvz-components/p-137b1fe1.entry.js +1 -0
- package/lmvz-components/p-26dd9684.entry.js +1 -0
- package/lmvz-components/p-36f44108.entry.js +1 -0
- package/lmvz-components/p-398b5cf4.entry.js +1 -0
- package/lmvz-components/p-3a396fc8.entry.js +1 -0
- package/lmvz-components/{p-0c05f24b.entry.js → p-3d5867df.entry.js} +1 -1
- package/lmvz-components/p-40716828.entry.js +1 -0
- package/lmvz-components/{p-a887018d.entry.js → p-492adf21.entry.js} +1 -1
- package/lmvz-components/{p-24d13be6.entry.js → p-4fa6e72f.entry.js} +1 -1
- package/lmvz-components/p-70f1e31a.entry.js +1 -0
- package/lmvz-components/p-71d06d1d.entry.js +1 -0
- package/lmvz-components/{p-d45164a8.entry.js → p-7a7aa922.entry.js} +1 -1
- package/lmvz-components/p-88661c50.entry.js +1 -0
- package/lmvz-components/p-91eb71bb.entry.js +1 -0
- package/lmvz-components/p-BA3wizqg.js +1 -0
- package/lmvz-components/{p-BPeerEwm.js → p-BOXP1Vx0.js} +2 -2
- package/lmvz-components/{p-D9PQIBzA.js → p-BeY96W7m.js} +1 -1
- package/lmvz-components/p-CHxiS3ja.js +1 -0
- package/lmvz-components/{p-wlMjNjuv.js → p-CPSyM_e-.js} +1 -1
- package/lmvz-components/p-DIyiticz.js +1 -0
- package/lmvz-components/p-a680a7b2.entry.js +1 -0
- package/lmvz-components/{p-c2544495.entry.js → p-a6fe9b61.entry.js} +1 -1
- package/lmvz-components/{p-ecbd9e93.entry.js → p-a99acb02.entry.js} +1 -1
- package/lmvz-components/p-f16a19fc.entry.js +1 -0
- package/lmvz-components/p-f3f0ed49.entry.js +1 -0
- package/lmvz-components/p-f516a949.entry.js +1 -0
- package/manifest.json +1305 -188
- package/package.json +5 -1
- package/types/api/ds.constants.d.ts +0 -1
- package/types/api/ds.types.d.ts +9 -0
- package/types/components/lmvz-action/lmvz-action.d.ts +0 -1
- package/types/components/lmvz-action-list/lmvz-action-list.d.ts +0 -1
- package/types/components/lmvz-button/lmvz-button.d.ts +0 -1
- package/types/components/lmvz-button-group/lmvz-button-group.d.ts +0 -1
- package/types/components/lmvz-card/lmvz-card.d.ts +0 -1
- package/types/components/lmvz-checkbox/lmvz-checkbox.d.ts +9 -2
- package/types/components/lmvz-chip/lmvz-chip.d.ts +0 -1
- package/types/components/lmvz-datepicker/lmvz-datepicker.d.ts +77 -0
- package/types/components/lmvz-datepicker/lmvz-datepicker.utils.d.ts +22 -0
- package/types/components/lmvz-datepicker/test/lmvz-datepicker.utils.unit.d.ts +1 -0
- package/types/components/lmvz-header/lmvz-header.d.ts +0 -1
- package/types/components/lmvz-icon/lmvz-icon.d.ts +0 -1
- package/types/components/lmvz-input/lmvz-input.d.ts +8 -1
- package/types/components/lmvz-link/lmvz-link.d.ts +0 -1
- package/types/components/lmvz-menuitem/lmvz-menuitem.d.ts +0 -1
- package/types/components/lmvz-message/lmvz-message.d.ts +0 -1
- package/types/components/lmvz-message/public.d.ts +0 -1
- package/types/components/lmvz-modal/lmvz-modal.d.ts +0 -1
- package/types/components/lmvz-modal/test/testing.d.ts +0 -1
- package/types/components/lmvz-popover/lmvz-popover.d.ts +2 -1
- package/types/components/lmvz-radio/lmvz-radio.d.ts +12 -3
- package/types/components/lmvz-select/lmvz-select.d.ts +53 -5
- package/types/components/lmvz-snackbar/lmvz-snackbar.d.ts +0 -1
- package/types/components/lmvz-snackbar/public.d.ts +0 -1
- package/types/components/lmvz-snackbar/snackbar-controller.d.ts +0 -1
- package/types/components/lmvz-spinner/lmvz-spinner.d.ts +0 -1
- package/types/components/lmvz-tab/lmvz-tab.d.ts +0 -1
- package/types/components/lmvz-tabs/lmvz-tabs.d.ts +0 -1
- package/types/components/lmvz-toggle/lmvz-toggle.d.ts +1 -1
- package/types/components.d.ts +312 -12
- package/types/index.d.ts +0 -1
- package/types/utils/aria/aria-validation-controller.d.ts +0 -1
- package/types/utils/aria/aria.constants.d.ts +1 -1
- package/types/utils/aria/directional-focus-controller.d.ts +0 -1
- package/types/utils/aria/element-activation-controller.d.ts +0 -1
- package/types/utils/aria/listbox-controller.d.ts +42 -0
- package/types/utils/async/async.util.d.ts +1 -2
- package/types/utils/data/event.util.d.ts +0 -1
- package/types/utils/data/number.util.d.ts +0 -1
- package/types/utils/data/object.util.d.ts +0 -1
- package/types/utils/data/time.util.d.ts +0 -1
- package/types/utils/element/element.util.d.ts +1 -1
- package/types/utils/environment.d.ts +0 -1
- package/types/utils/icons/icons-registry.d.ts +0 -1
- package/types/utils/icons/icons.d.ts +0 -1
- package/types/utils/icons/icons.unit.d.ts +0 -1
- package/types/utils/icons/public.d.ts +0 -1
- package/types/utils/public.d.ts +0 -1
- package/types/utils/radio/radio-group-controller.d.ts +3 -1
- package/types/utils/stencil/assets.d.ts +0 -1
- package/types/utils/stencil/reactive-controller-host.d.ts +0 -1
- package/types/utils/stencil/stencil.util.d.ts +0 -1
- package/components/p-DLUsBYJH.js +0 -1
- package/components/p-zMWemcoB.js +0 -1
- package/lmvz-components/p-194a3af5.entry.js +0 -1
- package/lmvz-components/p-46edf36f.entry.js +0 -1
- package/lmvz-components/p-5ff55ba9.entry.js +0 -1
- package/lmvz-components/p-888e04d7.entry.js +0 -1
- package/lmvz-components/p-9dc420e2.entry.js +0 -1
- package/lmvz-components/p-BFcYfHYq.js +0 -1
- package/lmvz-components/p-BuEA0MWd.js +0 -1
- package/lmvz-components/p-aaa7691c.entry.js +0 -1
- package/lmvz-components/p-b6dd045b.entry.js +0 -1
- package/lmvz-components/p-c3e62aba.entry.js +0 -1
- package/lmvz-components/p-d4154a65.entry.js +0 -1
- package/lmvz-components/p-e4ce63b3.entry.js +0 -1
- package/lmvz-components/p-eb4c5a6f.entry.js +0 -1
- package/lmvz-components/p-f42b16e6.entry.js +0 -1
- package/lmvz-components/p-fbf066d9.entry.js +0 -1
package/hydrate/index.mjs
CHANGED
|
@@ -5666,7 +5666,19 @@ const ariaAttributes = [
|
|
|
5666
5666
|
'aria-valuenow',
|
|
5667
5667
|
'aria-valuetext',
|
|
5668
5668
|
];
|
|
5669
|
+
const ariaHostMirrorAttributes = [
|
|
5670
|
+
'aria-haspopup',
|
|
5671
|
+
'aria-controls',
|
|
5672
|
+
'aria-expanded',
|
|
5673
|
+
'aria-activedescendant',
|
|
5674
|
+
'aria-autocomplete',
|
|
5675
|
+
];
|
|
5669
5676
|
|
|
5677
|
+
function isInputElement(element) {
|
|
5678
|
+
if (!element)
|
|
5679
|
+
return false;
|
|
5680
|
+
return ['INPUT', 'TEXTAREA', 'SELECT', 'LMVZ-INPUT', 'LMVZ-SELECT', 'LMVZ-DATEPICKER'].includes(element.tagName?.toUpperCase());
|
|
5681
|
+
}
|
|
5670
5682
|
function isActionButton(element) {
|
|
5671
5683
|
return ['LMVZ-BUTTON', 'BUTTON'].includes(element.tagName.toUpperCase());
|
|
5672
5684
|
}
|
|
@@ -5852,7 +5864,7 @@ function getLmvzComponentMetaInfo(el, key) {
|
|
|
5852
5864
|
function isFocusControllerHost(el) {
|
|
5853
5865
|
return Boolean(getLmvzComponentMetaInfo(el, 'isFocusControllerHost'));
|
|
5854
5866
|
}
|
|
5855
|
-
const defaultConfig = {
|
|
5867
|
+
const defaultConfig$1 = {
|
|
5856
5868
|
orientation: 'both',
|
|
5857
5869
|
enableHomeAndEnd: false,
|
|
5858
5870
|
manageTabIndex: false,
|
|
@@ -5865,7 +5877,7 @@ class DirectionalFocusController {
|
|
|
5865
5877
|
constructor(host, config = {}) {
|
|
5866
5878
|
this.host = host;
|
|
5867
5879
|
this.config = {
|
|
5868
|
-
...defaultConfig,
|
|
5880
|
+
...defaultConfig$1,
|
|
5869
5881
|
...config,
|
|
5870
5882
|
};
|
|
5871
5883
|
}
|
|
@@ -5894,6 +5906,8 @@ class DirectionalFocusController {
|
|
|
5894
5906
|
this.applyFocusTarget(element, true);
|
|
5895
5907
|
}
|
|
5896
5908
|
handleKeydown = (event) => {
|
|
5909
|
+
if (isInputElement(event.target))
|
|
5910
|
+
return;
|
|
5897
5911
|
const intent = this.getFocusIntent(event.key);
|
|
5898
5912
|
if (!intent)
|
|
5899
5913
|
return;
|
|
@@ -8781,7 +8795,7 @@ class LmvzCard {
|
|
|
8781
8795
|
|
|
8782
8796
|
const checkmarkSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTMuNzUgMTIuNTYyNUw4LjgzMDc5IDE3LjYyNUwyMC40Mzc1IDYuMzc1IiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjEuNzUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K';
|
|
8783
8797
|
|
|
8784
|
-
const lmvzCheckboxCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('RouterBook-Regular'), local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'); font-weight: 400; } @font-face { font-family: Router; src: local('RouterMedium-Regular'), local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'); font-weight: 500; } @font-face { font-family: Router; src: local('RouterBold-Regular'), local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'); font-weight: 700; } } .sc-lmvz-checkbox-h { display: inline-block; --checkbox-box-size: var(--lmvz-global-s18, 18px); --checkbox-border-radius: var(--lmvz-global-s4, 4px); --checkbox-bg: var(--lmvz-semantic-color-surface-input-primary, #ffffff); --checkbox-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); --checkbox-border-color-hover: var(--lmvz-semantic-color-border-hover, #a1a1a1); --checkbox-border-color-checked: var(--lmvz-semantic-color-border-active, #0f8acc); --checkbox-border-color-error: var(--lmvz-semantic-color-status-on-danger, #a31419); --checkbox-wrapper-bg-hover: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); --checkbox-wrapper-bg-checked: var(--lmvz-semantic-color-status-active, #f6fbfe); --checkbox-ripple-bg: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); --checkbox-checkmark-color: var(--lmvz-semantic-color-border-active, #0f8acc); --checkbox-label-color: var(--lmvz-semantic-color-on-surface-primary, #000000); --checkbox-label-color-checked: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --checkbox-helper-color: var(--lmvz-semantic-color-on-surface-secondary, #545454); --checkbox-error-color: var(--lmvz-semantic-color-status-on-danger, #a31419); --checkbox-focus-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --checkbox-easing: var(--lmvz-global-easing-default, ease); --checkbox-duration: 0.2s; } .pill.sc-lmvz-checkbox { display: flex; align-items: center; gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); padding-block: var(--lmvz-dimension-8-2, clamp(0.13rem, 0.03rem + 0.39vw, 0.5rem)); padding-inline: var(--lmvz-dimension-10-4, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); border-radius: var(--lmvz-semantic-border-radius-round, 999px); text-decoration: none; background-color: transparent; transition: background-color var(--checkbox-duration) var(--checkbox-easing); } input.sc-lmvz-checkbox { position: absolute; opacity: 0; width: var(--checkbox-box-size); height: var(--checkbox-box-size); margin: 0; cursor: pointer; z-index: 1; } .box.sc-lmvz-checkbox { display: flex; align-items: center; justify-content: center; width: var(--checkbox-box-size); height: var(--checkbox-box-size); background-color: var(--checkbox-bg); border: var(--lmvz-semantic-border-width-default, 1px) solid var(--checkbox-border-color); border-radius: var(--checkbox-border-radius); color: var(--checkbox-checkmark-color); cursor: pointer; transition: border-color var(--checkbox-duration) var(--checkbox-easing), background-color var(--checkbox-duration) var(--checkbox-easing); pointer-events: none; flex-shrink: 0; } .indicator.sc-lmvz-checkbox { display: flex; align-items: center; justify-content: center; line-height: 0; } .content.sc-lmvz-checkbox { display: flex; flex-direction: column; overflow-wrap: break-word; min-width: 0; cursor: pointer; } label.sc-lmvz-checkbox { font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.5 Router); color: var(--checkbox-label-color); transition: color var(--checkbox-duration) var(--checkbox-easing); cursor: pointer; } .helper-text.sc-lmvz-checkbox { font: var(--lmvz-typography-body-sm, 400 clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem) / 1.5 Router); color: var(--checkbox-helper-color); margin-block-start: 2px; } .error-text.sc-lmvz-checkbox { font: var(--lmvz-typography-body-sm, 400 clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem) / 1.5 Router); color: var(--checkbox-error-color); display: block; margin-block-start: 4px; padding-inline: 10px; } @media (hover: hover) { .pill.sc-lmvz-checkbox:hover { background-color: var(--checkbox-wrapper-bg-hover); } .pill.sc-lmvz-checkbox:hover .box.sc-lmvz-checkbox { border-color: var(--checkbox-border-color-hover); } } [checked].sc-lmvz-checkbox-h .pill.sc-lmvz-checkbox { background-color: var(--checkbox-wrapper-bg-checked); } [checked].sc-lmvz-checkbox-h .box.sc-lmvz-checkbox { border-color: var(--checkbox-border-color-checked); } [checked].sc-lmvz-checkbox-h label.sc-lmvz-checkbox { color: var(--checkbox-label-color-checked); } [error].sc-lmvz-checkbox-h .box.sc-lmvz-checkbox { border-color: var(--checkbox-border-color-error); } [error].sc-lmvz-checkbox-h .helper-text.sc-lmvz-checkbox { color: var(--checkbox-error-color); } [disabled].sc-lmvz-checkbox-h { opacity: var(--lmvz-component-input-disabled-opacity, 40%); pointer-events: none; input, label, .box, .content { cursor: not-allowed; } }
|
|
8798
|
+
const lmvzCheckboxCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('RouterBook-Regular'), local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'); font-weight: 400; } @font-face { font-family: Router; src: local('RouterMedium-Regular'), local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'); font-weight: 500; } @font-face { font-family: Router; src: local('RouterBold-Regular'), local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'); font-weight: 700; } } .sc-lmvz-checkbox-h { display: inline-block; --checkbox-box-size: var(--lmvz-global-s18, 18px); --checkbox-border-radius: var(--lmvz-global-s4, 4px); --checkbox-bg: var(--lmvz-semantic-color-surface-input-primary, #ffffff); --checkbox-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); --checkbox-border-color-hover: var(--lmvz-semantic-color-border-hover, #a1a1a1); --checkbox-border-color-checked: var(--lmvz-semantic-color-border-active, #0f8acc); --checkbox-border-color-error: var(--lmvz-semantic-color-status-on-danger, #a31419); --checkbox-wrapper-bg-hover: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); --checkbox-wrapper-bg-checked: var(--lmvz-semantic-color-status-active, #f6fbfe); --checkbox-ripple-bg: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); --checkbox-checkmark-color: var(--lmvz-semantic-color-border-active, #0f8acc); --checkbox-label-color: var(--lmvz-semantic-color-on-surface-primary, #000000); --checkbox-label-color-checked: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --checkbox-helper-color: var(--lmvz-semantic-color-on-surface-secondary, #545454); --checkbox-error-color: var(--lmvz-semantic-color-status-on-danger, #a31419); --checkbox-focus-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --checkbox-easing: var(--lmvz-global-easing-default, ease); --checkbox-duration: 0.2s; } .pill.sc-lmvz-checkbox { display: flex; align-items: center; gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); padding-block: var(--lmvz-dimension-8-2, clamp(0.13rem, 0.03rem + 0.39vw, 0.5rem)); padding-inline: var(--lmvz-dimension-10-4, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); border-radius: var(--lmvz-semantic-border-radius-round, 999px); text-decoration: none; background-color: transparent; transition: background-color var(--checkbox-duration) var(--checkbox-easing); } input.sc-lmvz-checkbox { position: absolute; opacity: 0; width: var(--checkbox-box-size); height: var(--checkbox-box-size); margin: 0; cursor: pointer; z-index: 1; appearance: none; } .box.sc-lmvz-checkbox { display: flex; align-items: center; justify-content: center; width: var(--checkbox-box-size); height: var(--checkbox-box-size); background-color: var(--checkbox-bg); border: var(--lmvz-semantic-border-width-default, 1px) solid var(--checkbox-border-color); border-radius: var(--checkbox-border-radius); color: var(--checkbox-checkmark-color); cursor: pointer; transition: border-color var(--checkbox-duration) var(--checkbox-easing), background-color var(--checkbox-duration) var(--checkbox-easing); pointer-events: none; flex-shrink: 0; } .indicator.sc-lmvz-checkbox { display: flex; align-items: center; justify-content: center; line-height: 0; } .content.sc-lmvz-checkbox { display: flex; flex-direction: column; overflow-wrap: break-word; min-width: 0; cursor: pointer; } label.sc-lmvz-checkbox { font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.5 Router); color: var(--checkbox-label-color); transition: color var(--checkbox-duration) var(--checkbox-easing); cursor: pointer; } .helper-text.sc-lmvz-checkbox { font: var(--lmvz-typography-body-sm, 400 clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem) / 1.5 Router); color: var(--checkbox-helper-color); margin-block-start: 2px; } .error-text.sc-lmvz-checkbox { font: var(--lmvz-typography-body-sm, 400 clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem) / 1.5 Router); color: var(--checkbox-error-color); display: block; margin-block-start: 4px; padding-inline: 10px; } @media (hover: hover) { .pill.sc-lmvz-checkbox:hover { background-color: var(--checkbox-wrapper-bg-hover); } .pill.sc-lmvz-checkbox:hover .box.sc-lmvz-checkbox { border-color: var(--checkbox-border-color-hover); } } [checked].sc-lmvz-checkbox-h .pill.sc-lmvz-checkbox { background-color: var(--checkbox-wrapper-bg-checked); } [checked].sc-lmvz-checkbox-h .box.sc-lmvz-checkbox { border-color: var(--checkbox-border-color-checked); } [checked].sc-lmvz-checkbox-h label.sc-lmvz-checkbox { color: var(--checkbox-label-color-checked); } [error].sc-lmvz-checkbox-h .box.sc-lmvz-checkbox { border-color: var(--checkbox-border-color-error); } [error].sc-lmvz-checkbox-h .helper-text.sc-lmvz-checkbox { color: var(--checkbox-error-color); } [disabled].sc-lmvz-checkbox-h { opacity: var(--lmvz-component-input-disabled-opacity, 40%); pointer-events: none; input, label, .box, .content { cursor: not-allowed; } } .sc-lmvz-checkbox-h:has(:focus-visible) .pill.sc-lmvz-checkbox { outline: var(--lmvz-ds-outline, 1px solid #0e7ab4); outline-offset: var(--lmvz-ds-outline-offset, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)); } @media (forced-colors: active) { .box.sc-lmvz-checkbox { forced-color-adjust: auto; border-color: ButtonText; background-color: Field; } [checked].sc-lmvz-checkbox-h .box.sc-lmvz-checkbox { border-color: Highlight; background-color: Field; } .indicator.sc-lmvz-checkbox { color: ButtonText; } [checked].sc-lmvz-checkbox-h .indicator.sc-lmvz-checkbox { color: HighlightText; } .sc-lmvz-checkbox-h:has(:focus-visible) .pill.sc-lmvz-checkbox { outline-color: Highlight; box-shadow: none; } }`;
|
|
8785
8799
|
|
|
8786
8800
|
const CHECKMARK_SVG = toValidSvgStringWithFallback(checkmarkSvg);
|
|
8787
8801
|
let checkboxIdCounter = 0;
|
|
@@ -8810,7 +8824,14 @@ class LmvzCheckbox extends ReactiveControllerHost {
|
|
|
8810
8824
|
name;
|
|
8811
8825
|
disabled = false;
|
|
8812
8826
|
required = false;
|
|
8813
|
-
|
|
8827
|
+
nativeError = false;
|
|
8828
|
+
errorFromProp = false;
|
|
8829
|
+
get error() {
|
|
8830
|
+
return this.errorFromProp || this.nativeError;
|
|
8831
|
+
}
|
|
8832
|
+
set error(value) {
|
|
8833
|
+
this.errorFromProp = value;
|
|
8834
|
+
}
|
|
8814
8835
|
errorMessage;
|
|
8815
8836
|
helperText;
|
|
8816
8837
|
form;
|
|
@@ -8819,6 +8840,10 @@ class LmvzCheckbox extends ReactiveControllerHost {
|
|
|
8819
8840
|
handleCheckedChange(val) {
|
|
8820
8841
|
this.checkedState = val;
|
|
8821
8842
|
this.internals.setFormValue?.(val ? (this.value ?? 'on') : null);
|
|
8843
|
+
this.updateValidity();
|
|
8844
|
+
}
|
|
8845
|
+
handleRequiredChange() {
|
|
8846
|
+
this.updateValidity();
|
|
8822
8847
|
}
|
|
8823
8848
|
lmvzChange;
|
|
8824
8849
|
async focusInput() {
|
|
@@ -8830,6 +8855,9 @@ class LmvzCheckbox extends ReactiveControllerHost {
|
|
|
8830
8855
|
async reportValidity() {
|
|
8831
8856
|
return this.internals?.reportValidity() ?? true;
|
|
8832
8857
|
}
|
|
8858
|
+
async getValidationMessage() {
|
|
8859
|
+
return this.internals?.validationMessage ?? '';
|
|
8860
|
+
}
|
|
8833
8861
|
constructor(hostRef) {
|
|
8834
8862
|
super();
|
|
8835
8863
|
registerInstance(this, hostRef);
|
|
@@ -8849,10 +8877,15 @@ class LmvzCheckbox extends ReactiveControllerHost {
|
|
|
8849
8877
|
this.initialChecked = this.checked;
|
|
8850
8878
|
this.checkedState = this.checked;
|
|
8851
8879
|
this.internals.setFormValue?.(this.checked ? (this.value ?? 'on') : null);
|
|
8880
|
+
this.updateValidity();
|
|
8852
8881
|
super.componentWillLoad();
|
|
8853
8882
|
}
|
|
8883
|
+
componentDidLoad() {
|
|
8884
|
+
this.updateValidity();
|
|
8885
|
+
super.componentDidLoad();
|
|
8886
|
+
}
|
|
8854
8887
|
componentWillRender() {
|
|
8855
|
-
if (this.
|
|
8888
|
+
if (this.errorFromProp && !this.errorMessage) {
|
|
8856
8889
|
console.warn('lmvz-checkbox: error=true set without errorMessage — no visual-only error state is rendered. Provide errorMessage to communicate the error to users.');
|
|
8857
8890
|
}
|
|
8858
8891
|
super.componentWillRender();
|
|
@@ -8862,6 +8895,7 @@ class LmvzCheckbox extends ReactiveControllerHost {
|
|
|
8862
8895
|
}
|
|
8863
8896
|
formResetCallback() {
|
|
8864
8897
|
this.checked = this.initialChecked;
|
|
8898
|
+
this.updateValidity();
|
|
8865
8899
|
}
|
|
8866
8900
|
formStateRestoreCallback(state) {
|
|
8867
8901
|
this.checked = state === (this.value ?? 'on');
|
|
@@ -8874,13 +8908,27 @@ class LmvzCheckbox extends ReactiveControllerHost {
|
|
|
8874
8908
|
retargetInnerClicks() {
|
|
8875
8909
|
this.nativeInput?.click();
|
|
8876
8910
|
}
|
|
8911
|
+
updateValidity() {
|
|
8912
|
+
if (this.required && !this.checked) {
|
|
8913
|
+
this.internals.setValidity?.({ valueMissing: true }, 'Please check this box.', this.nativeInput);
|
|
8914
|
+
return;
|
|
8915
|
+
}
|
|
8916
|
+
this.internals.setValidity?.({});
|
|
8917
|
+
this.nativeError = false;
|
|
8918
|
+
}
|
|
8919
|
+
handleInvalid() {
|
|
8920
|
+
this.nativeError = true;
|
|
8921
|
+
}
|
|
8877
8922
|
render() {
|
|
8878
|
-
return (hAsync(Host, { key: '
|
|
8923
|
+
return (hAsync(Host, { key: '089b23f8034fa089f358cc37923182c34f528cd2' }, hAsync("div", { key: '0af011ebf062332c330b49fa3076828204433ac4', class: "pill" }, hAsync("input", { key: 'a483a8c5bbe1d6da3cfab63ce32ad2e6392911ff', type: "checkbox", id: this.checkboxId, checked: this.checkedState, disabled: this.disabled, "aria-required": this.required ? 'true' : 'false', "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": this.ariaDescribedBy, "aria-errormessage": this.error && this.errorId ? this.errorId : undefined, ref: (el) => (this.nativeInput = el), onChange: this.handleChange, autoFocus: this.autofocus }), hAsync("span", { key: 'f21d34ab625c7eef23bd2761b399e8770cd62275', class: "box", "aria-hidden": "true" }, this.checkedState && hAsync("span", { key: 'de2680ea17f34ab0124c529d88d4191c97d0a4c5', class: "indicator", innerHTML: CHECKMARK_SVG })), hAsync("span", { key: '1b2d24e43603033a5a77340164e002de326db11a', class: "content" }, hAsync("label", { key: 'b18f17abb4459b3783dc41d0031f4b26795fdcf5', htmlFor: this.checkboxId }, this.label), this.helperText && (hAsync("span", { key: 'f32591c55fcc88d130815780a9999fcb235afd88', onClick: this.retargetInnerClicks.bind(this), class: "helper-text", id: this.helperId, role: "status" }, this.helperText)))), this.errorMessage && (hAsync("span", { key: '076489f5baadab07d95fc787e9ac71bae0a6ab68', onClick: this.retargetInnerClicks.bind(this), class: "error-text", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
8879
8924
|
}
|
|
8880
8925
|
static get formAssociated() { return true; }
|
|
8881
8926
|
static get watchers() { return {
|
|
8882
8927
|
"checked": [{
|
|
8883
8928
|
"handleCheckedChange": 0
|
|
8929
|
+
}],
|
|
8930
|
+
"required": [{
|
|
8931
|
+
"handleRequiredChange": 0
|
|
8884
8932
|
}]
|
|
8885
8933
|
}; }
|
|
8886
8934
|
static get style() { return lmvzCheckboxCss(); }
|
|
@@ -8891,22 +8939,24 @@ class LmvzCheckbox extends ReactiveControllerHost {
|
|
|
8891
8939
|
"label": [1],
|
|
8892
8940
|
"checked": [1540],
|
|
8893
8941
|
"value": [1],
|
|
8894
|
-
"name": [
|
|
8942
|
+
"name": [513],
|
|
8895
8943
|
"disabled": [516],
|
|
8896
8944
|
"required": [516],
|
|
8897
|
-
"error": [
|
|
8945
|
+
"error": [6660],
|
|
8898
8946
|
"errorMessage": [1, "error-message"],
|
|
8899
8947
|
"helperText": [1, "helper-text"],
|
|
8900
8948
|
"form": [1],
|
|
8901
8949
|
"autofocus": [4],
|
|
8950
|
+
"nativeError": [32],
|
|
8902
8951
|
"checkedState": [32],
|
|
8903
8952
|
"focusInput": [64],
|
|
8904
8953
|
"checkValidity": [64],
|
|
8905
|
-
"reportValidity": [64]
|
|
8954
|
+
"reportValidity": [64],
|
|
8955
|
+
"getValidationMessage": [64]
|
|
8906
8956
|
},
|
|
8907
|
-
"$listeners$":
|
|
8957
|
+
"$listeners$": [[0, "invalid", "handleInvalid"]],
|
|
8908
8958
|
"$lazyBundleId$": "-",
|
|
8909
|
-
"$attrsToReflect$": [["checked", "checked"], ["disabled", "disabled"], ["required", "required"], ["error", "error"]]
|
|
8959
|
+
"$attrsToReflect$": [["checked", "checked"], ["name", "name"], ["disabled", "disabled"], ["required", "required"], ["error", "error"]]
|
|
8910
8960
|
}; }
|
|
8911
8961
|
}
|
|
8912
8962
|
|
|
@@ -8986,12 +9036,2806 @@ class LmvzChip extends ReactiveControllerHost {
|
|
|
8986
9036
|
"$flags$": 777,
|
|
8987
9037
|
"$tagName$": "lmvz-chip",
|
|
8988
9038
|
"$members$": {
|
|
8989
|
-
"type": [1537],
|
|
8990
|
-
"size": [1537]
|
|
9039
|
+
"type": [1537],
|
|
9040
|
+
"size": [1537]
|
|
9041
|
+
},
|
|
9042
|
+
"$listeners$": undefined,
|
|
9043
|
+
"$lazyBundleId$": "-",
|
|
9044
|
+
"$attrsToReflect$": [["type", "type"], ["size", "size"]]
|
|
9045
|
+
}; }
|
|
9046
|
+
}
|
|
9047
|
+
|
|
9048
|
+
// Low-Level
|
|
9049
|
+
const expectedPositive = (entityName, num) => `Non-positive ${entityName}: ${num}`;
|
|
9050
|
+
const expectedFinite = (entityName, num) => `Non-finite ${entityName}: ${num}`;
|
|
9051
|
+
const forbiddenBigIntToNumber = (entityName) => `Cannot convert bigint to ${entityName}`;
|
|
9052
|
+
const invalidObject = 'Invalid object';
|
|
9053
|
+
const numberOutOfRange = (entityName, val, min, max) => invalidEntity$1(entityName, val) + `; must be between ${min}-${max}`;
|
|
9054
|
+
// Entity/Fields/Bags
|
|
9055
|
+
const invalidEntity$1 = (fieldName, val) => `Invalid ${fieldName}: ${val}`;
|
|
9056
|
+
|
|
9057
|
+
const nanoInMicro$1 = 1_000;
|
|
9058
|
+
const nanoInMilli$1 = 1_000_000;
|
|
9059
|
+
const nanoInSec$1 = 1_000_000_000;
|
|
9060
|
+
const nanoInMinute$1 = 60_000_000_000;
|
|
9061
|
+
const nanoInHour$1 = 3_600_000_000_000;
|
|
9062
|
+
function normalizeOptions(options) {
|
|
9063
|
+
if (options === undefined) {
|
|
9064
|
+
return Object.create(null);
|
|
9065
|
+
}
|
|
9066
|
+
return requireObjectLike(options);
|
|
9067
|
+
}
|
|
9068
|
+
function toFiniteNumber(arg, entityName = 'number') {
|
|
9069
|
+
if (typeof arg === 'bigint') {
|
|
9070
|
+
throw new TypeError(forbiddenBigIntToNumber(entityName));
|
|
9071
|
+
}
|
|
9072
|
+
arg = Number(arg);
|
|
9073
|
+
if (!Number.isFinite(arg)) {
|
|
9074
|
+
throw new RangeError(expectedFinite(entityName, arg));
|
|
9075
|
+
}
|
|
9076
|
+
return arg;
|
|
9077
|
+
}
|
|
9078
|
+
function toIntegerWithTrunc(arg, entityName) {
|
|
9079
|
+
return Math.trunc(toFiniteNumber(arg, entityName)) || 0; // ensure no -0
|
|
9080
|
+
}
|
|
9081
|
+
function toPositiveIntegerWithTruncation(arg, entityName) {
|
|
9082
|
+
return requireNumberIsPositive(toIntegerWithTrunc(arg, entityName), entityName);
|
|
9083
|
+
}
|
|
9084
|
+
/*
|
|
9085
|
+
Already known to be number.
|
|
9086
|
+
*/
|
|
9087
|
+
function requireNumberIsPositive(num, entityName = 'number') {
|
|
9088
|
+
if (num <= 0) {
|
|
9089
|
+
throw new RangeError(expectedPositive(entityName, num));
|
|
9090
|
+
}
|
|
9091
|
+
return num;
|
|
9092
|
+
}
|
|
9093
|
+
/*
|
|
9094
|
+
min/max are inclusive
|
|
9095
|
+
*/
|
|
9096
|
+
function constrainToRange$1(num, min, max) {
|
|
9097
|
+
return Math.min(Math.max(num, min), max);
|
|
9098
|
+
}
|
|
9099
|
+
function isObjectLike(arg) {
|
|
9100
|
+
return arg !== null && (typeof arg === 'object' || typeof arg === 'function');
|
|
9101
|
+
}
|
|
9102
|
+
function requireObjectLike(arg) {
|
|
9103
|
+
if (!isObjectLike(arg)) {
|
|
9104
|
+
throw new TypeError(invalidObject);
|
|
9105
|
+
}
|
|
9106
|
+
return arg;
|
|
9107
|
+
}
|
|
9108
|
+
|
|
9109
|
+
const invalidEntity = invalidEntity$1;
|
|
9110
|
+
|
|
9111
|
+
const missingField = fieldName => `Missing ${fieldName}`;
|
|
9112
|
+
|
|
9113
|
+
const noValidFields = validFields => "No valid fields: " + validFields.join();
|
|
9114
|
+
|
|
9115
|
+
const invalidChoice = (fieldName, val, choiceMap) => invalidEntity$1(fieldName, val) + "; must be " + Object.keys(choiceMap).join();
|
|
9116
|
+
|
|
9117
|
+
const forbiddenValueOf$1 = "Cannot use valueOf";
|
|
9118
|
+
|
|
9119
|
+
const invalidCallingContext = "Invalid calling context";
|
|
9120
|
+
|
|
9121
|
+
const missingYear = allowEra => "Missing year" + (allowEra ? "/era/eraYear" : "");
|
|
9122
|
+
|
|
9123
|
+
const invalidLeapMonth = "Invalid leap month";
|
|
9124
|
+
|
|
9125
|
+
const exoticCalendarRequired = (calendarId, remedy) => `Unknown calendar ${calendarId}; might need ${remedy}`;
|
|
9126
|
+
|
|
9127
|
+
const invalidTimeZone = calendarId => invalidEntity$1("TimeZone", calendarId);
|
|
9128
|
+
|
|
9129
|
+
const outOfBoundsDate = "Out-of-bounds date";
|
|
9130
|
+
|
|
9131
|
+
const failedParse = s => `Cannot parse: ${s}`;
|
|
9132
|
+
|
|
9133
|
+
const invalidSubstring = substring => `Invalid substring: ${substring}`;
|
|
9134
|
+
|
|
9135
|
+
const constrainToRange = constrainToRange$1;
|
|
9136
|
+
|
|
9137
|
+
function throwRangeError(message) {
|
|
9138
|
+
throw new RangeError(message);
|
|
9139
|
+
}
|
|
9140
|
+
|
|
9141
|
+
function throwTypeError(message) {
|
|
9142
|
+
throw new TypeError(message);
|
|
9143
|
+
}
|
|
9144
|
+
|
|
9145
|
+
function clampProp(props, propName, min, max, overflow) {
|
|
9146
|
+
return clampEntity(propName, ((props, propName) => {
|
|
9147
|
+
const propVal = props[propName];
|
|
9148
|
+
return void 0 === propVal && throwTypeError(missingField(propName)), propVal;
|
|
9149
|
+
})(props, propName), min, max, overflow);
|
|
9150
|
+
}
|
|
9151
|
+
|
|
9152
|
+
function clampEntity(entityName, num, min, max, overflow, choices) {
|
|
9153
|
+
const clamped = constrainToRange(num, min, max);
|
|
9154
|
+
return overflow && num !== clamped && throwRangeError(((entityName, val, min, max, choices) => numberOutOfRange(entityName, val, min, max))(entityName, num, min, max)),
|
|
9155
|
+
clamped;
|
|
9156
|
+
}
|
|
9157
|
+
|
|
9158
|
+
function memoize(generator, MapClass = Map) {
|
|
9159
|
+
const map = new MapClass;
|
|
9160
|
+
return (key, ...otherArgs) => {
|
|
9161
|
+
if (map.has(key)) {
|
|
9162
|
+
return map.get(key);
|
|
9163
|
+
}
|
|
9164
|
+
const val = generator(key, ...otherArgs);
|
|
9165
|
+
return map.set(key, val), val;
|
|
9166
|
+
};
|
|
9167
|
+
}
|
|
9168
|
+
|
|
9169
|
+
const createNameDescriptors = name => createPropDescriptors({
|
|
9170
|
+
name: name
|
|
9171
|
+
});
|
|
9172
|
+
|
|
9173
|
+
const createPropDescriptors = (propVals, readonly) => mapProps(value => ({
|
|
9174
|
+
value: value,
|
|
9175
|
+
configurable: 1,
|
|
9176
|
+
writable: false
|
|
9177
|
+
}), propVals);
|
|
9178
|
+
|
|
9179
|
+
const createStringTagDescriptors = value => ({
|
|
9180
|
+
[Symbol.toStringTag]: {
|
|
9181
|
+
value: value,
|
|
9182
|
+
configurable: 1
|
|
9183
|
+
}
|
|
9184
|
+
});
|
|
9185
|
+
|
|
9186
|
+
function mapProps(transformer, props) {
|
|
9187
|
+
const res = {};
|
|
9188
|
+
for (const propName in props) {
|
|
9189
|
+
res[propName] = transformer(props[propName], propName);
|
|
9190
|
+
}
|
|
9191
|
+
return res;
|
|
9192
|
+
}
|
|
9193
|
+
|
|
9194
|
+
function zipPropsConst(propNames, propVal) {
|
|
9195
|
+
const res = {};
|
|
9196
|
+
for (const propName of propNames) {
|
|
9197
|
+
res[propName] = propVal;
|
|
9198
|
+
}
|
|
9199
|
+
return res;
|
|
9200
|
+
}
|
|
9201
|
+
|
|
9202
|
+
function createPropGetters(propNames) {
|
|
9203
|
+
const getters = {};
|
|
9204
|
+
for (const propName of propNames) {
|
|
9205
|
+
getters[propName] = slots => slots[propName];
|
|
9206
|
+
}
|
|
9207
|
+
return getters;
|
|
9208
|
+
}
|
|
9209
|
+
|
|
9210
|
+
function pluckProps(propNames, props, dest = Object.create(null)) {
|
|
9211
|
+
for (const propName of propNames) {
|
|
9212
|
+
dest[propName] = props[propName];
|
|
9213
|
+
}
|
|
9214
|
+
return dest;
|
|
9215
|
+
}
|
|
9216
|
+
|
|
9217
|
+
function bindArgs(f, ...boundArgs) {
|
|
9218
|
+
return (...dynamicArgs) => f(...boundArgs, ...dynamicArgs);
|
|
9219
|
+
}
|
|
9220
|
+
|
|
9221
|
+
function noop() {}
|
|
9222
|
+
|
|
9223
|
+
function capitalize(s) {
|
|
9224
|
+
return s[0].toUpperCase() + s.substring(1);
|
|
9225
|
+
}
|
|
9226
|
+
|
|
9227
|
+
function sortStrings(...strss) {
|
|
9228
|
+
return [].concat(...strss).sort();
|
|
9229
|
+
}
|
|
9230
|
+
|
|
9231
|
+
function createRegExp(meat) {
|
|
9232
|
+
return new RegExp(`^${meat}$`, "i");
|
|
9233
|
+
}
|
|
9234
|
+
|
|
9235
|
+
function parseSubsecNano(fracStr) {
|
|
9236
|
+
return parseInt(fracStr.padEnd(9, "0"));
|
|
9237
|
+
}
|
|
9238
|
+
|
|
9239
|
+
function parseSign(s) {
|
|
9240
|
+
return s && "+" !== s ? -1 : 1;
|
|
9241
|
+
}
|
|
9242
|
+
|
|
9243
|
+
function parseInt0(s) {
|
|
9244
|
+
return void 0 === s ? 0 : parseInt(s);
|
|
9245
|
+
}
|
|
9246
|
+
|
|
9247
|
+
function padNumber(digits, num) {
|
|
9248
|
+
return String(num).padStart(digits, "0");
|
|
9249
|
+
}
|
|
9250
|
+
|
|
9251
|
+
const padNumber2 = /*@__PURE__*/ bindArgs(padNumber, 2);
|
|
9252
|
+
|
|
9253
|
+
function compareNumbers(a, b) {
|
|
9254
|
+
return Math.sign(a - b);
|
|
9255
|
+
}
|
|
9256
|
+
|
|
9257
|
+
function divFloorBigInt(num, denom) {
|
|
9258
|
+
const whole = num / denom;
|
|
9259
|
+
return num % denom < 0n ? whole - 1n : whole;
|
|
9260
|
+
}
|
|
9261
|
+
|
|
9262
|
+
function divModFloorBigInt(num, divisor) {
|
|
9263
|
+
const quotient = divFloorBigInt(num, divisor);
|
|
9264
|
+
return [ quotient, num - quotient * divisor ];
|
|
9265
|
+
}
|
|
9266
|
+
|
|
9267
|
+
function divModFloor(num, divisor) {
|
|
9268
|
+
return [ Math.floor(num / divisor), modFloor(num, divisor) ];
|
|
9269
|
+
}
|
|
9270
|
+
|
|
9271
|
+
function modFloor(num, divisor) {
|
|
9272
|
+
return (num % divisor + divisor) % divisor;
|
|
9273
|
+
}
|
|
9274
|
+
|
|
9275
|
+
function divTrunc(num, divisor) {
|
|
9276
|
+
return Math.trunc(num / divisor) || 0;
|
|
9277
|
+
}
|
|
9278
|
+
|
|
9279
|
+
function modTrunc(num, divisor) {
|
|
9280
|
+
return num % divisor || 0;
|
|
9281
|
+
}
|
|
9282
|
+
|
|
9283
|
+
const isoCalendarId = "iso8601";
|
|
9284
|
+
|
|
9285
|
+
const gregoryCalendarId = "gregory";
|
|
9286
|
+
|
|
9287
|
+
const gregoryEraOrigins = {
|
|
9288
|
+
"bce": -1,
|
|
9289
|
+
"ce": 0
|
|
9290
|
+
};
|
|
9291
|
+
|
|
9292
|
+
function normalizeEraName(era) {
|
|
9293
|
+
const normalized = era.normalize("NFD").toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
9294
|
+
return "bc" === normalized || "b" === normalized ? "bce" : "ad" === normalized || "a" === normalized ? "ce" : normalized;
|
|
9295
|
+
}
|
|
9296
|
+
|
|
9297
|
+
const isoCalendarImpl = void 0;
|
|
9298
|
+
|
|
9299
|
+
const gregoryCalendarImpl = 0;
|
|
9300
|
+
|
|
9301
|
+
function getCalendarSlotId(calendar) {
|
|
9302
|
+
return calendar === isoCalendarImpl ? "iso8601" : 0 === calendar ? "gregory" : calendar.id;
|
|
9303
|
+
}
|
|
9304
|
+
|
|
9305
|
+
const monthCodeRegExp = /^M(\d{2})(L?)$/;
|
|
9306
|
+
|
|
9307
|
+
function parseMonthCode(monthCode) {
|
|
9308
|
+
const m = monthCodeRegExp.exec(monthCode);
|
|
9309
|
+
return m || throwRangeError((monthCode => `Invalid monthCode: ${monthCode}`)(monthCode)),
|
|
9310
|
+
[ parseInt(m[1]), Boolean(m[2]) ];
|
|
9311
|
+
}
|
|
9312
|
+
|
|
9313
|
+
function formatMonthCode(monthCodeNumber, isLeapMonth) {
|
|
9314
|
+
return "M" + padNumber2(monthCodeNumber) + (isLeapMonth ? "L" : "");
|
|
9315
|
+
}
|
|
9316
|
+
|
|
9317
|
+
function monthCodeNumberToMonth(monthCodeNumber, isLeapMonth, leapMonth) {
|
|
9318
|
+
return monthCodeNumber + (isLeapMonth || leapMonth && monthCodeNumber >= leapMonth ? 1 : 0);
|
|
9319
|
+
}
|
|
9320
|
+
|
|
9321
|
+
const unitNameMap = {
|
|
9322
|
+
nanosecond: 0,
|
|
9323
|
+
microsecond: 1,
|
|
9324
|
+
millisecond: 2,
|
|
9325
|
+
second: 3,
|
|
9326
|
+
minute: 4,
|
|
9327
|
+
hour: 5,
|
|
9328
|
+
day: 6,
|
|
9329
|
+
week: 7,
|
|
9330
|
+
month: 8,
|
|
9331
|
+
year: 9
|
|
9332
|
+
};
|
|
9333
|
+
|
|
9334
|
+
const unitNamesAsc = /*@__PURE__*/ Object.keys(unitNameMap);
|
|
9335
|
+
|
|
9336
|
+
const nanoInMicro = nanoInMicro$1;
|
|
9337
|
+
|
|
9338
|
+
const nanoInMilli = nanoInMilli$1;
|
|
9339
|
+
|
|
9340
|
+
const nanoInSec = nanoInSec$1;
|
|
9341
|
+
|
|
9342
|
+
const nanoInMinute = nanoInMinute$1;
|
|
9343
|
+
|
|
9344
|
+
const nanoInHour = nanoInHour$1;
|
|
9345
|
+
|
|
9346
|
+
const nanoInUtcDay = 864e11;
|
|
9347
|
+
|
|
9348
|
+
const bigNanoInMicro = /*@__PURE__*/ BigInt(nanoInMicro);
|
|
9349
|
+
|
|
9350
|
+
const bigNanoInMilli = /*@__PURE__*/ BigInt(nanoInMilli);
|
|
9351
|
+
|
|
9352
|
+
const bigNanoInSec = /*@__PURE__*/ BigInt(nanoInSec);
|
|
9353
|
+
|
|
9354
|
+
const bigNanoInMinute = /*@__PURE__*/ BigInt(nanoInMinute);
|
|
9355
|
+
|
|
9356
|
+
const bigNanoInHour = /*@__PURE__*/ BigInt(nanoInHour);
|
|
9357
|
+
|
|
9358
|
+
const bigNanoInUtcDay = /*@__PURE__*/ BigInt(nanoInUtcDay);
|
|
9359
|
+
|
|
9360
|
+
const timeFieldNamesAsc = /*@__PURE__*/ unitNamesAsc.slice(0, 6);
|
|
9361
|
+
|
|
9362
|
+
const yearFieldNamesAsc = [ "year" ];
|
|
9363
|
+
|
|
9364
|
+
const dayFieldNamesAsc = [ "day" ];
|
|
9365
|
+
|
|
9366
|
+
const calendarDateFieldNamesAsc = [ "day", "month", "year" ];
|
|
9367
|
+
|
|
9368
|
+
const eraYearFieldNames = [ "era", "eraYear" ];
|
|
9369
|
+
|
|
9370
|
+
const allYearFieldNames = [ "era", "eraYear", "year" ];
|
|
9371
|
+
|
|
9372
|
+
const monthFieldNames = [ "month", "monthCode" ];
|
|
9373
|
+
|
|
9374
|
+
const monthDayFieldNames = [ "day", "month", "monthCode" ];
|
|
9375
|
+
|
|
9376
|
+
const yearMonthFieldNamesAlpha = /*@__PURE__*/ sortStrings(monthFieldNames, yearFieldNamesAsc);
|
|
9377
|
+
|
|
9378
|
+
const yearMonthCodeFieldNamesAlpha = /*@__PURE__*/ sortStrings([ "monthCode" ], yearFieldNamesAsc);
|
|
9379
|
+
|
|
9380
|
+
const yearMonthCodeFieldNamesWithEraAlpha = /*@__PURE__*/ sortStrings(eraYearFieldNames, yearMonthCodeFieldNamesAlpha);
|
|
9381
|
+
|
|
9382
|
+
const dateFieldNamesAlpha = /*@__PURE__*/ sortStrings(dayFieldNamesAsc, yearMonthFieldNamesAlpha);
|
|
9383
|
+
|
|
9384
|
+
const dateFieldNamesWithEraAlpha = /*@__PURE__*/ sortStrings(dayFieldNamesAsc, eraYearFieldNames, yearMonthFieldNamesAlpha);
|
|
9385
|
+
|
|
9386
|
+
const yearMonthCodeDayFieldNamesAlpha = /*@__PURE__*/ sortStrings(dayFieldNamesAsc, yearMonthCodeFieldNamesAlpha);
|
|
9387
|
+
|
|
9388
|
+
const yearMonthCodeDayFieldNamesWithEraAlpha = /*@__PURE__*/ sortStrings(dayFieldNamesAsc, eraYearFieldNames, yearMonthCodeFieldNamesAlpha);
|
|
9389
|
+
|
|
9390
|
+
function validateTimeFields(timeFields) {
|
|
9391
|
+
return constrainTimeFields(timeFields, 1), timeFields;
|
|
9392
|
+
}
|
|
9393
|
+
|
|
9394
|
+
const maxValues = {
|
|
9395
|
+
hour: 23,
|
|
9396
|
+
minute: 59,
|
|
9397
|
+
second: 59
|
|
9398
|
+
};
|
|
9399
|
+
|
|
9400
|
+
function constrainTimeFields(timeFields, overflow) {
|
|
9401
|
+
const constrainedFields = {};
|
|
9402
|
+
for (const fieldName of timeFieldNamesAsc) {
|
|
9403
|
+
constrainedFields[fieldName] = clampEntity(fieldName, timeFields[fieldName], 0, maxValues[fieldName] || 999, overflow);
|
|
9404
|
+
}
|
|
9405
|
+
return constrainedFields;
|
|
9406
|
+
}
|
|
9407
|
+
|
|
9408
|
+
function timeFieldsToNano(timeFields) {
|
|
9409
|
+
return timeFieldsToSec(timeFields) * nanoInSec + timeFieldsToSubsecNano(timeFields);
|
|
9410
|
+
}
|
|
9411
|
+
|
|
9412
|
+
function timeFieldsToSec(timeFields) {
|
|
9413
|
+
return 3600 * timeFields.hour + 60 * timeFields.minute + timeFields.second;
|
|
9414
|
+
}
|
|
9415
|
+
|
|
9416
|
+
function timeFieldsToSubsecNano(timeFields) {
|
|
9417
|
+
return timeFields.millisecond * nanoInMilli + timeFields.microsecond * nanoInMicro + timeFields.nanosecond;
|
|
9418
|
+
}
|
|
9419
|
+
|
|
9420
|
+
function nanoToTimeAndDay(nano) {
|
|
9421
|
+
const [dayDelta, timeNano] = divModFloor(nano, nanoInUtcDay);
|
|
9422
|
+
return [ nanoToTimeFields(timeNano), dayDelta ];
|
|
9423
|
+
}
|
|
9424
|
+
|
|
9425
|
+
function nanoToTimeFields(timeNano) {
|
|
9426
|
+
const [timeMilli, nanoAfterMilli] = divModFloor(timeNano, nanoInMilli);
|
|
9427
|
+
const [microsecond, nanosecond] = divModFloor(nanoAfterMilli, nanoInMicro);
|
|
9428
|
+
return milliToTimeFields(timeMilli, microsecond, nanosecond);
|
|
9429
|
+
}
|
|
9430
|
+
|
|
9431
|
+
function milliToTimeFields(timeMilli, microsecond = 0, nanosecond = 0) {
|
|
9432
|
+
const [hour, milliAfterHour] = divModFloor(timeMilli, 36e5);
|
|
9433
|
+
const [minute, milliAfterMinute] = divModFloor(milliAfterHour, 6e4);
|
|
9434
|
+
const [second, millisecond] = divModFloor(milliAfterMinute, 1e3);
|
|
9435
|
+
return {
|
|
9436
|
+
hour: hour,
|
|
9437
|
+
minute: minute,
|
|
9438
|
+
second: second,
|
|
9439
|
+
millisecond: millisecond,
|
|
9440
|
+
microsecond: microsecond,
|
|
9441
|
+
nanosecond: nanosecond
|
|
9442
|
+
};
|
|
9443
|
+
}
|
|
9444
|
+
|
|
9445
|
+
function epochNanoToSecMod(epochNano) {
|
|
9446
|
+
const [epochSec, nano] = divModFloorBigInt(epochNano, bigNanoInSec);
|
|
9447
|
+
return [ Number(epochSec), Number(nano) ];
|
|
9448
|
+
}
|
|
9449
|
+
|
|
9450
|
+
function isoDateToEpochNano(isoDate) {
|
|
9451
|
+
return BigInt(isoDateToEpochDays(isoDate)) * bigNanoInUtcDay;
|
|
9452
|
+
}
|
|
9453
|
+
|
|
9454
|
+
function isoDateToEpochMilli(isoDate) {
|
|
9455
|
+
return 864e5 * isoDateToEpochDays(isoDate);
|
|
9456
|
+
}
|
|
9457
|
+
|
|
9458
|
+
function isoDateToEpochDays(isoDate) {
|
|
9459
|
+
return isoArgsToEpochDays(isoDate.year, isoDate.month, isoDate.day);
|
|
9460
|
+
}
|
|
9461
|
+
|
|
9462
|
+
function isoArgsToEpochDays(isoYear, isoMonth = 1, isoDay = 1) {
|
|
9463
|
+
const monthIndex = isoMonth - 1;
|
|
9464
|
+
return isoYear += Math.floor(monthIndex / 12), isoMonth = modFloor(monthIndex, 12),
|
|
9465
|
+
Date.UTC(isoYear % 400 - 400, isoMonth, 0) / 864e5 + 146097 * (divTrunc(isoYear, 400) + 1) + isoDay;
|
|
9466
|
+
}
|
|
9467
|
+
|
|
9468
|
+
function epochNanoToIsoDateTime(epochNano) {
|
|
9469
|
+
const [epochDays, nanoAfterDay] = divModFloorBigInt(epochNano, bigNanoInUtcDay);
|
|
9470
|
+
return {
|
|
9471
|
+
...epochDaysToIsoDate(Number(epochDays)),
|
|
9472
|
+
...nanoToTimeFields(Number(nanoAfterDay))
|
|
9473
|
+
};
|
|
9474
|
+
}
|
|
9475
|
+
|
|
9476
|
+
function epochDaysToIsoDate(epochDays) {
|
|
9477
|
+
const legacyDate = new Date(864e5 * modFloor(epochDays, 146097));
|
|
9478
|
+
return {
|
|
9479
|
+
year: legacyDate.getUTCFullYear() + 400 * Math.floor(epochDays / 146097),
|
|
9480
|
+
month: legacyDate.getUTCMonth() + 1,
|
|
9481
|
+
day: legacyDate.getUTCDate()
|
|
9482
|
+
};
|
|
9483
|
+
}
|
|
9484
|
+
|
|
9485
|
+
function computeIsoMonthCodeParts(month) {
|
|
9486
|
+
return [ month, 0 ];
|
|
9487
|
+
}
|
|
9488
|
+
|
|
9489
|
+
function computeIsoFieldsFromParts(year, month, day) {
|
|
9490
|
+
return {
|
|
9491
|
+
year: year,
|
|
9492
|
+
month: month,
|
|
9493
|
+
day: day
|
|
9494
|
+
};
|
|
9495
|
+
}
|
|
9496
|
+
|
|
9497
|
+
function computeIsoDaysInMonth(year, month) {
|
|
9498
|
+
switch (month) {
|
|
9499
|
+
case 2:
|
|
9500
|
+
return computeIsoInLeapYear(year) ? 29 : 28;
|
|
9501
|
+
|
|
9502
|
+
case 4:
|
|
9503
|
+
case 6:
|
|
9504
|
+
case 9:
|
|
9505
|
+
case 11:
|
|
9506
|
+
return 30;
|
|
9507
|
+
}
|
|
9508
|
+
return 31;
|
|
9509
|
+
}
|
|
9510
|
+
|
|
9511
|
+
function computeIsoDaysInYear(year) {
|
|
9512
|
+
return computeIsoInLeapYear(year) ? 366 : 365;
|
|
9513
|
+
}
|
|
9514
|
+
|
|
9515
|
+
function computeIsoInLeapYear(year) {
|
|
9516
|
+
return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
|
|
9517
|
+
}
|
|
9518
|
+
|
|
9519
|
+
function addIsoMonths(year, month, monthDelta) {
|
|
9520
|
+
return year += divTrunc(monthDelta, 12), (month += modTrunc(monthDelta, 12)) < 1 ? (year--,
|
|
9521
|
+
month += 12) : month > 12 && (year++, month -= 12), {
|
|
9522
|
+
year: year,
|
|
9523
|
+
month: month
|
|
9524
|
+
};
|
|
9525
|
+
}
|
|
9526
|
+
|
|
9527
|
+
function computeIsoDayOfWeek(isoDateFields) {
|
|
9528
|
+
return modFloor(isoArgsToEpochDays(isoDateFields.year, isoDateFields.month, isoDateFields.day) + 4, 7) || 7;
|
|
9529
|
+
}
|
|
9530
|
+
|
|
9531
|
+
function computeIsoDayOfYear(isoDateFields) {
|
|
9532
|
+
return isoArgsToEpochDays(isoDateFields.year, isoDateFields.month, isoDateFields.day) - isoArgsToEpochDays(isoDateFields.year) + 1;
|
|
9533
|
+
}
|
|
9534
|
+
|
|
9535
|
+
function computeIsoWeekFields(isoDateFields) {
|
|
9536
|
+
let yearOfWeek = isoDateFields.year;
|
|
9537
|
+
let weekOfYear = Math.floor((computeIsoDayOfYear(isoDateFields) - computeIsoDayOfWeek(isoDateFields) + 10) / 7);
|
|
9538
|
+
let weeksInYear = computeIsoWeeksInYear(yearOfWeek);
|
|
9539
|
+
return weekOfYear < 1 ? weekOfYear = weeksInYear = computeIsoWeeksInYear(--yearOfWeek) : weekOfYear > weeksInYear && (weekOfYear = 1,
|
|
9540
|
+
weeksInYear = computeIsoWeeksInYear(++yearOfWeek)), {
|
|
9541
|
+
weekOfYear: weekOfYear,
|
|
9542
|
+
yearOfWeek: yearOfWeek,
|
|
9543
|
+
Ie: weeksInYear
|
|
9544
|
+
};
|
|
9545
|
+
}
|
|
9546
|
+
|
|
9547
|
+
function computeIsoWeeksInYear(year) {
|
|
9548
|
+
const y0DayOfWeek = computeIsoDayOfWeek({
|
|
9549
|
+
year: year,
|
|
9550
|
+
month: 1,
|
|
9551
|
+
day: 1
|
|
9552
|
+
});
|
|
9553
|
+
return 4 === y0DayOfWeek || 3 === y0DayOfWeek && computeIsoInLeapYear(year) ? 53 : 52;
|
|
9554
|
+
}
|
|
9555
|
+
|
|
9556
|
+
function computeGregoryEraFields({year: year}) {
|
|
9557
|
+
return year < 1 ? {
|
|
9558
|
+
era: "bce",
|
|
9559
|
+
eraYear: 1 - year
|
|
9560
|
+
} : {
|
|
9561
|
+
era: "ce",
|
|
9562
|
+
eraYear: year
|
|
9563
|
+
};
|
|
9564
|
+
}
|
|
9565
|
+
|
|
9566
|
+
function validateIsoDateTimeFields(isoDateTime) {
|
|
9567
|
+
return validateIsoDateFields(isoDateTime), validateTimeFields(isoDateTime);
|
|
9568
|
+
}
|
|
9569
|
+
|
|
9570
|
+
function validateIsoDateFields(isoInternals) {
|
|
9571
|
+
return constrainIsoDateFields(isoInternals, 1), isoInternals;
|
|
9572
|
+
}
|
|
9573
|
+
|
|
9574
|
+
function constrainIsoDateFields(isoDate, overflow) {
|
|
9575
|
+
const {year: year} = isoDate;
|
|
9576
|
+
const month = clampProp(isoDate, "month", 1, 12, overflow);
|
|
9577
|
+
return {
|
|
9578
|
+
year: year,
|
|
9579
|
+
month: month,
|
|
9580
|
+
day: clampProp(isoDate, "day", 1, computeIsoDaysInMonth(year, month), overflow)
|
|
9581
|
+
};
|
|
9582
|
+
}
|
|
9583
|
+
|
|
9584
|
+
function computeCalendarDateFields(calendar, isoDate) {
|
|
9585
|
+
return calendar ? calendar.ie(isoDate) : isoDate;
|
|
9586
|
+
}
|
|
9587
|
+
|
|
9588
|
+
function computeCalendarMonthCodeParts(calendar, year, month) {
|
|
9589
|
+
return calendar ? calendar.O(year, month) : computeIsoMonthCodeParts(month);
|
|
9590
|
+
}
|
|
9591
|
+
|
|
9592
|
+
function computeCalendarEraFields(calendar, isoDate) {
|
|
9593
|
+
return 0 === calendar ? computeGregoryEraFields(isoDate) : calendar ? calendar.h(isoDate) : {};
|
|
9594
|
+
}
|
|
9595
|
+
|
|
9596
|
+
function computeCalendarIsoFieldsFromParts(calendar, year, month, day) {
|
|
9597
|
+
return calendar ? calendar.je(year, month, day) : computeIsoFieldsFromParts(year, month, day);
|
|
9598
|
+
}
|
|
9599
|
+
|
|
9600
|
+
function computeCalendarMonthsInYearForYear(calendar, year) {
|
|
9601
|
+
return calendar ? calendar.k(year) : 12;
|
|
9602
|
+
}
|
|
9603
|
+
|
|
9604
|
+
function computeCalendarDaysInMonthForYearMonth(calendar, year, month) {
|
|
9605
|
+
return calendar ? calendar.p(year, month) : computeIsoDaysInMonth(year, month);
|
|
9606
|
+
}
|
|
9607
|
+
|
|
9608
|
+
function computeCalendarMonthCode(calendar, isoDate) {
|
|
9609
|
+
const {year: year, month: month} = computeCalendarDateFields(calendar, isoDate);
|
|
9610
|
+
const [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, year, month);
|
|
9611
|
+
return formatMonthCode(monthCodeNumber, isLeapMonth);
|
|
9612
|
+
}
|
|
9613
|
+
|
|
9614
|
+
function computeCalendarInLeapYear(calendar, isoDate) {
|
|
9615
|
+
const {year: year} = computeCalendarDateFields(calendar, isoDate);
|
|
9616
|
+
return calendar ? calendar.u(year) : computeIsoInLeapYear(year);
|
|
9617
|
+
}
|
|
9618
|
+
|
|
9619
|
+
function computeCalendarMonthsInYear(calendar, isoDate) {
|
|
9620
|
+
const {year: year} = computeCalendarDateFields(calendar, isoDate);
|
|
9621
|
+
return computeCalendarMonthsInYearForYear(calendar, year);
|
|
9622
|
+
}
|
|
9623
|
+
|
|
9624
|
+
function computeCalendarDaysInMonth(calendar, isoDate) {
|
|
9625
|
+
const {year: year, month: month} = computeCalendarDateFields(calendar, isoDate);
|
|
9626
|
+
return computeCalendarDaysInMonthForYearMonth(calendar, year, month);
|
|
9627
|
+
}
|
|
9628
|
+
|
|
9629
|
+
function computeCalendarDaysInYear(calendar, isoDate) {
|
|
9630
|
+
const {year: year} = computeCalendarDateFields(calendar, isoDate);
|
|
9631
|
+
return calendar ? calendar.j(year) : computeIsoDaysInYear(year);
|
|
9632
|
+
}
|
|
9633
|
+
|
|
9634
|
+
function computeCalendarDayOfYear(calendar, isoDate) {
|
|
9635
|
+
if (!calendar) {
|
|
9636
|
+
return computeIsoDayOfYear(isoDate);
|
|
9637
|
+
}
|
|
9638
|
+
const {year: year} = computeCalendarDateFields(calendar, isoDate);
|
|
9639
|
+
const yearStartIsoDate = computeCalendarIsoFieldsFromParts(calendar, year, 1, 1);
|
|
9640
|
+
return isoDateToEpochDays(isoDate) - isoDateToEpochDays(yearStartIsoDate) + 1;
|
|
9641
|
+
}
|
|
9642
|
+
|
|
9643
|
+
function computeCalendarWeekOfYear(calendar, isoDate) {
|
|
9644
|
+
return calendar === isoCalendarImpl ? computeIsoWeekFields(isoDate).weekOfYear : void 0;
|
|
9645
|
+
}
|
|
9646
|
+
|
|
9647
|
+
function computeCalendarYearOfWeek(calendar, isoDate) {
|
|
9648
|
+
return calendar === isoCalendarImpl ? computeIsoWeekFields(isoDate).yearOfWeek : void 0;
|
|
9649
|
+
}
|
|
9650
|
+
|
|
9651
|
+
const durationFieldNamesAsc = /*@__PURE__*/ unitNamesAsc.map(unitName => unitName + "s");
|
|
9652
|
+
|
|
9653
|
+
const durationDateFieldNamesAsc = /*@__PURE__*/ durationFieldNamesAsc.slice(6);
|
|
9654
|
+
|
|
9655
|
+
const durationCalendarFieldNamesAsc = /*@__PURE__*/ durationDateFieldNamesAsc.slice(1);
|
|
9656
|
+
|
|
9657
|
+
const durationFieldDefaults = /*@__PURE__*/ zipPropsConst(durationFieldNamesAsc, 0);
|
|
9658
|
+
|
|
9659
|
+
const requireString = /*@__PURE__*/ bindArgs(requireType, "string");
|
|
9660
|
+
|
|
9661
|
+
function requireType(typeName, arg, entityName = typeName) {
|
|
9662
|
+
return typeof arg !== typeName && throwTypeError(invalidEntity(entityName, arg)),
|
|
9663
|
+
arg;
|
|
9664
|
+
}
|
|
9665
|
+
|
|
9666
|
+
function requireNumberIsInteger(num, entityName = "number") {
|
|
9667
|
+
return Number.isInteger(num) || throwRangeError(((entityName, num) => `Non-integer ${entityName}: ${num}`)(entityName, num)),
|
|
9668
|
+
num || 0;
|
|
9669
|
+
}
|
|
9670
|
+
|
|
9671
|
+
function toString$4(arg) {
|
|
9672
|
+
return "symbol" == typeof arg && throwTypeError("Cannot convert Symbol to string"),
|
|
9673
|
+
String(arg);
|
|
9674
|
+
}
|
|
9675
|
+
|
|
9676
|
+
function toStringViaPrimitive(arg, entityName) {
|
|
9677
|
+
return isObjectLike(arg) ? String(arg) : requireString(arg, entityName);
|
|
9678
|
+
}
|
|
9679
|
+
|
|
9680
|
+
function toStrictInteger(arg, entityName) {
|
|
9681
|
+
return requireNumberIsInteger(toFiniteNumber(arg, entityName), entityName);
|
|
9682
|
+
}
|
|
9683
|
+
|
|
9684
|
+
const overflowMap = {
|
|
9685
|
+
constrain: 0,
|
|
9686
|
+
reject: 1
|
|
9687
|
+
};
|
|
9688
|
+
|
|
9689
|
+
const calendarDisplayMap = {
|
|
9690
|
+
auto: 0,
|
|
9691
|
+
never: 1,
|
|
9692
|
+
critical: 2,
|
|
9693
|
+
always: 3
|
|
9694
|
+
};
|
|
9695
|
+
|
|
9696
|
+
function coerceChoiceOption(optionName, enumNameMap, options, defaultChoice = 0) {
|
|
9697
|
+
const enumArg = options[optionName];
|
|
9698
|
+
if (void 0 === enumArg) {
|
|
9699
|
+
return defaultChoice;
|
|
9700
|
+
}
|
|
9701
|
+
const enumStr = toString$4(enumArg);
|
|
9702
|
+
const enumNum = enumNameMap[enumStr];
|
|
9703
|
+
return void 0 === enumNum && throwRangeError(invalidChoice(optionName, enumStr, enumNameMap)),
|
|
9704
|
+
enumNum;
|
|
9705
|
+
}
|
|
9706
|
+
|
|
9707
|
+
const coerceOverflow = /*@__PURE__*/ bindArgs(coerceChoiceOption, "overflow", overflowMap);
|
|
9708
|
+
|
|
9709
|
+
const coerceCalendarDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "calendarName", calendarDisplayMap);
|
|
9710
|
+
|
|
9711
|
+
function combineDateAndTime(isoDate, time) {
|
|
9712
|
+
return pluckProps(calendarDateFieldNamesAsc, isoDate, pluckProps(timeFieldNamesAsc, time));
|
|
9713
|
+
}
|
|
9714
|
+
|
|
9715
|
+
function refineOverflowOptions(options) {
|
|
9716
|
+
return void 0 === options ? 0 : coerceOverflow(requireObjectLike(options));
|
|
9717
|
+
}
|
|
9718
|
+
|
|
9719
|
+
const epochNanoMax = /*@__PURE__*/ BigInt(1e8) * bigNanoInUtcDay;
|
|
9720
|
+
|
|
9721
|
+
const epochNanoMin = /*@__PURE__*/ BigInt(-1e8) * bigNanoInUtcDay;
|
|
9722
|
+
|
|
9723
|
+
const plainDateEpochNanoMin = epochNanoMin - bigNanoInUtcDay;
|
|
9724
|
+
|
|
9725
|
+
const isoYearMonthIndexMin = -3261848;
|
|
9726
|
+
|
|
9727
|
+
function checkIsoYearMonthInBounds(isoDate) {
|
|
9728
|
+
const isoYearMonthIndex = 12 * isoDate.year + isoDate.month;
|
|
9729
|
+
return (isoYearMonthIndex < isoYearMonthIndexMin || isoYearMonthIndex > 3309129) && throwRangeError(outOfBoundsDate),
|
|
9730
|
+
isoDate;
|
|
9731
|
+
}
|
|
9732
|
+
|
|
9733
|
+
function checkIsoDateInBounds(isoDate, allowPlainDateLowerEdge = 1) {
|
|
9734
|
+
return checkIsoDateEpochNanoInBounds(isoDateToEpochNano(isoDate), allowPlainDateLowerEdge),
|
|
9735
|
+
isoDate;
|
|
9736
|
+
}
|
|
9737
|
+
|
|
9738
|
+
function checkIsoDateTimeInBounds(isoDateTime) {
|
|
9739
|
+
const epochNano = isoDateToEpochNano(isoDateTime);
|
|
9740
|
+
return checkIsoDateEpochNanoInBounds(epochNano), epochNano !== plainDateEpochNanoMin || timeFieldsToNano(isoDateTime) || throwRangeError(outOfBoundsDate),
|
|
9741
|
+
isoDateTime;
|
|
9742
|
+
}
|
|
9743
|
+
|
|
9744
|
+
function checkIsoDateEpochNanoInBounds(epochNano, allowPlainDateLowerEdge = 1) {
|
|
9745
|
+
(epochNano < (allowPlainDateLowerEdge ? plainDateEpochNanoMin : epochNanoMin) || epochNano > epochNanoMax) && throwRangeError(outOfBoundsDate);
|
|
9746
|
+
}
|
|
9747
|
+
|
|
9748
|
+
function checkEpochNanoInBounds(epochNano) {
|
|
9749
|
+
return (epochNano < epochNanoMin || epochNano > epochNanoMax) && throwRangeError(outOfBoundsDate),
|
|
9750
|
+
epochNano;
|
|
9751
|
+
}
|
|
9752
|
+
|
|
9753
|
+
function isoDateTimeAndOffsetToEpochNano(isoDateTime, offsetNano) {
|
|
9754
|
+
return checkEpochNanoInBounds(isoDateToEpochNano(isoDateTime) + BigInt(timeFieldsToNano(isoDateTime) - offsetNano));
|
|
9755
|
+
}
|
|
9756
|
+
|
|
9757
|
+
function createDateSlots(isoDate, calendar) {
|
|
9758
|
+
return pluckProps(calendarDateFieldNamesAsc, isoDate, {
|
|
9759
|
+
calendar: calendar
|
|
9760
|
+
});
|
|
9761
|
+
}
|
|
9762
|
+
|
|
9763
|
+
function createDurationSlots(durationFields) {
|
|
9764
|
+
return pluckProps(durationFieldNamesAsc, durationFields, {
|
|
9765
|
+
sign: computeDurationSign(durationFields)
|
|
9766
|
+
});
|
|
9767
|
+
}
|
|
9768
|
+
|
|
9769
|
+
function moveYearMonth(doSubtract, calendar, isoDateFields, durationSlots, options) {
|
|
9770
|
+
const overflow = refineOverflowOptions(options);
|
|
9771
|
+
durationSlots.sign && getMaxDurationUnit(durationSlots) < 8 && throwRangeError("Cannot use small units");
|
|
9772
|
+
const startOfMonthFields = checkIsoDateInBounds(moveToStartOfMonth(calendar, isoDateFields));
|
|
9773
|
+
return moveToStartOfMonth(calendar, dateAddWithOverflow(calendar, startOfMonthFields, durationSlots, overflow));
|
|
9774
|
+
}
|
|
9775
|
+
|
|
9776
|
+
function moveToStartOfMonth(calendar, isoDateFields) {
|
|
9777
|
+
return moveByDays(isoDateFields, 1 - computeCalendarDateFields(calendar, isoDateFields).day);
|
|
9778
|
+
}
|
|
9779
|
+
|
|
9780
|
+
function moveByDays(isoDate, days) {
|
|
9781
|
+
return days ? epochDaysToIsoDate(isoDateToEpochDays(isoDate) + days) : isoDate;
|
|
9782
|
+
}
|
|
9783
|
+
|
|
9784
|
+
function dateAddWithOverflow(calendar, isoDateFields, durationFields, overflow) {
|
|
9785
|
+
let {years: years, months: months, weeks: weeks, days: days} = durationFields;
|
|
9786
|
+
let isoDate;
|
|
9787
|
+
if (days += Number(durationTimeToBigNano(durationFields) / bigNanoInUtcDay), years || months) {
|
|
9788
|
+
isoDate = addDateMonths(calendar, isoDateFields, years, months, overflow);
|
|
9789
|
+
} else {
|
|
9790
|
+
if (!weeks && !days) {
|
|
9791
|
+
return isoDateFields;
|
|
9792
|
+
}
|
|
9793
|
+
isoDate = isoDateFields;
|
|
9794
|
+
}
|
|
9795
|
+
return (weeks || days) && (isoDate = moveByDays(isoDate, 7 * weeks + days)), checkIsoDateInBounds(isoDate);
|
|
9796
|
+
}
|
|
9797
|
+
|
|
9798
|
+
function addDateMonths(calendar, isoDateFields, years, months, overflow) {
|
|
9799
|
+
const dateParts = computeCalendarDateFields(calendar, isoDateFields);
|
|
9800
|
+
let {year: year, month: month, day: day} = dateParts;
|
|
9801
|
+
if (years) {
|
|
9802
|
+
const [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, year, month);
|
|
9803
|
+
year += years, month = computeYearMovedMonth(calendar, monthCodeNumber, isLeapMonth, calendar ? calendar.q(year) : void 0, overflow),
|
|
9804
|
+
month = clampEntity("month", month, 1, computeCalendarMonthsInYearForYear(calendar, year), overflow);
|
|
9805
|
+
}
|
|
9806
|
+
if (months) {
|
|
9807
|
+
const yearMonthParts = calendar ? calendar.N(year, month, months) : addIsoMonths(year, month, months);
|
|
9808
|
+
({year: year, month: month} = yearMonthParts);
|
|
9809
|
+
}
|
|
9810
|
+
return day = clampEntity("day", day, 1, computeCalendarDaysInMonthForYearMonth(calendar, year, month), overflow),
|
|
9811
|
+
computeCalendarIsoFieldsFromParts(calendar, year, month, day);
|
|
9812
|
+
}
|
|
9813
|
+
|
|
9814
|
+
function computeYearMovedMonth(calendar, monthCodeNumber, isLeapMonth, targetLeapMonth, overflow) {
|
|
9815
|
+
if (isLeapMonth) {
|
|
9816
|
+
const leapMonthMeta = calendar ? calendar.m : void 0;
|
|
9817
|
+
return void 0 !== targetLeapMonth && (leapMonthMeta < 0 || targetLeapMonth === monthCodeNumber + 1) ? targetLeapMonth : (1 === overflow && throwRangeError(invalidLeapMonth),
|
|
9818
|
+
leapMonthMeta < 0 ? -leapMonthMeta : monthCodeNumber);
|
|
9819
|
+
}
|
|
9820
|
+
return monthCodeNumberToMonth(monthCodeNumber, 0, targetLeapMonth);
|
|
9821
|
+
}
|
|
9822
|
+
|
|
9823
|
+
function computeDurationSign(fields, fieldNames = durationFieldNamesAsc) {
|
|
9824
|
+
let sign = 0;
|
|
9825
|
+
for (const fieldName of fieldNames) {
|
|
9826
|
+
const fieldSign = Math.sign(fields[fieldName]);
|
|
9827
|
+
fieldSign && (sign && sign !== fieldSign && throwRangeError("Cannot mix duration signs"),
|
|
9828
|
+
sign = fieldSign);
|
|
9829
|
+
}
|
|
9830
|
+
return sign;
|
|
9831
|
+
}
|
|
9832
|
+
|
|
9833
|
+
function validateDurationFields(fields) {
|
|
9834
|
+
for (const calendarUnit of durationCalendarFieldNamesAsc) {
|
|
9835
|
+
clampEntity(calendarUnit, fields[calendarUnit], -4294967295, 4294967295, 1);
|
|
9836
|
+
}
|
|
9837
|
+
const bigNano = durationDayTimeToBigNano(fields);
|
|
9838
|
+
return validateDurationTimeUnit(Number(bigNano / bigNanoInSec)), fields;
|
|
9839
|
+
}
|
|
9840
|
+
|
|
9841
|
+
function validateDurationTimeUnit(n) {
|
|
9842
|
+
Number.isSafeInteger(n) || throwRangeError("Out-of-bounds duration");
|
|
9843
|
+
}
|
|
9844
|
+
|
|
9845
|
+
function durationDayTimeToBigNano(fields) {
|
|
9846
|
+
return BigInt(fields.days) * bigNanoInUtcDay + durationTimeToBigNano(fields);
|
|
9847
|
+
}
|
|
9848
|
+
|
|
9849
|
+
function durationTimeToBigNano(fields) {
|
|
9850
|
+
return BigInt(fields.hours) * bigNanoInHour + BigInt(fields.minutes) * bigNanoInMinute + durationSubMinuteToBigNano(fields);
|
|
9851
|
+
}
|
|
9852
|
+
|
|
9853
|
+
function durationSubMinuteToBigNano(fields) {
|
|
9854
|
+
return BigInt(fields.seconds) * bigNanoInSec + BigInt(fields.milliseconds) * bigNanoInMilli + BigInt(fields.microseconds) * bigNanoInMicro + BigInt(fields.nanoseconds);
|
|
9855
|
+
}
|
|
9856
|
+
|
|
9857
|
+
function getMaxDurationUnit(fields) {
|
|
9858
|
+
let unit = 9;
|
|
9859
|
+
for (;unit > 0 && !fields[durationFieldNamesAsc[unit]]; unit--) {}
|
|
9860
|
+
return unit;
|
|
9861
|
+
}
|
|
9862
|
+
|
|
9863
|
+
function compareIsoDateFields(isoFields0, isoFields1) {
|
|
9864
|
+
return compareNumbers(isoDateToEpochDays(isoFields0), isoDateToEpochDays(isoFields1));
|
|
9865
|
+
}
|
|
9866
|
+
|
|
9867
|
+
function getCalendarEraOrigins(calendar) {
|
|
9868
|
+
return 0 === calendar ? gregoryEraOrigins : calendar ? calendar.l : void 0;
|
|
9869
|
+
}
|
|
9870
|
+
|
|
9871
|
+
function getCalendarFieldNames(calendar, fieldNames, fieldNamesWithEra = fieldNames) {
|
|
9872
|
+
return getCalendarEraOrigins(calendar) ? fieldNamesWithEra : fieldNames;
|
|
9873
|
+
}
|
|
9874
|
+
|
|
9875
|
+
function resolveCalendarYear(calendar, fields) {
|
|
9876
|
+
const exoticCalendar = calendar || void 0;
|
|
9877
|
+
const eraOrigins = getCalendarEraOrigins(calendar);
|
|
9878
|
+
let {era: era, eraYear: eraYear, year: year} = fields;
|
|
9879
|
+
if (void 0 !== year && (year = toIntegerWithTrunc(year, "year")), void 0 !== eraYear && (eraYear = toIntegerWithTrunc(eraYear, "eraYear")),
|
|
9880
|
+
void 0 !== era || void 0 !== eraYear) {
|
|
9881
|
+
void 0 !== era && void 0 !== eraYear || throwTypeError("Mismatching era/eraYear"),
|
|
9882
|
+
eraOrigins || throwRangeError("Forbidden era/eraYear");
|
|
9883
|
+
const normalizedEra = normalizeEraName(era);
|
|
9884
|
+
const eraOrigin = eraOrigins[normalizedEra];
|
|
9885
|
+
void 0 === eraOrigin && throwRangeError((era => `Invalid era: ${era}`)(era));
|
|
9886
|
+
const yearByEra = exoticCalendar?.te ? exoticCalendar.te(eraYear, normalizedEra, eraOrigin) : eraYearToYear(eraYear, eraOrigin);
|
|
9887
|
+
void 0 !== year && year !== yearByEra && throwRangeError("Mismatching year/eraYear"),
|
|
9888
|
+
year = yearByEra;
|
|
9889
|
+
} else {
|
|
9890
|
+
void 0 === year && throwTypeError(missingYear(eraOrigins));
|
|
9891
|
+
}
|
|
9892
|
+
return year;
|
|
9893
|
+
}
|
|
9894
|
+
|
|
9895
|
+
function resolveCalendarMonth(calendar, fields, year, overflow, monthCodeParts) {
|
|
9896
|
+
let {month: month, monthCode: monthCode} = fields;
|
|
9897
|
+
if (void 0 !== monthCode) {
|
|
9898
|
+
const monthByCode = ((calendar, monthCode, year, overflow, monthCodeParts = parseMonthCode(monthCode)) => {
|
|
9899
|
+
const leapMonth = calendar ? calendar.q(year) : void 0;
|
|
9900
|
+
const [monthCodeNumber, wantsLeapMonth] = monthCodeParts;
|
|
9901
|
+
let month = monthCodeNumberToMonth(monthCodeNumber, wantsLeapMonth, leapMonth);
|
|
9902
|
+
if (wantsLeapMonth) {
|
|
9903
|
+
const leapMonthMeta = calendar ? calendar.m : void 0;
|
|
9904
|
+
void 0 === leapMonthMeta && throwRangeError(invalidLeapMonth), leapMonthMeta > 0 ? (month > leapMonthMeta && throwRangeError(invalidLeapMonth),
|
|
9905
|
+
leapMonth !== month && (1 === overflow && throwRangeError(invalidLeapMonth), month = monthCodeNumberToMonth(monthCodeNumber, 0, leapMonth))) : (month !== -leapMonthMeta && throwRangeError(invalidLeapMonth),
|
|
9906
|
+
void 0 === leapMonth && 1 === overflow && throwRangeError(invalidLeapMonth));
|
|
9907
|
+
}
|
|
9908
|
+
return month;
|
|
9909
|
+
})(calendar, monthCode, year, overflow, monthCodeParts);
|
|
9910
|
+
void 0 !== month && month !== monthByCode && throwRangeError("Mismatching month/monthCode"),
|
|
9911
|
+
month = monthByCode, overflow = 1;
|
|
9912
|
+
} else {
|
|
9913
|
+
void 0 === month && throwTypeError("Missing month/monthCode");
|
|
9914
|
+
}
|
|
9915
|
+
return clampEntity("month", month, 1, computeCalendarMonthsInYearForYear(calendar, year), overflow);
|
|
9916
|
+
}
|
|
9917
|
+
|
|
9918
|
+
function resolveCalendarDay(calendar, fields, month, year, overflow) {
|
|
9919
|
+
return clampProp(fields, "day", 1, computeCalendarDaysInMonthForYearMonth(calendar, year, month), overflow);
|
|
9920
|
+
}
|
|
9921
|
+
|
|
9922
|
+
function eraYearToYear(eraYear, eraOrigin) {
|
|
9923
|
+
return (eraOrigin + eraYear) * (Math.sign(eraOrigin) || 1) || 0;
|
|
9924
|
+
}
|
|
9925
|
+
|
|
9926
|
+
const offsetRegExp = /*@__PURE__*/ createRegExp("([+-])(\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?");
|
|
9927
|
+
|
|
9928
|
+
function parseOffsetNanoMaybe(s, onlyHourMinute) {
|
|
9929
|
+
const parts = offsetRegExp.exec(s);
|
|
9930
|
+
if (parts && (s => (s => {
|
|
9931
|
+
"T" !== s[0] && "t" !== s[0] || (s = s.slice(1));
|
|
9932
|
+
const fractionIndex = s.search(/[.,]/);
|
|
9933
|
+
const main = fractionIndex < 0 ? s : s.slice(0, fractionIndex);
|
|
9934
|
+
const parts = main.split(":");
|
|
9935
|
+
return 1 === parts.length ? /^(?:\d{2}|\d{4}|\d{6})$/i.test(main) : (2 === parts.length || 3 === parts.length) && parts.every(part => 2 === part.length && /^\d{2}$/i.test(part));
|
|
9936
|
+
})(s.slice(1)))(parts[0])) {
|
|
9937
|
+
return ((parts, onlyHourMinute) => {
|
|
9938
|
+
const firstSubMinutePart = parts[4] || parts[5];
|
|
9939
|
+
firstSubMinutePart && throwRangeError(invalidSubstring(firstSubMinutePart));
|
|
9940
|
+
const offsetNanoPos = parseInt0(parts[2]) * nanoInHour + parseInt0(parts[3]) * nanoInMinute + parseInt0(parts[4]) * nanoInSec + parseSubsecNano(parts[5] || "");
|
|
9941
|
+
return offsetNano = offsetNanoPos * parseSign(parts[1]), Math.abs(offsetNano) >= nanoInUtcDay && throwRangeError("Out-of-bounds offset"),
|
|
9942
|
+
offsetNano;
|
|
9943
|
+
var offsetNano;
|
|
9944
|
+
})(parts);
|
|
9945
|
+
}
|
|
9946
|
+
}
|
|
9947
|
+
|
|
9948
|
+
const dateFieldRefiners = {
|
|
9949
|
+
era: toStringViaPrimitive,
|
|
9950
|
+
month: toPositiveIntegerWithTruncation,
|
|
9951
|
+
monthCode(monthCode, entityName = "monthCode") {
|
|
9952
|
+
return ((monthCode, entityName) => {
|
|
9953
|
+
if ("string" == typeof monthCode) {
|
|
9954
|
+
return monthCode;
|
|
9955
|
+
}
|
|
9956
|
+
if (monthCode && "object" == typeof monthCode) {
|
|
9957
|
+
const monthCodeToString = monthCode.toString;
|
|
9958
|
+
if ("function" == typeof monthCodeToString) {
|
|
9959
|
+
return requireString(monthCodeToString.call(monthCode), entityName);
|
|
9960
|
+
}
|
|
9961
|
+
}
|
|
9962
|
+
return requireString(monthCode, entityName);
|
|
9963
|
+
})(monthCode, entityName);
|
|
9964
|
+
},
|
|
9965
|
+
day: toPositiveIntegerWithTruncation
|
|
9966
|
+
};
|
|
9967
|
+
|
|
9968
|
+
function readAndRefineBagFields(bag, validFieldNames, fieldRefiners, requiredFieldNames, disallowEmpty = !requiredFieldNames) {
|
|
9969
|
+
const res = {};
|
|
9970
|
+
let anyMatching = 0;
|
|
9971
|
+
for (const fieldName of validFieldNames) {
|
|
9972
|
+
let fieldVal = bag[fieldName];
|
|
9973
|
+
if (void 0 !== fieldVal) {
|
|
9974
|
+
anyMatching = 1;
|
|
9975
|
+
const refiner = fieldRefiners[fieldName];
|
|
9976
|
+
refiner && (fieldVal = refiner(fieldVal, fieldName)), res[fieldName] = fieldVal;
|
|
9977
|
+
} else {
|
|
9978
|
+
requiredFieldNames && requiredFieldNames.includes(fieldName) && throwTypeError(missingField(fieldName));
|
|
9979
|
+
}
|
|
9980
|
+
}
|
|
9981
|
+
return disallowEmpty && !anyMatching && throwTypeError(noValidFields(validFieldNames)),
|
|
9982
|
+
res;
|
|
9983
|
+
}
|
|
9984
|
+
|
|
9985
|
+
function createPlainDateFromFields(calendar, fields, options) {
|
|
9986
|
+
return createPlainDateFromPreparedFields(calendar, fields, prepareDateFields(calendar, fields), refineOverflowOptions(options));
|
|
9987
|
+
}
|
|
9988
|
+
|
|
9989
|
+
function createPlainDateFromPreparedFields(calendar, fields, prepared, overflow) {
|
|
9990
|
+
const year = prepared[1];
|
|
9991
|
+
const month = resolveCalendarMonth(calendar, fields, year, overflow, prepared[0]);
|
|
9992
|
+
return createDateSlots(checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, year, month, resolveCalendarDay(calendar, fields, month, year, overflow))), calendar);
|
|
9993
|
+
}
|
|
9994
|
+
|
|
9995
|
+
function parseMonthCodeField(fields) {
|
|
9996
|
+
if (void 0 !== fields.monthCode) {
|
|
9997
|
+
return parseMonthCode(fields.monthCode);
|
|
9998
|
+
}
|
|
9999
|
+
}
|
|
10000
|
+
|
|
10001
|
+
function prepareDateFields(calendar, fields) {
|
|
10002
|
+
const eraOrigins = getCalendarEraOrigins(calendar);
|
|
10003
|
+
return void 0 !== fields.year || void 0 !== fields.era && void 0 !== fields.eraYear || throwTypeError(missingYear(eraOrigins)),
|
|
10004
|
+
void 0 === fields.monthCode && void 0 === fields.month && throwTypeError("Missing month/monthCode"),
|
|
10005
|
+
void 0 === fields.day && throwTypeError(missingField("day")), [ parseMonthCodeField(fields), resolveCalendarYear(calendar, fields) ];
|
|
10006
|
+
}
|
|
10007
|
+
|
|
10008
|
+
function createPlainYearMonthFromFields(calendar, fields, options) {
|
|
10009
|
+
const eraOrigins = getCalendarEraOrigins(calendar);
|
|
10010
|
+
void 0 !== fields.year || void 0 !== fields.era && void 0 !== fields.eraYear || throwTypeError(missingYear(eraOrigins)),
|
|
10011
|
+
void 0 === fields.monthCode && void 0 === fields.month && throwTypeError("Missing month/monthCode");
|
|
10012
|
+
const monthCodeParts = parseMonthCodeField(fields);
|
|
10013
|
+
const year = resolveCalendarYear(calendar, fields);
|
|
10014
|
+
return createDateSlots(checkIsoYearMonthInBounds(computeCalendarIsoFieldsFromParts(calendar, year, resolveCalendarMonth(calendar, fields, year, refineOverflowOptions(options), monthCodeParts), 1)), calendar);
|
|
10015
|
+
}
|
|
10016
|
+
|
|
10017
|
+
const RawDateTimeFormat = Intl.DateTimeFormat;
|
|
10018
|
+
|
|
10019
|
+
function formatEpochMilliToPartsRecord(intlFormat, epochMilli) {
|
|
10020
|
+
epochMilli < -864e13 && throwRangeError(outOfBoundsDate);
|
|
10021
|
+
const parts = intlFormat.formatToParts(epochMilli);
|
|
10022
|
+
const hash = {};
|
|
10023
|
+
for (const part of parts) {
|
|
10024
|
+
hash[part.type] = part.value;
|
|
10025
|
+
}
|
|
10026
|
+
return hash;
|
|
10027
|
+
}
|
|
10028
|
+
|
|
10029
|
+
const timeZonePeriodDaysByName = {
|
|
10030
|
+
"El_Aaiun": 17,
|
|
10031
|
+
"Tucuman": 12,
|
|
10032
|
+
"Tirane": 11,
|
|
10033
|
+
"Riga": 10,
|
|
10034
|
+
"Simferopol": 9,
|
|
10035
|
+
"Vienna": 9,
|
|
10036
|
+
"Tunis": 8,
|
|
10037
|
+
"Boa_Vista": 6,
|
|
10038
|
+
"Fortaleza": 6,
|
|
10039
|
+
"Maceio": 6,
|
|
10040
|
+
"Noronha": 6,
|
|
10041
|
+
"Recife": 6,
|
|
10042
|
+
"Gaza": 6,
|
|
10043
|
+
"Hebron": 6,
|
|
10044
|
+
"DeNoronha": 6
|
|
10045
|
+
};
|
|
10046
|
+
|
|
10047
|
+
const minPossibleTransitionSec = -388152e4;
|
|
10048
|
+
|
|
10049
|
+
function refineDateDisplayOptions(options) {
|
|
10050
|
+
return coerceCalendarDisplay(normalizeOptions(options));
|
|
10051
|
+
}
|
|
10052
|
+
|
|
10053
|
+
function formatPlainDateIso(plainDateSlots, options) {
|
|
10054
|
+
return calendar = plainDateSlots.calendar, isoDate = plainDateSlots, calendarDisplay = refineDateDisplayOptions(options),
|
|
10055
|
+
formatIsoDateFields(isoDate) + formatCalendar(calendar, calendarDisplay);
|
|
10056
|
+
var calendar, isoDate, calendarDisplay;
|
|
10057
|
+
}
|
|
10058
|
+
|
|
10059
|
+
function formatDateIsoAuto(plainDateSlots) {
|
|
10060
|
+
return formatIsoDateFields(plainDateSlots) + (plainDateSlots.calendar === isoCalendarImpl ? "" : formatCalendarId(getCalendarSlotId(plainDateSlots.calendar), 0));
|
|
10061
|
+
}
|
|
10062
|
+
|
|
10063
|
+
function formatPlainYearMonthIso(plainYearMonthSlots, options) {
|
|
10064
|
+
return formatDateLikeIso(plainYearMonthSlots.calendar, formatIsoYearMonthFields, plainYearMonthSlots, refineDateDisplayOptions(options));
|
|
10065
|
+
}
|
|
10066
|
+
|
|
10067
|
+
function formatYearMonthIsoAuto(plainYearMonthSlots) {
|
|
10068
|
+
const calendar = plainYearMonthSlots.calendar;
|
|
10069
|
+
return calendar !== isoCalendarImpl ? formatIsoDateFields(plainYearMonthSlots) + formatCalendarId(getCalendarSlotId(calendar), 0) : formatIsoYearMonthFields(plainYearMonthSlots);
|
|
10070
|
+
}
|
|
10071
|
+
|
|
10072
|
+
function formatDateLikeIso(calendar, formatSimple, isoDate, calendarDisplay) {
|
|
10073
|
+
const showCalendar = calendarDisplay > 1 || 0 === calendarDisplay && calendar !== isoCalendarImpl;
|
|
10074
|
+
return 1 === calendarDisplay ? calendar === isoCalendarImpl ? formatSimple(isoDate) : formatIsoDateFields(isoDate) : showCalendar ? formatIsoDateFields(isoDate) + formatCalendarId(getCalendarSlotId(calendar), 2 === calendarDisplay) : formatSimple(isoDate);
|
|
10075
|
+
}
|
|
10076
|
+
|
|
10077
|
+
function formatIsoDateFields(isoDateFields) {
|
|
10078
|
+
return formatIsoYearMonthFields(isoDateFields) + "-" + padNumber2(isoDateFields.day);
|
|
10079
|
+
}
|
|
10080
|
+
|
|
10081
|
+
function formatIsoYearMonthFields(isoDateFields) {
|
|
10082
|
+
const {year: year} = isoDateFields;
|
|
10083
|
+
return (year < 0 || year > 9999 ? getSignStr(year) + padNumber(6, Math.abs(year)) : padNumber(4, year)) + "-" + padNumber2(isoDateFields.month);
|
|
10084
|
+
}
|
|
10085
|
+
|
|
10086
|
+
function formatOffsetNano(offsetNano, offsetDisplay = 0) {
|
|
10087
|
+
if (1 === offsetDisplay) {
|
|
10088
|
+
return "";
|
|
10089
|
+
}
|
|
10090
|
+
const [hour, nanoRemainder0] = divModFloor(Math.abs(offsetNano), nanoInHour);
|
|
10091
|
+
const [minute, nanoRemainder1] = divModFloor(nanoRemainder0, nanoInMinute);
|
|
10092
|
+
const [second, nanoRemainder2] = divModFloor(nanoRemainder1, nanoInSec);
|
|
10093
|
+
return getSignStr(offsetNano) + padNumber2(hour) + ":" + padNumber2(minute) + (second || nanoRemainder2 ? ":" + padNumber2(second) + formatSubsecNano(nanoRemainder2) : "");
|
|
10094
|
+
}
|
|
10095
|
+
|
|
10096
|
+
function formatCalendar(calendar, calendarDisplay) {
|
|
10097
|
+
return calendarDisplay > 1 || 0 === calendarDisplay && calendar !== isoCalendarImpl ? formatCalendarId(getCalendarSlotId(calendar), 2 === calendarDisplay) : "";
|
|
10098
|
+
}
|
|
10099
|
+
|
|
10100
|
+
function formatCalendarId(calendarId, isCritical) {
|
|
10101
|
+
return "[" + (isCritical ? "!" : "") + "u-ca=" + calendarId + "]";
|
|
10102
|
+
}
|
|
10103
|
+
|
|
10104
|
+
const trailingZerosRE = /0+$/;
|
|
10105
|
+
|
|
10106
|
+
function formatSubsecNano(totalNano, subsecDigits) {
|
|
10107
|
+
let s = padNumber(9, totalNano);
|
|
10108
|
+
return s = s.replace(trailingZerosRE, "") ,
|
|
10109
|
+
s ? "." + s : "";
|
|
10110
|
+
}
|
|
10111
|
+
|
|
10112
|
+
function getSignStr(num) {
|
|
10113
|
+
return num < 0 ? "-" : "+";
|
|
10114
|
+
}
|
|
10115
|
+
|
|
10116
|
+
const icuRegExp = /^(AC|AE|AG|AR|AS|BE|BS|CA|CN|CS|CT|EA|EC|IE|IS|JS|MI|NE|NS|PL|PN|PR|PS|SS|VS)T$/;
|
|
10117
|
+
|
|
10118
|
+
const badCharactersRegExp = /[^\w\/:+-]+/;
|
|
10119
|
+
|
|
10120
|
+
function refineTimeZoneId(rawId) {
|
|
10121
|
+
return resolveTimeZoneId(requireString(rawId));
|
|
10122
|
+
}
|
|
10123
|
+
|
|
10124
|
+
function resolveTimeZoneId(rawId) {
|
|
10125
|
+
return resolveTimeZoneRecord(rawId).id;
|
|
10126
|
+
}
|
|
10127
|
+
|
|
10128
|
+
function resolveTimeZoneRecord(rawId) {
|
|
10129
|
+
const upperRawId = rawId.toUpperCase();
|
|
10130
|
+
const offsetRecord = (upperRawId => {
|
|
10131
|
+
const offsetNano = parseOffsetNanoMaybe(upperRawId);
|
|
10132
|
+
if (void 0 !== offsetNano) {
|
|
10133
|
+
return {
|
|
10134
|
+
id: formatOffsetNano(offsetNano),
|
|
10135
|
+
_: offsetNano,
|
|
10136
|
+
o: offsetNano
|
|
10137
|
+
};
|
|
10138
|
+
}
|
|
10139
|
+
})(upperRawId);
|
|
10140
|
+
if (offsetRecord) {
|
|
10141
|
+
return {
|
|
10142
|
+
kind: "fixed",
|
|
10143
|
+
...offsetRecord
|
|
10144
|
+
};
|
|
10145
|
+
}
|
|
10146
|
+
const normId = "UTC" === upperRawId ? "UTC" : (rawId => (badCharactersRegExp.test(rawId) && throwRangeError(invalidTimeZone(rawId)),
|
|
10147
|
+
icuRegExp.test(rawId) && throwRangeError("Forbidden ICU TimeZone"), rawId.toLowerCase().split("/").map((part, partI) => (part.length <= 3 || /\d/.test(part)) && !/etc|yap/.test(part) ? part.toUpperCase() : part.replace(/baja|dumont|[a-z]+/g, (a, i) => a.length <= 2 && !partI || "in" === a || "chat" === a ? a.toUpperCase() : a.length > 2 || !i ? capitalize(a).replace(/island|noronha|murdo|rivadavia|urville/, capitalize) : a)).join("/")))(rawId);
|
|
10148
|
+
return queryNamedTimeZoneRecord(normId);
|
|
10149
|
+
}
|
|
10150
|
+
|
|
10151
|
+
const queryNamedTimeZoneRecord = /*@__PURE__*/ memoize(normId => {
|
|
10152
|
+
if ("UTC" === normId) {
|
|
10153
|
+
return {
|
|
10154
|
+
kind: "utc",
|
|
10155
|
+
id: normId,
|
|
10156
|
+
o: normId
|
|
10157
|
+
};
|
|
10158
|
+
}
|
|
10159
|
+
const upperNormId = normId.toUpperCase();
|
|
10160
|
+
const format = queryTimeZoneIntlFormat(upperNormId);
|
|
10161
|
+
return {
|
|
10162
|
+
kind: "named",
|
|
10163
|
+
id: normId,
|
|
10164
|
+
format: format,
|
|
10165
|
+
o: format.resolvedOptions().timeZone
|
|
10166
|
+
};
|
|
10167
|
+
});
|
|
10168
|
+
|
|
10169
|
+
const queryTimeZoneIntlFormat = /*@__PURE__*/ memoize(upperNormId => new RawDateTimeFormat("en-u-hc-h23", {
|
|
10170
|
+
calendar: "iso8601",
|
|
10171
|
+
timeZone: upperNormId,
|
|
10172
|
+
era: "short",
|
|
10173
|
+
year: "numeric",
|
|
10174
|
+
month: "numeric",
|
|
10175
|
+
day: "numeric",
|
|
10176
|
+
hour: "numeric",
|
|
10177
|
+
minute: "numeric",
|
|
10178
|
+
second: "numeric"
|
|
10179
|
+
}));
|
|
10180
|
+
|
|
10181
|
+
function queryTimeZone(rawTimeZoneId) {
|
|
10182
|
+
const record = resolveTimeZoneRecord(rawTimeZoneId);
|
|
10183
|
+
return queryTimeZoneRecord(record.id, record);
|
|
10184
|
+
}
|
|
10185
|
+
|
|
10186
|
+
const queryTimeZoneRecord = /*@__PURE__*/ memoize((normTimeZoneId, record) => "named" === record.kind ? new IntlTimeZone(normTimeZoneId, record.o, record.format) : new FixedTimeZone(normTimeZoneId, record.o, "fixed" === record.kind ? record._ : 0));
|
|
10187
|
+
|
|
10188
|
+
class FixedTimeZone {
|
|
10189
|
+
constructor(id, compareKey, offsetNano) {
|
|
10190
|
+
this.id = id, this.o = compareKey, this._ = offsetNano;
|
|
10191
|
+
}
|
|
10192
|
+
C() {
|
|
10193
|
+
return this._;
|
|
10194
|
+
}
|
|
10195
|
+
R(isoDateTime) {
|
|
10196
|
+
return [ isoDateTimeAndOffsetToEpochNano(isoDateTime, this._) ];
|
|
10197
|
+
}
|
|
10198
|
+
U() {}
|
|
10199
|
+
}
|
|
10200
|
+
|
|
10201
|
+
class IntlTimeZone {
|
|
10202
|
+
constructor(id, compareKey, format) {
|
|
10203
|
+
this.id = id, this.o = compareKey, this.qe = ((computeOffsetSec, periodDays) => {
|
|
10204
|
+
const getSample = memoize(computeOffsetSec);
|
|
10205
|
+
const getSplit = memoize(createSplitTuple);
|
|
10206
|
+
const periodSec = 86400 * periodDays;
|
|
10207
|
+
function getOffsetSec(epochSec) {
|
|
10208
|
+
const [startEpochSec, endEpochSec] = computePeriod(epochSec, periodSec);
|
|
10209
|
+
const clampedStartEpochSec = clampIntlSampleEpochSec(startEpochSec);
|
|
10210
|
+
const clampedEndEpochSec = clampIntlSampleEpochSec(endEpochSec);
|
|
10211
|
+
const startOffsetSec = getSample(clampedStartEpochSec);
|
|
10212
|
+
const endOffsetSec = getSample(clampedEndEpochSec);
|
|
10213
|
+
return startOffsetSec === endOffsetSec ? startOffsetSec : pinch(getSplit(clampedStartEpochSec, clampedEndEpochSec), startOffsetSec, endOffsetSec, epochSec);
|
|
10214
|
+
}
|
|
10215
|
+
function pinch(split, startOffsetSec, endOffsetSec, forEpochSec) {
|
|
10216
|
+
let offsetSec;
|
|
10217
|
+
let splitDurSec;
|
|
10218
|
+
for (;(void 0 === forEpochSec || void 0 === (offsetSec = forEpochSec < split[0] ? startOffsetSec : forEpochSec >= split[1] ? endOffsetSec : void 0)) && (splitDurSec = split[1] - split[0]); ) {
|
|
10219
|
+
const middleEpochSec = split[0] + Math.floor(splitDurSec / 2);
|
|
10220
|
+
computeOffsetSec(middleEpochSec) === endOffsetSec ? split[1] = middleEpochSec : split[0] = middleEpochSec + 1;
|
|
10221
|
+
}
|
|
10222
|
+
return offsetSec;
|
|
10223
|
+
}
|
|
10224
|
+
return {
|
|
10225
|
+
Ee(zonedEpochSec) {
|
|
10226
|
+
const wideOffsetSec0 = getOffsetSec(zonedEpochSec - 86400);
|
|
10227
|
+
const wideOffsetSec1 = getOffsetSec(zonedEpochSec + 86400);
|
|
10228
|
+
const wideUtcEpochSec0 = zonedEpochSec - wideOffsetSec0;
|
|
10229
|
+
const wideUtcEpochSec1 = zonedEpochSec - wideOffsetSec1;
|
|
10230
|
+
if (wideOffsetSec0 === wideOffsetSec1) {
|
|
10231
|
+
return [ wideUtcEpochSec0 ];
|
|
10232
|
+
}
|
|
10233
|
+
const narrowOffsetSec0 = getOffsetSec(wideUtcEpochSec0);
|
|
10234
|
+
return narrowOffsetSec0 === getOffsetSec(wideUtcEpochSec1) ? [ zonedEpochSec - narrowOffsetSec0 ] : wideOffsetSec0 > wideOffsetSec1 ? [ wideUtcEpochSec0, wideUtcEpochSec1 ] : [];
|
|
10235
|
+
},
|
|
10236
|
+
De: getOffsetSec,
|
|
10237
|
+
U: function getTransition(epochSec, direction) {
|
|
10238
|
+
if (direction > 0 && epochSec >= 864e10) {
|
|
10239
|
+
return;
|
|
10240
|
+
}
|
|
10241
|
+
if (direction < 0) {
|
|
10242
|
+
if (epochSec <= minPossibleTransitionSec) {
|
|
10243
|
+
return;
|
|
10244
|
+
}
|
|
10245
|
+
const lookaheadEpochSec = getCurrentEpochSec() + 94867200;
|
|
10246
|
+
if (epochSec > lookaheadEpochSec) {
|
|
10247
|
+
return getTransition(lookaheadEpochSec, -1);
|
|
10248
|
+
}
|
|
10249
|
+
}
|
|
10250
|
+
const searchEpochSec = direction > 0 ? Math.max(epochSec, minPossibleTransitionSec) : epochSec;
|
|
10251
|
+
let [startEpochSec, endEpochSec] = computePeriod(searchEpochSec, periodSec);
|
|
10252
|
+
const inc = periodSec * direction;
|
|
10253
|
+
const searchLimit = direction > 0 ? Math.max(epochSec, getCurrentEpochSec()) + 94867200 : minPossibleTransitionSec;
|
|
10254
|
+
const inBounds = () => direction < 0 ? endEpochSec > searchLimit : startEpochSec < searchLimit;
|
|
10255
|
+
for (;inBounds(); ) {
|
|
10256
|
+
const clampedStartEpochSec = clampIntlSampleEpochSec(startEpochSec);
|
|
10257
|
+
const clampedEndEpochSec = clampIntlSampleEpochSec(endEpochSec);
|
|
10258
|
+
const startOffsetSec = getSample(clampedStartEpochSec);
|
|
10259
|
+
const endOffsetSec = getSample(clampedEndEpochSec);
|
|
10260
|
+
if (startOffsetSec !== endOffsetSec) {
|
|
10261
|
+
const split = getSplit(clampedStartEpochSec, clampedEndEpochSec);
|
|
10262
|
+
pinch(split, startOffsetSec, endOffsetSec);
|
|
10263
|
+
const transitionEpochSec = split[0];
|
|
10264
|
+
if ((compareNumbers(transitionEpochSec, epochSec) || 1) === direction) {
|
|
10265
|
+
return transitionEpochSec;
|
|
10266
|
+
}
|
|
10267
|
+
}
|
|
10268
|
+
startEpochSec += inc, endEpochSec += inc;
|
|
10269
|
+
}
|
|
10270
|
+
}
|
|
10271
|
+
};
|
|
10272
|
+
})((format => epochSec => {
|
|
10273
|
+
const intlParts = formatEpochMilliToPartsRecord(format, 1e3 * epochSec);
|
|
10274
|
+
return 86400 * isoArgsToEpochDays((intlParts => {
|
|
10275
|
+
const relatedYear = intlParts.relatedYear;
|
|
10276
|
+
if (void 0 !== relatedYear) {
|
|
10277
|
+
return parseInt(relatedYear);
|
|
10278
|
+
}
|
|
10279
|
+
const year = parseInt(intlParts.year);
|
|
10280
|
+
return void 0 !== intlParts.era && "bce" === normalizeEraName(intlParts.era) ? 1 - year : year;
|
|
10281
|
+
})(intlParts), parseInt(intlParts.month), parseInt(intlParts.day)) + 3600 * parseInt(intlParts.hour) + 60 * parseInt(intlParts.minute) + parseInt(intlParts.second) - epochSec;
|
|
10282
|
+
})(format), (timeZoneId => {
|
|
10283
|
+
const timeZoneName = timeZoneId.split("/").pop();
|
|
10284
|
+
return timeZonePeriodDaysByName[timeZoneName] || 60;
|
|
10285
|
+
})(id));
|
|
10286
|
+
}
|
|
10287
|
+
C(epochNano) {
|
|
10288
|
+
return this.qe.De((epochNano => epochNanoToSecMod(epochNano)[0])(epochNano)) * nanoInSec;
|
|
10289
|
+
}
|
|
10290
|
+
R(isoDateTime) {
|
|
10291
|
+
const zonedEpochSec = 86400 * isoDateToEpochDays(isoDateTime) + timeFieldsToSec(isoDateTime);
|
|
10292
|
+
const subsecNano = timeFieldsToSubsecNano(isoDateTime);
|
|
10293
|
+
return this.qe.Ee(zonedEpochSec).map(epochSec => checkEpochNanoInBounds(BigInt(epochSec) * bigNanoInSec + BigInt(subsecNano)));
|
|
10294
|
+
}
|
|
10295
|
+
U(epochNano, direction) {
|
|
10296
|
+
const [epochSec, subsecNano] = epochNanoToSecMod(epochNano);
|
|
10297
|
+
const resEpochSec = this.qe.U(epochSec + (direction > 0 || subsecNano ? 1 : 0), direction);
|
|
10298
|
+
if (void 0 !== resEpochSec) {
|
|
10299
|
+
return BigInt(resEpochSec) * bigNanoInSec;
|
|
10300
|
+
}
|
|
10301
|
+
}
|
|
10302
|
+
}
|
|
10303
|
+
|
|
10304
|
+
function getCurrentEpochSec() {
|
|
10305
|
+
return Math.floor(Date.now() / 1e3);
|
|
10306
|
+
}
|
|
10307
|
+
|
|
10308
|
+
function createSplitTuple(startEpochSec, endEpochSec) {
|
|
10309
|
+
return [ startEpochSec, endEpochSec ];
|
|
10310
|
+
}
|
|
10311
|
+
|
|
10312
|
+
function computePeriod(epochSec, periodSec) {
|
|
10313
|
+
const startEpochSec = Math.floor(epochSec / periodSec) * periodSec;
|
|
10314
|
+
return [ startEpochSec, startEpochSec + periodSec ];
|
|
10315
|
+
}
|
|
10316
|
+
|
|
10317
|
+
function clampIntlSampleEpochSec(epochSec) {
|
|
10318
|
+
return constrainToRange(epochSec, -1e10, 864e10);
|
|
10319
|
+
}
|
|
10320
|
+
|
|
10321
|
+
function refinePlainDateObjectLike(calendar, bag, options, requireFields = []) {
|
|
10322
|
+
return createPlainDateFromFields(calendar, readAndRefineBagFields(bag, getCalendarFieldNames(calendar, dateFieldNamesAlpha, dateFieldNamesWithEraAlpha), dateFieldRefiners, requireFields), options);
|
|
10323
|
+
}
|
|
10324
|
+
|
|
10325
|
+
function throwFailedParse(s) {
|
|
10326
|
+
throwRangeError(failedParse(s));
|
|
10327
|
+
}
|
|
10328
|
+
|
|
10329
|
+
function parsePlainDate(s, resolveCalendar) {
|
|
10330
|
+
const slots = finalizeDateLike(parsePlainDateLike(requireString(s)), void 0, resolveCalendar);
|
|
10331
|
+
return createDateSlots(slots, slots.calendar);
|
|
10332
|
+
}
|
|
10333
|
+
|
|
10334
|
+
function parsePlainYearMonth(s, resolveCalendar) {
|
|
10335
|
+
const organized = parseYearMonthOnly(requireString(s));
|
|
10336
|
+
if (organized) {
|
|
10337
|
+
return requireIsoCalendar(organized), createDateSlots(checkIsoYearMonthInBounds(validateIsoDateFields(organized)), resolveCalendar(organized.calendarId));
|
|
10338
|
+
}
|
|
10339
|
+
const dateSlots = finalizeDateLike(parsePlainDateLike(s), projectIsoYearMonthDate, resolveCalendar);
|
|
10340
|
+
const {calendar: calendar} = dateSlots;
|
|
10341
|
+
return createDateSlots(moveToStartOfMonth(calendar, dateSlots), calendar);
|
|
10342
|
+
}
|
|
10343
|
+
|
|
10344
|
+
function requireIsoCalendar(organized) {
|
|
10345
|
+
"iso8601" !== organized.calendarId && throwRangeError(invalidSubstring(organized.calendarId));
|
|
10346
|
+
}
|
|
10347
|
+
|
|
10348
|
+
function parsePlainDateLike(s) {
|
|
10349
|
+
const organized = parseDateTimeLike(s);
|
|
10350
|
+
return organized && !organized.F || throwFailedParse(s), organized;
|
|
10351
|
+
}
|
|
10352
|
+
|
|
10353
|
+
function finalizeDateLike(organized, isoDateProjector, resolveCalendar) {
|
|
10354
|
+
return isoDateProjector && "iso8601" === organized.calendarId ? (validateIsoDateFields(organized),
|
|
10355
|
+
organized.fe && validateTimeFields(organized), finalizeDate(isoDateProjector(organized), resolveCalendar)) : organized.fe ? finalizeDateTime(organized, resolveCalendar) : finalizeDate(organized, resolveCalendar);
|
|
10356
|
+
}
|
|
10357
|
+
|
|
10358
|
+
function projectIsoYearMonthDate(organized) {
|
|
10359
|
+
const day = 12 * organized.year + organized.month === isoYearMonthIndexMin ? 20 : 1;
|
|
10360
|
+
return {
|
|
10361
|
+
...organized,
|
|
10362
|
+
day: day
|
|
10363
|
+
};
|
|
10364
|
+
}
|
|
10365
|
+
|
|
10366
|
+
function finalizeDateTime(organized, resolveCalendar) {
|
|
10367
|
+
return validateIsoDateTimeFields(organized), checkIsoDateTimeInBounds(organized),
|
|
10368
|
+
{
|
|
10369
|
+
...combineDateAndTime(organized, organized),
|
|
10370
|
+
calendar: resolveCalendar(organized.calendarId)
|
|
10371
|
+
};
|
|
10372
|
+
}
|
|
10373
|
+
|
|
10374
|
+
function finalizeDate(organized, resolveCalendar) {
|
|
10375
|
+
return validateIsoDateFields(organized), checkIsoDateInBounds(organized), {
|
|
10376
|
+
calendar: resolveCalendar(organized.calendarId),
|
|
10377
|
+
year: organized.year,
|
|
10378
|
+
month: organized.month,
|
|
10379
|
+
day: organized.day
|
|
10380
|
+
};
|
|
10381
|
+
}
|
|
10382
|
+
|
|
10383
|
+
function timeRegExpStr(separatorIndex) {
|
|
10384
|
+
return `(\\d{2})(?:(:?)(\\d{2})(?:\\${separatorIndex}(\\d{2})(?:[.,](\\d{1,9}))?)?)?`;
|
|
10385
|
+
}
|
|
10386
|
+
|
|
10387
|
+
function offsetRegExpStr(separatorIndex) {
|
|
10388
|
+
return "([+-])" + timeRegExpStr(separatorIndex);
|
|
10389
|
+
}
|
|
10390
|
+
|
|
10391
|
+
const dateTimeRegExpStr = "(?:(?:([+-])(\\d{6}))|(\\d{4}))(-?)(\\d{2})\\4(\\d{2})(?:[T ]" + timeRegExpStr(8) + "(Z|" + offsetRegExpStr(15) + ")?)?";
|
|
10392
|
+
|
|
10393
|
+
const yearMonthRegExp = /*@__PURE__*/ createRegExp("(?:(?:([+-])(\\d{6}))|(\\d{4}))-?(\\d{2})((?:\\[(!?)([^\\]]*)\\]){0,9})");
|
|
10394
|
+
|
|
10395
|
+
const dateTimeRegExp = /*@__PURE__*/ createRegExp(dateTimeRegExpStr + "((?:\\[(!?)([^\\]]*)\\]){0,9})");
|
|
10396
|
+
|
|
10397
|
+
const annotationRegExp = /*@__PURE__*/ new RegExp("\\[(!?)([^\\]]*)\\]", "g");
|
|
10398
|
+
|
|
10399
|
+
function parseDateTimeLike(s) {
|
|
10400
|
+
const parts = dateTimeRegExp.exec(s);
|
|
10401
|
+
return parts ? (parts => {
|
|
10402
|
+
const zOrOffset = parts[12];
|
|
10403
|
+
const hasZ = "Z" === (zOrOffset || "").toUpperCase();
|
|
10404
|
+
return {
|
|
10405
|
+
year: organizeIsoYearParts(parts),
|
|
10406
|
+
month: parseInt(parts[5]),
|
|
10407
|
+
day: parseInt(parts[6]),
|
|
10408
|
+
...organizeTimeParts(parts, 7),
|
|
10409
|
+
...organizeAnnotationParts(parts[19]),
|
|
10410
|
+
fe: Boolean(parts[7]),
|
|
10411
|
+
F: hasZ,
|
|
10412
|
+
offset: hasZ ? void 0 : zOrOffset
|
|
10413
|
+
};
|
|
10414
|
+
})(parts) : void 0;
|
|
10415
|
+
}
|
|
10416
|
+
|
|
10417
|
+
function parseYearMonthOnly(s) {
|
|
10418
|
+
const parts = yearMonthRegExp.exec(s);
|
|
10419
|
+
if (parts) {
|
|
10420
|
+
return (parts => ({
|
|
10421
|
+
year: organizeIsoYearParts(parts),
|
|
10422
|
+
month: parseInt(parts[4]),
|
|
10423
|
+
day: 1,
|
|
10424
|
+
...organizeAnnotationParts(parts[5])
|
|
10425
|
+
}))(parts);
|
|
10426
|
+
}
|
|
10427
|
+
}
|
|
10428
|
+
|
|
10429
|
+
function organizeTimeParts(parts, hourIndex) {
|
|
10430
|
+
const second = parseInt0(parts[hourIndex + 3]);
|
|
10431
|
+
return {
|
|
10432
|
+
...nanoToTimeAndDay(parseSubsecNano(parts[hourIndex + 4] || ""))[0],
|
|
10433
|
+
hour: parseInt0(parts[hourIndex]),
|
|
10434
|
+
minute: parseInt0(parts[hourIndex + 2]),
|
|
10435
|
+
second: 60 === second ? 59 : second
|
|
10436
|
+
};
|
|
10437
|
+
}
|
|
10438
|
+
|
|
10439
|
+
function organizeIsoYearParts(parts) {
|
|
10440
|
+
const yearSign = parseSign(parts[1]);
|
|
10441
|
+
const year = parseInt(parts[2] || parts[3]);
|
|
10442
|
+
return yearSign < 0 && !year && throwRangeError(invalidSubstring(-0)), yearSign * year;
|
|
10443
|
+
}
|
|
10444
|
+
|
|
10445
|
+
function organizeAnnotationParts(s) {
|
|
10446
|
+
let calendarIsCritical;
|
|
10447
|
+
let timeZoneId;
|
|
10448
|
+
const calendarIds = [];
|
|
10449
|
+
return s.replace(annotationRegExp, (whole, criticalStr, mainStr) => {
|
|
10450
|
+
const isCritical = Boolean(criticalStr);
|
|
10451
|
+
const [val, name] = mainStr.split("=").reverse();
|
|
10452
|
+
return name ? "u-ca" === name ? (calendarIds.push(val.toLowerCase()), calendarIsCritical || (calendarIsCritical = isCritical)) : (isCritical || /[A-Z]/.test(name)) && throwRangeError(invalidSubstring(whole)) : (timeZoneId && throwRangeError(invalidSubstring(whole)),
|
|
10453
|
+
timeZoneId = val), "";
|
|
10454
|
+
}), calendarIds.length > 1 && calendarIsCritical && throwRangeError(invalidSubstring(s)),
|
|
10455
|
+
{
|
|
10456
|
+
timeZoneId: timeZoneId,
|
|
10457
|
+
calendarId: calendarIds[0] || "iso8601"
|
|
10458
|
+
};
|
|
10459
|
+
}
|
|
10460
|
+
|
|
10461
|
+
function mergeCalendarFields(calendar, baseFields, additionalFields) {
|
|
10462
|
+
const merged = Object.assign(Object.create(null), baseFields);
|
|
10463
|
+
return spliceFields(merged, additionalFields, monthFieldNames), getCalendarEraOrigins(calendar) && (spliceFields(merged, additionalFields, allYearFieldNames),
|
|
10464
|
+
calendar && calendar.le && spliceFields(merged, additionalFields, monthDayFieldNames, eraYearFieldNames)),
|
|
10465
|
+
merged;
|
|
10466
|
+
}
|
|
10467
|
+
|
|
10468
|
+
function spliceFields(dest, additional, allPropNames, deletablePropNames) {
|
|
10469
|
+
let anyMatching = 0;
|
|
10470
|
+
const nonMatchingPropNames = [];
|
|
10471
|
+
for (const propName of allPropNames) {
|
|
10472
|
+
void 0 !== additional[propName] ? anyMatching = 1 : nonMatchingPropNames.push(propName);
|
|
10473
|
+
}
|
|
10474
|
+
if (Object.assign(dest, additional), anyMatching) {
|
|
10475
|
+
for (const deletablePropName of deletablePropNames || nonMatchingPropNames) {
|
|
10476
|
+
delete dest[deletablePropName];
|
|
10477
|
+
}
|
|
10478
|
+
}
|
|
10479
|
+
}
|
|
10480
|
+
|
|
10481
|
+
function convertPlainYearMonthToDate(calendar, input, bag) {
|
|
10482
|
+
return createPlainDateFromMergedFields(calendar, pluckProps(getCalendarFieldNames(calendar, yearMonthCodeFieldNamesAlpha, yearMonthCodeFieldNamesWithEraAlpha), input), readAndRefineBagFields(requireObjectLike(bag), dayFieldNamesAsc, dateFieldRefiners, []));
|
|
10483
|
+
}
|
|
10484
|
+
|
|
10485
|
+
function createPlainDateFromMergedFields(calendar, inputFields, extraFields) {
|
|
10486
|
+
const mergedFieldNames = getCalendarFieldNames(calendar, yearMonthCodeDayFieldNamesAlpha, yearMonthCodeDayFieldNamesWithEraAlpha);
|
|
10487
|
+
let mergedFields = mergeCalendarFields(calendar, inputFields, extraFields);
|
|
10488
|
+
return mergedFields = readAndRefineBagFields(mergedFields, mergedFieldNames, dateFieldRefiners, []),
|
|
10489
|
+
createPlainDateFromFields(calendar, mergedFields);
|
|
10490
|
+
}
|
|
10491
|
+
|
|
10492
|
+
function applyPlainFormatTimeZone(options) {
|
|
10493
|
+
return options.timeZone = "UTC", [ "full", "long" ].includes(options.timeStyle) && (options.timeStyle = "medium"),
|
|
10494
|
+
options;
|
|
10495
|
+
}
|
|
10496
|
+
|
|
10497
|
+
function checkResolvedCalendarCompatible(format, slots, strictCalendarCheck) {
|
|
10498
|
+
const resolvedCalendarId = format.resolvedOptions().calendar;
|
|
10499
|
+
slots.calendar === isoCalendarImpl || getCalendarSlotId(slots.calendar) === resolvedCalendarId || throwRangeError("Mismatching Calendars");
|
|
10500
|
+
}
|
|
10501
|
+
|
|
10502
|
+
function createOptionsTransformer(shapeFieldNames, invalidShapeFieldNames, ignoredFieldNames, defaultShapeFields, dateStyleReplacementFields) {
|
|
10503
|
+
const shapeFieldNameSet = new Set(shapeFieldNames);
|
|
10504
|
+
const invalidShapeFieldNameSet = new Set(invalidShapeFieldNames);
|
|
10505
|
+
const ignoredFieldNameSet = new Set(ignoredFieldNames);
|
|
10506
|
+
return (options, allowPartialOverlap) => {
|
|
10507
|
+
const analysis = ((options, shapeFieldNameSet, invalidShapeFieldNameSet, ignoredFieldNameSet) => {
|
|
10508
|
+
const analysis = {
|
|
10509
|
+
dateStyle: void 0,
|
|
10510
|
+
timeStyle: void 0,
|
|
10511
|
+
me: {},
|
|
10512
|
+
pe: {},
|
|
10513
|
+
xe: {},
|
|
10514
|
+
oe: 0,
|
|
10515
|
+
ue: 0
|
|
10516
|
+
};
|
|
10517
|
+
for (const name of Object.keys(options)) {
|
|
10518
|
+
const value = options[name];
|
|
10519
|
+
void 0 === value || ignoredFieldNameSet.has(name) || (shapeFieldNameSet.has(name) ? "dateStyle" === name ? analysis.dateStyle = value : "timeStyle" === name ? analysis.timeStyle = value : analysis.me[name] = value : "era" === name ? analysis.pe[name] = value : invalidShapeFieldNameSet.has(name) ? "dateStyle" === name || "timeStyle" === name ? analysis.ue = 1 : analysis.oe = 1 : analysis.xe[name] = value);
|
|
10520
|
+
}
|
|
10521
|
+
return analysis;
|
|
10522
|
+
})(options, shapeFieldNameSet, invalidShapeFieldNameSet, ignoredFieldNameSet);
|
|
10523
|
+
const hasDateStyle = void 0 !== analysis.dateStyle;
|
|
10524
|
+
const hasTimeStyle = void 0 !== analysis.timeStyle;
|
|
10525
|
+
const hasAnyStyle = hasDateStyle || hasTimeStyle;
|
|
10526
|
+
const hasGranularShapeFields = Object.keys(analysis.me).length > 0;
|
|
10527
|
+
const hasInvalids = analysis.oe || analysis.ue;
|
|
10528
|
+
const hasShapeFields = hasGranularShapeFields || hasDateStyle || hasTimeStyle;
|
|
10529
|
+
const hasModifierFields = Object.keys(analysis.pe).length > 0;
|
|
10530
|
+
const hasStyleConflictFields = hasGranularShapeFields || hasModifierFields || analysis.oe;
|
|
10531
|
+
(!allowPartialOverlap && hasInvalids || allowPartialOverlap && hasInvalids && !hasShapeFields || hasAnyStyle && hasStyleConflictFields) && throwTypeError("Invalid formatting options");
|
|
10532
|
+
const transformedOptions = {};
|
|
10533
|
+
return hasAnyStyle || hasShapeFields || Object.assign(transformedOptions, defaultShapeFields),
|
|
10534
|
+
Object.assign(transformedOptions, analysis.me, analysis.pe, analysis.xe),
|
|
10535
|
+
hasDateStyle && (dateStyleReplacementFields ? Object.assign(transformedOptions, dateStyleReplacementFields[analysis.dateStyle]) : transformedOptions.dateStyle = analysis.dateStyle),
|
|
10536
|
+
hasTimeStyle && (transformedOptions.timeStyle = analysis.timeStyle), transformedOptions;
|
|
10537
|
+
};
|
|
10538
|
+
}
|
|
10539
|
+
|
|
10540
|
+
const dateDefaultShapeFields = {
|
|
10541
|
+
year: "numeric",
|
|
10542
|
+
month: "numeric",
|
|
10543
|
+
day: "numeric"
|
|
10544
|
+
};
|
|
10545
|
+
|
|
10546
|
+
const dateShapeFieldNames = [ "weekday", "year", "month", "day", "dateStyle" ];
|
|
10547
|
+
|
|
10548
|
+
const timeShapeFieldNames = [ "dayPeriod", "hour", "minute", "second", "fractionalSecondDigits", "timeStyle" ];
|
|
10549
|
+
|
|
10550
|
+
const transformDateOptions = /*@__PURE__*/ createOptionsTransformer(dateShapeFieldNames, timeShapeFieldNames, [ "timeZoneName" ], dateDefaultShapeFields);
|
|
10551
|
+
|
|
10552
|
+
function getCurrentIsoDateTime(timeZone) {
|
|
10553
|
+
const epochNano = getCurrentEpochNano();
|
|
10554
|
+
const offsetNano = timeZone.C(epochNano);
|
|
10555
|
+
return epochNanoToIsoDateTime(epochNano + BigInt(offsetNano));
|
|
10556
|
+
}
|
|
10557
|
+
|
|
10558
|
+
function getCurrentEpochNano() {
|
|
10559
|
+
return BigInt(Date.now()) * bigNanoInMilli;
|
|
10560
|
+
}
|
|
10561
|
+
|
|
10562
|
+
function getCurrentTimeZoneId() {
|
|
10563
|
+
return (new RawDateTimeFormat).resolvedOptions().timeZone;
|
|
10564
|
+
}
|
|
10565
|
+
|
|
10566
|
+
const PlainYearMonthBranding = "PlainYearMonth";
|
|
10567
|
+
|
|
10568
|
+
const PlainDateBranding = "PlainDate";
|
|
10569
|
+
|
|
10570
|
+
const CalendarBranding = "Calendar";
|
|
10571
|
+
|
|
10572
|
+
function defineTemporalClass(branding, cls, getSlots, ...getterMaps) {
|
|
10573
|
+
Object.defineProperties(cls, createNameDescriptors(branding)), Object.defineProperties(cls.prototype, createStringTagDescriptors("Temporal." + branding));
|
|
10574
|
+
for (const getterMap of getterMaps) {
|
|
10575
|
+
defineSlotGetters(cls.prototype, getSlots, getterMap);
|
|
10576
|
+
}
|
|
10577
|
+
return cls;
|
|
10578
|
+
}
|
|
10579
|
+
|
|
10580
|
+
function defineSlotGetters(destPrototype, getSlots, getterMap) {
|
|
10581
|
+
Object.defineProperties(destPrototype, mapProps(getter => ({
|
|
10582
|
+
get() {
|
|
10583
|
+
return getter(getSlots(this));
|
|
10584
|
+
},
|
|
10585
|
+
configurable: 1
|
|
10586
|
+
}), getterMap));
|
|
10587
|
+
}
|
|
10588
|
+
|
|
10589
|
+
const attachDebugString = "noop" === noop.name ? instance => {
|
|
10590
|
+
Object.defineProperty(instance, "_str_", {
|
|
10591
|
+
value: instance.toJSON()
|
|
10592
|
+
});
|
|
10593
|
+
} : noop;
|
|
10594
|
+
|
|
10595
|
+
function invalidRecordType() {
|
|
10596
|
+
throwTypeError(invalidCallingContext);
|
|
10597
|
+
}
|
|
10598
|
+
|
|
10599
|
+
function forbiddenValueOf() {
|
|
10600
|
+
throwTypeError(forbiddenValueOf$1);
|
|
10601
|
+
}
|
|
10602
|
+
|
|
10603
|
+
const yearMonthFieldGetters$1 = {
|
|
10604
|
+
era(slots) {
|
|
10605
|
+
return computeCalendarEraFields(slots.calendar, slots).era;
|
|
10606
|
+
},
|
|
10607
|
+
eraYear(slots) {
|
|
10608
|
+
return computeCalendarEraFields(slots.calendar, slots).eraYear;
|
|
10609
|
+
},
|
|
10610
|
+
year(slots) {
|
|
10611
|
+
return computeCalendarDateFields(slots.calendar, slots).year;
|
|
10612
|
+
},
|
|
10613
|
+
month(slots) {
|
|
10614
|
+
return computeCalendarDateFields(slots.calendar, slots).month;
|
|
10615
|
+
},
|
|
10616
|
+
monthCode(slots) {
|
|
10617
|
+
return computeCalendarMonthCode(slots.calendar, slots);
|
|
10618
|
+
}
|
|
10619
|
+
};
|
|
10620
|
+
|
|
10621
|
+
const dateFieldGetters$1 = {
|
|
10622
|
+
era(slots) {
|
|
10623
|
+
return computeCalendarEraFields(slots.calendar, slots).era;
|
|
10624
|
+
},
|
|
10625
|
+
eraYear(slots) {
|
|
10626
|
+
return computeCalendarEraFields(slots.calendar, slots).eraYear;
|
|
10627
|
+
},
|
|
10628
|
+
year(slots) {
|
|
10629
|
+
return computeCalendarDateFields(slots.calendar, slots).year;
|
|
10630
|
+
},
|
|
10631
|
+
month(slots) {
|
|
10632
|
+
return computeCalendarDateFields(slots.calendar, slots).month;
|
|
10633
|
+
},
|
|
10634
|
+
monthCode(slots) {
|
|
10635
|
+
return computeCalendarMonthCode(slots.calendar, slots);
|
|
10636
|
+
},
|
|
10637
|
+
day(slots) {
|
|
10638
|
+
return computeCalendarDateFields(slots.calendar, slots).day;
|
|
10639
|
+
}
|
|
10640
|
+
};
|
|
10641
|
+
|
|
10642
|
+
const yearMonthDerivedGetters = {
|
|
10643
|
+
daysInMonth(slots) {
|
|
10644
|
+
return computeCalendarDaysInMonth(slots.calendar, slots);
|
|
10645
|
+
},
|
|
10646
|
+
daysInYear(slots) {
|
|
10647
|
+
return computeCalendarDaysInYear(slots.calendar, slots);
|
|
10648
|
+
},
|
|
10649
|
+
monthsInYear(slots) {
|
|
10650
|
+
return computeCalendarMonthsInYear(slots.calendar, slots);
|
|
10651
|
+
},
|
|
10652
|
+
inLeapYear(slots) {
|
|
10653
|
+
return computeCalendarInLeapYear(slots.calendar, slots);
|
|
10654
|
+
}
|
|
10655
|
+
};
|
|
10656
|
+
|
|
10657
|
+
const dateDerivedGetters = {
|
|
10658
|
+
dayOfWeek(slots) {
|
|
10659
|
+
return computeIsoDayOfWeek(slots);
|
|
10660
|
+
},
|
|
10661
|
+
dayOfYear(slots) {
|
|
10662
|
+
return computeCalendarDayOfYear(slots.calendar, slots);
|
|
10663
|
+
},
|
|
10664
|
+
weekOfYear(slots) {
|
|
10665
|
+
return computeCalendarWeekOfYear(slots.calendar, slots);
|
|
10666
|
+
},
|
|
10667
|
+
yearOfWeek(slots) {
|
|
10668
|
+
return computeCalendarYearOfWeek(slots.calendar, slots);
|
|
10669
|
+
},
|
|
10670
|
+
daysInWeek() {
|
|
10671
|
+
return 7;
|
|
10672
|
+
},
|
|
10673
|
+
daysInMonth(slots) {
|
|
10674
|
+
return computeCalendarDaysInMonth(slots.calendar, slots);
|
|
10675
|
+
},
|
|
10676
|
+
daysInYear(slots) {
|
|
10677
|
+
return computeCalendarDaysInYear(slots.calendar, slots);
|
|
10678
|
+
},
|
|
10679
|
+
monthsInYear(slots) {
|
|
10680
|
+
return computeCalendarMonthsInYear(slots.calendar, slots);
|
|
10681
|
+
},
|
|
10682
|
+
inLeapYear(slots) {
|
|
10683
|
+
return computeCalendarInLeapYear(slots.calendar, slots);
|
|
10684
|
+
}
|
|
10685
|
+
};
|
|
10686
|
+
|
|
10687
|
+
function createNativeGetters(shimGetters) {
|
|
10688
|
+
return createPropGetters(Object.keys(shimGetters));
|
|
10689
|
+
}
|
|
10690
|
+
|
|
10691
|
+
const yearMonthFieldGetters = /*@__PURE__*/ createNativeGetters(yearMonthFieldGetters$1);
|
|
10692
|
+
|
|
10693
|
+
const dateFieldGetters = /*@__PURE__*/ createNativeGetters(dateFieldGetters$1);
|
|
10694
|
+
|
|
10695
|
+
createNativeGetters(yearMonthDerivedGetters), createNativeGetters(dateDerivedGetters);
|
|
10696
|
+
|
|
10697
|
+
const PlainYearMonthRecordBranding = `${PlainYearMonthBranding}Record`;
|
|
10698
|
+
|
|
10699
|
+
const PlainDateRecordBranding = `${PlainDateBranding}Record`;
|
|
10700
|
+
|
|
10701
|
+
const CalendarRecordBranding = `${CalendarBranding}Record`;
|
|
10702
|
+
|
|
10703
|
+
const calendarMap = /*@__PURE__*/ new WeakMap;
|
|
10704
|
+
|
|
10705
|
+
const plainDateMap = /*@__PURE__*/ new WeakMap;
|
|
10706
|
+
|
|
10707
|
+
const plainYearMonthMap = /*@__PURE__*/ new WeakMap;
|
|
10708
|
+
|
|
10709
|
+
function getCalendarSlots(record) {
|
|
10710
|
+
return getCalendarSlotsIfPresent(record) || invalidRecordType();
|
|
10711
|
+
}
|
|
10712
|
+
|
|
10713
|
+
function getCalendarSlotsIfPresent(record) {
|
|
10714
|
+
return calendarMap.get(record);
|
|
10715
|
+
}
|
|
10716
|
+
|
|
10717
|
+
function getPlainDateSlots(record) {
|
|
10718
|
+
return getPlainDateSlotsIfPresent(record) || invalidRecordType();
|
|
10719
|
+
}
|
|
10720
|
+
|
|
10721
|
+
function getPlainDateSlotsIfPresent(record) {
|
|
10722
|
+
return plainDateMap.get(record);
|
|
10723
|
+
}
|
|
10724
|
+
|
|
10725
|
+
function setPlainDateSlots(instance, slots) {
|
|
10726
|
+
plainDateMap.set(instance, slots);
|
|
10727
|
+
}
|
|
10728
|
+
|
|
10729
|
+
function isPlainYearMonthRecord(record) {
|
|
10730
|
+
return !!getPlainYearMonthSlotsIfPresent(record);
|
|
10731
|
+
}
|
|
10732
|
+
|
|
10733
|
+
function getPlainYearMonthSlots(record) {
|
|
10734
|
+
return getPlainYearMonthSlotsIfPresent(record) || invalidRecordType();
|
|
10735
|
+
}
|
|
10736
|
+
|
|
10737
|
+
function getPlainYearMonthSlotsIfPresent(record) {
|
|
10738
|
+
return plainYearMonthMap.get(record);
|
|
10739
|
+
}
|
|
10740
|
+
|
|
10741
|
+
function setPlainYearMonthSlots(instance, slots) {
|
|
10742
|
+
plainYearMonthMap.set(instance, slots);
|
|
10743
|
+
}
|
|
10744
|
+
|
|
10745
|
+
const CalendarRecord = /*@__PURE__*/ defineTemporalClass(CalendarRecordBranding, class {
|
|
10746
|
+
toJSON() {
|
|
10747
|
+
return getCalendarRecordId(this);
|
|
10748
|
+
}
|
|
10749
|
+
valueOf() {
|
|
10750
|
+
return getCalendarRecordId(this);
|
|
10751
|
+
}
|
|
10752
|
+
});
|
|
10753
|
+
|
|
10754
|
+
function createCalendarRecord(id, getImpl) {
|
|
10755
|
+
const instance = Object.create(CalendarRecord.prototype);
|
|
10756
|
+
return ((instance, slots) => {
|
|
10757
|
+
calendarMap.set(instance, slots);
|
|
10758
|
+
})(instance, {
|
|
10759
|
+
id: id,
|
|
10760
|
+
Be: getImpl
|
|
10761
|
+
}), attachDebugString(instance), instance;
|
|
10762
|
+
}
|
|
10763
|
+
|
|
10764
|
+
function getCalendarRecordId(record) {
|
|
10765
|
+
return getCalendarSlots(record).id;
|
|
10766
|
+
}
|
|
10767
|
+
|
|
10768
|
+
function getCalendarRecordImplCreator(record) {
|
|
10769
|
+
const getImpl = getCalendarSlots(record).Be;
|
|
10770
|
+
return getImpl || throwRangeError(exoticCalendarRequired(getCalendarRecordId(record), "getExotic or getAny")),
|
|
10771
|
+
getImpl;
|
|
10772
|
+
}
|
|
10773
|
+
|
|
10774
|
+
const isoCalendarRecord = /*@__PURE__*/ createCalendarRecord(isoCalendarId, () => isoCalendarImpl);
|
|
10775
|
+
|
|
10776
|
+
const gregoryCalendarRecord = /*@__PURE__*/ createCalendarRecord(gregoryCalendarId, () => gregoryCalendarImpl);
|
|
10777
|
+
|
|
10778
|
+
function getBasic(rawCalendarId) {
|
|
10779
|
+
const lowerRawCalendarId = requireString(rawCalendarId).toLowerCase();
|
|
10780
|
+
return lowerRawCalendarId === isoCalendarId ? isoCalendarRecord : lowerRawCalendarId === gregoryCalendarId ? gregoryCalendarRecord : getOrCreateUnknownRecord(rawCalendarId);
|
|
10781
|
+
}
|
|
10782
|
+
|
|
10783
|
+
const getOrCreateUnknownRecord = /*@__PURE__*/ memoize(createCalendarRecord);
|
|
10784
|
+
|
|
10785
|
+
const NativeTemporal = globalThis.Temporal;
|
|
10786
|
+
|
|
10787
|
+
function refineNativeCalendarArgMaybe(calendarRecord) {
|
|
10788
|
+
if (void 0 !== calendarRecord) {
|
|
10789
|
+
return getValidatedCalendarId(calendarRecord);
|
|
10790
|
+
}
|
|
10791
|
+
}
|
|
10792
|
+
|
|
10793
|
+
function runNativeCalendarResolver(canonicalCalendarId, getCalendarRecord) {
|
|
10794
|
+
getValidatedCalendarId(getCalendarRecord(canonicalCalendarId));
|
|
10795
|
+
}
|
|
10796
|
+
|
|
10797
|
+
function getValidatedCalendarId(record) {
|
|
10798
|
+
return getCalendarRecordImplCreator(record), getCalendarRecordId(record);
|
|
10799
|
+
}
|
|
10800
|
+
|
|
10801
|
+
const getNativePlainYearMonth = getPlainYearMonthSlots;
|
|
10802
|
+
|
|
10803
|
+
const NativePlainYearMonthRecord = /*@__PURE__*/ defineTemporalClass(PlainYearMonthRecordBranding, class {
|
|
10804
|
+
get calendarId() {
|
|
10805
|
+
return getNativePlainYearMonth(this).calendarId;
|
|
10806
|
+
}
|
|
10807
|
+
toJSON() {
|
|
10808
|
+
return getNativePlainYearMonth(this).toJSON();
|
|
10809
|
+
}
|
|
10810
|
+
valueOf() {
|
|
10811
|
+
return getNativePlainYearMonth(this).valueOf();
|
|
10812
|
+
}
|
|
10813
|
+
}, getNativePlainYearMonth, yearMonthFieldGetters);
|
|
10814
|
+
|
|
10815
|
+
function createNativePlainYearMonthRecord(native) {
|
|
10816
|
+
const instance = Object.create(NativePlainYearMonthRecord.prototype);
|
|
10817
|
+
return setPlainYearMonthSlots(instance, native), attachDebugString(instance), instance;
|
|
10818
|
+
}
|
|
10819
|
+
|
|
10820
|
+
function fromString$3$1(s, getCalendarRecord) {
|
|
10821
|
+
const resNative = NativeTemporal.PlainYearMonth.from(s);
|
|
10822
|
+
return runNativeCalendarResolver(resNative.calendarId, getCalendarRecord), createNativePlainYearMonthRecord(resNative);
|
|
10823
|
+
}
|
|
10824
|
+
|
|
10825
|
+
function daysInMonth$2$1(record) {
|
|
10826
|
+
return getNativePlainYearMonth(record).daysInMonth;
|
|
10827
|
+
}
|
|
10828
|
+
|
|
10829
|
+
function compare$3$1(record, otherRecord) {
|
|
10830
|
+
const native = getNativePlainYearMonth(record);
|
|
10831
|
+
const otherNative = getNativePlainYearMonth(otherRecord);
|
|
10832
|
+
return NativeTemporal.PlainYearMonth.compare(native, otherNative);
|
|
10833
|
+
}
|
|
10834
|
+
|
|
10835
|
+
function toString$3$1(record, options) {
|
|
10836
|
+
return getNativePlainYearMonth(record).toString(options);
|
|
10837
|
+
}
|
|
10838
|
+
|
|
10839
|
+
function toPlainDate$1$1(record, fields) {
|
|
10840
|
+
return createNativePlainDateRecord(getNativePlainYearMonth(record).toPlainDate(fields));
|
|
10841
|
+
}
|
|
10842
|
+
|
|
10843
|
+
function addMonths$2$1(record, months, options) {
|
|
10844
|
+
return createNativePlainYearMonthRecord(getNativePlainYearMonth(record).add({
|
|
10845
|
+
months: months
|
|
10846
|
+
}, options));
|
|
10847
|
+
}
|
|
10848
|
+
|
|
10849
|
+
const getNativePlainDate = getPlainDateSlots;
|
|
10850
|
+
|
|
10851
|
+
const NativePlainDateRecord = /*@__PURE__*/ defineTemporalClass(PlainDateRecordBranding, class {
|
|
10852
|
+
get calendarId() {
|
|
10853
|
+
return getNativePlainDate(this).calendarId;
|
|
10854
|
+
}
|
|
10855
|
+
toJSON() {
|
|
10856
|
+
return getNativePlainDate(this).toJSON();
|
|
10857
|
+
}
|
|
10858
|
+
valueOf() {
|
|
10859
|
+
return getNativePlainDate(this).valueOf();
|
|
10860
|
+
}
|
|
10861
|
+
}, getNativePlainDate, dateFieldGetters);
|
|
10862
|
+
|
|
10863
|
+
function createNativePlainDateRecord(native) {
|
|
10864
|
+
const instance = Object.create(NativePlainDateRecord.prototype);
|
|
10865
|
+
return setPlainDateSlots(instance, native), attachDebugString(instance), instance;
|
|
10866
|
+
}
|
|
10867
|
+
|
|
10868
|
+
function fromFields$1$1(fields, options) {
|
|
10869
|
+
const calendar = refineNativeCalendarArgMaybe(fields.calendar);
|
|
10870
|
+
return createNativePlainDateRecord(NativeTemporal.PlainDate.from({
|
|
10871
|
+
...fields,
|
|
10872
|
+
calendar: calendar
|
|
10873
|
+
}, options));
|
|
10874
|
+
}
|
|
10875
|
+
|
|
10876
|
+
function fromString$2$1(s, getCalendarRecord) {
|
|
10877
|
+
const resNative = NativeTemporal.PlainDate.from(s);
|
|
10878
|
+
return runNativeCalendarResolver(resNative.calendarId, getCalendarRecord), createNativePlainDateRecord(resNative);
|
|
10879
|
+
}
|
|
10880
|
+
|
|
10881
|
+
function dayOfWeek$1$1(record) {
|
|
10882
|
+
return getNativePlainDate(record).dayOfWeek;
|
|
10883
|
+
}
|
|
10884
|
+
|
|
10885
|
+
function compare$2$1(record, otherRecord) {
|
|
10886
|
+
const native = getNativePlainDate(record);
|
|
10887
|
+
const otherNative = getNativePlainDate(otherRecord);
|
|
10888
|
+
return NativeTemporal.PlainDate.compare(native, otherNative);
|
|
10889
|
+
}
|
|
10890
|
+
|
|
10891
|
+
function toLocaleString$2$1(record, locales, options) {
|
|
10892
|
+
return getNativePlainDate(record).toLocaleString(locales, options);
|
|
10893
|
+
}
|
|
10894
|
+
|
|
10895
|
+
function toString$2$1(record, options) {
|
|
10896
|
+
return getNativePlainDate(record).toString(options);
|
|
10897
|
+
}
|
|
10898
|
+
|
|
10899
|
+
function toPlainYearMonth$2(record) {
|
|
10900
|
+
return createNativePlainYearMonthRecord(getNativePlainDate(record).toPlainYearMonth());
|
|
10901
|
+
}
|
|
10902
|
+
|
|
10903
|
+
function addYears$1$1(record, years, options) {
|
|
10904
|
+
return createNativePlainDateRecord(getNativePlainDate(record).add({
|
|
10905
|
+
years: years
|
|
10906
|
+
}, options));
|
|
10907
|
+
}
|
|
10908
|
+
|
|
10909
|
+
function addMonths$1$2(record, months, options) {
|
|
10910
|
+
return createNativePlainDateRecord(getNativePlainDate(record).add({
|
|
10911
|
+
months: months
|
|
10912
|
+
}, options));
|
|
10913
|
+
}
|
|
10914
|
+
|
|
10915
|
+
function addDays$1$1(record, days) {
|
|
10916
|
+
return createNativePlainDateRecord(getNativePlainDate(record).add({
|
|
10917
|
+
days: days
|
|
10918
|
+
}));
|
|
10919
|
+
}
|
|
10920
|
+
|
|
10921
|
+
function plainDateISO$2(timeZoneId) {
|
|
10922
|
+
return createNativePlainDateRecord(NativeTemporal.Now.plainDateISO(timeZoneId));
|
|
10923
|
+
}
|
|
10924
|
+
|
|
10925
|
+
function refineShimCalendarArgMaybe(calendarRecord) {
|
|
10926
|
+
return void 0 === calendarRecord ? isoCalendarImpl : getCalendarRecordImpl(calendarRecord);
|
|
10927
|
+
}
|
|
10928
|
+
|
|
10929
|
+
function createShimCalendarStringResolver(getCalendarRecord) {
|
|
10930
|
+
return calendarId => getCalendarRecordImpl(getCalendarRecord(calendarId.toLowerCase()));
|
|
10931
|
+
}
|
|
10932
|
+
|
|
10933
|
+
function getCalendarRecordImpl(record) {
|
|
10934
|
+
return getCalendarRecordImplCreator(record)();
|
|
10935
|
+
}
|
|
10936
|
+
|
|
10937
|
+
function moveByYears(calendar, isoDate, years, options) {
|
|
10938
|
+
const overflow = refineOverflowOptions(options);
|
|
10939
|
+
return years ? addDateMonths(calendar, isoDate, toStrictInteger(years), 0, overflow) : isoDate;
|
|
10940
|
+
}
|
|
10941
|
+
|
|
10942
|
+
function moveByMonths(calendar, isoDate, months, options) {
|
|
10943
|
+
const overflow = refineOverflowOptions(options);
|
|
10944
|
+
return months ? addDateMonths(calendar, isoDate, 0, toStrictInteger(months), overflow) : isoDate;
|
|
10945
|
+
}
|
|
10946
|
+
|
|
10947
|
+
function moveByDaysStrict(_calendar, isoDate, days) {
|
|
10948
|
+
return moveByDays(isoDate, toStrictInteger(days));
|
|
10949
|
+
}
|
|
10950
|
+
|
|
10951
|
+
const getShimPlainYearMonthSlots = getPlainYearMonthSlots;
|
|
10952
|
+
|
|
10953
|
+
const ShimPlainYearMonthRecord = /*@__PURE__*/ defineTemporalClass(PlainYearMonthRecordBranding, class {
|
|
10954
|
+
get calendarId() {
|
|
10955
|
+
return getCalendarSlotId(getShimPlainYearMonthSlots(this).calendar);
|
|
10956
|
+
}
|
|
10957
|
+
toJSON() {
|
|
10958
|
+
return formatYearMonthIsoAuto(getShimPlainYearMonthSlots(this));
|
|
10959
|
+
}
|
|
10960
|
+
valueOf() {
|
|
10961
|
+
return forbiddenValueOf();
|
|
10962
|
+
}
|
|
10963
|
+
}, getShimPlainYearMonthSlots, yearMonthFieldGetters$1);
|
|
10964
|
+
|
|
10965
|
+
function createShimPlainYearMonthRecord(slots) {
|
|
10966
|
+
const instance = Object.create(ShimPlainYearMonthRecord.prototype);
|
|
10967
|
+
return setPlainYearMonthSlots(instance, slots), attachDebugString(instance), instance;
|
|
10968
|
+
}
|
|
10969
|
+
|
|
10970
|
+
function fromString$3(s, getCalendarRecord) {
|
|
10971
|
+
return createShimPlainYearMonthRecord(parsePlainYearMonth(s, createShimCalendarStringResolver(getCalendarRecord)));
|
|
10972
|
+
}
|
|
10973
|
+
|
|
10974
|
+
function daysInMonth$2(record) {
|
|
10975
|
+
const slots = getShimPlainYearMonthSlots(record);
|
|
10976
|
+
return computeCalendarDaysInMonth(slots.calendar, slots);
|
|
10977
|
+
}
|
|
10978
|
+
|
|
10979
|
+
function compare$3(record, otherRecord) {
|
|
10980
|
+
const slots = getShimPlainYearMonthSlots(record);
|
|
10981
|
+
const otherSlots = getShimPlainYearMonthSlots(otherRecord);
|
|
10982
|
+
return compareIsoDateFields(slots, otherSlots);
|
|
10983
|
+
}
|
|
10984
|
+
|
|
10985
|
+
function toString$3(record, options) {
|
|
10986
|
+
return formatPlainYearMonthIso(getShimPlainYearMonthSlots(record), options);
|
|
10987
|
+
}
|
|
10988
|
+
|
|
10989
|
+
function toPlainDate$1(record, fields) {
|
|
10990
|
+
const slots = getShimPlainYearMonthSlots(record);
|
|
10991
|
+
return createShimPlainDateRecord(convertPlainYearMonthToDate(slots.calendar, record, fields));
|
|
10992
|
+
}
|
|
10993
|
+
|
|
10994
|
+
function addMonths$2(record, months, options) {
|
|
10995
|
+
const slots = getShimPlainYearMonthSlots(record);
|
|
10996
|
+
return createShimPlainYearMonthRecord(createDateSlots(moveYearMonth(0, slots.calendar, slots, createDurationSlots(validateDurationFields({
|
|
10997
|
+
...durationFieldDefaults,
|
|
10998
|
+
months: toStrictInteger(months)
|
|
10999
|
+
})), options), slots.calendar));
|
|
11000
|
+
}
|
|
11001
|
+
|
|
11002
|
+
const getShimPlainDateSlots = getPlainDateSlots;
|
|
11003
|
+
|
|
11004
|
+
const ShimPlainDateRecord = /*@__PURE__*/ defineTemporalClass(PlainDateRecordBranding, class {
|
|
11005
|
+
get calendarId() {
|
|
11006
|
+
return getCalendarSlotId(getShimPlainDateSlots(this).calendar);
|
|
11007
|
+
}
|
|
11008
|
+
toJSON() {
|
|
11009
|
+
return formatDateIsoAuto(getShimPlainDateSlots(this));
|
|
11010
|
+
}
|
|
11011
|
+
valueOf() {
|
|
11012
|
+
return forbiddenValueOf();
|
|
11013
|
+
}
|
|
11014
|
+
}, getShimPlainDateSlots, dateFieldGetters$1);
|
|
11015
|
+
|
|
11016
|
+
function createShimPlainDateRecord(slots) {
|
|
11017
|
+
const instance = Object.create(ShimPlainDateRecord.prototype);
|
|
11018
|
+
return setPlainDateSlots(instance, slots), attachDebugString(instance), instance;
|
|
11019
|
+
}
|
|
11020
|
+
|
|
11021
|
+
function fromFields$1(fields, options) {
|
|
11022
|
+
const calendarImpl = refineShimCalendarArgMaybe(fields.calendar);
|
|
11023
|
+
return createShimPlainDateRecord(refinePlainDateObjectLike(calendarImpl, fields, options));
|
|
11024
|
+
}
|
|
11025
|
+
|
|
11026
|
+
function fromString$2(s, getCalendarRecord) {
|
|
11027
|
+
return createShimPlainDateRecord(parsePlainDate(s, createShimCalendarStringResolver(getCalendarRecord)));
|
|
11028
|
+
}
|
|
11029
|
+
|
|
11030
|
+
function dayOfWeek$1(record) {
|
|
11031
|
+
return computeIsoDayOfWeek(getShimPlainDateSlots(record));
|
|
11032
|
+
}
|
|
11033
|
+
|
|
11034
|
+
function compare$2(record, otherRecord) {
|
|
11035
|
+
const slots = getShimPlainDateSlots(record);
|
|
11036
|
+
const otherSlots = getShimPlainDateSlots(otherRecord);
|
|
11037
|
+
return compareIsoDateFields(slots, otherSlots);
|
|
11038
|
+
}
|
|
11039
|
+
|
|
11040
|
+
function toLocaleString$2(record, locales = void 0, options = {}) {
|
|
11041
|
+
const slots = getShimPlainDateSlots(record);
|
|
11042
|
+
const format = new RawDateTimeFormat(locales, applyPlainFormatTimeZone(transformDateOptions(options)));
|
|
11043
|
+
return checkResolvedCalendarCompatible(format, slots), format.format(isoDateToEpochMilli(slots));
|
|
11044
|
+
}
|
|
11045
|
+
|
|
11046
|
+
function toString$2(record, options) {
|
|
11047
|
+
return formatPlainDateIso(getShimPlainDateSlots(record), options);
|
|
11048
|
+
}
|
|
11049
|
+
|
|
11050
|
+
function toPlainYearMonth$1(record) {
|
|
11051
|
+
const slots = getShimPlainDateSlots(record);
|
|
11052
|
+
const calendarDate = computeCalendarDateFields(slots.calendar, slots);
|
|
11053
|
+
return createShimPlainYearMonthRecord(createPlainYearMonthFromFields(slots.calendar, {
|
|
11054
|
+
year: calendarDate.year,
|
|
11055
|
+
monthCode: computeCalendarMonthCode(slots.calendar, slots)
|
|
11056
|
+
}));
|
|
11057
|
+
}
|
|
11058
|
+
|
|
11059
|
+
function addYears$1(record, years, options) {
|
|
11060
|
+
const slots = getShimPlainDateSlots(record);
|
|
11061
|
+
return createRecordFromDateFields(createDateSlots(moveByYears(slots.calendar, slots, years, options), slots.calendar));
|
|
11062
|
+
}
|
|
11063
|
+
|
|
11064
|
+
function addMonths$1$1(record, months, options) {
|
|
11065
|
+
const slots = getShimPlainDateSlots(record);
|
|
11066
|
+
return createRecordFromDateFields(createDateSlots(moveByMonths(slots.calendar, slots, months, options), slots.calendar));
|
|
11067
|
+
}
|
|
11068
|
+
|
|
11069
|
+
function addDays$1(record, days) {
|
|
11070
|
+
const slots = getShimPlainDateSlots(record);
|
|
11071
|
+
return createRecordFromDateFields(createDateSlots(moveByDaysStrict(slots.calendar, slots, days), slots.calendar));
|
|
11072
|
+
}
|
|
11073
|
+
|
|
11074
|
+
function createRecordFromDateFields(isoDate) {
|
|
11075
|
+
return checkIsoDateInBounds(isoDate), createShimPlainDateRecord(createDateSlots(isoDate, isoDate.calendar));
|
|
11076
|
+
}
|
|
11077
|
+
|
|
11078
|
+
function plainDateISO$1(timeZoneId = getCurrentTimeZoneId()) {
|
|
11079
|
+
const isoDateTime = getCurrentIsoDateTime(queryTimeZone(refineTimeZoneId(timeZoneId)));
|
|
11080
|
+
return createShimPlainDateRecord(createDateSlots(isoDateTime));
|
|
11081
|
+
}
|
|
11082
|
+
|
|
11083
|
+
const plainDateISO = NativeTemporal ? plainDateISO$2 : plainDateISO$1;
|
|
11084
|
+
|
|
11085
|
+
const fromFields = NativeTemporal ? fromFields$1$1 : fromFields$1;
|
|
11086
|
+
|
|
11087
|
+
const fromString$1 = NativeTemporal ? fromString$2$1 : fromString$2;
|
|
11088
|
+
|
|
11089
|
+
const dayOfWeek = NativeTemporal ? dayOfWeek$1$1 : dayOfWeek$1;
|
|
11090
|
+
|
|
11091
|
+
const compare$1 = NativeTemporal ? compare$2$1 : compare$2;
|
|
11092
|
+
|
|
11093
|
+
const toLocaleString = NativeTemporal ? toLocaleString$2$1 : toLocaleString$2;
|
|
11094
|
+
|
|
11095
|
+
const toString$1 = NativeTemporal ? toString$2$1 : toString$2;
|
|
11096
|
+
|
|
11097
|
+
const toPlainYearMonth = NativeTemporal ? toPlainYearMonth$2 : toPlainYearMonth$1;
|
|
11098
|
+
|
|
11099
|
+
const addYears = NativeTemporal ? addYears$1$1 : addYears$1;
|
|
11100
|
+
|
|
11101
|
+
const addMonths$1 = NativeTemporal ? addMonths$1$2 : addMonths$1$1;
|
|
11102
|
+
|
|
11103
|
+
const addDays = NativeTemporal ? addDays$1$1 : addDays$1;
|
|
11104
|
+
|
|
11105
|
+
const isRecord = isPlainYearMonthRecord;
|
|
11106
|
+
|
|
11107
|
+
const fromString = NativeTemporal ? fromString$3$1 : fromString$3;
|
|
11108
|
+
|
|
11109
|
+
const daysInMonth = NativeTemporal ? daysInMonth$2$1 : daysInMonth$2;
|
|
11110
|
+
|
|
11111
|
+
const compare = NativeTemporal ? compare$3$1 : compare$3;
|
|
11112
|
+
|
|
11113
|
+
const toString = NativeTemporal ? toString$3$1 : toString$3;
|
|
11114
|
+
|
|
11115
|
+
const toPlainDate = NativeTemporal ? toPlainDate$1$1 : toPlainDate$1;
|
|
11116
|
+
|
|
11117
|
+
const addMonths = NativeTemporal ? addMonths$2$1 : addMonths$2;
|
|
11118
|
+
|
|
11119
|
+
const chevronLeftSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE1LjMzMzQgMjAuMzMzNEw3LjAwMDA4IDEyTDE1LjMzMzQgMy42NjY2MyIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS13aWR0aD0iMS43NSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPgo=';
|
|
11120
|
+
|
|
11121
|
+
const chevronRightSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTguNjY2NjMgMjAuMzMzNEwxNyAxMkw4LjY2NjYzIDMuNjY2NjMiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2Utd2lkdGg9IjEuNzUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K';
|
|
11122
|
+
|
|
11123
|
+
function parseIsoDateSafely(iso, format = fromString$1) {
|
|
11124
|
+
if (!iso)
|
|
11125
|
+
return undefined;
|
|
11126
|
+
try {
|
|
11127
|
+
return format(iso, getBasic);
|
|
11128
|
+
}
|
|
11129
|
+
catch {
|
|
11130
|
+
return undefined;
|
|
11131
|
+
}
|
|
11132
|
+
}
|
|
11133
|
+
function stripDayFromIsoDate(iso) {
|
|
11134
|
+
return iso.slice(0, 7);
|
|
11135
|
+
}
|
|
11136
|
+
/**
|
|
11137
|
+
* Serialize a PlainDate to an ISO YYYY-MM-DD string.
|
|
11138
|
+
*
|
|
11139
|
+
* IMPORTANT: the `fns` flavor of `temporal-polyfill` records do NOT carry a working instance
|
|
11140
|
+
* `.toString()` (calling it falls through to `Object.prototype.toString`, yielding
|
|
11141
|
+
* `"[object Temporal.PlainDateRecord]"`). Always use the top-level `PlainDateFns.toString()`.
|
|
11142
|
+
*/
|
|
11143
|
+
function toIsoDateString(date) {
|
|
11144
|
+
return toString$1(date);
|
|
11145
|
+
}
|
|
11146
|
+
function toIsoYearMonthString(date) {
|
|
11147
|
+
if (isRecord(date)) {
|
|
11148
|
+
return toString(date);
|
|
11149
|
+
}
|
|
11150
|
+
return stripDayFromIsoDate(toIsoDateString(date));
|
|
11151
|
+
}
|
|
11152
|
+
|
|
11153
|
+
const calendarSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIKICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8cmVjdCB4PSIzLjUiIHk9IjUiIHdpZHRoPSIxNyIgaGVpZ2h0PSIxNSIgcng9IjIiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2Utd2lkdGg9IjEuNzUiLz4KICAgIDxwYXRoIGQ9Ik0zLjUgOS41SDIwLjUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2Utd2lkdGg9IjEuNzUiLz4KICAgIDxwYXRoIGQ9Ik04IDNWNi41IiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIxLjc1IiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KICAgIDxwYXRoIGQ9Ik0xNiAzVjYuNSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS13aWR0aD0iMS43NSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+Cjwvc3ZnPg==';
|
|
11154
|
+
|
|
11155
|
+
function isSelected(date, value) {
|
|
11156
|
+
if (!value)
|
|
11157
|
+
return false;
|
|
11158
|
+
return compare$1(date, value) === 0;
|
|
11159
|
+
}
|
|
11160
|
+
function isDisabled(date, min, max) {
|
|
11161
|
+
if (min && compare$1(date, min) < 0)
|
|
11162
|
+
return true;
|
|
11163
|
+
if (max && compare$1(date, max) > 0)
|
|
11164
|
+
return true;
|
|
11165
|
+
return false;
|
|
11166
|
+
}
|
|
11167
|
+
function buildCalendarGrid(visibleMonth) {
|
|
11168
|
+
const firstOfMonth = toPlainDate(visibleMonth, { day: 1 });
|
|
11169
|
+
const firstDow = dayOfWeek(firstOfMonth);
|
|
11170
|
+
const offsetToMonday = firstDow - 1;
|
|
11171
|
+
const gridStart = addDays(firstOfMonth, -offsetToMonday);
|
|
11172
|
+
const grid = [];
|
|
11173
|
+
for (let i = 0; i < 42; i++) {
|
|
11174
|
+
grid.push(addDays(gridStart, i));
|
|
11175
|
+
}
|
|
11176
|
+
if (compare(visibleMonth, toPlainYearMonth(grid.at(-7))) !== 0) {
|
|
11177
|
+
return grid.slice(0, -7);
|
|
11178
|
+
}
|
|
11179
|
+
return grid;
|
|
11180
|
+
}
|
|
11181
|
+
function firstSelectableDayOfMonth(visibleMonth, min, max) {
|
|
11182
|
+
const daysInMonth$1 = daysInMonth(visibleMonth);
|
|
11183
|
+
for (let d = 1; d <= daysInMonth$1; d++) {
|
|
11184
|
+
const candidate = toPlainDate(visibleMonth, { day: d });
|
|
11185
|
+
if (!isDisabled(candidate, min, max))
|
|
11186
|
+
return candidate;
|
|
11187
|
+
}
|
|
11188
|
+
return null;
|
|
11189
|
+
}
|
|
11190
|
+
function lastSelectableDayOfMonth(visibleMonth, min, max) {
|
|
11191
|
+
const daysInMonth$1 = daysInMonth(visibleMonth);
|
|
11192
|
+
for (let d = daysInMonth$1; d >= 1; d--) {
|
|
11193
|
+
const candidate = toPlainDate(visibleMonth, { day: d });
|
|
11194
|
+
if (!isDisabled(candidate, min, max))
|
|
11195
|
+
return candidate;
|
|
11196
|
+
}
|
|
11197
|
+
return null;
|
|
11198
|
+
}
|
|
11199
|
+
const NAV_LABELS = {
|
|
11200
|
+
de: { prev: 'Vorheriger Monat', next: 'Nächster Monat' },
|
|
11201
|
+
'de-CH': { prev: 'Vorheriger Monat', next: 'Nächster Monat' },
|
|
11202
|
+
'de-AT': { prev: 'Vorheriger Monat', next: 'Nächster Monat' },
|
|
11203
|
+
'de-DE': { prev: 'Vorheriger Monat', next: 'Nächster Monat' },
|
|
11204
|
+
en: { prev: 'Previous month', next: 'Next month' },
|
|
11205
|
+
'en-US': { prev: 'Previous month', next: 'Next month' },
|
|
11206
|
+
'en-GB': { prev: 'Previous month', next: 'Next month' },
|
|
11207
|
+
fr: { prev: 'Mois précédent', next: 'Mois suivant' },
|
|
11208
|
+
'fr-CH': { prev: 'Mois précédent', next: 'Mois suivant' },
|
|
11209
|
+
it: { prev: 'Mese precedente', next: 'Mese successivo' },
|
|
11210
|
+
'it-CH': { prev: 'Mese precedente', next: 'Mese successivo' },
|
|
11211
|
+
};
|
|
11212
|
+
function getNavLabels(locale) {
|
|
11213
|
+
const DEFAULT = { prev: 'Vorheriger Monat', next: 'Nächster Monat' };
|
|
11214
|
+
const byLocale = NAV_LABELS[locale];
|
|
11215
|
+
if (byLocale)
|
|
11216
|
+
return byLocale;
|
|
11217
|
+
const lang = locale.split('-')[0];
|
|
11218
|
+
const byLang = lang !== undefined ? NAV_LABELS[lang] : undefined;
|
|
11219
|
+
if (byLang)
|
|
11220
|
+
return byLang;
|
|
11221
|
+
return DEFAULT;
|
|
11222
|
+
}
|
|
11223
|
+
const VALIDATION_LABELS = {
|
|
11224
|
+
de: { popoverSuffix: '— Kalender', invalidDateMessage: 'Ungültiges Datum' },
|
|
11225
|
+
'de-CH': { popoverSuffix: '— Kalender', invalidDateMessage: 'Ungültiges Datum' },
|
|
11226
|
+
'de-AT': { popoverSuffix: '— Kalender', invalidDateMessage: 'Ungültiges Datum' },
|
|
11227
|
+
'de-DE': { popoverSuffix: '— Kalender', invalidDateMessage: 'Ungültiges Datum' },
|
|
11228
|
+
en: { popoverSuffix: '— Calendar', invalidDateMessage: 'Invalid date' },
|
|
11229
|
+
'en-US': { popoverSuffix: '— Calendar', invalidDateMessage: 'Invalid date' },
|
|
11230
|
+
'en-GB': { popoverSuffix: '— Calendar', invalidDateMessage: 'Invalid date' },
|
|
11231
|
+
fr: { popoverSuffix: '— Calendrier', invalidDateMessage: 'Date invalide' },
|
|
11232
|
+
'fr-CH': { popoverSuffix: '— Calendrier', invalidDateMessage: 'Date invalide' },
|
|
11233
|
+
it: { popoverSuffix: '— Calendario', invalidDateMessage: 'Data non valida' },
|
|
11234
|
+
'it-CH': { popoverSuffix: '— Calendario', invalidDateMessage: 'Data non valida' },
|
|
11235
|
+
};
|
|
11236
|
+
function getValidationLabels(locale) {
|
|
11237
|
+
const DEFAULT = { popoverSuffix: '— Kalender', invalidDateMessage: 'Ungültiges Datum' };
|
|
11238
|
+
const byLocale = VALIDATION_LABELS[locale];
|
|
11239
|
+
if (byLocale)
|
|
11240
|
+
return byLocale;
|
|
11241
|
+
const lang = locale.split('-')[0];
|
|
11242
|
+
const byLang = lang !== undefined ? VALIDATION_LABELS[lang] : undefined;
|
|
11243
|
+
if (byLang)
|
|
11244
|
+
return byLang;
|
|
11245
|
+
return DEFAULT;
|
|
11246
|
+
}
|
|
11247
|
+
const FORMAT_TOKEN_ORDER = ['yyyy', 'MM', 'dd'];
|
|
11248
|
+
function derivePatternFromLocale(locale) {
|
|
11249
|
+
const reference = new Date(Date.UTC(2001, 10, 22));
|
|
11250
|
+
const parts = new Intl.DateTimeFormat(locale, { year: 'numeric', month: '2-digit', day: '2-digit', timeZone: 'UTC' }).formatToParts(reference);
|
|
11251
|
+
return parts
|
|
11252
|
+
.map((part) => {
|
|
11253
|
+
switch (part.type) {
|
|
11254
|
+
case 'year':
|
|
11255
|
+
return 'yyyy';
|
|
11256
|
+
case 'month':
|
|
11257
|
+
return 'MM';
|
|
11258
|
+
case 'day':
|
|
11259
|
+
return 'dd';
|
|
11260
|
+
default:
|
|
11261
|
+
return part.value;
|
|
11262
|
+
}
|
|
11263
|
+
})
|
|
11264
|
+
.join('');
|
|
11265
|
+
}
|
|
11266
|
+
function escapeRegExp(value) {
|
|
11267
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
11268
|
+
}
|
|
11269
|
+
function buildPatternMatcher(pattern) {
|
|
11270
|
+
const order = [];
|
|
11271
|
+
let regexSource = '';
|
|
11272
|
+
let i = 0;
|
|
11273
|
+
while (i < pattern.length) {
|
|
11274
|
+
const token = FORMAT_TOKEN_ORDER.find((t) => pattern.startsWith(t, i));
|
|
11275
|
+
if (token) {
|
|
11276
|
+
regexSource += token === 'yyyy' ? '(\\d{4})' : '(\\d{1,2})';
|
|
11277
|
+
order.push(token);
|
|
11278
|
+
i += token.length;
|
|
11279
|
+
}
|
|
11280
|
+
else {
|
|
11281
|
+
regexSource += escapeRegExp(pattern[i]);
|
|
11282
|
+
i += 1;
|
|
11283
|
+
}
|
|
11284
|
+
}
|
|
11285
|
+
return { regex: new RegExp(`^${regexSource}$`), order };
|
|
11286
|
+
}
|
|
11287
|
+
function isValidCalendarDate(year, month, day) {
|
|
11288
|
+
if (!Number.isInteger(year) || year < 1)
|
|
11289
|
+
return false;
|
|
11290
|
+
if (!Number.isInteger(month) || month < 1 || month > 12)
|
|
11291
|
+
return false;
|
|
11292
|
+
if (!Number.isInteger(day) || day < 1)
|
|
11293
|
+
return false;
|
|
11294
|
+
try {
|
|
11295
|
+
const ym = fromString(`${String(year).padStart(4, '0')}-${String(month).padStart(2, '0')}`, getBasic);
|
|
11296
|
+
return day <= daysInMonth(ym);
|
|
11297
|
+
}
|
|
11298
|
+
catch {
|
|
11299
|
+
return false;
|
|
11300
|
+
}
|
|
11301
|
+
}
|
|
11302
|
+
function formatToDisplay(value, locale, displayFormat) {
|
|
11303
|
+
if (!value)
|
|
11304
|
+
return '';
|
|
11305
|
+
const date = parseIsoDateSafely(value);
|
|
11306
|
+
if (!date)
|
|
11307
|
+
return '';
|
|
11308
|
+
const pattern = displayFormat ?? derivePatternFromLocale(locale);
|
|
11309
|
+
const yyyy = String(date.year).padStart(4, '0');
|
|
11310
|
+
const MM = String(date.month).padStart(2, '0');
|
|
11311
|
+
const dd = String(date.day).padStart(2, '0');
|
|
11312
|
+
return pattern.replace(/yyyy/g, yyyy).replace(/MM/g, MM).replace(/dd/g, dd);
|
|
11313
|
+
}
|
|
11314
|
+
function parseFromDisplay(text, locale, displayFormat) {
|
|
11315
|
+
const trimmed = text.trim();
|
|
11316
|
+
if (!trimmed)
|
|
11317
|
+
return undefined;
|
|
11318
|
+
const pattern = displayFormat ?? derivePatternFromLocale(locale);
|
|
11319
|
+
const { regex, order } = buildPatternMatcher(pattern);
|
|
11320
|
+
const match = regex.exec(trimmed);
|
|
11321
|
+
if (!match)
|
|
11322
|
+
return undefined;
|
|
11323
|
+
const values = {};
|
|
11324
|
+
order.forEach((token, idx) => {
|
|
11325
|
+
values[token] = Number(match[idx + 1]);
|
|
11326
|
+
});
|
|
11327
|
+
const { yyyy, MM, dd } = values;
|
|
11328
|
+
if (yyyy === undefined || MM === undefined || dd === undefined)
|
|
11329
|
+
return undefined;
|
|
11330
|
+
if (!isValidCalendarDate(yyyy, MM, dd))
|
|
11331
|
+
return undefined;
|
|
11332
|
+
return `${String(yyyy).padStart(4, '0')}-${String(MM).padStart(2, '0')}-${String(dd).padStart(2, '0')}`;
|
|
11333
|
+
}
|
|
11334
|
+
|
|
11335
|
+
const lmvzDatepickerCss = () => ` @layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('RouterBook-Regular'), local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'); font-weight: 400; } @font-face { font-family: Router; src: local('RouterMedium-Regular'), local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'); font-weight: 500; } @font-face { font-family: Router; src: local('RouterBold-Regular'), local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'); font-weight: 700; } } :host { display: inline-block; width: 100%; } .datepicker-panel { display: flex; flex-direction: column; gap: var(--lmvz-component-input-gap-lg, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); } .datepicker-header { display: flex; align-items: center; justify-content: space-between; width: 100%; } .datepicker-month-label { all: unset; font: var(--lmvz-typography-body-md-strong, 500 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.5 Router); color: var(--lmvz-semantic-color-on-surface-primary, #000000); text-align: center; cursor: default; pointer-events: none; user-select: none; } .datepicker-weekday-row { display: flex; gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); width: 100%; } .datepicker-weekday { flex: 1; display: flex; align-items: center; justify-content: center; font: var(--lmvz-typography-body-sm-strong, 500 clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem) / 1.5 Router); color: var(--lmvz-semantic-color-on-surface-secondary, #545454); min-width: 0; text-align: center; } .datepicker-grid { display: flex; flex-direction: column; gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); } .datepicker-week-row { display: flex; gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); } [part~='day'] { all: unset; flex: 1; width: var(--lmvz-component-input-size-md, clamp(2.5rem, 2.44rem + 0.26vw, 2.75rem)); height: var(--lmvz-component-input-size-md, clamp(2.5rem, 2.44rem + 0.26vw, 2.75rem)); min-width: var(--lmvz-component-input-size-md, clamp(2.5rem, 2.44rem + 0.26vw, 2.75rem)); box-sizing: border-box; display: flex; align-items: center; justify-content: center; border-radius: var(--lmvz-semantic-border-radius-round, 999px); font: var(--lmvz-typography-body-md-strong, 500 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.5 Router); color: var(--lmvz-semantic-color-on-surface-primary, #000000); background-color: transparent; cursor: pointer; transition: background-color 0.15s ease, color 0.15s ease; position: relative; } [part~='day--disabled'], [part~='day']:disabled { opacity: var(--lmvz-global-opacity-disabled, 40%); pointer-events: none; } [part~='day']:focus-visible { outline: var(--lmvz-ds-outline, 1px solid #0e7ab4); outline-offset: var(--lmvz-ds-outline-offset, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)); } [part~='day']:not(:disabled):hover { background-color: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); color: var(--lmvz-semantic-color-on-surface-primary, #000000); } [part~='day--today'] { box-shadow: inset 0 0 0 1px var(--lmvz-semantic-color-border-active, #0f8acc); } [part~='day--today']:not(:disabled):hover { background-color: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); box-shadow: inset 0 0 0 1px var(--lmvz-semantic-color-border-active, #0f8acc); } [part~='day--selected'] { background-color: var(--lmvz-semantic-color-status-active-alternate, #0f8acc); color: var(--lmvz-semantic-color-status-on-active-alternate, #ffffff); box-shadow: none; } [part~='day--today'][part~='day--selected'] { background-color: var(--lmvz-semantic-color-status-active-alternate, #0f8acc); color: var(--lmvz-semantic-color-status-on-active-alternate, #ffffff); box-shadow: none; } [part~='day--selected']:not(:disabled):hover { background-color: var(--lmvz-semantic-color-status-active-alternate, #0f8acc); color: var(--lmvz-semantic-color-status-on-active-alternate, #ffffff); } [part~='day--out-of-month'] { color: var(--lmvz-semantic-color-on-surface-tertiary, #7a7a7a); } `;
|
|
11336
|
+
|
|
11337
|
+
const CHEVRON_LEFT = toValidSvgStringWithFallback(chevronLeftSvg);
|
|
11338
|
+
const CHEVRON_RIGHT = toValidSvgStringWithFallback(chevronRightSvg);
|
|
11339
|
+
const CALENDAR_ICON = toValidSvgStringWithFallback(calendarSvg);
|
|
11340
|
+
class LmvzDatepicker {
|
|
11341
|
+
constructor(hostRef) {
|
|
11342
|
+
registerInstance(this, hostRef);
|
|
11343
|
+
this.lmvzChange = createEvent(this, "lmvzChange", 7);
|
|
11344
|
+
this.lmvzMonthChange = createEvent(this, "lmvzMonthChange", 7);
|
|
11345
|
+
this.lmvzOpen = createEvent(this, "lmvzOpen", 7);
|
|
11346
|
+
this.lmvzClose = createEvent(this, "lmvzClose", 7);
|
|
11347
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
11348
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
11349
|
+
}
|
|
11350
|
+
else {
|
|
11351
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
11352
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
11353
|
+
}
|
|
11354
|
+
}
|
|
11355
|
+
get el() { return getElement(this); }
|
|
11356
|
+
monthLabelId = `lmvz-dp-month-${Math.random().toString(36).slice(2, 9)}`;
|
|
11357
|
+
internals;
|
|
11358
|
+
visibleDays;
|
|
11359
|
+
inputEl;
|
|
11360
|
+
focusedButtonRef;
|
|
11361
|
+
initialValue;
|
|
11362
|
+
pendingGridFocus = false;
|
|
11363
|
+
syncOrigin = null;
|
|
11364
|
+
focusedDate;
|
|
11365
|
+
setFocusedDate(val) {
|
|
11366
|
+
if (this.focusedDate === val || (this.focusedDate && val && compare$1(this.focusedDate, val) === 0))
|
|
11367
|
+
return;
|
|
11368
|
+
this.focusedDate = val;
|
|
11369
|
+
}
|
|
11370
|
+
valueDate;
|
|
11371
|
+
get value() {
|
|
11372
|
+
return this.valueDate ? toIsoDateString(this.valueDate) : undefined;
|
|
11373
|
+
}
|
|
11374
|
+
set value(value) {
|
|
11375
|
+
this.valueDate = value ? parseIsoDateSafely(value) : undefined;
|
|
11376
|
+
this.visibleMonthDate = this.valueDate ? toPlainYearMonth(this.valueDate) : this.effectiveVisibleMonth;
|
|
11377
|
+
this.setFocusedDate(this.valueDate);
|
|
11378
|
+
this.syncInputTextFromValue();
|
|
11379
|
+
this.updateFormState();
|
|
11380
|
+
}
|
|
11381
|
+
visibleMonthDate;
|
|
11382
|
+
get visibleMonth() {
|
|
11383
|
+
return this.visibleMonthDate ? toIsoYearMonthString(this.visibleMonthDate) : undefined;
|
|
11384
|
+
}
|
|
11385
|
+
set visibleMonth(value) {
|
|
11386
|
+
this.visibleMonthDate = value ? fromString(value, getBasic) : undefined;
|
|
11387
|
+
this.initFocusedDate();
|
|
11388
|
+
}
|
|
11389
|
+
min;
|
|
11390
|
+
max;
|
|
11391
|
+
locale = 'de-CH';
|
|
11392
|
+
firstDayOfWeek = 1;
|
|
11393
|
+
disabled = false;
|
|
11394
|
+
readonly = false;
|
|
11395
|
+
required = false;
|
|
11396
|
+
name;
|
|
11397
|
+
label;
|
|
11398
|
+
placeholder;
|
|
11399
|
+
helperText;
|
|
11400
|
+
errorMessage;
|
|
11401
|
+
open = false;
|
|
11402
|
+
displayFormat;
|
|
11403
|
+
lmvzChange;
|
|
11404
|
+
lmvzMonthChange;
|
|
11405
|
+
lmvzOpen;
|
|
11406
|
+
lmvzClose;
|
|
11407
|
+
componentWillLoad() {
|
|
11408
|
+
if (!this.label) {
|
|
11409
|
+
console.warn('[lmvz-datepicker] no `label` provided; the text field will have no accessible name.');
|
|
11410
|
+
}
|
|
11411
|
+
this.initialValue = this.value;
|
|
11412
|
+
this.syncInputTextFromValue();
|
|
11413
|
+
this.updateFormState();
|
|
11414
|
+
}
|
|
11415
|
+
formAssociatedCallback(form) {
|
|
11416
|
+
if (!form)
|
|
11417
|
+
return;
|
|
11418
|
+
this.updateFormState();
|
|
11419
|
+
}
|
|
11420
|
+
formResetCallback() {
|
|
11421
|
+
this.internals.setValidity?.({});
|
|
11422
|
+
this.value = this.initialValue;
|
|
11423
|
+
}
|
|
11424
|
+
formStateRestoreCallback(state) {
|
|
11425
|
+
if (typeof state !== 'string')
|
|
11426
|
+
return;
|
|
11427
|
+
this.value = (state || undefined);
|
|
11428
|
+
}
|
|
11429
|
+
async checkValidity() {
|
|
11430
|
+
return this.internals.checkValidity?.() ?? true;
|
|
11431
|
+
}
|
|
11432
|
+
async reportValidity() {
|
|
11433
|
+
return this.internals.reportValidity?.() ?? true;
|
|
11434
|
+
}
|
|
11435
|
+
handleValidityRelevantPropChange() {
|
|
11436
|
+
this.updateFormState();
|
|
11437
|
+
}
|
|
11438
|
+
handleDisplayFormatChange() {
|
|
11439
|
+
this.syncInputTextFromValue();
|
|
11440
|
+
}
|
|
11441
|
+
handleDisabledChange(disabled) {
|
|
11442
|
+
if (disabled)
|
|
11443
|
+
this.open = false;
|
|
11444
|
+
}
|
|
11445
|
+
handleKeydown(ev) {
|
|
11446
|
+
if (this.disabled)
|
|
11447
|
+
return;
|
|
11448
|
+
const path = ev.composedPath();
|
|
11449
|
+
if (!path.some((el) => el?.getAttribute?.('role') === 'grid'))
|
|
11450
|
+
return;
|
|
11451
|
+
const focused = this.focusedDate;
|
|
11452
|
+
if (!focused) {
|
|
11453
|
+
console.warn('[lmvz-datepicker] any date should be focused but none is.');
|
|
11454
|
+
return;
|
|
11455
|
+
}
|
|
11456
|
+
const minDate = parseIsoDateSafely(this.min);
|
|
11457
|
+
const maxDate = parseIsoDateSafely(this.max);
|
|
11458
|
+
const swallowEvent = () => {
|
|
11459
|
+
ev.preventDefault();
|
|
11460
|
+
ev.stopPropagation();
|
|
11461
|
+
};
|
|
11462
|
+
switch (ev.key) {
|
|
11463
|
+
case 'ArrowRight': {
|
|
11464
|
+
swallowEvent();
|
|
11465
|
+
this.moveFocus(addDays(focused, 1));
|
|
11466
|
+
break;
|
|
11467
|
+
}
|
|
11468
|
+
case 'ArrowLeft': {
|
|
11469
|
+
swallowEvent();
|
|
11470
|
+
this.moveFocus(addDays(focused, -1));
|
|
11471
|
+
break;
|
|
11472
|
+
}
|
|
11473
|
+
case 'ArrowDown': {
|
|
11474
|
+
swallowEvent();
|
|
11475
|
+
this.moveFocus(addDays(focused, 7));
|
|
11476
|
+
break;
|
|
11477
|
+
}
|
|
11478
|
+
case 'ArrowUp': {
|
|
11479
|
+
swallowEvent();
|
|
11480
|
+
this.moveFocus(addDays(focused, -7));
|
|
11481
|
+
break;
|
|
11482
|
+
}
|
|
11483
|
+
case 'Home': {
|
|
11484
|
+
swallowEvent();
|
|
11485
|
+
this.moveFocus(firstSelectableDayOfMonth(this.effectiveVisibleMonth, minDate, maxDate));
|
|
11486
|
+
break;
|
|
11487
|
+
}
|
|
11488
|
+
case 'End': {
|
|
11489
|
+
swallowEvent();
|
|
11490
|
+
this.moveFocus(lastSelectableDayOfMonth(this.effectiveVisibleMonth, minDate, maxDate));
|
|
11491
|
+
break;
|
|
11492
|
+
}
|
|
11493
|
+
case 'PageUp':
|
|
11494
|
+
swallowEvent();
|
|
11495
|
+
this.moveFocus(ev.shiftKey ? addYears(focused, -1) : addMonths$1(focused, -1));
|
|
11496
|
+
break;
|
|
11497
|
+
case 'PageDown':
|
|
11498
|
+
swallowEvent();
|
|
11499
|
+
this.moveFocus(ev.shiftKey ? addYears(focused, 1) : addMonths$1(focused, 1));
|
|
11500
|
+
break;
|
|
11501
|
+
case 'Enter':
|
|
11502
|
+
case ' ':
|
|
11503
|
+
ev.preventDefault();
|
|
11504
|
+
if (!this.readonly && !isDisabled(focused, minDate, maxDate)) {
|
|
11505
|
+
this.selectDate(focused, { origin: 'calendar', closePopover: true });
|
|
11506
|
+
}
|
|
11507
|
+
break;
|
|
11508
|
+
}
|
|
11509
|
+
}
|
|
11510
|
+
initFocusedDate() {
|
|
11511
|
+
const vm = this.effectiveVisibleMonth;
|
|
11512
|
+
if (this.focusedDate && compare(toPlainYearMonth(this.focusedDate), vm) === 0) {
|
|
11513
|
+
return;
|
|
11514
|
+
}
|
|
11515
|
+
const selectedDate = this.valueDate;
|
|
11516
|
+
if (selectedDate && compare(toPlainYearMonth(selectedDate), vm) === 0) {
|
|
11517
|
+
this.setFocusedDate(selectedDate);
|
|
11518
|
+
return;
|
|
11519
|
+
}
|
|
11520
|
+
const todayDate = plainDateISO();
|
|
11521
|
+
if (compare(toPlainYearMonth(todayDate), vm) === 0) {
|
|
11522
|
+
this.setFocusedDate(todayDate);
|
|
11523
|
+
return;
|
|
11524
|
+
}
|
|
11525
|
+
this.setFocusedDate(toPlainDate(vm, { day: 1 }));
|
|
11526
|
+
}
|
|
11527
|
+
get effectiveVisibleMonth() {
|
|
11528
|
+
return this.visibleMonthDate ? this.visibleMonthDate : toPlainYearMonth(plainDateISO());
|
|
11529
|
+
}
|
|
11530
|
+
navigateMonth(delta, byMonthNav = false) {
|
|
11531
|
+
if (delta === 0)
|
|
11532
|
+
return;
|
|
11533
|
+
const newMonth = addMonths(this.effectiveVisibleMonth, delta);
|
|
11534
|
+
this.visibleMonthDate = newMonth;
|
|
11535
|
+
this.lmvzMonthChange.emit({ visibleMonth: toIsoYearMonthString(newMonth) });
|
|
11536
|
+
if (byMonthNav) {
|
|
11537
|
+
this.setFocusedDate(toPlainDate(newMonth, { day: 1 }));
|
|
11538
|
+
}
|
|
11539
|
+
}
|
|
11540
|
+
selectDate(date, opts = { origin: 'calendar' }) {
|
|
11541
|
+
this.syncOrigin = opts.origin;
|
|
11542
|
+
this.valueDate = date;
|
|
11543
|
+
this.setFocusedDate(date);
|
|
11544
|
+
this.lmvzChange.emit({ value: toIsoDateString(date) });
|
|
11545
|
+
this.navigateMonth(compare(toPlainYearMonth(date), this.effectiveVisibleMonth));
|
|
11546
|
+
if (opts.origin === 'input') {
|
|
11547
|
+
this.inputText = formatToDisplay(this.value, this.locale, this.displayFormat);
|
|
11548
|
+
this.hasUnparseableInput = false;
|
|
11549
|
+
}
|
|
11550
|
+
else {
|
|
11551
|
+
this.syncInputTextFromValue();
|
|
11552
|
+
}
|
|
11553
|
+
this.updateFormState();
|
|
11554
|
+
if (opts.closePopover)
|
|
11555
|
+
this.open = false;
|
|
11556
|
+
this.syncOrigin = null;
|
|
11557
|
+
}
|
|
11558
|
+
moveFocus(date) {
|
|
11559
|
+
if (!date)
|
|
11560
|
+
return;
|
|
11561
|
+
this.setFocusedDate(date);
|
|
11562
|
+
if (!this.visibleDays?.length)
|
|
11563
|
+
return;
|
|
11564
|
+
let day = this.visibleDays.at(0);
|
|
11565
|
+
if (day && compare$1(date, day) < 0) {
|
|
11566
|
+
return this.navigateMonth(-1);
|
|
11567
|
+
}
|
|
11568
|
+
day = this.visibleDays.at(-1);
|
|
11569
|
+
if (day && compare$1(date, day) > 0) {
|
|
11570
|
+
return this.navigateMonth(1);
|
|
11571
|
+
}
|
|
11572
|
+
}
|
|
11573
|
+
syncInputTextFromValue() {
|
|
11574
|
+
if (this.syncOrigin === 'input')
|
|
11575
|
+
return;
|
|
11576
|
+
this.inputText = formatToDisplay(this.value, this.locale, this.displayFormat);
|
|
11577
|
+
this.hasUnparseableInput = false;
|
|
11578
|
+
}
|
|
11579
|
+
inputText = '';
|
|
11580
|
+
hasUnparseableInput = false;
|
|
11581
|
+
handleInputTextChange = (ev) => {
|
|
11582
|
+
const text = ev.detail;
|
|
11583
|
+
this.inputText = text;
|
|
11584
|
+
if (!text.trim()) {
|
|
11585
|
+
this.hasUnparseableInput = false;
|
|
11586
|
+
if (this.valueDate) {
|
|
11587
|
+
this.syncOrigin = 'input';
|
|
11588
|
+
this.valueDate = undefined;
|
|
11589
|
+
this.lmvzChange.emit({ value: undefined });
|
|
11590
|
+
this.syncOrigin = null;
|
|
11591
|
+
}
|
|
11592
|
+
this.updateFormState();
|
|
11593
|
+
return;
|
|
11594
|
+
}
|
|
11595
|
+
const parsed = parseFromDisplay(text, this.locale, this.displayFormat);
|
|
11596
|
+
if (!parsed) {
|
|
11597
|
+
this.hasUnparseableInput = true;
|
|
11598
|
+
this.updateFormState();
|
|
11599
|
+
return;
|
|
11600
|
+
}
|
|
11601
|
+
this.hasUnparseableInput = false;
|
|
11602
|
+
const parsedDate = parseIsoDateSafely(parsed);
|
|
11603
|
+
if (!parsedDate)
|
|
11604
|
+
return;
|
|
11605
|
+
if (this.valueDate && compare$1(this.valueDate, parsedDate) === 0)
|
|
11606
|
+
return;
|
|
11607
|
+
this.selectDate(parsedDate, { origin: 'input' });
|
|
11608
|
+
};
|
|
11609
|
+
handleInputFocus(ev) {
|
|
11610
|
+
if (this.disabled || this.readonly)
|
|
11611
|
+
return;
|
|
11612
|
+
const originalTarget = ev.composedPath()[0];
|
|
11613
|
+
if (originalTarget !== this.inputEl && !this.inputEl?.contains(originalTarget ?? null))
|
|
11614
|
+
return;
|
|
11615
|
+
this.initFocusedDate();
|
|
11616
|
+
this.open = true;
|
|
11617
|
+
}
|
|
11618
|
+
handleInputKeydown = (ev) => {
|
|
11619
|
+
if (this.disabled || this.readonly)
|
|
11620
|
+
return;
|
|
11621
|
+
if (!['ArrowDown', 'ArrowUp', ' '].includes(ev.key))
|
|
11622
|
+
return;
|
|
11623
|
+
ev.preventDefault();
|
|
11624
|
+
if (!this.open) {
|
|
11625
|
+
this.pendingGridFocus = true;
|
|
11626
|
+
this.initFocusedDate();
|
|
11627
|
+
this.open = true;
|
|
11628
|
+
}
|
|
11629
|
+
else {
|
|
11630
|
+
this.focusGrid();
|
|
11631
|
+
}
|
|
11632
|
+
};
|
|
11633
|
+
focusGrid() {
|
|
11634
|
+
requestAnimationFrame(() => this.focusedButtonRef?.focus());
|
|
11635
|
+
}
|
|
11636
|
+
handlePopoverOpen = (ev) => {
|
|
11637
|
+
ev.stopPropagation();
|
|
11638
|
+
console.log('emitting open event');
|
|
11639
|
+
this.lmvzOpen.emit();
|
|
11640
|
+
if (this.pendingGridFocus) {
|
|
11641
|
+
this.pendingGridFocus = false;
|
|
11642
|
+
this.focusGrid();
|
|
11643
|
+
}
|
|
11644
|
+
};
|
|
11645
|
+
handlePopoverClose = (ev) => {
|
|
11646
|
+
console.log('handlePopoverClose', ev);
|
|
11647
|
+
ev.stopPropagation();
|
|
11648
|
+
this.open = false;
|
|
11649
|
+
this.lmvzClose.emit();
|
|
11650
|
+
};
|
|
11651
|
+
updateFormState() {
|
|
11652
|
+
const isoValue = this.value;
|
|
11653
|
+
this.internals.setFormValue?.(isoValue ?? null);
|
|
11654
|
+
const flags = {};
|
|
11655
|
+
if (this.required && !this.valueDate) {
|
|
11656
|
+
flags.valueMissing = true;
|
|
11657
|
+
}
|
|
11658
|
+
if (this.hasUnparseableInput) {
|
|
11659
|
+
flags.badInput = true;
|
|
11660
|
+
}
|
|
11661
|
+
if (this.valueDate) {
|
|
11662
|
+
const minDate = parseIsoDateSafely(this.min);
|
|
11663
|
+
const maxDate = parseIsoDateSafely(this.max);
|
|
11664
|
+
if (minDate && compare$1(this.valueDate, minDate) < 0)
|
|
11665
|
+
flags.rangeUnderflow = true;
|
|
11666
|
+
if (maxDate && compare$1(this.valueDate, maxDate) > 0)
|
|
11667
|
+
flags.rangeOverflow = true;
|
|
11668
|
+
}
|
|
11669
|
+
const isInvalid = Object.values(flags).some(Boolean);
|
|
11670
|
+
this.isInvalid = isInvalid;
|
|
11671
|
+
if (!isInvalid) {
|
|
11672
|
+
this.nativeError = false;
|
|
11673
|
+
}
|
|
11674
|
+
const validationLabels = getValidationLabels(this.locale);
|
|
11675
|
+
this.internals.setValidity?.(flags, isInvalid ? this.errorMessage || validationLabels.invalidDateMessage : undefined, isInvalid ? this.el : undefined);
|
|
11676
|
+
}
|
|
11677
|
+
handleInvalid() {
|
|
11678
|
+
this.nativeError = true;
|
|
11679
|
+
}
|
|
11680
|
+
isInvalid = false;
|
|
11681
|
+
nativeError = false;
|
|
11682
|
+
get effectivePlaceholder() {
|
|
11683
|
+
return this.placeholder ?? derivePatternFromLocale(this.locale).toLowerCase();
|
|
11684
|
+
}
|
|
11685
|
+
renderHeader() {
|
|
11686
|
+
const { locale } = this;
|
|
11687
|
+
const vm = this.effectiveVisibleMonth;
|
|
11688
|
+
const navLabels = getNavLabels(locale);
|
|
11689
|
+
const monthYearLabel = toLocaleString(toPlainDate(vm, { day: 1 }), locale, { month: 'long', year: 'numeric' });
|
|
11690
|
+
const prevMonth = addMonths(vm, -1);
|
|
11691
|
+
const nextMonth = addMonths(vm, 1);
|
|
11692
|
+
const minYM = this.min ? fromString(this.min.slice(0, 7), getBasic) : undefined;
|
|
11693
|
+
const maxYM = this.max ? fromString(this.max.slice(0, 7), getBasic) : undefined;
|
|
11694
|
+
const isPrevDisabled = this.disabled || (minYM !== undefined && compare(prevMonth, minYM) < 0);
|
|
11695
|
+
const isNextDisabled = this.disabled || (maxYM !== undefined && compare(nextMonth, maxYM) > 0);
|
|
11696
|
+
return (hAsync("div", { part: "header", class: "datepicker-header" }, hAsync("lmvz-button", { part: "nav-prev", variant: "tertiary", scale: "small", "aria-label": navLabels.prev, disabled: isPrevDisabled, onLmvzActivation: () => this.navigateMonth(-1, true) }, hAsync("lmvz-icon", { icon: CHEVRON_LEFT, "aria-hidden": "true" })), hAsync("span", { id: this.monthLabelId, part: "month-label", class: "datepicker-month-label" }, monthYearLabel), hAsync("lmvz-button", { part: "nav-next", variant: "tertiary", scale: "small", "aria-label": navLabels.next, disabled: isNextDisabled, onLmvzActivation: () => this.navigateMonth(1, true) }, hAsync("lmvz-icon", { icon: CHEVRON_RIGHT, "aria-hidden": "true" }))));
|
|
11697
|
+
}
|
|
11698
|
+
renderWeekdayRow() {
|
|
11699
|
+
const { locale } = this;
|
|
11700
|
+
const mondayFirstDows = [1, 2, 3, 4, 5, 6, 7];
|
|
11701
|
+
const refMonday = fromFields({ year: 2024, month: 1, day: 1 });
|
|
11702
|
+
return (hAsync("div", { part: "weekday-row", role: "row", class: "datepicker-weekday-row" }, mondayFirstDows.map((dow) => {
|
|
11703
|
+
const refDate = addDays(refMonday, dow - 1);
|
|
11704
|
+
const shortName = toLocaleString(refDate, locale, { weekday: 'short' });
|
|
11705
|
+
const longName = toLocaleString(refDate, locale, { weekday: 'long' });
|
|
11706
|
+
return (hAsync("span", { part: "weekday", role: "columnheader", "aria-label": longName, class: "datepicker-weekday", key: dow }, hAsync("abbr", { title: longName }, shortName)));
|
|
11707
|
+
})));
|
|
11708
|
+
}
|
|
11709
|
+
renderGrid() {
|
|
11710
|
+
const { locale, focusedDate } = this;
|
|
11711
|
+
const vm = this.effectiveVisibleMonth;
|
|
11712
|
+
const selectedDate = this.valueDate;
|
|
11713
|
+
const minDate = parseIsoDateSafely(this.min);
|
|
11714
|
+
const maxDate = parseIsoDateSafely(this.max);
|
|
11715
|
+
const grid = (this.visibleDays = buildCalendarGrid(vm));
|
|
11716
|
+
const weekdayAriaLabelFormatter = {
|
|
11717
|
+
weekday: 'long',
|
|
11718
|
+
day: 'numeric',
|
|
11719
|
+
month: 'long',
|
|
11720
|
+
year: 'numeric',
|
|
11721
|
+
};
|
|
11722
|
+
const weeks = [];
|
|
11723
|
+
for (let w = 0; w < 6; w++) {
|
|
11724
|
+
if (!grid.at(w * 7))
|
|
11725
|
+
break;
|
|
11726
|
+
weeks.push(grid.slice(w * 7, w * 7 + 7));
|
|
11727
|
+
}
|
|
11728
|
+
return (hAsync("div", { part: "grid", role: "grid", "aria-labelledby": this.monthLabelId, class: "datepicker-grid" }, this.renderWeekdayRow(), weeks.map((week, wi) => (hAsync("div", { part: "week-row", role: "row", class: "datepicker-week-row", key: wi }, week.map((date) => {
|
|
11729
|
+
const iso = toIsoDateString(date);
|
|
11730
|
+
const isTodayDate = compare$1(date, plainDateISO()) === 0;
|
|
11731
|
+
const isSelectedDate = isSelected(date, selectedDate);
|
|
11732
|
+
const isOutOfMonth = compare(toPlainYearMonth(date), vm) !== 0;
|
|
11733
|
+
const isDisabledDate = this.readonly || isDisabled(date, minDate, maxDate);
|
|
11734
|
+
const isFocused = focusedDate !== undefined && compare$1(date, focusedDate) === 0;
|
|
11735
|
+
const partMarkers = ['day'];
|
|
11736
|
+
if (isTodayDate)
|
|
11737
|
+
partMarkers.push('day--today');
|
|
11738
|
+
if (isSelectedDate)
|
|
11739
|
+
partMarkers.push('day--selected');
|
|
11740
|
+
if (isOutOfMonth)
|
|
11741
|
+
partMarkers.push('day--out-of-month');
|
|
11742
|
+
if (isDisabledDate)
|
|
11743
|
+
partMarkers.push('day--disabled');
|
|
11744
|
+
const ariaLabel = toLocaleString(date, locale, weekdayAriaLabelFormatter);
|
|
11745
|
+
let fromRender = false;
|
|
11746
|
+
let buttonRef;
|
|
11747
|
+
if (isFocused) {
|
|
11748
|
+
requestAnimationFrame(() => {
|
|
11749
|
+
const activeEl = this.el.shadowRoot?.activeElement;
|
|
11750
|
+
if (!(activeEl instanceof HTMLButtonElement) || activeEl.getAttribute('role') !== 'gridcell')
|
|
11751
|
+
return;
|
|
11752
|
+
fromRender = true;
|
|
11753
|
+
buttonRef?.focus();
|
|
11754
|
+
});
|
|
11755
|
+
}
|
|
11756
|
+
return (hAsync("button", { "data-debug-id": iso, role: "gridcell", type: "button", part: partMarkers.join(' '), tabIndex: isFocused ? 0 : -1, "aria-label": ariaLabel, "aria-selected": isSelectedDate ? 'true' : undefined, "aria-current": isTodayDate ? 'date' : undefined, "aria-disabled": isDisabledDate ? 'true' : undefined, onClick: () => {
|
|
11757
|
+
if (isDisabledDate || this.disabled)
|
|
11758
|
+
return;
|
|
11759
|
+
this.selectDate(date, { origin: 'calendar', closePopover: true });
|
|
11760
|
+
}, ref: (e) => {
|
|
11761
|
+
buttonRef = e;
|
|
11762
|
+
if (isFocused)
|
|
11763
|
+
this.focusedButtonRef = e;
|
|
11764
|
+
}, onFocus: (e) => {
|
|
11765
|
+
console.log('focus event on grid cell', iso, e.target);
|
|
11766
|
+
if (!this.el.shadowRoot?.contains(e.target))
|
|
11767
|
+
return;
|
|
11768
|
+
if (fromRender) {
|
|
11769
|
+
fromRender = false;
|
|
11770
|
+
return;
|
|
11771
|
+
}
|
|
11772
|
+
this.setFocusedDate(date);
|
|
11773
|
+
}, key: iso }, date.day));
|
|
11774
|
+
}))))));
|
|
11775
|
+
}
|
|
11776
|
+
render() {
|
|
11777
|
+
const validationLabels = getValidationLabels(this.locale);
|
|
11778
|
+
const popoverLabel = this.label ? `${this.label} ${validationLabels.popoverSuffix}` : undefined;
|
|
11779
|
+
return (hAsync(Host, { key: 'af9d7f075bf97d7eb58c6557f43cf8a245d5f712' }, hAsync("lmvz-input", { key: 'eef4be58281b8356d443c65c5cf6451192e70f75', ref: (el) => {
|
|
11780
|
+
this.inputEl = el;
|
|
11781
|
+
}, label: this.label ?? '', placeholder: this.effectivePlaceholder, helperText: this.helperText, errorMessage: this.errorMessage, error: this.nativeError, disabled: this.disabled, readonly: this.readonly, required: this.required, value: this.inputText, autocomplete: "off", onLmvzInput: this.handleInputTextChange, onKeyDown: this.handleInputKeydown }, hAsync("lmvz-icon", { key: 'fc39ef14720522a8089d33321b918e5577a36cc2', slot: "after-input", icon: CALENDAR_ICON, "aria-hidden": "true" })), hAsync("lmvz-popover", { key: '0076c57da02c7c9d0fcb53584f9dc4127317d6a5', anchor: this.inputEl, open: this.open && !this.disabled, autoFocus: false, size: "md", label: popoverLabel, onLmvzOpen: this.handlePopoverOpen, onLmvzClose: this.handlePopoverClose }, hAsync("div", { key: '4c1e716e52a5d9ed75155dded3c2c39649e1e844', part: "panel", class: "datepicker-panel" }, this.renderHeader(), this.renderGrid()))));
|
|
11782
|
+
}
|
|
11783
|
+
static get delegatesFocus() { return true; }
|
|
11784
|
+
static get formAssociated() { return true; }
|
|
11785
|
+
static get watchers() { return {
|
|
11786
|
+
"required": [{
|
|
11787
|
+
"handleValidityRelevantPropChange": 0
|
|
11788
|
+
}],
|
|
11789
|
+
"min": [{
|
|
11790
|
+
"handleValidityRelevantPropChange": 0
|
|
11791
|
+
}],
|
|
11792
|
+
"max": [{
|
|
11793
|
+
"handleValidityRelevantPropChange": 0
|
|
11794
|
+
}],
|
|
11795
|
+
"locale": [{
|
|
11796
|
+
"handleDisplayFormatChange": 0
|
|
11797
|
+
}],
|
|
11798
|
+
"displayFormat": [{
|
|
11799
|
+
"handleDisplayFormatChange": 0
|
|
11800
|
+
}],
|
|
11801
|
+
"disabled": [{
|
|
11802
|
+
"handleDisabledChange": 0
|
|
11803
|
+
}]
|
|
11804
|
+
}; }
|
|
11805
|
+
static get style() { return lmvzDatepickerCss(); }
|
|
11806
|
+
static get cmpMeta() { return {
|
|
11807
|
+
"$flags$": 601,
|
|
11808
|
+
"$tagName$": "lmvz-datepicker",
|
|
11809
|
+
"$members$": {
|
|
11810
|
+
"value": [6145],
|
|
11811
|
+
"visibleMonth": [6145, "visible-month"],
|
|
11812
|
+
"min": [1],
|
|
11813
|
+
"max": [1],
|
|
11814
|
+
"locale": [1],
|
|
11815
|
+
"firstDayOfWeek": [2, "first-day-of-week"],
|
|
11816
|
+
"disabled": [516],
|
|
11817
|
+
"readonly": [516],
|
|
11818
|
+
"required": [516],
|
|
11819
|
+
"name": [513],
|
|
11820
|
+
"label": [1],
|
|
11821
|
+
"placeholder": [1],
|
|
11822
|
+
"helperText": [1, "helper-text"],
|
|
11823
|
+
"errorMessage": [1, "error-message"],
|
|
11824
|
+
"open": [1540],
|
|
11825
|
+
"displayFormat": [1, "display-format"],
|
|
11826
|
+
"focusedDate": [32],
|
|
11827
|
+
"valueDate": [32],
|
|
11828
|
+
"visibleMonthDate": [32],
|
|
11829
|
+
"inputText": [32],
|
|
11830
|
+
"hasUnparseableInput": [32],
|
|
11831
|
+
"isInvalid": [32],
|
|
11832
|
+
"nativeError": [32],
|
|
11833
|
+
"checkValidity": [64],
|
|
11834
|
+
"reportValidity": [64]
|
|
8991
11835
|
},
|
|
8992
|
-
"$listeners$":
|
|
11836
|
+
"$listeners$": [[0, "keydown", "handleKeydown"], [0, "focusin", "handleInputFocus"], [0, "click", "handleInputFocus"], [0, "invalid", "handleInvalid"]],
|
|
8993
11837
|
"$lazyBundleId$": "-",
|
|
8994
|
-
"$attrsToReflect$": [["
|
|
11838
|
+
"$attrsToReflect$": [["disabled", "disabled"], ["readonly", "readonly"], ["required", "required"], ["name", "name"], ["open", "open"]]
|
|
8995
11839
|
}; }
|
|
8996
11840
|
}
|
|
8997
11841
|
|
|
@@ -9084,7 +11928,7 @@ class LmvzHeader extends ReactiveControllerHost {
|
|
|
9084
11928
|
}
|
|
9085
11929
|
}
|
|
9086
11930
|
render() {
|
|
9087
|
-
return (hAsync(Host, { key: '
|
|
11931
|
+
return (hAsync(Host, { key: '77744fd74160551232eb0347e9ebb01eb3b9bec0', onFocus: this.delegateFocus.bind(this) }, hAsync("div", { key: 'dfd78b2a2ab06b010d9f29dd61f57aced82243fe', class: "brand" }, hAsync("slot", { key: 'c6d29bbdbcbe581a8a170fbeb3d6ab1e31d27dcd', name: "brand" }, hAsync("img", { key: '80cea3b254d153411864d52c2ba300e0eb3c57a7', id: "fallback-logo-lmvz", src: logoSvg, alt: "Lehrmittelverlag Z\u00FCrich" }))), hAsync("nav", { key: '71c53ae0300b61291d0763cdb23f1f645a83928a', "aria-label": "Hauptnavigation" }, hAsync("div", { key: '09949b77a66c54a10c4c141de846fd5697b9d445', role: "menubar", class: "primary-menubar" }, hAsync("slot", { key: 'acec0cf7e13325c49d1e0929b90b056ad1cbbe64', name: "nav-primary", ref: (el) => (this.primarySlot = el) }), hAsync("div", { key: 'd35860c71ad5e28ee2e3aaafb157acbeff41d83e', role: "menu", id: "nav-secondary", class: "secondary-menubar", hidden: !this.lmvzActiveNav, ref: (el) => (this.secondaryNav = el) }, hAsync("slot", { key: 'a4c3a1ad1b1de5bd903b54ed6bd1616ce6517bbb', name: this.secondarySlotName, ref: (el) => (this.secondarySlot = el) })))), hAsync("div", { key: 'ff50045d9ab28bf66a619a48d9ea1f0ed2f5f952', class: "actions" }, hAsync("slot", { key: '6ead0b7a54bf93bb06f0eab2aa8159bd6e96e8f5', name: "actions" }))));
|
|
9088
11932
|
}
|
|
9089
11933
|
static get watchers() { return {
|
|
9090
11934
|
"lmvzActiveNav": [{
|
|
@@ -9153,7 +11997,7 @@ class LmvzIcon extends ReactiveControllerHost {
|
|
|
9153
11997
|
super.componentDidRender();
|
|
9154
11998
|
}
|
|
9155
11999
|
render() {
|
|
9156
|
-
return hAsync(Host, { key: '
|
|
12000
|
+
return hAsync(Host, { key: 'be6032d11399289c3baddd63ebc7d9e1fb98b773', role: "img", "aria-hidden": `${this.ariaHidden}`, innerHTML: this.iconData });
|
|
9157
12001
|
}
|
|
9158
12002
|
waitUntilVisible(callback, rootMargin = 50) {
|
|
9159
12003
|
{
|
|
@@ -9216,7 +12060,7 @@ const hasLazyBuild = (stencilEl) => {
|
|
|
9216
12060
|
return stencilEl.componentOnReady !== undefined;
|
|
9217
12061
|
};
|
|
9218
12062
|
|
|
9219
|
-
const lmvzInputCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('RouterBook-Regular'), local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'); font-weight: 400; } @font-face { font-family: Router; src: local('RouterMedium-Regular'), local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'); font-weight: 500; } @font-face { font-family: Router; src: local('RouterBold-Regular'), local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'); font-weight: 700; } } .sc-lmvz-input-h { display: block; font-family: var(--lmvz-global-font-family-default, Router); --input-radius: var(--lmvz-component-input-radius-default, 999px); --input-bg: var(--lmvz-semantic-color-surface-input-primary, #ffffff); --input-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); --input-border-color-hover: var(--lmvz-semantic-color-border-hover, #a1a1a1); --input-border-color-focus: var(--lmvz-semantic-color-border-active, #0f8acc); --input-border-width: var(--lmvz-semantic-border-width-default, 1px); --input-height: var(--lmvz-component-input-size-md, clamp(2.5rem, 2.44rem + 0.26vw, 2.75rem)); --input-padding-x: var(--lmvz-component-input-padding-md, clamp(0.88rem, 0.84rem + 0.13vw, 1rem)); --input-gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --input-font-size: var(--lmvz-component-body-md-font-size, clamp(0.88rem, 0.84rem + 0.13vw, 1rem)); --label-color: var(--lmvz-semantic-color-on-surface-input-secondary, #545454); --input-text-color: var(--lmvz-semantic-color-on-surface-input-primary, #000000); --helper-text-color: var(--lmvz-semantic-color-on-surface-input-secondary, #545454); --error-text-color: var(--lmvz-semantic-color-status-on-danger, #a31419); --label-minimized-bg: var(--input-bg); --label-minimized-padding-x: 4px; --input-disabled-opacity: var(--lmvz-component-input-disabled-opacity, 40%); } [size='sm'].sc-lmvz-input-h { --input-height: var(--lmvz-component-input-size-sm, clamp(2rem, 1.94rem + 0.26vw, 2.25rem)); --input-padding-x: var(--lmvz-component-input-padding-sm, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); --input-gap: var(--lmvz-component-input-gap-sm, clamp(0.38rem, 0.31rem + 0.26vw, 0.63rem)); --input-font-size: var(--lmvz-component-body-sm-font-size, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); } [size='md'].sc-lmvz-input-h { --input-height: var(--lmvz-component-input-size-md, clamp(2.5rem, 2.44rem + 0.26vw, 2.75rem)); --input-padding-x: var(--lmvz-component-input-padding-md, clamp(0.88rem, 0.84rem + 0.13vw, 1rem)); --input-gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --input-font-size: var(--lmvz-component-body-md-font-size, clamp(0.88rem, 0.84rem + 0.13vw, 1rem)); } [size='lg'].sc-lmvz-input-h { --input-height: var(--lmvz-component-input-size-lg, clamp(2.75rem, 2.69rem + 0.26vw, 3rem)); --input-padding-x: var(--lmvz-component-input-padding-lg, clamp(1rem, 0.94rem + 0.26vw, 1.25rem)); --input-gap: var(--lmvz-component-input-gap-lg, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); --input-font-size: var(--lmvz-component-body-lg-font-size, clamp(1rem, 0.97rem + 0.13vw, 1.13rem)); } .input-container.sc-lmvz-input { display: flex; flex-direction: column; position: relative; width: 100%; } .input-wrapper.sc-lmvz-input { background-color: var(--input-bg); border: var(--input-border-width) solid var(--input-border-color); border-radius: var(--input-radius); display: flex; align-items: center; height: var(--input-height); padding: 0 var(--input-padding-x); position: relative; transition: border-color 0.2s ease; gap: var(--input-gap); } [disabled].sc-lmvz-input-h .input-wrapper.sc-lmvz-input { opacity: var(--input-disabled-opacity); cursor: not-allowed; pointer-events: none; } .
|
|
12063
|
+
const lmvzInputCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('RouterBook-Regular'), local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'); font-weight: 400; } @font-face { font-family: Router; src: local('RouterMedium-Regular'), local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'); font-weight: 500; } @font-face { font-family: Router; src: local('RouterBold-Regular'), local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'); font-weight: 700; } } .sc-lmvz-input-h { display: block; font-family: var(--lmvz-global-font-family-default, Router); --input-radius: var(--lmvz-component-input-radius-default, 999px); --input-bg: var(--lmvz-semantic-color-surface-input-primary, #ffffff); --input-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); --input-border-color-hover: var(--lmvz-semantic-color-border-hover, #a1a1a1); --input-border-color-focus: var(--lmvz-semantic-color-border-active, #0f8acc); --input-border-width: var(--lmvz-semantic-border-width-default, 1px); --input-height: var(--lmvz-component-input-size-md, clamp(2.5rem, 2.44rem + 0.26vw, 2.75rem)); --input-padding-x: var(--lmvz-component-input-padding-md, clamp(0.88rem, 0.84rem + 0.13vw, 1rem)); --input-gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --input-font-size: var(--lmvz-component-body-md-font-size, clamp(0.88rem, 0.84rem + 0.13vw, 1rem)); --label-color: var(--lmvz-semantic-color-on-surface-input-secondary, #545454); --input-text-color: var(--lmvz-semantic-color-on-surface-input-primary, #000000); --helper-text-color: var(--lmvz-semantic-color-on-surface-input-secondary, #545454); --error-text-color: var(--lmvz-semantic-color-status-on-danger, #a31419); --label-minimized-bg: var(--input-bg); --label-minimized-padding-x: 4px; --input-disabled-opacity: var(--lmvz-component-input-disabled-opacity, 40%); } [size='sm'].sc-lmvz-input-h { --input-height: var(--lmvz-component-input-size-sm, clamp(2rem, 1.94rem + 0.26vw, 2.25rem)); --input-padding-x: var(--lmvz-component-input-padding-sm, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); --input-gap: var(--lmvz-component-input-gap-sm, clamp(0.38rem, 0.31rem + 0.26vw, 0.63rem)); --input-font-size: var(--lmvz-component-body-sm-font-size, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); } [size='md'].sc-lmvz-input-h { --input-height: var(--lmvz-component-input-size-md, clamp(2.5rem, 2.44rem + 0.26vw, 2.75rem)); --input-padding-x: var(--lmvz-component-input-padding-md, clamp(0.88rem, 0.84rem + 0.13vw, 1rem)); --input-gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --input-font-size: var(--lmvz-component-body-md-font-size, clamp(0.88rem, 0.84rem + 0.13vw, 1rem)); } [size='lg'].sc-lmvz-input-h { --input-height: var(--lmvz-component-input-size-lg, clamp(2.75rem, 2.69rem + 0.26vw, 3rem)); --input-padding-x: var(--lmvz-component-input-padding-lg, clamp(1rem, 0.94rem + 0.26vw, 1.25rem)); --input-gap: var(--lmvz-component-input-gap-lg, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); --input-font-size: var(--lmvz-component-body-lg-font-size, clamp(1rem, 0.97rem + 0.13vw, 1.13rem)); } .input-container.sc-lmvz-input { display: flex; flex-direction: column; position: relative; width: 100%; } .input-wrapper.sc-lmvz-input { background-color: var(--input-bg); border: var(--input-border-width) solid var(--input-border-color); border-radius: var(--input-radius); display: flex; align-items: center; height: var(--input-height); padding: 0 var(--input-padding-x); position: relative; transition: border-color 0.2s ease; gap: var(--input-gap); } [disabled].sc-lmvz-input-h .input-wrapper.sc-lmvz-input { opacity: var(--input-disabled-opacity); cursor: not-allowed; pointer-events: none; } .sc-lmvz-input-h:has(:focus-visible) .input-wrapper.sc-lmvz-input { border-color: var(--input-border-color-focus); outline: var(--lmvz-ds-outline, 1px solid #0e7ab4); outline-offset: var(--lmvz-ds-outline-offset, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)); } [error].sc-lmvz-input-h .input-wrapper.sc-lmvz-input { border-color: var(--error-text-color); } .sc-lmvz-input-h:not([disabled]) .input-wrapper.sc-lmvz-input:hover { border-color: var(--input-border-color-hover); } .label-input-group.sc-lmvz-input { position: relative; flex-grow: 1; display: flex; align-items: center; height: 100%; } label.sc-lmvz-input { position: absolute; left: 0; top: 50%; transform: translateY(-50%); color: var(--label-color); font-size: var(--input-font-size); font-weight: 400; pointer-events: none; transition: all 0.2s ease-out; background-color: transparent; padding: 0; margin: 0; line-height: 1.5; white-space: nowrap; } label.floating.sc-lmvz-input { top: 0.5em; transform: translateY(-100%); transform-origin: left top; font-size: var(--lmvz-component-body-2xs-font-size, clamp(0.5rem, 0.47rem + 0.13vw, 0.63rem)); background-color: var(--label-minimized-bg); padding: 0 var(--label-minimized-padding-x); left: -2px; color: var(--input-text-color); font-weight: 400; } .required-indicator.sc-lmvz-input { color: var(--error-text-color); margin-left: 2px; } input.sc-lmvz-input { border: none; background: transparent; width: 100%; height: 100%; color: var(--input-text-color); font-family: inherit; font-size: var(--input-font-size); outline: none; padding: 0; margin: 0; font-weight: 400; } input.sc-lmvz-input::placeholder { color: var(--label-color); } div.sc-lmvz-input:empty { display: none; } [role='status'].sc-lmvz-input { padding-top: 8px; padding-left: var(--input-padding-x); font-size: 12px; color: var(--helper-text-color); font-weight: 400; } [role='alert'].sc-lmvz-input { padding-top: 8px; padding-left: var(--input-padding-x); font-size: 12px; color: var(--error-text-color); font-weight: 400; } .sc-lmvz-input-s > lmvz-button { --lmvz-button-padding: var(--lmvz-dimension-6-4, clamp(0.25rem, 0.22rem + 0.13vw, 0.38rem)); --lmvz-button-min-height-override: var(--lmvz-component-input-size-sm, clamp(2rem, 1.94rem + 0.26vw, 2.25rem)); }`;
|
|
9220
12064
|
|
|
9221
12065
|
let inputIdCounter = 0;
|
|
9222
12066
|
class LmvzInput extends ReactiveControllerHost {
|
|
@@ -9226,9 +12070,11 @@ class LmvzInput extends ReactiveControllerHost {
|
|
|
9226
12070
|
}
|
|
9227
12071
|
lmvzInput;
|
|
9228
12072
|
internals;
|
|
12073
|
+
inputValidityActive = false;
|
|
9229
12074
|
nativeInputElement;
|
|
9230
12075
|
inputId = `lmvz-input-${inputIdCounter++}`;
|
|
9231
12076
|
initialValue = '';
|
|
12077
|
+
ariaHostMirrorObserver;
|
|
9232
12078
|
nativeError = false;
|
|
9233
12079
|
errorFromProp = false;
|
|
9234
12080
|
get helperId() {
|
|
@@ -9281,7 +12127,7 @@ class LmvzInput extends ReactiveControllerHost {
|
|
|
9281
12127
|
async setValue(newValue) {
|
|
9282
12128
|
const input = this.nativeInputElement;
|
|
9283
12129
|
const val = newValue ?? '';
|
|
9284
|
-
if (input) {
|
|
12130
|
+
if (input && input.value !== val) {
|
|
9285
12131
|
input.value = val;
|
|
9286
12132
|
}
|
|
9287
12133
|
this.value = val;
|
|
@@ -9303,6 +12149,9 @@ class LmvzInput extends ReactiveControllerHost {
|
|
|
9303
12149
|
async reportValidity() {
|
|
9304
12150
|
return this.nativeInputElement?.reportValidity?.() ?? false;
|
|
9305
12151
|
}
|
|
12152
|
+
async getValidationMessage() {
|
|
12153
|
+
return this.nativeInputElement?.validationMessage ?? '';
|
|
12154
|
+
}
|
|
9306
12155
|
async getInputElement() {
|
|
9307
12156
|
if (!this.nativeInputElement) {
|
|
9308
12157
|
await new Promise((resolve) => componentOnReady(this.el, resolve));
|
|
@@ -9328,14 +12177,54 @@ class LmvzInput extends ReactiveControllerHost {
|
|
|
9328
12177
|
this.initialValue = this.value ?? '';
|
|
9329
12178
|
super.componentWillLoad();
|
|
9330
12179
|
}
|
|
12180
|
+
connectedCallback() {
|
|
12181
|
+
super.connectedCallback();
|
|
12182
|
+
this.ariaHostMirrorObserver = new MutationObserver((mutations) => {
|
|
12183
|
+
for (const mutation of mutations) {
|
|
12184
|
+
this.mirrorHostAriaAttribute(mutation.attributeName);
|
|
12185
|
+
}
|
|
12186
|
+
});
|
|
12187
|
+
this.ariaHostMirrorObserver.observe(this.el, {
|
|
12188
|
+
attributes: true,
|
|
12189
|
+
attributeFilter: [...ariaHostMirrorAttributes],
|
|
12190
|
+
});
|
|
12191
|
+
}
|
|
12192
|
+
disconnectedCallback() {
|
|
12193
|
+
super.disconnectedCallback();
|
|
12194
|
+
this.ariaHostMirrorObserver?.disconnect();
|
|
12195
|
+
this.ariaHostMirrorObserver = undefined;
|
|
12196
|
+
}
|
|
12197
|
+
componentDidLoad() {
|
|
12198
|
+
super.componentDidLoad();
|
|
12199
|
+
for (const attr of ariaHostMirrorAttributes) {
|
|
12200
|
+
this.mirrorHostAriaAttribute(attr);
|
|
12201
|
+
}
|
|
12202
|
+
}
|
|
12203
|
+
mirrorHostAriaAttribute(attr) {
|
|
12204
|
+
if (!attr || !this.nativeInputElement)
|
|
12205
|
+
return;
|
|
12206
|
+
if (this.el.hasAttribute(attr)) {
|
|
12207
|
+
const value = this.el.getAttribute(attr);
|
|
12208
|
+
if (value !== null) {
|
|
12209
|
+
this.nativeInputElement.setAttribute(attr, value);
|
|
12210
|
+
}
|
|
12211
|
+
}
|
|
12212
|
+
else {
|
|
12213
|
+
this.nativeInputElement.removeAttribute(attr);
|
|
12214
|
+
}
|
|
12215
|
+
}
|
|
9331
12216
|
formAssociatedCallback(form) {
|
|
9332
12217
|
if (!form)
|
|
9333
12218
|
return;
|
|
9334
12219
|
this.internals.setFormValue?.(this.value ?? '');
|
|
9335
12220
|
}
|
|
9336
12221
|
formResetCallback() {
|
|
12222
|
+
this.inputValidityActive = false;
|
|
9337
12223
|
this.internals.setValidity({});
|
|
9338
12224
|
this.setValue(this.initialValue);
|
|
12225
|
+
if (this.nativeInputElement?.checkValidity?.()) {
|
|
12226
|
+
this.nativeError = false;
|
|
12227
|
+
}
|
|
9339
12228
|
}
|
|
9340
12229
|
formStateRestoreCallback(state) {
|
|
9341
12230
|
this.setValue(state);
|
|
@@ -9349,35 +12238,45 @@ class LmvzInput extends ReactiveControllerHost {
|
|
|
9349
12238
|
this.setValue(newValue);
|
|
9350
12239
|
}
|
|
9351
12240
|
handleDisabledChange(disabled) {
|
|
9352
|
-
if (
|
|
12241
|
+
if (!this.nativeInputElement)
|
|
12242
|
+
return;
|
|
12243
|
+
if (disabled) {
|
|
9353
12244
|
this.nativeInputElement.blur();
|
|
9354
12245
|
}
|
|
12246
|
+
else {
|
|
12247
|
+
this.inputValidityActive = false;
|
|
12248
|
+
}
|
|
9355
12249
|
}
|
|
9356
12250
|
handleInput = (event) => {
|
|
9357
12251
|
const input = event.target;
|
|
9358
12252
|
this.setValue(input.value);
|
|
12253
|
+
if (!this.inputValidityActive)
|
|
12254
|
+
return;
|
|
12255
|
+
this.updateNativeError('input');
|
|
9359
12256
|
};
|
|
9360
12257
|
handleChange = (event) => {
|
|
9361
|
-
const input = event.target ?? this.nativeInputElement;
|
|
9362
|
-
this.updateNativeError(input);
|
|
9363
12258
|
};
|
|
9364
12259
|
handleFocus = () => { };
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
12260
|
+
handleInvalid = () => this.updateNativeError('invalid');
|
|
12261
|
+
handleBlur = () => {
|
|
12262
|
+
this.inputValidityActive = true;
|
|
12263
|
+
this.updateNativeError('blur');
|
|
9368
12264
|
};
|
|
9369
|
-
updateNativeError(
|
|
9370
|
-
const input =
|
|
12265
|
+
updateNativeError(sourceEvent) {
|
|
12266
|
+
const input = this.nativeInputElement;
|
|
9371
12267
|
if (!input)
|
|
9372
12268
|
return;
|
|
9373
|
-
|
|
12269
|
+
const newState = sourceEvent === 'invalid' ? true : !(input.checkValidity?.() ?? true);
|
|
12270
|
+
if (this.nativeError === newState)
|
|
12271
|
+
return;
|
|
12272
|
+
this.nativeError = newState;
|
|
9374
12273
|
}
|
|
9375
12274
|
render() {
|
|
9376
12275
|
const hasValue = Boolean(this.value);
|
|
9377
12276
|
const shouldFloatLabel = hasValue || Boolean(this.placeholder);
|
|
9378
|
-
return (hAsync("div", { key: '
|
|
12277
|
+
return (hAsync("div", { key: '626697f00e9ba3ad46e6304d06b04df0f27bb2c2', class: classNames('input-container', {
|
|
9379
12278
|
'interaction-filled': hasValue,
|
|
9380
|
-
}) }, hAsync("div", { key: '
|
|
12279
|
+
}) }, hAsync("div", { key: '25ec1f448b689ff80defded1323f321d95d6b197', class: "input-wrapper" }, hAsync("slot", { key: '1d5f301e0327b4cd1714f403615f94658a754466', name: "before-input" }), hAsync("div", { key: 'ef553e6e8f6b74a5bb7cddef003d3b51650c7c9d', class: "label-input-group" }, hAsync("label", { key: '17d92ff7c65598739e8a379680580561936e21dc', htmlFor: this.inputId, class: classNames({ floating: shouldFloatLabel }) }, this.label, this.required && (hAsync("span", { key: 'cd40da3c85cc6cea49d7d8d270bba317534779f5', class: "required-indicator", "aria-hidden": "true" }, ' ', "*"))), hAsync("input", { key: '3ede0644d383c2a3f702230de2aac6fbcb2c7a06', id: this.inputId, ref: (el) => (this.nativeInputElement = el), type: this.type, min: this.min, max: this.max, step: this.step, value: this.value, name: this.name, placeholder: this.placeholder, disabled: this.disabled, readonly: this.readonly, required: this.required, form: this.form, autocomplete: this.autocomplete, inputmode: this.inputmode, autocorrect: this.autocorrect, autocapitalize: this.autocapitalize, spellcheck: this.spellcheck, autofocus: this.autofocus, minlength: this.minlength, maxlength: this.maxlength, pattern: this.pattern, "aria-invalid": this.error ? 'true' : 'false', "aria-required": this.required ? 'true' : 'false', "aria-describedby": this.describedBy, "aria-errormessage": this.errorId, onInput: this.handleInput, onChange: this.handleChange, onFocus: this.handleFocus, onBlur: this.handleBlur, onInvalid: this.handleInvalid })), hAsync("slot", { key: 'b282c5d9553b72af7fd05ed0f872af0d7b8a5689', name: "after-input" })), hAsync("div", { key: 'da6008e798cb5ee29fa7d1ba3208057c1845a217', id: this.helperId, role: "status" }, this.helperText || null), hAsync("div", { key: '5e7717a2d0dd32c53dd7ba6e170152239f3bfae9', id: this.errorId, role: "alert" }, (this.showErrorMessage && this.errorMessage) || null)));
|
|
9381
12280
|
}
|
|
9382
12281
|
static get formAssociated() { return true; }
|
|
9383
12282
|
static get watchers() { return {
|
|
@@ -9425,6 +12324,7 @@ class LmvzInput extends ReactiveControllerHost {
|
|
|
9425
12324
|
"select": [64],
|
|
9426
12325
|
"checkValidity": [64],
|
|
9427
12326
|
"reportValidity": [64],
|
|
12327
|
+
"getValidationMessage": [64],
|
|
9428
12328
|
"getInputElement": [64]
|
|
9429
12329
|
},
|
|
9430
12330
|
"$listeners$": undefined,
|
|
@@ -9483,7 +12383,7 @@ class LmvzLink {
|
|
|
9483
12383
|
const rel = this.computeRel();
|
|
9484
12384
|
const iconSvg = this.type === 'external' ? EXTERNAL_SVG : ARROW_RIGHT_SVG;
|
|
9485
12385
|
const isBlank = this.target === '_blank';
|
|
9486
|
-
return (hAsync(Host, { key: '
|
|
12386
|
+
return (hAsync(Host, { key: 'ee4f5c107243ff858f9189840e56a0525fdac782' }, hAsync("a", { key: '28229373bec276579c2bb7b9fcf254872baae9e8', href: this.computeHref(), target: this.target, rel: rel }, hAsync("slot", { key: '7c58f3f7501e457ee4a35d2a9f2bf80ed0c33fb0' }), hAsync("lmvz-icon", { key: '14784743d148d57e7c83da0f92ba96e4bb3a30a1', "aria-hidden": "true", icon: iconSvg }), isBlank && hAsync("span", { key: 'f72adde57b462282d1a8313e2eb06cf6b68c2697', class: "sr-only" }, this.externalLabel))));
|
|
9487
12387
|
}
|
|
9488
12388
|
static get delegatesFocus() { return true; }
|
|
9489
12389
|
static get watchers() { return {
|
|
@@ -9531,7 +12431,7 @@ class LmvzMenuItem extends ReactiveControllerHost {
|
|
|
9531
12431
|
this.addController(new ElementActivationController(this));
|
|
9532
12432
|
}
|
|
9533
12433
|
render() {
|
|
9534
|
-
return (hAsync(Host, { key: '
|
|
12434
|
+
return (hAsync(Host, { key: 'cd5814d6bcfa9b0f5b1b2f5108ce0fc65722b909' }, hAsync("slot", { key: 'b503b252c95bc09ca4b888d4576badd3976292e9', ref: (e) => (this.validationSlot = e) })));
|
|
9535
12435
|
}
|
|
9536
12436
|
static get style() { return lmvzMenuitemCss(); }
|
|
9537
12437
|
static get cmpMeta() { return {
|
|
@@ -9649,7 +12549,7 @@ class LmvzMessage {
|
|
|
9649
12549
|
}
|
|
9650
12550
|
render() {
|
|
9651
12551
|
const role = this.live === 'assertive' ? 'alert' : this.live === 'polite' ? 'status' : 'note';
|
|
9652
|
-
return (hAsync(Host, { key: '
|
|
12552
|
+
return (hAsync(Host, { key: '1c45cf27f057535ffff047548a3d6681dd487d3c', role: role }, this.leadingIcon && hAsync("span", { key: '8efab69f677dfaa06d333aa304479e17e6d60ad6', class: "leading-icon", "aria-hidden": "true", innerHTML: TYPE_SVG[this.type] }), hAsync("span", { key: '2e88e9053444e2aae23341b7cba923c7c440ff64', class: "message" }, hAsync("slot", { key: 'd6b0ee6c95846a1de97e0e6ed707001c29c78c92', ref: (el) => (this.messageSlot = el), onSlotchange: this.handleSlotChange })), this.actionLabel && (hAsync("lmvz-button", { key: 'c55e38e274e98c8ac584ae16520fb0cab5e11d17', variant: "tertiary", scale: "small", onLmvzActivation: this.handleActionClick }, this.actionLabel)), this.dismissible && (hAsync("lmvz-button", { key: '1ae69fefbb23cd8a219aee1d624e9d7779ae0c08', variant: "tertiary", scale: "small", "aria-label": this.closeLabel, onClick: this.handleDismissClick }, hAsync("lmvz-icon", { key: '572c5b3309a1b1b9798dc6fc3f4ad11d0a354ebc', "aria-hidden": "true", icon: CLOSE_SM_SVG })))));
|
|
9653
12553
|
}
|
|
9654
12554
|
static get style() { return lmvzMessageCss(); }
|
|
9655
12555
|
static get cmpMeta() { return {
|
|
@@ -9893,7 +12793,7 @@ class LmvzModal extends ReactiveControllerHost {
|
|
|
9893
12793
|
this.hasHeader = this.hasAssignedContent(this.headerSlot);
|
|
9894
12794
|
};
|
|
9895
12795
|
render() {
|
|
9896
|
-
return (hAsync(Host, { key: '
|
|
12796
|
+
return (hAsync(Host, { key: '9eb1aa89e4c682586d10291e2a8a2523b8fd17f7' }, hAsync("dialog", { key: '477c537328622f85759dc72a0c499d56e3d5e345', ref: (element) => (this.dialogEl = element), onCancel: this.handleDialogCancel, onClose: this.handleDialogClose, ...this.dialogAccessibilityAttributes }, hAsync("div", { key: 'b9fe9cb306938a117002e5213740ea20269080b8', class: "modal-shell" }, hAsync("header", { key: '34d0cd8078d55d98ec526843f02710044663de70', class: { header: true, 'has-title': this.hasHeader } }, hAsync("div", { key: '1408f0e0875f5e0508ad0f5682f4879a93df65df', class: "title", id: this.dialogTitleId, hidden: !this.hasHeader }, hAsync("slot", { key: '735c1757962e4f3804700a4669d0b49f2d11fb16', name: "header", ref: (element) => (this.headerSlot = element), onSlotchange: this.handleHeaderSlotChange })), hAsync("lmvz-button", { key: 'b0eb76cde508fb434023abdc0f764e1b809b6447', ref: (element) => (this.closeButtonEl = element), type: "button", class: "close-button", "aria-label": this.closeLabel, onLmvzActivation: this.handleCloseButtonClick, variant: "tertiary" }, hAsync("lmvz-icon", { key: '9f978d3117a4046202c3ba1df39aa0c7afc7ee28', icon: closeIconSvg }))), hAsync("div", { key: '46ffd7e7315099189c0a2499d17bdeabeb0e46e5', class: "body" }, hAsync("slot", { key: '095c3353f2ea00f6fa765ac0972ee0123f8e4154' })), hAsync("footer", { key: '5b092b00f10acede66d0fac53f01584ecf528418', class: "actions", hidden: !this.buttonGroupEl?.hasActions }, hAsync("lmvz-button-group", { key: 'ce312e1b1c3407838b8704f20393e7120d6338f9', ref: (element) => (this.buttonGroupEl = element) }, hAsync("slot", { key: '6246782cbee1cc440cfdaf45dac36655f19c972e', name: "actions" })))))));
|
|
9897
12797
|
}
|
|
9898
12798
|
static get watchers() { return {
|
|
9899
12799
|
"open": [{
|
|
@@ -11272,7 +14172,7 @@ const computePosition = (reference, floating, options) => {
|
|
|
11272
14172
|
});
|
|
11273
14173
|
};
|
|
11274
14174
|
|
|
11275
|
-
const lmvzPopoverCss = () => `@layer lmvz-ds.reset,lmvz-ds.theme,lmvz-ds.components,lmvz-ds.overrides; @layer lmvz-ds.components{.lmvz-wrapper-card-sm,.lmvz-wrapper-card-md,.lmvz-wrapper-card-lg{background:var(--lmvz-semantic-color-surface-primary, #ffffff);box-shadow:var(--lmvz-ds-shadow-l3-default-strong, 0 2px 32px 0 rgba(120, 120, 128, 0.11))}.lmvz-wrapper-card-sm{padding:var(--lmvz-component-wrapper-sm-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)) var(--lmvz-component-wrapper-sm-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem));border-radius:var(--lmvz-component-wrapper-sm-border-radius, 14px)}.lmvz-wrapper-card-md{padding:var(--lmvz-component-wrapper-md-padding-y, clamp(1rem, 0.88rem + 0.52vw, 1.5rem)) var(--lmvz-component-wrapper-md-padding-x, clamp(1rem, 0.88rem + 0.52vw, 1.5rem));border-radius:var(--lmvz-component-wrapper-md-border-radius, 18px)}.lmvz-wrapper-card-lg{padding:var(--lmvz-component-wrapper-lg-padding-y, clamp(2.25rem, 2.19rem + 0.26vw, 2.5rem)) var(--lmvz-component-wrapper-lg-padding-x, clamp(1.5rem, 1.14rem + 1.55vw, 3rem));border-radius:var(--lmvz-component-wrapper-lg-border-radius, 18px)}}:host{--lmvz-popover-z-index-internal:var(--lmvz-popover-z-index,
|
|
14175
|
+
const lmvzPopoverCss = () => `@layer lmvz-ds.reset,lmvz-ds.theme,lmvz-ds.components,lmvz-ds.overrides; @layer lmvz-ds.components{.lmvz-wrapper-card-sm,.lmvz-wrapper-card-md,.lmvz-wrapper-card-lg{background:var(--lmvz-semantic-color-surface-primary, #ffffff);box-shadow:var(--lmvz-ds-shadow-l3-default-strong, 0 2px 32px 0 rgba(120, 120, 128, 0.11))}.lmvz-wrapper-card-sm{padding:var(--lmvz-component-wrapper-sm-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)) var(--lmvz-component-wrapper-sm-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem));border-radius:var(--lmvz-component-wrapper-sm-border-radius, 14px)}.lmvz-wrapper-card-md{padding:var(--lmvz-component-wrapper-md-padding-y, clamp(1rem, 0.88rem + 0.52vw, 1.5rem)) var(--lmvz-component-wrapper-md-padding-x, clamp(1rem, 0.88rem + 0.52vw, 1.5rem));border-radius:var(--lmvz-component-wrapper-md-border-radius, 18px)}.lmvz-wrapper-card-lg{padding:var(--lmvz-component-wrapper-lg-padding-y, clamp(2.25rem, 2.19rem + 0.26vw, 2.5rem)) var(--lmvz-component-wrapper-lg-padding-x, clamp(1.5rem, 1.14rem + 1.55vw, 3rem));border-radius:var(--lmvz-component-wrapper-lg-border-radius, 18px)}}:host{--lmvz-popover-z-index-internal:var(--lmvz-popover-z-index, 100);display:contents;.container{position:absolute;top:-9999999999px;left:-9999999999px;max-width:var(--lmvz-popover-max-width, none);max-height:var(--lmvz-popover-max-height, none);z-index:var(--lmvz-popover-z-index-internal);overflow:auto;box-sizing:border-box}}:host(:not([open])) .container{display:none}`;
|
|
11276
14176
|
|
|
11277
14177
|
class LmvzPopover {
|
|
11278
14178
|
constructor(hostRef) {
|
|
@@ -11293,6 +14193,7 @@ class LmvzPopover {
|
|
|
11293
14193
|
placement = 'bottom-start';
|
|
11294
14194
|
size = 'sm';
|
|
11295
14195
|
autoFocus = true;
|
|
14196
|
+
containerRole = 'dialog';
|
|
11296
14197
|
label;
|
|
11297
14198
|
lmvzOpen;
|
|
11298
14199
|
lmvzClose;
|
|
@@ -11313,6 +14214,7 @@ class LmvzPopover {
|
|
|
11313
14214
|
}
|
|
11314
14215
|
componentDidLoad() {
|
|
11315
14216
|
autoAssignId(this.el);
|
|
14217
|
+
this.syncContainerId();
|
|
11316
14218
|
}
|
|
11317
14219
|
handleOpenChange(isOpen) {
|
|
11318
14220
|
if (isOpen) {
|
|
@@ -11339,16 +14241,26 @@ class LmvzPopover {
|
|
|
11339
14241
|
this.removeCloseHandlers();
|
|
11340
14242
|
this.extEventController.abort();
|
|
11341
14243
|
}
|
|
14244
|
+
syncContainerId() {
|
|
14245
|
+
const hostId = this.el.getAttribute('id');
|
|
14246
|
+
if (!hostId || !this.containerEl)
|
|
14247
|
+
return;
|
|
14248
|
+
this.containerEl.id = hostId;
|
|
14249
|
+
}
|
|
11342
14250
|
setupAnchorEl() {
|
|
11343
14251
|
const { anchorEl } = this;
|
|
11344
14252
|
if (!anchorEl) {
|
|
11345
14253
|
console.warn('no anchor element set for', this);
|
|
11346
14254
|
return;
|
|
11347
14255
|
}
|
|
14256
|
+
this.syncContainerId();
|
|
11348
14257
|
if (!anchorEl.hasAttribute('aria-haspopup')) {
|
|
11349
|
-
anchorEl.setAttribute('aria-haspopup', 'dialog');
|
|
14258
|
+
anchorEl.setAttribute('aria-haspopup', this.containerRole === 'dialog' ? 'dialog' : this.containerRole);
|
|
14259
|
+
}
|
|
14260
|
+
anchorEl.setAttribute('aria-controls', this.containerEl?.id || this.el.getAttribute('id'));
|
|
14261
|
+
if (!anchorEl.hasAttribute('aria-expanded')) {
|
|
14262
|
+
anchorEl.setAttribute('aria-expanded', this.open ? 'true' : 'false');
|
|
11350
14263
|
}
|
|
11351
|
-
anchorEl.setAttribute('aria-controls', this.el.getAttribute('id'));
|
|
11352
14264
|
if (isActionButton(anchorEl)) {
|
|
11353
14265
|
addElementActivationListener(anchorEl, this.toggle.bind(this), this.extEventController.signal);
|
|
11354
14266
|
}
|
|
@@ -11373,10 +14285,11 @@ class LmvzPopover {
|
|
|
11373
14285
|
await waitFrame();
|
|
11374
14286
|
await this.updatePosition();
|
|
11375
14287
|
autoAssignId(this.el);
|
|
14288
|
+
this.syncContainerId();
|
|
11376
14289
|
this.applyAnchorAriaOpen();
|
|
11377
14290
|
this.lmvzOpen.emit();
|
|
11378
14291
|
await waitFrame();
|
|
11379
|
-
if (this.autoFocus) {
|
|
14292
|
+
if (this.autoFocus && this.containerRole === 'dialog') {
|
|
11380
14293
|
this.focusFirst();
|
|
11381
14294
|
}
|
|
11382
14295
|
}
|
|
@@ -11434,7 +14347,8 @@ class LmvzPopover {
|
|
|
11434
14347
|
document.addEventListener('mousedown', (event) => {
|
|
11435
14348
|
if (!this.open)
|
|
11436
14349
|
return;
|
|
11437
|
-
|
|
14350
|
+
const mouseTarget = (event.target?.shadowRoot ?? document).elementFromPoint(event.x, event.y) ?? event.target;
|
|
14351
|
+
if (this.el === event.target || this.el.contains(mouseTarget) || this.el.contains(event.target))
|
|
11438
14352
|
return;
|
|
11439
14353
|
this.triggerClose();
|
|
11440
14354
|
}, options);
|
|
@@ -11450,7 +14364,7 @@ class LmvzPopover {
|
|
|
11450
14364
|
this.closureController?.abort();
|
|
11451
14365
|
}
|
|
11452
14366
|
render() {
|
|
11453
|
-
return (hAsync(Host, { key: '
|
|
14367
|
+
return (hAsync(Host, { key: '8dadcc766deebc03ea744fd1002078b382bfd48d' }, hAsync("div", { key: 'd332714964212db6f5446afb1b8f38ff031a87b9', role: this.containerRole, part: "container", class: `container lmvz-wrapper-card-${this.size}`, "aria-label": this.label || undefined, ref: (el) => (this.containerEl = el) }, hAsync("slot", { key: '0fa1d214c8c48942751cbd4759ebc992eacc8f72', ref: (el) => (this.slotEl = el) }))));
|
|
11454
14368
|
}
|
|
11455
14369
|
static get watchers() { return {
|
|
11456
14370
|
"open": [{
|
|
@@ -11470,6 +14384,7 @@ class LmvzPopover {
|
|
|
11470
14384
|
"placement": [1],
|
|
11471
14385
|
"size": [1],
|
|
11472
14386
|
"autoFocus": [4, "auto-focus"],
|
|
14387
|
+
"containerRole": [1, "container-role"],
|
|
11473
14388
|
"label": [1],
|
|
11474
14389
|
"anchorEl": [32],
|
|
11475
14390
|
"show": [64],
|
|
@@ -11544,6 +14459,7 @@ class RadioGroup {
|
|
|
11544
14459
|
if (wasEmpty) {
|
|
11545
14460
|
document.addEventListener('focusin', this._focusinHandler, true);
|
|
11546
14461
|
}
|
|
14462
|
+
this.refreshValidity();
|
|
11547
14463
|
}
|
|
11548
14464
|
}
|
|
11549
14465
|
unregister(host) {
|
|
@@ -11554,10 +14470,19 @@ class RadioGroup {
|
|
|
11554
14470
|
if (this.hosts.length === 0) {
|
|
11555
14471
|
document.removeEventListener('focusin', this._focusinHandler, true);
|
|
11556
14472
|
}
|
|
14473
|
+
this.refreshValidity();
|
|
11557
14474
|
}
|
|
11558
14475
|
get sortedEnabled() {
|
|
11559
14476
|
return this.hosts.filter((h) => !h.disabled);
|
|
11560
14477
|
}
|
|
14478
|
+
isAnyChecked() {
|
|
14479
|
+
return this.hosts.some((host) => host.checked);
|
|
14480
|
+
}
|
|
14481
|
+
refreshValidity() {
|
|
14482
|
+
for (const host of this.hosts) {
|
|
14483
|
+
host.updateValidity();
|
|
14484
|
+
}
|
|
14485
|
+
}
|
|
11561
14486
|
setFocused(host) {
|
|
11562
14487
|
this._focusedHost = host;
|
|
11563
14488
|
this.updateTabindex();
|
|
@@ -11573,6 +14498,7 @@ class RadioGroup {
|
|
|
11573
14498
|
host.checked = host === selectedHost;
|
|
11574
14499
|
}
|
|
11575
14500
|
this.updateTabindex();
|
|
14501
|
+
this.refreshValidity();
|
|
11576
14502
|
}
|
|
11577
14503
|
updateTabindex() {
|
|
11578
14504
|
const enabled = this.sortedEnabled;
|
|
@@ -11634,6 +14560,12 @@ class RadioGroupController {
|
|
|
11634
14560
|
select(selectedHost) {
|
|
11635
14561
|
this.group?.select(selectedHost);
|
|
11636
14562
|
}
|
|
14563
|
+
isAnyChecked() {
|
|
14564
|
+
return this.group?.isAnyChecked() ?? false;
|
|
14565
|
+
}
|
|
14566
|
+
refreshValidity() {
|
|
14567
|
+
this.group?.refreshValidity();
|
|
14568
|
+
}
|
|
11637
14569
|
setFocused(host) {
|
|
11638
14570
|
this.group?.setFocused(host);
|
|
11639
14571
|
}
|
|
@@ -11676,7 +14608,7 @@ class RadioGroupController {
|
|
|
11676
14608
|
|
|
11677
14609
|
const lmvzRadioCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('RouterBook-Regular'), local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'); font-weight: 400; } @font-face { font-family: Router; src: local('RouterMedium-Regular'), local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'); font-weight: 500; } @font-face { font-family: Router; src: local('RouterBold-Regular'), local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'); font-weight: 700; } } .sc-lmvz-radio-h { display: inline-block; --radio-circle-size: var(--lmvz-global-s18, 18px); --radio-dot-size: 0.5rem; --radio-bg: var(--lmvz-semantic-color-surface-input-primary, #ffffff); --radio-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); --radio-border-color-hover: var(--lmvz-semantic-color-border-hover, #a1a1a1); --radio-border-color-checked: var(--lmvz-semantic-color-border-active, #0f8acc); --radio-border-color-error: var(--lmvz-semantic-color-status-on-danger, #a31419); --radio-dot-color: var(--lmvz-semantic-color-border-active, #0f8acc); --radio-wrapper-bg-hover: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); --radio-wrapper-bg-active: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); --radio-label-color: var(--lmvz-semantic-color-on-surface-primary, #000000); --radio-label-color-checked: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --radio-helper-color: var(--lmvz-semantic-color-on-surface-secondary, #545454); --radio-easing: var(--lmvz-global-easing-default, ease); --radio-duration: 0.2s; display: flex; align-items: center; gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); padding-block: var(--lmvz-dimension-8-2, clamp(0.13rem, 0.03rem + 0.39vw, 0.5rem)); padding-inline: var(--lmvz-dimension-12-8, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); border-radius: var(--lmvz-semantic-border-radius-round, 999px); overflow: clip; cursor: pointer; background-color: transparent; position: relative; transition: background-color var(--radio-duration) var(--radio-easing); } input.sc-lmvz-radio { position: absolute; inset-block-start: var(--lmvz-dimension-8-2, clamp(0.13rem, 0.03rem + 0.39vw, 0.5rem)); inset-inline-start: var(--lmvz-dimension-10-4, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); opacity: 0; width: var(--radio-circle-size); height: var(--radio-circle-size); margin: 0; cursor: pointer; z-index: 1; } .circle.sc-lmvz-radio { width: var(--radio-circle-size); height: var(--radio-circle-size); border-radius: 50%; border: var(--lmvz-semantic-border-width-default, 1px) solid var(--radio-border-color); background-color: var(--radio-bg); pointer-events: none; flex-shrink: 0; display: flex; align-items: center; justify-content: center; box-sizing: border-box; transition: border-color var(--radio-duration) var(--radio-easing); } .dot.sc-lmvz-radio { width: var(--radio-dot-size); height: var(--radio-dot-size); border-radius: 50%; background-color: var(--radio-dot-color); } .content.sc-lmvz-radio { display: flex; flex-direction: column; overflow-wrap: break-word; min-width: 0; } label.sc-lmvz-radio { font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.5 Router); color: var(--radio-label-color); cursor: pointer; transition: color var(--radio-duration) var(--radio-easing); } .helper-text.sc-lmvz-radio { display: block; font: var(--lmvz-typography-body-sm, 400 clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem) / 1.5 Router); color: var(--radio-helper-color); margin-block-start: 2px; } .helper-text.sc-lmvz-radio:empty { display: none; } @media (hover: hover) { .sc-lmvz-radio-h:hover .circle.sc-lmvz-radio { border-color: var(--radio-border-color-hover); } .sc-lmvz-radio-h:hover { background-color: var(--radio-wrapper-bg-hover); } } .sc-lmvz-radio-h:active { background-color: var(--radio-wrapper-bg-active); } [checked].sc-lmvz-radio-h .circle.sc-lmvz-radio { border-color: var(--radio-border-color-checked); } [checked].sc-lmvz-radio-h label.sc-lmvz-radio { color: var(--radio-label-color-checked); } [error].sc-lmvz-radio-h .circle.sc-lmvz-radio { border-color: var(--radio-border-color-error); } [error].sc-lmvz-radio-h .helper-text.sc-lmvz-radio { color: var(--lmvz-semantic-color-status-on-danger, #a31419); } [disabled].sc-lmvz-radio-h { opacity: var(--lmvz-component-input-disabled-opacity, 40%); pointer-events: none; cursor: not-allowed; } @media (forced-colors: active) { .circle.sc-lmvz-radio { forced-color-adjust: auto; border-color: ButtonText; background-color: Field; } [checked].sc-lmvz-radio-h .circle.sc-lmvz-radio { border-color: Highlight; } .dot.sc-lmvz-radio { background-color: ButtonText; } [checked].sc-lmvz-radio-h .dot.sc-lmvz-radio { background-color: HighlightText; } }`;
|
|
11678
14610
|
|
|
11679
|
-
const focusWithinCss$1 = () => `.sc-lmvz-radio-h:focus-
|
|
14611
|
+
const focusWithinCss$1 = () => `.sc-lmvz-radio-h:has(:focus-visible){outline:var(--lmvz-ds-outline, 1px solid #0e7ab4);outline-offset:var(--lmvz-ds-outline-offset, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem))}@media (forced-colors: active){.sc-lmvz-radio-h:has(:focus-visible){outline-color:Highlight;box-shadow:none}}`;
|
|
11680
14612
|
|
|
11681
14613
|
let radioIdCounter = 0;
|
|
11682
14614
|
class LmvzRadio extends ReactiveControllerHost {
|
|
@@ -11698,7 +14630,14 @@ class LmvzRadio extends ReactiveControllerHost {
|
|
|
11698
14630
|
name;
|
|
11699
14631
|
disabled = false;
|
|
11700
14632
|
required = false;
|
|
11701
|
-
|
|
14633
|
+
nativeError = false;
|
|
14634
|
+
errorFromProp = false;
|
|
14635
|
+
get error() {
|
|
14636
|
+
return this.errorFromProp || this.nativeError;
|
|
14637
|
+
}
|
|
14638
|
+
set error(value) {
|
|
14639
|
+
this.errorFromProp = value;
|
|
14640
|
+
}
|
|
11702
14641
|
helperText;
|
|
11703
14642
|
form;
|
|
11704
14643
|
autofocus = false;
|
|
@@ -11706,6 +14645,7 @@ class LmvzRadio extends ReactiveControllerHost {
|
|
|
11706
14645
|
_handlingFormReset = false;
|
|
11707
14646
|
handleCheckedChange(newVal, oldVal) {
|
|
11708
14647
|
this.internals.setFormValue?.(newVal ? this.value : null);
|
|
14648
|
+
this.updateValidity();
|
|
11709
14649
|
if (!newVal && oldVal && !this._handlingNativeChange && !this._handlingFormReset) {
|
|
11710
14650
|
this.lmvzChange.emit(false);
|
|
11711
14651
|
}
|
|
@@ -11713,6 +14653,9 @@ class LmvzRadio extends ReactiveControllerHost {
|
|
|
11713
14653
|
this.lmvzChange.emit(true);
|
|
11714
14654
|
}
|
|
11715
14655
|
}
|
|
14656
|
+
handleRequiredChange() {
|
|
14657
|
+
this.updateValidity();
|
|
14658
|
+
}
|
|
11716
14659
|
handleValueChange(newVal) {
|
|
11717
14660
|
if (this.checked) {
|
|
11718
14661
|
this.internals.setFormValue?.(newVal);
|
|
@@ -11734,6 +14677,9 @@ class LmvzRadio extends ReactiveControllerHost {
|
|
|
11734
14677
|
async reportValidity() {
|
|
11735
14678
|
return this.internals?.reportValidity() ?? true;
|
|
11736
14679
|
}
|
|
14680
|
+
async getValidationMessage() {
|
|
14681
|
+
return this.internals?.validationMessage ?? '';
|
|
14682
|
+
}
|
|
11737
14683
|
constructor(hostRef) {
|
|
11738
14684
|
super();
|
|
11739
14685
|
registerInstance(this, hostRef);
|
|
@@ -11755,8 +14701,13 @@ class LmvzRadio extends ReactiveControllerHost {
|
|
|
11755
14701
|
componentWillLoad() {
|
|
11756
14702
|
this.initialChecked = this.checked;
|
|
11757
14703
|
this.internals.setFormValue?.(this.checked ? this.value : null);
|
|
14704
|
+
this.updateValidity();
|
|
11758
14705
|
super.componentWillLoad();
|
|
11759
14706
|
}
|
|
14707
|
+
componentDidLoad() {
|
|
14708
|
+
this.updateValidity();
|
|
14709
|
+
super.componentDidLoad();
|
|
14710
|
+
}
|
|
11760
14711
|
formAssociatedCallback() {
|
|
11761
14712
|
this.internals.setFormValue?.(this.checked ? this.value : null);
|
|
11762
14713
|
}
|
|
@@ -11768,6 +14719,8 @@ class LmvzRadio extends ReactiveControllerHost {
|
|
|
11768
14719
|
finally {
|
|
11769
14720
|
this._handlingFormReset = false;
|
|
11770
14721
|
}
|
|
14722
|
+
this.updateValidity();
|
|
14723
|
+
this.radioGroupController.refreshValidity();
|
|
11771
14724
|
}
|
|
11772
14725
|
formStateRestoreCallback(state) {
|
|
11773
14726
|
if (typeof state !== 'string')
|
|
@@ -11780,6 +14733,20 @@ class LmvzRadio extends ReactiveControllerHost {
|
|
|
11780
14733
|
this._handlingFormReset = false;
|
|
11781
14734
|
}
|
|
11782
14735
|
}
|
|
14736
|
+
isAnyInGroupChecked() {
|
|
14737
|
+
return this.radioGroupController.isAnyChecked();
|
|
14738
|
+
}
|
|
14739
|
+
updateValidity() {
|
|
14740
|
+
if (this.required && !this.isAnyInGroupChecked()) {
|
|
14741
|
+
this.internals.setValidity?.({ valueMissing: true }, 'Please select an option.', this.nativeInput);
|
|
14742
|
+
return;
|
|
14743
|
+
}
|
|
14744
|
+
this.internals.setValidity?.({});
|
|
14745
|
+
this.nativeError = false;
|
|
14746
|
+
}
|
|
14747
|
+
handleInvalid() {
|
|
14748
|
+
this.nativeError = true;
|
|
14749
|
+
}
|
|
11783
14750
|
handleChange = (event) => {
|
|
11784
14751
|
this._handlingNativeChange = true;
|
|
11785
14752
|
try {
|
|
@@ -11822,14 +14789,20 @@ class LmvzRadio extends ReactiveControllerHost {
|
|
|
11822
14789
|
return;
|
|
11823
14790
|
this.radioGroupController.setFocused(target);
|
|
11824
14791
|
}
|
|
14792
|
+
retargetInnerClicks() {
|
|
14793
|
+
this.nativeInput?.click();
|
|
14794
|
+
}
|
|
11825
14795
|
render() {
|
|
11826
|
-
return (hAsync(Host, { key: '
|
|
14796
|
+
return (hAsync(Host, { key: 'f1fdc1167c4e59c2524e1e545c3382ca32853788' }, hAsync("input", { key: 'c1b711444475ed401766cc5827eeaec0c46b62cf', type: "radio", id: this.radioId, value: this.value, checked: this.checked, disabled: this.disabled, autoFocus: this.autofocus, "aria-required": this.required ? 'true' : 'false', "aria-invalid": this.error ? 'true' : undefined, "aria-describedby": this.helperId, ref: (el) => (this.nativeInput = el), onChange: this.handleChange }), hAsync("span", { key: 'b25e623269df05bdf8159e72da4df2e0bfb5d7bc', class: "circle", "aria-hidden": "true" }, this.checked && hAsync("span", { key: '93d12890c7ba0abe203c63953ea1115aee37d7a0', class: "dot" })), hAsync("span", { key: '44dcfdc4e7ee3820624b0d02a438139f45bb8733', class: "content" }, hAsync("label", { key: 'd0547cd5e79642b298da155c9937715224b52cae', htmlFor: this.radioId }, this.label), hAsync("span", { key: 'a9df5dd8a775a2f7422d5bac296869f88553e33f', onClick: this.retargetInnerClicks.bind(this), "aria-live": "polite", class: "helper-text", id: this.helperId }, this.helperText))));
|
|
11827
14797
|
}
|
|
11828
14798
|
static get formAssociated() { return true; }
|
|
11829
14799
|
static get watchers() { return {
|
|
11830
14800
|
"checked": [{
|
|
11831
14801
|
"handleCheckedChange": 0
|
|
11832
14802
|
}],
|
|
14803
|
+
"required": [{
|
|
14804
|
+
"handleRequiredChange": 0
|
|
14805
|
+
}],
|
|
11833
14806
|
"value": [{
|
|
11834
14807
|
"handleValueChange": 0
|
|
11835
14808
|
}],
|
|
@@ -11845,24 +14818,181 @@ class LmvzRadio extends ReactiveControllerHost {
|
|
|
11845
14818
|
"label": [1],
|
|
11846
14819
|
"checked": [1540],
|
|
11847
14820
|
"value": [1],
|
|
11848
|
-
"name": [
|
|
14821
|
+
"name": [513],
|
|
11849
14822
|
"disabled": [516],
|
|
11850
14823
|
"required": [516],
|
|
11851
|
-
"error": [
|
|
14824
|
+
"error": [6660],
|
|
11852
14825
|
"helperText": [1, "helper-text"],
|
|
11853
14826
|
"form": [513],
|
|
11854
14827
|
"autofocus": [4],
|
|
14828
|
+
"nativeError": [32],
|
|
11855
14829
|
"focusInput": [64],
|
|
11856
14830
|
"checkValidity": [64],
|
|
11857
|
-
"reportValidity": [64]
|
|
14831
|
+
"reportValidity": [64],
|
|
14832
|
+
"getValidationMessage": [64]
|
|
11858
14833
|
},
|
|
11859
|
-
"$listeners$": [[0, "keydown", "handleKeydown"]],
|
|
14834
|
+
"$listeners$": [[0, "invalid", "handleInvalid"], [0, "keydown", "handleKeydown"]],
|
|
11860
14835
|
"$lazyBundleId$": "-",
|
|
11861
|
-
"$attrsToReflect$": [["checked", "checked"], ["disabled", "disabled"], ["required", "required"], ["error", "error"], ["form", "form"]]
|
|
14836
|
+
"$attrsToReflect$": [["checked", "checked"], ["name", "name"], ["disabled", "disabled"], ["required", "required"], ["error", "error"], ["form", "form"]]
|
|
11862
14837
|
}; }
|
|
11863
14838
|
}
|
|
11864
14839
|
|
|
11865
|
-
const
|
|
14840
|
+
const defaultConfig = {
|
|
14841
|
+
wrap: true,
|
|
14842
|
+
typeaheadTimeoutMs: 500,
|
|
14843
|
+
};
|
|
14844
|
+
class ListboxController {
|
|
14845
|
+
options = [];
|
|
14846
|
+
_activeId;
|
|
14847
|
+
_selectedId;
|
|
14848
|
+
config;
|
|
14849
|
+
typeaheadBuffer = '';
|
|
14850
|
+
typeaheadTimer;
|
|
14851
|
+
constructor(config = {}) {
|
|
14852
|
+
this.config = { ...defaultConfig, ...config };
|
|
14853
|
+
}
|
|
14854
|
+
hostDisconnected() {
|
|
14855
|
+
this.clearTypeaheadTimer();
|
|
14856
|
+
}
|
|
14857
|
+
get activeId() {
|
|
14858
|
+
return this._activeId;
|
|
14859
|
+
}
|
|
14860
|
+
get activeDescendantId() {
|
|
14861
|
+
return this._activeId;
|
|
14862
|
+
}
|
|
14863
|
+
get selectedId() {
|
|
14864
|
+
return this._selectedId;
|
|
14865
|
+
}
|
|
14866
|
+
setOptions(options) {
|
|
14867
|
+
this.options = options;
|
|
14868
|
+
if (this._activeId && this.findEnabledIndex(this._activeId) !== -1)
|
|
14869
|
+
return;
|
|
14870
|
+
const fallback = (this._selectedId && this.findEnabledIndex(this._selectedId) !== -1 ? this._selectedId : undefined) ?? this.firstEnabledOption()?.id;
|
|
14871
|
+
this.setActiveId(fallback);
|
|
14872
|
+
}
|
|
14873
|
+
setActiveId(id) {
|
|
14874
|
+
if (id !== undefined && !this.isEnabledId(id))
|
|
14875
|
+
return;
|
|
14876
|
+
if (id === this._activeId)
|
|
14877
|
+
return;
|
|
14878
|
+
this._activeId = id;
|
|
14879
|
+
this.config.onActiveChange?.(id);
|
|
14880
|
+
}
|
|
14881
|
+
setSelectedId(id) {
|
|
14882
|
+
this._selectedId = id;
|
|
14883
|
+
}
|
|
14884
|
+
selectOption(id) {
|
|
14885
|
+
if (!this.isEnabledId(id))
|
|
14886
|
+
return;
|
|
14887
|
+
this._selectedId = id;
|
|
14888
|
+
this.config.onSelect?.(id);
|
|
14889
|
+
}
|
|
14890
|
+
selectActive() {
|
|
14891
|
+
if (this._activeId)
|
|
14892
|
+
this.selectOption(this._activeId);
|
|
14893
|
+
}
|
|
14894
|
+
handleKeydown(event) {
|
|
14895
|
+
switch (event.key) {
|
|
14896
|
+
case 'ArrowDown':
|
|
14897
|
+
event.preventDefault();
|
|
14898
|
+
this.moveActive('next');
|
|
14899
|
+
return true;
|
|
14900
|
+
case 'ArrowUp':
|
|
14901
|
+
event.preventDefault();
|
|
14902
|
+
this.moveActive('previous');
|
|
14903
|
+
return true;
|
|
14904
|
+
case 'Home':
|
|
14905
|
+
event.preventDefault();
|
|
14906
|
+
this.setActiveId(this.firstEnabledOption()?.id);
|
|
14907
|
+
return true;
|
|
14908
|
+
case 'End':
|
|
14909
|
+
event.preventDefault();
|
|
14910
|
+
this.setActiveId(this.lastEnabledOption()?.id);
|
|
14911
|
+
return true;
|
|
14912
|
+
case 'Enter':
|
|
14913
|
+
case ' ':
|
|
14914
|
+
event.preventDefault();
|
|
14915
|
+
this.selectActive();
|
|
14916
|
+
return true;
|
|
14917
|
+
case 'Escape':
|
|
14918
|
+
event.preventDefault();
|
|
14919
|
+
this.config.onClose?.();
|
|
14920
|
+
return true;
|
|
14921
|
+
default:
|
|
14922
|
+
return this.handleTypeahead(event);
|
|
14923
|
+
}
|
|
14924
|
+
}
|
|
14925
|
+
clearTypeahead() {
|
|
14926
|
+
this.typeaheadBuffer = '';
|
|
14927
|
+
this.clearTypeaheadTimer();
|
|
14928
|
+
}
|
|
14929
|
+
moveActive(direction) {
|
|
14930
|
+
const enabledOptions = this.enabledOptions();
|
|
14931
|
+
if (!enabledOptions.length)
|
|
14932
|
+
return;
|
|
14933
|
+
const currentIndex = this._activeId ? enabledOptions.findIndex((option) => option.id === this._activeId) : -1;
|
|
14934
|
+
if (currentIndex === -1) {
|
|
14935
|
+
this.setActiveId((direction === 'next' ? enabledOptions[0] : enabledOptions[enabledOptions.length - 1])?.id);
|
|
14936
|
+
return;
|
|
14937
|
+
}
|
|
14938
|
+
const step = direction === 'next' ? 1 : -1;
|
|
14939
|
+
const rawIndex = currentIndex + step;
|
|
14940
|
+
if (rawIndex < 0 || rawIndex >= enabledOptions.length) {
|
|
14941
|
+
if (!this.config.wrap)
|
|
14942
|
+
return;
|
|
14943
|
+
const wrappedIndex = (rawIndex + enabledOptions.length) % enabledOptions.length;
|
|
14944
|
+
this.setActiveId(enabledOptions[wrappedIndex]?.id);
|
|
14945
|
+
return;
|
|
14946
|
+
}
|
|
14947
|
+
this.setActiveId(enabledOptions[rawIndex]?.id);
|
|
14948
|
+
}
|
|
14949
|
+
handleTypeahead(event) {
|
|
14950
|
+
if (event.key.length !== 1 || event.ctrlKey || event.metaKey || event.altKey)
|
|
14951
|
+
return false;
|
|
14952
|
+
event.preventDefault();
|
|
14953
|
+
this.typeaheadBuffer += event.key.toLowerCase();
|
|
14954
|
+
this.restartTypeaheadTimer();
|
|
14955
|
+
const enabledOptions = this.enabledOptions();
|
|
14956
|
+
if (!enabledOptions.length)
|
|
14957
|
+
return true;
|
|
14958
|
+
const currentIndex = this._activeId ? enabledOptions.findIndex((option) => option.id === this._activeId) : -1;
|
|
14959
|
+
const orderedFromCurrent = [...enabledOptions.slice(currentIndex + 1), ...enabledOptions.slice(0, currentIndex + 1)];
|
|
14960
|
+
const match = orderedFromCurrent.find((option) => option.label.toLowerCase().startsWith(this.typeaheadBuffer));
|
|
14961
|
+
if (match)
|
|
14962
|
+
this.setActiveId(match.id);
|
|
14963
|
+
return true;
|
|
14964
|
+
}
|
|
14965
|
+
restartTypeaheadTimer() {
|
|
14966
|
+
this.clearTypeaheadTimer();
|
|
14967
|
+
this.typeaheadTimer = setTimeout(() => {
|
|
14968
|
+
this.typeaheadBuffer = '';
|
|
14969
|
+
}, this.config.typeaheadTimeoutMs);
|
|
14970
|
+
}
|
|
14971
|
+
clearTypeaheadTimer() {
|
|
14972
|
+
if (this.typeaheadTimer !== undefined) {
|
|
14973
|
+
clearTimeout(this.typeaheadTimer);
|
|
14974
|
+
this.typeaheadTimer = undefined;
|
|
14975
|
+
}
|
|
14976
|
+
}
|
|
14977
|
+
enabledOptions() {
|
|
14978
|
+
return this.options.filter((option) => !option.disabled);
|
|
14979
|
+
}
|
|
14980
|
+
firstEnabledOption() {
|
|
14981
|
+
return this.enabledOptions()[0];
|
|
14982
|
+
}
|
|
14983
|
+
lastEnabledOption() {
|
|
14984
|
+
const enabledOptions = this.enabledOptions();
|
|
14985
|
+
return enabledOptions[enabledOptions.length - 1];
|
|
14986
|
+
}
|
|
14987
|
+
isEnabledId(id) {
|
|
14988
|
+
return this.findEnabledIndex(id) !== -1;
|
|
14989
|
+
}
|
|
14990
|
+
findEnabledIndex(id) {
|
|
14991
|
+
return this.enabledOptions().findIndex((option) => option.id === id);
|
|
14992
|
+
}
|
|
14993
|
+
}
|
|
14994
|
+
|
|
14995
|
+
const lmvzSelectCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('RouterBook-Regular'), local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'); font-weight: 400; } @font-face { font-family: Router; src: local('RouterMedium-Regular'), local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'); font-weight: 500; } @font-face { font-family: Router; src: local('RouterBold-Regular'), local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'); font-weight: 700; } } .sc-lmvz-select-h { display: block; font-family: var(--lmvz-global-font-family-default, Router); --lmvz-internal-select-floating-label-top-offset: 0.375rem; --lmvz-select-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-select-bg: var(--lmvz-semantic-color-surface-input-primary, #ffffff); --lmvz-select-border-color: var(--lmvz-semantic-color-border-alternate, #c7c7c7); --lmvz-select-border-color-hover: var(--lmvz-semantic-color-border-hover, #a1a1a1); --lmvz-select-border-width: var(--lmvz-semantic-border-width-default, 1px); --lmvz-select-text-color: var(--lmvz-semantic-color-on-surface-input-primary, #000000); --lmvz-select-label-color: var(--lmvz-semantic-color-on-surface-input-primary, #000000); --lmvz-select-padding-x: var(--lmvz-component-input-padding-md, clamp(0.88rem, 0.84rem + 0.13vw, 1rem)); --lmvz-select-gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-select-height: var(--lmvz-component-input-size-md, clamp(2.5rem, 2.44rem + 0.26vw, 2.75rem)); --lmvz-select-label-font-size: var(--lmvz-component-body-xs-font-size, clamp(0.63rem, 0.59rem + 0.13vw, 0.75rem)); --lmvz-select-label-top-offset: calc(var(--lmvz-internal-select-floating-label-top-offset) * -1); --lmvz-select-label-minimized-padding-x: 4px; --lmvz-select-disabled-opacity: var(--lmvz-component-input-disabled-opacity, 40%); --lmvz-select-helper-color: var(--lmvz-semantic-color-on-surface-input-secondary, #545454); --lmvz-select-focus-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --lmvz-select-error-color: var(--lmvz-semantic-color-status-on-danger, #a31419); padding-top: var(--lmvz-internal-select-floating-label-top-offset); } .select-wrapper.sc-lmvz-select { position: relative; height: var(--lmvz-select-height); } label.sc-lmvz-select { position: absolute; top: 50%; left: var(--lmvz-select-padding-x); font-size: var(--lmvz-select-label-font-size); color: var(--lmvz-select-label-color); line-height: normal; white-space: nowrap; pointer-events: none; z-index: 2; transform: translateY(-50%); transform-origin: left top; transition: top 0.2s ease-out, transform 0.2s ease-out, opacity 0.2s ease-out, padding 0.2s ease-out; } label.assistive-label.sc-lmvz-select { opacity: 0; padding: 0; } label.floating-label.sc-lmvz-select { top: var(--lmvz-select-label-top-offset); transform: translateY(0) scale(0.85); left: calc(var(--lmvz-select-padding-x) - 2px); background-color: var(--lmvz-select-bg); padding: 0 var(--lmvz-select-label-minimized-padding-x); opacity: 1; font-weight: 500; } label.sc-lmvz-select > span[aria-hidden='true'].sc-lmvz-select, .select-trigger.sc-lmvz-select > span.sc-lmvz-select:first-child > span[aria-hidden='true'].sc-lmvz-select { color: var(--lmvz-select-error-color); margin-left: 2px; display: inline-block; line-height: 0; vertical-align: middle; } .select-trigger.sc-lmvz-select { display: flex; align-items: center; gap: var(--lmvz-select-gap); height: 100%; width: 100%; padding: 0 var(--lmvz-select-padding-x); border-radius: var(--lmvz-select-radius); background-color: var(--lmvz-select-bg); border: var(--lmvz-select-border-width) solid var(--lmvz-select-border-color); box-sizing: border-box; cursor: pointer; position: relative; z-index: 1; transition: border-color 0.15s ease; } .sc-lmvz-select-h:not([disabled] .select-wrapper.sc-lmvz-select:hover .select-trigger.sc-lmvz-select, [highlighted].sc-lmvz-select-h .select-wrapper.sc-lmvz-select:hover .select-trigger.sc-lmvz-select, [error]).sc-lmvz-select-h .select-wrapper.sc-lmvz-select:hover .select-trigger.sc-lmvz-select { border-color: var(--lmvz-select-border-color-hover); } [error].sc-lmvz-select-h .select-trigger.sc-lmvz-select { border-color: var(--lmvz-select-error-color); } [highlighted].sc-lmvz-select-h .select-trigger.sc-lmvz-select { background-color: var(--lmvz-semantic-color-status-active-alternate, #0f8acc); border-color: var(--lmvz-semantic-color-border-active, #0f8acc); color: var(--lmvz-semantic-color-status-on-active-alternate, #ffffff); } [highlighted].sc-lmvz-select-h .select-trigger.sc-lmvz-select > span.sc-lmvz-select:first-child { color: var(--lmvz-semantic-color-status-on-active-alternate, #ffffff); } [highlighted].sc-lmvz-select-h label.floating-label.sc-lmvz-select { background-color: var(--lmvz-semantic-color-status-active-alternate, #0f8acc); color: var(--lmvz-semantic-color-status-on-active-alternate, #ffffff); } .sc-lmvz-select-h:has(:focus-visible) .select-trigger.sc-lmvz-select { outline: var(--lmvz-ds-outline, 1px solid #0e7ab4); outline-offset: var(--lmvz-ds-outline-offset, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)); } .select-trigger.sc-lmvz-select > span.sc-lmvz-select:first-child { flex: 1 0 0; font: var(--lmvz-typography-body-md-strong, 500 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.5 Router); color: var(--lmvz-select-text-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; } .sc-lmvz-select-h:not([highlighted]) .select-wrapper.has-value.sc-lmvz-select .select-trigger.sc-lmvz-select > span.sc-lmvz-select:first-child { color: var(--lmvz-semantic-color-int-on-secondary-active, #000000); } .select-trigger.sc-lmvz-select > span.sc-lmvz-select:last-child { flex-shrink: 0; display: flex; align-items: center; justify-content: center; } .select-trigger.sc-lmvz-select svg.sc-lmvz-select { width: var(--lmvz-component-icon-size-2xs, clamp(0.63rem, 0.59rem + 0.13vw, 0.75rem)); height: var(--lmvz-component-icon-size-2xs, clamp(0.63rem, 0.59rem + 0.13vw, 0.75rem)); flex-shrink: 0; } .lmvz-select-native-options.sc-lmvz-select { display: none; } [disabled].sc-lmvz-select-h .select-wrapper.sc-lmvz-select { opacity: var(--lmvz-select-disabled-opacity); pointer-events: none; cursor: not-allowed; } [role='status'].sc-lmvz-select { padding-top: var(--lmvz-dimension-8-6, clamp(0.38rem, 0.34rem + 0.13vw, 0.5rem)); padding-left: var(--lmvz-select-padding-x); font-size: var(--lmvz-select-label-font-size); color: var(--lmvz-select-helper-color); line-height: normal; } [role='alert'].sc-lmvz-select { padding-top: var(--lmvz-dimension-8-6, clamp(0.38rem, 0.34rem + 0.13vw, 0.5rem)); padding-left: var(--lmvz-select-padding-x); font-size: var(--lmvz-component-body-sm-font-size, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); color: var(--lmvz-select-error-color); line-height: normal; } [size='small'].sc-lmvz-select-h { --lmvz-select-height: var(--lmvz-component-input-size-sm, clamp(2rem, 1.94rem + 0.26vw, 2.25rem)); --lmvz-select-padding-x: var(--lmvz-component-input-padding-sm, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); --lmvz-select-gap: var(--lmvz-component-input-gap-sm, clamp(0.38rem, 0.31rem + 0.26vw, 0.63rem)); --lmvz-select-label-font-size: var(--lmvz-component-body-2xs-font-size, clamp(0.5rem, 0.47rem + 0.13vw, 0.63rem)); } [size='small'].sc-lmvz-select-h .select-trigger.sc-lmvz-select > span.sc-lmvz-select:first-child { font-size: var(--lmvz-component-body-sm-font-size, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); } [size='small'].sc-lmvz-select-h .select-trigger.sc-lmvz-select svg.sc-lmvz-select { width: var(--lmvz-component-icon-size-4xs, clamp(0.5rem, 0.47rem + 0.13vw, 0.63rem)); height: var(--lmvz-component-icon-size-4xs, clamp(0.5rem, 0.47rem + 0.13vw, 0.63rem)); } [size='large'].sc-lmvz-select-h { --lmvz-select-height: var(--lmvz-component-input-size-lg, clamp(2.75rem, 2.69rem + 0.26vw, 3rem)); --lmvz-select-padding-x: var(--lmvz-component-input-padding-lg, clamp(1rem, 0.94rem + 0.26vw, 1.25rem)); --lmvz-select-gap: var(--lmvz-component-input-gap-lg, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); --lmvz-select-label-font-size: var(--lmvz-component-body-sm-font-size, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); } [size='large'].sc-lmvz-select-h .select-trigger.sc-lmvz-select > span.sc-lmvz-select:first-child { font-size: var(--lmvz-component-body-lg-font-size, clamp(1rem, 0.97rem + 0.13vw, 1.13rem)); } [size='large'].sc-lmvz-select-h .select-trigger.sc-lmvz-select svg.sc-lmvz-select { width: var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); height: var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); } .lmvz-select-option.sc-lmvz-select { --lmvz-select-option-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); --lmvz-select-option-color: var(--lmvz-semantic-color-int-on-tertiary, #000000); display: flex; align-items: center; gap: var(--lmvz-select-gap); padding: var(--lmvz-component-input-padding-sm, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); border-radius: var(--lmvz-semantic-border-radius-md, 6px); background-color: var(--lmvz-select-option-background); color: var(--lmvz-select-option-color); cursor: pointer; font: var(--lmvz-typography-body-md-strong, 500 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.5 Router); transition: background-color 0.15s ease, color 0.15s ease; } .lmvz-select-option.sc-lmvz-select:not([aria-disabled='true']):hover { --lmvz-select-option-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); --lmvz-select-option-color: var(--lmvz-semantic-color-int-on-tertiary-hover, #000000); } .lmvz-select-option.sc-lmvz-select:not([aria-disabled='true']):active { --lmvz-select-option-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); --lmvz-select-option-color: var(--lmvz-semantic-color-int-on-tertiary-active, #000000); } .lmvz-select-option.sc-lmvz-select:focus-visible { outline: var(--lmvz-ds-outline, 1px solid #0e7ab4); outline-offset: var(--lmvz-ds-outline-offset, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)); position: relative; z-index: 1; } .lmvz-select-option[data-active='true'].sc-lmvz-select:not([aria-disabled='true']) { --lmvz-select-option-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); --lmvz-select-option-color: var(--lmvz-semantic-color-int-on-tertiary-hover, #000000); } .lmvz-select-option[aria-selected='true'].sc-lmvz-select { --lmvz-select-option-background: var(--lmvz-semantic-color-status-active-alternate, #0f8acc); --lmvz-select-option-color: var(--lmvz-semantic-color-status-on-active-alternate, #ffffff); } .lmvz-select-option[aria-disabled='true'].sc-lmvz-select { cursor: not-allowed; pointer-events: none; opacity: var(--lmvz-component-input-disabled-opacity, 40%); }`;
|
|
11866
14996
|
|
|
11867
14997
|
let selectIdCounter = 0;
|
|
11868
14998
|
class LmvzSelect extends ReactiveControllerHost {
|
|
@@ -11870,79 +15000,343 @@ class LmvzSelect extends ReactiveControllerHost {
|
|
|
11870
15000
|
get validationEl() {
|
|
11871
15001
|
return this.el;
|
|
11872
15002
|
}
|
|
15003
|
+
internals;
|
|
11873
15004
|
selectId = `lmvz-select-${selectIdCounter++}`;
|
|
11874
|
-
|
|
15005
|
+
triggerId = `${this.selectId}-trigger`;
|
|
15006
|
+
popoverId = `${this.selectId}-listbox`;
|
|
15007
|
+
triggerEl;
|
|
15008
|
+
optionsSourceEl;
|
|
15009
|
+
optionsMutationObserver;
|
|
15010
|
+
initialValue;
|
|
15011
|
+
initialValueCaptured = false;
|
|
15012
|
+
flatOptions = [];
|
|
15013
|
+
optionsById = new Map();
|
|
15014
|
+
listboxController = new ListboxController({
|
|
15015
|
+
onActiveChange: (id) => {
|
|
15016
|
+
this.activeId = id;
|
|
15017
|
+
},
|
|
15018
|
+
onSelect: (id) => this.handleOptionSelect(id),
|
|
15019
|
+
onClose: () => this.closePopover(),
|
|
15020
|
+
});
|
|
15021
|
+
get helperId() {
|
|
15022
|
+
return this.helperText ? `${this.selectId}-helper` : undefined;
|
|
15023
|
+
}
|
|
15024
|
+
get showErrorMessage() {
|
|
15025
|
+
return this.error && Boolean(this.errorMessage);
|
|
15026
|
+
}
|
|
15027
|
+
get errorId() {
|
|
15028
|
+
return `${this.selectId}-error`;
|
|
15029
|
+
}
|
|
15030
|
+
get describedBy() {
|
|
15031
|
+
const ids = [];
|
|
15032
|
+
if (this.helperId)
|
|
15033
|
+
ids.push(this.helperId);
|
|
15034
|
+
if (this.showErrorMessage)
|
|
15035
|
+
ids.push(this.errorId);
|
|
15036
|
+
return ids.length > 0 ? ids.join(' ') : undefined;
|
|
15037
|
+
}
|
|
11875
15038
|
constructor(hostRef) {
|
|
11876
15039
|
super();
|
|
11877
15040
|
registerInstance(this, hostRef);
|
|
11878
15041
|
this.lmvzChange = createEvent(this, "lmvzChange", 7);
|
|
15042
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
15043
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
15044
|
+
}
|
|
15045
|
+
else {
|
|
15046
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
15047
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
15048
|
+
}
|
|
11879
15049
|
this.addController(new AriaValidationController(this));
|
|
15050
|
+
this.addController(this.listboxController);
|
|
11880
15051
|
}
|
|
11881
15052
|
lmvzChange;
|
|
11882
15053
|
value;
|
|
11883
15054
|
label;
|
|
11884
15055
|
helperText;
|
|
15056
|
+
nativeError = false;
|
|
15057
|
+
errorFromProp = false;
|
|
15058
|
+
get error() {
|
|
15059
|
+
return this.errorFromProp || this.nativeError;
|
|
15060
|
+
}
|
|
15061
|
+
set error(value) {
|
|
15062
|
+
this.errorFromProp = value;
|
|
15063
|
+
}
|
|
15064
|
+
errorMessage;
|
|
11885
15065
|
disabled = false;
|
|
11886
15066
|
required = false;
|
|
11887
15067
|
name;
|
|
11888
15068
|
size = 'default';
|
|
11889
15069
|
highlighted = false;
|
|
11890
15070
|
selectedLabel = '';
|
|
15071
|
+
selectedId;
|
|
15072
|
+
activeId;
|
|
15073
|
+
isOpen = false;
|
|
15074
|
+
optionGroups = [];
|
|
11891
15075
|
get hasValue() {
|
|
11892
15076
|
return Boolean(this.value);
|
|
11893
15077
|
}
|
|
15078
|
+
componentWillLoad() {
|
|
15079
|
+
this.updateValidity();
|
|
15080
|
+
super.componentWillLoad();
|
|
15081
|
+
}
|
|
11894
15082
|
componentDidLoad() {
|
|
11895
|
-
this.
|
|
15083
|
+
this.handleSlotChange();
|
|
15084
|
+
this.observeSlottedOptionMutations();
|
|
15085
|
+
this.updateValidity();
|
|
11896
15086
|
super.componentDidLoad();
|
|
11897
15087
|
}
|
|
15088
|
+
disconnectedCallback() {
|
|
15089
|
+
this.optionsMutationObserver?.disconnect();
|
|
15090
|
+
super.disconnectedCallback();
|
|
15091
|
+
}
|
|
15092
|
+
observeSlottedOptionMutations() {
|
|
15093
|
+
if (typeof MutationObserver === 'undefined')
|
|
15094
|
+
return;
|
|
15095
|
+
this.optionsMutationObserver?.disconnect();
|
|
15096
|
+
this.optionsMutationObserver = new MutationObserver(this.handleSlotChange);
|
|
15097
|
+
this.optionsMutationObserver.observe(this.el, {
|
|
15098
|
+
attributes: true,
|
|
15099
|
+
attributeFilter: ['disabled', 'selected', 'value', 'label'],
|
|
15100
|
+
characterData: true,
|
|
15101
|
+
childList: true,
|
|
15102
|
+
subtree: true,
|
|
15103
|
+
});
|
|
15104
|
+
}
|
|
15105
|
+
async focusTrigger() {
|
|
15106
|
+
this.triggerEl?.focus();
|
|
15107
|
+
}
|
|
15108
|
+
async blurTrigger() {
|
|
15109
|
+
this.triggerEl?.blur();
|
|
15110
|
+
}
|
|
15111
|
+
async checkValidity() {
|
|
15112
|
+
return this.internals.checkValidity?.() ?? true;
|
|
15113
|
+
}
|
|
15114
|
+
async reportValidity() {
|
|
15115
|
+
return this.internals.reportValidity?.() ?? true;
|
|
15116
|
+
}
|
|
15117
|
+
async getValidationMessage() {
|
|
15118
|
+
return this.internals.validationMessage ?? '';
|
|
15119
|
+
}
|
|
15120
|
+
formAssociatedCallback(form) {
|
|
15121
|
+
if (!form)
|
|
15122
|
+
return;
|
|
15123
|
+
this.internals.setFormValue?.(this.value ?? '');
|
|
15124
|
+
}
|
|
15125
|
+
formResetCallback() {
|
|
15126
|
+
this.internals.setValidity?.({});
|
|
15127
|
+
this.value = this.initialValue;
|
|
15128
|
+
this.updateValidity();
|
|
15129
|
+
}
|
|
15130
|
+
formStateRestoreCallback(state) {
|
|
15131
|
+
this.value = state;
|
|
15132
|
+
}
|
|
11898
15133
|
handleValueChange(newValue) {
|
|
11899
|
-
|
|
11900
|
-
|
|
15134
|
+
this.applySelectionFromValue();
|
|
15135
|
+
if (this.selectedId && !this.isOpen) {
|
|
15136
|
+
this.listboxController.setActiveId(this.selectedId);
|
|
11901
15137
|
}
|
|
11902
|
-
this.
|
|
15138
|
+
this.internals.setFormValue?.(newValue ?? '');
|
|
15139
|
+
this.updateValidity();
|
|
11903
15140
|
}
|
|
11904
|
-
|
|
11905
|
-
|
|
15141
|
+
handleRequiredChange() {
|
|
15142
|
+
this.updateValidity();
|
|
15143
|
+
}
|
|
15144
|
+
handleDisabledChange(disabled) {
|
|
15145
|
+
if (!disabled)
|
|
11906
15146
|
return;
|
|
11907
|
-
|
|
11908
|
-
this.
|
|
15147
|
+
this.closePopover();
|
|
15148
|
+
this.triggerEl?.blur();
|
|
11909
15149
|
}
|
|
11910
|
-
|
|
11911
|
-
const
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
this.
|
|
15150
|
+
handleSlotChange = () => {
|
|
15151
|
+
const container = this.optionsSourceEl;
|
|
15152
|
+
if (!container)
|
|
15153
|
+
return;
|
|
15154
|
+
const { flat, groups } = parseOptionElements(container, this.selectId);
|
|
15155
|
+
this.flatOptions = flat;
|
|
15156
|
+
this.optionsById = new Map(flat.map((option) => [option.id, option]));
|
|
15157
|
+
this.optionGroups = groups;
|
|
15158
|
+
if (!this.value) {
|
|
15159
|
+
const preselected = flat.find((option) => option.selected && !option.disabled);
|
|
15160
|
+
if (preselected) {
|
|
15161
|
+
this.value = preselected.value;
|
|
15162
|
+
}
|
|
15163
|
+
}
|
|
15164
|
+
this.applySelectionFromValue();
|
|
15165
|
+
this.listboxController.setOptions(flat.map(({ id, label, disabled }) => ({ id, label, disabled })));
|
|
15166
|
+
if (!this.initialValueCaptured) {
|
|
15167
|
+
this.initialValue = this.value;
|
|
15168
|
+
this.initialValueCaptured = true;
|
|
15169
|
+
}
|
|
15170
|
+
};
|
|
15171
|
+
applySelectionFromValue() {
|
|
15172
|
+
const match = this.value ? this.flatOptions.find((option) => option.value === this.value) : undefined;
|
|
15173
|
+
this.selectedId = match?.id;
|
|
15174
|
+
this.selectedLabel = match?.label ?? '';
|
|
15175
|
+
this.listboxController.setSelectedId(match?.id);
|
|
15176
|
+
}
|
|
15177
|
+
updateValidity() {
|
|
15178
|
+
if (this.required && !this.value) {
|
|
15179
|
+
this.internals.setValidity?.({ valueMissing: true }, 'Please select a value.', this.triggerEl);
|
|
15180
|
+
return;
|
|
15181
|
+
}
|
|
15182
|
+
this.internals.setValidity?.({});
|
|
15183
|
+
this.nativeError = false;
|
|
15184
|
+
}
|
|
15185
|
+
handleInvalid() {
|
|
15186
|
+
this.nativeError = true;
|
|
15187
|
+
}
|
|
15188
|
+
handleOptionSelect(id) {
|
|
15189
|
+
const option = this.optionsById.get(id);
|
|
15190
|
+
if (!option)
|
|
15191
|
+
return;
|
|
15192
|
+
const isNewValue = option.value !== this.value;
|
|
15193
|
+
this.value = option.value;
|
|
15194
|
+
if (isNewValue) {
|
|
15195
|
+
this.lmvzChange.emit(option.value);
|
|
15196
|
+
}
|
|
15197
|
+
this.closePopover();
|
|
15198
|
+
}
|
|
15199
|
+
handleOptionClick = (option) => {
|
|
15200
|
+
if (option.disabled || this.disabled)
|
|
15201
|
+
return;
|
|
15202
|
+
this.listboxController.selectOption(option.id);
|
|
15203
|
+
};
|
|
15204
|
+
handleLabelClick = () => {
|
|
15205
|
+
if (this.disabled)
|
|
15206
|
+
return;
|
|
15207
|
+
this.triggerEl?.focus();
|
|
15208
|
+
this.openPopover();
|
|
15209
|
+
};
|
|
15210
|
+
handleTriggerClick = () => {
|
|
15211
|
+
if (this.disabled)
|
|
15212
|
+
return;
|
|
15213
|
+
if (this.isOpen) {
|
|
15214
|
+
this.closePopover();
|
|
15215
|
+
}
|
|
15216
|
+
else {
|
|
15217
|
+
this.openPopover();
|
|
15218
|
+
}
|
|
15219
|
+
};
|
|
15220
|
+
handleTriggerKeydown = (event) => {
|
|
15221
|
+
if (this.disabled)
|
|
15222
|
+
return;
|
|
15223
|
+
if (!this.isOpen) {
|
|
15224
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === 'Enter' || event.key === ' ') {
|
|
15225
|
+
event.preventDefault();
|
|
15226
|
+
this.openPopover();
|
|
15227
|
+
}
|
|
15228
|
+
return;
|
|
15229
|
+
}
|
|
15230
|
+
this.listboxController.handleKeydown(event);
|
|
15231
|
+
};
|
|
15232
|
+
handleTriggerBlur = () => {
|
|
15233
|
+
this.closePopover();
|
|
11915
15234
|
};
|
|
15235
|
+
handlePopoverClose = () => {
|
|
15236
|
+
this.isOpen = false;
|
|
15237
|
+
this.listboxController.clearTypeahead();
|
|
15238
|
+
};
|
|
15239
|
+
openPopover() {
|
|
15240
|
+
if (this.isOpen || this.disabled)
|
|
15241
|
+
return;
|
|
15242
|
+
this.isOpen = true;
|
|
15243
|
+
}
|
|
15244
|
+
closePopover() {
|
|
15245
|
+
if (!this.isOpen)
|
|
15246
|
+
return;
|
|
15247
|
+
this.isOpen = false;
|
|
15248
|
+
this.listboxController.clearTypeahead();
|
|
15249
|
+
}
|
|
15250
|
+
renderOptionGroups() {
|
|
15251
|
+
return this.optionGroups.map((group, groupIndex) => group.label ? (hAsync("div", { role: "group", "aria-label": group.label, key: `lmvz-select-group-${groupIndex}` }, group.options.map((option) => this.renderOption(option)))) : (group.options.map((option) => this.renderOption(option))));
|
|
15252
|
+
}
|
|
15253
|
+
renderOption(option) {
|
|
15254
|
+
return (hAsync("div", { id: option.id, key: option.id, role: "option", class: "lmvz-select-option", "aria-selected": option.id === this.selectedId ? 'true' : 'false', "aria-disabled": option.disabled ? 'true' : undefined, "data-active": option.id === this.activeId ? 'true' : undefined, onMouseDown: (event) => event.preventDefault(), onClick: () => this.handleOptionClick(option) }, option.label));
|
|
15255
|
+
}
|
|
11916
15256
|
render() {
|
|
11917
15257
|
const hasValue = this.hasValue;
|
|
11918
15258
|
const shouldShowLabel = hasValue;
|
|
11919
|
-
return (hAsync(Host, { key: '
|
|
15259
|
+
return (hAsync(Host, { key: '0bcc303a802db20a6be6558b8add53d0fa398493', "data-highlighted": String(this.highlighted) }, hAsync("div", { key: 'e248f8277b4786b34dfd064cb9c7b70302cf018a', class: hasValue ? 'select-wrapper has-value' : 'select-wrapper' }, hAsync("label", { key: '1c97c830d5782cadad98fb895d70c438031d3457', htmlFor: this.triggerId, class: shouldShowLabel ? 'floating-label' : 'assistive-label', onMouseDown: (event) => event.preventDefault(), onClick: this.handleLabelClick }, this.label, this.required && shouldShowLabel && hAsync("span", { key: '16157962846bffc111f5c672852f7b23e9ed2b73', "aria-hidden": "true" }, " *")), hAsync("div", { key: 'bc5e3e6b335723cfd9872ff955a1e8d664d4eeb8', id: this.triggerId, ref: (el) => (this.triggerEl = el), class: "select-trigger", role: "combobox", tabIndex: this.disabled ? -1 : 0, "aria-haspopup": "listbox", "aria-expanded": String(this.isOpen), "aria-controls": this.popoverId, "aria-activedescendant": this.isOpen ? this.activeId : undefined, "aria-label": hasValue ? `${this.label}, ${this.selectedLabel}` : this.label, "aria-disabled": this.disabled ? 'true' : undefined, "aria-required": this.required ? 'true' : 'false', "aria-invalid": this.error ? 'true' : 'false', "aria-errormessage": this.showErrorMessage ? this.errorId : undefined, "aria-describedby": this.describedBy, onClick: this.handleTriggerClick, onKeyDown: this.handleTriggerKeydown, onBlur: this.handleTriggerBlur }, hAsync("span", { key: '620c6108f679c8e5563c0e21d7b89d71434c01a2' }, hasValue ? this.selectedLabel : this.label, this.required && !hasValue && hAsync("span", { key: 'a2183941c7843bae3e9989f8e8b26be28fbbf6d7', "aria-hidden": "true" }, " *")), hAsync("span", { key: 'b57e14bda44dc0de5a35623a5cb203b7f570c802', "aria-hidden": "true" }, hAsync("svg", { key: '71ac319e398f07f7e65fe1f73f6d2a7c08b631a8', width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, hAsync("path", { key: '80b4a978471251ee8d2cce2d74a48fad750db125', d: "M20.3334 8.66663L12.0001 17L3.66675 8.66663", stroke: "currentColor", "stroke-width": "1.75", "stroke-linecap": "round", "stroke-linejoin": "round" })))), hAsync("lmvz-popover", { key: '15528c9a3f1404c385f4eb865cf78ef5891dcb32', id: this.popoverId, anchor: this.triggerId, open: this.isOpen, containerRole: "listbox", autoFocus: false, label: this.label, onLmvzClose: this.handlePopoverClose, size: "sm" }, this.renderOptionGroups()), hAsync("div", { key: 'f1b833973497e6dfd2013522e067382c73baa7a1', class: "lmvz-select-native-options", hidden: true, "aria-hidden": "true", ref: (el) => (this.optionsSourceEl = el) }, hAsync("slot", { key: '670bf62c50cbdd965342279b99e303614771ffa1', onSlotchange: this.handleSlotChange }))), this.helperText && (hAsync("div", { key: '849e35da09bff25896b08f275c265baa0ee12960', id: this.helperId, role: "status" }, this.helperText)), this.showErrorMessage && (hAsync("div", { key: 'd01c2dca8767aa815d08d895f308c42150cc3263', id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
11920
15260
|
}
|
|
15261
|
+
static get formAssociated() { return true; }
|
|
11921
15262
|
static get watchers() { return {
|
|
11922
15263
|
"value": [{
|
|
11923
15264
|
"handleValueChange": 0
|
|
15265
|
+
}],
|
|
15266
|
+
"required": [{
|
|
15267
|
+
"handleRequiredChange": 0
|
|
15268
|
+
}],
|
|
15269
|
+
"disabled": [{
|
|
15270
|
+
"handleDisabledChange": 0
|
|
11924
15271
|
}]
|
|
11925
15272
|
}; }
|
|
11926
15273
|
static get style() { return lmvzSelectCss(); }
|
|
11927
15274
|
static get cmpMeta() { return {
|
|
11928
|
-
"$flags$":
|
|
15275
|
+
"$flags$": 838,
|
|
11929
15276
|
"$tagName$": "lmvz-select",
|
|
11930
15277
|
"$members$": {
|
|
11931
15278
|
"value": [1025],
|
|
11932
15279
|
"label": [1],
|
|
11933
15280
|
"helperText": [1, "helper-text"],
|
|
15281
|
+
"error": [6660],
|
|
15282
|
+
"errorMessage": [1, "error-message"],
|
|
11934
15283
|
"disabled": [516],
|
|
11935
15284
|
"required": [516],
|
|
11936
|
-
"name": [
|
|
15285
|
+
"name": [513],
|
|
11937
15286
|
"size": [513],
|
|
11938
15287
|
"highlighted": [516],
|
|
11939
|
-
"
|
|
15288
|
+
"nativeError": [32],
|
|
15289
|
+
"selectedLabel": [32],
|
|
15290
|
+
"selectedId": [32],
|
|
15291
|
+
"activeId": [32],
|
|
15292
|
+
"isOpen": [32],
|
|
15293
|
+
"optionGroups": [32],
|
|
15294
|
+
"focusTrigger": [64],
|
|
15295
|
+
"blurTrigger": [64],
|
|
15296
|
+
"checkValidity": [64],
|
|
15297
|
+
"reportValidity": [64],
|
|
15298
|
+
"getValidationMessage": [64]
|
|
11940
15299
|
},
|
|
11941
|
-
"$listeners$":
|
|
15300
|
+
"$listeners$": [[0, "invalid", "handleInvalid"]],
|
|
11942
15301
|
"$lazyBundleId$": "-",
|
|
11943
|
-
"$attrsToReflect$": [["disabled", "disabled"], ["required", "required"], ["size", "size"], ["highlighted", "highlighted"]]
|
|
15302
|
+
"$attrsToReflect$": [["error", "error"], ["disabled", "disabled"], ["required", "required"], ["name", "name"], ["size", "size"], ["highlighted", "highlighted"]]
|
|
11944
15303
|
}; }
|
|
11945
15304
|
}
|
|
15305
|
+
function parseOptionElements(container, idPrefix) {
|
|
15306
|
+
const flat = [];
|
|
15307
|
+
const groups = [];
|
|
15308
|
+
let looseGroup;
|
|
15309
|
+
let optionIndex = 0;
|
|
15310
|
+
const toOptionData = (optionEl, disabledOverride = false) => {
|
|
15311
|
+
const option = optionEl;
|
|
15312
|
+
const data = {
|
|
15313
|
+
id: `${idPrefix}-option-${optionIndex++}`,
|
|
15314
|
+
value: option.value,
|
|
15315
|
+
label: (option.textContent ?? '').trim(),
|
|
15316
|
+
disabled: disabledOverride || option.disabled,
|
|
15317
|
+
selected: option.selected,
|
|
15318
|
+
};
|
|
15319
|
+
flat.push(data);
|
|
15320
|
+
return data;
|
|
15321
|
+
};
|
|
15322
|
+
Array.from(container.children).forEach((child) => {
|
|
15323
|
+
if (child.tagName === 'OPTGROUP') {
|
|
15324
|
+
looseGroup = undefined;
|
|
15325
|
+
const optgroup = child;
|
|
15326
|
+
const options = Array.from(optgroup.querySelectorAll('option')).map((option) => toOptionData(option, optgroup.disabled));
|
|
15327
|
+
groups.push({ label: optgroup.label || undefined, options });
|
|
15328
|
+
return;
|
|
15329
|
+
}
|
|
15330
|
+
if (child.tagName === 'OPTION') {
|
|
15331
|
+
if (!looseGroup) {
|
|
15332
|
+
looseGroup = { label: undefined, options: [] };
|
|
15333
|
+
groups.push(looseGroup);
|
|
15334
|
+
}
|
|
15335
|
+
looseGroup.options.push(toOptionData(child));
|
|
15336
|
+
}
|
|
15337
|
+
});
|
|
15338
|
+
return { flat, groups };
|
|
15339
|
+
}
|
|
11946
15340
|
|
|
11947
15341
|
const alertSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM0Nl8zODApIj4KPHBhdGggZD0iTTEyIDUuMjVWMTMuMTI1TTIyLjUgMTJDMjIuNSAxNy43OTkgMTcuNzk5IDIyLjUgMTIgMjIuNUM2LjIwMTAxIDIyLjUgMS41IDE3Ljc5OSAxLjUgMTJDMS41IDYuMjAxMDEgNi4yMDEwMSAxLjUgMTIgMS41QzE3Ljc5OSAxLjUgMjIuNSA2LjIwMTAxIDIyLjUgMTJaTTEzLjEyNSAxNi44NzVDMTMuMTI1IDE3LjQ5NjMgMTIuNjIxMyAxOCAxMiAxOEMxMS4zNzg3IDE4IDEwLjg3NSAxNy40OTYzIDEwLjg3NSAxNi44NzVDMTAuODc1IDE2LjI1MzcgMTEuMzc4NyAxNS43NSAxMiAxNS43NUMxMi42MjEzIDE1Ljc1IDEzLjEyNSAxNi4yNTM3IDEzLjEyNSAxNi44NzVaIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjEuNzUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzM0Nl8zODAiPgo8cmVjdCB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==';
|
|
11948
15342
|
|
|
@@ -12008,7 +15402,7 @@ class LmvzSnackbar {
|
|
|
12008
15402
|
this.el.dispatchEvent(new CustomEvent('lmvzAction', { bubbles: false, composed: false }));
|
|
12009
15403
|
};
|
|
12010
15404
|
render() {
|
|
12011
|
-
return (hAsync(Host, { key: '
|
|
15405
|
+
return (hAsync(Host, { key: 'f58c7657bf5511c72930dfc54ace4af1ff7f3554', class: this.animationClass }, hAsync("lmvz-icon", { key: '8632b42b9b246bf58480fb17ca336ce5f0883845', icon: STATUS_SVG[this.status], size: "md", weight: "bold" }), hAsync("span", { key: '4ca56d2cdf29415c6d21cc50399dc28aebb8de99', class: "message" }, this.message), this.actionLabel && (hAsync("lmvz-button", { key: 'd09043056b968421143aa180f464effcd7b781fe', variant: "tertiary", scale: "small", onLmvzActivation: this.handleActionClick }, this.actionLabel))));
|
|
12012
15406
|
}
|
|
12013
15407
|
static get watchers() { return {
|
|
12014
15408
|
"status": [{
|
|
@@ -12045,7 +15439,7 @@ class LmvzSpinner {
|
|
|
12045
15439
|
ariaLabel;
|
|
12046
15440
|
render() {
|
|
12047
15441
|
const hasLabel = !!this.ariaLabel?.trim();
|
|
12048
|
-
return (hAsync(Host, { key: '
|
|
15442
|
+
return (hAsync(Host, { key: 'cf60fcf652f377a66596cc51138bb73f7465a4e7', role: hasLabel ? 'status' : undefined, "aria-label": hasLabel ? this.ariaLabel : undefined, "aria-hidden": hasLabel ? undefined : 'true' }, hAsync("svg", { key: '121ab46a591242fbc0f1c3540e8f2a7b72c9582a', part: "indicator", viewBox: "0 0 16 16", "aria-hidden": "true" }, hAsync("circle", { key: 'fe649394c9bd6e7a06113e9a50b595bb890a6fac', pathLength: "100", cx: "8", cy: "8", r: "6" }))));
|
|
12049
15443
|
}
|
|
12050
15444
|
static get style() { return lmvzSpinnerCss(); }
|
|
12051
15445
|
static get cmpMeta() { return {
|
|
@@ -12081,7 +15475,7 @@ class LmvzTab {
|
|
|
12081
15475
|
this.el.dispatchEvent(new CustomEvent('lmvzTabReady', { bubbles: true, composed: false }));
|
|
12082
15476
|
}
|
|
12083
15477
|
render() {
|
|
12084
|
-
return (hAsync(Host, { key: '
|
|
15478
|
+
return (hAsync(Host, { key: '4380fe35cacb11bc7114664c126504e8f4fb09a0' }, hAsync("button", { key: 'ac77443cbba5c94f864820088f60c0bac23d0775', part: "button", role: "tab", disabled: this.disabled, "aria-selected": String(this.selected), "aria-disabled": this.disabled ? 'true' : undefined, tabIndex: 0 }, hAsync("slot", { key: '9988497505ca3effa6c41011ac408a5d25629ca1', name: "media", ref: (el) => (this.mediaSlotEl = el), onSlotchange: this.handleMediaSlotChange }), hAsync("span", { key: '70566c46fba36b8717aa82917e45abd39cd7a2ea', class: "label" }, hAsync("slot", { key: 'a595738c387ee2f4f77f6ccdfdfb0589751ce999' })), hAsync("span", { key: '933758dc965d1151ca6a96367ea40290189384ad', "aria-hidden": "true", part: "indicator", class: "indicator" }))));
|
|
12085
15479
|
}
|
|
12086
15480
|
static get delegatesFocus() { return true; }
|
|
12087
15481
|
static get style() { return lmvzTabCss(); }
|
|
@@ -12338,7 +15732,7 @@ class LmvzTabs extends ReactiveControllerHost {
|
|
|
12338
15732
|
this.selectTab(value);
|
|
12339
15733
|
};
|
|
12340
15734
|
render() {
|
|
12341
|
-
return (hAsync(Host, { key: '
|
|
15735
|
+
return (hAsync(Host, { key: '33205038c047420618800be3ef755e1d13a0127c', onClick: this.handleTabClick, onKeydown: this.handleKeydown }, hAsync("div", { key: 'e803f772c5b187326fc80cfa2d3b9d74f6ee1df8', role: "tablist", "aria-orientation": this.orientation, class: "tablist" }, hAsync("slot", { key: '6871a7b6b26c6251ceb544c03b245450aa53373d', ref: (el) => (this.tabSlotEl = el) })), hAsync("div", { key: '17721962da2ecf107a5b878dea996812c61be998', part: "panels-container", class: "panels-container" }, hAsync("slot", { key: '485de66efc7812ecb2368a6b01b0d8ab63971497', name: "panels", ref: (el) => (this.panelSlotEl = el) }))));
|
|
12342
15736
|
}
|
|
12343
15737
|
static get watchers() { return {
|
|
12344
15738
|
"value": [{
|
|
@@ -12369,7 +15763,7 @@ class LmvzTabs extends ReactiveControllerHost {
|
|
|
12369
15763
|
|
|
12370
15764
|
const lmvzToggleCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('RouterBook-Regular'), local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'); font-weight: 400; } @font-face { font-family: Router; src: local('RouterMedium-Regular'), local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'); font-weight: 500; } @font-face { font-family: Router; src: local('RouterBold-Regular'), local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'); font-weight: 700; } } .sc-lmvz-toggle-h { display: inline-flex; align-items: center; gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); padding-block: var(--lmvz-dimension-8-2, clamp(0.13rem, 0.03rem + 0.39vw, 0.5rem)); padding-inline: var(--lmvz-dimension-10-4, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); border-radius: var(--lmvz-semantic-border-radius-round, 999px); cursor: pointer; background-color: transparent; user-select: none; } .sc-lmvz-toggle-h:not([disabled]):hover { background-color: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); } [checked].sc-lmvz-toggle-h { background-color: var(--lmvz-semantic-color-status-active, #f6fbfe); } [disabled][checked].sc-lmvz-toggle-h { background-color: var(--lmvz-semantic-color-status-active, #f6fbfe); } [disabled].sc-lmvz-toggle-h { cursor: not-allowed; opacity: var(--lmvz-component-input-disabled-opacity, 40%); pointer-events: none; } .track.sc-lmvz-toggle { position: relative; flex-shrink: 0; width: var(--lmvz-global-s32, 32px); height: var(--lmvz-global-s20, 20px); border-radius: var(--lmvz-semantic-border-radius-round, 999px); background-color: var(--lmvz-semantic-color-surface-input-primary, #ffffff); border: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-border-default, #e0e0e0); } .sc-lmvz-toggle-h:not([disabled]):hover .track.sc-lmvz-toggle { border-color: var(--lmvz-semantic-color-border-hover, #a1a1a1); } [checked].sc-lmvz-toggle-h .track.sc-lmvz-toggle { border-color: var(--lmvz-semantic-color-border-active, #0f8acc); } input.sc-lmvz-toggle { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: inherit; } .thumb.sc-lmvz-toggle { position: absolute; width: var(--lmvz-global-s13, 13px); height: var(--lmvz-global-s13, 13px); border-radius: 50%; background-color: var(--lmvz-semantic-color-on-surface-input-secondary, #545454); top: 50%; transform: translateY(-50%); left: var(--lmvz-global-s4, 4px); transition: left 0.2s ease, background-color 0.2s ease; pointer-events: none; } [checked].sc-lmvz-toggle-h .thumb.sc-lmvz-toggle { left: calc(var(--lmvz-global-s4, 4px) + var(--lmvz-global-s11, 11px)); background-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); } label.sc-lmvz-toggle { font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.5 Router); color: var(--lmvz-semantic-color-on-surface-primary, #000000); cursor: pointer; }`;
|
|
12371
15765
|
|
|
12372
|
-
const focusWithinCss = () => `.sc-lmvz-toggle-h:focus-
|
|
15766
|
+
const focusWithinCss = () => `.sc-lmvz-toggle-h:has(:focus-visible){outline:var(--lmvz-ds-outline, 1px solid #0e7ab4);outline-offset:var(--lmvz-ds-outline-offset, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem))}@media (forced-colors: active){.sc-lmvz-toggle-h:has(:focus-visible){outline-color:Highlight;box-shadow:none}}`;
|
|
12373
15767
|
|
|
12374
15768
|
let toggleIdCounter = 0;
|
|
12375
15769
|
class LmvzToggle extends ReactiveControllerHost {
|
|
@@ -12431,6 +15825,9 @@ class LmvzToggle extends ReactiveControllerHost {
|
|
|
12431
15825
|
async reportValidity() {
|
|
12432
15826
|
return this.nativeInputElement?.reportValidity?.() ?? false;
|
|
12433
15827
|
}
|
|
15828
|
+
async getValidationMessage() {
|
|
15829
|
+
return this.nativeInputElement?.validationMessage ?? '';
|
|
15830
|
+
}
|
|
12434
15831
|
async getInputElement() {
|
|
12435
15832
|
if (!this.nativeInputElement) {
|
|
12436
15833
|
await new Promise((resolve) => componentOnReady(this.el, resolve));
|
|
@@ -12443,7 +15840,7 @@ class LmvzToggle extends ReactiveControllerHost {
|
|
|
12443
15840
|
this.lmvzChange.emit(newChecked);
|
|
12444
15841
|
};
|
|
12445
15842
|
render() {
|
|
12446
|
-
return (hAsync(Host, { key: '
|
|
15843
|
+
return (hAsync(Host, { key: 'a0e0272a8457ee6b07a102aa10e5a7c0292a55d9' }, hAsync("span", { key: '5d14029bee4b66f5ed2ee1eb189a1d80a68abe3e', class: "track" }, hAsync("input", { key: '926b1ca6065750717577ece30e8e78b9004ec0e8', type: "checkbox", role: "switch", id: this.toggleId, checked: this.checked, disabled: this.disabled, required: this.required, name: this.name, value: this.value, form: this.form, ref: (el) => (this.nativeInputElement = el), onChange: this.handleChange }), hAsync("span", { key: 'bdee06bab6acba72d019134828f7415d7b347c49', class: "thumb", "aria-hidden": "true" })), hAsync("label", { key: 'b8eaa9305352f7146bf95bb517766310517d60e6', htmlFor: this.toggleId }, this.label)));
|
|
12447
15844
|
}
|
|
12448
15845
|
static get formAssociated() { return true; }
|
|
12449
15846
|
static get watchers() { return {
|
|
@@ -12470,6 +15867,7 @@ class LmvzToggle extends ReactiveControllerHost {
|
|
|
12470
15867
|
"blurToggle": [64],
|
|
12471
15868
|
"checkValidity": [64],
|
|
12472
15869
|
"reportValidity": [64],
|
|
15870
|
+
"getValidationMessage": [64],
|
|
12473
15871
|
"getInputElement": [64]
|
|
12474
15872
|
},
|
|
12475
15873
|
"$listeners$": undefined,
|
|
@@ -12486,6 +15884,7 @@ registerComponents([
|
|
|
12486
15884
|
LmvzCard,
|
|
12487
15885
|
LmvzCheckbox,
|
|
12488
15886
|
LmvzChip,
|
|
15887
|
+
LmvzDatepicker,
|
|
12489
15888
|
LmvzHeader,
|
|
12490
15889
|
LmvzIcon,
|
|
12491
15890
|
LmvzInput,
|