@yuno-payments/dashboard-design-system 0.0.53-beta.2 → 0.0.53

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.
@@ -16,6 +16,7 @@ export { Input, type InputProps } from './input';
16
16
  export { NavLink, type NavLinkProps } from './nav-link';
17
17
  export { Select, type SelectProps, type SelectOption, type SelectOptionGroup, } from './select';
18
18
  export { Link, type LinkProps } from './link';
19
+ export { MultiSelect, type MultiSelectProps, type MultiSelectOption, } from './multi-select';
19
20
  export { RadioGroup, type RadioGroupProps, type RadioOption, RadioGroupBase, RadioGroupItem, } from './radio-group';
20
21
  export { Skeleton } from './skeleton';
21
22
  export { Separator, type SeparatorProps } from './separator';
@@ -0,0 +1,2 @@
1
+ export { MultiSelect } from './multi-select';
2
+ export type { MultiSelectProps, MultiSelectOption } from './multi-select';
@@ -0,0 +1,65 @@
1
+ import * as React from "react";
2
+ export interface MultiSelectOption {
3
+ value: string;
4
+ label: string;
5
+ icon?: string;
6
+ }
7
+ export interface MultiSelectProps {
8
+ /**
9
+ * Array of options to display in the dropdown
10
+ */
11
+ options: MultiSelectOption[];
12
+ /**
13
+ * Currently selected values (array of value strings)
14
+ */
15
+ value?: string[];
16
+ /**
17
+ * Callback fired when selection changes
18
+ */
19
+ onValueChange?: (value: string[]) => void;
20
+ /**
21
+ * Placeholder text when no items are selected
22
+ */
23
+ placeholder?: string;
24
+ /**
25
+ * Placeholder text for the search input
26
+ */
27
+ searchPlaceholder?: string;
28
+ /**
29
+ * Message to display when no options match the search
30
+ */
31
+ emptyMessage?: string;
32
+ /**
33
+ * Whether the component is disabled
34
+ */
35
+ disabled?: boolean;
36
+ /**
37
+ * Optional label for the multi-select
38
+ */
39
+ label?: string;
40
+ /**
41
+ * Optional description text
42
+ */
43
+ description?: string;
44
+ /**
45
+ * Error message to display
46
+ */
47
+ error?: string;
48
+ /**
49
+ * Maximum number of items to display as badges before showing count
50
+ */
51
+ maxDisplay?: number;
52
+ /**
53
+ * Additional CSS classes for the trigger button
54
+ */
55
+ className?: string;
56
+ /**
57
+ * Whether to show badges for selected items
58
+ */
59
+ showBadges?: boolean;
60
+ /**
61
+ * Whether to allow clearing all selections
62
+ */
63
+ allowClear?: boolean;
64
+ }
65
+ export declare const MultiSelect: React.ForwardRefExoticComponent<MultiSelectProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,160 @@
1
+ import { j as e } from "../../../_virtual/jsx-runtime.js";
2
+ import * as c from "react";
3
+ import { cn as j } from "../../../lib/utils.js";
4
+ import { Button as B } from "../../../vendor/shadcn/button.js";
5
+ import { Command as E, CommandInput as F, CommandEmpty as I, CommandList as A, CommandGroup as G, CommandItem as T } from "../../../vendor/shadcn/command.js";
6
+ import { Popover as W, PopoverTrigger as X, PopoverContent as q } from "../../../vendor/shadcn/popover.js";
7
+ import g from "../../../node_modules/lucide-react/dist/esm/icons/x.js";
8
+ import z from "../../../node_modules/lucide-react/dist/esm/icons/check.js";
9
+ const D = c.forwardRef(
10
+ ({
11
+ options: m,
12
+ value: s = [],
13
+ onValueChange: l,
14
+ placeholder: b = "Select items...",
15
+ searchPlaceholder: w = "Search...",
16
+ emptyMessage: N = "No results found.",
17
+ disabled: v = !1,
18
+ label: i,
19
+ description: u,
20
+ error: o,
21
+ maxDisplay: a = 3,
22
+ className: C,
23
+ showBadges: x = !0,
24
+ allowClear: y = !0
25
+ }, k) => {
26
+ const [h, S] = c.useState(!1), [p, L] = c.useState(""), P = (t) => {
27
+ const r = s.includes(t) ? s.filter((d) => d !== t) : [...s, t];
28
+ l?.(r);
29
+ }, V = (t, r) => {
30
+ r?.preventDefault(), r?.stopPropagation();
31
+ const d = s.filter((R) => R !== t);
32
+ l?.(d);
33
+ }, O = (t) => {
34
+ t.preventDefault(), t.stopPropagation(), l?.([]);
35
+ }, n = s.map((t) => m.find((r) => r.value === t)).filter(Boolean), M = x ? n.slice(0, a) : [], f = n.length > a ? n.length - a : 0;
36
+ return /* @__PURE__ */ e.jsxs("div", { className: "w-full", children: [
37
+ i && /* @__PURE__ */ e.jsx("label", { className: "text-sm font-medium text-foreground mb-1.5 block", children: i }),
38
+ u && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground mb-2", children: u }),
39
+ /* @__PURE__ */ e.jsxs(W, { open: h, onOpenChange: S, children: [
40
+ /* @__PURE__ */ e.jsx(X, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
41
+ B,
42
+ {
43
+ ref: k,
44
+ variant: "outline",
45
+ role: "combobox",
46
+ "aria-expanded": h,
47
+ disabled: v,
48
+ className: j(
49
+ "w-full justify-between h-auto min-h-9 py-2",
50
+ o && "border-destructive",
51
+ !s.length && "text-muted-foreground",
52
+ C
53
+ ),
54
+ children: [
55
+ /* @__PURE__ */ e.jsx("div", { className: "flex flex-wrap gap-1 items-center flex-1", children: s.length === 0 ? /* @__PURE__ */ e.jsx("span", { children: b }) : x ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
56
+ M.map((t) => /* @__PURE__ */ e.jsxs(
57
+ "span",
58
+ {
59
+ className: "inline-flex items-center mr-1 px-2 py-0.5 h-6 text-xs font-normal rounded-md border border-border bg-secondary text-secondary-foreground",
60
+ children: [
61
+ /* @__PURE__ */ e.jsx("span", { className: "max-w-[150px] truncate", children: t.label }),
62
+ /* @__PURE__ */ e.jsx(
63
+ "button",
64
+ {
65
+ type: "button",
66
+ className: "ml-1 rounded-full outline-hidden hover:bg-muted-foreground/20",
67
+ onClick: (r) => V(t.value, r),
68
+ children: /* @__PURE__ */ e.jsx(g, { className: "h-3 w-3" })
69
+ }
70
+ )
71
+ ]
72
+ },
73
+ t.value
74
+ )),
75
+ f > 0 && /* @__PURE__ */ e.jsxs("span", { className: "inline-flex items-center px-2 py-0.5 h-6 text-xs font-normal rounded-md border border-border bg-secondary text-secondary-foreground", children: [
76
+ "+",
77
+ f,
78
+ " more"
79
+ ] })
80
+ ] }) : /* @__PURE__ */ e.jsxs("span", { className: "text-sm", children: [
81
+ n.length,
82
+ " selected"
83
+ ] }) }),
84
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 ml-2", children: [
85
+ y && s.length > 0 && /* @__PURE__ */ e.jsx(
86
+ "button",
87
+ {
88
+ type: "button",
89
+ onClick: O,
90
+ className: "h-4 w-4 rounded-full hover:bg-muted p-0.5",
91
+ children: /* @__PURE__ */ e.jsx(g, { className: "h-3 w-3" })
92
+ }
93
+ ),
94
+ /* @__PURE__ */ e.jsx(
95
+ "svg",
96
+ {
97
+ className: "h-4 w-4 shrink-0 opacity-50",
98
+ fill: "none",
99
+ stroke: "currentColor",
100
+ viewBox: "0 0 24 24",
101
+ xmlns: "http://www.w3.org/2000/svg",
102
+ children: /* @__PURE__ */ e.jsx(
103
+ "path",
104
+ {
105
+ strokeLinecap: "round",
106
+ strokeLinejoin: "round",
107
+ strokeWidth: 2,
108
+ d: "M19 9l-7 7-7-7"
109
+ }
110
+ )
111
+ }
112
+ )
113
+ ] })
114
+ ]
115
+ }
116
+ ) }),
117
+ /* @__PURE__ */ e.jsx(q, { className: "w-[var(--radix-popover-trigger-width)] p-0", children: /* @__PURE__ */ e.jsxs(E, { shouldFilter: !1, children: [
118
+ /* @__PURE__ */ e.jsx(
119
+ F,
120
+ {
121
+ placeholder: w,
122
+ value: p,
123
+ onValueChange: L
124
+ }
125
+ ),
126
+ /* @__PURE__ */ e.jsx(I, { children: N }),
127
+ /* @__PURE__ */ e.jsx(A, { children: /* @__PURE__ */ e.jsx(G, { children: m.filter(
128
+ (t) => t.label.toLowerCase().includes(p.toLowerCase())
129
+ ).map((t) => /* @__PURE__ */ e.jsxs(
130
+ T,
131
+ {
132
+ value: t.value,
133
+ onSelect: () => {
134
+ P(t.value);
135
+ },
136
+ children: [
137
+ /* @__PURE__ */ e.jsx(
138
+ z,
139
+ {
140
+ className: j(
141
+ "mr-2 h-4 w-4",
142
+ s.includes(t.value) ? "opacity-100" : "opacity-0"
143
+ )
144
+ }
145
+ ),
146
+ t.label
147
+ ]
148
+ },
149
+ t.value
150
+ )) }) })
151
+ ] }) })
152
+ ] }),
153
+ o && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-destructive mt-1.5", children: o })
154
+ ] });
155
+ }
156
+ );
157
+ D.displayName = "MultiSelect";
158
+ export {
159
+ D as MultiSelect
160
+ };
@@ -9,6 +9,7 @@ interface TooltipProps extends ShadcnTooltipRootProps {
9
9
  contentProps?: TooltipContentProps;
10
10
  providerProps?: TooltipProviderProps;
11
11
  triggerProps?: TooltipTriggerProps;
12
+ show?: boolean;
12
13
  }
13
14
  declare const Tooltip: import('react').ForwardRefExoticComponent<TooltipProps & import('react').RefAttributes<HTMLDivElement>>;
14
- export { Tooltip, TooltipProvider, type TooltipProps, type TooltipProviderProps };
15
+ export { Tooltip, TooltipProvider, type TooltipProps, type TooltipProviderProps, };
@@ -1,21 +1,22 @@
1
1
  import { j as o } from "../../../_virtual/jsx-runtime.js";
2
- import { forwardRef as m } from "react";
3
- import { TooltipProvider as n, Tooltip as T, TooltipTrigger as d, TooltipContent as x } from "../../../vendor/shadcn/tooltip.js";
4
- const a = m(
2
+ import { forwardRef as n } from "react";
3
+ import { TooltipProvider as x, Tooltip as T, TooltipTrigger as a, TooltipContent as j } from "../../../vendor/shadcn/tooltip.js";
4
+ const d = n(
5
5
  ({
6
- content: r,
7
- children: i,
8
- contentProps: t,
9
- providerProps: p,
10
- triggerProps: e,
6
+ content: t,
7
+ children: r,
8
+ contentProps: i,
9
+ providerProps: e,
10
+ triggerProps: p,
11
+ show: s = !0,
11
12
  ...l
12
- }, s) => /* @__PURE__ */ o.jsx(n, { ...p, children: /* @__PURE__ */ o.jsxs(T, { ...l, children: [
13
- /* @__PURE__ */ o.jsx(d, { asChild: !0, ...e, children: i }),
14
- /* @__PURE__ */ o.jsx(x, { ref: s, ...t, children: r })
15
- ] }) })
13
+ }, m) => s ? /* @__PURE__ */ o.jsx(x, { ...e, children: /* @__PURE__ */ o.jsxs(T, { ...l, children: [
14
+ /* @__PURE__ */ o.jsx(a, { asChild: !0, ...p, children: r }),
15
+ /* @__PURE__ */ o.jsx(j, { ref: m, ...i, children: t })
16
+ ] }) }) : /* @__PURE__ */ o.jsx(o.Fragment, { children: r })
16
17
  );
17
- a.displayName = "Tooltip";
18
+ d.displayName = "Tooltip";
18
19
  export {
19
- a as Tooltip,
20
- n as TooltipProvider
20
+ d as Tooltip,
21
+ x as TooltipProvider
21
22
  };