@rockshin/tao-ui 0.0.11 → 0.0.13

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.
@@ -16,16 +16,19 @@
16
16
  opacity: var(--tao-opacity-loading);
17
17
  }
18
18
 
19
+ [data-tao-checkbox-control] {
20
+ flex: none;
21
+ display: inline-flex;
22
+ position: relative;
23
+ }
24
+
19
25
  [data-tao-checkbox-input] {
20
- clip: rect(0, 0, 0, 0);
21
- white-space: nowrap;
22
- border: 0;
23
- width: 1px;
24
- height: 1px;
25
- margin: -1px;
26
- padding: 0;
26
+ z-index: 1;
27
+ opacity: 0;
28
+ cursor: inherit;
29
+ margin: 0;
27
30
  position: absolute;
28
- overflow: hidden;
31
+ inset: 0;
29
32
  }
30
33
 
31
34
  [data-tao-checkbox] {
@@ -6,7 +6,7 @@ import { cx } from "../../utils/semantic.js";
6
6
  import "./checkbox.css";
7
7
  const CheckboxGroupContext = /*#__PURE__*/ createContext(null);
8
8
  function Checkbox(t0) {
9
- const $ = c(43);
9
+ const $ = c(45);
10
10
  const { checked, indeterminate, disabled, onChange, value, children, classNames, styles } = t0;
11
11
  const ctx = useTaoConfig();
12
12
  const groupCtx = useContext(CheckboxGroupContext);
@@ -122,40 +122,51 @@ function Checkbox(t0) {
122
122
  $[31] = t18;
123
123
  } else t18 = $[31];
124
124
  let t19;
125
- if ($[32] !== children || $[33] !== classNames?.label || $[34] !== styles?.label) {
126
- t19 = null != children && /*#__PURE__*/ jsx("span", {
125
+ if ($[32] !== t10 || $[33] !== t18) {
126
+ t19 = /*#__PURE__*/ jsxs("span", {
127
+ "data-tao-checkbox-control": "",
128
+ children: [
129
+ t10,
130
+ t18
131
+ ]
132
+ });
133
+ $[32] = t10;
134
+ $[33] = t18;
135
+ $[34] = t19;
136
+ } else t19 = $[34];
137
+ let t20;
138
+ if ($[35] !== children || $[36] !== classNames?.label || $[37] !== styles?.label) {
139
+ t20 = null != children && /*#__PURE__*/ jsx("span", {
127
140
  "data-tao-checkbox-label": "",
128
141
  className: cx(classNames?.label),
129
142
  style: styles?.label,
130
143
  children: children
131
144
  });
132
- $[32] = children;
133
- $[33] = classNames?.label;
134
- $[34] = styles?.label;
135
- $[35] = t19;
136
- } else t19 = $[35];
137
- let t20;
138
- if ($[36] !== t10 || $[37] !== t18 || $[38] !== t19 || $[39] !== t5 || $[40] !== t7 || $[41] !== t8) {
139
- t20 = /*#__PURE__*/ jsxs("label", {
145
+ $[35] = children;
146
+ $[36] = classNames?.label;
147
+ $[37] = styles?.label;
148
+ $[38] = t20;
149
+ } else t20 = $[38];
150
+ let t21;
151
+ if ($[39] !== t19 || $[40] !== t20 || $[41] !== t5 || $[42] !== t7 || $[43] !== t8) {
152
+ t21 = /*#__PURE__*/ jsxs("label", {
140
153
  "data-tao-checkbox-wrapper": "",
141
154
  "data-tao-disabled": t5,
142
155
  className: t7,
143
156
  style: t8,
144
157
  children: [
145
- t10,
146
- t18,
147
- t19
158
+ t19,
159
+ t20
148
160
  ]
149
161
  });
150
- $[36] = t10;
151
- $[37] = t18;
152
- $[38] = t19;
153
- $[39] = t5;
154
- $[40] = t7;
155
- $[41] = t8;
156
- $[42] = t20;
157
- } else t20 = $[42];
158
- return t20;
162
+ $[39] = t19;
163
+ $[40] = t20;
164
+ $[41] = t5;
165
+ $[42] = t7;
166
+ $[43] = t8;
167
+ $[44] = t21;
168
+ } else t21 = $[44];
169
+ return t21;
159
170
  }
160
171
  function CheckboxGroup(t0) {
161
172
  const $ = c(26);
@@ -69,6 +69,7 @@ function ContextMenu(t0) {
69
69
  if ($[12] !== content || $[13] !== size || $[14] !== t4 || $[15] !== t6) {
70
70
  t7 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_context_menu_293d36e3.Portal, {
71
71
  children: /*#__PURE__*/ jsx(TaoPortalScope, {
72
+ asChild: true,
72
73
  children: /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_context_menu_293d36e3.Content, {
73
74
  "data-tao-menu-content": "",
74
75
  "data-tao-context-menu": "",
@@ -582,6 +582,7 @@ function DatePicker(t0) {
582
582
  if ($[144] !== panelContent) {
583
583
  t42 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_popover_e2827c9f.Portal, {
584
584
  children: /*#__PURE__*/ jsx(TaoPortalScope, {
585
+ asChild: true,
585
586
  children: /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_popover_e2827c9f.Content, {
586
587
  "data-tao-picker-dropdown": "",
587
588
  sideOffset: 4,
@@ -282,6 +282,7 @@ function RangePicker({ value, onChange, picker = 'date', showTime, format: forma
282
282
  }),
283
283
  /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_popover_e2827c9f.Portal, {
284
284
  children: /*#__PURE__*/ jsx(TaoPortalScope, {
285
+ asChild: true,
285
286
  children: /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_popover_e2827c9f.Content, {
286
287
  "data-tao-picker-dropdown": "",
287
288
  sideOffset: 4,
@@ -241,6 +241,7 @@ function Dropdown(props) {
241
241
  if ($[47] !== align || $[48] !== content || $[49] !== hoverProps || $[50] !== side || $[51] !== size || $[52] !== t15 || $[53] !== t17 || $[54] !== t18) {
242
242
  t19 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dropdown_menu_dbc6754d.Portal, {
243
243
  children: /*#__PURE__*/ jsx(TaoPortalScope, {
244
+ asChild: true,
244
245
  children: /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_dropdown_menu_dbc6754d.Content, {
245
246
  "data-tao-menu-content": "",
246
247
  "data-tao-dropdown": "",
@@ -182,6 +182,7 @@ function renderMenuItems(items, ctx) {
182
182
  }),
183
183
  /*#__PURE__*/ jsx(P.Portal, {
184
184
  children: /*#__PURE__*/ jsx(TaoPortalScope, {
185
+ asChild: true,
185
186
  children: /*#__PURE__*/ jsx(P.SubContent, {
186
187
  "data-tao-menu-content": "",
187
188
  "data-tao-menu-sub-content": "",
@@ -16,16 +16,19 @@
16
16
  opacity: var(--tao-opacity-loading);
17
17
  }
18
18
 
19
+ [data-tao-radio-control] {
20
+ flex: none;
21
+ display: inline-flex;
22
+ position: relative;
23
+ }
24
+
19
25
  [data-tao-radio-input] {
20
- clip: rect(0, 0, 0, 0);
21
- white-space: nowrap;
22
- border: 0;
23
- width: 1px;
24
- height: 1px;
25
- margin: -1px;
26
- padding: 0;
26
+ z-index: 1;
27
+ opacity: 0;
28
+ cursor: inherit;
29
+ margin: 0;
27
30
  position: absolute;
28
- overflow: hidden;
31
+ inset: 0;
29
32
  }
30
33
 
31
34
  [data-tao-radio] {
@@ -6,7 +6,7 @@ import { cx } from "../../utils/semantic.js";
6
6
  import "./radio.css";
7
7
  const RadioGroupContext = /*#__PURE__*/ createContext(null);
8
8
  function Radio(t0) {
9
- const $ = c(29);
9
+ const $ = c(31);
10
10
  const { value, checked, disabled, onChange, children, name, classNames, styles } = t0;
11
11
  const ctx = useTaoConfig();
12
12
  const groupCtx = useContext(RadioGroupContext);
@@ -75,40 +75,51 @@ function Radio(t0) {
75
75
  $[17] = t11;
76
76
  } else t11 = $[17];
77
77
  let t12;
78
- if ($[18] !== children || $[19] !== classNames?.label || $[20] !== styles?.label) {
79
- t12 = null != children && /*#__PURE__*/ jsx("span", {
78
+ if ($[18] !== t11 || $[19] !== t6) {
79
+ t12 = /*#__PURE__*/ jsxs("span", {
80
+ "data-tao-radio-control": "",
81
+ children: [
82
+ t6,
83
+ t11
84
+ ]
85
+ });
86
+ $[18] = t11;
87
+ $[19] = t6;
88
+ $[20] = t12;
89
+ } else t12 = $[20];
90
+ let t13;
91
+ if ($[21] !== children || $[22] !== classNames?.label || $[23] !== styles?.label) {
92
+ t13 = null != children && /*#__PURE__*/ jsx("span", {
80
93
  "data-tao-radio-label": "",
81
94
  className: cx(classNames?.label),
82
95
  style: styles?.label,
83
96
  children: children
84
97
  });
85
- $[18] = children;
86
- $[19] = classNames?.label;
87
- $[20] = styles?.label;
88
- $[21] = t12;
89
- } else t12 = $[21];
90
- let t13;
91
- if ($[22] !== t11 || $[23] !== t12 || $[24] !== t2 || $[25] !== t4 || $[26] !== t5 || $[27] !== t6) {
92
- t13 = /*#__PURE__*/ jsxs("label", {
98
+ $[21] = children;
99
+ $[22] = classNames?.label;
100
+ $[23] = styles?.label;
101
+ $[24] = t13;
102
+ } else t13 = $[24];
103
+ let t14;
104
+ if ($[25] !== t12 || $[26] !== t13 || $[27] !== t2 || $[28] !== t4 || $[29] !== t5) {
105
+ t14 = /*#__PURE__*/ jsxs("label", {
93
106
  "data-tao-radio-wrapper": "",
94
107
  "data-tao-disabled": t2,
95
108
  className: t4,
96
109
  style: t5,
97
110
  children: [
98
- t6,
99
- t11,
100
- t12
111
+ t12,
112
+ t13
101
113
  ]
102
114
  });
103
- $[22] = t11;
104
- $[23] = t12;
105
- $[24] = t2;
106
- $[25] = t4;
107
- $[26] = t5;
108
- $[27] = t6;
109
- $[28] = t13;
110
- } else t13 = $[28];
111
- return t13;
115
+ $[25] = t12;
116
+ $[26] = t13;
117
+ $[27] = t2;
118
+ $[28] = t4;
119
+ $[29] = t5;
120
+ $[30] = t14;
121
+ } else t14 = $[30];
122
+ return t14;
112
123
  }
113
124
  function RadioGroup(t0) {
114
125
  const $ = c(26);
@@ -373,6 +373,7 @@ function Select(props) {
373
373
  /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.Portal, {
374
374
  container: container,
375
375
  children: /*#__PURE__*/ jsx(TaoPortalScope, {
376
+ asChild: true,
376
377
  children: /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.Content, {
377
378
  "data-tao-select-content": "",
378
379
  "data-tao-popup-width": false === popupMatchSelectWidth ? 'content' : void 0,
@@ -42,10 +42,18 @@ export declare function useTaoConfig(): TaoConfigContextValue;
42
42
  * portal their popup to document.body, escaping the `[data-tao-provider]`
43
43
  * element that carries custom token overrides; wrapping the portal content in
44
44
  * this component re-applies those overrides so colors/sizes stay consistent.
45
+ *
46
+ * With `asChild`, merges the tokens onto the immediate child (via Radix Slot)
47
+ * instead of adding a wrapper div. Prefer `asChild` inside portals whose Radix
48
+ * primitive does NOT Presence-gate its Portal (notably `@radix-ui/react-select`
49
+ * — see `SelectPortal` in `node_modules/@radix-ui/react-select`): the wrapper
50
+ * div would otherwise render even while the popup is closed, leaving a ghost
51
+ * `<div data-tao-provider>` in the body for every mounted-but-closed Select.
45
52
  */
46
- export declare function TaoPortalScope({ children, style, }: {
53
+ export declare function TaoPortalScope({ children, style, asChild, }: {
47
54
  children: ReactNode;
48
55
  style?: CSSProperties;
56
+ asChild?: boolean;
49
57
  }): import("react/jsx-runtime").JSX.Element;
50
58
  export interface TaoProviderProps {
51
59
  children: ReactNode;
@@ -1,5 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { c } from "react/compiler-runtime";
3
+ import { Slot } from "@radix-ui/react-slot";
3
4
  import { createContext, useContext, useRef } from "react";
4
5
  const TaoConfigContext = /*#__PURE__*/ createContext({
5
6
  size: 'medium',
@@ -11,31 +12,55 @@ function useTaoConfig() {
11
12
  return useContext(TaoConfigContext);
12
13
  }
13
14
  function TaoPortalScope(t0) {
14
- const $ = c(6);
15
- const { children, style } = t0;
15
+ const $ = c(12);
16
+ const { children, style, asChild } = t0;
16
17
  const { tokenStyle } = useTaoConfig();
18
+ if (asChild) {
19
+ let t1;
20
+ if ($[0] !== style || $[1] !== tokenStyle) {
21
+ t1 = {
22
+ ...tokenStyle,
23
+ ...style
24
+ };
25
+ $[0] = style;
26
+ $[1] = tokenStyle;
27
+ $[2] = t1;
28
+ } else t1 = $[2];
29
+ let t2;
30
+ if ($[3] !== children || $[4] !== t1) {
31
+ t2 = /*#__PURE__*/ jsx(Slot, {
32
+ "data-tao-provider": "",
33
+ style: t1,
34
+ children: children
35
+ });
36
+ $[3] = children;
37
+ $[4] = t1;
38
+ $[5] = t2;
39
+ } else t2 = $[5];
40
+ return t2;
41
+ }
17
42
  let t1;
18
- if ($[0] !== style || $[1] !== tokenStyle) {
43
+ if ($[6] !== style || $[7] !== tokenStyle) {
19
44
  t1 = {
20
45
  display: "contents",
21
46
  ...tokenStyle,
22
47
  ...style
23
48
  };
24
- $[0] = style;
25
- $[1] = tokenStyle;
26
- $[2] = t1;
27
- } else t1 = $[2];
49
+ $[6] = style;
50
+ $[7] = tokenStyle;
51
+ $[8] = t1;
52
+ } else t1 = $[8];
28
53
  let t2;
29
- if ($[3] !== children || $[4] !== t1) {
54
+ if ($[9] !== children || $[10] !== t1) {
30
55
  t2 = /*#__PURE__*/ jsx("div", {
31
56
  "data-tao-provider": "",
32
57
  style: t1,
33
58
  children: children
34
59
  });
35
- $[3] = children;
36
- $[4] = t1;
37
- $[5] = t2;
38
- } else t2 = $[5];
60
+ $[9] = children;
61
+ $[10] = t1;
62
+ $[11] = t2;
63
+ } else t2 = $[11];
39
64
  return t2;
40
65
  }
41
66
  const TOKEN_TO_VAR = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockshin/tao-ui",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "type": "module",
5
5
  "description": "A modern React 19 component library with semantic DOM customization and OKLCH-based theming.",
6
6
  "keywords": [