@cronocode/react-box 3.0.19 → 3.0.21
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/box.cjs +1 -1
- package/box.d.ts +4 -1
- package/box.mjs +20 -17
- package/components/baseSvg.cjs +1 -1
- package/components/baseSvg.d.ts +4 -4
- package/components/baseSvg.mjs +12 -11
- package/components/button.cjs +1 -1
- package/components/button.mjs +8 -7
- package/components/checkbox.cjs +1 -1
- package/components/checkbox.mjs +8 -7
- package/components/dataGrid.cjs +1 -1
- package/components/dataGrid.mjs +117 -116
- package/components/dropdown.cjs +1 -1
- package/components/dropdown.mjs +11 -10
- package/components/flex.cjs +1 -1
- package/components/flex.mjs +9 -8
- package/components/form.cjs +1 -1
- package/components/form.mjs +10 -9
- package/components/grid.cjs +1 -1
- package/components/grid.mjs +7 -6
- package/components/radioButton.cjs +1 -1
- package/components/radioButton.mjs +9 -8
- package/components/semantics.cjs +1 -1
- package/components/semantics.mjs +31 -29
- package/components/textarea.cjs +1 -1
- package/components/textarea.mjs +9 -8
- package/components/textbox.cjs +1 -1
- package/components/textbox.mjs +8 -7
- package/components/tooltip.cjs +1 -1
- package/components/tooltip.d.ts +2 -2
- package/components/tooltip.mjs +25 -24
- package/core/boxStyles.d.ts +4 -0
- package/core.cjs +3 -3
- package/core.mjs +155 -140
- package/package.json +2 -1
- package/ssg.mjs +1 -1
- package/utils/string/stringUtils.d.ts +4 -0
package/components/flex.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
5
|
-
const { inline:
|
|
6
|
-
return /* @__PURE__ */ f
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as t } from "react";
|
|
3
|
+
import f from "../box.mjs";
|
|
4
|
+
function n(e, o) {
|
|
5
|
+
const { inline: r, ...l } = e;
|
|
6
|
+
return /* @__PURE__ */ i(f, { ref: o, display: r ? "inline-flex" : "flex", ...l });
|
|
7
7
|
}
|
|
8
|
-
const
|
|
8
|
+
const m = t(n);
|
|
9
|
+
m.displayName = "Flex";
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
+
m as default
|
|
11
12
|
};
|
package/components/form.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const a=require("react/jsx-runtime"),s=require("react"),f=require("../box.cjs"),l=require("../core.cjs");function n(r){const{onSubmit:e,props:u}=r,t=s.useRef(null),c=s.useCallback(o=>{o.preventDefault();const m=l.FormUtils.getFormEntries(t.current);e(m,o)},[e]),i={...u,onSubmit:c,ref:t};return a.jsx(f.default,{tag:"form",...r,props:i})}n.displayName="Form";module.exports=n;
|
package/components/form.mjs
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
4
|
-
import { e as
|
|
5
|
-
function
|
|
6
|
-
const { onSubmit: r, props: e } = o, t =
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as i, useCallback as p } from "react";
|
|
3
|
+
import u from "../box.mjs";
|
|
4
|
+
import { e as l } from "../core.mjs";
|
|
5
|
+
function c(o) {
|
|
6
|
+
const { onSubmit: r, props: e } = o, t = i(null), n = p(
|
|
7
7
|
(m) => {
|
|
8
8
|
m.preventDefault();
|
|
9
|
-
const f =
|
|
9
|
+
const f = l.getFormEntries(t.current);
|
|
10
10
|
r(f, m);
|
|
11
11
|
},
|
|
12
12
|
[r]
|
|
13
13
|
), s = { ...e, onSubmit: n, ref: t };
|
|
14
|
-
return /* @__PURE__ */ u
|
|
14
|
+
return /* @__PURE__ */ a(u, { tag: "form", ...o, props: s });
|
|
15
15
|
}
|
|
16
|
+
c.displayName = "Form";
|
|
16
17
|
export {
|
|
17
|
-
|
|
18
|
+
c as default
|
|
18
19
|
};
|
package/components/grid.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),o=require("react"),d=require("../box.cjs");function c(e,i){const{inline:s,...t}=e;return n.jsx(d.default,{ref:i,display:s?"inline-grid":"grid",...t})}const r=o.forwardRef(c);r.displayName="Grid";module.exports=r;
|
package/components/grid.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as n } from "react";
|
|
3
3
|
import e from "../box.mjs";
|
|
4
|
-
function
|
|
4
|
+
function m(r, i) {
|
|
5
5
|
const { inline: o, ...t } = r;
|
|
6
|
-
return /* @__PURE__ */
|
|
6
|
+
return /* @__PURE__ */ d(e, { ref: i, display: o ? "inline-grid" : "grid", ...t });
|
|
7
7
|
}
|
|
8
|
-
const
|
|
8
|
+
const p = n(m);
|
|
9
|
+
p.displayName = "Grid";
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
+
p as default
|
|
11
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),r=require("react"),u=require("../box.cjs"),a=require("../core.cjs"),s=["name","onInput","onChange","value","autoFocus","readOnly","defaultChecked"];function i(o,c){const e=a.ObjectUtils.buildProps(o,s,{type:"radio"});return n.jsx(u.default,{tag:"input",component:"radioButton",...e})}const t=r.forwardRef(i);t.displayName="RadioButton";module.exports=t;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as r } from "react";
|
|
3
3
|
import a from "../box.mjs";
|
|
4
4
|
import { O as e } from "../core.mjs";
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
const t = e.buildProps(o,
|
|
8
|
-
return /* @__PURE__ */
|
|
5
|
+
const i = ["name", "onInput", "onChange", "value", "autoFocus", "readOnly", "defaultChecked"];
|
|
6
|
+
function p(o, d) {
|
|
7
|
+
const t = e.buildProps(o, i, { type: "radio" });
|
|
8
|
+
return /* @__PURE__ */ n(a, { tag: "input", component: "radioButton", ...t });
|
|
9
9
|
}
|
|
10
|
-
const
|
|
10
|
+
const u = r(p);
|
|
11
|
+
u.displayName = "RadioButton";
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
+
u as default
|
|
13
14
|
};
|
package/components/semantics.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("react"),a=require("../box.cjs"),r=require("../core.cjs");function t(n){const e=i.forwardRef((o,c)=>s.jsx(a.default,{tag:n,ref:c,component:n,...o}));return e.displayName=r.StringUtils.capitalize(n),e}const u=t("label"),m=t("span"),l=t("article"),H=t("aside"),d=t("details"),p=t("figcaption"),g=t("figure"),S=t("footer"),f=t("header"),h=t("main"),M=t("mark"),b=t("nav"),y=t("menu"),F=t("section"),k=t("summary"),q=t("time"),v=t("p"),A=t("h1"),L=t("h2"),j=t("h3"),x=t("h4"),P=t("h5"),R=t("h6"),T=t("a"),D=t("img");exports.Article=l;exports.Aside=H;exports.Details=d;exports.Figcaption=p;exports.Figure=g;exports.Footer=S;exports.H1=A;exports.H2=L;exports.H3=j;exports.H4=x;exports.H5=P;exports.H6=R;exports.Header=f;exports.Img=D;exports.Label=u;exports.Link=T;exports.Main=h;exports.Mark=M;exports.Menu=y;exports.Nav=b;exports.P=v;exports.Section=F;exports.Span=m;exports.Summary=k;exports.Time=q;
|
package/components/semantics.mjs
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as e } from "react";
|
|
3
|
-
import
|
|
3
|
+
import r from "../box.mjs";
|
|
4
|
+
import { f as a } from "../core.mjs";
|
|
4
5
|
function o(t) {
|
|
5
|
-
|
|
6
|
+
const n = e((s, c) => /* @__PURE__ */ i(r, { tag: t, ref: c, component: t, ...s }));
|
|
7
|
+
return n.displayName = a.capitalize(t), n;
|
|
6
8
|
}
|
|
7
|
-
const
|
|
9
|
+
const u = o("label"), d = o("span"), h = o("article"), H = o("aside"), g = o("details"), S = o("figcaption"), k = o("figure"), x = o("footer"), y = o("header"), F = o("main"), M = o("mark"), b = o("nav"), v = o("menu"), A = o("section"), L = o("summary"), j = o("time"), w = o("p"), z = o("h1"), B = o("h2"), D = o("h3"), I = o("h4"), P = o("h5"), R = o("h6"), T = o("a"), U = o("img");
|
|
8
10
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
11
|
+
h as Article,
|
|
12
|
+
H as Aside,
|
|
13
|
+
g as Details,
|
|
14
|
+
S as Figcaption,
|
|
15
|
+
k as Figure,
|
|
16
|
+
x as Footer,
|
|
17
|
+
z as H1,
|
|
18
|
+
B as H2,
|
|
19
|
+
D as H3,
|
|
20
|
+
I as H4,
|
|
21
|
+
P as H5,
|
|
22
|
+
R as H6,
|
|
23
|
+
y as Header,
|
|
24
|
+
U as Img,
|
|
25
|
+
u as Label,
|
|
26
|
+
T as Link,
|
|
27
|
+
F as Main,
|
|
28
|
+
M as Mark,
|
|
29
|
+
v as Menu,
|
|
30
|
+
b as Nav,
|
|
31
|
+
w as P,
|
|
32
|
+
A as Section,
|
|
33
|
+
d as Span,
|
|
34
|
+
L as Summary,
|
|
35
|
+
j as Time
|
|
34
36
|
};
|
package/components/textarea.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("react/jsx-runtime"),n=require("react"),
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),n=require("react"),s=require("../box.cjs"),c=require("../core.cjs"),u=["name","onInput","onChange","placeholder","value","defaultValue","rows","cols","autoFocus","maxLength","minLength","readOnly"];function l(t,a){const r=c.ObjectUtils.buildProps(t,u);return o.jsx(s.default,{ref:a,tag:"textarea",component:"textarea",...r})}const e=n.forwardRef(l);e.displayName="Textarea";module.exports=e;
|
package/components/textarea.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as r } from "react";
|
|
3
3
|
import n from "../box.mjs";
|
|
4
|
-
import { O as
|
|
5
|
-
const
|
|
4
|
+
import { O as m } from "../core.mjs";
|
|
5
|
+
const s = [
|
|
6
6
|
"name",
|
|
7
7
|
"onInput",
|
|
8
8
|
"onChange",
|
|
@@ -16,11 +16,12 @@ const m = [
|
|
|
16
16
|
"minLength",
|
|
17
17
|
"readOnly"
|
|
18
18
|
];
|
|
19
|
-
function p(
|
|
20
|
-
const
|
|
21
|
-
return /* @__PURE__ */
|
|
19
|
+
function p(e, t) {
|
|
20
|
+
const a = m.buildProps(e, s);
|
|
21
|
+
return /* @__PURE__ */ o(n, { ref: t, tag: "textarea", component: "textarea", ...a });
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const l = r(p);
|
|
24
|
+
l.displayName = "Textarea";
|
|
24
25
|
export {
|
|
25
|
-
|
|
26
|
+
l as default
|
|
26
27
|
};
|
package/components/textbox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),s=require("react"),u=require("../box.cjs"),a=require("../core.cjs"),c=["name","onInput","onChange","type","placeholder","defaultValue","autoFocus","readOnly","required","value","pattern"];function i(t,o){const r=a.ObjectUtils.buildProps(t,c);return n.jsx(u.default,{ref:o,tag:"input",component:"textbox",...r})}const e=s.forwardRef(i);e.displayName="Textbox";module.exports=e;
|
package/components/textbox.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
2
|
+
import { forwardRef as a } from "react";
|
|
3
|
+
import n from "../box.mjs";
|
|
4
4
|
import { O as p } from "../core.mjs";
|
|
5
|
-
const
|
|
5
|
+
const m = [
|
|
6
6
|
"name",
|
|
7
7
|
"onInput",
|
|
8
8
|
"onChange",
|
|
@@ -16,10 +16,11 @@ const u = [
|
|
|
16
16
|
"pattern"
|
|
17
17
|
];
|
|
18
18
|
function s(o, t) {
|
|
19
|
-
const e = p.buildProps(o,
|
|
20
|
-
return /* @__PURE__ */ r(
|
|
19
|
+
const e = p.buildProps(o, m);
|
|
20
|
+
return /* @__PURE__ */ r(n, { ref: t, tag: "input", component: "textbox", ...e });
|
|
21
21
|
}
|
|
22
|
-
const
|
|
22
|
+
const u = a(s);
|
|
23
|
+
u.displayName = "Textbox";
|
|
23
24
|
export {
|
|
24
|
-
|
|
25
|
+
u as default
|
|
25
26
|
};
|
package/components/tooltip.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("react/jsx-runtime"),C=require("react-dom"),d=require("../box.cjs"),s=require("react"),R=require("../core.cjs"),
|
|
1
|
+
"use strict";const i=require("react/jsx-runtime"),C=require("react-dom"),d=require("../box.cjs"),s=require("react"),R=require("../core.cjs"),c=2;function j(f,b){const{onPositionChange:a}=f,l=s.useRef(null),[t,h]=s.useState(),x=R.usePortalContainer(),g=s.useCallback((r,e)=>{const n=p=>{p.target.contains(r)&&e(r)},o=new AbortController;return document.addEventListener("scroll",n,{signal:o.signal,capture:!0}),()=>o.abort()},[t]),m=s.useCallback((r,e)=>{const n=p=>{e(r)},o=new AbortController;return window.addEventListener("resize",n,{signal:o.signal,capture:!0}),()=>o.abort()},[t]),u=s.useCallback(r=>{const e=r.getBoundingClientRect(),n=Math.round((e.top+window.scrollY)*c)/c,o=Math.round((e.left+window.scrollX)*c)/c;((t==null?void 0:t.top)!==n||(t==null?void 0:t.left)!==o)&&(a==null||a({top:n,left:o}),h({top:n,left:o,width:e.width>0?e.width:void 0}))},[t]);return s.useLayoutEffect(()=>{if(l.current){u(l.current);const r=g(l.current,u),e=m(l.current,u);return()=>{r(),e()}}},[t]),i.jsxs(i.Fragment,{children:[i.jsx(d.default,{ref:l}),t&&C.createPortal(i.jsx(d.default,{ref:b,position:"absolute",top:0,left:0,transition:"none",style:{transform:`translate(${t.left}px,${t.top}px)`,width:t.width},children:i.jsx(d.default,{position:"absolute",width:"fit",...f})}),x)]})}const w=s.forwardRef(j);w.displayName="Tooltip";module.exports=w;
|
package/components/tooltip.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ interface Props extends BoxProps {
|
|
|
5
5
|
left: number;
|
|
6
6
|
}): void;
|
|
7
7
|
}
|
|
8
|
-
declare const
|
|
9
|
-
export default
|
|
8
|
+
declare const Tooltip: import('react').ForwardRefExoticComponent<Omit<Props, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export default Tooltip;
|
package/components/tooltip.mjs
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import { jsxs as x, Fragment as C, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { createPortal as v } from "react-dom";
|
|
3
3
|
import u from "../box.mjs";
|
|
4
|
-
import { forwardRef as R, useRef as
|
|
5
|
-
import {
|
|
4
|
+
import { forwardRef as R, useRef as y, useState as z, useCallback as d, useLayoutEffect as A } from "react";
|
|
5
|
+
import { g as D } from "../core.mjs";
|
|
6
6
|
const i = 2;
|
|
7
|
-
function
|
|
8
|
-
const { onPositionChange: l } =
|
|
9
|
-
(
|
|
7
|
+
function E(f, m) {
|
|
8
|
+
const { onPositionChange: l } = f, s = y(null), [t, w] = z(), b = D(), g = d(
|
|
9
|
+
(r, o) => {
|
|
10
10
|
const n = (p) => {
|
|
11
|
-
p.target.contains(
|
|
12
|
-
},
|
|
13
|
-
return document.addEventListener("scroll", n, { signal:
|
|
11
|
+
p.target.contains(r) && o(r);
|
|
12
|
+
}, e = new AbortController();
|
|
13
|
+
return document.addEventListener("scroll", n, { signal: e.signal, capture: !0 }), () => e.abort();
|
|
14
14
|
},
|
|
15
15
|
[t]
|
|
16
|
-
),
|
|
17
|
-
(
|
|
16
|
+
), h = d(
|
|
17
|
+
(r, o) => {
|
|
18
18
|
const n = (p) => {
|
|
19
|
-
o(
|
|
20
|
-
},
|
|
21
|
-
return window.addEventListener("resize", n, { signal:
|
|
19
|
+
o(r);
|
|
20
|
+
}, e = new AbortController();
|
|
21
|
+
return window.addEventListener("resize", n, { signal: e.signal, capture: !0 }), () => e.abort();
|
|
22
22
|
},
|
|
23
23
|
[t]
|
|
24
|
-
), c =
|
|
25
|
-
(
|
|
26
|
-
const o =
|
|
27
|
-
((t == null ? void 0 : t.top) !== n || (t == null ? void 0 : t.left) !==
|
|
24
|
+
), c = d(
|
|
25
|
+
(r) => {
|
|
26
|
+
const o = r.getBoundingClientRect(), n = Math.round((o.top + window.scrollY) * i) / i, e = Math.round((o.left + window.scrollX) * i) / i;
|
|
27
|
+
((t == null ? void 0 : t.top) !== n || (t == null ? void 0 : t.left) !== e) && (l == null || l({ top: n, left: e }), w({ top: n, left: e, width: o.width > 0 ? o.width : void 0 }));
|
|
28
28
|
},
|
|
29
29
|
[t]
|
|
30
30
|
);
|
|
31
|
-
return
|
|
31
|
+
return A(() => {
|
|
32
32
|
if (s.current) {
|
|
33
33
|
c(s.current);
|
|
34
|
-
const
|
|
34
|
+
const r = g(s.current, c), o = h(s.current, c);
|
|
35
35
|
return () => {
|
|
36
|
-
|
|
36
|
+
r(), o();
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
}, [t]), /* @__PURE__ */ x(C, { children: [
|
|
@@ -42,20 +42,21 @@ function H(d, w) {
|
|
|
42
42
|
/* @__PURE__ */ a(
|
|
43
43
|
u,
|
|
44
44
|
{
|
|
45
|
-
ref:
|
|
45
|
+
ref: m,
|
|
46
46
|
position: "absolute",
|
|
47
47
|
top: 0,
|
|
48
48
|
left: 0,
|
|
49
49
|
transition: "none",
|
|
50
50
|
style: { transform: `translate(${t.left}px,${t.top}px)`, width: t.width },
|
|
51
|
-
children: /* @__PURE__ */ a(u, { position: "absolute", width: "fit", ...
|
|
51
|
+
children: /* @__PURE__ */ a(u, { position: "absolute", width: "fit", ...f })
|
|
52
52
|
}
|
|
53
53
|
),
|
|
54
54
|
b
|
|
55
55
|
)
|
|
56
56
|
] });
|
|
57
57
|
}
|
|
58
|
-
const
|
|
58
|
+
const H = R(E);
|
|
59
|
+
H.displayName = "Tooltip";
|
|
59
60
|
export {
|
|
60
|
-
|
|
61
|
+
H as default
|
|
61
62
|
};
|
package/core/boxStyles.d.ts
CHANGED
|
@@ -181,6 +181,10 @@ export declare const cssStyles: {
|
|
|
181
181
|
styleName: string;
|
|
182
182
|
values: readonly ["stretch", "flex-start", "flex-end", "center", "baseline", "start", "end", "self-start", "self-end"];
|
|
183
183
|
}[];
|
|
184
|
+
placeContent: {
|
|
185
|
+
styleName: string;
|
|
186
|
+
values: readonly ["start", "end", "flex-start", "flex-end", "center", "space-between", "space-around", "space-evenly", "stretch"];
|
|
187
|
+
}[];
|
|
184
188
|
/** The CSS align-content property sets the distribution of space between and around content items along a flexbox's cross axis, or a grid or block-level element's block axis. */
|
|
185
189
|
alignContent: {
|
|
186
190
|
styleName: string;
|