@character-foundry/character-foundry 0.1.9 → 0.4.0-dev.1765938243

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/app-framework.cjs +291 -95
  2. package/dist/app-framework.cjs.map +1 -1
  3. package/dist/app-framework.d.cts +1 -1
  4. package/dist/app-framework.d.ts +1 -1
  5. package/dist/app-framework.js +292 -96
  6. package/dist/app-framework.js.map +1 -1
  7. package/dist/charx.cjs +44 -23
  8. package/dist/charx.cjs.map +1 -1
  9. package/dist/charx.d.cts +377 -207
  10. package/dist/charx.d.ts +377 -207
  11. package/dist/charx.js +44 -23
  12. package/dist/charx.js.map +1 -1
  13. package/dist/exporter.cjs +27 -22
  14. package/dist/exporter.cjs.map +1 -1
  15. package/dist/exporter.d.cts +377 -207
  16. package/dist/exporter.d.ts +377 -207
  17. package/dist/exporter.js +27 -22
  18. package/dist/exporter.js.map +1 -1
  19. package/dist/federation.cjs +16 -4
  20. package/dist/federation.cjs.map +1 -1
  21. package/dist/federation.d.cts +377 -207
  22. package/dist/federation.d.ts +377 -207
  23. package/dist/federation.js +16 -4
  24. package/dist/federation.js.map +1 -1
  25. package/dist/image-utils.cjs.map +1 -1
  26. package/dist/image-utils.d.cts +12 -0
  27. package/dist/image-utils.d.ts +12 -0
  28. package/dist/image-utils.js.map +1 -1
  29. package/dist/index.cjs +106 -56
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +729 -423
  32. package/dist/index.d.ts +729 -423
  33. package/dist/index.js +106 -56
  34. package/dist/index.js.map +1 -1
  35. package/dist/loader.cjs +106 -56
  36. package/dist/loader.cjs.map +1 -1
  37. package/dist/loader.d.cts +578 -318
  38. package/dist/loader.d.ts +578 -318
  39. package/dist/loader.js +106 -56
  40. package/dist/loader.js.map +1 -1
  41. package/dist/lorebook.cjs +5 -5
  42. package/dist/lorebook.cjs.map +1 -1
  43. package/dist/lorebook.d.cts +691 -381
  44. package/dist/lorebook.d.ts +691 -381
  45. package/dist/lorebook.js +5 -5
  46. package/dist/lorebook.js.map +1 -1
  47. package/dist/normalizer.cjs +33 -23
  48. package/dist/normalizer.cjs.map +1 -1
  49. package/dist/normalizer.d.cts +926 -560
  50. package/dist/normalizer.d.ts +926 -560
  51. package/dist/normalizer.js +33 -23
  52. package/dist/normalizer.js.map +1 -1
  53. package/dist/png.cjs +27 -22
  54. package/dist/png.cjs.map +1 -1
  55. package/dist/png.d.cts +528 -312
  56. package/dist/png.d.ts +528 -312
  57. package/dist/png.js +27 -22
  58. package/dist/png.js.map +1 -1
  59. package/dist/schemas.cjs +41 -26
  60. package/dist/schemas.cjs.map +1 -1
  61. package/dist/schemas.d.cts +1492 -896
  62. package/dist/schemas.d.ts +1492 -896
  63. package/dist/schemas.js +41 -26
  64. package/dist/schemas.js.map +1 -1
  65. package/dist/voxta.cjs +48 -25
  66. package/dist/voxta.cjs.map +1 -1
  67. package/dist/voxta.d.cts +578 -318
  68. package/dist/voxta.d.ts +578 -318
  69. package/dist/voxta.js +48 -25
  70. package/dist/voxta.js.map +1 -1
  71. package/package.json +6 -6
@@ -68,16 +68,19 @@ var import_jsx_runtime4 = require("react/jsx-runtime");
68
68
  var import_jsx_runtime5 = require("react/jsx-runtime");
69
69
  var import_react3 = require("react");
70
70
  var import_jsx_runtime6 = require("react/jsx-runtime");
71
- var import_react4 = require("react");
72
71
  var import_jsx_runtime7 = require("react/jsx-runtime");
73
- var import_react5 = require("react");
74
72
  var import_jsx_runtime8 = require("react/jsx-runtime");
75
- var import_react6 = require("react");
76
73
  var import_jsx_runtime9 = require("react/jsx-runtime");
74
+ var import_react4 = require("react");
77
75
  var import_jsx_runtime10 = require("react/jsx-runtime");
76
+ var import_react5 = require("react");
78
77
  var import_jsx_runtime11 = require("react/jsx-runtime");
79
- var import_react7 = require("react");
78
+ var import_react6 = require("react");
80
79
  var import_jsx_runtime12 = require("react/jsx-runtime");
80
+ var import_jsx_runtime13 = require("react/jsx-runtime");
81
+ var import_jsx_runtime14 = require("react/jsx-runtime");
82
+ var import_react7 = require("react");
83
+ var import_jsx_runtime15 = require("react/jsx-runtime");
81
84
  var noopServices = {
82
85
  toast: {
83
86
  success: () => {
@@ -352,20 +355,25 @@ function analyzeField(name, zodType) {
352
355
  let isNullable = false;
353
356
  let defaultValue;
354
357
  const description = getDescription(zodType);
355
- if (currentType instanceof import_zod3.z.ZodOptional) {
356
- isOptional = true;
357
- currentType = currentType.unwrap();
358
- }
359
- if (currentType instanceof import_zod3.z.ZodNullable) {
360
- isNullable = true;
361
- currentType = currentType.unwrap();
362
- }
363
- if (currentType instanceof import_zod3.z.ZodDefault) {
364
- defaultValue = currentType._def.defaultValue();
365
- currentType = currentType._def.innerType;
366
- }
367
- if (currentType instanceof import_zod3.z.ZodEffects) {
368
- currentType = currentType._def.schema;
358
+ let unwrapping = true;
359
+ while (unwrapping) {
360
+ unwrapping = false;
361
+ if (currentType instanceof import_zod3.z.ZodOptional) {
362
+ isOptional = true;
363
+ currentType = currentType.unwrap();
364
+ unwrapping = true;
365
+ } else if (currentType instanceof import_zod3.z.ZodNullable) {
366
+ isNullable = true;
367
+ currentType = currentType.unwrap();
368
+ unwrapping = true;
369
+ } else if (currentType instanceof import_zod3.z.ZodDefault) {
370
+ defaultValue = currentType._def.defaultValue();
371
+ currentType = currentType._def.innerType;
372
+ unwrapping = true;
373
+ } else if (currentType instanceof import_zod3.z.ZodEffects) {
374
+ currentType = currentType._def.schema;
375
+ unwrapping = true;
376
+ }
369
377
  }
370
378
  if (currentType instanceof import_zod3.z.ZodUnion) {
371
379
  const options = currentType._def.options;
@@ -970,7 +978,7 @@ function SearchableSelect({
970
978
  type: "button",
971
979
  id,
972
980
  onClick: handleOpen,
973
- disabled,
981
+ disabled: disabled || hint?.readOnly,
974
982
  "aria-haspopup": "listbox",
975
983
  "aria-expanded": isOpen,
976
984
  "aria-labelledby": `${id}-label`,
@@ -1028,6 +1036,191 @@ function SearchableSelect({
1028
1036
  }
1029
1037
  );
1030
1038
  }
1039
+ function RadioGroup({
1040
+ value,
1041
+ onChange,
1042
+ name,
1043
+ label,
1044
+ error,
1045
+ disabled,
1046
+ required,
1047
+ hint
1048
+ }) {
1049
+ const id = `field-${name}`;
1050
+ const errorId = `${id}-error`;
1051
+ const helperId = `${id}-helper`;
1052
+ const hasError = Boolean(error);
1053
+ const hasHelper = Boolean(hint?.helperText);
1054
+ const options = hint?.options ?? [];
1055
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: hint?.className, "data-field": name, "data-error": hasError, children: [
1056
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("fieldset", { "data-radio-group": true, children: [
1057
+ label && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("legend", { "data-radio-legend": true, children: [
1058
+ label,
1059
+ required && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": "true", "data-required": true, children: "*" })
1060
+ ] }),
1061
+ hasHelper && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { id: helperId, "data-helper": true, children: hint?.helperText }),
1062
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { "data-radio-options": true, role: "radiogroup", "aria-required": required, children: options.map((opt, index) => {
1063
+ const optionId = `${id}-${index}`;
1064
+ const isChecked = value === opt.value;
1065
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1066
+ "label",
1067
+ {
1068
+ htmlFor: optionId,
1069
+ "data-radio-option": true,
1070
+ "data-checked": isChecked,
1071
+ children: [
1072
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1073
+ "input",
1074
+ {
1075
+ id: optionId,
1076
+ type: "radio",
1077
+ name,
1078
+ value: opt.value,
1079
+ checked: isChecked,
1080
+ onChange: (e) => onChange(e.target.value),
1081
+ disabled: disabled || hint?.readOnly,
1082
+ "aria-invalid": hasError,
1083
+ "aria-describedby": [hasError && errorId, hasHelper && helperId].filter(Boolean).join(" ") || void 0
1084
+ }
1085
+ ),
1086
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "data-radio-label": true, children: opt.label })
1087
+ ]
1088
+ },
1089
+ opt.value
1090
+ );
1091
+ }) })
1092
+ ] }),
1093
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { id: errorId, role: "alert", "data-error-message": true, children: error })
1094
+ ] });
1095
+ }
1096
+ function Slider({
1097
+ value,
1098
+ onChange,
1099
+ name,
1100
+ label,
1101
+ error,
1102
+ disabled,
1103
+ required,
1104
+ hint
1105
+ }) {
1106
+ const id = `field-${name}`;
1107
+ const errorId = `${id}-error`;
1108
+ const helperId = `${id}-helper`;
1109
+ const valueId = `${id}-value`;
1110
+ const hasError = Boolean(error);
1111
+ const hasHelper = Boolean(hint?.helperText);
1112
+ const min = hint?.min ?? 0;
1113
+ const max = hint?.max ?? 100;
1114
+ const step = hint?.step ?? 1;
1115
+ const currentValue = value ?? min;
1116
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: hint?.className, "data-field": name, "data-error": hasError, children: [
1117
+ label && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { htmlFor: id, "data-slider-label": true, children: [
1118
+ label,
1119
+ required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "aria-hidden": "true", "data-required": true, children: "*" })
1120
+ ] }),
1121
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { "data-slider-container": true, children: [
1122
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1123
+ "input",
1124
+ {
1125
+ id,
1126
+ type: "range",
1127
+ name,
1128
+ value: currentValue,
1129
+ min,
1130
+ max,
1131
+ step,
1132
+ onChange: (e) => onChange(Number(e.target.value)),
1133
+ disabled: disabled || hint?.readOnly,
1134
+ "aria-invalid": hasError,
1135
+ "aria-valuemin": min,
1136
+ "aria-valuemax": max,
1137
+ "aria-valuenow": currentValue,
1138
+ "aria-describedby": [valueId, hasError && errorId, hasHelper && helperId].filter(Boolean).join(" ") || void 0,
1139
+ "aria-required": required
1140
+ }
1141
+ ),
1142
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("output", { id: valueId, htmlFor: id, "data-slider-value": true, children: currentValue })
1143
+ ] }),
1144
+ hasHelper && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { id: helperId, "data-helper": true, children: hint?.helperText }),
1145
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { id: errorId, role: "alert", "data-error-message": true, children: error })
1146
+ ] });
1147
+ }
1148
+ function ColorPicker({
1149
+ value,
1150
+ onChange,
1151
+ name,
1152
+ label,
1153
+ error,
1154
+ disabled,
1155
+ required,
1156
+ hint
1157
+ }) {
1158
+ const id = `field-${name}`;
1159
+ const textId = `${id}-text`;
1160
+ const errorId = `${id}-error`;
1161
+ const helperId = `${id}-helper`;
1162
+ const hasError = Boolean(error);
1163
+ const hasHelper = Boolean(hint?.helperText);
1164
+ const currentValue = value || "#000000";
1165
+ const normalizeHex = (hex) => {
1166
+ let clean = hex.replace(/^#/, "");
1167
+ if (clean.length === 3) {
1168
+ clean = clean.split("").map((c) => c + c).join("");
1169
+ }
1170
+ if (/^[0-9a-fA-F]{6}$/.test(clean)) {
1171
+ return `#${clean.toLowerCase()}`;
1172
+ }
1173
+ return currentValue;
1174
+ };
1175
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: hint?.className, "data-field": name, "data-error": hasError, children: [
1176
+ label && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { htmlFor: id, "data-color-label": true, children: [
1177
+ label,
1178
+ required && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-hidden": "true", "data-required": true, children: "*" })
1179
+ ] }),
1180
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { "data-color-container": true, children: [
1181
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1182
+ "input",
1183
+ {
1184
+ id,
1185
+ type: "color",
1186
+ name,
1187
+ value: currentValue,
1188
+ onChange: (e) => onChange(e.target.value),
1189
+ disabled: disabled || hint?.readOnly,
1190
+ "aria-invalid": hasError,
1191
+ "aria-describedby": [hasError && errorId, hasHelper && helperId].filter(Boolean).join(" ") || void 0,
1192
+ "aria-required": required
1193
+ }
1194
+ ),
1195
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1196
+ "input",
1197
+ {
1198
+ id: textId,
1199
+ type: "text",
1200
+ value: currentValue,
1201
+ onChange: (e) => {
1202
+ const normalized = normalizeHex(e.target.value);
1203
+ onChange(normalized);
1204
+ },
1205
+ onBlur: (e) => {
1206
+ const normalized = normalizeHex(e.target.value);
1207
+ if (normalized !== e.target.value) {
1208
+ onChange(normalized);
1209
+ }
1210
+ },
1211
+ disabled: disabled || hint?.readOnly,
1212
+ placeholder: "#000000",
1213
+ pattern: "^#[0-9a-fA-F]{6}$",
1214
+ maxLength: 7,
1215
+ "data-color-text": true,
1216
+ "aria-label": `${label} hex value`
1217
+ }
1218
+ )
1219
+ ] }),
1220
+ hasHelper && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { id: helperId, "data-helper": true, children: hint?.helperText }),
1221
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { id: errorId, role: "alert", "data-error-message": true, children: error })
1222
+ ] });
1223
+ }
1031
1224
  function TagInput({
1032
1225
  value,
1033
1226
  onChange,
@@ -1077,15 +1270,15 @@ function TagInput({
1077
1270
  addTag(inputValue);
1078
1271
  }
1079
1272
  }, [inputValue, addTag]);
1080
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: hint?.className, "data-field": name, "data-error": hasError, children: [
1081
- label && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { htmlFor: id, children: [
1273
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: hint?.className, "data-field": name, "data-error": hasError, children: [
1274
+ label && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { htmlFor: id, children: [
1082
1275
  label,
1083
- required && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": "true", "data-required": true, children: "*" })
1276
+ required && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", "data-required": true, children: "*" })
1084
1277
  ] }),
1085
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-tag-container": true, children: [
1086
- tags.map((tag, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { "data-tag": true, children: [
1278
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { "data-tag-container": true, children: [
1279
+ tags.map((tag, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { "data-tag": true, children: [
1087
1280
  tag,
1088
- !disabled && !hint?.readOnly && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1281
+ !disabled && !hint?.readOnly && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1089
1282
  "button",
1090
1283
  {
1091
1284
  type: "button",
@@ -1096,7 +1289,7 @@ function TagInput({
1096
1289
  }
1097
1290
  )
1098
1291
  ] }, `${tag}-${index}`)),
1099
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1292
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1100
1293
  "input",
1101
1294
  {
1102
1295
  id,
@@ -1114,8 +1307,8 @@ function TagInput({
1114
1307
  }
1115
1308
  )
1116
1309
  ] }),
1117
- hasHelper && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { id: helperId, "data-helper": true, children: hint?.helperText }),
1118
- hasError && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { id: errorId, role: "alert", "data-error-message": true, children: error })
1310
+ hasHelper && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { id: helperId, "data-helper": true, children: hint?.helperText }),
1311
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { id: errorId, role: "alert", "data-error-message": true, children: error })
1119
1312
  ] });
1120
1313
  }
1121
1314
  function SecretInput({
@@ -1137,13 +1330,13 @@ function SecretInput({
1137
1330
  const toggleVisibility = (0, import_react5.useCallback)(() => {
1138
1331
  setShowValue((prev) => !prev);
1139
1332
  }, []);
1140
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: hint?.className, "data-field": name, "data-error": hasError, children: [
1141
- label && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { htmlFor: id, children: [
1333
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: hint?.className, "data-field": name, "data-error": hasError, children: [
1334
+ label && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { htmlFor: id, children: [
1142
1335
  label,
1143
- required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "aria-hidden": "true", "data-required": true, children: "*" })
1336
+ required && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", "data-required": true, children: "*" })
1144
1337
  ] }),
1145
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { "data-secret-container": true, children: [
1146
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1338
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { "data-secret-container": true, children: [
1339
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1147
1340
  "input",
1148
1341
  {
1149
1342
  id,
@@ -1161,7 +1354,7 @@ function SecretInput({
1161
1354
  "data-secret-input": true
1162
1355
  }
1163
1356
  ),
1164
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1357
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1165
1358
  "button",
1166
1359
  {
1167
1360
  type: "button",
@@ -1173,8 +1366,8 @@ function SecretInput({
1173
1366
  }
1174
1367
  )
1175
1368
  ] }),
1176
- hasHelper && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { id: helperId, "data-helper": true, children: hint?.helperText }),
1177
- hasError && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { id: errorId, role: "alert", "data-error-message": true, children: error })
1369
+ hasHelper && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { id: helperId, "data-helper": true, children: hint?.helperText }),
1370
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { id: errorId, role: "alert", "data-error-message": true, children: error })
1178
1371
  ] });
1179
1372
  }
1180
1373
  function FileUpload({
@@ -1311,12 +1504,12 @@ function FileUpload({
1311
1504
  );
1312
1505
  const displayError = error ?? localError;
1313
1506
  const files = multiple ? Array.isArray(value) ? value : [] : value instanceof File ? [value] : [];
1314
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: hint?.className, "data-field": name, "data-error": Boolean(displayError), children: [
1315
- label && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { htmlFor: id, children: [
1507
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: hint?.className, "data-field": name, "data-error": Boolean(displayError), children: [
1508
+ label && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { htmlFor: id, children: [
1316
1509
  label,
1317
- required && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-hidden": "true", "data-required": true, children: "*" })
1510
+ required && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "aria-hidden": "true", "data-required": true, children: "*" })
1318
1511
  ] }),
1319
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1512
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1320
1513
  "div",
1321
1514
  {
1322
1515
  "data-file-dropzone": true,
@@ -1327,10 +1520,10 @@ function FileUpload({
1327
1520
  onDrop: handleDrop,
1328
1521
  onClick: handleClick,
1329
1522
  role: "button",
1330
- tabIndex: disabled ? -1 : 0,
1523
+ tabIndex: disabled || hint?.readOnly ? -1 : 0,
1331
1524
  "aria-describedby": [Boolean(displayError) && errorId, hasHelper && helperId].filter(Boolean).join(" ") || void 0,
1332
1525
  children: [
1333
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1526
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1334
1527
  "input",
1335
1528
  {
1336
1529
  ref: inputRef,
@@ -1339,21 +1532,21 @@ function FileUpload({
1339
1532
  name,
1340
1533
  accept,
1341
1534
  multiple,
1342
- disabled,
1535
+ disabled: disabled || hint?.readOnly,
1343
1536
  onChange: handleChange,
1344
1537
  "aria-invalid": Boolean(displayError),
1345
1538
  "aria-required": required,
1346
1539
  "data-file-input": true
1347
1540
  }
1348
1541
  ),
1349
- files.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { "data-file-placeholder": true, children: hint?.placeholder ?? (isDragging ? "Drop files here..." : "Click or drag files to upload") }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { "data-file-list": true, children: files.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("li", { "data-file-item": true, children: [
1350
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "data-file-name": true, children: file.name }),
1351
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { "data-file-size": true, children: [
1542
+ files.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { "data-file-placeholder": true, children: hint?.placeholder ?? (isDragging ? "Drop files here..." : "Click or drag files to upload") }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { "data-file-list": true, children: files.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { "data-file-item": true, children: [
1543
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "data-file-name": true, children: file.name }),
1544
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { "data-file-size": true, children: [
1352
1545
  "(",
1353
1546
  formatFileSize(file.size),
1354
1547
  ")"
1355
1548
  ] }),
1356
- !disabled && !hint?.readOnly && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1549
+ !disabled && !hint?.readOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1357
1550
  "button",
1358
1551
  {
1359
1552
  type: "button",
@@ -1370,8 +1563,8 @@ function FileUpload({
1370
1563
  ]
1371
1564
  }
1372
1565
  ),
1373
- hasHelper && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { id: helperId, "data-helper": true, children: hint?.helperText }),
1374
- displayError && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { id: errorId, role: "alert", "data-error-message": true, children: displayError })
1566
+ hasHelper && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { id: helperId, "data-helper": true, children: hint?.helperText }),
1567
+ displayError && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { id: errorId, role: "alert", "data-error-message": true, children: displayError })
1375
1568
  ] });
1376
1569
  }
1377
1570
  function formatFileSize(bytes) {
@@ -1387,15 +1580,15 @@ var BUILTIN_WIDGETS = {
1387
1580
  checkbox: Switch,
1388
1581
  select: Select,
1389
1582
  "searchable-select": SearchableSelect,
1390
- radio: Select,
1391
- // Could be RadioGroup
1583
+ radio: RadioGroup,
1584
+ "radio-group": RadioGroup,
1392
1585
  password: SecretInput,
1393
1586
  "tag-input": TagInput,
1394
1587
  "file-upload": FileUpload,
1395
- slider: NumberInput,
1396
- // Could be Slider widget
1397
- "color-picker": TextInput
1398
- // Could be ColorPicker widget
1588
+ slider: Slider,
1589
+ range: Slider,
1590
+ "color-picker": ColorPicker,
1591
+ color: ColorPicker
1399
1592
  };
1400
1593
  var TYPE_TO_WIDGET = {
1401
1594
  ZodString: TextInput,
@@ -1418,16 +1611,16 @@ function FieldRenderer({
1418
1611
  if (fieldInfo.typeName === "ZodObject" && fieldInfo.nestedFields && renderNestedField) {
1419
1612
  const nestedFields = Array.from(fieldInfo.nestedFields.values());
1420
1613
  const fieldBaseName2 = fieldInfo.name.split(".").pop() ?? fieldInfo.name;
1421
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { "data-nested-object": true, "data-field": fieldInfo.name, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("fieldset", { "data-nested-fieldset": true, children: [
1422
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("legend", { "data-nested-legend": true, children: hint?.label ?? fieldInfo.description ?? formatLabel(fieldBaseName2) }),
1423
- hint?.helperText && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { "data-helper": true, children: hint.helperText }),
1424
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { "data-nested-fields": true, children: nestedFields.map((nestedInfo) => renderNestedField(nestedInfo)) })
1614
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { "data-nested-object": true, "data-field": fieldInfo.name, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("fieldset", { "data-nested-fieldset": true, children: [
1615
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("legend", { "data-nested-legend": true, children: hint?.label ?? fieldInfo.description ?? formatLabel(fieldBaseName2) }),
1616
+ hint?.helperText && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { "data-helper": true, children: hint.helperText }),
1617
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { "data-nested-fields": true, children: nestedFields.map((nestedInfo) => renderNestedField(nestedInfo)) })
1425
1618
  ] }) });
1426
1619
  }
1427
1620
  let Widget;
1428
1621
  if (hint?.widget) {
1429
1622
  if (typeof hint.widget === "string") {
1430
- Widget = BUILTIN_WIDGETS[hint.widget] ?? widgetRegistry2.getComponent(hint.widget) ?? TextInput;
1623
+ Widget = widgetRegistry2.getComponent(hint.widget) ?? BUILTIN_WIDGETS[hint.widget] ?? TextInput;
1431
1624
  } else {
1432
1625
  Widget = hint.widget;
1433
1626
  }
@@ -1462,11 +1655,30 @@ function FieldRenderer({
1462
1655
  max: hint?.max ?? fieldInfo.constraints?.max ?? fieldInfo.constraints?.maxLength
1463
1656
  }
1464
1657
  };
1465
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Widget, { ...props });
1658
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Widget, { ...props });
1466
1659
  }
1467
1660
  function formatLabel(name) {
1468
1661
  return name.replace(/([A-Z])/g, " $1").replace(/_/g, " ").replace(/^\w/, (c) => c.toUpperCase()).trim();
1469
1662
  }
1663
+ var HINT_KEYS = /* @__PURE__ */ new Set([
1664
+ "widget",
1665
+ "label",
1666
+ "placeholder",
1667
+ "helperText",
1668
+ "hidden",
1669
+ "readOnly",
1670
+ "className",
1671
+ "condition",
1672
+ "group",
1673
+ "rows",
1674
+ "accept",
1675
+ "multiple",
1676
+ "maxSize",
1677
+ "options",
1678
+ "searchable",
1679
+ "searchPlaceholder",
1680
+ "noResultsText"
1681
+ ]);
1470
1682
  function AutoForm({
1471
1683
  schema,
1472
1684
  values,
@@ -1526,7 +1738,9 @@ function AutoForm({
1526
1738
  fields.add(condition.field);
1527
1739
  }
1528
1740
  }
1529
- if (!("widget" in hint) && !("label" in hint) && !("condition" in hint)) {
1741
+ const hintKeys = Object.keys(hint);
1742
+ const isHintObject = hintKeys.length > 0 && hintKeys.every((k) => HINT_KEYS.has(k));
1743
+ if (!isHintObject) {
1530
1744
  extractConditionFields(hint, prefix ? `${prefix}.${key}` : key);
1531
1745
  }
1532
1746
  }
@@ -1578,28 +1792,10 @@ function AutoForm({
1578
1792
  });
1579
1793
  return () => subscription.unsubscribe();
1580
1794
  }, [watch]);
1581
- const HINT_KEYS = /* @__PURE__ */ new Set([
1582
- "widget",
1583
- "label",
1584
- "placeholder",
1585
- "helperText",
1586
- "hidden",
1587
- "readOnly",
1588
- "className",
1589
- "condition",
1590
- "group",
1591
- "rows",
1592
- "accept",
1593
- "multiple",
1594
- "maxSize",
1595
- "options",
1596
- "searchable",
1597
- "searchPlaceholder",
1598
- "noResultsText"
1599
- ]);
1600
1795
  const isFieldUIHint = (0, import_react.useCallback)((obj) => {
1601
1796
  if (!obj || typeof obj !== "object") return false;
1602
- return Object.keys(obj).some((key) => HINT_KEYS.has(key));
1797
+ const keys = Object.keys(obj);
1798
+ return keys.length > 0 && keys.every((key) => HINT_KEYS.has(key));
1603
1799
  }, []);
1604
1800
  const getHint = (0, import_react.useCallback)(
1605
1801
  (fieldName) => {
@@ -1657,12 +1853,12 @@ function AutoForm({
1657
1853
  const hint = getHint(fieldInfo.name);
1658
1854
  if (hint?.hidden) return null;
1659
1855
  if (!isConditionMet(hint?.condition)) return null;
1660
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1856
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1661
1857
  import_react_hook_form.Controller,
1662
1858
  {
1663
1859
  name: fieldInfo.name,
1664
1860
  control,
1665
- render: ({ field, fieldState }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1861
+ render: ({ field, fieldState }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1666
1862
  FieldRenderer,
1667
1863
  {
1668
1864
  fieldInfo,
@@ -1707,7 +1903,7 @@ function AutoForm({
1707
1903
  },
1708
1904
  [flatFieldInfoMap, getField, getHint]
1709
1905
  );
1710
- const submitButton = withSubmit ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1906
+ const submitButton = withSubmit ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1711
1907
  "button",
1712
1908
  {
1713
1909
  type: "submit",
@@ -1716,7 +1912,7 @@ function AutoForm({
1716
1912
  children: formState.isSubmitting ? "Submitting..." : submitText
1717
1913
  }
1718
1914
  ) : null;
1719
- const formContent = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_hook_form.FormProvider, { ...methods, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("form", { onSubmit: onFormSubmit, className, "data-autoform": true, children: children ? children({
1915
+ const formContent = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_hook_form.FormProvider, { ...methods, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("form", { onSubmit: onFormSubmit, className, "data-autoform": true, children: children ? children({
1720
1916
  fields: renderedFields,
1721
1917
  submit: submitButton,
1722
1918
  formState: {
@@ -1726,12 +1922,12 @@ function AutoForm({
1726
1922
  },
1727
1923
  getField,
1728
1924
  getFieldsByGroup
1729
- }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1925
+ }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1730
1926
  renderedFields,
1731
1927
  submitButton
1732
1928
  ] }) }) });
1733
1929
  if (widgetRegistry2) {
1734
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(WidgetRegistryContext.Provider, { value: widgetRegistry2, children: formContent });
1930
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(WidgetRegistryContext.Provider, { value: widgetRegistry2, children: formContent });
1735
1931
  }
1736
1932
  return formContent;
1737
1933
  }
@@ -1817,7 +2013,7 @@ function FieldGroup({
1817
2013
  }, [collapsible]);
1818
2014
  const headerId = `fieldgroup-${title.toLowerCase().replace(/\s+/g, "-")}`;
1819
2015
  const contentId = `${headerId}-content`;
1820
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2016
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1821
2017
  "fieldset",
1822
2018
  {
1823
2019
  className,
@@ -1825,7 +2021,7 @@ function FieldGroup({
1825
2021
  "data-collapsible": collapsible,
1826
2022
  "data-collapsed": isCollapsed,
1827
2023
  children: [
1828
- collapsible ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("legend", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2024
+ collapsible ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("legend", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1829
2025
  "button",
1830
2026
  {
1831
2027
  type: "button",
@@ -1834,13 +2030,13 @@ function FieldGroup({
1834
2030
  "aria-controls": contentId,
1835
2031
  "data-fieldgroup-toggle": true,
1836
2032
  children: [
1837
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "data-fieldgroup-arrow": true, "aria-hidden": "true", children: isCollapsed ? "\u25B6" : "\u25BC" }),
1838
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { id: headerId, "data-fieldgroup-title": true, children: title })
2033
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "data-fieldgroup-arrow": true, "aria-hidden": "true", children: isCollapsed ? "\u25B6" : "\u25BC" }),
2034
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { id: headerId, "data-fieldgroup-title": true, children: title })
1839
2035
  ]
1840
2036
  }
1841
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("legend", { id: headerId, "data-fieldgroup-title": true, children: title }),
1842
- description && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { "data-fieldgroup-description": true, children: description }),
1843
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2037
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("legend", { id: headerId, "data-fieldgroup-title": true, children: title }),
2038
+ description && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { "data-fieldgroup-description": true, children: description }),
2039
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1844
2040
  "div",
1845
2041
  {
1846
2042
  id: contentId,