@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.
- package/dist/components/combobox/combobox.cjs.js +1 -1
- package/dist/components/combobox/combobox.es.js +198 -218
- package/dist/components/select/select.cjs.js +1 -1
- package/dist/components/select/select.es.js +139 -159
- package/dist/hooks/use-pagination/use-pagination.cjs.js +1 -1
- package/dist/hooks/use-pagination/use-pagination.es.js +39 -39
- package/dist/src/components/combobox/combobox.d.ts +4 -16
- package/dist/src/components/select/select.d.ts +4 -17
- package/dist/src/utils/internal/index.d.ts +2 -0
- package/dist/src/utils/internal/item.d.ts +27 -0
- package/dist/utils/internal/item.cjs.js +1 -0
- package/dist/utils/internal/item.es.js +25 -0
- package/package.json +1 -1
- package/src/components/combobox/combobox.test.tsx +25 -0
- package/src/components/combobox/combobox.tsx +9 -43
- package/src/components/select/select.test.tsx +18 -0
- package/src/components/select/select.tsx +12 -46
- package/src/hooks/use-pagination/use-pagination.test.tsx +26 -0
- package/src/hooks/use-pagination/use-pagination.ts +9 -0
- package/src/utils/internal/index.ts +2 -0
- package/src/utils/internal/item.ts +51 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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
|
|
3
|
-
import * as
|
|
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 {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
38
|
+
function ne({
|
|
38
39
|
...e
|
|
39
40
|
}) {
|
|
40
|
-
return /* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ t(E, { ...e });
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
+
function se({
|
|
43
44
|
className: e,
|
|
44
|
-
children:
|
|
45
|
-
icon:
|
|
45
|
+
children: r,
|
|
46
|
+
icon: l,
|
|
46
47
|
...s
|
|
47
48
|
}) {
|
|
48
49
|
return /* @__PURE__ */ p(
|
|
49
|
-
|
|
50
|
+
K,
|
|
50
51
|
{
|
|
51
|
-
className:
|
|
52
|
+
className: n(L, e),
|
|
52
53
|
"data-slot": "select-trigger",
|
|
53
54
|
...s,
|
|
54
55
|
children: [
|
|
55
|
-
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
|
|
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:
|
|
62
|
+
children: l ?? /* @__PURE__ */ t(I, { className: k })
|
|
62
63
|
}
|
|
63
64
|
)
|
|
64
65
|
]
|
|
65
66
|
}
|
|
66
67
|
);
|
|
67
68
|
}
|
|
68
|
-
function
|
|
69
|
+
function Ae({
|
|
69
70
|
className: e,
|
|
70
|
-
render:
|
|
71
|
-
children:
|
|
71
|
+
render: r,
|
|
72
|
+
children: l,
|
|
72
73
|
icon: s,
|
|
73
74
|
...d
|
|
74
75
|
}) {
|
|
75
|
-
const i =
|
|
76
|
-
children: /* @__PURE__ */ p(
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
s ?? /* @__PURE__ */
|
|
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:
|
|
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:
|
|
87
|
-
render:
|
|
87
|
+
props: q(m, d),
|
|
88
|
+
render: r
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
|
-
function
|
|
91
|
+
function ie({
|
|
91
92
|
className: e,
|
|
92
|
-
...
|
|
93
|
+
...r
|
|
93
94
|
}) {
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
|
|
95
|
+
return /* @__PURE__ */ t(
|
|
96
|
+
F,
|
|
96
97
|
{
|
|
97
|
-
className:
|
|
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
|
-
...
|
|
103
|
+
...r
|
|
103
104
|
}
|
|
104
105
|
);
|
|
105
106
|
}
|
|
106
|
-
function
|
|
107
|
+
function ce({
|
|
107
108
|
className: e,
|
|
108
|
-
children:
|
|
109
|
-
side:
|
|
109
|
+
children: r,
|
|
110
|
+
side: l = "bottom",
|
|
110
111
|
sideOffset: s = 4,
|
|
111
112
|
align: d = "start",
|
|
112
113
|
alignOffset: i = 0,
|
|
113
|
-
alignItemWithTrigger:
|
|
114
|
-
anchor:
|
|
114
|
+
alignItemWithTrigger: m = !1,
|
|
115
|
+
anchor: u,
|
|
115
116
|
portalProps: c,
|
|
116
|
-
...
|
|
117
|
+
...f
|
|
117
118
|
}) {
|
|
118
|
-
return /* @__PURE__ */
|
|
119
|
-
|
|
119
|
+
return /* @__PURE__ */ t(O, { ...c, children: /* @__PURE__ */ t(
|
|
120
|
+
W,
|
|
120
121
|
{
|
|
121
122
|
align: d,
|
|
122
|
-
alignItemWithTrigger:
|
|
123
|
+
alignItemWithTrigger: m,
|
|
123
124
|
alignOffset: i,
|
|
124
|
-
anchor:
|
|
125
|
+
anchor: u,
|
|
125
126
|
className: "z-50 select-none",
|
|
126
127
|
"data-slot": "select-positioner",
|
|
127
|
-
side:
|
|
128
|
+
side: l,
|
|
128
129
|
sideOffset: s,
|
|
129
130
|
children: /* @__PURE__ */ p(
|
|
130
|
-
|
|
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
|
-
...
|
|
135
|
+
...f,
|
|
135
136
|
children: [
|
|
136
|
-
/* @__PURE__ */
|
|
137
|
-
|
|
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__ */
|
|
142
|
+
children: /* @__PURE__ */ t(R, { className: "relative size-4.5 sm:size-4" })
|
|
142
143
|
}
|
|
143
144
|
),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
|
|
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:
|
|
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:
|
|
153
|
+
children: r
|
|
153
154
|
}
|
|
154
155
|
) }),
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
|
|
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__ */
|
|
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
|
|
170
|
+
function de({
|
|
170
171
|
className: e,
|
|
171
|
-
children:
|
|
172
|
-
...
|
|
172
|
+
children: r,
|
|
173
|
+
...l
|
|
173
174
|
}) {
|
|
174
175
|
return /* @__PURE__ */ p(
|
|
175
|
-
|
|
176
|
+
Y,
|
|
176
177
|
{
|
|
177
|
-
className:
|
|
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
|
-
...
|
|
183
|
+
...l,
|
|
183
184
|
children: [
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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
|
|
206
|
+
function Ee({
|
|
206
207
|
className: e,
|
|
207
|
-
...
|
|
208
|
+
...r
|
|
208
209
|
}) {
|
|
209
|
-
return /* @__PURE__ */
|
|
210
|
-
|
|
210
|
+
return /* @__PURE__ */ t(
|
|
211
|
+
te,
|
|
211
212
|
{
|
|
212
|
-
className:
|
|
213
|
+
className: n("mx-2 my-1 h-px bg-border", e),
|
|
213
214
|
"data-slot": "select-separator",
|
|
214
|
-
...
|
|
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__ */
|
|
223
|
-
|
|
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
|
|
232
|
+
function qe({
|
|
232
233
|
className: e,
|
|
233
|
-
...
|
|
234
|
+
...r
|
|
234
235
|
}) {
|
|
235
|
-
return /* @__PURE__ */
|
|
236
|
-
|
|
236
|
+
return /* @__PURE__ */ t(
|
|
237
|
+
ae,
|
|
237
238
|
{
|
|
238
|
-
className:
|
|
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
|
-
...
|
|
244
|
+
...r
|
|
244
245
|
}
|
|
245
246
|
);
|
|
246
247
|
}
|
|
247
|
-
function
|
|
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
|
|
251
|
+
function Fe(e) {
|
|
272
252
|
const {
|
|
273
|
-
items:
|
|
274
|
-
getLabel:
|
|
253
|
+
items: r,
|
|
254
|
+
getLabel: l,
|
|
275
255
|
getId: s,
|
|
276
256
|
getDisabled: d,
|
|
277
257
|
renderItem: i,
|
|
278
|
-
placeholder:
|
|
279
|
-
onValueChange:
|
|
258
|
+
placeholder: m,
|
|
259
|
+
onValueChange: u,
|
|
280
260
|
value: c,
|
|
281
|
-
defaultValue:
|
|
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 =
|
|
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
|
|
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
|
|
279
|
+
const G = g ? c?.map((o) => String(o)) : c == null ? c : String(c), T = g ? f?.map(
|
|
300
280
|
(o) => String(o)
|
|
301
|
-
) :
|
|
281
|
+
) : f == null ? void 0 : String(f);
|
|
302
282
|
return /* @__PURE__ */ p(
|
|
303
|
-
|
|
283
|
+
ne,
|
|
304
284
|
{
|
|
305
285
|
itemToStringLabel: (o) => {
|
|
306
|
-
const a =
|
|
286
|
+
const a = S(o);
|
|
307
287
|
return a ? y(a) : o;
|
|
308
288
|
},
|
|
309
289
|
multiple: g,
|
|
310
|
-
value:
|
|
311
|
-
defaultValue:
|
|
290
|
+
value: G,
|
|
291
|
+
defaultValue: T,
|
|
312
292
|
onValueChange: (o) => {
|
|
313
293
|
if (g) {
|
|
314
|
-
const h = (o ?? []).map(
|
|
315
|
-
|
|
294
|
+
const h = (o ?? []).map(S).filter(Boolean);
|
|
295
|
+
u?.(h.map(v), h);
|
|
316
296
|
} else {
|
|
317
297
|
if (o == null) {
|
|
318
|
-
|
|
298
|
+
u?.(null, null);
|
|
319
299
|
return;
|
|
320
300
|
}
|
|
321
|
-
const a =
|
|
322
|
-
|
|
301
|
+
const a = S(o);
|
|
302
|
+
u?.(a ? v(a) : null, a);
|
|
323
303
|
}
|
|
324
304
|
},
|
|
325
305
|
...P,
|
|
326
306
|
children: [
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
|
|
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__ */
|
|
313
|
+
children: /* @__PURE__ */ t(ie, { placeholder: m })
|
|
334
314
|
}
|
|
335
315
|
),
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
|
|
316
|
+
/* @__PURE__ */ t(ce, { className: w?.popup, children: r.map((o) => /* @__PURE__ */ t(
|
|
317
|
+
de,
|
|
338
318
|
{
|
|
339
319
|
value: b(o),
|
|
340
|
-
disabled:
|
|
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
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
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"),
|
|
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;
|