@impulse-ui-native/primitives 2.6.0 → 2.8.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 +51 -3
- package/dist/components/atoms/avatar.d.mts +10 -0
- package/dist/components/atoms/avatar.js +161 -0
- package/dist/components/atoms/avatar.js.map +1 -0
- package/dist/components/atoms/button.d.mts +1 -1
- package/dist/components/atoms/button.js +26 -5
- package/dist/components/atoms/button.js.map +1 -1
- package/dist/components/atoms/circular-progress.d.mts +16 -0
- package/dist/components/atoms/circular-progress.js +144 -0
- package/dist/components/atoms/circular-progress.js.map +1 -0
- package/dist/components/atoms/divider.d.mts +10 -0
- package/dist/components/atoms/divider.js +48 -0
- package/dist/components/atoms/divider.js.map +1 -0
- package/dist/components/atoms/icon-button.d.mts +1 -1
- package/dist/components/atoms/icon-button.js +22 -1
- package/dist/components/atoms/icon-button.js.map +1 -1
- package/dist/components/atoms/index.d.mts +11 -2
- package/dist/components/atoms/index.js +8 -0
- package/dist/components/atoms/index.js.map +1 -1
- package/dist/components/atoms/linear-progress.d.mts +17 -0
- package/dist/components/atoms/linear-progress.js +97 -0
- package/dist/components/atoms/linear-progress.js.map +1 -0
- package/dist/components/atoms/pressable.d.mts +4 -4
- package/dist/components/atoms/pressable.js +48 -43
- package/dist/components/atoms/pressable.js.map +1 -1
- package/dist/components/atoms/progress.d.mts +9 -0
- package/dist/components/atoms/progress.js +94 -0
- package/dist/components/atoms/progress.js.map +1 -0
- package/dist/components/atoms/spinner.d.mts +9 -0
- package/dist/components/atoms/spinner.js +74 -0
- package/dist/components/atoms/spinner.js.map +1 -0
- package/dist/components/card/card.d.mts +17 -0
- package/dist/components/card/card.js +18 -0
- package/dist/components/card/card.js.map +1 -0
- package/dist/components/card/content.d.mts +10 -0
- package/dist/components/card/content.js +27 -0
- package/dist/components/card/content.js.map +1 -0
- package/dist/components/card/footer.d.mts +10 -0
- package/dist/components/card/footer.js +27 -0
- package/dist/components/card/footer.js.map +1 -0
- package/dist/components/card/header.d.mts +10 -0
- package/dist/components/card/header.js +27 -0
- package/dist/components/card/header.js.map +1 -0
- package/dist/components/card/index.d.mts +7 -0
- package/dist/components/card/index.js +5 -0
- package/dist/components/card/index.js.map +1 -0
- package/dist/components/card/media.d.mts +10 -0
- package/dist/components/card/media.js +32 -0
- package/dist/components/card/media.js.map +1 -0
- package/dist/components/card/pressable.d.mts +10 -0
- package/dist/components/card/pressable.js +45 -0
- package/dist/components/card/pressable.js.map +1 -0
- package/dist/components/card/root.d.mts +10 -0
- package/dist/components/card/root.js +21 -0
- package/dist/components/card/root.js.map +1 -0
- package/dist/components/card/root.styles.d.mts +13 -0
- package/dist/components/card/root.styles.js +17 -0
- package/dist/components/card/root.styles.js.map +1 -0
- package/dist/components/controls/addon.d.mts +1 -0
- package/dist/components/controls/container.d.mts +1 -0
- package/dist/components/controls/control.d.mts +3 -2
- package/dist/components/controls/error.d.mts +1 -0
- package/dist/components/controls/index.d.mts +1 -0
- package/dist/components/controls/input.d.mts +1 -0
- package/dist/components/controls/label.d.mts +1 -0
- package/dist/components/controls/loader.d.mts +7 -1
- package/dist/components/controls/loader.js +3 -3
- package/dist/components/controls/loader.js.map +1 -1
- package/dist/components/controls/placeholder.d.mts +1 -0
- package/dist/components/controls/provider.d.mts +1 -0
- package/dist/components/controls/value.d.mts +1 -0
- package/dist/components/index.d.mts +13 -3
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/use-indeterminate-progress-animation.hook.d.mts +5 -0
- package/dist/hooks/use-indeterminate-progress-animation.hook.js +47 -0
- package/dist/hooks/use-indeterminate-progress-animation.hook.js.map +1 -0
- package/dist/index.d.mts +11 -1
- package/dist/types/avatar.types.d.mts +20 -0
- package/dist/types/avatar.types.js +1 -0
- package/dist/types/avatar.types.js.map +1 -0
- package/dist/types/card.types.d.mts +21 -0
- package/dist/types/card.types.js +1 -0
- package/dist/types/card.types.js.map +1 -0
- package/dist/types/control-components.types.d.mts +3 -2
- package/dist/types/divider.types.d.mts +14 -0
- package/dist/types/divider.types.js +1 -0
- package/dist/types/divider.types.js.map +1 -0
- package/dist/types/index.d.mts +6 -1
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/progress.types.d.mts +15 -0
- package/dist/types/progress.types.js +1 -0
- package/dist/types/progress.types.js.map +1 -0
- package/dist/types/spinner.types.d.mts +9 -0
- package/dist/types/spinner.types.js +1 -0
- package/dist/types/spinner.types.js.map +1 -0
- package/dist/utils/progress.utils.d.mts +9 -0
- package/dist/utils/progress.utils.js +27 -0
- package/dist/utils/progress.utils.js.map +1 -0
- package/package.json +8 -6
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { CardContentProps } from '../../types/card.types.mjs';
|
|
4
|
+
import 'react-native';
|
|
5
|
+
import '@impulse-ui-native/theme';
|
|
6
|
+
import '../../types/view.types.mjs';
|
|
7
|
+
|
|
8
|
+
declare const CardContent: react.MemoExoticComponent<({ style, ...props }: CardContentProps) => react_jsx_runtime.JSX.Element>;
|
|
9
|
+
|
|
10
|
+
export { CardContent };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { useComponentsTokens, useStyleProps } from "@impulse-ui-native/theme";
|
|
4
|
+
import { View } from "../atoms/view";
|
|
5
|
+
const CardContent = memo(function CardContent2({
|
|
6
|
+
style,
|
|
7
|
+
...props
|
|
8
|
+
}) {
|
|
9
|
+
const tokens = useComponentsTokens().card.content;
|
|
10
|
+
const extractedStyleProps = useStyleProps(props);
|
|
11
|
+
const contentStyle = useMemo(
|
|
12
|
+
() => [
|
|
13
|
+
{
|
|
14
|
+
gap: tokens.gap,
|
|
15
|
+
padding: tokens.padding
|
|
16
|
+
},
|
|
17
|
+
extractedStyleProps,
|
|
18
|
+
style
|
|
19
|
+
],
|
|
20
|
+
[extractedStyleProps, style, tokens]
|
|
21
|
+
);
|
|
22
|
+
return /* @__PURE__ */ jsx(View, { ...props, style: contentStyle });
|
|
23
|
+
});
|
|
24
|
+
export {
|
|
25
|
+
CardContent
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/card/content.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\n\nimport { useComponentsTokens, useStyleProps } from \"@impulse-ui-native/theme\";\n\nimport type { CardContentProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\n\nexport const CardContent = memo(function CardContent({\n style,\n ...props\n}: CardContentProps) {\n const tokens = useComponentsTokens().card.content;\n const extractedStyleProps = useStyleProps(props);\n const contentStyle = useMemo(\n () => [\n {\n gap: tokens.gap,\n padding: tokens.padding,\n },\n extractedStyleProps,\n style,\n ],\n [extractedStyleProps, style, tokens],\n );\n\n return <View {...props} style={contentStyle} />;\n});\n"],"mappings":"AAyBS;AAzBT,SAAS,MAAM,eAAe;AAE9B,SAAS,qBAAqB,qBAAqB;AAGnD,SAAS,YAAY;AAEd,MAAM,cAAc,KAAK,SAASA,aAAY;AAAA,EACnD;AAAA,EACA,GAAG;AACL,GAAqB;AACnB,QAAM,SAAS,oBAAoB,EAAE,KAAK;AAC1C,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,eAAe;AAAA,IACnB,MAAM;AAAA,MACJ;AAAA,QACE,KAAK,OAAO;AAAA,QACZ,SAAS,OAAO;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,qBAAqB,OAAO,MAAM;AAAA,EACrC;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,cAAc;AAC/C,CAAC;","names":["CardContent"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { CardFooterProps } from '../../types/card.types.mjs';
|
|
4
|
+
import 'react-native';
|
|
5
|
+
import '@impulse-ui-native/theme';
|
|
6
|
+
import '../../types/view.types.mjs';
|
|
7
|
+
|
|
8
|
+
declare const CardFooter: react.MemoExoticComponent<({ style, ...props }: CardFooterProps) => react_jsx_runtime.JSX.Element>;
|
|
9
|
+
|
|
10
|
+
export { CardFooter };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { useComponentsTokens, useStyleProps } from "@impulse-ui-native/theme";
|
|
4
|
+
import { View } from "../atoms/view";
|
|
5
|
+
const CardFooter = memo(function CardFooter2({
|
|
6
|
+
style,
|
|
7
|
+
...props
|
|
8
|
+
}) {
|
|
9
|
+
const tokens = useComponentsTokens().card.footer;
|
|
10
|
+
const extractedStyleProps = useStyleProps(props);
|
|
11
|
+
const footerStyle = useMemo(
|
|
12
|
+
() => [
|
|
13
|
+
{
|
|
14
|
+
gap: tokens.gap,
|
|
15
|
+
padding: tokens.padding
|
|
16
|
+
},
|
|
17
|
+
extractedStyleProps,
|
|
18
|
+
style
|
|
19
|
+
],
|
|
20
|
+
[extractedStyleProps, style, tokens]
|
|
21
|
+
);
|
|
22
|
+
return /* @__PURE__ */ jsx(View, { ...props, style: footerStyle });
|
|
23
|
+
});
|
|
24
|
+
export {
|
|
25
|
+
CardFooter
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=footer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/card/footer.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\n\nimport { useComponentsTokens, useStyleProps } from \"@impulse-ui-native/theme\";\n\nimport type { CardFooterProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\n\nexport const CardFooter = memo(function CardFooter({\n style,\n ...props\n}: CardFooterProps) {\n const tokens = useComponentsTokens().card.footer;\n const extractedStyleProps = useStyleProps(props);\n const footerStyle = useMemo(\n () => [\n {\n gap: tokens.gap,\n padding: tokens.padding,\n },\n extractedStyleProps,\n style,\n ],\n [extractedStyleProps, style, tokens],\n );\n\n return <View {...props} style={footerStyle} />;\n});\n"],"mappings":"AAyBS;AAzBT,SAAS,MAAM,eAAe;AAE9B,SAAS,qBAAqB,qBAAqB;AAGnD,SAAS,YAAY;AAEd,MAAM,aAAa,KAAK,SAASA,YAAW;AAAA,EACjD;AAAA,EACA,GAAG;AACL,GAAoB;AAClB,QAAM,SAAS,oBAAoB,EAAE,KAAK;AAC1C,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,cAAc;AAAA,IAClB,MAAM;AAAA,MACJ;AAAA,QACE,KAAK,OAAO;AAAA,QACZ,SAAS,OAAO;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,qBAAqB,OAAO,MAAM;AAAA,EACrC;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,aAAa;AAC9C,CAAC;","names":["CardFooter"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { CardHeaderProps } from '../../types/card.types.mjs';
|
|
4
|
+
import 'react-native';
|
|
5
|
+
import '@impulse-ui-native/theme';
|
|
6
|
+
import '../../types/view.types.mjs';
|
|
7
|
+
|
|
8
|
+
declare const CardHeader: react.MemoExoticComponent<({ style, ...props }: CardHeaderProps) => react_jsx_runtime.JSX.Element>;
|
|
9
|
+
|
|
10
|
+
export { CardHeader };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { useComponentsTokens, useStyleProps } from "@impulse-ui-native/theme";
|
|
4
|
+
import { View } from "../atoms/view";
|
|
5
|
+
const CardHeader = memo(function CardHeader2({
|
|
6
|
+
style,
|
|
7
|
+
...props
|
|
8
|
+
}) {
|
|
9
|
+
const tokens = useComponentsTokens().card.header;
|
|
10
|
+
const extractedStyleProps = useStyleProps(props);
|
|
11
|
+
const headerStyle = useMemo(
|
|
12
|
+
() => [
|
|
13
|
+
{
|
|
14
|
+
gap: tokens.gap,
|
|
15
|
+
padding: tokens.padding
|
|
16
|
+
},
|
|
17
|
+
extractedStyleProps,
|
|
18
|
+
style
|
|
19
|
+
],
|
|
20
|
+
[extractedStyleProps, style, tokens]
|
|
21
|
+
);
|
|
22
|
+
return /* @__PURE__ */ jsx(View, { ...props, style: headerStyle });
|
|
23
|
+
});
|
|
24
|
+
export {
|
|
25
|
+
CardHeader
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/card/header.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\n\nimport { useComponentsTokens, useStyleProps } from \"@impulse-ui-native/theme\";\n\nimport type { CardHeaderProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\n\nexport const CardHeader = memo(function CardHeader({\n style,\n ...props\n}: CardHeaderProps) {\n const tokens = useComponentsTokens().card.header;\n const extractedStyleProps = useStyleProps(props);\n const headerStyle = useMemo(\n () => [\n {\n gap: tokens.gap,\n padding: tokens.padding,\n },\n extractedStyleProps,\n style,\n ],\n [extractedStyleProps, style, tokens],\n );\n\n return <View {...props} style={headerStyle} />;\n});\n"],"mappings":"AAyBS;AAzBT,SAAS,MAAM,eAAe;AAE9B,SAAS,qBAAqB,qBAAqB;AAGnD,SAAS,YAAY;AAEd,MAAM,aAAa,KAAK,SAASA,YAAW;AAAA,EACjD;AAAA,EACA,GAAG;AACL,GAAoB;AAClB,QAAM,SAAS,oBAAoB,EAAE,KAAK;AAC1C,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,cAAc;AAAA,IAClB,MAAM;AAAA,MACJ;AAAA,QACE,KAAK,OAAO;AAAA,QACZ,SAAS,OAAO;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,qBAAqB,OAAO,MAAM;AAAA,EACrC;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,aAAa;AAC9C,CAAC;","names":["CardHeader"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/card/index.ts"],"sourcesContent":["export { Card } from \"./card\";\n"],"mappings":"AAAA,SAAS,YAAY;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { CardMediaProps } from '../../types/card.types.mjs';
|
|
4
|
+
import 'react-native';
|
|
5
|
+
import '@impulse-ui-native/theme';
|
|
6
|
+
import '../../types/view.types.mjs';
|
|
7
|
+
|
|
8
|
+
declare const CardMedia: react.MemoExoticComponent<({ style, ...props }: CardMediaProps) => react_jsx_runtime.JSX.Element>;
|
|
9
|
+
|
|
10
|
+
export { CardMedia };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import { useComponentsTokens, useStyleProps } from "@impulse-ui-native/theme";
|
|
5
|
+
import { View } from "../atoms/view";
|
|
6
|
+
const CardMedia = memo(function CardMedia2({
|
|
7
|
+
style,
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
const tokens = useComponentsTokens().card;
|
|
11
|
+
const extractedStyleProps = useStyleProps(props);
|
|
12
|
+
const mediaStyle = useMemo(
|
|
13
|
+
() => [
|
|
14
|
+
styles.media,
|
|
15
|
+
{ backgroundColor: tokens.mediaBackgroundColor },
|
|
16
|
+
extractedStyleProps,
|
|
17
|
+
style
|
|
18
|
+
],
|
|
19
|
+
[extractedStyleProps, style, tokens.mediaBackgroundColor]
|
|
20
|
+
);
|
|
21
|
+
return /* @__PURE__ */ jsx(View, { ...props, style: mediaStyle });
|
|
22
|
+
});
|
|
23
|
+
const styles = StyleSheet.create({
|
|
24
|
+
media: {
|
|
25
|
+
overflow: "hidden",
|
|
26
|
+
width: "100%"
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
export {
|
|
30
|
+
CardMedia
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/card/media.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport { useComponentsTokens, useStyleProps } from \"@impulse-ui-native/theme\";\n\nimport type { CardMediaProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\n\nexport const CardMedia = memo(function CardMedia({\n style,\n ...props\n}: CardMediaProps) {\n const tokens = useComponentsTokens().card;\n const extractedStyleProps = useStyleProps(props);\n const mediaStyle = useMemo(\n () => [\n styles.media,\n { backgroundColor: tokens.mediaBackgroundColor },\n extractedStyleProps,\n style,\n ],\n [extractedStyleProps, style, tokens.mediaBackgroundColor],\n );\n\n return <View {...props} style={mediaStyle} />;\n});\n\nconst styles = StyleSheet.create({\n media: {\n overflow: \"hidden\",\n width: \"100%\",\n },\n});\n"],"mappings":"AAwBS;AAxBT,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAE3B,SAAS,qBAAqB,qBAAqB;AAGnD,SAAS,YAAY;AAEd,MAAM,YAAY,KAAK,SAASA,WAAU;AAAA,EAC/C;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,QAAM,SAAS,oBAAoB,EAAE;AACrC,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,aAAa;AAAA,IACjB,MAAM;AAAA,MACJ,OAAO;AAAA,MACP,EAAE,iBAAiB,OAAO,qBAAqB;AAAA,MAC/C;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,qBAAqB,OAAO,OAAO,oBAAoB;AAAA,EAC1D;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,YAAY;AAC7C,CAAC;AAED,MAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,OAAO;AAAA,IACL,UAAU;AAAA,IACV,OAAO;AAAA,EACT;AACF,CAAC;","names":["CardMedia"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { CardPressableProps } from '../../types/card.types.mjs';
|
|
4
|
+
import 'react-native';
|
|
5
|
+
import '@impulse-ui-native/theme';
|
|
6
|
+
import '../../types/view.types.mjs';
|
|
7
|
+
|
|
8
|
+
declare const CardPressable: react.MemoExoticComponent<({ accessibilityRole, accessibilityState, disabled, style, ...props }: CardPressableProps) => react_jsx_runtime.JSX.Element>;
|
|
9
|
+
|
|
10
|
+
export { CardPressable };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback, useMemo } from "react";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import { useStyleProps, useThemedStyles } from "@impulse-ui-native/theme";
|
|
5
|
+
import { Pressable } from "../atoms/pressable";
|
|
6
|
+
import { cardRootStyles } from "./root.styles";
|
|
7
|
+
const CardPressable = memo(function CardPressable2({
|
|
8
|
+
accessibilityRole = "button",
|
|
9
|
+
accessibilityState,
|
|
10
|
+
disabled,
|
|
11
|
+
style,
|
|
12
|
+
...props
|
|
13
|
+
}) {
|
|
14
|
+
const styles = useThemedStyles(cardRootStyles);
|
|
15
|
+
const extractedStyleProps = useStyleProps(props);
|
|
16
|
+
const resolvedAccessibilityState = useMemo(
|
|
17
|
+
() => ({
|
|
18
|
+
...accessibilityState,
|
|
19
|
+
disabled: disabled === true
|
|
20
|
+
}),
|
|
21
|
+
[accessibilityState, disabled]
|
|
22
|
+
);
|
|
23
|
+
const rootStyle = useCallback(
|
|
24
|
+
(state) => StyleSheet.flatten([
|
|
25
|
+
styles.root,
|
|
26
|
+
extractedStyleProps,
|
|
27
|
+
typeof style === "function" ? style(state) : style
|
|
28
|
+
]),
|
|
29
|
+
[extractedStyleProps, style, styles.root]
|
|
30
|
+
);
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
Pressable,
|
|
33
|
+
{
|
|
34
|
+
...props,
|
|
35
|
+
accessibilityRole,
|
|
36
|
+
accessibilityState: resolvedAccessibilityState,
|
|
37
|
+
disabled: disabled === true,
|
|
38
|
+
style: rootStyle
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
export {
|
|
43
|
+
CardPressable
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=pressable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/card/pressable.tsx"],"sourcesContent":["import type {\n AccessibilityState,\n PressableStateCallbackType,\n StyleProp,\n ViewStyle,\n} from \"react-native\";\nimport { memo, useCallback, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport { useStyleProps, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { CardPressableProps } from \"../../types\";\nimport { Pressable } from \"../atoms/pressable\";\nimport { cardRootStyles } from \"./root.styles\";\n\nexport const CardPressable = memo(function CardPressable({\n accessibilityRole = \"button\",\n accessibilityState,\n disabled,\n style,\n ...props\n}: CardPressableProps) {\n const styles = useThemedStyles(cardRootStyles);\n const extractedStyleProps = useStyleProps(props);\n\n const resolvedAccessibilityState = useMemo<AccessibilityState>(\n () => ({\n ...accessibilityState,\n disabled: disabled === true,\n }),\n [accessibilityState, disabled],\n );\n\n const rootStyle = useCallback(\n (state: PressableStateCallbackType): StyleProp<ViewStyle> =>\n StyleSheet.flatten([\n styles.root,\n extractedStyleProps,\n typeof style === \"function\" ? style(state) : style,\n ]),\n [extractedStyleProps, style, styles.root],\n );\n\n return (\n <Pressable\n {...props}\n accessibilityRole={accessibilityRole}\n accessibilityState={resolvedAccessibilityState}\n disabled={disabled === true}\n style={rootStyle}\n />\n );\n});\n"],"mappings":"AA4CI;AAtCJ,SAAS,MAAM,aAAa,eAAe;AAC3C,SAAS,kBAAkB;AAE3B,SAAS,eAAe,uBAAuB;AAG/C,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAExB,MAAM,gBAAgB,KAAK,SAASA,eAAc;AAAA,EACvD,oBAAoB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAuB;AACrB,QAAM,SAAS,gBAAgB,cAAc;AAC7C,QAAM,sBAAsB,cAAc,KAAK;AAE/C,QAAM,6BAA6B;AAAA,IACjC,OAAO;AAAA,MACL,GAAG;AAAA,MACH,UAAU,aAAa;AAAA,IACzB;AAAA,IACA,CAAC,oBAAoB,QAAQ;AAAA,EAC/B;AAEA,QAAM,YAAY;AAAA,IAChB,CAAC,UACC,WAAW,QAAQ;AAAA,MACjB,OAAO;AAAA,MACP;AAAA,MACA,OAAO,UAAU,aAAa,MAAM,KAAK,IAAI;AAAA,IAC/C,CAAC;AAAA,IACH,CAAC,qBAAqB,OAAO,OAAO,IAAI;AAAA,EAC1C;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,oBAAoB;AAAA,MACpB,UAAU,aAAa;AAAA,MACvB,OAAO;AAAA;AAAA,EACT;AAEJ,CAAC;","names":["CardPressable"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { CardRootProps } from '../../types/card.types.mjs';
|
|
4
|
+
import 'react-native';
|
|
5
|
+
import '@impulse-ui-native/theme';
|
|
6
|
+
import '../../types/view.types.mjs';
|
|
7
|
+
|
|
8
|
+
declare const CardRoot: react.MemoExoticComponent<({ style, ...props }: CardRootProps) => react_jsx_runtime.JSX.Element>;
|
|
9
|
+
|
|
10
|
+
export { CardRoot };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { useStyleProps, useThemedStyles } from "@impulse-ui-native/theme";
|
|
4
|
+
import { View } from "../atoms/view";
|
|
5
|
+
import { cardRootStyles } from "./root.styles";
|
|
6
|
+
const CardRoot = memo(function CardRoot2({
|
|
7
|
+
style,
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
const styles = useThemedStyles(cardRootStyles);
|
|
11
|
+
const extractedStyleProps = useStyleProps(props);
|
|
12
|
+
const rootStyle = useMemo(
|
|
13
|
+
() => [styles.root, extractedStyleProps, style],
|
|
14
|
+
[extractedStyleProps, style, styles.root]
|
|
15
|
+
);
|
|
16
|
+
return /* @__PURE__ */ jsx(View, { ...props, style: rootStyle });
|
|
17
|
+
});
|
|
18
|
+
export {
|
|
19
|
+
CardRoot
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/card/root.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\n\nimport { useStyleProps, useThemedStyles } from \"@impulse-ui-native/theme\";\n\nimport type { CardRootProps } from \"../../types\";\nimport { View } from \"../atoms/view\";\nimport { cardRootStyles } from \"./root.styles\";\n\nexport const CardRoot = memo(function CardRoot({\n style,\n ...props\n}: CardRootProps) {\n const styles = useThemedStyles(cardRootStyles);\n const extractedStyleProps = useStyleProps(props);\n const rootStyle = useMemo(\n () => [styles.root, extractedStyleProps, style],\n [extractedStyleProps, style, styles.root],\n );\n\n return <View {...props} style={rootStyle} />;\n});\n"],"mappings":"AAmBS;AAnBT,SAAS,MAAM,eAAe;AAE9B,SAAS,eAAe,uBAAuB;AAG/C,SAAS,YAAY;AACrB,SAAS,sBAAsB;AAExB,MAAM,WAAW,KAAK,SAASA,UAAS;AAAA,EAC7C;AAAA,EACA,GAAG;AACL,GAAkB;AAChB,QAAM,SAAS,gBAAgB,cAAc;AAC7C,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,YAAY;AAAA,IAChB,MAAM,CAAC,OAAO,MAAM,qBAAqB,KAAK;AAAA,IAC9C,CAAC,qBAAqB,OAAO,OAAO,IAAI;AAAA,EAC1C;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,WAAW;AAC5C,CAAC;","names":["CardRoot"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AppTheme } from '@impulse-ui-native/theme';
|
|
2
|
+
|
|
3
|
+
declare function cardRootStyles(theme: AppTheme): {
|
|
4
|
+
root: {
|
|
5
|
+
overflow: "hidden";
|
|
6
|
+
backgroundColor: string;
|
|
7
|
+
borderColor: string;
|
|
8
|
+
borderRadius: number;
|
|
9
|
+
borderWidth: number;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { cardRootStyles };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
function cardRootStyles(theme) {
|
|
3
|
+
const tokens = theme.components.card;
|
|
4
|
+
return StyleSheet.create({
|
|
5
|
+
root: {
|
|
6
|
+
overflow: "hidden",
|
|
7
|
+
backgroundColor: tokens.backgroundColor,
|
|
8
|
+
borderColor: tokens.borderColor,
|
|
9
|
+
borderRadius: tokens.borderRadius,
|
|
10
|
+
borderWidth: tokens.borderWidth
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
cardRootStyles
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=root.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/card/root.styles.ts"],"sourcesContent":["import { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\n\nexport function cardRootStyles(theme: AppTheme) {\n const tokens = theme.components.card;\n\n return StyleSheet.create({\n root: {\n overflow: \"hidden\",\n backgroundColor: tokens.backgroundColor,\n borderColor: tokens.borderColor,\n borderRadius: tokens.borderRadius,\n borderWidth: tokens.borderWidth,\n },\n });\n}\n"],"mappings":"AAAA,SAAS,kBAAkB;AAIpB,SAAS,eAAe,OAAiB;AAC9C,QAAM,SAAS,MAAM,WAAW;AAEhC,SAAO,WAAW,OAAO;AAAA,IACvB,MAAM;AAAA,MACJ,UAAU;AAAA,MACV,iBAAiB,OAAO;AAAA,MACxB,aAAa,OAAO;AAAA,MACpB,cAAc,OAAO;AAAA,MACrB,aAAa,OAAO;AAAA,IACtB;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -4,6 +4,7 @@ import { ControlAddonProps } from '../../types/control-components.types.mjs';
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
+
import '../../types/spinner.types.mjs';
|
|
7
8
|
import '../../types/button.types.mjs';
|
|
8
9
|
|
|
9
10
|
declare const ControlAddon: react.MemoExoticComponent<(props: ControlAddonProps) => react_jsx_runtime.JSX.Element | null>;
|
|
@@ -4,6 +4,7 @@ import { ControlContainerProps } from '../../types/control-components.types.mjs'
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
+
import '../../types/spinner.types.mjs';
|
|
7
8
|
import '../../types/button.types.mjs';
|
|
8
9
|
|
|
9
10
|
declare const ControlContainer: react.MemoExoticComponent<(props: ControlContainerProps) => react_jsx_runtime.JSX.Element>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
import { ViewProps } from '../../types/view.types.mjs';
|
|
4
|
-
import { ControlContainerProps, ControlContextData, ControlLabelProps, ControlErrorLabelProps, ControlAddonProps, ControlInputProps, ControlPlaceholderProps, ControlValueProps } from '../../types/control-components.types.mjs';
|
|
4
|
+
import { ControlContainerProps, ControlContextData, ControlLabelProps, ControlErrorLabelProps, ControlAddonProps, ControlInputProps, ControlPlaceholderProps, ControlValueProps, ControlLoaderProps } from '../../types/control-components.types.mjs';
|
|
5
5
|
import 'react-native';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
7
|
import '@impulse-ui-native/icon/types';
|
|
8
|
+
import '../../types/spinner.types.mjs';
|
|
8
9
|
import '../../types/button.types.mjs';
|
|
9
10
|
|
|
10
11
|
declare const Control: {
|
|
@@ -17,7 +18,7 @@ declare const Control: {
|
|
|
17
18
|
Input: react.MemoExoticComponent<(props: ControlInputProps) => react_jsx_runtime.JSX.Element>;
|
|
18
19
|
Placeholder: react.MemoExoticComponent<(props: ControlPlaceholderProps) => react_jsx_runtime.JSX.Element>;
|
|
19
20
|
Value: react.MemoExoticComponent<(props: ControlValueProps) => react_jsx_runtime.JSX.Element>;
|
|
20
|
-
Loader: react.MemoExoticComponent<() => react_jsx_runtime.JSX.Element>;
|
|
21
|
+
Loader: react.MemoExoticComponent<(props: ControlLoaderProps) => react_jsx_runtime.JSX.Element>;
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
export { Control };
|
|
@@ -4,6 +4,7 @@ import { ControlErrorLabelProps } from '../../types/control-components.types.mjs
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
+
import '../../types/spinner.types.mjs';
|
|
7
8
|
import '../../types/button.types.mjs';
|
|
8
9
|
|
|
9
10
|
declare const ControlError: react.MemoExoticComponent<(props: ControlErrorLabelProps) => react_jsx_runtime.JSX.Element | null>;
|
|
@@ -4,6 +4,7 @@ import { ControlInputProps } from '../../types/control-components.types.mjs';
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
+
import '../../types/spinner.types.mjs';
|
|
7
8
|
import '../../types/button.types.mjs';
|
|
8
9
|
|
|
9
10
|
declare const ControlInput: react.MemoExoticComponent<(props: ControlInputProps) => react_jsx_runtime.JSX.Element>;
|
|
@@ -4,6 +4,7 @@ import { ControlLabelProps } from '../../types/control-components.types.mjs';
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
+
import '../../types/spinner.types.mjs';
|
|
7
8
|
import '../../types/button.types.mjs';
|
|
8
9
|
|
|
9
10
|
declare const ControlLabel: react.MemoExoticComponent<(props: ControlLabelProps) => react_jsx_runtime.JSX.Element | null>;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { ControlLoaderProps } from '../../types/control-components.types.mjs';
|
|
4
|
+
import 'react-native';
|
|
5
|
+
import '@impulse-ui-native/icon/types';
|
|
6
|
+
import '@impulse-ui-native/theme';
|
|
7
|
+
import '../../types/spinner.types.mjs';
|
|
8
|
+
import '../../types/button.types.mjs';
|
|
3
9
|
|
|
4
|
-
declare const ControlLoader: react.MemoExoticComponent<() => react_jsx_runtime.JSX.Element>;
|
|
10
|
+
declare const ControlLoader: react.MemoExoticComponent<(props: ControlLoaderProps) => react_jsx_runtime.JSX.Element>;
|
|
5
11
|
|
|
6
12
|
export { ControlLoader };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo } from "react";
|
|
3
|
-
import {
|
|
4
|
-
const ControlLoader = memo(function ControlLoader2() {
|
|
5
|
-
return /* @__PURE__ */ jsx(
|
|
3
|
+
import { Spinner } from "../atoms/spinner";
|
|
4
|
+
const ControlLoader = memo(function ControlLoader2(props) {
|
|
5
|
+
return /* @__PURE__ */ jsx(Spinner, { ...props });
|
|
6
6
|
});
|
|
7
7
|
export {
|
|
8
8
|
ControlLoader
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/controls/loader.tsx"],"sourcesContent":["import { memo } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/controls/loader.tsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport type { ControlLoaderProps } from \"../../types\";\nimport { Spinner } from \"../atoms/spinner\";\n\nexport const ControlLoader = memo(function ControlLoader(\n props: ControlLoaderProps,\n) {\n return <Spinner {...props} />;\n});\n"],"mappings":"AAQS;AART,SAAS,YAAY;AAGrB,SAAS,eAAe;AAEjB,MAAM,gBAAgB,KAAK,SAASA,eACzC,OACA;AACA,SAAO,oBAAC,WAAS,GAAG,OAAO;AAC7B,CAAC;","names":["ControlLoader"]}
|
|
@@ -4,6 +4,7 @@ import { ControlPlaceholderProps } from '../../types/control-components.types.mj
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
+
import '../../types/spinner.types.mjs';
|
|
7
8
|
import '../../types/button.types.mjs';
|
|
8
9
|
|
|
9
10
|
declare const ControlPlaceholder: react.MemoExoticComponent<(props: ControlPlaceholderProps) => react_jsx_runtime.JSX.Element>;
|
|
@@ -5,6 +5,7 @@ import { ControlContextData } from '../../types/control-components.types.mjs';
|
|
|
5
5
|
import 'react-native';
|
|
6
6
|
import '@impulse-ui-native/icon/types';
|
|
7
7
|
import '@impulse-ui-native/theme';
|
|
8
|
+
import '../../types/spinner.types.mjs';
|
|
8
9
|
import '../../types/button.types.mjs';
|
|
9
10
|
|
|
10
11
|
declare const ControlProvider: react.MemoExoticComponent<(props: PropsWithChildren<ControlContextData>) => react_jsx_runtime.JSX.Element>;
|
|
@@ -4,6 +4,7 @@ import { ControlValueProps } from '../../types/control-components.types.mjs';
|
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '@impulse-ui-native/icon/types';
|
|
6
6
|
import '@impulse-ui-native/theme';
|
|
7
|
+
import '../../types/spinner.types.mjs';
|
|
7
8
|
import '../../types/button.types.mjs';
|
|
8
9
|
|
|
9
10
|
declare const ControlValue: react.MemoExoticComponent<(props: ControlValueProps) => react_jsx_runtime.JSX.Element>;
|
|
@@ -1,22 +1,32 @@
|
|
|
1
|
+
export { Avatar } from './atoms/avatar.mjs';
|
|
1
2
|
export { View } from './atoms/view.mjs';
|
|
2
3
|
export { SafeAreaView } from './atoms/safe-area-view.mjs';
|
|
3
4
|
export { Typography, TypographyComponent } from './atoms/typography.mjs';
|
|
4
5
|
export { Button } from './atoms/button.mjs';
|
|
6
|
+
export { Divider } from './atoms/divider.mjs';
|
|
5
7
|
export { IconButton } from './atoms/icon-button.mjs';
|
|
6
8
|
export { Pressable } from './atoms/pressable.mjs';
|
|
9
|
+
export { Progress } from './atoms/progress.mjs';
|
|
10
|
+
export { Spinner } from './atoms/spinner.mjs';
|
|
7
11
|
export { Tag } from './atoms/tag.mjs';
|
|
12
|
+
export { Card } from './card/card.mjs';
|
|
8
13
|
export { Control } from './controls/control.mjs';
|
|
9
14
|
export { useControlContext } from './controls/provider.mjs';
|
|
10
15
|
import 'react';
|
|
11
|
-
import '@impulse-ui-native/theme';
|
|
12
|
-
import 'react-native';
|
|
13
16
|
import 'react/jsx-runtime';
|
|
17
|
+
import '../types/avatar.types.mjs';
|
|
18
|
+
import 'react-native';
|
|
19
|
+
import '@impulse-ui-native/theme';
|
|
20
|
+
import '../types/view.types.mjs';
|
|
14
21
|
import '../types/safe-area-view.types.mjs';
|
|
15
22
|
import 'react-native-safe-area-context';
|
|
16
23
|
import '../types/typography.types.mjs';
|
|
17
24
|
import '../types/button.types.mjs';
|
|
25
|
+
import '../types/divider.types.mjs';
|
|
18
26
|
import '../types/icon-button.types.mjs';
|
|
19
27
|
import '@impulse-ui-native/icon/types';
|
|
28
|
+
import '../types/progress.types.mjs';
|
|
29
|
+
import '../types/spinner.types.mjs';
|
|
20
30
|
import '../types/tag.types.mjs';
|
|
21
|
-
import '../types/
|
|
31
|
+
import '../types/card.types.mjs';
|
|
22
32
|
import '../types/control-components.types.mjs';
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["export * from \"./atoms\";\nexport * from \"./controls\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["export * from \"./atoms\";\nexport * from \"./card\";\nexport * from \"./controls\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { AccessibilityInfo, Animated, Easing } from "react-native";
|
|
3
|
+
function useIndeterminateProgressAnimation(duration) {
|
|
4
|
+
const [reduceMotion, setReduceMotion] = useState(false);
|
|
5
|
+
const progress = useRef(new Animated.Value(0)).current;
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
let mounted = true;
|
|
8
|
+
AccessibilityInfo.isReduceMotionEnabled().then((enabled) => {
|
|
9
|
+
if (mounted) {
|
|
10
|
+
setReduceMotion(enabled);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const subscription = AccessibilityInfo.addEventListener(
|
|
14
|
+
"reduceMotionChanged",
|
|
15
|
+
setReduceMotion
|
|
16
|
+
);
|
|
17
|
+
return () => {
|
|
18
|
+
mounted = false;
|
|
19
|
+
subscription.remove();
|
|
20
|
+
};
|
|
21
|
+
}, []);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
progress.stopAnimation();
|
|
24
|
+
if (reduceMotion) {
|
|
25
|
+
progress.setValue(0.5);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
progress.setValue(0);
|
|
29
|
+
const animation = Animated.loop(
|
|
30
|
+
Animated.timing(progress, {
|
|
31
|
+
duration,
|
|
32
|
+
easing: Easing.linear,
|
|
33
|
+
toValue: 1,
|
|
34
|
+
useNativeDriver: true
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
animation.start();
|
|
38
|
+
return () => {
|
|
39
|
+
animation.stop();
|
|
40
|
+
};
|
|
41
|
+
}, [duration, progress, reduceMotion]);
|
|
42
|
+
return progress;
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
useIndeterminateProgressAnimation
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=use-indeterminate-progress-animation.hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-indeterminate-progress-animation.hook.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { AccessibilityInfo, Animated, Easing } from \"react-native\";\n\nexport function useIndeterminateProgressAnimation(duration: number) {\n const [reduceMotion, setReduceMotion] = useState(false);\n const progress = useRef(new Animated.Value(0)).current;\n\n useEffect(() => {\n let mounted = true;\n\n AccessibilityInfo.isReduceMotionEnabled().then((enabled) => {\n if (mounted) {\n setReduceMotion(enabled);\n }\n });\n\n const subscription = AccessibilityInfo.addEventListener(\n \"reduceMotionChanged\",\n setReduceMotion,\n );\n\n return () => {\n mounted = false;\n subscription.remove();\n };\n }, []);\n\n useEffect(() => {\n progress.stopAnimation();\n\n if (reduceMotion) {\n progress.setValue(0.5);\n return;\n }\n\n progress.setValue(0);\n\n const animation = Animated.loop(\n Animated.timing(progress, {\n duration,\n easing: Easing.linear,\n toValue: 1,\n useNativeDriver: true,\n }),\n );\n\n animation.start();\n\n return () => {\n animation.stop();\n };\n }, [duration, progress, reduceMotion]);\n\n return progress;\n}\n"],"mappings":"AAAA,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,mBAAmB,UAAU,cAAc;AAE7C,SAAS,kCAAkC,UAAkB;AAClE,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AACtD,QAAM,WAAW,OAAO,IAAI,SAAS,MAAM,CAAC,CAAC,EAAE;AAE/C,YAAU,MAAM;AACd,QAAI,UAAU;AAEd,sBAAkB,sBAAsB,EAAE,KAAK,CAAC,YAAY;AAC1D,UAAI,SAAS;AACX,wBAAgB,OAAO;AAAA,MACzB;AAAA,IACF,CAAC;AAED,UAAM,eAAe,kBAAkB;AAAA,MACrC;AAAA,MACA;AAAA,IACF;AAEA,WAAO,MAAM;AACX,gBAAU;AACV,mBAAa,OAAO;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,aAAS,cAAc;AAEvB,QAAI,cAAc;AAChB,eAAS,SAAS,GAAG;AACrB;AAAA,IACF;AAEA,aAAS,SAAS,CAAC;AAEnB,UAAM,YAAY,SAAS;AAAA,MACzB,SAAS,OAAO,UAAU;AAAA,QACxB;AAAA,QACA,QAAQ,OAAO;AAAA,QACf,SAAS;AAAA,QACT,iBAAiB;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,cAAU,MAAM;AAEhB,WAAO,MAAM;AACX,gBAAU,KAAK;AAAA,IACjB;AAAA,EACF,GAAG,CAAC,UAAU,UAAU,YAAY,CAAC;AAErC,SAAO;AACT;","names":[]}
|