@itwin/itwinui-react 5.0.0-alpha.7 → 5.0.0-alpha.9

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 (87) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +6 -6
  4. package/dist/DEV/bricks/Anchor.js +4 -9
  5. package/dist/DEV/bricks/Avatar.js +2 -2
  6. package/dist/DEV/bricks/Badge.js +2 -2
  7. package/dist/DEV/bricks/Button.js +10 -3
  8. package/dist/DEV/bricks/Checkbox.js +4 -2
  9. package/dist/DEV/bricks/Chip.js +2 -2
  10. package/dist/DEV/bricks/Divider.js +3 -2
  11. package/dist/DEV/bricks/DropdownMenu.js +83 -33
  12. package/dist/DEV/bricks/Field.js +21 -17
  13. package/dist/DEV/bricks/Icon.js +5 -5
  14. package/dist/DEV/bricks/IconButton.js +14 -6
  15. package/dist/DEV/bricks/Kbd.internal.js +19 -0
  16. package/dist/DEV/bricks/Kbd.js +3 -18
  17. package/dist/DEV/bricks/Label.js +2 -2
  18. package/dist/DEV/bricks/Radio.js +4 -2
  19. package/dist/DEV/bricks/Root.js +35 -4
  20. package/dist/DEV/bricks/Select.js +3 -3
  21. package/dist/DEV/bricks/Spinner.js +2 -2
  22. package/dist/DEV/bricks/Switch.js +4 -2
  23. package/dist/DEV/bricks/Table.js +7 -7
  24. package/dist/DEV/bricks/Tabs.js +5 -5
  25. package/dist/DEV/bricks/Text.js +2 -2
  26. package/dist/DEV/bricks/TextBox.js +8 -7
  27. package/dist/DEV/bricks/Tooltip.js +11 -22
  28. package/dist/DEV/bricks/Tree.js +8 -202
  29. package/dist/DEV/bricks/TreeItem.js +219 -0
  30. package/dist/DEV/bricks/VisuallyHidden.js +2 -2
  31. package/dist/DEV/bricks/styles.css.js +2 -2
  32. package/dist/DEV/bricks/~hooks.js +31 -0
  33. package/dist/DEV/bricks/~utils.GhostAligner.js +13 -0
  34. package/dist/DEV/bricks/{ListItem.js → ~utils.ListItem.js} +6 -4
  35. package/dist/DEV/foundations/styles.css.js +2 -2
  36. package/dist/bricks/Anchor.js +4 -9
  37. package/dist/bricks/Avatar.js +2 -2
  38. package/dist/bricks/Badge.js +2 -2
  39. package/dist/bricks/Button.js +10 -3
  40. package/dist/bricks/Checkbox.d.ts +2 -2
  41. package/dist/bricks/Checkbox.js +4 -2
  42. package/dist/bricks/Chip.js +2 -2
  43. package/dist/bricks/Divider.d.ts +2 -2
  44. package/dist/bricks/Divider.js +3 -2
  45. package/dist/bricks/DropdownMenu.d.ts +38 -23
  46. package/dist/bricks/DropdownMenu.js +81 -33
  47. package/dist/bricks/Field.d.ts +5 -5
  48. package/dist/bricks/Field.js +21 -17
  49. package/dist/bricks/Icon.js +5 -5
  50. package/dist/bricks/IconButton.d.ts +20 -4
  51. package/dist/bricks/IconButton.js +14 -6
  52. package/dist/bricks/Kbd.d.ts +2 -17
  53. package/dist/bricks/Kbd.internal.d.ts +17 -0
  54. package/dist/bricks/Kbd.internal.js +19 -0
  55. package/dist/bricks/Kbd.js +3 -18
  56. package/dist/bricks/Label.js +2 -2
  57. package/dist/bricks/Radio.d.ts +2 -2
  58. package/dist/bricks/Radio.js +4 -2
  59. package/dist/bricks/Root.js +35 -4
  60. package/dist/bricks/Select.d.ts +1 -2
  61. package/dist/bricks/Select.js +3 -3
  62. package/dist/bricks/Spinner.js +2 -2
  63. package/dist/bricks/Switch.d.ts +2 -2
  64. package/dist/bricks/Switch.js +4 -2
  65. package/dist/bricks/Table.js +7 -7
  66. package/dist/bricks/Tabs.d.ts +4 -4
  67. package/dist/bricks/Tabs.js +5 -5
  68. package/dist/bricks/Text.d.ts +1 -1
  69. package/dist/bricks/Text.js +2 -2
  70. package/dist/bricks/TextBox.js +8 -7
  71. package/dist/bricks/Tooltip.d.ts +2 -2
  72. package/dist/bricks/Tooltip.js +11 -22
  73. package/dist/bricks/Tree.d.ts +3 -108
  74. package/dist/bricks/Tree.js +8 -196
  75. package/dist/bricks/TreeItem.d.ts +123 -0
  76. package/dist/bricks/TreeItem.js +214 -0
  77. package/dist/bricks/VisuallyHidden.js +2 -2
  78. package/dist/bricks/styles.css.js +2 -2
  79. package/dist/bricks/~hooks.d.ts +31 -1
  80. package/dist/bricks/~hooks.js +31 -0
  81. package/dist/bricks/~utils.GhostAligner.d.ts +22 -0
  82. package/dist/bricks/~utils.GhostAligner.js +13 -0
  83. package/dist/bricks/{ListItem.d.ts → ~utils.ListItem.d.ts} +6 -6
  84. package/dist/bricks/{ListItem.js → ~utils.ListItem.js} +6 -4
  85. package/dist/bricks/~utils.d.ts +6 -3
  86. package/dist/foundations/styles.css.js +2 -2
  87. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import * as Ariakit from "@ariakit/react";
2
+ import { useCollectionStore, type CollectionItemProps } from "@ariakit/react/collection";
3
3
  import { type BaseProps } from "./~utils.js";
4
4
  interface FieldProps extends BaseProps {
5
5
  /**
@@ -28,14 +28,14 @@ interface FieldProps extends BaseProps {
28
28
  * - `Switch`
29
29
  */
30
30
  export declare const Field: React.ForwardRefExoticComponent<FieldProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
31
- type CollectionStoreItem = NonNullable<ReturnType<ReturnType<typeof Ariakit.useCollectionStore>["item"]>>;
31
+ type CollectionStoreItem = NonNullable<ReturnType<ReturnType<typeof useCollectionStore>["item"]>>;
32
32
  interface FieldCollectionStoreItem extends CollectionStoreItem {
33
33
  /** The type of field element being tracked */
34
34
  elementType: "label" | "control" | "description";
35
35
  /** If a control, the type of control. */
36
36
  controlType?: "textlike" | "checkable";
37
37
  }
38
- interface FieldCollectionItemControlProps extends Pick<Ariakit.CollectionItemProps, "render" | "id"> {
38
+ interface FieldCollectionItemControlProps extends Pick<CollectionItemProps, "render" | "id"> {
39
39
  type: FieldCollectionStoreItem["controlType"];
40
40
  }
41
41
  /**
@@ -45,9 +45,9 @@ export declare function FieldControl(props: FieldCollectionItemControlProps): im
45
45
  /**
46
46
  * An element tracked as a label in the `Field`’s collection.
47
47
  */
48
- export declare function FieldLabel(props: Pick<Ariakit.CollectionItemProps, "render">): import("react/jsx-runtime").JSX.Element;
48
+ export declare function FieldLabel(props: Pick<CollectionItemProps, "render">): import("react/jsx-runtime").JSX.Element;
49
49
  /**
50
50
  * An element tracked as a description in the `Field`’s collection.
51
51
  */
52
- export declare function FieldDescription(props: Pick<Ariakit.CollectionItemProps, "render" | "id">): import("react/jsx-runtime").JSX.Element;
52
+ export declare function FieldDescription(props: Pick<CollectionItemProps, "render" | "id">): import("react/jsx-runtime").JSX.Element;
53
53
  export {};
@@ -1,7 +1,14 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import * as Ariakit from "@ariakit/react";
4
3
  import cx from "classnames";
4
+ import { Role } from "@ariakit/react/role";
5
+ import {
6
+ useCollectionStore,
7
+ Collection,
8
+ useCollectionContext,
9
+ CollectionItem
10
+ } from "@ariakit/react/collection";
11
+ import { useStoreState } from "@ariakit/react/store";
5
12
  import { forwardRef } from "./~utils.js";
6
13
  const Field = forwardRef((props, forwardedRef) => {
7
14
  const { layout, ...rest } = props;
@@ -9,7 +16,7 @@ const Field = forwardRef((props, forwardedRef) => {
9
16
  FieldCollection,
10
17
  {
11
18
  render: /* @__PURE__ */ jsx(
12
- Ariakit.Role.div,
19
+ Role.div,
13
20
  {
14
21
  ...rest,
15
22
  className: cx("\u{1F95D}-field", props.className),
@@ -21,13 +28,10 @@ const Field = forwardRef((props, forwardedRef) => {
21
28
  );
22
29
  });
23
30
  function FieldCollection(props) {
24
- const fieldElementCollection = Ariakit.useCollectionStore({
31
+ const fieldElementCollection = useCollectionStore({
25
32
  defaultItems: []
26
33
  });
27
- const renderedItems = Ariakit.useStoreState(
28
- fieldElementCollection,
29
- "renderedItems"
30
- );
34
+ const renderedItems = useStoreState(fieldElementCollection, "renderedItems");
31
35
  const [controlType, controlIndex] = React.useMemo(() => {
32
36
  const controlIndex2 = renderedItems.findIndex(
33
37
  (item) => item.elementType === "control"
@@ -42,7 +46,7 @@ function FieldCollection(props) {
42
46
  return labelIndex < controlIndex ? "before" : "after";
43
47
  }, [renderedItems, controlIndex]);
44
48
  return /* @__PURE__ */ jsx(
45
- Ariakit.Collection,
49
+ Collection,
46
50
  {
47
51
  ...props,
48
52
  store: fieldElementCollection,
@@ -52,10 +56,10 @@ function FieldCollection(props) {
52
56
  );
53
57
  }
54
58
  function FieldControl(props) {
55
- const store = Ariakit.useCollectionContext();
59
+ const store = useCollectionContext();
56
60
  const generatedId = React.useId();
57
61
  const { id = store ? generatedId : void 0, type, ...rest } = props;
58
- const renderedItems = Ariakit.useStoreState(store, "renderedItems");
62
+ const renderedItems = useStoreState(store, "renderedItems");
59
63
  const describedBy = React.useMemo(() => {
60
64
  const idRefList = renderedItems?.filter(
61
65
  (item) => item.elementType === "description"
@@ -71,17 +75,17 @@ function FieldControl(props) {
71
75
  [type]
72
76
  );
73
77
  return /* @__PURE__ */ jsx(
74
- Ariakit.CollectionItem,
78
+ CollectionItem,
75
79
  {
76
80
  id,
77
81
  getItem: getData,
78
- render: /* @__PURE__ */ jsx(Ariakit.Role, { ...rest, "aria-describedby": describedBy })
82
+ render: /* @__PURE__ */ jsx(Role, { ...rest, "aria-describedby": describedBy })
79
83
  }
80
84
  );
81
85
  }
82
86
  function FieldLabel(props) {
83
- const store = Ariakit.useCollectionContext();
84
- const renderedItems = Ariakit.useStoreState(store, "renderedItems");
87
+ const store = useCollectionContext();
88
+ const renderedItems = useStoreState(store, "renderedItems");
85
89
  const fieldId = React.useMemo(
86
90
  () => renderedItems?.find(
87
91
  (item) => item.elementType === "control"
@@ -96,10 +100,10 @@ function FieldLabel(props) {
96
100
  []
97
101
  );
98
102
  return /* @__PURE__ */ jsx(
99
- Ariakit.CollectionItem,
103
+ CollectionItem,
100
104
  {
101
105
  getItem: getData,
102
- render: /* @__PURE__ */ jsx(Ariakit.Role.label, { ...props, htmlFor: fieldId })
106
+ render: /* @__PURE__ */ jsx(Role.label, { ...props, htmlFor: fieldId })
103
107
  }
104
108
  );
105
109
  }
@@ -113,7 +117,7 @@ function FieldDescription(props) {
113
117
  }),
114
118
  []
115
119
  );
116
- return /* @__PURE__ */ jsx(Ariakit.CollectionItem, { ...rest, id, getItem: getData });
120
+ return /* @__PURE__ */ jsx(CollectionItem, { ...rest, id, getItem: getData });
117
121
  }
118
122
  export {
119
123
  Field,
@@ -1,14 +1,14 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import cx from "classnames";
4
- import * as Ariakit from "@ariakit/react";
4
+ import { Role } from "@ariakit/react/role";
5
5
  import { forwardRef } from "./~utils.js";
6
6
  const Icon = forwardRef((props, forwardedRef) => {
7
7
  const { href, size, alt, ...rest } = props;
8
8
  const iconId = toIconId(size);
9
9
  const isDecorative = !alt;
10
10
  return /* @__PURE__ */ jsx(
11
- Ariakit.Role.svg,
11
+ Role.svg,
12
12
  {
13
13
  "aria-hidden": isDecorative ? "true" : void 0,
14
14
  role: isDecorative ? void 0 : "img",
@@ -41,7 +41,7 @@ const DisclosureArrow = forwardRef(
41
41
  {
42
42
  ...rest,
43
43
  render: /* @__PURE__ */ jsx(
44
- Ariakit.Role.svg,
44
+ Role.svg,
45
45
  {
46
46
  width: "16",
47
47
  height: "16",
@@ -64,7 +64,7 @@ const Checkmark = forwardRef(
64
64
  {
65
65
  ...props,
66
66
  render: /* @__PURE__ */ jsx(
67
- Ariakit.Role.svg,
67
+ Role.svg,
68
68
  {
69
69
  width: "16",
70
70
  height: "16",
@@ -93,7 +93,7 @@ const Dismiss = forwardRef(
93
93
  {
94
94
  ...props,
95
95
  render: /* @__PURE__ */ jsx(
96
- Ariakit.Role.svg,
96
+ Role.svg,
97
97
  {
98
98
  width: "16",
99
99
  height: "16",
@@ -1,3 +1,4 @@
1
+ import * as React from "react";
1
2
  import { Button } from "./Button.js";
2
3
  interface IconButtonBaseProps extends Omit<React.ComponentProps<typeof Button>, "children" | "tone"> {
3
4
  /**
@@ -10,7 +11,7 @@ interface IconButtonBaseProps extends Omit<React.ComponentProps<typeof Button>,
10
11
  /**
11
12
  * Icon to be displayed inside the button.
12
13
  *
13
- * Can be a URL of an SVG from the `kiwi-icons` package,
14
+ * Can be a URL of an SVG from the `@itwin/itwinui-icons` package,
14
15
  * or a custom JSX icon.
15
16
  */
16
17
  icon: string | React.JSX.Element;
@@ -23,11 +24,26 @@ interface IconButtonBaseProps extends Omit<React.ComponentProps<typeof Button>,
23
24
  * @default "tooltip"
24
25
  */
25
26
  labelVariant?: "tooltip" | "visually-hidden";
27
+ /**
28
+ * A small dot displayed in the corner of the icon.
29
+ *
30
+ * The value of this prop gets used as the button's "accessible description".
31
+ *
32
+ * Example:
33
+ * ```tsx
34
+ * <IconButton
35
+ * label="Messages"
36
+ * dot="You have unread messages"
37
+ * icon={…}
38
+ * />
39
+ * ```
40
+ */
41
+ dot?: string;
26
42
  }
27
43
  /**
28
44
  * An icon-only button, with a required accessible name.
29
45
  *
30
- * The icon can be a URL from the `kiwi-icons` package:
46
+ * The icon can be a URL from the `@itwin/itwinui-icons` package:
31
47
  * ```tsx
32
48
  * <IconButton
33
49
  * label="Reveal full content"
@@ -56,7 +72,7 @@ interface IconButtonBaseProps extends Omit<React.ComponentProps<typeof Button>,
56
72
  * />
57
73
  * ```
58
74
  */
59
- export declare const IconButton: import("react").ForwardRefExoticComponent<(Omit<IconButtonBaseProps & {
75
+ export declare const IconButton: React.ForwardRefExoticComponent<(Omit<IconButtonBaseProps & {
60
76
  variant: "ghost";
61
77
  /**
62
78
  * Whether the button is in a toggled state and currently "active" (toggled on).
@@ -75,5 +91,5 @@ export declare const IconButton: import("react").ForwardRefExoticComponent<(Omit
75
91
  }, "ref"> | Omit<IconButtonBaseProps & {
76
92
  variant?: Omit<React.ComponentProps<typeof Button>["variant"], "ghost">;
77
93
  isActive?: never;
78
- }, "ref">) & import("react").RefAttributes<HTMLElement | HTMLButtonElement>>;
94
+ }, "ref">) & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
79
95
  export {};
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
2
3
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
4
+ import { useToolbarContext, ToolbarItem } from "@ariakit/react/toolbar";
4
5
  import { Button } from "./Button.js";
5
6
  import { VisuallyHidden } from "./VisuallyHidden.js";
6
7
  import { Icon } from "./Icon.js";
@@ -8,19 +9,26 @@ import { Tooltip } from "./Tooltip.js";
8
9
  import { forwardRef } from "./~utils.js";
9
10
  const IconButton = forwardRef(
10
11
  (props, forwardedRef) => {
11
- const { label, icon, isActive, labelVariant, ...rest } = props;
12
- const toolbar = Ariakit.useToolbarContext();
12
+ const { label, icon, isActive, labelVariant, dot, ...rest } = props;
13
+ const baseId = React.useId();
14
+ const labelId = `${baseId}-label`;
15
+ const dotId = `${baseId}-dot`;
16
+ const toolbar = useToolbarContext();
13
17
  const button = /* @__PURE__ */ jsxs(
14
18
  Button,
15
19
  {
16
20
  "aria-pressed": isActive,
21
+ "aria-labelledby": labelId,
22
+ "aria-describedby": dot ? dotId : void 0,
17
23
  ...rest,
18
- render: toolbar ? /* @__PURE__ */ jsx(Ariakit.ToolbarItem, { render: props.render }) : props.render,
24
+ "data-kiwi-dot": dot ? "true" : void 0,
25
+ render: toolbar ? /* @__PURE__ */ jsx(ToolbarItem, { render: props.render }) : props.render,
19
26
  className: cx("\u{1F95D}-icon-button", props.className),
20
27
  ref: forwardedRef,
21
28
  children: [
22
- /* @__PURE__ */ jsx(VisuallyHidden, { children: label }),
23
- typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : icon
29
+ /* @__PURE__ */ jsx(VisuallyHidden, { id: labelId, children: label }),
30
+ typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : icon,
31
+ dot ? /* @__PURE__ */ jsx(VisuallyHidden, { id: dotId, "aria-hidden": "true", children: dot }) : null
24
32
  ]
25
33
  }
26
34
  );
@@ -1,20 +1,5 @@
1
1
  import { type BaseProps } from "./~utils.js";
2
- declare const predefinedSymbols: {
3
- readonly Backspace: "⌫";
4
- readonly Command: "⌘";
5
- readonly Control: "Ctrl";
6
- readonly Down: "↓";
7
- readonly Eject: "⏏";
8
- readonly Enter: "↵";
9
- readonly Escape: "Esc";
10
- readonly Left: "←";
11
- readonly Option: "⌥";
12
- readonly Right: "→";
13
- readonly Shift: "⇧";
14
- readonly Space: "␣";
15
- readonly Tab: "Tab";
16
- readonly Up: "↑";
17
- };
2
+ import { type PredefinedSymbol } from "./Kbd.internal.js";
18
3
  interface KbdProps extends BaseProps<"kbd"> {
19
4
  /** @default "solid" */
20
5
  variant?: "solid" | "muted" | "ghost";
@@ -27,7 +12,7 @@ interface KbdProps extends BaseProps<"kbd"> {
27
12
  * <Kbd symbol="Control" />
28
13
  * ```
29
14
  */
30
- symbol?: keyof typeof predefinedSymbols;
15
+ symbol?: PredefinedSymbol;
31
16
  }
32
17
  /**
33
18
  * A styled wrapper over the HTML `<kbd>` element. This is typically
@@ -0,0 +1,17 @@
1
+ export type PredefinedSymbol = keyof typeof predefinedSymbols;
2
+ export declare const predefinedSymbols: {
3
+ readonly Backspace: "⌫";
4
+ readonly Command: "⌘";
5
+ readonly Control: "Ctrl";
6
+ readonly Down: "↓";
7
+ readonly Eject: "⏏";
8
+ readonly Enter: "↵";
9
+ readonly Escape: "Esc";
10
+ readonly Left: "←";
11
+ readonly Option: "⌥";
12
+ readonly Right: "→";
13
+ readonly Shift: "⇧";
14
+ readonly Space: "␣";
15
+ readonly Tab: "Tab";
16
+ readonly Up: "↑";
17
+ };
@@ -0,0 +1,19 @@
1
+ const predefinedSymbols = {
2
+ Backspace: "\u232B",
3
+ Command: "\u2318",
4
+ Control: "Ctrl",
5
+ Down: "\u2193",
6
+ Eject: "\u23CF",
7
+ Enter: "\u21B5",
8
+ Escape: "Esc",
9
+ Left: "\u2190",
10
+ Option: "\u2325",
11
+ Right: "\u2192",
12
+ Shift: "\u21E7",
13
+ Space: "\u2423",
14
+ Tab: "Tab",
15
+ Up: "\u2191"
16
+ };
17
+ export {
18
+ predefinedSymbols
19
+ };
@@ -1,24 +1,9 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
3
+ import { Role } from "@ariakit/react/role";
4
4
  import { forwardRef } from "./~utils.js";
5
5
  import { VisuallyHidden } from "./VisuallyHidden.js";
6
- const predefinedSymbols = {
7
- Backspace: "\u232B",
8
- Command: "\u2318",
9
- Control: "Ctrl",
10
- Down: "\u2193",
11
- Eject: "\u23CF",
12
- Enter: "\u21B5",
13
- Escape: "Esc",
14
- Left: "\u2190",
15
- Option: "\u2325",
16
- Right: "\u2192",
17
- Shift: "\u21E7",
18
- Space: "\u2423",
19
- Tab: "Tab",
20
- Up: "\u2191"
21
- };
6
+ import { predefinedSymbols } from "./Kbd.internal.js";
22
7
  const Kbd = forwardRef((props, forwardedRef) => {
23
8
  const { variant = "solid", symbol, children, ...rest } = props;
24
9
  let content = children;
@@ -29,7 +14,7 @@ const Kbd = forwardRef((props, forwardedRef) => {
29
14
  ] });
30
15
  }
31
16
  return /* @__PURE__ */ jsx(
32
- Ariakit.Role,
17
+ Role,
33
18
  {
34
19
  ...rest,
35
20
  "data-kiwi-variant": variant,
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
3
+ import { Role } from "@ariakit/react/role";
4
4
  import { forwardRef } from "./~utils.js";
5
5
  import { FieldLabel } from "./Field.js";
6
6
  const Label = forwardRef((props, forwardedRef) => {
@@ -8,7 +8,7 @@ const Label = forwardRef((props, forwardedRef) => {
8
8
  FieldLabel,
9
9
  {
10
10
  render: /* @__PURE__ */ jsx(
11
- Ariakit.Role.label,
11
+ Role.label,
12
12
  {
13
13
  ...props,
14
14
  className: cx("\u{1F95D}-label", props.className),
@@ -1,7 +1,7 @@
1
- import * as Ariakit from "@ariakit/react";
1
+ import { type RadioProps as AkRadioProps } from "@ariakit/react/radio";
2
2
  import { type FocusableProps } from "./~utils.js";
3
3
  type InputBaseProps = Omit<FocusableProps<"input">, "defaultValue" | "value">;
4
- type RadioOwnProps = Pick<Ariakit.RadioProps, "value" | "checked" | "onChange">;
4
+ type RadioOwnProps = Pick<AkRadioProps, "value" | "checked" | "onChange">;
5
5
  interface RadioProps extends InputBaseProps, RadioOwnProps {
6
6
  }
7
7
  /**
@@ -1,6 +1,8 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
3
+ import {
4
+ Radio as AkRadio
5
+ } from "@ariakit/react/radio";
4
6
  import { FieldControl } from "./Field.js";
5
7
  import { forwardRef } from "./~utils.js";
6
8
  const Radio = forwardRef((props, forwardedRef) => {
@@ -11,7 +13,7 @@ const Radio = forwardRef((props, forwardedRef) => {
11
13
  type: "checkable",
12
14
  id,
13
15
  render: /* @__PURE__ */ jsx(
14
- Ariakit.Radio,
16
+ AkRadio,
15
17
  {
16
18
  accessibleWhenDisabled: true,
17
19
  ...rest,
@@ -1,19 +1,30 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import * as Ariakit from "@ariakit/react";
3
+ import * as ReactDOM from "react-dom";
4
+ import { Role } from "@ariakit/react/role";
5
+ import { PortalContext } from "@ariakit/react/portal";
4
6
  import cx from "classnames";
5
7
  import foundationsCss from "../foundations/styles.css.js";
6
8
  import bricksCss from "./styles.css.js";
7
9
  import { forwardRef, isBrowser } from "./~utils.js";
8
- import { useMergedRefs } from "./~hooks.js";
10
+ import { useIsClient, useMergedRefs } from "./~hooks.js";
9
11
  const css = foundationsCss + bricksCss;
10
12
  const Root = forwardRef((props, forwardedRef) => {
11
13
  const { children, synchronizeColorScheme = false, ...rest } = props;
14
+ const [portalContainer, setPortalContainer] = React.useState(null);
12
15
  return /* @__PURE__ */ jsxs(RootInternal, { ...rest, ref: forwardedRef, children: [
13
16
  /* @__PURE__ */ jsx(Styles, {}),
14
17
  /* @__PURE__ */ jsx(Fonts, {}),
15
18
  synchronizeColorScheme ? /* @__PURE__ */ jsx(SynchronizeColorScheme, { colorScheme: props.colorScheme }) : null,
16
- children
19
+ /* @__PURE__ */ jsx(
20
+ PortalContainer,
21
+ {
22
+ colorScheme: props.colorScheme,
23
+ density: props.density,
24
+ ref: setPortalContainer
25
+ }
26
+ ),
27
+ /* @__PURE__ */ jsx(PortalContext.Provider, { value: portalContainer, children })
17
28
  ] });
18
29
  });
19
30
  const RootNodeContext = React.createContext(null);
@@ -31,7 +42,7 @@ const RootInternal = forwardRef(
31
42
  setRootNode(rootNode2);
32
43
  }, []);
33
44
  return /* @__PURE__ */ jsx(
34
- Ariakit.Role,
45
+ Role,
35
46
  {
36
47
  ...rest,
37
48
  className: cx("\u{1F95D}-root", props.className),
@@ -59,6 +70,26 @@ function SynchronizeColorScheme({
59
70
  }, [rootNode, colorScheme]);
60
71
  return null;
61
72
  }
73
+ const PortalContainer = forwardRef((props, forwardedRef) => {
74
+ const isClient = useIsClient();
75
+ const rootNode = useRootNode();
76
+ if (!isClient) return null;
77
+ const destination = rootNode && isDocument(rootNode) ? rootNode.body : rootNode;
78
+ if (!destination) return null;
79
+ return ReactDOM.createPortal(
80
+ /* @__PURE__ */ jsx(
81
+ "div",
82
+ {
83
+ className: "\u{1F95D}-root",
84
+ "data-kiwi-theme": props.colorScheme,
85
+ "data-kiwi-density": props.density,
86
+ style: { display: "contents" },
87
+ ref: forwardedRef
88
+ }
89
+ ),
90
+ destination
91
+ );
92
+ });
62
93
  function Styles() {
63
94
  const rootNode = useRootNode();
64
95
  useLayoutEffect(() => {
@@ -1,5 +1,4 @@
1
1
  import * as React from "react";
2
- import * as Ariakit from "@ariakit/react";
3
2
  import { type FocusableProps } from "./~utils.js";
4
3
  /**
5
4
  * Compound component for a select element, which allows the user to select a value from a list of options.
@@ -20,7 +19,7 @@ import { type FocusableProps } from "./~utils.js";
20
19
  * </Field>
21
20
  * ```
22
21
  */
23
- declare const SelectRoot: React.ForwardRefExoticComponent<Pick<Ariakit.RoleProps, "render"> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "render"> & React.RefAttributes<HTMLElement | HTMLDivElement>>;
22
+ declare const SelectRoot: React.ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "render"> & React.RefAttributes<HTMLElement | HTMLDivElement>>;
24
23
  type HtmlSelectBaseProps = Omit<FocusableProps<"select">, "multiple" | "size">;
25
24
  interface HtmlSelectProps extends HtmlSelectBaseProps {
26
25
  /**
@@ -1,7 +1,7 @@
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";
4
+ import { Role } from "@ariakit/react/role";
5
5
  import {
6
6
  forwardRef,
7
7
  isBrowser
@@ -14,7 +14,7 @@ const HtmlSelectContext = React.createContext(() => {
14
14
  const SelectRoot = forwardRef((props, forwardedRef) => {
15
15
  const [isHtmlSelect, setIsHtmlSelect] = React.useState(false);
16
16
  return /* @__PURE__ */ jsx(HtmlSelectContext.Provider, { value: setIsHtmlSelect, children: /* @__PURE__ */ jsx(
17
- Ariakit.Role.div,
17
+ Role.div,
18
18
  {
19
19
  ...props,
20
20
  className: cx("\u{1F95D}-select-root", props.className),
@@ -40,7 +40,7 @@ const HtmlSelect = forwardRef(
40
40
  type: "textlike",
41
41
  id,
42
42
  render: /* @__PURE__ */ jsx(
43
- Ariakit.Role.select,
43
+ Role.select,
44
44
  {
45
45
  ...rest,
46
46
  className: cx("\u{1F95D}-button", "\u{1F95D}-select", props.className),
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } 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 { VisuallyHidden } from "./VisuallyHidden.js";
5
5
  import { forwardRef } from "./~utils.js";
@@ -12,7 +12,7 @@ const Spinner = forwardRef(
12
12
  ...rest
13
13
  } = props;
14
14
  return /* @__PURE__ */ jsxs(
15
- Ariakit.Role,
15
+ Role,
16
16
  {
17
17
  ...rest,
18
18
  "data-kiwi-size": size,
@@ -1,7 +1,7 @@
1
- import * as Ariakit from "@ariakit/react";
1
+ import { type CheckboxProps as AkCheckboxProps } from "@ariakit/react/checkbox";
2
2
  import { type FocusableProps } from "./~utils.js";
3
3
  type InputBaseProps = Omit<FocusableProps<"input">, "defaultValue" | "value">;
4
- type CheckboxOwnProps = Pick<Ariakit.CheckboxProps, "value" | "defaultChecked" | "checked" | "onChange">;
4
+ type CheckboxOwnProps = Pick<AkCheckboxProps, "value" | "defaultChecked" | "checked" | "onChange">;
5
5
  interface SwitchProps extends InputBaseProps, CheckboxOwnProps {
6
6
  /** The default checked state of the toggle switch. */
7
7
  defaultChecked?: boolean;
@@ -1,6 +1,8 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
3
+ import {
4
+ Checkbox as AkCheckbox
5
+ } from "@ariakit/react/checkbox";
4
6
  import { FieldControl } from "./Field.js";
5
7
  import { forwardRef } from "./~utils.js";
6
8
  const Switch = forwardRef(
@@ -12,7 +14,7 @@ const Switch = forwardRef(
12
14
  type: "checkable",
13
15
  id,
14
16
  render: /* @__PURE__ */ jsx(
15
- Ariakit.Checkbox,
17
+ AkCheckbox,
16
18
  {
17
19
  accessibleWhenDisabled: true,
18
20
  ...rest,
@@ -1,5 +1,5 @@
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 * as React from "react";
4
4
  import cx from "classnames";
5
5
  import { forwardRef } from "./~utils.js";
@@ -12,7 +12,7 @@ const Table = forwardRef((props, forwardedRef) => {
12
12
  const [captionId, setCaptionId] = React.useState();
13
13
  const tableContext = React.useMemo(() => ({ setCaptionId }), []);
14
14
  return /* @__PURE__ */ jsx(TableContext.Provider, { value: tableContext, children: /* @__PURE__ */ jsx(
15
- Ariakit.Role,
15
+ Role,
16
16
  {
17
17
  ...props,
18
18
  className: cx("\u{1F95D}-table", props.className),
@@ -27,7 +27,7 @@ const TableHeaderContext = React.createContext(false);
27
27
  const TableHeader = forwardRef(
28
28
  (props, forwardedRef) => {
29
29
  return /* @__PURE__ */ jsx(TableHeaderContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
30
- Ariakit.Role.div,
30
+ Role.div,
31
31
  {
32
32
  ...props,
33
33
  className: cx("\u{1F95D}-table-header", props.className),
@@ -40,7 +40,7 @@ const TableHeader = forwardRef(
40
40
  );
41
41
  const TableBody = forwardRef((props, forwardedRef) => {
42
42
  return /* @__PURE__ */ jsx(
43
- Ariakit.Role.div,
43
+ Role.div,
44
44
  {
45
45
  ...props,
46
46
  className: cx("\u{1F95D}-table-body", props.className),
@@ -52,7 +52,7 @@ const TableBody = forwardRef((props, forwardedRef) => {
52
52
  const TableRow = forwardRef((props, forwardedRef) => {
53
53
  const { children, ...rest } = props;
54
54
  return /* @__PURE__ */ jsx(
55
- Ariakit.Role.div,
55
+ Role.div,
56
56
  {
57
57
  ...rest,
58
58
  className: cx("\u{1F95D}-table-row", props.className),
@@ -74,7 +74,7 @@ const TableCaption = forwardRef(
74
74
  [id, setCaptionId]
75
75
  );
76
76
  return /* @__PURE__ */ jsx(
77
- Ariakit.Role,
77
+ Role,
78
78
  {
79
79
  ...rest,
80
80
  id,
@@ -88,7 +88,7 @@ const TableCaption = forwardRef(
88
88
  const TableCell = forwardRef((props, forwardedRef) => {
89
89
  const isWithinTableHeader = React.useContext(TableHeaderContext);
90
90
  return /* @__PURE__ */ jsx(
91
- Ariakit.Role.span,
91
+ Role.span,
92
92
  {
93
93
  ...props,
94
94
  className: cx("\u{1F95D}-table-cell", props.className),