@cntrl-site/components 1.0.82-alpha.1 → 1.0.82
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/Pretext/imageUtils.d.ts +0 -10
- package/dist/Components/props.d.ts +0 -10
- package/dist/Components/utils/index.d.ts +0 -3
- package/dist/index.d.ts +2 -4
- package/dist/index.js +82 -2882
- package/dist/index.mjs +8954 -13631
- package/dist/readTestimonialTextMeasure-B1FI-93F.mjs +60 -0
- package/dist/readTestimonialTextMeasure-CB_Uq-fO.js +1 -0
- package/dist/types/Component.d.ts +1 -4
- 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 -139
- package/dist/Components/Burger/BurgerComponent.d.ts +0 -828
- package/dist/Components/utils/panelAvailability.d.ts +0 -13
- package/dist/panelAvailability-CgSic84c.mjs +0 -126
- package/dist/panelAvailability-D8c7cdbu.js +0 -1
|
@@ -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;
|
|
@@ -6,17 +6,14 @@ export type ComponentSize = {
|
|
|
6
6
|
height?: number | string;
|
|
7
7
|
};
|
|
8
8
|
export type ComponentDefaultSize = Partial<Record<Breakpoint, ComponentSize>>;
|
|
9
|
-
export type ComponentNavigationPosition = 'default' | 'stickyTop' | 'switch';
|
|
10
|
-
export type ComponentDefaultNavigationPosition = Partial<Record<Breakpoint, ComponentNavigationPosition>>;
|
|
11
9
|
export type Component = {
|
|
12
10
|
element: (props: any) => React.ReactElement;
|
|
13
11
|
id: string;
|
|
14
12
|
name: string;
|
|
15
13
|
category?: string;
|
|
16
14
|
version?: number;
|
|
17
|
-
layoutMode?: 'freeform' | 'structured'
|
|
15
|
+
layoutMode?: 'freeform' | 'structured';
|
|
18
16
|
defaultSize?: ComponentDefaultSize;
|
|
19
|
-
defaultNavigationPosition?: ComponentDefaultNavigationPosition;
|
|
20
17
|
schema: any;
|
|
21
18
|
preview?: {
|
|
22
19
|
type: 'image' | 'video';
|
package/dist/types/SchemaV1.d.ts
CHANGED
|
@@ -71,19 +71,12 @@ export type SchemaSection = {
|
|
|
71
71
|
layoutDefaults?: Record<string, Record<string, unknown>>;
|
|
72
72
|
displayRules?: SchemaDisplayRule[];
|
|
73
73
|
};
|
|
74
|
-
export type SchemaPanelAvailability = Record<string, string[]>;
|
|
75
74
|
export type SchemaPanel = {
|
|
76
75
|
id: string;
|
|
77
76
|
icon: string;
|
|
78
77
|
title: string;
|
|
79
78
|
tooltip?: string;
|
|
80
79
|
layout: LayoutItem[];
|
|
81
|
-
/**
|
|
82
|
-
* When set, the panel is available only if every listed context key
|
|
83
|
-
* is either missing or matches one of the allowed values.
|
|
84
|
-
* Example: `{ navigationPosition: ['switch'] }`.
|
|
85
|
-
*/
|
|
86
|
-
availableWhen?: SchemaPanelAvailability;
|
|
87
80
|
};
|
|
88
81
|
export type SchemaPaletteBookmark = {
|
|
89
82
|
items: string[];
|
|
@@ -100,10 +93,4 @@ export type ComponentSchemaV1 = {
|
|
|
100
93
|
fontRelations?: Record<string, string>;
|
|
101
94
|
allowedPlugins?: string[];
|
|
102
95
|
states?: string[];
|
|
103
|
-
/**
|
|
104
|
-
* Panel ids that represent a visual component state.
|
|
105
|
-
* `null` or omitted means the component has no state panels.
|
|
106
|
-
* Opening one of these panels sets `currentState` to that panel id.
|
|
107
|
-
*/
|
|
108
|
-
statePanels?: string[] | null;
|
|
109
96
|
};
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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,14 +1,10 @@
|
|
|
1
|
-
import { b as
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
d as
|
|
10
|
-
n as isValidPhoneFormat,
|
|
11
|
-
g as readTestimonialTextMeasure,
|
|
12
|
-
m as scalingValue,
|
|
13
|
-
b as useScopedStyles
|
|
3
|
+
e as buildColorVars,
|
|
4
|
+
i as getFormFieldValidationError,
|
|
5
|
+
r as isValidEmailFormat,
|
|
6
|
+
o as isValidPhoneFormat,
|
|
7
|
+
l as readTestimonialTextMeasure,
|
|
8
|
+
t as scalingValue,
|
|
9
|
+
d as useScopedStyles
|
|
14
10
|
};
|
package/package.json
CHANGED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { CommonComponentProps } from '../props';
|
|
2
|
-
import { TextStyles } from '../utils/textStylesToCss';
|
|
3
|
-
type BurgerEffect = 'fade' | 'left' | 'top' | 'right' | 'bottom';
|
|
4
|
-
type BurgerLogo = {
|
|
5
|
-
mode?: 'On' | 'Off';
|
|
6
|
-
icon?: string | null;
|
|
7
|
-
};
|
|
8
|
-
type BurgerLogoPosition = 'left' | 'center' | 'right';
|
|
9
|
-
type BurgerShowInValue = string | Record<string, string>;
|
|
10
|
-
type BurgerLink = {
|
|
11
|
-
link?: {
|
|
12
|
-
type?: 'url' | 'page' | 'anchor';
|
|
13
|
-
value?: string;
|
|
14
|
-
target?: string;
|
|
15
|
-
anchor?: string;
|
|
16
|
-
url?: string;
|
|
17
|
-
};
|
|
18
|
-
mode?: 'page' | 'url';
|
|
19
|
-
page?: string;
|
|
20
|
-
url?: string;
|
|
21
|
-
label?: string;
|
|
22
|
-
anchor?: string;
|
|
23
|
-
openIn?: string;
|
|
24
|
-
showIn?: BurgerShowInValue;
|
|
25
|
-
};
|
|
26
|
-
type BurgerPosition = 'left-top' | 'center-top' | 'right-top' | 'left-center' | 'center' | 'center-center' | 'right-center' | 'left-bottom' | 'center-bottom' | 'right-bottom';
|
|
27
|
-
type BurgerSettings = {
|
|
28
|
-
link?: BurgerLink[];
|
|
29
|
-
logo?: BurgerLogo | null;
|
|
30
|
-
logoMaxWidth?: number;
|
|
31
|
-
logoMaxHeight?: number;
|
|
32
|
-
logoPosition?: BurgerLogoPosition;
|
|
33
|
-
logoColor?: string;
|
|
34
|
-
panelHeight?: number;
|
|
35
|
-
backgroundColor?: string;
|
|
36
|
-
position?: BurgerPosition;
|
|
37
|
-
horizontalAlign?: 'left' | 'center' | 'right';
|
|
38
|
-
verticalAlign?: 'top' | 'center' | 'bottom';
|
|
39
|
-
iconColor?: string;
|
|
40
|
-
showIcon?: 'on' | 'off';
|
|
41
|
-
iconSize?: number;
|
|
42
|
-
linkColor?: string;
|
|
43
|
-
openLinkColor?: string;
|
|
44
|
-
compactIconColor?: string;
|
|
45
|
-
compactCloseButtonColor?: string;
|
|
46
|
-
compactLinkColor?: string;
|
|
47
|
-
compactLogoColor?: string;
|
|
48
|
-
compactBackgroundColor?: string;
|
|
49
|
-
compactLogoMaxWidth?: number;
|
|
50
|
-
compactLogoMaxHeight?: number;
|
|
51
|
-
compactLogoPosition?: BurgerLogoPosition;
|
|
52
|
-
compactPanelHeight?: number;
|
|
53
|
-
compactShowIcon?: 'on' | 'off';
|
|
54
|
-
compactIconSize?: number;
|
|
55
|
-
compactNavTextWidth?: number;
|
|
56
|
-
compactNavGap?: number;
|
|
57
|
-
compactNavPaddingLeft?: number;
|
|
58
|
-
compactNavPaddingRight?: number;
|
|
59
|
-
compactFontFamily?: string;
|
|
60
|
-
compactFontSettings?: {
|
|
61
|
-
fontWeight?: number;
|
|
62
|
-
fontStyle?: string;
|
|
63
|
-
};
|
|
64
|
-
compactFontSize?: number;
|
|
65
|
-
compactLineHeight?: number;
|
|
66
|
-
compactLetterSpacing?: number;
|
|
67
|
-
compactWordSpacing?: number;
|
|
68
|
-
compactTextAlign?: TextStyles['textAlign'];
|
|
69
|
-
compactTextAppearance?: TextStyles['textAppearance'];
|
|
70
|
-
openLogoColor?: string;
|
|
71
|
-
menuBackgroundColor?: string;
|
|
72
|
-
overlayColor?: string;
|
|
73
|
-
closeButtonColor?: string;
|
|
74
|
-
effect?: BurgerEffect;
|
|
75
|
-
textWidth?: number;
|
|
76
|
-
navTextWidth?: number;
|
|
77
|
-
gap?: number;
|
|
78
|
-
navGap?: number;
|
|
79
|
-
navPaddingLeft?: number;
|
|
80
|
-
navPaddingRight?: number;
|
|
81
|
-
textPaddingLeft?: number;
|
|
82
|
-
textPaddingRight?: number;
|
|
83
|
-
textPaddingTop?: number;
|
|
84
|
-
textPaddingBottom?: number;
|
|
85
|
-
fontFamily?: string;
|
|
86
|
-
fontSettings?: {
|
|
87
|
-
fontWeight?: number;
|
|
88
|
-
fontStyle?: string;
|
|
89
|
-
};
|
|
90
|
-
fontSize?: number;
|
|
91
|
-
lineHeight?: number;
|
|
92
|
-
letterSpacing?: number;
|
|
93
|
-
wordSpacing?: number;
|
|
94
|
-
textAlign?: TextStyles['textAlign'];
|
|
95
|
-
textAppearance?: TextStyles['textAppearance'];
|
|
96
|
-
openFontFamily?: string;
|
|
97
|
-
openFontSettings?: {
|
|
98
|
-
fontWeight?: number;
|
|
99
|
-
fontStyle?: string;
|
|
100
|
-
};
|
|
101
|
-
openFontSize?: number;
|
|
102
|
-
openLineHeight?: number;
|
|
103
|
-
openLetterSpacing?: number;
|
|
104
|
-
openWordSpacing?: number;
|
|
105
|
-
openTextAlign?: TextStyles['textAlign'];
|
|
106
|
-
openTextAppearance?: TextStyles['textAppearance'];
|
|
107
|
-
stateOverrides?: Record<string, Partial<Record<'iconColor' | 'closeButtonColor' | 'linkColor' | 'openLinkColor' | 'compactIconColor' | 'compactCloseButtonColor' | 'compactLinkColor' | 'compactLogoColor' | 'compactBackgroundColor' | 'openLogoColor' | 'menuBackgroundColor' | 'overlayColor' | 'backgroundColor' | 'logoColor', string>>>;
|
|
108
|
-
};
|
|
109
|
-
type BurgerPageRef = {
|
|
110
|
-
id: string;
|
|
111
|
-
slug: string;
|
|
112
|
-
};
|
|
113
|
-
export declare function applyBurgerSettingsChange(nextSettings: BurgerSettings, prevSettings: BurgerSettings): BurgerSettings;
|
|
114
|
-
export type BurgerLinkNavigateEvent = {
|
|
115
|
-
mode: 'page' | 'url';
|
|
116
|
-
href: string;
|
|
117
|
-
page?: string;
|
|
118
|
-
url?: string;
|
|
119
|
-
anchor?: string;
|
|
120
|
-
target?: '_blank';
|
|
121
|
-
};
|
|
122
|
-
type BurgerProps = {
|
|
123
|
-
settings: BurgerSettings;
|
|
124
|
-
content?: unknown;
|
|
125
|
-
isEditor?: boolean;
|
|
126
|
-
isEditMode?: boolean;
|
|
127
|
-
isPreviewMode?: boolean;
|
|
128
|
-
activeEvent?: string;
|
|
129
|
-
currentState?: string | null;
|
|
130
|
-
isSwitchClone?: boolean;
|
|
131
|
-
portalId?: string;
|
|
132
|
-
layoutId?: string;
|
|
133
|
-
pages?: BurgerPageRef[];
|
|
134
|
-
onLinkNavigate?: (event: BurgerLinkNavigateEvent) => void;
|
|
135
|
-
onUpdateSettings?: (settings: BurgerSettings) => void;
|
|
136
|
-
onOpenChange?: (isOpen: boolean) => void;
|
|
137
|
-
} & CommonComponentProps;
|
|
138
|
-
export declare function Burger({ settings: settingsProp, isEditor, isEditMode, isPreviewMode, activeEvent, currentState: currentStateProp, isSwitchClone, unavailableStates, layoutId, pages, onLinkNavigate, onUpdateSettings, onOpenChange, }: BurgerProps): import("react/jsx-runtime").JSX.Element;
|
|
139
|
-
export {};
|