@wix/headless-bookings 0.0.89 → 0.0.91

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 (39) hide show
  1. package/cjs/dist/react/booking/Book.d.ts +11 -19
  2. package/cjs/dist/react/booking/Book.js +17 -13
  3. package/cjs/dist/react/booking/Booking.d.ts +1 -1
  4. package/cjs/dist/react/booking/Booking.js +1 -1
  5. package/cjs/dist/react/booking-form/BookingForm.d.ts +5 -2
  6. package/cjs/dist/react/booking-form/BookingForm.js +3 -2
  7. package/cjs/dist/react/location/Location.d.ts +3 -4
  8. package/cjs/dist/react/location/Location.js +6 -6
  9. package/cjs/dist/react/location/LocationList.d.ts +2 -4
  10. package/cjs/dist/react/location/LocationList.js +22 -15
  11. package/cjs/dist/react/service/Service.d.ts +18 -33
  12. package/cjs/dist/react/service/Service.js +20 -33
  13. package/cjs/dist/react/staff-member/StaffMember.d.ts +9 -4
  14. package/cjs/dist/react/staff-member/StaffMember.js +7 -7
  15. package/cjs/dist/react/staff-member/StaffMemberList.d.ts +9 -4
  16. package/cjs/dist/react/staff-member/StaffMemberList.js +23 -16
  17. package/cjs/dist/react/time-slot-list/TimeSlot.d.ts +17 -21
  18. package/cjs/dist/react/time-slot-list/TimeSlot.js +18 -22
  19. package/cjs/dist/services/booking/book-action/types.d.ts +3 -3
  20. package/dist/react/booking/Book.d.ts +11 -19
  21. package/dist/react/booking/Book.js +17 -13
  22. package/dist/react/booking/Booking.d.ts +1 -1
  23. package/dist/react/booking/Booking.js +1 -1
  24. package/dist/react/booking-form/BookingForm.d.ts +5 -2
  25. package/dist/react/booking-form/BookingForm.js +3 -2
  26. package/dist/react/location/Location.d.ts +3 -4
  27. package/dist/react/location/Location.js +6 -6
  28. package/dist/react/location/LocationList.d.ts +2 -4
  29. package/dist/react/location/LocationList.js +22 -15
  30. package/dist/react/service/Service.d.ts +18 -33
  31. package/dist/react/service/Service.js +20 -33
  32. package/dist/react/staff-member/StaffMember.d.ts +9 -4
  33. package/dist/react/staff-member/StaffMember.js +7 -7
  34. package/dist/react/staff-member/StaffMemberList.d.ts +9 -4
  35. package/dist/react/staff-member/StaffMemberList.js +23 -16
  36. package/dist/react/time-slot-list/TimeSlot.d.ts +17 -21
  37. package/dist/react/time-slot-list/TimeSlot.js +18 -22
  38. package/dist/services/booking/book-action/types.d.ts +3 -3
  39. package/package.json +5 -5
@@ -103,15 +103,13 @@ export declare const Totals: React.ForwardRefExoticComponent<TotalsProps & React
103
103
  /**
104
104
  * Props for LocationList.Actions.Clear component
105
105
  */
106
- export interface ClearProps {
106
+ export interface ClearProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onClick'> {
107
107
  asChild?: boolean;
108
108
  children?: React.ReactNode | ((props: {
109
109
  onClick: () => void;
110
110
  }) => React.ReactNode);
111
- className?: string;
112
111
  label?: string;
113
- /** Callback fired when the clear button is clicked */
114
- onClicked?: () => void;
112
+ onClick?: (location: Location | null) => void;
115
113
  }
116
114
  /**
117
115
  * Actions namespace for location list-level actions
@@ -153,6 +153,11 @@ Totals.displayName = 'LocationList.Totals';
153
153
  * // With custom label
154
154
  * <LocationList.Actions.Clear label="Clear selection" />
155
155
  *
156
+ * // With children as button content
157
+ * <LocationList.Actions.Clear className="text-destructive">
158
+ * <span>Reset Location</span>
159
+ * </LocationList.Actions.Clear>
160
+ *
156
161
  * // With asChild
157
162
  * <LocationList.Actions.Clear asChild>
158
163
  * <button className="btn-secondary">Clear location</button>
@@ -165,21 +170,23 @@ Totals.displayName = 'LocationList.Totals';
165
170
  * ```
166
171
  */
167
172
  const Clear = React.forwardRef((props, ref) => {
168
- const { asChild, children, className, label = 'Clear', onClicked } = props;
169
- let bookingService = null;
170
- try {
171
- bookingService = useService(BookingServiceDefinition);
172
- }
173
- catch {
174
- // BookingService not available - likely no ServiceManagerProvider
175
- }
176
- const handleClick = () => {
177
- bookingService?.actions.clearLocation();
178
- onClicked?.();
179
- };
180
- return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.locationListActionClear, customElement: children, customElementProps: {
181
- onClick: handleClick,
182
- }, children: _jsx("button", { type: "button", onClick: handleClick, children: label }) }));
173
+ const { asChild, children, className, label, onClick, ...buttonProps } = props;
174
+ return (_jsx(CoreLocationList.Actions, { children: ({ selectedLocation }) => {
175
+ let bookingService = null;
176
+ try {
177
+ bookingService = useService(BookingServiceDefinition);
178
+ }
179
+ catch {
180
+ // BookingService not available - likely no ServiceManagerProvider
181
+ }
182
+ const handleClick = () => {
183
+ bookingService?.actions.clearLocation();
184
+ onClick?.(selectedLocation);
185
+ };
186
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.locationListActionClear, customElement: children, customElementProps: {
187
+ onClick: handleClick,
188
+ }, children: _jsx("button", { ...buttonProps, onClick: handleClick, children: children || label }) }));
189
+ } }));
183
190
  });
184
191
  Clear.displayName = 'LocationList.Actions.Clear';
185
192
  /**
@@ -646,7 +646,7 @@ export declare namespace Actions {
646
646
  /**
647
647
  * Props for Select action component
648
648
  */
649
- interface SelectProps {
649
+ interface SelectProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'disabled' | 'onClick'> {
650
650
  asChild?: boolean;
651
651
  children?: React.ReactNode | ((props: {
652
652
  bookable: boolean;
@@ -655,9 +655,9 @@ export declare namespace Actions {
655
655
  onClick: () => void;
656
656
  service: Service;
657
657
  }) => React.ReactNode);
658
- className?: string;
659
658
  label?: string;
660
- onClicked?: (service: Service) => void;
659
+ /** Called after selection with the selected service */
660
+ onClick?: (service: Service) => void;
661
661
  }
662
662
  /**
663
663
  * Select action component - replaces selection with only this service.
@@ -673,15 +673,10 @@ export declare namespace Actions {
673
673
  * <Button variant="primary">Select Service</Button>
674
674
  * </Service.Actions.Select>
675
675
  *
676
- * // With onClicked callback for navigation
676
+ * // With onClick callback for navigation
677
677
  * <Service.Actions.Select
678
- * asChild
679
- * onClicked={(service) => {
680
- * router.push(`/booking/time-slots/${service._id}`);
681
- * }}
682
- * >
683
- * <Button variant="primary">Select Service</Button>
684
- * </Service.Actions.Select>
678
+ * onClick={() => router.push('/booking/time-slots')}
679
+ * />
685
680
  *
686
681
  * // Using render prop pattern to access bookable state
687
682
  * <Service.Actions.Select>
@@ -697,7 +692,7 @@ export declare namespace Actions {
697
692
  /**
698
693
  * Props for Add action component
699
694
  */
700
- interface AddProps {
695
+ interface AddProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'disabled' | 'onClick'> {
701
696
  asChild?: boolean;
702
697
  children?: React.ReactNode | ((props: {
703
698
  bookable: boolean;
@@ -706,9 +701,9 @@ export declare namespace Actions {
706
701
  onClick: () => void;
707
702
  service: Service;
708
703
  }) => React.ReactNode);
709
- className?: string;
710
704
  label?: string;
711
- onClicked?: (service: Service) => void;
705
+ /** Called after adding with the added service */
706
+ onClick?: (service: Service) => void;
712
707
  }
713
708
  /**
714
709
  * Add action component - adds service to selection array.
@@ -724,15 +719,10 @@ export declare namespace Actions {
724
719
  * <Button variant="secondary">Add Service</Button>
725
720
  * </Service.Actions.Add>
726
721
  *
727
- * // With onClicked callback for custom behavior after adding
722
+ * // With onClick callback
728
723
  * <Service.Actions.Add
729
- * asChild
730
- * onClicked={(service) => {
731
- * console.log(`Added service: ${service.name}`);
732
- * }}
733
- * >
734
- * <Button variant="secondary">Add Service</Button>
735
- * </Service.Actions.Add>
724
+ * onClick={() => console.log('Service added')}
725
+ * />
736
726
  *
737
727
  * // Using render prop pattern to access bookable state
738
728
  * <Service.Actions.Add>
@@ -748,7 +738,7 @@ export declare namespace Actions {
748
738
  /**
749
739
  * Props for Remove action component
750
740
  */
751
- interface RemoveProps {
741
+ interface RemoveProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'disabled' | 'onClick'> {
752
742
  asChild?: boolean;
753
743
  children?: React.ReactNode | ((props: {
754
744
  bookable: boolean;
@@ -757,9 +747,9 @@ export declare namespace Actions {
757
747
  onClick: () => void;
758
748
  service: Service;
759
749
  }) => React.ReactNode);
760
- className?: string;
761
750
  label?: string;
762
- onClicked?: (service: Service) => void;
751
+ /** Called after removing with the removed service */
752
+ onClick?: (service: Service) => void;
763
753
  }
764
754
  /**
765
755
  * Remove action component - removes service from selection array.
@@ -775,15 +765,10 @@ export declare namespace Actions {
775
765
  * <Button variant="destructive">Remove Service</Button>
776
766
  * </Service.Actions.Remove>
777
767
  *
778
- * // With onClicked callback for custom behavior after removing
768
+ * // With onClick callback
779
769
  * <Service.Actions.Remove
780
- * asChild
781
- * onClicked={(service) => {
782
- * console.log(`Removed service: ${service.name}`);
783
- * }}
784
- * >
785
- * <Button variant="destructive">Remove Service</Button>
786
- * </Service.Actions.Remove>
770
+ * onClick={() => console.log('Service removed')}
771
+ * />
787
772
  *
788
773
  * // Using render prop pattern to access bookable state
789
774
  * <Service.Actions.Remove>
@@ -602,15 +602,10 @@ export var Actions;
602
602
  * <Button variant="primary">Select Service</Button>
603
603
  * </Service.Actions.Select>
604
604
  *
605
- * // With onClicked callback for navigation
605
+ * // With onClick callback for navigation
606
606
  * <Service.Actions.Select
607
- * asChild
608
- * onClicked={(service) => {
609
- * router.push(`/booking/time-slots/${service._id}`);
610
- * }}
611
- * >
612
- * <Button variant="primary">Select Service</Button>
613
- * </Service.Actions.Select>
607
+ * onClick={() => router.push('/booking/time-slots')}
608
+ * />
614
609
  *
615
610
  * // Using render prop pattern to access bookable state
616
611
  * <Service.Actions.Select>
@@ -623,11 +618,11 @@ export var Actions;
623
618
  * ```
624
619
  */
625
620
  Actions.Select = React.forwardRef((props, ref) => {
626
- const { asChild, children, className, label = 'Select Service', onClicked, } = props;
621
+ const { asChild, children, className, label, onClick, ...buttonProps } = props;
627
622
  return (_jsx(CoreService.Actions, { children: ({ select, rawService, bookable, selected, requiresAvailability, }) => {
628
623
  const handleClick = () => {
629
624
  select();
630
- onClicked?.(rawService);
625
+ onClick?.(rawService);
631
626
  };
632
627
  return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.serviceActionSelect, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, customElement: children, customElementProps: {
633
628
  onClick: handleClick,
@@ -636,7 +631,7 @@ export var Actions;
636
631
  bookable,
637
632
  requiresAvailability,
638
633
  service: rawService,
639
- }, children: _jsx("button", { onClick: handleClick, disabled: !bookable, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, children: label }) }));
634
+ }, children: _jsx("button", { ...buttonProps, onClick: handleClick, disabled: !bookable, "data-testid": TestIds.serviceActionSelect, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, children: children || label }) }));
640
635
  } }));
641
636
  });
642
637
  Actions.Select.displayName = 'Service.Actions.Select';
@@ -654,15 +649,10 @@ export var Actions;
654
649
  * <Button variant="secondary">Add Service</Button>
655
650
  * </Service.Actions.Add>
656
651
  *
657
- * // With onClicked callback for custom behavior after adding
652
+ * // With onClick callback
658
653
  * <Service.Actions.Add
659
- * asChild
660
- * onClicked={(service) => {
661
- * console.log(`Added service: ${service.name}`);
662
- * }}
663
- * >
664
- * <Button variant="secondary">Add Service</Button>
665
- * </Service.Actions.Add>
654
+ * onClick={() => console.log('Service added')}
655
+ * />
666
656
  *
667
657
  * // Using render prop pattern to access bookable state
668
658
  * <Service.Actions.Add>
@@ -675,13 +665,13 @@ export var Actions;
675
665
  * ```
676
666
  */
677
667
  Actions.Add = React.forwardRef((props, ref) => {
678
- const { asChild, children, className, label = 'Add Service', onClicked, } = props;
668
+ const { asChild, children, className, label, onClick, ...buttonProps } = props;
679
669
  return (_jsx(CoreService.Actions, { children: ({ add, rawService, bookable, selected, requiresAvailability }) => {
680
670
  // Disabled when already selected (can't add again) or not bookable
681
671
  const isDisabled = selected || !bookable;
682
672
  const handleClick = () => {
683
673
  add();
684
- onClicked?.(rawService);
674
+ onClick?.(rawService);
685
675
  };
686
676
  return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.serviceActionAdd, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, customElement: children, customElementProps: {
687
677
  onClick: handleClick,
@@ -689,7 +679,8 @@ export var Actions;
689
679
  selected,
690
680
  bookable,
691
681
  requiresAvailability,
692
- }, children: _jsx("button", { onClick: handleClick, disabled: isDisabled, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, children: label }) }));
682
+ service: rawService,
683
+ }, children: _jsx("button", { ...buttonProps, onClick: handleClick, disabled: isDisabled, "data-testid": TestIds.serviceActionAdd, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, children: children || label }) }));
693
684
  } }));
694
685
  });
695
686
  Actions.Add.displayName = 'Service.Actions.Add';
@@ -707,15 +698,10 @@ export var Actions;
707
698
  * <Button variant="destructive">Remove Service</Button>
708
699
  * </Service.Actions.Remove>
709
700
  *
710
- * // With onClicked callback for custom behavior after removing
701
+ * // With onClick callback
711
702
  * <Service.Actions.Remove
712
- * asChild
713
- * onClicked={(service) => {
714
- * console.log(`Removed service: ${service.name}`);
715
- * }}
716
- * >
717
- * <Button variant="destructive">Remove Service</Button>
718
- * </Service.Actions.Remove>
703
+ * onClick={() => console.log('Service removed')}
704
+ * />
719
705
  *
720
706
  * // Using render prop pattern to access bookable state
721
707
  * <Service.Actions.Remove>
@@ -728,13 +714,13 @@ export var Actions;
728
714
  * ```
729
715
  */
730
716
  Actions.Remove = React.forwardRef((props, ref) => {
731
- const { asChild, children, className, label = 'Remove Service', onClicked, } = props;
717
+ const { asChild, children, className, label, onClick, ...buttonProps } = props;
732
718
  return (_jsx(CoreService.Actions, { children: ({ remove, rawService, bookable, selected, requiresAvailability, }) => {
733
719
  // Disabled when not selected (nothing to remove) or not bookable
734
720
  const isDisabled = !selected || !bookable;
735
721
  const handleClick = () => {
736
722
  remove();
737
- onClicked?.(rawService);
723
+ onClick?.(rawService);
738
724
  };
739
725
  return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.serviceActionRemove, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, customElement: children, customElementProps: {
740
726
  onClick: handleClick,
@@ -742,7 +728,8 @@ export var Actions;
742
728
  selected,
743
729
  bookable,
744
730
  requiresAvailability,
745
- }, children: _jsx("button", { onClick: handleClick, disabled: isDisabled, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, children: label }) }));
731
+ service: rawService,
732
+ }, children: _jsx("button", { ...buttonProps, onClick: handleClick, disabled: isDisabled, "data-testid": TestIds.serviceActionRemove, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, children: children || label }) }));
746
733
  } }));
747
734
  });
748
735
  Actions.Remove.displayName = 'Service.Actions.Remove';
@@ -8,6 +8,12 @@ import React from 'react';
8
8
  import * as CoreStaffMember from '../core/staff-member/StaffMember.js';
9
9
  import { type AsChildChildren } from '@wix/headless-utils/react';
10
10
  export { useStaffMemberContext } from '../core/staff-member/StaffMember.js';
11
+ export declare enum TestIds {
12
+ staffMemberRoot = "staff-member-root",
13
+ staffMemberName = "staff-member-name",
14
+ staffMemberRaw = "staff-member-raw",
15
+ staffMemberActionSelect = "staff-member-action-select"
16
+ }
11
17
  export type { StaffMemberData, StaffMemberRenderProps, } from '../core/staff-member/StaffMember.js';
12
18
  /**
13
19
  * Props for StaffMember.Root component
@@ -98,18 +104,17 @@ export declare const Raw: React.FC<RawProps>;
98
104
  /**
99
105
  * Props for StaffMember.Actions.Select component
100
106
  */
101
- export interface SelectProps {
107
+ export interface SelectProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onClick'> {
102
108
  asChild?: boolean;
103
109
  children?: React.ReactNode | AsChildChildren<{
104
110
  onClick: () => void;
105
111
  selected: boolean;
106
112
  staffMember: CoreStaffMember.StaffMemberData | null;
107
113
  }>;
108
- /** Callback fired after staff member is selected - receives the staff member */
109
- onClicked?: (staffMember: CoreStaffMember.StaffMemberData) => void;
110
114
  /** Label for the button */
111
115
  label?: string;
112
- className?: string;
116
+ /** Called after selection with the selected staffMember */
117
+ onClick?: (staffMember: CoreStaffMember.StaffMemberData) => void;
113
118
  }
114
119
  /**
115
120
  * Actions namespace for staff member-related actions
@@ -13,7 +13,7 @@ export { useStaffMemberContext } from '../core/staff-member/StaffMember.js';
13
13
  // ==========================================
14
14
  // TestIds Enum
15
15
  // ==========================================
16
- var TestIds;
16
+ export var TestIds;
17
17
  (function (TestIds) {
18
18
  TestIds["staffMemberRoot"] = "staff-member-root";
19
19
  TestIds["staffMemberName"] = "staff-member-name";
@@ -106,10 +106,10 @@ Raw.displayName = 'StaffMember.Raw';
106
106
  * ```tsx
107
107
  * <StaffMember.Actions.Select label="Choose Staff Member" />
108
108
  *
109
- * // With onClicked callback
109
+ * // With onClick callback
110
110
  * <StaffMember.Actions.Select
111
111
  * label="Select"
112
- * onClicked={(staffMember) => console.log('Selected:', staffMember.name)}
112
+ * onClick={() => console.log('Staff member selected')}
113
113
  * />
114
114
  *
115
115
  * // With asChild
@@ -123,19 +123,19 @@ Raw.displayName = 'StaffMember.Raw';
123
123
  * ```
124
124
  */
125
125
  const Select = React.forwardRef((props, ref) => {
126
- const { asChild, children, onClicked, label = 'Select', className, ...attrs } = props;
126
+ const { asChild, children, onClick, label, className, ...buttonProps } = props;
127
127
  return (_jsx(CoreStaffMember.Actions, { children: ({ select, selected, rawStaffMember }) => {
128
128
  const handleClick = () => {
129
129
  select();
130
- if (onClicked && rawStaffMember) {
131
- onClicked(rawStaffMember);
130
+ if (rawStaffMember) {
131
+ onClick?.(rawStaffMember);
132
132
  }
133
133
  };
134
134
  return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.staffMemberActionSelect, "data-selected": selected, customElement: children, customElementProps: {
135
135
  onClick: handleClick,
136
136
  selected,
137
137
  staffMember: rawStaffMember,
138
- }, ...attrs, children: _jsx("button", { type: "button", onClick: handleClick, children: label }) }));
138
+ }, children: _jsx("button", { ...buttonProps, onClick: handleClick, children: children || label }) }));
139
139
  } }));
140
140
  });
141
141
  Select.displayName = 'StaffMember.Actions.Select';
@@ -9,6 +9,12 @@ import { GenericListRepeaterProps, type ListVariant } from '@wix/headless-compon
9
9
  import { type AsChildChildren } from '@wix/headless-utils/react';
10
10
  import type { StaffMemberListServiceConfig } from '../../services/staff-member-list/staff-member-list.js';
11
11
  import type { StaffMemberData } from '../../services/staff-member-list/staff-member-list.def.js';
12
+ export declare enum TestIds {
13
+ staffMemberListRoot = "staff-member-list-root",
14
+ staffMemberListStaffMembers = "staff-member-list-staff-members",
15
+ staffMemberListStaffMember = "staff-member-list-staff-member",
16
+ staffMemberListActionClear = "staff-member-list-action-clear"
17
+ }
12
18
  /**
13
19
  * Props for the StaffMemberList root component
14
20
  */
@@ -97,15 +103,14 @@ export declare const Totals: React.ForwardRefExoticComponent<TotalsProps & React
97
103
  /**
98
104
  * Props for StaffMemberList.Actions.Clear component
99
105
  */
100
- export interface ClearProps {
106
+ export interface ClearProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onClick'> {
101
107
  asChild?: boolean;
102
108
  children?: React.ReactNode | ((props: {
103
109
  onClick: () => void;
104
110
  }) => React.ReactNode);
105
- className?: string;
106
111
  label?: string;
107
- /** Callback fired when the clear button is clicked */
108
- onClicked?: () => void;
112
+ /** Called after clearing with the staffMember that was cleared */
113
+ onClick?: (staffMember: StaffMemberData | null) => void;
109
114
  }
110
115
  /**
111
116
  * Actions namespace for staff member list-level actions
@@ -17,7 +17,7 @@ const STAFF_MEMBER_RESOURCE_TYPE_ID = '1cd44cf8-756f-41c3-bd90-3e2ffcaf1155';
17
17
  // ============================================================================
18
18
  // TestIds
19
19
  // ============================================================================
20
- var TestIds;
20
+ export var TestIds;
21
21
  (function (TestIds) {
22
22
  TestIds["staffMemberListRoot"] = "staff-member-list-root";
23
23
  TestIds["staffMemberListStaffMembers"] = "staff-member-list-staff-members";
@@ -130,6 +130,11 @@ Totals.displayName = 'StaffMemberList.Totals';
130
130
  * // With custom label
131
131
  * <StaffMemberList.Actions.Clear label="Clear selection" />
132
132
  *
133
+ * // With children as button content
134
+ * <StaffMemberList.Actions.Clear className="text-destructive">
135
+ * <span>Reset Staff</span>
136
+ * </StaffMemberList.Actions.Clear>
137
+ *
133
138
  * // With asChild
134
139
  * <StaffMemberList.Actions.Clear asChild>
135
140
  * <button className="btn-secondary">Clear staff</button>
@@ -142,21 +147,23 @@ Totals.displayName = 'StaffMemberList.Totals';
142
147
  * ```
143
148
  */
144
149
  const Clear = React.forwardRef((props, ref) => {
145
- const { asChild, children, className, label = 'Clear', onClicked } = props;
146
- let bookingService = null;
147
- try {
148
- bookingService = useService(BookingServiceDefinition);
149
- }
150
- catch {
151
- // BookingService not available - likely no ServiceManagerProvider
152
- }
153
- const handleClick = () => {
154
- bookingService?.actions.clearResourceByType(STAFF_MEMBER_RESOURCE_TYPE_ID);
155
- onClicked?.();
156
- };
157
- return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.staffMemberListActionClear, customElement: children, customElementProps: {
158
- onClick: handleClick,
159
- }, children: _jsx("button", { type: "button", onClick: handleClick, children: label }) }));
150
+ const { asChild, children, className, label, onClick, ...buttonProps } = props;
151
+ return (_jsx(CoreStaffMemberList.Actions, { children: ({ selectedStaffMember }) => {
152
+ let bookingService = null;
153
+ try {
154
+ bookingService = useService(BookingServiceDefinition);
155
+ }
156
+ catch {
157
+ // BookingService not available - likely no ServiceManagerProvider
158
+ }
159
+ const handleClick = () => {
160
+ bookingService?.actions.clearResourceByType(STAFF_MEMBER_RESOURCE_TYPE_ID);
161
+ onClick?.(selectedStaffMember);
162
+ };
163
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.staffMemberListActionClear, customElement: children, customElementProps: {
164
+ onClick: handleClick,
165
+ }, children: _jsx("button", { ...buttonProps, onClick: handleClick, children: children || label }) }));
166
+ } }));
160
167
  });
161
168
  Clear.displayName = 'StaffMemberList.Actions.Clear';
162
169
  /**
@@ -150,16 +150,17 @@ export declare const Duration: React.ForwardRefExoticComponent<DurationProps & R
150
150
  /**
151
151
  * Props for TimeSlot.Actions.Select component
152
152
  */
153
- export interface SelectProps {
153
+ export interface SelectProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'disabled' | 'onClick'> {
154
154
  asChild?: boolean;
155
155
  children?: React.ReactNode | ((props: {
156
156
  isSelected: boolean;
157
157
  bookable: boolean;
158
158
  onClick: () => void;
159
+ timeSlot: TimeSlotType;
159
160
  }) => React.ReactNode);
160
- className?: string;
161
161
  label?: string;
162
- onClicked?: (timeSlot: TimeSlotType) => void;
162
+ /** Called after selection with the selected timeSlot */
163
+ onClick?: (timeSlot: TimeSlotType) => void;
163
164
  }
164
165
  /**
165
166
  * Button to select this time slot.
@@ -179,11 +180,9 @@ export interface SelectProps {
179
180
  * <button className="btn-primary">Book this slot</button>
180
181
  * </TimeSlot.Actions.Select>
181
182
  *
182
- * // With onClicked callback for navigation
183
+ * // With onClick callback
183
184
  * <TimeSlot.Actions.Select
184
- * onClicked={(timeSlot) => {
185
- * router.push(`/booking/confirm/${timeSlot.localStartDate}`);
186
- * }}
185
+ * onClick={() => router.push('/booking/confirm')}
187
186
  * />
188
187
  *
189
188
  * // Using render prop pattern
@@ -200,14 +199,14 @@ export declare const Select: React.ForwardRefExoticComponent<SelectProps & React
200
199
  /**
201
200
  * Props for TimeSlot.Actions.ClearStaffSelection component
202
201
  */
203
- export interface ClearStaffSelectionProps {
202
+ export interface ClearStaffSelectionProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onClick'> {
204
203
  asChild?: boolean;
205
204
  children?: React.ReactNode | ((props: {
206
205
  onClick: () => void;
207
206
  }) => React.ReactNode);
208
- className?: string;
209
207
  label?: string;
210
- onClicked?: (timeSlot: TimeSlotType) => void;
208
+ /** Called after clearing with the timeSlot whose staff selection was cleared */
209
+ onClick?: (timeSlot: TimeSlotType) => void;
211
210
  }
212
211
  /**
213
212
  * Button to clear staff selection while keeping the slot selected.
@@ -228,11 +227,9 @@ export interface ClearStaffSelectionProps {
228
227
  * <button className="btn-secondary">Clear staff</button>
229
228
  * </TimeSlot.Actions.ClearStaffSelection>
230
229
  *
231
- * // With onClicked callback
230
+ * // With onClick callback
232
231
  * <TimeSlot.Actions.ClearStaffSelection
233
- * onClicked={(timeSlot) => {
234
- * console.log('Staff selection cleared for', timeSlot.localStartDate);
235
- * }}
232
+ * onClick={() => console.log('Staff selection cleared')}
236
233
  * />
237
234
  *
238
235
  * // Using render prop pattern
@@ -360,15 +357,16 @@ export declare const StaffMemberName: React.ForwardRefExoticComponent<StaffMembe
360
357
  /**
361
358
  * Props for TimeSlot.StaffMember.Actions.Select component
362
359
  */
363
- export interface SelectStaffMemberProps {
360
+ export interface SelectStaffMemberProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onClick'> {
364
361
  asChild?: boolean;
365
362
  children?: React.ReactNode | ((props: {
366
363
  isSelected: boolean;
367
364
  onClick: () => void;
365
+ staffMember: CoreTimeSlot.StaffMemberData;
368
366
  }) => React.ReactNode);
369
- className?: string;
370
367
  label?: string;
371
- onClicked?: (staffMember: CoreTimeSlot.StaffMemberData) => void;
368
+ /** Called after selection with the selected staffMember */
369
+ onClick?: (staffMember: CoreTimeSlot.StaffMemberData) => void;
372
370
  }
373
371
  /**
374
372
  * Button to select this staff member.
@@ -388,11 +386,9 @@ export interface SelectStaffMemberProps {
388
386
  * <button className="btn-primary">Choose Staff</button>
389
387
  * </TimeSlot.StaffMember.Actions.Select>
390
388
  *
391
- * // With onClicked callback
389
+ * // With onClick callback
392
390
  * <TimeSlot.StaffMember.Actions.Select
393
- * onClicked={(staffMember) => {
394
- * console.log('Selected staff:', staffMember.name);
395
- * }}
391
+ * onClick={() => console.log('Staff selected')}
396
392
  * />
397
393
  *
398
394
  * // Using render prop pattern