@itwin/itwinui-react 5.0.0-alpha.1 → 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 +5 -10
- package/dist/DEV/bricks/Avatar.js +24 -0
- package/dist/DEV/bricks/Badge.js +22 -0
- package/dist/DEV/bricks/Button.js +11 -4
- package/dist/DEV/bricks/Checkbox.js +17 -9
- package/dist/DEV/bricks/Chip.js +42 -0
- package/dist/DEV/bricks/Description.js +29 -0
- package/dist/DEV/bricks/Divider.js +3 -2
- package/dist/DEV/bricks/DropdownMenu.js +109 -30
- package/dist/DEV/bricks/Field.js +115 -14
- package/dist/DEV/bricks/Icon.js +70 -8
- package/dist/DEV/bricks/IconButton.js +14 -3
- package/dist/DEV/bricks/Kbd.internal.js +19 -0
- package/dist/DEV/bricks/Kbd.js +23 -6
- package/dist/DEV/bricks/Label.js +11 -8
- package/dist/DEV/bricks/ProgressBar.js +25 -0
- package/dist/DEV/bricks/Radio.js +17 -9
- package/dist/DEV/bricks/Root.js +35 -4
- package/dist/DEV/bricks/Select.js +17 -11
- package/dist/DEV/bricks/Skeleton.js +24 -0
- package/dist/DEV/bricks/Spinner.js +40 -0
- package/dist/DEV/bricks/Switch.js +18 -10
- package/dist/DEV/bricks/Table.js +114 -0
- package/dist/DEV/bricks/Tabs.js +6 -6
- package/dist/DEV/bricks/Text.js +2 -2
- package/dist/DEV/bricks/TextBox.js +54 -16
- package/dist/DEV/bricks/Tooltip.js +17 -25
- package/dist/DEV/bricks/Tree.js +15 -107
- package/dist/DEV/bricks/TreeItem.js +224 -0
- package/dist/DEV/bricks/VisuallyHidden.js +2 -2
- package/dist/DEV/bricks/index.js +16 -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/{ListItem.js → ~utils.ListItem.js} +19 -3
- package/dist/DEV/foundations/styles.css.js +2 -2
- package/dist/bricks/Anchor.js +5 -10
- 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.js +11 -4
- package/dist/bricks/Checkbox.d.ts +2 -2
- package/dist/bricks/Checkbox.js +17 -9
- 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 +2 -2
- package/dist/bricks/Divider.js +3 -2
- package/dist/bricks/DropdownMenu.d.ts +41 -14
- package/dist/bricks/DropdownMenu.js +106 -30
- package/dist/bricks/Field.d.ts +23 -1
- package/dist/bricks/Field.js +115 -14
- package/dist/bricks/Icon.d.ts +34 -3
- package/dist/bricks/Icon.js +68 -8
- package/dist/bricks/IconButton.d.ts +20 -4
- package/dist/bricks/IconButton.js +14 -3
- package/dist/bricks/Kbd.d.ts +15 -0
- package/dist/bricks/Kbd.internal.d.ts +17 -0
- package/dist/bricks/Kbd.internal.js +19 -0
- package/dist/bricks/Kbd.js +16 -6
- package/dist/bricks/Label.js +11 -8
- package/dist/bricks/ProgressBar.d.ts +31 -0
- package/dist/bricks/ProgressBar.js +24 -0
- package/dist/bricks/Radio.d.ts +2 -2
- package/dist/bricks/Radio.js +17 -9
- package/dist/bricks/Root.js +35 -4
- package/dist/bricks/Select.d.ts +9 -3
- package/dist/bricks/Select.js +17 -11
- 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 +2 -2
- package/dist/bricks/Switch.js +18 -10
- package/dist/bricks/Table.d.ts +115 -0
- package/dist/bricks/Table.js +108 -0
- package/dist/bricks/Tabs.d.ts +4 -4
- package/dist/bricks/Tabs.js +6 -6
- package/dist/bricks/Text.d.ts +1 -1
- package/dist/bricks/Text.js +2 -2
- package/dist/bricks/TextBox.d.ts +23 -2
- package/dist/bricks/TextBox.js +53 -16
- package/dist/bricks/Tooltip.d.ts +2 -2
- package/dist/bricks/Tooltip.js +17 -25
- package/dist/bricks/Tree.d.ts +19 -20
- package/dist/bricks/Tree.js +14 -102
- package/dist/bricks/TreeItem.d.ts +123 -0
- package/dist/bricks/TreeItem.js +219 -0
- package/dist/bricks/VisuallyHidden.js +2 -2
- package/dist/bricks/index.d.ts +8 -0
- package/dist/bricks/index.js +16 -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/{ListItem.js → ~utils.ListItem.js} +18 -3
- package/dist/bricks/~utils.d.ts +6 -3
- package/dist/foundations/styles.css.js +2 -2
- package/package.json +14 -13
- package/CHANGELOG.md +0 -14
- package/dist/DEV/bricks/Textarea.js +0 -30
- package/dist/bricks/ListItem.d.ts +0 -10
- package/dist/bricks/Textarea.d.ts +0 -24
- package/dist/bricks/Textarea.js +0 -29
package/dist/DEV/bricks/Icon.js
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
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
|
-
const { href, size
|
|
8
|
-
const
|
|
7
|
+
const { href, size, alt, ...rest } = props;
|
|
8
|
+
const isDecorative = !alt;
|
|
9
9
|
return /* @__PURE__ */ jsx(
|
|
10
|
-
|
|
10
|
+
Role.svg,
|
|
11
11
|
{
|
|
12
|
-
"
|
|
13
|
-
"
|
|
12
|
+
"aria-hidden": isDecorative ? "true" : void 0,
|
|
13
|
+
role: isDecorative ? void 0 : "img",
|
|
14
|
+
"aria-label": isDecorative ? void 0 : alt,
|
|
14
15
|
...rest,
|
|
16
|
+
"data-kiwi-size": size,
|
|
15
17
|
className: cx("\u{1F95D}-icon", props.className),
|
|
16
18
|
ref: forwardedRef,
|
|
17
|
-
children: /* @__PURE__ */ jsx("use", { href:
|
|
19
|
+
children: href ? /* @__PURE__ */ jsx("use", { href: toIconHref(href, size) }) : null
|
|
18
20
|
}
|
|
19
21
|
);
|
|
20
22
|
});
|
|
21
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
|
+
}
|
|
22
29
|
function toIconId(size) {
|
|
23
30
|
if (size === "large") return "icon-large";
|
|
24
31
|
return "icon";
|
|
@@ -39,7 +46,7 @@ const DisclosureArrow = forwardRef(
|
|
|
39
46
|
{
|
|
40
47
|
...rest,
|
|
41
48
|
render: /* @__PURE__ */ jsx(
|
|
42
|
-
|
|
49
|
+
Role.svg,
|
|
43
50
|
{
|
|
44
51
|
width: "16",
|
|
45
52
|
height: "16",
|
|
@@ -56,7 +63,62 @@ const DisclosureArrow = forwardRef(
|
|
|
56
63
|
}
|
|
57
64
|
);
|
|
58
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";
|
|
59
119
|
export {
|
|
120
|
+
Checkmark,
|
|
60
121
|
DisclosureArrow,
|
|
122
|
+
Dismiss,
|
|
61
123
|
Icon
|
|
62
124
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
2
3
|
import cx from "classnames";
|
|
4
|
+
import { useToolbarContext, ToolbarItem } from "@ariakit/react/toolbar";
|
|
3
5
|
import { Button } from "./Button.js";
|
|
4
6
|
import { VisuallyHidden } from "./VisuallyHidden.js";
|
|
5
7
|
import { Icon } from "./Icon.js";
|
|
@@ -7,17 +9,26 @@ import { Tooltip } from "./Tooltip.js";
|
|
|
7
9
|
import { forwardRef } from "./~utils.js";
|
|
8
10
|
const IconButton = forwardRef(
|
|
9
11
|
(props, forwardedRef) => {
|
|
10
|
-
const { label, icon, isActive, labelVariant, ...rest } = props;
|
|
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();
|
|
11
17
|
const button = /* @__PURE__ */ jsxs(
|
|
12
18
|
Button,
|
|
13
19
|
{
|
|
14
20
|
"aria-pressed": isActive,
|
|
21
|
+
"aria-labelledby": labelId,
|
|
22
|
+
"aria-describedby": dot ? dotId : void 0,
|
|
15
23
|
...rest,
|
|
24
|
+
"data-kiwi-dot": dot ? "true" : void 0,
|
|
25
|
+
render: toolbar ? /* @__PURE__ */ jsx(ToolbarItem, { render: props.render }) : props.render,
|
|
16
26
|
className: cx("\u{1F95D}-icon-button", props.className),
|
|
17
27
|
ref: forwardedRef,
|
|
18
28
|
children: [
|
|
19
|
-
/* @__PURE__ */ jsx(VisuallyHidden, { children: label }),
|
|
20
|
-
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
|
|
21
32
|
]
|
|
22
33
|
}
|
|
23
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,17 +1,34 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
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
|
+
import { VisuallyHidden } from "./VisuallyHidden.js";
|
|
6
|
+
import { predefinedSymbols } from "./Kbd.internal.js";
|
|
5
7
|
const Kbd = forwardRef((props, forwardedRef) => {
|
|
6
|
-
const { variant = "solid", ...rest } = props;
|
|
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
|
+
}
|
|
15
|
+
}
|
|
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
|
+
}
|
|
7
23
|
return /* @__PURE__ */ jsx(
|
|
8
|
-
|
|
24
|
+
Role,
|
|
9
25
|
{
|
|
10
|
-
"data-kiwi-variant": variant,
|
|
11
26
|
...rest,
|
|
27
|
+
"data-kiwi-variant": variant,
|
|
12
28
|
className: cx("\u{1F95D}-kbd", props.className),
|
|
13
29
|
render: props.render || /* @__PURE__ */ jsx("kbd", {}),
|
|
14
|
-
ref: forwardedRef
|
|
30
|
+
ref: forwardedRef,
|
|
31
|
+
children: content
|
|
15
32
|
}
|
|
16
33
|
);
|
|
17
34
|
});
|
package/dist/DEV/bricks/Label.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import
|
|
4
|
-
import { useFieldId } from "./Field.js";
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
5
4
|
import { forwardRef } from "./~utils.js";
|
|
5
|
+
import { FieldLabel } from "./Field.js";
|
|
6
6
|
const Label = forwardRef((props, forwardedRef) => {
|
|
7
|
-
const fieldId = useFieldId();
|
|
8
7
|
return /* @__PURE__ */ jsx(
|
|
9
|
-
|
|
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
2
|
import cx from "classnames";
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
Radio as AkRadio
|
|
5
|
+
} from "@ariakit/react/radio";
|
|
6
|
+
import { FieldControl } from "./Field.js";
|
|
5
7
|
import { forwardRef } from "./~utils.js";
|
|
6
8
|
const Radio = forwardRef((props, forwardedRef) => {
|
|
7
|
-
const
|
|
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
|
});
|
package/dist/DEV/bricks/Root.js
CHANGED
|
@@ -1,19 +1,30 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as ReactDOM from "react-dom";
|
|
4
|
+
import { Role } from "@ariakit/react/role";
|
|
5
|
+
import { PortalContext } from "@ariakit/react/portal";
|
|
4
6
|
import cx from "classnames";
|
|
5
7
|
import foundationsCss from "../foundations/styles.css.js";
|
|
6
8
|
import bricksCss from "./styles.css.js";
|
|
7
9
|
import { forwardRef, isBrowser } from "./~utils.js";
|
|
8
|
-
import { useMergedRefs } from "./~hooks.js";
|
|
10
|
+
import { useIsClient, useMergedRefs } from "./~hooks.js";
|
|
9
11
|
const css = foundationsCss + bricksCss;
|
|
10
12
|
const Root = forwardRef((props, forwardedRef) => {
|
|
11
13
|
const { children, synchronizeColorScheme = false, ...rest } = props;
|
|
14
|
+
const [portalContainer, setPortalContainer] = React.useState(null);
|
|
12
15
|
return /* @__PURE__ */ jsxs(RootInternal, { ...rest, ref: forwardedRef, children: [
|
|
13
16
|
/* @__PURE__ */ jsx(Styles, {}),
|
|
14
17
|
/* @__PURE__ */ jsx(Fonts, {}),
|
|
15
18
|
synchronizeColorScheme ? /* @__PURE__ */ jsx(SynchronizeColorScheme, { colorScheme: props.colorScheme }) : null,
|
|
16
|
-
|
|
19
|
+
/* @__PURE__ */ jsx(
|
|
20
|
+
PortalContainer,
|
|
21
|
+
{
|
|
22
|
+
colorScheme: props.colorScheme,
|
|
23
|
+
density: props.density,
|
|
24
|
+
ref: setPortalContainer
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ jsx(PortalContext.Provider, { value: portalContainer, children })
|
|
17
28
|
] });
|
|
18
29
|
});
|
|
19
30
|
DEV: Root.displayName = "Root";
|
|
@@ -32,7 +43,7 @@ const RootInternal = forwardRef(
|
|
|
32
43
|
setRootNode(rootNode2);
|
|
33
44
|
}, []);
|
|
34
45
|
return /* @__PURE__ */ jsx(
|
|
35
|
-
|
|
46
|
+
Role,
|
|
36
47
|
{
|
|
37
48
|
...rest,
|
|
38
49
|
className: cx("\u{1F95D}-root", props.className),
|
|
@@ -60,6 +71,26 @@ function SynchronizeColorScheme({
|
|
|
60
71
|
}, [rootNode, colorScheme]);
|
|
61
72
|
return null;
|
|
62
73
|
}
|
|
74
|
+
const PortalContainer = forwardRef((props, forwardedRef) => {
|
|
75
|
+
const isClient = useIsClient();
|
|
76
|
+
const rootNode = useRootNode();
|
|
77
|
+
if (!isClient) return null;
|
|
78
|
+
const destination = rootNode && isDocument(rootNode) ? rootNode.body : rootNode;
|
|
79
|
+
if (!destination) return null;
|
|
80
|
+
return ReactDOM.createPortal(
|
|
81
|
+
/* @__PURE__ */ jsx(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
className: "\u{1F95D}-root",
|
|
85
|
+
"data-kiwi-theme": props.colorScheme,
|
|
86
|
+
"data-kiwi-density": props.density,
|
|
87
|
+
style: { display: "contents" },
|
|
88
|
+
ref: forwardedRef
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
destination
|
|
92
|
+
);
|
|
93
|
+
});
|
|
63
94
|
function Styles() {
|
|
64
95
|
const rootNode = useRootNode();
|
|
65
96
|
useLayoutEffect(() => {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } 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 {
|
|
6
6
|
forwardRef,
|
|
7
7
|
isBrowser
|
|
8
8
|
} from "./~utils.js";
|
|
9
9
|
import { DisclosureArrow } from "./Icon.js";
|
|
10
|
-
import {
|
|
10
|
+
import { FieldControl } from "./Field.js";
|
|
11
11
|
const supportsHas = isBrowser && CSS?.supports?.("selector(:has(+ *))");
|
|
12
12
|
const HtmlSelectContext = React.createContext(() => {
|
|
13
13
|
});
|
|
14
14
|
const SelectRoot = forwardRef((props, forwardedRef) => {
|
|
15
15
|
const [isHtmlSelect, setIsHtmlSelect] = React.useState(false);
|
|
16
16
|
return /* @__PURE__ */ jsx(HtmlSelectContext.Provider, { value: setIsHtmlSelect, children: /* @__PURE__ */ jsx(
|
|
17
|
-
|
|
17
|
+
Role.div,
|
|
18
18
|
{
|
|
19
19
|
...props,
|
|
20
20
|
className: cx("\u{1F95D}-select-root", props.className),
|
|
@@ -25,8 +25,8 @@ const SelectRoot = forwardRef((props, forwardedRef) => {
|
|
|
25
25
|
});
|
|
26
26
|
const HtmlSelect = forwardRef(
|
|
27
27
|
(props, forwardedRef) => {
|
|
28
|
+
const { id, variant = "solid", ...rest } = props;
|
|
28
29
|
const setIsHtmlSelect = React.useContext(HtmlSelectContext);
|
|
29
|
-
const fieldId = useFieldId();
|
|
30
30
|
React.useEffect(
|
|
31
31
|
function updateContext() {
|
|
32
32
|
setIsHtmlSelect(true);
|
|
@@ -35,14 +35,20 @@ const HtmlSelect = forwardRef(
|
|
|
35
35
|
);
|
|
36
36
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
37
37
|
/* @__PURE__ */ jsx(
|
|
38
|
-
|
|
38
|
+
FieldControl,
|
|
39
39
|
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
type: "textlike",
|
|
41
|
+
id,
|
|
42
|
+
render: /* @__PURE__ */ jsx(
|
|
43
|
+
Role.select,
|
|
44
|
+
{
|
|
45
|
+
...rest,
|
|
46
|
+
className: cx("\u{1F95D}-button", "\u{1F95D}-select", props.className),
|
|
47
|
+
"data-kiwi-tone": "neutral",
|
|
48
|
+
"data-kiwi-variant": variant,
|
|
49
|
+
ref: forwardedRef
|
|
50
|
+
}
|
|
51
|
+
)
|
|
46
52
|
}
|
|
47
53
|
),
|
|
48
54
|
/* @__PURE__ */ jsx(DisclosureArrow, { className: "\u{1F95D}-select-arrow" })
|
|
@@ -0,0 +1,24 @@
|
|
|
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 Skeleton = forwardRef(
|
|
6
|
+
(props, forwardedRef) => {
|
|
7
|
+
const { variant = "text", size = "medium", ...rest } = props;
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
Role.div,
|
|
10
|
+
{
|
|
11
|
+
...rest,
|
|
12
|
+
ref: forwardedRef,
|
|
13
|
+
className: cx("\u{1F95D}-skeleton", props.className),
|
|
14
|
+
"data-kiwi-variant": variant,
|
|
15
|
+
"data-kiwi-size": size,
|
|
16
|
+
"aria-hidden": true
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
DEV: Skeleton.displayName = "Skeleton";
|
|
22
|
+
export {
|
|
23
|
+
Skeleton
|
|
24
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Role } from "@ariakit/react/role";
|
|
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
|
+
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
|
+
strokeLinecap: "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,20 +1,28 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
Checkbox as AkCheckbox
|
|
5
|
+
} from "@ariakit/react/checkbox";
|
|
6
|
+
import { FieldControl } from "./Field.js";
|
|
5
7
|
import { forwardRef } from "./~utils.js";
|
|
6
8
|
const Switch = forwardRef(
|
|
7
9
|
(props, forwardedRef) => {
|
|
8
|
-
const
|
|
10
|
+
const { id, ...rest } = props;
|
|
9
11
|
return /* @__PURE__ */ jsx(
|
|
10
|
-
|
|
12
|
+
FieldControl,
|
|
11
13
|
{
|
|
12
|
-
|
|
13
|
-
id
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
type: "checkable",
|
|
15
|
+
id,
|
|
16
|
+
render: /* @__PURE__ */ jsx(
|
|
17
|
+
AkCheckbox,
|
|
18
|
+
{
|
|
19
|
+
accessibleWhenDisabled: true,
|
|
20
|
+
...rest,
|
|
21
|
+
className: cx("\u{1F95D}-switch", props.className),
|
|
22
|
+
role: "switch",
|
|
23
|
+
ref: forwardedRef
|
|
24
|
+
}
|
|
25
|
+
)
|
|
18
26
|
}
|
|
19
27
|
);
|
|
20
28
|
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Role } from "@ariakit/react/role";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import cx from "classnames";
|
|
5
|
+
import { forwardRef } from "./~utils.js";
|
|
6
|
+
import { useMergedRefs } from "./~hooks.js";
|
|
7
|
+
const TableContext = React.createContext({
|
|
8
|
+
setCaptionId: () => {
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const Table = forwardRef((props, forwardedRef) => {
|
|
12
|
+
const [captionId, setCaptionId] = React.useState();
|
|
13
|
+
const tableContext = React.useMemo(() => ({ setCaptionId }), []);
|
|
14
|
+
return /* @__PURE__ */ jsx(TableContext.Provider, { value: tableContext, children: /* @__PURE__ */ jsx(
|
|
15
|
+
Role,
|
|
16
|
+
{
|
|
17
|
+
...props,
|
|
18
|
+
className: cx("\u{1F95D}-table", props.className),
|
|
19
|
+
ref: forwardedRef,
|
|
20
|
+
role: "table",
|
|
21
|
+
"aria-labelledby": captionId,
|
|
22
|
+
children: props.children
|
|
23
|
+
}
|
|
24
|
+
) });
|
|
25
|
+
});
|
|
26
|
+
DEV: Table.displayName = "Table.Root";
|
|
27
|
+
const TableHeaderContext = React.createContext(false);
|
|
28
|
+
const TableHeader = forwardRef(
|
|
29
|
+
(props, forwardedRef) => {
|
|
30
|
+
return /* @__PURE__ */ jsx(TableHeaderContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
|
|
31
|
+
Role.div,
|
|
32
|
+
{
|
|
33
|
+
...props,
|
|
34
|
+
className: cx("\u{1F95D}-table-header", props.className),
|
|
35
|
+
ref: forwardedRef,
|
|
36
|
+
role: "rowgroup",
|
|
37
|
+
children: props.children
|
|
38
|
+
}
|
|
39
|
+
) });
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
DEV: TableHeader.displayName = "Table.Header";
|
|
43
|
+
const TableBody = forwardRef((props, forwardedRef) => {
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
Role.div,
|
|
46
|
+
{
|
|
47
|
+
...props,
|
|
48
|
+
className: cx("\u{1F95D}-table-body", props.className),
|
|
49
|
+
ref: forwardedRef,
|
|
50
|
+
children: props.children
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
DEV: TableBody.displayName = "Table.Body";
|
|
55
|
+
const TableRow = forwardRef((props, forwardedRef) => {
|
|
56
|
+
const { children, ...rest } = props;
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
Role.div,
|
|
59
|
+
{
|
|
60
|
+
...rest,
|
|
61
|
+
className: cx("\u{1F95D}-table-row", props.className),
|
|
62
|
+
ref: forwardedRef,
|
|
63
|
+
role: "row",
|
|
64
|
+
children
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
DEV: TableRow.displayName = "Table.Row";
|
|
69
|
+
const TableCaption = forwardRef(
|
|
70
|
+
(props, forwardedRef) => {
|
|
71
|
+
const fallbackId = React.useId();
|
|
72
|
+
const { id = fallbackId, children, ...rest } = props;
|
|
73
|
+
const { setCaptionId } = React.useContext(TableContext);
|
|
74
|
+
const captionIdRef = React.useCallback(
|
|
75
|
+
(element) => {
|
|
76
|
+
setCaptionId(element ? id : void 0);
|
|
77
|
+
},
|
|
78
|
+
[id, setCaptionId]
|
|
79
|
+
);
|
|
80
|
+
return /* @__PURE__ */ jsx(
|
|
81
|
+
Role,
|
|
82
|
+
{
|
|
83
|
+
...rest,
|
|
84
|
+
id,
|
|
85
|
+
className: cx("\u{1F95D}-table-caption", props.className),
|
|
86
|
+
ref: useMergedRefs(forwardedRef, captionIdRef),
|
|
87
|
+
children
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
DEV: TableCaption.displayName = "Table.Caption";
|
|
93
|
+
const TableCell = forwardRef((props, forwardedRef) => {
|
|
94
|
+
const isWithinTableHeader = React.useContext(TableHeaderContext);
|
|
95
|
+
return /* @__PURE__ */ jsx(
|
|
96
|
+
Role.span,
|
|
97
|
+
{
|
|
98
|
+
...props,
|
|
99
|
+
className: cx("\u{1F95D}-table-cell", props.className),
|
|
100
|
+
ref: forwardedRef,
|
|
101
|
+
role: isWithinTableHeader ? "columnheader" : "cell",
|
|
102
|
+
children: props.children
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
DEV: TableCell.displayName = "Table.Cell";
|
|
107
|
+
export {
|
|
108
|
+
TableBody as Body,
|
|
109
|
+
TableCaption as Caption,
|
|
110
|
+
TableCell as Cell,
|
|
111
|
+
TableHeader as Header,
|
|
112
|
+
Table as Root,
|
|
113
|
+
TableRow as Row
|
|
114
|
+
};
|