@skf-design-system/ui-components 1.0.2-beta.0 → 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 +12 -8
- 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 +5 -9
- package/dist/components/accordion/accordion.component.js +4 -5
- 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 +4 -7
- package/dist/components/alert/alert.component.js +8 -9
- 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 +1 -1
- 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 +1 -1
- package/dist/components/checkbox/checkbox.component.d.ts +8 -6
- package/dist/components/checkbox/checkbox.component.js +2 -2
- 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.js +1 -1
- package/dist/components/date-picker/datepicker.component.js +1 -1
- package/dist/components/date-picker-input/datepicker-input.component.d.ts +1 -0
- package/dist/components/date-picker-input/datepicker-input.component.js +3 -2
- package/dist/components/dialog/dialog.component.d.ts +5 -4
- package/dist/components/dialog/dialog.component.js +44 -44
- package/dist/components/dialog/dialog.styles.js +4 -4
- package/dist/components/divider/divider.component.js +1 -1
- package/dist/components/drawer/drawer.component.d.ts +12 -8
- package/dist/components/drawer/drawer.component.js +5 -4
- package/dist/components/header/header.component.d.ts +3 -2
- package/dist/components/header/header.component.js +34 -28
- package/dist/components/heading/heading.component.d.ts +3 -5
- package/dist/components/heading/heading.component.js +22 -21
- 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 +136 -123
- package/dist/components/link/link.component.d.ts +12 -14
- package/dist/components/link/link.component.js +34 -34
- package/dist/components/link/link.styles.d.ts +1 -2
- package/dist/components/link/link.styles.js +2 -2
- 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 +9 -6
- package/dist/components/menu/menu.component.js +8 -10
- package/dist/components/{nav-item → nav}/nav-item.component.d.ts +0 -2
- package/dist/components/{nav-item → nav}/nav-item.component.js +1 -1
- package/dist/components/nav/nav.component.js +1 -1
- package/dist/components/popover/popover.component.d.ts +10 -6
- package/dist/components/popover/popover.component.js +22 -24
- 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 +9 -7
- package/dist/components/radio/radio.component.js +2 -2
- 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/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 +73 -0
- 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.js +1 -1
- 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.component.d.ts +16 -15
- package/dist/components/select/select.component.js +17 -17
- package/dist/components/select/select.controllers.d.ts +1 -1
- package/dist/components/select/select.controllers.js +14 -11
- 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.component.d.ts +2 -2
- 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.js +15 -15
- 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 +10 -14
- package/dist/components/tag/tag.component.js +32 -35
- package/dist/components/textarea/textarea.component.d.ts +10 -11
- package/dist/components/textarea/textarea.component.js +62 -64
- 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 +5 -4
- 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 +2 -1
- package/dist/components/tooltip/tooltip.component.js +15 -10
- package/dist/custom-elements.json +733 -820
- package/dist/index.d.ts +13 -7
- package/dist/index.js +100 -84
- package/dist/internal/base-classes/popover/popover.base.d.ts +10 -5
- package/dist/internal/base-classes/popover/popover.base.js +77 -60
- 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/helpers/hintSeverity.d.ts +2 -2
- package/dist/internal/helpers/hintSeverity.js +1 -1
- 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/global.css +1 -1
- package/dist/types/jsx/custom-element-jsx.d.ts +162 -180
- package/dist/types/vue/index.d.ts +162 -180
- package/dist/vscode.html-custom-data.json +133 -1091
- package/dist/web-types.json +368 -424
- package/package.json +24 -25
- 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/internal/constants/heading.d.ts +0 -2
- /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/{menu-item → menu}/menu-item.d.ts +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/{menu-item → menu}/menu-item.styles.js +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/{nav-item → nav}/nav-item.styles.js +0 -0
- /package/dist/components/{segmented-button-item → segmented-button}/segmented-button-item.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.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/select-option.styles.d.ts → select/select-option-group.style.d.ts} +0 -0
- /package/dist/components/{select-option-group → select}/select-option-group.style.js +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/{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/{toast-wrapper/toast-wrapper.styles.d.ts → stepper/stepper-item.styles.d.ts} +0 -0
- /package/dist/components/{stepper-item → stepper}/stepper-item.styles.js +0 -0
- /package/dist/components/{toast-item → toast}/toast-item.component.d.ts +0 -0
- /package/dist/components/{toast-item → toast}/toast-item.component.js +0 -0
- /package/dist/components/{toast-item → toast}/toast-item.styles.d.ts +0 -0
- /package/dist/components/{toast-item → toast}/toast-item.styles.js +0 -0
- /package/dist/components/{toast-wrapper → toast}/toast-wrapper.component.d.ts +0 -0
- /package/dist/components/{toast-wrapper → toast}/toast-wrapper.d.ts +0 -0
- /package/dist/components/{toast-wrapper → toast}/toast-wrapper.js +0 -0
- /package/dist/components/{toast-wrapper → toast}/toast-wrapper.styles.js +0 -0
@@ -1,49 +1,43 @@
|
|
1
|
-
var
|
1
|
+
var u = (t) => {
|
2
2
|
throw TypeError(t);
|
3
3
|
};
|
4
|
-
var
|
5
|
-
var
|
4
|
+
var d = (t, e, r) => e.has(t) || u("Cannot " + r);
|
5
|
+
var h = (t, e, r) => (d(t, e, "read from private field"), r ? r.call(t) : e.get(t)), f = (t, e, r) => e.has(t) ? u("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), v = (t, e, r, l) => (d(t, e, "write to private field"), l ? l.call(t, r) : e.set(t, r), r);
|
6
6
|
import { SkfElement as y } from "../../internal/components/skf-element.js";
|
7
|
-
import
|
8
|
-
import { html as
|
9
|
-
import { property as
|
10
|
-
import {
|
11
|
-
|
12
|
-
var
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
}, o;
|
7
|
+
import { componentStyles as b } from "../../styles/component.styles.js";
|
8
|
+
import { html as x } from "lit";
|
9
|
+
import { property as n } from "lit/decorators.js";
|
10
|
+
import { styles as C } from "./progress.styles.js";
|
11
|
+
var _ = Object.defineProperty, m = (t, e, r, l) => {
|
12
|
+
for (var s = void 0, p = t.length - 1, c; p >= 0; p--)
|
13
|
+
(c = t[p]) && (s = c(e, r, s) || s);
|
14
|
+
return s && _(e, r, s), s;
|
15
|
+
}, a;
|
17
16
|
const i = class i extends y {
|
18
17
|
constructor() {
|
19
|
-
super();
|
20
|
-
|
21
|
-
this.animated = !1, this.max = 1, this.value = 0
|
18
|
+
super(...arguments);
|
19
|
+
f(this, a);
|
20
|
+
v(this, a, this.attachInternals()), this.animated = !1, this.max = 1, this.value = 0;
|
21
|
+
}
|
22
|
+
connectedCallback() {
|
23
|
+
super.connectedCallback(), h(this, a).role = "progressbar";
|
22
24
|
}
|
23
25
|
render() {
|
24
26
|
const r = this.value / this.max * 100;
|
25
|
-
return
|
26
|
-
<div
|
27
|
-
class=${_({
|
28
|
-
progress: !0,
|
29
|
-
"progress--animated": this.animated
|
30
|
-
})}
|
31
|
-
style="--_skf-progress-value: ${r}%"
|
32
|
-
></div>
|
33
|
-
`;
|
27
|
+
return x`<div id="root" style="--_skf-progress-value: ${r}%"></div>`;
|
34
28
|
}
|
35
29
|
};
|
36
|
-
|
37
|
-
let
|
38
|
-
|
39
|
-
|
40
|
-
],
|
41
|
-
|
42
|
-
|
43
|
-
],
|
44
|
-
|
45
|
-
|
46
|
-
],
|
30
|
+
a = new WeakMap(), i.styles = [b, C], i.formAssociated = !0;
|
31
|
+
let o = i;
|
32
|
+
m([
|
33
|
+
n({ type: Boolean, reflect: !0 })
|
34
|
+
], o.prototype, "animated");
|
35
|
+
m([
|
36
|
+
n({ type: Number })
|
37
|
+
], o.prototype, "max");
|
38
|
+
m([
|
39
|
+
n({ type: Number })
|
40
|
+
], o.prototype, "value");
|
47
41
|
export {
|
48
|
-
|
42
|
+
o as SkfProgress
|
49
43
|
};
|
@@ -1,48 +1,53 @@
|
|
1
1
|
import { css as r } from "lit";
|
2
|
-
const
|
3
|
-
/* stylelint-disable selector-class-pattern */
|
2
|
+
const e = r`
|
4
3
|
@layer components {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
@layer base {
|
5
|
+
#root {
|
6
|
+
background: var(--skf-bg-color-neutral-3);
|
7
|
+
block-size: var(--skf-size-8);
|
8
|
+
border-radius: 0.25rem; /* Missing token */
|
9
|
+
overflow: hidden;
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
&::after {
|
12
|
+
background-color: var(--skf-bg-color-emphasised);
|
13
|
+
block-size: inherit;
|
14
|
+
border-radius: inherit;
|
15
|
+
content: '';
|
16
|
+
display: block;
|
17
|
+
inline-size: var(--_skf-progress-value, auto);
|
18
|
+
transition: inline-size calc(var(--skf-motion-duration-slow) * 1ms)
|
19
|
+
cubic-bezier(0.4, 0.93, 0.71, 0.89);
|
20
|
+
}
|
20
21
|
}
|
21
22
|
}
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
24
|
+
@layer mods {
|
25
|
+
:host([animated]) {
|
26
|
+
#root::after {
|
27
|
+
animation: skf-progress-animation calc(var(--skf-motion-duration-slow) * 1ms) linear
|
28
|
+
infinite reverse;
|
29
|
+
background-image: linear-gradient(
|
30
|
+
-45deg,
|
31
|
+
rgba(255 255 255 / 20%) 25%,
|
32
|
+
transparent 25%,
|
33
|
+
transparent 50%,
|
34
|
+
rgba(255 255 255 / 20%) 50%,
|
35
|
+
rgba(255 255 255 / 20%) 75%,
|
36
|
+
transparent 75%,
|
37
|
+
transparent
|
38
|
+
);
|
39
|
+
background-size: 50px 50px;
|
40
|
+
}
|
41
|
+
}
|
37
42
|
}
|
43
|
+
}
|
38
44
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
}
|
45
|
+
@keyframes skf-progress-animation {
|
46
|
+
to {
|
47
|
+
background-position: 50px 50px;
|
43
48
|
}
|
44
49
|
}
|
45
50
|
`;
|
46
51
|
export {
|
47
|
-
|
52
|
+
e as styles
|
48
53
|
};
|
@@ -1,16 +1,17 @@
|
|
1
1
|
import '../icon/icon.js';
|
2
2
|
import { FormBase } from '../../internal/components/formBase.js';
|
3
|
+
import type { FormFieldSeverity } from '../../internal/types.js';
|
3
4
|
import type { FormFieldBaseProps } from '../../internal/types/formField.js';
|
4
5
|
import { type CSSResultGroup } from 'lit';
|
5
6
|
/**
|
6
7
|
* The `<skf-radio>` component is used to create a radio input
|
7
8
|
*
|
8
|
-
*
|
9
|
+
* See [zeroheight](https://zeroheight.com/853e936c9/p/78d5dd-radio-button) for design principles
|
9
10
|
*
|
10
11
|
* @attribute {boolean} [disabled=false] - If true, sets disabled state
|
11
12
|
* @attribute {boolean} [required=false] - If true, value is required or must be checked for the form to be submittable
|
12
13
|
*
|
13
|
-
* @event
|
14
|
+
* @event {Event} change - When the value of the input changes
|
14
15
|
*
|
15
16
|
* @slot - The radios label. Alternatively, you can use the `label` attribute.
|
16
17
|
*
|
@@ -37,11 +38,8 @@ export declare class SkfRadio extends FormBase implements FormFieldBaseProps {
|
|
37
38
|
requiredLabel?: string;
|
38
39
|
/** Size of the Radio */
|
39
40
|
size: 'sm' | 'md';
|
40
|
-
/**
|
41
|
-
|
42
|
-
* @type {"success" | "info" | "warning" | "alert"}
|
43
|
-
*/
|
44
|
-
severity?: FormFieldBaseProps['severity'];
|
41
|
+
/** If defined, displays provided severity state */
|
42
|
+
severity?: FormFieldSeverity;
|
45
43
|
/** If true, displays valid state after interaction */
|
46
44
|
showValid: boolean;
|
47
45
|
/** The current value of the input field */
|
@@ -53,9 +51,13 @@ export declare class SkfRadio extends FormBase implements FormFieldBaseProps {
|
|
53
51
|
private $input?;
|
54
52
|
connectedCallback(): void;
|
55
53
|
protected firstUpdated(): void;
|
54
|
+
/** @internal */
|
56
55
|
handleInvalidChange(): void;
|
56
|
+
/** @internal */
|
57
57
|
handleDebugInvalid(): void;
|
58
|
+
/** @internal */
|
58
59
|
handleCheckedChanged(): void;
|
60
|
+
/** @internal */
|
59
61
|
handleCustomInvalidChange(): void;
|
60
62
|
/** @internal */
|
61
63
|
private _resetValue;
|
@@ -2,7 +2,7 @@ import "../icon/icon.js";
|
|
2
2
|
import { FormBase as c } from "../../internal/components/formBase.js";
|
3
3
|
import { watch as n } from "../../internal/helpers/watch.js";
|
4
4
|
import { Asterisk as p } from "../../internal/templates/asterisk.js";
|
5
|
-
import v from "../../styles/component.styles.js";
|
5
|
+
import { componentStyles as v } from "../../styles/component.styles.js";
|
6
6
|
import { html as m } from "lit";
|
7
7
|
import { property as r, state as f, query as y } from "lit/decorators.js";
|
8
8
|
import { ifDefined as b } from "lit/directives/if-defined.js";
|
@@ -81,7 +81,7 @@ const d = class d extends c {
|
|
81
81
|
<input
|
82
82
|
?disabled=${this.disabled}
|
83
83
|
?required=${this.required}
|
84
|
-
.checked=${_(
|
84
|
+
.checked=${_(this.checked)}
|
85
85
|
aria-invalid=${!!this._invalid}
|
86
86
|
name=${b(this.name)}
|
87
87
|
type="radio"
|
@@ -7,9 +7,9 @@ export interface SkfSegmentedButtonItemEvent {
|
|
7
7
|
/**
|
8
8
|
* The `<skf-segmented-button-item>` is used in conjunction with the `<skf-segmented-button>` component
|
9
9
|
*
|
10
|
-
* @event {CustomEvent}
|
10
|
+
* @event {CustomEvent} skf-segmented-button-item-select - Fired when selected
|
11
11
|
*
|
12
|
-
* @slot -
|
12
|
+
* @slot - Label for the button
|
13
13
|
*
|
14
14
|
* @tagname skf-segmented-button-item
|
15
15
|
*/
|
@@ -23,14 +23,14 @@ export declare class SkfSegmentedButtonItem extends SkfElement {
|
|
23
23
|
};
|
24
24
|
/** If true, items is marked as disabled */
|
25
25
|
disabled: boolean;
|
26
|
+
/** If true, items is marked as selected */
|
27
|
+
selected: boolean;
|
26
28
|
/** Sets the item value */
|
27
29
|
value: string;
|
28
30
|
constructor();
|
29
31
|
/** @internal */
|
30
32
|
isMultiple: boolean;
|
31
33
|
/** @internal */
|
32
|
-
isSelected: boolean;
|
33
|
-
/** @internal */
|
34
34
|
private _handleClick;
|
35
35
|
render(): import("lit").TemplateResult<1>;
|
36
36
|
}
|
@@ -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,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
|
+
};
|
@@ -11,8 +11,6 @@ import { type CSSResultGroup } from 'lit';
|
|
11
11
|
*/
|
12
12
|
export declare class SkfSegmentedButton extends SkfElement {
|
13
13
|
static styles: CSSResultGroup;
|
14
|
-
/** Sets the default selected control */
|
15
|
-
defaultSelected: number;
|
16
14
|
/** If true, allowes multiple items to be selected */
|
17
15
|
multiple: boolean;
|
18
16
|
/** @internal */
|
@@ -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,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";
|
@@ -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 })
|