@ttt-productions/ui-core 0.11.14 → 0.11.15
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/react/components/badge.d.ts +2 -2
- package/dist/react/components/button.d.ts +11 -2
- package/dist/react/components/button.d.ts.map +1 -1
- package/dist/react/components/button.js +18 -5
- package/dist/react/components/button.js.map +1 -1
- package/dist/react/components/chunk-error-recovery.js +2 -2
- package/dist/react/components/chunk-error-recovery.js.map +1 -1
- package/dist/react/components/consequence-dialog.d.ts +1 -1
- package/dist/react/components/consequence-dialog.d.ts.map +1 -1
- package/dist/react/components/consequence-dialog.js +2 -3
- package/dist/react/components/consequence-dialog.js.map +1 -1
- package/dist/react/components/dropdown-menu.d.ts +8 -0
- package/dist/react/components/dropdown-menu.d.ts.map +1 -1
- package/dist/react/components/dropdown-menu.js +2 -1
- package/dist/react/components/dropdown-menu.js.map +1 -1
- package/dist/react/components/list-pagination.d.ts.map +1 -1
- package/dist/react/components/list-pagination.js +19 -1
- package/dist/react/components/list-pagination.js.map +1 -1
- package/dist/react/components/search-dropdown.d.ts.map +1 -1
- package/dist/react/components/search-dropdown.js +3 -2
- package/dist/react/components/search-dropdown.js.map +1 -1
- package/dist/react/components/select.d.ts +8 -1
- package/dist/react/components/select.d.ts.map +1 -1
- package/dist/react/components/select.js +2 -1
- package/dist/react/components/select.js.map +1 -1
- package/dist/react/components/spinner.d.ts +23 -0
- package/dist/react/components/spinner.d.ts.map +1 -0
- package/dist/react/components/spinner.js +27 -0
- package/dist/react/components/spinner.js.map +1 -0
- package/dist/react/components/switch.d.ts +8 -1
- package/dist/react/components/switch.d.ts.map +1 -1
- package/dist/react/components/switch.js +2 -1
- package/dist/react/components/switch.js.map +1 -1
- package/dist/react/hooks/use-async-action.d.ts +30 -0
- package/dist/react/hooks/use-async-action.d.ts.map +1 -0
- package/dist/react/hooks/use-async-action.js +39 -0
- package/dist/react/hooks/use-async-action.js.map +1 -0
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +2 -0
- package/dist/react/index.js.map +1 -1
- package/package.json +3 -3
- package/src/react/components/button.tsx +46 -10
- package/src/react/components/chunk-error-recovery.tsx +2 -2
- package/src/react/components/consequence-dialog.tsx +4 -6
- package/src/react/components/dropdown-menu.tsx +16 -2
- package/src/react/components/list-pagination.tsx +24 -4
- package/src/react/components/search-dropdown.tsx +4 -3
- package/src/react/components/select.tsx +19 -5
- package/src/react/components/spinner.tsx +49 -0
- package/src/react/components/switch.tsx +16 -4
- package/src/react/hooks/use-async-action.ts +63 -0
- package/src/react/index.ts +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/react/components/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/react/components/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAMzD,QAAA,MAAM,MAAM,uCAAuB,CAAA;AACnC,QAAA,MAAM,WAAW,yGAAwB,CAAA;AACzC,QAAA,MAAM,WAAW,0GAAwB,CAAA;AAEzC,QAAA,MAAM,aAAa;IAGf;;;;OAIG;cACO,OAAO;2CAsBnB,CAAA;AAGF,QAAA,MAAM,oBAAoB,qKAWxB,CAAA;AAGF,QAAA,MAAM,sBAAsB,uKAW1B,CAAA;AAGF,QAAA,MAAM,aAAa,8JA6BjB,CAAA;AAGF,QAAA,MAAM,WAAW,4JASf,CAAA;AAGF,QAAA,MAAM,UAAU,2JAoBd,CAAA;AAGF,QAAA,MAAM,eAAe,gKASnB,CAAA;AAGF,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,CAAA"}
|
|
@@ -4,10 +4,11 @@ import * as React from "react";
|
|
|
4
4
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
5
5
|
import { Check, ChevronDown, ChevronUp } from "lucide-react";
|
|
6
6
|
import { cn } from "../../lib/utils.js";
|
|
7
|
+
import { Spinner } from "./spinner.js";
|
|
7
8
|
const Select = SelectPrimitive.Root;
|
|
8
9
|
const SelectGroup = SelectPrimitive.Group;
|
|
9
10
|
const SelectValue = SelectPrimitive.Value;
|
|
10
|
-
const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: cn("flex h-10 w-full items-center justify-between rounded-md border-2 border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { className: "h-4 w-4 opacity-50" }) })] })));
|
|
11
|
+
const SelectTrigger = React.forwardRef(({ className, children, pending = false, disabled, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: cn("flex h-10 w-full items-center justify-between rounded-md border-2 border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className), ...props, ...(pending ? { "aria-busy": true, "data-pending": "" } : {}), disabled: disabled || pending || undefined, children: [children, pending ? (_jsx(Spinner, { size: "xs" })) : (_jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { className: "h-4 w-4 opacity-50" }) }))] })));
|
|
11
12
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
12
13
|
const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollUpButton, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: _jsx(ChevronUp, { className: "h-4 w-4" }) })));
|
|
13
14
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/react/components/select.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE5D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/react/components/select.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE5D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAA;AACnC,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAA;AACzC,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAA;AAEzC,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAUpC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CACvE,MAAC,eA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AAG,EAAE,EAAE,CAAC,CAC5C,MAAC,eAAe,CAAC,IAAI,IACnB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,6NAA6N,EAC7N,SAAS,CACV,KACG,KAAK,aAET,eAAM,SAAS,EAAC,8DAA8D,YAC5E,KAAC,eAAe,CAAC,aAAa,cAC5B,KAAC,KAAK,IAAC,SAAS,EAAC,SAAS,GAAG,GACC,GAC3B,EAEP,KAAC,eAAe,CAAC,QAAQ,cAAE,QAAQ,GAA4B,IAC1C,CACxB,CAAC,CAAA;AACF,UAAU,CAAC,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,WAAW,CAAA;AAEzD,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,CAGtC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,KAAC,eAAe,CAAC,SAAS,IACxB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,0BAA0B,EAAE,SAAS,CAAC,KAChD,KAAK,GACT,CACH,CAAC,CAAA;AACF,eAAe,CAAC,WAAW,GAAG,eAAe,CAAC,SAAS,CAAC,WAAW,CAAA;AAEnE,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,CAAA","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport * as SelectPrimitive from \"@radix-ui/react-select\"\nimport { Check, ChevronDown, ChevronUp } from \"lucide-react\"\n\nimport { cn } from \"../../lib/utils.js\"\nimport { Spinner } from \"./spinner.js\"\n\nconst Select = SelectPrimitive.Root\nconst SelectGroup = SelectPrimitive.Group\nconst SelectValue = SelectPrimitive.Value\n\nconst SelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & {\n /**\n * The change this select started is in flight: the trigger disables itself, sets\n * `aria-busy`, and shows the spinner in place of its chevron. It keeps showing the\n * COMMITTED value — the caller changes `value` only once the write lands.\n */\n pending?: boolean\n }\n>(({ className, children, pending = false, disabled, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex h-10 w-full items-center justify-between rounded-md border-2 border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1\",\n className\n )}\n {...props}\n {...(pending ? { \"aria-busy\": true, \"data-pending\": \"\" } : {})}\n disabled={disabled || pending || undefined}\n >\n {children}\n {pending ? (\n <Spinner size=\"xs\" />\n ) : (\n <SelectPrimitive.Icon asChild>\n <ChevronDown className=\"h-4 w-4 opacity-50\" />\n </SelectPrimitive.Icon>\n )}\n </SelectPrimitive.Trigger>\n))\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName\n\nconst SelectScrollUpButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\"flex cursor-default items-center justify-center py-1\", className)}\n {...props}\n >\n <ChevronUp className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollUpButton>\n))\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName\n\nconst SelectScrollDownButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\"flex cursor-default items-center justify-center py-1\", className)}\n {...props}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollDownButton>\n))\nSelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName\n\nconst SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = \"popper\", ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n className={cn(\n \"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n className\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n \"p-1\",\n position === \"popper\" &&\n \"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]\"\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n))\nSelectContent.displayName = SelectPrimitive.Content.displayName\n\nconst SelectLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\"py-1.5 pl-8 pr-2 text-sm font-semibold\", className)}\n {...props}\n />\n))\nSelectLabel.displayName = SelectPrimitive.Label.displayName\n\nconst SelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n))\nSelectItem.displayName = SelectPrimitive.Item.displayName\n\nconst SelectSeparator = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n))\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type SpinnerSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
2
|
+
export interface SpinnerProps {
|
|
3
|
+
/** Maps onto the theme-core `spinner-*` classes. Defaults to `xs` (the in-control size). */
|
|
4
|
+
size?: SpinnerSize;
|
|
5
|
+
/**
|
|
6
|
+
* Screen-reader text. When set, the spinner becomes a `status` live region that
|
|
7
|
+
* announces it. Omit it for a spinner inside a control that already carries its
|
|
8
|
+
* own busy state (`aria-busy`) — the control speaks for it.
|
|
9
|
+
*/
|
|
10
|
+
label?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The ONE loading spinner. Every in-progress indicator renders through this
|
|
15
|
+
* component (or through a control's `pending` prop, which renders it), so the
|
|
16
|
+
* spinner's look, size scale, and color rule have one change point. The
|
|
17
|
+
* theme-core `spinner-*` classes own size, animation, and color — including the
|
|
18
|
+
* `button .spinner-*` rule that makes an in-button spinner inherit the button's
|
|
19
|
+
* text color so it is never primary-on-primary.
|
|
20
|
+
*/
|
|
21
|
+
declare function Spinner({ size, label, className }: SpinnerProps): import("react").JSX.Element;
|
|
22
|
+
export { Spinner };
|
|
23
|
+
//# sourceMappingURL=spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/react/components/spinner.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAE1D,MAAM,WAAW,YAAY;IAC3B,4FAA4F;IAC5F,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAUD;;;;;;;GAOG;AACH,iBAAS,OAAO,CAAC,EAAE,IAAW,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,YAAY,+BAU/D;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Loader2 } from "lucide-react";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
const SIZE_CLASS = {
|
|
6
|
+
xs: "spinner-xs",
|
|
7
|
+
sm: "spinner-sm",
|
|
8
|
+
md: "spinner-md",
|
|
9
|
+
lg: "spinner-lg",
|
|
10
|
+
xl: "spinner-xl",
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The ONE loading spinner. Every in-progress indicator renders through this
|
|
14
|
+
* component (or through a control's `pending` prop, which renders it), so the
|
|
15
|
+
* spinner's look, size scale, and color rule have one change point. The
|
|
16
|
+
* theme-core `spinner-*` classes own size, animation, and color — including the
|
|
17
|
+
* `button .spinner-*` rule that makes an in-button spinner inherit the button's
|
|
18
|
+
* text color so it is never primary-on-primary.
|
|
19
|
+
*/
|
|
20
|
+
function Spinner({ size = "xs", label, className }) {
|
|
21
|
+
if (!label) {
|
|
22
|
+
return _jsx(Loader2, { className: cn(SIZE_CLASS[size], className), "aria-hidden": "true" });
|
|
23
|
+
}
|
|
24
|
+
return (_jsxs("span", { role: "status", className: cn("inline-flex items-center justify-center", className), children: [_jsx(Loader2, { className: SIZE_CLASS[size], "aria-hidden": "true" }), _jsx("span", { className: "sr-only", children: label })] }));
|
|
25
|
+
}
|
|
26
|
+
export { Spinner };
|
|
27
|
+
//# sourceMappingURL=spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../../src/react/components/spinner.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAgBvC,MAAM,UAAU,GAAgC;IAC9C,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;CACjB,CAAA;AAED;;;;;;;GAOG;AACH,SAAS,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,EAAE,SAAS,EAAgB;IAC9D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAC,OAAO,IAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,iBAAc,MAAM,GAAG,CAAA;IACnF,CAAC;IACD,OAAO,CACL,gBAAM,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAE,EAAE,CAAC,yCAAyC,EAAE,SAAS,CAAC,aACrF,KAAC,OAAO,IAAC,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,iBAAc,MAAM,GAAG,EAC3D,eAAM,SAAS,EAAC,SAAS,YAAE,KAAK,GAAQ,IACnC,CACR,CAAA;AACH,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,CAAA","sourcesContent":["\"use client\"\n\nimport { Loader2 } from \"lucide-react\"\n\nimport { cn } from \"../../lib/utils.js\"\n\nexport type SpinnerSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\"\n\nexport interface SpinnerProps {\n /** Maps onto the theme-core `spinner-*` classes. Defaults to `xs` (the in-control size). */\n size?: SpinnerSize\n /**\n * Screen-reader text. When set, the spinner becomes a `status` live region that\n * announces it. Omit it for a spinner inside a control that already carries its\n * own busy state (`aria-busy`) — the control speaks for it.\n */\n label?: string\n className?: string\n}\n\nconst SIZE_CLASS: Record<SpinnerSize, string> = {\n xs: \"spinner-xs\",\n sm: \"spinner-sm\",\n md: \"spinner-md\",\n lg: \"spinner-lg\",\n xl: \"spinner-xl\",\n}\n\n/**\n * The ONE loading spinner. Every in-progress indicator renders through this\n * component (or through a control's `pending` prop, which renders it), so the\n * spinner's look, size scale, and color rule have one change point. The\n * theme-core `spinner-*` classes own size, animation, and color — including the\n * `button .spinner-*` rule that makes an in-button spinner inherit the button's\n * text color so it is never primary-on-primary.\n */\nfunction Spinner({ size = \"xs\", label, className }: SpinnerProps) {\n if (!label) {\n return <Loader2 className={cn(SIZE_CLASS[size], className)} aria-hidden=\"true\" />\n }\n return (\n <span role=\"status\" className={cn(\"inline-flex items-center justify-center\", className)}>\n <Loader2 className={SIZE_CLASS[size]} aria-hidden=\"true\" />\n <span className=\"sr-only\">{label}</span>\n </span>\n )\n}\n\nexport { Spinner }\n"]}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as SwitchPrimitives from "@radix-ui/react-switch";
|
|
3
|
-
declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> &
|
|
3
|
+
declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
4
|
+
/**
|
|
5
|
+
* The change this switch started is in flight: the switch disables itself, sets
|
|
6
|
+
* `aria-busy`, and spins inside its thumb. It keeps showing the COMMITTED state —
|
|
7
|
+
* the caller flips `checked` only once the write lands.
|
|
8
|
+
*/
|
|
9
|
+
pending?: boolean;
|
|
10
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
4
11
|
export { Switch };
|
|
5
12
|
//# sourceMappingURL=switch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/react/components/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/react/components/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAK1D,QAAA,MAAM,MAAM;IAGR;;;;OAIG;cACO,OAAO;2CAqBnB,CAAA;AAGF,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -3,7 +3,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import * as SwitchPrimitives from "@radix-ui/react-switch";
|
|
5
5
|
import { cn } from "../../lib/utils.js";
|
|
6
|
-
|
|
6
|
+
import { Spinner } from "./spinner.js";
|
|
7
|
+
const Switch = React.forwardRef(({ className, pending = false, disabled, ...props }, ref) => (_jsx(SwitchPrimitives.Root, { className: cn("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", className), ...props, ...(pending ? { "aria-busy": true, "data-pending": "" } : {}), disabled: disabled || pending || undefined, ref: ref, children: _jsx(SwitchPrimitives.Thumb, { className: cn("pointer-events-none flex h-5 w-5 items-center justify-center rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"), children: pending ? _jsx(Spinner, { size: "xs" }) : null }) })));
|
|
7
8
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
8
9
|
export { Switch };
|
|
9
10
|
//# sourceMappingURL=switch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/react/components/switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAE1D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/react/components/switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAE1D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAU7B,CAAC,EAAE,SAAS,EAAE,OAAO,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAC7D,KAAC,gBAAgB,CAAC,IAAI,IACpB,SAAS,EAAE,EAAE,CACX,sXAAsX,EACtX,SAAS,CACV,KACG,KAAK,KACL,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAC9D,QAAQ,EAAE,QAAQ,IAAI,OAAO,IAAI,SAAS,EAC1C,GAAG,EAAE,GAAG,YAER,KAAC,gBAAgB,CAAC,KAAK,IACrB,SAAS,EAAE,EAAE,CACX,uMAAuM,CACxM,YAEA,OAAO,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,IAAI,EAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,GAChB,GACH,CACzB,CAAC,CAAA;AACF,MAAM,CAAC,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAA;AAEtD,OAAO,EAAE,MAAM,EAAE,CAAA","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport * as SwitchPrimitives from \"@radix-ui/react-switch\"\n\nimport { cn } from \"../../lib/utils.js\"\nimport { Spinner } from \"./spinner.js\"\n\nconst Switch = React.forwardRef<\n React.ElementRef<typeof SwitchPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> & {\n /**\n * The change this switch started is in flight: the switch disables itself, sets\n * `aria-busy`, and spins inside its thumb. It keeps showing the COMMITTED state —\n * the caller flips `checked` only once the write lands.\n */\n pending?: boolean\n }\n>(({ className, pending = false, disabled, ...props }, ref) => (\n <SwitchPrimitives.Root\n className={cn(\n \"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input\",\n className\n )}\n {...props}\n {...(pending ? { \"aria-busy\": true, \"data-pending\": \"\" } : {})}\n disabled={disabled || pending || undefined}\n ref={ref}\n >\n <SwitchPrimitives.Thumb\n className={cn(\n \"pointer-events-none flex h-5 w-5 items-center justify-center rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0\"\n )}\n >\n {pending ? <Spinner size=\"xs\" /> : null}\n </SwitchPrimitives.Thumb>\n </SwitchPrimitives.Root>\n))\nSwitch.displayName = SwitchPrimitives.Root.displayName\n\nexport { Switch }\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface UseAsyncActionOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Receives anything the action throws. REQUIRED, so every call site decides what a
|
|
4
|
+
* failure means (surface it, capture it, or accept that another layer already did):
|
|
5
|
+
* `run` itself never rejects, so a fire-and-forget `onClick={() => void run()}` can
|
|
6
|
+
* never become an unhandled rejection.
|
|
7
|
+
*/
|
|
8
|
+
onError: (error: unknown) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface AsyncAction<TArgs extends unknown[]> {
|
|
11
|
+
/**
|
|
12
|
+
* Starts the action unless one is already in flight — a repeat call while pending is
|
|
13
|
+
* ignored. Resolves once the action settles: `true` when it completed, `false` when it
|
|
14
|
+
* was ignored or threw. Never rejects.
|
|
15
|
+
*/
|
|
16
|
+
run: (...args: TArgs) => Promise<boolean>;
|
|
17
|
+
/** True from the moment `run` starts the action until it settles. */
|
|
18
|
+
pending: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Pending state + repeat guard for async work that is NOT a React Query mutation
|
|
22
|
+
* (a local media step, a sign-out, an awaited navigation). Feed `pending` to the
|
|
23
|
+
* control's own `pending` prop. Server writes stay mutations — this hook does not
|
|
24
|
+
* replace the data layer's one mutation path.
|
|
25
|
+
*
|
|
26
|
+
* The guard is a ref, not the state, so two clicks inside one frame cannot both start
|
|
27
|
+
* the action.
|
|
28
|
+
*/
|
|
29
|
+
export declare function useAsyncAction<TArgs extends unknown[]>(action: (...args: TArgs) => Promise<unknown>, options: UseAsyncActionOptions): AsyncAction<TArgs>;
|
|
30
|
+
//# sourceMappingURL=use-async-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-async-action.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-async-action.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,WAAW,CAAC,KAAK,SAAS,OAAO,EAAE;IAClD;;;;OAIG;IACH,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,qEAAqE;IACrE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,SAAS,OAAO,EAAE,EACpD,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,EAC5C,OAAO,EAAE,qBAAqB,GAC7B,WAAW,CAAC,KAAK,CAAC,CAyBpB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useRef, useState } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Pending state + repeat guard for async work that is NOT a React Query mutation
|
|
5
|
+
* (a local media step, a sign-out, an awaited navigation). Feed `pending` to the
|
|
6
|
+
* control's own `pending` prop. Server writes stay mutations — this hook does not
|
|
7
|
+
* replace the data layer's one mutation path.
|
|
8
|
+
*
|
|
9
|
+
* The guard is a ref, not the state, so two clicks inside one frame cannot both start
|
|
10
|
+
* the action.
|
|
11
|
+
*/
|
|
12
|
+
export function useAsyncAction(action, options) {
|
|
13
|
+
const [pending, setPending] = useState(false);
|
|
14
|
+
const inFlightRef = useRef(false);
|
|
15
|
+
const actionRef = useRef(action);
|
|
16
|
+
const onErrorRef = useRef(options.onError);
|
|
17
|
+
actionRef.current = action;
|
|
18
|
+
onErrorRef.current = options.onError;
|
|
19
|
+
const run = useCallback(async (...args) => {
|
|
20
|
+
if (inFlightRef.current)
|
|
21
|
+
return false;
|
|
22
|
+
inFlightRef.current = true;
|
|
23
|
+
setPending(true);
|
|
24
|
+
try {
|
|
25
|
+
await actionRef.current(...args);
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
onErrorRef.current(error);
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
inFlightRef.current = false;
|
|
34
|
+
setPending(false);
|
|
35
|
+
}
|
|
36
|
+
}, []);
|
|
37
|
+
return { run, pending };
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=use-async-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-async-action.js","sourceRoot":"","sources":["../../../src/react/hooks/use-async-action.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAuBtD;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC5B,MAA4C,EAC5C,OAA8B;IAE9B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;IAC3B,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAErC,MAAM,GAAG,GAAG,WAAW,CAAC,KAAK,EAAE,GAAG,IAAW,EAAoB,EAAE;QACjE,IAAI,WAAW,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QACtC,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;QAC3B,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,IAAI,CAAC;YACH,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC1B,OAAO,KAAK,CAAC;QACf,CAAC;gBAAS,CAAC;YACT,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;YAC5B,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["\"use client\";\n\nimport { useCallback, useRef, useState } from \"react\";\n\nexport interface UseAsyncActionOptions {\n /**\n * Receives anything the action throws. REQUIRED, so every call site decides what a\n * failure means (surface it, capture it, or accept that another layer already did):\n * `run` itself never rejects, so a fire-and-forget `onClick={() => void run()}` can\n * never become an unhandled rejection.\n */\n onError: (error: unknown) => void;\n}\n\nexport interface AsyncAction<TArgs extends unknown[]> {\n /**\n * Starts the action unless one is already in flight — a repeat call while pending is\n * ignored. Resolves once the action settles: `true` when it completed, `false` when it\n * was ignored or threw. Never rejects.\n */\n run: (...args: TArgs) => Promise<boolean>;\n /** True from the moment `run` starts the action until it settles. */\n pending: boolean;\n}\n\n/**\n * Pending state + repeat guard for async work that is NOT a React Query mutation\n * (a local media step, a sign-out, an awaited navigation). Feed `pending` to the\n * control's own `pending` prop. Server writes stay mutations — this hook does not\n * replace the data layer's one mutation path.\n *\n * The guard is a ref, not the state, so two clicks inside one frame cannot both start\n * the action.\n */\nexport function useAsyncAction<TArgs extends unknown[]>(\n action: (...args: TArgs) => Promise<unknown>,\n options: UseAsyncActionOptions,\n): AsyncAction<TArgs> {\n const [pending, setPending] = useState(false);\n const inFlightRef = useRef(false);\n const actionRef = useRef(action);\n const onErrorRef = useRef(options.onError);\n actionRef.current = action;\n onErrorRef.current = options.onError;\n\n const run = useCallback(async (...args: TArgs): Promise<boolean> => {\n if (inFlightRef.current) return false;\n inFlightRef.current = true;\n setPending(true);\n try {\n await actionRef.current(...args);\n return true;\n } catch (error) {\n onErrorRef.current(error);\n return false;\n } finally {\n inFlightRef.current = false;\n setPending(false);\n }\n }, []);\n\n return { run, pending };\n}\n"]}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type { ButtonProps } from "./components/button.js";
|
|
2
2
|
export { Button, buttonVariants } from "./components/button.js";
|
|
3
|
+
export type { SpinnerProps, SpinnerSize } from "./components/spinner.js";
|
|
4
|
+
export { Spinner } from "./components/spinner.js";
|
|
3
5
|
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } from "./components/card.js";
|
|
4
6
|
export { Label } from "./components/label.js";
|
|
5
7
|
export { Textarea } from "./components/textarea.js";
|
|
@@ -43,6 +45,8 @@ export { ConsequenceDialog } from "./components/consequence-dialog.js";
|
|
|
43
45
|
export type { MaxWidthOption, ScreenAdaptiveViewProps } from "./components/layout/screen-adaptive-view.js";
|
|
44
46
|
export { ScreenAdaptiveView } from "./components/layout/screen-adaptive-view.js";
|
|
45
47
|
export { useMediaQuery } from "./hooks/use-media-query.js";
|
|
48
|
+
export { useAsyncAction } from "./hooks/use-async-action.js";
|
|
49
|
+
export type { AsyncAction, UseAsyncActionOptions } from "./hooks/use-async-action.js";
|
|
46
50
|
export { RelativeTime } from "./components/relative-time.js";
|
|
47
51
|
export type { RelativeTimeProps } from "./components/relative-time.js";
|
|
48
52
|
export { EndOfListIndicator } from "./components/end-of-list-indicator.js";
|
|
@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AC;AAE3E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,YAAY,EAAE,mBAAmB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErG,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAKhG,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACtH,YAAY,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/react/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
export { Button, buttonVariants } from "./components/button.js";
|
|
3
|
+
export { Spinner } from "./components/spinner.js";
|
|
3
4
|
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } from "./components/card.js";
|
|
4
5
|
export { Label } from "./components/label.js";
|
|
5
6
|
export { Textarea } from "./components/textarea.js";
|
|
@@ -36,6 +37,7 @@ export { SearchDropdown } from "./components/search-dropdown.js";
|
|
|
36
37
|
export { ConsequenceDialog } from "./components/consequence-dialog.js";
|
|
37
38
|
export { ScreenAdaptiveView } from "./components/layout/screen-adaptive-view.js";
|
|
38
39
|
export { useMediaQuery } from "./hooks/use-media-query.js";
|
|
40
|
+
export { useAsyncAction } from "./hooks/use-async-action.js";
|
|
39
41
|
// Shared building blocks
|
|
40
42
|
export { RelativeTime } from "./components/relative-time.js";
|
|
41
43
|
export { EndOfListIndicator } from "./components/end-of-list-indicator.js";
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,MAAM,EAAE,cAA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zD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,uFAAuF;AACvF,wFAAwF;AACxF,gCAAgC;AAChC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["\"use client\";\n\nexport type { ButtonProps } from \"./components/button.js\";\nexport { Button, buttonVariants } from \"./components/button.js\";\nexport { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } from \"./components/card.js\";\nexport { Label } from \"./components/label.js\";\nexport { Textarea } from \"./components/textarea.js\";\nexport { Skeleton } from \"./components/skeleton.js\";\nexport { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription } from \"./components/dialog.js\";\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from \"./components/popover.js\";\nexport { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup } from \"./components/dropdown-menu.js\";\nexport { Menubar, MenubarMenu, MenubarTrigger, MenubarContent, MenubarItem, MenubarSeparator, MenubarLabel, MenubarCheckboxItem, MenubarRadioGroup, MenubarRadioItem, MenubarPortal, MenubarSubContent, MenubarSubTrigger, MenubarGroup, MenubarSub, MenubarShortcut } from \"./components/menubar.js\";\nexport { AlertDialog, AlertDialogPortal, AlertDialogOverlay, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel } from \"./components/alert-dialog.js\";\nexport { Alert, AlertTitle, AlertDescription } from \"./components/alert.js\";\nexport type { ToastProps, ToastActionElement } from \"./components/toast.js\";\nexport { ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction } from \"./components/toast.js\";\nexport { Toaster } from \"./components/toaster.js\";\nexport type { ToastVariant, ToasterToast } from \"./hooks/use-toast.js\";\nexport { toast, useToast } from \"./hooks/use-toast.js\";\nexport { Input } from \"./components/input.js\";\nexport { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton } from \"./components/select.js\";\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from \"./components/tabs.js\";\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from \"./components/tooltip.js\";\nexport { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField } from \"./components/form.js\";\nexport { Checkbox } from \"./components/checkbox.js\";\nexport { Switch } from \"./components/switch.js\";\nexport type { BadgeProps } from \"./components/badge.js\";\nexport { Badge, badgeVariants } from \"./components/badge.js\";\nexport { Avatar, AvatarImage, AvatarFallback } from \"./components/avatar.js\";\nexport { Separator } from \"./components/separator.js\";\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from \"./components/accordion.js\";\nexport { RadioGroup, RadioGroupItem } from \"./components/radio-group.js\";\nexport { Progress } from \"./components/progress.js\";\nexport { Slider } from \"./components/slider.js\";\nexport type { DatePickerProps } from \"./components/date-picker.js\";\nexport { DatePicker } from \"./components/date-picker.js\";\nexport { ScrollArea, ScrollBar } from \"./components/scroll-area.js\";\nexport { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption } from \"./components/table.js\";\nexport { Sheet, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription } from \"./components/sheet.js\";\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent } from \"./components/collapsible.js\";\nexport type { SearchDropdownProps } from \"./components/search-dropdown.js\";\nexport { SearchDropdown } from \"./components/search-dropdown.js\";\n\nexport type { ConsequenceDialogProps, ConsequenceDialogReason, ConsequenceDialogTypedConfirmation } from \"./components/consequence-dialog.js\";\nexport { ConsequenceDialog } from \"./components/consequence-dialog.js\";\n\nexport type { MaxWidthOption, ScreenAdaptiveViewProps } from \"./components/layout/screen-adaptive-view.js\";\nexport { ScreenAdaptiveView } from \"./components/layout/screen-adaptive-view.js\";\n\nexport { useMediaQuery } from \"./hooks/use-media-query.js\";\n\n// Shared building blocks\nexport { RelativeTime } from \"./components/relative-time.js\";\nexport type { RelativeTimeProps } from \"./components/relative-time.js\";\n\nexport { EndOfListIndicator } from \"./components/end-of-list-indicator.js\";\nexport type { EndOfListIndicatorProps } from \"./components/end-of-list-indicator.js\";\n\nexport { ScrollToTopButton } from \"./components/scroll-to-top-button.js\";\nexport type { ScrollToTopButtonProps } from \"./components/scroll-to-top-button.js\";\n\nexport { ChunkErrorRecovery } from \"./components/chunk-error-recovery.js\";\nexport type { ChunkErrorRecoveryProps } from \"./components/chunk-error-recovery.js\";\n\n// List pagination — the one Previous / counter / Next control plus the page-state\n// hooks for its two flavors (known total, and cursor/`hasMore`).\nexport { ListPagination } from \"./components/list-pagination.js\";\nexport type { ListPaginationProps } from \"./components/list-pagination.js\";\n\nexport { usePagedList } from \"./hooks/use-paged-list.js\";\nexport type { ListPaginationState, PagedList, UsePagedListOptions } from \"./hooks/use-paged-list.js\";\n\nexport { useCursorPage } from \"./hooks/use-cursor-page.js\";\nexport type { CursorPage, CursorPager, UseCursorPageOptions } from \"./hooks/use-cursor-page.js\";\n\n// Return-scroll: restore a list's window offset when the user comes back to it after a\n// route change (save on leave, restore once on an eligible + ready return, keyed by the\n// caller's canonical list URL).\nexport { useReturnScroll, saveReturnScroll, clearReturnScroll, readReturnScroll } from \"./hooks/use-return-scroll.js\";\nexport type { ReturnScrollEntry, UseReturnScrollOptions, UseReturnScrollResult } from \"./hooks/use-return-scroll.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":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B,EAAE,MAAM,sCAAsC,CAAC;AAG1E,kFAAkF;AAClF,iEAAiE;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAGjE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,uFAAuF;AACvF,wFAAwF;AACxF,gCAAgC;AAChC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["\"use client\";\n\nexport type { ButtonProps } from \"./components/button.js\";\nexport { Button, buttonVariants } from \"./components/button.js\";\nexport type { SpinnerProps, SpinnerSize } from \"./components/spinner.js\";\nexport { Spinner } from \"./components/spinner.js\";\nexport { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } from \"./components/card.js\";\nexport { Label } from \"./components/label.js\";\nexport { Textarea } from \"./components/textarea.js\";\nexport { Skeleton } from \"./components/skeleton.js\";\nexport { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription } from \"./components/dialog.js\";\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from \"./components/popover.js\";\nexport { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup } from \"./components/dropdown-menu.js\";\nexport { Menubar, MenubarMenu, MenubarTrigger, MenubarContent, MenubarItem, MenubarSeparator, MenubarLabel, MenubarCheckboxItem, MenubarRadioGroup, MenubarRadioItem, MenubarPortal, MenubarSubContent, MenubarSubTrigger, MenubarGroup, MenubarSub, MenubarShortcut } from \"./components/menubar.js\";\nexport { AlertDialog, AlertDialogPortal, AlertDialogOverlay, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel } from \"./components/alert-dialog.js\";\nexport { Alert, AlertTitle, AlertDescription } from \"./components/alert.js\";\nexport type { ToastProps, ToastActionElement } from \"./components/toast.js\";\nexport { ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction } from \"./components/toast.js\";\nexport { Toaster } from \"./components/toaster.js\";\nexport type { ToastVariant, ToasterToast } from \"./hooks/use-toast.js\";\nexport { toast, useToast } from \"./hooks/use-toast.js\";\nexport { Input } from \"./components/input.js\";\nexport { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton } from \"./components/select.js\";\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from \"./components/tabs.js\";\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from \"./components/tooltip.js\";\nexport { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField } from \"./components/form.js\";\nexport { Checkbox } from \"./components/checkbox.js\";\nexport { Switch } from \"./components/switch.js\";\nexport type { BadgeProps } from \"./components/badge.js\";\nexport { Badge, badgeVariants } from \"./components/badge.js\";\nexport { Avatar, AvatarImage, AvatarFallback } from \"./components/avatar.js\";\nexport { Separator } from \"./components/separator.js\";\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from \"./components/accordion.js\";\nexport { RadioGroup, RadioGroupItem } from \"./components/radio-group.js\";\nexport { Progress } from \"./components/progress.js\";\nexport { Slider } from \"./components/slider.js\";\nexport type { DatePickerProps } from \"./components/date-picker.js\";\nexport { DatePicker } from \"./components/date-picker.js\";\nexport { ScrollArea, ScrollBar } from \"./components/scroll-area.js\";\nexport { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption } from \"./components/table.js\";\nexport { Sheet, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription } from \"./components/sheet.js\";\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent } from \"./components/collapsible.js\";\nexport type { SearchDropdownProps } from \"./components/search-dropdown.js\";\nexport { SearchDropdown } from \"./components/search-dropdown.js\";\n\nexport type { ConsequenceDialogProps, ConsequenceDialogReason, ConsequenceDialogTypedConfirmation } from \"./components/consequence-dialog.js\";\nexport { ConsequenceDialog } from \"./components/consequence-dialog.js\";\n\nexport type { MaxWidthOption, ScreenAdaptiveViewProps } from \"./components/layout/screen-adaptive-view.js\";\nexport { ScreenAdaptiveView } from \"./components/layout/screen-adaptive-view.js\";\n\nexport { useMediaQuery } from \"./hooks/use-media-query.js\";\n\nexport { useAsyncAction } from \"./hooks/use-async-action.js\";\nexport type { AsyncAction, UseAsyncActionOptions } from \"./hooks/use-async-action.js\";\n\n// Shared building blocks\nexport { RelativeTime } from \"./components/relative-time.js\";\nexport type { RelativeTimeProps } from \"./components/relative-time.js\";\n\nexport { EndOfListIndicator } from \"./components/end-of-list-indicator.js\";\nexport type { EndOfListIndicatorProps } from \"./components/end-of-list-indicator.js\";\n\nexport { ScrollToTopButton } from \"./components/scroll-to-top-button.js\";\nexport type { ScrollToTopButtonProps } from \"./components/scroll-to-top-button.js\";\n\nexport { ChunkErrorRecovery } from \"./components/chunk-error-recovery.js\";\nexport type { ChunkErrorRecoveryProps } from \"./components/chunk-error-recovery.js\";\n\n// List pagination — the one Previous / counter / Next control plus the page-state\n// hooks for its two flavors (known total, and cursor/`hasMore`).\nexport { ListPagination } from \"./components/list-pagination.js\";\nexport type { ListPaginationProps } from \"./components/list-pagination.js\";\n\nexport { usePagedList } from \"./hooks/use-paged-list.js\";\nexport type { ListPaginationState, PagedList, UsePagedListOptions } from \"./hooks/use-paged-list.js\";\n\nexport { useCursorPage } from \"./hooks/use-cursor-page.js\";\nexport type { CursorPage, CursorPager, UseCursorPageOptions } from \"./hooks/use-cursor-page.js\";\n\n// Return-scroll: restore a list's window offset when the user comes back to it after a\n// route change (save on leave, restore once on an eligible + ready return, keyed by the\n// caller's canonical list URL).\nexport { useReturnScroll, saveReturnScroll, clearReturnScroll, readReturnScroll } from \"./hooks/use-return-scroll.js\";\nexport type { ReturnScrollEntry, UseReturnScrollOptions, UseReturnScrollResult } from \"./hooks/use-return-scroll.js\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttt-productions/ui-core",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.15",
|
|
4
4
|
"description": "Shared UI components for TTT Productions projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"react-dom": ">=19.0.0",
|
|
50
50
|
"react-hook-form": ">=7.0.0",
|
|
51
51
|
"@hookform/resolvers": ">=3.0.0",
|
|
52
|
-
"@ttt-productions/firebase-helpers": "^0.12.
|
|
52
|
+
"@ttt-productions/firebase-helpers": "^0.12.9"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
55
55
|
"react": {
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"typescript": "^5.8.3",
|
|
100
100
|
"react-hook-form": "^7.69.0",
|
|
101
101
|
"@hookform/resolvers": "^5.2.2",
|
|
102
|
-
"@ttt-productions/firebase-helpers": "^0.12.
|
|
102
|
+
"@ttt-productions/firebase-helpers": "^0.12.9"
|
|
103
103
|
},
|
|
104
104
|
"author": "DJ (TTT Productions)",
|
|
105
105
|
"license": "MIT"
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import { Slot } from "@radix-ui/react-slot"
|
|
4
|
+
import { Slot, Slottable } from "@radix-ui/react-slot"
|
|
5
5
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
6
6
|
|
|
7
7
|
import { cn } from "../../lib/utils.js"
|
|
8
|
+
import { Spinner } from "./spinner.js"
|
|
8
9
|
|
|
9
10
|
const buttonVariants = cva(
|
|
10
11
|
"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",
|
|
@@ -44,19 +45,54 @@ export interface ButtonProps
|
|
|
44
45
|
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
45
46
|
VariantProps<typeof buttonVariants> {
|
|
46
47
|
asChild?: boolean
|
|
48
|
+
/**
|
|
49
|
+
* Async work this button started is in flight. The button disables itself — so
|
|
50
|
+
* neither a repeat click nor an implicit form resubmit can fire — sets
|
|
51
|
+
* `aria-busy`, and shows the canonical spinner: an icon button (`size="icon"`)
|
|
52
|
+
* swaps its icon for it; any other button shows it in place of its `icon`.
|
|
53
|
+
*/
|
|
54
|
+
pending?: boolean
|
|
55
|
+
/** Leading icon, rendered before the label. While `pending`, the spinner takes its place. */
|
|
56
|
+
icon?: React.ReactNode
|
|
47
57
|
}
|
|
48
58
|
|
|
49
59
|
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
50
|
-
({ className, variant, size, asChild = false, children, ...props }, ref) => {
|
|
51
|
-
const
|
|
60
|
+
({ className, variant, size, asChild = false, pending = false, icon, disabled, children, ...props }, ref) => {
|
|
61
|
+
const shared = {
|
|
62
|
+
...props,
|
|
63
|
+
...(pending ? { "aria-busy": true, "data-pending": "" } : {}),
|
|
64
|
+
disabled: disabled || pending || undefined,
|
|
65
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
66
|
+
}
|
|
67
|
+
const spinner = <Spinner size={size === "lg" ? "sm" : "xs"} />
|
|
68
|
+
const leading = pending ? spinner : icon
|
|
69
|
+
|
|
70
|
+
if (asChild) {
|
|
71
|
+
// Slot finds the Slottable among its DIRECT children, so the leading slot and the
|
|
72
|
+
// Slottable must be siblings here — never wrapped in a fragment.
|
|
73
|
+
return leading ? (
|
|
74
|
+
<Slot ref={ref} {...shared}>
|
|
75
|
+
{leading}
|
|
76
|
+
<Slottable>{children}</Slottable>
|
|
77
|
+
</Slot>
|
|
78
|
+
) : (
|
|
79
|
+
<Slot ref={ref} {...shared}>
|
|
80
|
+
{children}
|
|
81
|
+
</Slot>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
52
85
|
return (
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
86
|
+
<button ref={ref} {...shared}>
|
|
87
|
+
{size === "icon" ? (
|
|
88
|
+
pending ? spinner : children
|
|
89
|
+
) : (
|
|
90
|
+
<>
|
|
91
|
+
{leading}
|
|
92
|
+
{children}
|
|
93
|
+
</>
|
|
94
|
+
)}
|
|
95
|
+
</button>
|
|
60
96
|
)
|
|
61
97
|
}
|
|
62
98
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { Spinner } from "./spinner.js";
|
|
5
5
|
|
|
6
6
|
export interface ChunkErrorRecoveryProps {
|
|
7
7
|
children: React.ReactNode;
|
|
@@ -48,7 +48,7 @@ export function ChunkErrorRecovery({
|
|
|
48
48
|
if (hasError) {
|
|
49
49
|
return (
|
|
50
50
|
<div className="flex flex-col h-screen w-screen items-center justify-center gap-4 bg-background">
|
|
51
|
-
<
|
|
51
|
+
<Spinner size="xl" />
|
|
52
52
|
<p className="text-muted-foreground">{loadingMessage}</p>
|
|
53
53
|
</div>
|
|
54
54
|
);
|
|
@@ -14,7 +14,7 @@ import { Button } from './button.js';
|
|
|
14
14
|
import { Textarea } from './textarea.js';
|
|
15
15
|
import { Input } from './input.js';
|
|
16
16
|
import { Label } from './label.js';
|
|
17
|
-
import {
|
|
17
|
+
import { Zap, Clock, RotateCcw } from 'lucide-react';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* The inline required-reason config. The caller OWNS the reason value/onChange (draft state lives at
|
|
@@ -71,7 +71,7 @@ export interface ConsequenceDialogProps {
|
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* Runs on confirm. May be async — while it is pending the dialog STAYS OPEN, both buttons disable,
|
|
74
|
-
* and
|
|
74
|
+
* and the confirm button shows its pending spinner. Closes on resolve. If it rejects the dialog
|
|
75
75
|
* stays open so the caller's own surface (error toast, TOTP step-up) can show and the operator can
|
|
76
76
|
* retry or cancel. This component takes no Sentry/monitoring dependency — every error path
|
|
77
77
|
* belongs to the caller's `onConfirm`.
|
|
@@ -184,7 +184,6 @@ export function ConsequenceDialog({
|
|
|
184
184
|
(reason.maxLength === undefined || reason.value.length <= reason.maxLength);
|
|
185
185
|
|
|
186
186
|
const typedOk = !typedConfirmation ? true : typedValue === typedConfirmation.phrase;
|
|
187
|
-
const confirmDisabled = pending || !reasonOk || !typedOk;
|
|
188
187
|
|
|
189
188
|
return (
|
|
190
189
|
<AlertDialog open={actualOpen} onOpenChange={handleOpenChange}>
|
|
@@ -263,10 +262,9 @@ export function ConsequenceDialog({
|
|
|
263
262
|
<Button
|
|
264
263
|
variant={destructive ? 'destructive' : 'default'}
|
|
265
264
|
onClick={handleConfirm}
|
|
266
|
-
disabled={
|
|
267
|
-
|
|
265
|
+
disabled={!reasonOk || !typedOk}
|
|
266
|
+
pending={pending}
|
|
268
267
|
>
|
|
269
|
-
{pending ? <Loader2 className="mr-2 spinner-xs" aria-hidden="true" /> : null}
|
|
270
268
|
{confirmLabel}
|
|
271
269
|
</Button>
|
|
272
270
|
</AlertDialogFooter>
|
|
@@ -5,6 +5,7 @@ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
|
|
5
5
|
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
6
6
|
|
|
7
7
|
import { cn } from "../../lib/utils.js"
|
|
8
|
+
import { Spinner } from "./spinner.js"
|
|
8
9
|
|
|
9
10
|
const DropdownMenu = DropdownMenuPrimitive.Root
|
|
10
11
|
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
|
|
@@ -71,8 +72,16 @@ const DropdownMenuItem = React.forwardRef<
|
|
|
71
72
|
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
|
72
73
|
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
73
74
|
inset?: boolean
|
|
75
|
+
/**
|
|
76
|
+
* The action this item started is in flight: the item disables itself, sets
|
|
77
|
+
* `aria-busy`, and shows the spinner in place of its `icon`. Keeping the menu open
|
|
78
|
+
* meanwhile is the caller's `onSelect` (`event.preventDefault()`, close on settle).
|
|
79
|
+
*/
|
|
80
|
+
pending?: boolean
|
|
81
|
+
/** Leading icon. While `pending`, the spinner takes its place. */
|
|
82
|
+
icon?: React.ReactNode
|
|
74
83
|
}
|
|
75
|
-
>(({ className, inset, ...props }, ref) => (
|
|
84
|
+
>(({ className, inset, pending = false, icon, disabled, children, ...props }, ref) => (
|
|
76
85
|
<DropdownMenuPrimitive.Item
|
|
77
86
|
ref={ref}
|
|
78
87
|
className={cn(
|
|
@@ -81,7 +90,12 @@ const DropdownMenuItem = React.forwardRef<
|
|
|
81
90
|
className
|
|
82
91
|
)}
|
|
83
92
|
{...props}
|
|
84
|
-
|
|
93
|
+
{...(pending ? { "aria-busy": true, "data-pending": "" } : {})}
|
|
94
|
+
disabled={disabled || pending || undefined}
|
|
95
|
+
>
|
|
96
|
+
{pending ? <Spinner size="xs" /> : icon}
|
|
97
|
+
{children}
|
|
98
|
+
</DropdownMenuPrimitive.Item>
|
|
85
99
|
))
|
|
86
100
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
|
|
87
101
|
|