@nebutra/ui 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -676
- package/README.md +81 -86
- package/dist/agent/index.d.ts +119 -0
- package/dist/agent/index.js +135 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/canonical-CrO71UPO.d.ts +4058 -0
- package/dist/components/index.d.ts +51 -56
- package/dist/components/index.js +1467 -1160
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.d.ts +62 -15
- package/dist/hooks/index.js +56 -34
- package/dist/hooks/index.js.map +1 -1
- package/dist/index-CKLIGfiU.d.ts +19 -0
- package/dist/index-Dg4jRJV2.d.ts +57 -0
- package/dist/layout/index.d.ts +5 -1
- package/dist/layout/index.js +427 -533
- package/dist/layout/index.js.map +1 -1
- package/dist/layouts/index.js +11 -9
- package/dist/layouts/index.js.map +1 -1
- package/dist/patterns/index.d.ts +128 -2
- package/dist/patterns/index.js +1478 -786
- package/dist/patterns/index.js.map +1 -1
- package/dist/primitives/canonical.d.ts +25 -0
- package/dist/primitives/canonical.js +11903 -0
- package/dist/primitives/canonical.js.map +1 -0
- package/dist/primitives/index.d.ts +577 -3545
- package/dist/primitives/index.js +8002 -6159
- package/dist/primitives/index.js.map +1 -1
- package/dist/shared/animation/css/index.d.ts +1 -0
- package/dist/shared/animation/css/index.js +14 -0
- package/dist/shared/animation/css/index.js.map +1 -0
- package/dist/shared/animation/index.d.ts +6 -0
- package/dist/shared/animation/index.js +272 -0
- package/dist/shared/animation/index.js.map +1 -0
- package/dist/shared/animation/motion/index.d.ts +4 -0
- package/dist/shared/animation/motion/index.js +205 -0
- package/dist/shared/animation/motion/index.js.map +1 -0
- package/dist/styles/brand-override.css +11 -11
- package/dist/tailwind.preset.d.ts +10 -10
- package/dist/tailwind.preset.js +7 -4
- package/dist/tailwind.preset.js.map +1 -1
- package/dist/theme/index.d.ts +2 -2
- package/dist/tokens-EAC6uPem.d.ts +302 -0
- package/dist/typography/fonts.css +31 -12
- package/dist/typography/index.d.ts +27 -27
- package/dist/typography/index.js +24 -4
- package/dist/typography/index.js.map +1 -1
- package/dist/utils/index.d.ts +36 -14
- package/dist/utils/index.js +44 -10
- package/dist/utils/index.js.map +1 -1
- package/package.json +38 -12
- package/src/styles/brand-override.css +61 -0
- package/src/styles/preset.css +29 -0
- package/src/styles/sources.css +27 -0
- package/src/typography/fonts.css +129 -0
package/dist/layout/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Cross, Warning
|
|
3
|
-
import * as
|
|
2
|
+
import { Menu, Cross, Warning } from '@nebutra/icons';
|
|
3
|
+
import * as React4 from 'react';
|
|
4
4
|
import { createContext, useState, useEffect, useMemo, useCallback } from 'react';
|
|
5
5
|
import { Dialog } from '@base-ui/react/dialog';
|
|
6
6
|
import { cva } from 'class-variance-authority';
|
|
@@ -95,13 +95,34 @@ var primitiveFontWeight = {
|
|
|
95
95
|
semibold: 600};
|
|
96
96
|
var primitiveTransition = {
|
|
97
97
|
duration: {
|
|
98
|
-
//
|
|
99
|
-
|
|
98
|
+
// hover, focus, small state changes
|
|
99
|
+
flow: 200},
|
|
100
100
|
easing: {
|
|
101
|
-
|
|
102
|
-
}
|
|
101
|
+
default: "ease-out"}
|
|
103
102
|
};
|
|
104
103
|
|
|
104
|
+
// src/tokens/components/overlay.ts
|
|
105
|
+
var overlayFocusRingClassName = "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";
|
|
106
|
+
var overlayZIndex = {
|
|
107
|
+
backdrop: 1040,
|
|
108
|
+
modal: 1050};
|
|
109
|
+
var overlayTokens = {
|
|
110
|
+
motion: {
|
|
111
|
+
duration: primitiveTransition.duration.flow,
|
|
112
|
+
easing: primitiveTransition.easing.default}};
|
|
113
|
+
var overlayClassNames = {
|
|
114
|
+
focusRing: overlayFocusRingClassName,
|
|
115
|
+
sheetBackdrop: [
|
|
116
|
+
"fixed inset-0 bg-[var(--sheet-overlay-background)] backdrop-blur-[var(--sheet-overlay-blur)]",
|
|
117
|
+
"transition-[opacity,backdrop-filter,display] duration-[var(--motion-duration-flow)] ease-[var(--ease-out)]",
|
|
118
|
+
"data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none"
|
|
119
|
+
].join(" "),
|
|
120
|
+
sheetSurface: [
|
|
121
|
+
"fixed flex flex-col overflow-hidden border border-border bg-[var(--sheet-background)] text-foreground shadow-[var(--sheet-shadow)]",
|
|
122
|
+
"outline-none transition-[opacity,transform,display] duration-[var(--motion-duration-flow)] ease-[var(--ease-out)]",
|
|
123
|
+
"data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none"
|
|
124
|
+
].join(" ")};
|
|
125
|
+
|
|
105
126
|
// src/tokens/components/sheet.ts
|
|
106
127
|
var sheetTokens = {
|
|
107
128
|
inset: primitiveSpacing[3],
|
|
@@ -129,12 +150,7 @@ var sheetTokens = {
|
|
|
129
150
|
surface: {
|
|
130
151
|
background: "hsl(var(--popover))",
|
|
131
152
|
shadow: "var(--elevation-xl)"
|
|
132
|
-
}
|
|
133
|
-
motion: {
|
|
134
|
-
duration: primitiveTransition.duration.reveal,
|
|
135
|
-
easing: primitiveTransition.easing.inOut
|
|
136
|
-
}
|
|
137
|
-
};
|
|
153
|
+
}};
|
|
138
154
|
function cn(...inputs) {
|
|
139
155
|
return twMerge(clsx(inputs));
|
|
140
156
|
}
|
|
@@ -158,8 +174,8 @@ function getSheetStyle(style) {
|
|
|
158
174
|
"--sheet-overlay-blur": sheetTokens.overlay.blur,
|
|
159
175
|
"--sheet-background": sheetTokens.surface.background,
|
|
160
176
|
"--sheet-shadow": sheetTokens.surface.shadow,
|
|
161
|
-
"--sheet-duration": `${
|
|
162
|
-
"--sheet-easing":
|
|
177
|
+
"--sheet-duration": `${overlayTokens.motion.duration}ms`,
|
|
178
|
+
"--sheet-easing": overlayTokens.motion.easing,
|
|
163
179
|
...style
|
|
164
180
|
};
|
|
165
181
|
}
|
|
@@ -175,199 +191,107 @@ function Sheet({ modal = "trap-focus", disablePointerDismissal = true, ...props
|
|
|
175
191
|
);
|
|
176
192
|
}
|
|
177
193
|
Sheet.displayName = "Sheet";
|
|
178
|
-
var
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
);
|
|
194
|
-
SheetTrigger.displayName = "SheetTrigger";
|
|
195
|
-
var SheetClose = React.forwardRef(
|
|
196
|
-
({ asChild, children, ...props }, ref) => {
|
|
197
|
-
if (asChild && React.isValidElement(children)) {
|
|
198
|
-
return /* @__PURE__ */ jsx(
|
|
199
|
-
Dialog.Close,
|
|
200
|
-
{
|
|
201
|
-
ref,
|
|
202
|
-
"data-slot": "sheet-close",
|
|
203
|
-
...props,
|
|
204
|
-
render: children
|
|
205
|
-
}
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
return /* @__PURE__ */ jsx(Dialog.Close, { ref, "data-slot": "sheet-close", ...props, children });
|
|
194
|
+
var SheetClose = ({
|
|
195
|
+
asChild,
|
|
196
|
+
children,
|
|
197
|
+
ref,
|
|
198
|
+
...props
|
|
199
|
+
}) => {
|
|
200
|
+
if (asChild && React4.isValidElement(children)) {
|
|
201
|
+
return /* @__PURE__ */ jsx(
|
|
202
|
+
Dialog.Close,
|
|
203
|
+
{
|
|
204
|
+
ref,
|
|
205
|
+
"data-slot": "sheet-close",
|
|
206
|
+
...props,
|
|
207
|
+
render: children
|
|
208
|
+
}
|
|
209
|
+
);
|
|
209
210
|
}
|
|
210
|
-
);
|
|
211
|
+
return /* @__PURE__ */ jsx(Dialog.Close, { ref, "data-slot": "sheet-close", ...props, children });
|
|
212
|
+
};
|
|
211
213
|
SheetClose.displayName = "SheetClose";
|
|
212
214
|
function SheetPortal(props) {
|
|
213
215
|
return /* @__PURE__ */ jsx(Dialog.Portal, { "data-slot": "sheet-portal", ...props });
|
|
214
216
|
}
|
|
215
217
|
SheetPortal.displayName = "SheetPortal";
|
|
216
|
-
var SheetOverlay =
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
"fixed inset-0 z-50 bg-[var(--sheet-overlay-background)] backdrop-blur-[var(--sheet-overlay-blur)]",
|
|
224
|
-
"transition-[opacity,backdrop-filter,display] duration-[var(--sheet-duration)] ease-[var(--sheet-easing)]",
|
|
225
|
-
"data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none",
|
|
226
|
-
className
|
|
227
|
-
),
|
|
228
|
-
style: getSheetStyle(style),
|
|
229
|
-
...props
|
|
230
|
-
}
|
|
231
|
-
)
|
|
232
|
-
);
|
|
233
|
-
SheetOverlay.displayName = "SheetOverlay";
|
|
234
|
-
var sheetVariants = cva(
|
|
235
|
-
[
|
|
236
|
-
"fixed z-50 flex flex-col overflow-hidden border border-border bg-[var(--sheet-background)] text-foreground shadow-[var(--sheet-shadow)] outline-none",
|
|
237
|
-
"transition-[opacity,transform,display] duration-[var(--sheet-duration)] ease-[var(--sheet-easing)]",
|
|
238
|
-
"data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none"
|
|
239
|
-
].join(" "),
|
|
218
|
+
var SheetOverlay = ({
|
|
219
|
+
className,
|
|
220
|
+
style,
|
|
221
|
+
ref,
|
|
222
|
+
...props
|
|
223
|
+
}) => /* @__PURE__ */ jsx(
|
|
224
|
+
Dialog.Backdrop,
|
|
240
225
|
{
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
left: "inset-y-[var(--sheet-inset)] left-[var(--sheet-inset)] h-[calc(100dvh_-_var(--sheet-inset)_-_var(--sheet-inset))] w-[min(var(--sheet-side-width),calc(100vw_-_var(--sheet-inset)_-_var(--sheet-inset)))] rounded-[var(--sheet-radius)] data-ending-style:-translate-x-full data-starting-style:-translate-x-full",
|
|
246
|
-
right: "inset-y-[var(--sheet-inset)] right-[var(--sheet-inset)] h-[calc(100dvh_-_var(--sheet-inset)_-_var(--sheet-inset))] w-[min(var(--sheet-side-width),calc(100vw_-_var(--sheet-inset)_-_var(--sheet-inset)))] rounded-[var(--sheet-radius)] data-ending-style:translate-x-full data-starting-style:translate-x-full"
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
defaultVariants: {
|
|
250
|
-
side: "right"
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
);
|
|
254
|
-
var SheetContent = React.forwardRef(
|
|
255
|
-
({
|
|
256
|
-
side = "right",
|
|
257
|
-
className,
|
|
258
|
-
children,
|
|
259
|
-
overlay = true,
|
|
260
|
-
noOverlay = false,
|
|
261
|
-
showClose,
|
|
262
|
-
close,
|
|
263
|
-
style,
|
|
226
|
+
ref,
|
|
227
|
+
"data-slot": "sheet-overlay",
|
|
228
|
+
className: cn(overlayClassNames.sheetBackdrop, className),
|
|
229
|
+
style: { zIndex: overlayZIndex.backdrop, ...getSheetStyle(style) },
|
|
264
230
|
...props
|
|
265
|
-
}, ref) => {
|
|
266
|
-
const shouldRenderClose = close ?? showClose ?? true;
|
|
267
|
-
const shouldRenderOverlay = overlay && !noOverlay;
|
|
268
|
-
return /* @__PURE__ */ jsxs(SheetPortal, { children: [
|
|
269
|
-
shouldRenderOverlay ? /* @__PURE__ */ jsx(SheetOverlay, {}) : null,
|
|
270
|
-
/* @__PURE__ */ jsxs(
|
|
271
|
-
Dialog.Popup,
|
|
272
|
-
{
|
|
273
|
-
ref,
|
|
274
|
-
"data-slot": "sheet-content",
|
|
275
|
-
className: cn(sheetVariants({ side }), className),
|
|
276
|
-
style: getSheetStyle(style),
|
|
277
|
-
...props,
|
|
278
|
-
children: [
|
|
279
|
-
children,
|
|
280
|
-
shouldRenderClose ? /* @__PURE__ */ jsxs(
|
|
281
|
-
SheetClose,
|
|
282
|
-
{
|
|
283
|
-
"aria-label": "Close",
|
|
284
|
-
className: cn(
|
|
285
|
-
"absolute right-[var(--sheet-close-offset)] top-[var(--sheet-close-offset)] inline-flex size-[var(--sheet-close-size)] items-center justify-center rounded-[var(--sheet-close-radius)] text-muted-foreground",
|
|
286
|
-
"transition-[background-color,color,box-shadow] duration-[var(--sheet-duration)] ease-[var(--sheet-easing)] hover:bg-muted hover:text-foreground",
|
|
287
|
-
"focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none motion-reduce:transition-none"
|
|
288
|
-
),
|
|
289
|
-
children: [
|
|
290
|
-
/* @__PURE__ */ jsx(Cross, { "aria-hidden": "true", className: "size-[var(--sheet-close-icon-size)]" }),
|
|
291
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
292
|
-
]
|
|
293
|
-
}
|
|
294
|
-
) : null
|
|
295
|
-
]
|
|
296
|
-
}
|
|
297
|
-
)
|
|
298
|
-
] });
|
|
299
231
|
}
|
|
300
232
|
);
|
|
301
|
-
|
|
302
|
-
var
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
"grid gap-[var(--sheet-header-gap)] border-b border-border px-[var(--sheet-padding-x)] py-[var(--sheet-padding-y)] pr-[calc(var(--sheet-padding-x)_+_var(--sheet-close-size))] text-left",
|
|
310
|
-
className
|
|
311
|
-
),
|
|
312
|
-
...props
|
|
313
|
-
}
|
|
314
|
-
)
|
|
315
|
-
);
|
|
316
|
-
SheetHeader.displayName = "SheetHeader";
|
|
317
|
-
var SheetBody = React.forwardRef(
|
|
318
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
319
|
-
"div",
|
|
320
|
-
{
|
|
321
|
-
ref,
|
|
322
|
-
"data-slot": "sheet-body",
|
|
323
|
-
className: cn(
|
|
324
|
-
"min-h-0 flex-1 overflow-y-auto overscroll-contain px-[var(--sheet-padding-x)] py-[var(--sheet-body-padding-y)]",
|
|
325
|
-
className
|
|
326
|
-
),
|
|
327
|
-
...props
|
|
328
|
-
}
|
|
329
|
-
)
|
|
330
|
-
);
|
|
331
|
-
SheetBody.displayName = "SheetBody";
|
|
332
|
-
var SheetFooter = React.forwardRef(
|
|
333
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
334
|
-
"div",
|
|
335
|
-
{
|
|
336
|
-
ref,
|
|
337
|
-
"data-slot": "sheet-footer",
|
|
338
|
-
className: cn(
|
|
339
|
-
"mt-auto flex flex-col-reverse gap-[var(--sheet-footer-gap)] border-t border-border px-[var(--sheet-padding-x)] py-[var(--sheet-padding-y)] sm:flex-row sm:justify-end",
|
|
340
|
-
className
|
|
341
|
-
),
|
|
342
|
-
...props
|
|
343
|
-
}
|
|
344
|
-
)
|
|
345
|
-
);
|
|
346
|
-
SheetFooter.displayName = "SheetFooter";
|
|
347
|
-
var SheetTitle = React.forwardRef(
|
|
348
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
349
|
-
Dialog.Title,
|
|
350
|
-
{
|
|
351
|
-
ref,
|
|
352
|
-
"data-slot": "sheet-title",
|
|
353
|
-
className: cn("font-semibold text-base leading-6 text-foreground", className),
|
|
354
|
-
...props
|
|
355
|
-
}
|
|
356
|
-
)
|
|
357
|
-
);
|
|
358
|
-
SheetTitle.displayName = "SheetTitle";
|
|
359
|
-
var SheetDescription = React.forwardRef(
|
|
360
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
361
|
-
Dialog.Description,
|
|
362
|
-
{
|
|
363
|
-
ref,
|
|
364
|
-
"data-slot": "sheet-description",
|
|
365
|
-
className: cn("text-muted-foreground text-sm leading-5", className),
|
|
366
|
-
...props
|
|
233
|
+
SheetOverlay.displayName = "SheetOverlay";
|
|
234
|
+
var sheetVariants = cva(overlayClassNames.sheetSurface, {
|
|
235
|
+
variants: {
|
|
236
|
+
side: {
|
|
237
|
+
top: "inset-x-[var(--sheet-inset)] top-[var(--sheet-inset)] max-h-[min(var(--sheet-edge-height),calc(100dvh_-_var(--sheet-inset)_-_var(--sheet-inset)))] rounded-[var(--sheet-radius)] data-ending-style:-translate-y-full data-starting-style:-translate-y-full",
|
|
238
|
+
bottom: "inset-x-[var(--sheet-inset)] bottom-[var(--sheet-inset)] max-h-[min(var(--sheet-edge-height),calc(100dvh_-_var(--sheet-inset)_-_var(--sheet-inset)))] rounded-[var(--sheet-radius)] data-ending-style:translate-y-full data-starting-style:translate-y-full",
|
|
239
|
+
left: "inset-y-[var(--sheet-inset)] left-[var(--sheet-inset)] h-[calc(100dvh_-_var(--sheet-inset)_-_var(--sheet-inset))] w-[min(var(--sheet-side-width),calc(100vw_-_var(--sheet-inset)_-_var(--sheet-inset)))] rounded-[var(--sheet-radius)] data-ending-style:-translate-x-full data-starting-style:-translate-x-full",
|
|
240
|
+
right: "inset-y-[var(--sheet-inset)] right-[var(--sheet-inset)] h-[calc(100dvh_-_var(--sheet-inset)_-_var(--sheet-inset))] w-[min(var(--sheet-side-width),calc(100vw_-_var(--sheet-inset)_-_var(--sheet-inset)))] rounded-[var(--sheet-radius)] data-ending-style:translate-x-full data-starting-style:translate-x-full"
|
|
367
241
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
242
|
+
},
|
|
243
|
+
defaultVariants: {
|
|
244
|
+
side: "right"
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
var SheetContent = ({
|
|
248
|
+
side = "right",
|
|
249
|
+
className,
|
|
250
|
+
children,
|
|
251
|
+
overlay = true,
|
|
252
|
+
noOverlay = false,
|
|
253
|
+
showClose,
|
|
254
|
+
close,
|
|
255
|
+
style,
|
|
256
|
+
ref,
|
|
257
|
+
...props
|
|
258
|
+
}) => {
|
|
259
|
+
const shouldRenderClose = close ?? showClose ?? true;
|
|
260
|
+
const shouldRenderOverlay = overlay && !noOverlay;
|
|
261
|
+
return /* @__PURE__ */ jsxs(SheetPortal, { children: [
|
|
262
|
+
shouldRenderOverlay ? /* @__PURE__ */ jsx(SheetOverlay, {}) : null,
|
|
263
|
+
/* @__PURE__ */ jsxs(
|
|
264
|
+
Dialog.Popup,
|
|
265
|
+
{
|
|
266
|
+
ref,
|
|
267
|
+
"data-slot": "sheet-content",
|
|
268
|
+
className: cn(sheetVariants({ side }), className),
|
|
269
|
+
style: { zIndex: overlayZIndex.modal, ...getSheetStyle(style) },
|
|
270
|
+
...props,
|
|
271
|
+
children: [
|
|
272
|
+
children,
|
|
273
|
+
shouldRenderClose ? /* @__PURE__ */ jsxs(
|
|
274
|
+
SheetClose,
|
|
275
|
+
{
|
|
276
|
+
"aria-label": "Close",
|
|
277
|
+
className: cn(
|
|
278
|
+
"absolute right-[var(--sheet-close-offset)] top-[var(--sheet-close-offset)] inline-flex size-[var(--sheet-close-size)] items-center justify-center rounded-[var(--sheet-close-radius)] text-muted-foreground",
|
|
279
|
+
"transition-[background-color,color,box-shadow] duration-[var(--motion-duration-micro)] ease-[var(--ease-out)] hover:bg-muted hover:text-foreground",
|
|
280
|
+
overlayClassNames.focusRing,
|
|
281
|
+
"disabled:pointer-events-none motion-reduce:transition-none"
|
|
282
|
+
),
|
|
283
|
+
children: [
|
|
284
|
+
/* @__PURE__ */ jsx(Cross, { "aria-hidden": "true", className: "size-[var(--sheet-close-icon-size)]" }),
|
|
285
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
286
|
+
]
|
|
287
|
+
}
|
|
288
|
+
) : null
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
] });
|
|
293
|
+
};
|
|
294
|
+
SheetContent.displayName = "SheetContent";
|
|
371
295
|
var DEFAULT_SIDEBAR_WIDTH = 224;
|
|
372
296
|
var DEFAULT_COLLAPSED_WIDTH = 52;
|
|
373
297
|
var DEFAULT_HEADER_HEIGHT = 48;
|
|
@@ -382,32 +306,33 @@ function AppShell({
|
|
|
382
306
|
onCollapsedChange,
|
|
383
307
|
headerHeight = DEFAULT_HEADER_HEIGHT,
|
|
384
308
|
contentClassName,
|
|
385
|
-
className
|
|
309
|
+
className,
|
|
310
|
+
overlay = false
|
|
386
311
|
}) {
|
|
387
312
|
const isControlled = collapsed !== void 0;
|
|
388
|
-
const [internalCollapsed] =
|
|
313
|
+
const [internalCollapsed] = React4.useState(defaultCollapsed);
|
|
389
314
|
const isCollapsed = isControlled ? collapsed : internalCollapsed;
|
|
390
|
-
const
|
|
391
|
-
React.useEffect(() => {
|
|
392
|
-
if (lastReportedRef.current !== isCollapsed) {
|
|
393
|
-
lastReportedRef.current = isCollapsed;
|
|
394
|
-
onCollapsedChange?.(isCollapsed);
|
|
395
|
-
}
|
|
396
|
-
}, [isCollapsed, onCollapsedChange]);
|
|
397
|
-
const [mobileOpen, setMobileOpen] = React.useState(false);
|
|
315
|
+
const [mobileOpen, setMobileOpen] = React4.useState(false);
|
|
398
316
|
const railWidth = isCollapsed ? sidebarCollapsedWidth : sidebarWidth;
|
|
399
317
|
return /* @__PURE__ */ jsxs(
|
|
400
318
|
"div",
|
|
401
319
|
{
|
|
402
|
-
|
|
320
|
+
"data-ui": "nebutra-app-shell",
|
|
321
|
+
className: cn(
|
|
322
|
+
"relative flex h-screen w-full overflow-hidden bg-background text-foreground",
|
|
323
|
+
className
|
|
324
|
+
),
|
|
403
325
|
children: [
|
|
404
326
|
/* @__PURE__ */ jsx(
|
|
405
327
|
"aside",
|
|
406
328
|
{
|
|
407
329
|
"aria-label": "Primary",
|
|
408
330
|
className: cn(
|
|
409
|
-
"hidden
|
|
410
|
-
"transition-[width] duration-200 ease-out"
|
|
331
|
+
"hidden h-screen overflow-hidden bg-sidebar text-sidebar-foreground md:block",
|
|
332
|
+
"transition-[width] duration-200 ease-out",
|
|
333
|
+
overlay ? "absolute inset-y-0 left-0 z-40" : "shrink-0",
|
|
334
|
+
railWidth > 0 && "border-r border-sidebar-border",
|
|
335
|
+
overlay && railWidth > 0 && "shadow-2xl"
|
|
411
336
|
),
|
|
412
337
|
style: { width: railWidth },
|
|
413
338
|
children: /* @__PURE__ */ jsx(
|
|
@@ -420,14 +345,23 @@ function AppShell({
|
|
|
420
345
|
)
|
|
421
346
|
}
|
|
422
347
|
),
|
|
423
|
-
|
|
424
|
-
|
|
348
|
+
overlay && !isCollapsed ? /* @__PURE__ */ jsx(
|
|
349
|
+
"button",
|
|
350
|
+
{
|
|
351
|
+
type: "button",
|
|
352
|
+
"aria-label": "Collapse navigation",
|
|
353
|
+
onClick: () => onCollapsedChange?.(true),
|
|
354
|
+
className: "absolute inset-0 z-30 hidden cursor-default bg-foreground/20 backdrop-blur-[1px] md:block"
|
|
355
|
+
}
|
|
356
|
+
) : null,
|
|
357
|
+
/* @__PURE__ */ jsx(Sheet, { open: mobileOpen, onOpenChange: setMobileOpen, children: /* @__PURE__ */ jsx(SheetContent, { side: "left", className: "w-72 border-r border-sidebar-border bg-sidebar p-0", children: /* @__PURE__ */ jsx("div", { className: "h-full overflow-y-auto", children: sidebar }) }) }),
|
|
358
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [
|
|
425
359
|
header !== void 0 && /* @__PURE__ */ jsxs(
|
|
426
360
|
"header",
|
|
427
361
|
{
|
|
428
362
|
className: cn(
|
|
429
|
-
"sticky top-0 z-30 flex items-center gap-2 border-b border-border",
|
|
430
|
-
"bg-background/
|
|
363
|
+
"sticky top-0 z-30 flex shrink-0 items-center gap-2 border-b border-border",
|
|
364
|
+
"bg-background/90 px-3 backdrop-blur-xl supports-[backdrop-filter]:bg-background/80 sm:px-4"
|
|
431
365
|
),
|
|
432
366
|
style: { height: headerHeight },
|
|
433
367
|
children: [
|
|
@@ -438,9 +372,9 @@ function AppShell({
|
|
|
438
372
|
"aria-label": "Open navigation menu",
|
|
439
373
|
onClick: () => setMobileOpen(true),
|
|
440
374
|
className: cn(
|
|
441
|
-
"relative inline-flex size-8 items-center justify-center rounded-md text-foreground/80 after:absolute after:-inset-1.5 after:content-['']",
|
|
375
|
+
"relative inline-flex size-8 items-center justify-center rounded-[var(--radius-md)] text-foreground/80 after:absolute after:-inset-1.5 after:content-['']",
|
|
442
376
|
"hover:bg-muted hover:text-foreground md:hidden",
|
|
443
|
-
"focus:outline-none focus:ring-2 focus:ring-offset-1"
|
|
377
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1"
|
|
444
378
|
),
|
|
445
379
|
children: /* @__PURE__ */ jsx(Menu, { className: "size-4", "aria-hidden": "true" })
|
|
446
380
|
}
|
|
@@ -449,16 +383,16 @@ function AppShell({
|
|
|
449
383
|
]
|
|
450
384
|
}
|
|
451
385
|
),
|
|
452
|
-
header === void 0 && /* @__PURE__ */ jsx("div", { className: "flex items-center border-b border-border bg-background px-4 py-2 md:hidden", children: /* @__PURE__ */ jsx(
|
|
386
|
+
header === void 0 && /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center border-b border-border bg-background px-4 py-2 md:hidden", children: /* @__PURE__ */ jsx(
|
|
453
387
|
"button",
|
|
454
388
|
{
|
|
455
389
|
type: "button",
|
|
456
390
|
"aria-label": "Open navigation menu",
|
|
457
391
|
onClick: () => setMobileOpen(true),
|
|
458
392
|
className: cn(
|
|
459
|
-
"relative inline-flex size-8 items-center justify-center rounded-md text-foreground/80 after:absolute after:-inset-1.5 after:content-['']",
|
|
393
|
+
"relative inline-flex size-8 items-center justify-center rounded-[var(--radius-md)] text-foreground/80 after:absolute after:-inset-1.5 after:content-['']",
|
|
460
394
|
"hover:bg-muted hover:text-foreground",
|
|
461
|
-
"focus:outline-none focus:ring-2 focus:ring-offset-1"
|
|
395
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1"
|
|
462
396
|
),
|
|
463
397
|
children: /* @__PURE__ */ jsx(Menu, { className: "size-4", "aria-hidden": "true" })
|
|
464
398
|
}
|
|
@@ -466,7 +400,10 @@ function AppShell({
|
|
|
466
400
|
/* @__PURE__ */ jsx(
|
|
467
401
|
"main",
|
|
468
402
|
{
|
|
469
|
-
className: cn(
|
|
403
|
+
className: cn(
|
|
404
|
+
"min-h-0 flex-1 overflow-y-auto w-full max-w-none px-3 py-4 sm:px-4 md:px-5 2xl:px-6",
|
|
405
|
+
contentClassName
|
|
406
|
+
),
|
|
470
407
|
children
|
|
471
408
|
}
|
|
472
409
|
)
|
|
@@ -480,7 +417,7 @@ function Card({ children, isInteractive = false, className }) {
|
|
|
480
417
|
"div",
|
|
481
418
|
{
|
|
482
419
|
className: cn(
|
|
483
|
-
"rounded-
|
|
420
|
+
"rounded-[var(--radius-lg)] border border-border bg-background p-4 text-foreground shadow-sm dark:bg-black/40",
|
|
484
421
|
isInteractive && "cursor-pointer transition-shadow hover:shadow-md",
|
|
485
422
|
className
|
|
486
423
|
),
|
|
@@ -579,23 +516,21 @@ function BrandMark({
|
|
|
579
516
|
{
|
|
580
517
|
"aria-hidden": "true",
|
|
581
518
|
className: cn(
|
|
582
|
-
"pointer-events-none absolute rounded-full opacity-30 blur-2xl",
|
|
519
|
+
"pointer-events-none absolute rounded-full bg-brand-mark opacity-30 blur-2xl",
|
|
583
520
|
sizes.halo
|
|
584
|
-
)
|
|
585
|
-
style: { background: "var(--brand-gradient)" }
|
|
521
|
+
)
|
|
586
522
|
}
|
|
587
523
|
),
|
|
588
524
|
/* @__PURE__ */ jsx(
|
|
589
525
|
"span",
|
|
590
526
|
{
|
|
591
527
|
className: cn(
|
|
592
|
-
"relative inline-flex items-center justify-center rounded-2xl",
|
|
528
|
+
"relative inline-flex items-center justify-center rounded-[var(--radius-2xl)]",
|
|
593
529
|
sizes.box,
|
|
594
|
-
variant === "gradient" && "text-
|
|
595
|
-
variant === "soft" && "bg-
|
|
596
|
-
variant === "outline" && "border border-
|
|
530
|
+
variant === "gradient" && "bg-brand-mark text-brand-mark-foreground shadow-sm",
|
|
531
|
+
variant === "soft" && "bg-brand-mark/10 text-brand-mark dark:bg-brand-mark/20",
|
|
532
|
+
variant === "outline" && "border border-border bg-background text-foreground"
|
|
597
533
|
),
|
|
598
|
-
style: variant === "gradient" ? { background: "var(--brand-gradient)" } : void 0,
|
|
599
534
|
children: children ?? /* @__PURE__ */ jsx(DefaultGlyph, { className: sizes.glyph })
|
|
600
535
|
}
|
|
601
536
|
)
|
|
@@ -705,83 +640,85 @@ var emptyStateCssVars = (size) => ({
|
|
|
705
640
|
"--empty-state-title-line-height": `${emptyStateTokens.typography.titleLineHeight}px`,
|
|
706
641
|
"--empty-state-description-line-height": `${emptyStateTokens.typography.descriptionLineHeight}px`
|
|
707
642
|
});
|
|
708
|
-
var EmptyStateIcon =
|
|
709
|
-
|
|
710
|
-
|
|
643
|
+
var EmptyStateIcon = ({
|
|
644
|
+
className,
|
|
645
|
+
icon,
|
|
646
|
+
ref,
|
|
647
|
+
...props
|
|
648
|
+
}) => /* @__PURE__ */ jsx(
|
|
649
|
+
"div",
|
|
650
|
+
{
|
|
651
|
+
ref,
|
|
652
|
+
"aria-hidden": "true",
|
|
653
|
+
className: cn(
|
|
654
|
+
"flex size-[var(--empty-state-icon-size)] shrink-0 items-center justify-center rounded-[var(--empty-state-icon-radius)] bg-muted",
|
|
655
|
+
className
|
|
656
|
+
),
|
|
657
|
+
...props,
|
|
658
|
+
children: icon
|
|
659
|
+
}
|
|
660
|
+
);
|
|
661
|
+
EmptyStateIcon.displayName = "EmptyState.Icon";
|
|
662
|
+
var EmptyStateRoot = ({
|
|
663
|
+
className,
|
|
664
|
+
title,
|
|
665
|
+
description,
|
|
666
|
+
icon,
|
|
667
|
+
children,
|
|
668
|
+
action,
|
|
669
|
+
link,
|
|
670
|
+
style,
|
|
671
|
+
variant = "blank-slate",
|
|
672
|
+
size = "md",
|
|
673
|
+
align = "center",
|
|
674
|
+
live = false,
|
|
675
|
+
ref,
|
|
676
|
+
...props
|
|
677
|
+
}) => {
|
|
678
|
+
const actions = children ?? [action, link].filter(Boolean);
|
|
679
|
+
const hasActions = React4.Children.toArray(actions).length > 0;
|
|
680
|
+
return /* @__PURE__ */ jsx(
|
|
681
|
+
"section",
|
|
711
682
|
{
|
|
712
683
|
ref,
|
|
713
|
-
"aria-
|
|
684
|
+
"aria-live": live ? "polite" : void 0,
|
|
714
685
|
className: cn(
|
|
715
|
-
"flex
|
|
686
|
+
"flex min-h-[var(--empty-state-min-height)] w-full flex-col justify-center rounded-[var(--empty-state-radius)] px-[var(--empty-state-padding-x)] py-[var(--empty-state-padding-y)]",
|
|
687
|
+
variantClassName[variant],
|
|
688
|
+
align === "center" ? "items-center text-center" : "items-start text-left",
|
|
716
689
|
className
|
|
717
690
|
),
|
|
691
|
+
style: { ...emptyStateCssVars(size), ...style },
|
|
718
692
|
...props,
|
|
719
|
-
children:
|
|
693
|
+
children: /* @__PURE__ */ jsxs(
|
|
694
|
+
"div",
|
|
695
|
+
{
|
|
696
|
+
className: cn(
|
|
697
|
+
"flex max-w-[var(--empty-state-content-max-width)] flex-col gap-[var(--empty-state-stack-gap)]",
|
|
698
|
+
align === "center" ? "items-center" : "items-start"
|
|
699
|
+
),
|
|
700
|
+
children: [
|
|
701
|
+
icon ? /* @__PURE__ */ jsx("div", { className: cn("[&>div]:bg-muted", iconToneClassName[variant]), children: icon }) : null,
|
|
702
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-[var(--empty-state-copy-gap)]", children: [
|
|
703
|
+
/* @__PURE__ */ jsx("h3", { className: "font-[var(--empty-state-title-weight)] text-[length:var(--empty-state-title-size)] leading-[var(--empty-state-title-line-height)] text-foreground", children: title }),
|
|
704
|
+
description ? /* @__PURE__ */ jsx("p", { className: "max-w-[var(--empty-state-description-max-width)] text-[length:var(--empty-state-description-size)] leading-[var(--empty-state-description-line-height)] text-muted-foreground", children: description }) : null
|
|
705
|
+
] }),
|
|
706
|
+
hasActions ? /* @__PURE__ */ jsx(
|
|
707
|
+
"div",
|
|
708
|
+
{
|
|
709
|
+
className: cn(
|
|
710
|
+
"flex flex-wrap gap-[var(--empty-state-actions-gap)]",
|
|
711
|
+
align === "center" ? "justify-center" : "justify-start"
|
|
712
|
+
),
|
|
713
|
+
children: actions
|
|
714
|
+
}
|
|
715
|
+
) : null
|
|
716
|
+
]
|
|
717
|
+
}
|
|
718
|
+
)
|
|
720
719
|
}
|
|
721
|
-
)
|
|
722
|
-
|
|
723
|
-
EmptyStateIcon.displayName = "EmptyState.Icon";
|
|
724
|
-
var EmptyStateRoot = React.forwardRef(
|
|
725
|
-
({
|
|
726
|
-
className,
|
|
727
|
-
title,
|
|
728
|
-
description,
|
|
729
|
-
icon,
|
|
730
|
-
children,
|
|
731
|
-
action,
|
|
732
|
-
link,
|
|
733
|
-
style,
|
|
734
|
-
variant = "blank-slate",
|
|
735
|
-
size = "md",
|
|
736
|
-
align = "center",
|
|
737
|
-
live = false,
|
|
738
|
-
...props
|
|
739
|
-
}, ref) => {
|
|
740
|
-
const actions = children ?? [action, link].filter(Boolean);
|
|
741
|
-
const hasActions = React.Children.toArray(actions).length > 0;
|
|
742
|
-
return /* @__PURE__ */ jsx(
|
|
743
|
-
"section",
|
|
744
|
-
{
|
|
745
|
-
ref,
|
|
746
|
-
"aria-live": live ? "polite" : void 0,
|
|
747
|
-
className: cn(
|
|
748
|
-
"flex min-h-[var(--empty-state-min-height)] w-full flex-col justify-center rounded-[var(--empty-state-radius)] px-[var(--empty-state-padding-x)] py-[var(--empty-state-padding-y)]",
|
|
749
|
-
variantClassName[variant],
|
|
750
|
-
align === "center" ? "items-center text-center" : "items-start text-left",
|
|
751
|
-
className
|
|
752
|
-
),
|
|
753
|
-
style: { ...emptyStateCssVars(size), ...style },
|
|
754
|
-
...props,
|
|
755
|
-
children: /* @__PURE__ */ jsxs(
|
|
756
|
-
"div",
|
|
757
|
-
{
|
|
758
|
-
className: cn(
|
|
759
|
-
"flex max-w-[var(--empty-state-content-max-width)] flex-col gap-[var(--empty-state-stack-gap)]",
|
|
760
|
-
align === "center" ? "items-center" : "items-start"
|
|
761
|
-
),
|
|
762
|
-
children: [
|
|
763
|
-
icon ? /* @__PURE__ */ jsx("div", { className: cn("[&>div]:bg-muted", iconToneClassName[variant]), children: icon }) : null,
|
|
764
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-[var(--empty-state-copy-gap)]", children: [
|
|
765
|
-
/* @__PURE__ */ jsx("h3", { className: "font-[var(--empty-state-title-weight)] text-[length:var(--empty-state-title-size)] leading-[var(--empty-state-title-line-height)] text-foreground", children: title }),
|
|
766
|
-
description ? /* @__PURE__ */ jsx("p", { className: "max-w-[var(--empty-state-description-max-width)] text-[length:var(--empty-state-description-size)] leading-[var(--empty-state-description-line-height)] text-muted-foreground", children: description }) : null
|
|
767
|
-
] }),
|
|
768
|
-
hasActions ? /* @__PURE__ */ jsx(
|
|
769
|
-
"div",
|
|
770
|
-
{
|
|
771
|
-
className: cn(
|
|
772
|
-
"flex flex-wrap gap-[var(--empty-state-actions-gap)]",
|
|
773
|
-
align === "center" ? "justify-center" : "justify-start"
|
|
774
|
-
),
|
|
775
|
-
children: actions
|
|
776
|
-
}
|
|
777
|
-
) : null
|
|
778
|
-
]
|
|
779
|
-
}
|
|
780
|
-
)
|
|
781
|
-
}
|
|
782
|
-
);
|
|
783
|
-
}
|
|
784
|
-
);
|
|
720
|
+
);
|
|
721
|
+
};
|
|
785
722
|
EmptyStateRoot.displayName = "EmptyState.Root";
|
|
786
723
|
var EmptyState = {
|
|
787
724
|
Root: EmptyStateRoot,
|
|
@@ -818,18 +755,18 @@ function EmptyState2({
|
|
|
818
755
|
}
|
|
819
756
|
);
|
|
820
757
|
}
|
|
821
|
-
var Slot =
|
|
758
|
+
var Slot = React4.forwardRef(
|
|
822
759
|
({ children, className, style, ...props }, ref) => {
|
|
823
|
-
const childArray =
|
|
760
|
+
const childArray = React4.Children.toArray(children);
|
|
824
761
|
const child = childArray.length === 1 ? childArray[0] : null;
|
|
825
|
-
if (child == null || !
|
|
762
|
+
if (child == null || !React4.isValidElement(child)) {
|
|
826
763
|
return /* @__PURE__ */ jsx("span", { ref, className, style, ...props, children });
|
|
827
764
|
}
|
|
828
765
|
const childProps = child.props;
|
|
829
766
|
const mergedRef = (node) => {
|
|
830
767
|
if (typeof ref === "function") ref(node);
|
|
831
768
|
else if (ref) ref.current = node;
|
|
832
|
-
const childRef =
|
|
769
|
+
const childRef = childProps.ref;
|
|
833
770
|
if (typeof childRef === "function") childRef(node);
|
|
834
771
|
else if (childRef && "current" in childRef) {
|
|
835
772
|
childRef.current = node;
|
|
@@ -843,7 +780,7 @@ var Slot = React.forwardRef(
|
|
|
843
780
|
className: mergedClass,
|
|
844
781
|
style: { ...childProps.style, ...style }
|
|
845
782
|
};
|
|
846
|
-
return
|
|
783
|
+
return React4.cloneElement(
|
|
847
784
|
child,
|
|
848
785
|
merged
|
|
849
786
|
);
|
|
@@ -853,8 +790,9 @@ Slot.displayName = "Slot";
|
|
|
853
790
|
var buttonVariants = cva(
|
|
854
791
|
[
|
|
855
792
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap",
|
|
856
|
-
"rounded-[var(--radius-md)]
|
|
857
|
-
"
|
|
793
|
+
"rounded-[var(--btn-default-radius,var(--radius-md))]",
|
|
794
|
+
"text-[length:var(--control-font-size-md,0.875rem)] font-[number:var(--font-weight-medium,500)]",
|
|
795
|
+
"transition-colors duration-micro ease-out",
|
|
858
796
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
859
797
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
860
798
|
"aria-busy:cursor-wait"
|
|
@@ -862,8 +800,9 @@ var buttonVariants = cva(
|
|
|
862
800
|
{
|
|
863
801
|
variants: {
|
|
864
802
|
variant: {
|
|
865
|
-
|
|
866
|
-
|
|
803
|
+
// Recipe-driven via packages/design/tokens/recipe.css (.btn-brand-default)
|
|
804
|
+
default: "btn-brand-default",
|
|
805
|
+
ink: "bg-[var(--neutral-12)] text-[var(--neutral-1)] ring-1 ring-inset ring-[color:var(--neutral-1)]/5 hover:bg-[var(--neutral-11)] hover:-translate-y-px active:translate-y-0 transition-[transform,background-color] duration-micro",
|
|
867
806
|
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
868
807
|
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
869
808
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
@@ -873,16 +812,11 @@ var buttonVariants = cva(
|
|
|
873
812
|
warning: "bg-warning text-warning-foreground hover:bg-warning/90"
|
|
874
813
|
},
|
|
875
814
|
size: {
|
|
876
|
-
tiny: "h-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
// 40px
|
|
882
|
-
lg: "h-12 rounded-[var(--radius-lg)] px-5 text-base",
|
|
883
|
-
// 48px
|
|
884
|
-
icon: "h-10 w-10"
|
|
885
|
-
// 40×40px (kept for backward compat)
|
|
815
|
+
tiny: "h-[var(--control-height-tiny,1.5rem)] rounded-[var(--radius-sm)] px-2 text-[length:var(--control-font-size-tiny,0.6875rem)]",
|
|
816
|
+
sm: "h-[var(--control-height-sm,2rem)] rounded-[var(--radius-sm)] px-3 text-[length:var(--control-font-size-sm,0.75rem)]",
|
|
817
|
+
default: "h-[var(--control-height-md,2.5rem)] px-[var(--btn-default-padding-x,1rem)] py-[var(--btn-default-padding-y,0.5rem)]",
|
|
818
|
+
lg: "h-[var(--control-height-lg,3rem)] rounded-[var(--radius-lg)] px-5 text-[length:var(--control-font-size-lg,1rem)]",
|
|
819
|
+
icon: "h-[var(--control-height-md,2.5rem)] w-[var(--control-height-md,2.5rem)]"
|
|
886
820
|
},
|
|
887
821
|
shape: {
|
|
888
822
|
default: "",
|
|
@@ -891,16 +825,30 @@ var buttonVariants = cva(
|
|
|
891
825
|
}
|
|
892
826
|
},
|
|
893
827
|
compoundVariants: [
|
|
894
|
-
|
|
895
|
-
{ shape: "square", size: "
|
|
896
|
-
{ shape: "square", size: "
|
|
897
|
-
{ shape: "square", size: "
|
|
898
|
-
{
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
{
|
|
828
|
+
{ shape: "square", size: "tiny", className: "w-[var(--control-height-tiny,1.5rem)] px-0" },
|
|
829
|
+
{ shape: "square", size: "sm", className: "w-[var(--control-height-sm,2rem)] px-0" },
|
|
830
|
+
{ shape: "square", size: "default", className: "w-[var(--control-height-md,2.5rem)] px-0" },
|
|
831
|
+
{ shape: "square", size: "lg", className: "w-[var(--control-height-lg,3rem)] px-0" },
|
|
832
|
+
{
|
|
833
|
+
shape: "circle",
|
|
834
|
+
size: "tiny",
|
|
835
|
+
className: "w-[var(--control-height-tiny,1.5rem)] px-0 rounded-full"
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
shape: "circle",
|
|
839
|
+
size: "sm",
|
|
840
|
+
className: "w-[var(--control-height-sm,2rem)] px-0 rounded-full"
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
shape: "circle",
|
|
844
|
+
size: "default",
|
|
845
|
+
className: "w-[var(--control-height-md,2.5rem)] px-0 rounded-full"
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
shape: "circle",
|
|
849
|
+
size: "lg",
|
|
850
|
+
className: "w-[var(--control-height-lg,3rem)] px-0 rounded-full"
|
|
851
|
+
}
|
|
904
852
|
],
|
|
905
853
|
defaultVariants: {
|
|
906
854
|
variant: "default",
|
|
@@ -954,7 +902,7 @@ function getSpinnerSizeClass(size) {
|
|
|
954
902
|
var SHADOW_CLASSES = {
|
|
955
903
|
sm: "shadow-sm",
|
|
956
904
|
md: "shadow-md",
|
|
957
|
-
lg: "shadow-
|
|
905
|
+
lg: "shadow-md"
|
|
958
906
|
};
|
|
959
907
|
function resolveShadowClass(shadow) {
|
|
960
908
|
if (!shadow) return void 0;
|
|
@@ -970,85 +918,73 @@ function ButtonContent({ loading, prefix, suffix, size, children }) {
|
|
|
970
918
|
suffix != null && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("shrink-0", iconSizeClass), children: suffix })
|
|
971
919
|
] });
|
|
972
920
|
}
|
|
973
|
-
var Button =
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
}
|
|
1003
|
-
);
|
|
1004
|
-
Button.displayName = "Button";
|
|
1005
|
-
var ButtonLink = React.forwardRef(
|
|
1006
|
-
({
|
|
1007
|
-
className,
|
|
1008
|
-
variant,
|
|
1009
|
-
size,
|
|
1010
|
-
shape,
|
|
1011
|
-
prefix,
|
|
1012
|
-
suffix,
|
|
1013
|
-
shadow,
|
|
1014
|
-
loading = false,
|
|
1015
|
-
children,
|
|
1016
|
-
...props
|
|
1017
|
-
}, ref) => {
|
|
1018
|
-
const shadowClass = resolveShadowClass(shadow);
|
|
1019
|
-
const loadingProps = loading ? {
|
|
1020
|
-
"aria-busy": "true",
|
|
1021
|
-
"aria-disabled": "true",
|
|
1022
|
-
tabIndex: -1
|
|
1023
|
-
} : {};
|
|
1024
|
-
return /* @__PURE__ */ jsx(
|
|
1025
|
-
"a",
|
|
1026
|
-
{
|
|
1027
|
-
ref,
|
|
1028
|
-
className: cn(
|
|
1029
|
-
buttonVariants({ variant, size, shape }),
|
|
1030
|
-
shadowClass,
|
|
1031
|
-
loading && "pointer-events-none opacity-50",
|
|
1032
|
-
className
|
|
1033
|
-
),
|
|
1034
|
-
...loadingProps,
|
|
1035
|
-
...props,
|
|
1036
|
-
children: /* @__PURE__ */ jsx(ButtonContent, { loading, prefix, suffix, size, children })
|
|
1037
|
-
}
|
|
1038
|
-
);
|
|
1039
|
-
}
|
|
1040
|
-
);
|
|
1041
|
-
ButtonLink.displayName = "ButtonLink";
|
|
1042
|
-
var textSize = {
|
|
1043
|
-
small: "text-xs",
|
|
1044
|
-
medium: "text-sm",
|
|
1045
|
-
large: "text-base"
|
|
921
|
+
var Button = ({
|
|
922
|
+
className,
|
|
923
|
+
variant,
|
|
924
|
+
size,
|
|
925
|
+
shape,
|
|
926
|
+
asChild = false,
|
|
927
|
+
loading = false,
|
|
928
|
+
disabled,
|
|
929
|
+
prefix,
|
|
930
|
+
suffix,
|
|
931
|
+
shadow,
|
|
932
|
+
children,
|
|
933
|
+
ref,
|
|
934
|
+
...props
|
|
935
|
+
}) => {
|
|
936
|
+
const Comp = asChild ? Slot : "button";
|
|
937
|
+
const isDisabled = Boolean(disabled || loading);
|
|
938
|
+
const shadowClass = resolveShadowClass(shadow);
|
|
939
|
+
return /* @__PURE__ */ jsx(
|
|
940
|
+
Comp,
|
|
941
|
+
{
|
|
942
|
+
ref,
|
|
943
|
+
className: cn(buttonVariants({ variant, size, shape }), shadowClass, className),
|
|
944
|
+
disabled: isDisabled,
|
|
945
|
+
"aria-busy": loading || void 0,
|
|
946
|
+
...props,
|
|
947
|
+
children: asChild ? children : /* @__PURE__ */ jsx(ButtonContent, { loading, prefix, suffix, size, children })
|
|
948
|
+
}
|
|
949
|
+
);
|
|
1046
950
|
};
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
951
|
+
Button.displayName = "Button";
|
|
952
|
+
var ButtonLink = ({
|
|
953
|
+
className,
|
|
954
|
+
variant,
|
|
955
|
+
size,
|
|
956
|
+
shape,
|
|
957
|
+
prefix,
|
|
958
|
+
suffix,
|
|
959
|
+
shadow,
|
|
960
|
+
loading = false,
|
|
961
|
+
children,
|
|
962
|
+
ref,
|
|
963
|
+
...props
|
|
964
|
+
}) => {
|
|
965
|
+
const shadowClass = resolveShadowClass(shadow);
|
|
966
|
+
const loadingProps = loading ? {
|
|
967
|
+
"aria-busy": "true",
|
|
968
|
+
"aria-disabled": "true",
|
|
969
|
+
tabIndex: -1
|
|
970
|
+
} : {};
|
|
971
|
+
return /* @__PURE__ */ jsx(
|
|
972
|
+
"a",
|
|
973
|
+
{
|
|
974
|
+
ref,
|
|
975
|
+
className: cn(
|
|
976
|
+
buttonVariants({ variant, size, shape }),
|
|
977
|
+
shadowClass,
|
|
978
|
+
loading && "pointer-events-none opacity-50",
|
|
979
|
+
className
|
|
980
|
+
),
|
|
981
|
+
...loadingProps,
|
|
982
|
+
...props,
|
|
983
|
+
children: /* @__PURE__ */ jsx(ButtonContent, { loading, prefix, suffix, size, children })
|
|
984
|
+
}
|
|
985
|
+
);
|
|
1051
986
|
};
|
|
987
|
+
ButtonLink.displayName = "ButtonLink";
|
|
1052
988
|
var surfaceSize = {
|
|
1053
989
|
small: "gap-2 rounded-[var(--radius-md)] p-3 text-sm",
|
|
1054
990
|
medium: "gap-3 rounded-[var(--radius-lg)] p-4 text-sm",
|
|
@@ -1065,133 +1001,91 @@ function getActionTarget(link) {
|
|
|
1065
1001
|
}
|
|
1066
1002
|
return {};
|
|
1067
1003
|
}
|
|
1068
|
-
var
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
title,
|
|
1115
|
-
size = "medium",
|
|
1116
|
-
error,
|
|
1117
|
-
errorId,
|
|
1118
|
-
errorIdLabel = "Request ID",
|
|
1119
|
-
live = "polite",
|
|
1120
|
-
action,
|
|
1121
|
-
link,
|
|
1122
|
-
onAction,
|
|
1123
|
-
actionLoading = false,
|
|
1124
|
-
className,
|
|
1125
|
-
role,
|
|
1126
|
-
...props
|
|
1127
|
-
}, ref) => {
|
|
1128
|
-
const message = error?.message ?? children;
|
|
1129
|
-
const resolvedTitle = title ?? error?.title;
|
|
1130
|
-
const resolvedAction = action ?? error?.action;
|
|
1131
|
-
const resolvedLink = link ?? error?.link;
|
|
1132
|
-
const resolvedErrorId = errorId ?? error?.id;
|
|
1133
|
-
const resolvedRole = role ?? (live === "assertive" ? "alert" : "status");
|
|
1134
|
-
const ariaLive = live === "off" ? void 0 : live;
|
|
1135
|
-
return /* @__PURE__ */ jsxs(
|
|
1136
|
-
"div",
|
|
1137
|
-
{
|
|
1138
|
-
ref,
|
|
1139
|
-
role: resolvedRole,
|
|
1140
|
-
"aria-live": ariaLive,
|
|
1141
|
-
className: cn(
|
|
1142
|
-
"flex w-full border border-destructive/25 bg-destructive/5 text-foreground",
|
|
1143
|
-
surfaceSize[size],
|
|
1144
|
-
className
|
|
1004
|
+
var ErrorSurface = ({
|
|
1005
|
+
children,
|
|
1006
|
+
label,
|
|
1007
|
+
showLabel = true,
|
|
1008
|
+
title,
|
|
1009
|
+
size = "medium",
|
|
1010
|
+
error,
|
|
1011
|
+
errorId,
|
|
1012
|
+
errorIdLabel = "Request ID",
|
|
1013
|
+
live = "polite",
|
|
1014
|
+
action,
|
|
1015
|
+
link,
|
|
1016
|
+
onAction,
|
|
1017
|
+
actionLoading = false,
|
|
1018
|
+
className,
|
|
1019
|
+
role,
|
|
1020
|
+
ref,
|
|
1021
|
+
...props
|
|
1022
|
+
}) => {
|
|
1023
|
+
const message = error?.message ?? children;
|
|
1024
|
+
const resolvedTitle = title ?? error?.title;
|
|
1025
|
+
const resolvedAction = action ?? error?.action;
|
|
1026
|
+
const resolvedLink = link ?? error?.link;
|
|
1027
|
+
const resolvedErrorId = errorId ?? error?.id;
|
|
1028
|
+
const resolvedRole = role ?? (live === "assertive" ? "alert" : "status");
|
|
1029
|
+
const ariaLive = live === "off" ? void 0 : live;
|
|
1030
|
+
return /* @__PURE__ */ jsxs(
|
|
1031
|
+
"div",
|
|
1032
|
+
{
|
|
1033
|
+
ref,
|
|
1034
|
+
role: resolvedRole,
|
|
1035
|
+
"aria-live": ariaLive,
|
|
1036
|
+
className: cn(
|
|
1037
|
+
"flex w-full border border-destructive/25 bg-destructive/5 text-foreground",
|
|
1038
|
+
surfaceSize[size],
|
|
1039
|
+
className
|
|
1040
|
+
),
|
|
1041
|
+
...props,
|
|
1042
|
+
children: [
|
|
1043
|
+
/* @__PURE__ */ jsx(
|
|
1044
|
+
"span",
|
|
1045
|
+
{
|
|
1046
|
+
"aria-hidden": "true",
|
|
1047
|
+
className: "mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-[var(--radius-sm)] border border-destructive/20 bg-background text-destructive",
|
|
1048
|
+
children: /* @__PURE__ */ jsx(Warning, { size: surfaceIconSize[size] })
|
|
1049
|
+
}
|
|
1145
1050
|
),
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
/* @__PURE__ */ jsx(
|
|
1149
|
-
|
|
1051
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1052
|
+
label && showLabel ? /* @__PURE__ */ jsx("p", { className: "mb-1 text-xs font-medium uppercase tracking-normal text-destructive", children: label }) : null,
|
|
1053
|
+
resolvedTitle ? /* @__PURE__ */ jsx("p", { className: "font-semibold leading-6 text-foreground", children: resolvedTitle }) : null,
|
|
1054
|
+
message ? /* @__PURE__ */ jsx("p", { className: cn("leading-5 text-muted-foreground", resolvedTitle && "mt-1"), children: message }) : null,
|
|
1055
|
+
resolvedErrorId ? /* @__PURE__ */ jsxs("details", { className: "mt-3 text-xs text-muted-foreground", children: [
|
|
1056
|
+
/* @__PURE__ */ jsx("summary", { className: "cursor-pointer select-none text-foreground", children: "Diagnostic details" }),
|
|
1057
|
+
/* @__PURE__ */ jsxs("code", { className: "mt-2 block overflow-x-auto rounded-[var(--radius-sm)] border bg-background px-2 py-1 font-mono text-xs text-muted-foreground", children: [
|
|
1058
|
+
errorIdLabel,
|
|
1059
|
+
": ",
|
|
1060
|
+
resolvedErrorId,
|
|
1061
|
+
error?.code ? ` (${error.code})` : ""
|
|
1062
|
+
] })
|
|
1063
|
+
] }) : null,
|
|
1064
|
+
resolvedAction ? /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-wrap gap-2", children: resolvedLink ? /* @__PURE__ */ jsx(
|
|
1065
|
+
ButtonLink,
|
|
1150
1066
|
{
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1067
|
+
href: resolvedLink,
|
|
1068
|
+
size: "sm",
|
|
1069
|
+
variant: "outline",
|
|
1070
|
+
...getActionTarget(resolvedLink),
|
|
1071
|
+
children: resolvedAction
|
|
1154
1072
|
}
|
|
1155
|
-
)
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
{
|
|
1172
|
-
href: resolvedLink,
|
|
1173
|
-
size: "sm",
|
|
1174
|
-
variant: "outline",
|
|
1175
|
-
...getActionTarget(resolvedLink),
|
|
1176
|
-
children: resolvedAction
|
|
1177
|
-
}
|
|
1178
|
-
) : /* @__PURE__ */ jsx(
|
|
1179
|
-
Button,
|
|
1180
|
-
{
|
|
1181
|
-
type: "button",
|
|
1182
|
-
size: "sm",
|
|
1183
|
-
variant: "outline",
|
|
1184
|
-
loading: actionLoading,
|
|
1185
|
-
onClick: onAction,
|
|
1186
|
-
children: resolvedAction
|
|
1187
|
-
}
|
|
1188
|
-
) }) : null
|
|
1189
|
-
] })
|
|
1190
|
-
]
|
|
1191
|
-
}
|
|
1192
|
-
);
|
|
1193
|
-
}
|
|
1194
|
-
);
|
|
1073
|
+
) : /* @__PURE__ */ jsx(
|
|
1074
|
+
Button,
|
|
1075
|
+
{
|
|
1076
|
+
type: "button",
|
|
1077
|
+
size: "sm",
|
|
1078
|
+
variant: "outline",
|
|
1079
|
+
loading: actionLoading,
|
|
1080
|
+
onClick: onAction,
|
|
1081
|
+
children: resolvedAction
|
|
1082
|
+
}
|
|
1083
|
+
) }) : null
|
|
1084
|
+
] })
|
|
1085
|
+
]
|
|
1086
|
+
}
|
|
1087
|
+
);
|
|
1088
|
+
};
|
|
1195
1089
|
ErrorSurface.displayName = "Error";
|
|
1196
1090
|
function ErrorState({
|
|
1197
1091
|
title = "Couldn\u2019t Load Resource",
|
|
@@ -1266,14 +1160,14 @@ function LoadingState({ message, size = "large" }) {
|
|
|
1266
1160
|
"span",
|
|
1267
1161
|
{
|
|
1268
1162
|
className: cn(
|
|
1269
|
-
"inline-block animate-spin rounded-full border-solid border-
|
|
1163
|
+
"inline-block animate-spin rounded-full border-solid border-primary border-r-transparent align-[-0.125em]",
|
|
1270
1164
|
spinnerSize[size]
|
|
1271
1165
|
),
|
|
1272
1166
|
role: "status",
|
|
1273
1167
|
"aria-label": message ?? "Loading"
|
|
1274
1168
|
}
|
|
1275
1169
|
),
|
|
1276
|
-
message && /* @__PURE__ */ jsx("p", { className: "mt-3 text-sm text-
|
|
1170
|
+
message && /* @__PURE__ */ jsx("p", { className: "mt-3 text-sm text-muted-foreground", children: message })
|
|
1277
1171
|
] });
|
|
1278
1172
|
}
|
|
1279
1173
|
function PageHeader({ title, description, actions, className }) {
|
|
@@ -1286,8 +1180,8 @@ function PageHeader({ title, description, actions, className }) {
|
|
|
1286
1180
|
),
|
|
1287
1181
|
children: [
|
|
1288
1182
|
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
1289
|
-
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold tracking-tight text-
|
|
1290
|
-
description && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-
|
|
1183
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold tracking-tight text-foreground", children: title }),
|
|
1184
|
+
description && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: description })
|
|
1291
1185
|
] }),
|
|
1292
1186
|
actions && /* @__PURE__ */ jsx("div", { className: "mt-2 flex shrink-0 gap-2 sm:mt-0", children: actions })
|
|
1293
1187
|
]
|