@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/Root.js
CHANGED
|
@@ -1,51 +1,60 @@
|
|
|
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
|
-
import { isBrowser } from "./~utils.js";
|
|
8
|
-
import { useMergedRefs } from "./~hooks.js";
|
|
9
|
+
import { forwardRef, isBrowser } from "./~utils.js";
|
|
10
|
+
import { useIsClient, useMergedRefs } from "./~hooks.js";
|
|
9
11
|
const css = foundationsCss + bricksCss;
|
|
10
|
-
const Root =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
const Root = forwardRef((props, forwardedRef) => {
|
|
13
|
+
const { children, synchronizeColorScheme = false, ...rest } = props;
|
|
14
|
+
const [portalContainer, setPortalContainer] = React.useState(null);
|
|
15
|
+
return /* @__PURE__ */ jsxs(RootInternal, { ...rest, ref: forwardedRef, children: [
|
|
16
|
+
/* @__PURE__ */ jsx(Styles, {}),
|
|
17
|
+
/* @__PURE__ */ jsx(Fonts, {}),
|
|
18
|
+
synchronizeColorScheme ? /* @__PURE__ */ jsx(SynchronizeColorScheme, { colorScheme: props.colorScheme }) : null,
|
|
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 })
|
|
28
|
+
] });
|
|
29
|
+
});
|
|
21
30
|
DEV: Root.displayName = "Root";
|
|
22
31
|
const RootNodeContext = React.createContext(null);
|
|
23
32
|
function useRootNode() {
|
|
24
33
|
return React.useContext(RootNodeContext);
|
|
25
34
|
}
|
|
26
|
-
const RootInternal =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
null
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
const RootInternal = forwardRef(
|
|
36
|
+
(props, forwardedRef) => {
|
|
37
|
+
const { children, colorScheme, density, ...rest } = props;
|
|
38
|
+
const [rootNode, setRootNode] = React.useState(null);
|
|
39
|
+
const findRootNodeFromRef = React.useCallback((element) => {
|
|
40
|
+
if (!element) return;
|
|
41
|
+
const rootNode2 = element.getRootNode();
|
|
42
|
+
if (!isDocument(rootNode2) && !isShadow(rootNode2)) return;
|
|
43
|
+
setRootNode(rootNode2);
|
|
44
|
+
}, []);
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
46
|
+
Role,
|
|
47
|
+
{
|
|
48
|
+
...rest,
|
|
49
|
+
className: cx("\u{1F95D}-root", props.className),
|
|
50
|
+
"data-kiwi-theme": colorScheme,
|
|
51
|
+
"data-kiwi-density": density,
|
|
52
|
+
ref: useMergedRefs(forwardedRef, findRootNodeFromRef),
|
|
53
|
+
children: /* @__PURE__ */ jsx(RootNodeContext.Provider, { value: rootNode, children })
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
);
|
|
49
58
|
function SynchronizeColorScheme({
|
|
50
59
|
colorScheme
|
|
51
60
|
}) {
|
|
@@ -62,6 +71,26 @@ function SynchronizeColorScheme({
|
|
|
62
71
|
}, [rootNode, colorScheme]);
|
|
63
72
|
return null;
|
|
64
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
|
+
});
|
|
65
94
|
function Styles() {
|
|
66
95
|
const rootNode = useRootNode();
|
|
67
96
|
useLayoutEffect(() => {
|
|
@@ -105,8 +134,8 @@ function Fonts() {
|
|
|
105
134
|
return null;
|
|
106
135
|
}
|
|
107
136
|
function loadFonts(rootNode) {
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
137
|
+
const ownerWindow = getWindow(rootNode);
|
|
138
|
+
if (!ownerWindow || Array.from(ownerWindow.document.fonts).some(
|
|
110
139
|
(font) => font.family === "InterVariable"
|
|
111
140
|
)) {
|
|
112
141
|
return;
|
|
@@ -116,12 +145,16 @@ function loadFonts(rootNode) {
|
|
|
116
145
|
italic: "https://rsms.me/inter/font-files/InterVariable-Italic.woff2?v=4.1"
|
|
117
146
|
};
|
|
118
147
|
for (const [style, url] of Object.entries(interStyles)) {
|
|
119
|
-
const font = new FontFace(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
148
|
+
const font = new ownerWindow.FontFace(
|
|
149
|
+
"InterVariable",
|
|
150
|
+
`url(${url}) format("woff2")`,
|
|
151
|
+
{
|
|
152
|
+
display: "swap",
|
|
153
|
+
weight: "100 900",
|
|
154
|
+
style
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
ownerWindow.document.fonts.add(font);
|
|
125
158
|
}
|
|
126
159
|
}
|
|
127
160
|
const supportsAdoptedStylesheets = isBrowser && "adoptedStyleSheets" in Document.prototype;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import cx from "classnames";
|
|
4
|
+
import { Role } from "@ariakit/react/role";
|
|
5
|
+
import {
|
|
6
|
+
forwardRef,
|
|
7
|
+
isBrowser
|
|
8
|
+
} from "./~utils.js";
|
|
9
|
+
import { DisclosureArrow } from "./Icon.js";
|
|
10
|
+
import { FieldControl } from "./Field.js";
|
|
11
|
+
const supportsHas = isBrowser && CSS?.supports?.("selector(:has(+ *))");
|
|
12
|
+
const HtmlSelectContext = React.createContext(() => {
|
|
13
|
+
});
|
|
14
|
+
const SelectRoot = forwardRef((props, forwardedRef) => {
|
|
15
|
+
const [isHtmlSelect, setIsHtmlSelect] = React.useState(false);
|
|
16
|
+
return /* @__PURE__ */ jsx(HtmlSelectContext.Provider, { value: setIsHtmlSelect, children: /* @__PURE__ */ jsx(
|
|
17
|
+
Role.div,
|
|
18
|
+
{
|
|
19
|
+
...props,
|
|
20
|
+
className: cx("\u{1F95D}-select-root", props.className),
|
|
21
|
+
"data-kiwi-has-select": !supportsHas && isHtmlSelect ? "true" : void 0,
|
|
22
|
+
ref: forwardedRef
|
|
23
|
+
}
|
|
24
|
+
) });
|
|
25
|
+
});
|
|
26
|
+
const HtmlSelect = forwardRef(
|
|
27
|
+
(props, forwardedRef) => {
|
|
28
|
+
const { id, variant = "solid", ...rest } = props;
|
|
29
|
+
const setIsHtmlSelect = React.useContext(HtmlSelectContext);
|
|
30
|
+
React.useEffect(
|
|
31
|
+
function updateContext() {
|
|
32
|
+
setIsHtmlSelect(true);
|
|
33
|
+
},
|
|
34
|
+
[setIsHtmlSelect]
|
|
35
|
+
);
|
|
36
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
37
|
+
/* @__PURE__ */ jsx(
|
|
38
|
+
FieldControl,
|
|
39
|
+
{
|
|
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
|
+
)
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ jsx(DisclosureArrow, { className: "\u{1F95D}-select-arrow" })
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
export {
|
|
59
|
+
HtmlSelect,
|
|
60
|
+
SelectRoot as Root
|
|
61
|
+
};
|
|
@@ -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,22 +1,32 @@
|
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
import {
|
|
4
|
+
Checkbox as AkCheckbox
|
|
5
|
+
} from "@ariakit/react/checkbox";
|
|
6
|
+
import { FieldControl } from "./Field.js";
|
|
7
|
+
import { forwardRef } from "./~utils.js";
|
|
8
|
+
const Switch = forwardRef(
|
|
9
|
+
(props, forwardedRef) => {
|
|
10
|
+
const { id, ...rest } = props;
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
FieldControl,
|
|
13
|
+
{
|
|
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
|
+
)
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
);
|
|
20
30
|
DEV: Switch.displayName = "Switch";
|
|
21
31
|
export {
|
|
22
32
|
Switch
|
|
@@ -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
|
+
};
|
package/dist/DEV/bricks/Tabs.js
CHANGED
|
@@ -2,8 +2,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import * as ReactDOM from "react-dom";
|
|
4
4
|
import cx from "classnames";
|
|
5
|
-
import * as
|
|
5
|
+
import * as AkTab from "@ariakit/react/tab";
|
|
6
6
|
import { useControlledState } from "./~hooks.js";
|
|
7
|
+
import { forwardRef } from "./~utils.js";
|
|
7
8
|
function Tabs(props) {
|
|
8
9
|
const {
|
|
9
10
|
defaultSelectedId,
|
|
@@ -18,7 +19,7 @@ function Tabs(props) {
|
|
|
18
19
|
setSelectedIdProp
|
|
19
20
|
);
|
|
20
21
|
return /* @__PURE__ */ jsx(
|
|
21
|
-
|
|
22
|
+
AkTab.TabProvider,
|
|
22
23
|
{
|
|
23
24
|
selectedId,
|
|
24
25
|
setSelectedId: React.useCallback(
|
|
@@ -41,14 +42,14 @@ function Tabs(props) {
|
|
|
41
42
|
);
|
|
42
43
|
}
|
|
43
44
|
DEV: Tabs.displayName = "Tabs.Root";
|
|
44
|
-
const TabList =
|
|
45
|
+
const TabList = forwardRef((props, forwardedRef) => {
|
|
45
46
|
const { tone = "neutral", ...rest } = props;
|
|
46
47
|
const viewTransitionName = `\u{1F95D}active-stripe-${React.useId().replaceAll(":", "_")}`;
|
|
47
48
|
return /* @__PURE__ */ jsx(
|
|
48
|
-
|
|
49
|
+
AkTab.TabList,
|
|
49
50
|
{
|
|
50
|
-
"data-kiwi-tone": tone,
|
|
51
51
|
...rest,
|
|
52
|
+
"data-kiwi-tone": tone,
|
|
52
53
|
className: cx("\u{1F95D}-tab-list", props.className),
|
|
53
54
|
style: {
|
|
54
55
|
"--\u{1F95D}tab-active-stripe-view-transition-name": viewTransitionName,
|
|
@@ -59,23 +60,21 @@ const TabList = React.forwardRef((props, forwardedRef) => {
|
|
|
59
60
|
);
|
|
60
61
|
});
|
|
61
62
|
DEV: TabList.displayName = "Tabs.TabList";
|
|
62
|
-
const Tab =
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
);
|
|
63
|
+
const Tab = forwardRef((props, forwardedRef) => {
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
AkTab.Tab,
|
|
66
|
+
{
|
|
67
|
+
accessibleWhenDisabled: true,
|
|
68
|
+
...props,
|
|
69
|
+
className: cx("\u{1F95D}-tab", props.className),
|
|
70
|
+
ref: forwardedRef
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
});
|
|
75
74
|
DEV: Tab.displayName = "Tabs.Tab";
|
|
76
|
-
const TabPanel =
|
|
75
|
+
const TabPanel = forwardRef((props, forwardedRef) => {
|
|
77
76
|
return /* @__PURE__ */ jsx(
|
|
78
|
-
|
|
77
|
+
AkTab.TabPanel,
|
|
79
78
|
{
|
|
80
79
|
...props,
|
|
81
80
|
className: cx("\u{1F95D}-tab-panel", props.className),
|
|
@@ -0,0 +1,20 @@
|
|
|
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 Text = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const { variant, ...rest } = props;
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
Role,
|
|
9
|
+
{
|
|
10
|
+
...rest,
|
|
11
|
+
className: cx("\u{1F95D}-text", props.className),
|
|
12
|
+
"data-kiwi-text-variant": variant,
|
|
13
|
+
ref: forwardedRef
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
DEV: Text.displayName = "Text";
|
|
18
|
+
export {
|
|
19
|
+
Text
|
|
20
|
+
};
|