@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,4 +1,38 @@
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
2
|
+
/**
|
3
|
+
* @param date - a date to format, defaults to yyyy-mm-dd
|
4
|
+
* @param locale
|
5
|
+
* @returns - a formatted date string
|
6
|
+
*/
|
1
7
|
export declare function dateFormatter(date?: string | Date | null, locale?: string): string;
|
2
|
-
|
8
|
+
/**
|
9
|
+
* Questionable if this really works
|
10
|
+
*
|
11
|
+
* @param element - a popover element to check if it is open
|
12
|
+
* @returns - true if the popover is open, false otherwise
|
13
|
+
*/
|
14
|
+
export declare const isPopoverOpen: (element: HTMLElement) => boolean;
|
15
|
+
/**
|
16
|
+
* @param func - a function to debounce
|
17
|
+
* @param delay - the delay in milliseconds to debounce the function
|
18
|
+
* @returns - a debounced function
|
19
|
+
*/
|
3
20
|
export declare function debounce<T extends (...args: unknown[]) => void>(func: T, delay: number): (...args: Parameters<T>) => void;
|
4
|
-
|
21
|
+
/**
|
22
|
+
* Returns true if all given dates matches a least one of the given types.
|
23
|
+
*
|
24
|
+
* @param assertDate - dates to check if they match one valid date
|
25
|
+
* @returns - true if the date is a valid date, false otherwise
|
26
|
+
*
|
27
|
+
* @example - is('2021-01-01', new Date(), Temporal.PlainDate.from('2021-01-01')).dateISOPlainDate; // true
|
28
|
+
* @example - is('2021-01-01', new Date(), Temporal.PlainDate.from('2021-01-01')).dateISO; // false
|
29
|
+
*/
|
30
|
+
export declare const is: (...assertDates: (Date | Temporal.PlainDate | string | null)[]) => {
|
31
|
+
date: () => boolean;
|
32
|
+
ISO: () => boolean;
|
33
|
+
plain: () => boolean;
|
34
|
+
dateISO: () => boolean;
|
35
|
+
datePlain: () => boolean;
|
36
|
+
dateISOPlain: () => boolean;
|
37
|
+
plainISO: () => boolean;
|
38
|
+
};
|
@@ -1,29 +1,31 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import { Temporal as u } from "@js-temporal/polyfill";
|
2
|
+
function l(n, e = "en-CA") {
|
3
|
+
return n ? (typeof n == "string" && (n = new Date(n)), n.toLocaleDateString(e)) : "";
|
3
4
|
}
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
console.log("Function executed after delay"), e(...t);
|
12
|
-
}, n);
|
5
|
+
const p = (n) => n.matches(":popover-open");
|
6
|
+
let i = null;
|
7
|
+
function a(n, e) {
|
8
|
+
return (...o) => {
|
9
|
+
i && clearTimeout(i), i = setTimeout(() => {
|
10
|
+
n(...o);
|
11
|
+
}, e);
|
13
12
|
};
|
14
13
|
}
|
15
|
-
const
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
const f = (...n) => {
|
15
|
+
const e = () => n.some((t) => t instanceof Date && !isNaN(t.valueOf())), o = () => n.some((t) => typeof t == "string" && /^\d{4}-\d{2}-\d{2}$/.test(t)), r = () => n.some((t) => t instanceof u.PlainDate);
|
16
|
+
return {
|
17
|
+
date: e,
|
18
|
+
ISO: o,
|
19
|
+
plain: r,
|
20
|
+
dateISO: () => e() || o(),
|
21
|
+
datePlain: () => e() || r(),
|
22
|
+
dateISOPlain: () => e() || o() || r(),
|
23
|
+
plainISO: () => r() || o()
|
24
|
+
};
|
23
25
|
};
|
24
26
|
export {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
l as dateFormatter,
|
28
|
+
a as debounce,
|
29
|
+
f as is,
|
30
|
+
p as isPopoverOpen
|
29
31
|
};
|
@@ -1,22 +1,18 @@
|
|
1
1
|
import o from "../../styles/form-field.styles.js";
|
2
|
-
import { visuallyHidden as
|
3
|
-
import { css as
|
4
|
-
const
|
5
|
-
|
2
|
+
import { visuallyHidden as r } from "../../styles/util.styles.js";
|
3
|
+
import { css as e } from "lit";
|
4
|
+
const m = [
|
5
|
+
r,
|
6
6
|
o,
|
7
|
-
|
7
|
+
e`
|
8
8
|
@layer components {
|
9
9
|
#popover {
|
10
10
|
border: none;
|
11
11
|
overflow: visible;
|
12
12
|
}
|
13
13
|
}
|
14
|
-
|
15
|
-
input::-webkit-calendar-picker-indicator {
|
16
|
-
display: none;
|
17
|
-
}
|
18
14
|
`
|
19
15
|
];
|
20
16
|
export {
|
21
|
-
|
17
|
+
m as styles
|
22
18
|
};
|
@@ -4,27 +4,20 @@ import '../icon/icon.js';
|
|
4
4
|
import { SkfElement } from '../../internal/components/skf-element';
|
5
5
|
import { type CSSResultGroup } from 'lit';
|
6
6
|
/**
|
7
|
-
*
|
7
|
+
* The `<skf-dialog>` is a component that open up a dialog of type modal with the content provided. (MDN refrains from opening the dialog using the `open` attribute, however skf-dialog does not have that limitation)
|
8
8
|
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
* TBD: Should we disable scrolling on the page behind the dialog? Maybe only if it is modal?
|
12
|
-
*/
|
13
|
-
/**
|
14
|
-
* The `<skf-dialog>` is a component that open up a dialog with the content provided
|
15
|
-
*
|
16
|
-
* @documentation See [InVision DSM](https://skf.invisionapp.com/dsm/ab-skf/4-web-applications/nav/5fa7caf78c01200018354495/asset/6229d63d9fe16020a60657e5) for design principles
|
9
|
+
* @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/329940-dialogmodal) for design principles
|
17
10
|
*
|
18
11
|
* @slot - The dialog component's content
|
19
12
|
* @slot footer - The dialog component's buttons goes here
|
20
13
|
*
|
21
|
-
* @event skf-dialog-open - Fires when the dialog is opened (after transitioned in)
|
22
|
-
* @event skf-dialog-close - Fires when the dialog is closed (before transitioned out)
|
23
|
-
* @event close - Fires when the dialog is closed (after transitioned out)
|
24
|
-
*
|
25
14
|
* @cssproperty --skf-dialog-height - A custom height for the Dialog. Pass valid CSS **block-size** values
|
26
15
|
* @cssproperty --skf-dialog-width - A custom width for the Dialog Pass valid CSS **inline-size** values
|
27
16
|
*
|
17
|
+
* @event {CustomEvent} skf-dialog-opened - Fires when the dialog is opened (after transitioned in)
|
18
|
+
* @event {CustomEvent} skf-dialog-closing - Fires when the dialog is closing (before transitioned out)
|
19
|
+
* @event {CustomEvent} skf-dialog-closed - Fires when the dialog is closed (after transitioned out)
|
20
|
+
*
|
28
21
|
* @tagname skf-dialog
|
29
22
|
*/
|
30
23
|
export declare class SkfDialog extends SkfElement {
|
@@ -40,35 +33,33 @@ export declare class SkfDialog extends SkfElement {
|
|
40
33
|
noCloseButton?: boolean | undefined;
|
41
34
|
/** If defined, removes the inner padding */
|
42
35
|
noPadding: boolean;
|
43
|
-
|
44
|
-
|
36
|
+
/** If true, indicates that the dialog is active and is available for interaction */
|
37
|
+
open: boolean;
|
38
|
+
/** @internal */
|
45
39
|
onClose?: ((event: Event) => void) | null;
|
46
40
|
/** @internal */
|
47
|
-
|
41
|
+
renderFoot: boolean;
|
48
42
|
/** @internal */
|
49
|
-
|
43
|
+
$dialog?: HTMLDialogElement;
|
50
44
|
/** @internal */
|
51
|
-
|
45
|
+
footerEls?: HTMLElement[];
|
52
46
|
/** @internal */
|
53
|
-
renderFoot: boolean;
|
54
|
-
protected firstUpdated(): void;
|
55
47
|
handleOpenChange(): void;
|
48
|
+
protected firstUpdated(): void;
|
49
|
+
/** @internal */
|
50
|
+
_handleBackdropClick: (event: MouseEvent) => void;
|
51
|
+
/** @internal */
|
52
|
+
_handleClose: (event: Event) => void;
|
56
53
|
/** @internal */
|
57
|
-
|
54
|
+
_handleKeyDown: (event: KeyboardEvent) => void;
|
58
55
|
/** @internal */
|
59
56
|
_transition(): {
|
60
57
|
entry: () => Promise<unknown>;
|
61
58
|
exit: () => Promise<unknown>;
|
62
59
|
};
|
63
|
-
/** @internal */
|
64
|
-
_handleBackdropClick: (event: MouseEvent) => void;
|
65
|
-
/** @internal */
|
66
|
-
_handleClose: (event: Event) => void;
|
67
|
-
/** @internal */
|
68
|
-
get _isModal(): boolean;
|
69
60
|
/** Method that opens the dialog in modal state */
|
70
|
-
showModal
|
61
|
+
showModal(): Promise<boolean>;
|
71
62
|
/** Method that closes the dialog */
|
72
|
-
close
|
63
|
+
close(): Promise<boolean | undefined>;
|
73
64
|
render(): import("lit").TemplateResult<1>;
|
74
65
|
}
|
@@ -1,66 +1,61 @@
|
|
1
|
-
var
|
2
|
-
throw TypeError(
|
1
|
+
var m = (e) => {
|
2
|
+
throw TypeError(e);
|
3
3
|
};
|
4
|
-
var
|
5
|
-
var
|
4
|
+
var _ = (e, i, t) => i.has(e) || m("Cannot " + t);
|
5
|
+
var u = (e, i, t) => (_(e, i, "read from private field"), t ? t.call(e) : i.get(e)), g = (e, i, t) => i.has(e) ? m("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(e) : i.set(e, t), p = (e, i, t, o) => (_(e, i, "write to private field"), o ? o.call(e, t) : i.set(e, t), t);
|
6
6
|
import "../button/button.js";
|
7
7
|
import "../heading/heading.js";
|
8
8
|
import "../icon/icon.js";
|
9
|
-
import { SkfElement as
|
10
|
-
import { watch as
|
11
|
-
import B from "../../styles/component.styles.js";
|
12
|
-
import {
|
13
|
-
import { property as c, state as
|
14
|
-
import { classMap as
|
9
|
+
import { SkfElement as C } from "../../internal/components/skf-element.js";
|
10
|
+
import { watch as v } from "../../internal/helpers/watch.js";
|
11
|
+
import { componentStyles as B } from "../../styles/component.styles.js";
|
12
|
+
import { nothing as k, html as $ } from "lit";
|
13
|
+
import { property as c, state as b, query as P, queryAssignedElements as E } from "lit/decorators.js";
|
14
|
+
import { classMap as w } from "lit/directives/class-map.js";
|
15
15
|
import { styles as O } from "./dialog.styles.js";
|
16
|
-
var
|
17
|
-
for (var
|
18
|
-
(r =
|
19
|
-
return
|
20
|
-
},
|
21
|
-
const y = class y extends
|
16
|
+
var x = Object.defineProperty, A = Object.getOwnPropertyDescriptor, n = (e, i, t, o) => {
|
17
|
+
for (var l = o > 1 ? void 0 : o ? A(i, t) : i, a = e.length - 1, r; a >= 0; a--)
|
18
|
+
(r = e[a]) && (l = (o ? r(i, t, l) : r(l)) || l);
|
19
|
+
return o && l && x(i, t, l), l;
|
20
|
+
}, h, f, d;
|
21
|
+
const y = class y extends C {
|
22
22
|
constructor() {
|
23
23
|
super(...arguments);
|
24
|
-
g(this,
|
25
|
-
g(this,
|
24
|
+
g(this, h);
|
25
|
+
g(this, f);
|
26
26
|
g(this, d);
|
27
|
-
|
28
|
-
|
29
|
-
}, this._handleClose = (
|
30
|
-
|
31
|
-
}, this.
|
27
|
+
p(this, h, 0), p(this, f, 20), p(this, d, !1), this.fullscreen = !1, this.noCloseButton = !1, this.noPadding = !1, this.open = !1, this.onClose = null, this.renderFoot = !1, this._handleBackdropClick = (t) => {
|
28
|
+
t.target === this.$dialog && this.close();
|
29
|
+
}, this._handleClose = (t) => {
|
30
|
+
this.onClose && this.onClose(t), this.close();
|
31
|
+
}, this._handleKeyDown = (t) => {
|
32
|
+
t.preventDefault(), t.key === "Escape" && this.close();
|
33
|
+
};
|
34
|
+
}
|
35
|
+
handleOpenChange() {
|
36
|
+
var t;
|
37
|
+
this.open ? this.showModal() : this.close(), this.open && (this.renderFoot = !!((t = this.footerEls) != null && t.length));
|
32
38
|
}
|
33
39
|
firstUpdated() {
|
34
|
-
this.$dialog.addEventListener("close", (
|
35
|
-
|
40
|
+
this.$dialog && this.$dialog.addEventListener("close", (t) => {
|
41
|
+
t.stopPropagation(), this.emit("skf-dialog-closed");
|
36
42
|
});
|
37
43
|
}
|
38
|
-
handleOpenChange() {
|
39
|
-
var o;
|
40
|
-
switch (!0) {
|
41
|
-
case (this.open === !0 && !!this.modal):
|
42
|
-
this.showModal();
|
43
|
-
break;
|
44
|
-
case (this.open === !0 && !this.modal):
|
45
|
-
this.show();
|
46
|
-
break;
|
47
|
-
case this.open === !1:
|
48
|
-
this.close();
|
49
|
-
break;
|
50
|
-
}
|
51
|
-
this.open && (this.renderFoot = !!((o = this.footerEls) != null && o.length));
|
52
|
-
}
|
53
44
|
/** @internal */
|
54
45
|
_transition() {
|
55
|
-
const
|
56
|
-
translate: `${String(
|
46
|
+
const t = this.fullscreen ? {} : {
|
47
|
+
translate: `${String(u(this, h))} ${String(u(this, f))}px`
|
57
48
|
};
|
58
|
-
return { entry: () => new Promise((
|
49
|
+
return { entry: () => new Promise((a) => {
|
50
|
+
if (!this.$dialog) {
|
51
|
+
a("no dialog found");
|
52
|
+
return;
|
53
|
+
}
|
59
54
|
const r = this.$dialog.animate(
|
60
55
|
[
|
61
56
|
{
|
62
57
|
opacity: 0,
|
63
|
-
...
|
58
|
+
...t
|
64
59
|
},
|
65
60
|
{ opacity: 1, translate: "0 0" }
|
66
61
|
],
|
@@ -75,15 +70,19 @@ const y = class y extends v {
|
|
75
70
|
fill: "forwards",
|
76
71
|
pseudoElement: "::backdrop"
|
77
72
|
}), r.onfinish = () => {
|
78
|
-
|
73
|
+
a("opened");
|
79
74
|
};
|
80
|
-
}), exit: () => new Promise((
|
75
|
+
}), exit: () => new Promise((a) => {
|
76
|
+
if (!this.$dialog) {
|
77
|
+
a("no dialog found");
|
78
|
+
return;
|
79
|
+
}
|
81
80
|
const r = this.$dialog.animate(
|
82
81
|
[
|
83
82
|
{ opacity: 1, translate: "0 0" },
|
84
83
|
{
|
85
84
|
opacity: 0,
|
86
|
-
...
|
85
|
+
...t
|
87
86
|
}
|
88
87
|
],
|
89
88
|
{
|
@@ -97,22 +96,36 @@ const y = class y extends v {
|
|
97
96
|
fill: "forwards",
|
98
97
|
pseudoElement: "::backdrop"
|
99
98
|
}), r.onfinish = () => {
|
100
|
-
|
99
|
+
a("closed");
|
101
100
|
};
|
102
101
|
}) };
|
103
102
|
}
|
104
|
-
/**
|
105
|
-
|
106
|
-
|
103
|
+
/** Method that opens the dialog in modal state */
|
104
|
+
async showModal() {
|
105
|
+
async function t(o) {
|
106
|
+
return o.$dialog ? (o.$dialog.showModal(), await o._transition().entry(), o.emit("skf-dialog-opened"), !0) : !1;
|
107
|
+
}
|
108
|
+
return await t(this);
|
109
|
+
}
|
110
|
+
/** Method that closes the dialog */
|
111
|
+
async close() {
|
112
|
+
if (u(this, d) || !this.open) return;
|
113
|
+
p(this, d, !0);
|
114
|
+
async function t(o) {
|
115
|
+
return o.$dialog ? (o.emit("skf-dialog-closing"), await o._transition().exit(), o.$dialog.close(), o.open = !1, p(o, d, !1), !0) : !1;
|
116
|
+
}
|
117
|
+
return await t(this);
|
107
118
|
}
|
108
119
|
render() {
|
109
|
-
return
|
120
|
+
return $`
|
110
121
|
<dialog
|
111
122
|
@close=${this._handleClose}
|
112
123
|
@mousedown=${this._handleBackdropClick}
|
113
124
|
@touchstart=${this._handleBackdropClick}
|
125
|
+
@keydown=${this._handleKeyDown}
|
126
|
+
aria-modal="true"
|
114
127
|
autofocus
|
115
|
-
class=${
|
128
|
+
class=${w({
|
116
129
|
dialog: !0,
|
117
130
|
"dialog--fullscreen": this.fullscreen,
|
118
131
|
"dialog--no-padding": this.noPadding
|
@@ -120,7 +133,7 @@ const y = class y extends v {
|
|
120
133
|
>
|
121
134
|
<div class="dialog__head">
|
122
135
|
<h2 class="dialog__heading">${this.heading}</h2>
|
123
|
-
${this.noCloseButton ? k :
|
136
|
+
${this.noCloseButton ? k : $`
|
124
137
|
<button
|
125
138
|
@click=${this._handleClose}
|
126
139
|
aria-label=${this.closeButtonAriaLabel ?? "Close dialog"}
|
@@ -133,7 +146,7 @@ const y = class y extends v {
|
|
133
146
|
<div class="dialog__body">
|
134
147
|
<slot class="dialog__main"></slot>
|
135
148
|
<slot
|
136
|
-
class=${
|
149
|
+
class=${w({
|
137
150
|
dialog__foot: !0,
|
138
151
|
"dialog__foot--hidden": !this.renderFoot
|
139
152
|
})}
|
@@ -144,43 +157,40 @@ const y = class y extends v {
|
|
144
157
|
`;
|
145
158
|
}
|
146
159
|
};
|
147
|
-
|
160
|
+
h = new WeakMap(), f = new WeakMap(), d = new WeakMap(), y.styles = [B, O];
|
148
161
|
let s = y;
|
149
|
-
|
162
|
+
n([
|
150
163
|
c({ attribute: "close-button-aria-label" })
|
151
164
|
], s.prototype, "closeButtonAriaLabel", 2);
|
152
|
-
|
165
|
+
n([
|
153
166
|
c()
|
154
167
|
], s.prototype, "heading", 2);
|
155
|
-
|
168
|
+
n([
|
156
169
|
c({ type: Boolean })
|
157
170
|
], s.prototype, "fullscreen", 2);
|
158
|
-
|
171
|
+
n([
|
159
172
|
c({ type: Boolean, attribute: "no-close-button" })
|
160
173
|
], s.prototype, "noCloseButton", 2);
|
161
|
-
|
174
|
+
n([
|
162
175
|
c({ type: Boolean, attribute: "no-padding" })
|
163
176
|
], s.prototype, "noPadding", 2);
|
164
|
-
|
177
|
+
n([
|
165
178
|
c({ type: Boolean, reflect: !0 })
|
166
179
|
], s.prototype, "open", 2);
|
167
|
-
|
168
|
-
|
180
|
+
n([
|
181
|
+
b()
|
169
182
|
], s.prototype, "onClose", 2);
|
170
|
-
|
183
|
+
n([
|
184
|
+
b()
|
185
|
+
], s.prototype, "renderFoot", 2);
|
186
|
+
n([
|
171
187
|
P("dialog")
|
172
188
|
], s.prototype, "$dialog", 2);
|
173
|
-
|
174
|
-
|
189
|
+
n([
|
190
|
+
E({ slot: "footer" })
|
175
191
|
], s.prototype, "footerEls", 2);
|
176
|
-
|
177
|
-
|
178
|
-
], s.prototype, "modal", 2);
|
179
|
-
i([
|
180
|
-
m()
|
181
|
-
], s.prototype, "renderFoot", 2);
|
182
|
-
i([
|
183
|
-
C("open")
|
192
|
+
n([
|
193
|
+
v("open")
|
184
194
|
], s.prototype, "handleOpenChange", 1);
|
185
195
|
export {
|
186
196
|
s as SkfDialog
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { css as a } from "lit";
|
2
|
-
const
|
2
|
+
const i = a`
|
3
3
|
/* stylelint-disable selector-class-pattern */
|
4
4
|
@layer components {
|
5
5
|
.dialog {
|
@@ -28,7 +28,7 @@ const o = a`
|
|
28
28
|
}
|
29
29
|
|
30
30
|
&::backdrop {
|
31
|
-
background-color:
|
31
|
+
background-color: oklch(from var(--skf-bg-color-neutral-7) l c h / 50%);
|
32
32
|
}
|
33
33
|
}
|
34
34
|
|
@@ -58,9 +58,9 @@ const o = a`
|
|
58
58
|
}
|
59
59
|
|
60
60
|
.dialog__body {
|
61
|
-
/* block-size: calc(100% - (var(--_skf-dialog-head-height) + (var(--skf-box-spacing) * 2))); */
|
62
61
|
display: flex;
|
63
62
|
flex-direction: column;
|
63
|
+
grid-area: body;
|
64
64
|
row-gap: var(--skf-spacing-100);
|
65
65
|
|
66
66
|
.dialog:not(.dialog--no-padding) & {
|
@@ -87,5 +87,5 @@ const o = a`
|
|
87
87
|
}
|
88
88
|
`;
|
89
89
|
export {
|
90
|
-
|
90
|
+
i as styles
|
91
91
|
};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { SkfElement } from '../../internal/components/skf-element.js';
|
2
2
|
import type { BorderColor } from '@skf-design-system/ui-assets';
|
3
3
|
import { type CSSResultGroup } from 'lit';
|
4
|
+
type SkfDividerColor = BorderColor;
|
4
5
|
/**
|
5
6
|
* The `<Divider>` component can separate items from each other, to visually emphasize their lack of a relationship between groups of information
|
6
7
|
*
|
@@ -12,18 +13,13 @@ import { type CSSResultGroup } from 'lit';
|
|
12
13
|
* @tagname skf-divider
|
13
14
|
*/
|
14
15
|
export declare class SkfDivider extends SkfElement {
|
15
|
-
#private;
|
16
16
|
static styles: CSSResultGroup;
|
17
|
-
/**
|
18
|
-
|
19
|
-
* @type { "emphasised" | "primary" | "secondary" | "tertiary" | "inverse" }
|
20
|
-
*/
|
21
|
-
color: BorderColor;
|
17
|
+
/** Defines the Divider color */
|
18
|
+
color: SkfDividerColor;
|
22
19
|
/** If true, renders a div for presentational purpose instead of the semantic hr-element */
|
23
20
|
decorative: boolean;
|
24
21
|
/** If true, renders the divider vertically */
|
25
22
|
vertical: boolean;
|
26
|
-
constructor();
|
27
23
|
connectedCallback(): void;
|
28
|
-
render(): import("lit").TemplateResult<1>;
|
29
24
|
}
|
25
|
+
export {};
|
@@ -1,54 +1,32 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import { SkfElement as n } from "../../internal/components/skf-element.js";
|
2
|
+
import { componentStyles as m } from "../../styles/component.styles.js";
|
3
|
+
import "lit";
|
4
|
+
import { property as o } from "lit/decorators.js";
|
5
|
+
import { styles as f } from "./divider.styles.js";
|
6
|
+
var h = Object.defineProperty, a = (l, s, c, v) => {
|
7
|
+
for (var t = void 0, r = l.length - 1, p; r >= 0; r--)
|
8
|
+
(p = l[r]) && (t = p(s, c, t) || t);
|
9
|
+
return t && h(s, c, t), t;
|
3
10
|
};
|
4
|
-
|
5
|
-
var c = (r, e, t) => (m(r, e, "read from private field"), t ? t.call(r) : e.get(r)), f = (r, e, t) => e.has(r) ? h("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), y = (r, e, t, a) => (m(r, e, "write to private field"), a ? a.call(r, t) : e.set(r, t), t);
|
6
|
-
import { SkfElement as u } from "../../internal/components/skf-element.js";
|
7
|
-
import b from "../../styles/component.styles.js";
|
8
|
-
import { html as C } from "lit";
|
9
|
-
import { property as n } from "lit/decorators.js";
|
10
|
-
import { classMap as _ } from "lit/directives/class-map.js";
|
11
|
-
import { styles as x } from "./divider.styles.js";
|
12
|
-
var B = Object.defineProperty, p = (r, e, t, a) => {
|
13
|
-
for (var o = void 0, l = r.length - 1, v; l >= 0; l--)
|
14
|
-
(v = r[l]) && (o = v(e, t, o) || o);
|
15
|
-
return o && B(e, t, o), o;
|
16
|
-
}, i;
|
17
|
-
const d = class d extends u {
|
11
|
+
const i = class i extends n {
|
18
12
|
constructor() {
|
19
|
-
super();
|
20
|
-
f(this, i);
|
21
|
-
this.color = "primary", this.decorative = !1, this.vertical = !1, y(this, i, this.attachInternals());
|
13
|
+
super(...arguments), this.color = "primary", this.decorative = !1, this.vertical = !1;
|
22
14
|
}
|
23
15
|
connectedCallback() {
|
24
|
-
super.connectedCallback(),
|
25
|
-
}
|
26
|
-
render() {
|
27
|
-
return C`
|
28
|
-
<div
|
29
|
-
class=${_({
|
30
|
-
divider: !0,
|
31
|
-
"divider--color-emphasised": this.color === "emphasised",
|
32
|
-
"divider--color-inverse": this.color === "inverse",
|
33
|
-
"divider--color-secondary": this.color === "secondary",
|
34
|
-
"divider--color-tertiary": this.color === "tertiary",
|
35
|
-
"divider--vertical": this.vertical
|
36
|
-
})}
|
37
|
-
></div>
|
38
|
-
`;
|
16
|
+
super.connectedCallback(), this.role = this.decorative ? "generic" : "separator", this.ariaOrientation = this.vertical ? "vertical" : "horizontal";
|
39
17
|
}
|
40
18
|
};
|
41
|
-
i
|
42
|
-
let
|
43
|
-
|
44
|
-
|
45
|
-
],
|
46
|
-
|
47
|
-
|
48
|
-
],
|
49
|
-
|
50
|
-
|
51
|
-
],
|
19
|
+
i.styles = [m, f];
|
20
|
+
let e = i;
|
21
|
+
a([
|
22
|
+
o({ reflect: !0 })
|
23
|
+
], e.prototype, "color");
|
24
|
+
a([
|
25
|
+
o({ type: Boolean })
|
26
|
+
], e.prototype, "decorative");
|
27
|
+
a([
|
28
|
+
o({ type: Boolean, reflect: !0 })
|
29
|
+
], e.prototype, "vertical");
|
52
30
|
export {
|
53
|
-
|
31
|
+
e as SkfDivider
|
54
32
|
};
|