panelui-native 0.87.0 → 0.88.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/lib/module/components/animated-badge/index.js +451 -0
- package/lib/module/components/animated-badge/index.js.map +1 -0
- package/lib/module/components/bottom-sheet/index.js +17 -6
- package/lib/module/components/bottom-sheet/index.js.map +1 -1
- package/lib/module/components/bubble-chart/index.js +557 -41
- package/lib/module/components/bubble-chart/index.js.map +1 -1
- package/lib/module/components/feedback-dialog/index.js +474 -0
- package/lib/module/components/feedback-dialog/index.js.map +1 -0
- package/lib/module/components/scroll-blur/index.js +363 -0
- package/lib/module/components/scroll-blur/index.js.map +1 -0
- package/lib/module/components/scroll-canvas/index.js +2 -0
- package/lib/module/components/scroll-canvas/index.js.map +1 -1
- package/lib/module/components/scroll-text/index.js +3 -0
- package/lib/module/components/scroll-text/index.js.map +1 -1
- package/lib/module/components/search-bar/index.js +390 -45
- package/lib/module/components/search-bar/index.js.map +1 -1
- package/lib/module/hooks/use-keyboard-avoidance.js +21 -1
- package/lib/module/hooks/use-keyboard-avoidance.js.map +1 -1
- package/lib/module/hooks/use-reveal-progress.js +21 -1
- package/lib/module/hooks/use-reveal-progress.js.map +1 -1
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/components/animated-badge/index.d.ts +224 -0
- package/lib/typescript/src/components/animated-badge/index.d.ts.map +1 -0
- package/lib/typescript/src/components/bottom-sheet/index.d.ts +1 -15
- package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/src/components/bubble-chart/index.d.ts +150 -7
- package/lib/typescript/src/components/bubble-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/feedback-dialog/index.d.ts +156 -0
- package/lib/typescript/src/components/feedback-dialog/index.d.ts.map +1 -0
- package/lib/typescript/src/components/scroll-blur/index.d.ts +113 -0
- package/lib/typescript/src/components/scroll-blur/index.d.ts.map +1 -0
- package/lib/typescript/src/components/scroll-canvas/index.d.ts.map +1 -1
- package/lib/typescript/src/components/search-bar/index.d.ts +142 -7
- package/lib/typescript/src/components/search-bar/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/use-keyboard-avoidance.d.ts.map +1 -1
- package/lib/typescript/src/hooks/use-reveal-progress.d.ts +6 -27
- package/lib/typescript/src/hooks/use-reveal-progress.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +5 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/animated-badge/index.tsx +513 -0
- package/src/components/bottom-sheet/index.tsx +23 -8
- package/src/components/bubble-chart/index.tsx +664 -46
- package/src/components/feedback-dialog/index.tsx +557 -0
- package/src/components/scroll-blur/index.tsx +466 -0
- package/src/components/scroll-canvas/index.tsx +2 -1
- package/src/components/scroll-text/index.tsx +3 -3
- package/src/components/search-bar/index.tsx +471 -41
- package/src/hooks/use-keyboard-avoidance.ts +24 -1
- package/src/hooks/use-reveal-progress.ts +30 -1
- package/src/index.ts +27 -0
|
@@ -200,6 +200,27 @@ export function useKeyboardAvoidance({
|
|
|
200
200
|
/** The translation currently applied, in pixels. Zero or negative. */
|
|
201
201
|
const translation = useSharedValue(0);
|
|
202
202
|
|
|
203
|
+
/*
|
|
204
|
+
* Whether the element has been laid out at least once and is still mounted.
|
|
205
|
+
*
|
|
206
|
+
* `measure` warns when it is handed a view the layout engine has no metrics
|
|
207
|
+
* for — every frame between a mount and its first layout, and every frame
|
|
208
|
+
* after an unmount that the callback has not been stopped for yet. Neither
|
|
209
|
+
* is a fault, and neither can be answered by the `null` it returns, because
|
|
210
|
+
* the warning is printed before that null comes back. Running once a frame,
|
|
211
|
+
* one of these fills the log on its own.
|
|
212
|
+
*
|
|
213
|
+
* So the layout pass is what says the view can be measured, and the unmount
|
|
214
|
+
* is what takes it back.
|
|
215
|
+
*/
|
|
216
|
+
const laidOut = useSharedValue(false);
|
|
217
|
+
useEffect(
|
|
218
|
+
() => () => {
|
|
219
|
+
laidOut.value = false;
|
|
220
|
+
},
|
|
221
|
+
[laidOut]
|
|
222
|
+
);
|
|
223
|
+
|
|
203
224
|
// `active` is a plain prop and the worklets below cannot read props, so it is
|
|
204
225
|
// mirrored — written in an effect, because touching a shared value during
|
|
205
226
|
// render is a Reanimated strict-mode violation.
|
|
@@ -226,6 +247,7 @@ export function useKeyboardAvoidance({
|
|
|
226
247
|
'worklet';
|
|
227
248
|
const keyboardHeight = Math.abs(rawHeight.value);
|
|
228
249
|
if (keyboardHeight === 0) return;
|
|
250
|
+
if (!laidOut.value) return;
|
|
229
251
|
|
|
230
252
|
const frame = measure(ref);
|
|
231
253
|
if (!frame || frame.height <= 0) return;
|
|
@@ -267,12 +289,13 @@ export function useKeyboardAvoidance({
|
|
|
267
289
|
|
|
268
290
|
const onLayout = useCallback(
|
|
269
291
|
(_event: LayoutChangeEvent) => {
|
|
292
|
+
laidOut.value = true;
|
|
270
293
|
// A layout pass while the element is at rest means its slot moved for
|
|
271
294
|
// some reason other than the keyboard. Anything left over from the last
|
|
272
295
|
// lift belongs to the old slot.
|
|
273
296
|
if (!tracking && translation.value !== 0) translation.value = 0;
|
|
274
297
|
},
|
|
275
|
-
[tracking, translation]
|
|
298
|
+
[laidOut, tracking, translation]
|
|
276
299
|
);
|
|
277
300
|
|
|
278
301
|
const animatedStyle = useAnimatedStyle(() => {
|
|
@@ -25,11 +25,13 @@
|
|
|
25
25
|
* anything above it resizes; every frame is a measurement pass for a value that
|
|
26
26
|
* only changes when the scroller moves.
|
|
27
27
|
*/
|
|
28
|
+
import { useCallback, useEffect } from 'react';
|
|
28
29
|
import { useWindowDimensions, type View } from 'react-native';
|
|
29
30
|
import {
|
|
30
31
|
measure,
|
|
31
32
|
useAnimatedRef,
|
|
32
33
|
useDerivedValue,
|
|
34
|
+
useSharedValue,
|
|
33
35
|
type AnimatedRef,
|
|
34
36
|
type SharedValue,
|
|
35
37
|
} from 'react-native-reanimated';
|
|
@@ -58,6 +60,12 @@ export interface UseRevealProgressOptions {
|
|
|
58
60
|
export interface UseRevealProgressResult {
|
|
59
61
|
/** Attach to the element whose travel drives the effect. */
|
|
60
62
|
ref: AnimatedRef<View>;
|
|
63
|
+
/**
|
|
64
|
+
* Attach to the same element. It is what says the element can be measured —
|
|
65
|
+
* without it the effect still works, at the cost of a warning per frame for
|
|
66
|
+
* every element that is mounted but not yet laid out.
|
|
67
|
+
*/
|
|
68
|
+
onLayout: () => void;
|
|
61
69
|
/** `0` before, `1` after, scrubbed between. */
|
|
62
70
|
progress: SharedValue<number>;
|
|
63
71
|
}
|
|
@@ -72,6 +80,26 @@ export function useRevealProgress({
|
|
|
72
80
|
const scroll = useScrollProgress();
|
|
73
81
|
const { height: windowHeight } = useWindowDimensions();
|
|
74
82
|
|
|
83
|
+
/*
|
|
84
|
+
* Whether the element has been laid out at least once and is still mounted.
|
|
85
|
+
*
|
|
86
|
+
* `measure` warns when it is handed a view the layout engine has no metrics
|
|
87
|
+
* for, and the warning is printed before the `null` that would let a caller
|
|
88
|
+
* notice. A list of these runs its measurement on every scroll frame, so one
|
|
89
|
+
* element that has mounted but not laid out fills the log on its own — which
|
|
90
|
+
* is the case the warning itself names, and the one it is least useful for.
|
|
91
|
+
*/
|
|
92
|
+
const laidOut = useSharedValue(false);
|
|
93
|
+
const onLayout = useCallback(() => {
|
|
94
|
+
laidOut.value = true;
|
|
95
|
+
}, [laidOut]);
|
|
96
|
+
useEffect(
|
|
97
|
+
() => () => {
|
|
98
|
+
laidOut.value = false;
|
|
99
|
+
},
|
|
100
|
+
[laidOut]
|
|
101
|
+
);
|
|
102
|
+
|
|
75
103
|
const offset = scroll?.offset;
|
|
76
104
|
const viewportValue = scroll?.viewport;
|
|
77
105
|
const topValue = scroll?.top;
|
|
@@ -86,6 +114,7 @@ export function useRevealProgress({
|
|
|
86
114
|
const viewport = viewportValue?.value || windowHeight;
|
|
87
115
|
const viewportTop = topValue?.value ?? 0;
|
|
88
116
|
if (viewport <= 0 || Number.isNaN(scrolled)) return 0;
|
|
117
|
+
if (!laidOut.value) return 0;
|
|
89
118
|
|
|
90
119
|
const frame = measure(ref);
|
|
91
120
|
if (!frame || frame.height <= 0) return 0;
|
|
@@ -102,5 +131,5 @@ export function useRevealProgress({
|
|
|
102
131
|
|
|
103
132
|
// An external value is passed straight through, so a caller driving the
|
|
104
133
|
// effect by hand never pays for the measurement.
|
|
105
|
-
return { ref, progress: external ?? derived };
|
|
134
|
+
return { ref, onLayout, progress: external ?? derived };
|
|
106
135
|
}
|
package/src/index.ts
CHANGED
|
@@ -93,6 +93,12 @@ export {
|
|
|
93
93
|
type AreaChartDatum,
|
|
94
94
|
type AreaChartStatus,
|
|
95
95
|
} from './components/area-chart';
|
|
96
|
+
export {
|
|
97
|
+
AnimatedBadge,
|
|
98
|
+
type AnimatedBadgeProps,
|
|
99
|
+
type AnimatedBadgeSize,
|
|
100
|
+
type AnimatedBadgeStatus,
|
|
101
|
+
} from './components/animated-badge';
|
|
96
102
|
export { Badge, type BadgeProps } from './components/badge';
|
|
97
103
|
export {
|
|
98
104
|
BarChart,
|
|
@@ -180,6 +186,17 @@ export {
|
|
|
180
186
|
type DialogProps,
|
|
181
187
|
type DialogContentProps,
|
|
182
188
|
} from './components/dialog';
|
|
189
|
+
export {
|
|
190
|
+
FeedbackDialog,
|
|
191
|
+
type FeedbackDialogProps,
|
|
192
|
+
type FeedbackDialogContentProps,
|
|
193
|
+
type FeedbackDialogPanelProps,
|
|
194
|
+
type FeedbackDialogCloseProps,
|
|
195
|
+
type FeedbackDialogFieldProps,
|
|
196
|
+
type FeedbackDialogFooterProps,
|
|
197
|
+
type FeedbackDialogActionProps,
|
|
198
|
+
type FeedbackDialogSubmitProps,
|
|
199
|
+
} from './components/feedback-dialog';
|
|
183
200
|
export {
|
|
184
201
|
Soundwave,
|
|
185
202
|
type SoundwaveProps,
|
|
@@ -546,9 +563,11 @@ export { OtpInput, type OtpInputProps } from './components/otp-input';
|
|
|
546
563
|
export {
|
|
547
564
|
SearchBar,
|
|
548
565
|
type SearchBarProps,
|
|
566
|
+
type SearchBarActionProps,
|
|
549
567
|
type SearchBarItemProps,
|
|
550
568
|
type SearchBarSectionProps,
|
|
551
569
|
type SearchBarStatusProps,
|
|
570
|
+
type SearchBarTokenProps,
|
|
552
571
|
type SearchBarPanelMode,
|
|
553
572
|
type SearchBarPanelPlacement,
|
|
554
573
|
} from './components/search-bar';
|
|
@@ -636,8 +655,11 @@ export {
|
|
|
636
655
|
type BubbleChartHandle,
|
|
637
656
|
type BubbleChartHeaderProps,
|
|
638
657
|
type BubbleChartGridProps,
|
|
658
|
+
type BubbleChartQuadrantsProps,
|
|
659
|
+
type BubbleChartTrendProps,
|
|
639
660
|
type BubbleChartBubblesProps,
|
|
640
661
|
type BubbleChartLabelsProps,
|
|
662
|
+
type BubbleChartSizeKeyProps,
|
|
641
663
|
type BubbleChartSkeletonProps,
|
|
642
664
|
type BubbleChartXAxisProps,
|
|
643
665
|
type BubbleChartYAxisProps,
|
|
@@ -1018,6 +1040,11 @@ export {
|
|
|
1018
1040
|
type ScatterChartPoint,
|
|
1019
1041
|
type ScatterChartStatus,
|
|
1020
1042
|
} from './components/scatter-chart';
|
|
1043
|
+
export {
|
|
1044
|
+
ScrollBlur,
|
|
1045
|
+
type ScrollBlurProps,
|
|
1046
|
+
type ScrollBlurTint,
|
|
1047
|
+
} from './components/scroll-blur';
|
|
1021
1048
|
export {
|
|
1022
1049
|
ScrollFade,
|
|
1023
1050
|
type ScrollFadeProps,
|