@middag-io/react 0.46.0 → 0.46.1

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.
@@ -1,4 +1,4 @@
1
- import { $ as e, Et as t, I as n, J as r, Jt as i, Xt as a, Yt as o, Z as s, a as c, at as l, ct as u, et as d, i as f, lt as p, n as m, nt as h, o as g, pt as _, r as v, s as y, st as b, t as x, ut as S } from "./FormField-Csx8hGAW.js";
1
+ import { $ as e, Et as t, I as n, J as r, Qt as i, Xt as a, Z as o, Zt as s, a as c, at as l, ct as u, et as d, i as f, lt as p, n as m, nt as h, o as g, pt as _, r as v, s as y, st as b, t as x, ut as S } from "./FormField-M7Khc1eo.js";
2
2
  import { t as C } from "./button-PJdZDEA8.js";
3
3
  import { t as ee } from "./useTranslation-u1Lygbup.js";
4
4
  import { t as w } from "./utils-DXlQmFY8.js";
@@ -1175,10 +1175,10 @@ function _t(e, t, n) {
1175
1175
  };
1176
1176
  if (function(e) {
1177
1177
  return "_zod" in e && typeof e._zod == "object";
1178
- }(e)) return function(r, s, c) {
1178
+ }(e)) return function(r, o, c) {
1179
1179
  try {
1180
1180
  return Promise.resolve(mt(function() {
1181
- return Promise.resolve((n.mode === "sync" ? i : o)(e, r, t)).then(function(e) {
1181
+ return Promise.resolve((n.mode === "sync" ? a : s)(e, r, t)).then(function(e) {
1182
1182
  return c.shouldUseNativeValidation && ut({}, c), {
1183
1183
  errors: {},
1184
1184
  values: n.raw ? Object.assign({}, r) : e
@@ -1186,7 +1186,7 @@ function _t(e, t, n) {
1186
1186
  });
1187
1187
  }, function(e) {
1188
1188
  if (function(e) {
1189
- return e instanceof a;
1189
+ return e instanceof i;
1190
1190
  }(e)) return {
1191
1191
  values: {},
1192
1192
  errors: dt(gt(e.issues, !c.shouldUseNativeValidation && c.criteriaMode === "all"), c)
@@ -1266,7 +1266,7 @@ function bt({ nodes: e, values: t, errors: r, onChange: i, sourceValues: a }) {
1266
1266
  }) });
1267
1267
  }
1268
1268
  function xt({ block: n }) {
1269
- let { t: i } = ee(), { data: a } = n, o = O(() => v(a.schema), [a.schema]), y = O(() => new Set(o.map((e) => e.key)), [o]), x = (a.meta.validation ?? "both") !== "server", w = O(() => Object.fromEntries(o.map((e) => [e.key, vt(e, a.values)])), [o, a.values]), T = k(x ? m(a.schema, w, i) : null), P = ct({
1269
+ let { t: i } = ee(), { data: a } = n, s = O(() => v(a.schema), [a.schema]), y = O(() => new Set(s.map((e) => e.key)), [s]), x = (a.meta.validation ?? "both") !== "server", w = O(() => Object.fromEntries(s.map((e) => [e.key, vt(e, a.values)])), [s, a.values]), T = k(x ? m(a.schema, w, i) : null), P = ct({
1270
1270
  defaultValues: w,
1271
1271
  mode: "onTouched",
1272
1272
  resolver: O(() => {
@@ -1275,7 +1275,7 @@ function xt({ block: n }) {
1275
1275
  errors: {}
1276
1276
  };
1277
1277
  }, [x])
1278
- }), F = he({ control: P.control }) ?? w, I = o.map((e) => `${c(e, F) ? "1" : "0"}${f(e, F) ? "1" : "0"}`).join("");
1278
+ }), F = he({ control: P.control }) ?? w, I = s.map((e) => `${c(e, F) ? "1" : "0"}${f(e, F) ? "1" : "0"}`).join("");
1279
1279
  D(() => {
1280
1280
  x && (T.current = m(a.schema, F, i));
1281
1281
  }, [
@@ -1316,9 +1316,9 @@ function xt({ block: n }) {
1316
1316
  }), P.clearErrors(e);
1317
1317
  }, [P]), U = E((e) => {
1318
1318
  oe({});
1319
- let t = o.filter((t) => c(t, e)), n = Object.fromEntries(t.map((t) => [t.key, e[t.key]])), r = Object.values(n).some((e) => e instanceof File || Array.isArray(e) && e.some((e) => e instanceof File)), s = a.method === "put" ? "put" : a.method === "patch" ? "patch" : "post";
1319
+ let t = s.filter((t) => c(t, e)), n = Object.fromEntries(t.map((t) => [t.key, e[t.key]])), r = Object.values(n).some((e) => e instanceof File || Array.isArray(e) && e.some((e) => e instanceof File)), o = a.method === "put" ? "put" : a.method === "patch" ? "patch" : "post";
1320
1320
  return new Promise((e) => {
1321
- N[s](a.action, n, {
1321
+ N[o](a.action, n, {
1322
1322
  forceFormData: r,
1323
1323
  onProgress: (e) => {
1324
1324
  e && typeof e.percentage == "number" && ie(Math.round(e.percentage));
@@ -1340,7 +1340,7 @@ function xt({ block: n }) {
1340
1340
  });
1341
1341
  });
1342
1342
  }, [
1343
- o,
1343
+ s,
1344
1344
  a,
1345
1345
  P,
1346
1346
  i,
@@ -1369,7 +1369,7 @@ function xt({ block: n }) {
1369
1369
  y,
1370
1370
  i
1371
1371
  ]);
1372
- return o.filter((e) => c(e, F)).length === 0 && a.schema.length === 0 ? /* @__PURE__ */ j(r, {
1372
+ return s.filter((e) => c(e, F)).length === 0 && a.schema.length === 0 ? /* @__PURE__ */ j(r, {
1373
1373
  variant: "inline",
1374
1374
  title: i("middag.ui.form.no_fields")
1375
1375
  }) : /* @__PURE__ */ M(te, { children: [/* @__PURE__ */ M("form", {
@@ -1379,7 +1379,7 @@ function xt({ block: n }) {
1379
1379
  role: "form",
1380
1380
  "aria-label": h(n.title, i) || i("middag.ui.form.default_title"),
1381
1381
  children: [
1382
- K.length > 0 && /* @__PURE__ */ M(s, {
1382
+ K.length > 0 && /* @__PURE__ */ M(o, {
1383
1383
  variant: "destructive",
1384
1384
  children: [/* @__PURE__ */ j(d, { children: i("middag.ui.form.errors_title") }), /* @__PURE__ */ j(e, { children: /* @__PURE__ */ j("ul", {
1385
1385
  className: "list-disc ps-4",
@@ -1,16 +1,16 @@
1
1
  /**
2
- * @generated by scripts/gen-contracts.mjs — DO NOT EDIT BY HAND.
2
+ * @generated by @middag-io/ui-contracts-codegen — DO NOT EDIT BY HAND.
3
3
  *
4
- * Barrel for the generated contract layer.
4
+ * Barrel of the generated contract layer.
5
5
  *
6
- * Source of truth: middag-php-ui value objects -> JSON Schema (draft 2020-12).
6
+ * Source of truth: middag-io/ui value objects -> JSON Schema (draft 2020-12).
7
7
  * Regenerate: npm run gen:contracts
8
8
  * Drift gate: npm run gen:contracts:check
9
9
  *
10
- * @source middag-php-ui/schema/{page-contract,fragment}.json
10
+ * @source middag-io/middag-php-ui@v1.10.1 schema/{page-contract.json,fragment.json}
11
11
  * @contract-version 1
12
- * @hash 61137d173165ca8e
12
+ * @hash 8079f706d81e80a7
13
13
  */
14
- export * from "./contract-types";
15
- export { pageContractSchemaCore, fragmentSchemaCore } from "./contract-schema";
14
+ export * from "./types.js";
15
+ export { pageContractSchemaCore, fragmentSchemaCore } from "./schemas.js";
16
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/contracts/generated/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/contracts/generated/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}