@gecko-ui-kit/react 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +1823 -2
- package/index.d.ts +12 -0
- package/index.js +15 -0
- package/package.json +49 -4
- package/src/actions.d.ts +192 -0
- package/src/actions.js +238 -0
- package/src/basics.d.ts +268 -0
- package/src/basics.js +308 -0
- package/src/charts.d.ts +207 -0
- package/src/charts.js +79 -0
- package/src/controls.d.ts +159 -0
- package/src/controls.js +261 -0
- package/src/core.d.ts +78 -0
- package/src/core.js +284 -0
- package/src/data.d.ts +762 -0
- package/src/data.js +608 -0
- package/src/effects.d.ts +410 -0
- package/src/effects.js +580 -0
- package/src/forms.d.ts +724 -0
- package/src/forms.js +403 -0
- package/src/motion.d.ts +130 -0
- package/src/motion.js +176 -0
- package/src/overlays.d.ts +450 -0
- package/src/overlays.js +580 -0
- package/src/shell.d.ts +206 -0
- package/src/shell.js +602 -0
- package/src/text.d.ts +316 -0
- package/src/text.js +354 -0
package/src/effects.d.ts
ADDED
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { IconLike } from './core.js';
|
|
3
|
+
import type { ButtonProps } from './basics.js';
|
|
4
|
+
|
|
5
|
+
type ButtonAttrs = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>;
|
|
6
|
+
/** The look of a .btn (same as <Button>): variant, size, icon, block. */
|
|
7
|
+
interface BtnLook {
|
|
8
|
+
/** primary · dark · danger · ghost … (btn--variant). */
|
|
9
|
+
variant?: string;
|
|
10
|
+
/** sm · lg (btn--size). */
|
|
11
|
+
size?: string;
|
|
12
|
+
/** Full width. */
|
|
13
|
+
block?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* ------------------------------------------------------------------ indicator */
|
|
17
|
+
|
|
18
|
+
export interface IndicatorOptions {
|
|
19
|
+
/** Which element in the pill's parent is the active one. Default: [aria-current], [aria-selected="true"], [aria-pressed="true"], .is-active. */
|
|
20
|
+
selector?: string;
|
|
21
|
+
/** Corner radius of the pill in px (13; 99 = round ends). */
|
|
22
|
+
radius?: number;
|
|
23
|
+
/** An underline instead of a pill (full height cut off; style its height with CSS). */
|
|
24
|
+
line?: boolean;
|
|
25
|
+
/** Seconds for the leading edge (0.36). */
|
|
26
|
+
lead?: number;
|
|
27
|
+
/** Seconds for the trailing edge (0.55). */
|
|
28
|
+
trail?: number;
|
|
29
|
+
/** Seconds for the other two edges (0.45). */
|
|
30
|
+
cross?: number;
|
|
31
|
+
}
|
|
32
|
+
/** const pill = useIndicator(current, { radius: 99 }) — put ref={pill} on a <span> inside the menu; it stretches to the active item when `current` changes. */
|
|
33
|
+
export function useIndicator<E extends HTMLElement = HTMLSpanElement>(active: unknown, options?: IndicatorOptions): React.MutableRefObject<E | null>;
|
|
34
|
+
|
|
35
|
+
export interface IndicatorProps extends IndicatorOptions, React.HTMLAttributes<HTMLElement> {
|
|
36
|
+
/** The element to render (div). */
|
|
37
|
+
as?: React.ElementType;
|
|
38
|
+
/** Anything that changes when the active item changes (the current page, tab id…). */
|
|
39
|
+
active?: unknown;
|
|
40
|
+
/** Class of the pill (then the default accent background is left off). */
|
|
41
|
+
pillClassName?: string;
|
|
42
|
+
/** Inline style of the pill. */
|
|
43
|
+
pillStyle?: React.CSSProperties;
|
|
44
|
+
}
|
|
45
|
+
/** <Indicator as="nav" active={page} radius={99}>…items with aria-current…</Indicator> — a stretchy pill that follows the active child. */
|
|
46
|
+
export const Indicator: React.ForwardRefExoticComponent<IndicatorProps & React.RefAttributes<HTMLElement>>;
|
|
47
|
+
|
|
48
|
+
/* ------------------------------------------------------------------ page swap */
|
|
49
|
+
|
|
50
|
+
export interface SwapTiming {
|
|
51
|
+
/** Seconds the old page takes to leave (0.18). */
|
|
52
|
+
out?: number;
|
|
53
|
+
/** Seconds the new page takes to slide in (0.7). */
|
|
54
|
+
in?: number;
|
|
55
|
+
/** Pixels the old page steps back (16). */
|
|
56
|
+
shift?: number;
|
|
57
|
+
/** Pixels the new page slides in from (26). */
|
|
58
|
+
enter?: number;
|
|
59
|
+
}
|
|
60
|
+
export interface PageSwapProps extends Omit<React.HTMLAttributes<HTMLElement>, 'dir'> {
|
|
61
|
+
as?: React.ElementType;
|
|
62
|
+
/** The page's identity (route, tab id). When it changes, the old page leaves and the new children slide in. */
|
|
63
|
+
swapKey: React.Key;
|
|
64
|
+
/** 1 = forward (new page from the right), -1 = back (from the left). */
|
|
65
|
+
dir?: 1 | -1 | number;
|
|
66
|
+
/** Blocks that fade and drop on the way out (.card, .kpi, .lane, [data-swap]). */
|
|
67
|
+
leave?: string;
|
|
68
|
+
/** Header parts that lift away (.phead, .tabs, .toolbar, .chips). */
|
|
69
|
+
head?: string;
|
|
70
|
+
/** Timing for this swap only (default: the shared swapTiming). */
|
|
71
|
+
timing?: SwapTiming;
|
|
72
|
+
/** Called right after the new page is in (e.g. to rise its cards). */
|
|
73
|
+
onSwap?: (view: HTMLElement) => void;
|
|
74
|
+
}
|
|
75
|
+
/** <PageSwap swapKey={pathname} dir={1}>{page}</PageSwap> — page transition between children keyed by a route or value. */
|
|
76
|
+
export const PageSwap: React.ForwardRefExoticComponent<PageSwapProps & React.RefAttributes<HTMLElement>>;
|
|
77
|
+
|
|
78
|
+
/* ------------------------------------------------------------------ feedback */
|
|
79
|
+
|
|
80
|
+
/** An element, a ref to one, or an event (its currentTarget). Left out: the hook's own ref. */
|
|
81
|
+
export type FeedbackTarget = Element | React.RefObject<Element | null> | { currentTarget: EventTarget | null } | null | undefined;
|
|
82
|
+
export interface Feedback<E extends HTMLElement = HTMLElement> {
|
|
83
|
+
/** Put it on the element the feedback plays on. */
|
|
84
|
+
ref: React.MutableRefObject<E | null>;
|
|
85
|
+
/** Spring the icon inside (or the element) back from 70%: every press. */
|
|
86
|
+
pop: (target?: FeedbackTarget) => unknown;
|
|
87
|
+
/** A quick side-to-side “no”: wrong input, limit reached. */
|
|
88
|
+
shake: (target?: FeedbackTarget) => unknown;
|
|
89
|
+
/** A bell-style swing from the top: new notification. */
|
|
90
|
+
wiggle: (target?: FeedbackTarget) => unknown;
|
|
91
|
+
/** A value just changed: a small bounce and the accent colour. */
|
|
92
|
+
flash: (target?: FeedbackTarget) => void;
|
|
93
|
+
/** Tint green (up = true) or red (false) for a moment; CSS only, so it also runs with reduced motion. */
|
|
94
|
+
tick: (up: boolean, target?: FeedbackTarget) => void;
|
|
95
|
+
}
|
|
96
|
+
/** const fb = useFeedback(); <form ref={fb.ref}> … fb.shake() — pop / shake / wiggle / flash / tick, cleaned up on unmount. */
|
|
97
|
+
export function useFeedback<E extends HTMLElement = HTMLElement>(): Feedback<E>;
|
|
98
|
+
/** const ref = useFlash(total) — the element bounces and lights up each time the value changes. */
|
|
99
|
+
export function useFlash<E extends HTMLElement = HTMLElement>(value: unknown): React.MutableRefObject<E | null>;
|
|
100
|
+
/** const ref = useTick(qty) — tints green when the number goes up, red when it goes down. */
|
|
101
|
+
export function useTick<E extends HTMLElement = HTMLElement>(value: number): React.MutableRefObject<E | null>;
|
|
102
|
+
|
|
103
|
+
/* ------------------------------------------------------------------ confetti */
|
|
104
|
+
|
|
105
|
+
export interface ConfettiOptions {
|
|
106
|
+
/** Pieces of paper (120, at most 600). */
|
|
107
|
+
count?: number;
|
|
108
|
+
/** Width of the burst in degrees (100). */
|
|
109
|
+
spread?: number;
|
|
110
|
+
/** Which way it shoots: 90 = up, 45 = up and right, 135 = up and left. */
|
|
111
|
+
angle?: number;
|
|
112
|
+
/** How hard it shoots (1). */
|
|
113
|
+
velocity?: number;
|
|
114
|
+
/** Colours ('#…' or 'var(--token)'); default: the accent and theme hues. */
|
|
115
|
+
colors?: string[];
|
|
116
|
+
/** Shapes picked at random for each piece. */
|
|
117
|
+
shapes?: Array<'rect' | 'circle' | 'strip' | 'star'>;
|
|
118
|
+
/** How fast it falls (1; 0.5 floats, 2 drops). */
|
|
119
|
+
gravity?: number;
|
|
120
|
+
/** Seconds a piece lives at most (3). */
|
|
121
|
+
duration?: number;
|
|
122
|
+
zIndex?: number;
|
|
123
|
+
/** With reduced motion: a few sparkles at the origin, or nothing. */
|
|
124
|
+
reduced?: 'sparkle' | 'none';
|
|
125
|
+
}
|
|
126
|
+
/** Where a burst starts: an element, a selector, or a point in viewport pixels. */
|
|
127
|
+
export type ConfettiOrigin = Element | string | { x: number; y: number } | null | undefined;
|
|
128
|
+
/** A burst: resolves when the last piece is gone; stop() clears it now. */
|
|
129
|
+
export type ConfettiBurst = Promise<void> & { stop(): void };
|
|
130
|
+
/** confetti(origin, options) from @gecko-ui-kit/motion; confetti.clear() stops every burst. */
|
|
131
|
+
export const confetti: ((origin?: ConfettiOrigin, options?: ConfettiOptions) => ConfettiBurst) & { clear(): void };
|
|
132
|
+
/** const fire = useConfetti({ count: 150 }); fire(event) — bursts from an element, ref, event or point; stopped on unmount. */
|
|
133
|
+
export function useConfetti(options?: ConfettiOptions): (origin?: ConfettiOrigin | FeedbackTarget, options?: ConfettiOptions) => ConfettiBurst;
|
|
134
|
+
|
|
135
|
+
export interface ConfettiButtonProps extends ButtonProps, ConfettiOptions {
|
|
136
|
+
/** Called when the last piece has landed. */
|
|
137
|
+
onDone?: () => void;
|
|
138
|
+
}
|
|
139
|
+
/** <ConfettiButton variant="primary" icon="sparkle">Celebrate</ConfettiButton> — a Button that bursts confetti from itself on click. */
|
|
140
|
+
export const ConfettiButton: React.ForwardRefExoticComponent<ConfettiButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
141
|
+
|
|
142
|
+
/* ------------------------------------------------------------------ sortable */
|
|
143
|
+
|
|
144
|
+
export interface ReorderInfo<T> {
|
|
145
|
+
/** The item that moved. */
|
|
146
|
+
item: T;
|
|
147
|
+
/** Its index in its old list (-1 when this list received it from another). */
|
|
148
|
+
from: number;
|
|
149
|
+
/** Its index in its new list (-1 when this list gave it away). */
|
|
150
|
+
to: number;
|
|
151
|
+
/** The list it came from (before the move). */
|
|
152
|
+
fromList: T[];
|
|
153
|
+
/** The list it went to (after the move). */
|
|
154
|
+
toList: T[];
|
|
155
|
+
}
|
|
156
|
+
export interface SortableProps<T> extends Omit<React.HTMLAttributes<HTMLElement>, 'children' | 'defaultValue'> {
|
|
157
|
+
/** The items in order (controlled: update them in onReorder). */
|
|
158
|
+
items?: T[];
|
|
159
|
+
/** Starting items (uncontrolled: the list keeps its own order). */
|
|
160
|
+
defaultItems?: T[];
|
|
161
|
+
/** A stable key for each item (item.id, or the item itself). */
|
|
162
|
+
getKey?: (item: T) => React.Key;
|
|
163
|
+
/** Draws one item (it is wrapped in an element that can be dragged). */
|
|
164
|
+
renderItem?: (item: T, index: number) => React.ReactNode;
|
|
165
|
+
/** The new order of THIS list after a drop. */
|
|
166
|
+
onReorder?: (next: T[], info: ReorderInfo<T>) => void;
|
|
167
|
+
/** A press on an item without moving it. */
|
|
168
|
+
onItemClick?: (item: T) => void;
|
|
169
|
+
/** Lists with the same group can pass items to each other (a kanban board's lanes). */
|
|
170
|
+
group?: string;
|
|
171
|
+
/** The list element (div; ul gives li items). */
|
|
172
|
+
as?: React.ElementType;
|
|
173
|
+
/** The element around each item (div, or li inside ul/ol). */
|
|
174
|
+
itemAs?: React.ElementType;
|
|
175
|
+
/** Class of the element around each item. */
|
|
176
|
+
itemClassName?: string;
|
|
177
|
+
/** How an item looks in your hand: { scale: 1.04, rotation: 1.5 }. */
|
|
178
|
+
lift?: { scale?: number; rotation?: number; [prop: string]: unknown };
|
|
179
|
+
/** Squash like it landed (true) or a soft settle (false). */
|
|
180
|
+
squash?: boolean;
|
|
181
|
+
/** Degrees it tilts as it lands (3). */
|
|
182
|
+
rotate?: number;
|
|
183
|
+
/** Only start a drag from inside this selector (a grip icon). */
|
|
184
|
+
handle?: string;
|
|
185
|
+
/** Drawn before the items, inside the drop zone (a lane title). */
|
|
186
|
+
children?: React.ReactNode;
|
|
187
|
+
}
|
|
188
|
+
/** <Sortable items={tasks} getKey={(t) => t.id} onReorder={setTasks} renderItem={(t) => <Card task={t} />} /> — drag to reorder; React keeps the order. */
|
|
189
|
+
export function Sortable<T>(props: SortableProps<T> & React.RefAttributes<HTMLElement>): React.ReactElement;
|
|
190
|
+
|
|
191
|
+
/* ------------------------------------------------------------------ theme */
|
|
192
|
+
|
|
193
|
+
export type Theme = 'light' | 'dark';
|
|
194
|
+
export interface ThemeOptions {
|
|
195
|
+
/** localStorage key the choice is saved under ('gecko:theme'; '' = don't save). */
|
|
196
|
+
storageKey?: string;
|
|
197
|
+
/** Reveal length in ms (450). */
|
|
198
|
+
duration?: number;
|
|
199
|
+
/** Reveal easing (CSS). */
|
|
200
|
+
easing?: string;
|
|
201
|
+
}
|
|
202
|
+
/** const [theme, setTheme] = useTheme() — 'light' on the server, the real theme in the browser; setTheme('dark', event) reveals it from that element. */
|
|
203
|
+
export function useTheme(options?: ThemeOptions): [Theme, (next: Theme | ((current: Theme) => Theme), from?: FeedbackTarget) => Promise<void>];
|
|
204
|
+
|
|
205
|
+
export interface ThemeToggleProps extends ThemeOptions, Omit<ButtonAttrs, 'onChange'> {
|
|
206
|
+
/** Accessible name ('Switch theme'). */
|
|
207
|
+
label?: string;
|
|
208
|
+
/** sm (iconbtn--sm). */
|
|
209
|
+
size?: string;
|
|
210
|
+
/** The theme it switched to. */
|
|
211
|
+
onChange?: (theme: Theme) => void;
|
|
212
|
+
}
|
|
213
|
+
/** <ThemeToggle /> — a round moon / sun button that switches light ↔ dark with a circular reveal. */
|
|
214
|
+
export const ThemeToggle: React.ForwardRefExoticComponent<ThemeToggleProps & React.RefAttributes<HTMLButtonElement>>;
|
|
215
|
+
|
|
216
|
+
/* ------------------------------------------------------------------ send / delete / download / hold */
|
|
217
|
+
|
|
218
|
+
export interface SendButtonProps extends ButtonAttrs, BtnLook {
|
|
219
|
+
/** The label (Send). */
|
|
220
|
+
children?: React.ReactNode;
|
|
221
|
+
/** The plane icon ('send'). */
|
|
222
|
+
icon?: IconLike;
|
|
223
|
+
/** Controlled: true flies it off, false brings it back. Left out, a click plays it. */
|
|
224
|
+
sent?: boolean;
|
|
225
|
+
/** Text after sending (Sent). */
|
|
226
|
+
done?: string;
|
|
227
|
+
/** Flight path. */
|
|
228
|
+
path?: 'up' | 'straight' | 'loop';
|
|
229
|
+
/** Dotted trail behind the plane. */
|
|
230
|
+
trail?: boolean;
|
|
231
|
+
/** Seconds before it comes back by itself (2.4; 0 = stays). Not used with `sent`. */
|
|
232
|
+
back?: number;
|
|
233
|
+
/** Seconds of the flight. */
|
|
234
|
+
duration?: number;
|
|
235
|
+
/** Called when "Sent" has rolled in. */
|
|
236
|
+
onDone?: (button: HTMLButtonElement) => void;
|
|
237
|
+
}
|
|
238
|
+
/** <SendButton variant="primary" onClick={send}>Send</SendButton> — the plane flies off and "Sent" rolls in. */
|
|
239
|
+
export const SendButton: React.ForwardRefExoticComponent<SendButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
240
|
+
|
|
241
|
+
export interface DeleteButtonProps extends ButtonAttrs, BtnLook {
|
|
242
|
+
/** The label the bin eats (Delete). Text only. */
|
|
243
|
+
children?: string;
|
|
244
|
+
/** Controlled: true eats the label, false brings it back. Left out, a click plays it. */
|
|
245
|
+
deleted?: boolean;
|
|
246
|
+
/** Text afterwards (Deleted). */
|
|
247
|
+
done?: string;
|
|
248
|
+
/** Which letter jumps first: the one next to the bin, or the last. */
|
|
249
|
+
order?: 'first' | 'last';
|
|
250
|
+
/** The bin chews after the lid shuts. */
|
|
251
|
+
chew?: boolean;
|
|
252
|
+
/** Seconds before the word comes back (2.4; 0 = stays). Not used with `deleted`. */
|
|
253
|
+
back?: number;
|
|
254
|
+
/** Called when "Deleted" is in (remove the row here). */
|
|
255
|
+
onDone?: (button: HTMLButtonElement) => void;
|
|
256
|
+
}
|
|
257
|
+
/** <DeleteButton variant="danger" onDone={remove}>Delete</DeleteButton> — the bin eats its own label. */
|
|
258
|
+
export const DeleteButton: React.ForwardRefExoticComponent<DeleteButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
259
|
+
|
|
260
|
+
export interface DownloadButtonProps extends ButtonAttrs, BtnLook {
|
|
261
|
+
/** The label (Download). Text only. */
|
|
262
|
+
children?: string;
|
|
263
|
+
/** 0–1 fills the outline; null = size unknown (a segment chases round); undefined = not started. */
|
|
264
|
+
progress?: number | null;
|
|
265
|
+
/** 'idle' | 'loading' | 'done' | 'failed'. Default: 'loading' once progress is given, else 'idle'. */
|
|
266
|
+
state?: 'idle' | 'loading' | 'done' | 'failed';
|
|
267
|
+
/** The label while loading, from the progress (default: '40%'). */
|
|
268
|
+
label?: (progress: number) => string;
|
|
269
|
+
/** The label while the size is unknown (Preparing…). */
|
|
270
|
+
wait?: string;
|
|
271
|
+
/** The label when done (Done). */
|
|
272
|
+
done?: string;
|
|
273
|
+
/** The label when failed (Try again). */
|
|
274
|
+
fail?: string;
|
|
275
|
+
/** Seconds after done before it resets by itself (0 = stays). */
|
|
276
|
+
back?: number;
|
|
277
|
+
/** Outline thickness in px (2.5). */
|
|
278
|
+
width?: number;
|
|
279
|
+
}
|
|
280
|
+
/** <DownloadButton progress={0.4}>Download</DownloadButton> — the button's own outline is the progress bar. */
|
|
281
|
+
export const DownloadButton: React.ForwardRefExoticComponent<DownloadButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
282
|
+
|
|
283
|
+
export interface HoldButtonProps extends ButtonAttrs, BtnLook {
|
|
284
|
+
/** The label (with look="ring": the accessible name). Text only. */
|
|
285
|
+
children?: string;
|
|
286
|
+
/** The icon ('trash'); it turns into a tick when confirmed. */
|
|
287
|
+
icon?: IconLike;
|
|
288
|
+
/** Seconds to hold (1.2). */
|
|
289
|
+
duration?: number;
|
|
290
|
+
/** Colour floods the button, or a circle fills round a round icon button. */
|
|
291
|
+
look?: 'fill' | 'ring';
|
|
292
|
+
/** Colour of the fill. */
|
|
293
|
+
tone?: 'bad' | 'accent' | 'good' | 'warn';
|
|
294
|
+
/** Shown for a moment after letting go too early (Hold to confirm; '' = none). */
|
|
295
|
+
hint?: string;
|
|
296
|
+
/** The label afterwards (Done). */
|
|
297
|
+
done?: string;
|
|
298
|
+
/** Seconds until it resets by itself (0 = stays done). */
|
|
299
|
+
back?: number;
|
|
300
|
+
/** Small buzzes on phones. */
|
|
301
|
+
haptic?: boolean;
|
|
302
|
+
/** Controlled: true confirms it now, false (after true) resets it. */
|
|
303
|
+
confirmed?: boolean;
|
|
304
|
+
/** Held to the end: do the action here. */
|
|
305
|
+
onConfirm?: (button: HTMLButtonElement, handle: unknown) => void;
|
|
306
|
+
/** Let go too early (progress 0–1). */
|
|
307
|
+
onCancel?: (button: HTMLButtonElement, handle: unknown, progress: number) => void;
|
|
308
|
+
}
|
|
309
|
+
/** <HoldButton tone="bad" onConfirm={remove}>Delete bike</HoldButton> — press and hold to confirm. */
|
|
310
|
+
export const HoldButton: React.ForwardRefExoticComponent<HoldButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
311
|
+
|
|
312
|
+
/* ------------------------------------------------------------------ search */
|
|
313
|
+
|
|
314
|
+
export interface ExpandSearchProps extends Omit<React.FormHTMLAttributes<HTMLFormElement>, 'onChange' | 'defaultValue' | 'onSubmit'> {
|
|
315
|
+
/** The hint that types itself in (Search…). */
|
|
316
|
+
placeholder?: string;
|
|
317
|
+
/** Accessible name of the button and field (Search). */
|
|
318
|
+
label?: string;
|
|
319
|
+
/** Accessible name of the × (Close search). */
|
|
320
|
+
closeLabel?: string;
|
|
321
|
+
/** The field's name (q). */
|
|
322
|
+
name?: string;
|
|
323
|
+
/** Look when closed. */
|
|
324
|
+
look?: 'outline' | 'quiet';
|
|
325
|
+
size?: 'md' | 'sm';
|
|
326
|
+
/** Open width: px, or any CSS width such as '100%' (260). */
|
|
327
|
+
width?: number | string;
|
|
328
|
+
/** The hint types itself in (true). */
|
|
329
|
+
typing?: boolean;
|
|
330
|
+
/** Close when focus leaves an empty field (true). */
|
|
331
|
+
autoClose?: boolean;
|
|
332
|
+
/** A key that opens it from anywhere on the page, e.g. '/' (the vanilla `key` option). */
|
|
333
|
+
shortcut?: string;
|
|
334
|
+
/** The text (controlled). */
|
|
335
|
+
value?: string;
|
|
336
|
+
/** The starting text (uncontrolled). */
|
|
337
|
+
defaultValue?: string;
|
|
338
|
+
/** Every change of the text (typing, clearing). */
|
|
339
|
+
onChange?: (value: string) => void;
|
|
340
|
+
/** Enter, or a click on the magnifier with text in it. */
|
|
341
|
+
onSearch?: (value: string) => void;
|
|
342
|
+
/** Open (controlled). */
|
|
343
|
+
open?: boolean;
|
|
344
|
+
/** Start open. */
|
|
345
|
+
defaultOpen?: boolean;
|
|
346
|
+
onOpen?: () => void;
|
|
347
|
+
onClose?: () => void;
|
|
348
|
+
}
|
|
349
|
+
/** <ExpandSearch placeholder="Search bikes…" onChange={setQ} /> — a magnifier that stretches into a search field. */
|
|
350
|
+
export const ExpandSearch: React.ForwardRefExoticComponent<ExpandSearchProps & React.RefAttributes<HTMLFormElement>>;
|
|
351
|
+
|
|
352
|
+
/* ------------------------------------------------------------------ liquid tabs */
|
|
353
|
+
|
|
354
|
+
export interface LiquidItem {
|
|
355
|
+
label: React.ReactNode;
|
|
356
|
+
/** An icon name or any React node. */
|
|
357
|
+
icon?: IconLike;
|
|
358
|
+
/** Makes the tab a link. */
|
|
359
|
+
href?: string;
|
|
360
|
+
}
|
|
361
|
+
export interface LiquidTabsProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange' | 'defaultValue'> {
|
|
362
|
+
items: LiquidItem[];
|
|
363
|
+
/** The active index (controlled). */
|
|
364
|
+
value?: number;
|
|
365
|
+
/** The starting index (0). */
|
|
366
|
+
defaultValue?: number;
|
|
367
|
+
/** A tab was picked (click or arrow keys). */
|
|
368
|
+
onChange?: (index: number, tab: HTMLElement) => void;
|
|
369
|
+
/** 'dip': the bubble sinks, runs along the bar and swells up; 'glide': it slides across. */
|
|
370
|
+
mode?: 'dip' | 'glide';
|
|
371
|
+
/** Droplets splash (true). */
|
|
372
|
+
splash?: boolean;
|
|
373
|
+
/** Accessible name of the nav (Main). */
|
|
374
|
+
label?: string;
|
|
375
|
+
/** Show labels (false: icons only, labels stay for screen readers). */
|
|
376
|
+
labels?: boolean;
|
|
377
|
+
/** Melt the shapes together (false: plain shapes). */
|
|
378
|
+
goo?: boolean;
|
|
379
|
+
/** Component for items with href (Next.js Link). */
|
|
380
|
+
linkAs?: React.ElementType;
|
|
381
|
+
}
|
|
382
|
+
/** <LiquidTabs items={[…]} value={tab} onChange={setTab} /> — a tab bar where a liquid bubble moves to the active tab. */
|
|
383
|
+
export const LiquidTabs: React.ForwardRefExoticComponent<LiquidTabsProps & React.RefAttributes<HTMLElement>>;
|
|
384
|
+
|
|
385
|
+
/* ------------------------------------------------------------------ burger */
|
|
386
|
+
|
|
387
|
+
export interface BurgerProps extends Omit<ButtonAttrs, 'onToggle'> {
|
|
388
|
+
/** Open (controlled). */
|
|
389
|
+
open?: boolean;
|
|
390
|
+
/** Start open (uncontrolled). */
|
|
391
|
+
defaultOpen?: boolean;
|
|
392
|
+
/** A click or Escape asks for this state. */
|
|
393
|
+
onToggle?: (open: boolean, button: HTMLButtonElement | null) => void;
|
|
394
|
+
/** The button's label: { open: 'Open menu', close: 'Close menu' }. */
|
|
395
|
+
words?: { open?: string; close?: string };
|
|
396
|
+
/** Seconds of the morph (0.45). */
|
|
397
|
+
duration?: number;
|
|
398
|
+
/** id of the menu it opens (aria-controls). */
|
|
399
|
+
controls?: string;
|
|
400
|
+
/** Escape closes it and puts focus back on the button (true). */
|
|
401
|
+
escape?: boolean;
|
|
402
|
+
/** sm (iconbtn--sm). */
|
|
403
|
+
size?: string;
|
|
404
|
+
/** Class of the three lines (size them with --burger-w, --burger-h, --burger-t). */
|
|
405
|
+
iconClassName?: string;
|
|
406
|
+
}
|
|
407
|
+
/** <Burger open={open} onToggle={setOpen} controls="menu" /> — three lines that turn into an ✕. */
|
|
408
|
+
export const Burger: React.ForwardRefExoticComponent<BurgerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
409
|
+
|
|
410
|
+
export {};
|