@dynamic-labs-sdk/droplet 1.42.0 → 1.43.1
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/components/copy-button/copy-button.d.ts +3 -2
- package/dist/components/copy-button/copy-button.d.ts.map +1 -1
- package/dist/components/ui/table/table.d.ts.map +1 -1
- package/dist/components/ui/table/table.stories.d.ts +3 -0
- package/dist/components/ui/table/table.stories.d.ts.map +1 -1
- package/dist/index.cjs +167 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +167 -71
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export type CopyButtonProps = {
|
|
3
3
|
className?: string;
|
|
4
4
|
label?: string;
|
|
5
5
|
size?: 'default' | 'sm' | 'xs' | 'icon' | 'icon-xs' | 'icon-sm';
|
|
6
6
|
value: string;
|
|
7
7
|
variant?: 'default' | 'outline' | 'ghost' | 'secondary';
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
|
+
/** Copies a value and presents stable, accessible success or failure feedback. */
|
|
9
10
|
export declare const CopyButton: ({ value, label, variant, size, className, }: CopyButtonProps) => ReactElement;
|
|
10
11
|
//# sourceMappingURL=copy-button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-button.d.ts","sourceRoot":"","sources":["../../../src/components/copy-button/copy-button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAA+B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"copy-button.d.ts","sourceRoot":"","sources":["../../../src/components/copy-button/copy-button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAA+B,MAAM,OAAO,CAAC;AAkEvE,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;CACzD,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,UAAU,gDAMpB,eAAe,KAAG,YAmIpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/table/table.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/table/table.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAA+B,MAAM,OAAO,CAAC;AAI5F,QAAA,MAAM,KAAK,4BAGR,cAAc,CAAC,OAAO,CAAC,KAAG,YA4C5B,CAAC;AAEF,QAAA,MAAM,WAAW,4BAGd,cAAc,CAAC,OAAO,CAAC,KAAG,YAW5B,CAAC;AAEF,QAAA,MAAM,SAAS,4BAGZ,cAAc,CAAC,OAAO,CAAC,KAAG,YAiB5B,CAAC;AAEF,QAAA,MAAM,WAAW,4BAGd,cAAc,CAAC,OAAO,CAAC,KAAG,YAa5B,CAAC;AAEF,QAAA,MAAM,QAAQ,4BAGX,cAAc,CAAC,IAAI,CAAC,KAAG,YAWzB,CAAC;AAEF,QAAA,MAAM,SAAS,mCAIZ,cAAc,CAAC,IAAI,CAAC,KAAG,YAYzB,CAAC;AAEF,QAAA,MAAM,SAAS,4BAGZ,cAAc,CAAC,IAAI,CAAC,KAAG,YAWzB,CAAC;AAEF,QAAA,MAAM,YAAY,4BAGf,cAAc,CAAC,SAAS,CAAC,KAAG,YAQ9B,CAAC;AAEF,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,GACb,CAAC"}
|
|
@@ -10,4 +10,7 @@ declare const meta: {
|
|
|
10
10
|
export default meta;
|
|
11
11
|
type Story = StoryObj<typeof meta>;
|
|
12
12
|
export declare const Default: Story;
|
|
13
|
+
export declare const Selected: Story;
|
|
14
|
+
export declare const Empty: Story;
|
|
15
|
+
export declare const Loading: Story;
|
|
13
16
|
//# sourceMappingURL=table.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/table/table.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"table.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/table/table.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAe5D,QAAA,MAAM,IAAI;;;;;;;CAKoB,CAAC;AAE/B,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAoCnC,eAAO,MAAM,OAAO,EAAE,KAoCrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KA4BtB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAqBnB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAwBrB,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -64,7 +64,7 @@ let next_link = require("next/link");
|
|
|
64
64
|
next_link = __toESM(next_link);
|
|
65
65
|
|
|
66
66
|
//#region src/components/unsaved-changes-bar/unsaved-changes-bar.tsx
|
|
67
|
-
const spring$
|
|
67
|
+
const spring$3 = {
|
|
68
68
|
bounce: 0,
|
|
69
69
|
duration: .35,
|
|
70
70
|
type: "spring"
|
|
@@ -102,7 +102,7 @@ const ProgressiveBlur = () => {
|
|
|
102
102
|
});
|
|
103
103
|
};
|
|
104
104
|
const popTransition = {
|
|
105
|
-
...spring$
|
|
105
|
+
...spring$3,
|
|
106
106
|
duration: .25
|
|
107
107
|
};
|
|
108
108
|
const StatusIcon = ({ state }) => {
|
|
@@ -201,7 +201,7 @@ const UnsavedChangesBar = ({ hasChanges, onSave, onReset, suppressed = false })
|
|
|
201
201
|
initial: { opacity: 0 },
|
|
202
202
|
animate: { opacity: 1 },
|
|
203
203
|
exit: { opacity: 0 },
|
|
204
|
-
transition: spring$
|
|
204
|
+
transition: spring$3,
|
|
205
205
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProgressiveBlur, {})
|
|
206
206
|
}, "blur") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
207
207
|
className: "fixed bottom-10 left-1/2 -translate-x-1/2 z-50",
|
|
@@ -221,7 +221,7 @@ const UnsavedChangesBar = ({ hasChanges, onSave, onReset, suppressed = false })
|
|
|
221
221
|
scale: .95,
|
|
222
222
|
y: 20
|
|
223
223
|
},
|
|
224
|
-
transition: spring$
|
|
224
|
+
transition: spring$3,
|
|
225
225
|
style: { willChange: "opacity, transform" },
|
|
226
226
|
className: "flex items-center gap-1.5 rounded-xl bg-zinc-900 dark:bg-[oklch(0.940_0.008_231)] shadow-[0_0_0_1px_rgba(0,0,0,0.08),0_8px_24px_-4px_rgba(0,0,0,0.25),0_20px_50px_-8px_rgba(0,0,0,0.20)] dark:shadow-[0_0_0_1px_rgba(0,0,0,0.08),0_8px_20px_-4px_rgba(0,0,0,0.10),0_20px_50px_-8px_rgba(0,0,0,0.08)] pl-3 pr-1.5 py-1.5",
|
|
227
227
|
children: [
|
|
@@ -550,7 +550,7 @@ const AvatarGroupCount = ({ className, ...props }) => {
|
|
|
550
550
|
|
|
551
551
|
//#endregion
|
|
552
552
|
//#region src/components/ui/alert/alert.tsx
|
|
553
|
-
const spring$
|
|
553
|
+
const spring$2 = {
|
|
554
554
|
bounce: 0,
|
|
555
555
|
duration: .35,
|
|
556
556
|
type: "spring"
|
|
@@ -622,7 +622,7 @@ const Alert = ({ variant = "neutral", title, children, dismissible = false, onDi
|
|
|
622
622
|
type: "button",
|
|
623
623
|
"aria-label": "Dismiss",
|
|
624
624
|
whileTap: shouldReduceMotion ? void 0 : { scale: .96 },
|
|
625
|
-
transition: spring$
|
|
625
|
+
transition: spring$2,
|
|
626
626
|
onClick: () => {
|
|
627
627
|
setDismissed(true);
|
|
628
628
|
onDismiss?.();
|
|
@@ -2198,12 +2198,34 @@ const Stepper = ({ steps, currentStep, className, ...props }) => /* @__PURE__ */
|
|
|
2198
2198
|
//#endregion
|
|
2199
2199
|
//#region src/components/ui/table/table.tsx
|
|
2200
2200
|
const Table = ({ className, ...props }) => {
|
|
2201
|
-
|
|
2201
|
+
const containerRef = (0, react.useRef)(null);
|
|
2202
|
+
const [isScrollable, setIsScrollable] = (0, react.useState)(void 0);
|
|
2203
|
+
(0, react.useEffect)(() => {
|
|
2204
|
+
const container = containerRef.current;
|
|
2205
|
+
if (!container) return;
|
|
2206
|
+
const updateScrollability = () => setIsScrollable(container.scrollWidth > container.clientWidth);
|
|
2207
|
+
updateScrollability();
|
|
2208
|
+
window.addEventListener("resize", updateScrollability);
|
|
2209
|
+
const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(updateScrollability);
|
|
2210
|
+
if (observer) {
|
|
2211
|
+
observer.observe(container);
|
|
2212
|
+
observer.observe(container.firstElementChild);
|
|
2213
|
+
}
|
|
2214
|
+
return () => {
|
|
2215
|
+
window.removeEventListener("resize", updateScrollability);
|
|
2216
|
+
observer?.disconnect();
|
|
2217
|
+
};
|
|
2218
|
+
}, []);
|
|
2219
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
2220
|
+
ref: containerRef,
|
|
2202
2221
|
"data-slot": "table-container",
|
|
2203
|
-
|
|
2222
|
+
"data-tray": "header",
|
|
2223
|
+
tabIndex: isScrollable ? 0 : void 0,
|
|
2224
|
+
"aria-label": isScrollable ? "Scrollable table" : void 0,
|
|
2225
|
+
className: require_toggle_row.cn("relative w-full rounded-[16px] bg-[var(--tray-chrome)] px-[var(--tray-inset)] pb-[var(--tray-inset)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)]", isScrollable === false ? "overflow-visible" : "overflow-x-auto"),
|
|
2204
2226
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("table", {
|
|
2205
2227
|
"data-slot": "table",
|
|
2206
|
-
className: require_toggle_row.cn("w-full caption-bottom text-sm", className),
|
|
2228
|
+
className: require_toggle_row.cn("w-full caption-bottom border-separate border-spacing-0 text-sm", className),
|
|
2207
2229
|
...props
|
|
2208
2230
|
})
|
|
2209
2231
|
});
|
|
@@ -2211,28 +2233,28 @@ const Table = ({ className, ...props }) => {
|
|
|
2211
2233
|
const TableHeader = ({ className, ...props }) => {
|
|
2212
2234
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", {
|
|
2213
2235
|
"data-slot": "table-header",
|
|
2214
|
-
className: require_toggle_row.cn("
|
|
2236
|
+
className: require_toggle_row.cn("sticky top-0 z-20 bg-[var(--tray-chrome)] [&_tr]:border-0 [&_tr]:hover:bg-transparent", className),
|
|
2215
2237
|
...props
|
|
2216
2238
|
});
|
|
2217
2239
|
};
|
|
2218
2240
|
const TableBody = ({ className, ...props }) => {
|
|
2219
2241
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", {
|
|
2220
2242
|
"data-slot": "table-body",
|
|
2221
|
-
className: require_toggle_row.cn("[
|
|
2243
|
+
className: require_toggle_row.cn("relative after:pointer-events-none after:absolute after:inset-0 after:z-10 after:rounded-[var(--tray-shelf-radius)] after:border after:border-[var(--border-divider)] after:content-['']", "[&:has(+tfoot)]:after:rounded-b-none [&:has(+tfoot)]:after:border-b-0", "[&>tr>*]:bg-card [&>tr:first-child>*:first-child]:rounded-tl-[var(--tray-shelf-radius)] [&>tr:first-child>*:last-child]:rounded-tr-[var(--tray-shelf-radius)]", "[&>tr:last-child>*:first-child]:rounded-bl-[var(--tray-shelf-radius)] [&>tr:last-child>*:last-child]:rounded-br-[var(--tray-shelf-radius)]", "[&:has(+tfoot)>tr:last-child>*:first-child]:rounded-bl-none [&:has(+tfoot)>tr:last-child>*:last-child]:rounded-br-none", "[&>tr:not(:last-child)>*]:border-b [&>tr:not(:last-child)>*]:border-[var(--border-divider)]", className),
|
|
2222
2244
|
...props
|
|
2223
2245
|
});
|
|
2224
2246
|
};
|
|
2225
2247
|
const TableFooter = ({ className, ...props }) => {
|
|
2226
2248
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tfoot", {
|
|
2227
2249
|
"data-slot": "table-footer",
|
|
2228
|
-
className: require_toggle_row.cn("bg-
|
|
2250
|
+
className: require_toggle_row.cn("relative font-medium after:pointer-events-none after:absolute after:inset-0 after:z-10 after:rounded-b-[var(--tray-shelf-radius)] after:border-x after:border-b after:border-[var(--border-divider)] after:content-['']", "[&>tr>*]:bg-card [&>tr>*]:border-t [&>tr>*]:border-[var(--border-divider)]", "[&>tr:last-child>*:first-child]:rounded-bl-[var(--tray-shelf-radius)] [&>tr:last-child>*:last-child]:rounded-br-[var(--tray-shelf-radius)]", className),
|
|
2229
2251
|
...props
|
|
2230
2252
|
});
|
|
2231
2253
|
};
|
|
2232
2254
|
const TableRow = ({ className, ...props }) => {
|
|
2233
2255
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
|
|
2234
2256
|
"data-slot": "table-row",
|
|
2235
|
-
className: require_toggle_row.cn("hover:bg-[var(--overlay-hover)] data-[state=selected]:bg-[var(--overlay-selected)] border-b border-[var(--border-divider)] transition-[background-color] duration-100", className),
|
|
2257
|
+
className: require_toggle_row.cn("hover:[&>*]:bg-[var(--overlay-hover)] data-[state=selected]:[&>*]:bg-[var(--overlay-selected)] data-[state=selected]:hover:[&>*]:bg-[var(--overlay-selected-hover)] border-b border-[var(--border-divider)] [&>*]:transition-[background-color] [&>*]:duration-100", className),
|
|
2236
2258
|
...props
|
|
2237
2259
|
});
|
|
2238
2260
|
};
|
|
@@ -2240,14 +2262,14 @@ const TableHead = ({ className, scope, ...props }) => {
|
|
|
2240
2262
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
2241
2263
|
"data-slot": "table-head",
|
|
2242
2264
|
scope: scope ?? "col",
|
|
2243
|
-
className: require_toggle_row.cn("text-
|
|
2265
|
+
className: require_toggle_row.cn("text-foreground/75 h-[38px] px-4 text-left align-middle text-xs font-medium whitespace-nowrap tabular-nums [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
2244
2266
|
...props
|
|
2245
2267
|
});
|
|
2246
2268
|
};
|
|
2247
2269
|
const TableCell = ({ className, ...props }) => {
|
|
2248
2270
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
2249
2271
|
"data-slot": "table-cell",
|
|
2250
|
-
className: require_toggle_row.cn("px-
|
|
2272
|
+
className: require_toggle_row.cn("px-4 py-2.5 align-middle whitespace-nowrap tabular-nums [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
2251
2273
|
...props
|
|
2252
2274
|
});
|
|
2253
2275
|
};
|
|
@@ -2506,77 +2528,151 @@ const AssetIcon = ({ symbol, size = 32, className }) => {
|
|
|
2506
2528
|
|
|
2507
2529
|
//#endregion
|
|
2508
2530
|
//#region src/components/copy-button/copy-button.tsx
|
|
2509
|
-
const
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2531
|
+
const TIMING = {
|
|
2532
|
+
feedbackHold: 1500,
|
|
2533
|
+
iconSwap: 220,
|
|
2534
|
+
reset: 120
|
|
2535
|
+
};
|
|
2536
|
+
const COPY_STAGE = {
|
|
2537
|
+
copied: 1,
|
|
2538
|
+
error: 2,
|
|
2539
|
+
idle: 0
|
|
2540
|
+
};
|
|
2541
|
+
const ICON = {
|
|
2542
|
+
activeScale: 1,
|
|
2543
|
+
inactiveScale: .72,
|
|
2544
|
+
spring: {
|
|
2545
|
+
bounce: 0,
|
|
2546
|
+
type: "spring",
|
|
2547
|
+
visualDuration: TIMING.iconSwap / 1e3
|
|
2548
|
+
}
|
|
2513
2549
|
};
|
|
2550
|
+
const LABEL = {
|
|
2551
|
+
activeOffset: 0,
|
|
2552
|
+
inactiveOffset: 2,
|
|
2553
|
+
spring: {
|
|
2554
|
+
bounce: 0,
|
|
2555
|
+
type: "spring",
|
|
2556
|
+
visualDuration: TIMING.iconSwap / 1e3
|
|
2557
|
+
}
|
|
2558
|
+
};
|
|
2559
|
+
const RESET_TRANSITION = {
|
|
2560
|
+
duration: TIMING.reset / 1e3,
|
|
2561
|
+
ease: "easeOut"
|
|
2562
|
+
};
|
|
2563
|
+
const REDUCED_MOTION_TRANSITION = { duration: 0 };
|
|
2564
|
+
/** Copies a value and presents stable, accessible success or failure feedback. */
|
|
2514
2565
|
const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", className }) => {
|
|
2515
|
-
const [
|
|
2566
|
+
const [stage, setStage] = (0, react.useState)(COPY_STAGE.idle);
|
|
2516
2567
|
const timeoutRef = (0, react.useRef)(null);
|
|
2568
|
+
const requestIdRef = (0, react.useRef)(0);
|
|
2517
2569
|
const shouldReduceMotion = (0, motion_react.useReducedMotion)();
|
|
2570
|
+
const animationStyle = { willChange: shouldReduceMotion ? "auto" : "transform, opacity" };
|
|
2518
2571
|
(0, react.useEffect)(() => {
|
|
2519
2572
|
return () => {
|
|
2520
2573
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2521
2574
|
};
|
|
2522
2575
|
}, []);
|
|
2523
|
-
const
|
|
2524
|
-
|
|
2525
|
-
setCopied(true);
|
|
2576
|
+
const showFeedback = (nextStage) => {
|
|
2577
|
+
setStage(nextStage);
|
|
2526
2578
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2527
|
-
timeoutRef.current = setTimeout(() =>
|
|
2579
|
+
timeoutRef.current = setTimeout(() => setStage(COPY_STAGE.idle), TIMING.feedbackHold);
|
|
2528
2580
|
};
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2581
|
+
const handleCopy = async () => {
|
|
2582
|
+
const requestId = ++requestIdRef.current;
|
|
2583
|
+
try {
|
|
2584
|
+
await navigator.clipboard.writeText(value);
|
|
2585
|
+
if (requestId === requestIdRef.current) showFeedback(COPY_STAGE.copied);
|
|
2586
|
+
} catch {
|
|
2587
|
+
if (requestId === requestIdRef.current) showFeedback(COPY_STAGE.error);
|
|
2588
|
+
}
|
|
2589
|
+
};
|
|
2590
|
+
let ariaLabel = label || "Copy to clipboard";
|
|
2591
|
+
let announcement = "";
|
|
2592
|
+
if (stage === COPY_STAGE.copied) {
|
|
2593
|
+
ariaLabel = "Copied";
|
|
2594
|
+
announcement = "Copied to clipboard";
|
|
2595
|
+
} else if (stage === COPY_STAGE.error) {
|
|
2596
|
+
ariaLabel = "Copy failed";
|
|
2597
|
+
announcement = "Copy failed";
|
|
2598
|
+
}
|
|
2599
|
+
let iconTransition = ICON.spring;
|
|
2600
|
+
let labelTransition = LABEL.spring;
|
|
2601
|
+
if (stage === COPY_STAGE.idle) {
|
|
2602
|
+
iconTransition = RESET_TRANSITION;
|
|
2603
|
+
labelTransition = RESET_TRANSITION;
|
|
2604
|
+
}
|
|
2605
|
+
if (shouldReduceMotion) {
|
|
2606
|
+
iconTransition = REDUCED_MOTION_TRANSITION;
|
|
2607
|
+
labelTransition = REDUCED_MOTION_TRANSITION;
|
|
2608
|
+
}
|
|
2609
|
+
const visualStates = [
|
|
2610
|
+
{
|
|
2611
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
2612
|
+
icon: _hugeicons_core_free_icons.Copy01Icon,
|
|
2613
|
+
size: 14
|
|
2614
|
+
}),
|
|
2615
|
+
label,
|
|
2616
|
+
stage: COPY_STAGE.idle
|
|
2617
|
+
},
|
|
2618
|
+
{
|
|
2619
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckIcon, {
|
|
2620
|
+
size: 14,
|
|
2621
|
+
strokeWidth: 2
|
|
2622
|
+
}),
|
|
2623
|
+
label: label ? "Copied" : void 0,
|
|
2624
|
+
stage: COPY_STAGE.copied
|
|
2625
|
+
},
|
|
2626
|
+
{
|
|
2627
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
2628
|
+
icon: _hugeicons_core_free_icons.AlertCircleIcon,
|
|
2629
|
+
size: 14
|
|
2630
|
+
}),
|
|
2631
|
+
label: label ? "Failed" : void 0,
|
|
2632
|
+
stage: COPY_STAGE.error
|
|
2633
|
+
}
|
|
2634
|
+
];
|
|
2635
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_toggle_row.Button, {
|
|
2532
2636
|
variant,
|
|
2533
2637
|
size,
|
|
2534
2638
|
onClick: handleCopy,
|
|
2535
2639
|
"aria-label": ariaLabel,
|
|
2536
|
-
className: require_toggle_row.cn("
|
|
2537
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
children:
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
transition: spring$2,
|
|
2573
|
-
className: "flex items-center gap-1.5",
|
|
2574
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
2575
|
-
icon: _hugeicons_core_free_icons.Copy01Icon,
|
|
2576
|
-
size: 14
|
|
2577
|
-
}), label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: label })]
|
|
2578
|
-
}, "copy")
|
|
2579
|
-
})
|
|
2640
|
+
className: require_toggle_row.cn(stage === COPY_STAGE.copied && "text-[var(--text-success)]", stage === COPY_STAGE.error && "text-[var(--text-danger)]", className),
|
|
2641
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2642
|
+
"aria-hidden": "true",
|
|
2643
|
+
className: "grid items-center",
|
|
2644
|
+
children: visualStates.map((visualState) => {
|
|
2645
|
+
const isActive = stage === visualState.stage;
|
|
2646
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2647
|
+
className: "col-start-1 row-start-1 flex items-center gap-1.5",
|
|
2648
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.motion.span, {
|
|
2649
|
+
initial: false,
|
|
2650
|
+
animate: {
|
|
2651
|
+
opacity: isActive ? 1 : 0,
|
|
2652
|
+
scale: isActive ? ICON.activeScale : ICON.inactiveScale
|
|
2653
|
+
},
|
|
2654
|
+
transition: iconTransition,
|
|
2655
|
+
style: animationStyle,
|
|
2656
|
+
className: "flex items-center",
|
|
2657
|
+
children: visualState.icon
|
|
2658
|
+
}), visualState.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.motion.span, {
|
|
2659
|
+
initial: false,
|
|
2660
|
+
style: animationStyle,
|
|
2661
|
+
animate: {
|
|
2662
|
+
opacity: isActive ? 1 : 0,
|
|
2663
|
+
y: isActive ? LABEL.activeOffset : LABEL.inactiveOffset
|
|
2664
|
+
},
|
|
2665
|
+
transition: labelTransition,
|
|
2666
|
+
children: visualState.label
|
|
2667
|
+
})]
|
|
2668
|
+
}, visualState.stage);
|
|
2669
|
+
})
|
|
2670
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2671
|
+
"aria-live": "polite",
|
|
2672
|
+
className: "sr-only",
|
|
2673
|
+
role: "status",
|
|
2674
|
+
children: announcement
|
|
2675
|
+
})]
|
|
2580
2676
|
});
|
|
2581
2677
|
};
|
|
2582
2678
|
|