@catalystsoftware/ui 1.0.5 → 1.0.7

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 (155) hide show
  1. package/dist/data/data.tsx +29 -29
  2. package/dist/data/tailwind.config.js +3821 -261
  3. package/dist/data.tsx +29 -29
  4. package/package.json +4 -3
  5. package/components/catalyst-ui/buttons/burger.tsx +0 -207
  6. package/components/catalyst-ui/core/data-display/timeline.tsx +0 -210
  7. package/components/catalyst-ui/core/feedback/alert.tsx +0 -491
  8. package/components/catalyst-ui/core/feedback/spinner-1.tsx +0 -65
  9. package/components/catalyst-ui/core/feedback/toast.tsx +0 -1857
  10. package/components/catalyst-ui/core/navigation/menu.tsx +0 -164
  11. package/components/catalyst-ui/forms/toggle-class.tsx +0 -176
  12. package/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +0 -419
  13. package/components/catalyst-ui/hooks/use-counter.tsx +0 -13
  14. package/components/catalyst-ui/hooks/use-event-listener.tsx +0 -23
  15. package/components/catalyst-ui/hooks/use-export-markdown.tsx +0 -47
  16. package/components/catalyst-ui/hooks/use-focus.tsx +0 -17
  17. package/components/catalyst-ui/hooks/use-interval.tsx +0 -23
  18. package/components/catalyst-ui/hooks/use-is-client.tsx +0 -16
  19. package/components/catalyst-ui/hooks/use-media-query.tsx +0 -19
  20. package/components/catalyst-ui/hooks/use-mobile.tsx +0 -19
  21. package/components/catalyst-ui/hooks/use-resize-observer.tsx +0 -81
  22. package/components/catalyst-ui/hooks/use-timeout.tsx +0 -21
  23. package/components/catalyst-ui/hooks/use-timer.tsx +0 -209
  24. package/components/catalyst-ui/hooks/use-toggle.tsx +0 -12
  25. package/components/catalyst-ui/media/image.tsx +0 -13
  26. package/components/catalyst-ui/overlays/dual-sidebar.tsx +0 -4142
  27. package/components/catalyst-ui/overlays/sidebar-original.tsx +0 -726
  28. package/components/catalyst-ui/primitives/accordion.tsx +0 -250
  29. package/components/catalyst-ui/primitives/alert-dialog.tsx +0 -126
  30. package/components/catalyst-ui/primitives/aspect-ratio.tsx +0 -9
  31. package/components/catalyst-ui/primitives/avatar.tsx +0 -296
  32. package/components/catalyst-ui/primitives/badge.tsx +0 -57
  33. package/components/catalyst-ui/primitives/breadcrumb.tsx +0 -101
  34. package/components/catalyst-ui/primitives/button.tsx +0 -265
  35. package/components/catalyst-ui/primitives/calendar-v4.tsx +0 -208
  36. package/components/catalyst-ui/primitives/calendar.tsx +0 -295
  37. package/components/catalyst-ui/primitives/card.tsx +0 -618
  38. package/components/catalyst-ui/primitives/carousel.tsx +0 -238
  39. package/components/catalyst-ui/primitives/chart.tsx +0 -347
  40. package/components/catalyst-ui/primitives/checkbox.tsx +0 -225
  41. package/components/catalyst-ui/primitives/collapsible.tsx +0 -212
  42. package/components/catalyst-ui/primitives/command.tsx +0 -393
  43. package/components/catalyst-ui/primitives/context-menu.tsx +0 -236
  44. package/components/catalyst-ui/primitives/dialog.tsx +0 -471
  45. package/components/catalyst-ui/primitives/drawer.tsx +0 -761
  46. package/components/catalyst-ui/primitives/dropdown-menu.tsx +0 -290
  47. package/components/catalyst-ui/primitives/empty.tsx +0 -104
  48. package/components/catalyst-ui/primitives/field.tsx +0 -244
  49. package/components/catalyst-ui/primitives/hover-card.tsx +0 -124
  50. package/components/catalyst-ui/primitives/input-otp.tsx +0 -76
  51. package/components/catalyst-ui/primitives/input.tsx +0 -64
  52. package/components/catalyst-ui/primitives/item.tsx +0 -196
  53. package/components/catalyst-ui/primitives/kbd.tsx +0 -75
  54. package/components/catalyst-ui/primitives/label.tsx +0 -24
  55. package/components/catalyst-ui/primitives/navigation-menu.tsx +0 -150
  56. package/components/catalyst-ui/primitives/pagination.tsx +0 -198
  57. package/components/catalyst-ui/primitives/popover.tsx +0 -232
  58. package/components/catalyst-ui/primitives/progress.tsx +0 -34
  59. package/components/catalyst-ui/primitives/radio-group.tsx +0 -43
  60. package/components/catalyst-ui/primitives/resizable.tsx +0 -56
  61. package/components/catalyst-ui/primitives/select.tsx +0 -155
  62. package/components/catalyst-ui/primitives/separator.tsx +0 -74
  63. package/components/catalyst-ui/primitives/sheet.tsx +0 -126
  64. package/components/catalyst-ui/primitives/skeleton.tsx +0 -15
  65. package/components/catalyst-ui/primitives/slider.tsx +0 -27
  66. package/components/catalyst-ui/primitives/switch.tsx +0 -187
  67. package/components/catalyst-ui/primitives/tabs.tsx +0 -335
  68. package/components/catalyst-ui/primitives/textarea.tsx +0 -24
  69. package/components/catalyst-ui/primitives/toggle-group.tsx +0 -55
  70. package/components/catalyst-ui/primitives/toggle.tsx +0 -42
  71. package/components/catalyst-ui/primitives/tooltip.tsx +0 -116
  72. package/components/catalyst-ui/utils/basic-auth.tsx +0 -40
  73. package/components/catalyst-ui/utils/context-storage.tsx +0 -19
  74. package/components/catalyst-ui/utils/cors-middleware.tsx +0 -71
  75. package/components/catalyst-ui/utils/deferred-content.tsx +0 -595
  76. package/components/catalyst-ui/utils/honeypot-middleware.tsx +0 -38
  77. package/components/catalyst-ui/utils/incId.tsx +0 -75
  78. package/components/catalyst-ui/utils/jwk-auth.tsx +0 -36
  79. package/components/catalyst-ui/utils/request-id.tsx +0 -14
  80. package/components/catalyst-ui/utils/secure-headers.tsx +0 -37
  81. package/components/catalyst-ui/utils/server-timing.tsx +0 -23
  82. package/components/catalyst-ui/utils/utils.ts +0 -43
  83. package/components/catalyst-ui/utils/with-cookie.tsx +0 -43
  84. package/components/catalyst-ui/x/accordian-x.tsx +0 -428
  85. package/components/catalyst-ui/x/alert-x.tsx +0 -413
  86. package/components/catalyst-ui/x/animated-text-x.tsx +0 -2242
  87. package/components/catalyst-ui/x/avatar-x.tsx +0 -515
  88. package/components/catalyst-ui/x/badge-x.tsx +0 -670
  89. package/components/catalyst-ui/x/button-X.tsx +0 -2857
  90. package/components/catalyst-ui/x/button-group-x.tsx +0 -847
  91. package/components/catalyst-ui/x/calendar-x.tsx +0 -1910
  92. package/components/catalyst-ui/x/card-x.tsx +0 -2597
  93. package/components/catalyst-ui/x/checkbox-x.tsx +0 -656
  94. package/components/catalyst-ui/x/collapsible-x.tsx +0 -1360
  95. package/components/catalyst-ui/x/combobox-x.tsx +0 -911
  96. package/components/catalyst-ui/x/data-table-x.tsx +0 -1753
  97. package/components/catalyst-ui/x/date-picker-x.tsx +0 -648
  98. package/components/catalyst-ui/x/dialog-x.tsx +0 -659
  99. package/components/catalyst-ui/x/dropdown-menu-x.tsx +0 -612
  100. package/components/catalyst-ui/x/hover-card-x.tsx +0 -375
  101. package/components/catalyst-ui/x/icon-x.tsx +0 -840
  102. package/components/catalyst-ui/x/input-mask-x.tsx +0 -981
  103. package/components/catalyst-ui/x/input-otp-x.tsx +0 -659
  104. package/components/catalyst-ui/x/loader-x.tsx +0 -1757
  105. package/components/catalyst-ui/x/pagination-x.tsx +0 -622
  106. package/components/catalyst-ui/x/popover-x.tsx +0 -744
  107. package/components/catalyst-ui/x/radio-group-x.tsx +0 -499
  108. package/components/catalyst-ui/x/select-x.tsx +0 -1127
  109. package/components/catalyst-ui/x/sheet-x.tsx +0 -668
  110. package/components/catalyst-ui/x/switch-x.tsx +0 -681
  111. package/components/catalyst-ui/x/table-x.tsx +0 -574
  112. package/components/catalyst-ui/x/tabs-x.tsx +0 -839
  113. package/components/catalyst-ui/x/textarea-x.tsx +0 -1263
  114. package/components/catalyst-ui/x/tooltip-x.tsx +0 -396
  115. package/components/catalyst-ui/x/tracker-x.tsx +0 -560
  116. package/data/bg-data.tsx +0 -901
  117. package/data/buttons-data.tsx +0 -2327
  118. package/data/charts-data.tsx +0 -102
  119. package/data/chat-data.tsx +0 -83
  120. package/data/code-data.tsx +0 -1040
  121. package/data/comboboxes-data.tsx +0 -1843
  122. package/data/command-data.tsx +0 -1381
  123. package/data/core-data.tsx +0 -15953
  124. package/data/crm-data.tsx +0 -47
  125. package/data/data.tsx +0 -159
  126. package/data/date-and-time-data.tsx +0 -554
  127. package/data/dependencies.tsx +0 -7
  128. package/data/ecommerce-data.tsx +0 -1387
  129. package/data/forms-data.tsx +0 -7890
  130. package/data/hooks-data.tsx +0 -5487
  131. package/data/index.ts +0 -34
  132. package/data/inputs-data.tsx +0 -557
  133. package/data/interactive-data.tsx +0 -5394
  134. package/data/lofi-data.tsx +0 -18295
  135. package/data/marketing-data.tsx +0 -2546
  136. package/data/media-data.tsx +0 -1510
  137. package/data/motion-data.tsx +0 -5801
  138. package/data/overlay-data.tsx +0 -4136
  139. package/data/pdf-data.tsx +0 -124
  140. package/data/pos-data.tsx +0 -213
  141. package/data/postcss.config.js +0 -6
  142. package/data/primitive-data.tsx +0 -5170
  143. package/data/prompt-data.tsx +0 -1226
  144. package/data/requiredLibs.ts +0 -4
  145. package/data/sandbox-data.tsx +0 -1
  146. package/data/sidebars-data.tsx +0 -5421
  147. package/data/stacks-data.tsx +0 -32
  148. package/data/table-data.tsx +0 -706
  149. package/data/tailwind.config.js +0 -270
  150. package/data/tailwind.config.ngin.js +0 -3830
  151. package/data/tailwind.css +0 -431
  152. package/data/tools-data.tsx +0 -6910
  153. package/data/typography-data.tsx +0 -2050
  154. package/data/utils-data.tsx +0 -6500
  155. package/data/x-data.tsx +0 -1171
@@ -1,648 +0,0 @@
1
- /**
2
-
3
-
4
-
5
-
6
-
7
-
8
- export function DatePickerX({ datePicker = 'default', children, ...props }: any) {
9
- switch (datePicker) {
10
- case 'Closable':
11
- break
12
- default:
13
- break;
14
- }
15
- }
16
-
17
- const DatePickerDemo = () => {
18
- const [open, setOpen] = useState(false)
19
- const [date, setDate] = useState<Date | undefined>(undefined)
20
-
21
- return (
22
- <div className='w-full max-w-xs space-y-2'>
23
- <Label htmlFor='date' className='px-1'>
24
- Date picker
25
- </Label>
26
- <Popover open={open} onOpenChange={setOpen}>
27
- <PopoverTrigger asChild>
28
- <Button variant='outline' id='date' className='w-full justify-between font-normal'>
29
- {date ? date.toLocaleDateString() : 'Pick a date'}
30
- <ChevronDownIcon />
31
- </Button>
32
- </PopoverTrigger>
33
- <PopoverContent className='w-auto overflow-hidden p-0' align='start'>
34
- <Calendar
35
- mode='single'
36
- selected={date}
37
- onSelect={date => {
38
- setDate(date)
39
- setOpen(false)
40
- }}
41
- />
42
- </PopoverContent>
43
- </Popover>
44
- </div>
45
- )
46
- }
47
-
48
- const DatePickerRangeDemo = () => {
49
- const [range, setRange] = useState<DateRange | undefined>(undefined)
50
-
51
- return (
52
- <div className='w-full max-w-xs space-y-2'>
53
- <Label htmlFor='dates' className='px-1'>
54
- Range date picker
55
- </Label>
56
- <Popover>
57
- <PopoverTrigger asChild>
58
- <Button variant='outline' id='dates' className='w-full justify-between font-normal'>
59
- {range?.from && range?.to
60
- ? `${range.from.toLocaleDateString()} - ${range.to.toLocaleDateString()}`
61
- : 'Pick a date'}
62
- <ChevronDownIcon />
63
- </Button>
64
- </PopoverTrigger>
65
- <PopoverContent className='w-auto overflow-hidden p-0' align='start'>
66
- <Calendar
67
- mode='range'
68
- selected={range}
69
- onSelect={range => {
70
- setRange(range)
71
- }}
72
- />
73
- </PopoverContent>
74
- </Popover>
75
- </div>
76
- )
77
- }
78
-
79
- const DatePickerWithIconDemo = () => {
80
- const [open, setOpen] = useState(false)
81
- const [date, setDate] = useState<Date | undefined>(undefined)
82
-
83
- return (
84
- <div className='w-full max-w-xs space-y-2'>
85
- <Label htmlFor='date' className='px-1'>
86
- Date picker with icon
87
- </Label>
88
- <Popover open={open} onOpenChange={setOpen}>
89
- <PopoverTrigger asChild>
90
- <Button variant='outline' id='date' className='w-full justify-between font-normal'>
91
- <span className='flex items-center'>
92
- <CalendarIcon className='mr-2' />
93
- {date ? date.toLocaleDateString() : 'Pick a date'}
94
- </span>
95
- <ChevronDownIcon />
96
- </Button>
97
- </PopoverTrigger>
98
- <PopoverContent className='w-auto overflow-hidden p-0' align='start'>
99
- <Calendar
100
- mode='single'
101
- selected={date}
102
- onSelect={date => {
103
- setDate(date)
104
- setOpen(false)
105
- }}
106
- />
107
- </PopoverContent>
108
- </Popover>
109
- </div>
110
- )
111
- }
112
-
113
- const DatePickerWithinInputDemo = () => {
114
- const [open, setOpen] = useState(false)
115
- const [date, setDate] = useState<Date | undefined>(new Date())
116
- const [month, setMonth] = useState<Date | undefined>(date)
117
- const [value, setValue] = useState(formatDate(date))
118
-
119
- return (
120
- <div className='w-full max-w-xs space-y-2'>
121
- <Label htmlFor='date' className='px-1'>
122
- Date picker within input
123
- </Label>
124
- <div className='relative flex gap-2'>
125
- <Input
126
- id='date'
127
- value={value}
128
- placeholder='January 01, 2025'
129
- className='bg-background pr-10'
130
- onChange={e => {
131
- const date = new Date(e.target.value)
132
-
133
- setValue(e.target.value)
134
-
135
- if (isValidDate(date)) {
136
- setDate(date)
137
- setMonth(date)
138
- }
139
- }}
140
- onKeyDown={e => {
141
- if (e.key === 'ArrowDown') {
142
- e.preventDefault()
143
- setOpen(true)
144
- }
145
- }}
146
- />
147
- <Popover open={open} onOpenChange={setOpen}>
148
- <PopoverTrigger asChild>
149
- <Button id='date-picker' variant='ghost' className='absolute top-1/2 right-2 size-6 -translate-y-1/2'>
150
- <CalendarIcon className='size-3.5' />
151
- <span className='sr-only'>Pick a date</span>
152
- </Button>
153
- </PopoverTrigger>
154
- <PopoverContent className='w-auto overflow-hidden p-0' align='end' alignOffset={-8} sideOffset={10}>
155
- <Calendar
156
- mode='single'
157
- selected={date}
158
- month={month}
159
- onMonthChange={setMonth}
160
- onSelect={date => {
161
- setDate(date)
162
- setValue(formatDate(date))
163
- setOpen(false)
164
- }}
165
- />
166
- </PopoverContent>
167
- </Popover>
168
- </div>
169
- </div>
170
- )
171
- }
172
-
173
- const DatePickerWithNaturalLanguageDemo = () => {
174
- const [open, setOpen] = useState(false)
175
- const [value, setValue] = useState('In 2 days')
176
- const [date, setDate] = useState<Date | undefined>(parseDate(value) || undefined)
177
- const [month, setMonth] = useState<Date | undefined>(date)
178
-
179
- return (
180
- <div className='w-full max-w-xs space-y-2'>
181
- <Label htmlFor='date' className='px-1'>
182
- Date picker with natural language input
183
- </Label>
184
- <div className='relative flex gap-2'>
185
- <Input
186
- id='date'
187
- value={value}
188
- placeholder='Tomorrow or next week'
189
- className='bg-background pr-10'
190
- onChange={e => {
191
- setValue(e.target.value)
192
- const date = parseDate(e.target.value)
193
-
194
- if (date) {
195
- setDate(date)
196
- setMonth(date)
197
- }
198
- }}
199
- onKeyDown={e => {
200
- if (e.key === 'ArrowDown') {
201
- e.preventDefault()
202
- setOpen(true)
203
- }
204
- }}
205
- />
206
- <Popover open={open} onOpenChange={setOpen}>
207
- <PopoverTrigger asChild>
208
- <Button id='date-picker' variant='ghost' className='absolute top-1/2 right-2 size-6 -translate-y-1/2'>
209
- <CalendarIcon className='size-3.5' />
210
- <span className='sr-only'>Pick a date</span>
211
- </Button>
212
- </PopoverTrigger>
213
- <PopoverContent className='w-auto overflow-hidden p-0' align='end' alignOffset={-8} sideOffset={10}>
214
- <Calendar
215
- mode='single'
216
- selected={date}
217
- month={month}
218
- onMonthChange={setMonth}
219
- onSelect={date => {
220
- setDate(date)
221
- setValue(formatDate(date))
222
- setOpen(false)
223
- }}
224
- />
225
- </PopoverContent>
226
- </Popover>
227
- </div>
228
- <div className='text-muted-foreground px-1 text-sm'>
229
- Your post will be published on <span className='font-medium'>{formatDate(date)}</span>.
230
- </div>
231
- </div>
232
- )
233
- }
234
-
235
- const DatePickerWithShortDateDisplayDemo = () => {
236
- const [range, setRange] = useState<DateRange | undefined>({
237
- from: new Date(2025, 10, 20),
238
- to: new Date(2025, 10, 24)
239
- })
240
-
241
- return (
242
- <div className='w-full max-w-xs space-y-2'>
243
- <Label htmlFor='dates' className='px-1'>
244
- Date picker with short date
245
- </Label>
246
- <Popover>
247
- <PopoverTrigger asChild>
248
- <Button variant='outline' id='dates' className='w-full justify-between font-normal'>
249
- {range?.from && range?.to
250
- ? formatDateRange(range.from, range.to, {
251
- includeTime: false
252
- })
253
- : 'Pick a date'}
254
- <ChevronDownIcon />
255
- </Button>
256
- </PopoverTrigger>
257
- <PopoverContent className='w-auto overflow-hidden p-0' align='start'>
258
- <Calendar
259
- mode='range'
260
- selected={range}
261
- onSelect={range => {
262
- setRange(range)
263
- }}
264
- />
265
- </PopoverContent>
266
- </Popover>
267
- </div>
268
- )
269
- }
270
-
271
- const DatePickerDisableOutsideDaysDemo = () => {
272
- const [open, setOpen] = useState(false)
273
- const [date, setDate] = useState<Date | undefined>(undefined)
274
-
275
- return (
276
- <div className='w-full max-w-xs space-y-2'>
277
- <Label htmlFor='date' className='px-1'>
278
- Disable outside days
279
- </Label>
280
- <Popover open={open} onOpenChange={setOpen}>
281
- <PopoverTrigger asChild>
282
- <Button variant='outline' id='date' className='w-full justify-between font-normal'>
283
- {date ? date.toLocaleDateString() : 'Pick a date'}
284
- <ChevronDownIcon />
285
- </Button>
286
- </PopoverTrigger>
287
- <PopoverContent className='w-auto overflow-hidden p-0' align='start'>
288
- <Calendar
289
- mode='single'
290
- selected={date}
291
- showOutsideDays={false}
292
- onSelect={date => {
293
- setDate(date)
294
- setOpen(false)
295
- }}
296
- />
297
- </PopoverContent>
298
- </Popover>
299
- </div>
300
- )
301
- }
302
-
303
- const DatePickerDemo = () => {
304
- return (
305
- <div className='w-full max-w-xs space-y-2'>
306
- <Label htmlFor='time-picker' className='px-1'>
307
- Time input
308
- </Label>
309
- <Input
310
- type='time'
311
- id='time-picker'
312
- step='1'
313
- defaultValue='08:30:00'
314
- className='bg-background appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none'
315
- />
316
- </div>
317
- )
318
- }
319
-
320
- const TimePickerWithIconDemo = () => {
321
- return (
322
- <div className='w-full max-w-xs space-y-2'>
323
- <Label htmlFor='timepicker'>Time input with start icon</Label>
324
- <div className='relative'>
325
- <div className='text-muted-foreground pointer-events-none absolute inset-y-0 left-0 flex items-center justify-center pl-3 peer-disabled:opacity-50'>
326
- <Clock8Icon className='size-4' />
327
- <span className='sr-only'>User</span>
328
- </div>
329
- <Input
330
- type='time'
331
- id='time-picker'
332
- step='1'
333
- defaultValue='08:30:00'
334
- className='peer bg-background appearance-none pl-9 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none'
335
- />
336
- </div>
337
- </div>
338
- )
339
- }
340
-
341
- const DatePickerAndTimePickerDemo = () => {
342
- const [open, setOpen] = useState(false)
343
- const [date, setDate] = useState<Date | undefined>(undefined)
344
-
345
- return (
346
- <div className='flex gap-4'>
347
- <div className='flex flex-col gap-3'>
348
- <Label htmlFor='date-picker' className='px-1'>
349
- Date picker
350
- </Label>
351
- <Popover open={open} onOpenChange={setOpen}>
352
- <PopoverTrigger asChild>
353
- <Button variant='outline' id='date-picker' className='justify-between font-normal'>
354
- {date ? date.toLocaleDateString() : 'Pick a date'}
355
- <ChevronDownIcon />
356
- </Button>
357
- </PopoverTrigger>
358
- <PopoverContent className='w-auto overflow-hidden p-0' align='start'>
359
- <Calendar
360
- mode='single'
361
- selected={date}
362
- onSelect={date => {
363
- setDate(date)
364
- setOpen(false)
365
- }}
366
- />
367
- </PopoverContent>
368
- </Popover>
369
- </div>
370
- <div className='flex flex-col gap-3'>
371
- <Label htmlFor='time-picker' className='px-1'>
372
- Time input
373
- </Label>
374
- <Input
375
- type='time'
376
- id='time-picker'
377
- step='1'
378
- defaultValue='06:30:00'
379
- className='bg-background appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none'
380
- />
381
- </div>
382
- </div>
383
- )
384
- }
385
-
386
- const DatePickerAndTimeRangePicker = () => {
387
- const [open, setOpen] = useState(false)
388
- const [date, setDate] = useState<Date | undefined>(undefined)
389
-
390
- return (
391
- <div className='flex flex-col gap-6'>
392
- <div className='flex w-full max-w-xs flex-col gap-3'>
393
- <Label htmlFor='date' className='px-1'>
394
- Date
395
- </Label>
396
- <Popover open={open} onOpenChange={setOpen}>
397
- <PopoverTrigger asChild>
398
- <Button variant='outline' id='date' className='w-full justify-between font-normal'>
399
- {date ? date.toLocaleDateString() : 'Pick a date'}
400
- <ChevronDownIcon />
401
- </Button>
402
- </PopoverTrigger>
403
- <PopoverContent className='w-auto overflow-hidden p-0' align='start'>
404
- <Calendar
405
- mode='single'
406
- selected={date}
407
- onSelect={date => {
408
- setDate(date)
409
- setOpen(false)
410
- }}
411
- />
412
- </PopoverContent>
413
- </Popover>
414
- </div>
415
- <div className='flex gap-4'>
416
- <div className='flex flex-col gap-3'>
417
- <Label htmlFor='time-from' className='px-1'>
418
- From
419
- </Label>
420
- <Input
421
- type='time'
422
- id='time-from'
423
- step='1'
424
- defaultValue='01:30:00'
425
- className='bg-background appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none'
426
- />
427
- </div>
428
- <div className='flex flex-col gap-3'>
429
- <Label htmlFor='time-to' className='px-1'>
430
- To
431
- </Label>
432
- <Input
433
- type='time'
434
- id='time-to'
435
- step='1'
436
- defaultValue='02:30:00'
437
- className='bg-background appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none'
438
- />
439
- </div>
440
- </div>
441
- </div>
442
- )
443
- }
444
-
445
- const DatePickerRangeAndTimePickerDemo = () => {
446
- const [openFrom, setOpenFrom] = useState(false)
447
- const [openTo, setOpenTo] = useState(false)
448
- const [dateFrom, setDateFrom] = useState<Date | undefined>(new Date('2025-06-18'))
449
- const [dateTo, setDateTo] = useState<Date | undefined>(new Date('2025-06-25'))
450
-
451
- return (
452
- <div className='flex w-full max-w-64 min-w-0 flex-col gap-6'>
453
- <div className='flex gap-4'>
454
- <div className='flex flex-1 flex-col gap-3'>
455
- <Label htmlFor='date-from' className='px-1'>
456
- Departure date
457
- </Label>
458
- <Popover open={openFrom} onOpenChange={setOpenFrom}>
459
- <PopoverTrigger asChild>
460
- <Button variant='outline' id='date-from' className='w-full justify-between font-normal'>
461
- {dateFrom
462
- ? dateFrom.toLocaleDateString('en-US', {
463
- day: '2-digit',
464
- month: 'short',
465
- year: 'numeric'
466
- })
467
- : 'Pick a date'}
468
- <ChevronDownIcon />
469
- </Button>
470
- </PopoverTrigger>
471
- <PopoverContent className='w-auto overflow-hidden p-0' align='start'>
472
- <Calendar
473
- mode='single'
474
- selected={dateFrom}
475
- onSelect={date => {
476
- setDateFrom(date)
477
- setOpenFrom(false)
478
- }}
479
- />
480
- </PopoverContent>
481
- </Popover>
482
- </div>
483
- <div className='flex flex-col gap-3'>
484
- <Label htmlFor='time-from' className='invisible px-1'>
485
- From
486
- </Label>
487
- <Input
488
- type='time'
489
- id='time-from'
490
- step='1'
491
- defaultValue='09:30:00'
492
- className='bg-background appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none'
493
- />
494
- </div>
495
- </div>
496
- <div className='flex gap-4'>
497
- <div className='flex flex-1 flex-col gap-3'>
498
- <Label htmlFor='date-to' className='px-1'>
499
- Return date
500
- </Label>
501
- <Popover open={openTo} onOpenChange={setOpenTo}>
502
- <PopoverTrigger asChild>
503
- <Button variant='outline' id='date-to' className='w-full justify-between font-normal'>
504
- {dateTo
505
- ? dateTo.toLocaleDateString('en-US', {
506
- day: '2-digit',
507
- month: 'short',
508
- year: 'numeric'
509
- })
510
- : 'Pick a date'}
511
- <ChevronDownIcon />
512
- </Button>
513
- </PopoverTrigger>
514
- <PopoverContent className='w-auto overflow-hidden p-0' align='start'>
515
- <Calendar
516
- mode='single'
517
- selected={dateTo}
518
- captionLayout='dropdown'
519
- onSelect={date => {
520
- setDateTo(date)
521
- setOpenTo(false)
522
- }}
523
- disabled={dateFrom && { before: dateFrom }}
524
- />
525
- </PopoverContent>
526
- </Popover>
527
- </div>
528
- <div className='flex flex-col gap-3'>
529
- <Label htmlFor='time-to' className='invisible px-1'>
530
- To
531
- </Label>
532
- <Input
533
- type='time'
534
- id='time-to'
535
- step='1'
536
- defaultValue='18:30:00'
537
- className='bg-background appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none'
538
- />
539
- </div>
540
- </div>
541
- </div>
542
- )
543
- }
544
-
545
- const ChartFilterDemo = () => {
546
- const [range, setRange] = useState<DateRange | undefined>({
547
- from: new Date(2025, 0, 1),
548
- to: new Date(2025, 0, 31)
549
- })
550
-
551
- const filteredData = useMemo(() => {
552
- if (!range?.from && !range?.to) {
553
- return chartData
554
- }
555
-
556
- return chartData.filter(item => {
557
- const date = new Date(item.date)
558
-
559
- return date >= range.from! && date <= range.to!
560
- })
561
- }, [range])
562
-
563
- return (
564
- <Card className='@container/card w-full max-w-xl'>
565
- <CardHeader className='flex flex-col border-b @md/card:grid'>
566
- <CardTitle>Web Analytics</CardTitle>
567
- <CardDescription>Showing total visitors for this month.</CardDescription>
568
- <CardAction className='mt-2 @md/card:mt-0'>
569
- <Popover>
570
- <PopoverTrigger asChild>
571
- <Button variant='outline'>
572
- <CalendarIcon />
573
- {range?.from && range?.to
574
- ? `${range.from.toLocaleDateString()} - ${range.to.toLocaleDateString()}`
575
- : 'January 2025'}
576
- </Button>
577
- </PopoverTrigger>
578
- <PopoverContent className='w-auto overflow-hidden p-0' align='end'>
579
- <Calendar
580
- className='w-full'
581
- mode='range'
582
- defaultMonth={range?.from}
583
- selected={range}
584
- onSelect={setRange}
585
- startMonth={range?.from}
586
- fixedWeeks
587
- showOutsideDays
588
- disabled={{
589
- after: new Date(2025, 0, 31),
590
- before: new Date(2025, 0, 1)
591
- }}
592
- />
593
- </PopoverContent>
594
- </Popover>
595
- </CardAction>
596
- </CardHeader>
597
- <CardContent className='px-4'>
598
- <ChartContainer config={chartConfig} className='aspect-auto h-62 w-full'>
599
- <BarChart
600
- accessibilityLayer
601
- data={filteredData}
602
- margin={{
603
- left: 12,
604
- right: 12
605
- }}
606
- >
607
- <CartesianGrid vertical={false} />
608
- <XAxis
609
- dataKey='date'
610
- tickLine={false}
611
- axisLine={false}
612
- tickMargin={8}
613
- minTickGap={20}
614
- tickFormatter={value => {
615
- const date = new Date(value)
616
-
617
- return date.toLocaleDateString('en-US', {
618
- day: 'numeric'
619
- })
620
- }}
621
- />
622
- <ChartTooltip
623
- content={
624
- <ChartTooltipContent
625
- className='w-[150px]'
626
- nameKey='visitors'
627
- labelFormatter={value => {
628
- return new Date(value).toLocaleDateString('en-US', {
629
- month: 'short',
630
- day: 'numeric',
631
- year: 'numeric'
632
- })
633
- }}
634
- />
635
- }
636
- />
637
- <Bar dataKey='visitors' fill={`var(--color-visitors)`} radius={4} />
638
- </BarChart>
639
- </ChartContainer>
640
- </CardContent>
641
- <CardFooter className='border-t'>
642
- <div className='text-sm'>
643
- You had <span className='font-semibold'>{total.toLocaleString()}</span> visitors for the month of January.
644
- </div>
645
- </CardFooter>
646
- </Card>
647
- )
648
- } */