@itwin/itwinui-react 5.0.0-alpha.8 → 5.0.0-alpha.9
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 +11 -1
- package/LICENSE.md +1 -1
- package/dist/DEV/bricks/Anchor.js +4 -9
- package/dist/DEV/bricks/Avatar.js +2 -2
- package/dist/DEV/bricks/Badge.js +2 -2
- package/dist/DEV/bricks/Button.js +10 -3
- package/dist/DEV/bricks/Checkbox.js +4 -2
- package/dist/DEV/bricks/Chip.js +2 -2
- package/dist/DEV/bricks/Divider.js +3 -2
- package/dist/DEV/bricks/DropdownMenu.js +79 -19
- package/dist/DEV/bricks/Field.js +21 -17
- package/dist/DEV/bricks/Icon.js +5 -5
- package/dist/DEV/bricks/IconButton.js +14 -6
- package/dist/DEV/bricks/Kbd.internal.js +19 -0
- package/dist/DEV/bricks/Kbd.js +3 -18
- package/dist/DEV/bricks/Label.js +2 -2
- package/dist/DEV/bricks/Radio.js +4 -2
- package/dist/DEV/bricks/Root.js +35 -4
- package/dist/DEV/bricks/Select.js +3 -3
- package/dist/DEV/bricks/Spinner.js +2 -2
- package/dist/DEV/bricks/Switch.js +4 -2
- package/dist/DEV/bricks/Table.js +7 -7
- package/dist/DEV/bricks/Tabs.js +5 -5
- package/dist/DEV/bricks/Text.js +2 -2
- package/dist/DEV/bricks/TextBox.js +8 -7
- package/dist/DEV/bricks/Tooltip.js +5 -5
- package/dist/DEV/bricks/Tree.js +8 -195
- package/dist/DEV/bricks/TreeItem.js +219 -0
- package/dist/DEV/bricks/VisuallyHidden.js +2 -2
- package/dist/DEV/bricks/styles.css.js +1 -1
- package/dist/DEV/bricks/~hooks.js +11 -6
- package/dist/DEV/bricks/~utils.GhostAligner.js +13 -0
- package/dist/DEV/bricks/{ListItem.js → ~utils.ListItem.js} +3 -3
- package/dist/bricks/Anchor.js +4 -9
- package/dist/bricks/Avatar.js +2 -2
- package/dist/bricks/Badge.js +2 -2
- package/dist/bricks/Button.js +10 -3
- package/dist/bricks/Checkbox.d.ts +2 -2
- package/dist/bricks/Checkbox.js +4 -2
- package/dist/bricks/Chip.js +2 -2
- package/dist/bricks/Divider.d.ts +2 -2
- package/dist/bricks/Divider.js +3 -2
- package/dist/bricks/DropdownMenu.d.ts +38 -23
- package/dist/bricks/DropdownMenu.js +77 -19
- package/dist/bricks/Field.d.ts +5 -5
- package/dist/bricks/Field.js +21 -17
- package/dist/bricks/Icon.js +5 -5
- package/dist/bricks/IconButton.d.ts +18 -2
- package/dist/bricks/IconButton.js +14 -6
- package/dist/bricks/Kbd.d.ts +2 -17
- package/dist/bricks/Kbd.internal.d.ts +17 -0
- package/dist/bricks/Kbd.internal.js +19 -0
- package/dist/bricks/Kbd.js +3 -18
- package/dist/bricks/Label.js +2 -2
- package/dist/bricks/Radio.d.ts +2 -2
- package/dist/bricks/Radio.js +4 -2
- package/dist/bricks/Root.js +35 -4
- package/dist/bricks/Select.d.ts +1 -2
- package/dist/bricks/Select.js +3 -3
- package/dist/bricks/Spinner.js +2 -2
- package/dist/bricks/Switch.d.ts +2 -2
- package/dist/bricks/Switch.js +4 -2
- package/dist/bricks/Table.js +7 -7
- package/dist/bricks/Tabs.d.ts +4 -4
- package/dist/bricks/Tabs.js +5 -5
- package/dist/bricks/Text.js +2 -2
- package/dist/bricks/TextBox.js +8 -7
- package/dist/bricks/Tooltip.d.ts +2 -2
- package/dist/bricks/Tooltip.js +5 -5
- package/dist/bricks/Tree.d.ts +3 -110
- package/dist/bricks/Tree.js +8 -190
- package/dist/bricks/TreeItem.d.ts +123 -0
- package/dist/bricks/TreeItem.js +214 -0
- package/dist/bricks/VisuallyHidden.js +2 -2
- package/dist/bricks/styles.css.js +1 -1
- package/dist/bricks/~hooks.d.ts +11 -2
- package/dist/bricks/~hooks.js +11 -6
- package/dist/bricks/~utils.GhostAligner.d.ts +22 -0
- package/dist/bricks/~utils.GhostAligner.js +13 -0
- package/dist/bricks/{ListItem.d.ts → ~utils.ListItem.d.ts} +5 -5
- package/dist/bricks/{ListItem.js → ~utils.ListItem.js} +3 -3
- package/dist/bricks/~utils.d.ts +6 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.0.0-alpha.9
|
|
4
|
+
|
|
5
|
+
- Added `dot` prop to `<IconButton>` for showing a small "dot" next to the icon.
|
|
6
|
+
- Added `unstable_decorations` prop to `<Tree.Item>` for showing multiple decorations (e.g. icons).
|
|
7
|
+
- **breaking**: Replaced `<DropdownMenu.Item>` children with new `label` prop (see [#423](https://github.com/iTwin/design-system/pull/423)).
|
|
8
|
+
- Added `icon` prop to `<DropdownMenu.Item>` and `<DropdownMenu.CheckboxItem>`.
|
|
9
|
+
- Updated the `shortcuts` prop of `<DropdownMenu.Item>` to recognize predefined "symbols" (e.g. modifier keys).
|
|
10
|
+
- Updated `<Anchor>` and `<Badge>` visuals to match the latest design.
|
|
11
|
+
- Fixed forced-colors mode styling for `DropdownMenu`.
|
|
12
|
+
|
|
3
13
|
## 5.0.0-alpha.8
|
|
4
14
|
|
|
5
15
|
- Added `description` prop to `<Tree.Item>` component for showing "sublabels".
|
|
6
|
-
- **breaking**: Updated `<Text>`
|
|
16
|
+
- **breaking**: Updated `<Text>` component to require `variant` prop.
|
|
7
17
|
- (soft breaking) Removed `children` from `<Tree.Item>` prop types.
|
|
8
18
|
- Updated `DropdownMenu` padding.
|
|
9
19
|
|
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MIT License
|
|
2
2
|
|
|
3
|
-
Copyright ©
|
|
3
|
+
Copyright © 2025 Bentley Systems, Incorporated. All rights reserved.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
6
|
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
|
+
import { Focusable } from "@ariakit/react/focusable";
|
|
4
5
|
import { forwardRef } from "./~utils.js";
|
|
5
6
|
const Anchor = forwardRef((props, forwardedRef) => {
|
|
6
7
|
const { tone = "neutral", ...rest } = props;
|
|
7
8
|
return /* @__PURE__ */ jsx(
|
|
8
|
-
|
|
9
|
+
Role.a,
|
|
9
10
|
{
|
|
10
11
|
...rest,
|
|
11
12
|
"data-kiwi-tone": tone,
|
|
12
13
|
className: cx("\u{1F95D}-anchor", props.className),
|
|
13
|
-
render: /* @__PURE__ */ jsx(
|
|
14
|
-
Ariakit.Focusable,
|
|
15
|
-
{
|
|
16
|
-
accessibleWhenDisabled: true,
|
|
17
|
-
render: props.render || /* @__PURE__ */ jsx("a", {})
|
|
18
|
-
}
|
|
19
|
-
),
|
|
14
|
+
render: /* @__PURE__ */ jsx(Focusable, { accessibleWhenDisabled: true, render: props.render || /* @__PURE__ */ jsx("a", {}) }),
|
|
20
15
|
ref: forwardedRef
|
|
21
16
|
}
|
|
22
17
|
);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
4
|
import { forwardRef } from "./~utils.js";
|
|
5
5
|
const Avatar = forwardRef((props, forwardedRef) => {
|
|
6
6
|
const { size = "medium", initials, alt, image, children, ...rest } = props;
|
|
7
7
|
const isDecorative = !alt;
|
|
8
8
|
return /* @__PURE__ */ jsx(
|
|
9
|
-
|
|
9
|
+
Role.span,
|
|
10
10
|
{
|
|
11
11
|
role: isDecorative ? void 0 : "img",
|
|
12
12
|
"aria-label": isDecorative ? void 0 : alt,
|
package/dist/DEV/bricks/Badge.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
4
|
import { forwardRef } from "./~utils.js";
|
|
5
5
|
const Badge = forwardRef((props, forwardedRef) => {
|
|
6
6
|
const { tone = "neutral", variant = "solid", label, ...rest } = props;
|
|
7
7
|
return /* @__PURE__ */ jsx(
|
|
8
|
-
|
|
8
|
+
Role.span,
|
|
9
9
|
{
|
|
10
10
|
...rest,
|
|
11
11
|
"data-kiwi-tone": tone,
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import
|
|
3
|
+
import { Button as AkButton } from "@ariakit/react/button";
|
|
4
4
|
import { forwardRef } from "./~utils.js";
|
|
5
|
+
import { useGhostAlignment } from "./~utils.GhostAligner.js";
|
|
5
6
|
const Button = forwardRef(
|
|
6
7
|
(props, forwardedRef) => {
|
|
7
8
|
const { variant = "solid", tone = "neutral", ...rest } = props;
|
|
9
|
+
const ghostAlignment = useGhostAlignment();
|
|
8
10
|
return /* @__PURE__ */ jsx(
|
|
9
|
-
|
|
11
|
+
AkButton,
|
|
10
12
|
{
|
|
11
13
|
accessibleWhenDisabled: true,
|
|
12
14
|
...rest,
|
|
13
15
|
"data-kiwi-variant": variant,
|
|
14
16
|
"data-kiwi-tone": tone,
|
|
15
|
-
|
|
17
|
+
"data-kiwi-ghost-align": variant === "ghost" ? ghostAlignment : void 0,
|
|
18
|
+
className: cx(
|
|
19
|
+
"\u{1F95D}-button",
|
|
20
|
+
{ "\u{1F95D}-ghost-aligner": variant === "ghost" },
|
|
21
|
+
props.className
|
|
22
|
+
),
|
|
16
23
|
ref: forwardedRef
|
|
17
24
|
}
|
|
18
25
|
);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import
|
|
3
|
+
import {
|
|
4
|
+
Checkbox as AkCheckbox
|
|
5
|
+
} from "@ariakit/react/checkbox";
|
|
4
6
|
import { FieldControl } from "./Field.js";
|
|
5
7
|
import { forwardRef } from "./~utils.js";
|
|
6
8
|
const Checkbox = forwardRef(
|
|
@@ -12,7 +14,7 @@ const Checkbox = forwardRef(
|
|
|
12
14
|
type: "checkable",
|
|
13
15
|
id,
|
|
14
16
|
render: /* @__PURE__ */ jsx(
|
|
15
|
-
|
|
17
|
+
AkCheckbox,
|
|
16
18
|
{
|
|
17
19
|
accessibleWhenDisabled: true,
|
|
18
20
|
...rest,
|
package/dist/DEV/bricks/Chip.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import
|
|
4
|
+
import { Role } from "@ariakit/react/role";
|
|
5
5
|
import { forwardRef } from "./~utils.js";
|
|
6
6
|
import { IconButton } from "./IconButton.js";
|
|
7
7
|
import { Dismiss } from "./Icon.js";
|
|
@@ -11,7 +11,7 @@ const Chip = forwardRef((props, forwardedRef) => {
|
|
|
11
11
|
const labelId = `${baseId}-label`;
|
|
12
12
|
const dismissIconId = `${baseId}-dismiss`;
|
|
13
13
|
return /* @__PURE__ */ jsxs(
|
|
14
|
-
|
|
14
|
+
Role.div,
|
|
15
15
|
{
|
|
16
16
|
"data-kiwi-variant": variant,
|
|
17
17
|
...rest,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
|
+
import { Separator } from "@ariakit/react/separator";
|
|
4
5
|
import { forwardRef } from "./~utils.js";
|
|
5
6
|
const Divider = forwardRef((props, forwardedRef) => {
|
|
6
7
|
const { presentational, ...rest } = props;
|
|
7
|
-
const Comp = presentational ?
|
|
8
|
+
const Comp = presentational ? Role : Separator;
|
|
8
9
|
return /* @__PURE__ */ jsx(
|
|
9
10
|
Comp,
|
|
10
11
|
{
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import cx from "classnames";
|
|
4
|
-
import * as
|
|
5
|
-
import * as ListItem from "./ListItem.js";
|
|
4
|
+
import * as ListItem from "./~utils.ListItem.js";
|
|
6
5
|
import { Button } from "./Button.js";
|
|
7
6
|
import { Kbd } from "./Kbd.js";
|
|
8
|
-
import { Checkmark, DisclosureArrow } from "./Icon.js";
|
|
9
|
-
import {
|
|
7
|
+
import { Checkmark, DisclosureArrow, Icon } from "./Icon.js";
|
|
8
|
+
import {
|
|
9
|
+
forwardRef
|
|
10
|
+
} from "./~utils.js";
|
|
10
11
|
import { usePopoverApi } from "./~hooks.js";
|
|
12
|
+
import {
|
|
13
|
+
MenuProvider,
|
|
14
|
+
useMenuContext,
|
|
15
|
+
Menu,
|
|
16
|
+
MenuButton,
|
|
17
|
+
MenuItem,
|
|
18
|
+
MenuItemCheckbox
|
|
19
|
+
} from "@ariakit/react/menu";
|
|
20
|
+
import { predefinedSymbols } from "./Kbd.internal.js";
|
|
11
21
|
function DropdownMenu(props) {
|
|
12
22
|
const {
|
|
13
23
|
children,
|
|
@@ -17,7 +27,7 @@ function DropdownMenu(props) {
|
|
|
17
27
|
defaultOpen: defaultOpenProp
|
|
18
28
|
} = props;
|
|
19
29
|
return /* @__PURE__ */ jsx(
|
|
20
|
-
|
|
30
|
+
MenuProvider,
|
|
21
31
|
{
|
|
22
32
|
placement,
|
|
23
33
|
defaultOpen: defaultOpenProp,
|
|
@@ -30,9 +40,9 @@ function DropdownMenu(props) {
|
|
|
30
40
|
DEV: DropdownMenu.displayName = "DropdownMenu.Root";
|
|
31
41
|
const DropdownMenuContent = forwardRef(
|
|
32
42
|
(props, forwardedRef) => {
|
|
33
|
-
const popover = usePopoverApi(
|
|
43
|
+
const popover = usePopoverApi(useMenuContext());
|
|
34
44
|
return /* @__PURE__ */ jsx(
|
|
35
|
-
|
|
45
|
+
Menu,
|
|
36
46
|
{
|
|
37
47
|
portal: popover.portal,
|
|
38
48
|
unmountOnHide: true,
|
|
@@ -51,7 +61,7 @@ const DropdownMenuButton = forwardRef(
|
|
|
51
61
|
(props, forwardedRef) => {
|
|
52
62
|
const { accessibleWhenDisabled = true, children, ...rest } = props;
|
|
53
63
|
return /* @__PURE__ */ jsx(
|
|
54
|
-
|
|
64
|
+
MenuButton,
|
|
55
65
|
{
|
|
56
66
|
accessibleWhenDisabled: true,
|
|
57
67
|
render: /* @__PURE__ */ jsxs(Button, { accessibleWhenDisabled, children: [
|
|
@@ -68,13 +78,9 @@ const DropdownMenuButton = forwardRef(
|
|
|
68
78
|
DEV: DropdownMenuButton.displayName = "DropdownMenu.Button";
|
|
69
79
|
const DropdownMenuItem = forwardRef(
|
|
70
80
|
(props, forwardedRef) => {
|
|
71
|
-
const { shortcuts, ...rest } = props;
|
|
72
|
-
const shortcutKeys = React.useMemo(() => {
|
|
73
|
-
return typeof shortcuts === "string" ? shortcuts.split("+").map((key) => key.trim()) : [];
|
|
74
|
-
}, [shortcuts]);
|
|
75
|
-
const hasShortcuts = shortcutKeys.length > 0;
|
|
81
|
+
const { label, shortcuts, icon, ...rest } = props;
|
|
76
82
|
return /* @__PURE__ */ jsxs(
|
|
77
|
-
|
|
83
|
+
MenuItem,
|
|
78
84
|
{
|
|
79
85
|
accessibleWhenDisabled: true,
|
|
80
86
|
...rest,
|
|
@@ -82,26 +88,80 @@ const DropdownMenuItem = forwardRef(
|
|
|
82
88
|
className: cx("\u{1F95D}-dropdown-menu-item", props.className),
|
|
83
89
|
ref: forwardedRef,
|
|
84
90
|
children: [
|
|
85
|
-
/* @__PURE__ */ jsx(
|
|
86
|
-
|
|
91
|
+
icon ? /* @__PURE__ */ jsx(DropdownMenuIcon, { icon }) : null,
|
|
92
|
+
/* @__PURE__ */ jsx(ListItem.Content, { children: label }),
|
|
93
|
+
shortcuts ? /* @__PURE__ */ jsx(DropdownMenuItemShortcuts, { shortcuts }) : null
|
|
87
94
|
]
|
|
88
95
|
}
|
|
89
96
|
);
|
|
90
97
|
}
|
|
91
98
|
);
|
|
92
99
|
DEV: DropdownMenuItem.displayName = "DropdownMenu.Item";
|
|
100
|
+
const DropdownMenuItemShortcuts = forwardRef((props, forwardedRef) => {
|
|
101
|
+
const { shortcuts, ...rest } = props;
|
|
102
|
+
const shortcutKeys = React.useMemo(() => {
|
|
103
|
+
return shortcuts.split("+").map((key) => ({
|
|
104
|
+
key: key.trim(),
|
|
105
|
+
isSymbol: key in predefinedSymbols
|
|
106
|
+
}));
|
|
107
|
+
}, [shortcuts]);
|
|
108
|
+
return /* @__PURE__ */ jsx(
|
|
109
|
+
ListItem.Decoration,
|
|
110
|
+
{
|
|
111
|
+
...rest,
|
|
112
|
+
className: cx("\u{1F95D}-dropdown-menu-item-shortcuts", props.className),
|
|
113
|
+
ref: forwardedRef,
|
|
114
|
+
children: shortcutKeys.map(({ key, isSymbol }, index) => {
|
|
115
|
+
if (isSymbol) {
|
|
116
|
+
return /* @__PURE__ */ jsx(
|
|
117
|
+
Kbd,
|
|
118
|
+
{
|
|
119
|
+
variant: "ghost",
|
|
120
|
+
symbol: key
|
|
121
|
+
},
|
|
122
|
+
`${key + index}`
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
return /* @__PURE__ */ jsx(Kbd, { variant: "ghost", children: key }, `${key + index}`);
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
});
|
|
130
|
+
DEV: DropdownMenuItemShortcuts.displayName = "DropdownMenuItemShortcuts";
|
|
131
|
+
const DropdownMenuIcon = forwardRef(
|
|
132
|
+
(props, forwardedRef) => {
|
|
133
|
+
const { icon, ...rest } = props;
|
|
134
|
+
return /* @__PURE__ */ jsx(
|
|
135
|
+
ListItem.Decoration,
|
|
136
|
+
{
|
|
137
|
+
render: /* @__PURE__ */ jsx(
|
|
138
|
+
Icon,
|
|
139
|
+
{
|
|
140
|
+
href: typeof icon === "string" ? icon : void 0,
|
|
141
|
+
render: React.isValidElement(icon) ? icon : void 0
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
...rest,
|
|
145
|
+
ref: forwardedRef
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
DEV: DropdownMenuIcon.displayName = "DropdownMenuIcon";
|
|
93
151
|
const DropdownMenuCheckboxItem = forwardRef((props, forwardedRef) => {
|
|
152
|
+
const { label, icon, ...rest } = props;
|
|
94
153
|
return /* @__PURE__ */ jsxs(
|
|
95
|
-
|
|
154
|
+
MenuItemCheckbox,
|
|
96
155
|
{
|
|
97
156
|
accessibleWhenDisabled: true,
|
|
98
157
|
value: props.defaultChecked ? "on" : void 0,
|
|
99
|
-
...
|
|
158
|
+
...rest,
|
|
100
159
|
render: /* @__PURE__ */ jsx(ListItem.Root, { render: props.render }),
|
|
101
160
|
className: cx("\u{1F95D}-dropdown-menu-item", props.className),
|
|
102
161
|
ref: forwardedRef,
|
|
103
162
|
children: [
|
|
104
|
-
/* @__PURE__ */ jsx(
|
|
163
|
+
icon ? /* @__PURE__ */ jsx(DropdownMenuIcon, { icon }) : null,
|
|
164
|
+
/* @__PURE__ */ jsx(ListItem.Content, { children: label }),
|
|
105
165
|
/* @__PURE__ */ jsx(
|
|
106
166
|
ListItem.Decoration,
|
|
107
167
|
{
|
package/dist/DEV/bricks/Field.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import * as Ariakit from "@ariakit/react";
|
|
4
3
|
import cx from "classnames";
|
|
4
|
+
import { Role } from "@ariakit/react/role";
|
|
5
|
+
import {
|
|
6
|
+
useCollectionStore,
|
|
7
|
+
Collection,
|
|
8
|
+
useCollectionContext,
|
|
9
|
+
CollectionItem
|
|
10
|
+
} from "@ariakit/react/collection";
|
|
11
|
+
import { useStoreState } from "@ariakit/react/store";
|
|
5
12
|
import { forwardRef } from "./~utils.js";
|
|
6
13
|
const Field = forwardRef((props, forwardedRef) => {
|
|
7
14
|
const { layout, ...rest } = props;
|
|
@@ -9,7 +16,7 @@ const Field = forwardRef((props, forwardedRef) => {
|
|
|
9
16
|
FieldCollection,
|
|
10
17
|
{
|
|
11
18
|
render: /* @__PURE__ */ jsx(
|
|
12
|
-
|
|
19
|
+
Role.div,
|
|
13
20
|
{
|
|
14
21
|
...rest,
|
|
15
22
|
className: cx("\u{1F95D}-field", props.className),
|
|
@@ -22,13 +29,10 @@ const Field = forwardRef((props, forwardedRef) => {
|
|
|
22
29
|
});
|
|
23
30
|
DEV: Field.displayName = "Field";
|
|
24
31
|
function FieldCollection(props) {
|
|
25
|
-
const fieldElementCollection =
|
|
32
|
+
const fieldElementCollection = useCollectionStore({
|
|
26
33
|
defaultItems: []
|
|
27
34
|
});
|
|
28
|
-
const renderedItems =
|
|
29
|
-
fieldElementCollection,
|
|
30
|
-
"renderedItems"
|
|
31
|
-
);
|
|
35
|
+
const renderedItems = useStoreState(fieldElementCollection, "renderedItems");
|
|
32
36
|
const [controlType, controlIndex] = React.useMemo(() => {
|
|
33
37
|
const controlIndex2 = renderedItems.findIndex(
|
|
34
38
|
(item) => item.elementType === "control"
|
|
@@ -43,7 +47,7 @@ function FieldCollection(props) {
|
|
|
43
47
|
return labelIndex < controlIndex ? "before" : "after";
|
|
44
48
|
}, [renderedItems, controlIndex]);
|
|
45
49
|
return /* @__PURE__ */ jsx(
|
|
46
|
-
|
|
50
|
+
Collection,
|
|
47
51
|
{
|
|
48
52
|
...props,
|
|
49
53
|
store: fieldElementCollection,
|
|
@@ -53,10 +57,10 @@ function FieldCollection(props) {
|
|
|
53
57
|
);
|
|
54
58
|
}
|
|
55
59
|
function FieldControl(props) {
|
|
56
|
-
const store =
|
|
60
|
+
const store = useCollectionContext();
|
|
57
61
|
const generatedId = React.useId();
|
|
58
62
|
const { id = store ? generatedId : void 0, type, ...rest } = props;
|
|
59
|
-
const renderedItems =
|
|
63
|
+
const renderedItems = useStoreState(store, "renderedItems");
|
|
60
64
|
const describedBy = React.useMemo(() => {
|
|
61
65
|
const idRefList = renderedItems?.filter(
|
|
62
66
|
(item) => item.elementType === "description"
|
|
@@ -72,17 +76,17 @@ function FieldControl(props) {
|
|
|
72
76
|
[type]
|
|
73
77
|
);
|
|
74
78
|
return /* @__PURE__ */ jsx(
|
|
75
|
-
|
|
79
|
+
CollectionItem,
|
|
76
80
|
{
|
|
77
81
|
id,
|
|
78
82
|
getItem: getData,
|
|
79
|
-
render: /* @__PURE__ */ jsx(
|
|
83
|
+
render: /* @__PURE__ */ jsx(Role, { ...rest, "aria-describedby": describedBy })
|
|
80
84
|
}
|
|
81
85
|
);
|
|
82
86
|
}
|
|
83
87
|
function FieldLabel(props) {
|
|
84
|
-
const store =
|
|
85
|
-
const renderedItems =
|
|
88
|
+
const store = useCollectionContext();
|
|
89
|
+
const renderedItems = useStoreState(store, "renderedItems");
|
|
86
90
|
const fieldId = React.useMemo(
|
|
87
91
|
() => renderedItems?.find(
|
|
88
92
|
(item) => item.elementType === "control"
|
|
@@ -97,10 +101,10 @@ function FieldLabel(props) {
|
|
|
97
101
|
[]
|
|
98
102
|
);
|
|
99
103
|
return /* @__PURE__ */ jsx(
|
|
100
|
-
|
|
104
|
+
CollectionItem,
|
|
101
105
|
{
|
|
102
106
|
getItem: getData,
|
|
103
|
-
render: /* @__PURE__ */ jsx(
|
|
107
|
+
render: /* @__PURE__ */ jsx(Role.label, { ...props, htmlFor: fieldId })
|
|
104
108
|
}
|
|
105
109
|
);
|
|
106
110
|
}
|
|
@@ -114,7 +118,7 @@ function FieldDescription(props) {
|
|
|
114
118
|
}),
|
|
115
119
|
[]
|
|
116
120
|
);
|
|
117
|
-
return /* @__PURE__ */ jsx(
|
|
121
|
+
return /* @__PURE__ */ jsx(CollectionItem, { ...rest, id, getItem: getData });
|
|
118
122
|
}
|
|
119
123
|
export {
|
|
120
124
|
Field,
|
package/dist/DEV/bricks/Icon.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import cx from "classnames";
|
|
4
|
-
import
|
|
4
|
+
import { Role } from "@ariakit/react/role";
|
|
5
5
|
import { forwardRef } from "./~utils.js";
|
|
6
6
|
const Icon = forwardRef((props, forwardedRef) => {
|
|
7
7
|
const { href, size, alt, ...rest } = props;
|
|
8
8
|
const iconId = toIconId(size);
|
|
9
9
|
const isDecorative = !alt;
|
|
10
10
|
return /* @__PURE__ */ jsx(
|
|
11
|
-
|
|
11
|
+
Role.svg,
|
|
12
12
|
{
|
|
13
13
|
"aria-hidden": isDecorative ? "true" : void 0,
|
|
14
14
|
role: isDecorative ? void 0 : "img",
|
|
@@ -42,7 +42,7 @@ const DisclosureArrow = forwardRef(
|
|
|
42
42
|
{
|
|
43
43
|
...rest,
|
|
44
44
|
render: /* @__PURE__ */ jsx(
|
|
45
|
-
|
|
45
|
+
Role.svg,
|
|
46
46
|
{
|
|
47
47
|
width: "16",
|
|
48
48
|
height: "16",
|
|
@@ -66,7 +66,7 @@ const Checkmark = forwardRef(
|
|
|
66
66
|
{
|
|
67
67
|
...props,
|
|
68
68
|
render: /* @__PURE__ */ jsx(
|
|
69
|
-
|
|
69
|
+
Role.svg,
|
|
70
70
|
{
|
|
71
71
|
width: "16",
|
|
72
72
|
height: "16",
|
|
@@ -96,7 +96,7 @@ const Dismiss = forwardRef(
|
|
|
96
96
|
{
|
|
97
97
|
...props,
|
|
98
98
|
render: /* @__PURE__ */ jsx(
|
|
99
|
-
|
|
99
|
+
Role.svg,
|
|
100
100
|
{
|
|
101
101
|
width: "16",
|
|
102
102
|
height: "16",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
2
3
|
import cx from "classnames";
|
|
3
|
-
import
|
|
4
|
+
import { useToolbarContext, ToolbarItem } from "@ariakit/react/toolbar";
|
|
4
5
|
import { Button } from "./Button.js";
|
|
5
6
|
import { VisuallyHidden } from "./VisuallyHidden.js";
|
|
6
7
|
import { Icon } from "./Icon.js";
|
|
@@ -8,19 +9,26 @@ import { Tooltip } from "./Tooltip.js";
|
|
|
8
9
|
import { forwardRef } from "./~utils.js";
|
|
9
10
|
const IconButton = forwardRef(
|
|
10
11
|
(props, forwardedRef) => {
|
|
11
|
-
const { label, icon, isActive, labelVariant, ...rest } = props;
|
|
12
|
-
const
|
|
12
|
+
const { label, icon, isActive, labelVariant, dot, ...rest } = props;
|
|
13
|
+
const baseId = React.useId();
|
|
14
|
+
const labelId = `${baseId}-label`;
|
|
15
|
+
const dotId = `${baseId}-dot`;
|
|
16
|
+
const toolbar = useToolbarContext();
|
|
13
17
|
const button = /* @__PURE__ */ jsxs(
|
|
14
18
|
Button,
|
|
15
19
|
{
|
|
16
20
|
"aria-pressed": isActive,
|
|
21
|
+
"aria-labelledby": labelId,
|
|
22
|
+
"aria-describedby": dot ? dotId : void 0,
|
|
17
23
|
...rest,
|
|
18
|
-
|
|
24
|
+
"data-kiwi-dot": dot ? "true" : void 0,
|
|
25
|
+
render: toolbar ? /* @__PURE__ */ jsx(ToolbarItem, { render: props.render }) : props.render,
|
|
19
26
|
className: cx("\u{1F95D}-icon-button", props.className),
|
|
20
27
|
ref: forwardedRef,
|
|
21
28
|
children: [
|
|
22
|
-
/* @__PURE__ */ jsx(VisuallyHidden, { children: label }),
|
|
23
|
-
typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : icon
|
|
29
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { id: labelId, children: label }),
|
|
30
|
+
typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : icon,
|
|
31
|
+
dot ? /* @__PURE__ */ jsx(VisuallyHidden, { id: dotId, "aria-hidden": "true", children: dot }) : null
|
|
24
32
|
]
|
|
25
33
|
}
|
|
26
34
|
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const predefinedSymbols = {
|
|
2
|
+
Backspace: "\u232B",
|
|
3
|
+
Command: "\u2318",
|
|
4
|
+
Control: "Ctrl",
|
|
5
|
+
Down: "\u2193",
|
|
6
|
+
Eject: "\u23CF",
|
|
7
|
+
Enter: "\u21B5",
|
|
8
|
+
Escape: "Esc",
|
|
9
|
+
Left: "\u2190",
|
|
10
|
+
Option: "\u2325",
|
|
11
|
+
Right: "\u2192",
|
|
12
|
+
Shift: "\u21E7",
|
|
13
|
+
Space: "\u2423",
|
|
14
|
+
Tab: "Tab",
|
|
15
|
+
Up: "\u2191"
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
predefinedSymbols
|
|
19
|
+
};
|
package/dist/DEV/bricks/Kbd.js
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
4
|
import { forwardRef } from "./~utils.js";
|
|
5
5
|
import { VisuallyHidden } from "./VisuallyHidden.js";
|
|
6
|
-
|
|
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
|
-
};
|
|
6
|
+
import { predefinedSymbols } from "./Kbd.internal.js";
|
|
22
7
|
const Kbd = forwardRef((props, forwardedRef) => {
|
|
23
8
|
const { variant = "solid", symbol, children, ...rest } = props;
|
|
24
9
|
DEV: {
|
|
@@ -36,7 +21,7 @@ const Kbd = forwardRef((props, forwardedRef) => {
|
|
|
36
21
|
] });
|
|
37
22
|
}
|
|
38
23
|
return /* @__PURE__ */ jsx(
|
|
39
|
-
|
|
24
|
+
Role,
|
|
40
25
|
{
|
|
41
26
|
...rest,
|
|
42
27
|
"data-kiwi-variant": variant,
|
package/dist/DEV/bricks/Label.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
4
|
import { forwardRef } from "./~utils.js";
|
|
5
5
|
import { FieldLabel } from "./Field.js";
|
|
6
6
|
const Label = forwardRef((props, forwardedRef) => {
|
|
@@ -8,7 +8,7 @@ const Label = forwardRef((props, forwardedRef) => {
|
|
|
8
8
|
FieldLabel,
|
|
9
9
|
{
|
|
10
10
|
render: /* @__PURE__ */ jsx(
|
|
11
|
-
|
|
11
|
+
Role.label,
|
|
12
12
|
{
|
|
13
13
|
...props,
|
|
14
14
|
className: cx("\u{1F95D}-label", props.className),
|
package/dist/DEV/bricks/Radio.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import
|
|
3
|
+
import {
|
|
4
|
+
Radio as AkRadio
|
|
5
|
+
} from "@ariakit/react/radio";
|
|
4
6
|
import { FieldControl } from "./Field.js";
|
|
5
7
|
import { forwardRef } from "./~utils.js";
|
|
6
8
|
const Radio = forwardRef((props, forwardedRef) => {
|
|
@@ -11,7 +13,7 @@ const Radio = forwardRef((props, forwardedRef) => {
|
|
|
11
13
|
type: "checkable",
|
|
12
14
|
id,
|
|
13
15
|
render: /* @__PURE__ */ jsx(
|
|
14
|
-
|
|
16
|
+
AkRadio,
|
|
15
17
|
{
|
|
16
18
|
accessibleWhenDisabled: true,
|
|
17
19
|
...rest,
|