@stratakit/structures 0.1.0 → 0.1.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 +18 -0
- package/dist/AccordionItem.d.ts +133 -0
- package/dist/AccordionItem.js +103 -0
- package/dist/Banner.d.ts +81 -0
- package/dist/Banner.js +71 -0
- package/dist/Chip.d.ts +35 -0
- package/dist/Chip.js +41 -0
- package/dist/DEV/AccordionItem.js +109 -0
- package/dist/DEV/Banner.js +72 -0
- package/dist/DEV/Chip.js +42 -0
- package/dist/DEV/DropdownMenu.js +235 -0
- package/dist/DEV/ErrorRegion.js +164 -0
- package/dist/DEV/Table.js +151 -0
- package/dist/DEV/Tabs.js +66 -0
- package/dist/DEV/Toolbar.js +27 -0
- package/dist/DEV/Tree.js +26 -0
- package/dist/DEV/TreeItem.js +395 -0
- package/dist/DEV/index.js +21 -0
- package/dist/DEV/styles.css.js +1 -1
- package/dist/DEV/~utils.ListItem.js +49 -0
- package/dist/DEV/~utils.icons.js +61 -0
- package/dist/DropdownMenu.d.ts +113 -0
- package/dist/DropdownMenu.js +228 -0
- package/dist/ErrorRegion.d.ts +83 -0
- package/dist/ErrorRegion.js +162 -0
- package/dist/Table.d.ts +172 -0
- package/dist/Table.js +144 -0
- package/dist/Tabs.d.ts +81 -0
- package/dist/Tabs.js +62 -0
- package/dist/Toolbar.d.ts +36 -0
- package/dist/Toolbar.js +25 -0
- package/dist/Tree.d.ts +22 -0
- package/dist/Tree.js +25 -0
- package/dist/TreeItem.d.ts +183 -0
- package/dist/TreeItem.js +370 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +21 -0
- package/dist/styles.css.js +1 -1
- package/dist/~utils.ListItem.d.ts +14 -0
- package/dist/~utils.ListItem.js +46 -0
- package/dist/~utils.icons.d.ts +10 -0
- package/dist/~utils.icons.js +56 -0
- package/package.json +4 -4
package/dist/DEV/Tree.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Composite, useCompositeStore } from "@ariakit/react/composite";
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
|
+
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
5
|
+
import cx from "classnames";
|
|
6
|
+
import { Action as TreeItemAction, Root as TreeItemRoot } from "./TreeItem.js";
|
|
7
|
+
const Tree = forwardRef((props, forwardedRef) => {
|
|
8
|
+
const composite = useCompositeStore({ orientation: "vertical" });
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
Role.div,
|
|
11
|
+
{
|
|
12
|
+
role: "tree",
|
|
13
|
+
...props,
|
|
14
|
+
render: /* @__PURE__ */ jsx(Composite, { store: composite }),
|
|
15
|
+
className: cx("\u{1F95D}-tree", props.className),
|
|
16
|
+
ref: forwardedRef,
|
|
17
|
+
children: props.children
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
DEV: Tree.displayName = "Tree.Root";
|
|
22
|
+
export {
|
|
23
|
+
TreeItemRoot as Item,
|
|
24
|
+
TreeItemAction as ItemAction,
|
|
25
|
+
Tree as Root
|
|
26
|
+
};
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CompositeItem } from "@ariakit/react/composite";
|
|
3
|
+
import { PopoverProvider } from "@ariakit/react/popover";
|
|
4
|
+
import { Role } from "@ariakit/react/role";
|
|
5
|
+
import { Toolbar, ToolbarItem } from "@ariakit/react/toolbar";
|
|
6
|
+
import { IconButton } from "@stratakit/bricks";
|
|
7
|
+
import {
|
|
8
|
+
GhostAligner,
|
|
9
|
+
IconButtonPresentation
|
|
10
|
+
} from "@stratakit/bricks/secret-internals";
|
|
11
|
+
import { Icon } from "@stratakit/foundations";
|
|
12
|
+
import {
|
|
13
|
+
forwardRef,
|
|
14
|
+
useEventHandlers
|
|
15
|
+
} from "@stratakit/foundations/secret-internals";
|
|
16
|
+
import cx from "classnames";
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import * as DropdownMenu from "./DropdownMenu.js";
|
|
19
|
+
import * as ListItem from "./~utils.ListItem.js";
|
|
20
|
+
import { ChevronDown, MoreHorizontal, StatusIcon } from "./~utils.icons.js";
|
|
21
|
+
const TreeItemErrorContext = React.createContext(void 0);
|
|
22
|
+
const TreeItemActionsContext = React.createContext(void 0);
|
|
23
|
+
const TreeItemDecorationsContext = React.createContext(void 0);
|
|
24
|
+
const TreeItemIconContext = React.createContext(void 0);
|
|
25
|
+
const TreeItemDecorationIdContext = React.createContext(
|
|
26
|
+
void 0
|
|
27
|
+
);
|
|
28
|
+
const TreeItemLabelContext = React.createContext(void 0);
|
|
29
|
+
const TreeItemLabelIdContext = React.createContext(
|
|
30
|
+
void 0
|
|
31
|
+
);
|
|
32
|
+
const TreeItemDescriptionContext = React.createContext(void 0);
|
|
33
|
+
const TreeItemDescriptionIdContext = React.createContext(
|
|
34
|
+
void 0
|
|
35
|
+
);
|
|
36
|
+
const TreeItemInlineActionsContext = React.createContext(void 0);
|
|
37
|
+
const TreeItemOverflowActionsContext = React.createContext(void 0);
|
|
38
|
+
const TreeItemHasOverflowActionsContext = React.createContext(false);
|
|
39
|
+
const TreeItem = React.memo(
|
|
40
|
+
forwardRef((props, forwardedRef) => {
|
|
41
|
+
const { expanded, selected } = props;
|
|
42
|
+
const {
|
|
43
|
+
onSelectedChange,
|
|
44
|
+
onExpandedChange,
|
|
45
|
+
icon,
|
|
46
|
+
unstable_decorations,
|
|
47
|
+
label,
|
|
48
|
+
description,
|
|
49
|
+
actions,
|
|
50
|
+
onClick: onClickProp,
|
|
51
|
+
onKeyDown: onKeyDownProp,
|
|
52
|
+
...rest
|
|
53
|
+
} = props;
|
|
54
|
+
const onExpanderClick = useEventHandlers(() => {
|
|
55
|
+
if (expanded === void 0) return;
|
|
56
|
+
onExpandedChange?.(!expanded);
|
|
57
|
+
});
|
|
58
|
+
const handleClick = (event) => {
|
|
59
|
+
if (selected === void 0) return;
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
onSelectedChange?.(!selected);
|
|
62
|
+
};
|
|
63
|
+
const handleKeyDown = (event) => {
|
|
64
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (expanded === void 0) return;
|
|
68
|
+
if (event.key === "ArrowRight" || event.key === "ArrowLeft") {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
onExpandedChange?.(event.key === "ArrowRight");
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
return /* @__PURE__ */ jsx(TreeItemRootProvider, { ...props, children: /* @__PURE__ */ jsx(
|
|
74
|
+
TreeItemRoot,
|
|
75
|
+
{
|
|
76
|
+
...rest,
|
|
77
|
+
onClick: useEventHandlers(onClickProp, handleClick),
|
|
78
|
+
onKeyDown: useEventHandlers(onKeyDownProp, handleKeyDown),
|
|
79
|
+
ref: forwardedRef,
|
|
80
|
+
children: React.useMemo(
|
|
81
|
+
() => /* @__PURE__ */ jsx(
|
|
82
|
+
TreeItemNode,
|
|
83
|
+
{
|
|
84
|
+
onExpanderClick,
|
|
85
|
+
expanded,
|
|
86
|
+
selected
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
[onExpanderClick, expanded, selected]
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
) });
|
|
93
|
+
})
|
|
94
|
+
);
|
|
95
|
+
DEV: TreeItem.displayName = "Tree.Item";
|
|
96
|
+
function TreeItemRootProvider(props) {
|
|
97
|
+
const {
|
|
98
|
+
actions,
|
|
99
|
+
label,
|
|
100
|
+
description,
|
|
101
|
+
icon: iconProp,
|
|
102
|
+
unstable_decorations: decorations,
|
|
103
|
+
error
|
|
104
|
+
} = props;
|
|
105
|
+
const labelId = React.useId();
|
|
106
|
+
const descriptionId = React.useId();
|
|
107
|
+
const decorationId = React.useId();
|
|
108
|
+
const icon = error ? /* @__PURE__ */ jsx(StatusIcon, { tone: "attention" }) : iconProp;
|
|
109
|
+
const hasDecoration = icon || decorations;
|
|
110
|
+
return /* @__PURE__ */ jsx(TreeItemErrorContext.Provider, { value: error, children: /* @__PURE__ */ jsx(TreeItemActionsContext.Provider, { value: actions, children: /* @__PURE__ */ jsx(
|
|
111
|
+
TreeItemDecorationIdContext.Provider,
|
|
112
|
+
{
|
|
113
|
+
value: hasDecoration ? decorationId : void 0,
|
|
114
|
+
children: /* @__PURE__ */ jsx(TreeItemDecorationsContext.Provider, { value: decorations, children: /* @__PURE__ */ jsx(TreeItemIconContext.Provider, { value: icon, children: /* @__PURE__ */ jsx(TreeItemLabelIdContext.Provider, { value: labelId, children: /* @__PURE__ */ jsx(TreeItemLabelContext.Provider, { value: label, children: /* @__PURE__ */ jsx(TreeItemDescriptionContext.Provider, { value: description, children: /* @__PURE__ */ jsx(
|
|
115
|
+
TreeItemDescriptionIdContext.Provider,
|
|
116
|
+
{
|
|
117
|
+
value: description ? descriptionId : void 0,
|
|
118
|
+
children: props.children
|
|
119
|
+
}
|
|
120
|
+
) }) }) }) }) })
|
|
121
|
+
}
|
|
122
|
+
) }) });
|
|
123
|
+
}
|
|
124
|
+
DEV: TreeItemRootProvider.displayName = "TreeItemRootProvider";
|
|
125
|
+
const TreeItemRoot = React.memo(
|
|
126
|
+
forwardRef((props, forwardedRef) => {
|
|
127
|
+
const {
|
|
128
|
+
style: styleProp,
|
|
129
|
+
"aria-level": level,
|
|
130
|
+
selected,
|
|
131
|
+
expanded,
|
|
132
|
+
...rest
|
|
133
|
+
} = props;
|
|
134
|
+
const labelId = React.useContext(TreeItemLabelIdContext);
|
|
135
|
+
const decorationId = React.useContext(TreeItemDecorationIdContext);
|
|
136
|
+
const descriptionId = React.useContext(TreeItemDescriptionIdContext);
|
|
137
|
+
const error = React.useContext(TreeItemErrorContext);
|
|
138
|
+
const errorId = typeof error === "string" ? error : void 0;
|
|
139
|
+
const describedBy = React.useMemo(() => {
|
|
140
|
+
const ids = [];
|
|
141
|
+
if (descriptionId) ids.push(descriptionId);
|
|
142
|
+
if (decorationId) ids.push(decorationId);
|
|
143
|
+
if (errorId) ids.push(errorId);
|
|
144
|
+
return ids.length > 0 ? ids.join(" ") : void 0;
|
|
145
|
+
}, [decorationId, descriptionId, errorId]);
|
|
146
|
+
const style = React.useMemo(
|
|
147
|
+
() => ({
|
|
148
|
+
...styleProp,
|
|
149
|
+
"--\u{1F95D}tree-item-level": level
|
|
150
|
+
}),
|
|
151
|
+
[styleProp, level]
|
|
152
|
+
);
|
|
153
|
+
return /* @__PURE__ */ jsx(
|
|
154
|
+
CompositeItem,
|
|
155
|
+
{
|
|
156
|
+
render: /* @__PURE__ */ jsx(
|
|
157
|
+
Role,
|
|
158
|
+
{
|
|
159
|
+
...rest,
|
|
160
|
+
role: "treeitem",
|
|
161
|
+
"aria-expanded": expanded,
|
|
162
|
+
"aria-selected": selected,
|
|
163
|
+
"aria-labelledby": labelId,
|
|
164
|
+
"aria-describedby": describedBy,
|
|
165
|
+
"aria-level": level,
|
|
166
|
+
className: cx("\u{1F95D}-tree-item", props.className),
|
|
167
|
+
style,
|
|
168
|
+
ref: forwardedRef
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
children: props.children
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
})
|
|
175
|
+
);
|
|
176
|
+
DEV: TreeItemRoot.displayName = "TreeItemRoot";
|
|
177
|
+
const TreeItemNode = React.memo((props) => {
|
|
178
|
+
const { expanded, selected, onExpanderClick } = props;
|
|
179
|
+
const error = React.useContext(TreeItemErrorContext);
|
|
180
|
+
return /* @__PURE__ */ jsxs(
|
|
181
|
+
ListItem.Root,
|
|
182
|
+
{
|
|
183
|
+
"data-kiwi-expanded": expanded,
|
|
184
|
+
"data-kiwi-selected": selected,
|
|
185
|
+
"data-kiwi-error": error ? true : void 0,
|
|
186
|
+
className: "\u{1F95D}-tree-item-node",
|
|
187
|
+
role: void 0,
|
|
188
|
+
children: [
|
|
189
|
+
/* @__PURE__ */ jsx(TreeItemDecorations, { onExpanderClick }),
|
|
190
|
+
/* @__PURE__ */ jsx(TreeItemContent, {}),
|
|
191
|
+
/* @__PURE__ */ jsx(TreeItemDescription, {}),
|
|
192
|
+
/* @__PURE__ */ jsx(TreeItemActions, {})
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
DEV: TreeItemNode.displayName = "TreeItemNode";
|
|
198
|
+
const TreeItemDecorations = React.memo((props) => {
|
|
199
|
+
return /* @__PURE__ */ jsxs(ListItem.Decoration, { children: [
|
|
200
|
+
/* @__PURE__ */ jsx(TreeItemExpander, { onClick: props.onExpanderClick }),
|
|
201
|
+
/* @__PURE__ */ jsx(TreeItemDecoration, {})
|
|
202
|
+
] });
|
|
203
|
+
});
|
|
204
|
+
DEV: TreeItemDecorations.displayName = "TreeItemDecorations";
|
|
205
|
+
function TreeItemDecoration() {
|
|
206
|
+
const decorationId = React.useContext(TreeItemDecorationIdContext);
|
|
207
|
+
const decorations = React.useContext(TreeItemDecorationsContext);
|
|
208
|
+
const icon = React.useContext(TreeItemIconContext);
|
|
209
|
+
return icon || decorations ? /* @__PURE__ */ jsx(
|
|
210
|
+
Role,
|
|
211
|
+
{
|
|
212
|
+
className: "\u{1F95D}-tree-item-decoration",
|
|
213
|
+
id: decorationId,
|
|
214
|
+
render: React.isValidElement(icon) ? icon : typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : void 0,
|
|
215
|
+
children: !icon ? decorations : null
|
|
216
|
+
}
|
|
217
|
+
) : null;
|
|
218
|
+
}
|
|
219
|
+
DEV: TreeItemDecoration.displayName = "TreeItemDecoration";
|
|
220
|
+
const TreeItemContent = React.memo(() => {
|
|
221
|
+
const labelId = React.useContext(TreeItemLabelIdContext);
|
|
222
|
+
const label = React.useContext(TreeItemLabelContext);
|
|
223
|
+
return /* @__PURE__ */ jsx(ListItem.Content, { id: labelId, className: "\u{1F95D}-tree-item-content", children: label });
|
|
224
|
+
});
|
|
225
|
+
DEV: TreeItemContent.displayName = "TreeItemContent";
|
|
226
|
+
const TreeItemDescription = React.memo(() => {
|
|
227
|
+
const description = React.useContext(TreeItemDescriptionContext);
|
|
228
|
+
const descriptionId = React.useContext(TreeItemDescriptionIdContext);
|
|
229
|
+
return description ? /* @__PURE__ */ jsx(ListItem.Content, { id: descriptionId, className: "\u{1F95D}-tree-item-description", children: description }) : void 0;
|
|
230
|
+
});
|
|
231
|
+
DEV: TreeItemDescription.displayName = "TreeItemDescription";
|
|
232
|
+
const TreeItemActions = React.memo(
|
|
233
|
+
forwardRef((props, forwardedRef) => {
|
|
234
|
+
return /* @__PURE__ */ jsx(TreeItemActionsProvider, { children: /* @__PURE__ */ jsx(
|
|
235
|
+
ListItem.Decoration,
|
|
236
|
+
{
|
|
237
|
+
...props,
|
|
238
|
+
onClick: useEventHandlers(props.onClick, (e) => e.stopPropagation()),
|
|
239
|
+
onKeyDown: useEventHandlers(
|
|
240
|
+
props.onKeyDown,
|
|
241
|
+
(e) => e.stopPropagation()
|
|
242
|
+
),
|
|
243
|
+
className: cx("\u{1F95D}-tree-item-actions-container", props.className),
|
|
244
|
+
ref: forwardedRef,
|
|
245
|
+
render: /* @__PURE__ */ jsxs(Toolbar, { focusLoop: false, children: [
|
|
246
|
+
/* @__PURE__ */ jsx(TreeItemInlineActions, {}),
|
|
247
|
+
/* @__PURE__ */ jsx(TreeItemActionsOverflowMenu, {})
|
|
248
|
+
] })
|
|
249
|
+
}
|
|
250
|
+
) });
|
|
251
|
+
})
|
|
252
|
+
);
|
|
253
|
+
DEV: TreeItemActions.displayName = "TreeItemActions";
|
|
254
|
+
function TreeItemActionsProvider(props) {
|
|
255
|
+
const actionsProp = React.useContext(TreeItemActionsContext);
|
|
256
|
+
const error = React.useContext(TreeItemErrorContext);
|
|
257
|
+
const actionsLimit = error ? 2 : 3;
|
|
258
|
+
const { inline, overflow } = React.useMemo(() => {
|
|
259
|
+
const actions = React.Children.toArray(actionsProp).filter(Boolean);
|
|
260
|
+
const inline2 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
261
|
+
actions.slice(0, actionsLimit - 1),
|
|
262
|
+
actions.length === actionsLimit ? actions[actionsLimit - 1] : null
|
|
263
|
+
] });
|
|
264
|
+
const overflow2 = actions.length > actionsLimit ? actions.slice(actionsLimit - 1) : void 0;
|
|
265
|
+
return { inline: inline2, overflow: overflow2 };
|
|
266
|
+
}, [actionsProp, actionsLimit]);
|
|
267
|
+
return /* @__PURE__ */ jsx(TreeItemInlineActionsContext.Provider, { value: inline, children: /* @__PURE__ */ jsx(TreeItemOverflowActionsContext.Provider, { value: overflow, children: /* @__PURE__ */ jsx(TreeItemHasOverflowActionsContext.Provider, { value: !!overflow, children: props.children }) }) });
|
|
268
|
+
}
|
|
269
|
+
DEV: TreeItemActionsProvider.displayName = "TreeItemActionsProvider";
|
|
270
|
+
function TreeItemInlineActions() {
|
|
271
|
+
const actions = React.useContext(TreeItemInlineActionsContext);
|
|
272
|
+
return actions;
|
|
273
|
+
}
|
|
274
|
+
DEV: TreeItemInlineActions.displayName = "TreeItemInlineActions";
|
|
275
|
+
const arrowKeys = ["ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"];
|
|
276
|
+
const TreeItemActionsOverflowMenuContext = React.createContext(false);
|
|
277
|
+
function TreeItemActionsOverflowMenu() {
|
|
278
|
+
const overflow = React.useContext(TreeItemHasOverflowActionsContext);
|
|
279
|
+
const [open, setOpen] = React.useState(false);
|
|
280
|
+
const isArrowKeyPressed = React.useRef(false);
|
|
281
|
+
if (!overflow) return null;
|
|
282
|
+
return /* @__PURE__ */ jsx(PopoverProvider, { placement: "right-start", children: /* @__PURE__ */ jsxs(
|
|
283
|
+
DropdownMenu.Root,
|
|
284
|
+
{
|
|
285
|
+
open,
|
|
286
|
+
setOpen: React.useCallback((value) => {
|
|
287
|
+
if (value && !isArrowKeyPressed.current) {
|
|
288
|
+
setOpen(true);
|
|
289
|
+
} else {
|
|
290
|
+
setOpen(false);
|
|
291
|
+
}
|
|
292
|
+
}, []),
|
|
293
|
+
children: [
|
|
294
|
+
/* @__PURE__ */ jsx(
|
|
295
|
+
DropdownMenu.Button,
|
|
296
|
+
{
|
|
297
|
+
onKeyDown: (e) => {
|
|
298
|
+
if (arrowKeys.includes(e.key)) {
|
|
299
|
+
isArrowKeyPressed.current = true;
|
|
300
|
+
}
|
|
301
|
+
queueMicrotask(() => {
|
|
302
|
+
isArrowKeyPressed.current = false;
|
|
303
|
+
});
|
|
304
|
+
},
|
|
305
|
+
render: /* @__PURE__ */ jsx(TreeItemAction, { label: "More", icon: /* @__PURE__ */ jsx(MoreHorizontal, {}) })
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
/* @__PURE__ */ jsx(TreeItemActionsOverflowMenuContext.Provider, { value: true, children: /* @__PURE__ */ jsx(TreeItemActionsOverflowMenuContent, {}) })
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
) });
|
|
312
|
+
}
|
|
313
|
+
DEV: TreeItemActionsOverflowMenu.displayName = "TreeItemActionsOverflowMenu";
|
|
314
|
+
function TreeItemActionsOverflowMenuContent() {
|
|
315
|
+
const actions = React.useContext(TreeItemOverflowActionsContext);
|
|
316
|
+
return /* @__PURE__ */ jsx(DropdownMenu.Content, { children: actions });
|
|
317
|
+
}
|
|
318
|
+
DEV: TreeItemActionsOverflowMenu.displayName = "TreeItemActionsOverflowMenu";
|
|
319
|
+
const TreeItemAction = React.memo(
|
|
320
|
+
forwardRef((props, forwardedRef) => {
|
|
321
|
+
const error = React.useContext(TreeItemErrorContext);
|
|
322
|
+
const {
|
|
323
|
+
visible = error ? true : void 0,
|
|
324
|
+
// visible by default during error state
|
|
325
|
+
label,
|
|
326
|
+
icon,
|
|
327
|
+
dot,
|
|
328
|
+
...rest
|
|
329
|
+
} = props;
|
|
330
|
+
if (React.useContext(TreeItemActionsOverflowMenuContext)) {
|
|
331
|
+
DEV: {
|
|
332
|
+
if (visible !== void 0)
|
|
333
|
+
console.warn("overflowing actions should not use `visible` prop");
|
|
334
|
+
}
|
|
335
|
+
return /* @__PURE__ */ jsx(
|
|
336
|
+
DropdownMenu.Item,
|
|
337
|
+
{
|
|
338
|
+
...rest,
|
|
339
|
+
label,
|
|
340
|
+
icon,
|
|
341
|
+
unstable_dot: dot,
|
|
342
|
+
ref: forwardedRef
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
DEV: {
|
|
347
|
+
if (!icon)
|
|
348
|
+
throw new Error(
|
|
349
|
+
"`icon` prop is required when the action is displayed as a button"
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
return /* @__PURE__ */ jsx(
|
|
353
|
+
ToolbarItem,
|
|
354
|
+
{
|
|
355
|
+
render: /* @__PURE__ */ jsx(
|
|
356
|
+
IconButton,
|
|
357
|
+
{
|
|
358
|
+
label,
|
|
359
|
+
icon,
|
|
360
|
+
inert: visible === false ? true : void 0,
|
|
361
|
+
...rest,
|
|
362
|
+
dot,
|
|
363
|
+
variant: "ghost",
|
|
364
|
+
className: cx("\u{1F95D}-tree-item-action", props.className),
|
|
365
|
+
"data-kiwi-visible": visible,
|
|
366
|
+
ref: forwardedRef
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
);
|
|
371
|
+
})
|
|
372
|
+
);
|
|
373
|
+
DEV: TreeItemAction.displayName = "TreeItem.Action";
|
|
374
|
+
const TreeItemExpander = forwardRef(
|
|
375
|
+
(props, forwardedRef) => {
|
|
376
|
+
const descriptionId = React.useContext(TreeItemDescriptionIdContext);
|
|
377
|
+
return /* @__PURE__ */ jsx(GhostAligner, { align: descriptionId ? "block" : void 0, children: /* @__PURE__ */ jsx(
|
|
378
|
+
IconButtonPresentation,
|
|
379
|
+
{
|
|
380
|
+
"aria-hidden": "true",
|
|
381
|
+
...props,
|
|
382
|
+
onClick: useEventHandlers(props.onClick, (e) => e.stopPropagation()),
|
|
383
|
+
className: cx("\u{1F95D}-tree-item-expander", props.className),
|
|
384
|
+
variant: "ghost",
|
|
385
|
+
ref: forwardedRef,
|
|
386
|
+
children: /* @__PURE__ */ jsx(ChevronDown, {})
|
|
387
|
+
}
|
|
388
|
+
) });
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
DEV: TreeItemExpander.displayName = "TreeItemExpander";
|
|
392
|
+
export {
|
|
393
|
+
TreeItemAction as Action,
|
|
394
|
+
TreeItem as Root
|
|
395
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as unstable_AccordionItem from "./AccordionItem.js";
|
|
3
|
+
import { Banner } from "./Banner.js";
|
|
4
|
+
import { Chip } from "./Chip.js";
|
|
5
|
+
import * as DropdownMenu from "./DropdownMenu.js";
|
|
6
|
+
import * as unstable_ErrorRegion from "./ErrorRegion.js";
|
|
7
|
+
import * as Table from "./Table.js";
|
|
8
|
+
import * as Tabs from "./Tabs.js";
|
|
9
|
+
import * as unstable_Toolbar from "./Toolbar.js";
|
|
10
|
+
import * as Tree from "./Tree.js";
|
|
11
|
+
export {
|
|
12
|
+
Chip,
|
|
13
|
+
DropdownMenu,
|
|
14
|
+
Table,
|
|
15
|
+
Tabs,
|
|
16
|
+
Tree,
|
|
17
|
+
unstable_AccordionItem,
|
|
18
|
+
Banner as unstable_Banner,
|
|
19
|
+
unstable_ErrorRegion,
|
|
20
|
+
unstable_Toolbar
|
|
21
|
+
};
|
package/dist/DEV/styles.css.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// inline-css:/home/runner/work/design-system/design-system/packages/structures/src/styles.css
|
|
2
|
-
var styles_default = String.raw``;
|
|
2
|
+
var styles_default = String.raw`@layer itwinui.components{@layer base{.🥝-list-item{cursor:pointer;line-height:1.2;font-size:var(--ids-font-size-12);min-block-size:var(--🥝list-item-height,1.75rem);background-color:var(--🥝list-item-background-color);--🥝list-item-background-color:var(--🌀list-item-state--default,transparent)var(--🌀list-item-state--hover,var(--ids-color-bg-glow-on-surface-neutral-hover))var(--🌀list-item-state--pressed,var(--ids-color-bg-glow-on-surface-neutral-pressed))var(--🌀list-item-state--active,var(--ids-color-bg-glow-on-surface-accent-pressed))var(--🌀list-item-state--active-hover,var(--ids-color-bg-glow-on-surface-accent-pressed))var(--🌀list-item-state--disabled,transparent);color:var(--🥝list-item-color,var(--🌀list-item-state--default,var(--ids-color-text-neutral-primary))var(--🌀list-item-state--hover,var(--ids-color-text-neutral-primary))var(--🌀list-item-state--pressed,var(--ids-color-text-neutral-primary))var(--🌀list-item-state--active,var(--ids-color-text-accent-strong))var(--🌀list-item-state--active-hover,var(--ids-color-text-accent-strong))var(--🌀list-item-state--disabled,var(--ids-color-text-neutral-disabled)));--🥝icon-color:var(--🌀list-item-state--default,var(--ids-color-icon-neutral-base))var(--🌀list-item-state--hover,var(--ids-color-icon-neutral-hover))var(--🌀list-item-state--pressed,var(--ids-color-icon-neutral-hover))var(--🌀list-item-state--active,var(--ids-color-icon-accent-strong))var(--🌀list-item-state--active-hover,var(--ids-color-icon-accent-strong))var(--🌀list-item-state--disabled,var(--ids-color-icon-neutral-disabled));grid-template-columns:[decoration-before-start]auto[decoration-before-end content-start]minmax(0,1fr)[content-end decoration-after-start]auto[decoration-after-end];align-content:center;align-items:center;padding-inline:.5rem;display:grid}}@layer states{@media (any-hover:hover){.🥝-list-item:where(:hover){--🌀list-item-state:var(--🌀list-item-state--hover)}}.🥝-list-item:where(:active){--🌀list-item-state:var(--🌀list-item-state--pressed)}.🥝-list-item:where(:disabled,[aria-disabled=true]){--🌀list-item-state:var(--🌀list-item-state--disabled);cursor:not-allowed}}@layer modifiers{.🥝-list-item:where(:has(>:nth-child(2 of .🥝-list-item-content))){--🥝list-item-height:2.75rem;grid-template-rows:repeat(auto-fit,minmax(0,auto))}}@layer base.🌀{.🥝-list-item{--🌀list-item-state:var(--🌀list-item-state--default);--🌀list-item-state--default:var(--🌀list-item-state, );--🌀list-item-state--hover:var(--🌀list-item-state, );--🌀list-item-state--pressed:var(--🌀list-item-state, );--🌀list-item-state--active:var(--🌀list-item-state, );--🌀list-item-state--active-hover:var(--🌀list-item-state, );--🌀list-item-state--disabled:var(--🌀list-item-state, )}}@layer base{.🥝-list-item-content{grid-column:content}}@layer base{.🥝-list-item-decoration{grid-area:1/decoration-before/-1;align-self:start;align-items:center;margin-inline-end:.25rem;display:flex}:where(.🥝-list-item-content)~.🥝-list-item-decoration{grid-column:decoration-after;margin-inline:.25rem 0}}@media (forced-colors:active){.🥝-list-item:where(:disabled,[aria-disabled=true]){color:graytext}}.🥝-accordion-item{--🥝accordion-item-gap:12px;--🥝accordion-item-padding:12px}@layer base{.🥝-accordion-item{contain:paint;border-block-end:1px solid var(--ids-color-border-neutral-muted);grid-template-rows:[trigger-start]auto[trigger-end content-start]auto[content-end];grid-template-columns:[decoration-before-start]auto[decoration-before-end content-start]minmax(0,1fr)[content-end decoration-after-start]auto[decoration-after-end];display:grid}}@layer base{.🥝-accordion-item-trigger{padding:var(--🥝accordion-item-padding);--🥝focus-outline-offset:-4px;cursor:pointer;grid-area:trigger/decoration-before-start/trigger/decoration-after-end;grid-template-columns:inherit;border-radius:12px;align-items:center;display:grid}@supports (grid-template-columns:subgrid){.🥝-accordion-item-trigger{grid-template-columns:subgrid}}}@layer states{.🥝-accordion-item-trigger:where([aria-expanded=true]){--🥝chevron-down-rotate:-.5turn}}@layer base{.🥝-accordion-item-marker{grid-area:1/decoration-after;margin-inline-start:var(--🥝accordion-item-gap);margin-inline-end:calc(-1*var(--🥝ghost-inline-offset))}}@layer states{@media (any-hover:hover){:where(.🥝-accordion-item-trigger:hover) .🥝-accordion-item-marker{--🌀button-state:var(--🌀button-state--hover)}}}@layer base{.🥝-accordion-item-label.🥝-text{-webkit-hyphens:auto;hyphens:auto;overflow-wrap:break-word;text-box:cap alphabetic;grid-column:content;font-weight:500}}@layer base{.🥝-accordion-item-content{text-box:cap alphabetic;color:var(--ids-color-text-neutral-secondary);grid-area:content;padding-block-end:var(--🥝accordion-item-padding)}}@layer base{.🥝-accordion-item-decoration{grid-column:decoration-before;margin-inline-end:var(--🥝accordion-item-gap)}}@layer base{.🥝-banner{background-color:var(--🥝banner-color-background);border:1px solid var(--🥝banner-color-border);border-radius:8px;grid-template-columns:[start]auto[content]minmax(0,1fr)[end]auto;align-items:center;inline-size:100%;padding:12px;display:grid}}@layer modifiers{.🥝-banner:where([data-kiwi-variant=outline]){--🥝banner-color-background:var(--ids-color-bg-elevation-base)}.🥝-banner:where([data-kiwi-variant=outline]):where([data-kiwi-tone=neutral]){--🥝banner-color-border:var(--ids-color-border-neutral-base)}.🥝-banner:where([data-kiwi-tone=info]){--🥝banner-color-border:var(--ids-color-border-info-base);--🥝icon-color:var(--ids-color-icon-info-base)}.🥝-banner:where([data-kiwi-tone=positive]){--🥝banner-color-border:var(--ids-color-border-positive-base);--🥝icon-color:var(--ids-color-icon-positive-base)}.🥝-banner:where([data-kiwi-tone=attention]){--🥝banner-color-border:var(--ids-color-border-attention-base);--🥝icon-color:var(--ids-color-icon-attention-base)}.🥝-banner:where([data-kiwi-tone=critical]){--🥝banner-color-border:var(--ids-color-border-critical-base);--🥝icon-color:var(--ids-color-icon-critical-base)}}@layer base{.🥝-banner-icon{grid-area:1/start;align-self:start;margin-inline-end:8px}}@layer base{.🥝-banner-label{grid-column:content;align-self:start;margin-block-end:4px;font-weight:500}}@layer base{.🥝-banner-message{overflow-wrap:break-word;-webkit-hyphens:auto;hyphens:auto;grid-column:content;overflow:hidden}}@layer base{.🥝-banner-actions{flex-wrap:wrap;grid-column:content;justify-self:start;align-items:baseline;gap:8px;margin-block-start:12px;display:flex}}@layer base{.🥝-banner-dismiss-button{grid-area:1/end;align-self:start;margin-inline-start:12px}}@media (forced-colors:active){.🥝-banner{--🥝icon-color:CanvasText}}@layer base{.🥝-chip{isolation:isolate;--🥝chip-padding-inline:.5rem;padding-inline:var(--🥝chip-padding-inline);border:none;border-radius:9999px;align-items:center;min-block-size:1.5rem;display:inline-flex;position:relative}}.🥝-chip:before{z-index:-1;content:"";border-radius:inherit;border:1px solid var(--ids-color-border-neutral-base);pointer-events:none;position:absolute;inset:0}@layer modifiers{.🥝-chip:where([data-kiwi-variant=solid]){background-color:var(--ids-color-bg-neutral-base)}.🥝-chip:where([data-kiwi-variant=outline]){background-color:var(--ids-color-bg-page-base)}}@layer base{.🥝-chip-dismiss-button.🥝-icon-button{border-radius:inherit;margin-inline-end:calc(-1*var(--🥝chip-padding-inline));position:relative}}@layer base{.🥝-dropdown-menu{background-color:var(--ids-color-bg-elevation-level-1);min-inline-size:min(95vi,164px);box-shadow:var(--ids-shadow-surface-xl);border-radius:8px;flex-direction:column;padding:4px;display:flex}@media (forced-colors:active){.🥝-dropdown-menu{border:1px solid canvastext}}}@layer states{.🥝-dropdown-menu-button:where([aria-expanded=true]){--🥝disclosure-arrow-rotate:.5turn}}@layer base{.🥝-dropdown-menu-item.🥝-list-item{border-radius:4px}}@layer states{.🥝-dropdown-menu-item.🥝-list-item:where([role=menuitemcheckbox]:not([aria-checked=true])){--🥝dropdown-menu-checkmark-visibility:hidden}}@layer base{.🥝-dropdown-menu-item-dot.🥝-dot{align-self:center}}@layer base{.🥝-dropdown-menu-checkmark{visibility:var(--🥝dropdown-menu-checkmark-visibility)}}@layer base{.🥝-dropdown-menu-item-shortcuts{margin-inline-start:.5rem}}@layer base{.🥝-error-region{z-index:1;position:relative}}@layer states{.🥝-error-region:where([data-kiwi-expanded=true]){--🥝chevron-down-rotate:-.5turn;--🥝error-region-header-border-end-radius:0}.🥝-error-region:where([data-kiwi-visible=true]){block-size:2.625rem;padding-block:4px;padding-inline:4px}.🥝-error-region:where([data-kiwi-visible=false]){--🥝error-region-container-display:none}}@layer base{.🥝-error-region-container{isolation:isolate;display:var(--🥝error-region-container-display,flex);border:1px solid var(--ids-color-border-attention-base);background-color:var(--ids-color-bg-elevation-base);box-shadow:var(--ids-shadow-surface-sm);border-radius:8px;flex-direction:column;position:relative}@media (prefers-reduced-motion:no-preference){.🥝-error-region-container:before{content:"";border-radius:inherit;z-index:-1;position:absolute;inset:0}}}@layer base{.🥝-error-region-header{border-start-start-radius:7px;border-start-end-radius:7px;border-end-end-radius:var(--🥝error-region-header-border-end-radius,calc(8px - 1px));border-end-start-radius:var(--🥝error-region-header-border-end-radius,calc(8px - 1px));flex-wrap:wrap;min-block-size:2rem;padding-inline:8px 4px;font-weight:400;transition:border-radius 0s linear .15s}}@layer base{.🥝-error-region-icon{--🥝icon-color:var(--ids-color-icon-attention-base)}}@layer base{.🥝-error-region-label{text-align:start;overflow-wrap:break-word;flex:1;max-inline-size:100%}}@layer base{.🥝-error-region-dialog{transition:max-block-size .15s linear,opacity .15s linear;overflow:hidden}}@layer states{.🥝-error-region-dialog:where(:not([data-enter])){opacity:0}@media (prefers-reduced-motion:no-preference){.🥝-error-region-dialog:where(:not([data-enter])){max-block-size:0}}.🥝-error-region-dialog:where([data-enter]){opacity:1}@media (prefers-reduced-motion:no-preference){.🥝-error-region-dialog:where([data-enter]){max-block-size:calc(348px - 2rem)}@supports (interpolate-size:allow-keywords){.🥝-error-region-dialog:where([data-enter]){max-block-size:max-content}}}}@layer base{.🥝-error-region-items{border-block-start:1px solid var(--ids-color-border-page-base);max-block-size:calc(348px - 2rem);overflow:auto}}@layer base{.🥝-error-region-item{flex-direction:column;padding-block:12px;padding-inline:calc(12px + 1rem) 4px;display:flex}.🥝-error-region-item:where(:not(:nth-child(1 of .🥝-error-region-item))){border-block-start:1px solid var(--ids-color-border-page-base)}}@layer base{.🥝-error-region-item-actions{margin-block-start:8px}}@layer base{.🥝-table:where(table){table-layout:fixed;inline-size:100%}}@layer base{.🥝-table-header{color:var(--ids-color-text-neutral-secondary)}}@layer base{.🥝-table-row:where([role=row]){display:flex}}@layer base{.🥝-table-caption,.🥝-table-cell{overflow-wrap:anywhere;-webkit-hyphens:auto;hyphens:auto;align-content:center;min-block-size:3rem;padding-block:.5rem;padding-inline:1rem .75rem}:is(.🥝-table-caption,.🥝-table-cell):where(th,td){block-size:3rem}}@layer base{.🥝-table-cell{background-color:var(--🌀table-cell-state--default,var(--ids-color-bg-page-base))var(--🌀table-cell-state--hover,color-mix(in oklch,var(--ids-color-bg-page-base)100.0%,var(--ids-color-glow-hue)var(--ids-color-bg-glow-base-hover-\%)));border-block-end:1px solid var(--ids-color-border-neutral-muted);min-inline-size:4rem}.🥝-table-cell:where(:not(th,td)){flex-grow:1;flex-basis:4rem;column-gap:.5rem}.🥝-table-cell:where(th){font-weight:inherit}}@layer states{@media (any-hover:hover){.🥝-table-cell:where(:hover){--🌀table-cell-state:var(--🌀table-cell-state--hover)}:where(.🥝-table-row:hover) .🥝-table-cell:where([role=cell],td){--🌀table-cell-state:var(--🌀table-cell-state--hover)}}}@layer base.🌀{.🥝-table-cell{--🌀table-cell-state:var(--🌀table-cell-state--default);--🌀table-cell-state--default:var(--🌀table-cell-state, );--🌀table-cell-state--hover:var(--🌀table-cell-state, )}}@layer base{.🥝-tab-list{--🥝tab-active-stripe-gap:8px;--🥝tab-active-stripe-size:2px;--🥝tab-padding-inline:4px;gap:8px;display:flex;position:relative}@supports (position-anchor:--foo){.🥝-tab-list:after{content:"";position-anchor:--🥝active-tab;inline-size:calc(anchor-size(inline) - 2*var(--🥝tab-padding-inline));block-size:var(--🥝tab-active-stripe-size);background-color:var(--🥝tab-active-stripe-color);position:absolute;inset-block-end:calc(anchor(end) - var(--🥝tab-active-stripe-gap));inset-inline-start:calc(anchor(start) + var(--🥝tab-padding-inline))}@media (prefers-reduced-motion:no-preference){.🥝-tab-list:after{transition:inset-inline-start .15s ease-in-out,inline-size .15s ease-in-out}}}}@layer modifiers{.🥝-tab-list[aria-orientation=horizontal]{padding-block-end:var(--🥝tab-active-stripe-gap)}.🥝-tab-list:where([data-kiwi-tone=neutral]){--🥝tab-active-stripe-color:var(--ids-color-border-neutral-inverse)}.🥝-tab-list:where([data-kiwi-tone=accent]){--🥝tab-active-stripe-color:var(--ids-color-border-accent-strong)}}@layer base{.🥝-tab{font-size:var(--ids-font-size-12);color:var(--🥝tab-color);background-color:var(--🥝tab-bg);block-size:1.25rem;padding-inline:var(--🥝tab-padding-inline);-webkit-user-select:none;user-select:none;white-space:nowrap;cursor:pointer;border:none;border-radius:4px;transition:background-color .15s ease-out,color .15s ease-out;position:relative}.🥝-tab:before{content:"";inset-inline:0;inset-block:0 calc(var(--🥝tab-active-stripe-gap)*-1);position:absolute}}@layer modifiers{:where(.🥝-tab-list[data-kiwi-tone=neutral]) .🥝-tab{--🥝tab-bg:var(--🌀tab-state--default,transparent)var(--🌀tab-state--hover,var(--ids-color-bg-glow-on-surface-neutral-hover))var(--🌀tab-state--selected,transparent)var(--🌀tab-state--disabled,transparent);--🥝tab-color:var(--🌀tab-state--default,var(--ids-color-text-neutral-tertiary))var(--🌀tab-state--hover,var(--ids-color-text-neutral-primary))var(--🌀tab-state--selected,var(--ids-color-text-neutral-primary))var(--🌀tab-state--disabled,var(--ids-color-text-neutral-disabled));-webkit-tap-highlight-color:var(--ids-color-bg-glow-on-surface-neutral-pressed)}:where(.🥝-tab-list[data-kiwi-tone=accent]) .🥝-tab{--🥝tab-bg:var(--🌀tab-state--default,transparent)var(--🌀tab-state--hover,var(--ids-color-bg-glow-on-surface-accent-hover))var(--🌀tab-state--selected,transparent)var(--🌀tab-state--disabled,transparent);--🥝tab-color:var(--🌀tab-state--default,var(--ids-color-text-neutral-tertiary))var(--🌀tab-state--hover,var(--ids-color-text-accent-strong))var(--🌀tab-state--selected,var(--ids-color-text-accent-strong))var(--🌀tab-state--disabled,var(--ids-color-text-neutral-disabled));-webkit-tap-highlight-color:var(--ids-color-bg-glow-on-surface-accent-pressed)}}@layer states{.🥝-tab:where([aria-selected=true]){--🌀tab-state:var(--🌀tab-state--selected);anchor-name:--🥝active-tab}@supports not (anchor-name:--foo){.🥝-tab:where([aria-selected=true]):after{content:"";background-color:var(--🥝tab-active-stripe-color);block-size:var(--🥝tab-active-stripe-size);inset-inline:var(--🥝tab-padding-inline);inset-block:auto calc(var(--🥝tab-active-stripe-gap)*-1);position:absolute}}@media (any-hover:hover){.🥝-tab:where(:hover){--🌀tab-state:var(--🌀tab-state--hover)}}.🥝-tab:where(:disabled,[aria-disabled=true]){--🌀tab-state:var(--🌀tab-state--disabled);--🥝tab-active-stripe-color:var(--ids-color-border-neutral-disabled);cursor:not-allowed;-webkit-tap-highlight-color:transparent}}@layer base.🌀{.🥝-tab{--🌀tab-state:var(--🌀tab-state--default);--🌀tab-state--default:var(--🌀tab-state, );--🌀tab-state--hover:var(--🌀tab-state, );--🌀tab-state--selected:var(--🌀tab-state, );--🌀tab-state--disabled:var(--🌀tab-state, )}}@layer base{.🥝-tab-panel{--🥝focus-outline-offset:-2px}.🥝-tab-panel:not([data-open]){display:none!important}}@media (forced-colors:active){.🥝-tab-list,.🥝-tab{--🥝tab-active-stripe-color:CanvasText}.🥝-tab{--🥝tab-color:CanvasText}.🥝-tab:where([aria-selected=true]){forced-color-adjust:none;--🥝tab-bg:SelectedItem;--🥝tab-color:SelectedItemText}.🥝-tab:where(:disabled,[aria-disabled=true]){--🥝tab-color:GrayText}}@layer base{.🥝-toolbar{background-color:var(--ids-color-bg-page-base);box-shadow:var(--ids-shadow-toolbar-base);border-radius:8px;gap:4px;padding:4px;display:inline-flex}}@media (forced-colors:active){.🥝-toolbar{border:1px solid}}@layer base{.🥝-tree{background-color:var(--ids-color-bg-page-base);align-content:start;display:grid;overflow:auto}}@layer base{.🥝-tree-item{min-inline-size:max-content;position:relative}}@layer states{.🥝-tree-item:focus-visible{isolation:isolate;outline:none}.🥝-tree-item:focus-visible:before{content:"";z-index:1;pointer-events:none;outline:var(--🥝focus-outline);outline-offset:-1px;position:absolute;inset:0}@media (any-hover:hover){.🥝-tree-item:where(:not(:hover,:focus-visible,:has(:focus-visible),:has([data-has-popover-open]))){--🥝tree-item-action-visibility:hidden}@supports not selector(:has(+ *)){.🥝-tree-item{--🥝tree-item-action-visibility:visible}}}}@layer base{.🥝-tree-item-node.🥝-list-item{isolation:isolate;--🥝list-item-color:var(--🥝tree-item-color);padding-inline-start:calc(8px + 6px*(var(--🥝tree-item-level) - 1));padding-inline-end:0;position:relative}}@layer modifiers{.🥝-tree-item-node.🥝-list-item:where([data-kiwi-error=true]){--🥝icon-color:var(--ids-color-icon-attention-base);--🥝tree-item-color:var(--ids-color-text-attention-base)}}@layer states{.🥝-tree-item-node.🥝-list-item:where([data-kiwi-selected=true]){--🌀list-item-state:var(--🌀list-item-state--active)}.🥝-tree-item-node.🥝-list-item:where([data-kiwi-expanded=false]){--🥝chevron-down-rotate:-.25turn}.🥝-tree-item-node.🥝-list-item:where(:not([data-kiwi-expanded])){--🥝tree-item-expander-visibility:hidden}}@layer base{.🥝-tree-item-content.🥝-list-item-content{white-space:nowrap}}@layer base{.🥝-tree-item-description.🥝-list-item-content{color:var(--🥝tree-item-color,var(--🌀list-item-state--default,var(--ids-color-text-neutral-secondary)))}}@layer base{.🥝-tree-item-actions-container.🥝-list-item-decoration{background-color:var(--ids-color-bg-page-base);visibility:var(--🥝tree-item-actions-container-visibility,var(--🥝tree-item-action-visibility));align-self:stretch;padding-inline-end:4px;display:inline-flex;position:sticky;inset-inline-end:0}.🥝-tree-item-actions-container.🥝-list-item-decoration:before{content:"";background-color:var(--🥝list-item-background-color);z-index:-1;position:absolute;inset:0}}@layer modifiers{.🥝-tree-item-actions-container.🥝-list-item-decoration:where(:has(.🥝-tree-item-action[data-kiwi-visible=true])){--🥝tree-item-actions-container-visibility:visible}}@layer base{.🥝-tree-item-action.🥝-icon-button{visibility:var(--🥝tree-item-action-visibility);transition:visibility 16ms}}@layer modifiers{.🥝-tree-item-action.🥝-icon-button:where([data-kiwi-visible=false]){--🥝tree-item-action-visibility:hidden}.🥝-tree-item-action.🥝-icon-button:where([data-kiwi-visible=true]){--🥝tree-item-action-visibility:visible}}@layer base{.🥝-tree-item-expander.🥝-icon-button{visibility:var(--🥝tree-item-expander-visibility);z-index:1}}@layer base{.🥝-tree-item-decoration{align-items:center;gap:.25rem;display:flex}}@media (forced-colors:active){.🥝-tree-item-node.🥝-list-item{--🥝list-item-background-color:Canvas;--🥝tree-item-color:CanvasText}.🥝-tree-item-node.🥝-list-item:where([data-kiwi-error=true],[data-kiwi-selected=true]){forced-color-adjust:none}.🥝-tree-item-node.🥝-list-item:where([data-kiwi-error=true]) .🥝-tree-item-content,.🥝-tree-item-node.🥝-list-item:where([data-kiwi-error=true]) .🥝-tree-item-decoration{color:marktext;background-color:mark}.🥝-tree-item-node.🥝-list-item:where([data-kiwi-selected=true]){--🥝list-item-background-color:SelectedItem;--🥝tree-item-color:SelectedItemText}}}`;
|
|
3
3
|
|
|
4
4
|
// src/styles.css.ts
|
|
5
5
|
var styles_css_default = styles_default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Role } from "@ariakit/react/role";
|
|
3
|
+
import { Text } from "@stratakit/bricks";
|
|
4
|
+
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
5
|
+
import cx from "classnames";
|
|
6
|
+
const ListItem = forwardRef((props, forwardedRef) => {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
Role.div,
|
|
9
|
+
{
|
|
10
|
+
role: "listitem",
|
|
11
|
+
...props,
|
|
12
|
+
className: cx("\u{1F95D}-list-item", props.className),
|
|
13
|
+
ref: forwardedRef
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
DEV: ListItem.displayName = "ListItem.Root";
|
|
18
|
+
const ListItemContent = forwardRef(
|
|
19
|
+
(props, forwardedRef) => {
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
Text,
|
|
22
|
+
{
|
|
23
|
+
...props,
|
|
24
|
+
variant: "body-sm",
|
|
25
|
+
className: cx("\u{1F95D}-list-item-content", props.className),
|
|
26
|
+
ref: forwardedRef
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
DEV: ListItemContent.displayName = "ListItem.Content";
|
|
32
|
+
const ListItemDecoration = forwardRef(
|
|
33
|
+
(props, forwardedRef) => {
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
|
+
Role.div,
|
|
36
|
+
{
|
|
37
|
+
...props,
|
|
38
|
+
className: cx("\u{1F95D}-list-item-decoration", props.className),
|
|
39
|
+
ref: forwardedRef
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
DEV: ListItemDecoration.displayName = "ListItem.Decoration";
|
|
45
|
+
export {
|
|
46
|
+
ListItemContent as Content,
|
|
47
|
+
ListItemDecoration as Decoration,
|
|
48
|
+
ListItem as Root
|
|
49
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
createIconFromPath,
|
|
4
|
+
forwardRef
|
|
5
|
+
} from "@stratakit/foundations/secret-internals";
|
|
6
|
+
import cx from "classnames";
|
|
7
|
+
const Checkmark = createIconFromPath(
|
|
8
|
+
"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"
|
|
9
|
+
);
|
|
10
|
+
DEV: Checkmark.displayName = "Checkmark";
|
|
11
|
+
const Dismiss = createIconFromPath(
|
|
12
|
+
"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"
|
|
13
|
+
);
|
|
14
|
+
DEV: Dismiss.displayName = "Dismiss";
|
|
15
|
+
const statusIcons = {
|
|
16
|
+
positive: createIconFromPath(
|
|
17
|
+
"M7.748 1.726a.5.5 0 0 1 .504 0l5 2.916a.5.5 0 0 1 .248.432v5.852a.5.5 0 0 1-.248.431l-5 2.917a.5.5 0 0 1-.504 0l-5-2.916a.5.5 0 0 1-.248-.432V5.074a.5.5 0 0 1 .248-.432l5-2.916ZM8.756.862a1.5 1.5 0 0 0-1.512 0l-5 2.917A1.5 1.5 0 0 0 1.5 5.074v5.852a1.5 1.5 0 0 0 .744 1.295l5 2.917a1.5 1.5 0 0 0 1.512 0l5-2.917a1.5 1.5 0 0 0 .744-1.295V5.074a1.5 1.5 0 0 0-.744-1.295l-5-2.917Zm2.139 5.445a.5.5 0 0 0-.79-.614L6.953 9.746l-1.1-1.1a.5.5 0 0 0-.707.708l1.5 1.5a.5.5 0 0 0 .749-.047l3.5-4.5Z"
|
|
18
|
+
),
|
|
19
|
+
attention: createIconFromPath(
|
|
20
|
+
"M8.354 2.06a.5.5 0 0 0-.708 0L2.061 7.647a.5.5 0 0 0 0 .707l5.585 5.586a.5.5 0 0 0 .708 0l5.585-5.586a.5.5 0 0 0 0-.707L8.354 2.061Zm-1.415-.707a1.5 1.5 0 0 1 2.122 0l5.585 5.586a1.5 1.5 0 0 1 0 2.122l-5.585 5.585a1.5 1.5 0 0 1-2.122 0L1.354 9.061a1.5 1.5 0 0 1 0-2.122l5.585-5.586ZM8.75 10.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM8.5 8.5v-3a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0Z"
|
|
21
|
+
),
|
|
22
|
+
critical: createIconFromPath(
|
|
23
|
+
"M8.252 1.726a.5.5 0 0 0-.504 0l-5 2.916a.5.5 0 0 0-.248.432v5.852a.5.5 0 0 0 .248.431l5 2.917a.5.5 0 0 0 .504 0l5-2.916a.5.5 0 0 0 .248-.432V5.074a.5.5 0 0 0-.248-.432l-5-2.916ZM7.244.862a1.5 1.5 0 0 1 1.512 0l5 2.917a1.5 1.5 0 0 1 .744 1.295v5.852a1.5 1.5 0 0 1-.744 1.295l-5 2.917a1.5 1.5 0 0 1-1.512 0l-5-2.917a1.5 1.5 0 0 1-.744-1.295V5.074a1.5 1.5 0 0 1 .744-1.295l5-2.917ZM8.75 10.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM8.5 5.5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0v-3Z"
|
|
24
|
+
),
|
|
25
|
+
info: createIconFromPath(
|
|
26
|
+
"M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2ZM1 8a7 7 0 1 1 14 0A7 7 0 0 1 1 8Zm5.5-1.5a.5.5 0 0 0 0 1h1v3h-1a.5.5 0 1 0 0 1h3a.5.5 0 0 0 0-1h-1V7a.5.5 0 0 0-.5-.5H6.5Zm1.375-1a.625.625 0 1 0 0-1.25.625.625 0 0 0 0 1.25Z"
|
|
27
|
+
)
|
|
28
|
+
};
|
|
29
|
+
const StatusIcon = forwardRef(
|
|
30
|
+
(props, forwardedRef) => {
|
|
31
|
+
const { tone, ...rest } = props;
|
|
32
|
+
const Element = statusIcons[tone];
|
|
33
|
+
return /* @__PURE__ */ jsx(Element, { ...rest, ref: forwardedRef });
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
DEV: StatusIcon.displayName = "StatusIcon";
|
|
37
|
+
const MoreHorizontal = createIconFromPath(
|
|
38
|
+
"M3 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm6-1a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm5 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"
|
|
39
|
+
);
|
|
40
|
+
DEV: MoreHorizontal.displayName = "MoreHorizontal";
|
|
41
|
+
const ChevronDownBase = createIconFromPath(
|
|
42
|
+
"M4.146 6.146a.5.5 0 0 1 .708 0L8 9.293l3.146-3.147a.5.5 0 0 1 .708.708l-3.5 3.5a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 0 1 0-.708Z"
|
|
43
|
+
);
|
|
44
|
+
const ChevronDown = forwardRef((props, forwardedRef) => {
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
46
|
+
ChevronDownBase,
|
|
47
|
+
{
|
|
48
|
+
...props,
|
|
49
|
+
className: cx("\u{1F95D}-chevron-down", props.className),
|
|
50
|
+
ref: forwardedRef
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
DEV: ChevronDown.displayName = "ChevronDown";
|
|
55
|
+
export {
|
|
56
|
+
Checkmark,
|
|
57
|
+
ChevronDown,
|
|
58
|
+
Dismiss,
|
|
59
|
+
MoreHorizontal,
|
|
60
|
+
StatusIcon
|
|
61
|
+
};
|