@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.
- package/README.md +6 -17
- package/box.cjs +1 -1
- package/box.d.ts +4 -3
- package/box.mjs +7 -8
- package/components/baseSvg.cjs +1 -1
- package/components/baseSvg.d.ts +4 -4
- package/components/baseSvg.mjs +10 -12
- package/components/button.cjs +1 -1
- package/components/button.d.ts +3 -3
- package/components/button.mjs +8 -9
- package/components/checkbox.cjs +1 -1
- package/components/checkbox.d.ts +3 -2
- package/components/checkbox.mjs +8 -9
- package/components/dataGrid/useGrid.d.ts +1 -0
- package/components/dataGrid.cjs +1 -1
- package/components/dataGrid.mjs +11 -14
- package/components/flex.cjs +1 -1
- package/components/flex.d.ts +3 -2
- package/components/flex.mjs +6 -8
- package/components/form.cjs +1 -1
- package/components/form.d.ts +2 -2
- package/components/form.mjs +7 -8
- package/components/grid.cjs +1 -1
- package/components/grid.d.ts +3 -2
- package/components/grid.mjs +6 -8
- package/components/radioButton.cjs +1 -1
- package/components/radioButton.d.ts +4 -3
- package/components/radioButton.mjs +6 -7
- package/components/textarea.cjs +1 -1
- package/components/textarea.d.ts +4 -3
- package/components/textarea.mjs +7 -8
- package/components/textbox.cjs +1 -1
- package/components/textbox.d.ts +4 -3
- package/components/textbox.mjs +3 -4
- package/components/tooltip.cjs +1 -1
- package/components/tooltip.d.ts +3 -2
- package/components/tooltip.mjs +7 -9
- package/core/boxStyles.d.ts +10 -13
- package/core/stylesContext.d.ts +4 -1
- package/core/theme.d.ts +1 -0
- package/core/types.d.ts +15 -5
- package/core/useStyles.cssClass.test.d.ts +1 -0
- package/core/useStyles.d.ts +1 -0
- package/core/useStyles.styles.test.d.ts +1 -0
- package/core/useTheme.d.ts +2 -1
- package/core.cjs +13 -13
- package/core.mjs +362 -339
- package/package.json +16 -17
- package/ssg.cjs +65 -65
- package/ssg.d.ts +2 -1
- package/ssg.mjs +8375 -8393
- package/ssg.test.d.ts +1 -0
- package/theme.cjs +1 -1
- package/theme.d.ts +2 -1
- 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.
|
|
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");
|
|
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> &
|
|
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
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
9
|
+
const $ = v(H);
|
|
11
10
|
export {
|
|
12
|
-
|
|
11
|
+
$ as default
|
|
13
12
|
};
|
package/components/baseSvg.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
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;
|
package/components/baseSvg.d.ts
CHANGED
|
@@ -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(
|
|
17
|
+
declare const _default: import('react').ForwardRefExoticComponent<Props & import('react').RefAttributes<SVGSVGElement>>;
|
|
18
18
|
export default _default;
|
package/components/baseSvg.mjs
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
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:
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
|
|
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: { ...
|
|
14
|
-
...
|
|
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
|
|
16
|
+
const x = i(n);
|
|
19
17
|
export {
|
|
20
|
-
|
|
18
|
+
x as default
|
|
21
19
|
};
|
package/components/button.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
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;
|
package/components/button.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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(
|
|
14
|
+
declare const _default: import('react').ForwardRefExoticComponent<Omit<Props, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
|
|
15
15
|
export default _default;
|
package/components/button.mjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as p } from "react";
|
|
3
|
-
import
|
|
4
|
-
import { O as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
10
|
+
const b = p(f);
|
|
12
11
|
export {
|
|
13
|
-
|
|
12
|
+
b as default
|
|
14
13
|
};
|
package/components/checkbox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const u=require("react/jsx-runtime"),t=require("react"),s=require("../box.cjs"),i=require("../utils.cjs")
|
|
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;
|
package/components/checkbox.d.ts
CHANGED
|
@@ -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;
|
package/components/checkbox.mjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as u, useRef as a, useImperativeHandle as
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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", ...
|
|
10
|
+
}, [e, t]), /* @__PURE__ */ c(s, { tag: "input", ref: e, component: "checkbox", ...r });
|
|
12
11
|
}
|
|
13
|
-
const
|
|
12
|
+
const k = u(p);
|
|
14
13
|
export {
|
|
15
|
-
|
|
14
|
+
k as default
|
|
16
15
|
};
|
package/components/dataGrid.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("react/jsx-runtime"),
|
|
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;
|
package/components/dataGrid.mjs
CHANGED
|
@@ -1,35 +1,32 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
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
|
|
9
|
+
const s = Object.keys(e[0]);
|
|
13
10
|
return {
|
|
14
11
|
rows: e.map((r) => ({
|
|
15
12
|
dataRow: r,
|
|
16
|
-
cells:
|
|
13
|
+
cells: s.map((n) => ({
|
|
17
14
|
key: n,
|
|
18
15
|
value: r[n]
|
|
19
16
|
}))
|
|
20
17
|
})),
|
|
21
|
-
columns:
|
|
18
|
+
columns: s.map((r) => ({
|
|
22
19
|
key: r
|
|
23
20
|
}))
|
|
24
21
|
};
|
|
25
22
|
}
|
|
26
|
-
function
|
|
27
|
-
const { data:
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
r.columns.map((n,
|
|
30
|
-
r.rows.map((n,
|
|
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
|
-
|
|
31
|
+
d as default
|
|
35
32
|
};
|
package/components/flex.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
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;
|
package/components/flex.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { default as Box } from '../box';
|
|
1
2
|
import { RefAttributes } from 'react';
|
|
2
|
-
|
|
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<
|
|
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;
|
package/components/flex.mjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
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:
|
|
8
|
-
return /* @__PURE__ */
|
|
5
|
+
const { inline: e, ...f } = o;
|
|
6
|
+
return /* @__PURE__ */ t(n, { ref: r, display: e ? "inline-flex" : "flex", ...f });
|
|
9
7
|
}
|
|
10
|
-
const
|
|
8
|
+
const p = i(l);
|
|
11
9
|
export {
|
|
12
|
-
|
|
10
|
+
p as default
|
|
13
11
|
};
|
package/components/form.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const m=require("react/jsx-runtime"),o=require("react"),f=require("../box.cjs"),l=require("../utils.cjs");
|
|
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;
|
package/components/form.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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'>;
|
package/components/form.mjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
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
|
-
|
|
6
|
-
|
|
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__ */
|
|
11
|
+
return /* @__PURE__ */ u(p, { tag: "form", ...o, props: s });
|
|
13
12
|
}
|
|
14
13
|
export {
|
|
15
|
-
|
|
14
|
+
x as default
|
|
16
15
|
};
|
package/components/grid.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("react/jsx-runtime"),t=require("react"),o=require("../box.cjs");
|
|
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;
|
package/components/grid.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { default as Box } from '../box';
|
|
1
2
|
import { RefAttributes } from 'react';
|
|
2
|
-
|
|
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<
|
|
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;
|
package/components/grid.mjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
|
|
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(
|
|
6
|
+
return /* @__PURE__ */ n(e, { ref: i, display: o ? "inline-grid" : "grid", ...t });
|
|
9
7
|
}
|
|
10
|
-
const
|
|
8
|
+
const a = d(f);
|
|
11
9
|
export {
|
|
12
|
-
|
|
10
|
+
a as default
|
|
13
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const r=require("react/jsx-runtime"),n=require("react"),u=require("../box.cjs"),
|
|
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
|
|
2
|
-
import
|
|
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
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
10
|
+
const f = n(d);
|
|
12
11
|
export {
|
|
13
|
-
|
|
12
|
+
f as default
|
|
14
13
|
};
|
package/components/textarea.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("react/jsx-runtime"),o=require("react"),a=require("../box.cjs"),s=require("../utils.cjs")
|
|
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;
|
package/components/textarea.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
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;
|
package/components/textarea.mjs
CHANGED
|
@@ -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
|
|
5
|
-
|
|
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,
|
|
22
|
-
const
|
|
23
|
-
return /* @__PURE__ */ r(n, { ref:
|
|
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
|
|
24
|
+
const i = a(p);
|
|
26
25
|
export {
|
|
27
|
-
|
|
26
|
+
i as default
|
|
28
27
|
};
|
package/components/textbox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
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;
|
package/components/textbox.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
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;
|
package/components/textbox.mjs
CHANGED
|
@@ -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
|
|
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
|
|
22
|
+
const x = n(s);
|
|
24
23
|
export {
|
|
25
|
-
|
|
24
|
+
x as default
|
|
26
25
|
};
|
package/components/tooltip.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const l=require("react/jsx-runtime"),h=require("react-dom"),f=require("../box.cjs"),s=require("react");
|
|
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;
|
package/components/tooltip.d.ts
CHANGED