@impulse-ui-native/data-state 9.1.2 → 10.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 +6 -0
- package/dist/components/data-view.d.mts +1 -2
- package/dist/components/empty-details.d.mts +1 -2
- package/dist/components/empty-view.d.mts +1 -2
- package/dist/components/empty-view.js +2 -14
- package/dist/components/empty-view.js.map +1 -1
- package/dist/components/error-details.d.mts +1 -2
- package/dist/components/error-view.d.mts +1 -2
- package/dist/components/error-view.js +2 -14
- package/dist/components/error-view.js.map +1 -1
- package/dist/components/index.d.mts +0 -1
- package/dist/components/loading-view.d.mts +1 -2
- package/dist/components/state-actions-footer.d.mts +1 -2
- package/dist/components/state-view-container.d.mts +9 -0
- package/dist/components/state-view-container.js +14 -0
- package/dist/components/state-view-container.js.map +1 -0
- package/dist/index.d.mts +1 -2
- package/dist/types/index.d.mts +1 -1
- package/dist/types/state-view.types.d.mts +8 -9
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -17,6 +17,12 @@ Complete the Reanimated and Worklets setup required by your React Native or Expo
|
|
|
17
17
|
- `DataView` coordinates loading, error, empty, and successful-content states and renders the configured state copy and actions.
|
|
18
18
|
- Public prop types describe each state view and its action footer.
|
|
19
19
|
|
|
20
|
+
`EmptyView` and `ErrorView` always render their supplied children. Their only
|
|
21
|
+
container-specific option is `contentContainerStyle`, which styles the inner
|
|
22
|
+
content separately from the outer `style`. They accept native/themed View props
|
|
23
|
+
and children; text, action, `variant`, `isEmpty`, and `error` props are not part
|
|
24
|
+
of their API. Use `DataView` for automatic state selection and configured details.
|
|
25
|
+
|
|
20
26
|
## Usage
|
|
21
27
|
|
|
22
28
|
```tsx
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
3
|
import { DataViewProps } from '../types/state-view.types.mjs';
|
|
5
4
|
import 'react-native';
|
|
6
5
|
import '@impulse-ui-native/icon/types';
|
|
7
6
|
import '@impulse-ui-native/primitives';
|
|
8
7
|
|
|
9
|
-
declare const DataView: react.MemoExoticComponent<(props: PropsWithChildren<DataViewProps>) =>
|
|
8
|
+
declare const DataView: react.MemoExoticComponent<(props: PropsWithChildren<DataViewProps>) => react.JSX.Element>;
|
|
10
9
|
|
|
11
10
|
export { DataView };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { StateViewProps } from '../types/state-view.types.mjs';
|
|
4
3
|
import 'react-native';
|
|
5
4
|
import '@impulse-ui-native/icon/types';
|
|
6
5
|
import '@impulse-ui-native/primitives';
|
|
7
6
|
|
|
8
|
-
declare const EmptyDetails: react.MemoExoticComponent<(props: StateViewProps) =>
|
|
7
|
+
declare const EmptyDetails: react.MemoExoticComponent<(props: StateViewProps) => react.JSX.Element>;
|
|
9
8
|
|
|
10
9
|
export { EmptyDetails };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { EmptyViewProps } from '../types/state-view.types.mjs';
|
|
4
3
|
import 'react-native';
|
|
5
4
|
import '@impulse-ui-native/icon/types';
|
|
6
5
|
import '@impulse-ui-native/primitives';
|
|
7
6
|
|
|
8
|
-
declare const EmptyView: react.MemoExoticComponent<(props: EmptyViewProps) =>
|
|
7
|
+
declare const EmptyView: react.MemoExoticComponent<(props: EmptyViewProps) => react.JSX.Element>;
|
|
9
8
|
|
|
10
9
|
export { EmptyView };
|
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { StateViewContainer } from "./state-view-container";
|
|
4
4
|
const EmptyView = memo(function EmptyView2(props) {
|
|
5
|
-
|
|
6
|
-
variant,
|
|
7
|
-
text,
|
|
8
|
-
isEmpty,
|
|
9
|
-
onPressPrimaryAction,
|
|
10
|
-
primaryActionLabel,
|
|
11
|
-
onPressSecondaryAction,
|
|
12
|
-
secondaryActionLabel,
|
|
13
|
-
contentContainerStyle,
|
|
14
|
-
children,
|
|
15
|
-
...rest
|
|
16
|
-
} = props;
|
|
17
|
-
return /* @__PURE__ */ jsx(View, { ...rest, children: /* @__PURE__ */ jsx(View, { style: contentContainerStyle, children }) });
|
|
5
|
+
return /* @__PURE__ */ jsx(StateViewContainer, { ...props });
|
|
18
6
|
});
|
|
19
7
|
export {
|
|
20
8
|
EmptyView
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/empty-view.tsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/components/empty-view.tsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport type { EmptyViewProps } from \"../types\";\nimport { StateViewContainer } from \"./state-view-container\";\n\nexport const EmptyView = memo(function EmptyView(props: EmptyViewProps) {\n return <StateViewContainer {...props} />;\n});\n"],"mappings":"AAMS;AANT,SAAS,YAAY;AAGrB,SAAS,0BAA0B;AAE5B,MAAM,YAAY,KAAK,SAASA,WAAU,OAAuB;AACtE,SAAO,oBAAC,sBAAoB,GAAG,OAAO;AACxC,CAAC;","names":["EmptyView"]}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { StateViewProps } from '../types/state-view.types.mjs';
|
|
4
3
|
import 'react-native';
|
|
5
4
|
import '@impulse-ui-native/icon/types';
|
|
6
5
|
import '@impulse-ui-native/primitives';
|
|
7
6
|
|
|
8
|
-
declare const ErrorDetails: react.MemoExoticComponent<(props: StateViewProps) =>
|
|
7
|
+
declare const ErrorDetails: react.MemoExoticComponent<(props: StateViewProps) => react.JSX.Element>;
|
|
9
8
|
|
|
10
9
|
export { ErrorDetails };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { ErrorViewProps } from '../types/state-view.types.mjs';
|
|
4
3
|
import 'react-native';
|
|
5
4
|
import '@impulse-ui-native/icon/types';
|
|
6
5
|
import '@impulse-ui-native/primitives';
|
|
7
6
|
|
|
8
|
-
declare const ErrorView: react.MemoExoticComponent<(props: ErrorViewProps) =>
|
|
7
|
+
declare const ErrorView: react.MemoExoticComponent<(props: ErrorViewProps) => react.JSX.Element>;
|
|
9
8
|
|
|
10
9
|
export { ErrorView };
|
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { StateViewContainer } from "./state-view-container";
|
|
4
4
|
const ErrorView = memo(function ErrorView2(props) {
|
|
5
|
-
|
|
6
|
-
variant,
|
|
7
|
-
text,
|
|
8
|
-
error,
|
|
9
|
-
onPressPrimaryAction,
|
|
10
|
-
onPressSecondaryAction,
|
|
11
|
-
primaryActionLabel,
|
|
12
|
-
secondaryActionLabel,
|
|
13
|
-
contentContainerStyle,
|
|
14
|
-
children,
|
|
15
|
-
...rest
|
|
16
|
-
} = props;
|
|
17
|
-
return /* @__PURE__ */ jsx(View, { ...rest, children: /* @__PURE__ */ jsx(View, { style: contentContainerStyle, children }) });
|
|
5
|
+
return /* @__PURE__ */ jsx(StateViewContainer, { ...props });
|
|
18
6
|
});
|
|
19
7
|
export {
|
|
20
8
|
ErrorView
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/error-view.tsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/components/error-view.tsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport type { ErrorViewProps } from \"../types\";\nimport { StateViewContainer } from \"./state-view-container\";\n\nexport const ErrorView = memo(function ErrorView(props: ErrorViewProps) {\n return <StateViewContainer {...props} />;\n});\n"],"mappings":"AAMS;AANT,SAAS,YAAY;AAGrB,SAAS,0BAA0B;AAE5B,MAAM,YAAY,KAAK,SAASA,WAAU,OAAuB;AACtE,SAAO,oBAAC,sBAAoB,GAAG,OAAO;AACxC,CAAC;","names":["ErrorView"]}
|
|
@@ -4,7 +4,6 @@ export { LoadingView } from './loading-view.mjs';
|
|
|
4
4
|
export { DataView } from './data-view.mjs';
|
|
5
5
|
import '../types/state-view.types.mjs';
|
|
6
6
|
import 'react';
|
|
7
|
-
import 'react/jsx-runtime';
|
|
8
7
|
import 'react-native';
|
|
9
8
|
import '@impulse-ui-native/icon/types';
|
|
10
9
|
import '@impulse-ui-native/primitives';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { LoadingViewProps } from '../types/state-view.types.mjs';
|
|
4
3
|
import 'react-native';
|
|
5
4
|
import '@impulse-ui-native/icon/types';
|
|
6
5
|
import '@impulse-ui-native/primitives';
|
|
7
6
|
|
|
8
|
-
declare const LoadingView: react.MemoExoticComponent<(props: LoadingViewProps) =>
|
|
7
|
+
declare const LoadingView: react.MemoExoticComponent<(props: LoadingViewProps) => react.JSX.Element>;
|
|
9
8
|
|
|
10
9
|
export { LoadingView };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import { StateActionsFooterProps } from '../types/state-view.types.mjs';
|
|
4
3
|
import 'react-native';
|
|
5
4
|
import '@impulse-ui-native/icon/types';
|
|
6
5
|
import '@impulse-ui-native/primitives';
|
|
7
6
|
|
|
8
|
-
declare const StateActionsFooter: react.MemoExoticComponent<(props: StateActionsFooterProps) =>
|
|
7
|
+
declare const StateActionsFooter: react.MemoExoticComponent<(props: StateActionsFooterProps) => react.JSX.Element>;
|
|
9
8
|
|
|
10
9
|
export { StateActionsFooter };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { StateContainerProps } from '../types/state-view.types.mjs';
|
|
3
|
+
import 'react-native';
|
|
4
|
+
import '@impulse-ui-native/icon/types';
|
|
5
|
+
import '@impulse-ui-native/primitives';
|
|
6
|
+
|
|
7
|
+
declare const StateViewContainer: react.MemoExoticComponent<({ children, contentContainerStyle, ...props }: StateContainerProps) => react.JSX.Element>;
|
|
8
|
+
|
|
9
|
+
export { StateViewContainer };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { View } from "@impulse-ui-native/primitives";
|
|
4
|
+
const StateViewContainer = memo(function StateViewContainer2({
|
|
5
|
+
children,
|
|
6
|
+
contentContainerStyle,
|
|
7
|
+
...props
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ jsx(View, { ...props, children: /* @__PURE__ */ jsx(View, { style: contentContainerStyle, children }) });
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
StateViewContainer
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=state-view-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/state-view-container.tsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport { View } from \"@impulse-ui-native/primitives\";\n\nimport type { StateContainerProps } from \"../types\";\n\nexport const StateViewContainer = memo(function StateViewContainer({\n children,\n contentContainerStyle,\n ...props\n}: StateContainerProps) {\n return (\n <View {...props}>\n <View style={contentContainerStyle}>{children}</View>\n </View>\n );\n});\n"],"mappings":"AAaM;AAbN,SAAS,YAAY;AAErB,SAAS,YAAY;AAId,MAAM,qBAAqB,KAAK,SAASA,oBAAmB;AAAA,EACjE;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAwB;AACtB,SACE,oBAAC,QAAM,GAAG,OACR,8BAAC,QAAK,OAAO,uBAAwB,UAAS,GAChD;AAEJ,CAAC;","names":["StateViewContainer"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -2,9 +2,8 @@ export { ErrorView } from './components/error-view.mjs';
|
|
|
2
2
|
export { EmptyView } from './components/empty-view.mjs';
|
|
3
3
|
export { LoadingView } from './components/loading-view.mjs';
|
|
4
4
|
export { DataView } from './components/data-view.mjs';
|
|
5
|
-
export { DataViewProps, EmptyViewProps, ErrorViewProps, LoadingViewProps, StateActionsFooterProps, StateViewProps } from './types/state-view.types.mjs';
|
|
5
|
+
export { DataViewProps, EmptyViewProps, ErrorViewProps, LoadingViewProps, StateActionsFooterProps, StateContainerProps, StateViewProps } from './types/state-view.types.mjs';
|
|
6
6
|
import 'react';
|
|
7
|
-
import 'react/jsx-runtime';
|
|
8
7
|
import 'react-native';
|
|
9
8
|
import '@impulse-ui-native/icon/types';
|
|
10
9
|
import '@impulse-ui-native/primitives';
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DataViewProps, EmptyViewProps, ErrorViewProps, LoadingViewProps, StateActionsFooterProps, StateViewProps } from './state-view.types.mjs';
|
|
1
|
+
export { DataViewProps, EmptyViewProps, ErrorViewProps, LoadingViewProps, StateActionsFooterProps, StateContainerProps, StateViewProps } from './state-view.types.mjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
import 'react-native';
|
|
4
4
|
import '@impulse-ui-native/icon/types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ViewStyle, PressableProps } from 'react-native';
|
|
3
3
|
import { IconProps } from '@impulse-ui-native/icon/types';
|
|
4
4
|
import { ViewProps } from '@impulse-ui-native/primitives';
|
|
5
5
|
|
|
@@ -14,20 +14,19 @@ interface StateViewProps extends StateActionsFooterProps, ViewProps {
|
|
|
14
14
|
variant?: IconProps["variant"];
|
|
15
15
|
contentContainerStyle?: ViewStyle;
|
|
16
16
|
}
|
|
17
|
-
interface
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
interface ErrorViewProps extends StateViewProps {
|
|
21
|
-
error: Error | null;
|
|
17
|
+
interface StateContainerProps extends ViewProps {
|
|
18
|
+
contentContainerStyle?: ViewStyle;
|
|
22
19
|
}
|
|
20
|
+
type EmptyViewProps = StateContainerProps;
|
|
21
|
+
type ErrorViewProps = StateContainerProps;
|
|
23
22
|
interface LoadingViewProps extends ViewProps {
|
|
24
23
|
loading: boolean;
|
|
25
24
|
LoadingComponent: ComponentType;
|
|
26
25
|
contentContainerStyle?: ViewStyle;
|
|
27
26
|
}
|
|
28
27
|
interface DataViewProps extends ViewProps {
|
|
29
|
-
error:
|
|
30
|
-
isEmpty:
|
|
28
|
+
error: Error | null;
|
|
29
|
+
isEmpty: boolean;
|
|
31
30
|
LoadingComponent: ComponentType;
|
|
32
31
|
loading: LoadingViewProps["loading"];
|
|
33
32
|
contentContainerStyle?: ViewStyle;
|
|
@@ -35,4 +34,4 @@ interface DataViewProps extends ViewProps {
|
|
|
35
34
|
emptyViewProps: StateViewProps;
|
|
36
35
|
}
|
|
37
36
|
|
|
38
|
-
export type { DataViewProps, EmptyViewProps, ErrorViewProps, LoadingViewProps, StateActionsFooterProps, StateViewProps };
|
|
37
|
+
export type { DataViewProps, EmptyViewProps, ErrorViewProps, LoadingViewProps, StateActionsFooterProps, StateContainerProps, StateViewProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@impulse-ui-native/data-state",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Loading, empty, and error state components for ImpulseUI Native applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -28,23 +28,23 @@
|
|
|
28
28
|
],
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@impulse-ui-native/
|
|
32
|
-
"@impulse-ui-native/
|
|
33
|
-
"@impulse-ui-native/
|
|
34
|
-
"@impulse-ui-native/
|
|
35
|
-
"@impulse-ui-native/
|
|
31
|
+
"@impulse-ui-native/core": "10.0.0",
|
|
32
|
+
"@impulse-ui-native/skeleton": "10.0.0",
|
|
33
|
+
"@impulse-ui-native/icon": "10.0.0",
|
|
34
|
+
"@impulse-ui-native/theme": "10.0.0",
|
|
35
|
+
"@impulse-ui-native/primitives": "10.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@types/react": "~19.
|
|
38
|
+
"@types/react": "~19.3.0",
|
|
39
39
|
"eslint": "^9.38.0",
|
|
40
40
|
"prettier": "^3.6.2",
|
|
41
|
-
"react": "19.
|
|
42
|
-
"react-native": "0.
|
|
43
|
-
"react-native-reanimated": "4.
|
|
44
|
-
"react-native-worklets": "0.
|
|
41
|
+
"react": "19.3.0",
|
|
42
|
+
"react-native": "0.88.0",
|
|
43
|
+
"react-native-reanimated": "4.7.1",
|
|
44
|
+
"react-native-worklets": "0.13.0",
|
|
45
45
|
"typescript": "~6.0.3",
|
|
46
|
-
"@impulse-ui-native/eslint-config": "1.0.0",
|
|
47
46
|
"@impulse-ui-native/prettier-config": "1.0.0",
|
|
47
|
+
"@impulse-ui-native/eslint-config": "1.0.0",
|
|
48
48
|
"@impulse-ui-native/tsconfig": "1.0.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|