@cronocode/react-box 1.6.9 → 1.7.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.
Files changed (52) hide show
  1. package/box.js +1 -0
  2. package/components/baseSvg.d.ts +19 -2
  3. package/components/baseSvg.js +19 -0
  4. package/components/button.js +13 -0
  5. package/components/{checkbox.mjs → checkbox.js} +8 -6
  6. package/components/dataGrid.js +32 -0
  7. package/components/{dox.mjs → dox.js} +78 -78
  8. package/components/flex.js +11 -0
  9. package/components/form.js +15 -0
  10. package/components/grid.js +11 -0
  11. package/components/{radioButton.mjs → radioButton.js} +7 -5
  12. package/components/textarea.js +28 -0
  13. package/components/textbox.js +26 -0
  14. package/components/tooltip.js +63 -0
  15. package/package.json +9 -14
  16. package/theme.d.ts +12 -0
  17. package/{plugins.mjs → theme.js} +97 -31
  18. package/utils.js +107 -0
  19. package/box.cjs +0 -1
  20. package/box.mjs +0 -7
  21. package/box.module.css.cjs +0 -1
  22. package/components/baseSvg.cjs +0 -1
  23. package/components/baseSvg.mjs +0 -6
  24. package/components/button.cjs +0 -1
  25. package/components/button.mjs +0 -11
  26. package/components/checkbox.cjs +0 -1
  27. package/components/dataGrid.cjs +0 -1
  28. package/components/dataGrid.mjs +0 -5
  29. package/components/dox.cjs +0 -7
  30. package/components/doxSvg.cjs +0 -1
  31. package/components/doxSvg.d.ts +0 -19
  32. package/components/doxSvg.mjs +0 -18
  33. package/components/flex.cjs +0 -1
  34. package/components/flex.mjs +0 -13
  35. package/components/form.cjs +0 -1
  36. package/components/form.mjs +0 -5
  37. package/components/grid.cjs +0 -1
  38. package/components/grid.mjs +0 -10
  39. package/components/radioButton.cjs +0 -1
  40. package/components/textarea.cjs +0 -1
  41. package/components/textarea.mjs +0 -26
  42. package/components/textbox.cjs +0 -1
  43. package/components/textbox.mjs +0 -24
  44. package/components/tooltip.cjs +0 -1
  45. package/components/tooltip.mjs +0 -6
  46. package/plugins.cjs +0 -209
  47. package/plugins.d.ts +0 -13
  48. package/theme.cjs +0 -1
  49. package/theme.mjs +0 -74
  50. package/utils.cjs +0 -1
  51. package/utils.mjs +0 -97
  52. /package/{box.module.css.mjs → box.module.css.js} +0 -0
package/box.js ADDED
@@ -0,0 +1 @@
1
+ import "./components/dox.js";
@@ -1,2 +1,19 @@
1
- import DoxSvg from './doxSvg';
2
- export default DoxSvg;
1
+ /// <reference types="react" />
2
+ import Dox from './dox';
3
+ import ClassNameUtils from '../utils/className/classNameUtils';
4
+ import { DoxSvgStyles } from './dox/doxStyles';
5
+ type SvgTagProps = Required<React.ComponentProps<typeof Dox<'svg'>>>['props'];
6
+ type DoxSvgTagProps = Omit<SvgTagProps, 'viewBox' | 'width' | 'height'>;
7
+ interface Props extends DoxSvgStyles {
8
+ children?: React.ReactNode | ((props: {
9
+ isHover: boolean;
10
+ }) => React.ReactNode);
11
+ props?: DoxSvgTagProps;
12
+ style?: React.ComponentProps<'svg'>['style'];
13
+ className?: ClassNameUtils.ClassNameType;
14
+ viewBox?: string;
15
+ width?: string;
16
+ height?: string;
17
+ }
18
+ declare const _default: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<SVGSVGElement>>;
19
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as m } from "react";
3
+ import { D as n } from "./dox.js";
4
+ function a(o, r) {
5
+ const { viewBox: s = "0 0 24 24", width: t = "1.5rem", height: p, props: e, ...g } = o;
6
+ return /* @__PURE__ */ i(
7
+ n,
8
+ {
9
+ tag: "svg",
10
+ ref: r,
11
+ props: { ...e, viewBox: s, width: t, height: p, xmlns: "http://www.w3.org/2000/svg", fill: "none" },
12
+ ...g
13
+ }
14
+ );
15
+ }
16
+ const x = m(a);
17
+ export {
18
+ x as b
19
+ };
@@ -0,0 +1,13 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { forwardRef as s } from "react";
3
+ import { D as p } from "./dox.js";
4
+ import { O as i } from "../utils.js";
5
+ const m = ["type", "onClick", "disabled"];
6
+ function e(o, t) {
7
+ const r = i.buildProps(o, m);
8
+ return /* @__PURE__ */ n(p, { ref: t, tag: "button", component: "button", ...r });
9
+ }
10
+ const u = s(e);
11
+ export {
12
+ u as b
13
+ };
@@ -1,10 +1,9 @@
1
1
  import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
2
  import { forwardRef as c } from "react";
3
- import t from "./dox.mjs";
4
- import { O as a } from "../utils.mjs";
5
- import l from "./flex.mjs";
6
- import { c as d } from "../box.module.css.mjs";
7
- import "../theme.mjs";
3
+ import { D as t } from "./dox.js";
4
+ import { O as a } from "../utils.js";
5
+ import { F as l } from "./flex.js";
6
+ import { c as d } from "../box.module.css.js";
8
7
  const p = [
9
8
  "name",
10
9
  "onInput",
@@ -24,4 +23,7 @@ function m(o, r) {
24
23
  !n && /* @__PURE__ */ e(t, { position: "absolute", pointerEvents: "none", className: d._checkedIcon, children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", width: "100%", viewBox: "0 0 20 20", children: /* @__PURE__ */ e("g", { fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ e("path", { stroke: "#000", strokeLinecap: "round", strokeLinejoin: "round", d: "M6 10.15L8.5 13 14 7" }) }) }) })
25
24
  ] });
26
25
  }
27
- c(m);
26
+ const b = c(m);
27
+ export {
28
+ b as c
29
+ };
@@ -0,0 +1,32 @@
1
+ import { jsx as i, Fragment as m, jsxs as c } from "react/jsx-runtime";
2
+ import { D as t } from "./dox.js";
3
+ function u(n) {
4
+ if (!(n != null && n.length))
5
+ return {
6
+ rows: [],
7
+ columns: []
8
+ };
9
+ const s = Object.keys(n[0]);
10
+ return {
11
+ rows: n.map((r) => ({
12
+ dataRow: r,
13
+ cells: s.map((e) => ({
14
+ key: e,
15
+ value: r[e]
16
+ }))
17
+ })),
18
+ columns: s.map((r) => ({
19
+ key: r
20
+ }))
21
+ };
22
+ }
23
+ function d(n) {
24
+ const { data: s } = n, r = u(s);
25
+ return /* @__PURE__ */ i(t, { display: "grid", b: 1, borderRadius: 1, children: r.columns.length === 0 ? /* @__PURE__ */ i(m, { children: "empty grid" }) : /* @__PURE__ */ c(m, { children: [
26
+ r.columns.map((e, o) => /* @__PURE__ */ i(t, { style: { gridColumn: o + 1 }, children: e.key.toString() }, e.key.toString())),
27
+ r.rows.map((e, o) => e.cells.map((l) => /* @__PURE__ */ i(t, { children: l.value }, l.key.toString() + o)))
28
+ ] }) });
29
+ }
30
+ export {
31
+ d as D
32
+ };
@@ -1,6 +1,6 @@
1
- import O, { useMemo as j, useLayoutEffect as I, useEffect as _, forwardRef as D, useState as P } from "react";
2
- import { I as M, C as W } from "../utils.mjs";
3
- import { useTheme as G } from "../theme.mjs";
1
+ import O, { useMemo as j, useLayoutEffect as I, useEffect as D, forwardRef as _, useState as P } from "react";
2
+ import { I as M, C as W } from "../utils.js";
3
+ import { u as G } from "../theme.js";
4
4
  var e;
5
5
  ((a) => {
6
6
  ((r) => {
@@ -13,56 +13,56 @@ var e;
13
13
  }
14
14
  r.svg = n;
15
15
  })(a.ClassName || (a.ClassName = {})), ((r) => {
16
- function m(u, t) {
17
- return `${t / 4}rem`;
16
+ function m(u, i) {
17
+ return `${i / 4}rem`;
18
18
  }
19
19
  r.rem = m;
20
- function n(u, t) {
21
- return `${t}px`;
20
+ function n(u, i) {
21
+ return `${i}px`;
22
22
  }
23
23
  r.px = n;
24
- function l(u, t) {
25
- const [o, v] = t.split("/");
24
+ function l(u, i) {
25
+ const [o, v] = i.split("/");
26
26
  return `${+o / +v * 100}%`;
27
27
  }
28
28
  r.fraction = l;
29
- function d(u, t) {
30
- switch (t) {
29
+ function d(u, i) {
30
+ switch (i) {
31
31
  case "fit":
32
32
  return "100%";
33
33
  case "fit-screen":
34
34
  return u.toLocaleLowerCase().includes("height") ? "100vh" : "100vw";
35
35
  default:
36
- return t;
36
+ return i;
37
37
  }
38
38
  }
39
39
  r.widthHeight = d;
40
40
  function g(u) {
41
- return (t, o) => `var(--${u}${o});`;
41
+ return (i, o) => `var(--${u}${o});`;
42
42
  }
43
43
  r.variables = g;
44
44
  function z(u) {
45
- return (t, o) => `var(--${u}${o});`;
45
+ return (i, o) => `var(--${u}${o});`;
46
46
  }
47
47
  r.svgVariables = z;
48
- function x(u, t) {
49
- return `repeat(${t},minmax(0,1fr))`;
48
+ function x(u, i) {
49
+ return `repeat(${i},minmax(0,1fr))`;
50
50
  }
51
51
  r.gridColumns = x;
52
- function f(u, t) {
53
- return t === "full-row" ? "1/-1" : `span ${t}/span ${t}`;
52
+ function f(u, i) {
53
+ return i === "full-row" ? "1/-1" : `span ${i}/span ${i}`;
54
54
  }
55
55
  r.gridColumn = f;
56
- function h(u, t) {
57
- return `${t}ms`;
56
+ function h(u, i) {
57
+ return `${i}ms`;
58
58
  }
59
59
  r.ms = h;
60
- function V(u, t) {
61
- return `${t}deg`;
60
+ function V(u, i) {
61
+ return `${i}deg`;
62
62
  }
63
63
  r.rotate = V;
64
- function b(u, t) {
65
- return t === "xAxis" ? "-1 1" : "1 -1";
64
+ function b(u, i) {
65
+ return i === "xAxis" ? "-1 1" : "1 -1";
66
66
  }
67
67
  r.flip = b;
68
68
  })(a.Value || (a.Value = {}));
@@ -229,7 +229,7 @@ const R = {
229
229
  }, H = {
230
230
  hover: { className: "_h" },
231
231
  focus: { className: "_f" }
232
- }, i = {
232
+ }, t = {
233
233
  display: {
234
234
  cssNames: ["display"],
235
235
  values1: { values: ["none", "block", "inline-block", "flex", "inline-flex", "grid", "inline-grid", "contents"] },
@@ -870,46 +870,46 @@ const R = {
870
870
  }
871
871
  };
872
872
  Object.keys(C).forEach((a) => {
873
- i[a] = C[a];
873
+ t[a] = C[a];
874
874
  });
875
875
  Object.keys(R).forEach((a) => {
876
- i[a] = R[a], i[a].isThemeStyle = !0;
876
+ t[a] = R[a], t[a].isThemeStyle = !0;
877
877
  });
878
878
  Object.keys(A).forEach((a) => {
879
- i[a] = A[a], i[a].isThemeStyle = !0;
879
+ t[a] = A[a], t[a].isThemeStyle = !0;
880
880
  });
881
881
  const y = {
882
- w: { ...i.width, key: "width" },
883
- h: { ...i.height, key: "height" },
884
- m: { ...i.margin, key: "margin" },
885
- mx: { ...i.marginHorizontal, key: "marginHorizontal" },
886
- my: { ...i.marginVertical, key: "marginVertical" },
887
- mt: { ...i.marginTop, key: "marginTop" },
888
- mr: { ...i.marginRight, key: "marginRight" },
889
- mb: { ...i.marginBottom, key: "marginBottom" },
890
- ml: { ...i.marginLeft, key: "marginLeft" },
891
- p: { ...i.padding, key: "padding" },
892
- px: { ...i.paddingHorizontal, key: "paddingHorizontal" },
893
- py: { ...i.paddingVertical, key: "paddingVertical" },
894
- pt: { ...i.paddingTop, key: "paddingTop" },
895
- pr: { ...i.paddingRight, key: "paddingRight" },
896
- pb: { ...i.paddingBottom, key: "paddingBottom" },
897
- pl: { ...i.paddingLeft, key: "paddingLeft" },
898
- b: { ...i.border, key: "border" },
899
- bx: { ...i.borderHorizontal, key: "borderHorizontal" },
900
- by: { ...i.borderVertical, key: "borderVertical" },
901
- bt: { ...i.borderTop, key: "borderTop" },
902
- br: { ...i.borderRight, key: "borderRight" },
903
- bb: { ...i.borderBottom, key: "borderBottom" },
904
- bl: { ...i.borderLeft, key: "borderLeft" },
905
- jc: { ...i.justifyContent, key: "justifyContent" },
906
- ai: { ...i.alignItems, key: "alignItems" },
907
- ac: { ...i.alignContent, key: "alignContent" },
908
- d: { ...i.flexDirection, key: "flexDirection" }
909
- }, U = Object.keys(i), X = Object.keys(y);
882
+ w: { ...t.width, key: "width" },
883
+ h: { ...t.height, key: "height" },
884
+ m: { ...t.margin, key: "margin" },
885
+ mx: { ...t.marginHorizontal, key: "marginHorizontal" },
886
+ my: { ...t.marginVertical, key: "marginVertical" },
887
+ mt: { ...t.marginTop, key: "marginTop" },
888
+ mr: { ...t.marginRight, key: "marginRight" },
889
+ mb: { ...t.marginBottom, key: "marginBottom" },
890
+ ml: { ...t.marginLeft, key: "marginLeft" },
891
+ p: { ...t.padding, key: "padding" },
892
+ px: { ...t.paddingHorizontal, key: "paddingHorizontal" },
893
+ py: { ...t.paddingVertical, key: "paddingVertical" },
894
+ pt: { ...t.paddingTop, key: "paddingTop" },
895
+ pr: { ...t.paddingRight, key: "paddingRight" },
896
+ pb: { ...t.paddingBottom, key: "paddingBottom" },
897
+ pl: { ...t.paddingLeft, key: "paddingLeft" },
898
+ b: { ...t.border, key: "border" },
899
+ bx: { ...t.borderHorizontal, key: "borderHorizontal" },
900
+ by: { ...t.borderVertical, key: "borderVertical" },
901
+ bt: { ...t.borderTop, key: "borderTop" },
902
+ br: { ...t.borderRight, key: "borderRight" },
903
+ bb: { ...t.borderBottom, key: "borderBottom" },
904
+ bl: { ...t.borderLeft, key: "borderLeft" },
905
+ jc: { ...t.justifyContent, key: "justifyContent" },
906
+ ai: { ...t.alignItems, key: "alignItems" },
907
+ ac: { ...t.alignContent, key: "alignContent" },
908
+ d: { ...t.flexDirection, key: "flexDirection" }
909
+ }, U = Object.keys(t), X = Object.keys(y);
910
910
  q.forEach((a) => {
911
911
  U.forEach((r) => {
912
- i[`${r}${a}`] = { ...i[r] }, i[`${r}${a}`].pseudoSuffix = a;
912
+ t[`${r}${a}`] = { ...t[r] }, t[`${r}${a}`].pseudoSuffix = a;
913
913
  }), X.forEach((r) => {
914
914
  y[`${r}${a}`] = { ...y[r], key: `${y[r].key}${a}` }, y[`${r}${a}`].pseudoSuffix = a;
915
915
  });
@@ -923,16 +923,16 @@ body{margin: 0;line-height: var(--lineHeight);font-size: var(--fontSize);}
923
923
  a,ul{all: unset;}
924
924
  .${a.doxClassName}{display: block;border: 0 solid var(--borderColor);outline: 0px solid var(--outlineColor);margin: 0;padding: 0;background-color: initial;transition: all var(--transitionTime);box-sizing: border-box;font-family: inherit;font-size: inherit;}
925
925
  .${a.svgClassName}{transition: all var(--svgTransitionTime);}.${a.svgClassName} path,.${a.svgClassName} circle,.${a.svgClassName} rect,.${a.svgClassName} line {transition: all var(--svgTransitionTime);}
926
- `, m = new M(), n = Object.keys(i), l = b();
926
+ `, m = new M(), n = Object.keys(t), l = b();
927
927
  let d = !1;
928
- const g = n.reduce((u, t) => (u[t] = /* @__PURE__ */ new Set(), u), {});
929
- function z(u, t) {
930
- if (u in i)
931
- return f(u, t);
928
+ const g = n.reduce((u, i) => (u[i] = /* @__PURE__ */ new Set(), u), {});
929
+ function z(u, i) {
930
+ if (u in t)
931
+ return f(u, i);
932
932
  if (u in H)
933
933
  return H[u].className;
934
934
  if (u in C)
935
- return f(u, t);
935
+ return f(u, i);
936
936
  }
937
937
  a.get = z;
938
938
  function x() {
@@ -943,37 +943,37 @@ a,ul{all: unset;}
943
943
  }
944
944
  }
945
945
  a.flush = x;
946
- function f(u, t) {
946
+ function f(u, i) {
947
947
  var c;
948
- g[u].has(t) || (d = !0, g[u].add(t));
949
- const o = V(u, t), v = ((c = o.formatClassName) == null ? void 0 : c.call(o, u, t)) ?? `${u}${t}`;
948
+ g[u].has(i) || (d = !0, g[u].add(i));
949
+ const o = V(u, i), v = ((c = o.formatClassName) == null ? void 0 : c.call(o, u, i)) ?? `${u}${i}`;
950
950
  return `-${m.getIdentity(v)}`;
951
951
  }
952
- function h(u, t) {
952
+ function h(u, i) {
953
953
  return Object.entries(g).filter(([v]) => {
954
954
  var c;
955
- return ((c = i[v]) == null ? void 0 : c.pseudoSuffix) === t;
955
+ return ((c = t[v]) == null ? void 0 : c.pseudoSuffix) === i;
956
956
  }).reduce((v, [c, E]) => (E.forEach((k) => {
957
957
  var T;
958
958
  const p = V(c, k), N = `.${f(c, k)}`;
959
959
  let S = [];
960
- t ? t === "H" ? S = [
960
+ i ? i === "H" ? S = [
961
961
  ...o(`${N}:hover`, p),
962
962
  ...o(`.${H.hover.className}:hover>${N}`, p)
963
- ] : t === "F" ? S = [
963
+ ] : i === "F" ? S = [
964
964
  ...o(`${N}:focus-within`, p),
965
965
  ...o(`.${H.focus.className}:focus-within>${N}`, p)
966
- ] : t === "A" && (S = o(`${N}:active`, p)) : S = o(N, p);
967
- const F = ((T = p.formatValue) == null ? void 0 : T.call(p, c, k)) ?? k, B = i[c].cssNames.map((L) => `${L}:${F};`).join("");
966
+ ] : i === "A" && (S = o(`${N}:active`, p)) : S = o(N, p);
967
+ const F = ((T = p.formatValue) == null ? void 0 : T.call(p, c, k)) ?? k, B = t[c].cssNames.map((L) => `${L}:${F};`).join("");
968
968
  v.push(`${S.join(",")}{${B}}`);
969
969
  }), v), u);
970
970
  function o(v, c) {
971
971
  return c.formatSelector ? c.formatSelector(v) : [v];
972
972
  }
973
973
  }
974
- function V(u, t) {
975
- const o = i[u];
976
- return o.isThemeStyle ? o : o.values1.values.includes(t) ? o.values1 : o.values2.values.includes(t) ? o.values2 : o.values3;
974
+ function V(u, i) {
975
+ const o = t[u];
976
+ return o.isThemeStyle ? o : o.values1.values.includes(i) ? o.values1 : o.values2.values.includes(i) ? o.values2 : o.values3;
977
977
  }
978
978
  function b() {
979
979
  const u = "crono-styles", o = typeof window < "u" && typeof window.document < "u" ? window.document : global.document;
@@ -981,7 +981,7 @@ a,ul{all: unset;}
981
981
  return v || (v = o.createElement("style"), v.setAttribute("id", u), v.setAttribute("type", "text/css"), o.head.insertBefore(v, o.head.firstChild)), v;
982
982
  }
983
983
  })(w || (w = {}));
984
- const Y = typeof window < "u" && typeof window.document < "u", J = Y ? I : _;
984
+ const Y = typeof window < "u" && typeof window.document < "u", J = Y ? I : D;
985
985
  function Q(a, r) {
986
986
  const m = G(a);
987
987
  return J(w.flush, [a]), j(() => {
@@ -1004,7 +1004,7 @@ function Z(a, r) {
1004
1004
  const [h, V] = P(!1), b = typeof n == "function";
1005
1005
  return b && (f.onMouseEnter = () => V(!0), f.onMouseLeave = () => V(!1)), O.createElement(m, f, b ? n({ isHover: h }) : n);
1006
1006
  }
1007
- const le = D(Z);
1007
+ const le = _(Z);
1008
1008
  export {
1009
- le as default
1009
+ le as D
1010
1010
  };
@@ -0,0 +1,11 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { forwardRef as t } from "react";
3
+ import { D as f } from "./dox.js";
4
+ function s(o, r) {
5
+ const { inline: e, ...i } = o;
6
+ return /* @__PURE__ */ n(f, { ref: r, display: e ? "inline-flex" : "flex", ...i });
7
+ }
8
+ const p = t(s);
9
+ export {
10
+ p as F
11
+ };
@@ -0,0 +1,15 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { useRef as i, useCallback as p } from "react";
3
+ import { D as u } from "./dox.js";
4
+ import { F as c } from "../utils.js";
5
+ function x(o) {
6
+ const { onSubmit: m, props: n } = o, r = i(null), s = p((t) => {
7
+ t.preventDefault();
8
+ const f = c.getFormEntries(r.current);
9
+ m(f, t);
10
+ }, []), e = { ...n, onSubmit: s, ref: r };
11
+ return /* @__PURE__ */ a(u, { tag: "form", ...o, props: e });
12
+ }
13
+ export {
14
+ x as F
15
+ };
@@ -0,0 +1,11 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as s } from "react";
3
+ import { D as d } from "./dox.js";
4
+ function e(r, i) {
5
+ const { inline: o, ...n } = r;
6
+ return /* @__PURE__ */ t(d, { ref: i, display: o ? "inline-grid" : "grid", ...n });
7
+ }
8
+ const a = s(e);
9
+ export {
10
+ a as g
11
+ };
@@ -1,8 +1,7 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import { forwardRef as n } from "react";
3
- import a from "./dox.mjs";
4
- import { O as i } from "../utils.mjs";
5
- import "../theme.mjs";
3
+ import { D as a } from "./dox.js";
4
+ import { O as i } from "../utils.js";
6
5
  const d = [
7
6
  "name",
8
7
  "onInput",
@@ -15,8 +14,11 @@ const d = [
15
14
  "checked",
16
15
  "defaultChecked"
17
16
  ];
18
- function p(o, t) {
17
+ function s(o, t) {
19
18
  const r = i.buildProps(o, d, { type: "radio" });
20
19
  return /* @__PURE__ */ e(a, { ref: t, tag: "input", component: "radioButton", ...r });
21
20
  }
22
- n(p);
21
+ const f = n(s);
22
+ export {
23
+ f as r
24
+ };
@@ -0,0 +1,28 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as a } from "react";
3
+ import { D as n } from "./dox.js";
4
+ import { O as s } from "../utils.js";
5
+ const m = [
6
+ "name",
7
+ "onInput",
8
+ "onChange",
9
+ "placeholder",
10
+ "disabled",
11
+ "value",
12
+ "defaultValue",
13
+ "rows",
14
+ "cols",
15
+ "autoFocus",
16
+ "maxLength",
17
+ "minLength",
18
+ "readOnly",
19
+ "required"
20
+ ];
21
+ function p(t, e) {
22
+ const o = s.buildProps(t, m);
23
+ return /* @__PURE__ */ r(n, { ref: e, tag: "textarea", component: "textarea", ...o });
24
+ }
25
+ const d = a(p);
26
+ export {
27
+ d as t
28
+ };
@@ -0,0 +1,26 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as n } from "react";
3
+ import { D as a } from "./dox.js";
4
+ import { O as p } from "../utils.js";
5
+ const s = [
6
+ "name",
7
+ "onInput",
8
+ "onChange",
9
+ "type",
10
+ "placeholder",
11
+ "disabled",
12
+ "defaultValue",
13
+ "autoFocus",
14
+ "readOnly",
15
+ "required",
16
+ "value",
17
+ "pattern"
18
+ ];
19
+ function u(o, t) {
20
+ const e = p.buildProps(o, s);
21
+ return /* @__PURE__ */ r(a, { ref: t, tag: "input", component: "textbox", ...e });
22
+ }
23
+ const c = n(u);
24
+ export {
25
+ c as t
26
+ };
@@ -0,0 +1,63 @@
1
+ import { jsxs as v, Fragment as x, jsx as a } from "react/jsx-runtime";
2
+ import { createPortal as b } from "react-dom";
3
+ import { D as u } from "./dox.js";
4
+ import { useRef as D, useState as E, useCallback as d, useLayoutEffect as L } from "react";
5
+ import { u as g } from "../utils.js";
6
+ const i = 2;
7
+ function y(f) {
8
+ const { onPositionChange: c } = f, s = D(null), [t, p] = E(), m = g(), w = d(
9
+ (o, e) => {
10
+ const r = (n) => {
11
+ n.target.contains(o) && e(o);
12
+ };
13
+ return document.addEventListener("scroll", r, { capture: !0 }), () => {
14
+ document.removeEventListener("scroll", r, { capture: !0 });
15
+ };
16
+ },
17
+ [t]
18
+ ), h = d(
19
+ (o, e) => {
20
+ const r = (n) => {
21
+ e(o);
22
+ };
23
+ return window.addEventListener("resize", r, { capture: !0 }), () => {
24
+ window.removeEventListener("resize", r, { capture: !0 });
25
+ };
26
+ },
27
+ [t]
28
+ ), l = d(
29
+ (o) => {
30
+ const e = o.getBoundingClientRect(), r = Math.round((e.top + window.scrollY) * i) / i, n = Math.round((e.left + window.scrollX) * i) / i;
31
+ ((t == null ? void 0 : t.top) !== r || (t == null ? void 0 : t.left) !== n) && (c == null || c({ top: r, left: n }), p({ top: r, left: n, width: e.width > 0 ? e.width : void 0 }));
32
+ },
33
+ [t]
34
+ );
35
+ return L(() => {
36
+ if (s.current) {
37
+ l(s.current);
38
+ const o = w(s.current, l), e = h(s.current, l);
39
+ return () => {
40
+ o(), e();
41
+ };
42
+ }
43
+ }, [t]), /* @__PURE__ */ v(x, { children: [
44
+ /* @__PURE__ */ a(u, { ref: s }),
45
+ t && b(
46
+ /* @__PURE__ */ a(
47
+ u,
48
+ {
49
+ position: "absolute",
50
+ top: 0,
51
+ left: 0,
52
+ transition: "none",
53
+ style: { transform: `translate(${t.left}px,${t.top}px)`, width: t.width },
54
+ children: /* @__PURE__ */ a(u, { position: "absolute", width: "fit", ...f })
55
+ }
56
+ ),
57
+ m
58
+ )
59
+ ] });
60
+ }
61
+ export {
62
+ y as T
63
+ };
package/package.json CHANGED
@@ -1,33 +1,28 @@
1
1
  {
2
2
  "name": "@cronocode/react-box",
3
- "version": "1.6.9",
4
- "main": "./box.cjs",
5
- "module": "./box.mjs",
3
+ "version": "1.7.1",
4
+ "main": "./box.js",
5
+ "module": "./box.js",
6
6
  "types": "./box.d.ts",
7
7
  "exports": {
8
8
  ".": {
9
- "import": "./box.mjs",
10
- "require": "./box.cjs",
9
+ "import": "./box.js",
10
+ "require": "./box.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.cjs",
15
+ "import": "./theme.js",
16
+ "require": "./theme.js",
17
17
  "types": "./theme.d.ts"
18
18
  },
19
19
  "./types": {
20
20
  "types": "./types.d.ts"
21
21
  },
22
22
  "./components/*": {
23
- "import": "./components/*.mjs",
24
- "require": "./components/*.cjs",
23
+ "import": "./components/*.js",
24
+ "require": "./components/*.js",
25
25
  "types": "./components/*.d.ts"
26
- },
27
- "./plugins": {
28
- "import": "./plugins.mjs",
29
- "require": "./plugins.cjs",
30
- "types": "./plugins.d.ts"
31
26
  }
32
27
  },
33
28
  "scripts": {
package/theme.d.ts CHANGED
@@ -20,8 +20,20 @@ export interface ThemeSetup {
20
20
  checkbox?: ThemeComponentStyles;
21
21
  radioButton?: ThemeComponentStyles;
22
22
  }
23
+ interface BoxAugmentedProps {
24
+ colors: Record<string, string>;
25
+ shadows: Record<string, string>;
26
+ backgrounds: Record<string, string>;
27
+ }
23
28
  declare namespace Theme {
24
29
  function setup(styles: ThemeSetup): void;
30
+ function setupAugmentedProps(props: BoxAugmentedProps, options?: {
31
+ namespacePath?: string;
32
+ }): {
33
+ variables: string;
34
+ themeCss: string;
35
+ boxDts: string;
36
+ };
25
37
  }
26
38
  export default Theme;
27
39
  type ReservedComponentName = Exclude<string, keyof Omit<ThemeSetup, 'components'>>;