@itwin/itwinui-react 5.0.0-alpha.0 → 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 (118) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +6 -6
  3. package/dist/DEV/bricks/Anchor.js +16 -23
  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 +25 -16
  7. package/dist/DEV/bricks/Checkbox.js +26 -16
  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 +16 -17
  11. package/dist/DEV/bricks/DropdownMenu.js +143 -48
  12. package/dist/DEV/bricks/Field.js +120 -20
  13. package/dist/DEV/bricks/Icon.js +108 -45
  14. package/dist/DEV/bricks/IconButton.js +31 -18
  15. package/dist/DEV/bricks/Kbd.internal.js +19 -0
  16. package/dist/DEV/bricks/Kbd.js +32 -17
  17. package/dist/DEV/bricks/Label.js +13 -10
  18. package/dist/DEV/bricks/ProgressBar.js +25 -0
  19. package/dist/DEV/bricks/Radio.js +19 -11
  20. package/dist/DEV/bricks/Root.js +78 -45
  21. package/dist/DEV/bricks/Select.js +61 -0
  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 +27 -17
  25. package/dist/DEV/bricks/Table.js +114 -0
  26. package/dist/DEV/bricks/Tabs.js +19 -20
  27. package/dist/DEV/bricks/Text.js +20 -0
  28. package/dist/DEV/bricks/TextBox.js +95 -50
  29. package/dist/DEV/bricks/Tooltip.js +58 -58
  30. package/dist/DEV/bricks/Tree.js +16 -102
  31. package/dist/DEV/bricks/TreeItem.js +224 -0
  32. package/dist/DEV/bricks/VisuallyHidden.js +7 -5
  33. package/dist/DEV/bricks/index.js +20 -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/~utils.ListItem.js +49 -0
  38. package/dist/DEV/bricks/~utils.js +3 -0
  39. package/dist/DEV/foundations/styles.css.js +2 -2
  40. package/dist/bricks/Anchor.d.ts +12 -3
  41. package/dist/bricks/Anchor.js +16 -23
  42. package/dist/bricks/Avatar.d.ts +47 -0
  43. package/dist/bricks/Avatar.js +23 -0
  44. package/dist/bricks/Badge.d.ts +28 -0
  45. package/dist/bricks/Badge.js +21 -0
  46. package/dist/bricks/Button.d.ts +27 -4
  47. package/dist/bricks/Button.js +25 -16
  48. package/dist/bricks/Checkbox.d.ts +19 -5
  49. package/dist/bricks/Checkbox.js +26 -16
  50. package/dist/bricks/Chip.d.ts +31 -0
  51. package/dist/bricks/Chip.js +41 -0
  52. package/dist/bricks/Description.d.ts +19 -0
  53. package/dist/bricks/Description.js +29 -0
  54. package/dist/bricks/Divider.d.ts +5 -6
  55. package/dist/bricks/Divider.js +16 -17
  56. package/dist/bricks/DropdownMenu.d.ts +92 -15
  57. package/dist/bricks/DropdownMenu.js +138 -46
  58. package/dist/bricks/Field.d.ts +45 -3
  59. package/dist/bricks/Field.js +120 -20
  60. package/dist/bricks/Icon.d.ts +38 -7
  61. package/dist/bricks/Icon.js +105 -44
  62. package/dist/bricks/IconButton.d.ts +20 -4
  63. package/dist/bricks/IconButton.js +31 -18
  64. package/dist/bricks/Kbd.d.ts +17 -3
  65. package/dist/bricks/Kbd.internal.d.ts +17 -0
  66. package/dist/bricks/Kbd.internal.js +19 -0
  67. package/dist/bricks/Kbd.js +25 -17
  68. package/dist/bricks/Label.d.ts +22 -3
  69. package/dist/bricks/Label.js +13 -10
  70. package/dist/bricks/ProgressBar.d.ts +31 -0
  71. package/dist/bricks/ProgressBar.js +24 -0
  72. package/dist/bricks/Radio.d.ts +19 -5
  73. package/dist/bricks/Radio.js +19 -11
  74. package/dist/bricks/Root.d.ts +11 -2
  75. package/dist/bricks/Root.js +78 -45
  76. package/dist/bricks/Select.d.ts +51 -0
  77. package/dist/bricks/Select.js +61 -0
  78. package/dist/bricks/Skeleton.d.ts +25 -0
  79. package/dist/bricks/Skeleton.js +23 -0
  80. package/dist/bricks/Spinner.d.ts +31 -0
  81. package/dist/bricks/Spinner.js +39 -0
  82. package/dist/bricks/Switch.d.ts +19 -5
  83. package/dist/bricks/Switch.js +27 -17
  84. package/dist/bricks/Table.d.ts +115 -0
  85. package/dist/bricks/Table.js +108 -0
  86. package/dist/bricks/Tabs.d.ts +69 -8
  87. package/dist/bricks/Tabs.js +19 -20
  88. package/dist/bricks/Text.d.ts +22 -0
  89. package/dist/bricks/Text.js +19 -0
  90. package/dist/bricks/TextBox.d.ts +62 -11
  91. package/dist/bricks/TextBox.js +94 -50
  92. package/dist/bricks/Tooltip.d.ts +13 -6
  93. package/dist/bricks/Tooltip.js +58 -58
  94. package/dist/bricks/Tree.d.ts +20 -21
  95. package/dist/bricks/Tree.js +15 -97
  96. package/dist/bricks/TreeItem.d.ts +123 -0
  97. package/dist/bricks/TreeItem.js +219 -0
  98. package/dist/bricks/VisuallyHidden.d.ts +15 -3
  99. package/dist/bricks/VisuallyHidden.js +7 -5
  100. package/dist/bricks/index.d.ts +10 -0
  101. package/dist/bricks/index.js +20 -0
  102. package/dist/bricks/styles.css.js +2 -2
  103. package/dist/bricks/~hooks.d.ts +55 -0
  104. package/dist/bricks/~hooks.js +55 -3
  105. package/dist/bricks/~utils.GhostAligner.d.ts +22 -0
  106. package/dist/bricks/~utils.GhostAligner.js +13 -0
  107. package/dist/bricks/~utils.ListItem.d.ts +14 -0
  108. package/dist/bricks/~utils.ListItem.js +46 -0
  109. package/dist/bricks/~utils.d.ts +26 -3
  110. package/dist/bricks/~utils.js +3 -0
  111. package/dist/foundations/styles.css.js +2 -2
  112. package/package.json +14 -13
  113. package/dist/DEV/bricks/ListItem.js +0 -33
  114. package/dist/DEV/bricks/Textarea.js +0 -28
  115. package/dist/bricks/ListItem.d.ts +0 -11
  116. package/dist/bricks/ListItem.js +0 -31
  117. package/dist/bricks/Textarea.d.ts +0 -14
  118. package/dist/bricks/Textarea.js +0 -27
@@ -0,0 +1,61 @@
1
+ import { Fragment, 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
+ forwardRef,
7
+ isBrowser
8
+ } from "./~utils.js";
9
+ import { DisclosureArrow } from "./Icon.js";
10
+ import { FieldControl } from "./Field.js";
11
+ const supportsHas = isBrowser && CSS?.supports?.("selector(:has(+ *))");
12
+ const HtmlSelectContext = React.createContext(() => {
13
+ });
14
+ const SelectRoot = forwardRef((props, forwardedRef) => {
15
+ const [isHtmlSelect, setIsHtmlSelect] = React.useState(false);
16
+ return /* @__PURE__ */ jsx(HtmlSelectContext.Provider, { value: setIsHtmlSelect, children: /* @__PURE__ */ jsx(
17
+ Role.div,
18
+ {
19
+ ...props,
20
+ className: cx("\u{1F95D}-select-root", props.className),
21
+ "data-kiwi-has-select": !supportsHas && isHtmlSelect ? "true" : void 0,
22
+ ref: forwardedRef
23
+ }
24
+ ) });
25
+ });
26
+ const HtmlSelect = forwardRef(
27
+ (props, forwardedRef) => {
28
+ const { id, variant = "solid", ...rest } = props;
29
+ const setIsHtmlSelect = React.useContext(HtmlSelectContext);
30
+ React.useEffect(
31
+ function updateContext() {
32
+ setIsHtmlSelect(true);
33
+ },
34
+ [setIsHtmlSelect]
35
+ );
36
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
37
+ /* @__PURE__ */ jsx(
38
+ FieldControl,
39
+ {
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
+ )
52
+ }
53
+ ),
54
+ /* @__PURE__ */ jsx(DisclosureArrow, { className: "\u{1F95D}-select-arrow" })
55
+ ] });
56
+ }
57
+ );
58
+ export {
59
+ HtmlSelect,
60
+ SelectRoot as Root
61
+ };
@@ -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,13 +1,27 @@
1
- import * as React from "react";
2
- import * as Ariakit from "@ariakit/react";
3
- import type { FocusableProps } from "./~utils.js";
1
+ import { type CheckboxProps as AkCheckboxProps } from "@ariakit/react/checkbox";
2
+ import { type FocusableProps } from "./~utils.js";
4
3
  type InputBaseProps = Omit<FocusableProps<"input">, "defaultValue" | "value">;
5
- type CheckboxOwnProps = Pick<Ariakit.CheckboxProps, "value" | "defaultChecked" | "checked" | "onChange">;
4
+ type CheckboxOwnProps = Pick<AkCheckboxProps, "value" | "defaultChecked" | "checked" | "onChange">;
6
5
  interface SwitchProps extends InputBaseProps, CheckboxOwnProps {
7
6
  /** The default checked state of the toggle switch. */
8
7
  defaultChecked?: boolean;
9
8
  /** The controlled checked state of the toggle switch. */
10
9
  checked?: boolean;
11
10
  }
12
- export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
11
+ /**
12
+ * A toggle switch element, typically used for enabling or disabling a feature.
13
+ *
14
+ * Works well with the `Field` and `Label` components.
15
+ *
16
+ * ```tsx
17
+ * <Field>
18
+ * <Label>Enable feature</Label>
19
+ * <Switch />
20
+ * </Field>
21
+ * ```
22
+ *
23
+ * Underneath, it's an HTML checkbox, i.e. `<input type="checkbox">`, so it supports the same props,
24
+ * including `value`, `defaultChecked`, `checked`, and `onChange`.
25
+ */
26
+ export declare const Switch: import("react").ForwardRefExoticComponent<SwitchProps & import("react").RefAttributes<HTMLElement | HTMLInputElement>>;
13
27
  export {};
@@ -1,22 +1,32 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import * as React from "react";
3
2
  import cx from "classnames";
4
- import * as Ariakit from "@ariakit/react";
5
- import { useFieldId } from "./Field.js";
6
- const Switch = React.forwardRef((props, forwardedRef) => {
7
- const fieldId = useFieldId();
8
- return /* @__PURE__ */ jsx(
9
- Ariakit.Checkbox,
10
- {
11
- accessibleWhenDisabled: true,
12
- id: fieldId,
13
- ...props,
14
- className: cx("\u{1F95D}-switch", props.className),
15
- role: "switch",
16
- ref: forwardedRef
17
- }
18
- );
19
- });
3
+ import {
4
+ Checkbox as AkCheckbox
5
+ } from "@ariakit/react/checkbox";
6
+ import { FieldControl } from "./Field.js";
7
+ import { forwardRef } from "./~utils.js";
8
+ const Switch = forwardRef(
9
+ (props, forwardedRef) => {
10
+ const { id, ...rest } = props;
11
+ return /* @__PURE__ */ jsx(
12
+ FieldControl,
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
+ )
26
+ }
27
+ );
28
+ }
29
+ );
20
30
  export {
21
31
  Switch
22
32
  };
@@ -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,8 +1,36 @@
1
1
  import * as React from "react";
2
- import * as Ariakit from "@ariakit/react";
3
- import type { FocusableProps, BaseProps } from "./~utils.js";
4
- interface TabsProps extends Pick<Ariakit.TabProviderProps, "defaultSelectedId" | "selectedId" | "setSelectedId" | "selectOnMove" | "children"> {
2
+ import * as AkTab from "@ariakit/react/tab";
3
+ import { type FocusableProps, type BaseProps } from "./~utils.js";
4
+ interface TabsProps extends Pick<AkTab.TabProviderProps, "defaultSelectedId" | "selectedId" | "setSelectedId" | "selectOnMove" | "children"> {
5
5
  }
6
+ /**
7
+ * A set of tabs that can be used to switch between different views.
8
+ *
9
+ * `Tabs` is a compound component with subcomponents exposed for different parts.
10
+ *
11
+ * Example:
12
+ * ```tsx
13
+ * <Tabs.Root>
14
+ * <Tabs.TabList>
15
+ * <Tabs.Tab id="tab-1">Tab 1</Tabs.Tab>
16
+ * <Tabs.Tab id="tab-2">Tab 2</Tabs.Tab>
17
+ * <Tabs.Tab id="tab-3">Tab 3</Tabs.Tab>
18
+ * </Tabs.TabList>
19
+ *
20
+ * <Tabs.TabPanel tabId="tab-1">Tab 1 content</Tabs.TabPanel>
21
+ * <Tabs.TabPanel tabId="tab-2">Tab 2 content</Tabs.TabPanel>
22
+ * <Tabs.TabPanel tabId="tab-3">Tab 3 content</Tabs.TabPanel>
23
+ * </Tabs.Root>
24
+ * ```
25
+ *
26
+ * The tabs and their panels are connected by matching the `id` prop on the `Tabs.Tab` component with
27
+ * the `tabId` prop on the `Tabs.TabPanel` component.
28
+ *
29
+ * The `Tabs` component automatically manages the selected tab state. The initially selected tab can be set using `defaultSelectedId`.
30
+ * To take full control the selected tab state, use the `selectedId` and `setSelectedId` props together.
31
+ *
32
+ * **Note**: `Tabs` should _not_ be used for navigation; it is only intended for switching smaller views within an existing page.
33
+ */
6
34
  declare function Tabs(props: TabsProps): import("react/jsx-runtime").JSX.Element;
7
35
  declare namespace Tabs {
8
36
  var displayName: string;
@@ -11,11 +39,44 @@ interface TabListProps extends BaseProps {
11
39
  /** @default "neutral" */
12
40
  tone?: "neutral" | "accent";
13
41
  }
14
- declare const TabList: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<HTMLDivElement>>;
15
- interface TabProps extends FocusableProps<"button">, Pick<Ariakit.TabProps, "id"> {
42
+ /**
43
+ * A simple container for the tab buttons.
44
+ * Should be used as a child of `Tabs.Root` and consist of the individual `Tabs.Tab` components.
45
+ *
46
+ * Example:
47
+ * ```tsx
48
+ * <Tabs.TabList>
49
+ * <Tabs.Tab id="tab-1">Tab 1</Tabs.Tab>
50
+ * <Tabs.Tab id="tab-2">Tab 2</Tabs.Tab>
51
+ * <Tabs.Tab id="tab-3">Tab 3</Tabs.Tab>
52
+ * </Tabs.TabList>
53
+ * ```
54
+ */
55
+ declare const TabList: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
56
+ interface TabProps extends FocusableProps<"button">, Pick<AkTab.TabProps, "id"> {
16
57
  }
17
- declare const Tab: React.ForwardRefExoticComponent<TabProps & React.RefAttributes<HTMLButtonElement>>;
18
- interface TabPanelProps extends BaseProps<"div">, Pick<Ariakit.TabPanelProps, "tabId" | "unmountOnHide"> {
58
+ /**
59
+ * An individual tab button that switches the selected tab panel when clicked.
60
+ *
61
+ * Should be used as a child of `Tabs.TabList` and be paired with a `Tabs.TabPanel`,
62
+ * connected using an id.
63
+ *
64
+ * Example:
65
+ * ```tsx
66
+ * <Tabs.Tab id="tab-1">Tab 1</Tabs.Tab>
67
+ * ```
68
+ */
69
+ declare const Tab: React.ForwardRefExoticComponent<TabProps & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
70
+ interface TabPanelProps extends FocusableProps<"div">, Pick<AkTab.TabPanelProps, "tabId" | "unmountOnHide" | "focusable"> {
19
71
  }
20
- declare const TabPanel: React.ForwardRefExoticComponent<TabPanelProps & React.RefAttributes<HTMLDivElement>>;
72
+ /**
73
+ * The actual content of a tab, shown when the tab is selected. Should be used as a child of `Tabs.Root`.
74
+ * The `tabId` prop should match the `id` prop of the corresponding `Tabs.Tab` component.
75
+ *
76
+ * Example:
77
+ * ```tsx
78
+ * <Tabs.TabPanel tabId="tab-1">Tab 1 content</Tabs.TabPanel>
79
+ * ```
80
+ */
81
+ declare const TabPanel: React.ForwardRefExoticComponent<TabPanelProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
21
82
  export { Tabs as Root, TabList, Tab, TabPanel };
@@ -2,8 +2,9 @@ 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
+ import { forwardRef } from "./~utils.js";
7
8
  function Tabs(props) {
8
9
  const {
9
10
  defaultSelectedId,
@@ -18,7 +19,7 @@ function Tabs(props) {
18
19
  setSelectedIdProp
19
20
  );
20
21
  return /* @__PURE__ */ jsx(
21
- Ariakit.TabProvider,
22
+ AkTab.TabProvider,
22
23
  {
23
24
  selectedId,
24
25
  setSelectedId: React.useCallback(
@@ -40,14 +41,14 @@ function Tabs(props) {
40
41
  }
41
42
  );
42
43
  }
43
- const TabList = React.forwardRef((props, forwardedRef) => {
44
+ const TabList = forwardRef((props, forwardedRef) => {
44
45
  const { tone = "neutral", ...rest } = props;
45
46
  const viewTransitionName = `\u{1F95D}active-stripe-${React.useId().replaceAll(":", "_")}`;
46
47
  return /* @__PURE__ */ jsx(
47
- Ariakit.TabList,
48
+ AkTab.TabList,
48
49
  {
49
- "data-kiwi-tone": tone,
50
50
  ...rest,
51
+ "data-kiwi-tone": tone,
51
52
  className: cx("\u{1F95D}-tab-list", props.className),
52
53
  style: {
53
54
  "--\u{1F95D}tab-active-stripe-view-transition-name": viewTransitionName,
@@ -57,22 +58,20 @@ const TabList = React.forwardRef((props, forwardedRef) => {
57
58
  }
58
59
  );
59
60
  });
60
- const Tab = React.forwardRef(
61
- (props, forwardedRef) => {
62
- return /* @__PURE__ */ jsx(
63
- Ariakit.Tab,
64
- {
65
- accessibleWhenDisabled: true,
66
- ...props,
67
- className: cx("\u{1F95D}-tab", props.className),
68
- ref: forwardedRef
69
- }
70
- );
71
- }
72
- );
73
- const TabPanel = React.forwardRef((props, forwardedRef) => {
61
+ const Tab = forwardRef((props, forwardedRef) => {
62
+ return /* @__PURE__ */ jsx(
63
+ AkTab.Tab,
64
+ {
65
+ accessibleWhenDisabled: true,
66
+ ...props,
67
+ className: cx("\u{1F95D}-tab", props.className),
68
+ ref: forwardedRef
69
+ }
70
+ );
71
+ });
72
+ const TabPanel = forwardRef((props, forwardedRef) => {
74
73
  return /* @__PURE__ */ jsx(
75
- Ariakit.TabPanel,
74
+ AkTab.TabPanel,
76
75
  {
77
76
  ...props,
78
77
  className: cx("\u{1F95D}-tab-panel", props.className),
@@ -0,0 +1,22 @@
1
+ import { type BaseProps } from "./~utils.js";
2
+ interface TextProps extends BaseProps {
3
+ /**
4
+ * The typography variant to use.
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";
7
+ }
8
+ /**
9
+ * An element with text styles applied. Useful for paragraphs, headings, and other text content.
10
+ *
11
+ * Example usage:
12
+ * ```tsx
13
+ * <Text variant="display-sm">Hello, World!</Text>
14
+ * ```
15
+ *
16
+ * Use the `render` prop to change the underlying element (defaults to a `<div>`):
17
+ * ```tsx
18
+ * <Text render={<h1 />} variant="headline-lg">Hello, World!</Text>
19
+ * ```
20
+ */
21
+ export declare const Text: import("react").ForwardRefExoticComponent<TextProps & import("react").RefAttributes<HTMLElement | HTMLDivElement>>;
22
+ export {};