@itwin/itwinui-react 5.0.0-alpha.11 → 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 (53) hide show
  1. package/CHANGELOG.md +18 -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 +57 -19
  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 +32 -0
  9. package/dist/DEV/bricks/Label.js +4 -10
  10. package/dist/DEV/bricks/Radio.js +7 -14
  11. package/dist/DEV/bricks/Select.js +9 -15
  12. package/dist/DEV/bricks/Switch.js +8 -15
  13. package/dist/DEV/bricks/Table.js +71 -37
  14. package/dist/DEV/bricks/Tabs.js +4 -29
  15. package/dist/DEV/bricks/TextBox.js +23 -37
  16. package/dist/DEV/bricks/TreeItem.js +87 -8
  17. package/dist/DEV/bricks/index.js +3 -1
  18. package/dist/DEV/bricks/styles.css.js +1 -1
  19. package/dist/DEV/foundations/styles.css.js +1 -1
  20. package/dist/bricks/Checkbox.d.ts +13 -5
  21. package/dist/bricks/Checkbox.js +7 -14
  22. package/dist/bricks/Description.d.ts +2 -6
  23. package/dist/bricks/Description.js +7 -14
  24. package/dist/bricks/DropdownMenu.d.ts +9 -9
  25. package/dist/bricks/DropdownMenu.js +56 -18
  26. package/dist/bricks/Field.d.ts +63 -27
  27. package/dist/bricks/Field.internal.d.ts +33 -0
  28. package/dist/bricks/Field.internal.js +47 -0
  29. package/dist/bricks/Field.js +111 -84
  30. package/dist/bricks/Icon.d.ts +3 -0
  31. package/dist/bricks/Icon.js +31 -0
  32. package/dist/bricks/Label.d.ts +5 -12
  33. package/dist/bricks/Label.js +4 -10
  34. package/dist/bricks/Radio.d.ts +14 -5
  35. package/dist/bricks/Radio.js +7 -14
  36. package/dist/bricks/Select.d.ts +29 -12
  37. package/dist/bricks/Select.js +9 -15
  38. package/dist/bricks/Switch.d.ts +12 -5
  39. package/dist/bricks/Switch.js +8 -15
  40. package/dist/bricks/Table.d.ts +94 -37
  41. package/dist/bricks/Table.js +69 -36
  42. package/dist/bricks/Tabs.d.ts +3 -4
  43. package/dist/bricks/Tabs.js +4 -29
  44. package/dist/bricks/TextBox.d.ts +42 -19
  45. package/dist/bricks/TextBox.js +23 -37
  46. package/dist/bricks/TreeItem.d.ts +46 -8
  47. package/dist/bricks/TreeItem.js +76 -8
  48. package/dist/bricks/index.d.ts +2 -1
  49. package/dist/bricks/index.js +3 -1
  50. package/dist/bricks/styles.css.js +1 -1
  51. package/dist/bricks/~hooks.d.ts +1 -1
  52. package/dist/foundations/styles.css.js +1 -1
  53. package/package.json +1 -1
@@ -7,11 +7,12 @@ import {
7
7
  isBrowser
8
8
  } from "./~utils.js";
9
9
  import { DisclosureArrow } from "./Icon.js";
10
- import { FieldControl } from "./Field.js";
10
+ import { useFieldControlType } from "./Field.internal.js";
11
11
  const supportsHas = isBrowser && CSS?.supports?.("selector(:has(+ *))");
12
12
  const HtmlSelectContext = React.createContext(() => {
13
13
  });
14
14
  const SelectRoot = forwardRef((props, forwardedRef) => {
15
+ useFieldControlType("textlike");
15
16
  const [isHtmlSelect, setIsHtmlSelect] = React.useState(false);
16
17
  return /* @__PURE__ */ jsx(HtmlSelectContext.Provider, { value: setIsHtmlSelect, children: /* @__PURE__ */ jsx(
17
18
  Role.div,
@@ -25,7 +26,7 @@ const SelectRoot = forwardRef((props, forwardedRef) => {
25
26
  });
26
27
  const HtmlSelect = forwardRef(
27
28
  (props, forwardedRef) => {
28
- const { id, variant = "solid", ...rest } = props;
29
+ const { variant = "solid", ...rest } = props;
29
30
  const setIsHtmlSelect = React.useContext(HtmlSelectContext);
30
31
  React.useEffect(
31
32
  function updateContext() {
@@ -35,20 +36,13 @@ const HtmlSelect = forwardRef(
35
36
  );
36
37
  return /* @__PURE__ */ jsxs(Fragment, { children: [
37
38
  /* @__PURE__ */ jsx(
38
- FieldControl,
39
+ Role.select,
39
40
  {
40
- type: "textlike",
41
- id,
42
- render: /* @__PURE__ */ jsx(
43
- Role.select,
44
- {
45
- ...rest,
46
- className: cx("\u{1F95D}-button", "\u{1F95D}-select", props.className),
47
- "data-kiwi-tone": "neutral",
48
- "data-kiwi-variant": variant,
49
- ref: forwardedRef
50
- }
51
- )
41
+ ...rest,
42
+ className: cx("\u{1F95D}-button", "\u{1F95D}-select", props.className),
43
+ "data-kiwi-tone": "neutral",
44
+ "data-kiwi-variant": variant,
45
+ ref: forwardedRef
52
46
  }
53
47
  ),
54
48
  /* @__PURE__ */ jsx(DisclosureArrow, { className: "\u{1F95D}-select-arrow" })
@@ -3,26 +3,19 @@ import cx from "classnames";
3
3
  import {
4
4
  Checkbox as AkCheckbox
5
5
  } from "@ariakit/react/checkbox";
6
- import { FieldControl } from "./Field.js";
7
6
  import { forwardRef } from "./~utils.js";
7
+ import { useFieldControlType } from "./Field.internal.js";
8
8
  const Switch = forwardRef(
9
9
  (props, forwardedRef) => {
10
- const { id, ...rest } = props;
10
+ useFieldControlType("checkable");
11
11
  return /* @__PURE__ */ jsx(
12
- FieldControl,
12
+ AkCheckbox,
13
13
  {
14
- type: "checkable",
15
- id,
16
- render: /* @__PURE__ */ jsx(
17
- AkCheckbox,
18
- {
19
- accessibleWhenDisabled: true,
20
- ...rest,
21
- className: cx("\u{1F95D}-switch", props.className),
22
- role: "switch",
23
- ref: forwardedRef
24
- }
25
- )
14
+ accessibleWhenDisabled: true,
15
+ ...props,
16
+ className: cx("\u{1F95D}-switch", props.className),
17
+ role: "switch",
18
+ ref: forwardedRef
26
19
  }
27
20
  );
28
21
  }
@@ -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
  }
@@ -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, StatusWarning } 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(
@@ -63,9 +65,10 @@ const TreeItemRoot = forwardRef(
63
65
  () => ({
64
66
  level,
65
67
  expanded,
66
- selected
68
+ selected,
69
+ error
67
70
  }),
68
- [level, expanded, selected]
71
+ [level, expanded, selected, error]
69
72
  ),
70
73
  children: /* @__PURE__ */ jsx(
71
74
  CompositeItem,
@@ -143,25 +146,101 @@ const TreeItemRoot = forwardRef(
143
146
  );
144
147
  DEV: TreeItemRoot.displayName = "TreeItem.Root";
145
148
  const TreeItemActions = forwardRef((props, forwardedRef) => {
146
- 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(
147
154
  Toolbar,
148
155
  {
149
- ...props,
156
+ ...rest,
150
157
  onClick: useEventHandlers(props.onClick, (e) => e.stopPropagation()),
151
158
  onKeyDown: useEventHandlers(props.onKeyDown, (e) => e.stopPropagation()),
152
159
  className: cx("\u{1F95D}-tree-item-actions-container", props.className),
160
+ focusLoop: false,
153
161
  ref: forwardedRef,
154
- 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
+ ]
155
167
  }
156
168
  );
157
169
  });
158
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";
159
208
  const TreeItemAction = forwardRef(
160
209
  (props, forwardedRef) => {
161
- 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
+ }
162
239
  return /* @__PURE__ */ jsx(
163
240
  IconButton,
164
241
  {
242
+ label,
243
+ icon,
165
244
  inert: visible === false ? true : void 0,
166
245
  ...rest,
167
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,