@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
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
class AppRouter {
|
|
2
|
-
constructor() {
|
|
3
|
-
window.addEventListener('popstate', () => this._notify());
|
|
4
|
-
|
|
5
|
-
document.addEventListener('click', (e) => {
|
|
6
|
-
// 1. Ignore modified clicks (Ctrl+Click, etc)
|
|
7
|
-
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// 2. Safely traverse the path
|
|
12
|
-
const path = e.composedPath();
|
|
13
|
-
const link = path.find((el: any) =>
|
|
14
|
-
el && typeof el.hasAttribute === 'function' && el.hasAttribute('href')
|
|
15
|
-
) as HTMLElement | undefined;
|
|
16
|
-
|
|
17
|
-
if (!link) return;
|
|
18
|
-
|
|
19
|
-
const href = link.getAttribute('href');
|
|
20
|
-
const target = link.getAttribute('target');
|
|
21
|
-
|
|
22
|
-
// 3. Ignore external links
|
|
23
|
-
if (!href || href.startsWith('http') || href.startsWith('mailto:') || target === '_blank') {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// 4. Intercept internal links
|
|
28
|
-
if (href.startsWith('/')) {
|
|
29
|
-
e.preventDefault();
|
|
30
|
-
window.history.pushState(null, '', href);
|
|
31
|
-
this._notify();
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// Broadcast initial route on load
|
|
36
|
-
// Use setTimeout to ensure all Lit components have registered first
|
|
37
|
-
setTimeout(() => this._notify(), 0);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
private _notify() {
|
|
41
|
-
window.dispatchEvent(new CustomEvent('route-changed', {
|
|
42
|
-
detail: window.location.pathname
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
1
|
+
class AppRouter {
|
|
2
|
+
constructor() {
|
|
3
|
+
window.addEventListener('popstate', () => this._notify());
|
|
4
|
+
|
|
5
|
+
document.addEventListener('click', (e) => {
|
|
6
|
+
// 1. Ignore modified clicks (Ctrl+Click, etc)
|
|
7
|
+
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// 2. Safely traverse the path
|
|
12
|
+
const path = e.composedPath();
|
|
13
|
+
const link = path.find((el: any) =>
|
|
14
|
+
el && typeof el.hasAttribute === 'function' && el.hasAttribute('href')
|
|
15
|
+
) as HTMLElement | undefined;
|
|
16
|
+
|
|
17
|
+
if (!link) return;
|
|
18
|
+
|
|
19
|
+
const href = link.getAttribute('href');
|
|
20
|
+
const target = link.getAttribute('target');
|
|
21
|
+
|
|
22
|
+
// 3. Ignore external links
|
|
23
|
+
if (!href || href.startsWith('http') || href.startsWith('mailto:') || target === '_blank') {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 4. Intercept internal links
|
|
28
|
+
if (href.startsWith('/')) {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
window.history.pushState(null, '', href);
|
|
31
|
+
this._notify();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Broadcast initial route on load
|
|
36
|
+
// Use setTimeout to ensure all Lit components have registered first
|
|
37
|
+
setTimeout(() => this._notify(), 0);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
private _notify() {
|
|
41
|
+
window.dispatchEvent(new CustomEvent('route-changed', {
|
|
42
|
+
detail: window.location.pathname
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
47
|
export const router = new AppRouter();
|
|
@@ -1,162 +1,162 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit';
|
|
2
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
-
import { resetStyles } from '../../styles/reset';
|
|
4
|
-
|
|
5
|
-
@customElement('st-select')
|
|
6
|
-
export class StSelect extends LitElement {
|
|
7
|
-
@property({ type: String, reflect: true }) size: 'sm' | 'md' | 'lg' = 'md';
|
|
8
|
-
@property({ type: String, reflect: true }) variant: 'outline' | 'filled' = 'outline';
|
|
9
|
-
@property({ type: String, reflect: true }) color: 'default' | 'primary' | 'error' = 'default';
|
|
10
|
-
|
|
11
|
-
// Internal state to handle the chevron animation when the slotted select is focused
|
|
12
|
-
@property({ type: Boolean, reflect: true }) focused = false;
|
|
13
|
-
|
|
14
|
-
constructor() {
|
|
15
|
-
super();
|
|
16
|
-
// Track focus states to animate the chevron
|
|
17
|
-
this.addEventListener('focusin', () => this.focused = true);
|
|
18
|
-
this.addEventListener('focusout', () => this.focused = false);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
static styles = [
|
|
22
|
-
resetStyles,
|
|
23
|
-
css`
|
|
24
|
-
:host {
|
|
25
|
-
display: inline-block;
|
|
26
|
-
width: 100%;
|
|
27
|
-
position: relative;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.select-wrapper {
|
|
31
|
-
position: relative;
|
|
32
|
-
display: flex;
|
|
33
|
-
align-items: center;
|
|
34
|
-
width: 100%;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/*
|
|
38
|
-
Target the native select provided by the user in the Light DOM.
|
|
39
|
-
This completely bypasses the browser rendering bug.
|
|
40
|
-
*/
|
|
41
|
-
::slotted(select) {
|
|
42
|
-
appearance: none;
|
|
43
|
-
-webkit-appearance: none;
|
|
44
|
-
width: 100%;
|
|
45
|
-
font-family: inherit;
|
|
46
|
-
background-color: transparent;
|
|
47
|
-
border-radius: var(--st-radius-md, 0.5rem);
|
|
48
|
-
color: var(--st-color-text);
|
|
49
|
-
cursor: pointer;
|
|
50
|
-
outline: none;
|
|
51
|
-
transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
::slotted(select:disabled) {
|
|
55
|
-
opacity: 0.6;
|
|
56
|
-
cursor: not-allowed;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/* ==========================================================
|
|
60
|
-
Sizes
|
|
61
|
-
========================================================== */
|
|
62
|
-
:host([size="sm"]) ::slotted(select) {
|
|
63
|
-
padding: 0.25rem 2rem 0.25rem 0.75rem;
|
|
64
|
-
font-size: 0.875rem;
|
|
65
|
-
height: 2rem;
|
|
66
|
-
}
|
|
67
|
-
:host([size="md"]) ::slotted(select) {
|
|
68
|
-
padding: 0.5rem 2.5rem 0.5rem 1rem;
|
|
69
|
-
font-size: 1rem;
|
|
70
|
-
height: 2.5rem;
|
|
71
|
-
}
|
|
72
|
-
:host([size="lg"]) ::slotted(select) {
|
|
73
|
-
padding: 0.75rem 3rem 0.75rem 1.25rem;
|
|
74
|
-
font-size: 1.125rem;
|
|
75
|
-
height: 3rem;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/* Multiple select formatting (No fixed height, no right padding for chevron) */
|
|
79
|
-
::slotted(select[multiple]) {
|
|
80
|
-
height: auto !important;
|
|
81
|
-
padding-right: 1rem !important;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/* ==========================================================
|
|
85
|
-
Variants & Colors
|
|
86
|
-
========================================================== */
|
|
87
|
-
:host([variant="outline"]) ::slotted(select) {
|
|
88
|
-
border: 1px solid var(--st-color-border);
|
|
89
|
-
}
|
|
90
|
-
:host([variant="outline"][color="default"]) ::slotted(select:focus-visible) {
|
|
91
|
-
border-color: var(--st-color-primary);
|
|
92
|
-
box-shadow: 0 0 0 2px rgba(var(--st-color-primary-rgb, 99, 102, 241), 0.2);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
:host([variant="filled"]) ::slotted(select) {
|
|
96
|
-
border: 1px solid transparent;
|
|
97
|
-
background-color: var(--st-color-surface-hover, rgba(0, 0, 0, 0.05));
|
|
98
|
-
}
|
|
99
|
-
:host([variant="filled"]) ::slotted(select:not(:disabled):hover) {
|
|
100
|
-
background-color: var(--st-color-surface-active, rgba(0, 0, 0, 0.1));
|
|
101
|
-
}
|
|
102
|
-
:host([variant="filled"][color="default"]) ::slotted(select:focus-visible) {
|
|
103
|
-
border-color: var(--st-color-primary);
|
|
104
|
-
background-color: transparent;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/* Error Color State */
|
|
108
|
-
:host([color="error"]) ::slotted(select) {
|
|
109
|
-
border-color: var(--st-color-error, #ef4444);
|
|
110
|
-
}
|
|
111
|
-
:host([color="error"]) ::slotted(select:focus-visible) {
|
|
112
|
-
box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/* Primary Color State */
|
|
116
|
-
:host([color="primary"]) ::slotted(select) {
|
|
117
|
-
border-color: var(--st-color-primary);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/* ==========================================================
|
|
121
|
-
Chevron Icon
|
|
122
|
-
========================================================== */
|
|
123
|
-
.chevron {
|
|
124
|
-
position: absolute;
|
|
125
|
-
right: 0.75rem;
|
|
126
|
-
width: 1.25rem;
|
|
127
|
-
height: 1.25rem;
|
|
128
|
-
pointer-events: none;
|
|
129
|
-
color: var(--st-color-text-muted);
|
|
130
|
-
transition: transform 0.2s ease, color 0.2s ease;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/* Animate chevron when the wrapper detects focus */
|
|
134
|
-
:host([focused]) .chevron {
|
|
135
|
-
transform: rotate(180deg);
|
|
136
|
-
color: var(--st-color-primary);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/* Hide chevron if the user slots a native multiple select */
|
|
140
|
-
::slotted(select[multiple]) ~ .chevron {
|
|
141
|
-
display: none;
|
|
142
|
-
}
|
|
143
|
-
`
|
|
144
|
-
];
|
|
145
|
-
|
|
146
|
-
render() {
|
|
147
|
-
return html`
|
|
148
|
-
<div class="select-wrapper">
|
|
149
|
-
<slot></slot>
|
|
150
|
-
<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">
|
|
151
|
-
<polyline points="6 9 12 15 18 9"></polyline>
|
|
152
|
-
</svg>
|
|
153
|
-
</div>
|
|
154
|
-
`;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
declare global {
|
|
159
|
-
interface HTMLElementTagNameMap {
|
|
160
|
-
'st-select': StSelect;
|
|
161
|
-
}
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
+
|
|
5
|
+
@customElement('st-select')
|
|
6
|
+
export class StSelect extends LitElement {
|
|
7
|
+
@property({ type: String, reflect: true }) size: 'sm' | 'md' | 'lg' = 'md';
|
|
8
|
+
@property({ type: String, reflect: true }) variant: 'outline' | 'filled' = 'outline';
|
|
9
|
+
@property({ type: String, reflect: true }) color: 'default' | 'primary' | 'error' = 'default';
|
|
10
|
+
|
|
11
|
+
// Internal state to handle the chevron animation when the slotted select is focused
|
|
12
|
+
@property({ type: Boolean, reflect: true }) focused = false;
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
// Track focus states to animate the chevron
|
|
17
|
+
this.addEventListener('focusin', () => this.focused = true);
|
|
18
|
+
this.addEventListener('focusout', () => this.focused = false);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static styles = [
|
|
22
|
+
resetStyles,
|
|
23
|
+
css`
|
|
24
|
+
:host {
|
|
25
|
+
display: inline-block;
|
|
26
|
+
width: 100%;
|
|
27
|
+
position: relative;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.select-wrapper {
|
|
31
|
+
position: relative;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
Target the native select provided by the user in the Light DOM.
|
|
39
|
+
This completely bypasses the browser rendering bug.
|
|
40
|
+
*/
|
|
41
|
+
::slotted(select) {
|
|
42
|
+
appearance: none;
|
|
43
|
+
-webkit-appearance: none;
|
|
44
|
+
width: 100%;
|
|
45
|
+
font-family: inherit;
|
|
46
|
+
background-color: transparent;
|
|
47
|
+
border-radius: var(--st-radius-md, 0.5rem);
|
|
48
|
+
color: var(--st-color-text);
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
outline: none;
|
|
51
|
+
transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
::slotted(select:disabled) {
|
|
55
|
+
opacity: 0.6;
|
|
56
|
+
cursor: not-allowed;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* ==========================================================
|
|
60
|
+
Sizes
|
|
61
|
+
========================================================== */
|
|
62
|
+
:host([size="sm"]) ::slotted(select) {
|
|
63
|
+
padding: 0.25rem 2rem 0.25rem 0.75rem;
|
|
64
|
+
font-size: 0.875rem;
|
|
65
|
+
height: 2rem;
|
|
66
|
+
}
|
|
67
|
+
:host([size="md"]) ::slotted(select) {
|
|
68
|
+
padding: 0.5rem 2.5rem 0.5rem 1rem;
|
|
69
|
+
font-size: 1rem;
|
|
70
|
+
height: 2.5rem;
|
|
71
|
+
}
|
|
72
|
+
:host([size="lg"]) ::slotted(select) {
|
|
73
|
+
padding: 0.75rem 3rem 0.75rem 1.25rem;
|
|
74
|
+
font-size: 1.125rem;
|
|
75
|
+
height: 3rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Multiple select formatting (No fixed height, no right padding for chevron) */
|
|
79
|
+
::slotted(select[multiple]) {
|
|
80
|
+
height: auto !important;
|
|
81
|
+
padding-right: 1rem !important;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* ==========================================================
|
|
85
|
+
Variants & Colors
|
|
86
|
+
========================================================== */
|
|
87
|
+
:host([variant="outline"]) ::slotted(select) {
|
|
88
|
+
border: 1px solid var(--st-color-border);
|
|
89
|
+
}
|
|
90
|
+
:host([variant="outline"][color="default"]) ::slotted(select:focus-visible) {
|
|
91
|
+
border-color: var(--st-color-primary);
|
|
92
|
+
box-shadow: 0 0 0 2px rgba(var(--st-color-primary-rgb, 99, 102, 241), 0.2);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:host([variant="filled"]) ::slotted(select) {
|
|
96
|
+
border: 1px solid transparent;
|
|
97
|
+
background-color: var(--st-color-surface-hover, rgba(0, 0, 0, 0.05));
|
|
98
|
+
}
|
|
99
|
+
:host([variant="filled"]) ::slotted(select:not(:disabled):hover) {
|
|
100
|
+
background-color: var(--st-color-surface-active, rgba(0, 0, 0, 0.1));
|
|
101
|
+
}
|
|
102
|
+
:host([variant="filled"][color="default"]) ::slotted(select:focus-visible) {
|
|
103
|
+
border-color: var(--st-color-primary);
|
|
104
|
+
background-color: transparent;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Error Color State */
|
|
108
|
+
:host([color="error"]) ::slotted(select) {
|
|
109
|
+
border-color: var(--st-color-error, #ef4444);
|
|
110
|
+
}
|
|
111
|
+
:host([color="error"]) ::slotted(select:focus-visible) {
|
|
112
|
+
box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Primary Color State */
|
|
116
|
+
:host([color="primary"]) ::slotted(select) {
|
|
117
|
+
border-color: var(--st-color-primary);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* ==========================================================
|
|
121
|
+
Chevron Icon
|
|
122
|
+
========================================================== */
|
|
123
|
+
.chevron {
|
|
124
|
+
position: absolute;
|
|
125
|
+
right: 0.75rem;
|
|
126
|
+
width: 1.25rem;
|
|
127
|
+
height: 1.25rem;
|
|
128
|
+
pointer-events: none;
|
|
129
|
+
color: var(--st-color-text-muted);
|
|
130
|
+
transition: transform 0.2s ease, color 0.2s ease;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Animate chevron when the wrapper detects focus */
|
|
134
|
+
:host([focused]) .chevron {
|
|
135
|
+
transform: rotate(180deg);
|
|
136
|
+
color: var(--st-color-primary);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Hide chevron if the user slots a native multiple select */
|
|
140
|
+
::slotted(select[multiple]) ~ .chevron {
|
|
141
|
+
display: none;
|
|
142
|
+
}
|
|
143
|
+
`
|
|
144
|
+
];
|
|
145
|
+
|
|
146
|
+
render() {
|
|
147
|
+
return html`
|
|
148
|
+
<div class="select-wrapper">
|
|
149
|
+
<slot></slot>
|
|
150
|
+
<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">
|
|
151
|
+
<polyline points="6 9 12 15 18 9"></polyline>
|
|
152
|
+
</svg>
|
|
153
|
+
</div>
|
|
154
|
+
`;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
declare global {
|
|
159
|
+
interface HTMLElementTagNameMap {
|
|
160
|
+
'st-select': StSelect;
|
|
161
|
+
}
|
|
162
162
|
}
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit';
|
|
2
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
-
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
-
|
|
5
|
-
@customElement('st-skeleton')
|
|
6
|
-
export class StSkeleton extends LitElement {
|
|
7
|
-
/** Variant shape: 'text' | 'circular' | 'rectangular' */
|
|
8
|
-
@property({ type: String }) variant: 'text' | 'circular' | 'rectangular' = 'text';
|
|
9
|
-
|
|
10
|
-
/** Custom width override (e.g., '200px', '50%') */
|
|
11
|
-
@property({ type: String }) width = '';
|
|
12
|
-
|
|
13
|
-
/** Custom height override (e.g., '40px', '1rem') */
|
|
14
|
-
@property({ type: String }) height = '';
|
|
15
|
-
|
|
16
|
-
static styles = [
|
|
17
|
-
resetStyles,
|
|
18
|
-
css`
|
|
19
|
-
:host {
|
|
20
|
-
display: block;
|
|
21
|
-
width: 100%;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.skeleton {
|
|
25
|
-
width: var(--st-skeleton-width, 100%);
|
|
26
|
-
height: var(--st-skeleton-height, 1em);
|
|
27
|
-
background: linear-gradient(
|
|
28
|
-
90deg,
|
|
29
|
-
var(--st-color-surface-muted, #f1f5f9) 25%,
|
|
30
|
-
var(--st-color-border, #e2e8f0) 37%,
|
|
31
|
-
var(--st-color-surface-muted, #f1f5f9) 63%
|
|
32
|
-
);
|
|
33
|
-
background-size: 400% 100%;
|
|
34
|
-
animation: st-shimmer 1.4s ease infinite;
|
|
35
|
-
border-radius: var(--st-radius-sm, 0.25rem);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
:host([variant="circular"]) .skeleton {
|
|
39
|
-
border-radius: 50%;
|
|
40
|
-
height: var(--st-skeleton-height, 2.5rem);
|
|
41
|
-
width: var(--st-skeleton-width, 2.5rem);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
:host([variant="rectangular"]) .skeleton {
|
|
45
|
-
height: var(--st-skeleton-height, 8rem);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@keyframes st-shimmer {
|
|
49
|
-
0% { background-position: 100% 0; }
|
|
50
|
-
100% { background-position: 0 0; }
|
|
51
|
-
}
|
|
52
|
-
`
|
|
53
|
-
];
|
|
54
|
-
|
|
55
|
-
render() {
|
|
56
|
-
const style = `
|
|
57
|
-
${this.width ? `--st-skeleton-width: ${this.width};` : ''}
|
|
58
|
-
${this.height ? `--st-skeleton-height: ${this.height};` : ''}
|
|
59
|
-
`;
|
|
60
|
-
return html`<div class="skeleton" style=${style}></div>`;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
declare global {
|
|
65
|
-
interface HTMLElementTagNameMap {
|
|
66
|
-
'st-skeleton': StSkeleton;
|
|
67
|
-
}
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
+
|
|
5
|
+
@customElement('st-skeleton')
|
|
6
|
+
export class StSkeleton extends LitElement {
|
|
7
|
+
/** Variant shape: 'text' | 'circular' | 'rectangular' */
|
|
8
|
+
@property({ type: String }) variant: 'text' | 'circular' | 'rectangular' = 'text';
|
|
9
|
+
|
|
10
|
+
/** Custom width override (e.g., '200px', '50%') */
|
|
11
|
+
@property({ type: String }) width = '';
|
|
12
|
+
|
|
13
|
+
/** Custom height override (e.g., '40px', '1rem') */
|
|
14
|
+
@property({ type: String }) height = '';
|
|
15
|
+
|
|
16
|
+
static styles = [
|
|
17
|
+
resetStyles,
|
|
18
|
+
css`
|
|
19
|
+
:host {
|
|
20
|
+
display: block;
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.skeleton {
|
|
25
|
+
width: var(--st-skeleton-width, 100%);
|
|
26
|
+
height: var(--st-skeleton-height, 1em);
|
|
27
|
+
background: linear-gradient(
|
|
28
|
+
90deg,
|
|
29
|
+
var(--st-color-surface-muted, #f1f5f9) 25%,
|
|
30
|
+
var(--st-color-border, #e2e8f0) 37%,
|
|
31
|
+
var(--st-color-surface-muted, #f1f5f9) 63%
|
|
32
|
+
);
|
|
33
|
+
background-size: 400% 100%;
|
|
34
|
+
animation: st-shimmer 1.4s ease infinite;
|
|
35
|
+
border-radius: var(--st-radius-sm, 0.25rem);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host([variant="circular"]) .skeleton {
|
|
39
|
+
border-radius: 50%;
|
|
40
|
+
height: var(--st-skeleton-height, 2.5rem);
|
|
41
|
+
width: var(--st-skeleton-width, 2.5rem);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:host([variant="rectangular"]) .skeleton {
|
|
45
|
+
height: var(--st-skeleton-height, 8rem);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@keyframes st-shimmer {
|
|
49
|
+
0% { background-position: 100% 0; }
|
|
50
|
+
100% { background-position: 0 0; }
|
|
51
|
+
}
|
|
52
|
+
`
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
render() {
|
|
56
|
+
const style = `
|
|
57
|
+
${this.width ? `--st-skeleton-width: ${this.width};` : ''}
|
|
58
|
+
${this.height ? `--st-skeleton-height: ${this.height};` : ''}
|
|
59
|
+
`;
|
|
60
|
+
return html`<div class="skeleton" style=${style}></div>`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare global {
|
|
65
|
+
interface HTMLElementTagNameMap {
|
|
66
|
+
'st-skeleton': StSkeleton;
|
|
67
|
+
}
|
|
68
68
|
}
|