@stratakit/structures 0.4.5 → 0.5.1
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 +74 -0
- package/dist/AccordionItem.d.ts +1 -1
- package/dist/AccordionItem.js +69 -124
- package/dist/Banner.js +149 -120
- package/dist/Chip.js +86 -58
- package/dist/DEV/AccordionItem.js +2 -0
- package/dist/DEV/Banner.js +3 -0
- package/dist/DEV/Chip.js +3 -0
- package/dist/DEV/Dialog.js +2 -0
- package/dist/DEV/DropdownMenu.js +2 -0
- package/dist/DEV/ErrorRegion.js +5 -11
- package/dist/DEV/NavigationList.js +130 -0
- package/dist/DEV/NavigationRail.js +6 -4
- package/dist/DEV/Popover.js +90 -0
- package/dist/DEV/Table.js +3 -0
- package/dist/DEV/Tabs.js +3 -1
- package/dist/DEV/Toolbar.js +2 -0
- package/dist/DEV/Tree.js +2 -0
- package/dist/DEV/TreeItem.js +7 -2
- package/dist/DEV/index.js +4 -0
- package/dist/DEV/styles.css.js +1 -1
- package/dist/DEV/~utils.ListItem.js +3 -3
- package/dist/DEV/~utils.useInit.js +16 -0
- package/dist/Dialog.js +142 -132
- package/dist/DropdownMenu.js +217 -234
- package/dist/ErrorRegion.d.ts +18 -8
- package/dist/ErrorRegion.js +129 -154
- package/dist/NavigationList.d.ts +110 -0
- package/dist/NavigationList.js +130 -0
- package/dist/NavigationRail.js +211 -188
- package/dist/Popover.d.ts +36 -0
- package/dist/Popover.js +99 -0
- package/dist/Table.js +119 -108
- package/dist/Tabs.js +100 -63
- package/dist/Toolbar.js +25 -43
- package/dist/Tree.js +15 -12
- package/dist/TreeItem.js +398 -314
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/styles.css.js +1 -1
- package/dist/~utils.ListItem.d.ts +3 -3
- package/dist/~utils.ListItem.js +21 -34
- package/dist/~utils.icons.js +26 -46
- package/dist/~utils.useInit.d.ts +8 -0
- package/dist/~utils.useInit.js +13 -0
- package/package.json +25 -18
package/dist/Table.js
CHANGED
|
@@ -1,137 +1,148 @@
|
|
|
1
|
+
import { c as _c } from "react-compiler-runtime";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import { Role } from "@ariakit/react/role";
|
|
4
|
-
import {
|
|
5
|
-
forwardRef,
|
|
6
|
-
useMergedRefs,
|
|
7
|
-
useSafeContext
|
|
8
|
-
} from "@stratakit/foundations/secret-internals";
|
|
5
|
+
import { forwardRef, useMergedRefs, useSafeContext } from "@stratakit/foundations/secret-internals";
|
|
9
6
|
import cx from "classnames";
|
|
7
|
+
import { useInit } from "./~utils.useInit.js";
|
|
10
8
|
const TableContext = React.createContext(void 0);
|
|
11
9
|
const TableHeaderContext = React.createContext(false);
|
|
12
10
|
const HtmlTable = forwardRef((props, forwardedRef) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
);
|
|
17
|
-
return /* @__PURE__ */ jsx(TableContext.Provider, {
|
|
18
|
-
|
|
19
|
-
{
|
|
11
|
+
useInit();
|
|
12
|
+
const tableContextValue = React.useMemo(() => ({
|
|
13
|
+
mode: "html"
|
|
14
|
+
}), []);
|
|
15
|
+
return /* @__PURE__ */ jsx(TableContext.Provider, {
|
|
16
|
+
value: tableContextValue,
|
|
17
|
+
children: /* @__PURE__ */ jsx(Role, {
|
|
20
18
|
render: /* @__PURE__ */ jsx("table", {}),
|
|
21
19
|
...props,
|
|
22
20
|
ref: forwardedRef,
|
|
23
21
|
className: cx("\u{1F95D}Table", props.className)
|
|
24
|
-
}
|
|
25
|
-
|
|
22
|
+
})
|
|
23
|
+
});
|
|
26
24
|
});
|
|
27
|
-
const CustomTable = forwardRef(
|
|
28
|
-
(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
ref: forwardedRef,
|
|
41
|
-
className: cx("\u{1F95D}Table", props.className)
|
|
42
|
-
}
|
|
43
|
-
) });
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
const TableHeader = forwardRef(
|
|
47
|
-
(props, forwardedRef) => {
|
|
48
|
-
const { mode } = useSafeContext(TableContext);
|
|
49
|
-
const render = mode === "html" ? /* @__PURE__ */ jsx("thead", {}) : void 0;
|
|
50
|
-
const role = mode === "aria" ? "rowgroup" : void 0;
|
|
51
|
-
return /* @__PURE__ */ jsx(TableHeaderContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
|
|
52
|
-
Role.div,
|
|
53
|
-
{
|
|
54
|
-
render,
|
|
55
|
-
role,
|
|
56
|
-
...props,
|
|
57
|
-
ref: forwardedRef,
|
|
58
|
-
className: cx("\u{1F95D}TableHeader", props.className)
|
|
59
|
-
}
|
|
60
|
-
) });
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
const TableBody = forwardRef((props, forwardedRef) => {
|
|
64
|
-
const { mode } = useSafeContext(TableContext);
|
|
65
|
-
const render = mode === "html" ? /* @__PURE__ */ jsx("tbody", {}) : void 0;
|
|
66
|
-
return /* @__PURE__ */ jsx(
|
|
67
|
-
Role.div,
|
|
68
|
-
{
|
|
69
|
-
render,
|
|
70
|
-
role: void 0,
|
|
25
|
+
const CustomTable = forwardRef((props, forwardedRef) => {
|
|
26
|
+
useInit();
|
|
27
|
+
const [captionId, setCaptionId] = React.useState();
|
|
28
|
+
const tableContextValue = React.useMemo(() => ({
|
|
29
|
+
captionId,
|
|
30
|
+
setCaptionId,
|
|
31
|
+
mode: "aria"
|
|
32
|
+
}), [captionId]);
|
|
33
|
+
return /* @__PURE__ */ jsx(TableContext.Provider, {
|
|
34
|
+
value: tableContextValue,
|
|
35
|
+
children: /* @__PURE__ */ jsx(Role.div, {
|
|
36
|
+
role: "table",
|
|
37
|
+
"aria-labelledby": captionId,
|
|
71
38
|
...props,
|
|
72
39
|
ref: forwardedRef,
|
|
73
|
-
className: cx("\u{1F95D}
|
|
74
|
-
}
|
|
75
|
-
);
|
|
40
|
+
className: cx("\u{1F95D}Table", props.className)
|
|
41
|
+
})
|
|
42
|
+
});
|
|
76
43
|
});
|
|
77
|
-
const
|
|
78
|
-
const {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
44
|
+
const TableHeader = forwardRef((props, forwardedRef) => {
|
|
45
|
+
const {
|
|
46
|
+
mode
|
|
47
|
+
} = useSafeContext(TableContext);
|
|
48
|
+
const render = mode === "html" ? /* @__PURE__ */ jsx("thead", {}) : void 0;
|
|
49
|
+
const role = mode === "aria" ? "rowgroup" : void 0;
|
|
50
|
+
return /* @__PURE__ */ jsx(TableHeaderContext.Provider, {
|
|
51
|
+
value: true,
|
|
52
|
+
children: /* @__PURE__ */ jsx(Role.div, {
|
|
84
53
|
render,
|
|
85
54
|
role,
|
|
86
55
|
...props,
|
|
87
56
|
ref: forwardedRef,
|
|
88
|
-
className: cx("\u{1F95D}
|
|
89
|
-
}
|
|
90
|
-
);
|
|
57
|
+
className: cx("\u{1F95D}TableHeader", props.className)
|
|
58
|
+
})
|
|
59
|
+
});
|
|
91
60
|
});
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
61
|
+
const TableBody = forwardRef((props, forwardedRef) => {
|
|
62
|
+
const {
|
|
63
|
+
mode
|
|
64
|
+
} = useSafeContext(TableContext);
|
|
65
|
+
const render = mode === "html" ? /* @__PURE__ */ jsx("tbody", {}) : void 0;
|
|
66
|
+
return /* @__PURE__ */ jsx(Role.div, {
|
|
67
|
+
render,
|
|
68
|
+
role: void 0,
|
|
69
|
+
...props,
|
|
70
|
+
ref: forwardedRef,
|
|
71
|
+
className: cx("\u{1F95D}TableBody", props.className)
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
const TableRow = forwardRef((props, forwardedRef) => {
|
|
75
|
+
const {
|
|
76
|
+
mode
|
|
77
|
+
} = useSafeContext(TableContext);
|
|
78
|
+
const render = mode === "html" ? /* @__PURE__ */ jsx("tr", {}) : void 0;
|
|
79
|
+
const role = mode === "aria" ? "row" : void 0;
|
|
80
|
+
return /* @__PURE__ */ jsx(Role.div, {
|
|
81
|
+
render,
|
|
82
|
+
role,
|
|
83
|
+
...props,
|
|
84
|
+
ref: forwardedRef,
|
|
85
|
+
className: cx("\u{1F95D}TableRow", props.className)
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
const TableCaption = forwardRef((props, forwardedRef) => {
|
|
89
|
+
const $ = _c(3);
|
|
90
|
+
const fallbackId = React.useId();
|
|
91
|
+
const {
|
|
92
|
+
id: t0,
|
|
93
|
+
...rest
|
|
94
|
+
} = props;
|
|
95
|
+
const id = t0 === void 0 ? fallbackId : t0;
|
|
96
|
+
const {
|
|
97
|
+
mode,
|
|
98
|
+
setCaptionId
|
|
99
|
+
} = useSafeContext(TableContext);
|
|
100
|
+
const render = mode === "html" ? jsx("caption", {}) : void 0;
|
|
101
|
+
let t1;
|
|
102
|
+
if ($[0] !== id || $[1] !== setCaptionId) {
|
|
103
|
+
t1 = (element) => {
|
|
104
|
+
setCaptionId?.(element ? id : void 0);
|
|
105
|
+
};
|
|
106
|
+
$[0] = id;
|
|
107
|
+
$[1] = setCaptionId;
|
|
108
|
+
$[2] = t1;
|
|
109
|
+
} else {
|
|
110
|
+
t1 = $[2];
|
|
114
111
|
}
|
|
115
|
-
|
|
112
|
+
const captionIdRef = t1;
|
|
113
|
+
return jsx(Role.div, {
|
|
114
|
+
render,
|
|
115
|
+
...rest,
|
|
116
|
+
id,
|
|
117
|
+
ref: useMergedRefs(forwardedRef, captionIdRef),
|
|
118
|
+
className: cx("\u{1F95D}TableCaption", props.className)
|
|
119
|
+
});
|
|
120
|
+
});
|
|
116
121
|
const TableCell = forwardRef((props, forwardedRef) => {
|
|
117
122
|
const isWithinTableHeader = useSafeContext(TableHeaderContext);
|
|
118
|
-
const {
|
|
119
|
-
|
|
123
|
+
const {
|
|
124
|
+
mode
|
|
125
|
+
} = useSafeContext(TableContext);
|
|
126
|
+
const {
|
|
127
|
+
render,
|
|
128
|
+
role
|
|
129
|
+
} = React.useMemo(() => {
|
|
120
130
|
if (mode === "aria") {
|
|
121
|
-
return {
|
|
131
|
+
return {
|
|
132
|
+
role: isWithinTableHeader ? "columnheader" : "cell"
|
|
133
|
+
};
|
|
122
134
|
}
|
|
123
|
-
return {
|
|
135
|
+
return {
|
|
136
|
+
render: isWithinTableHeader ? /* @__PURE__ */ jsx("th", {}) : /* @__PURE__ */ jsx("td", {})
|
|
137
|
+
};
|
|
124
138
|
}, [isWithinTableHeader, mode]);
|
|
125
|
-
return /* @__PURE__ */ jsx(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
className: cx("\u{1F95D}TableCell", props.className)
|
|
133
|
-
}
|
|
134
|
-
);
|
|
139
|
+
return /* @__PURE__ */ jsx(Role.div, {
|
|
140
|
+
render,
|
|
141
|
+
role,
|
|
142
|
+
...props,
|
|
143
|
+
ref: forwardedRef,
|
|
144
|
+
className: cx("\u{1F95D}TableCell", props.className)
|
|
145
|
+
});
|
|
135
146
|
});
|
|
136
147
|
export {
|
|
137
148
|
TableBody as Body,
|
package/dist/Tabs.js
CHANGED
|
@@ -1,94 +1,131 @@
|
|
|
1
|
+
import { c as _c } from "react-compiler-runtime";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
3
|
import { useStoreState } from "@ariakit/react/store";
|
|
3
4
|
import * as AkTab from "@ariakit/react/tab";
|
|
4
|
-
import {
|
|
5
|
-
forwardRef,
|
|
6
|
-
isBrowser,
|
|
7
|
-
useUnreactiveCallback
|
|
8
|
-
} from "@stratakit/foundations/secret-internals";
|
|
5
|
+
import { forwardRef, isBrowser, useUnreactiveCallback } from "@stratakit/foundations/secret-internals";
|
|
9
6
|
import cx from "classnames";
|
|
10
|
-
|
|
7
|
+
import { useInit } from "./~utils.useInit.js";
|
|
8
|
+
const supportsAnchorPositioning = isBrowser && CSS?.supports?.("anchor-name: --foo");
|
|
11
9
|
const prefersReducedMotion = () => isBrowser && window.matchMedia("(prefers-reduced-motion)").matches;
|
|
12
10
|
function TabsProvider(props) {
|
|
11
|
+
const $ = _c(14);
|
|
12
|
+
useInit();
|
|
13
13
|
const {
|
|
14
14
|
defaultSelectedId,
|
|
15
15
|
selectedId,
|
|
16
16
|
setSelectedId,
|
|
17
|
-
selectOnMove
|
|
17
|
+
selectOnMove: t0,
|
|
18
18
|
children
|
|
19
19
|
} = props;
|
|
20
|
-
const
|
|
20
|
+
const selectOnMove = t0 === void 0 ? false : t0;
|
|
21
|
+
let t1;
|
|
22
|
+
if ($[0] !== defaultSelectedId) {
|
|
23
|
+
t1 = {
|
|
24
|
+
defaultSelectedId
|
|
25
|
+
};
|
|
26
|
+
$[0] = defaultSelectedId;
|
|
27
|
+
$[1] = t1;
|
|
28
|
+
} else {
|
|
29
|
+
t1 = $[1];
|
|
30
|
+
}
|
|
31
|
+
const store = AkTab.useTabStore(t1);
|
|
21
32
|
const tablist = useStoreState(store, "baseElement");
|
|
22
33
|
const selectedIdFromStore = useStoreState(store, "selectedId");
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
let t2;
|
|
35
|
+
if ($[2] !== selectedIdFromStore || $[3] !== tablist) {
|
|
36
|
+
t2 = (newSelectedId) => {
|
|
37
|
+
if (!supportsAnchorPositioning) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const rootNode = tablist?.getRootNode();
|
|
41
|
+
if (!rootNode || !selectedIdFromStore || !newSelectedId) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const previousTabRect = rootNode.getElementById?.(selectedIdFromStore)?.getBoundingClientRect();
|
|
45
|
+
const nextTabRect = rootNode.getElementById?.(newSelectedId)?.getBoundingClientRect();
|
|
46
|
+
if (!previousTabRect || !nextTabRect) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const deltaX = previousTabRect.left - nextTabRect.left;
|
|
50
|
+
const deltaWidth = previousTabRect.width / nextTabRect.width;
|
|
51
|
+
tablist?.animate([{
|
|
52
|
+
transform: `translateX(${deltaX}px) scaleX(${deltaWidth})`
|
|
53
|
+
}, {
|
|
54
|
+
transform: "none"
|
|
55
|
+
}], {
|
|
38
56
|
pseudoElement: "::after",
|
|
39
57
|
duration: 150,
|
|
40
58
|
easing: "ease-in-out"
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
$[2] = selectedIdFromStore;
|
|
62
|
+
$[3] = tablist;
|
|
63
|
+
$[4] = t2;
|
|
64
|
+
} else {
|
|
65
|
+
t2 = $[4];
|
|
66
|
+
}
|
|
67
|
+
const flipAnimateStripe = t2;
|
|
68
|
+
let t3;
|
|
69
|
+
if ($[5] !== flipAnimateStripe || $[6] !== setSelectedId) {
|
|
70
|
+
t3 = (newSelectedId_0) => {
|
|
71
|
+
if (!prefersReducedMotion()) {
|
|
72
|
+
flipAnimateStripe(newSelectedId_0);
|
|
41
73
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
74
|
+
setSelectedId?.(newSelectedId_0);
|
|
75
|
+
};
|
|
76
|
+
$[5] = flipAnimateStripe;
|
|
77
|
+
$[6] = setSelectedId;
|
|
78
|
+
$[7] = t3;
|
|
79
|
+
} else {
|
|
80
|
+
t3 = $[7];
|
|
81
|
+
}
|
|
82
|
+
const t4 = useUnreactiveCallback(t3);
|
|
83
|
+
let t5;
|
|
84
|
+
if ($[8] !== children || $[9] !== selectOnMove || $[10] !== selectedId || $[11] !== store || $[12] !== t4) {
|
|
85
|
+
t5 = jsx(AkTab.TabProvider, {
|
|
47
86
|
store,
|
|
48
87
|
selectedId,
|
|
49
|
-
setSelectedId:
|
|
50
|
-
(newSelectedId) => {
|
|
51
|
-
if (!prefersReducedMotion()) flipAnimateStripe(newSelectedId);
|
|
52
|
-
setSelectedId?.(newSelectedId);
|
|
53
|
-
}
|
|
54
|
-
),
|
|
88
|
+
setSelectedId: t4,
|
|
55
89
|
selectOnMove,
|
|
56
90
|
children
|
|
57
|
-
}
|
|
58
|
-
|
|
91
|
+
});
|
|
92
|
+
$[8] = children;
|
|
93
|
+
$[9] = selectOnMove;
|
|
94
|
+
$[10] = selectedId;
|
|
95
|
+
$[11] = store;
|
|
96
|
+
$[12] = t4;
|
|
97
|
+
$[13] = t5;
|
|
98
|
+
} else {
|
|
99
|
+
t5 = $[13];
|
|
100
|
+
}
|
|
101
|
+
return t5;
|
|
59
102
|
}
|
|
60
103
|
const TabList = forwardRef((props, forwardedRef) => {
|
|
61
|
-
const {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
);
|
|
104
|
+
const {
|
|
105
|
+
tone = "neutral",
|
|
106
|
+
...rest
|
|
107
|
+
} = props;
|
|
108
|
+
return /* @__PURE__ */ jsx(AkTab.TabList, {
|
|
109
|
+
...rest,
|
|
110
|
+
"data-_sk-tone": tone,
|
|
111
|
+
className: cx("\u{1F95D}TabList", props.className),
|
|
112
|
+
ref: forwardedRef
|
|
113
|
+
});
|
|
71
114
|
});
|
|
72
115
|
const Tab = forwardRef((props, forwardedRef) => {
|
|
73
|
-
return /* @__PURE__ */ jsx(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
ref: forwardedRef
|
|
80
|
-
}
|
|
81
|
-
);
|
|
116
|
+
return /* @__PURE__ */ jsx(AkTab.Tab, {
|
|
117
|
+
accessibleWhenDisabled: true,
|
|
118
|
+
...props,
|
|
119
|
+
className: cx("\u{1F95D}Tab", props.className),
|
|
120
|
+
ref: forwardedRef
|
|
121
|
+
});
|
|
82
122
|
});
|
|
83
123
|
const TabPanel = forwardRef((props, forwardedRef) => {
|
|
84
|
-
return /* @__PURE__ */ jsx(
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
ref: forwardedRef
|
|
90
|
-
}
|
|
91
|
-
);
|
|
124
|
+
return /* @__PURE__ */ jsx(AkTab.TabPanel, {
|
|
125
|
+
...props,
|
|
126
|
+
className: cx("\u{1F95D}TabPanel", props.className),
|
|
127
|
+
ref: forwardedRef
|
|
128
|
+
});
|
|
92
129
|
});
|
|
93
130
|
export {
|
|
94
131
|
TabsProvider as Provider,
|
package/dist/Toolbar.js
CHANGED
|
@@ -1,53 +1,35 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import * as Toolbar from "@ariakit/react/toolbar";
|
|
4
|
-
import {
|
|
5
|
-
IconButtonContext,
|
|
6
|
-
TooltipContext
|
|
7
|
-
} from "@stratakit/bricks/secret-internals";
|
|
4
|
+
import { IconButtonContext, TooltipContext } from "@stratakit/bricks/secret-internals";
|
|
8
5
|
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
9
6
|
import cx from "classnames";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}),
|
|
23
|
-
[props.orientation]
|
|
24
|
-
),
|
|
25
|
-
children: /* @__PURE__ */ jsx(
|
|
26
|
-
Toolbar.Toolbar,
|
|
27
|
-
{
|
|
28
|
-
...props,
|
|
29
|
-
className: cx("\u{1F95D}Toolbar", props.className),
|
|
30
|
-
ref: forwardedRef
|
|
31
|
-
}
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
const ToolbarItem = forwardRef(
|
|
40
|
-
(props, forwardedRef) => {
|
|
41
|
-
return /* @__PURE__ */ jsx(
|
|
42
|
-
Toolbar.ToolbarItem,
|
|
43
|
-
{
|
|
7
|
+
import { useInit } from "./~utils.useInit.js";
|
|
8
|
+
const ToolbarGroup = forwardRef((props, forwardedRef) => {
|
|
9
|
+
useInit();
|
|
10
|
+
return /* @__PURE__ */ jsx(IconButtonContext.Provider, {
|
|
11
|
+
value: React.useMemo(() => ({
|
|
12
|
+
iconSize: "large"
|
|
13
|
+
}), []),
|
|
14
|
+
children: /* @__PURE__ */ jsx(TooltipContext.Provider, {
|
|
15
|
+
value: React.useMemo(() => ({
|
|
16
|
+
placement: props.orientation === "vertical" ? "right" : "top"
|
|
17
|
+
}), [props.orientation]),
|
|
18
|
+
children: /* @__PURE__ */ jsx(Toolbar.Toolbar, {
|
|
44
19
|
...props,
|
|
45
|
-
className: cx("\u{1F95D}
|
|
20
|
+
className: cx("\u{1F95D}Toolbar", props.className),
|
|
46
21
|
ref: forwardedRef
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
);
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
const ToolbarItem = forwardRef((props, forwardedRef) => {
|
|
27
|
+
return /* @__PURE__ */ jsx(Toolbar.ToolbarItem, {
|
|
28
|
+
...props,
|
|
29
|
+
className: cx("\u{1F95D}ToolbarItem", props.className),
|
|
30
|
+
ref: forwardedRef
|
|
31
|
+
});
|
|
32
|
+
});
|
|
51
33
|
export {
|
|
52
34
|
ToolbarGroup as Group,
|
|
53
35
|
ToolbarItem as Item
|
package/dist/Tree.js
CHANGED
|
@@ -3,20 +3,23 @@ import { Composite, useCompositeStore } from "@ariakit/react/composite";
|
|
|
3
3
|
import { Role } from "@ariakit/react/role";
|
|
4
4
|
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
5
5
|
import cx from "classnames";
|
|
6
|
+
import { useInit } from "./~utils.useInit.js";
|
|
6
7
|
import { Action as TreeItemAction, Root as TreeItemRoot } from "./TreeItem.js";
|
|
7
8
|
const Tree = forwardRef((props, forwardedRef) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
9
|
+
useInit();
|
|
10
|
+
const composite = useCompositeStore({
|
|
11
|
+
orientation: "vertical"
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ jsx(Role.div, {
|
|
14
|
+
role: "tree",
|
|
15
|
+
...props,
|
|
16
|
+
render: /* @__PURE__ */ jsx(Composite, {
|
|
17
|
+
store: composite
|
|
18
|
+
}),
|
|
19
|
+
className: cx("\u{1F95D}Tree", props.className),
|
|
20
|
+
ref: forwardedRef,
|
|
21
|
+
children: props.children
|
|
22
|
+
});
|
|
20
23
|
});
|
|
21
24
|
export {
|
|
22
25
|
TreeItemRoot as Item,
|