@tecsinapse/react-core 1.15.1 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/components/atoms/Avatar/Avatar.js +1 -3
- package/dist/components/atoms/Avatar/Avatar.js.map +1 -1
- package/dist/components/atoms/Avatar/helpers.js +1 -3
- package/dist/components/atoms/Avatar/helpers.js.map +1 -1
- package/dist/components/atoms/Avatar/index.js +5 -15
- package/dist/components/atoms/Avatar/index.js.map +1 -1
- package/dist/components/atoms/Avatar/styled.js +1 -3
- package/dist/components/atoms/Avatar/styled.js.map +1 -1
- package/dist/components/atoms/Badge/Badge.js +1 -3
- package/dist/components/atoms/Badge/Badge.js.map +1 -1
- package/dist/components/atoms/Badge/index.js +5 -15
- package/dist/components/atoms/Badge/index.js.map +1 -1
- package/dist/components/atoms/Badge/styled.js +1 -3
- package/dist/components/atoms/Badge/styled.js.map +1 -1
- package/dist/components/atoms/BoxContent/BoxContent.js +1 -3
- package/dist/components/atoms/BoxContent/BoxContent.js.map +1 -1
- package/dist/components/atoms/BoxContent/index.js +5 -15
- package/dist/components/atoms/BoxContent/index.js.map +1 -1
- package/dist/components/atoms/BoxContent/styled.js +2 -4
- package/dist/components/atoms/BoxContent/styled.js.map +1 -1
- package/dist/components/atoms/Button/Button.js +1 -3
- package/dist/components/atoms/Button/Button.js.map +1 -1
- package/dist/components/atoms/Button/States/BaseState.js +1 -3
- package/dist/components/atoms/Button/States/BaseState.js.map +1 -1
- package/dist/components/atoms/Button/States/Error.js +1 -3
- package/dist/components/atoms/Button/States/Error.js.map +1 -1
- package/dist/components/atoms/Button/States/Loading.js +1 -3
- package/dist/components/atoms/Button/States/Loading.js.map +1 -1
- package/dist/components/atoms/Button/States/Success.js +1 -3
- package/dist/components/atoms/Button/States/Success.js.map +1 -1
- package/dist/components/atoms/Button/States/index.js +8 -21
- package/dist/components/atoms/Button/States/index.js.map +1 -1
- package/dist/components/atoms/Button/States/styled.js +1 -3
- package/dist/components/atoms/Button/States/styled.js.map +1 -1
- package/dist/components/atoms/Button/index.js +12 -51
- package/dist/components/atoms/Button/index.js.map +1 -1
- package/dist/components/atoms/Button/styled.js +1 -3
- package/dist/components/atoms/Button/styled.js.map +1 -1
- package/dist/components/atoms/Card/Card.js +1 -3
- package/dist/components/atoms/Card/Card.js.map +1 -1
- package/dist/components/atoms/Card/Footer/Footer.js +1 -3
- package/dist/components/atoms/Card/Footer/Footer.js.map +1 -1
- package/dist/components/atoms/Card/Footer/index.js +5 -15
- package/dist/components/atoms/Card/Footer/index.js.map +1 -1
- package/dist/components/atoms/Card/Header/Header.js +1 -3
- package/dist/components/atoms/Card/Header/Header.js.map +1 -1
- package/dist/components/atoms/Card/Header/index.js +5 -15
- package/dist/components/atoms/Card/Header/index.js.map +1 -1
- package/dist/components/atoms/Card/index.js +5 -15
- package/dist/components/atoms/Card/index.js.map +1 -1
- package/dist/components/atoms/Card/styled.js +1 -3
- package/dist/components/atoms/Card/styled.js.map +1 -1
- package/dist/components/atoms/Checkbox/Checkbox.js +1 -3
- package/dist/components/atoms/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/atoms/Checkbox/index.js +5 -15
- package/dist/components/atoms/Checkbox/index.js.map +1 -1
- package/dist/components/atoms/Checkbox/styled.js +1 -3
- package/dist/components/atoms/Checkbox/styled.js.map +1 -1
- package/dist/components/atoms/Divider/Divider.js +1 -3
- package/dist/components/atoms/Divider/Divider.js.map +1 -1
- package/dist/components/atoms/Divider/index.js +5 -15
- package/dist/components/atoms/Divider/index.js.map +1 -1
- package/dist/components/atoms/Divider/styled.js +1 -3
- package/dist/components/atoms/Divider/styled.js.map +1 -1
- package/dist/components/atoms/GroupButton/GroupButton.js +7 -9
- package/dist/components/atoms/GroupButton/GroupButton.js.map +1 -1
- package/dist/components/atoms/GroupButton/GroupButtonOption.js +1 -3
- package/dist/components/atoms/GroupButton/GroupButtonOption.js.map +1 -1
- package/dist/components/atoms/GroupButton/index.js +9 -33
- package/dist/components/atoms/GroupButton/index.js.map +1 -1
- package/dist/components/atoms/GroupButton/styled.js +12 -14
- package/dist/components/atoms/GroupButton/styled.js.map +1 -1
- package/dist/components/atoms/Icon/Icon.js +1 -3
- package/dist/components/atoms/Icon/Icon.js.map +1 -1
- package/dist/components/atoms/Icon/helpers.js +1 -3
- package/dist/components/atoms/Icon/helpers.js.map +1 -1
- package/dist/components/atoms/Icon/index.js +5 -15
- package/dist/components/atoms/Icon/index.js.map +1 -1
- package/dist/components/atoms/Input/Hint.js +1 -3
- package/dist/components/atoms/Input/Hint.js.map +1 -1
- package/dist/components/atoms/Input/InputContainer/InputContainer.js +1 -3
- package/dist/components/atoms/Input/InputContainer/InputContainer.js.map +1 -1
- package/dist/components/atoms/Input/InputElement/InputElement.d.ts +2 -5
- package/dist/components/atoms/Input/InputElement/InputElement.js +5 -49
- package/dist/components/atoms/Input/InputElement/InputElement.js.map +1 -1
- package/dist/components/atoms/Input/InputMaskElement/InputMaskElement.d.ts +17 -0
- package/dist/components/atoms/Input/InputMaskElement/InputMaskElement.js +84 -0
- package/dist/components/atoms/Input/InputMaskElement/InputMaskElement.js.map +1 -0
- package/dist/components/atoms/Input/PressableInputContainer/PressableInputContainer.js +1 -3
- package/dist/components/atoms/Input/PressableInputContainer/PressableInputContainer.js.map +1 -1
- package/dist/components/atoms/Input/PressableInputContainer/index.js +5 -15
- package/dist/components/atoms/Input/PressableInputContainer/index.js.map +1 -1
- package/dist/components/atoms/Input/PressableInputContainer/styled.js +1 -3
- package/dist/components/atoms/Input/PressableInputContainer/styled.js.map +1 -1
- package/dist/components/atoms/Input/hooks/useInputFocus.js +1 -3
- package/dist/components/atoms/Input/hooks/useInputFocus.js.map +1 -1
- package/dist/components/atoms/Input/hooks/useNumberMask.js +1 -3
- package/dist/components/atoms/Input/hooks/useNumberMask.js.map +1 -1
- package/dist/components/atoms/Input/hooks/useStringMask.js +3 -5
- package/dist/components/atoms/Input/hooks/useStringMask.js.map +1 -1
- package/dist/components/atoms/Input/index.d.ts +1 -0
- package/dist/components/atoms/Input/index.js +28 -82
- package/dist/components/atoms/Input/index.js.map +1 -1
- package/dist/components/atoms/Input/styled.js +2 -4
- package/dist/components/atoms/Input/styled.js.map +1 -1
- package/dist/components/atoms/Paper/Paper.js +1 -3
- package/dist/components/atoms/Paper/Paper.js.map +1 -1
- package/dist/components/atoms/Paper/index.js +5 -15
- package/dist/components/atoms/Paper/index.js.map +1 -1
- package/dist/components/atoms/Paper/styled.js +1 -3
- package/dist/components/atoms/Paper/styled.js.map +1 -1
- package/dist/components/atoms/PressableSurface/PressableSurface.js +1 -3
- package/dist/components/atoms/PressableSurface/PressableSurface.js.map +1 -1
- package/dist/components/atoms/PressableSurface/index.js +5 -15
- package/dist/components/atoms/PressableSurface/index.js.map +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.js +3 -7
- package/dist/components/atoms/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/atoms/ProgressBar/index.js +5 -15
- package/dist/components/atoms/ProgressBar/index.js.map +1 -1
- package/dist/components/atoms/ProgressBar/styled.js +1 -3
- package/dist/components/atoms/ProgressBar/styled.js.map +1 -1
- package/dist/components/atoms/RadioButton/RadioButton.js +1 -3
- package/dist/components/atoms/RadioButton/RadioButton.js.map +1 -1
- package/dist/components/atoms/RadioButton/index.js +5 -15
- package/dist/components/atoms/RadioButton/index.js.map +1 -1
- package/dist/components/atoms/RadioButton/styled.js +1 -3
- package/dist/components/atoms/RadioButton/styled.js.map +1 -1
- package/dist/components/atoms/Switch/Switch.js +1 -3
- package/dist/components/atoms/Switch/Switch.js.map +1 -1
- package/dist/components/atoms/Switch/animation.js +1 -3
- package/dist/components/atoms/Switch/animation.js.map +1 -1
- package/dist/components/atoms/Switch/index.js +5 -15
- package/dist/components/atoms/Switch/index.js.map +1 -1
- package/dist/components/atoms/Switch/styled.js +1 -3
- package/dist/components/atoms/Switch/styled.js.map +1 -1
- package/dist/components/atoms/Tag/Tag.js +2 -4
- package/dist/components/atoms/Tag/Tag.js.map +1 -1
- package/dist/components/atoms/Tag/index.js +5 -15
- package/dist/components/atoms/Tag/index.js.map +1 -1
- package/dist/components/atoms/Tag/styled.js +1 -3
- package/dist/components/atoms/Tag/styled.js.map +1 -1
- package/dist/components/atoms/Text/Text.js +1 -3
- package/dist/components/atoms/Text/Text.js.map +1 -1
- package/dist/components/atoms/Text/index.js +5 -15
- package/dist/components/atoms/Text/index.js.map +1 -1
- package/dist/components/atoms/Text/styled.js +1 -3
- package/dist/components/atoms/Text/styled.js.map +1 -1
- package/dist/components/atoms/shared/PaperAndCard.js +1 -3
- package/dist/components/atoms/shared/PaperAndCard.js.map +1 -1
- package/dist/components/molecules/Calendar/Calendar.js +3 -5
- package/dist/components/molecules/Calendar/Calendar.js.map +1 -1
- package/dist/components/molecules/Calendar/components/MonthWeek.js +4 -6
- package/dist/components/molecules/Calendar/components/MonthWeek.js.map +1 -1
- package/dist/components/molecules/Calendar/components/Weekdays.js +1 -3
- package/dist/components/molecules/Calendar/components/Weekdays.js.map +1 -1
- package/dist/components/molecules/Calendar/components/index.js +6 -15
- package/dist/components/molecules/Calendar/components/index.js.map +1 -1
- package/dist/components/molecules/Calendar/index.js +8 -33
- package/dist/components/molecules/Calendar/index.js.map +1 -1
- package/dist/components/molecules/Calendar/styled.js +4 -6
- package/dist/components/molecules/Calendar/styled.js.map +1 -1
- package/dist/components/molecules/DatePicker/DatePicker.js +1 -3
- package/dist/components/molecules/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/molecules/DatePicker/index.js +5 -15
- package/dist/components/molecules/DatePicker/index.js.map +1 -1
- package/dist/components/molecules/DatePicker/styled.js +2 -4
- package/dist/components/molecules/DatePicker/styled.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js +2 -4
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/index.js +5 -15
- package/dist/components/molecules/DateTimePicker/index.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/styled.js +1 -3
- package/dist/components/molecules/DateTimePicker/styled.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/DateTimeSelector.js +2 -4
- package/dist/components/molecules/DateTimeSelector/DateTimeSelector.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/Selector.js +1 -3
- package/dist/components/molecules/DateTimeSelector/Selector.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/index.js +6 -21
- package/dist/components/molecules/DateTimeSelector/index.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/styled.js +1 -3
- package/dist/components/molecules/DateTimeSelector/styled.js.map +1 -1
- package/dist/components/molecules/Grid/Grid.js +3 -5
- package/dist/components/molecules/Grid/Grid.js.map +1 -1
- package/dist/components/molecules/Grid/Item/Item.js +4 -6
- package/dist/components/molecules/Grid/Item/Item.js.map +1 -1
- package/dist/components/molecules/Grid/Item/index.js +5 -15
- package/dist/components/molecules/Grid/Item/index.js.map +1 -1
- package/dist/components/molecules/Grid/index.js +8 -27
- package/dist/components/molecules/Grid/index.js.map +1 -1
- package/dist/components/molecules/HintInputContainer/HintInputContainer.js +1 -3
- package/dist/components/molecules/HintInputContainer/HintInputContainer.js.map +1 -1
- package/dist/components/molecules/HintInputContainer/index.js +4 -9
- package/dist/components/molecules/HintInputContainer/index.js.map +1 -1
- package/dist/components/molecules/InputPassword/InputPasswordIcon.js +1 -3
- package/dist/components/molecules/InputPassword/InputPasswordIcon.js.map +1 -1
- package/dist/components/molecules/InputPassword/index.js +4 -9
- package/dist/components/molecules/InputPassword/index.js.map +1 -1
- package/dist/components/molecules/InputPassword/styled.js +1 -3
- package/dist/components/molecules/InputPassword/styled.js.map +1 -1
- package/dist/components/molecules/Snackbar/Snackbar.js +3 -5
- package/dist/components/molecules/Snackbar/Snackbar.js.map +1 -1
- package/dist/components/molecules/Snackbar/index.js +5 -15
- package/dist/components/molecules/Snackbar/index.js.map +1 -1
- package/dist/components/molecules/Snackbar/styled.js +1 -3
- package/dist/components/molecules/Snackbar/styled.js.map +1 -1
- package/dist/components/molecules/TextArea/TextArea.js +1 -3
- package/dist/components/molecules/TextArea/TextArea.js.map +1 -1
- package/dist/components/molecules/TextArea/index.js +7 -21
- package/dist/components/molecules/TextArea/index.js.map +1 -1
- package/dist/components/molecules/TextArea/styled.js +1 -3
- package/dist/components/molecules/TextArea/styled.js.map +1 -1
- package/dist/hooks/index.js +6 -15
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useDebouncedState.js +1 -3
- package/dist/hooks/useDebouncedState.js.map +1 -1
- package/dist/hooks/useTheme.js +1 -3
- package/dist/hooks/useTheme.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +123 -531
- package/dist/index.js.map +1 -1
- package/dist/styles/ThemeProvider.js +1 -3
- package/dist/styles/ThemeProvider.js.map +1 -1
- package/dist/styles/definitions.js +1 -3
- package/dist/styles/definitions.js.map +1 -1
- package/dist/styles/light.js +1 -3
- package/dist/styles/light.js.map +1 -1
- package/dist/types/defaults.js +1 -3
- package/dist/utils/IPhoneXHelper.js +1 -3
- package/dist/utils/IPhoneXHelper.js.map +1 -1
- package/dist/utils/ResponsiveFontSize.js +1 -3
- package/dist/utils/ResponsiveFontSize.js.map +1 -1
- package/dist/utils/extractNumbersFromString.js +1 -3
- package/dist/utils/extractNumbersFromString.js.map +1 -1
- package/dist/utils/formatWithMask.js +1 -3
- package/dist/utils/formatWithMask.js.map +1 -1
- package/dist/utils/index.js +11 -45
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/lightenDarkenColor.js +1 -3
- package/dist/utils/lightenDarkenColor.js.map +1 -1
- package/dist/utils/masks.js +3 -5
- package/dist/utils/masks.js.map +1 -1
- package/package.json +2 -2
- package/src/components/atoms/Input/InputElement/InputElement.tsx +5 -74
- package/src/components/atoms/Input/InputMaskElement/InputMaskElement.tsx +120 -0
- package/src/components/atoms/Input/index.ts +4 -0
- package/src/index.ts +2 -0
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.StyledPressable = exports.StyledDivider = exports.StyledOption = exports.getStyledGroupItemText = exports.StyledGroupButton = void 0;
|
|
7
5
|
|
|
8
6
|
var _native = _interopRequireWildcard(require("@emotion/native"));
|
|
@@ -44,7 +42,7 @@ const activeStyles = ({
|
|
|
44
42
|
activeBorderColor = 'secondary',
|
|
45
43
|
activeBorderColorTone = 'medium'
|
|
46
44
|
}) => isActive && (0, _native.css)`
|
|
47
|
-
border-color: ${theme
|
|
45
|
+
border-color: ${theme == null ? void 0 : theme.color[activeBorderColor][activeBorderColorTone]};
|
|
48
46
|
`;
|
|
49
47
|
|
|
50
48
|
const inactiveStyles = ({
|
|
@@ -57,13 +55,13 @@ const inactiveStyles = ({
|
|
|
57
55
|
}) => {
|
|
58
56
|
if (!isActive && inactiveBackgroundColor && inactiveBackgroundColorTone) {
|
|
59
57
|
return (0, _native.css)`
|
|
60
|
-
border-color: ${theme
|
|
58
|
+
border-color: ${theme == null ? void 0 : theme.color[inactiveBorderColor][inactiveBorderColorTone]};
|
|
61
59
|
`;
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
if (!isActive) {
|
|
65
63
|
return (0, _native.css)`
|
|
66
|
-
border-color: ${theme
|
|
64
|
+
border-color: ${theme == null ? void 0 : theme.color[inactiveBorderColor][inactiveBorderColorTone]};
|
|
67
65
|
`;
|
|
68
66
|
}
|
|
69
67
|
};
|
|
@@ -72,18 +70,18 @@ const leftStyles = ({
|
|
|
72
70
|
theme,
|
|
73
71
|
isFirstOption
|
|
74
72
|
}) => isFirstOption && (0, _native.css)`
|
|
75
|
-
border-top-left-radius: ${theme
|
|
76
|
-
border-bottom-left-radius: ${theme
|
|
77
|
-
border-left-width: ${theme
|
|
73
|
+
border-top-left-radius: ${theme == null ? void 0 : theme.borderRadius.mili};
|
|
74
|
+
border-bottom-left-radius: ${theme == null ? void 0 : theme.borderRadius.mili};
|
|
75
|
+
border-left-width: ${theme == null ? void 0 : theme.borderWidth.pico};
|
|
78
76
|
`;
|
|
79
77
|
|
|
80
78
|
const rightStyles = ({
|
|
81
79
|
theme,
|
|
82
80
|
isLastOption
|
|
83
81
|
}) => isLastOption && (0, _native.css)`
|
|
84
|
-
border-top-right-radius: ${theme
|
|
85
|
-
border-bottom-right-radius: ${theme
|
|
86
|
-
border-right-width: ${theme
|
|
82
|
+
border-top-right-radius: ${theme == null ? void 0 : theme.borderRadius.mili};
|
|
83
|
+
border-bottom-right-radius: ${theme == null ? void 0 : theme.borderRadius.mili};
|
|
84
|
+
border-right-width: ${theme == null ? void 0 : theme.borderWidth.pico};
|
|
87
85
|
`;
|
|
88
86
|
|
|
89
87
|
const sizeStyles = ({
|
|
@@ -93,13 +91,13 @@ const sizeStyles = ({
|
|
|
93
91
|
switch (buttonSize) {
|
|
94
92
|
case 'small':
|
|
95
93
|
return (0, _native.css)`
|
|
96
|
-
padding: ${theme
|
|
94
|
+
padding: ${theme == null ? void 0 : theme.spacing.mili} ${theme == null ? void 0 : theme.spacing.deca};
|
|
97
95
|
min-height: ${(0, _utils.RFValueStr)('34px')};
|
|
98
96
|
`;
|
|
99
97
|
|
|
100
98
|
default:
|
|
101
99
|
return (0, _native.css)`
|
|
102
|
-
padding: ${theme
|
|
100
|
+
padding: ${theme == null ? void 0 : theme.spacing.mili} ${theme == null ? void 0 : theme.spacing.kilo};
|
|
103
101
|
min-height: ${(0, _utils.RFValueStr)('44px')};
|
|
104
102
|
`;
|
|
105
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/GroupButton/styled.ts"],"names":["StyledGroupButton","styled","View","disabledStyles","disabled","isActive","getStyledGroupItemText","component","active","theme","miscellaneous","surfaceColor","color","secondary","medium","activeStyles","activeBorderColor","activeBorderColorTone","inactiveStyles","inactiveBackgroundColor","inactiveBackgroundColorTone","inactiveBorderColor","inactiveBorderColorTone","leftStyles","isFirstOption","borderRadius","mili","borderWidth","pico","rightStyles","isLastOption","sizeStyles","buttonSize","spacing","deca","kilo","StyledPressableBase","PressableSurface","StyledOption","StyledDivider","light","StyledPressable","props"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/GroupButton/styled.ts"],"names":["StyledGroupButton","styled","View","disabledStyles","disabled","isActive","getStyledGroupItemText","component","active","theme","miscellaneous","surfaceColor","color","secondary","medium","activeStyles","activeBorderColor","activeBorderColorTone","inactiveStyles","inactiveBackgroundColor","inactiveBackgroundColorTone","inactiveBorderColor","inactiveBorderColorTone","leftStyles","isFirstOption","borderRadius","mili","borderWidth","pico","rightStyles","isLastOption","sizeStyles","buttonSize","spacing","deca","kilo","StyledPressableBase","PressableSurface","StyledOption","StyledDivider","light","StyledPressable","props"],"mappings":";;;;;AAAA;;AAGA;;AAEA;;;;;;AAYO,MAAMA,iBAAiB,GAAGC,gBAAOC,IAA0B;AAClE;AACA,CAFO;;;AAKP,MAAMC,cAAc,GAAG,CAAC;AACtBC,EAAAA,QADsB;AAEtBC,EAAAA;AAFsB,CAAD,KAIrBD,QAAQ,IACR,CAACC,QADD,IAEA,gBAAI;AACN;AACA,GARA;;AAUO,MAAMC,sBAAsB,GAAIC,SAAD,IAA8B;AAClE,SAAO,qBAAOA,SAAP,CAEL;AACJ,aAAa,CAAC;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAD,KACPD,MAAM,GAAGC,KAAK,CAACC,aAAN,CAAoBC,YAAvB,GAAsCF,KAAK,CAACG,KAAN,CAAYC,SAAZ,CAAsBC,MAAO;AAC/E,GALE;AAMD,CAPM;;;;AASP,MAAMC,YAAY,GAAG,CAAC;AACpBN,EAAAA,KADoB;AAEpBJ,EAAAA,QAFoB;AAGpBW,EAAAA,iBAAiB,GAAG,WAHA;AAIpBC,EAAAA,qBAAqB,GAAG;AAJJ,CAAD,KAMnBZ,QAAQ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KAAD,IAAmD,gBAAI;AACzD,MAAM3B,YAAY,CAAC2B,KAAD,CAAQ;AAC1B,MAAMxB,cAAc,CAACwB,KAAD,CAAQ;AAC5B,MAAMnB,UAAU,CAACmB,KAAD,CAAQ;AACxB,MAAMb,WAAW,CAACa,KAAD,CAAQ;AACzB,MAAMX,UAAU,CAACW,KAAD,CAAQ;AACxB,MAAMvC,cAAc,CAACuC,KAAD,CAAQ;AAC5B,GAR+B,CAAxB","sourcesContent":["import styled, { css } from '@emotion/native';\nimport { FC } from 'react';\nimport { StyleProps } from '../../../types/defaults';\nimport { RFValueStr } from '../../../utils';\nimport { ButtonSizeType } from '../Button';\nimport { PressableSurface } from '../PressableSurface';\nimport { TextProps } from '../Text';\nimport { GroupButtonOptions } from './GroupButton';\nimport { GroupButtonOptionProps } from './GroupButtonOption';\n\ninterface PressableOptions extends GroupButtonOptions {\n isActive: boolean;\n isFirstOption: boolean;\n isLastOption: boolean;\n buttonSize?: ButtonSizeType;\n}\n\nexport const StyledGroupButton = styled.View<Partial<StyleProps>>`\n flex-direction: row;\n`;\n\n// TO FIXED: hexa color to theme definitions\nconst disabledStyles = ({\n disabled,\n isActive,\n}: PressableOptions & Partial<StyleProps>) =>\n disabled &&\n !isActive &&\n css`\n background-color: #dcdcdc;\n `;\n\nexport const getStyledGroupItemText = (component: FC<TextProps>) => {\n return styled(component)<\n Partial<GroupButtonOptionProps> & Partial<StyleProps>\n >`\n color: ${({ active, theme }) =>\n active ? theme.miscellaneous.surfaceColor : theme.color.secondary.medium};\n `;\n};\n\nconst activeStyles = ({\n theme,\n isActive,\n activeBorderColor = 'secondary',\n activeBorderColorTone = 'medium',\n}: PressableOptions & Partial<StyleProps>) =>\n isActive &&\n css`\n border-color: ${theme?.color[activeBorderColor][activeBorderColorTone]};\n `;\n\nconst inactiveStyles = ({\n theme,\n isActive,\n inactiveBackgroundColor,\n inactiveBackgroundColorTone,\n inactiveBorderColor = 'secondary',\n inactiveBorderColorTone = 'light',\n}: PressableOptions & Partial<StyleProps>) => {\n if (!isActive && inactiveBackgroundColor && inactiveBackgroundColorTone) {\n return css`\n border-color: ${theme?.color[inactiveBorderColor][\n inactiveBorderColorTone\n ]};\n `;\n }\n\n if (!isActive) {\n return css`\n border-color: ${theme?.color[inactiveBorderColor][\n inactiveBorderColorTone\n ]};\n `;\n }\n};\n\nconst leftStyles = ({\n theme,\n isFirstOption,\n}: PressableOptions & Partial<StyleProps>) =>\n isFirstOption &&\n css`\n border-top-left-radius: ${theme?.borderRadius.mili};\n border-bottom-left-radius: ${theme?.borderRadius.mili};\n border-left-width: ${theme?.borderWidth.pico};\n `;\n\nconst rightStyles = ({\n theme,\n isLastOption,\n}: PressableOptions & Partial<StyleProps>) =>\n isLastOption &&\n css`\n border-top-right-radius: ${theme?.borderRadius.mili};\n border-bottom-right-radius: ${theme?.borderRadius.mili};\n border-right-width: ${theme?.borderWidth.pico};\n `;\n\nconst sizeStyles = ({\n theme,\n buttonSize = 'small',\n}: PressableOptions & Partial<StyleProps>) => {\n switch (buttonSize) {\n case 'small':\n return css`\n padding: ${theme?.spacing.mili} ${theme?.spacing.deca};\n min-height: ${RFValueStr('34px')};\n `;\n default:\n return css`\n padding: ${theme?.spacing.mili} ${theme?.spacing.kilo};\n min-height: ${RFValueStr('44px')};\n `;\n }\n};\n\nconst StyledPressableBase = styled(PressableSurface)<\n PressableOptions & Partial<StyleProps>\n>`\n border-top-width: ${({ theme }) => theme.borderWidth.pico};\n border-bottom-width: ${({ theme }) => theme.borderWidth.pico};\n justify-content: center;\n align-items: center;\n flex: 1;\n`;\n\nexport const StyledOption = styled.View`\n flex-direction: row;\n flex: 1;\n`;\n\nexport const StyledDivider = styled.View<Partial<StyleProps>>`\n width: ${({ theme }) => theme.borderWidth.pico};\n background-color: ${({ theme }) => theme.color.secondary.light}; ;\n`;\n\nexport const StyledPressable = styled(StyledPressableBase)(\n (props: PressableOptions & Partial<StyleProps>) => css`\n ${activeStyles(props)}\n ${inactiveStyles(props)}\n ${leftStyles(props)}\n ${rightStyles(props)}\n ${sizeStyles(props)}\n ${disabledStyles(props)}\n `\n);\n"],"file":"styled.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Icon/Icon.tsx"],"names":["Icon","name","size","type","style","fontColor","colorVariant","colorTone","rest","theme","color","RNVIcon"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Icon/Icon.tsx"],"names":["Icon","name","size","type","style","fontColor","colorVariant","colorTone","rest","theme","color","RNVIcon"],"mappings":";;;;;AAAA;;AAEA;;AASA;;;;;;AAmBA,MAAMA,IAAmB,GAAG,CAAC;AAC3BC,EAAAA,IAD2B;AAE3BC,EAAAA,IAAI,GAAG,OAFoB;AAG3BC,EAAAA,IAH2B;AAI3BC,EAAAA,KAJ2B;AAK3BC,EAAAA,SAAS,GAAG,MALe;AAM3BC,EAAAA,YAN2B;AAO3BC,EAAAA,SAAS,GAAG,QAPe;AAQ3B,KAAGC;AARwB,CAAD,KAStB;AACJ,QAAMC,KAAK,GAAG,uBAAd;AACA,QAAMC,KAAK,GAAG,2BAAaJ,YAAb,EAA2BC,SAA3B,EAAsCF,SAAtC,EAAiDI,KAAjD,CAAd;AACA,QAAME,OAAO,GAAG,+BAAiBR,IAAjB,EAAuBD,IAAvB,CAAhB;AAEA,SAAO,6BAAC,OAAD,eAAaM,IAAb;AAAmB,IAAA,KAAK,EAAEJ,KAA1B;AAAiC,IAAA,IAAI,EAAEH,IAAvC;AAA6C,IAAA,KAAK,EAAES;AAApD,KAAP;AACD,CAfD;;eAiBeV,I","sourcesContent":["import React, { FC } from 'react';\nimport { StyleProp, TextStyle } from 'react-native';\nimport { useTheme } from '@emotion/react';\nimport {\n ColorGradationType,\n ColorType,\n FontColorType,\n IconSizeType,\n IconType,\n ThemeProp,\n} from '@tecsinapse/react-core';\nimport { getIconColor, getIconComponent } from './helpers';\n\nexport interface IconProps {\n /** Name of the icon. You must use the same icons from react-native-vector-icons */\n name: string;\n /** Default icon sizes from theme */\n size?: IconSizeType;\n /** Icon family. You must use the same icons from react-native-vector-icons */\n type: IconType;\n /** Font theme fill color */\n fontColor?: FontColorType;\n /** Palette theme fill color */\n colorVariant?: ColorType;\n /** Palette theme gradation fill color */\n colorTone?: ColorGradationType;\n style?: StyleProp<TextStyle>;\n}\n\n/** NOTE: When using colors, the order matters if you're trying to merge multiple types. */\nconst Icon: FC<IconProps> = ({\n name,\n size = 'centi',\n type,\n style,\n fontColor = 'dark',\n colorVariant,\n colorTone = 'medium',\n ...rest\n}) => {\n const theme = useTheme() as ThemeProp;\n const color = getIconColor(colorVariant, colorTone, fontColor, theme);\n const RNVIcon = getIconComponent(type, size);\n\n return <RNVIcon {...rest} style={style} name={name} color={color} />;\n};\n\nexport default Icon;\n"],"file":"Icon.js"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.getIconColor = exports.getIconComponent = exports.registerCustomIconType = void 0;
|
|
7
5
|
|
|
8
6
|
var _native = _interopRequireDefault(require("@emotion/native"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Icon/helpers.ts"],"names":["customIcons","registerCustomIconType","id","customIcon","getStyledIcon","Component","size","theme","iconSize","getIconComponent","type","require","default","Object","prototype","hasOwnProperty","call","getIconColor","colorVariant","colorGradation","fontColor","color","font"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Icon/helpers.ts"],"names":["customIcons","registerCustomIconType","id","customIcon","getStyledIcon","Component","size","theme","iconSize","getIconComponent","type","require","default","Object","prototype","hasOwnProperty","call","getIconColor","colorVariant","colorGradation","fontColor","color","font"],"mappings":";;;;;AAQA;;;;AAGA,MAAMA,WAAgB,GAAG,EAAzB;;AAEO,MAAMC,sBAAsB,GAAG,CAACC,EAA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{\n ColorGradationType,\n ColorType,\n FontColorType,\n IconSizeType,\n IconType,\n ThemeProp,\n} from '@tecsinapse/react-core';\nimport styled from '@emotion/native';\n\n/* eslint-disable */\nconst customIcons: any = {};\n\nexport const registerCustomIconType = (id: string, customIcon: any) => {\n customIcons[id] = customIcon;\n};\n\nconst getStyledIcon = (Component, size) => styled(Component)`\n font-size: ${({ theme }) => theme.iconSize[size]};\n text-align: center;\n`;\n\nexport const getIconComponent = (type: IconType, size: IconSizeType): any => {\n switch (type) {\n case 'zocial':\n return getStyledIcon(\n require('react-native-vector-icons/Zocial').default,\n size\n );\n case 'octicon':\n return getStyledIcon(\n require('react-native-vector-icons/Octicons').default,\n size\n );\n case 'material':\n return getStyledIcon(\n require('react-native-vector-icons/MaterialIcons').default,\n size\n );\n case 'material-community':\n return getStyledIcon(\n require('react-native-vector-icons/MaterialCommunityIcons').default,\n size\n );\n case 'ionicon':\n return getStyledIcon(\n require('react-native-vector-icons/Ionicons').default,\n size\n );\n case 'foundation':\n return getStyledIcon(\n require('react-native-vector-icons/Foundation').default,\n size\n );\n case 'evilicon':\n return getStyledIcon(\n require('react-native-vector-icons/EvilIcons').default,\n size\n );\n case 'entypo':\n return getStyledIcon(\n require('react-native-vector-icons/Entypo').default,\n size\n );\n case 'font-awesome':\n return getStyledIcon(\n require('react-native-vector-icons/FontAwesome').default,\n size\n );\n case 'font-awesome-5':\n return getStyledIcon(\n require('react-native-vector-icons/FontAwesome5').default,\n size\n );\n case 'simple-line-icon':\n return getStyledIcon(\n require('react-native-vector-icons/SimpleLineIcons').default,\n size\n );\n case 'feather':\n return getStyledIcon(\n require('react-native-vector-icons/Feather').default,\n size\n );\n case 'antdesign':\n case 'ant-design':\n return getStyledIcon(\n require('react-native-vector-icons/AntDesign').default,\n size\n );\n case 'fontisto':\n return getStyledIcon(\n require('react-native-vector-icons/Fontisto').default,\n size\n );\n default:\n if (Object.prototype.hasOwnProperty.call(customIcons, type)) {\n return getStyledIcon(customIcons[type], size);\n }\n return getStyledIcon(\n require('react-native-vector-icons/MaterialIcons').default,\n size\n );\n }\n};\n/* eslint-enable */\nexport const getIconColor = (\n colorVariant: ColorType | undefined,\n colorGradation: ColorGradationType | undefined,\n fontColor: FontColorType,\n theme: ThemeProp\n): string => {\n if (colorVariant && colorGradation) {\n return theme.color[colorVariant][colorGradation];\n }\n return theme.font.color[fontColor];\n};\n"],"file":"helpers.js"}
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Icon", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _Icon.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "IconProps", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _Icon.IconProps;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.IconProps = exports.Icon = void 0;
|
|
18
5
|
|
|
19
6
|
var _Icon = _interopRequireWildcard(require("./Icon"));
|
|
20
7
|
|
|
8
|
+
exports.Icon = _Icon.default;
|
|
9
|
+
exports.IconProps = _Icon.IconProps;
|
|
10
|
+
|
|
21
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
12
|
|
|
23
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Icon/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Icon/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export { default as Icon, IconProps } from './Icon';\n"],"file":"index.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Input/Hint.tsx"],"names":["Hint","variant","text","TextComponent","Text","color","icon"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Input/Hint.tsx"],"names":["Hint","variant","text","TextComponent","Text","color","icon"],"mappings":";;;;;AAAA;;AAGA;;AACA;;;;AAQA,MAAMA,IAAmB,GAAG,CAAC;AAAEC,EAAAA,OAAF;AAAWC,EAAAA,IAAX;AAAiBC,EAAAA,aAAa,GAAGC;AAAjC,CAAD,KAA6C;AACvE,MAAIC,KAAJ;AACA,MAAIC,IAAJ;;AAEA,UAAQL,OAAR;AACE,SAAK,SAAL;AACEI,MAAAA,KAAK,GAAG,WAAR;AACA;;AACF,SAAK,OAAL;AACEA,MAAAA,KAAK,GAAG,OAAR;AACAC,MAAAA,IAAI,GAAG,sBAAP;AACA;;AACF,SAAK,SAAL;AACED,MAAAA,KAAK,GAAG,SAAR;AACAC,MAAAA,IAAI,GAAG,0BAAP;AACA;AAXJ;;AAcA,SACE,6BAAC,2BAAD,QACGA,IAAI,IACH,6BAAC,sBAAD;AACE,IAAA,IAAI,EAAEA,IADR;AAEE,IAAA,IAAI,EAAC,SAFP;AAGE,IAAA,IAAI,EAAC,OAHP;AAIE,IAAA,YAAY,EAAED;AAJhB,IAFJ,EASE,6BAAC,aAAD;AAAe,IAAA,UAAU,EAAC,OAA1B;AAAkC,IAAA,YAAY,EAAEA;AAAhD,KACGH,IADH,CATF,CADF;AAeD,CAjCD;;eAmCeF,I","sourcesContent":["import React, { FC } from 'react';\nimport { ColorType } from '../../../types/defaults';\nimport { InputVariantType } from '../Input';\nimport { Text, TextProps } from '../Text';\nimport { StyledHintContainer, StyledHintIcon } from './styled';\n\ninterface HintProps {\n text?: string;\n variant: InputVariantType;\n TextComponent?: FC<TextProps>;\n}\n\nconst Hint: FC<HintProps> = ({ variant, text, TextComponent = Text }) => {\n let color: ColorType;\n let icon;\n\n switch (variant) {\n case 'default':\n color = 'secondary';\n break;\n case 'error':\n color = 'error';\n icon = 'close-circle-outline';\n break;\n case 'success':\n color = 'success';\n icon = 'checkmark-circle-outline';\n break;\n }\n\n return (\n <StyledHintContainer>\n {icon && (\n <StyledHintIcon\n name={icon}\n type=\"ionicon\"\n size=\"centi\"\n colorVariant={color}\n />\n )}\n <TextComponent typography=\"label\" colorVariant={color}>\n {text}\n </TextComponent>\n </StyledHintContainer>\n );\n};\n\nexport default Hint;\n"],"file":"Hint.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/atoms/Input/InputContainer/InputContainer.tsx"],"names":["InputContainer","label","labelColor","labelColorTone","labelColorVariant","labelTypography","labelStack","labelWeight","LabelComponent","Text","leftComponent","rightComponent","inputContainerStyle","disabled","focused","variant","children","rest","_defaultLabelColor","_labelColorVariant","_labelColorTone"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/atoms/Input/InputContainer/InputContainer.tsx"],"names":["InputContainer","label","labelColor","labelColorTone","labelColorVariant","labelTypography","labelStack","labelWeight","LabelComponent","Text","leftComponent","rightComponent","inputContainerStyle","disabled","focused","variant","children","rest","_defaultLabelColor","_labelColorVariant","_labelColorTone"],"mappings":";;;;;AAAA;;AA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AEE,IAAA,SAAS,EAAEkB,eAFb;AAGE,IAAA,YAAY,EAAED,kBAHhB;AAIE,IAAA,UAAU,EAAEd,eAJd;AAKE,IAAA,UAAU,EAAEE,WALd;AAME,IAAA,SAAS,EAAED;AANb,KAQGL,KARH,CALJ,EAgBGe,QAhBH,CAdF,EAiCGL,cAAc,IACb,6BAAC,yBAAD,QAAoBA,cAApB,CAlCJ,CADF;AAuCD,CA/DD;;eAiEeX,c","sourcesContent":["import React, { FC } from 'react';\nimport { StyleProp, ViewStyle } from 'react-native';\nimport { InputElementProps } from '..';\nimport {\n ColorGradationType,\n ColorType,\n FontColorType,\n FontStackType,\n FontWeightType,\n TypographyVariationType,\n} from '../../../../types/defaults';\nimport { Text, TextProps } from '../../Text';\nimport {\n StyledBorderKeeper,\n StyledIconContent,\n StyledInputContainer,\n StyledLabelContainer,\n} from '../styled';\n\nexport type InputVariantType = 'default' | 'error' | 'success';\n\nexport interface InputContainerProps {\n label?: string;\n labelColor?: FontColorType;\n labelColorVariant?: ColorType;\n labelColorTone?: ColorGradationType;\n labelTypography?: TypographyVariationType;\n labelStack?: FontStackType;\n LabelComponent?: FC<TextProps>;\n labelWeight?: FontWeightType;\n leftComponent?: JSX.Element;\n rightComponent?: JSX.Element;\n borderColor?: ColorType;\n borderColorGradation?: ColorGradationType;\n style?: StyleProp<ViewStyle>;\n inputContainerStyle?: StyleProp<ViewStyle>;\n focused?: boolean;\n disabled?: boolean;\n variant?: InputVariantType;\n hint?: string;\n hintComponent?: JSX.Element;\n}\n\nconst InputContainer: FC<InputContainerProps & Partial<InputElementProps>> = ({\n label,\n labelColor = 'medium',\n labelColorTone,\n labelColorVariant,\n labelTypography = 'label',\n labelStack = 'default',\n labelWeight = 'bold',\n LabelComponent = Text,\n leftComponent,\n rightComponent,\n inputContainerStyle,\n disabled,\n focused,\n variant,\n children,\n ...rest\n}): JSX.Element => {\n let _defaultLabelColor = labelColorVariant;\n if (variant === 'error') _defaultLabelColor = 'error';\n if (variant === 'success') _defaultLabelColor = 'success';\n const _labelColorVariant = disabled ? 'secondary' : _defaultLabelColor;\n const _labelColorTone = disabled ? 'light' : labelColorTone;\n\n return (\n <StyledInputContainer\n {...rest}\n style={inputContainerStyle}\n focused={focused}\n disabled={disabled}\n >\n <StyledBorderKeeper\n focused={focused}\n disabled={disabled}\n borderColor={_defaultLabelColor}\n />\n\n {leftComponent && <StyledIconContent>{leftComponent}</StyledIconContent>}\n\n <StyledLabelContainer\n leftComponent={leftComponent}\n rightComponent={rightComponent}\n >\n {label && (\n <LabelComponent\n fontColor={labelColor}\n colorTone={_labelColorTone}\n colorVariant={_labelColorVariant}\n typography={labelTypography}\n fontWeight={labelWeight}\n fontStack={labelStack}\n >\n {label}\n </LabelComponent>\n )}\n {children}\n </StyledLabelContainer>\n\n {rightComponent && (\n <StyledIconContent>{rightComponent}</StyledIconContent>\n )}\n </StyledInputContainer>\n );\n};\n\nexport default InputContainer;\n"],"file":"InputContainer.js"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { StyleProp, TextInputProps, TextStyle } from 'react-native';
|
|
3
|
-
import { MaskType } from '../hooks/useStringMask';
|
|
4
|
-
import { CurrencyOptions } from '../hooks/useNumberMask';
|
|
5
3
|
export interface InputElementProps extends Omit<TextInputProps, 'onChange' | 'value' | 'ref'> {
|
|
6
4
|
style?: StyleProp<TextStyle>;
|
|
7
|
-
value
|
|
5
|
+
value?: string;
|
|
8
6
|
placeholder?: string;
|
|
9
7
|
disabled?: boolean;
|
|
10
|
-
onChange?: (value:
|
|
11
|
-
mask?: (MaskType[] | ((value: string) => MaskType[])) | CurrencyOptions;
|
|
8
|
+
onChange?: (value: string) => void;
|
|
12
9
|
onFocus?: () => void;
|
|
13
10
|
onBlur?: () => void;
|
|
14
11
|
ref?: React.Ref<any>;
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.default = void 0;
|
|
7
5
|
|
|
8
6
|
var _react = require("@emotion/react");
|
|
9
7
|
|
|
10
|
-
var _react2 =
|
|
8
|
+
var _react2 = _interopRequireDefault(require("react"));
|
|
11
9
|
|
|
12
10
|
var _styled = require("../styled");
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _useNumberMask = require("../hooks/useNumberMask");
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
13
|
|
|
22
14
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
15
|
|
|
@@ -27,52 +19,16 @@ const InputElement = _react2.default.forwardRef(({
|
|
|
27
19
|
value,
|
|
28
20
|
disabled = false,
|
|
29
21
|
placeholderTextColor,
|
|
30
|
-
mask,
|
|
31
22
|
...rest
|
|
32
23
|
}, ref) => {
|
|
33
24
|
const theme = (0, _react.useTheme)();
|
|
34
25
|
|
|
35
26
|
const _placeholderColor = placeholderTextColor || theme.font.color.dark;
|
|
36
27
|
|
|
37
|
-
const getInputHook = value => {
|
|
38
|
-
if (mask !== undefined) {
|
|
39
|
-
if (Array.isArray(mask) || typeof mask === 'function') {
|
|
40
|
-
return (0, _useStringMask.useStringMask)(mask, value);
|
|
41
|
-
} else {
|
|
42
|
-
return (0, _useNumberMask.useNumberMask)(mask, value);
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
45
|
-
return [undefined, undefined];
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const [maskValue, setMaskValue] = getInputHook(value);
|
|
50
|
-
|
|
51
|
-
const _value = maskValue === undefined ? value.toString() : maskValue.formatted ? maskValue.formatted : '';
|
|
52
|
-
|
|
53
|
-
(0, _react2.useEffect)(() => {
|
|
54
|
-
if (onChange) {
|
|
55
|
-
onChange(maskValue === null || maskValue === void 0 ? void 0 : maskValue.raw);
|
|
56
|
-
}
|
|
57
|
-
}, [maskValue]);
|
|
58
|
-
const onChangeValue = (0, _react2.useCallback)(value => {
|
|
59
|
-
if (maskValue !== undefined && setMaskValue !== undefined) {
|
|
60
|
-
setMaskValue(value);
|
|
61
|
-
} else onChange && onChange(value);
|
|
62
|
-
}, [value]);
|
|
63
|
-
(0, _react2.useEffect)(() => {
|
|
64
|
-
if (maskValue !== undefined && setMaskValue !== undefined && value !== undefined && typeof maskValue === 'object') {
|
|
65
|
-
if (maskValue.raw !== undefined && maskValue.raw.toString() !== value.toString()) {
|
|
66
|
-
onChangeValue(value);
|
|
67
|
-
}
|
|
68
|
-
} else if (maskValue === undefined && value !== undefined) {
|
|
69
|
-
onChangeValue(value);
|
|
70
|
-
}
|
|
71
|
-
}, [value]);
|
|
72
28
|
return _react2.default.createElement(_styled.StyledInputElement, _extends({}, rest, {
|
|
73
29
|
ref: ref,
|
|
74
|
-
onChangeText:
|
|
75
|
-
value:
|
|
30
|
+
onChangeText: onChange,
|
|
31
|
+
value: value,
|
|
76
32
|
placeholder: placeholder,
|
|
77
33
|
placeholderTextColor: _placeholderColor,
|
|
78
34
|
disabled: disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/atoms/Input/InputElement/InputElement.tsx"],"names":["InputElement","React","forwardRef","onChange","placeholder","value","disabled","placeholderTextColor","
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/atoms/Input/InputElement/InputElement.tsx"],"names":["InputElement","React","forwardRef","onChange","placeholder","value","disabled","placeholderTextColor","rest","ref","theme","_placeholderColor","font","color","dark","displayName"],"mappings":";;;;;AAAA;;AAEA;;AAEA;;;;;;AAcA,MAAMA,YAAmC,GAAGC,gBAAMC,UAAN,CAC1C,CACE;AACEC,EAAAA,QADF;AAEEC,EAAAA,WAFF;AAGEC,EAAAA,KAHF;AAIEC,EAAAA,QAAQ,GAAG,KAJb;AAKEC,EAAAA,oBALF;AAME,KAAGC;AANL,CADF,EASEC,GATF,KAUkB;AAChB,QAAMC,KAAK,GAAG,sBAAd;;AACA,QAAMC,iBAAiB,GAAGJ,oBAAoB,IAAIG,KAAK,CAACE,IAAN,CAAWC,KAAX,CAAiBC,IAAnE;;AAEA,SACE,8BAAC,0BAAD,eACMN,IADN;AAEE,IAAA,GAAG,EAAEC,GAFP;AAGE,IAAA,YAAY,EAAEN,QAHhB;AAIE,IAAA,KAAK,EAAEE,KAJT;AAKE,IAAA,WAAW,EAAED,WALf;AAME,IAAA,oBAAoB,EAAEO,iBANxB;AAOE,IAAA,QAAQ,EAAEL,QAPZ;AAQE,IAAA,QAAQ,EAAE,CAACA;AARb,KADF;AAYD,CA3ByC,CAA5C;;AA8BAN,YAAY,CAACe,WAAb,GAA2B,cAA3B;eAEef,Y","sourcesContent":["import { useTheme } from '@emotion/react';\nimport { ThemeProp } from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\nimport { StyleProp, 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 ref?: React.Ref<any>;\n}\n\nconst InputElement: FC<InputElementProps> = React.forwardRef(\n (\n {\n onChange,\n placeholder,\n value,\n disabled = false,\n placeholderTextColor,\n ...rest\n },\n ref: React.Ref<any>\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"],"file":"InputElement.js"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { StyleProp, TextInputProps, TextStyle } from 'react-native';
|
|
3
|
+
import { MaskType } from '../hooks/useStringMask';
|
|
4
|
+
import { CurrencyOptions } from '../hooks/useNumberMask';
|
|
5
|
+
export interface InputMaskElementProps extends Omit<TextInputProps, 'onChange' | 'value' | 'ref'> {
|
|
6
|
+
style?: StyleProp<TextStyle>;
|
|
7
|
+
value?: string | number;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onChange?: (value: any) => void;
|
|
11
|
+
mask?: (MaskType[] | ((value: string) => MaskType[])) | CurrencyOptions;
|
|
12
|
+
onFocus?: () => void;
|
|
13
|
+
onBlur?: () => void;
|
|
14
|
+
ref?: React.Ref<any>;
|
|
15
|
+
}
|
|
16
|
+
declare const InputMaskElement: FC<InputMaskElementProps>;
|
|
17
|
+
export default InputMaskElement;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = require("@emotion/react");
|
|
7
|
+
|
|
8
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _styled = require("../styled");
|
|
11
|
+
|
|
12
|
+
var _useStringMask = require("../hooks/useStringMask");
|
|
13
|
+
|
|
14
|
+
var _useNumberMask = require("../hooks/useNumberMask");
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
+
|
|
22
|
+
const InputMaskElement = _react2.default.forwardRef(({
|
|
23
|
+
onChange,
|
|
24
|
+
placeholder,
|
|
25
|
+
value,
|
|
26
|
+
disabled = false,
|
|
27
|
+
placeholderTextColor,
|
|
28
|
+
mask,
|
|
29
|
+
...rest
|
|
30
|
+
}, ref) => {
|
|
31
|
+
const theme = (0, _react.useTheme)();
|
|
32
|
+
|
|
33
|
+
const _placeholderColor = placeholderTextColor || theme.font.color.dark;
|
|
34
|
+
|
|
35
|
+
const getInputHook = value => {
|
|
36
|
+
if (mask !== undefined) {
|
|
37
|
+
if (Array.isArray(mask) || typeof mask === 'function') {
|
|
38
|
+
return (0, _useStringMask.useStringMask)(mask, value);
|
|
39
|
+
} else {
|
|
40
|
+
return (0, _useNumberMask.useNumberMask)(mask, value);
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
return [undefined, undefined];
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const [maskValue, setMaskValue] = getInputHook(value ?? '');
|
|
48
|
+
|
|
49
|
+
const _value = maskValue === undefined ? value == null ? void 0 : value.toString() : maskValue.formatted ? maskValue.formatted : '';
|
|
50
|
+
|
|
51
|
+
(0, _react2.useEffect)(() => {
|
|
52
|
+
if (onChange) {
|
|
53
|
+
onChange(maskValue == null ? void 0 : maskValue.raw);
|
|
54
|
+
}
|
|
55
|
+
}, [maskValue]);
|
|
56
|
+
const onChangeValue = (0, _react2.useCallback)(value => {
|
|
57
|
+
if (maskValue !== undefined && setMaskValue !== undefined) {
|
|
58
|
+
setMaskValue(value);
|
|
59
|
+
} else onChange && onChange(value);
|
|
60
|
+
}, [value]);
|
|
61
|
+
(0, _react2.useEffect)(() => {
|
|
62
|
+
if (maskValue !== undefined && setMaskValue !== undefined && value !== undefined && typeof maskValue === 'object') {
|
|
63
|
+
if (maskValue.raw !== undefined && maskValue.raw.toString() !== value.toString()) {
|
|
64
|
+
onChangeValue(value);
|
|
65
|
+
}
|
|
66
|
+
} else if (maskValue === undefined && value !== undefined) {
|
|
67
|
+
onChangeValue(value);
|
|
68
|
+
}
|
|
69
|
+
}, [value]);
|
|
70
|
+
return _react2.default.createElement(_styled.StyledInputElement, _extends({}, rest, {
|
|
71
|
+
ref: ref,
|
|
72
|
+
onChangeText: onChangeValue,
|
|
73
|
+
value: _value,
|
|
74
|
+
placeholder: placeholder,
|
|
75
|
+
placeholderTextColor: _placeholderColor,
|
|
76
|
+
disabled: disabled,
|
|
77
|
+
editable: !disabled
|
|
78
|
+
}));
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
InputMaskElement.displayName = 'InputMaskElement';
|
|
82
|
+
var _default = InputMaskElement;
|
|
83
|
+
exports.default = _default;
|
|
84
|
+
//# sourceMappingURL=InputMaskElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/atoms/Input/InputMaskElement/InputMaskElement.tsx"],"names":["InputMaskElement","React","forwardRef","onChange","placeholder","value","disabled","placeholderTextColor","mask","rest","ref","theme","_placeholderColor","font","color","dark","getInputHook","undefined","Array","isArray","maskValue","setMaskValue","_value","toString","formatted","raw","onChangeValue","displayName"],"mappings":";;;;;AAAA;;AAEA;;AAEA;;AACA;;AACA;;;;;;;;AAuBA,MAAMA,gBAA2C,GAAGC,gBAAMC,UAAN,CAClD,CACE;AACEC,EAAAA,QADF;AAEEC,EAAAA,WAFF;AAGEC,EAAAA,KAHF;AAIEC,EAAAA,QAAQ,GAAG,KAJb;AAKEC,EAAAA,oBALF;AAMEC,EAAAA,IANF;AAOE,KAAGC;AAPL,CADF,EAUEC,GAVF,KAWkB;AAChB,QAAMC,KAAK,GAAG,sBAAd;;AAEA,QAAMC,iBAAiB,GAAGL,oBAAoB,IAAII,KAAK,CAACE,IAAN,CAAWC,KAAX,CAAiBC,IAAnE;;AAEA,QAAMC,YAAY,GAAIX,KAAD,IAA4B;AAC/C,QAAIG,IAAI,KAAKS,SAAb,EAAwB;AACtB,UAAIC,KAAK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D,MAaO,IAAIe,SAAS,KAAKH,SAAd,IAA2BZ,KAAK,KAAKY,SAAzC,EAAoD;AACzDS,MAAAA,aAAa,CAACrB,KAAD,CAAb;AACD;AACF,GAlBD,EAkBG,CAACA,KAAD,CAlBH;AAoBA,SACE,8BAAC,0BAAD,eACMI,IADN;AAEE,IAAA,GAAG,EAAEC,GAFP;AAGE,IAAA,YAAY,EAAEgB,aAHhB;AAIE,IAAA,KAAK,EAAEJ,MAJT;AAKE,IAAA,WAAW,EAAElB,WALf;AAME,IAAA,oBAAoB,EAAEQ,iBANxB;AAOE,IAAA,QAAQ,EAAEN,QAPZ;AAQE,IAAA,QAAQ,EAAE,CAACA;AARb,KADF;AAYD,CArFiD,CAApD;;AAwFAN,gBAAgB,CAAC2B,WAAjB,GAA+B,kBAA/B;eAEe3B,gB","sourcesContent":["import { useTheme } from '@emotion/react';\nimport { ThemeProp } from '@tecsinapse/react-core';\nimport React, { FC, useCallback, useEffect } from 'react';\nimport { StyleProp, 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 ref?: React.Ref<any>;\n}\n\nconst InputMaskElement: FC<InputMaskElementProps> = React.forwardRef(\n (\n {\n onChange,\n placeholder,\n value,\n disabled = false,\n placeholderTextColor,\n mask,\n ...rest\n },\n ref: React.Ref<any>\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"],"file":"InputMaskElement.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/atoms/Input/PressableInputContainer/PressableInputContainer.tsx"],"names":["PressableInputContainer","onPress","disabled","style","children","rest"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/atoms/Input/PressableInputContainer/PressableInputContainer.tsx"],"names":["PressableInputContainer","onPress","disabled","style","children","rest"],"mappings":";;;;;AAAA;;AAEA;;AAGA;;;;;;;;;;AAcA,MAAMA,uBAA+D,GAAG,CAAC;AACvEC,EAAAA,OADuE;AAEvEC,EAAAA,QAFuE;AAGvEC,EAAAA,KAHuE;AAIvEC,EAAAA,QAJuE;AAKvE,KAAGC;AALoE,CAAD,KAMlE;AACJ,SACE,oBAAC,8BAAD;AAAwB,IAAA,OAAO,EAAEJ,OAAjC;AAA0C,IAAA,QAAQ,EAAEC,QAApD;AAA8D,IAAA,KAAK,EAAEC;AAArE,KACE,oBAAC,uBAAD;AAAgB,IAAA,QAAQ,EAAED;AAA1B,KAAwCG,IAAxC,GACGD,QADH,CADF,CADF;AAOD,CAdD;;eAgBeJ,uB","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"],"file":"PressableInputContainer.js"}
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "PressableInputContainer", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _PressableInputContainer.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "PressableInputContainerProps", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _PressableInputContainer.PressableInputContainerProps;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.PressableInputContainerProps = exports.PressableInputContainer = void 0;
|
|
18
5
|
|
|
19
6
|
var _PressableInputContainer = _interopRequireWildcard(require("./PressableInputContainer"));
|
|
20
7
|
|
|
8
|
+
exports.PressableInputContainer = _PressableInputContainer.default;
|
|
9
|
+
exports.PressableInputContainerProps = _PressableInputContainer.PressableInputContainerProps;
|
|
10
|
+
|
|
21
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
12
|
|
|
23
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/atoms/Input/PressableInputContainer/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/atoms/Input/PressableInputContainer/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export {\n default as PressableInputContainer,\n PressableInputContainerProps,\n} from './PressableInputContainer';\n"],"file":"index.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/atoms/Input/PressableInputContainer/styled.ts"],"names":["StyledPressableSurface","styled","Pressable"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/atoms/Input/PressableInputContainer/styled.ts"],"names":["StyledPressableSurface","styled","Pressable"],"mappings":";;;;;AAAA;;;;AAEO,MAAMA,sBAAsB,GAAGC,gBAAOC,SAAU;AACvD;AACA,CAFO","sourcesContent":["import styled from '@emotion/native';\n\nexport const StyledPressableSurface = styled.Pressable`\n width: 100%;\n`;\n"],"file":"styled.js"}
|