@rockshin/tao-ui 0.0.11 → 0.0.12

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.
@@ -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": "",
@@ -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.12",
4
4
  "type": "module",
5
5
  "description": "A modern React 19 component library with semantic DOM customization and OKLCH-based theming.",
6
6
  "keywords": [