@ttt-productions/ui-core 0.11.32 → 0.11.34
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/browser/index.d.ts +2 -2
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/reload-recovery-watch.d.ts +2 -2
- package/dist/browser/reload-recovery-watch.d.ts.map +1 -1
- package/dist/browser/reload-recovery-watch.js +5 -5
- package/dist/browser/reload-recovery-watch.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/format-numbers.js +2 -2
- package/dist/lib/format-numbers.js.map +1 -1
- package/dist/lib/reload-recovery.js +13 -13
- package/dist/lib/reload-recovery.js.map +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/react/components/accordion.d.ts +2 -2
- package/dist/react/components/accordion.d.ts.map +1 -1
- package/dist/react/components/accordion.js +8 -8
- package/dist/react/components/accordion.js.map +1 -1
- package/dist/react/components/action-row.d.ts +32 -0
- package/dist/react/components/action-row.d.ts.map +1 -0
- package/dist/react/components/action-row.js +16 -0
- package/dist/react/components/action-row.js.map +1 -0
- package/dist/react/components/alert-dialog.d.ts +2 -2
- package/dist/react/components/alert-dialog.d.ts.map +1 -1
- package/dist/react/components/alert-dialog.js +15 -15
- package/dist/react/components/alert-dialog.js.map +1 -1
- package/dist/react/components/alert.d.ts +2 -2
- package/dist/react/components/alert.d.ts.map +1 -1
- package/dist/react/components/alert.js +12 -12
- package/dist/react/components/alert.js.map +1 -1
- package/dist/react/components/avatar.d.ts +2 -2
- package/dist/react/components/avatar.d.ts.map +1 -1
- package/dist/react/components/avatar.js +7 -7
- package/dist/react/components/avatar.js.map +1 -1
- package/dist/react/components/badge.d.ts +2 -2
- package/dist/react/components/badge.d.ts.map +1 -1
- package/dist/react/components/badge.js +9 -9
- package/dist/react/components/badge.js.map +1 -1
- package/dist/react/components/button.d.ts +2 -2
- package/dist/react/components/button.d.ts.map +1 -1
- package/dist/react/components/button.js +28 -28
- package/dist/react/components/button.js.map +1 -1
- package/dist/react/components/card.d.ts +1 -1
- package/dist/react/components/card.d.ts.map +1 -1
- package/dist/react/components/card.js +15 -15
- package/dist/react/components/card.js.map +1 -1
- package/dist/react/components/checkbox.d.ts +2 -2
- package/dist/react/components/checkbox.d.ts.map +1 -1
- package/dist/react/components/checkbox.js +6 -6
- package/dist/react/components/checkbox.js.map +1 -1
- package/dist/react/components/collapsible.d.ts +1 -1
- package/dist/react/components/collapsible.d.ts.map +1 -1
- package/dist/react/components/collapsible.js +2 -2
- package/dist/react/components/collapsible.js.map +1 -1
- package/dist/react/components/consequence-dialog.d.ts.map +1 -1
- package/dist/react/components/consequence-dialog.js +4 -2
- package/dist/react/components/consequence-dialog.js.map +1 -1
- package/dist/react/components/date-picker.d.ts +1 -1
- package/dist/react/components/date-picker.d.ts.map +1 -1
- package/dist/react/components/date-picker.js +102 -66
- package/dist/react/components/date-picker.js.map +1 -1
- package/dist/react/components/date-time-picker.d.ts +1 -1
- package/dist/react/components/date-time-picker.d.ts.map +1 -1
- package/dist/react/components/date-time-picker.js +20 -18
- package/dist/react/components/date-time-picker.js.map +1 -1
- package/dist/react/components/dialog.d.ts +2 -2
- package/dist/react/components/dialog.d.ts.map +1 -1
- package/dist/react/components/dialog.js +14 -14
- package/dist/react/components/dialog.js.map +1 -1
- package/dist/react/components/dropdown-menu.d.ts +2 -2
- package/dist/react/components/dropdown-menu.d.ts.map +1 -1
- package/dist/react/components/dropdown-menu.js +23 -18
- package/dist/react/components/dropdown-menu.js.map +1 -1
- package/dist/react/components/end-of-list-indicator.d.ts +1 -1
- package/dist/react/components/end-of-list-indicator.js +3 -3
- package/dist/react/components/end-of-list-indicator.js.map +1 -1
- package/dist/react/components/form.d.ts +3 -3
- package/dist/react/components/form.d.ts.map +1 -1
- package/dist/react/components/form.js +17 -17
- package/dist/react/components/form.js.map +1 -1
- package/dist/react/components/format-control.d.ts +12 -5
- package/dist/react/components/format-control.d.ts.map +1 -1
- package/dist/react/components/format-control.js +23 -7
- package/dist/react/components/format-control.js.map +1 -1
- package/dist/react/components/input.d.ts +10 -10
- package/dist/react/components/input.d.ts.map +1 -1
- package/dist/react/components/input.js +11 -7
- package/dist/react/components/input.js.map +1 -1
- package/dist/react/components/label.d.ts +3 -3
- package/dist/react/components/label.d.ts.map +1 -1
- package/dist/react/components/label.js +6 -6
- package/dist/react/components/label.js.map +1 -1
- package/dist/react/components/layout/screen-adaptive-view.d.ts +2 -2
- package/dist/react/components/layout/screen-adaptive-view.d.ts.map +1 -1
- package/dist/react/components/layout/screen-adaptive-view.js +39 -35
- package/dist/react/components/layout/screen-adaptive-view.js.map +1 -1
- package/dist/react/components/list-pagination.d.ts +1 -1
- package/dist/react/components/list-pagination.js +10 -10
- package/dist/react/components/list-pagination.js.map +1 -1
- package/dist/react/components/menubar.d.ts +2 -2
- package/dist/react/components/menubar.d.ts.map +1 -1
- package/dist/react/components/menubar.js +17 -17
- package/dist/react/components/menubar.js.map +1 -1
- package/dist/react/components/opener-focus.d.ts +1 -1
- package/dist/react/components/opener-focus.d.ts.map +1 -1
- package/dist/react/components/opener-focus.js +3 -3
- package/dist/react/components/opener-focus.js.map +1 -1
- package/dist/react/components/pending-guard.d.ts +1 -1
- package/dist/react/components/pending-guard.d.ts.map +1 -1
- package/dist/react/components/pending-guard.js +1 -1
- package/dist/react/components/pending-guard.js.map +1 -1
- package/dist/react/components/popover.d.ts +2 -2
- package/dist/react/components/popover.d.ts.map +1 -1
- package/dist/react/components/popover.js +5 -5
- package/dist/react/components/popover.js.map +1 -1
- package/dist/react/components/progress.d.ts +2 -2
- package/dist/react/components/progress.d.ts.map +1 -1
- package/dist/react/components/progress.js +5 -5
- package/dist/react/components/progress.js.map +1 -1
- package/dist/react/components/radio-group.d.ts +2 -2
- package/dist/react/components/radio-group.d.ts.map +1 -1
- package/dist/react/components/radio-group.js +7 -7
- package/dist/react/components/radio-group.js.map +1 -1
- package/dist/react/components/relative-time.d.ts +1 -1
- package/dist/react/components/relative-time.d.ts.map +1 -1
- package/dist/react/components/relative-time.js +8 -7
- package/dist/react/components/relative-time.js.map +1 -1
- package/dist/react/components/reload-recovery-notice.d.ts +3 -3
- package/dist/react/components/reload-recovery-notice.js +7 -7
- package/dist/react/components/reload-recovery-notice.js.map +1 -1
- package/dist/react/components/scroll-area.d.ts +2 -2
- package/dist/react/components/scroll-area.d.ts.map +1 -1
- package/dist/react/components/scroll-area.js +6 -8
- package/dist/react/components/scroll-area.js.map +1 -1
- package/dist/react/components/scroll-to-top-button.d.ts +5 -5
- package/dist/react/components/scroll-to-top-button.js +9 -9
- package/dist/react/components/scroll-to-top-button.js.map +1 -1
- package/dist/react/components/search-dropdown.d.ts.map +1 -1
- package/dist/react/components/search-dropdown.js +8 -3
- package/dist/react/components/search-dropdown.js.map +1 -1
- package/dist/react/components/select.d.ts +2 -2
- package/dist/react/components/select.d.ts.map +1 -1
- package/dist/react/components/select.js +19 -19
- package/dist/react/components/select.js.map +1 -1
- package/dist/react/components/separator.d.ts +2 -2
- package/dist/react/components/separator.d.ts.map +1 -1
- package/dist/react/components/separator.js +5 -5
- package/dist/react/components/separator.js.map +1 -1
- package/dist/react/components/sheet.d.ts +3 -3
- package/dist/react/components/sheet.d.ts.map +1 -1
- package/dist/react/components/sheet.js +21 -21
- package/dist/react/components/sheet.js.map +1 -1
- package/dist/react/components/show-more-toggle.d.ts +2 -2
- package/dist/react/components/show-more-toggle.d.ts.map +1 -1
- package/dist/react/components/show-more-toggle.js +6 -6
- package/dist/react/components/show-more-toggle.js.map +1 -1
- package/dist/react/components/skeleton.d.ts +1 -1
- package/dist/react/components/skeleton.d.ts.map +1 -1
- package/dist/react/components/skeleton.js +3 -3
- package/dist/react/components/skeleton.js.map +1 -1
- package/dist/react/components/slider.d.ts +2 -2
- package/dist/react/components/slider.d.ts.map +1 -1
- package/dist/react/components/slider.js +5 -5
- package/dist/react/components/slider.js.map +1 -1
- package/dist/react/components/spinner.d.ts +1 -1
- package/dist/react/components/spinner.d.ts.map +1 -1
- package/dist/react/components/spinner.js +10 -10
- package/dist/react/components/spinner.js.map +1 -1
- package/dist/react/components/switch.d.ts +2 -2
- package/dist/react/components/switch.d.ts.map +1 -1
- package/dist/react/components/switch.js +13 -8
- package/dist/react/components/switch.js.map +1 -1
- package/dist/react/components/table.d.ts +2 -2
- package/dist/react/components/table.d.ts.map +1 -1
- package/dist/react/components/table.js +24 -24
- package/dist/react/components/table.js.map +1 -1
- package/dist/react/components/tabs.d.ts +2 -2
- package/dist/react/components/tabs.d.ts.map +1 -1
- package/dist/react/components/tabs.js +7 -7
- package/dist/react/components/tabs.js.map +1 -1
- package/dist/react/components/textarea.d.ts +5 -5
- package/dist/react/components/textarea.d.ts.map +1 -1
- package/dist/react/components/textarea.js +11 -7
- package/dist/react/components/textarea.js.map +1 -1
- package/dist/react/components/toast.d.ts +4 -4
- package/dist/react/components/toast.d.ts.map +1 -1
- package/dist/react/components/toast.js +25 -25
- package/dist/react/components/toast.js.map +1 -1
- package/dist/react/components/toaster.d.ts.map +1 -1
- package/dist/react/components/toaster.js +5 -5
- package/dist/react/components/toaster.js.map +1 -1
- package/dist/react/components/tooltip.d.ts +2 -2
- package/dist/react/components/tooltip.d.ts.map +1 -1
- package/dist/react/components/tooltip.js +5 -5
- package/dist/react/components/tooltip.js.map +1 -1
- package/dist/react/hooks/use-async-action.js +2 -2
- package/dist/react/hooks/use-async-action.js.map +1 -1
- package/dist/react/hooks/use-cursor-page.d.ts +1 -1
- package/dist/react/hooks/use-cursor-page.js +2 -2
- package/dist/react/hooks/use-cursor-page.js.map +1 -1
- package/dist/react/hooks/use-media-query.js +5 -5
- package/dist/react/hooks/use-media-query.js.map +1 -1
- package/dist/react/hooks/use-paged-list.js +2 -2
- package/dist/react/hooks/use-paged-list.js.map +1 -1
- package/dist/react/hooks/use-return-scroll.d.ts +1 -1
- package/dist/react/hooks/use-return-scroll.d.ts.map +1 -1
- package/dist/react/hooks/use-return-scroll.js +11 -11
- package/dist/react/hooks/use-return-scroll.js.map +1 -1
- package/dist/react/hooks/use-toast.d.ts +3 -3
- package/dist/react/hooks/use-toast.d.ts.map +1 -1
- package/dist/react/hooks/use-toast.js +17 -17
- package/dist/react/hooks/use-toast.js.map +1 -1
- package/dist/react/index.d.ts +74 -72
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +51 -50
- package/dist/react/index.js.map +1 -1
- package/package.json +8 -6
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as React from
|
|
4
|
-
import * as AvatarPrimitive from
|
|
5
|
-
import { cn } from
|
|
6
|
-
const Avatar = React.forwardRef(({ className, ...props }, ref) => (_jsx(AvatarPrimitive.Root, { ref: ref, className: cn(
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
5
|
+
import { cn } from '../../lib/utils.js';
|
|
6
|
+
const Avatar = React.forwardRef(({ className, ...props }, ref) => (_jsx(AvatarPrimitive.Root, { ref: ref, className: cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className), ...props })));
|
|
7
7
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
8
8
|
const AvatarImage = React.forwardRef(({ className, src, ...props }, ref) => {
|
|
9
9
|
if (!src)
|
|
10
10
|
return null;
|
|
11
|
-
return (_jsx(AvatarPrimitive.Image, { ref: ref, src: src, className: cn(
|
|
11
|
+
return (_jsx(AvatarPrimitive.Image, { ref: ref, src: src, className: cn('aspect-square h-full w-full', className), ...props }));
|
|
12
12
|
});
|
|
13
13
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
14
|
-
const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => (_jsx(AvatarPrimitive.Fallback, { ref: ref, className: cn(
|
|
14
|
+
const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => (_jsx(AvatarPrimitive.Fallback, { ref: ref, className: cn('flex h-full w-full items-center justify-center rounded-full bg-[color:var(--avatar-fallback)] text-primary font-semibold', className), ...props })));
|
|
15
15
|
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
16
16
|
export { Avatar, AvatarImage, AvatarFallback };
|
|
17
17
|
//# sourceMappingURL=avatar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../../src/react/components/avatar.tsx"],"names":[],"mappings":"AAAA,YAAY,
|
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../../src/react/components/avatar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAG7B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,KAAC,eAAe,CAAC,IAAI,IACnB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,+DAA+D,EAAE,SAAS,CAAC,KACrF,KAAK,GACT,CACH,CAAC,CAAC;AACH,MAAM,CAAC,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC;AAEtD,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAGlC,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACtC,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,OAAO,CACL,KAAC,eAAe,CAAC,KAAK,IACpB,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,6BAA6B,EAAE,SAAS,CAAC,KACnD,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,WAAW,CAAC,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC;AAE5D,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAGrC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,KAAC,eAAe,CAAC,QAAQ,IACvB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,0HAA0H,EAC1H,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAC;AACH,cAAc,CAAC,WAAW,GAAG,eAAe,CAAC,QAAQ,CAAC,WAAW,CAAC;AAElE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as AvatarPrimitive from '@radix-ui/react-avatar';\n\nimport { cn } from '../../lib/utils.js';\n\nconst Avatar = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Root\n ref={ref}\n className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}\n {...props}\n />\n));\nAvatar.displayName = AvatarPrimitive.Root.displayName;\n\nconst AvatarImage = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, src, ...props }, ref) => {\n if (!src) return null;\n return (\n <AvatarPrimitive.Image\n ref={ref}\n src={src}\n className={cn('aspect-square h-full w-full', className)}\n {...props}\n />\n );\n});\nAvatarImage.displayName = AvatarPrimitive.Image.displayName;\n\nconst AvatarFallback = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Fallback\n ref={ref}\n className={cn(\n 'flex h-full w-full items-center justify-center rounded-full bg-[color:var(--avatar-fallback)] text-primary font-semibold',\n className,\n )}\n {...props}\n />\n));\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;\n\nexport { Avatar, AvatarImage, AvatarFallback };\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { type VariantProps } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
4
|
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/react/components/badge.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,aAAa;;
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/react/components/badge.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,aAAa;;8EAelB,CAAC;AAEF,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,YAAY,CAAC,OAAO,aAAa,CAAC;CAAG;AAErF,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,qBAE1D;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cva } from
|
|
4
|
-
import { cn } from
|
|
5
|
-
const badgeVariants = cva(
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { cn } from '../../lib/utils.js';
|
|
5
|
+
const badgeVariants = cva('inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2', {
|
|
6
6
|
variants: {
|
|
7
7
|
variant: {
|
|
8
|
-
default:
|
|
9
|
-
secondary:
|
|
10
|
-
destructive:
|
|
11
|
-
outline:
|
|
8
|
+
default: 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',
|
|
9
|
+
secondary: 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
10
|
+
destructive: 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
|
|
11
|
+
outline: 'text-foreground',
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
|
-
defaultVariants: { variant:
|
|
14
|
+
defaultVariants: { variant: 'default' },
|
|
15
15
|
});
|
|
16
16
|
function Badge({ className, variant, ...props }) {
|
|
17
17
|
return _jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../../../src/react/components/badge.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,MAAM,aAAa,GAAG,GAAG,CACvB,0KAA0K,EAC1K;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,2EAA2E;YACpF,SAAS,
|
|
1
|
+
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../../../src/react/components/badge.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,MAAM,aAAa,GAAG,GAAG,CACvB,0KAA0K,EAC1K;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,2EAA2E;YACpF,SAAS,EACP,iFAAiF;YACnF,WAAW,EACT,uFAAuF;YACzF,OAAO,EAAE,iBAAiB;SAC3B;KACF;IACD,eAAe,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;CACxC,CACF,CAAC;AAKF,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,EAAc;IACzD,OAAO,cAAK,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAAC;AAClF,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '../../lib/utils.js';\n\nconst badgeVariants = cva(\n 'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2',\n {\n variants: {\n variant: {\n default: 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',\n secondary:\n 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',\n destructive:\n 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',\n outline: 'text-foreground',\n },\n },\n defaultVariants: { variant: 'default' },\n },\n);\n\nexport interface BadgeProps\n extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}\n\nfunction Badge({ className, variant, ...props }: BadgeProps) {\n return <div className={cn(badgeVariants({ variant }), className)} {...props} />;\n}\n\nexport { Badge, badgeVariants };\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { type VariantProps } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
4
|
variant?: "link" | "default" | "destructive" | "success" | "outline" | "secondary" | "ghost" | "inverted" | null | undefined;
|
|
5
5
|
size?: "sm" | "lg" | "default" | "icon" | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/react/components/button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/react/components/button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAQlE,QAAA,MAAM,cAAc;;;8EAgCnB,CAAC;AAEF,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,YAAY,CAAC,OAAO,cAAc,CAAC;IAC1F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6FAA6F;IAC7F,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,QAAA,MAAM,MAAM,uFAoEX,CAAC;AAIF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import * as React from
|
|
4
|
-
import { Slot, Slottable } from
|
|
5
|
-
import { cva } from
|
|
6
|
-
import { cn } from
|
|
7
|
-
import { Spinner } from
|
|
8
|
-
import { blockActivationKey, blockEvent } from
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Slot, Slottable } from '@radix-ui/react-slot';
|
|
5
|
+
import { cva } from 'class-variance-authority';
|
|
6
|
+
import { cn } from '../../lib/utils.js';
|
|
7
|
+
import { Spinner } from './spinner.js';
|
|
8
|
+
import { blockActivationKey, blockEvent } from './pending-guard.js';
|
|
9
9
|
// `ui-button` is the stable hook an app's own stylesheet keys a rule for every button on (a press
|
|
10
10
|
// effect), so it never has to match this component's private utility string.
|
|
11
|
-
const buttonVariants = cva(
|
|
11
|
+
const buttonVariants = cva('ui-button inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-bold ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50', {
|
|
12
12
|
variants: {
|
|
13
13
|
variant: {
|
|
14
|
-
default:
|
|
15
|
-
destructive:
|
|
16
|
-
success:
|
|
17
|
-
outline:
|
|
18
|
-
secondary:
|
|
19
|
-
ghost:
|
|
20
|
-
link:
|
|
21
|
-
inverted:
|
|
14
|
+
default: 'button-default bg-primary text-primary-foreground hover:bg-primary/90 border-2 border-[hsl(var(--brand-primary-deep))]',
|
|
15
|
+
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90 border-2 border-[hsl(var(--destructive-border))]',
|
|
16
|
+
success: 'bg-[color:var(--button-success)] text-[hsl(var(--success-foreground))] hover:bg-[color:var(--button-success)]/90 border-2 border-[hsl(var(--status-success-border))]',
|
|
17
|
+
outline: 'border-2 border-border bg-background hover:bg-accent hover:text-accent-foreground text-foreground',
|
|
18
|
+
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 border-2 border-border',
|
|
19
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
20
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
21
|
+
inverted: 'bg-[hsl(var(--inverted-background))] text-[hsl(var(--inverted-foreground))] hover:bg-[hsl(var(--inverted-background))]/90 border-2 border-[hsl(var(--inverted-border))]',
|
|
22
22
|
},
|
|
23
23
|
size: {
|
|
24
|
-
default:
|
|
25
|
-
sm:
|
|
26
|
-
lg:
|
|
27
|
-
icon:
|
|
24
|
+
default: 'h-10 px-4 py-2',
|
|
25
|
+
sm: 'h-9 rounded-md px-3',
|
|
26
|
+
lg: 'h-11 rounded-md px-8',
|
|
27
|
+
icon: 'h-9 w-9',
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
30
|
defaultVariants: {
|
|
31
|
-
variant:
|
|
32
|
-
size:
|
|
31
|
+
variant: 'default',
|
|
32
|
+
size: 'default',
|
|
33
33
|
},
|
|
34
34
|
});
|
|
35
35
|
const Button = React.forwardRef(({ className, variant, size, asChild = false, pending = false, icon, disabled, children, ...props }, ref) => {
|
|
@@ -37,9 +37,9 @@ const Button = React.forwardRef(({ className, variant, size, asChild = false, pe
|
|
|
37
37
|
...props,
|
|
38
38
|
...(pending
|
|
39
39
|
? {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
'aria-busy': true,
|
|
41
|
+
'aria-disabled': true,
|
|
42
|
+
'data-pending': '',
|
|
43
43
|
// Stopped before any handler runs — the caller's, an `asChild` child's own, or a Radix
|
|
44
44
|
// trigger's — so a click submits nothing, a link goes nowhere, and neither a pointer
|
|
45
45
|
// press nor an activation key opens what the button triggers.
|
|
@@ -51,15 +51,15 @@ const Button = React.forwardRef(({ className, variant, size, asChild = false, pe
|
|
|
51
51
|
disabled: (disabled && !pending) || undefined,
|
|
52
52
|
className: cn(buttonVariants({ variant, size, className })),
|
|
53
53
|
};
|
|
54
|
-
const spinner = _jsx(Spinner, { size: size ===
|
|
54
|
+
const spinner = _jsx(Spinner, { size: size === 'lg' ? 'sm' : 'xs' });
|
|
55
55
|
const leading = pending ? spinner : icon;
|
|
56
56
|
if (asChild) {
|
|
57
57
|
// Slot finds the Slottable among its DIRECT children, so the leading slot and the
|
|
58
58
|
// Slottable must be siblings here — never wrapped in a fragment.
|
|
59
59
|
return leading ? (_jsxs(Slot, { ref: ref, ...shared, children: [leading, _jsx(Slottable, { children: children })] })) : (_jsx(Slot, { ref: ref, ...shared, children: children }));
|
|
60
60
|
}
|
|
61
|
-
return (_jsx("button", { ref: ref, ...shared, children: size ===
|
|
61
|
+
return (_jsx("button", { ref: ref, ...shared, children: size === 'icon' ? (pending ? (spinner) : (children)) : (_jsxs(_Fragment, { children: [leading, children] })) }));
|
|
62
62
|
});
|
|
63
|
-
Button.displayName =
|
|
63
|
+
Button.displayName = 'Button';
|
|
64
64
|
export { Button, buttonVariants };
|
|
65
65
|
//# sourceMappingURL=button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/react/components/button.tsx"],"names":[],"mappings":"AAAA,YAAY,
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/react/components/button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEpE,kGAAkG;AAClG,6EAA6E;AAC7E,MAAM,cAAc,GAAG,GAAG,CACxB,mWAAmW,EACnW;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EACL,wHAAwH;YAC1H,WAAW,EACT,qHAAqH;YACvH,OAAO,EACL,sKAAsK;YACxK,OAAO,EACL,mGAAmG;YACrG,SAAS,E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C,IAAI,CAAC;IAEzC,IAAI,OAAO,EAAE,CAAC;QACZ,kFAAkF;QAClF,iEAAiE;QACjE,OAAO,OAAO,CAAC,CAAC,CAAC,CACf,MAAC,IAAI,IAAC,GAAG,EAAE,GAAG,KAAM,MAAM,aACvB,OAAO,EACR,KAAC,SAAS,cAAE,QAAQ,GAAa,IAC5B,CACR,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,GAAG,EAAE,GAAG,KAAM,MAAM,YACvB,QAAQ,GACJ,CACR,CAAC;IACJ,CAAC;IAED,OAAO,CACL,iBAAQ,GAAG,EAAE,GAAG,KAAM,MAAM,YACzB,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CACjB,OAAO,CAAC,CAAC,CAAC,CACR,OAAO,CACR,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,CACF,CAAC,CAAC,CAAC,CACF,8BACG,OAAO,EACP,QAAQ,IACR,CACJ,GACM,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Slot, Slottable } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '../../lib/utils.js';\nimport { Spinner } from './spinner.js';\nimport { blockActivationKey, blockEvent } from './pending-guard.js';\n\n// `ui-button` is the stable hook an app's own stylesheet keys a rule for every button on (a press\n// effect), so it never has to match this component's private utility string.\nconst buttonVariants = cva(\n 'ui-button inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-bold ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50',\n {\n variants: {\n variant: {\n default:\n 'button-default bg-primary text-primary-foreground hover:bg-primary/90 border-2 border-[hsl(var(--brand-primary-deep))]',\n destructive:\n 'bg-destructive text-destructive-foreground hover:bg-destructive/90 border-2 border-[hsl(var(--destructive-border))]',\n success:\n 'bg-[color:var(--button-success)] text-[hsl(var(--success-foreground))] hover:bg-[color:var(--button-success)]/90 border-2 border-[hsl(var(--status-success-border))]',\n outline:\n 'border-2 border-border bg-background hover:bg-accent hover:text-accent-foreground text-foreground',\n secondary:\n 'bg-secondary text-secondary-foreground hover:bg-secondary/80 border-2 border-border',\n ghost: 'hover:bg-accent hover:text-accent-foreground',\n link: 'text-primary underline-offset-4 hover:underline',\n inverted:\n 'bg-[hsl(var(--inverted-background))] text-[hsl(var(--inverted-foreground))] hover:bg-[hsl(var(--inverted-background))]/90 border-2 border-[hsl(var(--inverted-border))]',\n },\n size: {\n default: 'h-10 px-4 py-2',\n sm: 'h-9 rounded-md px-3',\n lg: 'h-11 rounded-md px-8',\n icon: 'h-9 w-9',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n /**\n * Async work this button started is in flight. The button ignores activation — a\n * click, a key press, a form's implicit submit — sets `aria-disabled` and\n * `aria-busy`, and shows the canonical spinner: an icon button (`size=\"icon\"`)\n * swaps its icon for it; any other button shows it in place of its `icon`. It is\n * never natively disabled while pending — a `disabled` passed alongside `pending`\n * applies once pending ends — so the button the user just pressed keeps focus\n * (FRONTEND-203).\n */\n pending?: boolean;\n /** Leading icon, rendered before the label. While `pending`, the spinner takes its place. */\n icon?: React.ReactNode;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n asChild = false,\n pending = false,\n icon,\n disabled,\n children,\n ...props\n },\n ref,\n ) => {\n const shared = {\n ...props,\n ...(pending\n ? {\n 'aria-busy': true,\n 'aria-disabled': true,\n 'data-pending': '',\n // Stopped before any handler runs — the caller's, an `asChild` child's own, or a Radix\n // trigger's — so a click submits nothing, a link goes nowhere, and neither a pointer\n // press nor an activation key opens what the button triggers.\n onClickCapture: blockEvent,\n onPointerDownCapture: blockEvent,\n onKeyDownCapture: blockActivationKey,\n }\n : {}),\n disabled: (disabled && !pending) || undefined,\n className: cn(buttonVariants({ variant, size, className })),\n };\n const spinner = <Spinner size={size === 'lg' ? 'sm' : 'xs'} />;\n const leading = pending ? spinner : icon;\n\n if (asChild) {\n // Slot finds the Slottable among its DIRECT children, so the leading slot and the\n // Slottable must be siblings here — never wrapped in a fragment.\n return leading ? (\n <Slot ref={ref} {...shared}>\n {leading}\n <Slottable>{children}</Slottable>\n </Slot>\n ) : (\n <Slot ref={ref} {...shared}>\n {children}\n </Slot>\n );\n }\n\n return (\n <button ref={ref} {...shared}>\n {size === 'icon' ? (\n pending ? (\n spinner\n ) : (\n children\n )\n ) : (\n <>\n {leading}\n {children}\n </>\n )}\n </button>\n );\n },\n);\n\nButton.displayName = 'Button';\n\nexport { Button, buttonVariants };\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React from
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
3
3
|
declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
4
4
|
declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/react/components/card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/react/components/card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,QAAA,MAAM,IAAI,6GAQT,CAAC;AAGF,QAAA,MAAM,UAAU,6GAIf,CAAC;AAGF,QAAA,MAAM,SAAS,uHAWd,CAAC;AAGF,QAAA,MAAM,eAAe,yHAKnB,CAAC;AAGH,QAAA,MAAM,WAAW,6GAIhB,CAAC;AAGF,QAAA,MAAM,UAAU,6GAIf,CAAC;AAGF,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as React from
|
|
4
|
-
import { cn } from
|
|
5
|
-
const Card = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn(
|
|
6
|
-
Card.displayName =
|
|
7
|
-
const CardHeader = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn(
|
|
8
|
-
CardHeader.displayName =
|
|
9
|
-
const CardTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx("h3", { ref: ref, className: cn(
|
|
10
|
-
CardTitle.displayName =
|
|
11
|
-
const CardDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx("p", { ref: ref, className: cn(
|
|
12
|
-
CardDescription.displayName =
|
|
13
|
-
const CardContent = React.forwardRef(({ className, ...props }, ref) => _jsx("div", { ref: ref, className: cn(
|
|
14
|
-
CardContent.displayName =
|
|
15
|
-
const CardFooter = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn(
|
|
16
|
-
CardFooter.displayName =
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { cn } from '../../lib/utils.js';
|
|
5
|
+
const Card = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('rounded-lg border-2 card-border bg-card text-card-foreground', className), ...props })));
|
|
6
|
+
Card.displayName = 'Card';
|
|
7
|
+
const CardHeader = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('flex flex-col space-y-1.5 p-6', className), ...props })));
|
|
8
|
+
CardHeader.displayName = 'CardHeader';
|
|
9
|
+
const CardTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx("h3", { ref: ref, className: cn('text-2xl font-semibold leading-none tracking-tight break-words card-title', className), ...props })));
|
|
10
|
+
CardTitle.displayName = 'CardTitle';
|
|
11
|
+
const CardDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx("p", { ref: ref, className: cn('break-words card-description', className), ...props })));
|
|
12
|
+
CardDescription.displayName = 'CardDescription';
|
|
13
|
+
const CardContent = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('p-6 pt-0', className), ...props })));
|
|
14
|
+
CardContent.displayName = 'CardContent';
|
|
15
|
+
const CardFooter = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('flex items-center p-6 pt-0', className), ...props })));
|
|
16
|
+
CardFooter.displayName = 'CardFooter';
|
|
17
17
|
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
|
|
18
18
|
//# sourceMappingURL=card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../../src/react/components/card.tsx"],"names":[],"mappings":"AAAA,YAAY,
|
|
1
|
+
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../../src/react/components/card.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAC3B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAChC,cACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,8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ExC,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CACjC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAChC,cAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,4BAA4B,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CACrF,CACF,CAAC;AACF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../lib/utils.js';\n\nconst Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn('rounded-lg border-2 card-border bg-card text-card-foreground', className)}\n {...props}\n />\n ),\n);\nCard.displayName = 'Card';\n\nconst CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />\n ),\n);\nCardHeader.displayName = 'CardHeader';\n\nconst CardTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(\n ({ className, ...props }, ref) => (\n <h3\n ref={ref}\n className={cn(\n 'text-2xl font-semibold leading-none tracking-tight break-words card-title',\n className,\n )}\n {...props}\n />\n ),\n);\nCardTitle.displayName = 'CardTitle';\n\nconst CardDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p ref={ref} className={cn('break-words card-description', className)} {...props} />\n));\nCardDescription.displayName = 'CardDescription';\n\nconst CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('p-6 pt-0', className)} {...props} />\n ),\n);\nCardContent.displayName = 'CardContent';\n\nconst CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex items-center p-6 pt-0', className)} {...props} />\n ),\n);\nCardFooter.displayName = 'CardFooter';\n\nexport { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as CheckboxPrimitive from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
3
3
|
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
4
4
|
export { Checkbox };
|
|
5
5
|
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/react/components/checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/react/components/checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAK9D,QAAA,MAAM,QAAQ,iKAgBZ,CAAC;AAGH,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as React from
|
|
4
|
-
import * as CheckboxPrimitive from
|
|
5
|
-
import { Check } from
|
|
6
|
-
import { cn } from
|
|
7
|
-
const Checkbox = React.forwardRef(({ className, ...props }, ref) => (_jsx(CheckboxPrimitive.Root, { ref: ref, className: cn(
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
5
|
+
import { Check } from 'lucide-react';
|
|
6
|
+
import { cn } from '../../lib/utils.js';
|
|
7
|
+
const Checkbox = React.forwardRef(({ className, ...props }, ref) => (_jsx(CheckboxPrimitive.Root, { ref: ref, className: cn('peer h-4 w-4 shrink-0 rounded-xs border border-primary ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground', className), ...props, children: _jsx(CheckboxPrimitive.Indicator, { className: cn('flex items-center justify-center text-current'), children: _jsx(Check, { className: "h-4 w-4" }) }) })));
|
|
8
8
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
9
9
|
export { Checkbox };
|
|
10
10
|
//# sourceMappingURL=checkbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/react/components/checkbox.tsx"],"names":[],"mappings":"AAAA,YAAY,
|
|
1
|
+
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/react/components/checkbox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAG/B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,KAAC,iBAAiB,CAAC,IAAI,IACrB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,kTAAkT,EAClT,SAAS,CACV,KACG,KAAK,YAET,KAAC,iBAAiB,CAAC,SAAS,IAAC,SAAS,EAAE,EAAE,CAAC,+CAA+C,CAAC,YACzF,KAAC,KAAK,IAAC,SAAS,EAAC,SAAS,GAAG,GACD,GACP,CAC1B,CAAC,CAAC;AACH,QAAQ,CAAC,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { Check } from 'lucide-react';\n\nimport { cn } from '../../lib/utils.js';\n\nconst Checkbox = React.forwardRef<\n React.ElementRef<typeof CheckboxPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <CheckboxPrimitive.Root\n ref={ref}\n className={cn(\n 'peer h-4 w-4 shrink-0 rounded-xs border border-primary ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator className={cn('flex items-center justify-center text-current')}>\n <Check className=\"h-4 w-4\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n));\nCheckbox.displayName = CheckboxPrimitive.Root.displayName;\n\nexport { Checkbox };\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as CollapsiblePrimitive from
|
|
1
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
2
2
|
declare const Collapsible: import("react").ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
3
|
declare const CollapsibleTrigger: import("react").ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
4
4
|
declare const CollapsibleContent: import("react").ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../../src/react/components/collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,
|
|
1
|
+
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../../src/react/components/collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AAEpE,QAAA,MAAM,WAAW,kIAA4B,CAAC;AAE9C,QAAA,MAAM,kBAAkB,4IAA0C,CAAC;AAEnE,QAAA,MAAM,kBAAkB,yIAA0C,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import * as CollapsiblePrimitive from
|
|
1
|
+
'use client';
|
|
2
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
3
3
|
const Collapsible = CollapsiblePrimitive.Root;
|
|
4
4
|
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
5
5
|
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.js","sourceRoot":"","sources":["../../../src/react/components/collapsible.tsx"],"names":[],"mappings":"AAAA,YAAY,
|
|
1
|
+
{"version":3,"file":"collapsible.js","sourceRoot":"","sources":["../../../src/react/components/collapsible.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AAEpE,MAAM,WAAW,GAAG,oBAAoB,CAAC,IAAI,CAAC;AAE9C,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,kBAAkB,CAAC;AAEnE,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,kBAAkB,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["'use client';\n\nimport * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\n\nconst Collapsible = CollapsiblePrimitive.Root;\n\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\n\nconst CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consequence-dialog.d.ts","sourceRoot":"","sources":["../../../src/react/components/consequence-dialog.tsx"],"names":[],"mappings":"AAgBA,OAAO,
|
|
1
|
+
{"version":3,"file":"consequence-dialog.d.ts","sourceRoot":"","sources":["../../../src/react/components/consequence-dialog.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,oCAAoC,CAAC;AAG5C;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,mBAAmB,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,kCAAkC;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,uFAAuF;IACvF,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,0DAA0D;IAC1D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEvC,6EAA6E;IAC7E,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IAEvB,oFAAoF;IACpF,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,wFAAwF;IACxF,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,6DAA6D;IAC7D,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEhC,qCAAqC;IACrC,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,sDAAsD;IACtD,iBAAiB,CAAC,EAAE,kCAAkC,CAAC;IAEvD,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;;;OAOG;IACH,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAC3C;AA+BD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,eAAe,EACf,aAAa,EACb,aAAa,EACb,MAAM,EACN,iBAAiB,EACjB,YAAY,EACZ,WAAsB,EACtB,WAAmB,EACnB,SAAS,EACT,gBAAgB,GACjB,EAAE,sBAAsB,+BAmJxB"}
|
|
@@ -6,7 +6,7 @@ import { Button } from './button.js';
|
|
|
6
6
|
import { Textarea } from './textarea.js';
|
|
7
7
|
import { Input } from './input.js';
|
|
8
8
|
import { Label } from './label.js';
|
|
9
|
-
import { checkInputFormat, defineInputFormat } from '@ttt-productions/input-format-core';
|
|
9
|
+
import { checkInputFormat, defineInputFormat, } from '@ttt-productions/input-format-core';
|
|
10
10
|
import { Zap, Clock, RotateCcw } from 'lucide-react';
|
|
11
11
|
const SLOT_ICON_CLASS = 'icon-xs mt-0.5 shrink-0 text-muted-foreground';
|
|
12
12
|
/**
|
|
@@ -71,7 +71,9 @@ export function ConsequenceDialog({ trigger, open, onOpenChange, title, immediat
|
|
|
71
71
|
const typedOk = !typedConfirmation ? true : typedValue === typedConfirmation.phrase;
|
|
72
72
|
// The phrase is one line, and nothing longer than it can ever match it.
|
|
73
73
|
const phrase = typedConfirmation?.phrase ?? '';
|
|
74
|
-
const typedFormat = useMemo(() =>
|
|
74
|
+
const typedFormat = useMemo(() => phrase.length > 0
|
|
75
|
+
? defineInputFormat({ format: 'singleLine', min: 1, max: phrase.length })
|
|
76
|
+
: null, [phrase]);
|
|
75
77
|
return (_jsxs(AlertDialog, { open: actualOpen, onOpenChange: handleOpenChange, children: [trigger ? _jsx(AlertDialogTrigger, { asChild: true, children: trigger }) : null, _jsxs(AlertDialogContent, { onEscapeKeyDown: (e) => {
|
|
76
78
|
if (pending)
|
|
77
79
|
e.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consequence-dialog.js","sourceRoot":"","sources":["../../../src/react/components/consequence-dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,M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CAAC,MAAM,EACrC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAC,KAAK,GAClB,IACE,CACP,CAAC,CAAC,CAAC,IAAI,EAER,MAAC,iBAAiB,eAChB,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,EACtC,QAAQ,EAAE,OAAO,YAEhB,WAAW,GACL,EACT,KAAC,MAAM,IACL,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,EAChD,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,CAAC,QAAQ,IAAI,CAAC,OAAO,EAC/B,OAAO,EAAE,OAAO,YAEf,YAAY,GACN,IACS,IACD,IACT,CACf,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { useCallback, useId, useMemo, useState } from 'react';\nimport {\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogHeader,\n AlertDialogFooter,\n AlertDialogTitle,\n AlertDialogDescription,\n} from './alert-dialog.js';\nimport { Button } from './button.js';\nimport { Textarea } from './textarea.js';\nimport { Input } from './input.js';\nimport { Label } from './label.js';\nimport { checkInputFormat, defineInputFormat, type DeclaredInputFormat } from '@ttt-productions/input-format-core';\nimport { Zap, Clock, RotateCcw } from 'lucide-react';\n\n/**\n * The inline reason field. The caller OWNS the reason value/onChange (draft state lives at the call\n * site) and the field's declaration — this component declares no business numbers and no copy.\n * Confirm stays disabled until the value passes the declaration's check; `min: 0` makes the reason\n * optional.\n */\nexport interface ConsequenceDialogReason {\n inputFormat: DeclaredInputFormat;\n placeholder?: string;\n label?: React.ReactNode;\n value: string;\n onChange: (value: string) => void;\n rows?: number;\n /**\n * A line rendered directly under the reason box, such as why its current text is refused. It is\n * called with the id the box names in its `aria-describedby`, and the element it renders carries\n * that id. The caller owns the words; this component adds none.\n */\n hint?: (id: string) => React.ReactNode;\n}\n\n/**\n * The exact-match typed-confirmation gate. `phrase` is business copy owned by the CALLER; the\n * component only compares the typed value against it.\n */\nexport interface ConsequenceDialogTypedConfirmation {\n phrase: string;\n label?: React.ReactNode;\n}\n\nexport interface ConsequenceDialogProps {\n /** Uncontrolled open model: the element that opens the dialog (rendered `asChild`). */\n trigger?: React.ReactNode;\n /** Controlled open model. Provide with `onOpenChange`. */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n\n /** Heading — a string or node so callers can interpolate amounts / names. */\n title: React.ReactNode;\n\n /** SLOT 1 — what happens right now (e.g. \"initiates a Stripe refund of $X now\"). */\n immediateEffect?: React.ReactNode;\n /** SLOT 2 — what settles later, out of band (webhook / worker / async confirmation). */\n delayedEffect?: React.ReactNode;\n /** SLOT 3 — whether/how this can be undone or superseded. */\n reversibility?: React.ReactNode;\n\n /** Inline reason field. Optional. */\n reason?: ConsequenceDialogReason;\n /** Exact-phrase typed-confirmation gate. Optional. */\n typedConfirmation?: ConsequenceDialogTypedConfirmation;\n\n confirmLabel: React.ReactNode;\n cancelLabel?: React.ReactNode;\n /** `true` styles the confirm button with `bg-destructive`. */\n destructive?: boolean;\n\n /**\n * Runs on confirm. May be async — while it is pending the dialog STAYS OPEN: the confirm button\n * is `aria-disabled`, keeps focus, ignores further presses, and shows its pending spinner, and\n * only Cancel is natively disabled. Closes on resolve. If it rejects the dialog\n * stays open so the caller's own surface (error toast, TOTP step-up) can show and the operator can\n * retry or cancel. This component takes no Sentry/monitoring dependency — every error path\n * belongs to the caller's `onConfirm`.\n */\n onConfirm: () => void | Promise<void>;\n\n /**\n * Runs as the dialog closes, before Radix returns focus to the control that opened it. A confirmed\n * action that removes that control moves focus to its own destination here and calls\n * `event.preventDefault()`, so the restore does not pull focus back onto a control about to go.\n */\n onCloseAutoFocus?: (event: Event) => void;\n}\n\nconst SLOT_ICON_CLASS = 'icon-xs mt-0.5 shrink-0 text-muted-foreground';\n\n/**\n * One consequence slot: the icon beside a block column whose label sits on its own line above\n * the slot text. Every element is a block: the `stack-*` spacing is a vertical margin, which an\n * inline element ignores.\n */\nfunction ConsequenceRow({\n icon: Icon,\n label,\n children,\n}: {\n icon: typeof Zap;\n label: string;\n children: React.ReactNode;\n}) {\n return (\n <div className=\"flex items-start gap-2\">\n <Icon className={SLOT_ICON_CLASS} aria-hidden=\"true\" />\n <div className=\"stack-1 min-w-0\">\n <div className=\"text-caption font-medium uppercase tracking-wide text-muted-foreground\">\n {label}\n </div>\n <div className=\"text-small text-foreground\">{children}</div>\n </div>\n </div>\n );\n}\n\n/**\n * A reusable confirm-before-a-consequential-action dialog. Three optional, consistently-styled\n * consequence slots (immediate / afterward / reversibility), an optional inline reason field,\n * and an optional exact-phrase typed-confirmation gate. Composes the ui-core AlertDialog primitives\n * (Radix) — it never re-implements them. Supports BOTH a `trigger` (uncontrolled) and `open` /\n * `onOpenChange` (controlled).\n *\n * Pending model: the confirm button is a plain `Button` (NOT `AlertDialogAction`), so Radix does not\n * auto-close on click; open state is managed here so the dialog stays open with a visible spinner\n * until `onConfirm` resolves.\n */\nexport function ConsequenceDialog({\n trigger,\n open,\n onOpenChange,\n title,\n immediateEffect,\n delayedEffect,\n reversibility,\n reason,\n typedConfirmation,\n confirmLabel,\n cancelLabel = 'Cancel',\n destructive = false,\n onConfirm,\n onCloseAutoFocus,\n}: ConsequenceDialogProps) {\n const isControlled = open !== undefined;\n const [internalOpen, setInternalOpen] = useState(false);\n const [typedValue, setTypedValue] = useState('');\n const [pending, setPending] = useState(false);\n\n const actualOpen = isControlled ? open : internalOpen;\n\n const reasonId = useId();\n const reasonHintId = useId();\n const typedId = useId();\n\n const setOpenState = useCallback(\n (next: boolean) => {\n if (isControlled) onOpenChange?.(next);\n else setInternalOpen(next);\n },\n [isControlled, onOpenChange],\n );\n\n // Never allow an open-state change (Escape, cancel, controlled parent) to fight the pending action.\n const handleOpenChange = useCallback(\n (next: boolean) => {\n if (pending) return;\n setTypedValue(''); // reset the typed gate on every open/close\n setOpenState(next);\n },\n [pending, setOpenState],\n );\n\n const handleConfirm = useCallback(async () => {\n if (pending) return;\n setPending(true);\n try {\n await onConfirm();\n setTypedValue('');\n setOpenState(false);\n } catch {\n // Keep the dialog open — the caller's onConfirm surfaced the error (toast / step-up). The\n // operator can retry or cancel. Never rethrow, never monitor here.\n } finally {\n setPending(false);\n }\n }, [pending, onConfirm, setOpenState]);\n\n const reasonOk = !reason || checkInputFormat(reason.value, reason.inputFormat).ok;\n\n const typedOk = !typedConfirmation ? true : typedValue === typedConfirmation.phrase;\n // The phrase is one line, and nothing longer than it can ever match it.\n const phrase = typedConfirmation?.phrase ?? '';\n const typedFormat = useMemo(\n () => (phrase.length > 0 ? defineInputFormat({ format: 'singleLine', min: 1, max: phrase.length }) : null),\n [phrase],\n );\n\n return (\n <AlertDialog open={actualOpen} onOpenChange={handleOpenChange}>\n {trigger ? <AlertDialogTrigger asChild>{trigger}</AlertDialogTrigger> : null}\n <AlertDialogContent\n onEscapeKeyDown={(e) => {\n if (pending) e.preventDefault();\n }}\n onCloseAutoFocus={onCloseAutoFocus}\n >\n <AlertDialogHeader>\n <AlertDialogTitle>{title}</AlertDialogTitle>\n {/* A div, not the primitive's default <p>: the rows are blocks, which a <p> cannot hold.\n Left-aligned at every width — the header centres its text on narrow screens, and a\n wrapped consequence line reads as a list, not a caption. */}\n <AlertDialogDescription asChild>\n <div className=\"stack-3 text-left\">\n {immediateEffect ? (\n <ConsequenceRow icon={Zap} label=\"Immediately\">\n {immediateEffect}\n </ConsequenceRow>\n ) : null}\n {delayedEffect ? (\n <ConsequenceRow icon={Clock} label=\"Afterward\">\n {delayedEffect}\n </ConsequenceRow>\n ) : null}\n {reversibility ? (\n <ConsequenceRow icon={RotateCcw} label=\"Reversibility\">\n {reversibility}\n </ConsequenceRow>\n ) : null}\n </div>\n </AlertDialogDescription>\n </AlertDialogHeader>\n\n {reason ? (\n <div className=\"stack-2\">\n <Label htmlFor={reasonId}>{reason.label ?? 'Reason'}</Label>\n <Textarea\n id={reasonId}\n value={reason.value}\n onChange={(e) => reason.onChange(e.target.value)}\n placeholder={reason.placeholder}\n inputFormat={reason.inputFormat}\n rows={reason.rows ?? 3}\n disabled={pending}\n aria-describedby={reason.hint ? reasonHintId : undefined}\n />\n {reason.hint ? reason.hint(reasonHintId) : null}\n </div>\n ) : null}\n\n {typedConfirmation && typedFormat ? (\n <div className=\"stack-2\">\n <Label htmlFor={typedId}>\n {typedConfirmation.label ?? (\n <>\n Type <span className=\"font-mono\">{typedConfirmation.phrase}</span> to confirm\n </>\n )}\n </Label>\n <Input\n id={typedId}\n value={typedValue}\n onChange={(e) => setTypedValue(e.target.value)}\n placeholder={typedConfirmation.phrase}\n inputFormat={typedFormat}\n disabled={pending}\n autoComplete=\"off\"\n />\n </div>\n ) : null}\n\n <AlertDialogFooter>\n <Button\n variant=\"outline\"\n onClick={() => handleOpenChange(false)}\n disabled={pending}\n >\n {cancelLabel}\n </Button>\n <Button\n variant={destructive ? 'destructive' : 'default'}\n onClick={handleConfirm}\n disabled={!reasonOk || !typedOk}\n pending={pending}\n >\n {confirmLabel}\n </Button>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"consequence-dialog.js","sourceRoot":"","sources":["../../../src/react/components/consequence-dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE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AE,OAAO,EACjB,YAAY,EAAC,KAAK,GAClB,IACE,CACP,CAAC,CAAC,CAAC,IAAI,EAER,MAAC,iBAAiB,eAChB,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,OAAO,YAChF,WAAW,GACL,EACT,KAAC,MAAM,IACL,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,EAChD,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,CAAC,QAAQ,IAAI,CAAC,OAAO,EAC/B,OAAO,EAAE,OAAO,YAEf,YAAY,GACN,IACS,IACD,IACT,CACf,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { useCallback, useId, useMemo, useState } from 'react';\nimport {\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogHeader,\n AlertDialogFooter,\n AlertDialogTitle,\n AlertDialogDescription,\n} from './alert-dialog.js';\nimport { Button } from './button.js';\nimport { Textarea } from './textarea.js';\nimport { Input } from './input.js';\nimport { Label } from './label.js';\nimport {\n checkInputFormat,\n defineInputFormat,\n type DeclaredInputFormat,\n} from '@ttt-productions/input-format-core';\nimport { Zap, Clock, RotateCcw } from 'lucide-react';\n\n/**\n * The inline reason field. The caller OWNS the reason value/onChange (draft state lives at the call\n * site) and the field's declaration — this component declares no business numbers and no copy.\n * Confirm stays disabled until the value passes the declaration's check; `min: 0` makes the reason\n * optional.\n */\nexport interface ConsequenceDialogReason {\n inputFormat: DeclaredInputFormat;\n placeholder?: string;\n label?: React.ReactNode;\n value: string;\n onChange: (value: string) => void;\n rows?: number;\n /**\n * A line rendered directly under the reason box, such as why its current text is refused. It is\n * called with the id the box names in its `aria-describedby`, and the element it renders carries\n * that id. The caller owns the words; this component adds none.\n */\n hint?: (id: string) => React.ReactNode;\n}\n\n/**\n * The exact-match typed-confirmation gate. `phrase` is business copy owned by the CALLER; the\n * component only compares the typed value against it.\n */\nexport interface ConsequenceDialogTypedConfirmation {\n phrase: string;\n label?: React.ReactNode;\n}\n\nexport interface ConsequenceDialogProps {\n /** Uncontrolled open model: the element that opens the dialog (rendered `asChild`). */\n trigger?: React.ReactNode;\n /** Controlled open model. Provide with `onOpenChange`. */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n\n /** Heading — a string or node so callers can interpolate amounts / names. */\n title: React.ReactNode;\n\n /** SLOT 1 — what happens right now (e.g. \"initiates a Stripe refund of $X now\"). */\n immediateEffect?: React.ReactNode;\n /** SLOT 2 — what settles later, out of band (webhook / worker / async confirmation). */\n delayedEffect?: React.ReactNode;\n /** SLOT 3 — whether/how this can be undone or superseded. */\n reversibility?: React.ReactNode;\n\n /** Inline reason field. Optional. */\n reason?: ConsequenceDialogReason;\n /** Exact-phrase typed-confirmation gate. Optional. */\n typedConfirmation?: ConsequenceDialogTypedConfirmation;\n\n confirmLabel: React.ReactNode;\n cancelLabel?: React.ReactNode;\n /** `true` styles the confirm button with `bg-destructive`. */\n destructive?: boolean;\n\n /**\n * Runs on confirm. May be async — while it is pending the dialog STAYS OPEN: the confirm button\n * is `aria-disabled`, keeps focus, ignores further presses, and shows its pending spinner, and\n * only Cancel is natively disabled. Closes on resolve. If it rejects the dialog\n * stays open so the caller's own surface (error toast, TOTP step-up) can show and the operator can\n * retry or cancel. This component takes no Sentry/monitoring dependency — every error path\n * belongs to the caller's `onConfirm`.\n */\n onConfirm: () => void | Promise<void>;\n\n /**\n * Runs as the dialog closes, before Radix returns focus to the control that opened it. A confirmed\n * action that removes that control moves focus to its own destination here and calls\n * `event.preventDefault()`, so the restore does not pull focus back onto a control about to go.\n */\n onCloseAutoFocus?: (event: Event) => void;\n}\n\nconst SLOT_ICON_CLASS = 'icon-xs mt-0.5 shrink-0 text-muted-foreground';\n\n/**\n * One consequence slot: the icon beside a block column whose label sits on its own line above\n * the slot text. Every element is a block: the `stack-*` spacing is a vertical margin, which an\n * inline element ignores.\n */\nfunction ConsequenceRow({\n icon: Icon,\n label,\n children,\n}: {\n icon: typeof Zap;\n label: string;\n children: React.ReactNode;\n}) {\n return (\n <div className=\"flex items-start gap-2\">\n <Icon className={SLOT_ICON_CLASS} aria-hidden=\"true\" />\n <div className=\"stack-1 min-w-0\">\n <div className=\"text-caption font-medium uppercase tracking-wide text-muted-foreground\">\n {label}\n </div>\n <div className=\"text-small text-foreground\">{children}</div>\n </div>\n </div>\n );\n}\n\n/**\n * A reusable confirm-before-a-consequential-action dialog. Three optional, consistently-styled\n * consequence slots (immediate / afterward / reversibility), an optional inline reason field,\n * and an optional exact-phrase typed-confirmation gate. Composes the ui-core AlertDialog primitives\n * (Radix) — it never re-implements them. Supports BOTH a `trigger` (uncontrolled) and `open` /\n * `onOpenChange` (controlled).\n *\n * Pending model: the confirm button is a plain `Button` (NOT `AlertDialogAction`), so Radix does not\n * auto-close on click; open state is managed here so the dialog stays open with a visible spinner\n * until `onConfirm` resolves.\n */\nexport function ConsequenceDialog({\n trigger,\n open,\n onOpenChange,\n title,\n immediateEffect,\n delayedEffect,\n reversibility,\n reason,\n typedConfirmation,\n confirmLabel,\n cancelLabel = 'Cancel',\n destructive = false,\n onConfirm,\n onCloseAutoFocus,\n}: ConsequenceDialogProps) {\n const isControlled = open !== undefined;\n const [internalOpen, setInternalOpen] = useState(false);\n const [typedValue, setTypedValue] = useState('');\n const [pending, setPending] = useState(false);\n\n const actualOpen = isControlled ? open : internalOpen;\n\n const reasonId = useId();\n const reasonHintId = useId();\n const typedId = useId();\n\n const setOpenState = useCallback(\n (next: boolean) => {\n if (isControlled) onOpenChange?.(next);\n else setInternalOpen(next);\n },\n [isControlled, onOpenChange],\n );\n\n // Never allow an open-state change (Escape, cancel, controlled parent) to fight the pending action.\n const handleOpenChange = useCallback(\n (next: boolean) => {\n if (pending) return;\n setTypedValue(''); // reset the typed gate on every open/close\n setOpenState(next);\n },\n [pending, setOpenState],\n );\n\n const handleConfirm = useCallback(async () => {\n if (pending) return;\n setPending(true);\n try {\n await onConfirm();\n setTypedValue('');\n setOpenState(false);\n } catch {\n // Keep the dialog open — the caller's onConfirm surfaced the error (toast / step-up). The\n // operator can retry or cancel. Never rethrow, never monitor here.\n } finally {\n setPending(false);\n }\n }, [pending, onConfirm, setOpenState]);\n\n const reasonOk = !reason || checkInputFormat(reason.value, reason.inputFormat).ok;\n\n const typedOk = !typedConfirmation ? true : typedValue === typedConfirmation.phrase;\n // The phrase is one line, and nothing longer than it can ever match it.\n const phrase = typedConfirmation?.phrase ?? '';\n const typedFormat = useMemo(\n () =>\n phrase.length > 0\n ? defineInputFormat({ format: 'singleLine', min: 1, max: phrase.length })\n : null,\n [phrase],\n );\n\n return (\n <AlertDialog open={actualOpen} onOpenChange={handleOpenChange}>\n {trigger ? <AlertDialogTrigger asChild>{trigger}</AlertDialogTrigger> : null}\n <AlertDialogContent\n onEscapeKeyDown={(e) => {\n if (pending) e.preventDefault();\n }}\n onCloseAutoFocus={onCloseAutoFocus}\n >\n <AlertDialogHeader>\n <AlertDialogTitle>{title}</AlertDialogTitle>\n {/* A div, not the primitive's default <p>: the rows are blocks, which a <p> cannot hold.\n Left-aligned at every width — the header centres its text on narrow screens, and a\n wrapped consequence line reads as a list, not a caption. */}\n <AlertDialogDescription asChild>\n <div className=\"stack-3 text-left\">\n {immediateEffect ? (\n <ConsequenceRow icon={Zap} label=\"Immediately\">\n {immediateEffect}\n </ConsequenceRow>\n ) : null}\n {delayedEffect ? (\n <ConsequenceRow icon={Clock} label=\"Afterward\">\n {delayedEffect}\n </ConsequenceRow>\n ) : null}\n {reversibility ? (\n <ConsequenceRow icon={RotateCcw} label=\"Reversibility\">\n {reversibility}\n </ConsequenceRow>\n ) : null}\n </div>\n </AlertDialogDescription>\n </AlertDialogHeader>\n\n {reason ? (\n <div className=\"stack-2\">\n <Label htmlFor={reasonId}>{reason.label ?? 'Reason'}</Label>\n <Textarea\n id={reasonId}\n value={reason.value}\n onChange={(e) => reason.onChange(e.target.value)}\n placeholder={reason.placeholder}\n inputFormat={reason.inputFormat}\n rows={reason.rows ?? 3}\n disabled={pending}\n aria-describedby={reason.hint ? reasonHintId : undefined}\n />\n {reason.hint ? reason.hint(reasonHintId) : null}\n </div>\n ) : null}\n\n {typedConfirmation && typedFormat ? (\n <div className=\"stack-2\">\n <Label htmlFor={typedId}>\n {typedConfirmation.label ?? (\n <>\n Type <span className=\"font-mono\">{typedConfirmation.phrase}</span> to confirm\n </>\n )}\n </Label>\n <Input\n id={typedId}\n value={typedValue}\n onChange={(e) => setTypedValue(e.target.value)}\n placeholder={typedConfirmation.phrase}\n inputFormat={typedFormat}\n disabled={pending}\n autoComplete=\"off\"\n />\n </div>\n ) : null}\n\n <AlertDialogFooter>\n <Button variant=\"outline\" onClick={() => handleOpenChange(false)} disabled={pending}>\n {cancelLabel}\n </Button>\n <Button\n variant={destructive ? 'destructive' : 'default'}\n onClick={handleConfirm}\n disabled={!reasonOk || !typedOk}\n pending={pending}\n >\n {confirmLabel}\n </Button>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/react/components/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/react/components/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoED;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAS,UAAU,CAAC,EAClB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,WAAmB,EACnB,aAAqB,EACrB,SAAS,GACV,EAAE,eAAe,qBAugBjB;kBA9gBQ,UAAU;;;AAkhBnB,OAAO,EAAE,UAAU,EAAE,CAAC"}
|