@idkwebsites/components 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
2
+ import { ReactNode, ComponentType } from 'react';
3
3
  import * as _tanstack_react_query from '@tanstack/react-query';
4
4
  import { DehydratedState, DefaultOptions, QueryClient } from '@tanstack/react-query';
5
+ import { Scissors } from 'lucide-react';
5
6
 
6
7
  interface PlatformProviderProps {
7
8
  apiKey: string;
@@ -201,6 +202,141 @@ declare function useCancelBooking(): _tanstack_react_query.UseMutationResult<{
201
202
  }, Error, BookingCancelInput, unknown>;
202
203
  declare function useBookingLookup(uid?: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<BookingLookup, Error>;
203
204
 
205
+ type Step = "service" | "staff" | "time" | "details" | "done";
206
+ interface UseBookingWidgetOptions {
207
+ /** Pre-fetched services — skips the API call when provided. */
208
+ services?: Service[];
209
+ /** Query params forwarded to `useServices` when services are not pre-fetched. */
210
+ servicesQuery?: ServicesQueryParams;
211
+ /** Query params forwarded to `useTeam`. */
212
+ teamQuery?: TeamQueryParams;
213
+ /** Client-side filter applied to the services list. */
214
+ serviceFilter?: (service: Service) => boolean;
215
+ /** Client-side filter applied to the staff list. */
216
+ teamFilter?: (member: StaffMember) => boolean;
217
+ /** Enable the staff-selection step. Default `true`. */
218
+ showStaffSelection?: boolean;
219
+ /** Automatically advance when user selects a card. Default `false`. */
220
+ autoAdvanceOnSelect?: boolean;
221
+ /** Scroll the widget container into view on step change. Default `true`. */
222
+ scrollToStep?: boolean;
223
+ /** Pixel offset for scroll-into-view. Default `96`. */
224
+ scrollOffset?: number;
225
+ /** Ref to the widget container element. Used for scroll-to-top. */
226
+ widgetRef?: React.RefObject<HTMLElement | null>;
227
+ /** Called after a booking is created successfully. */
228
+ onSuccess?: (booking: unknown) => void;
229
+ /** Number of days to fetch at a time in list date picker. Default `7`. */
230
+ availabilityDays?: number;
231
+ /** Enable prev/next date paging. Default `true`. */
232
+ enableDatePaging?: boolean;
233
+ /** Date picker mode: `"list"` or `"calendar"`. Default `"list"`. */
234
+ datePickerMode?: "list" | "calendar";
235
+ /** Calendar variant. Default `"default"`. */
236
+ calendarVariant?: "default" | "compact";
237
+ /** Max months in advance. Default `3`. */
238
+ maxAdvanceMonths?: number;
239
+ /** Weekday numbers (0-6) to disable. Default `[]`. */
240
+ disabledWeekdays?: number[];
241
+ /** Show "Fully booked" labels on calendar days. Default `true`. */
242
+ showFullyBookedLabel?: boolean;
243
+ /** Enable search input for service filtering. Default `true`. */
244
+ enableServiceSearch?: boolean;
245
+ /** Enable category filter dropdown. Default `false`. */
246
+ enableCategoryFilter?: boolean;
247
+ /** Max items per page for services before "show more". Default `10`. */
248
+ servicePageSize?: number;
249
+ /** Max items per page for staff before "show more". Default `8`. */
250
+ staffPageSize?: number;
251
+ /** Show "Any Available" option for staff. Default `true`. */
252
+ showAnyStaffOption?: boolean;
253
+ }
254
+ interface UseBookingWidgetReturn {
255
+ step: Step;
256
+ /** 1-based step number for progress display. */
257
+ stepNumber: number;
258
+ totalSteps: number;
259
+ selectedService: Service | null;
260
+ selectedStaff: StaffMember | null;
261
+ selectedDate: string | null;
262
+ selectedTime: string | null;
263
+ selectedEndTime: string | null;
264
+ details: {
265
+ name: string;
266
+ email: string;
267
+ phone: string;
268
+ notes: string;
269
+ };
270
+ servicesList: Service[];
271
+ filteredServices: Service[];
272
+ pagedServices: Service[];
273
+ hasMoreServices: boolean;
274
+ categories: string[];
275
+ staffOptions: StaffMember[];
276
+ pagedStaff: StaffMember[];
277
+ hasMoreStaff: boolean;
278
+ availabilityDates: AvailabilityDate[];
279
+ availabilityByDate: Map<string, AvailabilityDate>;
280
+ timeZone: string;
281
+ timeZoneLabel: string;
282
+ calendarMonth: Date;
283
+ calendarDays: Array<{
284
+ date: string;
285
+ isCurrentMonth: boolean;
286
+ }>;
287
+ hasBlockedInCalendarView: boolean;
288
+ maxAdvanceDate: Date | null;
289
+ maxAdvanceMonthStart: Date | null;
290
+ monthOptions: Array<{
291
+ value: string;
292
+ label: string;
293
+ date: Date;
294
+ }>;
295
+ isServicesLoading: boolean;
296
+ isAvailabilityLoading: boolean;
297
+ isSubmitting: boolean;
298
+ bookingError: string | null;
299
+ requiresStaff: boolean;
300
+ canSkipStaff: boolean;
301
+ serviceSearch: string;
302
+ categoryFilter: string;
303
+ servicePage: number;
304
+ staffPage: number;
305
+ availabilityStartDate: string;
306
+ formatDateLabel: (date: string) => string;
307
+ formatDateHeading: (date: string) => string;
308
+ formatTimeLabel: (iso: string) => string;
309
+ formatDuration: (minutes: number) => string;
310
+ setServiceSearch: (value: string) => void;
311
+ setCategoryFilter: (value: string) => void;
312
+ loadMoreServices: () => void;
313
+ loadMoreStaff: () => void;
314
+ selectService: (service: Service) => void;
315
+ selectStaff: (staff: StaffMember | null) => void;
316
+ selectDate: (date: string) => void;
317
+ selectTime: (time: string, endTime: string) => void;
318
+ setDetails: React.Dispatch<React.SetStateAction<{
319
+ name: string;
320
+ email: string;
321
+ phone: string;
322
+ notes: string;
323
+ }>>;
324
+ goToServiceStep: () => void;
325
+ continueFromService: () => void;
326
+ continueFromStaff: () => void;
327
+ continueFromTime: () => void;
328
+ submitBooking: (event?: React.FormEvent) => Promise<void>;
329
+ goBack: () => void;
330
+ reset: () => void;
331
+ scrollToTop: () => void;
332
+ handlePrevDates: () => void;
333
+ handleNextDates: () => void;
334
+ handlePrevMonth: () => void;
335
+ handleNextMonth: () => void;
336
+ handleMonthSelect: (value: string) => void;
337
+ }
338
+ declare function useBookingWidget(options?: UseBookingWidgetOptions): UseBookingWidgetReturn;
339
+
204
340
  interface ServicesListProps {
205
341
  layout?: 'grid' | 'list';
206
342
  columns?: number;
@@ -267,7 +403,7 @@ interface ContactFormProps {
267
403
  }
268
404
  declare function ContactForm({ fields, formType, submitLabel, className, onSuccess, onError, }: ContactFormProps): react_jsx_runtime.JSX.Element;
269
405
 
270
- interface BookingWidgetProps {
406
+ interface BookingWidgetProps$1 {
271
407
  className?: string;
272
408
  showStaffSelection?: boolean;
273
409
  onSuccess?: (booking: unknown) => void;
@@ -304,7 +440,34 @@ interface BookingWidgetProps {
304
440
  disabledWeekdays?: number[];
305
441
  showFullyBookedLabel?: boolean;
306
442
  }
307
- declare function BookingWidget({ className, showStaffSelection, onSuccess, services, servicesQuery, teamQuery, serviceFilter, teamFilter, title, subtitle, autoAdvanceOnSelect, scrollToStep, scrollOffset, enableServiceSearch, serviceSearchPlaceholder, enableCategoryFilter, categoryLabel, serviceListMaxHeight, serviceLayout, serviceColumns, servicePageSize, showServicePagination, staffLayout, staffColumns, showAnyStaffOption, staffPageSize, showStaffPagination, timeLayout, availabilityDays: availabilityDaysProp, enableDatePaging, datePickerMode, calendarVariant, maxAdvanceMonths, disabledWeekdays, showFullyBookedLabel, }: BookingWidgetProps): react_jsx_runtime.JSX.Element;
443
+ declare function BookingWidget({ className, title, subtitle, serviceSearchPlaceholder, categoryLabel, serviceListMaxHeight, serviceLayout, serviceColumns, showServicePagination, staffLayout, staffColumns, showStaffPagination, timeLayout, showFullyBookedLabel, calendarVariant, enableServiceSearch, enableCategoryFilter, enableDatePaging, disabledWeekdays, ...hookProps }: BookingWidgetProps$1): react_jsx_runtime.JSX.Element;
444
+
445
+ interface BookingWidgetProps {
446
+ /** Navigation links shown in the mobile menu overlay. Omit to hide hamburger. */
447
+ navLinks?: {
448
+ label: string;
449
+ href: string;
450
+ }[];
451
+ /** Custom icon for the mobile menu open button (default: lucide Menu) */
452
+ menuIcon?: ReactNode;
453
+ /** Custom icon for the mobile menu close button (default: lucide X) */
454
+ closeIcon?: ReactNode;
455
+ /** Override the category → icon mapping (keyword → React component) */
456
+ categoryIcons?: Record<string, typeof Scissors>;
457
+ /** Override step titles for mobile flow */
458
+ stepTitles?: [string, string, string, string];
459
+ /**
460
+ * Link component for mobile nav. Defaults to a plain `<a>` tag.
461
+ * Next.js sites should pass `Link` from `next/link` for client-side navigation.
462
+ */
463
+ linkComponent?: ComponentType<{
464
+ href: string;
465
+ className?: string;
466
+ onClick?: () => void;
467
+ children: ReactNode;
468
+ }>;
469
+ }
470
+ declare function BookingWidgetPanel({ navLinks, menuIcon, closeIcon, categoryIcons, stepTitles, linkComponent: LinkComp, }?: BookingWidgetProps): react_jsx_runtime.JSX.Element;
308
471
 
309
472
  interface AvailabilityPickerProps {
310
473
  serviceId: string;
@@ -352,4 +515,4 @@ interface TimePickerProps {
352
515
  }
353
516
  declare function TimePicker({ slots, selectedTime, onSelect, className, }: TimePickerProps): react_jsx_runtime.JSX.Element;
354
517
 
355
- export { AvailabilityPicker, type AvailabilityResult, type BookingCancelInput, type BookingCreateInput, type BookingLookup, BookingWidget, ContactForm, type ContactSubmissionInput, DatePicker, PlatformProvider, type Service, ServiceCard, ServicePicker, ServicesList, type ServicesQueryParams, type StaffMember, StaffPicker, TeamGrid, TeamMember, type TeamQueryParams, type TenantInfo, TimePicker, useAvailability, useBookingLookup, useCancelBooking, useCreateBooking, useServices, useTeam, useTenant };
518
+ export { AvailabilityPicker, type AvailabilityResult, type BookingCancelInput, type BookingCreateInput, type BookingLookup, BookingWidget, BookingWidgetPanel, type BookingWidgetProps, ContactForm, type ContactSubmissionInput, DatePicker, PlatformProvider, type Service, ServiceCard, ServicePicker, ServicesList, type ServicesQueryParams, type StaffMember, StaffPicker, TeamGrid, TeamMember, type TeamQueryParams, type TenantInfo, TimePicker, type UseBookingWidgetOptions, type UseBookingWidgetReturn, useAvailability, useBookingLookup, useBookingWidget, useCancelBooking, useCreateBooking, useServices, useTeam, useTenant };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
2
+ import { ReactNode, ComponentType } from 'react';
3
3
  import * as _tanstack_react_query from '@tanstack/react-query';
4
4
  import { DehydratedState, DefaultOptions, QueryClient } from '@tanstack/react-query';
5
+ import { Scissors } from 'lucide-react';
5
6
 
6
7
  interface PlatformProviderProps {
7
8
  apiKey: string;
@@ -201,6 +202,141 @@ declare function useCancelBooking(): _tanstack_react_query.UseMutationResult<{
201
202
  }, Error, BookingCancelInput, unknown>;
202
203
  declare function useBookingLookup(uid?: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<BookingLookup, Error>;
203
204
 
205
+ type Step = "service" | "staff" | "time" | "details" | "done";
206
+ interface UseBookingWidgetOptions {
207
+ /** Pre-fetched services — skips the API call when provided. */
208
+ services?: Service[];
209
+ /** Query params forwarded to `useServices` when services are not pre-fetched. */
210
+ servicesQuery?: ServicesQueryParams;
211
+ /** Query params forwarded to `useTeam`. */
212
+ teamQuery?: TeamQueryParams;
213
+ /** Client-side filter applied to the services list. */
214
+ serviceFilter?: (service: Service) => boolean;
215
+ /** Client-side filter applied to the staff list. */
216
+ teamFilter?: (member: StaffMember) => boolean;
217
+ /** Enable the staff-selection step. Default `true`. */
218
+ showStaffSelection?: boolean;
219
+ /** Automatically advance when user selects a card. Default `false`. */
220
+ autoAdvanceOnSelect?: boolean;
221
+ /** Scroll the widget container into view on step change. Default `true`. */
222
+ scrollToStep?: boolean;
223
+ /** Pixel offset for scroll-into-view. Default `96`. */
224
+ scrollOffset?: number;
225
+ /** Ref to the widget container element. Used for scroll-to-top. */
226
+ widgetRef?: React.RefObject<HTMLElement | null>;
227
+ /** Called after a booking is created successfully. */
228
+ onSuccess?: (booking: unknown) => void;
229
+ /** Number of days to fetch at a time in list date picker. Default `7`. */
230
+ availabilityDays?: number;
231
+ /** Enable prev/next date paging. Default `true`. */
232
+ enableDatePaging?: boolean;
233
+ /** Date picker mode: `"list"` or `"calendar"`. Default `"list"`. */
234
+ datePickerMode?: "list" | "calendar";
235
+ /** Calendar variant. Default `"default"`. */
236
+ calendarVariant?: "default" | "compact";
237
+ /** Max months in advance. Default `3`. */
238
+ maxAdvanceMonths?: number;
239
+ /** Weekday numbers (0-6) to disable. Default `[]`. */
240
+ disabledWeekdays?: number[];
241
+ /** Show "Fully booked" labels on calendar days. Default `true`. */
242
+ showFullyBookedLabel?: boolean;
243
+ /** Enable search input for service filtering. Default `true`. */
244
+ enableServiceSearch?: boolean;
245
+ /** Enable category filter dropdown. Default `false`. */
246
+ enableCategoryFilter?: boolean;
247
+ /** Max items per page for services before "show more". Default `10`. */
248
+ servicePageSize?: number;
249
+ /** Max items per page for staff before "show more". Default `8`. */
250
+ staffPageSize?: number;
251
+ /** Show "Any Available" option for staff. Default `true`. */
252
+ showAnyStaffOption?: boolean;
253
+ }
254
+ interface UseBookingWidgetReturn {
255
+ step: Step;
256
+ /** 1-based step number for progress display. */
257
+ stepNumber: number;
258
+ totalSteps: number;
259
+ selectedService: Service | null;
260
+ selectedStaff: StaffMember | null;
261
+ selectedDate: string | null;
262
+ selectedTime: string | null;
263
+ selectedEndTime: string | null;
264
+ details: {
265
+ name: string;
266
+ email: string;
267
+ phone: string;
268
+ notes: string;
269
+ };
270
+ servicesList: Service[];
271
+ filteredServices: Service[];
272
+ pagedServices: Service[];
273
+ hasMoreServices: boolean;
274
+ categories: string[];
275
+ staffOptions: StaffMember[];
276
+ pagedStaff: StaffMember[];
277
+ hasMoreStaff: boolean;
278
+ availabilityDates: AvailabilityDate[];
279
+ availabilityByDate: Map<string, AvailabilityDate>;
280
+ timeZone: string;
281
+ timeZoneLabel: string;
282
+ calendarMonth: Date;
283
+ calendarDays: Array<{
284
+ date: string;
285
+ isCurrentMonth: boolean;
286
+ }>;
287
+ hasBlockedInCalendarView: boolean;
288
+ maxAdvanceDate: Date | null;
289
+ maxAdvanceMonthStart: Date | null;
290
+ monthOptions: Array<{
291
+ value: string;
292
+ label: string;
293
+ date: Date;
294
+ }>;
295
+ isServicesLoading: boolean;
296
+ isAvailabilityLoading: boolean;
297
+ isSubmitting: boolean;
298
+ bookingError: string | null;
299
+ requiresStaff: boolean;
300
+ canSkipStaff: boolean;
301
+ serviceSearch: string;
302
+ categoryFilter: string;
303
+ servicePage: number;
304
+ staffPage: number;
305
+ availabilityStartDate: string;
306
+ formatDateLabel: (date: string) => string;
307
+ formatDateHeading: (date: string) => string;
308
+ formatTimeLabel: (iso: string) => string;
309
+ formatDuration: (minutes: number) => string;
310
+ setServiceSearch: (value: string) => void;
311
+ setCategoryFilter: (value: string) => void;
312
+ loadMoreServices: () => void;
313
+ loadMoreStaff: () => void;
314
+ selectService: (service: Service) => void;
315
+ selectStaff: (staff: StaffMember | null) => void;
316
+ selectDate: (date: string) => void;
317
+ selectTime: (time: string, endTime: string) => void;
318
+ setDetails: React.Dispatch<React.SetStateAction<{
319
+ name: string;
320
+ email: string;
321
+ phone: string;
322
+ notes: string;
323
+ }>>;
324
+ goToServiceStep: () => void;
325
+ continueFromService: () => void;
326
+ continueFromStaff: () => void;
327
+ continueFromTime: () => void;
328
+ submitBooking: (event?: React.FormEvent) => Promise<void>;
329
+ goBack: () => void;
330
+ reset: () => void;
331
+ scrollToTop: () => void;
332
+ handlePrevDates: () => void;
333
+ handleNextDates: () => void;
334
+ handlePrevMonth: () => void;
335
+ handleNextMonth: () => void;
336
+ handleMonthSelect: (value: string) => void;
337
+ }
338
+ declare function useBookingWidget(options?: UseBookingWidgetOptions): UseBookingWidgetReturn;
339
+
204
340
  interface ServicesListProps {
205
341
  layout?: 'grid' | 'list';
206
342
  columns?: number;
@@ -267,7 +403,7 @@ interface ContactFormProps {
267
403
  }
268
404
  declare function ContactForm({ fields, formType, submitLabel, className, onSuccess, onError, }: ContactFormProps): react_jsx_runtime.JSX.Element;
269
405
 
270
- interface BookingWidgetProps {
406
+ interface BookingWidgetProps$1 {
271
407
  className?: string;
272
408
  showStaffSelection?: boolean;
273
409
  onSuccess?: (booking: unknown) => void;
@@ -304,7 +440,34 @@ interface BookingWidgetProps {
304
440
  disabledWeekdays?: number[];
305
441
  showFullyBookedLabel?: boolean;
306
442
  }
307
- declare function BookingWidget({ className, showStaffSelection, onSuccess, services, servicesQuery, teamQuery, serviceFilter, teamFilter, title, subtitle, autoAdvanceOnSelect, scrollToStep, scrollOffset, enableServiceSearch, serviceSearchPlaceholder, enableCategoryFilter, categoryLabel, serviceListMaxHeight, serviceLayout, serviceColumns, servicePageSize, showServicePagination, staffLayout, staffColumns, showAnyStaffOption, staffPageSize, showStaffPagination, timeLayout, availabilityDays: availabilityDaysProp, enableDatePaging, datePickerMode, calendarVariant, maxAdvanceMonths, disabledWeekdays, showFullyBookedLabel, }: BookingWidgetProps): react_jsx_runtime.JSX.Element;
443
+ declare function BookingWidget({ className, title, subtitle, serviceSearchPlaceholder, categoryLabel, serviceListMaxHeight, serviceLayout, serviceColumns, showServicePagination, staffLayout, staffColumns, showStaffPagination, timeLayout, showFullyBookedLabel, calendarVariant, enableServiceSearch, enableCategoryFilter, enableDatePaging, disabledWeekdays, ...hookProps }: BookingWidgetProps$1): react_jsx_runtime.JSX.Element;
444
+
445
+ interface BookingWidgetProps {
446
+ /** Navigation links shown in the mobile menu overlay. Omit to hide hamburger. */
447
+ navLinks?: {
448
+ label: string;
449
+ href: string;
450
+ }[];
451
+ /** Custom icon for the mobile menu open button (default: lucide Menu) */
452
+ menuIcon?: ReactNode;
453
+ /** Custom icon for the mobile menu close button (default: lucide X) */
454
+ closeIcon?: ReactNode;
455
+ /** Override the category → icon mapping (keyword → React component) */
456
+ categoryIcons?: Record<string, typeof Scissors>;
457
+ /** Override step titles for mobile flow */
458
+ stepTitles?: [string, string, string, string];
459
+ /**
460
+ * Link component for mobile nav. Defaults to a plain `<a>` tag.
461
+ * Next.js sites should pass `Link` from `next/link` for client-side navigation.
462
+ */
463
+ linkComponent?: ComponentType<{
464
+ href: string;
465
+ className?: string;
466
+ onClick?: () => void;
467
+ children: ReactNode;
468
+ }>;
469
+ }
470
+ declare function BookingWidgetPanel({ navLinks, menuIcon, closeIcon, categoryIcons, stepTitles, linkComponent: LinkComp, }?: BookingWidgetProps): react_jsx_runtime.JSX.Element;
308
471
 
309
472
  interface AvailabilityPickerProps {
310
473
  serviceId: string;
@@ -352,4 +515,4 @@ interface TimePickerProps {
352
515
  }
353
516
  declare function TimePicker({ slots, selectedTime, onSelect, className, }: TimePickerProps): react_jsx_runtime.JSX.Element;
354
517
 
355
- export { AvailabilityPicker, type AvailabilityResult, type BookingCancelInput, type BookingCreateInput, type BookingLookup, BookingWidget, ContactForm, type ContactSubmissionInput, DatePicker, PlatformProvider, type Service, ServiceCard, ServicePicker, ServicesList, type ServicesQueryParams, type StaffMember, StaffPicker, TeamGrid, TeamMember, type TeamQueryParams, type TenantInfo, TimePicker, useAvailability, useBookingLookup, useCancelBooking, useCreateBooking, useServices, useTeam, useTenant };
518
+ export { AvailabilityPicker, type AvailabilityResult, type BookingCancelInput, type BookingCreateInput, type BookingLookup, BookingWidget, BookingWidgetPanel, type BookingWidgetProps, ContactForm, type ContactSubmissionInput, DatePicker, PlatformProvider, type Service, ServiceCard, ServicePicker, ServicesList, type ServicesQueryParams, type StaffMember, StaffPicker, TeamGrid, TeamMember, type TeamQueryParams, type TenantInfo, TimePicker, type UseBookingWidgetOptions, type UseBookingWidgetReturn, useAvailability, useBookingLookup, useBookingWidget, useCancelBooking, useCreateBooking, useServices, useTeam, useTenant };