@itwin/itwinui-react 5.0.0-alpha.4 → 5.0.0-alpha.6

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.
@@ -1,23 +1,25 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import * as React from "react";
3
2
  import { forwardRef } from "./~utils.js";
4
3
  import cx from "classnames";
5
4
  import { Text } from "./Text.js";
6
- import { useFieldRegisterDescribedBy } from "./Field.js";
5
+ import { FieldDescription } from "./Field.js";
7
6
  const Description = forwardRef(
8
7
  (props, forwardedRef) => {
9
- const generatedId = React.useId();
10
- const { id = generatedId, tone, ...rest } = props;
11
- useFieldRegisterDescribedBy(id);
8
+ const { id, tone, ...rest } = props;
12
9
  return /* @__PURE__ */ jsx(
13
- Text,
10
+ FieldDescription,
14
11
  {
15
- ...rest,
16
12
  id,
17
- variant: "caption-md",
18
- "data-kiwi-tone": tone ?? "neutral",
19
- className: cx("\u{1F95D}-description", props.className),
20
- ref: forwardedRef
13
+ render: /* @__PURE__ */ jsx(
14
+ Text,
15
+ {
16
+ ...rest,
17
+ variant: "caption-md",
18
+ "data-kiwi-tone": tone ?? "neutral",
19
+ className: cx("\u{1F95D}-description", props.className),
20
+ ref: forwardedRef
21
+ }
22
+ )
21
23
  }
22
24
  );
23
25
  }
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import * as Ariakit from "@ariakit/react";
2
3
  import { type BaseProps } from "./~utils.js";
3
4
  interface FieldProps extends BaseProps {
4
5
  /**
@@ -27,13 +28,26 @@ interface FieldProps extends BaseProps {
27
28
  * - `Switch`
28
29
  */
29
30
  export declare const Field: React.ForwardRefExoticComponent<FieldProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
31
+ type CollectionStoreItem = NonNullable<ReturnType<ReturnType<typeof Ariakit.useCollectionStore>["item"]>>;
32
+ interface FieldCollectionStoreItem extends CollectionStoreItem {
33
+ /** The type of field element being tracked */
34
+ elementType: "label" | "control" | "description";
35
+ /** If a control, the type of control. */
36
+ controlType?: "textlike" | "checkable";
37
+ }
38
+ interface FieldCollectionItemControlProps extends Pick<Ariakit.CollectionItemProps, "render" | "id"> {
39
+ type: FieldCollectionStoreItem["controlType"];
40
+ }
41
+ /**
42
+ * An element tracked as a control in the `Field`’s collection.
43
+ */
44
+ export declare function FieldControl(props: FieldCollectionItemControlProps): import("react/jsx-runtime").JSX.Element;
30
45
  /**
31
- * Use the description IDs for a field.
46
+ * An element tracked as a label in the `Field`’s collection.
32
47
  */
33
- export declare function useFieldDescribedBy(ariaDescribedByProp?: string): string | undefined;
48
+ export declare function FieldLabel(props: Pick<Ariakit.CollectionItemProps, "render">): import("react/jsx-runtime").JSX.Element;
34
49
  /**
35
- * Registers a description for an associated control.
50
+ * An element tracked as a description in the `Field`’s collection.
36
51
  */
37
- export declare function useFieldRegisterDescribedBy(id: string): void;
38
- export declare function useFieldId(): string | undefined;
52
+ export declare function FieldDescription(props: Pick<Ariakit.CollectionItemProps, "render" | "id">): import("react/jsx-runtime").JSX.Element;
39
53
  export {};
@@ -4,74 +4,120 @@ import * as Ariakit from "@ariakit/react";
4
4
  import cx from "classnames";
5
5
  import { forwardRef } from "./~utils.js";
6
6
  const Field = forwardRef((props, forwardedRef) => {
7
- const fieldId = React.useId();
8
7
  const { layout, ...rest } = props;
9
- return /* @__PURE__ */ jsx(FieldIdContext.Provider, { value: fieldId, children: /* @__PURE__ */ jsx(FieldDescribedByProvider, { children: /* @__PURE__ */ jsx(
10
- Ariakit.Role,
8
+ return /* @__PURE__ */ jsx(
9
+ FieldCollection,
11
10
  {
12
- ...rest,
13
- className: cx("\u{1F95D}-field", props.className),
14
- "data-kiwi-layout": layout,
15
- ref: forwardedRef
11
+ render: /* @__PURE__ */ jsx(
12
+ Ariakit.Role.div,
13
+ {
14
+ ...rest,
15
+ className: cx("\u{1F95D}-field", props.className),
16
+ "data-kiwi-layout": layout,
17
+ ref: forwardedRef
18
+ }
19
+ )
16
20
  }
17
- ) }) });
21
+ );
18
22
  });
19
- const FieldDescribedByContext = React.createContext(void 0);
20
- function FieldDescribedByProvider(props) {
21
- const [describedBy, setDescribedBy] = React.useState(/* @__PURE__ */ new Set());
22
- const register = React.useCallback((id) => {
23
- setDescribedBy((describedBy2) => {
24
- const updated = new Set(describedBy2);
25
- updated.add(id);
26
- return updated;
27
- });
28
- }, []);
29
- const unregister = React.useCallback((id) => {
30
- setDescribedBy((describedBy2) => {
31
- const updated = new Set(describedBy2);
32
- updated.delete(id);
33
- return updated;
34
- });
35
- }, []);
23
+ function FieldCollection(props) {
24
+ const fieldElementCollection = Ariakit.useCollectionStore({
25
+ defaultItems: []
26
+ });
27
+ const renderedItems = Ariakit.useStoreState(
28
+ fieldElementCollection,
29
+ "renderedItems"
30
+ );
31
+ const [controlType, controlIndex] = React.useMemo(() => {
32
+ const controlIndex2 = renderedItems.findIndex(
33
+ (item) => item.elementType === "control"
34
+ );
35
+ return [renderedItems[controlIndex2]?.controlType, controlIndex2];
36
+ }, [renderedItems]);
37
+ const labelPlacement = React.useMemo(() => {
38
+ const labelIndex = renderedItems.findIndex(
39
+ (item) => item.elementType === "label"
40
+ );
41
+ if (controlIndex === -1 || labelIndex === -1) return;
42
+ return labelIndex < controlIndex ? "before" : "after";
43
+ }, [renderedItems, controlIndex]);
36
44
  return /* @__PURE__ */ jsx(
37
- FieldDescribedByContext.Provider,
45
+ Ariakit.Collection,
38
46
  {
39
- value: React.useMemo(
40
- () => ({
41
- describedBy,
42
- register,
43
- unregister
44
- }),
45
- [describedBy, register, unregister]
46
- ),
47
- children: props.children
47
+ ...props,
48
+ store: fieldElementCollection,
49
+ "data-kiwi-label-placement": labelPlacement,
50
+ "data-kiwi-control-type": controlType
48
51
  }
49
52
  );
50
53
  }
51
- function useFieldDescribedBy(ariaDescribedByProp) {
52
- const describedBySet = React.useContext(FieldDescribedByContext)?.describedBy;
53
- return React.useMemo(
54
- () => !describedBySet || describedBySet.size === 0 ? ariaDescribedByProp : [...describedBySet, ariaDescribedByProp].filter(Boolean).join(" "),
55
- [describedBySet, ariaDescribedByProp]
54
+ function FieldControl(props) {
55
+ const store = Ariakit.useCollectionContext();
56
+ const generatedId = React.useId();
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]);
65
+ const getData = React.useCallback(
66
+ (data) => ({
67
+ ...data,
68
+ elementType: "control",
69
+ controlType: type
70
+ }),
71
+ [type]
72
+ );
73
+ return /* @__PURE__ */ jsx(
74
+ Ariakit.CollectionItem,
75
+ {
76
+ id,
77
+ getItem: getData,
78
+ render: /* @__PURE__ */ jsx(Ariakit.Role, { ...rest, "aria-describedby": describedBy })
79
+ }
56
80
  );
57
81
  }
58
- function useFieldRegisterDescribedBy(id) {
59
- const context = React.useContext(FieldDescribedByContext);
60
- const register = context?.register;
61
- const unregister = context?.unregister;
62
- React.useEffect(() => {
63
- if (!register || !unregister) return;
64
- register(id);
65
- return () => unregister(id);
66
- }, [id, register, unregister]);
82
+ function FieldLabel(props) {
83
+ const store = Ariakit.useCollectionContext();
84
+ const renderedItems = Ariakit.useStoreState(store, "renderedItems");
85
+ const fieldId = React.useMemo(
86
+ () => renderedItems?.find(
87
+ (item) => item.elementType === "control"
88
+ )?.id,
89
+ [renderedItems]
90
+ );
91
+ const getData = React.useCallback(
92
+ (data) => ({
93
+ ...data,
94
+ elementType: "label"
95
+ }),
96
+ []
97
+ );
98
+ return /* @__PURE__ */ jsx(
99
+ Ariakit.CollectionItem,
100
+ {
101
+ getItem: getData,
102
+ render: /* @__PURE__ */ jsx(Ariakit.Role.label, { ...props, htmlFor: fieldId })
103
+ }
104
+ );
67
105
  }
68
- const FieldIdContext = React.createContext(void 0);
69
- function useFieldId() {
70
- return React.useContext(FieldIdContext);
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 });
71
117
  }
72
118
  export {
73
119
  Field,
74
- useFieldDescribedBy,
75
- useFieldId,
76
- useFieldRegisterDescribedBy
120
+ FieldControl,
121
+ FieldDescription,
122
+ FieldLabel
77
123
  };
@@ -1,17 +1,20 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
3
  import * as Ariakit from "@ariakit/react";
4
- import { useFieldId } from "./Field.js";
5
4
  import { forwardRef } from "./~utils.js";
5
+ import { FieldLabel } from "./Field.js";
6
6
  const Label = forwardRef((props, forwardedRef) => {
7
- const fieldId = useFieldId();
8
7
  return /* @__PURE__ */ jsx(
9
- Ariakit.Role.label,
8
+ FieldLabel,
10
9
  {
11
- htmlFor: fieldId,
12
- ...props,
13
- className: cx("\u{1F95D}-label", props.className),
14
- ref: forwardedRef
10
+ render: /* @__PURE__ */ jsx(
11
+ Ariakit.Role.label,
12
+ {
13
+ ...props,
14
+ className: cx("\u{1F95D}-label", props.className),
15
+ ref: forwardedRef
16
+ }
17
+ )
15
18
  }
16
19
  );
17
20
  });
@@ -1,20 +1,24 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
3
  import * as Ariakit from "@ariakit/react";
4
- import { useFieldDescribedBy, useFieldId } from "./Field.js";
4
+ import { FieldControl } from "./Field.js";
5
5
  import { forwardRef } from "./~utils.js";
6
6
  const Radio = forwardRef((props, forwardedRef) => {
7
- const fieldId = useFieldId();
8
- const describedBy = useFieldDescribedBy(props["aria-describedby"]);
7
+ const { id, ...rest } = props;
9
8
  return /* @__PURE__ */ jsx(
10
- Ariakit.Radio,
9
+ FieldControl,
11
10
  {
12
- accessibleWhenDisabled: true,
13
- id: fieldId,
14
- ...props,
15
- className: cx("\u{1F95D}-checkbox", "\u{1F95D}-radio", props.className),
16
- "aria-describedby": describedBy,
17
- ref: forwardedRef
11
+ type: "checkable",
12
+ id,
13
+ render: /* @__PURE__ */ jsx(
14
+ Ariakit.Radio,
15
+ {
16
+ accessibleWhenDisabled: true,
17
+ ...rest,
18
+ className: cx("\u{1F95D}-checkbox", "\u{1F95D}-radio", props.className),
19
+ ref: forwardedRef
20
+ }
21
+ )
18
22
  }
19
23
  );
20
24
  });
@@ -7,7 +7,7 @@ import {
7
7
  isBrowser
8
8
  } from "./~utils.js";
9
9
  import { DisclosureArrow } from "./Icon.js";
10
- import { useFieldDescribedBy, 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
  });
@@ -25,10 +25,8 @@ const SelectRoot = forwardRef((props, forwardedRef) => {
25
25
  });
26
26
  const HtmlSelect = forwardRef(
27
27
  (props, forwardedRef) => {
28
- const { variant = "solid", ...rest } = props;
28
+ const { id, variant = "solid", ...rest } = props;
29
29
  const setIsHtmlSelect = React.useContext(HtmlSelectContext);
30
- const fieldId = useFieldId();
31
- const describedBy = useFieldDescribedBy(props["aria-describedby"]);
32
30
  React.useEffect(
33
31
  function updateContext() {
34
32
  setIsHtmlSelect(true);
@@ -37,15 +35,20 @@ const HtmlSelect = forwardRef(
37
35
  );
38
36
  return /* @__PURE__ */ jsxs(Fragment, { children: [
39
37
  /* @__PURE__ */ jsx(
40
- Ariakit.Role.select,
38
+ FieldControl,
41
39
  {
42
- id: fieldId,
43
- ...rest,
44
- className: cx("\u{1F95D}-button", "\u{1F95D}-select", props.className),
45
- "aria-describedby": describedBy,
46
- "data-kiwi-tone": "neutral",
47
- "data-kiwi-variant": variant,
48
- ref: forwardedRef
40
+ type: "textlike",
41
+ id,
42
+ render: /* @__PURE__ */ jsx(
43
+ Ariakit.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
+ )
49
52
  }
50
53
  ),
51
54
  /* @__PURE__ */ jsx(DisclosureArrow, { className: "\u{1F95D}-select-arrow" })
@@ -1,22 +1,26 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
3
  import * as Ariakit from "@ariakit/react";
4
- import { useFieldDescribedBy, useFieldId } 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
- const fieldId = useFieldId();
9
- const describedBy = useFieldDescribedBy(props["aria-describedby"]);
8
+ const { id, ...rest } = props;
10
9
  return /* @__PURE__ */ jsx(
11
- Ariakit.Checkbox,
10
+ FieldControl,
12
11
  {
13
- accessibleWhenDisabled: true,
14
- id: fieldId,
15
- ...props,
16
- className: cx("\u{1F95D}-switch", props.className),
17
- "aria-describedby": describedBy,
18
- role: "switch",
19
- ref: forwardedRef
12
+ type: "checkable",
13
+ id,
14
+ render: /* @__PURE__ */ jsx(
15
+ Ariakit.Checkbox,
16
+ {
17
+ accessibleWhenDisabled: true,
18
+ ...rest,
19
+ className: cx("\u{1F95D}-switch", props.className),
20
+ role: "switch",
21
+ ref: forwardedRef
22
+ }
23
+ )
20
24
  }
21
25
  );
22
26
  }
@@ -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
+ };