@rockshin/tao-ui 0.0.1 → 0.0.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.
Files changed (71) hide show
  1. package/dist/components/breadcrumb/breadcrumb.css +1091 -0
  2. package/dist/components/breadcrumb/breadcrumb.d.ts +43 -0
  3. package/dist/components/breadcrumb/breadcrumb.js +268 -0
  4. package/dist/components/button/button.css +46 -21
  5. package/dist/components/checkbox/checkbox.css +33 -12
  6. package/dist/components/collapsible/collapsible.css +1026 -0
  7. package/dist/components/collapsible/collapsible.d.ts +39 -0
  8. package/dist/components/collapsible/collapsible.js +168 -0
  9. package/dist/components/context-menu/context-menu.css +1149 -0
  10. package/dist/components/context-menu/context-menu.d.ts +19 -0
  11. package/dist/components/context-menu/context-menu.js +106 -0
  12. package/dist/components/date-picker/calendar/month-grid.d.ts +1 -1
  13. package/dist/components/date-picker/calendar/time-panel.d.ts +1 -1
  14. package/dist/components/date-picker/calendar/year-grid.d.ts +1 -1
  15. package/dist/components/date-picker/date-picker.css +87 -17
  16. package/dist/components/date-picker/date-picker.js +9 -7
  17. package/dist/components/date-picker/range-picker.js +9 -7
  18. package/dist/components/drawer/drawer.css +128 -15
  19. package/dist/components/drawer/drawer.d.ts +36 -3
  20. package/dist/components/drawer/drawer.js +323 -121
  21. package/dist/components/dropdown/dropdown.css +999 -0
  22. package/dist/components/dropdown/dropdown.d.ts +45 -0
  23. package/dist/components/dropdown/dropdown.js +383 -0
  24. package/dist/components/form-field/form.css +33 -12
  25. package/dist/components/input/input.css +86 -14
  26. package/dist/components/menu/menu-render.d.ts +89 -0
  27. package/dist/components/menu/menu-render.js +379 -0
  28. package/dist/components/menu/menu.css +1145 -0
  29. package/dist/components/modal/confirm-dialog.d.ts +37 -0
  30. package/dist/components/modal/confirm-dialog.js +193 -0
  31. package/dist/components/modal/confirm.d.ts +13 -0
  32. package/dist/components/modal/confirm.js +56 -0
  33. package/dist/components/modal/index.d.ts +21 -0
  34. package/dist/components/modal/index.js +18 -0
  35. package/dist/components/modal/modal.css +1169 -0
  36. package/dist/components/modal/modal.d.ts +50 -0
  37. package/dist/components/modal/modal.js +362 -0
  38. package/dist/components/modal/use-modal.d.ts +21 -0
  39. package/dist/components/modal/use-modal.js +83 -0
  40. package/dist/components/pagination/pagination.css +33 -12
  41. package/dist/components/pagination/pagination.js +3 -1
  42. package/dist/components/radio/radio.css +33 -12
  43. package/dist/components/scroll-area/scroll-area.css +33 -12
  44. package/dist/components/select/mobile-select.css +75 -13
  45. package/dist/components/select/mobile-select.d.ts +4 -1
  46. package/dist/components/select/mobile-select.js +103 -107
  47. package/dist/components/select/select.css +167 -26
  48. package/dist/components/select/select.d.ts +62 -4
  49. package/dist/components/select/select.js +359 -377
  50. package/dist/components/spinner/spinner.css +1084 -0
  51. package/dist/components/spinner/spinner.d.ts +26 -0
  52. package/dist/components/spinner/spinner.js +229 -0
  53. package/dist/components/splitter/splitter.css +33 -12
  54. package/dist/components/switch/switch.css +33 -12
  55. package/dist/components/table/table.css +57 -18
  56. package/dist/components/table/table.d.ts +17 -2
  57. package/dist/components/table/table.js +214 -206
  58. package/dist/components/tabs/tabs.css +36 -17
  59. package/dist/components/tag/tag.css +33 -12
  60. package/dist/components/textarea/textarea.css +1246 -0
  61. package/dist/components/textarea/textarea.d.ts +19 -0
  62. package/dist/components/textarea/textarea.js +181 -0
  63. package/dist/index.d.ts +25 -18
  64. package/dist/index.js +22 -15
  65. package/dist/layouts/stack/layout.css +33 -12
  66. package/dist/provider/tao-provider.d.ts +17 -1
  67. package/dist/provider/tao-provider.js +53 -15
  68. package/dist/theme/control.css +86 -13
  69. package/dist/theme/theme.css +33 -12
  70. package/llms.txt +7 -6
  71. package/package.json +18 -13
@@ -87,7 +87,6 @@
87
87
  --tao-color-fill-quaternary: color-mix(in oklch, var(--tao-color-text-base) 3%, var(--tao-color-bg-base));
88
88
  --tao-color-bg-layout: color-mix(in oklch, var(--tao-color-text-base) 4%, var(--tao-color-bg-base));
89
89
  --tao-color-border: color-mix(in oklch, var(--tao-color-text-base) 18%, var(--tao-color-bg-base));
90
- --tao-color-border-secondary: color-mix(in oklch, var(--tao-color-text-base) 10%, var(--tao-color-bg-base));
91
90
  --tao-control-outline: color-mix(in oklch, var(--tao-color-primary) 10%, transparent);
92
91
  --tao-color-error-outline: color-mix(in oklch, var(--tao-color-error) 10%, transparent);
93
92
  --tao-color-warning-outline: color-mix(in oklch, var(--tao-color-warning) 10%, transparent);
@@ -350,11 +349,16 @@
350
349
  --tao-radius: 6px;
351
350
  --tao-font-size: 14px;
352
351
  --tao-control-height: 36px;
352
+ --tao-control-width: 200px;
353
+ --tao-control-range-width: 360px;
353
354
  --tao-size-unit: 4px;
354
355
  --tao-line-width: 1px;
355
356
  --tao-font-family: "Geist Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
356
357
  --tao-font-family-code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
357
358
  --tao-motion-unit: .1s;
359
+ --tao-z-index-drawer: 1000;
360
+ --tao-z-index-modal: 1000;
361
+ --tao-z-index-popup: 1100;
358
362
  --tao-primary: var(--tao-color-primary);
359
363
  --tao-primary-hover: var(--tao-color-primary);
360
364
  }
@@ -572,8 +576,8 @@
572
576
  }
573
577
 
574
578
  :root, [data-tao-provider] {
575
- --tao-color-bg-container: var(--tao-color-bg-base);
576
- --tao-color-bg-elevated: var(--tao-color-bg-base);
579
+ --tao-color-bg-container: oklch(100% 0 0);
580
+ --tao-color-bg-elevated: oklch(100% 0 0);
577
581
  --tao-color-border: var(--tao-color-text-base);
578
582
  }
579
583
 
@@ -584,16 +588,7 @@
584
588
  }
585
589
 
586
590
  :root, [data-tao-provider] {
587
- --tao-color-border-secondary: var(--tao-color-text-base);
588
- }
589
-
590
- @supports (color: color-mix(in lab, red, red)) {
591
- :root, [data-tao-provider] {
592
- --tao-color-border-secondary: color-mix(in oklch, var(--tao-color-text-base) 10%, var(--tao-color-bg-base));
593
- }
594
- }
595
-
596
- :root, [data-tao-provider] {
591
+ --tao-color-border-secondary: #0000170b;
597
592
  --tao-radius-xs: 2px;
598
593
  --tao-radius-sm: calc(var(--tao-radius) - 2px);
599
594
  --tao-radius-md: var(--tao-radius);
@@ -676,6 +671,10 @@
676
671
  visibility: collapse;
677
672
  }
678
673
 
674
+ .visible {
675
+ visibility: visible;
676
+ }
677
+
679
678
  .absolute {
680
679
  position: absolute;
681
680
  }
@@ -758,6 +757,10 @@
758
757
  display: inline;
759
758
  }
760
759
 
760
+ .inline-flex {
761
+ display: inline-flex;
762
+ }
763
+
761
764
  .table {
762
765
  display: table;
763
766
  }
@@ -770,6 +773,10 @@
770
773
  transform: var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, );
771
774
  }
772
775
 
776
+ .resize {
777
+ resize: both;
778
+ }
779
+
773
780
  .flex-wrap {
774
781
  flex-wrap: wrap;
775
782
  }
@@ -785,6 +792,14 @@
785
792
  border-width: 1px;
786
793
  }
787
794
 
795
+ .italic {
796
+ font-style: italic;
797
+ }
798
+
799
+ .underline {
800
+ text-decoration-line: underline;
801
+ }
802
+
788
803
  .shadow {
789
804
  --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, #0000001a), 0 1px 2px -1px var(--tw-shadow-color, #0000001a);
790
805
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
@@ -814,6 +829,24 @@
814
829
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
815
830
  transition-duration: var(--tw-duration, var(--default-transition-duration));
816
831
  }
832
+
833
+ .select-all {
834
+ -webkit-user-select: all;
835
+ user-select: all;
836
+ }
837
+ }
838
+
839
+ [data-tao-control] {
840
+ box-sizing: border-box;
841
+ width: var(--tao-control-width);
842
+ }
843
+
844
+ [data-tao-control][data-tao-range-trigger] {
845
+ width: var(--tao-control-range-width);
846
+ }
847
+
848
+ [data-tao-form-field] [data-tao-control] {
849
+ width: 100%;
817
850
  }
818
851
 
819
852
  [data-tao-control] {
@@ -821,8 +854,8 @@
821
854
  }
822
855
 
823
856
  [data-tao-control][data-tao-variant="outlined"] {
824
- background: var(--tao-color-bg-container);
825
857
  border: var(--tao-line-width) solid var(--tao-color-border);
858
+ background: none;
826
859
  }
827
860
 
828
861
  [data-tao-control][data-tao-variant="outlined"]:hover:not([data-disabled]):not(:focus-within):not([data-state="open"]) {
@@ -848,6 +881,25 @@
848
881
  box-shadow: 0 0 0 2px var(--tao-color-error-outline);
849
882
  }
850
883
 
884
+ [data-tao-control][data-tao-variant="outlined"][data-tao-warning] {
885
+ border-color: var(--tao-warning);
886
+ }
887
+
888
+ [data-tao-control][data-tao-variant="outlined"][data-tao-warning]:hover:not([data-disabled]):not(:focus-within) {
889
+ border-color: var(--tao-color-warning);
890
+ }
891
+
892
+ @supports (color: color-mix(in lab, red, red)) {
893
+ [data-tao-control][data-tao-variant="outlined"][data-tao-warning]:hover:not([data-disabled]):not(:focus-within) {
894
+ border-color: color-mix(in oklch, var(--tao-color-warning) 80%, white);
895
+ }
896
+ }
897
+
898
+ [data-tao-control][data-tao-variant="outlined"][data-tao-warning]:focus-within, [data-tao-control][data-tao-variant="outlined"][data-tao-warning][data-state="open"] {
899
+ border-color: var(--tao-warning);
900
+ box-shadow: 0 0 0 2px var(--tao-color-warning-outline);
901
+ }
902
+
851
903
  [data-tao-control][data-tao-variant="outlined"][data-disabled], [data-tao-control][data-tao-variant="outlined"]:has(input:disabled) {
852
904
  background: var(--tao-color-bg-disabled);
853
905
  border-color: var(--tao-color-border);
@@ -892,6 +944,26 @@
892
944
  box-shadow: 0 0 0 2px var(--tao-color-error-outline);
893
945
  }
894
946
 
947
+ [data-tao-control][data-tao-variant="filled"][data-tao-warning] {
948
+ background: var(--tao-warning-bg);
949
+ }
950
+
951
+ [data-tao-control][data-tao-variant="filled"][data-tao-warning]:hover:not([data-disabled]):not(:focus-within) {
952
+ background: var(--tao-color-warning);
953
+ }
954
+
955
+ @supports (color: color-mix(in lab, red, red)) {
956
+ [data-tao-control][data-tao-variant="filled"][data-tao-warning]:hover:not([data-disabled]):not(:focus-within) {
957
+ background: color-mix(in oklch, var(--tao-color-warning) 10%, var(--tao-color-bg-base));
958
+ }
959
+ }
960
+
961
+ [data-tao-control][data-tao-variant="filled"][data-tao-warning]:focus-within, [data-tao-control][data-tao-variant="filled"][data-tao-warning][data-state="open"] {
962
+ background: var(--tao-color-bg-container);
963
+ border-color: var(--tao-warning);
964
+ box-shadow: 0 0 0 2px var(--tao-color-warning-outline);
965
+ }
966
+
895
967
  [data-tao-control][data-tao-variant="filled"][data-disabled], [data-tao-control][data-tao-variant="filled"]:has(input:disabled) {
896
968
  background: var(--tao-color-bg-disabled);
897
969
  border-color: var(--tao-color-border);
@@ -0,0 +1,89 @@
1
+ import { type ComponentType, type ReactNode } from 'react';
2
+ import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
3
+ import './menu.css';
4
+ export type MenuSemanticPart = 'root' | 'content' | 'item' | 'itemIcon' | 'itemLabel' | 'itemExtra' | 'divider' | 'groupLabel' | 'subTrigger' | 'subContent';
5
+ export interface MenuItemType {
6
+ key: string;
7
+ label: ReactNode;
8
+ icon?: ReactNode;
9
+ disabled?: boolean;
10
+ danger?: boolean;
11
+ /** Right-aligned extra content, e.g. a keyboard shortcut. */
12
+ extra?: ReactNode;
13
+ onClick?: (info: {
14
+ key: string;
15
+ }) => void;
16
+ /** Nested submenu. */
17
+ children?: MenuItemType[];
18
+ }
19
+ export interface MenuDividerType {
20
+ type: 'divider';
21
+ }
22
+ export interface MenuGroupType {
23
+ type: 'group';
24
+ key?: string;
25
+ label?: ReactNode;
26
+ children: MenuItemType[];
27
+ }
28
+ export type MenuItem = MenuItemType | MenuDividerType | MenuGroupType;
29
+ export interface MenuProps {
30
+ items: MenuItem[];
31
+ onClick?: (info: {
32
+ key: string;
33
+ }) => void;
34
+ /** Render items as checkbox/radio entries. */
35
+ selectable?: boolean;
36
+ /** Multi-select (checkbox) when selectable. Otherwise single (radio). */
37
+ multiple?: boolean;
38
+ selectedKeys?: string[];
39
+ defaultSelectedKeys?: string[];
40
+ onSelect?: (info: {
41
+ key: string;
42
+ selectedKeys: string[];
43
+ }) => void;
44
+ }
45
+ /**
46
+ * Radix `react-dropdown-menu` and `react-context-menu` expose parallel
47
+ * sub-components with identical names. We render an antd-style `items` array
48
+ * against whichever set is passed in, so Dropdown and ContextMenu share one
49
+ * renderer.
50
+ */
51
+ type AnyComp = ComponentType<any>;
52
+ export interface MenuPrimitives {
53
+ Item: AnyComp;
54
+ CheckboxItem: AnyComp;
55
+ RadioGroup: AnyComp;
56
+ RadioItem: AnyComp;
57
+ Label: AnyComp;
58
+ Separator: AnyComp;
59
+ Group: AnyComp;
60
+ Sub: AnyComp;
61
+ SubTrigger: AnyComp;
62
+ SubContent: AnyComp;
63
+ Portal: AnyComp;
64
+ ItemIndicator: AnyComp;
65
+ }
66
+ export interface RenderCtx {
67
+ P: MenuPrimitives;
68
+ classNames?: SemanticClassNames<MenuSemanticPart>;
69
+ styles?: SemanticStyles<MenuSemanticPart>;
70
+ /** Fire item.onClick + menu.onClick for a plain action item. */
71
+ onAction: (item: MenuItemType) => void;
72
+ /** Multi-select: current keys + toggler. */
73
+ selectedKeys: string[];
74
+ multiple: boolean;
75
+ selectable: boolean;
76
+ onToggle: (key: string) => void;
77
+ }
78
+ export declare function renderMenuItems(items: MenuItem[], ctx: RenderCtx): ReactNode;
79
+ /**
80
+ * Encapsulates a menu's selection state (controlled / uncontrolled), the
81
+ * item-click dispatch (`item.onClick` → `menu.onClick`), and rendering of the
82
+ * item tree (wrapping in a RadioGroup for single-select). Returns the ready
83
+ * content node. Shared by Dropdown and ContextMenu.
84
+ */
85
+ export declare function useMenuController(menu: MenuProps, P: MenuPrimitives, semantic: {
86
+ classNames?: SemanticClassNames<MenuSemanticPart>;
87
+ styles?: SemanticStyles<MenuSemanticPart>;
88
+ }): ReactNode;
89
+ export {};
@@ -0,0 +1,379 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { useState } from "react";
4
+ import { TaoPortalScope } from "../../provider/tao-provider.js";
5
+ import { cx } from "../../utils/semantic.js";
6
+ import "./menu.css";
7
+ function ChevronRightIcon() {
8
+ const $ = c(1);
9
+ let t0;
10
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
11
+ t0 = /*#__PURE__*/ jsx("svg", {
12
+ "data-tao-menu-sub-icon": "",
13
+ width: "16",
14
+ height: "16",
15
+ viewBox: "0 0 24 24",
16
+ fill: "none",
17
+ stroke: "currentColor",
18
+ strokeWidth: "2",
19
+ strokeLinecap: "round",
20
+ strokeLinejoin: "round",
21
+ "aria-hidden": true,
22
+ children: /*#__PURE__*/ jsx("path", {
23
+ d: "m9 18 6-6-6-6"
24
+ })
25
+ });
26
+ $[0] = t0;
27
+ } else t0 = $[0];
28
+ return t0;
29
+ }
30
+ function CheckIcon() {
31
+ const $ = c(1);
32
+ let t0;
33
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
34
+ t0 = /*#__PURE__*/ jsx("svg", {
35
+ width: "16",
36
+ height: "16",
37
+ viewBox: "0 0 24 24",
38
+ fill: "none",
39
+ stroke: "currentColor",
40
+ strokeWidth: "2.5",
41
+ strokeLinecap: "round",
42
+ strokeLinejoin: "round",
43
+ "aria-hidden": true,
44
+ children: /*#__PURE__*/ jsx("polyline", {
45
+ points: "20 6 9 17 4 12"
46
+ })
47
+ });
48
+ $[0] = t0;
49
+ } else t0 = $[0];
50
+ return t0;
51
+ }
52
+ function DotIcon() {
53
+ const $ = c(1);
54
+ let t0;
55
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
56
+ t0 = /*#__PURE__*/ jsx("svg", {
57
+ width: "16",
58
+ height: "16",
59
+ viewBox: "0 0 24 24",
60
+ fill: "currentColor",
61
+ "aria-hidden": true,
62
+ children: /*#__PURE__*/ jsx("circle", {
63
+ cx: "12",
64
+ cy: "12",
65
+ r: "4"
66
+ })
67
+ });
68
+ $[0] = t0;
69
+ } else t0 = $[0];
70
+ return t0;
71
+ }
72
+ function ItemBody(t0) {
73
+ const $ = c(18);
74
+ const { icon, label, extra, ctx } = t0;
75
+ let t1;
76
+ if ($[0] !== ctx.classNames?.itemIcon || $[1] !== ctx.styles?.itemIcon || $[2] !== icon) {
77
+ t1 = null != icon && /*#__PURE__*/ jsx("span", {
78
+ "data-tao-menu-item-icon": "",
79
+ className: cx(ctx.classNames?.itemIcon),
80
+ style: ctx.styles?.itemIcon,
81
+ children: icon
82
+ });
83
+ $[0] = ctx.classNames?.itemIcon;
84
+ $[1] = ctx.styles?.itemIcon;
85
+ $[2] = icon;
86
+ $[3] = t1;
87
+ } else t1 = $[3];
88
+ const t2 = ctx.classNames?.itemLabel;
89
+ let t3;
90
+ if ($[4] !== t2) {
91
+ t3 = cx(t2);
92
+ $[4] = t2;
93
+ $[5] = t3;
94
+ } else t3 = $[5];
95
+ const t4 = ctx.styles?.itemLabel;
96
+ let t5;
97
+ if ($[6] !== label || $[7] !== t3 || $[8] !== t4) {
98
+ t5 = /*#__PURE__*/ jsx("span", {
99
+ "data-tao-menu-item-label": "",
100
+ className: t3,
101
+ style: t4,
102
+ children: label
103
+ });
104
+ $[6] = label;
105
+ $[7] = t3;
106
+ $[8] = t4;
107
+ $[9] = t5;
108
+ } else t5 = $[9];
109
+ let t6;
110
+ if ($[10] !== ctx.classNames?.itemExtra || $[11] !== ctx.styles?.itemExtra || $[12] !== extra) {
111
+ t6 = null != extra && /*#__PURE__*/ jsx("span", {
112
+ "data-tao-menu-item-extra": "",
113
+ className: cx(ctx.classNames?.itemExtra),
114
+ style: ctx.styles?.itemExtra,
115
+ children: extra
116
+ });
117
+ $[10] = ctx.classNames?.itemExtra;
118
+ $[11] = ctx.styles?.itemExtra;
119
+ $[12] = extra;
120
+ $[13] = t6;
121
+ } else t6 = $[13];
122
+ let t7;
123
+ if ($[14] !== t1 || $[15] !== t5 || $[16] !== t6) {
124
+ t7 = /*#__PURE__*/ jsxs(Fragment, {
125
+ children: [
126
+ t1,
127
+ t5,
128
+ t6
129
+ ]
130
+ });
131
+ $[14] = t1;
132
+ $[15] = t5;
133
+ $[16] = t6;
134
+ $[17] = t7;
135
+ } else t7 = $[17];
136
+ return t7;
137
+ }
138
+ function renderMenuItems(items, ctx) {
139
+ const { P } = ctx;
140
+ return items.map((item, index)=>{
141
+ if ('type' in item && 'divider' === item.type) return /*#__PURE__*/ jsx(P.Separator, {
142
+ "data-tao-menu-divider": "",
143
+ className: cx(ctx.classNames?.divider),
144
+ style: ctx.styles?.divider
145
+ }, `divider-${index}`);
146
+ if ('type' in item && 'group' === item.type) return /*#__PURE__*/ jsxs(P.Group, {
147
+ "data-tao-menu-group": "",
148
+ children: [
149
+ null != item.label && /*#__PURE__*/ jsx(P.Label, {
150
+ "data-tao-menu-group-label": "",
151
+ className: cx(ctx.classNames?.groupLabel),
152
+ style: ctx.styles?.groupLabel,
153
+ children: item.label
154
+ }),
155
+ renderMenuItems(item.children, ctx)
156
+ ]
157
+ }, item.key ?? `group-${index}`);
158
+ if (item.children && item.children.length > 0) return /*#__PURE__*/ jsxs(P.Sub, {
159
+ children: [
160
+ /*#__PURE__*/ jsxs(P.SubTrigger, {
161
+ disabled: item.disabled,
162
+ "data-tao-menu-item": "",
163
+ "data-tao-menu-sub-trigger": "",
164
+ "data-tao-danger": item.danger || void 0,
165
+ className: cx(ctx.classNames?.item, ctx.classNames?.subTrigger),
166
+ style: {
167
+ ...ctx.styles?.item,
168
+ ...ctx.styles?.subTrigger
169
+ },
170
+ children: [
171
+ /*#__PURE__*/ jsx(ItemBody, {
172
+ icon: item.icon,
173
+ label: item.label,
174
+ extra: item.extra,
175
+ ctx: ctx
176
+ }),
177
+ /*#__PURE__*/ jsx(ChevronRightIcon, {})
178
+ ]
179
+ }),
180
+ /*#__PURE__*/ jsx(P.Portal, {
181
+ children: /*#__PURE__*/ jsx(TaoPortalScope, {
182
+ children: /*#__PURE__*/ jsx(P.SubContent, {
183
+ "data-tao-menu-content": "",
184
+ "data-tao-menu-sub-content": "",
185
+ className: cx(ctx.classNames?.subContent),
186
+ style: ctx.styles?.subContent,
187
+ sideOffset: 2,
188
+ alignOffset: -4,
189
+ children: renderMenuItems(item.children, ctx)
190
+ })
191
+ })
192
+ })
193
+ ]
194
+ }, item.key);
195
+ if (ctx.selectable) {
196
+ if (ctx.multiple) return /*#__PURE__*/ jsxs(P.CheckboxItem, {
197
+ disabled: item.disabled,
198
+ checked: ctx.selectedKeys.includes(item.key),
199
+ onCheckedChange: ()=>{
200
+ ctx.onToggle(item.key);
201
+ ctx.onAction(item);
202
+ },
203
+ "data-tao-menu-item": "",
204
+ "data-tao-menu-selectable": "",
205
+ "data-tao-danger": item.danger || void 0,
206
+ className: cx(ctx.classNames?.item),
207
+ style: ctx.styles?.item,
208
+ children: [
209
+ /*#__PURE__*/ jsx("span", {
210
+ "data-tao-menu-item-indicator": "",
211
+ children: /*#__PURE__*/ jsx(P.ItemIndicator, {
212
+ children: /*#__PURE__*/ jsx(CheckIcon, {})
213
+ })
214
+ }),
215
+ /*#__PURE__*/ jsx(ItemBody, {
216
+ icon: item.icon,
217
+ label: item.label,
218
+ extra: item.extra,
219
+ ctx: ctx
220
+ })
221
+ ]
222
+ }, item.key);
223
+ return /*#__PURE__*/ jsxs(P.RadioItem, {
224
+ value: item.key,
225
+ disabled: item.disabled,
226
+ onSelect: ()=>ctx.onAction(item),
227
+ "data-tao-menu-item": "",
228
+ "data-tao-menu-selectable": "",
229
+ "data-tao-danger": item.danger || void 0,
230
+ className: cx(ctx.classNames?.item),
231
+ style: ctx.styles?.item,
232
+ children: [
233
+ /*#__PURE__*/ jsx("span", {
234
+ "data-tao-menu-item-indicator": "",
235
+ children: /*#__PURE__*/ jsx(P.ItemIndicator, {
236
+ children: /*#__PURE__*/ jsx(DotIcon, {})
237
+ })
238
+ }),
239
+ /*#__PURE__*/ jsx(ItemBody, {
240
+ icon: item.icon,
241
+ label: item.label,
242
+ extra: item.extra,
243
+ ctx: ctx
244
+ })
245
+ ]
246
+ }, item.key);
247
+ }
248
+ return /*#__PURE__*/ jsx(P.Item, {
249
+ disabled: item.disabled,
250
+ onSelect: ()=>ctx.onAction(item),
251
+ "data-tao-menu-item": "",
252
+ "data-tao-danger": item.danger || void 0,
253
+ className: cx(ctx.classNames?.item),
254
+ style: ctx.styles?.item,
255
+ children: /*#__PURE__*/ jsx(ItemBody, {
256
+ icon: item.icon,
257
+ label: item.label,
258
+ extra: item.extra,
259
+ ctx: ctx
260
+ })
261
+ }, item.key);
262
+ });
263
+ }
264
+ function useMenuController(menu, P, semantic) {
265
+ const $ = c(31);
266
+ const selectable = !!menu.selectable;
267
+ const multiple = !!menu.multiple;
268
+ const isSelControlled = null != menu.selectedKeys;
269
+ let t0;
270
+ if ($[0] !== menu.defaultSelectedKeys) {
271
+ t0 = menu.defaultSelectedKeys ?? [];
272
+ $[0] = menu.defaultSelectedKeys;
273
+ $[1] = t0;
274
+ } else t0 = $[1];
275
+ const [selInternal, setSelInternal] = useState(t0);
276
+ let t1;
277
+ if ($[2] !== isSelControlled || $[3] !== menu.selectedKeys || $[4] !== selInternal) {
278
+ t1 = isSelControlled ? menu.selectedKeys ?? [] : selInternal;
279
+ $[2] = isSelControlled;
280
+ $[3] = menu.selectedKeys;
281
+ $[4] = selInternal;
282
+ $[5] = t1;
283
+ } else t1 = $[5];
284
+ const selectedKeys = t1;
285
+ let t2;
286
+ if ($[6] !== isSelControlled || $[7] !== menu) {
287
+ t2 = (next, changedKey)=>{
288
+ if (!isSelControlled) setSelInternal(next);
289
+ menu.onSelect?.({
290
+ key: changedKey,
291
+ selectedKeys: next
292
+ });
293
+ };
294
+ $[6] = isSelControlled;
295
+ $[7] = menu;
296
+ $[8] = t2;
297
+ } else t2 = $[8];
298
+ const commitSel = t2;
299
+ let t3;
300
+ if ($[9] !== commitSel || $[10] !== selectedKeys) {
301
+ t3 = (key)=>{
302
+ const next_0 = selectedKeys.includes(key) ? selectedKeys.filter((k)=>k !== key) : [
303
+ ...selectedKeys,
304
+ key
305
+ ];
306
+ commitSel(next_0, key);
307
+ };
308
+ $[9] = commitSel;
309
+ $[10] = selectedKeys;
310
+ $[11] = t3;
311
+ } else t3 = $[11];
312
+ const toggleKey = t3;
313
+ let t4;
314
+ if ($[12] !== commitSel) {
315
+ t4 = (key_0)=>commitSel([
316
+ key_0
317
+ ], key_0);
318
+ $[12] = commitSel;
319
+ $[13] = t4;
320
+ } else t4 = $[13];
321
+ const radioChange = t4;
322
+ let t5;
323
+ if ($[14] !== menu) {
324
+ t5 = (item)=>{
325
+ item.onClick?.({
326
+ key: item.key
327
+ });
328
+ menu.onClick?.({
329
+ key: item.key
330
+ });
331
+ };
332
+ $[14] = menu;
333
+ $[15] = t5;
334
+ } else t5 = $[15];
335
+ const onAction = t5;
336
+ let t6;
337
+ if ($[16] !== P || $[17] !== menu.items || $[18] !== multiple || $[19] !== onAction || $[20] !== selectable || $[21] !== selectedKeys || $[22] !== semantic.classNames || $[23] !== semantic.styles || $[24] !== toggleKey) {
338
+ const ctx = {
339
+ P,
340
+ classNames: semantic.classNames,
341
+ styles: semantic.styles,
342
+ onAction,
343
+ selectedKeys,
344
+ multiple,
345
+ selectable,
346
+ onToggle: toggleKey
347
+ };
348
+ t6 = renderMenuItems(menu.items, ctx);
349
+ $[16] = P;
350
+ $[17] = menu.items;
351
+ $[18] = multiple;
352
+ $[19] = onAction;
353
+ $[20] = selectable;
354
+ $[21] = selectedKeys;
355
+ $[22] = semantic.classNames;
356
+ $[23] = semantic.styles;
357
+ $[24] = toggleKey;
358
+ $[25] = t6;
359
+ } else t6 = $[25];
360
+ const body = t6;
361
+ if (selectable && !multiple) {
362
+ let t7;
363
+ if ($[26] !== P.RadioGroup || $[27] !== body || $[28] !== radioChange || $[29] !== selectedKeys[0]) {
364
+ t7 = /*#__PURE__*/ jsx(P.RadioGroup, {
365
+ value: selectedKeys[0],
366
+ onValueChange: radioChange,
367
+ children: body
368
+ });
369
+ $[26] = P.RadioGroup;
370
+ $[27] = body;
371
+ $[28] = radioChange;
372
+ $[29] = selectedKeys[0];
373
+ $[30] = t7;
374
+ } else t7 = $[30];
375
+ return t7;
376
+ }
377
+ return body;
378
+ }
379
+ export { renderMenuItems, useMenuController };