@aortl/admin-react 0.0.1 → 0.2.0
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/README.md +0 -31
- package/dist/Accordion.d.ts +16 -0
- package/dist/Accordion.d.ts.map +1 -0
- package/dist/AdminRoot.d.ts +5 -0
- package/dist/AdminRoot.d.ts.map +1 -0
- package/dist/Alert.d.ts +23 -0
- package/dist/Alert.d.ts.map +1 -0
- package/dist/AppShell.d.ts +28 -0
- package/dist/AppShell.d.ts.map +1 -0
- package/dist/Badge.d.ts +12 -0
- package/dist/Badge.d.ts.map +1 -0
- package/dist/BrandTile.d.ts +10 -0
- package/dist/BrandTile.d.ts.map +1 -0
- package/dist/Breadcrumbs.d.ts +29 -0
- package/dist/Breadcrumbs.d.ts.map +1 -0
- package/dist/Button.d.ts +10 -2
- package/dist/Button.d.ts.map +1 -1
- package/dist/ButtonGroup.d.ts +7 -0
- package/dist/ButtonGroup.d.ts.map +1 -0
- package/dist/Card.d.ts +32 -5
- package/dist/Card.d.ts.map +1 -1
- package/dist/Checkbox.d.ts +11 -0
- package/dist/Checkbox.d.ts.map +1 -0
- package/dist/Dialog.d.ts +73 -0
- package/dist/Dialog.d.ts.map +1 -0
- package/dist/Field.d.ts +5 -2
- package/dist/Field.d.ts.map +1 -1
- package/dist/FileInput.d.ts +12 -0
- package/dist/FileInput.d.ts.map +1 -0
- package/dist/Footer.d.ts +16 -0
- package/dist/Footer.d.ts.map +1 -0
- package/dist/Input.d.ts.map +1 -1
- package/dist/InputGroup.d.ts +10 -0
- package/dist/InputGroup.d.ts.map +1 -0
- package/dist/Menu.d.ts +35 -0
- package/dist/Menu.d.ts.map +1 -0
- package/dist/Navbar.d.ts +36 -0
- package/dist/Navbar.d.ts.map +1 -0
- package/dist/Pagination.d.ts +51 -0
- package/dist/Pagination.d.ts.map +1 -0
- package/dist/Progress.d.ts +12 -0
- package/dist/Progress.d.ts.map +1 -0
- package/dist/Radio.d.ts +17 -0
- package/dist/Radio.d.ts.map +1 -0
- package/dist/Select.d.ts +43 -0
- package/dist/Select.d.ts.map +1 -0
- package/dist/Sidebar.d.ts +79 -0
- package/dist/Sidebar.d.ts.map +1 -0
- package/dist/Spinner.d.ts +9 -0
- package/dist/Spinner.d.ts.map +1 -0
- package/dist/Switch.d.ts +11 -0
- package/dist/Switch.d.ts.map +1 -0
- package/dist/Table.d.ts +55 -0
- package/dist/Table.d.ts.map +1 -0
- package/dist/Tabs.d.ts +26 -0
- package/dist/Tabs.d.ts.map +1 -0
- package/dist/Textarea.d.ts +9 -0
- package/dist/Textarea.d.ts.map +1 -0
- package/dist/admin.css +2918 -248
- package/dist/admin.scoped.css +3383 -0
- package/dist/cn.d.ts +10 -0
- package/dist/cn.d.ts.map +1 -0
- package/dist/icon.d.ts +26 -0
- package/dist/icon.d.ts.map +1 -0
- package/dist/index.cjs +1244 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1218 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +26 -7
package/dist/index.mjs
CHANGED
|
@@ -1,44 +1,694 @@
|
|
|
1
|
-
import { Button as Button$1 } from "@base-ui/react/button";
|
|
2
1
|
import { clsx } from "clsx";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Children, Fragment as Fragment$1, createContext, createElement, isValidElement, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { Button as Button$1 } from "@base-ui/react/button";
|
|
4
5
|
import { Input as Input$1 } from "@base-ui/react/input";
|
|
6
|
+
import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
|
|
7
|
+
import { Radio as Radio$1 } from "@base-ui/react/radio";
|
|
8
|
+
import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
|
|
9
|
+
import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
10
|
+
import { Select as Select$1 } from "@base-ui/react/select";
|
|
5
11
|
import { Field as Field$1 } from "@base-ui/react/field";
|
|
12
|
+
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
13
|
+
import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
14
|
+
//#region src/Accordion.tsx
|
|
15
|
+
function AccordionRoot({ className, ...rest }) {
|
|
16
|
+
return /* @__PURE__ */ jsx("div", {
|
|
17
|
+
className: clsx("accordion", className),
|
|
18
|
+
...rest
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function AccordionItem({ className, ...rest }) {
|
|
22
|
+
return /* @__PURE__ */ jsx("details", {
|
|
23
|
+
className: clsx("accordion-item", className),
|
|
24
|
+
...rest
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function AccordionSummary({ className, ...rest }) {
|
|
28
|
+
return /* @__PURE__ */ jsx("summary", {
|
|
29
|
+
className: clsx("accordion-summary", className),
|
|
30
|
+
...rest
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function AccordionContent({ className, ...rest }) {
|
|
34
|
+
return /* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: clsx("accordion-content", className),
|
|
36
|
+
...rest
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
var Accordion = Object.assign(AccordionRoot, {
|
|
40
|
+
Item: AccordionItem,
|
|
41
|
+
Summary: AccordionSummary,
|
|
42
|
+
Content: AccordionContent
|
|
43
|
+
});
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/AdminRoot.tsx
|
|
46
|
+
function AdminRoot({ className, ...rest }) {
|
|
47
|
+
return /* @__PURE__ */ jsx("div", {
|
|
48
|
+
className: clsx("admin-root", className),
|
|
49
|
+
...rest
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/icon.ts
|
|
54
|
+
/**
|
|
55
|
+
* Render an `IconProp` to a React node, defaulting to `size={16} aria-hidden`
|
|
56
|
+
* when given a component reference.
|
|
57
|
+
*
|
|
58
|
+
* Anything that is not `null`/`undefined` and not already a React element is
|
|
59
|
+
* treated as a component type — `createElement` accepts function components,
|
|
60
|
+
* `forwardRef`s (e.g. `@tabler/icons-react`), `memo`, etc.
|
|
61
|
+
*/
|
|
62
|
+
function renderIcon(icon, size = 16) {
|
|
63
|
+
if (icon == null) return null;
|
|
64
|
+
if (isValidElement(icon)) return icon;
|
|
65
|
+
return createElement(icon, {
|
|
66
|
+
size,
|
|
67
|
+
"aria-hidden": true
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/Alert.tsx
|
|
72
|
+
function AlertRoot({ variant = "info", icon, title, description, className, role, children, ...rest }) {
|
|
73
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
74
|
+
role: role ?? (variant === "danger" || variant === "warning" ? "alert" : "status"),
|
|
75
|
+
className: clsx("alert", `alert-${variant}`, className),
|
|
76
|
+
...rest,
|
|
77
|
+
children: [
|
|
78
|
+
renderIcon(icon),
|
|
79
|
+
title !== void 0 ? /* @__PURE__ */ jsx(AlertTitle, { children: title }) : null,
|
|
80
|
+
description !== void 0 ? /* @__PURE__ */ jsx(AlertDescription, { children: description }) : null,
|
|
81
|
+
children
|
|
82
|
+
]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function AlertTitle({ className, ...rest }) {
|
|
86
|
+
return /* @__PURE__ */ jsx("strong", {
|
|
87
|
+
className: clsx("alert-title", className),
|
|
88
|
+
...rest
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function AlertDescription({ className, ...rest }) {
|
|
92
|
+
return /* @__PURE__ */ jsx("p", {
|
|
93
|
+
className: clsx("alert-description", className),
|
|
94
|
+
...rest
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
var Alert = Object.assign(AlertRoot, {
|
|
98
|
+
Title: AlertTitle,
|
|
99
|
+
Description: AlertDescription
|
|
100
|
+
});
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/AppShell.tsx
|
|
103
|
+
var AppShellContext = createContext(null);
|
|
104
|
+
function useAppShell() {
|
|
105
|
+
return useContext(AppShellContext);
|
|
106
|
+
}
|
|
107
|
+
function AppShellRoot({ hasSidebar = false, hasFooter = false, mobileDrawerOpen, defaultMobileDrawerOpen = false, onMobileDrawerOpenChange, systemAccent, className, style, children, ...rest }) {
|
|
108
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultMobileDrawerOpen);
|
|
109
|
+
const isControlled = mobileDrawerOpen !== void 0;
|
|
110
|
+
const open = isControlled ? mobileDrawerOpen : uncontrolledOpen;
|
|
111
|
+
const value = useMemo(() => ({
|
|
112
|
+
mobileDrawerOpen: open,
|
|
113
|
+
setMobileDrawerOpen: (next) => {
|
|
114
|
+
if (!isControlled) setUncontrolledOpen(next);
|
|
115
|
+
onMobileDrawerOpenChange?.(next);
|
|
116
|
+
},
|
|
117
|
+
hasSidebar
|
|
118
|
+
}), [
|
|
119
|
+
open,
|
|
120
|
+
isControlled,
|
|
121
|
+
onMobileDrawerOpenChange,
|
|
122
|
+
hasSidebar
|
|
123
|
+
]);
|
|
124
|
+
const rootStyle = systemAccent !== void 0 ? {
|
|
125
|
+
...style,
|
|
126
|
+
"--color-system-accent": systemAccent
|
|
127
|
+
} : style;
|
|
128
|
+
return /* @__PURE__ */ jsx(AppShellContext.Provider, {
|
|
129
|
+
value,
|
|
130
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
131
|
+
className: clsx("app-shell", hasSidebar && "app-shell-with-sidebar", hasFooter && "app-shell-with-footer", className),
|
|
132
|
+
style: rootStyle,
|
|
133
|
+
...rest,
|
|
134
|
+
children
|
|
135
|
+
})
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function AppShellMain({ className, ...rest }) {
|
|
139
|
+
return /* @__PURE__ */ jsx("main", {
|
|
140
|
+
className: clsx("app-shell-main", className),
|
|
141
|
+
...rest
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
var AppShell = Object.assign(AppShellRoot, { Main: AppShellMain });
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/Badge.tsx
|
|
147
|
+
function Badge({ variant = "neutral", size = "md", icon, className, children, ...rest }) {
|
|
148
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
149
|
+
className: clsx("badge", `badge-${variant}`, size !== "md" && `badge-${size}`, className),
|
|
150
|
+
...rest,
|
|
151
|
+
children: [renderIcon(icon, size === "sm" ? 10 : 12), children]
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/BrandTile.tsx
|
|
156
|
+
function BrandTile({ monogram, icon, className, children, ...rest }) {
|
|
157
|
+
return /* @__PURE__ */ jsx("span", {
|
|
158
|
+
className: clsx("brand-tile", className),
|
|
159
|
+
"aria-hidden": true,
|
|
160
|
+
...rest,
|
|
161
|
+
children: icon ? renderIcon(icon, 14) : children ?? monogram
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/cn.ts
|
|
166
|
+
/**
|
|
167
|
+
* className merger that preserves Base UI's render-prop className form.
|
|
168
|
+
*
|
|
169
|
+
* Base UI components accept `className: string | ((state) => string | undefined)`. The plain
|
|
170
|
+
* `clsx()` path is correct for strings, but a function form has to be deferred
|
|
171
|
+
* until Base UI invokes it with the component state.
|
|
172
|
+
*/
|
|
173
|
+
function cn(base, className) {
|
|
174
|
+
if (typeof className === "function") return (state) => clsx(base, className(state));
|
|
175
|
+
return clsx(base, className);
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
6
178
|
//#region src/Button.tsx
|
|
7
|
-
function Button({ variant = "primary", size = "md",
|
|
8
|
-
|
|
179
|
+
function Button({ variant = "primary", size = "md", fullWidth, loading, icon, iconTrailing, className, type = "button", disabled, children, ...rest }) {
|
|
180
|
+
const iconOnly = children == null && (icon != null || iconTrailing != null);
|
|
181
|
+
return /* @__PURE__ */ jsxs(Button$1, {
|
|
9
182
|
type,
|
|
10
|
-
|
|
183
|
+
disabled: disabled || loading,
|
|
184
|
+
"aria-busy": loading || void 0,
|
|
185
|
+
className: cn([
|
|
186
|
+
"btn",
|
|
187
|
+
`btn-${variant}`,
|
|
188
|
+
size !== "md" && `btn-${size}`,
|
|
189
|
+
fullWidth && "btn-full-width",
|
|
190
|
+
loading && "btn-loading",
|
|
191
|
+
iconOnly && "btn-square"
|
|
192
|
+
], className),
|
|
193
|
+
...rest,
|
|
194
|
+
children: [
|
|
195
|
+
loading ? null : renderIcon(icon),
|
|
196
|
+
children,
|
|
197
|
+
renderIcon(iconTrailing)
|
|
198
|
+
]
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/ButtonGroup.tsx
|
|
203
|
+
function ButtonGroup({ orientation = "horizontal", role = "group", className, ...rest }) {
|
|
204
|
+
return /* @__PURE__ */ jsx("div", {
|
|
205
|
+
role,
|
|
206
|
+
className: clsx("btn-group", orientation === "vertical" && "btn-group-vertical", className),
|
|
11
207
|
...rest
|
|
12
208
|
});
|
|
13
209
|
}
|
|
14
210
|
//#endregion
|
|
211
|
+
//#region src/Breadcrumbs.tsx
|
|
212
|
+
function BreadcrumbsRoot({ separator, className, children, "aria-label": ariaLabel = "Breadcrumb", ...rest }) {
|
|
213
|
+
const items = Children.toArray(children).filter(isValidElement);
|
|
214
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
215
|
+
"aria-label": ariaLabel,
|
|
216
|
+
className: clsx("breadcrumbs", className),
|
|
217
|
+
...rest,
|
|
218
|
+
children: /* @__PURE__ */ jsx("ol", { children: items.map((child, i) => /* @__PURE__ */ jsxs(Fragment$1, { children: [child, i < items.length - 1 ? /* @__PURE__ */ jsx(BreadcrumbSeparator, { children: separator }) : null] }, child.key ?? i)) })
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function BreadcrumbItem(props) {
|
|
222
|
+
if (props.href !== void 0) {
|
|
223
|
+
const { className, current, icon, children, ...rest } = props;
|
|
224
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("a", {
|
|
225
|
+
className: clsx("breadcrumb-item", className),
|
|
226
|
+
"aria-current": current ? "page" : void 0,
|
|
227
|
+
...rest,
|
|
228
|
+
children: [renderIcon(icon, 14), children]
|
|
229
|
+
}) });
|
|
230
|
+
}
|
|
231
|
+
const { className, current, icon, children, ...rest } = props;
|
|
232
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("span", {
|
|
233
|
+
className: clsx("breadcrumb-item", className),
|
|
234
|
+
"aria-current": current ? "page" : void 0,
|
|
235
|
+
...rest,
|
|
236
|
+
children: [renderIcon(icon, 14), children]
|
|
237
|
+
}) });
|
|
238
|
+
}
|
|
239
|
+
function BreadcrumbSeparator({ className, children, ...rest }) {
|
|
240
|
+
return /* @__PURE__ */ jsx("span", {
|
|
241
|
+
"aria-hidden": "true",
|
|
242
|
+
className: clsx("breadcrumb-separator", className),
|
|
243
|
+
...rest,
|
|
244
|
+
children
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
var Breadcrumbs = Object.assign(BreadcrumbsRoot, {
|
|
248
|
+
Item: BreadcrumbItem,
|
|
249
|
+
Separator: BreadcrumbSeparator
|
|
250
|
+
});
|
|
251
|
+
//#endregion
|
|
15
252
|
//#region src/Input.tsx
|
|
16
253
|
function Input({ variant = "bordered", inputSize = "md", className, type = "text", ...rest }) {
|
|
17
254
|
return /* @__PURE__ */ jsx(Input$1, {
|
|
18
255
|
type,
|
|
19
|
-
className:
|
|
256
|
+
className: cn([
|
|
257
|
+
"input",
|
|
258
|
+
`input-${variant}`,
|
|
259
|
+
inputSize !== "md" && `input-${inputSize}`
|
|
260
|
+
], className),
|
|
261
|
+
...rest
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/FileInput.tsx
|
|
266
|
+
function FileInput({ variant = "bordered", inputSize = "md", className, ...rest }) {
|
|
267
|
+
return /* @__PURE__ */ jsx(Input$1, {
|
|
268
|
+
type: "file",
|
|
269
|
+
className: cn([
|
|
270
|
+
"file-input",
|
|
271
|
+
`file-input-${variant}`,
|
|
272
|
+
inputSize !== "md" && `file-input-${inputSize}`
|
|
273
|
+
], className),
|
|
274
|
+
...rest
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/InputGroup.tsx
|
|
279
|
+
function InputGroupRoot({ className, ...rest }) {
|
|
280
|
+
return /* @__PURE__ */ jsx("div", {
|
|
281
|
+
className: clsx("input-group", className),
|
|
282
|
+
...rest
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function InputGroupAddon({ className, ...rest }) {
|
|
286
|
+
return /* @__PURE__ */ jsx("span", {
|
|
287
|
+
className: clsx("input-group-addon", className),
|
|
20
288
|
...rest
|
|
21
289
|
});
|
|
22
290
|
}
|
|
291
|
+
var InputGroup = Object.assign(InputGroupRoot, { Addon: InputGroupAddon });
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region src/Pagination.tsx
|
|
294
|
+
/**
|
|
295
|
+
* Compute the items to render for a given `page` / `total`. Always returns:
|
|
296
|
+
* previous, ...numbers/ellipses, next
|
|
297
|
+
* with `boundaryCount` items on each end and `siblingCount` items around `page`.
|
|
298
|
+
* Pure: no React state, safe to call during render.
|
|
299
|
+
*/
|
|
300
|
+
function getPaginationItems({ page, total, siblingCount = 1, boundaryCount = 1 }) {
|
|
301
|
+
if (total <= 0) return [{
|
|
302
|
+
type: "previous",
|
|
303
|
+
page: 1,
|
|
304
|
+
disabled: true
|
|
305
|
+
}, {
|
|
306
|
+
type: "next",
|
|
307
|
+
page: 1,
|
|
308
|
+
disabled: true
|
|
309
|
+
}];
|
|
310
|
+
const clampedPage = Math.min(Math.max(1, page), total);
|
|
311
|
+
const items = [];
|
|
312
|
+
items.push({
|
|
313
|
+
type: "previous",
|
|
314
|
+
page: clampedPage - 1,
|
|
315
|
+
disabled: clampedPage === 1
|
|
316
|
+
});
|
|
317
|
+
const startPages = range(1, Math.min(boundaryCount, total));
|
|
318
|
+
const endPages = range(Math.max(total - boundaryCount + 1, boundaryCount + 1), total);
|
|
319
|
+
const siblingsStart = Math.max(Math.min(clampedPage - siblingCount, total - boundaryCount - siblingCount * 2 - 1), boundaryCount + 2);
|
|
320
|
+
const siblingsEnd = Math.min(Math.max(clampedPage + siblingCount, boundaryCount + siblingCount * 2 + 2), endPages.length > 0 ? endPages[0] - 2 : total - 1);
|
|
321
|
+
const middle = [];
|
|
322
|
+
if (siblingsStart > boundaryCount + 2) middle.push("ellipsis-start");
|
|
323
|
+
else if (boundaryCount + 1 < total - boundaryCount) middle.push(boundaryCount + 1);
|
|
324
|
+
middle.push(...range(siblingsStart, siblingsEnd));
|
|
325
|
+
if (siblingsEnd < total - boundaryCount - 1) middle.push("ellipsis-end");
|
|
326
|
+
else if (total - boundaryCount > boundaryCount) middle.push(total - boundaryCount);
|
|
327
|
+
const seen = /* @__PURE__ */ new Set();
|
|
328
|
+
const pushNumber = (n) => {
|
|
329
|
+
if (n < 1 || n > total || seen.has(n)) return;
|
|
330
|
+
seen.add(n);
|
|
331
|
+
items.push({
|
|
332
|
+
type: "page",
|
|
333
|
+
page: n,
|
|
334
|
+
selected: n === clampedPage
|
|
335
|
+
});
|
|
336
|
+
};
|
|
337
|
+
for (const n of startPages) pushNumber(n);
|
|
338
|
+
for (const entry of middle) if (entry === "ellipsis-start") items.push({
|
|
339
|
+
type: "ellipsis",
|
|
340
|
+
key: "start"
|
|
341
|
+
});
|
|
342
|
+
else if (entry === "ellipsis-end") items.push({
|
|
343
|
+
type: "ellipsis",
|
|
344
|
+
key: "end"
|
|
345
|
+
});
|
|
346
|
+
else pushNumber(entry);
|
|
347
|
+
for (const n of endPages) pushNumber(n);
|
|
348
|
+
items.push({
|
|
349
|
+
type: "next",
|
|
350
|
+
page: clampedPage + 1,
|
|
351
|
+
disabled: clampedPage === total
|
|
352
|
+
});
|
|
353
|
+
return items;
|
|
354
|
+
}
|
|
355
|
+
function range(start, end) {
|
|
356
|
+
if (end < start) return [];
|
|
357
|
+
const out = [];
|
|
358
|
+
for (let i = start; i <= end; i++) out.push(i);
|
|
359
|
+
return out;
|
|
360
|
+
}
|
|
361
|
+
function Pagination({ page, total, onPageChange, siblingCount = 1, boundaryCount = 1, previousIcon, nextIcon, renderItem, className, "aria-label": ariaLabel = "Pagination", ...rest }) {
|
|
362
|
+
const items = getPaginationItems({
|
|
363
|
+
page,
|
|
364
|
+
total,
|
|
365
|
+
siblingCount,
|
|
366
|
+
boundaryCount
|
|
367
|
+
});
|
|
368
|
+
const prev = previousIcon !== void 0 ? renderIcon(previousIcon, 16) : /* @__PURE__ */ jsx(ChevronLeftIcon, {});
|
|
369
|
+
const next = nextIcon !== void 0 ? renderIcon(nextIcon, 16) : /* @__PURE__ */ jsx(ChevronRightIcon, {});
|
|
370
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
371
|
+
"aria-label": ariaLabel,
|
|
372
|
+
className: clsx("pagination", className),
|
|
373
|
+
...rest,
|
|
374
|
+
children: /* @__PURE__ */ jsx("ul", { children: items.map((item, i) => /* @__PURE__ */ jsx("li", {
|
|
375
|
+
className: "page-item",
|
|
376
|
+
children: renderItem ? renderItem(item) : defaultRender(item, onPageChange, prev, next)
|
|
377
|
+
}, paginationItemKey(item, i))) })
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
function ChevronLeftIcon() {
|
|
381
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
382
|
+
width: "16",
|
|
383
|
+
height: "16",
|
|
384
|
+
viewBox: "0 0 24 24",
|
|
385
|
+
fill: "none",
|
|
386
|
+
stroke: "currentColor",
|
|
387
|
+
strokeWidth: "2",
|
|
388
|
+
strokeLinecap: "round",
|
|
389
|
+
strokeLinejoin: "round",
|
|
390
|
+
"aria-hidden": "true",
|
|
391
|
+
children: /* @__PURE__ */ jsx("path", { d: "M15 6l-6 6 6 6" })
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
function ChevronRightIcon() {
|
|
395
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
396
|
+
width: "16",
|
|
397
|
+
height: "16",
|
|
398
|
+
viewBox: "0 0 24 24",
|
|
399
|
+
fill: "none",
|
|
400
|
+
stroke: "currentColor",
|
|
401
|
+
strokeWidth: "2",
|
|
402
|
+
strokeLinecap: "round",
|
|
403
|
+
strokeLinejoin: "round",
|
|
404
|
+
"aria-hidden": "true",
|
|
405
|
+
children: /* @__PURE__ */ jsx("path", { d: "M9 6l6 6-6 6" })
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
function paginationItemKey(item, index) {
|
|
409
|
+
switch (item.type) {
|
|
410
|
+
case "previous": return "previous";
|
|
411
|
+
case "next": return "next";
|
|
412
|
+
case "ellipsis": return `ellipsis-${item.key}`;
|
|
413
|
+
case "page": return `page-${item.page}`;
|
|
414
|
+
default: return `${index}`;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
function defaultRender(item, onPageChange, prev, next) {
|
|
418
|
+
switch (item.type) {
|
|
419
|
+
case "previous": return /* @__PURE__ */ jsx("button", {
|
|
420
|
+
type: "button",
|
|
421
|
+
className: "page-link",
|
|
422
|
+
"aria-label": "Previous page",
|
|
423
|
+
"aria-disabled": item.disabled || void 0,
|
|
424
|
+
disabled: item.disabled,
|
|
425
|
+
onClick: () => onPageChange(item.page),
|
|
426
|
+
children: prev
|
|
427
|
+
});
|
|
428
|
+
case "next": return /* @__PURE__ */ jsx("button", {
|
|
429
|
+
type: "button",
|
|
430
|
+
className: "page-link",
|
|
431
|
+
"aria-label": "Next page",
|
|
432
|
+
"aria-disabled": item.disabled || void 0,
|
|
433
|
+
disabled: item.disabled,
|
|
434
|
+
onClick: () => onPageChange(item.page),
|
|
435
|
+
children: next
|
|
436
|
+
});
|
|
437
|
+
case "ellipsis": return /* @__PURE__ */ jsx("span", {
|
|
438
|
+
className: "page-ellipsis",
|
|
439
|
+
"aria-hidden": "true",
|
|
440
|
+
children: "…"
|
|
441
|
+
});
|
|
442
|
+
case "page": return /* @__PURE__ */ jsx("button", {
|
|
443
|
+
type: "button",
|
|
444
|
+
className: clsx("page-link", item.selected && "active"),
|
|
445
|
+
"aria-current": item.selected ? "page" : void 0,
|
|
446
|
+
"aria-label": `Page ${item.page}`,
|
|
447
|
+
onClick: () => onPageChange(item.page),
|
|
448
|
+
children: item.page
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region src/Textarea.tsx
|
|
454
|
+
function Textarea({ variant = "bordered", textareaSize = "md", className, ...rest }) {
|
|
455
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
456
|
+
className: clsx("textarea", `textarea-${variant}`, textareaSize !== "md" && `textarea-${textareaSize}`, className),
|
|
457
|
+
...rest
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
//#endregion
|
|
461
|
+
//#region src/Checkbox.tsx
|
|
462
|
+
function CheckboxRoot({ className, children, ...rest }) {
|
|
463
|
+
return /* @__PURE__ */ jsx(Checkbox$1.Root, {
|
|
464
|
+
className: cn("checkbox", className),
|
|
465
|
+
...rest,
|
|
466
|
+
children: children ?? /* @__PURE__ */ jsx(CheckboxIndicator, { children: /* @__PURE__ */ jsx(CheckIcon$1, {}) })
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
function CheckboxIndicator({ className, ...rest }) {
|
|
470
|
+
return /* @__PURE__ */ jsx(Checkbox$1.Indicator, {
|
|
471
|
+
className: cn("checkbox-indicator", className),
|
|
472
|
+
...rest
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
function CheckIcon$1() {
|
|
476
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
477
|
+
viewBox: "0 0 24 24",
|
|
478
|
+
fill: "none",
|
|
479
|
+
stroke: "currentColor",
|
|
480
|
+
strokeWidth: 2.5,
|
|
481
|
+
strokeLinecap: "round",
|
|
482
|
+
strokeLinejoin: "round",
|
|
483
|
+
width: "100%",
|
|
484
|
+
height: "100%",
|
|
485
|
+
"aria-hidden": true,
|
|
486
|
+
children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" })
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
var Checkbox = Object.assign(CheckboxRoot, { Indicator: CheckboxIndicator });
|
|
490
|
+
//#endregion
|
|
491
|
+
//#region src/Radio.tsx
|
|
492
|
+
function RadioRoot({ className, children, ...rest }) {
|
|
493
|
+
return /* @__PURE__ */ jsx(Radio$1.Root, {
|
|
494
|
+
className: cn("radio", className),
|
|
495
|
+
...rest,
|
|
496
|
+
children: children ?? /* @__PURE__ */ jsx(RadioIndicator, {})
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
function RadioIndicator({ className, ...rest }) {
|
|
500
|
+
return /* @__PURE__ */ jsx(Radio$1.Indicator, {
|
|
501
|
+
className: cn("radio-indicator", className),
|
|
502
|
+
...rest
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
var Radio = Object.assign(RadioRoot, { Indicator: RadioIndicator });
|
|
506
|
+
function RadioGroup({ orientation = "horizontal", className, ...rest }) {
|
|
507
|
+
return /* @__PURE__ */ jsx(RadioGroup$1, {
|
|
508
|
+
className: cn(["radio-group", orientation === "vertical" && "radio-group-vertical"], className),
|
|
509
|
+
...rest
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
//#endregion
|
|
513
|
+
//#region src/Progress.tsx
|
|
514
|
+
function Progress({ value, max = 100, variant = "primary", size = "md", className, ...rest }) {
|
|
515
|
+
return /* @__PURE__ */ jsx("progress", {
|
|
516
|
+
value,
|
|
517
|
+
max,
|
|
518
|
+
className: clsx("progress", variant !== "primary" && `progress-${variant}`, size !== "md" && `progress-${size}`, className),
|
|
519
|
+
...rest
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
//#endregion
|
|
523
|
+
//#region src/Spinner.tsx
|
|
524
|
+
function Spinner({ size = "md", label = "Loading", className, ...rest }) {
|
|
525
|
+
return /* @__PURE__ */ jsx("output", {
|
|
526
|
+
"aria-label": label,
|
|
527
|
+
className: clsx("spinner", size !== "md" && `spinner-${size}`, className),
|
|
528
|
+
...rest
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region src/Switch.tsx
|
|
533
|
+
function SwitchRoot({ className, children, ...rest }) {
|
|
534
|
+
return /* @__PURE__ */ jsx(Switch$1.Root, {
|
|
535
|
+
className: cn("switch", className),
|
|
536
|
+
...rest,
|
|
537
|
+
children: children ?? /* @__PURE__ */ jsx(SwitchThumb, {})
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
function SwitchThumb({ className, ...rest }) {
|
|
541
|
+
return /* @__PURE__ */ jsx(Switch$1.Thumb, {
|
|
542
|
+
className: cn("switch-thumb", className),
|
|
543
|
+
...rest
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
var Switch = Object.assign(SwitchRoot, { Thumb: SwitchThumb });
|
|
547
|
+
//#endregion
|
|
548
|
+
//#region src/Select.tsx
|
|
549
|
+
function SelectRoot(props) {
|
|
550
|
+
return /* @__PURE__ */ jsx(Select$1.Root, { ...props });
|
|
551
|
+
}
|
|
552
|
+
function SelectTrigger({ variant = "bordered", triggerSize = "md", className, ...rest }) {
|
|
553
|
+
return /* @__PURE__ */ jsx(Select$1.Trigger, {
|
|
554
|
+
className: cn([
|
|
555
|
+
"select",
|
|
556
|
+
`select-${variant}`,
|
|
557
|
+
triggerSize !== "md" && `select-${triggerSize}`
|
|
558
|
+
], className),
|
|
559
|
+
...rest
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
function SelectValue(props) {
|
|
563
|
+
return /* @__PURE__ */ jsx(Select$1.Value, { ...props });
|
|
564
|
+
}
|
|
565
|
+
function SelectIcon({ className, children, ...rest }) {
|
|
566
|
+
return /* @__PURE__ */ jsx(Select$1.Icon, {
|
|
567
|
+
className: cn("select-icon", className),
|
|
568
|
+
...rest,
|
|
569
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
function SelectPopup({ className, sideOffset = 4, children, ...rest }) {
|
|
573
|
+
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(Select$1.Positioner, {
|
|
574
|
+
sideOffset,
|
|
575
|
+
children: /* @__PURE__ */ jsx(Select$1.Popup, {
|
|
576
|
+
className: cn("select-popup", className),
|
|
577
|
+
...rest,
|
|
578
|
+
children
|
|
579
|
+
})
|
|
580
|
+
}) });
|
|
581
|
+
}
|
|
582
|
+
function SelectItem({ className, ...rest }) {
|
|
583
|
+
return /* @__PURE__ */ jsx(Select$1.Item, {
|
|
584
|
+
className: cn("select-item", className),
|
|
585
|
+
...rest
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
function SelectItemText(props) {
|
|
589
|
+
return /* @__PURE__ */ jsx(Select$1.ItemText, { ...props });
|
|
590
|
+
}
|
|
591
|
+
function SelectItemIndicator({ className, children, ...rest }) {
|
|
592
|
+
return /* @__PURE__ */ jsx(Select$1.ItemIndicator, {
|
|
593
|
+
className: cn("select-item-indicator", className),
|
|
594
|
+
...rest,
|
|
595
|
+
children: children ?? /* @__PURE__ */ jsx(CheckIcon, {})
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
function SelectGroup(props) {
|
|
599
|
+
return /* @__PURE__ */ jsx(Select$1.Group, { ...props });
|
|
600
|
+
}
|
|
601
|
+
function SelectGroupLabel({ className, ...rest }) {
|
|
602
|
+
return /* @__PURE__ */ jsx(Select$1.GroupLabel, {
|
|
603
|
+
className: cn("select-group-label", className),
|
|
604
|
+
...rest
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
function CheckIcon() {
|
|
608
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
609
|
+
viewBox: "0 0 24 24",
|
|
610
|
+
fill: "none",
|
|
611
|
+
stroke: "currentColor",
|
|
612
|
+
strokeWidth: 2.5,
|
|
613
|
+
strokeLinecap: "round",
|
|
614
|
+
strokeLinejoin: "round",
|
|
615
|
+
width: "100%",
|
|
616
|
+
height: "100%",
|
|
617
|
+
"aria-hidden": true,
|
|
618
|
+
children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" })
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
function ChevronDownIcon() {
|
|
622
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
623
|
+
viewBox: "0 0 24 24",
|
|
624
|
+
fill: "none",
|
|
625
|
+
stroke: "currentColor",
|
|
626
|
+
strokeWidth: 2,
|
|
627
|
+
strokeLinecap: "round",
|
|
628
|
+
strokeLinejoin: "round",
|
|
629
|
+
width: "100%",
|
|
630
|
+
height: "100%",
|
|
631
|
+
"aria-hidden": true,
|
|
632
|
+
children: /* @__PURE__ */ jsx("polyline", { points: "6 9 12 15 18 9" })
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
var Select = Object.assign(SelectRoot, {
|
|
636
|
+
Trigger: SelectTrigger,
|
|
637
|
+
Value: SelectValue,
|
|
638
|
+
Icon: SelectIcon,
|
|
639
|
+
Popup: SelectPopup,
|
|
640
|
+
Item: SelectItem,
|
|
641
|
+
ItemText: SelectItemText,
|
|
642
|
+
ItemIndicator: SelectItemIndicator,
|
|
643
|
+
Group: SelectGroup,
|
|
644
|
+
GroupLabel: SelectGroupLabel
|
|
645
|
+
});
|
|
23
646
|
//#endregion
|
|
24
647
|
//#region src/Card.tsx
|
|
25
|
-
|
|
648
|
+
/**
|
|
649
|
+
* The bare `.card` container — no body, no title. Use this when you need to
|
|
650
|
+
* compose the internals yourself (e.g. a media block above the body).
|
|
651
|
+
*/
|
|
652
|
+
function CardContainer({ bordered, compact, className, ...rest }) {
|
|
26
653
|
return /* @__PURE__ */ jsx("div", {
|
|
27
654
|
className: clsx("card", bordered && "card-bordered", compact && "card-compact", className),
|
|
28
655
|
...rest
|
|
29
656
|
});
|
|
30
657
|
}
|
|
658
|
+
/**
|
|
659
|
+
* Standard card: a `.card` container with a single `.card-body` that lays out
|
|
660
|
+
* an optional title (with icon), description, children, and actions. For
|
|
661
|
+
* anything outside that shape, use `<Card.Container>` and compose by hand.
|
|
662
|
+
*/
|
|
663
|
+
function CardRoot({ bordered, compact, icon, title, description, actions, className, children, ...rest }) {
|
|
664
|
+
const hasTitle = icon !== void 0 || title !== void 0;
|
|
665
|
+
return /* @__PURE__ */ jsx(CardContainer, {
|
|
666
|
+
bordered,
|
|
667
|
+
compact,
|
|
668
|
+
className,
|
|
669
|
+
...rest,
|
|
670
|
+
children: /* @__PURE__ */ jsxs(CardBody, { children: [
|
|
671
|
+
hasTitle ? /* @__PURE__ */ jsx(CardTitle, {
|
|
672
|
+
icon,
|
|
673
|
+
children: title
|
|
674
|
+
}) : null,
|
|
675
|
+
description !== void 0 ? /* @__PURE__ */ jsx(CardDescription, { children: description }) : null,
|
|
676
|
+
children,
|
|
677
|
+
actions !== void 0 ? /* @__PURE__ */ jsx(CardActions, { children: actions }) : null
|
|
678
|
+
] })
|
|
679
|
+
});
|
|
680
|
+
}
|
|
31
681
|
function CardBody({ className, ...rest }) {
|
|
32
682
|
return /* @__PURE__ */ jsx("div", {
|
|
33
683
|
className: clsx("card-body", className),
|
|
34
684
|
...rest
|
|
35
685
|
});
|
|
36
686
|
}
|
|
37
|
-
function CardTitle({ className, children, ...rest }) {
|
|
38
|
-
return /* @__PURE__ */
|
|
687
|
+
function CardTitle({ icon, className, children, ...rest }) {
|
|
688
|
+
return /* @__PURE__ */ jsxs("h3", {
|
|
39
689
|
className: clsx("card-title", className),
|
|
40
690
|
...rest,
|
|
41
|
-
children
|
|
691
|
+
children: [renderIcon(icon), children]
|
|
42
692
|
});
|
|
43
693
|
}
|
|
44
694
|
function CardDescription({ className, ...rest }) {
|
|
@@ -54,34 +704,161 @@ function CardActions({ className, ...rest }) {
|
|
|
54
704
|
});
|
|
55
705
|
}
|
|
56
706
|
var Card = Object.assign(CardRoot, {
|
|
707
|
+
Container: CardContainer,
|
|
57
708
|
Body: CardBody,
|
|
58
709
|
Title: CardTitle,
|
|
59
710
|
Description: CardDescription,
|
|
60
711
|
Actions: CardActions
|
|
61
712
|
});
|
|
62
713
|
//#endregion
|
|
714
|
+
//#region src/Dialog.tsx
|
|
715
|
+
var DialogContext = createContext(null);
|
|
716
|
+
function DefaultCloseIcon() {
|
|
717
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
718
|
+
width: "16",
|
|
719
|
+
height: "16",
|
|
720
|
+
viewBox: "0 0 24 24",
|
|
721
|
+
fill: "none",
|
|
722
|
+
stroke: "currentColor",
|
|
723
|
+
strokeWidth: "2",
|
|
724
|
+
strokeLinecap: "round",
|
|
725
|
+
strokeLinejoin: "round",
|
|
726
|
+
"aria-hidden": "true",
|
|
727
|
+
children: [/* @__PURE__ */ jsx("path", { d: "M18 6 6 18" }), /* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })]
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* The bare `<dialog>` primitive — no opinions about header, body, or footer.
|
|
732
|
+
* Use this when the default `<Dialog>` layout doesn't fit (custom header,
|
|
733
|
+
* media block, multi-step content).
|
|
734
|
+
*/
|
|
735
|
+
function DialogContainer({ open, onOpenChange, size = "md", closedby = "any", className, children, ...rest }) {
|
|
736
|
+
const ref = useRef(null);
|
|
737
|
+
const onOpenChangeRef = useRef(onOpenChange);
|
|
738
|
+
onOpenChangeRef.current = onOpenChange;
|
|
739
|
+
useEffect(() => {
|
|
740
|
+
const el = ref.current;
|
|
741
|
+
if (!el || open === void 0) return;
|
|
742
|
+
if (open && !el.open) el.showModal();
|
|
743
|
+
else if (!open && el.open) el.close();
|
|
744
|
+
}, [open]);
|
|
745
|
+
useEffect(() => {
|
|
746
|
+
const el = ref.current;
|
|
747
|
+
if (!el) return;
|
|
748
|
+
const handleClose = () => onOpenChangeRef.current?.(false);
|
|
749
|
+
el.addEventListener("close", handleClose);
|
|
750
|
+
return () => el.removeEventListener("close", handleClose);
|
|
751
|
+
}, []);
|
|
752
|
+
return /* @__PURE__ */ jsx(DialogContext.Provider, {
|
|
753
|
+
value: { close: () => ref.current?.close() },
|
|
754
|
+
children: /* @__PURE__ */ jsx("dialog", {
|
|
755
|
+
ref,
|
|
756
|
+
className: clsx("dialog", size !== "md" && `dialog-${size}`, className),
|
|
757
|
+
closedby,
|
|
758
|
+
...rest,
|
|
759
|
+
children
|
|
760
|
+
})
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
function DialogHeader({ className, ...rest }) {
|
|
764
|
+
return /* @__PURE__ */ jsx("div", {
|
|
765
|
+
className: clsx("dialog-header", className),
|
|
766
|
+
...rest
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
function DialogTitle({ icon, className, children, ...rest }) {
|
|
770
|
+
return /* @__PURE__ */ jsxs("h2", {
|
|
771
|
+
className: clsx("dialog-title", className),
|
|
772
|
+
...rest,
|
|
773
|
+
children: [renderIcon(icon), children]
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
function DialogDescription({ className, ...rest }) {
|
|
777
|
+
return /* @__PURE__ */ jsx("p", {
|
|
778
|
+
className: clsx("dialog-description", className),
|
|
779
|
+
...rest
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
function DialogBody({ className, ...rest }) {
|
|
783
|
+
return /* @__PURE__ */ jsx("div", {
|
|
784
|
+
className: clsx("dialog-body", className),
|
|
785
|
+
...rest
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
function DialogFooter({ className, ...rest }) {
|
|
789
|
+
return /* @__PURE__ */ jsx("div", {
|
|
790
|
+
className: clsx("dialog-footer", className),
|
|
791
|
+
...rest
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
function DialogCloseButton({ icon, className, children, onClick, type = "button", "aria-label": ariaLabel = "Close", ...rest }) {
|
|
795
|
+
const ctx = useContext(DialogContext);
|
|
796
|
+
return /* @__PURE__ */ jsx("button", {
|
|
797
|
+
type,
|
|
798
|
+
className: clsx("dialog-close", className),
|
|
799
|
+
"aria-label": ariaLabel,
|
|
800
|
+
onClick: (event) => {
|
|
801
|
+
onClick?.(event);
|
|
802
|
+
if (!event.defaultPrevented) ctx?.close();
|
|
803
|
+
},
|
|
804
|
+
...rest,
|
|
805
|
+
children: children ?? (icon !== void 0 ? renderIcon(icon) : /* @__PURE__ */ jsx(DefaultCloseIcon, {}))
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Standard modal: a `<dialog>` with an opinionated header / body / footer
|
|
810
|
+
* layout driven by shorthand props. For anything outside that shape, use
|
|
811
|
+
* `<Dialog.Container>` and compose by hand.
|
|
812
|
+
*/
|
|
813
|
+
function DialogRoot({ icon, title, description, actions, dismissible = true, closeLabel = "Close", children, ...containerProps }) {
|
|
814
|
+
const hasTitle = title !== void 0 || icon !== void 0;
|
|
815
|
+
const showHeader = hasTitle || dismissible;
|
|
816
|
+
return /* @__PURE__ */ jsxs(DialogContainer, {
|
|
817
|
+
...containerProps,
|
|
818
|
+
children: [
|
|
819
|
+
showHeader ? /* @__PURE__ */ jsxs(DialogHeader, { children: [hasTitle ? /* @__PURE__ */ jsx(DialogTitle, {
|
|
820
|
+
icon,
|
|
821
|
+
children: title
|
|
822
|
+
}) : /* @__PURE__ */ jsx("span", { className: "flex-1" }), dismissible ? /* @__PURE__ */ jsx(DialogCloseButton, { "aria-label": closeLabel }) : null] }) : null,
|
|
823
|
+
description !== void 0 ? /* @__PURE__ */ jsx(DialogDescription, { children: description }) : null,
|
|
824
|
+
children !== void 0 ? /* @__PURE__ */ jsx(DialogBody, { children }) : null,
|
|
825
|
+
actions !== void 0 ? /* @__PURE__ */ jsx(DialogFooter, { children: actions }) : null
|
|
826
|
+
]
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
var Dialog = Object.assign(DialogRoot, {
|
|
830
|
+
Container: DialogContainer,
|
|
831
|
+
Header: DialogHeader,
|
|
832
|
+
Title: DialogTitle,
|
|
833
|
+
Description: DialogDescription,
|
|
834
|
+
Body: DialogBody,
|
|
835
|
+
Footer: DialogFooter,
|
|
836
|
+
CloseButton: DialogCloseButton
|
|
837
|
+
});
|
|
838
|
+
//#endregion
|
|
63
839
|
//#region src/Field.tsx
|
|
64
840
|
function FieldRoot({ className, ...rest }) {
|
|
65
841
|
return /* @__PURE__ */ jsx(Field$1.Root, {
|
|
66
|
-
className:
|
|
842
|
+
className: cn("field", className),
|
|
67
843
|
...rest
|
|
68
844
|
});
|
|
69
845
|
}
|
|
70
|
-
function FieldLabel({ className, ...rest }) {
|
|
846
|
+
function FieldLabel({ className, required, ...rest }) {
|
|
71
847
|
return /* @__PURE__ */ jsx(Field$1.Label, {
|
|
72
|
-
|
|
848
|
+
"data-required": required ? "" : void 0,
|
|
849
|
+
className: cn("field-label", className),
|
|
73
850
|
...rest
|
|
74
851
|
});
|
|
75
852
|
}
|
|
76
853
|
function FieldDescription({ className, ...rest }) {
|
|
77
854
|
return /* @__PURE__ */ jsx(Field$1.Description, {
|
|
78
|
-
className:
|
|
855
|
+
className: cn("field-description", className),
|
|
79
856
|
...rest
|
|
80
857
|
});
|
|
81
858
|
}
|
|
82
859
|
function FieldError({ className, ...rest }) {
|
|
83
860
|
return /* @__PURE__ */ jsx(Field$1.Error, {
|
|
84
|
-
className:
|
|
861
|
+
className: cn("field-error", className),
|
|
85
862
|
...rest
|
|
86
863
|
});
|
|
87
864
|
}
|
|
@@ -91,6 +868,431 @@ var Field = Object.assign(FieldRoot, {
|
|
|
91
868
|
Error: FieldError
|
|
92
869
|
});
|
|
93
870
|
//#endregion
|
|
94
|
-
|
|
871
|
+
//#region src/Footer.tsx
|
|
872
|
+
function FooterRoot({ className, ...rest }) {
|
|
873
|
+
return /* @__PURE__ */ jsx("footer", {
|
|
874
|
+
className: clsx("footer", className),
|
|
875
|
+
...rest
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
function FooterLinks({ className, ...rest }) {
|
|
879
|
+
return /* @__PURE__ */ jsx("div", {
|
|
880
|
+
className: clsx("footer-links", className),
|
|
881
|
+
...rest
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
function FooterLink({ className, children, ...rest }) {
|
|
885
|
+
return /* @__PURE__ */ jsx("a", {
|
|
886
|
+
className: clsx("footer-link", className),
|
|
887
|
+
...rest,
|
|
888
|
+
children
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
function FooterMeta({ className, ...rest }) {
|
|
892
|
+
return /* @__PURE__ */ jsx("div", {
|
|
893
|
+
className: clsx("footer-meta", className),
|
|
894
|
+
...rest
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
var Footer = Object.assign(FooterRoot, {
|
|
898
|
+
Links: FooterLinks,
|
|
899
|
+
Link: FooterLink,
|
|
900
|
+
Meta: FooterMeta
|
|
901
|
+
});
|
|
902
|
+
//#endregion
|
|
903
|
+
//#region src/Menu.tsx
|
|
904
|
+
function MenuRoot({ className, ...rest }) {
|
|
905
|
+
return /* @__PURE__ */ jsx("details", {
|
|
906
|
+
className: clsx("menu", className),
|
|
907
|
+
...rest
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
function MenuTrigger({ className, ...rest }) {
|
|
911
|
+
return /* @__PURE__ */ jsx("summary", {
|
|
912
|
+
className: clsx("menu-trigger", className),
|
|
913
|
+
...rest
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
function MenuPopup({ className, role = "menu", ...rest }) {
|
|
917
|
+
return /* @__PURE__ */ jsx("div", {
|
|
918
|
+
role,
|
|
919
|
+
className: clsx("menu-popup", className),
|
|
920
|
+
...rest
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
function MenuItem(props) {
|
|
924
|
+
if (props.href !== void 0) {
|
|
925
|
+
const { className, role = "menuitem", icon, children, ...rest } = props;
|
|
926
|
+
return /* @__PURE__ */ jsxs("a", {
|
|
927
|
+
role,
|
|
928
|
+
className: clsx("menu-item", className),
|
|
929
|
+
...rest,
|
|
930
|
+
children: [renderIcon(icon), children]
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
const { className, type = "button", role = "menuitem", icon, children, ...rest } = props;
|
|
934
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
935
|
+
type,
|
|
936
|
+
role,
|
|
937
|
+
className: clsx("menu-item", className),
|
|
938
|
+
...rest,
|
|
939
|
+
children: [renderIcon(icon), children]
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
function MenuSeparator({ className, ...rest }) {
|
|
943
|
+
return /* @__PURE__ */ jsx("hr", {
|
|
944
|
+
className: clsx("menu-separator", className),
|
|
945
|
+
...rest
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
function MenuGroup({ className, role = "group", ...rest }) {
|
|
949
|
+
return /* @__PURE__ */ jsx("div", {
|
|
950
|
+
role,
|
|
951
|
+
className: clsx("menu-group", className),
|
|
952
|
+
...rest
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
function MenuGroupLabel({ className, ...rest }) {
|
|
956
|
+
return /* @__PURE__ */ jsx("div", {
|
|
957
|
+
className: clsx("menu-group-label", className),
|
|
958
|
+
...rest
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
var Menu = Object.assign(MenuRoot, {
|
|
962
|
+
Trigger: MenuTrigger,
|
|
963
|
+
Popup: MenuPopup,
|
|
964
|
+
Item: MenuItem,
|
|
965
|
+
Separator: MenuSeparator,
|
|
966
|
+
Group: MenuGroup,
|
|
967
|
+
GroupLabel: MenuGroupLabel
|
|
968
|
+
});
|
|
969
|
+
//#endregion
|
|
970
|
+
//#region src/Navbar.tsx
|
|
971
|
+
function NavbarRoot({ className, ...rest }) {
|
|
972
|
+
return /* @__PURE__ */ jsx("header", {
|
|
973
|
+
className: clsx("navbar", className),
|
|
974
|
+
...rest
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
function NavbarBrand({ className, ...rest }) {
|
|
978
|
+
return /* @__PURE__ */ jsx("div", {
|
|
979
|
+
className: clsx("navbar-brand", className),
|
|
980
|
+
...rest
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
function NavbarItems({ className, ...rest }) {
|
|
984
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
985
|
+
className: clsx("navbar-items", className),
|
|
986
|
+
...rest
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
function NavbarItem({ active, icon, className, children, ...rest }) {
|
|
990
|
+
return /* @__PURE__ */ jsxs("a", {
|
|
991
|
+
className: clsx("navbar-item", className),
|
|
992
|
+
"aria-current": active ? "page" : void 0,
|
|
993
|
+
...rest,
|
|
994
|
+
children: [renderIcon(icon), children]
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
function NavbarDropdown({ label, className, children, ...rest }) {
|
|
998
|
+
return /* @__PURE__ */ jsxs(Menu, {
|
|
999
|
+
className,
|
|
1000
|
+
...rest,
|
|
1001
|
+
children: [/* @__PURE__ */ jsx(Menu.Trigger, {
|
|
1002
|
+
className: "navbar-item",
|
|
1003
|
+
children: label
|
|
1004
|
+
}), /* @__PURE__ */ jsx(Menu.Popup, { children })]
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
function NavbarActions({ className, ...rest }) {
|
|
1008
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1009
|
+
className: clsx("navbar-actions", className),
|
|
1010
|
+
...rest
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
function NavbarMobileToggle({ label = "Open menu", className, type = "button", ...rest }) {
|
|
1014
|
+
const shell = useAppShell();
|
|
1015
|
+
const open = shell?.mobileDrawerOpen ?? false;
|
|
1016
|
+
return /* @__PURE__ */ jsx("button", {
|
|
1017
|
+
type,
|
|
1018
|
+
"aria-label": label,
|
|
1019
|
+
"aria-expanded": open,
|
|
1020
|
+
onClick: () => shell?.setMobileDrawerOpen(!open),
|
|
1021
|
+
className: clsx("navbar-mobile-toggle", className),
|
|
1022
|
+
...rest
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
var Navbar = Object.assign(NavbarRoot, {
|
|
1026
|
+
Brand: NavbarBrand,
|
|
1027
|
+
Items: NavbarItems,
|
|
1028
|
+
Item: NavbarItem,
|
|
1029
|
+
Dropdown: NavbarDropdown,
|
|
1030
|
+
Actions: NavbarActions,
|
|
1031
|
+
MobileToggle: NavbarMobileToggle
|
|
1032
|
+
});
|
|
1033
|
+
//#endregion
|
|
1034
|
+
//#region src/Tabs.tsx
|
|
1035
|
+
function TabsRoot({ variant = "bordered", size = "md", fullWidth = false, className, ...rest }) {
|
|
1036
|
+
return /* @__PURE__ */ jsx(Tabs$1.Root, {
|
|
1037
|
+
className: cn([
|
|
1038
|
+
"tabs",
|
|
1039
|
+
`tabs-${variant}`,
|
|
1040
|
+
size !== "md" && `tabs-${size}`,
|
|
1041
|
+
fullWidth && "tabs-full-width"
|
|
1042
|
+
], className),
|
|
1043
|
+
...rest
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
function TabsList({ className, ...rest }) {
|
|
1047
|
+
return /* @__PURE__ */ jsx(Tabs$1.List, {
|
|
1048
|
+
className: cn("tab-list", className),
|
|
1049
|
+
...rest
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
function TabsTab({ className, ...rest }) {
|
|
1053
|
+
return /* @__PURE__ */ jsx(Tabs$1.Tab, {
|
|
1054
|
+
className: cn("tab", className),
|
|
1055
|
+
...rest
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
function TabsPanel({ className, ...rest }) {
|
|
1059
|
+
return /* @__PURE__ */ jsx(Tabs$1.Panel, {
|
|
1060
|
+
className: cn("tab-panel", className),
|
|
1061
|
+
...rest
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
function TabsIndicator({ className, ...rest }) {
|
|
1065
|
+
return /* @__PURE__ */ jsx(Tabs$1.Indicator, {
|
|
1066
|
+
className: cn("tab-indicator", className),
|
|
1067
|
+
...rest
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
var Tabs = Object.assign(TabsRoot, {
|
|
1071
|
+
List: TabsList,
|
|
1072
|
+
Tab: TabsTab,
|
|
1073
|
+
Panel: TabsPanel,
|
|
1074
|
+
Indicator: TabsIndicator
|
|
1075
|
+
});
|
|
1076
|
+
//#endregion
|
|
1077
|
+
//#region src/Table.tsx
|
|
1078
|
+
function TableRoot({ striped, bordered, relaxed, sticky, className, ...rest }) {
|
|
1079
|
+
return /* @__PURE__ */ jsx("table", {
|
|
1080
|
+
className: clsx("table", striped && "table-striped", bordered && "table-bordered", relaxed && "table-relaxed", sticky && "table-sticky", className),
|
|
1081
|
+
...rest
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
function TableHead({ className, ...rest }) {
|
|
1085
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
1086
|
+
className: clsx(className),
|
|
1087
|
+
...rest
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
function TableBody({ className, ...rest }) {
|
|
1091
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
1092
|
+
className: clsx(className),
|
|
1093
|
+
...rest
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
function TableFoot({ className, ...rest }) {
|
|
1097
|
+
return /* @__PURE__ */ jsx("tfoot", {
|
|
1098
|
+
className: clsx(className),
|
|
1099
|
+
...rest
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
function TableRow({ selected, asLink, className, ...rest }) {
|
|
1103
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
1104
|
+
className: clsx(asLink && "table-row-link", className),
|
|
1105
|
+
"data-selected": selected || void 0,
|
|
1106
|
+
...rest
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
function TableHeaderCell({ align, gutter, className, scope, ...rest }) {
|
|
1110
|
+
return /* @__PURE__ */ jsx("th", {
|
|
1111
|
+
className: clsx("table-header-cell", gutter && "table-cell-gutter", className),
|
|
1112
|
+
"data-align": align && align !== "left" ? align : void 0,
|
|
1113
|
+
scope: scope ?? "col",
|
|
1114
|
+
...rest
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
function TableCell({ align, gutter, numeric, className, ...rest }) {
|
|
1118
|
+
return /* @__PURE__ */ jsx("td", {
|
|
1119
|
+
className: clsx("table-cell", gutter && "table-cell-gutter", numeric && "table-cell-numeric", className),
|
|
1120
|
+
"data-align": align && align !== "left" ? align : void 0,
|
|
1121
|
+
...rest
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
var Table = Object.assign(TableRoot, {
|
|
1125
|
+
Head: TableHead,
|
|
1126
|
+
Body: TableBody,
|
|
1127
|
+
Foot: TableFoot,
|
|
1128
|
+
Row: TableRow,
|
|
1129
|
+
HeaderCell: TableHeaderCell,
|
|
1130
|
+
Cell: TableCell
|
|
1131
|
+
});
|
|
1132
|
+
//#endregion
|
|
1133
|
+
//#region src/Sidebar.tsx
|
|
1134
|
+
var SidebarContext = createContext(null);
|
|
1135
|
+
function SidebarRoot({ collapsed, defaultCollapsed, onCollapsedChange, drawerLabel = "Navigation", className, children, ...rest }) {
|
|
1136
|
+
const shell = useAppShell();
|
|
1137
|
+
const drawerOpen = shell?.mobileDrawerOpen ?? false;
|
|
1138
|
+
return /* @__PURE__ */ jsxs(SidebarContext.Provider, {
|
|
1139
|
+
value: {
|
|
1140
|
+
collapsed,
|
|
1141
|
+
defaultCollapsed,
|
|
1142
|
+
onCollapsedChange
|
|
1143
|
+
},
|
|
1144
|
+
children: [/* @__PURE__ */ jsx("aside", {
|
|
1145
|
+
className: clsx("sidebar", className),
|
|
1146
|
+
...rest,
|
|
1147
|
+
children: drawerOpen ? null : children
|
|
1148
|
+
}), shell ? /* @__PURE__ */ jsx(Dialog$1.Root, {
|
|
1149
|
+
open: drawerOpen,
|
|
1150
|
+
onOpenChange: (open) => shell.setMobileDrawerOpen(open),
|
|
1151
|
+
children: /* @__PURE__ */ jsxs(Dialog$1.Portal, { children: [/* @__PURE__ */ jsx(Dialog$1.Backdrop, { className: "sidebar-drawer-backdrop" }), /* @__PURE__ */ jsx(Dialog$1.Popup, {
|
|
1152
|
+
className: "sidebar-drawer",
|
|
1153
|
+
"aria-label": drawerLabel,
|
|
1154
|
+
onClick: (event) => {
|
|
1155
|
+
if (event.target.closest("a, [data-drawer-close]")) shell.setMobileDrawerOpen(false);
|
|
1156
|
+
},
|
|
1157
|
+
children
|
|
1158
|
+
})] })
|
|
1159
|
+
}) : null]
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
function SidebarHeader({ className, ...rest }) {
|
|
1163
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1164
|
+
className: clsx("sidebar-header", className),
|
|
1165
|
+
...rest
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
function SidebarNav({ className, ...rest }) {
|
|
1169
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
1170
|
+
className: clsx("sidebar-nav", className),
|
|
1171
|
+
...rest
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
function SidebarGroup({ className, ...rest }) {
|
|
1175
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1176
|
+
className: clsx("sidebar-group", className),
|
|
1177
|
+
...rest
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
function SidebarGroupLabel({ className, ...rest }) {
|
|
1181
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1182
|
+
className: clsx("sidebar-group-label", className),
|
|
1183
|
+
...rest
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1186
|
+
function SidebarItem({ active, icon, badge, className, children, ...rest }) {
|
|
1187
|
+
return /* @__PURE__ */ jsxs("a", {
|
|
1188
|
+
className: clsx("sidebar-item", className),
|
|
1189
|
+
"aria-current": active ? "page" : void 0,
|
|
1190
|
+
...rest,
|
|
1191
|
+
children: [
|
|
1192
|
+
icon != null ? /* @__PURE__ */ jsx(SidebarIcon, { children: renderIcon(icon) }) : null,
|
|
1193
|
+
children !== void 0 ? /* @__PURE__ */ jsx(SidebarLabel, { children }) : null,
|
|
1194
|
+
badge !== void 0 ? /* @__PURE__ */ jsx(SidebarBadge, { children: badge }) : null
|
|
1195
|
+
]
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
function SidebarIcon({ className, ...rest }) {
|
|
1199
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1200
|
+
"aria-hidden": true,
|
|
1201
|
+
className: clsx("sidebar-icon", className),
|
|
1202
|
+
...rest
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
function SidebarLabel({ className, ...rest }) {
|
|
1206
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1207
|
+
className: clsx("sidebar-label", className),
|
|
1208
|
+
...rest
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
function SidebarBadge({ className, ...rest }) {
|
|
1212
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1213
|
+
className: clsx("sidebar-badge", className),
|
|
1214
|
+
...rest
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
function SidebarCollapsible({ icon, label, trigger, children, className, open, defaultOpen, onOpenChange, ...rest }) {
|
|
1218
|
+
const isControlled = open !== void 0;
|
|
1219
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen ?? false);
|
|
1220
|
+
const isOpen = isControlled ? open : internalOpen;
|
|
1221
|
+
const triggerContent = trigger ?? /* @__PURE__ */ jsxs(Fragment, { children: [icon != null ? /* @__PURE__ */ jsx(SidebarIcon, { children: renderIcon(icon) }) : null, label !== void 0 ? /* @__PURE__ */ jsx(SidebarLabel, { children: label }) : null] });
|
|
1222
|
+
return /* @__PURE__ */ jsxs("details", {
|
|
1223
|
+
className: clsx("sidebar-collapsible", className),
|
|
1224
|
+
open: isOpen,
|
|
1225
|
+
onToggle: (event) => {
|
|
1226
|
+
const next = event.currentTarget.open;
|
|
1227
|
+
if (!isControlled) setInternalOpen(next);
|
|
1228
|
+
onOpenChange?.(next);
|
|
1229
|
+
},
|
|
1230
|
+
...rest,
|
|
1231
|
+
children: [/* @__PURE__ */ jsx("summary", {
|
|
1232
|
+
className: "sidebar-collapsible-trigger",
|
|
1233
|
+
children: triggerContent
|
|
1234
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1235
|
+
className: "sidebar-collapsible-panel",
|
|
1236
|
+
children
|
|
1237
|
+
})]
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
function SidebarSubItem({ active, icon, badge, className, children, ...rest }) {
|
|
1241
|
+
return /* @__PURE__ */ jsxs("a", {
|
|
1242
|
+
className: clsx("sidebar-subitem", className),
|
|
1243
|
+
"aria-current": active ? "page" : void 0,
|
|
1244
|
+
...rest,
|
|
1245
|
+
children: [
|
|
1246
|
+
icon != null ? /* @__PURE__ */ jsx(SidebarIcon, { children: renderIcon(icon) }) : null,
|
|
1247
|
+
children,
|
|
1248
|
+
badge !== void 0 ? /* @__PURE__ */ jsx(SidebarBadge, { children: badge }) : null
|
|
1249
|
+
]
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
function SidebarFooter({ className, ...rest }) {
|
|
1253
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1254
|
+
className: clsx("sidebar-footer", className),
|
|
1255
|
+
...rest
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
function SidebarCollapseToggle({ label = "Toggle sidebar", className, children, ...rest }) {
|
|
1259
|
+
const ctx = useContext(SidebarContext);
|
|
1260
|
+
const controlledChecked = ctx?.collapsed;
|
|
1261
|
+
const isControlled = controlledChecked !== void 0;
|
|
1262
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
1263
|
+
className: clsx("sidebar-collapse-toggle", className),
|
|
1264
|
+
...rest,
|
|
1265
|
+
children: [
|
|
1266
|
+
/* @__PURE__ */ jsx("input", {
|
|
1267
|
+
type: "checkbox",
|
|
1268
|
+
className: "sidebar-toggle",
|
|
1269
|
+
"aria-label": label,
|
|
1270
|
+
...isControlled ? { checked: controlledChecked } : { defaultChecked: ctx?.defaultCollapsed },
|
|
1271
|
+
onChange: (event) => ctx?.onCollapsedChange?.(event.currentTarget.checked)
|
|
1272
|
+
}),
|
|
1273
|
+
/* @__PURE__ */ jsx("span", {
|
|
1274
|
+
className: "sr-only",
|
|
1275
|
+
children: label
|
|
1276
|
+
}),
|
|
1277
|
+
children
|
|
1278
|
+
]
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
var Sidebar = Object.assign(SidebarRoot, {
|
|
1282
|
+
Header: SidebarHeader,
|
|
1283
|
+
Nav: SidebarNav,
|
|
1284
|
+
Group: SidebarGroup,
|
|
1285
|
+
GroupLabel: SidebarGroupLabel,
|
|
1286
|
+
Item: SidebarItem,
|
|
1287
|
+
Icon: SidebarIcon,
|
|
1288
|
+
Label: SidebarLabel,
|
|
1289
|
+
Badge: SidebarBadge,
|
|
1290
|
+
Collapsible: SidebarCollapsible,
|
|
1291
|
+
SubItem: SidebarSubItem,
|
|
1292
|
+
Footer: SidebarFooter,
|
|
1293
|
+
CollapseToggle: SidebarCollapseToggle
|
|
1294
|
+
});
|
|
1295
|
+
//#endregion
|
|
1296
|
+
export { Accordion, AdminRoot, Alert, AppShell, Badge, BrandTile, Breadcrumbs, Button, ButtonGroup, Card, Checkbox, Dialog, Field, FileInput, Footer, Input, InputGroup, Menu, Navbar, Pagination, Progress, Radio, RadioGroup, Select, Sidebar, Spinner, Switch, Table, Tabs, Textarea, getPaginationItems, useAppShell };
|
|
95
1297
|
|
|
96
1298
|
//# sourceMappingURL=index.mjs.map
|