@itwin/itwinui-react 5.0.0-alpha.1 → 5.0.0-alpha.3
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 +21 -0
- package/dist/DEV/bricks/Anchor.js +1 -1
- package/dist/DEV/bricks/Button.js +1 -1
- package/dist/DEV/bricks/Checkbox.js +3 -1
- package/dist/DEV/bricks/Chip.js +21 -0
- package/dist/DEV/bricks/Description.js +27 -0
- package/dist/DEV/bricks/DropdownMenu.js +20 -1
- package/dist/DEV/bricks/Field.js +56 -5
- package/dist/DEV/bricks/Icon.js +32 -1
- package/dist/DEV/bricks/IconButton.js +3 -0
- package/dist/DEV/bricks/Kbd.js +36 -4
- package/dist/DEV/bricks/Radio.js +3 -1
- package/dist/DEV/bricks/Select.js +6 -3
- package/dist/DEV/bricks/Spinner.js +40 -0
- package/dist/DEV/bricks/Switch.js +3 -1
- package/dist/DEV/bricks/Tabs.js +1 -1
- package/dist/DEV/bricks/TextBox.js +30 -3
- package/dist/DEV/bricks/Tooltip.js +3 -3
- package/dist/DEV/bricks/Tree.js +119 -34
- package/dist/DEV/bricks/index.js +8 -0
- package/dist/DEV/bricks/styles.css.js +1 -1
- package/dist/DEV/bricks/~hooks.js +15 -2
- package/dist/DEV/foundations/styles.css.js +1 -1
- package/dist/bricks/Anchor.js +1 -1
- package/dist/bricks/Button.js +1 -1
- package/dist/bricks/Checkbox.js +3 -1
- package/dist/bricks/Chip.d.ts +22 -0
- package/dist/bricks/Chip.js +20 -0
- package/dist/bricks/Description.d.ts +20 -0
- package/dist/bricks/Description.js +27 -0
- package/dist/bricks/DropdownMenu.d.ts +13 -1
- package/dist/bricks/DropdownMenu.js +19 -1
- package/dist/bricks/Field.d.ts +8 -0
- package/dist/bricks/Field.js +56 -5
- package/dist/bricks/Icon.d.ts +3 -0
- package/dist/bricks/Icon.js +31 -1
- package/dist/bricks/IconButton.js +3 -0
- package/dist/bricks/Kbd.d.ts +30 -0
- package/dist/bricks/Kbd.js +29 -4
- package/dist/bricks/Radio.js +3 -1
- package/dist/bricks/Select.d.ts +8 -1
- package/dist/bricks/Select.js +6 -3
- package/dist/bricks/Spinner.d.ts +31 -0
- package/dist/bricks/Spinner.js +39 -0
- package/dist/bricks/Switch.js +3 -1
- package/dist/bricks/Tabs.d.ts +1 -1
- package/dist/bricks/Tabs.js +1 -1
- package/dist/bricks/TextBox.d.ts +23 -2
- package/dist/bricks/TextBox.js +29 -3
- package/dist/bricks/Tooltip.js +3 -3
- package/dist/bricks/Tree.d.ts +76 -13
- package/dist/bricks/Tree.js +116 -32
- package/dist/bricks/index.d.ts +4 -0
- package/dist/bricks/index.js +8 -0
- package/dist/bricks/styles.css.js +1 -1
- package/dist/bricks/~hooks.d.ts +16 -0
- package/dist/bricks/~hooks.js +15 -2
- package/dist/foundations/styles.css.js +1 -1
- package/package.json +2 -2
- package/dist/DEV/bricks/Textarea.js +0 -30
- package/dist/bricks/Textarea.d.ts +0 -24
- package/dist/bricks/Textarea.js +0 -29
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.0.0-alpha.3
|
|
4
|
+
|
|
5
|
+
- Added `<DropdownMenu.CheckboxItem>` component for rendering menu items with a checkable state.
|
|
6
|
+
- Added `variant` prop to `<Select.HtmlSelect>` component for displaying different visual variants of the component.
|
|
7
|
+
- Updated event handling of `Tree` components to avoid firing `onClick` event of the `<Tree.Item>` component when the expander or one of the actions is clicked.
|
|
8
|
+
- Updated `Tree` components to implement a tree view pattern instead of the previously used nested list approach.
|
|
9
|
+
- Updated size and spacing of `<Tree.Item>`, `<DropdownMenu.Item>` and `<Select>` components.
|
|
10
|
+
- Fixed `<Label>` component alignment with `TextBox` components.
|
|
11
|
+
- Fixed action rendering of `<Tree.Item>` component.
|
|
12
|
+
- Fixed `<Checkbox>` component styling, which caused the mixed checkbox to be displayed as unchecked in the light theme.
|
|
13
|
+
|
|
14
|
+
## 5.0.0-alpha.2
|
|
15
|
+
|
|
16
|
+
- Added initial `Tree` component, exposed as `<Tree.Root>` and `<Tree.Item>` subcomponents.
|
|
17
|
+
- Added initial `<Spinner>` component for indicating quick, indeterminate progress.
|
|
18
|
+
- Added `<Description>` component to be used within a `<Field>`.
|
|
19
|
+
- Added initial `<Chip>` component.
|
|
20
|
+
- Added `symbol` prop to `<Kbd>` for displaying predefined symbols.
|
|
21
|
+
- Added `focusable` prop to `<Tabs.TabPanel>` component.
|
|
22
|
+
- Fixed a visual issue where light color-scheme was using dark shadows.
|
|
23
|
+
|
|
3
24
|
## 5.0.0-alpha.1
|
|
4
25
|
|
|
5
26
|
- Added `<Text>` component with a `variant` prop to support all text styles from Figma.
|
|
@@ -7,8 +7,8 @@ const Anchor = forwardRef((props, forwardedRef) => {
|
|
|
7
7
|
return /* @__PURE__ */ jsx(
|
|
8
8
|
Ariakit.Role.a,
|
|
9
9
|
{
|
|
10
|
-
"data-kiwi-tone": tone,
|
|
11
10
|
...rest,
|
|
11
|
+
"data-kiwi-tone": tone,
|
|
12
12
|
className: cx("\u{1F95D}-anchor", props.className),
|
|
13
13
|
render: /* @__PURE__ */ jsx(
|
|
14
14
|
Ariakit.Focusable,
|
|
@@ -1,11 +1,12 @@
|
|
|
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";
|
|
4
|
+
import { useFieldDescribedBy, useFieldId } from "./Field.js";
|
|
5
5
|
import { forwardRef } from "./~utils.js";
|
|
6
6
|
const Checkbox = forwardRef(
|
|
7
7
|
(props, forwardedRef) => {
|
|
8
8
|
const fieldId = useFieldId();
|
|
9
|
+
const describedBy = useFieldDescribedBy(props["aria-describedby"]);
|
|
9
10
|
return /* @__PURE__ */ jsx(
|
|
10
11
|
Ariakit.Checkbox,
|
|
11
12
|
{
|
|
@@ -13,6 +14,7 @@ const Checkbox = forwardRef(
|
|
|
13
14
|
id: fieldId,
|
|
14
15
|
...props,
|
|
15
16
|
className: cx("\u{1F95D}-checkbox", props.className),
|
|
17
|
+
"aria-describedby": describedBy,
|
|
16
18
|
ref: forwardedRef
|
|
17
19
|
}
|
|
18
20
|
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import * as Ariakit from "@ariakit/react";
|
|
4
|
+
import { forwardRef } from "./~utils.js";
|
|
5
|
+
const Chip = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const { variant = "solid", children, ...rest } = props;
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
Ariakit.Role.div,
|
|
9
|
+
{
|
|
10
|
+
"data-kiwi-variant": variant,
|
|
11
|
+
...rest,
|
|
12
|
+
className: cx("\u{1F95D}-chip", props.className),
|
|
13
|
+
ref: forwardedRef,
|
|
14
|
+
children
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
DEV: Chip.displayName = "Chip";
|
|
19
|
+
export {
|
|
20
|
+
Chip
|
|
21
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { forwardRef } from "./~utils.js";
|
|
4
|
+
import cx from "classnames";
|
|
5
|
+
import { Text } from "./Text.js";
|
|
6
|
+
import { useFieldRegisterDescribedBy } from "./Field.js";
|
|
7
|
+
const Description = forwardRef(
|
|
8
|
+
(props, forwardedRef) => {
|
|
9
|
+
const generatedId = React.useId();
|
|
10
|
+
const { id = generatedId, tone, ...rest } = props;
|
|
11
|
+
useFieldRegisterDescribedBy(id);
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
Text,
|
|
14
|
+
{
|
|
15
|
+
...rest,
|
|
16
|
+
id,
|
|
17
|
+
variant: "caption-md",
|
|
18
|
+
"data-kiwi-tone": tone ?? "neutral",
|
|
19
|
+
className: cx("\u{1F95D}-description", props.className),
|
|
20
|
+
ref: forwardedRef
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
export {
|
|
26
|
+
Description
|
|
27
|
+
};
|
|
@@ -5,7 +5,7 @@ import * as Ariakit from "@ariakit/react";
|
|
|
5
5
|
import * as ListItem from "./ListItem.js";
|
|
6
6
|
import { Button } from "./Button.js";
|
|
7
7
|
import { Kbd } from "./Kbd.js";
|
|
8
|
-
import { DisclosureArrow } from "./Icon.js";
|
|
8
|
+
import { Checkmark, DisclosureArrow } from "./Icon.js";
|
|
9
9
|
import { forwardRef, supportsPopover } from "./~utils.js";
|
|
10
10
|
function DropdownMenu(props) {
|
|
11
11
|
const {
|
|
@@ -98,8 +98,27 @@ const DropdownMenuItem = forwardRef(
|
|
|
98
98
|
}
|
|
99
99
|
);
|
|
100
100
|
DEV: DropdownMenuItem.displayName = "DropdownMenu.Item";
|
|
101
|
+
const DropdownMenuCheckboxItem = forwardRef((props, forwardedRef) => {
|
|
102
|
+
return /* @__PURE__ */ jsxs(
|
|
103
|
+
Ariakit.MenuItemCheckbox,
|
|
104
|
+
{
|
|
105
|
+
accessibleWhenDisabled: true,
|
|
106
|
+
value: props.defaultChecked ? "on" : void 0,
|
|
107
|
+
...props,
|
|
108
|
+
render: /* @__PURE__ */ jsx(ListItem.Root, { render: props.render }),
|
|
109
|
+
className: cx("\u{1F95D}-dropdown-menu-checkbox-item", props.className),
|
|
110
|
+
ref: forwardedRef,
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ jsx(ListItem.Content, { children: props.children }),
|
|
113
|
+
/* @__PURE__ */ jsx(Checkmark, { className: "\u{1F95D}-dropdown-menu-checkmark" })
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
});
|
|
118
|
+
DEV: DropdownMenuCheckboxItem.displayName = "DropdownMenu.CheckboxItem";
|
|
101
119
|
export {
|
|
102
120
|
DropdownMenuButton as Button,
|
|
121
|
+
DropdownMenuCheckboxItem as CheckboxItem,
|
|
103
122
|
DropdownMenuContent as Content,
|
|
104
123
|
DropdownMenuItem as Item,
|
|
105
124
|
DropdownMenu as Root
|
package/dist/DEV/bricks/Field.js
CHANGED
|
@@ -5,23 +5,74 @@ import cx from "classnames";
|
|
|
5
5
|
import { forwardRef } from "./~utils.js";
|
|
6
6
|
const Field = forwardRef((props, forwardedRef) => {
|
|
7
7
|
const fieldId = React.useId();
|
|
8
|
-
const {
|
|
9
|
-
return /* @__PURE__ */ jsx(FieldIdContext.Provider, { value: fieldId, children: /* @__PURE__ */ jsx(
|
|
8
|
+
const { layout, ...rest } = props;
|
|
9
|
+
return /* @__PURE__ */ jsx(FieldIdContext.Provider, { value: fieldId, children: /* @__PURE__ */ jsx(FieldDescribedByProvider, { children: /* @__PURE__ */ jsx(
|
|
10
10
|
Ariakit.Role,
|
|
11
11
|
{
|
|
12
12
|
...rest,
|
|
13
|
-
className: cx("\u{1F95D}-field", className),
|
|
13
|
+
className: cx("\u{1F95D}-field", props.className),
|
|
14
14
|
"data-kiwi-layout": layout,
|
|
15
15
|
ref: forwardedRef
|
|
16
16
|
}
|
|
17
|
-
) });
|
|
17
|
+
) }) });
|
|
18
18
|
});
|
|
19
19
|
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
|
+
}, []);
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
FieldDescribedByContext.Provider,
|
|
39
|
+
{
|
|
40
|
+
value: React.useMemo(
|
|
41
|
+
() => ({
|
|
42
|
+
describedBy,
|
|
43
|
+
register,
|
|
44
|
+
unregister
|
|
45
|
+
}),
|
|
46
|
+
[describedBy, register, unregister]
|
|
47
|
+
),
|
|
48
|
+
children: props.children
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
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]
|
|
57
|
+
);
|
|
58
|
+
}
|
|
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]);
|
|
68
|
+
}
|
|
20
69
|
const FieldIdContext = React.createContext(void 0);
|
|
21
70
|
function useFieldId() {
|
|
22
71
|
return React.useContext(FieldIdContext);
|
|
23
72
|
}
|
|
24
73
|
export {
|
|
25
74
|
Field,
|
|
26
|
-
|
|
75
|
+
useFieldDescribedBy,
|
|
76
|
+
useFieldId,
|
|
77
|
+
useFieldRegisterDescribedBy
|
|
27
78
|
};
|
package/dist/DEV/bricks/Icon.js
CHANGED
|
@@ -9,9 +9,9 @@ const Icon = forwardRef((props, forwardedRef) => {
|
|
|
9
9
|
return /* @__PURE__ */ jsx(
|
|
10
10
|
Ariakit.Role.svg,
|
|
11
11
|
{
|
|
12
|
-
"data-kiwi-size": size,
|
|
13
12
|
"aria-hidden": true,
|
|
14
13
|
...rest,
|
|
14
|
+
"data-kiwi-size": size,
|
|
15
15
|
className: cx("\u{1F95D}-icon", props.className),
|
|
16
16
|
ref: forwardedRef,
|
|
17
17
|
children: /* @__PURE__ */ jsx("use", { href: `${props.href}#${iconId}` })
|
|
@@ -56,7 +56,38 @@ const DisclosureArrow = forwardRef(
|
|
|
56
56
|
}
|
|
57
57
|
);
|
|
58
58
|
DEV: DisclosureArrow.displayName = "DisclosureArrow";
|
|
59
|
+
const Checkmark = forwardRef(
|
|
60
|
+
(props, forwardedRef) => {
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
Icon,
|
|
63
|
+
{
|
|
64
|
+
...props,
|
|
65
|
+
render: /* @__PURE__ */ jsx(
|
|
66
|
+
Ariakit.Role.svg,
|
|
67
|
+
{
|
|
68
|
+
width: "16",
|
|
69
|
+
height: "16",
|
|
70
|
+
fill: "currentColor",
|
|
71
|
+
viewBox: "0 0 16 16",
|
|
72
|
+
render: props.render,
|
|
73
|
+
children: /* @__PURE__ */ jsx(
|
|
74
|
+
"path",
|
|
75
|
+
{
|
|
76
|
+
fillRule: "evenodd",
|
|
77
|
+
d: "M13.854 4.146a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3-3a.5.5 0 1 1 .708-.708L6.5 10.793l6.646-6.647a.5.5 0 0 1 .708 0Z",
|
|
78
|
+
clipRule: "evenodd"
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
ref: forwardedRef
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
DEV: Checkmark.displayName = "Checkmark";
|
|
59
89
|
export {
|
|
90
|
+
Checkmark,
|
|
60
91
|
DisclosureArrow,
|
|
61
92
|
Icon
|
|
62
93
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
+
import * as Ariakit from "@ariakit/react";
|
|
3
4
|
import { Button } from "./Button.js";
|
|
4
5
|
import { VisuallyHidden } from "./VisuallyHidden.js";
|
|
5
6
|
import { Icon } from "./Icon.js";
|
|
@@ -8,11 +9,13 @@ import { forwardRef } from "./~utils.js";
|
|
|
8
9
|
const IconButton = forwardRef(
|
|
9
10
|
(props, forwardedRef) => {
|
|
10
11
|
const { label, icon, isActive, labelVariant, ...rest } = props;
|
|
12
|
+
const toolbar = Ariakit.useToolbarContext();
|
|
11
13
|
const button = /* @__PURE__ */ jsxs(
|
|
12
14
|
Button,
|
|
13
15
|
{
|
|
14
16
|
"aria-pressed": isActive,
|
|
15
17
|
...rest,
|
|
18
|
+
render: toolbar ? /* @__PURE__ */ jsx(Ariakit.ToolbarItem, { render: props.render }) : props.render,
|
|
16
19
|
className: cx("\u{1F95D}-icon-button", props.className),
|
|
17
20
|
ref: forwardedRef,
|
|
18
21
|
children: [
|
package/dist/DEV/bricks/Kbd.js
CHANGED
|
@@ -1,17 +1,49 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
import * as Ariakit from "@ariakit/react";
|
|
4
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
|
+
};
|
|
5
22
|
const Kbd = forwardRef((props, forwardedRef) => {
|
|
6
|
-
const { variant = "solid", ...rest } = props;
|
|
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
|
+
] });
|
|
37
|
+
}
|
|
7
38
|
return /* @__PURE__ */ jsx(
|
|
8
39
|
Ariakit.Role,
|
|
9
40
|
{
|
|
10
|
-
"data-kiwi-variant": variant,
|
|
11
41
|
...rest,
|
|
42
|
+
"data-kiwi-variant": variant,
|
|
12
43
|
className: cx("\u{1F95D}-kbd", props.className),
|
|
13
44
|
render: props.render || /* @__PURE__ */ jsx("kbd", {}),
|
|
14
|
-
ref: forwardedRef
|
|
45
|
+
ref: forwardedRef,
|
|
46
|
+
children: content
|
|
15
47
|
}
|
|
16
48
|
);
|
|
17
49
|
});
|
package/dist/DEV/bricks/Radio.js
CHANGED
|
@@ -1,10 +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 { useFieldId } from "./Field.js";
|
|
4
|
+
import { useFieldDescribedBy, useFieldId } from "./Field.js";
|
|
5
5
|
import { forwardRef } from "./~utils.js";
|
|
6
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 = 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
|
);
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
isBrowser
|
|
8
8
|
} from "./~utils.js";
|
|
9
9
|
import { DisclosureArrow } from "./Icon.js";
|
|
10
|
-
import { useFieldId } from "./Field.js";
|
|
10
|
+
import { useFieldDescribedBy, useFieldId } from "./Field.js";
|
|
11
11
|
const supportsHas = isBrowser && CSS?.supports?.("selector(:has(+ *))");
|
|
12
12
|
const HtmlSelectContext = React.createContext(() => {
|
|
13
13
|
});
|
|
@@ -25,8 +25,10 @@ const SelectRoot = forwardRef((props, forwardedRef) => {
|
|
|
25
25
|
});
|
|
26
26
|
const HtmlSelect = forwardRef(
|
|
27
27
|
(props, forwardedRef) => {
|
|
28
|
+
const { variant = "solid", ...rest } = props;
|
|
28
29
|
const setIsHtmlSelect = React.useContext(HtmlSelectContext);
|
|
29
30
|
const fieldId = useFieldId();
|
|
31
|
+
const describedBy = useFieldDescribedBy(props["aria-describedby"]);
|
|
30
32
|
React.useEffect(
|
|
31
33
|
function updateContext() {
|
|
32
34
|
setIsHtmlSelect(true);
|
|
@@ -38,10 +40,11 @@ const HtmlSelect = forwardRef(
|
|
|
38
40
|
Ariakit.Role.select,
|
|
39
41
|
{
|
|
40
42
|
id: fieldId,
|
|
41
|
-
...
|
|
43
|
+
...rest,
|
|
42
44
|
className: cx("\u{1F95D}-button", "\u{1F95D}-select", props.className),
|
|
45
|
+
"aria-describedby": describedBy,
|
|
43
46
|
"data-kiwi-tone": "neutral",
|
|
44
|
-
"data-kiwi-variant":
|
|
47
|
+
"data-kiwi-variant": variant,
|
|
45
48
|
ref: forwardedRef
|
|
46
49
|
}
|
|
47
50
|
),
|
|
@@ -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,11 +1,12 @@
|
|
|
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";
|
|
4
|
+
import { useFieldDescribedBy, useFieldId } from "./Field.js";
|
|
5
5
|
import { forwardRef } from "./~utils.js";
|
|
6
6
|
const Switch = forwardRef(
|
|
7
7
|
(props, forwardedRef) => {
|
|
8
8
|
const fieldId = useFieldId();
|
|
9
|
+
const describedBy = useFieldDescribedBy(props["aria-describedby"]);
|
|
9
10
|
return /* @__PURE__ */ jsx(
|
|
10
11
|
Ariakit.Checkbox,
|
|
11
12
|
{
|
|
@@ -13,6 +14,7 @@ const Switch = forwardRef(
|
|
|
13
14
|
id: fieldId,
|
|
14
15
|
...props,
|
|
15
16
|
className: cx("\u{1F95D}-switch", props.className),
|
|
17
|
+
"aria-describedby": describedBy,
|
|
16
18
|
role: "switch",
|
|
17
19
|
ref: forwardedRef
|
|
18
20
|
}
|
package/dist/DEV/bricks/Tabs.js
CHANGED
|
@@ -48,8 +48,8 @@ const TabList = forwardRef((props, forwardedRef) => {
|
|
|
48
48
|
return /* @__PURE__ */ jsx(
|
|
49
49
|
Ariakit.TabList,
|
|
50
50
|
{
|
|
51
|
-
"data-kiwi-tone": tone,
|
|
52
51
|
...rest,
|
|
52
|
+
"data-kiwi-tone": tone,
|
|
53
53
|
className: cx("\u{1F95D}-tab-list", props.className),
|
|
54
54
|
style: {
|
|
55
55
|
"--\u{1F95D}tab-active-stripe-view-transition-name": viewTransitionName,
|
|
@@ -2,13 +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 { useFieldId } from "./Field.js";
|
|
5
|
+
import { useFieldDescribedBy, useFieldId } from "./Field.js";
|
|
6
6
|
import { Icon } from "./Icon.js";
|
|
7
|
-
import { Textarea } from "./Textarea.js";
|
|
8
7
|
import { useMergedRefs } from "./~hooks.js";
|
|
9
8
|
import { forwardRef } from "./~utils.js";
|
|
10
9
|
const TextBoxInput = forwardRef(
|
|
11
10
|
(props, forwardedRef) => {
|
|
11
|
+
const describedBy = useFieldDescribedBy(props["aria-describedby"]);
|
|
12
12
|
const fieldId = useFieldId();
|
|
13
13
|
const rootContext = React.useContext(TextBoxRootContext);
|
|
14
14
|
const setDisabled = rootContext?.setDisabled;
|
|
@@ -20,7 +20,9 @@ const TextBoxInput = forwardRef(
|
|
|
20
20
|
{
|
|
21
21
|
id: fieldId,
|
|
22
22
|
...props,
|
|
23
|
+
"aria-describedby": describedBy,
|
|
23
24
|
className: cx({ "\u{1F95D}-text-box": !rootContext }, props.className),
|
|
25
|
+
placeholder: props.placeholder ?? " ",
|
|
24
26
|
render: /* @__PURE__ */ jsx(
|
|
25
27
|
Ariakit.Focusable,
|
|
26
28
|
{
|
|
@@ -34,6 +36,31 @@ const TextBoxInput = forwardRef(
|
|
|
34
36
|
}
|
|
35
37
|
);
|
|
36
38
|
DEV: TextBoxInput.displayName = "TextBox.Input";
|
|
39
|
+
const TextBoxTextarea = forwardRef(
|
|
40
|
+
(props, forwardedRef) => {
|
|
41
|
+
const fieldId = useFieldId();
|
|
42
|
+
const describedBy = useFieldDescribedBy(props["aria-describedby"]);
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
Ariakit.Role.textarea,
|
|
45
|
+
{
|
|
46
|
+
id: fieldId,
|
|
47
|
+
...props,
|
|
48
|
+
className: cx("\u{1F95D}-text-box", props.className),
|
|
49
|
+
"aria-describedby": describedBy,
|
|
50
|
+
placeholder: props.placeholder ?? " ",
|
|
51
|
+
render: /* @__PURE__ */ jsx(
|
|
52
|
+
Ariakit.Focusable,
|
|
53
|
+
{
|
|
54
|
+
accessibleWhenDisabled: true,
|
|
55
|
+
render: props.render || /* @__PURE__ */ jsx("textarea", {})
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
ref: forwardedRef
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
DEV: TextBoxTextarea.displayName = "TextBox.Textarea";
|
|
37
64
|
const TextBoxRoot = forwardRef(
|
|
38
65
|
(props, forwardedRef) => {
|
|
39
66
|
const inputRef = React.useRef(null);
|
|
@@ -96,5 +123,5 @@ export {
|
|
|
96
123
|
TextBoxInput as Input,
|
|
97
124
|
TextBoxRoot as Root,
|
|
98
125
|
TextBoxText as Text,
|
|
99
|
-
Textarea
|
|
126
|
+
TextBoxTextarea as Textarea
|
|
100
127
|
};
|
|
@@ -5,12 +5,12 @@ import * as Ariakit from "@ariakit/react";
|
|
|
5
5
|
import { forwardRef, supportsPopover } from "./~utils.js";
|
|
6
6
|
const Tooltip = forwardRef(
|
|
7
7
|
(props, forwardedRef) => {
|
|
8
|
+
const generatedId = React.useId();
|
|
8
9
|
const {
|
|
9
10
|
content,
|
|
10
11
|
children,
|
|
11
|
-
className,
|
|
12
12
|
type = "description",
|
|
13
|
-
id =
|
|
13
|
+
id = generatedId,
|
|
14
14
|
defaultOpen: defaultOpenProp,
|
|
15
15
|
open: openProp,
|
|
16
16
|
setOpen: setOpenProp,
|
|
@@ -53,7 +53,7 @@ const Tooltip = forwardRef(
|
|
|
53
53
|
"aria-hidden": "true",
|
|
54
54
|
...rest,
|
|
55
55
|
unmountOnHide,
|
|
56
|
-
className: cx("\u{1F95D}-tooltip", className),
|
|
56
|
+
className: cx("\u{1F95D}-tooltip", props.className),
|
|
57
57
|
ref: forwardedRef,
|
|
58
58
|
id,
|
|
59
59
|
style: {
|