@datum-cloud/datum-ui 0.2.0-alpha.2 → 0.2.0-alpha.4
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/README.md +336 -0
- package/dist/alert/index.mjs +3 -0
- package/dist/alert-BC2Mccfo.mjs +95 -0
- package/dist/autocomplete/index.mjs +7 -0
- package/dist/autocomplete-DZtI97HP.mjs +295 -0
- package/dist/avatar-stack/index.mjs +5 -0
- package/dist/avatar-stack-JCfBlPB9.mjs +80 -0
- package/dist/badge/index.mjs +3 -0
- package/dist/badge-bFgeYceE.mjs +185 -0
- package/dist/breadcrumb/index.mjs +4 -0
- package/dist/breadcrumb-BGYJgom_.mjs +71 -0
- package/dist/button/index.mjs +4 -0
- package/dist/button-AzpnV-WB.mjs +49 -0
- package/dist/button-C1wRfGtT.mjs +230 -0
- package/dist/button-group/index.mjs +5 -0
- package/dist/button-group-C1IB2K5s.mjs +40 -0
- package/dist/calendar/index.mjs +5 -0
- package/dist/calendar-DlIHeWb0.mjs +113 -0
- package/dist/card/index.mjs +4 -0
- package/dist/card-3Kd0VdNf.mjs +63 -0
- package/dist/chart/index.mjs +4 -0
- package/dist/chart-BZqUKpkh.mjs +143 -0
- package/dist/checkbox/index.mjs +4 -0
- package/dist/checkbox-LG1OKTpG.mjs +34 -0
- package/dist/col-lrLMZaTJ.mjs +184 -0
- package/dist/collapsible/index.mjs +3 -0
- package/dist/collapsible-Bt9UYfv3.mjs +9 -0
- package/dist/command/index.mjs +5 -0
- package/dist/command-s0Yv3abE.mjs +86 -0
- package/dist/components/features/date-picker/index.d.ts +3 -0
- package/dist/components/features/date-picker/index.d.ts.map +1 -0
- package/dist/components/features/dropzone/index.d.ts +1 -0
- package/dist/components/features/dropzone/index.d.ts.map +1 -1
- package/dist/date-picker/index.mjs +9 -0
- package/dist/{datum.provider-D6VMjSV0.mjs → datum.provider-B77goJgl.mjs} +1 -1
- package/dist/dialog/index.mjs +5 -0
- package/dist/dialog-DXBaT9gA.mjs +86 -0
- package/dist/dialog-bnMMf9GD.mjs +73 -0
- package/dist/dropdown/index.mjs +3 -0
- package/dist/dropdown-DtSa_lqc.mjs +112 -0
- package/dist/dropzone/index.mjs +5 -0
- package/dist/dropzone-BkOnwrS4.mjs +221 -0
- package/dist/empty-content/index.mjs +3 -0
- package/dist/empty-content-BM9rzI13.mjs +196 -0
- package/dist/exports/map.d.ts +3 -0
- package/dist/exports/map.d.ts.map +1 -0
- package/dist/form/index.mjs +146 -0
- package/dist/grid/index.mjs +3 -0
- package/dist/hooks/index.mjs +2 -3
- package/dist/hover-card/index.mjs +4 -0
- package/dist/hover-card-CUPfFUqE.mjs +33 -0
- package/dist/icon-wrapper-9ticVbRL.mjs +14 -0
- package/dist/icons/index.mjs +3 -3
- package/dist/index.mjs +66 -8
- package/dist/input/index.mjs +5 -0
- package/dist/input-DuyjEKEW.mjs +17 -0
- package/dist/input-fzXBheCN.mjs +17 -0
- package/dist/input-group/index.mjs +7 -0
- package/dist/input-group-CPaFSTEV.mjs +80 -0
- package/dist/input-number/index.mjs +6 -0
- package/dist/input-number-9o62JHRl.mjs +106 -0
- package/dist/input-with-addons/index.mjs +3 -0
- package/dist/input-with-addons-BQn7KCTU.mjs +30 -0
- package/dist/label/index.mjs +4 -0
- package/dist/label-_ste_Re3.mjs +44 -0
- package/dist/link-button-TIF2Zdrk.mjs +36 -0
- package/dist/loader-overlay/index.mjs +3 -0
- package/dist/loader-overlay-DUaQSZQP.mjs +17 -0
- package/dist/map/index.mjs +13 -0
- package/dist/map-Df8QMcX0.mjs +1094 -0
- package/dist/more-actions/index.mjs +5 -0
- package/dist/more-actions-Ch1f6Mh3.mjs +54 -0
- package/dist/nprogress/index.mjs +32 -0
- package/dist/page-title/index.mjs +3 -0
- package/dist/page-title-BJuo81rT.mjs +26 -0
- package/dist/popover/index.mjs +4 -0
- package/dist/popover-SQlKSz6L.mjs +36 -0
- package/dist/provider/index.mjs +4 -0
- package/dist/radio-group/index.mjs +4 -0
- package/dist/radio-group-Oshv0b-U.mjs +49 -0
- package/dist/select/index.mjs +4 -0
- package/dist/select-DVlEzD2W.mjs +166 -0
- package/dist/separator/index.mjs +4 -0
- package/dist/separator-T2ppyD-8.mjs +18 -0
- package/dist/sheet/index.mjs +5 -0
- package/dist/sheet-BKiCwtNO.mjs +45 -0
- package/dist/sheet-CtnP6gTD.mjs +77 -0
- package/dist/sidebar/index.mjs +11 -0
- package/dist/sidebar-DfqezV8t.mjs +945 -0
- package/dist/skeleton/index.mjs +4 -0
- package/dist/skeleton-vzbxA-DQ.mjs +13 -0
- package/dist/spinner/index.mjs +4 -0
- package/dist/spinner-BE7k2bAD.mjs +16 -0
- package/dist/{icon-wrapper-BgPkifId.mjs → spinner.icon-Bg8zgGh0.mjs} +1 -12
- package/dist/stepper/index.mjs +5 -0
- package/dist/stepper-SWB-u_nM.mjs +323 -0
- package/dist/style.css +3 -0
- package/dist/switch/index.mjs +4 -0
- package/dist/switch-Calk7Gyw.mjs +32 -0
- package/dist/table/index.mjs +4 -0
- package/dist/table-CsXBcQLI.mjs +68 -0
- package/dist/tabs/index.mjs +3 -0
- package/dist/tabs-D8n-dqnw.mjs +52 -0
- package/dist/tag-input/index.mjs +5 -0
- package/dist/tag-input-Di7SDNbK.mjs +284 -0
- package/dist/task-queue/index.mjs +7 -0
- package/dist/task-queue-dropdown-DW72ikDH.mjs +1356 -0
- package/dist/textarea/index.mjs +5 -0
- package/dist/textarea-CxE3YbC7.mjs +17 -0
- package/dist/textarea-QYRcDEpK.mjs +15 -0
- package/dist/theme/index.mjs +4 -0
- package/dist/theme-script-XBouzsNR.mjs +66 -0
- package/dist/to-api-format-C2xjQUcI.mjs +1506 -0
- package/dist/toast/index.mjs +3 -0
- package/dist/tooltip/index.mjs +4 -0
- package/dist/tooltip-Dd3ActSS.mjs +74 -0
- package/dist/typography/index.mjs +3 -0
- package/dist/typography-UA7ZZvgJ.mjs +200 -0
- package/dist/use-copy-to-clipboard-ki-WoTml.mjs +31 -0
- package/dist/use-stepper-BaToCYMs.mjs +2017 -0
- package/dist/{use-copy-to-clipboard-BfrpD6G8.mjs → use-toast-mdn_CqRY.mjs} +34 -27
- package/dist/utils/index.mjs +0 -1
- package/dist/utils-Bfgoe-Gm.mjs +20 -0
- package/dist/visually-hidden/index.mjs +3 -0
- package/dist/visuallyhidden-aaTUk4Yo.mjs +7 -0
- package/package.json +208 -8
- package/dist/components/index.mjs +0 -8
- package/dist/providers/index.mjs +0 -4
- package/dist/theme-script-DHyLk25i.mjs +0 -11128
- /package/dist/{close.icon-chkXPAUC.mjs → close.icon-CMNMoXM_.mjs} +0 -0
- /package/dist/{map-leaflet-imports-OKaoesjZ.mjs → map-leaflet-imports-CdzvEnzY.mjs} +0 -0
- /package/dist/{theme.provider-DpFLwtHe.mjs → theme.provider-DgGshapa.mjs} +0 -0
- /package/dist/{use-debounce-BYB-jPeX.mjs → use-debounce-DQ1tmxOL.mjs} +0 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { t as cn } from "./cn-DWCc1QRE.mjs";
|
|
2
|
+
import { a as CommandInput, i as CommandGroup, o as CommandItem, r as CommandEmpty, s as CommandList, t as Command } from "./command-s0Yv3abE.mjs";
|
|
3
|
+
import { i as PopoverTrigger, r as PopoverContent, t as Popover } from "./popover-SQlKSz6L.mjs";
|
|
4
|
+
import { t as LoaderOverlay } from "./loader-overlay-DUaQSZQP.mjs";
|
|
5
|
+
import { CheckIcon, ChevronDown } from "lucide-react";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
9
|
+
|
|
10
|
+
//#region src/components/features/autocomplete/autocomplete.tsx
|
|
11
|
+
function isGroupedOptions(options) {
|
|
12
|
+
return options.length > 0 && "options" in options[0];
|
|
13
|
+
}
|
|
14
|
+
function flattenOptions(options) {
|
|
15
|
+
if (isGroupedOptions(options)) return options.flatMap((g) => g.options);
|
|
16
|
+
return options;
|
|
17
|
+
}
|
|
18
|
+
function Trigger({ ref, selectedOption, renderValue, placeholder, loading, disabled, open, id, className, ...rest }) {
|
|
19
|
+
let displayContent;
|
|
20
|
+
if (!selectedOption) displayContent = /* @__PURE__ */ jsx("span", {
|
|
21
|
+
className: "text-muted-foreground",
|
|
22
|
+
children: placeholder
|
|
23
|
+
});
|
|
24
|
+
else if (renderValue) displayContent = renderValue(selectedOption);
|
|
25
|
+
else displayContent = /* @__PURE__ */ jsx("span", {
|
|
26
|
+
className: "truncate",
|
|
27
|
+
children: selectedOption.label
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
30
|
+
ref,
|
|
31
|
+
type: "button",
|
|
32
|
+
id,
|
|
33
|
+
role: "combobox",
|
|
34
|
+
"aria-expanded": open,
|
|
35
|
+
disabled: disabled || loading,
|
|
36
|
+
className: cn("text-input-foreground placeholder:text-input-placeholder", "border-input-border bg-input-background/50 relative flex h-10 w-full items-center justify-between rounded-lg border px-3 py-2 text-left text-sm transition-all", "focus-visible:border-input-focus-border focus-visible:shadow-(--input-focus-shadow)", "focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:outline-hidden", "aria-invalid:border-destructive", (disabled || loading) && "cursor-not-allowed opacity-50", className),
|
|
37
|
+
...rest,
|
|
38
|
+
children: [
|
|
39
|
+
loading && /* @__PURE__ */ jsx(LoaderOverlay, {}),
|
|
40
|
+
/* @__PURE__ */ jsx("div", {
|
|
41
|
+
className: "min-w-0 flex-1",
|
|
42
|
+
children: displayContent
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "text-muted-foreground ml-2 size-4 shrink-0" })
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
Trigger.displayName = "AutocompleteTrigger";
|
|
49
|
+
function DefaultOptionContent({ option, isSelected }) {
|
|
50
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
51
|
+
className: "flex w-full items-center justify-between gap-2",
|
|
52
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
53
|
+
className: "min-w-0 flex-1",
|
|
54
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
55
|
+
className: "truncate text-sm",
|
|
56
|
+
children: option.label
|
|
57
|
+
}), option.description && /* @__PURE__ */ jsx("p", {
|
|
58
|
+
className: "text-muted-foreground mt-0.5 line-clamp-2 text-xs",
|
|
59
|
+
children: option.description
|
|
60
|
+
})]
|
|
61
|
+
}), isSelected && /* @__PURE__ */ jsx(CheckIcon, { className: "text-primary size-4 shrink-0" })]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function StaticOptions({ options, selectedValue, onSelect, renderOption }) {
|
|
65
|
+
const renderItem = (option) => {
|
|
66
|
+
const isSelected = option.value === selectedValue;
|
|
67
|
+
return /* @__PURE__ */ jsx(CommandItem, {
|
|
68
|
+
value: option.value,
|
|
69
|
+
keywords: [option.label, option.description ?? ""],
|
|
70
|
+
disabled: option.disabled,
|
|
71
|
+
onSelect: () => onSelect(option.value),
|
|
72
|
+
className: "cursor-pointer justify-between px-3 py-2 text-xs",
|
|
73
|
+
children: renderOption ? renderOption(option, isSelected) : /* @__PURE__ */ jsx(DefaultOptionContent, {
|
|
74
|
+
option,
|
|
75
|
+
isSelected
|
|
76
|
+
})
|
|
77
|
+
}, option.value);
|
|
78
|
+
};
|
|
79
|
+
if (isGroupedOptions(options)) return /* @__PURE__ */ jsx(Fragment$1, { children: options.map((group, index) => /* @__PURE__ */ jsx(CommandGroup, {
|
|
80
|
+
heading: group.label,
|
|
81
|
+
className: index > 0 ? "border-t pt-1" : "",
|
|
82
|
+
children: group.options.map(renderItem)
|
|
83
|
+
}, group.label)) });
|
|
84
|
+
return /* @__PURE__ */ jsx(CommandGroup, {
|
|
85
|
+
className: "p-0",
|
|
86
|
+
children: options.map(renderItem)
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function VirtualizedOptions({ options, selectedValue, onSelect, renderOption, itemSize = 36, listClassName }) {
|
|
90
|
+
const flatOptions = flattenOptions(options);
|
|
91
|
+
const parentRef = React$1.useRef(null);
|
|
92
|
+
const virtualizer = useVirtualizer({
|
|
93
|
+
count: flatOptions.length,
|
|
94
|
+
getScrollElement: () => parentRef.current,
|
|
95
|
+
estimateSize: () => itemSize
|
|
96
|
+
});
|
|
97
|
+
React$1.useEffect(() => {
|
|
98
|
+
if (selectedValue) {
|
|
99
|
+
const index = flatOptions.findIndex((o) => o.value === selectedValue);
|
|
100
|
+
if (index >= 0) virtualizer.scrollToIndex(index, { align: "center" });
|
|
101
|
+
}
|
|
102
|
+
}, [
|
|
103
|
+
selectedValue,
|
|
104
|
+
flatOptions,
|
|
105
|
+
virtualizer
|
|
106
|
+
]);
|
|
107
|
+
return /* @__PURE__ */ jsx("div", {
|
|
108
|
+
ref: parentRef,
|
|
109
|
+
className: cn("max-h-[200px] overflow-auto", listClassName),
|
|
110
|
+
children: /* @__PURE__ */ jsx(CommandGroup, { children: /* @__PURE__ */ jsx("div", {
|
|
111
|
+
style: { height: `${virtualizer.getTotalSize()}px` },
|
|
112
|
+
className: "relative w-full",
|
|
113
|
+
children: virtualizer.getVirtualItems().map((virtualItem) => {
|
|
114
|
+
const option = flatOptions[virtualItem.index];
|
|
115
|
+
const isSelected = option.value === selectedValue;
|
|
116
|
+
return /* @__PURE__ */ jsx(CommandItem, {
|
|
117
|
+
value: option.value,
|
|
118
|
+
keywords: [option.label, option.description ?? ""],
|
|
119
|
+
disabled: option.disabled,
|
|
120
|
+
onSelect: () => onSelect(option.value),
|
|
121
|
+
className: "absolute top-0 left-0 w-full cursor-pointer justify-between px-3 py-2 text-xs",
|
|
122
|
+
style: {
|
|
123
|
+
height: `${virtualItem.size}px`,
|
|
124
|
+
transform: `translateY(${virtualItem.start}px)`
|
|
125
|
+
},
|
|
126
|
+
children: renderOption ? renderOption(option, isSelected) : /* @__PURE__ */ jsx(DefaultOptionContent, {
|
|
127
|
+
option,
|
|
128
|
+
isSelected
|
|
129
|
+
})
|
|
130
|
+
}, option.value);
|
|
131
|
+
})
|
|
132
|
+
}) })
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Autocomplete - A searchable select component
|
|
137
|
+
*
|
|
138
|
+
* Standalone, form-agnostic combobox built on Popover + Command (cmdk).
|
|
139
|
+
* Supports flat/grouped options, virtualization, custom rendering, and async search.
|
|
140
|
+
*
|
|
141
|
+
* @example Basic usage
|
|
142
|
+
* ```tsx
|
|
143
|
+
* <Autocomplete
|
|
144
|
+
* value={country}
|
|
145
|
+
* onValueChange={setCountry}
|
|
146
|
+
* options={countries}
|
|
147
|
+
* placeholder="Select country..."
|
|
148
|
+
* />
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* @example Async search
|
|
152
|
+
* ```tsx
|
|
153
|
+
* <Autocomplete
|
|
154
|
+
* value={userId}
|
|
155
|
+
* onValueChange={setUserId}
|
|
156
|
+
* options={users ?? []}
|
|
157
|
+
* onSearchChange={setSearch}
|
|
158
|
+
* loading={isLoading}
|
|
159
|
+
* placeholder="Search users..."
|
|
160
|
+
* />
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
function Autocomplete({ options, value, onValueChange, onSearchChange, searchPlaceholder = "Search...", disableSearch = false, renderOption, renderValue, placeholder = "Select...", emptyContent = "No results found", footer, creatable = false, creatableLabel, virtualize = false, itemSize = 36, loading = false, disabled = false, name, id, className, triggerClassName, contentClassName, listClassName }) {
|
|
164
|
+
const [open, setOpen] = React$1.useState(false);
|
|
165
|
+
const [search, setSearch] = React$1.useState("");
|
|
166
|
+
const flatOptions = React$1.useMemo(() => flattenOptions(options), [options]);
|
|
167
|
+
const selectedOption = React$1.useMemo(() => flatOptions.find((o) => o.value === value), [flatOptions, value]);
|
|
168
|
+
const displayOption = React$1.useMemo(() => {
|
|
169
|
+
if (selectedOption) return selectedOption;
|
|
170
|
+
if (creatable && value) return {
|
|
171
|
+
value,
|
|
172
|
+
label: value
|
|
173
|
+
};
|
|
174
|
+
}, [
|
|
175
|
+
selectedOption,
|
|
176
|
+
creatable,
|
|
177
|
+
value
|
|
178
|
+
]);
|
|
179
|
+
const isExternalSearch = !!onSearchChange;
|
|
180
|
+
const trimmedSearch = React$1.useMemo(() => search.trim(), [search]);
|
|
181
|
+
const showCreatableItem = React$1.useMemo(() => {
|
|
182
|
+
if (!creatable || trimmedSearch.length === 0) return false;
|
|
183
|
+
const needle = trimmedSearch.toLowerCase();
|
|
184
|
+
return !flatOptions.some((o) => o.value.toLowerCase() === needle || o.label.toLowerCase() === needle);
|
|
185
|
+
}, [
|
|
186
|
+
creatable,
|
|
187
|
+
trimmedSearch,
|
|
188
|
+
flatOptions
|
|
189
|
+
]);
|
|
190
|
+
const handleSelect = React$1.useCallback((optionValue) => {
|
|
191
|
+
onValueChange?.(optionValue);
|
|
192
|
+
setSearch("");
|
|
193
|
+
setOpen(false);
|
|
194
|
+
}, [onValueChange]);
|
|
195
|
+
const handleCreatableSelect = React$1.useCallback(() => {
|
|
196
|
+
onValueChange?.(trimmedSearch);
|
|
197
|
+
setSearch("");
|
|
198
|
+
setOpen(false);
|
|
199
|
+
}, [onValueChange, trimmedSearch]);
|
|
200
|
+
const handleOpenChange = React$1.useCallback((nextOpen) => {
|
|
201
|
+
setOpen(nextOpen);
|
|
202
|
+
if (!nextOpen) {
|
|
203
|
+
setSearch("");
|
|
204
|
+
if (isExternalSearch) onSearchChange?.("");
|
|
205
|
+
}
|
|
206
|
+
}, [isExternalSearch, onSearchChange]);
|
|
207
|
+
const handleSearchChange = React$1.useCallback((val) => {
|
|
208
|
+
setSearch(val);
|
|
209
|
+
if (isExternalSearch) onSearchChange?.(val);
|
|
210
|
+
}, [isExternalSearch, onSearchChange]);
|
|
211
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
212
|
+
className: cn("relative", className),
|
|
213
|
+
children: [/* @__PURE__ */ jsxs(Popover, {
|
|
214
|
+
open,
|
|
215
|
+
onOpenChange: handleOpenChange,
|
|
216
|
+
modal: true,
|
|
217
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
218
|
+
asChild: true,
|
|
219
|
+
children: /* @__PURE__ */ jsx(Trigger, {
|
|
220
|
+
selectedOption: displayOption,
|
|
221
|
+
renderValue,
|
|
222
|
+
placeholder,
|
|
223
|
+
loading,
|
|
224
|
+
disabled,
|
|
225
|
+
open,
|
|
226
|
+
id,
|
|
227
|
+
className: triggerClassName
|
|
228
|
+
})
|
|
229
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
230
|
+
className: cn("popover-content-width-full p-0", contentClassName),
|
|
231
|
+
align: "start",
|
|
232
|
+
children: /* @__PURE__ */ jsxs(Command, {
|
|
233
|
+
shouldFilter: !isExternalSearch && !creatable,
|
|
234
|
+
defaultValue: value,
|
|
235
|
+
children: [
|
|
236
|
+
!disableSearch && /* @__PURE__ */ jsx(CommandInput, {
|
|
237
|
+
className: "placeholder:text-secondary/60 h-7 border-none text-xs placeholder:text-xs focus-visible:ring-0",
|
|
238
|
+
iconClassName: "text-secondary size-3.5",
|
|
239
|
+
wrapperClassName: "px-3 py-2",
|
|
240
|
+
placeholder: searchPlaceholder,
|
|
241
|
+
value: search,
|
|
242
|
+
onValueChange: handleSearchChange
|
|
243
|
+
}),
|
|
244
|
+
/* @__PURE__ */ jsxs(CommandList, {
|
|
245
|
+
className: cn(!virtualize && "max-h-[300px]", listClassName),
|
|
246
|
+
children: [
|
|
247
|
+
!showCreatableItem && /* @__PURE__ */ jsx(CommandEmpty, { children: typeof emptyContent === "string" ? /* @__PURE__ */ jsx("span", {
|
|
248
|
+
className: "text-muted-foreground text-xs",
|
|
249
|
+
children: emptyContent
|
|
250
|
+
}) : emptyContent }),
|
|
251
|
+
virtualize ? /* @__PURE__ */ jsx(VirtualizedOptions, {
|
|
252
|
+
options,
|
|
253
|
+
selectedValue: value,
|
|
254
|
+
onSelect: handleSelect,
|
|
255
|
+
renderOption,
|
|
256
|
+
itemSize,
|
|
257
|
+
listClassName
|
|
258
|
+
}) : /* @__PURE__ */ jsx(StaticOptions, {
|
|
259
|
+
options,
|
|
260
|
+
selectedValue: value,
|
|
261
|
+
onSelect: handleSelect,
|
|
262
|
+
renderOption
|
|
263
|
+
}),
|
|
264
|
+
showCreatableItem && /* @__PURE__ */ jsx(CommandGroup, {
|
|
265
|
+
forceMount: true,
|
|
266
|
+
className: "p-0",
|
|
267
|
+
children: /* @__PURE__ */ jsx(CommandItem, {
|
|
268
|
+
forceMount: true,
|
|
269
|
+
value: `\0creatable:${trimmedSearch}`,
|
|
270
|
+
keywords: [trimmedSearch],
|
|
271
|
+
onSelect: handleCreatableSelect,
|
|
272
|
+
className: "cursor-pointer px-3 py-2 text-xs",
|
|
273
|
+
children: creatableLabel ? creatableLabel(trimmedSearch) : `Use "${trimmedSearch}"`
|
|
274
|
+
})
|
|
275
|
+
})
|
|
276
|
+
]
|
|
277
|
+
}),
|
|
278
|
+
footer && /* @__PURE__ */ jsx("div", {
|
|
279
|
+
className: "border-t",
|
|
280
|
+
children: footer
|
|
281
|
+
})
|
|
282
|
+
]
|
|
283
|
+
})
|
|
284
|
+
})]
|
|
285
|
+
}), name && /* @__PURE__ */ jsx("input", {
|
|
286
|
+
type: "hidden",
|
|
287
|
+
name,
|
|
288
|
+
value: value ?? ""
|
|
289
|
+
})]
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
Autocomplete.displayName = "Autocomplete";
|
|
293
|
+
|
|
294
|
+
//#endregion
|
|
295
|
+
export { Autocomplete as t };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { t as cn } from "./cn-DWCc1QRE.mjs";
|
|
2
|
+
import { t as cn$1 } from "./utils-Bfgoe-Gm.mjs";
|
|
3
|
+
import { t as Tooltip } from "./tooltip-Dd3ActSS.mjs";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
8
|
+
|
|
9
|
+
//#region ../shadcn/ui/avatar.tsx
|
|
10
|
+
const Avatar = ({ className, ...props }) => {
|
|
11
|
+
return /* @__PURE__ */ jsx(AvatarPrimitive.Root, {
|
|
12
|
+
"data-slot": "avatar",
|
|
13
|
+
className: cn$1("relative flex size-8 shrink-0 overflow-hidden rounded-full", className),
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const AvatarImage = ({ className, ...props }) => {
|
|
18
|
+
return /* @__PURE__ */ jsx(AvatarPrimitive.Image, {
|
|
19
|
+
"data-slot": "avatar-image",
|
|
20
|
+
className: cn$1("aspect-square size-full", className),
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const AvatarFallback = ({ className, ...props }) => {
|
|
25
|
+
return /* @__PURE__ */ jsx(AvatarPrimitive.Fallback, {
|
|
26
|
+
"data-slot": "avatar-fallback",
|
|
27
|
+
className: cn$1("bg-muted flex size-full items-center justify-center rounded-full", className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/components/features/avatar-stack/avatar-stack.tsx
|
|
34
|
+
const avatarStackVariants = cva("flex", {
|
|
35
|
+
variants: {
|
|
36
|
+
orientation: {
|
|
37
|
+
vertical: "flex-row",
|
|
38
|
+
horizontal: "flex-col"
|
|
39
|
+
},
|
|
40
|
+
spacing: {
|
|
41
|
+
sm: "-space-x-5 -space-y-5",
|
|
42
|
+
md: "-space-x-4 -space-y-4",
|
|
43
|
+
lg: "-space-x-3 -space-y-3",
|
|
44
|
+
xl: "-space-x-2 -space-y-2"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
orientation: "vertical",
|
|
49
|
+
spacing: "md"
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
function AvatarStack({ className, orientation, avatars, spacing, maxAvatarsAmount = 3, avatarClassName, ...props }) {
|
|
53
|
+
const shownAvatars = avatars.slice(0, maxAvatarsAmount);
|
|
54
|
+
const hiddenAvatars = avatars.slice(maxAvatarsAmount);
|
|
55
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
56
|
+
className: cn(avatarStackVariants({
|
|
57
|
+
orientation,
|
|
58
|
+
spacing
|
|
59
|
+
}), className, orientation === "horizontal" ? "-space-x-0" : "-space-y-0"),
|
|
60
|
+
...props,
|
|
61
|
+
children: [shownAvatars.map(({ name, image }, index) => /* @__PURE__ */ jsx(Tooltip, {
|
|
62
|
+
message: name,
|
|
63
|
+
delayDuration: 300,
|
|
64
|
+
children: /* @__PURE__ */ jsxs(Avatar, {
|
|
65
|
+
className: cn(avatarStackVariants(), "hover:z-10", avatarClassName),
|
|
66
|
+
children: [/* @__PURE__ */ jsx(AvatarImage, { src: image }), /* @__PURE__ */ jsx(AvatarFallback, { children: name?.split(" ")?.map((word) => word[0])?.join("")?.toUpperCase() })]
|
|
67
|
+
})
|
|
68
|
+
}, `${image}-${index + 1}`)), hiddenAvatars.length ? /* @__PURE__ */ jsx(Tooltip, {
|
|
69
|
+
message: /* @__PURE__ */ jsx(Fragment$1, { children: hiddenAvatars.map(({ name }, index) => /* @__PURE__ */ jsx("p", { children: name }, `${name}-${index + 1}`)) }),
|
|
70
|
+
delayDuration: 300,
|
|
71
|
+
children: /* @__PURE__ */ jsx(Avatar, {
|
|
72
|
+
className: cn(avatarClassName),
|
|
73
|
+
children: /* @__PURE__ */ jsxs(AvatarFallback, { children: ["+", avatars.length - shownAvatars.length] })
|
|
74
|
+
}, "Excesive avatars")
|
|
75
|
+
}) : null]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
//#endregion
|
|
80
|
+
export { avatarStackVariants as n, AvatarStack as t };
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { t as cn } from "./cn-DWCc1QRE.mjs";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/base/badge/badge.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Datum Badge Component
|
|
9
|
+
* Similar to Button component but with badge-specific styling
|
|
10
|
+
* Supports types: primary, secondary, tertiary, quaternary, warning, danger, success
|
|
11
|
+
* Supports themes: solid, outline, light
|
|
12
|
+
*/
|
|
13
|
+
const badgeVariants = cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-all focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2", {
|
|
14
|
+
variants: {
|
|
15
|
+
type: {
|
|
16
|
+
primary: "",
|
|
17
|
+
secondary: "",
|
|
18
|
+
tertiary: "",
|
|
19
|
+
quaternary: "",
|
|
20
|
+
info: "",
|
|
21
|
+
warning: "",
|
|
22
|
+
danger: "",
|
|
23
|
+
success: "",
|
|
24
|
+
muted: ""
|
|
25
|
+
},
|
|
26
|
+
theme: {
|
|
27
|
+
solid: "",
|
|
28
|
+
outline: "border",
|
|
29
|
+
light: "border"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
compoundVariants: [
|
|
33
|
+
{
|
|
34
|
+
type: "primary",
|
|
35
|
+
theme: "solid",
|
|
36
|
+
className: "border-transparent bg-[var(--color-badge-primary)] text-[var(--color-badge-primary-foreground)]"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: "primary",
|
|
40
|
+
theme: "outline",
|
|
41
|
+
className: "border-[var(--color-badge-primary)] text-[var(--color-badge-primary)] dark:border-[var(--color-badge-primary)] dark:text-[var(--color-badge-primary)]"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: "primary",
|
|
45
|
+
theme: "light",
|
|
46
|
+
className: "border-[var(--color-badge-primary)]/30 text-[var(--color-badge-primary)] bg-[var(--color-badge-primary)]/10 dark:border-[var(--color-badge-primary)] dark:text-[var(--color-badge-primary)] dark:bg-[var(--color-badge-primary)]/20"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: "secondary",
|
|
50
|
+
theme: "solid",
|
|
51
|
+
className: "border-transparent bg-[var(--color-badge-secondary)] text-[var(--color-badge-secondary-foreground)]"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: "secondary",
|
|
55
|
+
theme: "outline",
|
|
56
|
+
className: "border-[var(--color-badge-secondary)] text-[var(--color-badge-secondary)] dark:border-[var(--color-badge-secondary)] dark:text-[var(--color-badge-secondary)]"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: "secondary",
|
|
60
|
+
theme: "light",
|
|
61
|
+
className: "border-[var(--color-badge-secondary)] text-[var(--color-badge-secondary)] bg-[var(--color-badge-secondary)]/20 dark:border-[var(--color-badge-secondary)] dark:text-[var(--color-badge-secondary)] dark:bg-[var(--color-badge-secondary)]/20"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: "tertiary",
|
|
65
|
+
theme: "solid",
|
|
66
|
+
className: "border-transparent bg-[var(--color-badge-tertiary)] text-[var(--color-badge-tertiary-foreground)]"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: "tertiary",
|
|
70
|
+
theme: "outline",
|
|
71
|
+
className: "border-[var(--color-badge-tertiary)] text-[var(--color-badge-tertiary)] dark:border-[var(--color-badge-tertiary)] dark:text-[var(--color-badge-tertiary)]"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: "tertiary",
|
|
75
|
+
theme: "light",
|
|
76
|
+
className: "border-[var(--color-badge-tertiary)] text-[var(--color-badge-tertiary)] bg-[var(--color-badge-tertiary)]/20 dark:border-[var(--color-badge-tertiary)] dark:text-[var(--color-badge-tertiary)] dark:bg-[var(--color-badge-tertiary)]/20"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: "quaternary",
|
|
80
|
+
theme: "solid",
|
|
81
|
+
className: "border-transparent bg-[var(--color-badge-quaternary)] text-[var(--color-badge-quaternary-foreground)]"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: "quaternary",
|
|
85
|
+
theme: "outline",
|
|
86
|
+
className: "border-[var(--color-badge-quaternary)] text-[var(--color-badge-quaternary-foreground)] dark:border-[var(--color-badge-quaternary)] dark:text-[var(--color-badge-quaternary-foreground)]"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: "quaternary",
|
|
90
|
+
theme: "light",
|
|
91
|
+
className: "border-[var(--color-badge-quaternary)] text-[var(--color-badge-quaternary-foreground)] bg-[var(--color-badge-quaternary)]/20 dark:border-[var(--color-badge-quaternary)] dark:text-[var(--color-badge-quaternary-foreground)] dark:bg-[var(--color-badge-quaternary)]/20"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: "info",
|
|
95
|
+
theme: "solid",
|
|
96
|
+
className: "border-transparent bg-[var(--color-badge-info)] text-[var(--color-badge-info-foreground)]"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: "info",
|
|
100
|
+
theme: "outline",
|
|
101
|
+
className: "border-[var(--color-badge-info)] text-[var(--color-badge-info)] dark:border-[var(--color-badge-info)] dark:text-[var(--color-badge-info)]"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: "info",
|
|
105
|
+
theme: "light",
|
|
106
|
+
className: "border-[var(--color-badge-info)] text-[var(--color-badge-info)] bg-[var(--color-badge-info)]/20 dark:border-[var(--color-badge-info)] dark:text-[var(--color-badge-info)] dark:bg-[var(--color-badge-info)]/20"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
type: "warning",
|
|
110
|
+
theme: "solid",
|
|
111
|
+
className: "border-transparent bg-[var(--color-badge-warning)] text-[var(--color-badge-warning-foreground)]"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
type: "warning",
|
|
115
|
+
theme: "outline",
|
|
116
|
+
className: "border-[var(--color-badge-warning)] text-[var(--color-badge-warning)] dark:border-[var(--color-badge-warning)] dark:text-[var(--color-badge-warning)]"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
type: "warning",
|
|
120
|
+
theme: "light",
|
|
121
|
+
className: "border-[var(--color-badge-warning)] text-[var(--color-badge-warning)] bg-[var(--color-badge-warning)]/20 dark:border-[var(--color-badge-warning)] dark:text-[var(--color-badge-warning)] dark:bg-[var(--color-badge-warning)]/20"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
type: "danger",
|
|
125
|
+
theme: "solid",
|
|
126
|
+
className: "border-transparent bg-[var(--color-badge-danger)] text-[var(--color-badge-danger-foreground)]"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
type: "danger",
|
|
130
|
+
theme: "outline",
|
|
131
|
+
className: "border-[var(--color-badge-danger)] text-[var(--color-badge-danger)] dark:border-[var(--color-badge-danger)] dark:text-[var(--color-badge-danger)]"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: "danger",
|
|
135
|
+
theme: "light",
|
|
136
|
+
className: "border-[var(--color-badge-danger)] text-[var(--color-badge-danger)] bg-[var(--color-badge-danger)]/20 dark:border-[var(--color-badge-danger)] dark:text-[var(--color-badge-danger)] dark:bg-[var(--color-badge-danger)]/20"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
type: "success",
|
|
140
|
+
theme: "solid",
|
|
141
|
+
className: "border-transparent bg-[var(--color-badge-success)] text-[var(--color-badge-success-foreground)]"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
type: "success",
|
|
145
|
+
theme: "outline",
|
|
146
|
+
className: "border-[var(--color-badge-success)] text-[var(--color-badge-success)] dark:border-[var(--color-badge-success)] dark:text-[var(--color-badge-success)]"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
type: "success",
|
|
150
|
+
theme: "light",
|
|
151
|
+
className: "border-[var(--color-badge-success)] text-[var(--color-badge-success)] bg-[var(--color-badge-success)]/20 dark:border-[var(--color-badge-success)] dark:text-[var(--color-badge-success)] dark:bg-[var(--color-badge-success)]/20"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
type: "muted",
|
|
155
|
+
theme: "solid",
|
|
156
|
+
className: "border-transparent text-[var(--color-badge-muted-foreground)] bg-[var(--color-badge-muted)] dark:border-[var(--color-badge-muted)]/20 dark:text-[var(--color-badge-muted)] dark:bg-[var(--color-badge-muted)]/20"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
type: "muted",
|
|
160
|
+
theme: "outline",
|
|
161
|
+
className: "border-[var(--color-badge-muted)] text-[var(--color-badge-muted)] dark:border-[var(--color-badge-muted)] dark:text-[var(--color-badge-muted)]"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
type: "muted",
|
|
165
|
+
theme: "light",
|
|
166
|
+
className: "border-[var(--color-badge-muted)] text-[var(--color-badge-muted)] bg-[var(--color-badge-muted)]/20 dark:border-[var(--color-badge-muted)] dark:text-[var(--color-badge-muted)] dark:bg-[var(--color-badge-muted)]/20"
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
defaultVariants: {
|
|
170
|
+
type: "muted",
|
|
171
|
+
theme: "solid"
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
function Badge({ className, type, theme, ...props }) {
|
|
175
|
+
return /* @__PURE__ */ jsx("div", {
|
|
176
|
+
className: cn(badgeVariants({
|
|
177
|
+
type,
|
|
178
|
+
theme
|
|
179
|
+
}), className),
|
|
180
|
+
...props
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
//#endregion
|
|
185
|
+
export { badgeVariants as n, Badge as t };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "../utils-Bfgoe-Gm.mjs";
|
|
2
|
+
import { a as BreadcrumbList, i as BreadcrumbLink, n as BreadcrumbEllipsis, o as BreadcrumbPage, r as BreadcrumbItem, s as BreadcrumbSeparator, t as Breadcrumb } from "../breadcrumb-BGYJgom_.mjs";
|
|
3
|
+
|
|
4
|
+
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Bfgoe-Gm.mjs";
|
|
2
|
+
import { ChevronRight, MoreHorizontal } from "lucide-react";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
6
|
+
|
|
7
|
+
//#region ../shadcn/ui/breadcrumb.tsx
|
|
8
|
+
const Breadcrumb = ({ ...props }) => {
|
|
9
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
10
|
+
"aria-label": "breadcrumb",
|
|
11
|
+
"data-slot": "breadcrumb",
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
const BreadcrumbList = ({ className, ...props }) => {
|
|
16
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
17
|
+
"data-slot": "breadcrumb-list",
|
|
18
|
+
className: cn("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5", className),
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const BreadcrumbItem = ({ className, ...props }) => {
|
|
23
|
+
return /* @__PURE__ */ jsx("li", {
|
|
24
|
+
"data-slot": "breadcrumb-item",
|
|
25
|
+
className: cn("inline-flex items-center gap-1.5", className),
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
const BreadcrumbLink = ({ asChild, className, ...props }) => {
|
|
30
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "a", {
|
|
31
|
+
"data-slot": "breadcrumb-link",
|
|
32
|
+
className: cn("hover:text-foreground transition-colors", className),
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const BreadcrumbPage = ({ className, ...props }) => {
|
|
37
|
+
return /* @__PURE__ */ jsx("span", {
|
|
38
|
+
"data-slot": "breadcrumb-page",
|
|
39
|
+
role: "link",
|
|
40
|
+
"aria-disabled": "true",
|
|
41
|
+
"aria-current": "page",
|
|
42
|
+
className: cn("text-foreground font-normal", className),
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const BreadcrumbSeparator = ({ children, className, ...props }) => {
|
|
47
|
+
return /* @__PURE__ */ jsx("li", {
|
|
48
|
+
"data-slot": "breadcrumb-separator",
|
|
49
|
+
role: "presentation",
|
|
50
|
+
"aria-hidden": "true",
|
|
51
|
+
className: cn("[&>svg]:size-3.5", className),
|
|
52
|
+
...props,
|
|
53
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronRight, {})
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const BreadcrumbEllipsis = ({ className, ...props }) => {
|
|
57
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
58
|
+
"data-slot": "breadcrumb-ellipsis",
|
|
59
|
+
role: "presentation",
|
|
60
|
+
"aria-hidden": "true",
|
|
61
|
+
className: cn("flex size-9 items-center justify-center", className),
|
|
62
|
+
...props,
|
|
63
|
+
children: [/* @__PURE__ */ jsx(MoreHorizontal, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
|
|
64
|
+
className: "sr-only",
|
|
65
|
+
children: "More"
|
|
66
|
+
})]
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
export { BreadcrumbList as a, BreadcrumbLink as i, BreadcrumbEllipsis as n, BreadcrumbPage as o, BreadcrumbItem as r, BreadcrumbSeparator as s, Breadcrumb as t };
|