@cronocode/react-box 1.6.7 → 1.6.8

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.
Files changed (43) hide show
  1. package/components/baseSvg.cjs +1 -1
  2. package/components/baseSvg.mjs +1 -4
  3. package/components/button.cjs +1 -1
  4. package/components/button.d.ts +1 -0
  5. package/components/button.mjs +7 -10
  6. package/components/checkbox.cjs +1 -1
  7. package/components/checkbox.mjs +4 -7
  8. package/components/dataGrid/dataGridContract.d.ts +1 -0
  9. package/components/dataGrid.cjs +1 -1
  10. package/components/dataGrid.d.ts +1 -1
  11. package/components/dataGrid.mjs +2 -32
  12. package/components/dox/doxStyles.d.ts +9 -0
  13. package/components/dox.cjs +2 -2
  14. package/components/dox.d.ts +6 -4
  15. package/components/dox.mjs +23 -24
  16. package/components/doxSvg.cjs +1 -1
  17. package/components/doxSvg.d.ts +1 -0
  18. package/components/doxSvg.mjs +4 -7
  19. package/components/flex.d.ts +4 -2
  20. package/components/form.cjs +1 -1
  21. package/components/form.d.ts +2 -1
  22. package/components/form.mjs +4 -15
  23. package/components/grid.cjs +1 -1
  24. package/components/grid.d.ts +4 -2
  25. package/components/grid.mjs +5 -8
  26. package/components/radioButton.cjs +1 -1
  27. package/components/radioButton.mjs +2 -5
  28. package/components/textarea.cjs +1 -1
  29. package/components/textarea.mjs +7 -10
  30. package/components/textbox.cjs +1 -1
  31. package/components/textbox.mjs +6 -9
  32. package/components/tooltip.cjs +1 -1
  33. package/components/tooltip.d.ts +1 -1
  34. package/components/tooltip.mjs +5 -63
  35. package/package.json +14 -14
  36. package/plugins.cjs +1 -209
  37. package/plugins.mjs +0 -219
  38. package/style.css +1 -1
  39. package/theme.cjs +1 -1
  40. package/theme.mjs +8 -10
  41. package/types.d.ts +9 -0
  42. package/utils/utils.cjs +1 -1
  43. package/utils/utils.mjs +53 -63
package/theme.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),d={button:{styles:{display:"inline-block",p:3,cursor:"pointer",b:1,borderRadius:1},disabled:{cursor:"default"}},checkbox:{styles:{display:"inline-block",b:1,p:2}},radioButton:{styles:{display:"inline-block",b:1,p:2}},textbox:{styles:{display:"inline-block",b:1,borderRadius:1,p:3}},textarea:{styles:{display:"inline-block",b:1,borderRadius:1}}};let i=d;var r;(a=>{function n(s){i=s,o()}a.setup=n;function o(){Object.keys(d).forEach(t=>{const e=i[t],l=d[t];e?(e.styles={...l.styles,...e.styles},e.disabled&&l.disabled&&(e.disabled={...l.disabled,...e.disabled})):i[t]=d[t]})}})(r||(r={}));const p=r;function f(a){const{clean:n,disabled:o,theme:s,component:t}=a;return y.useMemo(()=>{var b,c,u;if(n)return;let e=i[t]??((b=i.components)==null?void 0:b[t]);if(!e)return;let l=s?{...e.styles,...(c=e.themes)==null?void 0:c[s].styles}:e.styles;return o?s?{...l,...e.disabled,...(u=e.themes)==null?void 0:u[s].disabled}:{...l,...e.disabled}:l},[t,n,o,s])}exports.default=p;exports.useTheme=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),d={button:{styles:{display:"inline-block",p:3,cursor:"pointer",b:1,borderRadius:1},disabled:{cursor:"default"}},checkbox:{styles:{display:"inline-block",b:1,p:2}},radioButton:{styles:{display:"inline-block",b:1,p:2}},textbox:{styles:{display:"inline-block",b:1,borderRadius:1,p:3}},textarea:{styles:{display:"inline-block",b:1,borderRadius:1}}};let i=d;var u;(a=>{function n(s){i=s,o()}a.setup=n;function o(){Object.keys(d).forEach(t=>{const e=i[t],l=d[t];e?(e.styles={...l.styles,...e.styles},e.disabled&&l.disabled&&(e.disabled={...l.disabled,...e.disabled})):i[t]=d[t]})}})(u||(u={}));function p(a){const{clean:n,disabled:o,theme:s,component:t}=a;return y.useMemo(()=>{var r,b,c;if(n)return;let e=i[t]??((r=i.components)==null?void 0:r[t]);if(!e)return;let l=s?{...e.styles,...(b=e.themes)==null?void 0:b[s].styles}:e.styles;return o?s?{...l,...e.disabled,...(c=e.themes)==null?void 0:c[s].disabled}:{...l,...e.disabled}:l},[t,n,o,s])}exports.useTheme=p;
package/theme.mjs CHANGED
@@ -43,7 +43,7 @@ const d = {
43
43
  }
44
44
  };
45
45
  let i = d;
46
- var r;
46
+ var u;
47
47
  ((a) => {
48
48
  function n(s) {
49
49
  i = s, o();
@@ -55,22 +55,20 @@ var r;
55
55
  e ? (e.styles = { ...l.styles, ...e.styles }, e.disabled && l.disabled && (e.disabled = { ...l.disabled, ...e.disabled })) : i[t] = d[t];
56
56
  });
57
57
  }
58
- })(r || (r = {}));
59
- const f = r;
60
- function m(a) {
58
+ })(u || (u = {}));
59
+ function f(a) {
61
60
  const { clean: n, disabled: o, theme: s, component: t } = a;
62
61
  return y(() => {
63
- var b, c, u;
62
+ var r, b, c;
64
63
  if (n)
65
64
  return;
66
- let e = i[t] ?? ((b = i.components) == null ? void 0 : b[t]);
65
+ let e = i[t] ?? ((r = i.components) == null ? void 0 : r[t]);
67
66
  if (!e)
68
67
  return;
69
- let l = s ? { ...e.styles, ...(c = e.themes) == null ? void 0 : c[s].styles } : e.styles;
70
- return o ? s ? { ...l, ...e.disabled, ...(u = e.themes) == null ? void 0 : u[s].disabled } : { ...l, ...e.disabled } : l;
68
+ let l = s ? { ...e.styles, ...(b = e.themes) == null ? void 0 : b[s].styles } : e.styles;
69
+ return o ? s ? { ...l, ...e.disabled, ...(c = e.themes) == null ? void 0 : c[s].disabled } : { ...l, ...e.disabled } : l;
71
70
  }, [t, n, o, s]);
72
71
  }
73
72
  export {
74
- f as default,
75
- m as useTheme
73
+ f as useTheme
76
74
  };
package/types.d.ts CHANGED
@@ -1,3 +1,12 @@
1
+ type Hovered<T> = {
2
+ [K in keyof T as K extends string ? `${K}H` : never]: T[K];
3
+ };
4
+ type Focused<T> = {
5
+ [K in keyof T as K extends string ? `${K}F` : never]: T[K];
6
+ };
7
+ type Activated<T> = {
8
+ [K in keyof T as K extends string ? `${K}A` : never]: T[K];
9
+ };
1
10
  export declare const styleVariables: {
2
11
  display: readonly ["none", "block", "inline-block", "flex", "inline-flex", "grid", "inline-grid", "contents"];
3
12
  boxSizing: readonly ["border-box", "content-box"];
package/utils/utils.cjs CHANGED
@@ -1 +1 @@
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;
1
+ "use strict";require("react");var a;(h=>{function c(...o){return o.reduce((s,n)=>n?typeof n=="string"?(s.push(n),s):Array.isArray(n)?(s.push(...c(...n)),s):(Object.entries(n).forEach(([r,e])=>{e&&s.push(r)}),s):s,[])}h.classNames=c})(a||(a={}));const x=a;class y{constructor(){this._index=0,this._cache={}}getIdentity(c){return this._cache[c]||(this._cache[c]=this.getByIndex(this._index++)),this._cache[c]}getByIndex(c){const{first:o,next:s}=b,n=c-o.length;if(n<0)return o[c];const r=Math.floor(n/s.length),e=n-r*s.length;return this.getByIndex(r)+s[e]}}const b={first:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",next:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"};var l;(h=>{function c(s,...n){const r={...s},e={};return n.forEach(t=>{t in r&&(e[t]=r[t],delete r[t])}),[e,r]}h.moveToTagProps=c;function o(s,n,r){const e={...s},t=e.props||{};return n.forEach(i=>{if(i in e){if(t[i]=e[i],i==="disabled")return;delete e[i]}}),r&&Object.entries(r).forEach(([i,f])=>{t[i]=f}),e.props=t,e}h.buildProps=o})(l||(l={}));const I=l;var g;(h=>{function c(s){const n=Array.from(s.elements).reduce((r,e)=>{const t=e.name;return t&&(r[t]||(r[t]=[]),r[t].push(e)),r},{});return Object.entries(n).reduce((r,[e,t])=>{if(t.length===1){const i=t[0];o(r,e,i.type==="checkbox"||i.type==="radio"?i.checked:i.value)}else{const i=t.reduce((f,u)=>(u.type==="checkbox"||u.type==="radio"?u.checked&&f.push(u.value):f.push(u.value),f),[]);o(r,e,i)}return r},{})}h.getFormEntries=c;function o(s,n,r){if(n.includes(".")){const e=n.split(".");let t=s;e.forEach((i,f)=>{if(e.length>f+1){const u=i.match(/^(.+)\[(\d)\]$/);if(u){const[,d,p]=u;t[d]=t[d]||[],t[d][p]=t[d][p]||{},t=t[d][p]}else t[i]=t[i]||{},t=t[i]}else t[i]=r})}else s[n]=r}})(g||(g={}));exports.ClassNameUtils=x;exports.IdentityFactory=y;exports.ObjectUtils=I;
package/utils/utils.mjs CHANGED
@@ -1,14 +1,14 @@
1
- import { useMemo as x } from "react";
2
- var p;
3
- ((c) => {
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, []);
1
+ import "react";
2
+ var a;
3
+ ((u) => {
4
+ function i(...c) {
5
+ return c.reduce((s, n) => n ? typeof n == "string" ? (s.push(n), s) : Array.isArray(n) ? (s.push(...i(...n)), s) : (Object.entries(n).forEach(([r, e]) => {
6
+ e && s.push(r);
7
+ }), s) : s, []);
8
8
  }
9
- c.classNames = i;
10
- })(p || (p = {}));
11
- const y = p;
9
+ u.classNames = i;
10
+ })(a || (a = {}));
11
+ const y = a;
12
12
  class I {
13
13
  constructor() {
14
14
  this._index = 0, this._cache = {};
@@ -17,91 +17,81 @@ class I {
17
17
  return this._cache[i] || (this._cache[i] = this.getByIndex(this._index++)), this._cache[i];
18
18
  }
19
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];
20
+ const { first: c, next: s } = x, n = i - c.length;
21
+ if (n < 0)
22
+ return c[i];
23
+ const r = Math.floor(n / s.length), e = n - r * s.length;
24
+ return this.getByIndex(r) + s[e];
25
25
  }
26
26
  }
27
- const m = {
27
+ const x = {
28
28
  first: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
29
29
  next: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
30
30
  };
31
31
  var l;
32
- ((c) => {
33
- function i(n, ...o) {
34
- const r = { ...n }, e = {};
35
- return o.forEach((t) => {
32
+ ((u) => {
33
+ function i(s, ...n) {
34
+ const r = { ...s }, e = {};
35
+ return n.forEach((t) => {
36
36
  t in r && (e[t] = r[t], delete r[t]);
37
37
  }), [e, r];
38
38
  }
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")
39
+ u.moveToTagProps = i;
40
+ function c(s, n, r) {
41
+ const e = { ...s }, t = e.props || {};
42
+ return n.forEach((o) => {
43
+ if (o in e) {
44
+ if (t[o] = e[o], o === "disabled")
45
45
  return;
46
- delete e[s];
46
+ delete e[o];
47
47
  }
48
- }), r && Object.entries(r).forEach(([s, f]) => {
49
- t[s] = f;
48
+ }), r && Object.entries(r).forEach(([o, f]) => {
49
+ t[o] = f;
50
50
  }), e.props = t, e;
51
51
  }
52
- c.buildProps = u;
52
+ u.buildProps = c;
53
53
  })(l || (l = {}));
54
- const E = l;
54
+ const P = l;
55
55
  var g;
56
- ((c) => {
57
- function i(n) {
58
- const o = Array.from(n.elements).reduce((r, e) => {
56
+ ((u) => {
57
+ function i(s) {
58
+ const n = Array.from(s.elements).reduce((r, e) => {
59
59
  const t = e.name;
60
60
  return t && (r[t] || (r[t] = []), r[t].push(e)), r;
61
61
  }, {});
62
- return Object.entries(o).reduce((r, [e, t]) => {
62
+ return Object.entries(n).reduce((r, [e, t]) => {
63
63
  if (t.length === 1) {
64
- const s = t[0];
65
- u(r, e, s.type === "checkbox" || s.type === "radio" ? s.checked : s.value);
64
+ const o = t[0];
65
+ c(r, e, o.type === "checkbox" || o.type === "radio" ? o.checked : o.value);
66
66
  } else {
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);
67
+ const o = t.reduce((f, h) => (h.type === "checkbox" || h.type === "radio" ? h.checked && f.push(h.value) : f.push(h.value), f), []);
68
+ c(r, e, o);
69
69
  }
70
70
  return r;
71
71
  }, {});
72
72
  }
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) => {
73
+ u.getFormEntries = i;
74
+ function c(s, n, r) {
75
+ if (n.includes(".")) {
76
+ const e = n.split(".");
77
+ let t = s;
78
+ e.forEach((o, f) => {
79
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];
80
+ const h = o.match(/^(.+)\[(\d)\]$/);
81
+ if (h) {
82
+ const [, p, d] = h;
83
+ t[p] = t[p] || [], t[p][d] = t[p][d] || {}, t = t[p][d];
84
84
  } else
85
- t[s] = t[s] || {}, t = t[s];
85
+ t[o] = t[o] || {}, t = t[o];
86
86
  } else
87
- t[s] = r;
87
+ t[o] = r;
88
88
  });
89
89
  } else
90
- n[o] = r;
90
+ s[n] = r;
91
91
  }
92
92
  })(g || (g = {}));
93
- const P = g;
94
- function v() {
95
- return x(() => {
96
- const c = "crono-box";
97
- let i = document.getElementById(c);
98
- return i || (i = document.createElement("div"), i.id = c, document.body.appendChild(i)), i;
99
- }, []);
100
- }
101
93
  export {
102
94
  y as C,
103
- P as F,
104
95
  I,
105
- E as O,
106
- v as u
96
+ P as O
107
97
  };