@skf-design-system/ui-components 1.0.1-beta.1 → 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 +7 -7
- package/dist/components/breadcrumb/breadcrumb.component.d.ts +1 -1
- package/dist/components/card/card.component.js +18 -30
- package/dist/components/card/card.styles.js +25 -28
- package/dist/components/checkbox/checkbox.component.d.ts +8 -8
- package/dist/components/checkbox/checkbox.component.js +3 -3
- package/dist/components/collapse/collapse.component.js +1 -1
- package/dist/components/date-picker/datepicker.calendar.component.d.ts +5 -0
- package/dist/components/date-picker/datepicker.calendar.component.js +128 -95
- package/dist/components/date-picker/datepicker.calendar.styles.js +35 -25
- package/dist/components/date-picker/datepicker.component.d.ts +5 -0
- package/dist/components/date-picker/datepicker.component.js +117 -97
- package/dist/components/date-picker/datepicker.helpers.d.ts +3 -2
- package/dist/components/date-picker/datepicker.helpers.js +46 -39
- package/dist/components/date-picker/datepicker.styles.js +14 -26
- package/dist/components/date-picker-input/datepicker-input.component.d.ts +13 -5
- package/dist/components/date-picker-input/datepicker-input.component.js +263 -219
- package/dist/components/date-picker-input/datepicker-input.helpers.d.ts +36 -2
- package/dist/components/date-picker-input/datepicker-input.helpers.js +25 -23
- package/dist/components/date-picker-input/datepicker-input.styles.js +6 -10
- package/dist/components/dialog/dialog.component.d.ts +18 -28
- package/dist/components/dialog/dialog.component.js +89 -79
- 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 +11 -11
- 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/input/input.component.d.ts +2 -2
- package/dist/components/input/input.component.js +3 -3
- 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 +1 -0
- package/dist/components/link/link.styles.js +24 -20
- 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 +19 -19
- package/dist/components/radio/radio.component.d.ts +10 -6
- package/dist/components/radio/radio.component.js +10 -10
- 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/stepper/stepper.component.d.ts +2 -1
- package/dist/components/stepper-item/stepper-item.component.js +2 -2
- package/dist/components/switch/switch.component.d.ts +7 -6
- package/dist/components/switch/switch.component.js +7 -7
- package/dist/components/tag/tag.component.d.ts +4 -2
- package/dist/components/tag/tag.component.js +6 -6
- package/dist/components/textarea/textarea.component.js +7 -7
- package/dist/components/toast/toast.component.d.ts +1 -1
- package/dist/components/tooltip/tooltip.component.d.ts +5 -6
- package/dist/components/tooltip/tooltip.component.js +11 -11
- package/dist/custom-elements.json +2477 -1745
- package/dist/index.d.ts +4 -0
- package/dist/index.js +82 -70
- 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/controllers/elementOverflowController.d.ts +13 -0
- package/dist/internal/controllers/popover.controller.d.ts +12 -7
- package/dist/internal/controllers/popover.controller.js +9 -14
- package/dist/internal/helpers/utilityTypes.d.ts +1 -1
- package/dist/internal/helpers/uuid.d.ts +15 -0
- package/dist/internal/helpers/uuid.js +14 -0
- package/dist/internal/storybook/styles.d.ts +1 -0
- package/dist/styles/form-field.styles.js +11 -6
- package/dist/styles/global.css +1 -1
- package/dist/types/jsx/custom-element-jsx.d.ts +642 -1261
- package/dist/types/vue/index.d.ts +422 -267
- package/dist/vscode.html-custom-data.json +805 -525
- package/dist/web-types.json +928 -653
- package/package.json +41 -51
- package/dist/react/index.d.ts +0 -36
- package/dist/react/index.js +0 -36
- package/dist/react/skf-accordion/index.d.ts +0 -3
- package/dist/react/skf-accordion/index.js +0 -13
- package/dist/react/skf-alert/index.d.ts +0 -9
- package/dist/react/skf-alert/index.js +0 -17
- package/dist/react/skf-breadcrumb/index.d.ts +0 -9
- package/dist/react/skf-breadcrumb/index.js +0 -17
- package/dist/react/skf-breadcrumb-item/index.d.ts +0 -3
- package/dist/react/skf-breadcrumb-item/index.js +0 -13
- package/dist/react/skf-button/index.d.ts +0 -9
- package/dist/react/skf-button/index.js +0 -17
- package/dist/react/skf-card/index.d.ts +0 -3
- package/dist/react/skf-card/index.js +0 -13
- package/dist/react/skf-checkbox/index.d.ts +0 -9
- package/dist/react/skf-checkbox/index.js +0 -17
- package/dist/react/skf-collapse/index.d.ts +0 -9
- package/dist/react/skf-collapse/index.js +0 -17
- package/dist/react/skf-datepicker/index.d.ts +0 -12
- package/dist/react/skf-datepicker/index.js +0 -18
- package/dist/react/skf-dialog/index.d.ts +0 -15
- package/dist/react/skf-dialog/index.js +0 -19
- package/dist/react/skf-divider/index.d.ts +0 -3
- package/dist/react/skf-divider/index.js +0 -13
- package/dist/react/skf-heading/index.d.ts +0 -3
- package/dist/react/skf-heading/index.js +0 -13
- package/dist/react/skf-icon/index.d.ts +0 -3
- package/dist/react/skf-icon/index.js +0 -13
- package/dist/react/skf-input/index.d.ts +0 -12
- package/dist/react/skf-input/index.js +0 -18
- package/dist/react/skf-link/index.d.ts +0 -3
- package/dist/react/skf-link/index.js +0 -13
- package/dist/react/skf-loader/index.d.ts +0 -3
- package/dist/react/skf-loader/index.js +0 -13
- package/dist/react/skf-logo/index.d.ts +0 -3
- package/dist/react/skf-logo/index.js +0 -13
- package/dist/react/skf-menu/index.d.ts +0 -12
- package/dist/react/skf-menu/index.js +0 -18
- package/dist/react/skf-menu-item/index.d.ts +0 -27
- package/dist/react/skf-menu-item/index.js +0 -23
- package/dist/react/skf-popover/index.d.ts +0 -12
- package/dist/react/skf-popover/index.js +0 -18
- package/dist/react/skf-progress/index.d.ts +0 -3
- package/dist/react/skf-progress/index.js +0 -13
- package/dist/react/skf-radio/index.d.ts +0 -9
- package/dist/react/skf-radio/index.js +0 -17
- package/dist/react/skf-select/index.d.ts +0 -21
- package/dist/react/skf-select/index.js +0 -21
- package/dist/react/skf-select-option/index.d.ts +0 -9
- package/dist/react/skf-select-option/index.js +0 -17
- package/dist/react/skf-select-option-group/index.d.ts +0 -3
- package/dist/react/skf-select-option-group/index.js +0 -13
- package/dist/react/skf-stepper/index.d.ts +0 -9
- package/dist/react/skf-stepper/index.js +0 -17
- package/dist/react/skf-stepper-item/index.d.ts +0 -9
- package/dist/react/skf-stepper-item/index.js +0 -17
- package/dist/react/skf-switch/index.d.ts +0 -3
- package/dist/react/skf-switch/index.js +0 -13
- package/dist/react/skf-tab/index.d.ts +0 -12
- package/dist/react/skf-tab/index.js +0 -18
- package/dist/react/skf-tab-group/index.d.ts +0 -3
- package/dist/react/skf-tab-group/index.js +0 -13
- package/dist/react/skf-tab-panel/index.d.ts +0 -3
- package/dist/react/skf-tab-panel/index.js +0 -13
- package/dist/react/skf-tag/index.d.ts +0 -3
- package/dist/react/skf-tag/index.js +0 -13
- package/dist/react/skf-textarea/index.d.ts +0 -12
- package/dist/react/skf-textarea/index.js +0 -18
- package/dist/react/skf-toast/index.d.ts +0 -3
- package/dist/react/skf-toast/index.js +0 -13
- package/dist/react/skf-toast-wrapper/index.d.ts +0 -3
- package/dist/react/skf-toast-wrapper/index.js +0 -13
- package/dist/react/skf-tooltip/index.d.ts +0 -12
- package/dist/react/skf-tooltip/index.js +0 -18
@@ -0,0 +1,57 @@
|
|
1
|
+
import '../icon/icon.js';
|
2
|
+
import { SkfElement } from '../../internal/components/skf-element';
|
3
|
+
import { type CSSResultGroup } from 'lit';
|
4
|
+
/**
|
5
|
+
* TODO:
|
6
|
+
*
|
7
|
+
* - Fix drag outside closes the drawer
|
8
|
+
* - add tests
|
9
|
+
* - add documentation
|
10
|
+
*/
|
11
|
+
/**
|
12
|
+
* The `<skf-drawer>` is a modal component that displays content and toggle by sliding from left/right viewport edge.
|
13
|
+
*
|
14
|
+
* @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/0789c4-drawer) for design principles
|
15
|
+
*
|
16
|
+
* @event skf-drawer-opened - Fires when the drawer is opened (after transitioned in)
|
17
|
+
* @event skf-drawer-closing - Fires when the drawer is closed (before transitioned out)
|
18
|
+
* @event skf-drawer-closed - Fires when the drawer is closed (after transitioned out)
|
19
|
+
*
|
20
|
+
* @slot - The Drawer's main content
|
21
|
+
*
|
22
|
+
* @tagname skf-drawer
|
23
|
+
*/
|
24
|
+
export declare class SkfDrawer extends SkfElement {
|
25
|
+
static styles: CSSResultGroup;
|
26
|
+
/** @internal */
|
27
|
+
private _abortController?;
|
28
|
+
/** @internal */
|
29
|
+
private _signal?;
|
30
|
+
/** If defined, sets the aria-label for the close button */
|
31
|
+
closeButtonAriaLabel: string;
|
32
|
+
/** Heading for the Drawer */
|
33
|
+
heading?: string;
|
34
|
+
/** Sets the max-width */
|
35
|
+
size: 'sm' | 'md' | 'lg';
|
36
|
+
/** If true, Drawer is open */
|
37
|
+
open: boolean;
|
38
|
+
/** Placement of the Drawer */
|
39
|
+
placement: 'left' | 'right';
|
40
|
+
/** @internal */
|
41
|
+
$dialog: HTMLDialogElement;
|
42
|
+
disconnectedCallback(): void;
|
43
|
+
/** @internal */
|
44
|
+
_placementChanged: () => void;
|
45
|
+
/** @internal */
|
46
|
+
_openChanged(): Promise<void>;
|
47
|
+
/** @internal */
|
48
|
+
private _startListeners;
|
49
|
+
clickIsInsideElement(event: MouseEvent, el: HTMLElement): boolean;
|
50
|
+
/** @internal */
|
51
|
+
private _animateDrawer;
|
52
|
+
_clickstartInDialog: boolean;
|
53
|
+
_handleMouseDown: (event: MouseEvent) => void;
|
54
|
+
_handleMouseUp: () => void;
|
55
|
+
close(): void;
|
56
|
+
render(): import("lit").TemplateResult<1>;
|
57
|
+
}
|
@@ -0,0 +1,124 @@
|
|
1
|
+
import "../icon/icon.js";
|
2
|
+
import { SkfElement as m } from "../../internal/components/skf-element.js";
|
3
|
+
import { watch as d } from "../../internal/helpers/watch.js";
|
4
|
+
import { MOTION_DURATIONS as p } from "@skf-design-system/ui-assets";
|
5
|
+
import f from "../../styles/component.styles.js";
|
6
|
+
import { html as g } from "lit";
|
7
|
+
import { property as r, query as u } from "lit/decorators.js";
|
8
|
+
import { styles as _ } from "./drawer.styles.js";
|
9
|
+
var b = Object.defineProperty, w = Object.getOwnPropertyDescriptor, a = (h, t, i, e) => {
|
10
|
+
for (var o = e > 1 ? void 0 : e ? w(t, i) : t, n = h.length - 1, l; n >= 0; n--)
|
11
|
+
(l = h[n]) && (o = (e ? l(t, i, o) : l(o)) || o);
|
12
|
+
return e && o && b(t, i, o), o;
|
13
|
+
};
|
14
|
+
const c = class c extends m {
|
15
|
+
constructor() {
|
16
|
+
super(...arguments), this.closeButtonAriaLabel = "Close dialog", this.size = "md", this.open = !1, this.placement = "right", this._placementChanged = () => {
|
17
|
+
this.$dialog.getAnimations().forEach((i) => {
|
18
|
+
i.cancel();
|
19
|
+
});
|
20
|
+
}, this._clickstartInDialog = !1, this._handleMouseDown = (t) => {
|
21
|
+
this.clickIsInsideElement(t, this.$dialog) && (this._clickstartInDialog = !0);
|
22
|
+
}, this._handleMouseUp = () => {
|
23
|
+
if (this._clickstartInDialog) {
|
24
|
+
this._clickstartInDialog = !1;
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
};
|
28
|
+
}
|
29
|
+
disconnectedCallback() {
|
30
|
+
var t;
|
31
|
+
super.disconnectedCallback(), (t = this._abortController) == null || t.abort();
|
32
|
+
}
|
33
|
+
async _openChanged() {
|
34
|
+
var t;
|
35
|
+
this.open ? (this._abortController = new AbortController(), this._signal = this._abortController.signal, this.$dialog.showModal(), this._startListeners(), await this._animateDrawer(), this.emit("skf-drawer-opened")) : ((t = this._abortController) == null || t.abort(), this.emit("skf-drawer-closing"), await this._animateDrawer(), this.emit("skf-drawer-closed"), this.$dialog.close());
|
36
|
+
}
|
37
|
+
/** @internal */
|
38
|
+
_startListeners() {
|
39
|
+
window.addEventListener(
|
40
|
+
"keydown",
|
41
|
+
(t) => {
|
42
|
+
t.key === "Escape" && (t.preventDefault(), this.close());
|
43
|
+
},
|
44
|
+
{ signal: this._signal }
|
45
|
+
), this.addEventListener("click", (t) => {
|
46
|
+
!this.clickIsInsideElement(t, this.$dialog) && !this._clickstartInDialog && this.close();
|
47
|
+
});
|
48
|
+
}
|
49
|
+
clickIsInsideElement(t, i) {
|
50
|
+
const e = i.getBoundingClientRect();
|
51
|
+
return e.top <= t.clientY && t.clientY <= e.top + e.height && e.left <= t.clientX && t.clientX <= e.left + e.width;
|
52
|
+
}
|
53
|
+
/** @internal */
|
54
|
+
_animateDrawer() {
|
55
|
+
const t = this.open ? [{ opacity: 0 }, { opacity: 0.4 }] : [{ opacity: 0 }], i = this.open ? [{ translate: "0" }] : [{ translate: this.placement === "right" ? "100%" : "-100%" }];
|
56
|
+
return new Promise((e) => {
|
57
|
+
requestAnimationFrame(() => {
|
58
|
+
const o = this.$dialog.animate(t, {
|
59
|
+
duration: p.normal,
|
60
|
+
fill: "forwards",
|
61
|
+
pseudoElement: "::backdrop"
|
62
|
+
}), n = this.$dialog.animate(i, {
|
63
|
+
duration: p.normal,
|
64
|
+
easing: "ease-out",
|
65
|
+
fill: "forwards"
|
66
|
+
});
|
67
|
+
Promise.all([o.finished, n.finished]).then(() => {
|
68
|
+
e("Animations finished");
|
69
|
+
}).catch(() => {
|
70
|
+
throw new Error("Animation failed");
|
71
|
+
});
|
72
|
+
});
|
73
|
+
});
|
74
|
+
}
|
75
|
+
close() {
|
76
|
+
this.open = !1;
|
77
|
+
}
|
78
|
+
render() {
|
79
|
+
return g`
|
80
|
+
<dialog @mousedown="${this._handleMouseDown}" @mouseup="${this._handleMouseUp}">
|
81
|
+
<header>
|
82
|
+
<h2>${this.heading}</h2>
|
83
|
+
<button
|
84
|
+
aria-label=${this.closeButtonAriaLabel}
|
85
|
+
id="close-button"
|
86
|
+
@click="${() => this.open = !1}"
|
87
|
+
>
|
88
|
+
<skf-icon name="close" color="inverse"></skf-icon>
|
89
|
+
</button>
|
90
|
+
</header>
|
91
|
+
<slot id="body" part="body">${this.slot}</slot>
|
92
|
+
</dialog>
|
93
|
+
`;
|
94
|
+
}
|
95
|
+
};
|
96
|
+
c.styles = [f, _];
|
97
|
+
let s = c;
|
98
|
+
a([
|
99
|
+
r({ attribute: "close-button-aria-label" })
|
100
|
+
], s.prototype, "closeButtonAriaLabel", 2);
|
101
|
+
a([
|
102
|
+
r()
|
103
|
+
], s.prototype, "heading", 2);
|
104
|
+
a([
|
105
|
+
r({ reflect: !0 })
|
106
|
+
], s.prototype, "size", 2);
|
107
|
+
a([
|
108
|
+
r({ type: Boolean, reflect: !0 })
|
109
|
+
], s.prototype, "open", 2);
|
110
|
+
a([
|
111
|
+
r({ reflect: !0 })
|
112
|
+
], s.prototype, "placement", 2);
|
113
|
+
a([
|
114
|
+
u("dialog")
|
115
|
+
], s.prototype, "$dialog", 2);
|
116
|
+
a([
|
117
|
+
d("placement", { waitUntilFirstUpdate: !0 })
|
118
|
+
], s.prototype, "_placementChanged", 2);
|
119
|
+
a([
|
120
|
+
d("open", { waitUntilFirstUpdate: !0, afterUpdate: !0 })
|
121
|
+
], s.prototype, "_openChanged", 1);
|
122
|
+
export {
|
123
|
+
s as SkfDrawer
|
124
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import { css as e } from "lit";
|
2
|
+
const o = e`
|
3
|
+
@layer components {
|
4
|
+
dialog {
|
5
|
+
all: unset;
|
6
|
+
background-color: var(--skf-bg-color-neutral-1);
|
7
|
+
display: none;
|
8
|
+
flex-direction: column;
|
9
|
+
inline-size: min(100%, var(--_skf-drawer-size, 540px));
|
10
|
+
inset-block: 0;
|
11
|
+
inset-inline: var(--_skf-drawer-inset, auto 0);
|
12
|
+
position: fixed;
|
13
|
+
translate: 100% 0;
|
14
|
+
|
15
|
+
&[open] {
|
16
|
+
display: flex;
|
17
|
+
|
18
|
+
&::backdrop {
|
19
|
+
background-color: var(--skf-bg-color-neutral-7);
|
20
|
+
opacity: 0.4;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
:host([placement='left']) & {
|
25
|
+
--_skf-drawer-inset: 0 auto;
|
26
|
+
|
27
|
+
translate: -100% 0;
|
28
|
+
}
|
29
|
+
|
30
|
+
:host([size='sm']) & {
|
31
|
+
--_skf-drawer-size: 400px;
|
32
|
+
}
|
33
|
+
|
34
|
+
:host([size='lg']) & {
|
35
|
+
--_skf-drawer-size: 680px;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
header {
|
40
|
+
align-items: center;
|
41
|
+
background-color: var(--skf-bg-color-emphasised);
|
42
|
+
block-size: var(--skf-size-48);
|
43
|
+
color: var(--skf-text-color-inverse);
|
44
|
+
display: flex;
|
45
|
+
justify-content: space-between;
|
46
|
+
padding-inline: var(--skf-box-spacing);
|
47
|
+
}
|
48
|
+
|
49
|
+
h2 {
|
50
|
+
font-size: var(--skf-font-size-200);
|
51
|
+
}
|
52
|
+
|
53
|
+
#close-button {
|
54
|
+
display: inline-flex;
|
55
|
+
|
56
|
+
&:focus-visible {
|
57
|
+
border-radius: var(--skf-border-radius-sm);
|
58
|
+
outline: var(--skf-border-width-sm) solid var(--skf-interactive-text-color-inverse);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
#body {
|
63
|
+
display: block;
|
64
|
+
flex: auto;
|
65
|
+
padding: var(--skf-box-spacing);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
`;
|
69
|
+
export {
|
70
|
+
o as styles
|
71
|
+
};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import '../button/button.js';
|
2
|
+
import '../drawer/drawer.js';
|
3
|
+
import '../logo/logo.js';
|
4
|
+
import { SkfElement } from '../../internal/components/skf-element';
|
5
|
+
import { type CSSResultGroup } from 'lit';
|
6
|
+
/**
|
7
|
+
* The `<skf-header>` component is to be used as the site-header in the app
|
8
|
+
*
|
9
|
+
* @documentation See [zeroheight](https://zeroheight.com/****) for design principles
|
10
|
+
*
|
11
|
+
* @slot - Navigation items
|
12
|
+
*
|
13
|
+
* @tagname skf-header
|
14
|
+
*/
|
15
|
+
export declare class SkfHeader extends SkfElement {
|
16
|
+
static styles: CSSResultGroup;
|
17
|
+
/** @internal */
|
18
|
+
private _dynamicBreakpoint?;
|
19
|
+
/** @internal */
|
20
|
+
private _widthObserver?;
|
21
|
+
/** If true, sets header to display in compact mode only (hanburger menu and drawer) */
|
22
|
+
compact: boolean;
|
23
|
+
/** If defined, sets the aria-label for the hamburger button */
|
24
|
+
hamburgerAriaLabel: string;
|
25
|
+
/** If defined, sets the app or site's name */
|
26
|
+
siteName?: string;
|
27
|
+
/** If defined, sets the site's base-url for the "logo-link" */
|
28
|
+
siteUrl?: string;
|
29
|
+
/** @internal */
|
30
|
+
isCompact: boolean;
|
31
|
+
/** @internal */
|
32
|
+
private openDrawer;
|
33
|
+
/** @internal */
|
34
|
+
private nav;
|
35
|
+
/** @internal */
|
36
|
+
private $navWrapper;
|
37
|
+
firstUpdated(): void;
|
38
|
+
/** @internal */
|
39
|
+
private _observeHostWidth;
|
40
|
+
/** @internal */
|
41
|
+
private _observeNavContainer;
|
42
|
+
/** @internal */
|
43
|
+
private _renderMeta;
|
44
|
+
render(): import("lit").TemplateResult<1>;
|
45
|
+
}
|
@@ -0,0 +1,110 @@
|
|
1
|
+
import "../button/button.js";
|
2
|
+
import "../drawer/drawer.js";
|
3
|
+
import "../logo/logo.js";
|
4
|
+
import { SkfElement as d } from "../../internal/components/skf-element.js";
|
5
|
+
import v from "../../styles/component.styles.js";
|
6
|
+
import { nothing as b, html as a } from "lit";
|
7
|
+
import { property as s, state as f, queryAssignedElements as u, query as w } from "lit/decorators.js";
|
8
|
+
import { ifDefined as m } from "lit/directives/if-defined.js";
|
9
|
+
import { literal as c, html as y } from "lit/static-html.js";
|
10
|
+
import { styles as _ } from "./header.styles.js";
|
11
|
+
var $ = Object.defineProperty, r = (h, e, p, g) => {
|
12
|
+
for (var i = void 0, o = h.length - 1, l; o >= 0; o--)
|
13
|
+
(l = h[o]) && (i = l(e, p, i) || i);
|
14
|
+
return i && $(e, p, i), i;
|
15
|
+
};
|
16
|
+
const n = class n extends d {
|
17
|
+
constructor() {
|
18
|
+
super(...arguments), this.compact = !1, this.hamburgerAriaLabel = "Show navigation", this.isCompact = !1, this.openDrawer = !1;
|
19
|
+
}
|
20
|
+
firstUpdated() {
|
21
|
+
this.updateComplete.then(() => {
|
22
|
+
if (this.compact) {
|
23
|
+
this.isCompact = !0, this.nav[0].vertical = !0;
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
this._observeHostWidth();
|
27
|
+
}).catch(console.error);
|
28
|
+
}
|
29
|
+
/** @internal */
|
30
|
+
_observeHostWidth() {
|
31
|
+
this._widthObserver = new ResizeObserver(() => {
|
32
|
+
var e;
|
33
|
+
this.clientWidth > (this._dynamicBreakpoint ?? 0) && (this._dynamicBreakpoint = null, (e = this._widthObserver) == null || e.disconnect(), this.isCompact = !1, this.nav[0].vertical = !1, this._observeNavContainer());
|
34
|
+
}), this._widthObserver.observe(this);
|
35
|
+
}
|
36
|
+
/** @internal */
|
37
|
+
_observeNavContainer() {
|
38
|
+
this._widthObserver = new ResizeObserver(() => {
|
39
|
+
var e;
|
40
|
+
this.$navWrapper.clientWidth < this.$navWrapper.scrollWidth && (this._dynamicBreakpoint = this.clientWidth, (e = this._widthObserver) == null || e.disconnect(), this.isCompact = !0, this.nav[0].vertical = !0, this._observeHostWidth());
|
41
|
+
}), this._widthObserver.observe(this.$navWrapper);
|
42
|
+
}
|
43
|
+
/** @internal */
|
44
|
+
_renderMeta() {
|
45
|
+
const e = this.siteUrl ? c`a` : c`div`;
|
46
|
+
return y`
|
47
|
+
<${e} href=${m(this.siteUrl)} id="meta">
|
48
|
+
<skf-logo color="inverse"></skf-logo>
|
49
|
+
${this.siteName ? a`<h2>${this.siteName}</h2>` : b}
|
50
|
+
</${e}>
|
51
|
+
`;
|
52
|
+
}
|
53
|
+
render() {
|
54
|
+
return a`
|
55
|
+
<header role="banner">
|
56
|
+
${this._renderMeta()}
|
57
|
+
<div id="nav-wrapper">
|
58
|
+
${this.isCompact ? a`
|
59
|
+
<button
|
60
|
+
@click=${() => this.openDrawer = !this.openDrawer}
|
61
|
+
aria-controls="drawer"
|
62
|
+
aria-expanded=${this.openDrawer}
|
63
|
+
aria-label=${this.hamburgerAriaLabel}
|
64
|
+
>
|
65
|
+
<skf-icon color="inverse" name="hamburgerMenu" size="lg"></skf-icon>
|
66
|
+
</button>
|
67
|
+
<skf-drawer
|
68
|
+
?open=${this.openDrawer}
|
69
|
+
@close=${() => this.openDrawer = !1}
|
70
|
+
heading=${m(this.siteName)}
|
71
|
+
id="drawer"
|
72
|
+
placement="right"
|
73
|
+
>
|
74
|
+
<slot></slot>
|
75
|
+
</skf-drawer>
|
76
|
+
` : a`<slot></slot>`}
|
77
|
+
</div>
|
78
|
+
</header>
|
79
|
+
`;
|
80
|
+
}
|
81
|
+
};
|
82
|
+
n.styles = [v, _];
|
83
|
+
let t = n;
|
84
|
+
r([
|
85
|
+
s({ type: Boolean, reflect: !0 })
|
86
|
+
], t.prototype, "compact");
|
87
|
+
r([
|
88
|
+
s({ attribute: "hamburger-aria-label" })
|
89
|
+
], t.prototype, "hamburgerAriaLabel");
|
90
|
+
r([
|
91
|
+
s({ attribute: "site-name" })
|
92
|
+
], t.prototype, "siteName");
|
93
|
+
r([
|
94
|
+
s({ attribute: "site-url" })
|
95
|
+
], t.prototype, "siteUrl");
|
96
|
+
r([
|
97
|
+
s({ type: Boolean, reflect: !0, state: !0, attribute: "is-compact" })
|
98
|
+
], t.prototype, "isCompact");
|
99
|
+
r([
|
100
|
+
f()
|
101
|
+
], t.prototype, "openDrawer");
|
102
|
+
r([
|
103
|
+
u({ selector: "skf-nav" })
|
104
|
+
], t.prototype, "nav");
|
105
|
+
r([
|
106
|
+
w("#nav-wrapper")
|
107
|
+
], t.prototype, "$navWrapper");
|
108
|
+
export {
|
109
|
+
t as SkfHeader
|
110
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import { css as e } from "lit";
|
2
|
+
const a = e`
|
3
|
+
@layer components {
|
4
|
+
:host {
|
5
|
+
--skf-header-height: 60px;
|
6
|
+
}
|
7
|
+
|
8
|
+
header {
|
9
|
+
align-items: center;
|
10
|
+
background-color: var(--skf-bg-color-emphasised);
|
11
|
+
block-size: var(--skf-header-height);
|
12
|
+
display: flex;
|
13
|
+
gap: var(--skf-spacing-125);
|
14
|
+
justify-content: space-between;
|
15
|
+
padding-inline: var(--skf-spacing-100);
|
16
|
+
}
|
17
|
+
|
18
|
+
#meta {
|
19
|
+
align-items: inherit;
|
20
|
+
color: var(--skf-text-color-inverse);
|
21
|
+
display: inherit;
|
22
|
+
gap: var(--skf-spacing-100);
|
23
|
+
|
24
|
+
&:is(a) {
|
25
|
+
text-decoration: none;
|
26
|
+
}
|
27
|
+
|
28
|
+
:host(:not([is-compact])) &:has(h2)::after {
|
29
|
+
align-self: normal;
|
30
|
+
border-right: 1px solid var(--skf-border-color-inverse);
|
31
|
+
content: '';
|
32
|
+
display: block;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
h2 {
|
37
|
+
font-size: var(--skf-font-size-200);
|
38
|
+
font-weight: var(--skf-font-weight-regular);
|
39
|
+
white-space: nowrap;
|
40
|
+
}
|
41
|
+
|
42
|
+
#nav-wrapper:has(skf-drawer) {
|
43
|
+
display: inline-flex; /** Shrink-wrap icon-button */
|
44
|
+
}
|
45
|
+
|
46
|
+
#nav-wrapper:not(:has(skf-drawer)) {
|
47
|
+
overflow: hidden;
|
48
|
+
}
|
49
|
+
|
50
|
+
skf-drawer::part(body) {
|
51
|
+
background-color: var(--skf-bg-color-emphasised);
|
52
|
+
padding: 0;
|
53
|
+
}
|
54
|
+
|
55
|
+
button {
|
56
|
+
color: var(--_skf-header-button-color, var(--skf-interactive-text-color-inverse));
|
57
|
+
display: inline-flex;
|
58
|
+
|
59
|
+
&:focus-visible {
|
60
|
+
border-radius: var(--skf-border-radius-sm);
|
61
|
+
outline: var(--skf-border-width-sm) solid var(--skf-interactive-text-color-inverse);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
`;
|
66
|
+
export {
|
67
|
+
a as styles
|
68
|
+
};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { SkfElement } from '../../internal/components/skf-element.js';
|
2
2
|
import type { HeadingType } from '../../internal/constants/heading.js';
|
3
3
|
import { type CSSResultGroup } from 'lit';
|
4
|
+
type SkfHeadingType = HeadingType;
|
4
5
|
/**
|
5
6
|
* The `<Heading>` component is to deliniate content on a page. When using, take note not to skip heading levels.<br>
|
6
7
|
* It extends the interface of native html `<h1>` to `<h4>` elements.
|
@@ -11,17 +12,10 @@ import { type CSSResultGroup } from 'lit';
|
|
11
12
|
*/
|
12
13
|
export declare class SkfHeading extends SkfElement {
|
13
14
|
static styles: CSSResultGroup;
|
14
|
-
/**
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
*/
|
19
|
-
as: HeadingType;
|
20
|
-
/**
|
21
|
-
* If provided, changes the appearance of the heading
|
22
|
-
*
|
23
|
-
* @type { "h1" | "h2" | "h3" | "h4" }
|
24
|
-
*/
|
25
|
-
styledAs?: HeadingType;
|
15
|
+
/** Controls which heading element will be rendered. Should not be used to affect appearance */
|
16
|
+
as: SkfHeadingType;
|
17
|
+
/** If defined, changes the appearance of the heading */
|
18
|
+
styledAs?: SkfHeadingType;
|
26
19
|
render(): import("lit").TemplateResult;
|
27
20
|
}
|
21
|
+
export {};
|
@@ -2,32 +2,32 @@ import { SkfElement as n } from "../../internal/components/skf-element.js";
|
|
2
2
|
import u from "../../styles/component.styles.js";
|
3
3
|
import "lit";
|
4
4
|
import { property as a } from "lit/decorators.js";
|
5
|
-
import {
|
6
|
-
import
|
5
|
+
import { unsafeStatic as m, html as c } from "lit/static-html.js";
|
6
|
+
import { styles as y } from "./heading.styles.js";
|
7
7
|
var h = Object.defineProperty, f = (o, p, i, d) => {
|
8
|
-
for (var t = void 0,
|
9
|
-
(
|
8
|
+
for (var t = void 0, e = o.length - 1, l; e >= 0; e--)
|
9
|
+
(l = o[e]) && (t = l(p, i, t) || t);
|
10
10
|
return t && h(p, i, t), t;
|
11
11
|
};
|
12
|
-
const
|
12
|
+
const s = class s extends n {
|
13
13
|
constructor() {
|
14
14
|
super(...arguments), this.as = "h1";
|
15
15
|
}
|
16
16
|
render() {
|
17
|
-
return
|
18
|
-
<${
|
17
|
+
return c`
|
18
|
+
<${m(this.as)} id="root">
|
19
19
|
<slot></slot>
|
20
|
-
</${
|
20
|
+
</${m(this.as)}>
|
21
21
|
`;
|
22
22
|
}
|
23
23
|
};
|
24
|
-
|
25
|
-
let r =
|
24
|
+
s.styles = [u, y];
|
25
|
+
let r = s;
|
26
26
|
f([
|
27
27
|
a({ reflect: !0 })
|
28
28
|
], r.prototype, "as");
|
29
29
|
f([
|
30
|
-
a({ attribute: "styled-as" })
|
30
|
+
a({ attribute: "styled-as", reflect: !0 })
|
31
31
|
], r.prototype, "styledAs");
|
32
32
|
export {
|
33
33
|
r as SkfHeading
|
@@ -1,2 +1 @@
|
|
1
|
-
declare const
|
2
|
-
export default _default;
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -19,7 +19,7 @@ export declare class SkfIcon extends SkfElement {
|
|
19
19
|
label?: string;
|
20
20
|
/**
|
21
21
|
* Name of the icon to display
|
22
|
-
* @type { "arrowDown" | "
|
22
|
+
* @type { "addCircleOutline" | "addCircle" | "addPlus" | "arrowBackIos" | "arrowBack" | "arrowDown" | "arrowForwardIos" | "arrowForward" | "arrowLeft" | "arrowRight" | "arrowUpDown" | "arrowUp" | "article" | "asset" | "attachment" | "bandCursor" | "bands" | "batteryEmpty" | "batteryFull" | "batteryLow" | "bearingFault" | "bluetoothDisabled" | "bluetooth" | "book" | "bookmarkOutline" | "bookmark" | "calculator" | "calendarBusy" | "calendarCheck" | "calendarEmpty" | "calendarMonth" | "calendarReccuring" | "call" | "caretDown" | "caretUpDown" | "caretUp" | "chat" | "checkCircleOutline" | "checkCircle" | "checkSmall" | "check" | "chevronDownUp" | "chevronDown" | "chevronLeft" | "chevronRight" | "chevronUpDown" | "chevronUp" | "chip" | "circleStatus" | "closeAll" | "closeAlt" | "close" | "columnGraph" | "comment" | "connection0" | "connection1" | "connection2" | "connection3" | "connection4" | "contentPaste" | "copy" | "cpmCyclesPerMinute" | "dangerOutline" | "danger" | "defectFrequenciesAlt" | "defectFrequencies" | "deleteOutline" | "delete" | "devices" | "directions" | "doubleChevronLeft" | "doubleChevronRight" | "downloadDone" | "download" | "draftOutline" | "draft" | "dragDrop" | "drop" | "duplicate" | "editOutline" | "edit" | "emailOutline" | "emailPdf" | "email" | "errorOutline" | "error" | "exclamation" | "facebook" | "filterOutline" | "filter" | "findReplace" | "forbidden" | "frequencyHz" | "fullScreen" | "fullscreenExit" | "functionalGroup" | "hamburgerMenu" | "harmonicCursor" | "heatmap" | "hierarchy" | "history" | "homeOutline" | "home" | "hourglassOutline" | "hourglass" | "image" | "imx" | "infoOutline" | "info" | "instagram" | "integration" | "iosShare" | "kebabMore" | "language" | "lightbulbOutline" | "lightbulb" | "link" | "linkedin" | "listGroup" | "list" | "locationPin" | "lockOutline" | "lock" | "logOut" | "login" | "meatballsMoreCircle" | "meatballsMore" | "microphone" | "nearMe" | "noData" | "notificationsBellOutline" | "notificationsBell" | "o" | "offer" | "openInNew" | "overlaysBaseline" | "pan360" | "paper" | "pause" | "pdfOutline" | "pdf" | "person" | "photoCameraOutline" | "photoCamera" | "pieChart" | "pinOutline" | "pin" | "play" | "powerOff" | "printOutline" | "print" | "privacyPolicyOutline" | "privacyPolicy" | "proCollect" | "recAction" | "refresh" | "removeMinus" | "reorder" | "reply" | "report" | "rewakableRoute" | "route" | "search" | "sendOutline" | "send" | "sensorAlt" | "sensor" | "settingsOutline" | "settings" | "share" | "shoppingCart" | "sidebandCursor" | "singleCursor" | "skfBearing" | "spectrum" | "starOutline" | "star" | "stop" | "sync" | "time" | "timewave" | "translate" | "trend" | "trendingUp" | "twitter" | "undo" | "unknownDiamondOutline" | "unknownDiamond" | "unknownOutline" | "unknown" | "unlink" | "unlockOutline" | "unlock" | "unscheduledAction" | "upload" | "vibrationAlt" | "vibration" | "view3D" | "viewFull" | "viewHorizontal" | "viewVertical" | "visibilityOffOutline" | "visibilityOff" | "visibilityOutline" | "visibility" | "warningDiamondOutline" | "warningDiamond" | "warningOutline" | "warning" | "youtube" | "zoomIn" | "zoomOut" }
|
23
23
|
*/
|
24
24
|
name: Icon;
|
25
25
|
/**
|
@@ -28,7 +28,7 @@ export declare class SkfInput extends FormBase implements FormFieldBaseProps {
|
|
28
28
|
/**
|
29
29
|
* Specifies what permission the browser has to provide assistance in filling out form field values. Refer to
|
30
30
|
* [this page on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) for available values.
|
31
|
-
* @type {
|
31
|
+
* @type { 'on' | 'off' | 'name' | 'honorific-prefix' | 'given-name' | 'additional-name' | 'family-name' | 'honorific-suffix' | 'nickname' | 'username' | 'new-password' | 'current-password' | 'one-time-code' | 'organization-title' | 'organization' | 'street-address' | 'address-line1' | 'address-line2' | 'address-line3' | 'address-level4' | 'address-level3' | 'address-level2' | 'address-level1' | 'country' | 'country-name' | 'postal-code' | 'cc-name' | 'cc-given-name' | 'cc-additional-name' | 'cc-family-name' | 'cc-number' | 'cc-exp' | 'cc-exp-month' | 'cc-exp-year' | 'cc-csc' | 'cc-type' | 'transaction-amount' | 'transaction-currency' | 'language' | 'bday' | 'bday-day' | 'bday-month' | 'bday-year' | 'sex' | 'url' | 'photo' | 'tel' | 'tel-country-code' | 'tel-national' | 'tel-area-code' | 'tel-local' | 'tel-extension' | 'email' | 'impp' | 'password' | 'webauthn' | 'work' | (string & {})}
|
32
32
|
*/
|
33
33
|
autocomplete?: AutocompleteValues;
|
34
34
|
/** Custom aria-label for the clear button. **Notice!** Only applicable to type=search. */
|
@@ -72,7 +72,7 @@ export declare class SkfInput extends FormBase implements FormFieldBaseProps {
|
|
72
72
|
requiredLabel?: string;
|
73
73
|
/**
|
74
74
|
* If defined, displays provided severity state
|
75
|
-
* @type { "
|
75
|
+
* @type { "success" | "info" | "warning" }
|
76
76
|
*/
|
77
77
|
severity?: FormFieldBaseProps['severity'];
|
78
78
|
/** If true, displays valid state after interaction */
|