@dynamic-labs-sdk/droplet 1.50.0 → 1.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/components/copy-button/copy-button.d.ts +3 -1
  2. package/dist/components/copy-button/copy-button.d.ts.map +1 -1
  3. package/dist/components/copy-button/copy-button.stories.d.ts +1 -1
  4. package/dist/components/migration/field/field.d.ts.map +1 -1
  5. package/dist/components/toggle-card/toggle-card.d.ts +10 -0
  6. package/dist/components/toggle-card/toggle-card.d.ts.map +1 -1
  7. package/dist/components/toggle-card/toggle-card.stories.d.ts +5 -0
  8. package/dist/components/toggle-card/toggle-card.stories.d.ts.map +1 -1
  9. package/dist/components/toggle-row/toggle-row.d.ts +22 -1
  10. package/dist/components/toggle-row/toggle-row.d.ts.map +1 -1
  11. package/dist/components/toggle-row/toggle-row.stories.d.ts +10 -6
  12. package/dist/components/toggle-row/toggle-row.stories.d.ts.map +1 -1
  13. package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
  14. package/dist/components/ui/combobox/combobox.d.ts +54 -12
  15. package/dist/components/ui/combobox/combobox.d.ts.map +1 -1
  16. package/dist/components/ui/combobox/combobox.stories.d.ts +12 -1
  17. package/dist/components/ui/combobox/combobox.stories.d.ts.map +1 -1
  18. package/dist/components/ui/field/field-control-context.d.ts +20 -0
  19. package/dist/components/ui/field/field-control-context.d.ts.map +1 -0
  20. package/dist/components/ui/field/field.d.ts +20 -4
  21. package/dist/components/ui/field/field.d.ts.map +1 -1
  22. package/dist/components/ui/field/field.stories.d.ts +18 -6
  23. package/dist/components/ui/field/field.stories.d.ts.map +1 -1
  24. package/dist/components/ui/label/label.d.ts +15 -0
  25. package/dist/components/ui/label/label.d.ts.map +1 -1
  26. package/dist/components/ui/select/select.d.ts.map +1 -1
  27. package/dist/components/ui/select/select.stories.d.ts.map +1 -1
  28. package/dist/index.cjs +279 -139
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.esm.js +279 -139
  31. package/dist/index.esm.js.map +1 -1
  32. package/dist/migration.cjs +1 -1
  33. package/dist/migration.cjs.map +1 -1
  34. package/dist/migration.esm.js +1 -1
  35. package/dist/migration.esm.js.map +1 -1
  36. package/dist/{toggle-row-PqelNVXI.esm.js → toggle-row-CeiCy3Aa.esm.js} +33 -8
  37. package/dist/toggle-row-CeiCy3Aa.esm.js.map +1 -0
  38. package/dist/{toggle-row-BBTk7_bT.cjs → toggle-row-DcV81G3w.cjs} +33 -8
  39. package/dist/toggle-row-DcV81G3w.cjs.map +1 -0
  40. package/package.json +1 -1
  41. package/src/styles/globals.css +11 -15
  42. package/dist/toggle-row-BBTk7_bT.cjs.map +0 -1
  43. package/dist/toggle-row-PqelNVXI.esm.js.map +0 -1
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as Button, c as cn, i as Input, n as Switch, o as buttonVariants, r as Label, s as Spinner, t as ToggleRow } from "./toggle-row-PqelNVXI.esm.js";
1
+ import { a as Button, c as cn, i as Input, n as Switch, o as buttonVariants, r as Label, s as Spinner, t as ToggleRow } from "./toggle-row-CeiCy3Aa.esm.js";
2
2
  import { Children, Fragment, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import { AnimatePresence, motion, useAnimation, useReducedMotion } from "motion/react";
4
4
  import { HugeiconsIcon } from "@hugeicons/react";
@@ -18,9 +18,9 @@ import { Close, Content as Content$2, Description as Description$1, Overlay as O
18
18
  import * as PopoverPrimitive from "@radix-ui/react-popover";
19
19
  import { CheckboxItem, Content as Content$3, Group, Item as Item$1, ItemIndicator, Label as Label$1, Portal as Portal$2, RadioGroup as RadioGroup$1, RadioItem, Root as Root$3, Separator as Separator$1, Sub, SubContent, SubTrigger, Trigger as Trigger$3 } from "@radix-ui/react-dropdown-menu";
20
20
  import { CheckIcon as CheckIcon$1, ChevronRightIcon as ChevronRightIcon$1, CircleIcon } from "lucide-react";
21
+ import { Content as Content$4, Group as Group$1, Icon as Icon$1, Item as Item$2, ItemIndicator as ItemIndicator$1, ItemText, Label as Label$2, Portal as Portal$3, Root as Root$4, ScrollDownButton, ScrollUpButton, Separator as Separator$2, Trigger as Trigger$4, Value, Viewport } from "@radix-ui/react-select";
21
22
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
22
23
  import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
23
- import { Content as Content$4, Group as Group$1, Icon as Icon$1, Item as Item$2, ItemIndicator as ItemIndicator$1, ItemText, Label as Label$2, Portal as Portal$3, Root as Root$4, ScrollDownButton, ScrollUpButton, Separator as Separator$2, Trigger as Trigger$4, Value, Viewport } from "@radix-ui/react-select";
24
24
  import { Root as Root$5 } from "@radix-ui/react-separator";
25
25
  import { useTheme } from "next-themes";
26
26
  import { Toaster as Toaster$1, toast } from "sonner";
@@ -833,7 +833,8 @@ const Checkbox = ({ className, ...props }) => {
833
833
  className: "relative grid place-content-center text-current size-full",
834
834
  forceMount: true,
835
835
  children: [/* @__PURE__ */ jsx("svg", {
836
- className: "size-3.5 absolute inset-0 m-auto transition-[opacity,transform,filter] duration-200 motion-reduce:transition-none opacity-0 scale-[0.25] blur-[4px] group-data-[state=indeterminate]:opacity-100 group-data-[state=indeterminate]:scale-100 group-data-[state=indeterminate]:blur-none",
836
+ "aria-hidden": "true",
837
+ className: "size-3.5 text-current absolute inset-0 m-auto transition-[opacity,transform,filter] duration-200 motion-reduce:transition-none opacity-0 scale-[0.25] blur-[4px] group-data-[state=indeterminate]:opacity-100 group-data-[state=indeterminate]:scale-100 group-data-[state=indeterminate]:blur-none",
837
838
  viewBox: "0 0 24 24",
838
839
  fill: "none",
839
840
  stroke: "currentColor",
@@ -845,7 +846,8 @@ const Checkbox = ({ className, ...props }) => {
845
846
  strokeWidth: 3
846
847
  })
847
848
  }), /* @__PURE__ */ jsx("svg", {
848
- className: "size-3.5 absolute inset-0 m-auto transition-[opacity,transform,filter] duration-200 motion-reduce:transition-none opacity-0 scale-[0.25] blur-[4px] group-data-[state=checked]:opacity-100 group-data-[state=checked]:scale-100 group-data-[state=checked]:blur-none",
849
+ "aria-hidden": "true",
850
+ className: "size-3.5 text-current absolute inset-0 m-auto transition-[opacity,transform,filter] duration-200 motion-reduce:transition-none opacity-0 scale-[0.25] blur-[4px] group-data-[state=checked]:opacity-100 group-data-[state=checked]:scale-100 group-data-[state=checked]:blur-none",
849
851
  viewBox: "0 0 24 24",
850
852
  fill: "none",
851
853
  stroke: "currentColor",
@@ -1077,13 +1079,37 @@ const PopoverAnchor = ({ ...props }) => /* @__PURE__ */ jsx(PopoverPrimitive.Anc
1077
1079
 
1078
1080
  //#endregion
1079
1081
  //#region src/components/ui/combobox/combobox.tsx
1082
+ /** cmdk value of the select-all row; never matches a real option. */
1083
+ const SELECT_ALL_VALUE = "__droplet-combobox-select-all__";
1084
+ /**
1085
+ * Decorative `Checkbox` inside a multi-select option. The option row is the
1086
+ * control: it owns focus, the click target and the checked state for
1087
+ * assistive tech, so the checkbox is hidden from them and ignores pointer
1088
+ * events to avoid a second tab stop or a second announcement.
1089
+ */
1090
+ const OptionCheckbox = ({ checked }) => /* @__PURE__ */ jsx(Checkbox, {
1091
+ checked,
1092
+ "aria-hidden": true,
1093
+ tabIndex: -1,
1094
+ className: "pointer-events-none after:hidden in-data-[selected=true]:data-[state=unchecked]:shadow-[var(--shadow-control-hover)]"
1095
+ });
1096
+ /** Checkbox state of the select-all row: indeterminate while only some are selected. */
1097
+ const getSelectAllState = ({ selectedCount, totalCount }) => {
1098
+ if (selectedCount === 0) return false;
1099
+ if (selectedCount === totalCount) return true;
1100
+ return "indeterminate";
1101
+ };
1080
1102
  /**
1081
- * Searchable single-select Combobox.
1103
+ * Searchable Combobox, single-select by default or multi-select with `multiple`.
1082
1104
  *
1083
- * Composes `Popover`, `Button`, and `Command` from the droplet design system.
1084
- * The trigger is a full-width `outline` Button with a rotating chevron that
1085
- * signals open/closed state. Selecting an item closes the popover, fires
1086
- * `onValueChange`, and shows a check mark next to the active selection.
1105
+ * Composes `Popover`, `Command` and `Checkbox` from the droplet design system.
1106
+ * The trigger is styled like `SelectTrigger` with a rotating chevron that
1107
+ * signals open/closed state.
1108
+ *
1109
+ * - Single-select: picking an item closes the popover, fires `onValueChange`
1110
+ * and shows a check mark next to the active selection.
1111
+ * - Multi-select: each option shows a `Checkbox`, picking an item toggles it
1112
+ * and keeps the popover open, and the trigger lists the selected labels.
1087
1113
  *
1088
1114
  * @example
1089
1115
  * ```tsx
@@ -1094,18 +1120,49 @@ const PopoverAnchor = ({ ...props }) => /* @__PURE__ */ jsx(PopoverPrimitive.Anc
1094
1120
  * onValueChange={setChain}
1095
1121
  * placeholder="Select a chain"
1096
1122
  * />
1123
+ *
1124
+ * const [chains, setChains] = useState<string[]>([]);
1125
+ * <Combobox
1126
+ * multiple
1127
+ * options={[{ value: 'eth', label: 'Ethereum' }, { value: 'sol', label: 'Solana' }]}
1128
+ * value={chains}
1129
+ * onValueChange={setChains}
1130
+ * selectAllLabel="All chains"
1131
+ * />
1097
1132
  * ```
1098
1133
  */
1099
- const Combobox = ({ options, value, onValueChange, placeholder = "Select…", searchPlaceholder = "Search…", emptyText = "No results.", className, disabled = false }) => {
1134
+ const Combobox = (props) => {
1135
+ const { options, placeholder = "Select…", searchPlaceholder = "Search…", emptyText = "No results.", className, disabled = false } = props;
1100
1136
  const [open, setOpen] = useState(false);
1101
- const selectedLabel = options.find((opt) => opt.value === value)?.label;
1137
+ const [search, setSearch] = useState("");
1138
+ const selectedValues = props.multiple ? props.value : [props.value];
1139
+ const selectedOptions = options.filter((opt) => selectedValues.includes(opt.value));
1140
+ const selectedLabels = selectedOptions.map((opt) => opt.label);
1141
+ const selectedLabel = props.multiple && props.formatSelected && selectedLabels.length > 0 ? props.formatSelected(selectedLabels) : selectedLabels.join(", ") || void 0;
1142
+ const selectAllState = getSelectAllState({
1143
+ selectedCount: selectedOptions.length,
1144
+ totalCount: options.length
1145
+ });
1146
+ const showSelectAll = props.multiple && props.selectAllLabel !== void 0 && search === "";
1102
1147
  const handleSelect = (selectedValue) => {
1103
- onValueChange(selectedValue);
1104
- setOpen(false);
1148
+ if (!props.multiple) {
1149
+ props.onValueChange(selectedValue);
1150
+ handleOpenChange(false);
1151
+ return;
1152
+ }
1153
+ props.onValueChange(props.value.includes(selectedValue) ? props.value.filter((v) => v !== selectedValue) : [...props.value, selectedValue]);
1154
+ };
1155
+ const handleSelectAll = () => {
1156
+ if (!props.multiple) return;
1157
+ props.onValueChange(selectAllState === true ? [] : options.map((opt) => opt.value));
1158
+ };
1159
+ const handleOpenChange = (nextOpen) => {
1160
+ setOpen(nextOpen);
1161
+ if (!nextOpen) setSearch("");
1105
1162
  };
1106
1163
  return /* @__PURE__ */ jsxs(Popover, {
1107
1164
  open,
1108
- onOpenChange: setOpen,
1165
+ onOpenChange: handleOpenChange,
1109
1166
  children: [/* @__PURE__ */ jsx(PopoverTrigger, {
1110
1167
  asChild: true,
1111
1168
  children: /* @__PURE__ */ jsxs("button", {
@@ -1130,12 +1187,32 @@ const Combobox = ({ options, value, onValueChange, placeholder = "Select…", se
1130
1187
  sideOffset: 4,
1131
1188
  children: /* @__PURE__ */ jsxs(Command, {
1132
1189
  className: "rounded-[inherit]",
1133
- children: [/* @__PURE__ */ jsx(CommandInput, { placeholder: searchPlaceholder }), /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: emptyText }), options.map((opt) => /* @__PURE__ */ jsxs(CommandItem, {
1134
- value: opt.value,
1135
- keywords: [opt.label],
1136
- onSelect: handleSelect,
1137
- children: [/* @__PURE__ */ jsx(CheckIcon, { className: cn("shrink-0", value === opt.value ? "opacity-100" : "opacity-0") }), opt.label]
1138
- }, opt.value))] })]
1190
+ children: [/* @__PURE__ */ jsx(CommandInput, {
1191
+ placeholder: searchPlaceholder,
1192
+ value: search,
1193
+ onValueChange: setSearch
1194
+ }), /* @__PURE__ */ jsxs(CommandList, {
1195
+ "aria-multiselectable": props.multiple || void 0,
1196
+ children: [
1197
+ /* @__PURE__ */ jsx(CommandEmpty, { children: emptyText }),
1198
+ showSelectAll && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(CommandItem, {
1199
+ value: SELECT_ALL_VALUE,
1200
+ "aria-checked": selectAllState === "indeterminate" ? "mixed" : selectAllState,
1201
+ onSelect: handleSelectAll,
1202
+ children: [/* @__PURE__ */ jsx(OptionCheckbox, { checked: selectAllState }), props.selectAllLabel]
1203
+ }), /* @__PURE__ */ jsx(CommandSeparator, { className: "my-1" })] }),
1204
+ options.map((opt) => {
1205
+ const isSelected = selectedValues.includes(opt.value);
1206
+ return /* @__PURE__ */ jsxs(CommandItem, {
1207
+ value: opt.value,
1208
+ keywords: [opt.label],
1209
+ "aria-checked": props.multiple ? isSelected : void 0,
1210
+ onSelect: handleSelect,
1211
+ children: [props.multiple ? /* @__PURE__ */ jsx(OptionCheckbox, { checked: isSelected }) : /* @__PURE__ */ jsx(CheckIcon, { className: cn("shrink-0", isSelected ? "opacity-100" : "opacity-0") }), opt.label]
1212
+ }, opt.value);
1213
+ })
1214
+ ]
1215
+ })]
1139
1216
  })
1140
1217
  })]
1141
1218
  });
@@ -1389,9 +1466,114 @@ const Icon = (props) => {
1389
1466
  });
1390
1467
  };
1391
1468
 
1469
+ //#endregion
1470
+ //#region src/components/ui/field/field-control-context.ts
1471
+ /**
1472
+ * Carries a `Field`'s control attributes to a control that renders its focusable
1473
+ * element deeper than `Field`'s direct child.
1474
+ *
1475
+ * `Field` injects `id` and the `aria-*` attributes onto its direct child. That
1476
+ * works for `Input` and `Textarea`, but `Select` renders no element of its own,
1477
+ * so `SelectTrigger` reads them from here instead.
1478
+ */
1479
+ const FieldControlContext = createContext(null);
1480
+
1481
+ //#endregion
1482
+ //#region src/components/ui/select/select.tsx
1483
+ const Select = ({ ...props }) => /* @__PURE__ */ jsx(Root$4, {
1484
+ "data-slot": "select",
1485
+ ...props
1486
+ });
1487
+ const SelectGroup = ({ ...props }) => /* @__PURE__ */ jsx(Group$1, {
1488
+ "data-slot": "select-group",
1489
+ ...props
1490
+ });
1491
+ const SelectValue = ({ ...props }) => /* @__PURE__ */ jsx(Value, {
1492
+ "data-slot": "select-value",
1493
+ ...props
1494
+ });
1495
+ const SelectTrigger = ({ className, size = "default", children, ...props }) => {
1496
+ const fieldControlProps = useContext(FieldControlContext);
1497
+ return /* @__PURE__ */ jsxs(Trigger$4, {
1498
+ ...fieldControlProps,
1499
+ "data-slot": "select-trigger",
1500
+ "data-size": size,
1501
+ className: cn("data-[placeholder]:text-muted-foreground/60 [&_svg:not([class*='text-'])]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 flex w-fit touch-manipulation items-center justify-between gap-1.5 rounded-md border-0 bg-transparent px-3 py-2 text-[13px] whitespace-nowrap shadow-[var(--shadow-input)] hover:shadow-[var(--shadow-input-hover)] transition-[color,box-shadow] duration-100 ease-out outline-none focus-visible:shadow-[0_0_0_1px_var(--ring),0_0_0_4px_var(--ring-halo,#0072EF26)] aria-invalid:shadow-[0_0_0_1px_var(--destructive)] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:text-[13px] data-[size=sm]:px-2.5 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[state=open]:[&>svg:last-of-type]:rotate-180", className),
1502
+ ...props,
1503
+ ...fieldControlProps ? { id: fieldControlProps.id } : {},
1504
+ children: [children, /* @__PURE__ */ jsx(Icon$1, {
1505
+ asChild: true,
1506
+ children: /* @__PURE__ */ jsx(HugeiconsIcon, {
1507
+ icon: ArrowDown01Icon,
1508
+ size: 16,
1509
+ className: "opacity-50 transition-transform duration-150 ease-out motion-reduce:transition-none"
1510
+ })
1511
+ })]
1512
+ });
1513
+ };
1514
+ const SelectContent = ({ className, children, position = "popper", align = "start", ...props }) => /* @__PURE__ */ jsx(Portal$3, { children: /* @__PURE__ */ jsxs(Content$4, {
1515
+ "data-slot": "select-content",
1516
+ className: cn("bg-popover text-popover-foreground will-change-[opacity,transform] 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 motion-reduce:animate-none relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-xl border-0 shadow-[var(--shadow-elevated)]", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
1517
+ position,
1518
+ align,
1519
+ ...props,
1520
+ children: [
1521
+ /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
1522
+ /* @__PURE__ */ jsx(Viewport, {
1523
+ className: cn("p-1", position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
1524
+ children
1525
+ }),
1526
+ /* @__PURE__ */ jsx(SelectScrollDownButton, {})
1527
+ ]
1528
+ }) });
1529
+ const SelectLabel = ({ className, ...props }) => /* @__PURE__ */ jsx(Label$2, {
1530
+ "data-slot": "select-label",
1531
+ className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
1532
+ ...props
1533
+ });
1534
+ const SelectItem = ({ className, children, ...props }) => /* @__PURE__ */ jsxs(Item$2, {
1535
+ "data-slot": "select-item",
1536
+ className: cn("data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[state=checked]:font-medium [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
1537
+ ...props,
1538
+ children: [/* @__PURE__ */ jsx("span", {
1539
+ "data-slot": "select-item-indicator",
1540
+ className: "absolute right-2 flex size-3.5 items-center justify-center",
1541
+ children: /* @__PURE__ */ jsx(ItemIndicator$1, { children: /* @__PURE__ */ jsx(HugeiconsIcon, {
1542
+ icon: Tick01Icon,
1543
+ size: 14
1544
+ }) })
1545
+ }), /* @__PURE__ */ jsx(ItemText, { children })]
1546
+ });
1547
+ const SelectSeparator = ({ className, ...props }) => /* @__PURE__ */ jsx(Separator$2, {
1548
+ "data-slot": "select-separator",
1549
+ className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
1550
+ ...props
1551
+ });
1552
+ const SelectScrollUpButton = ({ className, ...props }) => /* @__PURE__ */ jsx(ScrollUpButton, {
1553
+ "data-slot": "select-scroll-up-button",
1554
+ className: cn("flex cursor-default items-center justify-center py-1", className),
1555
+ ...props,
1556
+ children: /* @__PURE__ */ jsx(HugeiconsIcon, {
1557
+ icon: ArrowUp01Icon,
1558
+ size: 16,
1559
+ "aria-hidden": true
1560
+ })
1561
+ });
1562
+ const SelectScrollDownButton = ({ className, ...props }) => /* @__PURE__ */ jsx(ScrollDownButton, {
1563
+ "data-slot": "select-scroll-down-button",
1564
+ className: cn("flex cursor-default items-center justify-center py-1", className),
1565
+ ...props,
1566
+ children: /* @__PURE__ */ jsx(HugeiconsIcon, {
1567
+ icon: ArrowDown01Icon,
1568
+ size: 16,
1569
+ "aria-hidden": true
1570
+ })
1571
+ });
1572
+
1392
1573
  //#endregion
1393
1574
  //#region src/components/ui/field/field.tsx
1394
- const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--spacing-label-gap)-var(--spacing-field-gap))]";
1575
+ const FIELD_GAP_CLASS_NAME = "grid [--field-gap:6px] [--label-gap:10px] gap-[var(--field-gap)]";
1576
+ const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--label-gap)-var(--field-gap))]";
1395
1577
  /**
1396
1578
  * A generic labeled form-field wrapper.
1397
1579
  *
@@ -1399,16 +1581,26 @@ const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--spacing-label-gap)-var(--spacing-fi
1399
1581
  * an error message together with the correct `id`/`htmlFor`/`aria-describedby`
1400
1582
  * associations so callers don't have to hand-assemble these.
1401
1583
  *
1584
+ * Always wrap a form control in `Field` rather than pairing a bare `<Label>`
1585
+ * with it: `Field` owns the label-to-control gap (10px) and the gap to the
1586
+ * error (6px). Don't add helper text: the error is the only message under a
1587
+ * control.
1588
+ *
1402
1589
  * When there is exactly one child element, `Field` uses `cloneElement` to
1403
1590
  * inject:
1404
1591
  * - `id` — links the label's `htmlFor` to the control
1592
+ * - `aria-labelledby` — names group controls such as `RadioGroup`, which a
1593
+ * `<label for>` cannot name
1405
1594
  * - `aria-describedby` — references the description and/or error paragraph ids
1406
1595
  * - `aria-invalid` — `true` when `error` is present
1407
1596
  *
1597
+ * `Select` renders no element of its own, so `SelectTrigger` picks up `id`,
1598
+ * `aria-describedby` and `aria-invalid` from `Field` instead.
1599
+ *
1408
1600
  * @example
1409
1601
  * ```tsx
1410
- * <Field label="Email" description="We'll never share your email." required>
1411
- * <Input type="email" />
1602
+ * <Field label="Email" required>
1603
+ * <Input type="email" required />
1412
1604
  * </Field>
1413
1605
  *
1414
1606
  * <Field label="Email" error="Enter a valid email address.">
@@ -1417,25 +1609,39 @@ const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--spacing-label-gap)-var(--spacing-fi
1417
1609
  * ```
1418
1610
  */
1419
1611
  const Field = ({ label, description, error, required, htmlFor, children, className }) => {
1612
+ const childArray = Children.toArray(children);
1613
+ const singleChild = childArray.length === 1 && isValidElement(childArray[0]) ? childArray[0] : null;
1614
+ const childId = (singleChild?.props)?.id;
1420
1615
  const generatedId = useId();
1421
- const controlId = htmlFor ?? generatedId;
1616
+ const controlId = (typeof childId === "string" ? childId : void 0) ?? htmlFor ?? generatedId;
1422
1617
  const descriptionId = `${controlId}-description`;
1423
1618
  const errorId = `${controlId}-error`;
1424
- const describedByParts = [];
1425
- if (description) describedByParts.push(descriptionId);
1426
- if (error) describedByParts.push(errorId);
1427
- const ariaDescribedBy = describedByParts.length > 0 ? describedByParts.join(" ") : void 0;
1428
- const childArray = Children.toArray(children);
1429
- const singleChild = childArray.length === 1 && isValidElement(childArray[0]) ? childArray[0] : null;
1619
+ const labelId = label ? `${controlId}-label` : void 0;
1620
+ const showDescription = Boolean(description) && !error;
1621
+ let ariaDescribedBy;
1622
+ if (error) ariaDescribedBy = errorId;
1623
+ else if (showDescription) ariaDescribedBy = descriptionId;
1624
+ const hasError = Boolean(error);
1625
+ const controlProps = useMemo(() => ({
1626
+ "aria-describedby": ariaDescribedBy,
1627
+ id: controlId,
1628
+ ...hasError ? { "aria-invalid": true } : {}
1629
+ }), [
1630
+ ariaDescribedBy,
1631
+ controlId,
1632
+ hasError
1633
+ ]);
1430
1634
  const enrichedChild = singleChild ? cloneElement(singleChild, {
1431
1635
  "aria-describedby": singleChild.props["aria-describedby"] ?? ariaDescribedBy,
1432
- id: singleChild.props.id ?? controlId,
1636
+ "aria-labelledby": singleChild.props["aria-labelledby"] ?? labelId,
1637
+ id: controlId,
1433
1638
  ...error ? { "aria-invalid": true } : {}
1434
1639
  }) : null;
1435
1640
  return /* @__PURE__ */ jsxs("div", {
1436
- className: cn("grid gap-field-gap", className),
1641
+ className: cn(FIELD_GAP_CLASS_NAME, className),
1437
1642
  children: [
1438
1643
  label && /* @__PURE__ */ jsxs(Label, {
1644
+ id: labelId,
1439
1645
  htmlFor: controlId,
1440
1646
  "data-slot": "field-label",
1441
1647
  className: LABEL_GAP_CLASS_NAME,
@@ -1445,8 +1651,11 @@ const Field = ({ label, description, error, required, htmlFor, children, classNa
1445
1651
  children: "*"
1446
1652
  })]
1447
1653
  }),
1448
- enrichedChild ?? children,
1449
- description && /* @__PURE__ */ jsx("p", {
1654
+ /* @__PURE__ */ jsx(FieldControlContext.Provider, {
1655
+ value: singleChild?.type === Select ? controlProps : null,
1656
+ children: enrichedChild ?? children
1657
+ }),
1658
+ showDescription && /* @__PURE__ */ jsx("p", {
1450
1659
  id: descriptionId,
1451
1660
  className: "text-sm text-muted-foreground",
1452
1661
  children: description
@@ -1796,93 +2005,6 @@ const SearchInput = ({ className, placeholder = "Search...", shortcut = "⌘K",
1796
2005
  });
1797
2006
  };
1798
2007
 
1799
- //#endregion
1800
- //#region src/components/ui/select/select.tsx
1801
- const Select = ({ ...props }) => /* @__PURE__ */ jsx(Root$4, {
1802
- "data-slot": "select",
1803
- ...props
1804
- });
1805
- const SelectGroup = ({ ...props }) => /* @__PURE__ */ jsx(Group$1, {
1806
- "data-slot": "select-group",
1807
- ...props
1808
- });
1809
- const SelectValue = ({ ...props }) => /* @__PURE__ */ jsx(Value, {
1810
- "data-slot": "select-value",
1811
- ...props
1812
- });
1813
- const SelectTrigger = ({ className, size = "default", children, ...props }) => /* @__PURE__ */ jsxs(Trigger$4, {
1814
- "data-slot": "select-trigger",
1815
- "data-size": size,
1816
- className: cn("data-[placeholder]:text-muted-foreground/60 [&_svg:not([class*='text-'])]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 flex w-fit touch-manipulation items-center justify-between gap-1.5 rounded-md border-0 bg-transparent px-3 py-2 text-[13px] whitespace-nowrap shadow-[var(--shadow-input)] hover:shadow-[var(--shadow-input-hover)] transition-[color,box-shadow] duration-100 ease-out outline-none focus-visible:shadow-[0_0_0_1px_var(--ring),0_0_0_4px_var(--ring-halo,#0072EF26)] aria-invalid:shadow-[0_0_0_1px_var(--destructive)] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:text-[13px] data-[size=sm]:px-2.5 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[state=open]:[&>svg:last-of-type]:rotate-180", className),
1817
- ...props,
1818
- children: [children, /* @__PURE__ */ jsx(Icon$1, {
1819
- asChild: true,
1820
- children: /* @__PURE__ */ jsx(HugeiconsIcon, {
1821
- icon: ArrowDown01Icon,
1822
- size: 16,
1823
- className: "opacity-50 transition-transform duration-150 ease-out motion-reduce:transition-none"
1824
- })
1825
- })]
1826
- });
1827
- const SelectContent = ({ className, children, position = "popper", align = "start", ...props }) => /* @__PURE__ */ jsx(Portal$3, { children: /* @__PURE__ */ jsxs(Content$4, {
1828
- "data-slot": "select-content",
1829
- className: cn("bg-popover text-popover-foreground will-change-[opacity,transform] 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 motion-reduce:animate-none relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-xl border-0 shadow-[var(--shadow-elevated)]", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
1830
- position,
1831
- align,
1832
- ...props,
1833
- children: [
1834
- /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
1835
- /* @__PURE__ */ jsx(Viewport, {
1836
- className: cn("p-1", position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
1837
- children
1838
- }),
1839
- /* @__PURE__ */ jsx(SelectScrollDownButton, {})
1840
- ]
1841
- }) });
1842
- const SelectLabel = ({ className, ...props }) => /* @__PURE__ */ jsx(Label$2, {
1843
- "data-slot": "select-label",
1844
- className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
1845
- ...props
1846
- });
1847
- const SelectItem = ({ className, children, ...props }) => /* @__PURE__ */ jsxs(Item$2, {
1848
- "data-slot": "select-item",
1849
- className: cn("data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[state=checked]:font-medium [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
1850
- ...props,
1851
- children: [/* @__PURE__ */ jsx("span", {
1852
- "data-slot": "select-item-indicator",
1853
- className: "absolute right-2 flex size-3.5 items-center justify-center",
1854
- children: /* @__PURE__ */ jsx(ItemIndicator$1, { children: /* @__PURE__ */ jsx(HugeiconsIcon, {
1855
- icon: Tick01Icon,
1856
- size: 14
1857
- }) })
1858
- }), /* @__PURE__ */ jsx(ItemText, { children })]
1859
- });
1860
- const SelectSeparator = ({ className, ...props }) => /* @__PURE__ */ jsx(Separator$2, {
1861
- "data-slot": "select-separator",
1862
- className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
1863
- ...props
1864
- });
1865
- const SelectScrollUpButton = ({ className, ...props }) => /* @__PURE__ */ jsx(ScrollUpButton, {
1866
- "data-slot": "select-scroll-up-button",
1867
- className: cn("flex cursor-default items-center justify-center py-1", className),
1868
- ...props,
1869
- children: /* @__PURE__ */ jsx(HugeiconsIcon, {
1870
- icon: ArrowUp01Icon,
1871
- size: 16,
1872
- "aria-hidden": true
1873
- })
1874
- });
1875
- const SelectScrollDownButton = ({ className, ...props }) => /* @__PURE__ */ jsx(ScrollDownButton, {
1876
- "data-slot": "select-scroll-down-button",
1877
- className: cn("flex cursor-default items-center justify-center py-1", className),
1878
- ...props,
1879
- children: /* @__PURE__ */ jsx(HugeiconsIcon, {
1880
- icon: ArrowDown01Icon,
1881
- size: 16,
1882
- "aria-hidden": true
1883
- })
1884
- });
1885
-
1886
2008
  //#endregion
1887
2009
  //#region src/components/ui/selectable-card/selectable-card.tsx
1888
2010
  const SelectableCard = ({ badge, className, description, icon, iconSize = 20, label, selected, ...props }) => /* @__PURE__ */ jsxs("button", {
@@ -4028,9 +4150,10 @@ const AssetIcon = ({ symbol, size = 32, className }) => {
4028
4150
  //#endregion
4029
4151
  //#region src/components/copy-button/copy-button.tsx
4030
4152
  const TIMING = {
4031
- feedbackHold: 1500,
4032
- iconSwap: 220,
4033
- reset: 120
4153
+ errorHold: 2e3,
4154
+ iconSwap: 200,
4155
+ reset: 120,
4156
+ successHold: 1e3
4034
4157
  };
4035
4158
  const COPY_STAGE = {
4036
4159
  copied: 1,
@@ -4038,12 +4161,18 @@ const COPY_STAGE = {
4038
4161
  idle: 0
4039
4162
  };
4040
4163
  const ICON = {
4164
+ activeBlur: "blur(0px)",
4041
4165
  activeScale: 1,
4042
- inactiveScale: .72,
4043
- spring: {
4044
- bounce: 0,
4045
- type: "spring",
4046
- visualDuration: TIMING.iconSwap / 1e3
4166
+ inactiveBlur: "blur(4px)",
4167
+ inactiveScale: .25,
4168
+ transition: {
4169
+ duration: TIMING.iconSwap / 1e3,
4170
+ ease: [
4171
+ .4,
4172
+ 0,
4173
+ .2,
4174
+ 1
4175
+ ]
4047
4176
  }
4048
4177
  };
4049
4178
  const LABEL = {
@@ -4064,6 +4193,7 @@ const HIDDEN_RESET_TRANSITION = {
4064
4193
  duration: 0
4065
4194
  };
4066
4195
  const ICON_RESET_TRANSITION = {
4196
+ filter: HIDDEN_RESET_TRANSITION,
4067
4197
  opacity: RESET_TRANSITION,
4068
4198
  scale: HIDDEN_RESET_TRANSITION
4069
4199
  };
@@ -4073,12 +4203,11 @@ const LABEL_RESET_TRANSITION = {
4073
4203
  };
4074
4204
  const REDUCED_MOTION_TRANSITION = { duration: 0 };
4075
4205
  /** Copies a value and presents stable, accessible success or failure feedback. */
4076
- const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", className }) => {
4206
+ const CopyButton = ({ value, ariaLabel: idleAriaLabel, label, variant = "outline", size = "icon-xs", className }) => {
4077
4207
  const [stage, setStage] = useState(COPY_STAGE.idle);
4078
4208
  const timeoutRef = useRef(null);
4079
4209
  const requestIdRef = useRef(0);
4080
4210
  const shouldReduceMotion = useReducedMotion();
4081
- const animationStyle = { willChange: shouldReduceMotion ? "auto" : "transform, opacity" };
4082
4211
  useEffect(() => {
4083
4212
  return () => {
4084
4213
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
@@ -4087,7 +4216,7 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
4087
4216
  const showFeedback = (nextStage) => {
4088
4217
  setStage(nextStage);
4089
4218
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4090
- timeoutRef.current = setTimeout(() => setStage(COPY_STAGE.idle), TIMING.feedbackHold);
4219
+ timeoutRef.current = setTimeout(() => setStage(COPY_STAGE.idle), nextStage === COPY_STAGE.error ? TIMING.errorHold : TIMING.successHold);
4091
4220
  };
4092
4221
  const handleCopy = async () => {
4093
4222
  const requestId = ++requestIdRef.current;
@@ -4098,7 +4227,7 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
4098
4227
  if (requestId === requestIdRef.current) showFeedback(COPY_STAGE.error);
4099
4228
  }
4100
4229
  };
4101
- let ariaLabel = label || "Copy to clipboard";
4230
+ let ariaLabel = idleAriaLabel || label || "Copy to clipboard";
4102
4231
  let announcement = "";
4103
4232
  if (stage === COPY_STAGE.copied) {
4104
4233
  ariaLabel = "Copied";
@@ -4107,7 +4236,7 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
4107
4236
  ariaLabel = "Copy failed";
4108
4237
  announcement = "Copy failed";
4109
4238
  }
4110
- let iconTransition = ICON.spring;
4239
+ let iconTransition = ICON.transition;
4111
4240
  let labelTransition = LABEL.spring;
4112
4241
  if (stage === COPY_STAGE.idle) {
4113
4242
  iconTransition = ICON_RESET_TRANSITION;
@@ -4128,8 +4257,8 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
4128
4257
  },
4129
4258
  {
4130
4259
  icon: /* @__PURE__ */ jsx(CheckIcon, {
4131
- size: null,
4132
- strokeWidth: 2
4260
+ className: "[&_path]:[stroke-width:var(--icon-stroke-width,1.75)]",
4261
+ size: null
4133
4262
  }),
4134
4263
  label: label ? "Copied" : void 0,
4135
4264
  stage: COPY_STAGE.copied
@@ -4159,17 +4288,18 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
4159
4288
  className: "col-start-1 row-start-1 flex items-center gap-1.5",
4160
4289
  children: [/* @__PURE__ */ jsx(motion.span, {
4161
4290
  initial: false,
4291
+ "data-slot": visualState.stage === COPY_STAGE.copied ? "copy-button-check" : void 0,
4292
+ "data-state": isActive ? "checked" : "unchecked",
4162
4293
  animate: {
4294
+ filter: isIdleVisual || isActive ? ICON.activeBlur : ICON.inactiveBlur,
4163
4295
  opacity: isActive ? 1 : 0,
4164
4296
  scale: isIdleVisual || isActive ? ICON.activeScale : ICON.inactiveScale
4165
4297
  },
4166
4298
  transition: iconTransition,
4167
- style: animationStyle,
4168
4299
  className: "flex items-center",
4169
4300
  children: visualState.icon
4170
4301
  }), visualState.label && /* @__PURE__ */ jsx(motion.span, {
4171
4302
  initial: false,
4172
- style: animationStyle,
4173
4303
  animate: {
4174
4304
  opacity: isActive ? 1 : 0,
4175
4305
  y: isIdleVisual || isActive ? LABEL.activeOffset : LABEL.inactiveOffset
@@ -4394,7 +4524,7 @@ const DomainList = ({ className, domains, onChange, placeholder = "https://examp
4394
4524
  children: domains.map((domain) => /* @__PURE__ */ jsxs("li", {
4395
4525
  className: "flex items-center justify-between gap-2 rounded-md border bg-[var(--bg-bottom)] px-3 py-2 text-sm",
4396
4526
  children: [/* @__PURE__ */ jsx("span", {
4397
- className: "font-mono text-sm truncate",
4527
+ className: "text-sm tabular-nums truncate",
4398
4528
  children: domain
4399
4529
  }), /* @__PURE__ */ jsx("button", {
4400
4530
  type: "button",
@@ -4915,6 +5045,16 @@ const renderInput = (input, id) => {
4915
5045
  })
4916
5046
  });
4917
5047
  };
5048
+ /**
5049
+ * DEPRECATED. Never use in new code. Use `FlushCardStack` with a `ToggleRow`
5050
+ * header instead; put sub-options in the item's reveal.
5051
+ *
5052
+ * Kept so existing callers keep rendering while they migrate.
5053
+ *
5054
+ * @deprecated Use `FlushCardStack` + `ToggleRow`.
5055
+ * @see FlushCardStack
5056
+ * @see ToggleRow
5057
+ */
4918
5058
  const ToggleCard = ({ accordionKey, title, description, inputProps, allowExpand = true, defaultExpanded, value, onValueChange, collapsible = true, Tags, RightSideTags, notification, actionLink, customActionIcon, onCardClick: _onCardClick, children, disabled, triggerTestId, className, triggerClassName }) => {
4919
5059
  const generatedId = useId();
4920
5060
  const inputId = inputProps?.id ?? generatedId;