@skf-design-system/ui-components 1.0.0-beta.7 → 1.0.1-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/dist/components/alert/alert.component.d.ts +2 -2
- package/dist/components/alert/alert.component.js +34 -34
- package/dist/components/breadcrumb/breadcrumb.component.d.ts +29 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +8 -0
- package/dist/components/breadcrumb/breadcrumb.styles.d.ts +1 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.component.d.ts +25 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.d.ts +8 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.styles.d.ts +1 -0
- package/dist/components/button/button.component.d.ts +6 -4
- package/dist/components/button/button.component.js +87 -70
- package/dist/components/button/button.styles.js +64 -45
- package/dist/components/checkbox/checkbox.component.d.ts +3 -1
- package/dist/components/checkbox/checkbox.component.js +71 -58
- package/dist/components/date-picker/datepicker.calendar.component.d.ts +72 -0
- package/dist/components/date-picker/datepicker.calendar.component.js +382 -0
- package/dist/components/date-picker/datepicker.calendar.styles.d.ts +1 -0
- package/dist/components/date-picker/datepicker.calendar.styles.js +192 -0
- package/dist/components/date-picker/datepicker.component.d.ts +74 -0
- package/dist/components/date-picker/datepicker.component.js +241 -0
- package/dist/components/date-picker/datepicker.d.ts +10 -0
- package/dist/components/date-picker/datepicker.helpers.d.ts +40 -0
- package/dist/components/date-picker/datepicker.helpers.js +69 -0
- package/dist/components/date-picker/datepicker.js +8 -0
- package/dist/components/date-picker/datepicker.styles.d.ts +1 -0
- package/dist/components/date-picker/datepicker.styles.js +99 -0
- package/dist/components/date-picker-input/datepicker-input.component.d.ts +107 -0
- package/dist/components/date-picker-input/datepicker-input.component.js +397 -0
- package/dist/components/date-picker-input/datepicker-input.d.ts +8 -0
- package/dist/components/date-picker-input/datepicker-input.helpers.d.ts +4 -0
- package/dist/components/date-picker-input/datepicker-input.helpers.js +29 -0
- package/dist/components/date-picker-input/datepicker-input.js +6 -0
- package/dist/components/date-picker-input/datepicker-input.styles.d.ts +1 -0
- package/dist/components/date-picker-input/datepicker-input.styles.js +22 -0
- package/dist/components/dialog/dialog.component.d.ts +0 -1
- package/dist/components/dialog/dialog.component.js +2 -4
- package/dist/components/icon/icon.component.d.ts +1 -4
- package/dist/components/icon/icon.component.js +28 -19
- package/dist/components/icon/icon.styles.js +53 -47
- package/dist/components/input/input.component.d.ts +1 -0
- package/dist/components/input/input.component.js +87 -80
- package/dist/components/link/link.component.d.ts +1 -0
- package/dist/components/link/link.component.js +21 -21
- package/dist/components/menu/menu.component.d.ts +24 -0
- package/dist/components/menu/menu.component.js +18 -0
- package/dist/components/menu/menu.d.ts +8 -0
- package/dist/components/menu/menu.js +6 -0
- package/dist/components/menu/menu.styles.d.ts +1 -0
- package/dist/components/menu/menu.styles.js +11 -0
- package/dist/components/menu-item/menu-item.component.d.ts +25 -0
- package/dist/components/menu-item/menu-item.component.js +13 -0
- package/dist/components/menu-item/menu-item.d.ts +8 -0
- package/dist/components/menu-item/menu-item.js +6 -0
- package/dist/components/menu-item/menu-item.styles.d.ts +1 -0
- package/dist/components/menu-item/menu-item.styles.js +19 -0
- package/dist/components/popover/popover.component.d.ts +29 -0
- package/dist/components/popover/popover.component.js +37 -0
- package/dist/components/popover/popover.d.ts +8 -0
- package/dist/components/popover/popover.js +6 -0
- package/dist/components/popover/popover.styles.d.ts +1 -0
- package/dist/components/popover/popover.styles.js +12 -0
- package/dist/components/select/select.component.d.ts +8 -10
- package/dist/components/select/select.component.js +115 -118
- package/dist/components/select/select.controllers.d.ts +0 -25
- package/dist/components/select/select.controllers.js +35 -95
- package/dist/components/stepper/stepper.component.d.ts +38 -0
- package/dist/components/stepper/stepper.component.js +91 -0
- package/dist/components/stepper/stepper.d.ts +8 -0
- package/dist/components/stepper/stepper.helpers.d.ts +16 -0
- package/dist/components/stepper/stepper.helpers.js +18 -0
- package/dist/components/stepper/stepper.js +6 -0
- package/dist/components/stepper/stepper.styles.d.ts +1 -0
- package/dist/components/stepper/stepper.styles.js +15 -0
- package/dist/components/stepper-item/stepper-item.component.d.ts +47 -0
- package/dist/components/stepper-item/stepper-item.component.js +113 -0
- package/dist/components/stepper-item/stepper-item.d.ts +8 -0
- package/dist/components/stepper-item/stepper-item.js +6 -0
- package/dist/components/stepper-item/stepper-item.styles.d.ts +1 -0
- package/dist/components/stepper-item/stepper-item.styles.js +98 -0
- package/dist/components/toast/toast.component.d.ts +7 -4
- package/dist/components/toast/toast.component.js +24 -20
- package/dist/components/toast/toast.singleton.d.ts +2 -7
- package/dist/components/toast/toast.singleton.js +25 -25
- package/dist/components/toast-item/toast-item.component.js +15 -15
- package/dist/components/toast-item/toast-item.styles.js +13 -11
- package/dist/components/tooltip/tooltip.component.d.ts +24 -0
- package/dist/components/tooltip/tooltip.component.js +18 -0
- package/dist/components/tooltip/tooltip.d.ts +8 -0
- package/dist/components/tooltip/tooltip.js +6 -0
- package/dist/components/tooltip/tooltip.styles.d.ts +1 -0
- package/dist/components/tooltip/tooltip.styles.js +12 -0
- package/dist/custom-elements.json +3278 -1321
- package/dist/index.d.ts +8 -0
- package/dist/index.js +78 -54
- package/dist/internal/base-classes/popover/popover.base.d.ts +29 -0
- package/dist/internal/base-classes/popover/popover.base.js +116 -0
- package/dist/internal/base-classes/popover/popover.styles.d.ts +1 -0
- package/dist/internal/base-classes/popover/popover.styles.js +29 -0
- package/dist/internal/controllers/popover.controller.d.ts +17 -0
- package/dist/internal/controllers/popover.controller.js +44 -0
- package/dist/internal/helpers/dateFormatter.d.ts +2 -0
- package/dist/internal/helpers/hintSeverity.d.ts +1 -1
- package/dist/internal/helpers/utilityTypes.d.ts +22 -0
- package/dist/react/index.d.ts +11 -2
- package/dist/react/index.js +11 -2
- package/dist/react/skf-breadcrumb/index.d.ts +9 -0
- package/dist/react/skf-breadcrumb/index.js +17 -0
- package/dist/react/skf-breadcrumb-item/index.d.ts +3 -0
- package/dist/react/skf-breadcrumb-item/index.js +13 -0
- package/dist/react/skf-datepicker/index.d.ts +12 -0
- package/dist/react/skf-datepicker/index.js +18 -0
- package/dist/react/skf-menu/index.d.ts +12 -0
- package/dist/react/skf-menu/index.js +18 -0
- package/dist/react/skf-menu-item/index.d.ts +27 -0
- package/dist/react/skf-menu-item/index.js +23 -0
- package/dist/react/skf-popover/index.d.ts +12 -0
- package/dist/react/skf-popover/index.js +18 -0
- package/dist/react/skf-stepper/index.d.ts +9 -0
- package/dist/react/skf-stepper/index.js +17 -0
- package/dist/react/skf-stepper-item/index.d.ts +9 -0
- package/dist/react/skf-stepper-item/index.js +17 -0
- package/dist/react/skf-tooltip/index.d.ts +12 -0
- package/dist/react/skf-tooltip/index.js +18 -0
- package/dist/types/jsx/custom-element-jsx.d.ts +628 -155
- package/dist/types/vue/index.d.ts +369 -74
- package/dist/vscode.html-custom-data.json +761 -391
- package/dist/web-types.json +936 -293
- package/package.json +34 -33
@@ -0,0 +1,25 @@
|
|
1
|
+
import { SkfLink } from '../link/link.component.js';
|
2
|
+
import { type CSSResultGroup } from 'lit';
|
3
|
+
/**
|
4
|
+
* The `<skf-menu-item>` is a component that displays a list of actions or options.
|
5
|
+
*
|
6
|
+
* @documentation See [zeroheight](https://zeroheight.com/****) for design principles
|
7
|
+
*
|
8
|
+
* @event {CustomEvent} my-tag-my-event - Fired when something happens
|
9
|
+
*
|
10
|
+
* @event click - Fired when the component is clicked
|
11
|
+
* @event mouseover - Fired when the mouse is over the component
|
12
|
+
* @event mouseout - Fired when the mouse is out of the component
|
13
|
+
* @event focus - Fired when the component is focused
|
14
|
+
* @event blur - Fired when the component is blurred
|
15
|
+
* @event change - Fired when the component's value changes
|
16
|
+
*
|
17
|
+
* @slot - The component's main content
|
18
|
+
* @slot my-named-slot - A named slot of the component
|
19
|
+
*
|
20
|
+
* @tagname skf-menu-item
|
21
|
+
*/
|
22
|
+
export declare class SkfMenuItem extends SkfLink {
|
23
|
+
static styles: CSSResultGroup;
|
24
|
+
constructor();
|
25
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { SkfLink as s } from "../link/link.component.js";
|
2
|
+
import "lit";
|
3
|
+
import { styles as o } from "./menu-item.styles.js";
|
4
|
+
const t = class t extends s {
|
5
|
+
constructor() {
|
6
|
+
super(), s.classMap = { "menu-item": !0 };
|
7
|
+
}
|
8
|
+
};
|
9
|
+
t.styles = [s.styles, o];
|
10
|
+
let r = t;
|
11
|
+
export {
|
12
|
+
r as SkfMenuItem
|
13
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { css as e } from "lit";
|
2
|
+
const s = e`
|
3
|
+
@layer components {
|
4
|
+
.menu-item {
|
5
|
+
block-size: var(--skf-size-44);
|
6
|
+
display: flex;
|
7
|
+
padding-inline: var(--skf-spacing-75);
|
8
|
+
|
9
|
+
@media screen and (any-hover: hover) {
|
10
|
+
&:hover {
|
11
|
+
background-color: var(--skf-color-blue-lighest);
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
16
|
+
`;
|
17
|
+
export {
|
18
|
+
s as styles
|
19
|
+
};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { SkfPopoverBase } from '../../internal/base-classes/popover/popover.base.js';
|
2
|
+
import type { CSSResultGroup } from 'lit';
|
3
|
+
/**
|
4
|
+
* The `<skf-popover>` is a general purpose component that displays the slot content.
|
5
|
+
*
|
6
|
+
* @documentation See [zeroheight](https://zeroheight.com/****) for design principles
|
7
|
+
*
|
8
|
+
* @property {"top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end"} [placement='bottom-start'] - The placement of the menu
|
9
|
+
* @property {boolean} [isOpen=false] - Whether the menu is open
|
10
|
+
* @property {string} [anchor] - The id of the element the menu will be anchored to
|
11
|
+
*
|
12
|
+
* @event open - Fired when the menu is opened
|
13
|
+
* @event close - Fired when the menu is closed
|
14
|
+
*
|
15
|
+
* @slot - The popover content
|
16
|
+
*
|
17
|
+
* @tagname skf-popover
|
18
|
+
*/
|
19
|
+
export declare class SkfPopover extends SkfPopoverBase {
|
20
|
+
static styles: CSSResultGroup;
|
21
|
+
/** If defined, sets a custom offset for the popover */
|
22
|
+
offset: number;
|
23
|
+
/** If true, hides the arrow */
|
24
|
+
hideArrow: boolean;
|
25
|
+
constructor();
|
26
|
+
hideArrowChanged(): void;
|
27
|
+
addEventListeners($element: HTMLElement | Element): void;
|
28
|
+
removeEventListeners($element: HTMLElement | Element): void;
|
29
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { SkfPopoverBase as h } from "../../internal/base-classes/popover/popover.base.js";
|
2
|
+
import { watch as d } from "../../internal/helpers/watch.js";
|
3
|
+
import { property as f } from "lit/decorators.js";
|
4
|
+
import { styles as v } from "./popover.styles.js";
|
5
|
+
var w = Object.defineProperty, l = Object.getOwnPropertyDescriptor, n = (m, e, s, o) => {
|
6
|
+
for (var r = o > 1 ? void 0 : o ? l(e, s) : e, i = m.length - 1, p; i >= 0; i--)
|
7
|
+
(p = m[i]) && (r = (o ? p(e, s, r) : p(r)) || r);
|
8
|
+
return o && r && w(e, s, r), r;
|
9
|
+
};
|
10
|
+
const a = class a extends h {
|
11
|
+
constructor() {
|
12
|
+
super(), this.offset = 8, this.hideArrow = !1, this.arrow = !this.hideArrow, this.placement = "bottom-start", h.classMap = { popover: !0 };
|
13
|
+
}
|
14
|
+
hideArrowChanged() {
|
15
|
+
this.arrow = !this.hideArrow;
|
16
|
+
}
|
17
|
+
addEventListeners(e) {
|
18
|
+
e.addEventListener("mouseenter", this.open);
|
19
|
+
}
|
20
|
+
removeEventListeners(e) {
|
21
|
+
e.removeEventListener("mouseenter", this.open);
|
22
|
+
}
|
23
|
+
};
|
24
|
+
a.styles = [h.styles, v];
|
25
|
+
let t = a;
|
26
|
+
n([
|
27
|
+
f({ type: Number })
|
28
|
+
], t.prototype, "offset", 2);
|
29
|
+
n([
|
30
|
+
f({ type: Boolean })
|
31
|
+
], t.prototype, "hideArrow", 2);
|
32
|
+
n([
|
33
|
+
d("hideArrow")
|
34
|
+
], t.prototype, "hideArrowChanged", 1);
|
35
|
+
export {
|
36
|
+
t as SkfPopover
|
37
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import { FormBase } from '../../internal/components/formBase.js';
|
2
|
+
import { PopoverController } from '../../internal/controllers/popover.controller.js';
|
2
3
|
import type { FormFieldBaseProps } from '../../internal/types/formField.js';
|
3
4
|
import { type CSSResultGroup } from 'lit';
|
4
5
|
import '../../internal/components/hint/hint';
|
5
6
|
import type { SelectOptionEvent, SkfSelectOption } from '../select-option/select-option.component.js';
|
6
7
|
import '../tag/tag';
|
7
|
-
import { DeveloperFeedbackController, GlobalClickController, KeyboardNavigationController
|
8
|
+
import { DeveloperFeedbackController, GlobalClickController, KeyboardNavigationController } from './select.controllers.js';
|
8
9
|
/**
|
9
10
|
* TODO: abstract the popover logic to a separate component/helper/partial, and use it in both select and in input[datalist], combobox etc
|
10
11
|
*
|
@@ -84,25 +85,23 @@ export declare class SkfSelect extends FormBase {
|
|
84
85
|
/** True if the internal state is invalid */
|
85
86
|
private _invalid;
|
86
87
|
/** @internal */
|
87
|
-
|
88
|
+
$anchor: HTMLButtonElement;
|
88
89
|
/** @internal */
|
89
90
|
private $selectedValue?;
|
90
91
|
/** @internal */
|
91
|
-
|
92
|
-
/** @internal */
|
93
|
-
protected scrollController: ScrollController;
|
94
|
-
/** @internal */
|
95
|
-
protected resizeController: ResizeController;
|
92
|
+
$popover: HTMLDivElement;
|
96
93
|
/** @internal */
|
97
94
|
protected globalClickController: GlobalClickController;
|
98
95
|
/** @internal */
|
99
96
|
protected keyboardNavController: KeyboardNavigationController;
|
100
97
|
/** @internal */
|
101
98
|
protected developerFeedbackController: DeveloperFeedbackController;
|
99
|
+
/** @internal */
|
100
|
+
protected popoverController: PopoverController;
|
102
101
|
constructor();
|
103
102
|
willUpdate(changedProperties: Map<string | number | symbol, unknown>): void;
|
104
103
|
firstUpdated(): void;
|
105
|
-
|
104
|
+
handleExpandedChange(): void;
|
106
105
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
107
106
|
disconnectedCallback(): void;
|
108
107
|
/** @internal */
|
@@ -119,8 +118,7 @@ export declare class SkfSelect extends FormBase {
|
|
119
118
|
/** @internal */
|
120
119
|
_updateWidth: () => void;
|
121
120
|
/** @internal */
|
122
|
-
|
123
|
-
private _managePopover;
|
121
|
+
reposition: () => Promise<void>;
|
124
122
|
/** @internal */
|
125
123
|
_handleDropdownToggle: (e: Event) => void;
|
126
124
|
/** @internal
|
@@ -1,26 +1,28 @@
|
|
1
1
|
import { computePosition as v, flip as f, shift as _, offset as g } from "@floating-ui/dom";
|
2
2
|
import { FormBase as b } from "../../internal/components/formBase.js";
|
3
|
-
import {
|
4
|
-
import {
|
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";
|
5
6
|
import { raiseError as w } from "../../internal/helpers/raiseError.js";
|
6
|
-
import {
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import {
|
10
|
-
import {
|
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 { html as n, nothing as C } 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";
|
11
13
|
import { ifDefined as m } from "lit/directives/if-defined.js";
|
12
14
|
import "../../internal/components/hint/hint.js";
|
13
15
|
import "../tag/tag.js";
|
14
|
-
import {
|
16
|
+
import { GlobalClickController as k, KeyboardNavigationController as L, DeveloperFeedbackController as A } from "./select.controllers.js";
|
15
17
|
import { styles as P } from "./select.styles.js";
|
16
|
-
var T = Object.defineProperty, D = Object.getOwnPropertyDescriptor,
|
17
|
-
for (var
|
18
|
-
(
|
19
|
-
return
|
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;
|
20
22
|
};
|
21
23
|
const c = class c extends b {
|
22
24
|
constructor() {
|
23
|
-
super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.size = "md", this._expanded = !1, this._invalid = !1, this.
|
25
|
+
super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.size = "md", this._expanded = !1, this._invalid = !1, this.globalClickController = new k(this), this.keyboardNavController = new L(this), this.developerFeedbackController = new A(this), this.popoverController = new y(this), this._handleOptionSelected = (t) => {
|
24
26
|
this._pristine = !1;
|
25
27
|
const e = this._selectedOptions.length > 0;
|
26
28
|
this.setFormValue(e ? this.selectedValues.join(",") : null), this._updateState(t);
|
@@ -28,26 +30,20 @@ const c = class c extends b {
|
|
28
30
|
this.emitEvent("reset"), this._resetSelectedOptions();
|
29
31
|
}, this._updateWidth = () => {
|
30
32
|
setTimeout(() => {
|
31
|
-
|
32
|
-
(t = this.$dropdown) == null || t.style.setProperty("--select-width", `${String(this.offsetWidth)}px`);
|
33
|
+
this.$popover.style.setProperty("--select-width", `${String(this.offsetWidth)}px`);
|
33
34
|
}, 50);
|
34
|
-
}, this.
|
35
|
-
|
36
|
-
(i = this.$dropdown) == null || i.hidePopover();
|
37
|
-
}, open: () => {
|
38
|
-
const i = this.$selectBtn, r = this.$dropdown;
|
39
|
-
!i || !r || (r.showPopover(), v(i, r, {
|
35
|
+
}, this.reposition = async () => {
|
36
|
+
const { x: t, y: e } = await v(this.$anchor, this.$popover, {
|
40
37
|
placement: "bottom",
|
41
|
-
middleware: [f(), _({ padding: 5 }), g(2)]
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
}
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
} }), this._handleDropdownToggle = (t) => {
|
38
|
+
middleware: [f(), _({ padding: 5 }), g(2)],
|
39
|
+
strategy: "fixed"
|
40
|
+
});
|
41
|
+
Object.assign(this.$popover.style, {
|
42
|
+
left: `${String(t)}px`,
|
43
|
+
top: `${String(e)}px`,
|
44
|
+
width: `${String(this.$anchor.offsetWidth)}px`
|
45
|
+
});
|
46
|
+
}, this._handleDropdownToggle = (t) => {
|
51
47
|
t.stopPropagation(), this._expanded = !this._expanded;
|
52
48
|
}, this._setValue = async () => new Promise((t) => {
|
53
49
|
switch (!0) {
|
@@ -68,8 +64,8 @@ const c = class c extends b {
|
|
68
64
|
});
|
69
65
|
}), this._resetSelectedOptions = (t) => {
|
70
66
|
const e = !t;
|
71
|
-
this._optionsList.forEach((
|
72
|
-
(e ||
|
67
|
+
this._optionsList.forEach((l) => {
|
68
|
+
(e || l !== t) && l.removeAttribute("selected");
|
73
69
|
});
|
74
70
|
}, this._handleSlotChange = () => {
|
75
71
|
this._collectSlotOptionTags(), this._validateInput();
|
@@ -93,8 +89,8 @@ const c = class c extends b {
|
|
93
89
|
return this._selectedOptions.map((t) => t.textContent ?? "");
|
94
90
|
}
|
95
91
|
set value(t) {
|
96
|
-
const e = t.split(",").map((
|
97
|
-
this._selectedOptions = this._optionsList.filter((
|
92
|
+
const e = t.split(",").map((l) => l.trim());
|
93
|
+
this._selectedOptions = this._optionsList.filter((l) => e.includes(l.value.trim()));
|
98
94
|
}
|
99
95
|
get value() {
|
100
96
|
return this._selectedOptions.length ? this._selectedOptions.length === 1 ? this._selectedOptions[0].value.trim() : this._selectedOptions.map((t) => t.value.trim()).join(",") : "";
|
@@ -127,18 +123,16 @@ const c = class c extends b {
|
|
127
123
|
var t;
|
128
124
|
this.addEventListener("skf-select-option:select", this._handleOptionSelected), (t = this._internals.form) == null || t.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this._validateInput();
|
129
125
|
}
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
this._expanded ? this._managePopover().open() : this._managePopover().close();
|
135
|
-
}
|
126
|
+
handleExpandedChange() {
|
127
|
+
this._expanded ? (this.$popover.togglePopover(this._expanded), this.popoverController.start()) : (this.$popover.togglePopover(this._expanded), this.popoverController.stop().catch((t) => {
|
128
|
+
console.error(t);
|
129
|
+
})), this.emit("skf-select:dropdown", { detail: { expanded: this._expanded } });
|
136
130
|
}
|
137
|
-
attributeChangedCallback(t, e,
|
138
|
-
if (super.attributeChangedCallback(t, e,
|
139
|
-
if (typeof
|
140
|
-
const
|
141
|
-
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 },
|
131
|
+
attributeChangedCallback(t, e, l) {
|
132
|
+
if (super.attributeChangedCallback(t, e, l), t === "custom-invalid")
|
133
|
+
if (typeof l == "string") {
|
134
|
+
const r = this.withFallback(l);
|
135
|
+
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, r), this.checkValidity();
|
142
136
|
} else
|
143
137
|
this.setValidity({}), this._validateInput();
|
144
138
|
}
|
@@ -153,8 +147,8 @@ const c = class c extends b {
|
|
153
147
|
e.selected && (this.selectedOptions = [...this.selectedOptions, e]);
|
154
148
|
});
|
155
149
|
else {
|
156
|
-
const e = this._selectedOptions.length > 0,
|
157
|
-
e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []),
|
150
|
+
const e = this._selectedOptions.length > 0, l = t.detail.value !== null;
|
151
|
+
e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), l && (this.selectedOptions = [t.target]);
|
158
152
|
}
|
159
153
|
this._setValue();
|
160
154
|
}
|
@@ -165,7 +159,7 @@ const c = class c extends b {
|
|
165
159
|
/** @internal */
|
166
160
|
/** Filter out elements other than skf-select-option and store in this._optionsList */
|
167
161
|
_collectSlotOptionTags() {
|
168
|
-
this._optionsList =
|
162
|
+
this._optionsList = O(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), w({
|
169
163
|
assert: this._optionsList.length > 0,
|
170
164
|
reason: "no-children",
|
171
165
|
replaceStrings: [this.localName, "skf-select-option"]
|
@@ -174,29 +168,29 @@ const c = class c extends b {
|
|
174
168
|
/** @internal */
|
175
169
|
_validateInput() {
|
176
170
|
this._invalid = !1;
|
177
|
-
const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min),
|
171
|
+
const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min), l = !!(this.max && this.selectedValues.length > this.max);
|
178
172
|
if (this._internals.validity.customError) {
|
179
173
|
this._invalid = !0;
|
180
174
|
return;
|
181
175
|
} else if (t) {
|
182
|
-
const
|
183
|
-
this.setValidity({ valueMissing: !0 }, String(
|
176
|
+
const r = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : "Please select an option";
|
177
|
+
this.setValidity({ valueMissing: !0 }, String(r)), this._pristine || (this._invalid = !0);
|
184
178
|
} else if (e) {
|
185
|
-
const
|
186
|
-
this.setValidity({ rangeUnderflow: !0 }, String(
|
187
|
-
} else if (
|
188
|
-
const
|
189
|
-
this.setValidity({ rangeOverflow: !0 }, String(
|
179
|
+
const r = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
|
180
|
+
this.setValidity({ rangeUnderflow: !0 }, String(r)), this._pristine || (this._invalid = !0);
|
181
|
+
} else if (l) {
|
182
|
+
const r = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
|
183
|
+
this.setValidity({ rangeOverflow: !0 }, String(r)), this._pristine || (this._invalid = !0);
|
190
184
|
} else
|
191
185
|
this.setValidity({}), !this._pristine && this.showValid && this.setAttribute("valid", "true");
|
192
186
|
}
|
193
187
|
render() {
|
194
|
-
return
|
188
|
+
return n`
|
195
189
|
<div id="root">
|
196
190
|
<label>
|
197
191
|
<div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
|
198
192
|
${this.label}
|
199
|
-
${this.required ?
|
193
|
+
${this.required ? V(this.requiredLabel) : null}
|
200
194
|
</div>
|
201
195
|
<button
|
202
196
|
?disabled=${this.disabled}
|
@@ -211,7 +205,7 @@ const c = class c extends b {
|
|
211
205
|
>
|
212
206
|
<span
|
213
207
|
id="selected-value"
|
214
|
-
class=${
|
208
|
+
class=${E({ "selected-value": !0, "contains-meta-info": !this.value })}>
|
215
209
|
${this._computeVisibleValue()}
|
216
210
|
</span>
|
217
211
|
<skf-icon class="arrow" name="chevronDown"></skf-icon>
|
@@ -220,10 +214,10 @@ const c = class c extends b {
|
|
220
214
|
<div aria-multiselectable=${m(this.multiple && !0)} id="select-dropdown" popover role="listbox">
|
221
215
|
<slot @slotchange=${this._handleSlotChange}></slot>
|
222
216
|
</div>
|
223
|
-
${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ?
|
217
|
+
${!this.hideTags && this.multiple && this.selectedOptions.length > 0 ? n`
|
224
218
|
<div id="tags">
|
225
219
|
${this.selectedOptions.map(
|
226
|
-
(t) =>
|
220
|
+
(t) => n`
|
227
221
|
<skf-tag
|
228
222
|
style="${`view-transition-name: tag-${String(t.textContent).replace(/[^a-zA-Z]/g, "").toLowerCase()}`}"
|
229
223
|
removable
|
@@ -236,12 +230,12 @@ const c = class c extends b {
|
|
236
230
|
`
|
237
231
|
)}
|
238
232
|
</div>
|
239
|
-
` :
|
240
|
-
${this.hint &&
|
233
|
+
` : C}
|
234
|
+
${this.hint && n`
|
241
235
|
<skf-hint
|
242
236
|
aria-live=${this._invalid ? "assertive" : "polite"}
|
243
237
|
id="hint"
|
244
|
-
severity=${m(
|
238
|
+
severity=${m(x(this.severity, this._invalid))}
|
245
239
|
>
|
246
240
|
${this.customInvalid ? this.customInvalid : this.hint}
|
247
241
|
</skf-hint>
|
@@ -251,77 +245,80 @@ const c = class c extends b {
|
|
251
245
|
`;
|
252
246
|
}
|
253
247
|
};
|
254
|
-
c.styles = [
|
255
|
-
let
|
256
|
-
|
248
|
+
c.styles = [S, P];
|
249
|
+
let i = c;
|
250
|
+
s([
|
257
251
|
o({ type: String, reflect: !0, attribute: "button-label" })
|
258
|
-
],
|
259
|
-
|
252
|
+
], i.prototype, "buttonLabel", 2);
|
253
|
+
s([
|
260
254
|
o({ attribute: "custom-invalid" })
|
261
|
-
],
|
262
|
-
|
255
|
+
], i.prototype, "customInvalid", 2);
|
256
|
+
s([
|
263
257
|
o({ type: Boolean, attribute: "hide-label" })
|
264
|
-
],
|
265
|
-
|
258
|
+
], i.prototype, "hideLabel", 2);
|
259
|
+
s([
|
266
260
|
o({ type: Boolean, reflect: !0, attribute: "hide-tags" })
|
267
|
-
],
|
268
|
-
|
261
|
+
], i.prototype, "hideTags", 2);
|
262
|
+
s([
|
269
263
|
o()
|
270
|
-
],
|
271
|
-
|
264
|
+
], i.prototype, "hint", 2);
|
265
|
+
s([
|
272
266
|
o({ type: Array, attribute: !1 })
|
273
|
-
],
|
274
|
-
|
267
|
+
], i.prototype, "selectedValues", 1);
|
268
|
+
s([
|
275
269
|
o({ type: Array, attribute: !1 })
|
276
|
-
],
|
277
|
-
|
270
|
+
], i.prototype, "selectedOptionsText", 1);
|
271
|
+
s([
|
278
272
|
o({ reflect: !0 })
|
279
|
-
],
|
280
|
-
|
273
|
+
], i.prototype, "label", 2);
|
274
|
+
s([
|
281
275
|
o({ type: Number })
|
282
|
-
],
|
283
|
-
|
276
|
+
], i.prototype, "max", 2);
|
277
|
+
s([
|
284
278
|
o({ type: Number })
|
285
|
-
],
|
286
|
-
|
279
|
+
], i.prototype, "min", 2);
|
280
|
+
s([
|
287
281
|
o({ type: Boolean, reflect: !0 })
|
288
|
-
],
|
289
|
-
|
282
|
+
], i.prototype, "multiple", 2);
|
283
|
+
s([
|
290
284
|
o()
|
291
|
-
],
|
292
|
-
|
285
|
+
], i.prototype, "name", 2);
|
286
|
+
s([
|
293
287
|
o({ attribute: "required-label" })
|
294
|
-
],
|
295
|
-
|
288
|
+
], i.prototype, "requiredLabel", 2);
|
289
|
+
s([
|
296
290
|
o()
|
297
|
-
],
|
298
|
-
|
291
|
+
], i.prototype, "severity", 2);
|
292
|
+
s([
|
299
293
|
o({ type: Boolean, attribute: "show-valid" })
|
300
|
-
],
|
301
|
-
|
294
|
+
], i.prototype, "showValid", 2);
|
295
|
+
s([
|
302
296
|
o({ reflect: !0 })
|
303
|
-
],
|
304
|
-
|
305
|
-
|
306
|
-
],
|
307
|
-
|
308
|
-
|
309
|
-
],
|
310
|
-
|
311
|
-
|
312
|
-
],
|
313
|
-
|
314
|
-
|
315
|
-
],
|
316
|
-
|
297
|
+
], i.prototype, "size", 2);
|
298
|
+
s([
|
299
|
+
h()
|
300
|
+
], i.prototype, "value", 1);
|
301
|
+
s([
|
302
|
+
h()
|
303
|
+
], i.prototype, "selectedOptions", 1);
|
304
|
+
s([
|
305
|
+
h()
|
306
|
+
], i.prototype, "_expanded", 2);
|
307
|
+
s([
|
308
|
+
h()
|
309
|
+
], i.prototype, "_invalid", 2);
|
310
|
+
s([
|
317
311
|
p("#select-button")
|
318
|
-
],
|
319
|
-
|
312
|
+
], i.prototype, "$anchor", 2);
|
313
|
+
s([
|
320
314
|
p("#selected-value")
|
321
|
-
],
|
322
|
-
|
315
|
+
], i.prototype, "$selectedValue", 2);
|
316
|
+
s([
|
323
317
|
p("#select-dropdown")
|
324
|
-
],
|
318
|
+
], i.prototype, "$popover", 2);
|
319
|
+
s([
|
320
|
+
$("_expanded", { afterUpdate: !0 })
|
321
|
+
], i.prototype, "handleExpandedChange", 1);
|
325
322
|
export {
|
326
|
-
|
323
|
+
i as SkfSelect
|
327
324
|
};
|
@@ -2,31 +2,6 @@ import type { SkfSelectOption } from '../select-option/select-option.component.j
|
|
2
2
|
import type { ReactiveController } from 'lit';
|
3
3
|
import type { SkfSelect } from './select.component.js';
|
4
4
|
type ControllerHost = SkfSelect;
|
5
|
-
export declare class ScrollController implements ReactiveController {
|
6
|
-
_scrollHandler?: () => void;
|
7
|
-
host?: ControllerHost;
|
8
|
-
localExpanded: boolean;
|
9
|
-
constructor(host: ControllerHost);
|
10
|
-
hostDisconnected(): void;
|
11
|
-
hostUpdated(): void;
|
12
|
-
enableScrollDetection(): void;
|
13
|
-
disableScrollDetection(): void;
|
14
|
-
/** @internal */
|
15
|
-
_onScrollOutOfView(): void;
|
16
|
-
/** @internal */
|
17
|
-
_onScrollIntoView(): void;
|
18
|
-
}
|
19
|
-
export declare class ResizeController implements ReactiveController {
|
20
|
-
host: ControllerHost;
|
21
|
-
_resizeObserver?: ResizeObserver;
|
22
|
-
constructor(host: ControllerHost);
|
23
|
-
hostConnected(): void;
|
24
|
-
hostDisconnected(): void;
|
25
|
-
enableResizeObserver(): void;
|
26
|
-
disableResizeObserver(): void;
|
27
|
-
/** @internal */
|
28
|
-
_onResize: () => void;
|
29
|
-
}
|
30
5
|
export declare class GlobalClickController implements ReactiveController {
|
31
6
|
host: ControllerHost;
|
32
7
|
constructor(host: ControllerHost);
|