@itwin/itwinui-react 5.0.0-alpha.1 → 5.0.0-alpha.11
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 +102 -0
- 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 +177 -10
- 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.internal.js +17 -0
- package/dist/DEV/bricks/Root.js +103 -26
- package/dist/DEV/bricks/Select.js +17 -11
- package/dist/DEV/bricks/Skeleton.js +24 -0
- package/dist/DEV/bricks/Spinner.js +55 -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 +227 -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 +57 -3
- package/dist/DEV/bricks/~utils.GhostAligner.js +13 -0
- package/dist/DEV/bricks/{ListItem.js → ~utils.ListItem.js} +19 -3
- package/dist/DEV/bricks/~utils.js +17 -0
- 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 +43 -4
- package/dist/bricks/Icon.js +174 -10
- 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.d.ts +12 -0
- package/dist/bricks/Root.internal.d.ts +6 -0
- package/dist/bricks/Root.internal.js +17 -0
- package/dist/bricks/Root.js +103 -26
- 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 +54 -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 +129 -0
- package/dist/bricks/TreeItem.js +222 -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 +63 -0
- package/dist/bricks/~hooks.js +57 -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 +14 -3
- package/dist/bricks/~utils.js +17 -0
- package/dist/foundations/styles.css.js +2 -2
- package/package.json +14 -13
- 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/Root.js
CHANGED
|
@@ -1,26 +1,51 @@
|
|
|
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 {
|
|
8
|
-
|
|
9
|
+
import {
|
|
10
|
+
forwardRef,
|
|
11
|
+
getOwnerDocument,
|
|
12
|
+
identity,
|
|
13
|
+
isBrowser,
|
|
14
|
+
isDocument
|
|
15
|
+
} from "./~utils.js";
|
|
16
|
+
import { useLayoutEffect, useMergedRefs } from "./~hooks.js";
|
|
17
|
+
import {
|
|
18
|
+
HtmlSanitizerContext,
|
|
19
|
+
RootNodeContext,
|
|
20
|
+
spriteSheetId,
|
|
21
|
+
useRootNode
|
|
22
|
+
} from "./Root.internal.js";
|
|
9
23
|
const css = foundationsCss + bricksCss;
|
|
10
24
|
const Root = forwardRef((props, forwardedRef) => {
|
|
11
|
-
const {
|
|
25
|
+
const {
|
|
26
|
+
children,
|
|
27
|
+
synchronizeColorScheme = false,
|
|
28
|
+
unstable_htmlSanitizer = identity,
|
|
29
|
+
...rest
|
|
30
|
+
} = props;
|
|
31
|
+
const [portalContainer, setPortalContainer] = React.useState(null);
|
|
12
32
|
return /* @__PURE__ */ jsxs(RootInternal, { ...rest, ref: forwardedRef, children: [
|
|
13
33
|
/* @__PURE__ */ jsx(Styles, {}),
|
|
14
34
|
/* @__PURE__ */ jsx(Fonts, {}),
|
|
35
|
+
/* @__PURE__ */ jsx(InlineSpriteSheet, {}),
|
|
15
36
|
synchronizeColorScheme ? /* @__PURE__ */ jsx(SynchronizeColorScheme, { colorScheme: props.colorScheme }) : null,
|
|
16
|
-
|
|
37
|
+
/* @__PURE__ */ jsx(
|
|
38
|
+
PortalContainer,
|
|
39
|
+
{
|
|
40
|
+
colorScheme: props.colorScheme,
|
|
41
|
+
density: props.density,
|
|
42
|
+
ref: setPortalContainer
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ jsx(PortalContext.Provider, { value: portalContainer, children: /* @__PURE__ */ jsx(HtmlSanitizerContext.Provider, { value: unstable_htmlSanitizer, children }) })
|
|
17
46
|
] });
|
|
18
47
|
});
|
|
19
48
|
DEV: Root.displayName = "Root";
|
|
20
|
-
const RootNodeContext = React.createContext(null);
|
|
21
|
-
function useRootNode() {
|
|
22
|
-
return React.useContext(RootNodeContext);
|
|
23
|
-
}
|
|
24
49
|
const RootInternal = forwardRef(
|
|
25
50
|
(props, forwardedRef) => {
|
|
26
51
|
const { children, colorScheme, density, ...rest } = props;
|
|
@@ -32,7 +57,7 @@ const RootInternal = forwardRef(
|
|
|
32
57
|
setRootNode(rootNode2);
|
|
33
58
|
}, []);
|
|
34
59
|
return /* @__PURE__ */ jsx(
|
|
35
|
-
|
|
60
|
+
Role,
|
|
36
61
|
{
|
|
37
62
|
...rest,
|
|
38
63
|
className: cx("\u{1F95D}-root", props.className),
|
|
@@ -60,39 +85,69 @@ function SynchronizeColorScheme({
|
|
|
60
85
|
}, [rootNode, colorScheme]);
|
|
61
86
|
return null;
|
|
62
87
|
}
|
|
88
|
+
const PortalContainer = forwardRef((props, forwardedRef) => {
|
|
89
|
+
const rootNode = useRootNode();
|
|
90
|
+
if (!rootNode) return null;
|
|
91
|
+
const destination = isDocument(rootNode) ? rootNode.body : rootNode;
|
|
92
|
+
if (!destination) return null;
|
|
93
|
+
return ReactDOM.createPortal(
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
className: "\u{1F95D}-root",
|
|
98
|
+
"data-kiwi-theme": props.colorScheme,
|
|
99
|
+
"data-kiwi-density": props.density,
|
|
100
|
+
style: { display: "contents" },
|
|
101
|
+
ref: forwardedRef
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
destination
|
|
105
|
+
);
|
|
106
|
+
});
|
|
63
107
|
function Styles() {
|
|
64
108
|
const rootNode = useRootNode();
|
|
65
109
|
useLayoutEffect(() => {
|
|
66
110
|
if (!rootNode) return;
|
|
67
|
-
loadStyles(rootNode, { css });
|
|
111
|
+
const { cleanup } = loadStyles(rootNode, { css });
|
|
112
|
+
return cleanup;
|
|
68
113
|
}, [rootNode]);
|
|
69
114
|
return null;
|
|
70
115
|
}
|
|
71
|
-
const styleSheets =
|
|
72
|
-
|
|
116
|
+
const styleSheets = new Map(
|
|
117
|
+
Object.entries({ default: /* @__PURE__ */ new WeakMap() })
|
|
118
|
+
);
|
|
119
|
+
function loadStyles(rootNode, { css: css2, key = "default" }) {
|
|
120
|
+
let cleanup = () => {
|
|
121
|
+
};
|
|
73
122
|
const loaded = (() => {
|
|
74
123
|
if (!isBrowser) return false;
|
|
75
124
|
const ownerDocument = getOwnerDocument(rootNode);
|
|
76
125
|
const _window = getWindow(rootNode);
|
|
77
126
|
if (!ownerDocument || !_window) return false;
|
|
78
|
-
if (!supportsAdoptedStylesheets && !rootNode.querySelector(
|
|
127
|
+
if (!supportsAdoptedStylesheets && !rootNode.querySelector(`style[data-kiwi="${key}"]`)) {
|
|
79
128
|
const styleElement = ownerDocument.createElement("style");
|
|
80
|
-
styleElement.dataset.kiwi =
|
|
129
|
+
styleElement.dataset.kiwi = key;
|
|
81
130
|
styleElement.textContent = css2;
|
|
82
131
|
(rootNode.head || rootNode).appendChild(styleElement);
|
|
132
|
+
cleanup = () => styleElement.remove();
|
|
83
133
|
return true;
|
|
84
134
|
}
|
|
85
|
-
const styleSheet = styleSheets.get(_window) || new _window.CSSStyleSheet();
|
|
86
|
-
if (!styleSheets.has(_window)) {
|
|
87
|
-
styleSheets.set(_window, styleSheet);
|
|
135
|
+
const styleSheet = styleSheets.get(key)?.get(_window) || new _window.CSSStyleSheet();
|
|
136
|
+
if (!styleSheets.get(key)?.has(_window)) {
|
|
137
|
+
styleSheets.get(key)?.set(_window, styleSheet);
|
|
88
138
|
}
|
|
89
139
|
styleSheet.replaceSync(css2);
|
|
90
140
|
if (!rootNode.adoptedStyleSheets.includes(styleSheet)) {
|
|
91
141
|
rootNode.adoptedStyleSheets.push(styleSheet);
|
|
142
|
+
cleanup = () => {
|
|
143
|
+
rootNode.adoptedStyleSheets = rootNode.adoptedStyleSheets.filter(
|
|
144
|
+
(sheet) => sheet !== styleSheet
|
|
145
|
+
);
|
|
146
|
+
};
|
|
92
147
|
}
|
|
93
148
|
return true;
|
|
94
149
|
})();
|
|
95
|
-
return { loaded };
|
|
150
|
+
return { loaded, cleanup };
|
|
96
151
|
}
|
|
97
152
|
function Fonts() {
|
|
98
153
|
const rootNode = useRootNode();
|
|
@@ -102,6 +157,35 @@ function Fonts() {
|
|
|
102
157
|
}, [rootNode]);
|
|
103
158
|
return null;
|
|
104
159
|
}
|
|
160
|
+
function InlineSpriteSheet() {
|
|
161
|
+
const rootNode = useRootNode();
|
|
162
|
+
React.useEffect(
|
|
163
|
+
function maybeCreateSpriteSheet() {
|
|
164
|
+
const ownerDocument = getOwnerDocument(rootNode);
|
|
165
|
+
if (!ownerDocument) return;
|
|
166
|
+
const spriteSheet = ownerDocument?.getElementById(spriteSheetId);
|
|
167
|
+
if (spriteSheet) return;
|
|
168
|
+
const svg = ownerDocument.createElementNS(
|
|
169
|
+
"http://www.w3.org/2000/svg",
|
|
170
|
+
"svg"
|
|
171
|
+
);
|
|
172
|
+
svg.id = spriteSheetId;
|
|
173
|
+
svg.style.display = "none";
|
|
174
|
+
Object.defineProperty(svg, Symbol.for("\u{1F95D}"), {
|
|
175
|
+
value: { icons: /* @__PURE__ */ new Map() }
|
|
176
|
+
// Map of icon URLs that have already been inlined.
|
|
177
|
+
});
|
|
178
|
+
ownerDocument.body.appendChild(svg);
|
|
179
|
+
return () => {
|
|
180
|
+
if (svg.isConnected) {
|
|
181
|
+
ownerDocument.body.removeChild(svg);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
},
|
|
185
|
+
[rootNode]
|
|
186
|
+
);
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
105
189
|
function loadFonts(rootNode) {
|
|
106
190
|
const ownerWindow = getWindow(rootNode);
|
|
107
191
|
if (!ownerWindow || Array.from(ownerWindow.document.fonts).some(
|
|
@@ -130,17 +214,10 @@ const supportsAdoptedStylesheets = isBrowser && "adoptedStyleSheets" in Document
|
|
|
130
214
|
function isShadow(node) {
|
|
131
215
|
return node instanceof ShadowRoot || node?.nodeType === Node.DOCUMENT_FRAGMENT_NODE && !!node?.host;
|
|
132
216
|
}
|
|
133
|
-
function isDocument(node) {
|
|
134
|
-
return node?.nodeType === Node.DOCUMENT_NODE;
|
|
135
|
-
}
|
|
136
|
-
function getOwnerDocument(node) {
|
|
137
|
-
return (isDocument(node) ? node : node.ownerDocument) || null;
|
|
138
|
-
}
|
|
139
217
|
function getWindow(node) {
|
|
140
218
|
const ownerDocument = getOwnerDocument(node);
|
|
141
219
|
return ownerDocument?.defaultView || null;
|
|
142
220
|
}
|
|
143
|
-
const useLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;
|
|
144
221
|
export {
|
|
145
222
|
Root
|
|
146
223
|
};
|
|
@@ -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,55 @@
|
|
|
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
|
+
"data-kiwi-variant": "indeterminate",
|
|
21
|
+
className: cx("\u{1F95D}-spinner", props.className),
|
|
22
|
+
ref: forwardedRef,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", className: "\u{1F95D}-spinner-svg", viewBox: "0 0 16 16", children: [
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
"circle",
|
|
27
|
+
{
|
|
28
|
+
pathLength: "100",
|
|
29
|
+
className: "\u{1F95D}-spinner-svg-track",
|
|
30
|
+
cx: "8",
|
|
31
|
+
cy: "8",
|
|
32
|
+
r: "6.5"
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
"circle",
|
|
37
|
+
{
|
|
38
|
+
pathLength: "100",
|
|
39
|
+
className: "\u{1F95D}-spinner-svg-fill",
|
|
40
|
+
cx: "8",
|
|
41
|
+
cy: "8",
|
|
42
|
+
r: "6.5"
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: alt })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
DEV: Spinner.displayName = "Spinner";
|
|
53
|
+
export {
|
|
54
|
+
Spinner
|
|
55
|
+
};
|
|
@@ -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
|
+
};
|
package/dist/DEV/bricks/Tabs.js
CHANGED
|
@@ -2,7 +2,7 @@ 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
7
|
import { forwardRef } from "./~utils.js";
|
|
8
8
|
function Tabs(props) {
|
|
@@ -19,7 +19,7 @@ function Tabs(props) {
|
|
|
19
19
|
setSelectedIdProp
|
|
20
20
|
);
|
|
21
21
|
return /* @__PURE__ */ jsx(
|
|
22
|
-
|
|
22
|
+
AkTab.TabProvider,
|
|
23
23
|
{
|
|
24
24
|
selectedId,
|
|
25
25
|
setSelectedId: React.useCallback(
|
|
@@ -46,10 +46,10 @@ const TabList = forwardRef((props, forwardedRef) => {
|
|
|
46
46
|
const { tone = "neutral", ...rest } = props;
|
|
47
47
|
const viewTransitionName = `\u{1F95D}active-stripe-${React.useId().replaceAll(":", "_")}`;
|
|
48
48
|
return /* @__PURE__ */ jsx(
|
|
49
|
-
|
|
49
|
+
AkTab.TabList,
|
|
50
50
|
{
|
|
51
|
-
"data-kiwi-tone": tone,
|
|
52
51
|
...rest,
|
|
52
|
+
"data-kiwi-tone": tone,
|
|
53
53
|
className: cx("\u{1F95D}-tab-list", props.className),
|
|
54
54
|
style: {
|
|
55
55
|
"--\u{1F95D}tab-active-stripe-view-transition-name": viewTransitionName,
|
|
@@ -62,7 +62,7 @@ const TabList = forwardRef((props, forwardedRef) => {
|
|
|
62
62
|
DEV: TabList.displayName = "Tabs.TabList";
|
|
63
63
|
const Tab = forwardRef((props, forwardedRef) => {
|
|
64
64
|
return /* @__PURE__ */ jsx(
|
|
65
|
-
|
|
65
|
+
AkTab.Tab,
|
|
66
66
|
{
|
|
67
67
|
accessibleWhenDisabled: true,
|
|
68
68
|
...props,
|
|
@@ -74,7 +74,7 @@ const Tab = forwardRef((props, forwardedRef) => {
|
|
|
74
74
|
DEV: Tab.displayName = "Tabs.Tab";
|
|
75
75
|
const TabPanel = forwardRef((props, forwardedRef) => {
|
|
76
76
|
return /* @__PURE__ */ jsx(
|
|
77
|
-
|
|
77
|
+
AkTab.TabPanel,
|
|
78
78
|
{
|
|
79
79
|
...props,
|
|
80
80
|
className: cx("\u{1F95D}-tab-panel", props.className),
|
package/dist/DEV/bricks/Text.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { Role } from "@ariakit/react/role";
|
|
3
3
|
import cx from "classnames";
|
|
4
4
|
import { forwardRef } from "./~utils.js";
|
|
5
5
|
const Text = forwardRef((props, forwardedRef) => {
|
|
6
6
|
const { variant, ...rest } = props;
|
|
7
7
|
return /* @__PURE__ */ jsx(
|
|
8
|
-
|
|
8
|
+
Role,
|
|
9
9
|
{
|
|
10
10
|
...rest,
|
|
11
11
|
className: cx("\u{1F95D}-text", props.className),
|
|
@@ -1,39 +1,77 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
|
+
import { Focusable } from "@ariakit/react/focusable";
|
|
4
5
|
import cx from "classnames";
|
|
5
|
-
import {
|
|
6
|
+
import { FieldControl } from "./Field.js";
|
|
6
7
|
import { Icon } from "./Icon.js";
|
|
7
|
-
import { Textarea } from "./Textarea.js";
|
|
8
8
|
import { useMergedRefs } from "./~hooks.js";
|
|
9
9
|
import { forwardRef } from "./~utils.js";
|
|
10
10
|
const TextBoxInput = forwardRef(
|
|
11
11
|
(props, forwardedRef) => {
|
|
12
|
-
const
|
|
12
|
+
const { id, ...rest } = props;
|
|
13
13
|
const rootContext = React.useContext(TextBoxRootContext);
|
|
14
14
|
const setDisabled = rootContext?.setDisabled;
|
|
15
15
|
React.useEffect(() => {
|
|
16
16
|
setDisabled?.(props.disabled);
|
|
17
17
|
}, [setDisabled, props.disabled]);
|
|
18
18
|
return /* @__PURE__ */ jsx(
|
|
19
|
-
|
|
19
|
+
FieldControl,
|
|
20
20
|
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
className: cx({ "\u{1F95D}-text-box": !rootContext }, props.className),
|
|
21
|
+
type: "textlike",
|
|
22
|
+
id,
|
|
24
23
|
render: /* @__PURE__ */ jsx(
|
|
25
|
-
|
|
24
|
+
Role.input,
|
|
26
25
|
{
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
readOnly: props.disabled,
|
|
27
|
+
...rest,
|
|
28
|
+
className: cx({ "\u{1F95D}-text-box": !rootContext }, props.className),
|
|
29
|
+
placeholder: props.placeholder ?? " ",
|
|
30
|
+
render: /* @__PURE__ */ jsx(
|
|
31
|
+
Focusable,
|
|
32
|
+
{
|
|
33
|
+
accessibleWhenDisabled: true,
|
|
34
|
+
render: props.render || /* @__PURE__ */ jsx("input", {})
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
ref: useMergedRefs(rootContext?.inputRef, forwardedRef)
|
|
29
38
|
}
|
|
30
|
-
)
|
|
31
|
-
ref: useMergedRefs(rootContext?.inputRef, forwardedRef)
|
|
39
|
+
)
|
|
32
40
|
}
|
|
33
41
|
);
|
|
34
42
|
}
|
|
35
43
|
);
|
|
36
44
|
DEV: TextBoxInput.displayName = "TextBox.Input";
|
|
45
|
+
const TextBoxTextarea = forwardRef(
|
|
46
|
+
(props, forwardedRef) => {
|
|
47
|
+
const { id, ...rest } = props;
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
FieldControl,
|
|
50
|
+
{
|
|
51
|
+
type: "textlike",
|
|
52
|
+
id,
|
|
53
|
+
render: /* @__PURE__ */ jsx(
|
|
54
|
+
Role.textarea,
|
|
55
|
+
{
|
|
56
|
+
readOnly: props.disabled,
|
|
57
|
+
...rest,
|
|
58
|
+
className: cx("\u{1F95D}-text-box", props.className),
|
|
59
|
+
placeholder: props.placeholder ?? " ",
|
|
60
|
+
render: /* @__PURE__ */ jsx(
|
|
61
|
+
Focusable,
|
|
62
|
+
{
|
|
63
|
+
accessibleWhenDisabled: true,
|
|
64
|
+
render: props.render || /* @__PURE__ */ jsx("textarea", {})
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
ref: forwardedRef
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
DEV: TextBoxTextarea.displayName = "TextBox.Textarea";
|
|
37
75
|
const TextBoxRoot = forwardRef(
|
|
38
76
|
(props, forwardedRef) => {
|
|
39
77
|
const inputRef = React.useRef(null);
|
|
@@ -43,7 +81,7 @@ const TextBoxRoot = forwardRef(
|
|
|
43
81
|
{
|
|
44
82
|
value: React.useMemo(() => ({ setDisabled, inputRef }), []),
|
|
45
83
|
children: /* @__PURE__ */ jsx(
|
|
46
|
-
|
|
84
|
+
Role.div,
|
|
47
85
|
{
|
|
48
86
|
...props,
|
|
49
87
|
"data-kiwi-disabled": disabled,
|
|
@@ -80,7 +118,7 @@ DEV: TextBoxIcon.displayName = "TextBox.Icon";
|
|
|
80
118
|
const TextBoxText = forwardRef(
|
|
81
119
|
(props, forwardedRef) => {
|
|
82
120
|
return /* @__PURE__ */ jsx(
|
|
83
|
-
|
|
121
|
+
Role.span,
|
|
84
122
|
{
|
|
85
123
|
...props,
|
|
86
124
|
className: cx("\u{1F95D}-text-box-decoration", props.className),
|
|
@@ -96,5 +134,5 @@ export {
|
|
|
96
134
|
TextBoxInput as Input,
|
|
97
135
|
TextBoxRoot as Root,
|
|
98
136
|
TextBoxText as Text,
|
|
99
|
-
Textarea
|
|
137
|
+
TextBoxTextarea as Textarea
|
|
100
138
|
};
|