@clasing/ui 2.0.7 → 2.0.9
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/{badge-B4oRxQ-G.js → badge-Ds17GJH4.js} +28 -20
- package/dist/badge-oQqEF2X5.cjs +1 -0
- package/dist/components/badge.cjs.js +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/badge.es.js +1 -1
- package/dist/components/blocks/interactive-card.cjs.js +1 -1
- package/dist/components/blocks/interactive-card.es.js +1 -1
- package/dist/components/multi-select.cjs.js +1 -1
- package/dist/components/multi-select.d.ts +5 -1
- package/dist/components/multi-select.es.js +174 -149
- package/package.json +1 -1
- package/dist/badge-CS2XfLYQ.cjs +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { j as e, c as
|
|
1
|
+
import { j as e, c as v } from "./index-DBpnlzOP.js";
|
|
2
2
|
import { Slot as c } from "@radix-ui/react-slot";
|
|
3
|
-
import { c as
|
|
3
|
+
import { c as x } from "./index-CwXB7YIx.js";
|
|
4
4
|
import { I as o } from "./icon-component-DGImZz3K.js";
|
|
5
|
-
const
|
|
5
|
+
const f = x(
|
|
6
6
|
"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex w-fit shrink-0 items-center justify-center gap-2 overflow-hidden border font-semibold whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none",
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
@@ -19,10 +19,18 @@ const x = f(
|
|
|
19
19
|
primary: "bg-primary-600 [a&]:hover:bg-primary-600/90 border-transparent text-white",
|
|
20
20
|
yellow: "border-transparent bg-yellow-600 text-white [a&]:hover:bg-yellow-600/90",
|
|
21
21
|
blue: "border-transparent bg-blue-600 text-white [a&]:hover:bg-blue-600/90",
|
|
22
|
-
violet: "border-transparent bg-violet-600 text-white [a&]:hover:bg-violet-600/90"
|
|
22
|
+
violet: "border-transparent bg-violet-600 text-white [a&]:hover:bg-violet-600/90",
|
|
23
|
+
"not-started": "text-neutral-1000 border-transparent bg-neutral-100 [a&]:hover:bg-neutral-100/90",
|
|
24
|
+
"in-progress": "bg-blue-050 text-neutral-1000 [a&]:hover:bg-blue-050/90 border-transparent",
|
|
25
|
+
completed: "bg-success-light text-neutral-1000 [a&]:hover:bg-success-light/90 border-transparent",
|
|
26
|
+
blocked: "text-neutral-1000 border-transparent bg-neutral-100 [a&]:hover:bg-neutral-100/90",
|
|
27
|
+
paused: "bg-warning-light text-neutral-1000 [a&]:hover:bg-warning-light/90 border-transparent",
|
|
28
|
+
failed: "bg-error-light text-neutral-1000 [a&]:hover:bg-error-light/90 border-transparent",
|
|
29
|
+
expired: "bg-error-light text-neutral-1000 [a&]:hover:bg-error-light/90 border-transparent",
|
|
30
|
+
cancelled: "bg-error-light text-neutral-1000 [a&]:hover:bg-error-light/90 border-transparent"
|
|
23
31
|
},
|
|
24
32
|
size: {
|
|
25
|
-
xs: "paragraph-xs px-3 py-px [&>svg]:size-3",
|
|
33
|
+
xs: "paragraph-xs h-6.5 px-3 py-px [&>svg]:size-3.5",
|
|
26
34
|
sm: "paragraph-xs px-4 py-1 [&>svg]:size-4",
|
|
27
35
|
md: "paragraph-sm px-4 py-2 [&>svg]:size-4",
|
|
28
36
|
lg: "paragraph-md px-4 py-2 [&>svg]:size-5"
|
|
@@ -48,32 +56,32 @@ const x = f(
|
|
|
48
56
|
);
|
|
49
57
|
function j({
|
|
50
58
|
className: s,
|
|
51
|
-
variant:
|
|
59
|
+
variant: i,
|
|
52
60
|
size: g,
|
|
53
|
-
weight:
|
|
54
|
-
rounded:
|
|
61
|
+
weight: l,
|
|
62
|
+
rounded: b,
|
|
55
63
|
iconName: r,
|
|
56
64
|
iconPosition: t = "left",
|
|
57
|
-
iconStroke: a,
|
|
58
|
-
iconOnly:
|
|
59
|
-
asChild:
|
|
60
|
-
children:
|
|
61
|
-
...
|
|
65
|
+
iconStroke: a = "1",
|
|
66
|
+
iconOnly: n,
|
|
67
|
+
asChild: d = !1,
|
|
68
|
+
children: u,
|
|
69
|
+
...h
|
|
62
70
|
}) {
|
|
63
|
-
const
|
|
71
|
+
const p = d ? c : "span";
|
|
64
72
|
return /* @__PURE__ */ e.jsxs(
|
|
65
|
-
|
|
73
|
+
p,
|
|
66
74
|
{
|
|
67
75
|
"data-slot": "badge",
|
|
68
|
-
className:
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
className: v(
|
|
77
|
+
f({ variant: i, size: g, weight: l, rounded: b }),
|
|
78
|
+
n && "px-2.5 py-2",
|
|
71
79
|
s
|
|
72
80
|
),
|
|
73
|
-
...
|
|
81
|
+
...h,
|
|
74
82
|
children: [
|
|
75
83
|
r && t === "left" && /* @__PURE__ */ e.jsx(o, { iconName: r, stroke: a }),
|
|
76
|
-
!
|
|
84
|
+
!n && u,
|
|
77
85
|
r && t === "right" && /* @__PURE__ */ e.jsx(o, { iconName: r, stroke: a })
|
|
78
86
|
]
|
|
79
87
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./index-DSjHHn1r.cjs"),c=require("@radix-ui/react-slot"),v=require("./index-BVmT9wZC.cjs"),o=require("./icon-component-DTlgy__B.cjs"),x=v.cva("focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex w-fit shrink-0 items-center justify-center gap-2 overflow-hidden border font-semibold whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none",{variants:{variant:{default:"bg-muted text-muted-foreground [a&]:hover:bg-muted/90 border-transparent",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90 border-transparent",destructive:"bg-destructive [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 border-transparent text-white",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",error:"bg-error-light text-error-main [a&]:hover:bg-error-light/90 border-transparent",warning:"bg-warning-light text-warning-main [a&]:hover:bg-warning-light/90 border-transparent",success:"bg-success-light text-success-main [a&]:hover:bg-success-light/90 border-transparent",info:"bg-info-light text-info-main [a&]:hover:bg-info-light/90 border-transparent",neutral:"border-transparent bg-black text-white [a&]:hover:bg-black/90",primary:"bg-primary-600 [a&]:hover:bg-primary-600/90 border-transparent text-white",yellow:"border-transparent bg-yellow-600 text-white [a&]:hover:bg-yellow-600/90",blue:"border-transparent bg-blue-600 text-white [a&]:hover:bg-blue-600/90",violet:"border-transparent bg-violet-600 text-white [a&]:hover:bg-violet-600/90","not-started":"text-neutral-1000 border-transparent bg-neutral-100 [a&]:hover:bg-neutral-100/90","in-progress":"bg-blue-050 text-neutral-1000 [a&]:hover:bg-blue-050/90 border-transparent",completed:"bg-success-light text-neutral-1000 [a&]:hover:bg-success-light/90 border-transparent",blocked:"text-neutral-1000 border-transparent bg-neutral-100 [a&]:hover:bg-neutral-100/90",paused:"bg-warning-light text-neutral-1000 [a&]:hover:bg-warning-light/90 border-transparent",failed:"bg-error-light text-neutral-1000 [a&]:hover:bg-error-light/90 border-transparent",expired:"bg-error-light text-neutral-1000 [a&]:hover:bg-error-light/90 border-transparent",cancelled:"bg-error-light text-neutral-1000 [a&]:hover:bg-error-light/90 border-transparent"},size:{xs:"paragraph-xs h-6.5 px-3 py-px [&>svg]:size-3.5",sm:"paragraph-xs px-4 py-1 [&>svg]:size-4",md:"paragraph-sm px-4 py-2 [&>svg]:size-4",lg:"paragraph-md px-4 py-2 [&>svg]:size-5"},weight:{light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},rounded:{default:"rounded-2xl",full:"rounded-full"}},defaultVariants:{variant:"default",size:"xs",weight:"semibold",rounded:"full"}});function f({className:i,variant:s,size:g,weight:l,rounded:b,iconName:r,iconPosition:t="left",iconStroke:a="1",iconOnly:n,asChild:d=!1,children:u,...h}){const p=d?c.Slot:"span";return e.jsxRuntimeExports.jsxs(p,{"data-slot":"badge",className:e.cn(x({variant:s,size:g,weight:l,rounded:b}),n&&"px-2.5 py-2",i),...h,children:[r&&t==="left"&&e.jsxRuntimeExports.jsx(o.IconComponent,{iconName:r,stroke:a}),!n&&u,r&&t==="right"&&e.jsxRuntimeExports.jsx(o.IconComponent,{iconName:r,stroke:a})]})}exports.Badge=f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../badge-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../badge-oQqEF2X5.cjs");exports.Badge=e.Badge;
|
|
@@ -2,7 +2,7 @@ import { type VariantProps } from 'class-variance-authority';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { TablerIconName } from './icon-component';
|
|
4
4
|
declare const badgeVariants: (props?: ({
|
|
5
|
-
variant?: "default" | "error" | "outline" | "primary" | "secondary" | "destructive" | "info" | "success" | "warning" | "neutral" | "yellow" | "blue" | "violet" | null | undefined;
|
|
5
|
+
variant?: "default" | "error" | "outline" | "primary" | "secondary" | "destructive" | "info" | "success" | "warning" | "neutral" | "yellow" | "blue" | "violet" | "not-started" | "in-progress" | "completed" | "blocked" | "paused" | "failed" | "expired" | "cancelled" | null | undefined;
|
|
6
6
|
size?: "lg" | "md" | "sm" | "xs" | null | undefined;
|
|
7
7
|
weight?: "bold" | "light" | "regular" | "semibold" | null | undefined;
|
|
8
8
|
rounded?: "default" | "full" | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../index-DSjHHn1r.cjs"),I=require("../../badge-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../index-DSjHHn1r.cjs"),I=require("../../badge-oQqEF2X5.cjs"),l=require("../../card-Dj2wgH-P.cjs"),p=require("../../icon-component-DTlgy__B.cjs"),x=require("../../tooltip-BvdeurjC.cjs"),q=require("../../index-BVmT9wZC.cjs"),w=require("react"),y=q.cva("focus-visible:border-ring focus-visible:ring-ring/50 transition-[color,box-shadow] focus-visible:ring-[3px]"),j=w.forwardRef(({className:g,isActive:n,title:u,text:m,helperText:d,badgeText:t,disabled:r,badgeVariant:h,badgeSize:f="xs",iconName:i,iconText:a,tooltipIconName:R="IconHelpCircleFilled",tooltipText:s,tooltipTitle:o,tooltipSide:b,tooltipSideOffset:C,tooltipAlign:E,children:N,...c},v)=>e.jsxRuntimeExports.jsxs(l.Card,{ref:v,className:e.cn(y({className:g}),{"bg-blue-050 border-blue-950":n,"border-neutral-100 bg-neutral-100":r,"cursor-pointer lg:active:bg-blue-100":c.onClick&&n&&!r,"lg:active:bg-blue-050 cursor-pointer":c.onClick&&!n&&!r}),role:"button",tabIndex:0,...c,children:[t||i||a?e.jsxRuntimeExports.jsxs(l.CardHeader,{className:"flex items-center justify-between gap-2",children:[i||a?e.jsxRuntimeExports.jsx("div",{className:e.cn("rounded-full p-1",{"bg-neutral-000 text-muted-foreground":!n,"bg-white text-blue-800":n,"bg-white text-neutral-700":r}),children:e.jsxRuntimeExports.jsx(p.IconComponent,{iconName:i,iconText:a,size:20})}):null,(t||s)&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[t?e.jsxRuntimeExports.jsx(I.Badge,{variant:h,size:f,weight:"semibold",className:e.cn({"opacity-50":r}),children:t}):null,s&&e.jsxRuntimeExports.jsxs(x.Tooltip,{children:[e.jsxRuntimeExports.jsx(x.TooltipTrigger,{children:e.jsxRuntimeExports.jsx(p.IconComponent,{iconName:R??"IconHelpCircleFilled",size:20,className:"z-10 min-h-5 min-w-5"})}),e.jsxRuntimeExports.jsx(x.TooltipContent,{side:b,sideOffset:C,align:E,children:o||s&&e.jsxRuntimeExports.jsxs("div",{className:"text-neutral-1000 flex flex-col gap-1",children:[o&&e.jsxRuntimeExports.jsx("p",{className:"paragraph-md font-semibold",children:o}),s&&e.jsxRuntimeExports.jsx("p",{className:"paragraph-md",children:s})]})})]})]})]}):null,e.jsxRuntimeExports.jsxs(l.CardContent,{className:"flex flex-col gap-1",children:[u?e.jsxRuntimeExports.jsx("p",{className:e.cn("text-foreground label-xl font-semibold",{"text-neutral-700":r}),children:u}):null,m?e.jsxRuntimeExports.jsx("p",{className:e.cn("text-muted-foreground paragraph-md",{"text-neutral-700":r}),children:m}):null,N]}),d?e.jsxRuntimeExports.jsx(l.CardFooter,{children:e.jsxRuntimeExports.jsx("p",{className:e.cn("paragraph-sm text-neutral-800",{"text-neutral-700":r}),children:d})}):null]}));j.displayName="InteractiveCard";const z=j;exports.InteractiveCard=z;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as e, c as a } from "../../index-DBpnlzOP.js";
|
|
2
|
-
import { B as w } from "../../badge-
|
|
2
|
+
import { B as w } from "../../badge-Ds17GJH4.js";
|
|
3
3
|
import { C as y, e as z, b as F, d as H } from "../../card-BNTyYiyA.js";
|
|
4
4
|
import { I as x } from "../../icon-component-DGImZz3K.js";
|
|
5
5
|
import { T as k, c as B, a as R } from "../../tooltip-CUaxcngn.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-DSjHHn1r.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-DSjHHn1r.cjs"),I=require("../badge-oQqEF2X5.cjs"),m=require("../command-CHisYTN-.cjs"),N=require("../popover-BnLx2OY6.cjs"),n=require("react"),v=require("../icon-component-DTlgy__B.cjs"),V=n.createContext(null);function k({children:t,values:r,defaultValues:i,onValuesChange:u,isLoading:d,onSearchChange:c,loadingText:f="Loading...",noResultsText:a="No results found"}){const[h,p]=n.useState(!1),[y,j]=n.useState(new Set(r??i)),[b,x]=n.useState(new Map),[S,E]=n.useState("");function o(s){const g=R=>{const C=new Set(R);return C.has(s)?C.delete(s):C.add(s),C};j(g),u?.([...g(y)])}const l=n.useCallback((s,g)=>{x(R=>R.get(s)===g?R:new Map(R).set(s,g))},[]),w=n.useCallback(s=>{E(s),c?.(s)},[c]);return e.jsxRuntimeExports.jsx(V,{value:{open:h,setOpen:p,selectedValues:r?new Set(r):y,toggleValue:o,items:b,onItemAdded:l,isLoading:d,searchValue:S,onSearchChange:w,loadingText:f,noResultsText:a},children:e.jsxRuntimeExports.jsx(N.Popover,{open:h,onOpenChange:p,children:t})})}function z({className:t,children:r,size:i="md",...u}){const{open:d}=M();return e.jsxRuntimeExports.jsx(N.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{...u,role:u.role??"combobox","aria-expanded":u["aria-expanded"]??d,"data-size":i,className:e.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",i==="xs"&&'label-sm h-7 px-2 py-1 [&_svg:not([class*="size-"])]:size-3.5',i==="sm"&&"label-md h-8 px-2 py-1",i==="md"&&"label-lg h-12 px-3 py-1",i==="lg"&&"label-xl h-16 px-4 py-2",t),children:[r,e.jsxRuntimeExports.jsx(v.IconComponent,{iconName:"IconSelector",className:"size-4 shrink-0 opacity-50"})]})})}function P({placeholder:t,clickToRemove:r=!0,className:i,overflowBehavior:u="wrap-when-open",...d}){const{selectedValues:c,toggleValue:f,items:a,open:h}=M(),[p,y]=n.useState(0),j=n.useRef(null),b=n.useRef(null),x=n.useRef(new Set),S=u==="wrap"||u==="wrap-when-open"&&h;n.useEffect(()=>{S&&x.current.forEach(o=>o.style.removeProperty("display"))},[S]);const E=n.useCallback(()=>{if(j.current==null)return;const o=j.current,l=b.current;l!=null&&(l.style.display="none"),x.current.forEach(s=>s.style.removeProperty("display"));let w=0;for(let s=x.current.size-1;s>=0;s--){const g=[...x.current][s];if(o.scrollWidth<=o.clientWidth)break;w=x.current.size-s,g.style.display="none",l?.style.removeProperty("display")}y(w)},[]);return n.useEffect(()=>{if(j.current==null)return;const o=new ResizeObserver(E);return o.observe(j.current),()=>o.disconnect()},[E]),n.useLayoutEffect(()=>{E()},[c,E]),c.size===0&&t?e.jsxRuntimeExports.jsx("span",{className:"text-muted-foreground font-normal",children:t}):e.jsxRuntimeExports.jsxs("div",{...d,ref:j,className:e.cn("flex min-h-[1.75rem] w-full gap-1.5 overflow-hidden",S&&"flex-wrap",i),children:[[...c].filter(o=>a.has(o)).map(o=>e.jsxRuntimeExports.jsxs(I.Badge,{ref:l=>{if(l!=null)return x.current.add(l),()=>{x.current.delete(l)}},variant:"outline",className:"group flex items-center gap-1",onClick:r?l=>{l.stopPropagation(),f(o)}:void 0,children:[a.get(o),r&&e.jsxRuntimeExports.jsx(v.IconComponent,{iconName:"IconX",className:"text-muted-foreground group-hover:text-destructive size-2"})]},o)),e.jsxRuntimeExports.jsxs(I.Badge,{style:{display:p>0&&!S?"block":"none"},variant:"outline",ref:b,children:["+",p]})]})}function q({search:t=!0,children:r,...i}){const{isLoading:u,onSearchChange:d,searchValue:c,noResultsText:f}=M(),a=typeof t=="object"?!0:t;return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{style:{display:"none"},children:e.jsxRuntimeExports.jsx(m.Command,{children:e.jsxRuntimeExports.jsx(m.CommandList,{children:r})})}),e.jsxRuntimeExports.jsx(N.PopoverContent,{className:"min-w-[var(--radix-popover-trigger-width)] p-0",children:e.jsxRuntimeExports.jsxs(m.Command,{...i,children:[a?e.jsxRuntimeExports.jsx(m.CommandInput,{placeholder:typeof t=="object"?t.placeholder:void 0,value:c,onValueChange:d}):e.jsxRuntimeExports.jsx("button",{autoFocus:!0,"aria-hidden":"true",className:"sr-only"}),e.jsxRuntimeExports.jsx(m.CommandList,{children:u?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-6",children:[e.jsxRuntimeExports.jsx(v.IconComponent,{iconName:"IconLoader2",className:"text-muted-foreground size-4 animate-spin"}),e.jsxRuntimeExports.jsx("span",{className:"text-muted-foreground ml-2 text-sm",children:u})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[a&&e.jsxRuntimeExports.jsx(m.CommandEmpty,{children:f}),r]})})]})})]})}function O({value:t,children:r,badgeLabel:i,onSelect:u,...d}){const{toggleValue:c,selectedValues:f,onItemAdded:a}=M(),h=f.has(t);return n.useEffect(()=>{a(t,i??r)},[t,r,a,i]),e.jsxRuntimeExports.jsxs(m.CommandItem,{...d,value:t,onSelect:p=>{c(p),u?.(p)},children:[e.jsxRuntimeExports.jsx(v.IconComponent,{iconName:"IconCheck",className:e.cn("mr-2 size-4",h?"opacity-100":"opacity-0")}),r]})}function L(t){return e.jsxRuntimeExports.jsx(m.CommandGroup,{...t})}function _(t){return e.jsxRuntimeExports.jsx(m.CommandSeparator,{...t})}function M(){const t=n.useContext(V);if(t==null)throw new Error("useMultiSelectContext must be used within a MultiSelectContext");return t}exports.MultiSelect=k;exports.MultiSelectContent=q;exports.MultiSelectGroup=L;exports.MultiSelectItem=O;exports.MultiSelectSeparator=_;exports.MultiSelectTrigger=z;exports.MultiSelectValue=P;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { Button } from '@/components/button';
|
|
2
2
|
import { Command, CommandGroup, CommandItem, CommandSeparator } from '@/components/command';
|
|
3
3
|
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
4
|
-
declare function MultiSelect({ children, values, defaultValues, onValuesChange, }: {
|
|
4
|
+
declare function MultiSelect({ children, values, defaultValues, onValuesChange, isLoading, onSearchChange, loadingText, noResultsText, }: {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
values?: string[];
|
|
7
7
|
defaultValues?: string[];
|
|
8
8
|
onValuesChange?: (values: string[]) => void;
|
|
9
|
+
isLoading?: boolean;
|
|
10
|
+
onSearchChange?: (value: string) => void;
|
|
11
|
+
loadingText?: string;
|
|
12
|
+
noResultsText?: string;
|
|
9
13
|
}): import("react/jsx-runtime").JSX.Element;
|
|
10
14
|
declare function MultiSelectTrigger({ className, children, size, ...props }: {
|
|
11
15
|
className?: string;
|
|
@@ -1,70 +1,84 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { B as
|
|
3
|
-
import { C as
|
|
4
|
-
import { P as
|
|
5
|
-
import { createContext as
|
|
6
|
-
import { I as
|
|
7
|
-
const
|
|
8
|
-
function
|
|
9
|
-
children:
|
|
10
|
-
values:
|
|
11
|
-
defaultValues:
|
|
12
|
-
onValuesChange:
|
|
1
|
+
import { j as e, c as z } from "../index-DBpnlzOP.js";
|
|
2
|
+
import { B as E } from "../badge-Ds17GJH4.js";
|
|
3
|
+
import { C as P, f as R, d as _, b as A, c as L, e as F, g as W } from "../command-CGUB58ej.js";
|
|
4
|
+
import { P as G, b as T, c as B } from "../popover-C6pozFVL.js";
|
|
5
|
+
import { createContext as X, useState as y, useCallback as I, useEffect as k, useRef as V, useLayoutEffect as q, useContext as D } from "react";
|
|
6
|
+
import { I as N } from "../icon-component-DGImZz3K.js";
|
|
7
|
+
const O = X(null);
|
|
8
|
+
function Z({
|
|
9
|
+
children: t,
|
|
10
|
+
values: r,
|
|
11
|
+
defaultValues: o,
|
|
12
|
+
onValuesChange: a,
|
|
13
|
+
isLoading: u,
|
|
14
|
+
onSearchChange: l,
|
|
15
|
+
loadingText: p = "Loading...",
|
|
16
|
+
noResultsText: c = "No results found"
|
|
13
17
|
}) {
|
|
14
|
-
const [
|
|
15
|
-
new Set(
|
|
16
|
-
), [
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
return
|
|
18
|
+
const [h, m] = y(!1), [b, f] = y(
|
|
19
|
+
new Set(r ?? o)
|
|
20
|
+
), [v, d] = y(/* @__PURE__ */ new Map()), [g, j] = y("");
|
|
21
|
+
function s(n) {
|
|
22
|
+
const x = (w) => {
|
|
23
|
+
const C = new Set(w);
|
|
24
|
+
return C.has(n) ? C.delete(n) : C.add(n), C;
|
|
21
25
|
};
|
|
22
|
-
|
|
26
|
+
f(x), a?.([...x(b)]);
|
|
23
27
|
}
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
}, [])
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
const i = I((n, x) => {
|
|
29
|
+
d((w) => w.get(n) === x ? w : new Map(w).set(n, x));
|
|
30
|
+
}, []), S = I(
|
|
31
|
+
(n) => {
|
|
32
|
+
j(n), l?.(n);
|
|
33
|
+
},
|
|
34
|
+
[l]
|
|
35
|
+
);
|
|
36
|
+
return /* @__PURE__ */ e.jsx(
|
|
37
|
+
O,
|
|
29
38
|
{
|
|
30
39
|
value: {
|
|
31
|
-
open:
|
|
40
|
+
open: h,
|
|
32
41
|
setOpen: m,
|
|
33
|
-
selectedValues:
|
|
34
|
-
toggleValue:
|
|
35
|
-
items:
|
|
36
|
-
onItemAdded:
|
|
42
|
+
selectedValues: r ? new Set(r) : b,
|
|
43
|
+
toggleValue: s,
|
|
44
|
+
items: v,
|
|
45
|
+
onItemAdded: i,
|
|
46
|
+
isLoading: u,
|
|
47
|
+
searchValue: g,
|
|
48
|
+
onSearchChange: S,
|
|
49
|
+
loadingText: p,
|
|
50
|
+
noResultsText: c
|
|
37
51
|
},
|
|
38
|
-
children: /* @__PURE__ */
|
|
52
|
+
children: /* @__PURE__ */ e.jsx(G, { open: h, onOpenChange: m, children: t })
|
|
39
53
|
}
|
|
40
54
|
);
|
|
41
55
|
}
|
|
42
|
-
function
|
|
43
|
-
className:
|
|
44
|
-
children:
|
|
45
|
-
size:
|
|
46
|
-
...
|
|
56
|
+
function $({
|
|
57
|
+
className: t,
|
|
58
|
+
children: r,
|
|
59
|
+
size: o = "md",
|
|
60
|
+
...a
|
|
47
61
|
}) {
|
|
48
|
-
const { open:
|
|
49
|
-
return /* @__PURE__ */
|
|
62
|
+
const { open: u } = M();
|
|
63
|
+
return /* @__PURE__ */ e.jsx(B, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
50
64
|
"button",
|
|
51
65
|
{
|
|
52
|
-
...
|
|
53
|
-
role:
|
|
54
|
-
"aria-expanded":
|
|
55
|
-
"data-size":
|
|
56
|
-
className:
|
|
66
|
+
...a,
|
|
67
|
+
role: a.role ?? "combobox",
|
|
68
|
+
"aria-expanded": a["aria-expanded"] ?? u,
|
|
69
|
+
"data-size": o,
|
|
70
|
+
className: z(
|
|
57
71
|
"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",
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
o === "xs" && 'label-sm h-7 px-2 py-1 [&_svg:not([class*="size-"])]:size-3.5',
|
|
73
|
+
o === "sm" && "label-md h-8 px-2 py-1",
|
|
74
|
+
o === "md" && "label-lg h-12 px-3 py-1",
|
|
75
|
+
o === "lg" && "label-xl h-16 px-4 py-2",
|
|
76
|
+
t
|
|
63
77
|
),
|
|
64
78
|
children: [
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
79
|
+
r,
|
|
80
|
+
/* @__PURE__ */ e.jsx(
|
|
81
|
+
N,
|
|
68
82
|
{
|
|
69
83
|
iconName: "IconSelector",
|
|
70
84
|
className: "size-4 shrink-0 opacity-50"
|
|
@@ -74,65 +88,65 @@ function Y({
|
|
|
74
88
|
}
|
|
75
89
|
) });
|
|
76
90
|
}
|
|
77
|
-
function
|
|
78
|
-
placeholder:
|
|
79
|
-
clickToRemove:
|
|
80
|
-
className:
|
|
81
|
-
overflowBehavior:
|
|
82
|
-
...
|
|
91
|
+
function ee({
|
|
92
|
+
placeholder: t,
|
|
93
|
+
clickToRemove: r = !0,
|
|
94
|
+
className: o,
|
|
95
|
+
overflowBehavior: a = "wrap-when-open",
|
|
96
|
+
...u
|
|
83
97
|
}) {
|
|
84
|
-
const { selectedValues:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}, [
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
let
|
|
93
|
-
for (let
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
98
|
+
const { selectedValues: l, toggleValue: p, items: c, open: h } = M(), [m, b] = y(0), f = V(null), v = V(null), d = V(/* @__PURE__ */ new Set()), g = a === "wrap" || a === "wrap-when-open" && h;
|
|
99
|
+
k(() => {
|
|
100
|
+
g && d.current.forEach((s) => s.style.removeProperty("display"));
|
|
101
|
+
}, [g]);
|
|
102
|
+
const j = I(() => {
|
|
103
|
+
if (f.current == null) return;
|
|
104
|
+
const s = f.current, i = v.current;
|
|
105
|
+
i != null && (i.style.display = "none"), d.current.forEach((n) => n.style.removeProperty("display"));
|
|
106
|
+
let S = 0;
|
|
107
|
+
for (let n = d.current.size - 1; n >= 0; n--) {
|
|
108
|
+
const x = [...d.current][n];
|
|
109
|
+
if (s.scrollWidth <= s.clientWidth)
|
|
96
110
|
break;
|
|
97
|
-
|
|
111
|
+
S = d.current.size - n, x.style.display = "none", i?.style.removeProperty("display");
|
|
98
112
|
}
|
|
99
|
-
b(
|
|
113
|
+
b(S);
|
|
100
114
|
}, []);
|
|
101
|
-
return
|
|
102
|
-
if (
|
|
103
|
-
const
|
|
104
|
-
return
|
|
105
|
-
}, [
|
|
106
|
-
|
|
107
|
-
}, [
|
|
115
|
+
return k(() => {
|
|
116
|
+
if (f.current == null) return;
|
|
117
|
+
const s = new ResizeObserver(j);
|
|
118
|
+
return s.observe(f.current), () => s.disconnect();
|
|
119
|
+
}, [j]), q(() => {
|
|
120
|
+
j();
|
|
121
|
+
}, [l, j]), l.size === 0 && t ? /* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground font-normal", children: t }) : /* @__PURE__ */ e.jsxs(
|
|
108
122
|
"div",
|
|
109
123
|
{
|
|
110
|
-
...
|
|
111
|
-
ref:
|
|
112
|
-
className:
|
|
124
|
+
...u,
|
|
125
|
+
ref: f,
|
|
126
|
+
className: z(
|
|
113
127
|
"flex min-h-[1.75rem] w-full gap-1.5 overflow-hidden",
|
|
114
|
-
|
|
115
|
-
|
|
128
|
+
g && "flex-wrap",
|
|
129
|
+
o
|
|
116
130
|
),
|
|
117
131
|
children: [
|
|
118
|
-
[...
|
|
119
|
-
|
|
132
|
+
[...l].filter((s) => c.has(s)).map((s) => /* @__PURE__ */ e.jsxs(
|
|
133
|
+
E,
|
|
120
134
|
{
|
|
121
|
-
ref: (
|
|
122
|
-
if (
|
|
123
|
-
return
|
|
124
|
-
|
|
135
|
+
ref: (i) => {
|
|
136
|
+
if (i != null)
|
|
137
|
+
return d.current.add(i), () => {
|
|
138
|
+
d.current.delete(i);
|
|
125
139
|
};
|
|
126
140
|
},
|
|
127
141
|
variant: "outline",
|
|
128
142
|
className: "group flex items-center gap-1",
|
|
129
|
-
onClick:
|
|
130
|
-
|
|
143
|
+
onClick: r ? (i) => {
|
|
144
|
+
i.stopPropagation(), p(s);
|
|
131
145
|
} : void 0,
|
|
132
146
|
children: [
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
147
|
+
c.get(s),
|
|
148
|
+
r && /* @__PURE__ */ e.jsx(
|
|
149
|
+
N,
|
|
136
150
|
{
|
|
137
151
|
iconName: "IconX",
|
|
138
152
|
className: "text-muted-foreground group-hover:text-destructive size-2"
|
|
@@ -140,19 +154,19 @@ function Z({
|
|
|
140
154
|
)
|
|
141
155
|
]
|
|
142
156
|
},
|
|
143
|
-
|
|
157
|
+
s
|
|
144
158
|
)),
|
|
145
|
-
/* @__PURE__ */
|
|
146
|
-
|
|
159
|
+
/* @__PURE__ */ e.jsxs(
|
|
160
|
+
E,
|
|
147
161
|
{
|
|
148
162
|
style: {
|
|
149
|
-
display:
|
|
163
|
+
display: m > 0 && !g ? "block" : "none"
|
|
150
164
|
},
|
|
151
165
|
variant: "outline",
|
|
152
|
-
ref:
|
|
166
|
+
ref: v,
|
|
153
167
|
children: [
|
|
154
168
|
"+",
|
|
155
|
-
|
|
169
|
+
m
|
|
156
170
|
]
|
|
157
171
|
}
|
|
158
172
|
)
|
|
@@ -160,79 +174,90 @@ function Z({
|
|
|
160
174
|
}
|
|
161
175
|
);
|
|
162
176
|
}
|
|
163
|
-
function
|
|
164
|
-
search:
|
|
165
|
-
children:
|
|
166
|
-
...
|
|
177
|
+
function te({
|
|
178
|
+
search: t = !0,
|
|
179
|
+
children: r,
|
|
180
|
+
...o
|
|
167
181
|
}) {
|
|
168
|
-
const
|
|
169
|
-
return /* @__PURE__ */
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
|
|
173
|
-
|
|
182
|
+
const { isLoading: a, onSearchChange: u, searchValue: l, noResultsText: p } = M(), c = typeof t == "object" ? !0 : t;
|
|
183
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
184
|
+
/* @__PURE__ */ e.jsx("div", { style: { display: "none" }, children: /* @__PURE__ */ e.jsx(P, { children: /* @__PURE__ */ e.jsx(R, { children: r }) }) }),
|
|
185
|
+
/* @__PURE__ */ e.jsx(T, { className: "min-w-[var(--radix-popover-trigger-width)] p-0", children: /* @__PURE__ */ e.jsxs(P, { ...o, children: [
|
|
186
|
+
c ? /* @__PURE__ */ e.jsx(
|
|
187
|
+
_,
|
|
174
188
|
{
|
|
175
|
-
placeholder: typeof
|
|
189
|
+
placeholder: typeof t == "object" ? t.placeholder : void 0,
|
|
190
|
+
value: l,
|
|
191
|
+
onValueChange: u
|
|
176
192
|
}
|
|
177
|
-
) : /* @__PURE__ */
|
|
178
|
-
/* @__PURE__ */
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
193
|
+
) : /* @__PURE__ */ e.jsx("button", { autoFocus: !0, "aria-hidden": "true", className: "sr-only" }),
|
|
194
|
+
/* @__PURE__ */ e.jsx(R, { children: a ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-6", children: [
|
|
195
|
+
/* @__PURE__ */ e.jsx(
|
|
196
|
+
N,
|
|
197
|
+
{
|
|
198
|
+
iconName: "IconLoader2",
|
|
199
|
+
className: "text-muted-foreground size-4 animate-spin"
|
|
200
|
+
}
|
|
201
|
+
),
|
|
202
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground ml-2 text-sm", children: a })
|
|
203
|
+
] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
204
|
+
c && /* @__PURE__ */ e.jsx(A, { children: p }),
|
|
205
|
+
r
|
|
206
|
+
] }) })
|
|
182
207
|
] }) })
|
|
183
208
|
] });
|
|
184
209
|
}
|
|
185
|
-
function
|
|
186
|
-
value:
|
|
187
|
-
children:
|
|
188
|
-
badgeLabel:
|
|
189
|
-
onSelect:
|
|
190
|
-
...
|
|
210
|
+
function ne({
|
|
211
|
+
value: t,
|
|
212
|
+
children: r,
|
|
213
|
+
badgeLabel: o,
|
|
214
|
+
onSelect: a,
|
|
215
|
+
...u
|
|
191
216
|
}) {
|
|
192
|
-
const { toggleValue:
|
|
193
|
-
return
|
|
194
|
-
|
|
195
|
-
}, [
|
|
196
|
-
|
|
217
|
+
const { toggleValue: l, selectedValues: p, onItemAdded: c } = M(), h = p.has(t);
|
|
218
|
+
return k(() => {
|
|
219
|
+
c(t, o ?? r);
|
|
220
|
+
}, [t, r, c, o]), /* @__PURE__ */ e.jsxs(
|
|
221
|
+
F,
|
|
197
222
|
{
|
|
198
|
-
...
|
|
199
|
-
value:
|
|
200
|
-
onSelect: (
|
|
201
|
-
m
|
|
223
|
+
...u,
|
|
224
|
+
value: t,
|
|
225
|
+
onSelect: (m) => {
|
|
226
|
+
l(m), a?.(m);
|
|
202
227
|
},
|
|
203
228
|
children: [
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
|
|
229
|
+
/* @__PURE__ */ e.jsx(
|
|
230
|
+
N,
|
|
206
231
|
{
|
|
207
232
|
iconName: "IconCheck",
|
|
208
|
-
className:
|
|
233
|
+
className: z("mr-2 size-4", h ? "opacity-100" : "opacity-0")
|
|
209
234
|
}
|
|
210
235
|
),
|
|
211
|
-
|
|
236
|
+
r
|
|
212
237
|
]
|
|
213
238
|
}
|
|
214
239
|
);
|
|
215
240
|
}
|
|
216
|
-
function
|
|
217
|
-
return /* @__PURE__ */
|
|
241
|
+
function re(t) {
|
|
242
|
+
return /* @__PURE__ */ e.jsx(L, { ...t });
|
|
218
243
|
}
|
|
219
|
-
function
|
|
220
|
-
return /* @__PURE__ */
|
|
244
|
+
function se(t) {
|
|
245
|
+
return /* @__PURE__ */ e.jsx(W, { ...t });
|
|
221
246
|
}
|
|
222
247
|
function M() {
|
|
223
|
-
const
|
|
224
|
-
if (
|
|
248
|
+
const t = D(O);
|
|
249
|
+
if (t == null)
|
|
225
250
|
throw new Error(
|
|
226
251
|
"useMultiSelectContext must be used within a MultiSelectContext"
|
|
227
252
|
);
|
|
228
|
-
return
|
|
253
|
+
return t;
|
|
229
254
|
}
|
|
230
255
|
export {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
256
|
+
Z as MultiSelect,
|
|
257
|
+
te as MultiSelectContent,
|
|
258
|
+
re as MultiSelectGroup,
|
|
259
|
+
ne as MultiSelectItem,
|
|
260
|
+
se as MultiSelectSeparator,
|
|
261
|
+
$ as MultiSelectTrigger,
|
|
262
|
+
ee as MultiSelectValue
|
|
238
263
|
};
|
package/package.json
CHANGED
package/dist/badge-CS2XfLYQ.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("./index-DSjHHn1r.cjs"),v=require("@radix-ui/react-slot"),h=require("./index-BVmT9wZC.cjs"),i=require("./icon-component-DTlgy__B.cjs"),x=h.cva("focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex w-fit shrink-0 items-center justify-center gap-2 overflow-hidden border font-semibold whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none",{variants:{variant:{default:"bg-muted text-muted-foreground [a&]:hover:bg-muted/90 border-transparent",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90 border-transparent",destructive:"bg-destructive [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 border-transparent text-white",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",error:"bg-error-light text-error-main [a&]:hover:bg-error-light/90 border-transparent",warning:"bg-warning-light text-warning-main [a&]:hover:bg-warning-light/90 border-transparent",success:"bg-success-light text-success-main [a&]:hover:bg-success-light/90 border-transparent",info:"bg-info-light text-info-main [a&]:hover:bg-info-light/90 border-transparent",neutral:"border-transparent bg-black text-white [a&]:hover:bg-black/90",primary:"bg-primary-600 [a&]:hover:bg-primary-600/90 border-transparent text-white",yellow:"border-transparent bg-yellow-600 text-white [a&]:hover:bg-yellow-600/90",blue:"border-transparent bg-blue-600 text-white [a&]:hover:bg-blue-600/90",violet:"border-transparent bg-violet-600 text-white [a&]:hover:bg-violet-600/90"},size:{xs:"paragraph-xs px-3 py-px [&>svg]:size-3",sm:"paragraph-xs px-4 py-1 [&>svg]:size-4",md:"paragraph-sm px-4 py-2 [&>svg]:size-4",lg:"paragraph-md px-4 py-2 [&>svg]:size-5"},weight:{light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},rounded:{default:"rounded-2xl",full:"rounded-full"}},defaultVariants:{variant:"default",size:"xs",weight:"semibold",rounded:"full"}});function f({className:o,variant:s,size:d,weight:g,rounded:l,iconName:e,iconPosition:t="left",iconStroke:a,iconOnly:n,asChild:b=!1,children:u,...p}){const c=b?v.Slot:"span";return r.jsxRuntimeExports.jsxs(c,{"data-slot":"badge",className:r.cn(x({variant:s,size:d,weight:g,rounded:l}),n&&"px-2.5 py-2",o),...p,children:[e&&t==="left"&&r.jsxRuntimeExports.jsx(i.IconComponent,{iconName:e,stroke:a}),!n&&u,e&&t==="right"&&r.jsxRuntimeExports.jsx(i.IconComponent,{iconName:e,stroke:a})]})}exports.Badge=f;
|