@sondor-technology/sondor-components 1.0.0 → 1.0.1-develop.11
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 +31 -0
- package/dist/components/checkbox/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox/checkbox.js +265 -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 +14 -0
- package/dist/components/form/form-step.d.ts.map +1 -0
- package/dist/components/form/form-step.js +44 -0
- package/dist/components/form/form.d.ts +30 -0
- package/dist/components/form/form.d.ts.map +1 -0
- package/dist/components/form/form.js +456 -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 +17 -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 +35 -0
- package/dist/components/modal/modal.d.ts.map +1 -0
- package/dist/components/modal/modal.js +251 -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 +31 -0
- package/dist/components/router/router.d.ts.map +1 -0
- package/dist/components/router/router.js +97 -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 +16 -0
- package/dist/components/skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton/skeleton.js +149 -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 +15 -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 +14 -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 +266 -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 +36 -32
- package/src/components/form/form.ts +492 -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 +84 -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 +246 -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 +133 -46
- package/src/components/select/select.ts +161 -161
- package/src/components/skeleton/skeleton.ts +134 -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 +115 -96
- package/src/components/vertical-nav/vertical-nav-item.ts +72 -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,268 @@
|
|
|
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"; // Helper for optional attributes
|
|
10
|
+
import { resetStyles } from "../../styles/reset.js";
|
|
11
|
+
let StInput = class StInput extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.name = "";
|
|
15
|
+
this.label = "";
|
|
16
|
+
this.value = "";
|
|
17
|
+
this.placeholder = "";
|
|
18
|
+
this.type = "text";
|
|
19
|
+
this.helpText = "";
|
|
20
|
+
// Validation Properties
|
|
21
|
+
this.required = false;
|
|
22
|
+
this.disabled = false;
|
|
23
|
+
this.invalid = false;
|
|
24
|
+
this.readonly = false;
|
|
25
|
+
this._internals = this.attachInternals();
|
|
26
|
+
// 1. Trigger error state if the user clicks away and the field is invalid
|
|
27
|
+
this.addEventListener("focusout", () => {
|
|
28
|
+
this.invalid = !this._inputEl.validity.valid;
|
|
29
|
+
});
|
|
30
|
+
// 2. Trigger error state if the st-form tries to submit and fails
|
|
31
|
+
this.addEventListener("invalid", () => {
|
|
32
|
+
this.invalid = true;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
updated(changedProperties) {
|
|
36
|
+
super.updated(changedProperties);
|
|
37
|
+
// Sync the value to the form engine
|
|
38
|
+
if (changedProperties.has("value")) {
|
|
39
|
+
this._internals.setFormValue(this.value);
|
|
40
|
+
}
|
|
41
|
+
// Sync validity whenever properties change (like value or required status)
|
|
42
|
+
this._syncValidity();
|
|
43
|
+
}
|
|
44
|
+
_syncValidity() {
|
|
45
|
+
if (!this._inputEl)
|
|
46
|
+
return;
|
|
47
|
+
// setValidity arguments: (ValidityState object, Custom Error Message, Anchor Element for Tooltip)
|
|
48
|
+
this._internals.setValidity(this._inputEl.validity, this._inputEl.validationMessage, this._inputEl);
|
|
49
|
+
}
|
|
50
|
+
formResetCallback() {
|
|
51
|
+
this.value = "";
|
|
52
|
+
this._internals.setFormValue("");
|
|
53
|
+
// Need to wait for the render cycle to finish before checking validity on reset
|
|
54
|
+
this.updateComplete.then(() => this._syncValidity());
|
|
55
|
+
}
|
|
56
|
+
// Expose standard native methods so external scripts can call them on the component
|
|
57
|
+
checkValidity() {
|
|
58
|
+
return this._internals.checkValidity();
|
|
59
|
+
}
|
|
60
|
+
reportValidity() {
|
|
61
|
+
return this._internals.reportValidity();
|
|
62
|
+
}
|
|
63
|
+
_handleInput(e) {
|
|
64
|
+
const target = e.target;
|
|
65
|
+
this.value = target.value;
|
|
66
|
+
if (this.invalid && target.validity.valid) {
|
|
67
|
+
this.invalid = false;
|
|
68
|
+
}
|
|
69
|
+
this.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
|
|
70
|
+
}
|
|
71
|
+
_handleChange(e) {
|
|
72
|
+
this.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
return html `
|
|
76
|
+
<div class="form-control">
|
|
77
|
+
${this.label ? html `<label for="input">${this.label}</label>` : ""}
|
|
78
|
+
|
|
79
|
+
<div class="input-wrapper">
|
|
80
|
+
<slot name="prefix"></slot>
|
|
81
|
+
|
|
82
|
+
<input
|
|
83
|
+
id="input"
|
|
84
|
+
type=${this.type}
|
|
85
|
+
.name=${this.name}
|
|
86
|
+
.value=${this.value}
|
|
87
|
+
placeholder=${this.placeholder}
|
|
88
|
+
?disabled=${this.disabled}
|
|
89
|
+
?readonly=${this.readonly}
|
|
90
|
+
?required=${this.required}
|
|
91
|
+
minlength=${ifDefined(this.minlength)}
|
|
92
|
+
maxlength=${ifDefined(this.maxlength)}
|
|
93
|
+
pattern=${ifDefined(this.pattern)}
|
|
94
|
+
@input=${this._handleInput}
|
|
95
|
+
@change=${this._handleChange}
|
|
96
|
+
/>
|
|
97
|
+
|
|
98
|
+
<slot name="suffix"></slot>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
${this.helpText ? html `<div class="help-text">${this.helpText}</div>` : ""}
|
|
102
|
+
</div>
|
|
103
|
+
`;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
StInput.formAssociated = true;
|
|
107
|
+
StInput.styles = [
|
|
108
|
+
resetStyles,
|
|
109
|
+
css `
|
|
110
|
+
:host {
|
|
111
|
+
display: block;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.form-control {
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-direction: column;
|
|
117
|
+
gap: var(--st-spacing-xs);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
label {
|
|
121
|
+
font-size: var(--st-font-size-sm);
|
|
122
|
+
font-weight: var(--st-font-weight-medium);
|
|
123
|
+
color: var(--st-color-text);
|
|
124
|
+
margin-bottom: 0.5em;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* 1. The Wrapper acts as the visual input field */
|
|
128
|
+
.input-wrapper {
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
gap: var(--st-spacing-sm);
|
|
132
|
+
width: 100%;
|
|
133
|
+
|
|
134
|
+
background-color: var(--st-color-bg);
|
|
135
|
+
border: 1px solid var(--st-color-border);
|
|
136
|
+
border-radius: 4px;
|
|
137
|
+
|
|
138
|
+
/* Horizontal padding on the wrapper, vertical on the input */
|
|
139
|
+
padding: 0 var(--st-spacing-md);
|
|
140
|
+
transition:
|
|
141
|
+
border-color 0.2s ease,
|
|
142
|
+
box-shadow 0.2s ease;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* 2. Apply focus ring to the wrapper when the internal input is focused */
|
|
146
|
+
.input-wrapper:focus-within {
|
|
147
|
+
border-color: var(--st-color-primary);
|
|
148
|
+
box-shadow: 0 0 0 1px var(--st-color-primary);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* 3. The actual input becomes transparent and fills the wrapper */
|
|
152
|
+
input {
|
|
153
|
+
flex: 1;
|
|
154
|
+
width: 100%;
|
|
155
|
+
border: none;
|
|
156
|
+
background: transparent;
|
|
157
|
+
outline: none;
|
|
158
|
+
|
|
159
|
+
/* Vertical padding stretches the wrapper */
|
|
160
|
+
padding: var(--st-spacing-sm) 0;
|
|
161
|
+
font-size: var(--st-font-size-base);
|
|
162
|
+
color: var(--st-color-text);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
input::placeholder {
|
|
166
|
+
color: var(--st-color-text-muted);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* Slotted Icons */
|
|
170
|
+
::slotted(svg) {
|
|
171
|
+
width: 1.25em;
|
|
172
|
+
height: 1.25em;
|
|
173
|
+
/* Default icons to the muted text color */
|
|
174
|
+
color: var(--st-color-text-muted);
|
|
175
|
+
fill: currentColor;
|
|
176
|
+
flex-shrink: 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* Interactive Slotted Elements (like clear buttons) */
|
|
180
|
+
::slotted(st-button) {
|
|
181
|
+
/* Pull the button back slightly so it aligns nicely with the input padding */
|
|
182
|
+
margin-right: calc(var(--st-spacing-sm) * -1);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* Invalid State */
|
|
186
|
+
:host([invalid]) .input-wrapper {
|
|
187
|
+
border-color: var(--st-color-error);
|
|
188
|
+
}
|
|
189
|
+
:host([invalid]) .input-wrapper:focus-within {
|
|
190
|
+
box-shadow: 0 0 0 1px var(--st-color-error);
|
|
191
|
+
}
|
|
192
|
+
:host([invalid]) .help-text {
|
|
193
|
+
color: var(--st-color-error);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Disabled & Readonly States */
|
|
197
|
+
:host([disabled]) .input-wrapper {
|
|
198
|
+
opacity: 0.5;
|
|
199
|
+
cursor: not-allowed;
|
|
200
|
+
background-color: var(--st-color-surface);
|
|
201
|
+
}
|
|
202
|
+
:host([disabled]) input {
|
|
203
|
+
cursor: not-allowed;
|
|
204
|
+
}
|
|
205
|
+
:host([readonly]) .input-wrapper {
|
|
206
|
+
background-color: var(--st-color-surface);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.help-text {
|
|
210
|
+
font-size: var(--st-font-size-xs);
|
|
211
|
+
color: var(--st-color-text-muted);
|
|
212
|
+
margin: 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
:host([invalid]) .input-wrapper {
|
|
216
|
+
border-color: var(--st-color-error);
|
|
217
|
+
}
|
|
218
|
+
:host([invalid]) .help-text {
|
|
219
|
+
color: var(--st-color-error);
|
|
220
|
+
}
|
|
221
|
+
`,
|
|
222
|
+
];
|
|
223
|
+
__decorate([
|
|
224
|
+
query("input")
|
|
225
|
+
], StInput.prototype, "_inputEl", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
property({ type: String, reflect: true })
|
|
228
|
+
], StInput.prototype, "name", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
property({ type: String })
|
|
231
|
+
], StInput.prototype, "label", void 0);
|
|
232
|
+
__decorate([
|
|
233
|
+
property({ type: String })
|
|
234
|
+
], StInput.prototype, "value", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
property({ type: String })
|
|
237
|
+
], StInput.prototype, "placeholder", void 0);
|
|
238
|
+
__decorate([
|
|
239
|
+
property({ type: String })
|
|
240
|
+
], StInput.prototype, "type", void 0);
|
|
241
|
+
__decorate([
|
|
242
|
+
property({ attribute: "help-text" })
|
|
243
|
+
], StInput.prototype, "helpText", void 0);
|
|
244
|
+
__decorate([
|
|
245
|
+
property({ type: Boolean, reflect: true })
|
|
246
|
+
], StInput.prototype, "required", void 0);
|
|
247
|
+
__decorate([
|
|
248
|
+
property({ type: Number })
|
|
249
|
+
], StInput.prototype, "minlength", void 0);
|
|
250
|
+
__decorate([
|
|
251
|
+
property({ type: Number })
|
|
252
|
+
], StInput.prototype, "maxlength", void 0);
|
|
253
|
+
__decorate([
|
|
254
|
+
property({ type: String })
|
|
255
|
+
], StInput.prototype, "pattern", void 0);
|
|
256
|
+
__decorate([
|
|
257
|
+
property({ type: Boolean, reflect: true })
|
|
258
|
+
], StInput.prototype, "disabled", void 0);
|
|
259
|
+
__decorate([
|
|
260
|
+
property({ type: Boolean, reflect: true })
|
|
261
|
+
], StInput.prototype, "invalid", void 0);
|
|
262
|
+
__decorate([
|
|
263
|
+
property({ type: Boolean, reflect: true })
|
|
264
|
+
], StInput.prototype, "readonly", void 0);
|
|
265
|
+
StInput = __decorate([
|
|
266
|
+
customElement("st-input")
|
|
267
|
+
], StInput);
|
|
268
|
+
export { StInput };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class StLink extends LitElement {
|
|
3
|
+
href: string;
|
|
4
|
+
target: '_blank' | '_self';
|
|
5
|
+
size: 'sm' | 'md' | 'lg';
|
|
6
|
+
variant: 'inline' | 'standalone';
|
|
7
|
+
color: 'default' | 'primary' | 'muted';
|
|
8
|
+
static styles: import("lit").CSSResult[];
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
}
|
|
11
|
+
declare global {
|
|
12
|
+
interface HTMLElementTagNameMap {
|
|
13
|
+
'st-link': StLink;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/components/link/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C,qBACa,MAAO,SAAQ,UAAU;IACR,IAAI,SAAO;IACX,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAW;IACtB,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAChC,OAAO,EAAE,QAAQ,GAAG,YAAY,CAAY;IAC5C,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAa;IAE9F,MAAM,CAAC,MAAM,4BAsEX;IAEF,MAAM,yCAML;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
|
|
@@ -0,0 +1,116 @@
|
|
|
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 StLink = class StLink extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.href = '#';
|
|
14
|
+
this.target = '_self';
|
|
15
|
+
this.size = 'md';
|
|
16
|
+
this.variant = 'inline';
|
|
17
|
+
this.color = 'primary';
|
|
18
|
+
}
|
|
19
|
+
render() {
|
|
20
|
+
return html `
|
|
21
|
+
<a href="${this.href}" target="${this.target}">
|
|
22
|
+
<slot></slot>
|
|
23
|
+
</a>
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
StLink.styles = [
|
|
28
|
+
resetStyles,
|
|
29
|
+
css `
|
|
30
|
+
:host {
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
a {
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
gap: 0.25em;
|
|
39
|
+
text-decoration: none;
|
|
40
|
+
font-weight: 500;
|
|
41
|
+
transition: color 0.2s ease, opacity 0.2s ease;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* ==========================================================
|
|
45
|
+
Colors
|
|
46
|
+
========================================================== */
|
|
47
|
+
:host([color="primary"]) a {
|
|
48
|
+
color: var(--st-color-primary);
|
|
49
|
+
}
|
|
50
|
+
:host([color="default"]) a {
|
|
51
|
+
color: var(--st-color-text);
|
|
52
|
+
}
|
|
53
|
+
:host([color="muted"]) a {
|
|
54
|
+
color: var(--st-color-text-muted);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Hover states */
|
|
58
|
+
:host([color="primary"]) a:hover {
|
|
59
|
+
filter: brightness(1.1);
|
|
60
|
+
}
|
|
61
|
+
:host([color="default"]) a:hover {
|
|
62
|
+
color: var(--st-color-primary);
|
|
63
|
+
}
|
|
64
|
+
:host([color="muted"]) a:hover {
|
|
65
|
+
color: var(--st-color-text);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* ==========================================================
|
|
69
|
+
Sizes
|
|
70
|
+
========================================================== */
|
|
71
|
+
:host([size="sm"]) a { font-size: 0.875rem; }
|
|
72
|
+
:host([size="md"]) a { font-size: 1rem; }
|
|
73
|
+
:host([size="lg"]) a { font-size: 1.125rem; }
|
|
74
|
+
|
|
75
|
+
/* ==========================================================
|
|
76
|
+
Variants
|
|
77
|
+
========================================================== */
|
|
78
|
+
/* inline links live inside paragraphs and underline on hover */
|
|
79
|
+
:host([variant="inline"]) a {
|
|
80
|
+
text-decoration: underline;
|
|
81
|
+
text-underline-offset: 4px;
|
|
82
|
+
font-weight: inherit; /* Inherits from surrounding paragraph text */
|
|
83
|
+
}
|
|
84
|
+
:host([variant="inline"]) a:hover {
|
|
85
|
+
text-decoration-thickness: 2px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* standalone links (e.g., footers, sidebars) have no underline by default */
|
|
89
|
+
:host([variant="standalone"]) a {
|
|
90
|
+
text-decoration: none;
|
|
91
|
+
}
|
|
92
|
+
:host([variant="standalone"]) a:hover {
|
|
93
|
+
text-decoration: underline;
|
|
94
|
+
text-underline-offset: 4px;
|
|
95
|
+
}
|
|
96
|
+
`
|
|
97
|
+
];
|
|
98
|
+
__decorate([
|
|
99
|
+
property({ type: String })
|
|
100
|
+
], StLink.prototype, "href", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
property({ type: String })
|
|
103
|
+
], StLink.prototype, "target", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
property({ type: String, reflect: true })
|
|
106
|
+
], StLink.prototype, "size", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
property({ type: String, reflect: true })
|
|
109
|
+
], StLink.prototype, "variant", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
property({ type: String, reflect: true })
|
|
112
|
+
], StLink.prototype, "color", void 0);
|
|
113
|
+
StLink = __decorate([
|
|
114
|
+
customElement('st-link')
|
|
115
|
+
], StLink);
|
|
116
|
+
export { StLink };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class StMetadata extends LitElement {
|
|
3
|
+
pageTitle: string;
|
|
4
|
+
description: string;
|
|
5
|
+
image: string;
|
|
6
|
+
protected createRenderRoot(): this;
|
|
7
|
+
updated(): void;
|
|
8
|
+
private _updateMetadata;
|
|
9
|
+
private _setMeta;
|
|
10
|
+
private _setCanonical;
|
|
11
|
+
render(): symbol;
|
|
12
|
+
}
|
|
13
|
+
declare global {
|
|
14
|
+
interface HTMLElementTagNameMap {
|
|
15
|
+
'st-metadata': StMetadata;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/components/metadata/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAW,MAAM,KAAK,CAAC;AAG1C,qBACa,UAAW,SAAQ,UAAU;IACZ,SAAS,SAAM;IACf,WAAW,SAAM;IACjB,KAAK,SAAM;IAEvC,SAAS,CAAC,gBAAgB,SAAmB;IAE7C,OAAO,SAEN;IAED,OAAO,CAAC,eAAe;IAsBvB,OAAO,CAAC,QAAQ;IAUhB,OAAO,CAAC,aAAa;IAUrB,MAAM,WAEL;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
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, nothing } from 'lit';
|
|
8
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
9
|
+
let StMetadata = class StMetadata extends LitElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.pageTitle = '';
|
|
13
|
+
this.description = '';
|
|
14
|
+
this.image = '';
|
|
15
|
+
}
|
|
16
|
+
createRenderRoot() { return this; }
|
|
17
|
+
updated() {
|
|
18
|
+
this._updateMetadata();
|
|
19
|
+
}
|
|
20
|
+
_updateMetadata() {
|
|
21
|
+
// Read site name from environment variable (e.g., VITE_SITE_NAME)
|
|
22
|
+
const siteName = import.meta.env?.VITE_SITE_NAME || '';
|
|
23
|
+
if (this.pageTitle) {
|
|
24
|
+
// If site name is configured, append it; otherwise use the title standalone
|
|
25
|
+
document.title = siteName ? `${this.pageTitle} - ${siteName}` : this.pageTitle;
|
|
26
|
+
this._setMeta('property', 'og:title', this.pageTitle);
|
|
27
|
+
}
|
|
28
|
+
if (this.description) {
|
|
29
|
+
this._setMeta('name', 'description', this.description);
|
|
30
|
+
this._setMeta('property', 'og:description', this.description);
|
|
31
|
+
}
|
|
32
|
+
if (this.image) {
|
|
33
|
+
this._setMeta('property', 'og:image', this.image);
|
|
34
|
+
}
|
|
35
|
+
this._setCanonical(window.location.href);
|
|
36
|
+
}
|
|
37
|
+
_setMeta(attrName, attrValue, content) {
|
|
38
|
+
let meta = document.head.querySelector(`meta[${attrName}="${attrValue}"]`);
|
|
39
|
+
if (!meta) {
|
|
40
|
+
meta = document.createElement('meta');
|
|
41
|
+
meta.setAttribute(attrName, attrValue);
|
|
42
|
+
document.head.appendChild(meta);
|
|
43
|
+
}
|
|
44
|
+
meta.setAttribute('content', content);
|
|
45
|
+
}
|
|
46
|
+
_setCanonical(url) {
|
|
47
|
+
let link = document.head.querySelector('link[rel="canonical"]');
|
|
48
|
+
if (!link) {
|
|
49
|
+
link = document.createElement('link');
|
|
50
|
+
link.setAttribute('rel', 'canonical');
|
|
51
|
+
document.head.appendChild(link);
|
|
52
|
+
}
|
|
53
|
+
link.setAttribute('href', url);
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
return nothing;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
__decorate([
|
|
60
|
+
property({ type: String })
|
|
61
|
+
], StMetadata.prototype, "pageTitle", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
property({ type: String })
|
|
64
|
+
], StMetadata.prototype, "description", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
property({ type: String })
|
|
67
|
+
], StMetadata.prototype, "image", void 0);
|
|
68
|
+
StMetadata = __decorate([
|
|
69
|
+
customElement('st-metadata')
|
|
70
|
+
], StMetadata);
|
|
71
|
+
export { StMetadata };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
export declare class StModal extends LitElement {
|
|
3
|
+
/**
|
|
4
|
+
* Controls whether the modal is open.
|
|
5
|
+
*/
|
|
6
|
+
open: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Title text displayed in the modal header.
|
|
9
|
+
*/
|
|
10
|
+
heading: string;
|
|
11
|
+
/**
|
|
12
|
+
* Size of the modal (sm, md, lg, xl, xxl).
|
|
13
|
+
*/
|
|
14
|
+
size: 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
15
|
+
/**
|
|
16
|
+
* If true, the modal cannot be closed by clicking the backdrop or pressing Esc.
|
|
17
|
+
*/
|
|
18
|
+
static: boolean;
|
|
19
|
+
private dialogEl;
|
|
20
|
+
private isClosing;
|
|
21
|
+
static styles: import("lit").CSSResult[];
|
|
22
|
+
updated(changedProperties: PropertyValues): void;
|
|
23
|
+
private closeWithAnimation;
|
|
24
|
+
private handleClose;
|
|
25
|
+
private handleCancel;
|
|
26
|
+
private onDialogClose;
|
|
27
|
+
private handleBackdropClick;
|
|
28
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
29
|
+
}
|
|
30
|
+
declare global {
|
|
31
|
+
interface HTMLElementTagNameMap {
|
|
32
|
+
'st-modal': StModal;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/modal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,cAAc,EAAW,MAAM,KAAK,CAAC;AAIrE,qBACa,OAAQ,SAAQ,UAAU;IACrC;;OAEG;IACyC,IAAI,UAAS;IAEzD;;OAEG;IACyB,OAAO,SAAM;IAEzC;;OAEG;IACyB,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAQ;IAE3E;;OAEG;IAC0B,MAAM,UAAS;IAE3B,OAAO,CAAC,QAAQ,CAAqB;IAEtD,OAAO,CAAC,SAAS,CAAS;IAE1B,MAAM,CAAC,MAAM,4BAkHX;IAEF,OAAO,CAAC,iBAAiB,EAAE,cAAc,QAYxC;IAED,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,mBAAmB;IAe3B,MAAM,yCA4BL;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
|