panelui-native 0.32.0 → 0.35.2
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 +2 -1
- package/lib/module/components/button/index.js +106 -11
- package/lib/module/components/button/index.js.map +1 -1
- package/lib/module/components/drawer/index.js +477 -0
- package/lib/module/components/drawer/index.js.map +1 -0
- package/lib/module/components/panelside/index.js +1024 -0
- package/lib/module/components/panelside/index.js.map +1 -0
- package/lib/module/components/progress/index.js +64 -24
- package/lib/module/components/progress/index.js.map +1 -1
- package/lib/module/components/select/index.js +14 -3
- package/lib/module/components/select/index.js.map +1 -1
- package/lib/module/components/swipe/index.js +537 -0
- package/lib/module/components/swipe/index.js.map +1 -0
- package/lib/module/icons/index.js +20 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/index.js +30 -0
- package/lib/module/native/index.js.map +1 -1
- package/lib/typescript/src/components/button/index.d.ts +22 -1
- package/lib/typescript/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/drawer/index.d.ts +146 -0
- package/lib/typescript/src/components/drawer/index.d.ts.map +1 -0
- package/lib/typescript/src/components/panelside/index.d.ts +354 -0
- package/lib/typescript/src/components/panelside/index.d.ts.map +1 -0
- package/lib/typescript/src/components/progress/index.d.ts +25 -4
- package/lib/typescript/src/components/progress/index.d.ts.map +1 -1
- package/lib/typescript/src/components/select/index.d.ts.map +1 -1
- package/lib/typescript/src/components/swipe/index.d.ts +206 -0
- package/lib/typescript/src/components/swipe/index.d.ts.map +1 -0
- package/lib/typescript/src/icons/index.d.ts +1 -0
- package/lib/typescript/src/icons/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/native/index.d.ts +20 -0
- package/lib/typescript/src/native/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/button/index.tsx +140 -8
- package/src/components/drawer/index.tsx +662 -0
- package/src/components/panelside/index.tsx +1358 -0
- package/src/components/progress/index.tsx +93 -25
- package/src/components/select/index.tsx +23 -3
- package/src/components/swipe/index.tsx +687 -0
- package/src/icons/index.tsx +14 -0
- package/src/index.ts +42 -0
- package/src/native/index.ts +51 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Panelside — a navigation panel that moves the app aside instead of covering
|
|
3
|
+
* it.
|
|
4
|
+
*
|
|
5
|
+
* ```tsx
|
|
6
|
+
* <Panelside>
|
|
7
|
+
* <Panelside.Panel>
|
|
8
|
+
* <Panelside.Header title="Assistant">
|
|
9
|
+
* <Panelside.Search value={query} onChangeText={setQuery} />
|
|
10
|
+
* </Panelside.Header>
|
|
11
|
+
* <Panelside.Content>
|
|
12
|
+
* <Panelside.Group>
|
|
13
|
+
* <Panelside.GroupLabel>Recents</Panelside.GroupLabel>
|
|
14
|
+
* <Panelside.Item label="Launch thread" />
|
|
15
|
+
* </Panelside.Group>
|
|
16
|
+
* </Panelside.Content>
|
|
17
|
+
* <Panelside.Footer>
|
|
18
|
+
* <Panelside.Cta label="New chat" onPress={compose} />
|
|
19
|
+
* </Panelside.Footer>
|
|
20
|
+
* </Panelside.Panel>
|
|
21
|
+
*
|
|
22
|
+
* <Panelside.Scene>
|
|
23
|
+
* <Panelside.Trigger />
|
|
24
|
+
* <Conversation />
|
|
25
|
+
* </Panelside.Scene>
|
|
26
|
+
* </Panelside>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* ## Why it is not a Drawer
|
|
30
|
+
*
|
|
31
|
+
* A drawer is an overlay: it mounts through a portal, lands above everything
|
|
32
|
+
* and dims what it hid. That is the wrong shape here, because the whole point
|
|
33
|
+
* of this pattern is that the app *stays legible* — it slides across, shrinks,
|
|
34
|
+
* rounds its corners and waits, so the panel reads as a layer behind the app
|
|
35
|
+
* rather than a sheet on top of it. A portal cannot do that: its content is
|
|
36
|
+
* above the app content by construction, and the app content is somewhere else
|
|
37
|
+
* in the tree entirely, unreachable.
|
|
38
|
+
*
|
|
39
|
+
* So Panelside owns both halves. It renders inline, keeps the panel and the
|
|
40
|
+
* app screen as siblings under one clipping container, and gives them a single
|
|
41
|
+
* `progress` value to move against. `Panelside.Scene` is the wrapper you put
|
|
42
|
+
* around your own screen; without it there is nothing to push, which is why it
|
|
43
|
+
* is explicit rather than inferred.
|
|
44
|
+
*
|
|
45
|
+
* ## The scene maths
|
|
46
|
+
*
|
|
47
|
+
* React Native scales a view about its centre, so a scene scaled to `s` has
|
|
48
|
+
* already pulled its left edge `W * (1 - s) / 2` inward before any translation
|
|
49
|
+
* is applied. Translating by the panel width alone would therefore leave a gap
|
|
50
|
+
* that grows with the scale, and the panel would look mis-measured. Subtracting
|
|
51
|
+
* that inset is what puts the scene's *visible* edge exactly where the panel
|
|
52
|
+
* ends:
|
|
53
|
+
*
|
|
54
|
+
* scale = 1 - (1 - s) * p
|
|
55
|
+
* translateX = p * (width + gap) - W * (1 - scale) / 2
|
|
56
|
+
*
|
|
57
|
+
* Both are driven from one shared value, so a half-finished drag is a real
|
|
58
|
+
* halfway state rather than an interpolation between two snapshots.
|
|
59
|
+
*
|
|
60
|
+
* ## One gesture, both directions
|
|
61
|
+
*
|
|
62
|
+
* A single pan opens and closes. By default it listens across the whole
|
|
63
|
+
* surface, because that is the behaviour this pattern is known for: a sideways
|
|
64
|
+
* drag anywhere on the app brings the panel in, from wherever your thumb
|
|
65
|
+
* already was. What keeps a list usable underneath it is the pair of
|
|
66
|
+
* thresholds — the drag gives itself up on twelve points of vertical travel
|
|
67
|
+
* and only claims the touch at fourteen horizontal, so anything even slightly
|
|
68
|
+
* vertical resolves as a scroll.
|
|
69
|
+
*
|
|
70
|
+
* `swipeFrom="edge"` narrows the closed-state hit area to a strip at the
|
|
71
|
+
* leading screen edge instead. That is for a scene with its own use for a
|
|
72
|
+
* horizontal drag — a carousel, a wide table, a pannable chart — which would
|
|
73
|
+
* otherwise fight the panel and lose.
|
|
74
|
+
*
|
|
75
|
+
* Reanimated's default `ReduceMotion.System` applies throughout: with the
|
|
76
|
+
* accessibility setting on, every spring here resolves instantly to its target
|
|
77
|
+
* rather than travelling.
|
|
78
|
+
*/
|
|
79
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
80
|
+
import { type PressableProps, type ScrollViewProps, type TextInputProps, type ViewProps } from 'react-native';
|
|
81
|
+
import { type SharedValue } from 'react-native-reanimated';
|
|
82
|
+
export type PanelsideMode = 'push' | 'overlay';
|
|
83
|
+
export type PanelsideSwipeFrom = 'anywhere' | 'edge';
|
|
84
|
+
export interface UsePanelsideResult {
|
|
85
|
+
open: boolean;
|
|
86
|
+
setOpen: (open: boolean) => void;
|
|
87
|
+
toggle: () => void;
|
|
88
|
+
/**
|
|
89
|
+
* How far the panel has travelled, 0 to 1, on the UI thread. Read it to move
|
|
90
|
+
* something of your own with the panel — a header that fades, a title that
|
|
91
|
+
* slides — without a re-render per frame.
|
|
92
|
+
*/
|
|
93
|
+
progress: SharedValue<number>;
|
|
94
|
+
/** True while the panel is docked open beside the scene. */
|
|
95
|
+
docked: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The panel's state, from anywhere inside a `<Panelside>` — including your own
|
|
99
|
+
* screen inside `Panelside.Scene`, which is where a custom open button usually
|
|
100
|
+
* lives.
|
|
101
|
+
*/
|
|
102
|
+
export declare function usePanelside(): UsePanelsideResult;
|
|
103
|
+
export interface PanelsideProps {
|
|
104
|
+
children: ReactNode;
|
|
105
|
+
/** Open state, when you want to own it. Pair with `onOpenChange`. */
|
|
106
|
+
open?: boolean;
|
|
107
|
+
/** Called with the next open state, whether a gesture or you caused it. */
|
|
108
|
+
onOpenChange?: (open: boolean) => void;
|
|
109
|
+
/** Open state to start at when you are not controlling it. */
|
|
110
|
+
defaultOpen?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* How the two layers relate. `push` moves the scene aside and curves it,
|
|
113
|
+
* which is the point of this component. `overlay` slides the panel over a
|
|
114
|
+
* scene that stays put — the same navigation, for a screen whose content
|
|
115
|
+
* cannot afford to move.
|
|
116
|
+
*/
|
|
117
|
+
mode?: PanelsideMode;
|
|
118
|
+
/**
|
|
119
|
+
* Panel width in points. Defaults to 80% of the container capped at 360,
|
|
120
|
+
* and to a third of it capped at 320 once docked — an overlay panel gives
|
|
121
|
+
* the width back when it closes and a docked one keeps it, so they are not
|
|
122
|
+
* the same measurement. The caps are what stop a tablet getting a navigation
|
|
123
|
+
* list with a field of whitespace beside it.
|
|
124
|
+
*/
|
|
125
|
+
width?: number;
|
|
126
|
+
/**
|
|
127
|
+
* Container width at or above which the panel stops being an overlay and
|
|
128
|
+
* becomes a permanent sidebar: laid out beside the scene, always open, with
|
|
129
|
+
* the gesture and the trigger switched off. A docked panel also narrows to a
|
|
130
|
+
* third of the container, capped at 320 — docked, every point it takes is a
|
|
131
|
+
* point the app does not get back.
|
|
132
|
+
*
|
|
133
|
+
* Off by default, and deliberately not a guess — a large phone in landscape
|
|
134
|
+
* is wider than a small tablet in portrait, so no single number is right for
|
|
135
|
+
* every app. Set it high enough that what is left over is still a screen:
|
|
136
|
+
* around 700 is the first width where both halves have room.
|
|
137
|
+
*/
|
|
138
|
+
dock?: number | false;
|
|
139
|
+
/** Swipe to open, and drag the scene to close. Default true. */
|
|
140
|
+
swipeEnabled?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Where a swipe may begin. `anywhere` is the default and the behaviour this
|
|
143
|
+
* pattern is known for — a sideways drag across the app opens the panel from
|
|
144
|
+
* wherever your thumb already was.
|
|
145
|
+
*
|
|
146
|
+
* `edge` narrows it to a strip at the leading screen edge, for a scene that
|
|
147
|
+
* has its own use for a horizontal drag: a carousel, a wide table, a chart
|
|
148
|
+
* you can pan. Anything like that under an `anywhere` panel will fight it,
|
|
149
|
+
* and the panel usually wins.
|
|
150
|
+
*/
|
|
151
|
+
swipeFrom?: PanelsideSwipeFrom;
|
|
152
|
+
/**
|
|
153
|
+
* How wide the leading-edge strip that starts a swipe is, when `swipeFrom`
|
|
154
|
+
* is `edge`. Default 48 — wider than the system's own edge gestures, because
|
|
155
|
+
* there is no bezel to feel for. Ignored otherwise.
|
|
156
|
+
*/
|
|
157
|
+
edgeWidth?: number;
|
|
158
|
+
/**
|
|
159
|
+
* Tapping the pushed scene, or the Android back button, closes the panel.
|
|
160
|
+
* Default true.
|
|
161
|
+
*/
|
|
162
|
+
dismissible?: boolean;
|
|
163
|
+
className?: string;
|
|
164
|
+
}
|
|
165
|
+
declare function PanelsideRoot({ children, open: controlledOpen, onOpenChange, defaultOpen, mode, width: widthProp, dock, swipeEnabled, swipeFrom, edgeWidth, dismissible, className, }: PanelsideProps): import("react").JSX.Element;
|
|
166
|
+
export interface PanelsidePanelProps extends ViewProps {
|
|
167
|
+
className?: string;
|
|
168
|
+
children?: ReactNode;
|
|
169
|
+
}
|
|
170
|
+
declare function PanelsidePanel({ className, children, style, ...props }: PanelsidePanelProps): import("react").JSX.Element;
|
|
171
|
+
declare namespace PanelsidePanel {
|
|
172
|
+
var displayName: string;
|
|
173
|
+
}
|
|
174
|
+
export interface PanelsideHeaderProps extends ViewProps {
|
|
175
|
+
className?: string;
|
|
176
|
+
/** Rendered as the heading. Omit it and supply your own in `children`. */
|
|
177
|
+
title?: string;
|
|
178
|
+
/** A single element pinned to the trailing end of the title row. */
|
|
179
|
+
action?: ReactNode;
|
|
180
|
+
/** Anything below the title row — a search field, a workspace switcher. */
|
|
181
|
+
children?: ReactNode;
|
|
182
|
+
}
|
|
183
|
+
declare function PanelsideHeader({ className, title, action, children, style, ...props }: PanelsideHeaderProps): import("react").JSX.Element;
|
|
184
|
+
declare namespace PanelsideHeader {
|
|
185
|
+
var displayName: string;
|
|
186
|
+
}
|
|
187
|
+
export interface PanelsideSearchProps extends TextInputProps {
|
|
188
|
+
className?: string;
|
|
189
|
+
containerClassName?: string;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* A compact filter field for the panel.
|
|
193
|
+
*
|
|
194
|
+
* Deliberately not the library's `Input`: that field carries a label, a
|
|
195
|
+
* description, an error slot and keyboard avoidance, none of which a panel
|
|
196
|
+
* search row wants, and all of which would have to be switched off at every
|
|
197
|
+
* call site.
|
|
198
|
+
*/
|
|
199
|
+
declare function PanelsideSearch({ className, containerClassName, placeholder, ...props }: PanelsideSearchProps): import("react").JSX.Element;
|
|
200
|
+
declare namespace PanelsideSearch {
|
|
201
|
+
var displayName: string;
|
|
202
|
+
}
|
|
203
|
+
export interface PanelsideContentProps extends ScrollViewProps {
|
|
204
|
+
className?: string;
|
|
205
|
+
contentContainerClassName?: string;
|
|
206
|
+
children?: ReactNode;
|
|
207
|
+
}
|
|
208
|
+
declare function PanelsideContent({ className, contentContainerClassName, contentContainerStyle, children, ...props }: PanelsideContentProps): import("react").JSX.Element;
|
|
209
|
+
declare namespace PanelsideContent {
|
|
210
|
+
var displayName: string;
|
|
211
|
+
}
|
|
212
|
+
export interface PanelsideGroupProps extends ViewProps {
|
|
213
|
+
className?: string;
|
|
214
|
+
children?: ReactNode;
|
|
215
|
+
}
|
|
216
|
+
declare function PanelsideGroup({ className, children, ...props }: PanelsideGroupProps): import("react").JSX.Element;
|
|
217
|
+
declare namespace PanelsideGroup {
|
|
218
|
+
var displayName: string;
|
|
219
|
+
}
|
|
220
|
+
export interface PanelsideGroupLabelProps extends ViewProps {
|
|
221
|
+
className?: string;
|
|
222
|
+
children?: ReactNode;
|
|
223
|
+
}
|
|
224
|
+
declare function PanelsideGroupLabel({ className, children, ...props }: PanelsideGroupLabelProps): import("react").JSX.Element;
|
|
225
|
+
declare namespace PanelsideGroupLabel {
|
|
226
|
+
var displayName: string;
|
|
227
|
+
}
|
|
228
|
+
export interface PanelsideItemProps extends Omit<PressableProps, 'children'> {
|
|
229
|
+
className?: string;
|
|
230
|
+
/** Leading element — an icon, an avatar, a coloured dot. */
|
|
231
|
+
icon?: ReactNode;
|
|
232
|
+
/** The row's text. Truncated to one line, since chat titles run long. */
|
|
233
|
+
label?: string;
|
|
234
|
+
/** Marks the row as the current destination. */
|
|
235
|
+
active?: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Trailing count or status. A number or string renders as a pill; anything
|
|
238
|
+
* else renders as given.
|
|
239
|
+
*/
|
|
240
|
+
badge?: ReactNode;
|
|
241
|
+
disabled?: boolean;
|
|
242
|
+
/** Trailing content — usually a `Panelside.Action`. */
|
|
243
|
+
children?: ReactNode;
|
|
244
|
+
}
|
|
245
|
+
declare function PanelsideItem({ className, icon, label, active, badge, disabled, children, ...props }: PanelsideItemProps): import("react").JSX.Element;
|
|
246
|
+
declare namespace PanelsideItem {
|
|
247
|
+
var displayName: string;
|
|
248
|
+
}
|
|
249
|
+
export interface PanelsideActionProps extends Omit<PressableProps, 'children'> {
|
|
250
|
+
className?: string;
|
|
251
|
+
/**
|
|
252
|
+
* What a screen reader announces. The default control is an unlabelled glyph,
|
|
253
|
+
* so this is the only description it has.
|
|
254
|
+
*/
|
|
255
|
+
label?: string;
|
|
256
|
+
/** Replaces the default overflow glyph. */
|
|
257
|
+
children?: ReactNode;
|
|
258
|
+
}
|
|
259
|
+
declare function PanelsideAction({ className, label, children, ...props }: PanelsideActionProps): import("react").JSX.Element;
|
|
260
|
+
declare namespace PanelsideAction {
|
|
261
|
+
var displayName: string;
|
|
262
|
+
}
|
|
263
|
+
export interface PanelsideFooterProps extends ViewProps {
|
|
264
|
+
className?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Overlay the scrolling list instead of taking a row below it. Default true —
|
|
267
|
+
* the list runs the full height of the panel behind it, and `Panelside.Content`
|
|
268
|
+
* leaves exactly this footer's height of room at the end.
|
|
269
|
+
*/
|
|
270
|
+
floating?: boolean;
|
|
271
|
+
children?: ReactNode;
|
|
272
|
+
}
|
|
273
|
+
declare function PanelsideFooter({ className, floating, children, style, ...props }: PanelsideFooterProps): import("react").JSX.Element;
|
|
274
|
+
declare namespace PanelsideFooter {
|
|
275
|
+
var displayName: string;
|
|
276
|
+
}
|
|
277
|
+
export interface PanelsideCtaProps extends Omit<PressableProps, 'children'> {
|
|
278
|
+
className?: string;
|
|
279
|
+
/** The button's text. */
|
|
280
|
+
label?: string;
|
|
281
|
+
/** Leading element, usually an icon. */
|
|
282
|
+
icon?: ReactNode;
|
|
283
|
+
/** `primary` is the filled accent pill; `secondary` is the quiet one. */
|
|
284
|
+
variant?: 'primary' | 'secondary';
|
|
285
|
+
/**
|
|
286
|
+
* Render the platform's own button instead of the pill. Requires the
|
|
287
|
+
* optional `@expo/ui` package; without it this prop does nothing.
|
|
288
|
+
*
|
|
289
|
+
* **Theme tokens do not apply** — the platform draws the button, so
|
|
290
|
+
* `className` and `icon` are ignored and it sizes itself to `label`.
|
|
291
|
+
*/
|
|
292
|
+
native?: boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Draw the native button in the platform's Liquid Glass material. Requires
|
|
295
|
+
* `native`, and iOS 26 or later; ignored anywhere else.
|
|
296
|
+
*/
|
|
297
|
+
glass?: boolean;
|
|
298
|
+
children?: ReactNode;
|
|
299
|
+
}
|
|
300
|
+
declare function PanelsideCta({ className, label, icon, variant, native, glass, disabled, children, ...props }: PanelsideCtaProps): import("react").JSX.Element;
|
|
301
|
+
declare namespace PanelsideCta {
|
|
302
|
+
var displayName: string;
|
|
303
|
+
}
|
|
304
|
+
export interface PanelsideSceneProps extends ViewProps {
|
|
305
|
+
className?: string;
|
|
306
|
+
/**
|
|
307
|
+
* How small the scene gets at full travel. Default 1 — the screen keeps its
|
|
308
|
+
* full height and stays behind the status bar, and the radius and dim do the
|
|
309
|
+
* work. Below one it shrinks about its centre, which insets it top and bottom
|
|
310
|
+
* as well as at the side.
|
|
311
|
+
*/
|
|
312
|
+
scale?: number;
|
|
313
|
+
/** The corner radius the scene reaches at full travel. Default 44. */
|
|
314
|
+
radius?: number;
|
|
315
|
+
/** How far the scene dims at full travel, 0 to 1. Default 0.45. */
|
|
316
|
+
dim?: number;
|
|
317
|
+
children?: ReactNode;
|
|
318
|
+
}
|
|
319
|
+
declare function PanelsideScene({ className, scale, radius, dim, children, style, ...props }: PanelsideSceneProps): import("react").JSX.Element;
|
|
320
|
+
declare namespace PanelsideScene {
|
|
321
|
+
var displayName: string;
|
|
322
|
+
}
|
|
323
|
+
export interface PanelsideTriggerProps extends Omit<PressableProps, 'children'> {
|
|
324
|
+
className?: string;
|
|
325
|
+
/** What a screen reader announces. */
|
|
326
|
+
label?: string;
|
|
327
|
+
/**
|
|
328
|
+
* A single pressable element to use instead of the default button. Its own
|
|
329
|
+
* `onPress` still runs.
|
|
330
|
+
*/
|
|
331
|
+
children?: ReactElement<{
|
|
332
|
+
onPress?: (...args: unknown[]) => void;
|
|
333
|
+
}>;
|
|
334
|
+
}
|
|
335
|
+
declare function PanelsideTrigger({ className, label, children, ...props }: PanelsideTriggerProps): import("react").JSX.Element | null;
|
|
336
|
+
declare namespace PanelsideTrigger {
|
|
337
|
+
var displayName: string;
|
|
338
|
+
}
|
|
339
|
+
export declare const Panelside: typeof PanelsideRoot & {
|
|
340
|
+
Panel: typeof PanelsidePanel;
|
|
341
|
+
Header: typeof PanelsideHeader;
|
|
342
|
+
Search: typeof PanelsideSearch;
|
|
343
|
+
Content: typeof PanelsideContent;
|
|
344
|
+
Group: typeof PanelsideGroup;
|
|
345
|
+
GroupLabel: typeof PanelsideGroupLabel;
|
|
346
|
+
Item: typeof PanelsideItem;
|
|
347
|
+
Action: typeof PanelsideAction;
|
|
348
|
+
Footer: typeof PanelsideFooter;
|
|
349
|
+
Cta: typeof PanelsideCta;
|
|
350
|
+
Scene: typeof PanelsideScene;
|
|
351
|
+
Trigger: typeof PanelsideTrigger;
|
|
352
|
+
};
|
|
353
|
+
export {};
|
|
354
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/panelside/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;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AE,SAAS,CAAC;CACtB;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,KAAK,EACL,IAAI,EACJ,OAAmB,EACnB,MAAc,EACd,KAAa,EACb,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,iBAAiB,+BA2EnB;kBArFQ,YAAY;;;AAuFrB,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,KAAmB,EACnB,MAAqB,EACrB,GAAe,EACf,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE,mBAAmB,+BAwHrB;kBAhIQ,cAAc;;;AAkIvB,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;QAAE,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;KAAE,CAAC,CAAC;CACrE;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,KAA+B,EAC/B,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,qBAAqB,sCA6BvB;kBAlCQ,gBAAgB;;;AAiDzB,eAAO,MAAM,SAAS;;;;;;;;;;;;;CAapB,CAAC"}
|
|
@@ -121,8 +121,21 @@ declare const progressVariants: import("tailwind-variants").TVReturnType<{
|
|
|
121
121
|
type ProgressVariantProps = VariantProps<typeof progressVariants>;
|
|
122
122
|
export interface ProgressProps extends Omit<ViewProps, 'children'>, ProgressVariantProps {
|
|
123
123
|
className?: string;
|
|
124
|
-
/**
|
|
124
|
+
/**
|
|
125
|
+
* Where the work has got to, somewhere between `minValue` and `maxValue`.
|
|
126
|
+
* Ignored when `indeterminate` is set.
|
|
127
|
+
*/
|
|
125
128
|
value?: number;
|
|
129
|
+
/**
|
|
130
|
+
* The bottom of the range — the value at which the bar reads as empty.
|
|
131
|
+
* Defaults to `0`.
|
|
132
|
+
*/
|
|
133
|
+
minValue?: number;
|
|
134
|
+
/**
|
|
135
|
+
* The top of the range — the value at which the bar reads as full. Defaults
|
|
136
|
+
* to `100`, so a bare percentage keeps working with neither bound set.
|
|
137
|
+
*/
|
|
138
|
+
maxValue?: number;
|
|
126
139
|
/** Show a looping animation for unknown-duration work. */
|
|
127
140
|
indeterminate?: boolean;
|
|
128
141
|
/** Extra classes for the moving indicator. */
|
|
@@ -144,9 +157,11 @@ export interface ProgressProps extends Omit<ViewProps, 'children'>, ProgressVari
|
|
|
144
157
|
*/
|
|
145
158
|
valueLabel?: string;
|
|
146
159
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
160
|
+
* How to write the value, through `Intl.NumberFormat`. A `percent` style
|
|
161
|
+
* formats how far along the bar is; every other style formats the value
|
|
162
|
+
* itself, so `{ style: 'currency', currency: 'USD' }` against a `maxValue`
|
|
163
|
+
* of `2000` reads `$1,250.00` rather than a percentage of it. Falls back to
|
|
164
|
+
* a rounded percent when omitted.
|
|
150
165
|
*/
|
|
151
166
|
formatOptions?: Intl.NumberFormatOptions;
|
|
152
167
|
/** Extra classes for the label + value-label row. */
|
|
@@ -159,6 +174,12 @@ export interface ProgressProps extends Omit<ViewProps, 'children'>, ProgressVari
|
|
|
159
174
|
*
|
|
160
175
|
* Pass `label` or `showValueLabel` to caption the bar with a header row; the
|
|
161
176
|
* bare track renders when neither is set, so existing call sites are untouched.
|
|
177
|
+
*
|
|
178
|
+
* The value is read against `minValue` / `maxValue`, which default to 0 and
|
|
179
|
+
* 100 — so a percentage needs neither. Set them and the bar speaks in whatever
|
|
180
|
+
* the work is actually counted in: bytes uploaded, seats filled, points
|
|
181
|
+
* scored. Nothing has to be converted to a percent on the way in, and the
|
|
182
|
+
* screen reader is told the real range rather than a derived one.
|
|
162
183
|
*/
|
|
163
184
|
export declare const Progress: import("react").ForwardRefExoticComponent<ProgressProps & import("react").RefAttributes<View>>;
|
|
164
185
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/progress/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAW5E,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAS1D,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAyBpB,CAAC;AAEH,KAAK,oBAAoB,GAAG,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAElE,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,EACjC,oBAAoB;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/progress/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAW5E,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAS1D,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,KAAK,EACL,aAAa,EACb,WAAgC,EAChC,QAAQ,EACR,YAAsB,EACtB,KAAK,EACL,YAAwB,EACxB,MAAU,EACV,YAAY,EACZ,UAAkB,EAClB,iBAA4B,EAC5B,YAA2B,EAC3B,MAAM,EACN,gBAAyB,EACzB,QAAQ,GACT,EAAE,WAAW,+BA8Ub;AAED,eAAO,MAAM,MAAM;;CAEjB,CAAC"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Swipe — a row that slides aside to reveal the things you can do to it.
|
|
3
|
+
*
|
|
4
|
+
* It is the one list interaction a phone has that a page does not: the actions
|
|
5
|
+
* are not on screen taking up room, they are behind the row, and the gesture
|
|
6
|
+
* that reveals them is the same one everywhere else in the OS. An inbox, a
|
|
7
|
+
* task list, a settings screen — all of them want it, and all of them
|
|
8
|
+
* otherwise end up with a trailing button too small to hit.
|
|
9
|
+
*
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <Swipe>
|
|
12
|
+
* <Swipe.End>
|
|
13
|
+
* <Swipe.Action icon={<TrashIcon />} label="Delete" color="destructive" onPress={remove} />
|
|
14
|
+
* </Swipe.End>
|
|
15
|
+
* <Item variant="outline">
|
|
16
|
+
* <Item.Content><Item.Title>Invoice.pdf</Item.Title></Item.Content>
|
|
17
|
+
* </Item>
|
|
18
|
+
* </Swipe>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* The sides are `start` and `end` rather than left and right, because the
|
|
22
|
+
* gesture mirrors with the reading direction: in a right-to-left app the row
|
|
23
|
+
* that opened toward the right has to open toward the left, and a caller
|
|
24
|
+
* should not have to write that twice. Yoga mirrors where the panels sit; the
|
|
25
|
+
* drag is measured in raw pixels and cannot be mirrored for us, so it reads
|
|
26
|
+
* the direction and turns itself around.
|
|
27
|
+
*
|
|
28
|
+
* Everything that moves runs on the UI thread. A row being dragged does not
|
|
29
|
+
* re-render — the only React work in a swipe is the callback at the end of it.
|
|
30
|
+
*/
|
|
31
|
+
import { type ReactNode } from 'react';
|
|
32
|
+
import { View, type ViewProps } from 'react-native';
|
|
33
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
34
|
+
type SwipeSide = 'start' | 'end';
|
|
35
|
+
/** The side a row is open on, or `null` while it is closed. */
|
|
36
|
+
export type SwipeOpenSide = SwipeSide | null;
|
|
37
|
+
export interface SwipeHandle {
|
|
38
|
+
/** Slide the row aside to reveal one side's actions. */
|
|
39
|
+
open: (side: SwipeSide) => void;
|
|
40
|
+
/** Put the row back. */
|
|
41
|
+
close: () => void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A tile is a filled block of colour with its content laid over it, which
|
|
45
|
+
* settles both halves of how it is coloured:
|
|
46
|
+
*
|
|
47
|
+
* - The fill is the status colour at full strength, never a tint of it. A tile
|
|
48
|
+
* only exists while the row is out of the way, so it has to be legible in the
|
|
49
|
+
* moment it appears; a 6%-alpha wash of the row's own background is not a
|
|
50
|
+
* tile at all, it is a hole with a glyph floating in it.
|
|
51
|
+
* - The content is white, because the status colours are chosen to be carried
|
|
52
|
+
* at full strength with white over them. The `-foreground` token of a status
|
|
53
|
+
* is the *darker text* form of that hue, meant for a neutral surface — laid
|
|
54
|
+
* over the fill it is the same hue twice and the label all but disappears.
|
|
55
|
+
*
|
|
56
|
+
* `default` and `primary` are the two that cannot take white. `primary`
|
|
57
|
+
* inverts with the theme and owns a true on-primary token, so it uses it;
|
|
58
|
+
* `default` is a mid grey in every theme, and takes the background colour,
|
|
59
|
+
* which is the neutral furthest from it in whichever direction the theme runs.
|
|
60
|
+
*/
|
|
61
|
+
declare const actionVariants: import("tailwind-variants").TVReturnType<{
|
|
62
|
+
color: {
|
|
63
|
+
default: {
|
|
64
|
+
root: string;
|
|
65
|
+
label: string;
|
|
66
|
+
};
|
|
67
|
+
primary: {
|
|
68
|
+
root: string;
|
|
69
|
+
label: string;
|
|
70
|
+
};
|
|
71
|
+
success: {
|
|
72
|
+
root: string;
|
|
73
|
+
label: string;
|
|
74
|
+
};
|
|
75
|
+
warning: {
|
|
76
|
+
root: string;
|
|
77
|
+
label: string;
|
|
78
|
+
};
|
|
79
|
+
info: {
|
|
80
|
+
root: string;
|
|
81
|
+
label: string;
|
|
82
|
+
};
|
|
83
|
+
destructive: {
|
|
84
|
+
root: string;
|
|
85
|
+
label: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
}, {
|
|
89
|
+
root: string;
|
|
90
|
+
label: string;
|
|
91
|
+
}, undefined, {
|
|
92
|
+
color: {
|
|
93
|
+
default: {
|
|
94
|
+
root: string;
|
|
95
|
+
label: string;
|
|
96
|
+
};
|
|
97
|
+
primary: {
|
|
98
|
+
root: string;
|
|
99
|
+
label: string;
|
|
100
|
+
};
|
|
101
|
+
success: {
|
|
102
|
+
root: string;
|
|
103
|
+
label: string;
|
|
104
|
+
};
|
|
105
|
+
warning: {
|
|
106
|
+
root: string;
|
|
107
|
+
label: string;
|
|
108
|
+
};
|
|
109
|
+
info: {
|
|
110
|
+
root: string;
|
|
111
|
+
label: string;
|
|
112
|
+
};
|
|
113
|
+
destructive: {
|
|
114
|
+
root: string;
|
|
115
|
+
label: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
}, {
|
|
119
|
+
root: string;
|
|
120
|
+
label: string;
|
|
121
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
122
|
+
color: {
|
|
123
|
+
default: {
|
|
124
|
+
root: string;
|
|
125
|
+
label: string;
|
|
126
|
+
};
|
|
127
|
+
primary: {
|
|
128
|
+
root: string;
|
|
129
|
+
label: string;
|
|
130
|
+
};
|
|
131
|
+
success: {
|
|
132
|
+
root: string;
|
|
133
|
+
label: string;
|
|
134
|
+
};
|
|
135
|
+
warning: {
|
|
136
|
+
root: string;
|
|
137
|
+
label: string;
|
|
138
|
+
};
|
|
139
|
+
info: {
|
|
140
|
+
root: string;
|
|
141
|
+
label: string;
|
|
142
|
+
};
|
|
143
|
+
destructive: {
|
|
144
|
+
root: string;
|
|
145
|
+
label: string;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
}, {
|
|
149
|
+
root: string;
|
|
150
|
+
label: string;
|
|
151
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
152
|
+
export type SwipeActionColor = 'default' | 'primary' | 'success' | 'warning' | 'info' | 'destructive';
|
|
153
|
+
export interface SwipeActionProps extends Omit<ViewProps, 'children'>, VariantProps<typeof actionVariants> {
|
|
154
|
+
className?: string;
|
|
155
|
+
/** What the action does. Also what a screen reader is offered. */
|
|
156
|
+
label: string;
|
|
157
|
+
/**
|
|
158
|
+
* Drawn above the label and tinted to match it. Pass the glyph, not a colour
|
|
159
|
+
* and not a size — a tile sizes it to read at a glance, since it is the part
|
|
160
|
+
* of an action the eye reaches before the word underneath it.
|
|
161
|
+
*/
|
|
162
|
+
icon?: ReactNode;
|
|
163
|
+
/** Run when the tile is tapped, or when a full swipe reaches it. */
|
|
164
|
+
onPress?: () => void;
|
|
165
|
+
/**
|
|
166
|
+
* Leave the row open after the action runs. Off by default: an action that
|
|
167
|
+
* has already happened has nothing left to offer, and a row left standing
|
|
168
|
+
* open is the most common way a swipe list ends up feeling stuck.
|
|
169
|
+
*/
|
|
170
|
+
keepOpen?: boolean;
|
|
171
|
+
/** Extra classes for the label. */
|
|
172
|
+
labelClassName?: string;
|
|
173
|
+
}
|
|
174
|
+
export interface SwipePanelProps extends Omit<ViewProps, 'children'> {
|
|
175
|
+
className?: string;
|
|
176
|
+
children?: ReactNode;
|
|
177
|
+
}
|
|
178
|
+
export interface SwipeProps extends Omit<ViewProps, 'children'> {
|
|
179
|
+
className?: string;
|
|
180
|
+
/**
|
|
181
|
+
* The row itself, plus a `Swipe.Start` and/or `Swipe.End` holding its
|
|
182
|
+
* actions. Order does not matter — the panels are recognised by type.
|
|
183
|
+
*/
|
|
184
|
+
children?: ReactNode;
|
|
185
|
+
/**
|
|
186
|
+
* Let a drag carried well past the panel fire its outermost action on
|
|
187
|
+
* release, without the tile ever being tapped. On by default, and the reason
|
|
188
|
+
* the far end of a panel is the destructive slot by convention.
|
|
189
|
+
*/
|
|
190
|
+
fullSwipe?: boolean;
|
|
191
|
+
/** Turn the gesture off and leave the row static. The tiles stay tappable. */
|
|
192
|
+
disabled?: boolean;
|
|
193
|
+
/** Tick when a drag crosses the point at which letting go fires an action. */
|
|
194
|
+
haptics?: boolean;
|
|
195
|
+
/** Told which side opened, or `null` when the row closed. */
|
|
196
|
+
onOpenChange?: (side: SwipeOpenSide) => void;
|
|
197
|
+
/** Extra classes for the moving row. */
|
|
198
|
+
contentClassName?: string;
|
|
199
|
+
}
|
|
200
|
+
export declare const Swipe: import("react").ForwardRefExoticComponent<SwipeProps & import("react").RefAttributes<SwipeHandle>> & {
|
|
201
|
+
Start: import("react").ForwardRefExoticComponent<SwipePanelProps & import("react").RefAttributes<View>>;
|
|
202
|
+
End: import("react").ForwardRefExoticComponent<SwipePanelProps & import("react").RefAttributes<View>>;
|
|
203
|
+
Action: import("react").ForwardRefExoticComponent<SwipeActionProps & import("react").RefAttributes<View>>;
|
|
204
|
+
};
|
|
205
|
+
export {};
|
|
206
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/swipe/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAYL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAU5E,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA0B1D,KAAK,SAAS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S,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,wCAAwC;IACxC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAkVD,eAAO,MAAM,KAAK;;;;CAIhB,CAAC"}
|
|
@@ -46,6 +46,7 @@ export declare function ChevronDownIcon({ size, color, ...props }: IconProps): i
|
|
|
46
46
|
export declare function ChevronLeftIcon({ size, color, ...props }: IconProps): import("react").JSX.Element;
|
|
47
47
|
export declare function ChevronRightIcon({ size, color, ...props }: IconProps): import("react").JSX.Element;
|
|
48
48
|
export declare function EllipsisIcon({ size, color, ...props }: IconProps): import("react").JSX.Element;
|
|
49
|
+
export declare function MenuIcon({ size, color, ...props }: IconProps): import("react").JSX.Element;
|
|
49
50
|
export declare function XIcon({ size, color, ...props }: IconProps): import("react").JSX.Element;
|
|
50
51
|
export declare function SearchIcon({ size, color, ...props }: IconProps): import("react").JSX.Element;
|
|
51
52
|
export declare function ArrowUpRightIcon({ size, color, ...props }: IconProps): import("react").JSX.Element;
|