@cronocode/react-box 1.6.4 → 1.6.6

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/utils/utils.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const g=require("react"),C={hover:"_h",focus:"_f",shadow:"shadow_",shadowH:"shadow_h_",shadowF:"shadow_f_",shadowA:"shadow_a_",background:"bg_",backgroundH:"bg_h_",backgroundF:"bg_f_",backgroundA:"bg_a_",bg:"bg_",bgH:"bg_h_",bgF:"bg_f_",bgA:"bg_a_",color:"color_",colorH:"color_h_",colorF:"color_f_",colorA:"color_a_",backgroundColor:"bgColor_",backgroundColorH:"bgColor_h_",backgroundColorF:"bgColor_f_",backgroundColorA:"bgColor_a_",bgColor:"bgColor_",bgColorH:"bgColor_h_",bgColorF:"bgColor_f_",bgColorA:"bgColor_a_",borderColor:"borderColor_",borderColorH:"borderColor_h_",borderColorF:"borderColor_f_",borderColorA:"borderColor_a_",outlineColor:"outlineColor_",outlineColorH:"outlineColor_h_",outlineColorF:"outlineColor_f_",outlineColorA:"outlineColor_a_"},p={fill:"fill_",fillH:"fill_h_",fillF:"fill_f_",fillA:"fill_a_",stroke:"stroke_",strokeH:"stroke_h_",strokeF:"stroke_f_",strokeA:"stroke_a_"};var h;(c=>{function l(...i){return i.reduce((e,s)=>s?typeof s=="string"?(e.push(s),e):Array.isArray(s)?(e.push(...l(...s)),e):(Object.entries(s).forEach(([r,t])=>{t&&e.push(r)}),e):e,[])}c.classNames=l})(h||(h={}));const F=h;class m{constructor(){this._index=0,this._cache={}}getIdentity(l){return this._cache[l]||(this._cache[l]=this.getByIndex(this._index++)),this._cache[l]}getByIndex(l){const{first:i,next:e}=y,s=l-i.length;if(s<0)return i[l];const r=Math.floor(s/e.length),t=s-r*e.length;return this.getByIndex(r)+e[t]}}const y={first:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",next:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"};var f;(c=>{function l(e,...s){const r={...e},t={};return s.forEach(o=>{o in r&&(t[o]=r[o],delete r[o])}),[t,r]}c.moveToTagProps=l;function i(e,s,r){const t={...e},o=t.props||{};return s.forEach(n=>{if(n in t){if(o[n]=t[n],n==="disabled")return;delete t[n]}}),r&&Object.entries(r).forEach(([n,u])=>{o[n]=u}),t.props=o,t}c.buildProps=i})(f||(f={}));const A=f;var b;(c=>{function l(e){const s=Array.from(e.elements).reduce((r,t)=>{const o=t.name;return o&&(r[o]||(r[o]=[]),r[o].push(t)),r},{});return Object.entries(s).reduce((r,[t,o])=>{if(o.length===1){const n=o[0];i(r,t,n.type==="checkbox"||n.type==="radio"?n.checked:n.value)}else{const n=o.reduce((u,_)=>(_.type==="checkbox"||_.type==="radio"?_.checked&&u.push(_.value):u.push(_.value),u),[]);i(r,t,n)}return r},{})}c.getFormEntries=l;function i(e,s,r){if(s.includes(".")){const t=s.split(".");let o=e;t.forEach((n,u)=>{if(t.length>u+1){const _=n.match(/^(.+)\[(\d)\]$/);if(_){const[,a,d]=_;o[a]=o[a]||[],o[a][d]=o[a][d]||{},o=o[a][d]}else o[n]=o[n]||{},o=o[n]}else o[n]=r})}else e[s]=r}})(b||(b={}));const k=b;function x(){return g.useMemo(()=>{const c="crono-box";let l=document.getElementById(c);return l||(l=document.createElement("div"),l.id=c,document.body.appendChild(l)),l},[])}exports.ClassNameUtils=F;exports.FormUtils=k;exports.IdentityFactory=m;exports.ObjectUtils=A;exports.themeClasses=C;exports.themeSvgClasses=p;exports.usePortalContainer=x;
1
+ "use strict";const y=require("react");var a;(c=>{function i(...u){return u.reduce((n,o)=>o?typeof o=="string"?(n.push(o),n):Array.isArray(o)?(n.push(...i(...o)),n):(Object.entries(o).forEach(([e,r])=>{r&&n.push(e)}),n):n,[])}c.classNames=i})(a||(a={}));const b=a;class m{constructor(){this._index=0,this._cache={}}getIdentity(i){return this._cache[i]||(this._cache[i]=this.getByIndex(this._index++)),this._cache[i]}getByIndex(i){const{first:u,next:n}=x,o=i-u.length;if(o<0)return u[i];const e=Math.floor(o/n.length),r=o-e*n.length;return this.getByIndex(e)+n[r]}}const x={first:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",next:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"};var p;(c=>{function i(n,...o){const e={...n},r={};return o.forEach(t=>{t in e&&(r[t]=e[t],delete e[t])}),[r,e]}c.moveToTagProps=i;function u(n,o,e){const r={...n},t=r.props||{};return o.forEach(s=>{if(s in r){if(t[s]=r[s],s==="disabled")return;delete r[s]}}),e&&Object.entries(e).forEach(([s,h])=>{t[s]=h}),r.props=t,r}c.buildProps=u})(p||(p={}));const I=p;var g;(c=>{function i(n){const o=Array.from(n.elements).reduce((e,r)=>{const t=r.name;return t&&(e[t]||(e[t]=[]),e[t].push(r)),e},{});return Object.entries(o).reduce((e,[r,t])=>{if(t.length===1){const s=t[0];u(e,r,s.type==="checkbox"||s.type==="radio"?s.checked:s.value)}else{const s=t.reduce((h,d)=>(d.type==="checkbox"||d.type==="radio"?d.checked&&h.push(d.value):h.push(d.value),h),[]);u(e,r,s)}return e},{})}c.getFormEntries=i;function u(n,o,e){if(o.includes(".")){const r=o.split(".");let t=n;r.forEach((s,h)=>{if(r.length>h+1){const d=s.match(/^(.+)\[(\d)\]$/);if(d){const[,f,l]=d;t[f]=t[f]||[],t[f][l]=t[f][l]||{},t=t[f][l]}else t[s]=t[s]||{},t=t[s]}else t[s]=e})}else n[o]=e}})(g||(g={}));const P=g;function E(){return y.useMemo(()=>{const c="crono-box";let i=document.getElementById(c);return i||(i=document.createElement("div"),i.id=c,document.body.appendChild(i)),i},[])}exports.ClassNameUtils=b;exports.FormUtils=P;exports.IdentityFactory=m;exports.ObjectUtils=I;exports.usePortalContainer=E;
package/utils/utils.mjs CHANGED
@@ -1,154 +1,107 @@
1
- import { useMemo as g } from "react";
2
- const F = {
3
- hover: "_h",
4
- focus: "_f",
5
- shadow: "shadow_",
6
- shadowH: "shadow_h_",
7
- shadowF: "shadow_f_",
8
- shadowA: "shadow_a_",
9
- background: "bg_",
10
- backgroundH: "bg_h_",
11
- backgroundF: "bg_f_",
12
- backgroundA: "bg_a_",
13
- bg: "bg_",
14
- bgH: "bg_h_",
15
- bgF: "bg_f_",
16
- bgA: "bg_a_",
17
- color: "color_",
18
- colorH: "color_h_",
19
- colorF: "color_f_",
20
- colorA: "color_a_",
21
- backgroundColor: "bgColor_",
22
- backgroundColorH: "bgColor_h_",
23
- backgroundColorF: "bgColor_f_",
24
- backgroundColorA: "bgColor_a_",
25
- bgColor: "bgColor_",
26
- bgColorH: "bgColor_h_",
27
- bgColorF: "bgColor_f_",
28
- bgColorA: "bgColor_a_",
29
- borderColor: "borderColor_",
30
- borderColorH: "borderColor_h_",
31
- borderColorF: "borderColor_f_",
32
- borderColorA: "borderColor_a_",
33
- outlineColor: "outlineColor_",
34
- outlineColorH: "outlineColor_h_",
35
- outlineColorF: "outlineColor_f_",
36
- outlineColorA: "outlineColor_a_"
37
- }, m = {
38
- fill: "fill_",
39
- fillH: "fill_h_",
40
- fillF: "fill_f_",
41
- fillA: "fill_a_",
42
- stroke: "stroke_",
43
- strokeH: "stroke_h_",
44
- strokeF: "stroke_f_",
45
- strokeA: "stroke_a_"
46
- };
47
- var h;
1
+ import { useMemo as x } from "react";
2
+ var p;
48
3
  ((c) => {
49
- function l(...i) {
50
- return i.reduce((e, n) => n ? typeof n == "string" ? (e.push(n), e) : Array.isArray(n) ? (e.push(...l(...n)), e) : (Object.entries(n).forEach(([r, t]) => {
51
- t && e.push(r);
52
- }), e) : e, []);
4
+ function i(...u) {
5
+ return u.reduce((n, o) => o ? typeof o == "string" ? (n.push(o), n) : Array.isArray(o) ? (n.push(...i(...o)), n) : (Object.entries(o).forEach(([r, e]) => {
6
+ e && n.push(r);
7
+ }), n) : n, []);
53
8
  }
54
- c.classNames = l;
55
- })(h || (h = {}));
56
- const x = h;
57
- class A {
9
+ c.classNames = i;
10
+ })(p || (p = {}));
11
+ const y = p;
12
+ class I {
58
13
  constructor() {
59
14
  this._index = 0, this._cache = {};
60
15
  }
61
- getIdentity(l) {
62
- return this._cache[l] || (this._cache[l] = this.getByIndex(this._index++)), this._cache[l];
16
+ getIdentity(i) {
17
+ return this._cache[i] || (this._cache[i] = this.getByIndex(this._index++)), this._cache[i];
63
18
  }
64
- getByIndex(l) {
65
- const { first: i, next: e } = C, n = l - i.length;
66
- if (n < 0)
67
- return i[l];
68
- const r = Math.floor(n / e.length), t = n - r * e.length;
69
- return this.getByIndex(r) + e[t];
19
+ getByIndex(i) {
20
+ const { first: u, next: n } = m, o = i - u.length;
21
+ if (o < 0)
22
+ return u[i];
23
+ const r = Math.floor(o / n.length), e = o - r * n.length;
24
+ return this.getByIndex(r) + n[e];
70
25
  }
71
26
  }
72
- const C = {
27
+ const m = {
73
28
  first: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
74
29
  next: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
75
30
  };
76
- var f;
31
+ var l;
77
32
  ((c) => {
78
- function l(e, ...n) {
79
- const r = { ...e }, t = {};
80
- return n.forEach((o) => {
81
- o in r && (t[o] = r[o], delete r[o]);
82
- }), [t, r];
33
+ function i(n, ...o) {
34
+ const r = { ...n }, e = {};
35
+ return o.forEach((t) => {
36
+ t in r && (e[t] = r[t], delete r[t]);
37
+ }), [e, r];
83
38
  }
84
- c.moveToTagProps = l;
85
- function i(e, n, r) {
86
- const t = { ...e }, o = t.props || {};
87
- return n.forEach((s) => {
88
- if (s in t) {
89
- if (o[s] = t[s], s === "disabled")
39
+ c.moveToTagProps = i;
40
+ function u(n, o, r) {
41
+ const e = { ...n }, t = e.props || {};
42
+ return o.forEach((s) => {
43
+ if (s in e) {
44
+ if (t[s] = e[s], s === "disabled")
90
45
  return;
91
- delete t[s];
46
+ delete e[s];
92
47
  }
93
- }), r && Object.entries(r).forEach(([s, a]) => {
94
- o[s] = a;
95
- }), t.props = o, t;
48
+ }), r && Object.entries(r).forEach(([s, f]) => {
49
+ t[s] = f;
50
+ }), e.props = t, e;
96
51
  }
97
- c.buildProps = i;
98
- })(f || (f = {}));
99
- const k = f;
100
- var b;
52
+ c.buildProps = u;
53
+ })(l || (l = {}));
54
+ const E = l;
55
+ var g;
101
56
  ((c) => {
102
- function l(e) {
103
- const n = Array.from(e.elements).reduce((r, t) => {
104
- const o = t.name;
105
- return o && (r[o] || (r[o] = []), r[o].push(t)), r;
57
+ function i(n) {
58
+ const o = Array.from(n.elements).reduce((r, e) => {
59
+ const t = e.name;
60
+ return t && (r[t] || (r[t] = []), r[t].push(e)), r;
106
61
  }, {});
107
- return Object.entries(n).reduce((r, [t, o]) => {
108
- if (o.length === 1) {
109
- const s = o[0];
110
- i(r, t, s.type === "checkbox" || s.type === "radio" ? s.checked : s.value);
62
+ return Object.entries(o).reduce((r, [e, t]) => {
63
+ if (t.length === 1) {
64
+ const s = t[0];
65
+ u(r, e, s.type === "checkbox" || s.type === "radio" ? s.checked : s.value);
111
66
  } else {
112
- const s = o.reduce((a, _) => (_.type === "checkbox" || _.type === "radio" ? _.checked && a.push(_.value) : a.push(_.value), a), []);
113
- i(r, t, s);
67
+ const s = t.reduce((f, d) => (d.type === "checkbox" || d.type === "radio" ? d.checked && f.push(d.value) : f.push(d.value), f), []);
68
+ u(r, e, s);
114
69
  }
115
70
  return r;
116
71
  }, {});
117
72
  }
118
- c.getFormEntries = l;
119
- function i(e, n, r) {
120
- if (n.includes(".")) {
121
- const t = n.split(".");
122
- let o = e;
123
- t.forEach((s, a) => {
124
- if (t.length > a + 1) {
125
- const _ = s.match(/^(.+)\[(\d)\]$/);
126
- if (_) {
127
- const [, u, d] = _;
128
- o[u] = o[u] || [], o[u][d] = o[u][d] || {}, o = o[u][d];
73
+ c.getFormEntries = i;
74
+ function u(n, o, r) {
75
+ if (o.includes(".")) {
76
+ const e = o.split(".");
77
+ let t = n;
78
+ e.forEach((s, f) => {
79
+ if (e.length > f + 1) {
80
+ const d = s.match(/^(.+)\[(\d)\]$/);
81
+ if (d) {
82
+ const [, h, a] = d;
83
+ t[h] = t[h] || [], t[h][a] = t[h][a] || {}, t = t[h][a];
129
84
  } else
130
- o[s] = o[s] || {}, o = o[s];
85
+ t[s] = t[s] || {}, t = t[s];
131
86
  } else
132
- o[s] = r;
87
+ t[s] = r;
133
88
  });
134
89
  } else
135
- e[n] = r;
90
+ n[o] = r;
136
91
  }
137
- })(b || (b = {}));
138
- const y = b;
139
- function I() {
140
- return g(() => {
92
+ })(g || (g = {}));
93
+ const P = g;
94
+ function v() {
95
+ return x(() => {
141
96
  const c = "crono-box";
142
- let l = document.getElementById(c);
143
- return l || (l = document.createElement("div"), l.id = c, document.body.appendChild(l)), l;
97
+ let i = document.getElementById(c);
98
+ return i || (i = document.createElement("div"), i.id = c, document.body.appendChild(i)), i;
144
99
  }, []);
145
100
  }
146
101
  export {
147
- x as C,
148
- y as F,
149
- A as I,
150
- k as O,
151
- F as a,
152
- m as t,
153
- I as u
102
+ y as C,
103
+ P as F,
104
+ I,
105
+ E as O,
106
+ v as u
154
107
  };
@@ -1 +0,0 @@
1
- "use strict";const a={base:"cal",rotate0:"cam",rotateH0:"can",hovertrue:"_h",rotate90:"cao",rotateH90:"cap",rotate180:"caq",rotateH180:"car",rotate270:"cas",rotateH270:"cat",flipxAxis:"cau",flipHxAxis:"cav",flipyAxis:"caw",flipHyAxis:"cax",rotateF0:"cay",focustrue:"_f",rotateF90:"caz",rotateF180:"caA",rotateF270:"caB",flipFxAxis:"caC",flipFyAxis:"caD",rotateA0:"caE",rotateA90:"caF",rotateA180:"caG",rotateA270:"caH",flipAxAxis:"caI",flipAyAxis:"caJ"};exports.classes=a;
@@ -1,4 +0,0 @@
1
- const a = { base: "cal", rotate0: "cam", rotateH0: "can", hovertrue: "_h", rotate90: "cao", rotateH90: "cap", rotate180: "caq", rotateH180: "car", rotate270: "cas", rotateH270: "cat", flipxAxis: "cau", flipHxAxis: "cav", flipyAxis: "caw", flipHyAxis: "cax", rotateF0: "cay", focustrue: "_f", rotateF90: "caz", rotateF180: "caA", rotateF270: "caB", flipFxAxis: "caC", flipFyAxis: "caD", rotateA0: "caE", rotateA90: "caF", rotateA180: "caG", rotateA270: "caH", flipAxAxis: "caI", flipAyAxis: "caJ" };
2
- export {
3
- a as c
4
- };