@luzmo/lucero 1.0.1-alpha.4 → 1.0.1-alpha.40
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/components/accordion/index.cjs +6 -6
- package/components/accordion/index.js +14 -13
- package/components/action-bar/index.cjs +4 -4
- package/components/action-bar/index.js +20 -18
- package/components/action-button/index.cjs +3 -3
- package/components/action-button/index.js +7 -6
- package/components/action-group/index.cjs +1 -1
- package/components/action-group/index.js +2 -2
- package/components/{action-group-DBImibFn.js → action-group-Bwt9w8Vh.js} +10 -9
- package/components/action-group-D917z7XF.cjs +20 -0
- package/components/action-menu/index.cjs +9 -9
- package/components/action-menu/index.js +10 -10
- package/components/avatar/index.cjs +3 -3
- package/components/avatar/index.js +7 -7
- package/components/base-5nDSSNeT.cjs +18 -0
- package/components/base-CdYjmV_8.js +96 -0
- package/components/button/button-base.d.ts +16 -0
- package/components/button/button.d.ts +38 -2
- package/components/button/index.cjs +2 -2
- package/components/button/index.js +37 -32
- package/components/{button-base-DbkDzb71.js → button-base-B5uul3tZ.js} +54 -39
- package/components/button-base-C7or8-FB.cjs +25 -0
- package/components/button-group/index.cjs +1 -1
- package/components/button-group/index.js +11 -9
- package/components/calendar/index.cjs +96 -1
- package/components/calendar/index.js +538 -6
- package/components/checkbox/index.cjs +4 -4
- package/components/checkbox/index.js +10 -8
- package/components/{checkbox-mixin-Do7EgtpQ.js → checkbox-mixin-DUbGDm7f.js} +9 -9
- package/components/{checkbox-mixin-BDN0dBtS.cjs → checkbox-mixin-DhN8CIXY.cjs} +3 -3
- package/components/{clear-button-DoeRUWQ3.js → clear-button-Bjp7N52G.js} +14 -13
- package/components/clear-button-C39c3PH0.cjs +18 -0
- package/components/close-button-C4zqQJRL.cjs +18 -0
- package/components/close-button-R-Cyxi_j.js +52 -0
- package/components/color-area/index.cjs +5 -5
- package/components/color-area/index.js +12 -11
- package/components/color-controller-7sNUf7SP.js +386 -0
- package/components/color-controller-ChN-A9Ft.cjs +18 -0
- package/components/color-field/color-field.d.ts +8 -0
- package/components/color-field/index.cjs +4 -4
- package/components/color-field/index.js +38 -25
- package/components/color-handle/index.cjs +2 -2
- package/components/color-handle/index.js +8 -6
- package/components/color-loupe/index.cjs +1 -1
- package/components/color-loupe/index.js +2 -2
- package/components/color-loupe-CIEFp7ln.cjs +56 -0
- package/components/{color-loupe-CmMsXbjT.js → color-loupe-CLPX6xVb.js} +6 -4
- package/components/color-menu/index.cjs +8 -8
- package/components/color-menu/index.js +46 -46
- package/components/color-palette/color-palette.d.ts +6 -2
- package/components/color-palette/index.cjs +1 -1
- package/components/color-palette/index.js +35 -34
- package/components/color-palette-group/color-palette-group.d.ts +79 -0
- package/components/color-palette-group/index.cjs +28 -0
- package/components/color-palette-group/index.d.ts +7 -0
- package/components/color-palette-group/index.js +206 -0
- package/components/color-picker/color-picker.d.ts +31 -2
- package/components/color-picker/index.cjs +6 -5
- package/components/color-picker/index.js +16 -12
- package/components/color-slider/index.cjs +40 -1
- package/components/color-slider/index.js +452 -6
- package/components/date-time-picker/index.cjs +16 -16
- package/components/date-time-picker/index.js +105 -106
- package/components/{dependency-manger-CEXvGQUV.js → dependency-manger-CO-VPlqq.js} +4 -4
- package/components/{dependency-manger-C5HCkMMB.cjs → dependency-manger-uthev62E.cjs} +1 -1
- package/components/divider/index.cjs +1 -1
- package/components/divider/index.js +11 -9
- package/components/field-group/index.cjs +1 -1
- package/components/field-group/index.js +2 -2
- package/components/field-group-BYHNJmv0.cjs +23 -0
- package/components/{field-group-DXfBWrkO.js → field-group-CHmw159R.js} +7 -5
- package/components/field-label/index.cjs +1 -1
- package/components/field-label/index.js +2 -2
- package/components/{field-label-CZ2zzChK.js → field-label-Cy3xMWZ-.js} +9 -8
- package/components/field-label-DZoeqJJX.cjs +25 -0
- package/components/{focus-visible-DBlJGoEW.js → focus-visible-BvScGDCE.js} +20 -20
- package/components/focus-visible-D4BXb5RB.cjs +18 -0
- package/components/{focusable-BxtpnzWp.js → focusable-BjvsvVam.js} +3 -2
- package/components/focusable-CbVKgGfS.cjs +18 -0
- package/components/icon/index.cjs +1 -1
- package/components/icon/index.js +22 -20
- package/components/index.cjs +1 -1
- package/components/index.js +140 -138
- package/components/infield-button/index.cjs +2 -2
- package/components/infield-button/index.js +6 -5
- package/components/label/index.cjs +1 -1
- package/components/label/index.js +7 -5
- package/components/{language-resolution-8yZa5r_P.js → language-resolution-B-wjV5bb.js} +9 -8
- package/components/{directive-C7oCP5Bh.cjs → language-resolution-EUER43cg.cjs} +1 -5
- package/components/like-anchor-B2EqJPdw.cjs +32 -0
- package/components/{like-anchor-Bvn_vLQ8.js → like-anchor-CgqCU210.js} +23 -22
- package/components/{manage-help-text-DhgARkZX.cjs → manage-help-text-Bat9yGvF.cjs} +3 -3
- package/components/{manage-help-text-syYnjKGL.js → manage-help-text-C9sCHK3R.js} +8 -8
- package/components/menu/index.cjs +38 -13
- package/components/menu/index.js +138 -105
- package/components/menu/menu-item.d.ts +8 -1
- package/components/multi-language-field/index.cjs +2 -2
- package/components/multi-language-field/index.js +9 -7
- package/components/number-field/index.cjs +5 -5
- package/components/number-field/index.js +122 -85
- package/components/number-field/number-field.d.ts +145 -0
- package/components/observe-slot-presence-CNltc0C0.cjs +18 -0
- package/components/{observe-slot-presence-CmVi0zTc.js → observe-slot-presence-DFi6GE3H.js} +1 -1
- package/components/observe-slot-text-CBMHpuIK.cjs +18 -0
- package/components/{observe-slot-text-BPfIQQtz.js → observe-slot-text-DorVpCL4.js} +14 -15
- package/components/options/index.cjs +26 -58
- package/components/options/index.js +205 -849
- package/components/overlay/index.cjs +6 -6
- package/components/overlay/index.js +31 -32
- package/components/overlay-BhrVS5h7.cjs +47 -0
- package/components/overlay-C-No3oJQ.js +1736 -0
- package/components/{pending-state-CaH1si5b.cjs → pending-state-DQctFHI8.cjs} +2 -2
- package/components/{pending-state-DTX7ggyF.js → pending-state-Dx1u3EXA.js} +2 -2
- package/components/picker/index.cjs +1 -1
- package/components/picker/index.js +3 -3
- package/components/{picker-BmoXv1jt.js → picker-Cm6_didQ.js} +44 -44
- package/components/picker-DxYgh4LR.cjs +123 -0
- package/components/picker-button/index.cjs +4 -4
- package/components/picker-button/index.js +8 -7
- package/components/{platform-BiXhwqk3.cjs → platform-BJnOJJag.cjs} +1 -1
- package/components/{platform-BM-uMWpX.js → platform-CqwNrovd.js} +12 -12
- package/components/popover/index.cjs +1 -1
- package/components/popover/index.js +2 -2
- package/components/popover-lcZnODPK.cjs +30 -0
- package/components/{popover-DjX0aAnY.js → popover-ucIgjbQs.js} +8 -7
- package/components/progress-circle/index.cjs +1 -1
- package/components/progress-circle/index.js +2 -2
- package/components/{progress-circle-DXH9z8-6.js → progress-circle-D5J0ZwY0.js} +8 -7
- package/components/progress-circle-DgMbqrzG.cjs +33 -0
- package/components/radio/index.cjs +2 -2
- package/components/radio/index.js +12 -11
- package/components/search/index.cjs +6 -6
- package/components/search/index.js +6 -6
- package/components/select/index.cjs +43 -42
- package/components/select/index.js +142 -126
- package/components/select/select.d.ts +1 -1
- package/components/{base-BjTwmyRF.cjs → sized-mixin-DcvJLFeo.cjs} +1 -5
- package/components/{sized-mixin-D4ACoVUr.js → sized-mixin-cJbo3PKR.js} +5 -5
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.js +48 -1101
- package/components/{strategies-9indNIEb.js → strategies-Bk97oVn1.js} +15 -50
- package/components/strategies-CNgBb6dM.cjs +18 -0
- package/components/{streaming-listener-CP-JE6Fa.js → streaming-listener-BlWm-XZU.js} +5 -6
- package/components/streaming-listener-D9Wc7skA.cjs +18 -0
- package/components/swatch/index.cjs +7 -7
- package/components/swatch/index.js +18 -17
- package/components/switch/index.cjs +2 -2
- package/components/switch/index.js +6 -5
- package/components/tabs/index.cjs +16 -24
- package/components/tabs/index.js +94 -162
- package/components/tags/index.cjs +4 -4
- package/components/tags/index.js +15 -14
- package/components/text-field/index.cjs +3 -3
- package/components/text-field/index.js +13 -11
- package/components/text-field/text-field.d.ts +1 -0
- package/components/{text-field-BIADXoLC.js → text-field-BHaLKkf1.js} +73 -99
- package/components/text-field-DFP7p8Rv.cjs +81 -0
- package/components/text-field.module-Bp4Mwuvj.js +21 -0
- package/components/text-field.module-eAEqjvZu.cjs +18 -0
- package/components/toast/index.cjs +11 -11
- package/components/toast/index.js +11 -9
- package/components/tooltip/index.cjs +4 -4
- package/components/tooltip/index.js +60 -36
- package/components/tooltip/tooltip.d.ts +12 -1
- package/components/unit-input/index.cjs +6 -6
- package/components/unit-input/index.js +12 -11
- package/components/utils.cjs +1 -1
- package/components/utils.js +6 -6
- package/custom-elements.json +1 -1
- package/index.d.ts +1 -0
- package/package.json +67 -1
- package/components/NumberFormatter-DewVDY5w.cjs +0 -18
- package/components/NumberFormatter-DgOUVrge.js +0 -136
- package/components/NumberParser-Dik4a0h-.cjs +0 -18
- package/components/NumberParser-ci9J5EKv.js +0 -173
- package/components/action-group-DJGMcRHb.cjs +0 -20
- package/components/async-directive-BX1T1e1_.cjs +0 -22
- package/components/async-directive-BfcqVjDp.js +0 -82
- package/components/base-CBCg3yyw.cjs +0 -40
- package/components/base-D76d76ww.js +0 -26
- package/components/base-WsynuqaS.js +0 -677
- package/components/button-base-XgPLmwP-.cjs +0 -25
- package/components/class-map-Di1D_rCm.cjs +0 -22
- package/components/class-map-NbVXqBU0.js +0 -51
- package/components/clear-button-Qi1pMA5S.cjs +0 -18
- package/components/close-button-BFMBEw3q.cjs +0 -18
- package/components/close-button-BWXdHSx3.js +0 -51
- package/components/color-controller-DTp1juRz.js +0 -3198
- package/components/color-controller-_ZwyhvaU.cjs +0 -18
- package/components/color-loupe-CaA_Lfkk.cjs +0 -56
- package/components/directive-helpers-Cm6gitnu.js +0 -62
- package/components/directive-helpers-DyIRTWwA.cjs +0 -22
- package/components/directive-oAbCiebi.js +0 -44
- package/components/field-group-DkGst3r5.cjs +0 -23
- package/components/field-label-mO1AkUgR.cjs +0 -25
- package/components/flow-D-0MTYCm.js +0 -527
- package/components/flow-DM3dNAKs.cjs +0 -30
- package/components/focus-visible-B0P9aY_G.cjs +0 -18
- package/components/focusable-EbipgXRh.cjs +0 -18
- package/components/if-defined-C9YGdo33.cjs +0 -22
- package/components/if-defined-DOaE2coe.js +0 -27
- package/components/index-A-yOTB_d.js +0 -1490
- package/components/index-BLWuwZXx.cjs +0 -113
- package/components/index-BwxgAdzi.cjs +0 -57
- package/components/index-HjQa8tew.js +0 -1174
- package/components/language-resolution-DJzmyzZq.cjs +0 -18
- package/components/like-anchor-sod1C1fR.cjs +0 -32
- package/components/luzmo-icons-DbwDQtuO.js +0 -229
- package/components/luzmo-icons-DletXGWU.cjs +0 -29
- package/components/mutation-controller-DH7YOCyj.js +0 -52
- package/components/mutation-controller-DkOMCW-c.cjs +0 -22
- package/components/observe-slot-presence-bc9chhsi.cjs +0 -18
- package/components/observe-slot-text-Ceb7SvYT.cjs +0 -18
- package/components/overlay-Cig9r6uU.js +0 -2747
- package/components/overlay-KSKMzzkh.cjs +0 -47
- package/components/picker-DWsBWdPN.cjs +0 -123
- package/components/popover-KFfO0IYL.cjs +0 -30
- package/components/progress-circle-BvRJNuNo.cjs +0 -33
- package/components/query-BL-TJj7K.cjs +0 -22
- package/components/query-D_KR_GUc.js +0 -51
- package/components/query-assigned-elements-DjfhL1cl.js +0 -36
- package/components/query-assigned-elements-DsKsfk7G.cjs +0 -22
- package/components/query-assigned-nodes-BcKWmGzy.cjs +0 -22
- package/components/query-assigned-nodes-C76XVPWY.js +0 -36
- package/components/sized-mixin-CPxE5C96.cjs +0 -18
- package/components/state-D8JEtYqe.cjs +0 -22
- package/components/state-Deh-vKYE.js +0 -29
- package/components/strategies-BACP6MhR.cjs +0 -18
- package/components/streaming-listener-B00MvALi.cjs +0 -18
- package/components/style-map-CeilmSgs.cjs +0 -22
- package/components/style-map-IgqIKvlE.js +0 -53
- package/components/text-field-D5d_Gt0t.cjs +0 -85
- package/components/text-field.module-ColtFhf_.js +0 -21
- package/components/text-field.module-p_VF2tC_.cjs +0 -18
- package/components/when-CDK1Tt5Y.js +0 -28
- package/components/when-CDZyJPvd.cjs +0 -22
|
@@ -15,14 +15,546 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
import {
|
|
19
|
-
|
|
18
|
+
import { getLocalTimeZone as D, today as _, isSameMonth as c, parseDate as y, toCalendarDate as b, startOfMonth as g, isSameDay as u, endOfMonth as M, startOfWeek as f, getWeeksInMonth as C, DateFormatter as T } from "@internationalized/date";
|
|
19
|
+
import { NumberFormatter as p } from "@internationalized/number";
|
|
20
|
+
import { unsafeCSS as S, html as i } from "lit";
|
|
21
|
+
import { classMap as F } from "lit/directives/class-map.js";
|
|
22
|
+
import { ifDefined as $ } from "lit/directives/if-defined.js";
|
|
23
|
+
import { a as I } from "../base-CdYjmV_8.js";
|
|
24
|
+
import { S as W } from "../sized-mixin-cJbo3PKR.js";
|
|
25
|
+
import "../action-button/index.js";
|
|
26
|
+
import "../icon/index.js";
|
|
27
|
+
import { luzmoAngleLeft as N, luzmoAngleRight as B } from "@luzmo/icons";
|
|
28
|
+
import { property as m, state as h } from "lit/decorators.js";
|
|
29
|
+
const k = () => {
|
|
20
30
|
if (typeof document < "u" && !document.querySelector("style[data-luzmo-vars]")) {
|
|
21
|
-
const
|
|
22
|
-
|
|
31
|
+
const s = document.createElement("style");
|
|
32
|
+
s.setAttribute("data-luzmo-vars", ""), s.textContent = 'html{--luzmo-animation-duration: 0.15s;--luzmo-border-color: rgba(var(--luzmo-border-color-rgb), 0.1);--luzmo-border-color-hover: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-down: rgba(var(--luzmo-border-color-rgb), 0.3);--luzmo-border-color-focus: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-rgb: 0, 0, 0;--luzmo-border-color-full: rgb(180, 180, 180);--luzmo-border-color-full-hover: rgb(140, 140, 140);--luzmo-border-color-full-down: rgb(110, 110, 110);--luzmo-border-color-full-focus: rgb(140, 140, 140);--luzmo-border-color-disabled: #dddddd;--luzmo-border-radius: 6px;--luzmo-border-radius-s: 4px;--luzmo-border-radius-l: 8px;--luzmo-border-radius-xl: 12px;--luzmo-border-radius-full: 999rem;--luzmo-background-color: #ffffff;--luzmo-background-color-rgb: 255, 255, 255;--luzmo-background-color-disabled: #eeeeee;--luzmo-background-color-hover: #f0f0fc;--luzmo-background-color-down: #f1f1ff;--luzmo-background-color-focus: #f0f0fc;--luzmo-background-color-highlight: rgb(240, 240, 240);--luzmo-background-color-highlight-disabled: rgb(245, 245, 245);--luzmo-background-color-highlight-hover: rgb(225, 225, 225);--luzmo-background-color-highlight-down: rgb(215, 215, 215);--luzmo-background-color-highlight-focus: rgb(225, 225, 225);--luzmo-border-width: 1px;--luzmo-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;--luzmo-font-size-xs: 10px;--luzmo-font-size-s: 12px;--luzmo-font-size-m: 14px;--luzmo-font-size: 14px;--luzmo-font-size-l: 16px;--luzmo-font-size-xl: 18px;--luzmo-font-size-xxl: 20px;--luzmo-font-style: normal;--luzmo-line-height: normal;--luzmo-font-weight: 400;--luzmo-font-weight-semibold: 500;--luzmo-font-weight-bold: 600;--luzmo-font-color: #333;--luzmo-font-color-disabled: var(--luzmo-disabled-color);--luzmo-font-color-extra-dimmed: #888;--luzmo-font-color-hover: #333;--luzmo-font-color-down: #111;--luzmo-font-color-focus: #333;--luzmo-primary: #4434ff;--luzmo-primary-hover: #4234e4;--luzmo-primary-down: #392cc7;--luzmo-primary-focus: #4234e4;--luzmo-primary-inverse-color: #ffffff;--luzmo-primary-rgb: 68, 52, 255;--luzmo-secondary: #ff00ff;--luzmo-secondary-hover: #e309e3;--luzmo-secondary-down: #c711c7;--luzmo-secondary-focus: #e309e3;--luzmo-secondary-inverse-color: #ffffff;--luzmo-secondary-rgb: 255, 0, 255;--luzmo-negative-color: #ca221c;--luzmo-negative-color-hover: #b3241f;--luzmo-negative-color-down: #9f231f;--luzmo-negative-color-focus: #b3241f;--luzmo-negative-color-rgb: 202, 34, 28;--luzmo-positive-color: rgb(20, 150, 101);--luzmo-positive-color-hover: rgb(17, 128, 86);--luzmo-positive-color-down: rgb(16, 105, 71);--luzmo-positive-color-focus: rgb(17, 128, 86);--luzmo-positive-color-rgb: 20, 150, 101;--luzmo-selected-color: rgb(110, 110, 110);--luzmo-selected-color-hover: rgb(70, 70, 70);--luzmo-selected-color-down: rgb(40, 40, 40);--luzmo-selected-color-focus: rgb(70, 70, 70);--luzmo-selected-color-hard: #1e1e1e;--luzmo-selected-color-hard-hover: rgb(0, 0, 0);--luzmo-selected-color-hard-down: rgb(0, 0, 0);--luzmo-selected-color-hard-focus: rgb(0, 0, 0);--luzmo-informative-color: #1a77e9;--luzmo-informative-color-rgb: 26, 119, 233;--luzmo-disabled-color: #aaaaaa;--luzmo-spacing-1: 2px;--luzmo-spacing-2: 4px;--luzmo-spacing-3: 8px;--luzmo-spacing-4: 12px;--luzmo-spacing-5: 16px;--luzmo-indicator-gap: 2px;--luzmo-indicator-width: 1px;--luzmo-indicator-color: var(--luzmo-primary);--luzmo-component-height-xxs: 20px;--luzmo-component-height-xs: 24px;--luzmo-component-height-s: 28px;--luzmo-component-height: 32px;--luzmo-component-height-l: 40px;--luzmo-component-height-xl: 48px;--luzmo-component-height-xxl: 64px;--luzmo-icon-size-xxs: 12px;--luzmo-icon-size-xs: 14px;--luzmo-icon-size-s: 16px;--luzmo-icon-size-m: 18px;--luzmo-icon-size-l: 20px;--luzmo-icon-size-xl: 22px;--luzmo-icon-size-xxl: 32px}', document.head.appendChild(s);
|
|
23
33
|
}
|
|
24
34
|
};
|
|
25
|
-
|
|
35
|
+
k();
|
|
36
|
+
const A = ':host{inline-size:var(--luzmo-calendar-width, var(--calendar-width));display:inline-block}.header{inline-size:100%;align-items:center;display:flex}.title{color:var(--highcontrast-calendar-date-text-color, var(--luzmo-calendar-date-text-color, var(--calendar-date-text-color)));font-size:var(--luzmo-calendar-title-text-size, var(--calendar-title-text-size));font-weight:var(--luzmo-calendar-title-font-weight, var(--calendar-title-font-weight));line-height:var(--luzmo-calendar-title-height, var(--calendar-title-height));text-align:center;white-space:nowrap;text-overflow:ellipsis;flex-grow:1;order:1;margin:0;overflow:hidden}.nextMonth,.prevMonth{transform:var(--logical-rotation)}.nextMonth:not([disabled]),.prevMonth:not([disabled]){color:var(--highcontrast-calendar-button-icon-color, var(--luzmo-calendar-button-icon-color, var(--calendar-button-icon-color)))}.prevMonth{order:0}.nextMonth{order:2}.dayOfWeek{inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));color:var(--highcontrast-calendar-day-title-text-color, var(--luzmo-calendar-day-title-text-color, var(--calendar-day-title-text-color)));font-size:var(--luzmo-calendar-day-title-text-size, var(--calendar-day-title-text-size));font-weight:var(--luzmo-calendar-day-title-text-font-weight, var(--calendar-day-title-text-font-weight));text-transform:uppercase;cursor:default;flex-direction:column;justify-content:flex-end;display:flex;border-block-end:none!important;-webkit-text-decoration:none!important;text-decoration:none!important}:host([title]) .dayOfWeek{text-decoration:underline;letter-spacing:var(--luzmo-calendar-title-text-letter-spacing, var(--calendar-title-text-letter-spacing));border-block-end:none;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.body{outline:none}.table{table-layout:fixed;border-collapse:collapse;border-spacing:0;-webkit-user-select:none;user-select:none}.table-cell{text-align:center;box-sizing:initial;block-size:var(--luzmo-calendar-day-height, var(--calendar-day-height));inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));padding:var(--luzmo-calendar-day-padding, var(--calendar-day-padding));position:relative}.table-cell:focus{outline:0}.date{box-sizing:border-box;block-size:var(--luzmo-calendar-day-height, var(--calendar-day-height));inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));margin:var(--luzmo-calendar-day-padding, var(--calendar-day-padding));border-radius:var(--luzmo-calendar-day-border-radius, var(--calendar-day-border-radius));border:var(--luzmo-calendar-day-border-size, var(--calendar-day-border-size)) solid transparent;font-size:var(--luzmo-calendar-day-text-size, var(--calendar-day-text-size));line-height:calc(var(--luzmo-calendar-day-width, var(--calendar-day-width)) - var(--luzmo-calendar-day-border-size, var(--calendar-day-border-size)) * 2);white-space:nowrap;cursor:pointer;display:block;position:absolute;inset-block-start:0;inset-inline-start:0}.date:lang(ja),.date:lang(ko),.date:lang(zh){font-size:var(--luzmo-calendar-day-text-size-han, var(--calendar-day-text-size-han))}.date.is-disabled{cursor:default;pointer-events:none}.date.is-outsideMonth{display:none}.date:before{content:"";box-sizing:border-box;inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));block-size:var(--luzmo-calendar-day-height, var(--calendar-day-height));border-radius:var(--luzmo-calendar-day-border-radius, var(--calendar-day-border-radius));border:var(--luzmo-calendar-day-border-size, var(--calendar-day-border-size)) solid transparent;position:absolute;inset-block-start:calc(50% - var(--luzmo-calendar-day-width, var(--calendar-day-width)) / 2);inset-inline-start:calc(50% - var(--luzmo-calendar-day-width, var(--calendar-day-width)) / 2)}.date.is-selected:not(.is-range-selection){font-weight:var(--luzmo-calendar-day-text-font-weight-selected, var(--calendar-day-text-font-weight-selected))}.date.is-selected:not(.is-range-selection):before{display:none}.date.is-today{font-weight:var(--luzmo-calendar-day-today-text-font-weight, var(--calendar-day-today-text-font-weight))}.date.is-range-selection{margin:var(--luzmo-calendar-day-padding, var(--calendar-day-padding)) 0;border-width:var(--luzmo-calendar-border-width-reset, var(--calendar-border-width-reset));line-height:var(--luzmo-calendar-day-height, var(--calendar-day-height));border-radius:var(--luzmo-calendar-border-radius-reset, var(--calendar-border-radius-reset));inline-size:calc(var(--luzmo-calendar-day-width, var(--calendar-day-width)) + var(--luzmo-calendar-day-padding, var(--calendar-day-padding)) * 2)}.date.is-range-selection.is-range-end,.date.is-range-selection.is-range-start,.date.is-range-selection.is-selection-end,.date.is-range-selection.is-selection-start{inline-size:calc(var(--luzmo-calendar-day-width, var(--calendar-day-width)) + var(--luzmo-calendar-day-padding, var(--calendar-day-padding)))}.date.is-range-selection.is-selection-end,.date.is-range-selection.is-selection-start{font-weight:var(--luzmo-calendar-day-text-font-weight-cap-selected, var(--calendar-day-text-font-weight-cap-selected))}.date.is-range-selection.is-selection-end:after,.date.is-range-selection.is-selection-start:after{block-size:var(--luzmo-calendar-day-height, var(--calendar-day-height));inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));border-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));content:"";display:block;position:absolute;inset-block-start:0}.date.is-range-selection.is-range-start,.date.is-range-selection.is-selection-start{border-start-start-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));border-end-start-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));margin-inline-start:var(--luzmo-calendar-day-padding, var(--calendar-day-padding));padding-inline-end:var(--luzmo-calendar-day-padding, var(--calendar-day-padding))}.date.is-range-selection.is-range-start:after,.date.is-range-selection.is-range-start:before,.date.is-range-selection.is-selection-start:after,.date.is-range-selection.is-selection-start:before{inset-inline-start:0}.date.is-range-selection.is-range-end,.date.is-range-selection.is-selection-end{border-start-end-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));border-end-end-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));margin-inline-end:var(--luzmo-calendar-day-padding, var(--calendar-day-padding));padding-inline-start:var(--luzmo-calendar-day-padding, var(--calendar-day-padding))}.date.is-range-selection.is-range-end:after,.date.is-range-selection.is-range-end:before,.date.is-range-selection.is-selection-end:after,.date.is-range-selection.is-selection-end:before{inset-inline:auto 0}.date.is-range-selection.is-range-start.is-range-end,.date.is-range-selection.is-selection-end.is-range-start,.date.is-range-selection.is-selection-start.is-range-end,.date.is-range-selection.is-selection-start.is-selection-end{inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));border-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width))}.date{color:var(--highcontrast-calendar-day-text-color, var(--luzmo-calendar-day-text-color, var(--calendar-day-text-color)))}.date:active{background-color:var(--highcontrast-calendar-day-background-color-down, var(--luzmo-calendar-day-background-color-down, var(--calendar-day-background-color-down)))}.date.is-selected{color:var(--highcontrast-calendar-day-text-color-selected, var(--luzmo-calendar-day-text-color-selected, var(--calendar-day-text-color-selected)));background:var(--highcontrast-calendar-day-background-color-selected, var(--luzmo-calendar-day-background-color-selected, var(--calendar-day-background-color-selected)))}.date.is-selected:not(.is-range-selection){background:var(--highcontrast-calendar-day-background-color-cap-selected, var(--luzmo-calendar-day-background-color-cap-selected, var(--calendar-day-background-color-cap-selected)));color:var(--highcontrast-calendar-day-text-color-cap-selected, var(--luzmo-calendar-day-text-color-cap-selected, var(--calendar-day-text-color-cap-selected)));border-color:var(--highcontrast-calendar-day-border-color-cap-selected, var(--luzmo-calendar-day-border-color-cap-selected, var(--calendar-day-border-color-cap-selected)))}.date.is-today{color:var(--highcontrast-calendar-day-today-text-color, var(--luzmo-calendar-day-today-text-color, var(--calendar-day-today-text-color)));background-color:var(--highcontrast-calendar-day-today-background-color, var(--luzmo-calendar-day-today-background-color, var(--calendar-day-today-background-color)))}.date.is-today,.date.is-today:before{border-color:var(--highcontrast-calendar-day-today-border-color, var(--luzmo-calendar-day-today-border-color, var(--calendar-day-today-border-color)))}@media (hover: hover){.date:hover{color:var(--highcontrast-calendar-day-text-color-hover, var(--luzmo-calendar-day-text-color-hover, var(--calendar-day-text-color-hover)))}.date:hover:not(.is-selection-end,.is-selection-start):before{background:var(--highcontrast-calendar-day-background-color-hover, var(--luzmo-calendar-day-background-color-hover, var(--calendar-day-background-color-hover)))}.date.is-range-selection:hover:before,.date.is-selected:hover:not(.is-selection-end,.is-selection-start):before{background:var(--highcontrast-calendar-day-background-color-selected-hover, var(--luzmo-calendar-day-background-color-selected-hover, var(--calendar-day-background-color-selected-hover)))}.date.is-today.is-selected:not(.is-range-selection):hover:before{background:var(--highcontrast-calendar-day-today-background-color-selected-hover, var(--luzmo-calendar-day-today-background-color-selected-hover, var(--calendar-day-today-background-color-selected-hover)))}}.date.is-today.is-disabled{color:var(--highcontrast-calendar-day-today-text-color-disabled, var(--luzmo-calendar-day-today-text-color-disabled, var(--calendar-day-today-text-color-disabled)))}.date.is-today.is-disabled,.date.is-today.is-disabled:before{border-color:var(--highcontrast-calendar-day-today-border-color-disabled, var(--luzmo-calendar-day-today-border-color-disabled, var(--calendar-day-today-border-color-disabled)))}.table-cell:focus-within .date:not(.is-range-selection){background:var(--highcontrast-calendar-day-background-color-key-focus, var(--luzmo-calendar-day-background-color-key-focus, var(--calendar-day-background-color-key-focus)));color:var(--highcontrast-calendar-day-text-color-key-focus, var(--luzmo-calendar-day-text-color-key-focus, var(--calendar-day-text-color-key-focus)))}.table-cell:focus-within .date.is-selected:not(.is-range-selection),.table-cell:focus-within .date.is-today:not(.is-range-selection),.table-cell:focus-within .date:not(.is-range-selection),.table-cell:focus-within .date:not(.is-range-selection):active{border-color:var(--highcontrast-calendar-day-border-color-key-focus, var(--luzmo-calendar-day-border-color-key-focus, var(--calendar-day-border-color-key-focus)))}.table-cell:focus-within .date.is-selected:not(.is-range-selection),.table-cell:focus-within .date:not(.is-range-selection):active{color:var(--highcontrast-calendar-day-text-color-selected, var(--luzmo-calendar-day-text-color-selected, var(--calendar-day-text-color-selected)));background:var(--highcontrast-calendar-day-background-color-cap-selected, var(--luzmo-calendar-day-background-color-cap-selected, var(--calendar-day-background-color-cap-selected)));border-color:var(--highcontrast-calendar-day-border-color-key-focus, var(--luzmo-calendar-day-border-color-cap-selected-focus, var(--calendar-day-border-color-cap-selected-focus)))}.table-cell:focus-within .date.is-range-selection:before,.table-cell:focus-within .date.is-selected:before{background:var(--highcontrast-calendar-day-background-color-selected-hover, var(--luzmo-calendar-day-background-color-selected-hover, var(--calendar-day-background-color-selected-hover)))}.table-cell:focus-within .date:before{border-color:var(--highcontrast-calendar-day-border-color-key-focus, var(--luzmo-calendar-day-border-color-key-focus, var(--calendar-day-border-color-key-focus)))}.date.is-disabled{color:var(--highcontrast-calendar-day-text-color-disabled, var(--luzmo-calendar-day-text-color-disabled, var(--calendar-day-text-color-disabled)))}.date.is-selection-end,.date.is-selection-start{color:var(--highcontrast-calendar-day-text-color-cap-selected, var(--luzmo-calendar-day-text-color-cap-selected, var(--calendar-day-text-color-cap-selected)))}.date.is-selection-end:after,.date.is-selection-start:after{background-color:var(--highcontrast-calendar-day-background-color-selected, var(--luzmo-calendar-day-background-color-selected, var(--calendar-day-background-color-selected)))}.date.is-selection-end.is-disabled,.date.is-selection-start.is-disabled{color:var(--highcontrast-calendar-day-text-color-disabled, var(--luzmo-calendar-day-text-color-disabled, var(--calendar-day-text-color-disabled)))}@media (forced-colors: active){.nextMonth,.prevMonth{--highcontrast-calendar-button-icon-color: ButtonText}.date{--highcontrast-calendar-day-background-color-cap-selected: Highlight;--highcontrast-calendar-day-background-color-down: ButtonFace;--highcontrast-calendar-day-background-color-hover: Transparent;--highcontrast-calendar-day-background-color-key-focus: ButtonFace;--highcontrast-calendar-day-background-color-selected-hover: Transparent;--highcontrast-calendar-day-background-color-selected: Highlight;--highcontrast-calendar-day-border-color-key-focus: ButtonText;--highcontrast-calendar-day-text-color-cap-selected: HighlightText;--highcontrast-calendar-day-text-color-disabled: GrayText;--highcontrast-calendar-day-text-color-hover: ButtonText;--highcontrast-calendar-day-text-color-key-focus: ButtonText;--highcontrast-calendar-day-text-color-selected: HighlightText;--highcontrast-calendar-day-text-color: CanvasText;--highcontrast-calendar-date-text-color: CanvasText;--highcontrast-calendar-day-title-text-color: CanvasText;--highcontrast-calendar-day-today-background-color-selected-hover: Highlight;--highcontrast-calendar-day-today-border-color-disabled: GrayText;--highcontrast-calendar-day-today-border-color: ButtonText;--highcontrast-calendar-day-today-text-color-disabled: GrayText;--highcontrast-calendar-day-today-text-color: ButtonText;forced-color-adjust:none}.date.is-range-selection.is-today{color:HighlightText}.date.is-range-selection.is-selection-end:after,.date.is-range-selection.is-selection-start:after{content:none}.date.is-disabled.is-range-selection,.date.is-disabled.is-selected{background:Highlight;color:HighlightText}}:host{--calendar-background-color: var(--luzmo-background-color-white)}:host{font-family:var(--luzmo-font-family);--calendar-day-width: var(--luzmo-component-height);--calendar-day-height: var(--luzmo-component-height);--calendar-border-radius-reset: 0;--calendar-border-width-reset: 0;--calendar-day-border-size: var(--luzmo-border-width);--calendar-margin-y: calc(var(--luzmo-spacing) * 3);--calendar-margin-x: var(--luzmo-component-height);--calendar-day-padding: var(--luzmo-spacing-2);--calendar-width: calc( (var(--calendar-day-width) + var(--calendar-day-padding) * 2) * 7 );--calendar-title-text-letter-spacing: .06em;--calendar-day-title-text-font-weight: bold;--calendar-day-title-text-color: var(--luzmo-font-color-disabled);--calendar-title-height: var(--luzmo-component-height);--calendar-title-font-weight: bold;--calendar-title-text-size: var(--luzmo-font-size);--calendar-day-title-text-size: var(--luzmo-font-size);--calendar-day-text-size-han: var(--luzmo-font-size);--calendar-date-text-color: var(--luzmo-font-color);--calendar-day-text-color: var(--luzmo-font-color);--calendar-day-text-size: var(--luzmo-font-size);--calendar-day-border-radius: var(--luzmo-border-radius);--calendar-day-text-color-selected: var(--luzmo-primary-inverse-color);--calendar-day-text-color-hover: var(--luzmo-font-color-hover);--calendar-day-text-color-cap-selected: var(--luzmo-primary-inverse-color);--calendar-day-border-color-cap-selected: var(--luzmo-primary);--calendar-day-border-color-cap-selected-focus: var(--luzmo-primary-focus);--calendar-day-text-font-weight-selected: var(--bold-font-weight);--calendar-day-text-font-weight-cap-selected: var(--bold-font-weight);--calendar-day-today-text-color: var(--luzmo-primary);--calendar-day-today-background-color: var(--luzmo-background-color-hover);--calendar-day-today-text-font-weight: normal;--calendar-day-today-border-color: transparent;--calendar-day-today-text-color-disabled: var(--luzmo-font-color-disabled);--calendar-day-today-border-color-disabled: transparent;--calendar-day-text-color-disabled: var(--luzmo-font-color-disabled);--calendar-day-text-color-key-focus: var(--luzmo-primary-down);--calendar-day-background-color-cap-selected: var(--luzmo-primary);--calendar-button-icon-color: var(--luzmo-font-color)}:host:dir(rtl),:host([dir=rtl]){--logical-rotation: matrix(-1, 0, 0, 1, 0, 0)}:host([size=s]){--calendar-day-width: var(--luzmo-component-height-s);--calendar-day-height: var(--luzmo-component-height-s);--calendar-day-border-radius: var(--luzmo-border-radius-s);--calendar-title-height: var(--luzmo-component-height-s);--calendar-title-text-size: var(--luzmo-font-size-s);--calendar-day-title-text-size: var(--luzmo-font-size-s);--calendar-day-text-size-han: var(--luzmo-font-size-s);--calendar-day-text-size: var(--luzmo-font-size-s)}:host([size=l]){--calendar-day-width: var(--luzmo-component-height-l);--calendar-day-height: var(--luzmo-component-height-l);--calendar-day-border-radius: var(--luzmo-border-radius-l);--calendar-title-height: var(--luzmo-component-height-l);--calendar-title-text-size: var(--luzmo-font-size-l);--calendar-day-title-text-size: var(--luzmo-font-size-l);--calendar-day-text-size-han: var(--luzmo-font-size-l);--calendar-day-text-size: var(--luzmo-font-size-l)}:host([size=xl]){--calendar-day-width: var(--luzmo-component-height-xl);--calendar-day-height: var(--luzmo-component-height-xl);--calendar-day-border-radius: var(--luzmo-border-radius-xl);--calendar-title-height: var(--luzmo-component-height-xl);--calendar-title-text-size: var(--luzmo-font-size-xl);--calendar-day-title-text-size: var(--luzmo-font-size-xl);--calendar-day-text-size-han: var(--luzmo-font-size-xl);--calendar-day-text-size: var(--luzmo-font-size-xl)}.table-cell span[role=button]{border-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width))}';
|
|
37
|
+
var L = Object.defineProperty, O = Object.getOwnPropertyDescriptor, l = (s, e, a, t) => {
|
|
38
|
+
for (var r = t > 1 ? void 0 : t ? O(e, a) : e, n = s.length - 1, d; n >= 0; n--)
|
|
39
|
+
(d = s[n]) && (r = (t ? d(e, a, r) : d(r)) || r);
|
|
40
|
+
return t && r && L(e, a, r), r;
|
|
41
|
+
};
|
|
42
|
+
const x = 7;
|
|
43
|
+
class o extends W(I, {
|
|
44
|
+
validSizes: ["s", "m", "l", "xl"],
|
|
45
|
+
noDefaultSize: !0
|
|
46
|
+
}) {
|
|
47
|
+
constructor() {
|
|
48
|
+
super(), this.disabled = !1, this.labels = {
|
|
49
|
+
previous: "Previous",
|
|
50
|
+
next: "Next",
|
|
51
|
+
today: "Today",
|
|
52
|
+
selected: "Selected"
|
|
53
|
+
}, this.currentDate = this.today, this.timeZone = D(), this.weekdays = [], this.currentMonthDates = [], this._isDateFocusIntent = !1, this.numberFormatter = new p(this._language), this.setNumberFormatter(), this.setWeekdays(), this.setCurrentMonthDates();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The styles of the calendar
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
static get styles() {
|
|
60
|
+
return [S(A)];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The language used to format the dates and weekdays.
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
get _language() {
|
|
67
|
+
try {
|
|
68
|
+
return this.language ? new Intl.Locale(this.language).language : "en";
|
|
69
|
+
} catch {
|
|
70
|
+
return "en";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The current date in the calendar
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
get today() {
|
|
78
|
+
return _(this.timeZone);
|
|
79
|
+
}
|
|
80
|
+
set isDateFocusIntent(e) {
|
|
81
|
+
this._isDateFocusIntent !== e && (this._isDateFocusIntent = e, this.requestUpdate("isDateFocusIntent", !e));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
get isDateFocusIntent() {
|
|
87
|
+
return this._isDateFocusIntent;
|
|
88
|
+
}
|
|
89
|
+
setDateFocusIntent() {
|
|
90
|
+
this.isDateFocusIntent = !0;
|
|
91
|
+
}
|
|
92
|
+
resetDateFocusIntent() {
|
|
93
|
+
this.isDateFocusIntent = !1;
|
|
94
|
+
}
|
|
95
|
+
connectedCallback() {
|
|
96
|
+
super.connectedCallback(), document.addEventListener("mousedown", this.resetDateFocusIntent);
|
|
97
|
+
}
|
|
98
|
+
disconnectedCallback() {
|
|
99
|
+
super.disconnectedCallback(), document.removeEventListener("mousedown", this.resetDateFocusIntent);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Resets the component's value
|
|
103
|
+
*/
|
|
104
|
+
clear() {
|
|
105
|
+
this._value = void 0;
|
|
106
|
+
}
|
|
107
|
+
willUpdate(e) {
|
|
108
|
+
e.has("language") && (this.setNumberFormatter(), this.setWeekdays(), this.setCurrentMonthDates());
|
|
109
|
+
const a = e.has("min"), t = e.has("max"), r = e.has("value");
|
|
110
|
+
(a || t || r) && (this.convertToCalendarDates(), this.checkDatePropsCompliance(a || t), this.updateCurrentDate());
|
|
111
|
+
const d = e.get("currentDate");
|
|
112
|
+
e.has("currentDate") && (!d || !c(d, this.currentDate)) && (this.setCurrentMonthDates(), this.setAttribute("aria-label", this.monthAndYear));
|
|
113
|
+
}
|
|
114
|
+
updated(e) {
|
|
115
|
+
e.has("currentDate") && this.isDateFocusIntent && this.focusCurrentDate();
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Focuses the tabbable day element in the calendar represented by the current date.
|
|
119
|
+
* Useful while navigating through the calendar as the focus might be lost when the month changes.
|
|
120
|
+
*/
|
|
121
|
+
focusCurrentDate() {
|
|
122
|
+
var a;
|
|
123
|
+
const e = (a = this.shadowRoot) == null ? void 0 : a.querySelector(
|
|
124
|
+
'td span[tabindex="0"]'
|
|
125
|
+
);
|
|
126
|
+
e && e.focus();
|
|
127
|
+
}
|
|
128
|
+
convertToCalendarDates() {
|
|
129
|
+
this._min = this.min ? y(this.min) : void 0, this._max = this.max ? y(this.max) : void 0, this._value = this.value ? y(this.value) : void 0;
|
|
130
|
+
const e = "AD";
|
|
131
|
+
this._min = this._min && b(this._min).set({ era: e }), this._max = this._max && b(this._max).set({ era: e }), this._value = this._value && b(this._value).set({ era: e });
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Validates the component's date properties (min, max and value) compliance with one another.
|
|
135
|
+
* If the [min, max] constraint interval is invalid, both properties are reset.
|
|
136
|
+
* If the value is not within the [min, max] (valid) interval, it is reset.
|
|
137
|
+
*
|
|
138
|
+
* @param checkInterval - Whether to check the [min, max] interval
|
|
139
|
+
*/
|
|
140
|
+
checkDatePropsCompliance(e) {
|
|
141
|
+
e && this._min && this._max && (this._min.compare(this._max) < 0 || (console.warn && console.warn(
|
|
142
|
+
this,
|
|
143
|
+
`<${this.localName}> expects the 'min' to be less than 'max'. Please ensure that 'min' property's date is earlier than 'max' property's date.`
|
|
144
|
+
), this._min = void 0, this._max = void 0)), this._value && this.isNonCompliantDate(this._value) && (console.warn && console.warn(
|
|
145
|
+
this,
|
|
146
|
+
`<${this.localName}> expects the preselected value to comply with the min and max constraints. Please ensure that 'value' property's date is in between the dates for the 'min' and 'max' properties.`
|
|
147
|
+
), this._value = void 0);
|
|
148
|
+
}
|
|
149
|
+
updateCurrentDate() {
|
|
150
|
+
if (this._value) {
|
|
151
|
+
this.currentDate = this._value;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
this.isNonCompliantDate(this.today) ? this._min ? this.currentDate = this._min : this._max && (this.currentDate = this._max) : this.currentDate = this.today;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Whether the date is non-compliant with the min and max constraints
|
|
158
|
+
*/
|
|
159
|
+
isNonCompliantDate(e) {
|
|
160
|
+
return !!(this._min && e.compare(this._min) < 0 || this._max && e.compare(this._max) > 0);
|
|
161
|
+
}
|
|
162
|
+
render() {
|
|
163
|
+
return i` ${this.renderCalendarHeader()}${this.renderCalendarGrid()} `;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* The month and year of the calendar
|
|
167
|
+
* @internal
|
|
168
|
+
*/
|
|
169
|
+
get monthAndYear() {
|
|
170
|
+
return this.formatDate(this.currentDate, {
|
|
171
|
+
month: "long",
|
|
172
|
+
year: "numeric"
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
renderCalendarHeader() {
|
|
176
|
+
return i`
|
|
177
|
+
<div class="header" @focusin=${this.resetDateFocusIntent}>
|
|
178
|
+
<h2
|
|
179
|
+
class="title"
|
|
180
|
+
aria-live="polite"
|
|
181
|
+
aria-atomic="true"
|
|
182
|
+
data-test-id="calendar-title"
|
|
183
|
+
>
|
|
184
|
+
${this.monthAndYear}
|
|
185
|
+
</h2>
|
|
186
|
+
|
|
187
|
+
<luzmo-action-button
|
|
188
|
+
quiet
|
|
189
|
+
size="s"
|
|
190
|
+
label=${this.labels.previous}
|
|
191
|
+
class="prevMonth"
|
|
192
|
+
data-test-id="prev-btn"
|
|
193
|
+
?disabled=${this.isPreviousMonthDisabled}
|
|
194
|
+
@click=${this.handlePreviousMonth}
|
|
195
|
+
>
|
|
196
|
+
<div slot="icon">
|
|
197
|
+
<slot name="prev-icon">
|
|
198
|
+
<luzmo-icon
|
|
199
|
+
block
|
|
200
|
+
.size=${this.size}
|
|
201
|
+
.icon=${N}
|
|
202
|
+
></luzmo-icon>
|
|
203
|
+
</slot>
|
|
204
|
+
</div>
|
|
205
|
+
</luzmo-action-button>
|
|
206
|
+
|
|
207
|
+
<luzmo-action-button
|
|
208
|
+
quiet
|
|
209
|
+
size="s"
|
|
210
|
+
label=${this.labels.next}
|
|
211
|
+
class="nextMonth"
|
|
212
|
+
data-test-id="next-btn"
|
|
213
|
+
?disabled=${this.isNextMonthDisabled}
|
|
214
|
+
@click=${this.handleNextMonth}
|
|
215
|
+
>
|
|
216
|
+
<div slot="icon">
|
|
217
|
+
<slot name="next-icon">
|
|
218
|
+
<luzmo-icon
|
|
219
|
+
block
|
|
220
|
+
.size=${this.size}
|
|
221
|
+
.icon=${B}
|
|
222
|
+
></luzmo-icon>
|
|
223
|
+
</slot>
|
|
224
|
+
</div>
|
|
225
|
+
</luzmo-action-button>
|
|
226
|
+
</div>
|
|
227
|
+
`;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Whether the previous month is disabled
|
|
231
|
+
* @internal
|
|
232
|
+
*/
|
|
233
|
+
get isPreviousMonthDisabled() {
|
|
234
|
+
if (this.disabled) return !0;
|
|
235
|
+
const e = g(this.currentDate), a = e.subtract({ months: 1 });
|
|
236
|
+
return e.era !== a.era || u(e, a);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Whether the next month is disabled
|
|
240
|
+
* @internal
|
|
241
|
+
*/
|
|
242
|
+
get isNextMonthDisabled() {
|
|
243
|
+
if (this.disabled) return !0;
|
|
244
|
+
const e = M(this.currentDate), a = e.add({ months: 1 });
|
|
245
|
+
return e.era !== a.era || u(e, a);
|
|
246
|
+
}
|
|
247
|
+
handlePreviousMonth() {
|
|
248
|
+
let e = g(this.currentDate).subtract({
|
|
249
|
+
months: 1
|
|
250
|
+
});
|
|
251
|
+
this._value && c(e, this._value) ? e = this._value : c(e, this.today) && (e = this.today), this.currentDate = e;
|
|
252
|
+
}
|
|
253
|
+
handleNextMonth() {
|
|
254
|
+
let e = g(this.currentDate).add({
|
|
255
|
+
months: 1
|
|
256
|
+
});
|
|
257
|
+
this._value && c(e, this._value) ? e = this._value : c(e, this.today) && (e = this.today), this.currentDate = e;
|
|
258
|
+
}
|
|
259
|
+
renderCalendarGrid() {
|
|
260
|
+
return i`
|
|
261
|
+
<table
|
|
262
|
+
role="grid"
|
|
263
|
+
aria-readonly="true"
|
|
264
|
+
aria-disabled=${this.disabled}
|
|
265
|
+
role="presentation"
|
|
266
|
+
class="table body"
|
|
267
|
+
@keydown=${this.handleKeydown}
|
|
268
|
+
>
|
|
269
|
+
${this.renderCalendarTableHead()} ${this.renderCalendarTableBody()}
|
|
270
|
+
</table>
|
|
271
|
+
`;
|
|
272
|
+
}
|
|
273
|
+
renderCalendarTableHead() {
|
|
274
|
+
return i`
|
|
275
|
+
<thead role="presentation">
|
|
276
|
+
<tr role="row">
|
|
277
|
+
${this.renderWeekdayColumns()}
|
|
278
|
+
</tr>
|
|
279
|
+
</thead>
|
|
280
|
+
`;
|
|
281
|
+
}
|
|
282
|
+
renderWeekdayColumns() {
|
|
283
|
+
return this.weekdays.map((e) => this.renderWeekdayColumn(e));
|
|
284
|
+
}
|
|
285
|
+
renderWeekdayColumn(e) {
|
|
286
|
+
return i`
|
|
287
|
+
<th role="columnheader" scope="col" class="table-cell">
|
|
288
|
+
<abbr class="dayOfWeek" title=${e.long}> ${e.narrow} </abbr>
|
|
289
|
+
</th>
|
|
290
|
+
`;
|
|
291
|
+
}
|
|
292
|
+
renderCalendarTableBody() {
|
|
293
|
+
return i`
|
|
294
|
+
<tbody role="presentation">
|
|
295
|
+
${this.renderCalendarWeeks()}
|
|
296
|
+
</tbody>
|
|
297
|
+
`;
|
|
298
|
+
}
|
|
299
|
+
renderCalendarWeeks() {
|
|
300
|
+
return this.currentMonthDates.map(
|
|
301
|
+
(e) => i`
|
|
302
|
+
<tr role="row">
|
|
303
|
+
${this.renderDatesInWeek(e)}
|
|
304
|
+
</tr>
|
|
305
|
+
`
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
renderDatesInWeek(e) {
|
|
309
|
+
return e.map((a) => this.renderCalendarTableCell(a));
|
|
310
|
+
}
|
|
311
|
+
parseDateCellProperties(e) {
|
|
312
|
+
const a = {
|
|
313
|
+
isOutsideMonth: !1,
|
|
314
|
+
isSelected: !1,
|
|
315
|
+
isToday: !1,
|
|
316
|
+
isDisabled: !1,
|
|
317
|
+
isTabbable: !1
|
|
318
|
+
};
|
|
319
|
+
return a.isOutsideMonth = e.month !== this.currentDate.month, a.isOutsideMonth || (a.isDisabled = this.disabled || this.isMinLimitReached(e) || this.isMaxLimitReached(e), a.isToday = u(e, this.today), a.isDisabled) || (a.isTabbable = u(e, this.currentDate), a.isSelected = !!(this._value && u(this._value, e))), a;
|
|
320
|
+
}
|
|
321
|
+
renderCalendarTableCell(e) {
|
|
322
|
+
const { isOutsideMonth: a, isSelected: t, isToday: r, isDisabled: n, isTabbable: d } = this.parseDateCellProperties(e), z = {
|
|
323
|
+
date: !0,
|
|
324
|
+
"is-outsideMonth": a,
|
|
325
|
+
"is-selected": t,
|
|
326
|
+
"is-today": r,
|
|
327
|
+
"is-disabled": n
|
|
328
|
+
};
|
|
329
|
+
let v = "";
|
|
330
|
+
r ? v = `${this.labels.today}, ` : t && (v = `${this.labels.selected}, `);
|
|
331
|
+
const w = v + this.formatDate(e, {
|
|
332
|
+
weekday: "long",
|
|
333
|
+
year: "numeric",
|
|
334
|
+
month: "long",
|
|
335
|
+
day: "numeric"
|
|
336
|
+
});
|
|
337
|
+
return i`
|
|
338
|
+
<td role="gridcell" class="table-cell">
|
|
339
|
+
<span
|
|
340
|
+
role="button"
|
|
341
|
+
tabindex=${$(
|
|
342
|
+
a ? void 0 : d ? "0" : "-1"
|
|
343
|
+
)}
|
|
344
|
+
aria-label=${w}
|
|
345
|
+
aria-disabled=${a || n}
|
|
346
|
+
data-value=${e.toString()}
|
|
347
|
+
@mousedown=${this.handleDaySelect}
|
|
348
|
+
>
|
|
349
|
+
<span role="presentation" class=${F(z)}>
|
|
350
|
+
${this.formatNumber(e.day)}
|
|
351
|
+
</span>
|
|
352
|
+
</span>
|
|
353
|
+
</td>
|
|
354
|
+
`;
|
|
355
|
+
}
|
|
356
|
+
handleKeydown(e) {
|
|
357
|
+
switch (this.setDateFocusIntent(), e.code) {
|
|
358
|
+
case "ArrowLeft": {
|
|
359
|
+
this.moveToPreviousDay();
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
case "ArrowDown": {
|
|
363
|
+
this.moveToNextWeek();
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
case "ArrowRight": {
|
|
367
|
+
this.moveToNextDay();
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
case "ArrowUp": {
|
|
371
|
+
this.moveToPreviousWeek();
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
case "Space":
|
|
375
|
+
case "Enter": {
|
|
376
|
+
this.handleDaySelect(e);
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
handleDaySelect(e) {
|
|
382
|
+
if (this.disabled) {
|
|
383
|
+
e.preventDefault();
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
const a = e.target.closest(
|
|
387
|
+
'span[role="button"]'
|
|
388
|
+
), t = a && a.dataset.value;
|
|
389
|
+
if (!t) return;
|
|
390
|
+
const r = y(t);
|
|
391
|
+
if (this._value && u(this._value, r) || this.isMinLimitReached(r) || this.isMaxLimitReached(r)) {
|
|
392
|
+
e.preventDefault();
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
this._value = r, this.value = r.toString(), this.dispatchEvent(
|
|
396
|
+
new CustomEvent("change", {
|
|
397
|
+
bubbles: !0,
|
|
398
|
+
composed: !0,
|
|
399
|
+
cancelable: !0,
|
|
400
|
+
detail: {
|
|
401
|
+
value: this.value
|
|
402
|
+
}
|
|
403
|
+
})
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
moveToPreviousDay() {
|
|
407
|
+
const e = this.currentDate.subtract({ days: 1 });
|
|
408
|
+
this.canMoveBackToDate(e) && (this.currentDate = e);
|
|
409
|
+
}
|
|
410
|
+
moveToNextDay() {
|
|
411
|
+
const e = this.currentDate.add({ days: 1 });
|
|
412
|
+
this.canMoveForwardToDate(e) && (this.currentDate = e);
|
|
413
|
+
}
|
|
414
|
+
moveToPreviousWeek() {
|
|
415
|
+
const e = this.currentDate.subtract({ weeks: 1 });
|
|
416
|
+
if (this.canMoveBackToDate(e)) {
|
|
417
|
+
this.currentDate = e;
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
let a = e.add({ days: 1 });
|
|
421
|
+
for (; !this.canMoveBackToDate(a); )
|
|
422
|
+
a = a.add({ days: 1 });
|
|
423
|
+
this.currentDate = a;
|
|
424
|
+
}
|
|
425
|
+
moveToNextWeek() {
|
|
426
|
+
const e = this.currentDate.add({ weeks: 1 });
|
|
427
|
+
if (this.canMoveForwardToDate(e)) {
|
|
428
|
+
this.currentDate = e;
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
let a = e.subtract({ days: 1 });
|
|
432
|
+
for (; !this.canMoveForwardToDate(a); )
|
|
433
|
+
a = a.subtract({ days: 1 });
|
|
434
|
+
this.currentDate = a;
|
|
435
|
+
}
|
|
436
|
+
canMoveBackToDate(e) {
|
|
437
|
+
return this.isMinLimitReached(e) ? !1 : c(this.currentDate, e) || !this.isPreviousMonthDisabled;
|
|
438
|
+
}
|
|
439
|
+
canMoveForwardToDate(e) {
|
|
440
|
+
return this.isMaxLimitReached(e) ? !1 : c(this.currentDate, e) || !this.isNextMonthDisabled;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Defines the array with data for the days of the week, starting on the first day of the week according to the
|
|
444
|
+
* defined location (Sunday, Monday, etc.)
|
|
445
|
+
*/
|
|
446
|
+
setWeekdays() {
|
|
447
|
+
const e = f(this.currentDate, this._language);
|
|
448
|
+
this.weekdays = [...Array.from({ length: x }).keys()].map(
|
|
449
|
+
(a) => {
|
|
450
|
+
const t = e.add({ days: a });
|
|
451
|
+
return {
|
|
452
|
+
narrow: this.formatDate(t, { weekday: "narrow" }),
|
|
453
|
+
long: this.formatDate(t, { weekday: "long" })
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Defines the 2D-array with the dates of the current month
|
|
460
|
+
*/
|
|
461
|
+
setCurrentMonthDates() {
|
|
462
|
+
const e = C(this.currentDate, this._language), a = Array.from({
|
|
463
|
+
length: e
|
|
464
|
+
});
|
|
465
|
+
for (const t of Array.from({ length: e }).keys())
|
|
466
|
+
a[t] = this.getDatesInWeek(
|
|
467
|
+
this.currentDate,
|
|
468
|
+
t
|
|
469
|
+
);
|
|
470
|
+
this.currentMonthDates = a;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Returns an array with all days of the week in a specific month, corresponding to the given index,
|
|
474
|
+
* starting with the first day of the week according to the language
|
|
475
|
+
*
|
|
476
|
+
* @param weekIndex - The index of the week
|
|
477
|
+
*/
|
|
478
|
+
getDatesInWeek(e, a) {
|
|
479
|
+
const t = [];
|
|
480
|
+
let r = f(
|
|
481
|
+
g(e).add({
|
|
482
|
+
weeks: a
|
|
483
|
+
}),
|
|
484
|
+
this._language
|
|
485
|
+
);
|
|
486
|
+
for (; t.length < x; ) {
|
|
487
|
+
t.push(r);
|
|
488
|
+
const n = r.add({ days: 1 });
|
|
489
|
+
if (u(r, n)) break;
|
|
490
|
+
r = n;
|
|
491
|
+
}
|
|
492
|
+
return t;
|
|
493
|
+
}
|
|
494
|
+
isMinLimitReached(e) {
|
|
495
|
+
return !!(this._min && e.compare(this._min) < 0);
|
|
496
|
+
}
|
|
497
|
+
isMaxLimitReached(e) {
|
|
498
|
+
return !!(this._max && e.compare(this._max) > 0);
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Formats a `CalendarDate` object using the current language and the provided date format options
|
|
502
|
+
*
|
|
503
|
+
* @param calendarDate - The `CalendarDate` object that will be formatted
|
|
504
|
+
* @param options - All date format options that will be used by the formatter
|
|
505
|
+
*/
|
|
506
|
+
formatDate(e, a) {
|
|
507
|
+
return new T(this._language, a).format(
|
|
508
|
+
e.toDate(this.timeZone)
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
setNumberFormatter() {
|
|
512
|
+
this.numberFormatter = new p(this._language);
|
|
513
|
+
}
|
|
514
|
+
formatNumber(e) {
|
|
515
|
+
return this.numberFormatter.format(e);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
l([
|
|
519
|
+
m({ type: String })
|
|
520
|
+
], o.prototype, "value", 2);
|
|
521
|
+
l([
|
|
522
|
+
m({ type: String })
|
|
523
|
+
], o.prototype, "min", 2);
|
|
524
|
+
l([
|
|
525
|
+
m({ type: String })
|
|
526
|
+
], o.prototype, "max", 2);
|
|
527
|
+
l([
|
|
528
|
+
m({ type: Boolean, reflect: !0 })
|
|
529
|
+
], o.prototype, "disabled", 2);
|
|
530
|
+
l([
|
|
531
|
+
m({ type: String, reflect: !0 })
|
|
532
|
+
], o.prototype, "language", 2);
|
|
533
|
+
l([
|
|
534
|
+
m({ type: Object })
|
|
535
|
+
], o.prototype, "labels", 2);
|
|
536
|
+
l([
|
|
537
|
+
h()
|
|
538
|
+
], o.prototype, "currentDate", 2);
|
|
539
|
+
l([
|
|
540
|
+
h()
|
|
541
|
+
], o.prototype, "_value", 2);
|
|
542
|
+
l([
|
|
543
|
+
h()
|
|
544
|
+
], o.prototype, "_min", 2);
|
|
545
|
+
l([
|
|
546
|
+
h()
|
|
547
|
+
], o.prototype, "_max", 2);
|
|
548
|
+
l([
|
|
549
|
+
h()
|
|
550
|
+
], o.prototype, "weekdays", 2);
|
|
551
|
+
l([
|
|
552
|
+
h()
|
|
553
|
+
], o.prototype, "currentMonthDates", 2);
|
|
554
|
+
l([
|
|
555
|
+
h()
|
|
556
|
+
], o.prototype, "isDateFocusIntent", 1);
|
|
557
|
+
customElements.get("luzmo-calendar") || customElements.define("luzmo-calendar", o);
|
|
26
558
|
export {
|
|
27
|
-
|
|
559
|
+
o as LuzmoCalendar
|
|
28
560
|
};
|