@wealthx/shadcn 1.5.8 → 1.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wealthx/shadcn",
3
- "version": "1.5.8",
3
+ "version": "1.5.10",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./src/index.ts",
@@ -50,12 +50,15 @@ export interface AppointmentCalendarViewProps {
50
50
  weekDays: AppointmentWeekDay[];
51
51
  /** Hours displayed in day/week view — defaults to [9..17] */
52
52
  hours?: number[];
53
- /** ISO date used for Day view */
53
+ /** ISO date controlling which day/month is displayed — defaults to `today` */
54
+ viewDate?: string;
55
+ /** @deprecated Use `viewDate` instead */
54
56
  dayViewDate?: string;
55
57
  defaultView?: "day" | "week" | "month";
56
58
  onPrev?: () => void;
57
59
  onNext?: () => void;
58
60
  onToday?: () => void;
61
+ onViewChange?: (view: "day" | "week" | "month") => void;
59
62
  onSelectAppointment?: (apt: AppointmentCalendarItem) => void;
60
63
  /** Slot rendered in the calendar toolbar right side (e.g. pending request button + new appointment button) */
61
64
  toolbarActions?: ReactNode;
@@ -335,16 +338,17 @@ function generateMonthGrid(year: number, month: number): (Date | null)[][] {
335
338
 
336
339
  function MonthView({
337
340
  appointments,
341
+ viewDate,
338
342
  today,
339
343
  onSelectAppointment,
340
344
  }: {
341
345
  appointments: AppointmentCalendarItem[];
346
+ viewDate: string;
342
347
  today: string;
343
348
  onSelectAppointment?: (apt: AppointmentCalendarItem) => void;
344
349
  }) {
345
- // Derive year/month from today prop
346
- const todayDate = new Date(today + "T00:00:00");
347
- const grid = generateMonthGrid(todayDate.getFullYear(), todayDate.getMonth());
350
+ const vd = new Date(viewDate + "T00:00:00");
351
+ const grid = generateMonthGrid(vd.getFullYear(), vd.getMonth());
348
352
  // Use local date parts — toISOString() converts to UTC first, which shifts the
349
353
  // date back 1 day for UTC+ timezones (e.g. UTC+7 shows Thu booking on Wed cell).
350
354
  const toIso = (d: Date) =>
@@ -430,15 +434,17 @@ export function AppointmentCalendarView({
430
434
  periodLabel,
431
435
  weekDays,
432
436
  hours = DEFAULT_HOURS,
437
+ viewDate,
433
438
  dayViewDate,
434
439
  defaultView = "week",
435
440
  onPrev,
436
441
  onNext,
437
442
  onToday,
443
+ onViewChange,
438
444
  onSelectAppointment,
439
445
  toolbarActions,
440
446
  }: AppointmentCalendarViewProps) {
441
- const dayDate = dayViewDate ?? today;
447
+ const effectiveViewDate = viewDate ?? dayViewDate ?? today;
442
448
 
443
449
  return (
444
450
  <div className="flex flex-col border border-border bg-card">
@@ -473,7 +479,11 @@ export function AppointmentCalendarView({
473
479
 
474
480
  <Separator />
475
481
 
476
- <Tabs defaultValue={defaultView} className="flex flex-col">
482
+ <Tabs
483
+ defaultValue={defaultView}
484
+ onValueChange={(v) => onViewChange?.(v as "day" | "week" | "month")}
485
+ className="flex flex-col"
486
+ >
477
487
  <div className="px-4 pt-3">
478
488
  <TabsList>
479
489
  <TabsTrigger value="day">Day</TabsTrigger>
@@ -481,16 +491,16 @@ export function AppointmentCalendarView({
481
491
  <TabsTrigger value="month">Month</TabsTrigger>
482
492
  </TabsList>
483
493
  </div>
484
- <TabsContent value="day" className="mt-0">
494
+ <TabsContent value="day" className="mt-0 max-h-[75vh] overflow-y-auto">
485
495
  <DayView
486
496
  appointments={appointments}
487
- date={dayDate}
497
+ date={effectiveViewDate}
488
498
  today={today}
489
499
  hours={hours}
490
500
  onSelectAppointment={onSelectAppointment}
491
501
  />
492
502
  </TabsContent>
493
- <TabsContent value="week" className="mt-0">
503
+ <TabsContent value="week" className="mt-0 max-h-[75vh] overflow-y-auto">
494
504
  <WeekView
495
505
  appointments={appointments}
496
506
  weekDays={weekDays}
@@ -499,9 +509,13 @@ export function AppointmentCalendarView({
499
509
  onSelectAppointment={onSelectAppointment}
500
510
  />
501
511
  </TabsContent>
502
- <TabsContent value="month" className="mt-0">
512
+ <TabsContent
513
+ value="month"
514
+ className="mt-0 max-h-[75vh] overflow-y-auto"
515
+ >
503
516
  <MonthView
504
517
  appointments={appointments}
518
+ viewDate={effectiveViewDate}
505
519
  today={today}
506
520
  onSelectAppointment={onSelectAppointment}
507
521
  />