@yamada-ui/react 2.2.0-next-20260405094127 → 2.2.0-next-20260405095509

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 (241) hide show
  1. package/dist/cjs/components/tree/tree.cjs +138 -110
  2. package/dist/cjs/components/tree/tree.cjs.map +1 -1
  3. package/dist/cjs/components/tree/tree.style.cjs +30 -45
  4. package/dist/cjs/components/tree/tree.style.cjs.map +1 -1
  5. package/dist/cjs/components/tree/use-tree.cjs +32 -66
  6. package/dist/cjs/components/tree/use-tree.cjs.map +1 -1
  7. package/dist/cjs/core/css/conditions.cjs +4 -0
  8. package/dist/cjs/core/css/conditions.cjs.map +1 -1
  9. package/dist/cjs/theme/semantic-tokens/colors.cjs +1 -1
  10. package/dist/cjs/theme/semantic-tokens/colors.cjs.map +1 -1
  11. package/dist/esm/components/tree/tree.js +138 -110
  12. package/dist/esm/components/tree/tree.js.map +1 -1
  13. package/dist/esm/components/tree/tree.style.js +30 -45
  14. package/dist/esm/components/tree/tree.style.js.map +1 -1
  15. package/dist/esm/components/tree/use-tree.js +32 -66
  16. package/dist/esm/components/tree/use-tree.js.map +1 -1
  17. package/dist/esm/core/css/conditions.js +4 -0
  18. package/dist/esm/core/css/conditions.js.map +1 -1
  19. package/dist/esm/theme/semantic-tokens/colors.js +1 -1
  20. package/dist/esm/theme/semantic-tokens/colors.js.map +1 -1
  21. package/dist/types/components/accordion/accordion.d.ts +2 -2
  22. package/dist/types/components/accordion/accordion.style.d.ts +1 -1
  23. package/dist/types/components/accordion/use-accordion.d.ts +11 -11
  24. package/dist/types/components/action-bar/action-bar.d.ts +2 -2
  25. package/dist/types/components/airy/airy.d.ts +2 -2
  26. package/dist/types/components/alert/alert.d.ts +2 -2
  27. package/dist/types/components/alert/alert.style.d.ts +1 -1
  28. package/dist/types/components/alpha-slider/alpha-slider.d.ts +2 -2
  29. package/dist/types/components/aspect-ratio/aspect-ratio.d.ts +2 -2
  30. package/dist/types/components/autocomplete/autocomplete.d.ts +2 -2
  31. package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
  32. package/dist/types/components/autocomplete/use-autocomplete.d.ts +5 -5
  33. package/dist/types/components/avatar/avatar.d.ts +5 -5
  34. package/dist/types/components/avatar/use-avatar-group.d.ts +2 -2
  35. package/dist/types/components/badge/badge.d.ts +2 -2
  36. package/dist/types/components/bleed/bleed.d.ts +2 -2
  37. package/dist/types/components/blockquote/blockquote.d.ts +2 -2
  38. package/dist/types/components/breadcrumb/breadcrumb.d.ts +2 -2
  39. package/dist/types/components/breadcrumb/breadcrumb.style.d.ts +1 -1
  40. package/dist/types/components/breadcrumb/use-breadcrumb.d.ts +2 -2
  41. package/dist/types/components/button/button.d.ts +2 -2
  42. package/dist/types/components/button/icon-button.d.ts +2 -2
  43. package/dist/types/components/calendar/calendar.d.ts +2 -2
  44. package/dist/types/components/calendar/calendar.style.d.ts +2 -2
  45. package/dist/types/components/calendar/use-calendar.d.ts +8 -8
  46. package/dist/types/components/card/card.d.ts +2 -2
  47. package/dist/types/components/carousel/carousel.d.ts +2 -2
  48. package/dist/types/components/carousel/carousel.style.d.ts +2 -2
  49. package/dist/types/components/carousel/use-carousel.d.ts +3 -3
  50. package/dist/types/components/center/center.d.ts +2 -2
  51. package/dist/types/components/chart/area-chart.d.ts +2 -2
  52. package/dist/types/components/chart/bar-chart.d.ts +2 -2
  53. package/dist/types/components/chart/cartesian-chart.style.d.ts +1 -1
  54. package/dist/types/components/chart/chart.d.ts +5 -5
  55. package/dist/types/components/chart/composed-chart.d.ts +2 -2
  56. package/dist/types/components/chart/donut-chart.d.ts +2 -2
  57. package/dist/types/components/chart/line-chart.d.ts +2 -2
  58. package/dist/types/components/chart/pie-chart.d.ts +2 -2
  59. package/dist/types/components/chart/polar-chart.style.d.ts +1 -1
  60. package/dist/types/components/chart/radar-chart.d.ts +2 -2
  61. package/dist/types/components/chart/radial-chart.d.ts +2 -2
  62. package/dist/types/components/chart/use-chart.d.ts +2 -2
  63. package/dist/types/components/checkbox/checkbox.d.ts +5 -5
  64. package/dist/types/components/checkbox/checkbox.style.d.ts +1 -1
  65. package/dist/types/components/checkbox/use-checkbox-group.d.ts +2 -2
  66. package/dist/types/components/checkbox-card/checkbox-card.d.ts +5 -5
  67. package/dist/types/components/checkbox-card/checkbox-card.style.d.ts +1 -1
  68. package/dist/types/components/circle-progress/circle-progress.d.ts +2 -2
  69. package/dist/types/components/close-button/close-button.d.ts +2 -2
  70. package/dist/types/components/code/code.d.ts +2 -2
  71. package/dist/types/components/collapse/collapse.d.ts +2 -2
  72. package/dist/types/components/color-picker/color-picker.d.ts +2 -2
  73. package/dist/types/components/color-picker/color-picker.style.d.ts +1 -1
  74. package/dist/types/components/color-picker/use-color-picker.d.ts +2 -2
  75. package/dist/types/components/color-selector/color-selector.d.ts +2 -2
  76. package/dist/types/components/color-selector/use-color-selector.d.ts +3 -3
  77. package/dist/types/components/color-swatch/color-swatch.d.ts +2 -2
  78. package/dist/types/components/container/container.d.ts +2 -2
  79. package/dist/types/components/data-list/data-list.d.ts +2 -2
  80. package/dist/types/components/data-list/data-list.style.d.ts +1 -1
  81. package/dist/types/components/date-picker/date-picker.d.ts +2 -2
  82. package/dist/types/components/date-picker/date-picker.style.d.ts +1 -1
  83. package/dist/types/components/date-picker/use-date-picker.d.ts +4 -4
  84. package/dist/types/components/drawer/drawer.d.ts +2 -2
  85. package/dist/types/components/dropzone/dropzone.d.ts +5 -5
  86. package/dist/types/components/dropzone/dropzone.style.d.ts +1 -1
  87. package/dist/types/components/editable/editable.d.ts +4 -4
  88. package/dist/types/components/editable/use-editable.d.ts +2 -2
  89. package/dist/types/components/em/em.d.ts +2 -2
  90. package/dist/types/components/empty-state/empty-state.d.ts +2 -2
  91. package/dist/types/components/empty-state/empty-state.style.d.ts +2 -2
  92. package/dist/types/components/fade/fade.d.ts +2 -2
  93. package/dist/types/components/field/field.d.ts +3 -3
  94. package/dist/types/components/field/use-field-props.d.ts +4 -4
  95. package/dist/types/components/fieldset/fieldset.d.ts +3 -3
  96. package/dist/types/components/file-button/file-button.d.ts +2 -2
  97. package/dist/types/components/file-button/use-file-button.d.ts +18 -18
  98. package/dist/types/components/file-input/file-input.d.ts +2 -2
  99. package/dist/types/components/file-input/use-file-input.d.ts +17 -17
  100. package/dist/types/components/flex/flex.d.ts +2 -2
  101. package/dist/types/components/flip/flip.d.ts +4 -4
  102. package/dist/types/components/flip/flip.style.d.ts +1 -1
  103. package/dist/types/components/float/float.d.ts +2 -2
  104. package/dist/types/components/form/form.d.ts +3 -3
  105. package/dist/types/components/form/form.style.d.ts +1 -1
  106. package/dist/types/components/format/format-byte.d.ts +4 -4
  107. package/dist/types/components/format/format-date-time.d.ts +4 -4
  108. package/dist/types/components/format/format-number.d.ts +2 -2
  109. package/dist/types/components/grid/grid-item.d.ts +2 -2
  110. package/dist/types/components/grid/grid.d.ts +2 -2
  111. package/dist/types/components/group/group.d.ts +2 -2
  112. package/dist/types/components/group/use-group.d.ts +2 -2
  113. package/dist/types/components/heading/heading.d.ts +2 -2
  114. package/dist/types/components/hue-slider/hue-slider.d.ts +3 -3
  115. package/dist/types/components/icon/icon.d.ts +5 -5
  116. package/dist/types/components/image/image.d.ts +2 -2
  117. package/dist/types/components/indicator/indicator.d.ts +4 -4
  118. package/dist/types/components/infinite-scroll-area/infinite-scroll-area.d.ts +2 -2
  119. package/dist/types/components/input/input-addon.d.ts +2 -2
  120. package/dist/types/components/input/input-element.d.ts +2 -2
  121. package/dist/types/components/input/input.d.ts +2 -2
  122. package/dist/types/components/kbd/kbd.d.ts +2 -2
  123. package/dist/types/components/link/link.d.ts +2 -2
  124. package/dist/types/components/link-box/link-box.d.ts +2 -2
  125. package/dist/types/components/list/list.d.ts +2 -2
  126. package/dist/types/components/list/list.style.d.ts +2 -2
  127. package/dist/types/components/loading/loading-provider.d.ts +2 -2
  128. package/dist/types/components/loading/loading.d.ts +3 -3
  129. package/dist/types/components/mark/mark.d.ts +2 -2
  130. package/dist/types/components/menu/menu.d.ts +2 -2
  131. package/dist/types/components/menu/menu.style.d.ts +2 -2
  132. package/dist/types/components/menu/use-menu.d.ts +11 -11
  133. package/dist/types/components/modal/modal.d.ts +2 -2
  134. package/dist/types/components/native-accordion/native-accordion.d.ts +2 -2
  135. package/dist/types/components/native-accordion/native-accordion.style.d.ts +2 -2
  136. package/dist/types/components/native-accordion/use-native-accordion.d.ts +2 -2
  137. package/dist/types/components/native-popover/native-popover.d.ts +2 -2
  138. package/dist/types/components/native-select/native-select.d.ts +2 -2
  139. package/dist/types/components/native-select/native-select.style.d.ts +1 -1
  140. package/dist/types/components/native-table/native-table.d.ts +4 -4
  141. package/dist/types/components/notice/notice.style.d.ts +1 -1
  142. package/dist/types/components/number-input/number-input.d.ts +2 -2
  143. package/dist/types/components/number-input/number-input.style.d.ts +1 -1
  144. package/dist/types/components/pagination/pagination.d.ts +2 -2
  145. package/dist/types/components/pagination/pagination.style.d.ts +1 -1
  146. package/dist/types/components/pagination/use-pagination.d.ts +2 -2
  147. package/dist/types/components/password-input/password-input.d.ts +2 -2
  148. package/dist/types/components/password-input/password-input.style.d.ts +1 -1
  149. package/dist/types/components/password-input/strength-meter.d.ts +2 -2
  150. package/dist/types/components/password-input/strength-meter.style.d.ts +1 -1
  151. package/dist/types/components/password-input/use-password-input.d.ts +2 -2
  152. package/dist/types/components/pin-input/pin-input.d.ts +2 -2
  153. package/dist/types/components/pin-input/pin-input.style.d.ts +1 -1
  154. package/dist/types/components/pin-input/use-pin-input.d.ts +7 -7
  155. package/dist/types/components/popover/popover.d.ts +2 -2
  156. package/dist/types/components/progress/progress.d.ts +4 -4
  157. package/dist/types/components/progress/use-progress.d.ts +706 -706
  158. package/dist/types/components/qr-code/qr-code.d.ts +2 -2
  159. package/dist/types/components/radio/radio.d.ts +5 -5
  160. package/dist/types/components/radio/radio.style.d.ts +1 -1
  161. package/dist/types/components/radio/use-radio-group.d.ts +2 -2
  162. package/dist/types/components/radio-card/radio-card.d.ts +5 -5
  163. package/dist/types/components/radio-card/radio-card.style.d.ts +1 -1
  164. package/dist/types/components/rating/rating.style.d.ts +2 -2
  165. package/dist/types/components/rating/use-rating.d.ts +7 -7
  166. package/dist/types/components/reorder/reorder.d.ts +2 -2
  167. package/dist/types/components/reorder/reorder.style.d.ts +1 -1
  168. package/dist/types/components/reorder/use-reorder.d.ts +3 -3
  169. package/dist/types/components/resizable/resizable.d.ts +2 -2
  170. package/dist/types/components/resizable/resizable.style.d.ts +2 -2
  171. package/dist/types/components/resizable/use-resizable.d.ts +2 -2
  172. package/dist/types/components/ripple/ripple.d.ts +2 -2
  173. package/dist/types/components/ripple/use-ripple.d.ts +2 -2
  174. package/dist/types/components/rotate/rotate.d.ts +2 -2
  175. package/dist/types/components/saturation-slider/saturation-slider.d.ts +2 -2
  176. package/dist/types/components/saturation-slider/use-saturation-slider.d.ts +2 -2
  177. package/dist/types/components/scroll-area/scroll-area.d.ts +2 -2
  178. package/dist/types/components/segmented-control/segmented-control.d.ts +2 -2
  179. package/dist/types/components/segmented-control/segmented-control.style.d.ts +2 -2
  180. package/dist/types/components/segmented-control/use-segmented-control.d.ts +9 -9
  181. package/dist/types/components/select/select.d.ts +2 -2
  182. package/dist/types/components/select/select.style.d.ts +1 -1
  183. package/dist/types/components/select/use-select.d.ts +4 -4
  184. package/dist/types/components/separator/separator.d.ts +2 -2
  185. package/dist/types/components/simple-grid/simple-grid.d.ts +2 -2
  186. package/dist/types/components/skeleton/skeleton.d.ts +2 -2
  187. package/dist/types/components/slide/slide.d.ts +2 -2
  188. package/dist/types/components/slide-fade/slide-fade.d.ts +2 -2
  189. package/dist/types/components/slider/slider.d.ts +2 -2
  190. package/dist/types/components/slider/use-slider.d.ts +2 -2
  191. package/dist/types/components/stack/h-stack.d.ts +2 -2
  192. package/dist/types/components/stack/stack.d.ts +2 -2
  193. package/dist/types/components/stack/v-stack.d.ts +2 -2
  194. package/dist/types/components/stack/z-stack.d.ts +2 -2
  195. package/dist/types/components/stat/stat.d.ts +2 -2
  196. package/dist/types/components/status/status.d.ts +2 -2
  197. package/dist/types/components/status/status.style.d.ts +2 -2
  198. package/dist/types/components/steps/steps.d.ts +2 -2
  199. package/dist/types/components/steps/steps.style.d.ts +1 -1
  200. package/dist/types/components/steps/use-steps.d.ts +10 -10
  201. package/dist/types/components/switch/switch.d.ts +2 -2
  202. package/dist/types/components/table/table.d.ts +2 -2
  203. package/dist/types/components/tabs/tabs.d.ts +2 -2
  204. package/dist/types/components/tabs/tabs.style.d.ts +1 -1
  205. package/dist/types/components/tabs/use-tabs.d.ts +16 -16
  206. package/dist/types/components/tag/tag.d.ts +2 -2
  207. package/dist/types/components/tag/tag.style.d.ts +1 -1
  208. package/dist/types/components/text/text.d.ts +2 -2
  209. package/dist/types/components/textarea/textarea.d.ts +2 -2
  210. package/dist/types/components/textarea/use-autosize.d.ts +2 -2
  211. package/dist/types/components/timeline/timeline.d.ts +5 -5
  212. package/dist/types/components/timeline/timeline.style.d.ts +1 -1
  213. package/dist/types/components/toggle/toggle.d.ts +5 -5
  214. package/dist/types/components/toggle/use-toggle-group.d.ts +2 -2
  215. package/dist/types/components/toggle/use-toggle.d.ts +2 -2
  216. package/dist/types/components/tooltip/tooltip.d.ts +2 -2
  217. package/dist/types/components/tree/tree.d.ts +9 -10
  218. package/dist/types/components/tree/tree.style.d.ts +20 -23
  219. package/dist/types/components/tree/use-tree.d.ts +293 -12
  220. package/dist/types/components/visually-hidden/visually-hidden.d.ts +2 -2
  221. package/dist/types/components/wrap/wrap.d.ts +2 -2
  222. package/dist/types/core/components/create-component.d.ts +7 -7
  223. package/dist/types/core/css/conditions.d.ts +37 -5
  224. package/dist/types/core/system/color-mode-provider.d.ts +2 -2
  225. package/dist/types/core/system/storage-script.d.ts +3 -3
  226. package/dist/types/core/system/styled.d.ts +2 -2
  227. package/dist/types/core/system/system-provider.d.ts +2 -2
  228. package/dist/types/hooks/use-breakpoint/use-breakpoint-state.d.ts +2 -2
  229. package/dist/types/hooks/use-clickable/index.d.ts +2 -2
  230. package/dist/types/hooks/use-clipboard/index.d.ts +2 -2
  231. package/dist/types/hooks/use-combobox/index.d.ts +12 -12
  232. package/dist/types/hooks/use-counter/index.d.ts +2 -2
  233. package/dist/types/hooks/use-descendants/index.d.ts +2 -2
  234. package/dist/types/hooks/use-field-sizing/index.d.ts +2 -2
  235. package/dist/types/hooks/use-hover/index.d.ts +2 -2
  236. package/dist/types/providers/i18n-provider/i18n-provider.d.ts +3 -3
  237. package/dist/types/providers/ui-provider/ui-provider.d.ts +4 -4
  238. package/dist/types/theme/index.d.ts +1 -1
  239. package/dist/types/theme/semantic-tokens/index.d.ts +1 -1
  240. package/dist/types/utils/children.d.ts +2 -2
  241. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
4
+ const require_context = require('../../utils/context.cjs');
4
5
  const require_utils_index = require('../../utils/index.cjs');
5
6
  const require_factory = require('../../core/system/factory.cjs');
6
7
  const require_create_component = require('../../core/components/create-component.cjs');
@@ -37,13 +38,14 @@ const getReactNodeOrFunction = (type, custom, root) => {
37
38
  else if ((0, require_utils_index.utils_exports.isObject)(root) && ("group" in root || "item" in root)) return root[type];
38
39
  else return root;
39
40
  };
41
+ const [ItemComponentContext, useItemComponentContext] = require_context.createContext({ name: "ItemComponentContext" });
40
42
  const { ComponentContext, PropsContext: TreePropsContext, useComponentContext, usePropsContext: useTreePropsContext, withContext, withProvider } = require_create_component.createSlotComponent("tree", require_tree_style.treeStyle);
41
43
  /**
42
44
  * `Tree` is a component used to display hierarchical data structures in an expandable tree format.
43
45
  *
44
46
  * @see https://yamada-ui.com/docs/components/tree
45
47
  */
46
- const TreeRoot = withProvider(({ size, animated, children, endElement, indicator, indicatorHidden, items, loadingScheme, startElement, checkboxProps, endElementProps, groupProps, indicatorProps, itemProps, labelProps, startElementProps, triggerProps, ...rest }) => {
48
+ const TreeRoot = withProvider(({ size, animated, children, endElement, indicator, indicatorHidden, items, loadingScheme, startElement, checkboxProps, endElementProps, groupProps, indicatorProps, itemProps, labelProps, startElementProps, ...rest }) => {
47
49
  const computedChildren = (0, react.useMemo)(() => {
48
50
  if (children) return children;
49
51
  return recursiveTreeItem(items);
@@ -99,8 +101,7 @@ const TreeRoot = withProvider(({ size, animated, children, endElement, indicator
99
101
  indicatorProps,
100
102
  itemProps,
101
103
  labelProps,
102
- startElementProps,
103
- triggerProps
104
+ startElementProps
104
105
  }), [
105
106
  size,
106
107
  animated,
@@ -114,7 +115,6 @@ const TreeRoot = withProvider(({ size, animated, children, endElement, indicator
114
115
  itemProps,
115
116
  labelProps,
116
117
  startElementProps,
117
- triggerProps,
118
118
  checkboxProps,
119
119
  loadingScheme
120
120
  ]),
@@ -123,7 +123,7 @@ const TreeRoot = withProvider(({ size, animated, children, endElement, indicator
123
123
  })
124
124
  });
125
125
  }, "root", { transferProps: ["size"] })();
126
- const TreeItem = withContext(({ animated: animatedProp, asyncChildren: asyncChildrenProp, endElement, indicator: indicatorProp, label, loadingScheme, startElement, value: valueProp = (0, require_utils_index.utils_exports.isString)(label) ? label : void 0, checkboxProps, endElementProps, groupProps, indicatorProps, labelProps, startElementProps, triggerProps, ...rest }) => {
126
+ const TreeItem = withContext(({ className, css, colorScheme, animated: animatedProp, asyncChildren: asyncChildrenProp, endElement, indicator: indicatorProp, label, loadingScheme, startElement, value: valueProp = (0, require_utils_index.utils_exports.isString)(label) ? label : void 0, checkboxProps, endElementProps, groupProps, indicatorProps, labelProps, rootProps, startElementProps, ...rest }) => {
127
127
  const { checkable } = require_use_tree.useTreeContext();
128
128
  const componentContext = useComponentContext();
129
129
  const Loading = require_use_loading_component.useLoadingComponent(loadingScheme ?? componentContext.loadingScheme ?? "oval");
@@ -136,125 +136,123 @@ const TreeItem = withContext(({ animated: animatedProp, asyncChildren: asyncChil
136
136
  const asyncChildren = (0, react.useCallback)(async () => {
137
137
  return recursiveTreeItem(await asyncChildrenProp?.());
138
138
  }, [asyncChildrenProp]);
139
- const { branchOpen, children, disabled, group, groupLoading, groupOpen, level, value, getCheckboxProps, getGroupItemProps, getGroupProps, getIndicatorProps, getItemProps, getLabelProps, getTriggerProps, onGroupClose, onGroupOpen, onGroupToggle } = require_use_tree.useTreeItem({
139
+ const { branchOpen, children, disabled, group, groupLoading, groupOpen, level, props, value, getCheckboxProps, getGroupItemProps, getGroupProps, getIndicatorProps, getItemProps, getLabelProps, onGroupClose, onGroupOpen, onGroupToggle } = require_use_tree.useTreeItem({
140
140
  ...componentContext.itemProps,
141
141
  ...rest,
142
142
  asyncChildren: asyncChildrenProp ? asyncChildren : void 0,
143
143
  value: valueProp
144
144
  });
145
- const props = {
145
+ const itemProps = {
146
+ className,
147
+ css,
148
+ colorScheme,
149
+ "--level": level.toString(),
150
+ ...rootProps
151
+ };
152
+ const callbackProps = {
146
153
  disabled,
147
154
  expanded: groupOpen
148
155
  };
149
- const context = (0, react.useMemo)(() => ({
150
- branchOpen,
151
- groupOpen,
152
- level,
153
- value,
154
- onGroupClose,
155
- onGroupOpen,
156
- onGroupToggle
157
- }), [
158
- branchOpen,
159
- groupOpen,
160
- level,
161
- value,
162
- onGroupClose,
163
- onGroupOpen,
164
- onGroupToggle
165
- ]);
166
- const varProps = (0, react.useMemo)(() => ({ "--level": level.toString() }), [level]);
167
156
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_tree.TreeItemContext, {
168
- value: context,
169
- children: group ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_factory.styled.li, {
170
- ...varProps,
171
- ...getGroupItemProps(),
172
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TreeTrigger, {
173
- ...getTriggerProps({
174
- ...componentContext.triggerProps,
175
- ...triggerProps
176
- }),
177
- children: [
178
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeIndicator, {
179
- ...getIndicatorProps({
180
- "data-animated": (0, require_utils_index.utils_exports.dataAttr)(animated),
181
- ...componentContext.indicatorProps,
182
- ...indicatorProps
183
- }),
184
- children: groupLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Loading, {}) : (0, require_utils_index.utils_exports.runIfFn)(indicator, props)
185
- }),
186
- checkable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeCheckbox, {
187
- size: componentContext.size,
188
- ...getCheckboxProps({
189
- ...componentContext.checkboxProps,
190
- ...checkboxProps
191
- })
192
- }) : null,
193
- groupStartElement ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeStartElement, {
194
- ...componentContext.startElementProps,
195
- ...startElementProps,
196
- children: (0, require_utils_index.utils_exports.runIfFn)(groupStartElement, props)
197
- }) : null,
198
- label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeLabel, {
199
- ...getLabelProps({
200
- ...componentContext.labelProps,
201
- ...labelProps
202
- }),
203
- children: label
204
- }) : null,
205
- groupEndElement ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeEndElement, {
206
- ...componentContext.endElementProps,
207
- ...endElementProps,
208
- children: (0, require_utils_index.utils_exports.runIfFn)(groupEndElement, props)
209
- }) : null
210
- ]
211
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeGroup, {
212
- duration: !animated ? 0 : void 0,
213
- open: groupOpen,
214
- ...getGroupProps({
215
- ...componentContext.groupProps,
216
- ...groupProps
217
- }),
218
- children
219
- })]
220
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_factory.styled.li, {
221
- ...varProps,
222
- ...getItemProps(),
223
- children: [
224
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeIndicator, { ...getIndicatorProps({
225
- "data-hidden": "",
226
- ...componentContext.indicatorProps,
227
- ...indicatorProps
228
- }) }),
229
- checkable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeCheckbox, {
157
+ value: (0, react.useMemo)(() => ({
158
+ branchOpen,
159
+ groupOpen,
160
+ level,
161
+ value,
162
+ onGroupClose,
163
+ onGroupOpen,
164
+ onGroupToggle
165
+ }), [
166
+ branchOpen,
167
+ groupOpen,
168
+ level,
169
+ value,
170
+ onGroupClose,
171
+ onGroupOpen,
172
+ onGroupToggle
173
+ ]),
174
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItemComponentContext, {
175
+ value: (0, react.useMemo)(() => ({
176
+ checkboxProps: {
230
177
  size: componentContext.size,
231
178
  ...getCheckboxProps({
232
179
  ...componentContext.checkboxProps,
233
180
  ...checkboxProps
234
181
  })
235
- }) : null,
236
- itemStartElement ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeStartElement, {
182
+ },
183
+ endElementProps: {
184
+ ...componentContext.endElementProps,
185
+ ...endElementProps
186
+ },
187
+ indicatorProps: { ...getIndicatorProps({
188
+ ...componentContext.indicatorProps,
189
+ ...indicatorProps
190
+ }) },
191
+ labelProps: { ...getLabelProps({
192
+ ...componentContext.labelProps,
193
+ ...labelProps
194
+ }) },
195
+ startElementProps: {
237
196
  ...componentContext.startElementProps,
238
- ...startElementProps,
239
- children: (0, require_utils_index.utils_exports.runIfFn)(itemStartElement, props)
240
- }) : null,
241
- label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeLabel, {
242
- ...getLabelProps({
243
- ...componentContext.labelProps,
244
- ...labelProps
197
+ ...startElementProps
198
+ }
199
+ }), [
200
+ checkboxProps,
201
+ componentContext.checkboxProps,
202
+ componentContext.endElementProps,
203
+ componentContext.indicatorProps,
204
+ componentContext.labelProps,
205
+ componentContext.size,
206
+ componentContext.startElementProps,
207
+ endElementProps,
208
+ getCheckboxProps,
209
+ getIndicatorProps,
210
+ getLabelProps,
211
+ indicatorProps,
212
+ labelProps,
213
+ startElementProps
214
+ ]),
215
+ children: group ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_factory.styled.li, {
216
+ ...getGroupItemProps(itemProps),
217
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_factory.styled.div, {
218
+ "data-content": true,
219
+ ...props,
220
+ children: [
221
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeIndicator, {
222
+ "data-animated": (0, require_utils_index.utils_exports.dataAttr)(animated),
223
+ children: groupLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Loading, {}) : (0, require_utils_index.utils_exports.runIfFn)(indicator, callbackProps)
224
+ }),
225
+ checkable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeCheckbox, {}) : null,
226
+ groupStartElement ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeStartElement, { children: (0, require_utils_index.utils_exports.runIfFn)(groupStartElement, callbackProps) }) : null,
227
+ label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeLabel, { children: label }) : null,
228
+ groupEndElement ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeEndElement, { children: (0, require_utils_index.utils_exports.runIfFn)(groupEndElement, callbackProps) }) : null
229
+ ]
230
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeGroup, {
231
+ duration: !animated ? 0 : void 0,
232
+ open: groupOpen,
233
+ ...getGroupProps({
234
+ ...componentContext.groupProps,
235
+ ...groupProps
245
236
  }),
246
- children: label
247
- }) : null,
248
- itemEndElement ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeEndElement, {
249
- ...componentContext.endElementProps,
250
- ...endElementProps,
251
- children: (0, require_utils_index.utils_exports.runIfFn)(itemEndElement, props)
252
- }) : null
253
- ]
237
+ children
238
+ })]
239
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.styled.li, {
240
+ ...getItemProps(itemProps),
241
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_factory.styled.div, {
242
+ "data-content": true,
243
+ ...props,
244
+ children: [
245
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeIndicator, { "data-hidden": true }),
246
+ checkable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeCheckbox, {}) : null,
247
+ itemStartElement ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeStartElement, { children: (0, require_utils_index.utils_exports.runIfFn)(itemStartElement, callbackProps) }) : null,
248
+ label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeLabel, { children: label }) : null,
249
+ itemEndElement ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeEndElement, { children: (0, require_utils_index.utils_exports.runIfFn)(itemEndElement, callbackProps) }) : null
250
+ ]
251
+ })
252
+ })
254
253
  })
255
254
  });
256
255
  }, "item")();
257
- const TreeTrigger = withContext("div", "trigger")();
258
256
  const TreeGroup = withContext((props) => {
259
257
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_collapse.Collapse, {
260
258
  as: "ul",
@@ -269,17 +267,47 @@ const TreeIndicator = withContext(({ children = /* @__PURE__ */ (0, react_jsx_ru
269
267
  ...children.props
270
268
  });
271
269
  return react.Children.count(children) > 1 ? react.Children.only(null) : null;
272
- }, "indicator")();
273
- const TreeCheckbox = withContext(require_checkbox.Checkbox, "checkbox")();
270
+ }, "indicator")(void 0, (props) => {
271
+ const { indicatorProps } = useItemComponentContext();
272
+ return {
273
+ ...indicatorProps,
274
+ ...props
275
+ };
276
+ });
277
+ const TreeCheckbox = withContext(require_checkbox.Checkbox, "checkbox")(void 0, (props) => {
278
+ const { checkboxProps } = useItemComponentContext();
279
+ return {
280
+ ...checkboxProps,
281
+ ...props
282
+ };
283
+ });
274
284
  const TreeStartElement = withContext("div", {
275
285
  name: "StartElement",
276
286
  slot: ["element", "start"]
277
- })();
287
+ })(void 0, (props) => {
288
+ const { startElementProps } = useItemComponentContext();
289
+ return {
290
+ ...startElementProps,
291
+ ...props
292
+ };
293
+ });
278
294
  const TreeEndElement = withContext("div", {
279
295
  name: "EndElement",
280
296
  slot: ["element", "end"]
281
- })();
282
- const TreeLabel = withContext("span", "label")();
297
+ })(void 0, (props) => {
298
+ const { endElementProps } = useItemComponentContext();
299
+ return {
300
+ ...endElementProps,
301
+ ...props
302
+ };
303
+ });
304
+ const TreeLabel = withContext("span", "label")(void 0, (props) => {
305
+ const { labelProps } = useItemComponentContext();
306
+ return {
307
+ ...labelProps,
308
+ ...props
309
+ };
310
+ });
283
311
 
284
312
  //#endregion
285
313
  exports.TreeItem = TreeItem;
@@ -1 +1 @@
1
- {"version":3,"file":"tree.cjs","names":["createSlotComponent","treeStyle","useTree","TreeDescendantsContext","TreeContext","styled","useTreeContext","useLoadingComponent","useTreeItem","TreeItemContext","Collapse","ChevronRightIcon","Children","Checkbox"],"sources":["../../../../src/components/tree/tree.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { CheckboxProps } from \"../checkbox\"\nimport type { CollapseProps } from \"../collapse\"\nimport type { Loading } from \"../loading\"\nimport type { WithTransitionProps } from \"../motion\"\nimport type { TreeStyle } from \"./tree.style\"\nimport type { UseTreeItemProps, UseTreeProps } from \"./use-tree\"\nimport {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useMemo,\n} from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport {\n cast,\n dataAttr,\n isObject,\n isString,\n type ReactNodeOrFunction,\n runIfFn,\n} from \"../../utils\"\nimport { Checkbox } from \"../checkbox\"\nimport { Collapse } from \"../collapse\"\nimport { ChevronRightIcon } from \"../icon\"\nimport { useLoadingComponent } from \"../loading\"\nimport { treeStyle } from \"./tree.style\"\nimport {\n TreeContext,\n TreeDescendantsContext,\n TreeItemContext,\n useTree,\n useTreeContext,\n useTreeItem,\n} from \"./use-tree\"\n\ninterface TreeCallBackProps {\n disabled?: boolean\n expanded?: boolean\n}\n\ntype TreeItemReactNode =\n | ReactNodeOrFunction<TreeCallBackProps>\n | {\n group: ReactNodeOrFunction<TreeCallBackProps>\n item?: ReactNodeOrFunction<TreeCallBackProps>\n }\n | {\n item: ReactNodeOrFunction<TreeCallBackProps>\n group?: ReactNodeOrFunction<TreeCallBackProps>\n }\n\ninterface TreeItemWithValue extends Omit<TreeItemProps, \"children\"> {}\n\ninterface TreeItemWithChildren extends TreeItemWithValue {\n children: TreeItem[]\n}\n\nexport type TreeItem = TreeItemWithChildren | TreeItemWithValue\n\nconst recursiveTreeItem = (items?: TreeItem[]) => {\n return items?.map((props, index) => {\n const key = props.value || (isString(props.label) ? props.label : index)\n\n if (\"children\" in props) {\n const { children, ...rest } = props\n\n return (\n <TreeItem key={key} {...rest}>\n {recursiveTreeItem(children)}\n </TreeItem>\n )\n } else {\n return <TreeItem key={key} {...props} />\n }\n })\n}\n\nconst getReactNodeOrFunction = (\n type: \"group\" | \"item\",\n custom?: TreeItemReactNode,\n root?: TreeItemReactNode,\n): ReactNodeOrFunction<TreeCallBackProps> => {\n if (isObject(custom) && (\"group\" in custom || \"item\" in custom)) {\n return custom[type]\n } else if (custom) {\n return custom\n } else if (isObject(root) && (\"group\" in root || \"item\" in root)) {\n return root[type]\n } else {\n return root\n }\n}\n\ninterface ComponentContext extends Pick<\n TreeRootProps,\n | \"animated\"\n | \"checkboxProps\"\n | \"endElement\"\n | \"endElementProps\"\n | \"groupProps\"\n | \"indicator\"\n | \"indicatorHidden\"\n | \"indicatorProps\"\n | \"itemProps\"\n | \"labelProps\"\n | \"loadingScheme\"\n | \"size\"\n | \"startElement\"\n | \"startElementProps\"\n | \"triggerProps\"\n> {}\n\nexport interface TreeRootProps<Multiple extends boolean = false>\n extends\n HTMLStyledProps<\"ul\">,\n ThemeProps<TreeStyle>,\n UseTreeProps<Multiple>,\n Pick<\n TreeItemProps,\n | \"animated\"\n | \"checkboxProps\"\n | \"endElement\"\n | \"endElementProps\"\n | \"groupProps\"\n | \"indicator\"\n | \"indicatorProps\"\n | \"labelProps\"\n | \"loadingScheme\"\n | \"startElement\"\n | \"startElementProps\"\n | \"triggerProps\"\n > {\n /**\n * If `true`, hide the tree indicator icon for all items.\n *\n * @default false\n */\n indicatorHidden?: boolean\n /**\n * If provided, generate elements based on items.\n */\n items?: TreeItem[]\n /**\n * Props for the item component.\n */\n itemProps?: Omit<TreeItemProps, \"children\" | \"label\" | \"open\" | \"value\">\n}\n\nconst {\n ComponentContext,\n PropsContext: TreePropsContext,\n useComponentContext,\n usePropsContext: useTreePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<TreeRootProps, TreeStyle, ComponentContext>(\n \"tree\",\n treeStyle,\n)\n\nexport { TreePropsContext, useTreePropsContext }\n\n/**\n * `Tree` is a component used to display hierarchical data structures in an expandable tree format.\n *\n * @see https://yamada-ui.com/docs/components/tree\n */\nexport const TreeRoot = withProvider<\"ul\", TreeRootProps, \"size\">(\n <Multiple extends boolean = false>({\n size,\n animated,\n children,\n endElement,\n indicator,\n indicatorHidden,\n items,\n loadingScheme,\n startElement,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n triggerProps,\n ...rest\n }: TreeRootProps<Multiple>) => {\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return recursiveTreeItem(items)\n }, [children, items])\n const {\n activeDescendant,\n checkable,\n checkedValue,\n descendants,\n expandedValue,\n multiple,\n selectedValue,\n getRootProps,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n } = useTree({ ...rest, children: computedChildren })\n const context = useMemo(\n () => ({\n activeDescendant,\n checkable,\n checkedValue,\n expandedValue,\n multiple,\n selectedValue,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n }),\n [\n activeDescendant,\n checkable,\n checkedValue,\n expandedValue,\n multiple,\n selectedValue,\n onActiveDescendant,\n onCheckedChange,\n onSearch,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSelectedChange,\n ],\n )\n const componentContext = useMemo(\n () => ({\n size,\n animated,\n endElement,\n indicator,\n indicatorHidden,\n loadingScheme,\n startElement,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n triggerProps,\n }),\n [\n size,\n animated,\n endElement,\n indicator,\n indicatorHidden,\n startElement,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n triggerProps,\n checkboxProps,\n loadingScheme,\n ],\n )\n\n return (\n <TreeDescendantsContext value={descendants}>\n <TreeContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.ul {...getRootProps()} />\n </ComponentContext>\n </TreeContext>\n </TreeDescendantsContext>\n )\n },\n \"root\",\n { transferProps: [\"size\"] },\n)() as GenericsComponent<{\n <Multiple extends boolean = false>(\n props: TreeRootProps<Multiple>,\n ): ReactElement\n}>\n\nexport interface TreeItemProps\n extends\n Omit<HTMLStyledProps<\"li\">, \"value\">,\n Omit<UseTreeItemProps, \"asyncChildren\"> {\n /**\n * The label to display in the item.\n */\n label: ReactNode\n /**\n * If `true`, the tree item will be animated.\n *\n * @default false\n */\n animated?: boolean\n /**\n * The element to display at the end of the item.\n */\n endElement?: TreeItemReactNode\n /**\n * The tree indicator icon to use.\n */\n indicator?: ReactNodeOrFunction<TreeCallBackProps>\n /**\n * The loading scheme.\n *\n * @default 'oval'\n */\n loadingScheme?: Loading.Scheme\n /**\n * The element to display at the start of the item.\n */\n startElement?: TreeItemReactNode\n /**\n * Props for the checkbox component.\n */\n checkboxProps?: Omit<CheckboxProps, \"checked\" | \"defaultChecked\" | \"value\">\n /**\n * Props for the end component.\n */\n endElementProps?: TreeEndElementProps\n /**\n * Props for the group component.\n */\n groupProps?: Omit<TreeGroupProps, \"children\">\n /**\n * Props for the indicator component.\n */\n indicatorProps?: TreeIndicatorProps\n /**\n * Props for the label component.\n */\n labelProps?: TreeLabelProps\n /**\n * Props for the start component.\n */\n startElementProps?: TreeStartElementProps\n /**\n * Props for the trigger component.\n */\n triggerProps?: TreeTriggerProps\n /**\n * If provided, the tree item will be rendered as an async tree item.\n */\n asyncChildren?: () => Promise<TreeItem[]>\n}\n\nexport const TreeItem = withContext<\"li\", TreeItemProps>(\n ({\n animated: animatedProp,\n asyncChildren: asyncChildrenProp,\n endElement,\n indicator: indicatorProp,\n label,\n loadingScheme,\n startElement,\n value: valueProp = isString(label) ? label : undefined,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n labelProps,\n startElementProps,\n triggerProps,\n ...rest\n }) => {\n const { checkable } = useTreeContext()\n const componentContext = useComponentContext()\n const Loading = useLoadingComponent(\n loadingScheme ?? componentContext.loadingScheme ?? \"oval\",\n )\n const animated = animatedProp ?? componentContext.animated\n const indicator = indicatorProp ?? componentContext.indicator\n const groupStartElement = getReactNodeOrFunction(\n \"group\",\n startElement,\n componentContext.startElement,\n )\n const groupEndElement = getReactNodeOrFunction(\n \"group\",\n endElement,\n componentContext.endElement,\n )\n const itemStartElement = getReactNodeOrFunction(\n \"item\",\n startElement,\n componentContext.startElement,\n )\n const itemEndElement = getReactNodeOrFunction(\n \"item\",\n endElement,\n componentContext.endElement,\n )\n const asyncChildren = useCallback(async () => {\n const items = await asyncChildrenProp?.()\n\n return recursiveTreeItem(items)\n }, [asyncChildrenProp])\n const {\n branchOpen,\n children,\n disabled,\n group,\n groupLoading,\n groupOpen,\n level,\n value,\n getCheckboxProps,\n getGroupItemProps,\n getGroupProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n getTriggerProps,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n } = useTreeItem({\n ...componentContext.itemProps,\n ...rest,\n asyncChildren: asyncChildrenProp ? asyncChildren : undefined,\n value: valueProp,\n })\n const props = { disabled, expanded: groupOpen }\n const context = useMemo(\n () => ({\n branchOpen,\n groupOpen,\n level,\n value,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n }),\n [\n branchOpen,\n groupOpen,\n level,\n value,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n ],\n )\n const varProps = useMemo(() => ({ \"--level\": level.toString() }), [level])\n\n return (\n <TreeItemContext value={context}>\n {group ? (\n <styled.li {...varProps} {...getGroupItemProps()}>\n <TreeTrigger\n {...getTriggerProps({\n ...componentContext.triggerProps,\n ...triggerProps,\n })}\n >\n <TreeIndicator\n {...getIndicatorProps({\n \"data-animated\": dataAttr(animated),\n ...componentContext.indicatorProps,\n ...indicatorProps,\n })}\n >\n {groupLoading ? <Loading /> : runIfFn(indicator, props)}\n </TreeIndicator>\n {checkable ? (\n <TreeCheckbox\n size={componentContext.size}\n {...getCheckboxProps({\n ...componentContext.checkboxProps,\n ...checkboxProps,\n })}\n />\n ) : null}\n {groupStartElement ? (\n <TreeStartElement\n {...componentContext.startElementProps}\n {...startElementProps}\n >\n {runIfFn(groupStartElement, props)}\n </TreeStartElement>\n ) : null}\n {label ? (\n <TreeLabel\n {...getLabelProps({\n ...componentContext.labelProps,\n ...labelProps,\n })}\n >\n {label}\n </TreeLabel>\n ) : null}\n {groupEndElement ? (\n <TreeEndElement\n {...componentContext.endElementProps}\n {...endElementProps}\n >\n {runIfFn(groupEndElement, props)}\n </TreeEndElement>\n ) : null}\n </TreeTrigger>\n\n <TreeGroup\n duration={!animated ? 0 : undefined}\n open={groupOpen}\n {...getGroupProps({\n ...componentContext.groupProps,\n ...groupProps,\n })}\n >\n {children}\n </TreeGroup>\n </styled.li>\n ) : (\n <styled.li {...varProps} {...getItemProps()}>\n <TreeIndicator\n {...getIndicatorProps({\n \"data-hidden\": \"\",\n ...componentContext.indicatorProps,\n ...indicatorProps,\n })}\n />\n {checkable ? (\n <TreeCheckbox\n size={componentContext.size}\n {...getCheckboxProps({\n ...componentContext.checkboxProps,\n ...checkboxProps,\n })}\n />\n ) : null}\n {itemStartElement ? (\n <TreeStartElement\n {...componentContext.startElementProps}\n {...startElementProps}\n >\n {runIfFn(itemStartElement, props)}\n </TreeStartElement>\n ) : null}\n {label ? (\n <TreeLabel\n {...getLabelProps({\n ...componentContext.labelProps,\n ...labelProps,\n })}\n >\n {label}\n </TreeLabel>\n ) : null}\n {itemEndElement ? (\n <TreeEndElement\n {...componentContext.endElementProps}\n {...endElementProps}\n >\n {runIfFn(itemEndElement, props)}\n </TreeEndElement>\n ) : null}\n </styled.li>\n )}\n </TreeItemContext>\n )\n },\n \"item\",\n)()\n\ninterface TreeTriggerProps extends HTMLStyledProps {}\n\nconst TreeTrigger = withContext<\"div\", TreeTriggerProps>(\"div\", \"trigger\")()\n\ninterface TreeGroupProps\n extends\n Omit<HTMLStyledProps<\"ul\">, \"transition\">,\n Pick<CollapseProps, \"animationOpacity\" | keyof WithTransitionProps> {}\n\nconst TreeGroup = withContext<\"ul\", TreeGroupProps>((props) => {\n return <Collapse as=\"ul\" {...cast<CollapseProps>(props)} />\n}, \"group\")()\n\ninterface TreeIndicatorProps extends HTMLStyledProps<\"svg\"> {}\n\nconst TreeIndicator = withContext<\"svg\", TreeIndicatorProps>(\n ({ children = <ChevronRightIcon />, ...rest }) => {\n const { indicatorHidden } = useComponentContext()\n\n if (indicatorHidden) return null\n\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(children, { ...rest, ...children.props })\n\n return Children.count(children) > 1 ? Children.only(null) : null\n },\n \"indicator\",\n)()\n\ninterface TreeCheckboxProps extends CheckboxProps {}\n\nconst TreeCheckbox = withContext<\"input\", TreeCheckboxProps>(\n Checkbox,\n \"checkbox\",\n)()\n\ninterface TreeStartElementProps extends HTMLStyledProps {}\n\nconst TreeStartElement = withContext<\"div\", TreeStartElementProps>(\"div\", {\n name: \"StartElement\",\n slot: [\"element\", \"start\"],\n})()\n\ninterface TreeEndElementProps extends HTMLStyledProps {}\n\nconst TreeEndElement = withContext<\"div\", TreeEndElementProps>(\"div\", {\n name: \"EndElement\",\n slot: [\"element\", \"end\"],\n})()\n\ninterface TreeLabelProps extends HTMLStyledProps<\"span\"> {}\n\nconst TreeLabel = withContext<\"span\", TreeLabelProps>(\"span\", \"label\")()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqEA,MAAM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A;KACA;KACA;KACA;KACA;KACA;KACD,GACD;KACE;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD,CACF;cAMO,2CAACC,uBAAO,MAAG,GAAI,cAAc,GAAI;KAChB;IACP;GACS;GAG7B,QACA,EAAE,eAAe,CAAC,OAAO,EAAE,CAC5B,EAAE;AAwEH,MAAa,WAAW,aACrB,EACC,UAAU,cACV,eAAe,mBACf,YACA,WAAW,eACX,OACA,eACA,cACA,OAAO,4DAAqB,MAAM,GAAG,QAAQ,QAC7C,eACA,iBACA,YACA,gBACA,YACA,mBACA,cACA,GAAG,WACC;CACJ,MAAM,EAAE,cAAcC,iCAAgB;CACtC,MAAM,mBAAmB,qBAAqB;CAC9C,MAAM,UAAUC,kDACd,iBAAiB,iBAAiB,iBAAiB,OACpD;CACD,MAAM,WAAW,gBAAgB,iBAAiB;CAClD,MAAM,YAAY,iBAAiB,iBAAiB;CACpD,MAAM,oBAAoB,uBACxB,SACA,cACA,iBAAiB,aAClB;CACD,MAAM,kBAAkB,uBACtB,SACA,YACA,iBAAiB,WAClB;CACD,MAAM,mBAAmB,uBACvB,QACA,cACA,iBAAiB,aAClB;CACD,MAAM,iBAAiB,uBACrB,QACA,YACA,iBAAiB,WAClB;CACD,MAAM,uCAA4B,YAAY;AAG5C,SAAO,kBAFO,MAAM,qBAAqB,CAEV;IAC9B,CAAC,kBAAkB,CAAC;CACvB,MAAM,EACJ,YACA,UACA,UACA,OACA,cACA,WACA,OACA,OACA,kBACA,mBACA,eACA,mBACA,cACA,eACA,iBACA,cACA,aACA,kBACEC,6BAAY;EACd,GAAG,iBAAiB;EACpB,GAAG;EACH,eAAe,oBAAoB,gBAAgB;EACnD,OAAO;EACR,CAAC;CACF,MAAM,QAAQ;EAAE;EAAU,UAAU;EAAW;CAC/C,MAAM,oCACG;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACD,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;E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AAM;MAChB,GACjB;IACH,QACC,2CAAC;KACC,GAAI,cAAc;MAChB,GAAG,iBAAiB;MACpB,GAAG;MACJ,CAAC;eAED;MACS,GACV;IACH,iBACC,2CAAC;KACC,GAAI,iBAAiB;KACrB,GAAI;8DAEK,gBAAgB,MAAM;MAChB,GACf;;IACM;GAEE;GAGtB,OACD,EAAE;AAIH,MAAM,cAAc,YAAqC,OAAO,UAAU,EAAE;AAO5E,MAAM,YAAY,aAAmC,UAAU;AAC7D,QAAO,2CAACK;EAAS,IAAG;EAAK,+CAAwB,MAAM;GAAI;GAC1D,QAAQ,EAAE;AAIb,MAAM,gBAAgB,aACnB,EAAE,WAAW,2CAACC,gDAAmB,EAAE,GAAG,WAAW;CAChD,MAAM,EAAE,oBAAoB,qBAAqB;AAEjD,KAAI,gBAAiB,QAAO;AAE5B,+BAAqC,SAAS,CAC5C,gCAAoB,UAAU;EAAE,GAAG;EAAM,GAAG,SAAS;EAAO,CAAC;AAE/D,QAAOC,eAAS,MAAM,SAAS,GAAG,IAAIA,eAAS,KAAK,KAAK,GAAG;GAE9D,YACD,EAAE;AAIH,MAAM,eAAe,YACnBC,2BACA,WACD,EAAE;AAIH,MAAM,mBAAmB,YAA0C,OAAO;CACxE,MAAM;CACN,MAAM,CAAC,WAAW,QAAQ;CAC3B,CAAC,EAAE;AAIJ,MAAM,iBAAiB,YAAwC,OAAO;CACpE,MAAM;CACN,MAAM,CAAC,WAAW,MAAM;CACzB,CAAC,EAAE;AAIJ,MAAM,YAAY,YAAoC,QAAQ,QAAQ,EAAE"}
1
+ {"version":3,"file":"tree.cjs","names":["createContext","createSlotComponent","treeStyle","useTree","TreeDescendantsContext","TreeContext","styled","useTreeContext","useLoadingComponent","useTreeItem","TreeItemContext","Collapse","ChevronRightIcon","Children","Checkbox"],"sources":["../../../../src/components/tree/tree.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { CheckboxProps } from \"../checkbox\"\nimport type { CollapseProps } from \"../collapse\"\nimport type { Loading } from \"../loading\"\nimport type { WithTransitionProps } from \"../motion\"\nimport type { TreeStyle } from \"./tree.style\"\nimport type { UseTreeItemProps, UseTreeProps } from \"./use-tree\"\nimport {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useMemo,\n} from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport {\n cast,\n createContext,\n dataAttr,\n isObject,\n isString,\n type ReactNodeOrFunction,\n runIfFn,\n} from \"../../utils\"\nimport { Checkbox } from \"../checkbox\"\nimport { Collapse } from \"../collapse\"\nimport { ChevronRightIcon } from \"../icon\"\nimport { useLoadingComponent } from \"../loading\"\nimport { treeStyle } from \"./tree.style\"\nimport {\n TreeContext,\n TreeDescendantsContext,\n TreeItemContext,\n useTree,\n useTreeContext,\n useTreeItem,\n} from \"./use-tree\"\n\ninterface TreeCallBackProps {\n disabled?: boolean\n expanded?: boolean\n}\n\ntype TreeItemReactNode =\n | ReactNodeOrFunction<TreeCallBackProps>\n | {\n group: ReactNodeOrFunction<TreeCallBackProps>\n item?: ReactNodeOrFunction<TreeCallBackProps>\n }\n | {\n item: ReactNodeOrFunction<TreeCallBackProps>\n group?: ReactNodeOrFunction<TreeCallBackProps>\n }\n\ninterface TreeItemWithValue extends Omit<TreeItemProps, \"children\"> {}\n\ninterface TreeItemWithChildren extends TreeItemWithValue {\n children: TreeItem[]\n}\n\nexport type TreeItem = TreeItemWithChildren | TreeItemWithValue\n\nconst recursiveTreeItem = (items?: TreeItem[]) => {\n return items?.map((props, index) => {\n const key = props.value || (isString(props.label) ? props.label : index)\n\n if (\"children\" in props) {\n const { children, ...rest } = props\n\n return (\n <TreeItem key={key} {...rest}>\n {recursiveTreeItem(children)}\n </TreeItem>\n )\n } else {\n return <TreeItem key={key} {...props} />\n }\n })\n}\n\nconst getReactNodeOrFunction = (\n type: \"group\" | \"item\",\n custom?: TreeItemReactNode,\n root?: TreeItemReactNode,\n): ReactNodeOrFunction<TreeCallBackProps> => {\n if (isObject(custom) && (\"group\" in custom || \"item\" in custom)) {\n return custom[type]\n } else if (custom) {\n return custom\n } else if (isObject(root) && (\"group\" in root || \"item\" in root)) {\n return root[type]\n } else {\n return root\n }\n}\n\ninterface ComponentContext extends Pick<\n TreeRootProps,\n | \"animated\"\n | \"checkboxProps\"\n | \"endElement\"\n | \"endElementProps\"\n | \"groupProps\"\n | \"indicator\"\n | \"indicatorHidden\"\n | \"indicatorProps\"\n | \"itemProps\"\n | \"labelProps\"\n | \"loadingScheme\"\n | \"size\"\n | \"startElement\"\n | \"startElementProps\"\n> {}\n\ninterface ItemComponentContext {\n checkboxProps: TreeCheckboxProps\n endElementProps: TreeEndElementProps\n indicatorProps: TreeIndicatorProps\n labelProps: TreeLabelProps\n startElementProps: TreeStartElementProps\n}\n\nconst [ItemComponentContext, useItemComponentContext] =\n createContext<ItemComponentContext>({ name: \"ItemComponentContext\" })\n\nexport interface TreeRootProps<Multiple extends boolean = false>\n extends\n HTMLStyledProps<\"ul\">,\n ThemeProps<TreeStyle>,\n UseTreeProps<Multiple>,\n Pick<\n TreeItemProps,\n | \"animated\"\n | \"checkboxProps\"\n | \"endElement\"\n | \"endElementProps\"\n | \"groupProps\"\n | \"indicator\"\n | \"indicatorProps\"\n | \"labelProps\"\n | \"loadingScheme\"\n | \"startElement\"\n | \"startElementProps\"\n > {\n /**\n * If `true`, hide the tree indicator icon for all items.\n *\n * @default false\n */\n indicatorHidden?: boolean\n /**\n * If provided, generate elements based on items.\n */\n items?: TreeItem[]\n /**\n * Props for the item component.\n */\n itemProps?: Omit<TreeItemProps, \"children\" | \"label\" | \"open\" | \"value\">\n}\n\nconst {\n ComponentContext,\n PropsContext: TreePropsContext,\n useComponentContext,\n usePropsContext: useTreePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<TreeRootProps, TreeStyle, ComponentContext>(\n \"tree\",\n treeStyle,\n)\n\nexport { TreePropsContext, useTreePropsContext }\n\n/**\n * `Tree` is a component used to display hierarchical data structures in an expandable tree format.\n *\n * @see https://yamada-ui.com/docs/components/tree\n */\nexport const TreeRoot = withProvider<\"ul\", TreeRootProps, \"size\">(\n <Multiple extends boolean = false>({\n size,\n animated,\n children,\n endElement,\n indicator,\n indicatorHidden,\n items,\n loadingScheme,\n startElement,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n ...rest\n }: TreeRootProps<Multiple>) => {\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return recursiveTreeItem(items)\n }, [children, items])\n const {\n activeDescendant,\n checkable,\n checkedValue,\n descendants,\n expandedValue,\n multiple,\n selectedValue,\n getRootProps,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n } = useTree({ ...rest, children: computedChildren })\n const context = useMemo(\n () => ({\n activeDescendant,\n checkable,\n checkedValue,\n expandedValue,\n multiple,\n selectedValue,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n }),\n [\n activeDescendant,\n checkable,\n checkedValue,\n expandedValue,\n multiple,\n selectedValue,\n onActiveDescendant,\n onCheckedChange,\n onSearch,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSelectedChange,\n ],\n )\n const componentContext = useMemo(\n () => ({\n size,\n animated,\n endElement,\n indicator,\n indicatorHidden,\n loadingScheme,\n startElement,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n }),\n [\n size,\n animated,\n endElement,\n indicator,\n indicatorHidden,\n startElement,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n checkboxProps,\n loadingScheme,\n ],\n )\n\n return (\n <TreeDescendantsContext value={descendants}>\n <TreeContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.ul {...getRootProps()} />\n </ComponentContext>\n </TreeContext>\n </TreeDescendantsContext>\n )\n },\n \"root\",\n { transferProps: [\"size\"] },\n)() as GenericsComponent<{\n <Multiple extends boolean = false>(\n props: TreeRootProps<Multiple>,\n ): ReactElement\n}>\n\nexport interface TreeItemProps\n extends HTMLStyledProps<\"div\">, Omit<UseTreeItemProps, \"asyncChildren\"> {\n /**\n * The label to display in the item.\n */\n label: ReactNode\n /**\n * If `true`, the tree item will be animated.\n *\n * @default false\n */\n animated?: boolean\n /**\n * The element to display at the end of the item.\n */\n endElement?: TreeItemReactNode\n /**\n * The tree indicator icon to use.\n */\n indicator?: ReactNodeOrFunction<TreeCallBackProps>\n /**\n * The loading scheme.\n *\n * @default 'oval'\n */\n loadingScheme?: Loading.Scheme\n /**\n * The element to display at the start of the item.\n */\n startElement?: TreeItemReactNode\n /**\n * Props for the checkbox component.\n */\n checkboxProps?: Omit<CheckboxProps, \"checked\" | \"defaultChecked\" | \"value\">\n /**\n * Props for the end component.\n */\n endElementProps?: TreeEndElementProps\n /**\n * Props for the group component.\n */\n groupProps?: Omit<TreeGroupProps, \"children\">\n /**\n * Props for the indicator component.\n */\n indicatorProps?: TreeIndicatorProps\n /**\n * Props for the label component.\n */\n labelProps?: TreeLabelProps\n /**\n * Props for the root element.\n */\n rootProps?: HTMLStyledProps<\"li\">\n /**\n * Props for the start component.\n */\n startElementProps?: TreeStartElementProps\n /**\n * If provided, the tree item will be rendered as an async tree item.\n */\n asyncChildren?: () => Promise<TreeItem[]>\n}\n\nexport const TreeItem = withContext<\"div\", TreeItemProps>(\n ({\n className,\n css,\n colorScheme,\n animated: animatedProp,\n asyncChildren: asyncChildrenProp,\n endElement,\n indicator: indicatorProp,\n label,\n loadingScheme,\n startElement,\n value: valueProp = isString(label) ? label : undefined,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n labelProps,\n rootProps,\n startElementProps,\n ...rest\n }) => {\n const { checkable } = useTreeContext()\n const componentContext = useComponentContext()\n const Loading = useLoadingComponent(\n loadingScheme ?? componentContext.loadingScheme ?? \"oval\",\n )\n const animated = animatedProp ?? componentContext.animated\n const indicator = indicatorProp ?? componentContext.indicator\n const groupStartElement = getReactNodeOrFunction(\n \"group\",\n startElement,\n componentContext.startElement,\n )\n const groupEndElement = getReactNodeOrFunction(\n \"group\",\n endElement,\n componentContext.endElement,\n )\n const itemStartElement = getReactNodeOrFunction(\n \"item\",\n startElement,\n componentContext.startElement,\n )\n const itemEndElement = getReactNodeOrFunction(\n \"item\",\n endElement,\n componentContext.endElement,\n )\n const asyncChildren = useCallback(async () => {\n const items = await asyncChildrenProp?.()\n\n return recursiveTreeItem(items)\n }, [asyncChildrenProp])\n const {\n branchOpen,\n children,\n disabled,\n group,\n groupLoading,\n groupOpen,\n level,\n props,\n value,\n getCheckboxProps,\n getGroupItemProps,\n getGroupProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n } = useTreeItem({\n ...componentContext.itemProps,\n ...rest,\n asyncChildren: asyncChildrenProp ? asyncChildren : undefined,\n value: valueProp,\n })\n const itemProps = {\n className,\n css,\n colorScheme,\n \"--level\": level.toString(),\n ...rootProps,\n }\n const callbackProps = { disabled, expanded: groupOpen }\n const context = useMemo(\n () => ({\n branchOpen,\n groupOpen,\n level,\n value,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n }),\n [\n branchOpen,\n groupOpen,\n level,\n value,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n ],\n )\n const itemComponentContext = useMemo(\n () => ({\n checkboxProps: {\n size: componentContext.size,\n ...getCheckboxProps({\n ...componentContext.checkboxProps,\n ...checkboxProps,\n }),\n },\n endElementProps: {\n ...componentContext.endElementProps,\n ...endElementProps,\n },\n indicatorProps: {\n ...getIndicatorProps({\n ...componentContext.indicatorProps,\n ...indicatorProps,\n }),\n },\n labelProps: {\n ...getLabelProps({\n ...componentContext.labelProps,\n ...labelProps,\n }),\n },\n startElementProps: {\n ...componentContext.startElementProps,\n ...startElementProps,\n },\n }),\n [\n checkboxProps,\n componentContext.checkboxProps,\n componentContext.endElementProps,\n componentContext.indicatorProps,\n componentContext.labelProps,\n componentContext.size,\n componentContext.startElementProps,\n endElementProps,\n getCheckboxProps,\n getIndicatorProps,\n getLabelProps,\n indicatorProps,\n labelProps,\n startElementProps,\n ],\n )\n\n return (\n <TreeItemContext value={context}>\n <ItemComponentContext value={itemComponentContext}>\n {group ? (\n <styled.li {...getGroupItemProps(itemProps)}>\n <styled.div data-content {...props}>\n <TreeIndicator data-animated={dataAttr(animated)}>\n {groupLoading ? (\n <Loading />\n ) : (\n runIfFn(indicator, callbackProps)\n )}\n </TreeIndicator>\n {checkable ? <TreeCheckbox /> : null}\n {groupStartElement ? (\n <TreeStartElement>\n {runIfFn(groupStartElement, callbackProps)}\n </TreeStartElement>\n ) : null}\n {label ? <TreeLabel>{label}</TreeLabel> : null}\n {groupEndElement ? (\n <TreeEndElement>\n {runIfFn(groupEndElement, callbackProps)}\n </TreeEndElement>\n ) : null}\n </styled.div>\n\n <TreeGroup\n duration={!animated ? 0 : undefined}\n open={groupOpen}\n {...getGroupProps({\n ...componentContext.groupProps,\n ...groupProps,\n })}\n >\n {children}\n </TreeGroup>\n </styled.li>\n ) : (\n <styled.li {...getItemProps(itemProps)}>\n <styled.div data-content {...props}>\n <TreeIndicator data-hidden />\n {checkable ? <TreeCheckbox /> : null}\n {itemStartElement ? (\n <TreeStartElement>\n {runIfFn(itemStartElement, callbackProps)}\n </TreeStartElement>\n ) : null}\n {label ? <TreeLabel>{label}</TreeLabel> : null}\n {itemEndElement ? (\n <TreeEndElement>\n {runIfFn(itemEndElement, callbackProps)}\n </TreeEndElement>\n ) : null}\n </styled.div>\n </styled.li>\n )}\n </ItemComponentContext>\n </TreeItemContext>\n )\n },\n \"item\",\n)()\n\ninterface TreeGroupProps\n extends\n Omit<HTMLStyledProps<\"ul\">, \"transition\">,\n Pick<CollapseProps, \"animationOpacity\" | keyof WithTransitionProps> {}\n\nconst TreeGroup = withContext<\"ul\", TreeGroupProps>((props) => {\n return <Collapse as=\"ul\" {...cast<CollapseProps>(props)} />\n}, \"group\")()\n\ninterface TreeIndicatorProps extends HTMLStyledProps<\"svg\"> {}\n\nconst TreeIndicator = withContext<\"svg\", TreeIndicatorProps>(\n ({ children = <ChevronRightIcon />, ...rest }) => {\n const { indicatorHidden } = useComponentContext()\n\n if (indicatorHidden) return null\n\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(children, { ...rest, ...children.props })\n\n return Children.count(children) > 1 ? Children.only(null) : null\n },\n \"indicator\",\n)(undefined, (props) => {\n const { indicatorProps } = useItemComponentContext()\n\n return { ...indicatorProps, ...props }\n})\n\ninterface TreeCheckboxProps extends CheckboxProps {}\n\nconst TreeCheckbox = withContext<\"input\", TreeCheckboxProps>(\n Checkbox,\n \"checkbox\",\n)(undefined, (props) => {\n const { checkboxProps } = useItemComponentContext()\n\n return { ...checkboxProps, ...props }\n})\n\ninterface TreeStartElementProps extends HTMLStyledProps {}\n\nconst TreeStartElement = withContext<\"div\", TreeStartElementProps>(\"div\", {\n name: \"StartElement\",\n slot: [\"element\", \"start\"],\n})(undefined, (props) => {\n const { startElementProps } = useItemComponentContext()\n\n return { ...startElementProps, ...props }\n})\n\ninterface TreeEndElementProps extends HTMLStyledProps {}\n\nconst TreeEndElement = withContext<\"div\", TreeEndElementProps>(\"div\", {\n name: \"EndElement\",\n slot: [\"element\", \"end\"],\n})(undefined, (props) => {\n const { endElementProps } = useItemComponentContext()\n\n return { ...endElementProps, ...props }\n})\n\ninterface TreeLabelProps extends HTMLStyledProps<\"span\"> {}\n\nconst TreeLabel = withContext<\"span\", TreeLabelProps>(\"span\", \"label\")(\n undefined,\n (props) => {\n const { labelProps } = useItemComponentContext()\n\n return { ...labelProps, ...props }\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsEA,MAAM,qBAAqB,UAAuB;AAChD,QAAO,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;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD,GACD;KACE;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD,CACF;cAMO,2CAACC,uBAAO,MAAG,GAAI,cAAc,GAAI;KAChB;IACP;GACS;GAG7B,QACA,EAAE,eAAe,CAAC,OAAO,EAAE,CAC5B,EAAE;AAsEH,MAAa,WAAW,aACrB,EACC,WACA,KACA,aACA,UAAU,cACV,eAAe,mBACf,YACA,WAAW,eACX,OACA,eACA,cACA,OAAO,4DAAqB,MAAM,GAAG,QAAQ,QAC7C,eACA,iBACA,YACA,gBACA,YACA,WACA,mBACA,GAAG,WACC;CACJ,MAAM,EAAE,cAAcC,iCAAgB;CACtC,MAAM,mBAAmB,qBAAqB;CAC9C,MAAM,UAAUC,kDACd,iBAAiB,iBAAiB,iBAAiB,OACpD;CACD,MAAM,WAAW,gBAAgB,iBAAiB;CAClD,MAAM,YAAY,iBAAiB,iBAAiB;CACpD,MAAM,oBAAoB,uBACxB,SACA,cACA,iBAAiB,aAClB;CACD,MAAM,kBAAkB,uBACtB,SACA,YACA,iBAAiB,WAClB;CACD,MAAM,mBAAmB,uBACvB,QACA,cACA,iBAAiB,aAClB;CACD,MAAM,iBAAiB,uBACrB,QACA,YACA,iBAAiB,WAClB;CACD,MAAM,uCAA4B,YAAY;AAG5C,SAAO,kBAFO,MAAM,qBAAqB,CAEV;IAC9B,CAAC,kBAAkB,CAAC;CACvB,MAAM,EACJ,YACA,UACA,UACA,OACA,cACA,WACA,OACA,OACA,OACA,kBACA,mBACA,eACA,mBACA,cACA,eACA,cACA,aACA,kBACEC,6BAAY;EACd,GAAG,iBAAiB;EACpB,GAAG;EACH,eAAe,oBAAoB,gBAAgB;EACnD,OAAO;EACR,CAAC;CACF,MAAM,YAAY;EAChB;EACA;EACA;EACA,WAAW,MAAM,UAAU;EAC3B,GAAG;EACJ;CACD,MAAM,gBAAgB;EAAE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AE,oBAAoB,yBAAyB;AAErD,QAAO;EAAE,GAAG;EAAiB,GAAG;EAAO;EACvC;AAIF,MAAM,YAAY,YAAoC,QAAQ,QAAQ,CACpE,SACC,UAAU;CACT,MAAM,EAAE,eAAe,yBAAyB;AAEhD,QAAO;EAAE,GAAG;EAAY,GAAG;EAAO;EAErC"}
@@ -1,4 +1,5 @@
1
1
  const require_config = require('../../core/system/config.cjs');
2
+ const require_focus_ring = require('../../core/css/focus-ring.cjs');
2
3
  require('../../core/index.cjs');
3
4
  const require_checkbox_style = require('../checkbox/checkbox.style.cjs');
4
5
  require('../checkbox/index.cjs');
@@ -32,25 +33,27 @@ const treeStyle = require_config.defineComponentSlotStyle({
32
33
  "--element-color": "colors.fg.subtle",
33
34
  "--space": "spaces.1",
34
35
  "--space-start": "calc({depth-space} * ({level} - 1))",
35
- alignItems: "center",
36
+ alignItems: "stretch",
36
37
  display: "flex",
37
- _hasGroup: {
38
- alignItems: "stretch",
39
- flexDirection: "column"
40
- },
41
- _notHasGroup: {
38
+ flexDirection: "column",
39
+ focusVisibleRing: "none",
40
+ _content: {
41
+ alignItems: "center",
42
42
  border: "1px solid transparent",
43
43
  cursor: "pointer",
44
- focusVisibleRing: "inside",
44
+ display: "flex",
45
45
  gap: "{gap}",
46
46
  pe: "{space}",
47
47
  ps: "calc({space-start} + {space})",
48
48
  rounded: "{rounded}",
49
49
  userSelect: "none",
50
- _hover: { bg: "bg.subtle" },
51
- _focusVisible: { bg: "bg.subtle" },
52
- _disabled: { layerStyle: "disabled" }
53
- }
50
+ _hover: { bg: "bg.subtle" }
51
+ },
52
+ _focusVisible: { _content: {
53
+ bg: "bg.subtle",
54
+ ...require_focus_ring.focusRingStyle.inside
55
+ } },
56
+ _disabled: { _content: { layerStyle: "disabled" } }
54
57
  },
55
58
  label: {
56
59
  flex: "1",
@@ -62,22 +65,7 @@ const treeStyle = require_config.defineComponentSlotStyle({
62
65
  display: "flex",
63
66
  flexDirection: "column"
64
67
  },
65
- start: {},
66
- trigger: {
67
- alignItems: "center",
68
- border: "1px solid transparent",
69
- cursor: "pointer",
70
- display: "flex",
71
- focusVisibleRing: "inside",
72
- gap: "{gap}",
73
- pe: "{space}",
74
- ps: "calc({space-start} + {space})",
75
- rounded: "{rounded}",
76
- userSelect: "none",
77
- _hover: { bg: "bg.subtle" },
78
- _focusVisible: { bg: "bg.subtle" },
79
- _disabled: { layerStyle: "disabled" }
80
- }
68
+ start: {}
81
69
  },
82
70
  props: {
83
71
  shape: {
@@ -89,7 +77,7 @@ const treeStyle = require_config.defineComponentSlotStyle({
89
77
  group: {
90
78
  position: "relative",
91
79
  _before: {
92
- bg: "border",
80
+ bg: "{guide-line-color}",
93
81
  display: "block",
94
82
  h: "full",
95
83
  left: "calc({space-guide-line} + {depth-space})",
@@ -101,10 +89,9 @@ const treeStyle = require_config.defineComponentSlotStyle({
101
89
  },
102
90
  item: {
103
91
  "--space-guide-line": "calc(({space-start} * 2) + {space})",
104
- ps: "{space-guide-line}",
105
- _hasGroup: { ps: "0" }
92
+ _content: { ps: "{space-guide-line}" }
106
93
  },
107
- trigger: { ps: "{space-guide-line}" }
94
+ root: { "--guide-line-color": "colors.border" }
108
95
  } }
109
96
  },
110
97
  variants: {
@@ -121,13 +108,12 @@ const treeStyle = require_config.defineComponentSlotStyle({
121
108
  }
122
109
  }
123
110
  },
124
- item: { _notHasGroup: { _selected: {
125
- layerStyle: "solid",
126
- "--element-color": "colorScheme.contrast"
127
- } } },
128
- trigger: { _selected: {
129
- layerStyle: "solid",
130
- "--element-color": "colorScheme.contrast"
111
+ item: { _selected: {
112
+ _content: {
113
+ layerStyle: "solid",
114
+ "--element-color": "colorScheme.contrast"
115
+ },
116
+ _focusVisible: { _content: { borderColor: "{focus-ring-color}" } }
131
117
  } }
132
118
  },
133
119
  subtle: {
@@ -135,13 +121,12 @@ const treeStyle = require_config.defineComponentSlotStyle({
135
121
  ...require_checkbox_style.checkboxStyle.variants?.solid.root,
136
122
  _indicator: require_checkbox_style.checkboxStyle.variants?.solid.indicator
137
123
  },
138
- item: { _notHasGroup: { _selected: {
139
- layerStyle: "subtle",
140
- "--element-color": "colorScheme.fg"
141
- } } },
142
- trigger: { _selected: {
143
- layerStyle: "subtle",
144
- "--element-color": "colorScheme.fg"
124
+ item: { _selected: {
125
+ _content: {
126
+ layerStyle: "subtle",
127
+ "--element-color": "colorScheme.fg"
128
+ },
129
+ _focusVisible: { _content: { borderColor: "{focus-ring-color}" } }
145
130
  } }
146
131
  }
147
132
  },
@@ -1 +1 @@
1
- {"version":3,"file":"tree.style.cjs","names":["defineComponentSlotStyle","checkboxStyle"],"sources":["../../../../src/components/tree/tree.style.ts"],"sourcesContent":["import { defineComponentSlotStyle } from \"../../core\"\nimport { checkboxStyle } from \"../checkbox\"\n\nexport const treeStyle = defineComponentSlotStyle({\n base: {\n checkbox: { \"--indicator-bg\": \"colors.bg\" },\n element: {\n color: \"{element-color}\",\n display: \"inline-center\",\n gap: \"{space}\",\n },\n end: {},\n group: { alignItems: \"stretch\", display: \"flex\", flexDirection: \"column\" },\n indicator: {\n color: \"{element-color}\",\n transformOrigin: \"center\",\n _animated: {\n transitionDuration: \"moderate\",\n transitionProperty: \"transform\",\n },\n _expanded: { transform: \"rotate(90deg)\" },\n _hidden: { opacity: \"0\" },\n },\n item: {\n \"--element-color\": \"colors.fg.subtle\",\n \"--space\": \"spaces.1\",\n \"--space-start\": \"calc({depth-space} * ({level} - 1))\",\n alignItems: \"center\",\n display: \"flex\",\n _hasGroup: {\n alignItems: \"stretch\",\n flexDirection: \"column\",\n },\n _notHasGroup: {\n border: \"1px solid transparent\",\n cursor: \"pointer\",\n focusVisibleRing: \"inside\",\n gap: \"{gap}\",\n pe: \"{space}\",\n ps: \"calc({space-start} + {space})\",\n rounded: \"{rounded}\",\n userSelect: \"none\",\n _hover: { bg: \"bg.subtle\" },\n _focusVisible: { bg: \"bg.subtle\" },\n _disabled: { layerStyle: \"disabled\" },\n },\n },\n label: { flex: \"1\", textAlign: \"left\", truncated: true },\n root: {\n alignItems: \"stretch\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n start: {},\n trigger: {\n alignItems: \"center\",\n border: \"1px solid transparent\",\n cursor: \"pointer\",\n display: \"flex\",\n focusVisibleRing: \"inside\",\n gap: \"{gap}\",\n pe: \"{space}\",\n ps: \"calc({space-start} + {space})\",\n rounded: \"{rounded}\",\n userSelect: \"none\",\n _hover: { bg: \"bg.subtle\" },\n _focusVisible: { bg: \"bg.subtle\" },\n _disabled: { layerStyle: \"disabled\" },\n },\n },\n\n props: {\n /**\n * The shape of the component\n *\n * @default 'rounded'\n */\n shape: {\n circle: {\n item: { \"--rounded\": \"radii.full\" },\n },\n rounded: {\n item: { \"--rounded\": \"radii.l1\" },\n },\n square: {\n item: { \"--rounded\": \"0\" },\n },\n },\n /**\n * If `true`, display guide lines.\n *\n * @default false\n */\n withGuideLine: {\n true: {\n group: {\n position: \"relative\",\n _before: {\n bg: \"border\",\n display: \"block\",\n h: \"full\",\n left: \"calc({space-guide-line} + {depth-space})\",\n position: \"absolute\",\n transform: \"translateX(-50%)\",\n w: \"px\",\n zIndex: \"yamcha\",\n },\n },\n item: {\n \"--space-guide-line\": \"calc(({space-start} * 2) + {space})\",\n ps: \"{space-guide-line}\",\n _hasGroup: { ps: \"0\" },\n },\n trigger: { ps: \"{space-guide-line}\" },\n },\n },\n },\n\n variants: {\n solid: {\n checkbox: {\n ...checkboxStyle.variants?.solid.root,\n _indicator: checkboxStyle.variants?.solid.indicator,\n _selected: {\n _checked: { \"--indicator-border-color\": \"colorScheme.contrast\" },\n _indicator: {\n color: \"colorScheme.solid\",\n _checked: { bg: \"colorScheme.contrast\" },\n _indeterminate: { bg: \"colorScheme.contrast\" },\n },\n },\n },\n item: {\n _notHasGroup: {\n _selected: {\n layerStyle: \"solid\",\n \"--element-color\": \"colorScheme.contrast\",\n },\n },\n },\n trigger: {\n _selected: {\n layerStyle: \"solid\",\n \"--element-color\": \"colorScheme.contrast\",\n },\n },\n },\n subtle: {\n checkbox: {\n ...checkboxStyle.variants?.solid.root,\n _indicator: checkboxStyle.variants?.solid.indicator,\n },\n item: {\n _notHasGroup: {\n _selected: {\n layerStyle: \"subtle\",\n \"--element-color\": \"colorScheme.fg\",\n },\n },\n },\n trigger: {\n _selected: {\n layerStyle: \"subtle\",\n \"--element-color\": \"colorScheme.fg\",\n },\n },\n },\n },\n\n sizes: {\n sm: {\n item: { \"--depth-space\": \"spaces.1.5\", \"--gap\": \"spaces.1.5\" },\n root: { fontSize: \"sm\" },\n },\n md: {\n item: { \"--depth-space\": \"spaces.2\", \"--gap\": \"spaces.2\" },\n root: { fontSize: \"md\" },\n },\n lg: {\n item: { \"--depth-space\": \"spaces.2\", \"--gap\": \"spaces.2\" },\n root: { fontSize: \"lg\" },\n },\n },\n\n defaultProps: {\n size: \"md\",\n variant: \"subtle\",\n shape: \"rounded\",\n withGuideLine: false,\n },\n})\n\nexport type TreeStyle = typeof treeStyle\n"],"mappings":";;;;;;AAGA,MAAa,YAAYA,wCAAyB;CAChD,MAAM;EACJ,UAAU,EAAE,kBAAkB,aAAa;EAC3C,SAAS;GACP,OAAO;GACP,SAAS;GACT,KAAK;GACN;EACD,KAAK,EAAE;EACP,OAAO;GAAE,YAAY;GAAW,SAAS;GAAQ,eAAe;GAAU;EAC1E,WAAW;GACT,OAAO;GACP,iBAAiB;GACjB,WAAW;IACT,oBAAoB;IACpB,oBAAoB;IACrB;GACD,WAAW,EAAE,WAAW,iBAAiB;GACzC,SAAS,EAAE,SAAS,KAAK;GAC1B;EACD,MAAM;GACJ,mBAAmB;GACnB,WAAW;GACX,iBAAiB;GACjB,YAAY;GACZ,SAAS;GACT,WAAW;IACT,YAAY;IACZ,eAAe;IAChB;GACD,cAAc;IACZ,QAAQ;IACR,QAAQ;IACR,kBAAkB;IAClB,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,SAAS;IACT,YAAY;IACZ,QAAQ,EAAE,IAAI,aAAa;IAC3B,eAAe,EAAE,IAAI,a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EACD,QAAQ;GACN,UAAU;IACR,GAAGA,qCAAc,UAAU,MAAM;IACjC,YAAYA,qCAAc,UAAU,MAAM;IAC3C;GACD,MAAM,EACJ,cAAc,EACZ,WAAW;IACT,YAAY;IACZ,mBAAmB;IACpB,EACF,EACF;GACD,SAAS,EACP,WAAW;IACT,YAAY;IACZ,mBAAmB;IACpB,EACF;GACF;EACF;CAED,OAAO;EACL,IAAI;GACF,MAAM;IAAE,iBAAiB;IAAc,SAAS;IAAc;GAC9D,MAAM,EAAE,UAAU,MAAM;GACzB;EACD,IAAI;GACF,MAAM;IAAE,iBAAiB;IAAY,SAAS;IAAY;GAC1D,MAAM,EAAE,UAAU,MAAM;GACzB;EACD,IAAI;GACF,MAAM;IAAE,iBAAiB;IAAY,SAAS;IAAY;GAC1D,MAAM,EAAE,UAAU,MAAM;GACzB;EACF;CAED,cAAc;EACZ,MAAM;EACN,SAAS;EACT,OAAO;EACP,eAAe;EAChB;CACF,CAAC"}
1
+ {"version":3,"file":"tree.style.cjs","names":["defineComponentSlotStyle","focusRingStyle","checkboxStyle"],"sources":["../../../../src/components/tree/tree.style.ts"],"sourcesContent":["import { defineComponentSlotStyle, focusRingStyle } from \"../../core\"\nimport { checkboxStyle } from \"../checkbox\"\n\nexport const treeStyle = defineComponentSlotStyle({\n base: {\n checkbox: { \"--indicator-bg\": \"colors.bg\" },\n element: {\n color: \"{element-color}\",\n display: \"inline-center\",\n gap: \"{space}\",\n },\n end: {},\n group: { alignItems: \"stretch\", display: \"flex\", flexDirection: \"column\" },\n indicator: {\n color: \"{element-color}\",\n transformOrigin: \"center\",\n _animated: {\n transitionDuration: \"moderate\",\n transitionProperty: \"transform\",\n },\n _expanded: { transform: \"rotate(90deg)\" },\n _hidden: { opacity: \"0\" },\n },\n item: {\n \"--element-color\": \"colors.fg.subtle\",\n \"--space\": \"spaces.1\",\n \"--space-start\": \"calc({depth-space} * ({level} - 1))\",\n alignItems: \"stretch\",\n display: \"flex\",\n flexDirection: \"column\",\n focusVisibleRing: \"none\",\n _content: {\n alignItems: \"center\",\n border: \"1px solid transparent\",\n cursor: \"pointer\",\n display: \"flex\",\n gap: \"{gap}\",\n pe: \"{space}\",\n ps: \"calc({space-start} + {space})\",\n rounded: \"{rounded}\",\n userSelect: \"none\",\n _hover: { bg: \"bg.subtle\" },\n },\n _focusVisible: {\n _content: { bg: \"bg.subtle\", ...focusRingStyle.inside },\n },\n _disabled: { _content: { layerStyle: \"disabled\" } },\n },\n label: { flex: \"1\", textAlign: \"left\", truncated: true },\n root: {\n alignItems: \"stretch\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n start: {},\n },\n\n props: {\n /**\n * The shape of the component\n *\n * @default 'rounded'\n */\n shape: {\n circle: {\n item: { \"--rounded\": \"radii.full\" },\n },\n rounded: {\n item: { \"--rounded\": \"radii.l1\" },\n },\n square: {\n item: { \"--rounded\": \"0\" },\n },\n },\n /**\n * If `true`, display guide lines.\n *\n * @default false\n */\n withGuideLine: {\n true: {\n group: {\n position: \"relative\",\n _before: {\n bg: \"{guide-line-color}\",\n display: \"block\",\n h: \"full\",\n left: \"calc({space-guide-line} + {depth-space})\",\n position: \"absolute\",\n transform: \"translateX(-50%)\",\n w: \"px\",\n zIndex: \"yamcha\",\n },\n },\n item: {\n \"--space-guide-line\": \"calc(({space-start} * 2) + {space})\",\n _content: { ps: \"{space-guide-line}\" },\n },\n root: { \"--guide-line-color\": \"colors.border\" },\n },\n },\n },\n\n variants: {\n solid: {\n checkbox: {\n ...checkboxStyle.variants?.solid.root,\n _indicator: checkboxStyle.variants?.solid.indicator,\n _selected: {\n _checked: { \"--indicator-border-color\": \"colorScheme.contrast\" },\n _indicator: {\n color: \"colorScheme.solid\",\n _checked: { bg: \"colorScheme.contrast\" },\n _indeterminate: { bg: \"colorScheme.contrast\" },\n },\n },\n },\n item: {\n _selected: {\n _content: {\n layerStyle: \"solid\",\n \"--element-color\": \"colorScheme.contrast\",\n },\n _focusVisible: {\n _content: { borderColor: \"{focus-ring-color}\" },\n },\n },\n },\n },\n subtle: {\n checkbox: {\n ...checkboxStyle.variants?.solid.root,\n _indicator: checkboxStyle.variants?.solid.indicator,\n },\n item: {\n _selected: {\n _content: {\n layerStyle: \"subtle\",\n \"--element-color\": \"colorScheme.fg\",\n },\n _focusVisible: {\n _content: { borderColor: \"{focus-ring-color}\" },\n },\n },\n },\n },\n },\n\n sizes: {\n sm: {\n item: { \"--depth-space\": \"spaces.1.5\", \"--gap\": \"spaces.1.5\" },\n root: { fontSize: \"sm\" },\n },\n md: {\n item: { \"--depth-space\": \"spaces.2\", \"--gap\": \"spaces.2\" },\n root: { fontSize: \"md\" },\n },\n lg: {\n item: { \"--depth-space\": \"spaces.2\", \"--gap\": \"spaces.2\" },\n root: { fontSize: \"lg\" },\n },\n },\n\n defaultProps: {\n size: \"md\",\n variant: \"subtle\",\n shape: \"rounded\",\n withGuideLine: false,\n },\n})\n\nexport type TreeStyle = typeof treeStyle\n"],"mappings":";;;;;;;AAGA,MAAa,YAAYA,wCAAyB;CAChD,MAAM;EACJ,UAAU,EAAE,kBAAkB,aAAa;EAC3C,SAAS;GACP,OAAO;GACP,SAAS;GACT,KAAK;GACN;EACD,KAAK,EAAE;EACP,OAAO;GAAE,YAAY;GAAW,SAAS;GAAQ,eAAe;GAAU;EAC1E,WAAW;GACT,OAAO;GACP,iBAAiB;GACjB,WAAW;IACT,oBAAoB;IACpB,oBAAoB;IACrB;GACD,WAAW,EAAE,WAAW,iBAAiB;GACzC,SAAS,EAAE,SAAS,KAAK;GAC1B;EACD,MAAM;GACJ,mBAAmB;GACnB,WAAW;GACX,iBAAiB;GACjB,YAAY;GACZ,SAAS;GACT,eAAe;GACf,kBAAkB;GAClB,UAAU;IACR,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,SAAS;IACT,YAAY;IACZ,QAAQ,EAAE,IAAI,aAAa;IAC5B;GACD,eAAe,EACb,UAAU;IAAE,IAAI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