@golemui/gui-validators 1.1.0 → 1.1.1-rc.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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 1.1.0 (2026-07-21)
2
+
3
+ ### 🚀 Features
4
+
5
+ - add time input ([#217](https://github.com/golemui/golemui/pull/217))
6
+
7
+ ### ❤️ Thank You
8
+
9
+ - Raúl Jiménez @Elecash
10
+
1
11
  ## 1.0.3 (2026-07-02)
2
12
 
3
13
  This was a version bump only for gui-validators to align it with other projects, there were no code changes.
package/index.js CHANGED
@@ -1,202 +1,217 @@
1
- import { filterTap as w, standardValidate as b, isStandardValidateSuccess as M } from "@golemui/core";
1
+ import { filterTap as S, standardValidate as M, isStandardValidateSuccess as O } from "@golemui/core";
2
2
  import "@standard-schema/spec";
3
3
  import { iso as d } from "zod";
4
- import { uuid as S, url as T, ipv6 as j, ipv4 as E, hostname as F, email as R, optional as _, any as f, superRefine as V, array as l, refine as c, minLength as q, maxLength as I, boolean as x, number as k, int as $, minimum as A, maximum as B, string as y, regex as C } from "zod/mini";
5
- const g = {
6
- email: { schema: R() },
7
- hostname: { schema: F() },
8
- ipv4: { schema: E() },
9
- ipv6: { schema: j() },
10
- url: { schema: T() },
11
- uuid: { schema: S() },
4
+ import { uuid as $, url as j, ipv6 as E, ipv4 as T, hostname as R, email as F, optional as N, any as g, superRefine as V, array as k, refine as u, minLength as q, maxLength as I, boolean as x, number as y, int as U, minimum as J, maximum as _, string as b, regex as A } from "zod/mini";
5
+ const p = {
6
+ email: { schema: F() },
7
+ hostname: { schema: R() },
8
+ ipv4: { schema: T() },
9
+ ipv6: { schema: E() },
10
+ url: { schema: j() },
11
+ uuid: { schema: $() },
12
12
  date: { schema: d.date() },
13
13
  time: { schema: d.time() },
14
14
  "date-time": { schema: d.datetime({ local: !0, offset: !0 }) },
15
15
  duration: { schema: d.duration() }
16
- }, K = Object.keys(g), Y = (i) => (m, e) => {
17
- switch (m.type) {
16
+ }, w = Object.keys(p), Y = (i) => (n, e) => {
17
+ switch (n.type) {
18
18
  case "string":
19
- return N(m, e);
19
+ return B(n, e);
20
20
  case "integer":
21
21
  case "number":
22
- return G(m, e);
22
+ return K(n, e);
23
23
  case "boolean":
24
- return H(m, e);
24
+ return D(n, e);
25
25
  case "array":
26
- return J(m, e);
26
+ return G(n, e);
27
27
  case "custom": {
28
28
  if (!i)
29
29
  throw new Error(
30
30
  'Validator type "custom" requires a customValidators object, but it was not supplied.'
31
31
  );
32
- return P(m, i);
32
+ return H(n, i);
33
+ }
34
+ default: {
35
+ const c = n;
36
+ throw new Error(
37
+ `Unknown validator config: ${JSON.stringify(c)}. The "type" property must be one of: "string", "number", "integer", "boolean", "array", "custom".`
38
+ );
33
39
  }
34
40
  }
35
41
  };
36
- function o(i, m) {
42
+ function o(i, n) {
37
43
  if (i !== void 0)
38
- return typeof i == "string" ? i : m?.translate(i.key, i.params, i.default) ?? i.default;
44
+ return typeof i == "string" ? i : n?.translate(i.key, i.params, i.default) ?? i.default;
39
45
  }
40
- function N(i, m) {
41
- return a(i, (e) => {
42
- const u = o(e.messages?.invalid, m);
43
- let s = u ? y(u) : y();
46
+ function B(i, n) {
47
+ return f(i, (e) => {
48
+ const c = o(e.messages?.invalid, n);
49
+ let s = c ? b(c) : b();
44
50
  if (e.required === !0) {
45
- const r = o(e.messages?.required, m) ?? "This field is required";
46
- s = s.check(c((t) => t.length > 0, { error: r }));
51
+ const r = o(e.messages?.required, n) ?? "This field is required";
52
+ s = s.check(u((t) => t.length > 0, { error: r }));
47
53
  }
48
54
  if (typeof e.minLength == "number") {
49
- const r = o(e.messages?.minLength, m), t = e.minLength;
55
+ const r = o(e.messages?.minLength, n), t = e.minLength;
50
56
  s = s.check(
51
- r ? c((n) => n.length >= t, { error: r }) : q(t)
57
+ r ? u((m) => m.length >= t, { error: r }) : q(t)
52
58
  );
53
59
  }
54
60
  if (typeof e.maxLength == "number") {
55
- const r = o(e.messages?.maxLength, m), t = e.maxLength;
61
+ const r = o(e.messages?.maxLength, n), t = e.maxLength;
56
62
  s = s.check(
57
- r ? c((n) => n.length <= t, { error: r }) : I(t)
63
+ r ? u((m) => m.length <= t, { error: r }) : I(t)
58
64
  );
59
65
  }
60
66
  if (typeof e.pattern == "string") {
61
- const r = o(e.messages?.pattern, m), t = new RegExp(e.pattern);
67
+ const r = o(e.messages?.pattern, n), t = new RegExp(e.pattern);
62
68
  s = s.check(
63
- r ? c((n) => t.test(n), { error: r }) : C(t)
69
+ r ? u((m) => t.test(m), { error: r }) : A(t)
64
70
  );
65
71
  }
66
72
  if (e.enum) {
67
- const r = e.enum, t = o(e.messages?.enum, m);
68
- s = s.check(c((n) => r.includes(n), t ? { error: t } : void 0));
73
+ const r = e.enum, t = o(e.messages?.enum, n);
74
+ s = s.check(u((m) => r.includes(m), t ? { error: t } : void 0));
69
75
  }
70
76
  if (e.const !== void 0) {
71
- const r = o(e.messages?.const, m);
72
- s = s.check(c((t) => t === e.const, r ? { error: r } : void 0));
77
+ const r = o(e.messages?.const, n);
78
+ s = s.check(u((t) => t === e.const, r ? { error: r } : void 0));
73
79
  }
74
80
  if (e.format !== void 0)
75
- if (K.includes(e.format)) {
76
- const r = o(e.messages?.format, m);
81
+ if (w.includes(e.format)) {
82
+ const r = o(e.messages?.format, n);
77
83
  s = s.check(
78
- r ? V((t, n) => {
79
- const h = b(
80
- g[e.format].schema,
84
+ r ? V((t, m) => {
85
+ const a = M(
86
+ p[e.format].schema,
81
87
  t
82
88
  );
83
- M(h) || n.addIssue({ code: "custom", path: [], message: r });
84
- }) : g[e.format].schema
89
+ O(a) || m.addIssue({ code: "custom", path: [], message: r });
90
+ }) : p[e.format].schema
85
91
  );
86
92
  } else
87
- console.error(`The string validation format "${e.format}" is not supported`);
93
+ throw new Error(
94
+ `Unknown string validation format: ${JSON.stringify(e.format)}. The "format" property must be one of: ${w.map((r) => `"${r}"`).join(", ")}.`
95
+ );
88
96
  return s;
89
97
  });
90
98
  }
91
- const D = (i, m) => {
92
- if (m === 0)
99
+ const C = (i, n) => {
100
+ if (n === 0)
93
101
  return !1;
94
- const e = i / m;
102
+ const e = i / n;
95
103
  return Math.abs(e - Math.round(e)) < 1e-10;
96
104
  };
97
- function G(i, m) {
98
- return a(i, (e) => {
99
- const u = o(e.messages?.invalid, m);
100
- let s = u ? k(u) : k();
101
- if (e.type === "integer" && (s = s.check($())), e.minimum !== void 0) {
102
- const r = o(e.messages?.minimum, m), t = e.minimum;
103
- s = s.check(r ? c((n) => n >= t, { error: r }) : A(t));
105
+ function K(i, n) {
106
+ return f(i, (e) => {
107
+ const c = o(e.messages?.invalid, n);
108
+ let s = c ? y(c) : y();
109
+ if (e.type === "integer" && (s = s.check(U())), e.minimum !== void 0) {
110
+ const r = o(e.messages?.minimum, n), t = e.minimum;
111
+ s = s.check(r ? u((m) => m >= t, { error: r }) : J(t));
104
112
  }
105
113
  if (e.maximum !== void 0) {
106
- const r = o(e.messages?.maximum, m), t = e.maximum;
107
- s = s.check(r ? c((n) => n <= t, { error: r }) : B(t));
114
+ const r = o(e.messages?.maximum, n), t = e.maximum;
115
+ s = s.check(r ? u((m) => m <= t, { error: r }) : _(t));
108
116
  }
109
117
  if (e.exclusiveMinimum !== void 0) {
110
- const r = o(e.messages?.exclusiveMinimum, m), t = e.exclusiveMinimum;
111
- s = s.check(c((n) => n > t, r ? { error: r } : void 0));
118
+ const r = o(e.messages?.exclusiveMinimum, n), t = e.exclusiveMinimum;
119
+ s = s.check(u((m) => m > t, r ? { error: r } : void 0));
112
120
  }
113
121
  if (e.exclusiveMaximum !== void 0) {
114
- const r = o(e.messages?.exclusiveMaximum, m), t = e.exclusiveMaximum;
115
- s = s.check(c((n) => n < t, r ? { error: r } : void 0));
122
+ const r = o(e.messages?.exclusiveMaximum, n), t = e.exclusiveMaximum;
123
+ s = s.check(u((m) => m < t, r ? { error: r } : void 0));
116
124
  }
117
125
  if (e.multipleOf !== void 0) {
118
- const r = o(e.messages?.multipleOf, m), t = e.multipleOf;
126
+ const r = o(e.messages?.multipleOf, n), t = e.multipleOf;
119
127
  s = s.check(
120
- c((n) => D(n, t), r ? { error: r } : void 0)
128
+ u((m) => C(m, t), r ? { error: r } : void 0)
121
129
  );
122
130
  }
123
131
  if (e.enum) {
124
- const r = e.enum, t = o(e.messages?.enum, m);
125
- s = s.check(c((n) => r.includes(n), t ? { error: t } : void 0));
132
+ const r = e.enum, t = o(e.messages?.enum, n);
133
+ s = s.check(u((m) => r.includes(m), t ? { error: t } : void 0));
126
134
  }
127
135
  if (e.const !== void 0) {
128
- const r = o(e.messages?.const, m);
129
- s = s.check(c((t) => t === e.const, r ? { error: r } : void 0));
136
+ const r = o(e.messages?.const, n);
137
+ s = s.check(u((t) => t === e.const, r ? { error: r } : void 0));
130
138
  }
131
139
  return s;
132
140
  });
133
141
  }
134
- function H(i, m) {
135
- return a(i, (e) => {
136
- const u = o(e.messages?.invalid, m);
137
- let s = u ? x(u) : x();
142
+ function D(i, n) {
143
+ return f(i, (e) => {
144
+ const c = o(e.messages?.invalid, n);
145
+ let s = c ? x(c) : x();
138
146
  if (e.const !== void 0) {
139
- const r = o(e.messages?.const, m);
140
- s = s.check(c((t) => t === e.const, r ? { error: r } : void 0));
147
+ const r = o(e.messages?.const, n);
148
+ s = s.check(u((t) => t === e.const, r ? { error: r } : void 0));
141
149
  }
142
150
  return s;
143
151
  });
144
152
  }
145
- function J(i, m) {
146
- return a(i, (e) => {
147
- const u = o(e.messages?.invalid, m);
148
- let s = u ? l(f(), u) : l(f());
153
+ function G(i, n) {
154
+ return f(i, (e) => {
155
+ const c = o(e.messages?.invalid, n);
156
+ let s = c ? k(g(), c) : k(g());
149
157
  if (e.required === !0) {
150
- const r = o(e.messages?.required, m) ?? "This field is required";
151
- s = s.check(c((t) => t.length > 0, { error: r }));
158
+ const r = o(e.messages?.required, n) ?? "This field is required";
159
+ s = s.check(u((t) => t.length > 0, { error: r }));
152
160
  }
153
161
  if (typeof e.minItems == "number") {
154
- const r = o(e.messages?.minItems, m), t = e.minItems;
162
+ const r = o(e.messages?.minItems, n), t = e.minItems;
155
163
  s = s.check(
156
- r ? c((n) => n.length >= t, { error: r }) : q(t)
164
+ r ? u((m) => m.length >= t, { error: r }) : q(t)
157
165
  );
158
166
  }
159
167
  if (typeof e.maxItems == "number") {
160
- const r = o(e.messages?.maxItems, m), t = e.maxItems;
168
+ const r = o(e.messages?.maxItems, n), t = e.maxItems;
161
169
  s = s.check(
162
- r ? c((n) => n.length <= t, { error: r }) : I(t)
170
+ r ? u((m) => m.length <= t, { error: r }) : I(t)
163
171
  );
164
172
  }
165
173
  return s;
166
174
  });
167
175
  }
168
- function P(i, m) {
169
- return a(i, (e) => {
170
- let u = f();
171
- return w(
176
+ function H(i, n) {
177
+ return f(i, (e) => {
178
+ let c = g();
179
+ return S(
172
180
  Object.keys(e),
173
181
  // filter non-custom validator keys
174
182
  (s) => s !== "type" && s !== "required",
175
183
  (s) => {
176
- const r = e[s], t = m[s], n = t(r);
177
- u = u.check(
178
- V((h, L) => {
179
- const p = b(
180
- n,
181
- h
184
+ const r = e[s], t = n[s];
185
+ if (!t) {
186
+ const a = Object.keys(n).map((h) => `"${h}"`).join(", ");
187
+ throw new Error(
188
+ `Unknown custom validator rule "${s}". Registered rules: ${a || "(none)"}.`
189
+ );
190
+ }
191
+ const m = t(r);
192
+ c = c.check(
193
+ V((a, h) => {
194
+ const l = M(
195
+ m,
196
+ a
182
197
  );
183
- if (!M(p)) {
184
- const O = p.issues[0];
185
- L.addIssue({
198
+ if (!O(l)) {
199
+ const L = l.issues[0];
200
+ h.addIssue({
186
201
  code: "custom",
187
202
  path: [],
188
- message: O?.message || `Validation failed for ${s}`
203
+ message: L?.message || `Validation failed for ${s}`
189
204
  });
190
205
  }
191
206
  })
192
207
  );
193
208
  }
194
- ), u;
209
+ ), c;
195
210
  });
196
211
  }
197
- function a(i, m) {
198
- const e = m(i);
199
- return i.required ? e : _(e);
212
+ function f(i, n) {
213
+ const e = n(i);
214
+ return i.required ? e : N(e);
200
215
  }
201
216
  export {
202
217
  Y as initValidators
package/index.umd.cjs CHANGED
@@ -1 +1 @@
1
- (function(i,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("@golemui/core"),require("@standard-schema/spec"),require("zod"),require("zod/mini")):typeof define=="function"&&define.amd?define(["exports","@golemui/core","@standard-schema/spec","zod","zod/mini"],d):(i=typeof globalThis<"u"?globalThis:i||self,d(i["gui-validators"]={},i.core,null,i.zod,i.mini))})(this,(function(i,d,O,h,n){"use strict";const g={email:{schema:n.email()},hostname:{schema:n.hostname()},ipv4:{schema:n.ipv4()},ipv6:{schema:n.ipv6()},url:{schema:n.url()},uuid:{schema:n.uuid()},date:{schema:h.iso.date()},time:{schema:h.iso.time()},"date-time":{schema:h.iso.datetime({local:!0,offset:!0})},duration:{schema:h.iso.duration()}},x=Object.keys(g),y=u=>(o,e)=>{switch(o.type){case"string":return k(o,e);case"integer":case"number":return M(o,e);case"boolean":return q(o,e);case"array":return V(o,e);case"custom":{if(!u)throw new Error('Validator type "custom" requires a customValidators object, but it was not supplied.');return L(o,u)}}};function m(u,o){if(u!==void 0)return typeof u=="string"?u:o?.translate(u.key,u.params,u.default)??u.default}function k(u,o){return f(u,e=>{const a=m(e.messages?.invalid,o);let s=a?n.string(a):n.string();if(e.required===!0){const r=m(e.messages?.required,o)??"This field is required";s=s.check(n.refine(t=>t.length>0,{error:r}))}if(typeof e.minLength=="number"){const r=m(e.messages?.minLength,o),t=e.minLength;s=s.check(r?n.refine(c=>c.length>=t,{error:r}):n.minLength(t))}if(typeof e.maxLength=="number"){const r=m(e.messages?.maxLength,o),t=e.maxLength;s=s.check(r?n.refine(c=>c.length<=t,{error:r}):n.maxLength(t))}if(typeof e.pattern=="string"){const r=m(e.messages?.pattern,o),t=new RegExp(e.pattern);s=s.check(r?n.refine(c=>t.test(c),{error:r}):n.regex(t))}if(e.enum){const r=e.enum,t=m(e.messages?.enum,o);s=s.check(n.refine(c=>r.includes(c),t?{error:t}:void 0))}if(e.const!==void 0){const r=m(e.messages?.const,o);s=s.check(n.refine(t=>t===e.const,r?{error:r}:void 0))}if(e.format!==void 0)if(x.includes(e.format)){const r=m(e.messages?.format,o);s=s.check(r?n.superRefine((t,c)=>{const p=d.standardValidate(g[e.format].schema,t);d.isStandardValidateSuccess(p)||c.addIssue({code:"custom",path:[],message:r})}):g[e.format].schema)}else console.error(`The string validation format "${e.format}" is not supported`);return s})}const b=(u,o)=>{if(o===0)return!1;const e=u/o;return Math.abs(e-Math.round(e))<1e-10};function M(u,o){return f(u,e=>{const a=m(e.messages?.invalid,o);let s=a?n.number(a):n.number();if(e.type==="integer"&&(s=s.check(n.int())),e.minimum!==void 0){const r=m(e.messages?.minimum,o),t=e.minimum;s=s.check(r?n.refine(c=>c>=t,{error:r}):n.minimum(t))}if(e.maximum!==void 0){const r=m(e.messages?.maximum,o),t=e.maximum;s=s.check(r?n.refine(c=>c<=t,{error:r}):n.maximum(t))}if(e.exclusiveMinimum!==void 0){const r=m(e.messages?.exclusiveMinimum,o),t=e.exclusiveMinimum;s=s.check(n.refine(c=>c>t,r?{error:r}:void 0))}if(e.exclusiveMaximum!==void 0){const r=m(e.messages?.exclusiveMaximum,o),t=e.exclusiveMaximum;s=s.check(n.refine(c=>c<t,r?{error:r}:void 0))}if(e.multipleOf!==void 0){const r=m(e.messages?.multipleOf,o),t=e.multipleOf;s=s.check(n.refine(c=>b(c,t),r?{error:r}:void 0))}if(e.enum){const r=e.enum,t=m(e.messages?.enum,o);s=s.check(n.refine(c=>r.includes(c),t?{error:t}:void 0))}if(e.const!==void 0){const r=m(e.messages?.const,o);s=s.check(n.refine(t=>t===e.const,r?{error:r}:void 0))}return s})}function q(u,o){return f(u,e=>{const a=m(e.messages?.invalid,o);let s=a?n.boolean(a):n.boolean();if(e.const!==void 0){const r=m(e.messages?.const,o);s=s.check(n.refine(t=>t===e.const,r?{error:r}:void 0))}return s})}function V(u,o){return f(u,e=>{const a=m(e.messages?.invalid,o);let s=a?n.array(n.any(),a):n.array(n.any());if(e.required===!0){const r=m(e.messages?.required,o)??"This field is required";s=s.check(n.refine(t=>t.length>0,{error:r}))}if(typeof e.minItems=="number"){const r=m(e.messages?.minItems,o),t=e.minItems;s=s.check(r?n.refine(c=>c.length>=t,{error:r}):n.minLength(t))}if(typeof e.maxItems=="number"){const r=m(e.messages?.maxItems,o),t=e.maxItems;s=s.check(r?n.refine(c=>c.length<=t,{error:r}):n.maxLength(t))}return s})}function L(u,o){return f(u,e=>{let a=n.any();return d.filterTap(Object.keys(e),s=>s!=="type"&&s!=="required",s=>{const r=e[s],t=o[s],c=t(r);a=a.check(n.superRefine((p,S)=>{const l=d.standardValidate(c,p);if(!d.isStandardValidateSuccess(l)){const I=l.issues[0];S.addIssue({code:"custom",path:[],message:I?.message||`Validation failed for ${s}`})}}))}),a})}function f(u,o){const e=o(u);return u.required?e:n.optional(e)}i.initValidators=y,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(i,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("@golemui/core"),require("@standard-schema/spec"),require("zod"),require("zod/mini")):typeof define=="function"&&define.amd?define(["exports","@golemui/core","@standard-schema/spec","zod","zod/mini"],f):(i=typeof globalThis<"u"?globalThis:i||self,f(i["gui-validators"]={},i.core,null,i.zod,i.mini))})(this,(function(i,f,L,g,n){"use strict";const p={email:{schema:n.email()},hostname:{schema:n.hostname()},ipv4:{schema:n.ipv4()},ipv6:{schema:n.ipv6()},url:{schema:n.url()},uuid:{schema:n.uuid()},date:{schema:g.iso.date()},time:{schema:g.iso.time()},"date-time":{schema:g.iso.datetime({local:!0,offset:!0})},duration:{schema:g.iso.duration()}},y=Object.keys(p),k=u=>(o,e)=>{switch(o.type){case"string":return b(o,e);case"integer":case"number":return M(o,e);case"boolean":return q(o,e);case"array":return V(o,e);case"custom":{if(!u)throw new Error('Validator type "custom" requires a customValidators object, but it was not supplied.');return S(o,u)}default:{const a=o;throw new Error(`Unknown validator config: ${JSON.stringify(a)}. The "type" property must be one of: "string", "number", "integer", "boolean", "array", "custom".`)}}};function m(u,o){if(u!==void 0)return typeof u=="string"?u:o?.translate(u.key,u.params,u.default)??u.default}function b(u,o){return d(u,e=>{const a=m(e.messages?.invalid,o);let s=a?n.string(a):n.string();if(e.required===!0){const r=m(e.messages?.required,o)??"This field is required";s=s.check(n.refine(t=>t.length>0,{error:r}))}if(typeof e.minLength=="number"){const r=m(e.messages?.minLength,o),t=e.minLength;s=s.check(r?n.refine(c=>c.length>=t,{error:r}):n.minLength(t))}if(typeof e.maxLength=="number"){const r=m(e.messages?.maxLength,o),t=e.maxLength;s=s.check(r?n.refine(c=>c.length<=t,{error:r}):n.maxLength(t))}if(typeof e.pattern=="string"){const r=m(e.messages?.pattern,o),t=new RegExp(e.pattern);s=s.check(r?n.refine(c=>t.test(c),{error:r}):n.regex(t))}if(e.enum){const r=e.enum,t=m(e.messages?.enum,o);s=s.check(n.refine(c=>r.includes(c),t?{error:t}:void 0))}if(e.const!==void 0){const r=m(e.messages?.const,o);s=s.check(n.refine(t=>t===e.const,r?{error:r}:void 0))}if(e.format!==void 0)if(y.includes(e.format)){const r=m(e.messages?.format,o);s=s.check(r?n.superRefine((t,c)=>{const h=f.standardValidate(p[e.format].schema,t);f.isStandardValidateSuccess(h)||c.addIssue({code:"custom",path:[],message:r})}):p[e.format].schema)}else throw new Error(`Unknown string validation format: ${JSON.stringify(e.format)}. The "format" property must be one of: ${y.map(r=>`"${r}"`).join(", ")}.`);return s})}const w=(u,o)=>{if(o===0)return!1;const e=u/o;return Math.abs(e-Math.round(e))<1e-10};function M(u,o){return d(u,e=>{const a=m(e.messages?.invalid,o);let s=a?n.number(a):n.number();if(e.type==="integer"&&(s=s.check(n.int())),e.minimum!==void 0){const r=m(e.messages?.minimum,o),t=e.minimum;s=s.check(r?n.refine(c=>c>=t,{error:r}):n.minimum(t))}if(e.maximum!==void 0){const r=m(e.messages?.maximum,o),t=e.maximum;s=s.check(r?n.refine(c=>c<=t,{error:r}):n.maximum(t))}if(e.exclusiveMinimum!==void 0){const r=m(e.messages?.exclusiveMinimum,o),t=e.exclusiveMinimum;s=s.check(n.refine(c=>c>t,r?{error:r}:void 0))}if(e.exclusiveMaximum!==void 0){const r=m(e.messages?.exclusiveMaximum,o),t=e.exclusiveMaximum;s=s.check(n.refine(c=>c<t,r?{error:r}:void 0))}if(e.multipleOf!==void 0){const r=m(e.messages?.multipleOf,o),t=e.multipleOf;s=s.check(n.refine(c=>w(c,t),r?{error:r}:void 0))}if(e.enum){const r=e.enum,t=m(e.messages?.enum,o);s=s.check(n.refine(c=>r.includes(c),t?{error:t}:void 0))}if(e.const!==void 0){const r=m(e.messages?.const,o);s=s.check(n.refine(t=>t===e.const,r?{error:r}:void 0))}return s})}function q(u,o){return d(u,e=>{const a=m(e.messages?.invalid,o);let s=a?n.boolean(a):n.boolean();if(e.const!==void 0){const r=m(e.messages?.const,o);s=s.check(n.refine(t=>t===e.const,r?{error:r}:void 0))}return s})}function V(u,o){return d(u,e=>{const a=m(e.messages?.invalid,o);let s=a?n.array(n.any(),a):n.array(n.any());if(e.required===!0){const r=m(e.messages?.required,o)??"This field is required";s=s.check(n.refine(t=>t.length>0,{error:r}))}if(typeof e.minItems=="number"){const r=m(e.messages?.minItems,o),t=e.minItems;s=s.check(r?n.refine(c=>c.length>=t,{error:r}):n.minLength(t))}if(typeof e.maxItems=="number"){const r=m(e.messages?.maxItems,o),t=e.maxItems;s=s.check(r?n.refine(c=>c.length<=t,{error:r}):n.maxLength(t))}return s})}function S(u,o){return d(u,e=>{let a=n.any();return f.filterTap(Object.keys(e),s=>s!=="type"&&s!=="required",s=>{const r=e[s],t=o[s];if(!t){const h=Object.keys(o).map(l=>`"${l}"`).join(", ");throw new Error(`Unknown custom validator rule "${s}". Registered rules: ${h||"(none)"}.`)}const c=t(r);a=a.check(n.superRefine((h,l)=>{const x=f.standardValidate(c,h);if(!f.isStandardValidateSuccess(x)){const O=x.issues[0];l.addIssue({code:"custom",path:[],message:O?.message||`Validation failed for ${s}`})}}))}),a})}function d(u,o){const e=o(u);return u.required?e:n.optional(e)}i.initValidators=k,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemui/gui-validators",
3
- "version": "1.1.0",
3
+ "version": "1.1.1-rc.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./index.umd.cjs",
@@ -23,7 +23,7 @@
23
23
  "peerDependencies": {
24
24
  "zod": "^4.0.0",
25
25
  "@standard-schema/spec": "^1.0.0",
26
- "@golemui/core": "1.1.0"
26
+ "@golemui/core": "1.1.1-rc.0"
27
27
  },
28
28
  "repository": {
29
29
  "type": "git",