@tecsinapse/react-core 1.21.7 → 1.21.8
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/dist/cjs/components/atoms/BoxContent/BoxContent.js +4 -31
- package/dist/cjs/components/atoms/BoxContent/BoxContent.js.map +1 -1
- package/dist/cjs/components/atoms/BoxContent/styled.js +1 -1
- package/dist/cjs/components/atoms/BoxContent/styled.js.map +1 -1
- package/dist/cjs/components/atoms/Button/Button.js +18 -61
- package/dist/cjs/components/atoms/Button/Button.js.map +1 -1
- package/dist/cjs/components/atoms/Button/States/Error.js +5 -23
- package/dist/cjs/components/atoms/Button/States/Error.js.map +1 -1
- package/dist/cjs/components/atoms/Button/States/Success.js +3 -21
- package/dist/cjs/components/atoms/Button/States/Success.js.map +1 -1
- package/dist/cjs/components/atoms/Card/Card.js +12 -45
- package/dist/cjs/components/atoms/Card/Card.js.map +1 -1
- package/dist/cjs/components/atoms/Checkbox/Checkbox.js +13 -51
- package/dist/cjs/components/atoms/Checkbox/Checkbox.js.map +1 -1
- package/dist/cjs/components/atoms/Divider/Divider.js +4 -31
- package/dist/cjs/components/atoms/Divider/Divider.js.map +1 -1
- package/dist/cjs/components/atoms/GroupButton/GroupButton.js +19 -57
- package/dist/cjs/components/atoms/GroupButton/GroupButton.js.map +1 -1
- package/dist/cjs/components/atoms/GroupButton/styled.js +11 -11
- package/dist/cjs/components/atoms/GroupButton/styled.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/AntDesign.js +4 -35
- package/dist/cjs/components/atoms/Icon/AntDesign.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/Entypo.js +4 -35
- package/dist/cjs/components/atoms/Icon/Entypo.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/Evil.js +4 -35
- package/dist/cjs/components/atoms/Icon/Evil.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/Feather.js +4 -35
- package/dist/cjs/components/atoms/Icon/Feather.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/FontAwesome.js +4 -35
- package/dist/cjs/components/atoms/Icon/FontAwesome.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/FontAwesomeFive.js +4 -35
- package/dist/cjs/components/atoms/Icon/FontAwesomeFive.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/Fontisto.js +4 -35
- package/dist/cjs/components/atoms/Icon/Fontisto.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/Foundation.js +4 -35
- package/dist/cjs/components/atoms/Icon/Foundation.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/Icon.js +13 -51
- package/dist/cjs/components/atoms/Icon/Icon.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/Ionicon.js +4 -35
- package/dist/cjs/components/atoms/Icon/Ionicon.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/Material.js +4 -35
- package/dist/cjs/components/atoms/Icon/Material.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/MaterialCommunity.js +9 -43
- package/dist/cjs/components/atoms/Icon/MaterialCommunity.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/Octicon.js +4 -35
- package/dist/cjs/components/atoms/Icon/Octicon.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/SimpleLine.js +4 -35
- package/dist/cjs/components/atoms/Icon/SimpleLine.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/Zocial.js +4 -35
- package/dist/cjs/components/atoms/Icon/Zocial.js.map +1 -1
- package/dist/cjs/components/atoms/Icon/functions.js +1 -1
- package/dist/cjs/components/atoms/Icon/functions.js.map +1 -1
- package/dist/cjs/components/atoms/Input/InputContainer/InputContainer.js +21 -67
- package/dist/cjs/components/atoms/Input/InputContainer/InputContainer.js.map +1 -1
- package/dist/cjs/components/atoms/Input/InputElement/InputElement.js +11 -47
- package/dist/cjs/components/atoms/Input/InputElement/InputElement.js.map +1 -1
- package/dist/cjs/components/atoms/Input/InputMaskElement/InputMaskElement.js +15 -52
- package/dist/cjs/components/atoms/Input/InputMaskElement/InputMaskElement.js.map +1 -1
- package/dist/cjs/components/atoms/Input/PressableInputContainer/PressableInputContainer.js +11 -43
- package/dist/cjs/components/atoms/Input/PressableInputContainer/PressableInputContainer.js.map +1 -1
- package/dist/cjs/components/atoms/Input/hooks/useNumberMask.js +1 -17
- package/dist/cjs/components/atoms/Input/hooks/useNumberMask.js.map +1 -1
- package/dist/cjs/components/atoms/Input/hooks/useStringMask.js +2 -2
- package/dist/cjs/components/atoms/Input/hooks/useStringMask.js.map +1 -1
- package/dist/cjs/components/atoms/Input/styled.js +1 -1
- package/dist/cjs/components/atoms/Input/styled.js.map +1 -1
- package/dist/cjs/components/atoms/Paper/Paper.js +8 -43
- package/dist/cjs/components/atoms/Paper/Paper.js.map +1 -1
- package/dist/cjs/components/atoms/PressableSurface/PressableSurface.js +12 -49
- package/dist/cjs/components/atoms/PressableSurface/PressableSurface.js.map +1 -1
- package/dist/cjs/components/atoms/ProgressBar/ProgressBar.js +16 -52
- package/dist/cjs/components/atoms/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/cjs/components/atoms/RadioButton/RadioButton.js +13 -51
- package/dist/cjs/components/atoms/RadioButton/RadioButton.js.map +1 -1
- package/dist/cjs/components/atoms/Switch/Switch.js +14 -53
- package/dist/cjs/components/atoms/Switch/Switch.js.map +1 -1
- package/dist/cjs/components/atoms/Tag/Tag.js +16 -52
- package/dist/cjs/components/atoms/Tag/Tag.js.map +1 -1
- package/dist/cjs/components/atoms/Text/Text.js +17 -59
- package/dist/cjs/components/atoms/Text/Text.js.map +1 -1
- package/dist/cjs/components/molecules/Calendar/Calendar.js +20 -60
- package/dist/cjs/components/molecules/Calendar/Calendar.js.map +1 -1
- package/dist/cjs/components/molecules/Calendar/components/MonthWeek.js +3 -3
- package/dist/cjs/components/molecules/Calendar/components/MonthWeek.js.map +1 -1
- package/dist/cjs/components/molecules/Calendar/styled.js +5 -8
- package/dist/cjs/components/molecules/Calendar/styled.js.map +1 -1
- package/dist/cjs/components/molecules/DatePicker/DatePicker.js +30 -81
- package/dist/cjs/components/molecules/DatePicker/DatePicker.js.map +1 -1
- package/dist/cjs/components/molecules/DatePicker/styled.js +3 -6
- package/dist/cjs/components/molecules/DatePicker/styled.js.map +1 -1
- package/dist/cjs/components/molecules/DateTimePicker/DateTimePicker.js +42 -104
- package/dist/cjs/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/cjs/components/molecules/DateTimeSelector/DateTimeSelector.js +26 -72
- package/dist/cjs/components/molecules/DateTimeSelector/DateTimeSelector.js.map +1 -1
- package/dist/cjs/components/molecules/DateTimeSelector/Selector.js +15 -51
- package/dist/cjs/components/molecules/DateTimeSelector/Selector.js.map +1 -1
- package/dist/cjs/components/molecules/Grid/functions.js +1 -2
- package/dist/cjs/components/molecules/Grid/functions.js.map +1 -1
- package/dist/cjs/components/molecules/HintInputContainer/HintInputContainer.js +17 -55
- package/dist/cjs/components/molecules/HintInputContainer/HintInputContainer.js.map +1 -1
- package/dist/cjs/components/molecules/IconTextButton/IconComponent.js +5 -21
- package/dist/cjs/components/molecules/IconTextButton/IconComponent.js.map +1 -1
- package/dist/cjs/components/molecules/InputPassword/InputPasswordIcon.js +8 -41
- package/dist/cjs/components/molecules/InputPassword/InputPasswordIcon.js.map +1 -1
- package/dist/cjs/components/molecules/Snackbar/Snackbar.js +8 -25
- package/dist/cjs/components/molecules/Snackbar/Snackbar.js.map +1 -1
- package/dist/cjs/styles/light.js +7 -20
- package/dist/cjs/styles/light.js.map +1 -1
- package/dist/cjs/utils/masks.js +2 -2
- package/dist/cjs/utils/masks.js.map +1 -1
- package/dist/esm/components/atoms/BoxContent/BoxContent.js +4 -31
- package/dist/esm/components/atoms/BoxContent/BoxContent.js.map +1 -1
- package/dist/esm/components/atoms/BoxContent/styled.js +1 -1
- package/dist/esm/components/atoms/BoxContent/styled.js.map +1 -1
- package/dist/esm/components/atoms/Button/Button.js +18 -61
- package/dist/esm/components/atoms/Button/Button.js.map +1 -1
- package/dist/esm/components/atoms/Button/States/Error.js +5 -23
- package/dist/esm/components/atoms/Button/States/Error.js.map +1 -1
- package/dist/esm/components/atoms/Button/States/Success.js +3 -21
- package/dist/esm/components/atoms/Button/States/Success.js.map +1 -1
- package/dist/esm/components/atoms/Card/Card.js +12 -45
- package/dist/esm/components/atoms/Card/Card.js.map +1 -1
- package/dist/esm/components/atoms/Checkbox/Checkbox.js +13 -51
- package/dist/esm/components/atoms/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/components/atoms/Divider/Divider.js +4 -31
- package/dist/esm/components/atoms/Divider/Divider.js.map +1 -1
- package/dist/esm/components/atoms/GroupButton/GroupButton.js +19 -57
- package/dist/esm/components/atoms/GroupButton/GroupButton.js.map +1 -1
- package/dist/esm/components/atoms/GroupButton/styled.js +11 -11
- package/dist/esm/components/atoms/GroupButton/styled.js.map +1 -1
- package/dist/esm/components/atoms/Icon/AntDesign.js +4 -35
- package/dist/esm/components/atoms/Icon/AntDesign.js.map +1 -1
- package/dist/esm/components/atoms/Icon/Entypo.js +4 -35
- package/dist/esm/components/atoms/Icon/Entypo.js.map +1 -1
- package/dist/esm/components/atoms/Icon/Evil.js +4 -35
- package/dist/esm/components/atoms/Icon/Evil.js.map +1 -1
- package/dist/esm/components/atoms/Icon/Feather.js +4 -35
- package/dist/esm/components/atoms/Icon/Feather.js.map +1 -1
- package/dist/esm/components/atoms/Icon/FontAwesome.js +4 -35
- package/dist/esm/components/atoms/Icon/FontAwesome.js.map +1 -1
- package/dist/esm/components/atoms/Icon/FontAwesomeFive.js +4 -35
- package/dist/esm/components/atoms/Icon/FontAwesomeFive.js.map +1 -1
- package/dist/esm/components/atoms/Icon/Fontisto.js +4 -35
- package/dist/esm/components/atoms/Icon/Fontisto.js.map +1 -1
- package/dist/esm/components/atoms/Icon/Foundation.js +4 -35
- package/dist/esm/components/atoms/Icon/Foundation.js.map +1 -1
- package/dist/esm/components/atoms/Icon/Icon.js +13 -51
- package/dist/esm/components/atoms/Icon/Icon.js.map +1 -1
- package/dist/esm/components/atoms/Icon/Ionicon.js +4 -35
- package/dist/esm/components/atoms/Icon/Ionicon.js.map +1 -1
- package/dist/esm/components/atoms/Icon/Material.js +4 -35
- package/dist/esm/components/atoms/Icon/Material.js.map +1 -1
- package/dist/esm/components/atoms/Icon/MaterialCommunity.js +9 -43
- package/dist/esm/components/atoms/Icon/MaterialCommunity.js.map +1 -1
- package/dist/esm/components/atoms/Icon/Octicon.js +4 -35
- package/dist/esm/components/atoms/Icon/Octicon.js.map +1 -1
- package/dist/esm/components/atoms/Icon/SimpleLine.js +4 -35
- package/dist/esm/components/atoms/Icon/SimpleLine.js.map +1 -1
- package/dist/esm/components/atoms/Icon/Zocial.js +4 -35
- package/dist/esm/components/atoms/Icon/Zocial.js.map +1 -1
- package/dist/esm/components/atoms/Icon/functions.js +1 -1
- package/dist/esm/components/atoms/Icon/functions.js.map +1 -1
- package/dist/esm/components/atoms/Input/InputContainer/InputContainer.js +21 -67
- package/dist/esm/components/atoms/Input/InputContainer/InputContainer.js.map +1 -1
- package/dist/esm/components/atoms/Input/InputElement/InputElement.js +11 -47
- package/dist/esm/components/atoms/Input/InputElement/InputElement.js.map +1 -1
- package/dist/esm/components/atoms/Input/InputMaskElement/InputMaskElement.js +15 -52
- package/dist/esm/components/atoms/Input/InputMaskElement/InputMaskElement.js.map +1 -1
- package/dist/esm/components/atoms/Input/PressableInputContainer/PressableInputContainer.js +11 -43
- package/dist/esm/components/atoms/Input/PressableInputContainer/PressableInputContainer.js.map +1 -1
- package/dist/esm/components/atoms/Input/hooks/useNumberMask.js +1 -17
- package/dist/esm/components/atoms/Input/hooks/useNumberMask.js.map +1 -1
- package/dist/esm/components/atoms/Input/hooks/useStringMask.js +2 -2
- package/dist/esm/components/atoms/Input/hooks/useStringMask.js.map +1 -1
- package/dist/esm/components/atoms/Input/styled.js +1 -1
- package/dist/esm/components/atoms/Input/styled.js.map +1 -1
- package/dist/esm/components/atoms/Paper/Paper.js +8 -43
- package/dist/esm/components/atoms/Paper/Paper.js.map +1 -1
- package/dist/esm/components/atoms/PressableSurface/PressableSurface.js +12 -49
- package/dist/esm/components/atoms/PressableSurface/PressableSurface.js.map +1 -1
- package/dist/esm/components/atoms/ProgressBar/ProgressBar.js +16 -52
- package/dist/esm/components/atoms/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/esm/components/atoms/RadioButton/RadioButton.js +13 -51
- package/dist/esm/components/atoms/RadioButton/RadioButton.js.map +1 -1
- package/dist/esm/components/atoms/Switch/Switch.js +14 -53
- package/dist/esm/components/atoms/Switch/Switch.js.map +1 -1
- package/dist/esm/components/atoms/Tag/Tag.js +16 -52
- package/dist/esm/components/atoms/Tag/Tag.js.map +1 -1
- package/dist/esm/components/atoms/Text/Text.js +17 -59
- package/dist/esm/components/atoms/Text/Text.js.map +1 -1
- package/dist/esm/components/molecules/Calendar/Calendar.js +20 -60
- package/dist/esm/components/molecules/Calendar/Calendar.js.map +1 -1
- package/dist/esm/components/molecules/Calendar/components/MonthWeek.js +3 -3
- package/dist/esm/components/molecules/Calendar/components/MonthWeek.js.map +1 -1
- package/dist/esm/components/molecules/Calendar/styled.js +5 -8
- package/dist/esm/components/molecules/Calendar/styled.js.map +1 -1
- package/dist/esm/components/molecules/DatePicker/DatePicker.js +30 -81
- package/dist/esm/components/molecules/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/molecules/DatePicker/styled.js +3 -6
- package/dist/esm/components/molecules/DatePicker/styled.js.map +1 -1
- package/dist/esm/components/molecules/DateTimePicker/DateTimePicker.js +42 -104
- package/dist/esm/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/esm/components/molecules/DateTimeSelector/DateTimeSelector.js +26 -72
- package/dist/esm/components/molecules/DateTimeSelector/DateTimeSelector.js.map +1 -1
- package/dist/esm/components/molecules/DateTimeSelector/Selector.js +15 -51
- package/dist/esm/components/molecules/DateTimeSelector/Selector.js.map +1 -1
- package/dist/esm/components/molecules/Grid/functions.js +1 -2
- package/dist/esm/components/molecules/Grid/functions.js.map +1 -1
- package/dist/esm/components/molecules/HintInputContainer/HintInputContainer.js +17 -55
- package/dist/esm/components/molecules/HintInputContainer/HintInputContainer.js.map +1 -1
- package/dist/esm/components/molecules/IconTextButton/IconComponent.js +5 -21
- package/dist/esm/components/molecules/IconTextButton/IconComponent.js.map +1 -1
- package/dist/esm/components/molecules/InputPassword/InputPasswordIcon.js +8 -41
- package/dist/esm/components/molecules/InputPassword/InputPasswordIcon.js.map +1 -1
- package/dist/esm/components/molecules/Snackbar/Snackbar.js +8 -25
- package/dist/esm/components/molecules/Snackbar/Snackbar.js.map +1 -1
- package/dist/esm/styles/light.js +8 -21
- package/dist/esm/styles/light.js.map +1 -1
- package/dist/esm/utils/masks.js +2 -2
- package/dist/esm/utils/masks.js.map +1 -1
- package/package.json +2 -2
|
@@ -32,54 +32,17 @@ function _interopNamespace(e) {
|
|
|
32
32
|
|
|
33
33
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (__propIsEnum.call(b, prop))
|
|
47
|
-
__defNormalProp(a, prop, b[prop]);
|
|
48
|
-
}
|
|
49
|
-
return a;
|
|
50
|
-
};
|
|
51
|
-
var __objRest = (source, exclude) => {
|
|
52
|
-
var target = {};
|
|
53
|
-
for (var prop in source)
|
|
54
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
55
|
-
target[prop] = source[prop];
|
|
56
|
-
if (source != null && __getOwnPropSymbols)
|
|
57
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
58
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
59
|
-
target[prop] = source[prop];
|
|
60
|
-
}
|
|
61
|
-
return target;
|
|
62
|
-
};
|
|
63
|
-
const ProgressBar = (_a) => {
|
|
64
|
-
var _b = _a, {
|
|
65
|
-
segments: _segments = 1,
|
|
66
|
-
valueMin = 0,
|
|
67
|
-
valueNow: _valueNow,
|
|
68
|
-
valueMax = 100,
|
|
69
|
-
color = "primary",
|
|
70
|
-
colorTone = "medium",
|
|
71
|
-
animate,
|
|
72
|
-
animationParameters
|
|
73
|
-
} = _b, rest = __objRest(_b, [
|
|
74
|
-
"segments",
|
|
75
|
-
"valueMin",
|
|
76
|
-
"valueNow",
|
|
77
|
-
"valueMax",
|
|
78
|
-
"color",
|
|
79
|
-
"colorTone",
|
|
80
|
-
"animate",
|
|
81
|
-
"animationParameters"
|
|
82
|
-
]);
|
|
35
|
+
const ProgressBar = ({
|
|
36
|
+
segments: _segments = 1,
|
|
37
|
+
valueMin = 0,
|
|
38
|
+
valueNow: _valueNow,
|
|
39
|
+
valueMax = 100,
|
|
40
|
+
color = "primary",
|
|
41
|
+
colorTone = "medium",
|
|
42
|
+
animate,
|
|
43
|
+
animationParameters,
|
|
44
|
+
...rest
|
|
45
|
+
}) => {
|
|
83
46
|
const theme = react.useTheme();
|
|
84
47
|
const animationValue = React__namespace.useRef(new reactNative.Animated.Value(0)).current;
|
|
85
48
|
const valueNow = typeof _valueNow === "string" ? extractNumbersFromString.extractNumbersFromString(_valueNow) : _valueNow;
|
|
@@ -88,7 +51,6 @@ const ProgressBar = (_a) => {
|
|
|
88
51
|
const segmentWidth = 100 / Math.max(segments);
|
|
89
52
|
const items = [...Array(segments).keys()];
|
|
90
53
|
const segmentsRender = items.map((index) => {
|
|
91
|
-
var _a2;
|
|
92
54
|
const max = segmentWidth * (index + 1);
|
|
93
55
|
const min = segmentWidth * index;
|
|
94
56
|
const minmax = (totalProgress - min) / (max - min);
|
|
@@ -101,8 +63,8 @@ const ProgressBar = (_a) => {
|
|
|
101
63
|
useNativeDriver: false,
|
|
102
64
|
delay: animationParameters.direction === "right" ? index * (animationParameters.duration / items.length) : (items.length - index - 1) * (animationParameters.duration / items.length)
|
|
103
65
|
}).start();
|
|
104
|
-
const rangeAnimation =
|
|
105
|
-
progressPercent =
|
|
66
|
+
const rangeAnimation = animationParameters?.direction === "right" ? [`${valueMin < 0 ? 0 : valueMin}%`, `${width}%`] : [`${valueMax}%`, `${width}%`];
|
|
67
|
+
progressPercent = animationValue.interpolate?.({
|
|
106
68
|
inputRange: [0, 1],
|
|
107
69
|
outputRange: rangeAnimation
|
|
108
70
|
});
|
|
@@ -120,7 +82,9 @@ const ProgressBar = (_a) => {
|
|
|
120
82
|
}
|
|
121
83
|
}));
|
|
122
84
|
});
|
|
123
|
-
return /* @__PURE__ */ React__namespace.createElement(styled.Container,
|
|
85
|
+
return /* @__PURE__ */ React__namespace.createElement(styled.Container, {
|
|
86
|
+
...rest
|
|
87
|
+
}, segmentsRender);
|
|
124
88
|
};
|
|
125
89
|
|
|
126
90
|
module.exports = ProgressBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.js","sources":["../../../../../src/components/atoms/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react';\nimport * as React from 'react';\nimport { Animated, ViewProps } from 'react-native';\nimport {\n ColorGradationType,\n ColorType,\n ThemeProp,\n} from '@tecsinapse/react-core';\nimport { extractNumbersFromString } from '../../../utils';\nimport { Container, Progress, Segment } from './styled';\n\nexport interface ProgressBarProps extends ViewProps {\n /** Number of segments. Defaults to 1. Set to 1 when 0 or less */\n segments?: number;\n /** Minimum possible value (0% of the bar). Defaults to 0 */\n valueMin?: number;\n /** Maximum possible value (100% of the bar). Defaults to 100 */\n valueMax?: number;\n /** Current value */\n valueNow: number | string;\n /** Filled partition color. Defaults to 'primary' */\n color?: ColorType;\n /** Filled partition color tone. Defaults to 'medium' */\n colorTone?: ColorGradationType;\n /** Animation */\n animate: boolean;\n /** Parameters animation */\n animationParameters?: { direction: 'left' | 'right'; duration: number };\n}\n\nconst ProgressBar: React.FC<ProgressBarProps> = ({\n segments: _segments = 1,\n valueMin = 0,\n valueNow: _valueNow,\n valueMax = 100,\n color = 'primary',\n colorTone = 'medium',\n animate,\n animationParameters,\n ...rest\n}) => {\n const theme = useTheme() as ThemeProp;\n const animationValue = React.useRef(new Animated.Value(0)).current;\n\n const valueNow =\n typeof _valueNow === 'string'\n ? extractNumbersFromString(_valueNow)\n : _valueNow;\n\n const totalProgress = ((valueNow - valueMin) / (valueMax - valueMin)) * 100;\n const segments = Math.max(1, _segments);\n const segmentWidth = 100 / Math.max(segments);\n\n const items = [...Array(segments).keys()];\n\n const segmentsRender = items.map(index => {\n const max = segmentWidth * (index + 1);\n const min = segmentWidth * index;\n const minmax = (totalProgress - min) / (max - min);\n const width = (minmax > 1 ? 1 : minmax < 0 ? 0 : minmax) * 100;\n\n let progressPercent: string | Animated.AnimatedInterpolation = `${width}%`;\n\n if (animate && animationParameters) {\n Animated.timing(animationValue, {\n toValue: 1,\n duration: animationParameters.duration / items.length,\n useNativeDriver: false,\n delay:\n animationParameters.direction === 'right'\n ? index * (animationParameters.duration / items.length)\n : (items.length - index - 1) *\n (animationParameters.duration / items.length),\n }).start();\n\n const rangeAnimation =\n animationParameters?.direction === 'right'\n ? [`${valueMin < 0 ? 0 : valueMin}%`, `${width}%`]\n : [`${valueMax}%`, `${width}%`];\n\n progressPercent = animationValue.interpolate?.({\n inputRange: [0, 1],\n outputRange: rangeAnimation,\n });\n }\n\n return (\n <Segment\n key={index}\n style={{\n borderRightWidth: index == segments - 1 ? 0 : 2,\n }}\n >\n <Progress\n style={{\n width: progressPercent,\n backgroundColor: theme.color[color][colorTone],\n borderRightWidth: width > 0 && width < 100 ? 2 : 0,\n }}\n />\n </Segment>\n );\n });\n\n return <Container {...rest}>{segmentsRender}</Container>;\n};\n\nexport default ProgressBar;\n"],"names":["useTheme","React","Animated","extractNumbersFromString","
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","sources":["../../../../../src/components/atoms/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react';\nimport * as React from 'react';\nimport { Animated, ViewProps } from 'react-native';\nimport {\n ColorGradationType,\n ColorType,\n ThemeProp,\n} from '@tecsinapse/react-core';\nimport { extractNumbersFromString } from '../../../utils';\nimport { Container, Progress, Segment } from './styled';\n\nexport interface ProgressBarProps extends ViewProps {\n /** Number of segments. Defaults to 1. Set to 1 when 0 or less */\n segments?: number;\n /** Minimum possible value (0% of the bar). Defaults to 0 */\n valueMin?: number;\n /** Maximum possible value (100% of the bar). Defaults to 100 */\n valueMax?: number;\n /** Current value */\n valueNow: number | string;\n /** Filled partition color. Defaults to 'primary' */\n color?: ColorType;\n /** Filled partition color tone. Defaults to 'medium' */\n colorTone?: ColorGradationType;\n /** Animation */\n animate: boolean;\n /** Parameters animation */\n animationParameters?: { direction: 'left' | 'right'; duration: number };\n}\n\nconst ProgressBar: React.FC<ProgressBarProps> = ({\n segments: _segments = 1,\n valueMin = 0,\n valueNow: _valueNow,\n valueMax = 100,\n color = 'primary',\n colorTone = 'medium',\n animate,\n animationParameters,\n ...rest\n}) => {\n const theme = useTheme() as ThemeProp;\n const animationValue = React.useRef(new Animated.Value(0)).current;\n\n const valueNow =\n typeof _valueNow === 'string'\n ? extractNumbersFromString(_valueNow)\n : _valueNow;\n\n const totalProgress = ((valueNow - valueMin) / (valueMax - valueMin)) * 100;\n const segments = Math.max(1, _segments);\n const segmentWidth = 100 / Math.max(segments);\n\n const items = [...Array(segments).keys()];\n\n const segmentsRender = items.map(index => {\n const max = segmentWidth * (index + 1);\n const min = segmentWidth * index;\n const minmax = (totalProgress - min) / (max - min);\n const width = (minmax > 1 ? 1 : minmax < 0 ? 0 : minmax) * 100;\n\n let progressPercent: string | Animated.AnimatedInterpolation = `${width}%`;\n\n if (animate && animationParameters) {\n Animated.timing(animationValue, {\n toValue: 1,\n duration: animationParameters.duration / items.length,\n useNativeDriver: false,\n delay:\n animationParameters.direction === 'right'\n ? index * (animationParameters.duration / items.length)\n : (items.length - index - 1) *\n (animationParameters.duration / items.length),\n }).start();\n\n const rangeAnimation =\n animationParameters?.direction === 'right'\n ? [`${valueMin < 0 ? 0 : valueMin}%`, `${width}%`]\n : [`${valueMax}%`, `${width}%`];\n\n progressPercent = animationValue.interpolate?.({\n inputRange: [0, 1],\n outputRange: rangeAnimation,\n });\n }\n\n return (\n <Segment\n key={index}\n style={{\n borderRightWidth: index == segments - 1 ? 0 : 2,\n }}\n >\n <Progress\n style={{\n width: progressPercent,\n backgroundColor: theme.color[color][colorTone],\n borderRightWidth: width > 0 && width < 100 ? 2 : 0,\n }}\n />\n </Segment>\n );\n });\n\n return <Container {...rest}>{segmentsRender}</Container>;\n};\n\nexport default ProgressBar;\n"],"names":["useTheme","React","Animated","extractNumbersFromString","Segment","Progress","Container"],"mappings":"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"}
|
|
@@ -9,63 +9,25 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
|
|
10
10
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
__defNormalProp(a, prop, b[prop]);
|
|
23
|
-
if (__getOwnPropSymbols)
|
|
24
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
25
|
-
if (__propIsEnum.call(b, prop))
|
|
26
|
-
__defNormalProp(a, prop, b[prop]);
|
|
27
|
-
}
|
|
28
|
-
return a;
|
|
29
|
-
};
|
|
30
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
31
|
-
var __objRest = (source, exclude) => {
|
|
32
|
-
var target = {};
|
|
33
|
-
for (var prop in source)
|
|
34
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
35
|
-
target[prop] = source[prop];
|
|
36
|
-
if (source != null && __getOwnPropSymbols)
|
|
37
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
38
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
39
|
-
target[prop] = source[prop];
|
|
40
|
-
}
|
|
41
|
-
return target;
|
|
42
|
-
};
|
|
43
|
-
const RadioButton = (_a) => {
|
|
44
|
-
var _b = _a, {
|
|
45
|
-
children,
|
|
46
|
-
onChange,
|
|
47
|
-
checked,
|
|
48
|
-
labelPosition = "right",
|
|
49
|
-
disabled = false,
|
|
50
|
-
color = "primary",
|
|
51
|
-
colorTone = "medium"
|
|
52
|
-
} = _b, rest = __objRest(_b, [
|
|
53
|
-
"children",
|
|
54
|
-
"onChange",
|
|
55
|
-
"checked",
|
|
56
|
-
"labelPosition",
|
|
57
|
-
"disabled",
|
|
58
|
-
"color",
|
|
59
|
-
"colorTone"
|
|
60
|
-
]);
|
|
12
|
+
const RadioButton = ({
|
|
13
|
+
children,
|
|
14
|
+
onChange,
|
|
15
|
+
checked,
|
|
16
|
+
labelPosition = "right",
|
|
17
|
+
disabled = false,
|
|
18
|
+
color = "primary",
|
|
19
|
+
colorTone = "medium",
|
|
20
|
+
...rest
|
|
21
|
+
}) => {
|
|
61
22
|
const handleChange = () => {
|
|
62
23
|
onChange && onChange(!checked);
|
|
63
24
|
};
|
|
64
|
-
return /* @__PURE__ */ React__default["default"].createElement(reactNative.Pressable,
|
|
25
|
+
return /* @__PURE__ */ React__default["default"].createElement(reactNative.Pressable, {
|
|
26
|
+
...rest,
|
|
65
27
|
disabled,
|
|
66
28
|
onPress: handleChange,
|
|
67
29
|
accessibilityRole: "radio"
|
|
68
|
-
}
|
|
30
|
+
}, /* @__PURE__ */ React__default["default"].createElement(styled.ViewStyled, null, labelPosition === "left" && children, checked && /* @__PURE__ */ React__default["default"].createElement(styled.IconViewStyled, null, /* @__PURE__ */ React__default["default"].createElement(styled.IconWrapper, null, /* @__PURE__ */ React__default["default"].createElement(styled.ScaledView, null, /* @__PURE__ */ React__default["default"].createElement(Icon, {
|
|
69
31
|
name: "circle",
|
|
70
32
|
colorVariant: color,
|
|
71
33
|
colorTone,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButton.js","sources":["../../../../../src/components/atoms/RadioButton/RadioButton.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { Pressable, StyleProp, ViewStyle } from 'react-native';\nimport { ColorGradationType, ColorType } from '../../../types/defaults';\nimport { Icon } from '../Icon';\nimport { IconViewStyled, IconWrapper, ScaledView, ViewStyled } from './styled';\n\nexport interface RadioButtonProps {\n /** Element is checked */\n checked?: boolean;\n /** Change handler */\n onChange?: (checked: boolean) => void;\n /** Position of children */\n labelPosition?: 'left' | 'right';\n /** Element is not clickable */\n disabled?: boolean;\n /** Color definition from theme */\n color?: ColorType;\n /** Color gradation from theme */\n colorTone?: ColorGradationType;\n style?: StyleProp<ViewStyle>;\n}\n\nconst RadioButton: FC<RadioButtonProps> = ({\n children,\n onChange,\n checked,\n labelPosition = 'right',\n disabled = false,\n color = 'primary',\n colorTone = 'medium',\n ...rest\n}): JSX.Element => {\n const handleChange = () => {\n onChange && onChange(!checked);\n };\n\n return (\n <Pressable\n {...rest}\n disabled={disabled}\n onPress={handleChange}\n accessibilityRole=\"radio\"\n >\n <ViewStyled>\n {labelPosition === 'left' && children}\n {checked && (\n <IconViewStyled>\n <IconWrapper>\n <ScaledView>\n <Icon\n name=\"circle\"\n colorVariant={color}\n colorTone={colorTone}\n type=\"material-community\"\n size=\"centi\"\n />\n </ScaledView>\n </IconWrapper>\n </IconViewStyled>\n )}\n {!checked && (\n <IconViewStyled>\n <IconWrapper>\n <ScaledView>\n <Icon\n name=\"circle\"\n fontColor=\"light\"\n type=\"material-community\"\n size=\"centi\"\n />\n </ScaledView>\n </IconWrapper>\n </IconViewStyled>\n )}\n {labelPosition === 'right' && children}\n </ViewStyled>\n </Pressable>\n );\n};\n\nexport default RadioButton;\n"],"names":["React","Pressable","ViewStyled","IconViewStyled","IconWrapper","ScaledView"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RadioButton.js","sources":["../../../../../src/components/atoms/RadioButton/RadioButton.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { Pressable, StyleProp, ViewStyle } from 'react-native';\nimport { ColorGradationType, ColorType } from '../../../types/defaults';\nimport { Icon } from '../Icon';\nimport { IconViewStyled, IconWrapper, ScaledView, ViewStyled } from './styled';\n\nexport interface RadioButtonProps {\n /** Element is checked */\n checked?: boolean;\n /** Change handler */\n onChange?: (checked: boolean) => void;\n /** Position of children */\n labelPosition?: 'left' | 'right';\n /** Element is not clickable */\n disabled?: boolean;\n /** Color definition from theme */\n color?: ColorType;\n /** Color gradation from theme */\n colorTone?: ColorGradationType;\n style?: StyleProp<ViewStyle>;\n}\n\nconst RadioButton: FC<RadioButtonProps> = ({\n children,\n onChange,\n checked,\n labelPosition = 'right',\n disabled = false,\n color = 'primary',\n colorTone = 'medium',\n ...rest\n}): JSX.Element => {\n const handleChange = () => {\n onChange && onChange(!checked);\n };\n\n return (\n <Pressable\n {...rest}\n disabled={disabled}\n onPress={handleChange}\n accessibilityRole=\"radio\"\n >\n <ViewStyled>\n {labelPosition === 'left' && children}\n {checked && (\n <IconViewStyled>\n <IconWrapper>\n <ScaledView>\n <Icon\n name=\"circle\"\n colorVariant={color}\n colorTone={colorTone}\n type=\"material-community\"\n size=\"centi\"\n />\n </ScaledView>\n </IconWrapper>\n </IconViewStyled>\n )}\n {!checked && (\n <IconViewStyled>\n <IconWrapper>\n <ScaledView>\n <Icon\n name=\"circle\"\n fontColor=\"light\"\n type=\"material-community\"\n size=\"centi\"\n />\n </ScaledView>\n </IconWrapper>\n </IconViewStyled>\n )}\n {labelPosition === 'right' && children}\n </ViewStyled>\n </Pressable>\n );\n};\n\nexport default RadioButton;\n"],"names":["React","Pressable","ViewStyled","IconViewStyled","IconWrapper","ScaledView"],"mappings":";;;;;;;;;;;AAsBA,MAAM,cAAoC,CAAC;AAAA,EACzC,QAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,aAAgB,GAAA,OAAA;AAAA,EAChB,QAAW,GAAA,KAAA;AAAA,EACX,KAAQ,GAAA,SAAA;AAAA,EACR,SAAY,GAAA,QAAA;AAAA,EACT,GAAA,IAAA;AACL,CAAmB,KAAA;AACjB,EAAA,MAAM,eAAe,MAAM;AACzB,IAAY,QAAA,IAAA,QAAA,CAAS,CAAC,OAAO,CAAA,CAAA;AAAA,GAC/B,CAAA;AAEA,EAAA,uBACGA,yBAAA,CAAA,aAAA,CAAAC,qBAAA,EAAA;AAAA,IACE,GAAG,IAAA;AAAA,IACJ,QAAA;AAAA,IACA,OAAS,EAAA,YAAA;AAAA,IACT,iBAAkB,EAAA,OAAA;AAAA,GAAA,kBAEjBD,yBAAA,CAAA,aAAA,CAAAE,iBAAA,EAAA,IAAA,EACE,aAAkB,KAAA,MAAA,IAAU,QAC5B,EAAA,OAAA,oBACEF,yBAAA,CAAA,aAAA,CAAAG,qBAAA,EAAA,IAAA,kBACEH,yBAAA,CAAA,aAAA,CAAAI,kBAAA,EAAA,IAAA,kBACEJ,yBAAA,CAAA,aAAA,CAAAK,iBAAA,EAAA,IAAA,kBACEL,yBAAA,CAAA,aAAA,CAAA,IAAA,EAAA;AAAA,IACC,IAAK,EAAA,QAAA;AAAA,IACL,YAAc,EAAA,KAAA;AAAA,IACd,SAAA;AAAA,IACA,IAAK,EAAA,oBAAA;AAAA,IACL,IAAK,EAAA,OAAA;AAAA,GACP,CACF,CACF,CACF,CAAA,EAED,CAAC,OAAA,oBACCA,yBAAA,CAAA,aAAA,CAAAG,qBAAA,EAAA,IAAA,kBACEH,yBAAA,CAAA,aAAA,CAAAI,kBAAA,EAAA,IAAA,kBACEJ,yBAAA,CAAA,aAAA,CAAAK,iBAAA,EAAA,IAAA,kBACEL,yBAAA,CAAA,aAAA,CAAA,IAAA,EAAA;AAAA,IACC,IAAK,EAAA,QAAA;AAAA,IACL,SAAU,EAAA,OAAA;AAAA,IACV,IAAK,EAAA,oBAAA;AAAA,IACL,IAAK,EAAA,OAAA;AAAA,GACP,CACF,CACF,CACF,GAED,aAAkB,KAAA,OAAA,IAAW,QAChC,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -20,57 +20,17 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
20
20
|
|
|
21
21
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (__getOwnPropSymbols)
|
|
35
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
36
|
-
if (__propIsEnum.call(b, prop))
|
|
37
|
-
__defNormalProp(a, prop, b[prop]);
|
|
38
|
-
}
|
|
39
|
-
return a;
|
|
40
|
-
};
|
|
41
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
42
|
-
var __objRest = (source, exclude) => {
|
|
43
|
-
var target = {};
|
|
44
|
-
for (var prop in source)
|
|
45
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
46
|
-
target[prop] = source[prop];
|
|
47
|
-
if (source != null && __getOwnPropSymbols)
|
|
48
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
49
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
50
|
-
target[prop] = source[prop];
|
|
51
|
-
}
|
|
52
|
-
return target;
|
|
53
|
-
};
|
|
54
|
-
const Switch = (_a) => {
|
|
55
|
-
var _b = _a, {
|
|
56
|
-
onChange,
|
|
57
|
-
activeColor = "primary",
|
|
58
|
-
activeColorTone = "medium",
|
|
59
|
-
inactiveColor = "secondary",
|
|
60
|
-
inactiveColorTone = "light",
|
|
61
|
-
active,
|
|
62
|
-
dotStyle,
|
|
63
|
-
disabled = false
|
|
64
|
-
} = _b, rest = __objRest(_b, [
|
|
65
|
-
"onChange",
|
|
66
|
-
"activeColor",
|
|
67
|
-
"activeColorTone",
|
|
68
|
-
"inactiveColor",
|
|
69
|
-
"inactiveColorTone",
|
|
70
|
-
"active",
|
|
71
|
-
"dotStyle",
|
|
72
|
-
"disabled"
|
|
73
|
-
]);
|
|
23
|
+
const Switch = ({
|
|
24
|
+
onChange,
|
|
25
|
+
activeColor = "primary",
|
|
26
|
+
activeColorTone = "medium",
|
|
27
|
+
inactiveColor = "secondary",
|
|
28
|
+
inactiveColorTone = "light",
|
|
29
|
+
active,
|
|
30
|
+
dotStyle,
|
|
31
|
+
disabled = false,
|
|
32
|
+
...rest
|
|
33
|
+
}) => {
|
|
74
34
|
const theme = react.useTheme();
|
|
75
35
|
const width = React__default["default"].useRef(0);
|
|
76
36
|
const transitionValue = React__default["default"].useRef(new reactNative.Animated.Value(0)).current;
|
|
@@ -103,11 +63,12 @@ const Switch = (_a) => {
|
|
|
103
63
|
const translate = calculateTranslate();
|
|
104
64
|
animation.transitionSwitch(active, translate, transitionValue, animatedColor);
|
|
105
65
|
};
|
|
106
|
-
return /* @__PURE__ */ React__default["default"].createElement(PressableSurface,
|
|
66
|
+
return /* @__PURE__ */ React__default["default"].createElement(PressableSurface, {
|
|
67
|
+
...rest,
|
|
107
68
|
onPress: handleChange,
|
|
108
69
|
effect: "none",
|
|
109
70
|
disabled
|
|
110
|
-
}
|
|
71
|
+
}, /* @__PURE__ */ React__default["default"].createElement(styled.StyledSwitchContent, {
|
|
111
72
|
onLayout: handleSwitchLayout,
|
|
112
73
|
style: { backgroundColor: interpolateColor }
|
|
113
74
|
}, /* @__PURE__ */ React__default["default"].createElement(styled.StyledSwitch, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","sources":["../../../../../src/components/atoms/Switch/Switch.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react';\nimport React, { FC, useCallback, useEffect } from 'react';\nimport {\n Animated,\n LayoutChangeEvent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport {\n ColorGradationType,\n ColorType,\n ThemeProp,\n} from '@tecsinapse/react-core';\nimport {\n extractNumbersFromString,\n lightenDarkenColor,\n RFValueStr,\n} from '../../../utils';\nimport { PressableSurface } from '../PressableSurface';\nimport { transitionSwitch } from './animation';\nimport { StyledSwitch, StyledSwitchContent, SWITCH_PIN_WIDTH } from './styled';\n\nexport interface SwitchProps {\n onChange: (active: boolean) => void;\n active: boolean;\n activeColor?: ColorType;\n activeColorTone?: ColorGradationType;\n inactiveColor?: ColorType;\n inactiveColorTone?: ColorGradationType;\n style?: StyleProp<ViewStyle>;\n dotStyle?: StyleProp<ViewStyle>;\n disabled?: boolean;\n}\n\nconst Switch: FC<SwitchProps> = ({\n onChange,\n activeColor = 'primary',\n activeColorTone = 'medium',\n inactiveColor = 'secondary',\n inactiveColorTone = 'light',\n active,\n dotStyle,\n disabled = false,\n ...rest\n}): JSX.Element => {\n const theme = useTheme() as ThemeProp;\n\n const width = React.useRef(0);\n const transitionValue = React.useRef(new Animated.Value(0)).current;\n const animatedColor = React.useRef(new Animated.Value(0)).current;\n\n const calculateTranslate = () => {\n if (width.current > 0) {\n return (\n width.current -\n extractNumbersFromString(theme.spacing.micro) * 2 -\n extractNumbersFromString(RFValueStr(SWITCH_PIN_WIDTH))\n );\n }\n return 0;\n };\n\n const getBackgroundColor = (color: string) => {\n return disabled\n ? lightenDarkenColor(theme.color[inactiveColor][inactiveColorTone], 20)\n : color;\n };\n\n const interpolateColor = animatedColor.interpolate({\n inputRange: [0, 1],\n outputRange: [\n getBackgroundColor(theme.color[inactiveColor][inactiveColorTone]),\n getBackgroundColor(theme.color[activeColor][activeColorTone]),\n ],\n });\n\n useEffect(() => {\n const translate = calculateTranslate();\n transitionSwitch(active, translate, transitionValue, animatedColor);\n }, [active]);\n\n const handleChange = useCallback(() => {\n onChange(!active);\n }, [active, onChange]);\n\n const handleSwitchLayout = (lce: LayoutChangeEvent) => {\n width.current = lce.nativeEvent.layout.width;\n const translate = calculateTranslate();\n transitionSwitch(active, translate, transitionValue, animatedColor);\n };\n\n return (\n <PressableSurface\n {...rest}\n onPress={handleChange}\n effect=\"none\"\n disabled={disabled}\n >\n <StyledSwitchContent\n onLayout={handleSwitchLayout}\n style={{ backgroundColor: interpolateColor }}\n >\n <StyledSwitch\n style={[dotStyle, { transform: [{ translateX: transitionValue }] }]}\n />\n </StyledSwitchContent>\n </PressableSurface>\n );\n};\n\nexport default Switch;\n"],"names":["useTheme","React","Animated","extractNumbersFromString","RFValueStr","SWITCH_PIN_WIDTH","lightenDarkenColor","useEffect","transitionSwitch","useCallback","StyledSwitchContent","StyledSwitch"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../../../../src/components/atoms/Switch/Switch.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react';\nimport React, { FC, useCallback, useEffect } from 'react';\nimport {\n Animated,\n LayoutChangeEvent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport {\n ColorGradationType,\n ColorType,\n ThemeProp,\n} from '@tecsinapse/react-core';\nimport {\n extractNumbersFromString,\n lightenDarkenColor,\n RFValueStr,\n} from '../../../utils';\nimport { PressableSurface } from '../PressableSurface';\nimport { transitionSwitch } from './animation';\nimport { StyledSwitch, StyledSwitchContent, SWITCH_PIN_WIDTH } from './styled';\n\nexport interface SwitchProps {\n onChange: (active: boolean) => void;\n active: boolean;\n activeColor?: ColorType;\n activeColorTone?: ColorGradationType;\n inactiveColor?: ColorType;\n inactiveColorTone?: ColorGradationType;\n style?: StyleProp<ViewStyle>;\n dotStyle?: StyleProp<ViewStyle>;\n disabled?: boolean;\n}\n\nconst Switch: FC<SwitchProps> = ({\n onChange,\n activeColor = 'primary',\n activeColorTone = 'medium',\n inactiveColor = 'secondary',\n inactiveColorTone = 'light',\n active,\n dotStyle,\n disabled = false,\n ...rest\n}): JSX.Element => {\n const theme = useTheme() as ThemeProp;\n\n const width = React.useRef(0);\n const transitionValue = React.useRef(new Animated.Value(0)).current;\n const animatedColor = React.useRef(new Animated.Value(0)).current;\n\n const calculateTranslate = () => {\n if (width.current > 0) {\n return (\n width.current -\n extractNumbersFromString(theme.spacing.micro) * 2 -\n extractNumbersFromString(RFValueStr(SWITCH_PIN_WIDTH))\n );\n }\n return 0;\n };\n\n const getBackgroundColor = (color: string) => {\n return disabled\n ? lightenDarkenColor(theme.color[inactiveColor][inactiveColorTone], 20)\n : color;\n };\n\n const interpolateColor = animatedColor.interpolate({\n inputRange: [0, 1],\n outputRange: [\n getBackgroundColor(theme.color[inactiveColor][inactiveColorTone]),\n getBackgroundColor(theme.color[activeColor][activeColorTone]),\n ],\n });\n\n useEffect(() => {\n const translate = calculateTranslate();\n transitionSwitch(active, translate, transitionValue, animatedColor);\n }, [active]);\n\n const handleChange = useCallback(() => {\n onChange(!active);\n }, [active, onChange]);\n\n const handleSwitchLayout = (lce: LayoutChangeEvent) => {\n width.current = lce.nativeEvent.layout.width;\n const translate = calculateTranslate();\n transitionSwitch(active, translate, transitionValue, animatedColor);\n };\n\n return (\n <PressableSurface\n {...rest}\n onPress={handleChange}\n effect=\"none\"\n disabled={disabled}\n >\n <StyledSwitchContent\n onLayout={handleSwitchLayout}\n style={{ backgroundColor: interpolateColor }}\n >\n <StyledSwitch\n style={[dotStyle, { transform: [{ translateX: transitionValue }] }]}\n />\n </StyledSwitchContent>\n </PressableSurface>\n );\n};\n\nexport default Switch;\n"],"names":["useTheme","React","Animated","extractNumbersFromString","RFValueStr","SWITCH_PIN_WIDTH","lightenDarkenColor","useEffect","transitionSwitch","useCallback","StyledSwitchContent","StyledSwitch"],"mappings":"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"}
|
|
@@ -9,53 +9,15 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
|
|
10
10
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (__hasOwnProp.call(b, prop))
|
|
22
|
-
__defNormalProp(a, prop, b[prop]);
|
|
23
|
-
if (__getOwnPropSymbols)
|
|
24
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
25
|
-
if (__propIsEnum.call(b, prop))
|
|
26
|
-
__defNormalProp(a, prop, b[prop]);
|
|
27
|
-
}
|
|
28
|
-
return a;
|
|
29
|
-
};
|
|
30
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
31
|
-
var __objRest = (source, exclude) => {
|
|
32
|
-
var target = {};
|
|
33
|
-
for (var prop in source)
|
|
34
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
35
|
-
target[prop] = source[prop];
|
|
36
|
-
if (source != null && __getOwnPropSymbols)
|
|
37
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
38
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
39
|
-
target[prop] = source[prop];
|
|
40
|
-
}
|
|
41
|
-
return target;
|
|
42
|
-
};
|
|
43
|
-
const Tag = (_a) => {
|
|
44
|
-
var _b = _a, {
|
|
45
|
-
value,
|
|
46
|
-
icon,
|
|
47
|
-
variant = "small",
|
|
48
|
-
dismiss: canDismiss = false,
|
|
49
|
-
onDismiss,
|
|
50
|
-
style
|
|
51
|
-
} = _b, rest = __objRest(_b, [
|
|
52
|
-
"value",
|
|
53
|
-
"icon",
|
|
54
|
-
"variant",
|
|
55
|
-
"dismiss",
|
|
56
|
-
"onDismiss",
|
|
57
|
-
"style"
|
|
58
|
-
]);
|
|
12
|
+
const Tag = ({
|
|
13
|
+
value,
|
|
14
|
+
icon,
|
|
15
|
+
variant = "small",
|
|
16
|
+
dismiss: canDismiss = false,
|
|
17
|
+
onDismiss,
|
|
18
|
+
style,
|
|
19
|
+
...rest
|
|
20
|
+
}) => {
|
|
59
21
|
const [dismiss, setDismiss] = React.useState(false);
|
|
60
22
|
const fadeAnim = React__default["default"].useRef(new reactNative.Animated.Value(1)).current;
|
|
61
23
|
const duration = 300;
|
|
@@ -67,18 +29,20 @@ const Tag = (_a) => {
|
|
|
67
29
|
}).start();
|
|
68
30
|
};
|
|
69
31
|
const handleDismiss = React.useCallback(() => {
|
|
70
|
-
onDismiss
|
|
32
|
+
onDismiss?.();
|
|
71
33
|
fadeOut();
|
|
72
34
|
setTimeout(() => setDismiss(true), duration);
|
|
73
35
|
}, [onDismiss]);
|
|
74
|
-
return /* @__PURE__ */ React__default["default"].createElement(styled.StyledTagContainer,
|
|
36
|
+
return /* @__PURE__ */ React__default["default"].createElement(styled.StyledTagContainer, {
|
|
37
|
+
...rest,
|
|
75
38
|
variant,
|
|
76
39
|
style: [{ opacity: fadeAnim }, style],
|
|
77
40
|
visible: !dismiss
|
|
78
|
-
}
|
|
41
|
+
}, icon && /* @__PURE__ */ React__default["default"].createElement(styled.StyledLeftIcon, {
|
|
79
42
|
size: icon.size || "micro",
|
|
80
|
-
colorVariant: icon.colorVariant || "primary"
|
|
81
|
-
|
|
43
|
+
colorVariant: icon.colorVariant || "primary",
|
|
44
|
+
...icon
|
|
45
|
+
}), value, canDismiss && /* @__PURE__ */ React__default["default"].createElement(PressableSurface, {
|
|
82
46
|
onPress: handleDismiss
|
|
83
47
|
}, /* @__PURE__ */ React__default["default"].createElement(styled.StyledCloseIcon, {
|
|
84
48
|
name: "close-outline",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.js","sources":["../../../../../src/components/atoms/Tag/Tag.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { Animated, ViewProps } from 'react-native';\nimport { IconProps } from '../Icon';\nimport { PressableSurface } from '../PressableSurface';\nimport { StyledCloseIcon, StyledLeftIcon, StyledTagContainer } from './styled';\n\nexport interface TagProps extends ViewProps {\n value: React.ReactNode;\n icon?: IconProps;\n dismiss?: boolean;\n onDismiss?: () => void;\n variant?: 'small' | 'default';\n}\n\nconst Tag: React.FC<TagProps> = ({\n value,\n icon,\n variant = 'small',\n dismiss: canDismiss = false,\n onDismiss,\n style,\n ...rest\n}): JSX.Element => {\n const [dismiss, setDismiss] = useState(false);\n const fadeAnim = React.useRef(new Animated.Value(1)).current;\n const duration = 300;\n\n const fadeOut = () => {\n Animated.timing(fadeAnim, {\n toValue: 0,\n duration,\n useNativeDriver: true,\n }).start();\n };\n\n const handleDismiss = useCallback(() => {\n onDismiss?.();\n fadeOut();\n setTimeout(() => setDismiss(true), duration);\n }, [onDismiss]);\n\n return (\n <StyledTagContainer\n {...rest}\n variant={variant}\n style={[{ opacity: fadeAnim as unknown as number }, style]}\n visible={!dismiss}\n >\n {icon && (\n <StyledLeftIcon\n size={icon.size || 'micro'}\n colorVariant={icon.colorVariant || 'primary'}\n {...icon}\n />\n )}\n {value}\n {canDismiss && (\n <PressableSurface onPress={handleDismiss}>\n <StyledCloseIcon\n name=\"close-outline\"\n type=\"ionicon\"\n size=\"centi\"\n fontColor=\"medium\"\n />\n </PressableSurface>\n )}\n </StyledTagContainer>\n );\n};\n\nexport default Tag;\n"],"names":["useState","React","Animated","useCallback","StyledTagContainer","StyledLeftIcon","StyledCloseIcon"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tag.js","sources":["../../../../../src/components/atoms/Tag/Tag.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { Animated, ViewProps } from 'react-native';\nimport { IconProps } from '../Icon';\nimport { PressableSurface } from '../PressableSurface';\nimport { StyledCloseIcon, StyledLeftIcon, StyledTagContainer } from './styled';\n\nexport interface TagProps extends ViewProps {\n value: React.ReactNode;\n icon?: IconProps;\n dismiss?: boolean;\n onDismiss?: () => void;\n variant?: 'small' | 'default';\n}\n\nconst Tag: React.FC<TagProps> = ({\n value,\n icon,\n variant = 'small',\n dismiss: canDismiss = false,\n onDismiss,\n style,\n ...rest\n}): JSX.Element => {\n const [dismiss, setDismiss] = useState(false);\n const fadeAnim = React.useRef(new Animated.Value(1)).current;\n const duration = 300;\n\n const fadeOut = () => {\n Animated.timing(fadeAnim, {\n toValue: 0,\n duration,\n useNativeDriver: true,\n }).start();\n };\n\n const handleDismiss = useCallback(() => {\n onDismiss?.();\n fadeOut();\n setTimeout(() => setDismiss(true), duration);\n }, [onDismiss]);\n\n return (\n <StyledTagContainer\n {...rest}\n variant={variant}\n style={[{ opacity: fadeAnim as unknown as number }, style]}\n visible={!dismiss}\n >\n {icon && (\n <StyledLeftIcon\n size={icon.size || 'micro'}\n colorVariant={icon.colorVariant || 'primary'}\n {...icon}\n />\n )}\n {value}\n {canDismiss && (\n <PressableSurface onPress={handleDismiss}>\n <StyledCloseIcon\n name=\"close-outline\"\n type=\"ionicon\"\n size=\"centi\"\n fontColor=\"medium\"\n />\n </PressableSurface>\n )}\n </StyledTagContainer>\n );\n};\n\nexport default Tag;\n"],"names":["useState","React","Animated","useCallback","StyledTagContainer","StyledLeftIcon","StyledCloseIcon"],"mappings":";;;;;;;;;;;AAcA,MAAM,MAA0B,CAAC;AAAA,EAC/B,KAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAU,GAAA,OAAA;AAAA,EACV,SAAS,UAAa,GAAA,KAAA;AAAA,EACtB,SAAA;AAAA,EACA,KAAA;AAAA,EACG,GAAA,IAAA;AACL,CAAmB,KAAA;AACjB,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAIA,eAAS,KAAK,CAAA,CAAA;AAC5C,EAAM,MAAA,QAAA,GAAWC,0BAAM,MAAO,CAAA,IAAIC,qBAAS,KAAM,CAAA,CAAC,CAAC,CAAE,CAAA,OAAA,CAAA;AACrD,EAAA,MAAM,QAAW,GAAA,GAAA,CAAA;AAEjB,EAAA,MAAM,UAAU,MAAM;AACpB,IAAAA,oBAAA,CAAS,OAAO,QAAU,EAAA;AAAA,MACxB,OAAS,EAAA,CAAA;AAAA,MACT,QAAA;AAAA,MACA,eAAiB,EAAA,IAAA;AAAA,KAClB,EAAE,KAAM,EAAA,CAAA;AAAA,GACX,CAAA;AAEA,EAAM,MAAA,aAAA,GAAgBC,kBAAY,MAAM;AACtC,IAAY,SAAA,IAAA,CAAA;AACZ,IAAQ,OAAA,EAAA,CAAA;AACR,IAAA,UAAA,CAAW,MAAM,UAAA,CAAW,IAAI,CAAA,EAAG,QAAQ,CAAA,CAAA;AAAA,GAC7C,EAAG,CAAC,SAAS,CAAC,CAAA,CAAA;AAEd,EAAA,uBACGF,yBAAA,CAAA,aAAA,CAAAG,yBAAA,EAAA;AAAA,IACE,GAAG,IAAA;AAAA,IACJ,OAAA;AAAA,IACA,OAAO,CAAC,EAAE,OAAS,EAAA,QAAA,IAAiC,KAAK,CAAA;AAAA,IACzD,SAAS,CAAC,OAAA;AAAA,GAAA,EAET,wBACEH,yBAAA,CAAA,aAAA,CAAAI,qBAAA,EAAA;AAAA,IACC,IAAA,EAAM,KAAK,IAAQ,IAAA,OAAA;AAAA,IACnB,YAAA,EAAc,KAAK,YAAgB,IAAA,SAAA;AAAA,IAClC,GAAG,IAAA;AAAA,GACN,CAAA,EAED,KACA,EAAA,UAAA,oBACEJ,yBAAA,CAAA,aAAA,CAAA,gBAAA,EAAA;AAAA,IAAiB,OAAS,EAAA,aAAA;AAAA,GAAA,kBACxBA,yBAAA,CAAA,aAAA,CAAAK,sBAAA,EAAA;AAAA,IACC,IAAK,EAAA,eAAA;AAAA,IACL,IAAK,EAAA,SAAA;AAAA,IACL,IAAK,EAAA,OAAA;AAAA,IACL,SAAU,EAAA,QAAA;AAAA,GACZ,CACF,CAEJ,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -8,64 +8,22 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
8
8
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return a;
|
|
28
|
-
};
|
|
29
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
30
|
-
var __objRest = (source, exclude) => {
|
|
31
|
-
var target = {};
|
|
32
|
-
for (var prop in source)
|
|
33
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
34
|
-
target[prop] = source[prop];
|
|
35
|
-
if (source != null && __getOwnPropSymbols)
|
|
36
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
37
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
38
|
-
target[prop] = source[prop];
|
|
39
|
-
}
|
|
40
|
-
return target;
|
|
41
|
-
};
|
|
42
|
-
const Text = (_a) => {
|
|
43
|
-
var _b = _a, {
|
|
44
|
-
children,
|
|
45
|
-
style,
|
|
46
|
-
fontColor = "dark",
|
|
47
|
-
colorTone = "medium",
|
|
48
|
-
colorVariant,
|
|
49
|
-
fontWeight = "regular",
|
|
50
|
-
typography = "base",
|
|
51
|
-
numberOfLines,
|
|
52
|
-
ellipsizeMode,
|
|
53
|
-
textTransform = "none",
|
|
54
|
-
capitalFirst = false
|
|
55
|
-
} = _b, rest = __objRest(_b, [
|
|
56
|
-
"children",
|
|
57
|
-
"style",
|
|
58
|
-
"fontColor",
|
|
59
|
-
"colorTone",
|
|
60
|
-
"colorVariant",
|
|
61
|
-
"fontWeight",
|
|
62
|
-
"typography",
|
|
63
|
-
"numberOfLines",
|
|
64
|
-
"ellipsizeMode",
|
|
65
|
-
"textTransform",
|
|
66
|
-
"capitalFirst"
|
|
67
|
-
]);
|
|
68
|
-
return /* @__PURE__ */ React__default["default"].createElement(styled.StyledColoredText, __spreadProps(__spreadValues({}, rest), {
|
|
11
|
+
const Text = ({
|
|
12
|
+
children,
|
|
13
|
+
style,
|
|
14
|
+
fontColor = "dark",
|
|
15
|
+
colorTone = "medium",
|
|
16
|
+
colorVariant,
|
|
17
|
+
fontWeight = "regular",
|
|
18
|
+
typography = "base",
|
|
19
|
+
numberOfLines,
|
|
20
|
+
ellipsizeMode,
|
|
21
|
+
textTransform = "none",
|
|
22
|
+
capitalFirst = false,
|
|
23
|
+
...rest
|
|
24
|
+
}) => {
|
|
25
|
+
return /* @__PURE__ */ React__default["default"].createElement(styled.StyledColoredText, {
|
|
26
|
+
...rest,
|
|
69
27
|
style,
|
|
70
28
|
fontColor,
|
|
71
29
|
colorTone,
|
|
@@ -75,7 +33,7 @@ const Text = (_a) => {
|
|
|
75
33
|
numberOfLines,
|
|
76
34
|
ellipsizeMode,
|
|
77
35
|
textTransform
|
|
78
|
-
}
|
|
36
|
+
}, functions.getLabel(children, capitalFirst));
|
|
79
37
|
};
|
|
80
38
|
|
|
81
39
|
module.exports = Text;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sources":["../../../../../src/components/atoms/Text/Text.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport {\n ColorGradationType,\n ColorType,\n FontColorType,\n FontStackType,\n FontWeightType,\n TypographyVariationType,\n} from '@tecsinapse/react-core';\nimport { StyleProp, TextStyle } from 'react-native';\nimport { StyledColoredText } from './styled';\nimport { getLabel } from './functions';\n\nexport interface TextProps {\n /** Font theme text color */\n fontColor?: FontColorType;\n /** Font theme weight */\n fontWeight?: FontWeightType;\n /** Font theme sizes */\n typography?: TypographyVariationType;\n /** Font theme stack */\n fontStack?: FontStackType;\n /** Palette theme colors. You can specify this prop to override theme fontColor */\n colorVariant?: ColorType;\n /** Palette theme colors gradation */\n colorTone?: ColorGradationType;\n numberOfLines?: number;\n ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip';\n textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize';\n capitalFirst?: boolean;\n style?: StyleProp<TextStyle>;\n children?: React.ReactNode;\n}\n\n/** NOTE: When using colors, be careful to not override fontColor by using colorVariant and colorTone, referent to theme colors and not text colors. */\nconst Text: FC<TextProps> = ({\n children,\n style,\n fontColor = 'dark',\n colorTone = 'medium',\n colorVariant,\n fontWeight = 'regular',\n typography = 'base',\n numberOfLines,\n ellipsizeMode,\n textTransform = 'none',\n capitalFirst = false,\n ...rest\n}): JSX.Element => {\n return (\n <StyledColoredText\n {...rest}\n style={style}\n fontColor={fontColor}\n colorTone={colorTone}\n colorVariant={colorVariant}\n fontWeight={fontWeight}\n typography={typography}\n numberOfLines={numberOfLines}\n ellipsizeMode={ellipsizeMode}\n textTransform={textTransform}\n >\n {getLabel(children, capitalFirst)}\n </StyledColoredText>\n );\n};\n\nexport default Text;\n"],"names":["React","StyledColoredText","getLabel"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Text.js","sources":["../../../../../src/components/atoms/Text/Text.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport {\n ColorGradationType,\n ColorType,\n FontColorType,\n FontStackType,\n FontWeightType,\n TypographyVariationType,\n} from '@tecsinapse/react-core';\nimport { StyleProp, TextStyle } from 'react-native';\nimport { StyledColoredText } from './styled';\nimport { getLabel } from './functions';\n\nexport interface TextProps {\n /** Font theme text color */\n fontColor?: FontColorType;\n /** Font theme weight */\n fontWeight?: FontWeightType;\n /** Font theme sizes */\n typography?: TypographyVariationType;\n /** Font theme stack */\n fontStack?: FontStackType;\n /** Palette theme colors. You can specify this prop to override theme fontColor */\n colorVariant?: ColorType;\n /** Palette theme colors gradation */\n colorTone?: ColorGradationType;\n numberOfLines?: number;\n ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip';\n textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize';\n capitalFirst?: boolean;\n style?: StyleProp<TextStyle>;\n children?: React.ReactNode;\n}\n\n/** NOTE: When using colors, be careful to not override fontColor by using colorVariant and colorTone, referent to theme colors and not text colors. */\nconst Text: FC<TextProps> = ({\n children,\n style,\n fontColor = 'dark',\n colorTone = 'medium',\n colorVariant,\n fontWeight = 'regular',\n typography = 'base',\n numberOfLines,\n ellipsizeMode,\n textTransform = 'none',\n capitalFirst = false,\n ...rest\n}): JSX.Element => {\n return (\n <StyledColoredText\n {...rest}\n style={style}\n fontColor={fontColor}\n colorTone={colorTone}\n colorVariant={colorVariant}\n fontWeight={fontWeight}\n typography={typography}\n numberOfLines={numberOfLines}\n ellipsizeMode={ellipsizeMode}\n textTransform={textTransform}\n >\n {getLabel(children, capitalFirst)}\n </StyledColoredText>\n );\n};\n\nexport default Text;\n"],"names":["React","StyledColoredText","getLabel"],"mappings":";;;;;;;;;;AAmCA,MAAM,OAAsB,CAAC;AAAA,EAC3B,QAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAY,GAAA,MAAA;AAAA,EACZ,SAAY,GAAA,QAAA;AAAA,EACZ,YAAA;AAAA,EACA,UAAa,GAAA,SAAA;AAAA,EACb,UAAa,GAAA,MAAA;AAAA,EACb,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAgB,GAAA,MAAA;AAAA,EAChB,YAAe,GAAA,KAAA;AAAA,EACZ,GAAA,IAAA;AACL,CAAmB,KAAA;AACjB,EAAA,uBACGA,yBAAA,CAAA,aAAA,CAAAC,wBAAA,EAAA;AAAA,IACE,GAAG,IAAA;AAAA,IACJ,KAAA;AAAA,IACA,SAAA;AAAA,IACA,SAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,aAAA;AAAA,IACA,aAAA;AAAA,IACA,aAAA;AAAA,GAEC,EAAAC,kBAAA,CAAS,QAAU,EAAA,YAAY,CAClC,CAAA,CAAA;AAEJ;;;;"}
|