@cronocode/react-box 1.4.0 → 1.4.2

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 (34) hide show
  1. package/baseSvg.module.css.cjs.js +1 -0
  2. package/box.cjs.js +1 -0
  3. package/{box.mjs → box.es.js} +3 -3
  4. package/box.module.css.cjs.js +1 -0
  5. package/components/baseSvg.cjs.js +1 -0
  6. package/components/{baseSvg.mjs → baseSvg.es.js} +2 -2
  7. package/components/button.cjs.js +1 -0
  8. package/components/{button.mjs → button.es.js} +4 -4
  9. package/components/checkbox.cjs.js +1 -0
  10. package/components/{checkbox.mjs → checkbox.es.js} +5 -5
  11. package/components/dataGrid.cjs.js +1 -0
  12. package/components/{dataGrid.mjs → dataGrid.es.js} +4 -4
  13. package/components/flex.cjs.js +1 -0
  14. package/components/{flex.mjs → flex.es.js} +4 -4
  15. package/components/form.cjs.js +1 -0
  16. package/components/{form.mjs → form.es.js} +4 -4
  17. package/components/radioButton.cjs.js +1 -0
  18. package/components/{radioButton.mjs → radioButton.es.js} +4 -4
  19. package/components/textarea.cjs.js +1 -0
  20. package/components/{textarea.mjs → textarea.es.js} +4 -4
  21. package/components/textbox.cjs.js +1 -0
  22. package/components/{textbox.mjs → textbox.es.js} +4 -4
  23. package/components/tooltip.cjs.js +1 -0
  24. package/components/{tooltip.mjs → tooltip.es.js} +4 -4
  25. package/package.json +11 -11
  26. package/plugins.cjs.js +220 -0
  27. package/plugins.d.ts +6 -5
  28. package/{plugins.mjs → plugins.es.js} +17 -18
  29. package/theme.cjs.js +1 -0
  30. package/utils/utils.cjs.js +1 -0
  31. /package/{baseSvg.module.css.mjs → baseSvg.module.css.es.js} +0 -0
  32. /package/{box.module.css.mjs → box.module.css.es.js} +0 -0
  33. /package/{theme.mjs → theme.es.js} +0 -0
  34. /package/utils/{utils.mjs → utils.es.js} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),o=require("../utils/utils.cjs.js"),n=require("../baseSvg.module.css.cjs.js");function w(l){const{children:s,props:v,className:c,style:m,viewBox:h,width:d,height:S}=l,e=c?o.ClassNameUtils.classNames(c,n.classes.base):[n.classes.base];Object.entries(l).forEach(([a,u])=>{const f=n.classes[a+u];f?e.push(f):a in o.themeSvgClasses&&e.push(`${o.themeSvgClasses[a]}${u}`)});const t={...v,style:{...m,width:d,height:S},className:e.join(" "),viewBox:h||"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none"},[p,i]=g.useState(!1),r=typeof s=="function";return r&&(t.onMouseEnter=()=>i(!0),t.onMouseLeave=()=>i(!1)),g.createElement("svg",t,r?s({isHover:p}):s)}exports.default=w;
@@ -1,6 +1,6 @@
1
1
  import d, { useState as N } from "react";
2
- import { C as x, t as m } from "../utils/utils.mjs";
3
- import { c as a } from "../baseSvg.module.css.mjs";
2
+ import { C as x, t as m } from "../utils/utils.es.js";
3
+ import { c as a } from "../baseSvg.module.css.es.js";
4
4
  function C(n) {
5
5
  const { children: s, props: p, className: r, style: h, viewBox: u, width: v, height: g } = n, e = r ? x.classNames(r, a.base) : [a.base];
6
6
  Object.entries(n).forEach(([o, l]) => {
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("react"),u=require("../box.cjs.js"),s=require("../utils/utils.cjs.js");require("../box.module.css.cjs.js");require("../theme.cjs.js");const i=["type","onClick","disabled"];function c(t,e){const o=s.ObjectUtils.buildProps(t,i);return r.jsx(u.default,{ref:e,tag:"button",component:"button",...o})}const l=n.forwardRef(c);exports.default=l;
@@ -1,9 +1,9 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { forwardRef as p } from "react";
3
- import i from "../box.mjs";
4
- import { O as m } from "../utils/utils.mjs";
5
- import "../box.module.css.mjs";
6
- import "../theme.mjs";
3
+ import i from "../box.es.js";
4
+ import { O as m } from "../utils/utils.es.js";
5
+ import "../box.module.css.es.js";
6
+ import "../theme.es.js";
7
7
  const s = ["type", "onClick", "disabled"];
8
8
  function e(o, t) {
9
9
  const r = m.buildProps(o, s);
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),t=require("../box.cjs.js"),i=require("../utils/utils.cjs.js"),u=require("./flex.cjs.js"),l=require("../box.module.css.cjs.js");require("../theme.cjs.js");const a=["name","onInput","onChange","disabled","autoFocus","readOnly","required","value","checked","defaultChecked"];function d(n,s){const{native:o}=n,r=i.ObjectUtils.buildProps(n,a,{type:"checkbox"});return e.jsxs(u.default,{inline:!0,position:"relative",children:[e.jsx(t.default,{ref:s,tag:"input",component:"checkbox",...r,appearance:o?void 0:"none"}),!o&&e.jsx(t.default,{position:"absolute",pointerEvents:"none",className:l.classes._checkedIcon,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",viewBox:"0 0 20 20",children:e.jsx("g",{fill:"none",fillRule:"evenodd",children:e.jsx("path",{stroke:"#000",strokeLinecap:"round",strokeLinejoin:"round",d:"M6 10.15L8.5 13 14 7"})})})})]})}const x=c.forwardRef(d);exports.default=x;
@@ -1,10 +1,10 @@
1
1
  import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
2
  import { forwardRef as s } from "react";
3
- import t from "../box.mjs";
4
- import { O as a } from "../utils/utils.mjs";
5
- import l from "./flex.mjs";
6
- import { c as d } from "../box.module.css.mjs";
7
- import "../theme.mjs";
3
+ import t from "../box.es.js";
4
+ import { O as a } from "../utils/utils.es.js";
5
+ import l from "./flex.es.js";
6
+ import { c as d } from "../box.module.css.es.js";
7
+ import "../theme.es.js";
8
8
  const p = [
9
9
  "name",
10
10
  "onInput",
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),u=require("../box.cjs.js");require("react");require("../box.module.css.cjs.js");require("../utils/utils.cjs.js");require("../theme.cjs.js");function o(r){if(!(r!=null&&r.length))return{rows:[],columns:[]};const t=Object.keys(r[0]);return{rows:r.map(e=>({dataRow:e,cells:t.map(n=>({key:n,value:e[n]}))})),columns:t.map(e=>({key:e}))}}function c(r){const{data:t}=r,e=o(t);return e.columns.length===0?i.jsx(u.default,{display:"grid",children:"empty grid"}):i.jsxs(u.default,{display:"grid",children:[e.columns.map((n,s)=>i.jsx(u.default,{style:{gridColumn:s+1},children:n.key.toString()},n.key.toString())),e.rows.map((n,s)=>n.cells.map(l=>i.jsx(u.default,{children:l.value},l.key.toString()+s)))]})}exports.default=c;
@@ -1,9 +1,9 @@
1
1
  import { jsx as s, jsxs as l } from "react/jsx-runtime";
2
- import t from "../box.mjs";
2
+ import t from "../box.es.js";
3
3
  import "react";
4
- import "../box.module.css.mjs";
5
- import "../utils/utils.mjs";
6
- import "../theme.mjs";
4
+ import "../box.module.css.es.js";
5
+ import "../utils/utils.es.js";
6
+ import "../theme.es.js";
7
7
  function p(i) {
8
8
  if (!(i != null && i.length))
9
9
  return {
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),n=require("react"),u=require("../box.cjs.js");require("../box.module.css.cjs.js");require("../utils/utils.cjs.js");require("../theme.cjs.js");function l(e,r){const{inline:t}=e;return i.jsx(u.default,{ref:r,display:t?"inline-flex":"flex",...e})}const o=n.forwardRef(l);exports.default=o;
@@ -1,9 +1,9 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import { forwardRef as e } from "react";
3
- import f from "../box.mjs";
4
- import "../box.module.css.mjs";
5
- import "../utils/utils.mjs";
6
- import "../theme.mjs";
3
+ import f from "../box.es.js";
4
+ import "../box.module.css.es.js";
5
+ import "../utils/utils.es.js";
6
+ import "../theme.es.js";
7
7
  function m(o, r) {
8
8
  const { inline: i } = o;
9
9
  return /* @__PURE__ */ t(f, { ref: r, display: i ? "inline-flex" : "flex", ...o });
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),o=require("react"),a=require("../box.cjs.js"),f=require("../utils/utils.cjs.js");require("../box.module.css.cjs.js");require("../theme.cjs.js");function m(e){const{onSubmit:n,props:u}=e,r=o.useRef(null),s=o.useCallback(t=>{t.preventDefault();const c=f.FormUtils.getFormEntries(r.current);n(c,t)},[]),i={...u,onSubmit:s,ref:r};return l.jsx(a.default,{tag:"form",...e,props:i})}exports.default=m;
@@ -1,9 +1,9 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
2
  import { useRef as p, useCallback as u } from "react";
3
- import a from "../box.mjs";
4
- import { F as c } from "../utils/utils.mjs";
5
- import "../box.module.css.mjs";
6
- import "../theme.mjs";
3
+ import a from "../box.es.js";
4
+ import { F as c } from "../utils/utils.es.js";
5
+ import "../box.module.css.es.js";
6
+ import "../theme.es.js";
7
7
  function d(o) {
8
8
  const { onSubmit: m, props: n } = o, r = p(null), e = u((t) => {
9
9
  t.preventDefault();
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("react"),u=require("../box.cjs.js"),i=require("../utils/utils.cjs.js");require("../box.module.css.cjs.js");require("../theme.cjs.js");const a=["name","onInput","onChange","disabled","value","autoFocus","readOnly","required","checked","defaultChecked"];function s(e,t){const o=i.ObjectUtils.buildProps(e,a,{type:"radio"});return r.jsx(u.default,{ref:t,tag:"input",component:"radioButton",...o})}const c=n.forwardRef(s);exports.default=c;
@@ -1,9 +1,9 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import { forwardRef as n } from "react";
3
- import a from "../box.mjs";
4
- import { O as i } from "../utils/utils.mjs";
5
- import "../box.module.css.mjs";
6
- import "../theme.mjs";
3
+ import a from "../box.es.js";
4
+ import { O as i } from "../utils/utils.es.js";
5
+ import "../box.module.css.es.js";
6
+ import "../theme.es.js";
7
7
  const d = [
8
8
  "name",
9
9
  "onInput",
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),n=require("../box.cjs.js"),u=require("../utils/utils.cjs.js");require("../box.module.css.cjs.js");require("../theme.cjs.js");const s=["name","onInput","onChange","placeholder","disabled","value","defaultValue","rows","cols","autoFocus","maxLength","minLength","readOnly","required"];function i(e,t){const r=u.ObjectUtils.buildProps(e,s);return a.jsx(n.default,{ref:t,tag:"textarea",component:"textarea",...r})}const c=o.forwardRef(i);exports.default=c;
@@ -1,9 +1,9 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import { forwardRef as a } from "react";
3
- import n from "../box.mjs";
4
- import { O as m } from "../utils/utils.mjs";
5
- import "../box.module.css.mjs";
6
- import "../theme.mjs";
3
+ import n from "../box.es.js";
4
+ import { O as m } from "../utils/utils.es.js";
5
+ import "../box.module.css.es.js";
6
+ import "../theme.es.js";
7
7
  const s = [
8
8
  "name",
9
9
  "onInput",
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),n=require("react"),u=require("../box.cjs.js"),a=require("../utils/utils.cjs.js");require("../box.module.css.cjs.js");require("../theme.cjs.js");const s=["name","onInput","onChange","type","placeholder","disabled","defaultValue","autoFocus","readOnly","required","value","pattern"];function i(e,t){const r=a.ObjectUtils.buildProps(e,s);return o.jsx(u.default,{ref:t,tag:"input",component:"textbox",...r})}const c=n.forwardRef(i);exports.default=c;
@@ -1,9 +1,9 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import { forwardRef as n } from "react";
3
- import a from "../box.mjs";
4
- import { O as p } from "../utils/utils.mjs";
5
- import "../box.module.css.mjs";
6
- import "../theme.mjs";
3
+ import a from "../box.es.js";
4
+ import { O as p } from "../utils/utils.es.js";
5
+ import "../box.module.css.es.js";
6
+ import "../theme.es.js";
7
7
  const i = [
8
8
  "name",
9
9
  "onInput",
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),v=require("react-dom"),d=require("../box.cjs.js"),s=require("react"),q=require("../utils/utils.cjs.js");require("../box.module.css.cjs.js");require("../theme.cjs.js");function x(u){const{children:f,onPositionChange:c}=u,o=s.useRef(null),[e,p]=s.useState(),w=q.usePortalContainer(),b=s.useCallback((t,r)=>{const n=a=>{a.target.contains(t)&&r()};return document.addEventListener("scroll",n,{capture:!0}),()=>{document.removeEventListener("scroll",n,{capture:!0})}},[e]),m=s.useCallback((t,r)=>{const n=a=>{r()};return window.addEventListener("resize",n,{capture:!0}),()=>{window.removeEventListener("resize",n,{capture:!0})}},[e]),i=s.useCallback(()=>{if(o.current){const t=o.current.getBoundingClientRect(),r=t.top+window.scrollY,n=t.left+window.scrollX;((e==null?void 0:e.top)!==r||(e==null?void 0:e.left)!==n)&&(c==null||c({top:r,left:n}),p({top:t.top+window.scrollY,left:t.left+window.scrollX}))}},[e]);return s.useLayoutEffect(()=>{if(o.current){i();const t=b(o.current,i),r=m(o.current,i);return()=>{t(),r()}}},[e]),l.jsxs(l.Fragment,{children:[l.jsx(d.default,{ref:o,position:"absolute",top:0,left:0,...u,children:void 0}),e&&v.createPortal(l.jsx(d.default,{position:"absolute",top:0,left:0,transition:"none",style:{transform:`translate(${e.left}px,${e.top}px)`},children:f}),w)]})}exports.default=x;
@@ -1,10 +1,10 @@
1
1
  import { jsxs as x, Fragment as b, jsx as a } from "react/jsx-runtime";
2
2
  import { createPortal as E } from "react-dom";
3
- import f from "../box.mjs";
3
+ import f from "../box.es.js";
4
4
  import { useRef as L, useState as z, useCallback as c, useLayoutEffect as g } from "react";
5
- import { u as C } from "../utils/utils.mjs";
6
- import "../box.module.css.mjs";
7
- import "../theme.mjs";
5
+ import { u as C } from "../utils/utils.es.js";
6
+ import "../box.module.css.es.js";
7
+ import "../theme.es.js";
8
8
  function P(i) {
9
9
  const { children: p, onPositionChange: s } = i, n = L(null), [t, d] = z(), m = C(), w = c(
10
10
  (e, r) => {
package/package.json CHANGED
@@ -1,29 +1,29 @@
1
1
  {
2
2
  "name": "@cronocode/react-box",
3
- "version": "1.4.0",
4
- "main": "./box.mjs",
5
- "module": "./box.mjs",
3
+ "version": "1.4.2",
4
+ "main": "./box.cjs.js",
5
+ "module": "./box.es.js",
6
6
  "types": "./box.d.ts",
7
7
  "exports": {
8
8
  ".": {
9
- "import": "./box.mjs",
10
- "require": "./box.mjs",
9
+ "import": "./box.es.js",
10
+ "require": "./box.cjs.js",
11
11
  "types": "./box.d.ts"
12
12
  },
13
13
  "./style.css": "./style.css",
14
14
  "./theme": {
15
- "import": "./theme.mjs",
16
- "require": "./theme.mjs",
15
+ "import": "./theme.es.js",
16
+ "require": "./theme.cjs.js",
17
17
  "types": "./theme.d.ts"
18
18
  },
19
19
  "./components/*": {
20
- "import": "./components/*.mjs",
21
- "require": "./components/*.mjs",
20
+ "import": "./components/*.es.js",
21
+ "require": "./components/*.cjs.js",
22
22
  "types": "./components/*.d.ts"
23
23
  },
24
24
  "./plugins": {
25
- "import": "./plugins.mjs",
26
- "require": "./plugins.mjs",
25
+ "import": "./plugins.es.js",
26
+ "require": "./plugins.cjs.js",
27
27
  "types": "./plugins.d.ts"
28
28
  }
29
29
  },
package/plugins.cjs.js ADDED
@@ -0,0 +1,220 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function u(r){const _=Object.entries(r.colors).map(([o,e])=>`--color${o}: ${e};`).join(`
2
+ `),n=Object.entries(r.shadows).map(([o,e])=>`--shadow${o}: ${e};`).join(`
3
+ `),i=Object.entries(r.backgrounds).map(([o,e])=>`--background${o}: ${e};`).join(`
4
+ `),s=`:root {
5
+ ${_}
6
+ ${n}
7
+ ${i}
8
+ }`,$=Object.keys(r.colors).map(o=>`
9
+ .color_${o},
10
+ .color_h_${o}:hover,
11
+ ._h:hover>.color_h_${o} {
12
+ color: var(--color${o});
13
+ }
14
+
15
+ .color_f_${o}:focus-within,
16
+ ._f:focus-within>.color_f_${o} {
17
+ color: var(--color${o});
18
+ }
19
+
20
+ .color_a_${o}:active {
21
+ color: var(--color${o});
22
+ }
23
+
24
+ .bgColor_${o},
25
+ .bgColor_h_${o}:hover,
26
+ ._h:hover>.bgColor_h_${o} {
27
+ background-color: var(--color${o});
28
+ }
29
+
30
+ .bgColor_f_${o}:focus-within,
31
+ ._f:focus-within>.bgColor_f_${o} {
32
+ background-color: var(--color${o});
33
+ }
34
+
35
+ .bgColor_a_${o}:active {
36
+ background-color: var(--color${o});
37
+ }
38
+
39
+ .borderColor_${o},
40
+ .borderColor_h_${o}:hover,
41
+ ._h:hover>.borderColor_h_${o} {
42
+ border-color: var(--color${o});
43
+ }
44
+
45
+ .borderColor_f_${o}:focus-within,
46
+ ._f:focus-within>.borderColor_f_${o} {
47
+ border-color: var(--color${o});
48
+ }
49
+
50
+ .borderColor_a_${o}:active {
51
+ border-color: var(--color${o});
52
+ }
53
+
54
+ .outlineColor_${o},
55
+ .outlineColor_h_${o}:hover,
56
+ ._h:hover>.outlineColor_h_${o} {
57
+ outline-color: var(--color${o});
58
+ }
59
+
60
+ .outlineColor_f_${o}:focus-within,
61
+ ._f:focus-within>.outlineColor_f_${o} {
62
+ outline-color: var(--color${o});
63
+ }
64
+
65
+ .outlineColor_a_${o}:active {
66
+ outline-color: var(--color${o});
67
+ }
68
+
69
+ .fill_${o},
70
+ .fill_h_${o}:hover,
71
+ ._h:hover>.fill_h_${o} {
72
+ path,
73
+ circle,
74
+ rect,
75
+ line {
76
+ fill: var(--color${o});
77
+ }
78
+ }
79
+
80
+ .fill_f_${o}:focus-within,
81
+ ._f:focus-within>.fill_f_${o} {
82
+ path,
83
+ circle,
84
+ rect,
85
+ line {
86
+ fill: var(--color${o});
87
+ }
88
+ }
89
+
90
+ .fill_a_${o}:active {
91
+ path,
92
+ circle,
93
+ rect,
94
+ line {
95
+ fill: var(--color${o});
96
+ }
97
+ }
98
+
99
+ .stroke_${o},
100
+ .stroke_h_${o}:hover,
101
+ ._h:hover>.stroke_h_${o} {
102
+ path,
103
+ circle,
104
+ rect,
105
+ line {
106
+ stroke: var(--color${o});
107
+ }
108
+ }
109
+
110
+ .stroke_f_${o}:focus-within,
111
+ ._f:focus-within>.stroke_f_${o} {
112
+ path,
113
+ circle,
114
+ rect,
115
+ line {
116
+ stroke: var(--color${o});
117
+ }
118
+ }
119
+
120
+ .stroke_a_${o}:active {
121
+ path,
122
+ circle,
123
+ rect,
124
+ line {
125
+ stroke: var(--color${o});
126
+ }
127
+ }`),h=Object.keys(r.shadows).map(o=>`
128
+ .shadow_${o},
129
+ .shadow_h_${o}:hover,
130
+ ._h:hover>.shadow_h_${o} {
131
+ box-shadow: var(--shadow${o});
132
+ }
133
+
134
+ .shadow_f_${o}:focus-within,
135
+ ._f:focus-within>.shadow_f_${o} {
136
+ box-shadow: var(--shadow${o});
137
+ }
138
+
139
+ .shadow_a_${o}:active {
140
+ box-shadow: var(--shadow${o});
141
+ }`),b=Object.keys(r.backgrounds).map(o=>`
142
+ .bg_${o},
143
+ .bg_h_${o}:hover,
144
+ ._h:hover>.bg_h_${o} {
145
+ background: var(--background${o});
146
+ }
147
+
148
+ .bg_f_${o}:focus-within,
149
+ ._f:focus-within>.bg_f_${o} {
150
+ background: var(--background${o});
151
+ }
152
+
153
+ .bg_a_${o}:active {
154
+ background: var(--background${o});
155
+ }`),l=Object.keys(r.colors).map(o=>`'${o}'`).join(" | "),t=Object.keys(r.backgrounds).map(o=>`'${o}'`).join(" | "),c=Object.keys(r.shadows).map(o=>`'${o}'`).join(" | "),p=`import '@cronocode/react-box';
156
+
157
+ declare module '@cronocode/react-box' {
158
+ type ColorType = ${l};
159
+ type BackgroundType = ${t};
160
+ type ShadowType = ${c};
161
+
162
+ namespace Augmented {
163
+ interface Props {
164
+ color?: ColorType;
165
+ colorH?: ColorType;
166
+ colorF?: ColorType;
167
+ colorA?: ColorType;
168
+ bgColor?: ColorType;
169
+ bgColorH?: ColorType;
170
+ bgColorF?: ColorType;
171
+ bgColorA?: ColorType;
172
+ backgroundColor?: ColorType;
173
+ backgroundColorH?: ColorType;
174
+ backgroundColorF?: ColorType;
175
+ backgroundColorA?: ColorType;
176
+ borderColor?: ColorType;
177
+ borderColorH?: ColorType;
178
+ borderColorF?: ColorType;
179
+ borderColorA?: ColorType;
180
+ outlineColor?: ColorType;
181
+ outlineColorH?: ColorType;
182
+ outlineColorF?: ColorType;
183
+ outlineColorA?: ColorType;
184
+ bg?: BackgroundType;
185
+ bgH?: BackgroundType;
186
+ bgF?: BackgroundType;
187
+ bgA?: BackgroundType;
188
+ background?: BackgroundType;
189
+ backgroundH?: BackgroundType;
190
+ backgroundF?: BackgroundType;
191
+ backgroundA?: BackgroundType;
192
+ shadow?: ShadowType;
193
+ shadowH?: ShadowType;
194
+ shadowF?: ShadowType;
195
+ shadowA?: ShadowType;
196
+ }
197
+ }
198
+ }
199
+ `,d=`import '@cronocode/react-box/components/baseSvg';
200
+
201
+ declare module '@cronocode/react-box/components/baseSvg' {
202
+ type ColorType = ${l};
203
+ type BackgroundType = ${t};
204
+ type ShadowType = ${c};
205
+
206
+ namespace Augmented {
207
+ interface Props {
208
+ fill?: ColorType;
209
+ fillH?: ColorType;
210
+ fillF?: ColorType;
211
+ fillA?: ColorType;
212
+ stroke?: ColorType;
213
+ strokeH?: ColorType;
214
+ strokeF?: ColorType;
215
+ strokeA?: ColorType;
216
+ }
217
+ }
218
+ }
219
+ `;return{themeCss:[s,...$,...h,...b].join(`
220
+ `),boxDts:p,baseSvgDts:d}}exports.boxTheme=u;
package/plugins.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- import { PluginOption } from 'vite';
2
1
  interface BoxThemeOptions {
3
- cssPath: string;
4
- boxDtsPath: string;
5
- baseSvgDtsPath: string;
6
2
  colors: Record<string, string>;
7
3
  shadows: Record<string, string>;
8
4
  backgrounds: Record<string, string>;
9
5
  }
10
- export declare function boxTheme(options: BoxThemeOptions): PluginOption;
6
+ interface BoxThemeResources {
7
+ themeCss: string;
8
+ boxDts: string;
9
+ baseSvgDts: string;
10
+ }
11
+ export declare function boxTheme(options: BoxThemeOptions): BoxThemeResources;
11
12
  export {};
@@ -1,15 +1,12 @@
1
1
  function C(r) {
2
- return {
3
- name: "boxTheme",
4
- configResolved(u) {
5
- const t = Object.entries(r.colors).map(([o, e]) => `--color${o}: ${e};`).join(`
6
- `), _ = Object.entries(r.shadows).map(([o, e]) => `--shadow${o}: ${e};`).join(`
2
+ const c = Object.entries(r.colors).map(([o, e]) => `--color${o}: ${e};`).join(`
3
+ `), n = Object.entries(r.shadows).map(([o, e]) => `--shadow${o}: ${e};`).join(`
7
4
  `), i = Object.entries(r.backgrounds).map(([o, e]) => `--background${o}: ${e};`).join(`
8
5
  `), $ = `:root {
9
- ${t}
10
- ${_}
6
+ ${c}
7
+ ${n}
11
8
  ${i}
12
- }`, h = Object.keys(r.colors).map((o) => `
9
+ }`, s = Object.keys(r.colors).map((o) => `
13
10
  .color_${o},
14
11
  .color_h_${o}:hover,
15
12
  ._h:hover>.color_h_${o} {
@@ -128,7 +125,7 @@ function C(r) {
128
125
  line {
129
126
  stroke: var(--color${o});
130
127
  }
131
- }`), s = Object.keys(r.shadows).map((o) => `
128
+ }`), h = Object.keys(r.shadows).map((o) => `
132
129
  .shadow_${o},
133
130
  .shadow_h_${o}:hover,
134
131
  ._h:hover>.shadow_h_${o} {
@@ -156,12 +153,12 @@ function C(r) {
156
153
 
157
154
  .bg_a_${o}:active {
158
155
  background: var(--background${o});
159
- }`), l = Object.keys(r.colors).map((o) => `'${o}'`).join(" | "), c = Object.keys(r.backgrounds).map((o) => `'${o}'`).join(" | "), n = Object.keys(r.shadows).map((o) => `'${o}'`).join(" | "), d = `import '@cronocode/react-box';
156
+ }`), l = Object.keys(r.colors).map((o) => `'${o}'`).join(" | "), t = Object.keys(r.backgrounds).map((o) => `'${o}'`).join(" | "), _ = Object.keys(r.shadows).map((o) => `'${o}'`).join(" | "), p = `import '@cronocode/react-box';
160
157
 
161
158
  declare module '@cronocode/react-box' {
162
159
  type ColorType = ${l};
163
- type BackgroundType = ${c};
164
- type ShadowType = ${n};
160
+ type BackgroundType = ${t};
161
+ type ShadowType = ${_};
165
162
 
166
163
  namespace Augmented {
167
164
  interface Props {
@@ -200,12 +197,12 @@ declare module '@cronocode/react-box' {
200
197
  }
201
198
  }
202
199
  }
203
- `, p = `import '@cronocode/react-box/components/baseSvg';
200
+ `, d = `import '@cronocode/react-box/components/baseSvg';
204
201
 
205
202
  declare module '@cronocode/react-box/components/baseSvg' {
206
203
  type ColorType = ${l};
207
- type BackgroundType = ${c};
208
- type ShadowType = ${n};
204
+ type BackgroundType = ${t};
205
+ type ShadowType = ${_};
209
206
 
210
207
  namespace Augmented {
211
208
  interface Props {
@@ -221,9 +218,11 @@ declare module '@cronocode/react-box/components/baseSvg' {
221
218
  }
222
219
  }
223
220
  `;
224
- (void 0)(r.cssPath, [$, ...h, ...s, ...b].join(`
225
- `)), (void 0)(r.boxDtsPath, d), (void 0)(r.baseSvgDtsPath, p);
226
- }
221
+ return {
222
+ themeCss: [$, ...s, ...h, ...b].join(`
223
+ `),
224
+ boxDts: p,
225
+ baseSvgDts: d
227
226
  };
228
227
  }
229
228
  export {
package/theme.cjs.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),o={button:{styles:{inline:!0,p:3,cursor:"pointer",b:1,borderRadius:1},disabled:{cursor:"default"}},checkbox:{styles:{inline:!0,b:1,p:2}},radioButton:{styles:{inline:!0,b:1,p:2}},textbox:{styles:{inline:!0,b:1,borderRadius:1,p:3}},textarea:{styles:{inline:!0,b:1,borderRadius:1}}};let n=o;var d;(u=>{function i(t){n=t,r()}u.setup=i;function r(){Object.keys(o).forEach(s=>{const e=n[s],l=o[s];e?(e.styles={...l.styles,...e.styles},e.disabled&&l.disabled&&(e.disabled={...l.disabled,...e.disabled})):n[s]=o[s]})}})(d||(d={}));const f=d;function m(u){const{clean:i,disabled:r,theme:t,component:s}=u;return y.useMemo(()=>{var a,b,c;if(i)return{};let e=n[s]??((a=n.components)==null?void 0:a[s]);if(!e)return{};let l=t?{...e.styles,...(b=e.themes)==null?void 0:b[t].styles}:e.styles;return r?t?{...l,...e.disabled,...(c=e.themes)==null?void 0:c[t].disabled}:{...l,...e.disabled}:l},[s,i,r,t])}exports.default=f;exports.useTheme=m;
@@ -0,0 +1 @@
1
+ "use strict";const h=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 b;(i=>{function n(...u){return u.reduce((l,s)=>s?typeof s=="string"?(l.push(s),l):Array.isArray(s)?(l.push(...n(...s)),l):(Object.entries(s).forEach(([r,e])=>{e&&l.push(r)}),l):l,[])}i.classNames=n})(b||(b={}));const F=b;var f;(i=>{function n(l,...s){const r={...l},e={};return s.forEach(o=>{o in r&&(e[o]=r[o],delete r[o])}),[e,r]}i.moveToTagProps=n;function u(l,s,r){const e={...l},o=e.props||{};return s.forEach(t=>{if(t in e){if(o[t]=e[t],t==="disabled")return;delete e[t]}}),r&&Object.entries(r).forEach(([t,c])=>{o[t]=c}),e.props=o,e}i.buildProps=u})(f||(f={}));const m=f;var g;(i=>{function n(l){const s=Array.from(l.elements).reduce((r,e)=>{const o=e.name;return o&&(r[o]||(r[o]=[]),r[o].push(e)),r},{});return Object.entries(s).reduce((r,[e,o])=>{if(o.length===1){const t=o[0];u(r,e,t.type==="checkbox"||t.type==="radio"?t.checked:t.value)}else{const t=o.reduce((c,_)=>(_.type==="checkbox"||_.type==="radio"?_.checked&&c.push(_.value):c.push(_.value),c),[]);u(r,e,t)}return r},{})}i.getFormEntries=n;function u(l,s,r){if(s.includes(".")){const e=s.split(".");let o=l;e.forEach((t,c)=>{if(e.length>c+1){const _=t.match(/^(.+)\[(\d)\]$/);if(_){const[,a,d]=_;o[a]=o[a]||[],o[a][d]=o[a][d]||{},o=o[a][d]}else o[t]=o[t]||{},o=o[t]}else o[t]=r})}else l[s]=r}})(g||(g={}));const k=g;function A(){return h.useMemo(()=>{const i="crono-box";let n=document.getElementById(i);return n||(n=document.createElement("div"),n.id=i,document.body.appendChild(n)),n},[])}exports.ClassNameUtils=F;exports.FormUtils=k;exports.ObjectUtils=m;exports.themeClasses=C;exports.themeSvgClasses=p;exports.usePortalContainer=A;
File without changes
File without changes
File without changes