@impulse-ui-native/primitives 2.7.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 +49 -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.js +4 -3
- 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.js +3 -2
- 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
|
@@ -1,15 +1,23 @@
|
|
|
1
|
+
import { Avatar } from "./avatar";
|
|
1
2
|
import { View } from "./view";
|
|
2
3
|
import { SafeAreaView } from "./safe-area-view";
|
|
3
4
|
import { Typography } from "./typography";
|
|
4
5
|
import { Button } from "./button";
|
|
6
|
+
import { Divider } from "./divider";
|
|
5
7
|
import { IconButton } from "./icon-button";
|
|
6
8
|
import { Pressable } from "./pressable";
|
|
9
|
+
import { Progress } from "./progress";
|
|
10
|
+
import { Spinner } from "./spinner";
|
|
7
11
|
import { Tag } from "./tag";
|
|
8
12
|
export {
|
|
13
|
+
Avatar,
|
|
9
14
|
Button,
|
|
15
|
+
Divider,
|
|
10
16
|
IconButton,
|
|
11
17
|
Pressable,
|
|
18
|
+
Progress,
|
|
12
19
|
SafeAreaView,
|
|
20
|
+
Spinner,
|
|
13
21
|
Tag,
|
|
14
22
|
Typography,
|
|
15
23
|
View
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/atoms/index.ts"],"sourcesContent":["export { View } from \"./view\";\nexport { SafeAreaView } from \"./safe-area-view\";\nexport { Typography, type TypographyComponent } from \"./typography\";\nexport { Button } from \"./button\";\nexport { IconButton } from \"./icon-button\";\nexport { Pressable } from \"./pressable\";\nexport { Tag } from \"./tag\";\n"],"mappings":"AAAA,SAAS,YAAY;AACrB,SAAS,oBAAoB;AAC7B,SAAS,kBAA4C;AACrD,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,WAAW;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/atoms/index.ts"],"sourcesContent":["export { Avatar } from \"./avatar\";\nexport { View } from \"./view\";\nexport { SafeAreaView } from \"./safe-area-view\";\nexport { Typography, type TypographyComponent } from \"./typography\";\nexport { Button } from \"./button\";\nexport { Divider } from \"./divider\";\nexport { IconButton } from \"./icon-button\";\nexport { Pressable } from \"./pressable\";\nexport { Progress } from \"./progress\";\nexport { Spinner } from \"./spinner\";\nexport { Tag } from \"./tag\";\n"],"mappings":"AAAA,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,oBAAoB;AAC7B,SAAS,kBAA4C;AACrD,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,WAAW;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { ViewProps, ColorValue } from 'react-native';
|
|
4
|
+
|
|
5
|
+
interface LinearProgressProps extends ViewProps {
|
|
6
|
+
animationDuration: number;
|
|
7
|
+
borderRadius: number;
|
|
8
|
+
fraction: number;
|
|
9
|
+
indicatorColor: ColorValue;
|
|
10
|
+
indeterminate: boolean;
|
|
11
|
+
indeterminateWidth: number;
|
|
12
|
+
trackColor: ColorValue;
|
|
13
|
+
trackHeight: number;
|
|
14
|
+
}
|
|
15
|
+
declare const LinearProgress: react.MemoExoticComponent<({ animationDuration, borderRadius, fraction, indicatorColor, indeterminate, indeterminateWidth, onLayout, style, trackColor, trackHeight, ...props }: LinearProgressProps) => react_jsx_runtime.JSX.Element>;
|
|
16
|
+
|
|
17
|
+
export { LinearProgress };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback, useMemo, useState } from "react";
|
|
3
|
+
import { Animated, I18nManager, StyleSheet, View } from "react-native";
|
|
4
|
+
import { useIndeterminateProgressAnimation } from "../../hooks/use-indeterminate-progress-animation.hook";
|
|
5
|
+
const LinearProgress = memo(function LinearProgress2({
|
|
6
|
+
animationDuration,
|
|
7
|
+
borderRadius,
|
|
8
|
+
fraction,
|
|
9
|
+
indicatorColor,
|
|
10
|
+
indeterminate,
|
|
11
|
+
indeterminateWidth,
|
|
12
|
+
onLayout,
|
|
13
|
+
style,
|
|
14
|
+
trackColor,
|
|
15
|
+
trackHeight,
|
|
16
|
+
...props
|
|
17
|
+
}) {
|
|
18
|
+
const [trackWidth, setTrackWidth] = useState(0);
|
|
19
|
+
const handleLayout = useCallback(
|
|
20
|
+
(event) => {
|
|
21
|
+
setTrackWidth(event.nativeEvent.layout.width);
|
|
22
|
+
onLayout?.(event);
|
|
23
|
+
},
|
|
24
|
+
[onLayout]
|
|
25
|
+
);
|
|
26
|
+
const trackStyle = useMemo(
|
|
27
|
+
() => [
|
|
28
|
+
styles.track,
|
|
29
|
+
{
|
|
30
|
+
backgroundColor: trackColor,
|
|
31
|
+
borderRadius,
|
|
32
|
+
height: trackHeight
|
|
33
|
+
},
|
|
34
|
+
style
|
|
35
|
+
],
|
|
36
|
+
[borderRadius, style, trackColor, trackHeight]
|
|
37
|
+
);
|
|
38
|
+
const determinateIndicatorStyle = useMemo(
|
|
39
|
+
() => ({
|
|
40
|
+
alignSelf: I18nManager.isRTL ? "flex-end" : "flex-start",
|
|
41
|
+
backgroundColor: indicatorColor,
|
|
42
|
+
borderRadius,
|
|
43
|
+
height: trackHeight,
|
|
44
|
+
width: `${fraction * 100}%`
|
|
45
|
+
}),
|
|
46
|
+
[borderRadius, fraction, indicatorColor, trackHeight]
|
|
47
|
+
);
|
|
48
|
+
return /* @__PURE__ */ jsx(View, { ...props, onLayout: handleLayout, style: trackStyle, children: indeterminate ? /* @__PURE__ */ jsx(
|
|
49
|
+
LinearIndeterminateIndicator,
|
|
50
|
+
{
|
|
51
|
+
animationDuration,
|
|
52
|
+
borderRadius,
|
|
53
|
+
color: indicatorColor,
|
|
54
|
+
ratio: indeterminateWidth,
|
|
55
|
+
trackHeight,
|
|
56
|
+
trackWidth
|
|
57
|
+
}
|
|
58
|
+
) : /* @__PURE__ */ jsx(View, { style: determinateIndicatorStyle }) });
|
|
59
|
+
});
|
|
60
|
+
const LinearIndeterminateIndicator = memo(
|
|
61
|
+
function LinearIndeterminateIndicator2({
|
|
62
|
+
animationDuration,
|
|
63
|
+
borderRadius,
|
|
64
|
+
color,
|
|
65
|
+
ratio,
|
|
66
|
+
trackHeight,
|
|
67
|
+
trackWidth
|
|
68
|
+
}) {
|
|
69
|
+
const progress = useIndeterminateProgressAnimation(animationDuration);
|
|
70
|
+
const indicatorWidth = trackWidth * ratio;
|
|
71
|
+
const translateX = progress.interpolate({
|
|
72
|
+
inputRange: [0, 1],
|
|
73
|
+
outputRange: I18nManager.isRTL ? [trackWidth, -indicatorWidth] : [-indicatorWidth, trackWidth]
|
|
74
|
+
});
|
|
75
|
+
const indicatorStyle = useMemo(
|
|
76
|
+
() => ({
|
|
77
|
+
backgroundColor: color,
|
|
78
|
+
borderRadius,
|
|
79
|
+
height: trackHeight,
|
|
80
|
+
transform: [{ translateX }],
|
|
81
|
+
width: `${ratio * 100}%`
|
|
82
|
+
}),
|
|
83
|
+
[borderRadius, color, ratio, trackHeight, translateX]
|
|
84
|
+
);
|
|
85
|
+
return /* @__PURE__ */ jsx(Animated.View, { style: indicatorStyle });
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
const styles = StyleSheet.create({
|
|
89
|
+
track: {
|
|
90
|
+
overflow: "hidden",
|
|
91
|
+
width: "100%"
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
export {
|
|
95
|
+
LinearProgress
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=linear-progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/atoms/linear-progress.tsx"],"sourcesContent":["import type { ColorValue, LayoutChangeEvent, ViewProps } from \"react-native\";\nimport { memo, useCallback, useMemo, useState } from \"react\";\nimport { Animated, I18nManager, StyleSheet, View } from \"react-native\";\n\nimport { useIndeterminateProgressAnimation } from \"../../hooks/use-indeterminate-progress-animation.hook\";\n\ninterface LinearProgressProps extends ViewProps {\n animationDuration: number;\n borderRadius: number;\n fraction: number;\n indicatorColor: ColorValue;\n indeterminate: boolean;\n indeterminateWidth: number;\n trackColor: ColorValue;\n trackHeight: number;\n}\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 ) : (\n <View style={determinateIndicatorStyle} />\n )}\n </View>\n );\n});\n\ninterface LinearIndeterminateIndicatorProps {\n animationDuration: number;\n borderRadius: number;\n color: ColorValue;\n ratio: number;\n trackHeight: number;\n trackWidth: number;\n}\n\nconst 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 const indicatorWidth = trackWidth * ratio;\n const translateX = progress.interpolate({\n inputRange: [0, 1],\n outputRange: I18nManager.isRTL\n ? [trackWidth, -indicatorWidth]\n : [-indicatorWidth, trackWidth],\n });\n\n const indicatorStyle = useMemo(\n () => ({\n backgroundColor: color,\n borderRadius,\n height: trackHeight,\n transform: [{ translateX }],\n width: `${ratio * 100}%` as const,\n }),\n [borderRadius, color, ratio, trackHeight, translateX],\n );\n\n return <Animated.View style={indicatorStyle} />;\n },\n);\n\nconst styles = StyleSheet.create({\n track: {\n overflow: \"hidden\",\n width: \"100%\",\n },\n});\n"],"mappings":"AAqEQ;AApER,SAAS,MAAM,aAAa,SAAS,gBAAgB;AACrD,SAAS,UAAU,aAAa,YAAY,YAAY;AAExD,SAAS,yCAAyC;AAa3C,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,oBAAC,QAAM,GAAG,OAAO,UAAU,cAAc,OAAO,YAC7C,0BACC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP,OAAO;AAAA,MACP;AAAA,MACA;AAAA;AAAA,EACF,IAEA,oBAAC,QAAK,OAAO,2BAA2B,GAE5C;AAEJ,CAAC;AAWD,MAAM,+BAA+B;AAAA,EACnC,SAASC,8BAA6B;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAAsC;AACpC,UAAM,WAAW,kCAAkC,iBAAiB;AACpE,UAAM,iBAAiB,aAAa;AACpC,UAAM,aAAa,SAAS,YAAY;AAAA,MACtC,YAAY,CAAC,GAAG,CAAC;AAAA,MACjB,aAAa,YAAY,QACrB,CAAC,YAAY,CAAC,cAAc,IAC5B,CAAC,CAAC,gBAAgB,UAAU;AAAA,IAClC,CAAC;AAED,UAAM,iBAAiB;AAAA,MACrB,OAAO;AAAA,QACL,iBAAiB;AAAA,QACjB;AAAA,QACA,QAAQ;AAAA,QACR,WAAW,CAAC,EAAE,WAAW,CAAC;AAAA,QAC1B,OAAO,GAAG,QAAQ,GAAG;AAAA,MACvB;AAAA,MACA,CAAC,cAAc,OAAO,OAAO,aAAa,UAAU;AAAA,IACtD;AAEA,WAAO,oBAAC,SAAS,MAAT,EAAc,OAAO,gBAAgB;AAAA,EAC/C;AACF;AAEA,MAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,OAAO;AAAA,IACL,UAAU;AAAA,IACV,OAAO;AAAA,EACT;AACF,CAAC;","names":["LinearProgress","LinearIndeterminateIndicator"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import * as react_native from 'react-native';
|
|
1
2
|
import * as react from 'react';
|
|
2
|
-
import { PropsWithChildren } from 'react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
3
|
import { PressableCoreProps } from '../../types/button.types.mjs';
|
|
5
|
-
import 'react-native';
|
|
6
4
|
import '@impulse-ui-native/theme';
|
|
7
5
|
|
|
8
|
-
declare const Pressable: react.
|
|
6
|
+
declare const Pressable: react.NamedExoticComponent<PressableCoreProps & {
|
|
7
|
+
children?: react.ReactNode | undefined;
|
|
8
|
+
} & react.RefAttributes<react_native.View>>;
|
|
9
9
|
|
|
10
10
|
export { Pressable };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useCallback } from "react";
|
|
2
|
+
import { forwardRef, memo, useCallback } from "react";
|
|
3
3
|
import {
|
|
4
4
|
Pressable as RNPressable,
|
|
5
5
|
StyleSheet
|
|
@@ -10,49 +10,54 @@ import {
|
|
|
10
10
|
useComponentsTokens,
|
|
11
11
|
useStyleProps
|
|
12
12
|
} from "@impulse-ui-native/theme";
|
|
13
|
-
const Pressable = memo(
|
|
14
|
-
children,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
13
|
+
const Pressable = memo(
|
|
14
|
+
forwardRef(function PressableCore({ children, disabled, pressedStyle, style, ...props }, ref) {
|
|
15
|
+
const colors = useColors();
|
|
16
|
+
const tokens = useComponentsTokens();
|
|
17
|
+
const pressableTokens = tokens.pressable;
|
|
18
|
+
const extractedStyleProps = useStyleProps(props);
|
|
19
|
+
const pressableStyles = useCallback(
|
|
20
|
+
(state) => {
|
|
21
|
+
let overrideStyle;
|
|
22
|
+
if (typeof style === "function") {
|
|
23
|
+
overrideStyle = style(state);
|
|
24
|
+
} else {
|
|
25
|
+
overrideStyle = style;
|
|
26
|
+
}
|
|
27
|
+
return StyleSheet.flatten([
|
|
28
|
+
{
|
|
29
|
+
opacity: disabled ? pressableTokens.disabledOpacity : state.pressed ? pressableTokens.pressedOpacity : 1
|
|
30
|
+
},
|
|
31
|
+
getShadowStyle(props.shadow, props.shadowPosition, colors),
|
|
32
|
+
extractedStyleProps,
|
|
33
|
+
overrideStyle,
|
|
34
|
+
state.pressed ? pressedStyle : void 0
|
|
35
|
+
]);
|
|
36
|
+
},
|
|
37
|
+
[
|
|
38
|
+
style,
|
|
39
|
+
pressedStyle,
|
|
40
|
+
disabled,
|
|
37
41
|
extractedStyleProps,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
})
|
|
42
|
+
props.shadow,
|
|
43
|
+
props.shadowPosition,
|
|
44
|
+
colors,
|
|
45
|
+
pressableTokens.disabledOpacity,
|
|
46
|
+
pressableTokens.pressedOpacity
|
|
47
|
+
]
|
|
48
|
+
);
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
RNPressable,
|
|
51
|
+
{
|
|
52
|
+
...props,
|
|
53
|
+
ref,
|
|
54
|
+
style: pressableStyles,
|
|
55
|
+
disabled,
|
|
56
|
+
children
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
})
|
|
60
|
+
);
|
|
56
61
|
export {
|
|
57
62
|
Pressable
|
|
58
63
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/atoms/pressable.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/atoms/pressable.tsx"],"sourcesContent":["import type { ComponentRef, PropsWithChildren } from \"react\";\nimport { forwardRef, memo, useCallback } from \"react\";\nimport {\n PressableStateCallbackType,\n Pressable as RNPressable,\n StyleProp,\n StyleSheet,\n ViewStyle,\n} from \"react-native\";\n\nimport {\n getShadowStyle,\n useColors,\n useComponentsTokens,\n useStyleProps,\n} from \"@impulse-ui-native/theme\";\n\nimport { PressableCoreProps } from \"../../types\";\n\nexport const Pressable = memo(\n forwardRef<\n ComponentRef<typeof RNPressable>,\n PropsWithChildren<PressableCoreProps>\n >(function PressableCore(\n { children, disabled, pressedStyle, style, ...props },\n ref,\n ) {\n const colors = useColors();\n const tokens = useComponentsTokens();\n const pressableTokens = tokens.pressable;\n const extractedStyleProps = useStyleProps(props);\n\n const pressableStyles = useCallback(\n (state: PressableStateCallbackType): StyleProp<ViewStyle> => {\n let overrideStyle: StyleProp<ViewStyle>;\n\n if (typeof style === \"function\") {\n overrideStyle = style(state);\n } else {\n overrideStyle = style;\n }\n\n return StyleSheet.flatten([\n {\n opacity: disabled\n ? pressableTokens.disabledOpacity\n : state.pressed\n ? pressableTokens.pressedOpacity\n : 1,\n },\n getShadowStyle(props.shadow, props.shadowPosition, colors),\n extractedStyleProps,\n overrideStyle,\n state.pressed ? pressedStyle : undefined,\n ]);\n },\n [\n style,\n pressedStyle,\n disabled,\n extractedStyleProps,\n props.shadow,\n props.shadowPosition,\n colors,\n pressableTokens.disabledOpacity,\n pressableTokens.pressedOpacity,\n ],\n );\n\n return (\n <RNPressable\n {...props}\n ref={ref}\n style={pressableStyles}\n disabled={disabled}\n >\n {children}\n </RNPressable>\n );\n }),\n);\n"],"mappings":"AAsEM;AArEN,SAAS,YAAY,MAAM,mBAAmB;AAC9C;AAAA,EAEE,aAAa;AAAA,EAEb;AAAA,OAEK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,MAAM,YAAY;AAAA,EACvB,WAGE,SAAS,cACT,EAAE,UAAU,UAAU,cAAc,OAAO,GAAG,MAAM,GACpD,KACA;AACA,UAAM,SAAS,UAAU;AACzB,UAAM,SAAS,oBAAoB;AACnC,UAAM,kBAAkB,OAAO;AAC/B,UAAM,sBAAsB,cAAc,KAAK;AAE/C,UAAM,kBAAkB;AAAA,MACtB,CAAC,UAA4D;AAC3D,YAAI;AAEJ,YAAI,OAAO,UAAU,YAAY;AAC/B,0BAAgB,MAAM,KAAK;AAAA,QAC7B,OAAO;AACL,0BAAgB;AAAA,QAClB;AAEA,eAAO,WAAW,QAAQ;AAAA,UACxB;AAAA,YACE,SAAS,WACL,gBAAgB,kBAChB,MAAM,UACJ,gBAAgB,iBAChB;AAAA,UACR;AAAA,UACA,eAAe,MAAM,QAAQ,MAAM,gBAAgB,MAAM;AAAA,UACzD;AAAA,UACA;AAAA,UACA,MAAM,UAAU,eAAe;AAAA,QACjC,CAAC;AAAA,MACH;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,MAAM;AAAA,QACN,MAAM;AAAA,QACN;AAAA,QACA,gBAAgB;AAAA,QAChB,gBAAgB;AAAA,MAClB;AAAA,IACF;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ;AAAA,QACA,OAAO;AAAA,QACP;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,EAEJ,CAAC;AACH;","names":[]}
|
|
@@ -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<({ accessibilityRole, accessibilityState, accessibilityValue, accessible, color, max, min, size, tone, trackColor, value, variant, ...props }: ProgressProps) => react_jsx_runtime.JSX.Element>;
|
|
8
|
+
|
|
9
|
+
export { Progress };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx } 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
|
+
accessibilityRole = "progressbar",
|
|
9
|
+
accessibilityState,
|
|
10
|
+
accessibilityValue,
|
|
11
|
+
accessible = true,
|
|
12
|
+
color,
|
|
13
|
+
max = 100,
|
|
14
|
+
min = 0,
|
|
15
|
+
size = "medium",
|
|
16
|
+
tone = "primary",
|
|
17
|
+
trackColor,
|
|
18
|
+
value,
|
|
19
|
+
variant = "linear",
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
const tokens = useComponentsTokens().progress;
|
|
23
|
+
const sizeTokens = tokens.sizes[size];
|
|
24
|
+
const colorTokens = tokens.colors[tone];
|
|
25
|
+
const normalized = useMemo(
|
|
26
|
+
() => normalizeProgressValue(value, min, max),
|
|
27
|
+
[max, min, value]
|
|
28
|
+
);
|
|
29
|
+
const indeterminate = normalized.value === void 0;
|
|
30
|
+
const resolvedAccessibilityState = useMemo(
|
|
31
|
+
() => ({
|
|
32
|
+
...accessibilityState,
|
|
33
|
+
busy: indeterminate ? true : accessibilityState?.busy
|
|
34
|
+
}),
|
|
35
|
+
[accessibilityState, indeterminate]
|
|
36
|
+
);
|
|
37
|
+
const resolvedAccessibilityValue = useMemo(
|
|
38
|
+
() => ({
|
|
39
|
+
...accessibilityValue,
|
|
40
|
+
max: indeterminate ? void 0 : normalized.max,
|
|
41
|
+
min: indeterminate ? void 0 : normalized.min,
|
|
42
|
+
now: indeterminate ? void 0 : normalized.value
|
|
43
|
+
}),
|
|
44
|
+
[accessibilityValue, indeterminate, normalized]
|
|
45
|
+
);
|
|
46
|
+
const commonProps = useMemo(
|
|
47
|
+
() => ({
|
|
48
|
+
...props,
|
|
49
|
+
accessibilityRole,
|
|
50
|
+
accessibilityState: resolvedAccessibilityState,
|
|
51
|
+
accessibilityValue: resolvedAccessibilityValue,
|
|
52
|
+
accessible,
|
|
53
|
+
animationDuration: tokens.animationDuration,
|
|
54
|
+
fraction: normalized.fraction,
|
|
55
|
+
indicatorColor: color ?? colorTokens.indicatorColor,
|
|
56
|
+
indeterminate,
|
|
57
|
+
trackColor: trackColor ?? colorTokens.trackColor
|
|
58
|
+
}),
|
|
59
|
+
[
|
|
60
|
+
accessibilityRole,
|
|
61
|
+
accessible,
|
|
62
|
+
color,
|
|
63
|
+
colorTokens.indicatorColor,
|
|
64
|
+
colorTokens.trackColor,
|
|
65
|
+
indeterminate,
|
|
66
|
+
normalized.fraction,
|
|
67
|
+
props,
|
|
68
|
+
resolvedAccessibilityState,
|
|
69
|
+
resolvedAccessibilityValue,
|
|
70
|
+
tokens.animationDuration,
|
|
71
|
+
trackColor
|
|
72
|
+
]
|
|
73
|
+
);
|
|
74
|
+
return variant === "circular" ? /* @__PURE__ */ jsx(
|
|
75
|
+
CircularProgress,
|
|
76
|
+
{
|
|
77
|
+
...commonProps,
|
|
78
|
+
strokeWidth: sizeTokens.circularStrokeWidth,
|
|
79
|
+
width: sizeTokens.circularSize
|
|
80
|
+
}
|
|
81
|
+
) : /* @__PURE__ */ jsx(
|
|
82
|
+
LinearProgress,
|
|
83
|
+
{
|
|
84
|
+
...commonProps,
|
|
85
|
+
borderRadius: tokens.borderRadius,
|
|
86
|
+
indeterminateWidth: tokens.indeterminateLinearWidth,
|
|
87
|
+
trackHeight: sizeTokens.linearHeight
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
export {
|
|
92
|
+
Progress
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/atoms/progress.tsx"],"sourcesContent":["import type { AccessibilityState, AccessibilityValue } from \"react-native\";\nimport { 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 accessibilityRole = \"progressbar\",\n accessibilityState,\n accessibilityValue,\n accessible = true,\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 const normalized = useMemo(\n () => normalizeProgressValue(value, min, max),\n [max, min, value],\n );\n const indeterminate = normalized.value === undefined;\n\n const resolvedAccessibilityState = useMemo<AccessibilityState>(\n () => ({\n ...accessibilityState,\n busy: indeterminate ? true : accessibilityState?.busy,\n }),\n [accessibilityState, indeterminate],\n );\n\n const resolvedAccessibilityValue = useMemo<AccessibilityValue>(\n () => ({\n ...accessibilityValue,\n max: indeterminate ? undefined : normalized.max,\n min: indeterminate ? undefined : normalized.min,\n now: indeterminate ? undefined : normalized.value,\n }),\n [accessibilityValue, indeterminate, normalized],\n );\n\n const commonProps = useMemo(\n () => ({\n ...props,\n accessibilityRole,\n accessibilityState: resolvedAccessibilityState,\n accessibilityValue: resolvedAccessibilityValue,\n accessible,\n animationDuration: tokens.animationDuration,\n fraction: normalized.fraction,\n indicatorColor: color ?? colorTokens.indicatorColor,\n indeterminate,\n trackColor: trackColor ?? colorTokens.trackColor,\n }),\n [\n accessibilityRole,\n accessible,\n color,\n colorTokens.indicatorColor,\n colorTokens.trackColor,\n indeterminate,\n normalized.fraction,\n props,\n resolvedAccessibilityState,\n resolvedAccessibilityValue,\n tokens.animationDuration,\n trackColor,\n ],\n );\n\n return variant === \"circular\" ? (\n <CircularProgress\n {...commonProps}\n strokeWidth={sizeTokens.circularStrokeWidth}\n width={sizeTokens.circularSize}\n />\n ) : (\n <LinearProgress\n {...commonProps}\n borderRadius={tokens.borderRadius}\n indeterminateWidth={tokens.indeterminateLinearWidth}\n trackHeight={sizeTokens.linearHeight}\n />\n );\n});\n"],"mappings":"AAkFI;AAjFJ,SAAS,MAAM,eAAe;AAE9B,SAAS,2BAA2B;AAGpC,SAAS,8BAA8B;AACvC,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAExB,MAAM,WAAW,KAAK,SAASA,UAAS;AAAA,EAC7C,oBAAoB;AAAA,EACpB;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;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;AACtC,QAAM,aAAa;AAAA,IACjB,MAAM,uBAAuB,OAAO,KAAK,GAAG;AAAA,IAC5C,CAAC,KAAK,KAAK,KAAK;AAAA,EAClB;AACA,QAAM,gBAAgB,WAAW,UAAU;AAE3C,QAAM,6BAA6B;AAAA,IACjC,OAAO;AAAA,MACL,GAAG;AAAA,MACH,MAAM,gBAAgB,OAAO,oBAAoB;AAAA,IACnD;AAAA,IACA,CAAC,oBAAoB,aAAa;AAAA,EACpC;AAEA,QAAM,6BAA6B;AAAA,IACjC,OAAO;AAAA,MACL,GAAG;AAAA,MACH,KAAK,gBAAgB,SAAY,WAAW;AAAA,MAC5C,KAAK,gBAAgB,SAAY,WAAW;AAAA,MAC5C,KAAK,gBAAgB,SAAY,WAAW;AAAA,IAC9C;AAAA,IACA,CAAC,oBAAoB,eAAe,UAAU;AAAA,EAChD;AAEA,QAAM,cAAc;AAAA,IAClB,OAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,MACA,oBAAoB;AAAA,MACpB,oBAAoB;AAAA,MACpB;AAAA,MACA,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;AAAA,MACA;AAAA,MACA,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAEA,SAAO,YAAY,aACjB;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,aAAa,WAAW;AAAA,MACxB,OAAO,WAAW;AAAA;AAAA,EACpB,IAEA;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,cAAc,OAAO;AAAA,MACrB,oBAAoB,OAAO;AAAA,MAC3B,aAAa,WAAW;AAAA;AAAA,EAC1B;AAEJ,CAAC;","names":["Progress"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { SpinnerProps } from '../../types/spinner.types.mjs';
|
|
4
|
+
import 'react-native';
|
|
5
|
+
import '@impulse-ui-native/theme';
|
|
6
|
+
|
|
7
|
+
declare const Spinner: react.MemoExoticComponent<({ accessibilityRole, accessibilityState, accessible, animating, color, hidesWhenStopped, size, style, tone, ...props }: SpinnerProps) => react_jsx_runtime.JSX.Element>;
|
|
8
|
+
|
|
9
|
+
export { Spinner };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { ActivityIndicator, StyleSheet, View } from "react-native";
|
|
4
|
+
import { useComponentsTokens } from "@impulse-ui-native/theme";
|
|
5
|
+
const Spinner = memo(function Spinner2({
|
|
6
|
+
accessibilityRole = "progressbar",
|
|
7
|
+
accessibilityState,
|
|
8
|
+
accessible = true,
|
|
9
|
+
animating = true,
|
|
10
|
+
color,
|
|
11
|
+
hidesWhenStopped,
|
|
12
|
+
size = "medium",
|
|
13
|
+
style,
|
|
14
|
+
tone = "primary",
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
const tokens = useComponentsTokens().spinner;
|
|
18
|
+
const resolvedSize = tokens.sizes[size];
|
|
19
|
+
const resolvedAccessibilityState = useMemo(
|
|
20
|
+
() => ({
|
|
21
|
+
...accessibilityState,
|
|
22
|
+
busy: animating
|
|
23
|
+
}),
|
|
24
|
+
[accessibilityState, animating]
|
|
25
|
+
);
|
|
26
|
+
const containerStyle = useMemo(
|
|
27
|
+
() => [
|
|
28
|
+
styles.container,
|
|
29
|
+
{
|
|
30
|
+
width: resolvedSize,
|
|
31
|
+
height: resolvedSize
|
|
32
|
+
},
|
|
33
|
+
style
|
|
34
|
+
],
|
|
35
|
+
[resolvedSize, style]
|
|
36
|
+
);
|
|
37
|
+
const indicatorStyle = useMemo(
|
|
38
|
+
() => ({
|
|
39
|
+
transform: [{ scale: resolvedSize / tokens.baseSize }]
|
|
40
|
+
}),
|
|
41
|
+
[resolvedSize, tokens.baseSize]
|
|
42
|
+
);
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
View,
|
|
45
|
+
{
|
|
46
|
+
...props,
|
|
47
|
+
accessibilityRole,
|
|
48
|
+
accessibilityState: resolvedAccessibilityState,
|
|
49
|
+
accessible,
|
|
50
|
+
style: containerStyle,
|
|
51
|
+
children: /* @__PURE__ */ jsx(
|
|
52
|
+
ActivityIndicator,
|
|
53
|
+
{
|
|
54
|
+
accessible: false,
|
|
55
|
+
animating,
|
|
56
|
+
color: color ?? tokens.colors[tone],
|
|
57
|
+
hidesWhenStopped,
|
|
58
|
+
size: "small",
|
|
59
|
+
style: indicatorStyle
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
const styles = StyleSheet.create({
|
|
66
|
+
container: {
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
justifyContent: "center"
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
export {
|
|
72
|
+
Spinner
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/atoms/spinner.tsx"],"sourcesContent":["import type { AccessibilityState } from \"react-native\";\nimport { memo, useMemo } from \"react\";\nimport { ActivityIndicator, StyleSheet, View } from \"react-native\";\n\nimport { useComponentsTokens } from \"@impulse-ui-native/theme\";\n\nimport type { SpinnerProps } from \"../../types\";\n\nexport const Spinner = memo(function Spinner({\n accessibilityRole = \"progressbar\",\n accessibilityState,\n accessible = true,\n animating = true,\n color,\n hidesWhenStopped,\n size = \"medium\",\n style,\n tone = \"primary\",\n ...props\n}: SpinnerProps) {\n const tokens = useComponentsTokens().spinner;\n const resolvedSize = tokens.sizes[size];\n\n const resolvedAccessibilityState = useMemo<AccessibilityState>(\n () => ({\n ...accessibilityState,\n busy: animating,\n }),\n [accessibilityState, animating],\n );\n\n const containerStyle = useMemo(\n () => [\n styles.container,\n {\n width: resolvedSize,\n height: resolvedSize,\n },\n style,\n ],\n [resolvedSize, style],\n );\n\n const indicatorStyle = useMemo(\n () => ({\n transform: [{ scale: resolvedSize / tokens.baseSize }],\n }),\n [resolvedSize, tokens.baseSize],\n );\n\n return (\n <View\n {...props}\n accessibilityRole={accessibilityRole}\n accessibilityState={resolvedAccessibilityState}\n accessible={accessible}\n style={containerStyle}\n >\n <ActivityIndicator\n accessible={false}\n animating={animating}\n color={color ?? tokens.colors[tone]}\n hidesWhenStopped={hidesWhenStopped}\n size=\"small\"\n style={indicatorStyle}\n />\n </View>\n );\n});\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n});\n"],"mappings":"AA0DM;AAzDN,SAAS,MAAM,eAAe;AAC9B,SAAS,mBAAmB,YAAY,YAAY;AAEpD,SAAS,2BAA2B;AAI7B,MAAM,UAAU,KAAK,SAASA,SAAQ;AAAA,EAC3C,oBAAoB;AAAA,EACpB;AAAA,EACA,aAAa;AAAA,EACb,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA,OAAO;AAAA,EACP,GAAG;AACL,GAAiB;AACf,QAAM,SAAS,oBAAoB,EAAE;AACrC,QAAM,eAAe,OAAO,MAAM,IAAI;AAEtC,QAAM,6BAA6B;AAAA,IACjC,OAAO;AAAA,MACL,GAAG;AAAA,MACH,MAAM;AAAA,IACR;AAAA,IACA,CAAC,oBAAoB,SAAS;AAAA,EAChC;AAEA,QAAM,iBAAiB;AAAA,IACrB,MAAM;AAAA,MACJ,OAAO;AAAA,MACP;AAAA,QACE,OAAO;AAAA,QACP,QAAQ;AAAA,MACV;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,cAAc,KAAK;AAAA,EACtB;AAEA,QAAM,iBAAiB;AAAA,IACrB,OAAO;AAAA,MACL,WAAW,CAAC,EAAE,OAAO,eAAe,OAAO,SAAS,CAAC;AAAA,IACvD;AAAA,IACA,CAAC,cAAc,OAAO,QAAQ;AAAA,EAChC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,oBAAoB;AAAA,MACpB;AAAA,MACA,OAAO;AAAA,MAEP;AAAA,QAAC;AAAA;AAAA,UACC,YAAY;AAAA,UACZ;AAAA,UACA,OAAO,SAAS,OAAO,OAAO,IAAI;AAAA,UAClC;AAAA,UACA,MAAK;AAAA,UACL,OAAO;AAAA;AAAA,MACT;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,MAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,WAAW;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,EAClB;AACF,CAAC;","names":["Spinner"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { CardRootProps, CardPressableProps, CardHeaderProps, CardContentProps, CardFooterProps, 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 Card: {
|
|
9
|
+
Root: react.MemoExoticComponent<({ style, ...props }: CardRootProps) => react_jsx_runtime.JSX.Element>;
|
|
10
|
+
Pressable: react.MemoExoticComponent<({ accessibilityRole, accessibilityState, disabled, style, ...props }: CardPressableProps) => react_jsx_runtime.JSX.Element>;
|
|
11
|
+
Header: react.MemoExoticComponent<({ style, ...props }: CardHeaderProps) => react_jsx_runtime.JSX.Element>;
|
|
12
|
+
Content: react.MemoExoticComponent<({ style, ...props }: CardContentProps) => react_jsx_runtime.JSX.Element>;
|
|
13
|
+
Footer: react.MemoExoticComponent<({ style, ...props }: CardFooterProps) => react_jsx_runtime.JSX.Element>;
|
|
14
|
+
Media: react.MemoExoticComponent<({ style, ...props }: CardMediaProps) => react_jsx_runtime.JSX.Element>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { Card };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CardContent } from "./content";
|
|
2
|
+
import { CardFooter } from "./footer";
|
|
3
|
+
import { CardHeader } from "./header";
|
|
4
|
+
import { CardMedia } from "./media";
|
|
5
|
+
import { CardPressable } from "./pressable";
|
|
6
|
+
import { CardRoot } from "./root";
|
|
7
|
+
const Card = {
|
|
8
|
+
Root: CardRoot,
|
|
9
|
+
Pressable: CardPressable,
|
|
10
|
+
Header: CardHeader,
|
|
11
|
+
Content: CardContent,
|
|
12
|
+
Footer: CardFooter,
|
|
13
|
+
Media: CardMedia
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
Card
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/card/card.tsx"],"sourcesContent":["import { CardContent } from \"./content\";\nimport { CardFooter } from \"./footer\";\nimport { CardHeader } from \"./header\";\nimport { CardMedia } from \"./media\";\nimport { CardPressable } from \"./pressable\";\nimport { CardRoot } from \"./root\";\n\nexport const Card = {\n Root: CardRoot,\n Pressable: CardPressable,\n Header: CardHeader,\n Content: CardContent,\n Footer: CardFooter,\n Media: CardMedia,\n};\n"],"mappings":"AAAA,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AAElB,MAAM,OAAO;AAAA,EAClB,MAAM;AAAA,EACN,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AACT;","names":[]}
|
|
@@ -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"]}
|