@cronocode/react-box 2.0.7 → 3.0.0-alpha.3

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 (53) hide show
  1. package/box.cjs +1 -1
  2. package/box.d.ts +15 -8
  3. package/box.mjs +15 -9
  4. package/components/baseSvg.d.ts +3 -4
  5. package/components/button.cjs +1 -1
  6. package/components/button.d.ts +4 -5
  7. package/components/button.mjs +1 -1
  8. package/components/checkbox.cjs +1 -1
  9. package/components/checkbox.d.ts +1 -4
  10. package/components/checkbox.mjs +10 -10
  11. package/components/dataGrid/dataGridContract.d.ts +19 -11
  12. package/components/dataGrid/useGridData.d.ts +7 -0
  13. package/components/dataGrid.cjs +1 -1
  14. package/components/dataGrid.d.ts +5 -3
  15. package/components/dataGrid.mjs +17 -28
  16. package/components/flex.d.ts +3 -6
  17. package/components/form.cjs +1 -1
  18. package/components/form.d.ts +3 -5
  19. package/components/form.mjs +1 -1
  20. package/components/grid.d.ts +3 -6
  21. package/components/label.d.ts +0 -1
  22. package/components/radioButton.cjs +1 -1
  23. package/components/radioButton.d.ts +5 -7
  24. package/components/radioButton.mjs +9 -9
  25. package/components/textarea.cjs +1 -1
  26. package/components/textarea.d.ts +5 -6
  27. package/components/textarea.mjs +8 -9
  28. package/components/textbox.cjs +1 -1
  29. package/components/textbox.d.ts +4 -6
  30. package/components/textbox.mjs +1 -1
  31. package/components/tooltip.cjs +1 -1
  32. package/components/tooltip.d.ts +2 -4
  33. package/components/tooltip.mjs +34 -40
  34. package/core/boxExtends.d.ts +6 -0
  35. package/core/boxStyles.d.ts +701 -1217
  36. package/core/boxStylesFormatters.d.ts +2 -2
  37. package/core/coreTypes.d.ts +31 -0
  38. package/core/theme.d.ts +13 -32
  39. package/core/useStyles.d.ts +12 -3
  40. package/core/useTheme.d.ts +7 -10
  41. package/core.cjs +4 -34
  42. package/core.mjs +1397 -1158
  43. package/package.json +20 -25
  44. package/ssg.d.ts +0 -1
  45. package/types.d.ts +26 -0
  46. package/utils/object/objectUtils.d.ts +2 -0
  47. package/components/dataGrid/useGrid.d.ts +0 -3
  48. package/core/stylesContext.d.ts +0 -13
  49. package/core/theme.cjs +0 -1
  50. package/core/theme.mjs +0 -4
  51. package/core/types.d.ts +0 -60
  52. package/utils.cjs +0 -1
  53. package/utils.mjs +0 -63
@@ -1,63 +1,57 @@
1
- import { jsxs as v, Fragment as b, jsx as a } from "react/jsx-runtime";
2
- import { createPortal as x } from "react-dom";
3
- import d from "../box.mjs";
4
- import { useMemo as E, useRef as C, useState as g, useCallback as f, useLayoutEffect as L } from "react";
5
- function y() {
6
- return E(() => {
7
- const i = "crono-box";
8
- let r = document.getElementById(i);
9
- return r || (r = document.createElement("div"), r.id = i, document.body.appendChild(r)), r;
10
- }, []);
11
- }
12
- const l = 2;
13
- function M(i) {
14
- const { onPositionChange: r } = i, c = C(null), [t, p] = g(), m = y(), w = f(
15
- (n, e) => {
16
- const o = (s) => {
17
- s.target.contains(n) && e(n);
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 u from "../box.mjs";
4
+ import { useRef as E, useState as L, useCallback as d, useLayoutEffect as g } from "react";
5
+ import { a as z } from "../core.mjs";
6
+ const i = 2;
7
+ function y(f) {
8
+ const { onPositionChange: c } = f, s = E(null), [t, p] = L(), m = z(), w = d(
9
+ (o, e) => {
10
+ const r = (n) => {
11
+ n.target.contains(o) && e(o);
18
12
  };
19
- return document.addEventListener("scroll", o, { capture: !0 }), () => {
20
- document.removeEventListener("scroll", o, { capture: !0 });
13
+ return document.addEventListener("scroll", r, { capture: !0 }), () => {
14
+ document.removeEventListener("scroll", r, { capture: !0 });
21
15
  };
22
16
  },
23
17
  [t]
24
- ), h = f(
25
- (n, e) => {
26
- const o = (s) => {
27
- e(n);
18
+ ), h = d(
19
+ (o, e) => {
20
+ const r = (n) => {
21
+ e(o);
28
22
  };
29
- return window.addEventListener("resize", o, { capture: !0 }), () => {
30
- window.removeEventListener("resize", o, { capture: !0 });
23
+ return window.addEventListener("resize", r, { capture: !0 }), () => {
24
+ window.removeEventListener("resize", r, { capture: !0 });
31
25
  };
32
26
  },
33
27
  [t]
34
- ), u = f(
35
- (n) => {
36
- const e = n.getBoundingClientRect(), o = Math.round((e.top + window.scrollY) * l) / l, s = Math.round((e.left + window.scrollX) * l) / l;
37
- ((t == null ? void 0 : t.top) !== o || (t == null ? void 0 : t.left) !== s) && (r == null || r({ top: o, left: s }), p({ top: o, left: s, width: e.width > 0 ? e.width : void 0 }));
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 }));
38
32
  },
39
33
  [t]
40
34
  );
41
- return L(() => {
42
- if (c.current) {
43
- u(c.current);
44
- const n = w(c.current, u), e = h(c.current, u);
35
+ return g(() => {
36
+ if (s.current) {
37
+ l(s.current);
38
+ const o = w(s.current, l), e = h(s.current, l);
45
39
  return () => {
46
- n(), e();
40
+ o(), e();
47
41
  };
48
42
  }
49
- }, [t]), /* @__PURE__ */ v(b, { children: [
50
- /* @__PURE__ */ a(d, { ref: c }),
51
- t && x(
43
+ }, [t]), /* @__PURE__ */ v(x, { children: [
44
+ /* @__PURE__ */ a(u, { ref: s }),
45
+ t && b(
52
46
  /* @__PURE__ */ a(
53
- d,
47
+ u,
54
48
  {
55
49
  position: "absolute",
56
50
  top: 0,
57
51
  left: 0,
58
52
  transition: "none",
59
53
  style: { transform: `translate(${t.left}px,${t.top}px)`, width: t.width },
60
- children: /* @__PURE__ */ a(d, { position: "absolute", width: "fit", ...i })
54
+ children: /* @__PURE__ */ a(u, { position: "absolute", width: "fit", ...f })
61
55
  }
62
56
  ),
63
57
  m
@@ -65,5 +59,5 @@ function M(i) {
65
59
  ] });
66
60
  }
67
61
  export {
68
- M as default
62
+ y as default
69
63
  };
@@ -0,0 +1,6 @@
1
+ import { BoxStyle } from './coreTypes';
2
+ declare namespace BoxExtends {
3
+ function extend<TProps extends Record<string, BoxStyle[]>>(variables: Record<string, string>, props: TProps): TProps;
4
+ function getVariables(): string;
5
+ }
6
+ export default BoxExtends;