@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 CHANGED
@@ -1 +1 @@
1
- "use strict";const o=require("react"),e=require("./core.cjs");function h(a,l){const{tag:c="div",children:n,props:m,className:p,style:i,disabled:x,required:B,checked:g,selected:f}=a,v=e.useStyles(a,c==="svg"),r=o.useMemo(()=>{const b=e.classNames(v,p).join(" "),s={...m,className:b};return e.BoxUtils.assignBooleanProp(x,"disabled",s),e.BoxUtils.assignBooleanProp(B,"required",s),e.BoxUtils.assignBooleanProp(g,"checked",s),e.BoxUtils.assignBooleanProp(f,"selected",s),i&&(s.style=i),l&&(s.ref=l),s},[a]),[P,u]=o.useState(!1),d=typeof n=="function";return d&&(r.onMouseEnter=()=>u(!0),r.onMouseLeave=()=>u(!1)),o.createElement(c,r,d?n({isHover:P}):n)}const t=o.memo(o.forwardRef(h));t.extend=e.BoxExtends.extend;t.themeSetup=e.Theme.setup;t.getVariableValue=e.Variables.getVariableValue;module.exports=t;
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 V, { memo as b, forwardRef as h, useMemo as y, useState as N } from "react";
2
- import { B as S, T as C, V as E, u as H, c as M, a as s } from "./core.mjs";
3
- function T(a, r) {
4
- const { tag: l = "div", children: o, props: d, className: m, style: c, disabled: p, required: f, checked: g, selected: B } = a, x = H(a, l === "svg"), t = y(() => {
5
- const P = M(x, m).join(" "), e = {
6
- ...d,
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 s.assignBooleanProp(p, "disabled", e), s.assignBooleanProp(f, "required", e), s.assignBooleanProp(g, "checked", e), s.assignBooleanProp(B, "selected", e), c && (e.style = c), r && (e.ref = r), e;
10
- }, [a]), [v, i] = N(!1), u = typeof o == "function";
11
- return u && (t.onMouseEnter = () => i(!0), t.onMouseLeave = () => i(!1)), V.createElement(l, t, u ? o({ isHover: v }) : o);
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 n = b(h(T));
14
- n.extend = S.extend;
15
- n.themeSetup = C.setup;
16
- n.getVariableValue = E.getVariableValue;
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
- n as default
20
+ s as default
19
21
  };
@@ -1 +1 @@
1
- "use strict";const r=require("react/jsx-runtime"),n=require("react"),w=require("../box.cjs"),U=require("./textbox.cjs"),C=require("./flex.cjs"),J=require("../core.cjs"),Y=require("./baseSvg.cjs"),k=require("./tooltip.cjs"),W=require("./button.cjs");function $(p,a){const{name:s,defaultValue:y,multiple:l,isSearchable:d,searchPlaceholder:V,children:v,onChange:i,...E}=p,[c,g]=n.useState(Array.isArray(y)?y:y?[y]:[]),[j,P]=n.useState(""),[m,R,D]=J.useVisibility(),M=n.useRef(null),A=n.useRef(null),[_,H]=n.useState(0),I=n.useMemo(()=>_>window.innerHeight/2,[_]),L=n.useMemo(()=>{var e;return I?((e=D.current)==null?void 0:e.getBoundingClientRect().height)??0:0},[I,D]),u=n.useMemo(()=>Array.isArray(v)?v:[v],[v]),f=n.useMemo(()=>u.filter(e=>{var t;return((t=e.type)==null?void 0:t.componentName)!=="DropdownItem"?!1:d&&j?N(e).toLowerCase().includes(j.toLowerCase()):!0}),[d,j,u]),h=n.useMemo(()=>u.find(e=>{var t;return((t=e.type)==null?void 0:t.componentName)==="DropdownUnselectItem"}),[u]),S=n.useMemo(()=>u.find(e=>{var t;return((t=e.type)==null?void 0:t.componentName)==="DropdownEmptyItem"}),[u]),O=n.useMemo(()=>u.find(e=>{var t;return((t=e.type)==null?void 0:t.componentName)==="DropdownDisplay"}),[u]),B=n.useMemo(()=>{if(O)return O.props.children(c);const e=f.filter(o=>c.includes(o.props.value));if(l&&e.length>1)return e.map(o=>N(o)).join(", ");const t=e.at(0);return(t==null?void 0:t.props.children)??(t==null?void 0:t.props.value)??(h==null?void 0:h.props.children)},[l,f,h,c]),T=n.useCallback((e,t)=>{if(!t)g([]),i==null||i(void 0,[]);else if(l){const o=c.filter(q=>q!==t.props.value);o.length===c.length&&o.push(t.props.value),g(o),i==null||i(t.props.value,o)}else g([t.props.value]),i==null||i(t.props.value,[t.props.value]);l?(e.stopPropagation(),setTimeout(()=>{var o;return(o=M.current)==null?void 0:o.focus()},0)):(R(!1),setTimeout(()=>{var o;return(o=D.current)==null?void 0:o.focus()},0))},[l,c,g]);return n.useEffect(()=>{m?setTimeout(()=>{var e,t,o;(e=M.current)==null||e.focus(),(o=(t=A.current)==null?void 0:t.querySelector('[aria-selected="true"]'))==null||o.scrollIntoView({block:"nearest"})},0):P("")},[m]),r.jsxs(w,{width:"fit-content",children:[c.map(e=>r.jsx(U,{ref:a,name:s,type:"hidden",value:JSON.stringify(e)??""},JSON.stringify(e))),r.jsxs(W,{ref:D,component:"dropdown",...E,props:{onMouseDown:()=>R(e=>!e),tabIndex:0},children:[d&&r.jsx(U,{display:m&&d?"block":"none",clean:!0,flex1:!0,width:1,minHeight:5,placeholder:V,value:j,onChange:e=>P(e.target.value),ref:M,props:{onMouseDown:e=>{m&&d&&e.stopPropagation()}}}),r.jsx(C,{display:m&&d?"none":"flex",flex1:!0,minHeight:5,children:B}),r.jsx(w,{children:r.jsx(Y,{viewBox:"0 0 10 6",width:"0.6rem",rotate:m?180:0,children:r.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 4 4 4-4"})})})]}),m&&r.jsx(k,{ref:A,top:I?void 0:0,bottom:I?2:void 0,style:{transform:`translateY(-${L}px)`},onPositionChange:e=>H(e.top),children:(f.length>0||S)&&r.jsxs(w,{component:"dropdown.items",children:[h&&f.length>0&&r.jsx(w,{component:"dropdown.unselectItem",selected:c.length===0,...h.props,props:{onMouseDown:e=>T(e)}}),f.map(e=>{const{value:t,...o}=e.props;return r.jsx(w,{component:"dropdown.item",theme:l?"multiple":"single",selected:c.includes(t),...o,props:{onMouseDown:q=>T(q,e)}},t)}),f.length===0&&S&&r.jsx(w,{component:"dropdown.emptyItem",...S.props})]})})]})}function b(p){const a=s=>null;return a.componentName=p,a}const x=n.forwardRef($);x.Item=b("DropdownItem");x.UnselectItem=b("DropdownUnselectItem");x.EmptyItem=b("DropdownEmptyItem");x.Display=b("DropdownDisplay");function N(p){var a;if(p==null)return"";if(typeof p=="object"){const s=(a=p.props)==null?void 0:a.children;return s==null?"":typeof s=="object"?(Array.isArray(s)?s:[s]).map(l=>N(l)).join(""):s.toString()}return p.toString()}module.exports=x;
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;
@@ -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
- UnselectItem: (props: BoxProps) => React.ReactNode;
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
  }
@@ -1,140 +1,160 @@
1
- import { jsxs as T, jsx as n } from "react/jsx-runtime";
2
- import { forwardRef as F, useState as A, useRef as H, useMemo as a, useCallback as W, useEffect as _ } from "react";
3
- import w from "../box.mjs";
4
- import L from "./textbox.mjs";
5
- import $ from "./flex.mjs";
6
- import { b as z } from "../core.mjs";
7
- import G from "./baseSvg.mjs";
8
- import Q from "./tooltip.mjs";
9
- import X from "./button.mjs";
10
- function Z(s, u) {
11
- const { name: r, defaultValue: y, multiple: l, isSearchable: d, searchPlaceholder: C, children: v, onChange: p, ...J } = s, [i, g] = A(Array.isArray(y) ? y : y ? [y] : []), [D, M] = A(""), [m, O, I] = z(), N = H(null), R = H(null), [U, Y] = A(0), x = a(() => U > window.innerHeight / 2, [U]), k = a(() => {
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 x ? ((e = I.current) == null ? void 0 : e.getBoundingClientRect().height) ?? 0 : 0;
14
- }, [x, I]), c = a(() => Array.isArray(v) ? v : [v], [v]), f = a(() => c.filter((e) => {
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) !== "DropdownItem" ? !1 : d && D ? B(e).toLowerCase().includes(D.toLowerCase()) : !0;
17
- }), [d, D, c]), h = a(() => c.find((e) => {
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) === "DropdownUnselectItem";
20
- }), [c]), P = a(() => c.find((e) => {
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
- }), [c]), V = a(() => c.find((e) => {
26
+ }), [r]), H = c(() => r.find((e) => {
24
27
  var o;
25
28
  return ((o = e.type) == null ? void 0 : o.componentName) === "DropdownDisplay";
26
- }), [c]), q = a(() => {
27
- if (V) return V.props.children(i);
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 (l && e.length > 1)
30
- return e.map((t) => B(t)).join(", ");
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) ?? (h == null ? void 0 : h.props.children);
33
- }, [l, f, h, i]), E = W(
34
- (e, o) => {
35
- if (!o)
36
- g([]), p == null || p(void 0, []);
37
- else if (l) {
38
- const t = i.filter((j) => j !== o.props.value);
39
- t.length === i.length && t.push(o.props.value), g(t), p == null || p(o.props.value, t);
40
- } else
41
- g([o.props.value]), p == null || p(o.props.value, [o.props.value]);
42
- l ? (e.stopPropagation(), setTimeout(() => {
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 = N.current) == null ? void 0 : t.focus();
45
- }, 0)) : (O(!1), setTimeout(() => {
53
+ return (t = b.current) == null ? void 0 : t.focus();
54
+ }, 0)) : (U(!1), setTimeout(() => {
46
55
  var t;
47
- return (t = I.current) == null ? void 0 : t.focus();
56
+ return (t = S.current) == null ? void 0 : t.focus();
48
57
  }, 0));
49
58
  },
50
- [l, i, g]
59
+ [p, i, g]
51
60
  );
52
- return _(() => {
53
- m ? setTimeout(() => {
61
+ X(() => {
62
+ d ? setTimeout(() => {
54
63
  var e, o, t;
55
- (e = N.current) == null || e.focus(), (t = (o = R.current) == null ? void 0 : o.querySelector('[aria-selected="true"]')) == null || t.scrollIntoView({ block: "nearest" });
56
- }, 0) : M("");
57
- }, [m]), /* @__PURE__ */ T(w, { width: "fit-content", children: [
58
- i.map((e) => /* @__PURE__ */ n(L, { ref: u, name: r, type: "hidden", value: JSON.stringify(e) ?? "" }, JSON.stringify(e))),
59
- /* @__PURE__ */ T(X, { ref: I, component: "dropdown", ...J, props: { onMouseDown: () => O((e) => !e), tabIndex: 0 }, children: [
60
- d && /* @__PURE__ */ n(
61
- L,
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: m && d ? "block" : "none",
74
+ display: d && w ? "block" : "none",
64
75
  clean: !0,
65
76
  flex1: !0,
66
77
  width: 1,
67
78
  minHeight: 5,
68
- placeholder: C,
69
- value: D,
70
- onChange: (e) => M(e.target.value),
71
- ref: N,
79
+ placeholder: q,
80
+ value: I,
81
+ onChange: (e) => B(e.target.value),
82
+ ref: b,
72
83
  props: {
73
84
  onMouseDown: (e) => {
74
- m && d && e.stopPropagation();
85
+ d && w && e.stopPropagation();
75
86
  }
76
87
  }
77
88
  }
78
89
  ),
79
- /* @__PURE__ */ n($, { display: m && d ? "none" : "flex", flex1: !0, minHeight: 5, children: q }),
80
- /* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(G, { viewBox: "0 0 10 6", width: "0.6rem", rotate: m ? 180 : 0, children: /* @__PURE__ */ n("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m1 1 4 4 4-4" }) }) })
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
- m && /* @__PURE__ */ n(
83
- Q,
93
+ d && /* @__PURE__ */ s(
94
+ oe,
84
95
  {
85
- ref: R,
86
- top: x ? void 0 : 0,
87
- bottom: x ? 2 : void 0,
88
- style: { transform: `translateY(-${k}px)` },
89
- onPositionChange: (e) => Y(e.top),
90
- children: (f.length > 0 || P) && /* @__PURE__ */ T(w, { component: "dropdown.items", children: [
91
- h && f.length > 0 && /* @__PURE__ */ n(
92
- w,
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.unselectItem",
105
+ component: "dropdown.unselect",
95
106
  selected: i.length === 0,
96
- ...h.props,
97
- props: { onMouseDown: (e) => E(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__ */ n(
103
- w,
121
+ return /* @__PURE__ */ s(
122
+ h,
104
123
  {
105
124
  component: "dropdown.item",
106
- theme: l ? "multiple" : "single",
125
+ theme: p ? "multiple" : "single",
107
126
  selected: i.includes(o),
108
127
  ...t,
109
- props: { onMouseDown: (j) => E(j, e) }
128
+ props: { onMouseDown: (a) => P(a, e) }
110
129
  },
111
130
  o
112
131
  );
113
132
  }),
114
- f.length === 0 && P && /* @__PURE__ */ n(w, { component: "dropdown.emptyItem", ...P.props })
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 b(s) {
121
- const u = (r) => null;
122
- return u.componentName = s, u;
139
+ function v(u) {
140
+ const m = (l) => null;
141
+ return m.componentName = u, m;
123
142
  }
124
- const S = F(Z);
125
- S.Item = b("DropdownItem");
126
- S.UnselectItem = b("DropdownUnselectItem");
127
- S.EmptyItem = b("DropdownEmptyItem");
128
- S.Display = b("DropdownDisplay");
129
- function B(s) {
130
- var u;
131
- if (s == null) return "";
132
- if (typeof s == "object") {
133
- const r = (u = s.props) == null ? void 0 : u.children;
134
- return r == null ? "" : typeof r == "object" ? (Array.isArray(r) ? r : [r]).map((l) => B(l)).join("") : r.toString();
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 s.toString();
156
+ return u.toString();
137
157
  }
138
158
  export {
139
- S as default
159
+ D as default
140
160
  };
@@ -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,3 @@
1
+ import { ThemeSetup } from './themeContract';
2
+ declare const defaultTheme: ThemeSetup;
3
+ export default defaultTheme;
@@ -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 '../types';
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
- declare namespace Theme {
24
- function setup(styles: ThemeSetup): void;
23
+ export interface Themes {
24
+ [name: string]: ThemeSetup;
25
25
  }
26
- export default Theme;
@@ -0,0 +1,2 @@
1
+ import { BoxThemeStyles, ThemeProps } from '../../types';
2
+ export default function useTheme(props: ThemeProps): BoxThemeStyles | undefined;