@cntrl-site/components 1.0.1-alpha.2 → 1.0.1-alpha.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.
- package/dist/Components/utils/formFieldValidation.d.ts +9 -0
- package/dist/Components/utils/index.d.ts +2 -0
- package/dist/index.js +62 -7
- package/dist/index.mjs +2058 -1995
- package/dist/types/SchemaV1.d.ts +1 -0
- package/dist/useScopedStyles-Bibm8h9Z.js +1 -0
- package/dist/useScopedStyles-Da2iLz5N.mjs +34 -0
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +6 -3
- package/package.json +1 -1
- package/dist/useScopedStyles-b8cb4EW8.js +0 -1
- package/dist/useScopedStyles-c-B_XeP_.mjs +0 -15
package/dist/types/SchemaV1.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const l=require("react");function o(e,t=!1){return t?`calc(var(--cntrl-article-width) * ${e})`:`${e*100}vw`}const c=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,a=e=>c.test(e.trim()),s=e=>{const t=e.replace(/\D/g,"");return t.length>=7&&t.length<=15},d=(e,t)=>{var r;for(const i of e){const n=((r=t[i.name])==null?void 0:r.trim())??"";if(n){if(i.type==="email"&&!a(n))return"Please enter a valid email address.";if(i.type==="phone"&&!s(n))return"Please enter a valid phone number."}}return null};function u(){const t=`cf-${l.useId().replace(/:/g,"")}`;return{prefix:t,cls:r=>`${t}-${r}`}}exports.getFormFieldValidationError=d;exports.isValidEmailFormat=a;exports.isValidPhoneFormat=s;exports.scalingValue=o;exports.useScopedStyles=u;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useId as a } from "react";
|
|
2
|
+
function d(e, t = !1) {
|
|
3
|
+
return t ? `calc(var(--cntrl-article-width) * ${e})` : `${e * 100}vw`;
|
|
4
|
+
}
|
|
5
|
+
const i = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, o = (e) => i.test(e.trim()), l = (e) => {
|
|
6
|
+
const t = e.replace(/\D/g, "");
|
|
7
|
+
return t.length >= 7 && t.length <= 15;
|
|
8
|
+
}, u = (e, t) => {
|
|
9
|
+
var r;
|
|
10
|
+
for (const n of e) {
|
|
11
|
+
const s = ((r = t[n.name]) == null ? void 0 : r.trim()) ?? "";
|
|
12
|
+
if (s) {
|
|
13
|
+
if (n.type === "email" && !o(s))
|
|
14
|
+
return "Please enter a valid email address.";
|
|
15
|
+
if (n.type === "phone" && !l(s))
|
|
16
|
+
return "Please enter a valid phone number.";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
};
|
|
21
|
+
function f() {
|
|
22
|
+
const t = `cf-${a().replace(/:/g, "")}`;
|
|
23
|
+
return {
|
|
24
|
+
prefix: t,
|
|
25
|
+
cls: (r) => `${t}-${r}`
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
l as a,
|
|
30
|
+
u as g,
|
|
31
|
+
o as i,
|
|
32
|
+
d as s,
|
|
33
|
+
f as u
|
|
34
|
+
};
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useScopedStyles-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useScopedStyles-Bibm8h9Z.js");exports.getFormFieldValidationError=e.getFormFieldValidationError;exports.isValidEmailFormat=e.isValidEmailFormat;exports.isValidPhoneFormat=e.isValidPhoneFormat;exports.scalingValue=e.scalingValue;exports.useScopedStyles=e.useScopedStyles;
|
package/dist/utils.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as i, i as o, a as e, s as l, u as r } from "./useScopedStyles-Da2iLz5N.mjs";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
i as getFormFieldValidationError,
|
|
4
|
+
o as isValidEmailFormat,
|
|
5
|
+
e as isValidPhoneFormat,
|
|
6
|
+
l as scalingValue,
|
|
7
|
+
r as useScopedStyles
|
|
5
8
|
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const s=require("react");function n(c,e=!1){return e?`calc(var(--cntrl-article-width) * ${c})`:`${c*100}vw`}function r(){const e=`cf-${s.useId().replace(/:/g,"")}`;return{prefix:e,cls:t=>`${e}-${t}`}}exports.scalingValue=n;exports.useScopedStyles=r;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useId as t } from "react";
|
|
2
|
-
function n(e, c = !1) {
|
|
3
|
-
return c ? `calc(var(--cntrl-article-width) * ${e})` : `${e * 100}vw`;
|
|
4
|
-
}
|
|
5
|
-
function i() {
|
|
6
|
-
const c = `cf-${t().replace(/:/g, "")}`;
|
|
7
|
-
return {
|
|
8
|
-
prefix: c,
|
|
9
|
-
cls: (r) => `${c}-${r}`
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
n as s,
|
|
14
|
-
i as u
|
|
15
|
-
};
|