@wix/headless-bookings 0.0.12 → 0.0.14
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/api/index.d.ts +1 -0
- package/cjs/dist/api/index.js +1 -0
- package/cjs/dist/api/query-services/index.d.ts +6 -7
- package/cjs/dist/api/query-services/index.js +4 -4
- package/cjs/dist/api/time-slot-list/index.d.ts +53 -0
- package/cjs/dist/api/time-slot-list/index.js +133 -0
- package/cjs/dist/react/core/booking/Booking.d.ts +2 -2
- package/cjs/dist/react/core/location/Location.d.ts +3 -3
- package/cjs/dist/react/core/location/Location.js +2 -2
- package/cjs/dist/react/core/service/Service.d.ts +8 -8
- package/cjs/dist/react/core/service-list/ServiceList.d.ts +2 -2
- package/cjs/dist/react/core/time-slot-list/TimeSlot.d.ts +368 -0
- package/cjs/dist/react/core/time-slot-list/TimeSlot.js +357 -0
- package/cjs/dist/react/core/time-slot-list/TimeSlotList.d.ts +84 -0
- package/cjs/dist/react/core/time-slot-list/TimeSlotList.js +68 -0
- package/cjs/dist/react/index.d.ts +1 -0
- package/cjs/dist/react/index.js +1 -0
- package/cjs/dist/react/location/Location.d.ts +3 -3
- package/cjs/dist/react/service/Service.d.ts +9 -9
- package/cjs/dist/react/service/Service.js +5 -5
- package/cjs/dist/react/service-list/ServiceList.d.ts +3 -3
- package/cjs/dist/react/time-slot-list/TimeSlot.d.ts +438 -0
- package/cjs/dist/react/time-slot-list/TimeSlot.js +427 -0
- package/cjs/dist/react/time-slot-list/TimeSlotList.d.ts +209 -0
- package/cjs/dist/react/time-slot-list/TimeSlotList.js +199 -0
- package/cjs/dist/services/booking/booking.d.ts +12 -11
- package/cjs/dist/services/booking/booking.js +5 -3
- package/cjs/dist/services/index.d.ts +1 -0
- package/cjs/dist/services/index.js +1 -0
- package/cjs/dist/services/service/service.d.ts +5 -5
- package/cjs/dist/services/service/service.js +8 -8
- package/cjs/dist/services/service-list/service-list.d.ts +3 -3
- package/cjs/dist/services/time-slot-list/index.d.ts +6 -0
- package/cjs/dist/services/time-slot-list/index.js +6 -0
- package/cjs/dist/services/time-slot-list/time-slot-list.d.ts +58 -0
- package/cjs/dist/services/time-slot-list/time-slot-list.def.d.ts +84 -0
- package/cjs/dist/services/time-slot-list/time-slot-list.def.js +17 -0
- package/cjs/dist/services/time-slot-list/time-slot-list.js +349 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/query-services/index.d.ts +6 -7
- package/dist/api/query-services/index.js +4 -4
- package/dist/api/time-slot-list/index.d.ts +53 -0
- package/dist/api/time-slot-list/index.js +133 -0
- package/dist/react/core/booking/Booking.d.ts +2 -2
- package/dist/react/core/location/Location.d.ts +3 -3
- package/dist/react/core/location/Location.js +2 -2
- package/dist/react/core/service/Service.d.ts +8 -8
- package/dist/react/core/service-list/ServiceList.d.ts +2 -2
- package/dist/react/core/time-slot-list/TimeSlot.d.ts +368 -0
- package/dist/react/core/time-slot-list/TimeSlot.js +357 -0
- package/dist/react/core/time-slot-list/TimeSlotList.d.ts +84 -0
- package/dist/react/core/time-slot-list/TimeSlotList.js +68 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/react/location/Location.d.ts +3 -3
- package/dist/react/service/Service.d.ts +9 -9
- package/dist/react/service/Service.js +5 -5
- package/dist/react/service-list/ServiceList.d.ts +3 -3
- package/dist/react/time-slot-list/TimeSlot.d.ts +438 -0
- package/dist/react/time-slot-list/TimeSlot.js +427 -0
- package/dist/react/time-slot-list/TimeSlotList.d.ts +209 -0
- package/dist/react/time-slot-list/TimeSlotList.js +199 -0
- package/dist/services/booking/booking.d.ts +12 -11
- package/dist/services/booking/booking.js +5 -3
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +1 -0
- package/dist/services/service/service.d.ts +5 -5
- package/dist/services/service/service.js +8 -8
- package/dist/services/service-list/service-list.d.ts +3 -3
- package/dist/services/time-slot-list/index.d.ts +6 -0
- package/dist/services/time-slot-list/index.js +6 -0
- package/dist/services/time-slot-list/time-slot-list.d.ts +58 -0
- package/dist/services/time-slot-list/time-slot-list.def.d.ts +84 -0
- package/dist/services/time-slot-list/time-slot-list.def.js +17 -0
- package/dist/services/time-slot-list/time-slot-list.js +349 -0
- package/package.json +2 -2
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* Handles business, custom, and customer location types
|
|
4
4
|
* Converts location data to Address component format
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { LocationType } from '@wix/auto_sdk_bookings_services';
|
|
7
7
|
/**
|
|
8
8
|
* Parses location data into Address component format
|
|
9
9
|
*/
|
|
10
10
|
function parseLocationAddress(location, locationType) {
|
|
11
11
|
// Handle customer location specially
|
|
12
|
-
if (locationType ===
|
|
12
|
+
if (locationType === LocationType.CUSTOMER) {
|
|
13
13
|
// For customer location, return an AddressData object with Customer's Place
|
|
14
14
|
return {
|
|
15
15
|
address: {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { type ServiceServiceConfig } from '../../../services/service/service.js';
|
|
7
|
-
import {
|
|
7
|
+
import type { Service, Payment, BookingPolicy, Schedule } from '@wix/auto_sdk_bookings_services';
|
|
8
8
|
import type { MoneyData } from '@wix/headless-components/react';
|
|
9
9
|
/**
|
|
10
10
|
* Props for Service.Root component
|
|
@@ -22,7 +22,7 @@ export declare function Root(props: RootProps): React.ReactNode;
|
|
|
22
22
|
*/
|
|
23
23
|
export interface ServiceProps {
|
|
24
24
|
children: (data: {
|
|
25
|
-
service:
|
|
25
|
+
service: Service;
|
|
26
26
|
isLoading: boolean;
|
|
27
27
|
error: string | null;
|
|
28
28
|
}) => React.ReactNode;
|
|
@@ -55,7 +55,7 @@ export interface InfoProps {
|
|
|
55
55
|
name?: string;
|
|
56
56
|
_id?: string;
|
|
57
57
|
};
|
|
58
|
-
locations?: Array<NonNullable<
|
|
58
|
+
locations?: Array<NonNullable<Service['locations']>[number]>;
|
|
59
59
|
staff?: Array<{
|
|
60
60
|
name?: string;
|
|
61
61
|
_id?: string;
|
|
@@ -110,8 +110,8 @@ export declare function Info(props: InfoProps): React.ReactNode;
|
|
|
110
110
|
*/
|
|
111
111
|
export interface PriceProps {
|
|
112
112
|
children: (data: {
|
|
113
|
-
servicePayment:
|
|
114
|
-
rateType:
|
|
113
|
+
servicePayment: Payment | undefined;
|
|
114
|
+
rateType: Payment['rateType'] | undefined;
|
|
115
115
|
money: MoneyData | null;
|
|
116
116
|
minPrice: MoneyData | null;
|
|
117
117
|
maxPrice: MoneyData | null;
|
|
@@ -151,7 +151,7 @@ export interface ActionsProps {
|
|
|
151
151
|
select: () => void;
|
|
152
152
|
add: () => void;
|
|
153
153
|
remove: () => void;
|
|
154
|
-
rawService:
|
|
154
|
+
rawService: Service;
|
|
155
155
|
bookable: boolean;
|
|
156
156
|
selected: boolean;
|
|
157
157
|
requiresAvailability: boolean;
|
|
@@ -180,7 +180,7 @@ export declare function Actions(props: ActionsProps): React.ReactNode;
|
|
|
180
180
|
*/
|
|
181
181
|
export interface PolicyProps {
|
|
182
182
|
children: (data: {
|
|
183
|
-
bookingPolicy:
|
|
183
|
+
bookingPolicy: BookingPolicy | null;
|
|
184
184
|
cancellationPolicyEnabled: boolean;
|
|
185
185
|
limitLatestCancellationEnabled: boolean;
|
|
186
186
|
latestCancellationInMinutes: number | undefined;
|
|
@@ -219,7 +219,7 @@ export declare function Policy(props: PolicyProps): React.ReactNode;
|
|
|
219
219
|
*/
|
|
220
220
|
export interface ScheduleProps {
|
|
221
221
|
children: (data: {
|
|
222
|
-
schedule:
|
|
222
|
+
schedule: Schedule | null;
|
|
223
223
|
isClassOrCourse: boolean;
|
|
224
224
|
}) => React.ReactNode;
|
|
225
225
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { type ServiceListServiceConfig, type QueryOptions } from '../../../services/service-list/service-list.js';
|
|
7
|
-
import type {
|
|
7
|
+
import type { Service } from '@wix/auto_sdk_bookings_services';
|
|
8
8
|
import type { PagingMetadata } from '../../../api/query-services/index.js';
|
|
9
9
|
/**
|
|
10
10
|
* Props for ServiceList.Root component
|
|
@@ -37,7 +37,7 @@ export interface ServicesProps {
|
|
|
37
37
|
*/
|
|
38
38
|
export interface ServicesRenderProps {
|
|
39
39
|
/** Array of services */
|
|
40
|
-
services:
|
|
40
|
+
services: Service[];
|
|
41
41
|
/** Whether services are currently loading */
|
|
42
42
|
isLoading: boolean;
|
|
43
43
|
/** Error message, or null if no error */
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core TimeSlot Components
|
|
3
|
+
* Provides low-level access to TimeSlot data via render props
|
|
4
|
+
*
|
|
5
|
+
* Note: These components must be used within TimeSlotList.TimeSlotRepeater
|
|
6
|
+
* which provides the TimeSlotProvider context.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import type { TimeSlot as TimeSlotType } from '../../../services/time-slot-list/time-slot-list.def.js';
|
|
10
|
+
/**
|
|
11
|
+
* Context value for TimeSlot components
|
|
12
|
+
*/
|
|
13
|
+
export interface TimeSlotContextValue {
|
|
14
|
+
/** The current time slot data */
|
|
15
|
+
slot: TimeSlotType;
|
|
16
|
+
/** Whether this slot is currently selected */
|
|
17
|
+
isSelected: boolean;
|
|
18
|
+
/** Action to select this slot */
|
|
19
|
+
selectSlot: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Hook to access TimeSlot context
|
|
23
|
+
* @throws Error if used outside of TimeSlotProvider
|
|
24
|
+
*/
|
|
25
|
+
export declare function useTimeSlotContext(): TimeSlotContextValue;
|
|
26
|
+
/**
|
|
27
|
+
* Props for TimeSlotProvider
|
|
28
|
+
*/
|
|
29
|
+
export interface TimeSlotProviderProps {
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
slot: TimeSlotType;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Provider component used by TimeSlotRepeater to provide context.
|
|
35
|
+
* Not used directly by consumers - only by TimeSlotList.TimeSlotRepeater.
|
|
36
|
+
*/
|
|
37
|
+
export declare function TimeSlotProvider(props: TimeSlotProviderProps): React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Context value for Location components
|
|
40
|
+
*/
|
|
41
|
+
export interface LocationContextValue {
|
|
42
|
+
location: LocationData;
|
|
43
|
+
selectLocation: () => void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Hook to access Location context
|
|
47
|
+
* @throws Error if used outside of LocationProvider
|
|
48
|
+
*/
|
|
49
|
+
export declare function useLocationContext(): LocationContextValue;
|
|
50
|
+
/**
|
|
51
|
+
* Props for LocationProvider
|
|
52
|
+
*/
|
|
53
|
+
export interface LocationProviderProps {
|
|
54
|
+
children: React.ReactNode;
|
|
55
|
+
location: LocationData;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Provider component used by LocationRepeater to provide context.
|
|
59
|
+
* Not used directly by consumers - only by TimeSlot.LocationRepeater.
|
|
60
|
+
*/
|
|
61
|
+
export declare function LocationProvider(props: LocationProviderProps): React.ReactNode;
|
|
62
|
+
/**
|
|
63
|
+
* Context value for StaffMember components
|
|
64
|
+
*/
|
|
65
|
+
export interface StaffMemberContextValue {
|
|
66
|
+
staffMember: StaffMemberData;
|
|
67
|
+
selectStaffMember: () => void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Hook to access StaffMember context
|
|
71
|
+
* @throws Error if used outside of StaffMemberProvider
|
|
72
|
+
*/
|
|
73
|
+
export declare function useStaffMemberContext(): StaffMemberContextValue;
|
|
74
|
+
/**
|
|
75
|
+
* Props for StaffMemberProvider
|
|
76
|
+
*/
|
|
77
|
+
export interface StaffMemberProviderProps {
|
|
78
|
+
children: React.ReactNode;
|
|
79
|
+
staffMember: StaffMemberData;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Provider component used by StaffMemberRepeater to provide context.
|
|
83
|
+
* Not used directly by consumers - only by TimeSlot.StaffMemberRepeater.
|
|
84
|
+
*/
|
|
85
|
+
export declare function StaffMemberProvider(props: StaffMemberProviderProps): React.ReactNode;
|
|
86
|
+
/**
|
|
87
|
+
* Props for Info render prop component
|
|
88
|
+
*/
|
|
89
|
+
export interface InfoProps {
|
|
90
|
+
children: (data: {
|
|
91
|
+
/** Raw localStartDate string from slot */
|
|
92
|
+
startDate: string | undefined;
|
|
93
|
+
/** Raw localEndDate string from slot */
|
|
94
|
+
endDate: string | undefined;
|
|
95
|
+
/** Calculated duration in minutes (null if dates unavailable) */
|
|
96
|
+
durationInMinutes: number | null;
|
|
97
|
+
/** Whether the slot is bookable */
|
|
98
|
+
bookable: boolean;
|
|
99
|
+
/** Whether this slot is currently selected */
|
|
100
|
+
isSelected: boolean;
|
|
101
|
+
/** The raw slot object for advanced use cases */
|
|
102
|
+
slot: TimeSlotType;
|
|
103
|
+
}) => React.ReactNode;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Core component that provides access to time slot info via render props.
|
|
107
|
+
* Includes start/end dates, duration, bookable status, and selection state.
|
|
108
|
+
*
|
|
109
|
+
* @component
|
|
110
|
+
* @example
|
|
111
|
+
* ```tsx
|
|
112
|
+
* <TimeSlot.Info>
|
|
113
|
+
* {({ startDate, endDate, durationInMinutes, bookable, isSelected }) => (
|
|
114
|
+
* <div>
|
|
115
|
+
* <span>{startDate}</span>
|
|
116
|
+
* <span>{durationInMinutes} min</span>
|
|
117
|
+
* </div>
|
|
118
|
+
* )}
|
|
119
|
+
* </TimeSlot.Info>
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export declare function Info(props: InfoProps): React.ReactNode;
|
|
123
|
+
/**
|
|
124
|
+
* Props for Actions render prop component
|
|
125
|
+
*/
|
|
126
|
+
export interface ActionsProps {
|
|
127
|
+
children: (data: {
|
|
128
|
+
/** Action to select this slot */
|
|
129
|
+
selectSlot: () => void;
|
|
130
|
+
/** Action to clear preferences */
|
|
131
|
+
clearPreferences?: () => void;
|
|
132
|
+
/** The raw slot object */
|
|
133
|
+
slot: TimeSlotType;
|
|
134
|
+
/** Whether the slot is bookable */
|
|
135
|
+
bookable: boolean;
|
|
136
|
+
/** Whether this slot is currently selected */
|
|
137
|
+
isSelected: boolean;
|
|
138
|
+
}) => React.ReactNode;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Core component that provides slot actions via render props.
|
|
142
|
+
*
|
|
143
|
+
* @component
|
|
144
|
+
* @example
|
|
145
|
+
* ```tsx
|
|
146
|
+
* <TimeSlot.Actions>
|
|
147
|
+
* {({ selectSlot, isSelected, bookable, clearPreferences, shouldShowClearPreferences }) => (
|
|
148
|
+
* <div>
|
|
149
|
+
* <button onClick={selectSlot} disabled={!bookable}>
|
|
150
|
+
* {isSelected ? 'Selected' : 'Select'}
|
|
151
|
+
* </button>
|
|
152
|
+
* {shouldShowClearPreferences && (
|
|
153
|
+
* <button onClick={clearPreferences}>Change</button>
|
|
154
|
+
* )}
|
|
155
|
+
* </div>
|
|
156
|
+
* )}
|
|
157
|
+
* </TimeSlot.Actions>
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export declare function Actions(props: ActionsProps): React.ReactNode;
|
|
161
|
+
/**
|
|
162
|
+
* Location data with selection state
|
|
163
|
+
*/
|
|
164
|
+
export interface LocationData {
|
|
165
|
+
/** Location ID */
|
|
166
|
+
id: string;
|
|
167
|
+
/** Location name */
|
|
168
|
+
name: string;
|
|
169
|
+
/** Whether this location is currently selected */
|
|
170
|
+
isSelected: boolean;
|
|
171
|
+
/** Whether this location is selectable (compatible with selected staff, or no staff selected) */
|
|
172
|
+
isSelectable: boolean;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Props for Locations render prop component
|
|
176
|
+
*/
|
|
177
|
+
export interface LocationsProps {
|
|
178
|
+
children: (data: {
|
|
179
|
+
/** Array of locations with selection state */
|
|
180
|
+
locations: LocationData[];
|
|
181
|
+
/** Action to select a location */
|
|
182
|
+
selectLocation: (locationId: string) => void;
|
|
183
|
+
}) => React.ReactNode;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Core component that provides access to time slot locations via render props.
|
|
187
|
+
* Extracts locations from slot.staffByLocation and enriches with name from originalSlots.
|
|
188
|
+
* Each location includes isSelected and isSelectable based on current selection state.
|
|
189
|
+
*
|
|
190
|
+
* @component
|
|
191
|
+
* @example
|
|
192
|
+
* ```tsx
|
|
193
|
+
* <CoreTimeSlot.Locations>
|
|
194
|
+
* {({ locations, locationsCount, selectLocation }) => (
|
|
195
|
+
* <GenericList.Root items={locations}>
|
|
196
|
+
* {children}
|
|
197
|
+
* </GenericList.Root>
|
|
198
|
+
* )}
|
|
199
|
+
* </CoreTimeSlot.Locations>
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
export declare function Locations(props: LocationsProps): React.ReactNode;
|
|
203
|
+
/**
|
|
204
|
+
* Props for LocationInfo render prop component
|
|
205
|
+
*/
|
|
206
|
+
export interface LocationInfoProps {
|
|
207
|
+
children: (data: {
|
|
208
|
+
/** Location name */
|
|
209
|
+
name: string;
|
|
210
|
+
/** Whether this location is currently selected */
|
|
211
|
+
isSelected: boolean;
|
|
212
|
+
/** Whether this location is selectable */
|
|
213
|
+
isSelectable: boolean;
|
|
214
|
+
/** The raw location object */
|
|
215
|
+
location: LocationData;
|
|
216
|
+
}) => React.ReactNode;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Core component that provides access to location info via render props.
|
|
220
|
+
* Must be used within LocationProvider.
|
|
221
|
+
*
|
|
222
|
+
* @component
|
|
223
|
+
* @example
|
|
224
|
+
* ```tsx
|
|
225
|
+
* <LocationInfo>
|
|
226
|
+
* {({ name, isSelected, isSelectable }) => (
|
|
227
|
+
* <span>{name}</span>
|
|
228
|
+
* )}
|
|
229
|
+
* </LocationInfo>
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
export declare function LocationInfo(props: LocationInfoProps): React.ReactNode;
|
|
233
|
+
/**
|
|
234
|
+
* Props for LocationActions render prop component
|
|
235
|
+
*/
|
|
236
|
+
export interface LocationActionsProps {
|
|
237
|
+
children: (data: {
|
|
238
|
+
/** Action to select this location */
|
|
239
|
+
selectLocation: () => void;
|
|
240
|
+
/** Whether this location is currently selected */
|
|
241
|
+
isSelected: boolean;
|
|
242
|
+
/** Whether this location is selectable */
|
|
243
|
+
isSelectable: boolean;
|
|
244
|
+
/** The raw location object */
|
|
245
|
+
location: LocationData;
|
|
246
|
+
}) => React.ReactNode;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Core component that provides location actions via render props.
|
|
250
|
+
* Must be used within LocationProvider.
|
|
251
|
+
*
|
|
252
|
+
* @component
|
|
253
|
+
* @example
|
|
254
|
+
* ```tsx
|
|
255
|
+
* <LocationActions>
|
|
256
|
+
* {({ selectLocation, isSelected, isSelectable }) => (
|
|
257
|
+
* <button onClick={selectLocation} disabled={!isSelectable}>
|
|
258
|
+
* {isSelected ? 'Selected' : 'Select'}
|
|
259
|
+
* </button>
|
|
260
|
+
* )}
|
|
261
|
+
* </LocationActions>
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
export declare function LocationActions(props: LocationActionsProps): React.ReactNode;
|
|
265
|
+
/**
|
|
266
|
+
* Staff member data with selection state
|
|
267
|
+
*/
|
|
268
|
+
export interface StaffMemberData {
|
|
269
|
+
/** Staff member ID */
|
|
270
|
+
id: string;
|
|
271
|
+
/** Staff member name */
|
|
272
|
+
name: string;
|
|
273
|
+
/** Whether this staff member is currently selected */
|
|
274
|
+
isSelected: boolean;
|
|
275
|
+
/** Whether this staff member is selectable (works at selected location, or no location selected) */
|
|
276
|
+
isSelectable: boolean;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Props for StaffMembers render prop component
|
|
280
|
+
*/
|
|
281
|
+
export interface StaffMembersProps {
|
|
282
|
+
children: (data: {
|
|
283
|
+
/** Array of staff members with selection state */
|
|
284
|
+
staffMembers: StaffMemberData[];
|
|
285
|
+
/** Action to select a staff member */
|
|
286
|
+
selectStaffMember: (staffMemberId: string) => void;
|
|
287
|
+
}) => React.ReactNode;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Core component that provides access to time slot staff members via render props.
|
|
291
|
+
* Extracts unique staff members from slot.staffByLocation (names already included).
|
|
292
|
+
* Each staff member includes isSelected and isSelectable based on current selection state.
|
|
293
|
+
*
|
|
294
|
+
* @component
|
|
295
|
+
* @example
|
|
296
|
+
* ```tsx
|
|
297
|
+
* <CoreTimeSlot.StaffMembers>
|
|
298
|
+
* {({ staffMembers, selectStaffMember }) => (
|
|
299
|
+
* <GenericList.Root items={staffMembers}>
|
|
300
|
+
* {children}
|
|
301
|
+
* </GenericList.Root>
|
|
302
|
+
* )}
|
|
303
|
+
* </CoreTimeSlot.StaffMembers>
|
|
304
|
+
* ```
|
|
305
|
+
*/
|
|
306
|
+
export declare function StaffMembers(props: StaffMembersProps): React.ReactNode;
|
|
307
|
+
/**
|
|
308
|
+
* Props for StaffMemberInfo render prop component
|
|
309
|
+
*/
|
|
310
|
+
export interface StaffMemberInfoProps {
|
|
311
|
+
children: (data: {
|
|
312
|
+
/** Staff member name */
|
|
313
|
+
name: string;
|
|
314
|
+
/** Whether this staff member is currently selected */
|
|
315
|
+
isSelected: boolean;
|
|
316
|
+
/** Whether this staff member is selectable */
|
|
317
|
+
isSelectable: boolean;
|
|
318
|
+
/** The raw staff member object */
|
|
319
|
+
staffMember: StaffMemberData;
|
|
320
|
+
}) => React.ReactNode;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Core component that provides access to staff member info via render props.
|
|
324
|
+
* Must be used within StaffMemberProvider.
|
|
325
|
+
*
|
|
326
|
+
* @component
|
|
327
|
+
* @example
|
|
328
|
+
* ```tsx
|
|
329
|
+
* <StaffMemberInfo>
|
|
330
|
+
* {({ name, isSelected, isSelectable }) => (
|
|
331
|
+
* <span>{name}</span>
|
|
332
|
+
* )}
|
|
333
|
+
* </StaffMemberInfo>
|
|
334
|
+
* ```
|
|
335
|
+
*/
|
|
336
|
+
export declare function StaffMemberInfo(props: StaffMemberInfoProps): React.ReactNode;
|
|
337
|
+
/**
|
|
338
|
+
* Props for StaffMemberActions render prop component
|
|
339
|
+
*/
|
|
340
|
+
export interface StaffMemberActionsProps {
|
|
341
|
+
children: (data: {
|
|
342
|
+
/** Action to select this staff member */
|
|
343
|
+
selectStaffMember: () => void;
|
|
344
|
+
/** Whether this staff member is currently selected */
|
|
345
|
+
isSelected: boolean;
|
|
346
|
+
/** Whether this staff member is selectable */
|
|
347
|
+
isSelectable: boolean;
|
|
348
|
+
/** The raw staff member object */
|
|
349
|
+
staffMember: StaffMemberData;
|
|
350
|
+
}) => React.ReactNode;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Core component that provides staff member actions via render props.
|
|
354
|
+
* Must be used within StaffMemberProvider.
|
|
355
|
+
*
|
|
356
|
+
* @component
|
|
357
|
+
* @example
|
|
358
|
+
* ```tsx
|
|
359
|
+
* <StaffMemberActions>
|
|
360
|
+
* {({ selectStaffMember, isSelected, isSelectable }) => (
|
|
361
|
+
* <button onClick={selectStaffMember} disabled={!isSelectable}>
|
|
362
|
+
* {isSelected ? 'Selected' : 'Select'}
|
|
363
|
+
* </button>
|
|
364
|
+
* )}
|
|
365
|
+
* </StaffMemberActions>
|
|
366
|
+
* ```
|
|
367
|
+
*/
|
|
368
|
+
export declare function StaffMemberActions(props: StaffMemberActionsProps): React.ReactNode;
|