@cronocode/react-box 3.0.7 → 3.0.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/box.cjs +1 -1
- package/box.d.ts +3 -1
- package/box.mjs +16 -14
- package/components/dropdown.cjs +1 -1
- package/components/dropdown.d.ts +2 -1
- package/components/dropdown.mjs +108 -88
- package/core/boxStyles.d.ts +15 -0
- package/core/theme/defaultTheme.d.ts +3 -0
- package/core/theme/theme.d.ts +13 -0
- package/core/theme/themeContext.d.ts +9 -0
- package/core/{theme.d.ts → theme/themeContract.d.ts} +9 -10
- package/core/theme/useTheme.d.ts +2 -0
- package/core.cjs +4 -4
- package/core.mjs +548 -484
- package/package.json +1 -1
- package/core/useTheme.d.ts +0 -8
package/box.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const t=require("react"),e=require("./core.cjs");function P(a,l){const{tag:c="div",children:n,props:m,className:p,style:i,disabled:x,required:B,checked:g,selected:h}=a,f=e.useStyles(a,c==="svg"),r=t.useMemo(()=>{const v=e.classNames(f,p).join(" "),s={...m,className:v};return e.BoxUtils.assignBooleanProp(x,"disabled",s),e.BoxUtils.assignBooleanProp(B,"required",s),e.BoxUtils.assignBooleanProp(g,"checked",s),e.BoxUtils.assignBooleanProp(h,"selected",s),i&&(s.style=i),l&&(s.ref=l),s},[a]),[T,u]=t.useState(!1),d=typeof n=="function";return d&&(r.onMouseEnter=()=>u(!0),r.onMouseLeave=()=>u(!1)),t.createElement(c,r,d?n({isHover:T}):n)}const o=t.memo(t.forwardRef(P));o.extend=e.BoxExtends.extend;o.themeSetup=e.Theme.setup;o.Theme=e.Theme;o.useTheme=e.Theme.useTheme;o.getVariableValue=e.Variables.getVariableValue;module.exports=o;
|
package/box.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ClassNameType } from './core/classNames';
|
|
|
3
3
|
import { ExtractElementFromTag } from './core/coreTypes';
|
|
4
4
|
import { BoxStyleProps } from './types';
|
|
5
5
|
import { default as BoxExtends } from './core/boxExtends';
|
|
6
|
-
import { default as Theme } from './core/theme';
|
|
6
|
+
import { default as Theme } from './core/theme/theme';
|
|
7
7
|
import { default as Variables } from './core/variables';
|
|
8
8
|
type AllProps<TTag extends keyof React.JSX.IntrinsicElements> = React.ComponentProps<TTag>;
|
|
9
9
|
type TagPropsType<TTag extends keyof React.JSX.IntrinsicElements> = Omit<AllProps<TTag>, 'className' | 'style' | 'ref' | 'disabled' | 'required' | 'checked'>;
|
|
@@ -21,6 +21,8 @@ interface BoxType {
|
|
|
21
21
|
<TTag extends keyof React.JSX.IntrinsicElements = 'div'>(props: Props<TTag> & RefAttributes<ExtractElementFromTag<TTag>>): React.ReactNode;
|
|
22
22
|
extend: typeof BoxExtends.extend;
|
|
23
23
|
themeSetup: typeof Theme.setup;
|
|
24
|
+
Theme: typeof Theme;
|
|
25
|
+
useTheme: typeof Theme.useTheme;
|
|
24
26
|
getVariableValue: typeof Variables.getVariableValue;
|
|
25
27
|
}
|
|
26
28
|
declare const Box: BoxType;
|
package/box.mjs
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { B as S, T as
|
|
3
|
-
function
|
|
4
|
-
const { tag:
|
|
5
|
-
const P =
|
|
6
|
-
...
|
|
1
|
+
import T, { memo as V, forwardRef as b, useMemo as y, useState as N } from "react";
|
|
2
|
+
import { B as S, T as r, V as C, u as E, c as H, a } from "./core.mjs";
|
|
3
|
+
function M(o, l) {
|
|
4
|
+
const { tag: c = "div", children: t, props: m, className: p, style: i, disabled: f, required: g, checked: B, selected: h } = o, x = E(o, c === "svg"), n = y(() => {
|
|
5
|
+
const P = H(x, p).join(" "), e = {
|
|
6
|
+
...m,
|
|
7
7
|
className: P
|
|
8
8
|
};
|
|
9
|
-
return
|
|
10
|
-
}, [
|
|
11
|
-
return
|
|
9
|
+
return a.assignBooleanProp(f, "disabled", e), a.assignBooleanProp(g, "required", e), a.assignBooleanProp(B, "checked", e), a.assignBooleanProp(h, "selected", e), i && (e.style = i), l && (e.ref = l), e;
|
|
10
|
+
}, [o]), [v, u] = N(!1), d = typeof t == "function";
|
|
11
|
+
return d && (n.onMouseEnter = () => u(!0), n.onMouseLeave = () => u(!1)), T.createElement(c, n, d ? t({ isHover: v }) : t);
|
|
12
12
|
}
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const s = V(b(M));
|
|
14
|
+
s.extend = S.extend;
|
|
15
|
+
s.themeSetup = r.setup;
|
|
16
|
+
s.Theme = r;
|
|
17
|
+
s.useTheme = r.useTheme;
|
|
18
|
+
s.getVariableValue = C.getVariableValue;
|
|
17
19
|
export {
|
|
18
|
-
|
|
20
|
+
s as default
|
|
19
21
|
};
|
package/components/dropdown.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),n=require("react"),h=require("../box.cjs"),E=require("./textbox.cjs"),z=require("./flex.cjs"),C=require("../core.cjs"),F=require("./baseSvg.cjs"),G=require("./tooltip.cjs"),Q=require("./button.cjs");function X(u,d){const{name:p,defaultValue:x,multiple:c,isSearchable:w,searchPlaceholder:H,children:D,onChange:r,...L}=u,[i,g]=n.useState(Array.isArray(x)?x:x?[x]:[]),[j,N]=n.useState(""),[m,P,I]=C.useVisibility(),S=n.useRef(null),R=n.useRef(null),[U,B]=n.useState(0),M=n.useMemo(()=>U>window.innerHeight/2,[U]),Y=n.useMemo(()=>{var e;return M?((e=I.current)==null?void 0:e.getBoundingClientRect().height)??0:0},[M,I]),l=n.useMemo(()=>Array.isArray(D)?D:[D],[D]),V=n.useMemo(()=>l.filter(e=>{var o;return((o=e.type)==null?void 0:o.componentName)==="DropdownItem"}),[l]),f=n.useMemo(()=>V.filter(e=>w&&j?q(e).toLowerCase().includes(j.toLowerCase()):!0),[w,j,l]),_=n.useMemo(()=>l.find(e=>{var o;return((o=e.type)==null?void 0:o.componentName)==="DropdownUnselect"}),[l]),O=n.useMemo(()=>l.find(e=>{var o;return((o=e.type)==null?void 0:o.componentName)==="DropdownSelectAll"}),[l]),b=n.useMemo(()=>l.find(e=>{var o;return((o=e.type)==null?void 0:o.componentName)==="DropdownEmptyItem"}),[l]),T=n.useMemo(()=>l.find(e=>{var o;return((o=e.type)==null?void 0:o.componentName)==="DropdownDisplay"}),[l]),J=n.useMemo(()=>{if(T)return T.props.children(i);const e=f.filter(t=>i.includes(t.props.value));if(c&&e.length>1)return e.map(t=>q(t)).join(", ");const o=e.at(0);return(o==null?void 0:o.props.children)??(o==null?void 0:o.props.value)},[c,f,i]),A=n.useCallback((e,...o)=>{if(o.length===0)g([]),r==null||r(void 0,[]);else if(c&&o.length>1){const t=o.map(a=>a.props.value);g(t),r==null||r(void 0,t)}else if(o.length===1){const t=o[0];if(c){const a=i.filter($=>$!==t.props.value);a.length===i.length&&a.push(t.props.value),g(a),r==null||r(t.props.value,a)}else g([t.props.value]),r==null||r(t.props.value,[t.props.value])}c?(e.stopPropagation(),setTimeout(()=>{var t;return(t=S.current)==null?void 0:t.focus()},0)):(P(!1),setTimeout(()=>{var t;return(t=I.current)==null?void 0:t.focus()},0))},[c,i,g]);n.useEffect(()=>{m?setTimeout(()=>{var e,o,t;(e=S.current)==null||e.focus(),(t=(o=R.current)==null?void 0:o.querySelector('[aria-selected="true"]'))==null||t.scrollIntoView({block:"nearest"})},0):N("")},[m]);const k=O&&c&&f.length>i.length,W=_&&f.length>0&&!k;return s.jsxs(h,{width:"fit-content",children:[i.map(e=>s.jsx(E,{ref:d,name:p,type:"hidden",value:JSON.stringify(e)??""},JSON.stringify(e))),s.jsxs(Q,{ref:I,component:"dropdown",...L,props:{onMouseDown:()=>P(e=>!e),tabIndex:0},children:[w&&s.jsx(E,{display:m&&w?"block":"none",clean:!0,flex1:!0,width:1,minHeight:5,placeholder:H,value:j,onChange:e=>N(e.target.value),ref:S,props:{onMouseDown:e=>{m&&w&&e.stopPropagation()}}}),s.jsx(z,{component:"dropdown.display",display:m&&w?"none":"flex",flex1:!0,minHeight:5,children:J}),s.jsx(h,{children:s.jsx(F,{viewBox:"0 0 10 6",width:"0.6rem",rotate:m?180:0,children:s.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 4 4 4-4"})})})]}),m&&s.jsx(G,{ref:R,top:M?void 0:0,bottom:M?2:void 0,style:{transform:`translateY(-${Y}px)`},onPositionChange:e=>B(e.top-window.scrollY),children:(f.length>0||b)&&s.jsxs(h,{component:"dropdown.items",children:[W&&s.jsx(h,{component:"dropdown.unselect",selected:i.length===0,..._.props,props:{onMouseDown:e=>A(e)}}),k&&s.jsx(h,{component:"dropdown.selectAll",...O.props,props:{onMouseDown:e=>A(e,...V)}}),f.map(e=>{const{value:o,...t}=e.props;return s.jsx(h,{component:"dropdown.item",theme:c?"multiple":"single",selected:i.includes(o),...t,props:{onMouseDown:a=>A(a,e)}},o)}),f.length===0&&b&&s.jsx(h,{component:"dropdown.emptyItem",...b.props})]})})]})}function v(u){const d=p=>null;return d.componentName=u,d}const y=n.forwardRef(X);y.Item=v("DropdownItem");y.Unselect=v("DropdownUnselect");y.SelectAll=v("DropdownSelectAll");y.EmptyItem=v("DropdownEmptyItem");y.Display=v("DropdownDisplay");function q(u){var d;if(u==null)return"";if(typeof u=="object"){const p=(d=u.props)==null?void 0:d.children;return p==null?"":typeof p=="object"?(Array.isArray(p)?p:[p]).map(c=>q(c)).join(""):p.toString()}return u.toString()}module.exports=y;
|
package/components/dropdown.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ interface DropdownDisplayProps<TVal> extends Omit<BoxProps, 'children'> {
|
|
|
17
17
|
interface DropdownType {
|
|
18
18
|
<TVal>(props: Props<TVal>, ref: Ref<HTMLInputElement>): React.ReactNode;
|
|
19
19
|
Item: <TVal>(props: DropdownItemProps<TVal>) => React.ReactNode;
|
|
20
|
-
|
|
20
|
+
Unselect: (props: BoxProps) => React.ReactNode;
|
|
21
|
+
SelectAll: (props: BoxProps) => React.ReactNode;
|
|
21
22
|
EmptyItem: (props: BoxProps) => React.ReactNode;
|
|
22
23
|
Display: <TVal>(props: DropdownDisplayProps<TVal>) => React.ReactNode;
|
|
23
24
|
}
|
package/components/dropdown.mjs
CHANGED
|
@@ -1,140 +1,160 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { b as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
function
|
|
11
|
-
const { name:
|
|
1
|
+
import { jsxs as j, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as G, useState as M, useRef as Y, useMemo as c, useCallback as Q, useEffect as X } from "react";
|
|
3
|
+
import h from "../box.mjs";
|
|
4
|
+
import J from "./textbox.mjs";
|
|
5
|
+
import Z from "./flex.mjs";
|
|
6
|
+
import { b as K } from "../core.mjs";
|
|
7
|
+
import ee from "./baseSvg.mjs";
|
|
8
|
+
import oe from "./tooltip.mjs";
|
|
9
|
+
import te from "./button.mjs";
|
|
10
|
+
function ne(u, m) {
|
|
11
|
+
const { name: l, defaultValue: y, multiple: p, isSearchable: w, searchPlaceholder: q, children: x, onChange: n, ...F } = u, [i, g] = M(Array.isArray(y) ? y : y ? [y] : []), [I, B] = M(""), [d, U, S] = K(), b = Y(null), V = Y(null), [O, W] = M(0), A = c(() => O > window.innerHeight / 2, [O]), _ = c(() => {
|
|
12
12
|
var e;
|
|
13
|
-
return
|
|
14
|
-
}, [
|
|
13
|
+
return A ? ((e = S.current) == null ? void 0 : e.getBoundingClientRect().height) ?? 0 : 0;
|
|
14
|
+
}, [A, S]), r = c(() => Array.isArray(x) ? x : [x], [x]), R = c(() => r.filter((e) => {
|
|
15
15
|
var o;
|
|
16
|
-
return ((o = e.type) == null ? void 0 : o.componentName)
|
|
17
|
-
}), [
|
|
16
|
+
return ((o = e.type) == null ? void 0 : o.componentName) === "DropdownItem";
|
|
17
|
+
}), [r]), f = c(() => R.filter((e) => w && I ? T(e).toLowerCase().includes(I.toLowerCase()) : !0), [w, I, r]), k = c(() => r.find((e) => {
|
|
18
18
|
var o;
|
|
19
|
-
return ((o = e.type) == null ? void 0 : o.componentName) === "
|
|
20
|
-
}), [
|
|
19
|
+
return ((o = e.type) == null ? void 0 : o.componentName) === "DropdownUnselect";
|
|
20
|
+
}), [r]), E = c(() => r.find((e) => {
|
|
21
|
+
var o;
|
|
22
|
+
return ((o = e.type) == null ? void 0 : o.componentName) === "DropdownSelectAll";
|
|
23
|
+
}), [r]), N = c(() => r.find((e) => {
|
|
21
24
|
var o;
|
|
22
25
|
return ((o = e.type) == null ? void 0 : o.componentName) === "DropdownEmptyItem";
|
|
23
|
-
}), [
|
|
26
|
+
}), [r]), H = c(() => r.find((e) => {
|
|
24
27
|
var o;
|
|
25
28
|
return ((o = e.type) == null ? void 0 : o.componentName) === "DropdownDisplay";
|
|
26
|
-
}), [
|
|
27
|
-
if (
|
|
29
|
+
}), [r]), $ = c(() => {
|
|
30
|
+
if (H) return H.props.children(i);
|
|
28
31
|
const e = f.filter((t) => i.includes(t.props.value));
|
|
29
|
-
if (
|
|
30
|
-
return e.map((t) =>
|
|
32
|
+
if (p && e.length > 1)
|
|
33
|
+
return e.map((t) => T(t)).join(", ");
|
|
31
34
|
const o = e.at(0);
|
|
32
|
-
return (o == null ? void 0 : o.props.children) ?? (o == null ? void 0 : o.props.value)
|
|
33
|
-
}, [
|
|
34
|
-
(e, o) => {
|
|
35
|
-
if (
|
|
36
|
-
g([]),
|
|
37
|
-
else if (
|
|
38
|
-
const t =
|
|
39
|
-
|
|
40
|
-
} else
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
return (o == null ? void 0 : o.props.children) ?? (o == null ? void 0 : o.props.value);
|
|
36
|
+
}, [p, f, i]), P = Q(
|
|
37
|
+
(e, ...o) => {
|
|
38
|
+
if (o.length === 0)
|
|
39
|
+
g([]), n == null || n(void 0, []);
|
|
40
|
+
else if (p && o.length > 1) {
|
|
41
|
+
const t = o.map((a) => a.props.value);
|
|
42
|
+
g(t), n == null || n(void 0, t);
|
|
43
|
+
} else if (o.length === 1) {
|
|
44
|
+
const t = o[0];
|
|
45
|
+
if (p) {
|
|
46
|
+
const a = i.filter((C) => C !== t.props.value);
|
|
47
|
+
a.length === i.length && a.push(t.props.value), g(a), n == null || n(t.props.value, a);
|
|
48
|
+
} else
|
|
49
|
+
g([t.props.value]), n == null || n(t.props.value, [t.props.value]);
|
|
50
|
+
}
|
|
51
|
+
p ? (e.stopPropagation(), setTimeout(() => {
|
|
43
52
|
var t;
|
|
44
|
-
return (t =
|
|
45
|
-
}, 0)) : (
|
|
53
|
+
return (t = b.current) == null ? void 0 : t.focus();
|
|
54
|
+
}, 0)) : (U(!1), setTimeout(() => {
|
|
46
55
|
var t;
|
|
47
|
-
return (t =
|
|
56
|
+
return (t = S.current) == null ? void 0 : t.focus();
|
|
48
57
|
}, 0));
|
|
49
58
|
},
|
|
50
|
-
[
|
|
59
|
+
[p, i, g]
|
|
51
60
|
);
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
X(() => {
|
|
62
|
+
d ? setTimeout(() => {
|
|
54
63
|
var e, o, t;
|
|
55
|
-
(e =
|
|
56
|
-
}, 0) :
|
|
57
|
-
}, [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
(e = b.current) == null || e.focus(), (t = (o = V.current) == null ? void 0 : o.querySelector('[aria-selected="true"]')) == null || t.scrollIntoView({ block: "nearest" });
|
|
65
|
+
}, 0) : B("");
|
|
66
|
+
}, [d]);
|
|
67
|
+
const L = E && p && f.length > i.length, z = k && f.length > 0 && !L;
|
|
68
|
+
return /* @__PURE__ */ j(h, { width: "fit-content", children: [
|
|
69
|
+
i.map((e) => /* @__PURE__ */ s(J, { ref: m, name: l, type: "hidden", value: JSON.stringify(e) ?? "" }, JSON.stringify(e))),
|
|
70
|
+
/* @__PURE__ */ j(te, { ref: S, component: "dropdown", ...F, props: { onMouseDown: () => U((e) => !e), tabIndex: 0 }, children: [
|
|
71
|
+
w && /* @__PURE__ */ s(
|
|
72
|
+
J,
|
|
62
73
|
{
|
|
63
|
-
display:
|
|
74
|
+
display: d && w ? "block" : "none",
|
|
64
75
|
clean: !0,
|
|
65
76
|
flex1: !0,
|
|
66
77
|
width: 1,
|
|
67
78
|
minHeight: 5,
|
|
68
|
-
placeholder:
|
|
69
|
-
value:
|
|
70
|
-
onChange: (e) =>
|
|
71
|
-
ref:
|
|
79
|
+
placeholder: q,
|
|
80
|
+
value: I,
|
|
81
|
+
onChange: (e) => B(e.target.value),
|
|
82
|
+
ref: b,
|
|
72
83
|
props: {
|
|
73
84
|
onMouseDown: (e) => {
|
|
74
|
-
|
|
85
|
+
d && w && e.stopPropagation();
|
|
75
86
|
}
|
|
76
87
|
}
|
|
77
88
|
}
|
|
78
89
|
),
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ s(Z, { component: "dropdown.display", display: d && w ? "none" : "flex", flex1: !0, minHeight: 5, children: $ }),
|
|
91
|
+
/* @__PURE__ */ s(h, { children: /* @__PURE__ */ s(ee, { viewBox: "0 0 10 6", width: "0.6rem", rotate: d ? 180 : 0, children: /* @__PURE__ */ s("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m1 1 4 4 4-4" }) }) })
|
|
81
92
|
] }),
|
|
82
|
-
|
|
83
|
-
|
|
93
|
+
d && /* @__PURE__ */ s(
|
|
94
|
+
oe,
|
|
84
95
|
{
|
|
85
|
-
ref:
|
|
86
|
-
top:
|
|
87
|
-
bottom:
|
|
88
|
-
style: { transform: `translateY(-${
|
|
89
|
-
onPositionChange: (e) =>
|
|
90
|
-
children: (f.length > 0 ||
|
|
91
|
-
|
|
92
|
-
|
|
96
|
+
ref: V,
|
|
97
|
+
top: A ? void 0 : 0,
|
|
98
|
+
bottom: A ? 2 : void 0,
|
|
99
|
+
style: { transform: `translateY(-${_}px)` },
|
|
100
|
+
onPositionChange: (e) => W(e.top - window.scrollY),
|
|
101
|
+
children: (f.length > 0 || N) && /* @__PURE__ */ j(h, { component: "dropdown.items", children: [
|
|
102
|
+
z && /* @__PURE__ */ s(
|
|
103
|
+
h,
|
|
93
104
|
{
|
|
94
|
-
component: "dropdown.
|
|
105
|
+
component: "dropdown.unselect",
|
|
95
106
|
selected: i.length === 0,
|
|
96
|
-
...
|
|
97
|
-
props: { onMouseDown: (e) =>
|
|
107
|
+
...k.props,
|
|
108
|
+
props: { onMouseDown: (e) => P(e) }
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
L && /* @__PURE__ */ s(
|
|
112
|
+
h,
|
|
113
|
+
{
|
|
114
|
+
component: "dropdown.selectAll",
|
|
115
|
+
...E.props,
|
|
116
|
+
props: { onMouseDown: (e) => P(e, ...R) }
|
|
98
117
|
}
|
|
99
118
|
),
|
|
100
119
|
f.map((e) => {
|
|
101
120
|
const { value: o, ...t } = e.props;
|
|
102
|
-
return /* @__PURE__ */
|
|
103
|
-
|
|
121
|
+
return /* @__PURE__ */ s(
|
|
122
|
+
h,
|
|
104
123
|
{
|
|
105
124
|
component: "dropdown.item",
|
|
106
|
-
theme:
|
|
125
|
+
theme: p ? "multiple" : "single",
|
|
107
126
|
selected: i.includes(o),
|
|
108
127
|
...t,
|
|
109
|
-
props: { onMouseDown: (
|
|
128
|
+
props: { onMouseDown: (a) => P(a, e) }
|
|
110
129
|
},
|
|
111
130
|
o
|
|
112
131
|
);
|
|
113
132
|
}),
|
|
114
|
-
f.length === 0 &&
|
|
133
|
+
f.length === 0 && N && /* @__PURE__ */ s(h, { component: "dropdown.emptyItem", ...N.props })
|
|
115
134
|
] })
|
|
116
135
|
}
|
|
117
136
|
)
|
|
118
137
|
] });
|
|
119
138
|
}
|
|
120
|
-
function
|
|
121
|
-
const
|
|
122
|
-
return
|
|
139
|
+
function v(u) {
|
|
140
|
+
const m = (l) => null;
|
|
141
|
+
return m.componentName = u, m;
|
|
123
142
|
}
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (
|
|
133
|
-
|
|
134
|
-
|
|
143
|
+
const D = G(ne);
|
|
144
|
+
D.Item = v("DropdownItem");
|
|
145
|
+
D.Unselect = v("DropdownUnselect");
|
|
146
|
+
D.SelectAll = v("DropdownSelectAll");
|
|
147
|
+
D.EmptyItem = v("DropdownEmptyItem");
|
|
148
|
+
D.Display = v("DropdownDisplay");
|
|
149
|
+
function T(u) {
|
|
150
|
+
var m;
|
|
151
|
+
if (u == null) return "";
|
|
152
|
+
if (typeof u == "object") {
|
|
153
|
+
const l = (m = u.props) == null ? void 0 : m.children;
|
|
154
|
+
return l == null ? "" : typeof l == "object" ? (Array.isArray(l) ? l : [l]).map((p) => T(p)).join("") : l.toString();
|
|
135
155
|
}
|
|
136
|
-
return
|
|
156
|
+
return u.toString();
|
|
137
157
|
}
|
|
138
158
|
export {
|
|
139
|
-
|
|
159
|
+
D as default
|
|
140
160
|
};
|
package/core/boxStyles.d.ts
CHANGED
|
@@ -714,6 +714,16 @@ export declare const cssStyles: {
|
|
|
714
714
|
valueFormat: (value: string, getVariableValue: (name: string) => string) => string;
|
|
715
715
|
styleName: string;
|
|
716
716
|
}[];
|
|
717
|
+
shadow: {
|
|
718
|
+
values: readonly ["small-shadow", "medium-shadow", "large-shadow"];
|
|
719
|
+
valueFormat: (value: string, getVariableValue: (name: string) => string) => string;
|
|
720
|
+
styleName: string;
|
|
721
|
+
}[];
|
|
722
|
+
translateX: {
|
|
723
|
+
values: number;
|
|
724
|
+
valueFormat: (value: number) => string;
|
|
725
|
+
styleName: string;
|
|
726
|
+
}[];
|
|
717
727
|
};
|
|
718
728
|
export declare const pseudo1: {
|
|
719
729
|
hover: string;
|
|
@@ -766,9 +776,14 @@ export declare const pseudoGroupClasses: {
|
|
|
766
776
|
disabledGroup: "disabled";
|
|
767
777
|
};
|
|
768
778
|
export declare const breakpoints: {
|
|
779
|
+
/** Styles applied for small screens and larger. >= 640 */
|
|
769
780
|
sm: number;
|
|
781
|
+
/** Styles applied for medium screens and larger. >= 768 */
|
|
770
782
|
md: number;
|
|
783
|
+
/** Styles applied for large screens and larger. >= 1024 */
|
|
771
784
|
lg: number;
|
|
785
|
+
/** Styles applied for extra-large screens and larger. >= 1280 */
|
|
772
786
|
xl: number;
|
|
787
|
+
/** Styles applied for 2x extra-large screens and larger. >= 1536 */
|
|
773
788
|
xxl: number;
|
|
774
789
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Themes } from './themeContract';
|
|
3
|
+
interface ThemeProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
theme: string;
|
|
6
|
+
}
|
|
7
|
+
declare function Theme(props: ThemeProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare namespace Theme {
|
|
9
|
+
let userThemes: Maybe<Themes>;
|
|
10
|
+
function setup(themes: Themes): void;
|
|
11
|
+
function useTheme(): [string, (theme: string) => void];
|
|
12
|
+
}
|
|
13
|
+
export default Theme;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ThemeType } from './themeContract';
|
|
3
|
+
interface IThemeContext {
|
|
4
|
+
themeStyles: ThemeType;
|
|
5
|
+
theme: string;
|
|
6
|
+
setTheme(theme: string): void;
|
|
7
|
+
}
|
|
8
|
+
declare const ThemeContext: React.Context<IThemeContext>;
|
|
9
|
+
export default ThemeContext;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { BoxThemeStyles } from '
|
|
1
|
+
import { BoxThemeStyles } from '../../types';
|
|
2
2
|
export interface ThemeComponentStyles {
|
|
3
|
+
clean?: boolean;
|
|
3
4
|
styles: BoxThemeStyles;
|
|
4
5
|
themes?: {
|
|
5
6
|
[name: string]: BoxThemeStyles;
|
|
6
7
|
};
|
|
7
|
-
children?:
|
|
8
|
-
[name: string]: ThemeComponentStyles;
|
|
9
|
-
};
|
|
8
|
+
children?: ThemeType;
|
|
10
9
|
}
|
|
10
|
+
export type ThemeType = {
|
|
11
|
+
[componentName: string]: ThemeComponentStyles;
|
|
12
|
+
};
|
|
11
13
|
export interface ThemeSetup {
|
|
12
|
-
components?:
|
|
13
|
-
[name: string]: ThemeComponentStyles;
|
|
14
|
-
};
|
|
14
|
+
components?: ThemeType;
|
|
15
15
|
button?: ThemeComponentStyles;
|
|
16
16
|
textbox?: ThemeComponentStyles;
|
|
17
17
|
textarea?: ThemeComponentStyles;
|
|
@@ -20,7 +20,6 @@ export interface ThemeSetup {
|
|
|
20
20
|
label?: ThemeComponentStyles;
|
|
21
21
|
dropdown?: ThemeComponentStyles;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
export interface Themes {
|
|
24
|
+
[name: string]: ThemeSetup;
|
|
25
25
|
}
|
|
26
|
-
export default Theme;
|