@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
@@ -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,8 +19,15 @@ 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>>;
24
- interface HtmlSelectProps extends Omit<FocusableProps<"select">, "multiple" | "size"> {
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>>;
23
+ type HtmlSelectBaseProps = Omit<FocusableProps<"select">, "multiple" | "size">;
24
+ interface HtmlSelectProps extends HtmlSelectBaseProps {
25
+ /**
26
+ * The variant of the `HtmlSelect`, i.e. solid, outline, or ghost.
27
+ *
28
+ * @default "solid"
29
+ */
30
+ variant?: "solid" | "outline" | "ghost";
25
31
  }
26
32
  /**
27
33
  * The actual select element to be used inside `Select.Root`. This is a wrapper around the
@@ -1,20 +1,20 @@
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
8
8
  } from "./~utils.js";
9
9
  import { DisclosureArrow } from "./Icon.js";
10
- import { useFieldId } from "./Field.js";
10
+ import { FieldControl } from "./Field.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
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),
@@ -25,8 +25,8 @@ const SelectRoot = forwardRef((props, forwardedRef) => {
25
25
  });
26
26
  const HtmlSelect = forwardRef(
27
27
  (props, forwardedRef) => {
28
+ const { id, variant = "solid", ...rest } = props;
28
29
  const setIsHtmlSelect = React.useContext(HtmlSelectContext);
29
- const fieldId = useFieldId();
30
30
  React.useEffect(
31
31
  function updateContext() {
32
32
  setIsHtmlSelect(true);
@@ -35,14 +35,20 @@ const HtmlSelect = forwardRef(
35
35
  );
36
36
  return /* @__PURE__ */ jsxs(Fragment, { children: [
37
37
  /* @__PURE__ */ jsx(
38
- Ariakit.Role.select,
38
+ FieldControl,
39
39
  {
40
- id: fieldId,
41
- ...props,
42
- className: cx("\u{1F95D}-button", "\u{1F95D}-select", props.className),
43
- "data-kiwi-tone": "neutral",
44
- "data-kiwi-variant": "solid",
45
- ref: forwardedRef
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
+ )
46
52
  }
47
53
  ),
48
54
  /* @__PURE__ */ jsx(DisclosureArrow, { className: "\u{1F95D}-select-arrow" })
@@ -0,0 +1,25 @@
1
+ import { type BaseProps } from "./~utils.js";
2
+ interface SkeletonPropsBase extends Omit<BaseProps, "children"> {
3
+ }
4
+ /**
5
+ * Represents the loaded content before it finishes loading.
6
+ *
7
+ * Example:
8
+ * ```tsx
9
+ * <Skeleton variant="object" size="small" shape="square" />
10
+ * <Skeleton variant="text" size="medium" />
11
+ * ```
12
+ */
13
+ export declare const Skeleton: import("react").ForwardRefExoticComponent<SkeletonPropsBase & {
14
+ /**
15
+ * The type of the skeleton item. Available variants: `text`, `object`.
16
+ * @default "text"
17
+ */
18
+ variant?: "text" | "object";
19
+ /**
20
+ * The size of the skeleton item. Available sizes: `xsmall`, `small`, `medium`, `large`, `xlarge`
21
+ * @default "medium"
22
+ */
23
+ size?: "xsmall" | "small" | "medium" | "large" | "xlarge";
24
+ } & import("react").RefAttributes<HTMLElement | HTMLDivElement>>;
25
+ export {};
@@ -0,0 +1,23 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Role } from "@ariakit/react/role";
3
+ import cx from "classnames";
4
+ import { forwardRef } from "./~utils.js";
5
+ const Skeleton = forwardRef(
6
+ (props, forwardedRef) => {
7
+ const { variant = "text", size = "medium", ...rest } = props;
8
+ return /* @__PURE__ */ jsx(
9
+ Role.div,
10
+ {
11
+ ...rest,
12
+ ref: forwardedRef,
13
+ className: cx("\u{1F95D}-skeleton", props.className),
14
+ "data-kiwi-variant": variant,
15
+ "data-kiwi-size": size,
16
+ "aria-hidden": true
17
+ }
18
+ );
19
+ }
20
+ );
21
+ export {
22
+ Skeleton
23
+ };
@@ -0,0 +1,31 @@
1
+ import { type BaseProps } from "./~utils.js";
2
+ interface SpinnerProps extends BaseProps {
3
+ /**
4
+ * A text alternative for the spinner.
5
+ * @default "Loading…"
6
+ */
7
+ alt?: string;
8
+ /**
9
+ * The size of the spinner.
10
+ * @default "medium"
11
+ */
12
+ size?: "small" | "medium" | "large" | "xlarge";
13
+ /**
14
+ * The tone of the spinner.
15
+ * @default "neutral"
16
+ */
17
+ tone?: "neutral" | "accent";
18
+ }
19
+ /**
20
+ * A loading spinner.
21
+ *
22
+ * Example:
23
+ * ```tsx
24
+ * <Spinner />
25
+ * ```
26
+ *
27
+ * Supports a `tone` prop to change the tone (color) of the spinner.
28
+ * Supports a `size` prop to change the size of the spinner.
29
+ */
30
+ export declare const Spinner: import("react").ForwardRefExoticComponent<SpinnerProps & import("react").RefAttributes<HTMLElement | HTMLDivElement>>;
31
+ export {};
@@ -0,0 +1,39 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Role } from "@ariakit/react/role";
3
+ import cx from "classnames";
4
+ import { VisuallyHidden } from "./VisuallyHidden.js";
5
+ import { forwardRef } from "./~utils.js";
6
+ const Spinner = forwardRef(
7
+ (props, forwardedRef) => {
8
+ const {
9
+ alt = "Loading\u2026",
10
+ size = "medium",
11
+ tone = "neutral",
12
+ ...rest
13
+ } = props;
14
+ return /* @__PURE__ */ jsxs(
15
+ Role,
16
+ {
17
+ ...rest,
18
+ "data-kiwi-size": size,
19
+ "data-kiwi-tone": tone,
20
+ className: cx("\u{1F95D}-spinner", props.className),
21
+ ref: forwardedRef,
22
+ children: [
23
+ /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", className: "\u{1F95D}-spinner-svg", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx(
24
+ "path",
25
+ {
26
+ stroke: "currentColor",
27
+ strokeLinecap: "round",
28
+ d: "M9.5 1.674a6.503 6.503 0 0 1 0 12.652m-3-12.652a6.503 6.503 0 0 0 0 12.652"
29
+ }
30
+ ) }),
31
+ /* @__PURE__ */ jsx(VisuallyHidden, { children: alt })
32
+ ]
33
+ }
34
+ );
35
+ }
36
+ );
37
+ export {
38
+ Spinner
39
+ };
@@ -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,20 +1,28 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
4
- import { useFieldId } from "./Field.js";
3
+ import {
4
+ Checkbox as AkCheckbox
5
+ } from "@ariakit/react/checkbox";
6
+ import { FieldControl } from "./Field.js";
5
7
  import { forwardRef } from "./~utils.js";
6
8
  const Switch = forwardRef(
7
9
  (props, forwardedRef) => {
8
- const fieldId = useFieldId();
10
+ const { id, ...rest } = props;
9
11
  return /* @__PURE__ */ jsx(
10
- Ariakit.Checkbox,
12
+ FieldControl,
11
13
  {
12
- accessibleWhenDisabled: true,
13
- id: fieldId,
14
- ...props,
15
- className: cx("\u{1F95D}-switch", props.className),
16
- role: "switch",
17
- ref: forwardedRef
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
+ )
18
26
  }
19
27
  );
20
28
  }
@@ -0,0 +1,115 @@
1
+ import * as React from "react";
2
+ import { type BaseProps } from "./~utils.js";
3
+ interface TableProps extends BaseProps {
4
+ }
5
+ /**
6
+ * A table is a grid of rows and columns that displays data in a structured format.
7
+ *
8
+ * `Table.Root` is the root component for a table.
9
+ * `Table.Header`, `Table.Body`, and `Table.Cell` can be nested inside a `Table.Root` to create a table structure.
10
+ *
11
+ * Example:
12
+ * ```tsx
13
+ * <Table.Root>
14
+ * <Table.Caption>Table Caption</Table.Caption>
15
+ * <Table.Header>
16
+ * <Table.Row>
17
+ * <Table.Cell>Header 1</Table.Cell>
18
+ * <Table.Cell>Header 2</Table.Cell>
19
+ * </Table.Row>
20
+ * </Table.Header>
21
+ *
22
+ * <Table.Body>
23
+ * <Table.Row>
24
+ * <Table.Cell>Cell 1.1</Table.Cell>
25
+ * <Table.Cell>Cell 1.2</Table.Cell>
26
+ * </Table.Row>
27
+ * <Table.Row>
28
+ * <Table.Cell>Cell 2.1</Table.Cell>
29
+ * <Table.Cell>Cell 2.2</Table.Cell>
30
+ * </Table.Row>
31
+ * </Table.Body>
32
+ * </Table.Root>
33
+ * ```
34
+ */
35
+ declare const Table: React.ForwardRefExoticComponent<TableProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
36
+ interface TableHeaderProps extends BaseProps {
37
+ }
38
+ /**
39
+ * `Table.Header` is a column component of cells that labels the columns of a table.
40
+ * `Table.Row` and `Table.Cell` can be nested inside a `Table.Header` to create a header row.
41
+ *
42
+ * Example:
43
+ * ```tsx
44
+ * <Table.Header>
45
+ * <Table.Row>
46
+ * <Table.Cell>Header 1</Table.Cell>
47
+ * <Table.Cell>Header 2</Table.Cell>
48
+ * </Table.Row>
49
+ * </Table.Header>
50
+ * ```
51
+ */
52
+ declare const TableHeader: React.ForwardRefExoticComponent<TableHeaderProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
53
+ interface TableBodyProps extends BaseProps {
54
+ }
55
+ /**
56
+ * `Table.Body` is a component that contains the rows of table data.
57
+ * Multiple `Table.Row`s and `Table.Cell`s can be nested inside a `Table.Body` to create a table body.
58
+ *
59
+ * This component intentionally does not set `role=rowgroup` because it is not properly supported.
60
+ *
61
+ * Example:
62
+ * ```tsx
63
+ * <Table.Body>
64
+ * <Table.Row>
65
+ * <Table.Cell>Cell 1.1</Table.Cell>
66
+ * <Table.Cell>Cell 1.2</Table.Cell>
67
+ * </Table.Row>
68
+ * <Table.Row>
69
+ * <Table.Cell>Cell 2.1</Table.Cell>
70
+ * <Table.Cell>Cell 2.2</Table.Cell>
71
+ * </Table.Row>
72
+ * </Table.Body>
73
+ * ```
74
+ */
75
+ declare const TableBody: React.ForwardRefExoticComponent<TableBodyProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
76
+ interface TableRowProps extends BaseProps {
77
+ }
78
+ /**
79
+ * `Table.Row` is a component that contains the cells of a table row.
80
+ *
81
+ * Example:
82
+ * ```tsx
83
+ * <Table.Row>
84
+ * <Table.Cell>Cell 1.1</Table.Cell>
85
+ * <Table.Cell>Cell 1.2</Table.Cell>
86
+ * </Table.Row>
87
+ * ```
88
+ */
89
+ declare const TableRow: React.ForwardRefExoticComponent<TableRowProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
90
+ interface TableCaptionProps extends BaseProps<"caption"> {
91
+ }
92
+ /**
93
+ * `Table.Caption` is a component that contains the caption of a table.
94
+ *
95
+ * Example:
96
+ * ```tsx
97
+ * <Table.Root>
98
+ * <Table.Caption>Table Caption</Table.Caption>
99
+ * …
100
+ * </Table.Root>
101
+ * ```
102
+ */
103
+ declare const TableCaption: React.ForwardRefExoticComponent<TableCaptionProps & React.RefAttributes<HTMLElement>>;
104
+ interface TableCellProps extends BaseProps<"span"> {
105
+ }
106
+ /**
107
+ * `Table.Cell` is a component that contains the data of a table cell.
108
+ *
109
+ * Example:
110
+ * ```tsx
111
+ * <Table.Cell>Cell 1.1</Table.Cell>
112
+ * ```
113
+ */
114
+ declare const TableCell: React.ForwardRefExoticComponent<TableCellProps & React.RefAttributes<HTMLElement | HTMLSpanElement>>;
115
+ export { Table as Root, TableHeader as Header, TableBody as Body, TableRow as Row, TableCaption as Caption, TableCell as Cell, };
@@ -0,0 +1,108 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Role } from "@ariakit/react/role";
3
+ import * as React from "react";
4
+ import cx from "classnames";
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(
15
+ Role,
16
+ {
17
+ ...props,
18
+ className: cx("\u{1F95D}-table", props.className),
19
+ ref: forwardedRef,
20
+ role: "table",
21
+ "aria-labelledby": captionId,
22
+ children: props.children
23
+ }
24
+ ) });
25
+ });
26
+ const TableHeaderContext = React.createContext(false);
27
+ const TableHeader = forwardRef(
28
+ (props, forwardedRef) => {
29
+ return /* @__PURE__ */ jsx(TableHeaderContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
30
+ Role.div,
31
+ {
32
+ ...props,
33
+ className: cx("\u{1F95D}-table-header", props.className),
34
+ ref: forwardedRef,
35
+ role: "rowgroup",
36
+ children: props.children
37
+ }
38
+ ) });
39
+ }
40
+ );
41
+ const TableBody = forwardRef((props, forwardedRef) => {
42
+ return /* @__PURE__ */ jsx(
43
+ Role.div,
44
+ {
45
+ ...props,
46
+ className: cx("\u{1F95D}-table-body", props.className),
47
+ ref: forwardedRef,
48
+ children: props.children
49
+ }
50
+ );
51
+ });
52
+ const TableRow = forwardRef((props, forwardedRef) => {
53
+ const { children, ...rest } = props;
54
+ return /* @__PURE__ */ jsx(
55
+ Role.div,
56
+ {
57
+ ...rest,
58
+ className: cx("\u{1F95D}-table-row", props.className),
59
+ ref: forwardedRef,
60
+ role: "row",
61
+ children
62
+ }
63
+ );
64
+ });
65
+ const TableCaption = forwardRef(
66
+ (props, forwardedRef) => {
67
+ const fallbackId = React.useId();
68
+ const { id = fallbackId, children, ...rest } = props;
69
+ const { setCaptionId } = React.useContext(TableContext);
70
+ const captionIdRef = React.useCallback(
71
+ (element) => {
72
+ setCaptionId(element ? id : void 0);
73
+ },
74
+ [id, setCaptionId]
75
+ );
76
+ return /* @__PURE__ */ jsx(
77
+ Role,
78
+ {
79
+ ...rest,
80
+ id,
81
+ className: cx("\u{1F95D}-table-caption", props.className),
82
+ ref: useMergedRefs(forwardedRef, captionIdRef),
83
+ children
84
+ }
85
+ );
86
+ }
87
+ );
88
+ const TableCell = forwardRef((props, forwardedRef) => {
89
+ const isWithinTableHeader = React.useContext(TableHeaderContext);
90
+ return /* @__PURE__ */ jsx(
91
+ Role.span,
92
+ {
93
+ ...props,
94
+ className: cx("\u{1F95D}-table-cell", props.className),
95
+ ref: forwardedRef,
96
+ role: isWithinTableHeader ? "columnheader" : "cell",
97
+ children: props.children
98
+ }
99
+ );
100
+ });
101
+ export {
102
+ TableBody as Body,
103
+ TableCaption as Caption,
104
+ TableCell as Cell,
105
+ TableHeader as Header,
106
+ Table as Root,
107
+ TableRow as Row
108
+ };
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
- import * as Ariakit from "@ariakit/react";
2
+ import * as AkTab from "@ariakit/react/tab";
3
3
  import { type FocusableProps, type BaseProps } from "./~utils.js";
4
- interface TabsProps extends Pick<Ariakit.TabProviderProps, "defaultSelectedId" | "selectedId" | "setSelectedId" | "selectOnMove" | "children"> {
4
+ interface TabsProps extends Pick<AkTab.TabProviderProps, "defaultSelectedId" | "selectedId" | "setSelectedId" | "selectOnMove" | "children"> {
5
5
  }
6
6
  /**
7
7
  * A set of tabs that can be used to switch between different views.
@@ -53,7 +53,7 @@ interface TabListProps extends BaseProps {
53
53
  * ```
54
54
  */
55
55
  declare const TabList: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
56
- interface TabProps extends FocusableProps<"button">, Pick<Ariakit.TabProps, "id"> {
56
+ interface TabProps extends FocusableProps<"button">, Pick<AkTab.TabProps, "id"> {
57
57
  }
58
58
  /**
59
59
  * An individual tab button that switches the selected tab panel when clicked.
@@ -67,7 +67,7 @@ interface TabProps extends FocusableProps<"button">, Pick<Ariakit.TabProps, "id"
67
67
  * ```
68
68
  */
69
69
  declare const Tab: React.ForwardRefExoticComponent<TabProps & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
70
- interface TabPanelProps extends BaseProps<"div">, Pick<Ariakit.TabPanelProps, "tabId" | "unmountOnHide"> {
70
+ interface TabPanelProps extends FocusableProps<"div">, Pick<AkTab.TabPanelProps, "tabId" | "unmountOnHide" | "focusable"> {
71
71
  }
72
72
  /**
73
73
  * The actual content of a tab, shown when the tab is selected. Should be used as a child of `Tabs.Root`.
@@ -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(
@@ -45,10 +45,10 @@ const TabList = forwardRef((props, forwardedRef) => {
45
45
  const { tone = "neutral", ...rest } = props;
46
46
  const viewTransitionName = `\u{1F95D}active-stripe-${React.useId().replaceAll(":", "_")}`;
47
47
  return /* @__PURE__ */ jsx(
48
- Ariakit.TabList,
48
+ AkTab.TabList,
49
49
  {
50
- "data-kiwi-tone": tone,
51
50
  ...rest,
51
+ "data-kiwi-tone": tone,
52
52
  className: cx("\u{1F95D}-tab-list", props.className),
53
53
  style: {
54
54
  "--\u{1F95D}tab-active-stripe-view-transition-name": viewTransitionName,
@@ -60,7 +60,7 @@ const TabList = forwardRef((props, forwardedRef) => {
60
60
  });
61
61
  const Tab = forwardRef((props, forwardedRef) => {
62
62
  return /* @__PURE__ */ jsx(
63
- Ariakit.Tab,
63
+ AkTab.Tab,
64
64
  {
65
65
  accessibleWhenDisabled: true,
66
66
  ...props,
@@ -71,7 +71,7 @@ const Tab = forwardRef((props, forwardedRef) => {
71
71
  });
72
72
  const TabPanel = forwardRef((props, forwardedRef) => {
73
73
  return /* @__PURE__ */ jsx(
74
- Ariakit.TabPanel,
74
+ AkTab.TabPanel,
75
75
  {
76
76
  ...props,
77
77
  className: cx("\u{1F95D}-tab-panel", props.className),
@@ -3,7 +3,7 @@ interface TextProps extends BaseProps {
3
3
  /**
4
4
  * The typography variant to use.
5
5
  */
6
- variant?: "display-lg" | "display-md" | "display-sm" | "headline-lg" | "headline-md" | "headline-sm" | "body-lg" | "body-md" | "body-sm" | "caption-lg" | "caption-md" | "caption-sm" | "mono-sm";
6
+ variant: "display-lg" | "display-md" | "display-sm" | "headline-lg" | "headline-md" | "headline-sm" | "body-lg" | "body-md" | "body-sm" | "caption-lg" | "caption-md" | "caption-sm" | "mono-sm";
7
7
  }
8
8
  /**
9
9
  * An element with text styles applied. Useful for paragraphs, headings, and other text content.
@@ -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),