@clasing/ui 0.1.125 → 0.1.126
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/blocks/date-range-picker.cjs.js +1 -1
- package/dist/components/blocks/date-range-picker.es.js +46 -38
- package/dist/components/checkbox.cjs.js +1 -1
- package/dist/components/checkbox.es.js +1 -1
- package/dist/components/multi-select.cjs.js +1 -1
- package/dist/components/multi-select.d.ts +2 -1
- package/dist/components/multi-select.es.js +89 -83
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../jsx-runtime-DUiatUiq.cjs"),$=require("../../label-CbzkBbPT.cjs"),b=require("../../index-DoxiiusW.cjs"),I=require("../../index-C8P6Mn4U.cjs"),a=require("date-fns"),w=require("react"),T=require("react-day-picker"),f=require("../../style-CA5976Oh.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../jsx-runtime-DUiatUiq.cjs"),$=require("../../label-CbzkBbPT.cjs"),b=require("../../index-DoxiiusW.cjs"),I=require("../../index-C8P6Mn4U.cjs"),a=require("date-fns"),w=require("react"),T=require("react-day-picker"),f=require("../../style-CA5976Oh.cjs"),N=require("../../icon-component-LY_vGYHZ.cjs"),j=require("../../popover-B8wp2cHF.cjs"),L=I.cva("border-neutral-050 focus-visible:ring-ring-default lg:hover:bg-neutral-000 flex w-full items-center gap-2 border-[0.5px] bg-white text-base whitespace-pre-wrap focus-visible:ring-[1.5px] focus-visible:ring-offset-1 focus-visible:outline-hidden disabled:border-neutral-100 disabled:bg-neutral-100 disabled:text-neutral-700 lg:disabled:hover:bg-neutral-100",{variants:{size:{sm:"text-label-md h-8 rounded-sm px-2 py-1",md:"text-label-lg h-12 rounded-md px-3 py-1",lg:"text-label-xl h-16 rounded-lg px-4 py-2"},rounded:{default:"",full:"rounded-full"},state:{default:"",selected:"bg-blue-050 focus:blue-800 border-blue-800 font-semibold text-blue-800 active:border-blue-800 lg:hover:bg-blue-100",error:"border-error-main"}},defaultVariants:{size:"md",rounded:"default",state:"default"}}),B=({onChange:d,value:o,options:x})=>e.jsxRuntimeExports.jsx("select",{className:"text-md focus-visible:ring-ring-default h-fit w-fit! cursor-pointer appearance-none rounded-md border-none pr-9 pl-1 font-semibold transition-colors focus:border-0 focus:border-transparent focus:ring-0 focus:ring-transparent focus:outline-hidden focus-visible:ring-[1.5px] focus-visible:ring-offset-1 focus-visible:outline-hidden",onChange:d,value:o,children:x?.map((n,m)=>{const g=n.value===o;return e.jsxRuntimeExports.jsx("option",{value:n.value,disabled:n.disabled,className:b.cn("disabled:hidden",{"bg-blue-050 font-semibold text-blue-800":g}),children:n.label},m)})}),G=({orientation:d="down",size:o=16})=>e.jsxRuntimeExports.jsx(N.IconComponent,{iconName:d==="left"?"IconChevronLeft":"IconChevronRight",stroke:"1.5",size:o}),F=w.forwardRef(({className:d,locale:o="enGB",placeholder:x,label:n,size:m="md",rounded:g="default",disabledDates:E,helperText:C,side:q="bottom",align:M="center",error:c,touched:p,startDate:i,endDate:l,calendarDropdowns:S=!0,onChange:R,minDate:k,maxDate:_,disabled:h=!1,...u},z)=>{const[t,v]=w.useState({from:i?new Date(i):void 0,to:l?new Date(l):void 0}),D=r=>{if(v(r),R){const s={from:r.from?a.format(r.from,"yyyy-MM-dd"):"",to:r.to?a.format(r.to,"yyyy-MM-dd"):""};R({target:{name:u.name,value:s}})}};w.useEffect(()=>{if(i){const r=new Date(i);isNaN(r.getTime())||v(s=>({...s,from:r}))}if(l){const r=new Date(l);isNaN(r.getTime())||v(s=>({...s,to:r}))}},[i,l]);const y=o==="enGB"?f.enGB:o==="enUS"?f.enUS:o==="fr"?f.fr:f.es;return e.jsxRuntimeExports.jsxs("div",{ref:z,className:b.cn("flex flex-col gap-3",d),...u,children:[n&&e.jsxRuntimeExports.jsx($.Label,{htmlFor:u.id,className:b.cn({"text-neutral-700":h}),children:n}),e.jsxRuntimeExports.jsxs(j.Popover,{children:[e.jsxRuntimeExports.jsx(j.PopoverTrigger,{children:e.jsxRuntimeExports.jsxs("button",{type:"button",className:b.cn(L({size:m,rounded:g,state:t.from&&t.to||p&&!c?"selected":c&&p?"error":"default"}),{"text-neutral-800":!t.from&&!t.to}),disabled:h,children:[e.jsxRuntimeExports.jsx(N.IconComponent,{iconName:"IconCalendar",size:20,className:"pointer-events-none"}),t.from&&t.to?`${a.format(t.from,"PPP",{locale:y})} - ${a.format(t.to,"PPP",{locale:y})}`:x||"Select a date range",e.jsxRuntimeExports.jsx("input",{hidden:!0,onChange:()=>null,value:t.from&&t.to?`${a.format(t.from,"yyyy-MM-dd")} to ${a.format(t.to,"yyyy-MM-dd")}`:`${i||""} to ${l||""}`})]})}),e.jsxRuntimeExports.jsx(j.PopoverContent,{className:"w-auto overflow-hidden p-0",side:q,align:M,children:e.jsxRuntimeExports.jsx(T.DayPicker,{mode:"range",captionLayout:S?"dropdown":"label",selected:t,onSelect:D,locale:y,startMonth:k||new Date(1900,0,1),endMonth:_||new Date(2100,11,31),showOutsideDays:!0,disabled:E,className:"p-2",required:!0,classNames:{root:"w-fit text-sm text-center",weekday:"text-muted-foreground font-regular",month_grid:"border-separate",month_caption:"h-9 relative flex items-center w-full",dropdowns:"absolute w-fit items-center justify-center z-10 left-1/2 flex -translate-x-1/2 top-1/2 -translate-y-1/2",button_next:"rounded-2xl border-none lg:hover:bg-neutral-050 transition-colors z-1 p-2 disabled:opacity-50 focus-visible:ring-ring-default focus-visible:outline-hidden focus-visible:ring-[1.5px] focus-visible:ring-offset-1",button_previous:"rounded-2xl border-none lg:hover:bg-neutral-050 transition-colors z-1 p-2 disabled:opacity-50 focus-visible:ring-ring-default focus-visible:outline-hidden focus-visible:ring-[1.5px] focus-visible:ring-offset-1",nav:"w-full h-9 top-0 left-0 absolute flex justify-between items-center gap-2",selected:"bg-blue-800 text-white border-[0.5px] border-blue-800! lg:hover:bg-blue-900 transition-colors font-semibold",today:"bg-blue-050 border-[0.5px] text-blue-800 lg:hover:bg-blue-100",outside:"bg-white text-neutral-200 border-[0.5px] border-neutral-000",day_button:"text-sm h-9 w-9 whitespace-nowrap border-none focus-visible:ring-ring-default focus-visible:outline-hidden focus-visible:ring-[1.5px] rounded-2xl",caption_label:"text-neutral-1000 text-base font-semibold leading-none self-center w-full",disabled:"bg-white text-neutral-200 border-[0.5px] border-neutral-000 lg:hover:bg-white!",day:"h-9 w-9 aspect-square text-sm rounded-2xl border-[0.5px] border-neutral-050 lg:hover:bg-blue-050 transition-colors p-0 whitespace-nowrap",range_end:"bg-blue-800 text-white border-[0.5px] border-blue-800! lg:hover:bg-blue-900 transition-colors font-semibold",range_start:"bg-blue-800 text-white border-[0.5px] border-blue-800! lg:hover:bg-blue-900 transition-colors font-semibold",range_middle:"bg-blue-050! border-[0.5px] border-blue-800! text-blue-800! lg:hover:bg-blue-100 transition-colors font-semibold"},components:{Dropdown:B,Chevron:({orientation:r,size:s})=>e.jsxRuntimeExports.jsx(G,{orientation:r,size:s})}})})]}),c&&p?e.jsxRuntimeExports.jsx("span",{"aria-describedby":u.id,"aria-invalid":"true",className:"text-error-main text-label-md -mt-1",children:c}):e.jsxRuntimeExports.jsx("span",{className:b.clsx("text-muted-foreground -mt-1",{"text-neutral-700":h}),"aria-describedby":u.id,children:C})]})}),P=F;P.displayName="DateRangePicker";exports.DateRangePicker=P;
|
|
@@ -168,46 +168,54 @@ const A = $(
|
|
|
168
168
|
]
|
|
169
169
|
}
|
|
170
170
|
) }),
|
|
171
|
-
/* @__PURE__ */ e.jsx(
|
|
172
|
-
|
|
171
|
+
/* @__PURE__ */ e.jsx(
|
|
172
|
+
O,
|
|
173
173
|
{
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
174
|
+
className: "w-auto overflow-hidden p-0",
|
|
175
|
+
side: P,
|
|
176
|
+
align: C,
|
|
177
|
+
children: /* @__PURE__ */ e.jsx(
|
|
178
|
+
B,
|
|
179
|
+
{
|
|
180
|
+
mode: "range",
|
|
181
|
+
captionLayout: M ? "dropdown" : "label",
|
|
182
|
+
selected: t,
|
|
183
|
+
onSelect: k,
|
|
184
|
+
locale: v,
|
|
185
|
+
startMonth: R || new Date(1900, 0, 1),
|
|
186
|
+
endMonth: S || new Date(2100, 11, 31),
|
|
187
|
+
showOutsideDays: !0,
|
|
188
|
+
disabled: j,
|
|
189
|
+
className: "p-2",
|
|
190
|
+
required: !0,
|
|
191
|
+
classNames: {
|
|
192
|
+
root: "w-fit text-sm text-center",
|
|
193
|
+
weekday: "text-muted-foreground font-regular",
|
|
194
|
+
month_grid: "border-separate",
|
|
195
|
+
month_caption: "h-9 relative flex items-center w-full",
|
|
196
|
+
dropdowns: "absolute w-fit items-center justify-center z-10 left-1/2 flex -translate-x-1/2 top-1/2 -translate-y-1/2",
|
|
197
|
+
button_next: "rounded-2xl border-none lg:hover:bg-neutral-050 transition-colors z-1 p-2 disabled:opacity-50 focus-visible:ring-ring-default focus-visible:outline-hidden focus-visible:ring-[1.5px] focus-visible:ring-offset-1",
|
|
198
|
+
button_previous: "rounded-2xl border-none lg:hover:bg-neutral-050 transition-colors z-1 p-2 disabled:opacity-50 focus-visible:ring-ring-default focus-visible:outline-hidden focus-visible:ring-[1.5px] focus-visible:ring-offset-1",
|
|
199
|
+
nav: "w-full h-9 top-0 left-0 absolute flex justify-between items-center gap-2",
|
|
200
|
+
selected: "bg-blue-800 text-white border-[0.5px] border-blue-800! lg:hover:bg-blue-900 transition-colors font-semibold",
|
|
201
|
+
today: "bg-blue-050 border-[0.5px] text-blue-800 lg:hover:bg-blue-100",
|
|
202
|
+
outside: "bg-white text-neutral-200 border-[0.5px] border-neutral-000",
|
|
203
|
+
day_button: "text-sm h-9 w-9 whitespace-nowrap border-none focus-visible:ring-ring-default focus-visible:outline-hidden focus-visible:ring-[1.5px] rounded-2xl",
|
|
204
|
+
caption_label: "text-neutral-1000 text-base font-semibold leading-none self-center w-full",
|
|
205
|
+
disabled: "bg-white text-neutral-200 border-[0.5px] border-neutral-000 lg:hover:bg-white!",
|
|
206
|
+
day: "h-9 w-9 aspect-square text-sm rounded-2xl border-[0.5px] border-neutral-050 lg:hover:bg-blue-050 transition-colors p-0 whitespace-nowrap",
|
|
207
|
+
range_end: "bg-blue-800 text-white border-[0.5px] border-blue-800! lg:hover:bg-blue-900 transition-colors font-semibold",
|
|
208
|
+
range_start: "bg-blue-800 text-white border-[0.5px] border-blue-800! lg:hover:bg-blue-900 transition-colors font-semibold",
|
|
209
|
+
range_middle: "bg-blue-050! border-[0.5px] border-blue-800! text-blue-800! lg:hover:bg-blue-100 transition-colors font-semibold"
|
|
210
|
+
},
|
|
211
|
+
components: {
|
|
212
|
+
Dropdown: H,
|
|
213
|
+
Chevron: ({ orientation: o, size: l }) => /* @__PURE__ */ e.jsx(J, { orientation: o, size: l })
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
)
|
|
209
217
|
}
|
|
210
|
-
)
|
|
218
|
+
)
|
|
211
219
|
] }),
|
|
212
220
|
b && x ? /* @__PURE__ */ e.jsx(
|
|
213
221
|
"span",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../jsx-runtime-DUiatUiq.cjs"),c=require("@radix-ui/react-checkbox"),a=require("../index-DoxiiusW.cjs"),s=require("../icon-component-LY_vGYHZ.cjs");function d(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const o=d(c);function u({className:e,...t}){return n.jsxRuntimeExports.jsx(o.Root,{"data-slot":"checkbox",className:a.cn("peer border-input dark:bg-input/30 data-[state=checked]:bg-secondary data-[state=checked]:text-secondary-foreground dark:data-[state=checked]:bg-secondary data-[state=checked]:border-secondary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../jsx-runtime-DUiatUiq.cjs"),c=require("@radix-ui/react-checkbox"),a=require("../index-DoxiiusW.cjs"),s=require("../icon-component-LY_vGYHZ.cjs");function d(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const o=d(c);function u({className:e,...t}){return n.jsxRuntimeExports.jsx(o.Root,{"data-slot":"checkbox",className:a.cn("peer border-input dark:bg-input/30 data-[state=checked]:bg-secondary data-[state=checked]:text-secondary-foreground dark:data-[state=checked]:bg-secondary data-[state=checked]:border-secondary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:n.jsxRuntimeExports.jsx(o.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:n.jsxRuntimeExports.jsx(s.IconComponent,{iconName:"IconCheck",className:"size-3.5"})})})}exports.Checkbox=u;
|
|
@@ -11,7 +11,7 @@ function d({
|
|
|
11
11
|
{
|
|
12
12
|
"data-slot": "checkbox",
|
|
13
13
|
className: a(
|
|
14
|
-
"peer border-input dark:bg-input/30 data-[state=checked]:bg-secondary data-[state=checked]:text-secondary-foreground dark:data-[state=checked]:bg-secondary data-[state=checked]:border-secondary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border
|
|
14
|
+
"peer border-input dark:bg-input/30 data-[state=checked]:bg-secondary data-[state=checked]:text-secondary-foreground dark:data-[state=checked]:bg-secondary data-[state=checked]:border-secondary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
15
15
|
i
|
|
16
16
|
),
|
|
17
17
|
...t,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../jsx-runtime-DUiatUiq.cjs"),M=require("../badge-Czof3oqL.cjs"),x=require("../command-D9M8dk1M.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../jsx-runtime-DUiatUiq.cjs"),M=require("../badge-Czof3oqL.cjs"),x=require("../command-D9M8dk1M.cjs"),b=require("../popover-B8wp2cHF.cjs"),w=require("../index-DoxiiusW.cjs"),s=require("react"),R=require("../icon-component-LY_vGYHZ.cjs"),I=s.createContext(null);function k({children:e,values:n,defaultValues:r,onValuesChange:o}){const[m,p]=s.useState(!1),[h,f]=s.useState(new Set(n??r)),[y,j]=s.useState(new Map);function E(c){const i=l=>{const a=new Set(l);return a.has(c)?a.delete(c):a.add(c),a};f(i),o?.([...i(h)])}const g=s.useCallback((c,i)=>{j(l=>l.get(c)===i?l:new Map(l).set(c,i))},[]);return t.jsxRuntimeExports.jsx(I,{value:{open:m,setOpen:p,selectedValues:n?new Set(n):h,toggleValue:E,items:y,onItemAdded:g},children:t.jsxRuntimeExports.jsx(b.Popover,{open:m,onOpenChange:p,children:e})})}function V({className:e,children:n,size:r="md",...o}){const{open:m}=v();return t.jsxRuntimeExports.jsx(b.PopoverTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsxs("button",{...o,role:o.role??"combobox","aria-expanded":o["aria-expanded"]??m,"data-size":r,className:w.cn("border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='text-'])]:text-muted-foreground flex w-fit items-center justify-between gap-2 overflow-hidden rounded-md border bg-transparent whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",r==="xs"&&'text-label-sm h-7 px-2 py-1 [&_svg:not([class*="size-"])]:size-3.5',r==="sm"&&"text-label-md h-8 px-2 py-1",r==="md"&&"text-label-lg h-12 px-3 py-1",r==="lg"&&"text-label-xl h-16 px-4 py-2",e),children:[n,t.jsxRuntimeExports.jsx(R.IconComponent,{iconName:"IconSelector",className:"size-4 shrink-0 opacity-50"})]})})}function z({placeholder:e,clickToRemove:n=!0,className:r,overflowBehavior:o="wrap-when-open",...m}){const{selectedValues:p,toggleValue:h,items:f,open:y}=v(),[j,E]=s.useState(0),g=s.useRef(null),c=s.useRef(null),i=s.useRef(new Set),l=o==="wrap"||o==="wrap-when-open"&&y;s.useEffect(()=>{l&&i.current.forEach(u=>u.style.removeProperty("display"))},[l]);const a=s.useCallback(()=>{if(g.current==null)return;const u=g.current,d=c.current;d!=null&&(d.style.display="none"),i.current.forEach(S=>S.style.removeProperty("display"));let C=0;for(let S=i.current.size-1;S>=0;S--){const N=[...i.current][S];if(u.scrollWidth<=u.clientWidth)break;C=i.current.size-S,N.style.display="none",d?.style.removeProperty("display")}E(C)},[]);return s.useEffect(()=>{if(g.current==null)return;const u=new ResizeObserver(a);return u.observe(g.current),()=>u.disconnect()},[a]),s.useLayoutEffect(()=>{a()},[p,a]),p.size===0&&e?t.jsxRuntimeExports.jsx("span",{className:"text-muted-foreground font-normal",children:e}):t.jsxRuntimeExports.jsxs("div",{...m,ref:g,className:w.cn("flex w-full gap-1.5 overflow-hidden min-h-[1.75rem]",l&&"flex-wrap",r),children:[[...p].filter(u=>f.has(u)).map(u=>t.jsxRuntimeExports.jsxs(M.Badge,{ref:d=>{if(d!=null)return i.current.add(d),()=>{i.current.delete(d)}},variant:"outline",className:"group flex items-center gap-1",onClick:n?d=>{d.stopPropagation(),h(u)}:void 0,children:[f.get(u),n&&t.jsxRuntimeExports.jsx(R.IconComponent,{iconName:"IconX",className:"text-muted-foreground group-hover:text-destructive size-2"})]},u)),t.jsxRuntimeExports.jsxs(M.Badge,{style:{display:j>0&&!l?"block":"none"},variant:"outline",ref:c,children:["+",j]})]})}function P({search:e=!0,children:n,...r}){const o=typeof e=="object"?!0:e;return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{style:{display:"none"},children:t.jsxRuntimeExports.jsx(x.Command,{children:t.jsxRuntimeExports.jsx(x.CommandList,{children:n})})}),t.jsxRuntimeExports.jsx(b.PopoverContent,{className:"min-w-[var(--radix-popover-trigger-width)] p-0",children:t.jsxRuntimeExports.jsxs(x.Command,{...r,children:[o?t.jsxRuntimeExports.jsx(x.CommandInput,{placeholder:typeof e=="object"?e.placeholder:void 0}):t.jsxRuntimeExports.jsx("button",{autoFocus:!0,"aria-hidden":"true",className:"sr-only"}),t.jsxRuntimeExports.jsxs(x.CommandList,{children:[o&&t.jsxRuntimeExports.jsx(x.CommandEmpty,{children:typeof e=="object"?e.emptyMessage:void 0}),n]})]})})]})}function q({value:e,children:n,badgeLabel:r,onSelect:o,...m}){const{toggleValue:p,selectedValues:h,onItemAdded:f}=v(),y=h.has(e);return s.useEffect(()=>{f(e,r??n)},[e,n,f,r]),t.jsxRuntimeExports.jsxs(x.CommandItem,{...m,value:e,onSelect:j=>{p(j),o?.(j)},children:[t.jsxRuntimeExports.jsx(R.IconComponent,{iconName:"IconCheck",className:w.cn("mr-2 size-4",y?"opacity-100":"opacity-0")}),n]})}function O(e){return t.jsxRuntimeExports.jsx(x.CommandGroup,{...e})}function _(e){return t.jsxRuntimeExports.jsx(x.CommandSeparator,{...e})}function v(){const e=s.useContext(I);if(e==null)throw new Error("useMultiSelectContext must be used within a MultiSelectContext");return e}exports.MultiSelect=k;exports.MultiSelectContent=P;exports.MultiSelectGroup=O;exports.MultiSelectItem=q;exports.MultiSelectSeparator=_;exports.MultiSelectTrigger=V;exports.MultiSelectValue=z;
|
|
@@ -7,9 +7,10 @@ declare function MultiSelect({ children, values, defaultValues, onValuesChange,
|
|
|
7
7
|
defaultValues?: string[];
|
|
8
8
|
onValuesChange?: (values: string[]) => void;
|
|
9
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
declare function MultiSelectTrigger({ className, children, ...props }: {
|
|
10
|
+
declare function MultiSelectTrigger({ className, children, size, ...props }: {
|
|
11
11
|
className?: string;
|
|
12
12
|
children?: ReactNode;
|
|
13
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
13
14
|
} & ComponentPropsWithoutRef<typeof Button>): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
declare function MultiSelectValue({ placeholder, clickToRemove, className, overflowBehavior, ...props }: {
|
|
15
16
|
placeholder?: string;
|
|
@@ -1,59 +1,65 @@
|
|
|
1
1
|
import { j as t } from "../jsx-runtime-C5mzlN2N.js";
|
|
2
2
|
import { B as I } from "../badge-BnerQ2lF.js";
|
|
3
|
-
import { C as k, f as
|
|
3
|
+
import { C as k, f as E, d as O, b as R, c as _, e as A, g as W } from "../command-BGCSJ9vX.js";
|
|
4
4
|
import { P as F, b as G, c as B } from "../popover-BoDRCUh2.js";
|
|
5
5
|
import { c as S } from "../index-CRiPKpXj.js";
|
|
6
|
-
import { createContext as L, useState as
|
|
6
|
+
import { createContext as L, useState as y, useCallback as V, useEffect as v, useRef as j, useLayoutEffect as T, useContext as X } from "react";
|
|
7
7
|
import { I as C } from "../icon-component-BZ-4FDV6.js";
|
|
8
|
-
const
|
|
8
|
+
const z = L(null);
|
|
9
9
|
function Y({
|
|
10
10
|
children: e,
|
|
11
11
|
values: n,
|
|
12
|
-
defaultValues:
|
|
13
|
-
onValuesChange:
|
|
12
|
+
defaultValues: r,
|
|
13
|
+
onValuesChange: o
|
|
14
14
|
}) {
|
|
15
|
-
const [
|
|
16
|
-
new Set(n ??
|
|
17
|
-
), [w,
|
|
18
|
-
function
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
return
|
|
15
|
+
const [d, m] = y(!1), [g, p] = y(
|
|
16
|
+
new Set(n ?? r)
|
|
17
|
+
), [w, f] = y(/* @__PURE__ */ new Map());
|
|
18
|
+
function b(a) {
|
|
19
|
+
const s = (l) => {
|
|
20
|
+
const c = new Set(l);
|
|
21
|
+
return c.has(a) ? c.delete(a) : c.add(a), c;
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
p(s), o?.([...s(g)]);
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const x = V((a, s) => {
|
|
26
|
+
f((l) => l.get(a) === s ? l : new Map(l).set(a, s));
|
|
27
27
|
}, []);
|
|
28
28
|
return /* @__PURE__ */ t.jsx(
|
|
29
|
-
|
|
29
|
+
z,
|
|
30
30
|
{
|
|
31
31
|
value: {
|
|
32
|
-
open:
|
|
33
|
-
setOpen:
|
|
32
|
+
open: d,
|
|
33
|
+
setOpen: m,
|
|
34
34
|
selectedValues: n ? new Set(n) : g,
|
|
35
|
-
toggleValue:
|
|
35
|
+
toggleValue: b,
|
|
36
36
|
items: w,
|
|
37
|
-
onItemAdded:
|
|
37
|
+
onItemAdded: x
|
|
38
38
|
},
|
|
39
|
-
children: /* @__PURE__ */ t.jsx(F, { open:
|
|
39
|
+
children: /* @__PURE__ */ t.jsx(F, { open: d, onOpenChange: m, children: e })
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
function Z({
|
|
44
44
|
className: e,
|
|
45
45
|
children: n,
|
|
46
|
-
|
|
46
|
+
size: r = "md",
|
|
47
|
+
...o
|
|
47
48
|
}) {
|
|
48
|
-
const { open:
|
|
49
|
+
const { open: d } = M();
|
|
49
50
|
return /* @__PURE__ */ t.jsx(B, { asChild: !0, children: /* @__PURE__ */ t.jsxs(
|
|
50
51
|
"button",
|
|
51
52
|
{
|
|
52
|
-
...
|
|
53
|
-
role:
|
|
54
|
-
"aria-expanded":
|
|
53
|
+
...o,
|
|
54
|
+
role: o.role ?? "combobox",
|
|
55
|
+
"aria-expanded": o["aria-expanded"] ?? d,
|
|
56
|
+
"data-size": r,
|
|
55
57
|
className: S(
|
|
56
|
-
"border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20
|
|
58
|
+
"border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='text-'])]:text-muted-foreground flex w-fit items-center justify-between gap-2 overflow-hidden rounded-md border bg-transparent whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
59
|
+
r === "xs" && 'text-label-sm h-7 px-2 py-1 [&_svg:not([class*="size-"])]:size-3.5',
|
|
60
|
+
r === "sm" && "text-label-md h-8 px-2 py-1",
|
|
61
|
+
r === "md" && "text-label-lg h-12 px-3 py-1",
|
|
62
|
+
r === "lg" && "text-label-xl h-16 px-4 py-2",
|
|
57
63
|
e
|
|
58
64
|
),
|
|
59
65
|
children: [
|
|
@@ -72,60 +78,60 @@ function Z({
|
|
|
72
78
|
function $({
|
|
73
79
|
placeholder: e,
|
|
74
80
|
clickToRemove: n = !0,
|
|
75
|
-
className:
|
|
76
|
-
overflowBehavior:
|
|
77
|
-
...
|
|
81
|
+
className: r,
|
|
82
|
+
overflowBehavior: o = "wrap-when-open",
|
|
83
|
+
...d
|
|
78
84
|
}) {
|
|
79
|
-
const { selectedValues:
|
|
80
|
-
|
|
81
|
-
l &&
|
|
85
|
+
const { selectedValues: m, toggleValue: g, items: p, open: w } = M(), [f, b] = y(0), x = j(null), a = j(null), s = j(/* @__PURE__ */ new Set()), l = o === "wrap" || o === "wrap-when-open" && w;
|
|
86
|
+
v(() => {
|
|
87
|
+
l && s.current.forEach((i) => i.style.removeProperty("display"));
|
|
82
88
|
}, [l]);
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
const
|
|
86
|
-
u != null && (u.style.display = "none"),
|
|
89
|
+
const c = V(() => {
|
|
90
|
+
if (x.current == null) return;
|
|
91
|
+
const i = x.current, u = a.current;
|
|
92
|
+
u != null && (u.style.display = "none"), s.current.forEach((h) => h.style.removeProperty("display"));
|
|
87
93
|
let N = 0;
|
|
88
|
-
for (let h =
|
|
89
|
-
const P = [...
|
|
90
|
-
if (
|
|
94
|
+
for (let h = s.current.size - 1; h >= 0; h--) {
|
|
95
|
+
const P = [...s.current][h];
|
|
96
|
+
if (i.scrollWidth <= i.clientWidth)
|
|
91
97
|
break;
|
|
92
|
-
N =
|
|
98
|
+
N = s.current.size - h, P.style.display = "none", u?.style.removeProperty("display");
|
|
93
99
|
}
|
|
94
|
-
|
|
100
|
+
b(N);
|
|
95
101
|
}, []);
|
|
96
|
-
return
|
|
97
|
-
if (
|
|
98
|
-
const
|
|
99
|
-
return
|
|
100
|
-
}, [
|
|
101
|
-
|
|
102
|
-
}, [
|
|
102
|
+
return v(() => {
|
|
103
|
+
if (x.current == null) return;
|
|
104
|
+
const i = new ResizeObserver(c);
|
|
105
|
+
return i.observe(x.current), () => i.disconnect();
|
|
106
|
+
}, [c]), T(() => {
|
|
107
|
+
c();
|
|
108
|
+
}, [m, c]), m.size === 0 && e ? /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground font-normal", children: e }) : /* @__PURE__ */ t.jsxs(
|
|
103
109
|
"div",
|
|
104
110
|
{
|
|
105
|
-
...
|
|
106
|
-
ref:
|
|
111
|
+
...d,
|
|
112
|
+
ref: x,
|
|
107
113
|
className: S(
|
|
108
|
-
"flex w-full gap-1.5 overflow-hidden",
|
|
109
|
-
l && "
|
|
110
|
-
|
|
114
|
+
"flex w-full gap-1.5 overflow-hidden min-h-[1.75rem]",
|
|
115
|
+
l && "flex-wrap",
|
|
116
|
+
r
|
|
111
117
|
),
|
|
112
118
|
children: [
|
|
113
|
-
[...
|
|
119
|
+
[...m].filter((i) => p.has(i)).map((i) => /* @__PURE__ */ t.jsxs(
|
|
114
120
|
I,
|
|
115
121
|
{
|
|
116
122
|
ref: (u) => {
|
|
117
123
|
if (u != null)
|
|
118
|
-
return
|
|
119
|
-
|
|
124
|
+
return s.current.add(u), () => {
|
|
125
|
+
s.current.delete(u);
|
|
120
126
|
};
|
|
121
127
|
},
|
|
122
128
|
variant: "outline",
|
|
123
129
|
className: "group flex items-center gap-1",
|
|
124
130
|
onClick: n ? (u) => {
|
|
125
|
-
u.stopPropagation(), g(
|
|
131
|
+
u.stopPropagation(), g(i);
|
|
126
132
|
} : void 0,
|
|
127
133
|
children: [
|
|
128
|
-
|
|
134
|
+
p.get(i),
|
|
129
135
|
n && /* @__PURE__ */ t.jsx(
|
|
130
136
|
C,
|
|
131
137
|
{
|
|
@@ -135,19 +141,19 @@ function $({
|
|
|
135
141
|
)
|
|
136
142
|
]
|
|
137
143
|
},
|
|
138
|
-
|
|
144
|
+
i
|
|
139
145
|
)),
|
|
140
146
|
/* @__PURE__ */ t.jsxs(
|
|
141
147
|
I,
|
|
142
148
|
{
|
|
143
149
|
style: {
|
|
144
|
-
display:
|
|
150
|
+
display: f > 0 && !l ? "block" : "none"
|
|
145
151
|
},
|
|
146
152
|
variant: "outline",
|
|
147
|
-
ref:
|
|
153
|
+
ref: a,
|
|
148
154
|
children: [
|
|
149
155
|
"+",
|
|
150
|
-
|
|
156
|
+
f
|
|
151
157
|
]
|
|
152
158
|
}
|
|
153
159
|
)
|
|
@@ -158,20 +164,20 @@ function $({
|
|
|
158
164
|
function ee({
|
|
159
165
|
search: e = !0,
|
|
160
166
|
children: n,
|
|
161
|
-
...
|
|
167
|
+
...r
|
|
162
168
|
}) {
|
|
163
|
-
const
|
|
169
|
+
const o = typeof e == "object" ? !0 : e;
|
|
164
170
|
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
165
|
-
/* @__PURE__ */ t.jsx("div", { style: { display: "none" }, children: /* @__PURE__ */ t.jsx(k, { children: /* @__PURE__ */ t.jsx(
|
|
166
|
-
/* @__PURE__ */ t.jsx(G, { className: "min-w-[var(--radix-popover-trigger-width)] p-0", children: /* @__PURE__ */ t.jsxs(k, { ...
|
|
167
|
-
|
|
171
|
+
/* @__PURE__ */ t.jsx("div", { style: { display: "none" }, children: /* @__PURE__ */ t.jsx(k, { children: /* @__PURE__ */ t.jsx(E, { children: n }) }) }),
|
|
172
|
+
/* @__PURE__ */ t.jsx(G, { className: "min-w-[var(--radix-popover-trigger-width)] p-0", children: /* @__PURE__ */ t.jsxs(k, { ...r, children: [
|
|
173
|
+
o ? /* @__PURE__ */ t.jsx(
|
|
168
174
|
O,
|
|
169
175
|
{
|
|
170
176
|
placeholder: typeof e == "object" ? e.placeholder : void 0
|
|
171
177
|
}
|
|
172
178
|
) : /* @__PURE__ */ t.jsx("button", { autoFocus: !0, "aria-hidden": "true", className: "sr-only" }),
|
|
173
|
-
/* @__PURE__ */ t.jsxs(
|
|
174
|
-
|
|
179
|
+
/* @__PURE__ */ t.jsxs(E, { children: [
|
|
180
|
+
o && /* @__PURE__ */ t.jsx(R, { children: typeof e == "object" ? e.emptyMessage : void 0 }),
|
|
175
181
|
n
|
|
176
182
|
] })
|
|
177
183
|
] }) })
|
|
@@ -180,20 +186,20 @@ function ee({
|
|
|
180
186
|
function te({
|
|
181
187
|
value: e,
|
|
182
188
|
children: n,
|
|
183
|
-
badgeLabel:
|
|
184
|
-
onSelect:
|
|
185
|
-
...
|
|
189
|
+
badgeLabel: r,
|
|
190
|
+
onSelect: o,
|
|
191
|
+
...d
|
|
186
192
|
}) {
|
|
187
|
-
const { toggleValue:
|
|
188
|
-
return
|
|
189
|
-
|
|
190
|
-
}, [e, n,
|
|
191
|
-
|
|
193
|
+
const { toggleValue: m, selectedValues: g, onItemAdded: p } = M(), w = g.has(e);
|
|
194
|
+
return v(() => {
|
|
195
|
+
p(e, r ?? n);
|
|
196
|
+
}, [e, n, p, r]), /* @__PURE__ */ t.jsxs(
|
|
197
|
+
A,
|
|
192
198
|
{
|
|
193
|
-
...
|
|
199
|
+
...d,
|
|
194
200
|
value: e,
|
|
195
|
-
onSelect: (
|
|
196
|
-
|
|
201
|
+
onSelect: (f) => {
|
|
202
|
+
m(f), o?.(f);
|
|
197
203
|
},
|
|
198
204
|
children: [
|
|
199
205
|
/* @__PURE__ */ t.jsx(
|
|
@@ -209,13 +215,13 @@ function te({
|
|
|
209
215
|
);
|
|
210
216
|
}
|
|
211
217
|
function ne(e) {
|
|
212
|
-
return /* @__PURE__ */ t.jsx(
|
|
218
|
+
return /* @__PURE__ */ t.jsx(_, { ...e });
|
|
213
219
|
}
|
|
214
220
|
function re(e) {
|
|
215
221
|
return /* @__PURE__ */ t.jsx(W, { ...e });
|
|
216
222
|
}
|
|
217
223
|
function M() {
|
|
218
|
-
const e = X(
|
|
224
|
+
const e = X(z);
|
|
219
225
|
if (e == null)
|
|
220
226
|
throw new Error(
|
|
221
227
|
"useMultiSelectContext must be used within a MultiSelectContext"
|