@sondor-technology/sondor-components 1.0.0 → 1.0.1-develop.2
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 +116 -0
- package/dist/components/icon/icon-paths.d.ts.map +1 -0
- package/dist/components/icon/icon-paths.js +121 -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 +9 -0
- package/dist/components/vertical-nav/vertical-nav-group.d.ts.map +1 -0
- package/dist/components/vertical-nav/vertical-nav-group.js +111 -0
- package/dist/components/vertical-nav/vertical-nav-item.d.ts +8 -0
- package/dist/components/vertical-nav/vertical-nav-item.d.ts.map +1 -0
- package/dist/components/vertical-nav/vertical-nav-item.js +65 -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 +3 -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 +124 -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 +96 -96
- package/src/components/vertical-nav/vertical-nav-item.ts +49 -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,218 +1,218 @@
|
|
|
1
|
-
import { LitElement, html, css, nothing } from 'lit';
|
|
2
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
-
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
-
|
|
5
|
-
export type DrawerPlacement = 'left' | 'right';
|
|
6
|
-
|
|
7
|
-
@customElement('st-drawer')
|
|
8
|
-
export class StDrawer extends LitElement {
|
|
9
|
-
@property({ type: Boolean, reflect: true }) open = false;
|
|
10
|
-
@property({ type: String, reflect: true }) placement: DrawerPlacement = 'left';
|
|
11
|
-
@property({ type: Boolean, attribute: 'mobile-only', reflect: true }) mobileOnly = false;
|
|
12
|
-
|
|
13
|
-
private _touchStartX = 0;
|
|
14
|
-
private _currentTranslateX = 0;
|
|
15
|
-
private _isDragging = false;
|
|
16
|
-
|
|
17
|
-
static styles = [
|
|
18
|
-
resetStyles,
|
|
19
|
-
css`
|
|
20
|
-
:host {
|
|
21
|
-
display: contents;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
:host([mobile-only]) {
|
|
25
|
-
display: block;
|
|
26
|
-
}
|
|
27
|
-
@media (min-width: 768px) {
|
|
28
|
-
:host([mobile-only]) {
|
|
29
|
-
display: none !important;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.overlay {
|
|
34
|
-
position: fixed;
|
|
35
|
-
top: 0;
|
|
36
|
-
left: 0;
|
|
37
|
-
width: 100vw;
|
|
38
|
-
height: 100vh;
|
|
39
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
40
|
-
backdrop-filter: blur(2px);
|
|
41
|
-
z-index: 1000;
|
|
42
|
-
display: flex;
|
|
43
|
-
opacity: 0;
|
|
44
|
-
pointer-events: none;
|
|
45
|
-
transition: opacity 0.25s ease-in-out;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
:host([open]) .overlay {
|
|
49
|
-
opacity: 1;
|
|
50
|
-
pointer-events: auto;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.panel {
|
|
54
|
-
position: fixed;
|
|
55
|
-
top: 0;
|
|
56
|
-
bottom: 0;
|
|
57
|
-
width: auto;
|
|
58
|
-
max-width: 90vw;
|
|
59
|
-
background-color: var(--st-color-surface, #ffffff);
|
|
60
|
-
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
|
|
61
|
-
display: flex;
|
|
62
|
-
flex-direction: column;
|
|
63
|
-
z-index: 1001;
|
|
64
|
-
overflow-y: auto;
|
|
65
|
-
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
66
|
-
touch-action: pan-y;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/* Slide from Left */
|
|
70
|
-
:host([placement="left"]) .panel {
|
|
71
|
-
left: 0;
|
|
72
|
-
transform: translateX(-100%);
|
|
73
|
-
}
|
|
74
|
-
:host([placement="left"][open]) .panel {
|
|
75
|
-
transform: translateX(0);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/* Slide from Right */
|
|
79
|
-
:host([placement="right"]) .panel {
|
|
80
|
-
right: 0;
|
|
81
|
-
transform: translateX(100%);
|
|
82
|
-
}
|
|
83
|
-
:host([placement="right"][open]) .panel {
|
|
84
|
-
transform: translateX(0);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.header {
|
|
88
|
-
display: flex;
|
|
89
|
-
align-items: center;
|
|
90
|
-
justify-content: space-between;
|
|
91
|
-
padding: var(--st-spacing-md) var(--st-spacing-lg);
|
|
92
|
-
border-bottom: 1px solid var(--st-color-border, #e2e8f0);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.title {
|
|
96
|
-
font-weight: var(--st-font-weight-bold);
|
|
97
|
-
font-size: var(--st-font-size-sm);
|
|
98
|
-
color: var(--st-color-text);
|
|
99
|
-
text-transform: uppercase;
|
|
100
|
-
letter-spacing: 0.05em;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.close-btn {
|
|
104
|
-
background: transparent;
|
|
105
|
-
border: none;
|
|
106
|
-
cursor: pointer;
|
|
107
|
-
color: var(--st-color-text-muted);
|
|
108
|
-
padding: 0.25rem;
|
|
109
|
-
display: flex;
|
|
110
|
-
align-items: center;
|
|
111
|
-
justify-content: center;
|
|
112
|
-
border-radius: var(--st-radius-sm, 0.375rem);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.close-btn:hover {
|
|
116
|
-
color: var(--st-color-text);
|
|
117
|
-
background-color: var(--st-color-surface-muted, #f1f5f9);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.close-btn svg {
|
|
121
|
-
width: 1.25rem;
|
|
122
|
-
height: 1.25rem;
|
|
123
|
-
stroke: currentColor;
|
|
124
|
-
stroke-width: 2;
|
|
125
|
-
stroke-linecap: round;
|
|
126
|
-
stroke-linejoin: round;
|
|
127
|
-
fill: none;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.body {
|
|
131
|
-
padding: var(--st-spacing-lg);
|
|
132
|
-
flex: 1;
|
|
133
|
-
}
|
|
134
|
-
`
|
|
135
|
-
];
|
|
136
|
-
|
|
137
|
-
private _close() {
|
|
138
|
-
this.open = false;
|
|
139
|
-
const panel = this.shadowRoot?.querySelector('.panel') as HTMLElement;
|
|
140
|
-
if (panel) panel.style.transform = '';
|
|
141
|
-
this.dispatchEvent(new CustomEvent('st-close', { bubbles: true, composed: true }));
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
private _handleTouchStart(e: TouchEvent) {
|
|
145
|
-
this._touchStartX = e.touches[0].clientX;
|
|
146
|
-
this._isDragging = true;
|
|
147
|
-
const panel = this.shadowRoot?.querySelector('.panel') as HTMLElement;
|
|
148
|
-
if (panel) panel.style.transition = 'none';
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
private _handleTouchMove(e: TouchEvent) {
|
|
152
|
-
if (!this._isDragging) return;
|
|
153
|
-
const currentX = e.touches[0].clientX;
|
|
154
|
-
const diff = currentX - this._touchStartX;
|
|
155
|
-
const panel = this.shadowRoot?.querySelector('.panel') as HTMLElement;
|
|
156
|
-
|
|
157
|
-
if (!panel) return;
|
|
158
|
-
|
|
159
|
-
if (this.placement === 'left' && diff < 0) {
|
|
160
|
-
this._currentTranslateX = diff;
|
|
161
|
-
panel.style.transform = `translateX(${diff}px)`;
|
|
162
|
-
} else if (this.placement === 'right' && diff > 0) {
|
|
163
|
-
this._currentTranslateX = diff;
|
|
164
|
-
panel.style.transform = `translateX(${diff}px)`;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
private _handleTouchEnd() {
|
|
169
|
-
if (!this._isDragging) return;
|
|
170
|
-
this._isDragging = false;
|
|
171
|
-
const panel = this.shadowRoot?.querySelector('.panel') as HTMLElement;
|
|
172
|
-
if (panel) panel.style.transition = '';
|
|
173
|
-
|
|
174
|
-
const threshold = 70;
|
|
175
|
-
if (
|
|
176
|
-
(this.placement === 'left' && this._currentTranslateX < -threshold) ||
|
|
177
|
-
(this.placement === 'right' && this._currentTranslateX > threshold)
|
|
178
|
-
) {
|
|
179
|
-
this._close();
|
|
180
|
-
} else if (panel) {
|
|
181
|
-
panel.style.transform = '';
|
|
182
|
-
}
|
|
183
|
-
this._currentTranslateX = 0;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
render() {
|
|
187
|
-
if (!this.open) return nothing;
|
|
188
|
-
|
|
189
|
-
return html`
|
|
190
|
-
<div class="overlay" @click=${this._close}></div>
|
|
191
|
-
<div
|
|
192
|
-
class="panel"
|
|
193
|
-
role="dialog"
|
|
194
|
-
aria-modal="true"
|
|
195
|
-
@click=${(e: Event) => e.stopPropagation()}
|
|
196
|
-
@touchstart=${this._handleTouchStart}
|
|
197
|
-
@touchmove=${this._handleTouchMove}
|
|
198
|
-
@touchend=${this._handleTouchEnd}
|
|
199
|
-
>
|
|
200
|
-
<div class="header">
|
|
201
|
-
<span class="title"><slot name="header">Menu</slot></span>
|
|
202
|
-
<button class="close-btn" @click=${this._close} aria-label="Close Drawer">
|
|
203
|
-
<svg viewBox="0 0 24 24"><path d="M18 6L6 18M6 6l12 12"></path></svg>
|
|
204
|
-
</button>
|
|
205
|
-
</div>
|
|
206
|
-
<div class="body">
|
|
207
|
-
<slot></slot>
|
|
208
|
-
</div>
|
|
209
|
-
</div>
|
|
210
|
-
`;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
declare global {
|
|
215
|
-
interface HTMLElementTagNameMap {
|
|
216
|
-
'st-drawer': StDrawer;
|
|
217
|
-
}
|
|
1
|
+
import { LitElement, html, css, nothing } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
+
|
|
5
|
+
export type DrawerPlacement = 'left' | 'right';
|
|
6
|
+
|
|
7
|
+
@customElement('st-drawer')
|
|
8
|
+
export class StDrawer extends LitElement {
|
|
9
|
+
@property({ type: Boolean, reflect: true }) open = false;
|
|
10
|
+
@property({ type: String, reflect: true }) placement: DrawerPlacement = 'left';
|
|
11
|
+
@property({ type: Boolean, attribute: 'mobile-only', reflect: true }) mobileOnly = false;
|
|
12
|
+
|
|
13
|
+
private _touchStartX = 0;
|
|
14
|
+
private _currentTranslateX = 0;
|
|
15
|
+
private _isDragging = false;
|
|
16
|
+
|
|
17
|
+
static styles = [
|
|
18
|
+
resetStyles,
|
|
19
|
+
css`
|
|
20
|
+
:host {
|
|
21
|
+
display: contents;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([mobile-only]) {
|
|
25
|
+
display: block;
|
|
26
|
+
}
|
|
27
|
+
@media (min-width: 768px) {
|
|
28
|
+
:host([mobile-only]) {
|
|
29
|
+
display: none !important;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.overlay {
|
|
34
|
+
position: fixed;
|
|
35
|
+
top: 0;
|
|
36
|
+
left: 0;
|
|
37
|
+
width: 100vw;
|
|
38
|
+
height: 100vh;
|
|
39
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
40
|
+
backdrop-filter: blur(2px);
|
|
41
|
+
z-index: 1000;
|
|
42
|
+
display: flex;
|
|
43
|
+
opacity: 0;
|
|
44
|
+
pointer-events: none;
|
|
45
|
+
transition: opacity 0.25s ease-in-out;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:host([open]) .overlay {
|
|
49
|
+
opacity: 1;
|
|
50
|
+
pointer-events: auto;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.panel {
|
|
54
|
+
position: fixed;
|
|
55
|
+
top: 0;
|
|
56
|
+
bottom: 0;
|
|
57
|
+
width: auto;
|
|
58
|
+
max-width: 90vw;
|
|
59
|
+
background-color: var(--st-color-surface, #ffffff);
|
|
60
|
+
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
z-index: 1001;
|
|
64
|
+
overflow-y: auto;
|
|
65
|
+
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
66
|
+
touch-action: pan-y;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Slide from Left */
|
|
70
|
+
:host([placement="left"]) .panel {
|
|
71
|
+
left: 0;
|
|
72
|
+
transform: translateX(-100%);
|
|
73
|
+
}
|
|
74
|
+
:host([placement="left"][open]) .panel {
|
|
75
|
+
transform: translateX(0);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Slide from Right */
|
|
79
|
+
:host([placement="right"]) .panel {
|
|
80
|
+
right: 0;
|
|
81
|
+
transform: translateX(100%);
|
|
82
|
+
}
|
|
83
|
+
:host([placement="right"][open]) .panel {
|
|
84
|
+
transform: translateX(0);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.header {
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: space-between;
|
|
91
|
+
padding: var(--st-spacing-md) var(--st-spacing-lg);
|
|
92
|
+
border-bottom: 1px solid var(--st-color-border, #e2e8f0);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.title {
|
|
96
|
+
font-weight: var(--st-font-weight-bold);
|
|
97
|
+
font-size: var(--st-font-size-sm);
|
|
98
|
+
color: var(--st-color-text);
|
|
99
|
+
text-transform: uppercase;
|
|
100
|
+
letter-spacing: 0.05em;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.close-btn {
|
|
104
|
+
background: transparent;
|
|
105
|
+
border: none;
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
color: var(--st-color-text-muted);
|
|
108
|
+
padding: 0.25rem;
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
border-radius: var(--st-radius-sm, 0.375rem);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.close-btn:hover {
|
|
116
|
+
color: var(--st-color-text);
|
|
117
|
+
background-color: var(--st-color-surface-muted, #f1f5f9);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.close-btn svg {
|
|
121
|
+
width: 1.25rem;
|
|
122
|
+
height: 1.25rem;
|
|
123
|
+
stroke: currentColor;
|
|
124
|
+
stroke-width: 2;
|
|
125
|
+
stroke-linecap: round;
|
|
126
|
+
stroke-linejoin: round;
|
|
127
|
+
fill: none;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.body {
|
|
131
|
+
padding: var(--st-spacing-lg);
|
|
132
|
+
flex: 1;
|
|
133
|
+
}
|
|
134
|
+
`
|
|
135
|
+
];
|
|
136
|
+
|
|
137
|
+
private _close() {
|
|
138
|
+
this.open = false;
|
|
139
|
+
const panel = this.shadowRoot?.querySelector('.panel') as HTMLElement;
|
|
140
|
+
if (panel) panel.style.transform = '';
|
|
141
|
+
this.dispatchEvent(new CustomEvent('st-close', { bubbles: true, composed: true }));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private _handleTouchStart(e: TouchEvent) {
|
|
145
|
+
this._touchStartX = e.touches[0].clientX;
|
|
146
|
+
this._isDragging = true;
|
|
147
|
+
const panel = this.shadowRoot?.querySelector('.panel') as HTMLElement;
|
|
148
|
+
if (panel) panel.style.transition = 'none';
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private _handleTouchMove(e: TouchEvent) {
|
|
152
|
+
if (!this._isDragging) return;
|
|
153
|
+
const currentX = e.touches[0].clientX;
|
|
154
|
+
const diff = currentX - this._touchStartX;
|
|
155
|
+
const panel = this.shadowRoot?.querySelector('.panel') as HTMLElement;
|
|
156
|
+
|
|
157
|
+
if (!panel) return;
|
|
158
|
+
|
|
159
|
+
if (this.placement === 'left' && diff < 0) {
|
|
160
|
+
this._currentTranslateX = diff;
|
|
161
|
+
panel.style.transform = `translateX(${diff}px)`;
|
|
162
|
+
} else if (this.placement === 'right' && diff > 0) {
|
|
163
|
+
this._currentTranslateX = diff;
|
|
164
|
+
panel.style.transform = `translateX(${diff}px)`;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
private _handleTouchEnd() {
|
|
169
|
+
if (!this._isDragging) return;
|
|
170
|
+
this._isDragging = false;
|
|
171
|
+
const panel = this.shadowRoot?.querySelector('.panel') as HTMLElement;
|
|
172
|
+
if (panel) panel.style.transition = '';
|
|
173
|
+
|
|
174
|
+
const threshold = 70;
|
|
175
|
+
if (
|
|
176
|
+
(this.placement === 'left' && this._currentTranslateX < -threshold) ||
|
|
177
|
+
(this.placement === 'right' && this._currentTranslateX > threshold)
|
|
178
|
+
) {
|
|
179
|
+
this._close();
|
|
180
|
+
} else if (panel) {
|
|
181
|
+
panel.style.transform = '';
|
|
182
|
+
}
|
|
183
|
+
this._currentTranslateX = 0;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
render() {
|
|
187
|
+
if (!this.open) return nothing;
|
|
188
|
+
|
|
189
|
+
return html`
|
|
190
|
+
<div class="overlay" @click=${this._close}></div>
|
|
191
|
+
<div
|
|
192
|
+
class="panel"
|
|
193
|
+
role="dialog"
|
|
194
|
+
aria-modal="true"
|
|
195
|
+
@click=${(e: Event) => e.stopPropagation()}
|
|
196
|
+
@touchstart=${this._handleTouchStart}
|
|
197
|
+
@touchmove=${this._handleTouchMove}
|
|
198
|
+
@touchend=${this._handleTouchEnd}
|
|
199
|
+
>
|
|
200
|
+
<div class="header">
|
|
201
|
+
<span class="title"><slot name="header">Menu</slot></span>
|
|
202
|
+
<button class="close-btn" @click=${this._close} aria-label="Close Drawer">
|
|
203
|
+
<svg viewBox="0 0 24 24"><path d="M18 6L6 18M6 6l12 12"></path></svg>
|
|
204
|
+
</button>
|
|
205
|
+
</div>
|
|
206
|
+
<div class="body">
|
|
207
|
+
<slot></slot>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
`;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
declare global {
|
|
215
|
+
interface HTMLElementTagNameMap {
|
|
216
|
+
'st-drawer': StDrawer;
|
|
217
|
+
}
|
|
218
218
|
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit';
|
|
2
|
-
import { customElement, } from 'lit/decorators.js';
|
|
3
|
-
import { resetStyles } from '../../styles/reset';
|
|
4
|
-
|
|
5
|
-
@customElement('st-field')
|
|
6
|
-
export class StField extends LitElement {
|
|
7
|
-
static styles = [
|
|
8
|
-
resetStyles,
|
|
9
|
-
css`
|
|
10
|
-
:host {
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
gap: var(--st-spacing-xs, 0.25rem);
|
|
14
|
-
width: 100%;
|
|
15
|
-
margin-bottom: var(--st-spacing-md, 0.25rem);
|
|
16
|
-
}
|
|
17
|
-
`
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
render() {
|
|
21
|
-
return html`
|
|
22
|
-
<slot></slot>
|
|
23
|
-
`;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
declare global {
|
|
28
|
-
interface HTMLElementTagNameMap {
|
|
29
|
-
'st-field': StField;
|
|
30
|
-
}
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { customElement, } from 'lit/decorators.js';
|
|
3
|
+
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
+
|
|
5
|
+
@customElement('st-field')
|
|
6
|
+
export class StField extends LitElement {
|
|
7
|
+
static styles = [
|
|
8
|
+
resetStyles,
|
|
9
|
+
css`
|
|
10
|
+
:host {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: var(--st-spacing-xs, 0.25rem);
|
|
14
|
+
width: 100%;
|
|
15
|
+
margin-bottom: var(--st-spacing-md, 0.25rem);
|
|
16
|
+
}
|
|
17
|
+
`
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
render() {
|
|
21
|
+
return html`
|
|
22
|
+
<slot></slot>
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare global {
|
|
28
|
+
interface HTMLElementTagNameMap {
|
|
29
|
+
'st-field': StField;
|
|
30
|
+
}
|
|
31
31
|
}
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import {LitElement, html, css} from "lit";
|
|
2
|
-
import {customElement} from "lit/decorators.js";
|
|
3
|
-
import {resetStyles} from "../../styles/reset";
|
|
4
|
-
|
|
5
|
-
@customElement("st-footer")
|
|
6
|
-
export class StFooter extends LitElement {
|
|
7
|
-
static styles = [
|
|
8
|
-
resetStyles,
|
|
9
|
-
css`
|
|
10
|
-
:host {
|
|
11
|
-
display: block;
|
|
12
|
-
border-top: 1px solid var(--st-color-border);
|
|
13
|
-
background-color: var(--st-color-surface);
|
|
14
|
-
padding: var(--st-spacing-lg, 2rem) 0;
|
|
15
|
-
margin-top: auto; /* Pushes footer to the bottom of the page */
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
footer {
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
align-items: center;
|
|
22
|
-
gap: var(--st-spacing-md, 1rem);
|
|
23
|
-
max-width: 1200px;
|
|
24
|
-
margin: 0 auto;
|
|
25
|
-
padding: 0 var(--st-spacing-md, 1rem);
|
|
26
|
-
color: var(--st-color-text-muted);
|
|
27
|
-
font-size: 0.875rem;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/* Wrapper for footer links */
|
|
31
|
-
.links {
|
|
32
|
-
display: flex;
|
|
33
|
-
gap: var(--st-spacing-md, 1rem);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
::slotted(a) {
|
|
37
|
-
color: var(--st-color-text-muted);
|
|
38
|
-
text-decoration: none;
|
|
39
|
-
transition: color 0.2s;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
::slotted(a:hover) {
|
|
43
|
-
color: var(--st-color-primary);
|
|
44
|
-
}
|
|
45
|
-
`,
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
render() {
|
|
49
|
-
return html`
|
|
50
|
-
<footer>
|
|
51
|
-
<slot></slot>
|
|
52
|
-
<div class="links">
|
|
53
|
-
<span>© ${new Date().getFullYear()} Sondor.</span>
|
|
54
|
-
</div>
|
|
55
|
-
</footer>
|
|
56
|
-
`;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
1
|
+
import {LitElement, html, css} from "lit";
|
|
2
|
+
import {customElement} from "lit/decorators.js";
|
|
3
|
+
import {resetStyles} from "../../styles/reset";
|
|
4
|
+
|
|
5
|
+
@customElement("st-footer")
|
|
6
|
+
export class StFooter extends LitElement {
|
|
7
|
+
static styles = [
|
|
8
|
+
resetStyles,
|
|
9
|
+
css`
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
border-top: 1px solid var(--st-color-border);
|
|
13
|
+
background-color: var(--st-color-surface);
|
|
14
|
+
padding: var(--st-spacing-lg, 2rem) 0;
|
|
15
|
+
margin-top: auto; /* Pushes footer to the bottom of the page */
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
footer {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: var(--st-spacing-md, 1rem);
|
|
23
|
+
max-width: 1200px;
|
|
24
|
+
margin: 0 auto;
|
|
25
|
+
padding: 0 var(--st-spacing-md, 1rem);
|
|
26
|
+
color: var(--st-color-text-muted);
|
|
27
|
+
font-size: 0.875rem;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Wrapper for footer links */
|
|
31
|
+
.links {
|
|
32
|
+
display: flex;
|
|
33
|
+
gap: var(--st-spacing-md, 1rem);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
::slotted(a) {
|
|
37
|
+
color: var(--st-color-text-muted);
|
|
38
|
+
text-decoration: none;
|
|
39
|
+
transition: color 0.2s;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
::slotted(a:hover) {
|
|
43
|
+
color: var(--st-color-primary);
|
|
44
|
+
}
|
|
45
|
+
`,
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
render() {
|
|
49
|
+
return html`
|
|
50
|
+
<footer>
|
|
51
|
+
<slot></slot>
|
|
52
|
+
<div class="links">
|
|
53
|
+
<span>© ${new Date().getFullYear()} Sondor.</span>
|
|
54
|
+
</div>
|
|
55
|
+
</footer>
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
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-form-step")
|
|
6
|
-
export class StFormStep extends LitElement {
|
|
7
|
-
@property({type: String}) title = "";
|
|
8
|
-
@property({type: Boolean, reflect: true}) active = false;
|
|
9
|
-
|
|
10
|
-
static styles = [
|
|
11
|
-
resetStyles,
|
|
12
|
-
css`
|
|
13
|
-
:host {
|
|
14
|
-
display: block;
|
|
15
|
-
}
|
|
16
|
-
/* Hide inactive steps completely from the layout and accessibility tree */
|
|
17
|
-
:host(:not([active])) {
|
|
18
|
-
display: none;
|
|
19
|
-
}
|
|
20
|
-
`,
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
render() {
|
|
24
|
-
return html`<slot></slot>`;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
declare global {
|
|
29
|
-
interface HTMLElementTagNameMap {
|
|
30
|
-
"st-form-step": StFormStep;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
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-form-step")
|
|
6
|
+
export class StFormStep extends LitElement {
|
|
7
|
+
@property({type: String}) title = "";
|
|
8
|
+
@property({type: Boolean, reflect: true}) active = false;
|
|
9
|
+
|
|
10
|
+
static styles = [
|
|
11
|
+
resetStyles,
|
|
12
|
+
css`
|
|
13
|
+
:host {
|
|
14
|
+
display: block;
|
|
15
|
+
}
|
|
16
|
+
/* Hide inactive steps completely from the layout and accessibility tree */
|
|
17
|
+
:host(:not([active])) {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
`,
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return html`<slot></slot>`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare global {
|
|
29
|
+
interface HTMLElementTagNameMap {
|
|
30
|
+
"st-form-step": StFormStep;
|
|
31
|
+
}
|
|
32
|
+
}
|