@cronocode/react-box 3.0.12 → 3.0.14
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 +8 -7
- package/array.d.ts +13 -0
- package/box.cjs +1 -1
- package/box.d.ts +8 -9
- package/box.mjs +16 -16
- package/components/button.d.ts +7 -6
- package/components/checkbox.d.ts +5 -3
- package/components/checkbox.mjs +4 -4
- package/components/dataGrid/contracts/dataGridContract.d.ts +36 -0
- package/components/dataGrid/dataGridCell.d.ts +8 -0
- package/components/dataGrid/dataGridGroupRow.d.ts +6 -0
- package/components/dataGrid/dataGridHeaderCell.d.ts +6 -0
- package/components/dataGrid/dataGridPagination.d.ts +6 -0
- package/components/dataGrid/dataGridRow.d.ts +6 -0
- package/components/dataGrid/models/cellModel.d.ts +10 -0
- package/components/dataGrid/models/columnModel.d.ts +36 -0
- package/components/dataGrid/models/gridModel.d.ts +44 -0
- package/components/dataGrid/models/groupRowCellModel.d.ts +10 -0
- package/components/dataGrid/models/groupRowModel.d.ts +23 -0
- package/components/dataGrid/models/rowModel.d.ts +16 -0
- package/components/dataGrid/useGrid.d.ts +3 -0
- package/components/dataGrid.cjs +1 -1
- package/components/dataGrid.d.ts +2 -7
- package/components/dataGrid.mjs +656 -18
- package/components/dropdown.cjs +1 -1
- package/components/dropdown.d.ts +2 -2
- package/components/dropdown.mjs +63 -62
- package/components/flex.d.ts +2 -1
- package/components/form.cjs +1 -1
- package/components/form.mjs +11 -8
- package/components/grid.d.ts +2 -1
- package/components/radioButton.cjs +1 -1
- package/components/radioButton.d.ts +7 -6
- package/components/radioButton.mjs +9 -9
- package/components/semantics.cjs +1 -1
- package/components/semantics.d.ts +27 -25
- package/components/semantics.mjs +26 -25
- package/components/textarea.d.ts +7 -6
- package/components/textbox.d.ts +7 -6
- package/components/tooltip.cjs +1 -1
- package/components/tooltip.d.ts +1 -1
- package/components/tooltip.mjs +20 -22
- package/core/boxConstants.d.ts +1 -0
- package/core/boxStyles.d.ts +112 -37
- package/core/boxStylesFormatters.d.ts +1 -1
- package/core/classNames.d.ts +1 -1
- package/core/extends/boxComponents.d.ts +391 -0
- package/core/{boxExtends.d.ts → extends/boxExtends.d.ts} +4 -1
- package/core/extends/useComponents.d.ts +2 -0
- package/core/theme/theme.d.ts +1 -3
- package/core/theme/themeContext.d.ts +2 -4
- package/core/useStyles.d.ts +2 -2
- package/core/variables.d.ts +1 -0
- package/core.cjs +4 -4
- package/core.mjs +634 -511
- package/hooks/useVisibility.d.ts +9 -1
- package/icons/arrowIcon.d.ts +2 -0
- package/icons/dotsIcon.d.ts +2 -0
- package/icons/groupingIcon.d.ts +2 -0
- package/icons/pinIcon.d.ts +2 -0
- package/package.json +1 -1
- package/types.d.ts +35 -6
- package/utils/fn/fnUtils.d.ts +4 -0
- package/utils/memo.d.ts +5 -0
- package/utils/object/objectUtils.d.ts +1 -1
- package/components/dataGrid/dataGridContract.d.ts +0 -24
- package/components/dataGrid/useGridData.d.ts +0 -7
- package/components/label.cjs +0 -1
- package/components/label.d.ts +0 -5
- package/components/label.mjs +0 -10
- package/core/theme/defaultTheme.d.ts +0 -3
- package/core/theme/themeContract.d.ts +0 -25
- package/core/theme/useTheme.d.ts +0 -2
package/components/dropdown.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const r=require("react/jsx-runtime"),n=require("react"),h=require("../box.cjs"),L=require("./textbox.cjs"),G=require("./flex.cjs"),Q=require("../core.cjs"),X=require("./baseSvg.cjs"),Z=require("./tooltip.cjs"),K=require("./button.cjs");function ee(i,m){const{name:p,defaultValue:g,value:y,multiple:u,isSearchable:w,searchPlaceholder:B,children:
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),n=require("react"),h=require("../box.cjs"),L=require("./textbox.cjs"),G=require("./flex.cjs"),Q=require("../core.cjs"),X=require("./baseSvg.cjs"),Z=require("./tooltip.cjs"),K=require("./button.cjs");function ee(i,m){const{name:p,defaultValue:g,value:y,multiple:u,isSearchable:w,searchPlaceholder:B,children:D,hideIcon:H,onChange:s,...Y}=i,[J,j]=n.useState(Array.isArray(g)?g:g?[g]:[]),c="value"in i?Array.isArray(y)?y:y?[y]:[]:J,[I,U]=n.useState(""),[a,T,b]=Q.useVisibility(),N=n.useRef(null),V=n.useRef(null),[_,F]=n.useState(0),A=n.useMemo(()=>_>window.innerHeight/2,[_]),W=n.useMemo(()=>{var e;return A?((e=b.current)==null?void 0:e.getBoundingClientRect().height)??0:0},[A,b]),l=n.useMemo(()=>(Array.isArray(D)?D:[D]).flatMap(e=>e),[D]),O=n.useMemo(()=>l.filter(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownItem"}),[l]),f=n.useMemo(()=>O.filter(e=>w&&I?R(e).toLowerCase().includes(I.toLowerCase()):!0),[w,I,l]),x=n.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownUnselect"}),[l]),C=n.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownSelectAll"}),[l]),k=n.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownEmptyItem"}),[l]),M=n.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownDisplay"}),[l]),$=n.useMemo(()=>{if(M)return typeof M.props.children=="function"?M.props.children(c,a):M.props.children;const e=f.filter(o=>c.includes(o.props.value));if(u&&e.length>1)return e.map(o=>R(o)).join(", ");const t=e.at(0);return(t==null?void 0:t.props.children)??(t==null?void 0:t.props.value)??(u?null:x==null?void 0:x.props.children)},[u,f,c,x,a]),P=n.useCallback((e,...t)=>{if(t.length===0)j([]),s==null||s(void 0,[]);else if(u&&t.length>1){const o=t.map(d=>d.props.value);j(o),s==null||s(void 0,o)}else if(t.length===1){const o=t[0];if(u){const d=c.filter(q=>q!==o.props.value);d.length===c.length&&d.push(o.props.value),j(d),s==null||s(o.props.value,d)}else j([o.props.value]),s==null||s(o.props.value,[o.props.value])}u?(e.stopPropagation(),setTimeout(()=>{var o;return(o=N.current)==null?void 0:o.focus()},0)):(T(!1),setTimeout(()=>{var o;return(o=b.current)==null?void 0:o.focus()},0))},[u,c,j]);n.useEffect(()=>{a?setTimeout(()=>{var e,t,o;(e=N.current)==null||e.focus(),(o=(t=V.current)==null?void 0:t.querySelector('[aria-selected="true"]'))==null||o.scrollIntoView({block:"nearest"})},0):U("")},[a]);const E=C&&u&&f.length>c.length,z=x&&f.length>0&&!E;return r.jsxs(h,{width:"fit-content",children:[c.map(e=>r.jsx(L,{ref:m,name:p,type:"hidden",value:JSON.stringify(e)??""},JSON.stringify(e))),r.jsxs(K,{ref:b,type:"button",component:"dropdown",onClick:()=>T(e=>!e),props:{tabIndex:0},...Y,children:[w&&r.jsx(L,{display:a&&w?"block":"none",clean:!0,flex1:!0,width:1,minHeight:5,placeholder:B,value:I,onChange:e=>U(e.target.value),ref:N,props:{onClick:e=>{a&&w&&e.stopPropagation()}}}),r.jsx(G,{component:"dropdown.display",display:a&&w?"none":"flex",children:$??r.jsx(r.Fragment,{children:" "})}),!H&&r.jsx(h,{children:r.jsx(X,{viewBox:"0 0 10 6",width:"0.6rem",rotate:a?180:0,children:r.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 4 4 4-4"})})})]}),a&&r.jsx(Z,{ref:V,top:A?void 0:0,bottom:A?2:void 0,style:{transform:`translateY(-${W}px)`},onPositionChange:e=>F(e.top-window.scrollY),children:(f.length>0||k)&&r.jsxs(h,{component:"dropdown.items",children:[z&&r.jsx(h,{component:"dropdown.unselect",selected:c.length===0,...x.props,props:{onClick:e=>P(e)}}),E&&r.jsx(h,{component:"dropdown.selectAll",...C.props,props:{onClick:e=>P(e,...O)}}),f.map(e=>{const{value:t,onClick:o,...d}=e.props;return r.jsx(h,{component:"dropdown.item",variant:u?"multiple":void 0,selected:c.includes(t),...d,props:{onClick:q=>{o==null||o(q),P(q,e)}}},t)}),f.length===0&&k&&r.jsx(h,{component:"dropdown.emptyItem",...k.props})]})})]})}function S(i){const m=p=>null;return m.displayName=i,m}const v=n.forwardRef(ee);v.Item=S("DropdownItem");v.Unselect=S("DropdownUnselect");v.SelectAll=S("DropdownSelectAll");v.EmptyItem=S("DropdownEmptyItem");v.Display=S("DropdownDisplay");function R(i){var m;if(i==null)return"";if(typeof i=="object"){const p=(m=i.props)==null?void 0:m.children;return p==null?"":typeof p=="object"?(Array.isArray(p)?p:[p]).map(y=>R(y)).join(""):p.toString()}return i.toString()}module.exports=v;
|
package/components/dropdown.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ interface Props<TVal> extends BoxProps<'button'> {
|
|
|
7
7
|
multiple?: boolean;
|
|
8
8
|
isSearchable?: boolean;
|
|
9
9
|
searchPlaceholder?: string;
|
|
10
|
-
|
|
10
|
+
hideIcon?: boolean;
|
|
11
11
|
onChange?: (value: Maybe<TVal>, values: TVal[]) => void;
|
|
12
12
|
}
|
|
13
13
|
interface DropdownItemProps<TVal> extends BoxProps {
|
|
@@ -15,7 +15,7 @@ interface DropdownItemProps<TVal> extends BoxProps {
|
|
|
15
15
|
onClick?(e: React.MouseEvent): void;
|
|
16
16
|
}
|
|
17
17
|
interface DropdownDisplayProps<TVal> extends Omit<BoxProps, 'children'> {
|
|
18
|
-
children: (selectedValues: TVal[], isOpen: boolean) => React.ReactNode;
|
|
18
|
+
children: ((selectedValues: TVal[], isOpen: boolean) => React.ReactNode) | React.ReactNode;
|
|
19
19
|
}
|
|
20
20
|
interface DropdownType {
|
|
21
21
|
<TVal>(props: Props<TVal>, ref: Ref<HTMLInputElement>): React.ReactNode;
|
package/components/dropdown.mjs
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as B, jsx as n, Fragment as Z } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as K, useState as V, useRef as J, useMemo as c, useCallback as ee, useEffect as te } from "react";
|
|
3
3
|
import h from "../box.mjs";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { b as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
function
|
|
11
|
-
const { name: p, defaultValue: g, value: y, multiple: a, isSearchable: w, searchPlaceholder:
|
|
4
|
+
import M from "./textbox.mjs";
|
|
5
|
+
import oe from "./flex.mjs";
|
|
6
|
+
import { b as re } from "../core.mjs";
|
|
7
|
+
import ne from "./baseSvg.mjs";
|
|
8
|
+
import le from "./tooltip.mjs";
|
|
9
|
+
import se from "./button.mjs";
|
|
10
|
+
function pe(s, m) {
|
|
11
|
+
const { name: p, defaultValue: g, value: y, multiple: a, isSearchable: w, searchPlaceholder: q, children: S, hideIcon: W, onChange: r, ..._ } = s, [$, x] = V(Array.isArray(g) ? g : g ? [g] : []), i = "value" in s ? Array.isArray(y) ? y : y ? [y] : [] : $, [A, R] = V(""), [d, C, b] = re(), T = J(null), E = J(null), [L, z] = V(0), N = c(() => L > window.innerHeight / 2, [L]), G = c(() => {
|
|
12
12
|
var e;
|
|
13
13
|
return N ? ((e = b.current) == null ? void 0 : e.getBoundingClientRect().height) ?? 0 : 0;
|
|
14
|
-
}, [N, b]),
|
|
14
|
+
}, [N, b]), l = c(
|
|
15
15
|
() => (Array.isArray(S) ? S : [S]).flatMap((e) => e),
|
|
16
16
|
[S]
|
|
17
|
-
),
|
|
17
|
+
), H = c(() => l.filter((e) => {
|
|
18
18
|
var t;
|
|
19
19
|
return ((t = e.type) == null ? void 0 : t.displayName) === "DropdownItem";
|
|
20
|
-
}), [
|
|
20
|
+
}), [l]), f = c(() => H.filter((e) => w && A ? O(e).toLowerCase().includes(A.toLowerCase()) : !0), [w, A, l]), v = c(() => l.find((e) => {
|
|
21
21
|
var t;
|
|
22
22
|
return ((t = e.type) == null ? void 0 : t.displayName) === "DropdownUnselect";
|
|
23
|
-
}), [
|
|
23
|
+
}), [l]), Y = c(() => l.find((e) => {
|
|
24
24
|
var t;
|
|
25
25
|
return ((t = e.type) == null ? void 0 : t.displayName) === "DropdownSelectAll";
|
|
26
|
-
}), [
|
|
26
|
+
}), [l]), j = c(() => l.find((e) => {
|
|
27
27
|
var t;
|
|
28
28
|
return ((t = e.type) == null ? void 0 : t.displayName) === "DropdownEmptyItem";
|
|
29
|
-
}), [
|
|
29
|
+
}), [l]), k = c(() => l.find((e) => {
|
|
30
30
|
var t;
|
|
31
31
|
return ((t = e.type) == null ? void 0 : t.displayName) === "DropdownDisplay";
|
|
32
|
-
}), [
|
|
33
|
-
if (
|
|
32
|
+
}), [l]), Q = c(() => {
|
|
33
|
+
if (k)
|
|
34
|
+
return typeof k.props.children == "function" ? k.props.children(i, d) : k.props.children;
|
|
34
35
|
const e = f.filter((o) => i.includes(o.props.value));
|
|
35
36
|
if (a && e.length > 1)
|
|
36
|
-
return e.map((o) =>
|
|
37
|
+
return e.map((o) => O(o)).join(", ");
|
|
37
38
|
const t = e.at(0);
|
|
38
39
|
return (t == null ? void 0 : t.props.children) ?? (t == null ? void 0 : t.props.value) ?? (a ? null : v == null ? void 0 : v.props.children);
|
|
39
|
-
}, [a, f, i, v, d]),
|
|
40
|
+
}, [a, f, i, v, d]), U = ee(
|
|
40
41
|
(e, ...t) => {
|
|
41
42
|
if (t.length === 0)
|
|
42
43
|
x([]), r == null || r(void 0, []);
|
|
@@ -46,52 +47,52 @@ function se(s, m) {
|
|
|
46
47
|
} else if (t.length === 1) {
|
|
47
48
|
const o = t[0];
|
|
48
49
|
if (a) {
|
|
49
|
-
const u = i.filter((
|
|
50
|
+
const u = i.filter((P) => P !== o.props.value);
|
|
50
51
|
u.length === i.length && u.push(o.props.value), x(u), r == null || r(o.props.value, u);
|
|
51
52
|
} else
|
|
52
53
|
x([o.props.value]), r == null || r(o.props.value, [o.props.value]);
|
|
53
54
|
}
|
|
54
55
|
a ? (e.stopPropagation(), setTimeout(() => {
|
|
55
56
|
var o;
|
|
56
|
-
return (o =
|
|
57
|
-
}, 0)) : (
|
|
57
|
+
return (o = T.current) == null ? void 0 : o.focus();
|
|
58
|
+
}, 0)) : (C(!1), setTimeout(() => {
|
|
58
59
|
var o;
|
|
59
60
|
return (o = b.current) == null ? void 0 : o.focus();
|
|
60
61
|
}, 0));
|
|
61
62
|
},
|
|
62
63
|
[a, i, x]
|
|
63
64
|
);
|
|
64
|
-
|
|
65
|
+
te(() => {
|
|
65
66
|
d ? setTimeout(() => {
|
|
66
67
|
var e, t, o;
|
|
67
|
-
(e =
|
|
68
|
-
}, 0) :
|
|
68
|
+
(e = T.current) == null || e.focus(), (o = (t = E.current) == null ? void 0 : t.querySelector('[aria-selected="true"]')) == null || o.scrollIntoView({ block: "nearest" });
|
|
69
|
+
}, 0) : R("");
|
|
69
70
|
}, [d]);
|
|
70
|
-
const
|
|
71
|
-
return /* @__PURE__ */
|
|
72
|
-
i.map((e) => /* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
71
|
+
const F = Y && a && f.length > i.length, X = v && f.length > 0 && !F;
|
|
72
|
+
return /* @__PURE__ */ B(h, { width: "fit-content", children: [
|
|
73
|
+
i.map((e) => /* @__PURE__ */ n(M, { ref: m, name: p, type: "hidden", value: JSON.stringify(e) ?? "" }, JSON.stringify(e))),
|
|
74
|
+
/* @__PURE__ */ B(
|
|
75
|
+
se,
|
|
75
76
|
{
|
|
76
77
|
ref: b,
|
|
77
78
|
type: "button",
|
|
78
79
|
component: "dropdown",
|
|
79
|
-
onClick: () =>
|
|
80
|
+
onClick: () => C((e) => !e),
|
|
80
81
|
props: { tabIndex: 0 },
|
|
81
82
|
..._,
|
|
82
83
|
children: [
|
|
83
|
-
w && /* @__PURE__ */
|
|
84
|
-
|
|
84
|
+
w && /* @__PURE__ */ n(
|
|
85
|
+
M,
|
|
85
86
|
{
|
|
86
87
|
display: d && w ? "block" : "none",
|
|
87
88
|
clean: !0,
|
|
88
89
|
flex1: !0,
|
|
89
90
|
width: 1,
|
|
90
91
|
minHeight: 5,
|
|
91
|
-
placeholder:
|
|
92
|
-
value:
|
|
93
|
-
onChange: (e) =>
|
|
94
|
-
ref:
|
|
92
|
+
placeholder: q,
|
|
93
|
+
value: A,
|
|
94
|
+
onChange: (e) => R(e.target.value),
|
|
95
|
+
ref: T,
|
|
95
96
|
props: {
|
|
96
97
|
onClick: (e) => {
|
|
97
98
|
d && w && e.stopPropagation();
|
|
@@ -99,73 +100,73 @@ function se(s, m) {
|
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
!W && /* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ n(oe, { component: "dropdown.display", display: d && w ? "none" : "flex", children: Q ?? /* @__PURE__ */ n(Z, { children: " " }) }),
|
|
104
|
+
!W && /* @__PURE__ */ n(h, { children: /* @__PURE__ */ n(ne, { viewBox: "0 0 10 6", width: "0.6rem", rotate: d ? 180 : 0, children: /* @__PURE__ */ n("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m1 1 4 4 4-4" }) }) })
|
|
104
105
|
]
|
|
105
106
|
}
|
|
106
107
|
),
|
|
107
|
-
d && /* @__PURE__ */
|
|
108
|
-
|
|
108
|
+
d && /* @__PURE__ */ n(
|
|
109
|
+
le,
|
|
109
110
|
{
|
|
110
|
-
ref:
|
|
111
|
+
ref: E,
|
|
111
112
|
top: N ? void 0 : 0,
|
|
112
113
|
bottom: N ? 2 : void 0,
|
|
113
114
|
style: { transform: `translateY(-${G}px)` },
|
|
114
115
|
onPositionChange: (e) => z(e.top - window.scrollY),
|
|
115
|
-
children: (f.length > 0 ||
|
|
116
|
-
X && /* @__PURE__ */
|
|
116
|
+
children: (f.length > 0 || j) && /* @__PURE__ */ B(h, { component: "dropdown.items", children: [
|
|
117
|
+
X && /* @__PURE__ */ n(
|
|
117
118
|
h,
|
|
118
119
|
{
|
|
119
120
|
component: "dropdown.unselect",
|
|
120
121
|
selected: i.length === 0,
|
|
121
122
|
...v.props,
|
|
122
|
-
props: { onClick: (e) =>
|
|
123
|
+
props: { onClick: (e) => U(e) }
|
|
123
124
|
}
|
|
124
125
|
),
|
|
125
|
-
|
|
126
|
+
F && /* @__PURE__ */ n(h, { component: "dropdown.selectAll", ...Y.props, props: { onClick: (e) => U(e, ...H) } }),
|
|
126
127
|
f.map((e) => {
|
|
127
128
|
const { value: t, onClick: o, ...u } = e.props;
|
|
128
|
-
return /* @__PURE__ */
|
|
129
|
+
return /* @__PURE__ */ n(
|
|
129
130
|
h,
|
|
130
131
|
{
|
|
131
132
|
component: "dropdown.item",
|
|
132
|
-
|
|
133
|
+
variant: a ? "multiple" : void 0,
|
|
133
134
|
selected: i.includes(t),
|
|
134
135
|
...u,
|
|
135
136
|
props: {
|
|
136
|
-
onClick: (
|
|
137
|
-
o == null || o(
|
|
137
|
+
onClick: (P) => {
|
|
138
|
+
o == null || o(P), U(P, e);
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
},
|
|
141
142
|
t
|
|
142
143
|
);
|
|
143
144
|
}),
|
|
144
|
-
f.length === 0 &&
|
|
145
|
+
f.length === 0 && j && /* @__PURE__ */ n(h, { component: "dropdown.emptyItem", ...j.props })
|
|
145
146
|
] })
|
|
146
147
|
}
|
|
147
148
|
)
|
|
148
149
|
] });
|
|
149
150
|
}
|
|
150
|
-
function
|
|
151
|
+
function D(s) {
|
|
151
152
|
const m = (p) => null;
|
|
152
153
|
return m.displayName = s, m;
|
|
153
154
|
}
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
function
|
|
155
|
+
const I = K(pe);
|
|
156
|
+
I.Item = D("DropdownItem");
|
|
157
|
+
I.Unselect = D("DropdownUnselect");
|
|
158
|
+
I.SelectAll = D("DropdownSelectAll");
|
|
159
|
+
I.EmptyItem = D("DropdownEmptyItem");
|
|
160
|
+
I.Display = D("DropdownDisplay");
|
|
161
|
+
function O(s) {
|
|
161
162
|
var m;
|
|
162
163
|
if (s == null) return "";
|
|
163
164
|
if (typeof s == "object") {
|
|
164
165
|
const p = (m = s.props) == null ? void 0 : m.children;
|
|
165
|
-
return p == null ? "" : typeof p == "object" ? (Array.isArray(p) ? p : [p]).map((y) =>
|
|
166
|
+
return p == null ? "" : typeof p == "object" ? (Array.isArray(p) ? p : [p]).map((y) => O(y)).join("") : p.toString();
|
|
166
167
|
}
|
|
167
168
|
return s.toString();
|
|
168
169
|
}
|
|
169
170
|
export {
|
|
170
|
-
|
|
171
|
+
I as default
|
|
171
172
|
};
|
package/components/flex.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RefAttributes } from 'react';
|
|
2
2
|
import { BoxProps } from '../box';
|
|
3
3
|
import { ExtractElementFromTag } from '../core/coreTypes';
|
|
4
|
-
|
|
4
|
+
import { ComponentsAndVariants } from '../types';
|
|
5
|
+
declare const _default: <TTag extends keyof React.JSX.IntrinsicElements = "div", TKey extends keyof ComponentsAndVariants = never>(props: BoxProps<TTag, TKey> & RefAttributes<ExtractElementFromTag<TTag>>) => React.ReactNode;
|
|
5
6
|
export default _default;
|
package/components/form.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const m=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const m=require("react/jsx-runtime"),n=require("react"),a=require("../box.cjs"),f=require("../core.cjs");function l(r){const{onSubmit:t,props:s}=r,e=n.useRef(null),u=n.useCallback(o=>{o.preventDefault();const i=f.FormUtils.getFormEntries(e.current);t(i,o)},[t]),c={...s,onSubmit:u,ref:e};return m.jsx(a,{tag:"form",...r,props:c})}module.exports=l;
|
package/components/form.mjs
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { jsx as u } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as a, useCallback as i } from "react";
|
|
3
3
|
import p from "../box.mjs";
|
|
4
|
-
import {
|
|
5
|
-
function
|
|
6
|
-
const { onSubmit:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import { e as c } from "../core.mjs";
|
|
5
|
+
function F(o) {
|
|
6
|
+
const { onSubmit: r, props: e } = o, t = a(null), n = i(
|
|
7
|
+
(m) => {
|
|
8
|
+
m.preventDefault();
|
|
9
|
+
const f = c.getFormEntries(t.current);
|
|
10
|
+
r(f, m);
|
|
11
|
+
},
|
|
12
|
+
[r]
|
|
13
|
+
), s = { ...e, onSubmit: n, ref: t };
|
|
11
14
|
return /* @__PURE__ */ u(p, { tag: "form", ...o, props: s });
|
|
12
15
|
}
|
|
13
16
|
export {
|
|
14
|
-
|
|
17
|
+
F as default
|
|
15
18
|
};
|
package/components/grid.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RefAttributes } from 'react';
|
|
2
2
|
import { BoxProps } from '../box';
|
|
3
3
|
import { ExtractElementFromTag } from '../core/coreTypes';
|
|
4
|
-
|
|
4
|
+
import { ComponentsAndVariants } from '../types';
|
|
5
|
+
declare const _default: <TTag extends keyof React.JSX.IntrinsicElements = "div", TKey extends keyof ComponentsAndVariants = never>(props: BoxProps<TTag, TKey> & RefAttributes<ExtractElementFromTag<TTag>>) => React.ReactNode;
|
|
5
6
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),n=require("react"),r=require("../box.cjs"),u=require("../core.cjs"),s=["name","onInput","onChange","value","autoFocus","readOnly","defaultChecked"];function c(t,i){const o=u.ObjectUtils.buildProps(t,s,{type:"radio"});return e.jsx(r,{tag:"input",component:"radioButton",...o})}const a=n.forwardRef(c);module.exports=a;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { RefAttributes } from 'react';
|
|
2
|
+
import { BoxProps, BoxTagProps } from '../box';
|
|
3
|
+
import { ComponentsAndVariants } from '../types';
|
|
4
4
|
declare const tagProps: readonly ["name", "onInput", "onChange", "value", "autoFocus", "readOnly", "defaultChecked"];
|
|
5
5
|
type TagPropsType = (typeof tagProps)[number];
|
|
6
|
-
type
|
|
7
|
-
|
|
6
|
+
type RadioButtonProps<TKey extends keyof ComponentsAndVariants> = Omit<BoxProps<'input', TKey>, 'tag' | 'props'>;
|
|
7
|
+
type RadioButtonTagProps = Omit<BoxTagProps<'input'>, TagPropsType | 'type'>;
|
|
8
|
+
interface Props<TKey extends keyof ComponentsAndVariants> extends RadioButtonProps<TKey> {
|
|
8
9
|
name?: string;
|
|
9
10
|
props?: RadioButtonTagProps;
|
|
10
11
|
onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -14,5 +15,5 @@ interface Props extends Omit<RadioButtonProps, 'props'> {
|
|
|
14
15
|
readOnly?: boolean;
|
|
15
16
|
defaultChecked?: boolean;
|
|
16
17
|
}
|
|
17
|
-
declare const _default:
|
|
18
|
+
declare const _default: <TKey extends keyof ComponentsAndVariants = "radioButton">(props: Props<TKey> & RefAttributes<HTMLInputElement>) => React.ReactNode;
|
|
18
19
|
export default _default;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import { O as
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
return /* @__PURE__ */
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as n } from "react";
|
|
3
|
+
import a from "../box.mjs";
|
|
4
|
+
import { O as e } from "../core.mjs";
|
|
5
|
+
const u = ["name", "onInput", "onChange", "value", "autoFocus", "readOnly", "defaultChecked"];
|
|
6
|
+
function i(o, p) {
|
|
7
|
+
const t = e.buildProps(o, u, { type: "radio" });
|
|
8
|
+
return /* @__PURE__ */ r(a, { tag: "input", component: "radioButton", ...t });
|
|
9
9
|
}
|
|
10
|
-
const c =
|
|
10
|
+
const c = n(i);
|
|
11
11
|
export {
|
|
12
12
|
c as default
|
|
13
13
|
};
|
package/components/semantics.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),s=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),s=require("react"),a=require("../box.cjs");function n(t,e){return s.forwardRef((o,i)=>c.jsx(a,{tag:t,ref:i,component:t,...e,...o}))}const r=n("label"),u=n("span",{inline:!0}),m=n("article"),l=n("aside"),H=n("details"),S=n("figcaption"),f=n("figure"),g=n("footer"),d=n("header"),p=n("main"),h=n("mark"),M=n("nav"),b=n("menu"),z=n("section"),F=n("summary"),k=n("time"),y=n("p"),v=n("h1",{fontSize:14*2.5}),A=n("h2",{fontSize:14*2}),L=n("h3",{fontSize:14*1.75}),j=n("h4",{fontSize:14*1.5}),q=n("h5",{fontSize:14*1.25}),x=n("h6",{fontSize:14*1}),P=n("a"),R=n("img");exports.Article=m;exports.Aside=l;exports.Details=H;exports.Figcaption=S;exports.Figure=f;exports.Footer=g;exports.H1=v;exports.H2=A;exports.H3=L;exports.H4=j;exports.H5=q;exports.H6=x;exports.Header=d;exports.Img=R;exports.Label=r;exports.Link=P;exports.Main=p;exports.Mark=h;exports.Menu=b;exports.Nav=M;exports.P=y;exports.Section=z;exports.Span=u;exports.Summary=F;exports.Time=k;
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import { RefAttributes } from 'react';
|
|
2
2
|
import { BoxProps } from '../box';
|
|
3
3
|
import { ExtractElementFromTag } from '../core/coreTypes';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const
|
|
24
|
-
export declare const
|
|
25
|
-
export declare const
|
|
26
|
-
export declare const
|
|
27
|
-
export declare const
|
|
28
|
-
export declare const
|
|
4
|
+
import { ComponentsAndVariants } from '../types';
|
|
5
|
+
type SemanticComponentType<TTag extends keyof React.JSX.IntrinsicElements, TKey extends keyof ComponentsAndVariants = never> = (props: Omit<BoxProps<TTag, TKey>, 'tag'> & RefAttributes<ExtractElementFromTag<TTag>>) => React.ReactNode;
|
|
6
|
+
export declare const Label: SemanticComponentType<"label", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
7
|
+
export declare const Span: SemanticComponentType<"span", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
8
|
+
export declare const Article: SemanticComponentType<"article", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
9
|
+
export declare const Aside: SemanticComponentType<"aside", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
10
|
+
export declare const Details: SemanticComponentType<"details", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
11
|
+
export declare const Figcaption: SemanticComponentType<"figcaption", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
12
|
+
export declare const Figure: SemanticComponentType<"figure", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
13
|
+
export declare const Footer: SemanticComponentType<"footer", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
14
|
+
export declare const Header: SemanticComponentType<"header", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
15
|
+
export declare const Main: SemanticComponentType<"main", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
16
|
+
export declare const Mark: SemanticComponentType<"mark", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
17
|
+
export declare const Nav: SemanticComponentType<"nav", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
18
|
+
export declare const Menu: SemanticComponentType<"menu", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
19
|
+
export declare const Section: SemanticComponentType<"section", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
20
|
+
export declare const Summary: SemanticComponentType<"summary", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
21
|
+
export declare const Time: SemanticComponentType<"time", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
22
|
+
export declare const P: SemanticComponentType<"p", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
23
|
+
export declare const H1: SemanticComponentType<"h1", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
24
|
+
export declare const H2: SemanticComponentType<"h2", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
25
|
+
export declare const H3: SemanticComponentType<"h3", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
26
|
+
export declare const H4: SemanticComponentType<"h4", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
27
|
+
export declare const H5: SemanticComponentType<"h5", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
28
|
+
export declare const H6: SemanticComponentType<"h6", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
29
|
+
export declare const Link: SemanticComponentType<"a", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
30
|
+
export declare const Img: SemanticComponentType<"img", "button" | "label" | "textarea" | "checkbox" | "textbox" | "radioButton" | "dropdown" | "datagrid" | "dropdown.display" | "dropdown.items" | "dropdown.item" | "dropdown.unselect" | "dropdown.selectAll" | "dropdown.emptyItem" | "datagrid.header" | "datagrid.header.cell" | "datagrid.cell">;
|
|
29
31
|
export {};
|
package/components/semantics.mjs
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as i } from "react";
|
|
3
3
|
import r from "../box.mjs";
|
|
4
|
-
function o
|
|
5
|
-
return i((c, e) => /* @__PURE__ */ s(r, { tag:
|
|
4
|
+
function n(o, t) {
|
|
5
|
+
return i((c, e) => /* @__PURE__ */ s(r, { tag: o, ref: e, component: o, ...t, ...c }));
|
|
6
6
|
}
|
|
7
|
-
const p =
|
|
7
|
+
const p = n("label"), u = n("span", { inline: !0 }), S = n("article"), l = n("aside"), h = n("details"), H = n("figcaption"), d = n("figure"), g = n("footer"), z = n("header"), k = n("main"), x = n("mark"), F = n("nav"), M = n("menu"), b = n("section"), v = n("summary"), y = n("time"), A = n("p"), L = n("h1", { fontSize: 14 * 2.5 }), j = n("h2", { fontSize: 14 * 2 }), w = n("h3", { fontSize: 14 * 1.75 }), B = n("h4", { fontSize: 14 * 1.5 }), D = n("h5", { fontSize: 14 * 1.25 }), I = n("h6", { fontSize: 14 * 1 }), P = n("a"), R = n("img");
|
|
8
8
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
S as Article,
|
|
10
|
+
l as Aside,
|
|
11
11
|
h as Details,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
H as Figcaption,
|
|
13
|
+
d as Figure,
|
|
14
|
+
g as Footer,
|
|
15
|
+
L as H1,
|
|
16
|
+
j as H2,
|
|
17
|
+
w as H3,
|
|
18
|
+
B as H4,
|
|
19
|
+
D as H5,
|
|
20
|
+
I as H6,
|
|
21
|
+
z as Header,
|
|
22
|
+
R as Img,
|
|
23
23
|
p as Label,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
v as
|
|
24
|
+
P as Link,
|
|
25
|
+
k as Main,
|
|
26
|
+
x as Mark,
|
|
27
|
+
M as Menu,
|
|
28
|
+
F as Nav,
|
|
29
|
+
A as P,
|
|
30
|
+
b as Section,
|
|
31
|
+
u as Span,
|
|
32
|
+
v as Summary,
|
|
33
|
+
y as Time
|
|
33
34
|
};
|
package/components/textarea.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { RefAttributes } from 'react';
|
|
2
|
+
import { BoxProps, BoxTagProps } from '../box';
|
|
3
|
+
import { ComponentsAndVariants } from '../types';
|
|
4
4
|
declare const tagProps: readonly ["name", "onInput", "onChange", "placeholder", "value", "defaultValue", "rows", "cols", "autoFocus", "maxLength", "minLength", "readOnly"];
|
|
5
5
|
type TagPropsType = (typeof tagProps)[number];
|
|
6
|
-
type
|
|
7
|
-
|
|
6
|
+
type TextareaProps<TKey extends keyof ComponentsAndVariants> = Omit<BoxProps<'textarea', TKey>, 'tag' | 'props'>;
|
|
7
|
+
type TextareaTagProps = Omit<BoxTagProps<'textarea'>, TagPropsType | 'type'>;
|
|
8
|
+
interface Props<TKey extends keyof ComponentsAndVariants> extends TextareaProps<TKey> {
|
|
8
9
|
name?: string;
|
|
9
10
|
props?: TextareaTagProps;
|
|
10
11
|
onInput?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
@@ -20,5 +21,5 @@ interface Props extends Omit<TextareaProps, 'props'> {
|
|
|
20
21
|
readOnly?: boolean;
|
|
21
22
|
required?: boolean;
|
|
22
23
|
}
|
|
23
|
-
declare const _default:
|
|
24
|
+
declare const _default: <TKey extends keyof ComponentsAndVariants = "textarea">(props: Props<TKey> & RefAttributes<HTMLTextAreaElement>) => React.ReactNode;
|
|
24
25
|
export default _default;
|
package/components/textbox.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { RefAttributes } from 'react';
|
|
2
|
+
import { BoxProps, BoxTagProps } from '../box';
|
|
3
|
+
import { ComponentsAndVariants } from '../types';
|
|
4
4
|
declare const tagProps: readonly ["name", "onInput", "onChange", "type", "placeholder", "defaultValue", "autoFocus", "readOnly", "required", "value", "pattern"];
|
|
5
5
|
type TagPropsType = (typeof tagProps)[number];
|
|
6
|
-
type
|
|
6
|
+
type TextareaProps<TKey extends keyof ComponentsAndVariants> = Omit<BoxProps<'input', TKey>, 'tag' | 'props'>;
|
|
7
|
+
type TextboxTagProps = Omit<BoxTagProps<'input'>, TagPropsType | 'type'>;
|
|
7
8
|
type TextboxType = 'date' | 'datetime-local' | 'email' | 'hidden' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
|
|
8
|
-
interface Props extends
|
|
9
|
+
interface Props<TKey extends keyof ComponentsAndVariants> extends TextareaProps<TKey> {
|
|
9
10
|
name?: string;
|
|
10
11
|
props?: TextboxTagProps;
|
|
11
12
|
onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -19,5 +20,5 @@ interface Props extends Omit<TextareaProps, 'props'> {
|
|
|
19
20
|
readOnly?: boolean;
|
|
20
21
|
step?: number | string;
|
|
21
22
|
}
|
|
22
|
-
declare const _default:
|
|
23
|
+
declare const _default: <TKey extends keyof ComponentsAndVariants = "textbox">(props: Props<TKey> & RefAttributes<HTMLInputElement>) => React.ReactNode;
|
|
23
24
|
export default _default;
|