@cntrl-site/components 1.0.73-alpha.0 → 1.0.73
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/props.d.ts +0 -10
- package/dist/Components/utils/index.d.ts +0 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +114 -3110
- package/dist/index.mjs +9520 -14450
- package/dist/readTestimonialTextMeasure-B1FI-93F.mjs +60 -0
- package/dist/readTestimonialTextMeasure-CB_Uq-fO.js +1 -0
- package/dist/types/Component.d.ts +1 -1
- package/dist/types/SchemaV1.d.ts +0 -13
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +8 -12
- package/package.json +1 -1
- package/dist/Components/Burger/Burger.d.ts +0 -138
- package/dist/Components/Burger/BurgerComponent.d.ts +0 -825
- package/dist/Components/utils/panelAvailability.d.ts +0 -13
- package/dist/panelAvailability-CgSic84c.mjs +0 -126
- package/dist/panelAvailability-D8c7cdbu.js +0 -1
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type PanelAvailabilityContext = Record<string, string | undefined>;
|
|
2
|
-
type AvailabilityPanel = {
|
|
3
|
-
id: string;
|
|
4
|
-
availableWhen?: Record<string, string[]>;
|
|
5
|
-
};
|
|
6
|
-
type AvailabilitySchema = {
|
|
7
|
-
panels?: AvailabilityPanel[];
|
|
8
|
-
statePanels?: string[] | null;
|
|
9
|
-
};
|
|
10
|
-
export declare function isPanelAvailable(panel: AvailabilityPanel | undefined, context: PanelAvailabilityContext): boolean;
|
|
11
|
-
export declare function getAvailableStatePanels(schema: AvailabilitySchema | undefined, context: PanelAvailabilityContext): string[] | null;
|
|
12
|
-
export declare function getUnavailableStates(schema: AvailabilitySchema | undefined, context: PanelAvailabilityContext): string[];
|
|
13
|
-
export {};
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { useId as d } from "react";
|
|
2
|
-
function S(t, e = !1) {
|
|
3
|
-
return e ? `calc(var(--cntrl-article-width) * ${t})` : `${t * 100}vw`;
|
|
4
|
-
}
|
|
5
|
-
const y = (t, e, r, i, n) => {
|
|
6
|
-
const a = {};
|
|
7
|
-
for (const [s, l] of Object.entries(r))
|
|
8
|
-
a[`--${t}-${l}`] = e[s];
|
|
9
|
-
const o = new Set(i);
|
|
10
|
-
if (n)
|
|
11
|
-
for (const s of Object.keys(n))
|
|
12
|
-
o.add(s);
|
|
13
|
-
for (const s of o) {
|
|
14
|
-
const l = n == null ? void 0 : n[s];
|
|
15
|
-
if (l)
|
|
16
|
-
for (const [c, f] of Object.entries(r)) {
|
|
17
|
-
const u = l[c];
|
|
18
|
-
u !== void 0 && (a[`--${t}-${s}-${f}`] = u);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
function h(t) {
|
|
24
|
-
const e = t.trim();
|
|
25
|
-
if (!e || e === "none") return 1;
|
|
26
|
-
if (e.endsWith("%")) {
|
|
27
|
-
const i = parseFloat(e);
|
|
28
|
-
return Number.isFinite(i) ? i / 100 : 1;
|
|
29
|
-
}
|
|
30
|
-
const r = parseFloat(e);
|
|
31
|
-
return Number.isFinite(r) ? r : 1;
|
|
32
|
-
}
|
|
33
|
-
function g(t) {
|
|
34
|
-
const e = t.lastIndexOf("/");
|
|
35
|
-
if (e !== -1)
|
|
36
|
-
return h(t.slice(e + 1));
|
|
37
|
-
}
|
|
38
|
-
function A(t) {
|
|
39
|
-
const e = t.trim().toLowerCase();
|
|
40
|
-
if (!e || e === "transparent") return 0;
|
|
41
|
-
const r = e.match(/^(?:oklch|oklab|rgba?|hsla?|hwb|lab|lch|color)\((.+)\)$/);
|
|
42
|
-
if (r) {
|
|
43
|
-
const n = r[1], a = g(n);
|
|
44
|
-
if (a !== void 0) return a;
|
|
45
|
-
if (/^(?:rgba|hsla)$/.test(e.slice(0, 4))) {
|
|
46
|
-
const o = n.split(",").map((s) => parseFloat(s.trim()));
|
|
47
|
-
if (o.length === 4 && Number.isFinite(o[3]))
|
|
48
|
-
return o[3];
|
|
49
|
-
}
|
|
50
|
-
return 1;
|
|
51
|
-
}
|
|
52
|
-
const i = e.match(/^#([0-9a-f]{4}|[0-9a-f]{8})$/);
|
|
53
|
-
if (i) {
|
|
54
|
-
const n = i[1], a = n.length === 4 ? n[3] + n[3] : n.slice(6, 8);
|
|
55
|
-
return parseInt(a, 16) / 255;
|
|
56
|
-
}
|
|
57
|
-
return 1;
|
|
58
|
-
}
|
|
59
|
-
const p = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, b = (t) => p.test(t.trim()), m = (t) => {
|
|
60
|
-
const e = t.replace(/\D/g, "");
|
|
61
|
-
return e.length >= 7 && e.length <= 15;
|
|
62
|
-
}, F = (t, e) => {
|
|
63
|
-
var r;
|
|
64
|
-
for (const i of t) {
|
|
65
|
-
const n = ((r = e[i.name]) == null ? void 0 : r.trim()) ?? "";
|
|
66
|
-
if (n) {
|
|
67
|
-
if (i.type === "email" && !b(n))
|
|
68
|
-
return "Please enter a valid email address.";
|
|
69
|
-
if (i.type === "phone" && !m(n))
|
|
70
|
-
return "Please enter a valid phone number.";
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return null;
|
|
74
|
-
};
|
|
75
|
-
function P() {
|
|
76
|
-
const e = `cf-${d().replace(/:/g, "")}`;
|
|
77
|
-
return {
|
|
78
|
-
prefix: e,
|
|
79
|
-
cls: (r) => `${e}-${r}`
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
const k = (t, e) => {
|
|
83
|
-
const r = Array.from(t.querySelectorAll('[data-testimonial-measure="text"]')).reduce(
|
|
84
|
-
(n, a) => Math.max(n, a.getBoundingClientRect().height),
|
|
85
|
-
0
|
|
86
|
-
), i = Array.from(t.querySelectorAll('[data-testimonial-measure="caption"]')).reduce(
|
|
87
|
-
(n, a) => Math.max(n, a.getBoundingClientRect().height),
|
|
88
|
-
0
|
|
89
|
-
);
|
|
90
|
-
e({ maxTextPx: r, maxCaptionPx: i });
|
|
91
|
-
};
|
|
92
|
-
function x(t, e) {
|
|
93
|
-
const r = t == null ? void 0 : t.availableWhen;
|
|
94
|
-
return r ? Object.entries(r).every(([i, n]) => {
|
|
95
|
-
if (!(n != null && n.length)) return !0;
|
|
96
|
-
const a = e[i];
|
|
97
|
-
return a === void 0 ? !0 : n.includes(a);
|
|
98
|
-
}) : !0;
|
|
99
|
-
}
|
|
100
|
-
function v(t, e) {
|
|
101
|
-
const r = t == null ? void 0 : t.statePanels;
|
|
102
|
-
return r != null && r.length ? r.filter((i) => {
|
|
103
|
-
var a;
|
|
104
|
-
const n = (a = t == null ? void 0 : t.panels) == null ? void 0 : a.find((o) => o.id === i);
|
|
105
|
-
return x(n, e);
|
|
106
|
-
}) : null;
|
|
107
|
-
}
|
|
108
|
-
function C(t, e) {
|
|
109
|
-
const r = t == null ? void 0 : t.statePanels;
|
|
110
|
-
if (!(r != null && r.length)) return [];
|
|
111
|
-
const i = new Set(v(t, e) ?? []);
|
|
112
|
-
return r.filter((n) => !i.has(n));
|
|
113
|
-
}
|
|
114
|
-
export {
|
|
115
|
-
F as a,
|
|
116
|
-
y as b,
|
|
117
|
-
m as c,
|
|
118
|
-
v as d,
|
|
119
|
-
C as e,
|
|
120
|
-
x as f,
|
|
121
|
-
A as g,
|
|
122
|
-
b as i,
|
|
123
|
-
k as r,
|
|
124
|
-
S as s,
|
|
125
|
-
P as u
|
|
126
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const m=require("react");function p(t,e=!1){return e?`calc(var(--cntrl-article-width) * ${t})`:`${t*100}vw`}const v=(t,e,r,i,n)=>{const a={};for(const[l,s]of Object.entries(r))a[`--${t}-${s}`]=e[l];const o=new Set(i);if(n)for(const l of Object.keys(n))o.add(l);for(const l of o){const s=n==null?void 0:n[l];if(s)for(const[h,b]of Object.entries(r)){const u=s[h];u!==void 0&&(a[`--${t}-${l}-${b}`]=u)}}return a};function x(t){const e=t.trim();if(!e||e==="none")return 1;if(e.endsWith("%")){const i=parseFloat(e);return Number.isFinite(i)?i/100:1}const r=parseFloat(e);return Number.isFinite(r)?r:1}function S(t){const e=t.lastIndexOf("/");if(e!==-1)return x(t.slice(e+1))}function A(t){const e=t.trim().toLowerCase();if(!e||e==="transparent")return 0;const r=e.match(/^(?:oklch|oklab|rgba?|hsla?|hwb|lab|lch|color)\((.+)\)$/);if(r){const n=r[1],a=S(n);if(a!==void 0)return a;if(/^(?:rgba|hsla)$/.test(e.slice(0,4))){const o=n.split(",").map(l=>parseFloat(l.trim()));if(o.length===4&&Number.isFinite(o[3]))return o[3]}return 1}const i=e.match(/^#([0-9a-f]{4}|[0-9a-f]{8})$/);if(i){const n=i[1],a=n.length===4?n[3]+n[3]:n.slice(6,8);return parseInt(a,16)/255}return 1}const F=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,c=t=>F.test(t.trim()),f=t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15},$=(t,e)=>{var r;for(const i of t){const n=((r=e[i.name])==null?void 0:r.trim())??"";if(n){if(i.type==="email"&&!c(n))return"Please enter a valid email address.";if(i.type==="phone"&&!f(n))return"Please enter a valid phone number."}}return null};function y(){const e=`cf-${m.useId().replace(/:/g,"")}`;return{prefix:e,cls:r=>`${e}-${r}`}}const P=(t,e)=>{const r=Array.from(t.querySelectorAll('[data-testimonial-measure="text"]')).reduce((n,a)=>Math.max(n,a.getBoundingClientRect().height),0),i=Array.from(t.querySelectorAll('[data-testimonial-measure="caption"]')).reduce((n,a)=>Math.max(n,a.getBoundingClientRect().height),0);e({maxTextPx:r,maxCaptionPx:i})};function d(t,e){const r=t==null?void 0:t.availableWhen;return r?Object.entries(r).every(([i,n])=>{if(!(n!=null&&n.length))return!0;const a=e[i];return a===void 0?!0:n.includes(a)}):!0}function g(t,e){const r=t==null?void 0:t.statePanels;return r!=null&&r.length?r.filter(i=>{var a;const n=(a=t==null?void 0:t.panels)==null?void 0:a.find(o=>o.id===i);return d(n,e)}):null}function V(t,e){const r=t==null?void 0:t.statePanels;if(!(r!=null&&r.length))return[];const i=new Set(g(t,e)??[]);return r.filter(n=>!i.has(n))}exports.buildColorVars=v;exports.getAvailableStatePanels=g;exports.getColorAlpha=A;exports.getFormFieldValidationError=$;exports.getUnavailableStates=V;exports.isPanelAvailable=d;exports.isValidEmailFormat=c;exports.isValidPhoneFormat=f;exports.readTestimonialTextMeasure=P;exports.scalingValue=p;exports.useScopedStyles=y;
|