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

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 (110) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +6 -6
  3. package/dist/DEV/bricks/Anchor.js +5 -10
  4. package/dist/DEV/bricks/Avatar.js +24 -0
  5. package/dist/DEV/bricks/Badge.js +22 -0
  6. package/dist/DEV/bricks/Button.js +11 -4
  7. package/dist/DEV/bricks/Checkbox.js +17 -9
  8. package/dist/DEV/bricks/Chip.js +42 -0
  9. package/dist/DEV/bricks/Description.js +29 -0
  10. package/dist/DEV/bricks/Divider.js +3 -2
  11. package/dist/DEV/bricks/DropdownMenu.js +109 -30
  12. package/dist/DEV/bricks/Field.js +115 -14
  13. package/dist/DEV/bricks/Icon.js +70 -8
  14. package/dist/DEV/bricks/IconButton.js +14 -3
  15. package/dist/DEV/bricks/Kbd.internal.js +19 -0
  16. package/dist/DEV/bricks/Kbd.js +23 -6
  17. package/dist/DEV/bricks/Label.js +11 -8
  18. package/dist/DEV/bricks/ProgressBar.js +25 -0
  19. package/dist/DEV/bricks/Radio.js +17 -9
  20. package/dist/DEV/bricks/Root.js +35 -4
  21. package/dist/DEV/bricks/Select.js +17 -11
  22. package/dist/DEV/bricks/Skeleton.js +24 -0
  23. package/dist/DEV/bricks/Spinner.js +40 -0
  24. package/dist/DEV/bricks/Switch.js +18 -10
  25. package/dist/DEV/bricks/Table.js +114 -0
  26. package/dist/DEV/bricks/Tabs.js +6 -6
  27. package/dist/DEV/bricks/Text.js +2 -2
  28. package/dist/DEV/bricks/TextBox.js +54 -16
  29. package/dist/DEV/bricks/Tooltip.js +17 -25
  30. package/dist/DEV/bricks/Tree.js +15 -107
  31. package/dist/DEV/bricks/TreeItem.js +224 -0
  32. package/dist/DEV/bricks/VisuallyHidden.js +2 -2
  33. package/dist/DEV/bricks/index.js +16 -0
  34. package/dist/DEV/bricks/styles.css.js +2 -2
  35. package/dist/DEV/bricks/~hooks.js +55 -3
  36. package/dist/DEV/bricks/~utils.GhostAligner.js +13 -0
  37. package/dist/DEV/bricks/{ListItem.js → ~utils.ListItem.js} +19 -3
  38. package/dist/DEV/foundations/styles.css.js +2 -2
  39. package/dist/bricks/Anchor.js +5 -10
  40. package/dist/bricks/Avatar.d.ts +47 -0
  41. package/dist/bricks/Avatar.js +23 -0
  42. package/dist/bricks/Badge.d.ts +28 -0
  43. package/dist/bricks/Badge.js +21 -0
  44. package/dist/bricks/Button.js +11 -4
  45. package/dist/bricks/Checkbox.d.ts +2 -2
  46. package/dist/bricks/Checkbox.js +17 -9
  47. package/dist/bricks/Chip.d.ts +31 -0
  48. package/dist/bricks/Chip.js +41 -0
  49. package/dist/bricks/Description.d.ts +19 -0
  50. package/dist/bricks/Description.js +29 -0
  51. package/dist/bricks/Divider.d.ts +2 -2
  52. package/dist/bricks/Divider.js +3 -2
  53. package/dist/bricks/DropdownMenu.d.ts +41 -14
  54. package/dist/bricks/DropdownMenu.js +106 -30
  55. package/dist/bricks/Field.d.ts +23 -1
  56. package/dist/bricks/Field.js +115 -14
  57. package/dist/bricks/Icon.d.ts +34 -3
  58. package/dist/bricks/Icon.js +68 -8
  59. package/dist/bricks/IconButton.d.ts +20 -4
  60. package/dist/bricks/IconButton.js +14 -3
  61. package/dist/bricks/Kbd.d.ts +15 -0
  62. package/dist/bricks/Kbd.internal.d.ts +17 -0
  63. package/dist/bricks/Kbd.internal.js +19 -0
  64. package/dist/bricks/Kbd.js +16 -6
  65. package/dist/bricks/Label.js +11 -8
  66. package/dist/bricks/ProgressBar.d.ts +31 -0
  67. package/dist/bricks/ProgressBar.js +24 -0
  68. package/dist/bricks/Radio.d.ts +2 -2
  69. package/dist/bricks/Radio.js +17 -9
  70. package/dist/bricks/Root.js +35 -4
  71. package/dist/bricks/Select.d.ts +9 -3
  72. package/dist/bricks/Select.js +17 -11
  73. package/dist/bricks/Skeleton.d.ts +25 -0
  74. package/dist/bricks/Skeleton.js +23 -0
  75. package/dist/bricks/Spinner.d.ts +31 -0
  76. package/dist/bricks/Spinner.js +39 -0
  77. package/dist/bricks/Switch.d.ts +2 -2
  78. package/dist/bricks/Switch.js +18 -10
  79. package/dist/bricks/Table.d.ts +115 -0
  80. package/dist/bricks/Table.js +108 -0
  81. package/dist/bricks/Tabs.d.ts +4 -4
  82. package/dist/bricks/Tabs.js +6 -6
  83. package/dist/bricks/Text.d.ts +1 -1
  84. package/dist/bricks/Text.js +2 -2
  85. package/dist/bricks/TextBox.d.ts +23 -2
  86. package/dist/bricks/TextBox.js +53 -16
  87. package/dist/bricks/Tooltip.d.ts +2 -2
  88. package/dist/bricks/Tooltip.js +17 -25
  89. package/dist/bricks/Tree.d.ts +19 -20
  90. package/dist/bricks/Tree.js +14 -102
  91. package/dist/bricks/TreeItem.d.ts +123 -0
  92. package/dist/bricks/TreeItem.js +219 -0
  93. package/dist/bricks/VisuallyHidden.js +2 -2
  94. package/dist/bricks/index.d.ts +8 -0
  95. package/dist/bricks/index.js +16 -0
  96. package/dist/bricks/styles.css.js +2 -2
  97. package/dist/bricks/~hooks.d.ts +55 -0
  98. package/dist/bricks/~hooks.js +55 -3
  99. package/dist/bricks/~utils.GhostAligner.d.ts +22 -0
  100. package/dist/bricks/~utils.GhostAligner.js +13 -0
  101. package/dist/bricks/~utils.ListItem.d.ts +14 -0
  102. package/dist/bricks/{ListItem.js → ~utils.ListItem.js} +18 -3
  103. package/dist/bricks/~utils.d.ts +6 -3
  104. package/dist/foundations/styles.css.js +2 -2
  105. package/package.json +14 -13
  106. package/CHANGELOG.md +0 -14
  107. package/dist/DEV/bricks/Textarea.js +0 -30
  108. package/dist/bricks/ListItem.d.ts +0 -10
  109. package/dist/bricks/Textarea.d.ts +0 -24
  110. package/dist/bricks/Textarea.js +0 -29
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import * as ReactDOM from "react-dom";
4
4
  import cx from "classnames";
5
- import * as Ariakit from "@ariakit/react";
5
+ import * as AkTab from "@ariakit/react/tab";
6
6
  import { useControlledState } from "./~hooks.js";
7
7
  import { forwardRef } from "./~utils.js";
8
8
  function Tabs(props) {
@@ -19,7 +19,7 @@ function Tabs(props) {
19
19
  setSelectedIdProp
20
20
  );
21
21
  return /* @__PURE__ */ jsx(
22
- Ariakit.TabProvider,
22
+ AkTab.TabProvider,
23
23
  {
24
24
  selectedId,
25
25
  setSelectedId: React.useCallback(
@@ -46,10 +46,10 @@ const TabList = forwardRef((props, forwardedRef) => {
46
46
  const { tone = "neutral", ...rest } = props;
47
47
  const viewTransitionName = `\u{1F95D}active-stripe-${React.useId().replaceAll(":", "_")}`;
48
48
  return /* @__PURE__ */ jsx(
49
- Ariakit.TabList,
49
+ AkTab.TabList,
50
50
  {
51
- "data-kiwi-tone": tone,
52
51
  ...rest,
52
+ "data-kiwi-tone": tone,
53
53
  className: cx("\u{1F95D}-tab-list", props.className),
54
54
  style: {
55
55
  "--\u{1F95D}tab-active-stripe-view-transition-name": viewTransitionName,
@@ -62,7 +62,7 @@ const TabList = forwardRef((props, forwardedRef) => {
62
62
  DEV: TabList.displayName = "Tabs.TabList";
63
63
  const Tab = forwardRef((props, forwardedRef) => {
64
64
  return /* @__PURE__ */ jsx(
65
- Ariakit.Tab,
65
+ AkTab.Tab,
66
66
  {
67
67
  accessibleWhenDisabled: true,
68
68
  ...props,
@@ -74,7 +74,7 @@ const Tab = forwardRef((props, forwardedRef) => {
74
74
  DEV: Tab.displayName = "Tabs.Tab";
75
75
  const TabPanel = forwardRef((props, forwardedRef) => {
76
76
  return /* @__PURE__ */ jsx(
77
- Ariakit.TabPanel,
77
+ AkTab.TabPanel,
78
78
  {
79
79
  ...props,
80
80
  className: cx("\u{1F95D}-tab-panel", props.className),
@@ -1,11 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import * as Ariakit from "@ariakit/react";
2
+ import { Role } from "@ariakit/react/role";
3
3
  import cx from "classnames";
4
4
  import { forwardRef } from "./~utils.js";
5
5
  const Text = forwardRef((props, forwardedRef) => {
6
6
  const { variant, ...rest } = props;
7
7
  return /* @__PURE__ */ jsx(
8
- Ariakit.Role,
8
+ Role,
9
9
  {
10
10
  ...rest,
11
11
  className: cx("\u{1F95D}-text", props.className),
@@ -1,39 +1,77 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import * as Ariakit from "@ariakit/react";
3
+ import { Role } from "@ariakit/react/role";
4
+ import { Focusable } from "@ariakit/react/focusable";
4
5
  import cx from "classnames";
5
- import { useFieldId } from "./Field.js";
6
+ import { FieldControl } from "./Field.js";
6
7
  import { Icon } from "./Icon.js";
7
- import { Textarea } from "./Textarea.js";
8
8
  import { useMergedRefs } from "./~hooks.js";
9
9
  import { forwardRef } from "./~utils.js";
10
10
  const TextBoxInput = forwardRef(
11
11
  (props, forwardedRef) => {
12
- const fieldId = useFieldId();
12
+ const { id, ...rest } = props;
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
- Ariakit.Role.input,
19
+ FieldControl,
20
20
  {
21
- id: fieldId,
22
- ...props,
23
- className: cx({ "\u{1F95D}-text-box": !rootContext }, props.className),
21
+ type: "textlike",
22
+ id,
24
23
  render: /* @__PURE__ */ jsx(
25
- Ariakit.Focusable,
24
+ Role.input,
26
25
  {
27
- accessibleWhenDisabled: true,
28
- render: props.render || /* @__PURE__ */ jsx("input", {})
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)
29
38
  }
30
- ),
31
- ref: useMergedRefs(rootContext?.inputRef, forwardedRef)
39
+ )
32
40
  }
33
41
  );
34
42
  }
35
43
  );
36
44
  DEV: TextBoxInput.displayName = "TextBox.Input";
45
+ const TextBoxTextarea = forwardRef(
46
+ (props, forwardedRef) => {
47
+ const { id, ...rest } = props;
48
+ return /* @__PURE__ */ jsx(
49
+ FieldControl,
50
+ {
51
+ type: "textlike",
52
+ id,
53
+ render: /* @__PURE__ */ jsx(
54
+ Role.textarea,
55
+ {
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
68
+ }
69
+ )
70
+ }
71
+ );
72
+ }
73
+ );
74
+ DEV: TextBoxTextarea.displayName = "TextBox.Textarea";
37
75
  const TextBoxRoot = forwardRef(
38
76
  (props, forwardedRef) => {
39
77
  const inputRef = React.useRef(null);
@@ -43,7 +81,7 @@ const TextBoxRoot = forwardRef(
43
81
  {
44
82
  value: React.useMemo(() => ({ setDisabled, inputRef }), []),
45
83
  children: /* @__PURE__ */ jsx(
46
- Ariakit.Role.div,
84
+ Role.div,
47
85
  {
48
86
  ...props,
49
87
  "data-kiwi-disabled": disabled,
@@ -80,7 +118,7 @@ DEV: TextBoxIcon.displayName = "TextBox.Icon";
80
118
  const TextBoxText = forwardRef(
81
119
  (props, forwardedRef) => {
82
120
  return /* @__PURE__ */ jsx(
83
- Ariakit.Role.span,
121
+ Role.span,
84
122
  {
85
123
  ...props,
86
124
  className: cx("\u{1F95D}-text-box-decoration", props.className),
@@ -96,5 +134,5 @@ export {
96
134
  TextBoxInput as Input,
97
135
  TextBoxRoot as Root,
98
136
  TextBoxText as Text,
99
- Textarea
137
+ TextBoxTextarea as Textarea
100
138
  };
@@ -1,38 +1,29 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import cx from "classnames";
4
- import * as Ariakit from "@ariakit/react";
5
- import { forwardRef, supportsPopover } from "./~utils.js";
4
+ import * as AkTooltip from "@ariakit/react/tooltip";
5
+ import { useStoreState } from "@ariakit/react/store";
6
+ import { forwardRef } from "./~utils.js";
7
+ import { usePopoverApi } from "./~hooks.js";
6
8
  const Tooltip = forwardRef(
7
9
  (props, forwardedRef) => {
10
+ const generatedId = React.useId();
8
11
  const {
9
12
  content,
10
13
  children,
11
- className,
12
14
  type = "description",
13
- id = React.useId(),
15
+ id = generatedId,
14
16
  defaultOpen: defaultOpenProp,
15
17
  open: openProp,
16
18
  setOpen: setOpenProp,
17
19
  unmountOnHide = type === "none",
18
20
  ...rest
19
21
  } = props;
20
- const store = Ariakit.useTooltipStore();
21
- const open = Ariakit.useStoreState(store, (state) => state.open);
22
- const popover = Ariakit.useStoreState(
23
- store,
24
- (state) => state.popoverElement
25
- );
26
- React.useEffect(
27
- function syncPopoverWithOpenState() {
28
- if (popover?.isConnected) {
29
- popover?.togglePopover?.(open);
30
- }
31
- },
32
- [open, popover]
33
- );
22
+ const store = AkTooltip.useTooltipStore();
23
+ const open = useStoreState(store, (store2) => store2.open);
24
+ const popover = usePopoverApi(store);
34
25
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
35
- Ariakit.TooltipProvider,
26
+ AkTooltip.TooltipProvider,
36
27
  {
37
28
  store,
38
29
  defaultOpen: defaultOpenProp,
@@ -40,28 +31,29 @@ const Tooltip = forwardRef(
40
31
  setOpen: setOpenProp,
41
32
  children: [
42
33
  /* @__PURE__ */ jsx(
43
- Ariakit.TooltipAnchor,
34
+ AkTooltip.TooltipAnchor,
44
35
  {
45
36
  render: children,
37
+ "data-has-popover-open": open || void 0,
46
38
  ...type === "description" && { "aria-describedby": id },
47
39
  ...type === "label" && { "aria-labelledby": id }
48
40
  }
49
41
  ),
50
42
  /* @__PURE__ */ jsx(
51
- Ariakit.Tooltip,
43
+ AkTooltip.Tooltip,
52
44
  {
53
45
  "aria-hidden": "true",
54
46
  ...rest,
55
47
  unmountOnHide,
56
- className: cx("\u{1F95D}-tooltip", className),
48
+ className: cx("\u{1F95D}-tooltip", props.className),
57
49
  ref: forwardedRef,
58
50
  id,
59
51
  style: {
60
- zIndex: supportsPopover ? void 0 : 9999,
52
+ ...popover.style,
61
53
  ...props.style
62
54
  },
63
- wrapperProps: { popover: "manual" },
64
- portal: !supportsPopover,
55
+ wrapperProps: popover.wrapperProps,
56
+ portal: popover.portal,
65
57
  children: content
66
58
  }
67
59
  )
@@ -1,118 +1,26 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import * as React from "react";
1
+ import { jsx } from "react/jsx-runtime";
3
2
  import cx from "classnames";
4
- import * as Ariakit from "@ariakit/react";
5
- import * as ListItem from "./ListItem.js";
6
- import { IconButton } from "./IconButton.js";
7
- import { Icon } from "./Icon.js";
3
+ import { Role } from "@ariakit/react/role";
4
+ import { useCompositeStore, Composite } from "@ariakit/react/composite";
8
5
  import { forwardRef } from "./~utils.js";
6
+ import { Root as TreeItemRoot, Action as TreeItemAction } from "./TreeItem.js";
9
7
  const Tree = forwardRef((props, forwardedRef) => {
10
- return /* @__PURE__ */ jsx(Ariakit.Role.div, { ...props, role: "list", ref: forwardedRef, children: props.children });
11
- });
12
- DEV: Tree.displayName = "Tree.Root";
13
- const TreeItem = forwardRef((props, forwardedRef) => {
14
- const { selected, content, children, className, expanded, style, ...rest } = props;
15
- const parentContext = React.useContext(TreeItemContext);
16
- const level = parentContext ? parentContext.level + 1 : 1;
17
- const firstSelected = !!selected && !parentContext?.selected;
8
+ const composite = useCompositeStore({ orientation: "vertical" });
18
9
  return /* @__PURE__ */ jsx(
19
- TreeItemContext.Provider,
10
+ Role.div,
20
11
  {
21
- value: React.useMemo(
22
- () => ({
23
- level,
24
- expanded,
25
- selected
26
- }),
27
- [level, expanded, selected]
28
- ),
29
- children: /* @__PURE__ */ jsxs("div", { role: "listitem", "aria-current": firstSelected ? true : void 0, children: [
30
- /* @__PURE__ */ jsx(
31
- ListItem.Root,
32
- {
33
- ...rest,
34
- "data-kiwi-expanded": expanded,
35
- "data-kiwi-selected": selected,
36
- "data-kiwi-parent-selected": parentContext?.selected,
37
- className: cx("\u{1F95D}-tree-item", className),
38
- style: {
39
- ...style,
40
- "--\u{1F95D}tree-item-level": level
41
- },
42
- ref: forwardedRef,
43
- role: void 0,
44
- children: content
45
- }
46
- ),
47
- children && /* @__PURE__ */ jsx("div", { role: "list", children })
48
- ] })
12
+ role: "tree",
13
+ ...props,
14
+ render: /* @__PURE__ */ jsx(Composite, { store: composite }),
15
+ className: cx("\u{1F95D}-tree", props.className),
16
+ ref: forwardedRef,
17
+ children: props.children
49
18
  }
50
19
  );
51
20
  });
52
- DEV: TreeItem.displayName = "Tree.Item";
53
- const TreeItemContent = forwardRef(
54
- (props, forwardedRef) => {
55
- const { children, ...rest } = props;
56
- return /* @__PURE__ */ jsx(
57
- ListItem.Content,
58
- {
59
- ...rest,
60
- className: cx("\u{1F95D}-tree-item-content", props.className),
61
- ref: forwardedRef,
62
- children: /* @__PURE__ */ jsx("button", { type: "button", children })
63
- }
64
- );
65
- }
66
- );
67
- DEV: TreeItemContent.displayName = "Tree.Content";
68
- const TreeItemExpander = forwardRef(
69
- (props, forwardedRef) => {
70
- const context = React.useContext(TreeItemContext);
71
- const expanded = context?.expanded;
72
- return /* @__PURE__ */ jsx(
73
- IconButton,
74
- {
75
- icon: /* @__PURE__ */ jsx(TreeChevron, {}),
76
- label: "Toggle",
77
- "aria-expanded": expanded === void 0 ? void 0 : expanded,
78
- ...props,
79
- className: cx("\u{1F95D}-tree-item-expander", props.className),
80
- variant: "ghost",
81
- labelVariant: "visually-hidden",
82
- ref: forwardedRef
83
- }
84
- );
85
- }
86
- );
87
- DEV: TreeItemExpander.displayName = "Tree.Expander";
88
- const TreeChevron = forwardRef(
89
- (props, forwardedRef) => {
90
- return /* @__PURE__ */ jsx(
91
- Icon,
92
- {
93
- ...props,
94
- render: /* @__PURE__ */ jsx(
95
- Ariakit.Role.svg,
96
- {
97
- width: "16",
98
- height: "16",
99
- fill: "currentColor",
100
- viewBox: "0 0 16 16",
101
- render: props.render,
102
- 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" })
103
- }
104
- ),
105
- className: cx("\u{1F95D}-tree-chevron", props.className),
106
- ref: forwardedRef
107
- }
108
- );
109
- }
110
- );
111
- DEV: TreeChevron.displayName = "TreeChevron";
112
- const TreeItemContext = React.createContext(void 0);
21
+ DEV: Tree.displayName = "Tree.Root";
113
22
  export {
114
- TreeItemContent as Content,
115
- TreeItemExpander as Expander,
116
- TreeItem as Item,
23
+ TreeItemRoot as Item,
24
+ TreeItemAction as ItemAction,
117
25
  Tree as Root
118
26
  };
@@ -0,0 +1,224 @@
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";
5
+ import {
6
+ CompositeItem
7
+ } from "@ariakit/react/composite";
8
+ import { Toolbar } from "@ariakit/react/toolbar";
9
+ import * as ListItem from "./~utils.ListItem.js";
10
+ import { IconButton } from "./IconButton.js";
11
+ import { Icon } from "./Icon.js";
12
+ import { forwardRef } from "./~utils.js";
13
+ import { useEventHandlers } from "./~hooks.js";
14
+ import { GhostAligner, useGhostAlignment } from "./~utils.GhostAligner.js";
15
+ const TreeItemContext = React.createContext(void 0);
16
+ const TreeItemRoot = forwardRef(
17
+ (props, forwardedRef) => {
18
+ const {
19
+ "aria-level": level,
20
+ selected,
21
+ expanded,
22
+ icon,
23
+ unstable_decorations,
24
+ label,
25
+ description,
26
+ actions,
27
+ onSelectedChange,
28
+ onExpandedChange,
29
+ onClick: onClickProp,
30
+ onKeyDown: onKeyDownProp,
31
+ ...rest
32
+ } = props;
33
+ const handleClick = (event) => {
34
+ if (selected === void 0) return;
35
+ event.stopPropagation();
36
+ onSelectedChange?.(!selected);
37
+ };
38
+ const handleKeyDown = (event) => {
39
+ if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
40
+ return;
41
+ }
42
+ if (expanded === void 0) return;
43
+ if (event.key === "ArrowRight" || event.key === "ArrowLeft") {
44
+ event.preventDefault();
45
+ onExpandedChange?.(event.key === "ArrowRight");
46
+ }
47
+ };
48
+ const labelId = React.useId();
49
+ const descriptionId = React.useId();
50
+ const decorationId = React.useId();
51
+ const describedBy = React.useMemo(() => {
52
+ const idRefs = [];
53
+ if (description) idRefs.push(descriptionId);
54
+ if (unstable_decorations || icon) idRefs.push(decorationId);
55
+ return idRefs.length > 0 ? idRefs.join(" ") : void 0;
56
+ }, [unstable_decorations, icon, decorationId, description, descriptionId]);
57
+ return /* @__PURE__ */ jsx(
58
+ TreeItemContext.Provider,
59
+ {
60
+ value: React.useMemo(
61
+ () => ({
62
+ level,
63
+ expanded,
64
+ selected
65
+ }),
66
+ [level, expanded, selected]
67
+ ),
68
+ children: /* @__PURE__ */ jsx(
69
+ CompositeItem,
70
+ {
71
+ render: /* @__PURE__ */ jsx(Role, { ...rest }),
72
+ onClick: useEventHandlers(
73
+ onClickProp,
74
+ handleClick
75
+ ),
76
+ onKeyDown: useEventHandlers(
77
+ onKeyDownProp,
78
+ handleKeyDown
79
+ ),
80
+ role: "treeitem",
81
+ "aria-expanded": expanded,
82
+ "aria-selected": selected,
83
+ "aria-labelledby": labelId,
84
+ "aria-describedby": describedBy,
85
+ "aria-level": level,
86
+ className: cx("\u{1F95D}-tree-item", props.className),
87
+ ref: forwardedRef,
88
+ children: /* @__PURE__ */ jsxs(
89
+ ListItem.Root,
90
+ {
91
+ "data-kiwi-expanded": expanded,
92
+ "data-kiwi-selected": selected,
93
+ className: "\u{1F95D}-tree-item-node",
94
+ style: { "--\u{1F95D}tree-item-level": level },
95
+ role: void 0,
96
+ children: [
97
+ /* @__PURE__ */ jsxs(ListItem.Decoration, { children: [
98
+ /* @__PURE__ */ jsx(GhostAligner, { align: description ? "block" : void 0, children: /* @__PURE__ */ jsx(
99
+ TreeItemExpander,
100
+ {
101
+ onClick: () => {
102
+ if (expanded === void 0) return;
103
+ onExpandedChange?.(!expanded);
104
+ }
105
+ }
106
+ ) }),
107
+ icon || unstable_decorations ? /* @__PURE__ */ jsx(
108
+ Role,
109
+ {
110
+ className: "\u{1F95D}-tree-item-decoration",
111
+ id: decorationId,
112
+ render: React.isValidElement(icon) ? icon : typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : void 0,
113
+ children: !icon ? unstable_decorations : null
114
+ }
115
+ ) : null
116
+ ] }),
117
+ /* @__PURE__ */ jsx(ListItem.Content, { id: labelId, className: "\u{1F95D}-tree-item-content", children: label }),
118
+ description ? /* @__PURE__ */ jsx(
119
+ ListItem.Content,
120
+ {
121
+ id: descriptionId,
122
+ className: "\u{1F95D}-tree-item-description",
123
+ children: description
124
+ }
125
+ ) : void 0,
126
+ /* @__PURE__ */ jsx(
127
+ ListItem.Decoration,
128
+ {
129
+ render: /* @__PURE__ */ jsx(TreeItemActions, { children: actions })
130
+ }
131
+ )
132
+ ]
133
+ }
134
+ )
135
+ }
136
+ )
137
+ }
138
+ );
139
+ }
140
+ );
141
+ DEV: TreeItemRoot.displayName = "TreeItem.Root";
142
+ const TreeItemActions = forwardRef((props, forwardedRef) => {
143
+ return /* @__PURE__ */ jsx(
144
+ Toolbar,
145
+ {
146
+ ...props,
147
+ onClick: useEventHandlers(props.onClick, (e) => e.stopPropagation()),
148
+ onKeyDown: useEventHandlers(props.onKeyDown, (e) => e.stopPropagation()),
149
+ className: cx("\u{1F95D}-tree-item-actions", props.className),
150
+ ref: forwardedRef,
151
+ children: props.children
152
+ }
153
+ );
154
+ });
155
+ DEV: TreeItemActions.displayName = "TreeItemActions";
156
+ const TreeItemAction = forwardRef(
157
+ (props, forwardedRef) => {
158
+ const { visible, ...rest } = props;
159
+ return /* @__PURE__ */ jsx(
160
+ IconButton,
161
+ {
162
+ inert: visible === false ? true : void 0,
163
+ ...rest,
164
+ variant: "ghost",
165
+ className: cx("\u{1F95D}-tree-item-action", props.className),
166
+ "data-kiwi-visible": visible,
167
+ ref: forwardedRef
168
+ }
169
+ );
170
+ }
171
+ );
172
+ DEV: TreeItemAction.displayName = "TreeItem.Action";
173
+ const TreeItemExpander = forwardRef(
174
+ (props, forwardedRef) => {
175
+ return /* @__PURE__ */ jsx(
176
+ Role.span,
177
+ {
178
+ "aria-hidden": "true",
179
+ ...props,
180
+ onClick: useEventHandlers(props.onClick, (e) => e.stopPropagation()),
181
+ className: cx(
182
+ "\u{1F95D}-button",
183
+ "\u{1F95D}-icon-button",
184
+ "\u{1F95D}-ghost-aligner",
185
+ "\u{1F95D}-tree-item-expander",
186
+ props.className
187
+ ),
188
+ "data-kiwi-variant": "ghost",
189
+ "data-kiwi-ghost-align": useGhostAlignment(),
190
+ ref: forwardedRef,
191
+ children: /* @__PURE__ */ jsx(TreeChevron, {})
192
+ }
193
+ );
194
+ }
195
+ );
196
+ DEV: TreeItemExpander.displayName = "TreeItemExpander";
197
+ const TreeChevron = forwardRef(
198
+ (props, forwardedRef) => {
199
+ return /* @__PURE__ */ jsx(
200
+ Icon,
201
+ {
202
+ ...props,
203
+ render: /* @__PURE__ */ jsx(
204
+ Role.svg,
205
+ {
206
+ width: "16",
207
+ height: "16",
208
+ fill: "currentColor",
209
+ viewBox: "0 0 16 16",
210
+ render: props.render,
211
+ 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" })
212
+ }
213
+ ),
214
+ className: cx("\u{1F95D}-tree-chevron", props.className),
215
+ ref: forwardedRef
216
+ }
217
+ );
218
+ }
219
+ );
220
+ DEV: TreeChevron.displayName = "TreeChevron";
221
+ export {
222
+ TreeItemAction as Action,
223
+ TreeItemRoot as Root
224
+ };
@@ -1,9 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import * as Ariakit from "@ariakit/react";
2
+ import { VisuallyHidden as AkVisuallyHidden } from "@ariakit/react/visually-hidden";
3
3
  import { forwardRef } from "./~utils.js";
4
4
  const VisuallyHidden = forwardRef(
5
5
  (props, forwardedRef) => {
6
- return /* @__PURE__ */ jsx(Ariakit.VisuallyHidden, { ...props, ref: forwardedRef });
6
+ return /* @__PURE__ */ jsx(AkVisuallyHidden, { ...props, ref: forwardedRef });
7
7
  }
8
8
  );
9
9
  DEV: VisuallyHidden.displayName = "VisuallyHidden";
@@ -1,8 +1,12 @@
1
1
  "use client";
2
2
  import { Root } from "./Root.js";
3
3
  import { Anchor } from "./Anchor.js";
4
+ import { Avatar } from "./Avatar.js";
5
+ import { Badge } from "./Badge.js";
4
6
  import { Button } from "./Button.js";
5
7
  import { Checkbox } from "./Checkbox.js";
8
+ import { Chip } from "./Chip.js";
9
+ import { Description } from "./Description.js";
6
10
  import * as DropdownMenu from "./DropdownMenu.js";
7
11
  import { Divider } from "./Divider.js";
8
12
  import { Icon } from "./Icon.js";
@@ -10,18 +14,26 @@ import { IconButton } from "./IconButton.js";
10
14
  import { Field } from "./Field.js";
11
15
  import { Kbd } from "./Kbd.js";
12
16
  import { Label } from "./Label.js";
17
+ import { ProgressBar } from "./ProgressBar.js";
13
18
  import { Radio } from "./Radio.js";
14
19
  import * as Select from "./Select.js";
20
+ import { Spinner } from "./Spinner.js";
21
+ import { Skeleton } from "./Skeleton.js";
15
22
  import { Switch } from "./Switch.js";
16
23
  import * as Tabs from "./Tabs.js";
17
24
  import { Text } from "./Text.js";
18
25
  import * as TextBox from "./TextBox.js";
26
+ import * as Tree from "./Tree.js";
19
27
  import { Tooltip } from "./Tooltip.js";
20
28
  import { VisuallyHidden } from "./VisuallyHidden.js";
21
29
  export {
22
30
  Anchor,
31
+ Avatar,
32
+ Badge,
23
33
  Button,
24
34
  Checkbox,
35
+ Chip,
36
+ Description,
25
37
  Divider,
26
38
  DropdownMenu,
27
39
  Field,
@@ -29,13 +41,17 @@ export {
29
41
  IconButton,
30
42
  Kbd,
31
43
  Label,
44
+ ProgressBar,
32
45
  Radio,
33
46
  Root,
34
47
  Select,
48
+ Skeleton,
49
+ Spinner,
35
50
  Switch,
36
51
  Tabs,
37
52
  Text,
38
53
  TextBox,
39
54
  Tooltip,
55
+ Tree,
40
56
  VisuallyHidden
41
57
  };