@cntrl-site/components 1.0.1-alpha.8 → 1.0.1

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.
@@ -15,5 +15,18 @@ export type Component = {
15
15
  url: string;
16
16
  };
17
17
  sourceCode?: string;
18
+ assetsPaths?: {
19
+ content: Path[];
20
+ parameters: Path[];
21
+ };
22
+ fontSettingsPaths?: {
23
+ content: Path[];
24
+ parameters: Path[];
25
+ };
26
+ };
27
+ type Path = {
28
+ path: string;
29
+ placeholderEnabled?: boolean;
18
30
  };
19
31
  export declare function isSchemaV1(schema: any): schema is ComponentSchemaV1;
32
+ export {};
@@ -64,6 +64,7 @@ export type SchemaSection = {
64
64
  properties: Record<string, SchemaProperty>;
65
65
  layout?: LayoutItem[];
66
66
  defaults: Record<string, unknown>;
67
+ layoutDefaults?: Record<string, Record<string, unknown>>;
67
68
  displayRules?: SchemaDisplayRule[];
68
69
  };
69
70
  export type SchemaPanel = {
@@ -0,0 +1,49 @@
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
+ };
@@ -0,0 +1 @@
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;
package/dist/utils.js CHANGED
@@ -1 +1 @@
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;
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;
package/dist/utils.mjs CHANGED
@@ -1,8 +1,9 @@
1
- import { g as i, i as o, a as e, s as l, u as r } from "./useScopedStyles-Da2iLz5N.mjs";
1
+ import { b as i, g as o, i as l, a as r, s as e, u as d } from "./useScopedStyles-BSwFAT27.mjs";
2
2
  export {
3
- i as getFormFieldValidationError,
4
- o as isValidEmailFormat,
5
- e as isValidPhoneFormat,
6
- l as scalingValue,
7
- r as useScopedStyles
3
+ i as buildColorVars,
4
+ o as getFormFieldValidationError,
5
+ l as isValidEmailFormat,
6
+ r as isValidPhoneFormat,
7
+ e as scalingValue,
8
+ d as useScopedStyles
8
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/components",
3
- "version": "1.0.1-alpha.8",
3
+ "version": "1.0.1",
4
4
  "description": "Custom components for control editor and public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1 +0,0 @@
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;
@@ -1,34 +0,0 @@
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
- };