@boxcustodia/library 2.0.0-alpha.31 → 2.0.0-alpha.33

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.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),O=require("react"),P=require("../../node_modules/lucide-react/dist/esm/icons/chevrons-up-down.cjs.js"),A=require("../../node_modules/@base-ui/react/use-render/useRender.cjs.js"),M=require("../../node_modules/lucide-react/dist/esm/icons/chevron-up.cjs.js"),U=require("../../node_modules/lucide-react/dist/esm/icons/chevron-down.cjs.js"),a=require("../../lib/cn.cjs.js"),E=require("../../node_modules/@base-ui/react/select/root/SelectRoot.cjs.js"),K=require("../../node_modules/@base-ui/react/select/trigger/SelectTrigger.cjs.js"),F=require("../../node_modules/@base-ui/react/select/icon/SelectIcon.cjs.js"),W=require("../../node_modules/@base-ui/react/merge-props/mergeProps.cjs.js"),H=require("../../node_modules/@base-ui/react/select/value/SelectValue.cjs.js"),J=require("../../node_modules/@base-ui/react/select/portal/SelectPortal.cjs.js"),Q=require("../../node_modules/@base-ui/react/select/positioner/SelectPositioner.cjs.js"),X=require("../../node_modules/@base-ui/react/select/popup/SelectPopup.cjs.js"),Y=require("../../node_modules/@base-ui/react/select/scroll-up-arrow/SelectScrollUpArrow.cjs.js"),Z=require("../../node_modules/@base-ui/react/select/list/SelectList.cjs.js"),ee=require("../../node_modules/@base-ui/react/select/scroll-down-arrow/SelectScrollDownArrow.cjs.js"),te=require("../../node_modules/@base-ui/react/select/item/SelectItem.cjs.js"),re=require("../../node_modules/@base-ui/react/select/item-text/SelectItemText.cjs.js"),oe=require("../../node_modules/@base-ui/react/select/item-indicator/SelectItemIndicator.cjs.js"),ne=require("../../node_modules/@base-ui/react/separator/Separator.cjs.js"),se=require("../../node_modules/@base-ui/react/select/group/SelectGroup.cjs.js"),le=require("../../node_modules/@base-ui/react/select/group-label/SelectGroupLabel.cjs.js"),ae=require("../../node_modules/@base-ui/react/select/label/SelectLabel.cjs.js"),ie=require("../input/input.cjs.js");function ce(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,l.get?l:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const ue=ce(O),v=a.cn(ie.inputBaseClasses,"relative inline-flex items-center justify-between gap-2 select-none text-left text-foreground","focus-visible:border-ring","aria-invalid:border-error focus-visible:aria-invalid:ring-error/20","has-aria-invalid:border-error has-focus-visible:has-aria-invalid:ring-error/20","data-disabled:cursor-not-allowed data-disabled:opacity-50","[&_svg]:pointer-events-none [&_svg]:shrink-0"),j="-me-1 size-4.5 opacity-80 sm:size-4";function z({...e}){return r.jsx(E.SelectRoot,{...e})}function L({className:e,children:t,icon:n,...l}){return r.jsxs(K.SelectTrigger,{className:a.cn(v,e),"data-slot":"select-trigger",...l,children:[t,r.jsx(F.SelectIcon,{"data-slot":"select-icon",className:"text-muted-foreground hover:text-foreground transition-colors",children:n??r.jsx(P.default,{className:j})})]})}function de({className:e,render:t,children:n,icon:l,...u}){const i=t?void 0:"button",d={children:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"flex-1 truncate in-data-placeholder:text-muted-foreground/72",children:n}),l??r.jsx(P.default,{className:j})]}),className:a.cn(v,"min-w-0",e),"data-slot":"select-button",type:i};return A.useRender({defaultTagName:"button",props:W.mergeProps(d,u),render:t})}function _({className:e,...t}){return r.jsx(H.SelectValue,{className:a.cn("flex-1 truncate data-placeholder:text-muted-foreground",e),"data-slot":"select-value",...t})}function w({className:e,children:t,side:n="bottom",sideOffset:l=4,align:u="start",alignOffset:i=0,alignItemWithTrigger:d=!1,anchor:f,portalProps:c,...p}){return r.jsx(J.SelectPortal,{...c,children:r.jsx(Q.SelectPositioner,{align:u,alignItemWithTrigger:d,alignOffset:i,anchor:f,className:"z-50 select-none","data-slot":"select-positioner",side:n,sideOffset:l,children:r.jsxs(X.SelectPopup,{className:"origin-(--transform-origin) text-foreground outline-none duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2","data-slot":"select-popup",...p,children:[r.jsx(Y.SelectScrollUpArrow,{className:"top-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover","data-slot":"select-scroll-up-arrow",children:r.jsx(M.default,{className:"relative size-4.5 sm:size-4"})}),r.jsx("div",{className:"relative h-full min-w-(--anchor-width) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",children:r.jsx(Z.SelectList,{className:a.cn("max-h-[min(24rem,var(--available-height))] overflow-y-auto p-1",e),"data-slot":"select-list",children:t})}),r.jsx(ee.SelectScrollDownArrow,{className:"bottom-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover","data-slot":"select-scroll-down-arrow",children:r.jsx(U.default,{className:"relative size-4.5 sm:size-4"})})]})})})}function T({className:e,children:t,...n}){return r.jsxs(te.SelectItem,{className:a.cn("grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1fr_1rem] items-center gap-2 rounded-sm py-1 px-2 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),"data-slot":"select-item",...n,children:[r.jsx(re.SelectItemText,{className:"col-start-1 min-w-0",children:t}),r.jsx(oe.SelectItemIndicator,{className:"col-start-2",children:r.jsx("svg",{"aria-hidden":"true",fill:"none",height:"24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("path",{d:"M5.252 12.7 10.2 18.63 18.748 5.37"})})})]})}function fe({className:e,...t}){return r.jsx(ne.Separator,{className:a.cn("mx-2 my-1 h-px bg-border",e),"data-slot":"select-separator",...t})}function pe(e){return r.jsx(se.SelectGroup,{"data-slot":"select-group",...e})}function ge(e){return r.jsx(le.SelectGroupLabel,{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs","data-slot":"select-group-label",...e})}function me({className:e,...t}){return r.jsx(ae.SelectLabel,{className:a.cn("not-in-data-[slot=field]:mb-2 inline-flex cursor-default items-center gap-2 font-medium text-base/4.5 text-foreground sm:text-sm/4",e),"data-slot":"select-label",...t})}function be(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number")return String(e);if(typeof e=="object"){const t=e;if("label"in t)return String(t.label);if("name"in t)return String(t.name);if("title"in t)return String(t.title)}return String(e)}function Se(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number")return String(e);if(typeof e=="object"){const t=e;if("id"in t)return String(t.id);if("value"in t)return String(t.value)}return String(e)}function xe(e){return e!=null&&typeof e=="object"&&"disabled"in e?!!e.disabled:!1}function he(e){const{items:t,getLabel:n,getId:l,getDisabled:u,renderItem:i,placeholder:d,onValueChange:f,value:c,defaultValue:p,multiple:g,className:k,classNames:N,icon:D,"aria-invalid":y,...G}=e,q=n??be,S=l??Se,R=u??xe,m=o=>String(S(o)),x=o=>t.find(s=>m(s)===o)??null,I=ue.useRef(!1);if(process.env.NODE_ENV!=="production"&&!I.current){const o=new Set,s=new Set;for(const b of t){const h=m(b);o.has(h)&&s.add(h),o.add(h)}s.size>0&&(I.current=!0,console.warn(`[Select] Multiple items resolve to the same id (${[...s].join(", ")}). Provide a \`getId\` that returns a unique value per item.`))}const C=g?c?.map(o=>String(o)):c==null?c:String(c),V=g?p?.map(o=>String(o)):p==null?void 0:String(p),$=o=>{if(g){const b=(o??[]).map(x).filter(Boolean);f?.(b.map(S),b)}else{if(o==null){f?.(null,null);return}const s=x(o);f?.(s?S(s):null,s)}},B=o=>{const s=x(o);return s?q(s):o};return r.jsxs(z,{itemToStringLabel:B,multiple:g,value:C,defaultValue:V,onValueChange:$,...G,children:[r.jsx(L,{className:k,icon:D,...y===void 0?{}:{"aria-invalid":y},children:r.jsx(_,{placeholder:d})}),r.jsx(w,{className:N?.popup,children:t.map(o=>r.jsx(T,{value:m(o),disabled:R(o),className:N?.item,children:i?i(o):q(o)},m(o)))})]})}exports.Select=he;exports.SelectButton=de;exports.SelectContent=w;exports.SelectGroup=pe;exports.SelectGroupLabel=ge;exports.SelectItem=T;exports.SelectLabel=me;exports.SelectPopup=w;exports.SelectRoot=z;exports.SelectSeparator=fe;exports.SelectTrigger=L;exports.SelectValue=_;exports.selectTriggerClasses=v;exports.selectTriggerIconClassName=j;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),A=require("react"),z=require("../../node_modules/lucide-react/dist/esm/icons/chevrons-up-down.cjs.js"),M=require("../../node_modules/@base-ui/react/use-render/useRender.cjs.js"),U=require("../../node_modules/lucide-react/dist/esm/icons/chevron-up.cjs.js"),E=require("../../node_modules/lucide-react/dist/esm/icons/chevron-down.cjs.js"),P=require("../../utils/internal/item.cjs.js"),a=require("../../lib/cn.cjs.js"),K=require("../../node_modules/@base-ui/react/select/root/SelectRoot.cjs.js"),F=require("../../node_modules/@base-ui/react/select/trigger/SelectTrigger.cjs.js"),W=require("../../node_modules/@base-ui/react/select/icon/SelectIcon.cjs.js"),H=require("../../node_modules/@base-ui/react/merge-props/mergeProps.cjs.js"),J=require("../../node_modules/@base-ui/react/select/value/SelectValue.cjs.js"),Q=require("../../node_modules/@base-ui/react/select/portal/SelectPortal.cjs.js"),X=require("../../node_modules/@base-ui/react/select/positioner/SelectPositioner.cjs.js"),Y=require("../../node_modules/@base-ui/react/select/popup/SelectPopup.cjs.js"),Z=require("../../node_modules/@base-ui/react/select/scroll-up-arrow/SelectScrollUpArrow.cjs.js"),ee=require("../../node_modules/@base-ui/react/select/list/SelectList.cjs.js"),te=require("../../node_modules/@base-ui/react/select/scroll-down-arrow/SelectScrollDownArrow.cjs.js"),re=require("../../node_modules/@base-ui/react/select/item/SelectItem.cjs.js"),oe=require("../../node_modules/@base-ui/react/select/item-text/SelectItemText.cjs.js"),se=require("../../node_modules/@base-ui/react/select/item-indicator/SelectItemIndicator.cjs.js"),ne=require("../../node_modules/@base-ui/react/separator/Separator.cjs.js"),le=require("../../node_modules/@base-ui/react/select/group/SelectGroup.cjs.js"),ae=require("../../node_modules/@base-ui/react/select/group-label/SelectGroupLabel.cjs.js"),ce=require("../../node_modules/@base-ui/react/select/label/SelectLabel.cjs.js"),ie=require("../input/input.cjs.js");function ue(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const l=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(o,s,l.get?l:{enumerable:!0,get:()=>e[s]})}}return o.default=e,Object.freeze(o)}const de=ue(A),v=a.cn(ie.inputBaseClasses,"relative inline-flex items-center justify-between gap-2 select-none text-left text-foreground","focus-visible:border-ring","aria-invalid:border-error focus-visible:aria-invalid:ring-error/20","has-aria-invalid:border-error has-focus-visible:has-aria-invalid:ring-error/20","data-disabled:cursor-not-allowed data-disabled:opacity-50","[&_svg]:pointer-events-none [&_svg]:shrink-0"),j="-me-1 size-4.5 opacity-80 sm:size-4";function L({...e}){return t.jsx(K.SelectRoot,{...e})}function _({className:e,children:o,icon:s,...l}){return t.jsxs(F.SelectTrigger,{className:a.cn(v,e),"data-slot":"select-trigger",...l,children:[o,t.jsx(W.SelectIcon,{"data-slot":"select-icon",className:"text-muted-foreground hover:text-foreground transition-colors",children:s??t.jsx(z.default,{className:j})})]})}function fe({className:e,render:o,children:s,icon:l,...u}){const c=o?void 0:"button",d={children:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"flex-1 truncate in-data-placeholder:text-muted-foreground/72",children:s}),l??t.jsx(z.default,{className:j})]}),className:a.cn(v,"min-w-0",e),"data-slot":"select-button",type:c};return M.useRender({defaultTagName:"button",props:H.mergeProps(d,u),render:o})}function T({className:e,...o}){return t.jsx(J.SelectValue,{className:a.cn("flex-1 truncate data-placeholder:text-muted-foreground",e),"data-slot":"select-value",...o})}function w({className:e,children:o,side:s="bottom",sideOffset:l=4,align:u="start",alignOffset:c=0,alignItemWithTrigger:d=!1,anchor:f,portalProps:i,...m}){return t.jsx(Q.SelectPortal,{...i,children:t.jsx(X.SelectPositioner,{align:u,alignItemWithTrigger:d,alignOffset:c,anchor:f,className:"z-50 select-none","data-slot":"select-positioner",side:s,sideOffset:l,children:t.jsxs(Y.SelectPopup,{className:"origin-(--transform-origin) text-foreground outline-none duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2","data-slot":"select-popup",...m,children:[t.jsx(Z.SelectScrollUpArrow,{className:"top-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover","data-slot":"select-scroll-up-arrow",children:t.jsx(U.default,{className:"relative size-4.5 sm:size-4"})}),t.jsx("div",{className:"relative h-full min-w-(--anchor-width) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",children:t.jsx(ee.SelectList,{className:a.cn("max-h-[min(24rem,var(--available-height))] overflow-y-auto p-1",e),"data-slot":"select-list",children:o})}),t.jsx(te.SelectScrollDownArrow,{className:"bottom-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover","data-slot":"select-scroll-down-arrow",children:t.jsx(E.default,{className:"relative size-4.5 sm:size-4"})})]})})})}function k({className:e,children:o,...s}){return t.jsxs(re.SelectItem,{className:a.cn("grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1fr_1rem] items-center gap-2 rounded-sm py-1 px-2 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),"data-slot":"select-item",...s,children:[t.jsx(oe.SelectItemText,{className:"col-start-1 min-w-0",children:o}),t.jsx(se.SelectItemIndicator,{className:"col-start-2",children:t.jsx("svg",{"aria-hidden":"true",fill:"none",height:"24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M5.252 12.7 10.2 18.63 18.748 5.37"})})})]})}function me({className:e,...o}){return t.jsx(ne.Separator,{className:a.cn("mx-2 my-1 h-px bg-border",e),"data-slot":"select-separator",...o})}function pe(e){return t.jsx(le.SelectGroup,{"data-slot":"select-group",...e})}function ge(e){return t.jsx(ae.SelectGroupLabel,{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs","data-slot":"select-group-label",...e})}function be({className:e,...o}){return t.jsx(ce.SelectLabel,{className:a.cn("not-in-data-[slot=field]:mb-2 inline-flex cursor-default items-center gap-2 font-medium text-base/4.5 text-foreground sm:text-sm/4",e),"data-slot":"select-label",...o})}function Se(e){return e!=null&&typeof e=="object"&&"disabled"in e?!!e.disabled:!1}function xe(e){const{items:o,getLabel:s,getId:l,getDisabled:u,renderItem:c,placeholder:d,onValueChange:f,value:i,defaultValue:m,multiple:p,className:D,classNames:N,icon:G,"aria-invalid":q,...R}=e,y=s??P.defaultGetLabel,S=l??P.defaultGetId,C=u??Se,g=r=>String(S(r)),x=r=>o.find(n=>g(n)===r)??null,I=de.useRef(!1);if(process.env.NODE_ENV!=="production"&&!I.current){const r=new Set,n=new Set;for(const b of o){const h=g(b);r.has(h)&&n.add(h),r.add(h)}n.size>0&&(I.current=!0,console.warn(`[Select] Multiple items resolve to the same id (${[...n].join(", ")}). Provide a \`getId\` that returns a unique value per item.`))}const V=p?i?.map(r=>String(r)):i==null?i:String(i),$=p?m?.map(r=>String(r)):m==null?void 0:String(m),B=r=>{if(p){const b=(r??[]).map(x).filter(Boolean);f?.(b.map(S),b)}else{if(r==null){f?.(null,null);return}const n=x(r);f?.(n?S(n):null,n)}},O=r=>{const n=x(r);return n?y(n):r};return t.jsxs(L,{itemToStringLabel:O,multiple:p,value:V,defaultValue:$,onValueChange:B,...R,children:[t.jsx(_,{className:D,icon:G,...q===void 0?{}:{"aria-invalid":q},children:t.jsx(T,{placeholder:d})}),t.jsx(w,{className:N?.popup,children:o.map(r=>t.jsx(k,{value:g(r),disabled:C(r),className:N?.item,children:c?c(r):y(r)},g(r)))})]})}exports.Select=xe;exports.SelectButton=fe;exports.SelectContent=w;exports.SelectGroup=pe;exports.SelectGroupLabel=ge;exports.SelectItem=k;exports.SelectLabel=be;exports.SelectPopup=w;exports.SelectRoot=L;exports.SelectSeparator=me;exports.SelectTrigger=_;exports.SelectValue=T;exports.selectTriggerClasses=v;exports.selectTriggerIconClassName=j;
@@ -1,32 +1,33 @@
1
1
  "use client";
2
- import { jsx as r, jsxs as p, Fragment as T } from "react/jsx-runtime";
3
- import * as $ from "react";
2
+ import { jsx as t, jsxs as p, Fragment as $ } from "react/jsx-runtime";
3
+ import * as j from "react";
4
4
  import I from "../../node_modules/lucide-react/dist/esm/icons/chevrons-up-down.es.js";
5
5
  import { useRender as V } from "../../node_modules/@base-ui/react/use-render/useRender.es.js";
6
6
  import R from "../../node_modules/lucide-react/dist/esm/icons/chevron-up.es.js";
7
7
  import B from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.es.js";
8
- import { cn as l } from "../../lib/cn.es.js";
9
- import { SelectRoot as U } from "../../node_modules/@base-ui/react/select/root/SelectRoot.es.js";
10
- import { SelectTrigger as A } from "../../node_modules/@base-ui/react/select/trigger/SelectTrigger.es.js";
11
- import { SelectIcon as E } from "../../node_modules/@base-ui/react/select/icon/SelectIcon.es.js";
12
- import { mergeProps as K } from "../../node_modules/@base-ui/react/merge-props/mergeProps.es.js";
13
- import { SelectValue as M } from "../../node_modules/@base-ui/react/select/value/SelectValue.es.js";
14
- import { SelectPortal as q } from "../../node_modules/@base-ui/react/select/portal/SelectPortal.es.js";
15
- import { SelectPositioner as F } from "../../node_modules/@base-ui/react/select/positioner/SelectPositioner.es.js";
16
- import { SelectPopup as O } from "../../node_modules/@base-ui/react/select/popup/SelectPopup.es.js";
17
- import { SelectScrollUpArrow as W } from "../../node_modules/@base-ui/react/select/scroll-up-arrow/SelectScrollUpArrow.es.js";
18
- import { SelectList as H } from "../../node_modules/@base-ui/react/select/list/SelectList.es.js";
19
- import { SelectScrollDownArrow as J } from "../../node_modules/@base-ui/react/select/scroll-down-arrow/SelectScrollDownArrow.es.js";
20
- import { SelectItem as Q } from "../../node_modules/@base-ui/react/select/item/SelectItem.es.js";
21
- import { SelectItemText as X } from "../../node_modules/@base-ui/react/select/item-text/SelectItemText.es.js";
22
- import { SelectItemIndicator as Y } from "../../node_modules/@base-ui/react/select/item-indicator/SelectItemIndicator.es.js";
23
- import { Separator as Z } from "../../node_modules/@base-ui/react/separator/Separator.es.js";
24
- import { SelectGroup as ee } from "../../node_modules/@base-ui/react/select/group/SelectGroup.es.js";
25
- import { SelectGroupLabel as te } from "../../node_modules/@base-ui/react/select/group-label/SelectGroupLabel.es.js";
26
- import { SelectLabel as re } from "../../node_modules/@base-ui/react/select/label/SelectLabel.es.js";
27
- import { inputBaseClasses as oe } from "../input/input.es.js";
28
- const L = l(
29
- oe,
8
+ import { defaultGetLabel as U, defaultGetId as A } from "../../utils/internal/item.es.js";
9
+ import { cn as n } from "../../lib/cn.es.js";
10
+ import { SelectRoot as E } from "../../node_modules/@base-ui/react/select/root/SelectRoot.es.js";
11
+ import { SelectTrigger as K } from "../../node_modules/@base-ui/react/select/trigger/SelectTrigger.es.js";
12
+ import { SelectIcon as M } from "../../node_modules/@base-ui/react/select/icon/SelectIcon.es.js";
13
+ import { mergeProps as q } from "../../node_modules/@base-ui/react/merge-props/mergeProps.es.js";
14
+ import { SelectValue as F } from "../../node_modules/@base-ui/react/select/value/SelectValue.es.js";
15
+ import { SelectPortal as O } from "../../node_modules/@base-ui/react/select/portal/SelectPortal.es.js";
16
+ import { SelectPositioner as W } from "../../node_modules/@base-ui/react/select/positioner/SelectPositioner.es.js";
17
+ import { SelectPopup as H } from "../../node_modules/@base-ui/react/select/popup/SelectPopup.es.js";
18
+ import { SelectScrollUpArrow as J } from "../../node_modules/@base-ui/react/select/scroll-up-arrow/SelectScrollUpArrow.es.js";
19
+ import { SelectList as Q } from "../../node_modules/@base-ui/react/select/list/SelectList.es.js";
20
+ import { SelectScrollDownArrow as X } from "../../node_modules/@base-ui/react/select/scroll-down-arrow/SelectScrollDownArrow.es.js";
21
+ import { SelectItem as Y } from "../../node_modules/@base-ui/react/select/item/SelectItem.es.js";
22
+ import { SelectItemText as Z } from "../../node_modules/@base-ui/react/select/item-text/SelectItemText.es.js";
23
+ import { SelectItemIndicator as ee } from "../../node_modules/@base-ui/react/select/item-indicator/SelectItemIndicator.es.js";
24
+ import { Separator as te } from "../../node_modules/@base-ui/react/separator/Separator.es.js";
25
+ import { SelectGroup as oe } from "../../node_modules/@base-ui/react/select/group/SelectGroup.es.js";
26
+ import { SelectGroupLabel as re } from "../../node_modules/@base-ui/react/select/group-label/SelectGroupLabel.es.js";
27
+ import { SelectLabel as ae } from "../../node_modules/@base-ui/react/select/label/SelectLabel.es.js";
28
+ import { inputBaseClasses as le } from "../input/input.es.js";
29
+ const L = n(
30
+ le,
30
31
  "relative inline-flex items-center justify-between gap-2 select-none text-left text-foreground",
31
32
  "focus-visible:border-ring",
32
33
  "aria-invalid:border-error focus-visible:aria-invalid:ring-error/20",
@@ -34,130 +35,130 @@ const L = l(
34
35
  "data-disabled:cursor-not-allowed data-disabled:opacity-50",
35
36
  "[&_svg]:pointer-events-none [&_svg]:shrink-0"
36
37
  ), k = "-me-1 size-4.5 opacity-80 sm:size-4";
37
- function ae({
38
+ function ne({
38
39
  ...e
39
40
  }) {
40
- return /* @__PURE__ */ r(U, { ...e });
41
+ return /* @__PURE__ */ t(E, { ...e });
41
42
  }
42
- function ne({
43
+ function se({
43
44
  className: e,
44
- children: t,
45
- icon: n,
45
+ children: r,
46
+ icon: l,
46
47
  ...s
47
48
  }) {
48
49
  return /* @__PURE__ */ p(
49
- A,
50
+ K,
50
51
  {
51
- className: l(L, e),
52
+ className: n(L, e),
52
53
  "data-slot": "select-trigger",
53
54
  ...s,
54
55
  children: [
55
- t,
56
- /* @__PURE__ */ r(
57
- E,
56
+ r,
57
+ /* @__PURE__ */ t(
58
+ M,
58
59
  {
59
60
  "data-slot": "select-icon",
60
61
  className: "text-muted-foreground hover:text-foreground transition-colors",
61
- children: n ?? /* @__PURE__ */ r(I, { className: k })
62
+ children: l ?? /* @__PURE__ */ t(I, { className: k })
62
63
  }
63
64
  )
64
65
  ]
65
66
  }
66
67
  );
67
68
  }
68
- function Ue({
69
+ function Ae({
69
70
  className: e,
70
- render: t,
71
- children: n,
71
+ render: r,
72
+ children: l,
72
73
  icon: s,
73
74
  ...d
74
75
  }) {
75
- const i = t ? void 0 : "button", u = {
76
- children: /* @__PURE__ */ p(T, { children: [
77
- /* @__PURE__ */ r("span", { className: "flex-1 truncate in-data-placeholder:text-muted-foreground/72", children: n }),
78
- s ?? /* @__PURE__ */ r(I, { className: k })
76
+ const i = r ? void 0 : "button", m = {
77
+ children: /* @__PURE__ */ p($, { children: [
78
+ /* @__PURE__ */ t("span", { className: "flex-1 truncate in-data-placeholder:text-muted-foreground/72", children: l }),
79
+ s ?? /* @__PURE__ */ t(I, { className: k })
79
80
  ] }),
80
- className: l(L, "min-w-0", e),
81
+ className: n(L, "min-w-0", e),
81
82
  "data-slot": "select-button",
82
83
  type: i
83
84
  };
84
85
  return V({
85
86
  defaultTagName: "button",
86
- props: K(u, d),
87
- render: t
87
+ props: q(m, d),
88
+ render: r
88
89
  });
89
90
  }
90
- function le({
91
+ function ie({
91
92
  className: e,
92
- ...t
93
+ ...r
93
94
  }) {
94
- return /* @__PURE__ */ r(
95
- M,
95
+ return /* @__PURE__ */ t(
96
+ F,
96
97
  {
97
- className: l(
98
+ className: n(
98
99
  "flex-1 truncate data-placeholder:text-muted-foreground",
99
100
  e
100
101
  ),
101
102
  "data-slot": "select-value",
102
- ...t
103
+ ...r
103
104
  }
104
105
  );
105
106
  }
106
- function se({
107
+ function ce({
107
108
  className: e,
108
- children: t,
109
- side: n = "bottom",
109
+ children: r,
110
+ side: l = "bottom",
110
111
  sideOffset: s = 4,
111
112
  align: d = "start",
112
113
  alignOffset: i = 0,
113
- alignItemWithTrigger: u = !1,
114
- anchor: f,
114
+ alignItemWithTrigger: m = !1,
115
+ anchor: u,
115
116
  portalProps: c,
116
- ...m
117
+ ...f
117
118
  }) {
118
- return /* @__PURE__ */ r(q, { ...c, children: /* @__PURE__ */ r(
119
- F,
119
+ return /* @__PURE__ */ t(O, { ...c, children: /* @__PURE__ */ t(
120
+ W,
120
121
  {
121
122
  align: d,
122
- alignItemWithTrigger: u,
123
+ alignItemWithTrigger: m,
123
124
  alignOffset: i,
124
- anchor: f,
125
+ anchor: u,
125
126
  className: "z-50 select-none",
126
127
  "data-slot": "select-positioner",
127
- side: n,
128
+ side: l,
128
129
  sideOffset: s,
129
130
  children: /* @__PURE__ */ p(
130
- O,
131
+ H,
131
132
  {
132
133
  className: "origin-(--transform-origin) text-foreground outline-none duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2",
133
134
  "data-slot": "select-popup",
134
- ...m,
135
+ ...f,
135
136
  children: [
136
- /* @__PURE__ */ r(
137
- W,
137
+ /* @__PURE__ */ t(
138
+ J,
138
139
  {
139
140
  className: "top-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover",
140
141
  "data-slot": "select-scroll-up-arrow",
141
- children: /* @__PURE__ */ r(R, { className: "relative size-4.5 sm:size-4" })
142
+ children: /* @__PURE__ */ t(R, { className: "relative size-4.5 sm:size-4" })
142
143
  }
143
144
  ),
144
- /* @__PURE__ */ r("div", { className: "relative h-full min-w-(--anchor-width) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]", children: /* @__PURE__ */ r(
145
- H,
145
+ /* @__PURE__ */ t("div", { className: "relative h-full min-w-(--anchor-width) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]", children: /* @__PURE__ */ t(
146
+ Q,
146
147
  {
147
- className: l(
148
+ className: n(
148
149
  "max-h-[min(24rem,var(--available-height))] overflow-y-auto p-1",
149
150
  e
150
151
  ),
151
152
  "data-slot": "select-list",
152
- children: t
153
+ children: r
153
154
  }
154
155
  ) }),
155
- /* @__PURE__ */ r(
156
- J,
156
+ /* @__PURE__ */ t(
157
+ X,
157
158
  {
158
159
  className: "bottom-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover",
159
160
  "data-slot": "select-scroll-down-arrow",
160
- children: /* @__PURE__ */ r(B, { className: "relative size-4.5 sm:size-4" })
161
+ children: /* @__PURE__ */ t(B, { className: "relative size-4.5 sm:size-4" })
161
162
  }
162
163
  )
163
164
  ]
@@ -166,23 +167,23 @@ function se({
166
167
  }
167
168
  ) });
168
169
  }
169
- function ie({
170
+ function de({
170
171
  className: e,
171
- children: t,
172
- ...n
172
+ children: r,
173
+ ...l
173
174
  }) {
174
175
  return /* @__PURE__ */ p(
175
- Q,
176
+ Y,
176
177
  {
177
- className: l(
178
+ className: n(
178
179
  "grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1fr_1rem] items-center gap-2 rounded-sm py-1 px-2 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
179
180
  e
180
181
  ),
181
182
  "data-slot": "select-item",
182
- ...n,
183
+ ...l,
183
184
  children: [
184
- /* @__PURE__ */ r(X, { className: "col-start-1 min-w-0", children: t }),
185
- /* @__PURE__ */ r(Y, { className: "col-start-2", children: /* @__PURE__ */ r(
185
+ /* @__PURE__ */ t(Z, { className: "col-start-1 min-w-0", children: r }),
186
+ /* @__PURE__ */ t(ee, { className: "col-start-2", children: /* @__PURE__ */ t(
186
187
  "svg",
187
188
  {
188
189
  "aria-hidden": "true",
@@ -195,32 +196,32 @@ function ie({
195
196
  viewBox: "0 0 24 24",
196
197
  width: "24",
197
198
  xmlns: "http://www.w3.org/2000/svg",
198
- children: /* @__PURE__ */ r("path", { d: "M5.252 12.7 10.2 18.63 18.748 5.37" })
199
+ children: /* @__PURE__ */ t("path", { d: "M5.252 12.7 10.2 18.63 18.748 5.37" })
199
200
  }
200
201
  ) })
201
202
  ]
202
203
  }
203
204
  );
204
205
  }
205
- function Ae({
206
+ function Ee({
206
207
  className: e,
207
- ...t
208
+ ...r
208
209
  }) {
209
- return /* @__PURE__ */ r(
210
- Z,
210
+ return /* @__PURE__ */ t(
211
+ te,
211
212
  {
212
- className: l("mx-2 my-1 h-px bg-border", e),
213
+ className: n("mx-2 my-1 h-px bg-border", e),
213
214
  "data-slot": "select-separator",
214
- ...t
215
+ ...r
215
216
  }
216
217
  );
217
218
  }
218
- function Ee(e) {
219
- return /* @__PURE__ */ r(ee, { "data-slot": "select-group", ...e });
220
- }
221
219
  function Ke(e) {
222
- return /* @__PURE__ */ r(
223
- te,
220
+ return /* @__PURE__ */ t(oe, { "data-slot": "select-group", ...e });
221
+ }
222
+ function Me(e) {
223
+ return /* @__PURE__ */ t(
224
+ re,
224
225
  {
225
226
  className: "px-2 py-1.5 font-medium text-muted-foreground text-xs",
226
227
  "data-slot": "select-group-label",
@@ -228,67 +229,46 @@ function Ke(e) {
228
229
  }
229
230
  );
230
231
  }
231
- function Me({
232
+ function qe({
232
233
  className: e,
233
- ...t
234
+ ...r
234
235
  }) {
235
- return /* @__PURE__ */ r(
236
- re,
236
+ return /* @__PURE__ */ t(
237
+ ae,
237
238
  {
238
- className: l(
239
+ className: n(
239
240
  "not-in-data-[slot=field]:mb-2 inline-flex cursor-default items-center gap-2 font-medium text-base/4.5 text-foreground sm:text-sm/4",
240
241
  e
241
242
  ),
242
243
  "data-slot": "select-label",
243
- ...t
244
+ ...r
244
245
  }
245
246
  );
246
247
  }
247
- function ce(e) {
248
- if (e == null) return "";
249
- if (typeof e == "string" || typeof e == "number") return String(e);
250
- if (typeof e == "object") {
251
- const t = e;
252
- if ("label" in t) return String(t.label);
253
- if ("name" in t) return String(t.name);
254
- if ("title" in t) return String(t.title);
255
- }
256
- return String(e);
257
- }
258
- function de(e) {
259
- if (e == null) return "";
260
- if (typeof e == "string" || typeof e == "number") return String(e);
261
- if (typeof e == "object") {
262
- const t = e;
263
- if ("id" in t) return String(t.id);
264
- if ("value" in t) return String(t.value);
265
- }
266
- return String(e);
267
- }
268
- function ue(e) {
248
+ function me(e) {
269
249
  return e != null && typeof e == "object" && "disabled" in e ? !!e.disabled : !1;
270
250
  }
271
- function qe(e) {
251
+ function Fe(e) {
272
252
  const {
273
- items: t,
274
- getLabel: n,
253
+ items: r,
254
+ getLabel: l,
275
255
  getId: s,
276
256
  getDisabled: d,
277
257
  renderItem: i,
278
- placeholder: u,
279
- onValueChange: f,
258
+ placeholder: m,
259
+ onValueChange: u,
280
260
  value: c,
281
- defaultValue: m,
261
+ defaultValue: f,
282
262
  multiple: g,
283
263
  className: C,
284
264
  classNames: w,
285
265
  icon: _,
286
266
  "aria-invalid": N,
287
267
  ...P
288
- } = e, y = n ?? ce, S = s ?? de, j = d ?? ue, b = (o) => String(S(o)), v = (o) => t.find((a) => b(a) === o) ?? null, z = $.useRef(!1);
268
+ } = e, y = l ?? U, v = s ?? A, D = d ?? me, b = (o) => String(v(o)), S = (o) => r.find((a) => b(a) === o) ?? null, z = j.useRef(!1);
289
269
  if (process.env.NODE_ENV !== "production" && !z.current) {
290
270
  const o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
291
- for (const h of t) {
271
+ for (const h of r) {
292
272
  const x = b(h);
293
273
  o.has(x) && a.add(x), o.add(x);
294
274
  }
@@ -296,48 +276,48 @@ function qe(e) {
296
276
  `[Select] Multiple items resolve to the same id (${[...a].join(", ")}). Provide a \`getId\` that returns a unique value per item.`
297
277
  ));
298
278
  }
299
- const D = g ? c?.map((o) => String(o)) : c == null ? c : String(c), G = g ? m?.map(
279
+ const G = g ? c?.map((o) => String(o)) : c == null ? c : String(c), T = g ? f?.map(
300
280
  (o) => String(o)
301
- ) : m == null ? void 0 : String(m);
281
+ ) : f == null ? void 0 : String(f);
302
282
  return /* @__PURE__ */ p(
303
- ae,
283
+ ne,
304
284
  {
305
285
  itemToStringLabel: (o) => {
306
- const a = v(o);
286
+ const a = S(o);
307
287
  return a ? y(a) : o;
308
288
  },
309
289
  multiple: g,
310
- value: D,
311
- defaultValue: G,
290
+ value: G,
291
+ defaultValue: T,
312
292
  onValueChange: (o) => {
313
293
  if (g) {
314
- const h = (o ?? []).map(v).filter(Boolean);
315
- f?.(h.map(S), h);
294
+ const h = (o ?? []).map(S).filter(Boolean);
295
+ u?.(h.map(v), h);
316
296
  } else {
317
297
  if (o == null) {
318
- f?.(null, null);
298
+ u?.(null, null);
319
299
  return;
320
300
  }
321
- const a = v(o);
322
- f?.(a ? S(a) : null, a);
301
+ const a = S(o);
302
+ u?.(a ? v(a) : null, a);
323
303
  }
324
304
  },
325
305
  ...P,
326
306
  children: [
327
- /* @__PURE__ */ r(
328
- ne,
307
+ /* @__PURE__ */ t(
308
+ se,
329
309
  {
330
310
  className: C,
331
311
  icon: _,
332
312
  ...N === void 0 ? {} : { "aria-invalid": N },
333
- children: /* @__PURE__ */ r(le, { placeholder: u })
313
+ children: /* @__PURE__ */ t(ie, { placeholder: m })
334
314
  }
335
315
  ),
336
- /* @__PURE__ */ r(se, { className: w?.popup, children: t.map((o) => /* @__PURE__ */ r(
337
- ie,
316
+ /* @__PURE__ */ t(ce, { className: w?.popup, children: r.map((o) => /* @__PURE__ */ t(
317
+ de,
338
318
  {
339
319
  value: b(o),
340
- disabled: j(o),
320
+ disabled: D(o),
341
321
  className: w?.item,
342
322
  children: i ? i(o) : y(o)
343
323
  },
@@ -348,18 +328,18 @@ function qe(e) {
348
328
  );
349
329
  }
350
330
  export {
351
- qe as Select,
352
- Ue as SelectButton,
353
- se as SelectContent,
354
- Ee as SelectGroup,
355
- Ke as SelectGroupLabel,
356
- ie as SelectItem,
357
- Me as SelectLabel,
358
- se as SelectPopup,
359
- ae as SelectRoot,
360
- Ae as SelectSeparator,
361
- ne as SelectTrigger,
362
- le as SelectValue,
331
+ Fe as Select,
332
+ Ae as SelectButton,
333
+ ce as SelectContent,
334
+ Ke as SelectGroup,
335
+ Me as SelectGroupLabel,
336
+ de as SelectItem,
337
+ qe as SelectLabel,
338
+ ce as SelectPopup,
339
+ ne as SelectRoot,
340
+ Ee as SelectSeparator,
341
+ se as SelectTrigger,
342
+ ie as SelectValue,
363
343
  L as selectTriggerClasses,
364
344
  k as selectTriggerIconClassName
365
345
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),f=require("../internal/use-latest-ref.cjs.js"),G=10,O=1;function m(e,r){return e<=0||Number.isNaN(e)?(process.env.NODE_ENV!=="production"&&(!r||!r.current)&&(r&&(r.current=!0),console.warn(`[usePagination] pageSize must be a positive number, received ${e}. Coercing to 1.`)),1):Math.floor(e)}function U(e,r){return e<=0?0:Math.ceil(e/r)}function d(e,r){return r<=0||Number.isNaN(e)?1:Math.min(Math.max(1,Math.floor(e)),r)}function j({totalItems:e,pageSize:r,defaultPageSize:z=G,onPageSizeChange:b,page:C,defaultPage:A=O,onPageChange:T,onPaginationChange:_}){const[p,R]=n.useState(A),[S,h]=n.useState(z),x=n.useRef(!1),c=m(r??S,x),o=U(e,c),u=d(C??p,o),i=f.useLatestRef(u),y=f.useLatestRef(c),s=f.useLatestRef(o),L=f.useLatestRef(T),N=f.useLatestRef(b),D=f.useLatestRef(_),P=n.useRef(!1),l=n.useRef(null),E=n.useRef(null);n.useEffect(()=>{if(!P.current)return;const t=d(p,s.current);l.current!==t&&(l.current=t,L.current?.(t))},[p]),n.useEffect(()=>{if(!P.current)return;const t=m(S);E.current!==t&&(E.current=t,N.current?.(t))},[S]),n.useEffect(()=>{P.current&&D.current?.({page:u,pageSize:c})},[u,c]),n.useEffect(()=>{P.current=!0},[]);const F=n.useMemo(()=>{const t=g=>{const a=d(g,s.current);a!==i.current&&R(a)};return{goTo:g=>{s.current<=0||t(g)},next:()=>{i.current>=s.current||t(i.current+1)},prev:()=>{i.current<=1||t(i.current-1)},firstPage:()=>{s.current<=0||t(1)},lastPage:()=>{s.current<=0||t(s.current)},setPageSize:g=>{const a=m(g);a!==y.current&&(E.current=a,h(a),N.current?.(a),i.current!==1&&(l.current=1,L.current?.(1)),R(1))}}},[R,h]),v=o<=0?!0:u<=1,M=o<=0?!0:u>=o,q=e<=0?{start:0,end:0}:{start:(u-1)*c+1,end:Math.min(u*c,e)};return{page:u,pageSize:c,pageCount:o,isFirstPage:v,isLastPage:M,hasPrevPage:!v,hasNextPage:!M,range:q,...F}}exports.usePagination=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),o=require("../internal/use-latest-ref.cjs.js"),O=10,U=1;function d(e,r){return e<=0||Number.isNaN(e)?(process.env.NODE_ENV!=="production"&&(!r||!r.current)&&(r&&(r.current=!0),console.warn(`[usePagination] pageSize must be a positive number, received ${e}. Coercing to 1.`)),1):Math.floor(e)}function j(e,r){return e<=0?0:Math.ceil(e/r)}function h(e,r){return r<=0||Number.isNaN(e)?1:Math.min(Math.max(1,Math.floor(e)),r)}function V({totalItems:e,pageSize:r,defaultPageSize:z=O,onPageSizeChange:b,page:C,defaultPage:A=U,onPageChange:T,onPaginationChange:_}){const[P,S]=n.useState(A),[l,L]=n.useState(z),x=n.useRef(!1),s=d(r??l,x),i=j(e,s),c=h(C??P,i),f=o.useLatestRef(c),y=o.useLatestRef(P),D=o.useLatestRef(s),a=o.useLatestRef(i),E=o.useLatestRef(T),N=o.useLatestRef(b),F=o.useLatestRef(_),R=n.useRef(!1),p=n.useRef(null),m=n.useRef(null);n.useEffect(()=>{if(!R.current)return;const t=h(P,a.current);p.current!==t&&(p.current=t,E.current?.(t))},[P]),n.useEffect(()=>{if(!R.current)return;const t=d(l);m.current!==t&&(m.current=t,N.current?.(t))},[l]),n.useEffect(()=>{R.current&&F.current?.({page:c,pageSize:s})},[c,s]),n.useEffect(()=>{R.current=!0},[]);const q=n.useMemo(()=>{const t=g=>{const u=h(g,a.current);u!==f.current&&(y.current===u&&(p.current=u,E.current?.(u)),S(u))};return{goTo:g=>{a.current<=0||t(g)},next:()=>{f.current>=a.current||t(f.current+1)},prev:()=>{f.current<=1||t(f.current-1)},firstPage:()=>{a.current<=0||t(1)},lastPage:()=>{a.current<=0||t(a.current)},setPageSize:g=>{const u=d(g);u!==D.current&&(m.current=u,L(u),N.current?.(u),f.current!==1&&(p.current=1,E.current?.(1)),S(1))}}},[S,L]),v=i<=0?!0:c<=1,M=i<=0?!0:c>=i,G=e<=0?{start:0,end:0}:{start:(c-1)*s+1,end:Math.min(c*s,e)};return{page:c,pageSize:s,pageCount:i,isFirstPage:v,isLastPage:M,hasPrevPage:!v,hasNextPage:!M,range:G,...q}}exports.usePagination=V;