@foundrykit/components 2.1.4 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/chunk-4WYKNDYY.js +91 -0
  2. package/dist/chunk-4WYKNDYY.js.map +1 -0
  3. package/dist/chunk-5CXNMTIN.js +84 -0
  4. package/dist/chunk-5CXNMTIN.js.map +1 -0
  5. package/dist/chunk-B5ZTF5MZ.js +203 -0
  6. package/dist/chunk-B5ZTF5MZ.js.map +1 -0
  7. package/dist/chunk-EDNWBEKV.js +51 -0
  8. package/dist/chunk-EDNWBEKV.js.map +1 -0
  9. package/dist/chunk-ID7BFTID.js +248 -0
  10. package/dist/chunk-ID7BFTID.js.map +1 -0
  11. package/dist/chunk-IYBHXVCH.js +181 -0
  12. package/dist/chunk-IYBHXVCH.js.map +1 -0
  13. package/dist/chunk-KQZEF7PS.js +71 -0
  14. package/dist/chunk-KQZEF7PS.js.map +1 -0
  15. package/dist/chunk-P3GSYR7O.js +889 -0
  16. package/dist/chunk-P3GSYR7O.js.map +1 -0
  17. package/dist/chunk-PKSRYDN4.js +168 -0
  18. package/dist/chunk-PKSRYDN4.js.map +1 -0
  19. package/dist/chunk-SFM7ZMG2.js +104 -0
  20. package/dist/chunk-SFM7ZMG2.js.map +1 -0
  21. package/dist/chunk-TLQQZJUR.js +126 -0
  22. package/dist/chunk-TLQQZJUR.js.map +1 -0
  23. package/dist/chunk-UE7CDYEN.js +59 -0
  24. package/dist/chunk-UE7CDYEN.js.map +1 -0
  25. package/dist/chunk-UG7YS3D5.js +198 -0
  26. package/dist/chunk-UG7YS3D5.js.map +1 -0
  27. package/dist/components/advanced-search-bar/index.d.ts +308 -0
  28. package/dist/components/advanced-search-bar/index.js +34 -0
  29. package/dist/components/advanced-search-bar/index.js.map +1 -0
  30. package/dist/components/calendar/index.d.ts +20 -0
  31. package/dist/components/calendar/index.js +11 -0
  32. package/dist/components/calendar/index.js.map +1 -0
  33. package/dist/components/carousel/index.d.ts +40 -0
  34. package/dist/components/carousel/index.js +17 -0
  35. package/dist/components/carousel/index.js.map +1 -0
  36. package/dist/components/chart/index.d.ts +59 -0
  37. package/dist/components/chart/index.js +21 -0
  38. package/dist/components/chart/index.js.map +1 -0
  39. package/dist/components/combobox/index.d.ts +33 -0
  40. package/dist/components/combobox/index.js +10 -0
  41. package/dist/components/combobox/index.js.map +1 -0
  42. package/dist/components/command/index.d.ts +33 -0
  43. package/dist/components/command/index.js +25 -0
  44. package/dist/components/command/index.js.map +1 -0
  45. package/dist/components/data-table/index.d.ts +17 -0
  46. package/dist/components/data-table/index.js +9 -0
  47. package/dist/components/data-table/index.js.map +1 -0
  48. package/dist/components/date-picker/index.d.ts +17 -0
  49. package/dist/components/date-picker/index.js +9 -0
  50. package/dist/components/date-picker/index.js.map +1 -0
  51. package/dist/components/form/index.d.ts +37 -0
  52. package/dist/components/form/index.js +23 -0
  53. package/dist/components/form/index.js.map +1 -0
  54. package/dist/components/input-otp/index.d.ts +30 -0
  55. package/dist/components/input-otp/index.js +15 -0
  56. package/dist/components/input-otp/index.js.map +1 -0
  57. package/dist/components/pagination/index.d.ts +26 -0
  58. package/dist/components/pagination/index.js +20 -0
  59. package/dist/components/pagination/index.js.map +1 -0
  60. package/dist/components/search-bar/index.d.ts +17 -0
  61. package/dist/components/search-bar/index.js +9 -0
  62. package/dist/components/search-bar/index.js.map +1 -0
  63. package/dist/components/sidebar/index.d.ts +70 -0
  64. package/dist/components/sidebar/index.js +652 -0
  65. package/dist/components/sidebar/index.js.map +1 -0
  66. package/dist/components/theme-toggle/index.d.ts +20 -0
  67. package/dist/components/theme-toggle/index.js +9 -0
  68. package/dist/components/theme-toggle/index.js.map +1 -0
  69. package/dist/index.d.ts +27 -582
  70. package/dist/index.js +74 -2280
  71. package/dist/index.js.map +1 -1
  72. package/package.json +15 -8
  73. package/.turbo/turbo-build.log +0 -17
  74. package/.turbo/turbo-type-check.log +0 -4
  75. package/CHANGELOG.md +0 -351
  76. package/src/components/advanced-search-bar/config.ts +0 -223
  77. package/src/components/advanced-search-bar/index.tsx +0 -1415
  78. package/src/components/calendar/config.ts +0 -51
  79. package/src/components/calendar/index.tsx +0 -225
  80. package/src/components/carousel/config.ts +0 -28
  81. package/src/components/carousel/index.tsx +0 -258
  82. package/src/components/chart/config.ts +0 -28
  83. package/src/components/chart/index.tsx +0 -365
  84. package/src/components/combobox/config.ts +0 -28
  85. package/src/components/combobox/index.tsx +0 -101
  86. package/src/components/command/config.ts +0 -804
  87. package/src/components/command/index.tsx +0 -195
  88. package/src/components/data-table/config.ts +0 -28
  89. package/src/components/data-table/index.tsx +0 -124
  90. package/src/components/date-picker/config.ts +0 -55
  91. package/src/components/date-picker/index.tsx +0 -207
  92. package/src/components/form/config.ts +0 -21
  93. package/src/components/form/index.tsx +0 -150
  94. package/src/components/input-otp/config.ts +0 -28
  95. package/src/components/input-otp/index.tsx +0 -92
  96. package/src/components/pagination/config.ts +0 -367
  97. package/src/components/pagination/index.tsx +0 -135
  98. package/src/components/search-bar/config.ts +0 -58
  99. package/src/components/search-bar/index.tsx +0 -70
  100. package/src/components/sidebar/config.ts +0 -29
  101. package/src/components/sidebar/index.tsx +0 -723
  102. package/src/components/theme-toggle/config.ts +0 -58
  103. package/src/components/theme-toggle/index.tsx +0 -35
  104. package/src/index.ts +0 -82
  105. package/tsconfig.json +0 -12
  106. package/tsconfig.lint.json +0 -8
  107. package/tsup.config.ts +0 -11
package/dist/index.js CHANGED
@@ -1,2295 +1,88 @@
1
+ 'use client';
1
2
  "use client";
2
-
3
- // src/index.ts
4
- import { cn as cn12 } from "@foundrykit/utils";
5
-
6
- // src/components/advanced-search-bar/index.tsx
7
3
  import {
8
- SearchContext,
9
- useAdvancedSearch
10
- } from "@foundrykit/hooks";
4
+ Form,
5
+ FormControl,
6
+ FormDescription,
7
+ FormField,
8
+ FormItem,
9
+ FormLabel,
10
+ FormMessage,
11
+ useFormField
12
+ } from "./chunk-SFM7ZMG2.js";
13
+ import {
14
+ DatePicker
15
+ } from "./chunk-PKSRYDN4.js";
11
16
  import {
12
- Badge,
13
- Button,
14
- Input,
15
- ScrollArea,
16
- Separator
17
- } from "@foundrykit/primitives";
18
- import { cn } from "@foundrykit/utils";
19
- import { Slot } from "@radix-ui/react-slot";
20
- import { cva } from "class-variance-authority";
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";
17
+ InputOTP,
18
+ InputOTPGroup,
19
+ InputOTPSeparator,
20
+ InputOTPSlot
21
+ } from "./chunk-KQZEF7PS.js";
883
22
  import {
884
- ChevronDownIcon,
885
- ChevronLeftIcon,
886
- ChevronRightIcon
887
- } from "lucide-react";
888
- import * as React2 from "react";
23
+ Pagination,
24
+ PaginationContent,
25
+ PaginationEllipsis,
26
+ PaginationItem,
27
+ PaginationLink,
28
+ PaginationNext,
29
+ PaginationPrevious
30
+ } from "./chunk-TLQQZJUR.js";
889
31
  import {
890
- DayPicker,
891
- getDefaultClassNames
892
- } from "react-day-picker";
893
- import { jsx as jsx2 } from "react/jsx-runtime";
894
- function Calendar({
895
- className,
896
- classNames,
897
- showOutsideDays = true,
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
32
+ SearchBar
33
+ } from "./chunk-EDNWBEKV.js";
1501
34
  import {
1502
- Button as Button4,
1503
- Popover,
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
35
+ ThemeToggle
36
+ } from "./chunk-UE7CDYEN.js";
1512
37
  import {
1513
- Dialog,
1514
- DialogContent,
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
- }) {
1686
- const [open, setOpen] = React5.useState(false);
1687
- const selected = options.find((option) => option.value === value);
1688
- return /* @__PURE__ */ jsxs5(Popover, { open, onOpenChange: setOpen, children: [
1689
- /* @__PURE__ */ jsx6(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(
1690
- Button4,
1691
- {
1692
- "data-slot": "combobox-trigger",
1693
- variant: "outline",
1694
- role: "combobox",
1695
- "aria-expanded": open,
1696
- className: "w-[200px] justify-between",
1697
- children: [
1698
- selected ? selected.label : placeholder,
1699
- /* @__PURE__ */ jsx6(ChevronsUpDownIcon, { className: "ml-2 size-4 shrink-0 opacity-50" })
1700
- ]
1701
- }
1702
- ) }),
1703
- /* @__PURE__ */ jsx6(PopoverContent, { "data-slot": "combobox-content", className: "w-[200px] p-0", children: /* @__PURE__ */ jsxs5(Command, { children: [
1704
- /* @__PURE__ */ jsx6(CommandInput, { placeholder, className: "h-9" }),
1705
- /* @__PURE__ */ jsxs5(CommandList, { children: [
1706
- /* @__PURE__ */ jsx6(CommandEmpty, { children: "No option found." }),
1707
- /* @__PURE__ */ jsx6(CommandGroup, { children: options.map((option) => /* @__PURE__ */ jsxs5(
1708
- CommandItem,
1709
- {
1710
- value: option.value,
1711
- onSelect: (currentValue) => {
1712
- onValueChange?.(currentValue === value ? "" : currentValue);
1713
- setOpen(false);
1714
- },
1715
- children: [
1716
- option.label,
1717
- /* @__PURE__ */ jsx6(
1718
- CheckIcon,
1719
- {
1720
- className: cn6(
1721
- "ml-auto size-4",
1722
- value === option.value ? "opacity-100" : "opacity-0"
1723
- )
1724
- }
1725
- )
1726
- ]
1727
- },
1728
- option.value
1729
- )) })
1730
- ] })
1731
- ] }) })
1732
- ] });
1733
- }
1734
-
1735
- // src/components/data-table/index.tsx
38
+ AdvancedSearchBar,
39
+ AdvancedSearchBarWrapper,
40
+ AdvancedSearchProvider,
41
+ SearchInput,
42
+ SearchItem,
43
+ SearchResults,
44
+ SearchSection,
45
+ SearchTrigger
46
+ } from "./chunk-P3GSYR7O.js";
47
+ import {
48
+ Carousel,
49
+ CarouselContent,
50
+ CarouselItem,
51
+ CarouselNext,
52
+ CarouselPrevious
53
+ } from "./chunk-B5ZTF5MZ.js";
1736
54
  import {
1737
- Button as Button5,
1738
- Table,
1739
- TableBody,
1740
- TableCell,
1741
- TableHead,
1742
- TableHeader,
1743
- TableRow
1744
- } from "@foundrykit/primitives";
55
+ Calendar
56
+ } from "./chunk-UG7YS3D5.js";
1745
57
  import {
1746
- flexRender,
1747
- getCoreRowModel,
1748
- getPaginationRowModel,
1749
- getSortedRowModel,
1750
- useReactTable
1751
- } from "@tanstack/react-table";
1752
- import * as React6 from "react";
1753
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1754
- function DataTable({
1755
- columns,
1756
- data
1757
- }) {
1758
- const [sorting, setSorting] = React6.useState([]);
1759
- const table = useReactTable({
1760
- data,
1761
- columns,
1762
- getCoreRowModel: getCoreRowModel(),
1763
- getPaginationRowModel: getPaginationRowModel(),
1764
- getSortedRowModel: getSortedRowModel(),
1765
- onSortingChange: setSorting,
1766
- state: {
1767
- sorting
1768
- }
1769
- });
1770
- return /* @__PURE__ */ jsxs6("div", { "data-slot": "data-table", className: "space-y-4", children: [
1771
- /* @__PURE__ */ jsx7("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs6(Table, { children: [
1772
- /* @__PURE__ */ jsx7(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx7(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx7(TableHead, { children: header.isPlaceholder ? null : flexRender(
1773
- header.column.columnDef.header,
1774
- header.getContext()
1775
- ) }, header.id)) }, headerGroup.id)) }),
1776
- /* @__PURE__ */ jsx7(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx7(
1777
- TableRow,
1778
- {
1779
- "data-state": row.getIsSelected() && "selected",
1780
- children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx7(TableCell, { children: flexRender(
1781
- cell.column.columnDef.cell,
1782
- cell.getContext()
1783
- ) }, cell.id))
1784
- },
1785
- row.id
1786
- )) : /* @__PURE__ */ jsx7(TableRow, { children: /* @__PURE__ */ jsx7(
1787
- TableCell,
1788
- {
1789
- colSpan: columns.length,
1790
- className: "h-24 text-center",
1791
- children: "No results."
1792
- }
1793
- ) }) })
1794
- ] }) }),
1795
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-end gap-2", children: [
1796
- /* @__PURE__ */ jsx7(
1797
- Button5,
1798
- {
1799
- variant: "outline",
1800
- size: "sm",
1801
- onClick: () => table.previousPage(),
1802
- disabled: !table.getCanPreviousPage(),
1803
- children: "Previous"
1804
- }
1805
- ),
1806
- /* @__PURE__ */ jsx7(
1807
- Button5,
1808
- {
1809
- variant: "outline",
1810
- size: "sm",
1811
- onClick: () => table.nextPage(),
1812
- disabled: !table.getCanNextPage(),
1813
- children: "Next"
1814
- }
1815
- )
1816
- ] })
1817
- ] });
1818
- }
1819
-
1820
- // src/components/date-picker/index.tsx
1821
- import { Button as Button6, Input as Input2 } from "@foundrykit/primitives";
1822
- import { cn as cn7 } from "@foundrykit/utils";
1823
- import { format } from "date-fns";
1824
- import { Calendar as CalendarIcon } from "lucide-react";
1825
- import * as React7 from "react";
1826
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1827
- var WEEK_DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
1828
- var DatePicker = React7.forwardRef(
1829
- ({ value, onValueChange, placeholder = "Pick a date", className, disabled }, ref) => {
1830
- const [open, setOpen] = React7.useState(false);
1831
- const [selectedDate, setSelectedDate] = React7.useState(
1832
- value
1833
- );
1834
- React7.useEffect(() => {
1835
- setSelectedDate(value);
1836
- }, [value]);
1837
- const containerRef = React7.useRef(null);
1838
- const toggleRef = React7.useRef(null);
1839
- React7.useImperativeHandle(
1840
- ref,
1841
- () => containerRef.current
1842
- );
1843
- React7.useEffect(() => {
1844
- if (!open) return;
1845
- const onPointerDown = (e) => {
1846
- if (!containerRef.current?.contains(e.target)) setOpen(false);
1847
- };
1848
- const onKeyDown = (e) => {
1849
- if (e.key === "Escape") {
1850
- setOpen(false);
1851
- toggleRef.current?.focus();
1852
- }
1853
- };
1854
- document.addEventListener("mousedown", onPointerDown);
1855
- document.addEventListener("keydown", onKeyDown);
1856
- return () => {
1857
- document.removeEventListener("mousedown", onPointerDown);
1858
- document.removeEventListener("keydown", onKeyDown);
1859
- };
1860
- }, [open]);
1861
- const handleDateSelect = (date) => {
1862
- setSelectedDate(date);
1863
- onValueChange?.(date);
1864
- setOpen(false);
1865
- toggleRef.current?.focus();
1866
- };
1867
- const handleInputChange = (e) => {
1868
- const inputValue = e.target.value;
1869
- if (inputValue) {
1870
- const date = new Date(inputValue);
1871
- if (!isNaN(date.getTime())) {
1872
- setSelectedDate(date);
1873
- onValueChange?.(date);
1874
- }
1875
- } else {
1876
- setSelectedDate(void 0);
1877
- onValueChange?.(void 0);
1878
- }
1879
- };
1880
- const viewDate = selectedDate ?? /* @__PURE__ */ new Date();
1881
- const currentMonth = viewDate.getMonth();
1882
- const currentYear = viewDate.getFullYear();
1883
- const monthLabel = format(viewDate, "MMMM yyyy");
1884
- const calendarDays = React7.useMemo(() => {
1885
- const firstDay = new Date(currentYear, currentMonth, 1);
1886
- const daysInMonth = new Date(currentYear, currentMonth + 1, 0).getDate();
1887
- const startingDayOfWeek = firstDay.getDay();
1888
- const days = [];
1889
- for (let i = 0; i < startingDayOfWeek; i++) days.push(null);
1890
- for (let day = 1; day <= daysInMonth; day++) {
1891
- days.push(new Date(currentYear, currentMonth, day));
1892
- }
1893
- return days;
1894
- }, [currentMonth, currentYear]);
1895
- const today = /* @__PURE__ */ new Date();
1896
- const dialogId = React7.useId();
1897
- return /* @__PURE__ */ jsxs7("div", { className: cn7("relative", className), ref: containerRef, children: [
1898
- /* @__PURE__ */ jsxs7("div", { className: "flex gap-2", children: [
1899
- /* @__PURE__ */ jsx8(
1900
- Input2,
1901
- {
1902
- type: "date",
1903
- value: selectedDate ? format(selectedDate, "yyyy-MM-dd") : "",
1904
- onChange: handleInputChange,
1905
- placeholder,
1906
- disabled,
1907
- className: "flex-1"
1908
- }
1909
- ),
1910
- /* @__PURE__ */ jsx8(
1911
- Button6,
1912
- {
1913
- ref: toggleRef,
1914
- type: "button",
1915
- variant: "outline",
1916
- onClick: () => setOpen(!open),
1917
- disabled,
1918
- className: "px-3",
1919
- "aria-label": selectedDate ? `Change date, currently ${format(selectedDate, "PPP")}` : "Choose date",
1920
- "aria-haspopup": "dialog",
1921
- "aria-expanded": open,
1922
- "aria-controls": open ? dialogId : void 0,
1923
- children: /* @__PURE__ */ jsx8(CalendarIcon, { className: "h-4 w-4" })
1924
- }
1925
- )
1926
- ] }),
1927
- open && /* @__PURE__ */ jsxs7(
1928
- "div",
1929
- {
1930
- id: dialogId,
1931
- role: "dialog",
1932
- "aria-label": `Choose date, ${monthLabel}`,
1933
- className: "bg-popover absolute top-full z-50 mt-1 w-80 rounded-md border p-3 shadow-md",
1934
- children: [
1935
- /* @__PURE__ */ jsx8(
1936
- "div",
1937
- {
1938
- "aria-hidden": "true",
1939
- className: "text-foreground mb-2 text-center text-sm font-semibold",
1940
- children: monthLabel
1941
- }
1942
- ),
1943
- /* @__PURE__ */ jsx8(
1944
- "div",
1945
- {
1946
- className: "mb-2 grid grid-cols-7 gap-1 text-center text-sm font-medium",
1947
- "aria-hidden": "true",
1948
- children: WEEK_DAYS.map((day) => /* @__PURE__ */ jsx8("div", { className: "p-1", children: day }, day))
1949
- }
1950
- ),
1951
- /* @__PURE__ */ jsx8("div", { role: "grid", className: "grid grid-cols-7 gap-1", children: calendarDays.map((day, index) => {
1952
- if (!day) {
1953
- return /* @__PURE__ */ jsx8("div", { role: "presentation" }, `empty-${index}`);
1954
- }
1955
- const isSelected = selectedDate && day.toDateString() === selectedDate.toDateString();
1956
- const isToday = day.toDateString() === today.toDateString();
1957
- return /* @__PURE__ */ jsx8(
1958
- "button",
1959
- {
1960
- type: "button",
1961
- "aria-label": format(day, "PPPP"),
1962
- "aria-pressed": isSelected,
1963
- "aria-current": isToday ? "date" : void 0,
1964
- className: cn7(
1965
- "hover:bg-accent hover:text-accent-foreground rounded p-2 text-sm",
1966
- isSelected ? "bg-primary text-primary-foreground" : isToday ? "bg-muted" : "text-muted-foreground"
1967
- ),
1968
- onClick: () => handleDateSelect(day),
1969
- children: day.getDate()
1970
- },
1971
- day.toDateString()
1972
- );
1973
- }) })
1974
- ]
1975
- }
1976
- )
1977
- ] });
1978
- }
1979
- );
1980
- DatePicker.displayName = "DatePicker";
1981
-
1982
- // src/components/form/index.tsx
1983
- import { Label } from "@foundrykit/primitives";
1984
- import { cn as cn8 } from "@foundrykit/utils";
1985
- import { Slot as Slot2 } from "@radix-ui/react-slot";
1986
- import * as React8 from "react";
58
+ ChartContainer,
59
+ ChartLegend,
60
+ ChartLegendContent,
61
+ ChartStyle,
62
+ ChartTooltip,
63
+ ChartTooltipContent,
64
+ useChart
65
+ } from "./chunk-ID7BFTID.js";
1987
66
  import {
1988
- Controller,
1989
- FormProvider
1990
- } from "react-hook-form";
67
+ Combobox
68
+ } from "./chunk-5CXNMTIN.js";
1991
69
  import {
1992
- FormFieldContext,
1993
- FormItemContext,
1994
- useFormField
1995
- } from "@foundrykit/hooks";
1996
- import { jsx as jsx9 } from "react/jsx-runtime";
1997
- var Form = FormProvider;
1998
- var FormField = ({
1999
- ...props
2000
- }) => {
2001
- return /* @__PURE__ */ jsx9(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx9(Controller, { ...props }) });
2002
- };
2003
- function FormItem({ className, ...props }) {
2004
- const id = React8.useId();
2005
- return /* @__PURE__ */ jsx9(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx9(
2006
- "div",
2007
- {
2008
- "data-slot": "form-item",
2009
- className: cn8("grid gap-2", className),
2010
- ...props
2011
- }
2012
- ) });
2013
- }
2014
- function FormLabel({
2015
- className,
2016
- ...props
2017
- }) {
2018
- const { error, formItemId } = useFormField();
2019
- return /* @__PURE__ */ jsx9(
2020
- Label,
2021
- {
2022
- "data-slot": "form-label",
2023
- "data-error": !!error,
2024
- className: cn8("data-[error=true]:text-destructive", className),
2025
- htmlFor: formItemId,
2026
- ...props
2027
- }
2028
- );
2029
- }
2030
- function FormControl({ ...props }) {
2031
- const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
2032
- return /* @__PURE__ */ jsx9(
2033
- Slot2,
2034
- {
2035
- "data-slot": "form-control",
2036
- id: formItemId,
2037
- "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
2038
- "aria-invalid": !!error,
2039
- ...props
2040
- }
2041
- );
2042
- }
2043
- function FormDescription({ className, ...props }) {
2044
- const { formDescriptionId } = useFormField();
2045
- return /* @__PURE__ */ jsx9(
2046
- "p",
2047
- {
2048
- "data-slot": "form-description",
2049
- id: formDescriptionId,
2050
- className: cn8("text-muted-foreground text-sm", className),
2051
- ...props
2052
- }
2053
- );
2054
- }
2055
- function FormMessage({ className, ...props }) {
2056
- const { error, formMessageId } = useFormField();
2057
- const body = error ? String(error?.message ?? "") : props.children;
2058
- if (!body) {
2059
- return null;
2060
- }
2061
- return /* @__PURE__ */ jsx9(
2062
- "p",
2063
- {
2064
- "data-slot": "form-message",
2065
- id: formMessageId,
2066
- className: cn8("text-destructive text-sm", className),
2067
- ...props,
2068
- children: body
2069
- }
2070
- );
2071
- }
2072
-
2073
- // src/components/input-otp/index.tsx
2074
- import { cn as cn9 } from "@foundrykit/utils";
2075
- import { OTPInput, OTPInputContext } from "input-otp";
2076
- import { MinusIcon } from "lucide-react";
2077
- import * as React9 from "react";
2078
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
2079
- function InputOTP({
2080
- className,
2081
- containerClassName,
2082
- ...props
2083
- }) {
2084
- return /* @__PURE__ */ jsx10(
2085
- OTPInput,
2086
- {
2087
- "data-slot": "input-otp",
2088
- containerClassName: cn9(
2089
- "flex items-center gap-2 has-disabled:opacity-50",
2090
- containerClassName
2091
- ),
2092
- className: cn9("disabled:cursor-not-allowed", className),
2093
- ...props
2094
- }
2095
- );
2096
- }
2097
- function InputOTPGroup({ className, ...props }) {
2098
- return /* @__PURE__ */ jsx10(
2099
- "div",
2100
- {
2101
- "data-slot": "input-otp-group",
2102
- className: cn9("flex items-center", className),
2103
- ...props
2104
- }
2105
- );
2106
- }
2107
- function InputOTPSlot({
2108
- index,
2109
- className,
2110
- ...props
2111
- }) {
2112
- const inputOTPContext = React9.useContext(OTPInputContext);
2113
- const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
2114
- return /* @__PURE__ */ jsxs8(
2115
- "div",
2116
- {
2117
- "data-slot": "input-otp-slot",
2118
- "data-active": isActive,
2119
- className: cn9(
2120
- "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]",
2121
- className
2122
- ),
2123
- ...props,
2124
- children: [
2125
- char,
2126
- 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" }) })
2127
- ]
2128
- }
2129
- );
2130
- }
2131
- function InputOTPSeparator({ ...props }) {
2132
- return /* @__PURE__ */ jsx10("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: /* @__PURE__ */ jsx10(MinusIcon, {}) });
2133
- }
2134
-
2135
- // src/components/pagination/index.tsx
2136
- import { buttonVariants as buttonVariants2 } from "@foundrykit/primitives";
2137
- import { cn as cn10 } from "@foundrykit/utils";
70
+ Command,
71
+ CommandDialog,
72
+ CommandEmpty,
73
+ CommandGroup,
74
+ CommandInput,
75
+ CommandItem,
76
+ CommandList,
77
+ CommandSeparator,
78
+ CommandShortcut
79
+ } from "./chunk-IYBHXVCH.js";
2138
80
  import {
2139
- ChevronLeftIcon as ChevronLeftIcon2,
2140
- ChevronRightIcon as ChevronRightIcon2,
2141
- MoreHorizontalIcon
2142
- } from "lucide-react";
2143
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2144
- function Pagination({ className, ...props }) {
2145
- return /* @__PURE__ */ jsx11(
2146
- "nav",
2147
- {
2148
- "aria-label": "pagination",
2149
- "data-slot": "pagination",
2150
- className: cn10("mx-auto flex w-full justify-center", className),
2151
- ...props
2152
- }
2153
- );
2154
- }
2155
- function PaginationContent({
2156
- className,
2157
- ...props
2158
- }) {
2159
- return /* @__PURE__ */ jsx11(
2160
- "ul",
2161
- {
2162
- "data-slot": "pagination-content",
2163
- className: cn10("flex flex-row items-center gap-1", className),
2164
- ...props
2165
- }
2166
- );
2167
- }
2168
- function PaginationItem({ ...props }) {
2169
- return /* @__PURE__ */ jsx11("li", { "data-slot": "pagination-item", ...props });
2170
- }
2171
- function PaginationLink({
2172
- className,
2173
- isActive,
2174
- size = "icon",
2175
- ...props
2176
- }) {
2177
- return /* @__PURE__ */ jsx11(
2178
- "a",
2179
- {
2180
- "aria-current": isActive ? "page" : void 0,
2181
- "data-slot": "pagination-link",
2182
- "data-active": isActive,
2183
- className: cn10(
2184
- buttonVariants2({
2185
- variant: isActive ? "outline" : "ghost",
2186
- size
2187
- }),
2188
- className
2189
- ),
2190
- ...props
2191
- }
2192
- );
2193
- }
2194
- function PaginationPrevious({
2195
- className,
2196
- ...props
2197
- }) {
2198
- return /* @__PURE__ */ jsxs9(
2199
- PaginationLink,
2200
- {
2201
- "aria-label": "Go to previous page",
2202
- size: "default",
2203
- className: cn10("gap-1 px-2.5 sm:pl-2.5", className),
2204
- ...props,
2205
- children: [
2206
- /* @__PURE__ */ jsx11(ChevronLeftIcon2, {}),
2207
- /* @__PURE__ */ jsx11("span", { className: "hidden sm:block", children: "Previous" })
2208
- ]
2209
- }
2210
- );
2211
- }
2212
- function PaginationNext({
2213
- className,
2214
- ...props
2215
- }) {
2216
- return /* @__PURE__ */ jsxs9(
2217
- PaginationLink,
2218
- {
2219
- "aria-label": "Go to next page",
2220
- size: "default",
2221
- className: cn10("gap-1 px-2.5 sm:pr-2.5", className),
2222
- ...props,
2223
- children: [
2224
- /* @__PURE__ */ jsx11("span", { className: "hidden sm:block", children: "Next" }),
2225
- /* @__PURE__ */ jsx11(ChevronRightIcon2, {})
2226
- ]
2227
- }
2228
- );
2229
- }
2230
- function PaginationEllipsis({
2231
- className,
2232
- ...props
2233
- }) {
2234
- return /* @__PURE__ */ jsxs9(
2235
- "span",
2236
- {
2237
- "aria-hidden": true,
2238
- "data-slot": "pagination-ellipsis",
2239
- className: cn10("flex size-9 items-center justify-center", className),
2240
- ...props,
2241
- children: [
2242
- /* @__PURE__ */ jsx11(MoreHorizontalIcon, { className: "size-4" }),
2243
- /* @__PURE__ */ jsx11("span", { className: "sr-only", children: "More pages" })
2244
- ]
2245
- }
2246
- );
2247
- }
81
+ DataTable
82
+ } from "./chunk-4WYKNDYY.js";
2248
83
 
2249
- // src/components/search-bar/index.tsx
2250
- import { Input as Input3 } from "@foundrykit/primitives";
2251
- import { cn as cn11 } from "@foundrykit/utils";
2252
- import { Search as Search2 } from "lucide-react";
2253
- import * as React10 from "react";
2254
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2255
- var SearchBar = React10.forwardRef(
2256
- ({
2257
- className,
2258
- onSearch,
2259
- placeholder = "Search...",
2260
- value: externalValue,
2261
- onChange: externalOnChange,
2262
- ...props
2263
- }, ref) => {
2264
- const [internalQuery, setInternalQuery] = React10.useState("");
2265
- const query = externalValue !== void 0 ? externalValue : internalQuery;
2266
- const isControlled = externalValue !== void 0;
2267
- const handleChange = (e) => {
2268
- const value = e.target.value;
2269
- if (!isControlled) {
2270
- setInternalQuery(value);
2271
- }
2272
- onSearch?.(value);
2273
- externalOnChange?.(e);
2274
- };
2275
- return /* @__PURE__ */ jsxs10("div", { className: cn11("relative", className), children: [
2276
- /* @__PURE__ */ jsx12(Search2, { className: "text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2" }),
2277
- /* @__PURE__ */ jsx12(
2278
- Input3,
2279
- {
2280
- ref,
2281
- type: "search",
2282
- placeholder,
2283
- value: query,
2284
- onChange: handleChange,
2285
- className: "pl-10",
2286
- ...props
2287
- }
2288
- )
2289
- ] });
2290
- }
2291
- );
2292
- SearchBar.displayName = "SearchBar";
84
+ // src/index.ts
85
+ import { cn } from "@foundrykit/utils";
2293
86
  export {
2294
87
  AdvancedSearchBar,
2295
88
  AdvancedSearchBarWrapper,
@@ -2342,7 +135,8 @@ export {
2342
135
  SearchResults,
2343
136
  SearchSection,
2344
137
  SearchTrigger,
2345
- cn12 as cn,
138
+ ThemeToggle,
139
+ cn,
2346
140
  useChart,
2347
141
  useFormField
2348
142
  };