@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
|
@@ -8,55 +8,19 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
8
8
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
10
|
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __defProps = Object.defineProperties;
|
|
13
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
14
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
17
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18
|
-
var __spreadValues = (a, b) => {
|
|
19
|
-
for (var prop in b || (b = {}))
|
|
20
|
-
if (__hasOwnProp.call(b, prop))
|
|
21
|
-
__defNormalProp(a, prop, b[prop]);
|
|
22
|
-
if (__getOwnPropSymbols)
|
|
23
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
24
|
-
if (__propIsEnum.call(b, prop))
|
|
25
|
-
__defNormalProp(a, prop, b[prop]);
|
|
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
11
|
const InputElement = React__default["default"].forwardRef(
|
|
43
|
-
(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"onChange",
|
|
52
|
-
"placeholder",
|
|
53
|
-
"value",
|
|
54
|
-
"disabled",
|
|
55
|
-
"placeholderTextColor"
|
|
56
|
-
]);
|
|
12
|
+
({
|
|
13
|
+
onChange,
|
|
14
|
+
placeholder,
|
|
15
|
+
value,
|
|
16
|
+
disabled = false,
|
|
17
|
+
placeholderTextColor,
|
|
18
|
+
...rest
|
|
19
|
+
}, ref) => {
|
|
57
20
|
const theme = react.useTheme();
|
|
58
21
|
const _placeholderColor = placeholderTextColor || theme.font.color.dark;
|
|
59
|
-
return /* @__PURE__ */ React__default["default"].createElement(styled.StyledInputElement,
|
|
22
|
+
return /* @__PURE__ */ React__default["default"].createElement(styled.StyledInputElement, {
|
|
23
|
+
...rest,
|
|
60
24
|
ref,
|
|
61
25
|
onChangeText: onChange,
|
|
62
26
|
value,
|
|
@@ -64,7 +28,7 @@ const InputElement = React__default["default"].forwardRef(
|
|
|
64
28
|
placeholderTextColor: _placeholderColor,
|
|
65
29
|
disabled,
|
|
66
30
|
editable: !disabled
|
|
67
|
-
})
|
|
31
|
+
});
|
|
68
32
|
}
|
|
69
33
|
);
|
|
70
34
|
InputElement.displayName = "InputElement";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputElement.js","sources":["../../../../../../src/components/atoms/Input/InputElement/InputElement.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react';\nimport { ThemeProp } from '@tecsinapse/react-core';\nimport React from 'react';\nimport { StyleProp, TextInput, TextInputProps, TextStyle } from 'react-native';\nimport { StyledInputElement } from '../styled';\n\nexport interface InputElementProps\n extends Omit<TextInputProps, 'onChange' | 'value' | 'ref'> {\n style?: StyleProp<TextStyle>;\n value?: string;\n placeholder?: string;\n disabled?: boolean;\n onChange?: (value: string) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n}\n\nconst InputElement = React.forwardRef<TextInput, InputElementProps>(\n (\n {\n onChange,\n placeholder,\n value,\n disabled = false,\n placeholderTextColor,\n ...rest\n },\n ref\n ): JSX.Element => {\n const theme = useTheme() as ThemeProp;\n const _placeholderColor = placeholderTextColor || theme.font.color.dark;\n\n return (\n <StyledInputElement\n {...rest}\n ref={ref}\n onChangeText={onChange}\n value={value}\n placeholder={placeholder}\n placeholderTextColor={_placeholderColor}\n disabled={disabled}\n editable={!disabled}\n />\n );\n }\n);\n\nInputElement.displayName = 'InputElement';\n\nexport default InputElement;\n"],"names":["React","useTheme","StyledInputElement"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InputElement.js","sources":["../../../../../../src/components/atoms/Input/InputElement/InputElement.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react';\nimport { ThemeProp } from '@tecsinapse/react-core';\nimport React from 'react';\nimport { StyleProp, TextInput, TextInputProps, TextStyle } from 'react-native';\nimport { StyledInputElement } from '../styled';\n\nexport interface InputElementProps\n extends Omit<TextInputProps, 'onChange' | 'value' | 'ref'> {\n style?: StyleProp<TextStyle>;\n value?: string;\n placeholder?: string;\n disabled?: boolean;\n onChange?: (value: string) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n}\n\nconst InputElement = React.forwardRef<TextInput, InputElementProps>(\n (\n {\n onChange,\n placeholder,\n value,\n disabled = false,\n placeholderTextColor,\n ...rest\n },\n ref\n ): JSX.Element => {\n const theme = useTheme() as ThemeProp;\n const _placeholderColor = placeholderTextColor || theme.font.color.dark;\n\n return (\n <StyledInputElement\n {...rest}\n ref={ref}\n onChangeText={onChange}\n value={value}\n placeholder={placeholder}\n placeholderTextColor={_placeholderColor}\n disabled={disabled}\n editable={!disabled}\n />\n );\n }\n);\n\nInputElement.displayName = 'InputElement';\n\nexport default InputElement;\n"],"names":["React","useTheme","StyledInputElement"],"mappings":";;;;;;;;;;AAiBA,MAAM,eAAeA,yBAAM,CAAA,UAAA;AAAA,EACzB,CACE;AAAA,IACE,QAAA;AAAA,IACA,WAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAW,GAAA,KAAA;AAAA,IACX,oBAAA;AAAA,IACG,GAAA,IAAA;AAAA,KAEL,GACgB,KAAA;AAChB,IAAA,MAAM,QAAQC,cAAS,EAAA,CAAA;AACvB,IAAA,MAAM,iBAAoB,GAAA,oBAAA,IAAwB,KAAM,CAAA,IAAA,CAAK,KAAM,CAAA,IAAA,CAAA;AAEnE,IAAA,uBACGD,yBAAA,CAAA,aAAA,CAAAE,yBAAA,EAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,GAAA;AAAA,MACA,YAAc,EAAA,QAAA;AAAA,MACd,KAAA;AAAA,MACA,WAAA;AAAA,MACA,oBAAsB,EAAA,iBAAA;AAAA,MACtB,QAAA;AAAA,MACA,UAAU,CAAC,QAAA;AAAA,KACb,CAAA,CAAA;AAAA,GAEJ;AACF,EAAA;AAEA,YAAA,CAAa,WAAc,GAAA,cAAA;;;;"}
|
|
@@ -10,54 +10,16 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
10
|
|
|
11
11
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
12
|
|
|
13
|
-
var __defProp = Object.defineProperty;
|
|
14
|
-
var __defProps = Object.defineProperties;
|
|
15
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
16
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
17
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
19
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
20
|
-
var __spreadValues = (a, b) => {
|
|
21
|
-
for (var prop in b || (b = {}))
|
|
22
|
-
if (__hasOwnProp.call(b, prop))
|
|
23
|
-
__defNormalProp(a, prop, b[prop]);
|
|
24
|
-
if (__getOwnPropSymbols)
|
|
25
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
26
|
-
if (__propIsEnum.call(b, prop))
|
|
27
|
-
__defNormalProp(a, prop, b[prop]);
|
|
28
|
-
}
|
|
29
|
-
return a;
|
|
30
|
-
};
|
|
31
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
32
|
-
var __objRest = (source, exclude) => {
|
|
33
|
-
var target = {};
|
|
34
|
-
for (var prop in source)
|
|
35
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
36
|
-
target[prop] = source[prop];
|
|
37
|
-
if (source != null && __getOwnPropSymbols)
|
|
38
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
39
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
40
|
-
target[prop] = source[prop];
|
|
41
|
-
}
|
|
42
|
-
return target;
|
|
43
|
-
};
|
|
44
13
|
const InputMaskElement = React__default["default"].forwardRef(
|
|
45
|
-
(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"onChange",
|
|
55
|
-
"placeholder",
|
|
56
|
-
"value",
|
|
57
|
-
"disabled",
|
|
58
|
-
"placeholderTextColor",
|
|
59
|
-
"mask"
|
|
60
|
-
]);
|
|
14
|
+
({
|
|
15
|
+
onChange,
|
|
16
|
+
placeholder,
|
|
17
|
+
value,
|
|
18
|
+
disabled = false,
|
|
19
|
+
placeholderTextColor,
|
|
20
|
+
mask,
|
|
21
|
+
...rest
|
|
22
|
+
}, ref) => {
|
|
61
23
|
const theme = react.useTheme();
|
|
62
24
|
const _placeholderColor = placeholderTextColor || theme.font.color.dark;
|
|
63
25
|
const getInputHook = (value2) => {
|
|
@@ -71,11 +33,11 @@ const InputMaskElement = React__default["default"].forwardRef(
|
|
|
71
33
|
return [void 0, void 0];
|
|
72
34
|
}
|
|
73
35
|
};
|
|
74
|
-
const [maskValue, setMaskValue] = getInputHook(value
|
|
75
|
-
const _value = maskValue === void 0 ? value
|
|
36
|
+
const [maskValue, setMaskValue] = getInputHook(value ?? "");
|
|
37
|
+
const _value = maskValue === void 0 ? value?.toString() : maskValue.formatted ? maskValue.formatted : "";
|
|
76
38
|
React.useEffect(() => {
|
|
77
39
|
if (onChange) {
|
|
78
|
-
onChange(maskValue
|
|
40
|
+
onChange(maskValue?.raw);
|
|
79
41
|
}
|
|
80
42
|
}, [maskValue]);
|
|
81
43
|
const onChangeValue = React.useCallback(
|
|
@@ -96,7 +58,8 @@ const InputMaskElement = React__default["default"].forwardRef(
|
|
|
96
58
|
onChangeValue(value);
|
|
97
59
|
}
|
|
98
60
|
}, [value]);
|
|
99
|
-
return /* @__PURE__ */ React__default["default"].createElement(styled.StyledInputElement,
|
|
61
|
+
return /* @__PURE__ */ React__default["default"].createElement(styled.StyledInputElement, {
|
|
62
|
+
...rest,
|
|
100
63
|
ref,
|
|
101
64
|
onChangeText: onChangeValue,
|
|
102
65
|
value: _value,
|
|
@@ -104,7 +67,7 @@ const InputMaskElement = React__default["default"].forwardRef(
|
|
|
104
67
|
placeholderTextColor: _placeholderColor,
|
|
105
68
|
disabled,
|
|
106
69
|
editable: !disabled
|
|
107
|
-
})
|
|
70
|
+
});
|
|
108
71
|
}
|
|
109
72
|
);
|
|
110
73
|
InputMaskElement.displayName = "InputMaskElement";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputMaskElement.js","sources":["../../../../../../src/components/atoms/Input/InputMaskElement/InputMaskElement.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react';\nimport { ThemeProp } from '@tecsinapse/react-core';\nimport React, { useCallback, useEffect } from 'react';\nimport { StyleProp, TextInput, TextInputProps, TextStyle } from 'react-native';\nimport { StyledInputElement } from '../styled';\nimport { MaskType, useStringMask } from '../hooks/useStringMask';\nimport { CurrencyOptions, useNumberMask } from '../hooks/useNumberMask';\n\nexport interface InputMaskElementProps\n extends Omit<TextInputProps, 'onChange' | 'value' | 'ref'> {\n style?: StyleProp<TextStyle>;\n value?: string | number;\n placeholder?: string;\n disabled?: boolean;\n onChange?: (value: any) => void;\n /**\n To use mask for strings you have to pass a MaskType[] or ((value: string) => MaskType[])\n A MaskType can be a string, RegExp, or Array<RegExp>.\n In case we have a string, '9' represents digits, 'a' represents alphabet characters, and any other character represents fixed characters in the mask.\n For example a phone mask can be represented as ['(99) \\\\99999-9999'], or ['(99) ', '/[9]/', '9999-9999'], or ['(', /[0-9]/, /[0-9]/, ') ', '/[9]/', '9999-9999'] and many others.\n To use mask for numbers you have to pass a CurrencyOptions object\n A CurrencyOptions object contains symbol, separator, decimal, precision. For example {symbol: 'R$ ', separator: '.', decimal: ',', precision: 2,}.\n **/\n mask?: (MaskType[] | ((value: string) => MaskType[])) | CurrencyOptions;\n onFocus?: () => void;\n onBlur?: () => void;\n}\n\nconst InputMaskElement = React.forwardRef<TextInput, InputMaskElementProps>(\n (\n {\n onChange,\n placeholder,\n value,\n disabled = false,\n placeholderTextColor,\n mask,\n ...rest\n },\n ref\n ): JSX.Element => {\n const theme = useTheme() as ThemeProp;\n\n const _placeholderColor = placeholderTextColor || theme.font.color.dark;\n\n const getInputHook = (value: string | number) => {\n if (mask !== undefined) {\n if (Array.isArray(mask) || typeof mask === 'function') {\n return useStringMask(mask, value);\n } else {\n return useNumberMask(mask, value);\n }\n } else {\n return [undefined, undefined];\n }\n };\n\n const [maskValue, setMaskValue] = getInputHook(value ?? '');\n\n const _value =\n maskValue === undefined\n ? value?.toString()\n : maskValue.formatted\n ? maskValue.formatted\n : '';\n\n useEffect(() => {\n if (onChange) {\n onChange(maskValue?.raw);\n }\n }, [maskValue]);\n\n const onChangeValue = useCallback(\n (value: string | number) => {\n if (maskValue !== undefined && setMaskValue !== undefined) {\n setMaskValue(value);\n } else onChange && onChange(value);\n },\n [value]\n );\n\n useEffect(() => {\n /** Used to reinitialize maskValue when the value is updated in the parent component **/\n if (\n maskValue !== undefined &&\n setMaskValue !== undefined &&\n value !== undefined &&\n typeof maskValue === 'object'\n ) {\n /** Case there is a mask **/\n if (\n maskValue.raw !== undefined &&\n maskValue.raw.toString() !== value.toString()\n ) {\n onChangeValue(value);\n }\n } else if (maskValue === undefined && value !== undefined) {\n onChangeValue(value);\n }\n }, [value]);\n\n return (\n <StyledInputElement\n {...rest}\n ref={ref}\n onChangeText={onChangeValue}\n value={_value}\n placeholder={placeholder}\n placeholderTextColor={_placeholderColor}\n disabled={disabled}\n editable={!disabled}\n />\n );\n }\n);\n\nInputMaskElement.displayName = 'InputMaskElement';\n\nexport default InputMaskElement;\n"],"names":["React","useTheme","value","useStringMask","useNumberMask","useEffect","useCallback","StyledInputElement"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InputMaskElement.js","sources":["../../../../../../src/components/atoms/Input/InputMaskElement/InputMaskElement.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react';\nimport { ThemeProp } from '@tecsinapse/react-core';\nimport React, { useCallback, useEffect } from 'react';\nimport { StyleProp, TextInput, TextInputProps, TextStyle } from 'react-native';\nimport { StyledInputElement } from '../styled';\nimport { MaskType, useStringMask } from '../hooks/useStringMask';\nimport { CurrencyOptions, useNumberMask } from '../hooks/useNumberMask';\n\nexport interface InputMaskElementProps\n extends Omit<TextInputProps, 'onChange' | 'value' | 'ref'> {\n style?: StyleProp<TextStyle>;\n value?: string | number;\n placeholder?: string;\n disabled?: boolean;\n onChange?: (value: any) => void;\n /**\n To use mask for strings you have to pass a MaskType[] or ((value: string) => MaskType[])\n A MaskType can be a string, RegExp, or Array<RegExp>.\n In case we have a string, '9' represents digits, 'a' represents alphabet characters, and any other character represents fixed characters in the mask.\n For example a phone mask can be represented as ['(99) \\\\99999-9999'], or ['(99) ', '/[9]/', '9999-9999'], or ['(', /[0-9]/, /[0-9]/, ') ', '/[9]/', '9999-9999'] and many others.\n To use mask for numbers you have to pass a CurrencyOptions object\n A CurrencyOptions object contains symbol, separator, decimal, precision. For example {symbol: 'R$ ', separator: '.', decimal: ',', precision: 2,}.\n **/\n mask?: (MaskType[] | ((value: string) => MaskType[])) | CurrencyOptions;\n onFocus?: () => void;\n onBlur?: () => void;\n}\n\nconst InputMaskElement = React.forwardRef<TextInput, InputMaskElementProps>(\n (\n {\n onChange,\n placeholder,\n value,\n disabled = false,\n placeholderTextColor,\n mask,\n ...rest\n },\n ref\n ): JSX.Element => {\n const theme = useTheme() as ThemeProp;\n\n const _placeholderColor = placeholderTextColor || theme.font.color.dark;\n\n const getInputHook = (value: string | number) => {\n if (mask !== undefined) {\n if (Array.isArray(mask) || typeof mask === 'function') {\n return useStringMask(mask, value);\n } else {\n return useNumberMask(mask, value);\n }\n } else {\n return [undefined, undefined];\n }\n };\n\n const [maskValue, setMaskValue] = getInputHook(value ?? '');\n\n const _value =\n maskValue === undefined\n ? value?.toString()\n : maskValue.formatted\n ? maskValue.formatted\n : '';\n\n useEffect(() => {\n if (onChange) {\n onChange(maskValue?.raw);\n }\n }, [maskValue]);\n\n const onChangeValue = useCallback(\n (value: string | number) => {\n if (maskValue !== undefined && setMaskValue !== undefined) {\n setMaskValue(value);\n } else onChange && onChange(value);\n },\n [value]\n );\n\n useEffect(() => {\n /** Used to reinitialize maskValue when the value is updated in the parent component **/\n if (\n maskValue !== undefined &&\n setMaskValue !== undefined &&\n value !== undefined &&\n typeof maskValue === 'object'\n ) {\n /** Case there is a mask **/\n if (\n maskValue.raw !== undefined &&\n maskValue.raw.toString() !== value.toString()\n ) {\n onChangeValue(value);\n }\n } else if (maskValue === undefined && value !== undefined) {\n onChangeValue(value);\n }\n }, [value]);\n\n return (\n <StyledInputElement\n {...rest}\n ref={ref}\n onChangeText={onChangeValue}\n value={_value}\n placeholder={placeholder}\n placeholderTextColor={_placeholderColor}\n disabled={disabled}\n editable={!disabled}\n />\n );\n }\n);\n\nInputMaskElement.displayName = 'InputMaskElement';\n\nexport default InputMaskElement;\n"],"names":["React","useTheme","value","useStringMask","useNumberMask","useEffect","useCallback","StyledInputElement"],"mappings":";;;;;;;;;;;;AA4BA,MAAM,mBAAmBA,yBAAM,CAAA,UAAA;AAAA,EAC7B,CACE;AAAA,IACE,QAAA;AAAA,IACA,WAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAW,GAAA,KAAA;AAAA,IACX,oBAAA;AAAA,IACA,IAAA;AAAA,IACG,GAAA,IAAA;AAAA,KAEL,GACgB,KAAA;AAChB,IAAA,MAAM,QAAQC,cAAS,EAAA,CAAA;AAEvB,IAAA,MAAM,iBAAoB,GAAA,oBAAA,IAAwB,KAAM,CAAA,IAAA,CAAK,KAAM,CAAA,IAAA,CAAA;AAEnE,IAAM,MAAA,YAAA,GAAe,CAACC,MAA2B,KAAA;AAC/C,MAAA,IAAI,SAAS,KAAW,CAAA,EAAA;AACtB,QAAA,IAAI,MAAM,OAAQ,CAAA,IAAI,CAAK,IAAA,OAAO,SAAS,UAAY,EAAA;AACrD,UAAO,OAAAC,2BAAA,CAAc,MAAMD,MAAK,CAAA,CAAA;AAAA,SAC3B,MAAA;AACL,UAAO,OAAAE,2BAAA,CAAc,MAAMF,MAAK,CAAA,CAA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aAAA,CAAc,KAAK,CAAA,CAAA;AAAA,OACrB;AAAA,KACF,EAAG,CAAC,KAAK,CAAC,CAAA,CAAA;AAEV,IAAA,uBACGL,yBAAA,CAAA,aAAA,CAAAO,yBAAA,EAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,GAAA;AAAA,MACA,YAAc,EAAA,aAAA;AAAA,MACd,KAAO,EAAA,MAAA;AAAA,MACP,WAAA;AAAA,MACA,oBAAsB,EAAA,iBAAA;AAAA,MACtB,QAAA;AAAA,MACA,UAAU,CAAC,QAAA;AAAA,KACb,CAAA,CAAA;AAAA,GAEJ;AACF,EAAA;AAEA,gBAAA,CAAiB,WAAc,GAAA,kBAAA;;;;"}
|
|
@@ -24,53 +24,21 @@ function _interopNamespace(e) {
|
|
|
24
24
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (__hasOwnProp.call(b, prop))
|
|
35
|
-
__defNormalProp(a, prop, b[prop]);
|
|
36
|
-
if (__getOwnPropSymbols)
|
|
37
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
38
|
-
if (__propIsEnum.call(b, prop))
|
|
39
|
-
__defNormalProp(a, prop, b[prop]);
|
|
40
|
-
}
|
|
41
|
-
return a;
|
|
42
|
-
};
|
|
43
|
-
var __objRest = (source, exclude) => {
|
|
44
|
-
var target = {};
|
|
45
|
-
for (var prop in source)
|
|
46
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
47
|
-
target[prop] = source[prop];
|
|
48
|
-
if (source != null && __getOwnPropSymbols)
|
|
49
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
50
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
51
|
-
target[prop] = source[prop];
|
|
52
|
-
}
|
|
53
|
-
return target;
|
|
54
|
-
};
|
|
55
|
-
const PressableInputContainer = (_a) => {
|
|
56
|
-
var _b = _a, {
|
|
57
|
-
onPress,
|
|
58
|
-
disabled,
|
|
59
|
-
style,
|
|
60
|
-
children
|
|
61
|
-
} = _b, rest = __objRest(_b, [
|
|
62
|
-
"onPress",
|
|
63
|
-
"disabled",
|
|
64
|
-
"style",
|
|
65
|
-
"children"
|
|
66
|
-
]);
|
|
27
|
+
const PressableInputContainer = ({
|
|
28
|
+
onPress,
|
|
29
|
+
disabled,
|
|
30
|
+
style,
|
|
31
|
+
children,
|
|
32
|
+
...rest
|
|
33
|
+
}) => {
|
|
67
34
|
return /* @__PURE__ */ React__namespace.createElement(styled.StyledPressableSurface, {
|
|
68
35
|
onPress,
|
|
69
36
|
disabled,
|
|
70
37
|
style
|
|
71
|
-
}, /* @__PURE__ */ React__namespace.createElement(InputContainer,
|
|
72
|
-
disabled
|
|
73
|
-
|
|
38
|
+
}, /* @__PURE__ */ React__namespace.createElement(InputContainer, {
|
|
39
|
+
disabled,
|
|
40
|
+
...rest
|
|
41
|
+
}, children));
|
|
74
42
|
};
|
|
75
43
|
|
|
76
44
|
module.exports = PressableInputContainer;
|
package/dist/cjs/components/atoms/Input/PressableInputContainer/PressableInputContainer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PressableInputContainer.js","sources":["../../../../../../src/components/atoms/Input/PressableInputContainer/PressableInputContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { PressableStateCallbackType, StyleProp, ViewStyle } from 'react-native';\nimport InputContainer, {\n InputContainerProps,\n} from '../InputContainer/InputContainer';\nimport { StyledPressableSurface } from './styled';\n\nexport interface PressableInputContainerProps\n extends Omit<\n InputContainerProps,\n 'value' | 'onChange' | 'onChangeText' | 'disabled' | 'style'\n > {\n onPress?: () => void | never;\n disabled?: boolean;\n style?:\n | StyleProp<ViewStyle>\n | ((state: PressableStateCallbackType) => StyleProp<ViewStyle>);\n}\n\nconst PressableInputContainer: React.FC<PressableInputContainerProps> = ({\n onPress,\n disabled,\n style,\n children,\n ...rest\n}) => {\n return (\n <StyledPressableSurface onPress={onPress} disabled={disabled} style={style}>\n <InputContainer disabled={disabled} {...rest}>\n {children}\n </InputContainer>\n </StyledPressableSurface>\n );\n};\n\nexport default PressableInputContainer;\n"],"names":["React","StyledPressableSurface"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PressableInputContainer.js","sources":["../../../../../../src/components/atoms/Input/PressableInputContainer/PressableInputContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { PressableStateCallbackType, StyleProp, ViewStyle } from 'react-native';\nimport InputContainer, {\n InputContainerProps,\n} from '../InputContainer/InputContainer';\nimport { StyledPressableSurface } from './styled';\n\nexport interface PressableInputContainerProps\n extends Omit<\n InputContainerProps,\n 'value' | 'onChange' | 'onChangeText' | 'disabled' | 'style'\n > {\n onPress?: () => void | never;\n disabled?: boolean;\n style?:\n | StyleProp<ViewStyle>\n | ((state: PressableStateCallbackType) => StyleProp<ViewStyle>);\n}\n\nconst PressableInputContainer: React.FC<PressableInputContainerProps> = ({\n onPress,\n disabled,\n style,\n children,\n ...rest\n}) => {\n return (\n <StyledPressableSurface onPress={onPress} disabled={disabled} style={style}>\n <InputContainer disabled={disabled} {...rest}>\n {children}\n </InputContainer>\n </StyledPressableSurface>\n );\n};\n\nexport default PressableInputContainer;\n"],"names":["React","StyledPressableSurface"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,0BAAkE,CAAC;AAAA,EACvE,OAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACG,GAAA,IAAA;AACL,CAAM,KAAA;AACJ,EAAA,uBACGA,gBAAA,CAAA,aAAA,CAAAC,6BAAA,EAAA;AAAA,IAAuB,OAAA;AAAA,IAAkB,QAAA;AAAA,IAAoB,KAAA;AAAA,GAAA,kBAC3DD,gBAAA,CAAA,aAAA,CAAA,cAAA,EAAA;AAAA,IAAe,QAAA;AAAA,IAAqB,GAAG,IAAA;AAAA,GAAA,EACrC,QACH,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -10,22 +10,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
10
|
|
|
11
11
|
var currency__default = /*#__PURE__*/_interopDefaultLegacy(currency);
|
|
12
12
|
|
|
13
|
-
var __defProp = Object.defineProperty;
|
|
14
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
17
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18
|
-
var __spreadValues = (a, b) => {
|
|
19
|
-
for (var prop in b || (b = {}))
|
|
20
|
-
if (__hasOwnProp.call(b, prop))
|
|
21
|
-
__defNormalProp(a, prop, b[prop]);
|
|
22
|
-
if (__getOwnPropSymbols)
|
|
23
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
24
|
-
if (__propIsEnum.call(b, prop))
|
|
25
|
-
__defNormalProp(a, prop, b[prop]);
|
|
26
|
-
}
|
|
27
|
-
return a;
|
|
28
|
-
};
|
|
29
13
|
const DEFAULT_OPTIONS = {
|
|
30
14
|
symbol: "R$ ",
|
|
31
15
|
separator: ".",
|
|
@@ -34,7 +18,7 @@ const DEFAULT_OPTIONS = {
|
|
|
34
18
|
};
|
|
35
19
|
const getRegex = (precision) => new RegExp(`\\B(?=(\\d{${precision}})(?!\\d))`, "g");
|
|
36
20
|
const getInternalNumberAndMask = (value, options) => {
|
|
37
|
-
const mergedOptions =
|
|
21
|
+
const mergedOptions = { ...DEFAULT_OPTIONS, ...options };
|
|
38
22
|
const { precision = -1 } = mergedOptions;
|
|
39
23
|
let internalNumber;
|
|
40
24
|
if (typeof value === "number") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNumberMask.js","sources":["../../../../../../src/components/atoms/Input/hooks/useNumberMask.ts"],"sourcesContent":["import currency from 'currency.js';\nimport { useCallback, useState } from 'react';\nimport { extractNumbersFromString } from '../../../../utils/extractNumbersFromString';\nimport { MaskValue } from './useStringMask';\n\nexport type CurrencyOptions = currency.Options;\n\nconst DEFAULT_OPTIONS: CurrencyOptions = {\n symbol: 'R$ ',\n separator: '.',\n decimal: ',',\n precision: 2,\n};\n\nconst getRegex = (precision: number) =>\n new RegExp(`\\\\B(?=(\\\\d{${precision}})(?!\\\\d))`, 'g');\n\nexport const getInternalNumberAndMask = (\n value: string | number,\n options?: CurrencyOptions\n): { internalNumber: number; mergedOptions: CurrencyOptions } => {\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const { precision = -1 } = mergedOptions;\n\n let internalNumber;\n\n if (typeof value === 'number') {\n if (precision) {\n let stringValue = String(value);\n const decimalIndex = stringValue.indexOf('.');\n const currentPrecision = decimalIndex + precision;\n if (decimalIndex !== -1 && currentPrecision <= stringValue.length) {\n const zeros = stringValue.length + 1 - currentPrecision;\n for (let i = 0; i < zeros; i++) stringValue = stringValue + `0`;\n }\n internalNumber = Number(stringValue);\n } else {\n internalNumber = value;\n }\n } else {\n const onlyNumbers = String(extractNumbersFromString(value));\n const padZeros = String(onlyNumbers).padStart(precision + 1, '0');\n internalNumber = Number(padZeros.replace(getRegex(precision), '.'));\n }\n\n if (internalNumber > Number.MAX_SAFE_INTEGER) {\n internalNumber = Number.MAX_SAFE_INTEGER;\n }\n\n if (internalNumber < Number.MIN_SAFE_INTEGER) {\n internalNumber = Number.MIN_SAFE_INTEGER;\n }\n\n return {\n internalNumber,\n mergedOptions,\n };\n};\n\n/**\n * TODO:\n * @param options\n * @param defaultValue\n * @returns\n */\nexport const useNumberMask = (\n options?: CurrencyOptions,\n defaultValue?: string | number\n): [MaskValue, (value: string | number) => void] => {\n const applyMask = useCallback(\n (value: string | number = 0): MaskValue => {\n const { internalNumber, mergedOptions } = getInternalNumberAndMask(\n value,\n options\n );\n\n return {\n raw: internalNumber,\n formatted: currency(internalNumber).format(mergedOptions),\n };\n },\n [options, getRegex]\n );\n\n const [value, setValue] = useState<MaskValue>(applyMask(defaultValue));\n\n const handleChangeValue = useCallback(\n (formattedValue: string | number) => {\n const { raw, formatted } = applyMask(formattedValue);\n setValue({\n raw,\n formatted,\n });\n },\n [applyMask, setValue]\n );\n\n return [value, handleChangeValue];\n};\n"],"names":["extractNumbersFromString","useCallback","value","currency","useState"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useNumberMask.js","sources":["../../../../../../src/components/atoms/Input/hooks/useNumberMask.ts"],"sourcesContent":["import currency from 'currency.js';\nimport { useCallback, useState } from 'react';\nimport { extractNumbersFromString } from '../../../../utils/extractNumbersFromString';\nimport { MaskValue } from './useStringMask';\n\nexport type CurrencyOptions = currency.Options;\n\nconst DEFAULT_OPTIONS: CurrencyOptions = {\n symbol: 'R$ ',\n separator: '.',\n decimal: ',',\n precision: 2,\n};\n\nconst getRegex = (precision: number) =>\n new RegExp(`\\\\B(?=(\\\\d{${precision}})(?!\\\\d))`, 'g');\n\nexport const getInternalNumberAndMask = (\n value: string | number,\n options?: CurrencyOptions\n): { internalNumber: number; mergedOptions: CurrencyOptions } => {\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const { precision = -1 } = mergedOptions;\n\n let internalNumber;\n\n if (typeof value === 'number') {\n if (precision) {\n let stringValue = String(value);\n const decimalIndex = stringValue.indexOf('.');\n const currentPrecision = decimalIndex + precision;\n if (decimalIndex !== -1 && currentPrecision <= stringValue.length) {\n const zeros = stringValue.length + 1 - currentPrecision;\n for (let i = 0; i < zeros; i++) stringValue = stringValue + `0`;\n }\n internalNumber = Number(stringValue);\n } else {\n internalNumber = value;\n }\n } else {\n const onlyNumbers = String(extractNumbersFromString(value));\n const padZeros = String(onlyNumbers).padStart(precision + 1, '0');\n internalNumber = Number(padZeros.replace(getRegex(precision), '.'));\n }\n\n if (internalNumber > Number.MAX_SAFE_INTEGER) {\n internalNumber = Number.MAX_SAFE_INTEGER;\n }\n\n if (internalNumber < Number.MIN_SAFE_INTEGER) {\n internalNumber = Number.MIN_SAFE_INTEGER;\n }\n\n return {\n internalNumber,\n mergedOptions,\n };\n};\n\n/**\n * TODO:\n * @param options\n * @param defaultValue\n * @returns\n */\nexport const useNumberMask = (\n options?: CurrencyOptions,\n defaultValue?: string | number\n): [MaskValue, (value: string | number) => void] => {\n const applyMask = useCallback(\n (value: string | number = 0): MaskValue => {\n const { internalNumber, mergedOptions } = getInternalNumberAndMask(\n value,\n options\n );\n\n return {\n raw: internalNumber,\n formatted: currency(internalNumber).format(mergedOptions),\n };\n },\n [options, getRegex]\n );\n\n const [value, setValue] = useState<MaskValue>(applyMask(defaultValue));\n\n const handleChangeValue = useCallback(\n (formattedValue: string | number) => {\n const { raw, formatted } = applyMask(formattedValue);\n setValue({\n raw,\n formatted,\n });\n },\n [applyMask, setValue]\n );\n\n return [value, handleChangeValue];\n};\n"],"names":["extractNumbersFromString","useCallback","value","currency","useState"],"mappings":";;;;;;;;;;;;AAOA,MAAM,eAAmC,GAAA;AAAA,EACvC,MAAQ,EAAA,KAAA;AAAA,EACR,SAAW,EAAA,GAAA;AAAA,EACX,OAAS,EAAA,GAAA;AAAA,EACT,SAAW,EAAA,CAAA;AACb,CAAA,CAAA;AAEA,MAAM,WAAW,CAAC,SAAA,KAChB,IAAI,MAAO,CAAA,CAAA,WAAA,EAAc,uBAAuB,GAAG,CAAA,CAAA;AAExC,MAAA,wBAAA,GAA2B,CACtC,KAAA,EACA,OAC+D,KAAA;AAC/D,EAAA,MAAM,aAAgB,GAAA,EAAE,GAAG,eAAA,EAAiB,GAAG,OAAQ,EAAA,CAAA;AACvD,EAAM,MAAA,EAAE,SAAY,GAAA,CAAA,CAAA,EAAO,GAAA,aAAA,CAAA;AAE3B,EAAI,IAAA,cAAA,CAAA;AAEJ,EAAI,IAAA,OAAO,UAAU,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A,IACL,cAAA;AAAA,IACA,aAAA;AAAA,GACF,CAAA;AACF,EAAA;AAQa,MAAA,aAAA,GAAgB,CAC3B,OAAA,EACA,YACkD,KAAA;AAClD,EAAA,MAAM,SAAY,GAAAC,iBAAA;AAAA,IAChB,CAACC,SAAyB,CAAiB,KAAA;AACzC,MAAM,MAAA,EAAE,cAAgB,EAAA,aAAA,EAAkB,GAAA,wBAAA;AAAA,QACxCA,MAAAA;AAAA,QACA,OAAA;AAAA,OACF,CAAA;AAEA,MAAO,OAAA;AAAA,QACL,GAAK,EAAA,cAAA;AAAA,QACL,SAAW,EAAAC,4BAAA,CAAS,cAAc,CAAA,CAAE,OAAO,aAAa,CAAA;AAAA,OAC1D,CAAA;AAAA,KACF;AAAA,IACA,CAAC,SAAS,QAAQ,CAAA;AAAA,GACpB,CAAA;AAEA,EAAA,MAAM,CAAC,KAAO,EAAA,QAAQ,IAAIC,cAAoB,CAAA,SAAA,CAAU,YAAY,CAAC,CAAA,CAAA;AAErE,EAAA,MAAM,iBAAoB,GAAAH,iBAAA;AAAA,IACxB,CAAC,cAAoC,KAAA;AACnC,MAAA,MAAM,EAAE,GAAA,EAAK,SAAU,EAAA,GAAI,UAAU,cAAc,CAAA,CAAA;AACnD,MAAS,QAAA,CAAA;AAAA,QACP,GAAA;AAAA,QACA,SAAA;AAAA,OACD,CAAA,CAAA;AAAA,KACH;AAAA,IACA,CAAC,WAAW,QAAQ,CAAA;AAAA,GACtB,CAAA;AAEA,EAAO,OAAA,CAAC,OAAO,iBAAiB,CAAA,CAAA;AAClC;;;;;"}
|
|
@@ -80,11 +80,11 @@ const useStringMask = (mask, defaultValue) => {
|
|
|
80
80
|
[mask]
|
|
81
81
|
);
|
|
82
82
|
const [value, setValue] = React.useState(
|
|
83
|
-
applyMask(defaultValue
|
|
83
|
+
applyMask(defaultValue?.toString())
|
|
84
84
|
);
|
|
85
85
|
const handleChangeValue = React.useCallback(
|
|
86
86
|
(formattedValue) => {
|
|
87
|
-
const { raw, formatted } = applyMask(formattedValue
|
|
87
|
+
const { raw, formatted } = applyMask(formattedValue?.toString());
|
|
88
88
|
setValue({
|
|
89
89
|
raw,
|
|
90
90
|
formatted
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStringMask.js","sources":["../../../../../../src/components/atoms/Input/hooks/useStringMask.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\nexport interface MaskValue {\n formatted?: string;\n raw?: string | number;\n}\n\nexport type MaskType = string | RegExp | Array<RegExp>;\n\n/**\n * TODO:\n * @param value\n * @param mask\n * @returns\n */\nexport const mergeMask = (value = '', mask: MaskType[]): MaskValue => {\n let formatted = '';\n let raw = '';\n let iMask = 0;\n let iChars = 0;\n\n while (!(iMask === mask.length || iChars === value.length)) {\n const maskChar = mask[iMask];\n const valueChar = value[iChars];\n\n if (maskChar === valueChar) {\n formatted += maskChar;\n iChars++;\n iMask++;\n continue;\n }\n\n const rawValueChar = value[iChars];\n\n if (typeof maskChar === 'object') {\n iChars++;\n\n const maskCharRegex = Array.isArray(maskChar) ? maskChar[0] : maskChar;\n const matchRegex = RegExp(maskCharRegex).test(valueChar);\n\n if (matchRegex) {\n formatted += valueChar;\n raw += rawValueChar;\n iMask++;\n }\n } else {\n formatted += maskChar;\n iMask++;\n }\n }\n\n return { raw, formatted };\n};\n\nexport const getMask = (\n mask: MaskType[] | ((value: string) => MaskType[]),\n newValue: string\n): MaskType[] => {\n let maskArray: MaskType[];\n const regexArray: MaskType[] = [];\n\n if (typeof mask === 'function') {\n maskArray = mask(newValue);\n } else {\n maskArray = mask;\n }\n\n maskArray.forEach(exp => {\n if (typeof exp !== 'string') {\n if (Array.isArray(exp)) regexArray.push(exp);\n else regexArray.push(exp);\n } else {\n for (let i = 0; i < exp.length; i++) {\n if (exp[i] === '\\\\') {\n regexArray.push(exp[i + 1]);\n i++;\n } else {\n if (exp[i] === '9') regexArray.push(/\\d/);\n else if (exp[i] === 'a') regexArray.push(/[a-zA-Z]/);\n else regexArray.push(exp[i]);\n }\n }\n }\n });\n\n return regexArray;\n};\n\n/**\n * TODO:\n * @param mask\n * @param defaultValue\n * @returns\n */\nexport const useStringMask = (\n mask: MaskType[] | ((value: string) => MaskType[]),\n defaultValue?: string | number\n): [MaskValue, (text: string | number) => void] => {\n const applyMask = useCallback(\n (value = ''): MaskValue => {\n const selectedMask = getMask(mask, value);\n const { formatted, raw } = mergeMask(value, selectedMask);\n\n return {\n raw,\n formatted,\n };\n },\n [mask]\n );\n\n const [value, setValue] = useState<MaskValue>(\n applyMask(defaultValue?.toString())\n );\n\n const handleChangeValue = useCallback(\n (formattedValue: string | number) => {\n const { raw, formatted } = applyMask(formattedValue?.toString());\n setValue({\n raw,\n formatted,\n });\n },\n [applyMask, setValue]\n );\n\n return [value, handleChangeValue];\n};\n"],"names":["useCallback","value","useState"],"mappings":";;;;;;AAeO,MAAM,SAAY,GAAA,CAAC,KAAQ,GAAA,EAAA,EAAI,IAAgC,KAAA;AACpE,EAAA,IAAI,SAAY,GAAA,EAAA,CAAA;AAChB,EAAA,IAAI,GAAM,GAAA,EAAA,CAAA;AACV,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AACZ,EAAA,IAAI,MAAS,GAAA,CAAA,CAAA;AAEb,EAAA,OAAO,EAAE,KAAU,KAAA,IAAA,CAAK,MAAU,IAAA,MAAA,KAAW,MAAM,MAAS,CAAA,EAAA;AAC1D,IAAA,MAAM,WAAW,IAAK,CAAA,KAAA,CAAA,CAAA;AACtB,IAAA,MAAM,YAAY,KAAM,CAAA,MAAA,CAAA,CAAA;AAExB,IAAA,IAAI,aAAa,SAAW,EAAA;AAC1B,MAAa,SAAA,IAAA,QAAA,CAAA;AACb,MAAA,MAAA,EAAA,CAAA;AACA,MAAA,KAAA,EAAA,CAAA;AACA,MAAA,SAAA;AAAA,KACF;AAEA,IAAA,MAAM,eAAe,KAAM,CAAA,MAAA,CAAA,CAAA;AAE3B,IAAI,IAAA,OAAO,aAAa,QAAU,EAAA;AAChC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AA,CAAK,GAAI,CAAA,CAAA,GAAI,CAAE,CAAA,CAAA,CAAA;AAC1B,UAAA,CAAA,EAAA,CAAA;AAAA,SACK,MAAA;AACL,UAAA,IAAI,IAAI,CAAO,CAAA,KAAA,GAAA;AAAK,YAAA,UAAA,CAAW,KAAK,IAAI,CAAA,CAAA;AAAA,eAAA,IAC/B,IAAI,CAAO,CAAA,KAAA,GAAA;AAAK,YAAA,UAAA,CAAW,KAAK,UAAU,CAAA,CAAA;AAAA;AAC9C,YAAW,UAAA,CAAA,IAAA,CAAK,IAAI,CAAE,CAAA,CAAA,CAAA;AAAA,SAC7B;AAAA,OACF;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AAED,EAAO,OAAA,UAAA,CAAA;AACT,EAAA;AAQa,MAAA,aAAA,GAAgB,CAC3B,IAAA,EACA,YACiD,KAAA;AACjD,EAAA,MAAM,SAAY,GAAAA,iBAAA;AAAA,IAChB,CAACC,SAAQ,EAAkB,KAAA;AACzB,MAAM,MAAA,YAAA,GAAe,OAAQ,CAAA,IAAA,EAAMA,MAAK,CAAA,CAAA;AACxC,MAAA,MAAM,EAAE,SAAW,EAAA,GAAA,EAAQ,GAAA,SAAA,CAAUA,QAAO,YAAY,CAAA,CAAA;AAExD,MAAO,OAAA;AAAA,QACL,GAAA;AAAA,QACA,SAAA;AAAA,OACF,CAAA;AAAA,KACF;AAAA,IACA,CAAC,IAAI,CAAA;AAAA,GACP,CAAA;AAEA,EAAM,MAAA,CAAC,KAAO,EAAA,QAAQ,CAAI,GAAAC,cAAA;AAAA,IACxB,SAAA,CAAU,
|
|
1
|
+
{"version":3,"file":"useStringMask.js","sources":["../../../../../../src/components/atoms/Input/hooks/useStringMask.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\nexport interface MaskValue {\n formatted?: string;\n raw?: string | number;\n}\n\nexport type MaskType = string | RegExp | Array<RegExp>;\n\n/**\n * TODO:\n * @param value\n * @param mask\n * @returns\n */\nexport const mergeMask = (value = '', mask: MaskType[]): MaskValue => {\n let formatted = '';\n let raw = '';\n let iMask = 0;\n let iChars = 0;\n\n while (!(iMask === mask.length || iChars === value.length)) {\n const maskChar = mask[iMask];\n const valueChar = value[iChars];\n\n if (maskChar === valueChar) {\n formatted += maskChar;\n iChars++;\n iMask++;\n continue;\n }\n\n const rawValueChar = value[iChars];\n\n if (typeof maskChar === 'object') {\n iChars++;\n\n const maskCharRegex = Array.isArray(maskChar) ? maskChar[0] : maskChar;\n const matchRegex = RegExp(maskCharRegex).test(valueChar);\n\n if (matchRegex) {\n formatted += valueChar;\n raw += rawValueChar;\n iMask++;\n }\n } else {\n formatted += maskChar;\n iMask++;\n }\n }\n\n return { raw, formatted };\n};\n\nexport const getMask = (\n mask: MaskType[] | ((value: string) => MaskType[]),\n newValue: string\n): MaskType[] => {\n let maskArray: MaskType[];\n const regexArray: MaskType[] = [];\n\n if (typeof mask === 'function') {\n maskArray = mask(newValue);\n } else {\n maskArray = mask;\n }\n\n maskArray.forEach(exp => {\n if (typeof exp !== 'string') {\n if (Array.isArray(exp)) regexArray.push(exp);\n else regexArray.push(exp);\n } else {\n for (let i = 0; i < exp.length; i++) {\n if (exp[i] === '\\\\') {\n regexArray.push(exp[i + 1]);\n i++;\n } else {\n if (exp[i] === '9') regexArray.push(/\\d/);\n else if (exp[i] === 'a') regexArray.push(/[a-zA-Z]/);\n else regexArray.push(exp[i]);\n }\n }\n }\n });\n\n return regexArray;\n};\n\n/**\n * TODO:\n * @param mask\n * @param defaultValue\n * @returns\n */\nexport const useStringMask = (\n mask: MaskType[] | ((value: string) => MaskType[]),\n defaultValue?: string | number\n): [MaskValue, (text: string | number) => void] => {\n const applyMask = useCallback(\n (value = ''): MaskValue => {\n const selectedMask = getMask(mask, value);\n const { formatted, raw } = mergeMask(value, selectedMask);\n\n return {\n raw,\n formatted,\n };\n },\n [mask]\n );\n\n const [value, setValue] = useState<MaskValue>(\n applyMask(defaultValue?.toString())\n );\n\n const handleChangeValue = useCallback(\n (formattedValue: string | number) => {\n const { raw, formatted } = applyMask(formattedValue?.toString());\n setValue({\n raw,\n formatted,\n });\n },\n [applyMask, setValue]\n );\n\n return [value, handleChangeValue];\n};\n"],"names":["useCallback","value","useState"],"mappings":";;;;;;AAeO,MAAM,SAAY,GAAA,CAAC,KAAQ,GAAA,EAAA,EAAI,IAAgC,KAAA;AACpE,EAAA,IAAI,SAAY,GAAA,EAAA,CAAA;AAChB,EAAA,IAAI,GAAM,GAAA,EAAA,CAAA;AACV,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AACZ,EAAA,IAAI,MAAS,GAAA,CAAA,CAAA;AAEb,EAAA,OAAO,EAAE,KAAU,KAAA,IAAA,CAAK,MAAU,IAAA,MAAA,KAAW,MAAM,MAAS,CAAA,EAAA;AAC1D,IAAA,MAAM,WAAW,IAAK,CAAA,KAAA,CAAA,CAAA;AACtB,IAAA,MAAM,YAAY,KAAM,CAAA,MAAA,CAAA,CAAA;AAExB,IAAA,IAAI,aAAa,SAAW,EAAA;AAC1B,MAAa,SAAA,IAAA,QAAA,CAAA;AACb,MAAA,MAAA,EAAA,CAAA;AACA,MAAA,KAAA,EAAA,CAAA;AACA,MAAA,SAAA;AAAA,KACF;AAEA,IAAA,MAAM,eAAe,KAAM,CAAA,MAAA,CAAA,CAAA;AAE3B,IAAI,IAAA,OAAO,aAAa,QAAU,EAAA;AAChC,MAAA,MAAA,EAAA,CAAA;AAEA,MAAA,MAAM,gBAAgB,KAAM,CAAA,OAAA,CAAQ,QAAQ,CAAA,GAAI,SAAS,CAAK,CAAA,GAAA,QAAA,CAAA;AAC9D,MAAA,MAAM,UAAa,GAAA,MAAA,CAAO,aAAa,CAAA,CAAE,KAAK,SAAS,CAAA,CAAA;AAEvD,MAAA,IAAI,UAAY,EAAA;AACd,QAAa,SAAA,IAAA,SAAA,CAAA;AACb,QAAO,GAAA,IAAA,YAAA,CAAA;AACP,QAAA,KAAA,EAAA,CAAA;AAAA,OACF;AAAA,KACK,MAAA;AACL,MAAa,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AAA,OACF;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AAED,EAAO,OAAA,UAAA,CAAA;AACT,EAAA;AAQa,MAAA,aAAA,GAAgB,CAC3B,IAAA,EACA,YACiD,KAAA;AACjD,EAAA,MAAM,SAAY,GAAAA,iBAAA;AAAA,IAChB,CAACC,SAAQ,EAAkB,KAAA;AACzB,MAAM,MAAA,YAAA,GAAe,OAAQ,CAAA,IAAA,EAAMA,MAAK,CAAA,CAAA;AACxC,MAAA,MAAM,EAAE,SAAW,EAAA,GAAA,EAAQ,GAAA,SAAA,CAAUA,QAAO,YAAY,CAAA,CAAA;AAExD,MAAO,OAAA;AAAA,QACL,GAAA;AAAA,QACA,SAAA;AAAA,OACF,CAAA;AAAA,KACF;AAAA,IACA,CAAC,IAAI,CAAA;AAAA,GACP,CAAA;AAEA,EAAM,MAAA,CAAC,KAAO,EAAA,QAAQ,CAAI,GAAAC,cAAA;AAAA,IACxB,SAAA,CAAU,YAAc,EAAA,QAAA,EAAU,CAAA;AAAA,GACpC,CAAA;AAEA,EAAA,MAAM,iBAAoB,GAAAF,iBAAA;AAAA,IACxB,CAAC,cAAoC,KAAA;AACnC,MAAA,MAAM,EAAE,GAAK,EAAA,SAAA,KAAc,SAAU,CAAA,cAAA,EAAgB,UAAU,CAAA,CAAA;AAC/D,MAAS,QAAA,CAAA;AAAA,QACP,GAAA;AAAA,QACA,SAAA;AAAA,OACD,CAAA,CAAA;AAAA,KACH;AAAA,IACA,CAAC,WAAW,QAAQ,CAAA;AAAA,GACtB,CAAA;AAEA,EAAO,OAAA,CAAC,OAAO,iBAAiB,CAAA,CAAA;AAClC;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","sources":["../../../../../src/components/atoms/Input/styled.ts"],"sourcesContent":["import styled, { css } from '@emotion/native';\nimport { TextInput } from 'react-native';\nimport { InputElementProps } from '.';\nimport { StyleProps } from '../../../types/defaults';\nimport { RFValueStr } from '../../../utils/ResponsiveFontSize';\nimport { InputContainerProps } from './InputContainer/InputContainer';\nimport { Icon } from '../Icon';\nconst leftIconStyles = ({\n leftComponent,\n theme,\n}: Partial<InputContainerProps> & StyleProps) =>\n !leftComponent &&\n css`\n padding-left: ${theme.spacing.centi};\n `;\n\nconst rightIconStyles = ({\n rightComponent,\n theme,\n}: Partial<InputContainerProps> & StyleProps) =>\n !rightComponent &&\n css`\n padding-right: ${theme.spacing.centi};\n `;\n\nconst disabledContainerStyles = ({\n disabled,\n}: Partial<InputContainerProps> & StyleProps) =>\n disabled &&\n css`\n background-color: transparent;\n `;\n\nexport const disabledInputStyles = ({\n disabled,\n theme,\n}: Partial<InputContainerProps> & Partial<StyleProps>) =>\n disabled &&\n css`\n color: ${theme?.color.secondary.light};\n `;\n\nconst focusedStyles = ({\n focused,\n borderColor = 'secondary',\n theme,\n}: Partial<InputContainerProps> & StyleProps) =>\n focused &&\n css`\n border-width: ${theme.borderWidth.nano};\n border-color: ${theme.color[borderColor].dark};\n `;\n\nexport const StyledIconContent = styled.View<Partial<StyleProps>>`\n z-index: ${({ theme }) => theme.zIndex.default};\n flex-direction: row;\n align-items: center;\n`;\n\nexport const StyledInputContainer = styled.View<\n Partial<InputContainerProps> & Partial<StyleProps>\n>`\n flex-direction: row;\n align-items: center;\n min-height: ${RFValueStr('44px')};\n`;\n\nexport const StyledInputElementBase = styled(TextInput)<\n InputElementProps & Partial<StyleProps>\n>`\n font-family: ${({ theme }) => `'${theme.font.stack.default}'`};\n font-size: ${({ theme }) => theme.typography.base.fontSize};\n font-weight: ${({ theme }) => theme.font.weight.bold};\n color: ${({ theme }) => theme.font.color.dark};\n`;\n\nexport const StyledLabelContainer = styled.View<\n Partial<InputContainerProps> & Partial<StyleProps>\n>(\n props => css`\n flex: 1;\n padding: ${props.theme.spacing.micro} 0;\n ${leftIconStyles(props)}\n ${rightIconStyles(props)}\n `\n);\n\nconst StyledBorderKeeperBase = styled.View<\n Partial<InputContainerProps> & Partial<StyleProps>\n>`\n background-color: ${({ theme }) => theme.miscellaneous.surfaceColor};\n border-color: ${({\n theme,\n borderColor = 'secondary',\n borderColorGradation = 'light',\n }) => theme.color[borderColor][borderColorGradation]};\n border-radius: ${({ theme }) => theme.borderRadius.mili};\n border-width: ${({ theme }) => theme.borderWidth.pico};\n position: absolute;\n width: 100%;\n height: 100%;\n`;\n\nexport const StyledBorderKeeper = styled(StyledBorderKeeperBase)<\n Partial<StyleProps>\n>(\n props => css`\n ${focusedStyles(props)}\n ${disabledContainerStyles(props)}\n `\n);\n\nexport const StyledInputElement = styled(StyledInputElementBase)<\n InputElementProps & Partial<StyleProps>\n>(\n props => css`\n width: 100%;\n ${disabledInputStyles(props)}\n `\n);\n\nexport const StyledHintContainer = styled.View<Partial<StyleProps>>`\n margin-top: ${({ theme }) => theme.spacing.micro};\n flex-direction: row;\n align-items: center;\n`;\n\nexport const StyledHintIcon = styled(Icon)<Partial<StyleProps>>`\n margin-right: ${({ theme }) => theme.spacing.micro};\n`;\n"],"names":["css","styled","RFValueStr","TextInput"],"mappings":";;;;;;;;;;;;;AAOA,MAAM,iBAAiB,CAAC;AAAA,EACtB,aAAA;AAAA,EACA,KAAA;AACF,CAAA,KACE,CAAC,aACD,IAAAA,UAAA,CAAA;AAAA,kBAAA,EACkB,MAAM,OAAQ,CAAA,KAAA,CAAA;AAAA,EAAA,CAAA,CAAA;AAGlC,MAAM,kBAAkB,CAAC;AAAA,EACvB,cAAA;AAAA,EACA,KAAA;AACF,CAAA,KACE,CAAC,cACD,IAAAA,UAAA,CAAA;AAAA,mBAAA,EACmB,MAAM,OAAQ,CAAA,KAAA,CAAA;AAAA,EAAA,CAAA,CAAA;AAGnC,MAAM,0BAA0B,CAAC;AAAA,EAC/B,QAAA;AACF,CAAA,KACE,QACA,IAAAA,UAAA,CAAA;AAAA;AAAA,EAAA,CAAA,CAAA;AAIK,MAAM,sBAAsB,CAAC;AAAA,EAClC,QAAA;AAAA,EACA,KAAA;AACF,CAAA,KACE,QACA,IAAAA,UAAA,CAAA;AAAA,WACW,EAAA,KAAA,
|
|
1
|
+
{"version":3,"file":"styled.js","sources":["../../../../../src/components/atoms/Input/styled.ts"],"sourcesContent":["import styled, { css } from '@emotion/native';\nimport { TextInput } from 'react-native';\nimport { InputElementProps } from '.';\nimport { StyleProps } from '../../../types/defaults';\nimport { RFValueStr } from '../../../utils/ResponsiveFontSize';\nimport { InputContainerProps } from './InputContainer/InputContainer';\nimport { Icon } from '../Icon';\nconst leftIconStyles = ({\n leftComponent,\n theme,\n}: Partial<InputContainerProps> & StyleProps) =>\n !leftComponent &&\n css`\n padding-left: ${theme.spacing.centi};\n `;\n\nconst rightIconStyles = ({\n rightComponent,\n theme,\n}: Partial<InputContainerProps> & StyleProps) =>\n !rightComponent &&\n css`\n padding-right: ${theme.spacing.centi};\n `;\n\nconst disabledContainerStyles = ({\n disabled,\n}: Partial<InputContainerProps> & StyleProps) =>\n disabled &&\n css`\n background-color: transparent;\n `;\n\nexport const disabledInputStyles = ({\n disabled,\n theme,\n}: Partial<InputContainerProps> & Partial<StyleProps>) =>\n disabled &&\n css`\n color: ${theme?.color.secondary.light};\n `;\n\nconst focusedStyles = ({\n focused,\n borderColor = 'secondary',\n theme,\n}: Partial<InputContainerProps> & StyleProps) =>\n focused &&\n css`\n border-width: ${theme.borderWidth.nano};\n border-color: ${theme.color[borderColor].dark};\n `;\n\nexport const StyledIconContent = styled.View<Partial<StyleProps>>`\n z-index: ${({ theme }) => theme.zIndex.default};\n flex-direction: row;\n align-items: center;\n`;\n\nexport const StyledInputContainer = styled.View<\n Partial<InputContainerProps> & Partial<StyleProps>\n>`\n flex-direction: row;\n align-items: center;\n min-height: ${RFValueStr('44px')};\n`;\n\nexport const StyledInputElementBase = styled(TextInput)<\n InputElementProps & Partial<StyleProps>\n>`\n font-family: ${({ theme }) => `'${theme.font.stack.default}'`};\n font-size: ${({ theme }) => theme.typography.base.fontSize};\n font-weight: ${({ theme }) => theme.font.weight.bold};\n color: ${({ theme }) => theme.font.color.dark};\n`;\n\nexport const StyledLabelContainer = styled.View<\n Partial<InputContainerProps> & Partial<StyleProps>\n>(\n props => css`\n flex: 1;\n padding: ${props.theme.spacing.micro} 0;\n ${leftIconStyles(props)}\n ${rightIconStyles(props)}\n `\n);\n\nconst StyledBorderKeeperBase = styled.View<\n Partial<InputContainerProps> & Partial<StyleProps>\n>`\n background-color: ${({ theme }) => theme.miscellaneous.surfaceColor};\n border-color: ${({\n theme,\n borderColor = 'secondary',\n borderColorGradation = 'light',\n }) => theme.color[borderColor][borderColorGradation]};\n border-radius: ${({ theme }) => theme.borderRadius.mili};\n border-width: ${({ theme }) => theme.borderWidth.pico};\n position: absolute;\n width: 100%;\n height: 100%;\n`;\n\nexport const StyledBorderKeeper = styled(StyledBorderKeeperBase)<\n Partial<StyleProps>\n>(\n props => css`\n ${focusedStyles(props)}\n ${disabledContainerStyles(props)}\n `\n);\n\nexport const StyledInputElement = styled(StyledInputElementBase)<\n InputElementProps & Partial<StyleProps>\n>(\n props => css`\n width: 100%;\n ${disabledInputStyles(props)}\n `\n);\n\nexport const StyledHintContainer = styled.View<Partial<StyleProps>>`\n margin-top: ${({ theme }) => theme.spacing.micro};\n flex-direction: row;\n align-items: center;\n`;\n\nexport const StyledHintIcon = styled(Icon)<Partial<StyleProps>>`\n margin-right: ${({ theme }) => theme.spacing.micro};\n`;\n"],"names":["css","styled","RFValueStr","TextInput"],"mappings":";;;;;;;;;;;;;AAOA,MAAM,iBAAiB,CAAC;AAAA,EACtB,aAAA;AAAA,EACA,KAAA;AACF,CAAA,KACE,CAAC,aACD,IAAAA,UAAA,CAAA;AAAA,kBAAA,EACkB,MAAM,OAAQ,CAAA,KAAA,CAAA;AAAA,EAAA,CAAA,CAAA;AAGlC,MAAM,kBAAkB,CAAC;AAAA,EACvB,cAAA;AAAA,EACA,KAAA;AACF,CAAA,KACE,CAAC,cACD,IAAAA,UAAA,CAAA;AAAA,mBAAA,EACmB,MAAM,OAAQ,CAAA,KAAA,CAAA;AAAA,E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,EAAA;AAEO,MAAM,sBAAsBC,0BAAO,CAAA,IAAA,CAAA;AAAA,cAAA,EAC1B,CAAC,EAAE,KAAM,EAAA,KAAM,MAAM,OAAQ,CAAA,KAAA,CAAA;AAAA;AAAA;AAAA,EAAA;AAKhC,MAAA,cAAA,GAAiBA,2BAAO,IAAI,CAAA,CAAA;AAAA,gBAAA,EACvB,CAAC,EAAE,KAAM,EAAA,KAAM,MAAM,OAAQ,CAAA,KAAA,CAAA;AAAA;;;;;;;;;;;;"}
|
|
@@ -7,49 +7,14 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
7
7
|
|
|
8
8
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
for (var prop in b || (b = {}))
|
|
19
|
-
if (__hasOwnProp.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
if (__getOwnPropSymbols)
|
|
22
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
23
|
-
if (__propIsEnum.call(b, prop))
|
|
24
|
-
__defNormalProp(a, prop, b[prop]);
|
|
25
|
-
}
|
|
26
|
-
return a;
|
|
27
|
-
};
|
|
28
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
29
|
-
var __objRest = (source, exclude) => {
|
|
30
|
-
var target = {};
|
|
31
|
-
for (var prop in source)
|
|
32
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
if (source != null && __getOwnPropSymbols)
|
|
35
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
36
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
37
|
-
target[prop] = source[prop];
|
|
38
|
-
}
|
|
39
|
-
return target;
|
|
40
|
-
};
|
|
41
|
-
const Paper = (_a) => {
|
|
42
|
-
var _b = _a, {
|
|
43
|
-
children,
|
|
44
|
-
elevated = false
|
|
45
|
-
} = _b, rest = __objRest(_b, [
|
|
46
|
-
"children",
|
|
47
|
-
"elevated"
|
|
48
|
-
]);
|
|
49
|
-
return /* @__PURE__ */ React__default["default"].createElement(styled.StyledPaper, __spreadProps(__spreadValues({}, rest), {
|
|
50
|
-
elevated
|
|
51
|
-
}), children);
|
|
52
|
-
};
|
|
10
|
+
const Paper = ({
|
|
11
|
+
children,
|
|
12
|
+
elevated = false,
|
|
13
|
+
...rest
|
|
14
|
+
}) => /* @__PURE__ */ React__default["default"].createElement(styled.StyledPaper, {
|
|
15
|
+
...rest,
|
|
16
|
+
elevated
|
|
17
|
+
}, children);
|
|
53
18
|
|
|
54
19
|
module.exports = Paper;
|
|
55
20
|
//# sourceMappingURL=Paper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paper.js","sources":["../../../../../src/components/atoms/Paper/Paper.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { StyleProp, ViewStyle } from 'react-native';\nimport { StyledPaper } from './styled';\n\nexport interface PaperProps {\n /** Creates elevation shadow */\n elevated?: boolean;\n style?: StyleProp<ViewStyle>;\n}\n\nconst Paper: FC<PaperProps> = ({\n children,\n elevated = false,\n ...rest\n}): JSX.Element => (\n <StyledPaper {...rest} elevated={elevated}>\n {children}\n </StyledPaper>\n);\n\nexport default Paper;\n"],"names":["React","StyledPaper"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Paper.js","sources":["../../../../../src/components/atoms/Paper/Paper.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { StyleProp, ViewStyle } from 'react-native';\nimport { StyledPaper } from './styled';\n\nexport interface PaperProps {\n /** Creates elevation shadow */\n elevated?: boolean;\n style?: StyleProp<ViewStyle>;\n}\n\nconst Paper: FC<PaperProps> = ({\n children,\n elevated = false,\n ...rest\n}): JSX.Element => (\n <StyledPaper {...rest} elevated={elevated}>\n {children}\n </StyledPaper>\n);\n\nexport default Paper;\n"],"names":["React","StyledPaper"],"mappings":";;;;;;;;;AAUA,MAAM,QAAwB,CAAC;AAAA,EAC7B,QAAA;AAAA,EACA,QAAW,GAAA,KAAA;AAAA,EACR,GAAA,IAAA;AACL,CAAA,qBACGA,yBAAA,CAAA,aAAA,CAAAC,kBAAA,EAAA;AAAA,EAAa,GAAG,IAAA;AAAA,EAAM,QAAA;AAAA,CAAA,EACpB,QACH;;;;"}
|
|
@@ -15,54 +15,16 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
15
15
|
|
|
16
16
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
17
|
|
|
18
|
-
var __defProp = Object.defineProperty;
|
|
19
|
-
var __defProps = Object.defineProperties;
|
|
20
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
21
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
22
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
23
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
24
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
25
|
-
var __spreadValues = (a, b) => {
|
|
26
|
-
for (var prop in b || (b = {}))
|
|
27
|
-
if (__hasOwnProp.call(b, prop))
|
|
28
|
-
__defNormalProp(a, prop, b[prop]);
|
|
29
|
-
if (__getOwnPropSymbols)
|
|
30
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
31
|
-
if (__propIsEnum.call(b, prop))
|
|
32
|
-
__defNormalProp(a, prop, b[prop]);
|
|
33
|
-
}
|
|
34
|
-
return a;
|
|
35
|
-
};
|
|
36
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
37
|
-
var __objRest = (source, exclude) => {
|
|
38
|
-
var target = {};
|
|
39
|
-
for (var prop in source)
|
|
40
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
41
|
-
target[prop] = source[prop];
|
|
42
|
-
if (source != null && __getOwnPropSymbols)
|
|
43
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
44
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
45
|
-
target[prop] = source[prop];
|
|
46
|
-
}
|
|
47
|
-
return target;
|
|
48
|
-
};
|
|
49
18
|
const COLOR_VARIATION_FACTOR = 25;
|
|
50
|
-
const PressableSurface = (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"children",
|
|
60
|
-
"surfaceColor",
|
|
61
|
-
"effect",
|
|
62
|
-
"effectIntensity",
|
|
63
|
-
"effectStyle",
|
|
64
|
-
"style"
|
|
65
|
-
]);
|
|
19
|
+
const PressableSurface = ({
|
|
20
|
+
children,
|
|
21
|
+
surfaceColor,
|
|
22
|
+
effect,
|
|
23
|
+
effectIntensity,
|
|
24
|
+
effectStyle,
|
|
25
|
+
style,
|
|
26
|
+
...rest
|
|
27
|
+
}) => {
|
|
66
28
|
const theme = react.useTheme();
|
|
67
29
|
let effectBaseColor = theme.miscellaneous.surfaceColor;
|
|
68
30
|
let bgColor = "transparent";
|
|
@@ -75,9 +37,10 @@ const PressableSurface = (_a) => {
|
|
|
75
37
|
effectBaseColor,
|
|
76
38
|
bgColor
|
|
77
39
|
);
|
|
78
|
-
return /* @__PURE__ */ React__default["default"].createElement(reactNative.Pressable,
|
|
40
|
+
return /* @__PURE__ */ React__default["default"].createElement(reactNative.Pressable, {
|
|
41
|
+
...rest,
|
|
79
42
|
style: readyStyle
|
|
80
|
-
}
|
|
43
|
+
}, children);
|
|
81
44
|
};
|
|
82
45
|
const prepareStyle = (props, effectColor, bgColor) => {
|
|
83
46
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PressableSurface.js","sources":["../../../../../src/components/atoms/PressableSurface/PressableSurface.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react';\nimport React, { FC } from 'react';\nimport { Pressable, PressableProps, StyleProp, ViewStyle } from 'react-native';\nimport { ThemeProp } from '../../../types/defaults';\nimport { lightenDarkenColor } from '../../../utils';\n\nconst COLOR_VARIATION_FACTOR = 25;\n\nexport interface PressableSurfaceProps extends PressableProps {\n effect?: 'darken' | 'lighten' | 'none';\n surfaceColor?: string;\n effectIntensity?: number;\n effectStyle?: (pressed: boolean) => StyleProp<ViewStyle>;\n}\n\nconst PressableSurface: FC<PressableSurfaceProps> = ({\n children,\n surfaceColor,\n effect,\n effectIntensity,\n effectStyle,\n style,\n ...rest\n}) => {\n const theme = useTheme() as ThemeProp;\n let effectBaseColor = theme.miscellaneous.surfaceColor;\n let bgColor = 'transparent';\n\n if (surfaceColor) {\n effectBaseColor = surfaceColor;\n bgColor = effectBaseColor;\n }\n\n const readyStyle = prepareStyle(\n { effect, effectIntensity, style, effectStyle },\n effectBaseColor,\n bgColor\n );\n return (\n <Pressable {...rest} style={readyStyle}>\n {children}\n </Pressable>\n );\n};\n\nconst prepareStyle = (\n props: PressableSurfaceProps,\n effectColor: string,\n bgColor: string\n): any => {\n const {\n effect = 'darken',\n effectIntensity = COLOR_VARIATION_FACTOR,\n style,\n effectStyle,\n } = props;\n\n const lighten = lightenDarkenColor(effectColor, effectIntensity);\n const darken = lightenDarkenColor(effectColor, -effectIntensity);\n const composedStyle = [{ backgroundColor: bgColor }, style];\n\n if (effectStyle) {\n return ({ pressed }) => [composedStyle, effectStyle(pressed)];\n }\n\n switch (effect) {\n case 'darken':\n return applyEffectStyle(composedStyle, darken);\n\n case 'lighten':\n return applyEffectStyle(composedStyle, lighten);\n\n case 'none':\n return composedStyle;\n }\n};\n\nconst applyEffectStyle = (style: any, variation: string) => {\n return ({ pressed }) => [style, pressed && { backgroundColor: variation }];\n};\n\nexport default PressableSurface;\n"],"names":["useTheme","React","Pressable","lightenDarkenColor"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PressableSurface.js","sources":["../../../../../src/components/atoms/PressableSurface/PressableSurface.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react';\nimport React, { FC } from 'react';\nimport { Pressable, PressableProps, StyleProp, ViewStyle } from 'react-native';\nimport { ThemeProp } from '../../../types/defaults';\nimport { lightenDarkenColor } from '../../../utils';\n\nconst COLOR_VARIATION_FACTOR = 25;\n\nexport interface PressableSurfaceProps extends PressableProps {\n effect?: 'darken' | 'lighten' | 'none';\n surfaceColor?: string;\n effectIntensity?: number;\n effectStyle?: (pressed: boolean) => StyleProp<ViewStyle>;\n}\n\nconst PressableSurface: FC<PressableSurfaceProps> = ({\n children,\n surfaceColor,\n effect,\n effectIntensity,\n effectStyle,\n style,\n ...rest\n}) => {\n const theme = useTheme() as ThemeProp;\n let effectBaseColor = theme.miscellaneous.surfaceColor;\n let bgColor = 'transparent';\n\n if (surfaceColor) {\n effectBaseColor = surfaceColor;\n bgColor = effectBaseColor;\n }\n\n const readyStyle = prepareStyle(\n { effect, effectIntensity, style, effectStyle },\n effectBaseColor,\n bgColor\n );\n return (\n <Pressable {...rest} style={readyStyle}>\n {children}\n </Pressable>\n );\n};\n\nconst prepareStyle = (\n props: PressableSurfaceProps,\n effectColor: string,\n bgColor: string\n): any => {\n const {\n effect = 'darken',\n effectIntensity = COLOR_VARIATION_FACTOR,\n style,\n effectStyle,\n } = props;\n\n const lighten = lightenDarkenColor(effectColor, effectIntensity);\n const darken = lightenDarkenColor(effectColor, -effectIntensity);\n const composedStyle = [{ backgroundColor: bgColor }, style];\n\n if (effectStyle) {\n return ({ pressed }) => [composedStyle, effectStyle(pressed)];\n }\n\n switch (effect) {\n case 'darken':\n return applyEffectStyle(composedStyle, darken);\n\n case 'lighten':\n return applyEffectStyle(composedStyle, lighten);\n\n case 'none':\n return composedStyle;\n }\n};\n\nconst applyEffectStyle = (style: any, variation: string) => {\n return ({ pressed }) => [style, pressed && { backgroundColor: variation }];\n};\n\nexport default PressableSurface;\n"],"names":["useTheme","React","Pressable","lightenDarkenColor"],"mappings":";;;;;;;;;;;;;;;;;AAMA,MAAM,sBAAyB,GAAA,EAAA,CAAA;AAS/B,MAAM,mBAA8C,CAAC;AAAA,EACnD,QAAA;AAAA,EACA,YAAA;AAAA,EACA,MAAA;AAAA,EACA,eAAA;AAAA,EACA,WAAA;AAAA,EACA,KAAA;AAAA,EACG,GAAA,IAAA;AACL,CAAM,KAAA;AACJ,EAAA,MAAM,QAAQA,cAAS,EAAA,CAAA;AACvB,EAAI,IAAA,eAAA,GAAkB,MAAM,aAAc,CAAA,YAAA,CAAA;AAC1C,EAAA,IAAI,OAAU,GAAA,aAAA,CAAA;AAEd,EAAA,IAAI,YAAc,EAAA;AAChB,IAAkB,eAAA,GAAA,YAAA,CAAA;AAClB,IAAU,OAAA,GAAA,eAAA,CAAA;AAAA,GACZ;AAEA,EAAA,MAAM,UAAa,GAAA,YAAA;AAAA,IACjB,EAAE,MAAA,EAAQ,eAAiB,EAAA,KAAA,EAAO,WAAY,EAAA;AAAA,IAC9C,eAAA;AAAA,IACA,OAAA;AAAA,GACF,CAAA;AACA,EAAA,uBACGC,yBAAA,CAAA,aAAA,CAAAC,qBAAA,EAAA;AAAA,IAAW,GAAG,IAAA;AAAA,IAAM,KAAO,EAAA,UAAA;AAAA,GAAA,EACzB,QACH,CAAA,CAAA;AAEJ,EAAA;AAEA,MAAM,YAAe,GAAA,CACnB,KACA,EAAA,WAAA,EACA,OACQ,KAAA;AACR,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,QAAA;AAAA,IACT,eAAkB,GAAA,sBAAA;AAAA,IAClB,KAAA;AAAA,IACA,WAAA;AAAA,GACE,GAAA,KAAA,CAAA;AAEJ,EAAM,MAAA,OAAA,GAAUC,qCAAmB,CAAA,WAAA,EAAa,eAAe,CAAA,CAAA;AAC/D,EAAA,MAAM,MAAS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