@impulse-ui-native/data-state 2.0.0 → 2.0.1

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.
Files changed (2) hide show
  1. package/README.md +46 -0
  2. package/package.json +8 -8
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # @impulse-ui-native/data-state
2
+
3
+ Reusable loading, empty, error, and content-state composition for data-backed screens.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ pnpm add @impulse-ui-native/data-state
9
+ ```
10
+
11
+ ## Main exports
12
+
13
+ - `LoadingView` swaps content for a caller-provided loading component.
14
+ - `EmptyView` renders empty-state copy and primary or secondary actions when `isEmpty` is true.
15
+ - `ErrorView` renders error-state copy and actions when an error is present.
16
+ - `DataView` coordinates loading, error, empty, and successful-content states in one component.
17
+ - Public prop types describe each state view and its action footer.
18
+
19
+ ## Usage
20
+
21
+ ```tsx
22
+ import { ActivityIndicator } from "react-native";
23
+
24
+ import { DataView } from "@impulse-ui-native/data-state";
25
+
26
+ <DataView
27
+ loading={query.isLoading}
28
+ error={query.error}
29
+ isEmpty={!query.data?.length}
30
+ LoadingComponent={ActivityIndicator}
31
+ errorViewProps={{
32
+ text: "Could not load projects.",
33
+ primaryActionLabel: "Try again",
34
+ onPressPrimaryAction: query.refetch,
35
+ }}
36
+ emptyViewProps={{
37
+ text: "No projects yet.",
38
+ primaryActionLabel: "Create project",
39
+ onPressPrimaryAction: openCreateProject,
40
+ }}
41
+ >
42
+ <ProjectList projects={query.data ?? []} />
43
+ </DataView>;
44
+ ```
45
+
46
+ The views use component tokens from `ThemeProvider` for their layout, layering, and presentation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impulse-ui-native/data-state",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "source": "src/index.ts",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.mts",
@@ -18,11 +18,11 @@
18
18
  "LICENSE"
19
19
  ],
20
20
  "dependencies": {
21
- "@impulse-ui-native/theme": "2.0.0",
22
- "@impulse-ui-native/core": "2.0.0",
23
- "@impulse-ui-native/primitives": "2.0.0",
24
- "@impulse-ui-native/skeleton": "2.0.0",
25
- "@impulse-ui-native/icon": "2.0.0"
21
+ "@impulse-ui-native/primitives": "2.0.1",
22
+ "@impulse-ui-native/theme": "2.0.1",
23
+ "@impulse-ui-native/icon": "2.0.1",
24
+ "@impulse-ui-native/skeleton": "2.0.1",
25
+ "@impulse-ui-native/core": "2.0.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/react": "~19.2.14",
@@ -34,8 +34,8 @@
34
34
  "react-native-worklets": "0.7.4",
35
35
  "typescript": "~5.9.2",
36
36
  "@impulse-ui-native/eslint-config": "1.0.0",
37
- "@impulse-ui-native/prettier-config": "1.0.0",
38
- "@impulse-ui-native/tsconfig": "1.0.0"
37
+ "@impulse-ui-native/tsconfig": "1.0.0",
38
+ "@impulse-ui-native/prettier-config": "1.0.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": ">=18",