@wix/headless-bookings 0.0.92 → 0.0.93
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/cjs/dist/react/booking/Book.d.ts +1 -1
- package/cjs/dist/react/booking/Book.js +9 -6
- package/cjs/dist/react/booking/BookingItem.d.ts +1 -2
- package/cjs/dist/react/booking/BookingItem.js +2 -2
- package/cjs/dist/react/booking-form/BookingForm.js +3 -3
- package/cjs/dist/react/location/Location.d.ts +2 -4
- package/cjs/dist/react/location/Location.js +14 -14
- package/cjs/dist/react/location/LocationList.d.ts +1 -2
- package/cjs/dist/react/location/LocationList.js +6 -5
- package/cjs/dist/react/payment/Payment.d.ts +8 -16
- package/cjs/dist/react/payment/Payment.js +14 -14
- package/cjs/dist/react/service/Service.d.ts +8 -16
- package/cjs/dist/react/service/Service.js +29 -29
- package/cjs/dist/react/staff-member/StaffMember.d.ts +1 -2
- package/cjs/dist/react/staff-member/StaffMember.js +5 -5
- package/cjs/dist/react/staff-member/StaffMemberList.d.ts +3 -3
- package/cjs/dist/react/staff-member/StaffMemberList.js +6 -5
- package/cjs/dist/react/time-slot-list/TimeSlot.d.ts +4 -8
- package/cjs/dist/react/time-slot-list/TimeSlot.js +19 -19
- package/cjs/dist/react/time-slot-list/TimeSlotList.d.ts +1 -3
- package/cjs/dist/react/time-slot-list/TimeSlotList.js +9 -8
- package/dist/react/booking/Book.d.ts +1 -1
- package/dist/react/booking/Book.js +9 -6
- package/dist/react/booking/BookingItem.d.ts +1 -2
- package/dist/react/booking/BookingItem.js +2 -2
- package/dist/react/booking-form/BookingForm.js +3 -3
- package/dist/react/location/Location.d.ts +2 -4
- package/dist/react/location/Location.js +14 -14
- package/dist/react/location/LocationList.d.ts +1 -2
- package/dist/react/location/LocationList.js +6 -5
- package/dist/react/payment/Payment.d.ts +8 -16
- package/dist/react/payment/Payment.js +14 -14
- package/dist/react/service/Service.d.ts +8 -16
- package/dist/react/service/Service.js +29 -29
- package/dist/react/staff-member/StaffMember.d.ts +1 -2
- package/dist/react/staff-member/StaffMember.js +5 -5
- package/dist/react/staff-member/StaffMemberList.d.ts +3 -3
- package/dist/react/staff-member/StaffMemberList.js +6 -5
- package/dist/react/time-slot-list/TimeSlot.d.ts +4 -8
- package/dist/react/time-slot-list/TimeSlot.js +19 -19
- package/dist/react/time-slot-list/TimeSlotList.d.ts +1 -3
- package/dist/react/time-slot-list/TimeSlotList.js +9 -8
- package/package.json +2 -2
|
@@ -148,8 +148,8 @@ Root.displayName = 'Service.Root';
|
|
|
148
148
|
* ```
|
|
149
149
|
*/
|
|
150
150
|
export const Name = React.forwardRef((props, ref) => {
|
|
151
|
-
const { asChild, children,
|
|
152
|
-
return (_jsx(CoreService.Info, { children: ({ name }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
151
|
+
const { asChild, children, ...rest } = props;
|
|
152
|
+
return (_jsx(CoreService.Info, { children: ({ name }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.serviceName, customElement: children, customElementProps: { name }, children: _jsx("span", { children: name }) })) }));
|
|
153
153
|
});
|
|
154
154
|
Name.displayName = 'Service.Name';
|
|
155
155
|
/**
|
|
@@ -168,8 +168,8 @@ Name.displayName = 'Service.Name';
|
|
|
168
168
|
* ```
|
|
169
169
|
*/
|
|
170
170
|
export const Description = React.forwardRef((props, ref) => {
|
|
171
|
-
const { asChild, children,
|
|
172
|
-
return (_jsx(CoreService.Info, { children: ({ description }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
171
|
+
const { asChild, children, ...rest } = props;
|
|
172
|
+
return (_jsx(CoreService.Info, { children: ({ description }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.serviceDescription, customElement: children, customElementProps: { description }, children: _jsx("div", { children: description }) })) }));
|
|
173
173
|
});
|
|
174
174
|
Description.displayName = 'Service.Description';
|
|
175
175
|
/**
|
|
@@ -261,8 +261,8 @@ Price.displayName = 'Service.Price';
|
|
|
261
261
|
* ```
|
|
262
262
|
*/
|
|
263
263
|
export const Tagline = React.forwardRef((props, ref) => {
|
|
264
|
-
const { asChild, children,
|
|
265
|
-
return (_jsx(CoreService.Info, { children: ({ tagline }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
264
|
+
const { asChild, children, ...rest } = props;
|
|
265
|
+
return (_jsx(CoreService.Info, { children: ({ tagline }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.serviceTagline, customElement: children, customElementProps: { tagline }, children: tagline ? _jsx("p", { children: tagline }) : null })) }));
|
|
266
266
|
});
|
|
267
267
|
Tagline.displayName = 'Service.Tagline';
|
|
268
268
|
/**
|
|
@@ -297,9 +297,9 @@ Tagline.displayName = 'Service.Tagline';
|
|
|
297
297
|
* ```
|
|
298
298
|
*/
|
|
299
299
|
export const DurationInMinutes = React.forwardRef((props, ref) => {
|
|
300
|
-
const { asChild, children,
|
|
300
|
+
const { asChild, children, ...rest } = props;
|
|
301
301
|
return (_jsx(CoreService.Info, { children: ({ duration }) => {
|
|
302
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
302
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.serviceDurationInMinutes, customElement: children, customElementProps: { duration }, children: duration ? _jsx("span", { children: duration }) : null }));
|
|
303
303
|
} }));
|
|
304
304
|
});
|
|
305
305
|
DurationInMinutes.displayName = 'Service.DurationInMinutes';
|
|
@@ -337,8 +337,8 @@ DurationInMinutes.displayName = 'Service.DurationInMinutes';
|
|
|
337
337
|
* ```
|
|
338
338
|
*/
|
|
339
339
|
export const Type = React.forwardRef((props, ref) => {
|
|
340
|
-
const { asChild, children,
|
|
341
|
-
return (_jsx(CoreService.Info, { children: ({ type }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
340
|
+
const { asChild, children, ...rest } = props;
|
|
341
|
+
return (_jsx(CoreService.Info, { children: ({ type }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.serviceType, customElement: children, customElementProps: { type }, children: type ? _jsx("span", { children: type }) : null })) }));
|
|
342
342
|
});
|
|
343
343
|
Type.displayName = 'Service.Type';
|
|
344
344
|
/**
|
|
@@ -377,8 +377,8 @@ Type.displayName = 'Service.Type';
|
|
|
377
377
|
* ```
|
|
378
378
|
*/
|
|
379
379
|
export const Category = React.forwardRef((props, ref) => {
|
|
380
|
-
const { asChild, children,
|
|
381
|
-
return (_jsx(CoreService.Info, { children: ({ category }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
380
|
+
const { asChild, children, ...rest } = props;
|
|
381
|
+
return (_jsx(CoreService.Info, { children: ({ category }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.serviceCategory, customElement: children, customElementProps: { category }, children: category?.name ? _jsx("span", { children: category.name }) : null })) }));
|
|
382
382
|
});
|
|
383
383
|
Category.displayName = 'Service.Category';
|
|
384
384
|
/**
|
|
@@ -413,13 +413,13 @@ Category.displayName = 'Service.Category';
|
|
|
413
413
|
* ```
|
|
414
414
|
*/
|
|
415
415
|
const LocationsBase = React.forwardRef((props, ref) => {
|
|
416
|
-
const { asChild, children, className, ...
|
|
416
|
+
const { asChild, children, className, ...rest } = props;
|
|
417
417
|
return (_jsx(CoreService.Info, { children: ({ locations }) => {
|
|
418
418
|
// Container level: don't render if no locations
|
|
419
419
|
if (!locations || locations.length === 0) {
|
|
420
420
|
return null;
|
|
421
421
|
}
|
|
422
|
-
return (_jsx(LocationList.Root, { locationListConfig: { locations }, className: className, ref: ref, children: _jsx(AsChildSlot, { ...
|
|
422
|
+
return (_jsx(LocationList.Root, { locationListConfig: { locations }, className: className, ref: ref, children: _jsx(AsChildSlot, { ...rest, asChild: asChild, className: className, "data-testid": TestIds.serviceLocations, customElement: children, children: _jsx("div", { children: children }) }) }));
|
|
423
423
|
} }));
|
|
424
424
|
});
|
|
425
425
|
LocationsBase.displayName = 'Service.Locations';
|
|
@@ -501,13 +501,13 @@ LocationRepeater.displayName = 'Service.Locations.LocationRepeater';
|
|
|
501
501
|
* ```
|
|
502
502
|
*/
|
|
503
503
|
const StaffMembersBase = React.forwardRef((props, ref) => {
|
|
504
|
-
const { asChild, children, className, ...
|
|
504
|
+
const { asChild, children, className, ...rest } = props;
|
|
505
505
|
return (_jsx(CoreService.Info, { children: ({ staff }) => {
|
|
506
506
|
// Container level: don't render if no staff members
|
|
507
507
|
if (!staff || staff.length === 0) {
|
|
508
508
|
return null;
|
|
509
509
|
}
|
|
510
|
-
return (_jsx(StaffMemberListModule.Root, { staffMemberListConfig: { staffMembers: staff }, className: className, ref: ref, children: _jsx(AsChildSlot, { ...
|
|
510
|
+
return (_jsx(StaffMemberListModule.Root, { staffMemberListConfig: { staffMembers: staff }, className: className, ref: ref, children: _jsx(AsChildSlot, { ...rest, asChild: asChild, className: className, "data-testid": TestIds.serviceStaffMembers, customElement: children, children: _jsx("div", { children: children }) }) }));
|
|
511
511
|
} }));
|
|
512
512
|
});
|
|
513
513
|
StaffMembersBase.displayName = 'Service.StaffMembers';
|
|
@@ -618,20 +618,20 @@ export var Actions;
|
|
|
618
618
|
* ```
|
|
619
619
|
*/
|
|
620
620
|
Actions.Select = React.forwardRef((props, ref) => {
|
|
621
|
-
const { asChild, children, className, label, onClick, ...
|
|
621
|
+
const { asChild, children, className, label, onClick, ...rest } = props;
|
|
622
622
|
return (_jsx(CoreService.Actions, { children: ({ select, rawService, bookable, selected, requiresAvailability, }) => {
|
|
623
623
|
const handleClick = () => {
|
|
624
624
|
select();
|
|
625
625
|
onClick?.(rawService);
|
|
626
626
|
};
|
|
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: {
|
|
627
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, className: className, onClick: handleClick, disabled: !bookable, "data-testid": TestIds.serviceActionSelect, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, customElement: children, customElementProps: {
|
|
628
628
|
onClick: handleClick,
|
|
629
629
|
disabled: !bookable,
|
|
630
630
|
selected,
|
|
631
631
|
bookable,
|
|
632
632
|
requiresAvailability,
|
|
633
633
|
service: rawService,
|
|
634
|
-
}, children: _jsx("button", {
|
|
634
|
+
}, children: _jsx("button", { children: children || label }) }));
|
|
635
635
|
} }));
|
|
636
636
|
});
|
|
637
637
|
Actions.Select.displayName = 'Service.Actions.Select';
|
|
@@ -665,7 +665,7 @@ export var Actions;
|
|
|
665
665
|
* ```
|
|
666
666
|
*/
|
|
667
667
|
Actions.Add = React.forwardRef((props, ref) => {
|
|
668
|
-
const { asChild, children, className, label, onClick, ...
|
|
668
|
+
const { asChild, children, className, label, onClick, ...rest } = props;
|
|
669
669
|
return (_jsx(CoreService.Actions, { children: ({ add, rawService, bookable, selected, requiresAvailability }) => {
|
|
670
670
|
// Disabled when already selected (can't add again) or not bookable
|
|
671
671
|
const isDisabled = selected || !bookable;
|
|
@@ -673,14 +673,14 @@ export var Actions;
|
|
|
673
673
|
add();
|
|
674
674
|
onClick?.(rawService);
|
|
675
675
|
};
|
|
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: {
|
|
676
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, className: className, onClick: handleClick, disabled: isDisabled, "data-testid": TestIds.serviceActionAdd, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, customElement: children, customElementProps: {
|
|
677
677
|
onClick: handleClick,
|
|
678
678
|
disabled: isDisabled,
|
|
679
679
|
selected,
|
|
680
680
|
bookable,
|
|
681
681
|
requiresAvailability,
|
|
682
682
|
service: rawService,
|
|
683
|
-
}, children: _jsx("button", {
|
|
683
|
+
}, children: _jsx("button", { children: children || label }) }));
|
|
684
684
|
} }));
|
|
685
685
|
});
|
|
686
686
|
Actions.Add.displayName = 'Service.Actions.Add';
|
|
@@ -714,7 +714,7 @@ export var Actions;
|
|
|
714
714
|
* ```
|
|
715
715
|
*/
|
|
716
716
|
Actions.Remove = React.forwardRef((props, ref) => {
|
|
717
|
-
const { asChild, children, className, label, onClick, ...
|
|
717
|
+
const { asChild, children, className, label, onClick, ...rest } = props;
|
|
718
718
|
return (_jsx(CoreService.Actions, { children: ({ remove, rawService, bookable, selected, requiresAvailability, }) => {
|
|
719
719
|
// Disabled when not selected (nothing to remove) or not bookable
|
|
720
720
|
const isDisabled = !selected || !bookable;
|
|
@@ -722,14 +722,14 @@ export var Actions;
|
|
|
722
722
|
remove();
|
|
723
723
|
onClick?.(rawService);
|
|
724
724
|
};
|
|
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: {
|
|
725
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, className: className, onClick: handleClick, disabled: isDisabled, "data-testid": TestIds.serviceActionRemove, "data-selected": selected, "data-bookable": bookable, "data-requires-availability": requiresAvailability, customElement: children, customElementProps: {
|
|
726
726
|
onClick: handleClick,
|
|
727
727
|
disabled: isDisabled,
|
|
728
728
|
selected,
|
|
729
729
|
bookable,
|
|
730
730
|
requiresAvailability,
|
|
731
731
|
service: rawService,
|
|
732
|
-
}, children: _jsx("button", {
|
|
732
|
+
}, children: _jsx("button", { children: children || label }) }));
|
|
733
733
|
} }));
|
|
734
734
|
});
|
|
735
735
|
Actions.Remove.displayName = 'Service.Actions.Remove';
|
|
@@ -1067,10 +1067,10 @@ export var Schedule;
|
|
|
1067
1067
|
* ```
|
|
1068
1068
|
*/
|
|
1069
1069
|
export const DefaultCapacity = React.forwardRef((props, ref) => {
|
|
1070
|
-
const { asChild, children,
|
|
1070
|
+
const { asChild, children, ...rest } = props;
|
|
1071
1071
|
return (_jsx(CoreService.Info, { children: ({ type, defaultCapacity }) => {
|
|
1072
1072
|
const isClassOrCourse = type === 'CLASS' || type === 'COURSE';
|
|
1073
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
1073
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.serviceDefaultCapacity, customElement: children, customElementProps: { defaultCapacity, isClassOrCourse }, children: isClassOrCourse && defaultCapacity ? (_jsxs("span", { children: ["Max ", defaultCapacity, " participants"] })) : null }));
|
|
1074
1074
|
} }));
|
|
1075
1075
|
});
|
|
1076
1076
|
DefaultCapacity.displayName = 'Service.DefaultCapacity';
|
|
@@ -1098,10 +1098,10 @@ DefaultCapacity.displayName = 'Service.DefaultCapacity';
|
|
|
1098
1098
|
* ```
|
|
1099
1099
|
*/
|
|
1100
1100
|
export const AvailableOnline = React.forwardRef((props, ref) => {
|
|
1101
|
-
const { asChild, children,
|
|
1101
|
+
const { asChild, children, label, ...rest } = props;
|
|
1102
1102
|
return (_jsx(CoreService.Service, { children: ({ service }) => {
|
|
1103
1103
|
const availableOnline = service.conferencing?.enabled ?? false;
|
|
1104
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
1104
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.serviceAvailableOnline, customElement: children, customElementProps: { availableOnline }, children: availableOnline && label ? _jsx("span", { children: label }) : null }));
|
|
1105
1105
|
} }));
|
|
1106
1106
|
});
|
|
1107
1107
|
AvailableOnline.displayName = 'Service.AvailableOnline';
|
|
@@ -58,12 +58,11 @@ export declare const Root: React.ForwardRefExoticComponent<RootProps & React.Ref
|
|
|
58
58
|
/**
|
|
59
59
|
* Props for StaffMember.Name component
|
|
60
60
|
*/
|
|
61
|
-
export interface NameProps {
|
|
61
|
+
export interface NameProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
62
62
|
asChild?: boolean;
|
|
63
63
|
children?: React.ReactNode | AsChildChildren<{
|
|
64
64
|
name: string | undefined;
|
|
65
65
|
}>;
|
|
66
|
-
className?: string;
|
|
67
66
|
}
|
|
68
67
|
/**
|
|
69
68
|
* Displays the staff member name.
|
|
@@ -74,9 +74,9 @@ Root.displayName = 'StaffMember.Root';
|
|
|
74
74
|
* ```
|
|
75
75
|
*/
|
|
76
76
|
export const Name = React.forwardRef((props, ref) => {
|
|
77
|
-
const { asChild, children,
|
|
77
|
+
const { asChild, children, ...rest } = props;
|
|
78
78
|
const { name } = useStaffMemberContext();
|
|
79
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
79
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.staffMemberName, customElement: children, customElementProps: { name }, children: name ? _jsx("span", { children: name }) : null }));
|
|
80
80
|
});
|
|
81
81
|
Name.displayName = 'StaffMember.Name';
|
|
82
82
|
/**
|
|
@@ -123,7 +123,7 @@ Raw.displayName = 'StaffMember.Raw';
|
|
|
123
123
|
* ```
|
|
124
124
|
*/
|
|
125
125
|
const Select = React.forwardRef((props, ref) => {
|
|
126
|
-
const { asChild, children, onClick, label, className, ...
|
|
126
|
+
const { asChild, children, onClick, label, className, ...rest } = props;
|
|
127
127
|
return (_jsx(CoreStaffMember.Actions, { children: ({ select, selected, rawStaffMember }) => {
|
|
128
128
|
const handleClick = () => {
|
|
129
129
|
select();
|
|
@@ -131,11 +131,11 @@ const Select = React.forwardRef((props, ref) => {
|
|
|
131
131
|
onClick?.(rawStaffMember);
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.staffMemberActionSelect, "data-selected": selected, customElement: children, customElementProps: {
|
|
134
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, className: className, onClick: handleClick, "data-testid": TestIds.staffMemberActionSelect, "data-selected": selected, customElement: children, customElementProps: {
|
|
135
135
|
onClick: handleClick,
|
|
136
136
|
selected,
|
|
137
137
|
staffMember: rawStaffMember,
|
|
138
|
-
}, children: _jsx("button", {
|
|
138
|
+
}, children: _jsx("button", { children: children || label }) }));
|
|
139
139
|
} }));
|
|
140
140
|
});
|
|
141
141
|
Select.displayName = 'StaffMember.Actions.Select';
|
|
@@ -13,7 +13,8 @@ export declare enum TestIds {
|
|
|
13
13
|
staffMemberListRoot = "staff-member-list-root",
|
|
14
14
|
staffMemberListStaffMembers = "staff-member-list-staff-members",
|
|
15
15
|
staffMemberListStaffMember = "staff-member-list-staff-member",
|
|
16
|
-
staffMemberListActionClear = "staff-member-list-action-clear"
|
|
16
|
+
staffMemberListActionClear = "staff-member-list-action-clear",
|
|
17
|
+
staffMemberListTotals = "staff-member-list-totals"
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* Props for the StaffMemberList root component
|
|
@@ -77,13 +78,12 @@ export declare const StaffMemberRepeater: React.ForwardRefExoticComponent<StaffM
|
|
|
77
78
|
/**
|
|
78
79
|
* Props for StaffMemberList.Totals component
|
|
79
80
|
*/
|
|
80
|
-
export interface TotalsProps {
|
|
81
|
+
export interface TotalsProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
81
82
|
asChild?: boolean;
|
|
82
83
|
children?: React.ReactNode | AsChildChildren<{
|
|
83
84
|
count: number;
|
|
84
85
|
hasStaffMembers: boolean;
|
|
85
86
|
}>;
|
|
86
|
-
className?: string;
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Displays the total count of staff members.
|
|
@@ -23,6 +23,7 @@ export var TestIds;
|
|
|
23
23
|
TestIds["staffMemberListStaffMembers"] = "staff-member-list-staff-members";
|
|
24
24
|
TestIds["staffMemberListStaffMember"] = "staff-member-list-staff-member";
|
|
25
25
|
TestIds["staffMemberListActionClear"] = "staff-member-list-action-clear";
|
|
26
|
+
TestIds["staffMemberListTotals"] = "staff-member-list-totals";
|
|
26
27
|
})(TestIds || (TestIds = {}));
|
|
27
28
|
/**
|
|
28
29
|
* Root component that provides the StaffMemberList service context for rendering staff member lists.
|
|
@@ -110,10 +111,10 @@ StaffMemberRepeater.displayName = 'StaffMemberList.StaffMemberRepeater';
|
|
|
110
111
|
* ```
|
|
111
112
|
*/
|
|
112
113
|
export const Totals = React.forwardRef((props, ref) => {
|
|
113
|
-
const { asChild, children,
|
|
114
|
+
const { asChild, children, ...rest } = props;
|
|
114
115
|
return (_jsx(CoreStaffMemberList.StaffMembers, { children: ({ staffMembers, hasStaffMembers }) => {
|
|
115
116
|
const count = staffMembers.length;
|
|
116
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
117
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.staffMemberListTotals, customElement: children, customElementProps: { count, hasStaffMembers }, children: _jsx("span", { children: count }) }));
|
|
117
118
|
} }));
|
|
118
119
|
});
|
|
119
120
|
Totals.displayName = 'StaffMemberList.Totals';
|
|
@@ -147,7 +148,7 @@ Totals.displayName = 'StaffMemberList.Totals';
|
|
|
147
148
|
* ```
|
|
148
149
|
*/
|
|
149
150
|
const Clear = React.forwardRef((props, ref) => {
|
|
150
|
-
const { asChild, children, className, label, onClick, ...
|
|
151
|
+
const { asChild, children, className, label, onClick, ...rest } = props;
|
|
151
152
|
return (_jsx(CoreStaffMemberList.Actions, { children: ({ selectedStaffMember }) => {
|
|
152
153
|
let bookingService = null;
|
|
153
154
|
try {
|
|
@@ -160,9 +161,9 @@ const Clear = React.forwardRef((props, ref) => {
|
|
|
160
161
|
bookingService?.actions.clearResourceByType(STAFF_MEMBER_RESOURCE_TYPE_ID);
|
|
161
162
|
onClick?.(selectedStaffMember);
|
|
162
163
|
};
|
|
163
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.staffMemberListActionClear, customElement: children, customElementProps: {
|
|
164
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, className: className, onClick: handleClick, "data-testid": TestIds.staffMemberListActionClear, customElement: children, customElementProps: {
|
|
164
165
|
onClick: handleClick,
|
|
165
|
-
}, children: _jsx("button", {
|
|
166
|
+
}, children: _jsx("button", { children: children || label }) }));
|
|
166
167
|
} }));
|
|
167
168
|
});
|
|
168
169
|
Clear.displayName = 'StaffMemberList.Actions.Clear';
|
|
@@ -121,12 +121,11 @@ export declare const EndDate: React.ForwardRefExoticComponent<EndDateProps & Rea
|
|
|
121
121
|
/**
|
|
122
122
|
* Props for TimeSlot.Duration component
|
|
123
123
|
*/
|
|
124
|
-
export interface DurationProps {
|
|
124
|
+
export interface DurationProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
125
125
|
asChild?: boolean;
|
|
126
126
|
children?: AsChildChildren<{
|
|
127
127
|
durationInMinutes: number;
|
|
128
128
|
}>;
|
|
129
|
-
className?: string;
|
|
130
129
|
}
|
|
131
130
|
/**
|
|
132
131
|
* Calculates and displays the duration between start and end times in minutes.
|
|
@@ -249,12 +248,11 @@ export declare const Actions: {
|
|
|
249
248
|
/**
|
|
250
249
|
* Props for TimeSlot.Location.Name component
|
|
251
250
|
*/
|
|
252
|
-
export interface LocationNameProps {
|
|
251
|
+
export interface LocationNameProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
253
252
|
asChild?: boolean;
|
|
254
253
|
children?: AsChildChildren<{
|
|
255
254
|
name: string;
|
|
256
255
|
}>;
|
|
257
|
-
className?: string;
|
|
258
256
|
}
|
|
259
257
|
/**
|
|
260
258
|
* Displays the location name.
|
|
@@ -283,9 +281,8 @@ export declare const Location: {
|
|
|
283
281
|
/**
|
|
284
282
|
* Props for TimeSlot.StaffMembers component
|
|
285
283
|
*/
|
|
286
|
-
export interface StaffMembersProps {
|
|
284
|
+
export interface StaffMembersProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
287
285
|
children: React.ReactNode;
|
|
288
|
-
className?: string;
|
|
289
286
|
}
|
|
290
287
|
/**
|
|
291
288
|
* Container for the staff members list within a time slot.
|
|
@@ -329,12 +326,11 @@ export declare const StaffMemberRepeater: React.ForwardRefExoticComponent<StaffM
|
|
|
329
326
|
/**
|
|
330
327
|
* Props for TimeSlot.StaffMember.Name component
|
|
331
328
|
*/
|
|
332
|
-
export interface StaffMemberNameProps {
|
|
329
|
+
export interface StaffMemberNameProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
333
330
|
asChild?: boolean;
|
|
334
331
|
children?: AsChildChildren<{
|
|
335
332
|
name: string;
|
|
336
333
|
}>;
|
|
337
|
-
className?: string;
|
|
338
334
|
}
|
|
339
335
|
/**
|
|
340
336
|
* Displays the staff member name.
|
|
@@ -24,8 +24,8 @@ import * as CoreTimeSlot from '../core/time-slot-list/TimeSlot.js';
|
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
26
|
export const Root = React.forwardRef((props, ref) => {
|
|
27
|
-
const { children, timeSlot, asChild, className
|
|
28
|
-
return (_jsx(CoreTimeSlot.Root, { config: { timeSlot }, children: _jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, customElement: children,
|
|
27
|
+
const { children, timeSlot, asChild, className } = props;
|
|
28
|
+
return (_jsx(CoreTimeSlot.Root, { config: { timeSlot }, children: _jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, customElement: children, children: children }) }));
|
|
29
29
|
});
|
|
30
30
|
Root.displayName = 'TimeSlot.Root';
|
|
31
31
|
// ============================================================================
|
|
@@ -137,8 +137,8 @@ EndDate.displayName = 'TimeSlot.EndDate';
|
|
|
137
137
|
* ```
|
|
138
138
|
*/
|
|
139
139
|
export const Duration = React.forwardRef((props, ref) => {
|
|
140
|
-
const { asChild, children,
|
|
141
|
-
return (_jsx(CoreTimeSlot.Info, { children: ({ durationInMinutes }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
140
|
+
const { asChild, children, ...rest } = props;
|
|
141
|
+
return (_jsx(CoreTimeSlot.Info, { children: ({ durationInMinutes }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.timeSlotDuration, customElement: children, customElementProps: { durationInMinutes }, children: _jsx("span", { children: durationInMinutes }) })) }));
|
|
142
142
|
});
|
|
143
143
|
Duration.displayName = 'TimeSlot.Duration';
|
|
144
144
|
/**
|
|
@@ -175,19 +175,19 @@ Duration.displayName = 'TimeSlot.Duration';
|
|
|
175
175
|
* ```
|
|
176
176
|
*/
|
|
177
177
|
export const Select = React.forwardRef((props, ref) => {
|
|
178
|
-
const { asChild, children, className, label, onClick, ...
|
|
178
|
+
const { asChild, children, className, label, onClick, ...rest } = props;
|
|
179
179
|
return (_jsx(CoreTimeSlot.Actions, { children: ({ selectTimeSlot, timeSlot, isSelected, bookable }) => {
|
|
180
180
|
const handleClick = () => {
|
|
181
181
|
selectTimeSlot();
|
|
182
182
|
onClick?.(timeSlot);
|
|
183
183
|
};
|
|
184
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.timeSlotActionSelect, "data-selected": isSelected, "data-bookable": bookable, customElement: children, customElementProps: {
|
|
184
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, className: className, onClick: handleClick, disabled: !bookable, "data-testid": TestIds.timeSlotActionSelect, "data-selected": isSelected, "data-bookable": bookable, customElement: children, customElementProps: {
|
|
185
185
|
onClick: handleClick,
|
|
186
186
|
disabled: !bookable,
|
|
187
187
|
isSelected,
|
|
188
188
|
bookable,
|
|
189
189
|
timeSlot,
|
|
190
|
-
}, children: _jsx("button", {
|
|
190
|
+
}, children: _jsx("button", { children: children || label }) }));
|
|
191
191
|
} }));
|
|
192
192
|
});
|
|
193
193
|
Select.displayName = 'TimeSlot.Actions.Select';
|
|
@@ -222,7 +222,7 @@ Select.displayName = 'TimeSlot.Actions.Select';
|
|
|
222
222
|
* ```
|
|
223
223
|
*/
|
|
224
224
|
export const ClearStaffSelection = React.forwardRef((props, ref) => {
|
|
225
|
-
const { asChild, children, className, label, onClick, ...
|
|
225
|
+
const { asChild, children, className, label, onClick, ...rest } = props;
|
|
226
226
|
return (_jsx(CoreTimeSlot.Actions, { children: ({ clearStaffSelection, timeSlot }) => {
|
|
227
227
|
if (!clearStaffSelection) {
|
|
228
228
|
return null;
|
|
@@ -231,9 +231,9 @@ export const ClearStaffSelection = React.forwardRef((props, ref) => {
|
|
|
231
231
|
clearStaffSelection();
|
|
232
232
|
onClick?.(timeSlot);
|
|
233
233
|
};
|
|
234
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.timeSlotActionClearStaffSelection, customElement: children, customElementProps: {
|
|
234
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, className: className, onClick: handleClick, "data-testid": TestIds.timeSlotActionClearStaffSelection, customElement: children, customElementProps: {
|
|
235
235
|
onClick: handleClick,
|
|
236
|
-
}, children: _jsx("button", {
|
|
236
|
+
}, children: _jsx("button", { children: children || label }) }));
|
|
237
237
|
} }));
|
|
238
238
|
});
|
|
239
239
|
ClearStaffSelection.displayName = 'TimeSlot.Actions.ClearStaffSelection';
|
|
@@ -262,9 +262,9 @@ export const Actions = {
|
|
|
262
262
|
* ```
|
|
263
263
|
*/
|
|
264
264
|
export const LocationName = React.forwardRef((props, ref) => {
|
|
265
|
-
const { asChild, children,
|
|
265
|
+
const { asChild, children, ...rest } = props;
|
|
266
266
|
return (_jsx(CoreTimeSlot.Info, { children: ({ locationName }) => {
|
|
267
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
267
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.timeSlotLocationName, customElement: children, customElementProps: { name: locationName }, children: _jsx("span", { children: locationName }) }));
|
|
268
268
|
} }));
|
|
269
269
|
});
|
|
270
270
|
LocationName.displayName = 'TimeSlot.Location.Name';
|
|
@@ -290,9 +290,9 @@ export const Location = {
|
|
|
290
290
|
* ```
|
|
291
291
|
*/
|
|
292
292
|
export const StaffMembers = React.forwardRef((props, ref) => {
|
|
293
|
-
const { children,
|
|
293
|
+
const { children, ...attrs } = props;
|
|
294
294
|
return (_jsx(CoreTimeSlot.StaffMembers, { children: ({ staffMembers }) => {
|
|
295
|
-
return (_jsx(GenericList.Root, { items: staffMembers, children: _jsx("div", { ref: ref,
|
|
295
|
+
return (_jsx(GenericList.Root, { items: staffMembers, children: _jsx("div", { ref: ref, ...attrs, "data-testid": TestIds.timeSlotStaffMembers, children: children }) }));
|
|
296
296
|
} }));
|
|
297
297
|
});
|
|
298
298
|
StaffMembers.displayName = 'TimeSlot.StaffMembers';
|
|
@@ -341,8 +341,8 @@ StaffMemberRepeater.displayName = 'TimeSlot.StaffMemberRepeater';
|
|
|
341
341
|
* ```
|
|
342
342
|
*/
|
|
343
343
|
export const StaffMemberName = React.forwardRef((props, ref) => {
|
|
344
|
-
const { asChild, children,
|
|
345
|
-
return (_jsx(CoreTimeSlot.StaffMemberInfo, { children: ({ name }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
344
|
+
const { asChild, children, ...rest } = props;
|
|
345
|
+
return (_jsx(CoreTimeSlot.StaffMemberInfo, { children: ({ name }) => (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.timeSlotStaffMemberName, customElement: children, customElementProps: { name }, children: _jsx("span", { children: name }) })) }));
|
|
346
346
|
});
|
|
347
347
|
StaffMemberName.displayName = 'TimeSlot.StaffMember.Name';
|
|
348
348
|
/**
|
|
@@ -379,17 +379,17 @@ StaffMemberName.displayName = 'TimeSlot.StaffMember.Name';
|
|
|
379
379
|
* ```
|
|
380
380
|
*/
|
|
381
381
|
export const SelectStaffMember = React.forwardRef((props, ref) => {
|
|
382
|
-
const { asChild, children, className, label, onClick, ...
|
|
382
|
+
const { asChild, children, className, label, onClick, ...rest } = props;
|
|
383
383
|
return (_jsx(CoreTimeSlot.StaffMemberActions, { children: ({ selectStaffMember, isSelected, staffMember }) => {
|
|
384
384
|
const handleClick = () => {
|
|
385
385
|
selectStaffMember();
|
|
386
386
|
onClick?.(staffMember);
|
|
387
387
|
};
|
|
388
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.timeSlotStaffMemberActionSelect, "data-selected": isSelected, customElement: children, customElementProps: {
|
|
388
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, className: className, onClick: handleClick, "data-testid": TestIds.timeSlotStaffMemberActionSelect, "data-selected": isSelected, customElement: children, customElementProps: {
|
|
389
389
|
onClick: handleClick,
|
|
390
390
|
isSelected,
|
|
391
391
|
staffMember,
|
|
392
|
-
}, children: _jsx("button", {
|
|
392
|
+
}, children: _jsx("button", { children: children || label }) }));
|
|
393
393
|
} }));
|
|
394
394
|
});
|
|
395
395
|
SelectStaffMember.displayName = 'TimeSlot.StaffMember.Actions.Select';
|
|
@@ -163,7 +163,7 @@ export declare const Actions: {
|
|
|
163
163
|
/**
|
|
164
164
|
* Props for DateRange.Input component
|
|
165
165
|
*/
|
|
166
|
-
export interface DateRangeInputProps {
|
|
166
|
+
export interface DateRangeInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'children' | 'type' | 'value' | 'defaultValue'> {
|
|
167
167
|
/** Whether to render as a child component */
|
|
168
168
|
asChild?: boolean;
|
|
169
169
|
/** Children for custom rendering */
|
|
@@ -174,8 +174,6 @@ export interface DateRangeInputProps {
|
|
|
174
174
|
/** IANA timezone string for the time slots (e.g., "America/New_York") */
|
|
175
175
|
timezone: string | undefined;
|
|
176
176
|
}>;
|
|
177
|
-
/** CSS classes to apply to the container */
|
|
178
|
-
className?: string;
|
|
179
177
|
}
|
|
180
178
|
/**
|
|
181
179
|
* DateRange namespace for TimeSlotList date range filter
|
|
@@ -182,7 +182,7 @@ export const Actions = {
|
|
|
182
182
|
* Uses the core DateRange component to access service data.
|
|
183
183
|
* Both dates are set together and trigger a single fetch.
|
|
184
184
|
*
|
|
185
|
-
* Default rendering provides
|
|
185
|
+
* Default rendering provides a native date input.
|
|
186
186
|
*
|
|
187
187
|
* @component
|
|
188
188
|
* @example
|
|
@@ -203,18 +203,19 @@ export const Actions = {
|
|
|
203
203
|
* ```
|
|
204
204
|
*/
|
|
205
205
|
const DateRangeInput = React.forwardRef((props, ref) => {
|
|
206
|
-
const { asChild, children, className, ...
|
|
206
|
+
const { asChild, children, className, onChange, ...rest } = props;
|
|
207
207
|
return (_jsx(CoreTimeSlotList.DateRange, { children: ({ startDate, endDate, setDateRange, timezone }) => {
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
208
|
+
const handleChange = (e) => {
|
|
209
|
+
const date = parse(e.target.value, 'yyyy-MM-dd', new Date());
|
|
210
|
+
setDateRange(startOfDay(date), endOfDay(date));
|
|
211
|
+
onChange?.(e);
|
|
212
|
+
};
|
|
213
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, className: className, onChange: handleChange, "data-testid": TestIds.timeSlotListDateRangeInput, customElement: children, customElementProps: {
|
|
213
214
|
startDate,
|
|
214
215
|
endDate,
|
|
215
216
|
onChange: setDateRange,
|
|
216
217
|
timezone,
|
|
217
|
-
},
|
|
218
|
+
}, children: _jsx("input", { ref: ref, type: "date", value: toISODateString(startDate, timezone) }) }));
|
|
218
219
|
} }));
|
|
219
220
|
});
|
|
220
221
|
DateRangeInput.displayName = 'TimeSlotList.DateRange.Input';
|
|
@@ -11,7 +11,7 @@ export interface BookProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonEle
|
|
|
11
11
|
asChild?: boolean;
|
|
12
12
|
children?: React.ReactNode | ((props: BookChildProps) => React.ReactNode);
|
|
13
13
|
label?: string;
|
|
14
|
-
loadingState?:
|
|
14
|
+
loadingState?: React.ReactNode;
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
/**
|
|
17
17
|
* Called when checkout is required for payment.
|
|
@@ -57,7 +57,7 @@ var TestIds;
|
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
59
|
export const Book = React.forwardRef((props, ref) => {
|
|
60
|
-
const { asChild, children,
|
|
60
|
+
const { asChild, children, label, loadingState, disabled, onCheckout, onComplete, onError, onClick, ...rest } = props;
|
|
61
61
|
return (_jsx(CoreBook.Book, { onCheckout: (result) => {
|
|
62
62
|
// Create navigateToCheckout with checkoutId captured
|
|
63
63
|
const navigateToCheckout = (options) => navigateToCheckoutUtil({
|
|
@@ -68,12 +68,15 @@ export const Book = React.forwardRef((props, ref) => {
|
|
|
68
68
|
return onCheckout?.(navigateToCheckout);
|
|
69
69
|
}, onComplete: (result) => {
|
|
70
70
|
return onComplete?.({ orderId: result.orderId });
|
|
71
|
-
}, onError: onError, disabled: disabled, children: (
|
|
72
|
-
const handleClick = () => {
|
|
73
|
-
|
|
74
|
-
onClick?.(
|
|
71
|
+
}, onError: onError, disabled: disabled, children: (coreBookProps) => {
|
|
72
|
+
const handleClick = async () => {
|
|
73
|
+
await coreBookProps.onClick();
|
|
74
|
+
onClick?.(coreBookProps);
|
|
75
75
|
};
|
|
76
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
76
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, onClick: handleClick, disabled: coreBookProps.disabled, "data-testid": TestIds.bookingActionBook, "data-in-progress": coreBookProps.isLoading, "data-can-book": coreBookProps.canBook, customElement: children, customElementProps: {
|
|
77
|
+
...coreBookProps,
|
|
78
|
+
onClick: handleClick,
|
|
79
|
+
}, children: _jsx("button", { children: coreBookProps.isLoading
|
|
77
80
|
? loadingState
|
|
78
81
|
: children || label }) }));
|
|
79
82
|
} }));
|
|
@@ -44,12 +44,11 @@ export declare function TimeSlot(props: TimeSlotProps): React.ReactNode;
|
|
|
44
44
|
export declare namespace TimeSlot {
|
|
45
45
|
var displayName: string;
|
|
46
46
|
}
|
|
47
|
-
export interface StaffNameProps {
|
|
47
|
+
export interface StaffNameProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {
|
|
48
48
|
asChild?: boolean;
|
|
49
49
|
children?: AsChildChildren<{
|
|
50
50
|
name: string;
|
|
51
51
|
}>;
|
|
52
|
-
className?: string;
|
|
53
52
|
}
|
|
54
53
|
/**
|
|
55
54
|
* Displays the staff member's name from the current booking item.
|
|
@@ -61,11 +61,11 @@ TimeSlot.displayName = 'BookingItem.TimeSlot';
|
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
63
|
export const StaffName = React.forwardRef((props, ref) => {
|
|
64
|
-
const { asChild, children,
|
|
64
|
+
const { asChild, children, ...rest } = props;
|
|
65
65
|
return (_jsx(CoreBooking.BookingItemInfo, { children: ({ staffName }) => {
|
|
66
66
|
if (!staffName)
|
|
67
67
|
return null;
|
|
68
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild,
|
|
68
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, ...rest, "data-testid": TestIds.bookingItemStaffName, customElement: children, customElementProps: { name: staffName }, children: _jsx("span", { children: staffName }) }));
|
|
69
69
|
} }));
|
|
70
70
|
});
|
|
71
71
|
StaffName.displayName = 'BookingItem.StaffName';
|