@cronocode/react-box 1.8.7 → 1.8.9

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 (55) hide show
  1. package/README.md +6 -17
  2. package/box.cjs +1 -1
  3. package/box.d.ts +4 -3
  4. package/box.mjs +7 -8
  5. package/components/baseSvg.cjs +1 -1
  6. package/components/baseSvg.d.ts +4 -4
  7. package/components/baseSvg.mjs +10 -12
  8. package/components/button.cjs +1 -1
  9. package/components/button.d.ts +3 -3
  10. package/components/button.mjs +8 -9
  11. package/components/checkbox.cjs +1 -1
  12. package/components/checkbox.d.ts +3 -2
  13. package/components/checkbox.mjs +8 -9
  14. package/components/dataGrid/useGrid.d.ts +1 -0
  15. package/components/dataGrid.cjs +1 -1
  16. package/components/dataGrid.mjs +11 -14
  17. package/components/flex.cjs +1 -1
  18. package/components/flex.d.ts +3 -2
  19. package/components/flex.mjs +6 -8
  20. package/components/form.cjs +1 -1
  21. package/components/form.d.ts +2 -2
  22. package/components/form.mjs +7 -8
  23. package/components/grid.cjs +1 -1
  24. package/components/grid.d.ts +3 -2
  25. package/components/grid.mjs +6 -8
  26. package/components/radioButton.cjs +1 -1
  27. package/components/radioButton.d.ts +4 -3
  28. package/components/radioButton.mjs +6 -7
  29. package/components/textarea.cjs +1 -1
  30. package/components/textarea.d.ts +4 -3
  31. package/components/textarea.mjs +7 -8
  32. package/components/textbox.cjs +1 -1
  33. package/components/textbox.d.ts +4 -3
  34. package/components/textbox.mjs +3 -4
  35. package/components/tooltip.cjs +1 -1
  36. package/components/tooltip.d.ts +3 -2
  37. package/components/tooltip.mjs +7 -9
  38. package/core/boxStyles.d.ts +10 -13
  39. package/core/stylesContext.d.ts +4 -1
  40. package/core/theme.d.ts +1 -0
  41. package/core/types.d.ts +15 -5
  42. package/core/useStyles.cssClass.test.d.ts +1 -0
  43. package/core/useStyles.d.ts +1 -0
  44. package/core/useStyles.styles.test.d.ts +1 -0
  45. package/core/useTheme.d.ts +2 -1
  46. package/core.cjs +13 -13
  47. package/core.mjs +362 -339
  48. package/package.json +16 -17
  49. package/ssg.cjs +65 -65
  50. package/ssg.d.ts +2 -1
  51. package/ssg.mjs +8375 -8393
  52. package/ssg.test.d.ts +1 -0
  53. package/theme.cjs +1 -1
  54. package/theme.d.ts +2 -1
  55. package/theme.mjs +2 -4
package/README.md CHANGED
@@ -10,27 +10,14 @@ This is a react base component which will reduce considerably necessity to write
10
10
  npm install @cronocode/react-box
11
11
  ```
12
12
 
13
- 2. Import styles
13
+ 2. Use component
14
14
 
15
- ```
16
- import "@cronocode/react-box/styles.css";
17
- ```
18
-
19
- OR
15
+ Sizes is equal to `1/4rem`
20
16
 
21
- ```
22
- @import "@cronocode/react-box/styles.css";
23
- ```
24
-
25
- 3. Use component
26
-
27
- Sizes are divided to `4`
28
- `padding={3}` means `1rem/4 => 0.75rem`
17
+ `padding={3}` means `1/4 * 3 => 0.75rem`
29
18
 
30
19
  In the example below is creating a box with `maring: 0.5rem` and `padding: 1.75rem`
31
20
 
32
- Root `font-size` is set to `16px`
33
-
34
21
  ```
35
22
  import Box from "@cronocode/react-box";
36
23
 
@@ -43,6 +30,8 @@ export default function Component(props: Props) {
43
30
  }
44
31
  ```
45
32
 
33
+ **NOTE**: Root `font-size` is set to `16px`
34
+
46
35
  ## Components
47
36
 
48
37
  - **Box** - base component with a tons of props
@@ -67,7 +56,7 @@ import Flex from "@cronocode/react-box/components/flex";
67
56
  import Button from "@cronocode/react-box/components/button";
68
57
  ```
69
58
 
70
- - **Textbox**
59
+ - **Textbox** - this is a `Box` component with html tag `input`
71
60
 
72
61
  ```
73
62
  import Textbox from "@cronocode/react-box/components/textbox";
package/box.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const s=require("react"),u=require("./core.cjs");require("./utils.cjs");function g(t,a){const{tag:n="div",children:r,props:f,className:d,style:c,disabled:o}=t,y=u.useStyles(t,n==="svg"),m=s.useMemo(()=>u.classNames(y,d).join(" "),[t]),e={...f,className:m,disabled:Array.isArray(o)?o[0]:o};c&&(e.style=c),a&&(e.ref=a);const[v,i]=s.useState(!1),l=typeof r=="function";return l&&(e.onMouseEnter=()=>i(!0),e.onMouseLeave=()=>i(!1)),s.createElement(n,e,l?r({isHover:v}):r)}const q=s.forwardRef(g);module.exports=q;
1
+ "use strict";const s=require("react"),u=require("./core.cjs");function g(t,a){const{tag:n="div",children:o,props:f,className:d,style:c,disabled:r}=t,y=u.useStyles(t,n==="svg"),m=s.useMemo(()=>u.classNames(y,d).join(" "),[t]),e={...f,className:m,disabled:Array.isArray(r)?r[0]:r};c&&(e.style=c),a&&(e.ref=a);const[v,l]=s.useState(!1),i=typeof o=="function";return i&&(e.onMouseEnter=()=>l(!0),e.onMouseLeave=()=>l(!1)),s.createElement(n,e,i?o({isHover:v}):o)}const N=s.forwardRef(g);module.exports=N;
package/box.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import React, { Ref, RefAttributes } from 'react';
2
- import { BoxStyleProps, ExtractElementFromTag } from './core/types';
3
1
  import { ClassNameType } from './core/classNames';
2
+ import { BoxStyleProps, ExtractElementFromTag } from './core/types';
3
+ import { default as React, Ref, RefAttributes } from 'react';
4
+
4
5
  type AllProps<TTag extends keyof React.JSX.IntrinsicElements> = React.ComponentProps<TTag>;
5
6
  type TagPropsType<TTag extends keyof React.JSX.IntrinsicElements> = Omit<AllProps<TTag>, 'className' | 'style' | 'ref' | 'disabled'>;
6
7
  interface Props<TTag extends keyof React.JSX.IntrinsicElements> extends BoxStyleProps {
@@ -13,7 +14,7 @@ interface Props<TTag extends keyof React.JSX.IntrinsicElements> extends BoxStyle
13
14
  style?: React.ComponentProps<TTag>['style'];
14
15
  }
15
16
  declare function Box<TTag extends keyof React.JSX.IntrinsicElements = 'div'>(props: Props<TTag>, ref: Ref<ExtractElementFromTag<TTag>>): React.ReactElement<React.ComponentProps<TTag>, string | React.JSXElementConstructor<any>>;
16
- declare const _default: <TTag extends keyof React.JSX.IntrinsicElements = "div">(props: Props<TTag> & React.RefAttributes<ExtractElementFromTag<TTag>>) => React.ReactNode;
17
+ declare const _default: <TTag extends keyof React.JSX.IntrinsicElements = "div">(props: Props<TTag> & RefAttributes<ExtractElementFromTag<TTag>>) => React.ReactNode;
17
18
  export default _default;
18
19
  export type BoxProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = React.ComponentProps<typeof Box<TTag>>;
19
20
  export type BoxTagProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = Required<BoxProps<TTag>>['props'];
package/box.mjs CHANGED
@@ -1,13 +1,12 @@
1
- import y, { forwardRef as v, useMemo as p, useState as g } from "react";
1
+ import y, { forwardRef as v, useMemo as g, useState as p } from "react";
2
2
  import { u as N, c as x } from "./core.mjs";
3
- import "./utils.mjs";
4
- function H(s, a) {
5
- const { tag: r = "div", children: t, props: i, className: u, style: n, disabled: o } = s, f = N(s, r === "svg"), m = p(() => x(f, u).join(" "), [s]), e = { ...i, className: m, disabled: Array.isArray(o) ? o[0] : o };
6
- n && (e.style = n), a && (e.ref = a);
7
- const [d, l] = g(!1), c = typeof t == "function";
3
+ function H(s, o) {
4
+ const { tag: r = "div", children: t, props: i, className: u, style: n, disabled: a } = s, f = N(s, r === "svg"), m = g(() => x(f, u).join(" "), [s]), e = { ...i, className: m, disabled: Array.isArray(a) ? a[0] : a };
5
+ n && (e.style = n), o && (e.ref = o);
6
+ const [d, l] = p(!1), c = typeof t == "function";
8
7
  return c && (e.onMouseEnter = () => l(!0), e.onMouseLeave = () => l(!1)), y.createElement(r, e, c ? t({ isHover: d }) : t);
9
8
  }
10
- const b = v(H);
9
+ const $ = v(H);
11
10
  export {
12
- b as default
11
+ $ as default
13
12
  };
@@ -1 +1 @@
1
- "use strict";const u=require("react/jsx-runtime"),g=require("react"),p=require("../box.cjs");require("../core.cjs");require("../utils.cjs");function c(r,e){const{viewBox:s="0 0 24 24",width:t="1.5rem",height:o,props:i,...n}=r;return u.jsx(p,{tag:"svg",ref:e,props:{...i,viewBox:s,width:t,height:o,xmlns:"http://www.w3.org/2000/svg",fill:"none"},...n})}const w=g.forwardRef(c);module.exports=w;
1
+ "use strict";const g=require("react/jsx-runtime"),p=require("react"),u=require("../box.cjs");function c(r,e){const{viewBox:s="0 0 24 24",width:t="1.5rem",height:o,props:n,...i}=r;return g.jsx(u,{tag:"svg",ref:e,props:{...n,viewBox:s,width:t,height:o,xmlns:"http://www.w3.org/2000/svg",fill:"none"},...i})}const w=p.forwardRef(c);module.exports=w;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
- import { BoxTagProps } from '../box';
3
- import { BoxSvgStyles } from '../core/types';
4
1
  import { ClassNameType } from '../core/classNames';
2
+ import { BoxSvgStyles } from '../core/types';
3
+ import { BoxTagProps } from '../box';
4
+
5
5
  type BoxSvgTagProps = Omit<BoxTagProps<'svg'>, 'viewBox' | 'width' | 'height'>;
6
6
  interface Props extends BoxSvgStyles {
7
7
  children?: React.ReactNode | ((props: {
@@ -14,5 +14,5 @@ interface Props extends BoxSvgStyles {
14
14
  width?: string;
15
15
  height?: string;
16
16
  }
17
- declare const _default: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<SVGSVGElement>>;
17
+ declare const _default: import('react').ForwardRefExoticComponent<Props & import('react').RefAttributes<SVGSVGElement>>;
18
18
  export default _default;
@@ -1,21 +1,19 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { forwardRef as f } from "react";
3
- import g from "../box.mjs";
4
- import "../core.mjs";
5
- import "../utils.mjs";
1
+ import { jsx as g } from "react/jsx-runtime";
2
+ import { forwardRef as i } from "react";
3
+ import m from "../box.mjs";
6
4
  function n(o, r) {
7
- const { viewBox: t = "0 0 24 24", width: s = "1.5rem", height: p, props: e, ...i } = o;
8
- return /* @__PURE__ */ m(
9
- g,
5
+ const { viewBox: t = "0 0 24 24", width: s = "1.5rem", height: e, props: p, ...f } = o;
6
+ return /* @__PURE__ */ g(
7
+ m,
10
8
  {
11
9
  tag: "svg",
12
10
  ref: r,
13
- props: { ...e, viewBox: t, width: s, height: p, xmlns: "http://www.w3.org/2000/svg", fill: "none" },
14
- ...i
11
+ props: { ...p, viewBox: t, width: s, height: e, xmlns: "http://www.w3.org/2000/svg", fill: "none" },
12
+ ...f
15
13
  }
16
14
  );
17
15
  }
18
- const l = f(n);
16
+ const x = i(n);
19
17
  export {
20
- l as default
18
+ x as default
21
19
  };
@@ -1 +1 @@
1
- "use strict";const r=require("react/jsx-runtime"),n=require("react"),s=require("../box.cjs"),u=require("../utils.cjs");require("../core.cjs");const i=["type","onClick"];function c(t,e){const o=u.ObjectUtils.buildProps(t,i);return r.jsx(s,{ref:e,tag:"button",component:"button",...o})}const b=n.forwardRef(c);module.exports=b;
1
+ "use strict";const n=require("react/jsx-runtime"),r=require("react"),s=require("../box.cjs"),u=require("../utils.cjs"),c=["type","onClick"];function i(t,o){const e=u.ObjectUtils.buildProps(t,c);return n.jsx(s,{ref:o,tag:"button",component:"button",...e})}const b=r.forwardRef(i);module.exports=b;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- import Box from '../box';
1
+ import { default as Box } from '../box';
2
+
3
3
  type BoxProps = Omit<React.ComponentProps<typeof Box<'button'>>, 'ref' | 'tag'>;
4
4
  type BoxTagProps = Required<BoxProps>['props'];
5
5
  declare const tagProps: readonly ["type", "onClick"];
@@ -11,5 +11,5 @@ interface Props extends Omit<BoxProps, 'props'> {
11
11
  type?: ButtonType;
12
12
  onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
13
13
  }
14
- declare const _default: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLButtonElement>>;
14
+ declare const _default: import('react').ForwardRefExoticComponent<Omit<Props, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
15
15
  export default _default;
@@ -1,14 +1,13 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { forwardRef as p } from "react";
3
- import m from "../box.mjs";
4
- import { O as s } from "../utils.mjs";
5
- import "../core.mjs";
6
- const i = ["type", "onClick"];
7
- function e(o, t) {
8
- const r = s.buildProps(o, i);
9
- return /* @__PURE__ */ n(m, { ref: t, tag: "button", component: "button", ...r });
3
+ import s from "../box.mjs";
4
+ import { O as m } from "../utils.mjs";
5
+ const e = ["type", "onClick"];
6
+ function f(o, t) {
7
+ const r = m.buildProps(o, e);
8
+ return /* @__PURE__ */ n(s, { ref: t, tag: "button", component: "button", ...r });
10
9
  }
11
- const l = p(e);
10
+ const b = p(f);
12
11
  export {
13
- l as default
12
+ b as default
14
13
  };
@@ -1 +1 @@
1
- "use strict";const u=require("react/jsx-runtime"),t=require("react"),s=require("../box.cjs"),i=require("../utils.cjs");require("../core.cjs");const a=["name","onInput","onChange","autoFocus","readOnly","required","value","checked","defaultChecked"];function d(n,c){const{indeterminate:r}=n,o=i.ObjectUtils.buildProps(n,a,{type:"checkbox"}),e=t.useRef(null);return t.useImperativeHandle(c,()=>e.current),t.useEffect(()=>{e.current&&(e.current.indeterminate=!!r)},[e,r]),u.jsx(s,{tag:"input",ref:e,component:"checkbox",...o})}const f=t.forwardRef(d);module.exports=f;
1
+ "use strict";const u=require("react/jsx-runtime"),t=require("react"),s=require("../box.cjs"),i=require("../utils.cjs"),a=["name","onInput","onChange","autoFocus","readOnly","required","value","checked","defaultChecked"];function d(n,c){const{indeterminate:r}=n,o=i.ObjectUtils.buildProps(n,a,{type:"checkbox"}),e=t.useRef(null);return t.useImperativeHandle(c,()=>e.current),t.useEffect(()=>{e.current&&(e.current.indeterminate=!!r)},[e,r]),u.jsx(s,{tag:"input",ref:e,component:"checkbox",...o})}const f=t.forwardRef(d);module.exports=f;
@@ -1,5 +1,6 @@
1
- import React from 'react';
2
1
  import { BoxTagProps, BoxProps } from '../box';
2
+ import { default as React } from 'react';
3
+
3
4
  declare const tagProps: readonly ["name", "onInput", "onChange", "autoFocus", "readOnly", "required", "value", "checked", "defaultChecked"];
4
5
  type TagPropsType = (typeof tagProps)[number];
5
6
  type CheckboxProps = Omit<BoxProps<'input'>, 'tag' | 'props'>;
@@ -17,5 +18,5 @@ interface Props extends CheckboxProps {
17
18
  defaultChecked?: boolean;
18
19
  indeterminate?: boolean;
19
20
  }
20
- declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
21
+ declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLInputElement>>;
21
22
  export default _default;
@@ -1,16 +1,15 @@
1
1
  import { jsx as c } from "react/jsx-runtime";
2
- import { forwardRef as u, useRef as a, useImperativeHandle as i, useEffect as f } from "react";
2
+ import { forwardRef as u, useRef as a, useImperativeHandle as f, useEffect as i } from "react";
3
3
  import s from "../box.mjs";
4
4
  import { O as m } from "../utils.mjs";
5
- import "../core.mjs";
6
- const p = ["name", "onInput", "onChange", "autoFocus", "readOnly", "required", "value", "checked", "defaultChecked"];
7
- function d(o, r) {
8
- const { indeterminate: t } = o, n = m.buildProps(o, p, { type: "checkbox" }), e = a(null);
9
- return i(r, () => e.current), f(() => {
5
+ const d = ["name", "onInput", "onChange", "autoFocus", "readOnly", "required", "value", "checked", "defaultChecked"];
6
+ function p(o, n) {
7
+ const { indeterminate: t } = o, r = m.buildProps(o, d, { type: "checkbox" }), e = a(null);
8
+ return f(n, () => e.current), i(() => {
10
9
  e.current && (e.current.indeterminate = !!t);
11
- }, [e, t]), /* @__PURE__ */ c(s, { tag: "input", ref: e, component: "checkbox", ...n });
10
+ }, [e, t]), /* @__PURE__ */ c(s, { tag: "input", ref: e, component: "checkbox", ...r });
12
11
  }
13
- const g = u(d);
12
+ const k = u(p);
14
13
  export {
15
- g as default
14
+ k as default
16
15
  };
@@ -1,2 +1,3 @@
1
1
  import { Grid } from './dataGridContract';
2
+
2
3
  export default function useGrid<T extends {}>(data?: T[]): Grid<T>;
@@ -1 +1 @@
1
- "use strict";const s=require("react/jsx-runtime"),u=require("../box.cjs");require("react");require("../core.cjs");require("../utils.cjs");function c(e){if(!(e!=null&&e.length))return{rows:[],columns:[]};const i=Object.keys(e[0]);return{rows:e.map(r=>({dataRow:r,cells:i.map(n=>({key:n,value:r[n]}))})),columns:i.map(r=>({key:r}))}}function l(e){const{data:i}=e,r=c(i);return s.jsx(u,{display:"grid",b:1,borderRadius:1,children:r.columns.length===0?s.jsx(s.Fragment,{children:"empty grid"}):s.jsxs(s.Fragment,{children:[r.columns.map((n,t)=>s.jsx(u,{style:{gridColumn:t+1},children:n.key.toString()},n.key.toString())),r.rows.map((n,t)=>n.cells.map(o=>s.jsx(u,{children:o.value},o.key.toString()+t)))]})})}module.exports=l;
1
+ "use strict";const s=require("react/jsx-runtime"),o=require("../box.cjs");function c(e){if(!(e!=null&&e.length))return{rows:[],columns:[]};const t=Object.keys(e[0]);return{rows:e.map(r=>({dataRow:r,cells:t.map(n=>({key:n,value:r[n]}))})),columns:t.map(r=>({key:r}))}}function l(e){const{data:t}=e,r=c(t);return s.jsx(o,{display:"grid",b:1,borderRadius:1,children:r.columns.length===0?s.jsx(s.Fragment,{children:"empty grid"}):s.jsxs(s.Fragment,{children:[r.columns.map((n,i)=>s.jsx(o,{style:{gridColumn:i+1},children:n.key.toString()},n.key.toString())),r.rows.map((n,i)=>n.cells.map(u=>s.jsx(o,{children:u.value},u.key.toString()+i)))]})})}module.exports=l;
@@ -1,35 +1,32 @@
1
- import { jsx as o, Fragment as l, jsxs as u } from "react/jsx-runtime";
2
- import s from "../box.mjs";
3
- import "react";
4
- import "../core.mjs";
5
- import "../utils.mjs";
1
+ import { jsx as i, Fragment as m, jsxs as u } from "react/jsx-runtime";
2
+ import t from "../box.mjs";
6
3
  function c(e) {
7
4
  if (!(e != null && e.length))
8
5
  return {
9
6
  rows: [],
10
7
  columns: []
11
8
  };
12
- const i = Object.keys(e[0]);
9
+ const s = Object.keys(e[0]);
13
10
  return {
14
11
  rows: e.map((r) => ({
15
12
  dataRow: r,
16
- cells: i.map((n) => ({
13
+ cells: s.map((n) => ({
17
14
  key: n,
18
15
  value: r[n]
19
16
  }))
20
17
  })),
21
- columns: i.map((r) => ({
18
+ columns: s.map((r) => ({
22
19
  key: r
23
20
  }))
24
21
  };
25
22
  }
26
- function f(e) {
27
- const { data: i } = e, r = c(i);
28
- return /* @__PURE__ */ o(s, { display: "grid", b: 1, borderRadius: 1, children: r.columns.length === 0 ? /* @__PURE__ */ o(l, { children: "empty grid" }) : /* @__PURE__ */ u(l, { children: [
29
- r.columns.map((n, t) => /* @__PURE__ */ o(s, { style: { gridColumn: t + 1 }, children: n.key.toString() }, n.key.toString())),
30
- r.rows.map((n, t) => n.cells.map((m) => /* @__PURE__ */ o(s, { children: m.value }, m.key.toString() + t)))
23
+ function d(e) {
24
+ const { data: s } = e, r = c(s);
25
+ return /* @__PURE__ */ i(t, { display: "grid", b: 1, borderRadius: 1, children: r.columns.length === 0 ? /* @__PURE__ */ i(m, { children: "empty grid" }) : /* @__PURE__ */ u(m, { children: [
26
+ r.columns.map((n, o) => /* @__PURE__ */ i(t, { style: { gridColumn: o + 1 }, children: n.key.toString() }, n.key.toString())),
27
+ r.rows.map((n, o) => n.cells.map((l) => /* @__PURE__ */ i(t, { children: l.value }, l.key.toString() + o)))
31
28
  ] }) });
32
29
  }
33
30
  export {
34
- f as default
31
+ d as default
35
32
  };
@@ -1 +1 @@
1
- "use strict";const s=require("react/jsx-runtime"),t=require("react"),o=require("../box.cjs");require("../core.cjs");require("../utils.cjs");function u(e,r){const{inline:i,...n}=e;return s.jsx(o,{ref:r,display:i?"inline-flex":"flex",...n})}const x=t.forwardRef(u);module.exports=x;
1
+ "use strict";const i=require("react/jsx-runtime"),t=require("react"),o=require("../box.cjs");function u(e,r){const{inline:n,...s}=e;return i.jsx(o,{ref:r,display:n?"inline-flex":"flex",...s})}const x=t.forwardRef(u);module.exports=x;
@@ -1,7 +1,8 @@
1
+ import { default as Box } from '../box';
1
2
  import { RefAttributes } from 'react';
2
- import Box from '../box';
3
+
3
4
  type ExtractElementType<T> = T extends React.DetailedHTMLProps<React.HTMLAttributes<infer E>, infer E> ? E : T extends React.SVGProps<infer E> ? E : never;
4
5
  type ExtractElementFromTag<T extends keyof React.JSX.IntrinsicElements> = ExtractElementType<React.JSX.IntrinsicElements[T]>;
5
6
  type BoxProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = Omit<React.ComponentProps<typeof Box<TTag>>, 'ref'>;
6
- declare const _default: <TTag extends keyof import("react").JSX.IntrinsicElements = "div">(props: BoxProps<TTag> & RefAttributes<ExtractElementType<import("react").JSX.IntrinsicElements[TTag]>>) => React.ReactNode;
7
+ declare const _default: <TTag extends keyof import("react").JSX.IntrinsicElements = "div">(props: BoxProps<TTag> & RefAttributes<ExtractElementFromTag<TTag>>) => React.ReactNode;
7
8
  export default _default;
@@ -1,13 +1,11 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { forwardRef as f } from "react";
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as i } from "react";
3
3
  import n from "../box.mjs";
4
- import "../core.mjs";
5
- import "../utils.mjs";
6
4
  function l(o, r) {
7
- const { inline: t, ...e } = o;
8
- return /* @__PURE__ */ i(n, { ref: r, display: t ? "inline-flex" : "flex", ...e });
5
+ const { inline: e, ...f } = o;
6
+ return /* @__PURE__ */ t(n, { ref: r, display: e ? "inline-flex" : "flex", ...f });
9
7
  }
10
- const c = f(l);
8
+ const p = i(l);
11
9
  export {
12
- c as default
10
+ p as default
13
11
  };
@@ -1 +1 @@
1
- "use strict";const m=require("react/jsx-runtime"),o=require("react"),f=require("../box.cjs"),l=require("../utils.cjs");require("../core.cjs");function a(r){const{onSubmit:s,props:n}=r,e=o.useRef(null),u=o.useCallback(t=>{t.preventDefault();const c=l.FormUtils.getFormEntries(e.current);s(c,t)},[]),i={...n,onSubmit:u,ref:e};return m.jsx(f,{tag:"form",...r,props:i})}module.exports=a;
1
+ "use strict";const m=require("react/jsx-runtime"),o=require("react"),f=require("../box.cjs"),l=require("../utils.cjs");function a(r){const{onSubmit:s,props:n}=r,t=o.useRef(null),u=o.useCallback(e=>{e.preventDefault();const c=l.FormUtils.getFormEntries(t.current);s(c,e)},[]),i={...n,onSubmit:u,ref:t};return m.jsx(f,{tag:"form",...r,props:i})}module.exports=a;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- import Box from '../box';
1
+ import { default as Box } from '../box';
2
+
3
3
  type BoxProps = React.ComponentProps<typeof Box<'form'>>;
4
4
  type BoxTagProps = Required<BoxProps>['props'];
5
5
  type FormTagProps = Omit<BoxTagProps, 'onSubmit' | 'ref'>;
@@ -1,16 +1,15 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { useRef as p, useCallback as u } from "react";
3
- import a from "../box.mjs";
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { useRef as a, useCallback as i } from "react";
3
+ import p from "../box.mjs";
4
4
  import { F as c } from "../utils.mjs";
5
- import "../core.mjs";
6
- function S(o) {
7
- const { onSubmit: m, props: n } = o, r = p(null), e = u((t) => {
5
+ function x(o) {
6
+ const { onSubmit: m, props: n } = o, r = a(null), e = i((t) => {
8
7
  t.preventDefault();
9
8
  const f = c.getFormEntries(r.current);
10
9
  m(f, t);
11
10
  }, []), s = { ...n, onSubmit: e, ref: r };
12
- return /* @__PURE__ */ i(a, { tag: "form", ...o, props: s });
11
+ return /* @__PURE__ */ u(p, { tag: "form", ...o, props: s });
13
12
  }
14
13
  export {
15
- S as default
14
+ x as default
16
15
  };
@@ -1 +1 @@
1
- "use strict";const s=require("react/jsx-runtime"),t=require("react"),o=require("../box.cjs");require("../core.cjs");require("../utils.cjs");function u(r,e){const{inline:i,...n}=r;return s.jsx(o,{ref:e,display:i?"inline-grid":"grid",...n})}const c=t.forwardRef(u);module.exports=c;
1
+ "use strict";const s=require("react/jsx-runtime"),t=require("react"),o=require("../box.cjs");function u(r,e){const{inline:i,...n}=r;return s.jsx(o,{ref:e,display:i?"inline-grid":"grid",...n})}const c=t.forwardRef(u);module.exports=c;
@@ -1,7 +1,8 @@
1
+ import { default as Box } from '../box';
1
2
  import { RefAttributes } from 'react';
2
- import Box from '../box';
3
+
3
4
  type ExtractElementType<T> = T extends React.DetailedHTMLProps<React.HTMLAttributes<infer E>, infer E> ? E : T extends React.SVGProps<infer E> ? E : never;
4
5
  type ExtractElementFromTag<T extends keyof React.JSX.IntrinsicElements> = ExtractElementType<React.JSX.IntrinsicElements[T]>;
5
6
  type BoxProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = Omit<React.ComponentProps<typeof Box<TTag>>, 'ref'>;
6
- declare const _default: <TTag extends keyof import("react").JSX.IntrinsicElements = "div">(props: BoxProps<TTag> & RefAttributes<ExtractElementType<import("react").JSX.IntrinsicElements[TTag]>>) => React.ReactNode;
7
+ declare const _default: <TTag extends keyof import("react").JSX.IntrinsicElements = "div">(props: BoxProps<TTag> & RefAttributes<ExtractElementFromTag<TTag>>) => React.ReactNode;
7
8
  export default _default;
@@ -1,13 +1,11 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
- import { forwardRef as m } from "react";
3
- import p from "../box.mjs";
4
- import "../core.mjs";
5
- import "../utils.mjs";
6
- function d(r, i) {
2
+ import { forwardRef as d } from "react";
3
+ import e from "../box.mjs";
4
+ function f(r, i) {
7
5
  const { inline: o, ...t } = r;
8
- return /* @__PURE__ */ n(p, { ref: i, display: o ? "inline-grid" : "grid", ...t });
6
+ return /* @__PURE__ */ n(e, { ref: i, display: o ? "inline-grid" : "grid", ...t });
9
7
  }
10
- const c = m(d);
8
+ const a = d(f);
11
9
  export {
12
- c as default
10
+ a as default
13
11
  };
@@ -1 +1 @@
1
- "use strict";const r=require("react/jsx-runtime"),n=require("react"),u=require("../box.cjs"),i=require("../utils.cjs");require("../core.cjs");const s=["name","onInput","onChange","value","autoFocus","readOnly","required","checked","defaultChecked"];function c(e,t){const o=i.ObjectUtils.buildProps(e,s,{type:"radio"});return r.jsx(u,{ref:t,tag:"input",component:"radioButton",...o})}const a=n.forwardRef(c);module.exports=a;
1
+ "use strict";const r=require("react/jsx-runtime"),n=require("react"),u=require("../box.cjs"),s=require("../utils.cjs"),i=["name","onInput","onChange","value","autoFocus","readOnly","required","checked","defaultChecked"];function c(e,t){const o=s.ObjectUtils.buildProps(e,i,{type:"radio"});return r.jsx(u,{ref:t,tag:"input",component:"radioButton",...o})}const a=n.forwardRef(c);module.exports=a;
@@ -1,5 +1,6 @@
1
- import React from 'react';
2
- import Box from '../box';
1
+ import { default as Box } from '../box';
2
+ import { default as React } from 'react';
3
+
3
4
  type BoxProps = Omit<React.ComponentProps<typeof Box<'input'>>, 'ref' | 'tag'>;
4
5
  type BoxTagProps = Required<BoxProps>['props'];
5
6
  declare const tagProps: readonly ["name", "onInput", "onChange", "value", "autoFocus", "readOnly", "required", "checked", "defaultChecked"];
@@ -17,5 +18,5 @@ interface Props extends Omit<BoxProps, 'props'> {
17
18
  checked?: boolean;
18
19
  defaultChecked?: boolean;
19
20
  }
20
- declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
21
+ declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLInputElement>>;
21
22
  export default _default;
@@ -1,14 +1,13 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import { forwardRef as n } from "react";
3
3
  import a from "../box.mjs";
4
- import { O as i } from "../utils.mjs";
5
- import "../core.mjs";
6
- const u = ["name", "onInput", "onChange", "value", "autoFocus", "readOnly", "required", "checked", "defaultChecked"];
7
- function p(o, t) {
8
- const r = i.buildProps(o, u, { type: "radio" });
4
+ import { O as u } from "../utils.mjs";
5
+ const i = ["name", "onInput", "onChange", "value", "autoFocus", "readOnly", "required", "checked", "defaultChecked"];
6
+ function d(o, t) {
7
+ const r = u.buildProps(o, i, { type: "radio" });
9
8
  return /* @__PURE__ */ e(a, { ref: t, tag: "input", component: "radioButton", ...r });
10
9
  }
11
- const l = n(p);
10
+ const f = n(d);
12
11
  export {
13
- l as default
12
+ f as default
14
13
  };
@@ -1 +1 @@
1
- "use strict";const n=require("react/jsx-runtime"),o=require("react"),a=require("../box.cjs"),s=require("../utils.cjs");require("../core.cjs");const u=["name","onInput","onChange","placeholder","value","defaultValue","rows","cols","autoFocus","maxLength","minLength","readOnly","required"];function c(e,t){const r=s.ObjectUtils.buildProps(e,u);return n.jsx(a,{ref:t,tag:"textarea",component:"textarea",...r})}const i=o.forwardRef(c);module.exports=i;
1
+ "use strict";const n=require("react/jsx-runtime"),o=require("react"),a=require("../box.cjs"),s=require("../utils.cjs"),u=["name","onInput","onChange","placeholder","value","defaultValue","rows","cols","autoFocus","maxLength","minLength","readOnly","required"];function c(e,t){const r=s.ObjectUtils.buildProps(e,u);return n.jsx(a,{ref:t,tag:"textarea",component:"textarea",...r})}const i=o.forwardRef(c);module.exports=i;
@@ -1,5 +1,6 @@
1
- import React from 'react';
2
- import Box from '../box';
1
+ import { default as Box } from '../box';
2
+ import { default as React } from 'react';
3
+
3
4
  type BoxProps = Omit<React.ComponentProps<typeof Box<'textarea'>>, 'ref' | 'tag'>;
4
5
  type BoxTagProps = Required<BoxProps>['props'];
5
6
  declare const tagProps: readonly ["name", "onInput", "onChange", "placeholder", "value", "defaultValue", "rows", "cols", "autoFocus", "maxLength", "minLength", "readOnly", "required"];
@@ -21,5 +22,5 @@ interface Props extends Omit<BoxProps, 'props'> {
21
22
  readOnly?: boolean;
22
23
  required?: boolean;
23
24
  }
24
- declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLTextAreaElement>>;
25
+ declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
25
26
  export default _default;
@@ -1,9 +1,8 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import { forwardRef as a } from "react";
3
3
  import n from "../box.mjs";
4
- import { O as m } from "../utils.mjs";
5
- import "../core.mjs";
6
- const s = [
4
+ import { O as s } from "../utils.mjs";
5
+ const m = [
7
6
  "name",
8
7
  "onInput",
9
8
  "onChange",
@@ -18,11 +17,11 @@ const s = [
18
17
  "readOnly",
19
18
  "required"
20
19
  ];
21
- function p(t, o) {
22
- const e = m.buildProps(t, s);
23
- return /* @__PURE__ */ r(n, { ref: o, tag: "textarea", component: "textarea", ...e });
20
+ function p(t, e) {
21
+ const o = s.buildProps(t, m);
22
+ return /* @__PURE__ */ r(n, { ref: e, tag: "textarea", component: "textarea", ...o });
24
23
  }
25
- const x = a(p);
24
+ const i = a(p);
26
25
  export {
27
- x as default
26
+ i as default
28
27
  };
@@ -1 +1 @@
1
- "use strict";const o=require("react/jsx-runtime"),n=require("react"),u=require("../box.cjs"),s=require("../utils.cjs");require("../core.cjs");const i=["name","onInput","onChange","type","placeholder","defaultValue","autoFocus","readOnly","required","value","pattern"];function c(e,t){const r=s.ObjectUtils.buildProps(e,i);return o.jsx(u,{ref:t,tag:"input",component:"textbox",...r})}const a=n.forwardRef(c);module.exports=a;
1
+ "use strict";const r=require("react/jsx-runtime"),n=require("react"),u=require("../box.cjs"),s=require("../utils.cjs"),c=["name","onInput","onChange","type","placeholder","defaultValue","autoFocus","readOnly","required","value","pattern"];function i(e,t){const o=s.ObjectUtils.buildProps(e,c);return r.jsx(u,{ref:t,tag:"input",component:"textbox",...o})}const a=n.forwardRef(i);module.exports=a;
@@ -1,5 +1,6 @@
1
- import React from 'react';
2
- import Box from '../box';
1
+ import { default as Box } from '../box';
2
+ import { default as React } from 'react';
3
+
3
4
  type BoxProps = Omit<React.ComponentProps<typeof Box<'input'>>, 'ref' | 'tag'>;
4
5
  type BoxTagProps = Required<BoxProps>['props'];
5
6
  declare const tagProps: readonly ["name", "onInput", "onChange", "type", "placeholder", "defaultValue", "autoFocus", "readOnly", "required", "value", "pattern"];
@@ -21,5 +22,5 @@ interface Props extends Omit<BoxProps, 'props'> {
21
22
  required?: boolean;
22
23
  step?: number | string;
23
24
  }
24
- declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
25
+ declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLInputElement>>;
25
26
  export default _default;
@@ -2,7 +2,6 @@ import { jsx as r } from "react/jsx-runtime";
2
2
  import { forwardRef as n } from "react";
3
3
  import a from "../box.mjs";
4
4
  import { O as p } from "../utils.mjs";
5
- import "../core.mjs";
6
5
  const u = [
7
6
  "name",
8
7
  "onInput",
@@ -16,11 +15,11 @@ const u = [
16
15
  "value",
17
16
  "pattern"
18
17
  ];
19
- function m(o, t) {
18
+ function s(o, t) {
20
19
  const e = p.buildProps(o, u);
21
20
  return /* @__PURE__ */ r(a, { ref: t, tag: "input", component: "textbox", ...e });
22
21
  }
23
- const c = n(m);
22
+ const x = n(s);
24
23
  export {
25
- c as default
24
+ x as default
26
25
  };
@@ -1 +1 @@
1
- "use strict";const l=require("react/jsx-runtime"),h=require("react-dom"),f=require("../box.cjs"),s=require("react");require("../core.cjs");require("../utils.cjs");function v(){return s.useMemo(()=>{const c="crono-box";let r=document.getElementById(c);return r||(r=document.createElement("div"),r.id=c,document.body.appendChild(r)),r},[])}const a=2;function x(c){const{onPositionChange:r}=c,u=s.useRef(null),[e,p]=s.useState(),m=v(),w=s.useCallback((o,t)=>{const n=i=>{i.target.contains(o)&&t(o)};return document.addEventListener("scroll",n,{capture:!0}),()=>{document.removeEventListener("scroll",n,{capture:!0})}},[e]),b=s.useCallback((o,t)=>{const n=i=>{t(o)};return window.addEventListener("resize",n,{capture:!0}),()=>{window.removeEventListener("resize",n,{capture:!0})}},[e]),d=s.useCallback(o=>{const t=o.getBoundingClientRect(),n=Math.round((t.top+window.scrollY)*a)/a,i=Math.round((t.left+window.scrollX)*a)/a;((e==null?void 0:e.top)!==n||(e==null?void 0:e.left)!==i)&&(r==null||r({top:n,left:i}),p({top:n,left:i,width:t.width>0?t.width:void 0}))},[e]);return s.useLayoutEffect(()=>{if(u.current){d(u.current);const o=w(u.current,d),t=b(u.current,d);return()=>{o(),t()}}},[e]),l.jsxs(l.Fragment,{children:[l.jsx(f,{ref:u}),e&&h.createPortal(l.jsx(f,{position:"absolute",top:0,left:0,transition:"none",style:{transform:`translate(${e.left}px,${e.top}px)`,width:e.width},children:l.jsx(f,{position:"absolute",width:"fit",...c})}),m)]})}module.exports=x;
1
+ "use strict";const l=require("react/jsx-runtime"),h=require("react-dom"),f=require("../box.cjs"),s=require("react");function v(){return s.useMemo(()=>{const i="crono-box";let r=document.getElementById(i);return r||(r=document.createElement("div"),r.id=i,document.body.appendChild(r)),r},[])}const a=2;function x(i){const{onPositionChange:r}=i,u=s.useRef(null),[e,p]=s.useState(),m=v(),w=s.useCallback((o,t)=>{const n=c=>{c.target.contains(o)&&t(o)};return document.addEventListener("scroll",n,{capture:!0}),()=>{document.removeEventListener("scroll",n,{capture:!0})}},[e]),b=s.useCallback((o,t)=>{const n=c=>{t(o)};return window.addEventListener("resize",n,{capture:!0}),()=>{window.removeEventListener("resize",n,{capture:!0})}},[e]),d=s.useCallback(o=>{const t=o.getBoundingClientRect(),n=Math.round((t.top+window.scrollY)*a)/a,c=Math.round((t.left+window.scrollX)*a)/a;((e==null?void 0:e.top)!==n||(e==null?void 0:e.left)!==c)&&(r==null||r({top:n,left:c}),p({top:n,left:c,width:t.width>0?t.width:void 0}))},[e]);return s.useLayoutEffect(()=>{if(u.current){d(u.current);const o=w(u.current,d),t=b(u.current,d);return()=>{o(),t()}}},[e]),l.jsxs(l.Fragment,{children:[l.jsx(f,{ref:u}),e&&h.createPortal(l.jsx(f,{position:"absolute",top:0,left:0,transition:"none",style:{transform:`translate(${e.left}px,${e.top}px)`,width:e.width},children:l.jsx(f,{position:"absolute",width:"fit",...i})}),m)]})}module.exports=x;
@@ -1,5 +1,6 @@
1
- import Box from '../box';
2
- import React from 'react';
1
+ import { default as React } from 'react';
2
+ import { default as Box } from '../box';
3
+
3
4
  interface Props extends React.ComponentProps<typeof Box> {
4
5
  onPositionChange?(position: {
5
6
  top: number;