@snap-rail/ui 0.2.0 → 0.3.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/charts.js +7 -1
- package/lib/components/index.js +2195 -0
- package/lib/contract.js +20 -1
- package/lib/fallback.js +14 -8
- package/lib/index.js +771 -539
- package/lib/runtime.js +142 -136
- package/lib/settings-pages/index.js +1326 -0
- package/lib/settings.js +64 -58
- package/lib/types/components/alert.js +7 -7
- package/lib/types/components/button.js +2 -2
- package/lib/types/components/combobox.d.ts +45 -0
- package/lib/types/components/combobox.js +108 -0
- package/lib/types/components/controls.js +16 -16
- package/lib/types/components/dialog.js +1 -1
- package/lib/types/components/index.d.ts +1 -0
- package/lib/types/components/index.js +1 -0
- package/lib/types/components/input.js +3 -3
- package/lib/types/components/overlay.d.ts +17 -2
- package/lib/types/components/overlay.js +65 -18
- package/lib/types/components/slider.js +1 -1
- package/lib/types/components/surface.js +12 -12
- package/lib/types/contract.d.ts +6 -1
- package/lib/types/contract.js +6 -1
- package/lib/types/utils.d.ts +7 -1
- package/lib/types/utils.js +7 -1
- package/package.json +7 -7
- package/src/styles/base.css +75 -3
- package/src/styles/default.css +10 -0
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 ToastPrimitive from "@radix-ui/react-toast";
|
|
8
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
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.
|
|
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",
|
|
@@ -619,7 +638,13 @@ const UI_COMPONENTS = {
|
|
|
619
638
|
function cn(...values) {
|
|
620
639
|
return values.filter((value) => typeof value === "string" && value.length > 0).join(" ");
|
|
621
640
|
}
|
|
622
|
-
/**
|
|
641
|
+
/**
|
|
642
|
+
* The anatomy attributes every semantic component renders. The identity is
|
|
643
|
+
* component-owned: components spread these AFTER caller props so a composite
|
|
644
|
+
* can never mask a host part (a masked `button.root` loses every skin rule
|
|
645
|
+
* and falls back to the UA default look). Composites tag their own wrappers
|
|
646
|
+
* instead of pushing `part()` into a child component's props.
|
|
647
|
+
*/
|
|
623
648
|
function part(component, name) {
|
|
624
649
|
return {
|
|
625
650
|
"data-snap-component": component,
|
|
@@ -982,58 +1007,58 @@ function useChartTheme() {
|
|
|
982
1007
|
/** An inline status banner for results and failures. */
|
|
983
1008
|
function Alert({ intent = "neutral", className, children, ...props }) {
|
|
984
1009
|
return jsx("div", {
|
|
985
|
-
...part("alert", "root"),
|
|
986
1010
|
role: "alert",
|
|
987
1011
|
className: cn("snap-alert", className),
|
|
988
1012
|
"data-intent": intent,
|
|
989
1013
|
...props,
|
|
1014
|
+
...part("alert", "root"),
|
|
990
1015
|
children
|
|
991
1016
|
});
|
|
992
1017
|
}
|
|
993
1018
|
/** The alert heading line. */
|
|
994
1019
|
function AlertTitle({ className, children, ...props }) {
|
|
995
1020
|
return jsx("h5", {
|
|
996
|
-
...part("alert", "title"),
|
|
997
1021
|
className: cn("snap-alert-title", className),
|
|
998
1022
|
...props,
|
|
1023
|
+
...part("alert", "title"),
|
|
999
1024
|
children
|
|
1000
1025
|
});
|
|
1001
1026
|
}
|
|
1002
1027
|
/** The alert body text. */
|
|
1003
1028
|
function AlertDescription({ className, children, ...props }) {
|
|
1004
1029
|
return jsx("div", {
|
|
1005
|
-
...part("alert", "description"),
|
|
1006
1030
|
className: cn("snap-alert-description", className),
|
|
1007
1031
|
...props,
|
|
1032
|
+
...part("alert", "description"),
|
|
1008
1033
|
children
|
|
1009
1034
|
});
|
|
1010
1035
|
}
|
|
1011
1036
|
/** A themed rule between sections. */
|
|
1012
1037
|
function Separator({ orientation = "horizontal", className, ...props }) {
|
|
1013
1038
|
return jsx(SeparatorPrimitive.Root, {
|
|
1014
|
-
...part("separator", "root"),
|
|
1015
1039
|
orientation,
|
|
1016
1040
|
className: cn("snap-separator", className),
|
|
1017
|
-
...props
|
|
1041
|
+
...props,
|
|
1042
|
+
...part("separator", "root")
|
|
1018
1043
|
});
|
|
1019
1044
|
}
|
|
1020
1045
|
/** A neutral loading placeholder shaped by the skin. */
|
|
1021
1046
|
function Skeleton({ variant = "block", className, ...props }) {
|
|
1022
1047
|
return jsx("div", {
|
|
1023
|
-
...part("skeleton", "root"),
|
|
1024
1048
|
className: cn("snap-skeleton", className),
|
|
1025
1049
|
"data-variant": variant,
|
|
1026
1050
|
"aria-hidden": "true",
|
|
1027
|
-
...props
|
|
1051
|
+
...props,
|
|
1052
|
+
...part("skeleton", "root")
|
|
1028
1053
|
});
|
|
1029
1054
|
}
|
|
1030
1055
|
/** A vertical collection of {@link ListItem} rows. */
|
|
1031
1056
|
function List({ divided = false, className, children, ...props }) {
|
|
1032
1057
|
return jsx("ul", {
|
|
1033
|
-
...part("list", "root"),
|
|
1034
1058
|
className: cn("snap-list", className),
|
|
1035
1059
|
"data-divided": divided || void 0,
|
|
1036
1060
|
...props,
|
|
1061
|
+
...part("list", "root"),
|
|
1037
1062
|
children
|
|
1038
1063
|
});
|
|
1039
1064
|
}
|
|
@@ -1047,7 +1072,6 @@ function ListItem({ leading, trailing, selected = false, disabled = false, onCli
|
|
|
1047
1072
|
}
|
|
1048
1073
|
};
|
|
1049
1074
|
return jsxs("li", {
|
|
1050
|
-
...part("list", "item"),
|
|
1051
1075
|
className: cn("snap-list-item", className),
|
|
1052
1076
|
"data-selected": selected || void 0,
|
|
1053
1077
|
"data-interactive": interactive || void 0,
|
|
@@ -1060,6 +1084,7 @@ function ListItem({ leading, trailing, selected = false, disabled = false, onCli
|
|
|
1060
1084
|
onKeyDown: activate
|
|
1061
1085
|
} : {},
|
|
1062
1086
|
...props,
|
|
1087
|
+
...part("list", "item"),
|
|
1063
1088
|
children: [
|
|
1064
1089
|
leading !== void 0 && jsx("span", {
|
|
1065
1090
|
...part("list", "leading"),
|
|
@@ -1132,7 +1157,6 @@ function Button({ intent = "neutral", emphasis = "solid", size = "md", loading =
|
|
|
1132
1157
|
loading && jsx(Spinner, {})
|
|
1133
1158
|
] });
|
|
1134
1159
|
return jsx(Component, {
|
|
1135
|
-
...part("button", "root"),
|
|
1136
1160
|
...type !== void 0 ? { type } : !asChild ? { type: "button" } : {},
|
|
1137
1161
|
className: cn("snap-button", className),
|
|
1138
1162
|
"data-intent": intent,
|
|
@@ -1143,13 +1167,13 @@ function Button({ intent = "neutral", emphasis = "solid", size = "md", loading =
|
|
|
1143
1167
|
"aria-busy": loading || void 0,
|
|
1144
1168
|
disabled: !asChild ? disabled === true || loading : void 0,
|
|
1145
1169
|
...props,
|
|
1170
|
+
...part("button", "root"),
|
|
1146
1171
|
children: content
|
|
1147
1172
|
});
|
|
1148
1173
|
}
|
|
1149
1174
|
/** A square glyph button with a mandatory accessible label. */
|
|
1150
1175
|
function IconButton({ icon, label, active = false, intent = "neutral", emphasis = "ghost", size = "md", className, ...props }) {
|
|
1151
1176
|
return jsx("button", {
|
|
1152
|
-
...part("icon-button", "root"),
|
|
1153
1177
|
type: "button",
|
|
1154
1178
|
className: cn("snap-icon-button", className),
|
|
1155
1179
|
"data-intent": intent,
|
|
@@ -1159,6 +1183,7 @@ function IconButton({ icon, label, active = false, intent = "neutral", emphasis
|
|
|
1159
1183
|
"aria-label": label,
|
|
1160
1184
|
"aria-pressed": active || void 0,
|
|
1161
1185
|
...props,
|
|
1186
|
+
...part("icon-button", "root"),
|
|
1162
1187
|
children: jsx("span", {
|
|
1163
1188
|
...part("icon-button", "icon"),
|
|
1164
1189
|
"aria-hidden": "true",
|
|
@@ -1167,137 +1192,693 @@ function IconButton({ icon, label, active = false, intent = "neutral", emphasis
|
|
|
1167
1192
|
});
|
|
1168
1193
|
}
|
|
1169
1194
|
//#endregion
|
|
1170
|
-
//#region lib/types/components/
|
|
1195
|
+
//#region lib/types/components/input.js
|
|
1171
1196
|
/**
|
|
1172
|
-
*
|
|
1173
|
-
* the
|
|
1174
|
-
* attribute; the core owns dismissal and focus behaviour.
|
|
1197
|
+
* Text-entry semantics: the wrapper owns the anatomy (prefix/suffix/clear),
|
|
1198
|
+
* the native field keeps keyboard and IME behaviour. Skins style the parts.
|
|
1175
1199
|
*
|
|
1176
|
-
* @module @snap-rail/ui/components/
|
|
1200
|
+
* @module @snap-rail/ui/components/input
|
|
1177
1201
|
*/
|
|
1178
|
-
/**
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
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,
|
|
1202
|
+
/** A single-line text field with semantic prefix/suffix slots. Layout
|
|
1203
|
+
* `style`/`className` dress the wrapper — the visible control; the native
|
|
1204
|
+
* field already stretches inside it. */
|
|
1205
|
+
function Input({ size = "md", invalid = false, prefix, suffix, onClear, fieldClassName, componentName = "input", className, style, disabled, ...props }) {
|
|
1206
|
+
return jsxs("div", {
|
|
1207
|
+
...part(componentName, "root"),
|
|
1208
|
+
className: cn("snap-input", className),
|
|
1209
|
+
style,
|
|
1194
1210
|
"data-size": size,
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
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
|
|
1211
|
+
"data-invalid": invalid || void 0,
|
|
1212
|
+
"data-disabled": disabled === true || void 0,
|
|
1213
|
+
children: [
|
|
1214
|
+
prefix !== void 0 && jsx("span", {
|
|
1215
|
+
...part(componentName, "prefix"),
|
|
1216
|
+
children: prefix
|
|
1217
|
+
}),
|
|
1218
|
+
jsx("input", {
|
|
1219
|
+
className: cn("snap-input-field", fieldClassName),
|
|
1220
|
+
disabled,
|
|
1221
|
+
"aria-invalid": invalid || void 0,
|
|
1222
|
+
...props,
|
|
1223
|
+
...part(componentName, "field")
|
|
1224
|
+
}),
|
|
1225
|
+
onClear !== void 0 && typeof props.value === "string" && props.value !== "" && jsx("button", {
|
|
1226
|
+
...part(componentName, "clear"),
|
|
1227
|
+
type: "button",
|
|
1228
|
+
className: "snap-input-clear",
|
|
1229
|
+
"aria-label": "清除",
|
|
1230
|
+
onClick: onClear,
|
|
1231
|
+
children: "×"
|
|
1232
|
+
}),
|
|
1233
|
+
suffix !== void 0 && jsx("span", {
|
|
1234
|
+
...part(componentName, "suffix"),
|
|
1235
|
+
children: suffix
|
|
1236
|
+
})
|
|
1237
|
+
]
|
|
1234
1238
|
});
|
|
1235
1239
|
}
|
|
1236
|
-
/**
|
|
1237
|
-
|
|
1240
|
+
/** A multi-line text field. Like {@link Input}, layout `style`/`className`
|
|
1241
|
+
* dress the wrapper; the field stretches inside it. */
|
|
1242
|
+
function Textarea({ size = "md", invalid = false, fieldClassName, className, style, disabled, ...props }) {
|
|
1238
1243
|
return jsx("div", {
|
|
1239
|
-
...part("
|
|
1240
|
-
className: cn("snap-
|
|
1241
|
-
|
|
1244
|
+
...part("textarea", "root"),
|
|
1245
|
+
className: cn("snap-textarea", className),
|
|
1246
|
+
style,
|
|
1247
|
+
"data-size": size,
|
|
1248
|
+
"data-invalid": invalid || void 0,
|
|
1249
|
+
"data-disabled": disabled === true || void 0,
|
|
1250
|
+
children: jsx("textarea", {
|
|
1251
|
+
className: cn("snap-textarea-field", fieldClassName),
|
|
1252
|
+
disabled,
|
|
1253
|
+
"aria-invalid": invalid || void 0,
|
|
1254
|
+
...props,
|
|
1255
|
+
...part("textarea", "field")
|
|
1256
|
+
})
|
|
1242
1257
|
});
|
|
1243
1258
|
}
|
|
1244
|
-
/** A
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1259
|
+
/** A numeric field with touch steppers: `step-up`/`step-down` commit through
|
|
1260
|
+
* the normal `onChange` (a native input event on the field), clamped to
|
|
1261
|
+
* `min`/`max`. */
|
|
1262
|
+
function NumberInput({ min, max, step = 1, size = "md", invalid = false, fieldClassName, className, style, disabled, value, onChange, ...props }) {
|
|
1263
|
+
const fieldRef = useRef(null);
|
|
1264
|
+
const current = typeof value === "number" ? value : void 0;
|
|
1265
|
+
const stepBy = (delta) => {
|
|
1266
|
+
const field = fieldRef.current;
|
|
1267
|
+
if (field === null || disabled === true) return;
|
|
1268
|
+
const parsed = typeof value === "number" ? value : Number(field.value);
|
|
1269
|
+
let next = (Number.isFinite(parsed) ? parsed : min ?? 0) + delta * step;
|
|
1270
|
+
if (min !== void 0 && next < min) next = min;
|
|
1271
|
+
if (max !== void 0 && next > max) next = max;
|
|
1272
|
+
(Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set)?.call(field, String(next));
|
|
1273
|
+
field.dispatchEvent(new Event("input", { bubbles: true }));
|
|
1274
|
+
};
|
|
1275
|
+
return jsxs("div", {
|
|
1276
|
+
...part("number-input", "root"),
|
|
1277
|
+
className: cn("snap-input", "snap-number-input", className),
|
|
1278
|
+
style,
|
|
1279
|
+
"data-size": size,
|
|
1280
|
+
"data-invalid": invalid || void 0,
|
|
1281
|
+
"data-disabled": disabled === true || void 0,
|
|
1282
|
+
children: [jsx("input", {
|
|
1283
|
+
ref: fieldRef,
|
|
1284
|
+
className: cn("snap-input-field", fieldClassName),
|
|
1285
|
+
type: "number",
|
|
1286
|
+
inputMode: "decimal",
|
|
1287
|
+
disabled,
|
|
1288
|
+
"aria-invalid": invalid || void 0,
|
|
1289
|
+
value,
|
|
1290
|
+
onChange,
|
|
1291
|
+
...min !== void 0 ? { min } : {},
|
|
1292
|
+
...max !== void 0 ? { max } : {},
|
|
1293
|
+
...step !== void 0 ? { step } : {},
|
|
1294
|
+
...props,
|
|
1295
|
+
...part("number-input", "field")
|
|
1296
|
+
}), jsxs("span", {
|
|
1297
|
+
className: "snap-number-input-steps",
|
|
1298
|
+
children: [jsx("button", {
|
|
1299
|
+
...part("number-input", "step-up"),
|
|
1300
|
+
type: "button",
|
|
1301
|
+
tabIndex: -1,
|
|
1302
|
+
className: "snap-number-input-step",
|
|
1303
|
+
"aria-label": "增大",
|
|
1304
|
+
disabled: disabled === true || current !== void 0 && max !== void 0 && current >= max,
|
|
1305
|
+
onClick: () => stepBy(1),
|
|
1306
|
+
children: "+"
|
|
1307
|
+
}), jsx("button", {
|
|
1308
|
+
...part("number-input", "step-down"),
|
|
1309
|
+
type: "button",
|
|
1310
|
+
tabIndex: -1,
|
|
1311
|
+
className: "snap-number-input-step",
|
|
1312
|
+
"aria-label": "减小",
|
|
1313
|
+
disabled: disabled === true || current !== void 0 && min !== void 0 && current <= min,
|
|
1314
|
+
onClick: () => stepBy(-1),
|
|
1315
|
+
children: "-"
|
|
1316
|
+
})]
|
|
1317
|
+
})]
|
|
1249
1318
|
});
|
|
1250
1319
|
}
|
|
1251
1320
|
//#endregion
|
|
1252
|
-
//#region lib/types/components/
|
|
1321
|
+
//#region lib/types/components/overlay.js
|
|
1253
1322
|
/**
|
|
1254
|
-
*
|
|
1255
|
-
*
|
|
1256
|
-
*
|
|
1323
|
+
* Overlay semantics over Radix: tooltips, popovers, dropdown menus, and
|
|
1324
|
+
* toasts. Behaviour/keyboard/focus handling stays here; skins target the
|
|
1325
|
+
* stable parts (`tooltip.*`, `popover.*`, `menu.*`, `toast.*`) and state
|
|
1326
|
+
* attributes. The imperative toast() helper pairs with the <Toaster/> the
|
|
1327
|
+
* runtime mounts in every surface root.
|
|
1257
1328
|
*
|
|
1258
|
-
* @module @snap-rail/ui/components/
|
|
1329
|
+
* @module @snap-rail/ui/components/overlay
|
|
1259
1330
|
*/
|
|
1260
|
-
/**
|
|
1261
|
-
function
|
|
1262
|
-
return jsx(
|
|
1263
|
-
className: cn("snap-label", className),
|
|
1331
|
+
/** The tooltip root; wraps `TooltipTrigger`/`TooltipContent` and owns delay. */
|
|
1332
|
+
function Tooltip({ delayDuration, ...props }) {
|
|
1333
|
+
return jsx(TooltipPrimitive.Root, {
|
|
1264
1334
|
...props,
|
|
1265
|
-
|
|
1335
|
+
delayDuration: delayDuration ?? 300
|
|
1266
1336
|
});
|
|
1267
1337
|
}
|
|
1268
|
-
/** The
|
|
1269
|
-
function
|
|
1270
|
-
return jsx(
|
|
1271
|
-
|
|
1272
|
-
|
|
1338
|
+
/** The tooltip provider; the runtime mounts one, pages only need it standalone. */
|
|
1339
|
+
function TooltipProvider(props) {
|
|
1340
|
+
return jsx(TooltipPrimitive.Provider, { ...props });
|
|
1341
|
+
}
|
|
1342
|
+
/** The tooltip trigger; wraps its child and anchors the bubble. */
|
|
1343
|
+
function TooltipTrigger(props) {
|
|
1344
|
+
return jsx(TooltipPrimitive.Trigger, {
|
|
1273
1345
|
...props,
|
|
1274
|
-
|
|
1346
|
+
...part("tooltip", "trigger")
|
|
1275
1347
|
});
|
|
1276
1348
|
}
|
|
1277
|
-
/** The
|
|
1278
|
-
function
|
|
1279
|
-
return jsx(
|
|
1280
|
-
|
|
1349
|
+
/** The portalled tooltip bubble. */
|
|
1350
|
+
function TooltipContent({ side = "top", sideOffset = 6, className, children, ...props }) {
|
|
1351
|
+
return jsx(TooltipPrimitive.Portal, { children: jsx(TooltipPrimitive.Content, {
|
|
1352
|
+
className: cn("snap-tooltip", className),
|
|
1353
|
+
side,
|
|
1354
|
+
sideOffset,
|
|
1355
|
+
...props,
|
|
1356
|
+
...part("tooltip", "content"),
|
|
1357
|
+
children
|
|
1358
|
+
}) });
|
|
1359
|
+
}
|
|
1360
|
+
/** The popover root. */
|
|
1361
|
+
const Popover = PopoverPrimitive.Root;
|
|
1362
|
+
/** The popover trigger; wraps its child and toggles the panel. */
|
|
1363
|
+
function PopoverTrigger(props) {
|
|
1364
|
+
return jsx(PopoverPrimitive.Trigger, {
|
|
1365
|
+
...props,
|
|
1366
|
+
...part("popover", "trigger")
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
/** An element the panel positions against without toggling it. */
|
|
1370
|
+
const PopoverAnchor = PopoverPrimitive.Anchor;
|
|
1371
|
+
/** Closes the popover from inside the panel. */
|
|
1372
|
+
function PopoverClose(props) {
|
|
1373
|
+
return jsx(PopoverPrimitive.Close, { ...props });
|
|
1374
|
+
}
|
|
1375
|
+
/** Whether the element can hold a text caret (the anchored-combobox opener). */
|
|
1376
|
+
function isEditableElement(element) {
|
|
1377
|
+
if (element === null || !(element instanceof HTMLElement)) return false;
|
|
1378
|
+
return element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.isContentEditable;
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* The portalled popover panel, with the two focus dead ends Radix leaves
|
|
1382
|
+
* open in anchored mode: on open, the FocusScope default steals the focus
|
|
1383
|
+
* from the field a combobox is typing into; on close, the default handler
|
|
1384
|
+
* focuses the trigger ref — which is `null` without a `PopoverTrigger`, so
|
|
1385
|
+
* focus strands on `body` and every keystroke dies. The wrapper remembers
|
|
1386
|
+
* the element that opened the panel and returns focus there; when that
|
|
1387
|
+
* element is editable it also keeps the focus in it while the panel is
|
|
1388
|
+
* open. Trigger-mode popovers behave exactly as Radix does (the opener IS
|
|
1389
|
+
* the trigger).
|
|
1390
|
+
*/
|
|
1391
|
+
function PopoverContent({ side = "bottom", align = "center", sideOffset = 6, autoFocusOnOpen, className, children, onOpenAutoFocus, onCloseAutoFocus, onInteractOutside, ...props }) {
|
|
1392
|
+
const openerRef = useRef(null);
|
|
1393
|
+
const interactedOutsideRef = useRef(false);
|
|
1394
|
+
const handleOpenAutoFocus = (event) => {
|
|
1395
|
+
openerRef.current = document.activeElement;
|
|
1396
|
+
interactedOutsideRef.current = false;
|
|
1397
|
+
onOpenAutoFocus?.(event);
|
|
1398
|
+
if (event.defaultPrevented) return;
|
|
1399
|
+
if (autoFocusOnOpen === false || autoFocusOnOpen === void 0 && isEditableElement(openerRef.current)) event.preventDefault();
|
|
1400
|
+
};
|
|
1401
|
+
const handleCloseAutoFocus = (event) => {
|
|
1402
|
+
onCloseAutoFocus?.(event);
|
|
1403
|
+
if (event.defaultPrevented) return;
|
|
1404
|
+
if (interactedOutsideRef.current) return;
|
|
1405
|
+
const opener = openerRef.current;
|
|
1406
|
+
if (opener !== null && opener !== document.body && opener.isConnected) {
|
|
1407
|
+
event.preventDefault();
|
|
1408
|
+
opener.focus({ preventScroll: true });
|
|
1409
|
+
}
|
|
1410
|
+
};
|
|
1411
|
+
const handleInteractOutside = (event) => {
|
|
1412
|
+
interactedOutsideRef.current = true;
|
|
1413
|
+
onInteractOutside?.(event);
|
|
1414
|
+
};
|
|
1415
|
+
return jsx(PopoverPrimitive.Portal, { children: jsx(PopoverPrimitive.Content, {
|
|
1416
|
+
className: cn("snap-popover", className),
|
|
1417
|
+
side,
|
|
1418
|
+
align,
|
|
1419
|
+
sideOffset,
|
|
1420
|
+
onOpenAutoFocus: handleOpenAutoFocus,
|
|
1421
|
+
onCloseAutoFocus: handleCloseAutoFocus,
|
|
1422
|
+
onInteractOutside: handleInteractOutside,
|
|
1423
|
+
...props,
|
|
1424
|
+
...part("popover", "content"),
|
|
1425
|
+
children
|
|
1426
|
+
}) });
|
|
1427
|
+
}
|
|
1428
|
+
/** The dropdown menu root. */
|
|
1429
|
+
const Menu = DropdownMenuPrimitive.Root;
|
|
1430
|
+
/** The menu trigger; wraps its child and toggles the dropdown. */
|
|
1431
|
+
function MenuTrigger(props) {
|
|
1432
|
+
return jsx(DropdownMenuPrimitive.Trigger, {
|
|
1433
|
+
...props,
|
|
1434
|
+
...part("menu", "trigger")
|
|
1435
|
+
});
|
|
1436
|
+
}
|
|
1437
|
+
/** The portalled dropdown list. */
|
|
1438
|
+
function MenuContent({ side = "bottom", align = "start", sideOffset = 4, className, children, ...props }) {
|
|
1439
|
+
return jsx(DropdownMenuPrimitive.Portal, { children: jsx(DropdownMenuPrimitive.Content, {
|
|
1440
|
+
className: cn("snap-menu", className),
|
|
1441
|
+
side,
|
|
1442
|
+
align,
|
|
1443
|
+
sideOffset,
|
|
1444
|
+
...props,
|
|
1445
|
+
...part("menu", "content"),
|
|
1446
|
+
children
|
|
1447
|
+
}) });
|
|
1448
|
+
}
|
|
1449
|
+
/** One menu action. */
|
|
1450
|
+
function MenuItem({ className, children, ...props }) {
|
|
1451
|
+
return jsx(DropdownMenuPrimitive.Item, {
|
|
1452
|
+
className: cn("snap-menu-item", className),
|
|
1453
|
+
...props,
|
|
1454
|
+
...part("menu", "item"),
|
|
1455
|
+
children
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
/** A checkable menu action with an indicator slot. */
|
|
1459
|
+
function MenuCheckboxItem({ className, children, ...props }) {
|
|
1460
|
+
return jsxs(DropdownMenuPrimitive.CheckboxItem, {
|
|
1461
|
+
className: cn("snap-menu-item", className),
|
|
1462
|
+
...props,
|
|
1463
|
+
...part("menu", "checkbox-item"),
|
|
1464
|
+
children: [jsx(DropdownMenuPrimitive.ItemIndicator, {
|
|
1465
|
+
...part("menu", "item-indicator"),
|
|
1466
|
+
className: "snap-menu-indicator",
|
|
1467
|
+
children: "✓"
|
|
1468
|
+
}), children]
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
/** A non-interactive group heading. */
|
|
1472
|
+
function MenuLabel({ className, children, ...props }) {
|
|
1473
|
+
return jsx(DropdownMenuPrimitive.Label, {
|
|
1474
|
+
className: cn("snap-menu-label", className),
|
|
1475
|
+
...props,
|
|
1476
|
+
...part("menu", "label"),
|
|
1477
|
+
children
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
/** A group container for items. */
|
|
1481
|
+
function MenuGroup(props) {
|
|
1482
|
+
return jsx(DropdownMenuPrimitive.Group, { ...props });
|
|
1483
|
+
}
|
|
1484
|
+
/** A horizontal rule between menu sections. */
|
|
1485
|
+
function MenuSeparator({ className, ...props }) {
|
|
1486
|
+
return jsx(DropdownMenuPrimitive.Separator, {
|
|
1487
|
+
className: cn("snap-menu-separator", className),
|
|
1488
|
+
...props,
|
|
1489
|
+
...part("menu", "separator")
|
|
1490
|
+
});
|
|
1491
|
+
}
|
|
1492
|
+
let toastNextId = 1;
|
|
1493
|
+
let toastRecords = [];
|
|
1494
|
+
const toastListeners = /* @__PURE__ */ new Set();
|
|
1495
|
+
function toastEmit() {
|
|
1496
|
+
for (const listener of toastListeners) listener();
|
|
1497
|
+
}
|
|
1498
|
+
function toastDismiss(id) {
|
|
1499
|
+
toastRecords = toastRecords.filter((record) => record.id !== id);
|
|
1500
|
+
toastEmit();
|
|
1501
|
+
}
|
|
1502
|
+
/** Enqueue a toast on the runtime-mounted {@link Toaster}s. */
|
|
1503
|
+
function toast(entry) {
|
|
1504
|
+
const id = toastNextId++;
|
|
1505
|
+
toastRecords = [...toastRecords, {
|
|
1506
|
+
...entry,
|
|
1507
|
+
id
|
|
1508
|
+
}];
|
|
1509
|
+
toastEmit();
|
|
1510
|
+
return id;
|
|
1511
|
+
}
|
|
1512
|
+
/** Dismiss a queued toast by id. */
|
|
1513
|
+
function dismissToast(id) {
|
|
1514
|
+
toastDismiss(id);
|
|
1515
|
+
}
|
|
1516
|
+
/** The runtime-mounted viewport: renders the shared toast queue. Pages never
|
|
1517
|
+
* mount this themselves — the runtime provides one per surface root. */
|
|
1518
|
+
function Toaster(props) {
|
|
1519
|
+
const records = useSyncExternalStore((onStoreChange) => {
|
|
1520
|
+
toastListeners.add(onStoreChange);
|
|
1521
|
+
return () => toastListeners.delete(onStoreChange);
|
|
1522
|
+
}, () => toastRecords, () => toastRecords);
|
|
1523
|
+
return jsxs(ToastPrimitive.Provider, {
|
|
1524
|
+
...props,
|
|
1525
|
+
children: [records.map((record) => jsxs(ToastPrimitive.Root, {
|
|
1526
|
+
...part("toast", "root"),
|
|
1527
|
+
className: "snap-toast",
|
|
1528
|
+
"data-intent": record.intent ?? "neutral",
|
|
1529
|
+
duration: record.duration ?? 5e3,
|
|
1530
|
+
onOpenChange: (open) => {
|
|
1531
|
+
if (!open) toastDismiss(record.id);
|
|
1532
|
+
},
|
|
1533
|
+
children: [
|
|
1534
|
+
jsx(ToastTitle, { children: record.title }),
|
|
1535
|
+
record.description !== void 0 && jsx(ToastDescription, { children: record.description }),
|
|
1536
|
+
jsx(ToastClose, { "aria-label": "关闭" })
|
|
1537
|
+
]
|
|
1538
|
+
}, record.id)), jsx(ToastViewport, {})]
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
/** The raw toast root for pages that manage their own open state. */
|
|
1542
|
+
const Toast = ToastPrimitive.Root;
|
|
1543
|
+
/** A toast title with its part tag. */
|
|
1544
|
+
function ToastTitle({ className, children, ...props }) {
|
|
1545
|
+
return jsx(ToastPrimitive.Title, {
|
|
1546
|
+
className: cn("snap-toast-title", className),
|
|
1547
|
+
...props,
|
|
1548
|
+
...part("toast", "title"),
|
|
1549
|
+
children
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1552
|
+
/** A toast description with its part tag. */
|
|
1553
|
+
function ToastDescription({ className, children, ...props }) {
|
|
1554
|
+
return jsx(ToastPrimitive.Description, {
|
|
1555
|
+
className: cn("snap-toast-description", className),
|
|
1556
|
+
...props,
|
|
1557
|
+
...part("toast", "description"),
|
|
1558
|
+
children
|
|
1559
|
+
});
|
|
1560
|
+
}
|
|
1561
|
+
/** An interactive toast action (confirm/retry affordances). */
|
|
1562
|
+
function ToastAction({ className, children, ...props }) {
|
|
1563
|
+
return jsx(ToastPrimitive.Action, {
|
|
1564
|
+
className: cn("snap-toast-action", className),
|
|
1565
|
+
...props,
|
|
1566
|
+
...part("toast", "action"),
|
|
1567
|
+
children
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
/** A toast dismissal button. */
|
|
1571
|
+
function ToastClose({ className, children, ...props }) {
|
|
1572
|
+
return jsx(ToastPrimitive.Close, {
|
|
1573
|
+
className: cn("snap-toast-close", className),
|
|
1574
|
+
...props,
|
|
1575
|
+
...part("toast", "close"),
|
|
1576
|
+
children: children ?? jsx("span", {
|
|
1577
|
+
"aria-hidden": "true",
|
|
1578
|
+
children: "×"
|
|
1579
|
+
})
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
/** The toast viewport; only the runtime's {@link Toaster} mounts one. */
|
|
1583
|
+
function ToastViewport({ className, ...props }) {
|
|
1584
|
+
return jsx(ToastPrimitive.Viewport, {
|
|
1585
|
+
className: cn("snap-toast-viewport", className),
|
|
1586
|
+
...props,
|
|
1587
|
+
...part("toast", "viewport")
|
|
1588
|
+
});
|
|
1589
|
+
}
|
|
1590
|
+
//#endregion
|
|
1591
|
+
//#region lib/types/components/combobox.js
|
|
1592
|
+
/**
|
|
1593
|
+
* A text field with an anchored suggestion list: search pickers, filtered
|
|
1594
|
+
* choosers, async candidate feeds (operator lookups, assignee search). The
|
|
1595
|
+
* focus never leaves the field — keyboard navigation rides
|
|
1596
|
+
* `aria-activedescendant`, pointer picks suppress the field's blur, and the
|
|
1597
|
+
* panel opens without taking the focus — so typing keeps working through
|
|
1598
|
+
* open, navigate, and select. The field is a regular {@link Input}; skins
|
|
1599
|
+
* style the `combobox.*` parts around it.
|
|
1600
|
+
*
|
|
1601
|
+
* @module @snap-rail/ui/components/combobox
|
|
1602
|
+
*/
|
|
1603
|
+
/** The text an option contributes to filtering and to the field once picked. */
|
|
1604
|
+
function textOf(option) {
|
|
1605
|
+
return typeof option.label === "string" || typeof option.label === "number" ? String(option.label) : option.value;
|
|
1606
|
+
}
|
|
1607
|
+
/** The next enabled row index from `from`, wrapping; -1 when none is enabled. */
|
|
1608
|
+
function nextEnabled(rows, from, step) {
|
|
1609
|
+
if (rows.length === 0) return -1;
|
|
1610
|
+
let index = from < 0 ? step > 0 ? -1 : 0 : from;
|
|
1611
|
+
for (let tries = 0; tries < rows.length; tries++) {
|
|
1612
|
+
index = (index + step + rows.length) % rows.length;
|
|
1613
|
+
if (rows[index]?.disabled !== true) return index;
|
|
1614
|
+
}
|
|
1615
|
+
return -1;
|
|
1616
|
+
}
|
|
1617
|
+
/** A field with an anchored, keyboard-navigable suggestion list. */
|
|
1618
|
+
function Combobox({ value, defaultValue, onValueChange, onInputValueChange, options, placeholder, disabled = false, invalid = false, size = "md", loading = false, emptyText = "无匹配项", id, className, contentClassName, "aria-label": ariaLabel }) {
|
|
1619
|
+
const listId = useId();
|
|
1620
|
+
const anchorRef = useRef(null);
|
|
1621
|
+
const [uncontrolled, setUncontrolled] = useState(defaultValue);
|
|
1622
|
+
const current = value !== void 0 ? value : uncontrolled;
|
|
1623
|
+
const selected = options.find((option) => option.value === current);
|
|
1624
|
+
const selectedText = selected !== void 0 ? textOf(selected) : void 0;
|
|
1625
|
+
const [text, setText] = useState(selectedText ?? "");
|
|
1626
|
+
const [open, setOpen] = useState(false);
|
|
1627
|
+
const [active, setActive] = useState(-1);
|
|
1628
|
+
useEffect(() => {
|
|
1629
|
+
if (selectedText !== void 0) setText(selectedText);
|
|
1630
|
+
}, [selectedText]);
|
|
1631
|
+
const query = text.trim().toLowerCase();
|
|
1632
|
+
const rows = onInputValueChange !== void 0 || query === "" || text === selectedText ? options : options.filter((option) => textOf(option).toLowerCase().includes(query));
|
|
1633
|
+
const optionId = (index) => `${listId}-${index}`;
|
|
1634
|
+
useEffect(() => {
|
|
1635
|
+
if (active < 0) return;
|
|
1636
|
+
document.getElementById(optionId(active))?.scrollIntoView?.({ block: "nearest" });
|
|
1637
|
+
});
|
|
1638
|
+
const close = () => {
|
|
1639
|
+
setOpen(false);
|
|
1640
|
+
setActive(-1);
|
|
1641
|
+
};
|
|
1642
|
+
const choose = (option) => {
|
|
1643
|
+
if (option.disabled === true) return;
|
|
1644
|
+
if (value === void 0) setUncontrolled(option.value);
|
|
1645
|
+
setText(textOf(option));
|
|
1646
|
+
onValueChange?.(option.value);
|
|
1647
|
+
close();
|
|
1648
|
+
};
|
|
1649
|
+
const onKeyDown = (event) => {
|
|
1650
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
1651
|
+
event.preventDefault();
|
|
1652
|
+
if (!open) {
|
|
1653
|
+
setOpen(true);
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1656
|
+
setActive((index) => nextEnabled(rows, index, event.key === "ArrowDown" ? 1 : -1));
|
|
1657
|
+
return;
|
|
1658
|
+
}
|
|
1659
|
+
if (event.key === "Enter" && open && active >= 0) {
|
|
1660
|
+
const option = rows[active];
|
|
1661
|
+
if (option !== void 0) {
|
|
1662
|
+
event.preventDefault();
|
|
1663
|
+
choose(option);
|
|
1664
|
+
}
|
|
1665
|
+
return;
|
|
1666
|
+
}
|
|
1667
|
+
if (event.key === "Escape" && open) {
|
|
1668
|
+
event.preventDefault();
|
|
1669
|
+
close();
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
return jsx("span", {
|
|
1673
|
+
...part("combobox", "root"),
|
|
1674
|
+
className: "snap-combobox",
|
|
1675
|
+
children: jsxs(Popover, {
|
|
1676
|
+
open: open && !disabled,
|
|
1677
|
+
onOpenChange: (next) => {
|
|
1678
|
+
if (!next) close();
|
|
1679
|
+
},
|
|
1680
|
+
children: [jsx(PopoverAnchor, {
|
|
1681
|
+
asChild: true,
|
|
1682
|
+
children: jsx("span", {
|
|
1683
|
+
ref: anchorRef,
|
|
1684
|
+
...part("combobox", "anchor"),
|
|
1685
|
+
children: jsx(Input, {
|
|
1686
|
+
id,
|
|
1687
|
+
size,
|
|
1688
|
+
invalid,
|
|
1689
|
+
disabled,
|
|
1690
|
+
placeholder,
|
|
1691
|
+
className,
|
|
1692
|
+
value: text,
|
|
1693
|
+
role: "combobox",
|
|
1694
|
+
autoComplete: "off",
|
|
1695
|
+
"aria-label": ariaLabel,
|
|
1696
|
+
"aria-expanded": open,
|
|
1697
|
+
"aria-controls": listId,
|
|
1698
|
+
"aria-autocomplete": "list",
|
|
1699
|
+
"aria-activedescendant": open && active >= 0 ? optionId(active) : void 0,
|
|
1700
|
+
onChange: (event) => {
|
|
1701
|
+
setText(event.target.value);
|
|
1702
|
+
setActive(-1);
|
|
1703
|
+
setOpen(true);
|
|
1704
|
+
onInputValueChange?.(event.target.value);
|
|
1705
|
+
},
|
|
1706
|
+
onFocus: () => setOpen(true),
|
|
1707
|
+
onBlur: close,
|
|
1708
|
+
onKeyDown
|
|
1709
|
+
})
|
|
1710
|
+
})
|
|
1711
|
+
}), jsx(PopoverContent, {
|
|
1712
|
+
align: "start",
|
|
1713
|
+
sideOffset: 4,
|
|
1714
|
+
autoFocusOnOpen: false,
|
|
1715
|
+
className: contentClassName,
|
|
1716
|
+
onInteractOutside: (event) => {
|
|
1717
|
+
if (anchorRef.current?.contains(event.target) === true) event.preventDefault();
|
|
1718
|
+
},
|
|
1719
|
+
children: jsxs("div", {
|
|
1720
|
+
...part("combobox", "list"),
|
|
1721
|
+
role: "listbox",
|
|
1722
|
+
id: listId,
|
|
1723
|
+
children: [
|
|
1724
|
+
rows.map((option, index) => jsx("div", {
|
|
1725
|
+
...part("combobox", "option"),
|
|
1726
|
+
id: optionId(index),
|
|
1727
|
+
role: "option",
|
|
1728
|
+
"aria-selected": option.value === current,
|
|
1729
|
+
"aria-disabled": option.disabled === true || void 0,
|
|
1730
|
+
"data-active": index === active || void 0,
|
|
1731
|
+
"data-disabled": option.disabled === true || void 0,
|
|
1732
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1733
|
+
onClick: () => choose(option),
|
|
1734
|
+
children: option.label
|
|
1735
|
+
}, option.value)),
|
|
1736
|
+
loading && jsx("div", {
|
|
1737
|
+
...part("combobox", "empty"),
|
|
1738
|
+
children: "搜索中…"
|
|
1739
|
+
}),
|
|
1740
|
+
!loading && rows.length === 0 && jsx("div", {
|
|
1741
|
+
...part("combobox", "empty"),
|
|
1742
|
+
children: emptyText
|
|
1743
|
+
})
|
|
1744
|
+
]
|
|
1745
|
+
})
|
|
1746
|
+
})]
|
|
1747
|
+
})
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
//#endregion
|
|
1751
|
+
//#region lib/types/components/dialog.js
|
|
1752
|
+
/**
|
|
1753
|
+
* Dialog/sheet semantics over Radix's focus trap and portal. The skin chooses
|
|
1754
|
+
* the presentation (modal, sheet, fullscreen) through the `presentation`
|
|
1755
|
+
* attribute; the core owns dismissal and focus behaviour.
|
|
1756
|
+
*
|
|
1757
|
+
* @module @snap-rail/ui/components/dialog
|
|
1758
|
+
*/
|
|
1759
|
+
/** The dialog root. */
|
|
1760
|
+
const Dialog = DialogPrimitive.Root;
|
|
1761
|
+
/** The dialog trigger. */
|
|
1762
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
1763
|
+
/** The dialog close. */
|
|
1764
|
+
const DialogClose = DialogPrimitive.Close;
|
|
1765
|
+
/** The portalled dialog content. */
|
|
1766
|
+
function DialogContent({ children, className, presentation = "auto", size = "md", showClose = true, ...rest }) {
|
|
1767
|
+
const resolved = presentation === "auto" ? "modal" : presentation;
|
|
1768
|
+
return jsxs(DialogPrimitive.Portal, { children: [jsx(DialogPrimitive.Overlay, {
|
|
1769
|
+
...part("dialog", "overlay"),
|
|
1770
|
+
className: "snap-dialog-overlay"
|
|
1771
|
+
}), jsxs(DialogPrimitive.Content, {
|
|
1772
|
+
className: cn("snap-dialog-panel", className),
|
|
1773
|
+
"data-presentation": resolved,
|
|
1774
|
+
"data-size": size,
|
|
1775
|
+
...rest,
|
|
1776
|
+
...part("dialog", "panel"),
|
|
1777
|
+
children: [children, showClose && jsx(DialogPrimitive.Close, {
|
|
1778
|
+
...part("dialog", "close"),
|
|
1779
|
+
className: "snap-dialog-close",
|
|
1780
|
+
"aria-label": "关闭",
|
|
1781
|
+
children: "×"
|
|
1782
|
+
})]
|
|
1783
|
+
})] });
|
|
1784
|
+
}
|
|
1785
|
+
/** The dialog header. */
|
|
1786
|
+
function DialogHeader({ children, className }) {
|
|
1787
|
+
return jsx("div", {
|
|
1788
|
+
...part("dialog", "header"),
|
|
1789
|
+
className: cn("snap-dialog-header", className),
|
|
1790
|
+
children
|
|
1791
|
+
});
|
|
1792
|
+
}
|
|
1793
|
+
/** The dialog title. */
|
|
1794
|
+
function DialogTitle({ children, className }) {
|
|
1795
|
+
return jsx(DialogPrimitive.Title, {
|
|
1796
|
+
...part("dialog", "title"),
|
|
1797
|
+
className: cn("snap-dialog-title", className),
|
|
1798
|
+
children
|
|
1799
|
+
});
|
|
1800
|
+
}
|
|
1801
|
+
/** The dialog description. */
|
|
1802
|
+
function DialogDescription({ children, className }) {
|
|
1803
|
+
return jsx(DialogPrimitive.Description, {
|
|
1804
|
+
...part("dialog", "description"),
|
|
1805
|
+
className: cn("snap-dialog-description", className),
|
|
1806
|
+
children
|
|
1807
|
+
});
|
|
1808
|
+
}
|
|
1809
|
+
/** The dialog body. */
|
|
1810
|
+
function DialogBody({ children, className }) {
|
|
1811
|
+
return jsx("div", {
|
|
1812
|
+
...part("dialog", "body"),
|
|
1813
|
+
className: cn("snap-dialog-body", className),
|
|
1814
|
+
children
|
|
1815
|
+
});
|
|
1816
|
+
}
|
|
1817
|
+
/** The dialog footer. */
|
|
1818
|
+
function DialogFooter({ children, className }) {
|
|
1819
|
+
return jsx("div", {
|
|
1820
|
+
...part("dialog", "footer"),
|
|
1821
|
+
className: cn("snap-dialog-footer", className),
|
|
1822
|
+
children
|
|
1823
|
+
});
|
|
1824
|
+
}
|
|
1825
|
+
/** A sheet is a dialog with the `sheet` presentation by default. */
|
|
1826
|
+
function Sheet(props) {
|
|
1827
|
+
return jsx(DialogContent, {
|
|
1828
|
+
...props,
|
|
1829
|
+
presentation: props.presentation ?? "sheet"
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
//#endregion
|
|
1833
|
+
//#region lib/types/components/controls.js
|
|
1834
|
+
/**
|
|
1835
|
+
* Selection and toggle semantics over Radix: tabs, select, switch, checkbox,
|
|
1836
|
+
* and radio groups. All behaviour/keyboard handling stays here; skins target
|
|
1837
|
+
* the stable parts and state attributes.
|
|
1838
|
+
*
|
|
1839
|
+
* @module @snap-rail/ui/components/controls
|
|
1840
|
+
*/
|
|
1841
|
+
/** A form label. */
|
|
1842
|
+
function Label({ className, children, ...props }) {
|
|
1843
|
+
return jsx(LabelPrimitive.Root, {
|
|
1844
|
+
className: cn("snap-label", className),
|
|
1845
|
+
...props,
|
|
1846
|
+
children
|
|
1847
|
+
});
|
|
1848
|
+
}
|
|
1849
|
+
/** The tabs root. */
|
|
1850
|
+
function Tabs({ className, children, ...props }) {
|
|
1851
|
+
return jsx(TabsPrimitive.Root, {
|
|
1852
|
+
className: cn("snap-tabs", className),
|
|
1853
|
+
...props,
|
|
1854
|
+
...part("tabs", "root"),
|
|
1855
|
+
children
|
|
1856
|
+
});
|
|
1857
|
+
}
|
|
1858
|
+
/** The tabs list. */
|
|
1859
|
+
function TabsList({ className, children, ...props }) {
|
|
1860
|
+
return jsx(TabsPrimitive.List, {
|
|
1281
1861
|
className: cn("snap-tabs-list", className),
|
|
1282
1862
|
...props,
|
|
1863
|
+
...part("tabs", "list"),
|
|
1283
1864
|
children
|
|
1284
1865
|
});
|
|
1285
1866
|
}
|
|
1286
1867
|
/** A tab trigger. */
|
|
1287
1868
|
function TabsTrigger({ className, children, ...props }) {
|
|
1288
1869
|
return jsx(TabsPrimitive.Trigger, {
|
|
1289
|
-
...part("tabs", "trigger"),
|
|
1290
1870
|
className: cn("snap-tabs-trigger", className),
|
|
1291
1871
|
...props,
|
|
1872
|
+
...part("tabs", "trigger"),
|
|
1292
1873
|
children
|
|
1293
1874
|
});
|
|
1294
1875
|
}
|
|
1295
1876
|
/** A tab panel. */
|
|
1296
1877
|
function TabsContent({ className, children, ...props }) {
|
|
1297
1878
|
return jsx(TabsPrimitive.Content, {
|
|
1298
|
-
...part("tabs", "content"),
|
|
1299
1879
|
className: cn("snap-tabs-content", className),
|
|
1300
1880
|
...props,
|
|
1881
|
+
...part("tabs", "content"),
|
|
1301
1882
|
children
|
|
1302
1883
|
});
|
|
1303
1884
|
}
|
|
@@ -1312,9 +1893,9 @@ function Switch({ className, label, labelPosition = "end", description, containe
|
|
|
1312
1893
|
children: [
|
|
1313
1894
|
labelPosition === "start" && labelNode,
|
|
1314
1895
|
jsx(SwitchPrimitive.Root, {
|
|
1315
|
-
...part("switch", "root"),
|
|
1316
1896
|
className: cn("snap-switch", className),
|
|
1317
1897
|
...props,
|
|
1898
|
+
...part("switch", "root"),
|
|
1318
1899
|
children: jsx(SwitchPrimitive.Thumb, {
|
|
1319
1900
|
...part("switch", "thumb"),
|
|
1320
1901
|
className: "snap-switch-thumb"
|
|
@@ -1345,9 +1926,9 @@ function Checkbox({ className, label, labelPosition = "end", description, contai
|
|
|
1345
1926
|
children: [
|
|
1346
1927
|
labelPosition === "start" && labelNode,
|
|
1347
1928
|
jsx(CheckboxPrimitive.Root, {
|
|
1348
|
-
...part("checkbox", "root"),
|
|
1349
1929
|
className: cn("snap-checkbox", className),
|
|
1350
1930
|
...props,
|
|
1931
|
+
...part("checkbox", "root"),
|
|
1351
1932
|
children: jsx(CheckboxPrimitive.Indicator, {
|
|
1352
1933
|
...part("checkbox", "indicator"),
|
|
1353
1934
|
className: "snap-checkbox-indicator",
|
|
@@ -1372,10 +1953,10 @@ function Checkbox({ className, label, labelPosition = "end", description, contai
|
|
|
1372
1953
|
function RadioGroup({ className, label, description, children, ...props }) {
|
|
1373
1954
|
const labelId = useId();
|
|
1374
1955
|
const group = jsx(RadioGroupPrimitive.Root, {
|
|
1375
|
-
...part("radio-group", "root"),
|
|
1376
1956
|
className: cn("snap-radio-group", className),
|
|
1377
1957
|
...label !== void 0 ? { "aria-labelledby": labelId } : {},
|
|
1378
1958
|
...props,
|
|
1959
|
+
...part("radio-group", "root"),
|
|
1379
1960
|
children
|
|
1380
1961
|
});
|
|
1381
1962
|
if (label === void 0 && description === void 0) return group;
|
|
@@ -1400,9 +1981,9 @@ function RadioGroup({ className, label, description, children, ...props }) {
|
|
|
1400
1981
|
/** One radio item. */
|
|
1401
1982
|
function RadioGroupItem({ className, ...props }) {
|
|
1402
1983
|
return jsx(RadioGroupPrimitive.Item, {
|
|
1403
|
-
...part("radio-group", "item"),
|
|
1404
1984
|
className: cn("snap-radio-item", className),
|
|
1405
1985
|
...props,
|
|
1986
|
+
...part("radio-group", "item"),
|
|
1406
1987
|
children: jsx(RadioGroupPrimitive.Indicator, {
|
|
1407
1988
|
...part("radio-group", "indicator"),
|
|
1408
1989
|
className: "snap-radio-indicator"
|
|
@@ -1416,58 +1997,63 @@ function TouchSelect({ value, onValueChange, options, placeholder = "请选择",
|
|
|
1416
1997
|
return jsxs("span", {
|
|
1417
1998
|
...part("touch-select", "root"),
|
|
1418
1999
|
className: "snap-touch-select",
|
|
1419
|
-
children: [
|
|
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),
|
|
2000
|
+
children: [jsx("span", {
|
|
1429
2001
|
...part("touch-select", "trigger"),
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
"aria-
|
|
1438
|
-
|
|
1439
|
-
|
|
2002
|
+
className: "snap-touch-select-trigger",
|
|
2003
|
+
children: jsxs(Button, {
|
|
2004
|
+
type: "button",
|
|
2005
|
+
size,
|
|
2006
|
+
emphasis: "outline",
|
|
2007
|
+
className,
|
|
2008
|
+
disabled,
|
|
2009
|
+
"aria-label": ariaLabel,
|
|
2010
|
+
"aria-invalid": invalid || void 0,
|
|
2011
|
+
"aria-haspopup": "dialog",
|
|
2012
|
+
onClick: () => setOpen(true),
|
|
2013
|
+
children: [jsx("span", {
|
|
2014
|
+
style: {
|
|
2015
|
+
flex: 1,
|
|
2016
|
+
textAlign: "left"
|
|
2017
|
+
},
|
|
2018
|
+
children: selected?.label ?? placeholder
|
|
2019
|
+
}), jsx("span", {
|
|
2020
|
+
"aria-hidden": "true",
|
|
2021
|
+
children: "▾"
|
|
2022
|
+
})]
|
|
2023
|
+
})
|
|
1440
2024
|
}), jsx(Dialog, {
|
|
1441
2025
|
open,
|
|
1442
2026
|
onOpenChange: setOpen,
|
|
1443
|
-
children:
|
|
2027
|
+
children: jsx(DialogContent, {
|
|
1444
2028
|
presentation: "modal",
|
|
1445
2029
|
size: "sm",
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
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);
|
|
2030
|
+
children: jsxs("div", {
|
|
2031
|
+
...part("touch-select", "sheet"),
|
|
2032
|
+
className: "snap-touch-select-sheet",
|
|
2033
|
+
children: [jsx(DialogHeader, { children: jsx(DialogTitle, { children: title ?? ariaLabel ?? "请选择" }) }), jsxs("div", {
|
|
2034
|
+
...part("touch-select", "options"),
|
|
2035
|
+
style: {
|
|
2036
|
+
display: "flex",
|
|
2037
|
+
flexDirection: "column",
|
|
2038
|
+
gap: "var(--snap-space-sm)"
|
|
1463
2039
|
},
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
2040
|
+
children: [options.map((option) => jsx(Button, {
|
|
2041
|
+
type: "button",
|
|
2042
|
+
size: "lg",
|
|
2043
|
+
emphasis: option.value === value ? "solid" : "outline",
|
|
2044
|
+
intent: option.value === value ? "primary" : "neutral",
|
|
2045
|
+
disabled: option.disabled === true,
|
|
2046
|
+
onClick: () => {
|
|
2047
|
+
onValueChange?.(option.value);
|
|
2048
|
+
setOpen(false);
|
|
2049
|
+
},
|
|
2050
|
+
children: option.label
|
|
2051
|
+
}, option.value)), options.length === 0 && jsx("span", {
|
|
2052
|
+
style: { color: "var(--snap-color-muted)" },
|
|
2053
|
+
children: "无可选项"
|
|
2054
|
+
})]
|
|
1469
2055
|
})]
|
|
1470
|
-
})
|
|
2056
|
+
})
|
|
1471
2057
|
})
|
|
1472
2058
|
})]
|
|
1473
2059
|
});
|
|
@@ -1475,13 +2061,13 @@ function TouchSelect({ value, onValueChange, options, placeholder = "请选择",
|
|
|
1475
2061
|
/** The select trigger; composes a {@link SelectValue} inside. */
|
|
1476
2062
|
function SelectTrigger({ className, size = "md", invalid = false, disabled = false, children, ...props }) {
|
|
1477
2063
|
return jsxs(SelectPrimitive.Trigger, {
|
|
1478
|
-
...part("select", "trigger"),
|
|
1479
2064
|
className: cn("snap-select-trigger", className),
|
|
1480
2065
|
"data-size": size,
|
|
1481
2066
|
"data-invalid": invalid || void 0,
|
|
1482
2067
|
"data-disabled": disabled || void 0,
|
|
1483
2068
|
"aria-invalid": invalid || void 0,
|
|
1484
2069
|
...props,
|
|
2070
|
+
...part("select", "trigger"),
|
|
1485
2071
|
children: [children, jsx(SelectPrimitive.Icon, {
|
|
1486
2072
|
...part("select", "chevron"),
|
|
1487
2073
|
className: "snap-select-chevron",
|
|
@@ -1492,29 +2078,29 @@ function SelectTrigger({ className, size = "md", invalid = false, disabled = fal
|
|
|
1492
2078
|
/** The selected-value slot of a trigger. */
|
|
1493
2079
|
function SelectValue(props) {
|
|
1494
2080
|
return jsx(SelectPrimitive.Value, {
|
|
1495
|
-
...
|
|
1496
|
-
...
|
|
2081
|
+
...props,
|
|
2082
|
+
...part("select", "value")
|
|
1497
2083
|
});
|
|
1498
2084
|
}
|
|
1499
2085
|
/** The portalled option list. */
|
|
1500
2086
|
function SelectContent({ side = "bottom", align = "start", sideOffset = 4, className, children, ...props }) {
|
|
1501
2087
|
return jsx(SelectPrimitive.Portal, { children: jsx(SelectPrimitive.Content, {
|
|
1502
|
-
...part("select", "content"),
|
|
1503
2088
|
className: cn("snap-select-content", className),
|
|
1504
2089
|
position: "popper",
|
|
1505
2090
|
side,
|
|
1506
2091
|
align,
|
|
1507
2092
|
sideOffset,
|
|
1508
2093
|
...props,
|
|
2094
|
+
...part("select", "content"),
|
|
1509
2095
|
children: jsx(SelectPrimitive.Viewport, { children })
|
|
1510
2096
|
}) });
|
|
1511
2097
|
}
|
|
1512
2098
|
/** One option row. */
|
|
1513
2099
|
function SelectItem({ className, children, ...props }) {
|
|
1514
2100
|
return jsxs(SelectPrimitive.Item, {
|
|
1515
|
-
...part("select", "item"),
|
|
1516
2101
|
className: cn("snap-select-item", className),
|
|
1517
2102
|
...props,
|
|
2103
|
+
...part("select", "item"),
|
|
1518
2104
|
children: [jsx(SelectPrimitive.ItemText, { children }), jsx(SelectPrimitive.ItemIndicator, {
|
|
1519
2105
|
...part("select", "item-indicator"),
|
|
1520
2106
|
className: "snap-select-item-indicator",
|
|
@@ -1824,141 +2410,15 @@ function FormDescription({ className, children }) {
|
|
|
1824
2410
|
/** The validation message for the bound field. */
|
|
1825
2411
|
function FormMessage({ message, children, className }) {
|
|
1826
2412
|
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
|
-
})
|
|
1901
|
-
});
|
|
1902
|
-
}
|
|
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
|
-
})]
|
|
2413
|
+
const raw = useFormState$1({ name }).errors[name]?.message;
|
|
2414
|
+
const body = message ?? (typeof raw === "string" || typeof raw === "number" || typeof raw === "bigint" || typeof raw === "boolean" ? String(raw) : void 0) ?? children;
|
|
2415
|
+
if (body === void 0 || body === "") return null;
|
|
2416
|
+
return jsx("div", {
|
|
2417
|
+
...part("field", "error"),
|
|
2418
|
+
id: `${id}-message`,
|
|
2419
|
+
className: cn("snap-field-error", className),
|
|
2420
|
+
role: "alert",
|
|
2421
|
+
children: body
|
|
1962
2422
|
});
|
|
1963
2423
|
}
|
|
1964
2424
|
//#endregion
|
|
@@ -2364,234 +2824,6 @@ function DragScroll({ direction = "vertical", className, style, children }) {
|
|
|
2364
2824
|
});
|
|
2365
2825
|
}
|
|
2366
2826
|
//#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
2827
|
//#region lib/types/components/schema-form.js
|
|
2596
2828
|
/** The closed literal set a property may take: its `enum`, or — for a union of
|
|
2597
2829
|
* scalar literals — the flattened `const` values of the `anyOf` branches, in
|
|
@@ -2733,10 +2965,10 @@ function schemaNodeOf(value) {
|
|
|
2733
2965
|
/** A ranged control with a large touch target and keyboard stepping. */
|
|
2734
2966
|
function Slider({ label, className, children, ...props }) {
|
|
2735
2967
|
return jsxs(SliderPrimitive.Root, {
|
|
2736
|
-
...part("slider", "root"),
|
|
2737
2968
|
className: cn("snap-slider", className),
|
|
2738
2969
|
"aria-label": label,
|
|
2739
2970
|
...props,
|
|
2971
|
+
...part("slider", "root"),
|
|
2740
2972
|
children: [
|
|
2741
2973
|
jsx(SliderPrimitive.Track, {
|
|
2742
2974
|
...part("slider", "track"),
|
|
@@ -2760,63 +2992,63 @@ function Slider({ label, className, children, ...props }) {
|
|
|
2760
2992
|
/** A content card. */
|
|
2761
2993
|
function Card({ className, children, ...props }) {
|
|
2762
2994
|
return jsx("div", {
|
|
2763
|
-
...part("card", "root"),
|
|
2764
2995
|
className: cn("snap-card", className),
|
|
2765
2996
|
...props,
|
|
2997
|
+
...part("card", "root"),
|
|
2766
2998
|
children
|
|
2767
2999
|
});
|
|
2768
3000
|
}
|
|
2769
3001
|
/** The card header region. */
|
|
2770
3002
|
function CardHeader({ className, children, ...props }) {
|
|
2771
3003
|
return jsx("div", {
|
|
2772
|
-
...part("card", "header"),
|
|
2773
3004
|
className: cn("snap-card-header", className),
|
|
2774
3005
|
...props,
|
|
3006
|
+
...part("card", "header"),
|
|
2775
3007
|
children
|
|
2776
3008
|
});
|
|
2777
3009
|
}
|
|
2778
3010
|
/** The card title. */
|
|
2779
3011
|
function CardTitle({ className, children, ...props }) {
|
|
2780
3012
|
return jsx("div", {
|
|
2781
|
-
...part("card", "title"),
|
|
2782
3013
|
className: cn("snap-card-title", className),
|
|
2783
3014
|
...props,
|
|
3015
|
+
...part("card", "title"),
|
|
2784
3016
|
children
|
|
2785
3017
|
});
|
|
2786
3018
|
}
|
|
2787
3019
|
/** The card description. */
|
|
2788
3020
|
function CardDescription({ className, children, ...props }) {
|
|
2789
3021
|
return jsx("div", {
|
|
2790
|
-
...part("card", "description"),
|
|
2791
3022
|
className: cn("snap-card-description", className),
|
|
2792
3023
|
...props,
|
|
3024
|
+
...part("card", "description"),
|
|
2793
3025
|
children
|
|
2794
3026
|
});
|
|
2795
3027
|
}
|
|
2796
3028
|
/** The card body. */
|
|
2797
3029
|
function CardContent({ className, children, ...props }) {
|
|
2798
3030
|
return jsx("div", {
|
|
2799
|
-
...part("card", "body"),
|
|
2800
3031
|
className: cn("snap-card-content", className),
|
|
2801
3032
|
...props,
|
|
3033
|
+
...part("card", "body"),
|
|
2802
3034
|
children
|
|
2803
3035
|
});
|
|
2804
3036
|
}
|
|
2805
3037
|
/** The card footer. */
|
|
2806
3038
|
function CardFooter({ className, children, ...props }) {
|
|
2807
3039
|
return jsx("div", {
|
|
2808
|
-
...part("card", "footer"),
|
|
2809
3040
|
className: cn("snap-card-footer", className),
|
|
2810
3041
|
...props,
|
|
3042
|
+
...part("card", "footer"),
|
|
2811
3043
|
children
|
|
2812
3044
|
});
|
|
2813
3045
|
}
|
|
2814
3046
|
/** A bounded panel with optional header/footer. */
|
|
2815
3047
|
function Panel({ title, actions, footer, className, children, ...props }) {
|
|
2816
3048
|
return jsxs("div", {
|
|
2817
|
-
...part("panel", "root"),
|
|
2818
3049
|
className: cn("snap-panel", className),
|
|
2819
3050
|
...props,
|
|
3051
|
+
...part("panel", "root"),
|
|
2820
3052
|
children: [
|
|
2821
3053
|
(title !== void 0 || actions !== void 0) && jsxs("div", {
|
|
2822
3054
|
...part("panel", "header"),
|
|
@@ -2853,45 +3085,45 @@ function Table({ className, children, ...props }) {
|
|
|
2853
3085
|
/** The table head. */
|
|
2854
3086
|
function TableHeader({ className, children, ...props }) {
|
|
2855
3087
|
return jsx("thead", {
|
|
2856
|
-
...part("table", "header"),
|
|
2857
3088
|
className: cn("snap-table-header", className),
|
|
2858
3089
|
...props,
|
|
3090
|
+
...part("table", "header"),
|
|
2859
3091
|
children
|
|
2860
3092
|
});
|
|
2861
3093
|
}
|
|
2862
3094
|
/** The table body. */
|
|
2863
3095
|
function TableBody({ className, children, ...props }) {
|
|
2864
3096
|
return jsx("tbody", {
|
|
2865
|
-
...part("table", "body"),
|
|
2866
3097
|
className: cn("snap-table-body", className),
|
|
2867
3098
|
...props,
|
|
3099
|
+
...part("table", "body"),
|
|
2868
3100
|
children
|
|
2869
3101
|
});
|
|
2870
3102
|
}
|
|
2871
3103
|
/** A table row. */
|
|
2872
3104
|
function TableRow({ className, children, ...props }) {
|
|
2873
3105
|
return jsx("tr", {
|
|
2874
|
-
...part("table", "row"),
|
|
2875
3106
|
className: cn("snap-table-row", className),
|
|
2876
3107
|
...props,
|
|
3108
|
+
...part("table", "row"),
|
|
2877
3109
|
children
|
|
2878
3110
|
});
|
|
2879
3111
|
}
|
|
2880
3112
|
/** A table header cell. */
|
|
2881
3113
|
function TableHead({ className, children, ...props }) {
|
|
2882
3114
|
return jsx("th", {
|
|
2883
|
-
...part("table", "head"),
|
|
2884
3115
|
className: cn("snap-table-head", className),
|
|
2885
3116
|
...props,
|
|
3117
|
+
...part("table", "head"),
|
|
2886
3118
|
children
|
|
2887
3119
|
});
|
|
2888
3120
|
}
|
|
2889
3121
|
/** A table body cell. */
|
|
2890
3122
|
function TableCell({ className, children, ...props }) {
|
|
2891
3123
|
return jsx("td", {
|
|
2892
|
-
...part("table", "cell"),
|
|
2893
3124
|
className: cn("snap-table-cell", className),
|
|
2894
3125
|
...props,
|
|
3126
|
+
...part("table", "cell"),
|
|
2895
3127
|
children
|
|
2896
3128
|
});
|
|
2897
3129
|
}
|
|
@@ -5073,4 +5305,4 @@ async function createClientRuntime(handle, options) {
|
|
|
5073
5305
|
};
|
|
5074
5306
|
}
|
|
5075
5307
|
//#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 };
|
|
5308
|
+
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, 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 };
|