@sondor-technology/sondor-components 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/alert/alert.constants.d.ts +3 -0
- package/dist/components/alert/alert.constants.d.ts.map +1 -0
- package/dist/components/alert/alert.constants.js +2 -0
- package/dist/components/alert/alert.constants.js.map +1 -0
- package/dist/components/alert/alert.d.ts +4 -3
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/alert.js +21 -11
- package/dist/components/alert/alert.js.map +1 -0
- package/dist/components/badge/badge.constants.d.ts +3 -0
- package/dist/components/badge/badge.constants.d.ts.map +1 -0
- package/dist/components/badge/badge.constants.js +2 -0
- package/dist/components/badge/badge.constants.js.map +1 -0
- package/dist/components/badge/badge.d.ts +1 -1
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/badge.js +3 -2
- package/dist/components/badge/badge.js.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.js +2 -1
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/components/button/button.constants.d.ts +7 -0
- package/dist/components/button/button.constants.d.ts.map +1 -0
- package/dist/components/button/button.constants.js +4 -0
- package/dist/components/button/button.constants.js.map +1 -0
- package/dist/components/button/button.d.ts +8 -4
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +181 -137
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/button-group/button-group.d.ts +6 -0
- package/dist/components/button-group/button-group.d.ts.map +1 -1
- package/dist/components/button-group/button-group.js +17 -21
- package/dist/components/button-group/button-group.js.map +1 -0
- package/dist/components/checkbox/checkbox.constants.d.ts +3 -0
- package/dist/components/checkbox/checkbox.constants.d.ts.map +1 -0
- package/dist/components/checkbox/checkbox.constants.js +2 -0
- package/dist/components/checkbox/checkbox.constants.js.map +1 -0
- package/dist/components/checkbox/checkbox.d.ts +5 -1
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/checkbox.js +21 -5
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/code-block/code-block.d.ts +12 -7
- package/dist/components/code-block/code-block.d.ts.map +1 -1
- package/dist/components/code-block/code-block.js +130 -66
- package/dist/components/code-block/code-block.js.map +1 -0
- package/dist/components/content-card/content-card.d.ts.map +1 -1
- package/dist/components/content-card/content-card.js +10 -15
- package/dist/components/content-card/content-card.js.map +1 -0
- package/dist/components/divider/divider.constants.d.ts +5 -0
- package/dist/components/divider/divider.constants.d.ts.map +1 -0
- package/dist/components/divider/divider.constants.js +3 -0
- package/dist/components/divider/divider.constants.js.map +1 -0
- package/dist/components/divider/divider.d.ts +4 -2
- package/dist/components/divider/divider.d.ts.map +1 -1
- package/dist/components/divider/divider.js +18 -9
- package/dist/components/divider/divider.js.map +1 -0
- package/dist/components/drawer/drawer.d.ts +7 -4
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/drawer.js +73 -30
- package/dist/components/drawer/drawer.js.map +1 -0
- package/dist/components/field/field.d.ts +2 -2
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/field.js +8 -9
- package/dist/components/field/field.js.map +1 -0
- package/dist/components/footer/footer.d.ts +8 -1
- package/dist/components/footer/footer.d.ts.map +1 -1
- package/dist/components/footer/footer.js +42 -12
- package/dist/components/footer/footer.js.map +1 -0
- package/dist/components/form/form-step.js +1 -0
- package/dist/components/form/form-step.js.map +1 -0
- package/dist/components/form/form.d.ts +3 -0
- package/dist/components/form/form.d.ts.map +1 -1
- package/dist/components/form/form.js +107 -67
- package/dist/components/form/form.js.map +1 -0
- package/dist/components/grid/grid-row.d.ts +3 -3
- package/dist/components/grid/grid-row.d.ts.map +1 -1
- package/dist/components/grid/grid-row.js +36 -22
- package/dist/components/grid/grid-row.js.map +1 -0
- package/dist/components/grid/grid.d.ts +2 -2
- package/dist/components/grid/grid.d.ts.map +1 -1
- package/dist/components/grid/grid.js +5 -2
- package/dist/components/grid/grid.js.map +1 -0
- package/dist/components/icon/icon-paths.js +1 -0
- package/dist/components/icon/icon-paths.js.map +1 -0
- package/dist/components/icon/icon.js +1 -0
- package/dist/components/icon/icon.js.map +1 -0
- package/dist/components/input/input.d.ts +14 -0
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/input/input.js +30 -37
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/link/link.d.ts +6 -6
- package/dist/components/link/link.d.ts.map +1 -1
- package/dist/components/link/link.js +42 -19
- package/dist/components/link/link.js.map +1 -0
- package/dist/components/metadata/metadata.d.ts +3 -3
- package/dist/components/metadata/metadata.d.ts.map +1 -1
- package/dist/components/metadata/metadata.js +23 -20
- package/dist/components/metadata/metadata.js.map +1 -0
- package/dist/components/modal/modal.d.ts +4 -16
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/modal/modal.js +99 -62
- package/dist/components/modal/modal.js.map +1 -0
- package/dist/components/page-layout/page-layout.d.ts +4 -3
- package/dist/components/page-layout/page-layout.d.ts.map +1 -1
- package/dist/components/page-layout/page-layout.js +96 -69
- package/dist/components/page-layout/page-layout.js.map +1 -0
- package/dist/components/radio/radio.d.ts +8 -0
- package/dist/components/radio/radio.d.ts.map +1 -1
- package/dist/components/radio/radio.js +8 -12
- package/dist/components/radio/radio.js.map +1 -0
- package/dist/components/radio-group/radio-group.d.ts +6 -1
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/radio-group/radio-group.js +44 -18
- package/dist/components/radio-group/radio-group.js.map +1 -0
- package/dist/components/router/router.d.ts +5 -7
- package/dist/components/router/router.d.ts.map +1 -1
- package/dist/components/router/router.js +54 -38
- package/dist/components/router/router.js.map +1 -0
- package/dist/components/select/select.d.ts +41 -7
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +467 -150
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/skeleton/skeleton.d.ts +3 -2
- package/dist/components/skeleton/skeleton.d.ts.map +1 -1
- package/dist/components/skeleton/skeleton.js +10 -13
- package/dist/components/skeleton/skeleton.js.map +1 -0
- package/dist/components/switch/switch.d.ts +12 -0
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/switch/switch.js +28 -22
- package/dist/components/switch/switch.js.map +1 -0
- package/dist/components/table/data-table.d.ts +3 -25
- package/dist/components/table/data-table.d.ts.map +1 -1
- package/dist/components/table/data-table.js +211 -146
- package/dist/components/table/data-table.js.map +1 -0
- package/dist/components/table/table.d.ts +3 -3
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +39 -20
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/tabs/tab-panel.d.ts +8 -1
- package/dist/components/tabs/tab-panel.d.ts.map +1 -1
- package/dist/components/tabs/tab-panel.js +21 -11
- package/dist/components/tabs/tab-panel.js.map +1 -0
- package/dist/components/tabs/tab.d.ts +10 -1
- package/dist/components/tabs/tab.d.ts.map +1 -1
- package/dist/components/tabs/tab.js +46 -28
- package/dist/components/tabs/tab.js.map +1 -0
- package/dist/components/tabs/tabs.d.ts +9 -0
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tabs/tabs.js +76 -13
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/textarea/textarea.d.ts +13 -0
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/textarea/textarea.js +59 -13
- package/dist/components/textarea/textarea.js.map +1 -0
- package/dist/components/theme-toggle/theme-toggle.constants.d.ts +3 -0
- package/dist/components/theme-toggle/theme-toggle.constants.d.ts.map +1 -0
- package/dist/components/theme-toggle/theme-toggle.constants.js +2 -0
- package/dist/components/theme-toggle/theme-toggle.constants.js.map +1 -0
- package/dist/components/theme-toggle/theme-toggle.d.ts +3 -2
- package/dist/components/theme-toggle/theme-toggle.d.ts.map +1 -1
- package/dist/components/theme-toggle/theme-toggle.js +46 -19
- package/dist/components/theme-toggle/theme-toggle.js.map +1 -0
- package/dist/components/vertical-nav/vertical-nav-group.d.ts +5 -2
- package/dist/components/vertical-nav/vertical-nav-group.d.ts.map +1 -1
- package/dist/components/vertical-nav/vertical-nav-group.js +50 -14
- package/dist/components/vertical-nav/vertical-nav-group.js.map +1 -0
- package/dist/components/vertical-nav/vertical-nav-item.d.ts +3 -2
- package/dist/components/vertical-nav/vertical-nav-item.d.ts.map +1 -1
- package/dist/components/vertical-nav/vertical-nav-item.js +30 -8
- package/dist/components/vertical-nav/vertical-nav-item.js.map +1 -0
- package/dist/styles/index.css +50 -17
- package/dist/styles/reset.js +1 -0
- package/dist/styles/reset.js.map +1 -0
- package/package.json +2 -1
- package/src/components/alert/alert.constants.ts +2 -0
- package/src/components/alert/alert.ts +24 -15
- package/src/components/badge/badge.constants.ts +2 -0
- package/src/components/badge/badge.ts +3 -4
- package/src/components/breadcrumb/breadcrumb.ts +2 -2
- package/src/components/button/button.constants.ts +8 -0
- package/src/components/button/button.ts +184 -144
- package/src/components/button-group/button-group.ts +23 -21
- package/src/components/checkbox/checkbox.constants.ts +2 -0
- package/src/components/checkbox/checkbox.ts +33 -18
- package/src/components/code-block/code-block.ts +157 -84
- package/src/components/content-card/content-card.ts +10 -16
- package/src/components/divider/divider.constants.ts +5 -0
- package/src/components/divider/divider.ts +22 -11
- package/src/components/drawer/drawer.ts +79 -34
- package/src/components/field/field.ts +9 -11
- package/src/components/footer/footer.ts +43 -12
- package/src/components/form/form.ts +120 -83
- package/src/components/grid/grid-row.ts +45 -32
- package/src/components/grid/grid.ts +7 -4
- package/src/components/input/input.ts +37 -41
- package/src/components/link/link.ts +45 -21
- package/src/components/metadata/metadata.ts +26 -24
- package/src/components/modal/modal.ts +108 -74
- package/src/components/page-layout/page-layout.ts +98 -73
- package/src/components/radio/radio.ts +8 -13
- package/src/components/radio-group/radio-group.ts +45 -21
- package/src/components/router/router.ts +73 -50
- package/src/components/select/select.ts +502 -131
- package/src/components/skeleton/skeleton.ts +14 -14
- package/src/components/switch/switch.ts +31 -25
- package/src/components/table/data-table.ts +248 -177
- package/src/components/table/table.ts +52 -29
- package/src/components/tabs/tab-panel.ts +30 -13
- package/src/components/tabs/tab.ts +64 -33
- package/src/components/tabs/tabs.ts +82 -14
- package/src/components/textarea/textarea.ts +63 -15
- package/src/components/theme-toggle/theme-toggle.constants.ts +2 -0
- package/src/components/theme-toggle/theme-toggle.ts +47 -22
- package/src/components/vertical-nav/vertical-nav-group.ts +57 -18
- package/src/components/vertical-nav/vertical-nav-item.ts +35 -12
- package/src/styles/globals.css +27 -4
- package/src/styles/theme.css +39 -31
- package/tsconfig.json +2 -1
- package/dist/components/card/card.d.ts +0 -11
- package/dist/components/card/card.d.ts.map +0 -1
- package/dist/components/card/card.js +0 -54
- package/src/components/card/card.ts +0 -53
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import {LitElement, html, css} from "lit";
|
|
2
2
|
import {customElement, property} from "lit/decorators.js";
|
|
3
3
|
import {resetStyles} from "../../styles/reset.js";
|
|
4
|
-
|
|
5
|
-
export type ThemeMode = "light" | "system" | "dark";
|
|
4
|
+
import {ThemeMode} from "./theme-toggle.constants.js";
|
|
6
5
|
|
|
7
6
|
@customElement("st-theme-toggle")
|
|
8
7
|
export class StThemeToggle extends LitElement {
|
|
9
8
|
@property({type: String, reflect: true}) theme: ThemeMode = "system";
|
|
10
9
|
|
|
10
|
+
// 🚀 FEATURE: Automatically applies the theme to the document and saves to localStorage
|
|
11
|
+
@property({type: Boolean}) auto = false;
|
|
12
|
+
|
|
11
13
|
static styles = [
|
|
12
14
|
resetStyles,
|
|
13
15
|
css`
|
|
14
16
|
:host {
|
|
15
17
|
display: inline-flex;
|
|
16
|
-
/* Use semantic tokens for the container */
|
|
17
18
|
background-color: var(--st-color-surface);
|
|
18
19
|
border: 1px solid var(--st-color-border);
|
|
19
20
|
border-radius: 999px;
|
|
@@ -39,12 +40,9 @@ export class StThemeToggle extends LitElement {
|
|
|
39
40
|
color: var(--st-color-text);
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
/* Active State Styling */
|
|
43
43
|
button[aria-pressed="true"] {
|
|
44
|
-
/* Use the main background color so the active pill "pops" out of the surface */
|
|
45
44
|
background-color: var(--st-color-bg);
|
|
46
45
|
color: var(--st-color-primary);
|
|
47
|
-
/* Subtle shadow to lift the active pill */
|
|
48
46
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
49
47
|
}
|
|
50
48
|
|
|
@@ -60,10 +58,45 @@ export class StThemeToggle extends LitElement {
|
|
|
60
58
|
`,
|
|
61
59
|
];
|
|
62
60
|
|
|
61
|
+
override connectedCallback() {
|
|
62
|
+
super.connectedCallback();
|
|
63
|
+
|
|
64
|
+
// 🚀 FIX: Semantically group the buttons for screen readers
|
|
65
|
+
this.setAttribute("role", "group");
|
|
66
|
+
this.setAttribute("aria-label", "Theme preference");
|
|
67
|
+
|
|
68
|
+
// If auto is enabled, try loading from localStorage first
|
|
69
|
+
if (this.auto) {
|
|
70
|
+
try {
|
|
71
|
+
const savedTheme = localStorage.getItem("st-theme") as ThemeMode | null;
|
|
72
|
+
if (savedTheme) {
|
|
73
|
+
this.theme = savedTheme;
|
|
74
|
+
document.documentElement.setAttribute("data-theme", savedTheme);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
} catch (e) {
|
|
78
|
+
// Silently fail if localStorage is blocked (e.g., incognito mode)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Fallback to checking the document root for a pre-rendered theme
|
|
83
|
+
const rootTheme = document.documentElement.getAttribute("data-theme") as ThemeMode | null;
|
|
84
|
+
if (rootTheme) {
|
|
85
|
+
this.theme = rootTheme;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
63
89
|
private _handleThemeChange(newTheme: ThemeMode) {
|
|
64
90
|
this.theme = newTheme;
|
|
65
91
|
|
|
66
|
-
//
|
|
92
|
+
// Apply automatically if the feature is enabled
|
|
93
|
+
if (this.auto) {
|
|
94
|
+
document.documentElement.setAttribute("data-theme", newTheme);
|
|
95
|
+
try {
|
|
96
|
+
localStorage.setItem("st-theme", newTheme);
|
|
97
|
+
} catch (e) {}
|
|
98
|
+
}
|
|
99
|
+
|
|
67
100
|
this.dispatchEvent(
|
|
68
101
|
new CustomEvent("st-theme-change", {
|
|
69
102
|
detail: {theme: newTheme},
|
|
@@ -73,24 +106,16 @@ export class StThemeToggle extends LitElement {
|
|
|
73
106
|
);
|
|
74
107
|
}
|
|
75
108
|
|
|
76
|
-
override connectedCallback() {
|
|
77
|
-
super.connectedCallback();
|
|
78
|
-
// Check the html tag for the theme injected by your blocking <head> script
|
|
79
|
-
const rootTheme = document.documentElement.getAttribute("data-theme") as ThemeMode;
|
|
80
|
-
if (rootTheme) {
|
|
81
|
-
this.theme = rootTheme;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
109
|
render() {
|
|
86
110
|
return html`
|
|
87
111
|
<button
|
|
88
112
|
aria-pressed=${this.theme === "light"}
|
|
113
|
+
aria-label="Light Mode"
|
|
89
114
|
title="Light Mode"
|
|
90
115
|
@click=${() => this._handleThemeChange("light")}
|
|
91
116
|
>
|
|
92
|
-
<!--
|
|
93
|
-
<svg viewBox="0 0 24 24">
|
|
117
|
+
<!-- 🚀 FIX: Hide decorative SVGs from the accessibility tree -->
|
|
118
|
+
<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
94
119
|
<circle cx="12" cy="12" r="5"></circle>
|
|
95
120
|
<path
|
|
96
121
|
d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"
|
|
@@ -100,11 +125,11 @@ export class StThemeToggle extends LitElement {
|
|
|
100
125
|
|
|
101
126
|
<button
|
|
102
127
|
aria-pressed=${this.theme === "system"}
|
|
128
|
+
aria-label="System Preference"
|
|
103
129
|
title="System Preference"
|
|
104
130
|
@click=${() => this._handleThemeChange("system")}
|
|
105
131
|
>
|
|
106
|
-
|
|
107
|
-
<svg viewBox="0 0 24 24">
|
|
132
|
+
<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
108
133
|
<rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect>
|
|
109
134
|
<path d="M8 21h8M12 17v4"></path>
|
|
110
135
|
</svg>
|
|
@@ -112,11 +137,11 @@ export class StThemeToggle extends LitElement {
|
|
|
112
137
|
|
|
113
138
|
<button
|
|
114
139
|
aria-pressed=${this.theme === "dark"}
|
|
140
|
+
aria-label="Dark Mode"
|
|
115
141
|
title="Dark Mode"
|
|
116
142
|
@click=${() => this._handleThemeChange("dark")}
|
|
117
143
|
>
|
|
118
|
-
|
|
119
|
-
<svg viewBox="0 0 24 24">
|
|
144
|
+
<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
120
145
|
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
|
121
146
|
</svg>
|
|
122
147
|
</button>
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import {LitElement, html, css, PropertyValues} from "lit";
|
|
2
|
+
import {customElement, property, query} from "lit/decorators.js";
|
|
3
|
+
import {resetStyles} from "../../styles/reset.js";
|
|
4
4
|
|
|
5
|
-
@customElement(
|
|
5
|
+
@customElement("st-vertical-nav-group")
|
|
6
6
|
export class StNavGroup extends LitElement {
|
|
7
|
-
@property({
|
|
8
|
-
@property({
|
|
9
|
-
@property({
|
|
7
|
+
@property({type: String}) label = "";
|
|
8
|
+
@property({type: Boolean, reflect: true}) open = false;
|
|
9
|
+
@property({type: Number}) depth = 0;
|
|
10
|
+
|
|
11
|
+
@query(".drawer-content") private _drawerContent!: HTMLElement;
|
|
10
12
|
|
|
11
13
|
static styles = [
|
|
12
14
|
resetStyles,
|
|
@@ -31,14 +33,20 @@ export class StNavGroup extends LitElement {
|
|
|
31
33
|
font-size: var(--st-font-size-sm);
|
|
32
34
|
font-weight: var(--st-font-weight-semibold);
|
|
33
35
|
cursor: pointer;
|
|
34
|
-
transition:
|
|
36
|
+
transition:
|
|
37
|
+
background-color 0.2s ease,
|
|
38
|
+
color 0.2s ease;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
button:hover {
|
|
38
|
-
background-color: var(--st-color-surface-hover, rgba(0,0,0,0.03));
|
|
42
|
+
background-color: var(--st-color-surface-hover, rgba(0, 0, 0, 0.03));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
button:focus-visible {
|
|
46
|
+
outline: 2px solid var(--st-color-primary);
|
|
47
|
+
outline-offset: -2px;
|
|
39
48
|
}
|
|
40
49
|
|
|
41
|
-
/* Styles for slotted icons */
|
|
42
50
|
::slotted([slot="icon"]) {
|
|
43
51
|
width: 1rem;
|
|
44
52
|
height: 1rem;
|
|
@@ -85,24 +93,55 @@ export class StNavGroup extends LitElement {
|
|
|
85
93
|
display: flex;
|
|
86
94
|
flex-direction: column;
|
|
87
95
|
}
|
|
88
|
-
|
|
96
|
+
`,
|
|
89
97
|
];
|
|
90
98
|
|
|
91
99
|
private _toggle() {
|
|
92
100
|
this.open = !this.open;
|
|
101
|
+
this.dispatchEvent(
|
|
102
|
+
new CustomEvent("st-group-toggle", {
|
|
103
|
+
detail: {open: this.open, label: this.label},
|
|
104
|
+
bubbles: true,
|
|
105
|
+
composed: true,
|
|
106
|
+
}),
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private _updateChildDepths() {
|
|
111
|
+
// Query 'this' (Light DOM) instead of the Shadow DOM
|
|
112
|
+
const childItems = this.querySelectorAll("st-vertical-nav-item, st-vertical-nav-group");
|
|
113
|
+
childItems.forEach((item: any) => {
|
|
114
|
+
item.depth = this.depth + 1;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
override updated(changedProperties: PropertyValues) {
|
|
119
|
+
super.updated(changedProperties);
|
|
120
|
+
if (changedProperties.has("depth")) {
|
|
121
|
+
this._updateChildDepths();
|
|
122
|
+
}
|
|
93
123
|
}
|
|
94
124
|
|
|
95
125
|
render() {
|
|
126
|
+
const groupId = `nav-group-${this.label.toLowerCase().replace(/\s+/g, "-")}`;
|
|
127
|
+
|
|
96
128
|
return html`
|
|
97
|
-
<button
|
|
129
|
+
<button
|
|
130
|
+
@click=${this._toggle}
|
|
131
|
+
aria-expanded=${this.open}
|
|
132
|
+
aria-controls=${groupId}
|
|
133
|
+
style="--nav-depth: ${this.depth}"
|
|
134
|
+
>
|
|
98
135
|
<slot name="icon"></slot>
|
|
99
136
|
<span class="label">${this.label}</span>
|
|
100
|
-
<svg class="chevron" viewBox="0 0 24 24"
|
|
137
|
+
<svg class="chevron" aria-hidden="true" viewBox="0 0 24 24">
|
|
138
|
+
<path d="M6 9l6 6 6-6"></path>
|
|
139
|
+
</svg>
|
|
101
140
|
</button>
|
|
102
|
-
|
|
103
|
-
<div class="drawer">
|
|
141
|
+
|
|
142
|
+
<div id=${groupId} class="drawer" role="region" aria-label=${this.label}>
|
|
104
143
|
<div class="drawer-content">
|
|
105
|
-
<slot></slot>
|
|
144
|
+
<slot @slotchange=${this._updateChildDepths}></slot>
|
|
106
145
|
</div>
|
|
107
146
|
</div>
|
|
108
147
|
`;
|
|
@@ -111,6 +150,6 @@ export class StNavGroup extends LitElement {
|
|
|
111
150
|
|
|
112
151
|
declare global {
|
|
113
152
|
interface HTMLElementTagNameMap {
|
|
114
|
-
|
|
153
|
+
"st-vertical-nav-group": StNavGroup;
|
|
115
154
|
}
|
|
116
|
-
}
|
|
155
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import {LitElement, html, css} from "lit";
|
|
2
|
+
import {customElement, property} from "lit/decorators.js";
|
|
3
|
+
import {resetStyles} from "../../styles/reset.js";
|
|
4
4
|
|
|
5
|
-
@customElement(
|
|
5
|
+
@customElement("st-vertical-nav-item")
|
|
6
6
|
export class StNavItem extends LitElement {
|
|
7
|
-
@property({
|
|
8
|
-
@property({
|
|
9
|
-
@property({
|
|
7
|
+
@property({type: String}) href = "#";
|
|
8
|
+
@property({type: Boolean, reflect: true}) active = false;
|
|
9
|
+
@property({type: Number}) depth = 0;
|
|
10
10
|
|
|
11
11
|
static styles = [
|
|
12
12
|
resetStyles,
|
|
@@ -37,7 +37,12 @@ export class StNavItem extends LitElement {
|
|
|
37
37
|
|
|
38
38
|
a:hover {
|
|
39
39
|
color: var(--st-color-text);
|
|
40
|
-
background-color: var(--st-color-surface-hover, rgba(0,0,0,0.03));
|
|
40
|
+
background-color: var(--st-color-surface-hover, rgba(0, 0, 0, 0.03));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
a:focus-visible {
|
|
44
|
+
outline: 2px solid var(--st-color-primary);
|
|
45
|
+
outline-offset: -2px;
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
::slotted([slot="icon"]) {
|
|
@@ -53,12 +58,30 @@ export class StNavItem extends LitElement {
|
|
|
53
58
|
font-weight: var(--st-font-weight-bold);
|
|
54
59
|
background-color: var(--st-color-primary-light, rgba(98, 0, 238, 0.05));
|
|
55
60
|
}
|
|
56
|
-
|
|
61
|
+
`,
|
|
57
62
|
];
|
|
58
63
|
|
|
64
|
+
private _handleClick(e: MouseEvent) {
|
|
65
|
+
// Dispatch a custom event so single-page apps can catch internal route clicks if desired
|
|
66
|
+
const event = new CustomEvent("st-nav-click", {
|
|
67
|
+
detail: {href: this.href},
|
|
68
|
+
bubbles: true,
|
|
69
|
+
composed: true,
|
|
70
|
+
cancelable: true,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
this.dispatchEvent(event);
|
|
74
|
+
}
|
|
75
|
+
|
|
59
76
|
render() {
|
|
60
77
|
return html`
|
|
61
|
-
<a
|
|
78
|
+
<a
|
|
79
|
+
href=${this.href}
|
|
80
|
+
part="link"
|
|
81
|
+
style="--nav-depth: ${this.depth}"
|
|
82
|
+
aria-current=${this.active ? "page" : "false"}
|
|
83
|
+
@click=${this._handleClick}
|
|
84
|
+
>
|
|
62
85
|
<slot name="icon"></slot>
|
|
63
86
|
<slot></slot>
|
|
64
87
|
</a>
|
|
@@ -68,6 +91,6 @@ export class StNavItem extends LitElement {
|
|
|
68
91
|
|
|
69
92
|
declare global {
|
|
70
93
|
interface HTMLElementTagNameMap {
|
|
71
|
-
|
|
94
|
+
"st-vertical-nav-item": StNavItem;
|
|
72
95
|
}
|
|
73
|
-
}
|
|
96
|
+
}
|
package/src/styles/globals.css
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
/* ==========================================================
|
|
3
3
|
Brand Primitives: Purple
|
|
4
4
|
========================================================== */
|
|
5
|
-
--st-purple-50: #faf5ff;
|
|
6
5
|
--st-purple-100: #f3e8ff;
|
|
7
|
-
--st-purple-
|
|
6
|
+
--st-purple-200: #e9d5ff;
|
|
7
|
+
--st-purple-300: #d8b4fe;
|
|
8
|
+
--st-purple-400: #c084fc;
|
|
8
9
|
--st-purple-500: #a855f7;
|
|
9
|
-
--st-purple-600: #
|
|
10
|
-
--st-purple-700: #
|
|
10
|
+
--st-purple-600: #9333ea;
|
|
11
|
+
--st-purple-700: #7e22ce;
|
|
12
|
+
--st-purple-800: #6b21a8;
|
|
13
|
+
--st-purple-900: #581c87;
|
|
11
14
|
|
|
12
15
|
/* ==========================================================
|
|
13
16
|
Neutral Primitives: Space Grey Scale
|
|
@@ -25,26 +28,46 @@
|
|
|
25
28
|
========================================================== */
|
|
26
29
|
/* Error / Danger */
|
|
27
30
|
--st-red-100: #fee2e2;
|
|
31
|
+
--st-red-200: #fecaca;
|
|
32
|
+
--st-red-300: #fca5a5;
|
|
33
|
+
--st-red-400: #f87171;
|
|
28
34
|
--st-red-500: #ef4444;
|
|
29
35
|
--st-red-600: #dc2626;
|
|
36
|
+
--st-red-700: #b91c1c;
|
|
37
|
+
--st-red-800: #991b1b;
|
|
30
38
|
--st-red-900: #7f1d1d;
|
|
31
39
|
|
|
32
40
|
/* Success / Validation */
|
|
33
41
|
--st-green-100: #dcfce7;
|
|
42
|
+
--st-green-200: #bbf7d0;
|
|
43
|
+
--st-green-300: #86efac;
|
|
44
|
+
--st-green-400: #4ade80;
|
|
34
45
|
--st-green-500: #22c55e;
|
|
35
46
|
--st-green-600: #16a34a;
|
|
47
|
+
--st-green-700: #15803d;
|
|
48
|
+
--st-green-800: #166534;
|
|
36
49
|
--st-green-900: #14532d;
|
|
37
50
|
|
|
38
51
|
/* Warning */
|
|
39
52
|
--st-amber-100: #fef3c7;
|
|
53
|
+
--st-amber-200: #fde68a;
|
|
54
|
+
--st-amber-300: #fcd34d;
|
|
55
|
+
--st-amber-400: #fbbf24;
|
|
40
56
|
--st-amber-500: #f59e0b;
|
|
41
57
|
--st-amber-600: #d97706;
|
|
58
|
+
--st-amber-700: #b45309;
|
|
59
|
+
--st-amber-800: #92400e;
|
|
42
60
|
--st-amber-900: #78350f;
|
|
43
61
|
|
|
44
62
|
/* Information */
|
|
45
63
|
--st-blue-100: #dbeafe;
|
|
64
|
+
--st-blue-200: #bfdbfe;
|
|
65
|
+
--st-blue-300: #93c5fd;
|
|
66
|
+
--st-blue-400: #60a5fa;
|
|
46
67
|
--st-blue-500: #3b82f6;
|
|
47
68
|
--st-blue-600: #2563eb;
|
|
69
|
+
--st-blue-700: #1d4ed8;
|
|
70
|
+
--st-blue-800: #1e40af;
|
|
48
71
|
--st-blue-900: #1e3a8a;
|
|
49
72
|
|
|
50
73
|
/* ==========================================================
|
package/src/styles/theme.css
CHANGED
|
@@ -5,26 +5,31 @@
|
|
|
5
5
|
:root[data-theme="light"] {
|
|
6
6
|
--st-color-bg: var(--st-white);
|
|
7
7
|
--st-color-surface: var(--st-gray-50);
|
|
8
|
+
--st-color-surface-muted: color-mix(in srgb, var(--st-color-surface), black 15%);
|
|
9
|
+
--st-color-surface-hover: color-mix(in srgb, var(--st-color-surface), white 10%);
|
|
8
10
|
--st-color-border: var(--st-gray-200);
|
|
9
|
-
|
|
11
|
+
|
|
10
12
|
--st-color-text: var(--st-gray-900);
|
|
11
13
|
--st-color-text-muted: var(--st-gray-700);
|
|
12
|
-
|
|
13
|
-
/* Now referencing the global tokens */
|
|
14
|
-
--st-color-primary: var(--st-purple-600);
|
|
15
|
-
--st-color-primary-hover: var(--st-purple-700);
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
/* BASE TOKENS: Used for Text, Outline Borders, and Icons. (DARK in light mode) */
|
|
16
|
+
--st-color-primary: var(--st-purple-700);
|
|
17
|
+
--st-color-primary-text: var(--st-purple-700);
|
|
18
|
+
--st-color-error: var(--st-red-700);
|
|
19
|
+
--st-color-error-text: var(--st-red-800);
|
|
20
|
+
--st-color-success: var(--st-green-800);
|
|
21
|
+
--st-color-warning: var(--st-amber-800);
|
|
22
|
+
--st-color-info: var(--st-blue-700);
|
|
23
|
+
--st-color-info-text: var(--st-blue-800);
|
|
24
|
+
|
|
25
|
+
/* BG TOKENS: Used for soft secondary backgrounds. (PASTEL in light mode) */
|
|
26
|
+
--st-color-primary-bg: var(--st-purple-100); /* NEW */
|
|
18
27
|
--st-color-error-bg: var(--st-red-100);
|
|
19
|
-
|
|
20
|
-
--st-color-success: var(--st-green-600);
|
|
21
28
|
--st-color-success-bg: var(--st-green-100);
|
|
22
|
-
|
|
23
|
-
--st-color-warning: var(--st-amber-600);
|
|
24
29
|
--st-color-warning-bg: var(--st-amber-100);
|
|
25
|
-
|
|
26
|
-
--st-color-info: var(--st-blue-600);
|
|
27
30
|
--st-color-info-bg: var(--st-blue-100);
|
|
31
|
+
|
|
32
|
+
--st-hover-brightness: 0.9;
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
/* ==========================================================
|
|
@@ -34,26 +39,29 @@
|
|
|
34
39
|
:root[data-theme="dark"] {
|
|
35
40
|
--st-color-bg: var(--st-gray-900);
|
|
36
41
|
--st-color-surface: var(--st-gray-800);
|
|
37
|
-
--st-color-surface-muted: color-mix(in srgb, var(--st-color-surface), black 15%);
|
|
42
|
+
--st-color-surface-muted: color-mix(in srgb, var(--st-color-surface), black 15%);
|
|
38
43
|
--st-color-surface-hover: color-mix(in srgb, var(--st-color-surface), white 10%);
|
|
39
44
|
--st-color-border: var(--st-gray-700);
|
|
40
|
-
|
|
45
|
+
|
|
41
46
|
--st-color-text: var(--st-gray-50);
|
|
42
|
-
--st-color-text-muted: var(--st-gray-
|
|
43
|
-
|
|
44
|
-
/*
|
|
45
|
-
--st-color-primary: var(--st-purple-
|
|
46
|
-
--st-color-primary-
|
|
47
|
-
|
|
48
|
-
--st-color-error: var(--st-
|
|
49
|
-
--st-color-
|
|
50
|
-
|
|
51
|
-
--st-color-
|
|
52
|
-
--st-color-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
--st-color-
|
|
56
|
-
|
|
57
|
-
--st-color-
|
|
58
|
-
--st-color-
|
|
47
|
+
--st-color-text-muted: var(--st-gray-300);
|
|
48
|
+
|
|
49
|
+
/* BASE TOKENS: Brightened to pass WCAG contrast against dark backgrounds */
|
|
50
|
+
--st-color-primary: var(--st-purple-300);
|
|
51
|
+
--st-color-primary-text: var(--st-color-primary);
|
|
52
|
+
--st-color-error: var(--st-red-300);
|
|
53
|
+
--st-color-error-text: var(--st-color-error);
|
|
54
|
+
--st-color-success: var(--st-green-400);
|
|
55
|
+
--st-color-warning: var(--st-amber-400);
|
|
56
|
+
--st-color-info: var(--st-blue-300);
|
|
57
|
+
--st-color-info-text: var(--st-color-info);
|
|
58
|
+
|
|
59
|
+
/* BG TOKENS: Deep, dark backgrounds for secondary variants */
|
|
60
|
+
--st-color-primary-bg: rgba(147, 51, 234, 0.15); /* NEW */
|
|
61
|
+
--st-color-error-bg: #451a1a;
|
|
62
|
+
--st-color-success-bg: #143620;
|
|
63
|
+
--st-color-warning-bg: #422a14;
|
|
64
|
+
--st-color-info-bg: #1e3a8a;
|
|
65
|
+
|
|
66
|
+
--st-hover-brightness: 1.3;
|
|
59
67
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
export declare class StCard extends LitElement {
|
|
3
|
-
static styles: import("lit").CSSResult[];
|
|
4
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
5
|
-
}
|
|
6
|
-
declare global {
|
|
7
|
-
interface HTMLElementTagNameMap {
|
|
8
|
-
'st-card': StCard;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=card.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/card/card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C,qBACa,MAAO,SAAQ,UAAU;IACpC,MAAM,CAAC,MAAM,4BA+BX;IAEF,MAAM,yCAML;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { LitElement, html, css } from 'lit';
|
|
8
|
-
import { customElement } from 'lit/decorators.js';
|
|
9
|
-
import { resetStyles } from '../../styles/reset.js';
|
|
10
|
-
let StCard = class StCard extends LitElement {
|
|
11
|
-
render() {
|
|
12
|
-
return html `
|
|
13
|
-
<slot name="header"></slot>
|
|
14
|
-
<slot></slot>
|
|
15
|
-
<slot name="footer"></slot>
|
|
16
|
-
`;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
StCard.styles = [
|
|
20
|
-
resetStyles,
|
|
21
|
-
css `
|
|
22
|
-
:host {
|
|
23
|
-
display: flex;
|
|
24
|
-
flex-direction: column;
|
|
25
|
-
background-color: var(--st-color-bg);
|
|
26
|
-
border: 1px solid var(--st-color-border);
|
|
27
|
-
border-radius: 8px;
|
|
28
|
-
overflow: hidden; /* Ensures contents don't break the border radius */
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/* Apply standard padding to all direct slotted children */
|
|
32
|
-
::slotted(*) {
|
|
33
|
-
padding: var(--st-spacing-md) var(--st-spacing-lg);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/* Optional structured slots for headers and footers */
|
|
37
|
-
::slotted([slot="header"]) {
|
|
38
|
-
border-bottom: 1px solid var(--st-color-border);
|
|
39
|
-
background-color: var(--st-color-surface);
|
|
40
|
-
font-weight: var(--st-font-weight-medium);
|
|
41
|
-
margin: 0;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
::slotted([slot="footer"]) {
|
|
45
|
-
border-top: 1px solid var(--st-color-border);
|
|
46
|
-
background-color: var(--st-color-surface);
|
|
47
|
-
margin-top: auto; /* Pushes the footer to the bottom if the card has a fixed height */
|
|
48
|
-
}
|
|
49
|
-
`
|
|
50
|
-
];
|
|
51
|
-
StCard = __decorate([
|
|
52
|
-
customElement('st-card')
|
|
53
|
-
], StCard);
|
|
54
|
-
export { StCard };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit';
|
|
2
|
-
import { customElement } from 'lit/decorators.js';
|
|
3
|
-
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
-
|
|
5
|
-
@customElement('st-card')
|
|
6
|
-
export class StCard extends LitElement {
|
|
7
|
-
static styles = [
|
|
8
|
-
resetStyles,
|
|
9
|
-
css`
|
|
10
|
-
:host {
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
background-color: var(--st-color-bg);
|
|
14
|
-
border: 1px solid var(--st-color-border);
|
|
15
|
-
border-radius: 8px;
|
|
16
|
-
overflow: hidden; /* Ensures contents don't break the border radius */
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/* Apply standard padding to all direct slotted children */
|
|
20
|
-
::slotted(*) {
|
|
21
|
-
padding: var(--st-spacing-md) var(--st-spacing-lg);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/* Optional structured slots for headers and footers */
|
|
25
|
-
::slotted([slot="header"]) {
|
|
26
|
-
border-bottom: 1px solid var(--st-color-border);
|
|
27
|
-
background-color: var(--st-color-surface);
|
|
28
|
-
font-weight: var(--st-font-weight-medium);
|
|
29
|
-
margin: 0;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
::slotted([slot="footer"]) {
|
|
33
|
-
border-top: 1px solid var(--st-color-border);
|
|
34
|
-
background-color: var(--st-color-surface);
|
|
35
|
-
margin-top: auto; /* Pushes the footer to the bottom if the card has a fixed height */
|
|
36
|
-
}
|
|
37
|
-
`
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
render() {
|
|
41
|
-
return html`
|
|
42
|
-
<slot name="header"></slot>
|
|
43
|
-
<slot></slot>
|
|
44
|
-
<slot name="footer"></slot>
|
|
45
|
-
`;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
declare global {
|
|
50
|
-
interface HTMLElementTagNameMap {
|
|
51
|
-
'st-card': StCard;
|
|
52
|
-
}
|
|
53
|
-
}
|