@bison-lab/ui 0.18.1 → 0.19.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 +15 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +177 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -90,25 +90,43 @@ function useIsMobile() {
|
|
|
90
90
|
const ThemeProviderContext = React.createContext(void 0);
|
|
91
91
|
function ThemeProvider({ children, defaultTheme = "system", storageKey = "bison-theme", attribute = "data-theme", ...props }) {
|
|
92
92
|
const [theme, setTheme] = React.useState(defaultTheme);
|
|
93
|
+
const [systemTheme, setSystemTheme] = React.useState(void 0);
|
|
93
94
|
React.useEffect(() => {
|
|
94
95
|
const stored = localStorage.getItem(storageKey);
|
|
95
96
|
if (stored) setTheme(stored);
|
|
96
97
|
}, [storageKey]);
|
|
97
98
|
React.useEffect(() => {
|
|
99
|
+
const media = window.matchMedia("(prefers-color-scheme: dark)");
|
|
100
|
+
setSystemTheme(media.matches ? "dark" : "light");
|
|
101
|
+
const handleChange = (event) => {
|
|
102
|
+
setSystemTheme(event.matches ? "dark" : "light");
|
|
103
|
+
};
|
|
104
|
+
media.addEventListener("change", handleChange);
|
|
105
|
+
return () => media.removeEventListener("change", handleChange);
|
|
106
|
+
}, []);
|
|
107
|
+
const resolvedTheme = theme === "light" || theme === "dark" ? theme : systemTheme;
|
|
108
|
+
React.useEffect(() => {
|
|
109
|
+
if (!resolvedTheme) return;
|
|
98
110
|
const root = window.document.documentElement;
|
|
99
|
-
const resolved = theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : theme;
|
|
100
111
|
if (attribute === "class") {
|
|
101
112
|
root.classList.remove("light", "dark");
|
|
102
|
-
root.classList.add(
|
|
103
|
-
} else root.setAttribute(attribute,
|
|
104
|
-
}, [
|
|
113
|
+
root.classList.add(resolvedTheme);
|
|
114
|
+
} else root.setAttribute(attribute, resolvedTheme);
|
|
115
|
+
}, [resolvedTheme, attribute]);
|
|
105
116
|
const value = React.useMemo(() => ({
|
|
106
117
|
theme,
|
|
118
|
+
resolvedTheme,
|
|
119
|
+
systemTheme,
|
|
107
120
|
setTheme: (newTheme) => {
|
|
108
121
|
localStorage.setItem(storageKey, newTheme);
|
|
109
122
|
setTheme(newTheme);
|
|
110
123
|
}
|
|
111
|
-
}), [
|
|
124
|
+
}), [
|
|
125
|
+
theme,
|
|
126
|
+
resolvedTheme,
|
|
127
|
+
systemTheme,
|
|
128
|
+
storageKey
|
|
129
|
+
]);
|
|
112
130
|
return /* @__PURE__ */ jsx(ThemeProviderContext.Provider, {
|
|
113
131
|
...props,
|
|
114
132
|
value,
|
|
@@ -396,15 +414,15 @@ function FormError({ message, className }) {
|
|
|
396
414
|
}
|
|
397
415
|
//#endregion
|
|
398
416
|
//#region src/components/button.tsx
|
|
399
|
-
const buttonVariants = cva("relative inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-
|
|
417
|
+
const buttonVariants = cva("relative inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-[color,background-color,border-color,box-shadow] duration-fast ease-default focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-pointer", {
|
|
400
418
|
variants: {
|
|
401
419
|
variant: {
|
|
402
|
-
default: "bg-primary text-primary-foreground hover:bg-primary
|
|
403
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary
|
|
404
|
-
accent: "bg-brand-accent text-brand-accent-foreground hover:bg-brand-accent
|
|
405
|
-
highlight: "bg-highlight text-highlight-foreground hover:bg-highlight
|
|
406
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive
|
|
407
|
-
outline: "border border-border-strong bg-background text-foreground hover:bg-accent hover:text-accent-foreground",
|
|
420
|
+
default: "bg-primary text-primary-foreground hover:bg-primary-700 hover:shadow-md",
|
|
421
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary-700 hover:shadow-md",
|
|
422
|
+
accent: "bg-brand-accent text-brand-accent-foreground hover:bg-brand-accent-600 hover:shadow-md",
|
|
423
|
+
highlight: "bg-highlight text-highlight-foreground hover:bg-highlight-600 hover:shadow-md",
|
|
424
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive-700 hover:shadow-md",
|
|
425
|
+
outline: "border border-border-strong bg-background text-foreground hover:bg-accent hover:text-accent-foreground hover:shadow-sm",
|
|
408
426
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
409
427
|
actionNeutral: actionNeutralToneClasses,
|
|
410
428
|
actionPositive: actionPositiveToneClasses,
|
|
@@ -472,11 +490,80 @@ const Button = React.forwardRef(({ className, variant, size, fullWidth, asChild
|
|
|
472
490
|
});
|
|
473
491
|
Button.displayName = "Button";
|
|
474
492
|
//#endregion
|
|
493
|
+
//#region src/lib/surface-classes.ts
|
|
494
|
+
/**
|
|
495
|
+
* Shared surface class strings extracted to a single source of truth.
|
|
496
|
+
*
|
|
497
|
+
* These patterns appear in multiple components that must stay in lockstep
|
|
498
|
+
* visually (same border, same focus ring, same scrim, etc.). When any of
|
|
499
|
+
* these visuals change, update here once — every consumer tracks.
|
|
500
|
+
*
|
|
501
|
+
* See components: input, textarea, password-input, currency-input,
|
|
502
|
+
* select, dropdown-menu, context-menu, command, dialog, alert-dialog,
|
|
503
|
+
* sheet, popover, tooltip.
|
|
504
|
+
*/
|
|
505
|
+
/**
|
|
506
|
+
* Common chrome for form input surfaces: border, background, ring-offset,
|
|
507
|
+
* placeholder color, disabled state. Does NOT include sizing or focus —
|
|
508
|
+
* consumers add `inputSizingClasses` (or their own) + `inputFocusClasses`.
|
|
509
|
+
*
|
|
510
|
+
* Used by: Input, Textarea, PasswordInput, CurrencyInput, Select Trigger,
|
|
511
|
+
* DatePicker trigger, DateRangePicker trigger.
|
|
512
|
+
*/
|
|
513
|
+
const inputSurfaceClasses = "flex w-full rounded-md border border-input bg-background text-base sm:text-sm ring-offset-background placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50";
|
|
514
|
+
/**
|
|
515
|
+
* Focus-visible ring for input surfaces. Keyboard focus only (`focus-visible`)
|
|
516
|
+
* so mouse clicks don't show the ring — matches WAI-ARIA expectations.
|
|
517
|
+
*/
|
|
518
|
+
const inputFocusClasses = "focus-visible:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/30 focus-visible:ring-offset-0";
|
|
519
|
+
/**
|
|
520
|
+
* Standard single-line input sizing: md-density height + 12px padding-x + 8px padding-y.
|
|
521
|
+
* Textarea uses `min-h-[80px]` instead.
|
|
522
|
+
*/
|
|
523
|
+
const inputSizingClasses = "h-[var(--density-height-md)] px-3 py-2";
|
|
524
|
+
/**
|
|
525
|
+
* Menu surface chrome shared by floating menus and popovers:
|
|
526
|
+
* Select Content, DropdownMenu Content, ContextMenu Content, Command.
|
|
527
|
+
*
|
|
528
|
+
* Uses `--z-dropdown` (500 after z-index refactor) so menus open *above*
|
|
529
|
+
* modals they're triggered from — critical for Select inside a Dialog, etc.
|
|
530
|
+
*/
|
|
531
|
+
const menuSurfaceClasses = "z-[var(--z-dropdown)] min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md";
|
|
532
|
+
/**
|
|
533
|
+
* Base menu item: focus styling, disabled state, selection-ready.
|
|
534
|
+
* Used by: Select Item, DropdownMenu Item, ContextMenu Item, Command Item.
|
|
535
|
+
*/
|
|
536
|
+
const menuItemClasses = "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
|
|
537
|
+
/**
|
|
538
|
+
* Menu item variant with indicator gutter on the left (for checkbox/radio
|
|
539
|
+
* indicators on Select, DropdownMenu, ContextMenu).
|
|
540
|
+
*/
|
|
541
|
+
const menuItemWithIndicatorClasses = "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
|
|
542
|
+
/**
|
|
543
|
+
* Menu separator: horizontal rule sitting between menu groups.
|
|
544
|
+
*/
|
|
545
|
+
const menuSeparatorClasses = "-mx-1 my-1 h-px bg-muted";
|
|
546
|
+
/**
|
|
547
|
+
* Radix state-driven animations for open/close + slide-in from side.
|
|
548
|
+
* Used by Select Content, DropdownMenu Content, ContextMenu Content,
|
|
549
|
+
* Popover Content, Tooltip Content, Command popovers.
|
|
550
|
+
*/
|
|
551
|
+
const floatingAnimationClasses = "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";
|
|
552
|
+
/**
|
|
553
|
+
* Scrim (backdrop) shared by Dialog, AlertDialog, Sheet.
|
|
554
|
+
*/
|
|
555
|
+
const overlayScrimClasses = "fixed inset-0 z-[var(--z-modal-backdrop)] bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0";
|
|
556
|
+
/**
|
|
557
|
+
* Centered modal content positioning + chrome (Dialog, AlertDialog).
|
|
558
|
+
* Sheet has its own side-anchored variants in `sheet.tsx`.
|
|
559
|
+
*/
|
|
560
|
+
const centeredModalContentClasses = "fixed left-[50%] top-[50%] z-[var(--z-modal)] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-normal rounded-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]";
|
|
561
|
+
//#endregion
|
|
475
562
|
//#region src/components/input.tsx
|
|
476
563
|
const Input = React.forwardRef(({ className, type, ...props }, ref) => {
|
|
477
564
|
return /* @__PURE__ */ jsx("input", {
|
|
478
565
|
type,
|
|
479
|
-
className: cn(
|
|
566
|
+
className: cn(inputSurfaceClasses, inputSizingClasses, inputFocusClasses, "file:border-0 file:bg-transparent file:text-base file:font-medium sm:file:text-sm", className),
|
|
480
567
|
ref,
|
|
481
568
|
...props
|
|
482
569
|
});
|
|
@@ -488,7 +575,7 @@ const PasswordInput = React.forwardRef(({ className, ...props }, ref) => {
|
|
|
488
575
|
return /* @__PURE__ */ jsx(unstable_PasswordToggleField.Root, { children: /* @__PURE__ */ jsxs("div", {
|
|
489
576
|
className: "relative",
|
|
490
577
|
children: [/* @__PURE__ */ jsx(unstable_PasswordToggleField.Input, {
|
|
491
|
-
className: cn(
|
|
578
|
+
className: cn(inputSurfaceClasses, inputSizingClasses, inputFocusClasses, "pr-10 file:border-0 file:bg-transparent file:text-base file:font-medium sm:file:text-sm", className),
|
|
492
579
|
ref,
|
|
493
580
|
...props
|
|
494
581
|
}), /* @__PURE__ */ jsx(unstable_PasswordToggleField.Toggle, {
|
|
@@ -618,7 +705,7 @@ const CurrencyInput = React.forwardRef(({ className, value, onChange, symbol = "
|
|
|
618
705
|
value: display,
|
|
619
706
|
onChange: handleChange,
|
|
620
707
|
onBlur: handleBlur,
|
|
621
|
-
className: cn(
|
|
708
|
+
className: cn(inputSurfaceClasses, inputSizingClasses, inputFocusClasses, "pl-7 pr-3 text-sm", className),
|
|
622
709
|
...props
|
|
623
710
|
})]
|
|
624
711
|
});
|
|
@@ -664,7 +751,7 @@ InputGroup.displayName = "InputGroup";
|
|
|
664
751
|
//#region src/components/textarea.tsx
|
|
665
752
|
const Textarea = React.forwardRef(({ className, ...props }, ref) => {
|
|
666
753
|
return /* @__PURE__ */ jsx("textarea", {
|
|
667
|
-
className: cn("
|
|
754
|
+
className: cn(inputSurfaceClasses, "min-h-[80px] px-3 py-2", inputFocusClasses, className),
|
|
668
755
|
ref,
|
|
669
756
|
...props
|
|
670
757
|
});
|
|
@@ -677,7 +764,7 @@ const SelectGroup = Select$1.Group;
|
|
|
677
764
|
const SelectValue = Select$1.Value;
|
|
678
765
|
const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(Select$1.Trigger, {
|
|
679
766
|
ref,
|
|
680
|
-
className: cn(
|
|
767
|
+
className: cn(inputSurfaceClasses, inputSizingClasses, inputFocusClasses, "items-center justify-between [&>span]:line-clamp-1", className),
|
|
681
768
|
...props,
|
|
682
769
|
children: [children, /* @__PURE__ */ jsx(Select$1.Icon, {
|
|
683
770
|
asChild: true,
|
|
@@ -710,7 +797,7 @@ const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) =
|
|
|
710
797
|
SelectScrollDownButton.displayName = Select$1.ScrollDownButton.displayName;
|
|
711
798
|
const SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsxs(Select$1.Content, {
|
|
712
799
|
ref,
|
|
713
|
-
className: cn("relative
|
|
800
|
+
className: cn(menuSurfaceClasses, floatingAnimationClasses, "relative max-h-96 p-0", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
|
|
714
801
|
position,
|
|
715
802
|
...props,
|
|
716
803
|
children: [
|
|
@@ -731,7 +818,7 @@ const SelectLabel = React.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
731
818
|
SelectLabel.displayName = Select$1.Label.displayName;
|
|
732
819
|
const SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(Select$1.Item, {
|
|
733
820
|
ref,
|
|
734
|
-
className: cn("
|
|
821
|
+
className: cn(menuItemWithIndicatorClasses, "w-full", className),
|
|
735
822
|
...props,
|
|
736
823
|
children: [/* @__PURE__ */ jsx("span", {
|
|
737
824
|
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
@@ -744,7 +831,7 @@ const SelectItem = React.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
744
831
|
SelectItem.displayName = Select$1.Item.displayName;
|
|
745
832
|
const SelectSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Select$1.Separator, {
|
|
746
833
|
ref,
|
|
747
|
-
className: cn(
|
|
834
|
+
className: cn(menuSeparatorClasses, className),
|
|
748
835
|
...props
|
|
749
836
|
}));
|
|
750
837
|
SelectSeparator.displayName = Select$1.Separator.displayName;
|
|
@@ -796,7 +883,7 @@ const PopoverContent = React.forwardRef(({ className, align = "center", sideOffs
|
|
|
796
883
|
ref,
|
|
797
884
|
align,
|
|
798
885
|
sideOffset,
|
|
799
|
-
className: cn("z-[var(--z-popover)] w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none
|
|
886
|
+
className: cn("z-[var(--z-popover)] w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none", floatingAnimationClasses, className),
|
|
800
887
|
...props
|
|
801
888
|
}) }));
|
|
802
889
|
PopoverContent.displayName = Popover$1.Content.displayName;
|
|
@@ -1040,7 +1127,7 @@ const TooltipTrigger = Tooltip$1.Trigger;
|
|
|
1040
1127
|
const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(Tooltip$1.Content, {
|
|
1041
1128
|
ref,
|
|
1042
1129
|
sideOffset,
|
|
1043
|
-
className: cn("z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md
|
|
1130
|
+
className: cn("z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md", floatingAnimationClasses, className),
|
|
1044
1131
|
...props
|
|
1045
1132
|
}));
|
|
1046
1133
|
TooltipContent.displayName = Tooltip$1.Content.displayName;
|
|
@@ -1439,7 +1526,7 @@ const alertVariants = cva("relative w-full rounded-[var(--radius-md)] border p-4
|
|
|
1439
1526
|
default: "bg-muted/50 text-foreground border-border [&_[data-alert-icon]]:text-muted-foreground dark:bg-muted/30 dark:border-border-strong",
|
|
1440
1527
|
destructive: "border-destructive-300 bg-destructive-50 text-destructive-900 [&_[data-alert-icon]]:text-destructive-600 dark:border-destructive-700 dark:bg-destructive-900/60 dark:text-destructive-100 dark:[&_[data-alert-icon]]:text-destructive-300",
|
|
1441
1528
|
success: "border-success-300 bg-success-50 text-success-900 [&_[data-alert-icon]]:text-success-600 dark:border-success-700 dark:bg-success-900/60 dark:text-success-100 dark:[&_[data-alert-icon]]:text-success-300",
|
|
1442
|
-
warning: "border-
|
|
1529
|
+
warning: "border-warning-300 bg-warning-50 text-warning-900 [&_[data-alert-icon]]:text-warning-600 dark:border-warning-700 dark:bg-warning-900/60 dark:text-warning-100 dark:[&_[data-alert-icon]]:text-warning-300",
|
|
1443
1530
|
danger: "border-destructive-300 bg-destructive-50 text-destructive-900 [&_[data-alert-icon]]:text-destructive-600 dark:border-destructive-700 dark:bg-destructive-900/60 dark:text-destructive-100 dark:[&_[data-alert-icon]]:text-destructive-300",
|
|
1444
1531
|
info: "border-primary-300 bg-primary-50 text-primary-900 [&_[data-alert-icon]]:text-primary-600 dark:border-primary-700 dark:bg-primary-900/60 dark:text-primary-100 dark:[&_[data-alert-icon]]:text-primary-300"
|
|
1445
1532
|
} },
|
|
@@ -1504,16 +1591,16 @@ AlertDescription.displayName = "AlertDescription";
|
|
|
1504
1591
|
//#region src/components/badge.tsx
|
|
1505
1592
|
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-primary/40 focus:ring-offset-2", {
|
|
1506
1593
|
variants: { variant: {
|
|
1507
|
-
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary
|
|
1508
|
-
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary
|
|
1509
|
-
accent: "border-transparent bg-brand-accent text-brand-accent-foreground hover:bg-brand-accent
|
|
1510
|
-
highlight: "border-transparent bg-highlight text-highlight-foreground hover:bg-highlight
|
|
1511
|
-
destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive
|
|
1594
|
+
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary-700",
|
|
1595
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary-700",
|
|
1596
|
+
accent: "border-transparent bg-brand-accent text-brand-accent-foreground hover:bg-brand-accent-600",
|
|
1597
|
+
highlight: "border-transparent bg-highlight text-highlight-foreground hover:bg-highlight-600",
|
|
1598
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive-700",
|
|
1512
1599
|
outline: "text-foreground",
|
|
1513
|
-
success: "border-
|
|
1514
|
-
warning: "border-
|
|
1515
|
-
error: "border-
|
|
1516
|
-
info: "border-
|
|
1600
|
+
success: "border-success-500/30 bg-success-500/10 text-success-700 dark:border-success-400/30 dark:bg-success-400/10 dark:text-success-400",
|
|
1601
|
+
warning: "border-warning-500/30 bg-warning-500/10 text-warning-700 dark:border-warning-400/30 dark:bg-warning-400/10 dark:text-warning-400",
|
|
1602
|
+
error: "border-destructive-500/30 bg-destructive-500/10 text-destructive-700 dark:border-destructive-400/30 dark:bg-destructive-400/10 dark:text-destructive-400",
|
|
1603
|
+
info: "border-primary-500/30 bg-primary-500/10 text-primary-700 dark:border-primary-400/30 dark:bg-primary-400/10 dark:text-primary-400"
|
|
1517
1604
|
} },
|
|
1518
1605
|
defaultVariants: { variant: "default" }
|
|
1519
1606
|
});
|
|
@@ -1559,13 +1646,13 @@ const DialogPortal = Dialog$1.Portal;
|
|
|
1559
1646
|
const DialogClose = Dialog$1.Close;
|
|
1560
1647
|
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Dialog$1.Overlay, {
|
|
1561
1648
|
ref,
|
|
1562
|
-
className: cn(
|
|
1649
|
+
className: cn(overlayScrimClasses, className),
|
|
1563
1650
|
...props
|
|
1564
1651
|
}));
|
|
1565
1652
|
DialogOverlay.displayName = Dialog$1.Overlay.displayName;
|
|
1566
1653
|
const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Dialog$1.Content, {
|
|
1567
1654
|
ref,
|
|
1568
|
-
className: cn(
|
|
1655
|
+
className: cn(centeredModalContentClasses, className),
|
|
1569
1656
|
...props,
|
|
1570
1657
|
children: [children, /* @__PURE__ */ jsxs(Dialog$1.Close, {
|
|
1571
1658
|
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-primary/40 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
|
|
@@ -1607,14 +1694,14 @@ const AlertDialog = AlertDialog$1.Root;
|
|
|
1607
1694
|
const AlertDialogTrigger = AlertDialog$1.Trigger;
|
|
1608
1695
|
const AlertDialogPortal = AlertDialog$1.Portal;
|
|
1609
1696
|
const AlertDialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AlertDialog$1.Overlay, {
|
|
1610
|
-
className: cn(
|
|
1697
|
+
className: cn(overlayScrimClasses, className),
|
|
1611
1698
|
...props,
|
|
1612
1699
|
ref
|
|
1613
1700
|
}));
|
|
1614
1701
|
AlertDialogOverlay.displayName = AlertDialog$1.Overlay.displayName;
|
|
1615
1702
|
const AlertDialogContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [/* @__PURE__ */ jsx(AlertDialogOverlay, {}), /* @__PURE__ */ jsx(AlertDialog$1.Content, {
|
|
1616
1703
|
ref,
|
|
1617
|
-
className: cn(
|
|
1704
|
+
className: cn(centeredModalContentClasses, className),
|
|
1618
1705
|
...props
|
|
1619
1706
|
})] }));
|
|
1620
1707
|
AlertDialogContent.displayName = AlertDialog$1.Content.displayName;
|
|
@@ -1657,7 +1744,7 @@ const SheetTrigger = Dialog$1.Trigger;
|
|
|
1657
1744
|
const SheetClose = Dialog$1.Close;
|
|
1658
1745
|
const SheetPortal = Dialog$1.Portal;
|
|
1659
1746
|
const SheetOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Dialog$1.Overlay, {
|
|
1660
|
-
className: cn(
|
|
1747
|
+
className: cn(overlayScrimClasses, className),
|
|
1661
1748
|
...props,
|
|
1662
1749
|
ref
|
|
1663
1750
|
}));
|
|
@@ -1776,6 +1863,12 @@ const SheetDescription = React.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
1776
1863
|
SheetDescription.displayName = Dialog$1.Description.displayName;
|
|
1777
1864
|
//#endregion
|
|
1778
1865
|
//#region src/components/dropdown-menu.tsx
|
|
1866
|
+
/**
|
|
1867
|
+
* DropdownMenu — visually mirrored by `context-menu.tsx`. Both pull chrome
|
|
1868
|
+
* from `lib/surface-classes.ts` (menuSurfaceClasses, menuItemClasses, etc.)
|
|
1869
|
+
* so they stay in lockstep. Edit the shared classes file, not this one or
|
|
1870
|
+
* context-menu.tsx, when tweaking menu visuals.
|
|
1871
|
+
*/
|
|
1779
1872
|
const DropdownMenu = DropdownMenu$1.Root;
|
|
1780
1873
|
const DropdownMenuTrigger = DropdownMenu$1.Trigger;
|
|
1781
1874
|
const DropdownMenuGroup = DropdownMenu$1.Group;
|
|
@@ -1784,7 +1877,7 @@ const DropdownMenuSub = DropdownMenu$1.Sub;
|
|
|
1784
1877
|
const DropdownMenuRadioGroup = DropdownMenu$1.RadioGroup;
|
|
1785
1878
|
const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenu$1.SubTrigger, {
|
|
1786
1879
|
ref,
|
|
1787
|
-
className: cn("
|
|
1880
|
+
className: cn(menuItemClasses, "data-[state=open]:bg-accent", inset && "pl-8", className),
|
|
1788
1881
|
...props,
|
|
1789
1882
|
children: [children, /* @__PURE__ */ jsx(FontAwesomeIcon, {
|
|
1790
1883
|
icon: faChevronRight,
|
|
@@ -1794,26 +1887,26 @@ const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children, .
|
|
|
1794
1887
|
DropdownMenuSubTrigger.displayName = DropdownMenu$1.SubTrigger.displayName;
|
|
1795
1888
|
const DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenu$1.SubContent, {
|
|
1796
1889
|
ref,
|
|
1797
|
-
className: cn(
|
|
1890
|
+
className: cn(menuSurfaceClasses, floatingAnimationClasses, "shadow-lg", className),
|
|
1798
1891
|
...props
|
|
1799
1892
|
}));
|
|
1800
1893
|
DropdownMenuSubContent.displayName = DropdownMenu$1.SubContent.displayName;
|
|
1801
1894
|
const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenu$1.Portal, { children: /* @__PURE__ */ jsx(DropdownMenu$1.Content, {
|
|
1802
1895
|
ref,
|
|
1803
1896
|
sideOffset,
|
|
1804
|
-
className: cn(
|
|
1897
|
+
className: cn(menuSurfaceClasses, floatingAnimationClasses, className),
|
|
1805
1898
|
...props
|
|
1806
1899
|
}) }));
|
|
1807
1900
|
DropdownMenuContent.displayName = DropdownMenu$1.Content.displayName;
|
|
1808
1901
|
const DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenu$1.Item, {
|
|
1809
1902
|
ref,
|
|
1810
|
-
className: cn(
|
|
1903
|
+
className: cn(menuItemClasses, inset && "pl-8", className),
|
|
1811
1904
|
...props
|
|
1812
1905
|
}));
|
|
1813
1906
|
DropdownMenuItem.displayName = DropdownMenu$1.Item.displayName;
|
|
1814
1907
|
const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenu$1.CheckboxItem, {
|
|
1815
1908
|
ref,
|
|
1816
|
-
className: cn(
|
|
1909
|
+
className: cn(menuItemWithIndicatorClasses, className),
|
|
1817
1910
|
checked,
|
|
1818
1911
|
...props,
|
|
1819
1912
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -1827,7 +1920,7 @@ const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checke
|
|
|
1827
1920
|
DropdownMenuCheckboxItem.displayName = DropdownMenu$1.CheckboxItem.displayName;
|
|
1828
1921
|
const DropdownMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenu$1.RadioItem, {
|
|
1829
1922
|
ref,
|
|
1830
|
-
className: cn(
|
|
1923
|
+
className: cn(menuItemWithIndicatorClasses, className),
|
|
1831
1924
|
...props,
|
|
1832
1925
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1833
1926
|
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
@@ -1846,7 +1939,7 @@ const DropdownMenuLabel = React.forwardRef(({ className, inset, ...props }, ref)
|
|
|
1846
1939
|
DropdownMenuLabel.displayName = DropdownMenu$1.Label.displayName;
|
|
1847
1940
|
const DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenu$1.Separator, {
|
|
1848
1941
|
ref,
|
|
1849
|
-
className: cn(
|
|
1942
|
+
className: cn(menuSeparatorClasses, className),
|
|
1850
1943
|
...props
|
|
1851
1944
|
}));
|
|
1852
1945
|
DropdownMenuSeparator.displayName = DropdownMenu$1.Separator.displayName;
|
|
@@ -2298,10 +2391,10 @@ DataTable.displayName = "DataTable";
|
|
|
2298
2391
|
//#region src/components/progress.tsx
|
|
2299
2392
|
const Progress = React.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ jsx(Progress$1.Root, {
|
|
2300
2393
|
ref,
|
|
2301
|
-
className: cn("relative h-4 w-full overflow-hidden rounded-full bg-
|
|
2394
|
+
className: cn("relative h-4 w-full overflow-hidden rounded-full bg-muted", className),
|
|
2302
2395
|
...props,
|
|
2303
2396
|
children: /* @__PURE__ */ jsx(Progress$1.Indicator, {
|
|
2304
|
-
className: "h-full w-full flex-1 bg-
|
|
2397
|
+
className: "h-full w-full flex-1 bg-primary transition-all duration-normal ease-default",
|
|
2305
2398
|
style: { transform: `translateX(-${100 - (value || 0)}%)` }
|
|
2306
2399
|
})
|
|
2307
2400
|
}));
|
|
@@ -2318,7 +2411,7 @@ const progressBarVariants = cva("h-full rounded-full transition-all duration-nor
|
|
|
2318
2411
|
} },
|
|
2319
2412
|
defaultVariants: { color: "primary" }
|
|
2320
2413
|
});
|
|
2321
|
-
const progressBarTrackVariants = cva("relative w-full overflow-hidden rounded-full bg-
|
|
2414
|
+
const progressBarTrackVariants = cva("relative w-full overflow-hidden rounded-full bg-muted", {
|
|
2322
2415
|
variants: { size: {
|
|
2323
2416
|
sm: "h-1.5",
|
|
2324
2417
|
md: "h-2.5",
|
|
@@ -2529,6 +2622,16 @@ const SavedPing = React.forwardRef(({ pingCount, label = "Saved", className, "da
|
|
|
2529
2622
|
SavedPing.displayName = "SavedPing";
|
|
2530
2623
|
//#endregion
|
|
2531
2624
|
//#region src/components/context-menu.tsx
|
|
2625
|
+
/**
|
|
2626
|
+
* ContextMenu mirrors `dropdown-menu.tsx` visually — Radix UI ships them as
|
|
2627
|
+
* separate primitives because the trigger semantics differ (right-click vs
|
|
2628
|
+
* click), but the rendered chrome is identical. Both import from
|
|
2629
|
+
* `lib/surface-classes.ts` so any visual tweak updates both automatically.
|
|
2630
|
+
*
|
|
2631
|
+
* If you need to change the look of menus, edit `surface-classes.ts`
|
|
2632
|
+
* (the `menuSurfaceClasses` / `menuItemClasses` exports). Do NOT edit one
|
|
2633
|
+
* of these files without the other.
|
|
2634
|
+
*/
|
|
2532
2635
|
const ContextMenu = ContextMenu$1.Root;
|
|
2533
2636
|
const ContextMenuTrigger = ContextMenu$1.Trigger;
|
|
2534
2637
|
const ContextMenuGroup = ContextMenu$1.Group;
|
|
@@ -2537,7 +2640,7 @@ const ContextMenuSub = ContextMenu$1.Sub;
|
|
|
2537
2640
|
const ContextMenuRadioGroup = ContextMenu$1.RadioGroup;
|
|
2538
2641
|
const ContextMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(ContextMenu$1.SubTrigger, {
|
|
2539
2642
|
ref,
|
|
2540
|
-
className: cn("
|
|
2643
|
+
className: cn(menuItemClasses, "data-[state=open]:bg-accent data-[state=open]:text-accent-foreground", inset && "pl-8", className),
|
|
2541
2644
|
...props,
|
|
2542
2645
|
children: [children, /* @__PURE__ */ jsx(FontAwesomeIcon, {
|
|
2543
2646
|
icon: faChevronRight,
|
|
@@ -2547,25 +2650,25 @@ const ContextMenuSubTrigger = React.forwardRef(({ className, inset, children, ..
|
|
|
2547
2650
|
ContextMenuSubTrigger.displayName = ContextMenu$1.SubTrigger.displayName;
|
|
2548
2651
|
const ContextMenuSubContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(ContextMenu$1.SubContent, {
|
|
2549
2652
|
ref,
|
|
2550
|
-
className: cn(
|
|
2653
|
+
className: cn(menuSurfaceClasses, floatingAnimationClasses, className),
|
|
2551
2654
|
...props
|
|
2552
2655
|
}));
|
|
2553
2656
|
ContextMenuSubContent.displayName = ContextMenu$1.SubContent.displayName;
|
|
2554
2657
|
const ContextMenuContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(ContextMenu$1.Portal, { children: /* @__PURE__ */ jsx(ContextMenu$1.Content, {
|
|
2555
2658
|
ref,
|
|
2556
|
-
className: cn(
|
|
2659
|
+
className: cn(menuSurfaceClasses, floatingAnimationClasses, className),
|
|
2557
2660
|
...props
|
|
2558
2661
|
}) }));
|
|
2559
2662
|
ContextMenuContent.displayName = ContextMenu$1.Content.displayName;
|
|
2560
2663
|
const ContextMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(ContextMenu$1.Item, {
|
|
2561
2664
|
ref,
|
|
2562
|
-
className: cn(
|
|
2665
|
+
className: cn(menuItemClasses, inset && "pl-8", className),
|
|
2563
2666
|
...props
|
|
2564
2667
|
}));
|
|
2565
2668
|
ContextMenuItem.displayName = ContextMenu$1.Item.displayName;
|
|
2566
2669
|
const ContextMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(ContextMenu$1.CheckboxItem, {
|
|
2567
2670
|
ref,
|
|
2568
|
-
className: cn(
|
|
2671
|
+
className: cn(menuItemWithIndicatorClasses, className),
|
|
2569
2672
|
checked,
|
|
2570
2673
|
...props,
|
|
2571
2674
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -2579,7 +2682,7 @@ const ContextMenuCheckboxItem = React.forwardRef(({ className, children, checked
|
|
|
2579
2682
|
ContextMenuCheckboxItem.displayName = ContextMenu$1.CheckboxItem.displayName;
|
|
2580
2683
|
const ContextMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(ContextMenu$1.RadioItem, {
|
|
2581
2684
|
ref,
|
|
2582
|
-
className: cn(
|
|
2685
|
+
className: cn(menuItemWithIndicatorClasses, className),
|
|
2583
2686
|
...props,
|
|
2584
2687
|
children: [/* @__PURE__ */ jsx("span", {
|
|
2585
2688
|
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
@@ -2598,7 +2701,7 @@ const ContextMenuLabel = React.forwardRef(({ className, inset, ...props }, ref)
|
|
|
2598
2701
|
ContextMenuLabel.displayName = ContextMenu$1.Label.displayName;
|
|
2599
2702
|
const ContextMenuSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(ContextMenu$1.Separator, {
|
|
2600
2703
|
ref,
|
|
2601
|
-
className: cn(
|
|
2704
|
+
className: cn(menuSeparatorClasses, className),
|
|
2602
2705
|
...props
|
|
2603
2706
|
}));
|
|
2604
2707
|
ContextMenuSeparator.displayName = ContextMenu$1.Separator.displayName;
|
|
@@ -2842,7 +2945,7 @@ const CommandSeparator = React.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
2842
2945
|
CommandSeparator.displayName = Command$1.Separator.displayName;
|
|
2843
2946
|
const CommandItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Command$1.Item, {
|
|
2844
2947
|
ref,
|
|
2845
|
-
className: cn("
|
|
2948
|
+
className: cn(menuItemClasses, "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground", className),
|
|
2846
2949
|
...props
|
|
2847
2950
|
}));
|
|
2848
2951
|
CommandItem.displayName = Command$1.Item.displayName;
|
|
@@ -3527,14 +3630,14 @@ function PillTabs({ activeTab, onTabChange, otpLabel }) {
|
|
|
3527
3630
|
}, tab.value))
|
|
3528
3631
|
});
|
|
3529
3632
|
}
|
|
3530
|
-
function OtpForm({ onOtpRequest, onOtpVerify, loading = false, disabled = false
|
|
3633
|
+
function OtpForm({ onOtpRequest, onOtpVerify, loading = false, disabled = false }) {
|
|
3531
3634
|
const [step, setStep] = React.useState("email");
|
|
3532
3635
|
const [email, setEmail] = React.useState("");
|
|
3533
3636
|
const [session, setSession] = React.useState("");
|
|
3534
3637
|
const [otpLoading, setOtpLoading] = React.useState(false);
|
|
3535
3638
|
const [otpError, setOtpError] = React.useState();
|
|
3536
3639
|
const isLoading = loading || otpLoading;
|
|
3537
|
-
const displayError = otpError
|
|
3640
|
+
const displayError = otpError;
|
|
3538
3641
|
const handleEmailSubmit = async (e) => {
|
|
3539
3642
|
e.preventDefault();
|
|
3540
3643
|
const emailValue = new FormData(e.currentTarget).get("otp-email");
|
|
@@ -3612,9 +3715,22 @@ function OtpForm({ onOtpRequest, onOtpVerify, loading = false, disabled = false,
|
|
|
3612
3715
|
})]
|
|
3613
3716
|
})] });
|
|
3614
3717
|
}
|
|
3615
|
-
function SignInBlock({ onSubmit, onForgotPassword, onSocialLogin, socialProviders = [], loading = false, error, disabled = false, title = "Sign in", description = "Enter your credentials to access your account", signUpHref, onSignUp, className, children, onOtpRequest, onOtpVerify, otpLabel = "Email me a code" }) {
|
|
3718
|
+
function SignInBlock({ onSubmit, onForgotPassword, onSocialLogin, socialProviders = [], loading = false, error, disabled = false, title = "Sign in", description = "Enter your credentials to access your account", signUpHref, onSignUp, className, children, onOtpRequest, onOtpVerify, otpLabel = "Email me a code", onTabChange }) {
|
|
3616
3719
|
const [activeTab, setActiveTab] = React.useState(AUTH_TABS.PASSWORD);
|
|
3617
3720
|
const otpEnabled = Boolean(onOtpRequest && onOtpVerify);
|
|
3721
|
+
const handleTabChange = React.useCallback((tab) => {
|
|
3722
|
+
setActiveTab(tab);
|
|
3723
|
+
onTabChange?.(tab);
|
|
3724
|
+
}, [onTabChange]);
|
|
3725
|
+
const [errorTab, setErrorTab] = React.useState(error ? AUTH_TABS.PASSWORD : null);
|
|
3726
|
+
const previousErrorRef = React.useRef(error);
|
|
3727
|
+
React.useEffect(() => {
|
|
3728
|
+
if (error !== previousErrorRef.current) {
|
|
3729
|
+
previousErrorRef.current = error;
|
|
3730
|
+
setErrorTab(error ? activeTab : null);
|
|
3731
|
+
}
|
|
3732
|
+
}, [error, activeTab]);
|
|
3733
|
+
const visibleError = errorTab === activeTab ? error : void 0;
|
|
3618
3734
|
const handleSubmit = async (e) => {
|
|
3619
3735
|
e.preventDefault();
|
|
3620
3736
|
const formData = new FormData(e.currentTarget);
|
|
@@ -3623,7 +3739,7 @@ function SignInBlock({ onSubmit, onForgotPassword, onSocialLogin, socialProvider
|
|
|
3623
3739
|
password: formData.get("password")
|
|
3624
3740
|
});
|
|
3625
3741
|
};
|
|
3626
|
-
const passwordForm = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FormError, { message:
|
|
3742
|
+
const passwordForm = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FormError, { message: visibleError }), /* @__PURE__ */ jsxs("form", {
|
|
3627
3743
|
onSubmit: handleSubmit,
|
|
3628
3744
|
className: "space-y-4",
|
|
3629
3745
|
children: [
|
|
@@ -3715,7 +3831,7 @@ function SignInBlock({ onSubmit, onForgotPassword, onSocialLogin, socialProvider
|
|
|
3715
3831
|
children: [
|
|
3716
3832
|
children ? children : otpEnabled ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(PillTabs, {
|
|
3717
3833
|
activeTab,
|
|
3718
|
-
onTabChange:
|
|
3834
|
+
onTabChange: handleTabChange,
|
|
3719
3835
|
otpLabel
|
|
3720
3836
|
}), /* @__PURE__ */ jsx(motion.div, {
|
|
3721
3837
|
layout: true,
|
|
@@ -3745,8 +3861,7 @@ function SignInBlock({ onSubmit, onForgotPassword, onSocialLogin, socialProvider
|
|
|
3745
3861
|
onOtpRequest,
|
|
3746
3862
|
onOtpVerify,
|
|
3747
3863
|
loading,
|
|
3748
|
-
disabled
|
|
3749
|
-
error
|
|
3864
|
+
disabled
|
|
3750
3865
|
})
|
|
3751
3866
|
}, "otp")
|
|
3752
3867
|
})
|