@impulse-ui-native/primitives 4.0.0 → 6.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 +30 -25
- package/dist/components/atoms/avatar.d.mts +1 -1
- package/dist/components/atoms/avatar.js +18 -31
- package/dist/components/atoms/avatar.js.map +1 -1
- package/dist/components/atoms/badge/addon.js +6 -2
- package/dist/components/atoms/badge/addon.js.map +1 -1
- package/dist/components/atoms/badge/root.d.mts +1 -1
- package/dist/components/atoms/badge/root.js +25 -38
- package/dist/components/atoms/badge/root.js.map +1 -1
- package/dist/components/atoms/button.d.mts +1 -1
- package/dist/components/atoms/button.js +2 -20
- package/dist/components/atoms/button.js.map +1 -1
- package/dist/components/atoms/divider.d.mts +1 -1
- package/dist/components/atoms/divider.js +18 -14
- package/dist/components/atoms/divider.js.map +1 -1
- package/dist/components/atoms/icon-button.d.mts +1 -1
- package/dist/components/atoms/icon-button.js +1 -11
- package/dist/components/atoms/icon-button.js.map +1 -1
- package/dist/components/atoms/index.d.mts +0 -2
- package/dist/components/atoms/index.js +0 -2
- package/dist/components/atoms/index.js.map +1 -1
- package/dist/components/atoms/pressable.js.map +1 -1
- package/dist/components/atoms/safe-area-view.js.map +1 -1
- package/dist/components/atoms/spinner.d.mts +1 -1
- package/dist/components/atoms/spinner.js +8 -29
- package/dist/components/atoms/spinner.js.map +1 -1
- package/dist/components/atoms/tag.js.map +1 -1
- package/dist/components/atoms/typography.js +25 -1
- package/dist/components/atoms/typography.js.map +1 -1
- package/dist/components/atoms/view.js.map +1 -1
- package/dist/components/index.d.mts +0 -4
- package/dist/components/index.js +0 -1
- package/dist/components/index.js.map +1 -1
- package/dist/hocs/create-preset.hoc.d.mts +1 -1
- package/dist/hocs/create-preset.hoc.js +23 -8
- package/dist/hocs/create-preset.hoc.js.map +1 -1
- package/dist/index.d.mts +0 -4
- package/dist/types/avatar.types.d.mts +1 -1
- package/dist/types/index.d.mts +0 -2
- package/dist/types/index.js +0 -2
- package/dist/types/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/components/atoms/circular-progress.d.mts +0 -16
- package/dist/components/atoms/circular-progress.js +0 -144
- package/dist/components/atoms/circular-progress.js.map +0 -1
- package/dist/components/atoms/linear-progress.d.mts +0 -17
- package/dist/components/atoms/linear-progress.js +0 -97
- package/dist/components/atoms/linear-progress.js.map +0 -1
- package/dist/components/atoms/progress.d.mts +0 -9
- package/dist/components/atoms/progress.js +0 -94
- package/dist/components/atoms/progress.js.map +0 -1
- package/dist/components/card/card.d.mts +0 -17
- package/dist/components/card/card.js +0 -18
- package/dist/components/card/card.js.map +0 -1
- package/dist/components/card/content.d.mts +0 -10
- package/dist/components/card/content.js +0 -30
- package/dist/components/card/content.js.map +0 -1
- package/dist/components/card/footer.d.mts +0 -10
- package/dist/components/card/footer.js +0 -30
- package/dist/components/card/footer.js.map +0 -1
- package/dist/components/card/header.d.mts +0 -10
- package/dist/components/card/header.js +0 -30
- package/dist/components/card/header.js.map +0 -1
- package/dist/components/card/index.d.mts +0 -7
- package/dist/components/card/index.js +0 -5
- package/dist/components/card/index.js.map +0 -1
- package/dist/components/card/media.d.mts +0 -10
- package/dist/components/card/media.js +0 -30
- package/dist/components/card/media.js.map +0 -1
- package/dist/components/card/pressable.d.mts +0 -10
- package/dist/components/card/pressable.js +0 -45
- package/dist/components/card/pressable.js.map +0 -1
- package/dist/components/card/root.d.mts +0 -10
- package/dist/components/card/root.js +0 -21
- package/dist/components/card/root.js.map +0 -1
- package/dist/components/card/root.styles.d.mts +0 -13
- package/dist/components/card/root.styles.js +0 -17
- package/dist/components/card/root.styles.js.map +0 -1
- package/dist/hooks/use-indeterminate-progress-animation.hook.d.mts +0 -5
- package/dist/hooks/use-indeterminate-progress-animation.hook.js +0 -47
- package/dist/hooks/use-indeterminate-progress-animation.hook.js.map +0 -1
- package/dist/types/card.types.d.mts +0 -21
- package/dist/types/card.types.js +0 -1
- package/dist/types/card.types.js.map +0 -1
- package/dist/types/progress.types.d.mts +0 -15
- package/dist/types/progress.types.js +0 -1
- package/dist/types/progress.types.js.map +0 -1
- package/dist/utils/progress.utils.d.mts +0 -9
- package/dist/utils/progress.utils.js +0 -27
- package/dist/utils/progress.utils.js.map +0 -1
|
@@ -1,10 +0,0 @@
|
|
|
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 };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useMemo } from "react";
|
|
3
|
-
import { StyleSheet } from "react-native";
|
|
4
|
-
import { useStyleProps, useThemedStyles } from "@impulse-ui-native/theme";
|
|
5
|
-
import { View } from "../atoms/view";
|
|
6
|
-
const CardMedia = memo(function CardMedia2({
|
|
7
|
-
style,
|
|
8
|
-
...props
|
|
9
|
-
}) {
|
|
10
|
-
const extractedStyleProps = useStyleProps(props);
|
|
11
|
-
const styles = useThemedStyles(themedStyles);
|
|
12
|
-
const mediaStyle = useMemo(
|
|
13
|
-
() => [styles.media, extractedStyleProps, style],
|
|
14
|
-
[extractedStyleProps, style, styles.media]
|
|
15
|
-
);
|
|
16
|
-
return /* @__PURE__ */ jsx(View, { ...props, style: mediaStyle });
|
|
17
|
-
});
|
|
18
|
-
function themedStyles(theme) {
|
|
19
|
-
return StyleSheet.create({
|
|
20
|
-
media: {
|
|
21
|
-
backgroundColor: theme.components.card.mediaBackgroundColor,
|
|
22
|
-
overflow: "hidden",
|
|
23
|
-
width: "100%"
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
export {
|
|
28
|
-
CardMedia
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=media.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/card/media.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { StyleSheet } from \"react-native\";\n\nimport type { AppTheme } from \"@impulse-ui-native/theme\";\nimport { useStyleProps, useThemedStyles } 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 extractedStyleProps = useStyleProps(props);\n const styles = useThemedStyles(themedStyles);\n const mediaStyle = useMemo(\n () => [styles.media, extractedStyleProps, style],\n [extractedStyleProps, style, styles.media],\n );\n\n return <View {...props} style={mediaStyle} />;\n});\n\nfunction themedStyles(theme: AppTheme) {\n return StyleSheet.create({\n media: {\n backgroundColor: theme.components.card.mediaBackgroundColor,\n overflow: \"hidden\",\n width: \"100%\",\n },\n });\n}\n"],"mappings":"AAoBS;AApBT,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,eAAe,uBAAuB;AAG/C,SAAS,YAAY;AAEd,MAAM,YAAY,KAAK,SAASA,WAAU;AAAA,EAC/C;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,QAAM,sBAAsB,cAAc,KAAK;AAC/C,QAAM,SAAS,gBAAgB,YAAY;AAC3C,QAAM,aAAa;AAAA,IACjB,MAAM,CAAC,OAAO,OAAO,qBAAqB,KAAK;AAAA,IAC/C,CAAC,qBAAqB,OAAO,OAAO,KAAK;AAAA,EAC3C;AAEA,SAAO,oBAAC,QAAM,GAAG,OAAO,OAAO,YAAY;AAC7C,CAAC;AAED,SAAS,aAAa,OAAiB;AACrC,SAAO,WAAW,OAAO;AAAA,IACvB,OAAO;AAAA,MACL,iBAAiB,MAAM,WAAW,KAAK;AAAA,MACvC,UAAU;AAAA,MACV,OAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;","names":["CardMedia"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
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 };
|
|
@@ -1,45 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
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 };
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
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 };
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { PressableProps, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import { DimensionProps, SpacingProps, ShadowProps } from '@impulse-ui-native/theme';
|
|
4
|
-
import { ViewProps } from './view.types.mjs';
|
|
5
|
-
|
|
6
|
-
interface CardRootProps extends ViewProps {
|
|
7
|
-
}
|
|
8
|
-
interface CardPressableProps extends Omit<PressableProps, "children">, DimensionProps, SpacingProps, ShadowProps {
|
|
9
|
-
children?: ReactNode;
|
|
10
|
-
pressedStyle?: StyleProp<ViewStyle>;
|
|
11
|
-
}
|
|
12
|
-
interface CardHeaderProps extends ViewProps {
|
|
13
|
-
}
|
|
14
|
-
interface CardContentProps extends ViewProps {
|
|
15
|
-
}
|
|
16
|
-
interface CardFooterProps extends ViewProps {
|
|
17
|
-
}
|
|
18
|
-
interface CardMediaProps extends ViewProps {
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type { CardContentProps, CardFooterProps, CardHeaderProps, CardMediaProps, CardPressableProps, CardRootProps };
|
package/dist/types/card.types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=card.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ViewProps, ColorValue } from 'react-native';
|
|
2
|
-
import { ComponentSize, ProgressTone, ProgressVariant } from '@impulse-ui-native/theme';
|
|
3
|
-
|
|
4
|
-
interface ProgressProps extends Omit<ViewProps, "children"> {
|
|
5
|
-
color?: ColorValue;
|
|
6
|
-
max?: number;
|
|
7
|
-
min?: number;
|
|
8
|
-
size?: ComponentSize;
|
|
9
|
-
tone?: ProgressTone;
|
|
10
|
-
trackColor?: ColorValue;
|
|
11
|
-
value?: number;
|
|
12
|
-
variant?: ProgressVariant;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type { ProgressProps };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=progress.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
interface NormalizedProgressValue {
|
|
2
|
-
fraction: number;
|
|
3
|
-
max: number;
|
|
4
|
-
min: number;
|
|
5
|
-
value: number | undefined;
|
|
6
|
-
}
|
|
7
|
-
declare function normalizeProgressValue(value: number | undefined, min: number, max: number): NormalizedProgressValue;
|
|
8
|
-
|
|
9
|
-
export { type NormalizedProgressValue, normalizeProgressValue };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
function normalizeProgressValue(value, min, max) {
|
|
2
|
-
const resolvedMin = Number.isFinite(min) ? min : 0;
|
|
3
|
-
const resolvedMax = Number.isFinite(max) && max > resolvedMin ? max : resolvedMin + 100;
|
|
4
|
-
if (value === void 0) {
|
|
5
|
-
return {
|
|
6
|
-
fraction: 0,
|
|
7
|
-
max: resolvedMax,
|
|
8
|
-
min: resolvedMin,
|
|
9
|
-
value: void 0
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
const finiteValue = Number.isFinite(value) ? value : resolvedMin;
|
|
13
|
-
const resolvedValue = Math.min(
|
|
14
|
-
Math.max(finiteValue, resolvedMin),
|
|
15
|
-
resolvedMax
|
|
16
|
-
);
|
|
17
|
-
return {
|
|
18
|
-
fraction: (resolvedValue - resolvedMin) / (resolvedMax - resolvedMin),
|
|
19
|
-
max: resolvedMax,
|
|
20
|
-
min: resolvedMin,
|
|
21
|
-
value: resolvedValue
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
normalizeProgressValue
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=progress.utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/progress.utils.ts"],"sourcesContent":["export interface NormalizedProgressValue {\n fraction: number;\n max: number;\n min: number;\n value: number | undefined;\n}\n\nexport function normalizeProgressValue(\n value: number | undefined,\n min: number,\n max: number,\n): NormalizedProgressValue {\n const resolvedMin = Number.isFinite(min) ? min : 0;\n const resolvedMax =\n Number.isFinite(max) && max > resolvedMin ? max : resolvedMin + 100;\n\n if (value === undefined) {\n return {\n fraction: 0,\n max: resolvedMax,\n min: resolvedMin,\n value: undefined,\n };\n }\n\n const finiteValue = Number.isFinite(value) ? value : resolvedMin;\n const resolvedValue = Math.min(\n Math.max(finiteValue, resolvedMin),\n resolvedMax,\n );\n\n return {\n fraction: (resolvedValue - resolvedMin) / (resolvedMax - resolvedMin),\n max: resolvedMax,\n min: resolvedMin,\n value: resolvedValue,\n };\n}\n"],"mappings":"AAOO,SAAS,uBACd,OACA,KACA,KACyB;AACzB,QAAM,cAAc,OAAO,SAAS,GAAG,IAAI,MAAM;AACjD,QAAM,cACJ,OAAO,SAAS,GAAG,KAAK,MAAM,cAAc,MAAM,cAAc;AAElE,MAAI,UAAU,QAAW;AACvB,WAAO;AAAA,MACL,UAAU;AAAA,MACV,KAAK;AAAA,MACL,KAAK;AAAA,MACL,OAAO;AAAA,IACT;AAAA,EACF;AAEA,QAAM,cAAc,OAAO,SAAS,KAAK,IAAI,QAAQ;AACrD,QAAM,gBAAgB,KAAK;AAAA,IACzB,KAAK,IAAI,aAAa,WAAW;AAAA,IACjC;AAAA,EACF;AAEA,SAAO;AAAA,IACL,WAAW,gBAAgB,gBAAgB,cAAc;AAAA,IACzD,KAAK;AAAA,IACL,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AACF;","names":[]}
|