panelui-native 0.5.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/lib/module/components/scroll-fade/index.js +156 -0
- package/lib/module/components/scroll-fade/index.js.map +1 -0
- package/lib/module/components/shimmer/index.js +120 -0
- package/lib/module/components/shimmer/index.js.map +1 -0
- package/lib/module/components/surface/index.js +64 -0
- package/lib/module/components/surface/index.js.map +1 -0
- package/lib/module/hooks/index.js +9 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/use-breakpoint.js +39 -0
- package/lib/module/hooks/use-breakpoint.js.map +1 -0
- package/lib/module/hooks/use-copy-to-clipboard.js +62 -0
- package/lib/module/hooks/use-copy-to-clipboard.js.map +1 -0
- package/lib/module/hooks/use-debounced-value.js +24 -0
- package/lib/module/hooks/use-debounced-value.js.map +1 -0
- package/lib/module/hooks/use-disclosure.js +43 -0
- package/lib/module/hooks/use-disclosure.js.map +1 -0
- package/lib/module/hooks/use-keyboard.js +36 -0
- package/lib/module/hooks/use-keyboard.js.map +1 -0
- package/lib/module/hooks/use-previous.js +25 -0
- package/lib/module/hooks/use-previous.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/components/scroll-fade/index.d.ts +38 -0
- package/lib/typescript/src/components/scroll-fade/index.d.ts.map +1 -0
- package/lib/typescript/src/components/shimmer/index.d.ts +42 -0
- package/lib/typescript/src/components/shimmer/index.d.ts.map +1 -0
- package/lib/typescript/src/components/surface/index.d.ts +30 -0
- package/lib/typescript/src/components/surface/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +7 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-breakpoint.d.ts +32 -0
- package/lib/typescript/src/hooks/use-breakpoint.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-copy-to-clipboard.d.ts +30 -0
- package/lib/typescript/src/hooks/use-copy-to-clipboard.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-debounced-value.d.ts +13 -0
- package/lib/typescript/src/hooks/use-debounced-value.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-disclosure.d.ts +32 -0
- package/lib/typescript/src/hooks/use-disclosure.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-keyboard.d.ts +20 -0
- package/lib/typescript/src/hooks/use-keyboard.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-previous.d.ts +15 -0
- package/lib/typescript/src/hooks/use-previous.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +8 -1
- package/src/components/scroll-fade/index.tsx +168 -0
- package/src/components/shimmer/index.tsx +135 -0
- package/src/components/surface/index.tsx +63 -0
- package/src/hooks/index.ts +19 -0
- package/src/hooks/use-breakpoint.ts +52 -0
- package/src/hooks/use-copy-to-clipboard.ts +81 -0
- package/src/hooks/use-debounced-value.ts +23 -0
- package/src/hooks/use-disclosure.ts +57 -0
- package/src/hooks/use-keyboard.ts +43 -0
- package/src/hooks/use-previous.ts +24 -0
- package/src/index.ts +9 -0
- package/theme.css +18 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The value from the previous render, or `undefined` on the first.
|
|
7
|
+
*
|
|
8
|
+
* Useful for reacting to a transition rather than a state — firing only when
|
|
9
|
+
* something *became* true.
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const wasOpen = usePrevious(isOpen);
|
|
13
|
+
* useEffect(() => {
|
|
14
|
+
* if (isOpen && !wasOpen) track('sheet_opened');
|
|
15
|
+
* }, [isOpen, wasOpen]);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export function usePrevious(value) {
|
|
19
|
+
const ref = useRef(undefined);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
ref.current = value;
|
|
22
|
+
}, [value]);
|
|
23
|
+
return ref.current;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=use-previous.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","usePrevious","value","ref","undefined","current"],"sourceRoot":"../../../src","sources":["hooks/use-previous.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAIC,KAAQ,EAAiB;EACtD,MAAMC,GAAG,GAAGH,MAAM,CAAgBI,SAAS,CAAC;EAE5CL,SAAS,CAAC,MAAM;IACdI,GAAG,CAACE,OAAO,GAAGH,KAAK;EACrB,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,OAAOC,GAAG,CAACE,OAAO;AACpB","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -31,9 +31,12 @@ export { InputGroup } from "./components/input-group/index.js";
|
|
|
31
31
|
export { Label } from "./components/label/index.js";
|
|
32
32
|
export { Progress } from "./components/progress/index.js";
|
|
33
33
|
export { RadioGroup } from "./components/radio-group/index.js";
|
|
34
|
+
export { ScrollFade } from "./components/scroll-fade/index.js";
|
|
35
|
+
export { Shimmer } from "./components/shimmer/index.js";
|
|
34
36
|
export { Skeleton } from "./components/skeleton/index.js";
|
|
35
37
|
export { Spinner } from "./components/spinner/index.js";
|
|
36
38
|
export { Steps } from "./components/steps/index.js";
|
|
39
|
+
export { Surface } from "./components/surface/index.js";
|
|
37
40
|
export { Switch } from "./components/switch/index.js";
|
|
38
41
|
export { Timeline } from "./components/timeline/index.js";
|
|
39
42
|
export { Toast, ToastViewport, toast, useToast } from "./components/toast/index.js";
|
|
@@ -42,6 +45,9 @@ export { Typography } from "./components/typography/index.js";
|
|
|
42
45
|
// Icons
|
|
43
46
|
export { AlertTriangleIcon, AppleIcon, ArrowUpRightIcon, BellIcon, CardIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, FacebookIcon, GoogleIcon, IconColorProvider, InfoIcon, MoonIcon, PackageIcon, PlusSquareIcon, ReceiptIcon, SearchIcon, SendIcon, ShareNodesIcon, ShieldAlertIcon, ShieldCheckIcon, SunIcon, XIcon, useIconColor } from "./icons/index.js";
|
|
44
47
|
|
|
48
|
+
// Hooks
|
|
49
|
+
export * from "./hooks/index.js";
|
|
50
|
+
|
|
45
51
|
// Utils
|
|
46
52
|
export { cn } from "./utils/cn.js";
|
|
47
53
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PanelUIProvider","useTheme","useThemeMode","PANEL_THEMES","PANEL_THEME_NAMES","PANEL_EXTRA_THEMES","Portal","PortalHost","PortalProvider","Text","AnimatedPressable","Accordion","Alert","Avatar","Badge","BottomSheet","Button","Dialog","Frame","InlineSelect","Select","Tabs","Card","Checkbox","EmptyState","Input","InputGroup","Label","Progress","RadioGroup","Skeleton","Spinner","Steps","Switch","Timeline","Toast","ToastViewport","toast","useToast","Typography","AlertTriangleIcon","AppleIcon","ArrowUpRightIcon","BellIcon","CardIcon","CheckCircleIcon","CheckIcon","ChevronDownIcon","ChevronLeftIcon","ChevronRightIcon","FacebookIcon","GoogleIcon","IconColorProvider","InfoIcon","MoonIcon","PackageIcon","PlusSquareIcon","ReceiptIcon","SearchIcon","SendIcon","ShareNodesIcon","ShieldAlertIcon","ShieldCheckIcon","SunIcon","XIcon","useIconColor","cn"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA,SAASA,eAAe,QAAmC,kCAA+B;;AAE1F;AACA,SACEC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,iBAAiB,EACjBC,kBAAkB,QAKb,sBAAmB;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VC,iBAAiB,EACjBC,QAAQ,EACRC,QAAQ,EACRC,WAAW,EACXC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,QAAQ,EACRC,cAAc,EACdC,eAAe,EACfC,eAAe,EACfC,OAAO,EACPC,KAAK,EACLC,YAAY,QAEP,kBAAS;;AAEhB;AACA,SAASC,EAAE,QAAQ,eAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["PanelUIProvider","useTheme","useThemeMode","PANEL_THEMES","PANEL_THEME_NAMES","PANEL_EXTRA_THEMES","Portal","PortalHost","PortalProvider","Text","AnimatedPressable","Accordion","Alert","Avatar","Badge","BottomSheet","Button","Dialog","Frame","InlineSelect","Select","Tabs","Card","Checkbox","EmptyState","Input","InputGroup","Label","Progress","RadioGroup","ScrollFade","Shimmer","Skeleton","Spinner","Steps","Surface","Switch","Timeline","Toast","ToastViewport","toast","useToast","Typography","AlertTriangleIcon","AppleIcon","ArrowUpRightIcon","BellIcon","CardIcon","CheckCircleIcon","CheckIcon","ChevronDownIcon","ChevronLeftIcon","ChevronRightIcon","FacebookIcon","GoogleIcon","IconColorProvider","InfoIcon","MoonIcon","PackageIcon","PlusSquareIcon","ReceiptIcon","SearchIcon","SendIcon","ShareNodesIcon","ShieldAlertIcon","ShieldCheckIcon","SunIcon","XIcon","useIconColor","cn"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA,SAASA,eAAe,QAAmC,kCAA+B;;AAE1F;AACA,SACEC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,iBAAiB,EACjBC,kBAAkB,QAKb,sBAAmB;;AAE1B;AACA,SAASC,MAAM,EAAEC,UAAU,EAAEC,cAAc,QAAQ,wBAAqB;AACxE,SAASC,IAAI,QAAwB,sBAAmB;AACxD,SACEC,iBAAiB,QAEZ,oCAAiC;;AAExC;AACA,SACEC,SAAS,QAQJ,iCAAwB;AAC/B,SACEC,KAAK,QAGA,6BAAoB;AAC3B,SACEC,MAAM,QAGD,8BAAqB;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AAO,EACPC,KAAK,EACLC,YAAY,QAEP,kBAAS;;AAEhB;AACA,cAAc,kBAAS;;AAEvB;AACA,SAASC,EAAE,QAAQ,eAAY","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ScrollFade — fades the edges of a scroll container.
|
|
3
|
+
*
|
|
4
|
+
* The React Native equivalent of shadcn-ui/ui's `scroll-fade` utility
|
|
5
|
+
* (https://ui.shadcn.com/docs/utils/scroll-fade), which is CSS `mask-image`
|
|
6
|
+
* driven by a scroll timeline. React Native has neither masks nor scroll
|
|
7
|
+
* timelines, so the fades are SVG gradients overlaid on each edge, with their
|
|
8
|
+
* opacity following the scroll position.
|
|
9
|
+
*
|
|
10
|
+
* Composition follows heroui-native's ScrollShadow: wrap the scrollable and
|
|
11
|
+
* let the orientation be inferred from its `horizontal` prop.
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <ScrollFade>
|
|
15
|
+
* <ScrollView horizontal>…</ScrollView>
|
|
16
|
+
* </ScrollFade>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import { type ReactNode } from 'react';
|
|
20
|
+
import { type ViewProps } from 'react-native';
|
|
21
|
+
export interface ScrollFadeProps extends ViewProps {
|
|
22
|
+
className?: string;
|
|
23
|
+
/** Depth of the fade in pixels. */
|
|
24
|
+
size?: number;
|
|
25
|
+
/** Which edges fade. */
|
|
26
|
+
edges?: 'both' | 'start' | 'end';
|
|
27
|
+
/**
|
|
28
|
+
* Colour the fade resolves to — normally whatever sits behind the
|
|
29
|
+
* scrollable. Defaults to the theme's background.
|
|
30
|
+
*/
|
|
31
|
+
color?: string;
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export declare function ScrollFade({ className, size, edges, color, children, ...props }: ScrollFadeProps): import("react").JSX.Element;
|
|
35
|
+
export declare namespace ScrollFade {
|
|
36
|
+
var displayName: string;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/scroll-fade/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAOtB,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAQD,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,IAAS,EACT,KAAc,EACd,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,+BA4DjB;yBAnEe,UAAU"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shimmer — an animated highlight sweeping across content.
|
|
3
|
+
*
|
|
4
|
+
* The React Native equivalent of shadcn-ui/ui's `shimmer` utility
|
|
5
|
+
* (https://ui.shadcn.com/docs/utils/shimmer). That one is CSS:
|
|
6
|
+
* `background-clip: text` with a `color-mix()` highlight. React Native has
|
|
7
|
+
* neither, so the highlight is drawn as an SVG gradient band swept across an
|
|
8
|
+
* overlay by Reanimated, on the UI thread.
|
|
9
|
+
*
|
|
10
|
+
* The visible difference: the band passes *over* the content rather than
|
|
11
|
+
* being clipped to glyph shapes. On body-sized text the two read the same; on
|
|
12
|
+
* very large text the web version is crisper.
|
|
13
|
+
*
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Shimmer>
|
|
16
|
+
* <Text muted>Generating response…</Text>
|
|
17
|
+
* </Shimmer>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import { type ReactNode } from 'react';
|
|
21
|
+
import { type ViewProps } from 'react-native';
|
|
22
|
+
export interface ShimmerProps extends ViewProps {
|
|
23
|
+
className?: string;
|
|
24
|
+
/** Milliseconds for one sweep. */
|
|
25
|
+
duration?: number;
|
|
26
|
+
/** Sweep once instead of looping. */
|
|
27
|
+
once?: boolean;
|
|
28
|
+
/** Sweep right-to-left. */
|
|
29
|
+
reverse?: boolean;
|
|
30
|
+
/** Width of the highlight band, as a fraction of the content width. */
|
|
31
|
+
spread?: number;
|
|
32
|
+
/** Highlight colour. Defaults to the theme's foreground. */
|
|
33
|
+
color?: string;
|
|
34
|
+
/** Peak opacity of the highlight. */
|
|
35
|
+
intensity?: number;
|
|
36
|
+
children?: ReactNode;
|
|
37
|
+
}
|
|
38
|
+
export declare function Shimmer({ className, duration, once, reverse, spread, color, intensity, children, ...props }: ShimmerProps): import("react").JSX.Element;
|
|
39
|
+
export declare namespace Shimmer {
|
|
40
|
+
var displayName: string;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/shimmer/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAc5E,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2BAA2B;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,OAAO,CAAC,EACtB,SAAS,EACT,QAAe,EACf,IAAY,EACZ,OAAe,EACf,MAAY,EACZ,KAAK,EACL,SAAgB,EAChB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,YAAY,+BAuEd;yBAjFe,OAAO"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { View, type ViewProps } from 'react-native';
|
|
2
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
3
|
+
declare const surfaceVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
variant: {
|
|
5
|
+
default: string;
|
|
6
|
+
secondary: string;
|
|
7
|
+
tertiary: string;
|
|
8
|
+
transparent: string;
|
|
9
|
+
};
|
|
10
|
+
}, undefined, "overflow-hidden rounded-3xl p-4", {
|
|
11
|
+
variant: {
|
|
12
|
+
default: string;
|
|
13
|
+
secondary: string;
|
|
14
|
+
tertiary: string;
|
|
15
|
+
transparent: string;
|
|
16
|
+
};
|
|
17
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
18
|
+
variant: {
|
|
19
|
+
default: string;
|
|
20
|
+
secondary: string;
|
|
21
|
+
tertiary: string;
|
|
22
|
+
transparent: string;
|
|
23
|
+
};
|
|
24
|
+
}, undefined, "overflow-hidden rounded-3xl p-4", unknown, unknown, undefined>>;
|
|
25
|
+
export interface SurfaceProps extends ViewProps, VariantProps<typeof surfaceVariants> {
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const Surface: import("react").ForwardRefExoticComponent<SurfaceProps & import("react").RefAttributes<View>>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/surface/index.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAc,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;8EAanB,CAAC;AAEH,MAAM,WAAW,YACf,SAAQ,SAAS,EACf,YAAY,CAAC,OAAO,eAAe,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,OAAO,+FAYnB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { useCopyToClipboard, type UseCopyToClipboardOptions, type UseCopyToClipboardResult, } from './use-copy-to-clipboard.js';
|
|
2
|
+
export { useDisclosure, type UseDisclosureOptions, type UseDisclosureResult, } from './use-disclosure.js';
|
|
3
|
+
export { useBreakpoint, BREAKPOINTS, type Breakpoint, type UseBreakpointResult, } from './use-breakpoint.js';
|
|
4
|
+
export { useKeyboard, type UseKeyboardResult } from './use-keyboard.js';
|
|
5
|
+
export { useDebouncedValue } from './use-debounced-value.js';
|
|
6
|
+
export { usePrevious } from './use-previous.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,4BAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,qBAAkB,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,WAAW,EACX,KAAK,UAAU,EACf,KAAK,mBAAmB,GACzB,MAAM,qBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAgB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAAuB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAgB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Tailwind's breakpoints, minus the ones no phone or tablet reaches. */
|
|
2
|
+
export declare const BREAKPOINTS: {
|
|
3
|
+
readonly sm: 640;
|
|
4
|
+
readonly md: 768;
|
|
5
|
+
readonly lg: 1024;
|
|
6
|
+
readonly xl: 1280;
|
|
7
|
+
};
|
|
8
|
+
export type Breakpoint = keyof typeof BREAKPOINTS;
|
|
9
|
+
export interface UseBreakpointResult {
|
|
10
|
+
/** Largest breakpoint the window currently satisfies, or `base`. */
|
|
11
|
+
current: Breakpoint | 'base';
|
|
12
|
+
/** True when the window is at least this wide. */
|
|
13
|
+
isAtLeast: (breakpoint: Breakpoint) => boolean;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
isLandscape: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Responsive state from the window size — the React Native answer to
|
|
20
|
+
* coss.com/ui's `useMediaQuery`, which has no equivalent here.
|
|
21
|
+
*
|
|
22
|
+
* For styling, prefer Uniwind's responsive class prefixes (`md:flex-row`).
|
|
23
|
+
* Reach for this when the *behaviour* changes, not just the look — rendering
|
|
24
|
+
* a sheet on a phone and a dialog on a tablet, say.
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const { isAtLeast } = useBreakpoint();
|
|
28
|
+
* return isAtLeast('md') ? <Dialog …/> : <BottomSheet …/>;
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useBreakpoint(): UseBreakpointResult;
|
|
32
|
+
//# sourceMappingURL=use-breakpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-breakpoint.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-breakpoint.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,eAAO,MAAM,WAAW;;;;;CAAoD,CAAC;AAE7E,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,WAAW,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,OAAO,EAAE,UAAU,GAAG,MAAM,CAAC;IAC7B,kDAAkD;IAClD,SAAS,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,OAAO,CAAC;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,IAAI,mBAAmB,CAqBnD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface UseCopyToClipboardOptions {
|
|
2
|
+
/** Milliseconds before `copied` flips back. */
|
|
3
|
+
timeout?: number;
|
|
4
|
+
onCopy?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export interface UseCopyToClipboardResult {
|
|
7
|
+
/** Writes `value` to the clipboard and sets `copied`. */
|
|
8
|
+
copy: (value: string) => Promise<void>;
|
|
9
|
+
copied: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Copy text to the clipboard, with a temporary "copied" state.
|
|
13
|
+
*
|
|
14
|
+
* Mirrors coss.com/ui's `useCopyToClipboard`.
|
|
15
|
+
*
|
|
16
|
+
* Requires `expo-clipboard`, which is an optional peer dependency — React
|
|
17
|
+
* Native removed `Clipboard` from core, and pulling in a required native
|
|
18
|
+
* module for one hook would cost every consumer who never calls it:
|
|
19
|
+
*
|
|
20
|
+
* ```sh
|
|
21
|
+
* npx expo install expo-clipboard
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const { copy, copied } = useCopyToClipboard();
|
|
26
|
+
* <Button onPress={() => copy(url)}>{copied ? 'Copied' : 'Copy link'}</Button>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function useCopyToClipboard({ timeout, onCopy, }?: UseCopyToClipboardOptions): UseCopyToClipboardResult;
|
|
30
|
+
//# sourceMappingURL=use-copy-to-clipboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-copy-to-clipboard.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-copy-to-clipboard.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,yBAAyB;IACxC,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,yDAAyD;IACzD,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,OAAc,EACd,MAAM,GACP,GAAE,yBAA8B,GAAG,wBAAwB,CA6B3D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A copy of `value` that only updates once it has stopped changing for
|
|
3
|
+
* `delay` ms — for search fields, where you want the typed value on screen
|
|
4
|
+
* immediately but the query fired once.
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const [query, setQuery] = useState('');
|
|
8
|
+
* const debounced = useDebouncedValue(query, 300);
|
|
9
|
+
* useEffect(() => { search(debounced); }, [debounced]);
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function useDebouncedValue<T>(value: T, delay?: number): T;
|
|
13
|
+
//# sourceMappingURL=use-debounced-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-debounced-value.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-debounced-value.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,SAAM,GAAG,CAAC,CAS7D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface UseDisclosureOptions {
|
|
2
|
+
defaultOpen?: boolean;
|
|
3
|
+
/** Controlled open state. Pass this to drive it from outside. */
|
|
4
|
+
open?: boolean;
|
|
5
|
+
onOpenChange?: (open: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface UseDisclosureResult {
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
open: () => void;
|
|
10
|
+
close: () => void;
|
|
11
|
+
toggle: () => void;
|
|
12
|
+
/** Spread onto Dialog, BottomSheet or Select. */
|
|
13
|
+
props: {
|
|
14
|
+
open: boolean;
|
|
15
|
+
onOpenChange: (open: boolean) => void;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Open/closed state for an overlay.
|
|
20
|
+
*
|
|
21
|
+
* The same controlled-or-uncontrolled pattern Dialog, BottomSheet and Select
|
|
22
|
+
* implement internally, lifted out for when you need to drive one from
|
|
23
|
+
* elsewhere — closing a sheet after a request settles, say.
|
|
24
|
+
*
|
|
25
|
+
* ```tsx
|
|
26
|
+
* const sheet = useDisclosure();
|
|
27
|
+
* <Button onPress={sheet.open}>Share</Button>
|
|
28
|
+
* <BottomSheet {...sheet.props}>…</BottomSheet>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useDisclosure({ defaultOpen, open: controlledOpen, onOpenChange, }?: UseDisclosureOptions): UseDisclosureResult;
|
|
32
|
+
//# sourceMappingURL=use-disclosure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-disclosure.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-disclosure.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iEAAiE;IACjE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,iDAAiD;IACjD,KAAK,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;KAAE,CAAC;CACjE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,EAC5B,WAAmB,EACnB,IAAI,EAAE,cAAc,EACpB,YAAY,GACb,GAAE,oBAAyB,GAAG,mBAAmB,CAqBjD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface UseKeyboardResult {
|
|
2
|
+
/** Height of the keyboard in px, or 0 when hidden. */
|
|
3
|
+
height: number;
|
|
4
|
+
isVisible: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Keyboard height and visibility, on the JS thread.
|
|
8
|
+
*
|
|
9
|
+
* Use this when the value drives rendering — showing a hint, swapping a
|
|
10
|
+
* layout. For *animating* against the keyboard, use Reanimated's
|
|
11
|
+
* `useAnimatedKeyboard` instead: it runs on the UI thread and tracks the
|
|
12
|
+
* keyboard frame-for-frame, where this fires once per show/hide.
|
|
13
|
+
*
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const { isVisible } = useKeyboard();
|
|
16
|
+
* {isVisible ? null : <Footer />}
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function useKeyboard(): UseKeyboardResult;
|
|
20
|
+
//# sourceMappingURL=use-keyboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-keyboard.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-keyboard.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,IAAI,iBAAiB,CAoB/C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The value from the previous render, or `undefined` on the first.
|
|
3
|
+
*
|
|
4
|
+
* Useful for reacting to a transition rather than a state — firing only when
|
|
5
|
+
* something *became* true.
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const wasOpen = usePrevious(isOpen);
|
|
9
|
+
* useEffect(() => {
|
|
10
|
+
* if (isOpen && !wasOpen) track('sheet_opened');
|
|
11
|
+
* }, [isOpen, wasOpen]);
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function usePrevious<T>(value: T): T | undefined;
|
|
15
|
+
//# sourceMappingURL=use-previous.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-previous.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-previous.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAQtD"}
|
|
@@ -22,13 +22,17 @@ export { InputGroup, type InputGroupProps, type InputGroupInputProps, type Input
|
|
|
22
22
|
export { Label, type LabelProps, type LabelTextProps } from './components/label/index.js';
|
|
23
23
|
export { Progress, type ProgressProps } from './components/progress/index.js';
|
|
24
24
|
export { RadioGroup, type RadioGroupProps, type RadioGroupItemProps, } from './components/radio-group/index.js';
|
|
25
|
+
export { ScrollFade, type ScrollFadeProps, } from './components/scroll-fade/index.js';
|
|
26
|
+
export { Shimmer, type ShimmerProps } from './components/shimmer/index.js';
|
|
25
27
|
export { Skeleton, type SkeletonProps } from './components/skeleton/index.js';
|
|
26
28
|
export { Spinner, type SpinnerProps } from './components/spinner/index.js';
|
|
27
29
|
export { Steps, type StepsProps, type StepsItemProps, type StepsTriggerProps, type StepsIndicatorProps, type StepsSeparatorProps, type StepState, type StepsOrientation, } from './components/steps/index.js';
|
|
30
|
+
export { Surface, type SurfaceProps } from './components/surface/index.js';
|
|
28
31
|
export { Switch, type SwitchProps } from './components/switch/index.js';
|
|
29
32
|
export { Timeline, type TimelineProps, type TimelineItemProps, type TimelineIndicatorProps, type TimelineStatProps, type TimelineVariant, type TimelineTone, } from './components/timeline/index.js';
|
|
30
33
|
export { Toast, ToastViewport, toast, useToast, type ToastProps, type ToastOptions, type ToastItem, type ToastVariant, type ToastPlacement, type ToastHandle, type ToastIndicatorProps, type ToastCloseProps, } from './components/toast/index.js';
|
|
31
34
|
export { Typography, type TypographyProps, type TypographyType, type TypographyHeadingProps, type TypographyParagraphProps, type TypographyCodeProps, } from './components/typography/index.js';
|
|
32
35
|
export { AlertTriangleIcon, AppleIcon, ArrowUpRightIcon, BellIcon, CardIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, FacebookIcon, GoogleIcon, IconColorProvider, InfoIcon, MoonIcon, PackageIcon, PlusSquareIcon, ReceiptIcon, SearchIcon, SendIcon, ShareNodesIcon, ShieldAlertIcon, ShieldCheckIcon, SunIcon, XIcon, useIconColor, type IconProps, } from './icons/index.js';
|
|
36
|
+
export * from './hooks/index.js';
|
|
33
37
|
export { cn } from './utils/cn.js';
|
|
34
38
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,kCAA+B,CAAC;AAG3F,OAAO,EACL,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B,CAAC;AAC/D,OAAO,EACL,QAAQ,EACR,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,YAAY,GAClB,MAAM,gCAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,EACL,aAAa,EACb,KAAK,EACL,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,eAAe,GACrB,MAAM,6BAAoB,CAAC;AAC5B,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,GACzB,MAAM,kCAAyB,CAAC;AAGjC,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,SAAS,EACT,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EACf,eAAe,EACf,OAAO,EACP,KAAK,EACL,YAAY,EACZ,KAAK,SAAS,GACf,MAAM,kBAAS,CAAC;AAGjB,OAAO,EAAE,EAAE,EAAE,MAAM,eAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,kCAA+B,CAAC;AAG3F,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,UA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AK,YAAY,EAAE,MAAM,+BAAsB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,8BAAqB,CAAC;AAC/D,OAAO,EACL,QAAQ,EACR,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,YAAY,GAClB,MAAM,gCAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,EACL,aAAa,EACb,KAAK,EACL,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,eAAe,GACrB,MAAM,6BAAoB,CAAC;AAC5B,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,GACzB,MAAM,kCAAyB,CAAC;AAGjC,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,SAAS,EACT,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EACf,eAAe,EACf,OAAO,EACP,KAAK,EACL,YAAY,EACZ,KAAK,SAAS,GACf,MAAM,kBAAS,CAAC;AAGjB,cAAc,kBAAS,CAAC;AAGxB,OAAO,EAAE,EAAE,EAAE,MAAM,eAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "panelui-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "High-performance React Native UI components for Expo. Coss UI design language, powered by Uniwind (Tailwind v4) and Reanimated.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
@@ -64,11 +64,13 @@
|
|
|
64
64
|
"license": "MIT",
|
|
65
65
|
"homepage": "https://github.com/panel-ui/PanelUI#readme",
|
|
66
66
|
"peerDependencies": {
|
|
67
|
+
"expo-clipboard": ">=7.0.0",
|
|
67
68
|
"react": "*",
|
|
68
69
|
"react-native": "*",
|
|
69
70
|
"react-native-gesture-handler": ">=2.0.0",
|
|
70
71
|
"react-native-reanimated": ">=3.0.0",
|
|
71
72
|
"react-native-safe-area-context": ">=4.0.0",
|
|
73
|
+
"react-native-svg": ">=15.0.0",
|
|
72
74
|
"tailwindcss": ">=4.0.0",
|
|
73
75
|
"uniwind": ">=1.0.0"
|
|
74
76
|
},
|
|
@@ -92,5 +94,10 @@
|
|
|
92
94
|
],
|
|
93
95
|
"typescript"
|
|
94
96
|
]
|
|
97
|
+
},
|
|
98
|
+
"peerDependenciesMeta": {
|
|
99
|
+
"expo-clipboard": {
|
|
100
|
+
"optional": true
|
|
101
|
+
}
|
|
95
102
|
}
|
|
96
103
|
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ScrollFade — fades the edges of a scroll container.
|
|
3
|
+
*
|
|
4
|
+
* The React Native equivalent of shadcn-ui/ui's `scroll-fade` utility
|
|
5
|
+
* (https://ui.shadcn.com/docs/utils/scroll-fade), which is CSS `mask-image`
|
|
6
|
+
* driven by a scroll timeline. React Native has neither masks nor scroll
|
|
7
|
+
* timelines, so the fades are SVG gradients overlaid on each edge, with their
|
|
8
|
+
* opacity following the scroll position.
|
|
9
|
+
*
|
|
10
|
+
* Composition follows heroui-native's ScrollShadow: wrap the scrollable and
|
|
11
|
+
* let the orientation be inferred from its `horizontal` prop.
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <ScrollFade>
|
|
15
|
+
* <ScrollView horizontal>…</ScrollView>
|
|
16
|
+
* </ScrollFade>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import {
|
|
20
|
+
Children,
|
|
21
|
+
cloneElement,
|
|
22
|
+
isValidElement,
|
|
23
|
+
useState,
|
|
24
|
+
type ReactElement,
|
|
25
|
+
type ReactNode,
|
|
26
|
+
} from 'react';
|
|
27
|
+
import {
|
|
28
|
+
View,
|
|
29
|
+
type NativeScrollEvent,
|
|
30
|
+
type NativeSyntheticEvent,
|
|
31
|
+
type ViewProps,
|
|
32
|
+
} from 'react-native';
|
|
33
|
+
import Svg, { Defs, LinearGradient, Rect, Stop } from 'react-native-svg';
|
|
34
|
+
import { useCSSVariable } from 'uniwind';
|
|
35
|
+
|
|
36
|
+
/** Past this many pixels from an edge, that edge's fade is fully shown. */
|
|
37
|
+
const FADE_IN_DISTANCE = 24;
|
|
38
|
+
|
|
39
|
+
export interface ScrollFadeProps extends ViewProps {
|
|
40
|
+
className?: string;
|
|
41
|
+
/** Depth of the fade in pixels. */
|
|
42
|
+
size?: number;
|
|
43
|
+
/** Which edges fade. */
|
|
44
|
+
edges?: 'both' | 'start' | 'end';
|
|
45
|
+
/**
|
|
46
|
+
* Colour the fade resolves to — normally whatever sits behind the
|
|
47
|
+
* scrollable. Defaults to the theme's background.
|
|
48
|
+
*/
|
|
49
|
+
color?: string;
|
|
50
|
+
children?: ReactNode;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface ScrollableProps {
|
|
54
|
+
horizontal?: boolean;
|
|
55
|
+
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
56
|
+
scrollEventThrottle?: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function ScrollFade({
|
|
60
|
+
className,
|
|
61
|
+
size = 48,
|
|
62
|
+
edges = 'both',
|
|
63
|
+
color,
|
|
64
|
+
children,
|
|
65
|
+
...props
|
|
66
|
+
}: ScrollFadeProps) {
|
|
67
|
+
const [startOpacity, setStartOpacity] = useState(0);
|
|
68
|
+
const [endOpacity, setEndOpacity] = useState(0);
|
|
69
|
+
|
|
70
|
+
const themeBackground = useCSSVariable('--color-background');
|
|
71
|
+
const fadeColor =
|
|
72
|
+
color ?? (typeof themeBackground === 'string' ? themeBackground : '#000000');
|
|
73
|
+
|
|
74
|
+
const child = Children.only(children) as ReactElement<ScrollableProps>;
|
|
75
|
+
const horizontal = isValidElement(child) ? !!child.props.horizontal : false;
|
|
76
|
+
|
|
77
|
+
const handleScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
78
|
+
const { contentOffset, contentSize, layoutMeasurement } = event.nativeEvent;
|
|
79
|
+
const offset = horizontal ? contentOffset.x : contentOffset.y;
|
|
80
|
+
const total = horizontal ? contentSize.width : contentSize.height;
|
|
81
|
+
const visible = horizontal ? layoutMeasurement.width : layoutMeasurement.height;
|
|
82
|
+
const remaining = total - visible - offset;
|
|
83
|
+
|
|
84
|
+
// Each edge fades in over the first FADE_IN_DISTANCE px of travel, so an
|
|
85
|
+
// edge with nothing past it shows nothing.
|
|
86
|
+
setStartOpacity(Math.min(offset / FADE_IN_DISTANCE, 1));
|
|
87
|
+
setEndOpacity(Math.min(Math.max(remaining, 0) / FADE_IN_DISTANCE, 1));
|
|
88
|
+
|
|
89
|
+
child.props.onScroll?.(event);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const scrollable = isValidElement(child)
|
|
93
|
+
? cloneElement(child, {
|
|
94
|
+
onScroll: handleScroll,
|
|
95
|
+
scrollEventThrottle: child.props.scrollEventThrottle ?? 16,
|
|
96
|
+
})
|
|
97
|
+
: child;
|
|
98
|
+
|
|
99
|
+
const showStart = edges !== 'end';
|
|
100
|
+
const showEnd = edges !== 'start';
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<View {...props} className={className}>
|
|
104
|
+
{scrollable}
|
|
105
|
+
|
|
106
|
+
{showStart ? (
|
|
107
|
+
<Fade
|
|
108
|
+
color={fadeColor}
|
|
109
|
+
size={size}
|
|
110
|
+
horizontal={horizontal}
|
|
111
|
+
opacity={startOpacity}
|
|
112
|
+
edge="start"
|
|
113
|
+
/>
|
|
114
|
+
) : null}
|
|
115
|
+
{showEnd ? (
|
|
116
|
+
<Fade
|
|
117
|
+
color={fadeColor}
|
|
118
|
+
size={size}
|
|
119
|
+
horizontal={horizontal}
|
|
120
|
+
opacity={endOpacity}
|
|
121
|
+
edge="end"
|
|
122
|
+
/>
|
|
123
|
+
) : null}
|
|
124
|
+
</View>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
ScrollFade.displayName = 'ScrollFade';
|
|
129
|
+
|
|
130
|
+
/** One edge's gradient, opaque at the edge and clear inwards. */
|
|
131
|
+
function Fade({
|
|
132
|
+
color,
|
|
133
|
+
size,
|
|
134
|
+
horizontal,
|
|
135
|
+
opacity,
|
|
136
|
+
edge,
|
|
137
|
+
}: {
|
|
138
|
+
color: string;
|
|
139
|
+
size: number;
|
|
140
|
+
horizontal: boolean;
|
|
141
|
+
opacity: number;
|
|
142
|
+
edge: 'start' | 'end';
|
|
143
|
+
}) {
|
|
144
|
+
const isStart = edge === 'start';
|
|
145
|
+
const id = `scroll-fade-${edge}-${horizontal ? 'x' : 'y'}`;
|
|
146
|
+
|
|
147
|
+
const position = horizontal
|
|
148
|
+
? { top: 0, bottom: 0, width: size, ...(isStart ? { left: 0 } : { right: 0 }) }
|
|
149
|
+
: { left: 0, right: 0, height: size, ...(isStart ? { top: 0 } : { bottom: 0 }) };
|
|
150
|
+
|
|
151
|
+
// The gradient runs from the screen edge inwards, so it is reversed on the
|
|
152
|
+
// end edge.
|
|
153
|
+
const [x2, y2] = horizontal ? [1, 0] : [0, 1];
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<View pointerEvents="none" style={{ position: 'absolute', opacity, ...position }}>
|
|
157
|
+
<Svg width="100%" height="100%">
|
|
158
|
+
<Defs>
|
|
159
|
+
<LinearGradient id={id} x1="0" y1="0" x2={String(x2)} y2={String(y2)}>
|
|
160
|
+
<Stop offset="0" stopColor={color} stopOpacity={isStart ? 1 : 0} />
|
|
161
|
+
<Stop offset="1" stopColor={color} stopOpacity={isStart ? 0 : 1} />
|
|
162
|
+
</LinearGradient>
|
|
163
|
+
</Defs>
|
|
164
|
+
<Rect x="0" y="0" width="100%" height="100%" fill={`url(#${id})`} />
|
|
165
|
+
</Svg>
|
|
166
|
+
</View>
|
|
167
|
+
);
|
|
168
|
+
}
|