@tecsinapse/react-native-kit 1.16.2 → 1.17.2
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 +34 -0
- package/dist/components/atoms/Input/Input.js +6 -1
- package/dist/components/atoms/Input/Input.js.map +1 -1
- package/dist/components/atoms/InputMask/InputMask.d.ts +8 -0
- package/dist/components/atoms/InputMask/InputMask.js +92 -0
- package/dist/components/atoms/InputMask/InputMask.js.map +1 -0
- package/dist/components/atoms/InputMask/index.d.ts +1 -0
- package/dist/components/atoms/InputMask/index.js +14 -0
- package/dist/components/atoms/InputMask/index.js.map +1 -0
- package/dist/components/atoms/InputMask/styled.d.ts +5 -0
- package/dist/components/atoms/InputMask/styled.js +27 -0
- package/dist/components/atoms/InputMask/styled.js.map +1 -0
- package/dist/components/atoms/Modal/ModalLifecycleHandler.d.ts +1 -0
- package/dist/components/atoms/Modal/ModalLifecycleHandler.js +10 -4
- package/dist/components/atoms/Modal/ModalLifecycleHandler.js.map +1 -1
- package/dist/components/atoms/Modal/index.d.ts +1 -0
- package/dist/components/atoms/Modal/index.js +8 -0
- package/dist/components/atoms/Modal/index.js.map +1 -1
- package/dist/components/atoms/Modal/useLazyModalManager.d.ts +1 -1
- package/dist/components/atoms/Modal/useLazyModalManager.js +2 -2
- package/dist/components/atoms/Modal/useLazyModalManager.js.map +1 -1
- package/dist/components/atoms/Modal/useModalManager.d.ts +1 -1
- package/dist/components/atoms/Modal/useModalManager.js +2 -2
- package/dist/components/atoms/Modal/useModalManager.js.map +1 -1
- package/dist/components/atoms/Modal/useModalRemoteControl.d.ts +4 -0
- package/dist/components/atoms/Modal/useModalRemoteControl.js +24 -0
- package/dist/components/atoms/Modal/useModalRemoteControl.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/atoms/Input/Input.tsx +7 -1
- package/src/components/atoms/InputMask/InputMask.tsx +102 -0
- package/src/components/atoms/InputMask/index.ts +1 -0
- package/src/components/atoms/InputMask/styled.ts +25 -0
- package/src/components/atoms/Modal/ModalLifecycleHandler.ts +15 -4
- package/src/components/atoms/Modal/index.ts +2 -1
- package/src/components/atoms/Modal/useLazyModalManager.ts +2 -2
- package/src/components/atoms/Modal/useModalManager.ts +2 -2
- package/src/components/atoms/Modal/useModalRemoteControl.ts +26 -0
- package/src/index.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,40 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.17.2](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.17.1...@tecsinapse/react-native-kit@1.17.2) (2022-05-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* error render, added ternary ([#163902](https://github.com/tecsinapse/design-system/issues/163902)) ([fd52d5c](https://github.com/tecsinapse/design-system/commit/fd52d5cfe7ca7f56c0b721ad17d8bac589295bf5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.17.1](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.17.0...@tecsinapse/react-native-kit@1.17.1) (2022-05-13)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* standardizing input label and placeholder ([#163902](https://github.com/tecsinapse/design-system/issues/163902)) ([225a57b](https://github.com/tecsinapse/design-system/commit/225a57b8c5f8b6a7ae1058a56590a3f0dd294d55))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# [1.17.0](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.16.2...@tecsinapse/react-native-kit@1.17.0) (2022-05-10)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* inputMask accepting undefined. ([6037162](https://github.com/tecsinapse/design-system/commit/6037162a564c118c8faed8359418ff7eda6d1645))
|
|
34
|
+
* updating skeleton from master. ([9904009](https://github.com/tecsinapse/design-system/commit/990400938c3eb92c78ab60277971726b64410515))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
6
40
|
## [1.16.2](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.16.1...@tecsinapse/react-native-kit@1.16.2) (2022-04-21)
|
|
7
41
|
|
|
8
42
|
|
|
@@ -39,6 +39,8 @@ const Input = _react.default.forwardRef(({
|
|
|
39
39
|
hint,
|
|
40
40
|
onFocus,
|
|
41
41
|
onBlur,
|
|
42
|
+
value,
|
|
43
|
+
placeholder,
|
|
42
44
|
...rest
|
|
43
45
|
}, ref) => {
|
|
44
46
|
const _hint = hintComponent || _react.default.createElement(_reactCore.Hint, {
|
|
@@ -52,10 +54,11 @@ const Input = _react.default.forwardRef(({
|
|
|
52
54
|
handleBlur,
|
|
53
55
|
handleFocus
|
|
54
56
|
} = (0, _reactCore.useInputFocus)(onFocus, onBlur, !disabled);
|
|
57
|
+
const onlyLabel = label && !placeholder;
|
|
55
58
|
return _react.default.createElement(_reactNative.View, {
|
|
56
59
|
style: style
|
|
57
60
|
}, _react.default.createElement(_styled.StyledInputContainer, {
|
|
58
|
-
label: label,
|
|
61
|
+
label: value ? label : undefined,
|
|
59
62
|
labelColor: labelColor,
|
|
60
63
|
labelColorVariant: labelColorVariant,
|
|
61
64
|
labelColorTone: labelColorTone,
|
|
@@ -72,6 +75,8 @@ const Input = _react.default.forwardRef(({
|
|
|
72
75
|
disabled: disabled,
|
|
73
76
|
variant: variant
|
|
74
77
|
}, _react.default.createElement(_styled.StyledNativeInput, _extends({}, rest, {
|
|
78
|
+
placeholder: onlyLabel ? label : placeholder,
|
|
79
|
+
value: value,
|
|
75
80
|
ref: ref,
|
|
76
81
|
fontStack: inputFontStack,
|
|
77
82
|
fontWeight: inputFontWeight,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Input/Input.tsx"],"names":["Input","React","forwardRef","label","labelColor","labelColorVariant","labelColorTone","labelTypography","labelStack","labelWeight","leftComponent","rightComponent","disabled","style","borderColor","borderColorGradation","inputFontStack","inputFontWeight","inputContainerStyle","variant","hintComponent","hint","onFocus","onBlur","rest","ref","_hint","Text","focused","handleBlur","handleFocus","displayName"],"mappings":";;;;;AAAA;;AAQA;;AACA;;AACA;;AACA;;;;;;AASA,MAAMA,KAA2B,GAAGC,eAAMC,UAAN,CAClC,CACE;AACEC,EAAAA,KADF;AAEEC,EAAAA,UAFF;AAGEC,EAAAA,iBAHF;AAIEC,EAAAA,cAJF;AAKEC,EAAAA,eALF;AAMEC,EAAAA,UANF;AAOEC,EAAAA,WAPF;AAQEC,EAAAA,aARF;AASEC,EAAAA,cATF;AAUEC,EAAAA,QAVF;AAWEC,EAAAA,KAXF;AAYEC,EAAAA,WAZF;AAaEC,EAAAA,oBAbF;AAcEC,EAAAA,cAAc,GAAG,SAdnB;AAeEC,EAAAA,eAAe,GAAG,MAfpB;AAgBEC,EAAAA,mBAhBF;AAiBEC,EAAAA,OAAO,GAAG,SAjBZ;AAkBEC,EAAAA,aAlBF;AAmBEC,EAAAA,IAnBF;AAoBEC,EAAAA,OApBF;AAqBEC,EAAAA,MArBF;
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Input/Input.tsx"],"names":["Input","React","forwardRef","label","labelColor","labelColorVariant","labelColorTone","labelTypography","labelStack","labelWeight","leftComponent","rightComponent","disabled","style","borderColor","borderColorGradation","inputFontStack","inputFontWeight","inputContainerStyle","variant","hintComponent","hint","onFocus","onBlur","value","placeholder","rest","ref","_hint","Text","focused","handleBlur","handleFocus","onlyLabel","undefined","displayName"],"mappings":";;;;;AAAA;;AAQA;;AACA;;AACA;;AACA;;;;;;AASA,MAAMA,KAA2B,GAAGC,eAAMC,UAAN,CAClC,CACE;AACEC,EAAAA,KADF;AAEEC,EAAAA,UAFF;AAGEC,EAAAA,iBAHF;AAIEC,EAAAA,cAJF;AAKEC,EAAAA,eALF;AAMEC,EAAAA,UANF;AAOEC,EAAAA,WAPF;AAQEC,EAAAA,aARF;AASEC,EAAAA,cATF;AAUEC,EAAAA,QAVF;AAWEC,EAAAA,KAXF;AAYEC,EAAAA,WAZF;AAaEC,EAAAA,oBAbF;AAcEC,EAAAA,cAAc,GAAG,SAdnB;AAeEC,EAAAA,eAAe,GAAG,MAfpB;AAgBEC,EAAAA,mBAhBF;AAiBEC,EAAAA,OAAO,GAAG,SAjBZ;AAkBEC,EAAAA,aAlBF;AAmBEC,EAAAA,IAnBF;AAoBEC,EAAAA,OApBF;AAqBEC,EAAAA,MArBF;AAsBEC,EAAAA,KAtBF;AAuBEC,EAAAA,WAvBF;AAwBE,KAAGC;AAxBL,CADF,EA2BEC,GA3BF,KA4BK;AACH,QAAMC,KAAK,GAAGR,aAAa,IACzB,6BAAC,eAAD;AAAM,IAAA,aAAa,EAAES,UAArB;AAA2B,IAAA,IAAI,EAAER,IAAjC;AAAuC,IAAA,OAAO,EAAEF;AAAhD,IADF;;AAGA,QAAM;AAAEW,IAAAA,OAAF;AAAWC,IAAAA,UAAX;AAAuBC,IAAAA;AAAvB,MAAuC,8BAC3CV,OAD2C,EAE3CC,MAF2C,EAG3C,CAACX,QAH0C,CAA7C;AAMA,QAAMqB,SAAS,GAAG9B,KAAK,IAAI,CAACsB,WAA5B;AAEA,SACE,6BAAC,iBAAD;AAAM,IAAA,KAAK,EAAEZ;AAAb,KACE,6BAAC,4BAAD;AACE,IAAA,KAAK,EAAEW,KAAK,GAAGrB,KAAH,GAAW+B,SADzB;AAEE,IAAA,UAAU,EAAE9B,UAFd;AAGE,IAAA,iBAAiB,EAAEC,iBAHrB;AAIE,IAAA,cAAc,EAAEC,cAJlB;AAKE,IAAA,eAAe,EAAEC,eALnB;AAME,IAAA,UAAU,EAAEC,UANd;AAOE,IAAA,WAAW,EAAEC,WAPf;AAQE,IAAA,cAAc,EAAEoB,UARlB;AASE,IAAA,aAAa,EAAEnB,aATjB;AAUE,IAAA,cAAc,EAAEC,cAVlB;AAWE,IAAA,WAAW,EAAEG,WAXf;AAYE,IAAA,oBAAoB,EAAEC,oBAZxB;AAaE,IAAA,mBAAmB,EAAEG,mBAbvB;AAcE,IAAA,OAAO,EAAEY,OAdX;AAeE,IAAA,QAAQ,EAAElB,QAfZ;AAgBE,IAAA,OAAO,EAAEO;AAhBX,KAkBE,6BAAC,yBAAD,eACMO,IADN;AAEE,IAAA,WAAW,EAAEO,SAAS,GAAG9B,KAAH,GAAWsB,WAFnC;AAGE,IAAA,KAAK,EAAED,KAHT;AAIE,IAAA,GAAG,EAAEG,GAJP;AAKE,IAAA,SAAS,EAAEX,cALb;AAME,IAAA,UAAU,EAAEC,eANd;AAOE,IAAA,QAAQ,EAAEL,QAPZ;AAQE,IAAA,OAAO,EAAEoB,WARX;AASE,IAAA,MAAM,EAAED;AATV,KAlBF,CADF,EA+BGV,IAAI,IAAIO,KA/BX,CADF;AAmCD,CA5EiC,CAApC;;AA+EA5B,KAAK,CAACmC,WAAN,GAAoB,OAApB;eAEenC,K","sourcesContent":["import {\n FontStackType,\n FontWeightType,\n Hint,\n InputContainerProps,\n InputElementProps,\n useInputFocus,\n} from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\nimport { View } from 'react-native';\nimport { Text } from '../Text';\nimport { StyledInputContainer, StyledNativeInput } from './styled';\n\nexport interface InputNativeProps\n extends Omit<InputElementProps, 'style'>,\n InputContainerProps {\n inputFontStack?: FontStackType;\n inputFontWeight?: FontWeightType;\n}\n\nconst Input: FC<InputNativeProps> = React.forwardRef(\n (\n {\n label,\n labelColor,\n labelColorVariant,\n labelColorTone,\n labelTypography,\n labelStack,\n labelWeight,\n leftComponent,\n rightComponent,\n disabled,\n style,\n borderColor,\n borderColorGradation,\n inputFontStack = 'default',\n inputFontWeight = 'bold',\n inputContainerStyle,\n variant = 'default',\n hintComponent,\n hint,\n onFocus,\n onBlur,\n value,\n placeholder,\n ...rest\n },\n ref\n ) => {\n const _hint = hintComponent || (\n <Hint TextComponent={Text} text={hint} variant={variant} />\n );\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n const onlyLabel = label && !placeholder;\n\n return (\n <View style={style}>\n <StyledInputContainer\n label={value ? label : undefined}\n labelColor={labelColor}\n labelColorVariant={labelColorVariant}\n labelColorTone={labelColorTone}\n labelTypography={labelTypography}\n labelStack={labelStack}\n labelWeight={labelWeight}\n LabelComponent={Text}\n leftComponent={leftComponent}\n rightComponent={rightComponent}\n borderColor={borderColor}\n borderColorGradation={borderColorGradation}\n inputContainerStyle={inputContainerStyle}\n focused={focused}\n disabled={disabled}\n variant={variant}\n >\n <StyledNativeInput\n {...rest}\n placeholder={onlyLabel ? label : placeholder}\n value={value}\n ref={ref}\n fontStack={inputFontStack}\n fontWeight={inputFontWeight}\n disabled={disabled}\n onFocus={handleFocus}\n onBlur={handleBlur}\n />\n </StyledInputContainer>\n {hint && _hint}\n </View>\n );\n }\n);\n\nInput.displayName = 'Input';\n\nexport default Input;\n"],"file":"Input.js"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FontStackType, FontWeightType, InputContainerProps, InputMaskElementProps } from '@tecsinapse/react-core';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
export interface InputMaskNativeProps extends Omit<InputMaskElementProps, 'style'>, InputContainerProps {
|
|
4
|
+
inputFontStack?: FontStackType;
|
|
5
|
+
inputFontWeight?: FontWeightType;
|
|
6
|
+
}
|
|
7
|
+
declare const InputMask: FC<InputMaskNativeProps>;
|
|
8
|
+
export default InputMask;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
|
|
6
|
+
var _reactCore = require("@tecsinapse/react-core");
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _styled = require("./styled");
|
|
13
|
+
|
|
14
|
+
var _Text = require("../Text");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
const InputMask = _react.default.forwardRef(({
|
|
21
|
+
label,
|
|
22
|
+
labelColor,
|
|
23
|
+
labelColorVariant,
|
|
24
|
+
labelColorTone,
|
|
25
|
+
labelTypography,
|
|
26
|
+
labelStack,
|
|
27
|
+
labelWeight,
|
|
28
|
+
leftComponent,
|
|
29
|
+
rightComponent,
|
|
30
|
+
disabled,
|
|
31
|
+
style,
|
|
32
|
+
borderColor,
|
|
33
|
+
borderColorGradation,
|
|
34
|
+
inputFontStack = 'default',
|
|
35
|
+
inputFontWeight = 'bold',
|
|
36
|
+
inputContainerStyle,
|
|
37
|
+
variant = 'default',
|
|
38
|
+
hintComponent,
|
|
39
|
+
hint,
|
|
40
|
+
onFocus,
|
|
41
|
+
onBlur,
|
|
42
|
+
value,
|
|
43
|
+
placeholder,
|
|
44
|
+
...rest
|
|
45
|
+
}, ref) => {
|
|
46
|
+
const _hint = hintComponent || _react.default.createElement(_reactCore.Hint, {
|
|
47
|
+
TextComponent: _Text.Text,
|
|
48
|
+
text: hint,
|
|
49
|
+
variant: variant
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const {
|
|
53
|
+
focused,
|
|
54
|
+
handleBlur,
|
|
55
|
+
handleFocus
|
|
56
|
+
} = (0, _reactCore.useInputFocus)(onFocus, onBlur, !disabled);
|
|
57
|
+
const onlyLabel = label && !placeholder;
|
|
58
|
+
return _react.default.createElement(_reactNative.View, {
|
|
59
|
+
style: style
|
|
60
|
+
}, _react.default.createElement(_styled.StyledInputContainer, {
|
|
61
|
+
label: String(value) ? label : undefined,
|
|
62
|
+
labelColor: labelColor,
|
|
63
|
+
labelColorVariant: labelColorVariant,
|
|
64
|
+
labelColorTone: labelColorTone,
|
|
65
|
+
labelTypography: labelTypography,
|
|
66
|
+
labelStack: labelStack,
|
|
67
|
+
labelWeight: labelWeight,
|
|
68
|
+
LabelComponent: _Text.Text,
|
|
69
|
+
leftComponent: leftComponent,
|
|
70
|
+
rightComponent: rightComponent,
|
|
71
|
+
borderColor: borderColor,
|
|
72
|
+
borderColorGradation: borderColorGradation,
|
|
73
|
+
inputContainerStyle: inputContainerStyle,
|
|
74
|
+
focused: focused,
|
|
75
|
+
disabled: disabled,
|
|
76
|
+
variant: variant
|
|
77
|
+
}, _react.default.createElement(_styled.StyledNativeInputMask, _extends({}, rest, {
|
|
78
|
+
placeholder: onlyLabel ? label : placeholder,
|
|
79
|
+
value: value,
|
|
80
|
+
ref: ref,
|
|
81
|
+
fontStack: inputFontStack,
|
|
82
|
+
fontWeight: inputFontWeight,
|
|
83
|
+
disabled: disabled,
|
|
84
|
+
onFocus: handleFocus,
|
|
85
|
+
onBlur: handleBlur
|
|
86
|
+
}))), hint && _hint);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
InputMask.displayName = 'InputMask';
|
|
90
|
+
var _default = InputMask;
|
|
91
|
+
exports.default = _default;
|
|
92
|
+
//# sourceMappingURL=InputMask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/InputMask/InputMask.tsx"],"names":["InputMask","React","forwardRef","label","labelColor","labelColorVariant","labelColorTone","labelTypography","labelStack","labelWeight","leftComponent","rightComponent","disabled","style","borderColor","borderColorGradation","inputFontStack","inputFontWeight","inputContainerStyle","variant","hintComponent","hint","onFocus","onBlur","value","placeholder","rest","ref","_hint","Text","focused","handleBlur","handleFocus","onlyLabel","String","undefined","displayName"],"mappings":";;;;;AAAA;;AAQA;;AACA;;AACA;;AACA;;;;;;AASA,MAAMA,SAAmC,GAAGC,eAAMC,UAAN,CAC1C,CACE;AACEC,EAAAA,KADF;AAEEC,EAAAA,UAFF;AAGEC,EAAAA,iBAHF;AAIEC,EAAAA,cAJF;AAKEC,EAAAA,eALF;AAMEC,EAAAA,UANF;AAOEC,EAAAA,WAPF;AAQEC,EAAAA,aARF;AASEC,EAAAA,cATF;AAUEC,EAAAA,QAVF;AAWEC,EAAAA,KAXF;AAYEC,EAAAA,WAZF;AAaEC,EAAAA,oBAbF;AAcEC,EAAAA,cAAc,GAAG,SAdnB;AAeEC,EAAAA,eAAe,GAAG,MAfpB;AAgBEC,EAAAA,mBAhBF;AAiBEC,EAAAA,OAAO,GAAG,SAjBZ;AAkBEC,EAAAA,aAlBF;AAmBEC,EAAAA,IAnBF;AAoBEC,EAAAA,OApBF;AAqBEC,EAAAA,MArBF;AAsBEC,EAAAA,KAtBF;AAuBEC,EAAAA,WAvBF;AAwBE,KAAGC;AAxBL,CADF,EA2BEC,GA3BF,KA4BK;AACH,QAAMC,KAAK,GAAGR,aAAa,IACzB,6BAAC,eAAD;AAAM,IAAA,aAAa,EAAES,UAArB;AAA2B,IAAA,IAAI,EAAER,IAAjC;AAAuC,IAAA,OAAO,EAAEF;AAAhD,IADF;;AAGA,QAAM;AAAEW,IAAAA,OAAF;AAAWC,IAAAA,UAAX;AAAuBC,IAAAA;AAAvB,MAAuC,8BAC3CV,OAD2C,EAE3CC,MAF2C,EAG3C,CAACX,QAH0C,CAA7C;AAMA,QAAMqB,SAAS,GAAG9B,KAAK,IAAI,CAACsB,WAA5B;AAEA,SACE,6BAAC,iBAAD;AAAM,IAAA,KAAK,EAAEZ;AAAb,KACE,6BAAC,4BAAD;AACE,IAAA,KAAK,EAAEqB,MAAM,CAACV,KAAD,CAAN,GAAgBrB,KAAhB,GAAwBgC,SADjC;AAEE,IAAA,UAAU,EAAE/B,UAFd;AAGE,IAAA,iBAAiB,EAAEC,iBAHrB;AAIE,IAAA,cAAc,EAAEC,cAJlB;AAKE,IAAA,eAAe,EAAEC,eALnB;AAME,IAAA,UAAU,EAAEC,UANd;AAOE,IAAA,WAAW,EAAEC,WAPf;AAQE,IAAA,cAAc,EAAEoB,UARlB;AASE,IAAA,aAAa,EAAEnB,aATjB;AAUE,IAAA,cAAc,EAAEC,cAVlB;AAWE,IAAA,WAAW,EAAEG,WAXf;AAYE,IAAA,oBAAoB,EAAEC,oBAZxB;AAaE,IAAA,mBAAmB,EAAEG,mBAbvB;AAcE,IAAA,OAAO,EAAEY,OAdX;AAeE,IAAA,QAAQ,EAAElB,QAfZ;AAgBE,IAAA,OAAO,EAAEO;AAhBX,KAkBE,6BAAC,6BAAD,eACMO,IADN;AAEE,IAAA,WAAW,EAAEO,SAAS,GAAG9B,KAAH,GAAWsB,WAFnC;AAGE,IAAA,KAAK,EAAED,KAHT;AAIE,IAAA,GAAG,EAAEG,GAJP;AAKE,IAAA,SAAS,EAAEX,cALb;AAME,IAAA,UAAU,EAAEC,eANd;AAOE,IAAA,QAAQ,EAAEL,QAPZ;AAQE,IAAA,OAAO,EAAEoB,WARX;AASE,IAAA,MAAM,EAAED;AATV,KAlBF,CADF,EA+BGV,IAAI,IAAIO,KA/BX,CADF;AAmCD,CA5EyC,CAA5C;;AA+EA5B,SAAS,CAACoC,WAAV,GAAwB,WAAxB;eAEepC,S","sourcesContent":["import {\n FontStackType,\n FontWeightType,\n Hint,\n InputContainerProps,\n InputMaskElementProps,\n useInputFocus,\n} from '@tecsinapse/react-core';\nimport React, { FC } from 'react';\nimport { View } from 'react-native';\nimport { StyledInputContainer, StyledNativeInputMask } from './styled';\nimport { Text } from '../Text';\n\nexport interface InputMaskNativeProps\n extends Omit<InputMaskElementProps, 'style'>,\n InputContainerProps {\n inputFontStack?: FontStackType;\n inputFontWeight?: FontWeightType;\n}\n\nconst InputMask: FC<InputMaskNativeProps> = React.forwardRef(\n (\n {\n label,\n labelColor,\n labelColorVariant,\n labelColorTone,\n labelTypography,\n labelStack,\n labelWeight,\n leftComponent,\n rightComponent,\n disabled,\n style,\n borderColor,\n borderColorGradation,\n inputFontStack = 'default',\n inputFontWeight = 'bold',\n inputContainerStyle,\n variant = 'default',\n hintComponent,\n hint,\n onFocus,\n onBlur,\n value,\n placeholder,\n ...rest\n },\n ref\n ) => {\n const _hint = hintComponent || (\n <Hint TextComponent={Text} text={hint} variant={variant} />\n );\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n const onlyLabel = label && !placeholder;\n\n return (\n <View style={style}>\n <StyledInputContainer\n label={String(value) ? label : undefined}\n labelColor={labelColor}\n labelColorVariant={labelColorVariant}\n labelColorTone={labelColorTone}\n labelTypography={labelTypography}\n labelStack={labelStack}\n labelWeight={labelWeight}\n LabelComponent={Text}\n leftComponent={leftComponent}\n rightComponent={rightComponent}\n borderColor={borderColor}\n borderColorGradation={borderColorGradation}\n inputContainerStyle={inputContainerStyle}\n focused={focused}\n disabled={disabled}\n variant={variant}\n >\n <StyledNativeInputMask\n {...rest}\n placeholder={onlyLabel ? label : placeholder}\n value={value}\n ref={ref}\n fontStack={inputFontStack}\n fontWeight={inputFontWeight}\n disabled={disabled}\n onFocus={handleFocus}\n onBlur={handleBlur}\n />\n </StyledInputContainer>\n {hint && _hint}\n </View>\n );\n }\n);\n\nInputMask.displayName = 'InputMask';\n\nexport default InputMask;\n"],"file":"InputMask.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as InputMask, InputMaskNativeProps } from './InputMask';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.InputMaskNativeProps = exports.InputMask = void 0;
|
|
5
|
+
|
|
6
|
+
var _InputMask = _interopRequireWildcard(require("./InputMask"));
|
|
7
|
+
|
|
8
|
+
exports.InputMask = _InputMask.default;
|
|
9
|
+
exports.InputMaskNativeProps = _InputMask.InputMaskNativeProps;
|
|
10
|
+
|
|
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); }
|
|
12
|
+
|
|
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; }
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/InputMask/index.ts"],"names":[],"mappings":";;;;;AAAA","sourcesContent":["export { default as InputMask, InputMaskNativeProps } from './InputMask';\n"],"file":"index.js"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledInputContainer: import("@emotion/native").StyledComponent<any, {}, {
|
|
3
|
+
ref?: import("react").Ref<any> | undefined;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const StyledNativeInputMask: import("@emotion/native").StyledComponent<any, {}, {}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.StyledNativeInputMask = exports.StyledInputContainer = void 0;
|
|
5
|
+
|
|
6
|
+
var _native = _interopRequireDefault(require("@emotion/native"));
|
|
7
|
+
|
|
8
|
+
var _reactCore = require("@tecsinapse/react-core");
|
|
9
|
+
|
|
10
|
+
var _styled = require("../Text/styled");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
const StyledInputContainer = (0, _native.default)(_reactCore.InputContainer)`
|
|
15
|
+
min-height: ${(0, _reactCore.RFValueStr)('50px')};
|
|
16
|
+
`;
|
|
17
|
+
exports.StyledInputContainer = StyledInputContainer;
|
|
18
|
+
const StyledNativeInputMaskBase = (0, _native.default)(_reactCore.InputMaskElement)`
|
|
19
|
+
height: ${({
|
|
20
|
+
theme
|
|
21
|
+
}) => theme.typography.h5.lineHeight};
|
|
22
|
+
width: 100%;
|
|
23
|
+
padding: 0;
|
|
24
|
+
`;
|
|
25
|
+
const StyledNativeInputMask = (0, _native.default)(StyledNativeInputMaskBase)(_styled.fontStyles);
|
|
26
|
+
exports.StyledNativeInputMask = StyledNativeInputMask;
|
|
27
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/InputMask/styled.ts"],"names":["StyledInputContainer","InputContainer","StyledNativeInputMaskBase","InputMaskElement","theme","typography","h5","lineHeight","StyledNativeInputMask","fontStyles"],"mappings":";;;;;AAAA;;AACA;;AAMA;;;;AAGO,MAAMA,oBAAoB,GAAG,qBAAOC,yBAAP,CAA4C;AAChF,gBAAgB,2BAAW,MAAX,CAAmB;AACnC,CAFO;;AAIP,MAAMC,yBAAyB,GAAG,qBAAOC,2BAAP,CAEhC;AACF,YAAY,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,UAAN,CAAiBC,EAAjB,CAAoBC,UAAW;AAC1D;AACA;AACA,CANA;AAQO,MAAMC,qBAAqB,GAAG,qBAAON,yBAAP,EAEnCO,kBAFmC,CAA9B","sourcesContent":["import styled from '@emotion/native';\nimport {\n InputContainer,\n InputMaskElement,\n RFValueStr,\n StyleProps,\n} from '@tecsinapse/react-core';\nimport { Font, fontStyles } from '../Text/styled';\nimport { InputMaskNativeProps } from './InputMask';\n\nexport const StyledInputContainer = styled(InputContainer)<Partial<StyleProps>>`\n min-height: ${RFValueStr('50px')};\n`;\n\nconst StyledNativeInputMaskBase = styled(InputMaskElement)<\n Partial<InputMaskNativeProps> & Partial<StyleProps>\n>`\n height: ${({ theme }) => theme.typography.h5.lineHeight};\n width: 100%;\n padding: 0;\n`;\n\nexport const StyledNativeInputMask = styled(StyledNativeInputMaskBase)<\n Font & Partial<InputMaskNativeProps> & Partial<StyleProps>\n>(fontStyles);\n"],"file":"styled.js"}
|
|
@@ -47,7 +47,7 @@ class ModalLifecycleHandler {
|
|
|
47
47
|
|
|
48
48
|
this.sync = (id, modal) => {
|
|
49
49
|
if (this.nodeGroup.has(id)) {
|
|
50
|
-
const savedNode = this.
|
|
50
|
+
const savedNode = this.findNode(id);
|
|
51
51
|
savedNode && this.nodeGroup.set(id, { ...savedNode,
|
|
52
52
|
modal
|
|
53
53
|
});
|
|
@@ -66,15 +66,21 @@ class ModalLifecycleHandler {
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
this.remove = id => {
|
|
69
|
-
const savedNode = this.
|
|
69
|
+
const savedNode = this.findNode(id);
|
|
70
70
|
savedNode && this.nodeGroup.set(id, { ...savedNode,
|
|
71
71
|
lastVisualization: undefined
|
|
72
72
|
});
|
|
73
73
|
this.update();
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
+
this.findNode = id => {
|
|
77
|
+
const node = this.nodeGroup.get(id);
|
|
78
|
+
!node && console.warn(`No modal was found with the id "${id}"`);
|
|
79
|
+
return node;
|
|
80
|
+
};
|
|
81
|
+
|
|
76
82
|
this.show = id => {
|
|
77
|
-
const savedNode = this.
|
|
83
|
+
const savedNode = this.findNode(id);
|
|
78
84
|
savedNode && this.nodeGroup.set(id, { ...savedNode,
|
|
79
85
|
visible: true,
|
|
80
86
|
lastVisualization: new Date()
|
|
@@ -83,7 +89,7 @@ class ModalLifecycleHandler {
|
|
|
83
89
|
};
|
|
84
90
|
|
|
85
91
|
this.close = id => {
|
|
86
|
-
const savedNode = this.
|
|
92
|
+
const savedNode = this.findNode(id);
|
|
87
93
|
savedNode && this.nodeGroup.set(id, { ...savedNode,
|
|
88
94
|
visible: false
|
|
89
95
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Modal/ModalLifecycleHandler.ts"],"names":["ModalLifecycleHandler","constructor","attach","state","update","requestAnimationFrame","nodes","Array","from","nodeGroup","values","filter","node","visible","lastVisualization","sort","nodeA","nodeB","getTime","map","index","filteredNodes","modalElement","modal","props","React","cloneElement","key","id","isLastShown","length","close","onClose","remove","updateState","render","modals","sync","has","savedNode","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Modal/ModalLifecycleHandler.ts"],"names":["ModalLifecycleHandler","constructor","attach","state","update","requestAnimationFrame","nodes","Array","from","nodeGroup","values","filter","node","visible","lastVisualization","sort","nodeA","nodeB","getTime","map","index","filteredNodes","modalElement","modal","props","React","cloneElement","key","id","isLastShown","length","close","onClose","remove","updateState","render","modals","sync","has","savedNode","findNode","set","destroy","delete","undefined","get","console","warn","show","Date","Map","createModalLifecycleHandler"],"mappings":"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","sourcesContent":["import React, { Dispatch, ReactElement } from \"react\"\nimport { IBaseModal } from \"./ui/types\"\n\n/**\n * It Represents a node (usually a modal component) in the modal's lifecycle handler.\n */\ninterface ModalNode {\n id: string\n visible?: boolean\n lastVisualization?: Date\n modal: () => ReactElement<IBaseModal>\n}\n\n/**\n * Manage all modal's lifecycle.\n */\nexport class ModalLifecycleHandler {\n \n nodeGroup: Map<string, ModalNode>\n state: [ReactElement<IBaseModal>[], Dispatch<ReactElement<IBaseModal>[]>] | undefined\n\n constructor() {\n this.nodeGroup = new Map()\n this.state = undefined\n }\n\n /**\n * Holds the ModalGroupManager state.\n * \n * @param state \n */\n public attach = (state: [ReactElement<IBaseModal>[], Dispatch<ReactElement<IBaseModal>[]>]) => {\n this.state = state\n }\n\n /**\n * Updates all the modal components.\n */\n public update = () => {\n requestAnimationFrame(() => {\n const nodes = Array.from(this.nodeGroup.values())\n .filter(node => node.visible || !!node.lastVisualization)\n .sort((nodeA, nodeB) => (nodeA.lastVisualization?.getTime() || 0) - (nodeB.lastVisualization?.getTime() || 0))\n .map((node, index, filteredNodes) => {\n let modalElement = node.modal()\n let { props } = modalElement\n return React.cloneElement(modalElement, {\n ...props,\n key: node.id,\n visible: node.visible,\n isLastShown: filteredNodes.length - 1 === index,\n close: () => this.close(node.id),\n onClose: () => {\n this.remove(node.id)\n props.onClose?.()\n }\n })\n })\n \n const [, updateState ] = this.state || []\n updateState?.(nodes)\n })\n }\n\n /**\n * Renders all selected modals.\n * \n * @returns \n */\n public render = (): ReactElement<IBaseModal>[] => {\n const [ modals ] = this.state || []\n return modals || []\n }\n\n /**\n * Tells to the lifecycle handler that a modal component needs to be handled.\n * \n * @param id \n * @param modal \n * @returns \n */\n public sync = (id: string, modal: () => ReactElement<IBaseModal>) => {\n if (this.nodeGroup.has(id)) {\n const savedNode = this.findNode(id)\n savedNode && this.nodeGroup.set(id, { ...savedNode, modal })\n return\n }\n this.nodeGroup.set(id, { id, modal })\n }\n\n /**\n * Destroy a modal from the lifecycle handler.\n * \n * @param id \n */\n public destroy = (id: string) => {\n this.nodeGroup.delete(id)\n this.update()\n }\n\n /**\n * Removes a modal from the rendering stack. It tells to the lifecycle handler that a modal \n * component is no longer used by the application.\n * \n * @param id \n */\n private remove = (id: string) => {\n const savedNode = this.findNode(id)\n savedNode && this.nodeGroup.set(id, { ...savedNode, lastVisualization: undefined })\n this.update()\n }\n\n /**\n * Find a modal node by id.\n * \n * @param id \n */\n private findNode = (id: string) => {\n const node = this.nodeGroup.get(id)\n !node && console.warn(`No modal was found with the id \"${id}\"`)\n return node\n }\n\n /**\n * Makes a modal appears.\n * \n * @param id \n */\n public show = (id: string) => {\n const savedNode = this.findNode(id)\n savedNode && this.nodeGroup.set(id, { ...savedNode, visible: true, lastVisualization: new Date() })\n this.update()\n }\n\n /**\n * Makes a modal disappears.\n * \n * @param id \n */\n public close = (id: string) => {\n const savedNode = this.findNode(id)\n savedNode && this.nodeGroup.set(id, { ...savedNode, visible: false })\n this.update()\n }\n}\n\n/**\n * Creates a new ModalLifecycleHandlere instance.\n * \n * @returns \n */\nexport const createModalLifecycleHandler = () => {\n return new ModalLifecycleHandler()\n}\n"],"file":"ModalLifecycleHandler.js"}
|
|
@@ -49,4 +49,12 @@ Object.keys(_useLazyModalManager).forEach(function (key) {
|
|
|
49
49
|
if (key in exports && exports[key] === _useLazyModalManager[key]) return;
|
|
50
50
|
exports[key] = _useLazyModalManager[key];
|
|
51
51
|
});
|
|
52
|
+
|
|
53
|
+
var _useModalRemoteControl = require("./useModalRemoteControl");
|
|
54
|
+
|
|
55
|
+
Object.keys(_useModalRemoteControl).forEach(function (key) {
|
|
56
|
+
if (key === "default" || key === "__esModule") return;
|
|
57
|
+
if (key in exports && exports[key] === _useModalRemoteControl[key]) return;
|
|
58
|
+
exports[key] = _useModalRemoteControl[key];
|
|
59
|
+
});
|
|
52
60
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Modal/index.ts"],"names":[],"mappings":";;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './ModalGroupManager'\nexport * from './ModalLifecycleHandler'\nexport * from './ui/BaseModalView'\nexport * from './ui/types'\nexport * from './useModalManager'\nexport * from './useLazyModalManager'"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Modal/index.ts"],"names":[],"mappings":";;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './ModalGroupManager'\nexport * from './ModalLifecycleHandler'\nexport * from './ui/BaseModalView'\nexport * from './ui/types'\nexport * from './useModalManager'\nexport * from './useLazyModalManager'\nexport * from './useModalRemoteControl'"],"file":"index.js"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
2
|
import { IBaseModal } from "./ui/types";
|
|
3
|
-
export declare const useLazyModalManager: () => {
|
|
3
|
+
export declare const useLazyModalManager: (modalId?: string | undefined) => {
|
|
4
4
|
requestUpdate: () => void;
|
|
5
5
|
sync: (modal: ReactElement<IBaseModal>) => null;
|
|
6
6
|
show: () => void;
|
|
@@ -9,8 +9,8 @@ var _uuid = require("uuid");
|
|
|
9
9
|
|
|
10
10
|
var _ModalGroupManager = require("./ModalGroupManager");
|
|
11
11
|
|
|
12
|
-
const useLazyModalManager =
|
|
13
|
-
const [id] = (0, _react.useState)((0, _uuid.v4)());
|
|
12
|
+
const useLazyModalManager = modalId => {
|
|
13
|
+
const [id] = (0, _react.useState)(modalId ?? (0, _uuid.v4)());
|
|
14
14
|
const requestUpdate = (0, _react.useCallback)(() => _ModalGroupManager.modalLifecycle.update(), []);
|
|
15
15
|
const sync = (0, _react.useCallback)(modal => {
|
|
16
16
|
_ModalGroupManager.modalLifecycle.sync(id, () => modal);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Modal/useLazyModalManager.ts"],"names":["useLazyModalManager","id","requestUpdate","modalLifecycle","update","sync","modal","show","close","destroy"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAWO,MAAMA,mBAAmB,
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Modal/useLazyModalManager.ts"],"names":["useLazyModalManager","modalId","id","requestUpdate","modalLifecycle","update","sync","modal","show","close","destroy"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAWO,MAAMA,mBAAmB,GAAIC,OAAD,IAAsB;AAErD,QAAM,CAACC,EAAD,IAAO,qBAASD,OAAO,IAAI,eAApB,CAAb;AAEA,QAAME,aAAa,GAAG,wBAAY,MAAMC,kCAAeC,MAAf,EAAlB,EAA2C,EAA3C,CAAtB;AAEA,QAAMC,IAAI,GAAG,wBAAaC,KAAD,IAAqC;AAC1DH,sCAAeE,IAAf,CAAoBJ,EAApB,EAAwB,MAAMK,KAA9B;;AACA,WAAO,IAAP;AACH,GAHY,EAGV,CAACL,EAAD,CAHU,CAAb;AAKA,QAAMM,IAAI,GAAG,wBAAY,MAAM;AAC3BJ,sCAAeI,IAAf,CAAoBN,EAApB;AACH,GAFY,EAEV,CAACA,EAAD,CAFU,CAAb;AAIA,QAAMO,KAAK,GAAG,wBAAY,MAAM;AAC5BL,sCAAeK,KAAf,CAAqBP,EAArB;AACH,GAFa,EAEX,CAACA,EAAD,CAFW,CAAd;AAIA,wBAAU,MAAM;AACZ,WAAO,MAAME,kCAAeM,OAAf,CAAuBR,EAAvB,CAAb;AACH,GAFD,EAEG,EAFH;AAIA,SAAO;AACHC,IAAAA,aADG;AAEHG,IAAAA,IAFG;AAGHE,IAAAA,IAHG;AAIHC,IAAAA;AAJG,GAAP;AAMH,CA7BM","sourcesContent":["import { ReactElement, useCallback, useEffect, useState } from \"react\"\nimport { v4 as uuidv4 } from 'uuid'\nimport { modalLifecycle } from \"./ModalGroupManager\"\nimport { IBaseModal } from \"./ui/types\"\n\n/**\n * Use this hook to tell the modal lifecycle handler that you want to add\n * a new modal component. \n * \n * @param id \n * @param modal \n * @returns\n */\nexport const useLazyModalManager = (modalId?: string) => {\n\n const [id] = useState(modalId ?? uuidv4())\n\n const requestUpdate = useCallback(() => modalLifecycle.update(), [])\n\n const sync = useCallback((modal: ReactElement<IBaseModal>) => {\n modalLifecycle.sync(id, () => modal)\n return null\n }, [id])\n\n const show = useCallback(() => {\n modalLifecycle.show(id)\n }, [id])\n\n const close = useCallback(() => {\n modalLifecycle.close(id)\n }, [id])\n \n useEffect(() => {\n return () => modalLifecycle.destroy(id)\n }, [])\n\n return {\n requestUpdate,\n sync,\n show,\n close\n }\n}"],"file":"useLazyModalManager.js"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
2
|
import { IBaseModal } from "./ui/types";
|
|
3
|
-
export declare const useModalManager: (modal: () => ReactElement<IBaseModal
|
|
3
|
+
export declare const useModalManager: (modal: () => ReactElement<IBaseModal>, modalId?: string | undefined) => {
|
|
4
4
|
show: () => void;
|
|
5
5
|
close: () => void;
|
|
6
6
|
};
|
|
@@ -9,8 +9,8 @@ var _uuid = require("uuid");
|
|
|
9
9
|
|
|
10
10
|
var _ModalGroupManager = require("./ModalGroupManager");
|
|
11
11
|
|
|
12
|
-
const useModalManager = modal => {
|
|
13
|
-
const [id] = (0, _react.useState)((0, _uuid.v4)());
|
|
12
|
+
const useModalManager = (modal, modalId) => {
|
|
13
|
+
const [id] = (0, _react.useState)(modalId ?? (0, _uuid.v4)());
|
|
14
14
|
|
|
15
15
|
_ModalGroupManager.modalLifecycle.sync(id, modal);
|
|
16
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Modal/useModalManager.ts"],"names":["useModalManager","modal","id","modalLifecycle","sync","show","close","destroy"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAWO,MAAMA,eAAe,
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Modal/useModalManager.ts"],"names":["useModalManager","modal","modalId","id","modalLifecycle","sync","show","close","destroy"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAWO,MAAMA,eAAe,GAAG,CAACC,KAAD,EAAwCC,OAAxC,KAA6D;AAExF,QAAM,CAACC,EAAD,IAAO,qBAASD,OAAO,IAAI,eAApB,CAAb;;AACAE,oCAAeC,IAAf,CAAoBF,EAApB,EAAwBF,KAAxB;;AAEA,QAAMK,IAAI,GAAG,wBAAY,MAAM;AAC3BF,sCAAeE,IAAf,CAAoBH,EAApB;AACH,GAFY,EAEV,CAACA,EAAD,CAFU,CAAb;AAIA,QAAMI,KAAK,GAAG,wBAAY,MAAM;AAC5BH,sCAAeG,KAAf,CAAqBJ,EAArB;AACH,GAFa,EAEX,CAACA,EAAD,CAFW,CAAd;AAIA,wBAAU,MAAM;AACZ,WAAO,MAAMC,kCAAeI,OAAf,CAAuBL,EAAvB,CAAb;AACH,GAFD,EAEG,EAFH;AAIA,SAAO;AACHG,IAAAA,IADG;AAEHC,IAAAA;AAFG,GAAP;AAIH,CArBM","sourcesContent":["import { ReactElement, useCallback, useEffect, useState } from \"react\"\nimport { v4 as uuidv4 } from 'uuid'\nimport { modalLifecycle } from \"./ModalGroupManager\"\nimport { IBaseModal } from \"./ui/types\"\n\n/**\n * Use this hook to tell the modal lifecycle handler that you want to add\n * a new modal component. \n * \n * @param id \n * @param modal \n * @returns\n */\nexport const useModalManager = (modal: () => ReactElement<IBaseModal>, modalId?: string) => {\n\n const [id] = useState(modalId ?? uuidv4())\n modalLifecycle.sync(id, modal)\n\n const show = useCallback(() => {\n modalLifecycle.show(id)\n }, [id])\n\n const close = useCallback(() => {\n modalLifecycle.close(id)\n }, [id])\n \n useEffect(() => {\n return () => modalLifecycle.destroy(id)\n }, [])\n\n return {\n show,\n close\n }\n}"],"file":"useModalManager.js"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.useModalRemoteControl = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = require("react");
|
|
7
|
+
|
|
8
|
+
var _ModalGroupManager = require("./ModalGroupManager");
|
|
9
|
+
|
|
10
|
+
const useModalRemoteControl = modalId => {
|
|
11
|
+
const show = (0, _react.useCallback)(() => {
|
|
12
|
+
_ModalGroupManager.modalLifecycle.show(modalId);
|
|
13
|
+
}, [modalId]);
|
|
14
|
+
const close = (0, _react.useCallback)(() => {
|
|
15
|
+
_ModalGroupManager.modalLifecycle.close(modalId);
|
|
16
|
+
}, [modalId]);
|
|
17
|
+
return {
|
|
18
|
+
show,
|
|
19
|
+
close
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
exports.useModalRemoteControl = useModalRemoteControl;
|
|
24
|
+
//# sourceMappingURL=useModalRemoteControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Modal/useModalRemoteControl.ts"],"names":["useModalRemoteControl","modalId","show","modalLifecycle","close"],"mappings":";;;;;AAAA;;AACA;;AASO,MAAMA,qBAAqB,GAAIC,OAAD,IAAqB;AAEtD,QAAMC,IAAI,GAAG,wBAAY,MAAM;AAC3BC,sCAAeD,IAAf,CAAoBD,OAApB;AACH,GAFY,EAEV,CAACA,OAAD,CAFU,CAAb;AAIA,QAAMG,KAAK,GAAG,wBAAY,MAAM;AAC5BD,sCAAeC,KAAf,CAAqBH,OAArB;AACH,GAFa,EAEX,CAACA,OAAD,CAFW,CAAd;AAIA,SAAO;AACHC,IAAAA,IADG;AAEHE,IAAAA;AAFG,GAAP;AAKH,CAfM","sourcesContent":["import { useCallback } from \"react\"\nimport { modalLifecycle } from \"./ModalGroupManager\"\n\n/**\n * Use it to control a specific modal wherever it's.\n * Just provide an id of a specific instance.\n * \n * @param modalId \n * @returns \n */\nexport const useModalRemoteControl = (modalId: string) => {\n\n const show = useCallback(() => {\n modalLifecycle.show(modalId)\n }, [modalId])\n\n const close = useCallback(() => {\n modalLifecycle.close(modalId)\n }, [modalId])\n\n return {\n show,\n close\n }\n\n}"],"file":"useModalRemoteControl.js"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from '@tecsinapse/react-core';
|
|
|
2
2
|
export { Header, HeaderProps } from './components/atoms/Header';
|
|
3
3
|
export { Select, SelectNativeProps } from './components/molecules/Select';
|
|
4
4
|
export { Input, InputNativeProps } from './components/atoms/Input';
|
|
5
|
+
export { InputMask, InputMaskNativeProps } from './components/atoms/InputMask';
|
|
5
6
|
export { TextArea, TextAreaProps } from './components/atoms/TextArea';
|
|
6
7
|
export { Text, TextNativeProps } from './components/atoms/Text';
|
|
7
8
|
export { Error, Loading, Success, Button, ButtonNativeProps, } from './components/atoms/Button';
|
|
@@ -17,5 +18,5 @@ export { DateTimePicker, NativeDateTimePickerProps, } from './components/molecul
|
|
|
17
18
|
export { Avatar } from './components/atoms/Avatar';
|
|
18
19
|
export { Calendar } from './components/molecules/Calendar';
|
|
19
20
|
export { DateTimeSelector } from './components/molecules/DateTimeSelector';
|
|
20
|
-
export { ModalGroupManager, ModalView, ModalLifecycleHandler, useLazyModalManager, useModalManager, IBaseModal, } from './components/atoms/Modal';
|
|
21
|
+
export { ModalGroupManager, ModalView, ModalLifecycleHandler, useLazyModalManager, useModalManager, useModalRemoteControl, IBaseModal, } from './components/atoms/Modal';
|
|
21
22
|
export { Skeleton, SkeletonProps } from './components/atoms/Skeleton';
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,8 @@ var _exportNames = {
|
|
|
8
8
|
SelectNativeProps: true,
|
|
9
9
|
Input: true,
|
|
10
10
|
InputNativeProps: true,
|
|
11
|
+
InputMask: true,
|
|
12
|
+
InputMaskNativeProps: true,
|
|
11
13
|
TextArea: true,
|
|
12
14
|
TextAreaProps: true,
|
|
13
15
|
Text: true,
|
|
@@ -42,11 +44,12 @@ var _exportNames = {
|
|
|
42
44
|
ModalLifecycleHandler: true,
|
|
43
45
|
useLazyModalManager: true,
|
|
44
46
|
useModalManager: true,
|
|
47
|
+
useModalRemoteControl: true,
|
|
45
48
|
IBaseModal: true,
|
|
46
49
|
Skeleton: true,
|
|
47
50
|
SkeletonProps: true
|
|
48
51
|
};
|
|
49
|
-
exports.SkeletonProps = exports.Skeleton = exports.IBaseModal = exports.useModalManager = exports.useLazyModalManager = exports.ModalLifecycleHandler = exports.ModalView = exports.ModalGroupManager = exports.DateTimeSelector = exports.Calendar = exports.Avatar = exports.NativeDateTimePickerProps = exports.DateTimePicker = exports.NativeDatePickerProps = exports.DatePicker = exports.SnackbarNativeProps = exports.Snackbar = exports.BadgeNativeProps = exports.Badge = exports.SnappingSliderProps = exports.SnappingSlider = exports.TagProps = exports.Tag = exports.BottomNavigatorProps = exports.BottomNavigator = exports.InputPasswordNativeProps = exports.InputPassword = exports.GroupButtonOption = exports.ButtonNativeProps = exports.Button = exports.Success = exports.Loading = exports.Error = exports.TextNativeProps = exports.Text = exports.TextAreaProps = exports.TextArea = exports.InputNativeProps = exports.Input = exports.SelectNativeProps = exports.Select = exports.HeaderProps = exports.Header = void 0;
|
|
52
|
+
exports.SkeletonProps = exports.Skeleton = exports.IBaseModal = exports.useModalRemoteControl = exports.useModalManager = exports.useLazyModalManager = exports.ModalLifecycleHandler = exports.ModalView = exports.ModalGroupManager = exports.DateTimeSelector = exports.Calendar = exports.Avatar = exports.NativeDateTimePickerProps = exports.DateTimePicker = exports.NativeDatePickerProps = exports.DatePicker = exports.SnackbarNativeProps = exports.Snackbar = exports.BadgeNativeProps = exports.Badge = exports.SnappingSliderProps = exports.SnappingSlider = exports.TagProps = exports.Tag = exports.BottomNavigatorProps = exports.BottomNavigator = exports.InputPasswordNativeProps = exports.InputPassword = exports.GroupButtonOption = exports.ButtonNativeProps = exports.Button = exports.Success = exports.Loading = exports.Error = exports.TextNativeProps = exports.Text = exports.TextAreaProps = exports.TextArea = exports.InputMaskNativeProps = exports.InputMask = exports.InputNativeProps = exports.Input = exports.SelectNativeProps = exports.Select = exports.HeaderProps = exports.Header = void 0;
|
|
50
53
|
|
|
51
54
|
var _reactCore = require("@tecsinapse/react-core");
|
|
52
55
|
|
|
@@ -72,6 +75,11 @@ var _Input = require("./components/atoms/Input");
|
|
|
72
75
|
exports.Input = _Input.Input;
|
|
73
76
|
exports.InputNativeProps = _Input.InputNativeProps;
|
|
74
77
|
|
|
78
|
+
var _InputMask = require("./components/atoms/InputMask");
|
|
79
|
+
|
|
80
|
+
exports.InputMask = _InputMask.InputMask;
|
|
81
|
+
exports.InputMaskNativeProps = _InputMask.InputMaskNativeProps;
|
|
82
|
+
|
|
75
83
|
var _TextArea = require("./components/atoms/TextArea");
|
|
76
84
|
|
|
77
85
|
exports.TextArea = _TextArea.TextArea;
|
|
@@ -153,6 +161,7 @@ exports.ModalView = _Modal.ModalView;
|
|
|
153
161
|
exports.ModalLifecycleHandler = _Modal.ModalLifecycleHandler;
|
|
154
162
|
exports.useLazyModalManager = _Modal.useLazyModalManager;
|
|
155
163
|
exports.useModalManager = _Modal.useModalManager;
|
|
164
|
+
exports.useModalRemoteControl = _Modal.useModalRemoteControl;
|
|
156
165
|
exports.IBaseModal = _Modal.IBaseModal;
|
|
157
166
|
|
|
158
167
|
var _Skeleton = require("./components/atoms/Skeleton");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;;;;AACA;;;;;AACA;;;;;AACA;;;;;AACA;;;;;AACA;;;;;AACA;;;;;;;;AAOA;;;;AACA;;;;;AAIA;;;;;AAIA;;;;;AACA;;;;;AAIA;;;;;AACA;;;;;AACA;;;;;AAIA;;;;;AAIA;;;;AACA;;;;AACA;;;;AACA;;;;;;;;;;AASA","sourcesContent":["export * from '@tecsinapse/react-core';\nexport { Header, HeaderProps } from './components/atoms/Header';\nexport { Select, SelectNativeProps } from './components/molecules/Select';\nexport { Input, InputNativeProps } from './components/atoms/Input';\nexport { InputMask, InputMaskNativeProps } from './components/atoms/InputMask';\nexport { TextArea, TextAreaProps } from './components/atoms/TextArea';\nexport { Text, TextNativeProps } from './components/atoms/Text';\nexport {\n Error,\n Loading,\n Success,\n Button,\n ButtonNativeProps,\n} from './components/atoms/Button';\nexport { GroupButtonOption } from './components/atoms/GroupButton';\nexport {\n InputPassword,\n InputPasswordNativeProps,\n} from './components/molecules/InputPassword';\nexport {\n BottomNavigator,\n BottomNavigatorProps,\n} from './components/atoms/BottomNavigator';\nexport { Tag, TagProps } from './components/atoms/Tag';\nexport {\n SnappingSlider,\n SnappingSliderProps,\n} from './components/atoms/SnappingSlider';\nexport { Badge, BadgeNativeProps } from './components/atoms/Badge';\nexport { Snackbar, SnackbarNativeProps } from './components/molecules/Snackbar';\nexport {\n DatePicker,\n NativeDatePickerProps,\n} from './components/molecules/DatePicker';\nexport {\n DateTimePicker,\n NativeDateTimePickerProps,\n} from './components/molecules/DateTimePicker';\nexport { Avatar } from './components/atoms/Avatar';\nexport { Calendar } from './components/molecules/Calendar';\nexport { DateTimeSelector } from './components/molecules/DateTimeSelector';\nexport {\n ModalGroupManager,\n ModalView,\n ModalLifecycleHandler,\n useLazyModalManager,\n useModalManager,\n useModalRemoteControl,\n IBaseModal,\n} from './components/atoms/Modal';\nexport { Skeleton, SkeletonProps } from './components/atoms/Skeleton';\n"],"file":"index.js"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/react-native-kit",
|
|
3
3
|
"description": "TecSinapse React Native components",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.17.2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@emotion/native": "^11.0.0",
|
|
15
15
|
"@emotion/react": "^11.4.1",
|
|
16
|
-
"@tecsinapse/react-core": "^1.
|
|
16
|
+
"@tecsinapse/react-core": "^1.16.0",
|
|
17
17
|
"react-native-linear-gradient": "^2.5.6"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/uuid": "^8.3.3"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "6ca09ace6c0df4a67383ee165bd592512aa3c0ac"
|
|
40
40
|
}
|
|
@@ -42,6 +42,8 @@ const Input: FC<InputNativeProps> = React.forwardRef(
|
|
|
42
42
|
hint,
|
|
43
43
|
onFocus,
|
|
44
44
|
onBlur,
|
|
45
|
+
value,
|
|
46
|
+
placeholder,
|
|
45
47
|
...rest
|
|
46
48
|
},
|
|
47
49
|
ref
|
|
@@ -55,10 +57,12 @@ const Input: FC<InputNativeProps> = React.forwardRef(
|
|
|
55
57
|
!disabled
|
|
56
58
|
);
|
|
57
59
|
|
|
60
|
+
const onlyLabel = label && !placeholder;
|
|
61
|
+
|
|
58
62
|
return (
|
|
59
63
|
<View style={style}>
|
|
60
64
|
<StyledInputContainer
|
|
61
|
-
label={label}
|
|
65
|
+
label={value ? label : undefined}
|
|
62
66
|
labelColor={labelColor}
|
|
63
67
|
labelColorVariant={labelColorVariant}
|
|
64
68
|
labelColorTone={labelColorTone}
|
|
@@ -77,6 +81,8 @@ const Input: FC<InputNativeProps> = React.forwardRef(
|
|
|
77
81
|
>
|
|
78
82
|
<StyledNativeInput
|
|
79
83
|
{...rest}
|
|
84
|
+
placeholder={onlyLabel ? label : placeholder}
|
|
85
|
+
value={value}
|
|
80
86
|
ref={ref}
|
|
81
87
|
fontStack={inputFontStack}
|
|
82
88
|
fontWeight={inputFontWeight}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FontStackType,
|
|
3
|
+
FontWeightType,
|
|
4
|
+
Hint,
|
|
5
|
+
InputContainerProps,
|
|
6
|
+
InputMaskElementProps,
|
|
7
|
+
useInputFocus,
|
|
8
|
+
} from '@tecsinapse/react-core';
|
|
9
|
+
import React, { FC } from 'react';
|
|
10
|
+
import { View } from 'react-native';
|
|
11
|
+
import { StyledInputContainer, StyledNativeInputMask } from './styled';
|
|
12
|
+
import { Text } from '../Text';
|
|
13
|
+
|
|
14
|
+
export interface InputMaskNativeProps
|
|
15
|
+
extends Omit<InputMaskElementProps, 'style'>,
|
|
16
|
+
InputContainerProps {
|
|
17
|
+
inputFontStack?: FontStackType;
|
|
18
|
+
inputFontWeight?: FontWeightType;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const InputMask: FC<InputMaskNativeProps> = React.forwardRef(
|
|
22
|
+
(
|
|
23
|
+
{
|
|
24
|
+
label,
|
|
25
|
+
labelColor,
|
|
26
|
+
labelColorVariant,
|
|
27
|
+
labelColorTone,
|
|
28
|
+
labelTypography,
|
|
29
|
+
labelStack,
|
|
30
|
+
labelWeight,
|
|
31
|
+
leftComponent,
|
|
32
|
+
rightComponent,
|
|
33
|
+
disabled,
|
|
34
|
+
style,
|
|
35
|
+
borderColor,
|
|
36
|
+
borderColorGradation,
|
|
37
|
+
inputFontStack = 'default',
|
|
38
|
+
inputFontWeight = 'bold',
|
|
39
|
+
inputContainerStyle,
|
|
40
|
+
variant = 'default',
|
|
41
|
+
hintComponent,
|
|
42
|
+
hint,
|
|
43
|
+
onFocus,
|
|
44
|
+
onBlur,
|
|
45
|
+
value,
|
|
46
|
+
placeholder,
|
|
47
|
+
...rest
|
|
48
|
+
},
|
|
49
|
+
ref
|
|
50
|
+
) => {
|
|
51
|
+
const _hint = hintComponent || (
|
|
52
|
+
<Hint TextComponent={Text} text={hint} variant={variant} />
|
|
53
|
+
);
|
|
54
|
+
const { focused, handleBlur, handleFocus } = useInputFocus(
|
|
55
|
+
onFocus,
|
|
56
|
+
onBlur,
|
|
57
|
+
!disabled
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const onlyLabel = label && !placeholder;
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<View style={style}>
|
|
64
|
+
<StyledInputContainer
|
|
65
|
+
label={String(value) ? label : undefined}
|
|
66
|
+
labelColor={labelColor}
|
|
67
|
+
labelColorVariant={labelColorVariant}
|
|
68
|
+
labelColorTone={labelColorTone}
|
|
69
|
+
labelTypography={labelTypography}
|
|
70
|
+
labelStack={labelStack}
|
|
71
|
+
labelWeight={labelWeight}
|
|
72
|
+
LabelComponent={Text}
|
|
73
|
+
leftComponent={leftComponent}
|
|
74
|
+
rightComponent={rightComponent}
|
|
75
|
+
borderColor={borderColor}
|
|
76
|
+
borderColorGradation={borderColorGradation}
|
|
77
|
+
inputContainerStyle={inputContainerStyle}
|
|
78
|
+
focused={focused}
|
|
79
|
+
disabled={disabled}
|
|
80
|
+
variant={variant}
|
|
81
|
+
>
|
|
82
|
+
<StyledNativeInputMask
|
|
83
|
+
{...rest}
|
|
84
|
+
placeholder={onlyLabel ? label : placeholder}
|
|
85
|
+
value={value}
|
|
86
|
+
ref={ref}
|
|
87
|
+
fontStack={inputFontStack}
|
|
88
|
+
fontWeight={inputFontWeight}
|
|
89
|
+
disabled={disabled}
|
|
90
|
+
onFocus={handleFocus}
|
|
91
|
+
onBlur={handleBlur}
|
|
92
|
+
/>
|
|
93
|
+
</StyledInputContainer>
|
|
94
|
+
{hint && _hint}
|
|
95
|
+
</View>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
InputMask.displayName = 'InputMask';
|
|
101
|
+
|
|
102
|
+
export default InputMask;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as InputMask, InputMaskNativeProps } from './InputMask';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import {
|
|
3
|
+
InputContainer,
|
|
4
|
+
InputMaskElement,
|
|
5
|
+
RFValueStr,
|
|
6
|
+
StyleProps,
|
|
7
|
+
} from '@tecsinapse/react-core';
|
|
8
|
+
import { Font, fontStyles } from '../Text/styled';
|
|
9
|
+
import { InputMaskNativeProps } from './InputMask';
|
|
10
|
+
|
|
11
|
+
export const StyledInputContainer = styled(InputContainer)<Partial<StyleProps>>`
|
|
12
|
+
min-height: ${RFValueStr('50px')};
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
const StyledNativeInputMaskBase = styled(InputMaskElement)<
|
|
16
|
+
Partial<InputMaskNativeProps> & Partial<StyleProps>
|
|
17
|
+
>`
|
|
18
|
+
height: ${({ theme }) => theme.typography.h5.lineHeight};
|
|
19
|
+
width: 100%;
|
|
20
|
+
padding: 0;
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export const StyledNativeInputMask = styled(StyledNativeInputMaskBase)<
|
|
24
|
+
Font & Partial<InputMaskNativeProps> & Partial<StyleProps>
|
|
25
|
+
>(fontStyles);
|
|
@@ -81,7 +81,7 @@ export class ModalLifecycleHandler {
|
|
|
81
81
|
*/
|
|
82
82
|
public sync = (id: string, modal: () => ReactElement<IBaseModal>) => {
|
|
83
83
|
if (this.nodeGroup.has(id)) {
|
|
84
|
-
const savedNode = this.
|
|
84
|
+
const savedNode = this.findNode(id)
|
|
85
85
|
savedNode && this.nodeGroup.set(id, { ...savedNode, modal })
|
|
86
86
|
return
|
|
87
87
|
}
|
|
@@ -105,18 +105,29 @@ export class ModalLifecycleHandler {
|
|
|
105
105
|
* @param id
|
|
106
106
|
*/
|
|
107
107
|
private remove = (id: string) => {
|
|
108
|
-
const savedNode = this.
|
|
108
|
+
const savedNode = this.findNode(id)
|
|
109
109
|
savedNode && this.nodeGroup.set(id, { ...savedNode, lastVisualization: undefined })
|
|
110
110
|
this.update()
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Find a modal node by id.
|
|
115
|
+
*
|
|
116
|
+
* @param id
|
|
117
|
+
*/
|
|
118
|
+
private findNode = (id: string) => {
|
|
119
|
+
const node = this.nodeGroup.get(id)
|
|
120
|
+
!node && console.warn(`No modal was found with the id "${id}"`)
|
|
121
|
+
return node
|
|
122
|
+
}
|
|
123
|
+
|
|
113
124
|
/**
|
|
114
125
|
* Makes a modal appears.
|
|
115
126
|
*
|
|
116
127
|
* @param id
|
|
117
128
|
*/
|
|
118
129
|
public show = (id: string) => {
|
|
119
|
-
const savedNode = this.
|
|
130
|
+
const savedNode = this.findNode(id)
|
|
120
131
|
savedNode && this.nodeGroup.set(id, { ...savedNode, visible: true, lastVisualization: new Date() })
|
|
121
132
|
this.update()
|
|
122
133
|
}
|
|
@@ -127,7 +138,7 @@ export class ModalLifecycleHandler {
|
|
|
127
138
|
* @param id
|
|
128
139
|
*/
|
|
129
140
|
public close = (id: string) => {
|
|
130
|
-
const savedNode = this.
|
|
141
|
+
const savedNode = this.findNode(id)
|
|
131
142
|
savedNode && this.nodeGroup.set(id, { ...savedNode, visible: false })
|
|
132
143
|
this.update()
|
|
133
144
|
}
|
|
@@ -11,9 +11,9 @@ import { IBaseModal } from "./ui/types"
|
|
|
11
11
|
* @param modal
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
|
-
export const useLazyModalManager = () => {
|
|
14
|
+
export const useLazyModalManager = (modalId?: string) => {
|
|
15
15
|
|
|
16
|
-
const [id] = useState(uuidv4())
|
|
16
|
+
const [id] = useState(modalId ?? uuidv4())
|
|
17
17
|
|
|
18
18
|
const requestUpdate = useCallback(() => modalLifecycle.update(), [])
|
|
19
19
|
|
|
@@ -11,9 +11,9 @@ import { IBaseModal } from "./ui/types"
|
|
|
11
11
|
* @param modal
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
|
-
export const useModalManager = (modal: () => ReactElement<IBaseModal
|
|
14
|
+
export const useModalManager = (modal: () => ReactElement<IBaseModal>, modalId?: string) => {
|
|
15
15
|
|
|
16
|
-
const [id] = useState(uuidv4())
|
|
16
|
+
const [id] = useState(modalId ?? uuidv4())
|
|
17
17
|
modalLifecycle.sync(id, modal)
|
|
18
18
|
|
|
19
19
|
const show = useCallback(() => {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useCallback } from "react"
|
|
2
|
+
import { modalLifecycle } from "./ModalGroupManager"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Use it to control a specific modal wherever it's.
|
|
6
|
+
* Just provide an id of a specific instance.
|
|
7
|
+
*
|
|
8
|
+
* @param modalId
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export const useModalRemoteControl = (modalId: string) => {
|
|
12
|
+
|
|
13
|
+
const show = useCallback(() => {
|
|
14
|
+
modalLifecycle.show(modalId)
|
|
15
|
+
}, [modalId])
|
|
16
|
+
|
|
17
|
+
const close = useCallback(() => {
|
|
18
|
+
modalLifecycle.close(modalId)
|
|
19
|
+
}, [modalId])
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
show,
|
|
23
|
+
close
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from '@tecsinapse/react-core';
|
|
|
2
2
|
export { Header, HeaderProps } from './components/atoms/Header';
|
|
3
3
|
export { Select, SelectNativeProps } from './components/molecules/Select';
|
|
4
4
|
export { Input, InputNativeProps } from './components/atoms/Input';
|
|
5
|
+
export { InputMask, InputMaskNativeProps } from './components/atoms/InputMask';
|
|
5
6
|
export { TextArea, TextAreaProps } from './components/atoms/TextArea';
|
|
6
7
|
export { Text, TextNativeProps } from './components/atoms/Text';
|
|
7
8
|
export {
|
|
@@ -44,6 +45,7 @@ export {
|
|
|
44
45
|
ModalLifecycleHandler,
|
|
45
46
|
useLazyModalManager,
|
|
46
47
|
useModalManager,
|
|
48
|
+
useModalRemoteControl,
|
|
47
49
|
IBaseModal,
|
|
48
50
|
} from './components/atoms/Modal';
|
|
49
51
|
export { Skeleton, SkeletonProps } from './components/atoms/Skeleton';
|