@skf-design-system/ui-components 1.0.1-beta.1 → 1.0.2-beta.0
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 +1 -18
- package/dist/components/accordion/accordion.component.d.ts +4 -4
- package/dist/components/accordion/accordion.component.js +8 -8
- package/dist/components/alert/alert.component.d.ts +8 -9
- package/dist/components/alert/alert.component.js +7 -7
- package/dist/components/breadcrumb/breadcrumb.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 +8 -8
- package/dist/components/checkbox/checkbox.component.js +3 -3
- package/dist/components/collapse/collapse.component.js +1 -1
- 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 +13 -5
- package/dist/components/date-picker-input/datepicker-input.component.js +263 -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 +18 -28
- package/dist/components/dialog/dialog.component.js +89 -79
- 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 +57 -0
- package/dist/components/drawer/drawer.component.js +124 -0
- package/dist/components/drawer/drawer.d.ts +8 -0
- package/dist/components/drawer/drawer.js +6 -0
- package/dist/components/drawer/drawer.styles.d.ts +1 -0
- package/dist/components/drawer/drawer.styles.js +71 -0
- package/dist/components/header/header.component.d.ts +45 -0
- package/dist/components/header/header.component.js +110 -0
- package/dist/components/header/header.d.ts +8 -0
- package/dist/components/header/header.js +6 -0
- package/dist/components/header/header.styles.d.ts +1 -0
- package/dist/components/header/header.styles.js +68 -0
- package/dist/components/heading/heading.component.d.ts +6 -12
- package/dist/components/heading/heading.component.js +11 -11
- 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 +1 -1
- package/dist/components/input/input.component.d.ts +2 -2
- package/dist/components/input/input.component.js +3 -3
- 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.js +1 -0
- package/dist/components/link/link.styles.js +24 -20
- package/dist/components/menu/menu.component.d.ts +4 -5
- package/dist/components/menu/menu.component.js +1 -1
- 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/nav-item/nav-item.component.d.ts +20 -0
- package/dist/components/nav-item/nav-item.component.js +38 -0
- package/dist/components/nav-item/nav-item.d.ts +8 -0
- package/dist/components/nav-item/nav-item.js +6 -0
- package/dist/components/nav-item/nav-item.styles.d.ts +1 -0
- package/dist/components/nav-item/nav-item.styles.js +39 -0
- package/dist/components/popover/popover.component.d.ts +5 -6
- package/dist/components/popover/popover.component.js +19 -19
- package/dist/components/radio/radio.component.d.ts +10 -6
- package/dist/components/radio/radio.component.js +10 -10
- 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.component.d.ts +32 -0
- package/dist/components/segmented-button/segmented-button.d.ts +8 -0
- package/dist/components/segmented-button/segmented-button.styles.d.ts +1 -0
- package/dist/components/segmented-button-item/segmented-button-item.component.d.ts +36 -0
- package/dist/components/segmented-button-item/segmented-button-item.d.ts +8 -0
- package/dist/components/segmented-button-item/segmented-button-item.styles.d.ts +1 -0
- package/dist/components/select/select.component.js +2 -2
- package/dist/components/select/select.controllers.d.ts +20 -9
- package/dist/components/select/select.controllers.js +27 -22
- package/dist/components/select-option/select-option.controllers.d.ts +11 -5
- package/dist/components/stepper/stepper.component.d.ts +2 -1
- package/dist/components/stepper-item/stepper-item.component.js +2 -2
- package/dist/components/switch/switch.component.d.ts +7 -6
- package/dist/components/switch/switch.component.js +7 -7
- package/dist/components/tag/tag.component.d.ts +4 -2
- package/dist/components/tag/tag.component.js +6 -6
- package/dist/components/textarea/textarea.component.js +7 -7
- package/dist/components/toast/toast.component.d.ts +1 -1
- package/dist/components/tooltip/tooltip.component.d.ts +5 -6
- package/dist/components/tooltip/tooltip.component.js +11 -11
- package/dist/custom-elements.json +2477 -1745
- package/dist/index.d.ts +4 -0
- package/dist/index.js +82 -70
- package/dist/internal/base-classes/popover/popover.base.d.ts +17 -7
- package/dist/internal/base-classes/popover/popover.base.js +119 -75
- package/dist/internal/base-classes/popover/popover.styles.js +14 -1
- 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/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/styles/form-field.styles.js +11 -6
- package/dist/styles/global.css +1 -1
- package/dist/types/jsx/custom-element-jsx.d.ts +642 -1261
- package/dist/types/vue/index.d.ts +422 -267
- package/dist/vscode.html-custom-data.json +805 -525
- package/dist/web-types.json +928 -653
- package/package.json +41 -51
- 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/index.d.ts
CHANGED
@@ -8,6 +8,8 @@ export { default as SkfDatePickerInput } from './components/date-picker-input/da
|
|
8
8
|
export { default as SkfDatePicker } from './components/date-picker/datepicker.js';
|
9
9
|
export { default as SkfDialog } from './components/dialog/dialog.js';
|
10
10
|
export { default as SkfDivider } from './components/divider/divider.js';
|
11
|
+
export { default as SkfDrawer } from './components/drawer/drawer.js';
|
12
|
+
export { default as SkfHeader } from './components/header/header.js';
|
11
13
|
export { default as SkfHeading } from './components/heading/heading.js';
|
12
14
|
export { default as SkfIcon } from './components/icon/icon.js';
|
13
15
|
export { default as SkfInput } from './components/input/input.js';
|
@@ -16,6 +18,8 @@ export { default as SkfLoader } from './components/loader/loader.js';
|
|
16
18
|
export { default as SkfLogo } from './components/logo/logo.js';
|
17
19
|
export { default as SkfMenuItem } from './components/menu-item/menu-item.js';
|
18
20
|
export { default as SkfMenu } from './components/menu/menu.js';
|
21
|
+
export { default as SkfNavItem } from './components/nav-item/nav-item.js';
|
22
|
+
export { default as SkfNav } from './components/nav/nav.js';
|
19
23
|
export { default as SkfPopover } from './components/popover/popover.js';
|
20
24
|
export { default as SkfProgress } from './components/progress/progress.js';
|
21
25
|
export { default as SkfRadio } from './components/radio/radio.js';
|
package/dist/index.js
CHANGED
@@ -8,6 +8,8 @@ import "./components/date-picker-input/datepicker-input.js";
|
|
8
8
|
import "./components/date-picker/datepicker.js";
|
9
9
|
import "./components/dialog/dialog.js";
|
10
10
|
import "./components/divider/divider.js";
|
11
|
+
import "./components/drawer/drawer.js";
|
12
|
+
import "./components/header/header.js";
|
11
13
|
import "./components/heading/heading.js";
|
12
14
|
import "./components/icon/icon.js";
|
13
15
|
import "./components/input/input.js";
|
@@ -16,6 +18,8 @@ import "./components/loader/loader.js";
|
|
16
18
|
import "./components/logo/logo.js";
|
17
19
|
import "./components/menu-item/menu-item.js";
|
18
20
|
import "./components/menu/menu.js";
|
21
|
+
import "./components/nav-item/nav-item.js";
|
22
|
+
import "./components/nav/nav.js";
|
19
23
|
import "./components/popover/popover.js";
|
20
24
|
import "./components/progress/progress.js";
|
21
25
|
import "./components/radio/radio.js";
|
@@ -32,75 +36,83 @@ import "./components/tag/tag.js";
|
|
32
36
|
import "./components/textarea/textarea.js";
|
33
37
|
import "./components/toast/toast.js";
|
34
38
|
import "./components/tooltip/tooltip.js";
|
35
|
-
import { SkfAccordion as
|
36
|
-
import { SkfAlert as
|
37
|
-
import { SkfButton as
|
38
|
-
import { SkfCard as
|
39
|
-
import { SkfCheckbox as
|
40
|
-
import { SkfCollapse as
|
41
|
-
import { SkfDatePickerInput as
|
42
|
-
import { SkfDatePicker as
|
43
|
-
import { SkfDialog as
|
44
|
-
import { SkfDivider as
|
45
|
-
import {
|
46
|
-
import {
|
47
|
-
import {
|
48
|
-
import {
|
49
|
-
import {
|
50
|
-
import {
|
51
|
-
import {
|
52
|
-
import {
|
53
|
-
import {
|
54
|
-
import {
|
55
|
-
import {
|
56
|
-
import {
|
57
|
-
import {
|
58
|
-
import {
|
59
|
-
import {
|
60
|
-
import {
|
61
|
-
import {
|
62
|
-
import {
|
63
|
-
import {
|
64
|
-
import {
|
65
|
-
import {
|
66
|
-
import {
|
67
|
-
import {
|
68
|
-
import {
|
69
|
-
import {
|
39
|
+
import { SkfAccordion as z } from "./components/accordion/accordion.component.js";
|
40
|
+
import { SkfAlert as F } from "./components/alert/alert.component.js";
|
41
|
+
import { SkfButton as K } from "./components/button/button.component.js";
|
42
|
+
import { SkfCard as U } from "./components/card/card.component.js";
|
43
|
+
import { SkfCheckbox as W } from "./components/checkbox/checkbox.component.js";
|
44
|
+
import { SkfCollapse as Y } from "./components/collapse/collapse.component.js";
|
45
|
+
import { SkfDatePickerInput as _ } from "./components/date-picker-input/datepicker-input.component.js";
|
46
|
+
import { SkfDatePicker as oo } from "./components/date-picker/datepicker.component.js";
|
47
|
+
import { SkfDialog as to } from "./components/dialog/dialog.component.js";
|
48
|
+
import { SkfDivider as fo } from "./components/divider/divider.component.js";
|
49
|
+
import { SkfDrawer as eo } from "./components/drawer/drawer.component.js";
|
50
|
+
import { SkfHeader as So } from "./components/header/header.component.js";
|
51
|
+
import { SkfHeading as xo } from "./components/heading/heading.component.js";
|
52
|
+
import { SkfIcon as no } from "./components/icon/icon.component.js";
|
53
|
+
import { SkfInput as lo } from "./components/input/input.component.js";
|
54
|
+
import { SkfLink as To } from "./components/link/link.component.js";
|
55
|
+
import { SkfLoader as Io } from "./components/loader/loader.component.js";
|
56
|
+
import { SkfLogo as go } from "./components/logo/logo.component.js";
|
57
|
+
import { SkfMenuItem as Po } from "./components/menu-item/menu-item.component.js";
|
58
|
+
import { SkfMenu as Ao } from "./components/menu/menu.component.js";
|
59
|
+
import { SkfNavItem as Oo } from "./components/nav-item/nav-item.component.js";
|
60
|
+
import { SkfNav as Lo } from "./components/nav/nav.component.js";
|
61
|
+
import { SkfPopover as wo } from "./components/popover/popover.component.js";
|
62
|
+
import { SkfProgress as Mo } from "./components/progress/progress.component.js";
|
63
|
+
import { SkfRadio as Bo } from "./components/radio/radio.component.js";
|
64
|
+
import { SkfSelectOptionGroup as jo } from "./components/select-option-group/select-option-group.component.js";
|
65
|
+
import { SkfSelectOption as yo } from "./components/select-option/select-option.component.js";
|
66
|
+
import { SkfSelect as Eo } from "./components/select/select.component.js";
|
67
|
+
import { SkfStepperItem as Jo } from "./components/stepper-item/stepper-item.component.js";
|
68
|
+
import { SkfStepper as Qo } from "./components/stepper/stepper.component.js";
|
69
|
+
import { SkfSwitch as Vo } from "./components/switch/switch.component.js";
|
70
|
+
import { SkfTabGroup as Xo } from "./components/tab-group/tab-group.component.js";
|
71
|
+
import { SkfTabPanel as Zo } from "./components/tab-panel/tab-panel.component.js";
|
72
|
+
import { SkfTab as $o } from "./components/tab/tab.component.js";
|
73
|
+
import { SkfTag as rr } from "./components/tag/tag.component.js";
|
74
|
+
import { SkfTextArea as pr } from "./components/textarea/textarea.component.js";
|
75
|
+
import { SkfToast as mr } from "./components/toast/toast.component.js";
|
76
|
+
import { SkfTooltip as ir } from "./components/tooltip/tooltip.component.js";
|
77
|
+
import { SkfAccordionItem as kr } from "./components/accordion/accordion-item.js";
|
70
78
|
export {
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
Mo as
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
79
|
+
z as SkfAccordion,
|
80
|
+
kr as SkfAccordionItem,
|
81
|
+
F as SkfAlert,
|
82
|
+
K as SkfButton,
|
83
|
+
U as SkfCard,
|
84
|
+
W as SkfCheckbox,
|
85
|
+
Y as SkfCollapse,
|
86
|
+
oo as SkfDatePicker,
|
87
|
+
_ as SkfDatePickerInput,
|
88
|
+
to as SkfDialog,
|
89
|
+
fo as SkfDivider,
|
90
|
+
eo as SkfDrawer,
|
91
|
+
So as SkfHeader,
|
92
|
+
xo as SkfHeading,
|
93
|
+
no as SkfIcon,
|
94
|
+
lo as SkfInput,
|
95
|
+
To as SkfLink,
|
96
|
+
Io as SkfLoader,
|
97
|
+
go as SkfLogo,
|
98
|
+
Ao as SkfMenu,
|
99
|
+
Po as SkfMenuItem,
|
100
|
+
Lo as SkfNav,
|
101
|
+
Oo as SkfNavItem,
|
102
|
+
yo as SkfOption,
|
103
|
+
jo as SkfOptionGroup,
|
104
|
+
wo as SkfPopover,
|
105
|
+
Mo as SkfProgress,
|
106
|
+
Bo as SkfRadio,
|
107
|
+
Eo as SkfSelect,
|
108
|
+
Qo as SkfStepper,
|
109
|
+
Jo as SkfStepperItem,
|
110
|
+
Vo as SkfSwitch,
|
111
|
+
$o as SkfTab,
|
112
|
+
Xo as SkfTabGoup,
|
113
|
+
Zo as SkfTabPanel,
|
114
|
+
rr as SkfTag,
|
115
|
+
pr as SkfTextArea,
|
116
|
+
mr as SkfToast,
|
117
|
+
ir as SkfTooltip
|
106
118
|
};
|
@@ -5,25 +5,35 @@ import { type CSSResultGroup } from 'lit';
|
|
5
5
|
export declare class SkfPopoverBase extends SkfElement {
|
6
6
|
static styles: CSSResultGroup;
|
7
7
|
static classMap: {};
|
8
|
-
|
8
|
+
$popover: this;
|
9
9
|
placement: Placement;
|
10
10
|
variant: 'dropdown' | 'popup' | 'tooltip';
|
11
11
|
anchor?: string;
|
12
|
+
isOpen: boolean;
|
12
13
|
offset: number;
|
13
14
|
$anchor?: Element | HTMLElement | null;
|
14
15
|
arrow: boolean;
|
15
|
-
$popover: HTMLElement;
|
16
|
-
$arrow: HTMLElement;
|
17
16
|
/** @internal */
|
17
|
+
triggerEvent: 'mouseenter' | 'click';
|
18
|
+
$arrow: HTMLElement;
|
19
|
+
protected abortEventsController: AbortController;
|
20
|
+
protected signal: AbortSignal;
|
18
21
|
protected popoverController: PopoverController;
|
19
|
-
|
22
|
+
constructor();
|
23
|
+
disconnectedCallback(): void;
|
24
|
+
protected _toggleOpen: (newValue?: boolean) => void;
|
20
25
|
private _handleToggle;
|
21
|
-
handleToggleOpen: () => void
|
26
|
+
handleToggleOpen: () => Promise<void>;
|
27
|
+
handleAnchorEl(): void;
|
22
28
|
handleAnchorChange: () => Promise<void>;
|
23
29
|
reposition: () => Promise<void>;
|
24
|
-
open: () =>
|
25
|
-
close: () =>
|
30
|
+
open: (e: Event) => void;
|
31
|
+
close: () => void;
|
32
|
+
/** @internal */
|
26
33
|
addEventListeners($element: HTMLElement | Element): void;
|
34
|
+
/** @internal */
|
27
35
|
removeEventListeners($element: HTMLElement | Element): void;
|
28
36
|
render(): import("lit").TemplateResult<1>;
|
37
|
+
/** @internal helper */
|
38
|
+
private _containsFocusableElement;
|
29
39
|
}
|
@@ -1,116 +1,160 @@
|
|
1
|
-
import { flip as
|
2
|
-
import { SkfElement as
|
3
|
-
import { PopoverController as
|
4
|
-
import {
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import {
|
1
|
+
import { flip as C, offset as S, arrow as x, computePosition as A } from "@floating-ui/dom";
|
2
|
+
import { SkfElement as _ } from "../../components/skf-element.js";
|
3
|
+
import { PopoverController as P } from "../../controllers/popover.controller.js";
|
4
|
+
import { uuid as w } from "../../helpers/uuid.js";
|
5
|
+
import { watch as f } from "../../helpers/watch.js";
|
6
|
+
import L from "../../../styles/component.styles.js";
|
7
|
+
import { nothing as F, html as b } from "lit";
|
8
|
+
import { property as m, state as c, query as M } from "lit/decorators.js";
|
8
9
|
import { classMap as j } from "lit/directives/class-map.js";
|
9
|
-
import { styles as
|
10
|
-
var
|
11
|
-
for (var
|
12
|
-
(
|
13
|
-
return
|
14
|
-
},
|
15
|
-
const
|
10
|
+
import { styles as T } from "./popover.styles.js";
|
11
|
+
var R = Object.defineProperty, q = Object.getOwnPropertyDescriptor, r = (u, t, s, i) => {
|
12
|
+
for (var e = i > 1 ? void 0 : i ? q(t, s) : t, n = u.length - 1, a; n >= 0; n--)
|
13
|
+
(a = u[n]) && (e = (i ? a(t, s, e) : a(e)) || e);
|
14
|
+
return i && e && R(t, s, e), e;
|
15
|
+
}, l;
|
16
|
+
const o = (l = class extends _ {
|
16
17
|
constructor() {
|
17
|
-
super(
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
this
|
22
|
-
|
23
|
-
|
24
|
-
fill: "forwards"
|
25
|
-
});
|
18
|
+
super(), this.$popover = this, this.placement = "top", this.variant = "popup", this.isOpen = !1, this.offset = 0, this.arrow = !1, this.triggerEvent = "mouseenter", this.abortEventsController = new AbortController(), this.signal = this.abortEventsController.signal, this.popoverController = new P(this), this._toggleOpen = (t) => {
|
19
|
+
this.isOpen = t ?? !this.isOpen;
|
20
|
+
}, this._handleToggle = (t) => {
|
21
|
+
const s = t.newState === "open";
|
22
|
+
this.isOpen = s, this.emit(s ? "skf-opened" : "skf-closed");
|
23
|
+
}, this.handleToggleOpen = async () => {
|
24
|
+
this.$anchor && (this.isOpen ? (this.$popover.togglePopover(!0), this.$popover.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 250, fill: "forwards" })) : (await this.$popover.animate([{ opacity: 0 }], { duration: 150, fill: "forwards" }).finished, this.$popover.togglePopover(this.isOpen)));
|
26
25
|
}, this.handleAnchorChange = async () => {
|
27
26
|
if (!this.anchor) return;
|
28
27
|
await this.popoverController.stop(), this.$anchor && this.removeEventListeners(this.$anchor);
|
29
28
|
const t = this.getRootNode();
|
30
29
|
this.$anchor = t.getElementById(this.anchor), this.$anchor && (this.addEventListeners(this.$anchor), this.popoverController.start());
|
31
30
|
}, this.reposition = async () => {
|
32
|
-
var n,
|
31
|
+
var n, a, h;
|
33
32
|
if (!this.$anchor) return;
|
34
|
-
const t = [
|
35
|
-
this.arrow && t.push(
|
36
|
-
const { x:
|
33
|
+
const t = [C(), S(this.offset)];
|
34
|
+
this.arrow && t.push(x({ element: this.$arrow }));
|
35
|
+
const { x: s, y: i, middlewareData: e } = await A(this.$anchor, this.$popover, {
|
37
36
|
placement: this.placement,
|
38
37
|
middleware: t,
|
39
38
|
strategy: "fixed"
|
40
39
|
});
|
41
40
|
if (Object.assign(this.$popover.style, {
|
42
|
-
left: `${String(
|
43
|
-
top: `${String(
|
41
|
+
left: `${String(s)}px`,
|
42
|
+
top: `${String(i)}px`
|
44
43
|
}), this.arrow) {
|
45
|
-
const
|
44
|
+
const d = this.placement.split("-")[0], p = { top: "bottom", right: "left", bottom: "top", left: "right" }[d] ?? "", g = (n = e.flip) == null ? void 0 : n.index, v = (a = e.arrow) == null ? void 0 : a.x, $ = (h = e.arrow) == null ? void 0 : h.y, y = typeof v == "number" ? `${String(v)}px` : "", E = typeof $ == "number" ? `${String($)}px` : "", O = {
|
46
45
|
bottom: 45,
|
47
46
|
right: 135,
|
48
47
|
top: 225,
|
49
48
|
left: 315
|
50
49
|
};
|
51
50
|
Object.assign(this.$arrow.style, {
|
52
|
-
top:
|
53
|
-
[this.placement.includes("left") ? "right" : "left"]:
|
54
|
-
[g ?
|
55
|
-
rotate: `${(
|
51
|
+
top: E,
|
52
|
+
[this.placement.includes("left") ? "right" : "left"]: y,
|
53
|
+
[g ? d : p]: "calc(var(--_skf-popover-arrow-size) * -1)",
|
54
|
+
rotate: `${(O[p] + (g ? 180 : 0)).toString()}deg`
|
56
55
|
});
|
57
56
|
}
|
58
|
-
}, this.open = () =>
|
57
|
+
}, this.open = (t) => {
|
58
|
+
t.stopPropagation(), this._toggleOpen(!0);
|
59
|
+
}, this.close = () => {
|
60
|
+
this._toggleOpen(!1);
|
61
|
+
}, this.setAttribute("popover", "");
|
62
|
+
}
|
63
|
+
disconnectedCallback() {
|
64
|
+
super.disconnectedCallback(), this.abortEventsController.abort();
|
59
65
|
}
|
66
|
+
handleAnchorEl() {
|
67
|
+
if (!this.$anchor) return;
|
68
|
+
const t = this._containsFocusableElement(this);
|
69
|
+
this.$anchor.addEventListener(
|
70
|
+
"focusout",
|
71
|
+
(s) => {
|
72
|
+
const i = this.contains(s.relatedTarget);
|
73
|
+
t && i || this.close();
|
74
|
+
},
|
75
|
+
{ signal: this.signal }
|
76
|
+
), this.addEventListener("focusout", this.close), this.$anchor.addEventListener("focusin", this.open, { signal: this.signal }), this.$anchor.setAttribute("aria-controls", w(this.$anchor.id)), this.$anchor.setAttribute("aria-has-popup", "true"), this.$popover.id = w(this.$anchor.id);
|
77
|
+
}
|
78
|
+
/** @internal */
|
60
79
|
addEventListeners(t) {
|
61
80
|
throw new Error(`Cannot add eventListeners for ${t.id}. Method not implemented.`);
|
62
81
|
}
|
82
|
+
/** @internal */
|
63
83
|
removeEventListeners(t) {
|
64
84
|
throw new Error(`Cannot remove eventListeners for ${t.id}. Method not implemented.`);
|
65
85
|
}
|
66
86
|
render() {
|
67
|
-
|
87
|
+
var t;
|
88
|
+
return (t = this.$anchor) == null || t.setAttribute("aria-expanded", this.isOpen ? "true" : "false"), b`
|
68
89
|
<div
|
69
90
|
@toggle=${this._handleToggle}
|
70
|
-
class=${j({ popover: !0, ...
|
91
|
+
class=${j({ popover: !0, ...l.classMap })}
|
71
92
|
id="popover"
|
72
|
-
popover
|
73
93
|
>
|
74
94
|
<slot></slot>
|
75
|
-
${this.arrow ?
|
95
|
+
${this.arrow ? b`<div class="popover__arrow" id="arrow"></div>` : F}
|
76
96
|
</div>
|
77
97
|
`;
|
78
98
|
}
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
],
|
83
|
-
|
84
|
-
|
85
|
-
],
|
86
|
-
|
87
|
-
|
88
|
-
]
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
],
|
101
|
-
|
102
|
-
|
103
|
-
],
|
104
|
-
|
105
|
-
|
106
|
-
],
|
107
|
-
|
108
|
-
|
109
|
-
],
|
110
|
-
|
111
|
-
|
112
|
-
],
|
113
|
-
|
99
|
+
/** @internal helper */
|
100
|
+
_containsFocusableElement(t) {
|
101
|
+
return e(t, [
|
102
|
+
"a[href]",
|
103
|
+
"button:not([disabled])",
|
104
|
+
"input:not([disabled])",
|
105
|
+
"select:not([disabled])",
|
106
|
+
"textarea:not([disabled])",
|
107
|
+
'[tabindex]:not([tabindex="-1"])'
|
108
|
+
]).length > 0;
|
109
|
+
function e(n, a) {
|
110
|
+
const h = Array.from(
|
111
|
+
n.querySelectorAll(a.join(", "))
|
112
|
+
), d = Array.from(n.querySelectorAll("*")).map((p) => p.shadowRoot).filter((p) => p !== null);
|
113
|
+
for (const p of d)
|
114
|
+
h.push(
|
115
|
+
...e(p, a)
|
116
|
+
);
|
117
|
+
return h;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}, l.styles = [L, T], l.classMap = {}, l);
|
121
|
+
r([
|
122
|
+
m()
|
123
|
+
], o.prototype, "placement", 2);
|
124
|
+
r([
|
125
|
+
m()
|
126
|
+
], o.prototype, "variant", 2);
|
127
|
+
r([
|
128
|
+
m()
|
129
|
+
], o.prototype, "anchor", 2);
|
130
|
+
r([
|
131
|
+
c()
|
132
|
+
], o.prototype, "isOpen", 2);
|
133
|
+
r([
|
134
|
+
c()
|
135
|
+
], o.prototype, "offset", 2);
|
136
|
+
r([
|
137
|
+
c()
|
138
|
+
], o.prototype, "$anchor", 2);
|
139
|
+
r([
|
140
|
+
c()
|
141
|
+
], o.prototype, "arrow", 2);
|
142
|
+
r([
|
143
|
+
c()
|
144
|
+
], o.prototype, "triggerEvent", 2);
|
145
|
+
r([
|
146
|
+
M("#arrow")
|
147
|
+
], o.prototype, "$arrow", 2);
|
148
|
+
r([
|
149
|
+
f("isOpen", { afterUpdate: !0 })
|
150
|
+
], o.prototype, "handleToggleOpen", 2);
|
151
|
+
r([
|
152
|
+
f("$anchor")
|
153
|
+
], o.prototype, "handleAnchorEl", 1);
|
154
|
+
r([
|
155
|
+
f("anchor")
|
156
|
+
], o.prototype, "handleAnchorChange", 2);
|
157
|
+
let H = o;
|
114
158
|
export {
|
115
|
-
|
159
|
+
H as SkfPopoverBase
|
116
160
|
};
|
@@ -2,13 +2,26 @@ import { css as o } from "lit";
|
|
2
2
|
const e = o`
|
3
3
|
/* stylelint-disable selector-class-pattern */
|
4
4
|
@layer components {
|
5
|
-
|
5
|
+
:host {
|
6
6
|
background-color: var(--skf-bg-color-neutral-1);
|
7
7
|
border: none;
|
8
8
|
border-radius: var(--skf-border-radius-sm);
|
9
9
|
box-shadow: var(--skf-shadow-md);
|
10
|
+
contain: layout;
|
11
|
+
height: fit-content;
|
12
|
+
margin: 0;
|
10
13
|
opacity: 0;
|
11
14
|
overflow: visible;
|
15
|
+
width: fit-content;
|
16
|
+
}
|
17
|
+
|
18
|
+
:host(:not(:popover-open)) {
|
19
|
+
display: none;
|
20
|
+
}
|
21
|
+
|
22
|
+
#popover {
|
23
|
+
height: 100%;
|
24
|
+
width: 100%;
|
12
25
|
}
|
13
26
|
|
14
27
|
.popover__arrow {
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import type { SkfNav } from '../../components/nav/nav.component.js';
|
2
|
+
type InputControllerHost = SkfNav;
|
3
|
+
export declare class ElementOverflowController {
|
4
|
+
host: InputControllerHost;
|
5
|
+
resizeObserver?: ResizeObserver;
|
6
|
+
watchedContainerEl?: HTMLElement;
|
7
|
+
isFullyVisible: boolean;
|
8
|
+
constructor(host: InputControllerHost);
|
9
|
+
initResizeObserver(el?: HTMLElement): void;
|
10
|
+
_checkVisibility: () => void;
|
11
|
+
disconnect(): void;
|
12
|
+
}
|
13
|
+
export {};
|
@@ -1,14 +1,19 @@
|
|
1
|
-
import type {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
2
|
+
/**
|
3
|
+
* Workaround for storybook helper not being able to import types
|
4
|
+
* E.g type ControllerHost = SkfPopover;
|
5
|
+
*/
|
6
|
+
interface ControllerHostProps {
|
7
|
+
$anchor?: Element | HTMLElement | null;
|
8
|
+
$popover?: Element | HTMLElement | null;
|
9
|
+
reposition: () => Promise<void>;
|
10
|
+
}
|
6
11
|
export declare class PopoverController implements ReactiveController {
|
7
|
-
host?:
|
12
|
+
host?: ReactiveControllerHost & Partial<ControllerHostProps>;
|
8
13
|
private cleanup;
|
9
14
|
private active;
|
10
15
|
private autoStart;
|
11
|
-
constructor(host:
|
16
|
+
constructor(host: ReactiveControllerHost, autoStart?: boolean);
|
12
17
|
hostConnected(): void;
|
13
18
|
hostDisconnected(): void;
|
14
19
|
start(): void;
|
@@ -1,8 +1,7 @@
|
|
1
|
-
import "
|
2
|
-
|
3
|
-
class p {
|
1
|
+
import { autoUpdate as h } from "@floating-ui/dom";
|
2
|
+
class c {
|
4
3
|
constructor(t, o = !0) {
|
5
|
-
this.active = !1, this.autoStart = !0, this.host = t
|
4
|
+
this.active = !1, this.autoStart = !0, (this.host = t).addController(this), this.autoStart = o;
|
6
5
|
}
|
7
6
|
hostConnected() {
|
8
7
|
var t;
|
@@ -18,15 +17,11 @@ class p {
|
|
18
17
|
});
|
19
18
|
}
|
20
19
|
start() {
|
21
|
-
var
|
22
|
-
const t = (
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
}
|
27
|
-
this.active || (this.cleanup = n(t, o, () => {
|
28
|
-
var s;
|
29
|
-
(s = this.host) == null || s.reposition().catch((i) => {
|
20
|
+
var s, e;
|
21
|
+
const t = (s = this.host) == null ? void 0 : s.$anchor, o = (e = this.host) == null ? void 0 : e.$popover;
|
22
|
+
!t || !o || this.active || (o.popover = "manual", this.cleanup = h(t, o, () => {
|
23
|
+
var r;
|
24
|
+
(r = this.host) != null && r.reposition && this.host.reposition().catch((i) => {
|
30
25
|
console.error(i);
|
31
26
|
});
|
32
27
|
}), this.active = !0);
|
@@ -40,5 +35,5 @@ class p {
|
|
40
35
|
}
|
41
36
|
}
|
42
37
|
export {
|
43
|
-
|
38
|
+
c as PopoverController
|
44
39
|
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/**
|
2
|
+
* Generate a unique id based on a string
|
3
|
+
*
|
4
|
+
* @param str - string to base hash on
|
5
|
+
* @returns string - a unique prefixed id
|
6
|
+
*/
|
7
|
+
export declare function uuid(str: string): string;
|
8
|
+
/**
|
9
|
+
* @describe - cyrb53 - A simple hash function for strings
|
10
|
+
*
|
11
|
+
* @param str - string to hash
|
12
|
+
* @param seed
|
13
|
+
* @returns - a 12 digit number
|
14
|
+
*/
|
15
|
+
export declare const hash: (str: string, seed?: number) => number;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
function r(u) {
|
2
|
+
const i = n(u);
|
3
|
+
return `skf-uuid-${String(i)}`;
|
4
|
+
}
|
5
|
+
const n = (u, i = 0) => {
|
6
|
+
let t = 3735928559 ^ i, h = 1103547991 ^ i;
|
7
|
+
for (let l = 0, a; l < u.length; l++)
|
8
|
+
a = u.charCodeAt(l), t = Math.imul(t ^ a, 2654435761), h = Math.imul(h ^ a, 1597334677);
|
9
|
+
return t = Math.imul(t ^ t >>> 16, 2246822507), t ^= Math.imul(h ^ h >>> 13, 3266489909), h = Math.imul(h ^ h >>> 16, 2246822507), h ^= Math.imul(t ^ t >>> 13, 3266489909), 4294967296 * (2097151 & h) + (t >>> 0);
|
10
|
+
};
|
11
|
+
export {
|
12
|
+
n as hash,
|
13
|
+
r as uuid
|
14
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|