@skygraph/react 0.5.2 → 0.5.3

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 (49) hide show
  1. package/README.md +70 -70
  2. package/dist/{Table-BmesoMje.d.ts → Table-CAay8MmA.d.ts} +8 -1
  3. package/dist/{Table-CpKMOH2x.d.cts → Table-CMKo6Pc3.d.cts} +8 -1
  4. package/dist/{chunk-ZJF6SJLP.js → chunk-45YW5VSP.js} +44 -10
  5. package/dist/chunk-45YW5VSP.js.map +1 -0
  6. package/dist/{chunk-Z5UGF7EO.js → chunk-EFDB2ENB.js} +87 -25
  7. package/dist/chunk-EFDB2ENB.js.map +1 -0
  8. package/dist/{chunk-UO6VJC3C.js → chunk-KGFFQGCM.js} +3 -3
  9. package/dist/{chunk-NXB3VAVF.js → chunk-P4J4PFBG.js} +54 -7
  10. package/dist/chunk-P4J4PFBG.js.map +1 -0
  11. package/dist/{chunk-FSV73JI4.js → chunk-PEX2UTNG.js} +2 -2
  12. package/dist/chunk-VLRLCHEL.js +184 -0
  13. package/dist/chunk-VLRLCHEL.js.map +1 -0
  14. package/dist/{chunk-MLEBVELO.js → chunk-YTPUWPWA.js} +51 -46
  15. package/dist/chunk-YTPUWPWA.js.map +1 -0
  16. package/dist/{chunk-GJDDPZH7.js → chunk-ZJC2QUWA.js} +12 -12
  17. package/dist/chunk-ZJC2QUWA.js.map +1 -0
  18. package/dist/datagrid.cjs +76 -21
  19. package/dist/datagrid.cjs.map +1 -1
  20. package/dist/datagrid.js +3 -3
  21. package/dist/devtools.cjs +11 -11
  22. package/dist/devtools.cjs.map +1 -1
  23. package/dist/devtools.js +1 -1
  24. package/dist/form.cjs +127 -86
  25. package/dist/form.cjs.map +1 -1
  26. package/dist/form.js +3 -3
  27. package/dist/index.cjs +1293 -935
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +153 -7
  30. package/dist/index.d.ts +153 -7
  31. package/dist/index.js +255 -131
  32. package/dist/index.js.map +1 -1
  33. package/dist/table.cjs +252 -169
  34. package/dist/table.cjs.map +1 -1
  35. package/dist/table.d.cts +1 -1
  36. package/dist/table.d.ts +1 -1
  37. package/dist/table.js +4 -4
  38. package/dist/tree.cjs.map +1 -1
  39. package/dist/tree.js +3 -3
  40. package/package.json +2 -2
  41. package/dist/chunk-2OCEO636.js +0 -91
  42. package/dist/chunk-2OCEO636.js.map +0 -1
  43. package/dist/chunk-GJDDPZH7.js.map +0 -1
  44. package/dist/chunk-MLEBVELO.js.map +0 -1
  45. package/dist/chunk-NXB3VAVF.js.map +0 -1
  46. package/dist/chunk-Z5UGF7EO.js.map +0 -1
  47. package/dist/chunk-ZJF6SJLP.js.map +0 -1
  48. /package/dist/{chunk-UO6VJC3C.js.map → chunk-KGFFQGCM.js.map} +0 -0
  49. /package/dist/{chunk-FSV73JI4.js.map → chunk-PEX2UTNG.js.map} +0 -0
package/dist/form.cjs CHANGED
@@ -421,7 +421,10 @@ function Form({
421
421
  }
422
422
 
423
423
  // src/components/complex/Field.tsx
424
- var import_react13 = require("react");
424
+ var import_react14 = require("react");
425
+
426
+ // src/components/ui/Input.tsx
427
+ var import_react10 = __toESM(require("react"), 1);
425
428
 
426
429
  // src/components/ui/Spin.tsx
427
430
  var import_react9 = __toESM(require("react"), 1);
@@ -498,9 +501,14 @@ function Input({
498
501
  size: sizeProp,
499
502
  disabled: disabledProp,
500
503
  loading,
504
+ allowClear = false,
505
+ status,
506
+ prefix,
507
+ suffix,
501
508
  onChange,
502
509
  onBlur,
503
510
  onFocus,
511
+ onClear,
504
512
  "aria-invalid": ariaInvalid,
505
513
  "aria-required": ariaRequired,
506
514
  "aria-describedby": ariaDescribedBy,
@@ -512,45 +520,73 @@ function Input({
512
520
  const config = useConfig();
513
521
  const size = sizeProp ?? config.size ?? "middle";
514
522
  const disabled = disabledProp ?? config.disabled ?? false;
523
+ const [internalValue, setInternalValue] = import_react10.default.useState(defaultValue ?? "");
524
+ const currentValue = value ?? internalValue;
525
+ const isControlled = value !== void 0;
515
526
  const wrapperClasses = unstyled ? className ?? "" : [
516
527
  "sg-input-wrapper",
517
528
  `sg-input-wrapper-${size}`,
518
529
  loading ? "sg-input-wrapper-loading" : "",
519
530
  readOnly ? "sg-input-wrapper-readonly" : "",
531
+ status ? `sg-input-wrapper-status-${status}` : "",
520
532
  className
521
533
  ].filter(Boolean).join(" ");
522
534
  const inputClasses = unstyled ? "" : [
523
535
  "sg-input",
524
536
  `sg-input-${size}`,
525
- readOnly ? "sg-input-readonly" : ""
537
+ readOnly ? "sg-input-readonly" : "",
538
+ status ? `sg-input-status-${status}` : ""
526
539
  ].filter(Boolean).join(" ");
540
+ const clearLabel = config.locale?.input?.clear ?? "Clear";
541
+ const showClear = allowClear && !disabled && !readOnly && !loading && currentValue !== "";
542
+ const handleChange = (e) => {
543
+ if (!isControlled) setInternalValue(e.target.value);
544
+ onChange?.(e.target.value);
545
+ };
546
+ const handleClear = () => {
547
+ if (!isControlled) setInternalValue("");
548
+ onChange?.("");
549
+ onClear?.();
550
+ };
551
+ const resolvedAriaInvalid = ariaInvalid ?? (status === "error" ? true : void 0);
527
552
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: wrapperClasses, style, children: [
553
+ prefix && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sg-input-prefix", children: prefix }),
528
554
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
529
555
  "input",
530
556
  {
531
557
  id,
532
558
  type,
533
559
  className: inputClasses,
534
- value,
535
- defaultValue,
560
+ value: currentValue,
536
561
  placeholder,
537
562
  disabled: disabled || loading,
538
563
  readOnly,
539
- "aria-invalid": ariaInvalid,
564
+ "aria-invalid": resolvedAriaInvalid,
540
565
  "aria-required": ariaRequired,
541
566
  "aria-readonly": readOnly || void 0,
542
567
  "aria-describedby": ariaDescribedBy,
543
- onChange: (e) => onChange?.(e.target.value),
568
+ onChange: handleChange,
544
569
  onBlur,
545
570
  onFocus
546
571
  }
547
572
  ),
548
- loading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spin, { size: "small", unstyled })
573
+ showClear && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
574
+ "button",
575
+ {
576
+ type: "button",
577
+ className: "sg-input-clear",
578
+ "aria-label": clearLabel,
579
+ onClick: handleClear,
580
+ children: "\xD7"
581
+ }
582
+ ),
583
+ loading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spin, { size: "small", unstyled }),
584
+ suffix && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sg-input-suffix", children: suffix })
549
585
  ] });
550
586
  }
551
587
 
552
588
  // src/components/ui/Textarea.tsx
553
- var import_react10 = __toESM(require("react"), 1);
589
+ var import_react11 = __toESM(require("react"), 1);
554
590
  var import_jsx_runtime6 = require("react/jsx-runtime");
555
591
  function Textarea({
556
592
  value,
@@ -576,7 +612,7 @@ function Textarea({
576
612
  const config = useConfig();
577
613
  const disabled = disabledProp ?? config.disabled;
578
614
  const size = sizeProp ?? config.size ?? "middle";
579
- const [internalValue, setInternalValue] = import_react10.default.useState(value ?? defaultValue ?? "");
615
+ const [internalValue, setInternalValue] = import_react11.default.useState(value ?? defaultValue ?? "");
580
616
  const currentValue = value ?? internalValue;
581
617
  const handleChange = (e) => {
582
618
  const v = e.target.value;
@@ -613,10 +649,10 @@ function Textarea({
613
649
  }
614
650
 
615
651
  // src/components/ui/Tooltip.tsx
616
- var import_react12 = require("react");
652
+ var import_react13 = require("react");
617
653
 
618
654
  // src/components/ui/Transition.tsx
619
- var import_react11 = __toESM(require("react"), 1);
655
+ var import_react12 = __toESM(require("react"), 1);
620
656
  function Transition({
621
657
  visible,
622
658
  name = "sg-fade",
@@ -630,20 +666,20 @@ function Transition({
630
666
  children,
631
667
  unmountOnExit = true
632
668
  }) {
633
- const [mounted, setMounted] = (0, import_react11.useState)(visible);
634
- const [phase, setPhase] = (0, import_react11.useState)(visible ? "idle" : "idle");
635
- const nodeRef = (0, import_react11.useRef)(null);
636
- const timerRef = (0, import_react11.useRef)(void 0);
637
- const prevVisible = (0, import_react11.useRef)(visible);
638
- const getEnterClasses = (0, import_react11.useCallback)(() => {
669
+ const [mounted, setMounted] = (0, import_react12.useState)(visible);
670
+ const [phase, setPhase] = (0, import_react12.useState)(visible ? "idle" : "idle");
671
+ const nodeRef = (0, import_react12.useRef)(null);
672
+ const timerRef = (0, import_react12.useRef)(void 0);
673
+ const prevVisible = (0, import_react12.useRef)(visible);
674
+ const getEnterClasses = (0, import_react12.useCallback)(() => {
639
675
  if (enterFrom && enterTo) return { from: enterFrom, active: `${name}-enter-active`, to: enterTo };
640
676
  return { from: `${name}-enter-from`, active: `${name}-enter-active`, to: `${name}-enter-to` };
641
677
  }, [name, enterFrom, enterTo]);
642
- const getLeaveClasses = (0, import_react11.useCallback)(() => {
678
+ const getLeaveClasses = (0, import_react12.useCallback)(() => {
643
679
  if (leaveFrom && leaveTo) return { from: leaveFrom, active: `${name}-leave-active`, to: leaveTo };
644
680
  return { from: `${name}-leave-from`, active: `${name}-leave-active`, to: `${name}-leave-to` };
645
681
  }, [name, leaveFrom, leaveTo]);
646
- (0, import_react11.useEffect)(() => {
682
+ (0, import_react12.useEffect)(() => {
647
683
  if (visible === prevVisible.current) return;
648
684
  prevVisible.current = visible;
649
685
  clearTimeout(timerRef.current);
@@ -669,7 +705,7 @@ function Transition({
669
705
  }, duration);
670
706
  }
671
707
  }, [visible, duration, unmountOnExit, onAfterEnter, onAfterLeave]);
672
- (0, import_react11.useEffect)(() => {
708
+ (0, import_react12.useEffect)(() => {
673
709
  return () => clearTimeout(timerRef.current);
674
710
  }, []);
675
711
  if (!mounted && unmountOnExit) return null;
@@ -690,7 +726,7 @@ function Transition({
690
726
  transitionClass = `${leaveC.to} ${leaveC.active}`;
691
727
  break;
692
728
  }
693
- return import_react11.default.cloneElement(children, {
729
+ return import_react12.default.cloneElement(children, {
694
730
  ref: nodeRef,
695
731
  className: [children.props.className, transitionClass].filter(Boolean).join(" ")
696
732
  });
@@ -705,10 +741,10 @@ function Tooltip({
705
741
  className,
706
742
  unstyled
707
743
  }) {
708
- const [visible, setVisible] = (0, import_react12.useState)(false);
709
- const ref = (0, import_react12.useRef)(null);
710
- const tooltipId = (0, import_react12.useId)();
711
- const triggerWithAria = (0, import_react12.isValidElement)(children) ? (0, import_react12.cloneElement)(children, {
744
+ const [visible, setVisible] = (0, import_react13.useState)(false);
745
+ const ref = (0, import_react13.useRef)(null);
746
+ const tooltipId = (0, import_react13.useId)();
747
+ const triggerWithAria = (0, import_react13.isValidElement)(children) ? (0, import_react13.cloneElement)(children, {
712
748
  "aria-describedby": visible ? [children.props["aria-describedby"], tooltipId].filter(Boolean).join(" ") : children.props["aria-describedby"],
713
749
  onFocus: (e) => {
714
750
  setVisible(true);
@@ -800,12 +836,12 @@ function Field({
800
836
  const formLocale = useConfig().locale?.form;
801
837
  const requiredMarker = formLocale?.required ?? "*";
802
838
  const optionalMarker = formLocale?.optional ?? "(optional)";
803
- const autoId = (0, import_react13.useId)();
839
+ const autoId = (0, import_react14.useId)();
804
840
  const fieldId = `sg-field-${autoId.replace(/:/g, "")}-${name.replace(/\./g, "-")}`;
805
841
  const helpId = `${fieldId}-help`;
806
842
  const field = useField(core, form, name);
807
- const prevValueRef = (0, import_react13.useRef)(field.value);
808
- (0, import_react13.useEffect)(() => {
843
+ const prevValueRef = (0, import_react14.useRef)(field.value);
844
+ (0, import_react14.useEffect)(() => {
809
845
  const allRules = [...rules];
810
846
  if (required) {
811
847
  allRules.unshift({ required: true });
@@ -1035,7 +1071,7 @@ function SubmitButton({
1035
1071
  }
1036
1072
 
1037
1073
  // src/components/complex/FormList.tsx
1038
- var import_react14 = __toESM(require("react"), 1);
1074
+ var import_react15 = __toESM(require("react"), 1);
1039
1075
  var import_jsx_runtime11 = require("react/jsx-runtime");
1040
1076
  var listUid = 0;
1041
1077
  function genKey() {
@@ -1043,15 +1079,15 @@ function genKey() {
1043
1079
  }
1044
1080
  function FormList({ name, initialValue, draggable, children }) {
1045
1081
  const { core, form } = useFormContext();
1046
- import_react14.default.useEffect(() => {
1082
+ import_react15.default.useEffect(() => {
1047
1083
  if (initialValue && !Array.isArray(core.get(name))) {
1048
1084
  core.set(name, initialValue);
1049
1085
  }
1050
1086
  }, []);
1051
1087
  const listValue = useWatch(core, name);
1052
1088
  const items = Array.isArray(listValue) ? listValue : [];
1053
- const [keys, setKeys] = (0, import_react14.useState)(() => items.map(() => genKey()));
1054
- import_react14.default.useEffect(() => {
1089
+ const [keys, setKeys] = (0, import_react15.useState)(() => items.map(() => genKey()));
1090
+ import_react15.default.useEffect(() => {
1055
1091
  setKeys((prev) => {
1056
1092
  if (prev.length === items.length) return prev;
1057
1093
  if (items.length > prev.length) {
@@ -1060,11 +1096,11 @@ function FormList({ name, initialValue, draggable, children }) {
1060
1096
  return prev.slice(0, items.length);
1061
1097
  });
1062
1098
  }, [items.length]);
1063
- const fields = (0, import_react14.useMemo)(
1099
+ const fields = (0, import_react15.useMemo)(
1064
1100
  () => keys.slice(0, items.length).map((key, index) => ({ key, index })),
1065
1101
  [keys, items.length]
1066
1102
  );
1067
- const add = (0, import_react14.useCallback)(
1103
+ const add = (0, import_react15.useCallback)(
1068
1104
  (defaultValue, insertIndex) => {
1069
1105
  form.listAdd(name, defaultValue, insertIndex);
1070
1106
  setKeys((prev) => {
@@ -1079,7 +1115,7 @@ function FormList({ name, initialValue, draggable, children }) {
1079
1115
  },
1080
1116
  [form, name]
1081
1117
  );
1082
- const remove = (0, import_react14.useCallback)(
1118
+ const remove = (0, import_react15.useCallback)(
1083
1119
  (index) => {
1084
1120
  form.listRemove(name, index);
1085
1121
  setKeys((prev) => {
@@ -1092,7 +1128,7 @@ function FormList({ name, initialValue, draggable, children }) {
1092
1128
  },
1093
1129
  [form, name]
1094
1130
  );
1095
- const move = (0, import_react14.useCallback)(
1131
+ const move = (0, import_react15.useCallback)(
1096
1132
  (from, to) => {
1097
1133
  form.listMove(name, from, to);
1098
1134
  setKeys((prev) => {
@@ -1104,20 +1140,20 @@ function FormList({ name, initialValue, draggable, children }) {
1104
1140
  },
1105
1141
  [form, name]
1106
1142
  );
1107
- const replace = (0, import_react14.useCallback)(
1143
+ const replace = (0, import_react15.useCallback)(
1108
1144
  (values) => {
1109
1145
  form.listReplace(name, values);
1110
1146
  setKeys(values.map(() => genKey()));
1111
1147
  },
1112
1148
  [form, name]
1113
1149
  );
1114
- const operation = (0, import_react14.useMemo)(
1150
+ const operation = (0, import_react15.useMemo)(
1115
1151
  () => ({ add, remove, move, replace }),
1116
1152
  [add, remove, move, replace]
1117
1153
  );
1118
- const meta = (0, import_react14.useMemo)(() => ({ errors: form.getFieldErrors(name) }), [form, name]);
1119
- const dragIdx = (0, import_react14.useRef)(-1);
1120
- const dragOverIdx = (0, import_react14.useRef)(-1);
1154
+ const meta = (0, import_react15.useMemo)(() => ({ errors: form.getFieldErrors(name) }), [form, name]);
1155
+ const dragIdx = (0, import_react15.useRef)(-1);
1156
+ const dragOverIdx = (0, import_react15.useRef)(-1);
1121
1157
  if (!draggable) {
1122
1158
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: children(fields, operation, meta) });
1123
1159
  }
@@ -1149,7 +1185,7 @@ function FormList({ name, initialValue, draggable, children }) {
1149
1185
  }
1150
1186
 
1151
1187
  // src/components/complex/AutoField/AutoField.tsx
1152
- var import_react15 = require("react");
1188
+ var import_react16 = require("react");
1153
1189
  var import_jsx_runtime12 = require("react/jsx-runtime");
1154
1190
  function AutoField(props) {
1155
1191
  const {
@@ -1172,7 +1208,7 @@ function AutoField(props) {
1172
1208
  const { form } = useFormContext();
1173
1209
  const value = form.getValue(name);
1174
1210
  const meta = form.getFieldState(name);
1175
- const inferredType = (0, import_react15.useMemo)(() => {
1211
+ const inferredType = (0, import_react16.useMemo)(() => {
1176
1212
  if (forcedType) return forcedType;
1177
1213
  if (options && options.length > 0) return "select";
1178
1214
  if (typeof value === "boolean") return "boolean";
@@ -1189,20 +1225,10 @@ function AutoField(props) {
1189
1225
  const errorId = `${name}-error`;
1190
1226
  const hasErrors = meta.errors.length > 0;
1191
1227
  const hasWarnings = meta.warnings.length > 0;
1192
- const wrapperStyle = {
1193
- display: "flex",
1194
- flexDirection: "column",
1195
- gap: 4,
1196
- ...style
1197
- };
1198
- const inputStyle = {
1199
- padding: "6px 12px",
1200
- border: `1px solid ${hasErrors ? "var(--sg-error, #ff4d4f)" : hasWarnings ? "var(--sg-warning, #faad14)" : "var(--sg-border, #d9d9d9)"}`,
1201
- borderRadius: "var(--sg-radius, 6px)",
1202
- fontSize: 14,
1203
- outline: "none",
1204
- background: disabled ? "var(--sg-bg-disabled, #f5f5f5)" : "var(--sg-bg, #fff)"
1205
- };
1228
+ const inputClass = [
1229
+ "sg-autofield-input",
1230
+ hasErrors ? "sg-autofield-input-error" : hasWarnings ? "sg-autofield-input-warning" : ""
1231
+ ].filter(Boolean).join(" ");
1206
1232
  function renderInput() {
1207
1233
  switch (inferredType) {
1208
1234
  case "boolean":
@@ -1233,7 +1259,7 @@ function AutoField(props) {
1233
1259
  min,
1234
1260
  max,
1235
1261
  step,
1236
- style: inputStyle,
1262
+ className: inputClass,
1237
1263
  "aria-invalid": hasErrors,
1238
1264
  "aria-describedby": hasErrors ? errorId : void 0
1239
1265
  }
@@ -1247,7 +1273,7 @@ function AutoField(props) {
1247
1273
  onBlur: () => form.onFieldBlur(name),
1248
1274
  placeholder,
1249
1275
  disabled,
1250
- style: { ...inputStyle, minHeight: 80, resize: "vertical" },
1276
+ className: `${inputClass} sg-autofield-input-textarea`,
1251
1277
  "aria-invalid": hasErrors,
1252
1278
  "aria-describedby": hasErrors ? errorId : void 0
1253
1279
  }
@@ -1259,7 +1285,7 @@ function AutoField(props) {
1259
1285
  value: value == null ? "" : String(value),
1260
1286
  onChange: (e) => handleChange(e.target.value),
1261
1287
  disabled,
1262
- style: inputStyle,
1288
+ className: inputClass,
1263
1289
  "aria-invalid": hasErrors,
1264
1290
  "aria-describedby": hasErrors ? errorId : void 0,
1265
1291
  children: [
@@ -1279,27 +1305,34 @@ function AutoField(props) {
1279
1305
  handleChange(selected);
1280
1306
  },
1281
1307
  disabled,
1282
- style: { ...inputStyle, minHeight: 80 },
1308
+ className: `${inputClass} sg-autofield-input-multiple`,
1283
1309
  "aria-invalid": hasErrors,
1284
1310
  "aria-describedby": hasErrors ? errorId : void 0,
1285
1311
  children: options?.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
1286
1312
  }
1287
1313
  );
1288
1314
  case "radio":
1289
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { role: "radiogroup", style: { display: "flex", gap: 12, flexWrap: "wrap" }, children: options?.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 4, cursor: "pointer" }, children: [
1290
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1291
- "input",
1292
- {
1293
- type: "radio",
1294
- name,
1295
- value: opt.value,
1296
- checked: value === opt.value,
1297
- onChange: () => handleChange(opt.value),
1298
- disabled
1299
- }
1300
- ),
1301
- opt.label
1302
- ] }, opt.value)) });
1315
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { role: "radiogroup", style: { display: "flex", gap: 12, flexWrap: "wrap" }, children: options?.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1316
+ "label",
1317
+ {
1318
+ style: { display: "flex", alignItems: "center", gap: 4, cursor: "pointer" },
1319
+ children: [
1320
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1321
+ "input",
1322
+ {
1323
+ type: "radio",
1324
+ name,
1325
+ value: opt.value,
1326
+ checked: value === opt.value,
1327
+ onChange: () => handleChange(opt.value),
1328
+ disabled
1329
+ }
1330
+ ),
1331
+ opt.label
1332
+ ]
1333
+ },
1334
+ opt.value
1335
+ )) });
1303
1336
  case "date":
1304
1337
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1305
1338
  "input",
@@ -1308,7 +1341,7 @@ function AutoField(props) {
1308
1341
  value: value == null ? "" : String(value),
1309
1342
  onChange: (e) => handleChange(e.target.value),
1310
1343
  disabled,
1311
- style: inputStyle,
1344
+ className: inputClass,
1312
1345
  "aria-invalid": hasErrors,
1313
1346
  "aria-describedby": hasErrors ? errorId : void 0
1314
1347
  }
@@ -1321,7 +1354,7 @@ function AutoField(props) {
1321
1354
  value: value == null ? "" : String(value),
1322
1355
  onChange: (e) => handleChange(e.target.value),
1323
1356
  disabled,
1324
- style: inputStyle,
1357
+ className: inputClass,
1325
1358
  "aria-invalid": hasErrors,
1326
1359
  "aria-describedby": hasErrors ? errorId : void 0
1327
1360
  }
@@ -1336,7 +1369,7 @@ function AutoField(props) {
1336
1369
  onBlur: () => form.onFieldBlur(name),
1337
1370
  placeholder,
1338
1371
  disabled,
1339
- style: inputStyle,
1372
+ className: inputClass,
1340
1373
  "aria-invalid": hasErrors,
1341
1374
  "aria-describedby": hasErrors ? errorId : void 0
1342
1375
  }
@@ -1349,7 +1382,7 @@ function AutoField(props) {
1349
1382
  value: value == null ? "#000000" : String(value),
1350
1383
  onChange: (e) => handleChange(e.target.value),
1351
1384
  disabled,
1352
- style: { ...inputStyle, padding: 2, width: 48, height: 32 }
1385
+ className: `${inputClass} sg-autofield-input-color`
1353
1386
  }
1354
1387
  );
1355
1388
  case "slider":
@@ -1383,7 +1416,7 @@ function AutoField(props) {
1383
1416
  border: "none",
1384
1417
  cursor: disabled ? "default" : "pointer",
1385
1418
  fontSize: 20,
1386
- color: i < currentRate ? "var(--sg-warning, #faad14)" : "var(--sg-border, #d9d9d9)",
1419
+ color: i < currentRate ? "var(--sg-color-warning, #faad14)" : "var(--sg-color-border, #d9d9d9)",
1387
1420
  padding: 0
1388
1421
  },
1389
1422
  "aria-label": `${i + 1} star${i !== 0 ? "s" : ""}`,
@@ -1404,7 +1437,7 @@ function AutoField(props) {
1404
1437
  if (files) handleChange(multiple ? Array.from(files) : files[0] ?? null);
1405
1438
  },
1406
1439
  disabled,
1407
- style: inputStyle
1440
+ className: inputClass
1408
1441
  }
1409
1442
  );
1410
1443
  case "email":
@@ -1420,18 +1453,26 @@ function AutoField(props) {
1420
1453
  onBlur: () => form.onFieldBlur(name),
1421
1454
  placeholder,
1422
1455
  disabled,
1423
- style: inputStyle,
1456
+ className: inputClass,
1424
1457
  "aria-invalid": hasErrors,
1425
1458
  "aria-describedby": hasErrors ? errorId : void 0
1426
1459
  }
1427
1460
  );
1428
1461
  }
1429
1462
  }
1430
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `sg-autofield ${className ?? ""}`, style: wrapperStyle, children: [
1431
- inferredType !== "boolean" && inferredType !== "switch" && label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { style: { fontWeight: 500, fontSize: 14 }, children: label }),
1463
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `sg-autofield ${className ?? ""}`, style, children: [
1464
+ inferredType !== "boolean" && inferredType !== "switch" && label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "sg-autofield-label", children: label }),
1432
1465
  renderInput(),
1433
- hasErrors && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { id: errorId, role: "alert", style: { color: "var(--sg-error, #ff4d4f)", fontSize: 12 }, children: meta.errors.join("; ") }),
1434
- hasWarnings && !hasErrors && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { color: "var(--sg-warning, #faad14)", fontSize: 12 }, children: meta.warnings.join("; ") })
1466
+ hasErrors && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1467
+ "span",
1468
+ {
1469
+ id: errorId,
1470
+ role: "alert",
1471
+ style: { color: "var(--sg-color-error, #ff4d4f)", fontSize: 12 },
1472
+ children: meta.errors.join("; ")
1473
+ }
1474
+ ),
1475
+ hasWarnings && !hasErrors && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { color: "var(--sg-color-warning, #faad14)", fontSize: 12 }, children: meta.warnings.join("; ") })
1435
1476
  ] });
1436
1477
  }
1437
1478