@skf-design-system/ui-components 1.0.1-beta.1 → 1.0.2-beta.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/README.md +13 -26
- package/dist/components/accordion/accordion-item.component.d.ts +36 -0
- package/dist/components/accordion/accordion-item.component.js +87 -0
- package/dist/components/accordion/accordion-item.d.ts +3 -3
- package/dist/components/accordion/accordion-item.js +4 -5
- package/dist/components/accordion/accordion-item.styles.js +77 -0
- package/dist/components/accordion/accordion.component.d.ts +9 -13
- package/dist/components/accordion/accordion.component.js +12 -13
- package/dist/components/accordion/accordion.d.ts +0 -1
- package/dist/components/accordion/accordion.js +0 -2
- package/dist/components/alert/alert.component.d.ts +6 -10
- package/dist/components/alert/alert.component.js +15 -16
- package/dist/components/alert/alert.styles.js +0 -5
- package/dist/components/breadcrumb/breadcrumb-item.component.js +61 -0
- package/dist/components/breadcrumb/breadcrumb-item.js +6 -0
- package/dist/components/breadcrumb/breadcrumb-item.styles.js +62 -0
- package/dist/components/breadcrumb/breadcrumb.component.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb.component.js +60 -0
- package/dist/components/breadcrumb/breadcrumb.js +6 -0
- package/dist/components/breadcrumb/breadcrumb.styles.js +22 -0
- package/dist/components/button/button.component.d.ts +13 -10
- package/dist/components/button/button.component.js +83 -76
- package/dist/components/button/button.styles.d.ts +1 -2
- package/dist/components/button/button.styles.js +1 -1
- package/dist/components/card/card.component.d.ts +1 -1
- package/dist/components/card/card.component.js +18 -30
- package/dist/components/card/card.styles.js +25 -28
- package/dist/components/checkbox/checkbox.component.d.ts +16 -14
- package/dist/components/checkbox/checkbox.component.js +5 -5
- package/dist/components/checkbox/checkbox.styles.d.ts +1 -2
- package/dist/components/checkbox/checkbox.styles.js +1 -5
- package/dist/components/date-picker/datepicker.calendar.component.d.ts +5 -0
- package/dist/components/date-picker/datepicker.calendar.component.js +128 -95
- package/dist/components/date-picker/datepicker.calendar.styles.js +35 -25
- package/dist/components/date-picker/datepicker.component.d.ts +5 -0
- package/dist/components/date-picker/datepicker.component.js +117 -97
- package/dist/components/date-picker/datepicker.helpers.d.ts +3 -2
- package/dist/components/date-picker/datepicker.helpers.js +46 -39
- package/dist/components/date-picker/datepicker.styles.js +14 -26
- package/dist/components/date-picker-input/datepicker-input.component.d.ts +14 -5
- package/dist/components/date-picker-input/datepicker-input.component.js +264 -219
- package/dist/components/date-picker-input/datepicker-input.helpers.d.ts +36 -2
- package/dist/components/date-picker-input/datepicker-input.helpers.js +25 -23
- package/dist/components/date-picker-input/datepicker-input.styles.js +6 -10
- package/dist/components/dialog/dialog.component.d.ts +20 -29
- package/dist/components/dialog/dialog.component.js +85 -75
- package/dist/components/dialog/dialog.styles.js +4 -4
- package/dist/components/divider/divider.component.d.ts +4 -8
- package/dist/components/divider/divider.component.js +24 -46
- package/dist/components/divider/divider.styles.js +34 -30
- package/dist/components/drawer/drawer.component.d.ts +61 -0
- package/dist/components/drawer/drawer.component.js +125 -0
- package/dist/components/drawer/drawer.d.ts +8 -0
- package/dist/components/drawer/drawer.js +6 -0
- package/dist/components/drawer/drawer.styles.js +71 -0
- package/dist/components/header/header.component.d.ts +46 -0
- package/dist/components/header/header.component.js +116 -0
- package/dist/components/header/header.d.ts +8 -0
- package/dist/components/header/header.js +6 -0
- package/dist/components/header/header.styles.js +68 -0
- package/dist/components/heading/heading.component.d.ts +3 -11
- package/dist/components/heading/heading.component.js +24 -23
- package/dist/components/heading/heading.styles.d.ts +1 -2
- package/dist/components/heading/heading.styles.js +1 -1
- package/dist/components/icon/icon.component.d.ts +11 -17
- package/dist/components/icon/icon.component.js +2 -2
- package/dist/components/icon/icon.styles.d.ts +1 -2
- package/dist/components/icon/icon.styles.js +1 -1
- package/dist/components/input/input.component.d.ts +30 -31
- package/dist/components/input/input.component.js +138 -125
- package/dist/components/input/input.controllers.d.ts +20 -6
- package/dist/components/input/input.controllers.js +14 -10
- package/dist/components/link/link.component.d.ts +12 -14
- package/dist/components/link/link.component.js +35 -34
- package/dist/components/link/link.styles.d.ts +1 -2
- package/dist/components/link/link.styles.js +24 -20
- package/dist/components/loader/loader.component.d.ts +1 -1
- package/dist/components/loader/loader.component.js +36 -40
- package/dist/components/loader/loader.styles.d.ts +1 -2
- package/dist/components/loader/loader.styles.js +40 -32
- package/dist/components/logo/logo.component.d.ts +4 -5
- package/dist/components/logo/logo.component.js +1 -1
- package/dist/components/menu/menu-item.component.d.ts +13 -0
- package/dist/components/{menu-item → menu}/menu-item.component.js +3 -3
- package/dist/components/menu/menu.component.d.ts +10 -8
- package/dist/components/menu/menu.component.js +8 -10
- package/dist/components/nav/nav-item.component.d.ts +18 -0
- package/dist/components/nav/nav-item.component.js +38 -0
- package/dist/components/nav/nav-item.d.ts +8 -0
- package/dist/components/nav/nav-item.js +6 -0
- package/dist/components/nav/nav-item.styles.js +39 -0
- package/dist/components/nav/nav.component.d.ts +17 -0
- package/dist/components/nav/nav.component.js +34 -0
- package/dist/components/nav/nav.d.ts +8 -0
- package/dist/components/nav/nav.js +6 -0
- package/dist/components/nav/nav.styles.d.ts +1 -0
- package/dist/components/nav/nav.styles.js +17 -0
- package/dist/components/popover/popover.component.d.ts +11 -8
- package/dist/components/popover/popover.component.js +24 -26
- package/dist/components/progress/progress.component.d.ts +2 -2
- package/dist/components/progress/progress.component.js +31 -37
- package/dist/components/progress/progress.styles.js +40 -35
- package/dist/components/radio/radio.component.d.ts +19 -13
- package/dist/components/radio/radio.component.js +12 -12
- package/dist/components/radio/radio.styles.d.ts +1 -2
- package/dist/components/radio/radio.styles.js +1 -1
- package/dist/components/segmented-button/segmented-button-item.component.d.ts +36 -0
- package/dist/components/segmented-button/segmented-button-item.component.js +56 -0
- package/dist/components/segmented-button/segmented-button-item.d.ts +8 -0
- package/dist/components/segmented-button/segmented-button-item.js +6 -0
- package/dist/components/segmented-button/segmented-button-item.styles.d.ts +1 -0
- package/dist/components/segmented-button/segmented-button-item.styles.js +62 -0
- package/dist/components/segmented-button/segmented-button.component.d.ts +30 -0
- package/dist/components/segmented-button/segmented-button.component.js +73 -0
- package/dist/components/segmented-button/segmented-button.d.ts +8 -0
- package/dist/components/segmented-button/segmented-button.js +6 -0
- package/dist/components/segmented-button/segmented-button.styles.d.ts +1 -0
- package/dist/components/segmented-button/segmented-button.styles.js +16 -0
- package/dist/components/{select-option-group → select}/select-option-group.component.js +1 -1
- package/dist/components/select/select-option-group.style.d.ts +1 -0
- package/dist/components/{select-option → select}/select-option.component.d.ts +7 -8
- package/dist/components/{select-option → select}/select-option.component.js +15 -15
- package/dist/components/select/select-option.controllers.d.ts +15 -0
- package/dist/components/select/select-option.styles.d.ts +1 -0
- package/dist/components/select/select.component.d.ts +16 -15
- package/dist/components/select/select.component.js +19 -19
- package/dist/components/select/select.controllers.d.ts +21 -10
- package/dist/components/select/select.controllers.js +31 -23
- package/dist/components/select/select.stories.icons.d.ts +7 -0
- package/dist/components/{stepper-item → stepper}/stepper-item.component.js +8 -8
- package/dist/components/stepper/stepper-item.styles.d.ts +1 -0
- package/dist/components/stepper/stepper.component.d.ts +4 -3
- package/dist/components/stepper/stepper.component.js +15 -15
- package/dist/components/stepper/stepper.helpers.d.ts +1 -1
- package/dist/components/switch/switch.component.d.ts +7 -6
- package/dist/components/switch/switch.component.js +21 -21
- package/dist/components/tab/tab.component.js +1 -1
- package/dist/components/tab-group/tab-group.component.js +1 -1
- package/dist/components/tab-panel/tab-panel.component.js +1 -1
- package/dist/components/tag/tag.component.d.ts +14 -16
- package/dist/components/tag/tag.component.js +36 -39
- package/dist/components/textarea/textarea.component.d.ts +10 -11
- package/dist/components/textarea/textarea.component.js +65 -67
- package/dist/components/{toast-item → toast}/toast-item.d.ts +2 -0
- package/dist/components/{toast-item → toast}/toast-item.js +4 -0
- package/dist/components/{toast-wrapper → toast}/toast-wrapper.component.js +1 -1
- package/dist/components/toast/toast-wrapper.styles.d.ts +1 -0
- package/dist/components/toast/toast.component.d.ts +6 -5
- package/dist/components/toast/toast.component.js +15 -15
- package/dist/components/toast/toast.singleton.d.ts +4 -4
- package/dist/components/toast/toast.singleton.js +12 -12
- package/dist/components/tooltip/tooltip.component.d.ts +7 -7
- package/dist/components/tooltip/tooltip.component.js +16 -11
- package/dist/custom-elements.json +2718 -2073
- package/dist/index.d.ts +16 -6
- package/dist/index.js +103 -75
- package/dist/internal/base-classes/popover/popover.base.d.ts +24 -9
- package/dist/internal/base-classes/popover/popover.base.js +138 -77
- package/dist/internal/base-classes/popover/popover.styles.js +14 -1
- package/dist/internal/components/hint/hint.component.d.ts +2 -2
- package/dist/internal/components/hint/hint.component.js +2 -2
- package/dist/internal/components/hint/hint.styles.d.ts +1 -2
- package/dist/internal/components/hint/hint.styles.js +1 -1
- package/dist/internal/constants/iconSeverity.d.ts +3 -2
- package/dist/internal/constants/iconSeverity.js +2 -3
- package/dist/internal/controllers/elementOverflowController.d.ts +13 -0
- package/dist/internal/controllers/popover.controller.d.ts +12 -7
- package/dist/internal/controllers/popover.controller.js +9 -14
- package/dist/internal/helpers/hintSeverity.d.ts +2 -2
- package/dist/internal/helpers/hintSeverity.js +1 -1
- package/dist/internal/helpers/utilityTypes.d.ts +1 -1
- package/dist/internal/helpers/uuid.d.ts +15 -0
- package/dist/internal/helpers/uuid.js +14 -0
- package/dist/internal/storybook/styles.d.ts +1 -0
- package/dist/internal/types/formField.d.ts +1 -1
- package/dist/internal/types.d.ts +18 -0
- package/dist/styles/component.styles.d.ts +1 -2
- package/dist/styles/component.styles.js +1 -1
- package/dist/styles/form-field.styles.js +11 -6
- package/dist/styles/global.css +1 -1
- package/dist/types/jsx/custom-element-jsx.d.ts +673 -1310
- package/dist/types/vue/index.d.ts +456 -319
- package/dist/vscode.html-custom-data.json +402 -1080
- package/dist/web-types.json +986 -767
- package/package.json +44 -55
- package/dist/components/collapse/collapse.component.d.ts +0 -40
- package/dist/components/collapse/collapse.component.js +0 -86
- package/dist/components/collapse/collapse.d.ts +0 -8
- package/dist/components/collapse/collapse.js +0 -6
- package/dist/components/collapse/collapse.styles.d.ts +0 -2
- package/dist/components/collapse/collapse.styles.js +0 -77
- package/dist/components/menu-item/menu-item.component.d.ts +0 -25
- package/dist/components/select-option/select-option.controllers.d.ts +0 -9
- package/dist/internal/constants/heading.d.ts +0 -2
- package/dist/react/index.d.ts +0 -36
- package/dist/react/index.js +0 -36
- package/dist/react/skf-accordion/index.d.ts +0 -3
- package/dist/react/skf-accordion/index.js +0 -13
- package/dist/react/skf-alert/index.d.ts +0 -9
- package/dist/react/skf-alert/index.js +0 -17
- package/dist/react/skf-breadcrumb/index.d.ts +0 -9
- package/dist/react/skf-breadcrumb/index.js +0 -17
- package/dist/react/skf-breadcrumb-item/index.d.ts +0 -3
- package/dist/react/skf-breadcrumb-item/index.js +0 -13
- package/dist/react/skf-button/index.d.ts +0 -9
- package/dist/react/skf-button/index.js +0 -17
- package/dist/react/skf-card/index.d.ts +0 -3
- package/dist/react/skf-card/index.js +0 -13
- package/dist/react/skf-checkbox/index.d.ts +0 -9
- package/dist/react/skf-checkbox/index.js +0 -17
- package/dist/react/skf-collapse/index.d.ts +0 -9
- package/dist/react/skf-collapse/index.js +0 -17
- package/dist/react/skf-datepicker/index.d.ts +0 -12
- package/dist/react/skf-datepicker/index.js +0 -18
- package/dist/react/skf-dialog/index.d.ts +0 -15
- package/dist/react/skf-dialog/index.js +0 -19
- package/dist/react/skf-divider/index.d.ts +0 -3
- package/dist/react/skf-divider/index.js +0 -13
- package/dist/react/skf-heading/index.d.ts +0 -3
- package/dist/react/skf-heading/index.js +0 -13
- package/dist/react/skf-icon/index.d.ts +0 -3
- package/dist/react/skf-icon/index.js +0 -13
- package/dist/react/skf-input/index.d.ts +0 -12
- package/dist/react/skf-input/index.js +0 -18
- package/dist/react/skf-link/index.d.ts +0 -3
- package/dist/react/skf-link/index.js +0 -13
- package/dist/react/skf-loader/index.d.ts +0 -3
- package/dist/react/skf-loader/index.js +0 -13
- package/dist/react/skf-logo/index.d.ts +0 -3
- package/dist/react/skf-logo/index.js +0 -13
- package/dist/react/skf-menu/index.d.ts +0 -12
- package/dist/react/skf-menu/index.js +0 -18
- package/dist/react/skf-menu-item/index.d.ts +0 -27
- package/dist/react/skf-menu-item/index.js +0 -23
- package/dist/react/skf-popover/index.d.ts +0 -12
- package/dist/react/skf-popover/index.js +0 -18
- package/dist/react/skf-progress/index.d.ts +0 -3
- package/dist/react/skf-progress/index.js +0 -13
- package/dist/react/skf-radio/index.d.ts +0 -9
- package/dist/react/skf-radio/index.js +0 -17
- package/dist/react/skf-select/index.d.ts +0 -21
- package/dist/react/skf-select/index.js +0 -21
- package/dist/react/skf-select-option/index.d.ts +0 -9
- package/dist/react/skf-select-option/index.js +0 -17
- package/dist/react/skf-select-option-group/index.d.ts +0 -3
- package/dist/react/skf-select-option-group/index.js +0 -13
- package/dist/react/skf-stepper/index.d.ts +0 -9
- package/dist/react/skf-stepper/index.js +0 -17
- package/dist/react/skf-stepper-item/index.d.ts +0 -9
- package/dist/react/skf-stepper-item/index.js +0 -17
- package/dist/react/skf-switch/index.d.ts +0 -3
- package/dist/react/skf-switch/index.js +0 -13
- package/dist/react/skf-tab/index.d.ts +0 -12
- package/dist/react/skf-tab/index.js +0 -18
- package/dist/react/skf-tab-group/index.d.ts +0 -3
- package/dist/react/skf-tab-group/index.js +0 -13
- package/dist/react/skf-tab-panel/index.d.ts +0 -3
- package/dist/react/skf-tab-panel/index.js +0 -13
- package/dist/react/skf-tag/index.d.ts +0 -3
- package/dist/react/skf-tag/index.js +0 -13
- package/dist/react/skf-textarea/index.d.ts +0 -12
- package/dist/react/skf-textarea/index.js +0 -18
- package/dist/react/skf-toast/index.d.ts +0 -3
- package/dist/react/skf-toast/index.js +0 -13
- package/dist/react/skf-toast-wrapper/index.d.ts +0 -3
- package/dist/react/skf-toast-wrapper/index.js +0 -13
- package/dist/react/skf-tooltip/index.d.ts +0 -12
- package/dist/react/skf-tooltip/index.js +0 -18
- /package/dist/components/{breadcrumb-item/breadcrumb-item.styles.d.ts → accordion/accordion-item.styles.d.ts} +0 -0
- /package/dist/components/{collapse/collapse.test.d.ts → accordion/accordion-item.test.d.ts} +0 -0
- /package/dist/components/{breadcrumb-item → breadcrumb}/breadcrumb-item.component.d.ts +0 -0
- /package/dist/components/{breadcrumb-item → breadcrumb}/breadcrumb-item.d.ts +0 -0
- /package/dist/components/{menu-item/menu-item.styles.d.ts → breadcrumb/breadcrumb-item.styles.d.ts} +0 -0
- /package/dist/components/{select-option-group/select-option-group.style.d.ts → drawer/drawer.styles.d.ts} +0 -0
- /package/dist/components/{select-option/select-option.styles.d.ts → header/header.styles.d.ts} +0 -0
- /package/dist/components/{menu-item → menu}/menu-item.d.ts +0 -0
- /package/dist/components/{menu-item → menu}/menu-item.js +0 -0
- /package/dist/components/{stepper-item/stepper-item.styles.d.ts → menu/menu-item.styles.d.ts} +0 -0
- /package/dist/components/{menu-item → menu}/menu-item.styles.js +0 -0
- /package/dist/components/{toast-wrapper/toast-wrapper.styles.d.ts → nav/nav-item.styles.d.ts} +0 -0
- /package/dist/components/{select-option-group → select}/select-option-group.component.d.ts +0 -0
- /package/dist/components/{select-option-group → select}/select-option-group.d.ts +0 -0
- /package/dist/components/{select-option-group → select}/select-option-group.js +0 -0
- /package/dist/components/{select-option-group → select}/select-option-group.style.js +0 -0
- /package/dist/components/{select-option → select}/select-option.d.ts +0 -0
- /package/dist/components/{select-option → select}/select-option.js +0 -0
- /package/dist/components/{select-option → select}/select-option.styles.js +0 -0
- /package/dist/components/{stepper-item → stepper}/stepper-item.component.d.ts +0 -0
- /package/dist/components/{stepper-item → stepper}/stepper-item.d.ts +0 -0
- /package/dist/components/{stepper-item → stepper}/stepper-item.js +0 -0
- /package/dist/components/{stepper-item → stepper}/stepper-item.styles.js +0 -0
- /package/dist/components/{toast-item → toast}/toast-item.component.d.ts +0 -0
- /package/dist/components/{toast-item → toast}/toast-item.component.js +0 -0
- /package/dist/components/{toast-item → toast}/toast-item.styles.d.ts +0 -0
- /package/dist/components/{toast-item → toast}/toast-item.styles.js +0 -0
- /package/dist/components/{toast-wrapper → toast}/toast-wrapper.component.d.ts +0 -0
- /package/dist/components/{toast-wrapper → toast}/toast-wrapper.d.ts +0 -0
- /package/dist/components/{toast-wrapper → toast}/toast-wrapper.js +0 -0
- /package/dist/components/{toast-wrapper → toast}/toast-wrapper.styles.js +0 -0
@@ -1,19 +1,19 @@
|
|
1
1
|
import "../button/button.js";
|
2
|
-
import { dateFormatter as
|
3
|
-
import { SkfElement as
|
4
|
-
import { watch as
|
5
|
-
import
|
6
|
-
import { html as
|
7
|
-
import { property as
|
2
|
+
import { dateFormatter as l, is as v } from "../date-picker-input/datepicker-input.helpers.js";
|
3
|
+
import { SkfElement as R } from "../../internal/components/skf-element.js";
|
4
|
+
import { watch as p } from "../../internal/helpers/watch.js";
|
5
|
+
import { componentStyles as S } from "../../styles/component.styles.js";
|
6
|
+
import { html as D } from "lit";
|
7
|
+
import { property as o, state as m } from "lit/decorators.js";
|
8
8
|
import "./datepicker.js";
|
9
|
-
import { getDateParts as
|
10
|
-
import { styles as
|
11
|
-
var
|
12
|
-
for (var
|
13
|
-
(
|
14
|
-
return
|
9
|
+
import { getDateParts as g, assertISODate as $, earliestDate as T, latestDate as C, compareDates as c, doAnimate as b } from "./datepicker.helpers.js";
|
10
|
+
import { styles as k } from "./datepicker.styles.js";
|
11
|
+
var F = Object.defineProperty, E = Object.getOwnPropertyDescriptor, n = (w, e, t, a) => {
|
12
|
+
for (var s = a > 1 ? void 0 : a ? E(e, t) : e, r = w.length - 1, d; r >= 0; r--)
|
13
|
+
(d = w[r]) && (s = (a ? d(e, t, s) : d(s)) || s);
|
14
|
+
return a && s && F(e, t, s), s;
|
15
15
|
};
|
16
|
-
const
|
16
|
+
const y = class y extends R {
|
17
17
|
constructor() {
|
18
18
|
super(...arguments), this.locale = "en-CA", this.date = (/* @__PURE__ */ new Date()).toLocaleDateString(this.locale), this.id = "", this.range = !1, this.selectedDate = void 0, this.selectedDateRange = {
|
19
19
|
start: null,
|
@@ -25,43 +25,43 @@ const m = class m extends $ {
|
|
25
25
|
), this._handleCalendarView = (e) => {
|
26
26
|
this._handleChangeCalendarView(e.detail);
|
27
27
|
}, this._handleSelectedDate = (e) => {
|
28
|
-
var
|
28
|
+
var t;
|
29
29
|
if (this.selectedDate = e.detail.date, console.log("selectedDate", this.selectedDate), this.range) {
|
30
|
-
const
|
31
|
-
if ((
|
30
|
+
const a = (t = this.shadowRoot) == null ? void 0 : t.querySelectorAll("skf-datepicker-calendar"), s = this.selectedDateRange, r = s.start && this.selectedDate < s.start;
|
31
|
+
if (!!(s.start && s.end) || r)
|
32
32
|
this.selectedDateRange = {
|
33
33
|
start: this.selectedDate,
|
34
34
|
end: null
|
35
35
|
};
|
36
36
|
else {
|
37
|
-
const
|
37
|
+
const f = !!s.start ? { end: e.detail.date } : { start: e.detail.date };
|
38
38
|
this.selectedDateRange = {
|
39
|
-
...
|
40
|
-
...
|
39
|
+
...s,
|
40
|
+
...f
|
41
41
|
};
|
42
42
|
}
|
43
|
-
this._onRangeCompleteEmitEvent(),
|
44
|
-
|
43
|
+
this._onRangeCompleteEmitEvent(), a != null && a.length && [...a].forEach((h) => {
|
44
|
+
h.selectedDateRange = this.selectedDateRange;
|
45
45
|
});
|
46
46
|
}
|
47
47
|
this.emit("skf-datepicker-selected", {
|
48
48
|
detail: { date: this.range ? this.selectedDateRange : this.selectedDate }
|
49
49
|
}), this.requestUpdate();
|
50
50
|
}, this._handleTodayClick = () => {
|
51
|
-
const { month: e, year:
|
52
|
-
if (
|
53
|
-
this.date =
|
51
|
+
const { month: e, year: t } = g(), { month: a, year: s } = g(this.date);
|
52
|
+
if (a === e && s === t && (this.selectedDateRange.start || this.selectedDate)) {
|
53
|
+
this.date = l(this.selectedDateRange.start ?? this.selectedDate), this.emit("update-calendar-view", {
|
54
54
|
detail: this.date
|
55
55
|
});
|
56
56
|
return;
|
57
57
|
}
|
58
58
|
if (this.range) {
|
59
59
|
this.emit("update-calendar-view", {
|
60
|
-
detail:
|
60
|
+
detail: l(/* @__PURE__ */ new Date())
|
61
61
|
});
|
62
62
|
return;
|
63
63
|
}
|
64
|
-
this.date =
|
64
|
+
this.date = l(/* @__PURE__ */ new Date());
|
65
65
|
};
|
66
66
|
}
|
67
67
|
connectedCallback() {
|
@@ -69,6 +69,8 @@ const m = class m extends $ {
|
|
69
69
|
}
|
70
70
|
firstUpdated() {
|
71
71
|
(this.selectedDateRange.start ?? this.selectedDate) && this._onRangeCompleteEmitEvent();
|
72
|
+
const t = this.selectedDate ?? this.selectedDateRange.start;
|
73
|
+
t instanceof Date && this.gotoDate(t);
|
72
74
|
}
|
73
75
|
clearSelection() {
|
74
76
|
this.selectedDateRange = {
|
@@ -81,11 +83,11 @@ const m = class m extends $ {
|
|
81
83
|
if (!this.selectedDateRange.start || !this.selectedDateRange.end) return;
|
82
84
|
const e = Math.abs(
|
83
85
|
this.selectedDateRange.end.getTime() - this.selectedDateRange.start.getTime()
|
84
|
-
),
|
86
|
+
), t = Math.ceil(e / (1e3 * 60 * 60 * 24)) + 1;
|
85
87
|
this.emit("selected-date-range-changed", {
|
86
88
|
detail: {
|
87
89
|
...this.selectedDateRange,
|
88
|
-
days:
|
90
|
+
days: t,
|
89
91
|
id: this.id
|
90
92
|
}
|
91
93
|
});
|
@@ -94,8 +96,8 @@ const m = class m extends $ {
|
|
94
96
|
this.style.setProperty("--max-width", this.range ? "43em" : "21em");
|
95
97
|
}
|
96
98
|
_handleDateChange() {
|
97
|
-
console.log("%cdate changed", "color:red", this.date), this.date = this.date ? this.date :
|
98
|
-
|
99
|
+
console.log("%cdate changed", "color:red", this.date), this.date = this.date && $(this.date) ? this.date : l(/* @__PURE__ */ new Date()), this.date = T(
|
100
|
+
C(this.date, this.selectableFrom ?? this.date),
|
99
101
|
this.selectableTo ?? this.date
|
100
102
|
), this._date = new Date(this.date), this._datePlusOneMonth = new Date(this._date.getFullYear(), this._date.getMonth() + 1, 1);
|
101
103
|
}
|
@@ -104,8 +106,23 @@ const m = class m extends $ {
|
|
104
106
|
_handleSelectedDateChange() {
|
105
107
|
console.log("selected date changed", this.selectedDate);
|
106
108
|
}
|
109
|
+
/**
|
110
|
+
* Navigates to the given date.
|
111
|
+
* @param date - The date to navigate to, either a Date object or a string in the format 'yyyy-mm-dd'
|
112
|
+
*/
|
113
|
+
gotoDate(e) {
|
114
|
+
if (e instanceof Date)
|
115
|
+
this.date = l(e);
|
116
|
+
else if (v(e).dateISO())
|
117
|
+
this.date = e;
|
118
|
+
else
|
119
|
+
throw new Error("Invalid date format");
|
120
|
+
this.emit("update-calendar-view", {
|
121
|
+
detail: e
|
122
|
+
});
|
123
|
+
}
|
107
124
|
render() {
|
108
|
-
return
|
125
|
+
return D`
|
109
126
|
<div class="calendar-container">
|
110
127
|
<skf-datepicker-calendar
|
111
128
|
.date=${this._date ?? /* @__PURE__ */ new Date()}
|
@@ -142,45 +159,48 @@ const m = class m extends $ {
|
|
142
159
|
}
|
143
160
|
/** @internal */
|
144
161
|
_renderTodayBtn() {
|
145
|
-
|
146
|
-
|
147
|
-
|
162
|
+
let e = !1;
|
163
|
+
if (this.selectableTo && c(this.selectableTo, l(/* @__PURE__ */ new Date())) === -1)
|
164
|
+
return D``;
|
165
|
+
if (this.selectableFrom && c(this.selectableFrom, l(/* @__PURE__ */ new Date())) === 1)
|
166
|
+
return D``;
|
167
|
+
const { month: t, year: a } = g(), { month: s, year: r } = g(this.date), d = this.selectedDate ?? this.selectedDateRange.start, h = t === s && a === r, f = d && c(l(/* @__PURE__ */ new Date()), l(d), "months") === 0;
|
168
|
+
return (h && !d || f && h) && (e = !0), D`
|
148
169
|
<div class="today">
|
149
170
|
<skf-button
|
150
171
|
@click=${this._handleTodayClick}
|
151
|
-
?disabled=${
|
172
|
+
?disabled=${e}
|
152
173
|
variant="tertiary"
|
153
174
|
size="sm"
|
154
175
|
>
|
155
|
-
${
|
176
|
+
${_(this.date) && (this.selectedDate || this.selectedDateRange.start) && !e ? "Selected date" : "Today"}
|
156
177
|
</skf-button>
|
157
178
|
</div>
|
158
179
|
`;
|
159
|
-
function
|
160
|
-
|
161
|
-
return w === v && R === b;
|
180
|
+
function _(u) {
|
181
|
+
return c(u, l(/* @__PURE__ */ new Date()), "months") === 0;
|
162
182
|
}
|
163
183
|
}
|
164
184
|
/** @internal */
|
165
185
|
_handleChangeCalendarView(e) {
|
166
|
-
const
|
167
|
-
this._animateView(
|
186
|
+
const t = c(this.date, e);
|
187
|
+
this._animateView(t, () => {
|
168
188
|
this.date = e;
|
169
189
|
}).then(() => {
|
170
|
-
}).catch((
|
171
|
-
console.error(
|
190
|
+
}).catch((a) => {
|
191
|
+
console.error(a);
|
172
192
|
});
|
173
193
|
}
|
174
194
|
/** @internal */
|
175
|
-
async _animateView(e,
|
195
|
+
async _animateView(e, t) {
|
176
196
|
if (!this.shadowRoot) return;
|
177
|
-
const
|
178
|
-
return
|
179
|
-
|
197
|
+
const a = [...this.shadowRoot.querySelectorAll("skf-datepicker-calendar")];
|
198
|
+
return a.length ? (await b(
|
199
|
+
a,
|
180
200
|
[{ opacity: 0, transform: `translateX(calc(16px * ${e.toString()}))` }],
|
181
201
|
{ duration: 100, easing: "ease-in", fill: "backwards" }
|
182
|
-
),
|
183
|
-
|
202
|
+
), t(), await b(
|
203
|
+
a,
|
184
204
|
[
|
185
205
|
{ opacity: 0, transform: `translateX(${(-16 * e).toString()}px)` },
|
186
206
|
{ opacity: 1, transform: "translateX(0)" }
|
@@ -189,53 +209,53 @@ const m = class m extends $ {
|
|
189
209
|
)) : Promise.resolve();
|
190
210
|
}
|
191
211
|
};
|
192
|
-
|
193
|
-
let
|
194
|
-
|
195
|
-
|
196
|
-
],
|
197
|
-
|
198
|
-
|
199
|
-
],
|
200
|
-
|
201
|
-
|
202
|
-
],
|
203
|
-
|
204
|
-
|
205
|
-
],
|
206
|
-
|
207
|
-
|
208
|
-
],
|
209
|
-
|
210
|
-
|
211
|
-
],
|
212
|
-
|
213
|
-
|
214
|
-
],
|
215
|
-
|
216
|
-
|
217
|
-
],
|
218
|
-
|
219
|
-
|
220
|
-
],
|
221
|
-
|
222
|
-
|
223
|
-
],
|
224
|
-
|
225
|
-
|
226
|
-
],
|
227
|
-
|
228
|
-
|
229
|
-
],
|
230
|
-
|
231
|
-
|
232
|
-
],
|
233
|
-
|
234
|
-
|
235
|
-
],
|
236
|
-
|
237
|
-
|
238
|
-
],
|
212
|
+
y.styles = [S, k];
|
213
|
+
let i = y;
|
214
|
+
n([
|
215
|
+
o({ reflect: !0 })
|
216
|
+
], i.prototype, "locale", 2);
|
217
|
+
n([
|
218
|
+
o({ type: String, reflect: !0 })
|
219
|
+
], i.prototype, "date", 2);
|
220
|
+
n([
|
221
|
+
o({ type: String })
|
222
|
+
], i.prototype, "id", 2);
|
223
|
+
n([
|
224
|
+
o({ attribute: "invalid-dates" })
|
225
|
+
], i.prototype, "invalidDates", 2);
|
226
|
+
n([
|
227
|
+
o({ type: Boolean })
|
228
|
+
], i.prototype, "range", 2);
|
229
|
+
n([
|
230
|
+
m()
|
231
|
+
], i.prototype, "selectedDate", 2);
|
232
|
+
n([
|
233
|
+
o({ attribute: "selectable-from" })
|
234
|
+
], i.prototype, "selectableFrom", 2);
|
235
|
+
n([
|
236
|
+
o({ attribute: "selectable-to" })
|
237
|
+
], i.prototype, "selectableTo", 2);
|
238
|
+
n([
|
239
|
+
m()
|
240
|
+
], i.prototype, "selectedDateRange", 2);
|
241
|
+
n([
|
242
|
+
m()
|
243
|
+
], i.prototype, "_date", 2);
|
244
|
+
n([
|
245
|
+
m()
|
246
|
+
], i.prototype, "_datePlusOneMonth", 2);
|
247
|
+
n([
|
248
|
+
p("range")
|
249
|
+
], i.prototype, "_handleRangeChange", 1);
|
250
|
+
n([
|
251
|
+
p("date")
|
252
|
+
], i.prototype, "_handleDateChange", 1);
|
253
|
+
n([
|
254
|
+
p("selectedDateRange")
|
255
|
+
], i.prototype, "_handleSelectedDateRangeChange", 1);
|
256
|
+
n([
|
257
|
+
p("selectedDate")
|
258
|
+
], i.prototype, "_handleSelectedDateChange", 1);
|
239
259
|
export {
|
240
|
-
|
260
|
+
i as SkfDatePicker
|
241
261
|
};
|
@@ -17,9 +17,10 @@ export declare function getDateParts(date?: undefined | string | Date | Temporal
|
|
17
17
|
/**
|
18
18
|
* @param dateOne - first date to compare as string
|
19
19
|
* @param dateTwo - second date to compare as string
|
20
|
+
* @param granularity - the unit to compare the dates by [days, months, years], defaults to days
|
20
21
|
* @returns - 0 if the dates are the same, 1 if dateOne is after dateTwo, -1 if dateOne is before dateTwo
|
21
22
|
*/
|
22
|
-
export declare function compareDates(dateOne: Temporal.PlainDate | string, dateTwo: Temporal.PlainDate | string): 0 | 1 | -1;
|
23
|
+
export declare function compareDates(dateOne: Temporal.PlainDate | string, dateTwo: Temporal.PlainDate | string, granularity?: 'days' | 'months' | 'years'): 0 | 1 | -1;
|
23
24
|
/**
|
24
25
|
* @param dateOne - first date to compare as string
|
25
26
|
* @param dateTwo - second date to compare as string
|
@@ -37,4 +38,4 @@ export declare function earliestDate(...dates: (string | Date)[]): string;
|
|
37
38
|
* @returns the latest date of the list
|
38
39
|
*/
|
39
40
|
export declare function latestDate(...dates: (string | Date)[]): string;
|
40
|
-
export declare function assertISODate(date: string | Temporal.PlainDate | Date): string;
|
41
|
+
export declare function assertISODate(date: string | Temporal.PlainDate | Date, throwErr?: boolean): string;
|
@@ -1,69 +1,76 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
1
|
+
import { is as c } from "../date-picker-input/datepicker-input.helpers.js";
|
2
|
+
import { Temporal as e } from "@js-temporal/polyfill";
|
3
|
+
function I(t, n, s) {
|
4
|
+
const o = (r) => Array.isArray(r) ? r : [r], f = o(t);
|
4
5
|
n = o(n);
|
5
|
-
const
|
6
|
-
for (const r of
|
7
|
-
const { promise: i, resolve:
|
6
|
+
const a = [];
|
7
|
+
for (const r of f) {
|
8
|
+
const { promise: i, resolve: m, reject: p } = Promise.withResolvers(), l = r.animate(n, {
|
8
9
|
fill: "forwards",
|
9
10
|
duration: 300,
|
10
11
|
iterations: 1,
|
11
|
-
...
|
12
|
+
...s
|
12
13
|
});
|
13
|
-
l.onfinish = () =>
|
14
|
+
l.onfinish = () => m("finished"), l.oncancel = () => p("canceled"), a.push(i);
|
14
15
|
}
|
15
|
-
return Promise.allSettled(
|
16
|
+
return Promise.allSettled(a);
|
16
17
|
}
|
17
|
-
function
|
18
|
-
return t ?? (t =
|
18
|
+
function P(t = e.Now.plainDateISO()) {
|
19
|
+
return t ?? (t = e.Now.plainDateISO()), t instanceof Date && (t = e.PlainDate.from(t.toISOString())), typeof t == "string" && (t = e.PlainDate.from(S(t, !0))), {
|
19
20
|
year: t.year,
|
20
21
|
month: t.month - 1,
|
21
22
|
// new Date is 0 based
|
22
23
|
day: t.day
|
23
24
|
};
|
24
25
|
}
|
25
|
-
function
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
function v(t, n, s = "days") {
|
27
|
+
console.assert(c(t, n).plainISO(), "Invalid dates passed to compareDates()"), typeof t == "string" && (t = e.PlainDate.from(t)), typeof n == "string" && (n = e.PlainDate.from(n)), console.assert(
|
28
|
+
c(t, n).plain(),
|
29
|
+
`Invalid date was sent to helper function compareDates(). Got ${JSON.stringify(t)} and ${JSON.stringify(n)} passed in`
|
30
|
+
);
|
31
|
+
const o = D(t, n, s);
|
32
|
+
return f(o);
|
33
|
+
function f(a) {
|
29
34
|
return Math.max(-1, Math.min(a, 1));
|
30
35
|
}
|
31
36
|
}
|
32
|
-
function
|
33
|
-
return typeof t == "string" && (t =
|
34
|
-
t instanceof
|
37
|
+
function D(t, n, s = "days") {
|
38
|
+
return typeof t == "string" && (t = e.PlainDate.from(t)), typeof n == "string" && (n = e.PlainDate.from(n)), console.assert(
|
39
|
+
t instanceof e.PlainDate && n instanceof e.PlainDate,
|
35
40
|
`Invalid date was sent to helper function timeBetween(). Got ${JSON.stringify(t)} and ${JSON.stringify(n)} passed in`
|
36
|
-
), t.
|
41
|
+
), s === "months" ? n.until(t, { largestUnit: "months" }).months : s === "years" ? n.until(t, { largestUnit: "years" }).years : n.until(t, { largestUnit: "days" }).days;
|
37
42
|
}
|
38
|
-
function
|
43
|
+
function u(...t) {
|
39
44
|
if (t.length === 0)
|
40
45
|
throw new Error("At least one date must be provided");
|
41
|
-
const n = (i) => i instanceof Date,
|
42
|
-
if (
|
43
|
-
return
|
44
|
-
const [o, ...
|
46
|
+
const n = (i) => i instanceof Date, s = t.map((i) => n(i) ? i : new Date(i));
|
47
|
+
if (s.length === 1)
|
48
|
+
return s[0].toISOString().split("T")[0];
|
49
|
+
const [o, ...f] = s, a = u(...f), r = new Date(a);
|
45
50
|
return o < r ? o.toISOString().split("T")[0] : r.toISOString().split("T")[0];
|
46
51
|
}
|
47
|
-
function
|
52
|
+
function g(...t) {
|
48
53
|
if (t.length === 0)
|
49
54
|
throw new Error("At least one date must be provided");
|
50
|
-
const n = (i) => i instanceof Date,
|
51
|
-
if (
|
52
|
-
return
|
53
|
-
const [o, ...
|
55
|
+
const n = (i) => i instanceof Date, s = t.map((i) => n(i) ? i : new Date(i));
|
56
|
+
if (s.length === 1)
|
57
|
+
return s[0].toISOString().split("T")[0];
|
58
|
+
const [o, ...f] = s, a = g(...f), r = new Date(a);
|
54
59
|
return o > r ? o.toISOString().split("T")[0] : r.toISOString().split("T")[0];
|
55
60
|
}
|
56
|
-
function
|
57
|
-
|
61
|
+
function S(t, n = !1) {
|
62
|
+
t instanceof Date && (t = e.PlainDate.from(t.toISOString())), typeof t != "string" && (t = t.toString());
|
63
|
+
const s = /^\d{4}-\d{2}-\d{2}$/;
|
64
|
+
if (!s.test(t) && n)
|
58
65
|
throw new Error(`Invalid date format. Got ${t} passed in.`);
|
59
|
-
return t;
|
66
|
+
return s.test(t) ? t : "";
|
60
67
|
}
|
61
68
|
export {
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
+
S as assertISODate,
|
70
|
+
v as compareDates,
|
71
|
+
I as doAnimate,
|
72
|
+
u as earliestDate,
|
73
|
+
P as getDateParts,
|
74
|
+
g as latestDate,
|
75
|
+
D as timeBetween
|
69
76
|
};
|
@@ -1,27 +1,12 @@
|
|
1
|
-
import { css as
|
2
|
-
const
|
1
|
+
import { css as r } from "lit";
|
2
|
+
const a = r`
|
3
3
|
@layer components {
|
4
4
|
:host {
|
5
|
-
--black: #323232;
|
6
|
-
--call-to-action-color: #007bff;
|
7
|
-
--selected-bg: var(--call-to-action-color); /* hsl(218deg 87% 45%); */
|
8
|
-
--selected-fg: #fff;
|
9
|
-
--in-range-bg: #def;
|
10
|
-
--today: #eee;
|
11
|
-
--today-fg: var(--black);
|
12
|
-
--title-fg: var(--black);
|
13
|
-
--other-month-fg: #999;
|
14
|
-
--hover-bg: #def;
|
15
|
-
--border-color: #ddd;
|
16
|
-
--button-control-fg: #333;
|
17
|
-
--button-control-fg-hover: var(--call-to-action-color);
|
18
|
-
--weekday-fg: var(--black);
|
19
|
-
--calendar-padding: 16px;
|
20
5
|
--max-width: 21em;
|
21
6
|
--day-outline: transparent;
|
22
7
|
|
23
|
-
background-color:
|
24
|
-
border: solid 1px
|
8
|
+
background-color: var(--skf-bg-color-neutral-1);
|
9
|
+
border: solid 1px var(--skf-border-color-primary);
|
25
10
|
border-radius: 3px;
|
26
11
|
box-shadow: 0 0 10px rgba(0 0 0 / 30%);
|
27
12
|
box-sizing: border-box;
|
@@ -52,16 +37,19 @@ const e = o`
|
|
52
37
|
.calendar-container {
|
53
38
|
display: flex;
|
54
39
|
flex-direction: row;
|
55
|
-
gap: var(--
|
40
|
+
gap: var(--skf-text-color-primary);
|
56
41
|
justify-content: space-between;
|
57
42
|
overflow: hidden;
|
58
|
-
padding: var(--
|
43
|
+
padding: var(--skf-spacing-50);
|
44
|
+
}
|
45
|
+
|
46
|
+
skf-datepicker-calendar {
|
47
|
+
margin: var(--skf-spacing-50) var(--skf-spacing-50) 0 var(--skf-spacing-50);
|
59
48
|
}
|
60
49
|
|
61
50
|
.today {
|
62
|
-
border-top: 1px solid var(--border-color);
|
51
|
+
border-top: 1px solid var(--skf-border-color-primary);
|
63
52
|
margin-bottom: 0.5rem;
|
64
|
-
margin-top: -1rem;
|
65
53
|
padding-top: 0.5rem;
|
66
54
|
text-align: center;
|
67
55
|
|
@@ -78,11 +66,11 @@ const e = o`
|
|
78
66
|
}
|
79
67
|
|
80
68
|
&:hover {
|
81
|
-
background-color: var(--
|
69
|
+
background-color: var(--skf-interactive-bg-color-primary);
|
82
70
|
}
|
83
71
|
|
84
72
|
&:active {
|
85
|
-
background-color: lch(from var(--
|
73
|
+
background-color: lch(from var(--skf-interactive-bg-color-primary) calc(l - 5) c h);
|
86
74
|
}
|
87
75
|
|
88
76
|
&:focus-visible {
|
@@ -95,5 +83,5 @@ const e = o`
|
|
95
83
|
}
|
96
84
|
`;
|
97
85
|
export {
|
98
|
-
|
86
|
+
a as styles
|
99
87
|
};
|
@@ -1,4 +1,6 @@
|
|
1
|
+
import '../icon/icon.js';
|
1
2
|
import { FormBase } from '../../internal/components/formBase.js';
|
3
|
+
import '../../internal/components/hint/hint.js';
|
2
4
|
import { PopoverController } from '../../internal/controllers/popover.controller.js';
|
3
5
|
import type { FormFieldBaseProps } from '../../internal/types/formField.js';
|
4
6
|
import { type CSSResultGroup } from 'lit';
|
@@ -8,7 +10,7 @@ export declare class SkfDatePickerInput extends FormBase {
|
|
8
10
|
/** @internal */
|
9
11
|
static styles: CSSResultGroup;
|
10
12
|
/** @inernal */
|
11
|
-
|
13
|
+
focusTimeoutId: ReturnType<typeof setTimeout> | undefined;
|
12
14
|
/** @internal */
|
13
15
|
private customError;
|
14
16
|
/** @internal */
|
@@ -48,6 +50,8 @@ export declare class SkfDatePickerInput extends FormBase {
|
|
48
50
|
* @type { "alert" | "success" | "info" | "warning" }
|
49
51
|
*/
|
50
52
|
severity?: FormFieldBaseProps['severity'];
|
53
|
+
/** Size of the input */
|
54
|
+
size: 'sm' | 'md';
|
51
55
|
/** Sets validation start */
|
52
56
|
validateOn: 'input' | 'change' | 'submit';
|
53
57
|
/** The current value of the input field */
|
@@ -72,16 +76,21 @@ export declare class SkfDatePickerInput extends FormBase {
|
|
72
76
|
$datepicker: SkfDatePicker;
|
73
77
|
/** @internal */
|
74
78
|
_defaultSlot: Node[];
|
79
|
+
abortController: AbortController;
|
80
|
+
abortSignal: AbortSignal;
|
75
81
|
constructor();
|
76
82
|
connectedCallback(): void;
|
77
|
-
|
78
|
-
|
79
|
-
id: number;
|
80
|
-
}>) => void;
|
83
|
+
disconnectedCallback(): void;
|
84
|
+
_handleSelectedDate: () => void;
|
81
85
|
protected firstUpdated(): void;
|
82
86
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
83
87
|
private _handleDateSelected;
|
88
|
+
/** @internal */
|
89
|
+
_handleKeyboardEvents: (e: KeyboardEvent) => void;
|
90
|
+
/** @internal */
|
84
91
|
private _handleFocus;
|
92
|
+
showPopover: () => void;
|
93
|
+
hidePopover: () => void;
|
85
94
|
/** @internal */
|
86
95
|
_handleBlur: (event: FocusEvent) => void;
|
87
96
|
/** @internal */
|