@universe-platform/ui 0.1.0-beta.56 → 0.1.0-beta.57

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/dist/index.js CHANGED
@@ -15576,6 +15576,31 @@ var ALWAYS_FULL_TYPES = /* @__PURE__ */ new Set(["GOOGLE_DRIVE_FILE", "SUB_TABLE
15576
15576
  function isFormPresetId(v) {
15577
15577
  return typeof v === "string" && v in FORM_PRESETS;
15578
15578
  }
15579
+ var FRAME_STYLES = ["none", "soft", "solid", "double"];
15580
+ function isFormFrameStyle(v) {
15581
+ return typeof v === "string" && FRAME_STYLES.includes(v);
15582
+ }
15583
+ function withAlpha(color, alpha) {
15584
+ const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec((color || "").trim());
15585
+ if (!m) return color;
15586
+ let h = m[1];
15587
+ if (h.length === 3) h = h.split("").map((c) => c + c).join("");
15588
+ const n = parseInt(h, 16);
15589
+ return `rgba(${n >> 16 & 255}, ${n >> 8 & 255}, ${n & 255}, ${alpha})`;
15590
+ }
15591
+ function frameToCss(frame) {
15592
+ if (!frame) return null;
15593
+ if (frame === "none") return { border: "none" };
15594
+ const c = frame.color;
15595
+ switch (frame.style) {
15596
+ case "soft":
15597
+ return { border: `1.5px solid ${withAlpha(c, 0.4)}`, boxShadow: `0 0 0 5px ${withAlpha(c, 0.08)}` };
15598
+ case "solid":
15599
+ return { border: `2px solid ${c}` };
15600
+ case "double":
15601
+ return { border: `1.5px solid ${c}`, outline: `1px solid ${withAlpha(c, 0.55)}`, outlineOffset: -7 };
15602
+ }
15603
+ }
15579
15604
  function safeLogoUrl(url) {
15580
15605
  const u = (url || "").trim();
15581
15606
  if (!u) return void 0;
@@ -15603,7 +15628,8 @@ function resolveFormDesign(design) {
15603
15628
  titleColor: (design == null ? void 0 : design.titleColor) || void 0,
15604
15629
  logoUrl: safeLogoUrl(design == null ? void 0 : design.logoUrl),
15605
15630
  logoHeight: Math.min(200, Math.max(24, Number(design == null ? void 0 : design.logoHeight) || 56)),
15606
- logoAlign: (design == null ? void 0 : design.logoAlign) || "start"
15631
+ logoAlign: (design == null ? void 0 : design.logoAlign) || "start",
15632
+ frame: isFormFrameStyle(design == null ? void 0 : design.frameStyle) ? design.frameStyle === "none" ? "none" : { style: design.frameStyle, color: (design == null ? void 0 : design.frameColor) || primary } : void 0
15607
15633
  };
15608
15634
  }
15609
15635
  var TODAY_DEFAULT_TOKEN = "@today";
@@ -15706,6 +15732,9 @@ function StyledFormBlock({
15706
15732
  const [formData, setFormData] = (0, import_react29.useState)(initialValues || {});
15707
15733
  const [isSubmitting, setIsSubmitting] = (0, import_react29.useState)(false);
15708
15734
  const [isSubmitted, setIsSubmitted] = (0, import_react29.useState)(false);
15735
+ const [formError, setFormError] = (0, import_react29.useState)(null);
15736
+ const [missingNames, setMissingNames] = (0, import_react29.useState)([]);
15737
+ const errorRef = (0, import_react29.useRef)(null);
15709
15738
  const [columns, setColumns] = (0, import_react29.useState)((schema == null ? void 0 : schema.columns) || []);
15710
15739
  const [isLoadingSchema, setIsLoadingSchema] = (0, import_react29.useState)(false);
15711
15740
  const [dragName, setDragName] = (0, import_react29.useState)(null);
@@ -15782,6 +15811,11 @@ function StyledFormBlock({
15782
15811
  const hiddenColumns = orderedColumns.filter((c) => isDesignHidden(c));
15783
15812
  const handleFieldChange = (colName, value) => {
15784
15813
  setFormData((prev) => __spreadProps(__spreadValues({}, prev), { [colName]: value }));
15814
+ if (missingNames.includes(colName)) {
15815
+ const left = missingNames.filter((n) => n !== colName);
15816
+ setMissingNames(left);
15817
+ if (left.length === 0) setFormError(null);
15818
+ }
15785
15819
  };
15786
15820
  const canReorder = !!onReorder;
15787
15821
  const reorderFields = (fromName, toName, side) => {
@@ -15926,13 +15960,29 @@ function StyledFormBlock({
15926
15960
  showError("\u05D4\u05E7\u05D9\u05E9\u05D5\u05E8 \u05D0\u05D9\u05E0\u05D5 \u05DE\u05E7\u05D5\u05E9\u05E8 \u05DC\u05E8\u05E9\u05D5\u05DE\u05D4 \u05E7\u05D9\u05D9\u05DE\u05EA", "\u05E9\u05D2\u05D9\u05D0\u05EA \u05E9\u05DE\u05D9\u05E8\u05D4");
15927
15961
  return;
15928
15962
  }
15963
+ const isEmptyValue = (col) => {
15964
+ var _a;
15965
+ const v = formData[col.name];
15966
+ if (((_a = col.type) == null ? void 0 : _a.toUpperCase()) === "BOOLEAN") return v !== true;
15967
+ return v === void 0 || v === null || v === "" || Array.isArray(v) && v.length === 0 || typeof v === "string" && v.trim() === "";
15968
+ };
15929
15969
  const missingFields = formColumns.filter(
15930
- (col) => isFieldRequired(col, design) && !isFieldLocked(col, design) && (formData[col.name] === void 0 || formData[col.name] === null || formData[col.name] === "")
15970
+ (col) => isFieldRequired(col, design) && !isFieldLocked(col, design) && isEmptyValue(col)
15931
15971
  );
15932
15972
  if (missingFields.length > 0) {
15933
- showError(`\u05D9\u05E9 \u05DC\u05DE\u05DC\u05D0 \u05D0\u05EA \u05D4\u05E9\u05D3\u05D5\u05EA \u05D4\u05D1\u05D0\u05D9\u05DD: ${missingFields.map((c) => c.name).join(", ")}`, "\u05E9\u05D2\u05D9\u05D0\u05EA \u05D5\u05DC\u05D9\u05D3\u05E6\u05D9\u05D4");
15973
+ const names = missingFields.map((c) => c.name);
15974
+ setMissingNames(names);
15975
+ setFormError(
15976
+ names.length === 1 ? `\u05E0\u05E8\u05D0\u05D4 \u05E9\u05E9\u05DB\u05D7\u05EA\u05DD \u05DC\u05DE\u05DC\u05D0 \u05D0\u05EA \u05D4\u05E9\u05D3\u05D4 "${names[0]}". \u05E0\u05E9\u05DE\u05D7 \u05D0\u05DD \u05EA\u05E9\u05DC\u05D9\u05DE\u05D5 \u05D0\u05D5\u05EA\u05D5 \u05D5\u05EA\u05E9\u05DC\u05D7\u05D5 \u05E9\u05D5\u05D1. \u05EA\u05D5\u05D3\u05D4!` : `\u05E0\u05E8\u05D0\u05D4 \u05E9\u05E9\u05DB\u05D7\u05EA\u05DD \u05DC\u05DE\u05DC\u05D0 \u05DB\u05DE\u05D4 \u05E9\u05D3\u05D5\u05EA \u05D7\u05D5\u05D1\u05D4: ${names.map((n) => `"${n}"`).join(", ")}. \u05E0\u05E9\u05DE\u05D7 \u05D0\u05DD \u05EA\u05E9\u05DC\u05D9\u05DE\u05D5 \u05D0\u05D5\u05EA\u05DD \u05D5\u05EA\u05E9\u05DC\u05D7\u05D5 \u05E9\u05D5\u05D1. \u05EA\u05D5\u05D3\u05D4!`
15977
+ );
15978
+ setTimeout(() => {
15979
+ var _a;
15980
+ return (_a = errorRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "nearest" });
15981
+ }, 0);
15934
15982
  return;
15935
15983
  }
15984
+ setFormError(null);
15985
+ setMissingNames([]);
15936
15986
  setIsSubmitting(true);
15937
15987
  try {
15938
15988
  const payload = {};
@@ -15977,20 +16027,28 @@ function StyledFormBlock({
15977
16027
  } catch (err) {
15978
16028
  console.error("[StyledFormBlock] Submit error:", err);
15979
16029
  showError((err == null ? void 0 : err.message) || String(err), "\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05E9\u05DE\u05D9\u05E8\u05EA \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD");
16030
+ const raw = String((err == null ? void 0 : err.message) || "");
16031
+ setFormError(
16032
+ raw.startsWith("Validation Error") ? "\u05DC\u05D0 \u05D4\u05E6\u05DC\u05D7\u05E0\u05D5 \u05DC\u05E9\u05DE\u05D5\u05E8: \u05D7\u05DC\u05E7 \u05DE\u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05D7\u05E1\u05E8\u05D9\u05DD \u05D0\u05D5 \u05D0\u05D9\u05E0\u05DD \u05EA\u05E7\u05D9\u05E0\u05D9\u05DD. \u05E0\u05E9\u05DE\u05D7 \u05D0\u05DD \u05EA\u05D1\u05D3\u05E7\u05D5 \u05D0\u05D5\u05EA\u05DD \u05D5\u05EA\u05E0\u05E1\u05D5 \u05E9\u05D5\u05D1." : "\u05D0\u05D9\u05E8\u05E2\u05D4 \u05EA\u05E7\u05DC\u05D4 \u05D1\u05E9\u05DE\u05D9\u05E8\u05EA \u05D4\u05E4\u05E8\u05D8\u05D9\u05DD. \u05E0\u05E1\u05D5 \u05E9\u05D5\u05D1 \u05D1\u05E2\u05D5\u05D3 \u05E8\u05D2\u05E2, \u05D5\u05D0\u05DD \u05D6\u05D4 \u05D7\u05D5\u05D6\u05E8 \u05E0\u05E9\u05DE\u05D7 \u05E9\u05EA\u05D9\u05E6\u05E8\u05D5 \u05D0\u05D9\u05EA\u05E0\u05D5 \u05E7\u05E9\u05E8."
16033
+ );
15980
16034
  } finally {
15981
16035
  setIsSubmitting(false);
15982
16036
  }
15983
16037
  };
15984
16038
  const muted = t.invertText ? "rgba(255,255,255,0.85)" : "#64748b";
15985
- const cardStyle = {
16039
+ const frameCss = frameToCss(d.frame);
16040
+ const framed = !!d.frame && d.frame !== "none";
16041
+ const cardRadius = t.radius || (framed ? 12 : 0);
16042
+ const cardPadding = t.padding || (framed ? 24 : 0);
16043
+ const cardStyle = __spreadValues({
15986
16044
  background: d.background,
15987
16045
  color: d.text,
15988
- borderRadius: t.radius,
16046
+ borderRadius: cardRadius,
15989
16047
  border: t.border,
15990
16048
  boxShadow: t.shadow,
15991
- padding: t.headerBand ? 0 : t.padding,
16049
+ padding: t.headerBand ? 0 : cardPadding,
15992
16050
  overflow: t.headerBand ? "hidden" : void 0
15993
- };
16051
+ }, frameCss ? __spreadValues(__spreadValues(__spreadValues({}, frameCss.border !== void 0 ? { border: frameCss.border } : {}), frameCss.boxShadow ? { boxShadow: t.shadow && t.shadow !== "none" ? `${frameCss.boxShadow}, ${t.shadow}` : frameCss.boxShadow } : {}), frameCss.outline ? { outline: frameCss.outline, outlineOffset: frameCss.outlineOffset } : {}) : {});
15994
16052
  const inputBoxStyle = t.inputStyle === "underline" ? { borderBottom: "1px solid #cbd5e1", borderRadius: 0, background: "transparent", minHeight: 40, position: "relative" } : {
15995
16053
  border: "1px solid #e2e8f0",
15996
16054
  borderRadius: Math.min(t.radius, 10) || 6,
@@ -16012,7 +16070,9 @@ function StyledFormBlock({
16012
16070
  .${uid} .fdz-grid{display:flex;flex-wrap:wrap;align-items:flex-end;gap:${t.gap}px}
16013
16071
  .${uid} .fdz-f{--n:6;flex:0 0 auto;box-sizing:border-box;min-width:0;display:flex;flex-direction:column;gap:6px;width:calc((100% - ${t.gap * 5}px) / 6 * var(--n) + ${t.gap}px * (var(--n) - 1) - 0.5px)}
16014
16072
  .${uid} .fdz-s1{--n:2}
16015
- .${uid} .fdz-b{width:fit-content;max-width:140px;margin-inline-end:-${Math.max(0, t.gap - 8)}px}
16073
+ .${uid} .fdz-b{width:fit-content;max-width:100%;margin-inline-end:-${Math.max(0, t.gap - 8)}px}
16074
+ .${uid} .fdz-b label{white-space:nowrap}
16075
+ .${uid} [data-fdz-box] input:focus,.${uid} [data-fdz-box] input:focus-visible,.${uid} [data-fdz-box] select:focus,.${uid} [data-fdz-box] textarea:focus{outline:none!important;box-shadow:none!important;--tw-ring-shadow:0 0 #0000!important;--tw-ring-offset-shadow:0 0 #0000!important}
16016
16076
  @container (min-width:480px){
16017
16077
  .${uid} .fdz-f{--n:var(--span)}
16018
16078
  }
@@ -16093,7 +16153,7 @@ function StyledFormBlock({
16093
16153
  const shownValue = (_c = formData[col.name]) != null ? _c : locked && submitMode !== "update" ? (_b = parseColumnDefault(col)) != null ? _b : "" : "";
16094
16154
  const fieldHeight = resizing && resizing.name === col.name ? resizing.height : (_e = (_d = design == null ? void 0 : design.fields) == null ? void 0 : _d[col.name]) == null ? void 0 : _e.height;
16095
16155
  const useTextarea = !!fieldHeight && fieldHeight > 56 && InputComponent === FORM_INPUTS.DEFAULT;
16096
- const boxStyle = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, isBoolean ? booleanBoxStyle : inputBoxStyle), fieldHeight && !isBoolean ? __spreadValues({ minHeight: fieldHeight }, useTextarea ? { height: fieldHeight } : {}) : {}), canReorder ? { pointerEvents: "none" } : {}), locked ? { background: t.inputStyle === "underline" ? "transparent" : "#f1f5f9", opacity: 0.85, cursor: "not-allowed" } : {});
16156
+ const boxStyle = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, isBoolean ? booleanBoxStyle : inputBoxStyle), fieldHeight && !isBoolean ? __spreadValues({ minHeight: fieldHeight }, useTextarea ? { height: fieldHeight } : {}) : {}), canReorder ? { pointerEvents: "none" } : {}), missingNames.includes(col.name) ? t.inputStyle === "underline" ? { borderBottom: "2px solid #f43f5e" } : { border: "1px solid #f43f5e", boxShadow: "0 0 0 3px rgba(244,63,94,0.15)" } : {}), locked ? { background: t.inputStyle === "underline" ? "transparent" : "#f1f5f9", opacity: 0.85, cursor: "not-allowed" } : {});
16097
16157
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
16098
16158
  "div",
16099
16159
  {
@@ -16200,6 +16260,25 @@ function StyledFormBlock({
16200
16260
  };
16201
16261
  return formColumns.map((col) => renderField(col));
16202
16262
  })() }),
16263
+ formError && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
16264
+ "div",
16265
+ {
16266
+ ref: errorRef,
16267
+ role: "alert",
16268
+ "aria-live": "polite",
16269
+ style: {
16270
+ marginTop: t.gap + 8,
16271
+ padding: "10px 14px",
16272
+ borderRadius: Math.min(t.radius, 10) || 6,
16273
+ background: "#fff1f2",
16274
+ border: "1px solid #fda4af",
16275
+ color: "#9f1239",
16276
+ fontSize: 14,
16277
+ lineHeight: 1.5
16278
+ },
16279
+ children: formError
16280
+ }
16281
+ ),
16203
16282
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
16204
16283
  "div",
16205
16284
  {
package/dist/index.mjs CHANGED
@@ -15481,6 +15481,31 @@ var ALWAYS_FULL_TYPES = /* @__PURE__ */ new Set(["GOOGLE_DRIVE_FILE", "SUB_TABLE
15481
15481
  function isFormPresetId(v) {
15482
15482
  return typeof v === "string" && v in FORM_PRESETS;
15483
15483
  }
15484
+ var FRAME_STYLES = ["none", "soft", "solid", "double"];
15485
+ function isFormFrameStyle(v) {
15486
+ return typeof v === "string" && FRAME_STYLES.includes(v);
15487
+ }
15488
+ function withAlpha(color, alpha) {
15489
+ const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec((color || "").trim());
15490
+ if (!m) return color;
15491
+ let h = m[1];
15492
+ if (h.length === 3) h = h.split("").map((c) => c + c).join("");
15493
+ const n = parseInt(h, 16);
15494
+ return `rgba(${n >> 16 & 255}, ${n >> 8 & 255}, ${n & 255}, ${alpha})`;
15495
+ }
15496
+ function frameToCss(frame) {
15497
+ if (!frame) return null;
15498
+ if (frame === "none") return { border: "none" };
15499
+ const c = frame.color;
15500
+ switch (frame.style) {
15501
+ case "soft":
15502
+ return { border: `1.5px solid ${withAlpha(c, 0.4)}`, boxShadow: `0 0 0 5px ${withAlpha(c, 0.08)}` };
15503
+ case "solid":
15504
+ return { border: `2px solid ${c}` };
15505
+ case "double":
15506
+ return { border: `1.5px solid ${c}`, outline: `1px solid ${withAlpha(c, 0.55)}`, outlineOffset: -7 };
15507
+ }
15508
+ }
15484
15509
  function safeLogoUrl(url) {
15485
15510
  const u = (url || "").trim();
15486
15511
  if (!u) return void 0;
@@ -15508,7 +15533,8 @@ function resolveFormDesign(design) {
15508
15533
  titleColor: (design == null ? void 0 : design.titleColor) || void 0,
15509
15534
  logoUrl: safeLogoUrl(design == null ? void 0 : design.logoUrl),
15510
15535
  logoHeight: Math.min(200, Math.max(24, Number(design == null ? void 0 : design.logoHeight) || 56)),
15511
- logoAlign: (design == null ? void 0 : design.logoAlign) || "start"
15536
+ logoAlign: (design == null ? void 0 : design.logoAlign) || "start",
15537
+ frame: isFormFrameStyle(design == null ? void 0 : design.frameStyle) ? design.frameStyle === "none" ? "none" : { style: design.frameStyle, color: (design == null ? void 0 : design.frameColor) || primary } : void 0
15512
15538
  };
15513
15539
  }
15514
15540
  var TODAY_DEFAULT_TOKEN = "@today";
@@ -15611,6 +15637,9 @@ function StyledFormBlock({
15611
15637
  const [formData, setFormData] = useState22(initialValues || {});
15612
15638
  const [isSubmitting, setIsSubmitting] = useState22(false);
15613
15639
  const [isSubmitted, setIsSubmitted] = useState22(false);
15640
+ const [formError, setFormError] = useState22(null);
15641
+ const [missingNames, setMissingNames] = useState22([]);
15642
+ const errorRef = useRef20(null);
15614
15643
  const [columns, setColumns] = useState22((schema == null ? void 0 : schema.columns) || []);
15615
15644
  const [isLoadingSchema, setIsLoadingSchema] = useState22(false);
15616
15645
  const [dragName, setDragName] = useState22(null);
@@ -15687,6 +15716,11 @@ function StyledFormBlock({
15687
15716
  const hiddenColumns = orderedColumns.filter((c) => isDesignHidden(c));
15688
15717
  const handleFieldChange = (colName, value) => {
15689
15718
  setFormData((prev) => __spreadProps(__spreadValues({}, prev), { [colName]: value }));
15719
+ if (missingNames.includes(colName)) {
15720
+ const left = missingNames.filter((n) => n !== colName);
15721
+ setMissingNames(left);
15722
+ if (left.length === 0) setFormError(null);
15723
+ }
15690
15724
  };
15691
15725
  const canReorder = !!onReorder;
15692
15726
  const reorderFields = (fromName, toName, side) => {
@@ -15831,13 +15865,29 @@ function StyledFormBlock({
15831
15865
  showError("\u05D4\u05E7\u05D9\u05E9\u05D5\u05E8 \u05D0\u05D9\u05E0\u05D5 \u05DE\u05E7\u05D5\u05E9\u05E8 \u05DC\u05E8\u05E9\u05D5\u05DE\u05D4 \u05E7\u05D9\u05D9\u05DE\u05EA", "\u05E9\u05D2\u05D9\u05D0\u05EA \u05E9\u05DE\u05D9\u05E8\u05D4");
15832
15866
  return;
15833
15867
  }
15868
+ const isEmptyValue = (col) => {
15869
+ var _a;
15870
+ const v = formData[col.name];
15871
+ if (((_a = col.type) == null ? void 0 : _a.toUpperCase()) === "BOOLEAN") return v !== true;
15872
+ return v === void 0 || v === null || v === "" || Array.isArray(v) && v.length === 0 || typeof v === "string" && v.trim() === "";
15873
+ };
15834
15874
  const missingFields = formColumns.filter(
15835
- (col) => isFieldRequired(col, design) && !isFieldLocked(col, design) && (formData[col.name] === void 0 || formData[col.name] === null || formData[col.name] === "")
15875
+ (col) => isFieldRequired(col, design) && !isFieldLocked(col, design) && isEmptyValue(col)
15836
15876
  );
15837
15877
  if (missingFields.length > 0) {
15838
- showError(`\u05D9\u05E9 \u05DC\u05DE\u05DC\u05D0 \u05D0\u05EA \u05D4\u05E9\u05D3\u05D5\u05EA \u05D4\u05D1\u05D0\u05D9\u05DD: ${missingFields.map((c) => c.name).join(", ")}`, "\u05E9\u05D2\u05D9\u05D0\u05EA \u05D5\u05DC\u05D9\u05D3\u05E6\u05D9\u05D4");
15878
+ const names = missingFields.map((c) => c.name);
15879
+ setMissingNames(names);
15880
+ setFormError(
15881
+ names.length === 1 ? `\u05E0\u05E8\u05D0\u05D4 \u05E9\u05E9\u05DB\u05D7\u05EA\u05DD \u05DC\u05DE\u05DC\u05D0 \u05D0\u05EA \u05D4\u05E9\u05D3\u05D4 "${names[0]}". \u05E0\u05E9\u05DE\u05D7 \u05D0\u05DD \u05EA\u05E9\u05DC\u05D9\u05DE\u05D5 \u05D0\u05D5\u05EA\u05D5 \u05D5\u05EA\u05E9\u05DC\u05D7\u05D5 \u05E9\u05D5\u05D1. \u05EA\u05D5\u05D3\u05D4!` : `\u05E0\u05E8\u05D0\u05D4 \u05E9\u05E9\u05DB\u05D7\u05EA\u05DD \u05DC\u05DE\u05DC\u05D0 \u05DB\u05DE\u05D4 \u05E9\u05D3\u05D5\u05EA \u05D7\u05D5\u05D1\u05D4: ${names.map((n) => `"${n}"`).join(", ")}. \u05E0\u05E9\u05DE\u05D7 \u05D0\u05DD \u05EA\u05E9\u05DC\u05D9\u05DE\u05D5 \u05D0\u05D5\u05EA\u05DD \u05D5\u05EA\u05E9\u05DC\u05D7\u05D5 \u05E9\u05D5\u05D1. \u05EA\u05D5\u05D3\u05D4!`
15882
+ );
15883
+ setTimeout(() => {
15884
+ var _a;
15885
+ return (_a = errorRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "nearest" });
15886
+ }, 0);
15839
15887
  return;
15840
15888
  }
15889
+ setFormError(null);
15890
+ setMissingNames([]);
15841
15891
  setIsSubmitting(true);
15842
15892
  try {
15843
15893
  const payload = {};
@@ -15882,20 +15932,28 @@ function StyledFormBlock({
15882
15932
  } catch (err) {
15883
15933
  console.error("[StyledFormBlock] Submit error:", err);
15884
15934
  showError((err == null ? void 0 : err.message) || String(err), "\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05E9\u05DE\u05D9\u05E8\u05EA \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD");
15935
+ const raw = String((err == null ? void 0 : err.message) || "");
15936
+ setFormError(
15937
+ raw.startsWith("Validation Error") ? "\u05DC\u05D0 \u05D4\u05E6\u05DC\u05D7\u05E0\u05D5 \u05DC\u05E9\u05DE\u05D5\u05E8: \u05D7\u05DC\u05E7 \u05DE\u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05D7\u05E1\u05E8\u05D9\u05DD \u05D0\u05D5 \u05D0\u05D9\u05E0\u05DD \u05EA\u05E7\u05D9\u05E0\u05D9\u05DD. \u05E0\u05E9\u05DE\u05D7 \u05D0\u05DD \u05EA\u05D1\u05D3\u05E7\u05D5 \u05D0\u05D5\u05EA\u05DD \u05D5\u05EA\u05E0\u05E1\u05D5 \u05E9\u05D5\u05D1." : "\u05D0\u05D9\u05E8\u05E2\u05D4 \u05EA\u05E7\u05DC\u05D4 \u05D1\u05E9\u05DE\u05D9\u05E8\u05EA \u05D4\u05E4\u05E8\u05D8\u05D9\u05DD. \u05E0\u05E1\u05D5 \u05E9\u05D5\u05D1 \u05D1\u05E2\u05D5\u05D3 \u05E8\u05D2\u05E2, \u05D5\u05D0\u05DD \u05D6\u05D4 \u05D7\u05D5\u05D6\u05E8 \u05E0\u05E9\u05DE\u05D7 \u05E9\u05EA\u05D9\u05E6\u05E8\u05D5 \u05D0\u05D9\u05EA\u05E0\u05D5 \u05E7\u05E9\u05E8."
15938
+ );
15885
15939
  } finally {
15886
15940
  setIsSubmitting(false);
15887
15941
  }
15888
15942
  };
15889
15943
  const muted = t.invertText ? "rgba(255,255,255,0.85)" : "#64748b";
15890
- const cardStyle = {
15944
+ const frameCss = frameToCss(d.frame);
15945
+ const framed = !!d.frame && d.frame !== "none";
15946
+ const cardRadius = t.radius || (framed ? 12 : 0);
15947
+ const cardPadding = t.padding || (framed ? 24 : 0);
15948
+ const cardStyle = __spreadValues({
15891
15949
  background: d.background,
15892
15950
  color: d.text,
15893
- borderRadius: t.radius,
15951
+ borderRadius: cardRadius,
15894
15952
  border: t.border,
15895
15953
  boxShadow: t.shadow,
15896
- padding: t.headerBand ? 0 : t.padding,
15954
+ padding: t.headerBand ? 0 : cardPadding,
15897
15955
  overflow: t.headerBand ? "hidden" : void 0
15898
- };
15956
+ }, frameCss ? __spreadValues(__spreadValues(__spreadValues({}, frameCss.border !== void 0 ? { border: frameCss.border } : {}), frameCss.boxShadow ? { boxShadow: t.shadow && t.shadow !== "none" ? `${frameCss.boxShadow}, ${t.shadow}` : frameCss.boxShadow } : {}), frameCss.outline ? { outline: frameCss.outline, outlineOffset: frameCss.outlineOffset } : {}) : {});
15899
15957
  const inputBoxStyle = t.inputStyle === "underline" ? { borderBottom: "1px solid #cbd5e1", borderRadius: 0, background: "transparent", minHeight: 40, position: "relative" } : {
15900
15958
  border: "1px solid #e2e8f0",
15901
15959
  borderRadius: Math.min(t.radius, 10) || 6,
@@ -15917,7 +15975,9 @@ function StyledFormBlock({
15917
15975
  .${uid} .fdz-grid{display:flex;flex-wrap:wrap;align-items:flex-end;gap:${t.gap}px}
15918
15976
  .${uid} .fdz-f{--n:6;flex:0 0 auto;box-sizing:border-box;min-width:0;display:flex;flex-direction:column;gap:6px;width:calc((100% - ${t.gap * 5}px) / 6 * var(--n) + ${t.gap}px * (var(--n) - 1) - 0.5px)}
15919
15977
  .${uid} .fdz-s1{--n:2}
15920
- .${uid} .fdz-b{width:fit-content;max-width:140px;margin-inline-end:-${Math.max(0, t.gap - 8)}px}
15978
+ .${uid} .fdz-b{width:fit-content;max-width:100%;margin-inline-end:-${Math.max(0, t.gap - 8)}px}
15979
+ .${uid} .fdz-b label{white-space:nowrap}
15980
+ .${uid} [data-fdz-box] input:focus,.${uid} [data-fdz-box] input:focus-visible,.${uid} [data-fdz-box] select:focus,.${uid} [data-fdz-box] textarea:focus{outline:none!important;box-shadow:none!important;--tw-ring-shadow:0 0 #0000!important;--tw-ring-offset-shadow:0 0 #0000!important}
15921
15981
  @container (min-width:480px){
15922
15982
  .${uid} .fdz-f{--n:var(--span)}
15923
15983
  }
@@ -15998,7 +16058,7 @@ function StyledFormBlock({
15998
16058
  const shownValue = (_c = formData[col.name]) != null ? _c : locked && submitMode !== "update" ? (_b = parseColumnDefault(col)) != null ? _b : "" : "";
15999
16059
  const fieldHeight = resizing && resizing.name === col.name ? resizing.height : (_e = (_d = design == null ? void 0 : design.fields) == null ? void 0 : _d[col.name]) == null ? void 0 : _e.height;
16000
16060
  const useTextarea = !!fieldHeight && fieldHeight > 56 && InputComponent === FORM_INPUTS.DEFAULT;
16001
- const boxStyle = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, isBoolean ? booleanBoxStyle : inputBoxStyle), fieldHeight && !isBoolean ? __spreadValues({ minHeight: fieldHeight }, useTextarea ? { height: fieldHeight } : {}) : {}), canReorder ? { pointerEvents: "none" } : {}), locked ? { background: t.inputStyle === "underline" ? "transparent" : "#f1f5f9", opacity: 0.85, cursor: "not-allowed" } : {});
16061
+ const boxStyle = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, isBoolean ? booleanBoxStyle : inputBoxStyle), fieldHeight && !isBoolean ? __spreadValues({ minHeight: fieldHeight }, useTextarea ? { height: fieldHeight } : {}) : {}), canReorder ? { pointerEvents: "none" } : {}), missingNames.includes(col.name) ? t.inputStyle === "underline" ? { borderBottom: "2px solid #f43f5e" } : { border: "1px solid #f43f5e", boxShadow: "0 0 0 3px rgba(244,63,94,0.15)" } : {}), locked ? { background: t.inputStyle === "underline" ? "transparent" : "#f1f5f9", opacity: 0.85, cursor: "not-allowed" } : {});
16002
16062
  return /* @__PURE__ */ jsxs26(
16003
16063
  "div",
16004
16064
  {
@@ -16105,6 +16165,25 @@ function StyledFormBlock({
16105
16165
  };
16106
16166
  return formColumns.map((col) => renderField(col));
16107
16167
  })() }),
16168
+ formError && /* @__PURE__ */ jsx30(
16169
+ "div",
16170
+ {
16171
+ ref: errorRef,
16172
+ role: "alert",
16173
+ "aria-live": "polite",
16174
+ style: {
16175
+ marginTop: t.gap + 8,
16176
+ padding: "10px 14px",
16177
+ borderRadius: Math.min(t.radius, 10) || 6,
16178
+ background: "#fff1f2",
16179
+ border: "1px solid #fda4af",
16180
+ color: "#9f1239",
16181
+ fontSize: 14,
16182
+ lineHeight: 1.5
16183
+ },
16184
+ children: formError
16185
+ }
16186
+ ),
16108
16187
  /* @__PURE__ */ jsx30(
16109
16188
  "div",
16110
16189
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@universe-platform/ui",
3
- "version": "0.1.0-beta.56",
3
+ "version": "0.1.0-beta.57",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",