@itwin/itwinui-react 5.0.0-alpha.0 → 5.0.0-alpha.2

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 (90) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/DEV/bricks/Anchor.js +20 -22
  3. package/dist/DEV/bricks/Button.js +17 -15
  4. package/dist/DEV/bricks/Checkbox.js +19 -15
  5. package/dist/DEV/bricks/Chip.js +21 -0
  6. package/dist/DEV/bricks/Description.js +27 -0
  7. package/dist/DEV/bricks/Divider.js +14 -16
  8. package/dist/DEV/bricks/DropdownMenu.js +60 -44
  9. package/dist/DEV/bricks/Field.js +66 -16
  10. package/dist/DEV/bricks/Icon.js +45 -44
  11. package/dist/DEV/bricks/IconButton.js +24 -19
  12. package/dist/DEV/bricks/Kbd.js +46 -16
  13. package/dist/DEV/bricks/Label.js +2 -2
  14. package/dist/DEV/bricks/ListItem.js +16 -16
  15. package/dist/DEV/bricks/Radio.js +5 -3
  16. package/dist/DEV/bricks/Root.js +45 -43
  17. package/dist/DEV/bricks/Select.js +57 -0
  18. package/dist/DEV/bricks/Spinner.js +40 -0
  19. package/dist/DEV/bricks/Switch.js +20 -16
  20. package/dist/DEV/bricks/Tabs.js +15 -16
  21. package/dist/DEV/bricks/Text.js +20 -0
  22. package/dist/DEV/bricks/TextBox.js +55 -46
  23. package/dist/DEV/bricks/Textarea.js +25 -21
  24. package/dist/DEV/bricks/Tooltip.js +65 -57
  25. package/dist/DEV/bricks/Tree.js +133 -66
  26. package/dist/DEV/bricks/VisuallyHidden.js +6 -4
  27. package/dist/DEV/bricks/index.js +12 -0
  28. package/dist/DEV/bricks/styles.css.js +1 -1
  29. package/dist/DEV/bricks/~hooks.js +13 -0
  30. package/dist/DEV/bricks/~utils.js +3 -0
  31. package/dist/DEV/foundations/styles.css.js +1 -1
  32. package/dist/bricks/Anchor.d.ts +12 -3
  33. package/dist/bricks/Anchor.js +20 -22
  34. package/dist/bricks/Button.d.ts +27 -4
  35. package/dist/bricks/Button.js +17 -15
  36. package/dist/bricks/Checkbox.d.ts +17 -3
  37. package/dist/bricks/Checkbox.js +19 -15
  38. package/dist/bricks/Chip.d.ts +22 -0
  39. package/dist/bricks/Chip.js +20 -0
  40. package/dist/bricks/Description.d.ts +20 -0
  41. package/dist/bricks/Description.js +27 -0
  42. package/dist/bricks/Divider.d.ts +3 -4
  43. package/dist/bricks/Divider.js +14 -16
  44. package/dist/bricks/DropdownMenu.d.ts +60 -10
  45. package/dist/bricks/DropdownMenu.js +60 -44
  46. package/dist/bricks/Field.d.ts +30 -2
  47. package/dist/bricks/Field.js +66 -16
  48. package/dist/bricks/Icon.d.ts +4 -4
  49. package/dist/bricks/Icon.js +44 -43
  50. package/dist/bricks/IconButton.d.ts +4 -4
  51. package/dist/bricks/IconButton.js +24 -19
  52. package/dist/bricks/Kbd.d.ts +32 -3
  53. package/dist/bricks/Kbd.js +39 -16
  54. package/dist/bricks/Label.d.ts +22 -3
  55. package/dist/bricks/Label.js +2 -2
  56. package/dist/bricks/ListItem.d.ts +2 -3
  57. package/dist/bricks/ListItem.js +15 -15
  58. package/dist/bricks/Radio.d.ts +17 -3
  59. package/dist/bricks/Radio.js +5 -3
  60. package/dist/bricks/Root.d.ts +11 -2
  61. package/dist/bricks/Root.js +45 -43
  62. package/dist/bricks/Select.d.ts +45 -0
  63. package/dist/bricks/Select.js +57 -0
  64. package/dist/bricks/Spinner.d.ts +31 -0
  65. package/dist/bricks/Spinner.js +39 -0
  66. package/dist/bricks/Switch.d.ts +17 -3
  67. package/dist/bricks/Switch.js +20 -16
  68. package/dist/bricks/Tabs.d.ts +66 -5
  69. package/dist/bricks/Tabs.js +15 -16
  70. package/dist/bricks/Text.d.ts +22 -0
  71. package/dist/bricks/Text.js +19 -0
  72. package/dist/bricks/TextBox.d.ts +39 -9
  73. package/dist/bricks/TextBox.js +55 -46
  74. package/dist/bricks/Textarea.d.ts +14 -4
  75. package/dist/bricks/Textarea.js +25 -21
  76. package/dist/bricks/Tooltip.d.ts +11 -4
  77. package/dist/bricks/Tooltip.js +65 -57
  78. package/dist/bricks/Tree.d.ts +79 -16
  79. package/dist/bricks/Tree.js +128 -62
  80. package/dist/bricks/VisuallyHidden.d.ts +15 -3
  81. package/dist/bricks/VisuallyHidden.js +6 -4
  82. package/dist/bricks/index.d.ts +6 -0
  83. package/dist/bricks/index.js +12 -0
  84. package/dist/bricks/styles.css.js +1 -1
  85. package/dist/bricks/~hooks.d.ts +15 -0
  86. package/dist/bricks/~hooks.js +13 -0
  87. package/dist/bricks/~utils.d.ts +20 -0
  88. package/dist/bricks/~utils.js +3 -0
  89. package/dist/foundations/styles.css.js +1 -1
  90. package/package.json +2 -2
@@ -1,22 +1,52 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import * as React from "react";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
2
  import cx from "classnames";
4
3
  import * as Ariakit from "@ariakit/react";
5
- const Kbd = React.forwardRef(
6
- (props, forwardedRef) => {
7
- const { variant = "solid", ...rest } = props;
8
- return /* @__PURE__ */ jsx(
9
- Ariakit.Role,
10
- {
11
- "data-kiwi-variant": variant,
12
- ...rest,
13
- className: cx("\u{1F95D}-kbd", props.className),
14
- render: props.render || /* @__PURE__ */ jsx("kbd", {}),
15
- ref: forwardedRef
16
- }
17
- );
4
+ import { forwardRef } from "./~utils.js";
5
+ import { VisuallyHidden } from "./VisuallyHidden.js";
6
+ const predefinedSymbols = {
7
+ Backspace: "\u232B",
8
+ Command: "\u2318",
9
+ Control: "Ctrl",
10
+ Down: "\u2193",
11
+ Eject: "\u23CF",
12
+ Enter: "\u21B5",
13
+ Escape: "Esc",
14
+ Left: "\u2190",
15
+ Option: "\u2325",
16
+ Right: "\u2192",
17
+ Shift: "\u21E7",
18
+ Space: "\u2423",
19
+ Tab: "Tab",
20
+ Up: "\u2191"
21
+ };
22
+ const Kbd = forwardRef((props, forwardedRef) => {
23
+ const { variant = "solid", symbol, children, ...rest } = props;
24
+ DEV: {
25
+ if (symbol && !(symbol in predefinedSymbols)) {
26
+ console.error(
27
+ `Kbd: Invalid symbol "${symbol}". Must be one of: ${Object.keys(predefinedSymbols).join(", ")}`
28
+ );
29
+ }
30
+ }
31
+ let content = children;
32
+ if (symbol) {
33
+ content = /* @__PURE__ */ jsxs(Fragment, { children: [
34
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: predefinedSymbols[symbol] }),
35
+ children || /* @__PURE__ */ jsx(VisuallyHidden, { children: symbol })
36
+ ] });
18
37
  }
19
- );
38
+ return /* @__PURE__ */ jsx(
39
+ Ariakit.Role,
40
+ {
41
+ ...rest,
42
+ "data-kiwi-variant": variant,
43
+ className: cx("\u{1F95D}-kbd", props.className),
44
+ render: props.render || /* @__PURE__ */ jsx("kbd", {}),
45
+ ref: forwardedRef,
46
+ children: content
47
+ }
48
+ );
49
+ });
20
50
  DEV: Kbd.displayName = "Kbd";
21
51
  export {
22
52
  Kbd
@@ -1,9 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import * as React from "react";
3
2
  import cx from "classnames";
4
3
  import * as Ariakit from "@ariakit/react";
5
4
  import { useFieldId } from "./Field.js";
6
- const Label = React.forwardRef((props, forwardedRef) => {
5
+ import { forwardRef } from "./~utils.js";
6
+ const Label = forwardRef((props, forwardedRef) => {
7
7
  const fieldId = useFieldId();
8
8
  return /* @__PURE__ */ jsx(
9
9
  Ariakit.Role.label,
@@ -1,31 +1,31 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import * as React from "react";
3
2
  import cx from "classnames";
4
3
  import * as Ariakit from "@ariakit/react";
5
- const ListItem = React.forwardRef(
4
+ import { forwardRef } from "./~utils.js";
5
+ const ListItem = forwardRef((props, forwardedRef) => {
6
+ return /* @__PURE__ */ jsx(
7
+ Ariakit.Role.div,
8
+ {
9
+ role: "listitem",
10
+ ...props,
11
+ className: cx("\u{1F95D}-list-item", props.className),
12
+ ref: forwardedRef
13
+ }
14
+ );
15
+ });
16
+ DEV: ListItem.displayName = "ListItem.Root";
17
+ const ListItemContent = forwardRef(
6
18
  (props, forwardedRef) => {
7
19
  return /* @__PURE__ */ jsx(
8
- Ariakit.Role.div,
20
+ Ariakit.Role.span,
9
21
  {
10
- role: "listitem",
11
22
  ...props,
12
- className: cx("\u{1F95D}-list-item", props.className),
23
+ className: cx("\u{1F95D}-list-item-content", props.className),
13
24
  ref: forwardedRef
14
25
  }
15
26
  );
16
27
  }
17
28
  );
18
- DEV: ListItem.displayName = "ListItem.Root";
19
- const ListItemContent = React.forwardRef((props, forwardedRef) => {
20
- return /* @__PURE__ */ jsx(
21
- Ariakit.Role.span,
22
- {
23
- ...props,
24
- className: cx("\u{1F95D}-list-item-content", props.className),
25
- ref: forwardedRef
26
- }
27
- );
28
- });
29
29
  DEV: ListItemContent.displayName = "ListItem.Content";
30
30
  export {
31
31
  ListItemContent as Content,
@@ -1,10 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import * as React from "react";
3
2
  import cx from "classnames";
4
3
  import * as Ariakit from "@ariakit/react";
5
- import { useFieldId } from "./Field.js";
6
- const Radio = React.forwardRef((props, forwardedRef) => {
4
+ import { useFieldDescribedBy, useFieldId } from "./Field.js";
5
+ import { forwardRef } from "./~utils.js";
6
+ const Radio = forwardRef((props, forwardedRef) => {
7
7
  const fieldId = useFieldId();
8
+ const describedBy = useFieldDescribedBy(props["aria-describedby"]);
8
9
  return /* @__PURE__ */ jsx(
9
10
  Ariakit.Radio,
10
11
  {
@@ -12,6 +13,7 @@ const Radio = React.forwardRef((props, forwardedRef) => {
12
13
  id: fieldId,
13
14
  ...props,
14
15
  className: cx("\u{1F95D}-checkbox", "\u{1F95D}-radio", props.className),
16
+ "aria-describedby": describedBy,
15
17
  ref: forwardedRef
16
18
  }
17
19
  );
@@ -4,48 +4,46 @@ import * as Ariakit from "@ariakit/react";
4
4
  import cx from "classnames";
5
5
  import foundationsCss from "../foundations/styles.css.js";
6
6
  import bricksCss from "./styles.css.js";
7
- import { isBrowser } from "./~utils.js";
7
+ import { forwardRef, isBrowser } from "./~utils.js";
8
8
  import { useMergedRefs } from "./~hooks.js";
9
9
  const css = foundationsCss + bricksCss;
10
- const Root = React.forwardRef(
11
- (props, forwardedRef) => {
12
- const { children, synchronizeColorScheme = false, ...rest } = props;
13
- return /* @__PURE__ */ jsxs(RootInternal, { ...rest, ref: forwardedRef, children: [
14
- /* @__PURE__ */ jsx(Styles, {}),
15
- /* @__PURE__ */ jsx(Fonts, {}),
16
- synchronizeColorScheme ? /* @__PURE__ */ jsx(SynchronizeColorScheme, { colorScheme: props.colorScheme }) : null,
17
- children
18
- ] });
19
- }
20
- );
10
+ const Root = forwardRef((props, forwardedRef) => {
11
+ const { children, synchronizeColorScheme = false, ...rest } = props;
12
+ return /* @__PURE__ */ jsxs(RootInternal, { ...rest, ref: forwardedRef, children: [
13
+ /* @__PURE__ */ jsx(Styles, {}),
14
+ /* @__PURE__ */ jsx(Fonts, {}),
15
+ synchronizeColorScheme ? /* @__PURE__ */ jsx(SynchronizeColorScheme, { colorScheme: props.colorScheme }) : null,
16
+ children
17
+ ] });
18
+ });
21
19
  DEV: Root.displayName = "Root";
22
20
  const RootNodeContext = React.createContext(null);
23
21
  function useRootNode() {
24
22
  return React.useContext(RootNodeContext);
25
23
  }
26
- const RootInternal = React.forwardRef((props, forwardedRef) => {
27
- const { children, colorScheme, density, ...rest } = props;
28
- const [rootNode, setRootNode] = React.useState(
29
- null
30
- );
31
- const findRootNodeFromRef = React.useCallback((element) => {
32
- if (!element) return;
33
- const rootNode2 = element.getRootNode();
34
- if (!isDocument(rootNode2) && !isShadow(rootNode2)) return;
35
- setRootNode(rootNode2);
36
- }, []);
37
- return /* @__PURE__ */ jsx(
38
- Ariakit.Role,
39
- {
40
- ...rest,
41
- className: cx("\u{1F95D}-root", props.className),
42
- "data-kiwi-theme": colorScheme,
43
- "data-kiwi-density": density,
44
- ref: useMergedRefs(forwardedRef, findRootNodeFromRef),
45
- children: /* @__PURE__ */ jsx(RootNodeContext.Provider, { value: rootNode, children })
46
- }
47
- );
48
- });
24
+ const RootInternal = forwardRef(
25
+ (props, forwardedRef) => {
26
+ const { children, colorScheme, density, ...rest } = props;
27
+ const [rootNode, setRootNode] = React.useState(null);
28
+ const findRootNodeFromRef = React.useCallback((element) => {
29
+ if (!element) return;
30
+ const rootNode2 = element.getRootNode();
31
+ if (!isDocument(rootNode2) && !isShadow(rootNode2)) return;
32
+ setRootNode(rootNode2);
33
+ }, []);
34
+ return /* @__PURE__ */ jsx(
35
+ Ariakit.Role,
36
+ {
37
+ ...rest,
38
+ className: cx("\u{1F95D}-root", props.className),
39
+ "data-kiwi-theme": colorScheme,
40
+ "data-kiwi-density": density,
41
+ ref: useMergedRefs(forwardedRef, findRootNodeFromRef),
42
+ children: /* @__PURE__ */ jsx(RootNodeContext.Provider, { value: rootNode, children })
43
+ }
44
+ );
45
+ }
46
+ );
49
47
  function SynchronizeColorScheme({
50
48
  colorScheme
51
49
  }) {
@@ -105,8 +103,8 @@ function Fonts() {
105
103
  return null;
106
104
  }
107
105
  function loadFonts(rootNode) {
108
- const ownerDocument = getOwnerDocument(rootNode);
109
- if (!ownerDocument || Array.from(ownerDocument.fonts).some(
106
+ const ownerWindow = getWindow(rootNode);
107
+ if (!ownerWindow || Array.from(ownerWindow.document.fonts).some(
110
108
  (font) => font.family === "InterVariable"
111
109
  )) {
112
110
  return;
@@ -116,12 +114,16 @@ function loadFonts(rootNode) {
116
114
  italic: "https://rsms.me/inter/font-files/InterVariable-Italic.woff2?v=4.1"
117
115
  };
118
116
  for (const [style, url] of Object.entries(interStyles)) {
119
- const font = new FontFace("InterVariable", `url(${url}) format("woff2")`, {
120
- display: "swap",
121
- weight: "100 900",
122
- style
123
- });
124
- ownerDocument.fonts.add(font);
117
+ const font = new ownerWindow.FontFace(
118
+ "InterVariable",
119
+ `url(${url}) format("woff2")`,
120
+ {
121
+ display: "swap",
122
+ weight: "100 900",
123
+ style
124
+ }
125
+ );
126
+ ownerWindow.document.fonts.add(font);
125
127
  }
126
128
  }
127
129
  const supportsAdoptedStylesheets = isBrowser && "adoptedStyleSheets" in Document.prototype;
@@ -0,0 +1,57 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import cx from "classnames";
4
+ import * as Ariakit from "@ariakit/react";
5
+ import {
6
+ forwardRef,
7
+ isBrowser
8
+ } from "./~utils.js";
9
+ import { DisclosureArrow } from "./Icon.js";
10
+ import { useFieldDescribedBy, useFieldId } 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
+ Ariakit.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 setIsHtmlSelect = React.useContext(HtmlSelectContext);
29
+ const fieldId = useFieldId();
30
+ const describedBy = useFieldDescribedBy(props["aria-describedby"]);
31
+ React.useEffect(
32
+ function updateContext() {
33
+ setIsHtmlSelect(true);
34
+ },
35
+ [setIsHtmlSelect]
36
+ );
37
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
38
+ /* @__PURE__ */ jsx(
39
+ Ariakit.Role.select,
40
+ {
41
+ id: fieldId,
42
+ ...props,
43
+ className: cx("\u{1F95D}-button", "\u{1F95D}-select", props.className),
44
+ "aria-describedby": describedBy,
45
+ "data-kiwi-tone": "neutral",
46
+ "data-kiwi-variant": "solid",
47
+ ref: forwardedRef
48
+ }
49
+ ),
50
+ /* @__PURE__ */ jsx(DisclosureArrow, { className: "\u{1F95D}-select-arrow" })
51
+ ] });
52
+ }
53
+ );
54
+ export {
55
+ HtmlSelect,
56
+ SelectRoot as Root
57
+ };
@@ -0,0 +1,40 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import * as Ariakit from "@ariakit/react";
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
+ Ariakit.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
+ "stroke-linecap": "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
+ DEV: Spinner.displayName = "Spinner";
38
+ export {
39
+ Spinner
40
+ };
@@ -1,22 +1,26 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import * as React from "react";
3
2
  import cx from "classnames";
4
3
  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
- });
4
+ import { useFieldDescribedBy, useFieldId } from "./Field.js";
5
+ import { forwardRef } from "./~utils.js";
6
+ const Switch = forwardRef(
7
+ (props, forwardedRef) => {
8
+ const fieldId = useFieldId();
9
+ const describedBy = useFieldDescribedBy(props["aria-describedby"]);
10
+ return /* @__PURE__ */ jsx(
11
+ Ariakit.Checkbox,
12
+ {
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
20
+ }
21
+ );
22
+ }
23
+ );
20
24
  DEV: Switch.displayName = "Switch";
21
25
  export {
22
26
  Switch
@@ -4,6 +4,7 @@ import * as ReactDOM from "react-dom";
4
4
  import cx from "classnames";
5
5
  import * as Ariakit from "@ariakit/react";
6
6
  import { useControlledState } from "./~hooks.js";
7
+ import { forwardRef } from "./~utils.js";
7
8
  function Tabs(props) {
8
9
  const {
9
10
  defaultSelectedId,
@@ -41,14 +42,14 @@ function Tabs(props) {
41
42
  );
42
43
  }
43
44
  DEV: Tabs.displayName = "Tabs.Root";
44
- const TabList = React.forwardRef((props, forwardedRef) => {
45
+ const TabList = forwardRef((props, forwardedRef) => {
45
46
  const { tone = "neutral", ...rest } = props;
46
47
  const viewTransitionName = `\u{1F95D}active-stripe-${React.useId().replaceAll(":", "_")}`;
47
48
  return /* @__PURE__ */ jsx(
48
49
  Ariakit.TabList,
49
50
  {
50
- "data-kiwi-tone": tone,
51
51
  ...rest,
52
+ "data-kiwi-tone": tone,
52
53
  className: cx("\u{1F95D}-tab-list", props.className),
53
54
  style: {
54
55
  "--\u{1F95D}tab-active-stripe-view-transition-name": viewTransitionName,
@@ -59,21 +60,19 @@ const TabList = React.forwardRef((props, forwardedRef) => {
59
60
  );
60
61
  });
61
62
  DEV: TabList.displayName = "Tabs.TabList";
62
- const Tab = React.forwardRef(
63
- (props, forwardedRef) => {
64
- return /* @__PURE__ */ jsx(
65
- Ariakit.Tab,
66
- {
67
- accessibleWhenDisabled: true,
68
- ...props,
69
- className: cx("\u{1F95D}-tab", props.className),
70
- ref: forwardedRef
71
- }
72
- );
73
- }
74
- );
63
+ const Tab = forwardRef((props, forwardedRef) => {
64
+ return /* @__PURE__ */ jsx(
65
+ Ariakit.Tab,
66
+ {
67
+ accessibleWhenDisabled: true,
68
+ ...props,
69
+ className: cx("\u{1F95D}-tab", props.className),
70
+ ref: forwardedRef
71
+ }
72
+ );
73
+ });
75
74
  DEV: Tab.displayName = "Tabs.Tab";
76
- const TabPanel = React.forwardRef((props, forwardedRef) => {
75
+ const TabPanel = forwardRef((props, forwardedRef) => {
77
76
  return /* @__PURE__ */ jsx(
78
77
  Ariakit.TabPanel,
79
78
  {
@@ -0,0 +1,20 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import * as Ariakit from "@ariakit/react";
3
+ import cx from "classnames";
4
+ import { forwardRef } from "./~utils.js";
5
+ const Text = forwardRef((props, forwardedRef) => {
6
+ const { variant, ...rest } = props;
7
+ return /* @__PURE__ */ jsx(
8
+ Ariakit.Role,
9
+ {
10
+ ...rest,
11
+ className: cx("\u{1F95D}-text", props.className),
12
+ "data-kiwi-text-variant": variant,
13
+ ref: forwardedRef
14
+ }
15
+ );
16
+ });
17
+ DEV: Text.displayName = "Text";
18
+ export {
19
+ Text
20
+ };
@@ -2,36 +2,41 @@ 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 { useFieldId } from "./Field.js";
5
+ import { useFieldDescribedBy, useFieldId } from "./Field.js";
6
6
  import { Icon } from "./Icon.js";
7
7
  import { Textarea } from "./Textarea.js";
8
8
  import { useMergedRefs } from "./~hooks.js";
9
- const TextBoxInput = React.forwardRef((props, forwardedRef) => {
10
- const fieldId = useFieldId();
11
- const rootContext = React.useContext(TextBoxRootContext);
12
- const setDisabled = rootContext?.setDisabled;
13
- React.useEffect(() => {
14
- setDisabled?.(props.disabled);
15
- }, [setDisabled, props.disabled]);
16
- return /* @__PURE__ */ jsx(
17
- Ariakit.Role.input,
18
- {
19
- id: fieldId,
20
- ...props,
21
- className: cx({ "\u{1F95D}-text-box": !rootContext }, props.className),
22
- render: /* @__PURE__ */ jsx(
23
- Ariakit.Focusable,
24
- {
25
- accessibleWhenDisabled: true,
26
- render: props.render || /* @__PURE__ */ jsx("input", {})
27
- }
28
- ),
29
- ref: useMergedRefs(rootContext?.inputRef, forwardedRef)
30
- }
31
- );
32
- });
9
+ import { forwardRef } from "./~utils.js";
10
+ const TextBoxInput = forwardRef(
11
+ (props, forwardedRef) => {
12
+ const describedBy = useFieldDescribedBy(props["aria-describedby"]);
13
+ const fieldId = useFieldId();
14
+ const rootContext = React.useContext(TextBoxRootContext);
15
+ const setDisabled = rootContext?.setDisabled;
16
+ React.useEffect(() => {
17
+ setDisabled?.(props.disabled);
18
+ }, [setDisabled, props.disabled]);
19
+ return /* @__PURE__ */ jsx(
20
+ Ariakit.Role.input,
21
+ {
22
+ id: fieldId,
23
+ ...props,
24
+ "aria-describedby": describedBy,
25
+ className: cx({ "\u{1F95D}-text-box": !rootContext }, props.className),
26
+ render: /* @__PURE__ */ jsx(
27
+ Ariakit.Focusable,
28
+ {
29
+ accessibleWhenDisabled: true,
30
+ render: props.render || /* @__PURE__ */ jsx("input", {})
31
+ }
32
+ ),
33
+ ref: useMergedRefs(rootContext?.inputRef, forwardedRef)
34
+ }
35
+ );
36
+ }
37
+ );
33
38
  DEV: TextBoxInput.displayName = "TextBox.Input";
34
- const TextBoxRoot = React.forwardRef(
39
+ const TextBoxRoot = forwardRef(
35
40
  (props, forwardedRef) => {
36
41
  const inputRef = React.useRef(null);
37
42
  const [disabled, setDisabled] = React.useState();
@@ -61,27 +66,31 @@ const TextBoxRoot = React.forwardRef(
61
66
  }
62
67
  );
63
68
  DEV: TextBoxRoot.displayName = "TextBox.Root";
64
- const TextBoxIcon = React.forwardRef((props, forwardedRef) => {
65
- return /* @__PURE__ */ jsx(
66
- Icon,
67
- {
68
- ...props,
69
- className: cx("\u{1F95D}-text-box-decoration", props.className),
70
- ref: forwardedRef
71
- }
72
- );
73
- });
69
+ const TextBoxIcon = forwardRef(
70
+ (props, forwardedRef) => {
71
+ return /* @__PURE__ */ jsx(
72
+ Icon,
73
+ {
74
+ ...props,
75
+ className: cx("\u{1F95D}-text-box-decoration", props.className),
76
+ ref: forwardedRef
77
+ }
78
+ );
79
+ }
80
+ );
74
81
  DEV: TextBoxIcon.displayName = "TextBox.Icon";
75
- const TextBoxText = React.forwardRef((props, forwardedRef) => {
76
- return /* @__PURE__ */ jsx(
77
- Ariakit.Role.span,
78
- {
79
- ...props,
80
- className: cx("\u{1F95D}-text-box-decoration", props.className),
81
- ref: forwardedRef
82
- }
83
- );
84
- });
82
+ const TextBoxText = forwardRef(
83
+ (props, forwardedRef) => {
84
+ return /* @__PURE__ */ jsx(
85
+ Ariakit.Role.span,
86
+ {
87
+ ...props,
88
+ className: cx("\u{1F95D}-text-box-decoration", props.className),
89
+ ref: forwardedRef
90
+ }
91
+ );
92
+ }
93
+ );
85
94
  DEV: TextBoxText.displayName = "TextBox.Text";
86
95
  const TextBoxRootContext = React.createContext(void 0);
87
96
  export {