@foundrykit/components 2.2.0 → 2.2.3
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/chunk-4WYKNDYY.js +91 -0
- package/dist/chunk-4WYKNDYY.js.map +1 -0
- package/dist/chunk-5CXNMTIN.js +84 -0
- package/dist/chunk-5CXNMTIN.js.map +1 -0
- package/dist/chunk-B5ZTF5MZ.js +203 -0
- package/dist/chunk-B5ZTF5MZ.js.map +1 -0
- package/dist/chunk-EDNWBEKV.js +51 -0
- package/dist/chunk-EDNWBEKV.js.map +1 -0
- package/dist/chunk-ID7BFTID.js +248 -0
- package/dist/chunk-ID7BFTID.js.map +1 -0
- package/dist/chunk-IYBHXVCH.js +181 -0
- package/dist/chunk-IYBHXVCH.js.map +1 -0
- package/dist/chunk-KQZEF7PS.js +71 -0
- package/dist/chunk-KQZEF7PS.js.map +1 -0
- package/dist/chunk-P3GSYR7O.js +889 -0
- package/dist/chunk-P3GSYR7O.js.map +1 -0
- package/dist/chunk-PKSRYDN4.js +168 -0
- package/dist/chunk-PKSRYDN4.js.map +1 -0
- package/dist/chunk-SFM7ZMG2.js +104 -0
- package/dist/chunk-SFM7ZMG2.js.map +1 -0
- package/dist/chunk-TLQQZJUR.js +126 -0
- package/dist/chunk-TLQQZJUR.js.map +1 -0
- package/dist/chunk-UE7CDYEN.js +59 -0
- package/dist/chunk-UE7CDYEN.js.map +1 -0
- package/dist/chunk-UG7YS3D5.js +198 -0
- package/dist/chunk-UG7YS3D5.js.map +1 -0
- package/dist/components/advanced-search-bar/index.d.ts +308 -0
- package/dist/components/advanced-search-bar/index.js +34 -0
- package/dist/components/advanced-search-bar/index.js.map +1 -0
- package/dist/components/calendar/index.d.ts +20 -0
- package/dist/components/calendar/index.js +11 -0
- package/dist/components/calendar/index.js.map +1 -0
- package/dist/components/carousel/index.d.ts +40 -0
- package/dist/components/carousel/index.js +17 -0
- package/dist/components/carousel/index.js.map +1 -0
- package/dist/components/chart/index.d.ts +59 -0
- package/dist/components/chart/index.js +21 -0
- package/dist/components/chart/index.js.map +1 -0
- package/dist/components/combobox/index.d.ts +33 -0
- package/dist/components/combobox/index.js +10 -0
- package/dist/components/combobox/index.js.map +1 -0
- package/dist/components/command/index.d.ts +33 -0
- package/dist/components/command/index.js +25 -0
- package/dist/components/command/index.js.map +1 -0
- package/dist/components/data-table/index.d.ts +17 -0
- package/dist/components/data-table/index.js +9 -0
- package/dist/components/data-table/index.js.map +1 -0
- package/dist/components/date-picker/index.d.ts +17 -0
- package/dist/components/date-picker/index.js +9 -0
- package/dist/components/date-picker/index.js.map +1 -0
- package/dist/components/form/index.d.ts +37 -0
- package/dist/components/form/index.js +23 -0
- package/dist/components/form/index.js.map +1 -0
- package/dist/components/input-otp/index.d.ts +30 -0
- package/dist/components/input-otp/index.js +15 -0
- package/dist/components/input-otp/index.js.map +1 -0
- package/dist/components/pagination/index.d.ts +26 -0
- package/dist/components/pagination/index.js +20 -0
- package/dist/components/pagination/index.js.map +1 -0
- package/dist/components/search-bar/index.d.ts +17 -0
- package/dist/components/search-bar/index.js +9 -0
- package/dist/components/search-bar/index.js.map +1 -0
- package/dist/components/sidebar/index.d.ts +70 -0
- package/dist/components/sidebar/index.js +652 -0
- package/dist/components/sidebar/index.js.map +1 -0
- package/dist/components/theme-toggle/index.d.ts +20 -0
- package/dist/components/theme-toggle/index.js +9 -0
- package/dist/components/theme-toggle/index.js.map +1 -0
- package/dist/index.d.ts +27 -605
- package/dist/index.js +73 -2337
- package/dist/index.js.map +1 -1
- package/package.json +17 -10
- package/CHANGELOG.md +0 -362
- package/src/components/advanced-search-bar/config.ts +0 -223
- package/src/components/advanced-search-bar/index.tsx +0 -1415
- package/src/components/calendar/config.ts +0 -51
- package/src/components/calendar/index.tsx +0 -225
- package/src/components/carousel/config.ts +0 -28
- package/src/components/carousel/index.tsx +0 -258
- package/src/components/chart/config.ts +0 -28
- package/src/components/chart/index.tsx +0 -365
- package/src/components/combobox/config.ts +0 -28
- package/src/components/combobox/index.tsx +0 -111
- package/src/components/command/config.ts +0 -804
- package/src/components/command/index.tsx +0 -195
- package/src/components/data-table/config.ts +0 -28
- package/src/components/data-table/index.tsx +0 -124
- package/src/components/date-picker/config.ts +0 -55
- package/src/components/date-picker/index.tsx +0 -207
- package/src/components/form/config.ts +0 -21
- package/src/components/form/index.tsx +0 -150
- package/src/components/input-otp/config.ts +0 -28
- package/src/components/input-otp/index.tsx +0 -92
- package/src/components/pagination/config.ts +0 -367
- package/src/components/pagination/index.tsx +0 -135
- package/src/components/search-bar/config.ts +0 -58
- package/src/components/search-bar/index.tsx +0 -70
- package/src/components/sidebar/config.ts +0 -29
- package/src/components/sidebar/index.tsx +0 -723
- package/src/components/theme-toggle/config.ts +0 -27
- package/src/components/theme-toggle/index.tsx +0 -63
- package/src/index.ts +0 -83
- package/tsconfig.json +0 -12
- package/tsconfig.lint.json +0 -8
- package/tsup.config.ts +0 -11
package/dist/index.js
CHANGED
|
@@ -1,2352 +1,88 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use client";
|
|
2
|
-
|
|
3
|
-
// src/index.ts
|
|
4
|
-
import { cn as cn13 } from "@foundrykit/utils";
|
|
5
|
-
|
|
6
|
-
// src/components/advanced-search-bar/index.tsx
|
|
7
3
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "@foundrykit/hooks";
|
|
4
|
+
DatePicker
|
|
5
|
+
} from "./chunk-PKSRYDN4.js";
|
|
11
6
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import { ChevronDown, Search, X } from "lucide-react";
|
|
22
|
-
import * as React from "react";
|
|
23
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
-
function AdvancedSearchProvider({
|
|
25
|
-
children,
|
|
26
|
-
onSearch,
|
|
27
|
-
onResultSelect,
|
|
28
|
-
debounceMs = 300,
|
|
29
|
-
minQueryLength = 1,
|
|
30
|
-
emptyStateBehaviour = "show-empty-message",
|
|
31
|
-
initialResults = [],
|
|
32
|
-
styles = {
|
|
33
|
-
results: {
|
|
34
|
-
maxHeight: "24rem"
|
|
35
|
-
},
|
|
36
|
-
width: "100%"
|
|
37
|
-
}
|
|
38
|
-
}) {
|
|
39
|
-
const inputId = React.useId();
|
|
40
|
-
const resultsId = React.useId();
|
|
41
|
-
const [query, setQuery] = React.useState("");
|
|
42
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
43
|
-
const [results, setResults] = React.useState(initialResults);
|
|
44
|
-
const [isLoading, setIsLoading] = React.useState(false);
|
|
45
|
-
const [activeIndex, setActiveIndex] = React.useState(-1);
|
|
46
|
-
const timeoutRef = React.useRef(null);
|
|
47
|
-
const requestIdRef = React.useRef(0);
|
|
48
|
-
React.useEffect(() => {
|
|
49
|
-
return () => {
|
|
50
|
-
if (timeoutRef.current) {
|
|
51
|
-
clearTimeout(timeoutRef.current);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}, []);
|
|
55
|
-
const handleSearch = React.useCallback(
|
|
56
|
-
(searchQuery) => {
|
|
57
|
-
if (timeoutRef.current) {
|
|
58
|
-
clearTimeout(timeoutRef.current);
|
|
59
|
-
}
|
|
60
|
-
setActiveIndex(-1);
|
|
61
|
-
const trimmedQuery = searchQuery.trim();
|
|
62
|
-
const isEmptyQuery = trimmedQuery.length === 0;
|
|
63
|
-
const isTooShort = trimmedQuery.length < minQueryLength;
|
|
64
|
-
if (isEmptyQuery || isTooShort || !onSearch) {
|
|
65
|
-
requestIdRef.current += 1;
|
|
66
|
-
setIsLoading(false);
|
|
67
|
-
setResults(
|
|
68
|
-
emptyStateBehaviour === "show-all-results" && (isEmptyQuery || isTooShort) ? initialResults : []
|
|
69
|
-
);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const requestId = requestIdRef.current + 1;
|
|
73
|
-
requestIdRef.current = requestId;
|
|
74
|
-
timeoutRef.current = setTimeout(async () => {
|
|
75
|
-
setIsLoading(true);
|
|
76
|
-
try {
|
|
77
|
-
const searchResults = await onSearch(trimmedQuery);
|
|
78
|
-
if (requestIdRef.current === requestId) {
|
|
79
|
-
setResults(searchResults);
|
|
80
|
-
}
|
|
81
|
-
} catch (error) {
|
|
82
|
-
if (requestIdRef.current === requestId) {
|
|
83
|
-
console.error("Search error:", error);
|
|
84
|
-
setResults([]);
|
|
85
|
-
}
|
|
86
|
-
} finally {
|
|
87
|
-
if (requestIdRef.current === requestId) {
|
|
88
|
-
setIsLoading(false);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}, debounceMs);
|
|
92
|
-
},
|
|
93
|
-
[debounceMs, emptyStateBehaviour, initialResults, minQueryLength, onSearch]
|
|
94
|
-
);
|
|
95
|
-
const handleResultSelect = React.useCallback(
|
|
96
|
-
(result) => {
|
|
97
|
-
onResultSelect?.(result);
|
|
98
|
-
setQuery(result.title);
|
|
99
|
-
setActiveIndex(-1);
|
|
100
|
-
setIsOpen(false);
|
|
101
|
-
},
|
|
102
|
-
[onResultSelect]
|
|
103
|
-
);
|
|
104
|
-
const value = React.useMemo(
|
|
105
|
-
() => ({
|
|
106
|
-
query,
|
|
107
|
-
setQuery,
|
|
108
|
-
isOpen,
|
|
109
|
-
setIsOpen,
|
|
110
|
-
inputId,
|
|
111
|
-
resultsId,
|
|
112
|
-
activeIndex,
|
|
113
|
-
setActiveIndex,
|
|
114
|
-
results,
|
|
115
|
-
setResults,
|
|
116
|
-
isLoading,
|
|
117
|
-
setIsLoading,
|
|
118
|
-
onSearch: handleSearch,
|
|
119
|
-
onResultSelect: handleResultSelect,
|
|
120
|
-
emptyStateBehaviour,
|
|
121
|
-
minQueryLength
|
|
122
|
-
}),
|
|
123
|
-
[
|
|
124
|
-
query,
|
|
125
|
-
isOpen,
|
|
126
|
-
inputId,
|
|
127
|
-
resultsId,
|
|
128
|
-
activeIndex,
|
|
129
|
-
results,
|
|
130
|
-
isLoading,
|
|
131
|
-
handleSearch,
|
|
132
|
-
handleResultSelect,
|
|
133
|
-
emptyStateBehaviour,
|
|
134
|
-
minQueryLength
|
|
135
|
-
]
|
|
136
|
-
);
|
|
137
|
-
return /* @__PURE__ */ jsx(SearchContext.Provider, { value, children: /* @__PURE__ */ jsx(
|
|
138
|
-
"div",
|
|
139
|
-
{
|
|
140
|
-
style: {
|
|
141
|
-
"--results-max-height": styles.results?.maxHeight ?? "24rem",
|
|
142
|
-
width: styles.width
|
|
143
|
-
},
|
|
144
|
-
children
|
|
145
|
-
}
|
|
146
|
-
) });
|
|
147
|
-
}
|
|
148
|
-
var searchInputWrapperVariants = cva("relative flex w-full items-center", {
|
|
149
|
-
variants: {
|
|
150
|
-
size: {
|
|
151
|
-
sm: "h-8",
|
|
152
|
-
md: "h-10",
|
|
153
|
-
lg: "h-12",
|
|
154
|
-
xl: "h-14"
|
|
155
|
-
},
|
|
156
|
-
variant: {
|
|
157
|
-
default: "border-input bg-background border",
|
|
158
|
-
ghost: "bg-transparent",
|
|
159
|
-
filled: "bg-muted"
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
defaultVariants: {
|
|
163
|
-
size: "md",
|
|
164
|
-
variant: "default"
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
var searchResultsVariants = cva("w-full", {
|
|
168
|
-
variants: {
|
|
169
|
-
size: {
|
|
170
|
-
sm: "max-w-sm",
|
|
171
|
-
md: "max-w-md",
|
|
172
|
-
lg: "max-w-lg",
|
|
173
|
-
xl: "max-w-xl",
|
|
174
|
-
"2xl": "max-w-2xl",
|
|
175
|
-
full: "max-w-full"
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
defaultVariants: {
|
|
179
|
-
size: "lg"
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
var SearchInput = React.forwardRef(
|
|
183
|
-
({
|
|
184
|
-
className,
|
|
185
|
-
size,
|
|
186
|
-
variant,
|
|
187
|
-
placeholder = "Search...",
|
|
188
|
-
showSearchIcon = true,
|
|
189
|
-
showClearButton = true,
|
|
190
|
-
onClear,
|
|
191
|
-
asChild = false,
|
|
192
|
-
...props
|
|
193
|
-
}, ref) => {
|
|
194
|
-
const {
|
|
195
|
-
query,
|
|
196
|
-
setQuery,
|
|
197
|
-
onSearch,
|
|
198
|
-
onResultSelect,
|
|
199
|
-
results,
|
|
200
|
-
isOpen,
|
|
201
|
-
setIsOpen,
|
|
202
|
-
inputId,
|
|
203
|
-
resultsId,
|
|
204
|
-
activeIndex,
|
|
205
|
-
setActiveIndex,
|
|
206
|
-
emptyStateBehaviour,
|
|
207
|
-
minQueryLength
|
|
208
|
-
} = useAdvancedSearch();
|
|
209
|
-
const Comp = asChild ? Slot : "div";
|
|
210
|
-
const handleChange = (e) => {
|
|
211
|
-
const value = e.target.value;
|
|
212
|
-
setQuery(value);
|
|
213
|
-
if (emptyStateBehaviour === "hide-until-min-chars") {
|
|
214
|
-
setIsOpen(value.length >= minQueryLength);
|
|
215
|
-
} else {
|
|
216
|
-
setIsOpen(true);
|
|
217
|
-
}
|
|
218
|
-
setTimeout(() => {
|
|
219
|
-
onSearch(value);
|
|
220
|
-
}, 0);
|
|
221
|
-
props.onChange?.(e);
|
|
222
|
-
};
|
|
223
|
-
const handleFocus = (e) => {
|
|
224
|
-
if (emptyStateBehaviour === "hide-until-min-chars") {
|
|
225
|
-
setIsOpen(query.length >= minQueryLength);
|
|
226
|
-
} else {
|
|
227
|
-
setIsOpen(true);
|
|
228
|
-
}
|
|
229
|
-
props.onFocus?.(e);
|
|
230
|
-
};
|
|
231
|
-
const handleClear = () => {
|
|
232
|
-
setQuery("");
|
|
233
|
-
setActiveIndex(-1);
|
|
234
|
-
setTimeout(() => {
|
|
235
|
-
onSearch("");
|
|
236
|
-
}, 0);
|
|
237
|
-
onClear?.();
|
|
238
|
-
};
|
|
239
|
-
const handleKeyDown = (e) => {
|
|
240
|
-
props.onKeyDown?.(e);
|
|
241
|
-
if (e.defaultPrevented) return;
|
|
242
|
-
if (e.key === "Escape") {
|
|
243
|
-
setIsOpen(false);
|
|
244
|
-
setActiveIndex(-1);
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
if (e.key === "ArrowDown") {
|
|
248
|
-
e.preventDefault();
|
|
249
|
-
setIsOpen(true);
|
|
250
|
-
setActiveIndex(
|
|
251
|
-
results.length ? (activeIndex + 1) % results.length : -1
|
|
252
|
-
);
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
if (e.key === "ArrowUp") {
|
|
256
|
-
e.preventDefault();
|
|
257
|
-
setIsOpen(true);
|
|
258
|
-
setActiveIndex(
|
|
259
|
-
results.length ? activeIndex <= 0 ? results.length - 1 : activeIndex - 1 : -1
|
|
260
|
-
);
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
if (e.key === "Home") {
|
|
264
|
-
if (!results.length) return;
|
|
265
|
-
e.preventDefault();
|
|
266
|
-
setActiveIndex(0);
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
if (e.key === "End") {
|
|
270
|
-
if (!results.length) return;
|
|
271
|
-
e.preventDefault();
|
|
272
|
-
setActiveIndex(results.length - 1);
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
if (e.key === "Enter" && activeIndex >= 0 && results[activeIndex]) {
|
|
276
|
-
e.preventDefault();
|
|
277
|
-
onResultSelect(results[activeIndex]);
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
return /* @__PURE__ */ jsxs(
|
|
281
|
-
Comp,
|
|
282
|
-
{
|
|
283
|
-
className: cn(
|
|
284
|
-
searchInputWrapperVariants({ size, variant }),
|
|
285
|
-
"rounded-md",
|
|
286
|
-
className
|
|
287
|
-
),
|
|
288
|
-
onClick: (e) => {
|
|
289
|
-
if (e.target !== e.currentTarget) return;
|
|
290
|
-
const input = e.currentTarget.querySelector("input");
|
|
291
|
-
input?.focus();
|
|
292
|
-
},
|
|
293
|
-
children: [
|
|
294
|
-
showSearchIcon && /* @__PURE__ */ jsx(Search, { className: "text-muted-foreground absolute left-3 h-4 w-4" }),
|
|
295
|
-
/* @__PURE__ */ jsx(
|
|
296
|
-
Input,
|
|
297
|
-
{
|
|
298
|
-
ref,
|
|
299
|
-
...props,
|
|
300
|
-
id: inputId,
|
|
301
|
-
type: "search",
|
|
302
|
-
role: "combobox",
|
|
303
|
-
"aria-label": "Search",
|
|
304
|
-
"aria-autocomplete": "list",
|
|
305
|
-
"aria-expanded": isOpen,
|
|
306
|
-
"aria-controls": resultsId,
|
|
307
|
-
"aria-activedescendant": activeIndex >= 0 && results[activeIndex] ? `${resultsId}-option-${results[activeIndex].id}` : void 0,
|
|
308
|
-
placeholder,
|
|
309
|
-
value: query,
|
|
310
|
-
onChange: handleChange,
|
|
311
|
-
onFocus: handleFocus,
|
|
312
|
-
onKeyDown: handleKeyDown,
|
|
313
|
-
className: cn(
|
|
314
|
-
"border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0",
|
|
315
|
-
showSearchIcon && "pl-10",
|
|
316
|
-
showClearButton && query && "pr-10"
|
|
317
|
-
),
|
|
318
|
-
size: void 0
|
|
319
|
-
}
|
|
320
|
-
),
|
|
321
|
-
showClearButton && query && /* @__PURE__ */ jsx(
|
|
322
|
-
Button,
|
|
323
|
-
{
|
|
324
|
-
type: "button",
|
|
325
|
-
variant: "ghost",
|
|
326
|
-
size: "sm",
|
|
327
|
-
"aria-label": "Clear search",
|
|
328
|
-
className: "absolute right-1 h-6 w-6 p-0",
|
|
329
|
-
onClick: handleClear,
|
|
330
|
-
children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
|
|
331
|
-
}
|
|
332
|
-
)
|
|
333
|
-
]
|
|
334
|
-
}
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
);
|
|
338
|
-
SearchInput.displayName = "SearchInput";
|
|
339
|
-
var SearchTrigger = React.forwardRef(({ className, asChild = false, children, onClick, ...props }, ref) => {
|
|
340
|
-
const { isOpen, setIsOpen, resultsId } = useAdvancedSearch();
|
|
341
|
-
const Comp = asChild ? Slot : Button;
|
|
342
|
-
return /* @__PURE__ */ jsx(
|
|
343
|
-
Comp,
|
|
344
|
-
{
|
|
345
|
-
ref,
|
|
346
|
-
...props,
|
|
347
|
-
type: "button",
|
|
348
|
-
"aria-expanded": isOpen,
|
|
349
|
-
"aria-controls": resultsId,
|
|
350
|
-
className: cn(className),
|
|
351
|
-
onClick: (event) => {
|
|
352
|
-
onClick?.(event);
|
|
353
|
-
if (!event.defaultPrevented) {
|
|
354
|
-
setIsOpen(!isOpen);
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
children
|
|
358
|
-
}
|
|
359
|
-
);
|
|
360
|
-
});
|
|
361
|
-
SearchTrigger.displayName = "SearchTrigger";
|
|
362
|
-
var SearchResults = React.forwardRef(
|
|
363
|
-
({
|
|
364
|
-
className,
|
|
365
|
-
size = "full",
|
|
366
|
-
sections,
|
|
367
|
-
showEmptyState = true,
|
|
368
|
-
emptyStateMessage = "No results found",
|
|
369
|
-
showLoadingState = true,
|
|
370
|
-
loadingBehaviour = "replace-results",
|
|
371
|
-
loadingState,
|
|
372
|
-
loadingMessage = "Searching...",
|
|
373
|
-
...props
|
|
374
|
-
}, ref) => {
|
|
375
|
-
const {
|
|
376
|
-
results,
|
|
377
|
-
isLoading,
|
|
378
|
-
query,
|
|
379
|
-
onResultSelect,
|
|
380
|
-
resultsId,
|
|
381
|
-
activeIndex,
|
|
382
|
-
emptyStateBehaviour,
|
|
383
|
-
minQueryLength
|
|
384
|
-
} = useAdvancedSearch();
|
|
385
|
-
const shouldReplaceResultsWithLoading = loadingBehaviour === "replace-results" || results.length === 0;
|
|
386
|
-
if (isLoading && showLoadingState && shouldReplaceResultsWithLoading) {
|
|
387
|
-
return /* @__PURE__ */ jsx(
|
|
388
|
-
"div",
|
|
389
|
-
{
|
|
390
|
-
ref,
|
|
391
|
-
id: resultsId,
|
|
392
|
-
className: cn(
|
|
393
|
-
searchResultsVariants({ size }),
|
|
394
|
-
"text-muted-foreground p-4 text-center",
|
|
395
|
-
className
|
|
396
|
-
),
|
|
397
|
-
role: "status",
|
|
398
|
-
"aria-live": "polite",
|
|
399
|
-
...props,
|
|
400
|
-
children: loadingState ?? loadingMessage
|
|
401
|
-
}
|
|
402
|
-
);
|
|
403
|
-
}
|
|
404
|
-
const shouldShowEmptyState = results.length === 0 || !query && emptyStateBehaviour !== "show-all-results";
|
|
405
|
-
if (shouldShowEmptyState) {
|
|
406
|
-
if (!showEmptyState) return null;
|
|
407
|
-
if (emptyStateBehaviour === "hide-until-min-chars" && query.length < minQueryLength) {
|
|
408
|
-
return null;
|
|
409
|
-
}
|
|
410
|
-
return /* @__PURE__ */ jsx(
|
|
411
|
-
"div",
|
|
412
|
-
{
|
|
413
|
-
ref,
|
|
414
|
-
id: resultsId,
|
|
415
|
-
className: cn(
|
|
416
|
-
searchResultsVariants({ size }),
|
|
417
|
-
"text-muted-foreground p-4 text-center",
|
|
418
|
-
className
|
|
419
|
-
),
|
|
420
|
-
role: "status",
|
|
421
|
-
"aria-live": "polite",
|
|
422
|
-
...props,
|
|
423
|
-
children: emptyStateMessage
|
|
424
|
-
}
|
|
425
|
-
);
|
|
426
|
-
}
|
|
427
|
-
const displaySections = sections || [
|
|
428
|
-
{
|
|
429
|
-
id: "results",
|
|
430
|
-
title: "Results",
|
|
431
|
-
results
|
|
432
|
-
}
|
|
433
|
-
];
|
|
434
|
-
return /* @__PURE__ */ jsx(
|
|
435
|
-
"div",
|
|
436
|
-
{
|
|
437
|
-
ref,
|
|
438
|
-
id: resultsId,
|
|
439
|
-
className: cn(
|
|
440
|
-
searchResultsVariants({ size }),
|
|
441
|
-
"max-h-[var(--results-max-height)]",
|
|
442
|
-
className
|
|
443
|
-
),
|
|
444
|
-
role: "listbox",
|
|
445
|
-
"aria-label": "Search results",
|
|
446
|
-
"aria-busy": isLoading || void 0,
|
|
447
|
-
...props,
|
|
448
|
-
children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-fit max-h-[var(--results-max-height)] *:max-h-[var(--results-max-height)]", children: /* @__PURE__ */ jsx("div", { className: "space-y-4 p-4", children: displaySections.map((section, index) => /* @__PURE__ */ jsxs("div", { children: [
|
|
449
|
-
index > 0 && /* @__PURE__ */ jsx(Separator, { className: "my-4" }),
|
|
450
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
451
|
-
/* @__PURE__ */ jsx("h3", { className: "text-muted-foreground text-sm font-semibold tracking-wide uppercase", children: section.title }),
|
|
452
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
453
|
-
section.results.map((result) => {
|
|
454
|
-
const resultIndex = results.findIndex(
|
|
455
|
-
(item) => item.id === result.id
|
|
456
|
-
);
|
|
457
|
-
return /* @__PURE__ */ jsx(
|
|
458
|
-
SearchResultItem,
|
|
459
|
-
{
|
|
460
|
-
id: `${resultsId}-option-${result.id}`,
|
|
461
|
-
result,
|
|
462
|
-
isActive: resultIndex === activeIndex,
|
|
463
|
-
onClick: () => onResultSelect(result)
|
|
464
|
-
},
|
|
465
|
-
result.id
|
|
466
|
-
);
|
|
467
|
-
}),
|
|
468
|
-
section.showMore && section.onShowMore && /* @__PURE__ */ jsxs(
|
|
469
|
-
Button,
|
|
470
|
-
{
|
|
471
|
-
variant: "ghost",
|
|
472
|
-
size: "sm",
|
|
473
|
-
className: "text-muted-foreground w-full justify-start",
|
|
474
|
-
onClick: section.onShowMore,
|
|
475
|
-
children: [
|
|
476
|
-
"Show more",
|
|
477
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: "ml-2 h-3 w-3" })
|
|
478
|
-
]
|
|
479
|
-
}
|
|
480
|
-
)
|
|
481
|
-
] })
|
|
482
|
-
] })
|
|
483
|
-
] }, section.id)) }) })
|
|
484
|
-
}
|
|
485
|
-
);
|
|
486
|
-
}
|
|
487
|
-
);
|
|
488
|
-
SearchResults.displayName = "SearchResults";
|
|
489
|
-
var SearchResultItem = ({
|
|
490
|
-
id,
|
|
491
|
-
result,
|
|
492
|
-
isActive,
|
|
493
|
-
onClick
|
|
494
|
-
}) => {
|
|
495
|
-
const itemClasses = cn(
|
|
496
|
-
"hover:bg-accent hover:text-accent-foreground focus-visible:border-ring focus-visible:ring-ring/50 w-full rounded-md text-left transition-colors outline-none focus-visible:ring-[3px]",
|
|
497
|
-
isActive && "bg-accent text-accent-foreground"
|
|
498
|
-
);
|
|
499
|
-
if (result.type === "category") {
|
|
500
|
-
return /* @__PURE__ */ jsx(
|
|
501
|
-
"div",
|
|
502
|
-
{
|
|
503
|
-
id,
|
|
504
|
-
role: "presentation",
|
|
505
|
-
className: "text-muted-foreground p-2 text-sm font-medium",
|
|
506
|
-
children: result.title
|
|
507
|
-
}
|
|
508
|
-
);
|
|
509
|
-
}
|
|
510
|
-
if (result.type === "suggestion") {
|
|
511
|
-
return /* @__PURE__ */ jsx(
|
|
512
|
-
"button",
|
|
513
|
-
{
|
|
514
|
-
id,
|
|
515
|
-
type: "button",
|
|
516
|
-
role: "option",
|
|
517
|
-
"aria-selected": isActive,
|
|
518
|
-
className: cn(itemClasses, "p-2 text-sm"),
|
|
519
|
-
onClick,
|
|
520
|
-
children: result.title
|
|
521
|
-
}
|
|
522
|
-
);
|
|
523
|
-
}
|
|
524
|
-
const content = /* @__PURE__ */ jsxs("div", { className: "flex gap-3 p-3", children: [
|
|
525
|
-
result.image && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx(
|
|
526
|
-
"img",
|
|
527
|
-
{
|
|
528
|
-
src: result.image,
|
|
529
|
-
alt: result.title,
|
|
530
|
-
className: "h-12 w-12 rounded-md object-cover",
|
|
531
|
-
loading: "lazy"
|
|
532
|
-
}
|
|
533
|
-
) }),
|
|
534
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
535
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-2", children: [
|
|
536
|
-
/* @__PURE__ */ jsx("h4", { className: "truncate text-sm font-semibold", children: result.title }),
|
|
537
|
-
result.badge && /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: result.badge })
|
|
538
|
-
] }),
|
|
539
|
-
result.description && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1 line-clamp-2 text-xs", children: result.description })
|
|
540
|
-
] })
|
|
541
|
-
] });
|
|
542
|
-
if (result.href) {
|
|
543
|
-
return /* @__PURE__ */ jsx(
|
|
544
|
-
"a",
|
|
545
|
-
{
|
|
546
|
-
id,
|
|
547
|
-
role: "option",
|
|
548
|
-
"aria-selected": isActive,
|
|
549
|
-
href: result.href,
|
|
550
|
-
className: cn(itemClasses, "block"),
|
|
551
|
-
onClick,
|
|
552
|
-
children: content
|
|
553
|
-
}
|
|
554
|
-
);
|
|
555
|
-
}
|
|
556
|
-
return /* @__PURE__ */ jsx(
|
|
557
|
-
"button",
|
|
558
|
-
{
|
|
559
|
-
id,
|
|
560
|
-
type: "button",
|
|
561
|
-
role: "option",
|
|
562
|
-
"aria-selected": isActive,
|
|
563
|
-
className: itemClasses,
|
|
564
|
-
onClick,
|
|
565
|
-
children: content
|
|
566
|
-
}
|
|
567
|
-
);
|
|
568
|
-
};
|
|
569
|
-
var AdvancedSearchBar = React.forwardRef(
|
|
570
|
-
({
|
|
571
|
-
className,
|
|
572
|
-
children,
|
|
573
|
-
open,
|
|
574
|
-
onOpenChange,
|
|
575
|
-
resultsMode = "popover",
|
|
576
|
-
triggerClassName,
|
|
577
|
-
resultsClassName,
|
|
578
|
-
...props
|
|
579
|
-
}, ref) => {
|
|
580
|
-
const { isOpen, setIsOpen, setActiveIndex } = useAdvancedSearch();
|
|
581
|
-
const rootRef = React.useRef(null);
|
|
582
|
-
const previousOpenRef = React.useRef(isOpen);
|
|
583
|
-
const isControlled = open !== void 0;
|
|
584
|
-
const isOpenState = isControlled ? open : isOpen;
|
|
585
|
-
React.useEffect(() => {
|
|
586
|
-
if (previousOpenRef.current !== isOpen) {
|
|
587
|
-
previousOpenRef.current = isOpen;
|
|
588
|
-
onOpenChange?.(isOpen);
|
|
589
|
-
}
|
|
590
|
-
}, [isOpen, onOpenChange]);
|
|
591
|
-
React.useEffect(() => {
|
|
592
|
-
if (!isOpenState) return;
|
|
593
|
-
const handlePointerDown = (event) => {
|
|
594
|
-
if (!rootRef.current?.contains(event.target)) {
|
|
595
|
-
setActiveIndex(-1);
|
|
596
|
-
setIsOpen(false);
|
|
597
|
-
onOpenChange?.(false);
|
|
598
|
-
}
|
|
599
|
-
};
|
|
600
|
-
const handleKeyDown = (event) => {
|
|
601
|
-
if (event.key !== "Escape") return;
|
|
602
|
-
setActiveIndex(-1);
|
|
603
|
-
setIsOpen(false);
|
|
604
|
-
onOpenChange?.(false);
|
|
605
|
-
const focusTarget = rootRef.current?.querySelector(
|
|
606
|
-
'input, button, [href], [tabindex]:not([tabindex="-1"])'
|
|
607
|
-
);
|
|
608
|
-
focusTarget?.focus();
|
|
609
|
-
};
|
|
610
|
-
document.addEventListener("pointerdown", handlePointerDown);
|
|
611
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
612
|
-
return () => {
|
|
613
|
-
document.removeEventListener("pointerdown", handlePointerDown);
|
|
614
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
615
|
-
};
|
|
616
|
-
}, [isOpenState, onOpenChange, setActiveIndex, setIsOpen]);
|
|
617
|
-
const setRefs = React.useCallback(
|
|
618
|
-
(node) => {
|
|
619
|
-
rootRef.current = node;
|
|
620
|
-
if (typeof ref === "function") {
|
|
621
|
-
ref(node);
|
|
622
|
-
} else if (ref) {
|
|
623
|
-
ref.current = node;
|
|
624
|
-
}
|
|
625
|
-
},
|
|
626
|
-
[ref]
|
|
627
|
-
);
|
|
628
|
-
const isSearchResultsChild = (child) => {
|
|
629
|
-
if (!React.isValidElement(child)) return false;
|
|
630
|
-
const childType = child.type;
|
|
631
|
-
return child.type === SearchResults || childType.displayName === SearchResults.displayName;
|
|
632
|
-
};
|
|
633
|
-
const childrenArray = React.Children.toArray(children);
|
|
634
|
-
const resultsChildren = childrenArray.filter(isSearchResultsChild);
|
|
635
|
-
const triggerChildren = childrenArray.filter(
|
|
636
|
-
(child) => !isSearchResultsChild(child)
|
|
637
|
-
);
|
|
638
|
-
const triggerElement = triggerChildren.length ? triggerChildren : /* @__PURE__ */ jsx(SearchInput, {});
|
|
639
|
-
const resultsElement = resultsChildren.length ? resultsChildren : /* @__PURE__ */ jsx(SearchResults, {});
|
|
640
|
-
const resultsPanel = isOpenState ? resultsMode === "inline" ? /* @__PURE__ */ jsx("div", { className: cn("w-full overflow-hidden", resultsClassName), children: resultsElement }) : /* @__PURE__ */ jsx(
|
|
641
|
-
"div",
|
|
642
|
-
{
|
|
643
|
-
className: cn(
|
|
644
|
-
"bg-popover text-popover-foreground border-border absolute top-full left-0 z-50 mt-1 max-h-[min(var(--results-max-height),calc(100vh-8rem))] w-full overflow-hidden rounded-md border shadow-lg",
|
|
645
|
-
resultsClassName
|
|
646
|
-
),
|
|
647
|
-
children: resultsElement
|
|
648
|
-
}
|
|
649
|
-
) : null;
|
|
650
|
-
return /* @__PURE__ */ jsxs(
|
|
651
|
-
"div",
|
|
652
|
-
{
|
|
653
|
-
ref: setRefs,
|
|
654
|
-
"data-state": isOpenState ? "open" : "closed",
|
|
655
|
-
className: cn("relative w-full", className),
|
|
656
|
-
...props,
|
|
657
|
-
children: [
|
|
658
|
-
/* @__PURE__ */ jsx("div", { className: cn("w-full", triggerClassName), children: triggerElement }),
|
|
659
|
-
resultsPanel
|
|
660
|
-
]
|
|
661
|
-
}
|
|
662
|
-
);
|
|
663
|
-
}
|
|
664
|
-
);
|
|
665
|
-
AdvancedSearchBar.displayName = "AdvancedSearchBar";
|
|
666
|
-
var SearchSection = React.forwardRef(({ className, title, showMore, onShowMore, children, ...props }, ref) => {
|
|
667
|
-
return /* @__PURE__ */ jsxs("div", { ref, className: cn("space-y-2", className), ...props, children: [
|
|
668
|
-
title && /* @__PURE__ */ jsx("h3", { className: "text-muted-foreground text-sm font-semibold tracking-wide uppercase", children: title }),
|
|
669
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
670
|
-
children,
|
|
671
|
-
showMore && onShowMore && /* @__PURE__ */ jsxs(
|
|
672
|
-
Button,
|
|
673
|
-
{
|
|
674
|
-
variant: "ghost",
|
|
675
|
-
size: "sm",
|
|
676
|
-
className: "text-muted-foreground w-full justify-start",
|
|
677
|
-
onClick: onShowMore,
|
|
678
|
-
children: [
|
|
679
|
-
"Show more",
|
|
680
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: "ml-2 h-3 w-3" })
|
|
681
|
-
]
|
|
682
|
-
}
|
|
683
|
-
)
|
|
684
|
-
] })
|
|
685
|
-
] });
|
|
686
|
-
});
|
|
687
|
-
SearchSection.displayName = "SearchSection";
|
|
688
|
-
var SearchItem = React.forwardRef(
|
|
689
|
-
({ className, result, onClick, children, ...props }, ref) => {
|
|
690
|
-
const { onResultSelect } = useAdvancedSearch();
|
|
691
|
-
const handleClick = () => {
|
|
692
|
-
if (result) {
|
|
693
|
-
onResultSelect(result);
|
|
694
|
-
}
|
|
695
|
-
onClick?.();
|
|
696
|
-
};
|
|
697
|
-
const handleKeyDown = (event) => {
|
|
698
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
699
|
-
event.preventDefault();
|
|
700
|
-
handleClick();
|
|
701
|
-
}
|
|
702
|
-
};
|
|
703
|
-
if (children) {
|
|
704
|
-
return /* @__PURE__ */ jsx(
|
|
705
|
-
"div",
|
|
706
|
-
{
|
|
707
|
-
ref,
|
|
708
|
-
role: "button",
|
|
709
|
-
tabIndex: 0,
|
|
710
|
-
className: cn("cursor-pointer outline-none", className),
|
|
711
|
-
onClick: handleClick,
|
|
712
|
-
onKeyDown: handleKeyDown,
|
|
713
|
-
...props,
|
|
714
|
-
children
|
|
715
|
-
}
|
|
716
|
-
);
|
|
717
|
-
}
|
|
718
|
-
if (!result) return null;
|
|
719
|
-
if (result.type === "category") {
|
|
720
|
-
return /* @__PURE__ */ jsx(
|
|
721
|
-
"div",
|
|
722
|
-
{
|
|
723
|
-
ref,
|
|
724
|
-
role: "presentation",
|
|
725
|
-
className: cn(
|
|
726
|
-
"text-muted-foreground p-2 text-sm font-medium",
|
|
727
|
-
className
|
|
728
|
-
),
|
|
729
|
-
...props,
|
|
730
|
-
children: result.title
|
|
731
|
-
}
|
|
732
|
-
);
|
|
733
|
-
}
|
|
734
|
-
if (result.type === "suggestion") {
|
|
735
|
-
return /* @__PURE__ */ jsx(
|
|
736
|
-
Button,
|
|
737
|
-
{
|
|
738
|
-
ref,
|
|
739
|
-
variant: "ghost",
|
|
740
|
-
size: "sm",
|
|
741
|
-
className: cn("h-auto w-full justify-start p-2", className),
|
|
742
|
-
onClick: handleClick,
|
|
743
|
-
...props,
|
|
744
|
-
children: /* @__PURE__ */ jsx("span", { className: "text-sm", children: result.title })
|
|
745
|
-
}
|
|
746
|
-
);
|
|
747
|
-
}
|
|
748
|
-
return /* @__PURE__ */ jsx(
|
|
749
|
-
"button",
|
|
750
|
-
{
|
|
751
|
-
ref,
|
|
752
|
-
type: "button",
|
|
753
|
-
className: cn(
|
|
754
|
-
"hover:bg-accent hover:text-accent-foreground focus-visible:border-ring focus-visible:ring-ring/50 w-full cursor-pointer rounded-md text-left transition-colors outline-none focus-visible:ring-[3px]",
|
|
755
|
-
className
|
|
756
|
-
),
|
|
757
|
-
onClick: handleClick,
|
|
758
|
-
...props,
|
|
759
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3 p-3", children: [
|
|
760
|
-
result.image && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx(
|
|
761
|
-
"img",
|
|
762
|
-
{
|
|
763
|
-
src: result.image,
|
|
764
|
-
alt: result.title,
|
|
765
|
-
className: "h-12 w-12 rounded-md object-cover",
|
|
766
|
-
loading: "lazy"
|
|
767
|
-
}
|
|
768
|
-
) }),
|
|
769
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
770
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-2", children: [
|
|
771
|
-
/* @__PURE__ */ jsx("h4", { className: "truncate text-sm font-semibold", children: result.title }),
|
|
772
|
-
result.badge && /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: result.badge })
|
|
773
|
-
] }),
|
|
774
|
-
result.description && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1 line-clamp-2 text-xs", children: result.description })
|
|
775
|
-
] })
|
|
776
|
-
] })
|
|
777
|
-
}
|
|
778
|
-
);
|
|
779
|
-
}
|
|
780
|
-
);
|
|
781
|
-
SearchItem.displayName = "SearchItem";
|
|
782
|
-
function AdvancedSearchBarWrapper(props = {}) {
|
|
783
|
-
const {
|
|
784
|
-
minQueryLength = 1,
|
|
785
|
-
emptyStateBehaviour = "show-all-results",
|
|
786
|
-
size = "md",
|
|
787
|
-
variant = "default",
|
|
788
|
-
useCustomTrigger = false
|
|
789
|
-
} = props;
|
|
790
|
-
const mockSearchResults = [
|
|
791
|
-
{
|
|
792
|
-
id: "1",
|
|
793
|
-
title: "Beach Holidays",
|
|
794
|
-
description: "Relaxing beach destinations",
|
|
795
|
-
type: "result",
|
|
796
|
-
badge: "Popular"
|
|
797
|
-
},
|
|
798
|
-
{
|
|
799
|
-
id: "2",
|
|
800
|
-
title: "Adventure Trips",
|
|
801
|
-
description: "Exciting adventure experiences",
|
|
802
|
-
type: "result",
|
|
803
|
-
badge: "New"
|
|
804
|
-
},
|
|
805
|
-
{
|
|
806
|
-
id: "3",
|
|
807
|
-
title: "City Breaks",
|
|
808
|
-
description: "Urban exploration trips",
|
|
809
|
-
type: "result"
|
|
810
|
-
},
|
|
811
|
-
{
|
|
812
|
-
id: "4",
|
|
813
|
-
title: "Mountain Retreats",
|
|
814
|
-
description: "Peaceful mountain getaways",
|
|
815
|
-
type: "result"
|
|
816
|
-
},
|
|
817
|
-
{
|
|
818
|
-
id: "5",
|
|
819
|
-
title: "Cultural Tours",
|
|
820
|
-
description: "Explore local culture and history",
|
|
821
|
-
type: "result"
|
|
822
|
-
}
|
|
823
|
-
];
|
|
824
|
-
const handleSearch = async (query) => {
|
|
825
|
-
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
826
|
-
if (!query.trim()) {
|
|
827
|
-
return emptyStateBehaviour === "show-all-results" ? mockSearchResults : [];
|
|
828
|
-
}
|
|
829
|
-
return mockSearchResults.filter(
|
|
830
|
-
(result) => result.title.toLowerCase().includes(query.toLowerCase()) || result.description.toLowerCase().includes(query.toLowerCase())
|
|
831
|
-
);
|
|
832
|
-
};
|
|
833
|
-
const handleResultSelect = (result) => {
|
|
834
|
-
console.log("Selected result:", result);
|
|
835
|
-
};
|
|
836
|
-
const getPlaceholder = () => {
|
|
837
|
-
if (emptyStateBehaviour === "hide-until-min-chars") {
|
|
838
|
-
return `Type at least ${minQueryLength} characters...`;
|
|
839
|
-
}
|
|
840
|
-
return "Search destinations...";
|
|
841
|
-
};
|
|
842
|
-
return /* @__PURE__ */ jsx(
|
|
843
|
-
AdvancedSearchProvider,
|
|
844
|
-
{
|
|
845
|
-
onSearch: handleSearch,
|
|
846
|
-
onResultSelect: handleResultSelect,
|
|
847
|
-
debounceMs: 300,
|
|
848
|
-
minQueryLength,
|
|
849
|
-
emptyStateBehaviour,
|
|
850
|
-
initialResults: emptyStateBehaviour === "show-all-results" ? mockSearchResults : [],
|
|
851
|
-
children: /* @__PURE__ */ jsxs(AdvancedSearchBar, { children: [
|
|
852
|
-
useCustomTrigger ? /* @__PURE__ */ jsx(SearchTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", className: "w-full justify-start", children: [
|
|
853
|
-
/* @__PURE__ */ jsx(Search, { className: "mr-2 h-4 w-4" }),
|
|
854
|
-
"Click to search..."
|
|
855
|
-
] }) }) : /* @__PURE__ */ jsx(
|
|
856
|
-
SearchInput,
|
|
857
|
-
{
|
|
858
|
-
placeholder: getPlaceholder(),
|
|
859
|
-
size,
|
|
860
|
-
variant,
|
|
861
|
-
showSearchIcon: true,
|
|
862
|
-
showClearButton: true
|
|
863
|
-
}
|
|
864
|
-
),
|
|
865
|
-
/* @__PURE__ */ jsx(
|
|
866
|
-
SearchResults,
|
|
867
|
-
{
|
|
868
|
-
size: size === "sm" ? "sm" : size === "lg" ? "lg" : "md",
|
|
869
|
-
showEmptyState: true,
|
|
870
|
-
emptyStateMessage: "No destinations found.",
|
|
871
|
-
showLoadingState: true,
|
|
872
|
-
loadingMessage: "Searching destinations..."
|
|
873
|
-
}
|
|
874
|
-
)
|
|
875
|
-
] })
|
|
876
|
-
}
|
|
877
|
-
);
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
// src/components/calendar/index.tsx
|
|
881
|
-
import { Button as Button2, buttonVariants } from "@foundrykit/primitives";
|
|
882
|
-
import { cn as cn2 } from "@foundrykit/utils";
|
|
7
|
+
Form,
|
|
8
|
+
FormControl,
|
|
9
|
+
FormDescription,
|
|
10
|
+
FormField,
|
|
11
|
+
FormItem,
|
|
12
|
+
FormLabel,
|
|
13
|
+
FormMessage,
|
|
14
|
+
useFormField
|
|
15
|
+
} from "./chunk-SFM7ZMG2.js";
|
|
883
16
|
import {
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
17
|
+
InputOTP,
|
|
18
|
+
InputOTPGroup,
|
|
19
|
+
InputOTPSeparator,
|
|
20
|
+
InputOTPSlot
|
|
21
|
+
} from "./chunk-KQZEF7PS.js";
|
|
889
22
|
import {
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
captionLayout = "label",
|
|
899
|
-
buttonVariant = "ghost",
|
|
900
|
-
formatters,
|
|
901
|
-
components,
|
|
902
|
-
...props
|
|
903
|
-
}) {
|
|
904
|
-
const defaultClassNames = getDefaultClassNames();
|
|
905
|
-
return /* @__PURE__ */ jsx2(
|
|
906
|
-
DayPicker,
|
|
907
|
-
{
|
|
908
|
-
showOutsideDays,
|
|
909
|
-
className: cn2(
|
|
910
|
-
"bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
911
|
-
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
912
|
-
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
913
|
-
className
|
|
914
|
-
),
|
|
915
|
-
captionLayout,
|
|
916
|
-
formatters: {
|
|
917
|
-
formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
|
|
918
|
-
...formatters
|
|
919
|
-
},
|
|
920
|
-
classNames: {
|
|
921
|
-
root: cn2("w-fit", defaultClassNames.root),
|
|
922
|
-
months: cn2(
|
|
923
|
-
"relative flex flex-col gap-4 md:flex-row",
|
|
924
|
-
defaultClassNames.months
|
|
925
|
-
),
|
|
926
|
-
month: cn2("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
927
|
-
nav: cn2(
|
|
928
|
-
"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
|
|
929
|
-
defaultClassNames.nav
|
|
930
|
-
),
|
|
931
|
-
button_previous: cn2(
|
|
932
|
-
buttonVariants({ variant: buttonVariant }),
|
|
933
|
-
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
934
|
-
defaultClassNames.button_previous
|
|
935
|
-
),
|
|
936
|
-
button_next: cn2(
|
|
937
|
-
buttonVariants({ variant: buttonVariant }),
|
|
938
|
-
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
939
|
-
defaultClassNames.button_next
|
|
940
|
-
),
|
|
941
|
-
month_caption: cn2(
|
|
942
|
-
"flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
|
|
943
|
-
defaultClassNames.month_caption
|
|
944
|
-
),
|
|
945
|
-
dropdowns: cn2(
|
|
946
|
-
"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
|
|
947
|
-
defaultClassNames.dropdowns
|
|
948
|
-
),
|
|
949
|
-
dropdown_root: cn2(
|
|
950
|
-
"has-focus:border-ring border-input has-focus:ring-ring/50 relative rounded-md border shadow-xs has-focus:ring-[3px]",
|
|
951
|
-
defaultClassNames.dropdown_root
|
|
952
|
-
),
|
|
953
|
-
dropdown: cn2(
|
|
954
|
-
"bg-popover absolute inset-0 opacity-0",
|
|
955
|
-
defaultClassNames.dropdown
|
|
956
|
-
),
|
|
957
|
-
caption_label: cn2(
|
|
958
|
-
"font-medium select-none",
|
|
959
|
-
captionLayout === "label" ? "text-sm" : "[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5",
|
|
960
|
-
defaultClassNames.caption_label
|
|
961
|
-
),
|
|
962
|
-
table: "w-full border-collapse",
|
|
963
|
-
weekdays: cn2("flex", defaultClassNames.weekdays),
|
|
964
|
-
weekday: cn2(
|
|
965
|
-
"text-muted-foreground flex-1 rounded-md text-[0.8rem] font-normal select-none",
|
|
966
|
-
defaultClassNames.weekday
|
|
967
|
-
),
|
|
968
|
-
week: cn2("mt-2 flex w-full", defaultClassNames.week),
|
|
969
|
-
week_number_header: cn2(
|
|
970
|
-
"w-(--cell-size) select-none",
|
|
971
|
-
defaultClassNames.week_number_header
|
|
972
|
-
),
|
|
973
|
-
week_number: cn2(
|
|
974
|
-
"text-muted-foreground text-[0.8rem] select-none",
|
|
975
|
-
defaultClassNames.week_number
|
|
976
|
-
),
|
|
977
|
-
day: cn2(
|
|
978
|
-
"group/day relative aspect-square h-full w-full p-0 text-center select-none [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",
|
|
979
|
-
defaultClassNames.day
|
|
980
|
-
),
|
|
981
|
-
range_start: cn2(
|
|
982
|
-
"bg-accent rounded-l-md",
|
|
983
|
-
defaultClassNames.range_start
|
|
984
|
-
),
|
|
985
|
-
range_middle: cn2("rounded-none", defaultClassNames.range_middle),
|
|
986
|
-
range_end: cn2("bg-accent rounded-r-md", defaultClassNames.range_end),
|
|
987
|
-
today: cn2(
|
|
988
|
-
"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
|
|
989
|
-
defaultClassNames.today
|
|
990
|
-
),
|
|
991
|
-
outside: cn2(
|
|
992
|
-
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
993
|
-
defaultClassNames.outside
|
|
994
|
-
),
|
|
995
|
-
disabled: cn2(
|
|
996
|
-
"text-muted-foreground opacity-50",
|
|
997
|
-
defaultClassNames.disabled
|
|
998
|
-
),
|
|
999
|
-
hidden: cn2("invisible", defaultClassNames.hidden),
|
|
1000
|
-
...classNames
|
|
1001
|
-
},
|
|
1002
|
-
components: {
|
|
1003
|
-
Root: ({ className: className2, rootRef, ...props2 }) => {
|
|
1004
|
-
return /* @__PURE__ */ jsx2(
|
|
1005
|
-
"div",
|
|
1006
|
-
{
|
|
1007
|
-
"data-slot": "calendar",
|
|
1008
|
-
ref: rootRef,
|
|
1009
|
-
className: cn2(className2),
|
|
1010
|
-
...props2
|
|
1011
|
-
}
|
|
1012
|
-
);
|
|
1013
|
-
},
|
|
1014
|
-
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
1015
|
-
if (orientation === "left") {
|
|
1016
|
-
return /* @__PURE__ */ jsx2(ChevronLeftIcon, { className: cn2("size-4", className2), ...props2 });
|
|
1017
|
-
}
|
|
1018
|
-
if (orientation === "right") {
|
|
1019
|
-
return /* @__PURE__ */ jsx2(
|
|
1020
|
-
ChevronRightIcon,
|
|
1021
|
-
{
|
|
1022
|
-
className: cn2("size-4", className2),
|
|
1023
|
-
...props2
|
|
1024
|
-
}
|
|
1025
|
-
);
|
|
1026
|
-
}
|
|
1027
|
-
return /* @__PURE__ */ jsx2(ChevronDownIcon, { className: cn2("size-4", className2), ...props2 });
|
|
1028
|
-
},
|
|
1029
|
-
DayButton: CalendarDayButton,
|
|
1030
|
-
WeekNumber: ({ children, ...props2 }) => {
|
|
1031
|
-
return /* @__PURE__ */ jsx2("td", { ...props2, children: /* @__PURE__ */ jsx2("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
|
|
1032
|
-
},
|
|
1033
|
-
...components
|
|
1034
|
-
},
|
|
1035
|
-
...props
|
|
1036
|
-
}
|
|
1037
|
-
);
|
|
1038
|
-
}
|
|
1039
|
-
function CalendarDayButton({
|
|
1040
|
-
className,
|
|
1041
|
-
day,
|
|
1042
|
-
modifiers,
|
|
1043
|
-
...props
|
|
1044
|
-
}) {
|
|
1045
|
-
const defaultClassNames = getDefaultClassNames();
|
|
1046
|
-
const ref = React2.useRef(null);
|
|
1047
|
-
React2.useEffect(() => {
|
|
1048
|
-
if (modifiers.focused) ref.current?.focus();
|
|
1049
|
-
}, [modifiers.focused]);
|
|
1050
|
-
return /* @__PURE__ */ jsx2(
|
|
1051
|
-
Button2,
|
|
1052
|
-
{
|
|
1053
|
-
ref,
|
|
1054
|
-
variant: "ghost",
|
|
1055
|
-
size: "icon",
|
|
1056
|
-
"data-day": day.date.toLocaleDateString(),
|
|
1057
|
-
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
1058
|
-
"data-range-start": modifiers.range_start,
|
|
1059
|
-
"data-range-end": modifiers.range_end,
|
|
1060
|
-
"data-range-middle": modifiers.range_middle,
|
|
1061
|
-
className: cn2(
|
|
1062
|
-
"data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
|
|
1063
|
-
defaultClassNames.day,
|
|
1064
|
-
className
|
|
1065
|
-
),
|
|
1066
|
-
...props
|
|
1067
|
-
}
|
|
1068
|
-
);
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
// src/components/carousel/index.tsx
|
|
1072
|
-
import { Button as Button3 } from "@foundrykit/primitives";
|
|
1073
|
-
import { cn as cn3 } from "@foundrykit/utils";
|
|
1074
|
-
import useEmblaCarousel from "embla-carousel-react";
|
|
1075
|
-
import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";
|
|
1076
|
-
import * as React3 from "react";
|
|
1077
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1078
|
-
var CarouselContext = React3.createContext(null);
|
|
1079
|
-
function useCarousel() {
|
|
1080
|
-
const context = React3.useContext(CarouselContext);
|
|
1081
|
-
if (!context) {
|
|
1082
|
-
throw new Error("useCarousel must be used within a <Carousel />");
|
|
1083
|
-
}
|
|
1084
|
-
return context;
|
|
1085
|
-
}
|
|
1086
|
-
function Carousel({
|
|
1087
|
-
orientation = "horizontal",
|
|
1088
|
-
opts,
|
|
1089
|
-
setApi,
|
|
1090
|
-
plugins,
|
|
1091
|
-
className,
|
|
1092
|
-
children,
|
|
1093
|
-
...props
|
|
1094
|
-
}) {
|
|
1095
|
-
const [carouselRef, api] = useEmblaCarousel(
|
|
1096
|
-
{
|
|
1097
|
-
...opts,
|
|
1098
|
-
axis: orientation === "horizontal" ? "x" : "y"
|
|
1099
|
-
},
|
|
1100
|
-
plugins
|
|
1101
|
-
);
|
|
1102
|
-
const [canScrollPrev, setCanScrollPrev] = React3.useState(false);
|
|
1103
|
-
const [canScrollNext, setCanScrollNext] = React3.useState(false);
|
|
1104
|
-
const onSelect = React3.useCallback((api2) => {
|
|
1105
|
-
if (!api2) return;
|
|
1106
|
-
setCanScrollPrev(api2.canScrollPrev());
|
|
1107
|
-
setCanScrollNext(api2.canScrollNext());
|
|
1108
|
-
}, []);
|
|
1109
|
-
const scrollPrev = React3.useCallback(() => {
|
|
1110
|
-
api?.scrollPrev();
|
|
1111
|
-
}, [api]);
|
|
1112
|
-
const scrollNext = React3.useCallback(() => {
|
|
1113
|
-
api?.scrollNext();
|
|
1114
|
-
}, [api]);
|
|
1115
|
-
const handleKeyDown = React3.useCallback(
|
|
1116
|
-
(event) => {
|
|
1117
|
-
if (event.key === "ArrowLeft") {
|
|
1118
|
-
event.preventDefault();
|
|
1119
|
-
scrollPrev();
|
|
1120
|
-
} else if (event.key === "ArrowRight") {
|
|
1121
|
-
event.preventDefault();
|
|
1122
|
-
scrollNext();
|
|
1123
|
-
}
|
|
1124
|
-
},
|
|
1125
|
-
[scrollPrev, scrollNext]
|
|
1126
|
-
);
|
|
1127
|
-
React3.useEffect(() => {
|
|
1128
|
-
if (!api || !setApi) return;
|
|
1129
|
-
setApi(api);
|
|
1130
|
-
}, [api, setApi]);
|
|
1131
|
-
React3.useEffect(() => {
|
|
1132
|
-
if (!api) return;
|
|
1133
|
-
onSelect(api);
|
|
1134
|
-
api.on("reInit", onSelect);
|
|
1135
|
-
api.on("select", onSelect);
|
|
1136
|
-
return () => {
|
|
1137
|
-
api?.off("select", onSelect);
|
|
1138
|
-
};
|
|
1139
|
-
}, [api, onSelect]);
|
|
1140
|
-
return /* @__PURE__ */ jsx3(
|
|
1141
|
-
CarouselContext.Provider,
|
|
1142
|
-
{
|
|
1143
|
-
value: {
|
|
1144
|
-
carouselRef,
|
|
1145
|
-
api,
|
|
1146
|
-
opts,
|
|
1147
|
-
orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
1148
|
-
scrollPrev,
|
|
1149
|
-
scrollNext,
|
|
1150
|
-
canScrollPrev,
|
|
1151
|
-
canScrollNext
|
|
1152
|
-
},
|
|
1153
|
-
children: /* @__PURE__ */ jsx3(
|
|
1154
|
-
"div",
|
|
1155
|
-
{
|
|
1156
|
-
"data-slot": "carousel",
|
|
1157
|
-
onKeyDownCapture: handleKeyDown,
|
|
1158
|
-
className: cn3("relative", className),
|
|
1159
|
-
role: "region",
|
|
1160
|
-
"aria-roledescription": "carousel",
|
|
1161
|
-
...props,
|
|
1162
|
-
children
|
|
1163
|
-
}
|
|
1164
|
-
)
|
|
1165
|
-
}
|
|
1166
|
-
);
|
|
1167
|
-
}
|
|
1168
|
-
function CarouselContent({ className, ...props }) {
|
|
1169
|
-
const { carouselRef, orientation } = useCarousel();
|
|
1170
|
-
return /* @__PURE__ */ jsx3(
|
|
1171
|
-
"div",
|
|
1172
|
-
{
|
|
1173
|
-
ref: carouselRef,
|
|
1174
|
-
"data-slot": "carousel-content",
|
|
1175
|
-
className: "overflow-hidden",
|
|
1176
|
-
children: /* @__PURE__ */ jsx3(
|
|
1177
|
-
"div",
|
|
1178
|
-
{
|
|
1179
|
-
className: cn3(
|
|
1180
|
-
"flex",
|
|
1181
|
-
orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
|
|
1182
|
-
className
|
|
1183
|
-
),
|
|
1184
|
-
...props
|
|
1185
|
-
}
|
|
1186
|
-
)
|
|
1187
|
-
}
|
|
1188
|
-
);
|
|
1189
|
-
}
|
|
1190
|
-
function CarouselItem({ className, ...props }) {
|
|
1191
|
-
const { orientation } = useCarousel();
|
|
1192
|
-
return /* @__PURE__ */ jsx3(
|
|
1193
|
-
"div",
|
|
1194
|
-
{
|
|
1195
|
-
"data-slot": "carousel-item",
|
|
1196
|
-
role: "group",
|
|
1197
|
-
"aria-roledescription": "slide",
|
|
1198
|
-
className: cn3(
|
|
1199
|
-
"min-w-0 shrink-0 grow-0 basis-full",
|
|
1200
|
-
orientation === "horizontal" ? "pl-4" : "pt-4",
|
|
1201
|
-
className
|
|
1202
|
-
),
|
|
1203
|
-
...props
|
|
1204
|
-
}
|
|
1205
|
-
);
|
|
1206
|
-
}
|
|
1207
|
-
function CarouselPrevious({
|
|
1208
|
-
className,
|
|
1209
|
-
variant = "outline",
|
|
1210
|
-
size = "icon",
|
|
1211
|
-
...props
|
|
1212
|
-
}) {
|
|
1213
|
-
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
1214
|
-
return /* @__PURE__ */ jsxs2(
|
|
1215
|
-
Button3,
|
|
1216
|
-
{
|
|
1217
|
-
"data-slot": "carousel-previous",
|
|
1218
|
-
variant,
|
|
1219
|
-
size,
|
|
1220
|
-
className: cn3(
|
|
1221
|
-
"absolute size-8 rounded-full",
|
|
1222
|
-
orientation === "horizontal" ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
1223
|
-
className
|
|
1224
|
-
),
|
|
1225
|
-
disabled: !canScrollPrev,
|
|
1226
|
-
onClick: scrollPrev,
|
|
1227
|
-
...props,
|
|
1228
|
-
children: [
|
|
1229
|
-
/* @__PURE__ */ jsx3(ArrowLeftIcon, {}),
|
|
1230
|
-
/* @__PURE__ */ jsx3("span", { className: "sr-only", children: "Previous slide" })
|
|
1231
|
-
]
|
|
1232
|
-
}
|
|
1233
|
-
);
|
|
1234
|
-
}
|
|
1235
|
-
function CarouselNext({
|
|
1236
|
-
className,
|
|
1237
|
-
variant = "outline",
|
|
1238
|
-
size = "icon",
|
|
1239
|
-
...props
|
|
1240
|
-
}) {
|
|
1241
|
-
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
1242
|
-
return /* @__PURE__ */ jsxs2(
|
|
1243
|
-
Button3,
|
|
1244
|
-
{
|
|
1245
|
-
"data-slot": "carousel-next",
|
|
1246
|
-
variant,
|
|
1247
|
-
size,
|
|
1248
|
-
className: cn3(
|
|
1249
|
-
"absolute size-8 rounded-full",
|
|
1250
|
-
orientation === "horizontal" ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
1251
|
-
className
|
|
1252
|
-
),
|
|
1253
|
-
disabled: !canScrollNext,
|
|
1254
|
-
onClick: scrollNext,
|
|
1255
|
-
...props,
|
|
1256
|
-
children: [
|
|
1257
|
-
/* @__PURE__ */ jsx3(ArrowRightIcon, {}),
|
|
1258
|
-
/* @__PURE__ */ jsx3("span", { className: "sr-only", children: "Next slide" })
|
|
1259
|
-
]
|
|
1260
|
-
}
|
|
1261
|
-
);
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
// src/components/chart/index.tsx
|
|
1265
|
-
import { cn as cn4 } from "@foundrykit/utils";
|
|
1266
|
-
import * as React4 from "react";
|
|
1267
|
-
import * as RechartsPrimitive from "recharts";
|
|
1268
|
-
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1269
|
-
var THEMES = { light: "", dark: ".dark" };
|
|
1270
|
-
var ChartContext = React4.createContext(null);
|
|
1271
|
-
function useChart() {
|
|
1272
|
-
const context = React4.useContext(ChartContext);
|
|
1273
|
-
if (!context) {
|
|
1274
|
-
throw new Error("useChart must be used within a <ChartContainer />");
|
|
1275
|
-
}
|
|
1276
|
-
return context;
|
|
1277
|
-
}
|
|
1278
|
-
function ChartContainer({
|
|
1279
|
-
id,
|
|
1280
|
-
className,
|
|
1281
|
-
children,
|
|
1282
|
-
config,
|
|
1283
|
-
...props
|
|
1284
|
-
}) {
|
|
1285
|
-
const uniqueId = React4.useId();
|
|
1286
|
-
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
1287
|
-
return /* @__PURE__ */ jsx4(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxs3(
|
|
1288
|
-
"div",
|
|
1289
|
-
{
|
|
1290
|
-
"data-slot": "chart",
|
|
1291
|
-
"data-chart": chartId,
|
|
1292
|
-
className: cn4(
|
|
1293
|
-
"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
|
|
1294
|
-
className
|
|
1295
|
-
),
|
|
1296
|
-
...props,
|
|
1297
|
-
children: [
|
|
1298
|
-
/* @__PURE__ */ jsx4(ChartStyle, { id: chartId, config }),
|
|
1299
|
-
/* @__PURE__ */ jsx4(RechartsPrimitive.ResponsiveContainer, { children })
|
|
1300
|
-
]
|
|
1301
|
-
}
|
|
1302
|
-
) });
|
|
1303
|
-
}
|
|
1304
|
-
function ChartStyle({ id, config }) {
|
|
1305
|
-
const colorConfig = Object.entries(config).filter(
|
|
1306
|
-
([, itemConfig]) => itemConfig.theme || itemConfig.color
|
|
1307
|
-
);
|
|
1308
|
-
if (!colorConfig.length) {
|
|
1309
|
-
return null;
|
|
1310
|
-
}
|
|
1311
|
-
return /* @__PURE__ */ jsx4(
|
|
1312
|
-
"style",
|
|
1313
|
-
{
|
|
1314
|
-
dangerouslySetInnerHTML: {
|
|
1315
|
-
__html: Object.entries(THEMES).map(
|
|
1316
|
-
([theme, prefix]) => `
|
|
1317
|
-
${prefix} [data-chart=${id}] {
|
|
1318
|
-
${colorConfig.map(([key, itemConfig]) => {
|
|
1319
|
-
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
1320
|
-
return color ? ` --color-${key}: ${color};` : null;
|
|
1321
|
-
}).join("\n")}
|
|
1322
|
-
}
|
|
1323
|
-
`
|
|
1324
|
-
).join("\n")
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
);
|
|
1328
|
-
}
|
|
1329
|
-
var ChartTooltip = RechartsPrimitive.Tooltip;
|
|
1330
|
-
function ChartTooltipContent({
|
|
1331
|
-
active,
|
|
1332
|
-
payload,
|
|
1333
|
-
className,
|
|
1334
|
-
indicator = "dot",
|
|
1335
|
-
hideLabel = false,
|
|
1336
|
-
hideIndicator = false,
|
|
1337
|
-
label,
|
|
1338
|
-
labelFormatter,
|
|
1339
|
-
labelClassName,
|
|
1340
|
-
formatter,
|
|
1341
|
-
color,
|
|
1342
|
-
nameKey,
|
|
1343
|
-
labelKey
|
|
1344
|
-
}) {
|
|
1345
|
-
const { config } = useChart();
|
|
1346
|
-
const tooltipLabel = React4.useMemo(() => {
|
|
1347
|
-
if (hideLabel || !payload?.length) {
|
|
1348
|
-
return null;
|
|
1349
|
-
}
|
|
1350
|
-
const [item] = payload;
|
|
1351
|
-
const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
|
|
1352
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
1353
|
-
const value = !labelKey && typeof label === "string" ? config[label]?.label || label : itemConfig?.label;
|
|
1354
|
-
if (labelFormatter) {
|
|
1355
|
-
return /* @__PURE__ */ jsx4("div", { className: cn4("font-medium", labelClassName), children: labelFormatter(value, payload) });
|
|
1356
|
-
}
|
|
1357
|
-
if (!value) {
|
|
1358
|
-
return null;
|
|
1359
|
-
}
|
|
1360
|
-
return /* @__PURE__ */ jsx4("div", { className: cn4("font-medium", labelClassName), children: value });
|
|
1361
|
-
}, [
|
|
1362
|
-
label,
|
|
1363
|
-
labelFormatter,
|
|
1364
|
-
payload,
|
|
1365
|
-
hideLabel,
|
|
1366
|
-
labelClassName,
|
|
1367
|
-
config,
|
|
1368
|
-
labelKey
|
|
1369
|
-
]);
|
|
1370
|
-
if (!active || !payload?.length) {
|
|
1371
|
-
return null;
|
|
1372
|
-
}
|
|
1373
|
-
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
1374
|
-
return /* @__PURE__ */ jsxs3(
|
|
1375
|
-
"div",
|
|
1376
|
-
{
|
|
1377
|
-
"data-slot": "chart-tooltip-content",
|
|
1378
|
-
className: cn4(
|
|
1379
|
-
"border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
|
|
1380
|
-
className
|
|
1381
|
-
),
|
|
1382
|
-
children: [
|
|
1383
|
-
!nestLabel ? tooltipLabel : null,
|
|
1384
|
-
/* @__PURE__ */ jsx4("div", { className: "grid gap-1.5", children: payload.map((item, index) => {
|
|
1385
|
-
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
1386
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
1387
|
-
const indicatorColor = color || item.payload.fill || item.color;
|
|
1388
|
-
return /* @__PURE__ */ jsx4(
|
|
1389
|
-
"div",
|
|
1390
|
-
{
|
|
1391
|
-
className: cn4(
|
|
1392
|
-
"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
|
|
1393
|
-
indicator === "dot" && "items-center"
|
|
1394
|
-
),
|
|
1395
|
-
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1396
|
-
itemConfig?.icon ? /* @__PURE__ */ jsx4(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsx4(
|
|
1397
|
-
"div",
|
|
1398
|
-
{
|
|
1399
|
-
className: cn4(
|
|
1400
|
-
"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
|
|
1401
|
-
{
|
|
1402
|
-
"h-2.5 w-2.5": indicator === "dot",
|
|
1403
|
-
"w-1": indicator === "line",
|
|
1404
|
-
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
1405
|
-
"my-0.5": nestLabel && indicator === "dashed"
|
|
1406
|
-
}
|
|
1407
|
-
),
|
|
1408
|
-
style: {
|
|
1409
|
-
"--color-bg": indicatorColor,
|
|
1410
|
-
"--color-border": indicatorColor
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
),
|
|
1414
|
-
/* @__PURE__ */ jsxs3(
|
|
1415
|
-
"div",
|
|
1416
|
-
{
|
|
1417
|
-
className: cn4(
|
|
1418
|
-
"flex flex-1 justify-between leading-none",
|
|
1419
|
-
nestLabel ? "items-end" : "items-center"
|
|
1420
|
-
),
|
|
1421
|
-
children: [
|
|
1422
|
-
/* @__PURE__ */ jsxs3("div", { className: "grid gap-1.5", children: [
|
|
1423
|
-
nestLabel ? tooltipLabel : null,
|
|
1424
|
-
/* @__PURE__ */ jsx4("span", { className: "text-muted-foreground", children: itemConfig?.label || item.name })
|
|
1425
|
-
] }),
|
|
1426
|
-
item.value && /* @__PURE__ */ jsx4("span", { className: "text-foreground font-mono font-medium tabular-nums", children: item.value.toLocaleString() })
|
|
1427
|
-
]
|
|
1428
|
-
}
|
|
1429
|
-
)
|
|
1430
|
-
] })
|
|
1431
|
-
},
|
|
1432
|
-
item.dataKey
|
|
1433
|
-
);
|
|
1434
|
-
}) })
|
|
1435
|
-
]
|
|
1436
|
-
}
|
|
1437
|
-
);
|
|
1438
|
-
}
|
|
1439
|
-
var ChartLegend = RechartsPrimitive.Legend;
|
|
1440
|
-
function ChartLegendContent({
|
|
1441
|
-
className,
|
|
1442
|
-
hideIcon = false,
|
|
1443
|
-
payload,
|
|
1444
|
-
verticalAlign = "bottom",
|
|
1445
|
-
nameKey
|
|
1446
|
-
}) {
|
|
1447
|
-
const { config } = useChart();
|
|
1448
|
-
if (!payload?.length) {
|
|
1449
|
-
return null;
|
|
1450
|
-
}
|
|
1451
|
-
return /* @__PURE__ */ jsx4(
|
|
1452
|
-
"div",
|
|
1453
|
-
{
|
|
1454
|
-
"data-slot": "chart-legend-content",
|
|
1455
|
-
className: cn4(
|
|
1456
|
-
"flex items-center justify-center gap-4",
|
|
1457
|
-
verticalAlign === "top" ? "pb-3" : "pt-3",
|
|
1458
|
-
className
|
|
1459
|
-
),
|
|
1460
|
-
children: payload.map((item) => {
|
|
1461
|
-
const key = `${nameKey || item.dataKey || "value"}`;
|
|
1462
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
1463
|
-
return /* @__PURE__ */ jsxs3(
|
|
1464
|
-
"div",
|
|
1465
|
-
{
|
|
1466
|
-
className: cn4(
|
|
1467
|
-
"[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"
|
|
1468
|
-
),
|
|
1469
|
-
children: [
|
|
1470
|
-
itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx4(itemConfig.icon, {}) : /* @__PURE__ */ jsx4(
|
|
1471
|
-
"div",
|
|
1472
|
-
{
|
|
1473
|
-
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
1474
|
-
style: { backgroundColor: item.color }
|
|
1475
|
-
}
|
|
1476
|
-
),
|
|
1477
|
-
itemConfig?.label
|
|
1478
|
-
]
|
|
1479
|
-
},
|
|
1480
|
-
item.value
|
|
1481
|
-
);
|
|
1482
|
-
})
|
|
1483
|
-
}
|
|
1484
|
-
);
|
|
1485
|
-
}
|
|
1486
|
-
function getPayloadConfigFromPayload(config, payload, key) {
|
|
1487
|
-
if (typeof payload !== "object" || payload === null) {
|
|
1488
|
-
return void 0;
|
|
1489
|
-
}
|
|
1490
|
-
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
1491
|
-
let configLabelKey = key;
|
|
1492
|
-
if (key in payload && typeof payload[key] === "string") {
|
|
1493
|
-
configLabelKey = payload[key];
|
|
1494
|
-
} else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
|
|
1495
|
-
configLabelKey = payloadPayload[key];
|
|
1496
|
-
}
|
|
1497
|
-
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
|
-
// src/components/combobox/index.tsx
|
|
23
|
+
Pagination,
|
|
24
|
+
PaginationContent,
|
|
25
|
+
PaginationEllipsis,
|
|
26
|
+
PaginationItem,
|
|
27
|
+
PaginationLink,
|
|
28
|
+
PaginationNext,
|
|
29
|
+
PaginationPrevious
|
|
30
|
+
} from "./chunk-TLQQZJUR.js";
|
|
1501
31
|
import {
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
PopoverContent,
|
|
1505
|
-
PopoverTrigger
|
|
1506
|
-
} from "@foundrykit/primitives";
|
|
1507
|
-
import { cn as cn6 } from "@foundrykit/utils";
|
|
1508
|
-
import { CheckIcon, ChevronsUpDownIcon } from "lucide-react";
|
|
1509
|
-
import * as React5 from "react";
|
|
1510
|
-
|
|
1511
|
-
// src/components/command/index.tsx
|
|
32
|
+
SearchBar
|
|
33
|
+
} from "./chunk-EDNWBEKV.js";
|
|
1512
34
|
import {
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
DialogDescription,
|
|
1516
|
-
DialogHeader,
|
|
1517
|
-
DialogTitle
|
|
1518
|
-
} from "@foundrykit/primitives";
|
|
1519
|
-
import { cn as cn5 } from "@foundrykit/utils";
|
|
1520
|
-
import { Command as CommandPrimitive } from "cmdk";
|
|
1521
|
-
import { SearchIcon } from "lucide-react";
|
|
1522
|
-
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1523
|
-
function Command({
|
|
1524
|
-
className,
|
|
1525
|
-
...props
|
|
1526
|
-
}) {
|
|
1527
|
-
return /* @__PURE__ */ jsx5(
|
|
1528
|
-
CommandPrimitive,
|
|
1529
|
-
{
|
|
1530
|
-
"data-slot": "command",
|
|
1531
|
-
className: cn5(
|
|
1532
|
-
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
|
|
1533
|
-
className
|
|
1534
|
-
),
|
|
1535
|
-
...props
|
|
1536
|
-
}
|
|
1537
|
-
);
|
|
1538
|
-
}
|
|
1539
|
-
function CommandDialog({
|
|
1540
|
-
title = "Command Palette",
|
|
1541
|
-
description = "Search for a command to run...",
|
|
1542
|
-
children,
|
|
1543
|
-
className,
|
|
1544
|
-
showCloseButton = true,
|
|
1545
|
-
...props
|
|
1546
|
-
}) {
|
|
1547
|
-
return /* @__PURE__ */ jsxs4(Dialog, { ...props, children: [
|
|
1548
|
-
/* @__PURE__ */ jsxs4(DialogHeader, { className: "sr-only", children: [
|
|
1549
|
-
/* @__PURE__ */ jsx5(DialogTitle, { children: title }),
|
|
1550
|
-
/* @__PURE__ */ jsx5(DialogDescription, { children: description })
|
|
1551
|
-
] }),
|
|
1552
|
-
/* @__PURE__ */ jsx5(
|
|
1553
|
-
DialogContent,
|
|
1554
|
-
{
|
|
1555
|
-
className: cn5("overflow-hidden p-0", className),
|
|
1556
|
-
showCloseButton,
|
|
1557
|
-
children: /* @__PURE__ */ jsx5(Command, { className: "[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children })
|
|
1558
|
-
}
|
|
1559
|
-
)
|
|
1560
|
-
] });
|
|
1561
|
-
}
|
|
1562
|
-
function CommandInput({
|
|
1563
|
-
className,
|
|
1564
|
-
...props
|
|
1565
|
-
}) {
|
|
1566
|
-
return /* @__PURE__ */ jsxs4(
|
|
1567
|
-
"div",
|
|
1568
|
-
{
|
|
1569
|
-
"data-slot": "command-input-wrapper",
|
|
1570
|
-
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
1571
|
-
children: [
|
|
1572
|
-
/* @__PURE__ */ jsx5(SearchIcon, { className: "size-4 shrink-0 opacity-50" }),
|
|
1573
|
-
/* @__PURE__ */ jsx5(
|
|
1574
|
-
CommandPrimitive.Input,
|
|
1575
|
-
{
|
|
1576
|
-
"data-slot": "command-input",
|
|
1577
|
-
className: cn5(
|
|
1578
|
-
"placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
1579
|
-
className
|
|
1580
|
-
),
|
|
1581
|
-
...props
|
|
1582
|
-
}
|
|
1583
|
-
)
|
|
1584
|
-
]
|
|
1585
|
-
}
|
|
1586
|
-
);
|
|
1587
|
-
}
|
|
1588
|
-
function CommandList({
|
|
1589
|
-
className,
|
|
1590
|
-
...props
|
|
1591
|
-
}) {
|
|
1592
|
-
return /* @__PURE__ */ jsx5(
|
|
1593
|
-
CommandPrimitive.List,
|
|
1594
|
-
{
|
|
1595
|
-
"data-slot": "command-list",
|
|
1596
|
-
className: cn5(
|
|
1597
|
-
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
|
|
1598
|
-
className
|
|
1599
|
-
),
|
|
1600
|
-
...props
|
|
1601
|
-
}
|
|
1602
|
-
);
|
|
1603
|
-
}
|
|
1604
|
-
function CommandEmpty({
|
|
1605
|
-
...props
|
|
1606
|
-
}) {
|
|
1607
|
-
return /* @__PURE__ */ jsx5(
|
|
1608
|
-
CommandPrimitive.Empty,
|
|
1609
|
-
{
|
|
1610
|
-
"data-slot": "command-empty",
|
|
1611
|
-
className: "py-6 text-center text-sm",
|
|
1612
|
-
...props
|
|
1613
|
-
}
|
|
1614
|
-
);
|
|
1615
|
-
}
|
|
1616
|
-
function CommandGroup({
|
|
1617
|
-
className,
|
|
1618
|
-
...props
|
|
1619
|
-
}) {
|
|
1620
|
-
return /* @__PURE__ */ jsx5(
|
|
1621
|
-
CommandPrimitive.Group,
|
|
1622
|
-
{
|
|
1623
|
-
"data-slot": "command-group",
|
|
1624
|
-
className: cn5(
|
|
1625
|
-
"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
|
|
1626
|
-
className
|
|
1627
|
-
),
|
|
1628
|
-
...props
|
|
1629
|
-
}
|
|
1630
|
-
);
|
|
1631
|
-
}
|
|
1632
|
-
function CommandSeparator({
|
|
1633
|
-
className,
|
|
1634
|
-
...props
|
|
1635
|
-
}) {
|
|
1636
|
-
return /* @__PURE__ */ jsx5(
|
|
1637
|
-
CommandPrimitive.Separator,
|
|
1638
|
-
{
|
|
1639
|
-
"data-slot": "command-separator",
|
|
1640
|
-
className: cn5("bg-border -mx-1 h-px", className),
|
|
1641
|
-
...props
|
|
1642
|
-
}
|
|
1643
|
-
);
|
|
1644
|
-
}
|
|
1645
|
-
function CommandItem({
|
|
1646
|
-
className,
|
|
1647
|
-
...props
|
|
1648
|
-
}) {
|
|
1649
|
-
return /* @__PURE__ */ jsx5(
|
|
1650
|
-
CommandPrimitive.Item,
|
|
1651
|
-
{
|
|
1652
|
-
"data-slot": "command-item",
|
|
1653
|
-
className: cn5(
|
|
1654
|
-
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
1655
|
-
className
|
|
1656
|
-
),
|
|
1657
|
-
...props
|
|
1658
|
-
}
|
|
1659
|
-
);
|
|
1660
|
-
}
|
|
1661
|
-
function CommandShortcut({
|
|
1662
|
-
className,
|
|
1663
|
-
...props
|
|
1664
|
-
}) {
|
|
1665
|
-
return /* @__PURE__ */ jsx5(
|
|
1666
|
-
"span",
|
|
1667
|
-
{
|
|
1668
|
-
"data-slot": "command-shortcut",
|
|
1669
|
-
className: cn5(
|
|
1670
|
-
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
1671
|
-
className
|
|
1672
|
-
),
|
|
1673
|
-
...props
|
|
1674
|
-
}
|
|
1675
|
-
);
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1678
|
-
// src/components/combobox/index.tsx
|
|
1679
|
-
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1680
|
-
function Combobox({
|
|
1681
|
-
options,
|
|
1682
|
-
value,
|
|
1683
|
-
onValueChange,
|
|
1684
|
-
placeholder = "Select an option...",
|
|
1685
|
-
id,
|
|
1686
|
-
"aria-label": ariaLabel
|
|
1687
|
-
}) {
|
|
1688
|
-
const [open, setOpen] = React5.useState(false);
|
|
1689
|
-
const selected = options.find((option) => option.value === value);
|
|
1690
|
-
return /* @__PURE__ */ jsxs5(Popover, { open, onOpenChange: setOpen, children: [
|
|
1691
|
-
/* @__PURE__ */ jsx6(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(
|
|
1692
|
-
Button4,
|
|
1693
|
-
{
|
|
1694
|
-
"data-slot": "combobox-trigger",
|
|
1695
|
-
variant: "outline",
|
|
1696
|
-
role: "combobox",
|
|
1697
|
-
id,
|
|
1698
|
-
"aria-label": ariaLabel,
|
|
1699
|
-
"aria-expanded": open,
|
|
1700
|
-
className: "w-[200px] justify-between",
|
|
1701
|
-
children: [
|
|
1702
|
-
selected ? selected.label : placeholder,
|
|
1703
|
-
/* @__PURE__ */ jsx6(ChevronsUpDownIcon, { className: "ml-2 size-4 shrink-0 opacity-50" })
|
|
1704
|
-
]
|
|
1705
|
-
}
|
|
1706
|
-
) }),
|
|
1707
|
-
/* @__PURE__ */ jsx6(PopoverContent, { "data-slot": "combobox-content", className: "w-[200px] p-0", children: /* @__PURE__ */ jsxs5(Command, { children: [
|
|
1708
|
-
/* @__PURE__ */ jsx6(CommandInput, { placeholder, className: "h-9" }),
|
|
1709
|
-
/* @__PURE__ */ jsxs5(CommandList, { children: [
|
|
1710
|
-
/* @__PURE__ */ jsx6(CommandEmpty, { children: "No option found." }),
|
|
1711
|
-
/* @__PURE__ */ jsx6(CommandGroup, { children: options.map((option) => /* @__PURE__ */ jsxs5(
|
|
1712
|
-
CommandItem,
|
|
1713
|
-
{
|
|
1714
|
-
value: option.value,
|
|
1715
|
-
onSelect: (currentValue) => {
|
|
1716
|
-
onValueChange?.(currentValue === value ? "" : currentValue);
|
|
1717
|
-
setOpen(false);
|
|
1718
|
-
},
|
|
1719
|
-
children: [
|
|
1720
|
-
option.label,
|
|
1721
|
-
/* @__PURE__ */ jsx6(
|
|
1722
|
-
CheckIcon,
|
|
1723
|
-
{
|
|
1724
|
-
className: cn6(
|
|
1725
|
-
"ml-auto size-4",
|
|
1726
|
-
value === option.value ? "opacity-100" : "opacity-0"
|
|
1727
|
-
)
|
|
1728
|
-
}
|
|
1729
|
-
)
|
|
1730
|
-
]
|
|
1731
|
-
},
|
|
1732
|
-
option.value
|
|
1733
|
-
)) })
|
|
1734
|
-
] })
|
|
1735
|
-
] }) })
|
|
1736
|
-
] });
|
|
1737
|
-
}
|
|
1738
|
-
|
|
1739
|
-
// src/components/data-table/index.tsx
|
|
35
|
+
ThemeToggle
|
|
36
|
+
} from "./chunk-UE7CDYEN.js";
|
|
1740
37
|
import {
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
38
|
+
AdvancedSearchBar,
|
|
39
|
+
AdvancedSearchBarWrapper,
|
|
40
|
+
AdvancedSearchProvider,
|
|
41
|
+
SearchInput,
|
|
42
|
+
SearchItem,
|
|
43
|
+
SearchResults,
|
|
44
|
+
SearchSection,
|
|
45
|
+
SearchTrigger
|
|
46
|
+
} from "./chunk-P3GSYR7O.js";
|
|
1749
47
|
import {
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
function DataTable({
|
|
1759
|
-
columns,
|
|
1760
|
-
data
|
|
1761
|
-
}) {
|
|
1762
|
-
const [sorting, setSorting] = React6.useState([]);
|
|
1763
|
-
const table = useReactTable({
|
|
1764
|
-
data,
|
|
1765
|
-
columns,
|
|
1766
|
-
getCoreRowModel: getCoreRowModel(),
|
|
1767
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
1768
|
-
getSortedRowModel: getSortedRowModel(),
|
|
1769
|
-
onSortingChange: setSorting,
|
|
1770
|
-
state: {
|
|
1771
|
-
sorting
|
|
1772
|
-
}
|
|
1773
|
-
});
|
|
1774
|
-
return /* @__PURE__ */ jsxs6("div", { "data-slot": "data-table", className: "space-y-4", children: [
|
|
1775
|
-
/* @__PURE__ */ jsx7("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs6(Table, { children: [
|
|
1776
|
-
/* @__PURE__ */ jsx7(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx7(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx7(TableHead, { children: header.isPlaceholder ? null : flexRender(
|
|
1777
|
-
header.column.columnDef.header,
|
|
1778
|
-
header.getContext()
|
|
1779
|
-
) }, header.id)) }, headerGroup.id)) }),
|
|
1780
|
-
/* @__PURE__ */ jsx7(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx7(
|
|
1781
|
-
TableRow,
|
|
1782
|
-
{
|
|
1783
|
-
"data-state": row.getIsSelected() && "selected",
|
|
1784
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx7(TableCell, { children: flexRender(
|
|
1785
|
-
cell.column.columnDef.cell,
|
|
1786
|
-
cell.getContext()
|
|
1787
|
-
) }, cell.id))
|
|
1788
|
-
},
|
|
1789
|
-
row.id
|
|
1790
|
-
)) : /* @__PURE__ */ jsx7(TableRow, { children: /* @__PURE__ */ jsx7(
|
|
1791
|
-
TableCell,
|
|
1792
|
-
{
|
|
1793
|
-
colSpan: columns.length,
|
|
1794
|
-
className: "h-24 text-center",
|
|
1795
|
-
children: "No results."
|
|
1796
|
-
}
|
|
1797
|
-
) }) })
|
|
1798
|
-
] }) }),
|
|
1799
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-end gap-2", children: [
|
|
1800
|
-
/* @__PURE__ */ jsx7(
|
|
1801
|
-
Button5,
|
|
1802
|
-
{
|
|
1803
|
-
variant: "outline",
|
|
1804
|
-
size: "sm",
|
|
1805
|
-
onClick: () => table.previousPage(),
|
|
1806
|
-
disabled: !table.getCanPreviousPage(),
|
|
1807
|
-
children: "Previous"
|
|
1808
|
-
}
|
|
1809
|
-
),
|
|
1810
|
-
/* @__PURE__ */ jsx7(
|
|
1811
|
-
Button5,
|
|
1812
|
-
{
|
|
1813
|
-
variant: "outline",
|
|
1814
|
-
size: "sm",
|
|
1815
|
-
onClick: () => table.nextPage(),
|
|
1816
|
-
disabled: !table.getCanNextPage(),
|
|
1817
|
-
children: "Next"
|
|
1818
|
-
}
|
|
1819
|
-
)
|
|
1820
|
-
] })
|
|
1821
|
-
] });
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
// src/components/date-picker/index.tsx
|
|
1825
|
-
import { Button as Button6, Input as Input2 } from "@foundrykit/primitives";
|
|
1826
|
-
import { cn as cn7 } from "@foundrykit/utils";
|
|
1827
|
-
import { format } from "date-fns";
|
|
1828
|
-
import { Calendar as CalendarIcon } from "lucide-react";
|
|
1829
|
-
import * as React7 from "react";
|
|
1830
|
-
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1831
|
-
var WEEK_DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
1832
|
-
var DatePicker = React7.forwardRef(
|
|
1833
|
-
({ value, onValueChange, placeholder = "Pick a date", className, disabled }, ref) => {
|
|
1834
|
-
const [open, setOpen] = React7.useState(false);
|
|
1835
|
-
const [selectedDate, setSelectedDate] = React7.useState(
|
|
1836
|
-
value
|
|
1837
|
-
);
|
|
1838
|
-
React7.useEffect(() => {
|
|
1839
|
-
setSelectedDate(value);
|
|
1840
|
-
}, [value]);
|
|
1841
|
-
const containerRef = React7.useRef(null);
|
|
1842
|
-
const toggleRef = React7.useRef(null);
|
|
1843
|
-
React7.useImperativeHandle(
|
|
1844
|
-
ref,
|
|
1845
|
-
() => containerRef.current
|
|
1846
|
-
);
|
|
1847
|
-
React7.useEffect(() => {
|
|
1848
|
-
if (!open) return;
|
|
1849
|
-
const onPointerDown = (e) => {
|
|
1850
|
-
if (!containerRef.current?.contains(e.target)) setOpen(false);
|
|
1851
|
-
};
|
|
1852
|
-
const onKeyDown = (e) => {
|
|
1853
|
-
if (e.key === "Escape") {
|
|
1854
|
-
setOpen(false);
|
|
1855
|
-
toggleRef.current?.focus();
|
|
1856
|
-
}
|
|
1857
|
-
};
|
|
1858
|
-
document.addEventListener("mousedown", onPointerDown);
|
|
1859
|
-
document.addEventListener("keydown", onKeyDown);
|
|
1860
|
-
return () => {
|
|
1861
|
-
document.removeEventListener("mousedown", onPointerDown);
|
|
1862
|
-
document.removeEventListener("keydown", onKeyDown);
|
|
1863
|
-
};
|
|
1864
|
-
}, [open]);
|
|
1865
|
-
const handleDateSelect = (date) => {
|
|
1866
|
-
setSelectedDate(date);
|
|
1867
|
-
onValueChange?.(date);
|
|
1868
|
-
setOpen(false);
|
|
1869
|
-
toggleRef.current?.focus();
|
|
1870
|
-
};
|
|
1871
|
-
const handleInputChange = (e) => {
|
|
1872
|
-
const inputValue = e.target.value;
|
|
1873
|
-
if (inputValue) {
|
|
1874
|
-
const date = new Date(inputValue);
|
|
1875
|
-
if (!isNaN(date.getTime())) {
|
|
1876
|
-
setSelectedDate(date);
|
|
1877
|
-
onValueChange?.(date);
|
|
1878
|
-
}
|
|
1879
|
-
} else {
|
|
1880
|
-
setSelectedDate(void 0);
|
|
1881
|
-
onValueChange?.(void 0);
|
|
1882
|
-
}
|
|
1883
|
-
};
|
|
1884
|
-
const viewDate = selectedDate ?? /* @__PURE__ */ new Date();
|
|
1885
|
-
const currentMonth = viewDate.getMonth();
|
|
1886
|
-
const currentYear = viewDate.getFullYear();
|
|
1887
|
-
const monthLabel = format(viewDate, "MMMM yyyy");
|
|
1888
|
-
const calendarDays = React7.useMemo(() => {
|
|
1889
|
-
const firstDay = new Date(currentYear, currentMonth, 1);
|
|
1890
|
-
const daysInMonth = new Date(currentYear, currentMonth + 1, 0).getDate();
|
|
1891
|
-
const startingDayOfWeek = firstDay.getDay();
|
|
1892
|
-
const days = [];
|
|
1893
|
-
for (let i = 0; i < startingDayOfWeek; i++) days.push(null);
|
|
1894
|
-
for (let day = 1; day <= daysInMonth; day++) {
|
|
1895
|
-
days.push(new Date(currentYear, currentMonth, day));
|
|
1896
|
-
}
|
|
1897
|
-
return days;
|
|
1898
|
-
}, [currentMonth, currentYear]);
|
|
1899
|
-
const today = /* @__PURE__ */ new Date();
|
|
1900
|
-
const dialogId = React7.useId();
|
|
1901
|
-
return /* @__PURE__ */ jsxs7("div", { className: cn7("relative", className), ref: containerRef, children: [
|
|
1902
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex gap-2", children: [
|
|
1903
|
-
/* @__PURE__ */ jsx8(
|
|
1904
|
-
Input2,
|
|
1905
|
-
{
|
|
1906
|
-
type: "date",
|
|
1907
|
-
value: selectedDate ? format(selectedDate, "yyyy-MM-dd") : "",
|
|
1908
|
-
onChange: handleInputChange,
|
|
1909
|
-
placeholder,
|
|
1910
|
-
disabled,
|
|
1911
|
-
className: "flex-1"
|
|
1912
|
-
}
|
|
1913
|
-
),
|
|
1914
|
-
/* @__PURE__ */ jsx8(
|
|
1915
|
-
Button6,
|
|
1916
|
-
{
|
|
1917
|
-
ref: toggleRef,
|
|
1918
|
-
type: "button",
|
|
1919
|
-
variant: "outline",
|
|
1920
|
-
onClick: () => setOpen(!open),
|
|
1921
|
-
disabled,
|
|
1922
|
-
className: "px-3",
|
|
1923
|
-
"aria-label": selectedDate ? `Change date, currently ${format(selectedDate, "PPP")}` : "Choose date",
|
|
1924
|
-
"aria-haspopup": "dialog",
|
|
1925
|
-
"aria-expanded": open,
|
|
1926
|
-
"aria-controls": open ? dialogId : void 0,
|
|
1927
|
-
children: /* @__PURE__ */ jsx8(CalendarIcon, { className: "h-4 w-4" })
|
|
1928
|
-
}
|
|
1929
|
-
)
|
|
1930
|
-
] }),
|
|
1931
|
-
open && /* @__PURE__ */ jsxs7(
|
|
1932
|
-
"div",
|
|
1933
|
-
{
|
|
1934
|
-
id: dialogId,
|
|
1935
|
-
role: "dialog",
|
|
1936
|
-
"aria-label": `Choose date, ${monthLabel}`,
|
|
1937
|
-
className: "bg-popover absolute top-full z-50 mt-1 w-80 rounded-md border p-3 shadow-md",
|
|
1938
|
-
children: [
|
|
1939
|
-
/* @__PURE__ */ jsx8(
|
|
1940
|
-
"div",
|
|
1941
|
-
{
|
|
1942
|
-
"aria-hidden": "true",
|
|
1943
|
-
className: "text-foreground mb-2 text-center text-sm font-semibold",
|
|
1944
|
-
children: monthLabel
|
|
1945
|
-
}
|
|
1946
|
-
),
|
|
1947
|
-
/* @__PURE__ */ jsx8(
|
|
1948
|
-
"div",
|
|
1949
|
-
{
|
|
1950
|
-
className: "mb-2 grid grid-cols-7 gap-1 text-center text-sm font-medium",
|
|
1951
|
-
"aria-hidden": "true",
|
|
1952
|
-
children: WEEK_DAYS.map((day) => /* @__PURE__ */ jsx8("div", { className: "p-1", children: day }, day))
|
|
1953
|
-
}
|
|
1954
|
-
),
|
|
1955
|
-
/* @__PURE__ */ jsx8("div", { role: "grid", className: "grid grid-cols-7 gap-1", children: calendarDays.map((day, index) => {
|
|
1956
|
-
if (!day) {
|
|
1957
|
-
return /* @__PURE__ */ jsx8("div", { role: "presentation" }, `empty-${index}`);
|
|
1958
|
-
}
|
|
1959
|
-
const isSelected = selectedDate && day.toDateString() === selectedDate.toDateString();
|
|
1960
|
-
const isToday = day.toDateString() === today.toDateString();
|
|
1961
|
-
return /* @__PURE__ */ jsx8(
|
|
1962
|
-
"button",
|
|
1963
|
-
{
|
|
1964
|
-
type: "button",
|
|
1965
|
-
"aria-label": format(day, "PPPP"),
|
|
1966
|
-
"aria-pressed": isSelected,
|
|
1967
|
-
"aria-current": isToday ? "date" : void 0,
|
|
1968
|
-
className: cn7(
|
|
1969
|
-
"hover:bg-accent hover:text-accent-foreground rounded p-2 text-sm",
|
|
1970
|
-
isSelected ? "bg-primary text-primary-foreground" : isToday ? "bg-muted" : "text-muted-foreground"
|
|
1971
|
-
),
|
|
1972
|
-
onClick: () => handleDateSelect(day),
|
|
1973
|
-
children: day.getDate()
|
|
1974
|
-
},
|
|
1975
|
-
day.toDateString()
|
|
1976
|
-
);
|
|
1977
|
-
}) })
|
|
1978
|
-
]
|
|
1979
|
-
}
|
|
1980
|
-
)
|
|
1981
|
-
] });
|
|
1982
|
-
}
|
|
1983
|
-
);
|
|
1984
|
-
DatePicker.displayName = "DatePicker";
|
|
1985
|
-
|
|
1986
|
-
// src/components/form/index.tsx
|
|
1987
|
-
import { Label } from "@foundrykit/primitives";
|
|
1988
|
-
import { cn as cn8 } from "@foundrykit/utils";
|
|
1989
|
-
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
1990
|
-
import * as React8 from "react";
|
|
48
|
+
ChartContainer,
|
|
49
|
+
ChartLegend,
|
|
50
|
+
ChartLegendContent,
|
|
51
|
+
ChartStyle,
|
|
52
|
+
ChartTooltip,
|
|
53
|
+
ChartTooltipContent,
|
|
54
|
+
useChart
|
|
55
|
+
} from "./chunk-ID7BFTID.js";
|
|
1991
56
|
import {
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
57
|
+
Carousel,
|
|
58
|
+
CarouselContent,
|
|
59
|
+
CarouselItem,
|
|
60
|
+
CarouselNext,
|
|
61
|
+
CarouselPrevious
|
|
62
|
+
} from "./chunk-B5ZTF5MZ.js";
|
|
1995
63
|
import {
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
useFormField
|
|
1999
|
-
} from "@foundrykit/hooks";
|
|
2000
|
-
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
2001
|
-
var Form = FormProvider;
|
|
2002
|
-
var FormField = ({
|
|
2003
|
-
...props
|
|
2004
|
-
}) => {
|
|
2005
|
-
return /* @__PURE__ */ jsx9(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx9(Controller, { ...props }) });
|
|
2006
|
-
};
|
|
2007
|
-
function FormItem({ className, ...props }) {
|
|
2008
|
-
const id = React8.useId();
|
|
2009
|
-
return /* @__PURE__ */ jsx9(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx9(
|
|
2010
|
-
"div",
|
|
2011
|
-
{
|
|
2012
|
-
"data-slot": "form-item",
|
|
2013
|
-
className: cn8("grid gap-2", className),
|
|
2014
|
-
...props
|
|
2015
|
-
}
|
|
2016
|
-
) });
|
|
2017
|
-
}
|
|
2018
|
-
function FormLabel({
|
|
2019
|
-
className,
|
|
2020
|
-
...props
|
|
2021
|
-
}) {
|
|
2022
|
-
const { error, formItemId } = useFormField();
|
|
2023
|
-
return /* @__PURE__ */ jsx9(
|
|
2024
|
-
Label,
|
|
2025
|
-
{
|
|
2026
|
-
"data-slot": "form-label",
|
|
2027
|
-
"data-error": !!error,
|
|
2028
|
-
className: cn8("data-[error=true]:text-destructive", className),
|
|
2029
|
-
htmlFor: formItemId,
|
|
2030
|
-
...props
|
|
2031
|
-
}
|
|
2032
|
-
);
|
|
2033
|
-
}
|
|
2034
|
-
function FormControl({ ...props }) {
|
|
2035
|
-
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
2036
|
-
return /* @__PURE__ */ jsx9(
|
|
2037
|
-
Slot2,
|
|
2038
|
-
{
|
|
2039
|
-
"data-slot": "form-control",
|
|
2040
|
-
id: formItemId,
|
|
2041
|
-
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
2042
|
-
"aria-invalid": !!error,
|
|
2043
|
-
...props
|
|
2044
|
-
}
|
|
2045
|
-
);
|
|
2046
|
-
}
|
|
2047
|
-
function FormDescription({ className, ...props }) {
|
|
2048
|
-
const { formDescriptionId } = useFormField();
|
|
2049
|
-
return /* @__PURE__ */ jsx9(
|
|
2050
|
-
"p",
|
|
2051
|
-
{
|
|
2052
|
-
"data-slot": "form-description",
|
|
2053
|
-
id: formDescriptionId,
|
|
2054
|
-
className: cn8("text-muted-foreground text-sm", className),
|
|
2055
|
-
...props
|
|
2056
|
-
}
|
|
2057
|
-
);
|
|
2058
|
-
}
|
|
2059
|
-
function FormMessage({ className, ...props }) {
|
|
2060
|
-
const { error, formMessageId } = useFormField();
|
|
2061
|
-
const body = error ? String(error?.message ?? "") : props.children;
|
|
2062
|
-
if (!body) {
|
|
2063
|
-
return null;
|
|
2064
|
-
}
|
|
2065
|
-
return /* @__PURE__ */ jsx9(
|
|
2066
|
-
"p",
|
|
2067
|
-
{
|
|
2068
|
-
"data-slot": "form-message",
|
|
2069
|
-
id: formMessageId,
|
|
2070
|
-
className: cn8("text-destructive text-sm", className),
|
|
2071
|
-
...props,
|
|
2072
|
-
children: body
|
|
2073
|
-
}
|
|
2074
|
-
);
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
// src/components/input-otp/index.tsx
|
|
2078
|
-
import { cn as cn9 } from "@foundrykit/utils";
|
|
2079
|
-
import { OTPInput, OTPInputContext } from "input-otp";
|
|
2080
|
-
import { MinusIcon } from "lucide-react";
|
|
2081
|
-
import * as React9 from "react";
|
|
2082
|
-
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2083
|
-
function InputOTP({
|
|
2084
|
-
className,
|
|
2085
|
-
containerClassName,
|
|
2086
|
-
...props
|
|
2087
|
-
}) {
|
|
2088
|
-
return /* @__PURE__ */ jsx10(
|
|
2089
|
-
OTPInput,
|
|
2090
|
-
{
|
|
2091
|
-
"data-slot": "input-otp",
|
|
2092
|
-
containerClassName: cn9(
|
|
2093
|
-
"flex items-center gap-2 has-disabled:opacity-50",
|
|
2094
|
-
containerClassName
|
|
2095
|
-
),
|
|
2096
|
-
className: cn9("disabled:cursor-not-allowed", className),
|
|
2097
|
-
...props
|
|
2098
|
-
}
|
|
2099
|
-
);
|
|
2100
|
-
}
|
|
2101
|
-
function InputOTPGroup({ className, ...props }) {
|
|
2102
|
-
return /* @__PURE__ */ jsx10(
|
|
2103
|
-
"div",
|
|
2104
|
-
{
|
|
2105
|
-
"data-slot": "input-otp-group",
|
|
2106
|
-
className: cn9("flex items-center", className),
|
|
2107
|
-
...props
|
|
2108
|
-
}
|
|
2109
|
-
);
|
|
2110
|
-
}
|
|
2111
|
-
function InputOTPSlot({
|
|
2112
|
-
index,
|
|
2113
|
-
className,
|
|
2114
|
-
...props
|
|
2115
|
-
}) {
|
|
2116
|
-
const inputOTPContext = React9.useContext(OTPInputContext);
|
|
2117
|
-
const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
|
|
2118
|
-
return /* @__PURE__ */ jsxs8(
|
|
2119
|
-
"div",
|
|
2120
|
-
{
|
|
2121
|
-
"data-slot": "input-otp-slot",
|
|
2122
|
-
"data-active": isActive,
|
|
2123
|
-
className: cn9(
|
|
2124
|
-
"data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",
|
|
2125
|
-
className
|
|
2126
|
-
),
|
|
2127
|
-
...props,
|
|
2128
|
-
children: [
|
|
2129
|
-
char,
|
|
2130
|
-
hasFakeCaret && /* @__PURE__ */ jsx10("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx10("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" }) })
|
|
2131
|
-
]
|
|
2132
|
-
}
|
|
2133
|
-
);
|
|
2134
|
-
}
|
|
2135
|
-
function InputOTPSeparator({ ...props }) {
|
|
2136
|
-
return /* @__PURE__ */ jsx10("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: /* @__PURE__ */ jsx10(MinusIcon, {}) });
|
|
2137
|
-
}
|
|
2138
|
-
|
|
2139
|
-
// src/components/pagination/index.tsx
|
|
2140
|
-
import { buttonVariants as buttonVariants2 } from "@foundrykit/primitives";
|
|
2141
|
-
import { cn as cn10 } from "@foundrykit/utils";
|
|
64
|
+
Combobox
|
|
65
|
+
} from "./chunk-5CXNMTIN.js";
|
|
2142
66
|
import {
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
}
|
|
2159
|
-
function PaginationContent({
|
|
2160
|
-
className,
|
|
2161
|
-
...props
|
|
2162
|
-
}) {
|
|
2163
|
-
return /* @__PURE__ */ jsx11(
|
|
2164
|
-
"ul",
|
|
2165
|
-
{
|
|
2166
|
-
"data-slot": "pagination-content",
|
|
2167
|
-
className: cn10("flex flex-row items-center gap-1", className),
|
|
2168
|
-
...props
|
|
2169
|
-
}
|
|
2170
|
-
);
|
|
2171
|
-
}
|
|
2172
|
-
function PaginationItem({ ...props }) {
|
|
2173
|
-
return /* @__PURE__ */ jsx11("li", { "data-slot": "pagination-item", ...props });
|
|
2174
|
-
}
|
|
2175
|
-
function PaginationLink({
|
|
2176
|
-
className,
|
|
2177
|
-
isActive,
|
|
2178
|
-
size = "icon",
|
|
2179
|
-
...props
|
|
2180
|
-
}) {
|
|
2181
|
-
return /* @__PURE__ */ jsx11(
|
|
2182
|
-
"a",
|
|
2183
|
-
{
|
|
2184
|
-
"aria-current": isActive ? "page" : void 0,
|
|
2185
|
-
"data-slot": "pagination-link",
|
|
2186
|
-
"data-active": isActive,
|
|
2187
|
-
className: cn10(
|
|
2188
|
-
buttonVariants2({
|
|
2189
|
-
variant: isActive ? "outline" : "ghost",
|
|
2190
|
-
size
|
|
2191
|
-
}),
|
|
2192
|
-
className
|
|
2193
|
-
),
|
|
2194
|
-
...props
|
|
2195
|
-
}
|
|
2196
|
-
);
|
|
2197
|
-
}
|
|
2198
|
-
function PaginationPrevious({
|
|
2199
|
-
className,
|
|
2200
|
-
...props
|
|
2201
|
-
}) {
|
|
2202
|
-
return /* @__PURE__ */ jsxs9(
|
|
2203
|
-
PaginationLink,
|
|
2204
|
-
{
|
|
2205
|
-
"aria-label": "Go to previous page",
|
|
2206
|
-
size: "default",
|
|
2207
|
-
className: cn10("gap-1 px-2.5 sm:pl-2.5", className),
|
|
2208
|
-
...props,
|
|
2209
|
-
children: [
|
|
2210
|
-
/* @__PURE__ */ jsx11(ChevronLeftIcon2, {}),
|
|
2211
|
-
/* @__PURE__ */ jsx11("span", { className: "hidden sm:block", children: "Previous" })
|
|
2212
|
-
]
|
|
2213
|
-
}
|
|
2214
|
-
);
|
|
2215
|
-
}
|
|
2216
|
-
function PaginationNext({
|
|
2217
|
-
className,
|
|
2218
|
-
...props
|
|
2219
|
-
}) {
|
|
2220
|
-
return /* @__PURE__ */ jsxs9(
|
|
2221
|
-
PaginationLink,
|
|
2222
|
-
{
|
|
2223
|
-
"aria-label": "Go to next page",
|
|
2224
|
-
size: "default",
|
|
2225
|
-
className: cn10("gap-1 px-2.5 sm:pr-2.5", className),
|
|
2226
|
-
...props,
|
|
2227
|
-
children: [
|
|
2228
|
-
/* @__PURE__ */ jsx11("span", { className: "hidden sm:block", children: "Next" }),
|
|
2229
|
-
/* @__PURE__ */ jsx11(ChevronRightIcon2, {})
|
|
2230
|
-
]
|
|
2231
|
-
}
|
|
2232
|
-
);
|
|
2233
|
-
}
|
|
2234
|
-
function PaginationEllipsis({
|
|
2235
|
-
className,
|
|
2236
|
-
...props
|
|
2237
|
-
}) {
|
|
2238
|
-
return /* @__PURE__ */ jsxs9(
|
|
2239
|
-
"span",
|
|
2240
|
-
{
|
|
2241
|
-
"aria-hidden": true,
|
|
2242
|
-
"data-slot": "pagination-ellipsis",
|
|
2243
|
-
className: cn10("flex size-9 items-center justify-center", className),
|
|
2244
|
-
...props,
|
|
2245
|
-
children: [
|
|
2246
|
-
/* @__PURE__ */ jsx11(MoreHorizontalIcon, { className: "size-4" }),
|
|
2247
|
-
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: "More pages" })
|
|
2248
|
-
]
|
|
2249
|
-
}
|
|
2250
|
-
);
|
|
2251
|
-
}
|
|
2252
|
-
|
|
2253
|
-
// src/components/search-bar/index.tsx
|
|
2254
|
-
import { Input as Input3 } from "@foundrykit/primitives";
|
|
2255
|
-
import { cn as cn11 } from "@foundrykit/utils";
|
|
2256
|
-
import { Search as Search2 } from "lucide-react";
|
|
2257
|
-
import * as React10 from "react";
|
|
2258
|
-
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2259
|
-
var SearchBar = React10.forwardRef(
|
|
2260
|
-
({
|
|
2261
|
-
className,
|
|
2262
|
-
onSearch,
|
|
2263
|
-
placeholder = "Search...",
|
|
2264
|
-
value: externalValue,
|
|
2265
|
-
onChange: externalOnChange,
|
|
2266
|
-
...props
|
|
2267
|
-
}, ref) => {
|
|
2268
|
-
const [internalQuery, setInternalQuery] = React10.useState("");
|
|
2269
|
-
const query = externalValue !== void 0 ? externalValue : internalQuery;
|
|
2270
|
-
const isControlled = externalValue !== void 0;
|
|
2271
|
-
const handleChange = (e) => {
|
|
2272
|
-
const value = e.target.value;
|
|
2273
|
-
if (!isControlled) {
|
|
2274
|
-
setInternalQuery(value);
|
|
2275
|
-
}
|
|
2276
|
-
onSearch?.(value);
|
|
2277
|
-
externalOnChange?.(e);
|
|
2278
|
-
};
|
|
2279
|
-
return /* @__PURE__ */ jsxs10("div", { className: cn11("relative", className), children: [
|
|
2280
|
-
/* @__PURE__ */ jsx12(Search2, { className: "text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2" }),
|
|
2281
|
-
/* @__PURE__ */ jsx12(
|
|
2282
|
-
Input3,
|
|
2283
|
-
{
|
|
2284
|
-
ref,
|
|
2285
|
-
type: "search",
|
|
2286
|
-
placeholder,
|
|
2287
|
-
value: query,
|
|
2288
|
-
onChange: handleChange,
|
|
2289
|
-
className: "pl-10",
|
|
2290
|
-
...props
|
|
2291
|
-
}
|
|
2292
|
-
)
|
|
2293
|
-
] });
|
|
2294
|
-
}
|
|
2295
|
-
);
|
|
2296
|
-
SearchBar.displayName = "SearchBar";
|
|
67
|
+
Calendar
|
|
68
|
+
} from "./chunk-UG7YS3D5.js";
|
|
69
|
+
import {
|
|
70
|
+
Command,
|
|
71
|
+
CommandDialog,
|
|
72
|
+
CommandEmpty,
|
|
73
|
+
CommandGroup,
|
|
74
|
+
CommandInput,
|
|
75
|
+
CommandItem,
|
|
76
|
+
CommandList,
|
|
77
|
+
CommandSeparator,
|
|
78
|
+
CommandShortcut
|
|
79
|
+
} from "./chunk-IYBHXVCH.js";
|
|
80
|
+
import {
|
|
81
|
+
DataTable
|
|
82
|
+
} from "./chunk-4WYKNDYY.js";
|
|
2297
83
|
|
|
2298
|
-
// src/
|
|
2299
|
-
import {
|
|
2300
|
-
import { cn as cn12 } from "@foundrykit/utils";
|
|
2301
|
-
import { MoonIcon, SunIcon } from "lucide-react";
|
|
2302
|
-
import { useEffect as useEffect5, useState as useState7 } from "react";
|
|
2303
|
-
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2304
|
-
function ThemeToggle({ className }) {
|
|
2305
|
-
const [dark, setDark] = useState7(false);
|
|
2306
|
-
useEffect5(() => {
|
|
2307
|
-
setDark(document.documentElement.classList.contains("dark"));
|
|
2308
|
-
}, []);
|
|
2309
|
-
const toggle = (next) => {
|
|
2310
|
-
const root = document.documentElement;
|
|
2311
|
-
root.classList.add("theme-switching");
|
|
2312
|
-
root.classList.toggle("dark", next);
|
|
2313
|
-
setDark(next);
|
|
2314
|
-
requestAnimationFrame(
|
|
2315
|
-
() => requestAnimationFrame(() => root.classList.remove("theme-switching"))
|
|
2316
|
-
);
|
|
2317
|
-
};
|
|
2318
|
-
return /* @__PURE__ */ jsxs11(
|
|
2319
|
-
Toggle,
|
|
2320
|
-
{
|
|
2321
|
-
variant: "outline",
|
|
2322
|
-
"aria-label": "Dark mode",
|
|
2323
|
-
pressed: dark,
|
|
2324
|
-
onPressedChange: toggle,
|
|
2325
|
-
className: cn12(
|
|
2326
|
-
"data-[state=on]:hover:bg-muted group size-9 transition-[color,box-shadow,scale] duration-150 ease-out data-[state=on]:bg-transparent motion-safe:active:scale-[0.97]",
|
|
2327
|
-
className
|
|
2328
|
-
),
|
|
2329
|
-
children: [
|
|
2330
|
-
/* @__PURE__ */ jsx13(
|
|
2331
|
-
MoonIcon,
|
|
2332
|
-
{
|
|
2333
|
-
size: 16,
|
|
2334
|
-
className: "hidden shrink-0 group-data-[state=on]:block",
|
|
2335
|
-
"aria-hidden": "true"
|
|
2336
|
-
}
|
|
2337
|
-
),
|
|
2338
|
-
/* @__PURE__ */ jsx13(
|
|
2339
|
-
SunIcon,
|
|
2340
|
-
{
|
|
2341
|
-
size: 16,
|
|
2342
|
-
className: "shrink-0 group-data-[state=on]:hidden",
|
|
2343
|
-
"aria-hidden": "true"
|
|
2344
|
-
}
|
|
2345
|
-
)
|
|
2346
|
-
]
|
|
2347
|
-
}
|
|
2348
|
-
);
|
|
2349
|
-
}
|
|
84
|
+
// src/index.ts
|
|
85
|
+
import { cn } from "@foundrykit/utils";
|
|
2350
86
|
export {
|
|
2351
87
|
AdvancedSearchBar,
|
|
2352
88
|
AdvancedSearchBarWrapper,
|
|
@@ -2400,7 +136,7 @@ export {
|
|
|
2400
136
|
SearchSection,
|
|
2401
137
|
SearchTrigger,
|
|
2402
138
|
ThemeToggle,
|
|
2403
|
-
|
|
139
|
+
cn,
|
|
2404
140
|
useChart,
|
|
2405
141
|
useFormField
|
|
2406
142
|
};
|