@withnicer/ui 0.0.0-stage → 1.0.0
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/README.md +74 -2
- package/dist/index.d.ts +919 -0
- package/dist/index.js +5521 -0
- package/package.json +91 -4
- package/src/assets/avatar-placeholder-dark.svg +4 -0
- package/src/assets/avatar-placeholder-light.svg +4 -0
- package/src/assets/cards/amex.png +0 -0
- package/src/assets/cards/amex.svg +4 -0
- package/src/assets/cards/apple-pay.png +0 -0
- package/src/assets/cards/apple-pay.svg +4 -0
- package/src/assets/cards/cartes-bancaires.png +0 -0
- package/src/assets/cards/cartes-bancaires.svg +4 -0
- package/src/assets/cards/diners.png +0 -0
- package/src/assets/cards/diners.svg +6 -0
- package/src/assets/cards/discover.png +0 -0
- package/src/assets/cards/discover.svg +13 -0
- package/src/assets/cards/eftpos.png +0 -0
- package/src/assets/cards/eftpos.svg +11 -0
- package/src/assets/cards/google-pay.png +0 -0
- package/src/assets/cards/google-pay.svg +7 -0
- package/src/assets/cards/hiper.png +0 -0
- package/src/assets/cards/hiper.svg +9 -0
- package/src/assets/cards/hipercard.png +0 -0
- package/src/assets/cards/hipercard.svg +4 -0
- package/src/assets/cards/interac.png +0 -0
- package/src/assets/cards/interac.svg +16 -0
- package/src/assets/cards/jcb.png +0 -0
- package/src/assets/cards/jcb.svg +31 -0
- package/src/assets/cards/maestro.png +0 -0
- package/src/assets/cards/maestro.svg +7 -0
- package/src/assets/cards/mastercard.png +0 -0
- package/src/assets/cards/mastercard.svg +6 -0
- package/src/assets/cards/unionpay.png +0 -0
- package/src/assets/cards/unionpay.svg +8 -0
- package/src/assets/cards/unknown.png +0 -0
- package/src/assets/cards/unknown.svg +3 -0
- package/src/assets/cards/visa.png +0 -0
- package/src/assets/cards/visa.svg +4 -0
- package/src/assets/dropdown-black.svg +5 -0
- package/src/assets/dropdown-white.svg +5 -0
- package/src/assets/image-placeholder-dark.svg +12 -0
- package/src/assets/image-placeholder-light.svg +12 -0
- package/src/assets/lodging-placeholder.jpg +0 -0
- package/src/assets/spinner-black.png +0 -0
- package/src/assets/spinner-white.png +0 -0
- package/src/styles/fonts/TheSeasons-Regular.ttf +0 -0
- package/src/styles/fonts/TheSeasons-Regular.woff +0 -0
- package/src/styles/fonts/TheSeasons-Regular.woff2 +0 -0
- package/src/styles/icons/Icomoon.json +4117 -0
- package/src/styles/icons/fonts/icomoon.eot +0 -0
- package/src/styles/icons/fonts/icomoon.svg +221 -0
- package/src/styles/icons/fonts/icomoon.ttf +0 -0
- package/src/styles/icons/fonts/icomoon.woff +0 -0
- package/src/styles/icons/style.css +677 -0
- package/src/styles/reset.css +35 -0
- package/src/styles/styles.sass +2719 -0
- package/src/utils/dial-codes.json +1454 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,919 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, ComponentType, Dispatch, HTMLAttributes, InputHTMLAttributes, MouseEvent, PointerEvent, ReactNode, RefObject, SelectHTMLAttributes, SetStateAction, TextareaHTMLAttributes } from "react";
|
|
2
|
+
import { Step } from "react-joyride";
|
|
3
|
+
interface OptionsProps$1 {
|
|
4
|
+
action: () => void;
|
|
5
|
+
destructive?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
hidden?: boolean;
|
|
8
|
+
icon?: string;
|
|
9
|
+
label: string;
|
|
10
|
+
}
|
|
11
|
+
interface ActionsProps {
|
|
12
|
+
options: OptionsProps$1[];
|
|
13
|
+
setVisible: (state: boolean) => void;
|
|
14
|
+
triggerRef: RefObject<HTMLElement | null>;
|
|
15
|
+
visible: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare function Actions({ options, visible, setVisible, triggerRef }: ActionsProps): import("react").ReactPortal | null;
|
|
18
|
+
export interface DropdownOption<T> {
|
|
19
|
+
/** A second, softer line under the label: what tells two alike apart. */
|
|
20
|
+
description?: string;
|
|
21
|
+
endDecorator?: React.ReactNode;
|
|
22
|
+
label: string;
|
|
23
|
+
/**
|
|
24
|
+
* The heading this option sits under. A heading prints wherever the
|
|
25
|
+
* section changes, so options arrive already grouped.
|
|
26
|
+
*/
|
|
27
|
+
section?: string;
|
|
28
|
+
startDecorator?: React.ReactNode;
|
|
29
|
+
value?: T;
|
|
30
|
+
}
|
|
31
|
+
export interface DropdownProps<T> {
|
|
32
|
+
anchorEl?: React.RefObject<HTMLElement | null>;
|
|
33
|
+
onSelect?: (value?: T) => void;
|
|
34
|
+
options: DropdownOption<T>[];
|
|
35
|
+
/**
|
|
36
|
+
* A field over the options, this its placeholder, that narrows them as
|
|
37
|
+
* you type, by the label or the line under it; the arrows move and Enter
|
|
38
|
+
* picks the first match. For a long list opened from a button.
|
|
39
|
+
*/
|
|
40
|
+
search?: string;
|
|
41
|
+
selectedOptions?: T[];
|
|
42
|
+
setVisible: (state: boolean) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Every option shows its box, empty until it is the chosen one, so the
|
|
45
|
+
* rows line up and the choice reads as one of them. For a list of
|
|
46
|
+
* choices opened from a button.
|
|
47
|
+
*/
|
|
48
|
+
showChecks?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The keyboard picks, as in a native select: typing jumps to the first
|
|
51
|
+
* option that starts with it, the arrows move, Enter picks and Escape
|
|
52
|
+
* closes. For a list opened from a button — under a text input the typing
|
|
53
|
+
* belongs to the input.
|
|
54
|
+
*/
|
|
55
|
+
typeAhead?: boolean;
|
|
56
|
+
visible: boolean;
|
|
57
|
+
}
|
|
58
|
+
declare function Dropdown<T>({ options, visible, setVisible, onSelect, search, selectedOptions, anchorEl, showChecks, typeAhead }: DropdownProps<T>): import("react").JSX.Element | null;
|
|
59
|
+
interface OptionsProps<T> {
|
|
60
|
+
/** The keyboard is on it (`typeAhead`). */
|
|
61
|
+
active?: boolean;
|
|
62
|
+
checked?: boolean;
|
|
63
|
+
/** Its place in the list, for the keyboard to scroll to. */
|
|
64
|
+
index?: number;
|
|
65
|
+
onClick?: () => void;
|
|
66
|
+
option: DropdownOption<T>;
|
|
67
|
+
/** Its box shows unchecked too (`showChecks`). */
|
|
68
|
+
showCheck?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export declare function Option<T>({ active, checked, index, option, onClick, showCheck }: OptionsProps<T>): import("react").JSX.Element;
|
|
71
|
+
interface AutocompleteProps<T> extends InputHTMLAttributes<HTMLInputElement> {
|
|
72
|
+
defaultOptions?: DropdownOption<T>[];
|
|
73
|
+
icon?: string;
|
|
74
|
+
inputValue?: string;
|
|
75
|
+
isLoading?: boolean;
|
|
76
|
+
label?: string;
|
|
77
|
+
onInputChange?: (value: string) => void;
|
|
78
|
+
onSelectOption?: (value?: T) => void;
|
|
79
|
+
options: DropdownOption<T>[];
|
|
80
|
+
required?: boolean;
|
|
81
|
+
selectedOptions?: T[];
|
|
82
|
+
}
|
|
83
|
+
declare function Autocomplete<T>({ label, options, onInputChange, onSelectOption, selectedOptions, inputValue, required, isLoading, onBlur, onFocus, defaultOptions, icon, ...rest }: AutocompleteProps<T>): import("react").JSX.Element;
|
|
84
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
85
|
+
buttonType: "primary" | "secondary" | "tertiary" | "destructive";
|
|
86
|
+
dropdown?: boolean;
|
|
87
|
+
iconLeft?: string;
|
|
88
|
+
/** Defaults to the kit's 10px, small for a plain glyph like `plus`. */
|
|
89
|
+
iconSize?: number;
|
|
90
|
+
label: string;
|
|
91
|
+
size: "l" | "m" | "s";
|
|
92
|
+
state?: "loading" | "success" | "error" | "disabled";
|
|
93
|
+
}
|
|
94
|
+
declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
95
|
+
interface CalendarProps {
|
|
96
|
+
defaultFrom?: string;
|
|
97
|
+
defaultTo?: string;
|
|
98
|
+
double?: boolean;
|
|
99
|
+
maxDate?: string;
|
|
100
|
+
minDate?: string;
|
|
101
|
+
onChange: (from: string | null, to: string | null) => void;
|
|
102
|
+
setVisible: (state: boolean) => void;
|
|
103
|
+
visible: boolean;
|
|
104
|
+
}
|
|
105
|
+
declare function Calendar({ defaultFrom, defaultTo, double, onChange, visible, setVisible, minDate, maxDate }: CalendarProps): false | import("react").JSX.Element;
|
|
106
|
+
export interface CalendarPropsV2 {
|
|
107
|
+
/**
|
|
108
|
+
* A click on the picked day unpicks it (one day only, not a range): Done
|
|
109
|
+
* then reads as no date.
|
|
110
|
+
*/
|
|
111
|
+
clearable?: boolean;
|
|
112
|
+
defaultFrom?: string;
|
|
113
|
+
defaultTo?: string;
|
|
114
|
+
double?: boolean;
|
|
115
|
+
initialViewDate?: string;
|
|
116
|
+
maxDate?: string;
|
|
117
|
+
minDate?: string;
|
|
118
|
+
onChange: (from: string | null, to: string | null) => void;
|
|
119
|
+
/**
|
|
120
|
+
* Done, and only Done: a click outside closes the calendar too, which a
|
|
121
|
+
* host that applies the picked range on Done reads as leaving it be.
|
|
122
|
+
*/
|
|
123
|
+
onDone?: () => void;
|
|
124
|
+
setVisible: (state: boolean) => void;
|
|
125
|
+
visible: boolean;
|
|
126
|
+
}
|
|
127
|
+
export declare const CalendarV2: ({ clearable, defaultFrom, defaultTo, double, initialViewDate, onChange, onDone, visible, setVisible, minDate, maxDate }: CalendarPropsV2) => import("react").JSX.Element | null;
|
|
128
|
+
type CardBrand = "amex" | "applePay" | "cartes_bancaires" | "diners" | "discover" | "eftpos_au" | "googlePay" | "hiper" | "hipercard" | "interac" | "jcb" | "maestro" | "mastercard" | "unionpay" | "unknown" | "visa";
|
|
129
|
+
declare const cards: Record<CardBrand, string>;
|
|
130
|
+
interface CardInputValues {
|
|
131
|
+
brand?: CardBrand;
|
|
132
|
+
cvv?: string | null;
|
|
133
|
+
date?: string | null;
|
|
134
|
+
number?: string | null;
|
|
135
|
+
}
|
|
136
|
+
export interface CardInputProps {
|
|
137
|
+
data?: CardInputValues;
|
|
138
|
+
disabled?: boolean;
|
|
139
|
+
includeCvv?: boolean;
|
|
140
|
+
setData?: (data: CardInputValues) => void;
|
|
141
|
+
}
|
|
142
|
+
declare const CardInput: ({ data, setData, disabled, includeCvv }: CardInputProps) => import("react").JSX.Element;
|
|
143
|
+
interface CheckProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
144
|
+
circle?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Some of what it stands for is chosen, not all: drawn checked with a
|
|
147
|
+
* dash instead of a tick (a group whose items are partly selected).
|
|
148
|
+
*/
|
|
149
|
+
partial?: boolean;
|
|
150
|
+
}
|
|
151
|
+
declare function Check({ circle, partial, ...rest }: CheckProps): import("react").JSX.Element;
|
|
152
|
+
interface DateInputProps {
|
|
153
|
+
defaultDate?: string;
|
|
154
|
+
disabled?: boolean;
|
|
155
|
+
id?: string;
|
|
156
|
+
key?: string;
|
|
157
|
+
label?: string;
|
|
158
|
+
maxDate?: string;
|
|
159
|
+
minDate?: string;
|
|
160
|
+
name?: string;
|
|
161
|
+
onChange?: (value: string) => void;
|
|
162
|
+
required?: boolean;
|
|
163
|
+
}
|
|
164
|
+
declare function DateInput({ id, defaultDate, disabled, label, name, onChange, required, key, minDate, maxDate }: DateInputProps): import("react").JSX.Element;
|
|
165
|
+
export interface DateInputV2Props extends InputHTMLAttributes<HTMLInputElement> {
|
|
166
|
+
label?: string;
|
|
167
|
+
setCalendarVisible: Dispatch<SetStateAction<boolean>>;
|
|
168
|
+
}
|
|
169
|
+
export declare const DateInputV2: ({ label, setCalendarVisible, ...rest }: DateInputV2Props) => import("react").JSX.Element;
|
|
170
|
+
interface DialogProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
171
|
+
actions: DialogAction[];
|
|
172
|
+
children?: React.ReactNode;
|
|
173
|
+
description?: string;
|
|
174
|
+
setVisible: (state: boolean) => void;
|
|
175
|
+
/**
|
|
176
|
+
* The heading, in the header beside the close button as the Modal sets
|
|
177
|
+
* it; the content scrolls under it. It used to fall through to the box as
|
|
178
|
+
* a tooltip, so every titled dialog opened without one.
|
|
179
|
+
*/
|
|
180
|
+
title?: string;
|
|
181
|
+
}
|
|
182
|
+
interface DialogAction {
|
|
183
|
+
disabled?: boolean;
|
|
184
|
+
hierarchy: ButtonProps["buttonType"];
|
|
185
|
+
label: string;
|
|
186
|
+
onClick: () => void;
|
|
187
|
+
}
|
|
188
|
+
declare const Dialog: ({ actions, description, setVisible, children, title, ...rest }: DialogProps) => import("react").JSX.Element;
|
|
189
|
+
export interface DetailDrawerProps {
|
|
190
|
+
buttons: ButtonProps[];
|
|
191
|
+
children: ReactNode;
|
|
192
|
+
/**
|
|
193
|
+
* Adds a share button beside the close X. The drawer only reports the tap —
|
|
194
|
+
* what gets shared (and how: native sheet vs clipboard) is the caller's.
|
|
195
|
+
*/
|
|
196
|
+
onShare?: () => void;
|
|
197
|
+
setVisible: Dispatch<SetStateAction<boolean>>;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* THE detail side panel — every search result, itinerary segment, order and
|
|
201
|
+
* form drawer in the apps opens in this: a 640px panel sliding in from the
|
|
202
|
+
* right over a dimmed page, scrolling content, and its actions pinned in the
|
|
203
|
+
* footer. On a phone it takes the whole screen and rises from below.
|
|
204
|
+
*/
|
|
205
|
+
declare function DetailDrawer({ buttons, children, onShare, setVisible }: DetailDrawerProps): import("react").JSX.Element;
|
|
206
|
+
export interface EmptyStateProps {
|
|
207
|
+
/** What to do about it, under the text. */
|
|
208
|
+
button?: ButtonProps;
|
|
209
|
+
description: string;
|
|
210
|
+
icon: string;
|
|
211
|
+
title?: string;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* "Nothing here yet": a muted round icon, an optional bold title and a short
|
|
215
|
+
* description, centred in whatever hosts it.
|
|
216
|
+
*/
|
|
217
|
+
declare function EmptyState({ button, description, icon, title }: EmptyStateProps): import("react").JSX.Element;
|
|
218
|
+
interface Props$2 {
|
|
219
|
+
children: ReactNode;
|
|
220
|
+
/** Headline shown in place of the app. */
|
|
221
|
+
message?: string;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Root boundary for the SPAs. Catches render errors, takes over the screen
|
|
225
|
+
* with the fallback and reports the error to CloudWatch RUM.
|
|
226
|
+
*
|
|
227
|
+
* Event-handler and async errors are not caught here — RUM's `errors`
|
|
228
|
+
* telemetry picks those up from `onerror` / `unhandledrejection`.
|
|
229
|
+
*/
|
|
230
|
+
declare function ErrorBoundary({ children, message }: Props$2): import("react").JSX.Element;
|
|
231
|
+
interface FileInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
232
|
+
/** The picker button's words. */
|
|
233
|
+
browseLabel?: string;
|
|
234
|
+
/**
|
|
235
|
+
* Something held over the host's module rather than the box: the host
|
|
236
|
+
* takes the drop, the box only answers. Leave it out and the box takes
|
|
237
|
+
* its own drops.
|
|
238
|
+
*/
|
|
239
|
+
dragging?: {
|
|
240
|
+
files: number;
|
|
241
|
+
} | null;
|
|
242
|
+
icon?: string;
|
|
243
|
+
inputValue?: File | File[];
|
|
244
|
+
/** What it takes and how big, under the prompt. */
|
|
245
|
+
label?: string;
|
|
246
|
+
linkLabel?: string;
|
|
247
|
+
/** Words for one and for several, as in "Drop to upload 2 files". */
|
|
248
|
+
noun?: readonly [string, string];
|
|
249
|
+
/** The files picked or dropped, besides `onChange`. */
|
|
250
|
+
onFiles?: (files: File[]) => void;
|
|
251
|
+
/** Offers Add a link, which turns the box into the field. */
|
|
252
|
+
onLink?: (url: string) => void;
|
|
253
|
+
/** The words over the hint; by default it asks for the file. */
|
|
254
|
+
prompt?: string;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* THE way to hand files over, in every app: one dashed box that takes a
|
|
258
|
+
* drop, the picker and, when the host offers it, a link. It keeps one height
|
|
259
|
+
* in every state, so nothing under it moves: dragging lifts the arrow, and
|
|
260
|
+
* Add a link turns the box itself into the field.
|
|
261
|
+
*/
|
|
262
|
+
declare function FileInput({ browseLabel, dragging, icon, inputValue, label, linkLabel, noun, onFiles, onLink, prompt, ...rest }: FileInputProps): import("react").JSX.Element;
|
|
263
|
+
interface IconProps extends HTMLAttributes<HTMLElement> {
|
|
264
|
+
misc?: boolean;
|
|
265
|
+
name: string;
|
|
266
|
+
size?: number;
|
|
267
|
+
}
|
|
268
|
+
declare function Icon({ misc, name, size, className, ...rest }: IconProps): import("react").JSX.Element;
|
|
269
|
+
export interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
270
|
+
buttonType: "primary" | "secondary" | "tertiary" | "destructive";
|
|
271
|
+
circle?: boolean;
|
|
272
|
+
icon: string;
|
|
273
|
+
size: "l" | "m" | "s";
|
|
274
|
+
}
|
|
275
|
+
declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
276
|
+
interface Props$1 {
|
|
277
|
+
/** The app's API origin (VITE_APP_API_URL). Empty disables the gate. */
|
|
278
|
+
apiUrl: string;
|
|
279
|
+
/** This deployment protects config reads with Cognito. Guests skip the gate. */
|
|
280
|
+
getToken?: () => Promise<string | null | void>;
|
|
281
|
+
children: ReactNode;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* The web twin of the native app's version gate: a kill switch for deploys.
|
|
285
|
+
*
|
|
286
|
+
* Reads authenticated `GET /config/AppVersion/web` — the same config resource
|
|
287
|
+
* the native app checks at cold start — and takes over the screen while its
|
|
288
|
+
* `isUnderMaintenance` flag is on. Ops flips the flag with the admin
|
|
289
|
+
* `POST /config/AppVersion` (versionCode "web"); no frontend deploy involved.
|
|
290
|
+
*
|
|
291
|
+
* Fails OPEN, like the native gate: a network error, a missing row or an
|
|
292
|
+
* unexpected payload renders the app normally. Being unable to read the flag
|
|
293
|
+
* must never take the product down. While mounted it keeps polling, so
|
|
294
|
+
* browsers left open drop into (and come back out of) maintenance on their
|
|
295
|
+
* own.
|
|
296
|
+
*/
|
|
297
|
+
declare function MaintenanceGate({ apiUrl, children, getToken }: Props$1): import("react").JSX.Element;
|
|
298
|
+
interface ModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
299
|
+
button?: ButtonProps;
|
|
300
|
+
children: ReactNode;
|
|
301
|
+
hideCloseButton?: boolean;
|
|
302
|
+
setVisible: (state: boolean) => void;
|
|
303
|
+
title?: string;
|
|
304
|
+
visible: boolean;
|
|
305
|
+
}
|
|
306
|
+
declare function Modal({ button, children, title, visible, hideCloseButton, setVisible, className, ...rest }: ModalProps): false | import("react").JSX.Element;
|
|
307
|
+
interface NavButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
308
|
+
buttonType: "back" | "forward" | "cancel" | "more" | "less";
|
|
309
|
+
size: "l" | "s";
|
|
310
|
+
}
|
|
311
|
+
declare function NavButton({ size, buttonType, ...rest }: NavButtonProps): import("react").JSX.Element;
|
|
312
|
+
interface NumberInputProps {
|
|
313
|
+
defaultValue?: number | string;
|
|
314
|
+
disabled?: boolean;
|
|
315
|
+
id?: string;
|
|
316
|
+
maxValue?: number;
|
|
317
|
+
minValue?: number;
|
|
318
|
+
name?: string;
|
|
319
|
+
onChange?: (value: number | string) => void;
|
|
320
|
+
required?: boolean;
|
|
321
|
+
unit?: {
|
|
322
|
+
singular: string;
|
|
323
|
+
plural: string;
|
|
324
|
+
};
|
|
325
|
+
/** Given, the host holds the number: a reset from outside shows. */
|
|
326
|
+
value?: number;
|
|
327
|
+
}
|
|
328
|
+
declare function NumberInput({ id, defaultValue, disabled, minValue, maxValue, name, onChange, required, unit, value: held }: NumberInputProps): import("react").JSX.Element;
|
|
329
|
+
interface OverlayProps extends HTMLAttributes<HTMLDivElement> {
|
|
330
|
+
children: ReactNode;
|
|
331
|
+
onClose?: (state: boolean) => void;
|
|
332
|
+
}
|
|
333
|
+
declare function Overlay({ children, onClose, ...rest }: OverlayProps): import("react").JSX.Element;
|
|
334
|
+
interface PaginatorProps extends HTMLAttributes<HTMLDivElement> {
|
|
335
|
+
currentPage: number;
|
|
336
|
+
onNextPage: () => void;
|
|
337
|
+
onPageChange: (page: number) => void;
|
|
338
|
+
onPrevPage: () => void;
|
|
339
|
+
resultsPerPage: number;
|
|
340
|
+
totalPages: number;
|
|
341
|
+
totalResults: number;
|
|
342
|
+
}
|
|
343
|
+
declare function Paginator({ totalPages, currentPage, onPageChange, totalResults, resultsPerPage, onPrevPage, onNextPage, ...rest }: PaginatorProps): import("react").JSX.Element;
|
|
344
|
+
export interface Phone {
|
|
345
|
+
completeNumber: string;
|
|
346
|
+
dialCode: string;
|
|
347
|
+
number: string;
|
|
348
|
+
}
|
|
349
|
+
interface PhoneInputProps {
|
|
350
|
+
/** The dial code a known number starts with, e.g. "+51"; else the visitor's. */
|
|
351
|
+
defaultDialCode?: string;
|
|
352
|
+
/** The national number, without its dial code. */
|
|
353
|
+
defaultValue?: string;
|
|
354
|
+
disabled?: boolean;
|
|
355
|
+
/** Under the field, as TextInput shows one. */
|
|
356
|
+
error?: string;
|
|
357
|
+
id?: string;
|
|
358
|
+
/**
|
|
359
|
+
* Names the field on its top border, from the start: the dial code holds
|
|
360
|
+
* the spot a TextInput's resting label would take. For two phone fields
|
|
361
|
+
* side by side (a phone and a WhatsApp).
|
|
362
|
+
*/
|
|
363
|
+
label?: string;
|
|
364
|
+
name?: string;
|
|
365
|
+
/** Focus left the field: the number and its dial code alike. */
|
|
366
|
+
onBlur?: () => void;
|
|
367
|
+
onChange?: (phone?: Phone) => void;
|
|
368
|
+
/** What the empty number field shows; "Phone" by default. */
|
|
369
|
+
placeholder?: string;
|
|
370
|
+
readOnly?: boolean;
|
|
371
|
+
required?: boolean;
|
|
372
|
+
}
|
|
373
|
+
declare function PhoneInput({ id, defaultDialCode, defaultValue, disabled, error, label, name, onBlur, onChange, placeholder, required, readOnly }: PhoneInputProps): import("react").JSX.Element;
|
|
374
|
+
export type SignInMethod = "email" | "phone";
|
|
375
|
+
export type SignInStep = "code" | "contact";
|
|
376
|
+
export interface SignInCardProps {
|
|
377
|
+
/**
|
|
378
|
+
* The agency whose own host this is (`portal.agency.com`): the screen
|
|
379
|
+
* welcomes to it and wears its mark and sign-in photo in place of Nicer's.
|
|
380
|
+
* Nicer's terms still govern, so the terms line names Nicer.
|
|
381
|
+
*/
|
|
382
|
+
agency?: {
|
|
383
|
+
logoUrl?: string;
|
|
384
|
+
name: string;
|
|
385
|
+
photoUrl?: string;
|
|
386
|
+
};
|
|
387
|
+
/** A code is being asked for or checked: the button waits. */
|
|
388
|
+
busy?: boolean;
|
|
389
|
+
/** The CAPTCHA widget the host's sign-in renders under the fields. */
|
|
390
|
+
captcha?: ReactNode;
|
|
391
|
+
/** More links of the code step, after Resend code: another channel. */
|
|
392
|
+
codeLinks?: ReactNode;
|
|
393
|
+
/** The card's top right corner: the portal's Register link. */
|
|
394
|
+
corner?: ReactNode;
|
|
395
|
+
email: string;
|
|
396
|
+
/** The square Nicer mark for the app's theme. */
|
|
397
|
+
logoSrc: string;
|
|
398
|
+
method: SignInMethod;
|
|
399
|
+
/** Back to the contact step, to type another phone or email. */
|
|
400
|
+
onChangeContact: () => void;
|
|
401
|
+
/** The digits typed so far; anything else is dropped as it is typed. */
|
|
402
|
+
onCode: (code: string) => void;
|
|
403
|
+
onEmail: (email: string) => void;
|
|
404
|
+
onMethod: (method: SignInMethod) => void;
|
|
405
|
+
onPhone: (phone?: Phone) => void;
|
|
406
|
+
onResend: () => void;
|
|
407
|
+
/** Continue on the contact step, Sign in on the code step. */
|
|
408
|
+
onSubmit: () => void;
|
|
409
|
+
step: SignInStep;
|
|
410
|
+
/** The drawn wordmark a phone shows in the upper half of the screen. */
|
|
411
|
+
wordmarkSrc: string;
|
|
412
|
+
}
|
|
413
|
+
/** The length of the code the sign-in sends. */
|
|
414
|
+
export declare const SIGN_IN_CODE_LENGTH = 6;
|
|
415
|
+
/**
|
|
416
|
+
* Sign-in for the apps Nicer's own people use (portal and Octopus): the card
|
|
417
|
+
* inside the brand photo on a desktop, the native app's plain screen on a
|
|
418
|
+
* phone. The host owns the challenge and what follows it; this owns the
|
|
419
|
+
* screen, so every app signs in on the same one.
|
|
420
|
+
*/
|
|
421
|
+
declare function SignInCard({ agency, busy, captcha, codeLinks, corner, email, logoSrc, method, onChangeContact, onCode, onEmail, onMethod, onPhone, onResend, onSubmit, step, wordmarkSrc }: SignInCardProps): import("react").JSX.Element;
|
|
422
|
+
export interface AgencyMarkProps {
|
|
423
|
+
/** The agency's logo; without one, or when it fails to load, its initial. */
|
|
424
|
+
logoUrl?: string;
|
|
425
|
+
/** The agency's name, whose first letter stands in for the logo. */
|
|
426
|
+
name: string;
|
|
427
|
+
/**
|
|
428
|
+
* 24px (`s`), 32px (`m`, the default), or the whole of a tile the host
|
|
429
|
+
* frames (`fill`), as a detail page's 64px one.
|
|
430
|
+
*/
|
|
431
|
+
size?: "fill" | "m" | "s";
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* An agency's mark: its logo over a neutral tile holding its initial. The
|
|
435
|
+
* logo shows once it has loaded, so a broken or missing one leaves the
|
|
436
|
+
* initial instead of the browser's broken image; never Nicer's own mark.
|
|
437
|
+
*/
|
|
438
|
+
declare function AgencyMark({ logoUrl, name, size }: AgencyMarkProps): import("react").JSX.Element;
|
|
439
|
+
export interface SideNavItem {
|
|
440
|
+
/** A count on the page's mark, as Community's unread messages. */
|
|
441
|
+
badge?: number;
|
|
442
|
+
icon: string;
|
|
443
|
+
/**
|
|
444
|
+
* Names the page from one render to the next: its place in what the
|
|
445
|
+
* person arranged, its slide, and its tour step (`nav-<key>`).
|
|
446
|
+
*/
|
|
447
|
+
key: string;
|
|
448
|
+
label: string;
|
|
449
|
+
route: string;
|
|
450
|
+
}
|
|
451
|
+
/** What the rail asks of the host's router link. */
|
|
452
|
+
export interface SideNavLinkProps {
|
|
453
|
+
children: ReactNode;
|
|
454
|
+
className?: string;
|
|
455
|
+
"data-flip"?: string;
|
|
456
|
+
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
457
|
+
to: string;
|
|
458
|
+
}
|
|
459
|
+
export interface SideNavProps {
|
|
460
|
+
/**
|
|
461
|
+
* Every page the rail can hold, in their default order, so a page this
|
|
462
|
+
* person can't see now (another role's, a feature off) keeps its place in
|
|
463
|
+
* what they arranged. The pages' own keys by default.
|
|
464
|
+
*/
|
|
465
|
+
allKeys?: readonly string[];
|
|
466
|
+
/**
|
|
467
|
+
* Where this person's arrangement is kept on this device, one per person.
|
|
468
|
+
* Without it there is no Edit menu.
|
|
469
|
+
*/
|
|
470
|
+
arrangementKey?: string;
|
|
471
|
+
/** Keeps the rail open, as while a menu in its header is. */
|
|
472
|
+
expanded?: boolean;
|
|
473
|
+
/** After the pages, sliding with them: a divider, links out. */
|
|
474
|
+
footer?: ReactNode;
|
|
475
|
+
/** The pages this person may see, in their default order; none until known. */
|
|
476
|
+
items: SideNavItem[];
|
|
477
|
+
/** The host router's link. */
|
|
478
|
+
Link: ComponentType<SideNavLinkProps>;
|
|
479
|
+
/**
|
|
480
|
+
* The rail's top: the agency switcher, or a link holding the mark and,
|
|
481
|
+
* shown as the rail opens, a `.label`.
|
|
482
|
+
*/
|
|
483
|
+
logo: ReactNode;
|
|
484
|
+
/** A page's link clicked: the host may keep it from navigating. */
|
|
485
|
+
onNavigate?: (item: SideNavItem, event: MouseEvent<HTMLAnchorElement>) => void;
|
|
486
|
+
pathname: string;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* The apps' left rail: the pages, open over the page on hover, and Edit menu,
|
|
490
|
+
* where a person hides pages and drags the rest into their order, kept per
|
|
491
|
+
* person on this device.
|
|
492
|
+
*/
|
|
493
|
+
declare function SideNav({ allKeys, arrangementKey, expanded, footer, items, Link, logo, onNavigate, pathname }: SideNavProps): import("react").JSX.Element;
|
|
494
|
+
/** Six dots, the grip a row or a card is dragged by: the kit has no such icon. */
|
|
495
|
+
declare function Grip(): import("react").JSX.Element;
|
|
496
|
+
/**
|
|
497
|
+
* How a person arranged a board's columns (their order, and which are off
|
|
498
|
+
* it), kept per person on this device. The pipeline's stages, My tasks' due
|
|
499
|
+
* dates and the sidebar's pages keep theirs this way, each under its own key.
|
|
500
|
+
*/
|
|
501
|
+
export interface Arrangement<Id extends string> {
|
|
502
|
+
/** Every column, in the board's order. */
|
|
503
|
+
columns: Id[];
|
|
504
|
+
/** The columns off the board. */
|
|
505
|
+
hidden: Id[];
|
|
506
|
+
}
|
|
507
|
+
/** The board as it comes: every column, in its own order. */
|
|
508
|
+
export declare const defaultArrangement: <Id extends string>(all: readonly Id[]) => Arrangement<Id>;
|
|
509
|
+
export declare const isDefaultArrangement: <Id extends string>(arrangement: Arrangement<Id>, all: readonly Id[]) => boolean;
|
|
510
|
+
/**
|
|
511
|
+
* A saved arrangement as the board reads it now: columns it no longer has
|
|
512
|
+
* are dropped, and one it has that the saved order lacks goes after the
|
|
513
|
+
* one it follows in the board's own order. Anything else reads as nothing
|
|
514
|
+
* arranged.
|
|
515
|
+
*/
|
|
516
|
+
export declare const arrangementFrom: <Id extends string>(saved: unknown, all: readonly Id[]) => Arrangement<Id>;
|
|
517
|
+
/** No storage at all (a private window) reads as nothing arranged. */
|
|
518
|
+
export declare const loadArrangement: <Id extends string>(key: string, all: readonly Id[]) => Arrangement<Id>;
|
|
519
|
+
export declare const saveArrangement: <Id extends string>(key: string, arrangement: Arrangement<Id>) => void;
|
|
520
|
+
/**
|
|
521
|
+
* The whole order with the ones this person sees put in their new order,
|
|
522
|
+
* the ones they can't see (another role's, a feature off) where they were.
|
|
523
|
+
*/
|
|
524
|
+
export declare const withShownOrder: <Id extends string>(order: readonly Id[], shown: readonly Id[], next: readonly Id[]) => Id[];
|
|
525
|
+
/**
|
|
526
|
+
* When the container's items change (`keys`: one taken out, put in, or
|
|
527
|
+
* reordered), slides each that stayed from where it showed to where it
|
|
528
|
+
* is: down a column (`y`) or across a board (`x`). Where they showed is
|
|
529
|
+
* read as the render starts, while the page still shows them: an item
|
|
530
|
+
* that left by its own motion, or a scroll the browser kept in place,
|
|
531
|
+
* moves nothing. The items are the container's children with `data-flip`,
|
|
532
|
+
* the key that names the same item from one render to the next. With
|
|
533
|
+
* `enter`, an item put in fades in where it lands (not the first ones the
|
|
534
|
+
* container shows).
|
|
535
|
+
*/
|
|
536
|
+
export declare function useFlip(ref: RefObject<HTMLElement | null>, keys: string[], axis?: "x" | "y", { enter }?: {
|
|
537
|
+
enter?: boolean;
|
|
538
|
+
}): void;
|
|
539
|
+
/**
|
|
540
|
+
* A list's rows dragged into a new order where they stand, as the Columns
|
|
541
|
+
* menu's: the row in hand follows the pointer, the others make room (the
|
|
542
|
+
* list slides them with `useFlip`), and dropped, it settles into its slot
|
|
543
|
+
* and `onMove` takes the new order once. Each row carries `data-row`; the
|
|
544
|
+
* one in hand drops its `data-flip`, so the slides leave it alone. The
|
|
545
|
+
* list's first row starts at the list's top.
|
|
546
|
+
*/
|
|
547
|
+
export declare function useDragOrder<Id extends string>(listRef: RefObject<HTMLElement | null>, settled: readonly Id[], onMove: (order: Id[]) => void): {
|
|
548
|
+
heldId: Id | undefined;
|
|
549
|
+
moveBy: (id: Id, step: -1 | 1) => void;
|
|
550
|
+
order: readonly Id[];
|
|
551
|
+
take: (id: Id, event: PointerEvent<HTMLElement>) => void;
|
|
552
|
+
};
|
|
553
|
+
interface PriceProps {
|
|
554
|
+
/** Names the field when no visible label is tied to it. */
|
|
555
|
+
"aria-label"?: string;
|
|
556
|
+
currencySelector?: boolean;
|
|
557
|
+
defaultCurrency?: string;
|
|
558
|
+
defaultValue?: string;
|
|
559
|
+
disabled?: boolean;
|
|
560
|
+
id?: string;
|
|
561
|
+
max?: number;
|
|
562
|
+
min?: number;
|
|
563
|
+
name?: string;
|
|
564
|
+
onChange?: (value: string) => void;
|
|
565
|
+
onCurrencyChange?: (curency: string) => void;
|
|
566
|
+
options?: {
|
|
567
|
+
label: string;
|
|
568
|
+
value: string;
|
|
569
|
+
}[];
|
|
570
|
+
required?: boolean;
|
|
571
|
+
}
|
|
572
|
+
declare function PriceInput({ "aria-label": ariaLabel, id, options, currencySelector, defaultCurrency, defaultValue, disabled, name, onChange, onCurrencyChange, required, min, max }: PriceProps): import("react").JSX.Element;
|
|
573
|
+
interface RadioButtonProps extends InputHTMLAttributes<HTMLInputElement> {}
|
|
574
|
+
declare function RadioButton({ ...rest }: RadioButtonProps): import("react").JSX.Element;
|
|
575
|
+
export interface SelectOption {
|
|
576
|
+
defaultValue?: string;
|
|
577
|
+
label: string;
|
|
578
|
+
selected?: boolean;
|
|
579
|
+
value: string;
|
|
580
|
+
}
|
|
581
|
+
export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
|
582
|
+
defaultValue?: string;
|
|
583
|
+
options?: SelectOption[];
|
|
584
|
+
placeholder?: string;
|
|
585
|
+
readOnly?: boolean;
|
|
586
|
+
variant?: "outlined" | "standard";
|
|
587
|
+
}
|
|
588
|
+
declare function Select({ className, options, placeholder, variant, defaultValue, readOnly, style, ...rest }: SelectProps): import("react").JSX.Element;
|
|
589
|
+
interface RangeSliderProps {
|
|
590
|
+
/** Names each thumb for screen readers: "Minimum price", "Maximum price". */
|
|
591
|
+
labels?: [string, string];
|
|
592
|
+
max: number;
|
|
593
|
+
min: number;
|
|
594
|
+
onChange: (value: [number, number]) => void;
|
|
595
|
+
step?: number;
|
|
596
|
+
value: [number, number];
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Two thumbs on one track, for picking a range (a price band). Two native
|
|
600
|
+
* range inputs stacked on the `.ui-slider` track: keyboard and touch come
|
|
601
|
+
* for free, and the thumbs can't cross — each one stops at the other.
|
|
602
|
+
*/
|
|
603
|
+
declare function RangeSlider({ labels, max, min, onChange, step, value }: RangeSliderProps): import("react").JSX.Element;
|
|
604
|
+
export interface SeparatorProps {
|
|
605
|
+
orientation: "vertical" | "horizontal";
|
|
606
|
+
}
|
|
607
|
+
declare function Separator({ orientation }: SeparatorProps): import("react").JSX.Element;
|
|
608
|
+
interface SpinnerProps {
|
|
609
|
+
color?: "dark" | "light";
|
|
610
|
+
size?: number;
|
|
611
|
+
}
|
|
612
|
+
declare function Spinner({ size }: SpinnerProps): import("react").JSX.Element;
|
|
613
|
+
interface Props {
|
|
614
|
+
children: ReactNode;
|
|
615
|
+
}
|
|
616
|
+
/** Provides `StatusContext` and renders the toast its `setStatus` raises. */
|
|
617
|
+
declare function StatusManager({ children }: Props): import("react").JSX.Element;
|
|
618
|
+
interface SwitchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onChange"> {
|
|
619
|
+
defaultChecked?: boolean;
|
|
620
|
+
onChange?: (checked: boolean) => void;
|
|
621
|
+
size: "l" | "s";
|
|
622
|
+
}
|
|
623
|
+
declare function Switch({ defaultChecked, onChange, size, ...rest }: SwitchProps): import("react").JSX.Element;
|
|
624
|
+
interface Tab {
|
|
625
|
+
/** Shown as a small badge after the label (e.g. a queue size, or "10,000+"). */
|
|
626
|
+
count?: number | string;
|
|
627
|
+
label: string;
|
|
628
|
+
/** A small dot after the label: something in the tab waits, unsaved. */
|
|
629
|
+
mark?: boolean;
|
|
630
|
+
onClick: () => void;
|
|
631
|
+
}
|
|
632
|
+
interface TabsProps extends HTMLAttributes<HTMLDivElement> {
|
|
633
|
+
/** Selected tab when the parent owns the selection (e.g. it lives in the URL). */
|
|
634
|
+
activeIndex?: number;
|
|
635
|
+
tabs: Tab[];
|
|
636
|
+
}
|
|
637
|
+
declare function Tabs({ activeIndex, tabs, ...rest }: TabsProps): import("react").JSX.Element;
|
|
638
|
+
interface TagProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
639
|
+
disabled?: boolean;
|
|
640
|
+
label: string;
|
|
641
|
+
onRemove?: () => void;
|
|
642
|
+
type: "default" | "positive" | "warning" | "negative" | "disabled";
|
|
643
|
+
}
|
|
644
|
+
declare function Tag({ disabled: _disabled, label, type, onRemove, ...rest }: TagProps): import("react").JSX.Element;
|
|
645
|
+
interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
646
|
+
label?: string;
|
|
647
|
+
}
|
|
648
|
+
declare function TextArea({ label, defaultValue, ...rest }: TextAreaProps): import("react").JSX.Element;
|
|
649
|
+
interface TextInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
650
|
+
error?: string;
|
|
651
|
+
icon?: string;
|
|
652
|
+
isLoading?: boolean;
|
|
653
|
+
label?: string;
|
|
654
|
+
}
|
|
655
|
+
declare function TextInput({ icon, id, isLoading, label, error, ...rest }: TextInputProps): import("react").JSX.Element;
|
|
656
|
+
export type ThemeName = "dark" | "light";
|
|
657
|
+
/**
|
|
658
|
+
* Shows `theme` and saves it as the visitor's choice. With `persist: false`
|
|
659
|
+
* it is shown and not saved: a look one page asks for (an agency's own mode)
|
|
660
|
+
* must not become the choice the next page starts from.
|
|
661
|
+
*/
|
|
662
|
+
export type SetTheme = (theme: ThemeName, options?: {
|
|
663
|
+
persist?: boolean;
|
|
664
|
+
}) => void;
|
|
665
|
+
export type ThemeContextValue = [ThemeName, SetTheme];
|
|
666
|
+
/** `[theme, setTheme]`, provided by `ThemeProvider`. */
|
|
667
|
+
export declare const ThemeContext: import("react").Context<ThemeContextValue>;
|
|
668
|
+
export interface ThemeProviderProps {
|
|
669
|
+
/**
|
|
670
|
+
* Apply the class and save the choice inside `setTheme`, before React
|
|
671
|
+
* re-renders: consumers that read the computed tokens while rendering
|
|
672
|
+
* (charts) must already get the new theme's values.
|
|
673
|
+
*/
|
|
674
|
+
applyBeforeRender?: boolean;
|
|
675
|
+
children: ReactNode;
|
|
676
|
+
/** With no saved choice, follow the device (`prefers-color-scheme`). */
|
|
677
|
+
followSystem?: boolean;
|
|
678
|
+
/**
|
|
679
|
+
* Repaint `<meta name="theme-color">` with the theme's `--bgPrimary`: the
|
|
680
|
+
* browser paints the installed app's status-bar strip from it.
|
|
681
|
+
*/
|
|
682
|
+
syncThemeColor?: boolean;
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* The visitor's own theme: the one they chose, else the device's when the
|
|
686
|
+
* app follows it, else light. What a page that showed another look goes back to.
|
|
687
|
+
*/
|
|
688
|
+
export declare const savedTheme: (followSystem?: boolean) => ThemeName;
|
|
689
|
+
/**
|
|
690
|
+
* Owns the light/dark theme: the `light`/`dark` class on <body>, the choice
|
|
691
|
+
* saved under `localStorage.theme`, and `ThemeContext`.
|
|
692
|
+
*/
|
|
693
|
+
declare function ThemeProvider({ applyBeforeRender, children, followSystem, syncThemeColor }: ThemeProviderProps): import("react").JSX.Element;
|
|
694
|
+
/**
|
|
695
|
+
* The light/dark toggle: a 56×32 pill whose knob slides between the moon and
|
|
696
|
+
* the sun (300ms easeOutExpo) and shrinks on hover.
|
|
697
|
+
*/
|
|
698
|
+
declare function ThemeSwitch(): import("react").JSX.Element;
|
|
699
|
+
interface TimeInputProps {
|
|
700
|
+
defaultTime?: string;
|
|
701
|
+
disabled?: boolean;
|
|
702
|
+
id?: string;
|
|
703
|
+
maxTime?: string;
|
|
704
|
+
minTime?: string;
|
|
705
|
+
name?: string;
|
|
706
|
+
onChange?: (time: string) => void;
|
|
707
|
+
required?: boolean;
|
|
708
|
+
}
|
|
709
|
+
declare function TimeInput({ id, defaultTime, disabled, name, onChange, required, minTime, maxTime }: TimeInputProps): import("react").JSX.Element;
|
|
710
|
+
export interface ToastAction {
|
|
711
|
+
/** Its mark before the label, as Undo's rotate-left. */
|
|
712
|
+
icon?: string;
|
|
713
|
+
label: string;
|
|
714
|
+
onClick: () => void;
|
|
715
|
+
}
|
|
716
|
+
export interface ToastProps {
|
|
717
|
+
/** One thing to do about it, before the ring or the close: Undo. */
|
|
718
|
+
action?: ToastAction;
|
|
719
|
+
autoClose?: boolean;
|
|
720
|
+
description: string;
|
|
721
|
+
setVisible: (state: boolean) => void;
|
|
722
|
+
type: "info" | "success" | "warning" | "error";
|
|
723
|
+
visible: boolean;
|
|
724
|
+
}
|
|
725
|
+
declare function Toast({ action, autoClose, description, type, visible, setVisible }: ToastProps): false | import("react").JSX.Element;
|
|
726
|
+
export type TourStep = Omit<Step, "skipBeacon"> & {
|
|
727
|
+
/**
|
|
728
|
+
* When set, the Tour adds the `tour-highlighted` class to the step's target
|
|
729
|
+
* while the step is active (and removes it when the step changes or the tour
|
|
730
|
+
* closes). Useful for elements that need extra visual emphasis beyond the
|
|
731
|
+
* spotlight hole — e.g. revealing hidden actions on hover-only menus.
|
|
732
|
+
*/
|
|
733
|
+
highlight?: boolean;
|
|
734
|
+
/**
|
|
735
|
+
* "compact" sizes the hole to the target's CONTENT (measured with a
|
|
736
|
+
* Range) instead of its padded box — for anchors like the bottom tabs,
|
|
737
|
+
* which stretch a third of the screen while their icon + label sit in a
|
|
738
|
+
* small centred cluster.
|
|
739
|
+
*/
|
|
740
|
+
spotlight?: "compact";
|
|
741
|
+
/**
|
|
742
|
+
* Alternative takes on the same step, in order of preference: of the steps
|
|
743
|
+
* sharing a `oneOf` key, only the first whose target is visible survives.
|
|
744
|
+
* For a target that may or may not be there (a photo grid that only exists
|
|
745
|
+
* once there are photos) with a fallback anchor that always is.
|
|
746
|
+
*/
|
|
747
|
+
oneOf?: string;
|
|
748
|
+
/**
|
|
749
|
+
* Set when `onBeforeStep` is what PUTS the target on screen (switching a
|
|
750
|
+
* tab, opening a panel). Such a step survives the "is the target visible"
|
|
751
|
+
* filter below, since the check runs before the callback — only set it
|
|
752
|
+
* when the callback guarantees the target.
|
|
753
|
+
*/
|
|
754
|
+
bringsOwnTarget?: boolean;
|
|
755
|
+
/** How long a `bringsOwnTarget` step waits for its target, then is passed over. */
|
|
756
|
+
targetWaitMs?: number;
|
|
757
|
+
/**
|
|
758
|
+
* Clicking the target moves the tour on, as Next does: for a step that asks
|
|
759
|
+
* the person to click it (a menu, then the option it opens).
|
|
760
|
+
*/
|
|
761
|
+
advanceOnTargetClick?: boolean;
|
|
762
|
+
/** Glides the target into view, if it isn't, before the step shows. */
|
|
763
|
+
scrollToTarget?: boolean;
|
|
764
|
+
/**
|
|
765
|
+
* Runs just before the step is shown: switching to the tab the target
|
|
766
|
+
* lives on, scrolling it into view — whatever the step needs the screen to
|
|
767
|
+
* be doing.
|
|
768
|
+
*/
|
|
769
|
+
onBeforeStep?: () => void;
|
|
770
|
+
};
|
|
771
|
+
interface TourProps {
|
|
772
|
+
onClose?: () => void;
|
|
773
|
+
run: boolean;
|
|
774
|
+
setRun: (run: boolean) => void;
|
|
775
|
+
steps: TourStep[];
|
|
776
|
+
}
|
|
777
|
+
declare function Tour({ steps, run, setRun, onClose }: TourProps): import("react").JSX.Element | null;
|
|
778
|
+
interface ToggleOption {
|
|
779
|
+
/** Something after the label, such as an unread mark. */
|
|
780
|
+
icon?: React.ReactNode;
|
|
781
|
+
/** A kit icon before the label, as a view switch shows each view. */
|
|
782
|
+
iconLeft?: string;
|
|
783
|
+
label: string;
|
|
784
|
+
onClick: () => void;
|
|
785
|
+
}
|
|
786
|
+
interface ToggleProps extends HTMLAttributes<HTMLDivElement> {
|
|
787
|
+
/** A negative index selects nothing — no option is highlighted. */
|
|
788
|
+
defaultSelected?: number;
|
|
789
|
+
disabled?: boolean;
|
|
790
|
+
options: ToggleOption[];
|
|
791
|
+
size?: "l" | "s" | "xl";
|
|
792
|
+
}
|
|
793
|
+
declare function Toggle({ options, defaultSelected, disabled, size, ...rest }: ToggleProps): import("react").JSX.Element;
|
|
794
|
+
interface TooltipProps {
|
|
795
|
+
children: React.ReactNode;
|
|
796
|
+
className?: string;
|
|
797
|
+
/** Off: no bubble and no help cursor — a label only worth showing sometimes. */
|
|
798
|
+
disabled?: boolean;
|
|
799
|
+
/** Usually a line of text; a list when there is more than one thing to say. */
|
|
800
|
+
label: React.ReactNode;
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* A hover label. The bubble renders on `document.body` at fixed viewport
|
|
804
|
+
* coordinates, so a scrolling rail or a card with `overflow: hidden` can't
|
|
805
|
+
* clip it. It opens below the anchor, left edges aligned; it moves above
|
|
806
|
+
* when there is no room below and slides left to stay on screen. Content
|
|
807
|
+
* that needs its own styles must carry them (a styled element as `label`),
|
|
808
|
+
* since the bubble no longer sits inside the host's markup.
|
|
809
|
+
*/
|
|
810
|
+
declare function Tag$1({ label, children, className, disabled, ...rest }: TooltipProps): import("react").JSX.Element;
|
|
811
|
+
export interface StatusProps {
|
|
812
|
+
/**
|
|
813
|
+
* One thing to do about what the toast says, as Undo: a click does it
|
|
814
|
+
* and closes the toast.
|
|
815
|
+
*/
|
|
816
|
+
action?: ToastProps["action"];
|
|
817
|
+
autoClose?: boolean;
|
|
818
|
+
description: string;
|
|
819
|
+
type: ToastProps["type"];
|
|
820
|
+
}
|
|
821
|
+
export type SetStatus = (status: StatusProps) => void;
|
|
822
|
+
/** `setStatus` — raises a toast from anywhere under `StatusManager`. */
|
|
823
|
+
export declare const StatusContext: import("react").Context<SetStatus>;
|
|
824
|
+
export type HapticKind = "error" | "success" | "tap";
|
|
825
|
+
/**
|
|
826
|
+
* A short haptic for the few moments that deserve one: approving, saving,
|
|
827
|
+
* committing to a booking ("tap"), a payment that went through ("success"),
|
|
828
|
+
* a booking that could not be confirmed ("error").
|
|
829
|
+
*
|
|
830
|
+
* The web has no haptics API that reaches both phones, so there are two
|
|
831
|
+
* paths. Where the Vibration API exists (Android), `navigator.vibrate`. iOS
|
|
832
|
+
* has none, but since iOS 18 toggling a switch (`<input type="checkbox"
|
|
833
|
+
* switch>`) plays the system haptic, also through a click on its label — so a
|
|
834
|
+
* hidden one is toggled and dropped. That path is a WebKit quirk, not an API:
|
|
835
|
+
* it only plays inside the user's tap (one tick, whatever the kind), Apple
|
|
836
|
+
* reportedly closed it in iOS 26.5, and where it plays nothing it changes
|
|
837
|
+
* nothing.
|
|
838
|
+
*
|
|
839
|
+
* Call it synchronously from the tap's handler, before any `await`. A caller
|
|
840
|
+
* outside a tap (an effect, a timer) passes `{ inGesture: false }` and gets
|
|
841
|
+
* the vibration only. It never throws: a haptic must not break the action.
|
|
842
|
+
*/
|
|
843
|
+
export declare const haptic: (kind?: HapticKind, { inGesture }?: {
|
|
844
|
+
inGesture?: boolean;
|
|
845
|
+
}) => void;
|
|
846
|
+
/**
|
|
847
|
+
* Which placeholder a failed photo shows: a hotel's blurred room, a person's
|
|
848
|
+
* silhouette, or a picture glyph for everything else (trip covers, places).
|
|
849
|
+
*/
|
|
850
|
+
export type ImageKind = "avatar" | "lodging" | "photo";
|
|
851
|
+
/**
|
|
852
|
+
* The media proxy answers a photo it can't serve (expired, deleted, from
|
|
853
|
+
* another environment) with 200 and a 1×1 pixel, so `error` never fires: the
|
|
854
|
+
* size is what gives it away. Exactly 1×1 — an SVG without a size of its own
|
|
855
|
+
* loads as 0×0 and is a real image.
|
|
856
|
+
*/
|
|
857
|
+
export declare const isPlaceholderPixel: (image: HTMLImageElement) => boolean;
|
|
858
|
+
/**
|
|
859
|
+
* Whether an <img> gave up on its photo and shows a placeholder — true from
|
|
860
|
+
* inside its own `onError`/`onLoad`, since the document listener runs first.
|
|
861
|
+
*/
|
|
862
|
+
export declare const showsImageFallback: (image: HTMLImageElement) => boolean;
|
|
863
|
+
/**
|
|
864
|
+
* Every <img> that fails to load, or loads the media proxy's 1×1 pixel, shows
|
|
865
|
+
* the placeholder instead of a broken icon, its alt text or a solid block.
|
|
866
|
+
* `load` and `error` don't bubble, so one capture listener on the document
|
|
867
|
+
* sees every image; a component's own `onError` still runs after it and wins.
|
|
868
|
+
* Returns the uninstall.
|
|
869
|
+
*/
|
|
870
|
+
export declare const installImageFallbacks: () => (() => void);
|
|
871
|
+
/** Reload once when a tab from a previous release requests a removed lazy chunk. */
|
|
872
|
+
export declare const recoverStaleAssets: () => void;
|
|
873
|
+
/**
|
|
874
|
+
* The photo once it loaded as a real image, for a CSS background — which has
|
|
875
|
+
* no `error` to fall back on and paints the proxy's pixel as a solid block.
|
|
876
|
+
* Nothing while it loads or when it failed, so the element keeps its own
|
|
877
|
+
* background; `onBroken` hears of a photo that failed or came back as the
|
|
878
|
+
* proxy's pixel.
|
|
879
|
+
*/
|
|
880
|
+
export declare const useLoadedImage: (src?: string, onBroken?: () => void) => string | undefined;
|
|
881
|
+
type SessionAttributes = Record<string, string | number | boolean | undefined>;
|
|
882
|
+
/**
|
|
883
|
+
* Starts CloudWatch RUM for one app. No-op locally and whenever the app
|
|
884
|
+
* monitor id is missing, which is also the kill switch: the id stays unset in
|
|
885
|
+
* Amplify until the API is deployed with `X-Amzn-Trace-Id` allowed by CORS.
|
|
886
|
+
*/
|
|
887
|
+
export declare const initRum: (app: string, appMonitorId: string | undefined, releaseId: string) => void;
|
|
888
|
+
export declare const recordError: (error: unknown) => void;
|
|
889
|
+
/** Attributes are searchable in Transaction Search. Never email or name. */
|
|
890
|
+
export declare const tagSession: (attributes: SessionAttributes) => void;
|
|
891
|
+
/**
|
|
892
|
+
* Browser glue for a booking-site theme. The theme itself (which variables,
|
|
893
|
+
* which values) is computed by `siteThemeVars` in `@nicer/catalog`; this module
|
|
894
|
+
* only writes it into the document, so `@nicer/ui` stays free of contracts.
|
|
895
|
+
*/
|
|
896
|
+
type StyleTarget = {
|
|
897
|
+
style: {
|
|
898
|
+
setProperty: (name: string, value: string) => void;
|
|
899
|
+
removeProperty: (name: string) => string;
|
|
900
|
+
};
|
|
901
|
+
};
|
|
902
|
+
/**
|
|
903
|
+
* Sets `vars` on `target` (the body by default) and clears every name in
|
|
904
|
+
* `managed` that this theme no longer sets, so switching themes never leaves
|
|
905
|
+
* a stale color behind. The body, not the root: dark mode redefines the same
|
|
906
|
+
* tokens on `body.dark`, which hid every color set on <html> but the brand's.
|
|
907
|
+
*/
|
|
908
|
+
export declare const applyCssVars: (vars: Record<string, string>, managed?: readonly string[], target?: StyleTarget) => void;
|
|
909
|
+
/** One `<link id="site-font">`; `null` removes it. */
|
|
910
|
+
export declare const setFontStylesheet: (href: string | null) => void;
|
|
911
|
+
export declare const setFavicon: (href: string) => void;
|
|
912
|
+
/** `<meta name=…>`; created when missing. */
|
|
913
|
+
export declare const setMetaContent: (name: string, content: string) => void;
|
|
914
|
+
/**
|
|
915
|
+
* The JSON the page renderer inlines as `<script type="application/json"
|
|
916
|
+
* id="nicer-site">`. `undefined` when the page was not served by the renderer.
|
|
917
|
+
*/
|
|
918
|
+
export declare const readInlineJson: <T>(id: string) => T | undefined;
|
|
919
|
+
export { Actions, AgencyMark, Autocomplete, Button, Calendar, type CardBrand, CardInput, Check, DateInput, DetailDrawer, Dialog, Dropdown, EmptyState, ErrorBoundary, FileInput, Grip, Icon, IconButton, MaintenanceGate, Modal, NavButton, NumberInput, Overlay, Paginator, PhoneInput, PriceInput, RadioButton, RangeSlider, Select, Separator, SideNav, SignInCard, Spinner, StatusManager, Switch, Tabs, Tag, TextArea, TextInput, ThemeProvider, ThemeSwitch, TimeInput, Toast, Toggle, Tag$1 as Tooltip, Tour, cards };
|