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