@sondor-technology/sondor-components 1.0.0 → 1.0.1-develop.3
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 +8 -0
- package/dist/components/alert/alert.d.ts +13 -0
- package/dist/components/alert/alert.d.ts.map +1 -0
- package/dist/components/alert/alert.js +105 -0
- package/dist/components/badge/badge.d.ts +13 -0
- package/dist/components/badge/badge.d.ts.map +1 -0
- package/dist/components/badge/badge.js +101 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +19 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.js +99 -0
- package/dist/components/button/button.d.ts +23 -0
- package/dist/components/button/button.d.ts.map +1 -0
- package/dist/components/button/button.js +304 -0
- package/dist/components/button-group/button-group.d.ts +6 -0
- package/dist/components/button-group/button-group.d.ts.map +1 -0
- package/dist/components/button-group/button-group.js +74 -0
- package/dist/components/card/card.d.ts +11 -0
- package/dist/components/card/card.d.ts.map +1 -0
- package/dist/components/card/card.js +54 -0
- package/dist/components/checkbox/checkbox.d.ts +28 -0
- package/dist/components/checkbox/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox/checkbox.js +247 -0
- package/dist/components/code-block/code-block.d.ts +20 -0
- package/dist/components/code-block/code-block.d.ts.map +1 -0
- package/dist/components/code-block/code-block.js +260 -0
- package/dist/components/content-card/content-card.d.ts +13 -0
- package/dist/components/content-card/content-card.d.ts.map +1 -0
- package/dist/components/content-card/content-card.js +140 -0
- package/dist/components/divider/divider.d.ts +16 -0
- package/dist/components/divider/divider.d.ts.map +1 -0
- package/dist/components/divider/divider.js +82 -0
- package/dist/components/drawer/drawer.d.ts +22 -0
- package/dist/components/drawer/drawer.d.ts.map +1 -0
- package/dist/components/drawer/drawer.js +226 -0
- package/dist/components/field/field.d.ts +11 -0
- package/dist/components/field/field.d.ts.map +1 -0
- package/dist/components/field/field.js +32 -0
- package/dist/components/footer/footer.d.ts +6 -0
- package/dist/components/footer/footer.d.ts.map +1 -0
- package/dist/components/footer/footer.js +65 -0
- package/dist/components/form/form-step.d.ts +13 -0
- package/dist/components/form/form-step.d.ts.map +1 -0
- package/dist/components/form/form-step.js +41 -0
- package/dist/components/form/form.d.ts +25 -0
- package/dist/components/form/form.d.ts.map +1 -0
- package/dist/components/form/form.js +358 -0
- package/dist/components/grid/grid-row.d.ts +17 -0
- package/dist/components/grid/grid-row.d.ts.map +1 -0
- package/dist/components/grid/grid-row.js +92 -0
- package/dist/components/grid/grid.d.ts +13 -0
- package/dist/components/grid/grid.d.ts.map +1 -0
- package/dist/components/grid/grid.js +42 -0
- package/dist/components/icon/icon-paths.d.ts +132 -0
- package/dist/components/icon/icon-paths.d.ts.map +1 -0
- package/dist/components/icon/icon-paths.js +137 -0
- package/dist/components/icon/icon.d.ts +16 -0
- package/dist/components/icon/icon.d.ts.map +1 -0
- package/dist/components/icon/icon.js +95 -0
- package/dist/components/input/input.d.ts +31 -0
- package/dist/components/input/input.d.ts.map +1 -0
- package/dist/components/input/input.js +268 -0
- package/dist/components/link/link.d.ts +16 -0
- package/dist/components/link/link.d.ts.map +1 -0
- package/dist/components/link/link.js +116 -0
- package/dist/components/metadata/metadata.d.ts +18 -0
- package/dist/components/metadata/metadata.d.ts.map +1 -0
- package/dist/components/metadata/metadata.js +71 -0
- package/dist/components/modal/modal.d.ts +24 -0
- package/dist/components/modal/modal.d.ts.map +1 -0
- package/dist/components/modal/modal.js +163 -0
- package/dist/components/page-layout/page-layout.d.ts +46 -0
- package/dist/components/page-layout/page-layout.d.ts.map +1 -0
- package/dist/components/page-layout/page-layout.js +697 -0
- package/dist/components/radio/radio.d.ts +16 -0
- package/dist/components/radio/radio.d.ts.map +1 -0
- package/dist/components/radio/radio.js +152 -0
- package/dist/components/radio-group/radio-group.d.ts +27 -0
- package/dist/components/radio-group/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group/radio-group.js +161 -0
- package/dist/components/router/router.d.ts +7 -0
- package/dist/components/router/router.d.ts.map +1 -0
- package/dist/components/router/router.js +37 -0
- package/dist/components/select/select.d.ts +16 -0
- package/dist/components/select/select.d.ts.map +1 -0
- package/dist/components/select/select.js +172 -0
- package/dist/components/skeleton/skeleton.d.ts +17 -0
- package/dist/components/skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton/skeleton.js +78 -0
- package/dist/components/switch/switch.d.ts +25 -0
- package/dist/components/switch/switch.d.ts.map +1 -0
- package/dist/components/switch/switch.js +185 -0
- package/dist/components/table/data-table.d.ts +72 -0
- package/dist/components/table/data-table.d.ts.map +1 -0
- package/dist/components/table/data-table.js +551 -0
- package/dist/components/table/table.d.ts +22 -0
- package/dist/components/table/table.d.ts.map +1 -0
- package/dist/components/table/table.js +167 -0
- package/dist/components/tabs/tab-panel.d.ts +8 -0
- package/dist/components/tabs/tab-panel.d.ts.map +1 -0
- package/dist/components/tabs/tab-panel.js +46 -0
- package/dist/components/tabs/tab.d.ts +9 -0
- package/dist/components/tabs/tab.d.ts.map +1 -0
- package/dist/components/tabs/tab.js +91 -0
- package/dist/components/tabs/tabs.d.ts +14 -0
- package/dist/components/tabs/tabs.d.ts.map +1 -0
- package/dist/components/tabs/tabs.js +85 -0
- package/dist/components/textarea/textarea.d.ts +36 -0
- package/dist/components/textarea/textarea.d.ts.map +1 -0
- package/dist/components/textarea/textarea.js +231 -0
- package/dist/components/theme-toggle/theme-toggle.d.ts +15 -0
- package/dist/components/theme-toggle/theme-toggle.d.ts.map +1 -0
- package/dist/components/theme-toggle/theme-toggle.js +130 -0
- package/dist/components/vertical-nav/vertical-nav-group.d.ts +10 -0
- package/dist/components/vertical-nav/vertical-nav-group.d.ts.map +1 -0
- package/dist/components/vertical-nav/vertical-nav-group.js +127 -0
- package/dist/components/vertical-nav/vertical-nav-item.d.ts +9 -0
- package/dist/components/vertical-nav/vertical-nav-item.d.ts.map +1 -0
- package/dist/components/vertical-nav/vertical-nav-item.js +85 -0
- package/dist/styles/index.css +171 -0
- package/dist/styles/reset.d.ts +2 -0
- package/dist/styles/reset.d.ts.map +1 -0
- package/dist/styles/reset.js +50 -0
- package/package.json +7 -2
- package/src/components/alert/alert.ts +100 -100
- package/src/components/badge/badge.ts +96 -96
- package/src/components/breadcrumb/breadcrumb.ts +98 -98
- package/src/components/button/button.ts +281 -281
- package/src/components/button-group/button-group.ts +67 -67
- package/src/components/card/card.ts +52 -52
- package/src/components/checkbox/checkbox.ts +238 -238
- package/src/components/code-block/code-block.ts +256 -256
- package/src/components/content-card/content-card.ts +133 -133
- package/src/components/divider/divider.ts +68 -68
- package/src/components/drawer/drawer.ts +217 -217
- package/src/components/field/field.ts +30 -30
- package/src/components/footer/footer.ts +58 -58
- package/src/components/form/form-step.ts +32 -32
- package/src/components/form/form.ts +376 -376
- package/src/components/grid/grid-row.ts +75 -75
- package/src/components/grid/grid.ts +36 -36
- package/src/components/icon/icon-paths.ts +140 -124
- package/src/components/icon/icon.ts +82 -82
- package/src/components/input/input.ts +248 -248
- package/src/components/link/link.ts +97 -97
- package/src/components/metadata/metadata.ts +66 -66
- package/src/components/modal/modal.ts +158 -158
- package/src/components/page-layout/page-layout.ts +704 -704
- package/src/components/radio/radio.ts +142 -142
- package/src/components/radio-group/radio-group.ts +157 -157
- package/src/components/router/router.ts +46 -46
- package/src/components/select/select.ts +161 -161
- package/src/components/skeleton/skeleton.ts +67 -67
- package/src/components/switch/switch.ts +181 -181
- package/src/components/table/data-table.ts +556 -556
- package/src/components/table/table.ts +153 -153
- package/src/components/tabs/tab-panel.ts +30 -30
- package/src/components/tabs/tab.ts +76 -76
- package/src/components/tabs/tabs.ts +88 -88
- package/src/components/textarea/textarea.ts +215 -215
- package/src/components/theme-toggle/theme-toggle.ts +131 -131
- package/src/components/vertical-nav/vertical-nav-group.ts +109 -96
- package/src/components/vertical-nav/vertical-nav-item.ts +66 -49
- package/src/styles/globals.css +58 -58
- package/src/styles/index.css +80 -80
- package/src/styles/reset.ts +50 -50
- package/src/styles/theme.css +58 -58
- package/src/styles/typography.css +25 -25
- package/tsconfig.json +15 -15
|
@@ -0,0 +1,231 @@
|
|
|
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, property, query } from "lit/decorators.js";
|
|
9
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
|
+
import { resetStyles } from "../../styles/reset.js";
|
|
11
|
+
let StTextarea = class StTextarea extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.name = "";
|
|
15
|
+
this.label = "";
|
|
16
|
+
this.value = "";
|
|
17
|
+
this.placeholder = "";
|
|
18
|
+
this.helpText = "";
|
|
19
|
+
// Textarea specific properties
|
|
20
|
+
this.rows = 4;
|
|
21
|
+
this.resize = "vertical";
|
|
22
|
+
// Validation
|
|
23
|
+
this.required = false;
|
|
24
|
+
// States
|
|
25
|
+
this.disabled = false;
|
|
26
|
+
this.invalid = false;
|
|
27
|
+
this.readonly = false;
|
|
28
|
+
this._internals = this.attachInternals();
|
|
29
|
+
// 1. Trigger error state if the user clicks away and the field is invalid
|
|
30
|
+
this.addEventListener("focusout", () => {
|
|
31
|
+
this.invalid = !this._textareaEl.validity.valid;
|
|
32
|
+
});
|
|
33
|
+
// 2. Trigger error state if the st-form tries to submit and fails
|
|
34
|
+
this.addEventListener("invalid", () => {
|
|
35
|
+
this.invalid = true;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
updated(changedProperties) {
|
|
39
|
+
super.updated(changedProperties);
|
|
40
|
+
if (changedProperties.has("value")) {
|
|
41
|
+
this._internals.setFormValue(this.value);
|
|
42
|
+
}
|
|
43
|
+
this._syncValidity();
|
|
44
|
+
}
|
|
45
|
+
_syncValidity() {
|
|
46
|
+
if (!this._textareaEl)
|
|
47
|
+
return;
|
|
48
|
+
this._internals.setValidity(this._textareaEl.validity, this._textareaEl.validationMessage, this._textareaEl);
|
|
49
|
+
}
|
|
50
|
+
formResetCallback() {
|
|
51
|
+
this.value = "";
|
|
52
|
+
this._internals.setFormValue("");
|
|
53
|
+
this.updateComplete.then(() => this._syncValidity());
|
|
54
|
+
}
|
|
55
|
+
checkValidity() {
|
|
56
|
+
return this._internals.checkValidity();
|
|
57
|
+
}
|
|
58
|
+
reportValidity() {
|
|
59
|
+
return this._internals.reportValidity();
|
|
60
|
+
}
|
|
61
|
+
_handleInput(e) {
|
|
62
|
+
const target = e.target;
|
|
63
|
+
this.value = target.value;
|
|
64
|
+
if (this.invalid && target.validity.valid) {
|
|
65
|
+
this.invalid = false;
|
|
66
|
+
}
|
|
67
|
+
this.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
|
|
68
|
+
}
|
|
69
|
+
_handleChange(e) {
|
|
70
|
+
this.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
return html `
|
|
74
|
+
<div class="form-control">
|
|
75
|
+
${this.label ? html `<label for="textarea">${this.label}</label>` : ""}
|
|
76
|
+
|
|
77
|
+
<textarea
|
|
78
|
+
id="textarea"
|
|
79
|
+
.name=${this.name}
|
|
80
|
+
.value=${this.value}
|
|
81
|
+
placeholder=${this.placeholder}
|
|
82
|
+
rows=${this.rows}
|
|
83
|
+
?disabled=${this.disabled}
|
|
84
|
+
?readonly=${this.readonly}
|
|
85
|
+
?required=${this.required}
|
|
86
|
+
minlength=${ifDefined(this.minlength)}
|
|
87
|
+
maxlength=${ifDefined(this.maxlength)}
|
|
88
|
+
@input=${this._handleInput}
|
|
89
|
+
@change=${this._handleChange}
|
|
90
|
+
></textarea>
|
|
91
|
+
|
|
92
|
+
${this.helpText ? html `<div class="help-text">${this.helpText}</div>` : ""}
|
|
93
|
+
</div>
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
StTextarea.formAssociated = true;
|
|
98
|
+
StTextarea.styles = [
|
|
99
|
+
resetStyles,
|
|
100
|
+
css `
|
|
101
|
+
:host {
|
|
102
|
+
display: block;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.form-control {
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
gap: var(--st-spacing-xs);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
label {
|
|
112
|
+
font-size: var(--st-font-size-sm);
|
|
113
|
+
font-weight: var(--st-font-weight-medium);
|
|
114
|
+
color: var(--st-color-text);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
textarea {
|
|
118
|
+
width: 100%;
|
|
119
|
+
padding: var(--st-spacing-sm) var(--st-spacing-md);
|
|
120
|
+
font-size: var(--st-font-size-base);
|
|
121
|
+
font-family: inherit;
|
|
122
|
+
color: var(--st-color-text);
|
|
123
|
+
background-color: var(--st-color-bg);
|
|
124
|
+
border: 1px solid var(--st-color-border);
|
|
125
|
+
border-radius: 4px;
|
|
126
|
+
transition:
|
|
127
|
+
border-color 0.2s ease,
|
|
128
|
+
box-shadow 0.2s ease;
|
|
129
|
+
|
|
130
|
+
/* Map the resize property */
|
|
131
|
+
resize: vertical;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Dynamically handle resize constraints based on the host attribute */
|
|
135
|
+
:host([resize="none"]) textarea {
|
|
136
|
+
resize: none;
|
|
137
|
+
}
|
|
138
|
+
:host([resize="horizontal"]) textarea {
|
|
139
|
+
resize: horizontal;
|
|
140
|
+
}
|
|
141
|
+
:host([resize="both"]) textarea {
|
|
142
|
+
resize: both;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
textarea::placeholder {
|
|
146
|
+
color: var(--st-color-text-muted);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
textarea:focus {
|
|
150
|
+
outline: none;
|
|
151
|
+
border-color: var(--st-color-primary);
|
|
152
|
+
box-shadow: 0 0 0 1px var(--st-color-primary);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* Validation States */
|
|
156
|
+
:host([invalid]) textarea {
|
|
157
|
+
border-color: var(--st-color-error);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
:host([invalid]) textarea:focus {
|
|
161
|
+
box-shadow: 0 0 0 1px var(--st-color-error);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
:host([invalid]) .help-text {
|
|
165
|
+
color: var(--st-color-error);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* Disabled & Readonly */
|
|
169
|
+
:host([disabled]) textarea {
|
|
170
|
+
opacity: 0.5;
|
|
171
|
+
cursor: not-allowed;
|
|
172
|
+
background-color: var(--st-color-surface);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
:host([readonly]) textarea {
|
|
176
|
+
background-color: var(--st-color-surface);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.help-text {
|
|
180
|
+
font-size: var(--st-font-size-xs);
|
|
181
|
+
color: var(--st-color-text-muted);
|
|
182
|
+
margin: 0;
|
|
183
|
+
}
|
|
184
|
+
`,
|
|
185
|
+
];
|
|
186
|
+
__decorate([
|
|
187
|
+
query("textarea")
|
|
188
|
+
], StTextarea.prototype, "_textareaEl", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
property({ type: String, reflect: true })
|
|
191
|
+
], StTextarea.prototype, "name", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
property({ type: String })
|
|
194
|
+
], StTextarea.prototype, "label", void 0);
|
|
195
|
+
__decorate([
|
|
196
|
+
property({ type: String })
|
|
197
|
+
], StTextarea.prototype, "value", void 0);
|
|
198
|
+
__decorate([
|
|
199
|
+
property({ type: String })
|
|
200
|
+
], StTextarea.prototype, "placeholder", void 0);
|
|
201
|
+
__decorate([
|
|
202
|
+
property({ attribute: "help-text" })
|
|
203
|
+
], StTextarea.prototype, "helpText", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
property({ type: Number })
|
|
206
|
+
], StTextarea.prototype, "rows", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
property({ type: String, reflect: true })
|
|
209
|
+
], StTextarea.prototype, "resize", void 0);
|
|
210
|
+
__decorate([
|
|
211
|
+
property({ type: Boolean, reflect: true })
|
|
212
|
+
], StTextarea.prototype, "required", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
property({ type: Number })
|
|
215
|
+
], StTextarea.prototype, "minlength", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
property({ type: Number })
|
|
218
|
+
], StTextarea.prototype, "maxlength", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
property({ type: Boolean, reflect: true })
|
|
221
|
+
], StTextarea.prototype, "disabled", void 0);
|
|
222
|
+
__decorate([
|
|
223
|
+
property({ type: Boolean, reflect: true })
|
|
224
|
+
], StTextarea.prototype, "invalid", void 0);
|
|
225
|
+
__decorate([
|
|
226
|
+
property({ type: Boolean, reflect: true })
|
|
227
|
+
], StTextarea.prototype, "readonly", void 0);
|
|
228
|
+
StTextarea = __decorate([
|
|
229
|
+
customElement("st-textarea")
|
|
230
|
+
], StTextarea);
|
|
231
|
+
export { StTextarea };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export type ThemeMode = "light" | "system" | "dark";
|
|
3
|
+
export declare class StThemeToggle extends LitElement {
|
|
4
|
+
theme: ThemeMode;
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
private _handleThemeChange;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9
|
+
}
|
|
10
|
+
declare global {
|
|
11
|
+
interface HTMLElementTagNameMap {
|
|
12
|
+
"st-theme-toggle": StThemeToggle;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=theme-toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/theme-toggle/theme-toggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAY,MAAM,KAAK,CAAC;AAI1C,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEpD,qBACa,aAAc,SAAQ,UAAU;IACF,KAAK,EAAE,SAAS,CAAY;IAErE,MAAM,CAAC,MAAM,4BAkDX;IAEF,OAAO,CAAC,kBAAkB;IAajB,iBAAiB,SAOzB;IAED,MAAM,yCAuCL;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,aAAa,CAAC;KAClC;CACF"}
|
|
@@ -0,0 +1,130 @@
|
|
|
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, property } from "lit/decorators.js";
|
|
9
|
+
import { resetStyles } from "../../styles/reset.js";
|
|
10
|
+
let StThemeToggle = class StThemeToggle extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.theme = "system";
|
|
14
|
+
}
|
|
15
|
+
_handleThemeChange(newTheme) {
|
|
16
|
+
this.theme = newTheme;
|
|
17
|
+
// Dispatch an event so the consuming app knows to update the document root
|
|
18
|
+
this.dispatchEvent(new CustomEvent("st-theme-change", {
|
|
19
|
+
detail: { theme: newTheme },
|
|
20
|
+
bubbles: true,
|
|
21
|
+
composed: true,
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
super.connectedCallback();
|
|
26
|
+
// Check the html tag for the theme injected by your blocking <head> script
|
|
27
|
+
const rootTheme = document.documentElement.getAttribute("data-theme");
|
|
28
|
+
if (rootTheme) {
|
|
29
|
+
this.theme = rootTheme;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
return html `
|
|
34
|
+
<button
|
|
35
|
+
aria-pressed=${this.theme === "light"}
|
|
36
|
+
title="Light Mode"
|
|
37
|
+
@click=${() => this._handleThemeChange("light")}
|
|
38
|
+
>
|
|
39
|
+
<!-- Sun Icon -->
|
|
40
|
+
<svg viewBox="0 0 24 24">
|
|
41
|
+
<circle cx="12" cy="12" r="5"></circle>
|
|
42
|
+
<path
|
|
43
|
+
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"
|
|
44
|
+
></path>
|
|
45
|
+
</svg>
|
|
46
|
+
</button>
|
|
47
|
+
|
|
48
|
+
<button
|
|
49
|
+
aria-pressed=${this.theme === "system"}
|
|
50
|
+
title="System Preference"
|
|
51
|
+
@click=${() => this._handleThemeChange("system")}
|
|
52
|
+
>
|
|
53
|
+
<!-- Monitor/System Icon -->
|
|
54
|
+
<svg viewBox="0 0 24 24">
|
|
55
|
+
<rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect>
|
|
56
|
+
<path d="M8 21h8M12 17v4"></path>
|
|
57
|
+
</svg>
|
|
58
|
+
</button>
|
|
59
|
+
|
|
60
|
+
<button
|
|
61
|
+
aria-pressed=${this.theme === "dark"}
|
|
62
|
+
title="Dark Mode"
|
|
63
|
+
@click=${() => this._handleThemeChange("dark")}
|
|
64
|
+
>
|
|
65
|
+
<!-- Moon Icon -->
|
|
66
|
+
<svg viewBox="0 0 24 24">
|
|
67
|
+
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
|
68
|
+
</svg>
|
|
69
|
+
</button>
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
StThemeToggle.styles = [
|
|
74
|
+
resetStyles,
|
|
75
|
+
css `
|
|
76
|
+
:host {
|
|
77
|
+
display: inline-flex;
|
|
78
|
+
/* Use semantic tokens for the container */
|
|
79
|
+
background-color: var(--st-color-surface);
|
|
80
|
+
border: 1px solid var(--st-color-border);
|
|
81
|
+
border-radius: 999px;
|
|
82
|
+
padding: 4px;
|
|
83
|
+
gap: 2px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
button {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
width: 28px;
|
|
91
|
+
height: 28px;
|
|
92
|
+
border-radius: 50%;
|
|
93
|
+
border: none;
|
|
94
|
+
background: transparent;
|
|
95
|
+
color: var(--st-color-text-muted);
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
transition: all 0.2s ease;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
button:hover {
|
|
101
|
+
color: var(--st-color-text);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Active State Styling */
|
|
105
|
+
button[aria-pressed="true"] {
|
|
106
|
+
/* Use the main background color so the active pill "pops" out of the surface */
|
|
107
|
+
background-color: var(--st-color-bg);
|
|
108
|
+
color: var(--st-color-primary);
|
|
109
|
+
/* Subtle shadow to lift the active pill */
|
|
110
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
svg {
|
|
114
|
+
width: 16px;
|
|
115
|
+
height: 16px;
|
|
116
|
+
fill: none;
|
|
117
|
+
stroke: currentColor;
|
|
118
|
+
stroke-width: 2;
|
|
119
|
+
stroke-linecap: round;
|
|
120
|
+
stroke-linejoin: round;
|
|
121
|
+
}
|
|
122
|
+
`,
|
|
123
|
+
];
|
|
124
|
+
__decorate([
|
|
125
|
+
property({ type: String, reflect: true })
|
|
126
|
+
], StThemeToggle.prototype, "theme", void 0);
|
|
127
|
+
StThemeToggle = __decorate([
|
|
128
|
+
customElement("st-theme-toggle")
|
|
129
|
+
], StThemeToggle);
|
|
130
|
+
export { StThemeToggle };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class StNavGroup extends LitElement {
|
|
3
|
+
label: string;
|
|
4
|
+
open: boolean;
|
|
5
|
+
depth: number;
|
|
6
|
+
static styles: import("lit").CSSResult[];
|
|
7
|
+
private _toggle;
|
|
8
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=vertical-nav-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertical-nav-group.d.ts","sourceRoot":"","sources":["../../../src/components/vertical-nav/vertical-nav-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C,qBACa,UAAW,SAAQ,UAAU;IACZ,KAAK,SAAM;IACK,IAAI,UAAS;IAC7B,KAAK,SAAK;IAEtC,MAAM,CAAC,MAAM,4BA8EX;IAEF,OAAO,CAAC,OAAO;IAIf,MAAM,yCAcL;CACF"}
|
|
@@ -0,0 +1,127 @@
|
|
|
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, property } from 'lit/decorators.js';
|
|
9
|
+
import { resetStyles } from '../../styles/reset.js';
|
|
10
|
+
let StNavGroup = class StNavGroup extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.label = '';
|
|
14
|
+
this.open = false;
|
|
15
|
+
this.depth = 0;
|
|
16
|
+
}
|
|
17
|
+
_toggle() {
|
|
18
|
+
this.open = !this.open;
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
return html `
|
|
22
|
+
<button @click=${this._toggle} aria-expanded=${this.open} style="--nav-depth: ${this.depth}">
|
|
23
|
+
<slot name="icon"></slot>
|
|
24
|
+
<span class="label">${this.label}</span>
|
|
25
|
+
<svg class="chevron" viewBox="0 0 24 24"><path d="M6 9l6 6 6-6"></path></svg>
|
|
26
|
+
</button>
|
|
27
|
+
|
|
28
|
+
<div class="drawer">
|
|
29
|
+
<div class="drawer-content">
|
|
30
|
+
<slot></slot>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
StNavGroup.styles = [
|
|
37
|
+
resetStyles,
|
|
38
|
+
css `
|
|
39
|
+
:host {
|
|
40
|
+
display: block;
|
|
41
|
+
margin-bottom: 2px;
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
button {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: var(--st-spacing-sm, 8px);
|
|
49
|
+
width: 100%;
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
background: transparent;
|
|
52
|
+
border: none;
|
|
53
|
+
padding: var(--st-spacing-sm) var(--st-spacing-xl);
|
|
54
|
+
padding-left: calc(var(--st-spacing-xl, 24px) + (var(--nav-depth, 0) * 16px));
|
|
55
|
+
color: var(--st-color-text);
|
|
56
|
+
font-size: var(--st-font-size-sm);
|
|
57
|
+
font-weight: var(--st-font-weight-semibold);
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
transition: background-color 0.2s ease, color 0.2s ease;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
button:hover {
|
|
63
|
+
background-color: var(--st-color-surface-hover, rgba(0,0,0,0.03));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Styles for slotted icons */
|
|
67
|
+
::slotted([slot="icon"]) {
|
|
68
|
+
width: 1rem;
|
|
69
|
+
height: 1rem;
|
|
70
|
+
flex-shrink: 0;
|
|
71
|
+
color: var(--st-color-text-muted);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.label {
|
|
75
|
+
flex: 1;
|
|
76
|
+
white-space: nowrap;
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
text-overflow: ellipsis;
|
|
79
|
+
text-align: left;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
svg.chevron {
|
|
83
|
+
width: 1rem;
|
|
84
|
+
height: 1rem;
|
|
85
|
+
flex-shrink: 0;
|
|
86
|
+
fill: none;
|
|
87
|
+
stroke: currentColor;
|
|
88
|
+
stroke-width: 2;
|
|
89
|
+
stroke-linecap: round;
|
|
90
|
+
stroke-linejoin: round;
|
|
91
|
+
transition: transform 0.2s ease;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:host([open]) svg.chevron {
|
|
95
|
+
transform: rotate(180deg);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.drawer {
|
|
99
|
+
display: grid;
|
|
100
|
+
grid-template-rows: 0fr;
|
|
101
|
+
transition: grid-template-rows 0.2s ease-in-out;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
:host([open]) .drawer {
|
|
105
|
+
grid-template-rows: 1fr;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.drawer-content {
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-direction: column;
|
|
112
|
+
}
|
|
113
|
+
`
|
|
114
|
+
];
|
|
115
|
+
__decorate([
|
|
116
|
+
property({ type: String })
|
|
117
|
+
], StNavGroup.prototype, "label", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
property({ type: Boolean, reflect: true })
|
|
120
|
+
], StNavGroup.prototype, "open", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
property({ type: Number })
|
|
123
|
+
], StNavGroup.prototype, "depth", void 0);
|
|
124
|
+
StNavGroup = __decorate([
|
|
125
|
+
customElement('st-vertical-nav-group')
|
|
126
|
+
], StNavGroup);
|
|
127
|
+
export { StNavGroup };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class StNavItem extends LitElement {
|
|
3
|
+
href: string;
|
|
4
|
+
active: boolean;
|
|
5
|
+
depth: number;
|
|
6
|
+
static styles: import("lit").CSSResult[];
|
|
7
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=vertical-nav-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertical-nav-item.d.ts","sourceRoot":"","sources":["../../../src/components/vertical-nav/vertical-nav-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C,qBACa,SAAU,SAAQ,UAAU;IACX,IAAI,SAAO;IACK,MAAM,UAAS;IAC/B,KAAK,SAAK;IAEtC,MAAM,CAAC,MAAM,4BA8CX;IAEF,MAAM,yCAOL;CACF"}
|
|
@@ -0,0 +1,85 @@
|
|
|
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, property } from 'lit/decorators.js';
|
|
9
|
+
import { resetStyles } from '../../styles/reset.js';
|
|
10
|
+
let StNavItem = class StNavItem extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.href = '#';
|
|
14
|
+
this.active = false;
|
|
15
|
+
this.depth = 0;
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
return html `
|
|
19
|
+
<a href=${this.href} part="link" style="--nav-depth: ${this.depth}">
|
|
20
|
+
<slot name="icon"></slot>
|
|
21
|
+
<slot></slot>
|
|
22
|
+
</a>
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
StNavItem.styles = [
|
|
27
|
+
resetStyles,
|
|
28
|
+
css `
|
|
29
|
+
:host {
|
|
30
|
+
display: block;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
a {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
gap: var(--st-spacing-sm, 8px);
|
|
38
|
+
width: 100%;
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
padding: 8px var(--st-spacing-xl);
|
|
41
|
+
padding-left: calc(var(--st-spacing-xl, 24px) + (var(--nav-depth, 0) * 16px));
|
|
42
|
+
color: var(--st-color-text-muted);
|
|
43
|
+
font-size: var(--st-font-size-sm);
|
|
44
|
+
text-decoration: none;
|
|
45
|
+
border-left: 3px solid transparent;
|
|
46
|
+
transition: all 0.15s ease;
|
|
47
|
+
|
|
48
|
+
white-space: nowrap;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
text-overflow: ellipsis;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
a:hover {
|
|
54
|
+
color: var(--st-color-text);
|
|
55
|
+
background-color: var(--st-color-surface-hover, rgba(0,0,0,0.03));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
::slotted([slot="icon"]) {
|
|
59
|
+
width: 1rem;
|
|
60
|
+
height: 1rem;
|
|
61
|
+
flex-shrink: 0;
|
|
62
|
+
color: inherit;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:host([active]) a {
|
|
66
|
+
color: var(--st-color-primary);
|
|
67
|
+
border-left-color: var(--st-color-primary);
|
|
68
|
+
font-weight: var(--st-font-weight-bold);
|
|
69
|
+
background-color: var(--st-color-primary-light, rgba(98, 0, 238, 0.05));
|
|
70
|
+
}
|
|
71
|
+
`
|
|
72
|
+
];
|
|
73
|
+
__decorate([
|
|
74
|
+
property({ type: String })
|
|
75
|
+
], StNavItem.prototype, "href", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
property({ type: Boolean, reflect: true })
|
|
78
|
+
], StNavItem.prototype, "active", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
property({ type: Number })
|
|
81
|
+
], StNavItem.prototype, "depth", void 0);
|
|
82
|
+
StNavItem = __decorate([
|
|
83
|
+
customElement('st-vertical-nav-item')
|
|
84
|
+
], StNavItem);
|
|
85
|
+
export { StNavItem };
|