@rockshin/tao-ui 0.0.6 → 0.0.7

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.
@@ -1,8 +1,24 @@
1
1
  [data-tao-select] {
2
- align-items: center;
2
+ --tao-select-height: var(--tao-control-height);
3
+ --tao-select-font-size: var(--tao-font-size-base);
4
+ --tao-select-line-height: var(--tao-line-height);
5
+ --tao-select-padding-inline: var(--tao-padding-sm);
6
+ --tao-select-padding-block: calc((
7
+ var(--tao-select-height) -
8
+ var(--tao-select-font-size) *
9
+ var(--tao-select-line-height)
10
+ ) /
11
+ 2 -
12
+ var(--tao-line-width));
13
+ align-items: flex-start;
3
14
  gap: var(--tao-padding-xs);
4
15
  width: 100%;
5
16
  font-family: var(--tao-font-family);
17
+ font-size: var(--tao-select-font-size);
18
+ line-height: var(--tao-select-line-height);
19
+ height: var(--tao-select-height);
20
+ padding-block: max(var(--tao-select-padding-block), 0px);
21
+ padding-inline: var(--tao-select-padding-inline);
6
22
  cursor: pointer;
7
23
  outline: none;
8
24
  display: flex;
@@ -18,39 +34,44 @@ button[data-tao-select] {
18
34
  white-space: nowrap;
19
35
  min-width: 0;
20
36
  color: var(--tao-color-text);
37
+ line-height: var(--tao-select-line-height);
21
38
  flex: 1;
39
+ align-self: center;
40
+ display: block;
22
41
  overflow: hidden;
23
42
  }
24
43
 
25
44
  [data-tao-select-placeholder] {
26
45
  color: var(--tao-color-text-placeholder);
46
+ line-height: var(--tao-select-line-height);
27
47
  }
28
48
 
29
49
  [data-tao-select][data-tao-size="small"] {
30
- height: var(--tao-control-height-sm);
31
- padding-inline: var(--tao-padding-xs);
32
- font-size: var(--tao-font-size-sm);
50
+ --tao-select-height: var(--tao-control-height-sm);
51
+ --tao-select-font-size: var(--tao-font-size-sm);
52
+ --tao-select-line-height: var(--tao-line-height-sm);
53
+ --tao-select-padding-inline: var(--tao-padding-xs);
33
54
  border-radius: var(--tao-radius-sm);
34
55
  }
35
56
 
36
57
  [data-tao-select][data-tao-size="medium"] {
37
- height: var(--tao-control-height);
38
- padding-inline: var(--tao-padding-sm);
39
- font-size: var(--tao-font-size-base);
40
58
  border-radius: var(--tao-radius-md);
41
59
  }
42
60
 
43
61
  [data-tao-select][data-tao-size="large"] {
44
- height: var(--tao-control-height-lg);
45
- padding-inline: var(--tao-padding-sm);
46
- font-size: var(--tao-font-size-lg);
62
+ --tao-select-height: var(--tao-control-height-lg);
63
+ --tao-select-font-size: var(--tao-font-size-lg);
64
+ --tao-select-line-height: var(--tao-line-height-lg);
47
65
  border-radius: var(--tao-radius-md);
48
66
  }
49
67
 
50
68
  [data-tao-select-prefix] {
51
69
  color: var(--tao-color-text-tertiary);
52
70
  flex-shrink: 0;
71
+ justify-content: center;
72
+ align-self: center;
53
73
  align-items: center;
74
+ line-height: 0;
54
75
  display: flex;
55
76
  }
56
77
 
@@ -58,6 +79,7 @@ button[data-tao-select] {
58
79
  border-radius: var(--tao-radius-sm);
59
80
  flex: none;
60
81
  justify-content: center;
82
+ align-self: center;
61
83
  align-items: center;
62
84
  width: 1.25rem;
63
85
  height: 1.25rem;
@@ -73,9 +95,12 @@ button[data-tao-select] {
73
95
 
74
96
  [data-tao-select-icons] {
75
97
  flex-shrink: 0;
98
+ justify-content: center;
99
+ align-self: center;
76
100
  align-items: center;
77
101
  gap: 4px;
78
102
  margin-inline-start: auto;
103
+ line-height: 0;
79
104
  display: flex;
80
105
  position: relative;
81
106
  }
@@ -167,14 +192,17 @@ button[data-tao-select] {
167
192
  [data-tao-select-search] {
168
193
  align-items: center;
169
194
  gap: var(--tao-padding-xs);
195
+ min-height: var(--tao-control-height);
170
196
  padding: var(--tao-padding-xs) var(--tao-padding-sm);
171
197
  border-block-end: var(--tao-line-width) solid
172
198
  var(--tao-color-border-secondary);
173
199
  color: var(--tao-color-text-tertiary);
200
+ line-height: 1;
174
201
  display: flex;
175
202
  }
176
203
 
177
204
  [data-tao-select-search-input] {
205
+ height: calc(var(--tao-control-height) - var(--tao-padding-xs) * 2);
178
206
  font-family: var(--tao-font-family);
179
207
  font-size: var(--tao-font-size-base);
180
208
  color: var(--tao-color-text);
@@ -183,6 +211,7 @@ button[data-tao-select] {
183
211
  outline: none;
184
212
  flex: 1;
185
213
  min-width: 0;
214
+ line-height: 1;
186
215
  }
187
216
 
188
217
  [data-tao-select-search-input]::placeholder {
@@ -221,6 +250,7 @@ button[data-tao-select] {
221
250
  var(--tao-motion-ease-out);
222
251
  outline: none;
223
252
  align-items: center;
253
+ line-height: 1;
224
254
  display: flex;
225
255
  }
226
256
 
@@ -265,7 +295,9 @@ button[data-tao-select] {
265
295
  [data-tao-select-item-main] {
266
296
  flex-direction: column;
267
297
  flex: 1;
298
+ justify-content: center;
268
299
  min-width: 0;
300
+ line-height: 1;
269
301
  display: flex;
270
302
  }
271
303
 
@@ -95,8 +95,7 @@ function Select(props) {
95
95
  isSearchControlled,
96
96
  onSearch
97
97
  ]);
98
- const handleClear = useCallback((e)=>{
99
- e.stopPropagation();
98
+ const clearValue = useCallback(()=>{
100
99
  if (!isValueControlled) setValueInternal(void 0);
101
100
  onChange?.('', void 0);
102
101
  onClear?.();
@@ -105,6 +104,12 @@ function Select(props) {
105
104
  onChange,
106
105
  onClear
107
106
  ]);
107
+ const handleClear = useCallback((e)=>{
108
+ e.stopPropagation();
109
+ clearValue();
110
+ }, [
111
+ clearValue
112
+ ]);
108
113
  const filteredOptions = useMemo(()=>{
109
114
  if (!showSearch || !search) return options;
110
115
  const fn = filterOption ?? defaultFilter;
@@ -141,7 +146,15 @@ function Select(props) {
141
146
  style: styles?.clear,
142
147
  onPointerDown: (e_0)=>e_0.stopPropagation(),
143
148
  onClick: handleClear,
149
+ onKeyDown: (e_1)=>{
150
+ if ('Enter' === e_1.key || ' ' === e_1.key) {
151
+ e_1.preventDefault();
152
+ e_1.stopPropagation();
153
+ clearValue();
154
+ }
155
+ },
144
156
  role: "button",
157
+ tabIndex: 0,
145
158
  "aria-label": "Clear",
146
159
  children: clearIcon
147
160
  }) : /*#__PURE__*/ jsx("span", {
@@ -293,7 +306,7 @@ function Select(props) {
293
306
  /*#__PURE__*/ jsx("input", {
294
307
  "data-tao-select-search-input": "",
295
308
  value: search,
296
- onChange: (e_1)=>handleSearchChange(e_1.target.value),
309
+ onChange: (e_2)=>handleSearchChange(e_2.target.value),
297
310
  placeholder: "Search...",
298
311
  autoFocus: true
299
312
  })
@@ -389,6 +402,8 @@ function ChevronDownIcon() {
389
402
  strokeWidth: "2",
390
403
  strokeLinecap: "round",
391
404
  strokeLinejoin: "round",
405
+ "aria-hidden": "true",
406
+ role: "presentation",
392
407
  children: /*#__PURE__*/ jsx("path", {
393
408
  d: "m6 9 6 6 6-6"
394
409
  })
@@ -432,6 +447,8 @@ function CheckIcon() {
432
447
  strokeWidth: "2.5",
433
448
  strokeLinecap: "round",
434
449
  strokeLinejoin: "round",
450
+ "aria-hidden": "true",
451
+ role: "presentation",
435
452
  children: /*#__PURE__*/ jsx("polyline", {
436
453
  points: "20 6 9 17 4 12"
437
454
  })
@@ -453,6 +470,8 @@ function CloseIcon() {
453
470
  strokeWidth: "2",
454
471
  strokeLinecap: "round",
455
472
  strokeLinejoin: "round",
473
+ "aria-hidden": "true",
474
+ role: "presentation",
456
475
  children: /*#__PURE__*/ jsx("path", {
457
476
  d: "M18 6 6 18M6 6l12 12"
458
477
  })
@@ -474,6 +493,8 @@ function SearchIcon() {
474
493
  strokeWidth: "2",
475
494
  strokeLinecap: "round",
476
495
  strokeLinejoin: "round",
496
+ "aria-hidden": "true",
497
+ role: "presentation",
477
498
  children: [
478
499
  /*#__PURE__*/ jsx("circle", {
479
500
  cx: "11",
@@ -503,6 +524,8 @@ function LoadingIcon() {
503
524
  strokeWidth: "2",
504
525
  strokeLinecap: "round",
505
526
  strokeLinejoin: "round",
527
+ "aria-hidden": "true",
528
+ role: "presentation",
506
529
  children: /*#__PURE__*/ jsx("path", {
507
530
  d: "M21 12a9 9 0 1 1-6.219-8.56"
508
531
  })
@@ -4,19 +4,29 @@
4
4
  --tao-table-cell-bg: transparent;
5
5
  --tao-table-header-bg: transparent;
6
6
  --tao-table-header-color: var(--tao-color-text-secondary);
7
- --tao-table-row-hover-bg: oklch(0% 0 0 / .02);
7
+ --tao-table-row-hover-bg: #fafafa;
8
8
  --tao-table-row-selected-bg: oklch(0% 0 0 / .05);
9
9
  --tao-table-row-selected-hover-bg: oklch(0% 0 0 / .07);
10
+ --tao-table-border-color: var(--tao-color-border-secondary);
11
+ --tao-table-frame-radius: var(--tao-radius-md);
10
12
  position: relative;
11
13
  }
12
14
 
13
15
  [data-tao-table-wrapper][data-tao-variant="filled"], [data-tao-table-wrapper][data-tao-variant="outlined"] {
14
16
  --tao-table-header-bg: oklch(98.5% 0 0);
15
- --tao-table-row-hover-bg: oklch(98.5% 0 0);
16
17
  --tao-table-row-selected-bg: var(--tao-primary-bg);
17
18
  --tao-table-row-selected-hover-bg: var(--tao-primary-bg-hover);
18
19
  }
19
20
 
21
+ [data-tao-table-wrapper][data-tao-variant="modern"] {
22
+ --tao-table-header-bg: var(--tao-color-bg-container);
23
+ --tao-table-header-color: var(--tao-color-text-secondary);
24
+ --tao-table-row-selected-bg: var(--tao-primary-bg);
25
+ --tao-table-row-selected-hover-bg: var(--tao-primary-bg-hover);
26
+ --tao-table-border-color: var(--tao-color-border);
27
+ --tao-table-frame-radius: var(--tao-radius-md);
28
+ }
29
+
20
30
  [data-tao-table-wrapper][data-tao-header-bg="off"] {
21
31
  --tao-table-header-bg: transparent;
22
32
  }
@@ -26,6 +36,12 @@
26
36
  overflow-x: auto;
27
37
  }
28
38
 
39
+ [data-tao-table-wrapper][data-tao-variant="modern"] [data-tao-table-scroll] {
40
+ border: var(--tao-line-width) solid var(--tao-table-border-color);
41
+ border-radius: var(--tao-table-frame-radius);
42
+ background: var(--tao-color-bg-container);
43
+ }
44
+
29
45
  [data-tao-table] {
30
46
  border-collapse: collapse;
31
47
  table-layout: auto;
@@ -39,7 +55,7 @@
39
55
  [data-tao-table-cell] {
40
56
  padding: var(--tao-padding-sm) var(--tao-padding);
41
57
  text-align: left;
42
- border-bottom: var(--tao-line-width) solid var(--tao-color-border-secondary);
58
+ border-bottom: var(--tao-line-width) solid var(--tao-table-border-color);
43
59
  background: var(--tao-table-cell-bg);
44
60
  transition: background-color var(--tao-motion-duration-fast)
45
61
  var(--tao-motion-ease-out);
@@ -66,12 +82,24 @@
66
82
  white-space: nowrap;
67
83
  }
68
84
 
85
+ [data-tao-table-wrapper][data-tao-variant="modern"] [data-tao-table-thead] [data-tao-table-cell] {
86
+ font-size: var(--tao-font-size-sm);
87
+ }
88
+
69
89
  [data-tao-table-header-content] {
70
90
  align-items: center;
71
91
  gap: var(--tao-padding-xxs);
72
92
  display: flex;
73
93
  }
74
94
 
95
+ [data-tao-table-cell][data-tao-align="center"] [data-tao-table-header-content] {
96
+ justify-content: center;
97
+ }
98
+
99
+ [data-tao-table-cell][data-tao-align="right"] [data-tao-table-header-content] {
100
+ justify-content: flex-end;
101
+ }
102
+
75
103
  [data-tao-table-header-title] {
76
104
  align-items: center;
77
105
  gap: 2px;
@@ -277,18 +305,30 @@
277
305
  }
278
306
 
279
307
  [data-tao-table-wrapper][data-tao-bordered] [data-tao-table] {
280
- border: var(--tao-line-width) solid var(--tao-color-border-secondary);
281
- border-radius: var(--tao-radius-md);
308
+ border: var(--tao-line-width) solid var(--tao-table-border-color);
309
+ border-radius: var(--tao-table-frame-radius);
282
310
  }
283
311
 
284
312
  [data-tao-table-wrapper][data-tao-bordered] [data-tao-table-cell] {
285
- border-right: var(--tao-line-width) solid var(--tao-color-border-secondary);
313
+ border-right: var(--tao-line-width) solid var(--tao-table-border-color);
286
314
  }
287
315
 
288
316
  [data-tao-table-wrapper][data-tao-bordered] tr > [data-tao-table-cell]:last-child {
289
317
  border-right: none;
290
318
  }
291
319
 
320
+ [data-tao-table-wrapper][data-tao-variant="modern"][data-tao-bordered] [data-tao-table] {
321
+ border: none;
322
+ }
323
+
324
+ [data-tao-table-wrapper][data-tao-variant="modern"][data-tao-bordered] [data-tao-table-cell] {
325
+ border-right: none;
326
+ }
327
+
328
+ [data-tao-table-wrapper][data-tao-variant="modern"] [data-tao-table-tbody] tr:last-child [data-tao-table-cell] {
329
+ border-bottom: none;
330
+ }
331
+
292
332
  [data-tao-table-wrapper][data-tao-size="small"] [data-tao-table-cell] {
293
333
  padding: var(--tao-padding-xxs) var(--tao-padding-xs);
294
334
  font-size: var(--tao-font-size-sm);
@@ -3,6 +3,7 @@ import { type TaoSize, type TaoVariant } from '../../provider/tao-provider';
3
3
  import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
4
4
  import './table.css';
5
5
  export type TableSemanticPart = 'root' | 'header.cell' | 'body.row' | 'body.cell' | 'pagination';
6
+ export type TableVariant = TaoVariant | 'modern';
6
7
  export type SortOrder = 'ascend' | 'descend' | null;
7
8
  export interface TableFilterItem {
8
9
  text: ReactNode;
@@ -67,13 +68,14 @@ export interface TableProps<T = any> {
67
68
  /**
68
69
  * 表面风格。
69
70
  * - `borderless`(极简):无表头底色、单元格透明、仅行底分隔线。
70
- * - `filled`:表头灰底(库的默认表现)。
71
+ * - `filled`:表头灰底。
71
72
  * - `outlined`:filled + 整体外框 + 列分隔线。
73
+ * - `modern`:轻外框、圆角、克制表头,更接近 shadcn 的表格视觉。
72
74
  *
73
75
  * 不传时继承 TaoProvider 的 variant;当继承到框架默认 `outlined` 时,
74
- * Table 回落为 `filled` 以保持向后兼容(裸用 `<Table>` 仍是灰底表头)。
76
+ * Table 回落为 `modern`,让裸用 `<Table>` 默认呈现现代轻外框风格。
75
77
  */
76
- variant?: TaoVariant;
78
+ variant?: TableVariant;
77
79
  /**
78
80
  * 表头灰底开关,默认 `true`。设为 `false` 关掉表头底色(极简表头),
79
81
  * 不影响外框 / 列分隔线等其它 variant 表现。
@@ -297,8 +297,8 @@ function Table(t0) {
297
297
  const bordered = void 0 === t4 ? false : t4;
298
298
  const ctx = useTaoConfig();
299
299
  const resolvedSize = size ?? ctx.size;
300
- const resolvedVariant = variant ?? ("outlined" === ctx.variant ? "filled" : ctx.variant);
301
- const showBorder = "outlined" === resolvedVariant || bordered && "borderless" !== resolvedVariant;
300
+ const resolvedVariant = variant ?? ("outlined" === ctx.variant ? "modern" : ctx.variant);
301
+ const showBorder = "outlined" === resolvedVariant || "modern" === resolvedVariant || bordered && "borderless" !== resolvedVariant;
302
302
  let defaultSortCol;
303
303
  let t5;
304
304
  let t6;
@@ -1,48 +1,79 @@
1
1
  [data-tao-tag] {
2
+ box-sizing: border-box;
3
+ min-height: calc(var(--tao-font-size-xs) *
4
+ var(--tao-line-height-sm) +
5
+ var(--tao-line-width) *
6
+ 2);
2
7
  font-family: var(--tao-font-family);
3
8
  font-size: var(--tao-font-size-xs);
4
- font-weight: var(--tao-font-weight-medium);
5
- border-radius: var(--tao-radius-sm);
9
+ font-weight: var(--tao-font-weight-strong);
10
+ line-height: var(--tao-line-height-sm);
11
+ border-radius: var(--tao-radius-md);
6
12
  border: var(--tao-line-width) solid transparent;
7
13
  white-space: nowrap;
8
14
  cursor: default;
9
15
  -webkit-user-select: none;
10
16
  user-select: none;
17
+ box-shadow: none;
11
18
  transition: background-color var(--tao-motion-duration-fast) var(--tao-motion-ease-out),
12
19
  border-color var(--tao-motion-duration-fast) var(--tao-motion-ease-out),
13
20
  color var(--tao-motion-duration-fast) var(--tao-motion-ease-out),
21
+ box-shadow var(--tao-motion-duration-fast) var(--tao-motion-ease-out),
14
22
  opacity var(--tao-motion-duration-fast) var(--tao-motion-ease-out);
23
+ justify-content: center;
15
24
  align-items: center;
16
- gap: 4px;
17
- padding: 3px 8px;
18
- line-height: 1;
25
+ gap: 6px;
26
+ padding-block: 0;
27
+ padding-inline: 8px;
19
28
  display: inline-flex;
20
29
  }
21
30
 
22
31
  [data-tao-tag-icon] {
32
+ flex: none;
33
+ justify-content: center;
34
+ align-items: center;
35
+ font-size: 12px;
36
+ line-height: 0;
37
+ display: inline-flex;
38
+ }
39
+
40
+ [data-tao-tag-content] {
41
+ line-height: inherit;
23
42
  align-items: center;
24
- font-size: 14px;
25
43
  display: inline-flex;
26
44
  }
27
45
 
46
+ [data-tao-tag]:not([data-tao-closable]) [data-tao-tag-content] {
47
+ transform: translateY(-.03em);
48
+ }
49
+
28
50
  [data-tao-tag-close] {
29
51
  cursor: pointer;
30
- border-radius: var(--tao-radius-xs);
31
- opacity: .6;
32
- transition: opacity var(--tao-motion-duration-fast) var(--tao-motion-ease-out),
33
- background-color var(--tao-motion-duration-fast) var(--tao-motion-ease-out);
52
+ border-radius: var(--tao-radius-full);
53
+ width: 14px;
54
+ height: 14px;
55
+ color: color-mix(in oklch, currentColor 72%, transparent);
56
+ font: inherit;
57
+ transition: background-color var(--tao-motion-duration-fast) var(--tao-motion-ease-out),
58
+ color var(--tao-motion-duration-fast) var(--tao-motion-ease-out);
59
+ background: none;
60
+ border: 0;
61
+ flex: none;
62
+ justify-content: center;
34
63
  align-items: center;
35
- margin-inline: 2px -2px;
36
- padding: 1px;
64
+ margin-inline: -1px -4px;
65
+ padding: 0;
66
+ line-height: 1;
37
67
  display: inline-flex;
38
68
  }
39
69
 
40
70
  [data-tao-tag-close]:hover {
41
- opacity: 1;
71
+ background: color-mix(in oklch, currentColor 12%, transparent);
72
+ color: currentColor;
42
73
  }
43
74
 
44
75
  [data-tao-tag-close]:focus-visible {
45
- box-shadow: 0 0 0 2px var(--tao-control-outline);
76
+ box-shadow: 0 0 0 var(--tao-ring-width) var(--tao-control-outline);
46
77
  outline: none;
47
78
  }
48
79
 
@@ -52,111 +83,135 @@
52
83
  }
53
84
 
54
85
  [data-tao-tag][data-tao-color="default"][data-tao-variant="filled"] {
55
- background: var(--tao-color-fill-tertiary);
86
+ background: var(--tao-color-fill-secondary);
56
87
  color: var(--tao-color-text);
57
- border-color: #0000;
88
+ border-color: var(--tao-color-border-secondary);
89
+ box-shadow: var(--tao-box-shadow-xs);
58
90
  }
59
91
 
60
92
  [data-tao-tag][data-tao-color="primary"][data-tao-variant="filled"] {
61
- background: var(--tao-primary-bg);
93
+ background: color-mix(in oklch,
94
+ var(--tao-color-primary) 10%,
95
+ var(--tao-color-bg-base));
62
96
  color: var(--tao-primary);
63
- border-color: var(--tao-primary-border);
97
+ border-color: color-mix(in oklch,
98
+ var(--tao-color-primary) 18%,
99
+ var(--tao-color-bg-base));
64
100
  }
65
101
 
66
102
  [data-tao-tag][data-tao-color="success"][data-tao-variant="filled"] {
67
- background: var(--tao-success-bg);
103
+ background: color-mix(in oklch,
104
+ var(--tao-color-success) 10%,
105
+ var(--tao-color-bg-base));
68
106
  color: var(--tao-success);
69
- border-color: var(--tao-success-border);
107
+ border-color: color-mix(in oklch,
108
+ var(--tao-color-success) 18%,
109
+ var(--tao-color-bg-base));
70
110
  }
71
111
 
72
112
  [data-tao-tag][data-tao-color="warning"][data-tao-variant="filled"] {
73
- background: var(--tao-warning-bg);
113
+ background: color-mix(in oklch,
114
+ var(--tao-color-warning) 12%,
115
+ var(--tao-color-bg-base));
74
116
  color: var(--tao-warning);
75
- border-color: var(--tao-warning-border);
117
+ border-color: color-mix(in oklch,
118
+ var(--tao-color-warning) 22%,
119
+ var(--tao-color-bg-base));
76
120
  }
77
121
 
78
122
  [data-tao-tag][data-tao-color="error"][data-tao-variant="filled"] {
79
- background: var(--tao-error-bg);
123
+ background: color-mix(in oklch,
124
+ var(--tao-color-error) 10%,
125
+ var(--tao-color-bg-base));
80
126
  color: var(--tao-error);
81
- border-color: var(--tao-error-border);
127
+ border-color: color-mix(in oklch,
128
+ var(--tao-color-error) 18%,
129
+ var(--tao-color-bg-base));
82
130
  }
83
131
 
84
132
  [data-tao-tag][data-tao-color="default"][data-tao-variant="solid"] {
85
133
  background: var(--tao-color-text);
86
134
  color: var(--tao-color-bg-base);
135
+ box-shadow: var(--tao-box-shadow-xs);
87
136
  border-color: #0000;
88
137
  }
89
138
 
90
139
  [data-tao-tag][data-tao-color="primary"][data-tao-variant="solid"] {
91
140
  background: var(--tao-primary);
92
141
  color: var(--tao-primary-fg);
142
+ box-shadow: var(--tao-box-shadow-xs);
93
143
  border-color: #0000;
94
144
  }
95
145
 
96
146
  [data-tao-tag][data-tao-color="success"][data-tao-variant="solid"] {
97
147
  background: var(--tao-success);
98
148
  color: #fff;
149
+ box-shadow: var(--tao-box-shadow-xs);
99
150
  border-color: #0000;
100
151
  }
101
152
 
102
153
  [data-tao-tag][data-tao-color="warning"][data-tao-variant="solid"] {
103
154
  background: var(--tao-warning);
104
155
  color: #fff;
156
+ box-shadow: var(--tao-box-shadow-xs);
105
157
  border-color: #0000;
106
158
  }
107
159
 
108
160
  [data-tao-tag][data-tao-color="error"][data-tao-variant="solid"] {
109
161
  background: var(--tao-error);
110
162
  color: var(--tao-error-fg);
163
+ box-shadow: var(--tao-box-shadow-xs);
111
164
  border-color: #0000;
112
165
  }
113
166
 
114
167
  [data-tao-tag][data-tao-color="default"][data-tao-variant="outlined"] {
115
168
  color: var(--tao-color-text);
116
- border-color: var(--tao-color-border);
169
+ border-color: var(--tao-color-border-secondary);
117
170
  background: none;
118
171
  }
119
172
 
120
173
  [data-tao-tag][data-tao-color="primary"][data-tao-variant="outlined"] {
121
174
  color: var(--tao-primary);
122
- border-color: var(--tao-primary);
175
+ border-color: color-mix(in oklch, var(--tao-color-primary) 32%, transparent);
123
176
  background: none;
124
177
  }
125
178
 
126
179
  [data-tao-tag][data-tao-color="success"][data-tao-variant="outlined"] {
127
180
  color: var(--tao-success);
128
- border-color: var(--tao-success);
181
+ border-color: color-mix(in oklch, var(--tao-color-success) 36%, transparent);
129
182
  background: none;
130
183
  }
131
184
 
132
185
  [data-tao-tag][data-tao-color="warning"][data-tao-variant="outlined"] {
133
186
  color: var(--tao-warning);
134
- border-color: var(--tao-warning);
187
+ border-color: color-mix(in oklch, var(--tao-color-warning) 40%, transparent);
135
188
  background: none;
136
189
  }
137
190
 
138
191
  [data-tao-tag][data-tao-color="error"][data-tao-variant="outlined"] {
139
192
  color: var(--tao-error);
140
- border-color: var(--tao-error);
193
+ border-color: color-mix(in oklch, var(--tao-color-error) 36%, transparent);
141
194
  background: none;
142
195
  }
143
196
 
144
197
  [data-tao-tag][data-tao-checkable] {
145
198
  cursor: pointer;
146
199
  color: var(--tao-color-text-secondary);
147
- border-color: var(--tao-color-border);
200
+ border-color: var(--tao-color-border-secondary);
148
201
  background: none;
149
202
  }
150
203
 
151
204
  [data-tao-tag][data-tao-checkable]:hover {
152
- color: var(--tao-primary);
153
- border-color: var(--tao-primary);
205
+ background: var(--tao-color-fill-tertiary);
206
+ color: var(--tao-color-text);
207
+ border-color: var(--tao-color-border);
154
208
  }
155
209
 
156
210
  [data-tao-tag][data-tao-checkable][data-tao-checked] {
157
211
  background: var(--tao-primary);
158
212
  color: var(--tao-primary-fg);
159
213
  border-color: var(--tao-primary);
214
+ box-shadow: var(--tao-box-shadow-xs);
160
215
  }
161
216
 
162
217
  [data-tao-tag][data-tao-checkable][data-tao-checked]:hover {
@@ -165,7 +220,7 @@
165
220
  }
166
221
 
167
222
  [data-tao-tag][data-tao-checkable]:focus-visible {
168
- box-shadow: 0 0 0 2px var(--tao-control-outline);
223
+ box-shadow: 0 0 0 var(--tao-ring-width) var(--tao-control-outline);
169
224
  outline: none;
170
225
  }
171
226
 
@@ -1,7 +1,7 @@
1
1
  import { type CSSProperties, type MouseEvent, type ReactNode } from 'react';
2
2
  import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
3
3
  import './tag.css';
4
- export type TagSemanticPart = 'root' | 'icon' | 'close';
4
+ export type TagSemanticPart = 'root' | 'icon' | 'content' | 'close';
5
5
  export type TagColor = 'default' | 'primary' | 'success' | 'warning' | 'error' | (string & {});
6
6
  export type TagVariant = 'filled' | 'solid' | 'outlined';
7
7
  export interface TagProps {
@@ -11,7 +11,8 @@ function CloseIcon() {
11
11
  height: "12",
12
12
  viewBox: "0 0 12 12",
13
13
  fill: "none",
14
- "aria-hidden": true,
14
+ "aria-hidden": "true",
15
+ role: "presentation",
15
16
  children: /*#__PURE__*/ jsx("path", {
16
17
  d: "M3 3l6 6M9 3l-6 6",
17
18
  stroke: "currentColor",
@@ -24,7 +25,7 @@ function CloseIcon() {
24
25
  return t0;
25
26
  }
26
27
  function Tag(t0) {
27
- const $ = c(35);
28
+ const $ = c(40);
28
29
  const { children, color: t1, variant: t2, icon, closeIcon, onClose, disabled: t3, className, style, classNames, styles } = t0;
29
30
  const color = void 0 === t1 ? "default" : t1;
30
31
  const variant = void 0 === t2 ? "filled" : t2;
@@ -62,11 +63,11 @@ function Tag(t0) {
62
63
  borderColor: color
63
64
  } : "outlined" === variant ? {
64
65
  color,
65
- borderColor: color
66
+ borderColor: `color-mix(in oklch, ${color} 36%, transparent)`
66
67
  } : {
67
- background: `color-mix(in oklch, ${color} 12%, var(--tao-color-bg-base))`,
68
+ background: `color-mix(in oklch, ${color} 10%, var(--tao-color-bg-base))`,
68
69
  color,
69
- borderColor: `color-mix(in oklch, ${color} 30%, var(--tao-color-bg-base))`
70
+ borderColor: `color-mix(in oklch, ${color} 18%, var(--tao-color-bg-base))`
70
71
  }
71
72
  } : void 0;
72
73
  $[4] = color;
@@ -77,30 +78,31 @@ function Tag(t0) {
77
78
  const customColorStyle = t6;
78
79
  const t7 = isPreset ? color : void 0;
79
80
  const t8 = disabled || void 0;
80
- const t9 = classNames?.root;
81
- let t10;
82
- if ($[8] !== className || $[9] !== t9) {
83
- t10 = cx(t9, className);
81
+ const t9 = showClose || void 0;
82
+ const t10 = classNames?.root;
83
+ let t11;
84
+ if ($[8] !== className || $[9] !== t10) {
85
+ t11 = cx(t10, className);
84
86
  $[8] = className;
85
- $[9] = t9;
86
- $[10] = t10;
87
- } else t10 = $[10];
88
- const t11 = styles?.root;
89
- let t12;
90
- if ($[11] !== customColorStyle || $[12] !== style || $[13] !== t11) {
91
- t12 = {
87
+ $[9] = t10;
88
+ $[10] = t11;
89
+ } else t11 = $[10];
90
+ const t12 = styles?.root;
91
+ let t13;
92
+ if ($[11] !== customColorStyle || $[12] !== style || $[13] !== t12) {
93
+ t13 = {
92
94
  ...customColorStyle,
93
- ...t11,
95
+ ...t12,
94
96
  ...style
95
97
  };
96
98
  $[11] = customColorStyle;
97
99
  $[12] = style;
98
- $[13] = t11;
99
- $[14] = t12;
100
- } else t12 = $[14];
101
- let t13;
100
+ $[13] = t12;
101
+ $[14] = t13;
102
+ } else t13 = $[14];
103
+ let t14;
102
104
  if ($[15] !== classNames?.icon || $[16] !== icon || $[17] !== styles?.icon) {
103
- t13 = null != icon && /*#__PURE__*/ jsx("span", {
105
+ t14 = null != icon && /*#__PURE__*/ jsx("span", {
104
106
  "data-tao-tag-icon": "",
105
107
  className: cx(classNames?.icon),
106
108
  style: styles?.icon,
@@ -109,63 +111,72 @@ function Tag(t0) {
109
111
  $[15] = classNames?.icon;
110
112
  $[16] = icon;
111
113
  $[17] = styles?.icon;
112
- $[18] = t13;
113
- } else t13 = $[18];
114
- let t14;
115
- if ($[19] !== classNames?.close || $[20] !== closeIcon || $[21] !== disabled || $[22] !== handleClose || $[23] !== showClose || $[24] !== styles?.close) {
116
- t14 = showClose && /*#__PURE__*/ jsx("span", {
114
+ $[18] = t14;
115
+ } else t14 = $[18];
116
+ let t15;
117
+ if ($[19] !== children || $[20] !== classNames?.content || $[21] !== styles?.content) {
118
+ t15 = null != children && /*#__PURE__*/ jsx("span", {
119
+ "data-tao-tag-content": "",
120
+ className: cx(classNames?.content),
121
+ style: styles?.content,
122
+ children: children
123
+ });
124
+ $[19] = children;
125
+ $[20] = classNames?.content;
126
+ $[21] = styles?.content;
127
+ $[22] = t15;
128
+ } else t15 = $[22];
129
+ let t16;
130
+ if ($[23] !== classNames?.close || $[24] !== closeIcon || $[25] !== disabled || $[26] !== handleClose || $[27] !== showClose || $[28] !== styles?.close) {
131
+ t16 = showClose && /*#__PURE__*/ jsx("button", {
132
+ type: "button",
117
133
  "data-tao-tag-close": "",
118
- role: "button",
119
- tabIndex: disabled ? void 0 : 0,
120
134
  "aria-label": "Close",
135
+ disabled: disabled,
121
136
  onClick: handleClose,
122
- onKeyDown: (e_0)=>{
123
- if ("Enter" === e_0.key || " " === e_0.key) {
124
- e_0.preventDefault();
125
- handleClose(e_0);
126
- }
127
- },
128
137
  className: cx(classNames?.close),
129
138
  style: styles?.close,
130
139
  children: true === closeIcon || void 0 === closeIcon ? /*#__PURE__*/ jsx(CloseIcon, {}) : closeIcon
131
140
  });
132
- $[19] = classNames?.close;
133
- $[20] = closeIcon;
134
- $[21] = disabled;
135
- $[22] = handleClose;
136
- $[23] = showClose;
137
- $[24] = styles?.close;
138
- $[25] = t14;
139
- } else t14 = $[25];
140
- let t15;
141
- if ($[26] !== children || $[27] !== t10 || $[28] !== t12 || $[29] !== t13 || $[30] !== t14 || $[31] !== t7 || $[32] !== t8 || $[33] !== variant) {
142
- t15 = /*#__PURE__*/ jsxs("span", {
141
+ $[23] = classNames?.close;
142
+ $[24] = closeIcon;
143
+ $[25] = disabled;
144
+ $[26] = handleClose;
145
+ $[27] = showClose;
146
+ $[28] = styles?.close;
147
+ $[29] = t16;
148
+ } else t16 = $[29];
149
+ let t17;
150
+ if ($[30] !== t11 || $[31] !== t13 || $[32] !== t14 || $[33] !== t15 || $[34] !== t16 || $[35] !== t7 || $[36] !== t8 || $[37] !== t9 || $[38] !== variant) {
151
+ t17 = /*#__PURE__*/ jsxs("span", {
143
152
  "data-tao-tag": "",
144
153
  "data-tao-color": t7,
145
154
  "data-tao-variant": variant,
146
155
  "data-tao-disabled": t8,
147
- className: t10,
148
- style: t12,
156
+ "data-tao-closable": t9,
157
+ className: t11,
158
+ style: t13,
149
159
  children: [
150
- t13,
151
- children,
152
- t14
160
+ t14,
161
+ t15,
162
+ t16
153
163
  ]
154
164
  });
155
- $[26] = children;
156
- $[27] = t10;
157
- $[28] = t12;
158
- $[29] = t13;
159
- $[30] = t14;
160
- $[31] = t7;
161
- $[32] = t8;
162
- $[33] = variant;
163
- $[34] = t15;
164
- } else t15 = $[34];
165
- return t15;
165
+ $[30] = t11;
166
+ $[31] = t13;
167
+ $[32] = t14;
168
+ $[33] = t15;
169
+ $[34] = t16;
170
+ $[35] = t7;
171
+ $[36] = t8;
172
+ $[37] = t9;
173
+ $[38] = variant;
174
+ $[39] = t17;
175
+ } else t17 = $[39];
176
+ return t17;
166
177
  }
167
178
  function CheckableTag(t0) {
168
- const $ = c(18);
179
+ const $ = c(20);
169
180
  const { children, checked: t1, onChange, disabled: t2, icon, className, style } = t0;
170
181
  const checked = void 0 === t1 ? false : t1;
171
182
  const disabled = void 0 === t2 ? false : t2;
@@ -201,8 +212,17 @@ function CheckableTag(t0) {
201
212
  $[6] = t8;
202
213
  } else t8 = $[6];
203
214
  let t9;
204
- if ($[7] !== checked || $[8] !== children || $[9] !== className || $[10] !== style || $[11] !== t3 || $[12] !== t4 || $[13] !== t5 || $[14] !== t6 || $[15] !== t7 || $[16] !== t8) {
205
- t9 = /*#__PURE__*/ jsxs("span", {
215
+ if ($[7] !== children) {
216
+ t9 = null != children && /*#__PURE__*/ jsx("span", {
217
+ "data-tao-tag-content": "",
218
+ children: children
219
+ });
220
+ $[7] = children;
221
+ $[8] = t9;
222
+ } else t9 = $[8];
223
+ let t10;
224
+ if ($[9] !== checked || $[10] !== className || $[11] !== style || $[12] !== t3 || $[13] !== t4 || $[14] !== t5 || $[15] !== t6 || $[16] !== t7 || $[17] !== t8 || $[18] !== t9) {
225
+ t10 = /*#__PURE__*/ jsxs("span", {
206
226
  "data-tao-tag": "",
207
227
  "data-tao-checkable": "",
208
228
  "data-tao-checked": t3,
@@ -216,22 +236,22 @@ function CheckableTag(t0) {
216
236
  onKeyDown: t7,
217
237
  children: [
218
238
  t8,
219
- children
239
+ t9
220
240
  ]
221
241
  });
222
- $[7] = checked;
223
- $[8] = children;
224
- $[9] = className;
225
- $[10] = style;
226
- $[11] = t3;
227
- $[12] = t4;
228
- $[13] = t5;
229
- $[14] = t6;
230
- $[15] = t7;
231
- $[16] = t8;
232
- $[17] = t9;
233
- } else t9 = $[17];
234
- return t9;
242
+ $[9] = checked;
243
+ $[10] = className;
244
+ $[11] = style;
245
+ $[12] = t3;
246
+ $[13] = t4;
247
+ $[14] = t5;
248
+ $[15] = t6;
249
+ $[16] = t7;
250
+ $[17] = t8;
251
+ $[18] = t9;
252
+ $[19] = t10;
253
+ } else t10 = $[19];
254
+ return t10;
235
255
  }
236
256
  Tag.CheckableTag = CheckableTag;
237
257
  export { CheckableTag, Tag };
package/dist/index.d.ts CHANGED
@@ -21,7 +21,7 @@ export { ChevronsUpDownIcon, Select, type SelectOption, type SelectPlacement, ty
21
21
  export { Spinner, type SpinnerProps, type SpinnerSemanticPart, } from "./components/spinner/spinner";
22
22
  export { Splitter, type SplitterPanelProps, type SplitterProps, type SplitterSemanticPart, } from "./components/splitter/splitter";
23
23
  export { Switch, type SwitchProps, type SwitchSemanticPart, } from "./components/switch/switch";
24
- export { type SorterResult, type SortOrder, Table, type TableColumn, type TableFilterItem, type TablePagination, type TableProps, type TableRowSelection, type TableSemanticPart, } from "./components/table/table";
24
+ export { type SorterResult, type SortOrder, Table, type TableColumn, type TableFilterItem, type TablePagination, type TableProps, type TableRowSelection, type TableSemanticPart, type TableVariant, } from "./components/table/table";
25
25
  export { type TabItem, Tabs, type TabsProps, type TabsSemanticPart, } from "./components/tabs/tabs";
26
26
  export { CheckableTag, type CheckableTagProps, Tag, type TagColor, type TagProps, type TagSemanticPart, type TagVariant, } from "./components/tag/tag";
27
27
  export { type AutoSizeOptions, Textarea, type TextareaProps, type TextareaSemanticPart, } from "./components/textarea/textarea";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockshin/tao-ui",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "description": "A modern React 19 component library with semantic DOM customization and OKLCH-based theming.",
6
6
  "keywords": [