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