@tecsinapse/react-core 1.16.1 → 1.16.4

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,39 @@
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.4](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.16.3...@tecsinapse/react-core@1.16.4) (2022-06-24)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * added verification number extended without mask ([#177465](https://github.com/tecsinapse/design-system/issues/177465)) ([27ef33c](https://github.com/tecsinapse/design-system/commit/27ef33cb5fe25bd0a6ef00370650e81f71188f06))
12
+
13
+
14
+
15
+
16
+
17
+ ## [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)
18
+
19
+
20
+ ### Features
21
+
22
+ * automation yalc for develop local ([9c6f1bb](https://github.com/tecsinapse/design-system/commit/9c6f1bbf0ea4bbacd194e4cf5c338405b94a9686))
23
+
24
+
25
+
26
+
27
+
28
+ ## [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)
29
+
30
+
31
+ ### Features
32
+
33
+ * add capital option to text component ([56821ee](https://github.com/tecsinapse/design-system/commit/56821ee96eefc13a0b93d9b8b2d61af1be65e705))
34
+
35
+
36
+
37
+
38
+
6
39
  ## [1.16.1](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.16.0...@tecsinapse/react-core@1.16.1) (2022-05-24)
7
40
 
8
41
  **Note:** Version bump only for package @tecsinapse/react-core
@@ -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 {
@@ -10,7 +10,10 @@ export interface TextProps {
10
10
  colorTone?: ColorGradationType;
11
11
  numberOfLines?: number;
12
12
  ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip';
13
+ textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize';
14
+ capitalFirst?: boolean;
13
15
  style?: StyleProp<TextStyle>;
16
+ children?: React.ReactNode;
14
17
  }
15
18
  declare const Text: FC<TextProps>;
16
19
  export default Text;
@@ -7,6 +7,8 @@ var _react = _interopRequireDefault(require("react"));
7
7
 
8
8
  var _styled = require("./styled");
9
9
 
10
+ var _functions = require("./functions");
11
+
10
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
13
 
12
14
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -21,6 +23,8 @@ const Text = ({
21
23
  typography = 'base',
22
24
  numberOfLines,
23
25
  ellipsizeMode,
26
+ textTransform = 'none',
27
+ capitalFirst = false,
24
28
  ...rest
25
29
  }) => {
26
30
  return _react.default.createElement(_styled.StyledColoredText, _extends({}, rest, {
@@ -31,8 +35,9 @@ const Text = ({
31
35
  fontWeight: fontWeight,
32
36
  typography: typography,
33
37
  numberOfLines: numberOfLines,
34
- ellipsizeMode: ellipsizeMode
35
- }), children);
38
+ ellipsizeMode: ellipsizeMode,
39
+ textTransform: textTransform
40
+ }), (0, _functions.getLabel)(children, capitalFirst));
36
41
  };
37
42
 
38
43
  var _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","rest"],"mappings":";;;;;AAAA;;AAUA;;;;;;AAqBA,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;AAU3B,KAAGC;AAVwB,CAAD,KAWT;AACjB,SACE,6BAAC,yBAAD,eACMA,IADN;AAEE,IAAA,KAAK,EAAER,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,MAWGR,QAXH,CADF;AAeD,CA3BD;;eA6BeD,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';\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 style?: StyleProp<TextStyle>;\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 ...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 >\n {children}\n </StyledColoredText>\n );\n};\n\nexport default Text;\n"],"file":"Text.js"}
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"}
@@ -0,0 +1,2 @@
1
+ export declare const getFirstCapitalCharacter: (value: string) => string;
2
+ export declare const getLabel: (children: any, capitalFirst: boolean) => any;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.getLabel = exports.getFirstCapitalCharacter = void 0;
5
+
6
+ const getFirstCapitalCharacter = value => value.charAt(0).toUpperCase().concat(value.slice(1));
7
+
8
+ exports.getFirstCapitalCharacter = getFirstCapitalCharacter;
9
+
10
+ const getLabel = (children, capitalFirst) => typeof children === 'string' && capitalFirst ? getFirstCapitalCharacter(children) : children;
11
+
12
+ exports.getLabel = getLabel;
13
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/atoms/Text/functions.ts"],"names":["getFirstCapitalCharacter","value","charAt","toUpperCase","concat","slice","getLabel","children","capitalFirst"],"mappings":";;;;;AAAO,MAAMA,wBAAwB,GAAIC,KAAD,IACtCA,KAAK,CAACC,MAAN,CAAa,CAAb,EAAgBC,WAAhB,GAA8BC,MAA9B,CAAqCH,KAAK,CAACI,KAAN,CAAY,CAAZ,CAArC,CADK;;;;AAIA,MAAMC,QAAQ,GAAG,CAACC,QAAD,EAAWC,YAAX,KACtB,OAAOD,QAAP,KAAoB,QAApB,IAAgCC,YAAhC,GACIR,wBAAwB,CAACO,QAAD,CAD5B,GAEIA,QAHC","sourcesContent":["export const getFirstCapitalCharacter = (value: string): string =>\n value.charAt(0).toUpperCase().concat(value.slice(1));\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport const getLabel = (children, capitalFirst: boolean) =>\n typeof children === 'string' && capitalFirst\n ? getFirstCapitalCharacter(children)\n : children;\n"],"file":"functions.js"}
@@ -32,6 +32,9 @@ const StyledText = (0, _native.default)(_reactNative.Text)`
32
32
  theme,
33
33
  fontStack = 'default'
34
34
  }) => `'${theme.font.stack[fontStack]}'`};
35
+ text-transform: ${({
36
+ textTransform = 'none'
37
+ }) => `${textTransform}`};
35
38
  `;
36
39
  exports.StyledText = StyledText;
37
40
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/Text/styled.ts"],"names":["StyledText","RNText","theme","fontColor","font","color","fontWeight","weight","typography","fontSize","lineHeight","fontStack","stack","colorStyles","colorVariant","colorTone","StyledColoredText"],"mappings":";;;;;AAAA;;AAEA;;;;;;AAEO,MAAMA,UAAU,GAAG,qBAAOC,iBAAP,CAAgD;AAC1E,WAAW,CAAC;AAAEC,EAAAA,KAAF;AAASC,EAAAA,SAAS,GAAG;AAArB,CAAD,KAAmCD,KAAK,CAACE,IAAN,CAAWC,KAAX,CAAiBF,SAAjB,CAA4B;AAC1E,iBAAiB,CAAC;AAAED,EAAAA,KAAF;AAASI,EAAAA,UAAU,GAAG;AAAtB,CAAD,KACbJ,KAAK,CAACE,IAAN,CAAWG,MAAX,CAAkBD,UAAlB,CAA8B;AAClC,eAAe,CAAC;AAAEJ,EAAAA,KAAF;AAASM,EAAAA,UAAU,GAAG;AAAtB,CAAD,KACXN,KAAK,CAACM,UAAN,CAAiBA,UAAjB,EAA6BC,QAAS;AAC1C,iBAAiB,CAAC;AAAEP,EAAAA,KAAF;AAASM,EAAAA,UAAU,GAAG;AAAtB,CAAD,KACbN,KAAK,CAACM,UAAN,CAAiBA,UAAjB,EAA6BE,UAAW;AAC5C,iBAAiB,CAAC;AAAER,EAAAA,KAAF;AAASS,EAAAA,SAAS,GAAG;AAArB,CAAD,KACZ,IAAGT,KAAK,CAACE,IAAN,CAAWQ,KAAX,CAAiBD,SAAjB,CAA4B,GAAG;AACvC,CAVO;;;AAYP,MAAME,WAAW,GAAG,CAAC;AACnBC,EAAAA,YADmB;AAEnBC,EAAAA,SAFmB;AAGnBb,EAAAA;AAHmB,CAAD,KAKlBY,YAAY,IACZC,SADA,IAEA,gBAAI;AACN,aAAab,KAAK,CAACG,KAAN,CAAYS,YAAZ,EAA0BC,SAA1B,CAAqC;AAClD,GATA;;AAWO,MAAMC,iBAAiB,GAAG,qBAAOhB,UAAP,EAE/Ba,WAF+B,CAA1B","sourcesContent":["import styled, { css } from '@emotion/native';\nimport { StyleProps, TextProps } from '@tecsinapse/react-core';\nimport { Text as RNText } from 'react-native';\n\nexport const StyledText = styled(RNText)<TextProps & Partial<StyleProps>>`\n color: ${({ theme, fontColor = 'dark' }) => theme.font.color[fontColor]};\n font-weight: ${({ theme, fontWeight = 'regular' }) =>\n theme.font.weight[fontWeight]};\n font-size: ${({ theme, typography = 'base' }) =>\n theme.typography[typography].fontSize};\n line-height: ${({ theme, typography = 'base' }) =>\n theme.typography[typography].lineHeight};\n font-family: ${({ theme, fontStack = 'default' }) =>\n `'${theme.font.stack[fontStack]}'`};\n`;\n\nconst colorStyles = ({\n colorVariant,\n colorTone,\n theme,\n}: TextProps & StyleProps) =>\n colorVariant &&\n colorTone &&\n css`\n color: ${theme.color[colorVariant][colorTone]};\n `;\n\nexport const StyledColoredText = styled(StyledText)<\n TextProps & Partial<StyleProps>\n>(colorStyles);\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/Text/styled.ts"],"names":["StyledText","RNText","theme","fontColor","font","color","fontWeight","weight","typography","fontSize","lineHeight","fontStack","stack","textTransform","colorStyles","colorVariant","colorTone","StyledColoredText"],"mappings":";;;;;AAAA;;AAEA;;;;;;AAEO,MAAMA,UAAU,GAAG,qBAAOC,iBAAP,CAAgD;AAC1E,WAAW,CAAC;AAAEC,EAAAA,KAAF;AAASC,EAAAA,SAAS,GAAG;AAArB,CAAD,KAAmCD,KAAK,CAACE,IAAN,CAAWC,KAAX,CAAiBF,SAAjB,CAA4B;AAC1E,iBAAiB,CAAC;AAAED,EAAAA,KAAF;AAASI,EAAAA,UAAU,GAAG;AAAtB,CAAD,KACbJ,KAAK,CAACE,IAAN,CAAWG,MAAX,CAAkBD,UAAlB,CAA8B;AAClC,eAAe,CAAC;AAAEJ,EAAAA,KAAF;AAASM,EAAAA,UAAU,GAAG;AAAtB,CAAD,KACXN,KAAK,CAACM,UAAN,CAAiBA,UAAjB,EAA6BC,QAAS;AAC1C,iBAAiB,CAAC;AAAEP,EAAAA,KAAF;AAASM,EAAAA,UAAU,GAAG;AAAtB,CAAD,KACbN,KAAK,CAACM,UAAN,CAAiBA,UAAjB,EAA6BE,UAAW;AAC5C,iBAAiB,CAAC;AAAER,EAAAA,KAAF;AAASS,EAAAA,SAAS,GAAG;AAArB,CAAD,KACZ,IAAGT,KAAK,CAACE,IAAN,CAAWQ,KAAX,CAAiBD,SAAjB,CAA4B,GAAG;AACvC,oBAAoB,CAAC;AAAEE,EAAAA,aAAa,GAAG;AAAlB,CAAD,KAAiC,GAAEA,aAAc,EAAE;AACvE,CAXO;;;AAaP,MAAMC,WAAW,GAAG,CAAC;AACnBC,EAAAA,YADmB;AAEnBC,EAAAA,SAFmB;AAGnBd,EAAAA;AAHmB,CAAD,KAKlBa,YAAY,IACZC,SADA,IAEA,gBAAI;AACN,aAAad,KAAK,CAACG,KAAN,CAAYU,YAAZ,EAA0BC,SAA1B,CAAqC;AAClD,GATA;;AAWO,MAAMC,iBAAiB,GAAG,qBAAOjB,UAAP,EAE/Bc,WAF+B,CAA1B","sourcesContent":["import styled, { css } from '@emotion/native';\nimport { StyleProps, TextProps } from '@tecsinapse/react-core';\nimport { Text as RNText } from 'react-native';\n\nexport const StyledText = styled(RNText)<TextProps & Partial<StyleProps>>`\n color: ${({ theme, fontColor = 'dark' }) => theme.font.color[fontColor]};\n font-weight: ${({ theme, fontWeight = 'regular' }) =>\n theme.font.weight[fontWeight]};\n font-size: ${({ theme, typography = 'base' }) =>\n theme.typography[typography].fontSize};\n line-height: ${({ theme, typography = 'base' }) =>\n theme.typography[typography].lineHeight};\n font-family: ${({ theme, fontStack = 'default' }) =>\n `'${theme.font.stack[fontStack]}'`};\n text-transform: ${({ textTransform = 'none' }) => `${textTransform}`};\n`;\n\nconst colorStyles = ({\n colorVariant,\n colorTone,\n theme,\n}: TextProps & StyleProps) =>\n colorVariant &&\n colorTone &&\n css`\n color: ${theme.color[colorVariant][colorTone]};\n `;\n\nexport const StyledColoredText = styled(StyledText)<\n TextProps & Partial<StyleProps>\n>(colorStyles);\n"],"file":"styled.js"}
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare type Color = {
2
3
  primary: ColorGradation;
3
4
  secondary: ColorGradation;
@@ -111,6 +112,7 @@ export declare type ThemeProp = {
111
112
  zIndex: ZIndex;
112
113
  };
113
114
  export interface ThemeProviderProps {
115
+ children?: React.ReactNode;
114
116
  theme: ThemeProp;
115
117
  }
116
118
  export declare type StyleProps = ThemeProviderProps;
@@ -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 => (value == null ? void 0 : value.length) <= 14 ? Masks.PHONE : Masks.PHONE_EXTENDED,
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;
@@ -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,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.1",
4
+ "version": "1.16.4",
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: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"
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": "f4d635a35883748ec2594557606c00e2822a1ad6"
37
+ "gitHead": "ab944cad9dc3a840ebf3ebc9ed525926ebe3a436"
35
38
  }
@@ -9,6 +9,7 @@ import {
9
9
  } from '@tecsinapse/react-core';
10
10
  import { StyleProp, TextStyle } from 'react-native';
11
11
  import { StyledColoredText } from './styled';
12
+ import { getLabel } from './functions';
12
13
 
13
14
  export interface TextProps {
14
15
  /** Font theme text color */
@@ -25,7 +26,10 @@ export interface TextProps {
25
26
  colorTone?: ColorGradationType;
26
27
  numberOfLines?: number;
27
28
  ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip';
29
+ textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize';
30
+ capitalFirst?: boolean;
28
31
  style?: StyleProp<TextStyle>;
32
+ children?: React.ReactNode;
29
33
  }
30
34
 
31
35
  /** NOTE: When using colors, be careful to not override fontColor by using colorVariant and colorTone, referent to theme colors and not text colors. */
@@ -39,6 +43,8 @@ const Text: FC<TextProps> = ({
39
43
  typography = 'base',
40
44
  numberOfLines,
41
45
  ellipsizeMode,
46
+ textTransform = 'none',
47
+ capitalFirst = false,
42
48
  ...rest
43
49
  }): JSX.Element => {
44
50
  return (
@@ -52,8 +58,9 @@ const Text: FC<TextProps> = ({
52
58
  typography={typography}
53
59
  numberOfLines={numberOfLines}
54
60
  ellipsizeMode={ellipsizeMode}
61
+ textTransform={textTransform}
55
62
  >
56
- {children}
63
+ {getLabel(children, capitalFirst)}
57
64
  </StyledColoredText>
58
65
  );
59
66
  };
@@ -0,0 +1,8 @@
1
+ export const getFirstCapitalCharacter = (value: string): string =>
2
+ value.charAt(0).toUpperCase().concat(value.slice(1));
3
+
4
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
5
+ export const getLabel = (children, capitalFirst: boolean) =>
6
+ typeof children === 'string' && capitalFirst
7
+ ? getFirstCapitalCharacter(children)
8
+ : children;
@@ -12,6 +12,7 @@ export const StyledText = styled(RNText)<TextProps & Partial<StyleProps>>`
12
12
  theme.typography[typography].lineHeight};
13
13
  font-family: ${({ theme, fontStack = 'default' }) =>
14
14
  `'${theme.font.stack[fontStack]}'`};
15
+ text-transform: ${({ textTransform = 'none' }) => `${textTransform}`};
15
16
  `;
16
17
 
17
18
  const colorStyles = ({
@@ -125,6 +125,7 @@ export type ThemeProp = {
125
125
  };
126
126
 
127
127
  export interface ThemeProviderProps {
128
+ children?: React.ReactNode;
128
129
  theme: ThemeProp;
129
130
  }
130
131
 
@@ -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 ? 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
  };