react-native-unilist 0.2.0 → 2.0.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 +86 -128
- package/lib/module/UniList.js +191 -40
- package/lib/module/UniList.js.map +1 -1
- package/lib/module/components/Card.js +134 -47
- package/lib/module/components/Card.js.map +1 -1
- package/lib/module/components/Skeleton.js +92 -0
- package/lib/module/components/Skeleton.js.map +1 -0
- package/lib/module/components/SwipeableItem.js +106 -0
- package/lib/module/components/SwipeableItem.js.map +1 -0
- package/lib/module/components/layouts/CarouselLayout.js +3 -0
- package/lib/module/components/layouts/CarouselLayout.js.map +1 -1
- package/lib/module/components/layouts/GridLayout.js +3 -0
- package/lib/module/components/layouts/GridLayout.js.map +1 -1
- package/lib/module/components/layouts/MasonryLayout.js +3 -0
- package/lib/module/components/layouts/MasonryLayout.js.map +1 -1
- package/lib/module/hooks/usePagination.js +107 -69
- package/lib/module/hooks/usePagination.js.map +1 -1
- package/lib/module/hooks/useSearch.js +48 -75
- package/lib/module/hooks/useSearch.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/theme.js +44 -2
- package/lib/module/utils/theme.js.map +1 -1
- package/lib/typescript/src/UniList.d.ts +79 -17
- package/lib/typescript/src/UniList.d.ts.map +1 -1
- package/lib/typescript/src/components/Card.d.ts +39 -1
- package/lib/typescript/src/components/Card.d.ts.map +1 -1
- package/lib/typescript/src/components/Skeleton.d.ts +20 -0
- package/lib/typescript/src/components/Skeleton.d.ts.map +1 -0
- package/lib/typescript/src/components/SwipeableItem.d.ts +27 -0
- package/lib/typescript/src/components/SwipeableItem.d.ts.map +1 -0
- package/lib/typescript/src/components/layouts/CarouselLayout.d.ts +11 -0
- package/lib/typescript/src/components/layouts/CarouselLayout.d.ts.map +1 -1
- package/lib/typescript/src/components/layouts/GridLayout.d.ts +7 -0
- package/lib/typescript/src/components/layouts/GridLayout.d.ts.map +1 -1
- package/lib/typescript/src/components/layouts/MasonryLayout.d.ts +6 -0
- package/lib/typescript/src/components/layouts/MasonryLayout.d.ts.map +1 -1
- package/lib/typescript/src/hooks/usePagination.d.ts +32 -5
- package/lib/typescript/src/hooks/usePagination.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useSearch.d.ts +28 -3
- package/lib/typescript/src/hooks/useSearch.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/theme.d.ts +30 -0
- package/lib/typescript/src/utils/theme.d.ts.map +1 -1
- package/llms.txt +11 -0
- package/package.json +16 -7
|
@@ -1,34 +1,96 @@
|
|
|
1
|
-
import type { FlatListProps, ScrollViewProps, StyleProp, ViewStyle } from 'react-native';
|
|
2
1
|
import React, { type ReactElement, type ReactNode } from 'react';
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { type FlatListProps, type ScrollViewProps, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { type SwipeActions } from './components/SwipeableItem';
|
|
4
|
+
/** Visual treatment used by the built-in empty-list loading placeholders. */
|
|
5
|
+
export type SkeletonVariant = 'modern' | 'classic' | 'glass' | 'material' | 'minimal' | 'neumorphic';
|
|
6
|
+
/** A typed group for `UniList.sections`. @example `{ title: 'Today', data: messages }` */
|
|
7
|
+
export interface UniListSection<ItemT> {
|
|
8
|
+
/** Stable optional key for the section. */
|
|
9
|
+
key?: string;
|
|
10
|
+
/** Optional label available to `renderSectionHeader`. */
|
|
11
|
+
title?: string;
|
|
12
|
+
/** Items rendered within the section. */
|
|
13
|
+
data: readonly ItemT[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Props for {@link UniList}.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <UniList<User> data={users} keyExtractor={user => user.id}
|
|
21
|
+
* renderItem={user => <UserRow user={user} />} recycleItems />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export interface UniListProps<ItemT> extends Omit<FlatListProps<ItemT>, 'data' | 'renderItem' | 'horizontal' | 'contentContainerStyle' | 'ListEmptyComponent'>, Omit<ScrollViewProps, 'children' | 'horizontal' | 'contentContainerStyle'> {
|
|
25
|
+
/** Items to virtualize. Omit `data` to use ScrollView/children mode. */
|
|
26
|
+
data?: readonly ItemT[];
|
|
27
|
+
/** Typed sections select SectionList mode and support sticky headers. */
|
|
28
|
+
sections?: readonly UniListSection<ItemT>[];
|
|
29
|
+
/** Renders one typed list item. */
|
|
8
30
|
renderItem?: (item: ItemT, index: number) => ReactElement | null;
|
|
9
|
-
/**
|
|
31
|
+
/** Renders a section heading in `sections` mode. */
|
|
32
|
+
renderSectionHeader?: (section: UniListSection<ItemT>) => ReactElement | null;
|
|
33
|
+
/** Keeps section headers visible while vertically scrolling. */
|
|
34
|
+
stickySectionHeadersEnabled?: boolean;
|
|
35
|
+
/** Content for non-virtualized ScrollView mode. */
|
|
10
36
|
children?: ReactNode;
|
|
11
|
-
/**
|
|
37
|
+
/** Gap in points between adjacent cells. */
|
|
12
38
|
spacing?: number;
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
/**
|
|
39
|
+
/** Renders cells horizontally. Chat mode should remain vertical. */
|
|
40
|
+
horizontal?: boolean;
|
|
41
|
+
/** Content shown when the list is empty and not loading. */
|
|
42
|
+
ListEmptyComponent?: FlatListProps<ItemT>['ListEmptyComponent'];
|
|
43
|
+
/** Shows skeletons while an otherwise-empty list is loading. */
|
|
16
44
|
loading?: boolean;
|
|
17
|
-
/**
|
|
45
|
+
/** Number of skeleton cards shown during initial loading. */
|
|
46
|
+
skeletonCount?: number;
|
|
47
|
+
/** Skeleton visual treatment; choose the card style used by the screen. */
|
|
48
|
+
skeletonVariant?: SkeletonVariant;
|
|
49
|
+
/** Native React Native container style. */
|
|
18
50
|
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
51
|
+
/** NativeWind class forwarded to the native list/container. */
|
|
52
|
+
className?: string;
|
|
53
|
+
/** Enables FlatList clipped-cell windowing; this is not a native recycler. */
|
|
54
|
+
recycleItems?: boolean;
|
|
55
|
+
/** Opt-in native layout transition when the data array identity changes. */
|
|
56
|
+
animateLayout?: boolean;
|
|
57
|
+
/** Bottom-aligned, non-inverted mode for chat and streaming AI responses. */
|
|
58
|
+
chatMode?: boolean;
|
|
59
|
+
/** Called near the visual top in chat mode; prepend older items in chronological order. */
|
|
60
|
+
onLoadOlder?: () => void;
|
|
61
|
+
/** Called near the visual bottom in chat mode. */
|
|
62
|
+
onLoadNewer?: () => void;
|
|
63
|
+
/** Prevents duplicate top pagination callbacks while older items are loading. */
|
|
64
|
+
loadingOlder?: boolean;
|
|
65
|
+
/** Prevents duplicate bottom pagination callbacks while newer items are loading. */
|
|
66
|
+
loadingNewer?: boolean;
|
|
67
|
+
/** Typed leading/trailing swipe action configuration for every cell. */
|
|
68
|
+
swipeActions?: SwipeActions<ItemT>;
|
|
19
69
|
}
|
|
20
|
-
/** Imperative
|
|
70
|
+
/** Imperative controls exposed through `ref` on {@link UniList}. */
|
|
21
71
|
export interface UniListRef {
|
|
22
|
-
/**
|
|
72
|
+
/** Scrolls to a virtualized item index. */
|
|
23
73
|
scrollToIndex: (opts: {
|
|
24
74
|
index: number;
|
|
25
75
|
animated?: boolean;
|
|
26
76
|
}) => void;
|
|
27
|
-
/**
|
|
77
|
+
/** Scrolls to the start of either list mode. */
|
|
28
78
|
scrollToTop: (animated?: boolean) => void;
|
|
79
|
+
/** Scrolls to the end of either list mode. */
|
|
80
|
+
scrollToEnd: (animated?: boolean) => void;
|
|
29
81
|
}
|
|
30
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Typed React Native list for feeds, data grids, and non-inverted AI chat.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```tsx
|
|
87
|
+
* const ref = useRef<UniListRef>(null);
|
|
88
|
+
* <UniList<Message> ref={ref} chatMode data={messages}
|
|
89
|
+
* keyExtractor={message => message.id}
|
|
90
|
+
* renderItem={message => <Bubble message={message} />} />
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare const UniList: <ItemT>(props: UniListProps<ItemT> & {
|
|
31
94
|
ref?: React.Ref<UniListRef>;
|
|
32
95
|
}) => ReactElement;
|
|
33
|
-
export {};
|
|
34
96
|
//# sourceMappingURL=UniList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UniList.d.ts","sourceRoot":"","sources":["../../../src/UniList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"UniList.d.ts","sourceRoot":"","sources":["../../../src/UniList.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,22 +1,60 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
/** Built-in card surface variants. */
|
|
3
4
|
export type CardType = 'elevated' | 'outlined' | 'filled' | 'gradient' | 'glass';
|
|
5
|
+
/** Built-in card shape and shadow treatments. */
|
|
4
6
|
export type CardStyle = 'modern' | 'classic' | 'minimal' | 'material' | 'neumorphic';
|
|
7
|
+
/**
|
|
8
|
+
* Shared props for every card component.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <OutlinedCard title="Invoice" subtitle="Paid" onPress={openInvoice} />
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
5
15
|
export interface CardProps {
|
|
16
|
+
/** Surface variant. Wrapper components set this automatically. */
|
|
6
17
|
type?: CardType;
|
|
18
|
+
/** Shape/shadow recipe layered over the surface variant. */
|
|
7
19
|
cardStyle?: CardStyle;
|
|
20
|
+
/** Optional heading rendered above children. */
|
|
8
21
|
title?: string;
|
|
22
|
+
/** Optional secondary text rendered under the title. */
|
|
9
23
|
subtitle?: string;
|
|
24
|
+
/** Application-defined card body. */
|
|
10
25
|
children?: React.ReactNode;
|
|
26
|
+
/** Overrides the surface background color. */
|
|
11
27
|
backgroundColor?: string;
|
|
28
|
+
/** Overrides the surface border color. */
|
|
29
|
+
borderColor?: string;
|
|
30
|
+
/** Overrides the selected style's radius. */
|
|
12
31
|
borderRadius?: number;
|
|
32
|
+
/** Android elevation for elevated cards. */
|
|
13
33
|
elevation?: number;
|
|
34
|
+
/** Native React Native style override. */
|
|
14
35
|
style?: StyleProp<ViewStyle>;
|
|
36
|
+
/** Removes library chrome while retaining semantic card structure. */
|
|
37
|
+
headless?: boolean;
|
|
38
|
+
/** NativeWind class forwarded to the native card surface. */
|
|
39
|
+
className?: string;
|
|
40
|
+
/** Makes the card keyboard- and screen-reader-accessible as a button. */
|
|
15
41
|
onPress?: () => void;
|
|
16
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Raised general-purpose card.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <ElevatedCard title="Summary" cardStyle="material"><Text>42 tasks</Text></ElevatedCard>
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
17
51
|
export declare const ElevatedCard: React.FC<CardProps>;
|
|
52
|
+
/** Outlined card with a low-emphasis border. @example `<OutlinedCard title="Settings" />` */
|
|
18
53
|
export declare const OutlinedCard: React.FC<CardProps>;
|
|
54
|
+
/** Filled card for grouped or selected content. @example `<FilledCard title="Selected" />` */
|
|
19
55
|
export declare const FilledCard: React.FC<CardProps>;
|
|
56
|
+
/** Gradient-like dependency-free fallback. @example `<GradientCard title="Featured" />` */
|
|
20
57
|
export declare const GradientCard: React.FC<CardProps>;
|
|
58
|
+
/** Translucent glass-like card. @example `<GlassCard title="Now playing" />` */
|
|
21
59
|
export declare const GlassCard: React.FC<CardProps>;
|
|
22
60
|
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/components/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/components/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAqC,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEjG,sCAAsC;AACtC,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;AACjF,iDAAiD;AACjD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC;AAErF;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,kEAAkE;IAClE,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,8CAA8C;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAgBD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAiB5C,CAAC;AAEF,6FAA6F;AAC7F,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAAwD,CAAC;AACtG,8FAA8F;AAC9F,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAAsD,CAAC;AAClG,2FAA2F;AAC3F,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAAwD,CAAC;AACtG,gFAAgF;AAChF,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAAqD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import type { SkeletonVariant } from '../UniList';
|
|
4
|
+
/** Props for one animated loading placeholder. @example `<Skeleton variant="glass" />` */
|
|
5
|
+
export interface SkeletonProps {
|
|
6
|
+
/** Color treatment matching a card style. */
|
|
7
|
+
variant?: SkeletonVariant;
|
|
8
|
+
/** Native style override for one placeholder. */
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
10
|
+
/** NativeWind class forwarded to the animated surface. */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Animated, native-driver loading placeholder. @example `<Skeleton variant="material" />` */
|
|
14
|
+
export declare function Skeleton({ variant, style, className }: SkeletonProps): ReactElement;
|
|
15
|
+
/** Renders a vertical group of skeleton cards. @example `<SkeletonList count={3} variant="modern" />` */
|
|
16
|
+
export declare function SkeletonList({ count, variant }: {
|
|
17
|
+
count: number;
|
|
18
|
+
variant: SkeletonVariant;
|
|
19
|
+
}): ReactElement;
|
|
20
|
+
//# sourceMappingURL=Skeleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../../../src/components/Skeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAA8B,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,0FAA0F;AAC1F,MAAM,WAAW,aAAa;IAC5B,6CAA6C;IAC7C,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,iDAAiD;IACjD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD,8FAA8F;AAC9F,wBAAgB,QAAQ,CAAC,EAAE,OAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,aAAa,GAAG,YAAY,CAe9F;AAED,yGAAyG;AACzG,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,eAAe,CAAA;CAAE,GAAG,YAAY,CAE1G"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/** One typed action revealed by swiping a UniList cell. @example `{ label: 'Delete', onPress: item => remove(item.id) }` */
|
|
3
|
+
export interface SwipeAction<ItemT> {
|
|
4
|
+
/** Accessible visible label. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Underlay color; defaults to blue. */
|
|
7
|
+
color?: string;
|
|
8
|
+
/** Receives the exact item and index associated with the swiped row. */
|
|
9
|
+
onPress: (item: ItemT, index: number) => void;
|
|
10
|
+
}
|
|
11
|
+
/** Left/right swipe configuration passed to `UniList.swipeActions`. */
|
|
12
|
+
export interface SwipeActions<ItemT> {
|
|
13
|
+
/** Action revealed by a rightward swipe. */
|
|
14
|
+
left?: SwipeAction<ItemT>;
|
|
15
|
+
/** Action revealed by a leftward swipe. */
|
|
16
|
+
right?: SwipeAction<ItemT>;
|
|
17
|
+
/** Distance in points needed to trigger an action; default is 72. */
|
|
18
|
+
threshold?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Internal cell wrapper exported for custom composition. @example `<SwipeableItem item={task} index={0} actions={actions}><TaskRow /></SwipeableItem>` */
|
|
21
|
+
export declare function SwipeableItem<ItemT>({ item, index, actions, children }: {
|
|
22
|
+
item: ItemT;
|
|
23
|
+
index: number;
|
|
24
|
+
actions: SwipeActions<ItemT>;
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
//# sourceMappingURL=SwipeableItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwipeableItem.d.ts","sourceRoot":"","sources":["../../../../src/components/SwipeableItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAG/C,4HAA4H;AAC5H,MAAM,WAAW,WAAW,CAAC,KAAK;IAChC,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAED,uEAAuE;AACvE,MAAM,WAAW,YAAY,CAAC,KAAK;IACjC,4CAA4C;IAC5C,IAAI,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IAC1B,2CAA2C;IAC3C,KAAK,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IAC3B,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,2JAA2J;AAC3J,wBAAgB,aAAa,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAqB/J"}
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/** Props for {@link CarouselLayout}. @example `<CarouselLayout autoplay showDots>{slides}</CarouselLayout>` */
|
|
2
3
|
export interface CarouselLayoutProps {
|
|
4
|
+
/** Slide elements. */
|
|
3
5
|
children: React.ReactNode;
|
|
6
|
+
/** Advances the active slide indicator at the configured interval. */
|
|
4
7
|
autoplay?: boolean;
|
|
8
|
+
/** Autoplay delay in milliseconds. */
|
|
5
9
|
interval?: number;
|
|
10
|
+
/** Renders slide position dots below the carousel. */
|
|
6
11
|
showDots?: boolean;
|
|
12
|
+
/** Inactive dot color. */
|
|
7
13
|
dotColor?: string;
|
|
14
|
+
/** Active dot color. */
|
|
8
15
|
activeDotColor?: string;
|
|
16
|
+
/** Fixed slide width in points. */
|
|
9
17
|
itemWidth?: number;
|
|
18
|
+
/** Gap after each slide in points. */
|
|
10
19
|
spacing?: number;
|
|
20
|
+
/** Native style applied to the carousel container. */
|
|
11
21
|
style?: any;
|
|
12
22
|
}
|
|
23
|
+
/** Horizontal paged carousel. @example `<CarouselLayout itemWidth={280}>{banners}</CarouselLayout>` */
|
|
13
24
|
export declare const CarouselLayout: React.FC<CarouselLayoutProps>;
|
|
14
25
|
//# sourceMappingURL=CarouselLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselLayout.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/CarouselLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAgFxD,CAAC"}
|
|
1
|
+
{"version":3,"file":"CarouselLayout.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/CarouselLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,+GAA+G;AAC/G,MAAM,WAAW,mBAAmB;IAClC,sBAAsB;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAED,uGAAuG;AACvG,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAgFxD,CAAC"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ViewStyle, StyleProp } from 'react-native';
|
|
3
|
+
/** Props for {@link GridLayout}. @example `<GridLayout columns={2} spacing={12}>{cards}</GridLayout>` */
|
|
3
4
|
export interface GridLayoutProps {
|
|
5
|
+
/** Cells to place into grid rows. */
|
|
4
6
|
children: React.ReactNode;
|
|
7
|
+
/** Number of cells per row; use a positive integer. */
|
|
5
8
|
columns?: number;
|
|
9
|
+
/** Gap and outer padding in points. */
|
|
6
10
|
spacing?: number;
|
|
11
|
+
/** Optional width-to-height ratio applied to every cell. */
|
|
7
12
|
aspectRatio?: number;
|
|
13
|
+
/** Native style applied to the grid container. */
|
|
8
14
|
style?: StyleProp<ViewStyle>;
|
|
9
15
|
}
|
|
16
|
+
/** Simple responsive grid layout for a small static group of children. @example `<GridLayout columns={3}>{tiles}</GridLayout>` */
|
|
10
17
|
export declare const GridLayout: React.FC<GridLayoutProps>;
|
|
11
18
|
//# sourceMappingURL=GridLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridLayout.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/GridLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgDhD,CAAC"}
|
|
1
|
+
{"version":3,"file":"GridLayout.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/GridLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,yGAAyG;AACzG,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,kIAAkI;AAClI,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgDhD,CAAC"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/** Props for {@link MasonryLayout}. @example `<MasonryLayout columns={2}>{cards}</MasonryLayout>` */
|
|
2
3
|
export interface MasonryLayoutProps {
|
|
4
|
+
/** Card elements assigned across columns. */
|
|
3
5
|
children: React.ReactNode;
|
|
6
|
+
/** Number of visual columns. */
|
|
4
7
|
columns?: number;
|
|
8
|
+
/** Horizontal and vertical cell gap in points. */
|
|
5
9
|
spacing?: number;
|
|
10
|
+
/** Native style applied to the masonry container. */
|
|
6
11
|
style?: any;
|
|
7
12
|
}
|
|
13
|
+
/** Round-robin multi-column layout for static child collections. @example `<MasonryLayout>{items}</MasonryLayout>` */
|
|
8
14
|
export declare const MasonryLayout: React.FC<MasonryLayoutProps>;
|
|
9
15
|
//# sourceMappingURL=MasonryLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MasonryLayout.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/MasonryLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAkDtD,CAAC"}
|
|
1
|
+
{"version":3,"file":"MasonryLayout.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/MasonryLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,qGAAqG;AACrG,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAED,sHAAsH;AACtH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAkDtD,CAAC"}
|
|
@@ -1,23 +1,50 @@
|
|
|
1
|
+
/** Options for {@link usePagination}. @example `usePagination<Message>({ pageSize: 30, onLoadMore: fetchPage })` */
|
|
1
2
|
export interface PaginationOptions<T> {
|
|
3
|
+
/** Expected server page size; values below one are clamped to one. */
|
|
2
4
|
pageSize: number;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
/** Already-loaded first-page items. */
|
|
6
|
+
initialData?: readonly T[];
|
|
7
|
+
/** Receives the 1-based page to fetch and returns typed new items. */
|
|
8
|
+
onLoadMore?: (page: number) => Promise<readonly T[]>;
|
|
9
|
+
/** Receives normalized errors from load or refresh operations. */
|
|
5
10
|
onError?: (error: Error) => void;
|
|
6
11
|
}
|
|
12
|
+
/** Typed state returned by {@link usePagination}. */
|
|
7
13
|
export interface PaginationState<T> {
|
|
14
|
+
/** Loaded items in display order. */
|
|
8
15
|
data: T[];
|
|
16
|
+
/** True while a request is in flight. */
|
|
9
17
|
loading: boolean;
|
|
18
|
+
/** Most recent normalized error, if any. */
|
|
10
19
|
error: Error | null;
|
|
20
|
+
/** False after a short/empty page is received. */
|
|
11
21
|
hasMore: boolean;
|
|
22
|
+
/** Last successfully loaded 1-based page. */
|
|
12
23
|
currentPage: number;
|
|
24
|
+
/** Number of locally loaded pages. */
|
|
13
25
|
totalPages: number;
|
|
26
|
+
/** Number of locally loaded items. */
|
|
14
27
|
totalItems: number;
|
|
15
28
|
}
|
|
16
|
-
|
|
29
|
+
/** Operations returned by {@link usePagination}. */
|
|
30
|
+
export interface PaginationActions<T> {
|
|
31
|
+
/** Loads the next page; overlapping calls are ignored. */
|
|
17
32
|
loadMore: () => Promise<void>;
|
|
33
|
+
/** Reloads page one and replaces current data. */
|
|
18
34
|
refresh: () => Promise<void>;
|
|
35
|
+
/** Restores current `initialData`. */
|
|
19
36
|
reset: () => void;
|
|
20
|
-
|
|
37
|
+
/** Replaces data while preserving the generic item type. */
|
|
38
|
+
setData: (data: readonly T[]) => void;
|
|
21
39
|
}
|
|
22
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Serializes async pagination and preserves exact item types in all actions.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* const pager = usePagination<Product>({ pageSize: 20, onLoadMore: page => api.products(page) });
|
|
46
|
+
* <UniList data={pager.data} renderItem={renderProduct} onEndReached={pager.loadMore} />
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function usePagination<T>({ pageSize, initialData, onLoadMore, onError }: PaginationOptions<T>): PaginationState<T> & PaginationActions<T>;
|
|
23
50
|
//# sourceMappingURL=usePagination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePagination.d.ts","sourceRoot":"","sources":["../../../../src/hooks/usePagination.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"usePagination.d.ts","sourceRoot":"","sources":["../../../../src/hooks/usePagination.ts"],"names":[],"mappings":"AAEA,oHAAoH;AACpH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,WAAW,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC;IAC3B,sEAAsE;IACtE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACrD,kEAAkE;IAClE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,qDAAqD;AACrD,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,qCAAqC;IACrC,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,oDAAoD;AACpD,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,kDAAkD;IAClD,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,sCAAsC;IACtC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,4DAA4D;IAC5D,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,IAAI,CAAC;CACvC;AAID;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAgB,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CA+ErJ"}
|
|
@@ -1,20 +1,45 @@
|
|
|
1
|
+
/** Options for {@link useSearch}. @example `useSearch<Product>({ data: products, searchFields: ['name'] })` */
|
|
1
2
|
export interface SearchOptions<T> {
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
/** Source items; results recompute when this identity changes. */
|
|
4
|
+
data: readonly T[];
|
|
5
|
+
/** Typed item properties included in text matching. */
|
|
6
|
+
searchFields: readonly (keyof T)[];
|
|
7
|
+
/** Delay before applying a new query; defaults to 300 ms. */
|
|
4
8
|
debounceMs?: number;
|
|
9
|
+
/** Preserves letter case while matching. */
|
|
5
10
|
caseSensitive?: boolean;
|
|
11
|
+
/** Retained for v1 compatibility. Use highlightText while rendering instead of mutating T. */
|
|
6
12
|
highlightResults?: boolean;
|
|
7
13
|
}
|
|
14
|
+
/** Current typed search state returned by {@link useSearch}. */
|
|
8
15
|
export interface SearchState<T> {
|
|
16
|
+
/** The immediately entered query. */
|
|
9
17
|
query: string;
|
|
18
|
+
/** Filtered items after debounce completes. */
|
|
10
19
|
results: T[];
|
|
20
|
+
/** True while `query` is waiting for its debounce interval. */
|
|
11
21
|
loading: boolean;
|
|
22
|
+
/** Compatibility alias for unmodified `results`. */
|
|
12
23
|
highlightedResults: T[];
|
|
13
24
|
}
|
|
25
|
+
/** Imperative operations returned by {@link useSearch}. */
|
|
14
26
|
export interface SearchActions {
|
|
27
|
+
/** Sets a debounced query. */
|
|
15
28
|
setQuery: (query: string) => void;
|
|
29
|
+
/** Clears query and synchronously restores source items. */
|
|
16
30
|
clearSearch: () => void;
|
|
31
|
+
/** Alias for `setQuery`. */
|
|
17
32
|
search: (query: string) => void;
|
|
33
|
+
/** Returns markdown-marked text when `highlightResults` is enabled. */
|
|
34
|
+
highlightText: (text: string) => string;
|
|
18
35
|
}
|
|
19
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Type-safe debounced local search that never mutates source items.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* const { results, setQuery } = useSearch<User>({ data: users, searchFields: ['name', 'email'] });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function useSearch<T>({ data, searchFields, debounceMs, caseSensitive, highlightResults }: SearchOptions<T>): SearchState<T> & SearchActions;
|
|
20
45
|
//# sourceMappingURL=useSearch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSearch.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useSearch.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,IAAI,EAAE,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"useSearch.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useSearch.ts"],"names":[],"mappings":"AAEA,+GAA+G;AAC/G,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,kEAAkE;IAClE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC;IACnB,uDAAuD;IACvD,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IACnC,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,8FAA8F;IAC9F,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,gEAAgE;AAChE,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,+DAA+D;IAC/D,OAAO,EAAE,OAAO,CAAC;IACjB,oDAAoD;IACpD,kBAAkB,EAAE,CAAC,EAAE,CAAC;CACzB;AAED,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,8BAA8B;IAC9B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,4DAA4D;IAC5D,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,4BAA4B;IAC5B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,uEAAuE;IACvE,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACzC;AAID;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,UAAgB,EAAE,aAAqB,EAAE,gBAAwB,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,aAAa,CAsCxK"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { UniList, type UniListProps, type UniListRef } from './UniList';
|
|
1
|
+
export { UniList, type UniListProps, type UniListRef, type UniListSection, type SkeletonVariant } from './UniList';
|
|
2
|
+
export { Skeleton, SkeletonList, type SkeletonProps } from './components/Skeleton';
|
|
3
|
+
export { type SwipeAction, type SwipeActions } from './components/SwipeableItem';
|
|
2
4
|
export { ElevatedCard, OutlinedCard, FilledCard, GradientCard, GlassCard, type CardProps, type CardType, type CardStyle } from './components/Card';
|
|
3
5
|
export { GridLayout, type GridLayoutProps } from './components/layouts/GridLayout';
|
|
4
6
|
export { CarouselLayout, type CarouselLayoutProps } from './components/layouts/CarouselLayout';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AACnH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAGjF,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,SAAS,EACT,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,SAAS,EACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACrB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,EACzB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,EACxB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EACL,aAAa,EACb,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,YAAY,EACZ,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
/** Theme mode accepted by {@link ThemeManager.setThemeType}. */
|
|
1
2
|
export type ThemeType = 'light' | 'dark' | 'auto' | 'custom';
|
|
3
|
+
/** Built-in accent palette accepted by {@link ThemeManager.setThemeType}. */
|
|
2
4
|
export type ColorScheme = 'blue' | 'green' | 'purple' | 'orange' | 'red' | 'custom';
|
|
5
|
+
/** Semantic colors exposed by a UniList theme. */
|
|
3
6
|
export interface ThemeColors {
|
|
4
7
|
primary: string;
|
|
5
8
|
secondary: string;
|
|
@@ -14,6 +17,7 @@ export interface ThemeColors {
|
|
|
14
17
|
error: string;
|
|
15
18
|
info: string;
|
|
16
19
|
}
|
|
20
|
+
/** Complete theme token object returned by {@link useTheme}. */
|
|
17
21
|
export interface Theme {
|
|
18
22
|
type: ThemeType;
|
|
19
23
|
colors: ThemeColors;
|
|
@@ -54,20 +58,46 @@ export interface Theme {
|
|
|
54
58
|
};
|
|
55
59
|
};
|
|
56
60
|
}
|
|
61
|
+
/** Accent overrides keyed by {@link ColorScheme}. */
|
|
57
62
|
export declare const colorSchemes: Record<ColorScheme, Partial<ThemeColors>>;
|
|
63
|
+
/** Default light theme token set. */
|
|
58
64
|
export declare const lightTheme: Theme;
|
|
65
|
+
/** Default dark theme token set. */
|
|
59
66
|
export declare const darkTheme: Theme;
|
|
67
|
+
/**
|
|
68
|
+
* App-wide theme store with subscriptions used by {@link useTheme}.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* ThemeManager.getInstance().setThemeType('dark', 'purple');
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
60
75
|
export declare class ThemeManager {
|
|
61
76
|
private static instance;
|
|
62
77
|
private currentTheme;
|
|
63
78
|
private listeners;
|
|
79
|
+
/** Returns the shared manager instance. */
|
|
64
80
|
static getInstance(): ThemeManager;
|
|
81
|
+
/** Reads the active theme token object. */
|
|
65
82
|
getTheme(): Theme;
|
|
83
|
+
/** Replaces the active theme with a complete custom token object. */
|
|
66
84
|
setTheme(theme: Theme): void;
|
|
85
|
+
/** Selects a built-in mode and accent palette. */
|
|
67
86
|
setThemeType(type: ThemeType, colorScheme?: ColorScheme): void;
|
|
87
|
+
/** Merges custom semantic colors into the active theme. */
|
|
68
88
|
setCustomTheme(customColors: Partial<ThemeColors>): void;
|
|
89
|
+
/** Adds a listener and returns its unsubscribe function. */
|
|
69
90
|
subscribe(listener: (theme: Theme) => void): () => void;
|
|
70
91
|
private notifyListeners;
|
|
71
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* React hook that rerenders when the shared theme changes.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```tsx
|
|
98
|
+
* const theme = useTheme();
|
|
99
|
+
* return <Text style={{ color: theme.colors.text }}>Hello</Text>;
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
72
102
|
export declare const useTheme: () => Theme;
|
|
73
103
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/utils/theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/utils/theme.ts"],"names":[],"mappings":"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"}
|
package/llms.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# react-native-unilist v2
|
|
2
|
+
|
|
3
|
+
Use `UniList<T>` for a React Native virtualized list. Pass `data`, `keyExtractor`, and `renderItem(item, index)`. `data` selects FlatList mode; omit it for ScrollView mode.
|
|
4
|
+
|
|
5
|
+
Recommended pattern: use `<UniList<T> data={items} keyExtractor={item => item.id} renderItem={item => <Row item={item} />} />`; do not rely on the default index key for mutable data. `recycleItems` enables conservative FlatList windowing; it is not native view recycling. `chatMode` is a bottom-aligned non-inverted chat feed with `onLoadOlder`, `onLoadNewer`, `loadingOlder`, and `loadingNewer`. `loading` shows `SkeletonList` only while the list is empty. `skeletonVariant` is modern, classic, glass, material, minimal, or neumorphic. `swipeActions` accepts typed left/right actions. `animateLayout` requests native layout transitions.
|
|
6
|
+
|
|
7
|
+
Cards: ElevatedCard, OutlinedCard, FilledCard, GradientCard, GlassCard. All accept `className`, `headless`, `onPress`, `cardStyle`, and React Native `style`. GradientCard is dependency-free and uses a gradient-like fallback; use `headless` plus an app-owned gradient for a real gradient.
|
|
8
|
+
|
|
9
|
+
Hooks: `usePagination<T>({ pageSize, initialData, onLoadMore, onError })` and `useSearch<T>({ data, searchFields, debounceMs, caseSensitive, highlightResults })`. `useSearch` provides `highlightText` and never alters generic item values. For chat, prepend older messages in chronological order and immutably replace the final item for token streaming.
|
|
10
|
+
|
|
11
|
+
React 19+ and React Native 0.76+ are peer dependencies. Do not claim native recycler behavior, universal 60fps, or zero blank cells.
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-unilist",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Fabric-ready virtualized lists, AI chat feeds, cards, and utilities for React Native.",
|
|
5
5
|
"main": "lib/module/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
7
7
|
"types": "lib/typescript/src/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
|
-
"lib"
|
|
9
|
+
"lib",
|
|
10
|
+
"README.md",
|
|
11
|
+
"LICENSE",
|
|
12
|
+
"llms.txt"
|
|
10
13
|
],
|
|
14
|
+
"sideEffects": false,
|
|
11
15
|
"repository": {
|
|
12
16
|
"type": "git",
|
|
13
17
|
"url": "https://github.com/SamadK01/react-native-unilist.git"
|
|
@@ -22,18 +26,23 @@
|
|
|
22
26
|
"author": "SamadK01",
|
|
23
27
|
"license": "MIT",
|
|
24
28
|
"devDependencies": {
|
|
29
|
+
"@react-native/babel-preset": "^0.79.7",
|
|
30
|
+
"@types/jest": "^29.5.14",
|
|
31
|
+
"@types/react-test-renderer": "^19.0.0",
|
|
32
|
+
"jest": "^29.7.0",
|
|
25
33
|
"react-native-builder-bob": "^0.40.8",
|
|
34
|
+
"react-test-renderer": "19.0.0",
|
|
26
35
|
"typescript": "^5.8.3"
|
|
27
36
|
},
|
|
28
37
|
"peerDependencies": {
|
|
29
|
-
"react": "19.0.0",
|
|
30
|
-
"react-native": "
|
|
38
|
+
"react": ">=19.0.0",
|
|
39
|
+
"react-native": ">=0.76.0"
|
|
31
40
|
},
|
|
32
41
|
"scripts": {
|
|
33
42
|
"prepare": "bob build",
|
|
34
|
-
"lint": "
|
|
43
|
+
"lint": "tsc --noEmit",
|
|
35
44
|
"typecheck": "tsc --noEmit",
|
|
36
|
-
"test": "
|
|
45
|
+
"test": "jest --runInBand"
|
|
37
46
|
},
|
|
38
47
|
"react-native-builder-bob": {
|
|
39
48
|
"source": "src",
|