@cronocode/react-box 3.0.4 → 3.0.6

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 t=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:f,checked:g}=a,B=e.useStyles(a,c==="svg"),r=t.useMemo(()=>{const b=e.classNames(B,p).join(" "),s={...m,className:b};return e.BoxUtils.assignBooleanProp(x,"disabled",s),e.BoxUtils.assignBooleanProp(f,"required",s),e.BoxUtils.assignBooleanProp(g,"checked",s),i&&(s.style=i),l&&(s.ref=l),s},[a]),[v,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:v}):n)}const o=t.memo(t.forwardRef(h));o.extend=e.BoxExtends.extend;o.themeSetup=e.Theme.setup;o.getVariableValue=e.Variables.getVariableValue;module.exports=o;
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;
package/box.mjs CHANGED
@@ -1,19 +1,19 @@
1
- import V, { memo as b, forwardRef as h, useMemo as y, useState as P } from "react";
2
- import { B as N, T as S, V as C, u as E, c as H, a as t } from "./core.mjs";
3
- function M(s, r) {
4
- const { tag: l = "div", children: a, props: d, className: m, style: c, disabled: f, required: p, checked: g } = s, x = E(s, l === "svg"), o = y(() => {
5
- const v = H(x, m).join(" "), e = {
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
6
  ...d,
7
- className: v
7
+ className: P
8
8
  };
9
- return t.assignBooleanProp(f, "disabled", e), t.assignBooleanProp(p, "required", e), t.assignBooleanProp(g, "checked", e), c && (e.style = c), r && (e.ref = r), e;
10
- }, [s]), [B, i] = P(!1), u = typeof a == "function";
11
- return u && (o.onMouseEnter = () => i(!0), o.onMouseLeave = () => i(!1)), V.createElement(l, o, u ? a({ isHover: B }) : a);
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);
12
12
  }
13
- const n = b(h(M));
14
- n.extend = N.extend;
15
- n.themeSetup = S.setup;
16
- n.getVariableValue = C.getVariableValue;
13
+ const n = b(h(T));
14
+ n.extend = S.extend;
15
+ n.themeSetup = C.setup;
16
+ n.getVariableValue = E.getVariableValue;
17
17
  export {
18
18
  n as default
19
19
  };
@@ -1,3 +1,4 @@
1
+ import { Ref } from 'react';
1
2
  import { BoxTagProps } from '../box';
2
3
  import { BoxStyleProps } from '../types';
3
4
  import { ClassNameType } from '../core/classNames';
@@ -13,5 +14,7 @@ interface Props extends Omit<BoxStyleProps, 'width' | 'height'> {
13
14
  width?: string;
14
15
  height?: string;
15
16
  }
17
+ declare function BaseSvg(props: Props, ref: Ref<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
16
18
  declare const _default: import('react').ForwardRefExoticComponent<Props & import('react').RefAttributes<SVGSVGElement>>;
17
19
  export default _default;
20
+ export type BaseSvgProps = React.ComponentProps<typeof BaseSvg>;
@@ -1 +1 @@
1
- "use strict";const n=require("react/jsx-runtime"),r=require("react"),s=require("../box.cjs"),c=require("../core.cjs"),u=["type","onClick"];function i(t,o){const e=c.ObjectUtils.buildProps(t,u);return n.jsx(s,{ref:o,tag:"button",component:"button",...e})}const b=r.forwardRef(i);module.exports=b;
1
+ "use strict";const n=require("react/jsx-runtime"),r=require("react"),s=require("../box.cjs"),c=require("../core.cjs"),u=["type","onClick"];function i(t,o){const e=c.ObjectUtils.buildProps(t,u);return n.jsx(s,{ref:o,tag:"button",component:"button",...e})}const p=r.forwardRef(i);module.exports=p;
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),p=require("react"),a=require("../box.cjs"),b=require("./tooltip.cjs"),k=require("./baseSvg.cjs"),q=require("./flex.cjs"),C=require("../core.cjs"),I=require("./textbox.cjs");function v(r,y){const{children:i,name:d}=r,s=(Array.isArray(i)?i:[i]).filter(n=>{var t;return((t=n.type)==null?void 0:t.componentName)==="DropdownItem"}),[o,w]=p.useState(s==null?void 0:s[0]),[u,c,f]=C.useVisibility(),h=p.useCallback(()=>{c(n=>!n)},[c]),j=p.useCallback(n=>{var t,m;w(n),c(!1),(m=(t=n.props).onClick)==null||m.call(t)},[]);return e.jsxs(a,{ref:f,width:"fit-content",userSelect:"none",props:{tabIndex:0},children:[e.jsx(I,{name:d,type:"hidden",value:o==null?void 0:o.props.value}),e.jsxs(q,{component:"dropdown",gap:2,jc:"space-between",...r,props:{onMouseDown:h,onBlur:()=>c(!1)},children:[(o==null?void 0:o.props.label)??(o==null?void 0:o.props.children)??(o==null?void 0:o.props.value),e.jsx(k,{viewBox:"0 0 10 6",width:"0.6rem",rotate:u?180:0,children:e.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 4 4 4-4",style:{transition:"none"}})})]}),u&&e.jsx(b,{children:e.jsx(a,{component:"dropdown.items",children:s.map(n=>e.jsx(l,{...n.props,onClick:()=>j(n)},n.props.value))})})]})}function l(r){return e.jsx(a,{component:"dropdown.item",...r,props:{onClick:r.onClick,tabIndex:0}})}l.componentName="DropdownItem";const x=p.forwardRef(v);x.Item=l;module.exports=x;
1
+ "use strict";const t=require("react/jsx-runtime"),c=require("react"),h=require("../box.cjs"),O=require("./tooltip.cjs"),P=require("./baseSvg.cjs"),E=require("../core.cjs"),A=require("./textbox.cjs"),U=require("./flex.cjs"),y=require("./button.cjs");function W(n,m){var g;const{children:o,name:N,isSearchable:p,searchPlaceholder:L,onChange:x,selectedValue:T}=n,[a,b]=c.useState(""),f=c.useMemo(()=>(Array.isArray(o)?o:[o]).filter(s=>{var r;return((r=s.type)==null?void 0:r.componentName)!=="DropdownItem"?!1:p&&a?_(s).toLowerCase().includes(a.toLowerCase()):!0}),[p,a,o]),l=c.useMemo(()=>(Array.isArray(o)?o:[o]).find(s=>{var r;return((r=s.type)==null?void 0:r.componentName)==="DropdownNullItem"}),[p,a,o]),v=c.useMemo(()=>(Array.isArray(o)?o:[o]).find(s=>{var r;return((r=s.type)==null?void 0:r.componentName)==="DropdownNoItems"}),[p,a,o]),[u,B]=c.useState(f.find(e=>e.props.value===T)),[i,j,V]=E.useVisibility(),k=c.useRef(null),C=c.useRef(null),q=c.useRef(null),H=c.useCallback(()=>{j(e=>!e)},[j]),S=c.useCallback((e,s)=>{var r,d;B(s),j(!1),(d=(r=s.props).onClick)==null||d.call(r,e),x==null||x(s.props.value),setTimeout(()=>{var R;return(R=C.current)==null?void 0:R.focus()},0)},[]);return c.useEffect(()=>{i?setTimeout(()=>{var e,s,r;(e=k.current)==null||e.focus(),(r=(s=q.current)==null?void 0:s.querySelector('[aria-selected="true"]'))==null||r.scrollIntoView({block:"nearest"})},0):b("")},[i]),t.jsxs(h,{ref:V,width:"fit-content",children:[t.jsx(A,{ref:m,name:N,type:"hidden",value:((g=u==null?void 0:u.props)==null?void 0:g.value)??""}),t.jsxs(y,{ref:C,component:"dropdown",...n,props:{onMouseDown:H},children:[p&&t.jsx(A,{display:i&&p?"block":"none",clean:!0,flex1:!0,width:1,placeholder:L,value:a,onChange:e=>b(e.target.value),ref:k,props:{onMouseDown:e=>{i&&p&&e.stopPropagation()}}}),t.jsx(U,{display:i&&p?"none":"flex",children:(u==null?void 0:u.props.children)??(u==null?void 0:u.props.value)??(l==null?void 0:l.props.children)??t.jsx(h,{height:5})}),t.jsx(P,{viewBox:"0 0 10 6",width:"0.6rem",rotate:i?180:0,children:t.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 4 4 4-4"})})]}),i&&t.jsx(O,{ref:q,children:(f.length>0||l||v)&&t.jsxs(h,{component:"dropdown.items",children:[l&&t.jsx(D,{...l.props,selected:!u,onClick:e=>S(e,l)}),f.map((e,s)=>{var r;return t.jsx(I,{...e.props,selected:e===u,onClick:d=>S(d,e)},(r=e.props.value)==null?void 0:r.toString())}),f.length===0&&!l&&v]})})]})}function I(n){return t.jsx(y,{component:"dropdown.item",...n,props:{onMouseDown:n.onClick}})}I.componentName="DropdownItem";function D(n){return t.jsx(y,{component:"dropdown.nullItem",...n,props:{onMouseDown:n.onClick}})}D.componentName="DropdownNullItem";function M(n){return t.jsx(h,{component:"dropdown.noItems",...n})}M.componentName="DropdownNoItems";const w=c.forwardRef(W);w.Item=I;w.NullItem=D;w.NoItems=M;function _(n){var m;if(n==null)return"";if(typeof n=="object"){const o=(m=n.props)==null?void 0:m.children;return o==null?"":typeof o=="object"?(Array.isArray(o)?o:[o]).map(p=>_(p)).join(""):o.toString()}return n.toString()}module.exports=w;
@@ -1,18 +1,25 @@
1
1
  import { Ref } from 'react';
2
2
  import { BoxProps } from '../box';
3
- interface DropdownItemProps extends BoxProps {
4
- value: string | number;
5
- label?: string;
6
- onClick?: () => void;
3
+ interface DropdownItemProps<TVal> extends BoxProps {
4
+ value: TVal;
5
+ onClick?: (e: React.MouseEvent) => void;
7
6
  }
8
- interface Props extends BoxProps {
7
+ interface Props<TVal> extends BoxProps {
9
8
  name?: string;
10
- children: React.ReactElement<DropdownItemProps> | Array<React.ReactElement<DropdownItemProps>>;
9
+ children: React.ReactElement<DropdownItemProps<TVal>> | Array<React.ReactElement<DropdownItemProps<TVal>>>;
10
+ isSearchable?: boolean;
11
+ searchPlaceholder?: string;
12
+ onChange?: (value: TVal) => void;
13
+ selectedValue?: TVal;
11
14
  }
12
- declare function DropdownImpl(props: Props, ref: Ref<HTMLSelectElement>): React.ReactNode;
13
- declare function DropdownItem(props: DropdownItemProps): import("react/jsx-runtime").JSX.Element;
15
+ declare function DropdownImpl<TVal>(props: Props<TVal>, ref: Ref<HTMLInputElement>): React.ReactNode;
16
+ declare function DropdownItem<TVal>(props: DropdownItemProps<TVal>): import("react/jsx-runtime").JSX.Element;
17
+ declare function DropdownNullItem<TVal>(props: Omit<DropdownItemProps<TVal>, 'value'>): import("react/jsx-runtime").JSX.Element;
18
+ declare function DropdownNoItems<TVal>(props: Omit<DropdownItemProps<TVal>, 'value'>): import("react/jsx-runtime").JSX.Element;
14
19
  type DropdownType = typeof DropdownImpl & {
15
20
  Item: typeof DropdownItem;
21
+ NullItem: typeof DropdownNullItem;
22
+ NoItems: typeof DropdownNoItems;
16
23
  };
17
24
  declare const Dropdown: DropdownType;
18
25
  export default Dropdown;
@@ -1,46 +1,106 @@
1
- import { jsxs as f, jsx as n } from "react/jsx-runtime";
2
- import { forwardRef as k, useState as C, useCallback as u } from "react";
3
- import s from "../box.mjs";
4
- import I from "./tooltip.mjs";
5
- import v from "./baseSvg.mjs";
6
- import y from "./flex.mjs";
7
- import { b as D } from "../core.mjs";
8
- import j from "./textbox.mjs";
9
- function B(e, T) {
10
- const { children: m, name: d } = e, p = (Array.isArray(m) ? m : [m]).filter((r) => {
11
- var t;
12
- return ((t = r.type) == null ? void 0 : t.componentName) === "DropdownItem";
13
- }), [o, w] = C(p == null ? void 0 : p[0]), [c, i, h] = D(), x = u(() => {
14
- i((r) => !r);
15
- }, [i]), b = u((r) => {
16
- var t, l;
17
- w(r), i(!1), (l = (t = r.props).onClick) == null || l.call(t);
1
+ import { jsxs as y, jsx as s } from "react/jsx-runtime";
2
+ import { forwardRef as W, useState as R, useMemo as I, useRef as D, useCallback as L, useEffect as z } from "react";
3
+ import f from "../box.mjs";
4
+ import G from "./tooltip.mjs";
5
+ import J from "./baseSvg.mjs";
6
+ import { b as Q } from "../core.mjs";
7
+ import V from "./textbox.mjs";
8
+ import X from "./flex.mjs";
9
+ import x from "./button.mjs";
10
+ function Y(n, m) {
11
+ var T;
12
+ const { children: e, name: C, isSearchable: c, searchPlaceholder: P, onChange: h, selectedValue: q } = n, [a, b] = R(""), d = I(() => (Array.isArray(e) ? e : [e]).filter((t) => {
13
+ var r;
14
+ return ((r = t.type) == null ? void 0 : r.componentName) !== "DropdownItem" ? !1 : c && a ? O(t).toLowerCase().includes(a.toLowerCase()) : !0;
15
+ }), [c, a, e]), l = I(() => (Array.isArray(e) ? e : [e]).find((t) => {
16
+ var r;
17
+ return ((r = t.type) == null ? void 0 : r.componentName) === "DropdownNullItem";
18
+ }), [c, a, e]), g = I(() => (Array.isArray(e) ? e : [e]).find((t) => {
19
+ var r;
20
+ return ((r = t.type) == null ? void 0 : r.componentName) === "DropdownNoItems";
21
+ }), [c, a, e]), [p, E] = R(
22
+ d.find((o) => o.props.value === q)
23
+ ), [i, w, F] = Q(), S = D(null), A = D(null), j = D(null), U = L(() => {
24
+ w((o) => !o);
25
+ }, [w]), B = L((o, t) => {
26
+ var r, u;
27
+ E(t), w(!1), (u = (r = t.props).onClick) == null || u.call(r, o), h == null || h(t.props.value), setTimeout(() => {
28
+ var M;
29
+ return (M = A.current) == null ? void 0 : M.focus();
30
+ }, 0);
18
31
  }, []);
19
- return /* @__PURE__ */ f(s, { ref: h, width: "fit-content", userSelect: "none", props: { tabIndex: 0 }, children: [
20
- /* @__PURE__ */ n(j, { name: d, type: "hidden", value: o == null ? void 0 : o.props.value }),
21
- /* @__PURE__ */ f(y, { component: "dropdown", gap: 2, jc: "space-between", ...e, props: { onMouseDown: x, onBlur: () => i(!1) }, children: [
22
- (o == null ? void 0 : o.props.label) ?? (o == null ? void 0 : o.props.children) ?? (o == null ? void 0 : o.props.value),
23
- /* @__PURE__ */ n(v, { viewBox: "0 0 10 6", width: "0.6rem", rotate: c ? 180 : 0, children: /* @__PURE__ */ n(
24
- "path",
32
+ return z(() => {
33
+ i ? setTimeout(() => {
34
+ var o, t, r;
35
+ (o = S.current) == null || o.focus(), (r = (t = j.current) == null ? void 0 : t.querySelector('[aria-selected="true"]')) == null || r.scrollIntoView({ block: "nearest" });
36
+ }, 0) : b("");
37
+ }, [i]), /* @__PURE__ */ y(f, { ref: F, width: "fit-content", children: [
38
+ /* @__PURE__ */ s(V, { ref: m, name: C, type: "hidden", value: ((T = p == null ? void 0 : p.props) == null ? void 0 : T.value) ?? "" }),
39
+ /* @__PURE__ */ y(x, { ref: A, component: "dropdown", ...n, props: { onMouseDown: U }, children: [
40
+ c && /* @__PURE__ */ s(
41
+ V,
25
42
  {
26
- stroke: "currentColor",
27
- strokeLinecap: "round",
28
- strokeLinejoin: "round",
29
- strokeWidth: "2",
30
- d: "m1 1 4 4 4-4",
31
- style: { transition: "none" }
43
+ display: i && c ? "block" : "none",
44
+ clean: !0,
45
+ flex1: !0,
46
+ width: 1,
47
+ placeholder: P,
48
+ value: a,
49
+ onChange: (o) => b(o.target.value),
50
+ ref: S,
51
+ props: {
52
+ onMouseDown: (o) => {
53
+ i && c && o.stopPropagation();
54
+ }
55
+ }
32
56
  }
33
- ) })
57
+ ),
58
+ /* @__PURE__ */ s(X, { display: i && c ? "none" : "flex", children: (p == null ? void 0 : p.props.children) ?? (p == null ? void 0 : p.props.value) ?? (l == null ? void 0 : l.props.children) ?? /* @__PURE__ */ s(f, { height: 5 }) }),
59
+ /* @__PURE__ */ s(J, { viewBox: "0 0 10 6", width: "0.6rem", rotate: i ? 180 : 0, children: /* @__PURE__ */ s("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m1 1 4 4 4-4" }) })
34
60
  ] }),
35
- c && /* @__PURE__ */ n(I, { children: /* @__PURE__ */ n(s, { component: "dropdown.items", children: p.map((r) => /* @__PURE__ */ n(a, { ...r.props, onClick: () => b(r) }, r.props.value)) }) })
61
+ i && /* @__PURE__ */ s(G, { ref: j, children: (d.length > 0 || l || g) && /* @__PURE__ */ y(f, { component: "dropdown.items", children: [
62
+ l && /* @__PURE__ */ s(v, { ...l.props, selected: !p, onClick: (o) => B(o, l) }),
63
+ d.map((o, t) => {
64
+ var r;
65
+ return /* @__PURE__ */ s(
66
+ N,
67
+ {
68
+ ...o.props,
69
+ selected: o === p,
70
+ onClick: (u) => B(u, o)
71
+ },
72
+ (r = o.props.value) == null ? void 0 : r.toString()
73
+ );
74
+ }),
75
+ d.length === 0 && !l && g
76
+ ] }) })
36
77
  ] });
37
78
  }
38
- function a(e) {
39
- return /* @__PURE__ */ n(s, { component: "dropdown.item", ...e, props: { onClick: e.onClick, tabIndex: 0 } });
79
+ function N(n) {
80
+ return /* @__PURE__ */ s(x, { component: "dropdown.item", ...n, props: { onMouseDown: n.onClick } });
81
+ }
82
+ N.componentName = "DropdownItem";
83
+ function v(n) {
84
+ return /* @__PURE__ */ s(x, { component: "dropdown.nullItem", ...n, props: { onMouseDown: n.onClick } });
85
+ }
86
+ v.componentName = "DropdownNullItem";
87
+ function H(n) {
88
+ return /* @__PURE__ */ s(f, { component: "dropdown.noItems", ...n });
89
+ }
90
+ H.componentName = "DropdownNoItems";
91
+ const k = W(Y);
92
+ k.Item = N;
93
+ k.NullItem = v;
94
+ k.NoItems = H;
95
+ function O(n) {
96
+ var m;
97
+ if (n == null) return "";
98
+ if (typeof n == "object") {
99
+ const e = (m = n.props) == null ? void 0 : m.children;
100
+ return e == null ? "" : typeof e == "object" ? (Array.isArray(e) ? e : [e]).map((c) => O(c)).join("") : e.toString();
101
+ }
102
+ return n.toString();
40
103
  }
41
- a.componentName = "DropdownItem";
42
- const S = k(B);
43
- S.Item = a;
44
104
  export {
45
- S as default
105
+ k as default
46
106
  };
@@ -1 +1 @@
1
- "use strict";const i=require("react/jsx-runtime"),v=require("react-dom"),d=require("../box.cjs"),s=require("react"),x=require("../core.cjs"),l=2;function b(f){const{onPositionChange:u}=f,c=s.useRef(null),[t,p]=s.useState(),w=x.usePortalContainer(),h=s.useCallback((n,e)=>{const r=o=>{o.target.contains(n)&&e(n)};return document.addEventListener("scroll",r,{capture:!0}),()=>{document.removeEventListener("scroll",r,{capture:!0})}},[t]),m=s.useCallback((n,e)=>{const r=o=>{e(n)};return window.addEventListener("resize",r,{capture:!0}),()=>{window.removeEventListener("resize",r,{capture:!0})}},[t]),a=s.useCallback(n=>{const e=n.getBoundingClientRect(),r=Math.round((e.top+window.scrollY)*l)/l,o=Math.round((e.left+window.scrollX)*l)/l;((t==null?void 0:t.top)!==r||(t==null?void 0:t.left)!==o)&&(u==null||u({top:r,left:o}),p({top:r,left:o,width:e.width>0?e.width:void 0}))},[t]);return s.useLayoutEffect(()=>{if(c.current){a(c.current);const n=h(c.current,a),e=m(c.current,a);return()=>{n(),e()}}},[t]),i.jsxs(i.Fragment,{children:[i.jsx(d,{ref:c}),t&&v.createPortal(i.jsx(d,{position:"absolute",top:0,left:0,transition:"none",style:{transform:`translate(${t.left}px,${t.top}px)`,width:t.width},children:i.jsx(d,{position:"absolute",width:"fit",...f})}),w)]})}module.exports=b;
1
+ "use strict";const i=require("react/jsx-runtime"),x=require("react-dom"),d=require("../box.cjs"),n=require("react"),b=require("../core.cjs"),l=2;function R(f,p){const{onPositionChange:u}=f,c=n.useRef(null),[t,w]=n.useState(),h=b.usePortalContainer(),m=n.useCallback((o,e)=>{const r=s=>{s.target.contains(o)&&e(o)};return document.addEventListener("scroll",r,{capture:!0}),()=>{document.removeEventListener("scroll",r,{capture:!0})}},[t]),v=n.useCallback((o,e)=>{const r=s=>{e(o)};return window.addEventListener("resize",r,{capture:!0}),()=>{window.removeEventListener("resize",r,{capture:!0})}},[t]),a=n.useCallback(o=>{const e=o.getBoundingClientRect(),r=Math.round((e.top+window.scrollY)*l)/l,s=Math.round((e.left+window.scrollX)*l)/l;((t==null?void 0:t.top)!==r||(t==null?void 0:t.left)!==s)&&(u==null||u({top:r,left:s}),w({top:r,left:s,width:e.width>0?e.width:void 0}))},[t]);return n.useLayoutEffect(()=>{if(c.current){a(c.current);const o=m(c.current,a),e=v(c.current,a);return()=>{o(),e()}}},[t]),i.jsxs(i.Fragment,{children:[i.jsx(d,{ref:c}),t&&x.createPortal(i.jsx(d,{ref:p,position:"absolute",top:0,left:0,transition:"none",style:{transform:`translate(${t.left}px,${t.top}px)`,width:t.width},children:i.jsx(d,{position:"absolute",width:"fit",...f})}),h)]})}const C=n.forwardRef(R);module.exports=C;
@@ -5,5 +5,5 @@ interface Props extends BoxProps {
5
5
  left: number;
6
6
  }): void;
7
7
  }
8
- export default function Tooltip(props: Props): import("react/jsx-runtime").JSX.Element;
9
- export {};
8
+ declare const _default: import('react').ForwardRefExoticComponent<Props & import('react').RefAttributes<HTMLDivElement>>;
9
+ export default _default;
@@ -1,11 +1,11 @@
1
- import { jsxs as v, Fragment as x, jsx as a } from "react/jsx-runtime";
2
- import { createPortal as b } from "react-dom";
1
+ import { jsxs as x, Fragment as b, jsx as a } from "react/jsx-runtime";
2
+ import { createPortal as E } from "react-dom";
3
3
  import u from "../box.mjs";
4
- import { useRef as E, useState as L, useCallback as d, useLayoutEffect as g } from "react";
5
- import { d as z } from "../core.mjs";
4
+ import { forwardRef as L, useRef as R, useState as g, useCallback as d, useLayoutEffect as z } from "react";
5
+ import { d as C } from "../core.mjs";
6
6
  const i = 2;
7
- function y(f) {
8
- const { onPositionChange: c } = f, s = E(null), [t, p] = L(), m = z(), w = d(
7
+ function D(f, p) {
8
+ const { onPositionChange: c } = f, s = R(null), [t, m] = g(), w = C(), h = d(
9
9
  (o, e) => {
10
10
  const r = (n) => {
11
11
  n.target.contains(o) && e(o);
@@ -15,7 +15,7 @@ function y(f) {
15
15
  };
16
16
  },
17
17
  [t]
18
- ), h = d(
18
+ ), v = d(
19
19
  (o, e) => {
20
20
  const r = (n) => {
21
21
  e(o);
@@ -28,24 +28,25 @@ function y(f) {
28
28
  ), l = d(
29
29
  (o) => {
30
30
  const e = o.getBoundingClientRect(), r = Math.round((e.top + window.scrollY) * i) / i, n = Math.round((e.left + window.scrollX) * i) / i;
31
- ((t == null ? void 0 : t.top) !== r || (t == null ? void 0 : t.left) !== n) && (c == null || c({ top: r, left: n }), p({ top: r, left: n, width: e.width > 0 ? e.width : void 0 }));
31
+ ((t == null ? void 0 : t.top) !== r || (t == null ? void 0 : t.left) !== n) && (c == null || c({ top: r, left: n }), m({ top: r, left: n, width: e.width > 0 ? e.width : void 0 }));
32
32
  },
33
33
  [t]
34
34
  );
35
- return g(() => {
35
+ return z(() => {
36
36
  if (s.current) {
37
37
  l(s.current);
38
- const o = w(s.current, l), e = h(s.current, l);
38
+ const o = h(s.current, l), e = v(s.current, l);
39
39
  return () => {
40
40
  o(), e();
41
41
  };
42
42
  }
43
- }, [t]), /* @__PURE__ */ v(x, { children: [
43
+ }, [t]), /* @__PURE__ */ x(b, { children: [
44
44
  /* @__PURE__ */ a(u, { ref: s }),
45
- t && b(
45
+ t && E(
46
46
  /* @__PURE__ */ a(
47
47
  u,
48
48
  {
49
+ ref: p,
49
50
  position: "absolute",
50
51
  top: 0,
51
52
  left: 0,
@@ -54,10 +55,11 @@ function y(f) {
54
55
  children: /* @__PURE__ */ a(u, { position: "absolute", width: "fit", ...f })
55
56
  }
56
57
  ),
57
- m
58
+ w
58
59
  )
59
60
  ] });
60
61
  }
62
+ const M = L(D);
61
63
  export {
62
- y as default
64
+ M as default
63
65
  };
@@ -701,6 +701,11 @@ export declare const cssStyles: {
701
701
  valueFormat: (value: string, getVariableValue: (name: string) => string) => string;
702
702
  styleName: string;
703
703
  }[];
704
+ bgImage: {
705
+ values: readonly ["none", "bg-img-checked", "bg-img-indeterminate", "bg-img-radio"];
706
+ valueFormat: (value: string, getVariableValue: (name: string) => string) => string;
707
+ styleName: string;
708
+ }[];
704
709
  };
705
710
  export declare const pseudo1: {
706
711
  hover: string;
@@ -721,12 +726,14 @@ export declare const pseudo2: {
721
726
  checked: string;
722
727
  required: string;
723
728
  disabled: string;
729
+ selected: string;
724
730
  };
725
731
  export declare const pseudoClasses: {
726
732
  indeterminate: string;
727
733
  checked: string;
728
734
  required: string;
729
735
  disabled: string;
736
+ selected: string;
730
737
  hover: string;
731
738
  focus: string;
732
739
  hasFocus: string;
@@ -740,9 +747,9 @@ export declare const pseudoClasses: {
740
747
  hasRequired: string;
741
748
  hasDisabled: string;
742
749
  };
743
- export declare const pseudoClassesWeight: Record<"indeterminate" | "checked" | "required" | "disabled" | "hover" | "focus" | "hasFocus" | "active" | "valid" | "hasValid" | "invalid" | "hasInvalid" | "optional" | "hasChecked" | "hasRequired" | "hasDisabled", number>;
750
+ export declare const pseudoClassesWeight: Record<"indeterminate" | "checked" | "required" | "disabled" | "selected" | "hover" | "focus" | "hasFocus" | "active" | "valid" | "hasValid" | "invalid" | "hasInvalid" | "optional" | "hasChecked" | "hasRequired" | "hasDisabled", number>;
744
751
  export declare const pseudoClassesByWeight: {
745
- [key: number]: ("indeterminate" | "checked" | "required" | "disabled" | "hover" | "focus" | "hasFocus" | "active" | "valid" | "hasValid" | "invalid" | "hasInvalid" | "optional" | "hasChecked" | "hasRequired" | "hasDisabled")[];
752
+ [key: number]: ("indeterminate" | "checked" | "required" | "disabled" | "selected" | "hover" | "focus" | "hasFocus" | "active" | "valid" | "hasValid" | "invalid" | "hasInvalid" | "optional" | "hasChecked" | "hasRequired" | "hasDisabled")[];
746
753
  };
747
754
  export declare const pseudoGroupClasses: {
748
755
  hoverGroup: "hover";
@@ -1,8 +1,11 @@
1
1
  declare namespace Variables {
2
2
  const colors: {
3
- inherit: string;
4
- current: string;
3
+ currentColor: string;
5
4
  transparent: string;
5
+ green: string;
6
+ red: string;
7
+ blue: string;
8
+ gray: string;
6
9
  black: string;
7
10
  white: string;
8
11
  'slate-50': string;
@@ -203,6 +206,7 @@ declare namespace Variables {
203
206
  'violet-800': string;
204
207
  'violet-900': string;
205
208
  'violet-950': string;
209
+ vi: string;
206
210
  'purple-50': string;
207
211
  'purple-100': string;
208
212
  'purple-200': string;
@@ -248,7 +252,7 @@ declare namespace Variables {
248
252
  'rose-900': string;
249
253
  'rose-950': string;
250
254
  };
251
- type ColorType = keyof typeof colors;
255
+ type ColorType = keyof typeof colors | 'none';
252
256
  function getVariableValue(name: string): string;
253
257
  function generateVariables(): string;
254
258
  function setUserVariables(variables: Record<string, string>): void;