@skf-design-system/ui-components 1.0.2-beta.0 → 1.0.2-beta.10
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 +37 -9
- package/dist/components/accordion/accordion-item.component.d.ts +36 -0
- package/dist/components/accordion/accordion-item.component.js +98 -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 +6 -10
- package/dist/components/accordion/accordion.component.js +9 -10
- 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 +12 -10
- package/dist/components/alert/alert.component.js +59 -51
- package/dist/components/alert/alert.styles.js +50 -51
- package/dist/components/breadcrumb/breadcrumb-item.component.js +59 -0
- package/dist/components/{breadcrumb-item → breadcrumb}/breadcrumb-item.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb-item.js +6 -0
- package/dist/components/breadcrumb/breadcrumb-item.styles.js +63 -0
- package/dist/components/breadcrumb/breadcrumb.component.d.ts +6 -3
- package/dist/components/breadcrumb/breadcrumb.component.js +65 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb.js +6 -0
- package/dist/components/breadcrumb/breadcrumb.styles.js +25 -0
- package/dist/components/button/button.component.d.ts +13 -10
- package/dist/components/button/button.component.js +69 -66
- package/dist/components/button/button.styles.d.ts +1 -2
- package/dist/components/button/button.styles.js +6 -5
- package/dist/components/card/card.component.d.ts +6 -1
- package/dist/components/card/card.component.js +46 -24
- package/dist/components/card/card.styles.js +31 -14
- package/dist/components/checkbox/checkbox.component.d.ts +14 -11
- package/dist/components/checkbox/checkbox.component.js +67 -69
- package/dist/components/checkbox/checkbox.styles.d.ts +1 -2
- package/dist/components/checkbox/checkbox.styles.js +2 -6
- package/dist/components/{date-picker/datepicker.calendar.component.d.ts → datepicker/datepicker-calendar.component.d.ts} +8 -1
- package/dist/components/{date-picker/datepicker.calendar.component.js → datepicker/datepicker-calendar.component.js} +109 -115
- package/dist/components/datepicker/datepicker-calendar.d.ts +8 -0
- package/dist/components/datepicker/datepicker-calendar.js +6 -0
- package/dist/components/{date-picker/datepicker.component.d.ts → datepicker/datepicker-popup.component.d.ts} +9 -20
- package/dist/components/datepicker/datepicker-popup.component.js +272 -0
- package/dist/components/datepicker/datepicker-popup.d.ts +8 -0
- package/dist/components/{date-picker/datepicker.helpers.d.ts → datepicker/datepicker-popup.helpers.d.ts} +3 -3
- package/dist/components/datepicker/datepicker-popup.helpers.js +83 -0
- package/dist/components/datepicker/datepicker-popup.js +6 -0
- package/dist/components/{date-picker/datepicker.styles.js → datepicker/datepicker-popup.styles.js} +3 -3
- package/dist/components/{date-picker-input/datepicker-input.component.d.ts → datepicker/datepicker.component.d.ts} +22 -14
- package/dist/components/datepicker/datepicker.component.js +455 -0
- package/dist/components/datepicker/datepicker.d.ts +8 -0
- package/dist/components/datepicker/datepicker.js +6 -0
- package/dist/components/dialog/dialog.component.d.ts +8 -6
- package/dist/components/dialog/dialog.component.js +67 -67
- package/dist/components/dialog/dialog.d.ts +2 -2
- package/dist/components/dialog/dialog.styles.js +4 -4
- package/dist/components/divider/divider.component.d.ts +3 -0
- package/dist/components/divider/divider.component.js +43 -22
- package/dist/components/divider/divider.styles.js +9 -9
- package/dist/components/drawer/drawer.component.d.ts +24 -12
- package/dist/components/drawer/drawer.component.js +87 -63
- package/dist/components/drawer/drawer.d.ts +2 -2
- package/dist/components/drawer/drawer.styles.js +47 -40
- package/dist/components/header/header.component.d.ts +7 -4
- package/dist/components/header/header.component.js +68 -55
- package/dist/components/header/header.d.ts +2 -2
- package/dist/components/header/header.styles.js +2 -2
- package/dist/components/heading/heading.component.d.ts +8 -6
- package/dist/components/heading/heading.component.js +52 -24
- package/dist/components/heading/heading.styles.js +34 -36
- package/dist/components/icon/icon.component.d.ts +15 -17
- package/dist/components/icon/icon.component.js +62 -43
- package/dist/components/icon/icon.styles.d.ts +1 -2
- package/dist/components/icon/icon.styles.js +60 -60
- package/dist/components/input/input.component.d.ts +34 -39
- package/dist/components/input/input.component.js +159 -153
- package/dist/components/input/input.controllers.d.ts +0 -1
- package/dist/components/input/input.controllers.js +14 -19
- package/dist/components/link/link.component.d.ts +20 -25
- package/dist/components/link/link.component.js +104 -107
- package/dist/components/link/link.styles.d.ts +1 -2
- package/dist/components/link/link.styles.js +54 -46
- package/dist/components/loader/loader.component.d.ts +6 -4
- package/dist/components/loader/loader.component.js +49 -42
- package/dist/components/loader/loader.styles.d.ts +1 -2
- package/dist/components/loader/loader.styles.js +34 -30
- package/dist/components/logo/logo.component.d.ts +8 -6
- package/dist/components/logo/logo.component.js +55 -51
- package/dist/components/logo/logo.styles.js +26 -16
- package/dist/components/menu/menu-item.component.d.ts +13 -0
- package/dist/components/menu/menu-item.component.js +13 -0
- package/dist/components/{menu-item → menu}/menu-item.d.ts +2 -2
- package/dist/components/menu/menu-item.styles.js +23 -0
- package/dist/components/menu/menu.component.d.ts +14 -8
- package/dist/components/menu/menu.component.js +10 -12
- package/dist/components/menu/menu.d.ts +2 -2
- package/dist/components/{nav-item → nav}/nav-item.component.d.ts +6 -4
- package/dist/components/nav/nav-item.component.js +57 -0
- package/dist/components/nav/nav-item.styles.js +43 -0
- package/dist/components/nav/nav.component.d.ts +9 -0
- package/dist/components/nav/nav.component.js +47 -21
- package/dist/components/nav/nav.d.ts +2 -2
- package/dist/components/nav/nav.styles.js +15 -9
- package/dist/components/popover/popover.component.d.ts +17 -6
- package/dist/components/popover/popover.component.js +22 -16
- package/dist/components/popover/popover.d.ts +2 -2
- package/dist/components/progress/progress.component.d.ts +4 -2
- package/dist/components/progress/progress.component.js +38 -35
- package/dist/components/progress/progress.d.ts +2 -2
- package/dist/components/progress/progress.styles.js +42 -35
- package/dist/components/radio/radio.component.d.ts +13 -9
- package/dist/components/radio/radio.component.js +96 -91
- package/dist/components/radio/radio.styles.js +1 -1
- package/dist/components/{segmented-button-item → segmented-button}/segmented-button-item.component.d.ts +4 -4
- package/dist/components/segmented-button/segmented-button-item.component.js +56 -0
- package/dist/components/{segmented-button-item → segmented-button}/segmented-button-item.d.ts +2 -2
- package/dist/components/segmented-button/segmented-button-item.js +6 -0
- package/dist/components/segmented-button/segmented-button-item.styles.js +62 -0
- package/dist/components/segmented-button/segmented-button.component.d.ts +0 -2
- package/dist/components/segmented-button/segmented-button.component.js +71 -0
- package/dist/components/segmented-button/segmented-button.d.ts +2 -2
- package/dist/components/segmented-button/segmented-button.js +6 -0
- package/dist/components/segmented-button/segmented-button.styles.js +16 -0
- package/dist/components/{select-option-group → select}/select-option-group.component.d.ts +4 -0
- package/dist/components/select/select-option-group.component.js +50 -0
- package/dist/components/{select-option-group → select}/select-option-group.d.ts +2 -2
- package/dist/components/select/select-option-group.style.js +24 -0
- package/dist/components/{select-option → select}/select-option.component.d.ts +16 -12
- package/dist/components/select/select-option.component.js +135 -0
- package/dist/components/select/select-option.styles.js +65 -0
- package/dist/components/select/select.component.d.ts +35 -25
- package/dist/components/select/select.component.js +126 -88
- package/dist/components/select/select.controllers.d.ts +1 -1
- package/dist/components/select/select.controllers.js +16 -18
- package/dist/components/select/select.styles.js +8 -2
- package/dist/components/select/stories/select.stories.icons.d.ts +7 -0
- package/dist/components/{stepper-item → stepper}/stepper-item.component.d.ts +1 -1
- package/dist/components/stepper/stepper-item.component.js +116 -0
- package/dist/components/{stepper-item → stepper}/stepper-item.d.ts +2 -2
- package/dist/components/{stepper-item → stepper}/stepper-item.styles.js +4 -4
- package/dist/components/stepper/stepper.component.d.ts +2 -2
- package/dist/components/stepper/stepper.component.js +17 -18
- package/dist/components/stepper/stepper.d.ts +2 -2
- package/dist/components/stepper/stepper.helpers.d.ts +1 -1
- package/dist/components/stepper/stepper.helpers.js +6 -7
- package/dist/components/switch/switch.component.d.ts +4 -2
- package/dist/components/switch/switch.component.js +64 -58
- package/dist/components/switch/switch.d.ts +2 -2
- package/dist/components/switch/switch.styles.js +1 -1
- package/dist/components/{tab-panel → tabs}/tab-panel.component.d.ts +1 -1
- package/dist/components/tabs/tab-panel.component.js +39 -0
- package/dist/components/{tab-panel → tabs}/tab-panel.d.ts +2 -2
- package/dist/components/{tab → tabs}/tab.component.d.ts +3 -3
- package/dist/components/{tab → tabs}/tab.component.js +18 -15
- package/dist/components/{tab → tabs}/tab.d.ts +2 -2
- package/dist/components/{tab → tabs}/tab.styles.js +2 -2
- package/dist/components/{tab-group/tab-group.component.d.ts → tabs/tabs.component.d.ts} +3 -4
- package/dist/components/{tab-group/tab-group.component.js → tabs/tabs.component.js} +36 -37
- package/dist/components/tabs/tabs.d.ts +8 -0
- package/dist/components/tabs/tabs.js +6 -0
- package/dist/components/{tab-group/tab-group.styles.js → tabs/tabs.styles.js} +16 -16
- package/dist/components/tag/tag.component.d.ts +20 -16
- package/dist/components/tag/tag.component.js +74 -65
- package/dist/components/tag/tag.d.ts +2 -2
- package/dist/components/tag/tag.styles.js +63 -50
- package/dist/components/textarea/textarea.component.d.ts +14 -13
- package/dist/components/textarea/textarea.component.js +77 -72
- 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/toast-item.styles.js +21 -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 +5 -4
- package/dist/components/toast/toast.component.js +16 -16
- package/dist/components/toast/toast.singleton.d.ts +5 -5
- package/dist/components/toast/toast.singleton.js +28 -29
- package/dist/components/tooltip/tooltip.component.d.ts +11 -3
- package/dist/components/tooltip/tooltip.component.js +18 -9
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/custom-elements.json +2202 -1720
- package/dist/index.d.ts +19 -12
- package/dist/index.js +108 -89
- package/dist/internal/base-classes/popover/popover.base.d.ts +30 -6
- package/dist/internal/base-classes/popover/popover.base.js +83 -69
- package/dist/internal/base-classes/popover/popover.styles.js +4 -5
- package/dist/internal/components/formBase.d.ts +1 -0
- package/dist/internal/components/formBase.js +11 -19
- package/dist/internal/components/hint/hint.component.d.ts +6 -2
- package/dist/internal/components/hint/hint.component.js +47 -20
- package/dist/internal/components/hint/hint.styles.d.ts +1 -2
- package/dist/internal/components/hint/hint.styles.js +30 -26
- package/dist/internal/components/skf-element.d.ts +1 -3
- package/dist/internal/components/skf-element.js +4 -9
- package/dist/internal/constants/iconSeverity.d.ts +3 -2
- package/dist/internal/constants/iconSeverity.js +2 -3
- package/dist/internal/controllers/popover.controller.d.ts +2 -0
- package/dist/internal/controllers/popover.controller.js +11 -14
- package/dist/internal/helpers/hintSeverity.d.ts +2 -2
- package/dist/internal/helpers/hintSeverity.js +1 -1
- package/dist/internal/helpers/stateMap.d.ts +14 -0
- package/dist/internal/helpers/stateMap.js +68 -0
- package/dist/internal/helpers/uuid.d.ts +8 -10
- package/dist/internal/helpers/uuid.js +4 -11
- package/dist/internal/helpers/watch.d.ts +1 -1
- package/dist/internal/helpers/watch.js +12 -12
- package/dist/internal/templates/asterisk.d.ts +1 -1
- package/dist/internal/templates/asterisk.js +4 -4
- package/dist/internal/types/formField.d.ts +1 -1
- package/dist/internal/types.d.ts +22 -0
- package/dist/styles/component.styles.d.ts +1 -2
- package/dist/styles/component.styles.js +38 -37
- package/dist/styles/global-alt.css +1 -0
- package/dist/styles/global.css +1 -1
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +27 -0
- package/dist/translations/es.d.ts +3 -0
- package/dist/translations/es.js +27 -0
- package/dist/translations/index.d.ts +4 -0
- package/dist/translations/pt.d.ts +3 -0
- package/dist/translations/pt.js +27 -0
- package/dist/translations/sv.d.ts +3 -0
- package/dist/translations/sv.js +27 -0
- package/dist/types/jsx/custom-element-jsx.d.ts +2031 -927
- package/dist/types/vue/index.d.ts +357 -324
- package/dist/utilities/localize.d.ts +28 -0
- package/dist/utilities/localize.js +13 -0
- package/dist/vscode.html-custom-data.json +360 -1241
- package/dist/web-types.json +932 -805
- package/package.json +38 -52
- package/dist/components/accordion/accordion.test.d.ts +0 -1
- package/dist/components/checkbox/checkbox.test.d.ts +0 -1
- 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/collapse/collapse.test.d.ts +0 -1
- package/dist/components/date-picker/datepicker.component.js +0 -261
- package/dist/components/date-picker/datepicker.d.ts +0 -10
- package/dist/components/date-picker/datepicker.helpers.js +0 -76
- package/dist/components/date-picker/datepicker.js +0 -8
- package/dist/components/date-picker-input/datepicker-input.component.js +0 -441
- package/dist/components/date-picker-input/datepicker-input.d.ts +0 -8
- package/dist/components/date-picker-input/datepicker-input.js +0 -6
- package/dist/components/input/input.test.d.ts +0 -1
- package/dist/components/menu-item/menu-item.component.d.ts +0 -25
- package/dist/components/menu-item/menu-item.component.js +0 -13
- package/dist/components/menu-item/menu-item.styles.js +0 -19
- package/dist/components/nav-item/nav-item.component.js +0 -38
- package/dist/components/nav-item/nav-item.styles.js +0 -39
- package/dist/components/radio/radio.test.d.ts +0 -1
- package/dist/components/select-option/select-option.component.js +0 -123
- package/dist/components/select-option/select-option.styles.js +0 -53
- package/dist/components/select-option-group/select-option-group.component.js +0 -31
- package/dist/components/select-option-group/select-option-group.style.js +0 -18
- package/dist/components/stepper-item/stepper-item.component.js +0 -113
- package/dist/components/switch/switch.test.d.ts +0 -1
- package/dist/components/tab-group/tab-group.d.ts +0 -8
- package/dist/components/tab-group/tab-group.js +0 -6
- package/dist/components/tab-panel/tab-panel.component.js +0 -36
- package/dist/components/toast-item/toast-item.styles.js +0 -18
- package/dist/internal/constants/heading.d.ts +0 -2
- package/dist/internal/playwright/index.d.ts +0 -1
- /package/dist/components/{breadcrumb-item/breadcrumb-item.styles.d.ts → accordion/accordion-item.styles.d.ts} +0 -0
- /package/dist/components/{breadcrumb-item → breadcrumb}/breadcrumb-item.component.d.ts +0 -0
- /package/dist/components/{date-picker/datepicker.calendar.styles.d.ts → breadcrumb/breadcrumb-item.styles.d.ts} +0 -0
- /package/dist/components/{date-picker/datepicker.styles.d.ts → datepicker/datepicker-calendar.styles.d.ts} +0 -0
- /package/dist/components/{date-picker/datepicker.calendar.styles.js → datepicker/datepicker-calendar.styles.js} +0 -0
- /package/dist/components/{menu-item/menu-item.styles.d.ts → datepicker/datepicker-popup.styles.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.helpers.d.ts → datepicker/datepicker.helpers.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.helpers.js → datepicker/datepicker.helpers.js} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.styles.d.ts → datepicker/datepicker.styles.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.styles.js → datepicker/datepicker.styles.js} +0 -0
- /package/dist/components/{menu-item → menu}/menu-item.js +0 -0
- /package/dist/components/{nav-item/nav-item.styles.d.ts → menu/menu-item.styles.d.ts} +0 -0
- /package/dist/components/{nav-item → nav}/nav-item.d.ts +0 -0
- /package/dist/components/{nav-item → nav}/nav-item.js +0 -0
- /package/dist/components/{segmented-button-item/segmented-button-item.styles.d.ts → nav/nav-item.styles.d.ts} +0 -0
- /package/dist/components/{select-option-group/select-option-group.style.d.ts → segmented-button/segmented-button-item.styles.d.ts} +0 -0
- /package/dist/components/{select-option-group → select}/select-option-group.js +0 -0
- /package/dist/components/{select-option/select-option.styles.d.ts → select/select-option-group.style.d.ts} +0 -0
- /package/dist/components/{select-option → select}/select-option.controllers.d.ts +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/{stepper-item/stepper-item.styles.d.ts → select/select-option.styles.d.ts} +0 -0
- /package/dist/components/{stepper-item → stepper}/stepper-item.js +0 -0
- /package/dist/components/{tab-group/tab-group.styles.d.ts → stepper/stepper-item.styles.d.ts} +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.js +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.styles.d.ts +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.styles.js +0 -0
- /package/dist/components/{tab → tabs}/tab.js +0 -0
- /package/dist/components/{tab → tabs}/tab.styles.d.ts +0 -0
- /package/dist/components/{toast-wrapper/toast-wrapper.styles.d.ts → tabs/tabs.styles.d.ts} +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-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,10 +1,12 @@
|
|
1
|
+
import { SkfSelectOptionGroup } from '../select/select-option-group.component.js';
|
2
|
+
import '../tag/tag.js';
|
1
3
|
import { FormBase } from '../../internal/components/formBase.js';
|
4
|
+
import '../../internal/components/hint/hint.js';
|
2
5
|
import { PopoverController } from '../../internal/controllers/popover.controller.js';
|
3
|
-
import type {
|
6
|
+
import type { FormFieldSeverity } from '../../internal/types.js';
|
7
|
+
import { type Language } from '../../utilities/localize.js';
|
4
8
|
import { type CSSResultGroup } from 'lit';
|
5
|
-
import '
|
6
|
-
import type { SelectOptionEvent, SkfSelectOption } from '../select-option/select-option.component.js';
|
7
|
-
import '../tag/tag';
|
9
|
+
import { SkfSelectOption, type SelectOptionEvent } from './select-option.component.js';
|
8
10
|
import { DeveloperFeedbackController, GlobalClickController, KeyboardNavigationController } from './select.controllers.js';
|
9
11
|
/**
|
10
12
|
* TODO: abstract the popover logic to a separate component/helper/partial, and use it in both select and in input[datalist], combobox etc
|
@@ -14,22 +16,27 @@ import { DeveloperFeedbackController, GlobalClickController, KeyboardNavigationC
|
|
14
16
|
/**
|
15
17
|
* 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
18
|
*
|
17
|
-
*
|
19
|
+
* See [zeroheight](https://zeroheight.com/853e936c9/p/91c9f0-select-and-combobox) for design principles
|
18
20
|
*
|
19
|
-
* @attribute {boolean} [disabled] - If true, the select is disabled
|
21
|
+
* @attribute {boolean} [disabled=false] - If true, the select is disabled
|
22
|
+
* @attribute {boolean} [required=false] - If true, the select is required
|
20
23
|
*
|
21
24
|
* @slot - The select's placeholder content
|
22
25
|
*
|
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
|
26
|
+
* @event {Event} change - Fired when the selected option(s) changes
|
27
|
+
* @event {Event} invalid - Fired when the select is invalid
|
28
|
+
* @event {Event} reset - Fired when the form is reset
|
29
|
+
* @event {CustomEvent} skf-select-dropdown - {detail: {expanded: boolean}} Fired when the select dropdown is toggled
|
30
|
+
* @event {CustomEvent} skf-select-option-select - {detail: {value: string | null, option: SkfSelectOption}} Fired when the select dropdown is toggled
|
31
|
+
* @event {CustomEvent} skf-select-connected - Fires when the select options are connected, useful for setting selected option(s) via value property. E.g mySkfSelect.value = 'option1,option2';
|
28
32
|
*
|
29
33
|
* @tagname skf-select
|
30
34
|
*/
|
31
35
|
export declare class SkfSelect extends FormBase {
|
36
|
+
#private;
|
32
37
|
static styles: CSSResultGroup;
|
38
|
+
private _componentIsConnected;
|
39
|
+
private _defaultButtonLabel;
|
33
40
|
/** @internal */
|
34
41
|
selectDelay: number;
|
35
42
|
/** @internal */
|
@@ -39,9 +46,9 @@ export declare class SkfSelect extends FormBase {
|
|
39
46
|
/** If defined, forces component to invalid state until removed */
|
40
47
|
customInvalid?: string;
|
41
48
|
/** If true, hides the label visually */
|
42
|
-
hideLabel
|
49
|
+
hideLabel: boolean;
|
43
50
|
/** If true and mulltiple is true, no tags are displayed under the select */
|
44
|
-
hideTags
|
51
|
+
hideTags: boolean;
|
45
52
|
/** If defined, sets the hint text under the select component in the form */
|
46
53
|
hint?: string;
|
47
54
|
/** A readonly property that returns the selected value(s) in a array */
|
@@ -52,30 +59,28 @@ export declare class SkfSelect extends FormBase {
|
|
52
59
|
get selectedOptionsText(): string[];
|
53
60
|
/** If defined, displays provided label */
|
54
61
|
label?: string;
|
62
|
+
/** Sets the internal language of the component */
|
63
|
+
lang: Language;
|
55
64
|
/** If defined, limits the number of selectable options */
|
56
65
|
max?: number;
|
57
66
|
/** If defined, sets the minimum number of required options */
|
58
67
|
min?: number;
|
59
68
|
/** If true, allows for multiple options to be selected */
|
60
|
-
multiple
|
69
|
+
multiple: boolean;
|
61
70
|
/** If defined, set name of the component */
|
62
71
|
name?: string;
|
63
|
-
/** If defined, renders an alternative A11y text for the asterisk */
|
64
|
-
requiredLabel?: string;
|
65
72
|
/** If defined, displays provided severity state */
|
66
|
-
severity?:
|
73
|
+
severity?: FormFieldSeverity;
|
67
74
|
/** If true, displays valid state after interaction */
|
68
|
-
showValid
|
75
|
+
showValid: boolean;
|
69
76
|
/** Size of the Select */
|
70
77
|
size: 'sm' | 'md';
|
71
|
-
/**
|
78
|
+
/** Returns the selected value. (if multiple: in a comma separated string). If set will default set corresponding option. */
|
72
79
|
set value(newValue: string);
|
73
80
|
get value(): string;
|
74
|
-
/** Stores the selected SkfSelectOption tag(s) in a array. Is the source of truth for the internal state. */
|
75
|
-
/** @internal */
|
81
|
+
/** @internal - Stores the selected SkfSelectOption tag(s) in a array. Is the source of truth for the internal state. */
|
76
82
|
private _selectedOptions;
|
77
|
-
/** @internal */
|
78
|
-
/** The selected options in an array. Treat it as a read only property. See selectedValues, slectedSlots for computed value arrays. */
|
83
|
+
/** @internal - Read only. The selected options in an array. See also selectedValues, slectedSlots for computed value arrays. */
|
79
84
|
set selectedOptions(option: SkfSelectOption[]);
|
80
85
|
/** @internal */
|
81
86
|
get selectedOptions(): SkfSelectOption[];
|
@@ -91,6 +96,8 @@ export declare class SkfSelect extends FormBase {
|
|
91
96
|
/** @internal */
|
92
97
|
$popover: HTMLDivElement;
|
93
98
|
/** @internal */
|
99
|
+
_slottedItems: SkfSelectOption[] | SkfSelectOptionGroup[];
|
100
|
+
/** @internal */
|
94
101
|
protected globalClickController: GlobalClickController;
|
95
102
|
/** @internal */
|
96
103
|
protected keyboardNavController: KeyboardNavigationController;
|
@@ -101,6 +108,7 @@ export declare class SkfSelect extends FormBase {
|
|
101
108
|
constructor();
|
102
109
|
willUpdate(changedProperties: Map<string | number | symbol, unknown>): void;
|
103
110
|
firstUpdated(): void;
|
111
|
+
_handleSizeUpdate(): void;
|
104
112
|
handleExpandedChange(): void;
|
105
113
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
106
114
|
disconnectedCallback(): void;
|
@@ -130,8 +138,10 @@ export declare class SkfSelect extends FormBase {
|
|
130
138
|
_resetSelectedOptions: (target?: SkfSelectOption) => void;
|
131
139
|
/** @internal */
|
132
140
|
_handleSlotChange: () => void;
|
133
|
-
/** @internal */
|
134
|
-
|
141
|
+
/** @internal - on slot update, if value is set, select the corresponding option */
|
142
|
+
_ifValueIsSetSelectOption: () => void;
|
143
|
+
/** @internal - Computes the visible value of the select component - if multiple options are selected, shows a visually dimmed summary (meta info) */
|
144
|
+
_computeVisibleValue: () => string | null;
|
135
145
|
/** @internal */
|
136
146
|
private _validateInput;
|
137
147
|
render(): import("lit").TemplateResult<1>;
|
@@ -1,28 +1,38 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import { PopoverController as y } from "../../internal/controllers/popover.controller.js";
|
4
|
-
import { findMatchingTags as O } from "../../internal/helpers/findMatchingTags.js";
|
5
|
-
import { hintSeverity as x } from "../../internal/helpers/hintSeverity.js";
|
6
|
-
import { raiseError as w } from "../../internal/helpers/raiseError.js";
|
7
|
-
import { watch as $ } from "../../internal/helpers/watch.js";
|
8
|
-
import { Asterisk as V } from "../../internal/templates/asterisk.js";
|
9
|
-
import S from "../../styles/component.styles.js";
|
10
|
-
import { nothing as C, html as n } from "lit";
|
11
|
-
import { property as o, state as h, query as p } from "lit/decorators.js";
|
12
|
-
import { classMap as E } from "lit/directives/class-map.js";
|
13
|
-
import { ifDefined as m } from "lit/directives/if-defined.js";
|
14
|
-
import "../../internal/components/hint/hint.js";
|
15
|
-
import "../tag/tag.js";
|
16
|
-
import { GlobalClickController as k, KeyboardNavigationController as L, DeveloperFeedbackController as A } from "./select.controllers.js";
|
17
|
-
import { styles as P } from "./select.styles.js";
|
18
|
-
var T = Object.defineProperty, D = Object.getOwnPropertyDescriptor, s = (u, t, e, l) => {
|
19
|
-
for (var a = l > 1 ? void 0 : l ? D(t, e) : t, r = u.length - 1, d; r >= 0; r--)
|
20
|
-
(d = u[r]) && (a = (l ? d(t, e, a) : d(a)) || a);
|
21
|
-
return l && a && T(t, e, a), a;
|
1
|
+
var _ = (o) => {
|
2
|
+
throw TypeError(o);
|
22
3
|
};
|
23
|
-
|
4
|
+
var v = (o, a, t) => a.has(o) || _("Cannot " + t);
|
5
|
+
var c = (o, a, t) => (v(o, a, "read from private field"), t ? t.call(o) : a.get(o)), g = (o, a, t) => a.has(o) ? _("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(o) : a.set(o, t), b = (o, a, t, e) => (v(o, a, "write to private field"), e ? e.call(o, t) : a.set(o, t), t);
|
6
|
+
import { SkfSelectOptionGroup as w } from "./select-option-group.component.js";
|
7
|
+
import "../tag/tag.js";
|
8
|
+
import { computePosition as C, flip as x, shift as V, offset as $ } from "@floating-ui/dom";
|
9
|
+
import { FormBase as L } from "../../internal/components/formBase.js";
|
10
|
+
import "../../internal/components/hint/hint.js";
|
11
|
+
import { PopoverController as E } from "../../internal/controllers/popover.controller.js";
|
12
|
+
import { findMatchingTags as k } from "../../internal/helpers/findMatchingTags.js";
|
13
|
+
import { hintSeverity as A } from "../../internal/helpers/hintSeverity.js";
|
14
|
+
import { raiseError as D } from "../../internal/helpers/raiseError.js";
|
15
|
+
import { watch as S } from "../../internal/helpers/watch.js";
|
16
|
+
import { Asterisk as I } from "../../internal/templates/asterisk.js";
|
17
|
+
import { componentStyles as P } from "../../styles/component.styles.js";
|
18
|
+
import { LocalizeController as T } from "../../utilities/localize.js";
|
19
|
+
import { nothing as y, html as p } from "lit";
|
20
|
+
import { property as r, state as u, query as m, queryAssignedElements as F } from "lit/decorators.js";
|
21
|
+
import { classMap as U } from "lit/directives/class-map.js";
|
22
|
+
import { ifDefined as O } from "lit/directives/if-defined.js";
|
23
|
+
import { SkfSelectOption as z } from "./select-option.component.js";
|
24
|
+
import { GlobalClickController as M, KeyboardNavigationController as B, DeveloperFeedbackController as q } from "./select.controllers.js";
|
25
|
+
import { styles as j } from "./select.styles.js";
|
26
|
+
var N = Object.defineProperty, R = Object.getOwnPropertyDescriptor, s = (o, a, t, e) => {
|
27
|
+
for (var l = e > 1 ? void 0 : e ? R(a, t) : a, n = o.length - 1, h; n >= 0; n--)
|
28
|
+
(h = o[n]) && (l = (e ? h(a, t, l) : h(l)) || l);
|
29
|
+
return e && l && N(a, t, l), l;
|
30
|
+
}, d;
|
31
|
+
const f = class f extends L {
|
24
32
|
constructor() {
|
25
|
-
super()
|
33
|
+
super();
|
34
|
+
g(this, d);
|
35
|
+
b(this, d, new T(this)), this._componentIsConnected = !1, this._defaultButtonLabel = "Select an option", this.selectDelay = 200, this._optionsList = [], this.buttonLabel = this._defaultButtonLabel, this.hideLabel = !1, this.hideTags = !1, this.lang = "en", this.multiple = !1, this.showValid = !1, this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new M(this), this.keyboardNavController = new B(this), this.developerFeedbackController = new q(this), this.popoverController = new E(this), this._handleOptionSelected = (t) => {
|
26
36
|
this._pristine = !1;
|
27
37
|
const e = this._selectedOptions.length > 0;
|
28
38
|
this.setFormValue(e ? this.selectedValues.join(",") : null), this._updateState(t);
|
@@ -33,9 +43,9 @@ const c = class c extends b {
|
|
33
43
|
this.$popover.style.setProperty("--select-width", `${String(this.offsetWidth)}px`);
|
34
44
|
}, 50);
|
35
45
|
}, this.reposition = async () => {
|
36
|
-
const { x: t, y: e } = await
|
46
|
+
const { x: t, y: e } = await C(this.$anchor, this.$popover, {
|
37
47
|
placement: "bottom",
|
38
|
-
middleware: [
|
48
|
+
middleware: [x(), V(), $(2)],
|
39
49
|
strategy: "fixed"
|
40
50
|
});
|
41
51
|
Object.assign(this.$popover.style, {
|
@@ -59,20 +69,34 @@ const c = class c extends b {
|
|
59
69
|
default:
|
60
70
|
throw new Error("Something went wrong");
|
61
71
|
}
|
62
|
-
this.emitEvent("change"), this._validateInput(), this.$selectedValue && (this.$selectedValue.animate([{ opacity: 0.5 }, { opacity: 1 }], this.selectDelay).onfinish = () => {
|
72
|
+
this._componentIsConnected && this.emitEvent("change"), this._validateInput(), this.$selectedValue && (this.$selectedValue.animate([{ opacity: 0.5 }, { opacity: 1 }], this.selectDelay).onfinish = () => {
|
63
73
|
this.multiple || (this._expanded = !1), t("done");
|
64
74
|
});
|
65
75
|
}), this._resetSelectedOptions = (t) => {
|
66
76
|
const e = !t;
|
67
77
|
this._optionsList.forEach((l) => {
|
68
78
|
(e || l !== t) && l.removeAttribute("selected");
|
69
|
-
});
|
79
|
+
}), this._optionsList = [];
|
70
80
|
}, this._handleSlotChange = () => {
|
71
|
-
this._collectSlotOptionTags(), this._validateInput();
|
72
|
-
}, this.
|
73
|
-
|
74
|
-
|
75
|
-
|
81
|
+
this._handleSizeUpdate(), this._collectSlotOptionTags(), this._ifValueIsSetSelectOption(), this._validateInput(), this._componentIsConnected = !0, this.emitEvent("skf-select-connected");
|
82
|
+
}, this._ifValueIsSetSelectOption = () => {
|
83
|
+
if (this.value)
|
84
|
+
if (this.multiple) {
|
85
|
+
const t = String(this.value).split(",").map((e) => e.toLowerCase().trim());
|
86
|
+
this._optionsList.forEach((e) => {
|
87
|
+
t.includes(e.value.toLowerCase().trim()) ? (e.setSelectedDiscrete = !0, this.selectedOptions = [...this.selectedOptions, e]) : (e.setSelectedDiscrete = !1, this._selectedOptions = this._selectedOptions.filter(
|
88
|
+
(l) => l.value.toLowerCase().trim() !== e.value.toLowerCase().trim()
|
89
|
+
));
|
90
|
+
}), this._setValue().catch((e) => {
|
91
|
+
console.error(e);
|
92
|
+
});
|
93
|
+
} else {
|
94
|
+
const t = this.value.toLowerCase().trim(), e = this._optionsList.find((l) => l.value.toLowerCase().trim() === t);
|
95
|
+
e && (e.setSelectedDiscrete = !0, this.selectedOptions = [e], this._setValue().catch((l) => {
|
96
|
+
console.error(l);
|
97
|
+
}));
|
98
|
+
}
|
99
|
+
}, this._computeVisibleValue = () => this.buttonLabel !== this._defaultButtonLabel ? this.buttonLabel : (this.$selectedValue?.classList.add("contains-meta-info"), this._selectedOptions.length > 1 ? `(${c(this, d).term("itemsSelected", this._selectedOptions.length)})` : this.value ? (this.$selectedValue?.classList.remove("contains-meta-info"), this._selectedOptions[0].textContent) : (this.$selectedValue?.classList.add("contains-meta-info"), this.buttonLabel)), this._selectedOptions = [];
|
76
100
|
}
|
77
101
|
set selectedValues(t) {
|
78
102
|
this._selectedOptions = this._optionsList.filter((e) => t.includes(e.value.trim()));
|
@@ -89,8 +113,12 @@ const c = class c extends b {
|
|
89
113
|
return this._selectedOptions.map((t) => t.textContent ?? "");
|
90
114
|
}
|
91
115
|
set value(t) {
|
92
|
-
|
93
|
-
this.
|
116
|
+
let e = [];
|
117
|
+
this._componentIsConnected && (this.multiple ? e = String(t).split(",").map((n) => n.toLowerCase().trim()) : e = [String(t).toLowerCase().trim()], this._selectedOptions = this._optionsList.filter(
|
118
|
+
(n) => e.includes(n.value.toLowerCase().trim())
|
119
|
+
), this._optionsList.forEach((n) => {
|
120
|
+
n.selected && (n.setSelectedDiscrete = !1);
|
121
|
+
}), this._selectedOptions.forEach((n) => n.setSelectedDiscrete = !0)), this._setValue();
|
94
122
|
}
|
95
123
|
get value() {
|
96
124
|
return this._selectedOptions.length ? this._selectedOptions.length === 1 ? this._selectedOptions[0].value.trim() : this._selectedOptions.map((t) => t.value.trim()).join(",") : "";
|
@@ -120,25 +148,28 @@ const c = class c extends b {
|
|
120
148
|
this.removeAttribute("invalid"), !this._pristine && this.showValid && this.setAttribute("valid", "true"), this.hint = this.getAttribute("hint") ?? "";
|
121
149
|
}
|
122
150
|
firstUpdated() {
|
123
|
-
|
124
|
-
|
151
|
+
this.addEventListener("skf-select-option-select", this._handleOptionSelected), this._internals.form?.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this._validateInput();
|
152
|
+
}
|
153
|
+
_handleSizeUpdate() {
|
154
|
+
this._slottedItems.forEach((t) => {
|
155
|
+
(t instanceof z || t instanceof w) && (t.small = this.size === "sm");
|
156
|
+
});
|
125
157
|
}
|
126
158
|
handleExpandedChange() {
|
127
159
|
this._expanded ? (this.$popover.togglePopover(this._expanded), this.popoverController.start()) : (this.$popover.togglePopover(this._expanded), this.popoverController.stop().catch((t) => {
|
128
160
|
console.error(t);
|
129
|
-
})), this.emit("skf-select
|
161
|
+
})), this.emit("skf-select-dropdown", { detail: { expanded: this._expanded } });
|
130
162
|
}
|
131
163
|
attributeChangedCallback(t, e, l) {
|
132
164
|
if (super.attributeChangedCallback(t, e, l), t === "custom-invalid")
|
133
165
|
if (typeof l == "string") {
|
134
|
-
const
|
135
|
-
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 },
|
166
|
+
const h = this.withFallback(l);
|
167
|
+
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, h), this.checkValidity();
|
136
168
|
} else
|
137
169
|
this.setValidity({}), this._validateInput();
|
138
170
|
}
|
139
171
|
disconnectedCallback() {
|
140
|
-
|
141
|
-
super.disconnectedCallback(), (t = this._internals.form) == null || t.removeEventListener("reset", this._handleReset);
|
172
|
+
super.disconnectedCallback(), this._internals.form?.removeEventListener("reset", this._handleReset);
|
142
173
|
}
|
143
174
|
/** @internal */
|
144
175
|
_updateState(t) {
|
@@ -159,7 +190,7 @@ const c = class c extends b {
|
|
159
190
|
/** @internal */
|
160
191
|
/** Filter out elements other than skf-select-option and store in this._optionsList */
|
161
192
|
_collectSlotOptionTags() {
|
162
|
-
this._optionsList =
|
193
|
+
this._optionsList = k(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), D({
|
163
194
|
assert: this._optionsList.length > 0,
|
164
195
|
reason: "no-children",
|
165
196
|
replaceStrings: [this.localName, "skf-select-option"]
|
@@ -173,51 +204,51 @@ const c = class c extends b {
|
|
173
204
|
this._invalid = !0;
|
174
205
|
return;
|
175
206
|
} else if (t) {
|
176
|
-
const
|
177
|
-
this.setValidity({ valueMissing: !0 }, String(
|
207
|
+
const h = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : "Please select an option";
|
208
|
+
this.setValidity({ valueMissing: !0 }, String(h)), this._pristine || (this._invalid = !0);
|
178
209
|
} else if (e) {
|
179
|
-
const
|
180
|
-
this.setValidity({ rangeUnderflow: !0 }, String(
|
210
|
+
const h = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
|
211
|
+
this.setValidity({ rangeUnderflow: !0 }, String(h)), this._pristine || (this._invalid = !0);
|
181
212
|
} else if (l) {
|
182
|
-
const
|
183
|
-
this.setValidity({ rangeOverflow: !0 }, String(
|
213
|
+
const h = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
|
214
|
+
this.setValidity({ rangeOverflow: !0 }, String(h)), this._pristine || (this._invalid = !0);
|
184
215
|
} else
|
185
216
|
this.setValidity({}), !this._pristine && this.showValid && this.setAttribute("valid", "true");
|
186
217
|
}
|
187
218
|
render() {
|
188
|
-
return
|
219
|
+
return p`
|
189
220
|
<div id="root">
|
190
221
|
<label>
|
191
222
|
<div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
|
192
223
|
${this.label}
|
193
|
-
${this.required ?
|
224
|
+
${this.required ? I(c(this, d).term("required")) : y}
|
194
225
|
</div>
|
195
226
|
<button
|
196
227
|
?disabled=${this.disabled}
|
197
228
|
@click=${this._handleDropdownToggle}
|
198
229
|
aria-controls="select-dropdown"
|
199
230
|
aria-expanded=${this._expanded}
|
200
|
-
aria-invalid=${this._invalid}
|
201
231
|
aria-haspopup="listbox"
|
202
|
-
|
232
|
+
aria-invalid=${this._invalid}
|
233
|
+
aria-labelledby="label"
|
203
234
|
id="select-button"
|
204
235
|
role="combobox"
|
205
236
|
>
|
206
237
|
<span
|
207
238
|
id="selected-value"
|
208
|
-
class=${
|
239
|
+
class=${U({ "selected-value": !0, "contains-meta-info": !this.value })}>
|
209
240
|
${this._computeVisibleValue()}
|
210
241
|
</span>
|
211
|
-
<skf-icon class="arrow" name="chevronDown"></skf-icon>
|
242
|
+
<skf-icon class="arrow" data-color="custom" name="chevronDown"></skf-icon>
|
212
243
|
</button>
|
213
244
|
</label>
|
214
|
-
<div aria-multiselectable=${
|
245
|
+
<div aria-labelledby="select-button" aria-multiselectable=${O(this.multiple && !0)} id="select-dropdown" popover role="listbox">
|
215
246
|
<slot @slotchange=${this._handleSlotChange}></slot>
|
216
247
|
</div>
|
217
|
-
${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ?
|
248
|
+
${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ? p`
|
218
249
|
<div id="tags">
|
219
250
|
${this.selectedOptions.map(
|
220
|
-
(t) =>
|
251
|
+
(t) => p`
|
221
252
|
<skf-tag
|
222
253
|
style="${`view-transition-name: tag-${String(t.textContent).replace(/[^a-zA-Z]/g, "").toLowerCase()}`}"
|
223
254
|
removable
|
@@ -230,12 +261,13 @@ const c = class c extends b {
|
|
230
261
|
`
|
231
262
|
)}
|
232
263
|
</div>
|
233
|
-
` :
|
234
|
-
${this.hint &&
|
264
|
+
` : y}
|
265
|
+
${this.hint && p`
|
235
266
|
<skf-hint
|
267
|
+
?disabled=${this.disabled}
|
236
268
|
aria-live=${this._invalid ? "assertive" : "polite"}
|
237
269
|
id="hint"
|
238
|
-
severity=${
|
270
|
+
severity=${O(A(this._invalid, this.severity))}
|
239
271
|
>
|
240
272
|
${this.customInvalid ?? this.hint}
|
241
273
|
</skf-hint>
|
@@ -245,79 +277,85 @@ const c = class c extends b {
|
|
245
277
|
`;
|
246
278
|
}
|
247
279
|
};
|
248
|
-
|
249
|
-
let i =
|
280
|
+
d = new WeakMap(), f.styles = [P, j];
|
281
|
+
let i = f;
|
250
282
|
s([
|
251
|
-
|
283
|
+
r({ type: String, reflect: !0, attribute: "button-label" })
|
252
284
|
], i.prototype, "buttonLabel", 2);
|
253
285
|
s([
|
254
|
-
|
286
|
+
r({ type: String, attribute: "custom-invalid" })
|
255
287
|
], i.prototype, "customInvalid", 2);
|
256
288
|
s([
|
257
|
-
|
289
|
+
r({ type: Boolean, attribute: "hide-label" })
|
258
290
|
], i.prototype, "hideLabel", 2);
|
259
291
|
s([
|
260
|
-
|
292
|
+
r({ type: Boolean, reflect: !0, attribute: "hide-tags" })
|
261
293
|
], i.prototype, "hideTags", 2);
|
262
294
|
s([
|
263
|
-
|
295
|
+
r({ type: String })
|
264
296
|
], i.prototype, "hint", 2);
|
265
297
|
s([
|
266
|
-
|
298
|
+
r({ type: Array, attribute: !1 })
|
267
299
|
], i.prototype, "selectedValues", 1);
|
268
300
|
s([
|
269
|
-
|
301
|
+
r({ type: Array, attribute: !1 })
|
270
302
|
], i.prototype, "selectedOptionsText", 1);
|
271
303
|
s([
|
272
|
-
|
304
|
+
r({ type: String, reflect: !0 })
|
273
305
|
], i.prototype, "label", 2);
|
274
306
|
s([
|
275
|
-
|
307
|
+
r({ type: String })
|
308
|
+
], i.prototype, "lang", 2);
|
309
|
+
s([
|
310
|
+
r({ type: Number })
|
276
311
|
], i.prototype, "max", 2);
|
277
312
|
s([
|
278
|
-
|
313
|
+
r({ type: Number })
|
279
314
|
], i.prototype, "min", 2);
|
280
315
|
s([
|
281
|
-
|
316
|
+
r({ type: Boolean, reflect: !0 })
|
282
317
|
], i.prototype, "multiple", 2);
|
283
318
|
s([
|
284
|
-
|
319
|
+
r({ type: String })
|
285
320
|
], i.prototype, "name", 2);
|
286
321
|
s([
|
287
|
-
|
288
|
-
], i.prototype, "requiredLabel", 2);
|
289
|
-
s([
|
290
|
-
o()
|
322
|
+
r()
|
291
323
|
], i.prototype, "severity", 2);
|
292
324
|
s([
|
293
|
-
|
325
|
+
r({ type: Boolean, attribute: "show-valid" })
|
294
326
|
], i.prototype, "showValid", 2);
|
295
327
|
s([
|
296
|
-
|
328
|
+
r({ reflect: !0 })
|
297
329
|
], i.prototype, "size", 2);
|
298
330
|
s([
|
299
|
-
|
331
|
+
r({ type: String, attribute: !1 })
|
300
332
|
], i.prototype, "value", 1);
|
301
333
|
s([
|
302
|
-
|
334
|
+
u()
|
303
335
|
], i.prototype, "selectedOptions", 1);
|
304
336
|
s([
|
305
|
-
|
337
|
+
u()
|
306
338
|
], i.prototype, "_expanded", 2);
|
307
339
|
s([
|
308
|
-
|
340
|
+
u()
|
309
341
|
], i.prototype, "_invalid", 2);
|
310
342
|
s([
|
311
|
-
|
343
|
+
m("#select-button")
|
312
344
|
], i.prototype, "$anchor", 2);
|
313
345
|
s([
|
314
|
-
|
346
|
+
m("#selected-value")
|
315
347
|
], i.prototype, "$selectedValue", 2);
|
316
348
|
s([
|
317
|
-
|
349
|
+
m("#select-dropdown")
|
318
350
|
], i.prototype, "$popover", 2);
|
319
351
|
s([
|
320
|
-
|
352
|
+
F()
|
353
|
+
], i.prototype, "_slottedItems", 2);
|
354
|
+
s([
|
355
|
+
S("size", { waitUntilFirstUpdate: !0 })
|
356
|
+
], i.prototype, "_handleSizeUpdate", 1);
|
357
|
+
s([
|
358
|
+
S("_expanded", { afterUpdate: !0 })
|
321
359
|
], i.prototype, "handleExpandedChange", 1);
|
322
360
|
export {
|
323
361
|
i as SkfSelect
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { SkfSelectOption } from '../select-option/select-option.component.js';
|
2
1
|
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
2
|
+
import type { SkfSelectOption } from './select-option.component.js';
|
3
3
|
/**
|
4
4
|
* Workaround for storybook helper not being able to import types
|
5
5
|
* E.g type ControllerHost = SkfSelect;
|
@@ -1,9 +1,8 @@
|
|
1
|
-
import { raiseError as
|
1
|
+
import { raiseError as l } from "../../internal/helpers/raiseError.js";
|
2
2
|
class d {
|
3
3
|
constructor(t) {
|
4
4
|
this._globalClickHandler = (e) => {
|
5
|
-
|
6
|
-
!((s = this.host) != null && s.localName) || e.target.closest(this.host.localName) || (this.host._expanded = !1);
|
5
|
+
!this.host?.localName || e.target.closest(this.host.localName) || (this.host._expanded = !1);
|
7
6
|
}, (this.host = t).addController(this);
|
8
7
|
}
|
9
8
|
// hostConnected() {
|
@@ -13,8 +12,7 @@ class d {
|
|
13
12
|
this.disableGlobalClickDetection();
|
14
13
|
}
|
15
14
|
hostUpdated() {
|
16
|
-
|
17
|
-
(t = this.host) != null && t._expanded ? this.enableGlobalClickDetection() : this.disableGlobalClickDetection();
|
15
|
+
this.host?._expanded ? this.enableGlobalClickDetection() : this.disableGlobalClickDetection();
|
18
16
|
}
|
19
17
|
enableGlobalClickDetection() {
|
20
18
|
document.addEventListener("click", this._globalClickHandler);
|
@@ -48,8 +46,7 @@ class p {
|
|
48
46
|
this.removeKeyboardListener();
|
49
47
|
}
|
50
48
|
hostUpdated() {
|
51
|
-
|
52
|
-
(t = this.host) != null && t._expanded && !this._listenerActivated && this.setupKeyboardListener(), !((e = this.host) != null && e._expanded) && this._listenerActivated && this.removeKeyboardListener();
|
49
|
+
this.host?._expanded && !this._listenerActivated && this.setupKeyboardListener(), !this.host?._expanded && this._listenerActivated && this.removeKeyboardListener();
|
53
50
|
}
|
54
51
|
setupKeyboardListener() {
|
55
52
|
this._listenerActivated = !0, this.host.addEventListener("keydown", this._handleKeyDown);
|
@@ -64,16 +61,16 @@ class p {
|
|
64
61
|
});
|
65
62
|
}
|
66
63
|
_focusSiblingOption(t) {
|
67
|
-
const e = (
|
68
|
-
if (!
|
64
|
+
const e = (n) => n === document.activeElement, s = this._selectableOptions.find((n) => e(n));
|
65
|
+
if (!s) {
|
69
66
|
this._focusFirstOption();
|
70
67
|
return;
|
71
68
|
}
|
72
|
-
const
|
73
|
-
let
|
74
|
-
|
75
|
-
const h = this._selectableOptions[t === "next" ?
|
76
|
-
|
69
|
+
const r = this._selectableOptions.indexOf(s);
|
70
|
+
let i = r - 1, o = r + 1;
|
71
|
+
i < 0 && (i = this._selectableOptions.length - 1), o >= this._selectableOptions.length && (o = 0);
|
72
|
+
const h = this._selectableOptions[t === "next" ? o : i];
|
73
|
+
s.blur(), h.focus();
|
77
74
|
}
|
78
75
|
_selectFocusedOption(t) {
|
79
76
|
t.selected = !0;
|
@@ -92,19 +89,20 @@ class b {
|
|
92
89
|
_badAttributeCombinationWarning() {
|
93
90
|
if (!this.host) return;
|
94
91
|
const t = this.host.localName ?? "never";
|
95
|
-
|
92
|
+
l({
|
96
93
|
assert: (this.host.min ?? 0) <= (this.host.max ?? 1 / 0),
|
97
94
|
reason: "attribute-mismatch",
|
98
95
|
replaceStrings: [t, "min", "smaller than max"]
|
99
|
-
}),
|
96
|
+
}), l({
|
100
97
|
assert: (
|
101
98
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
102
99
|
(this.host.min || this.host.max) && this.host.multiple || !(this.host.min && this.host.max)
|
103
100
|
),
|
104
101
|
reason: "attribute-mismatch",
|
105
102
|
replaceStrings: [t, "min or max", "together with multiple"]
|
106
|
-
}),
|
107
|
-
|
103
|
+
}), l({
|
104
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
105
|
+
assert: this.host.hideTags && this.host.multiple || !this.host.hideTags,
|
108
106
|
reason: "attribute-mismatch",
|
109
107
|
replaceStrings: [t, "hide-tags", "together with multiple"]
|
110
108
|
});
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { visuallyHidden as r } from "../../styles/util.styles.js";
|
2
|
-
import { css as
|
2
|
+
import { css as e } from "lit";
|
3
3
|
const t = [
|
4
4
|
r,
|
5
|
-
|
5
|
+
e`
|
6
6
|
@layer components {
|
7
7
|
:host {
|
8
8
|
contain: initial;
|
@@ -53,6 +53,12 @@ const t = [
|
|
53
53
|
justify-content: space-between;
|
54
54
|
padding-inline: var(--skf-spacing-75);
|
55
55
|
|
56
|
+
span {
|
57
|
+
overflow: hidden;
|
58
|
+
text-overflow: ellipsis;
|
59
|
+
white-space: nowrap;
|
60
|
+
}
|
61
|
+
|
56
62
|
&:hover {
|
57
63
|
--_skf-select-button-bg-color: var(--skf-interactive-bg-color-secondary-hover);
|
58
64
|
}
|
@@ -35,7 +35,7 @@ export declare class SkfStepperItem extends SkfElement {
|
|
35
35
|
/** @internal */
|
36
36
|
set _setInternalState(state: typeof this._uiState);
|
37
37
|
get _setInternalState(): typeof this._uiState;
|
38
|
-
|
38
|
+
connectedCallback(): void;
|
39
39
|
protected firstUpdated(): void;
|
40
40
|
/** @internal */
|
41
41
|
_handleState(): void;
|