@snap-rail/ui 0.2.0 → 0.4.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.
package/lib/index.js CHANGED
@@ -2,6 +2,10 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Component, createContext, useContext, useEffect, useId, useRef, useState, useSyncExternalStore } from "react";
3
3
  import * as SeparatorPrimitive from "@radix-ui/react-separator";
4
4
  import { Slot as Slot$1 } from "@radix-ui/react-slot";
5
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
6
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
7
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
8
+ import { Toaster as Toaster$1, toast as toast$1 } from "sonner";
5
9
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
6
10
  import * as LabelPrimitive from "@radix-ui/react-label";
7
11
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
@@ -12,10 +16,6 @@ import * as DialogPrimitive from "@radix-ui/react-dialog";
12
16
  import { Controller, Controller as Controller$1, FormProvider, FormProvider as FormProvider$1, useController, useFieldArray, useForm, useFormContext, useFormState, useFormState as useFormState$1, useWatch } from "react-hook-form";
13
17
  import { zodResolver } from "@hookform/resolvers/zod";
14
18
  import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
15
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
16
- import * as PopoverPrimitive from "@radix-ui/react-popover";
17
- import * as ToastPrimitive from "@radix-ui/react-toast";
18
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
19
19
  import * as SliderPrimitive from "@radix-ui/react-slider";
20
20
  import { attachBallDrag as attachBallDrag$1 } from "@snap-rail/client-kernel";
21
21
  import { rpcErrorText, subscribeFrame } from "@snap-rail/connection";
@@ -185,10 +185,29 @@ const UI_COMPONENTS = {
185
185
  "touch-select.root",
186
186
  "touch-select.trigger",
187
187
  "touch-select.sheet",
188
- "touch-select.option"
188
+ "touch-select.options"
189
189
  ],
190
190
  props: ["invalid", "disabled"]
191
191
  },
192
+ combobox: {
193
+ parts: [
194
+ "combobox.root",
195
+ "combobox.anchor",
196
+ "combobox.list",
197
+ "combobox.option",
198
+ "combobox.empty"
199
+ ],
200
+ slots: ["empty"],
201
+ props: [
202
+ "value",
203
+ "options",
204
+ "size",
205
+ "invalid",
206
+ "disabled",
207
+ "loading",
208
+ "onInputValueChange"
209
+ ]
210
+ },
192
211
  checkbox: {
193
212
  parts: [
194
213
  "checkbox.root",
@@ -350,17 +369,6 @@ const UI_COMPONENTS = {
350
369
  ],
351
370
  slots: ["trigger", "content"]
352
371
  },
353
- toast: {
354
- parts: [
355
- "toast.root",
356
- "toast.title",
357
- "toast.description",
358
- "toast.action",
359
- "toast.close",
360
- "toast.viewport"
361
- ],
362
- slots: ["action"]
363
- },
364
372
  progress: { parts: [
365
373
  "progress.root",
366
374
  "progress.track",
@@ -619,7 +627,13 @@ const UI_COMPONENTS = {
619
627
  function cn(...values) {
620
628
  return values.filter((value) => typeof value === "string" && value.length > 0).join(" ");
621
629
  }
622
- /** The anatomy attributes every semantic component renders. */
630
+ /**
631
+ * The anatomy attributes every semantic component renders. The identity is
632
+ * component-owned: components spread these AFTER caller props so a composite
633
+ * can never mask a host part (a masked `button.root` loses every skin rule
634
+ * and falls back to the UA default look). Composites tag their own wrappers
635
+ * instead of pushing `part()` into a child component's props.
636
+ */
623
637
  function part(component, name) {
624
638
  return {
625
639
  "data-snap-component": component,
@@ -982,58 +996,58 @@ function useChartTheme() {
982
996
  /** An inline status banner for results and failures. */
983
997
  function Alert({ intent = "neutral", className, children, ...props }) {
984
998
  return jsx("div", {
985
- ...part("alert", "root"),
986
999
  role: "alert",
987
1000
  className: cn("snap-alert", className),
988
1001
  "data-intent": intent,
989
1002
  ...props,
1003
+ ...part("alert", "root"),
990
1004
  children
991
1005
  });
992
1006
  }
993
1007
  /** The alert heading line. */
994
1008
  function AlertTitle({ className, children, ...props }) {
995
1009
  return jsx("h5", {
996
- ...part("alert", "title"),
997
1010
  className: cn("snap-alert-title", className),
998
1011
  ...props,
1012
+ ...part("alert", "title"),
999
1013
  children
1000
1014
  });
1001
1015
  }
1002
1016
  /** The alert body text. */
1003
1017
  function AlertDescription({ className, children, ...props }) {
1004
1018
  return jsx("div", {
1005
- ...part("alert", "description"),
1006
1019
  className: cn("snap-alert-description", className),
1007
1020
  ...props,
1021
+ ...part("alert", "description"),
1008
1022
  children
1009
1023
  });
1010
1024
  }
1011
1025
  /** A themed rule between sections. */
1012
1026
  function Separator({ orientation = "horizontal", className, ...props }) {
1013
1027
  return jsx(SeparatorPrimitive.Root, {
1014
- ...part("separator", "root"),
1015
1028
  orientation,
1016
1029
  className: cn("snap-separator", className),
1017
- ...props
1030
+ ...props,
1031
+ ...part("separator", "root")
1018
1032
  });
1019
1033
  }
1020
1034
  /** A neutral loading placeholder shaped by the skin. */
1021
1035
  function Skeleton({ variant = "block", className, ...props }) {
1022
1036
  return jsx("div", {
1023
- ...part("skeleton", "root"),
1024
1037
  className: cn("snap-skeleton", className),
1025
1038
  "data-variant": variant,
1026
1039
  "aria-hidden": "true",
1027
- ...props
1040
+ ...props,
1041
+ ...part("skeleton", "root")
1028
1042
  });
1029
1043
  }
1030
1044
  /** A vertical collection of {@link ListItem} rows. */
1031
1045
  function List({ divided = false, className, children, ...props }) {
1032
1046
  return jsx("ul", {
1033
- ...part("list", "root"),
1034
1047
  className: cn("snap-list", className),
1035
1048
  "data-divided": divided || void 0,
1036
1049
  ...props,
1050
+ ...part("list", "root"),
1037
1051
  children
1038
1052
  });
1039
1053
  }
@@ -1047,7 +1061,6 @@ function ListItem({ leading, trailing, selected = false, disabled = false, onCli
1047
1061
  }
1048
1062
  };
1049
1063
  return jsxs("li", {
1050
- ...part("list", "item"),
1051
1064
  className: cn("snap-list-item", className),
1052
1065
  "data-selected": selected || void 0,
1053
1066
  "data-interactive": interactive || void 0,
@@ -1060,6 +1073,7 @@ function ListItem({ leading, trailing, selected = false, disabled = false, onCli
1060
1073
  onKeyDown: activate
1061
1074
  } : {},
1062
1075
  ...props,
1076
+ ...part("list", "item"),
1063
1077
  children: [
1064
1078
  leading !== void 0 && jsx("span", {
1065
1079
  ...part("list", "leading"),
@@ -1132,7 +1146,6 @@ function Button({ intent = "neutral", emphasis = "solid", size = "md", loading =
1132
1146
  loading && jsx(Spinner, {})
1133
1147
  ] });
1134
1148
  return jsx(Component, {
1135
- ...part("button", "root"),
1136
1149
  ...type !== void 0 ? { type } : !asChild ? { type: "button" } : {},
1137
1150
  className: cn("snap-button", className),
1138
1151
  "data-intent": intent,
@@ -1143,13 +1156,13 @@ function Button({ intent = "neutral", emphasis = "solid", size = "md", loading =
1143
1156
  "aria-busy": loading || void 0,
1144
1157
  disabled: !asChild ? disabled === true || loading : void 0,
1145
1158
  ...props,
1159
+ ...part("button", "root"),
1146
1160
  children: content
1147
1161
  });
1148
1162
  }
1149
1163
  /** A square glyph button with a mandatory accessible label. */
1150
1164
  function IconButton({ icon, label, active = false, intent = "neutral", emphasis = "ghost", size = "md", className, ...props }) {
1151
1165
  return jsx("button", {
1152
- ...part("icon-button", "root"),
1153
1166
  type: "button",
1154
1167
  className: cn("snap-icon-button", className),
1155
1168
  "data-intent": intent,
@@ -1159,6 +1172,7 @@ function IconButton({ icon, label, active = false, intent = "neutral", emphasis
1159
1172
  "aria-label": label,
1160
1173
  "aria-pressed": active || void 0,
1161
1174
  ...props,
1175
+ ...part("icon-button", "root"),
1162
1176
  children: jsx("span", {
1163
1177
  ...part("icon-button", "icon"),
1164
1178
  "aria-hidden": "true",
@@ -1167,137 +1181,680 @@ function IconButton({ icon, label, active = false, intent = "neutral", emphasis
1167
1181
  });
1168
1182
  }
1169
1183
  //#endregion
1170
- //#region lib/types/components/dialog.js
1184
+ //#region lib/types/components/input.js
1171
1185
  /**
1172
- * Dialog/sheet semantics over Radix's focus trap and portal. The skin chooses
1173
- * the presentation (modal, sheet, fullscreen) through the `presentation`
1174
- * attribute; the core owns dismissal and focus behaviour.
1186
+ * Text-entry semantics: the wrapper owns the anatomy (prefix/suffix/clear),
1187
+ * the native field keeps keyboard and IME behaviour. Skins style the parts.
1175
1188
  *
1176
- * @module @snap-rail/ui/components/dialog
1189
+ * @module @snap-rail/ui/components/input
1177
1190
  */
1178
- /** The dialog root. */
1179
- const Dialog = DialogPrimitive.Root;
1180
- /** The dialog trigger. */
1181
- const DialogTrigger = DialogPrimitive.Trigger;
1182
- /** The dialog close. */
1183
- const DialogClose = DialogPrimitive.Close;
1184
- /** The portalled dialog content. */
1185
- function DialogContent({ children, className, presentation = "auto", size = "md", showClose = true, ...rest }) {
1186
- const resolved = presentation === "auto" ? "modal" : presentation;
1187
- return jsxs(DialogPrimitive.Portal, { children: [jsx(DialogPrimitive.Overlay, {
1188
- ...part("dialog", "overlay"),
1189
- className: "snap-dialog-overlay"
1190
- }), jsxs(DialogPrimitive.Content, {
1191
- ...part("dialog", "panel"),
1192
- className: cn("snap-dialog-panel", className),
1193
- "data-presentation": resolved,
1191
+ /** A single-line text field with semantic prefix/suffix slots. Layout
1192
+ * `style`/`className` dress the wrapper — the visible control; the native
1193
+ * field already stretches inside it. */
1194
+ function Input({ size = "md", invalid = false, prefix, suffix, onClear, fieldClassName, componentName = "input", className, style, disabled, ...props }) {
1195
+ return jsxs("div", {
1196
+ ...part(componentName, "root"),
1197
+ className: cn("snap-input", className),
1198
+ style,
1194
1199
  "data-size": size,
1195
- ...rest,
1196
- children: [children, showClose && jsx(DialogPrimitive.Close, {
1197
- ...part("dialog", "close"),
1198
- className: "snap-dialog-close",
1199
- "aria-label": "关闭",
1200
- children: "×"
1201
- })]
1202
- })] });
1203
- }
1204
- /** The dialog header. */
1205
- function DialogHeader({ children, className }) {
1206
- return jsx("div", {
1207
- ...part("dialog", "header"),
1208
- className: cn("snap-dialog-header", className),
1209
- children
1210
- });
1211
- }
1212
- /** The dialog title. */
1213
- function DialogTitle({ children, className }) {
1214
- return jsx(DialogPrimitive.Title, {
1215
- ...part("dialog", "title"),
1216
- className: cn("snap-dialog-title", className),
1217
- children
1218
- });
1219
- }
1220
- /** The dialog description. */
1221
- function DialogDescription({ children, className }) {
1222
- return jsx(DialogPrimitive.Description, {
1223
- ...part("dialog", "description"),
1224
- className: cn("snap-dialog-description", className),
1225
- children
1226
- });
1227
- }
1228
- /** The dialog body. */
1229
- function DialogBody({ children, className }) {
1230
- return jsx("div", {
1231
- ...part("dialog", "body"),
1232
- className: cn("snap-dialog-body", className),
1233
- children
1200
+ "data-invalid": invalid || void 0,
1201
+ "data-disabled": disabled === true || void 0,
1202
+ children: [
1203
+ prefix !== void 0 && jsx("span", {
1204
+ ...part(componentName, "prefix"),
1205
+ children: prefix
1206
+ }),
1207
+ jsx("input", {
1208
+ className: cn("snap-input-field", fieldClassName),
1209
+ disabled,
1210
+ "aria-invalid": invalid || void 0,
1211
+ ...props,
1212
+ ...part(componentName, "field")
1213
+ }),
1214
+ onClear !== void 0 && typeof props.value === "string" && props.value !== "" && jsx("button", {
1215
+ ...part(componentName, "clear"),
1216
+ type: "button",
1217
+ className: "snap-input-clear",
1218
+ "aria-label": "清除",
1219
+ onClick: onClear,
1220
+ children: "×"
1221
+ }),
1222
+ suffix !== void 0 && jsx("span", {
1223
+ ...part(componentName, "suffix"),
1224
+ children: suffix
1225
+ })
1226
+ ]
1234
1227
  });
1235
1228
  }
1236
- /** The dialog footer. */
1237
- function DialogFooter({ children, className }) {
1229
+ /** A multi-line text field. Like {@link Input}, layout `style`/`className`
1230
+ * dress the wrapper; the field stretches inside it. */
1231
+ function Textarea({ size = "md", invalid = false, fieldClassName, className, style, disabled, ...props }) {
1238
1232
  return jsx("div", {
1239
- ...part("dialog", "footer"),
1240
- className: cn("snap-dialog-footer", className),
1241
- children
1233
+ ...part("textarea", "root"),
1234
+ className: cn("snap-textarea", className),
1235
+ style,
1236
+ "data-size": size,
1237
+ "data-invalid": invalid || void 0,
1238
+ "data-disabled": disabled === true || void 0,
1239
+ children: jsx("textarea", {
1240
+ className: cn("snap-textarea-field", fieldClassName),
1241
+ disabled,
1242
+ "aria-invalid": invalid || void 0,
1243
+ ...props,
1244
+ ...part("textarea", "field")
1245
+ })
1242
1246
  });
1243
1247
  }
1244
- /** A sheet is a dialog with the `sheet` presentation by default. */
1245
- function Sheet(props) {
1246
- return jsx(DialogContent, {
1247
- ...props,
1248
- presentation: props.presentation ?? "sheet"
1248
+ /** A numeric field with touch steppers: `step-up`/`step-down` commit through
1249
+ * the normal `onChange` (a native input event on the field), clamped to
1250
+ * `min`/`max`. */
1251
+ function NumberInput({ min, max, step = 1, size = "md", invalid = false, fieldClassName, className, style, disabled, value, onChange, ...props }) {
1252
+ const fieldRef = useRef(null);
1253
+ const current = typeof value === "number" ? value : void 0;
1254
+ const stepBy = (delta) => {
1255
+ const field = fieldRef.current;
1256
+ if (field === null || disabled === true) return;
1257
+ const parsed = typeof value === "number" ? value : Number(field.value);
1258
+ let next = (Number.isFinite(parsed) ? parsed : min ?? 0) + delta * step;
1259
+ if (min !== void 0 && next < min) next = min;
1260
+ if (max !== void 0 && next > max) next = max;
1261
+ (Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set)?.call(field, String(next));
1262
+ field.dispatchEvent(new Event("input", { bubbles: true }));
1263
+ };
1264
+ return jsxs("div", {
1265
+ ...part("number-input", "root"),
1266
+ className: cn("snap-input", "snap-number-input", className),
1267
+ style,
1268
+ "data-size": size,
1269
+ "data-invalid": invalid || void 0,
1270
+ "data-disabled": disabled === true || void 0,
1271
+ children: [jsx("input", {
1272
+ ref: fieldRef,
1273
+ className: cn("snap-input-field", fieldClassName),
1274
+ type: "number",
1275
+ inputMode: "decimal",
1276
+ disabled,
1277
+ "aria-invalid": invalid || void 0,
1278
+ value,
1279
+ onChange,
1280
+ ...min !== void 0 ? { min } : {},
1281
+ ...max !== void 0 ? { max } : {},
1282
+ ...step !== void 0 ? { step } : {},
1283
+ ...props,
1284
+ ...part("number-input", "field")
1285
+ }), jsxs("span", {
1286
+ className: "snap-number-input-steps",
1287
+ children: [jsx("button", {
1288
+ ...part("number-input", "step-up"),
1289
+ type: "button",
1290
+ tabIndex: -1,
1291
+ className: "snap-number-input-step",
1292
+ "aria-label": "增大",
1293
+ disabled: disabled === true || current !== void 0 && max !== void 0 && current >= max,
1294
+ onClick: () => stepBy(1),
1295
+ children: "+"
1296
+ }), jsx("button", {
1297
+ ...part("number-input", "step-down"),
1298
+ type: "button",
1299
+ tabIndex: -1,
1300
+ className: "snap-number-input-step",
1301
+ "aria-label": "减小",
1302
+ disabled: disabled === true || current !== void 0 && min !== void 0 && current <= min,
1303
+ onClick: () => stepBy(-1),
1304
+ children: "-"
1305
+ })]
1306
+ })]
1249
1307
  });
1250
1308
  }
1251
1309
  //#endregion
1252
- //#region lib/types/components/controls.js
1310
+ //#region lib/types/components/overlay.js
1253
1311
  /**
1254
- * Selection and toggle semantics over Radix: tabs, select, switch, checkbox,
1255
- * and radio groups. All behaviour/keyboard handling stays here; skins target
1256
- * the stable parts and state attributes.
1312
+ * Overlay semantics over Radix: tooltips, popovers, and dropdown menus; the
1313
+ * toast queue runs on Sonner (the Radix toast primitive is deprecated
1314
+ * upstream). Behaviour/keyboard/focus handling stays here; skins target the
1315
+ * stable parts (`tooltip.*`, `popover.*`, `menu.*`) and Sonner's toast data
1316
+ * attributes. The imperative toast() helper pairs with the <Toaster/> the
1317
+ * runtime mounts in every surface root.
1257
1318
  *
1258
- * @module @snap-rail/ui/components/controls
1319
+ * @module @snap-rail/ui/components/overlay
1259
1320
  */
1260
- /** A form label. */
1261
- function Label({ className, children, ...props }) {
1262
- return jsx(LabelPrimitive.Root, {
1263
- className: cn("snap-label", className),
1321
+ /** The tooltip root; wraps `TooltipTrigger`/`TooltipContent` and owns delay. */
1322
+ function Tooltip({ delayDuration, ...props }) {
1323
+ return jsx(TooltipPrimitive.Root, {
1264
1324
  ...props,
1265
- children
1325
+ delayDuration: delayDuration ?? 300
1266
1326
  });
1267
1327
  }
1268
- /** The tabs root. */
1269
- function Tabs({ className, children, ...props }) {
1270
- return jsx(TabsPrimitive.Root, {
1271
- ...part("tabs", "root"),
1272
- className: cn("snap-tabs", className),
1328
+ /** The tooltip provider; the runtime mounts one, pages only need it standalone. */
1329
+ function TooltipProvider(props) {
1330
+ return jsx(TooltipPrimitive.Provider, { ...props });
1331
+ }
1332
+ /** The tooltip trigger; wraps its child and anchors the bubble. */
1333
+ function TooltipTrigger(props) {
1334
+ return jsx(TooltipPrimitive.Trigger, {
1273
1335
  ...props,
1274
- children
1336
+ ...part("tooltip", "trigger")
1275
1337
  });
1276
1338
  }
1277
- /** The tabs list. */
1278
- function TabsList({ className, children, ...props }) {
1279
- return jsx(TabsPrimitive.List, {
1280
- ...part("tabs", "list"),
1281
- className: cn("snap-tabs-list", className),
1339
+ /** The portalled tooltip bubble. */
1340
+ function TooltipContent({ side = "top", sideOffset = 6, className, children, ...props }) {
1341
+ return jsx(TooltipPrimitive.Portal, { children: jsx(TooltipPrimitive.Content, {
1342
+ className: cn("snap-tooltip", className),
1343
+ side,
1344
+ sideOffset,
1345
+ ...props,
1346
+ ...part("tooltip", "content"),
1347
+ children
1348
+ }) });
1349
+ }
1350
+ /** The popover root. */
1351
+ const Popover = PopoverPrimitive.Root;
1352
+ /** The popover trigger; wraps its child and toggles the panel. */
1353
+ function PopoverTrigger(props) {
1354
+ return jsx(PopoverPrimitive.Trigger, {
1355
+ ...props,
1356
+ ...part("popover", "trigger")
1357
+ });
1358
+ }
1359
+ /** An element the panel positions against without toggling it. */
1360
+ const PopoverAnchor = PopoverPrimitive.Anchor;
1361
+ /** Closes the popover from inside the panel. */
1362
+ function PopoverClose(props) {
1363
+ return jsx(PopoverPrimitive.Close, { ...props });
1364
+ }
1365
+ /** Whether the element can hold a text caret (the anchored-combobox opener). */
1366
+ function isEditableElement(element) {
1367
+ if (element === null || !(element instanceof HTMLElement)) return false;
1368
+ return element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.isContentEditable;
1369
+ }
1370
+ /**
1371
+ * The portalled popover panel, with the two focus dead ends Radix leaves
1372
+ * open in anchored mode: on open, the FocusScope default steals the focus
1373
+ * from the field a combobox is typing into; on close, the default handler
1374
+ * focuses the trigger ref — which is `null` without a `PopoverTrigger`, so
1375
+ * focus strands on `body` and every keystroke dies. The wrapper remembers
1376
+ * the element that opened the panel and returns focus there; when that
1377
+ * element is editable it also keeps the focus in it while the panel is
1378
+ * open. Trigger-mode popovers behave exactly as Radix does (the opener IS
1379
+ * the trigger).
1380
+ */
1381
+ function PopoverContent({ side = "bottom", align = "center", sideOffset = 6, autoFocusOnOpen, className, children, onOpenAutoFocus, onCloseAutoFocus, onInteractOutside, ...props }) {
1382
+ const openerRef = useRef(null);
1383
+ const interactedOutsideRef = useRef(false);
1384
+ const handleOpenAutoFocus = (event) => {
1385
+ openerRef.current = document.activeElement;
1386
+ interactedOutsideRef.current = false;
1387
+ onOpenAutoFocus?.(event);
1388
+ if (event.defaultPrevented) return;
1389
+ if (autoFocusOnOpen === false || autoFocusOnOpen === void 0 && isEditableElement(openerRef.current)) event.preventDefault();
1390
+ };
1391
+ const handleCloseAutoFocus = (event) => {
1392
+ onCloseAutoFocus?.(event);
1393
+ if (event.defaultPrevented) return;
1394
+ if (interactedOutsideRef.current) return;
1395
+ const opener = openerRef.current;
1396
+ if (opener !== null && opener !== document.body && opener.isConnected) {
1397
+ event.preventDefault();
1398
+ opener.focus({ preventScroll: true });
1399
+ }
1400
+ };
1401
+ const handleInteractOutside = (event) => {
1402
+ interactedOutsideRef.current = true;
1403
+ onInteractOutside?.(event);
1404
+ };
1405
+ return jsx(PopoverPrimitive.Portal, { children: jsx(PopoverPrimitive.Content, {
1406
+ className: cn("snap-popover", className),
1407
+ side,
1408
+ align,
1409
+ sideOffset,
1410
+ onOpenAutoFocus: handleOpenAutoFocus,
1411
+ onCloseAutoFocus: handleCloseAutoFocus,
1412
+ onInteractOutside: handleInteractOutside,
1413
+ ...props,
1414
+ ...part("popover", "content"),
1415
+ children
1416
+ }) });
1417
+ }
1418
+ /** The dropdown menu root. */
1419
+ const Menu = DropdownMenuPrimitive.Root;
1420
+ /** The menu trigger; wraps its child and toggles the dropdown. */
1421
+ function MenuTrigger(props) {
1422
+ return jsx(DropdownMenuPrimitive.Trigger, {
1423
+ ...props,
1424
+ ...part("menu", "trigger")
1425
+ });
1426
+ }
1427
+ /** The portalled dropdown list. */
1428
+ function MenuContent({ side = "bottom", align = "start", sideOffset = 4, className, children, ...props }) {
1429
+ return jsx(DropdownMenuPrimitive.Portal, { children: jsx(DropdownMenuPrimitive.Content, {
1430
+ className: cn("snap-menu", className),
1431
+ side,
1432
+ align,
1433
+ sideOffset,
1434
+ ...props,
1435
+ ...part("menu", "content"),
1436
+ children
1437
+ }) });
1438
+ }
1439
+ /** One menu action. */
1440
+ function MenuItem({ className, children, ...props }) {
1441
+ return jsx(DropdownMenuPrimitive.Item, {
1442
+ className: cn("snap-menu-item", className),
1443
+ ...props,
1444
+ ...part("menu", "item"),
1445
+ children
1446
+ });
1447
+ }
1448
+ /** A checkable menu action with an indicator slot. */
1449
+ function MenuCheckboxItem({ className, children, ...props }) {
1450
+ return jsxs(DropdownMenuPrimitive.CheckboxItem, {
1451
+ className: cn("snap-menu-item", className),
1452
+ ...props,
1453
+ ...part("menu", "checkbox-item"),
1454
+ children: [jsx(DropdownMenuPrimitive.ItemIndicator, {
1455
+ ...part("menu", "item-indicator"),
1456
+ className: "snap-menu-indicator",
1457
+ children: "✓"
1458
+ }), children]
1459
+ });
1460
+ }
1461
+ /** A non-interactive group heading. */
1462
+ function MenuLabel({ className, children, ...props }) {
1463
+ return jsx(DropdownMenuPrimitive.Label, {
1464
+ className: cn("snap-menu-label", className),
1465
+ ...props,
1466
+ ...part("menu", "label"),
1467
+ children
1468
+ });
1469
+ }
1470
+ /** A group container for items. */
1471
+ function MenuGroup(props) {
1472
+ return jsx(DropdownMenuPrimitive.Group, { ...props });
1473
+ }
1474
+ /** A horizontal rule between menu sections. */
1475
+ function MenuSeparator({ className, ...props }) {
1476
+ return jsx(DropdownMenuPrimitive.Separator, {
1477
+ className: cn("snap-menu-separator", className),
1478
+ ...props,
1479
+ ...part("menu", "separator")
1480
+ });
1481
+ }
1482
+ /** Stroke glyphs per intent (lucide-style 24-box, `currentColor`); the skin
1483
+ * colours them through the toast's `[data-icon]`. */
1484
+ const TOAST_INTENT_PATHS = {
1485
+ neutral: jsxs(Fragment, { children: [
1486
+ jsx("circle", {
1487
+ cx: "12",
1488
+ cy: "12",
1489
+ r: "10"
1490
+ }),
1491
+ jsx("path", { d: "M12 16v-4" }),
1492
+ jsx("path", { d: "M12 8h.01" })
1493
+ ] }),
1494
+ primary: jsxs(Fragment, { children: [
1495
+ jsx("circle", {
1496
+ cx: "12",
1497
+ cy: "12",
1498
+ r: "10"
1499
+ }),
1500
+ jsx("path", { d: "M12 16v-4" }),
1501
+ jsx("path", { d: "M12 8h.01" })
1502
+ ] }),
1503
+ success: jsxs(Fragment, { children: [jsx("circle", {
1504
+ cx: "12",
1505
+ cy: "12",
1506
+ r: "10"
1507
+ }), jsx("path", { d: "m9 12 2 2 4-4" })] }),
1508
+ warning: jsxs(Fragment, { children: [
1509
+ jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
1510
+ jsx("path", { d: "M12 9v4" }),
1511
+ jsx("path", { d: "M12 17h.01" })
1512
+ ] }),
1513
+ danger: jsxs(Fragment, { children: [
1514
+ jsx("circle", {
1515
+ cx: "12",
1516
+ cy: "12",
1517
+ r: "10"
1518
+ }),
1519
+ jsx("path", { d: "m15 9-6 6" }),
1520
+ jsx("path", { d: "m9 9 6 6" })
1521
+ ] })
1522
+ };
1523
+ function toastIcon(intent) {
1524
+ return jsx("svg", {
1525
+ viewBox: "0 0 24 24",
1526
+ fill: "none",
1527
+ stroke: "currentColor",
1528
+ strokeWidth: 2,
1529
+ strokeLinecap: "round",
1530
+ strokeLinejoin: "round",
1531
+ "aria-hidden": "true",
1532
+ children: TOAST_INTENT_PATHS[intent]
1533
+ });
1534
+ }
1535
+ /** Enqueue a toast on the runtime-mounted {@link Toaster}s. Backed by Sonner
1536
+ * (the Radix toast primitive is deprecated upstream): `success`/`warning`/
1537
+ * `danger` map to the typed emitters, `neutral`/`primary` ride the plain one,
1538
+ * and every toast carries an `snap-intent-*` class the skins target. */
1539
+ function toast(entry) {
1540
+ const intent = entry.intent ?? "neutral";
1541
+ const options = {
1542
+ description: entry.description,
1543
+ icon: toastIcon(intent),
1544
+ duration: entry.duration === 0 ? Number.POSITIVE_INFINITY : entry.duration ?? 5e3,
1545
+ className: `snap-intent-${intent}`
1546
+ };
1547
+ switch (intent) {
1548
+ case "success": return toast$1.success(entry.title, options);
1549
+ case "warning": return toast$1.warning(entry.title, options);
1550
+ case "danger": return toast$1.error(entry.title, options);
1551
+ default: return toast$1(entry.title, options);
1552
+ }
1553
+ }
1554
+ /** Dismiss a queued toast by id. */
1555
+ function dismissToast(id) {
1556
+ toast$1.dismiss(id);
1557
+ }
1558
+ /** The runtime-mounted viewport: renders the shared toast queue. Pages never
1559
+ * mount this themselves — the runtime provides one per surface root. */
1560
+ function Toaster() {
1561
+ return jsx(Toaster$1, {
1562
+ position: "bottom-right",
1563
+ closeButton: true
1564
+ });
1565
+ }
1566
+ //#endregion
1567
+ //#region lib/types/components/combobox.js
1568
+ /**
1569
+ * A text field with an anchored suggestion list: search pickers, filtered
1570
+ * choosers, async candidate feeds (operator lookups, assignee search). The
1571
+ * focus never leaves the field — keyboard navigation rides
1572
+ * `aria-activedescendant`, pointer picks suppress the field's blur, and the
1573
+ * panel opens without taking the focus — so typing keeps working through
1574
+ * open, navigate, and select. The field is a regular {@link Input}; skins
1575
+ * style the `combobox.*` parts around it.
1576
+ *
1577
+ * @module @snap-rail/ui/components/combobox
1578
+ */
1579
+ /** The text an option contributes to filtering and to the field once picked. */
1580
+ function textOf(option) {
1581
+ return typeof option.label === "string" || typeof option.label === "number" ? String(option.label) : option.value;
1582
+ }
1583
+ /** The next enabled row index from `from`, wrapping; -1 when none is enabled. */
1584
+ function nextEnabled(rows, from, step) {
1585
+ if (rows.length === 0) return -1;
1586
+ let index = from < 0 ? step > 0 ? -1 : 0 : from;
1587
+ for (let tries = 0; tries < rows.length; tries++) {
1588
+ index = (index + step + rows.length) % rows.length;
1589
+ if (rows[index]?.disabled !== true) return index;
1590
+ }
1591
+ return -1;
1592
+ }
1593
+ /** A field with an anchored, keyboard-navigable suggestion list. */
1594
+ function Combobox({ value, defaultValue, onValueChange, onInputValueChange, options, placeholder, disabled = false, invalid = false, size = "md", loading = false, emptyText = "无匹配项", id, className, contentClassName, "aria-label": ariaLabel }) {
1595
+ const listId = useId();
1596
+ const anchorRef = useRef(null);
1597
+ const [uncontrolled, setUncontrolled] = useState(defaultValue);
1598
+ const current = value !== void 0 ? value : uncontrolled;
1599
+ const selected = options.find((option) => option.value === current);
1600
+ const selectedText = selected !== void 0 ? textOf(selected) : void 0;
1601
+ const [text, setText] = useState(selectedText ?? "");
1602
+ const [open, setOpen] = useState(false);
1603
+ const [active, setActive] = useState(-1);
1604
+ useEffect(() => {
1605
+ if (selectedText !== void 0) setText(selectedText);
1606
+ }, [selectedText]);
1607
+ const query = text.trim().toLowerCase();
1608
+ const rows = onInputValueChange !== void 0 || query === "" || text === selectedText ? options : options.filter((option) => textOf(option).toLowerCase().includes(query));
1609
+ const optionId = (index) => `${listId}-${index}`;
1610
+ useEffect(() => {
1611
+ if (active < 0) return;
1612
+ document.getElementById(optionId(active))?.scrollIntoView?.({ block: "nearest" });
1613
+ });
1614
+ const close = () => {
1615
+ setOpen(false);
1616
+ setActive(-1);
1617
+ };
1618
+ const choose = (option) => {
1619
+ if (option.disabled === true) return;
1620
+ if (value === void 0) setUncontrolled(option.value);
1621
+ setText(textOf(option));
1622
+ onValueChange?.(option.value);
1623
+ close();
1624
+ };
1625
+ const onKeyDown = (event) => {
1626
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
1627
+ event.preventDefault();
1628
+ if (!open) {
1629
+ setOpen(true);
1630
+ return;
1631
+ }
1632
+ setActive((index) => nextEnabled(rows, index, event.key === "ArrowDown" ? 1 : -1));
1633
+ return;
1634
+ }
1635
+ if (event.key === "Enter" && open && active >= 0) {
1636
+ const option = rows[active];
1637
+ if (option !== void 0) {
1638
+ event.preventDefault();
1639
+ choose(option);
1640
+ }
1641
+ return;
1642
+ }
1643
+ if (event.key === "Escape" && open) {
1644
+ event.preventDefault();
1645
+ close();
1646
+ }
1647
+ };
1648
+ return jsx("span", {
1649
+ ...part("combobox", "root"),
1650
+ className: "snap-combobox",
1651
+ children: jsxs(Popover, {
1652
+ open: open && !disabled,
1653
+ onOpenChange: (next) => {
1654
+ if (!next) close();
1655
+ },
1656
+ children: [jsx(PopoverAnchor, {
1657
+ asChild: true,
1658
+ children: jsx("span", {
1659
+ ref: anchorRef,
1660
+ ...part("combobox", "anchor"),
1661
+ children: jsx(Input, {
1662
+ id,
1663
+ size,
1664
+ invalid,
1665
+ disabled,
1666
+ placeholder,
1667
+ className,
1668
+ value: text,
1669
+ role: "combobox",
1670
+ autoComplete: "off",
1671
+ "aria-label": ariaLabel,
1672
+ "aria-expanded": open,
1673
+ "aria-controls": listId,
1674
+ "aria-autocomplete": "list",
1675
+ "aria-activedescendant": open && active >= 0 ? optionId(active) : void 0,
1676
+ onChange: (event) => {
1677
+ setText(event.target.value);
1678
+ setActive(-1);
1679
+ setOpen(true);
1680
+ onInputValueChange?.(event.target.value);
1681
+ },
1682
+ onFocus: () => setOpen(true),
1683
+ onBlur: close,
1684
+ onKeyDown
1685
+ })
1686
+ })
1687
+ }), jsx(PopoverContent, {
1688
+ align: "start",
1689
+ sideOffset: 4,
1690
+ autoFocusOnOpen: false,
1691
+ className: contentClassName,
1692
+ onInteractOutside: (event) => {
1693
+ if (anchorRef.current?.contains(event.target) === true) event.preventDefault();
1694
+ },
1695
+ children: jsxs("div", {
1696
+ ...part("combobox", "list"),
1697
+ role: "listbox",
1698
+ id: listId,
1699
+ children: [
1700
+ rows.map((option, index) => jsx("div", {
1701
+ ...part("combobox", "option"),
1702
+ id: optionId(index),
1703
+ role: "option",
1704
+ "aria-selected": option.value === current,
1705
+ "aria-disabled": option.disabled === true || void 0,
1706
+ "data-active": index === active || void 0,
1707
+ "data-disabled": option.disabled === true || void 0,
1708
+ onMouseDown: (event) => event.preventDefault(),
1709
+ onClick: () => choose(option),
1710
+ children: option.label
1711
+ }, option.value)),
1712
+ loading && jsx("div", {
1713
+ ...part("combobox", "empty"),
1714
+ children: "搜索中…"
1715
+ }),
1716
+ !loading && rows.length === 0 && jsx("div", {
1717
+ ...part("combobox", "empty"),
1718
+ children: emptyText
1719
+ })
1720
+ ]
1721
+ })
1722
+ })]
1723
+ })
1724
+ });
1725
+ }
1726
+ //#endregion
1727
+ //#region lib/types/components/dialog.js
1728
+ /**
1729
+ * Dialog/sheet semantics over Radix's focus trap and portal. The skin chooses
1730
+ * the presentation (modal, sheet, fullscreen) through the `presentation`
1731
+ * attribute; the core owns dismissal and focus behaviour.
1732
+ *
1733
+ * @module @snap-rail/ui/components/dialog
1734
+ */
1735
+ /** The dialog root. */
1736
+ const Dialog = DialogPrimitive.Root;
1737
+ /** The dialog trigger. */
1738
+ const DialogTrigger = DialogPrimitive.Trigger;
1739
+ /** The dialog close. */
1740
+ const DialogClose = DialogPrimitive.Close;
1741
+ /** The portalled dialog content. */
1742
+ function DialogContent({ children, className, presentation = "auto", size = "md", showClose = true, ...rest }) {
1743
+ const resolved = presentation === "auto" ? "modal" : presentation;
1744
+ return jsxs(DialogPrimitive.Portal, { children: [jsx(DialogPrimitive.Overlay, {
1745
+ ...part("dialog", "overlay"),
1746
+ className: "snap-dialog-overlay"
1747
+ }), jsxs(DialogPrimitive.Content, {
1748
+ className: cn("snap-dialog-panel", className),
1749
+ "data-presentation": resolved,
1750
+ "data-size": size,
1751
+ ...rest,
1752
+ ...part("dialog", "panel"),
1753
+ children: [children, showClose && jsx(DialogPrimitive.Close, {
1754
+ ...part("dialog", "close"),
1755
+ className: "snap-dialog-close",
1756
+ "aria-label": "关闭",
1757
+ children: "×"
1758
+ })]
1759
+ })] });
1760
+ }
1761
+ /** The dialog header. */
1762
+ function DialogHeader({ children, className }) {
1763
+ return jsx("div", {
1764
+ ...part("dialog", "header"),
1765
+ className: cn("snap-dialog-header", className),
1766
+ children
1767
+ });
1768
+ }
1769
+ /** The dialog title. */
1770
+ function DialogTitle({ children, className }) {
1771
+ return jsx(DialogPrimitive.Title, {
1772
+ ...part("dialog", "title"),
1773
+ className: cn("snap-dialog-title", className),
1774
+ children
1775
+ });
1776
+ }
1777
+ /** The dialog description. */
1778
+ function DialogDescription({ children, className }) {
1779
+ return jsx(DialogPrimitive.Description, {
1780
+ ...part("dialog", "description"),
1781
+ className: cn("snap-dialog-description", className),
1782
+ children
1783
+ });
1784
+ }
1785
+ /** The dialog body. */
1786
+ function DialogBody({ children, className }) {
1787
+ return jsx("div", {
1788
+ ...part("dialog", "body"),
1789
+ className: cn("snap-dialog-body", className),
1790
+ children
1791
+ });
1792
+ }
1793
+ /** The dialog footer. */
1794
+ function DialogFooter({ children, className }) {
1795
+ return jsx("div", {
1796
+ ...part("dialog", "footer"),
1797
+ className: cn("snap-dialog-footer", className),
1798
+ children
1799
+ });
1800
+ }
1801
+ /** A sheet is a dialog with the `sheet` presentation by default. */
1802
+ function Sheet(props) {
1803
+ return jsx(DialogContent, {
1282
1804
  ...props,
1805
+ presentation: props.presentation ?? "sheet"
1806
+ });
1807
+ }
1808
+ //#endregion
1809
+ //#region lib/types/components/controls.js
1810
+ /**
1811
+ * Selection and toggle semantics over Radix: tabs, select, switch, checkbox,
1812
+ * and radio groups. All behaviour/keyboard handling stays here; skins target
1813
+ * the stable parts and state attributes.
1814
+ *
1815
+ * @module @snap-rail/ui/components/controls
1816
+ */
1817
+ /** A form label. */
1818
+ function Label({ className, children, ...props }) {
1819
+ return jsx(LabelPrimitive.Root, {
1820
+ className: cn("snap-label", className),
1821
+ ...props,
1822
+ children
1823
+ });
1824
+ }
1825
+ /** The tabs root. */
1826
+ function Tabs({ className, children, ...props }) {
1827
+ return jsx(TabsPrimitive.Root, {
1828
+ className: cn("snap-tabs", className),
1829
+ ...props,
1830
+ ...part("tabs", "root"),
1831
+ children
1832
+ });
1833
+ }
1834
+ /** The tabs list. */
1835
+ function TabsList({ className, children, ...props }) {
1836
+ return jsx(TabsPrimitive.List, {
1837
+ className: cn("snap-tabs-list", className),
1838
+ ...props,
1839
+ ...part("tabs", "list"),
1283
1840
  children
1284
1841
  });
1285
1842
  }
1286
1843
  /** A tab trigger. */
1287
1844
  function TabsTrigger({ className, children, ...props }) {
1288
1845
  return jsx(TabsPrimitive.Trigger, {
1289
- ...part("tabs", "trigger"),
1290
1846
  className: cn("snap-tabs-trigger", className),
1291
1847
  ...props,
1848
+ ...part("tabs", "trigger"),
1292
1849
  children
1293
1850
  });
1294
1851
  }
1295
1852
  /** A tab panel. */
1296
1853
  function TabsContent({ className, children, ...props }) {
1297
1854
  return jsx(TabsPrimitive.Content, {
1298
- ...part("tabs", "content"),
1299
1855
  className: cn("snap-tabs-content", className),
1300
1856
  ...props,
1857
+ ...part("tabs", "content"),
1301
1858
  children
1302
1859
  });
1303
1860
  }
@@ -1312,9 +1869,9 @@ function Switch({ className, label, labelPosition = "end", description, containe
1312
1869
  children: [
1313
1870
  labelPosition === "start" && labelNode,
1314
1871
  jsx(SwitchPrimitive.Root, {
1315
- ...part("switch", "root"),
1316
1872
  className: cn("snap-switch", className),
1317
1873
  ...props,
1874
+ ...part("switch", "root"),
1318
1875
  children: jsx(SwitchPrimitive.Thumb, {
1319
1876
  ...part("switch", "thumb"),
1320
1877
  className: "snap-switch-thumb"
@@ -1345,9 +1902,9 @@ function Checkbox({ className, label, labelPosition = "end", description, contai
1345
1902
  children: [
1346
1903
  labelPosition === "start" && labelNode,
1347
1904
  jsx(CheckboxPrimitive.Root, {
1348
- ...part("checkbox", "root"),
1349
1905
  className: cn("snap-checkbox", className),
1350
1906
  ...props,
1907
+ ...part("checkbox", "root"),
1351
1908
  children: jsx(CheckboxPrimitive.Indicator, {
1352
1909
  ...part("checkbox", "indicator"),
1353
1910
  className: "snap-checkbox-indicator",
@@ -1372,10 +1929,10 @@ function Checkbox({ className, label, labelPosition = "end", description, contai
1372
1929
  function RadioGroup({ className, label, description, children, ...props }) {
1373
1930
  const labelId = useId();
1374
1931
  const group = jsx(RadioGroupPrimitive.Root, {
1375
- ...part("radio-group", "root"),
1376
1932
  className: cn("snap-radio-group", className),
1377
1933
  ...label !== void 0 ? { "aria-labelledby": labelId } : {},
1378
1934
  ...props,
1935
+ ...part("radio-group", "root"),
1379
1936
  children
1380
1937
  });
1381
1938
  if (label === void 0 && description === void 0) return group;
@@ -1400,9 +1957,9 @@ function RadioGroup({ className, label, description, children, ...props }) {
1400
1957
  /** One radio item. */
1401
1958
  function RadioGroupItem({ className, ...props }) {
1402
1959
  return jsx(RadioGroupPrimitive.Item, {
1403
- ...part("radio-group", "item"),
1404
1960
  className: cn("snap-radio-item", className),
1405
1961
  ...props,
1962
+ ...part("radio-group", "item"),
1406
1963
  children: jsx(RadioGroupPrimitive.Indicator, {
1407
1964
  ...part("radio-group", "indicator"),
1408
1965
  className: "snap-radio-indicator"
@@ -1416,58 +1973,63 @@ function TouchSelect({ value, onValueChange, options, placeholder = "请选择",
1416
1973
  return jsxs("span", {
1417
1974
  ...part("touch-select", "root"),
1418
1975
  className: "snap-touch-select",
1419
- children: [jsxs(Button, {
1420
- type: "button",
1421
- size,
1422
- emphasis: "outline",
1423
- className,
1424
- disabled,
1425
- "aria-label": ariaLabel,
1426
- "aria-invalid": invalid || void 0,
1427
- "aria-haspopup": "dialog",
1428
- onClick: () => setOpen(true),
1976
+ children: [jsx("span", {
1429
1977
  ...part("touch-select", "trigger"),
1430
- children: [jsx("span", {
1431
- style: {
1432
- flex: 1,
1433
- textAlign: "left"
1434
- },
1435
- children: selected?.label ?? placeholder
1436
- }), jsx("span", {
1437
- "aria-hidden": "true",
1438
- children: "▾"
1439
- })]
1978
+ className: "snap-touch-select-trigger",
1979
+ children: jsxs(Button, {
1980
+ type: "button",
1981
+ size,
1982
+ emphasis: "outline",
1983
+ className,
1984
+ disabled,
1985
+ "aria-label": ariaLabel,
1986
+ "aria-invalid": invalid || void 0,
1987
+ "aria-haspopup": "dialog",
1988
+ onClick: () => setOpen(true),
1989
+ children: [jsx("span", {
1990
+ style: {
1991
+ flex: 1,
1992
+ textAlign: "left"
1993
+ },
1994
+ children: selected?.label ?? placeholder
1995
+ }), jsx("span", {
1996
+ "aria-hidden": "true",
1997
+ children: "▾"
1998
+ })]
1999
+ })
1440
2000
  }), jsx(Dialog, {
1441
2001
  open,
1442
2002
  onOpenChange: setOpen,
1443
- children: jsxs(DialogContent, {
2003
+ children: jsx(DialogContent, {
1444
2004
  presentation: "modal",
1445
2005
  size: "sm",
1446
- ...part("touch-select", "sheet"),
1447
- children: [jsx(DialogHeader, { children: jsx(DialogTitle, { children: title ?? ariaLabel ?? "请选择" }) }), jsxs("div", {
1448
- ...part("touch-select", "options"),
1449
- style: {
1450
- display: "flex",
1451
- flexDirection: "column",
1452
- gap: "var(--snap-space-sm)"
1453
- },
1454
- children: [options.map((option) => jsx(Button, {
1455
- type: "button",
1456
- size: "lg",
1457
- emphasis: option.value === value ? "solid" : "outline",
1458
- intent: option.value === value ? "primary" : "neutral",
1459
- disabled: option.disabled === true,
1460
- onClick: () => {
1461
- onValueChange?.(option.value);
1462
- setOpen(false);
2006
+ children: jsxs("div", {
2007
+ ...part("touch-select", "sheet"),
2008
+ className: "snap-touch-select-sheet",
2009
+ children: [jsx(DialogHeader, { children: jsx(DialogTitle, { children: title ?? ariaLabel ?? "请选择" }) }), jsxs("div", {
2010
+ ...part("touch-select", "options"),
2011
+ style: {
2012
+ display: "flex",
2013
+ flexDirection: "column",
2014
+ gap: "var(--snap-space-sm)"
1463
2015
  },
1464
- ...part("touch-select", "option"),
1465
- children: option.label
1466
- }, option.value)), options.length === 0 && jsx("span", {
1467
- style: { color: "var(--snap-color-muted)" },
1468
- children: "无可选项"
2016
+ children: [options.map((option) => jsx(Button, {
2017
+ type: "button",
2018
+ size: "lg",
2019
+ emphasis: option.value === value ? "solid" : "outline",
2020
+ intent: option.value === value ? "primary" : "neutral",
2021
+ disabled: option.disabled === true,
2022
+ onClick: () => {
2023
+ onValueChange?.(option.value);
2024
+ setOpen(false);
2025
+ },
2026
+ children: option.label
2027
+ }, option.value)), options.length === 0 && jsx("span", {
2028
+ style: { color: "var(--snap-color-muted)" },
2029
+ children: "无可选项"
2030
+ })]
1469
2031
  })]
1470
- })]
2032
+ })
1471
2033
  })
1472
2034
  })]
1473
2035
  });
@@ -1475,13 +2037,13 @@ function TouchSelect({ value, onValueChange, options, placeholder = "请选择",
1475
2037
  /** The select trigger; composes a {@link SelectValue} inside. */
1476
2038
  function SelectTrigger({ className, size = "md", invalid = false, disabled = false, children, ...props }) {
1477
2039
  return jsxs(SelectPrimitive.Trigger, {
1478
- ...part("select", "trigger"),
1479
2040
  className: cn("snap-select-trigger", className),
1480
2041
  "data-size": size,
1481
2042
  "data-invalid": invalid || void 0,
1482
2043
  "data-disabled": disabled || void 0,
1483
2044
  "aria-invalid": invalid || void 0,
1484
2045
  ...props,
2046
+ ...part("select", "trigger"),
1485
2047
  children: [children, jsx(SelectPrimitive.Icon, {
1486
2048
  ...part("select", "chevron"),
1487
2049
  className: "snap-select-chevron",
@@ -1492,29 +2054,29 @@ function SelectTrigger({ className, size = "md", invalid = false, disabled = fal
1492
2054
  /** The selected-value slot of a trigger. */
1493
2055
  function SelectValue(props) {
1494
2056
  return jsx(SelectPrimitive.Value, {
1495
- ...part("select", "value"),
1496
- ...props
2057
+ ...props,
2058
+ ...part("select", "value")
1497
2059
  });
1498
2060
  }
1499
2061
  /** The portalled option list. */
1500
2062
  function SelectContent({ side = "bottom", align = "start", sideOffset = 4, className, children, ...props }) {
1501
2063
  return jsx(SelectPrimitive.Portal, { children: jsx(SelectPrimitive.Content, {
1502
- ...part("select", "content"),
1503
2064
  className: cn("snap-select-content", className),
1504
2065
  position: "popper",
1505
2066
  side,
1506
2067
  align,
1507
2068
  sideOffset,
1508
2069
  ...props,
2070
+ ...part("select", "content"),
1509
2071
  children: jsx(SelectPrimitive.Viewport, { children })
1510
2072
  }) });
1511
2073
  }
1512
2074
  /** One option row. */
1513
2075
  function SelectItem({ className, children, ...props }) {
1514
2076
  return jsxs(SelectPrimitive.Item, {
1515
- ...part("select", "item"),
1516
2077
  className: cn("snap-select-item", className),
1517
2078
  ...props,
2079
+ ...part("select", "item"),
1518
2080
  children: [jsx(SelectPrimitive.ItemText, { children }), jsx(SelectPrimitive.ItemIndicator, {
1519
2081
  ...part("select", "item-indicator"),
1520
2082
  className: "snap-select-item-indicator",
@@ -1815,150 +2377,24 @@ function FormControl({ children }) {
1815
2377
  function FormDescription({ className, children }) {
1816
2378
  const { id } = useFormField();
1817
2379
  return jsx("div", {
1818
- ...part("field", "help"),
1819
- id: `${id}-description`,
1820
- className: cn("snap-field-help", className),
1821
- children
1822
- });
1823
- }
1824
- /** The validation message for the bound field. */
1825
- function FormMessage({ message, children, className }) {
1826
- const { id, name } = useFormField();
1827
- const raw = useFormState$1({ name }).errors[name]?.message;
1828
- const body = message ?? (typeof raw === "string" || typeof raw === "number" || typeof raw === "bigint" || typeof raw === "boolean" ? String(raw) : void 0) ?? children;
1829
- if (body === void 0 || body === "") return null;
1830
- return jsx("div", {
1831
- ...part("field", "error"),
1832
- id: `${id}-message`,
1833
- className: cn("snap-field-error", className),
1834
- role: "alert",
1835
- children: body
1836
- });
1837
- }
1838
- //#endregion
1839
- //#region lib/types/components/input.js
1840
- /**
1841
- * Text-entry semantics: the wrapper owns the anatomy (prefix/suffix/clear),
1842
- * the native field keeps keyboard and IME behaviour. Skins style the parts.
1843
- *
1844
- * @module @snap-rail/ui/components/input
1845
- */
1846
- /** A single-line text field with semantic prefix/suffix slots. Layout
1847
- * `style`/`className` dress the wrapper — the visible control; the native
1848
- * field already stretches inside it. */
1849
- function Input({ size = "md", invalid = false, prefix, suffix, onClear, fieldClassName, componentName = "input", className, style, disabled, ...props }) {
1850
- return jsxs("div", {
1851
- ...part(componentName, "root"),
1852
- className: cn("snap-input", className),
1853
- style,
1854
- "data-size": size,
1855
- "data-invalid": invalid || void 0,
1856
- "data-disabled": disabled === true || void 0,
1857
- children: [
1858
- prefix !== void 0 && jsx("span", {
1859
- ...part(componentName, "prefix"),
1860
- children: prefix
1861
- }),
1862
- jsx("input", {
1863
- ...part(componentName, "field"),
1864
- className: cn("snap-input-field", fieldClassName),
1865
- disabled,
1866
- "aria-invalid": invalid || void 0,
1867
- ...props
1868
- }),
1869
- onClear !== void 0 && typeof props.value === "string" && props.value !== "" && jsx("button", {
1870
- ...part(componentName, "clear"),
1871
- type: "button",
1872
- className: "snap-input-clear",
1873
- "aria-label": "清除",
1874
- onClick: onClear,
1875
- children: "×"
1876
- }),
1877
- suffix !== void 0 && jsx("span", {
1878
- ...part(componentName, "suffix"),
1879
- children: suffix
1880
- })
1881
- ]
1882
- });
1883
- }
1884
- /** A multi-line text field. Like {@link Input}, layout `style`/`className`
1885
- * dress the wrapper; the field stretches inside it. */
1886
- function Textarea({ size = "md", invalid = false, fieldClassName, className, style, disabled, ...props }) {
1887
- return jsx("div", {
1888
- ...part("textarea", "root"),
1889
- className: cn("snap-textarea", className),
1890
- style,
1891
- "data-size": size,
1892
- "data-invalid": invalid || void 0,
1893
- "data-disabled": disabled === true || void 0,
1894
- children: jsx("textarea", {
1895
- ...part("textarea", "field"),
1896
- className: cn("snap-textarea-field", fieldClassName),
1897
- disabled,
1898
- "aria-invalid": invalid || void 0,
1899
- ...props
1900
- })
2380
+ ...part("field", "help"),
2381
+ id: `${id}-description`,
2382
+ className: cn("snap-field-help", className),
2383
+ children
1901
2384
  });
1902
2385
  }
1903
- /** A numeric field with touch steppers: `step-up`/`step-down` commit through
1904
- * the normal `onChange` (a native input event on the field), clamped to
1905
- * `min`/`max`. */
1906
- function NumberInput({ min, max, step = 1, size = "md", invalid = false, fieldClassName, className, style, disabled, value, onChange, ...props }) {
1907
- const fieldRef = useRef(null);
1908
- const current = typeof value === "number" ? value : void 0;
1909
- const stepBy = (delta) => {
1910
- const field = fieldRef.current;
1911
- if (field === null || disabled === true) return;
1912
- const parsed = typeof value === "number" ? value : Number(field.value);
1913
- let next = (Number.isFinite(parsed) ? parsed : min ?? 0) + delta * step;
1914
- if (min !== void 0 && next < min) next = min;
1915
- if (max !== void 0 && next > max) next = max;
1916
- (Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set)?.call(field, String(next));
1917
- field.dispatchEvent(new Event("input", { bubbles: true }));
1918
- };
1919
- return jsxs("div", {
1920
- ...part("number-input", "root"),
1921
- className: cn("snap-input", "snap-number-input", className),
1922
- style,
1923
- "data-size": size,
1924
- "data-invalid": invalid || void 0,
1925
- "data-disabled": disabled === true || void 0,
1926
- children: [jsx("input", {
1927
- ref: fieldRef,
1928
- ...part("number-input", "field"),
1929
- className: cn("snap-input-field", fieldClassName),
1930
- type: "number",
1931
- inputMode: "decimal",
1932
- disabled,
1933
- "aria-invalid": invalid || void 0,
1934
- value,
1935
- onChange,
1936
- ...min !== void 0 ? { min } : {},
1937
- ...max !== void 0 ? { max } : {},
1938
- ...step !== void 0 ? { step } : {},
1939
- ...props
1940
- }), jsxs("span", {
1941
- className: "snap-number-input-steps",
1942
- children: [jsx("button", {
1943
- ...part("number-input", "step-up"),
1944
- type: "button",
1945
- tabIndex: -1,
1946
- className: "snap-number-input-step",
1947
- "aria-label": "增大",
1948
- disabled: disabled === true || current !== void 0 && max !== void 0 && current >= max,
1949
- onClick: () => stepBy(1),
1950
- children: "+"
1951
- }), jsx("button", {
1952
- ...part("number-input", "step-down"),
1953
- type: "button",
1954
- tabIndex: -1,
1955
- className: "snap-number-input-step",
1956
- "aria-label": "减小",
1957
- disabled: disabled === true || current !== void 0 && min !== void 0 && current <= min,
1958
- onClick: () => stepBy(-1),
1959
- children: "-"
1960
- })]
1961
- })]
2386
+ /** The validation message for the bound field. */
2387
+ function FormMessage({ message, children, className }) {
2388
+ const { id, name } = useFormField();
2389
+ const raw = useFormState$1({ name }).errors[name]?.message;
2390
+ const body = message ?? (typeof raw === "string" || typeof raw === "number" || typeof raw === "bigint" || typeof raw === "boolean" ? String(raw) : void 0) ?? children;
2391
+ if (body === void 0 || body === "") return null;
2392
+ return jsx("div", {
2393
+ ...part("field", "error"),
2394
+ id: `${id}-message`,
2395
+ className: cn("snap-field-error", className),
2396
+ role: "alert",
2397
+ children: body
1962
2398
  });
1963
2399
  }
1964
2400
  //#endregion
@@ -2364,234 +2800,6 @@ function DragScroll({ direction = "vertical", className, style, children }) {
2364
2800
  });
2365
2801
  }
2366
2802
  //#endregion
2367
- //#region lib/types/components/overlay.js
2368
- /**
2369
- * Overlay semantics over Radix: tooltips, popovers, dropdown menus, and
2370
- * toasts. Behaviour/keyboard/focus handling stays here; skins target the
2371
- * stable parts (`tooltip.*`, `popover.*`, `menu.*`, `toast.*`) and state
2372
- * attributes. The imperative toast() helper pairs with the <Toaster/> the
2373
- * runtime mounts in every surface root.
2374
- *
2375
- * @module @snap-rail/ui/components/overlay
2376
- */
2377
- /** The tooltip root; wraps `TooltipTrigger`/`TooltipContent` and owns delay. */
2378
- function Tooltip({ delayDuration, ...props }) {
2379
- return jsx(TooltipPrimitive.Root, {
2380
- ...props,
2381
- delayDuration: delayDuration ?? 300
2382
- });
2383
- }
2384
- /** The tooltip provider; the runtime mounts one, pages only need it standalone. */
2385
- function TooltipProvider(props) {
2386
- return jsx(TooltipPrimitive.Provider, { ...props });
2387
- }
2388
- /** The tooltip trigger; wraps its child and anchors the bubble. */
2389
- function TooltipTrigger(props) {
2390
- return jsx(TooltipPrimitive.Trigger, {
2391
- ...part("tooltip", "trigger"),
2392
- ...props
2393
- });
2394
- }
2395
- /** The portalled tooltip bubble. */
2396
- function TooltipContent({ side = "top", sideOffset = 6, className, children, ...props }) {
2397
- return jsx(TooltipPrimitive.Portal, { children: jsx(TooltipPrimitive.Content, {
2398
- ...part("tooltip", "content"),
2399
- className: cn("snap-tooltip", className),
2400
- side,
2401
- sideOffset,
2402
- ...props,
2403
- children
2404
- }) });
2405
- }
2406
- /** The popover root. */
2407
- const Popover = PopoverPrimitive.Root;
2408
- /** The popover trigger; wraps its child and toggles the panel. */
2409
- function PopoverTrigger(props) {
2410
- return jsx(PopoverPrimitive.Trigger, {
2411
- ...part("popover", "trigger"),
2412
- ...props
2413
- });
2414
- }
2415
- /** An element the panel positions against without toggling it. */
2416
- const PopoverAnchor = PopoverPrimitive.Anchor;
2417
- /** Closes the popover from inside the panel. */
2418
- function PopoverClose(props) {
2419
- return jsx(PopoverPrimitive.Close, { ...props });
2420
- }
2421
- /** The portalled popover panel. */
2422
- function PopoverContent({ side = "bottom", align = "center", sideOffset = 6, className, children, ...props }) {
2423
- return jsx(PopoverPrimitive.Portal, { children: jsx(PopoverPrimitive.Content, {
2424
- ...part("popover", "content"),
2425
- className: cn("snap-popover", className),
2426
- side,
2427
- align,
2428
- sideOffset,
2429
- ...props,
2430
- children
2431
- }) });
2432
- }
2433
- /** The dropdown menu root. */
2434
- const Menu = DropdownMenuPrimitive.Root;
2435
- /** The menu trigger; wraps its child and toggles the dropdown. */
2436
- function MenuTrigger(props) {
2437
- return jsx(DropdownMenuPrimitive.Trigger, {
2438
- ...part("menu", "trigger"),
2439
- ...props
2440
- });
2441
- }
2442
- /** The portalled dropdown list. */
2443
- function MenuContent({ side = "bottom", align = "start", sideOffset = 4, className, children, ...props }) {
2444
- return jsx(DropdownMenuPrimitive.Portal, { children: jsx(DropdownMenuPrimitive.Content, {
2445
- ...part("menu", "content"),
2446
- className: cn("snap-menu", className),
2447
- side,
2448
- align,
2449
- sideOffset,
2450
- ...props,
2451
- children
2452
- }) });
2453
- }
2454
- /** One menu action. */
2455
- function MenuItem({ className, children, ...props }) {
2456
- return jsx(DropdownMenuPrimitive.Item, {
2457
- ...part("menu", "item"),
2458
- className: cn("snap-menu-item", className),
2459
- ...props,
2460
- children
2461
- });
2462
- }
2463
- /** A checkable menu action with an indicator slot. */
2464
- function MenuCheckboxItem({ className, children, ...props }) {
2465
- return jsxs(DropdownMenuPrimitive.CheckboxItem, {
2466
- ...part("menu", "checkbox-item"),
2467
- className: cn("snap-menu-item", className),
2468
- ...props,
2469
- children: [jsx(DropdownMenuPrimitive.ItemIndicator, {
2470
- ...part("menu", "item-indicator"),
2471
- className: "snap-menu-indicator",
2472
- children: "✓"
2473
- }), children]
2474
- });
2475
- }
2476
- /** A non-interactive group heading. */
2477
- function MenuLabel({ className, children, ...props }) {
2478
- return jsx(DropdownMenuPrimitive.Label, {
2479
- className: cn("snap-menu-label", className),
2480
- ...props,
2481
- children
2482
- });
2483
- }
2484
- /** A group container for items. */
2485
- function MenuGroup(props) {
2486
- return jsx(DropdownMenuPrimitive.Group, { ...props });
2487
- }
2488
- /** A horizontal rule between menu sections. */
2489
- function MenuSeparator({ className, ...props }) {
2490
- return jsx(DropdownMenuPrimitive.Separator, {
2491
- ...part("menu", "separator"),
2492
- className: cn("snap-menu-separator", className),
2493
- ...props
2494
- });
2495
- }
2496
- let toastNextId = 1;
2497
- let toastRecords = [];
2498
- const toastListeners = /* @__PURE__ */ new Set();
2499
- function toastEmit() {
2500
- for (const listener of toastListeners) listener();
2501
- }
2502
- function toastDismiss(id) {
2503
- toastRecords = toastRecords.filter((record) => record.id !== id);
2504
- toastEmit();
2505
- }
2506
- /** Enqueue a toast on the runtime-mounted {@link Toaster}s. */
2507
- function toast(entry) {
2508
- const id = toastNextId++;
2509
- toastRecords = [...toastRecords, {
2510
- ...entry,
2511
- id
2512
- }];
2513
- toastEmit();
2514
- return id;
2515
- }
2516
- /** Dismiss a queued toast by id. */
2517
- function dismissToast(id) {
2518
- toastDismiss(id);
2519
- }
2520
- /** The runtime-mounted viewport: renders the shared toast queue. Pages never
2521
- * mount this themselves — the runtime provides one per surface root. */
2522
- function Toaster(props) {
2523
- const records = useSyncExternalStore((onStoreChange) => {
2524
- toastListeners.add(onStoreChange);
2525
- return () => toastListeners.delete(onStoreChange);
2526
- }, () => toastRecords, () => toastRecords);
2527
- return jsxs(ToastPrimitive.Provider, {
2528
- ...props,
2529
- children: [records.map((record) => jsxs(ToastPrimitive.Root, {
2530
- ...part("toast", "root"),
2531
- className: "snap-toast",
2532
- "data-intent": record.intent ?? "neutral",
2533
- duration: record.duration ?? 5e3,
2534
- onOpenChange: (open) => {
2535
- if (!open) toastDismiss(record.id);
2536
- },
2537
- children: [
2538
- jsx(ToastTitle, { children: record.title }),
2539
- record.description !== void 0 && jsx(ToastDescription, { children: record.description }),
2540
- jsx(ToastClose, { "aria-label": "关闭" })
2541
- ]
2542
- }, record.id)), jsx(ToastViewport, {})]
2543
- });
2544
- }
2545
- /** The raw toast root for pages that manage their own open state. */
2546
- const Toast = ToastPrimitive.Root;
2547
- /** A toast title with its part tag. */
2548
- function ToastTitle({ className, children, ...props }) {
2549
- return jsx(ToastPrimitive.Title, {
2550
- ...part("toast", "title"),
2551
- className: cn("snap-toast-title", className),
2552
- ...props,
2553
- children
2554
- });
2555
- }
2556
- /** A toast description with its part tag. */
2557
- function ToastDescription({ className, children, ...props }) {
2558
- return jsx(ToastPrimitive.Description, {
2559
- ...part("toast", "description"),
2560
- className: cn("snap-toast-description", className),
2561
- ...props,
2562
- children
2563
- });
2564
- }
2565
- /** An interactive toast action (confirm/retry affordances). */
2566
- function ToastAction({ className, children, ...props }) {
2567
- return jsx(ToastPrimitive.Action, {
2568
- ...part("toast", "action"),
2569
- className: cn("snap-toast-action", className),
2570
- ...props,
2571
- children
2572
- });
2573
- }
2574
- /** A toast dismissal button. */
2575
- function ToastClose({ className, children, ...props }) {
2576
- return jsx(ToastPrimitive.Close, {
2577
- ...part("toast", "close"),
2578
- className: cn("snap-toast-close", className),
2579
- ...props,
2580
- children: children ?? jsx("span", {
2581
- "aria-hidden": "true",
2582
- children: "×"
2583
- })
2584
- });
2585
- }
2586
- /** The toast viewport; only the runtime's {@link Toaster} mounts one. */
2587
- function ToastViewport({ className, ...props }) {
2588
- return jsx(ToastPrimitive.Viewport, {
2589
- ...part("toast", "viewport"),
2590
- className: cn("snap-toast-viewport", className),
2591
- ...props
2592
- });
2593
- }
2594
- //#endregion
2595
2803
  //#region lib/types/components/schema-form.js
2596
2804
  /** The closed literal set a property may take: its `enum`, or — for a union of
2597
2805
  * scalar literals — the flattened `const` values of the `anyOf` branches, in
@@ -2733,10 +2941,10 @@ function schemaNodeOf(value) {
2733
2941
  /** A ranged control with a large touch target and keyboard stepping. */
2734
2942
  function Slider({ label, className, children, ...props }) {
2735
2943
  return jsxs(SliderPrimitive.Root, {
2736
- ...part("slider", "root"),
2737
2944
  className: cn("snap-slider", className),
2738
2945
  "aria-label": label,
2739
2946
  ...props,
2947
+ ...part("slider", "root"),
2740
2948
  children: [
2741
2949
  jsx(SliderPrimitive.Track, {
2742
2950
  ...part("slider", "track"),
@@ -2760,63 +2968,63 @@ function Slider({ label, className, children, ...props }) {
2760
2968
  /** A content card. */
2761
2969
  function Card({ className, children, ...props }) {
2762
2970
  return jsx("div", {
2763
- ...part("card", "root"),
2764
2971
  className: cn("snap-card", className),
2765
2972
  ...props,
2973
+ ...part("card", "root"),
2766
2974
  children
2767
2975
  });
2768
2976
  }
2769
2977
  /** The card header region. */
2770
2978
  function CardHeader({ className, children, ...props }) {
2771
2979
  return jsx("div", {
2772
- ...part("card", "header"),
2773
2980
  className: cn("snap-card-header", className),
2774
2981
  ...props,
2982
+ ...part("card", "header"),
2775
2983
  children
2776
2984
  });
2777
2985
  }
2778
2986
  /** The card title. */
2779
2987
  function CardTitle({ className, children, ...props }) {
2780
2988
  return jsx("div", {
2781
- ...part("card", "title"),
2782
2989
  className: cn("snap-card-title", className),
2783
2990
  ...props,
2991
+ ...part("card", "title"),
2784
2992
  children
2785
2993
  });
2786
2994
  }
2787
2995
  /** The card description. */
2788
2996
  function CardDescription({ className, children, ...props }) {
2789
2997
  return jsx("div", {
2790
- ...part("card", "description"),
2791
2998
  className: cn("snap-card-description", className),
2792
2999
  ...props,
3000
+ ...part("card", "description"),
2793
3001
  children
2794
3002
  });
2795
3003
  }
2796
3004
  /** The card body. */
2797
3005
  function CardContent({ className, children, ...props }) {
2798
3006
  return jsx("div", {
2799
- ...part("card", "body"),
2800
3007
  className: cn("snap-card-content", className),
2801
3008
  ...props,
3009
+ ...part("card", "body"),
2802
3010
  children
2803
3011
  });
2804
3012
  }
2805
3013
  /** The card footer. */
2806
3014
  function CardFooter({ className, children, ...props }) {
2807
3015
  return jsx("div", {
2808
- ...part("card", "footer"),
2809
3016
  className: cn("snap-card-footer", className),
2810
3017
  ...props,
3018
+ ...part("card", "footer"),
2811
3019
  children
2812
3020
  });
2813
3021
  }
2814
3022
  /** A bounded panel with optional header/footer. */
2815
3023
  function Panel({ title, actions, footer, className, children, ...props }) {
2816
3024
  return jsxs("div", {
2817
- ...part("panel", "root"),
2818
3025
  className: cn("snap-panel", className),
2819
3026
  ...props,
3027
+ ...part("panel", "root"),
2820
3028
  children: [
2821
3029
  (title !== void 0 || actions !== void 0) && jsxs("div", {
2822
3030
  ...part("panel", "header"),
@@ -2853,45 +3061,45 @@ function Table({ className, children, ...props }) {
2853
3061
  /** The table head. */
2854
3062
  function TableHeader({ className, children, ...props }) {
2855
3063
  return jsx("thead", {
2856
- ...part("table", "header"),
2857
3064
  className: cn("snap-table-header", className),
2858
3065
  ...props,
3066
+ ...part("table", "header"),
2859
3067
  children
2860
3068
  });
2861
3069
  }
2862
3070
  /** The table body. */
2863
3071
  function TableBody({ className, children, ...props }) {
2864
3072
  return jsx("tbody", {
2865
- ...part("table", "body"),
2866
3073
  className: cn("snap-table-body", className),
2867
3074
  ...props,
3075
+ ...part("table", "body"),
2868
3076
  children
2869
3077
  });
2870
3078
  }
2871
3079
  /** A table row. */
2872
3080
  function TableRow({ className, children, ...props }) {
2873
3081
  return jsx("tr", {
2874
- ...part("table", "row"),
2875
3082
  className: cn("snap-table-row", className),
2876
3083
  ...props,
3084
+ ...part("table", "row"),
2877
3085
  children
2878
3086
  });
2879
3087
  }
2880
3088
  /** A table header cell. */
2881
3089
  function TableHead({ className, children, ...props }) {
2882
3090
  return jsx("th", {
2883
- ...part("table", "head"),
2884
3091
  className: cn("snap-table-head", className),
2885
3092
  ...props,
3093
+ ...part("table", "head"),
2886
3094
  children
2887
3095
  });
2888
3096
  }
2889
3097
  /** A table body cell. */
2890
3098
  function TableCell({ className, children, ...props }) {
2891
3099
  return jsx("td", {
2892
- ...part("table", "cell"),
2893
3100
  className: cn("snap-table-cell", className),
2894
3101
  ...props,
3102
+ ...part("table", "cell"),
2895
3103
  children
2896
3104
  });
2897
3105
  }
@@ -5073,4 +5281,4 @@ async function createClientRuntime(handle, options) {
5073
5281
  };
5074
5282
  }
5075
5283
  //#endregion
5076
- export { Alert, AlertDescription, AlertTitle, AppShell, Badge, Button, CUSTOM_SLOT_PATTERN, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartFrame, Checkbox, ClientProvider, Controller, DEFAULT_DARK, DEFAULT_DARK_ID, DEFAULT_LIGHT, DEFAULT_LIGHT_ID, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DragScroll, EmptyState, Field, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormProvider, Grid, IconButton, Input, Label, Led, List, ListItem, Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuSeparator, MenuTrigger, NumberInput, Page, Panel, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, Row, SchemaForm, ScrollArea, Section, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, Separator, SettingsEntry, SettingsSurface, Sheet, Skeleton, SkinsProvider, Slider, Slot, Spinner, Split, Stack, Switch, Table, TableBody, TableCell, TableEmpty, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastTitle, ToastViewport, Toaster, Toolbar, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TouchSelect, UI_COMPONENTS, UI_DIAGNOSTIC_KINDS, UI_PROFILES, UI_SLOT_IDS, UI_SLOT_MODES, UiProvider, Visualization, attachBallDrag, attachDragPan, chartThemeOf, cn, controlHeight, createClientRuntime, dismissToast, fallbackPlugin, isValidSlotId, literalValuesOf, pagesPlugin, part, schemaNodeOf, settingsPageInfo, settingsPlugin, skinTokenVar, skinsPlugin, slotsPlugin, space, toast, useActiveLayout, useChartTheme, useClient, useController, useFieldArray, useForm, useFormContext, useFormState, usePagesVersion, useSkinId, useSkinTokens, useSkins, useUi, useUiVersion, useWatch, zodResolver };
5284
+ export { Alert, AlertDescription, AlertTitle, AppShell, Badge, Button, CUSTOM_SLOT_PATTERN, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartFrame, Checkbox, ClientProvider, Combobox, Controller, DEFAULT_DARK, DEFAULT_DARK_ID, DEFAULT_LIGHT, DEFAULT_LIGHT_ID, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DragScroll, EmptyState, Field, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormProvider, Grid, IconButton, Input, Label, Led, List, ListItem, Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuSeparator, MenuTrigger, NumberInput, Page, Panel, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, Row, SchemaForm, ScrollArea, Section, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, Separator, SettingsEntry, SettingsSurface, Sheet, Skeleton, SkinsProvider, Slider, Slot, Spinner, Split, Stack, Switch, Table, TableBody, TableCell, TableEmpty, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toolbar, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TouchSelect, UI_COMPONENTS, UI_DIAGNOSTIC_KINDS, UI_PROFILES, UI_SLOT_IDS, UI_SLOT_MODES, UiProvider, Visualization, attachBallDrag, attachDragPan, chartThemeOf, cn, controlHeight, createClientRuntime, dismissToast, fallbackPlugin, isValidSlotId, literalValuesOf, pagesPlugin, part, schemaNodeOf, settingsPageInfo, settingsPlugin, skinTokenVar, skinsPlugin, slotsPlugin, space, toast, useActiveLayout, useChartTheme, useClient, useController, useFieldArray, useForm, useFormContext, useFormState, usePagesVersion, useSkinId, useSkinTokens, useSkins, useUi, useUiVersion, useWatch, zodResolver };