@tecsinapse/react-native-kit 1.6.4 → 1.7.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 CHANGED
@@ -3,6 +3,42 @@
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.7.2](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.7.1...@tecsinapse/react-native-kit@1.7.2) (2021-09-24)
7
+
8
+ **Note:** Version bump only for package @tecsinapse/react-native-kit
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.7.1](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.7.0...@tecsinapse/react-native-kit@1.7.1) (2021-09-24)
15
+
16
+ **Note:** Version bump only for package @tecsinapse/react-native-kit
17
+
18
+
19
+
20
+
21
+
22
+ # [1.7.0](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.6.5...@tecsinapse/react-native-kit@1.7.0) (2021-09-21)
23
+
24
+
25
+ ### Features
26
+
27
+ * text area ([35ce0ba](https://github.com/tecsinapse/design-system/commit/35ce0ba36aeb9c3d90db19d077e0741e417c65e0))
28
+ * text area hybrid ([f16d074](https://github.com/tecsinapse/design-system/commit/f16d074a71bbea3b1bbc4c4e3933a124b0f1e064))
29
+
30
+
31
+
32
+
33
+
34
+ ## [1.6.5](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.6.4...@tecsinapse/react-native-kit@1.6.5) (2021-09-20)
35
+
36
+ **Note:** Version bump only for package @tecsinapse/react-native-kit
37
+
38
+
39
+
40
+
41
+
6
42
  ## [1.6.4](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.6.3...@tecsinapse/react-native-kit@1.6.4) (2021-09-16)
7
43
 
8
44
  **Note:** Version bump only for package @tecsinapse/react-native-kit
@@ -1,10 +1,6 @@
1
- import { FontStackType, FontWeightType, InputContainerProps, InputElementProps } from '@tecsinapse/react-core';
2
1
  import { FC } from 'react';
3
- export interface TextAreaProps extends Omit<InputElementProps, 'style' | 'multiline' | 'value'>, InputContainerProps {
4
- inputFontStack?: FontStackType;
5
- inputFontWeight?: FontWeightType;
6
- maxCharCount?: number;
7
- value: string;
2
+ import { TextAreaProps as ITACore } from '@tecsinapse/react-core';
3
+ export interface TextAreaProps extends Omit<ITACore, 'TextComponent' | 'focused'> {
8
4
  }
9
5
  declare const TextArea: FC<TextAreaProps>;
10
6
  export default TextArea;
@@ -5,11 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _reactCore = require("@tecsinapse/react-core");
9
-
10
8
  var _react = _interopRequireDefault(require("react"));
11
9
 
12
- var _reactNative = require("react-native");
10
+ var _reactCore = require("@tecsinapse/react-core");
13
11
 
14
12
  var _Text = require("../Text");
15
13
 
@@ -41,29 +39,16 @@ const TextArea = ({
41
39
  hint,
42
40
  onFocus,
43
41
  onBlur,
42
+ value,
43
+ maxLength,
44
44
  ...rest
45
45
  }) => {
46
- let length = rest.value.length;
47
- const maxLength = rest.maxLength;
48
-
49
- if (maxLength && length > maxLength) {
50
- length = maxLength;
51
- }
52
-
53
- const _hint = hintComponent || _react.default.createElement(_reactCore.Hint, {
54
- TextComponent: _Text.Text,
55
- text: hint,
56
- variant: variant
57
- });
58
-
59
46
  const {
60
47
  focused,
61
48
  handleBlur,
62
49
  handleFocus
63
50
  } = (0, _reactCore.useInputFocus)(onFocus, onBlur, !disabled);
64
- return _react.default.createElement(_reactNative.View, {
65
- style: style
66
- }, _react.default.createElement(_styled.StyledInputContainer, {
51
+ return _react.default.createElement(_reactCore.TextArea, {
67
52
  label: label,
68
53
  labelColor: labelColor,
69
54
  labelColorVariant: labelColorVariant,
@@ -79,7 +64,13 @@ const TextArea = ({
79
64
  inputContainerStyle: inputContainerStyle,
80
65
  focused: focused,
81
66
  disabled: disabled,
82
- variant: variant
67
+ variant: variant,
68
+ value: value,
69
+ hintComponent: hintComponent,
70
+ hint: hint,
71
+ style: style,
72
+ TextComponent: _Text.Text,
73
+ maxLength: maxLength
83
74
  }, _react.default.createElement(_styled.StyledNativeInput, _extends({}, rest, {
84
75
  fontStack: inputFontStack,
85
76
  fontWeight: inputFontWeight,
@@ -87,14 +78,10 @@ const TextArea = ({
87
78
  onFocus: handleFocus,
88
79
  onBlur: handleBlur,
89
80
  textAlignVertical: 'top',
90
- multiline: true
91
- })), maxLength && _react.default.createElement(_styled.CharCountText, {
92
- colorVariant: 'secondary',
93
- colorTone: 'medium',
94
- typography: 'label',
95
- fontStack: 'default',
96
- fontWeight: 'bold'
97
- }, `${length}/${maxLength}`)), hint && _hint);
81
+ multiline: true,
82
+ value: value,
83
+ maxLength: maxLength
84
+ })));
98
85
  };
99
86
 
100
87
  var _default = TextArea;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/TextArea/TextArea.tsx"],"names":["TextArea","label","labelColor","labelColorVariant","labelColorTone","labelTypography","labelStack","labelWeight","leftComponent","rightComponent","disabled","style","borderColor","borderColorGradation","inputFontStack","inputFontWeight","inputContainerStyle","variant","hintComponent","hint","onFocus","onBlur","rest","length","value","maxLength","_hint","Text","focused","handleBlur","handleFocus"],"mappings":";;;;;;;AAAA;;AAQA;;AACA;;AACA;;AACA;;;;;;AAeA,MAAMA,QAA2B,GAAG,CAAC;AACnCC,EAAAA,KADmC;AAEnCC,EAAAA,UAFmC;AAGnCC,EAAAA,iBAHmC;AAInCC,EAAAA,cAJmC;AAKnCC,EAAAA,eALmC;AAMnCC,EAAAA,UANmC;AAOnCC,EAAAA,WAPmC;AAQnCC,EAAAA,aARmC;AASnCC,EAAAA,cATmC;AAUnCC,EAAAA,QAVmC;AAWnCC,EAAAA,KAXmC;AAYnCC,EAAAA,WAZmC;AAanCC,EAAAA,oBAbmC;AAcnCC,EAAAA,cAAc,GAAG,SAdkB;AAenCC,EAAAA,eAAe,GAAG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,IAAA,QAAQ,EAAElB,QAfZ;AAgBE,IAAA,OAAO,EAAEO;AAhBX,KAkBE,6BAAC,yBAAD,eACMK,IADN;AAEE,IAAA,SAAS,EAAER,cAFb;AAGE,IAAA,UAAU,EAAEC,eAHd;AAIE,IAAA,QAAQ,EAAEL,QAJZ;AAKE,IAAA,OAAO,EAAEoB,WALX;AAME,IAAA,MAAM,EAAED,UANV;AAOE,IAAA,iBAAiB,EAAE,KAPrB;AAQE,IAAA,SAAS;AARX,KAlBF,EA4BGJ,SAAS,IACR,6BAAC,qBAAD;AACE,IAAA,YAAY,EAAE,WADhB;AAEE,IAAA,SAAS,EAAE,QAFb;AAGE,IAAA,UAAU,EAAE,OAHd;AAIE,IAAA,SAAS,EAAE,SAJb;AAKE,IAAA,UAAU,EAAE;AALd,KAOI,GAAEF,MAAO,IAAGE,SAAU,EAP1B,CA7BJ,CADF,EAyCGN,IAAI,IAAIO,KAzCX,CADF;AA6CD,CArFD;;eAuFe1B,Q","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 {\n CharCountText,\n StyledInputContainer,\n StyledNativeInput,\n} from './styled';\n\nexport interface TextAreaProps\n extends Omit<InputElementProps, 'style' | 'multiline' | 'value'>,\n InputContainerProps {\n inputFontStack?: FontStackType;\n inputFontWeight?: FontWeightType;\n maxCharCount?: number;\n value: string;\n}\n\nconst TextArea: FC<TextAreaProps> = ({\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 ...rest\n}) => {\n let length = rest.value.length;\n const maxLength = rest.maxLength;\n if (maxLength && length > maxLength) {\n length = maxLength;\n }\n\n const _hint = hintComponent || (\n <Hint TextComponent={Text} text={hint} variant={variant} />\n );\n\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n return (\n <View style={style}>\n <StyledInputContainer\n label={label}\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 fontStack={inputFontStack}\n fontWeight={inputFontWeight}\n disabled={disabled}\n onFocus={handleFocus}\n onBlur={handleBlur}\n textAlignVertical={'top'}\n multiline\n />\n {maxLength && (\n <CharCountText\n colorVariant={'secondary'}\n colorTone={'medium'}\n typography={'label'}\n fontStack={'default'}\n fontWeight={'bold'}\n >\n {`${length}/${maxLength}`}\n </CharCountText>\n )}\n </StyledInputContainer>\n {hint && _hint}\n </View>\n );\n};\n\nexport default TextArea;\n"],"file":"TextArea.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/TextArea/TextArea.tsx"],"names":["TextArea","label","labelColor","labelColorVariant","labelColorTone","labelTypography","labelStack","labelWeight","leftComponent","rightComponent","disabled","style","borderColor","borderColorGradation","inputFontStack","inputFontWeight","inputContainerStyle","variant","hintComponent","hint","onFocus","onBlur","value","maxLength","rest","focused","handleBlur","handleFocus","Text"],"mappings":";;;;;;;AAAA;;AACA;;AAKA;;AACA;;;;;;AAKA,MAAMA,QAA2B,GAAG,CAAC;AACnCC,EAAAA,KADmC;AAEnCC,EAAAA,UAFmC;AAGnCC,EAAAA,iBAHmC;AAInCC,EAAAA,cAJmC;AAKnCC,EAAAA,eALmC;AAMnCC,EAAAA,UANmC;AAOnCC,EAAAA,WAPm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EC,IAnBR;AAoBE,IAAA,KAAK,EAAER,KApBT;AAqBE,IAAA,aAAa,EAAEiB,UArBjB;AAsBE,IAAA,SAAS,EAAEL;AAtBb,KAwBE,6BAAC,yBAAD,eACMC,IADN;AAEE,IAAA,SAAS,EAAEV,cAFb;AAGE,IAAA,UAAU,EAAEC,eAHd;AAIE,IAAA,QAAQ,EAAEL,QAJZ;AAKE,IAAA,OAAO,EAAEiB,WALX;AAME,IAAA,MAAM,EAAED,UANV;AAOE,IAAA,iBAAiB,EAAE,KAPrB;AAQE,IAAA,SAAS,MARX;AASE,IAAA,KAAK,EAAEJ,KATT;AAUE,IAAA,SAAS,EAAEC;AAVb,KAxBF,CADF;AAuCD,CAvED;;eAyEevB,Q","sourcesContent":["import React, { FC } from 'react';\nimport {\n useInputFocus,\n TextAreaProps as ITACore,\n TextArea as TACore,\n} from '@tecsinapse/react-core';\nimport { Text } from '../Text';\nimport { StyledNativeInput } from './styled';\n\nexport interface TextAreaProps\n extends Omit<ITACore, 'TextComponent' | 'focused'> {}\n\nconst TextArea: FC<TextAreaProps> = ({\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 maxLength,\n ...rest\n}) => {\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n return (\n <TACore\n label={label}\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 value={value}\n hintComponent={hintComponent}\n hint={hint}\n style={style}\n TextComponent={Text}\n maxLength={maxLength}\n >\n <StyledNativeInput\n {...rest}\n fontStack={inputFontStack}\n fontWeight={inputFontWeight}\n disabled={disabled}\n onFocus={handleFocus}\n onBlur={handleBlur}\n textAlignVertical={'top'}\n multiline\n value={value}\n maxLength={maxLength}\n />\n </TACore>\n );\n};\n\nexport default TextArea;\n"],"file":"TextArea.js"}
@@ -1,6 +1,4 @@
1
1
  /// <reference types="react" />
2
- export declare const StyledInputContainer: import("@emotion/native").StyledComponent<any, {}, {
2
+ export declare const StyledNativeInput: import("@emotion/native").StyledComponent<any, {}, {
3
3
  ref?: import("react").Ref<any> | undefined;
4
4
  }>;
5
- export declare const StyledNativeInput: import("@emotion/native").StyledComponent<any, {}, {}>;
6
- export declare const CharCountText: import("@emotion/native").StyledComponent<any, {}, {}>;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.CharCountText = exports.StyledNativeInput = exports.StyledInputContainer = void 0;
6
+ exports.StyledNativeInput = void 0;
7
7
 
8
8
  var _native = _interopRequireDefault(require("@emotion/native"));
9
9
 
@@ -11,27 +11,8 @@ var _reactCore = require("@tecsinapse/react-core");
11
11
 
12
12
  var _styled = require("../Text/styled");
13
13
 
14
- var _Text = require("../Text");
15
-
16
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
15
 
18
- const StyledInputContainer = (0, _native.default)(_reactCore.InputContainer)`
19
- min-height: 50px;
20
- `;
21
- exports.StyledInputContainer = StyledInputContainer;
22
- const StyledNativeInputBase = (0, _native.default)(_reactCore.InputElement)`
23
- max-height: ${({
24
- theme,
25
- numberOfLines
26
- }) => `${(0, _reactCore.extractNumbersFromString)(theme.typography.h5.lineHeight) * (numberOfLines || 1)}px`};
27
- width: 100%;
28
- padding: 0;
29
- margin: 3px 0;
30
- `;
31
- const StyledNativeInput = (0, _native.default)(StyledNativeInputBase)(_styled.fontStyles);
16
+ const StyledNativeInput = (0, _native.default)(_reactCore.TextAreaInputBase)(_styled.fontStyles);
32
17
  exports.StyledNativeInput = StyledNativeInput;
33
- const CharCountText = (0, _native.default)(_Text.Text)`
34
- text-align: right;
35
- `;
36
- exports.CharCountText = CharCountText;
37
18
  //# sourceMappingURL=styled.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/TextArea/styled.ts"],"names":["StyledInputContainer","InputContainer","StyledNativeInputBase","InputElement","theme","numberOfLines","typography","h5","lineHeight","StyledNativeInput","fontStyles","CharCountText","Text"],"mappings":";;;;;;;AAAA;;AACA;;AAMA;;AAEA;;;;AAEO,MAAMA,oBAAoB,GAAG,qBAAOC,yBAAP,CAA4C;AAChF;AACA,CAFO;;AAIP,MAAMC,qBAAqB,GAAG,qBAAOC,uBAAP,CAE5B;AACF,gBAAgB,CAAC;AAAEC,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAAD,KACX,GACC,yCAAyBD,KAAK,CAACE,UAAN,CAAiBC,EAAjB,CAAoBC,UAA7C,KACCH,aAAa,IAAI,CADlB,CAED,IAAI;AACT;AACA;AACA;AACA,CAXA;AAaO,MAAMI,iBAAiB,GAAG,qBAAOP,qBAAP,EAE/BQ,kBAF+B,CAA1B;;AAIA,MAAMC,aAAa,GAAG,qBAAOC,UAAP,CAA8B;AAC3D;AACA,CAFO","sourcesContent":["import styled from '@emotion/native';\nimport {\n extractNumbersFromString,\n InputContainer,\n InputElement,\n StyleProps,\n} from '@tecsinapse/react-core';\nimport { Font, fontStyles } from '../Text/styled';\nimport { TextAreaProps } from './TextArea';\nimport { Text, TextNativeProps } from '../Text';\n\nexport const StyledInputContainer = styled(InputContainer)<Partial<StyleProps>>`\n min-height: 50px;\n`;\n\nconst StyledNativeInputBase = styled(InputElement)<\n Partial<TextAreaProps> & Partial<StyleProps>\n>`\n max-height: ${({ theme, numberOfLines }) =>\n `${\n extractNumbersFromString(theme.typography.h5.lineHeight) *\n (numberOfLines || 1)\n }px`};\n width: 100%;\n padding: 0;\n margin: 3px 0;\n`;\n\nexport const StyledNativeInput = styled(StyledNativeInputBase)<\n Font & Partial<TextAreaProps> & Partial<StyleProps>\n>(fontStyles);\n\nexport const CharCountText = styled(Text)<TextNativeProps>`\n text-align: right;\n`;\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/TextArea/styled.ts"],"names":["StyledNativeInput","TextAreaInputBase","fontStyles"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAGO,MAAMA,iBAAiB,GAAG,qBAAOC,4BAAP,EAE/BC,kBAF+B,CAA1B","sourcesContent":["import styled from '@emotion/native';\nimport { StyleProps, TextAreaInputBase } from '@tecsinapse/react-core';\nimport { Font, fontStyles } from '../Text/styled';\nimport { TextAreaProps } from './TextArea';\n\nexport const StyledNativeInput = styled(TextAreaInputBase)<\n Font & Partial<TextAreaProps> & Partial<StyleProps>\n>(fontStyles);\n"],"file":"styled.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.6.4",
4
+ "version": "1.7.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.6.4"
16
+ "@tecsinapse/react-core": "^1.7.2"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
@@ -29,5 +29,5 @@
29
29
  "react-native": ">=0.64.0",
30
30
  "react-native-vector-icons": ">=8.1.0"
31
31
  },
32
- "gitHead": "65433c5b787f8dc03fbdeaa1c6414481f21086ee"
32
+ "gitHead": "9802bc60d7d24c13f818f7459441a87d7d2d6d70"
33
33
  }
@@ -1,28 +1,14 @@
1
+ import React, { FC } from 'react';
1
2
  import {
2
- FontStackType,
3
- FontWeightType,
4
- Hint,
5
- InputContainerProps,
6
- InputElementProps,
7
3
  useInputFocus,
4
+ TextAreaProps as ITACore,
5
+ TextArea as TACore,
8
6
  } from '@tecsinapse/react-core';
9
- import React, { FC } from 'react';
10
- import { View } from 'react-native';
11
7
  import { Text } from '../Text';
12
- import {
13
- CharCountText,
14
- StyledInputContainer,
15
- StyledNativeInput,
16
- } from './styled';
8
+ import { StyledNativeInput } from './styled';
17
9
 
18
10
  export interface TextAreaProps
19
- extends Omit<InputElementProps, 'style' | 'multiline' | 'value'>,
20
- InputContainerProps {
21
- inputFontStack?: FontStackType;
22
- inputFontWeight?: FontWeightType;
23
- maxCharCount?: number;
24
- value: string;
25
- }
11
+ extends Omit<ITACore, 'TextComponent' | 'focused'> {}
26
12
 
27
13
  const TextArea: FC<TextAreaProps> = ({
28
14
  label,
@@ -46,18 +32,10 @@ const TextArea: FC<TextAreaProps> = ({
46
32
  hint,
47
33
  onFocus,
48
34
  onBlur,
35
+ value,
36
+ maxLength,
49
37
  ...rest
50
38
  }) => {
51
- let length = rest.value.length;
52
- const maxLength = rest.maxLength;
53
- if (maxLength && length > maxLength) {
54
- length = maxLength;
55
- }
56
-
57
- const _hint = hintComponent || (
58
- <Hint TextComponent={Text} text={hint} variant={variant} />
59
- );
60
-
61
39
  const { focused, handleBlur, handleFocus } = useInputFocus(
62
40
  onFocus,
63
41
  onBlur,
@@ -65,49 +43,43 @@ const TextArea: FC<TextAreaProps> = ({
65
43
  );
66
44
 
67
45
  return (
68
- <View style={style}>
69
- <StyledInputContainer
70
- label={label}
71
- labelColor={labelColor}
72
- labelColorVariant={labelColorVariant}
73
- labelColorTone={labelColorTone}
74
- labelTypography={labelTypography}
75
- labelStack={labelStack}
76
- labelWeight={labelWeight}
77
- LabelComponent={Text}
78
- leftComponent={leftComponent}
79
- rightComponent={rightComponent}
80
- borderColor={borderColor}
81
- borderColorGradation={borderColorGradation}
82
- inputContainerStyle={inputContainerStyle}
83
- focused={focused}
46
+ <TACore
47
+ label={label}
48
+ labelColor={labelColor}
49
+ labelColorVariant={labelColorVariant}
50
+ labelColorTone={labelColorTone}
51
+ labelTypography={labelTypography}
52
+ labelStack={labelStack}
53
+ labelWeight={labelWeight}
54
+ LabelComponent={Text}
55
+ leftComponent={leftComponent}
56
+ rightComponent={rightComponent}
57
+ borderColor={borderColor}
58
+ borderColorGradation={borderColorGradation}
59
+ inputContainerStyle={inputContainerStyle}
60
+ focused={focused}
61
+ disabled={disabled}
62
+ variant={variant}
63
+ value={value}
64
+ hintComponent={hintComponent}
65
+ hint={hint}
66
+ style={style}
67
+ TextComponent={Text}
68
+ maxLength={maxLength}
69
+ >
70
+ <StyledNativeInput
71
+ {...rest}
72
+ fontStack={inputFontStack}
73
+ fontWeight={inputFontWeight}
84
74
  disabled={disabled}
85
- variant={variant}
86
- >
87
- <StyledNativeInput
88
- {...rest}
89
- fontStack={inputFontStack}
90
- fontWeight={inputFontWeight}
91
- disabled={disabled}
92
- onFocus={handleFocus}
93
- onBlur={handleBlur}
94
- textAlignVertical={'top'}
95
- multiline
96
- />
97
- {maxLength && (
98
- <CharCountText
99
- colorVariant={'secondary'}
100
- colorTone={'medium'}
101
- typography={'label'}
102
- fontStack={'default'}
103
- fontWeight={'bold'}
104
- >
105
- {`${length}/${maxLength}`}
106
- </CharCountText>
107
- )}
108
- </StyledInputContainer>
109
- {hint && _hint}
110
- </View>
75
+ onFocus={handleFocus}
76
+ onBlur={handleBlur}
77
+ textAlignVertical={'top'}
78
+ multiline
79
+ value={value}
80
+ maxLength={maxLength}
81
+ />
82
+ </TACore>
111
83
  );
112
84
  };
113
85
 
@@ -1,35 +1,8 @@
1
1
  import styled from '@emotion/native';
2
- import {
3
- extractNumbersFromString,
4
- InputContainer,
5
- InputElement,
6
- StyleProps,
7
- } from '@tecsinapse/react-core';
2
+ import { StyleProps, TextAreaInputBase } from '@tecsinapse/react-core';
8
3
  import { Font, fontStyles } from '../Text/styled';
9
4
  import { TextAreaProps } from './TextArea';
10
- import { Text, TextNativeProps } from '../Text';
11
5
 
12
- export const StyledInputContainer = styled(InputContainer)<Partial<StyleProps>>`
13
- min-height: 50px;
14
- `;
15
-
16
- const StyledNativeInputBase = styled(InputElement)<
17
- Partial<TextAreaProps> & Partial<StyleProps>
18
- >`
19
- max-height: ${({ theme, numberOfLines }) =>
20
- `${
21
- extractNumbersFromString(theme.typography.h5.lineHeight) *
22
- (numberOfLines || 1)
23
- }px`};
24
- width: 100%;
25
- padding: 0;
26
- margin: 3px 0;
27
- `;
28
-
29
- export const StyledNativeInput = styled(StyledNativeInputBase)<
6
+ export const StyledNativeInput = styled(TextAreaInputBase)<
30
7
  Font & Partial<TextAreaProps> & Partial<StyleProps>
31
8
  >(fontStyles);
32
-
33
- export const CharCountText = styled(Text)<TextNativeProps>`
34
- text-align: right;
35
- `;