@tecsinapse/react-core 1.15.0 → 1.16.1
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 +30 -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 +3 -5
- 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 +4 -6
- 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 +4 -8
- 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 +6 -6
- 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/hooks/useNumberMask.ts +1 -1
- package/src/components/atoms/Input/index.ts +4 -0
- package/src/components/atoms/Input/styled.ts +1 -1
- package/src/components/atoms/ProgressBar/ProgressBar.tsx +2 -1
- package/src/index.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/atoms/Input/hooks/useInputFocus.ts"],"names":["useInputFocus","onFocus","onBlur","focusEnabled","focused","setFocused","handleFocus","handleBlur"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/atoms/Input/hooks/useInputFocus.ts"],"names":["useInputFocus","onFocus","onBlur","focusEnabled","focused","setFocused","handleFocus","handleBlur"],"mappings":";;;;;AAAA;;AAEO,MAAMA,aAAa,GAAG,CAC3BC,OAD2B,EAE3BC,MAF2B,EAG3BC,YAAY,GAAG,IAHY,KAIxB;AACH,QAAM,CAACC,OAAD,EAAUC,UAAV,IAAwB,qBAAkB,KAAlB,CAA9B;AAEA,QAAMC,WAAW,GAAG,wBAAY,MAAM;AACpC,QAAIH,YAAJ,EAAkB;AAChBE,MAAAA,UAAU,CAAC,IAAD,CAAV;AACAJ,MAAAA,OAAO,IAAIA,OAAO,EAAlB;AACD;AACF,GALmB,EAKjB,CAACE,YAAD,EAAeE,UAAf,EAA2BJ,OAA3B,CALiB,CAApB;AAOA,QAAMM,UAAU,GAAG,wBAAY,MAAM;AACnC,QAAIJ,YAAJ,EAAkB;AAChBE,MAAAA,UAAU,CAAC,KAAD,CAAV;AACAH,MAAAA,MAAM,IAAIA,MAAM,EAAhB;AACD;AACF,GALkB,EAKhB,CAACC,YAAD,EAAeE,UAAf,EAA2BH,MAA3B,CALgB,CAAnB;AAOA,SAAO;AACLE,IAAAA,OADK;AAELG,IAAAA,UAFK;AAGLD,IAAAA;AAHK,GAAP;AAKD,CA1BM","sourcesContent":["import { useCallback, useState } from 'react';\n\nexport const useInputFocus = (\n onFocus?: () => void,\n onBlur?: () => void,\n focusEnabled = true\n) => {\n const [focused, setFocused] = useState<boolean>(false);\n\n const handleFocus = useCallback(() => {\n if (focusEnabled) {\n setFocused(true);\n onFocus && onFocus();\n }\n }, [focusEnabled, setFocused, onFocus]);\n\n const handleBlur = useCallback(() => {\n if (focusEnabled) {\n setFocused(false);\n onBlur && onBlur();\n }\n }, [focusEnabled, setFocused, onBlur]);\n\n return {\n focused,\n handleBlur,\n handleFocus,\n };\n};\n"],"file":"useInputFocus.js"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.useNumberMask = exports.getInternalNumberAndMask = void 0;
|
|
7
5
|
|
|
8
6
|
var _currency = _interopRequireDefault(require("currency.js"));
|
|
9
7
|
|
|
10
8
|
var _react = require("react");
|
|
11
9
|
|
|
12
|
-
var
|
|
10
|
+
var _extractNumbersFromString = require("../../../../utils/extractNumbersFromString");
|
|
13
11
|
|
|
14
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
13
|
|
|
@@ -48,7 +46,7 @@ const getInternalNumberAndMask = (value, options) => {
|
|
|
48
46
|
internalNumber = value;
|
|
49
47
|
}
|
|
50
48
|
} else {
|
|
51
|
-
const onlyNumbers = String((0,
|
|
49
|
+
const onlyNumbers = String((0, _extractNumbersFromString.extractNumbersFromString)(value));
|
|
52
50
|
const padZeros = String(onlyNumbers).padStart(precision + 1, '0');
|
|
53
51
|
internalNumber = Number(padZeros.replace(getRegex(precision), '.'));
|
|
54
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/atoms/Input/hooks/useNumberMask.ts"],"names":["DEFAULT_OPTIONS","symbol","separator","decimal","precision","getRegex","RegExp","getInternalNumberAndMask","value","options","mergedOptions","internalNumber","stringValue","String","decimalIndex","indexOf","currentPrecision","length","zeros","i","Number","onlyNumbers","padZeros","padStart","replace","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","useNumberMask","defaultValue","applyMask","raw","formatted","format","setValue","handleChangeValue","formattedValue"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/atoms/Input/hooks/useNumberMask.ts"],"names":["DEFAULT_OPTIONS","symbol","separator","decimal","precision","getRegex","RegExp","getInternalNumberAndMask","value","options","mergedOptions","internalNumber","stringValue","String","decimalIndex","indexOf","currentPrecision","length","zeros","i","Number","onlyNumbers","padZeros","padStart","replace","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","useNumberMask","defaultValue","applyMask","raw","formatted","format","setValue","handleChangeValue","formattedValue"],"mappings":";;;;;AAAA;;AACA;;AACA;;;;AAKA,MAAMA,eAAgC,GAAG;AACvCC,EAAAA,MAAM,EAAE,KAD+B;AAEvCC,EAAAA,SAAS,EAAE,GAF4B;AAGvCC,EAAAA,OAAO,EAAE,GAH8B;AAIvCC,EAAAA,SAAS,EAAE;AAJ4B,CAAzC;;AAOA,MAAMC,QAAQ,GAAID,SAAD,IACf,IAAIE,MAAJ,CAAY,cAAaF,SAAU,YAAnC,EAAgD,GAAhD,CADF;;AAGO,MAAMG,wBAAwB,GAAG,CACtCC,KADsC,EAEtCC,OAFsC,KAGyB;AAC/D,QAAMC,aAAa,GAAG,EAAE,GAAGV,eAAL;AAAsB,OAAGS;AAAzB,GAAtB;AACA,QAAM;AAAEL,IAAAA,SAAS,GAAG,CAAC;AAAf,MAAqBM,aAA3B;AAEA,MAAIC,cAAJ;;AAEA,MAAI,OAAOH,KAAP,KAAiB,QAArB,EAA+B;AAC7B,QAAIJ,SAAJ,EAAe;AACb,UAAIQ,WAAW,GAAGC,MAAM,CAACL,KAAD,CAAxB;AACA,YAAMM,YAAY,GAAGF,WAAW,CAACG,OAAZ,CAAoB,GAApB,CAArB;AACA,YAAMC,gBAAgB,GAAGF,YAAY,GAAGV,SAAxC;;AACA,UAAIU,YAAY,KAAK,CAAC,CAAlB,IAAuBE,gBAAgB,IAAIJ,WAAW,CAACK,MAA3D,EAAmE;AACjE,cAAMC,KAAK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AASpB,cAAT,EAAyBqB,MAAzB,CAAgCtB,aAAhC;AAFN,KAAP;AAID,GAXe,EAYhB,CAACD,OAAD,EAAUJ,QAAV,CAZgB,CAAlB;AAeA,QAAM,CAACG,KAAD,EAAQyB,QAAR,IAAoB,qBAAoBJ,SAAS,CAACD,YAAD,CAA7B,CAA1B;AAEA,QAAMM,iBAAiB,GAAG,wBACvBC,cAAD,IAAqC;AACnC,UAAM;AAAEL,MAAAA,GAAF;AAAOC,MAAAA;AAAP,QAAqBF,SAAS,CAACM,cAAD,CAApC;AACAF,IAAAA,QAAQ,CAAC;AACPH,MAAAA,GADO;AAEPC,MAAAA;AAFO,KAAD,CAAR;AAID,GAPuB,EAQxB,CAACF,SAAD,EAAYI,QAAZ,CARwB,CAA1B;AAWA,SAAO,CAACzB,KAAD,EAAQ0B,iBAAR,CAAP;AACD,CAjCM","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"],"file":"useNumberMask.js"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.useStringMask = exports.getMask = exports.mergeMask = void 0;
|
|
7
5
|
|
|
8
6
|
var _react = require("react");
|
|
@@ -91,12 +89,12 @@ const useStringMask = (mask, defaultValue) => {
|
|
|
91
89
|
formatted
|
|
92
90
|
};
|
|
93
91
|
}, [mask]);
|
|
94
|
-
const [value, setValue] = (0, _react.useState)(applyMask(defaultValue
|
|
92
|
+
const [value, setValue] = (0, _react.useState)(applyMask(defaultValue == null ? void 0 : defaultValue.toString()));
|
|
95
93
|
const handleChangeValue = (0, _react.useCallback)(formattedValue => {
|
|
96
94
|
const {
|
|
97
95
|
raw,
|
|
98
96
|
formatted
|
|
99
|
-
} = applyMask(formattedValue
|
|
97
|
+
} = applyMask(formattedValue == null ? void 0 : formattedValue.toString());
|
|
100
98
|
setValue({
|
|
101
99
|
raw,
|
|
102
100
|
formatted
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/atoms/Input/hooks/useStringMask.ts"],"names":["mergeMask","value","mask","formatted","raw","iMask","iChars","length","maskChar","valueChar","rawValueChar","maskCharRegex","Array","isArray","matchRegex","RegExp","test","getMask","newValue","maskArray","regexArray","forEach","exp","push","i","useStringMask","defaultValue","applyMask","selectedMask","setValue","toString","handleChangeValue","formattedValue"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/atoms/Input/hooks/useStringMask.ts"],"names":["mergeMask","value","mask","formatted","raw","iMask","iChars","length","maskChar","valueChar","rawValueChar","maskCharRegex","Array","isArray","matchRegex","RegExp","test","getMask","newValue","maskArray","regexArray","forEach","exp","push","i","useStringMask","defaultValue","applyMask","selectedMask","setValue","toString","handleChangeValue","formattedValue"],"mappings":";;;;;AAAA;;AAeO,MAAMA,SAAS,GAAG,CAACC,KAAK,GAAG,EAAT,EAAaC,IAAb,KAA6C;AACpE,MAAIC,SAAS,GAAG,EAAhB;AACA,MAAIC,GAAG,GAAG,EAAV;AACA,MAAIC,KAAK,GAAG,CAAZ;AACA,MAAIC,MAAM,GAAG,CAAb;;AAEA,SAAO,EAAED,KAAK,KAAKH,IAAI,CAACK,MAAf,IAAyBD,MAAM,KAAKL,KAAK,CAACM,MAA5C,CAAP,EAA4D;AAC1D,UAAMC,QAAQ,GAAGN,IAAI,CAACG,KAAD,CAArB;AACA,UAAMI,SAAS,GAAGR,KAAK,CAACK,MAAD,CAAvB;;AAEA,QAAIE,QAAQ,KAAKC,SAAjB,EAA4B;AAC1BN,MAAAA,SAAS,IAAIK,QAAb;AACAF,MAAAA,M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PzB,MAAAA,GADO;AAEPD,MAAAA;AAFO,KAAD,CAAR;AAID,GAPuB,EAQxB,CAACwB,SAAD,EAAYE,QAAZ,CARwB,CAA1B;AAWA,SAAO,CAAC5B,KAAD,EAAQ8B,iBAAR,CAAP;AACD,CAjCM","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"],"file":"useStringMask.js"}
|
|
@@ -4,5 +4,6 @@ export * from './hooks/useNumberMask';
|
|
|
4
4
|
export * from './hooks/useStringMask';
|
|
5
5
|
export { default as InputContainer, InputContainerProps, InputVariantType, } from './InputContainer/InputContainer';
|
|
6
6
|
export { default as InputElement, InputElementProps, } from './InputElement/InputElement';
|
|
7
|
+
export { default as InputMaskElement, InputMaskElementProps, } from './InputMaskElement/InputMaskElement';
|
|
7
8
|
export { PressableInputContainer, PressableInputContainerProps, } from './PressableInputContainer';
|
|
8
9
|
export { StyledBorderKeeper, disabledInputStyles } from './styled';
|
|
@@ -1,95 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
var _exportNames = {
|
|
7
5
|
Hint: true,
|
|
8
6
|
InputContainer: true,
|
|
7
|
+
InputElement: true,
|
|
8
|
+
InputMaskElement: true,
|
|
9
9
|
InputContainerProps: true,
|
|
10
10
|
InputVariantType: true,
|
|
11
|
-
InputElement: true,
|
|
12
11
|
InputElementProps: true,
|
|
12
|
+
InputMaskElementProps: true,
|
|
13
13
|
PressableInputContainer: true,
|
|
14
14
|
PressableInputContainerProps: true,
|
|
15
15
|
StyledBorderKeeper: true,
|
|
16
16
|
disabledInputStyles: true
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _Hint.default;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "InputContainer", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _InputContainer.default;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "InputContainerProps", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _InputContainer.InputContainerProps;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "InputVariantType", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _InputContainer.InputVariantType;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "InputElement", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _InputElement.default;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "InputElementProps", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return _InputElement.InputElementProps;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "PressableInputContainer", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _PressableInputContainer.PressableInputContainer;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(exports, "PressableInputContainerProps", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function () {
|
|
63
|
-
return _PressableInputContainer.PressableInputContainerProps;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
Object.defineProperty(exports, "StyledBorderKeeper", {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function () {
|
|
69
|
-
return _styled.StyledBorderKeeper;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
Object.defineProperty(exports, "disabledInputStyles", {
|
|
73
|
-
enumerable: true,
|
|
74
|
-
get: function () {
|
|
75
|
-
return _styled.disabledInputStyles;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
18
|
+
exports.disabledInputStyles = exports.StyledBorderKeeper = exports.PressableInputContainerProps = exports.PressableInputContainer = exports.InputMaskElementProps = exports.InputElementProps = exports.InputVariantType = exports.InputContainerProps = exports.InputMaskElement = exports.InputElement = exports.InputContainer = exports.Hint = void 0;
|
|
78
19
|
|
|
79
20
|
var _Hint = _interopRequireDefault(require("./Hint"));
|
|
80
21
|
|
|
22
|
+
exports.Hint = _Hint.default;
|
|
23
|
+
|
|
81
24
|
var _useInputFocus = require("./hooks/useInputFocus");
|
|
82
25
|
|
|
83
26
|
Object.keys(_useInputFocus).forEach(function (key) {
|
|
84
27
|
if (key === "default" || key === "__esModule") return;
|
|
85
28
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
86
29
|
if (key in exports && exports[key] === _useInputFocus[key]) return;
|
|
87
|
-
|
|
88
|
-
enumerable: true,
|
|
89
|
-
get: function () {
|
|
90
|
-
return _useInputFocus[key];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
30
|
+
exports[key] = _useInputFocus[key];
|
|
93
31
|
});
|
|
94
32
|
|
|
95
33
|
var _useNumberMask = require("./hooks/useNumberMask");
|
|
@@ -98,12 +36,7 @@ Object.keys(_useNumberMask).forEach(function (key) {
|
|
|
98
36
|
if (key === "default" || key === "__esModule") return;
|
|
99
37
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
100
38
|
if (key in exports && exports[key] === _useNumberMask[key]) return;
|
|
101
|
-
|
|
102
|
-
enumerable: true,
|
|
103
|
-
get: function () {
|
|
104
|
-
return _useNumberMask[key];
|
|
105
|
-
}
|
|
106
|
-
});
|
|
39
|
+
exports[key] = _useNumberMask[key];
|
|
107
40
|
});
|
|
108
41
|
|
|
109
42
|
var _useStringMask = require("./hooks/useStringMask");
|
|
@@ -112,22 +45,35 @@ Object.keys(_useStringMask).forEach(function (key) {
|
|
|
112
45
|
if (key === "default" || key === "__esModule") return;
|
|
113
46
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
114
47
|
if (key in exports && exports[key] === _useStringMask[key]) return;
|
|
115
|
-
|
|
116
|
-
enumerable: true,
|
|
117
|
-
get: function () {
|
|
118
|
-
return _useStringMask[key];
|
|
119
|
-
}
|
|
120
|
-
});
|
|
48
|
+
exports[key] = _useStringMask[key];
|
|
121
49
|
});
|
|
122
50
|
|
|
123
51
|
var _InputContainer = _interopRequireWildcard(require("./InputContainer/InputContainer"));
|
|
124
52
|
|
|
53
|
+
exports.InputContainer = _InputContainer.default;
|
|
54
|
+
exports.InputContainerProps = _InputContainer.InputContainerProps;
|
|
55
|
+
exports.InputVariantType = _InputContainer.InputVariantType;
|
|
56
|
+
|
|
125
57
|
var _InputElement = _interopRequireWildcard(require("./InputElement/InputElement"));
|
|
126
58
|
|
|
59
|
+
exports.InputElement = _InputElement.default;
|
|
60
|
+
exports.InputElementProps = _InputElement.InputElementProps;
|
|
61
|
+
|
|
62
|
+
var _InputMaskElement = _interopRequireWildcard(require("./InputMaskElement/InputMaskElement"));
|
|
63
|
+
|
|
64
|
+
exports.InputMaskElement = _InputMaskElement.default;
|
|
65
|
+
exports.InputMaskElementProps = _InputMaskElement.InputMaskElementProps;
|
|
66
|
+
|
|
127
67
|
var _PressableInputContainer = require("./PressableInputContainer");
|
|
128
68
|
|
|
69
|
+
exports.PressableInputContainer = _PressableInputContainer.PressableInputContainer;
|
|
70
|
+
exports.PressableInputContainerProps = _PressableInputContainer.PressableInputContainerProps;
|
|
71
|
+
|
|
129
72
|
var _styled = require("./styled");
|
|
130
73
|
|
|
74
|
+
exports.StyledBorderKeeper = _styled.StyledBorderKeeper;
|
|
75
|
+
exports.disabledInputStyles = _styled.disabledInputStyles;
|
|
76
|
+
|
|
131
77
|
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); }
|
|
132
78
|
|
|
133
79
|
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/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Input/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;;;;;AAKA;;;;;AAIA;;;;;AAIA;;;;;AAIA","sourcesContent":["export { default as Hint } from './Hint';\nexport * from './hooks/useInputFocus';\nexport * from './hooks/useNumberMask';\nexport * from './hooks/useStringMask';\nexport {\n default as InputContainer,\n InputContainerProps,\n InputVariantType,\n} from './InputContainer/InputContainer';\nexport {\n default as InputElement,\n InputElementProps,\n} from './InputElement/InputElement';\nexport {\n default as InputMaskElement,\n InputMaskElementProps,\n} from './InputMaskElement/InputMaskElement';\nexport {\n PressableInputContainer,\n PressableInputContainerProps,\n} from './PressableInputContainer';\nexport { StyledBorderKeeper, disabledInputStyles } from './styled';\n"],"file":"index.js"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
6
4
|
exports.StyledHintIcon = exports.StyledHintContainer = exports.StyledInputElement = exports.StyledBorderKeeper = exports.StyledLabelContainer = exports.StyledInputElementBase = exports.StyledInputContainer = exports.StyledIconContent = exports.disabledInputStyles = void 0;
|
|
7
5
|
|
|
8
6
|
var _native = _interopRequireWildcard(require("@emotion/native"));
|
|
9
7
|
|
|
10
8
|
var _reactNative = require("react-native");
|
|
11
9
|
|
|
12
|
-
var
|
|
10
|
+
var _ResponsiveFontSize = require("../../../utils/ResponsiveFontSize");
|
|
13
11
|
|
|
14
12
|
var _Icon = require("../Icon");
|
|
15
13
|
|
|
@@ -41,7 +39,7 @@ const disabledInputStyles = ({
|
|
|
41
39
|
disabled,
|
|
42
40
|
theme
|
|
43
41
|
}) => disabled && (0, _native.css)`
|
|
44
|
-
color: ${theme
|
|
42
|
+
color: ${theme == null ? void 0 : theme.color.secondary.light};
|
|
45
43
|
`;
|
|
46
44
|
|
|
47
45
|
exports.disabledInputStyles = disabledInputStyles;
|
|
@@ -66,7 +64,7 @@ exports.StyledIconContent = StyledIconContent;
|
|
|
66
64
|
const StyledInputContainer = _native.default.View`
|
|
67
65
|
flex-direction: row;
|
|
68
66
|
align-items: center;
|
|
69
|
-
min-height: ${(0,
|
|
67
|
+
min-height: ${(0, _ResponsiveFontSize.RFValueStr)('44px')};
|
|
70
68
|
`;
|
|
71
69
|
exports.StyledInputContainer = StyledInputContainer;
|
|
72
70
|
const StyledInputElementBase = (0, _native.default)(_reactNative.TextInput)`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Input/styled.ts"],"names":["leftIconStyles","leftComponent","theme","spacing","centi","rightIconStyles","rightComponent","disabledContainerStyles","disabled","disabledInputStyles","color","secondary","light","focusedStyles","focused","borderColor","borderWidth","nano","dark","StyledIconContent","styled","View","zIndex","default","StyledInputContainer","StyledInputElementBase","TextInput","font","stack","typography","base","fontSize","weight","bold","StyledLabelContainer","props","micro","StyledBorderKeeperBase","miscellaneous","surfaceColor","borderColorGradation","borderRadius","mili","pico","StyledBorderKeeper","StyledInputElement","StyledHintContainer","StyledHintIcon","Icon"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Input/styled.ts"],"names":["leftIconStyles","leftComponent","theme","spacing","centi","rightIconStyles","rightComponent","disabledContainerStyles","disabled","disabledInputStyles","color","secondary","light","focusedStyles","focused","borderColor","borderWidth","nano","dark","StyledIconContent","styled","View","zIndex","default","StyledInputContainer","StyledInputElementBase","TextInput","font","stack","typography","base","fontSize","weight","bold","StyledLabelContainer","props","micro","StyledBorderKeeperBase","miscellaneous","surfaceColor","borderColorGradation","borderRadius","mili","pico","StyledBorderKeeper","StyledInputElement","StyledHintContainer","StyledHintIcon","Icon"],"mappings":";;;;;AAAA;;AACA;;AAGA;;AACA;;;;;;AAGA,MAAMA,cAAc,GAAG,CAAC;AACtBC,EAAAA,aADsB;AAEtBC,EAAAA;AAFsB,CAAD,KAIrB,CAACD,aAAD,IACA,gBAAI;AACN,oBAAoBC,KAAK,CAACC,OAAN,CAAcC,KAAM;AACxC,GAPA;;AASA,MAAMC,eAAe,GAAG,CAAC;AACvBC,EAAAA,cADuB;AAEvBJ,EAAAA;AAFuB,CAAD,KAItB,CAACI,cAAD,IACA,gBAAI;AACN,qBAAqBJ,KAAK,CAACC,OAAN,CAAcC,KAAM;AACzC,GAPA;;AASA,MAAMG,uBAAuB,GAAG,CAAC;AAC/BC,EAAAA;AAD+B,CAAD,KAG9BA,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JO;;AAMA,MAAMW,cAAc,GAAG,qBAAOC,UAAP,CAAkC;AAChE,kBAAkB,CAAC;AAAE9C,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAciC,KAAM;AACrD,CAFO","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 { Icon } from '../Icon';\nimport { InputContainerProps } from './InputContainer/InputContainer';\n\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 ${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"],"file":"styled.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Paper/Paper.tsx"],"names":["Paper","children","elevated","rest"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Paper/Paper.tsx"],"names":["Paper","children","elevated","rest"],"mappings":";;;;;AAAA;;AAEA;;;;;;AAQA,MAAMA,KAAqB,GAAG,CAAC;AAC7BC,EAAAA,QAD6B;AAE7BC,EAAAA,QAAQ,GAAG,KAFkB;AAG7B,KAAGC;AAH0B,CAAD,KAK5B,6BAAC,mBAAD,eAAiBA,IAAjB;AAAuB,EAAA,QAAQ,EAAED;AAAjC,IACGD,QADH,CALF;;eAUeD,K","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"],"file":"Paper.js"}
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Paper", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _Paper.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "PaperProps", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _Paper.PaperProps;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.PaperProps = exports.Paper = void 0;
|
|
18
5
|
|
|
19
6
|
var _Paper = _interopRequireWildcard(require("./Paper"));
|
|
20
7
|
|
|
8
|
+
exports.Paper = _Paper.default;
|
|
9
|
+
exports.PaperProps = _Paper.PaperProps;
|
|
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/Paper/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Paper/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export { default as Paper, PaperProps } from './Paper';\n"],"file":"index.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Paper/styled.ts"],"names":["StyledPaper","Animated","View","props"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Paper/styled.ts"],"names":["StyledPaper","Animated","View","props"],"mappings":";;;;;AAAA;;AACA;;AAGA;;;;;;AAEO,MAAMA,WAAW,GAAG,qBAAOC,sBAASC,IAAhB,EAGzBC,KAAK,IAAI,gBAAI;AACf,MAAM,8BAAWA,KAAX,CAAkB;AACxB,MAAM,kCAAeA,KAAf,CAAsB;AAC5B,GAN2B,CAApB","sourcesContent":["import { Animated } from 'react-native';\nimport styled, { css } from '@emotion/native';\nimport { StyleProps } from '@tecsinapse/react-core';\nimport { PaperProps } from './Paper';\nimport { baseStyles, elevatedStyles } from '../shared/PaperAndCard';\n\nexport const StyledPaper = styled(Animated.View)<\n PaperProps & Partial<StyleProps>\n>(\n props => css`\n ${baseStyles(props)}\n ${elevatedStyles(props)}\n `\n);\n"],"file":"styled.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/PressableSurface/PressableSurface.tsx"],"names":["COLOR_VARIATION_FACTOR","PressableSurface","children","surfaceColor","effect","effectIntensity","effectStyle","style","rest","theme","effectBaseColor","miscellaneous","bgColor","readyStyle","prepareStyle","props","effectColor","lighten","darken","composedStyle","backgroundColor","pressed","applyEffectStyle","variation"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/PressableSurface/PressableSurface.tsx"],"names":["COLOR_VARIATION_FACTOR","PressableSurface","children","surfaceColor","effect","effectIntensity","effectStyle","style","rest","theme","effectBaseColor","miscellaneous","bgColor","readyStyle","prepareStyle","props","effectColor","lighten","darken","composedStyle","backgroundColor","pressed","applyEffectStyle","variation"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAEA;;;;;;AAEA,MAAMA,sBAAsB,GAAG,EAA/B;;AASA,MAAMC,gBAA2C,GAAG,CAAC;AACnDC,EAAAA,QADmD;AAEnDC,EAAAA,YAFmD;AAGnDC,EAAAA,MAHmD;AAInDC,EAAAA,eAJmD;AAKnDC,EAAAA,WALmD;AAMnDC,EAAAA,KANmD;AAOnD,KAAGC;AAPgD,CAAD,KAQ9C;AACJ,QAAMC,KAAK,GAAG,sBAAd;AACA,MAAIC,eAAe,GAAGD,KAAK,CAACE,aAAN,CAAoBR,YAA1C;AACA,MAAIS,OAAO,GAAG,aAAd;;AAEA,MAAIT,YAAJ,EAAkB;AAChBO,IAAAA,eAAe,GAAGP,YAAlB;AACAS,IAAAA,OAAO,GAAGF,eAAV;AACD;;AAED,QAAMG,UAAU,GAAGC,YAAY,CAC7B;AAAEV,IAAAA,MAAF;AAAUC,IAAAA,eAAV;AAA2BE,IAAAA,KAA3B;AAAkCD,IAAAA;AAAlC,GAD6B,EAE7BI,eAF6B,EAG7BE,OAH6B,CAA/B;AAKA,SACE,8BAAC,sBAAD,eAAeJ,IAAf;AAAqB,IAAA,KAAK,EAAEK;AAA5B,MACGX,QADH,CADF;AAKD,CA5BD;;AA8BA,MAAMY,YAAY,GAAG,CACnBC,KADmB,EAEnBC,WAFmB,EAGnBJ,OAHmB,KAIX;AACR,QAAM;AACJR,IAAAA,MAAM,GAAG,QADL;AAEJC,IAAAA,eAAe,GAAGL,sBAFd;AAGJO,IAAAA,KAHI;AAIJD,IAAAA;AAJI,MAKFS,KALJ;AAOA,QAAME,OAAO,GAAG,+BAAmBD,WAAnB,EAAgCX,eAAhC,CAAhB;AACA,QAAMa,MAAM,GAAG,+BAAmBF,WAAnB,EAAgC,CAACX,eAAjC,CAAf;AACA,QAAMc,aAAa,GAAG,CAAC;AAAEC,IAAAA,eAAe,EAAER;AAAnB,GAAD,EAA+BL,KAA/B,CAAtB;;AAEA,MAAID,WAAJ,EAAiB;AACf,WAAO,CAAC;AAAEe,MAAAA;AAAF,KAAD,KAAiB,CAACF,aAAD,EAAgBb,WAAW,CAACe,OAAD,CAA3B,CAAxB;AACD;;AAED,UAAQjB,MAAR;AACE,SAAK,QAAL;AACE,aAAOkB,gBAAgB,CAACH,aAAD,EAAgBD,MAAhB,CAAvB;;AAEF,SAAK,SAAL;AACE,aAAOI,gBAAgB,CAACH,aAAD,EAAgBF,OAAhB,CAAvB;;AAEF,SAAK,MAAL;AACE,aAAOE,aAAP;AARJ;AAUD,CA9BD;;AAgCA,MAAMG,gBAAgB,GAAG,CAACf,KAAD,EAAagB,SAAb,KAAmC;AAC1D,SAAO,CAAC;AAAEF,IAAAA;AAAF,GAAD,KAAiB,CAACd,KAAD,EAAQc,OAAO,IAAI;AAAED,IAAAA,eAAe,EAAEG;AAAnB,GAAnB,CAAxB;AACD,CAFD;;eAIetB,gB","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"],"file":"PressableSurface.js"}
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "PressableSurface", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _PressableSurface.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "PressableSurfaceProps", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _PressableSurface.PressableSurfaceProps;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.PressableSurfaceProps = exports.PressableSurface = void 0;
|
|
18
5
|
|
|
19
6
|
var _PressableSurface = _interopRequireWildcard(require("./PressableSurface"));
|
|
20
7
|
|
|
8
|
+
exports.PressableSurface = _PressableSurface.default;
|
|
9
|
+
exports.PressableSurfaceProps = _PressableSurface.PressableSurfaceProps;
|
|
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/PressableSurface/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/PressableSurface/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export {\n default as PressableSurface,\n PressableSurfaceProps,\n} from './PressableSurface';\n"],"file":"index.js"}
|
|
@@ -1,8 +1,6 @@
|
|
|
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");
|
|
@@ -31,13 +29,13 @@ const ProgressBar = ({
|
|
|
31
29
|
...rest
|
|
32
30
|
}) => {
|
|
33
31
|
const theme = (0, _react.useTheme)();
|
|
32
|
+
const animationValue = React.useRef(new _reactNative.Animated.Value(0)).current;
|
|
34
33
|
const valueNow = typeof _valueNow === 'string' ? (0, _utils.extractNumbersFromString)(_valueNow) : _valueNow;
|
|
35
34
|
const totalProgress = (valueNow - valueMin) / (valueMax - valueMin) * 100;
|
|
36
35
|
const segments = Math.max(1, _segments);
|
|
37
36
|
const segmentWidth = 100 / Math.max(segments);
|
|
38
37
|
const items = [...Array(segments).keys()];
|
|
39
38
|
const segmentsRender = items.map(index => {
|
|
40
|
-
const animationValue = React.useRef(new _reactNative.Animated.Value(0)).current;
|
|
41
39
|
const max = segmentWidth * (index + 1);
|
|
42
40
|
const min = segmentWidth * index;
|
|
43
41
|
const minmax = (totalProgress - min) / (max - min);
|
|
@@ -45,8 +43,6 @@ const ProgressBar = ({
|
|
|
45
43
|
let progressPercent = `${width}%`;
|
|
46
44
|
|
|
47
45
|
if (animate && animationParameters) {
|
|
48
|
-
var _animationValue$inter;
|
|
49
|
-
|
|
50
46
|
_reactNative.Animated.timing(animationValue, {
|
|
51
47
|
toValue: 1,
|
|
52
48
|
duration: animationParameters.duration / items.length,
|
|
@@ -54,8 +50,8 @@ const ProgressBar = ({
|
|
|
54
50
|
delay: animationParameters.direction === 'right' ? index * (animationParameters.duration / items.length) : (items.length - index - 1) * (animationParameters.duration / items.length)
|
|
55
51
|
}).start();
|
|
56
52
|
|
|
57
|
-
const rangeAnimation = (animationParameters
|
|
58
|
-
progressPercent =
|
|
53
|
+
const rangeAnimation = (animationParameters == null ? void 0 : animationParameters.direction) === 'right' ? [`${valueMin < 0 ? 0 : valueMin}%`, `${width}%`] : [`${valueMax}%`, `${width}%`];
|
|
54
|
+
progressPercent = animationValue.interpolate == null ? void 0 : animationValue.interpolate({
|
|
59
55
|
inputRange: [0, 1],
|
|
60
56
|
outputRange: rangeAnimation
|
|
61
57
|
});
|