@itwin/itwinui-react 5.0.0-alpha.0 → 5.0.0-alpha.10
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/LICENSE.md +1 -1
- package/README.md +6 -6
- package/dist/DEV/bricks/Anchor.js +16 -23
- package/dist/DEV/bricks/Avatar.js +24 -0
- package/dist/DEV/bricks/Badge.js +22 -0
- package/dist/DEV/bricks/Button.js +25 -16
- package/dist/DEV/bricks/Checkbox.js +26 -16
- package/dist/DEV/bricks/Chip.js +42 -0
- package/dist/DEV/bricks/Description.js +29 -0
- package/dist/DEV/bricks/Divider.js +16 -17
- package/dist/DEV/bricks/DropdownMenu.js +143 -48
- package/dist/DEV/bricks/Field.js +120 -20
- package/dist/DEV/bricks/Icon.js +108 -45
- package/dist/DEV/bricks/IconButton.js +31 -18
- package/dist/DEV/bricks/Kbd.internal.js +19 -0
- package/dist/DEV/bricks/Kbd.js +32 -17
- package/dist/DEV/bricks/Label.js +13 -10
- package/dist/DEV/bricks/ProgressBar.js +25 -0
- package/dist/DEV/bricks/Radio.js +19 -11
- package/dist/DEV/bricks/Root.js +78 -45
- package/dist/DEV/bricks/Select.js +61 -0
- package/dist/DEV/bricks/Skeleton.js +24 -0
- package/dist/DEV/bricks/Spinner.js +40 -0
- package/dist/DEV/bricks/Switch.js +27 -17
- package/dist/DEV/bricks/Table.js +114 -0
- package/dist/DEV/bricks/Tabs.js +19 -20
- package/dist/DEV/bricks/Text.js +20 -0
- package/dist/DEV/bricks/TextBox.js +95 -50
- package/dist/DEV/bricks/Tooltip.js +58 -58
- package/dist/DEV/bricks/Tree.js +16 -102
- package/dist/DEV/bricks/TreeItem.js +224 -0
- package/dist/DEV/bricks/VisuallyHidden.js +7 -5
- package/dist/DEV/bricks/index.js +20 -0
- package/dist/DEV/bricks/styles.css.js +2 -2
- package/dist/DEV/bricks/~hooks.js +55 -3
- package/dist/DEV/bricks/~utils.GhostAligner.js +13 -0
- package/dist/DEV/bricks/~utils.ListItem.js +49 -0
- package/dist/DEV/bricks/~utils.js +3 -0
- package/dist/DEV/foundations/styles.css.js +2 -2
- package/dist/bricks/Anchor.d.ts +12 -3
- package/dist/bricks/Anchor.js +16 -23
- package/dist/bricks/Avatar.d.ts +47 -0
- package/dist/bricks/Avatar.js +23 -0
- package/dist/bricks/Badge.d.ts +28 -0
- package/dist/bricks/Badge.js +21 -0
- package/dist/bricks/Button.d.ts +27 -4
- package/dist/bricks/Button.js +25 -16
- package/dist/bricks/Checkbox.d.ts +19 -5
- package/dist/bricks/Checkbox.js +26 -16
- package/dist/bricks/Chip.d.ts +31 -0
- package/dist/bricks/Chip.js +41 -0
- package/dist/bricks/Description.d.ts +19 -0
- package/dist/bricks/Description.js +29 -0
- package/dist/bricks/Divider.d.ts +5 -6
- package/dist/bricks/Divider.js +16 -17
- package/dist/bricks/DropdownMenu.d.ts +92 -15
- package/dist/bricks/DropdownMenu.js +138 -46
- package/dist/bricks/Field.d.ts +45 -3
- package/dist/bricks/Field.js +120 -20
- package/dist/bricks/Icon.d.ts +38 -7
- package/dist/bricks/Icon.js +105 -44
- package/dist/bricks/IconButton.d.ts +20 -4
- package/dist/bricks/IconButton.js +31 -18
- package/dist/bricks/Kbd.d.ts +17 -3
- package/dist/bricks/Kbd.internal.d.ts +17 -0
- package/dist/bricks/Kbd.internal.js +19 -0
- package/dist/bricks/Kbd.js +25 -17
- package/dist/bricks/Label.d.ts +22 -3
- package/dist/bricks/Label.js +13 -10
- package/dist/bricks/ProgressBar.d.ts +31 -0
- package/dist/bricks/ProgressBar.js +24 -0
- package/dist/bricks/Radio.d.ts +19 -5
- package/dist/bricks/Radio.js +19 -11
- package/dist/bricks/Root.d.ts +11 -2
- package/dist/bricks/Root.js +78 -45
- package/dist/bricks/Select.d.ts +51 -0
- package/dist/bricks/Select.js +61 -0
- package/dist/bricks/Skeleton.d.ts +25 -0
- package/dist/bricks/Skeleton.js +23 -0
- package/dist/bricks/Spinner.d.ts +31 -0
- package/dist/bricks/Spinner.js +39 -0
- package/dist/bricks/Switch.d.ts +19 -5
- package/dist/bricks/Switch.js +27 -17
- package/dist/bricks/Table.d.ts +115 -0
- package/dist/bricks/Table.js +108 -0
- package/dist/bricks/Tabs.d.ts +69 -8
- package/dist/bricks/Tabs.js +19 -20
- package/dist/bricks/Text.d.ts +22 -0
- package/dist/bricks/Text.js +19 -0
- package/dist/bricks/TextBox.d.ts +62 -11
- package/dist/bricks/TextBox.js +94 -50
- package/dist/bricks/Tooltip.d.ts +13 -6
- package/dist/bricks/Tooltip.js +58 -58
- package/dist/bricks/Tree.d.ts +20 -21
- package/dist/bricks/Tree.js +15 -97
- package/dist/bricks/TreeItem.d.ts +123 -0
- package/dist/bricks/TreeItem.js +219 -0
- package/dist/bricks/VisuallyHidden.d.ts +15 -3
- package/dist/bricks/VisuallyHidden.js +7 -5
- package/dist/bricks/index.d.ts +10 -0
- package/dist/bricks/index.js +20 -0
- package/dist/bricks/styles.css.js +2 -2
- package/dist/bricks/~hooks.d.ts +55 -0
- package/dist/bricks/~hooks.js +55 -3
- package/dist/bricks/~utils.GhostAligner.d.ts +22 -0
- package/dist/bricks/~utils.GhostAligner.js +13 -0
- package/dist/bricks/~utils.ListItem.d.ts +14 -0
- package/dist/bricks/~utils.ListItem.js +46 -0
- package/dist/bricks/~utils.d.ts +26 -3
- package/dist/bricks/~utils.js +3 -0
- package/dist/foundations/styles.css.js +2 -2
- package/package.json +14 -13
- package/dist/DEV/bricks/ListItem.js +0 -33
- package/dist/DEV/bricks/Textarea.js +0 -28
- package/dist/bricks/ListItem.d.ts +0 -11
- package/dist/bricks/ListItem.js +0 -31
- package/dist/bricks/Textarea.d.ts +0 -14
- package/dist/bricks/Textarea.js +0 -27
package/dist/DEV/bricks/Field.js
CHANGED
|
@@ -1,28 +1,128 @@
|
|
|
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";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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";
|
|
12
|
+
import { forwardRef } from "./~utils.js";
|
|
13
|
+
const Field = forwardRef((props, forwardedRef) => {
|
|
14
|
+
const { layout, ...rest } = props;
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
FieldCollection,
|
|
17
|
+
{
|
|
18
|
+
render: /* @__PURE__ */ jsx(
|
|
19
|
+
Role.div,
|
|
20
|
+
{
|
|
21
|
+
...rest,
|
|
22
|
+
className: cx("\u{1F95D}-field", props.className),
|
|
23
|
+
"data-kiwi-layout": layout,
|
|
24
|
+
ref: forwardedRef
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
});
|
|
20
30
|
DEV: Field.displayName = "Field";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
function FieldCollection(props) {
|
|
32
|
+
const fieldElementCollection = useCollectionStore({
|
|
33
|
+
defaultItems: []
|
|
34
|
+
});
|
|
35
|
+
const renderedItems = useStoreState(fieldElementCollection, "renderedItems");
|
|
36
|
+
const [controlType, controlIndex] = React.useMemo(() => {
|
|
37
|
+
const controlIndex2 = renderedItems.findIndex(
|
|
38
|
+
(item) => item.elementType === "control"
|
|
39
|
+
);
|
|
40
|
+
return [renderedItems[controlIndex2]?.controlType, controlIndex2];
|
|
41
|
+
}, [renderedItems]);
|
|
42
|
+
const labelPlacement = React.useMemo(() => {
|
|
43
|
+
const labelIndex = renderedItems.findIndex(
|
|
44
|
+
(item) => item.elementType === "label"
|
|
45
|
+
);
|
|
46
|
+
if (controlIndex === -1 || labelIndex === -1) return;
|
|
47
|
+
return labelIndex < controlIndex ? "before" : "after";
|
|
48
|
+
}, [renderedItems, controlIndex]);
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
Collection,
|
|
51
|
+
{
|
|
52
|
+
...props,
|
|
53
|
+
store: fieldElementCollection,
|
|
54
|
+
"data-kiwi-label-placement": labelPlacement,
|
|
55
|
+
"data-kiwi-control-type": controlType
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
function FieldControl(props) {
|
|
60
|
+
const store = useCollectionContext();
|
|
61
|
+
const generatedId = React.useId();
|
|
62
|
+
const { id = store ? generatedId : void 0, type, ...rest } = props;
|
|
63
|
+
const renderedItems = useStoreState(store, "renderedItems");
|
|
64
|
+
const describedBy = React.useMemo(() => {
|
|
65
|
+
const idRefList = renderedItems?.filter(
|
|
66
|
+
(item) => item.elementType === "description"
|
|
67
|
+
)?.map((item) => item.id).join(" ");
|
|
68
|
+
return idRefList || void 0;
|
|
69
|
+
}, [renderedItems]);
|
|
70
|
+
const getData = React.useCallback(
|
|
71
|
+
(data) => ({
|
|
72
|
+
...data,
|
|
73
|
+
elementType: "control",
|
|
74
|
+
controlType: type
|
|
75
|
+
}),
|
|
76
|
+
[type]
|
|
77
|
+
);
|
|
78
|
+
return /* @__PURE__ */ jsx(
|
|
79
|
+
CollectionItem,
|
|
80
|
+
{
|
|
81
|
+
id,
|
|
82
|
+
getItem: getData,
|
|
83
|
+
render: /* @__PURE__ */ jsx(Role, { ...rest, "aria-describedby": describedBy })
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
function FieldLabel(props) {
|
|
88
|
+
const store = useCollectionContext();
|
|
89
|
+
const renderedItems = useStoreState(store, "renderedItems");
|
|
90
|
+
const fieldId = React.useMemo(
|
|
91
|
+
() => renderedItems?.find(
|
|
92
|
+
(item) => item.elementType === "control"
|
|
93
|
+
)?.id,
|
|
94
|
+
[renderedItems]
|
|
95
|
+
);
|
|
96
|
+
const getData = React.useCallback(
|
|
97
|
+
(data) => ({
|
|
98
|
+
...data,
|
|
99
|
+
elementType: "label"
|
|
100
|
+
}),
|
|
101
|
+
[]
|
|
102
|
+
);
|
|
103
|
+
return /* @__PURE__ */ jsx(
|
|
104
|
+
CollectionItem,
|
|
105
|
+
{
|
|
106
|
+
getItem: getData,
|
|
107
|
+
render: /* @__PURE__ */ jsx(Role.label, { ...props, htmlFor: fieldId })
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
function FieldDescription(props) {
|
|
112
|
+
const generatedId = React.useId();
|
|
113
|
+
const { id = generatedId, ...rest } = props;
|
|
114
|
+
const getData = React.useCallback(
|
|
115
|
+
(data) => ({
|
|
116
|
+
...data,
|
|
117
|
+
elementType: "description"
|
|
118
|
+
}),
|
|
119
|
+
[]
|
|
120
|
+
);
|
|
121
|
+
return /* @__PURE__ */ jsx(CollectionItem, { ...rest, id, getItem: getData });
|
|
24
122
|
}
|
|
25
123
|
export {
|
|
26
124
|
Field,
|
|
27
|
-
|
|
125
|
+
FieldControl,
|
|
126
|
+
FieldDescription,
|
|
127
|
+
FieldLabel
|
|
28
128
|
};
|
package/dist/DEV/bricks/Icon.js
CHANGED
|
@@ -1,61 +1,124 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import cx from "classnames";
|
|
4
|
-
import
|
|
5
|
-
|
|
4
|
+
import { Role } from "@ariakit/react/role";
|
|
5
|
+
import { forwardRef } from "./~utils.js";
|
|
6
|
+
const Icon = forwardRef((props, forwardedRef) => {
|
|
7
|
+
const { href, size, alt, ...rest } = props;
|
|
8
|
+
const isDecorative = !alt;
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
Role.svg,
|
|
11
|
+
{
|
|
12
|
+
"aria-hidden": isDecorative ? "true" : void 0,
|
|
13
|
+
role: isDecorative ? void 0 : "img",
|
|
14
|
+
"aria-label": isDecorative ? void 0 : alt,
|
|
15
|
+
...rest,
|
|
16
|
+
"data-kiwi-size": size,
|
|
17
|
+
className: cx("\u{1F95D}-icon", props.className),
|
|
18
|
+
ref: forwardedRef,
|
|
19
|
+
children: href ? /* @__PURE__ */ jsx("use", { href: toIconHref(href, size) }) : null
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
DEV: Icon.displayName = "Icon";
|
|
24
|
+
function toIconHref(href, size) {
|
|
25
|
+
const separator = href.includes("#") ? "--" : "#";
|
|
26
|
+
const suffix = toIconId(size);
|
|
27
|
+
return `${href}${separator}${suffix}`;
|
|
28
|
+
}
|
|
29
|
+
function toIconId(size) {
|
|
30
|
+
if (size === "large") return "icon-large";
|
|
31
|
+
return "icon";
|
|
32
|
+
}
|
|
33
|
+
const DisclosureArrow = forwardRef(
|
|
6
34
|
(props, forwardedRef) => {
|
|
7
|
-
const {
|
|
8
|
-
const
|
|
35
|
+
const { direction = "down", ...rest } = props;
|
|
36
|
+
const path = React.useMemo(() => {
|
|
37
|
+
switch (direction) {
|
|
38
|
+
case "down":
|
|
39
|
+
return /* @__PURE__ */ jsx("path", { d: "M8 10 5 7h6l-3 3Z" });
|
|
40
|
+
case "right":
|
|
41
|
+
return /* @__PURE__ */ jsx("path", { d: "M7 11V5l3 3-3 3Z" });
|
|
42
|
+
}
|
|
43
|
+
}, [direction]);
|
|
9
44
|
return /* @__PURE__ */ jsx(
|
|
10
|
-
|
|
45
|
+
Icon,
|
|
11
46
|
{
|
|
12
|
-
"data-kiwi-size": size,
|
|
13
|
-
"aria-hidden": true,
|
|
14
47
|
...rest,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
48
|
+
render: /* @__PURE__ */ jsx(
|
|
49
|
+
Role.svg,
|
|
50
|
+
{
|
|
51
|
+
width: "16",
|
|
52
|
+
height: "16",
|
|
53
|
+
fill: "currentColor",
|
|
54
|
+
viewBox: "0 0 16 16",
|
|
55
|
+
render: props.render,
|
|
56
|
+
children: path
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
className: cx("\u{1F95D}-disclosure-arrow", props.className),
|
|
60
|
+
ref: forwardedRef
|
|
18
61
|
}
|
|
19
62
|
);
|
|
20
63
|
}
|
|
21
64
|
);
|
|
22
|
-
DEV: Icon.displayName = "Icon";
|
|
23
|
-
function toIconId(size) {
|
|
24
|
-
if (size === "large") return "icon-large";
|
|
25
|
-
return "icon";
|
|
26
|
-
}
|
|
27
|
-
const DisclosureArrow = React.forwardRef((props, forwardedRef) => {
|
|
28
|
-
const { direction = "down", ...rest } = props;
|
|
29
|
-
const path = React.useMemo(() => {
|
|
30
|
-
switch (direction) {
|
|
31
|
-
case "down":
|
|
32
|
-
return /* @__PURE__ */ jsx("path", { d: "M8 10 5 7h6l-3 3Z" });
|
|
33
|
-
case "right":
|
|
34
|
-
return /* @__PURE__ */ jsx("path", { d: "M7 11V5l3 3-3 3Z" });
|
|
35
|
-
}
|
|
36
|
-
}, [direction]);
|
|
37
|
-
return /* @__PURE__ */ jsx(
|
|
38
|
-
Icon,
|
|
39
|
-
{
|
|
40
|
-
...rest,
|
|
41
|
-
render: /* @__PURE__ */ jsx(
|
|
42
|
-
Ariakit.Role.svg,
|
|
43
|
-
{
|
|
44
|
-
width: "16",
|
|
45
|
-
height: "16",
|
|
46
|
-
fill: "currentColor",
|
|
47
|
-
viewBox: "0 0 16 16",
|
|
48
|
-
render: props.render,
|
|
49
|
-
children: path
|
|
50
|
-
}
|
|
51
|
-
),
|
|
52
|
-
className: cx("\u{1F95D}-disclosure-arrow", props.className),
|
|
53
|
-
ref: forwardedRef
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
});
|
|
57
65
|
DEV: DisclosureArrow.displayName = "DisclosureArrow";
|
|
66
|
+
const Checkmark = forwardRef(
|
|
67
|
+
(props, forwardedRef) => {
|
|
68
|
+
return /* @__PURE__ */ jsx(
|
|
69
|
+
Icon,
|
|
70
|
+
{
|
|
71
|
+
...props,
|
|
72
|
+
render: /* @__PURE__ */ jsx(
|
|
73
|
+
Role.svg,
|
|
74
|
+
{
|
|
75
|
+
width: "16",
|
|
76
|
+
height: "16",
|
|
77
|
+
fill: "currentColor",
|
|
78
|
+
viewBox: "0 0 16 16",
|
|
79
|
+
render: props.render,
|
|
80
|
+
children: /* @__PURE__ */ jsx(
|
|
81
|
+
"path",
|
|
82
|
+
{
|
|
83
|
+
fillRule: "evenodd",
|
|
84
|
+
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",
|
|
85
|
+
clipRule: "evenodd"
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
ref: forwardedRef
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
DEV: Checkmark.displayName = "Checkmark";
|
|
96
|
+
const Dismiss = forwardRef(
|
|
97
|
+
(props, forwardedRef) => {
|
|
98
|
+
return /* @__PURE__ */ jsx(
|
|
99
|
+
Icon,
|
|
100
|
+
{
|
|
101
|
+
...props,
|
|
102
|
+
render: /* @__PURE__ */ jsx(
|
|
103
|
+
Role.svg,
|
|
104
|
+
{
|
|
105
|
+
width: "16",
|
|
106
|
+
height: "16",
|
|
107
|
+
viewBox: "0 0 16 16",
|
|
108
|
+
fill: "currentColor",
|
|
109
|
+
render: props.render,
|
|
110
|
+
children: /* @__PURE__ */ jsx("path", { d: "M4.853 4.146a.5.5 0 1 0-.707.708L7.293 8l-3.147 3.146a.5.5 0 0 0 .707.708L8 8.707l3.146 3.147a.5.5 0 0 0 .707-.708L8.707 8l3.146-3.146a.5.5 0 1 0-.707-.708L8 7.293 4.853 4.146Z" })
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
ref: forwardedRef
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
DEV: Dismiss.displayName = "Dismiss";
|
|
58
119
|
export {
|
|
120
|
+
Checkmark,
|
|
59
121
|
DisclosureArrow,
|
|
122
|
+
Dismiss,
|
|
60
123
|
Icon
|
|
61
124
|
};
|
|
@@ -1,30 +1,43 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import cx from "classnames";
|
|
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";
|
|
7
8
|
import { Tooltip } from "./Tooltip.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
import { forwardRef } from "./~utils.js";
|
|
10
|
+
const IconButton = forwardRef(
|
|
11
|
+
(props, forwardedRef) => {
|
|
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();
|
|
17
|
+
const button = /* @__PURE__ */ jsxs(
|
|
18
|
+
Button,
|
|
19
|
+
{
|
|
20
|
+
"aria-pressed": isActive,
|
|
21
|
+
"aria-labelledby": labelId,
|
|
22
|
+
"aria-describedby": dot ? dotId : void 0,
|
|
23
|
+
...rest,
|
|
24
|
+
"data-kiwi-dot": dot ? "true" : void 0,
|
|
25
|
+
render: toolbar ? /* @__PURE__ */ jsx(ToolbarItem, { render: props.render }) : props.render,
|
|
26
|
+
className: cx("\u{1F95D}-icon-button", props.className),
|
|
27
|
+
ref: forwardedRef,
|
|
28
|
+
children: [
|
|
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
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
if (labelVariant === "visually-hidden") {
|
|
36
|
+
return button;
|
|
21
37
|
}
|
|
22
|
-
|
|
23
|
-
if (labelVariant === "visually-hidden") {
|
|
24
|
-
return button;
|
|
38
|
+
return /* @__PURE__ */ jsx(Tooltip, { content: label, type: "none", children: button });
|
|
25
39
|
}
|
|
26
|
-
|
|
27
|
-
});
|
|
40
|
+
);
|
|
28
41
|
DEV: IconButton.displayName = "IconButton";
|
|
29
42
|
export {
|
|
30
43
|
IconButton
|
|
@@ -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,22 +1,37 @@
|
|
|
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
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
);
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
|
+
import { forwardRef } from "./~utils.js";
|
|
5
|
+
import { VisuallyHidden } from "./VisuallyHidden.js";
|
|
6
|
+
import { predefinedSymbols } from "./Kbd.internal.js";
|
|
7
|
+
const Kbd = forwardRef((props, forwardedRef) => {
|
|
8
|
+
const { variant = "solid", symbol, children, ...rest } = props;
|
|
9
|
+
DEV: {
|
|
10
|
+
if (symbol && !(symbol in predefinedSymbols)) {
|
|
11
|
+
console.error(
|
|
12
|
+
`Kbd: Invalid symbol "${symbol}". Must be one of: ${Object.keys(predefinedSymbols).join(", ")}`
|
|
13
|
+
);
|
|
14
|
+
}
|
|
18
15
|
}
|
|
19
|
-
|
|
16
|
+
let content = children;
|
|
17
|
+
if (symbol) {
|
|
18
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: predefinedSymbols[symbol] }),
|
|
20
|
+
children || /* @__PURE__ */ jsx(VisuallyHidden, { children: symbol })
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
Role,
|
|
25
|
+
{
|
|
26
|
+
...rest,
|
|
27
|
+
"data-kiwi-variant": variant,
|
|
28
|
+
className: cx("\u{1F95D}-kbd", props.className),
|
|
29
|
+
render: props.render || /* @__PURE__ */ jsx("kbd", {}),
|
|
30
|
+
ref: forwardedRef,
|
|
31
|
+
children: content
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
});
|
|
20
35
|
DEV: Kbd.displayName = "Kbd";
|
|
21
36
|
export {
|
|
22
37
|
Kbd
|
package/dist/DEV/bricks/Label.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
2
|
import cx from "classnames";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
|
+
import { forwardRef } from "./~utils.js";
|
|
5
|
+
import { FieldLabel } from "./Field.js";
|
|
6
|
+
const Label = forwardRef((props, forwardedRef) => {
|
|
8
7
|
return /* @__PURE__ */ jsx(
|
|
9
|
-
|
|
8
|
+
FieldLabel,
|
|
10
9
|
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
render: /* @__PURE__ */ jsx(
|
|
11
|
+
Role.label,
|
|
12
|
+
{
|
|
13
|
+
...props,
|
|
14
|
+
className: cx("\u{1F95D}-label", props.className),
|
|
15
|
+
ref: forwardedRef
|
|
16
|
+
}
|
|
17
|
+
)
|
|
15
18
|
}
|
|
16
19
|
);
|
|
17
20
|
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Role } from "@ariakit/react/role";
|
|
3
|
+
import cx from "classnames";
|
|
4
|
+
import { forwardRef } from "./~utils.js";
|
|
5
|
+
const ProgressBar = forwardRef(
|
|
6
|
+
(props, forwardedRef) => {
|
|
7
|
+
const { size = "medium", tone = "neutral", ...rest } = props;
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
Role,
|
|
10
|
+
{
|
|
11
|
+
role: "progressbar",
|
|
12
|
+
...rest,
|
|
13
|
+
"data-kiwi-size": size,
|
|
14
|
+
"data-kiwi-tone": tone,
|
|
15
|
+
"data-kiwi-variant": "indeterminate",
|
|
16
|
+
className: cx("\u{1F95D}-progress-bar", props.className),
|
|
17
|
+
ref: forwardedRef
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
DEV: ProgressBar.displayName = "ProgressBar";
|
|
23
|
+
export {
|
|
24
|
+
ProgressBar
|
|
25
|
+
};
|
package/dist/DEV/bricks/Radio.js
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
2
|
import cx from "classnames";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import {
|
|
4
|
+
Radio as AkRadio
|
|
5
|
+
} from "@ariakit/react/radio";
|
|
6
|
+
import { FieldControl } from "./Field.js";
|
|
7
|
+
import { forwardRef } from "./~utils.js";
|
|
8
|
+
const Radio = forwardRef((props, forwardedRef) => {
|
|
9
|
+
const { id, ...rest } = props;
|
|
8
10
|
return /* @__PURE__ */ jsx(
|
|
9
|
-
|
|
11
|
+
FieldControl,
|
|
10
12
|
{
|
|
11
|
-
|
|
12
|
-
id
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
type: "checkable",
|
|
14
|
+
id,
|
|
15
|
+
render: /* @__PURE__ */ jsx(
|
|
16
|
+
AkRadio,
|
|
17
|
+
{
|
|
18
|
+
accessibleWhenDisabled: true,
|
|
19
|
+
...rest,
|
|
20
|
+
className: cx("\u{1F95D}-checkbox", "\u{1F95D}-radio", props.className),
|
|
21
|
+
ref: forwardedRef
|
|
22
|
+
}
|
|
23
|
+
)
|
|
16
24
|
}
|
|
17
25
|
);
|
|
18
26
|
});
|