@skf-design-system/ui-components 1.0.1-beta.0 → 1.0.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -18
- package/dist/components/accordion/accordion.component.d.ts +4 -4
- package/dist/components/accordion/accordion.component.js +8 -8
- package/dist/components/alert/alert.component.d.ts +8 -9
- package/dist/components/alert/alert.component.js +14 -14
- package/dist/components/breadcrumb/breadcrumb.component.d.ts +1 -1
- package/dist/components/button/button.component.d.ts +3 -3
- package/dist/components/button/button.component.js +59 -55
- package/dist/components/card/card.component.js +18 -30
- package/dist/components/card/card.styles.js +25 -28
- package/dist/components/checkbox/checkbox.component.d.ts +9 -7
- package/dist/components/checkbox/checkbox.component.js +71 -58
- package/dist/components/collapse/collapse.component.js +1 -1
- package/dist/components/date-picker/datepicker.calendar.component.d.ts +77 -0
- package/dist/components/date-picker/datepicker.calendar.component.js +415 -0
- package/dist/components/date-picker/datepicker.calendar.styles.d.ts +1 -0
- package/dist/components/date-picker/datepicker.calendar.styles.js +202 -0
- package/dist/components/date-picker/datepicker.component.d.ts +79 -0
- package/dist/components/date-picker/datepicker.component.js +261 -0
- package/dist/components/date-picker/datepicker.d.ts +10 -0
- package/dist/components/date-picker/datepicker.helpers.d.ts +41 -0
- package/dist/components/date-picker/datepicker.helpers.js +76 -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 +87 -0
- package/dist/components/date-picker-input/datepicker-input.component.d.ts +115 -0
- package/dist/components/date-picker-input/datepicker-input.component.js +441 -0
- package/dist/components/date-picker-input/datepicker-input.d.ts +8 -0
- package/dist/components/date-picker-input/datepicker-input.helpers.d.ts +38 -0
- package/dist/components/date-picker-input/datepicker-input.helpers.js +31 -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 +18 -0
- package/dist/components/dialog/dialog.component.d.ts +18 -28
- package/dist/components/dialog/dialog.component.js +94 -84
- package/dist/components/divider/divider.component.d.ts +4 -8
- package/dist/components/divider/divider.component.js +24 -46
- package/dist/components/divider/divider.styles.js +34 -30
- package/dist/components/drawer/drawer.component.d.ts +57 -0
- package/dist/components/drawer/drawer.component.js +124 -0
- package/dist/components/drawer/drawer.d.ts +8 -0
- package/dist/components/drawer/drawer.js +6 -0
- package/dist/components/drawer/drawer.styles.d.ts +1 -0
- package/dist/components/drawer/drawer.styles.js +71 -0
- package/dist/components/header/header.component.d.ts +45 -0
- package/dist/components/header/header.component.js +110 -0
- package/dist/components/header/header.d.ts +8 -0
- package/dist/components/header/header.js +6 -0
- package/dist/components/header/header.styles.d.ts +1 -0
- package/dist/components/header/header.styles.js +68 -0
- package/dist/components/heading/heading.component.d.ts +6 -12
- package/dist/components/heading/heading.component.js +17 -17
- package/dist/components/heading/heading.styles.d.ts +1 -2
- package/dist/components/heading/heading.styles.js +1 -1
- package/dist/components/icon/icon.component.d.ts +1 -1
- package/dist/components/icon/icon.component.js +19 -19
- package/dist/components/input/input.component.d.ts +3 -2
- package/dist/components/input/input.component.js +89 -82
- package/dist/components/input/input.controllers.d.ts +20 -6
- package/dist/components/input/input.controllers.js +14 -10
- package/dist/components/link/link.component.js +29 -28
- package/dist/components/link/link.styles.js +24 -20
- package/dist/components/loader/loader.component.js +19 -19
- package/dist/components/logo/logo.component.js +6 -6
- package/dist/components/menu/menu.component.d.ts +4 -5
- package/dist/components/menu/menu.component.js +1 -1
- package/dist/components/nav/nav.component.d.ts +17 -0
- package/dist/components/nav/nav.component.js +34 -0
- package/dist/components/nav/nav.d.ts +8 -0
- package/dist/components/nav/nav.js +6 -0
- package/dist/components/nav/nav.styles.d.ts +1 -0
- package/dist/components/nav/nav.styles.js +17 -0
- package/dist/components/nav-item/nav-item.component.d.ts +20 -0
- package/dist/components/nav-item/nav-item.component.js +38 -0
- package/dist/components/nav-item/nav-item.d.ts +8 -0
- package/dist/components/nav-item/nav-item.js +6 -0
- package/dist/components/nav-item/nav-item.styles.d.ts +1 -0
- package/dist/components/nav-item/nav-item.styles.js +39 -0
- package/dist/components/popover/popover.component.d.ts +5 -6
- package/dist/components/popover/popover.component.js +24 -24
- package/dist/components/progress/progress.component.js +7 -7
- package/dist/components/radio/radio.component.d.ts +10 -6
- package/dist/components/radio/radio.component.js +14 -14
- package/dist/components/radio/radio.styles.d.ts +1 -2
- package/dist/components/radio/radio.styles.js +1 -1
- package/dist/components/segmented-button/segmented-button.component.d.ts +32 -0
- package/dist/components/segmented-button/segmented-button.d.ts +8 -0
- package/dist/components/segmented-button/segmented-button.styles.d.ts +1 -0
- package/dist/components/segmented-button-item/segmented-button-item.component.d.ts +36 -0
- package/dist/components/segmented-button-item/segmented-button-item.d.ts +8 -0
- package/dist/components/segmented-button-item/segmented-button-item.styles.d.ts +1 -0
- package/dist/components/select/select.component.js +2 -2
- package/dist/components/select/select.controllers.d.ts +20 -9
- package/dist/components/select/select.controllers.js +27 -22
- package/dist/components/select-option/select-option.controllers.d.ts +11 -5
- package/dist/components/select-option-group/select-option-group.component.js +9 -9
- package/dist/components/stepper/stepper.component.d.ts +2 -1
- package/dist/components/stepper/stepper.component.js +9 -9
- package/dist/components/stepper/stepper.helpers.js +5 -5
- package/dist/components/stepper-item/stepper-item.component.js +25 -25
- package/dist/components/switch/switch.component.d.ts +7 -6
- package/dist/components/switch/switch.component.js +7 -7
- package/dist/components/tab/tab.component.js +4 -4
- package/dist/components/tab-panel/tab-panel.component.js +12 -12
- package/dist/components/tag/tag.component.d.ts +4 -2
- package/dist/components/tag/tag.component.js +14 -14
- package/dist/components/textarea/textarea.component.js +10 -10
- package/dist/components/toast/toast.component.d.ts +1 -1
- package/dist/components/toast/toast.component.js +13 -13
- package/dist/components/toast-wrapper/toast-wrapper.component.js +10 -10
- package/dist/components/tooltip/tooltip.component.d.ts +5 -6
- package/dist/components/tooltip/tooltip.component.js +11 -11
- package/dist/custom-elements.json +3702 -2190
- package/dist/index.d.ts +6 -0
- package/dist/index.js +84 -66
- package/dist/internal/base-classes/popover/popover.base.d.ts +17 -7
- package/dist/internal/base-classes/popover/popover.base.js +119 -75
- package/dist/internal/base-classes/popover/popover.styles.js +14 -1
- package/dist/internal/components/hint/hint.component.js +13 -13
- package/dist/internal/controllers/elementOverflowController.d.ts +13 -0
- package/dist/internal/controllers/popover.controller.d.ts +12 -6
- package/dist/internal/controllers/popover.controller.js +9 -14
- package/dist/internal/helpers/dateFormatter.d.ts +2 -0
- package/dist/internal/helpers/utilityTypes.d.ts +22 -0
- package/dist/internal/helpers/uuid.d.ts +15 -0
- package/dist/internal/helpers/uuid.js +14 -0
- package/dist/internal/storybook/styles.d.ts +1 -0
- package/dist/styles/form-field.styles.js +11 -6
- package/dist/styles/global.css +1 -1
- package/dist/types/jsx/custom-element-jsx.d.ts +663 -1240
- package/dist/types/vue/index.d.ts +453 -255
- package/dist/vscode.html-custom-data.json +821 -503
- package/dist/web-types.json +1005 -633
- package/package.json +43 -52
- package/dist/react/index.d.ts +0 -35
- package/dist/react/index.js +0 -35
- package/dist/react/skf-accordion/index.d.ts +0 -3
- package/dist/react/skf-accordion/index.js +0 -13
- package/dist/react/skf-alert/index.d.ts +0 -9
- package/dist/react/skf-alert/index.js +0 -17
- package/dist/react/skf-breadcrumb/index.d.ts +0 -9
- package/dist/react/skf-breadcrumb/index.js +0 -17
- package/dist/react/skf-breadcrumb-item/index.d.ts +0 -3
- package/dist/react/skf-breadcrumb-item/index.js +0 -13
- package/dist/react/skf-button/index.d.ts +0 -9
- package/dist/react/skf-button/index.js +0 -17
- package/dist/react/skf-card/index.d.ts +0 -3
- package/dist/react/skf-card/index.js +0 -13
- package/dist/react/skf-checkbox/index.d.ts +0 -9
- package/dist/react/skf-checkbox/index.js +0 -17
- package/dist/react/skf-collapse/index.d.ts +0 -9
- package/dist/react/skf-collapse/index.js +0 -17
- package/dist/react/skf-dialog/index.d.ts +0 -15
- package/dist/react/skf-dialog/index.js +0 -19
- package/dist/react/skf-divider/index.d.ts +0 -3
- package/dist/react/skf-divider/index.js +0 -13
- package/dist/react/skf-heading/index.d.ts +0 -3
- package/dist/react/skf-heading/index.js +0 -13
- package/dist/react/skf-icon/index.d.ts +0 -3
- package/dist/react/skf-icon/index.js +0 -13
- package/dist/react/skf-input/index.d.ts +0 -12
- package/dist/react/skf-input/index.js +0 -18
- package/dist/react/skf-link/index.d.ts +0 -3
- package/dist/react/skf-link/index.js +0 -13
- package/dist/react/skf-loader/index.d.ts +0 -3
- package/dist/react/skf-loader/index.js +0 -13
- package/dist/react/skf-logo/index.d.ts +0 -3
- package/dist/react/skf-logo/index.js +0 -13
- package/dist/react/skf-menu/index.d.ts +0 -12
- package/dist/react/skf-menu/index.js +0 -18
- package/dist/react/skf-menu-item/index.d.ts +0 -27
- package/dist/react/skf-menu-item/index.js +0 -23
- package/dist/react/skf-popover/index.d.ts +0 -12
- package/dist/react/skf-popover/index.js +0 -18
- package/dist/react/skf-progress/index.d.ts +0 -3
- package/dist/react/skf-progress/index.js +0 -13
- package/dist/react/skf-radio/index.d.ts +0 -9
- package/dist/react/skf-radio/index.js +0 -17
- package/dist/react/skf-select/index.d.ts +0 -21
- package/dist/react/skf-select/index.js +0 -21
- package/dist/react/skf-select-option/index.d.ts +0 -9
- package/dist/react/skf-select-option/index.js +0 -17
- package/dist/react/skf-select-option-group/index.d.ts +0 -3
- package/dist/react/skf-select-option-group/index.js +0 -13
- package/dist/react/skf-stepper/index.d.ts +0 -9
- package/dist/react/skf-stepper/index.js +0 -17
- package/dist/react/skf-stepper-item/index.d.ts +0 -9
- package/dist/react/skf-stepper-item/index.js +0 -17
- package/dist/react/skf-switch/index.d.ts +0 -3
- package/dist/react/skf-switch/index.js +0 -13
- package/dist/react/skf-tab/index.d.ts +0 -12
- package/dist/react/skf-tab/index.js +0 -18
- package/dist/react/skf-tab-group/index.d.ts +0 -3
- package/dist/react/skf-tab-group/index.js +0 -13
- package/dist/react/skf-tab-panel/index.d.ts +0 -3
- package/dist/react/skf-tab-panel/index.js +0 -13
- package/dist/react/skf-tag/index.d.ts +0 -3
- package/dist/react/skf-tag/index.js +0 -13
- package/dist/react/skf-textarea/index.d.ts +0 -12
- package/dist/react/skf-textarea/index.js +0 -18
- package/dist/react/skf-toast/index.d.ts +0 -3
- package/dist/react/skf-toast/index.js +0 -13
- package/dist/react/skf-toast-wrapper/index.d.ts +0 -3
- package/dist/react/skf-toast-wrapper/index.js +0 -13
- package/dist/react/skf-tooltip/index.d.ts +0 -12
- package/dist/react/skf-tooltip/index.js +0 -18
package/README.md
CHANGED
@@ -221,24 +221,7 @@ import { SkfInput } from "@skf-design-system/ui-components";
|
|
221
221
|
<skf-input name="input" onchange={(e) => console.log((e.target as unknown as SkfInput).value)}></skf-input>
|
222
222
|
```
|
223
223
|
|
224
|
-
|
225
|
-
|
226
|
-
> Note, for React 18 it is not necessary to install an extra plugin to get code completion since you are writing in react
|
227
|
-
|
228
|
-
React 18 does not support native web components out of the box. If you want to use SKF UI components with React 18 you will have to use our generated wrappers in order to do so.
|
229
|
-
|
230
|
-
```tsx
|
231
|
-
import { SkfInput } from "@skf-design-system/ui-components/react/index.js";
|
232
|
-
|
233
|
-
...
|
234
|
-
|
235
|
-
<SkfInput
|
236
|
-
name="input"
|
237
|
-
onChange={(e) => {
|
238
|
-
console.log( e.target.value );
|
239
|
-
}}
|
240
|
-
/>
|
241
|
-
```
|
224
|
+
⚠️ **React 18** does not support native web components. If you want to use this library you must upgrade React to version 19.
|
242
225
|
|
243
226
|
### Setting up code completion
|
244
227
|
|
@@ -14,7 +14,7 @@ import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
14
14
|
export declare class SkfAccordion extends SkfElement {
|
15
15
|
static styles: CSSResultGroup;
|
16
16
|
/** If true, will animate the expand/collapse state */
|
17
|
-
animated
|
17
|
+
animated: boolean;
|
18
18
|
/**
|
19
19
|
* Defines which heading element will be rendered
|
20
20
|
* @type { "h1" | "h2" | "h3" | "h4" }
|
@@ -23,11 +23,11 @@ export declare class SkfAccordion extends SkfElement {
|
|
23
23
|
/** If true, adds a gap between each item */
|
24
24
|
gap: boolean;
|
25
25
|
/** If true, allowes multiple accordion items to open */
|
26
|
-
multiple
|
26
|
+
multiple: boolean;
|
27
27
|
/** If true, renders the small version */
|
28
|
-
small
|
28
|
+
small: boolean;
|
29
29
|
/** If true, will truncate all headings in collapsed state */
|
30
|
-
truncate
|
30
|
+
truncate: boolean;
|
31
31
|
/** @internal */
|
32
32
|
private $accordionItems;
|
33
33
|
protected updated(_changedProperties: PropertyValues): void;
|
@@ -1,18 +1,18 @@
|
|
1
1
|
import "../collapse/collapse.js";
|
2
|
-
import { SkfElement as
|
2
|
+
import { SkfElement as p } from "../../internal/components/skf-element.js";
|
3
3
|
import m from "../../styles/component.styles.js";
|
4
4
|
import { html as f } from "lit";
|
5
5
|
import { property as a, queryAssignedNodes as d } from "lit/decorators.js";
|
6
6
|
import { classMap as c } from "lit/directives/class-map.js";
|
7
7
|
import { styles as g } from "./accordion.styles.js";
|
8
|
-
var y = Object.defineProperty, s = (u, t, i,
|
9
|
-
for (var r = void 0,
|
10
|
-
(
|
8
|
+
var y = Object.defineProperty, s = (u, t, i, l) => {
|
9
|
+
for (var r = void 0, o = u.length - 1, h; o >= 0; o--)
|
10
|
+
(h = u[o]) && (r = h(t, i, r) || r);
|
11
11
|
return r && y(t, i, r), r;
|
12
12
|
};
|
13
|
-
const n = class n extends
|
13
|
+
const n = class n extends p {
|
14
14
|
constructor() {
|
15
|
-
super(...arguments), this.headingAs = "h2", this.gap = !1, this._setItemAttributes = () => {
|
15
|
+
super(...arguments), this.animated = !1, this.headingAs = "h2", this.gap = !1, this.multiple = !1, this.small = !1, this.truncate = !1, this._setItemAttributes = () => {
|
16
16
|
this.items.forEach((t) => {
|
17
17
|
t.setAttribute("heading-as", this.headingAs), this.animated ? t.setAttribute("animated", "") : t.hasAttribute("animated") && t.removeAttribute("animated"), this.small ? t.setAttribute("small", "") : t.hasAttribute("small") && t.removeAttribute("small"), this.truncate ? t.setAttribute("truncate", "") : t.hasAttribute("truncate") && t.removeAttribute("truncate");
|
18
18
|
});
|
@@ -28,8 +28,8 @@ const n = class n extends h {
|
|
28
28
|
_onChildToggle(t) {
|
29
29
|
if (this.multiple || t.defaultPrevented) return;
|
30
30
|
const i = t.target;
|
31
|
-
this.items.length && this.items.forEach((
|
32
|
-
|
31
|
+
this.items.length && this.items.forEach((l) => {
|
32
|
+
l !== i && l.hasAttribute("expanded") && l.setClose();
|
33
33
|
});
|
34
34
|
}
|
35
35
|
render() {
|
@@ -1,8 +1,9 @@
|
|
1
|
-
import type { SkfIcon } from '../icon/icon.component.js';
|
2
1
|
import '../icon/icon.js';
|
3
2
|
import { SkfElement } from '../../internal/components/skf-element.js';
|
4
|
-
import type { SeverityFgColor } from '@skf-design-system/ui-assets';
|
3
|
+
import type { Icon, SeverityFgColor } from '@skf-design-system/ui-assets';
|
5
4
|
import { type CSSResultGroup } from 'lit';
|
5
|
+
type SkfAlertIcon = Icon;
|
6
|
+
type SkfAlertSeverity = SeverityFgColor;
|
6
7
|
/**
|
7
8
|
* The `<skf-alert>` is a type of notification that appears in-line
|
8
9
|
*
|
@@ -20,15 +21,13 @@ export declare class SkfAlert extends SkfElement {
|
|
20
21
|
/** Close button aria-label */
|
21
22
|
buttonLabel: string;
|
22
23
|
/** If defined, displays leading icon */
|
23
|
-
icon?:
|
24
|
+
icon?: SkfAlertIcon;
|
24
25
|
/** If true, renders with an close button and sets aria-role to `status` */
|
25
|
-
persistent
|
26
|
-
/**
|
27
|
-
|
28
|
-
* @type { "error" | "info" | "warning" | "success" | "alert" }
|
29
|
-
*/
|
30
|
-
severity?: SeverityFgColor;
|
26
|
+
persistent: boolean;
|
27
|
+
/** If defined, gives the supplied appearance */
|
28
|
+
severity?: SkfAlertSeverity;
|
31
29
|
/** @internal */
|
32
30
|
private _handleClose;
|
33
31
|
render(): import("lit").TemplateResult<1>;
|
34
32
|
}
|
33
|
+
export {};
|
@@ -1,27 +1,27 @@
|
|
1
1
|
import "../icon/icon.js";
|
2
2
|
import { SkfElement as y } from "../../internal/components/skf-element.js";
|
3
3
|
import f from "../../styles/component.styles.js";
|
4
|
-
import {
|
4
|
+
import { nothing as h, html as p } from "lit";
|
5
5
|
import { property as s } from "lit/decorators.js";
|
6
|
-
import { classMap as
|
7
|
-
import { ifDefined as
|
6
|
+
import { classMap as u } from "lit/directives/class-map.js";
|
7
|
+
import { ifDefined as m } from "lit/directives/if-defined.js";
|
8
8
|
import { styles as v } from "./alert.styles.js";
|
9
|
-
var b = Object.defineProperty, r = (
|
10
|
-
for (var t = void 0, i =
|
11
|
-
(c =
|
12
|
-
return t && b(
|
9
|
+
var b = Object.defineProperty, r = (l, a, n, d) => {
|
10
|
+
for (var t = void 0, i = l.length - 1, c; i >= 0; i--)
|
11
|
+
(c = l[i]) && (t = c(a, n, t) || t);
|
12
|
+
return t && b(a, n, t), t;
|
13
13
|
};
|
14
14
|
const o = class o extends y {
|
15
15
|
constructor() {
|
16
|
-
super(...arguments), this.buttonLabel = "Close", this._handleClose = () => {
|
16
|
+
super(...arguments), this.buttonLabel = "Close", this.persistent = !1, this._handleClose = () => {
|
17
17
|
this.emit("skf-alert-close");
|
18
18
|
};
|
19
19
|
}
|
20
20
|
render() {
|
21
|
-
return
|
21
|
+
return p`
|
22
22
|
<div
|
23
23
|
aria-describedby="main"
|
24
|
-
class=${
|
24
|
+
class=${u({
|
25
25
|
alert: !0,
|
26
26
|
"alert--severity-alert": this.severity === "alert",
|
27
27
|
"alert--severity-error": this.severity === "error",
|
@@ -33,15 +33,15 @@ const o = class o extends y {
|
|
33
33
|
role=${this.persistent ? "status" : "alert"}
|
34
34
|
>
|
35
35
|
<skf-icon
|
36
|
-
color=${
|
37
|
-
name=${
|
36
|
+
color=${m(this.severity ?? "secondary")}
|
37
|
+
name=${m(this.icon ?? "info")}
|
38
38
|
size="sm"
|
39
39
|
></skf-icon>
|
40
40
|
<div class="alert__body">
|
41
41
|
<slot class="alert__main" id="main"></slot>
|
42
42
|
<slot name="link"></slot>
|
43
43
|
</div>
|
44
|
-
${this.persistent ?
|
44
|
+
${this.persistent ? p`
|
45
45
|
<button
|
46
46
|
@click="${this._handleClose}"
|
47
47
|
aria-label=${this.buttonLabel}
|
@@ -50,7 +50,7 @@ const o = class o extends y {
|
|
50
50
|
>
|
51
51
|
<skf-icon name="close" size="sm"></skf-icon>
|
52
52
|
</button>
|
53
|
-
` :
|
53
|
+
` : h}
|
54
54
|
</div>
|
55
55
|
`;
|
56
56
|
}
|
@@ -4,7 +4,7 @@ import { type CSSResultGroup } from 'lit';
|
|
4
4
|
/**
|
5
5
|
* The `<skf-breadcrumb>` component consists of multiple `<skf-breadcrumb-item>`, working together.
|
6
6
|
*
|
7
|
-
*
|
7
|
+
* See [zeroheight](https://zeroheight.com/853e936c9/p/3338ef-breadcrumbs) for design principles.
|
8
8
|
*
|
9
9
|
* @event click - Fired when the item is clicked
|
10
10
|
*
|
@@ -33,8 +33,8 @@ export declare class SkfButton extends SkfElement {
|
|
33
33
|
icon?: SkfIcon['name'];
|
34
34
|
/** If true, removes border */
|
35
35
|
iconOnly: boolean;
|
36
|
-
/**
|
37
|
-
iconPosition
|
36
|
+
/** Determines the positioning of the icon in relation to the text */
|
37
|
+
iconPosition: 'left' | 'right';
|
38
38
|
/** If true, hides text & icon and shows loading indicator. **Notice!** Only applicable if `variant` is `primary`. */
|
39
39
|
loading: boolean;
|
40
40
|
noValidate: boolean;
|
@@ -55,7 +55,7 @@ export declare class SkfButton extends SkfElement {
|
|
55
55
|
private $button?;
|
56
56
|
constructor();
|
57
57
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|
58
|
-
|
58
|
+
_handleLoadingChange(): void;
|
59
59
|
/** @internal */
|
60
60
|
_handleClick: (e: MouseEvent) => void;
|
61
61
|
/** @internal */
|
@@ -1,18 +1,19 @@
|
|
1
1
|
import "../icon/icon.js";
|
2
2
|
import "../loader/loader.js";
|
3
|
-
import { SkfElement as
|
4
|
-
import f from "../../
|
5
|
-
import
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
3
|
+
import { SkfElement as m } from "../../internal/components/skf-element.js";
|
4
|
+
import { watch as f } from "../../internal/helpers/watch.js";
|
5
|
+
import u from "../../styles/component.styles.js";
|
6
|
+
import { html as d, LitElement as _, nothing as p } from "lit";
|
7
|
+
import { property as o, state as v, query as c } from "lit/decorators.js";
|
8
|
+
import { classMap as $ } from "lit/directives/class-map.js";
|
9
|
+
import { ifDefined as b } from "lit/directives/if-defined.js";
|
10
|
+
import g from "./button.styles.js";
|
11
|
+
var O = Object.defineProperty, V = Object.getOwnPropertyDescriptor, s = (y, t, l, r) => {
|
12
|
+
for (var e = r > 1 ? void 0 : r ? V(t, l) : t, a = y.length - 1, n; a >= 0; a--)
|
13
|
+
(n = y[a]) && (e = (r ? n(t, l, e) : n(e)) || e);
|
14
|
+
return r && e && O(t, l, e), e;
|
14
15
|
};
|
15
|
-
const
|
16
|
+
const h = class h extends m {
|
16
17
|
constructor() {
|
17
18
|
super(), this._transitionOptions = {
|
18
19
|
duration: 200,
|
@@ -20,13 +21,13 @@ const d = class d extends b {
|
|
20
21
|
}, this.destructive = !1, this.disabled = !1, this.iconOnly = !1, this.iconPosition = "left", this.loading = !1, this.noValidate = !1, this.size = "md", this.type = "button", this.variant = "primary", this._loaderVisible = !1, this._handleClick = (t) => {
|
21
22
|
t.preventDefault(), t.stopPropagation(), !(this.disabled || this.loading) && (this.dispatchEvent(new CustomEvent("click", { bubbles: !0, composed: !0, detail: t })), this.type === "submit" && this._submitForm(), this.type === "reset" && this._resetForm());
|
22
23
|
}, this._submitForm = () => {
|
23
|
-
var
|
24
|
-
const t = !((
|
25
|
-
(
|
24
|
+
var e, a, n;
|
25
|
+
const t = !((e = this._internals.form) != null && e.reportValidity()), l = !this.noValidate, r = !((a = this._internals.form) != null && a.hasAttribute("no-validate"));
|
26
|
+
(l || r) && t || (n = this._internals.form) == null || n.requestSubmit();
|
26
27
|
}, this._resetForm = () => {
|
27
28
|
var t;
|
28
29
|
(t = this._internals.form) == null || t.reset();
|
29
|
-
}, this._renderIcon = () =>
|
30
|
+
}, this._renderIcon = () => d`<skf-icon class="skf-icon-host" name=${b(this.icon)}></skf-icon>`, this._internals = this.attachInternals();
|
30
31
|
}
|
31
32
|
firstUpdated(t) {
|
32
33
|
if (t.has("loading") && this.loading) {
|
@@ -34,8 +35,8 @@ const d = class d extends b {
|
|
34
35
|
this._loaderVisible = !0, this.$body.style.opacity = "0", this.$loader.style.opacity = "1";
|
35
36
|
}
|
36
37
|
}
|
37
|
-
|
38
|
-
|
38
|
+
_handleLoadingChange() {
|
39
|
+
this.loading ? this._showLoader() : this._hideLoader();
|
39
40
|
}
|
40
41
|
/** Simulates a click on the button. */
|
41
42
|
click() {
|
@@ -52,11 +53,11 @@ const d = class d extends b {
|
|
52
53
|
!this.$body || !this.$loader || (await this.$loader.animate({ opacity: 0 }, this._transitionOptions).finished, this._loaderVisible = !1, this.$body.animate({ opacity: 1 }, this._transitionOptions));
|
53
54
|
}
|
54
55
|
render() {
|
55
|
-
return
|
56
|
+
return d`
|
56
57
|
<button
|
57
58
|
?disabled=${this.disabled || this.loading}
|
58
59
|
aria-busy=${this.loading}
|
59
|
-
class=${
|
60
|
+
class=${$({
|
60
61
|
btn: !0,
|
61
62
|
"btn--destructive": this.destructive,
|
62
63
|
"btn--icon-only": this.iconOnly,
|
@@ -67,65 +68,68 @@ const d = class d extends b {
|
|
67
68
|
"btn--variant-secondary": this.variant === "secondary",
|
68
69
|
"btn--variant-tertiary": this.variant === "tertiary"
|
69
70
|
})}
|
70
|
-
type=${
|
71
|
+
type=${b(this.type)}
|
71
72
|
@click=${this._handleClick}
|
72
73
|
title=${/* An empty title prevents browser validation tooltips from appearing on hover */
|
73
74
|
this.title}
|
74
75
|
>
|
75
|
-
${this.variant === "primary" && this._loaderVisible ?
|
76
|
+
${this.variant === "primary" && this._loaderVisible ? d`<skf-loader class="btn__loader" invert size="sm"></skf-loader>` : ""}
|
76
77
|
<div class="btn__body" id="body">
|
77
|
-
${this.icon && this.iconPosition === "left" ? this._renderIcon() :
|
78
|
-
${this.iconOnly ?
|
79
|
-
${this.icon && this.iconPosition === "right" ? this._renderIcon() :
|
78
|
+
${this.icon && this.iconPosition === "left" ? this._renderIcon() : p}
|
79
|
+
${this.iconOnly ? p : d`<slot class="btn__label"></slot>`}
|
80
|
+
${this.icon && this.iconPosition === "right" ? this._renderIcon() : p}
|
80
81
|
</div>
|
81
82
|
</button>
|
82
83
|
`;
|
83
84
|
}
|
84
85
|
};
|
85
|
-
|
86
|
-
let i =
|
86
|
+
h.formAssociated = !0, h.shadowRootOptions = { ..._.shadowRootOptions, delegatesFocus: !0 }, h.styles = [u, g];
|
87
|
+
let i = h;
|
87
88
|
s([
|
88
|
-
|
89
|
-
], i.prototype, "destructive");
|
89
|
+
o({ type: Boolean })
|
90
|
+
], i.prototype, "destructive", 2);
|
90
91
|
s([
|
91
|
-
|
92
|
-
], i.prototype, "disabled");
|
92
|
+
o({ type: Boolean })
|
93
|
+
], i.prototype, "disabled", 2);
|
93
94
|
s([
|
94
|
-
|
95
|
-
], i.prototype, "icon");
|
95
|
+
o()
|
96
|
+
], i.prototype, "icon", 2);
|
96
97
|
s([
|
97
|
-
|
98
|
-
], i.prototype, "iconOnly");
|
98
|
+
o({ type: Boolean })
|
99
|
+
], i.prototype, "iconOnly", 2);
|
99
100
|
s([
|
100
|
-
|
101
|
-
], i.prototype, "iconPosition");
|
101
|
+
o({ attribute: "icon-position" })
|
102
|
+
], i.prototype, "iconPosition", 2);
|
102
103
|
s([
|
103
|
-
|
104
|
-
], i.prototype, "loading");
|
104
|
+
o({ type: Boolean, reflect: !0 })
|
105
|
+
], i.prototype, "loading", 2);
|
105
106
|
s([
|
106
|
-
|
107
|
-
], i.prototype, "noValidate");
|
107
|
+
o({ type: Boolean, attribute: "no-validate" })
|
108
|
+
], i.prototype, "noValidate", 2);
|
108
109
|
s([
|
109
|
-
|
110
|
-
], i.prototype, "size");
|
110
|
+
o({ reflect: !0 })
|
111
|
+
], i.prototype, "size", 2);
|
111
112
|
s([
|
112
|
-
|
113
|
-
], i.prototype, "type");
|
113
|
+
o()
|
114
|
+
], i.prototype, "type", 2);
|
114
115
|
s([
|
115
|
-
|
116
|
-
], i.prototype, "variant");
|
116
|
+
o({ reflect: !0 })
|
117
|
+
], i.prototype, "variant", 2);
|
117
118
|
s([
|
118
|
-
|
119
|
-
], i.prototype, "_loaderVisible");
|
119
|
+
v()
|
120
|
+
], i.prototype, "_loaderVisible", 2);
|
120
121
|
s([
|
121
|
-
|
122
|
-
], i.prototype, "$loader");
|
122
|
+
c("skf-loader")
|
123
|
+
], i.prototype, "$loader", 2);
|
123
124
|
s([
|
124
|
-
|
125
|
-
], i.prototype, "$body");
|
125
|
+
c("#body")
|
126
|
+
], i.prototype, "$body", 2);
|
126
127
|
s([
|
127
|
-
|
128
|
-
], i.prototype, "$button");
|
128
|
+
c("button")
|
129
|
+
], i.prototype, "$button", 2);
|
130
|
+
s([
|
131
|
+
f("loading", { afterUpdate: !0 })
|
132
|
+
], i.prototype, "_handleLoadingChange", 1);
|
129
133
|
export {
|
130
134
|
i as SkfButton
|
131
135
|
};
|
@@ -1,44 +1,32 @@
|
|
1
|
-
import { SkfElement as
|
2
|
-
import
|
3
|
-
import { html as
|
1
|
+
import { SkfElement as f } from "../../internal/components/skf-element.js";
|
2
|
+
import m from "../../styles/component.styles.js";
|
3
|
+
import { html as d } from "lit";
|
4
4
|
import { property as o } from "lit/decorators.js";
|
5
|
-
import {
|
6
|
-
|
7
|
-
var
|
8
|
-
|
9
|
-
|
10
|
-
return t && u(d, p, t), t;
|
5
|
+
import { styles as u } from "./card.styles.js";
|
6
|
+
var c = Object.defineProperty, s = (p, l, i, y) => {
|
7
|
+
for (var t = void 0, r = p.length - 1, a; r >= 0; r--)
|
8
|
+
(a = p[r]) && (t = a(l, i, t) || t);
|
9
|
+
return t && c(l, i, t), t;
|
11
10
|
};
|
12
|
-
const n = class n extends
|
11
|
+
const n = class n extends f {
|
13
12
|
constructor() {
|
14
13
|
super(...arguments), this.noBorder = !1, this.noPadding = !1, this.stretch = !1;
|
15
14
|
}
|
16
15
|
render() {
|
17
|
-
return
|
18
|
-
<div
|
19
|
-
class=${f({
|
20
|
-
card: !0,
|
21
|
-
"card--no-border": this.noBorder,
|
22
|
-
"card--no-padding": this.noPadding,
|
23
|
-
"card--stretch": this.stretch
|
24
|
-
})}
|
25
|
-
>
|
26
|
-
<slot></slot>
|
27
|
-
</div>
|
28
|
-
`;
|
16
|
+
return d`<slot></slot>`;
|
29
17
|
}
|
30
18
|
};
|
31
|
-
n.styles = [
|
32
|
-
let
|
19
|
+
n.styles = [m, u];
|
20
|
+
let e = n;
|
33
21
|
s([
|
34
|
-
o({ type: Boolean, attribute: "no-border" })
|
35
|
-
],
|
22
|
+
o({ type: Boolean, attribute: "no-border", reflect: !0 })
|
23
|
+
], e.prototype, "noBorder");
|
36
24
|
s([
|
37
|
-
o({ type: Boolean, attribute: "no-padding" })
|
38
|
-
],
|
25
|
+
o({ type: Boolean, attribute: "no-padding", reflect: !0 })
|
26
|
+
], e.prototype, "noPadding");
|
39
27
|
s([
|
40
28
|
o({ type: Boolean, reflect: !0 })
|
41
|
-
],
|
29
|
+
], e.prototype, "stretch");
|
42
30
|
export {
|
43
|
-
|
31
|
+
e as SkfCard
|
44
32
|
};
|
@@ -1,36 +1,33 @@
|
|
1
1
|
import { css as r } from "lit";
|
2
|
-
const
|
3
|
-
|
2
|
+
const s = r`
|
3
|
+
@layer components {
|
4
|
+
@layer base {
|
5
|
+
:host {
|
6
|
+
background-color: var(--skf-bg-color-neutral-1);
|
7
|
+
border: var(--skf-border-width-sm) solid
|
8
|
+
var(--_skf-card-border-color, var(--skf-border-color-tertiary));
|
9
|
+
border-radius: var(--skf-border-radius-sm);
|
10
|
+
box-shadow: var(--skf-shadow-md);
|
11
|
+
contain: layout;
|
12
|
+
padding: var(--_skf-card-padding, var(--skf-spacing-100));
|
13
|
+
}
|
14
|
+
}
|
4
15
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
:host([stretch]) {
|
10
|
-
block-size: 100%;
|
11
|
-
}
|
12
|
-
|
13
|
-
.card {
|
14
|
-
background-color: var(--skf-bg-color-neutral-1);
|
15
|
-
border: var(--skf-border-width-sm) solid
|
16
|
-
var(--_skf-card-border-color, var(--skf-border-color-tertiary));
|
17
|
-
border-radius: var(--skf-border-radius-sm);
|
18
|
-
box-shadow: var(--skf-shadow-md);
|
19
|
-
padding: var(--_skf-card-padding, var(--skf-spacing-100));
|
20
|
-
}
|
21
|
-
|
22
|
-
.card--no-border {
|
23
|
-
--_skf-card-border-color: transparent;
|
24
|
-
}
|
16
|
+
@layer mods {
|
17
|
+
:host([stretch]) {
|
18
|
+
block-size: 100%;
|
19
|
+
}
|
25
20
|
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
:host([no-border]) {
|
22
|
+
--_skf-card-border-color: transparent;
|
23
|
+
}
|
29
24
|
|
30
|
-
|
31
|
-
|
25
|
+
:host([no-padding]) {
|
26
|
+
--_skf-card-padding: 0;
|
27
|
+
}
|
28
|
+
}
|
32
29
|
}
|
33
30
|
`;
|
34
31
|
export {
|
35
|
-
|
32
|
+
s as styles
|
36
33
|
};
|
@@ -7,8 +7,8 @@ import { type CSSResultGroup } from 'lit';
|
|
7
7
|
*
|
8
8
|
* @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/94464f-checkbox) for design principles
|
9
9
|
*
|
10
|
-
* @attribute {boolean} disabled - If true, sets disabled state
|
11
|
-
* @attribute {boolean} required - If true, value is required or must be checked for the form to be submittable
|
10
|
+
* @attribute {boolean} [disabled=false] - If true, sets disabled state
|
11
|
+
* @attribute {boolean} [required=false] - If true, value is required or must be checked for the form to be submittable
|
12
12
|
*
|
13
13
|
* @event change {object} - When the value of the input changes
|
14
14
|
*
|
@@ -24,13 +24,14 @@ export declare class SkfCheckbox extends FormBase implements FormFieldBaseProps
|
|
24
24
|
*/
|
25
25
|
private _initiallyChecked;
|
26
26
|
/** If defined, outputs helping hints in console */
|
27
|
-
debug
|
27
|
+
debug: boolean;
|
28
28
|
/** If true, outputs helping hints in console */
|
29
|
-
checked
|
29
|
+
get checked(): boolean;
|
30
|
+
set checked(value: boolean);
|
30
31
|
/** If true, forces component to invalid state until removed */
|
31
|
-
customInvalid
|
32
|
+
customInvalid: boolean;
|
32
33
|
/** If true and the checkbox is unchecked, the checkbox will appear indeterminate */
|
33
|
-
indeterminate
|
34
|
+
indeterminate: boolean;
|
34
35
|
/** If defined, sets the input's label. Alternatively, you can use the `label` attribute. */
|
35
36
|
label?: string;
|
36
37
|
/** If defined, adds name to the input-element */
|
@@ -43,7 +44,7 @@ export declare class SkfCheckbox extends FormBase implements FormFieldBaseProps
|
|
43
44
|
*/
|
44
45
|
severity?: FormFieldBaseProps['severity'];
|
45
46
|
/** If true, displays valid state after interaction */
|
46
|
-
showValid
|
47
|
+
showValid: boolean;
|
47
48
|
/** Size of the checkbox */
|
48
49
|
size: 'sm' | 'md';
|
49
50
|
/** The current value of the input field */
|
@@ -53,6 +54,7 @@ export declare class SkfCheckbox extends FormBase implements FormFieldBaseProps
|
|
53
54
|
private _invalid;
|
54
55
|
/** @internal */
|
55
56
|
private $input?;
|
57
|
+
handleCheckedChange(): void;
|
56
58
|
handleInvalidChange(): void;
|
57
59
|
handleDebugInvalid(): void;
|
58
60
|
handleCustomInvalidChange(): void;
|