@impulse-ui-native/progress 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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -0
  3. package/dist/components/circular-indeterminate-indicator.d.mts +8 -0
  4. package/dist/components/circular-indeterminate-indicator.js +56 -0
  5. package/dist/components/circular-indeterminate-indicator.js.map +1 -0
  6. package/dist/components/circular-progress.d.mts +8 -0
  7. package/dist/components/circular-progress.js +48 -0
  8. package/dist/components/circular-progress.js.map +1 -0
  9. package/dist/components/index.d.mts +6 -0
  10. package/dist/components/index.js +5 -0
  11. package/dist/components/index.js.map +1 -0
  12. package/dist/components/linear-indeterminate-indicator.d.mts +8 -0
  13. package/dist/components/linear-indeterminate-indicator.js +44 -0
  14. package/dist/components/linear-indeterminate-indicator.js.map +1 -0
  15. package/dist/components/linear-progress.d.mts +8 -0
  16. package/dist/components/linear-progress.js +67 -0
  17. package/dist/components/linear-progress.js.map +1 -0
  18. package/dist/components/progress-circle.d.mts +8 -0
  19. package/dist/components/progress-circle.js +49 -0
  20. package/dist/components/progress-circle.js.map +1 -0
  21. package/dist/components/progress.d.mts +9 -0
  22. package/dist/components/progress.js +69 -0
  23. package/dist/components/progress.js.map +1 -0
  24. package/dist/constants/progress.constants.d.mts +14 -0
  25. package/dist/constants/progress.constants.js +12 -0
  26. package/dist/constants/progress.constants.js.map +1 -0
  27. package/dist/hooks/use-indeterminate-progress-animation.hook.d.mts +5 -0
  28. package/dist/hooks/use-indeterminate-progress-animation.hook.js +25 -0
  29. package/dist/hooks/use-indeterminate-progress-animation.hook.js.map +1 -0
  30. package/dist/index.d.mts +6 -0
  31. package/dist/index.js +3 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/types/index.d.mts +3 -0
  34. package/dist/types/index.js +2 -0
  35. package/dist/types/index.js.map +1 -0
  36. package/dist/types/progress-internal.types.d.mts +45 -0
  37. package/dist/types/progress-internal.types.js +1 -0
  38. package/dist/types/progress-internal.types.js.map +1 -0
  39. package/dist/types/progress.types.d.mts +15 -0
  40. package/dist/types/progress.types.js +1 -0
  41. package/dist/types/progress.types.js.map +1 -0
  42. package/dist/utils/progress.utils.d.mts +9 -0
  43. package/dist/utils/progress.utils.js +27 -0
  44. package/dist/utils/progress.utils.js.map +1 -0
  45. package/package.json +62 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ImpulseUI Native contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @impulse-ui-native/progress
2
+
3
+ Token-aware linear and circular progress with Reanimated indeterminate animations.
4
+
5
+ ## Installation
6
+
7
+ `pnpm add @impulse-ui-native/progress`
8
+
9
+ Install React, React Native, `react-native-svg`, `react-native-reanimated` (4 or newer), and compatible `react-native-worklets` peers. Configure Reanimated and Worklets in the native host, and render inside `ThemeProvider` from `@impulse-ui-native/theme`.
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+ import { Progress } from "@impulse-ui-native/progress";
15
+
16
+ <Progress value={65} />;
17
+ <Progress variant="circular" value={35} />;
18
+ <Progress />;
19
+ ```
20
+
21
+ Progress defaults to a medium linear indicator with the primary tone. Provide `value` for determinate progress or omit it for indeterminate progress. Values are clamped between `min` and `max`, defaulting to 0 and 100. Invalid bounds fall back to a finite range; non-finite values render at the range minimum. Sizes, semantic colors, geometry, and animation duration come from `theme.components.progress`. Override indicator and track colors through `color` and `trackColor`.
22
+
23
+ Indeterminate linear motion respects RTL. Reanimated loops cancel on unmount and restart when duration changes. Native View props, styles, and linear `onLayout` callbacks are preserved.
24
+
25
+ `Progress` and `ProgressProps` are also exported by `@impulse-ui-native/toolkit`. Migrate imports from primitives to this package or the toolkit. Use the native Progress stories to inspect both variants, ranges, sizes, tones, and indeterminate states.
@@ -0,0 +1,8 @@
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { CircularIndeterminateIndicatorProps } from '../types/progress-internal.types.mjs';
4
+ import 'react-native';
5
+
6
+ declare const CircularIndeterminateIndicator: react.MemoExoticComponent<({ animationDuration, color, strokeWidth, trackColor, width, }: CircularIndeterminateIndicatorProps) => react_jsx_runtime.JSX.Element>;
7
+
8
+ export { CircularIndeterminateIndicator };
@@ -0,0 +1,56 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { memo, useMemo } from "react";
3
+ import Animated, { useAnimatedStyle } from "react-native-reanimated";
4
+ import Svg, { Circle } from "react-native-svg";
5
+ import { useIndeterminateProgressAnimation } from "../hooks/use-indeterminate-progress-animation.hook";
6
+ const CircularIndeterminateIndicator = memo(
7
+ function CircularIndeterminateIndicator2({
8
+ animationDuration,
9
+ color,
10
+ strokeWidth,
11
+ trackColor,
12
+ width
13
+ }) {
14
+ const progress = useIndeterminateProgressAnimation(animationDuration);
15
+ const center = width / 2;
16
+ const radius = (width - strokeWidth) / 2;
17
+ const circumference = 2 * Math.PI * radius;
18
+ const animatedStyle = useAnimatedStyle(() => ({
19
+ transform: [{ rotate: progress.value * 360 + "deg" }]
20
+ }));
21
+ const strokeDasharray = useMemo(
22
+ () => [circumference * 0.25, circumference * 0.75],
23
+ [circumference]
24
+ );
25
+ return /* @__PURE__ */ jsx(Animated.View, { style: animatedStyle, children: /* @__PURE__ */ jsxs(Svg, { height: width, width, children: [
26
+ /* @__PURE__ */ jsx(
27
+ Circle,
28
+ {
29
+ cx: center,
30
+ cy: center,
31
+ fill: "none",
32
+ r: radius,
33
+ stroke: trackColor,
34
+ strokeWidth
35
+ }
36
+ ),
37
+ /* @__PURE__ */ jsx(
38
+ Circle,
39
+ {
40
+ cx: center,
41
+ cy: center,
42
+ fill: "none",
43
+ r: radius,
44
+ stroke: color,
45
+ strokeDasharray,
46
+ strokeLinecap: "round",
47
+ strokeWidth
48
+ }
49
+ )
50
+ ] }) });
51
+ }
52
+ );
53
+ export {
54
+ CircularIndeterminateIndicator
55
+ };
56
+ //# sourceMappingURL=circular-indeterminate-indicator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/circular-indeterminate-indicator.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport Animated, { useAnimatedStyle } from \"react-native-reanimated\";\nimport Svg, { Circle } from \"react-native-svg\";\n\nimport type { CircularIndeterminateIndicatorProps } from \"../types/progress-internal.types\";\nimport { useIndeterminateProgressAnimation } from \"../hooks/use-indeterminate-progress-animation.hook\";\n\nexport const CircularIndeterminateIndicator = memo(\n function CircularIndeterminateIndicator({\n animationDuration,\n color,\n strokeWidth,\n trackColor,\n width,\n }: CircularIndeterminateIndicatorProps) {\n const progress = useIndeterminateProgressAnimation(animationDuration);\n\n const center = width / 2;\n const radius = (width - strokeWidth) / 2;\n const circumference = 2 * Math.PI * radius;\n\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ rotate: progress.value * 360 + \"deg\" }],\n }));\n const strokeDasharray = useMemo(\n () => [circumference * 0.25, circumference * 0.75],\n [circumference],\n );\n\n return (\n <Animated.View style={animatedStyle}>\n <Svg height={width} width={width}>\n <Circle\n cx={center}\n cy={center}\n fill=\"none\"\n r={radius}\n stroke={trackColor}\n strokeWidth={strokeWidth}\n />\n <Circle\n cx={center}\n cy={center}\n fill=\"none\"\n r={radius}\n stroke={color}\n strokeDasharray={strokeDasharray}\n strokeLinecap=\"round\"\n strokeWidth={strokeWidth}\n />\n </Svg>\n </Animated.View>\n );\n },\n);\n"],"mappings":"AA+BQ,SACE,KADF;AA/BR,SAAS,MAAM,eAAe;AAC9B,OAAO,YAAY,wBAAwB;AAC3C,OAAO,OAAO,cAAc;AAG5B,SAAS,yCAAyC;AAE3C,MAAM,iCAAiC;AAAA,EAC5C,SAASA,gCAA+B;AAAA,IACtC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAAwC;AACtC,UAAM,WAAW,kCAAkC,iBAAiB;AAEpE,UAAM,SAAS,QAAQ;AACvB,UAAM,UAAU,QAAQ,eAAe;AACvC,UAAM,gBAAgB,IAAI,KAAK,KAAK;AAEpC,UAAM,gBAAgB,iBAAiB,OAAO;AAAA,MAC5C,WAAW,CAAC,EAAE,QAAQ,SAAS,QAAQ,MAAM,MAAM,CAAC;AAAA,IACtD,EAAE;AACF,UAAM,kBAAkB;AAAA,MACtB,MAAM,CAAC,gBAAgB,MAAM,gBAAgB,IAAI;AAAA,MACjD,CAAC,aAAa;AAAA,IAChB;AAEA,WACE,oBAAC,SAAS,MAAT,EAAc,OAAO,eACpB,+BAAC,OAAI,QAAQ,OAAO,OAClB;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,MAAK;AAAA,UACL,GAAG;AAAA,UACH,QAAQ;AAAA,UACR;AAAA;AAAA,MACF;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,MAAK;AAAA,UACL,GAAG;AAAA,UACH,QAAQ;AAAA,UACR;AAAA,UACA,eAAc;AAAA,UACd;AAAA;AAAA,MACF;AAAA,OACF,GACF;AAAA,EAEJ;AACF;","names":["CircularIndeterminateIndicator"]}
@@ -0,0 +1,8 @@
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { CircularProgressProps } from '../types/progress-internal.types.mjs';
4
+ import 'react-native';
5
+
6
+ declare const CircularProgress: react.MemoExoticComponent<({ animationDuration, fraction, indicatorColor, indeterminate, strokeWidth, style, trackColor, width, ...props }: CircularProgressProps) => react_jsx_runtime.JSX.Element>;
7
+
8
+ export { CircularProgress };
@@ -0,0 +1,48 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { memo, useMemo } from "react";
3
+ import { View } from "react-native";
4
+ import { ProgressRootStyles as styles } from "../constants/progress.constants";
5
+ import { CircularIndeterminateIndicator } from "./circular-indeterminate-indicator";
6
+ import { ProgressCircle } from "./progress-circle";
7
+ const CircularProgress = memo(function CircularProgress2({
8
+ animationDuration,
9
+ fraction,
10
+ indicatorColor,
11
+ indeterminate,
12
+ strokeWidth,
13
+ style,
14
+ trackColor,
15
+ width,
16
+ ...props
17
+ }) {
18
+ const rootStyle = useMemo(
19
+ () => [styles.root, { height: width, width }, style],
20
+ [style, width]
21
+ );
22
+ return /* @__PURE__ */ jsxs(View, { ...props, style: rootStyle, children: [
23
+ indeterminate ? /* @__PURE__ */ jsx(
24
+ CircularIndeterminateIndicator,
25
+ {
26
+ animationDuration,
27
+ color: indicatorColor,
28
+ strokeWidth,
29
+ trackColor,
30
+ width
31
+ }
32
+ ) : null,
33
+ !indeterminate ? /* @__PURE__ */ jsx(
34
+ ProgressCircle,
35
+ {
36
+ color: indicatorColor,
37
+ fraction,
38
+ strokeWidth,
39
+ trackColor,
40
+ width
41
+ }
42
+ ) : null
43
+ ] });
44
+ });
45
+ export {
46
+ CircularProgress
47
+ };
48
+ //# sourceMappingURL=circular-progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/circular-progress.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { View } from \"react-native\";\n\nimport type { CircularProgressProps } from \"../types/progress-internal.types\";\nimport { ProgressRootStyles as styles } from \"../constants/progress.constants\";\nimport { CircularIndeterminateIndicator } from \"./circular-indeterminate-indicator\";\nimport { ProgressCircle } from \"./progress-circle\";\n\nexport const CircularProgress = memo(function CircularProgress({\n animationDuration,\n fraction,\n indicatorColor,\n indeterminate,\n strokeWidth,\n style,\n trackColor,\n width,\n ...props\n}: CircularProgressProps) {\n const rootStyle = useMemo(\n () => [styles.root, { height: width, width }, style],\n [style, width],\n );\n\n return (\n <View {...props} style={rootStyle}>\n {indeterminate ? (\n <CircularIndeterminateIndicator\n animationDuration={animationDuration}\n color={indicatorColor}\n strokeWidth={strokeWidth}\n trackColor={trackColor}\n width={width}\n />\n ) : null}\n {!indeterminate ? (\n <ProgressCircle\n color={indicatorColor}\n fraction={fraction}\n strokeWidth={strokeWidth}\n trackColor={trackColor}\n width={width}\n />\n ) : null}\n </View>\n );\n});\n"],"mappings":"AAyBI,SAEI,KAFJ;AAzBJ,SAAS,MAAM,eAAe;AAC9B,SAAS,YAAY;AAGrB,SAAS,sBAAsB,cAAc;AAC7C,SAAS,sCAAsC;AAC/C,SAAS,sBAAsB;AAExB,MAAM,mBAAmB,KAAK,SAASA,kBAAiB;AAAA,EAC7D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAA0B;AACxB,QAAM,YAAY;AAAA,IAChB,MAAM,CAAC,OAAO,MAAM,EAAE,QAAQ,OAAO,MAAM,GAAG,KAAK;AAAA,IACnD,CAAC,OAAO,KAAK;AAAA,EACf;AAEA,SACE,qBAAC,QAAM,GAAG,OAAO,OAAO,WACrB;AAAA,oBACC;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF,IACE;AAAA,IACH,CAAC,gBACA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF,IACE;AAAA,KACN;AAEJ,CAAC;","names":["CircularProgress"]}
@@ -0,0 +1,6 @@
1
+ export { Progress } from './progress.mjs';
2
+ import 'react';
3
+ import 'react/jsx-runtime';
4
+ import '../types/progress.types.mjs';
5
+ import 'react-native';
6
+ import '@impulse-ui-native/theme';
@@ -0,0 +1,5 @@
1
+ import { Progress } from "./progress";
2
+ export {
3
+ Progress
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["export { Progress } from \"./progress\";\n"],"mappings":"AAAA,SAAS,gBAAgB;","names":[]}
@@ -0,0 +1,8 @@
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { LinearIndeterminateIndicatorProps } from '../types/progress-internal.types.mjs';
4
+ import 'react-native';
5
+
6
+ declare const LinearIndeterminateIndicator: react.MemoExoticComponent<({ animationDuration, borderRadius, color, ratio, trackHeight, trackWidth, }: LinearIndeterminateIndicatorProps) => react_jsx_runtime.JSX.Element>;
7
+
8
+ export { LinearIndeterminateIndicator };
@@ -0,0 +1,44 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { memo, useMemo } from "react";
3
+ import { I18nManager } from "react-native";
4
+ import Animated, { useAnimatedStyle } from "react-native-reanimated";
5
+ import { useIndeterminateProgressAnimation } from "../hooks/use-indeterminate-progress-animation.hook";
6
+ const LinearIndeterminateIndicator = memo(
7
+ function LinearIndeterminateIndicator2({
8
+ animationDuration,
9
+ borderRadius,
10
+ color,
11
+ ratio,
12
+ trackHeight,
13
+ trackWidth
14
+ }) {
15
+ const progress = useIndeterminateProgressAnimation(animationDuration);
16
+ const indicatorWidth = trackWidth * ratio;
17
+ const direction = I18nManager.isRTL;
18
+ const animatedStyle = useAnimatedStyle(() => ({
19
+ transform: [
20
+ {
21
+ translateX: direction ? trackWidth - progress.value * (trackWidth + indicatorWidth) : -indicatorWidth + progress.value * (trackWidth + indicatorWidth)
22
+ }
23
+ ]
24
+ }));
25
+ const indicatorStyle = useMemo(
26
+ () => ({
27
+ backgroundColor: color,
28
+ borderRadius,
29
+ height: trackHeight,
30
+ width: `${ratio * 100}%`
31
+ }),
32
+ [borderRadius, color, ratio, trackHeight]
33
+ );
34
+ const composedStyle = useMemo(
35
+ () => [indicatorStyle, animatedStyle],
36
+ [indicatorStyle, animatedStyle]
37
+ );
38
+ return /* @__PURE__ */ jsx(Animated.View, { style: composedStyle });
39
+ }
40
+ );
41
+ export {
42
+ LinearIndeterminateIndicator
43
+ };
44
+ //# sourceMappingURL=linear-indeterminate-indicator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/linear-indeterminate-indicator.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport { I18nManager } from \"react-native\";\nimport Animated, { useAnimatedStyle } from \"react-native-reanimated\";\n\nimport type { LinearIndeterminateIndicatorProps } from \"../types/progress-internal.types\";\nimport { useIndeterminateProgressAnimation } from \"../hooks/use-indeterminate-progress-animation.hook\";\n\nexport const LinearIndeterminateIndicator = memo(\n function LinearIndeterminateIndicator({\n animationDuration,\n borderRadius,\n color,\n ratio,\n trackHeight,\n trackWidth,\n }: LinearIndeterminateIndicatorProps) {\n const progress = useIndeterminateProgressAnimation(animationDuration);\n\n const indicatorWidth = trackWidth * ratio;\n const direction = I18nManager.isRTL;\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [\n {\n translateX: direction\n ? trackWidth - progress.value * (trackWidth + indicatorWidth)\n : -indicatorWidth + progress.value * (trackWidth + indicatorWidth),\n },\n ],\n }));\n\n const indicatorStyle = useMemo(\n () => ({\n backgroundColor: color,\n borderRadius,\n height: trackHeight,\n width: `${ratio * 100}%` as const,\n }),\n [borderRadius, color, ratio, trackHeight],\n );\n\n const composedStyle = useMemo(\n () => [indicatorStyle, animatedStyle],\n [indicatorStyle, animatedStyle],\n );\n\n return <Animated.View style={composedStyle} />;\n },\n);\n"],"mappings":"AA6CW;AA7CX,SAAS,MAAM,eAAe;AAC9B,SAAS,mBAAmB;AAC5B,OAAO,YAAY,wBAAwB;AAG3C,SAAS,yCAAyC;AAE3C,MAAM,+BAA+B;AAAA,EAC1C,SAASA,8BAA6B;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAAsC;AACpC,UAAM,WAAW,kCAAkC,iBAAiB;AAEpE,UAAM,iBAAiB,aAAa;AACpC,UAAM,YAAY,YAAY;AAC9B,UAAM,gBAAgB,iBAAiB,OAAO;AAAA,MAC5C,WAAW;AAAA,QACT;AAAA,UACE,YAAY,YACR,aAAa,SAAS,SAAS,aAAa,kBAC5C,CAAC,iBAAiB,SAAS,SAAS,aAAa;AAAA,QACvD;AAAA,MACF;AAAA,IACF,EAAE;AAEF,UAAM,iBAAiB;AAAA,MACrB,OAAO;AAAA,QACL,iBAAiB;AAAA,QACjB;AAAA,QACA,QAAQ;AAAA,QACR,OAAO,GAAG,QAAQ,GAAG;AAAA,MACvB;AAAA,MACA,CAAC,cAAc,OAAO,OAAO,WAAW;AAAA,IAC1C;AAEA,UAAM,gBAAgB;AAAA,MACpB,MAAM,CAAC,gBAAgB,aAAa;AAAA,MACpC,CAAC,gBAAgB,aAAa;AAAA,IAChC;AAEA,WAAO,oBAAC,SAAS,MAAT,EAAc,OAAO,eAAe;AAAA,EAC9C;AACF;","names":["LinearIndeterminateIndicator"]}
@@ -0,0 +1,8 @@
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { LinearProgressProps } from '../types/progress-internal.types.mjs';
4
+ import 'react-native';
5
+
6
+ declare const LinearProgress: react.MemoExoticComponent<({ animationDuration, borderRadius, fraction, indicatorColor, indeterminate, indeterminateWidth, onLayout, style, trackColor, trackHeight, ...props }: LinearProgressProps) => react_jsx_runtime.JSX.Element>;
7
+
8
+ export { LinearProgress };
@@ -0,0 +1,67 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { memo, useCallback, useMemo, useState } from "react";
3
+ import { I18nManager, View } from "react-native";
4
+ import { ProgressTrackStyles as styles } from "../constants/progress.constants";
5
+ import { LinearIndeterminateIndicator } from "./linear-indeterminate-indicator";
6
+ const LinearProgress = memo(function LinearProgress2({
7
+ animationDuration,
8
+ borderRadius,
9
+ fraction,
10
+ indicatorColor,
11
+ indeterminate,
12
+ indeterminateWidth,
13
+ onLayout,
14
+ style,
15
+ trackColor,
16
+ trackHeight,
17
+ ...props
18
+ }) {
19
+ const [trackWidth, setTrackWidth] = useState(0);
20
+ const handleLayout = useCallback(
21
+ (event) => {
22
+ setTrackWidth(event.nativeEvent.layout.width);
23
+ onLayout?.(event);
24
+ },
25
+ [onLayout]
26
+ );
27
+ const trackStyle = useMemo(
28
+ () => [
29
+ styles.track,
30
+ {
31
+ backgroundColor: trackColor,
32
+ borderRadius,
33
+ height: trackHeight
34
+ },
35
+ style
36
+ ],
37
+ [borderRadius, style, trackColor, trackHeight]
38
+ );
39
+ const determinateIndicatorStyle = useMemo(
40
+ () => ({
41
+ alignSelf: I18nManager.isRTL ? "flex-end" : "flex-start",
42
+ backgroundColor: indicatorColor,
43
+ borderRadius,
44
+ height: trackHeight,
45
+ width: `${fraction * 100}%`
46
+ }),
47
+ [borderRadius, fraction, indicatorColor, trackHeight]
48
+ );
49
+ return /* @__PURE__ */ jsxs(View, { ...props, onLayout: handleLayout, style: trackStyle, children: [
50
+ indeterminate ? /* @__PURE__ */ jsx(
51
+ LinearIndeterminateIndicator,
52
+ {
53
+ animationDuration,
54
+ borderRadius,
55
+ color: indicatorColor,
56
+ ratio: indeterminateWidth,
57
+ trackHeight,
58
+ trackWidth
59
+ }
60
+ ) : null,
61
+ !indeterminate ? /* @__PURE__ */ jsx(View, { style: determinateIndicatorStyle }) : null
62
+ ] });
63
+ });
64
+ export {
65
+ LinearProgress
66
+ };
67
+ //# sourceMappingURL=linear-progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/linear-progress.tsx"],"sourcesContent":["import type { LayoutChangeEvent } from \"react-native\";\nimport { memo, useCallback, useMemo, useState } from \"react\";\nimport { I18nManager, View } from \"react-native\";\n\nimport type { LinearProgressProps } from \"../types/progress-internal.types\";\nimport { ProgressTrackStyles as styles } from \"../constants/progress.constants\";\nimport { LinearIndeterminateIndicator } from \"./linear-indeterminate-indicator\";\n\nexport const LinearProgress = memo(function LinearProgress({\n animationDuration,\n borderRadius,\n fraction,\n indicatorColor,\n indeterminate,\n indeterminateWidth,\n onLayout,\n style,\n trackColor,\n trackHeight,\n ...props\n}: LinearProgressProps) {\n const [trackWidth, setTrackWidth] = useState(0);\n\n const handleLayout = useCallback(\n (event: LayoutChangeEvent) => {\n setTrackWidth(event.nativeEvent.layout.width);\n onLayout?.(event);\n },\n [onLayout],\n );\n\n const trackStyle = useMemo(\n () => [\n styles.track,\n {\n backgroundColor: trackColor,\n borderRadius,\n height: trackHeight,\n },\n style,\n ],\n [borderRadius, style, trackColor, trackHeight],\n );\n\n const determinateIndicatorStyle = useMemo(\n () => ({\n alignSelf: I18nManager.isRTL\n ? (\"flex-end\" as const)\n : (\"flex-start\" as const),\n backgroundColor: indicatorColor,\n borderRadius,\n height: trackHeight,\n width: `${fraction * 100}%` as const,\n }),\n [borderRadius, fraction, indicatorColor, trackHeight],\n );\n\n return (\n <View {...props} onLayout={handleLayout} style={trackStyle}>\n {indeterminate ? (\n <LinearIndeterminateIndicator\n animationDuration={animationDuration}\n borderRadius={borderRadius}\n color={indicatorColor}\n ratio={indeterminateWidth}\n trackHeight={trackHeight}\n trackWidth={trackWidth}\n />\n ) : null}\n {!indeterminate ? <View style={determinateIndicatorStyle} /> : null}\n </View>\n );\n});\n"],"mappings":"AA0DI,SAEI,KAFJ;AAzDJ,SAAS,MAAM,aAAa,SAAS,gBAAgB;AACrD,SAAS,aAAa,YAAY;AAGlC,SAAS,uBAAuB,cAAc;AAC9C,SAAS,oCAAoC;AAEtC,MAAM,iBAAiB,KAAK,SAASA,gBAAe;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAwB;AACtB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,CAAC;AAE9C,QAAM,eAAe;AAAA,IACnB,CAAC,UAA6B;AAC5B,oBAAc,MAAM,YAAY,OAAO,KAAK;AAC5C,iBAAW,KAAK;AAAA,IAClB;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,QAAM,aAAa;AAAA,IACjB,MAAM;AAAA,MACJ,OAAO;AAAA,MACP;AAAA,QACE,iBAAiB;AAAA,QACjB;AAAA,QACA,QAAQ;AAAA,MACV;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,cAAc,OAAO,YAAY,WAAW;AAAA,EAC/C;AAEA,QAAM,4BAA4B;AAAA,IAChC,OAAO;AAAA,MACL,WAAW,YAAY,QAClB,aACA;AAAA,MACL,iBAAiB;AAAA,MACjB;AAAA,MACA,QAAQ;AAAA,MACR,OAAO,GAAG,WAAW,GAAG;AAAA,IAC1B;AAAA,IACA,CAAC,cAAc,UAAU,gBAAgB,WAAW;AAAA,EACtD;AAEA,SACE,qBAAC,QAAM,GAAG,OAAO,UAAU,cAAc,OAAO,YAC7C;AAAA,oBACC;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP,OAAO;AAAA,QACP;AAAA,QACA;AAAA;AAAA,IACF,IACE;AAAA,IACH,CAAC,gBAAgB,oBAAC,QAAK,OAAO,2BAA2B,IAAK;AAAA,KACjE;AAEJ,CAAC;","names":["LinearProgress"]}
@@ -0,0 +1,8 @@
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { ProgressCircleProps } from '../types/progress-internal.types.mjs';
4
+ import 'react-native';
5
+
6
+ declare const ProgressCircle: react.MemoExoticComponent<({ color, fraction, strokeWidth, trackColor, width, }: ProgressCircleProps) => react_jsx_runtime.JSX.Element>;
7
+
8
+ export { ProgressCircle };
@@ -0,0 +1,49 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { memo, useMemo } from "react";
3
+ import Svg, { Circle, G } from "react-native-svg";
4
+ const ProgressCircle = memo(function ProgressCircle2({
5
+ color,
6
+ fraction,
7
+ strokeWidth,
8
+ trackColor,
9
+ width
10
+ }) {
11
+ const center = width / 2;
12
+ const radius = (width - strokeWidth) / 2;
13
+ const circumference = 2 * Math.PI * radius;
14
+ const strokeDasharray = useMemo(
15
+ () => [circumference, circumference],
16
+ [circumference]
17
+ );
18
+ return /* @__PURE__ */ jsxs(Svg, { height: width, width, children: [
19
+ /* @__PURE__ */ jsx(
20
+ Circle,
21
+ {
22
+ cx: center,
23
+ cy: center,
24
+ fill: "none",
25
+ r: radius,
26
+ stroke: trackColor,
27
+ strokeWidth
28
+ }
29
+ ),
30
+ /* @__PURE__ */ jsx(G, { origin: `${center}, ${center}`, rotation: -90, children: /* @__PURE__ */ jsx(
31
+ Circle,
32
+ {
33
+ cx: center,
34
+ cy: center,
35
+ fill: "none",
36
+ r: radius,
37
+ stroke: color,
38
+ strokeDasharray,
39
+ strokeDashoffset: circumference * (1 - fraction),
40
+ strokeLinecap: fraction === 0 ? "butt" : "round",
41
+ strokeWidth
42
+ }
43
+ ) })
44
+ ] });
45
+ });
46
+ export {
47
+ ProgressCircle
48
+ };
49
+ //# sourceMappingURL=progress-circle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/progress-circle.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport Svg, { Circle, G } from \"react-native-svg\";\n\nimport type { ProgressCircleProps } from \"../types/progress-internal.types\";\n\nexport const ProgressCircle = memo(function ProgressCircle({\n color,\n fraction,\n strokeWidth,\n trackColor,\n width,\n}: ProgressCircleProps) {\n const center = width / 2;\n const radius = (width - strokeWidth) / 2;\n const circumference = 2 * Math.PI * radius;\n\n const strokeDasharray = useMemo(\n () => [circumference, circumference],\n [circumference],\n );\n\n return (\n <Svg height={width} width={width}>\n <Circle\n cx={center}\n cy={center}\n fill=\"none\"\n r={radius}\n stroke={trackColor}\n strokeWidth={strokeWidth}\n />\n <G origin={`${center}, ${center}`} rotation={-90}>\n <Circle\n cx={center}\n cy={center}\n fill=\"none\"\n r={radius}\n stroke={color}\n strokeDasharray={strokeDasharray}\n strokeDashoffset={circumference * (1 - fraction)}\n strokeLinecap={fraction === 0 ? \"butt\" : \"round\"}\n strokeWidth={strokeWidth}\n />\n </G>\n </Svg>\n );\n});\n"],"mappings":"AAsBI,SACE,KADF;AAtBJ,SAAS,MAAM,eAAe;AAC9B,OAAO,OAAO,QAAQ,SAAS;AAIxB,MAAM,iBAAiB,KAAK,SAASA,gBAAe;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAwB;AACtB,QAAM,SAAS,QAAQ;AACvB,QAAM,UAAU,QAAQ,eAAe;AACvC,QAAM,gBAAgB,IAAI,KAAK,KAAK;AAEpC,QAAM,kBAAkB;AAAA,IACtB,MAAM,CAAC,eAAe,aAAa;AAAA,IACnC,CAAC,aAAa;AAAA,EAChB;AAEA,SACE,qBAAC,OAAI,QAAQ,OAAO,OAClB;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAK;AAAA,QACL,GAAG;AAAA,QACH,QAAQ;AAAA,QACR;AAAA;AAAA,IACF;AAAA,IACA,oBAAC,KAAE,QAAQ,GAAG,MAAM,KAAK,MAAM,IAAI,UAAU,KAC3C;AAAA,MAAC;AAAA;AAAA,QACC,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAK;AAAA,QACL,GAAG;AAAA,QACH,QAAQ;AAAA,QACR;AAAA,QACA,kBAAkB,iBAAiB,IAAI;AAAA,QACvC,eAAe,aAAa,IAAI,SAAS;AAAA,QACzC;AAAA;AAAA,IACF,GACF;AAAA,KACF;AAEJ,CAAC;","names":["ProgressCircle"]}
@@ -0,0 +1,9 @@
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { ProgressProps } from '../types/progress.types.mjs';
4
+ import 'react-native';
5
+ import '@impulse-ui-native/theme';
6
+
7
+ declare const Progress: react.MemoExoticComponent<({ color, max, min, size, tone, trackColor, value, variant, ...props }: ProgressProps) => react_jsx_runtime.JSX.Element>;
8
+
9
+ export { Progress };
@@ -0,0 +1,69 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { memo, useMemo } from "react";
3
+ import { useComponentsTokens } from "@impulse-ui-native/theme";
4
+ import { normalizeProgressValue } from "../utils/progress.utils";
5
+ import { CircularProgress } from "./circular-progress";
6
+ import { LinearProgress } from "./linear-progress";
7
+ const Progress = memo(function Progress2({
8
+ color,
9
+ max = 100,
10
+ min = 0,
11
+ size = "medium",
12
+ tone = "primary",
13
+ trackColor,
14
+ value,
15
+ variant = "linear",
16
+ ...props
17
+ }) {
18
+ const tokens = useComponentsTokens().progress;
19
+ const sizeTokens = tokens.sizes[size];
20
+ const colorTokens = tokens.colors[tone];
21
+ const normalized = useMemo(
22
+ () => normalizeProgressValue(value, min, max),
23
+ [max, min, value]
24
+ );
25
+ const indeterminate = normalized.value === void 0;
26
+ const commonProps = useMemo(
27
+ () => ({
28
+ ...props,
29
+ animationDuration: tokens.animationDuration,
30
+ fraction: normalized.fraction,
31
+ indicatorColor: color ?? colorTokens.indicatorColor,
32
+ indeterminate,
33
+ trackColor: trackColor ?? colorTokens.trackColor
34
+ }),
35
+ [
36
+ color,
37
+ colorTokens.indicatorColor,
38
+ colorTokens.trackColor,
39
+ indeterminate,
40
+ normalized.fraction,
41
+ props,
42
+ tokens.animationDuration,
43
+ trackColor
44
+ ]
45
+ );
46
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
47
+ variant === "circular" ? /* @__PURE__ */ jsx(
48
+ CircularProgress,
49
+ {
50
+ ...commonProps,
51
+ strokeWidth: sizeTokens.circularStrokeWidth,
52
+ width: sizeTokens.circularSize
53
+ }
54
+ ) : null,
55
+ variant === "linear" ? /* @__PURE__ */ jsx(
56
+ LinearProgress,
57
+ {
58
+ ...commonProps,
59
+ borderRadius: tokens.borderRadius,
60
+ indeterminateWidth: tokens.indeterminateLinearWidth,
61
+ trackHeight: sizeTokens.linearHeight
62
+ }
63
+ ) : null
64
+ ] });
65
+ });
66
+ export {
67
+ Progress
68
+ };
69
+ //# sourceMappingURL=progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/progress.tsx"],"sourcesContent":["import { memo, useMemo } from \"react\";\n\nimport { useComponentsTokens } from \"@impulse-ui-native/theme\";\n\nimport type { ProgressProps } from \"../types\";\nimport { normalizeProgressValue } from \"../utils/progress.utils\";\nimport { CircularProgress } from \"./circular-progress\";\nimport { LinearProgress } from \"./linear-progress\";\n\nexport const Progress = memo(function Progress({\n color,\n max = 100,\n min = 0,\n size = \"medium\",\n tone = \"primary\",\n trackColor,\n value,\n variant = \"linear\",\n ...props\n}: ProgressProps) {\n const tokens = useComponentsTokens().progress;\n const sizeTokens = tokens.sizes[size];\n const colorTokens = tokens.colors[tone];\n\n const normalized = useMemo(\n () => normalizeProgressValue(value, min, max),\n [max, min, value],\n );\n\n const indeterminate = normalized.value === undefined;\n\n const commonProps = useMemo(\n () => ({\n ...props,\n animationDuration: tokens.animationDuration,\n fraction: normalized.fraction,\n indicatorColor: color ?? colorTokens.indicatorColor,\n indeterminate,\n trackColor: trackColor ?? colorTokens.trackColor,\n }),\n [\n color,\n colorTokens.indicatorColor,\n colorTokens.trackColor,\n indeterminate,\n normalized.fraction,\n props,\n tokens.animationDuration,\n trackColor,\n ],\n );\n\n return (\n <>\n {variant === \"circular\" ? (\n <CircularProgress\n {...commonProps}\n strokeWidth={sizeTokens.circularStrokeWidth}\n width={sizeTokens.circularSize}\n />\n ) : null}\n {variant === \"linear\" ? (\n <LinearProgress\n {...commonProps}\n borderRadius={tokens.borderRadius}\n indeterminateWidth={tokens.indeterminateLinearWidth}\n trackHeight={sizeTokens.linearHeight}\n />\n ) : null}\n </>\n );\n});\n"],"mappings":"AAqDI,mBAEI,KAFJ;AArDJ,SAAS,MAAM,eAAe;AAE9B,SAAS,2BAA2B;AAGpC,SAAS,8BAA8B;AACvC,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAExB,MAAM,WAAW,KAAK,SAASA,UAAS;AAAA,EAC7C;AAAA,EACA,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,GAAkB;AAChB,QAAM,SAAS,oBAAoB,EAAE;AACrC,QAAM,aAAa,OAAO,MAAM,IAAI;AACpC,QAAM,cAAc,OAAO,OAAO,IAAI;AAEtC,QAAM,aAAa;AAAA,IACjB,MAAM,uBAAuB,OAAO,KAAK,GAAG;AAAA,IAC5C,CAAC,KAAK,KAAK,KAAK;AAAA,EAClB;AAEA,QAAM,gBAAgB,WAAW,UAAU;AAE3C,QAAM,cAAc;AAAA,IAClB,OAAO;AAAA,MACL,GAAG;AAAA,MACH,mBAAmB,OAAO;AAAA,MAC1B,UAAU,WAAW;AAAA,MACrB,gBAAgB,SAAS,YAAY;AAAA,MACrC;AAAA,MACA,YAAY,cAAc,YAAY;AAAA,IACxC;AAAA,IACA;AAAA,MACE;AAAA,MACA,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA,OAAO;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAEA,SACE,iCACG;AAAA,gBAAY,aACX;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,aAAa,WAAW;AAAA,QACxB,OAAO,WAAW;AAAA;AAAA,IACpB,IACE;AAAA,IACH,YAAY,WACX;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,cAAc,OAAO;AAAA,QACrB,oBAAoB,OAAO;AAAA,QAC3B,aAAa,WAAW;AAAA;AAAA,IAC1B,IACE;AAAA,KACN;AAEJ,CAAC;","names":["Progress"]}
@@ -0,0 +1,14 @@
1
+ declare const ProgressTrackStyles: {
2
+ track: {
3
+ overflow: "hidden";
4
+ width: "100%";
5
+ };
6
+ };
7
+ declare const ProgressRootStyles: {
8
+ root: {
9
+ alignItems: "center";
10
+ justifyContent: "center";
11
+ };
12
+ };
13
+
14
+ export { ProgressRootStyles, ProgressTrackStyles };
@@ -0,0 +1,12 @@
1
+ import { StyleSheet } from "react-native";
2
+ const ProgressTrackStyles = StyleSheet.create({
3
+ track: { overflow: "hidden", width: "100%" }
4
+ });
5
+ const ProgressRootStyles = StyleSheet.create({
6
+ root: { alignItems: "center", justifyContent: "center" }
7
+ });
8
+ export {
9
+ ProgressRootStyles,
10
+ ProgressTrackStyles
11
+ };
12
+ //# sourceMappingURL=progress.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/constants/progress.constants.ts"],"sourcesContent":["import { StyleSheet } from \"react-native\";\n\nexport const ProgressTrackStyles = StyleSheet.create({\n track: { overflow: \"hidden\", width: \"100%\" },\n});\n\nexport const ProgressRootStyles = StyleSheet.create({\n root: { alignItems: \"center\", justifyContent: \"center\" },\n});\n"],"mappings":"AAAA,SAAS,kBAAkB;AAEpB,MAAM,sBAAsB,WAAW,OAAO;AAAA,EACnD,OAAO,EAAE,UAAU,UAAU,OAAO,OAAO;AAC7C,CAAC;AAEM,MAAM,qBAAqB,WAAW,OAAO;AAAA,EAClD,MAAM,EAAE,YAAY,UAAU,gBAAgB,SAAS;AACzD,CAAC;","names":[]}
@@ -0,0 +1,5 @@
1
+ import * as react_native_reanimated from 'react-native-reanimated';
2
+
3
+ declare function useIndeterminateProgressAnimation(duration: number): react_native_reanimated.SharedValue<number>;
4
+
5
+ export { useIndeterminateProgressAnimation };
@@ -0,0 +1,25 @@
1
+ import { useEffect } from "react";
2
+ import {
3
+ cancelAnimation,
4
+ Easing,
5
+ useSharedValue,
6
+ withRepeat,
7
+ withTiming
8
+ } from "react-native-reanimated";
9
+ function useIndeterminateProgressAnimation(duration) {
10
+ const progress = useSharedValue(0);
11
+ useEffect(() => {
12
+ progress.value = 0;
13
+ progress.value = withRepeat(
14
+ withTiming(1, { duration, easing: Easing.linear }),
15
+ -1,
16
+ false
17
+ );
18
+ return () => cancelAnimation(progress);
19
+ }, [duration, progress]);
20
+ return progress;
21
+ }
22
+ export {
23
+ useIndeterminateProgressAnimation
24
+ };
25
+ //# 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 } from \"react\";\nimport {\n cancelAnimation,\n Easing,\n useSharedValue,\n withRepeat,\n withTiming,\n} from \"react-native-reanimated\";\n\nexport function useIndeterminateProgressAnimation(duration: number) {\n const progress = useSharedValue(0);\n\n useEffect(() => {\n progress.value = 0;\n progress.value = withRepeat(\n withTiming(1, { duration, easing: Easing.linear }),\n -1,\n false,\n );\n\n return () => cancelAnimation(progress);\n }, [duration, progress]);\n\n return progress;\n}\n"],"mappings":"AAAA,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,SAAS,kCAAkC,UAAkB;AAClE,QAAM,WAAW,eAAe,CAAC;AAEjC,YAAU,MAAM;AACd,aAAS,QAAQ;AACjB,aAAS,QAAQ;AAAA,MACf,WAAW,GAAG,EAAE,UAAU,QAAQ,OAAO,OAAO,CAAC;AAAA,MACjD;AAAA,MACA;AAAA,IACF;AAEA,WAAO,MAAM,gBAAgB,QAAQ;AAAA,EACvC,GAAG,CAAC,UAAU,QAAQ,CAAC;AAEvB,SAAO;AACT;","names":[]}
@@ -0,0 +1,6 @@
1
+ export { Progress } from './components/progress.mjs';
2
+ export { ProgressProps } from './types/progress.types.mjs';
3
+ import 'react';
4
+ import 'react/jsx-runtime';
5
+ import 'react-native';
6
+ import '@impulse-ui-native/theme';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./components";
2
+ export * from "./types";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./components\";\nexport * from \"./types\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,3 @@
1
+ export { ProgressProps } from './progress.types.mjs';
2
+ import 'react-native';
3
+ import '@impulse-ui-native/theme';
@@ -0,0 +1,2 @@
1
+ export * from "./progress.types";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from \"./progress.types\";\n"],"mappings":"AAAA,cAAc;","names":[]}
@@ -0,0 +1,45 @@
1
+ import { ColorValue, ViewProps } from 'react-native';
2
+
3
+ interface LinearProgressProps extends ViewProps {
4
+ animationDuration: number;
5
+ borderRadius: number;
6
+ fraction: number;
7
+ indicatorColor: ColorValue;
8
+ indeterminate: boolean;
9
+ indeterminateWidth: number;
10
+ trackColor: ColorValue;
11
+ trackHeight: number;
12
+ }
13
+ interface LinearIndeterminateIndicatorProps {
14
+ animationDuration: number;
15
+ borderRadius: number;
16
+ color: ColorValue;
17
+ ratio: number;
18
+ trackHeight: number;
19
+ trackWidth: number;
20
+ }
21
+ interface CircularProgressProps extends ViewProps {
22
+ animationDuration: number;
23
+ fraction: number;
24
+ indicatorColor: ColorValue;
25
+ indeterminate: boolean;
26
+ strokeWidth: number;
27
+ trackColor: ColorValue;
28
+ width: number;
29
+ }
30
+ interface ProgressCircleProps {
31
+ color: ColorValue;
32
+ fraction: number;
33
+ strokeWidth: number;
34
+ trackColor: ColorValue;
35
+ width: number;
36
+ }
37
+ interface CircularIndeterminateIndicatorProps {
38
+ animationDuration: number;
39
+ color: ColorValue;
40
+ strokeWidth: number;
41
+ trackColor: ColorValue;
42
+ width: number;
43
+ }
44
+
45
+ export type { CircularIndeterminateIndicatorProps, CircularProgressProps, LinearIndeterminateIndicatorProps, LinearProgressProps, ProgressCircleProps };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=progress-internal.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,15 @@
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 };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=progress.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,9 @@
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 };
@@ -0,0 +1,27 @@
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
@@ -0,0 +1 @@
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":[]}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@impulse-ui-native/progress",
3
+ "version": "6.0.0",
4
+ "description": "Progress components for ImpulseUI Native.",
5
+ "keywords": [
6
+ "react-native",
7
+ "progress",
8
+ "components"
9
+ ],
10
+ "license": "MIT",
11
+ "source": "src/index.ts",
12
+ "module": "dist/index.js",
13
+ "types": "dist/index.d.mts",
14
+ "react-native": "src/index.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.mts",
18
+ "react-native": "./src/index.ts",
19
+ "import": "./dist/index.js"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "README.md",
25
+ "LICENSE"
26
+ ],
27
+ "sideEffects": false,
28
+ "dependencies": {
29
+ "@impulse-ui-native/theme": "6.0.0"
30
+ },
31
+ "devDependencies": {
32
+ "@types/react": "~19.2.14",
33
+ "eslint": "^9.38.0",
34
+ "prettier": "^3.6.2",
35
+ "react": "19.2.3",
36
+ "react-native": "0.86.2",
37
+ "typescript": "~6.0.3",
38
+ "react-native-svg": "15.15.4",
39
+ "react-native-reanimated": "4.5.1",
40
+ "react-native-worklets": "0.10.1",
41
+ "@impulse-ui-native/eslint-config": "1.0.0",
42
+ "@impulse-ui-native/prettier-config": "1.0.0",
43
+ "@impulse-ui-native/tsconfig": "1.0.0"
44
+ },
45
+ "peerDependencies": {
46
+ "react": ">=18",
47
+ "react-native": ">=0.73",
48
+ "react-native-svg": ">=13.9.0",
49
+ "react-native-reanimated": ">=4.0.0",
50
+ "react-native-worklets": ">=0.5"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "prettier": "@impulse-ui-native/prettier-config",
56
+ "scripts": {
57
+ "build": "tsup --config tsup.config.ts",
58
+ "typecheck": "tsc -p tsconfig.json --noEmit",
59
+ "lint": "pnpm exec eslint . --fix",
60
+ "format": "prettier --write \"./**/*.{ts,tsx,js,jsx,json,md}\" --ignore-path ../../.prettierignore"
61
+ }
62
+ }