@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.cjs CHANGED
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  }) : target, mod));
26
26
 
27
27
  //#endregion
28
- const require_toggle_row = require('./toggle-row-BBTk7_bT.cjs');
28
+ const require_toggle_row = require('./toggle-row-DcV81G3w.cjs');
29
29
  let react = require("react");
30
30
  let motion_react = require("motion/react");
31
31
  let _hugeicons_react = require("@hugeicons/react");
@@ -49,11 +49,11 @@ let _radix_ui_react_popover = require("@radix-ui/react-popover");
49
49
  _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
50
50
  let _radix_ui_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
51
51
  let lucide_react = require("lucide-react");
52
+ let _radix_ui_react_select = require("@radix-ui/react-select");
52
53
  let _radix_ui_react_radio_group = require("@radix-ui/react-radio-group");
53
54
  _radix_ui_react_radio_group = __toESM(_radix_ui_react_radio_group);
54
55
  let _radix_ui_react_scroll_area = require("@radix-ui/react-scroll-area");
55
56
  _radix_ui_react_scroll_area = __toESM(_radix_ui_react_scroll_area);
56
- let _radix_ui_react_select = require("@radix-ui/react-select");
57
57
  let _radix_ui_react_separator = require("@radix-ui/react-separator");
58
58
  let next_themes = require("next-themes");
59
59
  let sonner = require("sonner");
@@ -868,7 +868,8 @@ const Checkbox = ({ className, ...props }) => {
868
868
  className: "relative grid place-content-center text-current size-full",
869
869
  forceMount: true,
870
870
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
871
- 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",
871
+ "aria-hidden": "true",
872
+ 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",
872
873
  viewBox: "0 0 24 24",
873
874
  fill: "none",
874
875
  stroke: "currentColor",
@@ -880,7 +881,8 @@ const Checkbox = ({ className, ...props }) => {
880
881
  strokeWidth: 3
881
882
  })
882
883
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
883
- 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",
884
+ "aria-hidden": "true",
885
+ 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",
884
886
  viewBox: "0 0 24 24",
885
887
  fill: "none",
886
888
  stroke: "currentColor",
@@ -1112,13 +1114,37 @@ const PopoverAnchor = ({ ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.js
1112
1114
 
1113
1115
  //#endregion
1114
1116
  //#region src/components/ui/combobox/combobox.tsx
1117
+ /** cmdk value of the select-all row; never matches a real option. */
1118
+ const SELECT_ALL_VALUE = "__droplet-combobox-select-all__";
1119
+ /**
1120
+ * Decorative `Checkbox` inside a multi-select option. The option row is the
1121
+ * control: it owns focus, the click target and the checked state for
1122
+ * assistive tech, so the checkbox is hidden from them and ignores pointer
1123
+ * events to avoid a second tab stop or a second announcement.
1124
+ */
1125
+ const OptionCheckbox = ({ checked }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Checkbox, {
1126
+ checked,
1127
+ "aria-hidden": true,
1128
+ tabIndex: -1,
1129
+ className: "pointer-events-none after:hidden in-data-[selected=true]:data-[state=unchecked]:shadow-[var(--shadow-control-hover)]"
1130
+ });
1131
+ /** Checkbox state of the select-all row: indeterminate while only some are selected. */
1132
+ const getSelectAllState = ({ selectedCount, totalCount }) => {
1133
+ if (selectedCount === 0) return false;
1134
+ if (selectedCount === totalCount) return true;
1135
+ return "indeterminate";
1136
+ };
1115
1137
  /**
1116
- * Searchable single-select Combobox.
1138
+ * Searchable Combobox, single-select by default or multi-select with `multiple`.
1117
1139
  *
1118
- * Composes `Popover`, `Button`, and `Command` from the droplet design system.
1119
- * The trigger is a full-width `outline` Button with a rotating chevron that
1120
- * signals open/closed state. Selecting an item closes the popover, fires
1121
- * `onValueChange`, and shows a check mark next to the active selection.
1140
+ * Composes `Popover`, `Command` and `Checkbox` from the droplet design system.
1141
+ * The trigger is styled like `SelectTrigger` with a rotating chevron that
1142
+ * signals open/closed state.
1143
+ *
1144
+ * - Single-select: picking an item closes the popover, fires `onValueChange`
1145
+ * and shows a check mark next to the active selection.
1146
+ * - Multi-select: each option shows a `Checkbox`, picking an item toggles it
1147
+ * and keeps the popover open, and the trigger lists the selected labels.
1122
1148
  *
1123
1149
  * @example
1124
1150
  * ```tsx
@@ -1129,18 +1155,49 @@ const PopoverAnchor = ({ ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.js
1129
1155
  * onValueChange={setChain}
1130
1156
  * placeholder="Select a chain"
1131
1157
  * />
1158
+ *
1159
+ * const [chains, setChains] = useState<string[]>([]);
1160
+ * <Combobox
1161
+ * multiple
1162
+ * options={[{ value: 'eth', label: 'Ethereum' }, { value: 'sol', label: 'Solana' }]}
1163
+ * value={chains}
1164
+ * onValueChange={setChains}
1165
+ * selectAllLabel="All chains"
1166
+ * />
1132
1167
  * ```
1133
1168
  */
1134
- const Combobox = ({ options, value, onValueChange, placeholder = "Select…", searchPlaceholder = "Search…", emptyText = "No results.", className, disabled = false }) => {
1169
+ const Combobox = (props) => {
1170
+ const { options, placeholder = "Select…", searchPlaceholder = "Search…", emptyText = "No results.", className, disabled = false } = props;
1135
1171
  const [open, setOpen] = (0, react.useState)(false);
1136
- const selectedLabel = options.find((opt) => opt.value === value)?.label;
1172
+ const [search, setSearch] = (0, react.useState)("");
1173
+ const selectedValues = props.multiple ? props.value : [props.value];
1174
+ const selectedOptions = options.filter((opt) => selectedValues.includes(opt.value));
1175
+ const selectedLabels = selectedOptions.map((opt) => opt.label);
1176
+ const selectedLabel = props.multiple && props.formatSelected && selectedLabels.length > 0 ? props.formatSelected(selectedLabels) : selectedLabels.join(", ") || void 0;
1177
+ const selectAllState = getSelectAllState({
1178
+ selectedCount: selectedOptions.length,
1179
+ totalCount: options.length
1180
+ });
1181
+ const showSelectAll = props.multiple && props.selectAllLabel !== void 0 && search === "";
1137
1182
  const handleSelect = (selectedValue) => {
1138
- onValueChange(selectedValue);
1139
- setOpen(false);
1183
+ if (!props.multiple) {
1184
+ props.onValueChange(selectedValue);
1185
+ handleOpenChange(false);
1186
+ return;
1187
+ }
1188
+ props.onValueChange(props.value.includes(selectedValue) ? props.value.filter((v) => v !== selectedValue) : [...props.value, selectedValue]);
1189
+ };
1190
+ const handleSelectAll = () => {
1191
+ if (!props.multiple) return;
1192
+ props.onValueChange(selectAllState === true ? [] : options.map((opt) => opt.value));
1193
+ };
1194
+ const handleOpenChange = (nextOpen) => {
1195
+ setOpen(nextOpen);
1196
+ if (!nextOpen) setSearch("");
1140
1197
  };
1141
1198
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Popover, {
1142
1199
  open,
1143
- onOpenChange: setOpen,
1200
+ onOpenChange: handleOpenChange,
1144
1201
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PopoverTrigger, {
1145
1202
  asChild: true,
1146
1203
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
@@ -1165,12 +1222,32 @@ const Combobox = ({ options, value, onValueChange, placeholder = "Select…", se
1165
1222
  sideOffset: 4,
1166
1223
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Command, {
1167
1224
  className: "rounded-[inherit]",
1168
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandInput, { placeholder: searchPlaceholder }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CommandList, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandEmpty, { children: emptyText }), options.map((opt) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CommandItem, {
1169
- value: opt.value,
1170
- keywords: [opt.label],
1171
- onSelect: handleSelect,
1172
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckIcon, { className: require_toggle_row.cn("shrink-0", value === opt.value ? "opacity-100" : "opacity-0") }), opt.label]
1173
- }, opt.value))] })]
1225
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandInput, {
1226
+ placeholder: searchPlaceholder,
1227
+ value: search,
1228
+ onValueChange: setSearch
1229
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CommandList, {
1230
+ "aria-multiselectable": props.multiple || void 0,
1231
+ children: [
1232
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandEmpty, { children: emptyText }),
1233
+ showSelectAll && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CommandItem, {
1234
+ value: SELECT_ALL_VALUE,
1235
+ "aria-checked": selectAllState === "indeterminate" ? "mixed" : selectAllState,
1236
+ onSelect: handleSelectAll,
1237
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionCheckbox, { checked: selectAllState }), props.selectAllLabel]
1238
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandSeparator, { className: "my-1" })] }),
1239
+ options.map((opt) => {
1240
+ const isSelected = selectedValues.includes(opt.value);
1241
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CommandItem, {
1242
+ value: opt.value,
1243
+ keywords: [opt.label],
1244
+ "aria-checked": props.multiple ? isSelected : void 0,
1245
+ onSelect: handleSelect,
1246
+ children: [props.multiple ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionCheckbox, { checked: isSelected }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckIcon, { className: require_toggle_row.cn("shrink-0", isSelected ? "opacity-100" : "opacity-0") }), opt.label]
1247
+ }, opt.value);
1248
+ })
1249
+ ]
1250
+ })]
1174
1251
  })
1175
1252
  })]
1176
1253
  });
@@ -1424,9 +1501,114 @@ const Icon = (props) => {
1424
1501
  });
1425
1502
  };
1426
1503
 
1504
+ //#endregion
1505
+ //#region src/components/ui/field/field-control-context.ts
1506
+ /**
1507
+ * Carries a `Field`'s control attributes to a control that renders its focusable
1508
+ * element deeper than `Field`'s direct child.
1509
+ *
1510
+ * `Field` injects `id` and the `aria-*` attributes onto its direct child. That
1511
+ * works for `Input` and `Textarea`, but `Select` renders no element of its own,
1512
+ * so `SelectTrigger` reads them from here instead.
1513
+ */
1514
+ const FieldControlContext = (0, react.createContext)(null);
1515
+
1516
+ //#endregion
1517
+ //#region src/components/ui/select/select.tsx
1518
+ const Select = ({ ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Root, {
1519
+ "data-slot": "select",
1520
+ ...props
1521
+ });
1522
+ const SelectGroup = ({ ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Group, {
1523
+ "data-slot": "select-group",
1524
+ ...props
1525
+ });
1526
+ const SelectValue = ({ ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Value, {
1527
+ "data-slot": "select-value",
1528
+ ...props
1529
+ });
1530
+ const SelectTrigger = ({ className, size = "default", children, ...props }) => {
1531
+ const fieldControlProps = (0, react.useContext)(FieldControlContext);
1532
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_select.Trigger, {
1533
+ ...fieldControlProps,
1534
+ "data-slot": "select-trigger",
1535
+ "data-size": size,
1536
+ className: require_toggle_row.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),
1537
+ ...props,
1538
+ ...fieldControlProps ? { id: fieldControlProps.id } : {},
1539
+ children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Icon, {
1540
+ asChild: true,
1541
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
1542
+ icon: _hugeicons_core_free_icons.ArrowDown01Icon,
1543
+ size: 16,
1544
+ className: "opacity-50 transition-transform duration-150 ease-out motion-reduce:transition-none"
1545
+ })
1546
+ })]
1547
+ });
1548
+ };
1549
+ const SelectContent = ({ className, children, position = "popper", align = "start", ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_select.Content, {
1550
+ "data-slot": "select-content",
1551
+ className: require_toggle_row.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),
1552
+ position,
1553
+ align,
1554
+ ...props,
1555
+ children: [
1556
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectScrollUpButton, {}),
1557
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Viewport, {
1558
+ className: require_toggle_row.cn("p-1", position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
1559
+ children
1560
+ }),
1561
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectScrollDownButton, {})
1562
+ ]
1563
+ }) });
1564
+ const SelectLabel = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Label, {
1565
+ "data-slot": "select-label",
1566
+ className: require_toggle_row.cn("text-muted-foreground px-2 py-1.5 text-xs", className),
1567
+ ...props
1568
+ });
1569
+ const SelectItem = ({ className, children, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_select.Item, {
1570
+ "data-slot": "select-item",
1571
+ className: require_toggle_row.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),
1572
+ ...props,
1573
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1574
+ "data-slot": "select-item-indicator",
1575
+ className: "absolute right-2 flex size-3.5 items-center justify-center",
1576
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.ItemIndicator, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
1577
+ icon: _hugeicons_core_free_icons.Tick01Icon,
1578
+ size: 14
1579
+ }) })
1580
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.ItemText, { children })]
1581
+ });
1582
+ const SelectSeparator = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Separator, {
1583
+ "data-slot": "select-separator",
1584
+ className: require_toggle_row.cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
1585
+ ...props
1586
+ });
1587
+ const SelectScrollUpButton = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.ScrollUpButton, {
1588
+ "data-slot": "select-scroll-up-button",
1589
+ className: require_toggle_row.cn("flex cursor-default items-center justify-center py-1", className),
1590
+ ...props,
1591
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
1592
+ icon: _hugeicons_core_free_icons.ArrowUp01Icon,
1593
+ size: 16,
1594
+ "aria-hidden": true
1595
+ })
1596
+ });
1597
+ const SelectScrollDownButton = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.ScrollDownButton, {
1598
+ "data-slot": "select-scroll-down-button",
1599
+ className: require_toggle_row.cn("flex cursor-default items-center justify-center py-1", className),
1600
+ ...props,
1601
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
1602
+ icon: _hugeicons_core_free_icons.ArrowDown01Icon,
1603
+ size: 16,
1604
+ "aria-hidden": true
1605
+ })
1606
+ });
1607
+
1427
1608
  //#endregion
1428
1609
  //#region src/components/ui/field/field.tsx
1429
- const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--spacing-label-gap)-var(--spacing-field-gap))]";
1610
+ const FIELD_GAP_CLASS_NAME = "grid [--field-gap:6px] [--label-gap:10px] gap-[var(--field-gap)]";
1611
+ const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--label-gap)-var(--field-gap))]";
1430
1612
  /**
1431
1613
  * A generic labeled form-field wrapper.
1432
1614
  *
@@ -1434,16 +1616,26 @@ const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--spacing-label-gap)-var(--spacing-fi
1434
1616
  * an error message together with the correct `id`/`htmlFor`/`aria-describedby`
1435
1617
  * associations so callers don't have to hand-assemble these.
1436
1618
  *
1619
+ * Always wrap a form control in `Field` rather than pairing a bare `<Label>`
1620
+ * with it: `Field` owns the label-to-control gap (10px) and the gap to the
1621
+ * error (6px). Don't add helper text: the error is the only message under a
1622
+ * control.
1623
+ *
1437
1624
  * When there is exactly one child element, `Field` uses `cloneElement` to
1438
1625
  * inject:
1439
1626
  * - `id` — links the label's `htmlFor` to the control
1627
+ * - `aria-labelledby` — names group controls such as `RadioGroup`, which a
1628
+ * `<label for>` cannot name
1440
1629
  * - `aria-describedby` — references the description and/or error paragraph ids
1441
1630
  * - `aria-invalid` — `true` when `error` is present
1442
1631
  *
1632
+ * `Select` renders no element of its own, so `SelectTrigger` picks up `id`,
1633
+ * `aria-describedby` and `aria-invalid` from `Field` instead.
1634
+ *
1443
1635
  * @example
1444
1636
  * ```tsx
1445
- * <Field label="Email" description="We'll never share your email." required>
1446
- * <Input type="email" />
1637
+ * <Field label="Email" required>
1638
+ * <Input type="email" required />
1447
1639
  * </Field>
1448
1640
  *
1449
1641
  * <Field label="Email" error="Enter a valid email address.">
@@ -1452,25 +1644,39 @@ const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--spacing-label-gap)-var(--spacing-fi
1452
1644
  * ```
1453
1645
  */
1454
1646
  const Field = ({ label, description, error, required, htmlFor, children, className }) => {
1647
+ const childArray = react.Children.toArray(children);
1648
+ const singleChild = childArray.length === 1 && (0, react.isValidElement)(childArray[0]) ? childArray[0] : null;
1649
+ const childId = (singleChild?.props)?.id;
1455
1650
  const generatedId = (0, react.useId)();
1456
- const controlId = htmlFor ?? generatedId;
1651
+ const controlId = (typeof childId === "string" ? childId : void 0) ?? htmlFor ?? generatedId;
1457
1652
  const descriptionId = `${controlId}-description`;
1458
1653
  const errorId = `${controlId}-error`;
1459
- const describedByParts = [];
1460
- if (description) describedByParts.push(descriptionId);
1461
- if (error) describedByParts.push(errorId);
1462
- const ariaDescribedBy = describedByParts.length > 0 ? describedByParts.join(" ") : void 0;
1463
- const childArray = react.Children.toArray(children);
1464
- const singleChild = childArray.length === 1 && (0, react.isValidElement)(childArray[0]) ? childArray[0] : null;
1654
+ const labelId = label ? `${controlId}-label` : void 0;
1655
+ const showDescription = Boolean(description) && !error;
1656
+ let ariaDescribedBy;
1657
+ if (error) ariaDescribedBy = errorId;
1658
+ else if (showDescription) ariaDescribedBy = descriptionId;
1659
+ const hasError = Boolean(error);
1660
+ const controlProps = (0, react.useMemo)(() => ({
1661
+ "aria-describedby": ariaDescribedBy,
1662
+ id: controlId,
1663
+ ...hasError ? { "aria-invalid": true } : {}
1664
+ }), [
1665
+ ariaDescribedBy,
1666
+ controlId,
1667
+ hasError
1668
+ ]);
1465
1669
  const enrichedChild = singleChild ? (0, react.cloneElement)(singleChild, {
1466
1670
  "aria-describedby": singleChild.props["aria-describedby"] ?? ariaDescribedBy,
1467
- id: singleChild.props.id ?? controlId,
1671
+ "aria-labelledby": singleChild.props["aria-labelledby"] ?? labelId,
1672
+ id: controlId,
1468
1673
  ...error ? { "aria-invalid": true } : {}
1469
1674
  }) : null;
1470
1675
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1471
- className: require_toggle_row.cn("grid gap-field-gap", className),
1676
+ className: require_toggle_row.cn(FIELD_GAP_CLASS_NAME, className),
1472
1677
  children: [
1473
1678
  label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_toggle_row.Label, {
1679
+ id: labelId,
1474
1680
  htmlFor: controlId,
1475
1681
  "data-slot": "field-label",
1476
1682
  className: LABEL_GAP_CLASS_NAME,
@@ -1480,8 +1686,11 @@ const Field = ({ label, description, error, required, htmlFor, children, classNa
1480
1686
  children: "*"
1481
1687
  })]
1482
1688
  }),
1483
- enrichedChild ?? children,
1484
- description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1689
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldControlContext.Provider, {
1690
+ value: singleChild?.type === Select ? controlProps : null,
1691
+ children: enrichedChild ?? children
1692
+ }),
1693
+ showDescription && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1485
1694
  id: descriptionId,
1486
1695
  className: "text-sm text-muted-foreground",
1487
1696
  children: description
@@ -1831,93 +2040,6 @@ const SearchInput = ({ className, placeholder = "Search...", shortcut = "⌘K",
1831
2040
  });
1832
2041
  };
1833
2042
 
1834
- //#endregion
1835
- //#region src/components/ui/select/select.tsx
1836
- const Select = ({ ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Root, {
1837
- "data-slot": "select",
1838
- ...props
1839
- });
1840
- const SelectGroup = ({ ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Group, {
1841
- "data-slot": "select-group",
1842
- ...props
1843
- });
1844
- const SelectValue = ({ ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Value, {
1845
- "data-slot": "select-value",
1846
- ...props
1847
- });
1848
- const SelectTrigger = ({ className, size = "default", children, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_select.Trigger, {
1849
- "data-slot": "select-trigger",
1850
- "data-size": size,
1851
- className: require_toggle_row.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),
1852
- ...props,
1853
- children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Icon, {
1854
- asChild: true,
1855
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
1856
- icon: _hugeicons_core_free_icons.ArrowDown01Icon,
1857
- size: 16,
1858
- className: "opacity-50 transition-transform duration-150 ease-out motion-reduce:transition-none"
1859
- })
1860
- })]
1861
- });
1862
- const SelectContent = ({ className, children, position = "popper", align = "start", ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_select.Content, {
1863
- "data-slot": "select-content",
1864
- className: require_toggle_row.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),
1865
- position,
1866
- align,
1867
- ...props,
1868
- children: [
1869
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectScrollUpButton, {}),
1870
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Viewport, {
1871
- className: require_toggle_row.cn("p-1", position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
1872
- children
1873
- }),
1874
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectScrollDownButton, {})
1875
- ]
1876
- }) });
1877
- const SelectLabel = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Label, {
1878
- "data-slot": "select-label",
1879
- className: require_toggle_row.cn("text-muted-foreground px-2 py-1.5 text-xs", className),
1880
- ...props
1881
- });
1882
- const SelectItem = ({ className, children, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_select.Item, {
1883
- "data-slot": "select-item",
1884
- className: require_toggle_row.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),
1885
- ...props,
1886
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1887
- "data-slot": "select-item-indicator",
1888
- className: "absolute right-2 flex size-3.5 items-center justify-center",
1889
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.ItemIndicator, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
1890
- icon: _hugeicons_core_free_icons.Tick01Icon,
1891
- size: 14
1892
- }) })
1893
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.ItemText, { children })]
1894
- });
1895
- const SelectSeparator = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Separator, {
1896
- "data-slot": "select-separator",
1897
- className: require_toggle_row.cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
1898
- ...props
1899
- });
1900
- const SelectScrollUpButton = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.ScrollUpButton, {
1901
- "data-slot": "select-scroll-up-button",
1902
- className: require_toggle_row.cn("flex cursor-default items-center justify-center py-1", className),
1903
- ...props,
1904
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
1905
- icon: _hugeicons_core_free_icons.ArrowUp01Icon,
1906
- size: 16,
1907
- "aria-hidden": true
1908
- })
1909
- });
1910
- const SelectScrollDownButton = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.ScrollDownButton, {
1911
- "data-slot": "select-scroll-down-button",
1912
- className: require_toggle_row.cn("flex cursor-default items-center justify-center py-1", className),
1913
- ...props,
1914
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
1915
- icon: _hugeicons_core_free_icons.ArrowDown01Icon,
1916
- size: 16,
1917
- "aria-hidden": true
1918
- })
1919
- });
1920
-
1921
2043
  //#endregion
1922
2044
  //#region src/components/ui/selectable-card/selectable-card.tsx
1923
2045
  const SelectableCard = ({ badge, className, description, icon, iconSize = 20, label, selected, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
@@ -4063,9 +4185,10 @@ const AssetIcon = ({ symbol, size = 32, className }) => {
4063
4185
  //#endregion
4064
4186
  //#region src/components/copy-button/copy-button.tsx
4065
4187
  const TIMING = {
4066
- feedbackHold: 1500,
4067
- iconSwap: 220,
4068
- reset: 120
4188
+ errorHold: 2e3,
4189
+ iconSwap: 200,
4190
+ reset: 120,
4191
+ successHold: 1e3
4069
4192
  };
4070
4193
  const COPY_STAGE = {
4071
4194
  copied: 1,
@@ -4073,12 +4196,18 @@ const COPY_STAGE = {
4073
4196
  idle: 0
4074
4197
  };
4075
4198
  const ICON = {
4199
+ activeBlur: "blur(0px)",
4076
4200
  activeScale: 1,
4077
- inactiveScale: .72,
4078
- spring: {
4079
- bounce: 0,
4080
- type: "spring",
4081
- visualDuration: TIMING.iconSwap / 1e3
4201
+ inactiveBlur: "blur(4px)",
4202
+ inactiveScale: .25,
4203
+ transition: {
4204
+ duration: TIMING.iconSwap / 1e3,
4205
+ ease: [
4206
+ .4,
4207
+ 0,
4208
+ .2,
4209
+ 1
4210
+ ]
4082
4211
  }
4083
4212
  };
4084
4213
  const LABEL = {
@@ -4099,6 +4228,7 @@ const HIDDEN_RESET_TRANSITION = {
4099
4228
  duration: 0
4100
4229
  };
4101
4230
  const ICON_RESET_TRANSITION = {
4231
+ filter: HIDDEN_RESET_TRANSITION,
4102
4232
  opacity: RESET_TRANSITION,
4103
4233
  scale: HIDDEN_RESET_TRANSITION
4104
4234
  };
@@ -4108,12 +4238,11 @@ const LABEL_RESET_TRANSITION = {
4108
4238
  };
4109
4239
  const REDUCED_MOTION_TRANSITION = { duration: 0 };
4110
4240
  /** Copies a value and presents stable, accessible success or failure feedback. */
4111
- const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", className }) => {
4241
+ const CopyButton = ({ value, ariaLabel: idleAriaLabel, label, variant = "outline", size = "icon-xs", className }) => {
4112
4242
  const [stage, setStage] = (0, react.useState)(COPY_STAGE.idle);
4113
4243
  const timeoutRef = (0, react.useRef)(null);
4114
4244
  const requestIdRef = (0, react.useRef)(0);
4115
4245
  const shouldReduceMotion = (0, motion_react.useReducedMotion)();
4116
- const animationStyle = { willChange: shouldReduceMotion ? "auto" : "transform, opacity" };
4117
4246
  (0, react.useEffect)(() => {
4118
4247
  return () => {
4119
4248
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
@@ -4122,7 +4251,7 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
4122
4251
  const showFeedback = (nextStage) => {
4123
4252
  setStage(nextStage);
4124
4253
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
4125
- timeoutRef.current = setTimeout(() => setStage(COPY_STAGE.idle), TIMING.feedbackHold);
4254
+ timeoutRef.current = setTimeout(() => setStage(COPY_STAGE.idle), nextStage === COPY_STAGE.error ? TIMING.errorHold : TIMING.successHold);
4126
4255
  };
4127
4256
  const handleCopy = async () => {
4128
4257
  const requestId = ++requestIdRef.current;
@@ -4133,7 +4262,7 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
4133
4262
  if (requestId === requestIdRef.current) showFeedback(COPY_STAGE.error);
4134
4263
  }
4135
4264
  };
4136
- let ariaLabel = label || "Copy to clipboard";
4265
+ let ariaLabel = idleAriaLabel || label || "Copy to clipboard";
4137
4266
  let announcement = "";
4138
4267
  if (stage === COPY_STAGE.copied) {
4139
4268
  ariaLabel = "Copied";
@@ -4142,7 +4271,7 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
4142
4271
  ariaLabel = "Copy failed";
4143
4272
  announcement = "Copy failed";
4144
4273
  }
4145
- let iconTransition = ICON.spring;
4274
+ let iconTransition = ICON.transition;
4146
4275
  let labelTransition = LABEL.spring;
4147
4276
  if (stage === COPY_STAGE.idle) {
4148
4277
  iconTransition = ICON_RESET_TRANSITION;
@@ -4163,8 +4292,8 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
4163
4292
  },
4164
4293
  {
4165
4294
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckIcon, {
4166
- size: null,
4167
- strokeWidth: 2
4295
+ className: "[&_path]:[stroke-width:var(--icon-stroke-width,1.75)]",
4296
+ size: null
4168
4297
  }),
4169
4298
  label: label ? "Copied" : void 0,
4170
4299
  stage: COPY_STAGE.copied
@@ -4194,17 +4323,18 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
4194
4323
  className: "col-start-1 row-start-1 flex items-center gap-1.5",
4195
4324
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.motion.span, {
4196
4325
  initial: false,
4326
+ "data-slot": visualState.stage === COPY_STAGE.copied ? "copy-button-check" : void 0,
4327
+ "data-state": isActive ? "checked" : "unchecked",
4197
4328
  animate: {
4329
+ filter: isIdleVisual || isActive ? ICON.activeBlur : ICON.inactiveBlur,
4198
4330
  opacity: isActive ? 1 : 0,
4199
4331
  scale: isIdleVisual || isActive ? ICON.activeScale : ICON.inactiveScale
4200
4332
  },
4201
4333
  transition: iconTransition,
4202
- style: animationStyle,
4203
4334
  className: "flex items-center",
4204
4335
  children: visualState.icon
4205
4336
  }), visualState.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.motion.span, {
4206
4337
  initial: false,
4207
- style: animationStyle,
4208
4338
  animate: {
4209
4339
  opacity: isActive ? 1 : 0,
4210
4340
  y: isIdleVisual || isActive ? LABEL.activeOffset : LABEL.inactiveOffset
@@ -4429,7 +4559,7 @@ const DomainList = ({ className, domains, onChange, placeholder = "https://examp
4429
4559
  children: domains.map((domain) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
4430
4560
  className: "flex items-center justify-between gap-2 rounded-md border bg-[var(--bg-bottom)] px-3 py-2 text-sm",
4431
4561
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4432
- className: "font-mono text-sm truncate",
4562
+ className: "text-sm tabular-nums truncate",
4433
4563
  children: domain
4434
4564
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4435
4565
  type: "button",
@@ -4950,6 +5080,16 @@ const renderInput = (input, id) => {
4950
5080
  })
4951
5081
  });
4952
5082
  };
5083
+ /**
5084
+ * DEPRECATED. Never use in new code. Use `FlushCardStack` with a `ToggleRow`
5085
+ * header instead; put sub-options in the item's reveal.
5086
+ *
5087
+ * Kept so existing callers keep rendering while they migrate.
5088
+ *
5089
+ * @deprecated Use `FlushCardStack` + `ToggleRow`.
5090
+ * @see FlushCardStack
5091
+ * @see ToggleRow
5092
+ */
4953
5093
  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 }) => {
4954
5094
  const generatedId = (0, react.useId)();
4955
5095
  const inputId = inputProps?.id ?? generatedId;