@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,152 @@
|
|
|
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 StRadio = class StRadio extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.value = "";
|
|
14
|
+
this.checked = false;
|
|
15
|
+
this.disabled = false;
|
|
16
|
+
this.ariaLabel = "";
|
|
17
|
+
}
|
|
18
|
+
_handleChange(e) {
|
|
19
|
+
// Prevent the native change event from leaking out
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
if (!this.disabled) {
|
|
22
|
+
// Dispatch a custom event to tell the parent group this radio was selected
|
|
23
|
+
this.dispatchEvent(new CustomEvent("st-radio-select", {
|
|
24
|
+
detail: { value: this.value },
|
|
25
|
+
bubbles: true,
|
|
26
|
+
composed: true,
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
return html `
|
|
32
|
+
<label>
|
|
33
|
+
<input
|
|
34
|
+
type="radio"
|
|
35
|
+
aria-label=${this.ariaLabel || ""}
|
|
36
|
+
.value=${this.value}
|
|
37
|
+
.checked=${this.checked}
|
|
38
|
+
?disabled=${this.disabled}
|
|
39
|
+
@change=${this._handleChange}
|
|
40
|
+
/>
|
|
41
|
+
<span class="control"></span>
|
|
42
|
+
<span class="label"><slot></slot></span>
|
|
43
|
+
</label>
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
StRadio.styles = [
|
|
48
|
+
resetStyles,
|
|
49
|
+
css `
|
|
50
|
+
:host {
|
|
51
|
+
display: inline-block;
|
|
52
|
+
outline: none;
|
|
53
|
+
user-select: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
label {
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: var(--st-spacing-sm);
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
color: var(--st-color-text);
|
|
62
|
+
font-size: var(--st-font-size-base);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Hide the native input visually, but keep it accessible for screen readers */
|
|
66
|
+
input {
|
|
67
|
+
position: absolute;
|
|
68
|
+
width: 1px;
|
|
69
|
+
height: 1px;
|
|
70
|
+
padding: 0;
|
|
71
|
+
margin: -1px;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
clip: rect(0, 0, 0, 0);
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
border-width: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Custom Radio Circle */
|
|
79
|
+
.control {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
width: 1.25rem;
|
|
84
|
+
height: 1.25rem;
|
|
85
|
+
border: 1px solid var(--st-color-border);
|
|
86
|
+
border-radius: 50%;
|
|
87
|
+
background-color: var(--st-color-bg);
|
|
88
|
+
transition: all 0.2s ease;
|
|
89
|
+
flex-shrink: 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Inner Dot (Hidden by default) */
|
|
93
|
+
.control::after {
|
|
94
|
+
content: "";
|
|
95
|
+
width: 0.625rem;
|
|
96
|
+
height: 0.625rem;
|
|
97
|
+
border-radius: 50%;
|
|
98
|
+
background-color: var(--st-color-bg); /* Matches the dot color to background initially */
|
|
99
|
+
transition:
|
|
100
|
+
transform 0.2s ease,
|
|
101
|
+
background-color 0.2s ease;
|
|
102
|
+
transform: scale(0);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* Hover State */
|
|
106
|
+
label:hover .control {
|
|
107
|
+
border-color: var(--st-color-primary-hover);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Focus State (Driven by the hidden input) */
|
|
111
|
+
input:focus-visible + .control {
|
|
112
|
+
box-shadow:
|
|
113
|
+
0 0 0 2px var(--st-color-bg),
|
|
114
|
+
0 0 0 4px var(--st-color-primary);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Checked State */
|
|
118
|
+
:host([checked]) .control {
|
|
119
|
+
border-color: var(--st-color-primary);
|
|
120
|
+
background-color: var(--st-color-primary);
|
|
121
|
+
}
|
|
122
|
+
:host([checked]) .control::after {
|
|
123
|
+
background-color: var(--st-white); /* White dot inside the primary circle */
|
|
124
|
+
transform: scale(1);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Disabled State */
|
|
128
|
+
:host([disabled]) {
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
}
|
|
131
|
+
:host([disabled]) label {
|
|
132
|
+
opacity: 0.5;
|
|
133
|
+
cursor: not-allowed;
|
|
134
|
+
}
|
|
135
|
+
`,
|
|
136
|
+
];
|
|
137
|
+
__decorate([
|
|
138
|
+
property({ type: String })
|
|
139
|
+
], StRadio.prototype, "value", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
property({ type: Boolean, reflect: true })
|
|
142
|
+
], StRadio.prototype, "checked", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
property({ type: Boolean, reflect: true })
|
|
145
|
+
], StRadio.prototype, "disabled", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
property({ attribute: "aria-label" })
|
|
148
|
+
], StRadio.prototype, "ariaLabel", void 0);
|
|
149
|
+
StRadio = __decorate([
|
|
150
|
+
customElement("st-radio")
|
|
151
|
+
], StRadio);
|
|
152
|
+
export { StRadio };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from "lit";
|
|
2
|
+
export declare class StRadioGroup extends LitElement {
|
|
3
|
+
static formAssociated: boolean;
|
|
4
|
+
private _internals;
|
|
5
|
+
name: string;
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
helpText: string;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
invalid: boolean;
|
|
11
|
+
private _radios;
|
|
12
|
+
constructor();
|
|
13
|
+
static styles: import("lit").CSSResult[];
|
|
14
|
+
connectedCallback(): void;
|
|
15
|
+
disconnectedCallback(): void;
|
|
16
|
+
private _handleRadioSelect;
|
|
17
|
+
updated(changedProperties: PropertyValues<this>): void;
|
|
18
|
+
private _syncRadios;
|
|
19
|
+
formResetCallback(): void;
|
|
20
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
21
|
+
}
|
|
22
|
+
declare global {
|
|
23
|
+
interface HTMLElementTagNameMap {
|
|
24
|
+
"st-radio-group": StRadioGroup;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=radio-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../../src/components/radio-group/radio-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAa,cAAc,EAAC,MAAM,KAAK,CAAC;AAK1D,qBACa,YAAa,SAAQ,UAAU;IAC1C,MAAM,CAAC,cAAc,UAAQ;IAC7B,OAAO,CAAC,UAAU,CAAmB;IAEI,IAAI,SAAM;IACzB,KAAK,SAAM;IACX,KAAK,SAAM;IACD,QAAQ,SAAM;IACR,QAAQ,UAAS;IACjB,OAAO,UAAS;IAI1D,OAAO,CAAC,OAAO,CAAa;IAE5B,cAaC;IAED,MAAM,CAAC,MAAM,4BAiDX;IAEF,iBAAiB,SAIhB;IAED,oBAAoB,SAGnB;IAED,OAAO,CAAC,kBAAkB;IAMjB,OAAO,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,QAYvD;IAGD,OAAO,CAAC,WAAW;IAYnB,iBAAiB,SAIhB;IAED,MAAM,yCAYL;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,YAAY,CAAC;KAChC;CACF"}
|
|
@@ -0,0 +1,161 @@
|
|
|
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, queryAssignedElements } from "lit/decorators.js";
|
|
9
|
+
import { resetStyles } from "../../styles/reset.js";
|
|
10
|
+
let StRadioGroup = class StRadioGroup extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this.name = "";
|
|
14
|
+
this.value = "";
|
|
15
|
+
this.label = "";
|
|
16
|
+
this.helpText = "";
|
|
17
|
+
this.disabled = false;
|
|
18
|
+
this.invalid = false;
|
|
19
|
+
this._internals = this.attachInternals();
|
|
20
|
+
// 1. Trigger error state if the user clicks away and the field is invalid
|
|
21
|
+
this.addEventListener("change", () => {
|
|
22
|
+
this.invalid = !this._internals.validity.valid;
|
|
23
|
+
});
|
|
24
|
+
// 2. Trigger error state if the st-form tries to submit and fails
|
|
25
|
+
this.addEventListener("invalid", () => {
|
|
26
|
+
this.invalid = true;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
connectedCallback() {
|
|
30
|
+
super.connectedCallback();
|
|
31
|
+
// Listen for selections from child radios
|
|
32
|
+
this.addEventListener("st-radio-select", this._handleRadioSelect);
|
|
33
|
+
}
|
|
34
|
+
disconnectedCallback() {
|
|
35
|
+
super.disconnectedCallback();
|
|
36
|
+
this.removeEventListener("st-radio-select", this._handleRadioSelect);
|
|
37
|
+
}
|
|
38
|
+
_handleRadioSelect(e) {
|
|
39
|
+
if (this.disabled)
|
|
40
|
+
return;
|
|
41
|
+
this.value = e.detail.value;
|
|
42
|
+
this.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
43
|
+
}
|
|
44
|
+
updated(changedProperties) {
|
|
45
|
+
super.updated(changedProperties);
|
|
46
|
+
// When the group's value changes, sync the form and update all child radios
|
|
47
|
+
if (changedProperties.has("value")) {
|
|
48
|
+
this._internals.setFormValue(this.value);
|
|
49
|
+
this._syncRadios();
|
|
50
|
+
}
|
|
51
|
+
if (changedProperties.has("disabled")) {
|
|
52
|
+
this._syncRadios();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Loops through children and unchecks/checks them based on the group's current value
|
|
56
|
+
_syncRadios() {
|
|
57
|
+
if (!this._radios)
|
|
58
|
+
return;
|
|
59
|
+
this._radios.forEach((radio) => {
|
|
60
|
+
radio.checked = radio.value === this.value;
|
|
61
|
+
if (this.disabled) {
|
|
62
|
+
radio.disabled = true;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// Fired natively by the browser if the parent <form> is reset
|
|
67
|
+
formResetCallback() {
|
|
68
|
+
this.value = "";
|
|
69
|
+
this._internals.setFormValue("");
|
|
70
|
+
this._syncRadios();
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
return html `
|
|
74
|
+
<fieldset ?disabled=${this.disabled}>
|
|
75
|
+
${this.label ? html `<legend>${this.label}</legend>` : ""}
|
|
76
|
+
|
|
77
|
+
<div class="options">
|
|
78
|
+
<slot @slotchange=${this._syncRadios}></slot>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
${this.helpText ? html `<div class="help-text">${this.helpText}</div>` : ""}
|
|
82
|
+
</fieldset>
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
StRadioGroup.formAssociated = true;
|
|
87
|
+
StRadioGroup.styles = [
|
|
88
|
+
resetStyles,
|
|
89
|
+
css `
|
|
90
|
+
:host {
|
|
91
|
+
display: block;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
fieldset {
|
|
95
|
+
border: none;
|
|
96
|
+
padding: 0;
|
|
97
|
+
margin: 0;
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
gap: var(--st-spacing-xs);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
legend {
|
|
104
|
+
font-size: var(--st-font-size-sm);
|
|
105
|
+
font-weight: var(--st-font-weight-medium);
|
|
106
|
+
color: var(--st-color-text);
|
|
107
|
+
padding: 0;
|
|
108
|
+
margin-bottom: var(--st-spacing-xs);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.options {
|
|
112
|
+
display: flex;
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
gap: var(--st-spacing-sm);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Horizontal layout modifier */
|
|
118
|
+
:host([layout="horizontal"]) .options {
|
|
119
|
+
flex-direction: row;
|
|
120
|
+
gap: var(--st-spacing-md);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.help-text {
|
|
124
|
+
font-size: var(--st-font-size-xs);
|
|
125
|
+
color: var(--st-color-text-muted);
|
|
126
|
+
margin: 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
:host([invalid]) .help-text {
|
|
130
|
+
color: var(--st-color-error);
|
|
131
|
+
}
|
|
132
|
+
:host([invalid]) legend {
|
|
133
|
+
color: var(--st-color-error);
|
|
134
|
+
}
|
|
135
|
+
`,
|
|
136
|
+
];
|
|
137
|
+
__decorate([
|
|
138
|
+
property({ type: String, reflect: true })
|
|
139
|
+
], StRadioGroup.prototype, "name", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
property({ type: String })
|
|
142
|
+
], StRadioGroup.prototype, "value", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
property({ type: String })
|
|
145
|
+
], StRadioGroup.prototype, "label", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
property({ attribute: "help-text" })
|
|
148
|
+
], StRadioGroup.prototype, "helpText", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
property({ type: Boolean, reflect: true })
|
|
151
|
+
], StRadioGroup.prototype, "disabled", void 0);
|
|
152
|
+
__decorate([
|
|
153
|
+
property({ type: Boolean, reflect: true })
|
|
154
|
+
], StRadioGroup.prototype, "invalid", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
queryAssignedElements({ selector: "st-radio" })
|
|
157
|
+
], StRadioGroup.prototype, "_radios", void 0);
|
|
158
|
+
StRadioGroup = __decorate([
|
|
159
|
+
customElement("st-radio-group")
|
|
160
|
+
], StRadioGroup);
|
|
161
|
+
export { StRadioGroup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../src/components/router/router.ts"],"names":[],"mappings":"AAAA,cAAM,SAAS;IACb,cAoCC;IAED,OAAO,CAAC,OAAO;CAKhB;AAED,eAAO,MAAM,MAAM,WAAkB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
class AppRouter {
|
|
2
|
+
constructor() {
|
|
3
|
+
window.addEventListener('popstate', () => this._notify());
|
|
4
|
+
document.addEventListener('click', (e) => {
|
|
5
|
+
// 1. Ignore modified clicks (Ctrl+Click, etc)
|
|
6
|
+
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
// 2. Safely traverse the path
|
|
10
|
+
const path = e.composedPath();
|
|
11
|
+
const link = path.find((el) => el && typeof el.hasAttribute === 'function' && el.hasAttribute('href'));
|
|
12
|
+
if (!link)
|
|
13
|
+
return;
|
|
14
|
+
const href = link.getAttribute('href');
|
|
15
|
+
const target = link.getAttribute('target');
|
|
16
|
+
// 3. Ignore external links
|
|
17
|
+
if (!href || href.startsWith('http') || href.startsWith('mailto:') || target === '_blank') {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
// 4. Intercept internal links
|
|
21
|
+
if (href.startsWith('/')) {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
window.history.pushState(null, '', href);
|
|
24
|
+
this._notify();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
// Broadcast initial route on load
|
|
28
|
+
// Use setTimeout to ensure all Lit components have registered first
|
|
29
|
+
setTimeout(() => this._notify(), 0);
|
|
30
|
+
}
|
|
31
|
+
_notify() {
|
|
32
|
+
window.dispatchEvent(new CustomEvent('route-changed', {
|
|
33
|
+
detail: window.location.pathname
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export const router = new AppRouter();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class StSelect extends LitElement {
|
|
3
|
+
size: 'sm' | 'md' | 'lg';
|
|
4
|
+
variant: 'outline' | 'filled';
|
|
5
|
+
color: 'default' | 'primary' | 'error';
|
|
6
|
+
focused: boolean;
|
|
7
|
+
constructor();
|
|
8
|
+
static styles: import("lit").CSSResult[];
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
}
|
|
11
|
+
declare global {
|
|
12
|
+
interface HTMLElementTagNameMap {
|
|
13
|
+
'st-select': StSelect;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/components/select/select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C,qBACa,QAAS,SAAQ,UAAU;IACK,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAChC,OAAO,EAAE,SAAS,GAAG,QAAQ,CAAa;IAC1C,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAa;IAGlD,OAAO,UAAS;IAE5D,cAKC;IAED,MAAM,CAAC,MAAM,4BA2HX;IAEF,MAAM,yCASL;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
|
|
@@ -0,0 +1,172 @@
|
|
|
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 StSelect = class StSelect extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this.size = 'md';
|
|
14
|
+
this.variant = 'outline';
|
|
15
|
+
this.color = 'default';
|
|
16
|
+
// Internal state to handle the chevron animation when the slotted select is focused
|
|
17
|
+
this.focused = false;
|
|
18
|
+
// Track focus states to animate the chevron
|
|
19
|
+
this.addEventListener('focusin', () => this.focused = true);
|
|
20
|
+
this.addEventListener('focusout', () => this.focused = false);
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
return html `
|
|
24
|
+
<div class="select-wrapper">
|
|
25
|
+
<slot></slot>
|
|
26
|
+
<svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
27
|
+
<polyline points="6 9 12 15 18 9"></polyline>
|
|
28
|
+
</svg>
|
|
29
|
+
</div>
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
StSelect.styles = [
|
|
34
|
+
resetStyles,
|
|
35
|
+
css `
|
|
36
|
+
:host {
|
|
37
|
+
display: inline-block;
|
|
38
|
+
width: 100%;
|
|
39
|
+
position: relative;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.select-wrapper {
|
|
43
|
+
position: relative;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
width: 100%;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
Target the native select provided by the user in the Light DOM.
|
|
51
|
+
This completely bypasses the browser rendering bug.
|
|
52
|
+
*/
|
|
53
|
+
::slotted(select) {
|
|
54
|
+
appearance: none;
|
|
55
|
+
-webkit-appearance: none;
|
|
56
|
+
width: 100%;
|
|
57
|
+
font-family: inherit;
|
|
58
|
+
background-color: transparent;
|
|
59
|
+
border-radius: var(--st-radius-md, 0.5rem);
|
|
60
|
+
color: var(--st-color-text);
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
outline: none;
|
|
63
|
+
transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
::slotted(select:disabled) {
|
|
67
|
+
opacity: 0.6;
|
|
68
|
+
cursor: not-allowed;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* ==========================================================
|
|
72
|
+
Sizes
|
|
73
|
+
========================================================== */
|
|
74
|
+
:host([size="sm"]) ::slotted(select) {
|
|
75
|
+
padding: 0.25rem 2rem 0.25rem 0.75rem;
|
|
76
|
+
font-size: 0.875rem;
|
|
77
|
+
height: 2rem;
|
|
78
|
+
}
|
|
79
|
+
:host([size="md"]) ::slotted(select) {
|
|
80
|
+
padding: 0.5rem 2.5rem 0.5rem 1rem;
|
|
81
|
+
font-size: 1rem;
|
|
82
|
+
height: 2.5rem;
|
|
83
|
+
}
|
|
84
|
+
:host([size="lg"]) ::slotted(select) {
|
|
85
|
+
padding: 0.75rem 3rem 0.75rem 1.25rem;
|
|
86
|
+
font-size: 1.125rem;
|
|
87
|
+
height: 3rem;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Multiple select formatting (No fixed height, no right padding for chevron) */
|
|
91
|
+
::slotted(select[multiple]) {
|
|
92
|
+
height: auto !important;
|
|
93
|
+
padding-right: 1rem !important;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* ==========================================================
|
|
97
|
+
Variants & Colors
|
|
98
|
+
========================================================== */
|
|
99
|
+
:host([variant="outline"]) ::slotted(select) {
|
|
100
|
+
border: 1px solid var(--st-color-border);
|
|
101
|
+
}
|
|
102
|
+
:host([variant="outline"][color="default"]) ::slotted(select:focus-visible) {
|
|
103
|
+
border-color: var(--st-color-primary);
|
|
104
|
+
box-shadow: 0 0 0 2px rgba(var(--st-color-primary-rgb, 99, 102, 241), 0.2);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
:host([variant="filled"]) ::slotted(select) {
|
|
108
|
+
border: 1px solid transparent;
|
|
109
|
+
background-color: var(--st-color-surface-hover, rgba(0, 0, 0, 0.05));
|
|
110
|
+
}
|
|
111
|
+
:host([variant="filled"]) ::slotted(select:not(:disabled):hover) {
|
|
112
|
+
background-color: var(--st-color-surface-active, rgba(0, 0, 0, 0.1));
|
|
113
|
+
}
|
|
114
|
+
:host([variant="filled"][color="default"]) ::slotted(select:focus-visible) {
|
|
115
|
+
border-color: var(--st-color-primary);
|
|
116
|
+
background-color: transparent;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* Error Color State */
|
|
120
|
+
:host([color="error"]) ::slotted(select) {
|
|
121
|
+
border-color: var(--st-color-error, #ef4444);
|
|
122
|
+
}
|
|
123
|
+
:host([color="error"]) ::slotted(select:focus-visible) {
|
|
124
|
+
box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Primary Color State */
|
|
128
|
+
:host([color="primary"]) ::slotted(select) {
|
|
129
|
+
border-color: var(--st-color-primary);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* ==========================================================
|
|
133
|
+
Chevron Icon
|
|
134
|
+
========================================================== */
|
|
135
|
+
.chevron {
|
|
136
|
+
position: absolute;
|
|
137
|
+
right: 0.75rem;
|
|
138
|
+
width: 1.25rem;
|
|
139
|
+
height: 1.25rem;
|
|
140
|
+
pointer-events: none;
|
|
141
|
+
color: var(--st-color-text-muted);
|
|
142
|
+
transition: transform 0.2s ease, color 0.2s ease;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* Animate chevron when the wrapper detects focus */
|
|
146
|
+
:host([focused]) .chevron {
|
|
147
|
+
transform: rotate(180deg);
|
|
148
|
+
color: var(--st-color-primary);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* Hide chevron if the user slots a native multiple select */
|
|
152
|
+
::slotted(select[multiple]) ~ .chevron {
|
|
153
|
+
display: none;
|
|
154
|
+
}
|
|
155
|
+
`
|
|
156
|
+
];
|
|
157
|
+
__decorate([
|
|
158
|
+
property({ type: String, reflect: true })
|
|
159
|
+
], StSelect.prototype, "size", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
property({ type: String, reflect: true })
|
|
162
|
+
], StSelect.prototype, "variant", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
property({ type: String, reflect: true })
|
|
165
|
+
], StSelect.prototype, "color", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
property({ type: Boolean, reflect: true })
|
|
168
|
+
], StSelect.prototype, "focused", void 0);
|
|
169
|
+
StSelect = __decorate([
|
|
170
|
+
customElement('st-select')
|
|
171
|
+
], StSelect);
|
|
172
|
+
export { StSelect };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class StSkeleton extends LitElement {
|
|
3
|
+
/** Variant shape: 'text' | 'circular' | 'rectangular' */
|
|
4
|
+
variant: 'text' | 'circular' | 'rectangular';
|
|
5
|
+
/** Custom width override (e.g., '200px', '50%') */
|
|
6
|
+
width: string;
|
|
7
|
+
/** Custom height override (e.g., '40px', '1rem') */
|
|
8
|
+
height: string;
|
|
9
|
+
static styles: import("lit").CSSResult[];
|
|
10
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
'st-skeleton': StSkeleton;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=skeleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../../src/components/skeleton/skeleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C,qBACa,UAAW,SAAQ,UAAU;IACxC,yDAAyD;IAC7B,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,CAAU;IAElF,mDAAmD;IACvB,KAAK,SAAM;IAEvC,oDAAoD;IACxB,MAAM,SAAM;IAExC,MAAM,CAAC,MAAM,4BAqCX;IAEF,MAAM,yCAML;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
|
@@ -0,0 +1,78 @@
|
|
|
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 StSkeleton = class StSkeleton extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
/** Variant shape: 'text' | 'circular' | 'rectangular' */
|
|
14
|
+
this.variant = 'text';
|
|
15
|
+
/** Custom width override (e.g., '200px', '50%') */
|
|
16
|
+
this.width = '';
|
|
17
|
+
/** Custom height override (e.g., '40px', '1rem') */
|
|
18
|
+
this.height = '';
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
const style = `
|
|
22
|
+
${this.width ? `--st-skeleton-width: ${this.width};` : ''}
|
|
23
|
+
${this.height ? `--st-skeleton-height: ${this.height};` : ''}
|
|
24
|
+
`;
|
|
25
|
+
return html `<div class="skeleton" style=${style}></div>`;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
StSkeleton.styles = [
|
|
29
|
+
resetStyles,
|
|
30
|
+
css `
|
|
31
|
+
:host {
|
|
32
|
+
display: block;
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.skeleton {
|
|
37
|
+
width: var(--st-skeleton-width, 100%);
|
|
38
|
+
height: var(--st-skeleton-height, 1em);
|
|
39
|
+
background: linear-gradient(
|
|
40
|
+
90deg,
|
|
41
|
+
var(--st-color-surface-muted, #f1f5f9) 25%,
|
|
42
|
+
var(--st-color-border, #e2e8f0) 37%,
|
|
43
|
+
var(--st-color-surface-muted, #f1f5f9) 63%
|
|
44
|
+
);
|
|
45
|
+
background-size: 400% 100%;
|
|
46
|
+
animation: st-shimmer 1.4s ease infinite;
|
|
47
|
+
border-radius: var(--st-radius-sm, 0.25rem);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:host([variant="circular"]) .skeleton {
|
|
51
|
+
border-radius: 50%;
|
|
52
|
+
height: var(--st-skeleton-height, 2.5rem);
|
|
53
|
+
width: var(--st-skeleton-width, 2.5rem);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:host([variant="rectangular"]) .skeleton {
|
|
57
|
+
height: var(--st-skeleton-height, 8rem);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@keyframes st-shimmer {
|
|
61
|
+
0% { background-position: 100% 0; }
|
|
62
|
+
100% { background-position: 0 0; }
|
|
63
|
+
}
|
|
64
|
+
`
|
|
65
|
+
];
|
|
66
|
+
__decorate([
|
|
67
|
+
property({ type: String })
|
|
68
|
+
], StSkeleton.prototype, "variant", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
property({ type: String })
|
|
71
|
+
], StSkeleton.prototype, "width", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
property({ type: String })
|
|
74
|
+
], StSkeleton.prototype, "height", void 0);
|
|
75
|
+
StSkeleton = __decorate([
|
|
76
|
+
customElement('st-skeleton')
|
|
77
|
+
], StSkeleton);
|
|
78
|
+
export { StSkeleton };
|