@bison-lab/ui 0.14.0 → 0.15.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/dist/index.d.mts +39 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +287 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -6
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { t as cn } from "./utils-DPv8mMhD.mjs";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { defaultFontWeights, densityPresets, deriveDarkPalette, deriveLightPalette, generateBrandScales, generateScaleCSS, motionPresets, radiusPresets, shadowPresets, zIndexTokens } from "@bison-lab/tokens";
|
|
4
|
+
import { defaultFontWeights, densityPresets, deriveDarkPalette, deriveLightPalette, generateBrandScales, generateDestructiveScaleCSS, generateScaleCSS, motionPresets, radiusPresets, shadowPresets, zIndexTokens } from "@bison-lab/tokens";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { Accordion as Accordion$1, AlertDialog as AlertDialog$1, AspectRatio as AspectRatio$1, Avatar as Avatar$1, Checkbox as Checkbox$1, Collapsible as Collapsible$1, ContextMenu as ContextMenu$1, Dialog as Dialog$1, DropdownMenu as DropdownMenu$1, Label as Label$1, NavigationMenu as NavigationMenu$1, Popover as Popover$1, Progress as Progress$1, RadioGroup as RadioGroup$1, ScrollArea as ScrollArea$1, Select as Select$1, Separator as Separator$1, Slider as Slider$1, Slot, Switch as Switch$1, Tabs as Tabs$1, Tooltip as Tooltip$1, unstable_PasswordToggleField } from "radix-ui";
|
|
7
7
|
import { cva } from "class-variance-authority";
|
|
8
8
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
9
|
-
import { faAlignCenter, faAlignLeft, faAlignRight, faArrowDown, faArrowLeft, faArrowRight, faArrowUp, faArrowsUpDown, faBars, faBold, faCalendar, faCamera, faCheck, faChevronDown, faChevronLeft, faChevronRight, faChevronUp, faChevronsLeft, faChevronsRight, faCircle, faCode, faEllipsis, faEnvelope, faEye, faEyeSlash, faFileCircleQuestion, faH1, faH2, faH3, faImage, faInbox, faItalic, faLink, faLinkSlash, faList, faListOl, faMagnifyingGlass, faMinus, faPlus, faQuoteLeft, faRightFromBracket, faRotateLeft, faRotateRight, faServer, faSidebarFlip, faSlidersUp, faSpinnerThird, faStrikethrough, faUnderline, faUpDown, faWrench, faXmark } from "@fortawesome/pro-regular-svg-icons";
|
|
9
|
+
import { faAlignCenter, faAlignLeft, faAlignRight, faArrowDown, faArrowLeft, faArrowRight, faArrowUp, faArrowsUpDown, faBars, faBold, faCalendar, faCamera, faCheck, faChevronDown, faChevronLeft, faChevronRight, faChevronUp, faChevronsLeft, faChevronsRight, faCircle, faCode, faEllipsis, faEnvelope, faEye, faEyeSlash, faFileCircleQuestion, faH1, faH2, faH3, faImage, faInbox, faItalic, faLink, faLinkSlash, faList, faListOl, faMagnifyingGlass, faMinus, faPen, faPlus, faQuoteLeft, faRightFromBracket, faRotateLeft, faRotateRight, faServer, faSidebarFlip, faSlidersUp, faSpinnerThird, faStrikethrough, faUnderline, faUpDown, faWrench, faXmark } from "@fortawesome/pro-regular-svg-icons";
|
|
10
10
|
import { DayPicker } from "react-day-picker";
|
|
11
11
|
import { endOfMonth, endOfWeek, format, startOfMonth, startOfWeek, startOfYear, subDays, subMonths, subYears } from "date-fns";
|
|
12
12
|
import { EditorContent, useEditor } from "@tiptap/react";
|
|
@@ -18,6 +18,19 @@ import TextAlign from "@tiptap/extension-text-align";
|
|
|
18
18
|
import { Toaster as Toaster$1, toast } from "sonner";
|
|
19
19
|
import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
20
20
|
import { Command as Command$1 } from "cmdk";
|
|
21
|
+
//#region src/lib/semantic-action-tones.ts
|
|
22
|
+
/**
|
|
23
|
+
* Reusable “soft” icon tiles: same border + shadow language, hue from semantic scales.
|
|
24
|
+
* Pair with `Button` variants `actionNeutral` | `actionPositive` | `actionNegative` and `size="icon"`.
|
|
25
|
+
*
|
|
26
|
+
* Requires `--success-*` and `--destructive-*` scales from BisonProvider / tailwind preset.
|
|
27
|
+
*/
|
|
28
|
+
const actionNeutralToneClasses = "border border-border bg-muted/80 text-muted-foreground shadow-sm hover:border-border-strong hover:bg-muted hover:text-foreground dark:border-border dark:bg-muted/50 dark:hover:bg-muted/80 dark:hover:text-foreground";
|
|
29
|
+
const actionPositiveToneClasses = "border border-success-200/90 bg-success-100 text-success-600 shadow-sm hover:border-success-300 hover:bg-success-200 hover:text-success-700 focus-visible:ring-success-500/40 dark:border-success-800/55 dark:bg-success-950/40 dark:text-success-400 dark:hover:border-success-700 dark:hover:bg-success-950/60 dark:hover:text-success-300";
|
|
30
|
+
const actionNegativeToneClasses = "border border-destructive-200/90 bg-destructive-100 text-destructive-600 shadow-sm hover:border-destructive-300 hover:bg-destructive-200 hover:text-destructive-700 focus-visible:ring-destructive-500/40 dark:border-destructive-800/55 dark:bg-destructive-950/45 dark:text-destructive-400 dark:hover:border-destructive-700 dark:hover:bg-destructive-950/65 dark:hover:text-destructive-300";
|
|
31
|
+
/** @deprecated Use `actionNeutralToneClasses` + `variant="actionNeutral"` on Button. */
|
|
32
|
+
const actionNeutralIconChromeClasses = actionNeutralToneClasses;
|
|
33
|
+
//#endregion
|
|
21
34
|
//#region src/hooks/use-scroll-reveal.ts
|
|
22
35
|
/**
|
|
23
36
|
* Returns a ref and a boolean indicating whether the element is in view.
|
|
@@ -167,7 +180,7 @@ function BisonProvider({ children, brandColors, radius = "rounded", shadow = "su
|
|
|
167
180
|
const lightPalette = React.useMemo(() => deriveLightPalette(brandColors), [brandColors]);
|
|
168
181
|
const darkPalette = React.useMemo(() => deriveDarkPalette(brandColors), [brandColors]);
|
|
169
182
|
const scaleCSS = React.useMemo(() => {
|
|
170
|
-
return generateScaleCSS(generateBrandScales(brandColors))
|
|
183
|
+
return `${generateScaleCSS(generateBrandScales(brandColors))}\n${generateDestructiveScaleCSS()}`;
|
|
171
184
|
}, [brandColors]);
|
|
172
185
|
const fontsUrl = React.useMemo(() => {
|
|
173
186
|
const fonts = [bodyFont];
|
|
@@ -392,6 +405,9 @@ const buttonVariants = cva("inline-flex items-center justify-center whitespace-n
|
|
|
392
405
|
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
393
406
|
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
394
407
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
408
|
+
actionNeutral: actionNeutralToneClasses,
|
|
409
|
+
actionPositive: actionPositiveToneClasses,
|
|
410
|
+
actionNegative: actionNegativeToneClasses,
|
|
395
411
|
link: "text-primary underline-offset-4 hover:underline"
|
|
396
412
|
},
|
|
397
413
|
size: {
|
|
@@ -1221,14 +1237,18 @@ const CardFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1221
1237
|
CardFooter.displayName = "CardFooter";
|
|
1222
1238
|
//#endregion
|
|
1223
1239
|
//#region src/components/badge.tsx
|
|
1224
|
-
const badgeVariants = cva("inline-flex items-center rounded-
|
|
1240
|
+
const badgeVariants = cva("inline-flex h-6 items-center justify-center rounded-[var(--radius-sm)] border px-2.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", {
|
|
1225
1241
|
variants: { variant: {
|
|
1226
1242
|
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
|
1227
1243
|
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
1228
1244
|
accent: "border-transparent bg-brand-accent text-brand-accent-foreground hover:bg-brand-accent/80",
|
|
1229
1245
|
highlight: "border-transparent bg-highlight text-highlight-foreground hover:bg-highlight/80",
|
|
1230
1246
|
destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
|
1231
|
-
outline: "text-foreground"
|
|
1247
|
+
outline: "text-foreground",
|
|
1248
|
+
success: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:border-emerald-400/30 dark:bg-emerald-400/10 dark:text-emerald-400",
|
|
1249
|
+
warning: "border-amber-500/30 bg-amber-500/10 text-amber-700 dark:border-amber-400/30 dark:bg-amber-400/10 dark:text-amber-400",
|
|
1250
|
+
error: "border-red-500/30 bg-red-500/10 text-red-700 dark:border-red-400/30 dark:bg-red-400/10 dark:text-red-400",
|
|
1251
|
+
info: "border-blue-500/30 bg-blue-500/10 text-blue-700 dark:border-blue-400/30 dark:bg-blue-400/10 dark:text-blue-400"
|
|
1232
1252
|
} },
|
|
1233
1253
|
defaultVariants: { variant: "default" }
|
|
1234
1254
|
});
|
|
@@ -1378,17 +1398,84 @@ const SheetOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
1378
1398
|
}));
|
|
1379
1399
|
SheetOverlay.displayName = Dialog$1.Overlay.displayName;
|
|
1380
1400
|
const sheetVariants = cva("fixed z-[var(--z-modal)] gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-slow data-[state=open]:duration-normal", {
|
|
1381
|
-
variants: {
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1401
|
+
variants: {
|
|
1402
|
+
side: {
|
|
1403
|
+
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
1404
|
+
bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
1405
|
+
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left",
|
|
1406
|
+
right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right"
|
|
1407
|
+
},
|
|
1408
|
+
size: {
|
|
1409
|
+
sm: "",
|
|
1410
|
+
md: "",
|
|
1411
|
+
lg: "",
|
|
1412
|
+
xl: "",
|
|
1413
|
+
full: ""
|
|
1414
|
+
}
|
|
1415
|
+
},
|
|
1416
|
+
defaultVariants: {
|
|
1417
|
+
side: "right",
|
|
1418
|
+
size: "sm"
|
|
1419
|
+
},
|
|
1420
|
+
compoundVariants: [
|
|
1421
|
+
{
|
|
1422
|
+
side: "left",
|
|
1423
|
+
size: "sm",
|
|
1424
|
+
className: "sm:max-w-sm"
|
|
1425
|
+
},
|
|
1426
|
+
{
|
|
1427
|
+
side: "left",
|
|
1428
|
+
size: "md",
|
|
1429
|
+
className: "sm:max-w-md"
|
|
1430
|
+
},
|
|
1431
|
+
{
|
|
1432
|
+
side: "left",
|
|
1433
|
+
size: "lg",
|
|
1434
|
+
className: "sm:max-w-lg"
|
|
1435
|
+
},
|
|
1436
|
+
{
|
|
1437
|
+
side: "left",
|
|
1438
|
+
size: "xl",
|
|
1439
|
+
className: "sm:max-w-xl"
|
|
1440
|
+
},
|
|
1441
|
+
{
|
|
1442
|
+
side: "left",
|
|
1443
|
+
size: "full",
|
|
1444
|
+
className: "sm:max-w-full"
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
side: "right",
|
|
1448
|
+
size: "sm",
|
|
1449
|
+
className: "sm:max-w-sm"
|
|
1450
|
+
},
|
|
1451
|
+
{
|
|
1452
|
+
side: "right",
|
|
1453
|
+
size: "md",
|
|
1454
|
+
className: "sm:max-w-md"
|
|
1455
|
+
},
|
|
1456
|
+
{
|
|
1457
|
+
side: "right",
|
|
1458
|
+
size: "lg",
|
|
1459
|
+
className: "sm:max-w-lg"
|
|
1460
|
+
},
|
|
1461
|
+
{
|
|
1462
|
+
side: "right",
|
|
1463
|
+
size: "xl",
|
|
1464
|
+
className: "sm:max-w-xl"
|
|
1465
|
+
},
|
|
1466
|
+
{
|
|
1467
|
+
side: "right",
|
|
1468
|
+
size: "full",
|
|
1469
|
+
className: "sm:max-w-full"
|
|
1470
|
+
}
|
|
1471
|
+
]
|
|
1388
1472
|
});
|
|
1389
|
-
const SheetContent = React.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SheetPortal, { children: [/* @__PURE__ */ jsx(SheetOverlay, {}), /* @__PURE__ */ jsxs(Dialog$1.Content, {
|
|
1473
|
+
const SheetContent = React.forwardRef(({ side = "right", size = "sm", className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SheetPortal, { children: [/* @__PURE__ */ jsx(SheetOverlay, {}), /* @__PURE__ */ jsxs(Dialog$1.Content, {
|
|
1390
1474
|
ref,
|
|
1391
|
-
className: cn(sheetVariants({
|
|
1475
|
+
className: cn(sheetVariants({
|
|
1476
|
+
side,
|
|
1477
|
+
size
|
|
1478
|
+
}), className),
|
|
1392
1479
|
...props,
|
|
1393
1480
|
children: [children, /* @__PURE__ */ jsxs(Dialog$1.Close, {
|
|
1394
1481
|
className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",
|
|
@@ -1529,7 +1616,7 @@ const TabsList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
1529
1616
|
TabsList.displayName = Tabs$1.List.displayName;
|
|
1530
1617
|
const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Tabs$1.Trigger, {
|
|
1531
1618
|
ref,
|
|
1532
|
-
className: cn("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-
|
|
1619
|
+
className: cn("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-[var(--bison-tab-active-bg,hsl(var(--card)))] data-[state=active]:text-[var(--bison-tab-active-fg,hsl(var(--card-foreground)))] data-[state=active]:shadow-sm", className),
|
|
1533
1620
|
...props
|
|
1534
1621
|
}));
|
|
1535
1622
|
TabsTrigger.displayName = Tabs$1.Trigger.displayName;
|
|
@@ -2400,6 +2487,190 @@ const CommandShortcut = ({ className, ...props }) => /* @__PURE__ */ jsx("span",
|
|
|
2400
2487
|
...props
|
|
2401
2488
|
});
|
|
2402
2489
|
//#endregion
|
|
2490
|
+
//#region src/components/editable-title.tsx
|
|
2491
|
+
const editableTitleVariants = cva("inline-flex items-center gap-2 font-semibold text-foreground", {
|
|
2492
|
+
variants: { size: {
|
|
2493
|
+
sm: "text-lg",
|
|
2494
|
+
md: "text-2xl",
|
|
2495
|
+
lg: "text-4xl"
|
|
2496
|
+
} },
|
|
2497
|
+
defaultVariants: { size: "md" }
|
|
2498
|
+
});
|
|
2499
|
+
const editableTitleInputVariants = cva("bg-transparent border-b-2 border-primary outline-none font-semibold text-foreground w-full min-w-0", {
|
|
2500
|
+
variants: { size: {
|
|
2501
|
+
sm: "text-lg pb-0.5",
|
|
2502
|
+
md: "text-2xl pb-1",
|
|
2503
|
+
lg: "text-4xl pb-1.5"
|
|
2504
|
+
} },
|
|
2505
|
+
defaultVariants: { size: "md" }
|
|
2506
|
+
});
|
|
2507
|
+
/**
|
|
2508
|
+
* Fixed square chrome for edit / confirm / cancel: outer box is identical regardless of glyph.
|
|
2509
|
+
* Overrides `Button` `size="icon"` density vars so all three match exactly.
|
|
2510
|
+
*/
|
|
2511
|
+
function titleActionButtonClass(size) {
|
|
2512
|
+
switch (size) {
|
|
2513
|
+
case "sm": return "box-border aspect-square size-6 min-h-6 min-w-6 max-h-6 max-w-6 shrink-0 p-0 leading-none overflow-hidden inline-flex items-center justify-center [&_svg]:block [&_svg]:size-3 [&_svg]:shrink-0";
|
|
2514
|
+
case "lg": return "box-border aspect-square size-10 min-h-10 min-w-10 max-h-10 max-w-10 shrink-0 p-0 leading-none overflow-hidden inline-flex items-center justify-center [&_svg]:block [&_svg]:size-5 [&_svg]:shrink-0";
|
|
2515
|
+
default: return "box-border aspect-square size-8 min-h-8 min-w-8 max-h-8 max-w-8 shrink-0 p-0 leading-none overflow-hidden inline-flex items-center justify-center [&_svg]:block [&_svg]:size-4 [&_svg]:shrink-0";
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
/** Loading affordance: same outer square as action buttons. */
|
|
2519
|
+
function loadingSpinnerWrapClass(size) {
|
|
2520
|
+
switch (size) {
|
|
2521
|
+
case "sm": return "box-border size-6 min-h-6 min-w-6 max-h-6 max-w-6 [&_svg]:size-3";
|
|
2522
|
+
case "lg": return "box-border size-10 min-h-10 min-w-10 max-h-10 max-w-10 [&_svg]:size-5";
|
|
2523
|
+
default: return "box-border size-8 min-h-8 min-w-8 max-h-8 max-w-8 [&_svg]:size-4";
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
const EditableTitle = React.forwardRef(({ className, size, value, onSave, onChange, placeholder = "Untitled", disabled = false, loading = false, maxLength, ...props }, ref) => {
|
|
2527
|
+
const [isEditing, setIsEditing] = React.useState(false);
|
|
2528
|
+
const [draft, setDraft] = React.useState(value);
|
|
2529
|
+
/** Avoids a flash: after save/cancel the pointer often sits where the pen mounts, so hover would show it immediately. */
|
|
2530
|
+
const [suppressPenReveal, setSuppressPenReveal] = React.useState(false);
|
|
2531
|
+
const inputRef = React.useRef(null);
|
|
2532
|
+
React.useEffect(() => {
|
|
2533
|
+
if (!suppressPenReveal) return;
|
|
2534
|
+
const t = window.setTimeout(() => setSuppressPenReveal(false), 200);
|
|
2535
|
+
return () => clearTimeout(t);
|
|
2536
|
+
}, [suppressPenReveal]);
|
|
2537
|
+
React.useEffect(() => {
|
|
2538
|
+
if (!isEditing) setDraft(value);
|
|
2539
|
+
}, [value, isEditing]);
|
|
2540
|
+
React.useEffect(() => {
|
|
2541
|
+
if (isEditing && inputRef.current) {
|
|
2542
|
+
inputRef.current.focus();
|
|
2543
|
+
inputRef.current.select();
|
|
2544
|
+
}
|
|
2545
|
+
}, [isEditing]);
|
|
2546
|
+
const startEditing = () => {
|
|
2547
|
+
if (disabled || loading) return;
|
|
2548
|
+
setSuppressPenReveal(false);
|
|
2549
|
+
setDraft(value);
|
|
2550
|
+
setIsEditing(true);
|
|
2551
|
+
};
|
|
2552
|
+
const endEditing = () => {
|
|
2553
|
+
setSuppressPenReveal(true);
|
|
2554
|
+
setIsEditing(false);
|
|
2555
|
+
};
|
|
2556
|
+
const save = () => {
|
|
2557
|
+
const trimmed = draft.trim();
|
|
2558
|
+
if (trimmed && trimmed !== value) onSave?.(trimmed);
|
|
2559
|
+
endEditing();
|
|
2560
|
+
};
|
|
2561
|
+
const cancel = () => {
|
|
2562
|
+
setDraft(value);
|
|
2563
|
+
endEditing();
|
|
2564
|
+
};
|
|
2565
|
+
const handleKeyDown = (e) => {
|
|
2566
|
+
if (e.key === "Enter") {
|
|
2567
|
+
e.preventDefault();
|
|
2568
|
+
save();
|
|
2569
|
+
} else if (e.key === "Escape") {
|
|
2570
|
+
e.preventDefault();
|
|
2571
|
+
cancel();
|
|
2572
|
+
}
|
|
2573
|
+
};
|
|
2574
|
+
const handleChange = (e) => {
|
|
2575
|
+
const newValue = e.target.value;
|
|
2576
|
+
if (maxLength && newValue.length > maxLength) return;
|
|
2577
|
+
setDraft(newValue);
|
|
2578
|
+
onChange?.(newValue);
|
|
2579
|
+
};
|
|
2580
|
+
if (isEditing) return /* @__PURE__ */ jsxs("div", {
|
|
2581
|
+
ref,
|
|
2582
|
+
className: cn(editableTitleVariants({ size }), className),
|
|
2583
|
+
...props,
|
|
2584
|
+
children: [
|
|
2585
|
+
/* @__PURE__ */ jsx("input", {
|
|
2586
|
+
ref: inputRef,
|
|
2587
|
+
type: "text",
|
|
2588
|
+
value: draft,
|
|
2589
|
+
onChange: handleChange,
|
|
2590
|
+
onKeyDown: handleKeyDown,
|
|
2591
|
+
onBlur: save,
|
|
2592
|
+
placeholder,
|
|
2593
|
+
maxLength,
|
|
2594
|
+
className: cn(editableTitleInputVariants({ size }), "min-w-0 flex-1"),
|
|
2595
|
+
"aria-label": "Edit title"
|
|
2596
|
+
}),
|
|
2597
|
+
/* @__PURE__ */ jsx(Button, {
|
|
2598
|
+
type: "button",
|
|
2599
|
+
variant: "actionPositive",
|
|
2600
|
+
size: "icon",
|
|
2601
|
+
className: titleActionButtonClass(size),
|
|
2602
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
2603
|
+
onClick: save,
|
|
2604
|
+
"aria-label": "Save title",
|
|
2605
|
+
children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faCheck })
|
|
2606
|
+
}),
|
|
2607
|
+
/* @__PURE__ */ jsx(Button, {
|
|
2608
|
+
type: "button",
|
|
2609
|
+
variant: "actionNegative",
|
|
2610
|
+
size: "icon",
|
|
2611
|
+
className: titleActionButtonClass(size),
|
|
2612
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
2613
|
+
onClick: cancel,
|
|
2614
|
+
"aria-label": "Cancel editing",
|
|
2615
|
+
children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faXmark })
|
|
2616
|
+
})
|
|
2617
|
+
]
|
|
2618
|
+
});
|
|
2619
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2620
|
+
ref,
|
|
2621
|
+
className: cn(editableTitleVariants({ size }), "group", className),
|
|
2622
|
+
...props,
|
|
2623
|
+
children: [
|
|
2624
|
+
/* @__PURE__ */ jsx("span", {
|
|
2625
|
+
className: cn("cursor-pointer hover:text-primary transition-colors duration-fast ease-default", disabled && "cursor-default hover:text-foreground", loading && "cursor-wait hover:text-foreground opacity-70"),
|
|
2626
|
+
onClick: startEditing,
|
|
2627
|
+
role: "button",
|
|
2628
|
+
tabIndex: disabled ? -1 : 0,
|
|
2629
|
+
onKeyDown: (e) => {
|
|
2630
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2631
|
+
e.preventDefault();
|
|
2632
|
+
startEditing();
|
|
2633
|
+
}
|
|
2634
|
+
},
|
|
2635
|
+
"aria-label": disabled ? value : `Edit title: ${value}`,
|
|
2636
|
+
children: value || placeholder
|
|
2637
|
+
}),
|
|
2638
|
+
!disabled && !loading && /* @__PURE__ */ jsx(Button, {
|
|
2639
|
+
type: "button",
|
|
2640
|
+
variant: "actionNeutral",
|
|
2641
|
+
size: "icon",
|
|
2642
|
+
className: cn("transition-opacity duration-fast ease-default", titleActionButtonClass(size), suppressPenReveal ? "pointer-events-none opacity-0" : "opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),
|
|
2643
|
+
onClick: startEditing,
|
|
2644
|
+
tabIndex: -1,
|
|
2645
|
+
"aria-hidden": "true",
|
|
2646
|
+
children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faPen })
|
|
2647
|
+
}),
|
|
2648
|
+
loading && /* @__PURE__ */ jsx("span", {
|
|
2649
|
+
className: cn("inline-flex items-center justify-center shrink-0 rounded-md text-muted-foreground", loadingSpinnerWrapClass(size), "animate-spin pointer-events-none"),
|
|
2650
|
+
"aria-label": "Saving",
|
|
2651
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
2652
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2653
|
+
fill: "none",
|
|
2654
|
+
viewBox: "0 0 24 24",
|
|
2655
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
2656
|
+
className: "opacity-25",
|
|
2657
|
+
cx: "12",
|
|
2658
|
+
cy: "12",
|
|
2659
|
+
r: "10",
|
|
2660
|
+
stroke: "currentColor",
|
|
2661
|
+
strokeWidth: "4"
|
|
2662
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
2663
|
+
className: "opacity-75",
|
|
2664
|
+
fill: "currentColor",
|
|
2665
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
2666
|
+
})]
|
|
2667
|
+
})
|
|
2668
|
+
})
|
|
2669
|
+
]
|
|
2670
|
+
});
|
|
2671
|
+
});
|
|
2672
|
+
EditableTitle.displayName = "EditableTitle";
|
|
2673
|
+
//#endregion
|
|
2403
2674
|
//#region src/components/aspect-ratio.tsx
|
|
2404
2675
|
const AspectRatio = AspectRatio$1.Root;
|
|
2405
2676
|
//#endregion
|
|
@@ -4216,6 +4487,6 @@ function NotificationSettingsBlock({ groups, onSave, loading = false, error, dis
|
|
|
4216
4487
|
});
|
|
4217
4488
|
}
|
|
4218
4489
|
//#endregion
|
|
4219
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppSidebarBlock, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataTable, DataTableColumnHeader, DatePicker, DateRangePicker, DensityProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyStateBlock, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, Input, Label, MaintenanceBlock, MediaCard, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, Popover, PopoverContent, PopoverTrigger, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, ResetPasswordBlock, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarBlock, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SignInBlock, SignUpBlock, Skeleton, Slider, SocialProviders, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TextContent, TextEditor, Textarea, ThemeProvider, ThemeScope, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VerifyBlock, avatarVariants, badgeVariants, buttonVariants, cn, dateRangePresets, navigationMenuTriggerStyle, progressBarVariants, spinnerVariants, toast, useDensity, useFormContext, useIsMobile, useScrollReveal, useSidebar, useTheme };
|
|
4490
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppSidebarBlock, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataTable, DataTableColumnHeader, DatePicker, DateRangePicker, DensityProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditableTitle, EmptyStateBlock, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, Input, Label, MaintenanceBlock, MediaCard, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, Popover, PopoverContent, PopoverTrigger, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, ResetPasswordBlock, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarBlock, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SignInBlock, SignUpBlock, Skeleton, Slider, SocialProviders, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TextContent, TextEditor, Textarea, ThemeProvider, ThemeScope, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VerifyBlock, actionNegativeToneClasses, actionNeutralIconChromeClasses, actionNeutralToneClasses, actionPositiveToneClasses, avatarVariants, badgeVariants, buttonVariants, cn, dateRangePresets, editableTitleVariants, navigationMenuTriggerStyle, progressBarVariants, spinnerVariants, toast, useDensity, useFormContext, useIsMobile, useScrollReveal, useSidebar, useTheme };
|
|
4220
4491
|
|
|
4221
4492
|
//# sourceMappingURL=index.mjs.map
|