@itwin/itwinui-react 5.0.0-alpha.12 → 5.0.0-alpha.14

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 (109) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +31 -0
  3. package/dist/DEV/bricks/Anchor.js +2 -2
  4. package/dist/DEV/bricks/Avatar.js +1 -1
  5. package/dist/DEV/bricks/Badge.js +1 -1
  6. package/dist/DEV/bricks/Button.js +2 -2
  7. package/dist/DEV/bricks/Checkbox.js +2 -4
  8. package/dist/DEV/bricks/Chip.js +3 -3
  9. package/dist/DEV/bricks/Description.js +1 -1
  10. package/dist/DEV/bricks/Divider.js +1 -1
  11. package/dist/DEV/bricks/DropdownMenu.js +23 -16
  12. package/dist/DEV/bricks/ErrorRegion.js +106 -0
  13. package/dist/DEV/bricks/Field.internal.js +2 -5
  14. package/dist/DEV/bricks/Field.js +17 -16
  15. package/dist/DEV/bricks/Icon.js +28 -7
  16. package/dist/DEV/bricks/IconButton.internal.js +23 -0
  17. package/dist/DEV/bricks/IconButton.js +24 -19
  18. package/dist/DEV/bricks/Kbd.js +3 -3
  19. package/dist/DEV/bricks/Label.js +1 -1
  20. package/dist/DEV/bricks/Radio.js +2 -4
  21. package/dist/DEV/bricks/Root.js +11 -11
  22. package/dist/DEV/bricks/Select.js +4 -7
  23. package/dist/DEV/bricks/Switch.js +2 -4
  24. package/dist/DEV/bricks/Table.js +2 -2
  25. package/dist/DEV/bricks/Tabs.js +1 -1
  26. package/dist/DEV/bricks/TextBox.js +6 -8
  27. package/dist/DEV/bricks/Toolbar.js +27 -0
  28. package/dist/DEV/bricks/Tooltip.js +4 -4
  29. package/dist/DEV/bricks/Tree.js +3 -3
  30. package/dist/DEV/bricks/TreeItem.js +254 -166
  31. package/dist/DEV/bricks/VisuallyHidden.js +10 -2
  32. package/dist/DEV/bricks/index.js +6 -2
  33. package/dist/DEV/bricks/styles.css.js +1 -1
  34. package/dist/DEV/bricks/~hooks.js +1 -1
  35. package/dist/DEV/bricks/~utils.Dot.js +22 -0
  36. package/dist/DEV/bricks/~utils.ListItem.js +2 -2
  37. package/dist/DEV/foundations/styles.css.js +1 -1
  38. package/dist/bricks/Anchor.d.ts +1 -1
  39. package/dist/bricks/Anchor.js +2 -2
  40. package/dist/bricks/Avatar.d.ts +1 -1
  41. package/dist/bricks/Avatar.js +1 -1
  42. package/dist/bricks/Badge.d.ts +1 -1
  43. package/dist/bricks/Badge.js +1 -1
  44. package/dist/bricks/Button.d.ts +1 -1
  45. package/dist/bricks/Button.js +2 -2
  46. package/dist/bricks/Checkbox.d.ts +2 -2
  47. package/dist/bricks/Checkbox.js +2 -4
  48. package/dist/bricks/Chip.d.ts +1 -1
  49. package/dist/bricks/Chip.js +3 -3
  50. package/dist/bricks/Description.d.ts +1 -1
  51. package/dist/bricks/Description.js +1 -1
  52. package/dist/bricks/Divider.d.ts +2 -2
  53. package/dist/bricks/Divider.js +1 -1
  54. package/dist/bricks/DropdownMenu.d.ts +5 -3
  55. package/dist/bricks/DropdownMenu.js +23 -16
  56. package/dist/bricks/ErrorRegion.d.ts +83 -0
  57. package/dist/bricks/ErrorRegion.js +104 -0
  58. package/dist/bricks/Field.d.ts +8 -2
  59. package/dist/bricks/Field.internal.d.ts +2 -1
  60. package/dist/bricks/Field.internal.js +2 -5
  61. package/dist/bricks/Field.js +17 -16
  62. package/dist/bricks/Icon.d.ts +4 -1
  63. package/dist/bricks/Icon.js +27 -7
  64. package/dist/bricks/IconButton.internal.d.ts +10 -0
  65. package/dist/bricks/IconButton.internal.js +22 -0
  66. package/dist/bricks/IconButton.js +24 -19
  67. package/dist/bricks/Kbd.d.ts +2 -2
  68. package/dist/bricks/Kbd.js +3 -3
  69. package/dist/bricks/Label.d.ts +1 -1
  70. package/dist/bricks/Label.js +1 -1
  71. package/dist/bricks/ProgressBar.d.ts +8 -2
  72. package/dist/bricks/Radio.d.ts +2 -2
  73. package/dist/bricks/Radio.js +2 -4
  74. package/dist/bricks/Root.d.ts +1 -1
  75. package/dist/bricks/Root.js +11 -11
  76. package/dist/bricks/Select.d.ts +1 -1
  77. package/dist/bricks/Select.js +4 -7
  78. package/dist/bricks/Skeleton.d.ts +1 -1
  79. package/dist/bricks/Spinner.d.ts +1 -1
  80. package/dist/bricks/Switch.d.ts +2 -2
  81. package/dist/bricks/Switch.js +2 -4
  82. package/dist/bricks/Table.d.ts +1 -1
  83. package/dist/bricks/Table.js +2 -2
  84. package/dist/bricks/Tabs.d.ts +1 -1
  85. package/dist/bricks/Tabs.js +1 -1
  86. package/dist/bricks/Text.d.ts +1 -1
  87. package/dist/bricks/TextBox.d.ts +1 -1
  88. package/dist/bricks/TextBox.js +6 -8
  89. package/dist/bricks/Toolbar.d.ts +36 -0
  90. package/dist/bricks/Toolbar.js +25 -0
  91. package/dist/bricks/Tooltip.d.ts +2 -2
  92. package/dist/bricks/Tooltip.js +4 -4
  93. package/dist/bricks/Tree.d.ts +2 -2
  94. package/dist/bricks/Tree.js +3 -3
  95. package/dist/bricks/TreeItem.d.ts +24 -8
  96. package/dist/bricks/TreeItem.js +243 -164
  97. package/dist/bricks/VisuallyHidden.d.ts +1 -1
  98. package/dist/bricks/VisuallyHidden.js +10 -2
  99. package/dist/bricks/index.d.ts +3 -1
  100. package/dist/bricks/index.js +6 -2
  101. package/dist/bricks/styles.css.js +1 -1
  102. package/dist/bricks/~hooks.js +1 -1
  103. package/dist/bricks/~utils.Dot.d.ts +11 -0
  104. package/dist/bricks/~utils.Dot.js +21 -0
  105. package/dist/bricks/~utils.ListItem.d.ts +1 -1
  106. package/dist/bricks/~utils.ListItem.js +2 -2
  107. package/dist/bricks/~utils.d.ts +1 -1
  108. package/dist/foundations/styles.css.js +1 -1
  109. package/package.json +1 -1
@@ -1,38 +1,54 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import * as React from "react";
3
- import cx from "classnames";
4
- import { Role } from "@ariakit/react/role";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { CompositeItem } from "@ariakit/react/composite";
5
3
  import { PopoverProvider } from "@ariakit/react/popover";
6
- import {
7
- CompositeItem
8
- } from "@ariakit/react/composite";
9
- import { Toolbar } from "@ariakit/react/toolbar";
10
- import * as ListItem from "./~utils.ListItem.js";
11
- import { IconButton } from "./IconButton.js";
4
+ import { Role } from "@ariakit/react/role";
5
+ import { Toolbar, ToolbarItem } from "@ariakit/react/toolbar";
6
+ import cx from "classnames";
7
+ import * as React from "react";
12
8
  import * as DropdownMenu from "./DropdownMenu.js";
13
- import { Icon, StatusWarning, MoreHorizontal } from "./Icon.js";
9
+ import { ChevronDown, Icon, MoreHorizontal, StatusWarning } from "./Icon.js";
10
+ import { IconButtonPresentation } from "./IconButton.internal.js";
11
+ import { IconButton } from "./IconButton.js";
12
+ import { useEventHandlers } from "./~hooks.js";
13
+ import * as ListItem from "./~utils.ListItem.js";
14
14
  import { forwardRef } from "./~utils.js";
15
- import { useEventHandlers, useSafeContext } from "./~hooks.js";
16
- import { GhostAligner, useGhostAlignment } from "./~utils.GhostAligner.js";
17
- const TreeItemContext = React.createContext(void 0);
18
- const TreeItemRoot = forwardRef(
19
- (props, forwardedRef) => {
15
+ const TreeItemErrorContext = React.createContext(void 0);
16
+ const TreeItemActionsContext = React.createContext(void 0);
17
+ const TreeItemDecorationsContext = React.createContext(void 0);
18
+ const TreeItemIconContext = React.createContext(void 0);
19
+ const TreeItemDecorationIdContext = React.createContext(
20
+ void 0
21
+ );
22
+ const TreeItemLabelContext = React.createContext(void 0);
23
+ const TreeItemLabelIdContext = React.createContext(
24
+ void 0
25
+ );
26
+ const TreeItemDescriptionContext = React.createContext(void 0);
27
+ const TreeItemDescriptionIdContext = React.createContext(
28
+ void 0
29
+ );
30
+ const TreeItemInlineActionsContext = React.createContext(void 0);
31
+ const TreeItemOverflowActionsContext = React.createContext(void 0);
32
+ const TreeItemHasOverflowActionsContext = React.createContext(false);
33
+ const TreeItem = React.memo(
34
+ forwardRef((props, forwardedRef) => {
35
+ const { expanded, selected } = props;
20
36
  const {
21
- "aria-level": level,
22
- selected,
23
- expanded,
24
- icon: iconProp,
37
+ onSelectedChange,
38
+ onExpandedChange,
39
+ icon,
25
40
  unstable_decorations,
26
41
  label,
27
42
  description,
28
43
  actions,
29
- error,
30
- onSelectedChange,
31
- onExpandedChange,
32
44
  onClick: onClickProp,
33
45
  onKeyDown: onKeyDownProp,
34
46
  ...rest
35
47
  } = props;
48
+ const onExpanderClick = useEventHandlers(() => {
49
+ if (expanded === void 0) return;
50
+ onExpandedChange?.(!expanded);
51
+ });
36
52
  const handleClick = (event) => {
37
53
  if (selected === void 0) return;
38
54
  event.stopPropagation();
@@ -48,40 +64,91 @@ const TreeItemRoot = forwardRef(
48
64
  onExpandedChange?.(event.key === "ArrowRight");
49
65
  }
50
66
  };
51
- const labelId = React.useId();
52
- const descriptionId = React.useId();
53
- const decorationId = React.useId();
54
- const icon = error ? /* @__PURE__ */ jsx(StatusWarning, {}) : iconProp;
67
+ return /* @__PURE__ */ jsx(TreeItemRootProvider, { ...props, children: /* @__PURE__ */ jsx(
68
+ TreeItemRoot,
69
+ {
70
+ ...rest,
71
+ onClick: useEventHandlers(onClickProp, handleClick),
72
+ onKeyDown: useEventHandlers(onKeyDownProp, handleKeyDown),
73
+ ref: forwardedRef,
74
+ children: React.useMemo(
75
+ () => /* @__PURE__ */ jsx(
76
+ TreeItemNode,
77
+ {
78
+ onExpanderClick,
79
+ expanded,
80
+ selected
81
+ }
82
+ ),
83
+ [onExpanderClick, expanded, selected]
84
+ )
85
+ }
86
+ ) });
87
+ })
88
+ );
89
+ function TreeItemRootProvider(props) {
90
+ const {
91
+ actions,
92
+ label,
93
+ description,
94
+ icon: iconProp,
95
+ unstable_decorations: decorations,
96
+ error
97
+ } = props;
98
+ const labelId = React.useId();
99
+ const descriptionId = React.useId();
100
+ const decorationId = React.useId();
101
+ const icon = error ? /* @__PURE__ */ jsx(StatusWarning, {}) : iconProp;
102
+ const hasDecoration = icon || decorations;
103
+ return /* @__PURE__ */ jsx(TreeItemErrorContext.Provider, { value: error, children: /* @__PURE__ */ jsx(TreeItemActionsContext.Provider, { value: actions, children: /* @__PURE__ */ jsx(
104
+ TreeItemDecorationIdContext.Provider,
105
+ {
106
+ value: hasDecoration ? decorationId : void 0,
107
+ children: /* @__PURE__ */ jsx(TreeItemDecorationsContext.Provider, { value: decorations, children: /* @__PURE__ */ jsx(TreeItemIconContext.Provider, { value: icon, children: /* @__PURE__ */ jsx(TreeItemLabelIdContext.Provider, { value: labelId, children: /* @__PURE__ */ jsx(TreeItemLabelContext.Provider, { value: label, children: /* @__PURE__ */ jsx(TreeItemDescriptionContext.Provider, { value: description, children: /* @__PURE__ */ jsx(
108
+ TreeItemDescriptionIdContext.Provider,
109
+ {
110
+ value: description ? descriptionId : void 0,
111
+ children: props.children
112
+ }
113
+ ) }) }) }) }) })
114
+ }
115
+ ) }) });
116
+ }
117
+ const TreeItemRoot = React.memo(
118
+ forwardRef((props, forwardedRef) => {
119
+ const {
120
+ style: styleProp,
121
+ "aria-level": level,
122
+ selected,
123
+ expanded,
124
+ ...rest
125
+ } = props;
126
+ const labelId = React.useContext(TreeItemLabelIdContext);
127
+ const decorationId = React.useContext(TreeItemDecorationIdContext);
128
+ const descriptionId = React.useContext(TreeItemDescriptionIdContext);
129
+ const error = React.useContext(TreeItemErrorContext);
130
+ const errorId = typeof error === "string" ? error : void 0;
55
131
  const describedBy = React.useMemo(() => {
56
- const idRefs = [];
57
- if (description) idRefs.push(descriptionId);
58
- if (unstable_decorations || icon) idRefs.push(decorationId);
59
- return idRefs.length > 0 ? idRefs.join(" ") : void 0;
60
- }, [unstable_decorations, icon, decorationId, description, descriptionId]);
132
+ const ids = [];
133
+ if (descriptionId) ids.push(descriptionId);
134
+ if (decorationId) ids.push(decorationId);
135
+ if (errorId) ids.push(errorId);
136
+ return ids.length > 0 ? ids.join(" ") : void 0;
137
+ }, [decorationId, descriptionId, errorId]);
138
+ const style = React.useMemo(
139
+ () => ({
140
+ ...styleProp,
141
+ "--\u{1F95D}tree-item-level": level
142
+ }),
143
+ [styleProp, level]
144
+ );
61
145
  return /* @__PURE__ */ jsx(
62
- TreeItemContext.Provider,
146
+ CompositeItem,
63
147
  {
64
- value: React.useMemo(
65
- () => ({
66
- level,
67
- expanded,
68
- selected,
69
- error
70
- }),
71
- [level, expanded, selected, error]
72
- ),
73
- children: /* @__PURE__ */ jsx(
74
- CompositeItem,
148
+ render: /* @__PURE__ */ jsx(
149
+ Role,
75
150
  {
76
- render: /* @__PURE__ */ jsx(Role, { ...rest }),
77
- onClick: useEventHandlers(
78
- onClickProp,
79
- handleClick
80
- ),
81
- onKeyDown: useEventHandlers(
82
- onKeyDownProp,
83
- handleKeyDown
84
- ),
151
+ ...rest,
85
152
  role: "treeitem",
86
153
  "aria-expanded": expanded,
87
154
  "aria-selected": selected,
@@ -89,88 +156,112 @@ const TreeItemRoot = forwardRef(
89
156
  "aria-describedby": describedBy,
90
157
  "aria-level": level,
91
158
  className: cx("\u{1F95D}-tree-item", props.className),
92
- ref: forwardedRef,
93
- children: /* @__PURE__ */ jsxs(
94
- ListItem.Root,
95
- {
96
- "data-kiwi-expanded": expanded,
97
- "data-kiwi-selected": selected,
98
- "data-kiwi-error": error ? true : void 0,
99
- className: "\u{1F95D}-tree-item-node",
100
- style: { "--\u{1F95D}tree-item-level": level },
101
- role: void 0,
102
- children: [
103
- /* @__PURE__ */ jsxs(ListItem.Decoration, { children: [
104
- /* @__PURE__ */ jsx(GhostAligner, { align: description ? "block" : void 0, children: /* @__PURE__ */ jsx(
105
- TreeItemExpander,
106
- {
107
- onClick: () => {
108
- if (expanded === void 0) return;
109
- onExpandedChange?.(!expanded);
110
- }
111
- }
112
- ) }),
113
- icon || unstable_decorations ? /* @__PURE__ */ jsx(
114
- Role,
115
- {
116
- className: "\u{1F95D}-tree-item-decoration",
117
- id: decorationId,
118
- render: React.isValidElement(icon) ? icon : typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : void 0,
119
- children: !icon ? unstable_decorations : null
120
- }
121
- ) : null
122
- ] }),
123
- /* @__PURE__ */ jsx(ListItem.Content, { id: labelId, className: "\u{1F95D}-tree-item-content", children: label }),
124
- description ? /* @__PURE__ */ jsx(
125
- ListItem.Content,
126
- {
127
- id: descriptionId,
128
- className: "\u{1F95D}-tree-item-description",
129
- children: description
130
- }
131
- ) : void 0,
132
- /* @__PURE__ */ jsx(
133
- ListItem.Decoration,
134
- {
135
- render: /* @__PURE__ */ jsx(TreeItemActions, { children: actions })
136
- }
137
- )
138
- ]
139
- }
140
- )
159
+ style,
160
+ ref: forwardedRef
141
161
  }
142
- )
162
+ ),
163
+ children: props.children
143
164
  }
144
165
  );
145
- }
166
+ })
146
167
  );
147
- const TreeItemActions = forwardRef((props, forwardedRef) => {
148
- const { children, ...rest } = props;
149
- const actions = React.Children.toArray(children).filter(Boolean);
150
- const { error } = useSafeContext(TreeItemContext);
151
- const limit = error ? 2 : 3;
168
+ const TreeItemNode = React.memo((props) => {
169
+ const { expanded, selected, onExpanderClick } = props;
170
+ const error = React.useContext(TreeItemErrorContext);
152
171
  return /* @__PURE__ */ jsxs(
153
- Toolbar,
172
+ ListItem.Root,
154
173
  {
155
- ...rest,
156
- onClick: useEventHandlers(props.onClick, (e) => e.stopPropagation()),
157
- onKeyDown: useEventHandlers(props.onKeyDown, (e) => e.stopPropagation()),
158
- className: cx("\u{1F95D}-tree-item-actions-container", props.className),
159
- focusLoop: false,
160
- ref: forwardedRef,
174
+ "data-kiwi-expanded": expanded,
175
+ "data-kiwi-selected": selected,
176
+ "data-kiwi-error": error ? true : void 0,
177
+ className: "\u{1F95D}-tree-item-node",
178
+ role: void 0,
161
179
  children: [
162
- actions.slice(0, limit - 1),
163
- actions.length === limit ? actions[limit - 1] : null,
164
- actions.length > limit ? /* @__PURE__ */ jsx(TreeItemActionsOverflowMenu, { children: actions.slice(limit - 1) }) : null
180
+ /* @__PURE__ */ jsx(TreeItemDecorations, { onExpanderClick }),
181
+ /* @__PURE__ */ jsx(TreeItemContent, {}),
182
+ /* @__PURE__ */ jsx(TreeItemDescription, {}),
183
+ /* @__PURE__ */ jsx(TreeItemActions, {})
165
184
  ]
166
185
  }
167
186
  );
168
187
  });
188
+ const TreeItemDecorations = React.memo((props) => {
189
+ return /* @__PURE__ */ jsxs(ListItem.Decoration, { children: [
190
+ /* @__PURE__ */ jsx(TreeItemExpander, { onClick: props.onExpanderClick }),
191
+ /* @__PURE__ */ jsx(TreeItemDecoration, {})
192
+ ] });
193
+ });
194
+ function TreeItemDecoration() {
195
+ const decorationId = React.useContext(TreeItemDecorationIdContext);
196
+ const decorations = React.useContext(TreeItemDecorationsContext);
197
+ const icon = React.useContext(TreeItemIconContext);
198
+ return icon || decorations ? /* @__PURE__ */ jsx(
199
+ Role,
200
+ {
201
+ className: "\u{1F95D}-tree-item-decoration",
202
+ id: decorationId,
203
+ render: React.isValidElement(icon) ? icon : typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : void 0,
204
+ children: !icon ? decorations : null
205
+ }
206
+ ) : null;
207
+ }
208
+ const TreeItemContent = React.memo(() => {
209
+ const labelId = React.useContext(TreeItemLabelIdContext);
210
+ const label = React.useContext(TreeItemLabelContext);
211
+ return /* @__PURE__ */ jsx(ListItem.Content, { id: labelId, className: "\u{1F95D}-tree-item-content", children: label });
212
+ });
213
+ const TreeItemDescription = React.memo(() => {
214
+ const description = React.useContext(TreeItemDescriptionContext);
215
+ const descriptionId = React.useContext(TreeItemDescriptionIdContext);
216
+ return description ? /* @__PURE__ */ jsx(ListItem.Content, { id: descriptionId, className: "\u{1F95D}-tree-item-description", children: description }) : void 0;
217
+ });
218
+ const TreeItemActions = React.memo(
219
+ forwardRef((props, forwardedRef) => {
220
+ return /* @__PURE__ */ jsx(TreeItemActionsProvider, { children: /* @__PURE__ */ jsx(
221
+ ListItem.Decoration,
222
+ {
223
+ ...props,
224
+ onClick: useEventHandlers(props.onClick, (e) => e.stopPropagation()),
225
+ onKeyDown: useEventHandlers(
226
+ props.onKeyDown,
227
+ (e) => e.stopPropagation()
228
+ ),
229
+ className: cx("\u{1F95D}-tree-item-actions-container", props.className),
230
+ ref: forwardedRef,
231
+ render: /* @__PURE__ */ jsxs(Toolbar, { focusLoop: false, children: [
232
+ /* @__PURE__ */ jsx(TreeItemInlineActions, {}),
233
+ /* @__PURE__ */ jsx(TreeItemActionsOverflowMenu, {})
234
+ ] })
235
+ }
236
+ ) });
237
+ })
238
+ );
239
+ function TreeItemActionsProvider(props) {
240
+ const actionsProp = React.useContext(TreeItemActionsContext);
241
+ const error = React.useContext(TreeItemErrorContext);
242
+ const actionsLimit = error ? 2 : 3;
243
+ const { inline, overflow } = React.useMemo(() => {
244
+ const actions = React.Children.toArray(actionsProp).filter(Boolean);
245
+ const inline2 = /* @__PURE__ */ jsxs(Fragment, { children: [
246
+ actions.slice(0, actionsLimit - 1),
247
+ actions.length === actionsLimit ? actions[actionsLimit - 1] : null
248
+ ] });
249
+ const overflow2 = actions.length > actionsLimit ? actions.slice(actionsLimit - 1) : void 0;
250
+ return { inline: inline2, overflow: overflow2 };
251
+ }, [actionsProp, actionsLimit]);
252
+ return /* @__PURE__ */ jsx(TreeItemInlineActionsContext.Provider, { value: inline, children: /* @__PURE__ */ jsx(TreeItemOverflowActionsContext.Provider, { value: overflow, children: /* @__PURE__ */ jsx(TreeItemHasOverflowActionsContext.Provider, { value: !!overflow, children: props.children }) }) });
253
+ }
254
+ function TreeItemInlineActions() {
255
+ const actions = React.useContext(TreeItemInlineActionsContext);
256
+ return actions;
257
+ }
169
258
  const arrowKeys = ["ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"];
170
259
  const TreeItemActionsOverflowMenuContext = React.createContext(false);
171
- function TreeItemActionsOverflowMenu({ children }) {
260
+ function TreeItemActionsOverflowMenu() {
261
+ const overflow = React.useContext(TreeItemHasOverflowActionsContext);
172
262
  const [open, setOpen] = React.useState(false);
173
263
  const isArrowKeyPressed = React.useRef(false);
264
+ if (!overflow) return null;
174
265
  return /* @__PURE__ */ jsx(PopoverProvider, { placement: "right-start", children: /* @__PURE__ */ jsxs(
175
266
  DropdownMenu.Root,
176
267
  {
@@ -197,19 +288,24 @@ function TreeItemActionsOverflowMenu({ children }) {
197
288
  render: /* @__PURE__ */ jsx(TreeItemAction, { label: "More", icon: /* @__PURE__ */ jsx(MoreHorizontal, {}) })
198
289
  }
199
290
  ),
200
- /* @__PURE__ */ jsx(TreeItemActionsOverflowMenuContext.Provider, { value: true, children: /* @__PURE__ */ jsx(DropdownMenu.Content, { children }) })
291
+ /* @__PURE__ */ jsx(TreeItemActionsOverflowMenuContext.Provider, { value: true, children: /* @__PURE__ */ jsx(TreeItemActionsOverflowMenuContent, {}) })
201
292
  ]
202
293
  }
203
294
  ) });
204
295
  }
205
- const TreeItemAction = forwardRef(
206
- (props, forwardedRef) => {
207
- const { error } = useSafeContext(TreeItemContext);
296
+ function TreeItemActionsOverflowMenuContent() {
297
+ const actions = React.useContext(TreeItemOverflowActionsContext);
298
+ return /* @__PURE__ */ jsx(DropdownMenu.Content, { children: actions });
299
+ }
300
+ const TreeItemAction = React.memo(
301
+ forwardRef((props, forwardedRef) => {
302
+ const error = React.useContext(TreeItemErrorContext);
208
303
  const {
209
304
  visible = error ? true : void 0,
210
305
  // visible by default during error state
211
306
  label,
212
307
  icon,
308
+ dot,
213
309
  ...rest
214
310
  } = props;
215
311
  if (React.useContext(TreeItemActionsOverflowMenuContext)) {
@@ -219,72 +315,55 @@ const TreeItemAction = forwardRef(
219
315
  ...rest,
220
316
  label,
221
317
  icon,
318
+ unstable_dot: dot,
222
319
  ref: forwardedRef
223
320
  }
224
321
  );
225
322
  }
226
323
  return /* @__PURE__ */ jsx(
227
- IconButton,
324
+ ToolbarItem,
228
325
  {
229
- label,
230
- icon,
231
- inert: visible === false ? true : void 0,
232
- ...rest,
233
- variant: "ghost",
234
- className: cx("\u{1F95D}-tree-item-action", props.className),
235
- "data-kiwi-visible": visible,
236
- ref: forwardedRef
326
+ render: /* @__PURE__ */ jsx(
327
+ IconButton,
328
+ {
329
+ label,
330
+ icon,
331
+ inert: visible === false ? true : void 0,
332
+ ...rest,
333
+ dot,
334
+ variant: "ghost",
335
+ className: cx("\u{1F95D}-tree-item-action", props.className),
336
+ "data-kiwi-visible": visible,
337
+ ref: forwardedRef
338
+ }
339
+ )
237
340
  }
238
341
  );
239
- }
342
+ })
240
343
  );
241
344
  const TreeItemExpander = forwardRef(
242
345
  (props, forwardedRef) => {
346
+ const descriptionId = React.useContext(TreeItemDescriptionIdContext);
243
347
  return /* @__PURE__ */ jsx(
244
- Role.span,
348
+ IconButtonPresentation,
245
349
  {
246
350
  "aria-hidden": "true",
247
351
  ...props,
248
352
  onClick: useEventHandlers(props.onClick, (e) => e.stopPropagation()),
249
353
  className: cx(
250
- "\u{1F95D}-button",
251
- "\u{1F95D}-icon-button",
252
354
  "\u{1F95D}-ghost-aligner",
253
355
  "\u{1F95D}-tree-item-expander",
254
356
  props.className
255
357
  ),
256
- "data-kiwi-variant": "ghost",
257
- "data-kiwi-ghost-align": useGhostAlignment(),
358
+ variant: "ghost",
359
+ "data-kiwi-ghost-align": descriptionId ? "block" : void 0,
258
360
  ref: forwardedRef,
259
- children: /* @__PURE__ */ jsx(TreeChevron, {})
260
- }
261
- );
262
- }
263
- );
264
- const TreeChevron = forwardRef(
265
- (props, forwardedRef) => {
266
- return /* @__PURE__ */ jsx(
267
- Icon,
268
- {
269
- ...props,
270
- render: /* @__PURE__ */ jsx(
271
- Role.svg,
272
- {
273
- width: "16",
274
- height: "16",
275
- fill: "currentColor",
276
- viewBox: "0 0 16 16",
277
- render: props.render,
278
- children: /* @__PURE__ */ jsx("path", { d: "M4.146 6.146a.5.5 0 0 1 .708 0L8 9.293l3.146-3.147a.5.5 0 0 1 .708.708l-3.5 3.5a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 0 1 0-.708Z" })
279
- }
280
- ),
281
- className: cx("\u{1F95D}-tree-chevron", props.className),
282
- ref: forwardedRef
361
+ children: /* @__PURE__ */ jsx(ChevronDown, {})
283
362
  }
284
363
  );
285
364
  }
286
365
  );
287
366
  export {
288
367
  TreeItemAction as Action,
289
- TreeItemRoot as Root
368
+ TreeItem as Root
290
369
  };
@@ -1,4 +1,4 @@
1
- import { type BaseProps } from "./~utils.js";
1
+ import type { BaseProps } from "./~utils.js";
2
2
  interface VisuallyHiddenProps extends BaseProps<"span"> {
3
3
  }
4
4
  /**
@@ -1,9 +1,17 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { VisuallyHidden as AkVisuallyHidden } from "@ariakit/react/visually-hidden";
2
+ import { Role } from "@ariakit/react/role";
3
+ import cx from "classnames";
3
4
  import { forwardRef } from "./~utils.js";
4
5
  const VisuallyHidden = forwardRef(
5
6
  (props, forwardedRef) => {
6
- return /* @__PURE__ */ jsx(AkVisuallyHidden, { ...props, ref: forwardedRef });
7
+ return /* @__PURE__ */ jsx(
8
+ Role.span,
9
+ {
10
+ ...props,
11
+ className: cx("\u{1F95D}-visually-hidden", props.className),
12
+ ref: forwardedRef
13
+ }
14
+ );
7
15
  }
8
16
  );
9
17
  export {
@@ -7,6 +7,7 @@ export { Checkbox } from "./Checkbox.js";
7
7
  export { Chip } from "./Chip.js";
8
8
  export { Description } from "./Description.js";
9
9
  export * as DropdownMenu from "./DropdownMenu.js";
10
+ export * as unstable_ErrorRegion from "./ErrorRegion.js";
10
11
  export { Divider } from "./Divider.js";
11
12
  export { Icon } from "./Icon.js";
12
13
  export { IconButton } from "./IconButton.js";
@@ -23,6 +24,7 @@ export * as Table from "./Table.js";
23
24
  export * as Tabs from "./Tabs.js";
24
25
  export { Text } from "./Text.js";
25
26
  export * as TextBox from "./TextBox.js";
26
- export * as Tree from "./Tree.js";
27
+ export * as unstable_Toolbar from "./Toolbar.js";
27
28
  export { Tooltip } from "./Tooltip.js";
29
+ export * as Tree from "./Tree.js";
28
30
  export { VisuallyHidden } from "./VisuallyHidden.js";
@@ -8,6 +8,7 @@ import { Checkbox } from "./Checkbox.js";
8
8
  import { Chip } from "./Chip.js";
9
9
  import { Description } from "./Description.js";
10
10
  import * as DropdownMenu from "./DropdownMenu.js";
11
+ import * as unstable_ErrorRegion from "./ErrorRegion.js";
11
12
  import { Divider } from "./Divider.js";
12
13
  import { Icon } from "./Icon.js";
13
14
  import { IconButton } from "./IconButton.js";
@@ -24,8 +25,9 @@ import * as Table from "./Table.js";
24
25
  import * as Tabs from "./Tabs.js";
25
26
  import { Text } from "./Text.js";
26
27
  import * as TextBox from "./TextBox.js";
27
- import * as Tree from "./Tree.js";
28
+ import * as unstable_Toolbar from "./Toolbar.js";
28
29
  import { Tooltip } from "./Tooltip.js";
30
+ import * as Tree from "./Tree.js";
29
31
  import { VisuallyHidden } from "./VisuallyHidden.js";
30
32
  export {
31
33
  Anchor,
@@ -55,5 +57,7 @@ export {
55
57
  TextBox,
56
58
  Tooltip,
57
59
  Tree,
58
- VisuallyHidden
60
+ VisuallyHidden,
61
+ unstable_ErrorRegion,
62
+ unstable_Toolbar
59
63
  };