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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/README.md +13 -2
  3. package/dist/DEV/bricks/Checkbox.js +7 -14
  4. package/dist/DEV/bricks/Description.js +7 -14
  5. package/dist/DEV/bricks/DropdownMenu.js +58 -20
  6. package/dist/DEV/bricks/Field.internal.js +47 -0
  7. package/dist/DEV/bricks/Field.js +116 -85
  8. package/dist/DEV/bricks/Icon.js +144 -7
  9. package/dist/DEV/bricks/Label.js +4 -10
  10. package/dist/DEV/bricks/Radio.js +7 -14
  11. package/dist/DEV/bricks/Root.internal.js +17 -0
  12. package/dist/DEV/bricks/Root.js +73 -27
  13. package/dist/DEV/bricks/Select.js +9 -15
  14. package/dist/DEV/bricks/Spinner.js +23 -8
  15. package/dist/DEV/bricks/Switch.js +8 -15
  16. package/dist/DEV/bricks/Table.js +71 -37
  17. package/dist/DEV/bricks/Tabs.js +4 -29
  18. package/dist/DEV/bricks/TextBox.js +23 -37
  19. package/dist/DEV/bricks/Tooltip.js +1 -1
  20. package/dist/DEV/bricks/TreeItem.js +92 -10
  21. package/dist/DEV/bricks/index.js +3 -1
  22. package/dist/DEV/bricks/styles.css.js +1 -1
  23. package/dist/DEV/bricks/~hooks.js +3 -1
  24. package/dist/DEV/bricks/~utils.js +17 -0
  25. package/dist/DEV/foundations/styles.css.js +1 -1
  26. package/dist/bricks/Badge.d.ts +1 -1
  27. package/dist/bricks/Checkbox.d.ts +13 -5
  28. package/dist/bricks/Checkbox.js +7 -14
  29. package/dist/bricks/Description.d.ts +2 -6
  30. package/dist/bricks/Description.js +7 -14
  31. package/dist/bricks/DropdownMenu.d.ts +9 -9
  32. package/dist/bricks/DropdownMenu.js +57 -19
  33. package/dist/bricks/Field.d.ts +63 -27
  34. package/dist/bricks/Field.internal.d.ts +33 -0
  35. package/dist/bricks/Field.internal.js +47 -0
  36. package/dist/bricks/Field.js +111 -84
  37. package/dist/bricks/Icon.d.ts +12 -1
  38. package/dist/bricks/Icon.js +142 -7
  39. package/dist/bricks/Label.d.ts +5 -12
  40. package/dist/bricks/Label.js +4 -10
  41. package/dist/bricks/Radio.d.ts +14 -5
  42. package/dist/bricks/Radio.js +7 -14
  43. package/dist/bricks/Root.d.ts +12 -0
  44. package/dist/bricks/Root.internal.d.ts +6 -0
  45. package/dist/bricks/Root.internal.js +17 -0
  46. package/dist/bricks/Root.js +73 -27
  47. package/dist/bricks/Select.d.ts +29 -12
  48. package/dist/bricks/Select.js +9 -15
  49. package/dist/bricks/Spinner.js +23 -8
  50. package/dist/bricks/Switch.d.ts +12 -5
  51. package/dist/bricks/Switch.js +8 -15
  52. package/dist/bricks/Table.d.ts +94 -37
  53. package/dist/bricks/Table.js +69 -36
  54. package/dist/bricks/Tabs.d.ts +3 -4
  55. package/dist/bricks/Tabs.js +4 -29
  56. package/dist/bricks/TextBox.d.ts +42 -19
  57. package/dist/bricks/TextBox.js +23 -37
  58. package/dist/bricks/Tooltip.js +1 -1
  59. package/dist/bricks/TreeItem.d.ts +53 -9
  60. package/dist/bricks/TreeItem.js +81 -10
  61. package/dist/bricks/index.d.ts +2 -1
  62. package/dist/bricks/index.js +3 -1
  63. package/dist/bricks/styles.css.js +1 -1
  64. package/dist/bricks/~hooks.d.ts +8 -0
  65. package/dist/bricks/~hooks.js +3 -1
  66. package/dist/bricks/~utils.d.ts +8 -0
  67. package/dist/bricks/~utils.js +17 -0
  68. package/dist/foundations/styles.css.js +1 -1
  69. package/package.json +1 -1
@@ -3,65 +3,90 @@ import { Role } from "@ariakit/react/role";
3
3
  import * as React from "react";
4
4
  import cx from "classnames";
5
5
  import { forwardRef } from "./~utils.js";
6
- import { useMergedRefs } from "./~hooks.js";
7
- const TableContext = React.createContext({
8
- setCaptionId: () => {
9
- }
10
- });
11
- const Table = forwardRef((props, forwardedRef) => {
12
- const [captionId, setCaptionId] = React.useState();
13
- const tableContext = React.useMemo(() => ({ setCaptionId }), []);
14
- return /* @__PURE__ */ jsx(TableContext.Provider, { value: tableContext, children: /* @__PURE__ */ jsx(
6
+ import { useMergedRefs, useSafeContext } from "./~hooks.js";
7
+ const TableContext = React.createContext(void 0);
8
+ const TableHeaderContext = React.createContext(false);
9
+ const HtmlTable = forwardRef((props, forwardedRef) => {
10
+ const tableContextValue = React.useMemo(
11
+ () => ({ mode: "html" }),
12
+ []
13
+ );
14
+ return /* @__PURE__ */ jsx(TableContext.Provider, { value: tableContextValue, children: /* @__PURE__ */ jsx(
15
15
  Role,
16
16
  {
17
+ render: /* @__PURE__ */ jsx("table", {}),
17
18
  ...props,
18
- className: cx("\u{1F95D}-table", props.className),
19
19
  ref: forwardedRef,
20
- role: "table",
21
- "aria-labelledby": captionId,
22
- children: props.children
20
+ className: cx("\u{1F95D}-table", props.className)
23
21
  }
24
22
  ) });
25
23
  });
26
- DEV: Table.displayName = "Table.Root";
27
- const TableHeaderContext = React.createContext(false);
24
+ DEV: HtmlTable.displayName = "Table.HtmlTable";
25
+ const CustomTable = forwardRef(
26
+ (props, forwardedRef) => {
27
+ const [captionId, setCaptionId] = React.useState();
28
+ const tableContextValue = React.useMemo(
29
+ () => ({ captionId, setCaptionId, mode: "aria" }),
30
+ [captionId]
31
+ );
32
+ return /* @__PURE__ */ jsx(TableContext.Provider, { value: tableContextValue, children: /* @__PURE__ */ jsx(
33
+ Role.div,
34
+ {
35
+ role: "table",
36
+ "aria-labelledby": captionId,
37
+ ...props,
38
+ ref: forwardedRef,
39
+ className: cx("\u{1F95D}-table", props.className)
40
+ }
41
+ ) });
42
+ }
43
+ );
44
+ DEV: CustomTable.displayName = "Table.CustomTable";
28
45
  const TableHeader = forwardRef(
29
46
  (props, forwardedRef) => {
47
+ const { mode } = useSafeContext(TableContext);
48
+ const render = mode === "html" ? /* @__PURE__ */ jsx("thead", {}) : void 0;
49
+ const role = mode === "aria" ? "rowgroup" : void 0;
30
50
  return /* @__PURE__ */ jsx(TableHeaderContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
31
51
  Role.div,
32
52
  {
53
+ render,
54
+ role,
33
55
  ...props,
34
- className: cx("\u{1F95D}-table-header", props.className),
35
56
  ref: forwardedRef,
36
- role: "rowgroup",
37
- children: props.children
57
+ className: cx("\u{1F95D}-table-header", props.className)
38
58
  }
39
59
  ) });
40
60
  }
41
61
  );
42
62
  DEV: TableHeader.displayName = "Table.Header";
43
63
  const TableBody = forwardRef((props, forwardedRef) => {
64
+ const { mode } = useSafeContext(TableContext);
65
+ const render = mode === "html" ? /* @__PURE__ */ jsx("tbody", {}) : void 0;
44
66
  return /* @__PURE__ */ jsx(
45
67
  Role.div,
46
68
  {
69
+ render,
70
+ role: void 0,
47
71
  ...props,
48
- className: cx("\u{1F95D}-table-body", props.className),
49
72
  ref: forwardedRef,
50
- children: props.children
73
+ className: cx("\u{1F95D}-table-body", props.className)
51
74
  }
52
75
  );
53
76
  });
54
77
  DEV: TableBody.displayName = "Table.Body";
55
78
  const TableRow = forwardRef((props, forwardedRef) => {
56
- const { children, ...rest } = props;
79
+ const { mode } = useSafeContext(TableContext);
80
+ const render = mode === "html" ? /* @__PURE__ */ jsx("tr", {}) : void 0;
81
+ const role = mode === "aria" ? "row" : void 0;
57
82
  return /* @__PURE__ */ jsx(
58
83
  Role.div,
59
84
  {
60
- ...rest,
61
- className: cx("\u{1F95D}-table-row", props.className),
85
+ render,
86
+ role,
87
+ ...props,
62
88
  ref: forwardedRef,
63
- role: "row",
64
- children
89
+ className: cx("\u{1F95D}-table-row", props.className)
65
90
  }
66
91
  );
67
92
  });
@@ -69,37 +94,45 @@ DEV: TableRow.displayName = "Table.Row";
69
94
  const TableCaption = forwardRef(
70
95
  (props, forwardedRef) => {
71
96
  const fallbackId = React.useId();
72
- const { id = fallbackId, children, ...rest } = props;
73
- const { setCaptionId } = React.useContext(TableContext);
97
+ const { id = fallbackId, ...rest } = props;
98
+ const { mode, setCaptionId } = useSafeContext(TableContext);
99
+ const render = mode === "html" ? /* @__PURE__ */ jsx("caption", {}) : void 0;
74
100
  const captionIdRef = React.useCallback(
75
101
  (element) => {
76
- setCaptionId(element ? id : void 0);
102
+ setCaptionId?.(element ? id : void 0);
77
103
  },
78
104
  [id, setCaptionId]
79
105
  );
80
106
  return /* @__PURE__ */ jsx(
81
- Role,
107
+ Role.div,
82
108
  {
109
+ render,
83
110
  ...rest,
84
111
  id,
85
- className: cx("\u{1F95D}-table-caption", props.className),
86
112
  ref: useMergedRefs(forwardedRef, captionIdRef),
87
- children
113
+ className: cx("\u{1F95D}-table-caption", props.className)
88
114
  }
89
115
  );
90
116
  }
91
117
  );
92
118
  DEV: TableCaption.displayName = "Table.Caption";
93
119
  const TableCell = forwardRef((props, forwardedRef) => {
94
- const isWithinTableHeader = React.useContext(TableHeaderContext);
120
+ const isWithinTableHeader = useSafeContext(TableHeaderContext);
121
+ const { mode } = useSafeContext(TableContext);
122
+ const { render, role } = React.useMemo(() => {
123
+ if (mode === "aria") {
124
+ return { role: isWithinTableHeader ? "columnheader" : "cell" };
125
+ }
126
+ return { render: isWithinTableHeader ? /* @__PURE__ */ jsx("th", {}) : /* @__PURE__ */ jsx("td", {}) };
127
+ }, [isWithinTableHeader, mode]);
95
128
  return /* @__PURE__ */ jsx(
96
- Role.span,
129
+ Role.div,
97
130
  {
131
+ render,
132
+ role,
98
133
  ...props,
99
- className: cx("\u{1F95D}-table-cell", props.className),
100
134
  ref: forwardedRef,
101
- role: isWithinTableHeader ? "columnheader" : "cell",
102
- children: props.children
135
+ className: cx("\u{1F95D}-table-cell", props.className)
103
136
  }
104
137
  );
105
138
  });
@@ -108,7 +141,8 @@ export {
108
141
  TableBody as Body,
109
142
  TableCaption as Caption,
110
143
  TableCell as Cell,
144
+ CustomTable,
111
145
  TableHeader as Header,
112
- Table as Root,
146
+ HtmlTable,
113
147
  TableRow as Row
114
148
  };
@@ -1,41 +1,21 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import * as React from "react";
3
- import * as ReactDOM from "react-dom";
4
2
  import cx from "classnames";
5
3
  import * as AkTab from "@ariakit/react/tab";
6
- import { useControlledState } from "./~hooks.js";
7
4
  import { forwardRef } from "./~utils.js";
8
5
  function Tabs(props) {
9
6
  const {
10
7
  defaultSelectedId,
11
- selectedId: selectedIdProp,
12
- setSelectedId: setSelectedIdProp,
8
+ selectedId,
9
+ setSelectedId,
13
10
  selectOnMove,
14
11
  children
15
12
  } = props;
16
- const [selectedId, setSelectedId] = useControlledState(
17
- defaultSelectedId,
18
- selectedIdProp,
19
- setSelectedIdProp
20
- );
21
13
  return /* @__PURE__ */ jsx(
22
14
  AkTab.TabProvider,
23
15
  {
16
+ defaultSelectedId,
24
17
  selectedId,
25
- setSelectedId: React.useCallback(
26
- (id) => {
27
- if (document.startViewTransition) {
28
- document.startViewTransition(() => {
29
- ReactDOM.flushSync(() => {
30
- setSelectedId(id);
31
- });
32
- });
33
- } else {
34
- setSelectedId(id);
35
- }
36
- },
37
- [setSelectedId]
38
- ),
18
+ setSelectedId,
39
19
  selectOnMove,
40
20
  children
41
21
  }
@@ -44,17 +24,12 @@ function Tabs(props) {
44
24
  DEV: Tabs.displayName = "Tabs.Root";
45
25
  const TabList = forwardRef((props, forwardedRef) => {
46
26
  const { tone = "neutral", ...rest } = props;
47
- const viewTransitionName = `\u{1F95D}active-stripe-${React.useId().replaceAll(":", "_")}`;
48
27
  return /* @__PURE__ */ jsx(
49
28
  AkTab.TabList,
50
29
  {
51
30
  ...rest,
52
31
  "data-kiwi-tone": tone,
53
32
  className: cx("\u{1F95D}-tab-list", props.className),
54
- style: {
55
- "--\u{1F95D}tab-active-stripe-view-transition-name": viewTransitionName,
56
- ...props.style
57
- },
58
33
  ref: forwardedRef
59
34
  }
60
35
  );
@@ -3,40 +3,33 @@ import * as React from "react";
3
3
  import { Role } from "@ariakit/react/role";
4
4
  import { Focusable } from "@ariakit/react/focusable";
5
5
  import cx from "classnames";
6
- import { FieldControl } from "./Field.js";
7
6
  import { Icon } from "./Icon.js";
8
7
  import { useMergedRefs } from "./~hooks.js";
9
8
  import { forwardRef } from "./~utils.js";
9
+ import { useFieldControlType } from "./Field.internal.js";
10
10
  const TextBoxInput = forwardRef(
11
11
  (props, forwardedRef) => {
12
- const { id, ...rest } = props;
12
+ useFieldControlType("textlike");
13
13
  const rootContext = React.useContext(TextBoxRootContext);
14
14
  const setDisabled = rootContext?.setDisabled;
15
15
  React.useEffect(() => {
16
16
  setDisabled?.(props.disabled);
17
17
  }, [setDisabled, props.disabled]);
18
18
  return /* @__PURE__ */ jsx(
19
- FieldControl,
19
+ Role.input,
20
20
  {
21
- type: "textlike",
22
- id,
21
+ readOnly: props.disabled,
22
+ ...props,
23
+ className: cx({ "\u{1F95D}-text-box": !rootContext }, props.className),
24
+ placeholder: props.placeholder ?? " ",
23
25
  render: /* @__PURE__ */ jsx(
24
- Role.input,
26
+ Focusable,
25
27
  {
26
- readOnly: props.disabled,
27
- ...rest,
28
- className: cx({ "\u{1F95D}-text-box": !rootContext }, props.className),
29
- placeholder: props.placeholder ?? " ",
30
- render: /* @__PURE__ */ jsx(
31
- Focusable,
32
- {
33
- accessibleWhenDisabled: true,
34
- render: props.render || /* @__PURE__ */ jsx("input", {})
35
- }
36
- ),
37
- ref: useMergedRefs(rootContext?.inputRef, forwardedRef)
28
+ accessibleWhenDisabled: true,
29
+ render: props.render || /* @__PURE__ */ jsx("input", {})
38
30
  }
39
- )
31
+ ),
32
+ ref: useMergedRefs(rootContext?.inputRef, forwardedRef)
40
33
  }
41
34
  );
42
35
  }
@@ -44,29 +37,22 @@ const TextBoxInput = forwardRef(
44
37
  DEV: TextBoxInput.displayName = "TextBox.Input";
45
38
  const TextBoxTextarea = forwardRef(
46
39
  (props, forwardedRef) => {
47
- const { id, ...rest } = props;
40
+ useFieldControlType("textlike");
48
41
  return /* @__PURE__ */ jsx(
49
- FieldControl,
42
+ Role.textarea,
50
43
  {
51
- type: "textlike",
52
- id,
44
+ readOnly: props.disabled,
45
+ ...props,
46
+ className: cx("\u{1F95D}-text-box", props.className),
47
+ placeholder: props.placeholder ?? " ",
53
48
  render: /* @__PURE__ */ jsx(
54
- Role.textarea,
49
+ Focusable,
55
50
  {
56
- readOnly: props.disabled,
57
- ...rest,
58
- className: cx("\u{1F95D}-text-box", props.className),
59
- placeholder: props.placeholder ?? " ",
60
- render: /* @__PURE__ */ jsx(
61
- Focusable,
62
- {
63
- accessibleWhenDisabled: true,
64
- render: props.render || /* @__PURE__ */ jsx("textarea", {})
65
- }
66
- ),
67
- ref: forwardedRef
51
+ accessibleWhenDisabled: true,
52
+ render: props.render || /* @__PURE__ */ jsx("textarea", {})
68
53
  }
69
- )
54
+ ),
55
+ ref: forwardedRef
70
56
  }
71
57
  );
72
58
  }
@@ -43,6 +43,7 @@ const Tooltip = forwardRef(
43
43
  AkTooltip.Tooltip,
44
44
  {
45
45
  "aria-hidden": "true",
46
+ portal: true,
46
47
  ...rest,
47
48
  unmountOnHide,
48
49
  className: cx("\u{1F95D}-tooltip", props.className),
@@ -53,7 +54,6 @@ const Tooltip = forwardRef(
53
54
  ...props.style
54
55
  },
55
56
  wrapperProps: popover.wrapperProps,
56
- portal: popover.portal,
57
57
  children: content
58
58
  }
59
59
  )
@@ -2,15 +2,17 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import cx from "classnames";
4
4
  import { Role } from "@ariakit/react/role";
5
+ import { PopoverProvider } from "@ariakit/react/popover";
5
6
  import {
6
7
  CompositeItem
7
8
  } from "@ariakit/react/composite";
8
9
  import { Toolbar } from "@ariakit/react/toolbar";
9
10
  import * as ListItem from "./~utils.ListItem.js";
10
11
  import { IconButton } from "./IconButton.js";
11
- import { Icon } from "./Icon.js";
12
+ import * as DropdownMenu from "./DropdownMenu.js";
13
+ import { Icon, StatusWarning, MoreHorizontal } from "./Icon.js";
12
14
  import { forwardRef } from "./~utils.js";
13
- import { useEventHandlers } from "./~hooks.js";
15
+ import { useEventHandlers, useSafeContext } from "./~hooks.js";
14
16
  import { GhostAligner, useGhostAlignment } from "./~utils.GhostAligner.js";
15
17
  const TreeItemContext = React.createContext(void 0);
16
18
  const TreeItemRoot = forwardRef(
@@ -19,11 +21,12 @@ const TreeItemRoot = forwardRef(
19
21
  "aria-level": level,
20
22
  selected,
21
23
  expanded,
22
- icon,
24
+ icon: iconProp,
23
25
  unstable_decorations,
24
26
  label,
25
27
  description,
26
28
  actions,
29
+ error,
27
30
  onSelectedChange,
28
31
  onExpandedChange,
29
32
  onClick: onClickProp,
@@ -48,6 +51,7 @@ const TreeItemRoot = forwardRef(
48
51
  const labelId = React.useId();
49
52
  const descriptionId = React.useId();
50
53
  const decorationId = React.useId();
54
+ const icon = error ? /* @__PURE__ */ jsx(StatusWarning, {}) : iconProp;
51
55
  const describedBy = React.useMemo(() => {
52
56
  const idRefs = [];
53
57
  if (description) idRefs.push(descriptionId);
@@ -61,9 +65,10 @@ const TreeItemRoot = forwardRef(
61
65
  () => ({
62
66
  level,
63
67
  expanded,
64
- selected
68
+ selected,
69
+ error
65
70
  }),
66
- [level, expanded, selected]
71
+ [level, expanded, selected, error]
67
72
  ),
68
73
  children: /* @__PURE__ */ jsx(
69
74
  CompositeItem,
@@ -90,6 +95,7 @@ const TreeItemRoot = forwardRef(
90
95
  {
91
96
  "data-kiwi-expanded": expanded,
92
97
  "data-kiwi-selected": selected,
98
+ "data-kiwi-error": error ? true : void 0,
93
99
  className: "\u{1F95D}-tree-item-node",
94
100
  style: { "--\u{1F95D}tree-item-level": level },
95
101
  role: void 0,
@@ -140,25 +146,101 @@ const TreeItemRoot = forwardRef(
140
146
  );
141
147
  DEV: TreeItemRoot.displayName = "TreeItem.Root";
142
148
  const TreeItemActions = forwardRef((props, forwardedRef) => {
143
- return /* @__PURE__ */ jsx(
149
+ const { children, ...rest } = props;
150
+ const actions = React.Children.toArray(children).filter(Boolean);
151
+ const { error } = useSafeContext(TreeItemContext);
152
+ const limit = error ? 2 : 3;
153
+ return /* @__PURE__ */ jsxs(
144
154
  Toolbar,
145
155
  {
146
- ...props,
156
+ ...rest,
147
157
  onClick: useEventHandlers(props.onClick, (e) => e.stopPropagation()),
148
158
  onKeyDown: useEventHandlers(props.onKeyDown, (e) => e.stopPropagation()),
149
- className: cx("\u{1F95D}-tree-item-actions", props.className),
159
+ className: cx("\u{1F95D}-tree-item-actions-container", props.className),
160
+ focusLoop: false,
150
161
  ref: forwardedRef,
151
- children: props.children
162
+ children: [
163
+ actions.slice(0, limit - 1),
164
+ actions.length === limit ? actions[limit - 1] : null,
165
+ actions.length > limit ? /* @__PURE__ */ jsx(TreeItemActionsOverflowMenu, { children: actions.slice(limit - 1) }) : null
166
+ ]
152
167
  }
153
168
  );
154
169
  });
155
170
  DEV: TreeItemActions.displayName = "TreeItemActions";
171
+ const arrowKeys = ["ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"];
172
+ const TreeItemActionsOverflowMenuContext = React.createContext(false);
173
+ function TreeItemActionsOverflowMenu({ children }) {
174
+ const [open, setOpen] = React.useState(false);
175
+ const isArrowKeyPressed = React.useRef(false);
176
+ return /* @__PURE__ */ jsx(PopoverProvider, { placement: "right-start", children: /* @__PURE__ */ jsxs(
177
+ DropdownMenu.Root,
178
+ {
179
+ open,
180
+ setOpen: React.useCallback((value) => {
181
+ if (value && !isArrowKeyPressed.current) {
182
+ setOpen(true);
183
+ } else {
184
+ setOpen(false);
185
+ }
186
+ }, []),
187
+ children: [
188
+ /* @__PURE__ */ jsx(
189
+ DropdownMenu.Button,
190
+ {
191
+ onKeyDown: (e) => {
192
+ if (arrowKeys.includes(e.key)) {
193
+ isArrowKeyPressed.current = true;
194
+ }
195
+ queueMicrotask(() => {
196
+ isArrowKeyPressed.current = false;
197
+ });
198
+ },
199
+ render: /* @__PURE__ */ jsx(TreeItemAction, { label: "More", icon: /* @__PURE__ */ jsx(MoreHorizontal, {}) })
200
+ }
201
+ ),
202
+ /* @__PURE__ */ jsx(TreeItemActionsOverflowMenuContext.Provider, { value: true, children: /* @__PURE__ */ jsx(DropdownMenu.Content, { children }) })
203
+ ]
204
+ }
205
+ ) });
206
+ }
207
+ DEV: TreeItemActionsOverflowMenu.displayName = "TreeItemActionsOverflowMenu";
156
208
  const TreeItemAction = forwardRef(
157
209
  (props, forwardedRef) => {
158
- const { visible, ...rest } = props;
210
+ const { error } = useSafeContext(TreeItemContext);
211
+ const {
212
+ visible = error ? true : void 0,
213
+ // visible by default during error state
214
+ label,
215
+ icon,
216
+ ...rest
217
+ } = props;
218
+ if (React.useContext(TreeItemActionsOverflowMenuContext)) {
219
+ DEV: {
220
+ if (visible !== void 0)
221
+ console.warn("overflowing actions should not use `visible` prop");
222
+ }
223
+ return /* @__PURE__ */ jsx(
224
+ DropdownMenu.Item,
225
+ {
226
+ ...rest,
227
+ label,
228
+ icon,
229
+ ref: forwardedRef
230
+ }
231
+ );
232
+ }
233
+ DEV: {
234
+ if (!icon)
235
+ throw new Error(
236
+ "`icon` prop is required when the action is displayed as a button"
237
+ );
238
+ }
159
239
  return /* @__PURE__ */ jsx(
160
240
  IconButton,
161
241
  {
242
+ label,
243
+ icon,
162
244
  inert: visible === false ? true : void 0,
163
245
  ...rest,
164
246
  variant: "ghost",
@@ -11,7 +11,7 @@ import * as DropdownMenu from "./DropdownMenu.js";
11
11
  import { Divider } from "./Divider.js";
12
12
  import { Icon } from "./Icon.js";
13
13
  import { IconButton } from "./IconButton.js";
14
- import { Field } from "./Field.js";
14
+ import * as Field from "./Field.js";
15
15
  import { Kbd } from "./Kbd.js";
16
16
  import { Label } from "./Label.js";
17
17
  import { ProgressBar } from "./ProgressBar.js";
@@ -20,6 +20,7 @@ import * as Select from "./Select.js";
20
20
  import { Spinner } from "./Spinner.js";
21
21
  import { Skeleton } from "./Skeleton.js";
22
22
  import { Switch } from "./Switch.js";
23
+ import * as Table from "./Table.js";
23
24
  import * as Tabs from "./Tabs.js";
24
25
  import { Text } from "./Text.js";
25
26
  import * as TextBox from "./TextBox.js";
@@ -48,6 +49,7 @@ export {
48
49
  Skeleton,
49
50
  Spinner,
50
51
  Switch,
52
+ Table,
51
53
  Tabs,
52
54
  Text,
53
55
  TextBox,