@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
@@ -0,0 +1,56 @@
|
|
1
|
+
import "../icon/icon.js";
|
2
|
+
import { SkfElement as n } from "../../internal/components/skf-element.js";
|
3
|
+
import { componentStyles as f } from "../../styles/component.styles.js";
|
4
|
+
import { LitElement as u, nothing as m, html as c } from "lit";
|
5
|
+
import { property as r, state as v } from "lit/decorators.js";
|
6
|
+
import { ifDefined as l } from "lit/directives/if-defined.js";
|
7
|
+
import { styles as y } from "./segmented-button-item.styles.js";
|
8
|
+
var b = Object.defineProperty, i = (a, p, d, k) => {
|
9
|
+
for (var e = void 0, o = a.length - 1, h; o >= 0; o--)
|
10
|
+
(h = a[o]) && (e = h(p, d, e) || e);
|
11
|
+
return e && b(p, d, e), e;
|
12
|
+
};
|
13
|
+
const s = class s extends n {
|
14
|
+
constructor() {
|
15
|
+
super(), this.disabled = !1, this.selected = !1, this.value = "", this.isMultiple = !1, this._handleClick = () => {
|
16
|
+
this.emit("skf-segmented-button-item-select", {
|
17
|
+
detail: {
|
18
|
+
item: this
|
19
|
+
}
|
20
|
+
});
|
21
|
+
}, this.addEventListener("click", this._handleClick);
|
22
|
+
}
|
23
|
+
render() {
|
24
|
+
return c`
|
25
|
+
<button
|
26
|
+
?disabled=${this.disabled}
|
27
|
+
aria-checked=${l(this.isMultiple ? void 0 : this.selected ? "true" : "false")}
|
28
|
+
aria-pressed=${l(this.isMultiple ? this.selected ? "true" : "false" : void 0)}
|
29
|
+
id="root"
|
30
|
+
role=${l(this.isMultiple ? void 0 : "radio")}
|
31
|
+
type="button"
|
32
|
+
value=${this.value}
|
33
|
+
>
|
34
|
+
${this.selected ? c`<skf-icon color="emphasised" name="check" size="sm"></skf-icon>` : m}
|
35
|
+
<slot></slot>
|
36
|
+
</button>
|
37
|
+
`;
|
38
|
+
}
|
39
|
+
};
|
40
|
+
s.styles = [f, y], s.shadowRootOptions = { ...u.shadowRootOptions, delegatesFocus: !0 };
|
41
|
+
let t = s;
|
42
|
+
i([
|
43
|
+
r({ type: Boolean, reflect: !0 })
|
44
|
+
], t.prototype, "disabled");
|
45
|
+
i([
|
46
|
+
r({ type: Boolean, reflect: !0 })
|
47
|
+
], t.prototype, "selected");
|
48
|
+
i([
|
49
|
+
r({ reflect: !0 })
|
50
|
+
], t.prototype, "value");
|
51
|
+
i([
|
52
|
+
v()
|
53
|
+
], t.prototype, "isMultiple");
|
54
|
+
export {
|
55
|
+
t as SkfSegmentedButtonItem
|
56
|
+
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { SkfSegmentedButtonItem } from './segmented-button-item.component';
|
2
|
+
export * from './segmented-button-item.component';
|
3
|
+
export default SkfSegmentedButtonItem;
|
4
|
+
declare global {
|
5
|
+
interface HTMLElementTagNameMap {
|
6
|
+
'skf-segmented-button-item': SkfSegmentedButtonItem;
|
7
|
+
}
|
8
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { css as e } from "lit";
|
2
|
+
const o = e`
|
3
|
+
@layer components {
|
4
|
+
:host {
|
5
|
+
display: contents;
|
6
|
+
}
|
7
|
+
|
8
|
+
#root {
|
9
|
+
align-items: center;
|
10
|
+
background-color: var(--_skf-segmented-button-item-bg, transparent);
|
11
|
+
border: var(--skf-border-width-md) solid var(--_skf-segmented-button-item-border, transparent);
|
12
|
+
border-radius: 4px; /* TODO: Missing token */
|
13
|
+
display: flex;
|
14
|
+
flex: 1;
|
15
|
+
font-size: var(--skf-font-size-75);
|
16
|
+
font-weight: var(--skf-font-weight-bold);
|
17
|
+
gap: var(--skf-spacing-25);
|
18
|
+
justify-content: center;
|
19
|
+
min-inline-size: 0;
|
20
|
+
padding-inline: var(--skf-spacing-50);
|
21
|
+
position: relative;
|
22
|
+
|
23
|
+
:host(:not(:last-of-type)) &::after {
|
24
|
+
background-color: var(--skf-border-color-primary);
|
25
|
+
block-size: calc(100% - 5px);
|
26
|
+
content: '';
|
27
|
+
inline-size: 1px;
|
28
|
+
|
29
|
+
/* inset-inline-end: calc((var(--skf-spacing-75) + 2px + var(--skf-border-width-md) * 2) / -2); */
|
30
|
+
inset-inline-end: -9px;
|
31
|
+
position: absolute;
|
32
|
+
}
|
33
|
+
|
34
|
+
&:disabled {
|
35
|
+
color: var(--skf-interactive-text-color-disabled);
|
36
|
+
font-weight: 500;
|
37
|
+
}
|
38
|
+
|
39
|
+
&:is([aria-checked='true'], [aria-pressed='true']) {
|
40
|
+
--_skf-segmented-button-item-border: var(--skf-border-color-emphasised);
|
41
|
+
}
|
42
|
+
|
43
|
+
&:hover:not(:disabled) {
|
44
|
+
--_skf-segmented-button-item-bg: var(--skf-interactive-bg-color-secondary-hover);
|
45
|
+
}
|
46
|
+
|
47
|
+
&:is(:focus, :active):not(:disabled) {
|
48
|
+
--_skf-segmented-button-item-bg: var(--skf-interactive-bg-color-secondary-active);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
slot {
|
53
|
+
display: block;
|
54
|
+
overflow: hidden;
|
55
|
+
text-overflow: ellipsis;
|
56
|
+
white-space: nowrap;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
`;
|
60
|
+
export {
|
61
|
+
o as styles
|
62
|
+
};
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { SkfElement } from '../../internal/components/skf-element';
|
2
|
+
import { type CSSResultGroup } from 'lit';
|
3
|
+
/**
|
4
|
+
* The `<skf-segmented-button>` component consists of multiple `<skf-segmented-button-item>`, working together.
|
5
|
+
*
|
6
|
+
* See [zeroheight](https://zeroheight.com/853e936c9/p/68ff54-segmented-buttons) for design principles
|
7
|
+
*
|
8
|
+
* @slot - One or more `<skf-segmented-button-item>`
|
9
|
+
*
|
10
|
+
* @tagname skf-segmented-button
|
11
|
+
*/
|
12
|
+
export declare class SkfSegmentedButton extends SkfElement {
|
13
|
+
static styles: CSSResultGroup;
|
14
|
+
/** If true, allowes multiple items to be selected */
|
15
|
+
multiple: boolean;
|
16
|
+
/** @internal */
|
17
|
+
value: string;
|
18
|
+
/** @internal */
|
19
|
+
private items;
|
20
|
+
firstUpdated(): void;
|
21
|
+
/** @internal */
|
22
|
+
private _handleSegmentedButtonItemSelected;
|
23
|
+
/** @internal */
|
24
|
+
private _handleSlotChange;
|
25
|
+
/** @internal */
|
26
|
+
private _handleKeyDown;
|
27
|
+
/** @internal */
|
28
|
+
private _getKeyDownNextItem;
|
29
|
+
render(): import("lit").TemplateResult<1>;
|
30
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import { SkfElement as d } from "../../internal/components/skf-element.js";
|
2
|
+
import { componentStyles as m } from "../../styles/component.styles.js";
|
3
|
+
import { html as c } from "lit";
|
4
|
+
import { property as u, state as f, queryAssignedElements as p } from "lit/decorators.js";
|
5
|
+
import { ifDefined as g } from "lit/directives/if-defined.js";
|
6
|
+
import { styles as y } from "./segmented-button.styles.js";
|
7
|
+
var v = Object.defineProperty, n = (a, s, e, i) => {
|
8
|
+
for (var t = void 0, o = a.length - 1, r; o >= 0; o--)
|
9
|
+
(r = a[o]) && (t = r(s, e, t) || t);
|
10
|
+
return t && v(s, e, t), t;
|
11
|
+
};
|
12
|
+
const h = class h extends d {
|
13
|
+
constructor() {
|
14
|
+
super(...arguments), this.multiple = !1, this.value = "", this._handleSegmentedButtonItemSelected = (s) => {
|
15
|
+
const e = s.detail.item;
|
16
|
+
this.multiple && (e.selected = !e.selected), this.value = "";
|
17
|
+
let i = [];
|
18
|
+
this.items.forEach((t) => {
|
19
|
+
this.multiple ? t.selected && (i = [...i, t.value], this.value = i.join()) : t !== e ? t.selected = !1 : (t.selected = !0, this.value = t.value);
|
20
|
+
});
|
21
|
+
}, this._handleSlotChange = () => {
|
22
|
+
this.items.forEach((s) => {
|
23
|
+
if (s.isMultiple = this.multiple, !this.multiple) {
|
24
|
+
const e = this.items.filter((i) => i.selected);
|
25
|
+
e.length > 1 && e.slice(0, -1).forEach((i) => i.selected = !1);
|
26
|
+
}
|
27
|
+
});
|
28
|
+
}, this._handleKeyDown = (s) => {
|
29
|
+
if (["ArrowLeft", "ArrowRight"].includes(s.key)) {
|
30
|
+
const e = this._getKeyDownNextItem(s.key);
|
31
|
+
e == null || e.focus({ preventScroll: !0 });
|
32
|
+
}
|
33
|
+
};
|
34
|
+
}
|
35
|
+
firstUpdated() {
|
36
|
+
this.addEventListener(
|
37
|
+
"skf-segmented-button-item-select",
|
38
|
+
this._handleSegmentedButtonItemSelected
|
39
|
+
);
|
40
|
+
}
|
41
|
+
/** @internal */
|
42
|
+
_getKeyDownNextItem(s) {
|
43
|
+
const e = this.items.findIndex((r) => r === document.activeElement);
|
44
|
+
if (e === -1) return;
|
45
|
+
const t = (e + (s === "ArrowRight" ? 1 : -1)) % this.items.length;
|
46
|
+
return this.items[t < 0 ? this.items.length - 1 : t];
|
47
|
+
}
|
48
|
+
render() {
|
49
|
+
return c`
|
50
|
+
<slot
|
51
|
+
@keydown=${this._handleKeyDown}
|
52
|
+
@slotchange=${this._handleSlotChange}
|
53
|
+
aria-label=${g(this.ariaLabel ?? "Segmented button label")}
|
54
|
+
id="root"
|
55
|
+
role=${this.multiple ? "group" : "radiogroup"}
|
56
|
+
></slot>
|
57
|
+
`;
|
58
|
+
}
|
59
|
+
};
|
60
|
+
h.styles = [m, y];
|
61
|
+
let l = h;
|
62
|
+
n([
|
63
|
+
u({ type: Boolean })
|
64
|
+
], l.prototype, "multiple");
|
65
|
+
n([
|
66
|
+
f()
|
67
|
+
], l.prototype, "value");
|
68
|
+
n([
|
69
|
+
p()
|
70
|
+
], l.prototype, "items");
|
71
|
+
export {
|
72
|
+
l as SkfSegmentedButton
|
73
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { css as r } from "lit";
|
2
|
+
const o = r`
|
3
|
+
@layer components {
|
4
|
+
#root {
|
5
|
+
block-size: var(--skf-size-44);
|
6
|
+
border: var(--skf-border-width-sm) solid var(--skf-border-color-primary);
|
7
|
+
border-radius: 6px; /* TODO: Missing token */
|
8
|
+
display: flex;
|
9
|
+
gap: var(--skf-spacing-75);
|
10
|
+
padding: var(--skf-spacing-25);
|
11
|
+
}
|
12
|
+
}
|
13
|
+
`;
|
14
|
+
export {
|
15
|
+
o as styles
|
16
|
+
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { SkfElement as a } from "../../internal/components/skf-element.js";
|
2
|
-
import f from "../../styles/component.styles.js";
|
2
|
+
import { componentStyles as f } from "../../styles/component.styles.js";
|
3
3
|
import { html as p } from "lit";
|
4
4
|
import { property as d } from "lit/decorators.js";
|
5
5
|
import { styles as n } from "./select-option-group.style.js";
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import { SkfElement } from '../../internal/components/skf-element.js';
|
2
|
-
import type {
|
2
|
+
import type { Icon, IconColor } from '../../internal/types.js';
|
3
3
|
import { type CSSResultGroup } from 'lit';
|
4
4
|
import '../icon/icon';
|
5
|
-
import { SkfIcon } from '../icon/icon';
|
6
5
|
import type { SkfSelect } from '../select/select.component.js';
|
7
6
|
export interface SelectOptionEvent {
|
8
7
|
value: string | null;
|
@@ -16,7 +15,7 @@ export interface SelectOptionEvent {
|
|
16
15
|
* @slot - The option's text content
|
17
16
|
* @slot icon - The option's slot for icon or custom meta information (svg).
|
18
17
|
*
|
19
|
-
* @event skf-select-option
|
18
|
+
* @event skf-select-option-select - {detail: { value: string | null, option: SkfSelectOption }} Fires when the option is selected/deselected.
|
20
19
|
*
|
21
20
|
* @tagname skf-select-option
|
22
21
|
*/
|
@@ -37,15 +36,15 @@ export declare class SkfSelectOption extends SkfElement {
|
|
37
36
|
* Do not use directly, instead use `setSelectedDiscrete`.
|
38
37
|
* If true, instantly sets/unsets the selected property, without engaging ui feedback. Primarily for unselecting previous option in single select.
|
39
38
|
*/
|
40
|
-
_shortcutUpdate
|
39
|
+
_shortcutUpdate: boolean;
|
41
40
|
/** If true, prevents interaction with the option */
|
42
|
-
disabled
|
41
|
+
disabled: boolean;
|
43
42
|
/** If defined, set an icon */
|
44
|
-
icon?:
|
43
|
+
icon?: Icon;
|
45
44
|
/** If defined, sets provided color on the icon */
|
46
|
-
iconColor?:
|
45
|
+
iconColor?: IconColor;
|
47
46
|
/** If true, sets the option as selected */
|
48
|
-
selected
|
47
|
+
selected: boolean;
|
49
48
|
/** If defined, sets a short label */
|
50
49
|
shortLabel?: string;
|
51
50
|
/** The option's label text (equivalent to the tags textContent) */
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { SkfElement as u } from "../../internal/components/skf-element.js";
|
2
|
-
import f from "../../styles/component.styles.js";
|
2
|
+
import { componentStyles as f } from "../../styles/component.styles.js";
|
3
3
|
import { LitElement as m, html as h } from "lit";
|
4
|
-
import { property as
|
4
|
+
import { property as l, queryAssignedNodes as _ } from "lit/decorators.js";
|
5
5
|
import { ifDefined as p } from "lit/directives/if-defined.js";
|
6
6
|
import "../icon/icon.js";
|
7
7
|
import { styles as y } from "./select-option.styles.js";
|
@@ -10,9 +10,9 @@ var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (d, t, s
|
|
10
10
|
(c = d[a]) && (r = (i ? c(t, s, r) : c(r)) || r);
|
11
11
|
return i && r && v(t, s, r), r;
|
12
12
|
};
|
13
|
-
const
|
13
|
+
const n = class n extends u {
|
14
14
|
constructor() {
|
15
|
-
super(), this._handleClick = (s) => {
|
15
|
+
super(), this._shortcutUpdate = !1, this.disabled = !1, this.selected = !1, this._handleClick = (s) => {
|
16
16
|
s.stopPropagation(), this.selected = !this.selected;
|
17
17
|
};
|
18
18
|
const t = this.attachInternals();
|
@@ -33,7 +33,7 @@ const l = class l extends u {
|
|
33
33
|
return !this._value && this._slotContainsOnlyText ? this._getSlottedContent().trim() : ((t = this._value) == null ? void 0 : t.trim()) ?? this.text;
|
34
34
|
}
|
35
35
|
updated(t) {
|
36
|
-
super.updated(t), t.has("selected") && !this._shortcutUpdate && this.emit("skf-select-option
|
36
|
+
super.updated(t), t.has("selected") && !this._shortcutUpdate && this.emit("skf-select-option-select", {
|
37
37
|
detail: {
|
38
38
|
value: this.selected ? this.value : null,
|
39
39
|
option: this
|
@@ -80,7 +80,7 @@ const l = class l extends u {
|
|
80
80
|
<slot name="icon">
|
81
81
|
${this.icon && h`
|
82
82
|
<skf-icon
|
83
|
-
class=${p((this.disabled
|
83
|
+
class=${p((this.disabled || !this.iconColor) && "skf-icon-host")}
|
84
84
|
color=${p(this.iconColor)}
|
85
85
|
name=${this.icon}
|
86
86
|
></skf-icon>
|
@@ -92,28 +92,28 @@ const l = class l extends u {
|
|
92
92
|
`;
|
93
93
|
}
|
94
94
|
};
|
95
|
-
|
96
|
-
let e =
|
95
|
+
n.styles = [f, y], n.shadowRootOptions = { ...m.shadowRootOptions, delegatesFocus: !0 };
|
96
|
+
let e = n;
|
97
97
|
o([
|
98
|
-
|
98
|
+
l({ type: Boolean, reflect: !0 })
|
99
99
|
], e.prototype, "disabled", 2);
|
100
100
|
o([
|
101
|
-
|
101
|
+
l({ reflect: !0 })
|
102
102
|
], e.prototype, "icon", 2);
|
103
103
|
o([
|
104
|
-
|
104
|
+
l({ reflect: !0, attribute: "icon-color" })
|
105
105
|
], e.prototype, "iconColor", 2);
|
106
106
|
o([
|
107
|
-
|
107
|
+
l({ type: Boolean, reflect: !0 })
|
108
108
|
], e.prototype, "selected", 2);
|
109
109
|
o([
|
110
|
-
|
110
|
+
l({ reflect: !0, attribute: "short-label" })
|
111
111
|
], e.prototype, "shortLabel", 2);
|
112
112
|
o([
|
113
|
-
|
113
|
+
l({ attribute: !1 })
|
114
114
|
], e.prototype, "text", 1);
|
115
115
|
o([
|
116
|
-
|
116
|
+
l({ reflect: !0 })
|
117
117
|
], e.prototype, "value", 1);
|
118
118
|
o([
|
119
119
|
_({ flatten: !0 })
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
2
|
+
/**
|
3
|
+
* Workaround for storybook helper not being able to import types
|
4
|
+
* E.g type ControllerHost = SkfSelectOption;
|
5
|
+
*/
|
6
|
+
interface ControllerHostProps {
|
7
|
+
localName: keyof HTMLElementTagNameMap;
|
8
|
+
_parent: HTMLElement | null;
|
9
|
+
}
|
10
|
+
export declare class DeveloperFeedbackController implements ReactiveController {
|
11
|
+
host?: ReactiveControllerHost & Partial<ControllerHostProps>;
|
12
|
+
constructor(host: ReactiveControllerHost);
|
13
|
+
hostUpdated(): void;
|
14
|
+
}
|
15
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { FormBase } from '../../internal/components/formBase.js';
|
2
2
|
import { PopoverController } from '../../internal/controllers/popover.controller.js';
|
3
|
-
import type {
|
3
|
+
import type { FormFieldSeverity } from '../../internal/types.js';
|
4
4
|
import { type CSSResultGroup } from 'lit';
|
5
5
|
import '../../internal/components/hint/hint';
|
6
|
-
import type { SelectOptionEvent, SkfSelectOption } from '../select-option/select-option.component.js';
|
7
6
|
import '../tag/tag';
|
7
|
+
import type { SelectOptionEvent, SkfSelectOption } from './select-option.component.js';
|
8
8
|
import { DeveloperFeedbackController, GlobalClickController, KeyboardNavigationController } from './select.controllers.js';
|
9
9
|
/**
|
10
10
|
* TODO: abstract the popover logic to a separate component/helper/partial, and use it in both select and in input[datalist], combobox etc
|
@@ -14,17 +14,18 @@ import { DeveloperFeedbackController, GlobalClickController, KeyboardNavigationC
|
|
14
14
|
/**
|
15
15
|
* The `<skf-select>` is a component that displays a list of actions or options. A click in the options list toggle the selected state of the option. Use it together with the ´skf-select-option` tag.
|
16
16
|
*
|
17
|
-
*
|
17
|
+
* See [zeroheight](https://zeroheight.com/853e936c9/p/91c9f0-select-and-combobox) for design principles
|
18
18
|
*
|
19
|
-
* @attribute {boolean} [disabled] - If true, the select is disabled
|
19
|
+
* @attribute {boolean} [disabled=false] - If true, the select is disabled
|
20
|
+
* @attribute {boolean} [required=false] - If true, the select is required
|
20
21
|
*
|
21
22
|
* @slot - The select's placeholder content
|
22
23
|
*
|
23
|
-
* @event change - Fired when the selected option(s) changes
|
24
|
-
* @event invalid - Fired when the select is invalid
|
25
|
-
* @event reset - Fired when the form is reset
|
26
|
-
* @event skf-select
|
27
|
-
* @event skf-select-option
|
24
|
+
* @event {Event} change - Fired when the selected option(s) changes
|
25
|
+
* @event {Event} invalid - Fired when the select is invalid
|
26
|
+
* @event {Event} reset - Fired when the form is reset
|
27
|
+
* @event {CustomEvent} skf-select-dropdown - {detail: {expanded: boolean}} Fired when the select dropdown is toggled
|
28
|
+
* @event {CustomEvent} skf-select-option-select - {detail: {value: string | null, option: SkfSelectOption}} Fired when the select dropdown is toggled
|
28
29
|
*
|
29
30
|
* @tagname skf-select
|
30
31
|
*/
|
@@ -39,9 +40,9 @@ export declare class SkfSelect extends FormBase {
|
|
39
40
|
/** If defined, forces component to invalid state until removed */
|
40
41
|
customInvalid?: string;
|
41
42
|
/** If true, hides the label visually */
|
42
|
-
hideLabel
|
43
|
+
hideLabel: boolean;
|
43
44
|
/** If true and mulltiple is true, no tags are displayed under the select */
|
44
|
-
hideTags
|
45
|
+
hideTags: boolean;
|
45
46
|
/** If defined, sets the hint text under the select component in the form */
|
46
47
|
hint?: string;
|
47
48
|
/** A readonly property that returns the selected value(s) in a array */
|
@@ -57,22 +58,22 @@ export declare class SkfSelect extends FormBase {
|
|
57
58
|
/** If defined, sets the minimum number of required options */
|
58
59
|
min?: number;
|
59
60
|
/** If true, allows for multiple options to be selected */
|
60
|
-
multiple
|
61
|
+
multiple: boolean;
|
61
62
|
/** If defined, set name of the component */
|
62
63
|
name?: string;
|
63
64
|
/** If defined, renders an alternative A11y text for the asterisk */
|
64
65
|
requiredLabel?: string;
|
65
66
|
/** If defined, displays provided severity state */
|
66
|
-
severity?:
|
67
|
+
severity?: FormFieldSeverity;
|
67
68
|
/** If true, displays valid state after interaction */
|
68
|
-
showValid
|
69
|
+
showValid: boolean;
|
69
70
|
/** Size of the Select */
|
70
71
|
size: 'sm' | 'md';
|
71
72
|
/** Read only, returns the selected value. (if multiple: in a comma separated string) */
|
72
73
|
set value(newValue: string);
|
73
74
|
get value(): string;
|
74
|
-
/** Stores the selected SkfSelectOption tag(s) in a array. Is the source of truth for the internal state. */
|
75
75
|
/** @internal */
|
76
|
+
/** Stores the selected SkfSelectOption tag(s) in a array. Is the source of truth for the internal state. */
|
76
77
|
private _selectedOptions;
|
77
78
|
/** @internal */
|
78
79
|
/** The selected options in an array. Treat it as a read only property. See selectedValues, slectedSlots for computed value arrays. */
|
@@ -6,23 +6,23 @@ import { hintSeverity as x } from "../../internal/helpers/hintSeverity.js";
|
|
6
6
|
import { raiseError as w } from "../../internal/helpers/raiseError.js";
|
7
7
|
import { watch as $ } from "../../internal/helpers/watch.js";
|
8
8
|
import { Asterisk as V } from "../../internal/templates/asterisk.js";
|
9
|
-
import S from "../../styles/component.styles.js";
|
10
|
-
import {
|
9
|
+
import { componentStyles as S } from "../../styles/component.styles.js";
|
10
|
+
import { nothing as C, html as n } from "lit";
|
11
11
|
import { property as o, state as h, query as p } from "lit/decorators.js";
|
12
12
|
import { classMap as E } from "lit/directives/class-map.js";
|
13
13
|
import { ifDefined as m } from "lit/directives/if-defined.js";
|
14
14
|
import "../../internal/components/hint/hint.js";
|
15
15
|
import "../tag/tag.js";
|
16
|
-
import { GlobalClickController as
|
16
|
+
import { GlobalClickController as L, KeyboardNavigationController as k, DeveloperFeedbackController as A } from "./select.controllers.js";
|
17
17
|
import { styles as P } from "./select.styles.js";
|
18
18
|
var T = Object.defineProperty, D = Object.getOwnPropertyDescriptor, s = (u, t, e, l) => {
|
19
|
-
for (var
|
20
|
-
(d = u[
|
21
|
-
return l &&
|
19
|
+
for (var r = l > 1 ? void 0 : l ? D(t, e) : t, a = u.length - 1, d; a >= 0; a--)
|
20
|
+
(d = u[a]) && (r = (l ? d(t, e, r) : d(r)) || r);
|
21
|
+
return l && r && T(t, e, r), r;
|
22
22
|
};
|
23
23
|
const c = class c extends b {
|
24
24
|
constructor() {
|
25
|
-
super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new
|
25
|
+
super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.hideLabel = !1, this.hideTags = !1, this.multiple = !1, this.showValid = !1, this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new L(this), this.keyboardNavController = new k(this), this.developerFeedbackController = new A(this), this.popoverController = new y(this), this._handleOptionSelected = (t) => {
|
26
26
|
this._pristine = !1;
|
27
27
|
const e = this._selectedOptions.length > 0;
|
28
28
|
this.setFormValue(e ? this.selectedValues.join(",") : null), this._updateState(t);
|
@@ -121,18 +121,18 @@ const c = class c extends b {
|
|
121
121
|
}
|
122
122
|
firstUpdated() {
|
123
123
|
var t;
|
124
|
-
this.addEventListener("skf-select-option
|
124
|
+
this.addEventListener("skf-select-option-select", this._handleOptionSelected), (t = this._internals.form) == null || t.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this._validateInput();
|
125
125
|
}
|
126
126
|
handleExpandedChange() {
|
127
127
|
this._expanded ? (this.$popover.togglePopover(this._expanded), this.popoverController.start()) : (this.$popover.togglePopover(this._expanded), this.popoverController.stop().catch((t) => {
|
128
128
|
console.error(t);
|
129
|
-
})), this.emit("skf-select
|
129
|
+
})), this.emit("skf-select-dropdown", { detail: { expanded: this._expanded } });
|
130
130
|
}
|
131
131
|
attributeChangedCallback(t, e, l) {
|
132
132
|
if (super.attributeChangedCallback(t, e, l), t === "custom-invalid")
|
133
133
|
if (typeof l == "string") {
|
134
|
-
const
|
135
|
-
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 },
|
134
|
+
const a = this.withFallback(l);
|
135
|
+
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, a), this.checkValidity();
|
136
136
|
} else
|
137
137
|
this.setValidity({}), this._validateInput();
|
138
138
|
}
|
@@ -173,14 +173,14 @@ const c = class c extends b {
|
|
173
173
|
this._invalid = !0;
|
174
174
|
return;
|
175
175
|
} else if (t) {
|
176
|
-
const
|
177
|
-
this.setValidity({ valueMissing: !0 }, String(
|
176
|
+
const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : "Please select an option";
|
177
|
+
this.setValidity({ valueMissing: !0 }, String(a)), this._pristine || (this._invalid = !0);
|
178
178
|
} else if (e) {
|
179
|
-
const
|
180
|
-
this.setValidity({ rangeUnderflow: !0 }, String(
|
179
|
+
const a = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
|
180
|
+
this.setValidity({ rangeUnderflow: !0 }, String(a)), this._pristine || (this._invalid = !0);
|
181
181
|
} else if (l) {
|
182
|
-
const
|
183
|
-
this.setValidity({ rangeOverflow: !0 }, String(
|
182
|
+
const a = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
|
183
|
+
this.setValidity({ rangeOverflow: !0 }, String(a)), this._pristine || (this._invalid = !0);
|
184
184
|
} else
|
185
185
|
this.setValidity({}), !this._pristine && this.showValid && this.setAttribute("valid", "true");
|
186
186
|
}
|
@@ -235,9 +235,9 @@ const c = class c extends b {
|
|
235
235
|
<skf-hint
|
236
236
|
aria-live=${this._invalid ? "assertive" : "polite"}
|
237
237
|
id="hint"
|
238
|
-
severity=${m(x(this.
|
238
|
+
severity=${m(x(this._invalid, this.severity))}
|
239
239
|
>
|
240
|
-
${this.customInvalid
|
240
|
+
${this.customInvalid ?? this.hint}
|
241
241
|
</skf-hint>
|
242
242
|
`}
|
243
243
|
</div>
|
@@ -1,10 +1,21 @@
|
|
1
|
-
import type {
|
2
|
-
import type {
|
3
|
-
|
4
|
-
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
2
|
+
import type { SkfSelectOption } from './select-option.component.js';
|
3
|
+
/**
|
4
|
+
* Workaround for storybook helper not being able to import types
|
5
|
+
* E.g type ControllerHost = SkfSelect;
|
6
|
+
*/
|
7
|
+
interface ControllerHostProps {
|
8
|
+
_expanded: boolean;
|
9
|
+
_optionsList: SkfSelectOption[];
|
10
|
+
localName: keyof HTMLElementTagNameMap;
|
11
|
+
min: number;
|
12
|
+
max: number;
|
13
|
+
multiple: boolean;
|
14
|
+
hideTags: boolean;
|
15
|
+
}
|
5
16
|
export declare class GlobalClickController implements ReactiveController {
|
6
|
-
host
|
7
|
-
constructor(host:
|
17
|
+
host?: ReactiveControllerHost & Partial<ControllerHostProps>;
|
18
|
+
constructor(host: ReactiveControllerHost);
|
8
19
|
hostDisconnected(): void;
|
9
20
|
hostUpdated(): void;
|
10
21
|
_globalClickHandler: (event: MouseEvent) => void;
|
@@ -12,9 +23,9 @@ export declare class GlobalClickController implements ReactiveController {
|
|
12
23
|
disableGlobalClickDetection(): void;
|
13
24
|
}
|
14
25
|
export declare class KeyboardNavigationController implements ReactiveController {
|
15
|
-
host
|
26
|
+
host?: ReactiveControllerHost & Partial<ControllerHostProps>;
|
16
27
|
_listenerActivated: boolean;
|
17
|
-
constructor(host:
|
28
|
+
constructor(host: ReactiveControllerHost);
|
18
29
|
hostDisconnected(): void;
|
19
30
|
hostUpdated(): void;
|
20
31
|
setupKeyboardListener(): void;
|
@@ -26,8 +37,8 @@ export declare class KeyboardNavigationController implements ReactiveController
|
|
26
37
|
get _selectableOptions(): SkfSelectOption[];
|
27
38
|
}
|
28
39
|
export declare class DeveloperFeedbackController implements ReactiveController {
|
29
|
-
host
|
30
|
-
constructor(host:
|
40
|
+
host?: ReactiveControllerHost & Partial<ControllerHostProps>;
|
41
|
+
constructor(host: ReactiveControllerHost);
|
31
42
|
hostConnected(): void;
|
32
43
|
_badAttributeCombinationWarning(): void;
|
33
44
|
}
|