docthub-core-components 3.0.0 → 3.2.1
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/overrides/ui/auto-complete.js +466 -0
- package/dist/components/overrides/ui/autocomplete-checkbox.js +491 -0
- package/dist/components/overrides/ui/chips/doct-chip.js +157 -0
- package/dist/components/overrides/ui/circular-progress.js +32 -0
- package/dist/components/overrides/ui/composed/address-form-section.js +67 -0
- package/dist/components/overrides/ui/composed/contact-form-section.js +56 -0
- package/dist/components/overrides/ui/composed/search-filter-section.js +132 -0
- package/dist/components/overrides/ui/composed/user-registration-section.js +77 -0
- package/dist/components/overrides/ui/currencyInput/currency-input.js +69 -0
- package/dist/components/overrides/ui/doct-animation-loader.js +13 -0
- package/dist/components/overrides/ui/expandable-card.js +115 -0
- package/dist/components/overrides/ui/footer/doct-footer.js +35 -0
- package/dist/components/overrides/ui/footer/footer-desktop.js +92 -0
- package/dist/components/overrides/ui/footer/footer-mobile.js +123 -0
- package/dist/components/overrides/ui/footer/footer-routes.js +87 -0
- package/dist/components/overrides/ui/footer/footer-shared.js +137 -0
- package/dist/components/overrides/ui/footer/presets.js +269 -0
- package/dist/components/overrides/ui/inputs/labeled-input.js +92 -0
- package/dist/components/overrides/ui/inputs/otp-input.js +101 -0
- package/dist/components/overrides/ui/inputs/password-input.js +77 -0
- package/dist/components/overrides/ui/inputs/phone-input.js +336 -0
- package/dist/components/overrides/ui/navigation-menu/doct-navigation-menu.js +22 -0
- package/dist/components/overrides/ui/navigation-menu/individual-nav-routes.js +46 -0
- package/dist/components/overrides/ui/navigation-menu/individual-navigation-menu-desktop.js +109 -0
- package/dist/components/overrides/ui/navigation-menu/individual-navigation-menu-mobile.js +231 -0
- package/dist/components/overrides/ui/navigation-menu/individual-navigation-menu.js +44 -0
- package/dist/components/overrides/ui/navigation-menu/nav-env.js +64 -0
- package/dist/components/overrides/ui/navigation-menu/navigation-menu-adapter.js +55 -0
- package/dist/components/overrides/ui/navigation-menu/navigation-menu-internal.js +36 -0
- package/dist/components/overrides/ui/navigation-menu/organization-nav-routes.js +34 -0
- package/dist/components/overrides/ui/navigation-menu/organization-navigation-menu-desktop.js +109 -0
- package/dist/components/overrides/ui/navigation-menu/organization-navigation-menu-mobile.js +231 -0
- package/dist/components/overrides/ui/navigation-menu/organization-navigation-menu.js +44 -0
- package/dist/components/overrides/ui/navigation-menu/presets.js +238 -0
- package/dist/components/overrides/ui/navigation-menu/types.js +6 -0
- package/dist/components/overrides/ui/pickers/date-picker-field.js +361 -0
- package/dist/components/overrides/ui/pickers/date-range-picker-field.js +288 -0
- package/dist/components/overrides/ui/pickers/day-picker-bounds.js +38 -0
- package/dist/components/overrides/ui/pickers/select-field.js +158 -0
- package/dist/components/overrides/ui/search/auto-complete.js +64 -0
- package/dist/components/overrides/ui/search/search-input.js +65 -0
- package/dist/components/overrides/ui/showcase/component-section.js +45 -0
- package/dist/components/ui/alert.js +94 -0
- package/dist/components/ui/avatar.js +69 -0
- package/dist/components/ui/badge.js +37 -0
- package/dist/components/ui/breadcrumb.js +117 -0
- package/dist/components/ui/button.js +223 -0
- package/dist/components/ui/calendar.js +100 -0
- package/dist/components/ui/checkbox.js +57 -0
- package/dist/components/ui/collapsible.js +25 -0
- package/dist/components/ui/command.js +132 -0
- package/dist/components/ui/dialog.js +230 -0
- package/dist/components/ui/drawer.js +119 -0
- package/dist/components/ui/dropdown-menu.js +216 -0
- package/dist/components/ui/input.js +48 -0
- package/dist/components/ui/label.js +22 -0
- package/dist/components/ui/popover.js +181 -0
- package/dist/components/ui/progress.js +91 -0
- package/dist/components/ui/radio-group.js +49 -0
- package/dist/components/ui/select.js +169 -0
- package/dist/components/ui/skeleton.js +91 -0
- package/dist/components/ui/spinner.js +32 -0
- package/dist/components/ui/tabs.js +68 -0
- package/dist/components/ui/textarea.js +73 -0
- package/dist/components/ui/timeline.js +177 -0
- package/dist/components/ui/toast.js +82 -0
- package/dist/components/ui/tooltip.js +91 -0
- package/dist/components/ui/typography.js +213 -0
- package/dist/hooks/use-exclusive-dropdown.js +53 -0
- package/dist/hooks/use-mobile.js +19 -0
- package/dist/hooks/useAutocompleteCheckbox.js +204 -0
- package/dist/index.js +187 -0
- package/dist/lib/dropdown-manager.js +17 -0
- package/dist/lib/get-floating-dropdown-position.js +32 -0
- package/dist/lib/get-scroll-parents.js +20 -0
- package/dist/lib/slot.js +40 -0
- package/dist/lib/utils.js +9 -0
- package/dist/src/components/overrides/ui/autocomplete-checkbox.d.ts +16 -1
- package/dist/style.css +1 -1
- package/dist/util/getInputClasses.js +19 -0
- package/package.json +5 -5
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as n, jsxs as D } from "react/jsx-runtime";
|
|
3
|
+
import { c as ro } from "react-compiler-runtime";
|
|
4
|
+
import { ChevronDown as to, X as ao } from "lucide-react";
|
|
5
|
+
import { useId as so, useState as co, useEffect as yt, useRef as oo } from "react";
|
|
6
|
+
import { createPortal as bo } from "react-dom";
|
|
7
|
+
import { Chip as go } from "./chips/doct-chip.js";
|
|
8
|
+
import { SearchInput as xo } from "./search/search-input.js";
|
|
9
|
+
import { DoctButton as vo } from "../../ui/button.js";
|
|
10
|
+
import { Checkbox as wo } from "../../ui/checkbox.js";
|
|
11
|
+
import { Input as yo } from "../../ui/input.js";
|
|
12
|
+
import { TooltipProvider as ko, Tooltip as Co, TooltipTrigger as So, TooltipContent as No } from "../../ui/tooltip.js";
|
|
13
|
+
import { useAutocompleteCheckbox as To } from "../../../hooks/useAutocompleteCheckbox.js";
|
|
14
|
+
import { cn as C } from "../../../lib/utils.js";
|
|
15
|
+
const Oo = {
|
|
16
|
+
small: "h-8 text-xs px-2",
|
|
17
|
+
medium: "h-10 text-sm px-3",
|
|
18
|
+
large: "h-12 text-base px-4"
|
|
19
|
+
}, Po = {
|
|
20
|
+
outlined: "border border-input bg-background",
|
|
21
|
+
filled: "border-0 bg-accent",
|
|
22
|
+
standard: "border-0 border-b border-input rounded-none bg-transparent"
|
|
23
|
+
}, Io = (Qe) => {
|
|
24
|
+
const e = ro(68), {
|
|
25
|
+
option: r,
|
|
26
|
+
index: g,
|
|
27
|
+
isSelected: d,
|
|
28
|
+
isHighlighted: b,
|
|
29
|
+
onSelect: a,
|
|
30
|
+
getOptionLabel: i,
|
|
31
|
+
renderOption: v,
|
|
32
|
+
freeSolo: x,
|
|
33
|
+
originalOptions: S,
|
|
34
|
+
checkboxPosition: N,
|
|
35
|
+
showChip: T,
|
|
36
|
+
checkboxProps: B,
|
|
37
|
+
chipProps: F,
|
|
38
|
+
checkboxColor: et,
|
|
39
|
+
hideCheckbox: Ue
|
|
40
|
+
} = Qe, Ne = x === void 0 ? !1 : x;
|
|
41
|
+
let ae;
|
|
42
|
+
e[0] !== S ? (ae = S === void 0 ? [] : S, e[0] = S, e[1] = ae) : ae = e[1];
|
|
43
|
+
const Te = ae, Z = Ue === void 0 ? !1 : Ue, $ = oo(null), [Oe, kt] = co(!1);
|
|
44
|
+
let w;
|
|
45
|
+
e[2] !== a || e[3] !== r ? (w = () => {
|
|
46
|
+
a(r);
|
|
47
|
+
}, e[2] = a, e[3] = r, e[4] = w) : w = e[4];
|
|
48
|
+
const Pe = w;
|
|
49
|
+
let ce;
|
|
50
|
+
e[5] !== a || e[6] !== r ? (ce = (p) => {
|
|
51
|
+
(p.key === "Enter" || p.key === " ") && (p.preventDefault(), a(r));
|
|
52
|
+
}, e[5] = a, e[6] = r, e[7] = ce) : ce = e[7];
|
|
53
|
+
const Ie = ce;
|
|
54
|
+
let G;
|
|
55
|
+
e[8] !== Ne || e[9] !== i || e[10] !== r || e[11] !== Te ? (G = Ne && typeof r == "string" && !Te.some((p) => i(p).toLowerCase() === r.toLowerCase()), e[8] = Ne, e[9] = i, e[10] = r, e[11] = Te, e[12] = G) : G = e[12];
|
|
56
|
+
const J = G;
|
|
57
|
+
let de;
|
|
58
|
+
e[13] !== i || e[14] !== J || e[15] !== r ? (de = J ? `Add "${i(r)}"` : i(r), e[13] = i, e[14] = J, e[15] = r, e[16] = de) : de = e[16];
|
|
59
|
+
const P = de;
|
|
60
|
+
let Q, ue;
|
|
61
|
+
e[17] === Symbol.for("react.memo_cache_sentinel") ? (Q = () => {
|
|
62
|
+
const p = () => {
|
|
63
|
+
if ($.current) {
|
|
64
|
+
const Ae = $.current.scrollWidth > $.current.clientWidth;
|
|
65
|
+
kt(Ae);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
p();
|
|
69
|
+
const tt = new ResizeObserver(() => {
|
|
70
|
+
p();
|
|
71
|
+
});
|
|
72
|
+
$.current && tt.observe($.current);
|
|
73
|
+
const m = setTimeout(p, 0);
|
|
74
|
+
return () => {
|
|
75
|
+
tt.disconnect(), clearTimeout(m);
|
|
76
|
+
};
|
|
77
|
+
}, ue = [], e[17] = Q, e[18] = ue) : (Q = e[17], ue = e[18]), yt(Q, ue);
|
|
78
|
+
let q;
|
|
79
|
+
e[19] !== B ? (q = B ?? {}, e[19] = B, e[20] = q) : q = e[20];
|
|
80
|
+
let K, fe, O, De;
|
|
81
|
+
e[21] !== q ? ({
|
|
82
|
+
className: K,
|
|
83
|
+
tabIndex: De,
|
|
84
|
+
color: fe,
|
|
85
|
+
...O
|
|
86
|
+
} = q, e[21] = q, e[22] = K, e[23] = fe, e[24] = O, e[25] = De) : (K = e[22], fe = e[23], O = e[24], De = e[25]);
|
|
87
|
+
const Ye = fe ?? et, me = De ?? -1, pe = !d && "opacity-20";
|
|
88
|
+
let U;
|
|
89
|
+
e[26] !== K || e[27] !== pe ? (U = C("pointer-events-none border-2 opacity-100 flex items-center justify-center !rounded-sm", pe, K), e[26] = K, e[27] = pe, e[28] = U) : U = e[28];
|
|
90
|
+
let Y;
|
|
91
|
+
e[29] !== O || e[30] !== d || e[31] !== Ye || e[32] !== me || e[33] !== U ? (Y = /* @__PURE__ */ n(wo, { checked: d, tabIndex: me, className: U, color: Ye, ...O }), e[29] = O, e[30] = d, e[31] = Ye, e[32] = me, e[33] = U, e[34] = Y) : Y = e[34];
|
|
92
|
+
const he = Y, Fe = F == null ? void 0 : F.className;
|
|
93
|
+
let L;
|
|
94
|
+
e[35] !== Fe ? (L = C("flex-shrink-0", Fe), e[35] = Fe, e[36] = L) : L = e[36];
|
|
95
|
+
let u;
|
|
96
|
+
e[37] !== F || e[38] !== L ? (u = {
|
|
97
|
+
size: "small",
|
|
98
|
+
variant: "soft",
|
|
99
|
+
...F,
|
|
100
|
+
className: L
|
|
101
|
+
}, e[37] = F, e[38] = L, e[39] = u) : u = e[39];
|
|
102
|
+
const be = u, _ = N === "left";
|
|
103
|
+
let ee;
|
|
104
|
+
e[40] !== P ? (ee = /* @__PURE__ */ n("span", { ref: $, className: "flex-1 truncate", children: P }), e[40] = P, e[41] = ee) : ee = e[41];
|
|
105
|
+
const H = ee;
|
|
106
|
+
let f;
|
|
107
|
+
e[42] !== Oe || e[43] !== P || e[44] !== H ? (f = Oe ? /* @__PURE__ */ D(Co, { children: [
|
|
108
|
+
/* @__PURE__ */ n(So, { asChild: !0, children: H }),
|
|
109
|
+
/* @__PURE__ */ n(No, { children: /* @__PURE__ */ n("p", { children: P }) })
|
|
110
|
+
] }) : H, e[42] = Oe, e[43] = P, e[44] = H, e[45] = f) : f = e[45];
|
|
111
|
+
const ge = f, te = b ? "bg-accent text-accent-foreground" : "", xe = Z && d && "bg-[#F5F5F5]", oe = J && "italic";
|
|
112
|
+
let W;
|
|
113
|
+
e[46] !== te || e[47] !== xe || e[48] !== oe ? (W = C("px-3 py-2 cursor-pointer flex items-center", "text-sm transition-colors mx-2.5 rounded-md my-0.5 hover:bg-[#F5F5F5]", te, xe, oe), e[46] = te, e[47] = xe, e[48] = oe, e[49] = W) : W = e[49];
|
|
114
|
+
let A;
|
|
115
|
+
e[50] !== he || e[51] !== be || e[52] !== Z || e[53] !== g || e[54] !== _ || e[55] !== r || e[56] !== P || e[57] !== v || e[58] !== T || e[59] !== ge ? (A = v ? v(r, g) : /* @__PURE__ */ D("div", { className: "flex items-center gap-2 w-full", children: [
|
|
116
|
+
!Z && _ && he,
|
|
117
|
+
ge,
|
|
118
|
+
T && /* @__PURE__ */ n(go, { label: P, ...be }),
|
|
119
|
+
!Z && !_ && he
|
|
120
|
+
] }), e[50] = he, e[51] = be, e[52] = Z, e[53] = g, e[54] = _, e[55] = r, e[56] = P, e[57] = v, e[58] = T, e[59] = ge, e[60] = A) : A = e[60];
|
|
121
|
+
let t;
|
|
122
|
+
return e[61] !== Pe || e[62] !== Ie || e[63] !== g || e[64] !== d || e[65] !== W || e[66] !== A ? (t = /* @__PURE__ */ n("div", { role: "option", "aria-selected": d, tabIndex: 0, onClick: Pe, onKeyDown: Ie, "data-option-index": g, className: W, children: A }), e[61] = Pe, e[62] = Ie, e[63] = g, e[64] = d, e[65] = W, e[66] = A, e[67] = t) : t = e[67], t;
|
|
123
|
+
}, Do = (Qe) => {
|
|
124
|
+
const e = ro(17), {
|
|
125
|
+
tag: r,
|
|
126
|
+
index: g,
|
|
127
|
+
getOptionLabel: d,
|
|
128
|
+
onRemove: b
|
|
129
|
+
} = Qe;
|
|
130
|
+
let a;
|
|
131
|
+
e[0] !== b || e[1] !== r ? (a = (F) => {
|
|
132
|
+
F.stopPropagation(), b(r);
|
|
133
|
+
}, e[0] = b, e[1] = r, e[2] = a) : a = e[2];
|
|
134
|
+
const i = a;
|
|
135
|
+
let v;
|
|
136
|
+
e[3] !== d || e[4] !== r ? (v = d(r), e[3] = d, e[4] = r, e[5] = v) : v = e[5];
|
|
137
|
+
let x;
|
|
138
|
+
e[6] !== d || e[7] !== r ? (x = d(r), e[6] = d, e[7] = r, e[8] = x) : x = e[8];
|
|
139
|
+
const S = `Remove ${x}`;
|
|
140
|
+
let N;
|
|
141
|
+
e[9] === Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ n(ao, { className: "h-3 w-3" }), e[9] = N) : N = e[9];
|
|
142
|
+
let T;
|
|
143
|
+
e[10] !== i || e[11] !== S ? (T = /* @__PURE__ */ n("button", { type: "button", onClick: i, className: "ml-1 hover:bg-secondary-foreground/20 rounded-full p-0.5", "aria-label": S, children: N }), e[10] = i, e[11] = S, e[12] = T) : T = e[12];
|
|
144
|
+
let B;
|
|
145
|
+
return e[13] !== g || e[14] !== v || e[15] !== T ? (B = /* @__PURE__ */ D("div", { className: "inline-flex items-center gap-1 px-2.5 py-0.5 text-xs font-medium bg-secondary text-secondary-foreground rounded-full", children: [
|
|
146
|
+
v,
|
|
147
|
+
T
|
|
148
|
+
] }, g), e[13] = g, e[14] = v, e[15] = T, e[16] = B) : B = e[16], B;
|
|
149
|
+
};
|
|
150
|
+
function jo(Qe) {
|
|
151
|
+
const e = ro(197), {
|
|
152
|
+
options: r,
|
|
153
|
+
dataSource: g,
|
|
154
|
+
value: d,
|
|
155
|
+
onChange: b,
|
|
156
|
+
change: a,
|
|
157
|
+
onInputChange: i,
|
|
158
|
+
placeholder: v,
|
|
159
|
+
label: x,
|
|
160
|
+
helperText: S,
|
|
161
|
+
error: N,
|
|
162
|
+
noOptionsText: T,
|
|
163
|
+
emptyMessage: B,
|
|
164
|
+
disabled: F,
|
|
165
|
+
loading: et,
|
|
166
|
+
required: Ue,
|
|
167
|
+
clearable: Ne,
|
|
168
|
+
disableCloseOnSelect: ae,
|
|
169
|
+
freeSolo: Te,
|
|
170
|
+
size: Z,
|
|
171
|
+
variant: $,
|
|
172
|
+
fullWidth: Oe,
|
|
173
|
+
className: kt,
|
|
174
|
+
inputClassName: w,
|
|
175
|
+
checkboxPosition: Pe,
|
|
176
|
+
showChip: ce,
|
|
177
|
+
showTags: Ie,
|
|
178
|
+
checkboxProps: G,
|
|
179
|
+
chipProps: J,
|
|
180
|
+
checkboxColor: de,
|
|
181
|
+
showSearch: P,
|
|
182
|
+
searchPlaceholder: Q,
|
|
183
|
+
showScroller: ue,
|
|
184
|
+
multiple: q,
|
|
185
|
+
hideCheckbox: K,
|
|
186
|
+
triggerType: fe,
|
|
187
|
+
triggerButtonLabel: O,
|
|
188
|
+
triggerButtonVariant: De,
|
|
189
|
+
triggerButtonSize: Ye,
|
|
190
|
+
triggerButtonProps: me,
|
|
191
|
+
triggerButtonIcon: pe,
|
|
192
|
+
triggerButtonIconPosition: U,
|
|
193
|
+
portalContainer: Y,
|
|
194
|
+
disablePortal: he,
|
|
195
|
+
dropdownWidth: Fe,
|
|
196
|
+
getOptionLabel: L,
|
|
197
|
+
getOptionValue: u,
|
|
198
|
+
isOptionEqualToValue: be,
|
|
199
|
+
filterOptions: _,
|
|
200
|
+
renderOption: ee,
|
|
201
|
+
renderTags: H,
|
|
202
|
+
limitTags: f,
|
|
203
|
+
fields: ge
|
|
204
|
+
} = Qe;
|
|
205
|
+
let te;
|
|
206
|
+
e[0] !== r ? (te = r === void 0 ? [] : r, e[0] = r, e[1] = te) : te = e[1];
|
|
207
|
+
const xe = te;
|
|
208
|
+
let oe;
|
|
209
|
+
e[2] !== g ? (oe = g === void 0 ? [] : g, e[2] = g, e[3] = oe) : oe = e[3];
|
|
210
|
+
const W = oe;
|
|
211
|
+
let A;
|
|
212
|
+
e[4] !== d ? (A = d === void 0 ? [] : d, e[4] = d, e[5] = A) : A = e[5];
|
|
213
|
+
const t = A, p = v === void 0 ? "Search..." : v, tt = T === void 0 ? "No options" : T, m = F === void 0 ? !1 : F, Ae = et === void 0 ? !1 : et, Ct = Ue === void 0 ? !1 : Ue, uo = Ne === void 0 ? !0 : Ne, St = ae === void 0 ? !0 : ae, Re = Te === void 0 ? !1 : Te, fo = Z === void 0 ? "medium" : Z, mo = $ === void 0 ? "outlined" : $, lo = Oe === void 0 ? !0 : Oe, Nt = Pe === void 0 ? "right" : Pe, Tt = ce === void 0 ? !1 : ce, po = Ie === void 0 ? !0 : Ie, Ot = de === void 0 ? "#000000" : de, h = P === void 0 ? !1 : P, Pt = ue === void 0 ? !0 : ue, It = q === void 0 ? !0 : q, Dt = K === void 0 ? !1 : K, Ft = fe === void 0 ? "input" : fe, At = he === void 0 ? !1 : he, Be = Fe === void 0 ? "220px" : Fe, ve = so(), [we, Rt] = co(!1);
|
|
214
|
+
let ot;
|
|
215
|
+
e[6] === Symbol.for("react.memo_cache_sentinel") ? (ot = () => {
|
|
216
|
+
Rt(!1);
|
|
217
|
+
}, e[6] = ot) : ot = e[6];
|
|
218
|
+
let rt;
|
|
219
|
+
e[7] !== t ? (rt = [t], e[7] = t, e[8] = rt) : rt = e[8], yt(ot, rt);
|
|
220
|
+
let lt;
|
|
221
|
+
e[9] !== W ? (lt = W ?? [], e[9] = W, e[10] = lt) : lt = e[10];
|
|
222
|
+
const no = lt;
|
|
223
|
+
let nt;
|
|
224
|
+
e[11] !== xe ? (nt = xe ?? [], e[11] = xe, e[12] = nt) : nt = e[12];
|
|
225
|
+
const ho = nt, Le = no.length > 0 ? no : ho;
|
|
226
|
+
let We;
|
|
227
|
+
e[13] !== a || e[14] !== b ? (We = (o, l) => {
|
|
228
|
+
b == null || b(o, l), a == null || a({
|
|
229
|
+
itemData: l
|
|
230
|
+
});
|
|
231
|
+
}, e[13] = a, e[14] = b, e[15] = We) : We = e[15];
|
|
232
|
+
let it;
|
|
233
|
+
e[16] !== St || e[17] !== m || e[18] !== Le || e[19] !== ge || e[20] !== _ || e[21] !== Re || e[22] !== L || e[23] !== u || e[24] !== be || e[25] !== i || e[26] !== We || e[27] !== t ? (it = {
|
|
234
|
+
options: Le,
|
|
235
|
+
value: t,
|
|
236
|
+
onChange: We,
|
|
237
|
+
onInputChange: i,
|
|
238
|
+
disabled: m,
|
|
239
|
+
disableCloseOnSelect: St,
|
|
240
|
+
freeSolo: Re,
|
|
241
|
+
getOptionLabel: L,
|
|
242
|
+
getOptionValue: u,
|
|
243
|
+
isOptionEqualToValue: be,
|
|
244
|
+
filterOptions: _,
|
|
245
|
+
fields: ge
|
|
246
|
+
}, e[16] = St, e[17] = m, e[18] = Le, e[19] = ge, e[20] = _, e[21] = Re, e[22] = L, e[23] = u, e[24] = be, e[25] = i, e[26] = We, e[27] = t, e[28] = it) : it = e[28];
|
|
247
|
+
const {
|
|
248
|
+
open: s,
|
|
249
|
+
inputValue: re,
|
|
250
|
+
highlightedIndex: V,
|
|
251
|
+
filteredOptions: j,
|
|
252
|
+
dropdownPosition: M,
|
|
253
|
+
inputRef: I,
|
|
254
|
+
listRef: X,
|
|
255
|
+
containerRef: Bt,
|
|
256
|
+
triggerRef: st,
|
|
257
|
+
setOpen: z,
|
|
258
|
+
setInputValue: ye,
|
|
259
|
+
handleInputChange: ke,
|
|
260
|
+
handleOptionSelect: Lt,
|
|
261
|
+
handleTagRemove: le,
|
|
262
|
+
handleClear: Wt,
|
|
263
|
+
handleKeyDown: Ce,
|
|
264
|
+
handleToggle: at,
|
|
265
|
+
handleFocus: ct,
|
|
266
|
+
isOptionSelected: ze,
|
|
267
|
+
getOptionLabelSafe: R
|
|
268
|
+
} = To(it), zt = uo && !m && re !== "" && !h && Ft !== "button";
|
|
269
|
+
let _e;
|
|
270
|
+
e: {
|
|
271
|
+
if (!po || Ft === "button") {
|
|
272
|
+
_e = null;
|
|
273
|
+
break e;
|
|
274
|
+
}
|
|
275
|
+
if (!Array.isArray(t) || t.length === 0) {
|
|
276
|
+
_e = null;
|
|
277
|
+
break e;
|
|
278
|
+
}
|
|
279
|
+
if (H) {
|
|
280
|
+
let c;
|
|
281
|
+
e[29] !== le || e[30] !== H || e[31] !== t ? (c = H(t, le), e[29] = le, e[30] = H, e[31] = t, e[32] = c) : c = e[32], _e = c;
|
|
282
|
+
break e;
|
|
283
|
+
}
|
|
284
|
+
let o = t;
|
|
285
|
+
if (f && t.length > f && !we) {
|
|
286
|
+
let c;
|
|
287
|
+
e[33] !== f || e[34] !== t ? (c = t.slice(0, f), e[33] = f, e[34] = t, e[35] = c) : c = e[35], o = c;
|
|
288
|
+
}
|
|
289
|
+
let l;
|
|
290
|
+
e[36] !== I || e[37] !== i || e[38] !== ye || e[39] !== z ? (l = () => {
|
|
291
|
+
var c;
|
|
292
|
+
z(!1), ye(""), i == null || i({
|
|
293
|
+
target: {
|
|
294
|
+
value: ""
|
|
295
|
+
}
|
|
296
|
+
}, ""), (c = I.current) == null || c.focus();
|
|
297
|
+
}, e[36] = I, e[37] = i, e[38] = ye, e[39] = z, e[40] = l) : l = e[40];
|
|
298
|
+
let y;
|
|
299
|
+
if (e[41] !== R || e[42] !== u || e[43] !== le || e[44] !== o) {
|
|
300
|
+
let c;
|
|
301
|
+
e[46] !== R || e[47] !== u || e[48] !== le ? (c = (wt, io) => /* @__PURE__ */ n(Do, { tag: wt, index: io, getOptionLabel: R, onRemove: le }, typeof wt == "string" ? wt : String((u == null ? void 0 : u(wt)) ?? io)), e[46] = R, e[47] = u, e[48] = le, e[49] = c) : c = e[49], y = o.map(c), e[41] = R, e[42] = u, e[43] = le, e[44] = o, e[45] = y;
|
|
302
|
+
} else
|
|
303
|
+
y = e[45];
|
|
304
|
+
let k;
|
|
305
|
+
e[50] !== f || e[51] !== we || e[52] !== t ? (k = f && t.length > f && !we && /* @__PURE__ */ D("button", { type: "button", onClick: (c) => {
|
|
306
|
+
c.stopPropagation(), Rt(!0);
|
|
307
|
+
}, className: "inline-flex items-center px-2.5 py-0.5 text-xs font-medium bg-muted text-muted-foreground rounded-full hover:bg-muted/80 transition-colors cursor-pointer", children: [
|
|
308
|
+
"+",
|
|
309
|
+
t.length - f,
|
|
310
|
+
" more"
|
|
311
|
+
] }), e[50] = f, e[51] = we, e[52] = t, e[53] = k) : k = e[53];
|
|
312
|
+
let E;
|
|
313
|
+
e[54] !== f || e[55] !== we || e[56] !== t ? (E = f && t.length > f && we && /* @__PURE__ */ n("button", { type: "button", onClick: (c) => {
|
|
314
|
+
c.stopPropagation(), Rt(!1);
|
|
315
|
+
}, className: "inline-flex items-center px-2.5 py-0.5 text-xs font-medium bg-muted text-muted-foreground rounded-full hover:bg-muted/80 transition-colors cursor-pointer", children: "Show less" }), e[54] = f, e[55] = we, e[56] = t, e[57] = E) : E = e[57];
|
|
316
|
+
let Je;
|
|
317
|
+
e[58] !== l || e[59] !== y || e[60] !== k || e[61] !== E ? (Je = /* @__PURE__ */ D("div", { className: "flex flex-wrap gap-1 mb-1", onClick: l, children: [
|
|
318
|
+
y,
|
|
319
|
+
k,
|
|
320
|
+
E
|
|
321
|
+
] }), e[58] = l, e[59] = y, e[60] = k, e[61] = E, e[62] = Je) : Je = e[62], _e = Je;
|
|
322
|
+
}
|
|
323
|
+
const Et = _e, ne = Ft === "button", $t = N ? "border border-destructive" : Po[mo], qt = Oo[fo], Kt = m ? "opacity-50 cursor-not-allowed" : "cursor-text";
|
|
324
|
+
let dt;
|
|
325
|
+
e[63] !== w || e[64] !== $t || e[65] !== qt || e[66] !== Kt ? (dt = C("relative flex items-center rounded-md", $t, qt, Kt, "transition-colors", w), e[63] = w, e[64] = $t, e[65] = qt, e[66] = Kt, e[67] = dt) : dt = e[67];
|
|
326
|
+
const Ht = dt, Vt = m ? "opacity-50 cursor-not-allowed" : "cursor-pointer";
|
|
327
|
+
let ut;
|
|
328
|
+
e[68] !== w || e[69] !== Vt ? (ut = C("relative inline-flex items-center gap-2", Vt, w), e[68] = w, e[69] = Vt, e[70] = ut) : ut = e[70];
|
|
329
|
+
const jt = ut, Mt = B ?? tt, Se = so(), Xt = oo(null), ie = oo(null);
|
|
330
|
+
let ft, mt;
|
|
331
|
+
e[71] !== s || e[72] !== h ? (ft = () => {
|
|
332
|
+
var o;
|
|
333
|
+
s && h && ((o = Xt.current) == null || o.focus());
|
|
334
|
+
}, mt = [s, h], e[71] = s, e[72] = h, e[73] = ft, e[74] = mt) : (ft = e[73], mt = e[74]), yt(ft, mt);
|
|
335
|
+
let pt;
|
|
336
|
+
e[75] !== a || e[76] !== Lt || e[77] !== ze || e[78] !== It || e[79] !== b || e[80] !== s || e[81] !== z || e[82] !== h ? (pt = (o) => {
|
|
337
|
+
if (!It) {
|
|
338
|
+
const y = ze(o) ? [] : [o];
|
|
339
|
+
b == null || b(null, y), a == null || a({
|
|
340
|
+
itemData: y
|
|
341
|
+
}), z(!1);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
Lt(o), h && s && setTimeout(() => {
|
|
345
|
+
var l;
|
|
346
|
+
(l = Xt.current) == null || l.focus();
|
|
347
|
+
}, 10);
|
|
348
|
+
}, e[75] = a, e[76] = Lt, e[77] = ze, e[78] = It, e[79] = b, e[80] = s, e[81] = z, e[82] = h, e[83] = pt) : pt = e[83];
|
|
349
|
+
const Zt = pt;
|
|
350
|
+
let ht, bt;
|
|
351
|
+
e[84] !== j.length || e[85] !== V || e[86] !== X || e[87] !== s ? (ht = () => {
|
|
352
|
+
if (!(!s || V < 0 || !X.current) && j.length !== 0 && !(V >= j.length))
|
|
353
|
+
return ie.current !== null && (cancelAnimationFrame(ie.current), ie.current = null), ie.current = requestAnimationFrame(() => {
|
|
354
|
+
if (!X.current)
|
|
355
|
+
return;
|
|
356
|
+
const o = X.current.querySelector('div.max-h-60, div[class*="max-h-60"]');
|
|
357
|
+
if (!o)
|
|
358
|
+
return;
|
|
359
|
+
const l = o.querySelector(`[data-option-index="${V}"]`);
|
|
360
|
+
l && l.scrollIntoView({
|
|
361
|
+
behavior: "auto",
|
|
362
|
+
block: "nearest",
|
|
363
|
+
inline: "nearest"
|
|
364
|
+
}), ie.current = null;
|
|
365
|
+
}), () => {
|
|
366
|
+
ie.current !== null && (cancelAnimationFrame(ie.current), ie.current = null);
|
|
367
|
+
};
|
|
368
|
+
}, bt = [V, s, j.length, X], e[84] = j.length, e[85] = V, e[86] = X, e[87] = s, e[88] = ht, e[89] = bt) : (ht = e[88], bt = e[89]), yt(ht, bt);
|
|
369
|
+
let Ee;
|
|
370
|
+
e: {
|
|
371
|
+
if (typeof O == "function") {
|
|
372
|
+
let o;
|
|
373
|
+
e[90] !== t ? (o = t ?? [], e[90] = t, e[91] = o) : o = e[91];
|
|
374
|
+
let l;
|
|
375
|
+
e[92] !== o || e[93] !== O ? (l = O(o), e[92] = o, e[93] = O, e[94] = l) : l = e[94], Ee = l;
|
|
376
|
+
break e;
|
|
377
|
+
}
|
|
378
|
+
if (O !== void 0) {
|
|
379
|
+
Ee = O;
|
|
380
|
+
break e;
|
|
381
|
+
}
|
|
382
|
+
if (Array.isArray(t) && t.length > 0) {
|
|
383
|
+
if (t.length === 1) {
|
|
384
|
+
let o;
|
|
385
|
+
e[95] !== R || e[96] !== t[0] ? (o = R(t[0]), e[95] = R, e[96] = t[0], e[97] = o) : o = e[97], Ee = o;
|
|
386
|
+
break e;
|
|
387
|
+
}
|
|
388
|
+
Ee = `${t.length} selected`;
|
|
389
|
+
break e;
|
|
390
|
+
}
|
|
391
|
+
Ee = p;
|
|
392
|
+
}
|
|
393
|
+
const Gt = Ee;
|
|
394
|
+
let $e;
|
|
395
|
+
e[98] !== me ? ($e = me ?? {}, e[98] = me, e[99] = $e) : $e = e[99];
|
|
396
|
+
let qe, Ke, gt, se;
|
|
397
|
+
e[100] !== $e ? ({
|
|
398
|
+
onClick: se,
|
|
399
|
+
fullWidth: gt,
|
|
400
|
+
className: Ke,
|
|
401
|
+
...qe
|
|
402
|
+
} = $e, e[100] = $e, e[101] = qe, e[102] = Ke, e[103] = gt, e[104] = se) : (qe = e[101], Ke = e[102], gt = e[103], se = e[104]);
|
|
403
|
+
const Jt = De ?? "outline", Qt = Ye ?? "small", Ut = gt ?? lo ?? !1, He = U ?? "right";
|
|
404
|
+
let xt;
|
|
405
|
+
e[105] !== s || e[106] !== He || e[107] !== pe ? (xt = pe ?? (He === "left" ? /* @__PURE__ */ n(to, { className: C("h-4 w-4 transition-transform", s ? "-rotate-180" : "") }) : /* @__PURE__ */ n(to, { className: C("h-4 w-4 transition-transform", s ? "rotate-180" : "") })), e[105] = s, e[106] = He, e[107] = pe, e[108] = xt) : xt = e[108];
|
|
406
|
+
const Yt = xt, _t = "w-auto", eo = ne ? "" : kt;
|
|
407
|
+
let Ve;
|
|
408
|
+
e[109] !== _t || e[110] !== eo ? (Ve = C("relative", _t, eo), e[109] = _t, e[110] = eo, e[111] = Ve) : Ve = e[111];
|
|
409
|
+
let je;
|
|
410
|
+
e[112] !== ve || e[113] !== I || e[114] !== x || e[115] !== i || e[116] !== Ct || e[117] !== ye || e[118] !== z ? (je = x && /* @__PURE__ */ D("label", { htmlFor: ve, className: "block text-sm font-medium mb-1", onClick: (o) => {
|
|
411
|
+
var l;
|
|
412
|
+
o.preventDefault(), z(!1), ye(""), i == null || i({
|
|
413
|
+
target: {
|
|
414
|
+
value: ""
|
|
415
|
+
}
|
|
416
|
+
}, ""), (l = I.current) == null || l.focus();
|
|
417
|
+
}, onKeyDown: (o) => {
|
|
418
|
+
var l;
|
|
419
|
+
(o.key === "Enter" || o.key === " ") && (o.preventDefault(), z(!1), ye(""), i == null || i({
|
|
420
|
+
target: {
|
|
421
|
+
value: ""
|
|
422
|
+
}
|
|
423
|
+
}, ""), (l = I.current) == null || l.focus());
|
|
424
|
+
}, children: [
|
|
425
|
+
x,
|
|
426
|
+
Ct && /* @__PURE__ */ n("span", { className: "text-destructive ml-1", children: "*" })
|
|
427
|
+
] }), e[112] = ve, e[113] = I, e[114] = x, e[115] = i, e[116] = Ct, e[117] = ye, e[118] = z, e[119] = je) : je = e[119];
|
|
428
|
+
let Me;
|
|
429
|
+
e[120] !== jt || e[121] !== Gt || e[122] !== Ht || e[123] !== m || e[124] !== Wt || e[125] !== ct || e[126] !== ke || e[127] !== Ce || e[128] !== at || e[129] !== ve || e[130] !== I || e[131] !== re || e[132] !== ne || e[133] !== Se || e[134] !== Ae || e[135] !== s || e[136] !== p || e[137] !== Ut || e[138] !== Yt || e[139] !== He || e[140] !== Qt || e[141] !== Jt || e[142] !== qe || e[143] !== zt || e[144] !== h || e[145] !== Ke || e[146] !== se || e[147] !== st ? (Me = ne ? /* @__PURE__ */ D("div", { ref: st, className: jt, children: [
|
|
430
|
+
/* @__PURE__ */ n("input", { id: ve, ref: I, value: re, onChange: ke, onKeyDown: Ce, onFocus: ct, "aria-hidden": "true", tabIndex: -1, readOnly: !0, className: "sr-only" }),
|
|
431
|
+
/* @__PURE__ */ n(vo, { variant: Jt, size: Qt, icon: Yt, iconPosition: He, fullWidth: Ut, disabled: m, type: "button", "aria-haspopup": "listbox", "aria-expanded": s, "aria-controls": Se, className: C("hover:bg-transparent active:bg-transparent focus-visible:bg-transparent focus-visible:ring-0", Ke), ...qe, onClick: (o) => {
|
|
432
|
+
if (se == null || se(o), m)
|
|
433
|
+
return;
|
|
434
|
+
const l = !s;
|
|
435
|
+
at(), l && setTimeout(() => {
|
|
436
|
+
var y;
|
|
437
|
+
(y = I.current) == null || y.focus();
|
|
438
|
+
}, 0);
|
|
439
|
+
}, children: Gt }),
|
|
440
|
+
Ae && /* @__PURE__ */ n("div", { className: "ml-2 animate-spin rounded-full h-4 w-4 border-2 border-muted-foreground border-t-transparent" })
|
|
441
|
+
] }) : /* @__PURE__ */ D("div", { ref: st, className: Ht, children: [
|
|
442
|
+
/* @__PURE__ */ n(yo, { id: ve, ref: I, value: h ? "" : re, onChange: h ? void 0 : ke, onKeyDown: Ce, onFocus: ct, placeholder: p, disabled: m, readOnly: h, className: "px-0 border-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent rounded-md", role: "combobox", "aria-expanded": s, "aria-controls": Se, "aria-autocomplete": "list" }),
|
|
443
|
+
/* @__PURE__ */ D("div", { className: "flex items-center gap-1 ml-auto", children: [
|
|
444
|
+
Ae && /* @__PURE__ */ n("div", { className: "animate-spin rounded-full h-4 w-4 border-2 border-muted-foreground border-t-transparent" }),
|
|
445
|
+
zt && /* @__PURE__ */ n("button", { type: "button", onClick: Wt, className: "p-1 hover:bg-accent rounded-sm transition-colors", tabIndex: -1, children: /* @__PURE__ */ n(ao, { className: "h-4 w-4 text-muted-foreground" }) }),
|
|
446
|
+
/* @__PURE__ */ n("button", { type: "button", disabled: m, onClick: at, className: C("p-1 hover:bg-accent rounded-sm transition-colors", m ? "opacity-50 cursor-not-allowed" : "cursor-pointer"), tabIndex: -1, "aria-label": s ? "Close options" : "Open options", children: /* @__PURE__ */ n(to, { className: C("h-4 w-4 text-muted-foreground transition-transform", s ? "rotate-180" : "") }) })
|
|
447
|
+
] })
|
|
448
|
+
] }), e[120] = jt, e[121] = Gt, e[122] = Ht, e[123] = m, e[124] = Wt, e[125] = ct, e[126] = ke, e[127] = Ce, e[128] = at, e[129] = ve, e[130] = I, e[131] = re, e[132] = ne, e[133] = Se, e[134] = Ae, e[135] = s, e[136] = p, e[137] = Ut, e[138] = Yt, e[139] = He, e[140] = Qt, e[141] = Jt, e[142] = qe, e[143] = zt, e[144] = h, e[145] = Ke, e[146] = se, e[147] = st, e[148] = Me) : Me = e[148];
|
|
449
|
+
let Xe;
|
|
450
|
+
e[149] !== Ot || e[150] !== Nt || e[151] !== G || e[152] !== J || e[153] !== At || e[154] !== m || e[155] !== M || e[156] !== Be || e[157] !== Le || e[158] !== j || e[159] !== Re || e[160] !== R || e[161] !== u || e[162] !== ke || e[163] !== Ce || e[164] !== Zt || e[165] !== Dt || e[166] !== V || e[167] !== w || e[168] !== re || e[169] !== ne || e[170] !== ze || e[171] !== x || e[172] !== X || e[173] !== Se || e[174] !== Mt || e[175] !== s || e[176] !== p || e[177] !== Y || e[178] !== ee || e[179] !== Q || e[180] !== Tt || e[181] !== Pt || e[182] !== h ? (Xe = s && (() => {
|
|
451
|
+
const o = M.width > 0 && M.maxHeight > 0, l = /* @__PURE__ */ n(ko, { delayDuration: 0, children: /* @__PURE__ */ D("div", { id: Se, role: "listbox", "aria-label": x || "Options", "data-dialog-interactive-layer": "true", className: C("fixed z-[99999] pointer-events-auto bg-popover border border-border rounded-md shadow-lg", "flex flex-col overflow-hidden", !o && "invisible", w), style: (() => {
|
|
452
|
+
const k = () => ne ? typeof Be == "number" ? `${Be}px` : typeof Be == "string" ? Be : "220px" : M.width;
|
|
453
|
+
return {
|
|
454
|
+
top: M.top,
|
|
455
|
+
left: M.left,
|
|
456
|
+
minWidth: ne ? void 0 : M.width,
|
|
457
|
+
width: k(),
|
|
458
|
+
maxHeight: M.maxHeight,
|
|
459
|
+
zIndex: 99999,
|
|
460
|
+
pointerEvents: "auto"
|
|
461
|
+
};
|
|
462
|
+
})(), ref: X, children: [
|
|
463
|
+
h && /* @__PURE__ */ n("div", { className: "p-2 bg-popover", children: /* @__PURE__ */ n(xo, { ref: Xt, query: re, onChange: ke, onKeyDown: Ce, placeholder: Q ?? p, className: "w-full", "aria-label": "Search options", disabled: m, size: "small" }) }),
|
|
464
|
+
/* @__PURE__ */ n("div", { className: C("min-h-0 flex-1 overflow-auto", !h && "py-2", Pt ? ["[scrollbar-gutter:stable]", "[&::-webkit-scrollbar]:w-2", "[&::-webkit-scrollbar-track]:bg-transparent", "[&::-webkit-scrollbar-thumb]:bg-gray-300", "[&::-webkit-scrollbar-thumb]:rounded-full", "[&::-webkit-scrollbar-thumb]:border-0", "[&::-webkit-scrollbar-thumb]:min-h-[30px]", "scrollbar-thin scrollbar-thumb-gray-300 scrollbar-track-transparent"] : ["[&::-webkit-scrollbar]:hidden", "[-ms-overflow-style:none]", "[scrollbar-width:none]"]), children: j.length === 0 ? /* @__PURE__ */ n("div", { className: "p-3 text-sm text-muted-foreground text-center", children: Mt }) : j.map((k, E) => {
|
|
465
|
+
const Je = ze(k);
|
|
466
|
+
return /* @__PURE__ */ n(Io, { option: k, index: E, isSelected: Je, isHighlighted: E === V, onSelect: Zt, getOptionLabel: R, renderOption: ee, freeSolo: Re, originalOptions: Le, checkboxPosition: Nt, showChip: Tt, checkboxProps: G, chipProps: J, checkboxColor: Ot, hideCheckbox: Dt }, typeof k == "string" ? k : String((u == null ? void 0 : u(k)) ?? E));
|
|
467
|
+
}) })
|
|
468
|
+
] }) });
|
|
469
|
+
if (At)
|
|
470
|
+
return l;
|
|
471
|
+
const y = Y ?? document.body;
|
|
472
|
+
return bo(l, y);
|
|
473
|
+
})(), e[149] = Ot, e[150] = Nt, e[151] = G, e[152] = J, e[153] = At, e[154] = m, e[155] = M, e[156] = Be, e[157] = Le, e[158] = j, e[159] = Re, e[160] = R, e[161] = u, e[162] = ke, e[163] = Ce, e[164] = Zt, e[165] = Dt, e[166] = V, e[167] = w, e[168] = re, e[169] = ne, e[170] = ze, e[171] = x, e[172] = X, e[173] = Se, e[174] = Mt, e[175] = s, e[176] = p, e[177] = Y, e[178] = ee, e[179] = Q, e[180] = Tt, e[181] = Pt, e[182] = h, e[183] = Xe) : Xe = e[183];
|
|
474
|
+
let Ze;
|
|
475
|
+
e[184] !== Et || e[185] !== Me || e[186] !== Xe ? (Ze = /* @__PURE__ */ D("div", { className: "relative overflow-visible", children: [
|
|
476
|
+
Et,
|
|
477
|
+
Me,
|
|
478
|
+
Xe
|
|
479
|
+
] }), e[184] = Et, e[185] = Me, e[186] = Xe, e[187] = Ze) : Ze = e[187];
|
|
480
|
+
let Ge;
|
|
481
|
+
e[188] !== N || e[189] !== S ? (Ge = (S || N) && /* @__PURE__ */ n("p", { className: C("mt-1 text-xs", N ? "text-destructive" : "text-muted-foreground"), children: N || S }), e[188] = N, e[189] = S, e[190] = Ge) : Ge = e[190];
|
|
482
|
+
let vt;
|
|
483
|
+
return e[191] !== Bt || e[192] !== Ve || e[193] !== je || e[194] !== Ze || e[195] !== Ge ? (vt = /* @__PURE__ */ D("div", { className: Ve, ref: Bt, children: [
|
|
484
|
+
je,
|
|
485
|
+
Ze,
|
|
486
|
+
Ge
|
|
487
|
+
] }), e[191] = Bt, e[192] = Ve, e[193] = je, e[194] = Ze, e[195] = Ge, e[196] = vt) : vt = e[196], vt;
|
|
488
|
+
}
|
|
489
|
+
export {
|
|
490
|
+
jo as AutocompleteCheckbox
|
|
491
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as d, jsxs as te } from "react/jsx-runtime";
|
|
3
|
+
import { c as ne } from "react-compiler-runtime";
|
|
4
|
+
import { X as ae } from "lucide-react";
|
|
5
|
+
import le, { useRef as de, useState as ce, useEffect as fe } from "react";
|
|
6
|
+
import { TooltipProvider as ue, Tooltip as be, TooltipTrigger as pe, TooltipContent as ge } from "../../../ui/tooltip.js";
|
|
7
|
+
import { cn as _ } from "../../../../lib/utils.js";
|
|
8
|
+
const Ce = (q) => {
|
|
9
|
+
const e = ne(82);
|
|
10
|
+
let c, s, f, u, n, o, r, i, b, C, D, k, N, z, B, T;
|
|
11
|
+
e[0] !== q ? ({
|
|
12
|
+
label: o,
|
|
13
|
+
variant: C,
|
|
14
|
+
color: D,
|
|
15
|
+
size: k,
|
|
16
|
+
shape: N,
|
|
17
|
+
deletable: z,
|
|
18
|
+
onDelete: i,
|
|
19
|
+
onClick: r,
|
|
20
|
+
icon: n,
|
|
21
|
+
avatar: s,
|
|
22
|
+
disabled: B,
|
|
23
|
+
className: T,
|
|
24
|
+
"aria-label": c,
|
|
25
|
+
deleteAriaLabel: u,
|
|
26
|
+
closeButtonClassName: f,
|
|
27
|
+
...b
|
|
28
|
+
} = q, e[0] = q, e[1] = c, e[2] = s, e[3] = f, e[4] = u, e[5] = n, e[6] = o, e[7] = r, e[8] = i, e[9] = b, e[10] = C, e[11] = D, e[12] = k, e[13] = N, e[14] = z, e[15] = B, e[16] = T) : (c = e[1], s = e[2], f = e[3], u = e[4], n = e[5], o = e[6], r = e[7], i = e[8], b = e[9], C = e[10], D = e[11], k = e[12], N = e[13], z = e[14], B = e[15], T = e[16]);
|
|
29
|
+
const H = C === void 0 ? "filled" : C, V = D === void 0 ? "default" : D, a = k === void 0 ? "medium" : k, X = N === void 0 ? "pill" : N, F = z === void 0 ? !1 : z, t = B === void 0 ? !1 : B, G = T === void 0 ? "" : T;
|
|
30
|
+
let K;
|
|
31
|
+
if (e[17] !== G || e[18] !== V || e[19] !== t || e[20] !== r || e[21] !== X || e[22] !== a || e[23] !== H) {
|
|
32
|
+
const l = {
|
|
33
|
+
small: "px-2 py-0.5 text-xs",
|
|
34
|
+
medium: "px-3 py-1 text-sm",
|
|
35
|
+
large: "px-4 py-1.5 text-base"
|
|
36
|
+
}, E = {
|
|
37
|
+
pill: "rounded-full",
|
|
38
|
+
square: "rounded-md"
|
|
39
|
+
}, re = {
|
|
40
|
+
default: {
|
|
41
|
+
filled: "bg-gray-200 text-gray-800",
|
|
42
|
+
outlined: "border border-gray-300 text-gray-700",
|
|
43
|
+
soft: "bg-gray-100 text-gray-800"
|
|
44
|
+
},
|
|
45
|
+
primary: {
|
|
46
|
+
filled: "bg-blue-500 text-white",
|
|
47
|
+
outlined: "border border-blue-500 text-blue-600",
|
|
48
|
+
soft: "bg-blue-50 text-blue-700"
|
|
49
|
+
},
|
|
50
|
+
secondary: {
|
|
51
|
+
filled: "bg-purple-500 text-white",
|
|
52
|
+
outlined: "border border-purple-500 text-purple-600",
|
|
53
|
+
soft: "bg-purple-50 text-purple-700"
|
|
54
|
+
},
|
|
55
|
+
success: {
|
|
56
|
+
filled: "bg-green-500 text-white",
|
|
57
|
+
outlined: "border border-green-500 text-green-600",
|
|
58
|
+
soft: "bg-green-50 text-green-700"
|
|
59
|
+
},
|
|
60
|
+
warning: {
|
|
61
|
+
filled: "bg-yellow-500 text-white",
|
|
62
|
+
outlined: "border border-yellow-500 text-yellow-600",
|
|
63
|
+
soft: "bg-yellow-50 text-yellow-700"
|
|
64
|
+
},
|
|
65
|
+
error: {
|
|
66
|
+
filled: "bg-red-500 text-white",
|
|
67
|
+
outlined: "border border-destructive text-red-600",
|
|
68
|
+
soft: "bg-red-50 text-red-700"
|
|
69
|
+
},
|
|
70
|
+
gray: {
|
|
71
|
+
filled: "bg-gray-400 text-white",
|
|
72
|
+
outlined: "border border-gray-400 text-gray-400",
|
|
73
|
+
soft: "bg-gray-400/20 text-gray-600"
|
|
74
|
+
},
|
|
75
|
+
branding: {
|
|
76
|
+
filled: "bg-brandBlue text-white",
|
|
77
|
+
outlined: "border border-brandBlue text-brandBlue",
|
|
78
|
+
soft: "bg-brandBlue/10 text-brandBlue"
|
|
79
|
+
}
|
|
80
|
+
}, se = t ? "opacity-50 cursor-not-allowed" : "", ie = r && !t ? "cursor-pointer" : "";
|
|
81
|
+
K = _("inline-flex items-center gap-1 font-medium transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2", l[a], E[X], re[V][H], se, ie, r && !t && "focus:ring-2 focus:ring-offset-2", G), e[17] = G, e[18] = V, e[19] = t, e[20] = r, e[21] = X, e[22] = a, e[23] = H, e[24] = K;
|
|
82
|
+
} else
|
|
83
|
+
K = e[24];
|
|
84
|
+
const J = K;
|
|
85
|
+
let L;
|
|
86
|
+
e[25] !== t || e[26] !== r ? (L = (l) => {
|
|
87
|
+
!t && r && r(l);
|
|
88
|
+
}, e[25] = t, e[26] = r, e[27] = L) : L = e[27];
|
|
89
|
+
const p = L;
|
|
90
|
+
let R;
|
|
91
|
+
e[28] !== t || e[29] !== p || e[30] !== r ? (R = (l) => {
|
|
92
|
+
!t && r && (l.key === "Enter" || l.key === " ") && (l.preventDefault(), p(l));
|
|
93
|
+
}, e[28] = t, e[29] = p, e[30] = r, e[31] = R) : R = e[31];
|
|
94
|
+
const O = R;
|
|
95
|
+
let $;
|
|
96
|
+
e[32] !== t || e[33] !== i ? ($ = (l) => {
|
|
97
|
+
l.stopPropagation(), !t && i && i(l);
|
|
98
|
+
}, e[32] = t, e[33] = i, e[34] = $) : $ = e[34];
|
|
99
|
+
const g = $;
|
|
100
|
+
let j;
|
|
101
|
+
e[35] !== t || e[36] !== g ? (j = (l) => {
|
|
102
|
+
t || (l.preventDefault(), g(l));
|
|
103
|
+
}, e[35] = t, e[36] = g, e[37] = j) : j = e[37];
|
|
104
|
+
const Q = j;
|
|
105
|
+
let I;
|
|
106
|
+
e[38] !== t || e[39] !== g || e[40] !== i ? (I = (l) => {
|
|
107
|
+
!t && i && (l.key === "Delete" || l.key === "Backspace") && (l.preventDefault(), g(l));
|
|
108
|
+
}, e[38] = t, e[39] = g, e[40] = i, e[41] = I) : I = e[41];
|
|
109
|
+
const U = I, m = a === "small" ? 12 : a === "large" ? 18 : 14, ee = de(null), [Y, oe] = ce(!1);
|
|
110
|
+
let S, A;
|
|
111
|
+
e[42] === Symbol.for("react.memo_cache_sentinel") ? (S = () => {
|
|
112
|
+
const l = ee.current;
|
|
113
|
+
if (!l)
|
|
114
|
+
return;
|
|
115
|
+
const E = () => {
|
|
116
|
+
l && oe(l.scrollWidth > l.clientWidth);
|
|
117
|
+
};
|
|
118
|
+
return E(), window.addEventListener("resize", E), () => {
|
|
119
|
+
window.removeEventListener("resize", E);
|
|
120
|
+
};
|
|
121
|
+
}, A = [], e[42] = S, e[43] = A) : (S = e[42], A = e[43]), fe(S, A);
|
|
122
|
+
let M;
|
|
123
|
+
e[44] !== o ? (M = /* @__PURE__ */ d("span", { ref: ee, className: "max-w-72 truncate", children: o }), e[44] = o, e[45] = M) : M = e[45];
|
|
124
|
+
const P = M, Z = !!r;
|
|
125
|
+
let h;
|
|
126
|
+
e[46] !== c || e[47] !== t || e[48] !== p || e[49] !== O || e[50] !== Z || e[51] !== o ? (h = Z ? {
|
|
127
|
+
onClick: p,
|
|
128
|
+
onKeyDown: O,
|
|
129
|
+
role: "button",
|
|
130
|
+
tabIndex: t ? void 0 : 0,
|
|
131
|
+
"aria-label": c || `${o} chip`,
|
|
132
|
+
"aria-disabled": t
|
|
133
|
+
} : {}, e[46] = c, e[47] = t, e[48] = p, e[49] = O, e[50] = Z, e[51] = o, e[52] = h) : h = e[52];
|
|
134
|
+
let x;
|
|
135
|
+
e[53] !== s || e[54] !== o || e[55] !== a ? (x = s && /* @__PURE__ */ d("div", { className: _("rounded-full overflow-hidden", a === "small" ? "w-4 h-4" : a === "large" ? "w-6 h-6" : "w-5 h-5"), children: typeof s == "string" ? /* @__PURE__ */ d("img", { src: s, alt: `Avatar for ${o}`, className: "w-full h-full object-cover" }) : s }), e[53] = s, e[54] = o, e[55] = a, e[56] = x) : x = e[56];
|
|
136
|
+
let y;
|
|
137
|
+
e[57] !== s || e[58] !== n || e[59] !== m ? (y = n && !s && /* @__PURE__ */ d("div", { className: "flex items-center", "aria-hidden": "true", children: le.isValidElement(n) ? le.cloneElement(n, {
|
|
138
|
+
size: m
|
|
139
|
+
}) : n }), e[57] = s, e[58] = n, e[59] = m, e[60] = y) : y = e[60];
|
|
140
|
+
let w;
|
|
141
|
+
e[61] !== Y || e[62] !== o || e[63] !== P ? (w = Y ? /* @__PURE__ */ d(ue, { delayDuration: 0, children: /* @__PURE__ */ te(be, { children: [
|
|
142
|
+
/* @__PURE__ */ d(pe, { asChild: !0, children: P }),
|
|
143
|
+
/* @__PURE__ */ d(ge, { children: o })
|
|
144
|
+
] }) }) : P, e[61] = Y, e[62] = o, e[63] = P, e[64] = w) : w = e[64];
|
|
145
|
+
let v;
|
|
146
|
+
e[65] !== f || e[66] !== F || e[67] !== u || e[68] !== t || e[69] !== U || e[70] !== Q || e[71] !== m || e[72] !== o ? (v = F && /* @__PURE__ */ d("button", { type: "button", onMouseDown: Q, onKeyDown: U, className: _("ml-1 rounded-full p-0.5 transition-colors focus:outline-none focus:ring-1 focus:ring-offset-1", f, t ? "cursor-not-allowed" : ""), disabled: t, "aria-label": u || `Remove ${o}`, tabIndex: t ? -1 : 0, children: /* @__PURE__ */ d(ae, { size: m }) }), e[65] = f, e[66] = F, e[67] = u, e[68] = t, e[69] = U, e[70] = Q, e[71] = m, e[72] = o, e[73] = v) : v = e[73];
|
|
147
|
+
let W;
|
|
148
|
+
return e[74] !== J || e[75] !== b || e[76] !== h || e[77] !== x || e[78] !== y || e[79] !== w || e[80] !== v ? (W = /* @__PURE__ */ te("div", { ...b, className: J, ...h, children: [
|
|
149
|
+
x,
|
|
150
|
+
y,
|
|
151
|
+
w,
|
|
152
|
+
v
|
|
153
|
+
] }), e[74] = J, e[75] = b, e[76] = h, e[77] = x, e[78] = y, e[79] = w, e[80] = v, e[81] = W) : W = e[81], W;
|
|
154
|
+
};
|
|
155
|
+
export {
|
|
156
|
+
Ce as Chip
|
|
157
|
+
};
|