@cntrl-site/components 1.0.7-alpha.10 → 1.0.7-alpha.13

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.
@@ -0,0 +1,60 @@
1
+ import { useId as f } from "react";
2
+ function h(e, t = !1) {
3
+ return t ? `calc(var(--cntrl-article-width) * ${e})` : `${e * 100}vw`;
4
+ }
5
+ const p = (e, t, n, a, r) => {
6
+ const i = {};
7
+ for (const [o, s] of Object.entries(n))
8
+ i[`--${e}-${s}`] = t[o];
9
+ if (r)
10
+ for (const o of a) {
11
+ const s = r[o];
12
+ if (s)
13
+ for (const [l, u] of Object.entries(n)) {
14
+ const c = s[l];
15
+ c !== void 0 && (i[`--${e}-${o}-${u}`] = c);
16
+ }
17
+ }
18
+ return i;
19
+ }, d = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, m = (e) => d.test(e.trim()), g = (e) => {
20
+ const t = e.replace(/\D/g, "");
21
+ return t.length >= 7 && t.length <= 15;
22
+ }, $ = (e, t) => {
23
+ var n;
24
+ for (const a of e) {
25
+ const r = ((n = t[a.name]) == null ? void 0 : n.trim()) ?? "";
26
+ if (r) {
27
+ if (a.type === "email" && !m(r))
28
+ return "Please enter a valid email address.";
29
+ if (a.type === "phone" && !g(r))
30
+ return "Please enter a valid phone number.";
31
+ }
32
+ }
33
+ return null;
34
+ };
35
+ function y() {
36
+ const t = `cf-${f().replace(/:/g, "")}`;
37
+ return {
38
+ prefix: t,
39
+ cls: (n) => `${t}-${n}`
40
+ };
41
+ }
42
+ const v = (e, t) => {
43
+ const n = Array.from(e.querySelectorAll('[data-testimonial-measure="text"]')).reduce(
44
+ (r, i) => Math.max(r, i.getBoundingClientRect().height),
45
+ 0
46
+ ), a = Array.from(e.querySelectorAll('[data-testimonial-measure="caption"]')).reduce(
47
+ (r, i) => Math.max(r, i.getBoundingClientRect().height),
48
+ 0
49
+ );
50
+ t({ maxTextPx: n, maxCaptionPx: a });
51
+ };
52
+ export {
53
+ g as a,
54
+ p as b,
55
+ $ as g,
56
+ m as i,
57
+ v as r,
58
+ h as s,
59
+ y as u
60
+ };
@@ -0,0 +1 @@
1
+ "use strict";const m=require("react");function g(e,t=!1){return t?`calc(var(--cntrl-article-width) * ${e})`:`${e*100}vw`}const h=(e,t,i,n,r)=>{const a={};for(const[o,s]of Object.entries(i))a[`--${e}-${s}`]=t[o];if(r)for(const o of n){const s=r[o];if(s)for(const[d,f]of Object.entries(i)){const l=s[d];l!==void 0&&(a[`--${e}-${o}-${f}`]=l)}}return a},x=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,c=e=>x.test(e.trim()),u=e=>{const t=e.replace(/\D/g,"");return t.length>=7&&t.length<=15},$=(e,t)=>{var i;for(const n of e){const r=((i=t[n.name])==null?void 0:i.trim())??"";if(r){if(n.type==="email"&&!c(r))return"Please enter a valid email address.";if(n.type==="phone"&&!u(r))return"Please enter a valid phone number."}}return null};function p(){const t=`cf-${m.useId().replace(/:/g,"")}`;return{prefix:t,cls:i=>`${t}-${i}`}}const y=(e,t)=>{const i=Array.from(e.querySelectorAll('[data-testimonial-measure="text"]')).reduce((r,a)=>Math.max(r,a.getBoundingClientRect().height),0),n=Array.from(e.querySelectorAll('[data-testimonial-measure="caption"]')).reduce((r,a)=>Math.max(r,a.getBoundingClientRect().height),0);t({maxTextPx:i,maxCaptionPx:n})};exports.buildColorVars=h;exports.getFormFieldValidationError=$;exports.isValidEmailFormat=c;exports.isValidPhoneFormat=u;exports.readTestimonialTextMeasure=y;exports.scalingValue=g;exports.useScopedStyles=p;
package/dist/utils.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useScopedStyles-DpVdqfXj.js");exports.buildColorVars=e.buildColorVars;exports.getFormFieldValidationError=e.getFormFieldValidationError;exports.isValidEmailFormat=e.isValidEmailFormat;exports.isValidPhoneFormat=e.isValidPhoneFormat;exports.scalingValue=e.scalingValue;exports.useScopedStyles=e.useScopedStyles;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./readTestimonialTextMeasure-CB_Uq-fO.js");exports.buildColorVars=e.buildColorVars;exports.getFormFieldValidationError=e.getFormFieldValidationError;exports.isValidEmailFormat=e.isValidEmailFormat;exports.isValidPhoneFormat=e.isValidPhoneFormat;exports.readTestimonialTextMeasure=e.readTestimonialTextMeasure;exports.scalingValue=e.scalingValue;exports.useScopedStyles=e.useScopedStyles;
package/dist/utils.mjs CHANGED
@@ -1,9 +1,10 @@
1
- import { b as i, g as o, i as l, a as r, s as e, u as d } from "./useScopedStyles-BSwFAT27.mjs";
1
+ import { b as e, g as i, i as r, a as o, r as l, s as t, u as d } from "./readTestimonialTextMeasure-B1FI-93F.mjs";
2
2
  export {
3
- i as buildColorVars,
4
- o as getFormFieldValidationError,
5
- l as isValidEmailFormat,
6
- r as isValidPhoneFormat,
7
- e as scalingValue,
3
+ e as buildColorVars,
4
+ i as getFormFieldValidationError,
5
+ r as isValidEmailFormat,
6
+ o as isValidPhoneFormat,
7
+ l as readTestimonialTextMeasure,
8
+ t as scalingValue,
8
9
  d as useScopedStyles
9
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/components",
3
- "version": "1.0.7-alpha.10",
3
+ "version": "1.0.7-alpha.13",
4
4
  "description": "Custom components for control editor and public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1,49 +0,0 @@
1
- import { useId as u } from "react";
2
- function g(e, t = !1) {
3
- return t ? `calc(var(--cntrl-article-width) * ${e})` : `${e * 100}vw`;
4
- }
5
- const v = (e, t, n, s, r) => {
6
- const a = {};
7
- for (const [o, i] of Object.entries(n))
8
- a[`--${e}-${i}`] = t[o];
9
- if (r)
10
- for (const o of s) {
11
- const i = r[o];
12
- if (i)
13
- for (const [l, f] of Object.entries(n)) {
14
- const c = i[l];
15
- c !== void 0 && (a[`--${e}-${o}-${f}`] = c);
16
- }
17
- }
18
- return a;
19
- }, d = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, m = (e) => d.test(e.trim()), $ = (e) => {
20
- const t = e.replace(/\D/g, "");
21
- return t.length >= 7 && t.length <= 15;
22
- }, h = (e, t) => {
23
- var n;
24
- for (const s of e) {
25
- const r = ((n = t[s.name]) == null ? void 0 : n.trim()) ?? "";
26
- if (r) {
27
- if (s.type === "email" && !m(r))
28
- return "Please enter a valid email address.";
29
- if (s.type === "phone" && !$(r))
30
- return "Please enter a valid phone number.";
31
- }
32
- }
33
- return null;
34
- };
35
- function b() {
36
- const t = `cf-${u().replace(/:/g, "")}`;
37
- return {
38
- prefix: t,
39
- cls: (n) => `${t}-${n}`
40
- };
41
- }
42
- export {
43
- $ as a,
44
- v as b,
45
- h as g,
46
- m as i,
47
- g as s,
48
- b as u
49
- };
@@ -1 +0,0 @@
1
- "use strict";const m=require("react");function $(e,t=!1){return t?`calc(var(--cntrl-article-width) * ${e})`:`${e*100}vw`}const g=(e,t,r,n,i)=>{const a={};for(const[o,s]of Object.entries(r))a[`--${e}-${s}`]=t[o];if(i)for(const o of n){const s=i[o];if(s)for(const[d,u]of Object.entries(r)){const l=s[d];l!==void 0&&(a[`--${e}-${o}-${u}`]=l)}}return a},V=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,c=e=>V.test(e.trim()),f=e=>{const t=e.replace(/\D/g,"");return t.length>=7&&t.length<=15},p=(e,t)=>{var r;for(const n of e){const i=((r=t[n.name])==null?void 0:r.trim())??"";if(i){if(n.type==="email"&&!c(i))return"Please enter a valid email address.";if(n.type==="phone"&&!f(i))return"Please enter a valid phone number."}}return null};function v(){const t=`cf-${m.useId().replace(/:/g,"")}`;return{prefix:t,cls:r=>`${t}-${r}`}}exports.buildColorVars=g;exports.getFormFieldValidationError=p;exports.isValidEmailFormat=c;exports.isValidPhoneFormat=f;exports.scalingValue=$;exports.useScopedStyles=v;