@tecsinapse/react-core 1.16.3 → 1.16.6

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 CHANGED
@@ -3,6 +3,33 @@
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.6](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.16.5...@tecsinapse/react-core@1.16.6) (2022-07-14)
7
+
8
+ **Note:** Version bump only for package @tecsinapse/react-core
9
+
10
+
11
+
12
+
13
+
14
+ ## [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)
15
+
16
+ **Note:** Version bump only for package @tecsinapse/react-core
17
+
18
+
19
+
20
+
21
+
22
+ ## [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)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * added verification number extended without mask ([#177465](https://github.com/tecsinapse/design-system/issues/177465)) ([27ef33c](https://github.com/tecsinapse/design-system/commit/27ef33cb5fe25bd0a6ef00370650e81f71188f06))
28
+
29
+
30
+
31
+
32
+
6
33
  ## [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)
7
34
 
8
35
 
@@ -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,KA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E,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
+ {"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"}
@@ -2,6 +2,9 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.Masks = void 0;
5
+
6
+ var _extractNumbersFromString = require("./extractNumbersFromString");
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 => (value == null ? void 0 : value.length) <= 14 ? Masks.PHONE : Masks.PHONE_EXTENDED,
16
+ COMBINED_PHONE: value => {
17
+ const onlyNumbers = (0, _extractNumbersFromString.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;
@@ -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":";;;;AACO,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,IAEd,CAAAA,KAAK,QAAL,YAAAA,KAAK,CAAEC,MAAP,KAAiB,EAAjB,GAAsBV,KAAK,CAACM,KAA5B,GAAoCN,KAAK,CAACO,cAVzB;AAWnBI,EAAAA,iBAAiB,EAAGF,KAAD,IACjB,CAAAA,KAAK,QAAL,YAAAA,KAAK,CAAEC,MAAP,KAAiB,EAAjB,GAAsBV,KAAK,CAACC,GAA5B,GAAkCD,KAAK,CAACE;AAZvB,CAAd","sourcesContent":["// NOTE: Add here all individually utils, then you can use it on input components everywhere.\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 // Value in formatted mode\n value?.length <= 14 ? Masks.PHONE : Masks.PHONE_EXTENDED,\n COMBINED_CPF_CNPJ: (value: string) =>\n value?.length <= 14 ? Masks.CPF : Masks.CNPJ,\n};\n"],"file":"masks.js"}
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,uDAAwBD,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 './extractNumbersFromString';\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,7 +1,7 @@
1
1
  {
2
2
  "name": "@tecsinapse/react-core",
3
3
  "description": "TecSinapse hybrid React components",
4
- "version": "1.16.3",
4
+ "version": "1.16.6",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -34,5 +34,5 @@
34
34
  "react-native": "^0.64.0",
35
35
  "react-native-vector-icons": "^8.1.0 || ^9.0.0"
36
36
  },
37
- "gitHead": "190dab1b92539a51f19411f1102bdd9ee67c9959"
37
+ "gitHead": "e1145c70e523ec9a232d369ea9b6fac69e7733ba"
38
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';
@@ -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 './extractNumbersFromString';
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 ? Masks.PHONE : Masks.PHONE_EXTENDED,
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
  };