@cronocode/react-box 3.0.13 → 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.
Files changed (46) hide show
  1. package/array.d.ts +13 -0
  2. package/components/checkbox.mjs +4 -4
  3. package/components/dataGrid/contracts/dataGridContract.d.ts +36 -0
  4. package/components/dataGrid/dataGridCell.d.ts +8 -0
  5. package/components/dataGrid/dataGridGroupRow.d.ts +6 -0
  6. package/components/dataGrid/dataGridHeaderCell.d.ts +6 -0
  7. package/components/dataGrid/dataGridPagination.d.ts +6 -0
  8. package/components/dataGrid/dataGridRow.d.ts +6 -0
  9. package/components/dataGrid/models/cellModel.d.ts +10 -0
  10. package/components/dataGrid/models/columnModel.d.ts +36 -0
  11. package/components/dataGrid/models/gridModel.d.ts +44 -0
  12. package/components/dataGrid/models/groupRowCellModel.d.ts +10 -0
  13. package/components/dataGrid/models/groupRowModel.d.ts +23 -0
  14. package/components/dataGrid/models/rowModel.d.ts +16 -0
  15. package/components/dataGrid/useGrid.d.ts +3 -0
  16. package/components/dataGrid.cjs +1 -1
  17. package/components/dataGrid.d.ts +2 -7
  18. package/components/dataGrid.mjs +656 -18
  19. package/components/dropdown.cjs +1 -1
  20. package/components/dropdown.d.ts +2 -2
  21. package/components/dropdown.mjs +62 -61
  22. package/components/form.mjs +5 -5
  23. package/components/semantics.d.ts +25 -25
  24. package/components/tooltip.cjs +1 -1
  25. package/components/tooltip.mjs +20 -22
  26. package/core/boxConstants.d.ts +1 -0
  27. package/core/boxStyles.d.ts +108 -35
  28. package/core/boxStylesFormatters.d.ts +1 -1
  29. package/core/classNames.d.ts +1 -1
  30. package/core/extends/boxComponents.d.ts +86 -1
  31. package/core/useStyles.d.ts +2 -2
  32. package/core/variables.d.ts +1 -0
  33. package/core.cjs +4 -4
  34. package/core.mjs +623 -507
  35. package/hooks/useVisibility.d.ts +9 -1
  36. package/icons/arrowIcon.d.ts +2 -0
  37. package/icons/dotsIcon.d.ts +2 -0
  38. package/icons/groupingIcon.d.ts +2 -0
  39. package/icons/pinIcon.d.ts +2 -0
  40. package/package.json +1 -1
  41. package/types.d.ts +12 -23
  42. package/utils/fn/fnUtils.d.ts +4 -0
  43. package/utils/memo.d.ts +5 -0
  44. package/utils/object/objectUtils.d.ts +1 -1
  45. package/components/dataGrid/dataGridContract.d.ts +0 -24
  46. package/components/dataGrid/useGridData.d.ts +0 -7
@@ -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:A,hideArrow: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,[D,R]=n.useState(""),[a,U,b]=Q.useVisibility(),q=n.useRef(null),T=n.useRef(null),[V,W]=n.useState(0),I=n.useMemo(()=>V>window.innerHeight/2,[V]),$=n.useMemo(()=>{var e;return I?((e=b.current)==null?void 0:e.getBoundingClientRect().height)??0:0},[I,b]),l=n.useMemo(()=>(Array.isArray(A)?A:[A]).flatMap(e=>e),[A]),_=n.useMemo(()=>l.filter(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownItem"}),[l]),f=n.useMemo(()=>_.filter(e=>w&&D?P(e).toLowerCase().includes(D.toLowerCase()):!0),[w,D,l]),v=n.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownUnselect"}),[l]),O=n.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownSelectAll"}),[l]),N=n.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownEmptyItem"}),[l]),C=n.useMemo(()=>l.find(e=>{var t;return((t=e.type)==null?void 0:t.displayName)==="DropdownDisplay"}),[l]),z=n.useMemo(()=>{if(C)return C.props.children(c,a);const e=f.filter(o=>c.includes(o.props.value));if(u&&e.length>1)return e.map(o=>P(o)).join(", ");const t=e.at(0);return(t==null?void 0:t.props.children)??(t==null?void 0:t.props.value)??(u?null:v==null?void 0:v.props.children)},[u,f,c,v,a]),k=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(M=>M!==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=q.current)==null?void 0:o.focus()},0)):(U(!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=q.current)==null||e.focus(),(o=(t=T.current)==null?void 0:t.querySelector('[aria-selected="true"]'))==null||o.scrollIntoView({block:"nearest"})},0):R("")},[a]);const E=O&&u&&f.length>c.length,F=v&&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:()=>U(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:D,onChange:e=>R(e.target.value),ref:q,props:{onClick:e=>{a&&w&&e.stopPropagation()}}}),r.jsx(G,{component:"dropdown.display",display:a&&w?"none":"flex",children:z}),!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:T,top:I?void 0:0,bottom:I?2:void 0,style:{transform:`translateY(-${$}px)`},onPositionChange:e=>W(e.top-window.scrollY),children:(f.length>0||N)&&r.jsxs(h,{component:"dropdown.items",children:[F&&r.jsx(h,{component:"dropdown.unselect",selected:c.length===0,...v.props,props:{onClick:e=>k(e)}}),E&&r.jsx(h,{component:"dropdown.selectAll",...O.props,props:{onClick:e=>k(e,..._)}}),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:M=>{o==null||o(M),k(M,e)}}},t)}),f.length===0&&N&&r.jsx(h,{component:"dropdown.emptyItem",...N.props})]})})]})}function S(i){const m=p=>null;return m.displayName=i,m}const x=n.forwardRef(ee);x.Item=S("DropdownItem");x.Unselect=S("DropdownUnselect");x.SelectAll=S("DropdownSelectAll");x.EmptyItem=S("DropdownEmptyItem");x.Display=S("DropdownDisplay");function P(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=>P(y)).join(""):p.toString()}return i.toString()}module.exports=x;
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;
@@ -7,7 +7,7 @@ interface Props<TVal> extends BoxProps<'button'> {
7
7
  multiple?: boolean;
8
8
  isSearchable?: boolean;
9
9
  searchPlaceholder?: string;
10
- hideArrow?: boolean;
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;
@@ -1,42 +1,43 @@
1
- import { jsxs as U, jsx as l } from "react/jsx-runtime";
2
- import { forwardRef as Z, useState as B, useRef as M, useMemo as c, useCallback as K, useEffect as ee } from "react";
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 q from "./textbox.mjs";
5
- import te from "./flex.mjs";
6
- import { b as oe } from "../core.mjs";
7
- import re from "./baseSvg.mjs";
8
- import ne from "./tooltip.mjs";
9
- import le from "./button.mjs";
10
- function se(s, m) {
11
- const { name: p, defaultValue: g, value: y, multiple: a, isSearchable: w, searchPlaceholder: F, children: S, hideArrow: W, onChange: r, ..._ } = s, [$, x] = B(Array.isArray(g) ? g : g ? [g] : []), i = "value" in s ? Array.isArray(y) ? y : y ? [y] : [] : $, [I, O] = B(""), [d, R, b] = oe(), P = M(null), C = M(null), [E, z] = B(0), N = c(() => E > window.innerHeight / 2, [E]), G = c(() => {
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]), n = c(
14
+ }, [N, b]), l = c(
15
15
  () => (Array.isArray(S) ? S : [S]).flatMap((e) => e),
16
16
  [S]
17
- ), L = c(() => n.filter((e) => {
17
+ ), H = c(() => l.filter((e) => {
18
18
  var t;
19
19
  return ((t = e.type) == null ? void 0 : t.displayName) === "DropdownItem";
20
- }), [n]), f = c(() => L.filter((e) => w && I ? V(e).toLowerCase().includes(I.toLowerCase()) : !0), [w, I, n]), v = c(() => n.find((e) => {
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
- }), [n]), H = c(() => n.find((e) => {
23
+ }), [l]), Y = c(() => l.find((e) => {
24
24
  var t;
25
25
  return ((t = e.type) == null ? void 0 : t.displayName) === "DropdownSelectAll";
26
- }), [n]), T = c(() => n.find((e) => {
26
+ }), [l]), j = c(() => l.find((e) => {
27
27
  var t;
28
28
  return ((t = e.type) == null ? void 0 : t.displayName) === "DropdownEmptyItem";
29
- }), [n]), Y = c(() => n.find((e) => {
29
+ }), [l]), k = c(() => l.find((e) => {
30
30
  var t;
31
31
  return ((t = e.type) == null ? void 0 : t.displayName) === "DropdownDisplay";
32
- }), [n]), Q = c(() => {
33
- if (Y) return Y.props.children(i, d);
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) => V(o)).join(", ");
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]), j = K(
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((k) => k !== o.props.value);
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 = P.current) == null ? void 0 : o.focus();
57
- }, 0)) : (R(!1), setTimeout(() => {
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
- ee(() => {
65
+ te(() => {
65
66
  d ? setTimeout(() => {
66
67
  var e, t, o;
67
- (e = P.current) == null || e.focus(), (o = (t = C.current) == null ? void 0 : t.querySelector('[aria-selected="true"]')) == null || o.scrollIntoView({ block: "nearest" });
68
- }, 0) : O("");
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 J = H && a && f.length > i.length, X = v && f.length > 0 && !J;
71
- return /* @__PURE__ */ U(h, { width: "fit-content", children: [
72
- i.map((e) => /* @__PURE__ */ l(q, { ref: m, name: p, type: "hidden", value: JSON.stringify(e) ?? "" }, JSON.stringify(e))),
73
- /* @__PURE__ */ U(
74
- le,
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: () => R((e) => !e),
80
+ onClick: () => C((e) => !e),
80
81
  props: { tabIndex: 0 },
81
82
  ..._,
82
83
  children: [
83
- w && /* @__PURE__ */ l(
84
- q,
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: F,
92
- value: I,
93
- onChange: (e) => O(e.target.value),
94
- ref: P,
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,33 +100,33 @@ function se(s, m) {
99
100
  }
100
101
  }
101
102
  ),
102
- /* @__PURE__ */ l(te, { component: "dropdown.display", display: d && w ? "none" : "flex", children: Q }),
103
- !W && /* @__PURE__ */ l(h, { children: /* @__PURE__ */ l(re, { viewBox: "0 0 10 6", width: "0.6rem", rotate: d ? 180 : 0, children: /* @__PURE__ */ l("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m1 1 4 4 4-4" }) }) })
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__ */ l(
108
- ne,
108
+ d && /* @__PURE__ */ n(
109
+ le,
109
110
  {
110
- ref: C,
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 || T) && /* @__PURE__ */ U(h, { component: "dropdown.items", children: [
116
- X && /* @__PURE__ */ l(
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) => j(e) }
123
+ props: { onClick: (e) => U(e) }
123
124
  }
124
125
  ),
125
- J && /* @__PURE__ */ l(h, { component: "dropdown.selectAll", ...H.props, props: { onClick: (e) => j(e, ...L) } }),
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__ */ l(
129
+ return /* @__PURE__ */ n(
129
130
  h,
130
131
  {
131
132
  component: "dropdown.item",
@@ -133,39 +134,39 @@ function se(s, m) {
133
134
  selected: i.includes(t),
134
135
  ...u,
135
136
  props: {
136
- onClick: (k) => {
137
- o == null || o(k), j(k, e);
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 && T && /* @__PURE__ */ l(h, { component: "dropdown.emptyItem", ...T.props })
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 A(s) {
151
+ function D(s) {
151
152
  const m = (p) => null;
152
153
  return m.displayName = s, m;
153
154
  }
154
- const D = Z(se);
155
- D.Item = A("DropdownItem");
156
- D.Unselect = A("DropdownUnselect");
157
- D.SelectAll = A("DropdownSelectAll");
158
- D.EmptyItem = A("DropdownEmptyItem");
159
- D.Display = A("DropdownDisplay");
160
- function V(s) {
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) => V(y)).join("") : p.toString();
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
- D as default
171
+ I as default
171
172
  };
@@ -1,18 +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 { F as c } from "../core.mjs";
5
- function x(o) {
6
- const { onSubmit: r, props: n } = o, t = a(null), e = i(
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
7
  (m) => {
8
8
  m.preventDefault();
9
9
  const f = c.getFormEntries(t.current);
10
10
  r(f, m);
11
11
  },
12
12
  [r]
13
- ), s = { ...n, onSubmit: e, ref: t };
13
+ ), s = { ...e, onSubmit: n, ref: t };
14
14
  return /* @__PURE__ */ u(p, { tag: "form", ...o, props: s });
15
15
  }
16
16
  export {
17
- x as default
17
+ F as default
18
18
  };
@@ -3,29 +3,29 @@ import { BoxProps } from '../box';
3
3
  import { ExtractElementFromTag } from '../core/coreTypes';
4
4
  import { ComponentsAndVariants } from '../types';
5
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
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">;
31
31
  export {};
@@ -1 +1 @@
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;
1
+ "use strict";const c=require("react/jsx-runtime"),v=require("react-dom"),d=require("../box.cjs"),s=require("react"),C=require("../core.cjs"),l=2;function R(f,w){const{onPositionChange:a}=f,i=s.useRef(null),[t,p]=s.useState(),b=C.usePortalContainer(),h=s.useCallback((r,e)=>{const o=m=>{m.target.contains(r)&&e(r)},n=new AbortController;return document.addEventListener("scroll",o,n),()=>n.abort()},[t]),x=s.useCallback((r,e)=>{const o=n=>{e(r)};return window.addEventListener("resize",o,{capture:!0}),()=>{window.removeEventListener("resize",o,{capture:!0})}},[t]),u=s.useCallback(r=>{const e=r.getBoundingClientRect(),o=Math.round((e.top+window.scrollY)*l)/l,n=Math.round((e.left+window.scrollX)*l)/l;((t==null?void 0:t.top)!==o||(t==null?void 0:t.left)!==n)&&(a==null||a({top:o,left:n}),p({top:o,left:n,width:e.width>0?e.width:void 0}))},[t]);return s.useLayoutEffect(()=>{if(i.current){u(i.current);const r=h(i.current,u),e=x(i.current,u);return()=>{r(),e()}}},[t]),c.jsxs(c.Fragment,{children:[c.jsx(d,{ref:i}),t&&v.createPortal(c.jsx(d,{ref:w,position:"absolute",top:0,left:0,transition:"none",style:{transform:`translate(${t.left}px,${t.top}px)`,width:t.width},children:c.jsx(d,{position:"absolute",width:"fit",...f})}),b)]})}const j=s.forwardRef(R);module.exports=j;
@@ -1,21 +1,19 @@
1
- import { jsxs as x, Fragment as b, jsx as a } from "react/jsx-runtime";
2
- import { createPortal as E } from "react-dom";
1
+ import { jsxs as x, Fragment as C, jsx as a } from "react/jsx-runtime";
2
+ import { createPortal as R } from "react-dom";
3
3
  import u from "../box.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";
4
+ import { forwardRef as g, useRef as z, useState as E, useCallback as d, useLayoutEffect as L } from "react";
5
+ import { f as D } from "../core.mjs";
6
6
  const i = 2;
7
- function D(f, p) {
8
- const { onPositionChange: c } = f, s = R(null), [t, m] = g(), w = C(), h = d(
7
+ function H(f, p) {
8
+ const { onPositionChange: l } = f, s = z(null), [t, w] = E(), m = D(), h = d(
9
9
  (o, e) => {
10
- const r = (n) => {
11
- n.target.contains(o) && e(o);
12
- };
13
- return document.addEventListener("scroll", r, { capture: !0 }), () => {
14
- document.removeEventListener("scroll", r, { capture: !0 });
15
- };
10
+ const r = (v) => {
11
+ v.target.contains(o) && e(o);
12
+ }, n = new AbortController();
13
+ return document.addEventListener("scroll", r, n), () => n.abort();
16
14
  },
17
15
  [t]
18
- ), v = d(
16
+ ), b = d(
19
17
  (o, e) => {
20
18
  const r = (n) => {
21
19
  e(o);
@@ -25,24 +23,24 @@ function D(f, p) {
25
23
  };
26
24
  },
27
25
  [t]
28
- ), l = d(
26
+ ), c = d(
29
27
  (o) => {
30
28
  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 }), m({ top: r, left: n, width: e.width > 0 ? e.width : void 0 }));
29
+ ((t == null ? void 0 : t.top) !== r || (t == null ? void 0 : t.left) !== n) && (l == null || l({ top: r, left: n }), w({ top: r, left: n, width: e.width > 0 ? e.width : void 0 }));
32
30
  },
33
31
  [t]
34
32
  );
35
- return z(() => {
33
+ return L(() => {
36
34
  if (s.current) {
37
- l(s.current);
38
- const o = h(s.current, l), e = v(s.current, l);
35
+ c(s.current);
36
+ const o = h(s.current, c), e = b(s.current, c);
39
37
  return () => {
40
38
  o(), e();
41
39
  };
42
40
  }
43
- }, [t]), /* @__PURE__ */ x(b, { children: [
41
+ }, [t]), /* @__PURE__ */ x(C, { children: [
44
42
  /* @__PURE__ */ a(u, { ref: s }),
45
- t && E(
43
+ t && R(
46
44
  /* @__PURE__ */ a(
47
45
  u,
48
46
  {
@@ -55,11 +53,11 @@ function D(f, p) {
55
53
  children: /* @__PURE__ */ a(u, { position: "absolute", width: "fit", ...f })
56
54
  }
57
55
  ),
58
- w
56
+ m
59
57
  )
60
58
  ] });
61
59
  }
62
- const M = L(D);
60
+ const M = g(H);
63
61
  export {
64
62
  M as default
65
63
  };
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_REM_DIVIDER = 4;