@iyulab/components 0.2.1 → 0.2.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/CHANGELOG.md +123 -113
- package/LICENSE +20 -20
- package/README.md +283 -283
- package/dist/assets/icons/arrow-down.svg.js +1 -1
- package/dist/assets/icons/arrow-repeat.svg.js +1 -1
- package/dist/assets/icons/arrow-up.svg.js +1 -1
- package/dist/assets/icons/ban.svg.js +1 -1
- package/dist/assets/icons/bell-fill.svg.js +1 -1
- package/dist/assets/icons/box-arrow-up-right.svg.js +1 -1
- package/dist/assets/icons/check-circle-fill.svg.js +1 -1
- package/dist/assets/icons/check-lg.svg.js +1 -1
- package/dist/assets/icons/chevron-down.svg.js +1 -1
- package/dist/assets/icons/chevron-left.svg.js +1 -1
- package/dist/assets/icons/chevron-right.svg.js +1 -1
- package/dist/assets/icons/chevron-up.svg.js +1 -1
- package/dist/assets/icons/copy.svg.js +1 -1
- package/dist/assets/icons/dash-lg.svg.js +1 -1
- package/dist/assets/icons/exclamation-circle-fill.svg.js +1 -1
- package/dist/assets/icons/exclamation-triangle-fill.svg.js +1 -1
- package/dist/assets/icons/eye-slash.svg.js +1 -1
- package/dist/assets/icons/eye.svg.js +1 -1
- package/dist/assets/icons/file-earmark.svg.js +1 -1
- package/dist/assets/icons/flag.svg.js +1 -1
- package/dist/assets/icons/globe.svg.js +1 -1
- package/dist/assets/icons/hand-thumbs-down-fill.svg.js +1 -1
- package/dist/assets/icons/hand-thumbs-down.svg.js +1 -1
- package/dist/assets/icons/hand-thumbs-up-fill.svg.js +1 -1
- package/dist/assets/icons/hand-thumbs-up.svg.js +1 -1
- package/dist/assets/icons/info-circle-fill.svg.js +1 -1
- package/dist/assets/icons/lightbulb-fill.svg.js +1 -1
- package/dist/assets/icons/lightbulb-off.svg.js +1 -1
- package/dist/assets/icons/lightbulb.svg.js +1 -1
- package/dist/assets/icons/mic-fill.svg.js +1 -1
- package/dist/assets/icons/mic-mute-fill.svg.js +1 -1
- package/dist/assets/icons/paperclip.svg.js +1 -1
- package/dist/assets/icons/pencil-square.svg.js +1 -1
- package/dist/assets/icons/plus-lg.svg.js +1 -1
- package/dist/assets/icons/search.svg.js +1 -1
- package/dist/assets/icons/share.svg.js +1 -1
- package/dist/assets/icons/stop-circle.svg.js +1 -1
- package/dist/assets/icons/tools.svg.js +1 -1
- package/dist/assets/icons/x-lg.svg.js +1 -1
- package/dist/assets/styles/dark.css +129 -129
- package/dist/assets/styles/dark.css.js +1 -1
- package/dist/assets/styles/light.css +129 -129
- package/dist/assets/styles/light.css.js +1 -1
- package/dist/components/icon/UIcon.component.d.ts +4 -1
- package/dist/components/input/UInput.component.d.ts +14 -0
- package/dist/components/input/UInput.component.js +29 -0
- package/dist/utilities/IconRegistry.js +1 -2
- package/package.json +60 -60
- package/dist/assets/icons/layout-sidebar.svg.js +0 -3
package/README.md
CHANGED
|
@@ -1,283 +1,283 @@
|
|
|
1
|
-
# @iyulab/components
|
|
2
|
-
|
|
3
|
-
Modern web components library built with Lit-Element for building reactive user interfaces.
|
|
4
|
-
|
|
5
|
-
Visit our [Demo Site](https://components.iyulab.com) to explore all components and their features.
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install @iyulab/components
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
import "@iyulab/components";
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Components
|
|
20
|
-
|
|
21
|
-
| Component | Tag | Description |
|
|
22
|
-
|-----------|-----|-------------|
|
|
23
|
-
| UAlert | `u-alert` | Alert messages with variants |
|
|
24
|
-
| UButton | `u-button` | Button with variants, loading state |
|
|
25
|
-
| UDialog | `u-dialog` | Modal dialog |
|
|
26
|
-
| UDrawer | `u-drawer` | Slide-in drawer panel |
|
|
27
|
-
| UDivider | `u-divider` | Visual divider |
|
|
28
|
-
| UForm | `u-form` | Form container with validation |
|
|
29
|
-
| UIcon | `u-icon` | Icon display |
|
|
30
|
-
| UInput | `u-input` | Text input with validation |
|
|
31
|
-
| UMenu | `u-menu` | Dropdown/context menu |
|
|
32
|
-
| UMenuItem | `u-menu-item` | Menu item |
|
|
33
|
-
| UProgressBar | `u-progress-bar` | Progress bar |
|
|
34
|
-
| UProgressRing | `u-progress-ring` | Circular progress indicator |
|
|
35
|
-
| USkeleton | `u-skeleton` | Loading placeholder |
|
|
36
|
-
| USpinner | `u-spinner` | Loading spinner |
|
|
37
|
-
| USplitPanel | `u-split-panel` | Resizable split panel |
|
|
38
|
-
| UTag | `u-tag` | Label/status tag |
|
|
39
|
-
| UTooltip | `u-tooltip` | Tooltip |
|
|
40
|
-
| UTree | `u-tree` | Tree view |
|
|
41
|
-
| UTreeItem | `u-tree-item` | Tree view item |
|
|
42
|
-
|
|
43
|
-
## Events
|
|
44
|
-
|
|
45
|
-
All custom events use the `u-<action>` naming convention. Events bubble across Shadow DOM boundaries (`bubbles: true`, `composed: true`).
|
|
46
|
-
|
|
47
|
-
### Event Reference
|
|
48
|
-
|
|
49
|
-
| Event | Emitted By | Detail | Description |
|
|
50
|
-
|-------|-----------|--------|-------------|
|
|
51
|
-
| `u-input` | `u-input` | `{ value: string }` | Fires on every keystroke (real-time input) |
|
|
52
|
-
| `u-change` | `u-input` | `{ value: string }` | Fires when value is committed (blur/enter) |
|
|
53
|
-
| `u-select` | `u-tree-item` | `{ value: string, item: UTreeItem }` | Fires when a leaf item is selected |
|
|
54
|
-
| `u-show` | `u-dialog`, `u-drawer`, `u-tooltip` | — | Fires when the element becomes visible |
|
|
55
|
-
| `u-hide` | `u-dialog`, `u-drawer`, `u-tooltip` | — | Fires when the element is hidden |
|
|
56
|
-
| `u-toggle` | `u-tree-item` | `{ expanded: boolean, item: UTreeItem }` | Fires when a branch item expands/collapses |
|
|
57
|
-
| `u-resize` | `u-split-panel` | — | Fires when the panel is resized |
|
|
58
|
-
|
|
59
|
-
### TypeScript Support
|
|
60
|
-
|
|
61
|
-
All events are typed and registered on `GlobalEventHandlersEventMap`:
|
|
62
|
-
|
|
63
|
-
```typescript
|
|
64
|
-
import type { UInputEvent, UChangeEvent, USelectEvent, UShowEvent, UHideEvent, UResizeEvent } from '@iyulab/components';
|
|
65
|
-
|
|
66
|
-
element.addEventListener('u-input', (e: UInputEvent) => {
|
|
67
|
-
console.log(e.detail.value);
|
|
68
|
-
});
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Listening to Events
|
|
72
|
-
|
|
73
|
-
```html
|
|
74
|
-
<!-- Lit template -->
|
|
75
|
-
<u-input @u-input=${this.handleInput} @u-change=${this.handleChange}></u-input>
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
```javascript
|
|
79
|
-
// Vanilla JS
|
|
80
|
-
document.querySelector('u-input').addEventListener('u-input', (e) => {
|
|
81
|
-
console.log('Real-time value:', e.detail.value);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
document.querySelector('u-input').addEventListener('u-change', (e) => {
|
|
85
|
-
console.log('Committed value:', e.detail.value);
|
|
86
|
-
});
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## CSS Custom Properties
|
|
90
|
-
|
|
91
|
-
All CSS custom properties use the `--u-` prefix and are defined on `:root`. They respond to light/dark theme changes automatically.
|
|
92
|
-
|
|
93
|
-
### Semantic Colors
|
|
94
|
-
|
|
95
|
-
These variables reference the color palette and should be used in most cases:
|
|
96
|
-
|
|
97
|
-
#### Text
|
|
98
|
-
|
|
99
|
-
| Variable | Light | Dark |
|
|
100
|
-
|----------|-------|------|
|
|
101
|
-
| `--u-txt-color` | neutral-900 | neutral-900 |
|
|
102
|
-
| `--u-txt-color-inverse` | neutral-0 | neutral-100 |
|
|
103
|
-
| `--u-txt-color-hover` | blue-600 | blue-600 |
|
|
104
|
-
| `--u-txt-color-active` | blue-600 | blue-600 |
|
|
105
|
-
| `--u-txt-color-disabled` | neutral-400 | neutral-500 |
|
|
106
|
-
| `--u-txt-color-weak` | neutral-700 | neutral-700 |
|
|
107
|
-
| `--u-txt-color-strong` | neutral-1000 | neutral-1000 |
|
|
108
|
-
| `--u-link-txt-color` | blue-700 | blue-700 |
|
|
109
|
-
| `--u-tooltip-txt-color` | neutral-0 | neutral-100 |
|
|
110
|
-
|
|
111
|
-
#### Icon
|
|
112
|
-
|
|
113
|
-
| Variable | Light | Dark |
|
|
114
|
-
|----------|-------|------|
|
|
115
|
-
| `--u-icon-color` | neutral-700 | neutral-800 |
|
|
116
|
-
| `--u-icon-color-inverse` | neutral-0 | neutral-100 |
|
|
117
|
-
| `--u-icon-color-hover` | blue-600 | blue-600 |
|
|
118
|
-
| `--u-icon-color-active` | blue-600 | blue-600 |
|
|
119
|
-
| `--u-icon-color-disabled` | neutral-400 | neutral-500 |
|
|
120
|
-
|
|
121
|
-
#### Border
|
|
122
|
-
|
|
123
|
-
| Variable | Light | Dark |
|
|
124
|
-
|----------|-------|------|
|
|
125
|
-
| `--u-border-color` | neutral-300 | neutral-400 |
|
|
126
|
-
| `--u-border-color-weak` | neutral-200 | neutral-300 |
|
|
127
|
-
| `--u-border-color-strong` | neutral-400 | neutral-500 |
|
|
128
|
-
| `--u-input-border-color` | neutral-300 | neutral-400 |
|
|
129
|
-
| `--u-input-border-color-hover` | neutral-400 | neutral-500 |
|
|
130
|
-
| `--u-input-border-color-focus` | blue-600 | blue-600 |
|
|
131
|
-
| `--u-input-border-color-invalid` | red-600 | red-600 |
|
|
132
|
-
|
|
133
|
-
#### Background
|
|
134
|
-
|
|
135
|
-
| Variable | Light | Dark |
|
|
136
|
-
|----------|-------|------|
|
|
137
|
-
| `--u-bg-color` | neutral-0 | neutral-100 |
|
|
138
|
-
| `--u-bg-color-inverse` | neutral-900 | neutral-0 |
|
|
139
|
-
| `--u-bg-color-hover` | neutral-100 | neutral-300 |
|
|
140
|
-
| `--u-bg-color-active` | neutral-200 | neutral-400 |
|
|
141
|
-
| `--u-bg-color-disabled` | neutral-50 | neutral-100 |
|
|
142
|
-
| `--u-input-bg-color` | neutral-0 | neutral-200 |
|
|
143
|
-
| `--u-panel-bg-color` | neutral-0 | neutral-200 |
|
|
144
|
-
| `--u-overlay-bg-color` | `rgba(0,0,0,0.5)` | `rgba(0,0,0,0.7)` |
|
|
145
|
-
| `--u-tooltip-bg-color` | `rgba(0,0,0,0.75)` | `rgba(255,255,255,0.85)` |
|
|
146
|
-
|
|
147
|
-
#### Shadow
|
|
148
|
-
|
|
149
|
-
| Variable | Light | Dark |
|
|
150
|
-
|----------|-------|------|
|
|
151
|
-
| `--u-shadow-color-weaker` | `rgba(0,0,0,0.04)` | `rgba(0,0,0,0.15)` |
|
|
152
|
-
| `--u-shadow-color-weak` | `rgba(0,0,0,0.08)` | `rgba(0,0,0,0.25)` |
|
|
153
|
-
| `--u-shadow-color-normal` | `rgba(0,0,0,0.12)` | `rgba(0,0,0,0.35)` |
|
|
154
|
-
| `--u-shadow-color-strong` | `rgba(0,0,0,0.16)` | `rgba(0,0,0,0.45)` |
|
|
155
|
-
| `--u-shadow-color-stronger` | `rgba(0,0,0,0.24)` | `rgba(0,0,0,0.60)` |
|
|
156
|
-
|
|
157
|
-
#### Scrollbar
|
|
158
|
-
|
|
159
|
-
| Variable | Light | Dark |
|
|
160
|
-
|----------|-------|------|
|
|
161
|
-
| `--u-scrollbar-color` | neutral-400 | neutral-500 |
|
|
162
|
-
| `--u-scrollbar-color-hover` | neutral-500 | neutral-600 |
|
|
163
|
-
| `--u-scrollbar-track-color` | `transparent` | `transparent` |
|
|
164
|
-
|
|
165
|
-
### Typography
|
|
166
|
-
|
|
167
|
-
| Variable | Value |
|
|
168
|
-
|----------|-------|
|
|
169
|
-
| `--u-font-base` | -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif |
|
|
170
|
-
| `--u-font-mono` | ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, monospace |
|
|
171
|
-
| `--u-font-serif` | 'Georgia', 'Times New Roman', Times, serif |
|
|
172
|
-
| `--u-font-display` | 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif |
|
|
173
|
-
| `--u-font-modern` | 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif |
|
|
174
|
-
| `--u-font-rounded` | 'Nunito', 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif |
|
|
175
|
-
|
|
176
|
-
### Color Palette
|
|
177
|
-
|
|
178
|
-
The base color palettes (`neutral`, `blue`, `green`, `yellow`, `red`) range from `0` (lightest) to `1000` (darkest) in light mode, and are inverted for dark mode.
|
|
179
|
-
|
|
180
|
-
```css
|
|
181
|
-
--u-neutral-{0|50|100|200|300|400|500|600|700|800|900|1000}
|
|
182
|
-
--u-blue-{0|100|200|300|400|500|600|700|800|900|1000}
|
|
183
|
-
--u-green-{0|100|200|300|400|500|600|700|800|900|1000}
|
|
184
|
-
--u-yellow-{0|100|200|300|400|500|600|700|800|900|1000}
|
|
185
|
-
--u-red-{0|100|200|300|400|500|600|700|800|900|1000}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### Customizing Styles
|
|
189
|
-
|
|
190
|
-
Override any `--u-*` variable on `:root` or on specific elements:
|
|
191
|
-
|
|
192
|
-
```css
|
|
193
|
-
/* Global override */
|
|
194
|
-
:root {
|
|
195
|
-
--u-blue-600: #3B82F6;
|
|
196
|
-
--u-font-base: 'Pretendard', sans-serif;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/* Scoped override */
|
|
200
|
-
u-button {
|
|
201
|
-
--u-bg-color: var(--my-brand-primary);
|
|
202
|
-
--u-txt-color: var(--my-brand-on-primary);
|
|
203
|
-
}
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### Integrating with External Design Systems
|
|
207
|
-
|
|
208
|
-
Bridge `--u-*` variables with your design tokens:
|
|
209
|
-
|
|
210
|
-
```css
|
|
211
|
-
/* Tailwind CSS bridge */
|
|
212
|
-
:root {
|
|
213
|
-
--u-blue-500: var(--color-blue-500);
|
|
214
|
-
--u-blue-600: var(--color-blue-600);
|
|
215
|
-
--u-neutral-0: var(--color-white);
|
|
216
|
-
--u-neutral-900: var(--color-gray-900);
|
|
217
|
-
--u-font-base: var(--font-sans);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/* Material Design bridge */
|
|
221
|
-
:root {
|
|
222
|
-
--u-blue-600: var(--md-sys-color-primary);
|
|
223
|
-
--u-bg-color: var(--md-sys-color-surface);
|
|
224
|
-
--u-txt-color: var(--md-sys-color-on-surface);
|
|
225
|
-
}
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
## Theming
|
|
229
|
-
|
|
230
|
-
### Setup
|
|
231
|
-
|
|
232
|
-
```typescript
|
|
233
|
-
import { Theme } from '@iyulab/components';
|
|
234
|
-
|
|
235
|
-
await Theme.init({
|
|
236
|
-
default: 'system', // 'light' | 'dark' | 'system'
|
|
237
|
-
useBuiltIn: true, // use built-in light/dark CSS (default: true)
|
|
238
|
-
store: { // persist theme preference
|
|
239
|
-
type: 'localStorage',
|
|
240
|
-
prefix: 'my-app',
|
|
241
|
-
},
|
|
242
|
-
});
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
### Switching Themes
|
|
246
|
-
|
|
247
|
-
```typescript
|
|
248
|
-
Theme.set('dark'); // apply dark theme
|
|
249
|
-
Theme.set('light'); // apply light theme
|
|
250
|
-
Theme.set('system'); // follow OS preference
|
|
251
|
-
const current = Theme.get(); // get current theme
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
### External Theme Toggle Integration
|
|
255
|
-
|
|
256
|
-
When using an external dark mode toggle (e.g., Tailwind's `dark:` class), disable built-in styles and bridge the variables:
|
|
257
|
-
|
|
258
|
-
```typescript
|
|
259
|
-
// Disable built-in theme styles
|
|
260
|
-
await Theme.init({ useBuiltIn: false });
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
```css
|
|
264
|
-
/* Provide your own light/dark values */
|
|
265
|
-
:root {
|
|
266
|
-
--u-bg-color: #ffffff;
|
|
267
|
-
--u-txt-color: #212121;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
[data-theme="dark"] {
|
|
271
|
-
--u-bg-color: #121212;
|
|
272
|
-
--u-txt-color: #d4d4d4;
|
|
273
|
-
}
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
## Core Dependencies
|
|
277
|
-
|
|
278
|
-
- [lit](https://www.npmjs.com/package/lit) - Fast web components framework
|
|
279
|
-
- [@floating-ui/dom](https://www.npmjs.com/package/@floating-ui/dom) - Positioning library for tooltips and popovers
|
|
280
|
-
|
|
281
|
-
## License
|
|
282
|
-
|
|
283
|
-
MIT © [iyulab](https://www.iyulab.com)
|
|
1
|
+
# @iyulab/components
|
|
2
|
+
|
|
3
|
+
Modern web components library built with Lit-Element for building reactive user interfaces.
|
|
4
|
+
|
|
5
|
+
Visit our [Demo Site](https://components.iyulab.com) to explore all components and their features.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @iyulab/components
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import "@iyulab/components";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Components
|
|
20
|
+
|
|
21
|
+
| Component | Tag | Description |
|
|
22
|
+
|-----------|-----|-------------|
|
|
23
|
+
| UAlert | `u-alert` | Alert messages with variants |
|
|
24
|
+
| UButton | `u-button` | Button with variants, loading state |
|
|
25
|
+
| UDialog | `u-dialog` | Modal dialog |
|
|
26
|
+
| UDrawer | `u-drawer` | Slide-in drawer panel |
|
|
27
|
+
| UDivider | `u-divider` | Visual divider |
|
|
28
|
+
| UForm | `u-form` | Form container with validation |
|
|
29
|
+
| UIcon | `u-icon` | Icon display |
|
|
30
|
+
| UInput | `u-input` | Text input with validation |
|
|
31
|
+
| UMenu | `u-menu` | Dropdown/context menu |
|
|
32
|
+
| UMenuItem | `u-menu-item` | Menu item |
|
|
33
|
+
| UProgressBar | `u-progress-bar` | Progress bar |
|
|
34
|
+
| UProgressRing | `u-progress-ring` | Circular progress indicator |
|
|
35
|
+
| USkeleton | `u-skeleton` | Loading placeholder |
|
|
36
|
+
| USpinner | `u-spinner` | Loading spinner |
|
|
37
|
+
| USplitPanel | `u-split-panel` | Resizable split panel |
|
|
38
|
+
| UTag | `u-tag` | Label/status tag |
|
|
39
|
+
| UTooltip | `u-tooltip` | Tooltip |
|
|
40
|
+
| UTree | `u-tree` | Tree view |
|
|
41
|
+
| UTreeItem | `u-tree-item` | Tree view item |
|
|
42
|
+
|
|
43
|
+
## Events
|
|
44
|
+
|
|
45
|
+
All custom events use the `u-<action>` naming convention. Events bubble across Shadow DOM boundaries (`bubbles: true`, `composed: true`).
|
|
46
|
+
|
|
47
|
+
### Event Reference
|
|
48
|
+
|
|
49
|
+
| Event | Emitted By | Detail | Description |
|
|
50
|
+
|-------|-----------|--------|-------------|
|
|
51
|
+
| `u-input` | `u-input` | `{ value: string }` | Fires on every keystroke (real-time input) |
|
|
52
|
+
| `u-change` | `u-input` | `{ value: string }` | Fires when value is committed (blur/enter) |
|
|
53
|
+
| `u-select` | `u-tree-item` | `{ value: string, item: UTreeItem }` | Fires when a leaf item is selected |
|
|
54
|
+
| `u-show` | `u-dialog`, `u-drawer`, `u-tooltip` | — | Fires when the element becomes visible |
|
|
55
|
+
| `u-hide` | `u-dialog`, `u-drawer`, `u-tooltip` | — | Fires when the element is hidden |
|
|
56
|
+
| `u-toggle` | `u-tree-item` | `{ expanded: boolean, item: UTreeItem }` | Fires when a branch item expands/collapses |
|
|
57
|
+
| `u-resize` | `u-split-panel` | — | Fires when the panel is resized |
|
|
58
|
+
|
|
59
|
+
### TypeScript Support
|
|
60
|
+
|
|
61
|
+
All events are typed and registered on `GlobalEventHandlersEventMap`:
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import type { UInputEvent, UChangeEvent, USelectEvent, UShowEvent, UHideEvent, UResizeEvent } from '@iyulab/components';
|
|
65
|
+
|
|
66
|
+
element.addEventListener('u-input', (e: UInputEvent) => {
|
|
67
|
+
console.log(e.detail.value);
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Listening to Events
|
|
72
|
+
|
|
73
|
+
```html
|
|
74
|
+
<!-- Lit template -->
|
|
75
|
+
<u-input @u-input=${this.handleInput} @u-change=${this.handleChange}></u-input>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
// Vanilla JS
|
|
80
|
+
document.querySelector('u-input').addEventListener('u-input', (e) => {
|
|
81
|
+
console.log('Real-time value:', e.detail.value);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
document.querySelector('u-input').addEventListener('u-change', (e) => {
|
|
85
|
+
console.log('Committed value:', e.detail.value);
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## CSS Custom Properties
|
|
90
|
+
|
|
91
|
+
All CSS custom properties use the `--u-` prefix and are defined on `:root`. They respond to light/dark theme changes automatically.
|
|
92
|
+
|
|
93
|
+
### Semantic Colors
|
|
94
|
+
|
|
95
|
+
These variables reference the color palette and should be used in most cases:
|
|
96
|
+
|
|
97
|
+
#### Text
|
|
98
|
+
|
|
99
|
+
| Variable | Light | Dark |
|
|
100
|
+
|----------|-------|------|
|
|
101
|
+
| `--u-txt-color` | neutral-900 | neutral-900 |
|
|
102
|
+
| `--u-txt-color-inverse` | neutral-0 | neutral-100 |
|
|
103
|
+
| `--u-txt-color-hover` | blue-600 | blue-600 |
|
|
104
|
+
| `--u-txt-color-active` | blue-600 | blue-600 |
|
|
105
|
+
| `--u-txt-color-disabled` | neutral-400 | neutral-500 |
|
|
106
|
+
| `--u-txt-color-weak` | neutral-700 | neutral-700 |
|
|
107
|
+
| `--u-txt-color-strong` | neutral-1000 | neutral-1000 |
|
|
108
|
+
| `--u-link-txt-color` | blue-700 | blue-700 |
|
|
109
|
+
| `--u-tooltip-txt-color` | neutral-0 | neutral-100 |
|
|
110
|
+
|
|
111
|
+
#### Icon
|
|
112
|
+
|
|
113
|
+
| Variable | Light | Dark |
|
|
114
|
+
|----------|-------|------|
|
|
115
|
+
| `--u-icon-color` | neutral-700 | neutral-800 |
|
|
116
|
+
| `--u-icon-color-inverse` | neutral-0 | neutral-100 |
|
|
117
|
+
| `--u-icon-color-hover` | blue-600 | blue-600 |
|
|
118
|
+
| `--u-icon-color-active` | blue-600 | blue-600 |
|
|
119
|
+
| `--u-icon-color-disabled` | neutral-400 | neutral-500 |
|
|
120
|
+
|
|
121
|
+
#### Border
|
|
122
|
+
|
|
123
|
+
| Variable | Light | Dark |
|
|
124
|
+
|----------|-------|------|
|
|
125
|
+
| `--u-border-color` | neutral-300 | neutral-400 |
|
|
126
|
+
| `--u-border-color-weak` | neutral-200 | neutral-300 |
|
|
127
|
+
| `--u-border-color-strong` | neutral-400 | neutral-500 |
|
|
128
|
+
| `--u-input-border-color` | neutral-300 | neutral-400 |
|
|
129
|
+
| `--u-input-border-color-hover` | neutral-400 | neutral-500 |
|
|
130
|
+
| `--u-input-border-color-focus` | blue-600 | blue-600 |
|
|
131
|
+
| `--u-input-border-color-invalid` | red-600 | red-600 |
|
|
132
|
+
|
|
133
|
+
#### Background
|
|
134
|
+
|
|
135
|
+
| Variable | Light | Dark |
|
|
136
|
+
|----------|-------|------|
|
|
137
|
+
| `--u-bg-color` | neutral-0 | neutral-100 |
|
|
138
|
+
| `--u-bg-color-inverse` | neutral-900 | neutral-0 |
|
|
139
|
+
| `--u-bg-color-hover` | neutral-100 | neutral-300 |
|
|
140
|
+
| `--u-bg-color-active` | neutral-200 | neutral-400 |
|
|
141
|
+
| `--u-bg-color-disabled` | neutral-50 | neutral-100 |
|
|
142
|
+
| `--u-input-bg-color` | neutral-0 | neutral-200 |
|
|
143
|
+
| `--u-panel-bg-color` | neutral-0 | neutral-200 |
|
|
144
|
+
| `--u-overlay-bg-color` | `rgba(0,0,0,0.5)` | `rgba(0,0,0,0.7)` |
|
|
145
|
+
| `--u-tooltip-bg-color` | `rgba(0,0,0,0.75)` | `rgba(255,255,255,0.85)` |
|
|
146
|
+
|
|
147
|
+
#### Shadow
|
|
148
|
+
|
|
149
|
+
| Variable | Light | Dark |
|
|
150
|
+
|----------|-------|------|
|
|
151
|
+
| `--u-shadow-color-weaker` | `rgba(0,0,0,0.04)` | `rgba(0,0,0,0.15)` |
|
|
152
|
+
| `--u-shadow-color-weak` | `rgba(0,0,0,0.08)` | `rgba(0,0,0,0.25)` |
|
|
153
|
+
| `--u-shadow-color-normal` | `rgba(0,0,0,0.12)` | `rgba(0,0,0,0.35)` |
|
|
154
|
+
| `--u-shadow-color-strong` | `rgba(0,0,0,0.16)` | `rgba(0,0,0,0.45)` |
|
|
155
|
+
| `--u-shadow-color-stronger` | `rgba(0,0,0,0.24)` | `rgba(0,0,0,0.60)` |
|
|
156
|
+
|
|
157
|
+
#### Scrollbar
|
|
158
|
+
|
|
159
|
+
| Variable | Light | Dark |
|
|
160
|
+
|----------|-------|------|
|
|
161
|
+
| `--u-scrollbar-color` | neutral-400 | neutral-500 |
|
|
162
|
+
| `--u-scrollbar-color-hover` | neutral-500 | neutral-600 |
|
|
163
|
+
| `--u-scrollbar-track-color` | `transparent` | `transparent` |
|
|
164
|
+
|
|
165
|
+
### Typography
|
|
166
|
+
|
|
167
|
+
| Variable | Value |
|
|
168
|
+
|----------|-------|
|
|
169
|
+
| `--u-font-base` | -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif |
|
|
170
|
+
| `--u-font-mono` | ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, monospace |
|
|
171
|
+
| `--u-font-serif` | 'Georgia', 'Times New Roman', Times, serif |
|
|
172
|
+
| `--u-font-display` | 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif |
|
|
173
|
+
| `--u-font-modern` | 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif |
|
|
174
|
+
| `--u-font-rounded` | 'Nunito', 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif |
|
|
175
|
+
|
|
176
|
+
### Color Palette
|
|
177
|
+
|
|
178
|
+
The base color palettes (`neutral`, `blue`, `green`, `yellow`, `red`) range from `0` (lightest) to `1000` (darkest) in light mode, and are inverted for dark mode.
|
|
179
|
+
|
|
180
|
+
```css
|
|
181
|
+
--u-neutral-{0|50|100|200|300|400|500|600|700|800|900|1000}
|
|
182
|
+
--u-blue-{0|100|200|300|400|500|600|700|800|900|1000}
|
|
183
|
+
--u-green-{0|100|200|300|400|500|600|700|800|900|1000}
|
|
184
|
+
--u-yellow-{0|100|200|300|400|500|600|700|800|900|1000}
|
|
185
|
+
--u-red-{0|100|200|300|400|500|600|700|800|900|1000}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Customizing Styles
|
|
189
|
+
|
|
190
|
+
Override any `--u-*` variable on `:root` or on specific elements:
|
|
191
|
+
|
|
192
|
+
```css
|
|
193
|
+
/* Global override */
|
|
194
|
+
:root {
|
|
195
|
+
--u-blue-600: #3B82F6;
|
|
196
|
+
--u-font-base: 'Pretendard', sans-serif;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/* Scoped override */
|
|
200
|
+
u-button {
|
|
201
|
+
--u-bg-color: var(--my-brand-primary);
|
|
202
|
+
--u-txt-color: var(--my-brand-on-primary);
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Integrating with External Design Systems
|
|
207
|
+
|
|
208
|
+
Bridge `--u-*` variables with your design tokens:
|
|
209
|
+
|
|
210
|
+
```css
|
|
211
|
+
/* Tailwind CSS bridge */
|
|
212
|
+
:root {
|
|
213
|
+
--u-blue-500: var(--color-blue-500);
|
|
214
|
+
--u-blue-600: var(--color-blue-600);
|
|
215
|
+
--u-neutral-0: var(--color-white);
|
|
216
|
+
--u-neutral-900: var(--color-gray-900);
|
|
217
|
+
--u-font-base: var(--font-sans);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/* Material Design bridge */
|
|
221
|
+
:root {
|
|
222
|
+
--u-blue-600: var(--md-sys-color-primary);
|
|
223
|
+
--u-bg-color: var(--md-sys-color-surface);
|
|
224
|
+
--u-txt-color: var(--md-sys-color-on-surface);
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Theming
|
|
229
|
+
|
|
230
|
+
### Setup
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
import { Theme } from '@iyulab/components';
|
|
234
|
+
|
|
235
|
+
await Theme.init({
|
|
236
|
+
default: 'system', // 'light' | 'dark' | 'system'
|
|
237
|
+
useBuiltIn: true, // use built-in light/dark CSS (default: true)
|
|
238
|
+
store: { // persist theme preference
|
|
239
|
+
type: 'localStorage',
|
|
240
|
+
prefix: 'my-app',
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Switching Themes
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
Theme.set('dark'); // apply dark theme
|
|
249
|
+
Theme.set('light'); // apply light theme
|
|
250
|
+
Theme.set('system'); // follow OS preference
|
|
251
|
+
const current = Theme.get(); // get current theme
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### External Theme Toggle Integration
|
|
255
|
+
|
|
256
|
+
When using an external dark mode toggle (e.g., Tailwind's `dark:` class), disable built-in styles and bridge the variables:
|
|
257
|
+
|
|
258
|
+
```typescript
|
|
259
|
+
// Disable built-in theme styles
|
|
260
|
+
await Theme.init({ useBuiltIn: false });
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
```css
|
|
264
|
+
/* Provide your own light/dark values */
|
|
265
|
+
:root {
|
|
266
|
+
--u-bg-color: #ffffff;
|
|
267
|
+
--u-txt-color: #212121;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
[data-theme="dark"] {
|
|
271
|
+
--u-bg-color: #121212;
|
|
272
|
+
--u-txt-color: #d4d4d4;
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Core Dependencies
|
|
277
|
+
|
|
278
|
+
- [lit](https://www.npmjs.com/package/lit) - Fast web components framework
|
|
279
|
+
- [@floating-ui/dom](https://www.npmjs.com/package/@floating-ui/dom) - Positioning library for tooltips and popovers
|
|
280
|
+
|
|
281
|
+
## License
|
|
282
|
+
|
|
283
|
+
MIT © [iyulab](https://www.iyulab.com)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const arrowDown = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\
|
|
1
|
+
const arrowDown = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path stroke=\"currentColor\" stroke-width=\"1.5\" d=\"M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1\"/>\n</svg>";
|
|
2
2
|
|
|
3
3
|
export { arrowDown as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const arrowRepeat = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\
|
|
1
|
+
const arrowRepeat = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41m-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9\"/>\n <path fill-rule=\"evenodd\" d=\"M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5 5 0 0 0 8 3M3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9z\"/>\n</svg>";
|
|
2
2
|
|
|
3
3
|
export { arrowRepeat as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const arrowUp = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\
|
|
1
|
+
const arrowUp = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path stroke=\"currentColor\" stroke-width=\"1.5\" d=\"M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5\"/>\n</svg>";
|
|
2
2
|
|
|
3
3
|
export { arrowUp as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const ban = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\
|
|
1
|
+
const ban = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M15 8a6.97 6.97 0 0 0-1.71-4.584l-9.874 9.875A7 7 0 0 0 15 8M2.71 12.584l9.874-9.875a7 7 0 0 0-9.874 9.874ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0\"/>\n</svg>";
|
|
2
2
|
|
|
3
3
|
export { ban as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const bellFill = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\
|
|
1
|
+
const bellFill = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M8 16a2 2 0 0 0 2-2H6a2 2 0 0 0 2 2m.995-14.901a1 1 0 1 0-1.99 0A5 5 0 0 0 3 6c0 1.098-.5 6-2 7h14c-1.5-1-2-5.902-2-7 0-2.42-1.72-4.44-4.005-4.901\"/>\n</svg>";
|
|
2
2
|
|
|
3
3
|
export { bellFill as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const boxArrowUpRight = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\
|
|
1
|
+
const boxArrowUpRight = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5\"/>\n <path fill-rule=\"evenodd\" d=\"M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0z\"/>\n</svg>";
|
|
2
2
|
|
|
3
3
|
export { boxArrowUpRight as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const checkCircleFill = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\
|
|
1
|
+
const checkCircleFill = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z\"/>\n</svg>";
|
|
2
2
|
|
|
3
3
|
export { checkCircleFill as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const checkLg = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\
|
|
1
|
+
const checkLg = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M12.736 3.97a.733.733 0 0 1 1.047 0c.286.289.29.756.01 1.05L7.88 12.01a.733.733 0 0 1-1.065.02L3.217 8.384a.757.757 0 0 1 0-1.06.733.733 0 0 1 1.047 0l3.052 3.093 5.4-6.425z\"/>\n</svg>";
|
|
2
2
|
|
|
3
3
|
export { checkLg as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const chevronDown = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\
|
|
1
|
+
const chevronDown = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708\"></path>\n</svg>";
|
|
2
2
|
|
|
3
3
|
export { chevronDown as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const chevronLeft = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\
|
|
1
|
+
const chevronLeft = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0\"/>\n</svg>";
|
|
2
2
|
|
|
3
3
|
export { chevronLeft as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const chevronRight = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\
|
|
1
|
+
const chevronRight = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708\"/>\n</svg>";
|
|
2
2
|
|
|
3
3
|
export { chevronRight as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const chevronUp = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\
|
|
1
|
+
const chevronUp = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708z\"></path>\n</svg>";
|
|
2
2
|
|
|
3
3
|
export { chevronUp as default };
|