@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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.0.0-alpha.6
4
+
5
+ - **breaking**: All CSS variables have been renamed to use the `--ids` prefix. See [#369](https://github.com/iTwin/kiwi/pull/369).
6
+ - **breaking**: Some CSS variables were renamed further. See [#368](https://github.com/iTwin/kiwi/pull/368).
7
+ - Notably, the "surface" backgrounds have been split into two different "page" and "elevation" scales.
8
+ - Background colors have been updated to match the latest design.
9
+ - All styles are now loaded into `@layer itwinui`. The one exception is the CSS reset which remains in `@layer reset`.
10
+ - `<Field>` now respects the order of `<Description>`s when creating associations.
11
+
12
+ ## 5.0.0-alpha.5
13
+
14
+ - **breaking**: `Tree` API has changed to require flat structure, with explicit ARIA props (see [#300](https://github.com/iTwin/kiwi/pull/300)). `<Tree.Item>` no longer allows passing `children`.
15
+ - **breaking**: `Tree.Item`s `action` prop now requires a list of `<Tree.ItemAction>` components (see [#355](https://github.com/iTwin/kiwi/pull/355) and [#362](https://github.com/iTwin/kiwi/pull/362)).
16
+ - **breaking**: Replaced `<Chip>` children with new `label` prop (see [#349](https://github.com/iTwin/kiwi/pull/349)).
17
+ - Added `<Tree.ItemAction>` component with `visible` prop for more granular control over action visibility.
18
+ - Updated the layout of `<Field>` so that `<Description>` is placed in the best spot according on the label position and control type.
19
+ - `<Field>` now considers the presence of explicit control `id`s when creating associations.
20
+
3
21
  ## 5.0.0-alpha.4
4
22
 
5
23
  - Added `onDismiss` prop and dismiss button to `<Chip>`.
@@ -1,21 +1,25 @@
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 Checkbox = 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}-checkbox", props.className),
17
- "aria-describedby": describedBy,
18
- 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}-checkbox", props.className),
20
+ ref: forwardedRef
21
+ }
22
+ )
19
23
  }
20
24
  );
21
25
  }
@@ -6,7 +6,7 @@ import { forwardRef } from "./~utils.js";
6
6
  import { IconButton } from "./IconButton.js";
7
7
  import { Dismiss } from "./Icon.js";
8
8
  const Chip = forwardRef((props, forwardedRef) => {
9
- const { variant = "solid", onDismiss, children, ...rest } = props;
9
+ const { variant = "solid", onDismiss, label, ...rest } = props;
10
10
  const baseId = React.useId();
11
11
  const labelId = `${baseId}-label`;
12
12
  const dismissIconId = `${baseId}-dismiss`;
@@ -18,7 +18,7 @@ const Chip = forwardRef((props, forwardedRef) => {
18
18
  className: cx("\u{1F95D}-chip", props.className),
19
19
  ref: forwardedRef,
20
20
  children: [
21
- /* @__PURE__ */ jsx("span", { id: labelId, children }),
21
+ /* @__PURE__ */ jsx("span", { id: labelId, children: label }),
22
22
  onDismiss && /* @__PURE__ */ jsx(
23
23
  IconButton,
24
24
  {
@@ -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
  }
@@ -4,75 +4,121 @@ 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
23
  DEV: Field.displayName = "Field";
20
- const FieldDescribedByContext = React.createContext(void 0);
21
- function FieldDescribedByProvider(props) {
22
- const [describedBy, setDescribedBy] = React.useState(/* @__PURE__ */ new Set());
23
- const register = React.useCallback((id) => {
24
- setDescribedBy((describedBy2) => {
25
- const updated = new Set(describedBy2);
26
- updated.add(id);
27
- return updated;
28
- });
29
- }, []);
30
- const unregister = React.useCallback((id) => {
31
- setDescribedBy((describedBy2) => {
32
- const updated = new Set(describedBy2);
33
- updated.delete(id);
34
- return updated;
35
- });
36
- }, []);
24
+ function FieldCollection(props) {
25
+ const fieldElementCollection = Ariakit.useCollectionStore({
26
+ defaultItems: []
27
+ });
28
+ const renderedItems = Ariakit.useStoreState(
29
+ fieldElementCollection,
30
+ "renderedItems"
31
+ );
32
+ const [controlType, controlIndex] = React.useMemo(() => {
33
+ const controlIndex2 = renderedItems.findIndex(
34
+ (item) => item.elementType === "control"
35
+ );
36
+ return [renderedItems[controlIndex2]?.controlType, controlIndex2];
37
+ }, [renderedItems]);
38
+ const labelPlacement = React.useMemo(() => {
39
+ const labelIndex = renderedItems.findIndex(
40
+ (item) => item.elementType === "label"
41
+ );
42
+ if (controlIndex === -1 || labelIndex === -1) return;
43
+ return labelIndex < controlIndex ? "before" : "after";
44
+ }, [renderedItems, controlIndex]);
37
45
  return /* @__PURE__ */ jsx(
38
- FieldDescribedByContext.Provider,
46
+ Ariakit.Collection,
39
47
  {
40
- value: React.useMemo(
41
- () => ({
42
- describedBy,
43
- register,
44
- unregister
45
- }),
46
- [describedBy, register, unregister]
47
- ),
48
- children: props.children
48
+ ...props,
49
+ store: fieldElementCollection,
50
+ "data-kiwi-label-placement": labelPlacement,
51
+ "data-kiwi-control-type": controlType
49
52
  }
50
53
  );
51
54
  }
52
- function useFieldDescribedBy(ariaDescribedByProp) {
53
- const describedBySet = React.useContext(FieldDescribedByContext)?.describedBy;
54
- return React.useMemo(
55
- () => !describedBySet || describedBySet.size === 0 ? ariaDescribedByProp : [...describedBySet, ariaDescribedByProp].filter(Boolean).join(" "),
56
- [describedBySet, ariaDescribedByProp]
55
+ function FieldControl(props) {
56
+ const store = Ariakit.useCollectionContext();
57
+ const generatedId = React.useId();
58
+ const { id = store ? generatedId : void 0, type, ...rest } = props;
59
+ const renderedItems = Ariakit.useStoreState(store, "renderedItems");
60
+ const describedBy = React.useMemo(() => {
61
+ const idRefList = renderedItems?.filter(
62
+ (item) => item.elementType === "description"
63
+ )?.map((item) => item.id).join(" ");
64
+ return idRefList || void 0;
65
+ }, [renderedItems]);
66
+ const getData = React.useCallback(
67
+ (data) => ({
68
+ ...data,
69
+ elementType: "control",
70
+ controlType: type
71
+ }),
72
+ [type]
73
+ );
74
+ return /* @__PURE__ */ jsx(
75
+ Ariakit.CollectionItem,
76
+ {
77
+ id,
78
+ getItem: getData,
79
+ render: /* @__PURE__ */ jsx(Ariakit.Role, { ...rest, "aria-describedby": describedBy })
80
+ }
57
81
  );
58
82
  }
59
- function useFieldRegisterDescribedBy(id) {
60
- const context = React.useContext(FieldDescribedByContext);
61
- const register = context?.register;
62
- const unregister = context?.unregister;
63
- React.useEffect(() => {
64
- if (!register || !unregister) return;
65
- register(id);
66
- return () => unregister(id);
67
- }, [id, register, unregister]);
83
+ function FieldLabel(props) {
84
+ const store = Ariakit.useCollectionContext();
85
+ const renderedItems = Ariakit.useStoreState(store, "renderedItems");
86
+ const fieldId = React.useMemo(
87
+ () => renderedItems?.find(
88
+ (item) => item.elementType === "control"
89
+ )?.id,
90
+ [renderedItems]
91
+ );
92
+ const getData = React.useCallback(
93
+ (data) => ({
94
+ ...data,
95
+ elementType: "label"
96
+ }),
97
+ []
98
+ );
99
+ return /* @__PURE__ */ jsx(
100
+ Ariakit.CollectionItem,
101
+ {
102
+ getItem: getData,
103
+ render: /* @__PURE__ */ jsx(Ariakit.Role.label, { ...props, htmlFor: fieldId })
104
+ }
105
+ );
68
106
  }
69
- const FieldIdContext = React.createContext(void 0);
70
- function useFieldId() {
71
- return React.useContext(FieldIdContext);
107
+ function FieldDescription(props) {
108
+ const generatedId = React.useId();
109
+ const { id = generatedId, ...rest } = props;
110
+ const getData = React.useCallback(
111
+ (data) => ({
112
+ ...data,
113
+ elementType: "description"
114
+ }),
115
+ []
116
+ );
117
+ return /* @__PURE__ */ jsx(Ariakit.CollectionItem, { ...rest, id, getItem: getData });
72
118
  }
73
119
  export {
74
120
  Field,
75
- useFieldDescribedBy,
76
- useFieldId,
77
- useFieldRegisterDescribedBy
121
+ FieldControl,
122
+ FieldDescription,
123
+ FieldLabel
78
124
  };
@@ -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,114 @@
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
+ DEV: Table.displayName = "Table.Root";
27
+ const TableHeaderContext = React.createContext(false);
28
+ const TableHeader = forwardRef(
29
+ (props, forwardedRef) => {
30
+ return /* @__PURE__ */ jsx(TableHeaderContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
31
+ Ariakit.Role.div,
32
+ {
33
+ ...props,
34
+ className: cx("\u{1F95D}-table-header", props.className),
35
+ ref: forwardedRef,
36
+ role: "rowgroup",
37
+ children: props.children
38
+ }
39
+ ) });
40
+ }
41
+ );
42
+ DEV: TableHeader.displayName = "Table.Header";
43
+ const TableBody = forwardRef((props, forwardedRef) => {
44
+ return /* @__PURE__ */ jsx(
45
+ Ariakit.Role.div,
46
+ {
47
+ ...props,
48
+ className: cx("\u{1F95D}-table-body", props.className),
49
+ ref: forwardedRef,
50
+ children: props.children
51
+ }
52
+ );
53
+ });
54
+ DEV: TableBody.displayName = "Table.Body";
55
+ const TableRow = forwardRef((props, forwardedRef) => {
56
+ const { children, ...rest } = props;
57
+ return /* @__PURE__ */ jsx(
58
+ Ariakit.Role.div,
59
+ {
60
+ ...rest,
61
+ className: cx("\u{1F95D}-table-row", props.className),
62
+ ref: forwardedRef,
63
+ role: "row",
64
+ children
65
+ }
66
+ );
67
+ });
68
+ DEV: TableRow.displayName = "Table.Row";
69
+ const TableCaption = forwardRef(
70
+ (props, forwardedRef) => {
71
+ const fallbackId = React.useId();
72
+ const { id = fallbackId, children, ...rest } = props;
73
+ const { setCaptionId } = React.useContext(TableContext);
74
+ const captionIdRef = React.useCallback(
75
+ (element) => {
76
+ setCaptionId(element ? id : void 0);
77
+ },
78
+ [id, setCaptionId]
79
+ );
80
+ return /* @__PURE__ */ jsx(
81
+ Ariakit.Role,
82
+ {
83
+ ...rest,
84
+ id,
85
+ className: cx("\u{1F95D}-table-caption", props.className),
86
+ ref: useMergedRefs(forwardedRef, captionIdRef),
87
+ children
88
+ }
89
+ );
90
+ }
91
+ );
92
+ DEV: TableCaption.displayName = "Table.Caption";
93
+ const TableCell = forwardRef((props, forwardedRef) => {
94
+ const isWithinTableHeader = React.useContext(TableHeaderContext);
95
+ return /* @__PURE__ */ jsx(
96
+ Ariakit.Role.span,
97
+ {
98
+ ...props,
99
+ className: cx("\u{1F95D}-table-cell", props.className),
100
+ ref: forwardedRef,
101
+ role: isWithinTableHeader ? "columnheader" : "cell",
102
+ children: props.children
103
+ }
104
+ );
105
+ });
106
+ DEV: TableCell.displayName = "Table.Cell";
107
+ export {
108
+ TableBody as Body,
109
+ TableCaption as Caption,
110
+ TableCell as Cell,
111
+ TableHeader as Header,
112
+ Table as Root,
113
+ TableRow as Row
114
+ };
@@ -2,36 +2,40 @@ 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 { useFieldDescribedBy, useFieldId } 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
- const describedBy = useFieldDescribedBy(props["aria-describedby"]);
12
- const fieldId = useFieldId();
11
+ const { id, ...rest } = props;
13
12
  const rootContext = React.useContext(TextBoxRootContext);
14
13
  const setDisabled = rootContext?.setDisabled;
15
14
  React.useEffect(() => {
16
15
  setDisabled?.(props.disabled);
17
16
  }, [setDisabled, props.disabled]);
18
17
  return /* @__PURE__ */ jsx(
19
- Ariakit.Role.input,
18
+ FieldControl,
20
19
  {
21
- id: fieldId,
22
- readOnly: props.disabled,
23
- ...props,
24
- "aria-describedby": describedBy,
25
- className: cx({ "\u{1F95D}-text-box": !rootContext }, props.className),
26
- placeholder: props.placeholder ?? " ",
20
+ type: "textlike",
21
+ id,
27
22
  render: /* @__PURE__ */ jsx(
28
- Ariakit.Focusable,
23
+ Ariakit.Role.input,
29
24
  {
30
- accessibleWhenDisabled: true,
31
- render: props.render || /* @__PURE__ */ jsx("input", {})
25
+ readOnly: props.disabled,
26
+ ...rest,
27
+ className: cx({ "\u{1F95D}-text-box": !rootContext }, props.className),
28
+ placeholder: props.placeholder ?? " ",
29
+ render: /* @__PURE__ */ jsx(
30
+ Ariakit.Focusable,
31
+ {
32
+ accessibleWhenDisabled: true,
33
+ render: props.render || /* @__PURE__ */ jsx("input", {})
34
+ }
35
+ ),
36
+ ref: useMergedRefs(rootContext?.inputRef, forwardedRef)
32
37
  }
33
- ),
34
- ref: useMergedRefs(rootContext?.inputRef, forwardedRef)
38
+ )
35
39
  }
36
40
  );
37
41
  }
@@ -39,25 +43,29 @@ const TextBoxInput = forwardRef(
39
43
  DEV: TextBoxInput.displayName = "TextBox.Input";
40
44
  const TextBoxTextarea = forwardRef(
41
45
  (props, forwardedRef) => {
42
- const fieldId = useFieldId();
43
- const describedBy = useFieldDescribedBy(props["aria-describedby"]);
46
+ const { id, ...rest } = props;
44
47
  return /* @__PURE__ */ jsx(
45
- Ariakit.Role.textarea,
48
+ FieldControl,
46
49
  {
47
- id: fieldId,
48
- readOnly: props.disabled,
49
- ...props,
50
- className: cx("\u{1F95D}-text-box", props.className),
51
- "aria-describedby": describedBy,
52
- placeholder: props.placeholder ?? " ",
50
+ type: "textlike",
51
+ id,
53
52
  render: /* @__PURE__ */ jsx(
54
- Ariakit.Focusable,
53
+ Ariakit.Role.textarea,
55
54
  {
56
- accessibleWhenDisabled: true,
57
- render: props.render || /* @__PURE__ */ jsx("textarea", {})
55
+ readOnly: props.disabled,
56
+ ...rest,
57
+ className: cx("\u{1F95D}-text-box", props.className),
58
+ placeholder: props.placeholder ?? " ",
59
+ render: /* @__PURE__ */ jsx(
60
+ Ariakit.Focusable,
61
+ {
62
+ accessibleWhenDisabled: true,
63
+ render: props.render || /* @__PURE__ */ jsx("textarea", {})
64
+ }
65
+ ),
66
+ ref: forwardedRef
58
67
  }
59
- ),
60
- ref: forwardedRef
68
+ )
61
69
  }
62
70
  );
63
71
  }