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

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 (47) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/DEV/bricks/Avatar.js +24 -0
  3. package/dist/DEV/bricks/Badge.js +22 -0
  4. package/dist/DEV/bricks/Checkbox.js +1 -3
  5. package/dist/DEV/bricks/Description.js +13 -11
  6. package/dist/DEV/bricks/DropdownMenu.js +7 -2
  7. package/dist/DEV/bricks/Field.js +33 -56
  8. package/dist/DEV/bricks/Icon.js +5 -2
  9. package/dist/DEV/bricks/ListItem.js +14 -0
  10. package/dist/DEV/bricks/Radio.js +1 -3
  11. package/dist/DEV/bricks/Select.js +1 -3
  12. package/dist/DEV/bricks/Switch.js +1 -3
  13. package/dist/DEV/bricks/Table.js +114 -0
  14. package/dist/DEV/bricks/TextBox.js +1 -5
  15. package/dist/DEV/bricks/Tree.js +16 -10
  16. package/dist/DEV/bricks/index.js +4 -0
  17. package/dist/DEV/bricks/styles.css.js +1 -1
  18. package/dist/DEV/bricks/~hooks.js +9 -1
  19. package/dist/DEV/foundations/styles.css.js +1 -1
  20. package/dist/bricks/Avatar.d.ts +47 -0
  21. package/dist/bricks/Avatar.js +23 -0
  22. package/dist/bricks/Badge.d.ts +28 -0
  23. package/dist/bricks/Badge.js +21 -0
  24. package/dist/bricks/Checkbox.js +1 -3
  25. package/dist/bricks/Description.d.ts +1 -2
  26. package/dist/bricks/Description.js +13 -11
  27. package/dist/bricks/DropdownMenu.js +7 -2
  28. package/dist/bricks/Field.d.ts +4 -8
  29. package/dist/bricks/Field.js +33 -56
  30. package/dist/bricks/Icon.d.ts +28 -3
  31. package/dist/bricks/Icon.js +5 -2
  32. package/dist/bricks/ListItem.d.ts +5 -1
  33. package/dist/bricks/ListItem.js +13 -0
  34. package/dist/bricks/Radio.js +1 -3
  35. package/dist/bricks/Select.js +1 -3
  36. package/dist/bricks/Switch.js +1 -3
  37. package/dist/bricks/Table.d.ts +115 -0
  38. package/dist/bricks/Table.js +108 -0
  39. package/dist/bricks/TextBox.js +1 -5
  40. package/dist/bricks/Tree.js +16 -10
  41. package/dist/bricks/index.d.ts +2 -0
  42. package/dist/bricks/index.js +4 -0
  43. package/dist/bricks/styles.css.js +1 -1
  44. package/dist/bricks/~hooks.d.ts +9 -0
  45. package/dist/bricks/~hooks.js +9 -1
  46. package/dist/foundations/styles.css.js +1 -1
  47. package/package.json +4 -3
@@ -28,14 +28,6 @@ interface FieldProps extends BaseProps {
28
28
  * - `Switch`
29
29
  */
30
30
  export declare const Field: React.ForwardRefExoticComponent<FieldProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
31
- /**
32
- * Use the description IDs for a field.
33
- */
34
- export declare function useFieldDescribedBy(ariaDescribedByProp?: string): string | undefined;
35
- /**
36
- * Registers a description for an associated control.
37
- */
38
- export declare function useFieldRegisterDescribedBy(id: string): void;
39
31
  type CollectionStoreItem = NonNullable<ReturnType<ReturnType<typeof Ariakit.useCollectionStore>["item"]>>;
40
32
  interface FieldCollectionStoreItem extends CollectionStoreItem {
41
33
  /** The type of field element being tracked */
@@ -54,4 +46,8 @@ export declare function FieldControl(props: FieldCollectionItemControlProps): im
54
46
  * An element tracked as a label in the `Field`’s collection.
55
47
  */
56
48
  export declare function FieldLabel(props: Pick<Ariakit.CollectionItemProps, "render">): import("react/jsx-runtime").JSX.Element;
49
+ /**
50
+ * An element tracked as a description in the `Field`’s collection.
51
+ */
52
+ export declare function FieldDescription(props: Pick<Ariakit.CollectionItemProps, "render" | "id">): import("react/jsx-runtime").JSX.Element;
57
53
  export {};
@@ -5,7 +5,7 @@ import cx from "classnames";
5
5
  import { forwardRef } from "./~utils.js";
6
6
  const Field = forwardRef((props, forwardedRef) => {
7
7
  const { layout, ...rest } = props;
8
- return /* @__PURE__ */ jsx(FieldDescribedByProvider, { children: /* @__PURE__ */ jsx(
8
+ return /* @__PURE__ */ jsx(
9
9
  FieldCollection,
10
10
  {
11
11
  render: /* @__PURE__ */ jsx(
@@ -18,57 +18,8 @@ const Field = forwardRef((props, forwardedRef) => {
18
18
  }
19
19
  )
20
20
  }
21
- ) });
22
- });
23
- const FieldDescribedByContext = React.createContext(void 0);
24
- function FieldDescribedByProvider(props) {
25
- const [describedBy, setDescribedBy] = React.useState(/* @__PURE__ */ new Set());
26
- const register = React.useCallback((id) => {
27
- setDescribedBy((describedBy2) => {
28
- const updated = new Set(describedBy2);
29
- updated.add(id);
30
- return updated;
31
- });
32
- }, []);
33
- const unregister = React.useCallback((id) => {
34
- setDescribedBy((describedBy2) => {
35
- const updated = new Set(describedBy2);
36
- updated.delete(id);
37
- return updated;
38
- });
39
- }, []);
40
- return /* @__PURE__ */ jsx(
41
- FieldDescribedByContext.Provider,
42
- {
43
- value: React.useMemo(
44
- () => ({
45
- describedBy,
46
- register,
47
- unregister
48
- }),
49
- [describedBy, register, unregister]
50
- ),
51
- children: props.children
52
- }
53
- );
54
- }
55
- function useFieldDescribedBy(ariaDescribedByProp) {
56
- const describedBySet = React.useContext(FieldDescribedByContext)?.describedBy;
57
- return React.useMemo(
58
- () => !describedBySet || describedBySet.size === 0 ? ariaDescribedByProp : [...describedBySet, ariaDescribedByProp].filter(Boolean).join(" "),
59
- [describedBySet, ariaDescribedByProp]
60
21
  );
61
- }
62
- function useFieldRegisterDescribedBy(id) {
63
- const context = React.useContext(FieldDescribedByContext);
64
- const register = context?.register;
65
- const unregister = context?.unregister;
66
- React.useEffect(() => {
67
- if (!register || !unregister) return;
68
- register(id);
69
- return () => unregister(id);
70
- }, [id, register, unregister]);
71
- }
22
+ });
72
23
  function FieldCollection(props) {
73
24
  const fieldElementCollection = Ariakit.useCollectionStore({
74
25
  defaultItems: []
@@ -101,8 +52,16 @@ function FieldCollection(props) {
101
52
  );
102
53
  }
103
54
  function FieldControl(props) {
55
+ const store = Ariakit.useCollectionContext();
104
56
  const generatedId = React.useId();
105
- const { id = generatedId, type, ...rest } = props;
57
+ const { id = store ? generatedId : void 0, type, ...rest } = props;
58
+ const renderedItems = Ariakit.useStoreState(store, "renderedItems");
59
+ const describedBy = React.useMemo(() => {
60
+ const idRefList = renderedItems?.filter(
61
+ (item) => item.elementType === "description"
62
+ )?.map((item) => item.id).join(" ");
63
+ return idRefList || void 0;
64
+ }, [renderedItems]);
106
65
  const getData = React.useCallback(
107
66
  (data) => ({
108
67
  ...data,
@@ -111,7 +70,14 @@ function FieldControl(props) {
111
70
  }),
112
71
  [type]
113
72
  );
114
- return /* @__PURE__ */ jsx(Ariakit.CollectionItem, { ...rest, id, getItem: getData });
73
+ return /* @__PURE__ */ jsx(
74
+ Ariakit.CollectionItem,
75
+ {
76
+ id,
77
+ getItem: getData,
78
+ render: /* @__PURE__ */ jsx(Ariakit.Role, { ...rest, "aria-describedby": describedBy })
79
+ }
80
+ );
115
81
  }
116
82
  function FieldLabel(props) {
117
83
  const store = Ariakit.useCollectionContext();
@@ -137,10 +103,21 @@ function FieldLabel(props) {
137
103
  }
138
104
  );
139
105
  }
106
+ function FieldDescription(props) {
107
+ const generatedId = React.useId();
108
+ const { id = generatedId, ...rest } = props;
109
+ const getData = React.useCallback(
110
+ (data) => ({
111
+ ...data,
112
+ elementType: "description"
113
+ }),
114
+ []
115
+ );
116
+ return /* @__PURE__ */ jsx(Ariakit.CollectionItem, { ...rest, id, getItem: getData });
117
+ }
140
118
  export {
141
119
  Field,
142
120
  FieldControl,
143
- FieldLabel,
144
- useFieldDescribedBy,
145
- useFieldRegisterDescribedBy
121
+ FieldDescription,
122
+ FieldLabel
146
123
  };
@@ -1,10 +1,29 @@
1
1
  import * as React from "react";
2
2
  import { type BaseProps } from "./~utils.js";
3
3
  interface IconProps extends Omit<BaseProps<"svg">, "children"> {
4
- /** URL of the symbol sprite. */
4
+ /**
5
+ * URL of the symbol sprite.
6
+ *
7
+ * Should be a URL to an `.svg` file from `@itwin/itwinui-icons`.
8
+ */
5
9
  href?: string;
6
- /** Size of the icon. Defaults to `regular`. */
10
+ /**
11
+ * Size of the icon. This affects the icon's physical dimensions, as well as the
12
+ * actual SVG contents (different sizes might have different fidelity).
13
+ *
14
+ * Defaults to `"regular"` (16px) and can be optionally set to `"large"` (24px).
15
+ */
7
16
  size?: "regular" | "large";
17
+ /**
18
+ * Alternative text describing the icon.
19
+ *
20
+ * When this prop is passed, the SVG gets rendered as `role="img"` and labelled
21
+ * using the provided text.
22
+ *
23
+ * This prop is not required if the icon is purely decorative. By default, the icon
24
+ * will be hidden from the accessibility tree.
25
+ */
26
+ alt?: string;
8
27
  }
9
28
  /**
10
29
  * Icon component that provides fill and sizing to the SVGs from `@itwin/itwinui-icons`.
@@ -21,7 +40,13 @@ interface IconProps extends Omit<BaseProps<"svg">, "children"> {
21
40
  * <Icon render={<svg><path d="…" fill="currentColor" /></svg>} />
22
41
  * ```
23
42
  *
24
- * **Note**: This component is meant to be used with decorative icons, so it adds `aria-hidden` by default.
43
+ * By default, this component assumes that the icon is decorative, so it adds `aria-hidden` by default.
44
+ *
45
+ * If the icon is semantically meaningful, the `alt` prop can be used to provide alternative text.
46
+ *
47
+ * ```tsx
48
+ * <Icon href={…} alt="Help" />
49
+ * ```
25
50
  */
26
51
  export declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<HTMLElement | SVGSVGElement>>;
27
52
  interface DisclosureArrowProps extends Omit<BaseProps<"svg">, "children"> {
@@ -4,12 +4,15 @@ import cx from "classnames";
4
4
  import * as Ariakit from "@ariakit/react";
5
5
  import { forwardRef } from "./~utils.js";
6
6
  const Icon = forwardRef((props, forwardedRef) => {
7
- const { href, size = "regular", ...rest } = props;
7
+ const { href, size, alt, ...rest } = props;
8
8
  const iconId = toIconId(size);
9
+ const isDecorative = !alt;
9
10
  return /* @__PURE__ */ jsx(
10
11
  Ariakit.Role.svg,
11
12
  {
12
- "aria-hidden": true,
13
+ "aria-hidden": isDecorative ? "true" : void 0,
14
+ role: isDecorative ? void 0 : "img",
15
+ "aria-label": isDecorative ? void 0 : alt,
13
16
  ...rest,
14
17
  "data-kiwi-size": size,
15
18
  className: cx("\u{1F95D}-icon", props.className),
@@ -7,4 +7,8 @@ interface ListItemContentProps extends Ariakit.RoleProps<"span"> {
7
7
  }
8
8
  /** @internal */
9
9
  declare const ListItemContent: import("react").ForwardRefExoticComponent<Omit<ListItemContentProps, "ref"> & import("react").RefAttributes<HTMLElement | HTMLSpanElement>>;
10
- export { ListItem as Root, ListItemContent as Content };
10
+ interface ListItemDecorationProps extends Ariakit.RoleProps<"span"> {
11
+ }
12
+ /** @internal */
13
+ declare const ListItemDecoration: import("react").ForwardRefExoticComponent<Omit<ListItemDecorationProps, "ref"> & import("react").RefAttributes<HTMLElement | HTMLSpanElement>>;
14
+ export { ListItem as Root, ListItemContent as Content, ListItemDecoration as Decoration, };
@@ -25,7 +25,20 @@ const ListItemContent = forwardRef(
25
25
  );
26
26
  }
27
27
  );
28
+ const ListItemDecoration = forwardRef(
29
+ (props, forwardedRef) => {
30
+ return /* @__PURE__ */ jsx(
31
+ Ariakit.Role.span,
32
+ {
33
+ ...props,
34
+ className: cx("\u{1F95D}-list-item-decoration", props.className),
35
+ ref: forwardedRef
36
+ }
37
+ );
38
+ }
39
+ );
28
40
  export {
29
41
  ListItemContent as Content,
42
+ ListItemDecoration as Decoration,
30
43
  ListItem as Root
31
44
  };
@@ -1,11 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
3
  import * as Ariakit from "@ariakit/react";
4
- import { FieldControl, useFieldDescribedBy } from "./Field.js";
4
+ import { FieldControl } from "./Field.js";
5
5
  import { forwardRef } from "./~utils.js";
6
6
  const Radio = forwardRef((props, forwardedRef) => {
7
7
  const { id, ...rest } = props;
8
- const describedBy = useFieldDescribedBy(props["aria-describedby"]);
9
8
  return /* @__PURE__ */ jsx(
10
9
  FieldControl,
11
10
  {
@@ -17,7 +16,6 @@ const Radio = forwardRef((props, forwardedRef) => {
17
16
  accessibleWhenDisabled: true,
18
17
  ...rest,
19
18
  className: cx("\u{1F95D}-checkbox", "\u{1F95D}-radio", props.className),
20
- "aria-describedby": describedBy,
21
19
  ref: forwardedRef
22
20
  }
23
21
  )
@@ -7,7 +7,7 @@ import {
7
7
  isBrowser
8
8
  } from "./~utils.js";
9
9
  import { DisclosureArrow } from "./Icon.js";
10
- import { FieldControl, useFieldDescribedBy } 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
  });
@@ -27,7 +27,6 @@ const HtmlSelect = forwardRef(
27
27
  (props, forwardedRef) => {
28
28
  const { id, variant = "solid", ...rest } = props;
29
29
  const setIsHtmlSelect = React.useContext(HtmlSelectContext);
30
- const describedBy = useFieldDescribedBy(props["aria-describedby"]);
31
30
  React.useEffect(
32
31
  function updateContext() {
33
32
  setIsHtmlSelect(true);
@@ -45,7 +44,6 @@ const HtmlSelect = forwardRef(
45
44
  {
46
45
  ...rest,
47
46
  className: cx("\u{1F95D}-button", "\u{1F95D}-select", props.className),
48
- "aria-describedby": describedBy,
49
47
  "data-kiwi-tone": "neutral",
50
48
  "data-kiwi-variant": variant,
51
49
  ref: forwardedRef
@@ -1,12 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
3
  import * as Ariakit from "@ariakit/react";
4
- import { FieldControl, useFieldDescribedBy } from "./Field.js";
4
+ import { FieldControl } from "./Field.js";
5
5
  import { forwardRef } from "./~utils.js";
6
6
  const Switch = forwardRef(
7
7
  (props, forwardedRef) => {
8
8
  const { id, ...rest } = props;
9
- const describedBy = useFieldDescribedBy(props["aria-describedby"]);
10
9
  return /* @__PURE__ */ jsx(
11
10
  FieldControl,
12
11
  {
@@ -18,7 +17,6 @@ const Switch = forwardRef(
18
17
  accessibleWhenDisabled: true,
19
18
  ...rest,
20
19
  className: cx("\u{1F95D}-switch", props.className),
21
- "aria-describedby": describedBy,
22
20
  role: "switch",
23
21
  ref: forwardedRef
24
22
  }
@@ -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 * as Ariakit from "@ariakit/react";
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
+ Ariakit.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
+ Ariakit.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
+ Ariakit.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
+ Ariakit.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
+ Ariakit.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
+ Ariakit.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
+ };
@@ -2,14 +2,13 @@ import { jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import * as Ariakit from "@ariakit/react";
4
4
  import cx from "classnames";
5
- import { FieldControl, useFieldDescribedBy } from "./Field.js";
5
+ import { FieldControl } from "./Field.js";
6
6
  import { Icon } from "./Icon.js";
7
7
  import { useMergedRefs } from "./~hooks.js";
8
8
  import { forwardRef } from "./~utils.js";
9
9
  const TextBoxInput = forwardRef(
10
10
  (props, forwardedRef) => {
11
11
  const { id, ...rest } = props;
12
- const describedBy = useFieldDescribedBy(props["aria-describedby"]);
13
12
  const rootContext = React.useContext(TextBoxRootContext);
14
13
  const setDisabled = rootContext?.setDisabled;
15
14
  React.useEffect(() => {
@@ -25,7 +24,6 @@ const TextBoxInput = forwardRef(
25
24
  {
26
25
  readOnly: props.disabled,
27
26
  ...rest,
28
- "aria-describedby": describedBy,
29
27
  className: cx({ "\u{1F95D}-text-box": !rootContext }, props.className),
30
28
  placeholder: props.placeholder ?? " ",
31
29
  render: /* @__PURE__ */ jsx(
@@ -45,7 +43,6 @@ const TextBoxInput = forwardRef(
45
43
  const TextBoxTextarea = forwardRef(
46
44
  (props, forwardedRef) => {
47
45
  const { id, ...rest } = props;
48
- const describedBy = useFieldDescribedBy(props["aria-describedby"]);
49
46
  return /* @__PURE__ */ jsx(
50
47
  FieldControl,
51
48
  {
@@ -57,7 +54,6 @@ const TextBoxTextarea = forwardRef(
57
54
  readOnly: props.disabled,
58
55
  ...rest,
59
56
  className: cx("\u{1F95D}-text-box", props.className),
60
- "aria-describedby": describedBy,
61
57
  placeholder: props.placeholder ?? " ",
62
58
  render: /* @__PURE__ */ jsx(
63
59
  Ariakit.Focusable,
@@ -30,7 +30,6 @@ const TreeItem = forwardRef((props, forwardedRef) => {
30
30
  icon,
31
31
  label,
32
32
  actions,
33
- style,
34
33
  onSelectedChange,
35
34
  onExpandedChange,
36
35
  onClick: onClickProp,
@@ -93,18 +92,25 @@ const TreeItem = forwardRef((props, forwardedRef) => {
93
92
  style: { "--\u{1F95D}tree-item-level": level },
94
93
  role: void 0,
95
94
  children: [
95
+ /* @__PURE__ */ jsxs(ListItem.Decoration, { children: [
96
+ /* @__PURE__ */ jsx(
97
+ TreeItemExpander,
98
+ {
99
+ onClick: () => {
100
+ if (expanded === void 0) return;
101
+ onExpandedChange?.(!expanded);
102
+ }
103
+ }
104
+ ),
105
+ typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : icon
106
+ ] }),
107
+ /* @__PURE__ */ jsx(TreeItemContent, { label }),
96
108
  /* @__PURE__ */ jsx(
97
- TreeItemExpander,
109
+ ListItem.Decoration,
98
110
  {
99
- onClick: () => {
100
- if (expanded === void 0) return;
101
- onExpandedChange?.(!expanded);
102
- }
111
+ render: /* @__PURE__ */ jsx(TreeItemActions, { children: actions })
103
112
  }
104
- ),
105
- typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : icon,
106
- /* @__PURE__ */ jsx(TreeItemContent, { label }),
107
- /* @__PURE__ */ jsx(TreeItemActions, { children: actions })
113
+ )
108
114
  ]
109
115
  }
110
116
  )
@@ -1,5 +1,7 @@
1
1
  export { Root } from "./Root.js";
2
2
  export { Anchor } from "./Anchor.js";
3
+ export { Avatar } from "./Avatar.js";
4
+ export { Badge } from "./Badge.js";
3
5
  export { Button } from "./Button.js";
4
6
  export { Checkbox } from "./Checkbox.js";
5
7
  export { Chip } from "./Chip.js";
@@ -1,6 +1,8 @@
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";
6
8
  import { Chip } from "./Chip.js";
@@ -24,6 +26,8 @@ import { Tooltip } from "./Tooltip.js";
24
26
  import { VisuallyHidden } from "./VisuallyHidden.js";
25
27
  export {
26
28
  Anchor,
29
+ Avatar,
30
+ Badge,
27
31
  Button,
28
32
  Checkbox,
29
33
  Chip,