@zappie/foundations 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,808 @@
1
+ import * as react from 'react';
2
+ import { KeyboardEvent as KeyboardEvent$1, ImgHTMLAttributes, ChangeEvent, ClipboardEvent } from 'react';
3
+ import * as _zappie_sdk from '@zappie/sdk';
4
+ import { CartLine, CartLineInput, CartIssue, CartFix, Quote, DeliveryAddress, Branch as Branch$1, MenuSchedule, CartFulfilment, OptionGroup as OptionGroup$1, Item, Money as Money$1, Choice as Choice$1, MoneyFormatOptions, PaymentMethodKind, Category, Menu, OpeningTime } from '@zappie/sdk';
5
+ import * as react_jsx_runtime from 'react/jsx-runtime';
6
+ import { useCart } from '@zappie/sdk/react';
7
+ import { P as PartProps, a as Presentation, S as SwipeDirection } from './engine-XTsgCwwe.js';
8
+ import { C as CloseOptions, O as OverlayQuery } from './history-Bqu12Vkz.js';
9
+ import '@base-ui/react/dialog';
10
+
11
+ /** Account stubs that do not read credentials or host authentication. */
12
+ type Customer = {
13
+ id: string;
14
+ givenName?: string;
15
+ phoneMasked: string;
16
+ };
17
+ /**
18
+ * Sign-in options reserved by the account contract.
19
+ * The current Account sign-in stub rejects with AccountNotConfiguredError.
20
+ */
21
+ type SignInOptions = {
22
+ returnTo?: string;
23
+ prompt?: "none" | "login";
24
+ display?: "popup" | "redirect" | "auto";
25
+ scopes?: ("openid" | "phone" | "profile" | "addresses" | "orders:read" | "offline_access" | "cart")[];
26
+ };
27
+ /**
28
+ * An error from Account sign-in and sign-out when authentication is not configured.
29
+ */
30
+ declare class AccountNotConfiguredError extends Error {
31
+ readonly code = "not_configured";
32
+ constructor();
33
+ }
34
+ declare function signIn(_options?: SignInOptions): Promise<void>;
35
+ declare function signOut(_options?: {
36
+ everywhere?: boolean;
37
+ }): Promise<void>;
38
+ /**
39
+ * Account UI stubs that expose a not_configured status and a null customer.
40
+ * SignIn and SignOut reject with AccountNotConfiguredError. They do not authenticate.
41
+ */
42
+ declare const Account: {
43
+ SignIn: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
44
+ asChild?: boolean;
45
+ children?: react.ReactNode | ((state: {
46
+ signIn: typeof signIn;
47
+ status: "not_configured";
48
+ }) => react.ReactNode);
49
+ } & react.RefAttributes<HTMLElement>>;
50
+ SignOut: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
51
+ asChild?: boolean;
52
+ children?: react.ReactNode | ((state: {
53
+ signOut: typeof signOut;
54
+ status: "not_configured";
55
+ }) => react.ReactNode);
56
+ } & react.RefAttributes<HTMLElement>>;
57
+ Customer: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
58
+ asChild?: boolean;
59
+ children?: react.ReactNode | ((state: {
60
+ customer: Customer | null;
61
+ status: "not_configured";
62
+ }) => react.ReactNode);
63
+ } & react.RefAttributes<HTMLElement>>;
64
+ };
65
+
66
+ /**
67
+ * The current quantity, bounds, step, disabled state and value setter exposed by a quantity control.
68
+ */
69
+ type QuantityState = {
70
+ value: number;
71
+ setValue: (value: number) => void;
72
+ min: number;
73
+ max: number;
74
+ step: number;
75
+ disabled: boolean;
76
+ };
77
+ /**
78
+ * Controlled or default quantity, bounds and change callback for Quantity.Root.
79
+ */
80
+ type QuantityProps = PartProps<QuantityState> & {
81
+ value?: number;
82
+ defaultValue?: number;
83
+ onValueChange?: (value: number) => void;
84
+ min?: number;
85
+ max?: number;
86
+ step?: number;
87
+ disabled?: boolean;
88
+ };
89
+ declare function Root$5({ value, defaultValue, onValueChange, min, max, step, disabled, ...props }: QuantityProps): react_jsx_runtime.JSX.Element;
90
+ /**
91
+ * Composable quantity controls with bounded step changes and keyboard support.
92
+ * Wrap Value, Increment and Decrement in Quantity.Root.
93
+ *
94
+ * @example
95
+ * ```tsx
96
+ * <Quantity.Root min={1} max={10} defaultValue={1}>
97
+ * <Quantity.Decrement>Less</Quantity.Decrement>
98
+ * <Quantity.Value aria-label="Quantity" />
99
+ * <Quantity.Increment>More</Quantity.Increment>
100
+ * </Quantity.Root>
101
+ * ```
102
+ */
103
+ declare const Quantity: {
104
+ Root: typeof Root$5;
105
+ Value: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
106
+ asChild?: boolean;
107
+ children?: react.ReactNode | ((state: QuantityState) => react.ReactNode);
108
+ } & react.RefAttributes<HTMLElement>>;
109
+ Increment: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
110
+ asChild?: boolean;
111
+ children?: react.ReactNode | ((state: QuantityState) => react.ReactNode);
112
+ } & react.RefAttributes<HTMLElement>>;
113
+ Decrement: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
114
+ asChild?: boolean;
115
+ children?: react.ReactNode | ((state: QuantityState) => react.ReactNode);
116
+ } & react.RefAttributes<HTMLElement>>;
117
+ };
118
+
119
+ type CartContext = ReturnType<typeof useCart>;
120
+ declare function Root$4(props: PartProps<CartContext>): react_jsx_runtime.JSX.Element;
121
+ type LineContext = {
122
+ line: CartLine;
123
+ item: _zappie_sdk.Item | undefined;
124
+ edit: (patch: Partial<Omit<CartLineInput, "itemId">>) => CartLine;
125
+ remove: () => void;
126
+ };
127
+ declare function CartQuantity({ lineId, ...props }: Omit<QuantityProps, "value" | "defaultValue" | "onValueChange"> & {
128
+ lineId: string;
129
+ }): react_jsx_runtime.JSX.Element | null;
130
+ /**
131
+ * Composable cart parts for lines, quantity changes, removal, empty state and validation issues.
132
+ * Wrap the parts in Cart.Root inside your ZappieProvider.
133
+ */
134
+ declare const Cart: {
135
+ Root: typeof Root$4;
136
+ Line: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
137
+ asChild?: boolean;
138
+ children?: react.ReactNode | ((state: LineContext) => react.ReactNode);
139
+ } & {
140
+ line: CartLine;
141
+ } & react.RefAttributes<HTMLElement>>;
142
+ Quantity: typeof CartQuantity;
143
+ Remove: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
144
+ asChild?: boolean;
145
+ children?: react.ReactNode | ((state: Record<string, never>) => react.ReactNode);
146
+ } & {
147
+ lineId: string;
148
+ } & react.RefAttributes<HTMLElement>>;
149
+ Empty: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
150
+ asChild?: boolean;
151
+ children?: react.ReactNode | ((state: Record<string, never>) => react.ReactNode);
152
+ } & react.RefAttributes<HTMLElement>>;
153
+ Issues: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
154
+ asChild?: boolean;
155
+ children?: react.ReactNode | ((state: {
156
+ issues: readonly CartIssue[];
157
+ applyFix: (issue: CartIssue, fix?: CartFix) => void;
158
+ }) => react.ReactNode);
159
+ } & react.RefAttributes<HTMLElement>>;
160
+ };
161
+ /**
162
+ * The quote and its display status: loading, stale, ready or offline.
163
+ */
164
+ type TotalsState = {
165
+ quote?: Quote | undefined;
166
+ status: "loading" | "stale" | "ready" | "offline";
167
+ };
168
+ /**
169
+ * Expose the cart quote and its freshness or network status to your render function.
170
+ * Subscribes to the cart and quote failures through your ZappieProvider.
171
+ */
172
+ declare const Totals: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
173
+ asChild?: boolean;
174
+ children?: react.ReactNode | ((state: TotalsState) => react.ReactNode);
175
+ } & react.RefAttributes<HTMLElement>>;
176
+
177
+ declare function useCombobox<T>(results: readonly T[], onSelect: (item: T) => void): {
178
+ setListId: react.Dispatch<react.SetStateAction<string>>;
179
+ registerOption: (index: number, id: string) => void;
180
+ activeIndex: number;
181
+ setActiveIndex: react.Dispatch<react.SetStateAction<number>>;
182
+ isOpen: boolean;
183
+ setOpen: react.Dispatch<react.SetStateAction<boolean>>;
184
+ select: (index: number) => void;
185
+ inputProps: {
186
+ role: string;
187
+ "aria-autocomplete": "list";
188
+ "aria-expanded": boolean;
189
+ "aria-controls": string;
190
+ "aria-activedescendant": string | undefined;
191
+ onKeyDown: (event: KeyboardEvent$1) => void;
192
+ onFocus: () => void;
193
+ };
194
+ listProps: {
195
+ id: string;
196
+ role: string;
197
+ hidden: boolean;
198
+ };
199
+ getOptionProps: (index: number) => {
200
+ id: string;
201
+ role: string;
202
+ "aria-selected": boolean;
203
+ "data-selected": string | undefined;
204
+ onMouseDown: (event: {
205
+ preventDefault: () => void;
206
+ }) => void;
207
+ onPointerDown: (event: {
208
+ stopPropagation: () => void;
209
+ }) => void;
210
+ onTouchStart: (event: {
211
+ stopPropagation: () => void;
212
+ }) => void;
213
+ onClick: () => void;
214
+ };
215
+ };
216
+
217
+ /**
218
+ * A labelled address suggestion with an ID and the delivery address selected by the shopper.
219
+ */
220
+ type AddressSuggestion = {
221
+ id: string;
222
+ label: string;
223
+ address: DeliveryAddress;
224
+ };
225
+ /**
226
+ * Address picker state with query controls, combobox navigation, suggestions and request status.
227
+ */
228
+ type AddressState = ReturnType<typeof useCombobox<AddressSuggestion>> & {
229
+ query: string;
230
+ setQuery: (query: string) => void;
231
+ suggestions: AddressSuggestion[];
232
+ status: "loading" | "ready" | "error";
233
+ error?: unknown;
234
+ };
235
+ declare function Picker({ getSuggestions, onSelect, query, defaultQuery, onQueryChange, debounceMs, announcement, ...props }: PartProps<AddressState> & {
236
+ /** Screen-reader text for the suggestion count. Override it for your language. */
237
+ announcement?: (count: number) => string;
238
+ getSuggestions: (query: string, signal?: AbortSignal) => Promise<AddressSuggestion[]>;
239
+ onSelect: (suggestion: AddressSuggestion) => void;
240
+ query?: string;
241
+ defaultQuery?: string;
242
+ onQueryChange?: (query: string) => void;
243
+ debounceMs?: number;
244
+ }): react_jsx_runtime.JSX.Element;
245
+ /**
246
+ * Composable address picker parts with debounced suggestions and keyboard navigation.
247
+ * Supply getSuggestions and onSelect to Address.Picker. It cancels outdated requests.
248
+ */
249
+ declare const Address: {
250
+ Picker: typeof Picker;
251
+ Input: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
252
+ asChild?: boolean;
253
+ children?: react.ReactNode | ((state: AddressState) => react.ReactNode);
254
+ } & react.RefAttributes<HTMLElement>>;
255
+ Suggestions: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
256
+ asChild?: boolean;
257
+ children?: react.ReactNode | ((state: AddressState) => react.ReactNode);
258
+ } & react.RefAttributes<HTMLElement>>;
259
+ Suggestion: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
260
+ asChild?: boolean;
261
+ children?: react.ReactNode | ((state: AddressState) => react.ReactNode);
262
+ } & {
263
+ index: number;
264
+ } & react.RefAttributes<HTMLElement>>;
265
+ };
266
+
267
+ type BranchPickerState = {
268
+ branches: Branch$1[];
269
+ selected?: Branch$1 | undefined;
270
+ isOpenNow: (branch: Branch$1) => boolean;
271
+ select: (branch: Branch$1) => Promise<void>;
272
+ isLoading: boolean;
273
+ error?: unknown;
274
+ };
275
+ /**
276
+ * A branch picker that moves the cart to a selected branch and exposes loading and error state.
277
+ * Use Branch.Picker within your ZappieProvider.
278
+ */
279
+ declare const Branch: {
280
+ Picker: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
281
+ asChild?: boolean;
282
+ children?: react.ReactNode | ((state: BranchPickerState) => react.ReactNode);
283
+ } & {
284
+ branches: Branch$1[];
285
+ value?: string;
286
+ onSelect?: (branch: Branch$1) => void;
287
+ } & react.RefAttributes<HTMLElement>>;
288
+ };
289
+
290
+ /**
291
+ * A selectable time with an ISO instant, local date and display label including the UTC offset.
292
+ */
293
+ type ScheduleSlot = {
294
+ value: string;
295
+ label: string;
296
+ date: string;
297
+ };
298
+ /**
299
+ * Available days and slots, the selected time and controls for choosing ASAP or a scheduled time.
300
+ */
301
+ type ScheduleState = {
302
+ days: {
303
+ date: string;
304
+ slots: ScheduleSlot[];
305
+ }[];
306
+ slots: ScheduleSlot[];
307
+ value: string | null;
308
+ setValue: (value: string | null) => void;
309
+ isAsap: boolean;
310
+ canAsap: boolean;
311
+ isValid: boolean;
312
+ };
313
+ /**
314
+ * Generate scheduling slots within branch hours and any supplied menu hours and preorder limits.
315
+ * Returns no slots when the branch does not support scheduling.
316
+ *
317
+ * @param branch - The branch whose hours and scheduling capability apply.
318
+ * @param timezone - The time zone used to interpret opening hours and label slots.
319
+ * @param now - The instant from which notice and scheduling limits are measured.
320
+ * @returns Slots with ISO values, local dates and display labels.
321
+ */
322
+ declare function scheduleSlots(branch: Branch$1, timezone: string, now: Date, { intervalMinutes, maxDays, noticeMinutes, menuSchedule, }?: {
323
+ intervalMinutes?: number | undefined;
324
+ maxDays?: number | undefined;
325
+ noticeMinutes?: number | undefined;
326
+ menuSchedule?: MenuSchedule | undefined;
327
+ }): ScheduleSlot[];
328
+ /**
329
+ * Expose valid fulfilment slots and ASAP eligibility using branch hours and loaded menu metadata.
330
+ * Use null for ASAP. Requires a ZappieProvider and refreshes the available times each minute.
331
+ */
332
+ declare const Schedule: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
333
+ asChild?: boolean;
334
+ children?: react.ReactNode | ((state: ScheduleState) => react.ReactNode);
335
+ } & {
336
+ branch: Branch$1;
337
+ timezone?: string;
338
+ value?: string | null;
339
+ defaultValue?: string | null;
340
+ onValueChange?: (value: string | null) => void;
341
+ intervalMinutes?: number | undefined;
342
+ maxDays?: number | undefined;
343
+ noticeMinutes?: number;
344
+ } & react.RefAttributes<HTMLElement>>;
345
+
346
+ type FulfilmentState = {
347
+ options: CartFulfilment["type"][];
348
+ value: CartFulfilment | null;
349
+ setValue: (value: CartFulfilment) => void;
350
+ };
351
+ /**
352
+ * A fulfilment switch that exposes the active branch modes and updates the SDK cart.
353
+ * Selections must use an offered mode and the active branch ID.
354
+ */
355
+ declare const Fulfilment: {
356
+ Switch: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
357
+ asChild?: boolean;
358
+ children?: react.ReactNode | ((state: FulfilmentState) => react.ReactNode);
359
+ } & {
360
+ value?: CartFulfilment | null;
361
+ defaultValue?: CartFulfilment | null;
362
+ onValueChange?: (value: CartFulfilment | null) => void;
363
+ } & react.RefAttributes<HTMLElement>>;
364
+ };
365
+
366
+ /**
367
+ * Manage either a supplied value or internal state initialized from defaultValue.
368
+ * The setter accepts a value or updater and calls onChange only when Object.is detects a change.
369
+ *
370
+ * @returns The current value and a stable setter. A defined value keeps state controlled by you.
371
+ */
372
+ declare function useControllableState<T>({ value, defaultValue, onChange, }: {
373
+ value?: T | undefined;
374
+ defaultValue: T;
375
+ onChange?: ((value: T) => void) | undefined;
376
+ }): readonly [T, (next: T | ((previous: T) => T)) => void];
377
+
378
+ /**
379
+ * An SDK option group with the effective rules exposed by the item preview.
380
+ */
381
+ type ActiveGroup = OptionGroup$1;
382
+ /**
383
+ * The current item selection, preview prices, validation issues and actions supplied to item form parts.
384
+ */
385
+ type ItemFormContext = {
386
+ item: Item;
387
+ groups: ActiveGroup[];
388
+ quantity: number;
389
+ setQuantity: (quantity: number) => void;
390
+ unitPrice: Money$1;
391
+ total: Money$1;
392
+ issues: CartIssue[];
393
+ canAdd: boolean;
394
+ add: () => CartLine | null;
395
+ status: "incomplete" | "valid" | "added";
396
+ value: CartLineInput;
397
+ setValue: (value: CartLineInput) => void;
398
+ };
399
+ /**
400
+ * Item form configuration with controlled or default selections and cart commit callbacks.
401
+ * Supply onCommit to update an existing line instead of adding a new one.
402
+ */
403
+ type ItemFormProps = PartProps<ItemFormContext> & {
404
+ item: Item;
405
+ value?: CartLineInput;
406
+ defaultValue?: Partial<CartLineInput>;
407
+ onValueChange?: (value: CartLineInput) => void;
408
+ defaultQuantity?: number;
409
+ onAdded?: (line: CartLine) => void;
410
+ /** Update an existing line through the same validation and focus workflow. */
411
+ onCommit?: (input: CartLineInput) => CartLine;
412
+ };
413
+ declare function Root$3({ item, value, defaultValue, onValueChange, defaultQuantity, onAdded, onCommit, ...props }: ItemFormProps): react_jsx_runtime.JSX.Element;
414
+
415
+ type GroupState = {
416
+ group: OptionGroup$1;
417
+ selected: string[];
418
+ invalid: boolean;
419
+ input: string;
420
+ setInput: (value: string) => void;
421
+ toggle: (id: string) => void;
422
+ quantities: Readonly<Record<string, number>>;
423
+ /** Set a choice's quantity within its bounds. Zero deselects it. A positive value selects it. */
424
+ setQuantity: (id: string, quantity: number) => void;
425
+ };
426
+ type ChoiceState = {
427
+ choice: Choice$1;
428
+ selected: boolean;
429
+ disabled: boolean;
430
+ toggle: () => void;
431
+ /** Selected quantity (0 when unselected) and the choice's bounds. */
432
+ quantity: number;
433
+ min: number;
434
+ max: number;
435
+ setQuantity: (quantity: number) => void;
436
+ };
437
+ /**
438
+ * Render a selectable option within an OptionGroup, with radio or checkbox semantics.
439
+ * Exposes selection and quantity controls and disables unavailable choices.
440
+ */
441
+ declare const Choice: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
442
+ asChild?: boolean;
443
+ children?: react.ReactNode | ((state: ChoiceState) => react.ReactNode);
444
+ } & {
445
+ choice: Choice$1;
446
+ } & react.RefAttributes<HTMLElement>>;
447
+ /**
448
+ * Group item options with selection rules, validation state and an Input part for typed responses.
449
+ * Use within ItemForm.Root. Use Choice for options and OptionGroup.Input for typed responses.
450
+ */
451
+ declare const OptionGroup: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
452
+ asChild?: boolean;
453
+ children?: react.ReactNode | ((state: GroupState) => react.ReactNode);
454
+ } & {
455
+ group: OptionGroup$1;
456
+ } & react.RefAttributes<HTMLElement>> & {
457
+ Input: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
458
+ asChild?: boolean;
459
+ children?: react.ReactNode | ((state: GroupState) => react.ReactNode);
460
+ } & react.RefAttributes<HTMLElement>>;
461
+ };
462
+
463
+ /**
464
+ * Composable item configuration parts for selecting options, validating a line and adding it to the cart.
465
+ * Use ItemForm.Root within your ZappieProvider and place Options and Add inside it.
466
+ */
467
+ declare const ItemForm: {
468
+ Root: typeof Root$3;
469
+ Options: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
470
+ asChild?: boolean;
471
+ children?: react.ReactNode | ((state: ItemFormContext) => react.ReactNode);
472
+ } & react.RefAttributes<HTMLElement>>;
473
+ Add: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
474
+ asChild?: boolean;
475
+ children?: react.ReactNode | ((state: ItemFormContext) => react.ReactNode);
476
+ } & react.RefAttributes<HTMLElement>>;
477
+ };
478
+
479
+ /** Props for a responsive storefront image. */
480
+ type ImageProps = Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "srcSet"> & {
481
+ src: string;
482
+ alt: string;
483
+ sizes?: string;
484
+ priority?: boolean;
485
+ quality?: number;
486
+ mode?: "resize" | "direct";
487
+ };
488
+ /** Render an image through same-origin resizing, or directly when unavailable. */
489
+ declare function Image({ src, sizes, priority, quality, mode, alt, ...props }: ImageProps): react_jsx_runtime.JSX.Element;
490
+
491
+ /**
492
+ * Render formatted SDK money in a data element, with the minor-unit amount as its value.
493
+ * You can override the content with children or a render function receiving the formatted string.
494
+ */
495
+ declare const Money: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
496
+ asChild?: boolean;
497
+ children?: react.ReactNode | ((state: {
498
+ formatted: string;
499
+ }) => react.ReactNode);
500
+ } & {
501
+ value: Money$1;
502
+ formatOptions?: MoneyFormatOptions;
503
+ } & react.RefAttributes<HTMLElement>>;
504
+
505
+ type OtpState = {
506
+ value: string;
507
+ slots: string[];
508
+ getSlotProps: (index: number) => ReturnType<typeof slotAttributes>;
509
+ };
510
+ declare function slotAttributes(index: number, length: number, value: string, disabled: boolean, update: (index: number, text: string) => void, focus: (index: number) => void): {
511
+ type: string;
512
+ inputMode: "numeric";
513
+ autoComplete: string;
514
+ "aria-label": string;
515
+ "data-otp-slot": number;
516
+ value: string;
517
+ disabled: boolean;
518
+ onChange: (event: ChangeEvent<HTMLInputElement>) => void;
519
+ onPaste: (event: ClipboardEvent<HTMLInputElement>) => void;
520
+ onKeyDown: (event: KeyboardEvent$1<HTMLInputElement>) => void;
521
+ onFocus: (event: {
522
+ currentTarget: HTMLInputElement;
523
+ }) => void;
524
+ };
525
+ /**
526
+ * A numeric one-time-code input with paste, autofill and keyboard focus handling.
527
+ * Otp.Input defaults to six digits and calls onComplete when a new complete code is entered.
528
+ * You supply code verification.
529
+ */
530
+ declare const Otp: {
531
+ Input: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
532
+ asChild?: boolean;
533
+ children?: react.ReactNode | ((state: OtpState) => react.ReactNode);
534
+ } & {
535
+ length?: number;
536
+ value?: string;
537
+ defaultValue?: string;
538
+ onValueChange?: (value: string) => void;
539
+ onComplete?: (value: string) => void;
540
+ disabled?: boolean;
541
+ } & react.RefAttributes<HTMLElement>>;
542
+ };
543
+
544
+ /**
545
+ * Control an overlay whose open state is stored in a URL query parameter.
546
+ *
547
+ * @param param - The query parameter to read and update.
548
+ * @param id - The value that identifies this overlay as open.
549
+ * @param options - Fallback query values and query parameters to omit when closing.
550
+ * @returns Reactive open state and history-backed open and close actions.
551
+ */
552
+ declare function useOverlay(param: string, id: string, options?: CloseOptions): {
553
+ isOpen: boolean;
554
+ open: (query?: OverlayQuery) => void;
555
+ close: () => void;
556
+ };
557
+ /** Tailwind's default min-width breakpoints. */
558
+ declare const BREAKPOINTS: {
559
+ readonly sm: 640;
560
+ readonly md: 768;
561
+ readonly lg: 1024;
562
+ readonly xl: 1280;
563
+ };
564
+ type ResponsivePresentation = Presentation | ({
565
+ base: Presentation;
566
+ } & Partial<Record<keyof typeof BREAKPOINTS, Presentation>>);
567
+ type OverlayState = ReturnType<typeof useOverlay>;
568
+ /**
569
+ * The URL is the only open state. The engine (Base UI) supplies the modal mechanics: portal,
570
+ * focus scope, scroll lock, outside and Escape dismissal, exit presence and, for drawers and
571
+ * sheets, swipe-to-dismiss. Every open or close it requests goes through the history core.
572
+ */
573
+ declare function Root$2({ param, id, presentation, swipeDirection, fallback, omitParams, navigation, ...props }: PartProps<OverlayState> & {
574
+ param: string;
575
+ id: string;
576
+ /** Your URL adapter for overlays whose open state lives in the path. */
577
+ navigation?: OverlayState;
578
+ /** A `dialog`, swipeable `drawer` or `sheet`. Use `{ base, sm, md, lg, xl }` for responsive layouts. */
579
+ presentation?: ResponsivePresentation;
580
+ /** Swipe direction to dismiss. Defaults to `down` for drawers and `right` for sheets. */
581
+ swipeDirection?: SwipeDirection;
582
+ } & CloseOptions): react_jsx_runtime.JSX.Element;
583
+ /**
584
+ * Composable dialog, drawer and sheet parts with URL-backed open state and a lazy modal engine.
585
+ * Use Root, Trigger, Content, Title and Close to connect history, focus handling and dismissal.
586
+ */
587
+ declare const Overlay: {
588
+ Root: typeof Root$2;
589
+ Trigger: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
590
+ asChild?: boolean;
591
+ children?: react.ReactNode | ((state: {
592
+ isOpen: boolean;
593
+ open: (query?: OverlayQuery) => void;
594
+ close: () => void;
595
+ }) => react.ReactNode);
596
+ } & react.RefAttributes<HTMLElement>>;
597
+ Content: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
598
+ asChild?: boolean;
599
+ children?: react.ReactNode | ((state: {
600
+ isOpen: boolean;
601
+ open: (query?: OverlayQuery) => void;
602
+ close: () => void;
603
+ }) => react.ReactNode);
604
+ } & {
605
+ /** Runs on Escape. Call `event.preventDefault()` to keep the overlay open. */
606
+ onEscape?: (event: KeyboardEvent) => void;
607
+ /** Runs on an outside pointer press or focus. Call `event.preventDefault()` to keep the overlay open. */
608
+ onInteractOutside?: (event: Event) => void;
609
+ /** Keep the content mounted while closed, for exit animations driven by `data-state`. */
610
+ forceMount?: true;
611
+ /** Where to mount the content. Defaults to `document.body`. */
612
+ container?: HTMLElement | null;
613
+ } & react.RefAttributes<HTMLElement>>;
614
+ Title: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
615
+ asChild?: boolean;
616
+ children?: react.ReactNode | ((state: {
617
+ isOpen: boolean;
618
+ open: (query?: OverlayQuery) => void;
619
+ close: () => void;
620
+ }) => react.ReactNode);
621
+ } & react.RefAttributes<HTMLElement>>;
622
+ Close: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
623
+ asChild?: boolean;
624
+ children?: react.ReactNode | ((state: {
625
+ isOpen: boolean;
626
+ open: (query?: OverlayQuery) => void;
627
+ close: () => void;
628
+ }) => react.ReactNode);
629
+ } & react.RefAttributes<HTMLElement>>;
630
+ };
631
+
632
+ /**
633
+ * A payment-method choice with optional disabled state and an explanatory reason.
634
+ */
635
+ type PaymentMethod = {
636
+ value: PaymentMethodKind;
637
+ disabled?: boolean;
638
+ reason?: string;
639
+ };
640
+ type PaymentState = {
641
+ methods: PaymentMethod[];
642
+ value: PaymentMethodKind | null;
643
+ setValue: (value: PaymentMethodKind) => void;
644
+ };
645
+ declare function Root$1({ methods, value, defaultValue, onValueChange, ...props }: PartProps<PaymentState> & {
646
+ methods: (PaymentMethod | PaymentMethodKind)[];
647
+ value?: PaymentMethodKind | null;
648
+ defaultValue?: PaymentMethodKind | null;
649
+ onValueChange?: (value: PaymentMethodKind | null) => void;
650
+ }): react_jsx_runtime.JSX.Element;
651
+ /**
652
+ * Composable payment-method radio controls with keyboard navigation.
653
+ * Root manages the selection. Item renders each method and prevents selection when disabled.
654
+ */
655
+ declare const PaymentMethods: {
656
+ Root: typeof Root$1;
657
+ Item: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
658
+ asChild?: boolean;
659
+ children?: react.ReactNode | ((state: PaymentMethod & {
660
+ selected: boolean;
661
+ }) => react.ReactNode);
662
+ } & {
663
+ value: PaymentMethodKind;
664
+ } & react.RefAttributes<HTMLElement>>;
665
+ };
666
+
667
+ /**
668
+ * A scored item or category returned by menu search, ordered by descending score.
669
+ */
670
+ type SearchResult = {
671
+ type: "item";
672
+ item: Item;
673
+ score: number;
674
+ } | {
675
+ type: "category";
676
+ category: Category;
677
+ score: number;
678
+ };
679
+ /**
680
+ * Index item names, tags and descriptions plus category names and descriptions for local search.
681
+ * Matches case- and accent-insensitive prefixes and allows a single edit for query tokens of at least four characters.
682
+ *
683
+ * @param menu - The menu snapshot you want to search.
684
+ * @returns A search function that requires every query token to match and sorts results by descending score.
685
+ */
686
+ declare function createSearchIndex(menu: Menu): (query: string) => SearchResult[];
687
+
688
+ /**
689
+ * Search query, results and combobox navigation exposed to search parts and render functions.
690
+ */
691
+ type SearchState = ReturnType<typeof useCombobox<SearchResult>> & {
692
+ query: string;
693
+ setQuery: (query: string) => void;
694
+ results: SearchResult[];
695
+ setComposing: (value: boolean) => void;
696
+ error?: string;
697
+ retry?: () => void;
698
+ };
699
+ /**
700
+ * Externally supplied search results and optional loading, error, retry and composition controls.
701
+ */
702
+ type SearchSource = {
703
+ results: SearchResult[];
704
+ isLoading?: boolean;
705
+ isStale?: boolean;
706
+ error?: string;
707
+ retry?: () => void;
708
+ onCompositionChange?: (composing: boolean) => void;
709
+ };
710
+ type RootProps = Omit<PartProps<SearchState>, "onSelect"> & {
711
+ announcement?: (count: number) => string;
712
+ query?: string;
713
+ defaultQuery?: string;
714
+ onQueryChange?: (query: string) => void;
715
+ onSelect?: (result: SearchResult) => void;
716
+ source?: SearchSource;
717
+ };
718
+ declare function Root(props: RootProps): react_jsx_runtime.JSX.Element;
719
+ /**
720
+ * Composable menu search parts with combobox navigation and result announcements.
721
+ * Use Root with your own source or let it index the active branch menu through your ZappieProvider.
722
+ */
723
+ declare const Search: {
724
+ Root: typeof Root;
725
+ Input: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
726
+ asChild?: boolean;
727
+ children?: react.ReactNode | ((state: SearchState) => react.ReactNode);
728
+ } & react.RefAttributes<HTMLElement>>;
729
+ Results: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
730
+ asChild?: boolean;
731
+ children?: react.ReactNode | ((state: SearchState) => react.ReactNode);
732
+ } & react.RefAttributes<HTMLElement>>;
733
+ Result: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
734
+ asChild?: boolean;
735
+ children?: react.ReactNode | ((state: SearchState) => react.ReactNode);
736
+ } & {
737
+ index: number;
738
+ } & react.RefAttributes<HTMLElement>>;
739
+ };
740
+
741
+ /**
742
+ * Parse a zero-padded HH:mm or HH:mm:ss wall-clock value without applying a time zone.
743
+ *
744
+ * @returns Clock parts with 12-hour and 24-hour values, or undefined for an invalid time.
745
+ * @example
746
+ * ```ts
747
+ * parseWallClock("14:30"); // { hour24: 14, hour12: 2, minute: 30, second: 0, period: "PM" }
748
+ * ```
749
+ */
750
+ declare function parseWallClock(value: string): {
751
+ hour24: number;
752
+ hour12: number;
753
+ minute: number;
754
+ second: number;
755
+ period: string;
756
+ } | undefined;
757
+ /**
758
+ * Format a valid wall-clock time as a 12-hour label with AM or PM.
759
+ * Omits zero minutes and all seconds. Returns invalid input unchanged.
760
+ *
761
+ * @example
762
+ * ```ts
763
+ * formatWallClock("14:00"); // "2 PM"
764
+ * formatWallClock("09:30:15"); // "9:30 AM"
765
+ * ```
766
+ */
767
+ declare function formatWallClock(value: string): string;
768
+ /**
769
+ * Group consecutive days with identical opening intervals into display labels.
770
+ * Skips disabled intervals and days with no enabled hours, and orders the groups from Sunday to Saturday.
771
+ */
772
+ declare function formatOpeningHours(times: OpeningTime[]): {
773
+ days: number[];
774
+ dayLabel: string;
775
+ hoursLabel: string;
776
+ }[];
777
+ type OpenStatusState = {
778
+ isOpen: boolean;
779
+ label: string;
780
+ nextChange?: Date;
781
+ };
782
+ /**
783
+ * Calculate whether a branch is open and provide its next opening or closing label.
784
+ * Accounts for weekly hours, special hours, overnight intervals and closedUntil.
785
+ *
786
+ * @param branch - The branch whose opening rules apply.
787
+ * @param timezone - The time zone used to interpret and display its hours.
788
+ * @param now - The instant to check. Defaults to the current time.
789
+ * @returns Open state, a display label and the next boundary found in the opening-hours window.
790
+ */
791
+ declare function getOpenStatus(branch: Branch$1, timezone: string, now?: Date): OpenStatusState;
792
+
793
+ /**
794
+ * Expose a branch opening label and open/closed state in a span or your render function.
795
+ * Uses your time zone override, then the branch, store or UTC, and refreshes at boundaries and window focus.
796
+ */
797
+ declare const OpenStatus: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, "children" | "defaultValue" | "value"> & {
798
+ asChild?: boolean;
799
+ children?: react.ReactNode | ((state: OpenStatusState) => react.ReactNode);
800
+ } & {
801
+ branch: Branch$1;
802
+ timezone?: string;
803
+ } & react.RefAttributes<HTMLElement>>;
804
+
805
+ /** The installed @zappie/foundations version. */
806
+ declare const FOUNDATIONS_VERSION: string;
807
+
808
+ export { Account, AccountNotConfiguredError, type ActiveGroup, Address, type AddressState, type AddressSuggestion, Branch, Cart, Choice, type Customer, FOUNDATIONS_VERSION, Fulfilment, Image, type ImageProps, ItemForm, type ItemFormContext, type ItemFormProps, Money, OpenStatus, OptionGroup, Otp, Overlay, PartProps, type PaymentMethod, PaymentMethods, Quantity, type QuantityProps, type QuantityState, Schedule, type ScheduleSlot, type ScheduleState, Search, type SearchResult, type SearchSource, type SearchState, type SignInOptions, Totals, type TotalsState, createSearchIndex, formatOpeningHours, formatWallClock, getOpenStatus, parseWallClock, scheduleSlots, useControllableState, useOverlay };