@tecsinapse/react-core 1.16.2 → 1.16.5
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/Input/InputContainer/InputContainer.js.map +1 -1
- package/dist/components/atoms/Text/Text.d.ts +2 -1
- package/dist/components/atoms/Text/Text.js.map +1 -1
- package/dist/utils/masks.js +8 -1
- package/dist/utils/masks.js.map +1 -1
- package/package.json +6 -3
- package/src/components/atoms/Input/InputContainer/InputContainer.tsx +2 -2
- package/src/components/atoms/Text/Text.tsx +1 -0
- package/src/utils/masks.ts +11 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
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.16.5](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.16.4...@tecsinapse/react-core@1.16.5) (2022-07-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @tecsinapse/react-core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.16.4](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.16.3...@tecsinapse/react-core@1.16.4) (2022-06-24)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* added verification number extended without mask ([#177465](https://github.com/tecsinapse/design-system/issues/177465)) ([27ef33c](https://github.com/tecsinapse/design-system/commit/27ef33cb5fe25bd0a6ef00370650e81f71188f06))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [1.16.3](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.16.2...@tecsinapse/react-core@1.16.3) (2022-06-22)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* automation yalc for develop local ([9c6f1bb](https://github.com/tecsinapse/design-system/commit/9c6f1bbf0ea4bbacd194e4cf5c338405b94a9686))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
## [1.16.2](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.16.1...@tecsinapse/react-core@1.16.2) (2022-06-19)
|
|
7
37
|
|
|
8
38
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/atoms/Input/InputContainer/InputContainer.tsx"],"names":["InputContainer","label","labelColor","labelColorTone","labelColorVariant","labelTypography","labelStack","labelWeight","LabelComponent","Text","leftComponent","rightComponent","inputContainerStyle","disabled","focused","variant","children","rest","_defaultLabelColor","_labelColorVariant","_labelColorTone"],"mappings":";;;;;AAAA;;AAWA;;AACA;;;;;;AA+BA,MAAMA,cAAoE,GAAG,CAAC;AAC5EC,EAAAA,KAD4E;AAE5EC,EAAAA,UAAU,GAAG,QAF+D;AAG5EC,EAAAA,cAH4E;AAI5EC,EAAAA,iBAJ4E;AAK5EC,EAAAA,eAAe,GAAG,OAL0D;AAM5EC,EAAAA,UAAU,GAAG,SAN+D;AAO5EC,EAAAA,WAAW,GAAG,MAP8D;AAQ5EC,EAAAA,cAAc,GAAGC,UAR2D;AAS5EC,EAAAA,aAT4E;AAU5EC,EAAAA,cAV4E;AAW5EC,EAAAA,mBAX4E;AAY5EC,EAAAA,QAZ4E;AAa5EC,EAAAA,OAb4E;AAc5EC,EAAAA,OAd4E;AAe5EC,EAAAA,QAf4E;AAgB5E,KAAGC;AAhByE,CAAD,KAiB1D;AACjB,MAAIC,kBAAkB,GAAGd,iBAAzB;AACA,MAAIW,OAAO,KAAK,OAAhB,EAAyBG,kBAAkB,GAAG,OAArB;AACzB,MAAIH,OAAO,KAAK,SAAhB,EAA2BG,kBAAkB,GAAG,SAArB;;AAC3B,QAAMC,kBAAkB,GAAGN,QAAQ,GAAG,WAAH,GAAiBK,kBAApD;;AACA,QAAME,eAAe,GAAGP,QAAQ,GAAG,OAAH,GAAaV,cAA7C;;AAEA,SACE,6BAAC,4BAAD,eACMc,IADN;AAEE,IAAA,KAAK,EAAEL,mBAFT;AAGE,IAAA,OAAO,EAAEE,OAHX;AAIE,IAAA,QAAQ,EAAED;AAJZ,MAME,6BAAC,0BAAD;AACE,IAAA,OAAO,EAAEC,OADX;AAEE,IAAA,QAAQ,EAAED,QAFZ;AAGE,IAAA,WAAW,EAAEK;AAHf,IANF,EAYGR,aAAa,IAAI,6BAAC,yBAAD,QAAoBA,aAApB,CAZpB,EAcE,6BAAC,4BAAD;AACE,IAAA,aAAa,EAAEA,aADjB;AAEE,IAAA,cAAc,EAAEC;AAFlB,KAIGV,KAAK,IACJ,6BAAC,cAAD;AACE,IAAA,SAAS,EAAEC,UADb;AAEE,IAAA,SAAS,EAAEkB,eAFb;AAGE,IAAA,YAAY,EAAED,kBAHhB;AAIE,IAAA,UAAU,EAAEd,eAJd;AAKE,IAAA,UAAU,EAAEE,WALd;AAME,IAAA,SAAS,EAAED;AANb,KAQGL,KARH,CALJ,EAgBGe,QAhBH,CAdF,EAiCGL,cAAc,IACb,6BAAC,yBAAD,QAAoBA,cAApB,CAlCJ,CADF;AAuCD,CA/DD;;eAiEeX,c","sourcesContent":["import React, { FC } from 'react';\nimport { StyleProp, ViewStyle } from 'react-native';\nimport { InputElementProps } from '..';\nimport {\n ColorGradationType,\n ColorType,\n FontColorType,\n FontStackType,\n FontWeightType,\n TypographyVariationType
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/atoms/Input/InputContainer/InputContainer.tsx"],"names":["InputContainer","label","labelColor","labelColorTone","labelColorVariant","labelTypography","labelStack","labelWeight","LabelComponent","Text","leftComponent","rightComponent","inputContainerStyle","disabled","focused","variant","children","rest","_defaultLabelColor","_labelColorVariant","_labelColorTone"],"mappings":";;;;;AAAA;;AAWA;;AACA;;;;;;AA+BA,MAAMA,cAAoE,GAAG,CAAC;AAC5EC,EAAAA,KAD4E;AAE5EC,EAAAA,UAAU,GAAG,QAF+D;AAG5EC,EAAAA,cAH4E;AAI5EC,EAAAA,iBAJ4E;AAK5EC,EAAAA,eAAe,GAAG,OAL0D;AAM5EC,EAAAA,UAAU,GAAG,SAN+D;AAO5EC,EAAAA,WAAW,GAAG,MAP8D;AAQ5EC,EAAAA,cAAc,GAAGC,UAR2D;AAS5EC,EAAAA,aAT4E;AAU5EC,EAAAA,cAV4E;AAW5EC,EAAAA,mBAX4E;AAY5EC,EAAAA,QAZ4E;AAa5EC,EAAAA,OAb4E;AAc5EC,EAAAA,OAd4E;AAe5EC,EAAAA,QAf4E;AAgB5E,KAAGC;AAhByE,CAAD,KAiB1D;AACjB,MAAIC,kBAAkB,GAAGd,iBAAzB;AACA,MAAIW,OAAO,KAAK,OAAhB,EAAyBG,kBAAkB,GAAG,OAArB;AACzB,MAAIH,OAAO,KAAK,SAAhB,EAA2BG,kBAAkB,GAAG,SAArB;;AAC3B,QAAMC,kBAAkB,GAAGN,QAAQ,GAAG,WAAH,GAAiBK,kBAApD;;AACA,QAAME,eAAe,GAAGP,QAAQ,GAAG,OAAH,GAAaV,cAA7C;;AAEA,SACE,6BAAC,4BAAD,eACMc,IADN;AAEE,IAAA,KAAK,EAAEL,mBAFT;AAGE,IAAA,OAAO,EAAEE,OAHX;AAIE,IAAA,QAAQ,EAAED;AAJZ,MAME,6BAAC,0BAAD;AACE,IAAA,OAAO,EAAEC,OADX;AAEE,IAAA,QAAQ,EAAED,QAFZ;AAGE,IAAA,WAAW,EAAEK;AAHf,IANF,EAYGR,aAAa,IAAI,6BAAC,yBAAD,QAAoBA,aAApB,CAZpB,EAcE,6BAAC,4BAAD;AACE,IAAA,aAAa,EAAEA,aADjB;AAEE,IAAA,cAAc,EAAEC;AAFlB,KAIGV,KAAK,IACJ,6BAAC,cAAD;AACE,IAAA,SAAS,EAAEC,UADb;AAEE,IAAA,SAAS,EAAEkB,eAFb;AAGE,IAAA,YAAY,EAAED,kBAHhB;AAIE,IAAA,UAAU,EAAEd,eAJd;AAKE,IAAA,UAAU,EAAEE,WALd;AAME,IAAA,SAAS,EAAED;AANb,KAQGL,KARH,CALJ,EAgBGe,QAhBH,CAdF,EAiCGL,cAAc,IACb,6BAAC,yBAAD,QAAoBA,cAApB,CAlCJ,CADF;AAuCD,CA/DD;;eAiEeX,c","sourcesContent":["import React, { FC } from 'react';\nimport { StyleProp, ViewStyle } from 'react-native';\nimport { InputElementProps } from '..';\nimport {\n ColorGradationType,\n ColorType,\n FontColorType,\n FontStackType,\n FontWeightType,\n TypographyVariationType\n} from '../../../../types/defaults';\nimport { Text, TextProps } from '../../Text';\nimport {\n StyledBorderKeeper,\n StyledIconContent,\n StyledInputContainer,\n StyledLabelContainer\n} from '../styled';\n\nexport type InputVariantType = 'default' | 'error' | 'success';\n\nexport interface InputContainerProps {\n label?: string;\n labelColor?: FontColorType;\n labelColorVariant?: ColorType;\n labelColorTone?: ColorGradationType;\n labelTypography?: TypographyVariationType;\n labelStack?: FontStackType;\n LabelComponent?: FC<TextProps>;\n labelWeight?: FontWeightType;\n leftComponent?: JSX.Element;\n rightComponent?: JSX.Element;\n borderColor?: ColorType;\n borderColorGradation?: ColorGradationType;\n style?: StyleProp<ViewStyle>;\n inputContainerStyle?: StyleProp<ViewStyle>;\n focused?: boolean;\n disabled?: boolean;\n variant?: InputVariantType;\n hint?: string;\n hintComponent?: JSX.Element;\n}\n\nconst InputContainer: FC<InputContainerProps & Partial<InputElementProps>> = ({\n label,\n labelColor = 'medium',\n labelColorTone,\n labelColorVariant,\n labelTypography = 'label',\n labelStack = 'default',\n labelWeight = 'bold',\n LabelComponent = Text,\n leftComponent,\n rightComponent,\n inputContainerStyle,\n disabled,\n focused,\n variant,\n children,\n ...rest\n}): JSX.Element => {\n let _defaultLabelColor = labelColorVariant;\n if (variant === 'error') _defaultLabelColor = 'error';\n if (variant === 'success') _defaultLabelColor = 'success';\n const _labelColorVariant = disabled ? 'secondary' : _defaultLabelColor;\n const _labelColorTone = disabled ? 'light' : labelColorTone;\n\n return (\n <StyledInputContainer\n {...rest}\n style={inputContainerStyle}\n focused={focused}\n disabled={disabled}\n >\n <StyledBorderKeeper\n focused={focused}\n disabled={disabled}\n borderColor={_defaultLabelColor}\n />\n\n {leftComponent && <StyledIconContent>{leftComponent}</StyledIconContent>}\n\n <StyledLabelContainer\n leftComponent={leftComponent}\n rightComponent={rightComponent}\n >\n {label && (\n <LabelComponent\n fontColor={labelColor}\n colorTone={_labelColorTone}\n colorVariant={_labelColorVariant}\n typography={labelTypography}\n fontWeight={labelWeight}\n fontStack={labelStack}\n >\n {label}\n </LabelComponent>\n )}\n {children}\n </StyledLabelContainer>\n\n {rightComponent && (\n <StyledIconContent>{rightComponent}</StyledIconContent>\n )}\n </StyledInputContainer>\n );\n};\n\nexport default InputContainer;\n"],"file":"InputContainer.js"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
2
|
import { ColorGradationType, ColorType, FontColorType, FontStackType, FontWeightType, TypographyVariationType } from '@tecsinapse/react-core';
|
|
3
3
|
import { StyleProp, TextStyle } from 'react-native';
|
|
4
4
|
export interface TextProps {
|
|
@@ -13,6 +13,7 @@ export interface TextProps {
|
|
|
13
13
|
textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize';
|
|
14
14
|
capitalFirst?: boolean;
|
|
15
15
|
style?: StyleProp<TextStyle>;
|
|
16
|
+
children?: React.ReactNode;
|
|
16
17
|
}
|
|
17
18
|
declare const Text: FC<TextProps>;
|
|
18
19
|
export default Text;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Text/Text.tsx"],"names":["Text","children","style","fontColor","colorTone","colorVariant","fontWeight","typography","numberOfLines","ellipsizeMode","textTransform","capitalFirst","rest"],"mappings":";;;;;AAAA;;AAUA;;AACA;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Text/Text.tsx"],"names":["Text","children","style","fontColor","colorTone","colorVariant","fontWeight","typography","numberOfLines","ellipsizeMode","textTransform","capitalFirst","rest"],"mappings":";;;;;AAAA;;AAUA;;AACA;;;;;;AAwBA,MAAMA,IAAmB,GAAG,CAAC;AAC3BC,EAAAA,QAD2B;AAE3BC,EAAAA,KAF2B;AAG3BC,EAAAA,SAAS,GAAG,MAHe;AAI3BC,EAAAA,SAAS,GAAG,QAJe;AAK3BC,EAAAA,YAL2B;AAM3BC,EAAAA,UAAU,GAAG,SANc;AAO3BC,EAAAA,UAAU,GAAG,MAPc;AAQ3BC,EAAAA,aAR2B;AAS3BC,EAAAA,aAT2B;AAU3BC,EAAAA,aAAa,GAAG,MAVW;AAW3BC,EAAAA,YAAY,GAAG,KAXY;AAY3B,KAAGC;AAZwB,CAAD,KAaT;AACjB,SACE,6BAAC,yBAAD,eACMA,IADN;AAEE,IAAA,KAAK,EAAEV,KAFT;AAGE,IAAA,SAAS,EAAEC,SAHb;AAIE,IAAA,SAAS,EAAEC,SAJb;AAKE,IAAA,YAAY,EAAEC,YALhB;AAME,IAAA,UAAU,EAAEC,UANd;AAOE,IAAA,UAAU,EAAEC,UAPd;AAQE,IAAA,aAAa,EAAEC,aARjB;AASE,IAAA,aAAa,EAAEC,aATjB;AAUE,IAAA,aAAa,EAAEC;AAVjB,MAYG,yBAAST,QAAT,EAAmBU,YAAnB,CAZH,CADF;AAgBD,CA9BD;;eAgCeX,I","sourcesContent":["import React, { FC } from 'react';\nimport {\n ColorGradationType,\n ColorType,\n FontColorType,\n FontStackType,\n FontWeightType,\n TypographyVariationType,\n} from '@tecsinapse/react-core';\nimport { StyleProp, TextStyle } from 'react-native';\nimport { StyledColoredText } from './styled';\nimport { getLabel } from './functions';\n\nexport interface TextProps {\n /** Font theme text color */\n fontColor?: FontColorType;\n /** Font theme weight */\n fontWeight?: FontWeightType;\n /** Font theme sizes */\n typography?: TypographyVariationType;\n /** Font theme stack */\n fontStack?: FontStackType;\n /** Palette theme colors. You can specify this prop to override theme fontColor */\n colorVariant?: ColorType;\n /** Palette theme colors gradation */\n colorTone?: ColorGradationType;\n numberOfLines?: number;\n ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip';\n textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize';\n capitalFirst?: boolean;\n style?: StyleProp<TextStyle>;\n children?: React.ReactNode;\n}\n\n/** NOTE: When using colors, be careful to not override fontColor by using colorVariant and colorTone, referent to theme colors and not text colors. */\nconst Text: FC<TextProps> = ({\n children,\n style,\n fontColor = 'dark',\n colorTone = 'medium',\n colorVariant,\n fontWeight = 'regular',\n typography = 'base',\n numberOfLines,\n ellipsizeMode,\n textTransform = 'none',\n capitalFirst = false,\n ...rest\n}): JSX.Element => {\n return (\n <StyledColoredText\n {...rest}\n style={style}\n fontColor={fontColor}\n colorTone={colorTone}\n colorVariant={colorVariant}\n fontWeight={fontWeight}\n typography={typography}\n numberOfLines={numberOfLines}\n ellipsizeMode={ellipsizeMode}\n textTransform={textTransform}\n >\n {getLabel(children, capitalFirst)}\n </StyledColoredText>\n );\n};\n\nexport default Text;\n"],"file":"Text.js"}
|
package/dist/utils/masks.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.Masks = void 0;
|
|
5
|
+
|
|
6
|
+
var _reactCore = require("@tecsinapse/react-core");
|
|
7
|
+
|
|
5
8
|
const Masks = {
|
|
6
9
|
CPF: ['999.999.999-99'],
|
|
7
10
|
CNPJ: ['99.999.999/9999-99'],
|
|
@@ -10,7 +13,11 @@ const Masks = {
|
|
|
10
13
|
CEP: ['99999-999'],
|
|
11
14
|
PHONE: ['(99) 9999-9999'],
|
|
12
15
|
PHONE_EXTENDED: ['(99) 99999-9999'],
|
|
13
|
-
COMBINED_PHONE: value =>
|
|
16
|
+
COMBINED_PHONE: value => {
|
|
17
|
+
const onlyNumbers = (0, _reactCore.extractDigitsFromString)(value);
|
|
18
|
+
const isCellPhoneExtended = onlyNumbers.length === 11;
|
|
19
|
+
return (value == null ? void 0 : value.length) <= 14 && !isCellPhoneExtended ? Masks.PHONE : Masks.PHONE_EXTENDED;
|
|
20
|
+
},
|
|
14
21
|
COMBINED_CPF_CNPJ: value => (value == null ? void 0 : value.length) <= 14 ? Masks.CPF : Masks.CNPJ
|
|
15
22
|
};
|
|
16
23
|
exports.Masks = Masks;
|
package/dist/utils/masks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/masks.ts"],"names":["Masks","CPF","CNPJ","DATE","MONTH_YEAR","CEP","PHONE","PHONE_EXTENDED","COMBINED_PHONE","value","length","COMBINED_CPF_CNPJ"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/masks.ts"],"names":["Masks","CPF","CNPJ","DATE","MONTH_YEAR","CEP","PHONE","PHONE_EXTENDED","COMBINED_PHONE","value","onlyNumbers","isCellPhoneExtended","length","COMBINED_CPF_CNPJ"],"mappings":";;;;;AACA;;AAEO,MAAMA,KAAK,GAAG;AACnBC,EAAAA,GAAG,EAAE,CAAC,gBAAD,CADc;AAEnBC,EAAAA,IAAI,EAAE,CAAC,oBAAD,CAFa;AAGnBC,EAAAA,IAAI,EAAE,CAAC,YAAD,CAHa;AAInBC,EAAAA,UAAU,EAAE,CAAC,SAAD,CAJO;AAKnBC,EAAAA,GAAG,EAAE,CAAC,WAAD,CALc;AAMnBC,EAAAA,KAAK,EAAE,CAAC,gBAAD,CANY;AAOnBC,EAAAA,cAAc,EAAE,CAAC,iBAAD,CAPG;AAQnBC,EAAAA,cAAc,EAAGC,KAAD,IAAmB;AACjC,UAAMC,WAAW,GAAG,wCAAwBD,KAAxB,CAApB;AAEA,UAAME,mBAAmB,GAAGD,WAAW,CAACE,MAAZ,KAAuB,EAAnD;AAGA,WAAO,CAAAH,KAAK,QAAL,YAAAA,KAAK,CAAEG,MAAP,KAAiB,EAAjB,IAAuB,CAACD,mBAAxB,GACHX,KAAK,CAACM,KADH,GAEHN,KAAK,CAACO,cAFV;AAGD,GAjBkB;AAkBnBM,EAAAA,iBAAiB,EAAGJ,KAAD,IACjB,CAAAA,KAAK,QAAL,YAAAA,KAAK,CAAEG,MAAP,KAAiB,EAAjB,GAAsBZ,KAAK,CAACC,GAA5B,GAAkCD,KAAK,CAACE;AAnBvB,CAAd","sourcesContent":["// NOTE: Add here all individually utils, then you can use it on input components everywhere.\nimport { extractDigitsFromString } from '@tecsinapse/react-core';\n\nexport const Masks = {\n CPF: ['999.999.999-99'],\n CNPJ: ['99.999.999/9999-99'],\n DATE: ['99/99/9999'],\n MONTH_YEAR: ['99/9999'],\n CEP: ['99999-999'],\n PHONE: ['(99) 9999-9999'],\n PHONE_EXTENDED: ['(99) 99999-9999'],\n COMBINED_PHONE: (value: string) => {\n const onlyNumbers = extractDigitsFromString(value);\n // Value is number extended, but without mask.\n const isCellPhoneExtended = onlyNumbers.length === 11;\n\n // Value in formatted mode\n return value?.length <= 14 && !isCellPhoneExtended\n ? Masks.PHONE\n : Masks.PHONE_EXTENDED;\n },\n COMBINED_CPF_CNPJ: (value: string) =>\n value?.length <= 14 ? Masks.CPF : Masks.CNPJ,\n};\n"],"file":"masks.js"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/react-core",
|
|
3
3
|
"description": "TecSinapse hybrid React components",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"start": "yarn build:es --watch",
|
|
10
|
+
"build:es": "cross-env BABEL_ENV=build babel src --root-mode upward --out-dir dist --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments",
|
|
10
11
|
"build:declaration": "tsc --project tsconfig.build.json",
|
|
11
|
-
"build:
|
|
12
|
+
"build:declaration:watch": "tsc --project tsconfig.build.json --watch",
|
|
13
|
+
"yalc:push": "yalc push --changed",
|
|
14
|
+
"yalc:show": "yalc installations show $npm_package_name"
|
|
12
15
|
},
|
|
13
16
|
"dependencies": {
|
|
14
17
|
"@emotion/native": "^11.0.0",
|
|
@@ -31,5 +34,5 @@
|
|
|
31
34
|
"react-native": "^0.64.0",
|
|
32
35
|
"react-native-vector-icons": "^8.1.0 || ^9.0.0"
|
|
33
36
|
},
|
|
34
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "41a7cd4c1031d3561019af3afffdc549f185ac02"
|
|
35
38
|
}
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
FontColorType,
|
|
8
8
|
FontStackType,
|
|
9
9
|
FontWeightType,
|
|
10
|
-
TypographyVariationType
|
|
10
|
+
TypographyVariationType
|
|
11
11
|
} from '../../../../types/defaults';
|
|
12
12
|
import { Text, TextProps } from '../../Text';
|
|
13
13
|
import {
|
|
14
14
|
StyledBorderKeeper,
|
|
15
15
|
StyledIconContent,
|
|
16
16
|
StyledInputContainer,
|
|
17
|
-
StyledLabelContainer
|
|
17
|
+
StyledLabelContainer
|
|
18
18
|
} from '../styled';
|
|
19
19
|
|
|
20
20
|
export type InputVariantType = 'default' | 'error' | 'success';
|
|
@@ -29,6 +29,7 @@ export interface TextProps {
|
|
|
29
29
|
textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize';
|
|
30
30
|
capitalFirst?: boolean;
|
|
31
31
|
style?: StyleProp<TextStyle>;
|
|
32
|
+
children?: React.ReactNode;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
/** NOTE: When using colors, be careful to not override fontColor by using colorVariant and colorTone, referent to theme colors and not text colors. */
|
package/src/utils/masks.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// NOTE: Add here all individually utils, then you can use it on input components everywhere.
|
|
2
|
+
import { extractDigitsFromString } from '@tecsinapse/react-core';
|
|
3
|
+
|
|
2
4
|
export const Masks = {
|
|
3
5
|
CPF: ['999.999.999-99'],
|
|
4
6
|
CNPJ: ['99.999.999/9999-99'],
|
|
@@ -7,9 +9,16 @@ export const Masks = {
|
|
|
7
9
|
CEP: ['99999-999'],
|
|
8
10
|
PHONE: ['(99) 9999-9999'],
|
|
9
11
|
PHONE_EXTENDED: ['(99) 99999-9999'],
|
|
10
|
-
COMBINED_PHONE: (value: string) =>
|
|
12
|
+
COMBINED_PHONE: (value: string) => {
|
|
13
|
+
const onlyNumbers = extractDigitsFromString(value);
|
|
14
|
+
// Value is number extended, but without mask.
|
|
15
|
+
const isCellPhoneExtended = onlyNumbers.length === 11;
|
|
16
|
+
|
|
11
17
|
// Value in formatted mode
|
|
12
|
-
value?.length <= 14
|
|
18
|
+
return value?.length <= 14 && !isCellPhoneExtended
|
|
19
|
+
? Masks.PHONE
|
|
20
|
+
: Masks.PHONE_EXTENDED;
|
|
21
|
+
},
|
|
13
22
|
COMBINED_CPF_CNPJ: (value: string) =>
|
|
14
23
|
value?.length <= 14 ? Masks.CPF : Masks.CNPJ,
|
|
15
24
|
};
|