@tecsinapse/react-core 1.6.5 → 1.7.0

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,18 @@
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.0](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.6.5...@tecsinapse/react-core@1.7.0) (2021-09-21)
7
+
8
+
9
+ ### Features
10
+
11
+ * text area ([35ce0ba](https://github.com/tecsinapse/design-system/commit/35ce0ba36aeb9c3d90db19d077e0741e417c65e0))
12
+ * text area hybrid ([f16d074](https://github.com/tecsinapse/design-system/commit/f16d074a71bbea3b1bbc4c4e3933a124b0f1e064))
13
+
14
+
15
+
16
+
17
+
6
18
  ## [1.6.5](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.6.4...@tecsinapse/react-core@1.6.5) (2021-09-20)
7
19
 
8
20
 
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ import { FontStackType, FontWeightType, InputContainerProps, InputElementProps, TextProps } from '@tecsinapse/react-core';
3
+ export interface TextAreaProps extends Omit<InputElementProps, 'style' | 'multiline' | 'value'>, InputContainerProps {
4
+ inputFontStack?: FontStackType;
5
+ inputFontWeight?: FontWeightType;
6
+ maxCharCount?: number;
7
+ value: string;
8
+ TextComponent?: FC<TextProps>;
9
+ focused?: boolean;
10
+ }
11
+ declare const TextArea: FC<TextAreaProps>;
12
+ export default TextArea;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _reactCore = require("@tecsinapse/react-core");
11
+
12
+ var _reactNative = require("react-native");
13
+
14
+ var _styled = require("./styled");
15
+
16
+ var _Text = require("../../atoms/Text");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ const TextArea = ({
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
+ inputContainerStyle,
35
+ variant = 'default',
36
+ hintComponent,
37
+ hint,
38
+ TextComponent = _Text.Text,
39
+ focused,
40
+ children,
41
+ maxLength: _maxLenght,
42
+ value: _value
43
+ }) => {
44
+ let length = _value.length;
45
+ const maxLength = _maxLenght;
46
+
47
+ if (maxLength && length > maxLength) {
48
+ length = maxLength;
49
+ }
50
+
51
+ const _hint = hintComponent || _react.default.createElement(_reactCore.Hint, {
52
+ TextComponent: TextComponent,
53
+ text: hint,
54
+ variant: variant
55
+ });
56
+
57
+ return _react.default.createElement(_reactNative.View, {
58
+ style: style
59
+ }, _react.default.createElement(_styled.StyledInputContainer, {
60
+ label: label,
61
+ labelColor: labelColor,
62
+ labelColorVariant: labelColorVariant,
63
+ labelColorTone: labelColorTone,
64
+ labelTypography: labelTypography,
65
+ labelStack: labelStack,
66
+ labelWeight: labelWeight,
67
+ LabelComponent: TextComponent,
68
+ leftComponent: leftComponent,
69
+ rightComponent: rightComponent,
70
+ borderColor: borderColor,
71
+ borderColorGradation: borderColorGradation,
72
+ inputContainerStyle: inputContainerStyle,
73
+ focused: focused,
74
+ disabled: disabled,
75
+ variant: variant
76
+ }, children, maxLength && _react.default.createElement(TextComponent, {
77
+ colorVariant: 'secondary',
78
+ colorTone: 'medium',
79
+ typography: 'label',
80
+ fontStack: 'default',
81
+ fontWeight: 'bold',
82
+ style: {
83
+ textAlign: 'right'
84
+ }
85
+ }, `${length}/${maxLength}`)), hint && _hint);
86
+ };
87
+
88
+ var _default = TextArea;
89
+ exports.default = _default;
90
+ //# sourceMappingURL=TextArea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/molecules/TextArea/TextArea.tsx"],"names":["TextArea","label","labelColor","labelColorVariant","labelColorTone","labelTypography","labelStack","labelWeight","leftComponent","rightComponent","disabled","style","borderColor","borderColorGradation","inputContainerStyle","variant","hintComponent","hint","TextComponent","Text","focused","children","maxLength","_maxLenght","value","_value","length","_hint","textAlign"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;AACA;;;;AAcA,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,mBAdmC;AAenCC,EAAAA,OAAO,GAAG,SAfyB;AAgBnCC,EAAAA,aAhBmC;AAiBnCC,EAAAA,IAjBmC;AAkBnCC,EAAAA,aAAa,GAAGC,UAlBmB;AAmBnCC,EAAAA,OAnBmC;AAoBnCC,EAAAA,QApBmC;AAqBnCC,EAAAA,SAAS,EAAEC,UArBwB;AAsBnCC,EAAAA,KAAK,EAAEC;AAtB4B,CAAD,KAuB9B;AACJ,MAAIC,MAAM,GAAGD,MAAM,CAACC,MAApB;AACA,QAAMJ,SAAS,GAAGC,UAAlB;;AACA,MAAID,SAAS,IAAII,MAAM,GAAGJ,SAA1B,EAAqC;AACnCI,IAAAA,MAAM,GAAGJ,SAAT;AACD;;AAED,QAAMK,KAAK,GAAGX,aAAa,IACzB,6BAAC,eAAD;AAAM,IAAA,aAAa,EAAEE,aAArB;AAAoC,IAAA,IAAI,EAAED,IAA1C;AAAgD,IAAA,OAAO,EAAEF;AAAzD,IADF;;AAIA,SACE,6BAAC,iBAAD;AAAM,IAAA,KAAK,EAAEJ;AAAb,KACE,6BAAC,4BAAD;AACE,IAAA,KAAK,EAAEV,KADT;AAEE,IAAA,UAAU,EAAEC,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,EAAEW,aARlB;AASE,IAAA,aAAa,EAAEV,aATjB;AAUE,IAAA,cAAc,EAAEC,cAVlB;AAWE,IAAA,WAAW,EAAEG,WAXf;AAYE,IAAA,oBAAoB,EAAEC,oBAZxB;AAaE,IAAA,mBAAmB,EAAEC,mBAbvB;AAcE,IAAA,OAAO,EAAEM,OAdX;AAeE,IAAA,QAAQ,EAAEV,QAfZ;AAgBE,IAAA,OAAO,EAAEK;AAhBX,KAkBGM,QAlBH,EAmBGC,SAAS,IACR,6BAAC,aAAD;AACE,IAAA,YAAY,EAAE,WADhB;AAEE,IAAA,SAAS,EAAE,QAFb;AAGE,IAAA,UAAU,EAAE,OAHd;AAIE,IAAA,SAAS,EAAE,SAJb;AAKE,IAAA,UAAU,EAAE,MALd;AAME,IAAA,KAAK,EAAE;AAAEM,MAAAA,SAAS,EAAE;AAAb;AANT,KAQI,GAAEF,MAAO,IAAGJ,SAAU,EAR1B,CApBJ,CADF,EAiCGL,IAAI,IAAIU,KAjCX,CADF;AAqCD,CAvED;;eAyEe3B,Q","sourcesContent":["import React, { FC } from 'react';\nimport {\n FontStackType,\n FontWeightType,\n Hint,\n InputContainerProps,\n InputElementProps,\n TextProps,\n} from '@tecsinapse/react-core';\nimport { View } from 'react-native';\nimport { StyledInputContainer } from './styled';\nimport { Text } from '../../atoms/Text';\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 // Omit below\n TextComponent?: FC<TextProps>;\n focused?: boolean;\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 inputContainerStyle,\n variant = 'default',\n hintComponent,\n hint,\n TextComponent = Text,\n focused,\n children,\n maxLength: _maxLenght,\n value: _value,\n}) => {\n let length = _value.length;\n const maxLength = _maxLenght;\n if (maxLength && length > maxLength) {\n length = maxLength;\n }\n\n const _hint = hintComponent || (\n <Hint TextComponent={TextComponent} text={hint} variant={variant} />\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={TextComponent}\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 {children}\n {maxLength && (\n <TextComponent\n colorVariant={'secondary'}\n colorTone={'medium'}\n typography={'label'}\n fontStack={'default'}\n fontWeight={'bold'}\n style={{ textAlign: 'right' }}\n >\n {`${length}/${maxLength}`}\n </TextComponent>\n )}\n </StyledInputContainer>\n {hint && _hint}\n </View>\n );\n};\n\nexport default TextArea;\n"],"file":"TextArea.js"}
@@ -0,0 +1,2 @@
1
+ export { default as TextArea, TextAreaProps } from './TextArea';
2
+ export { TextAreaInputBase } from './styled';
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "TextArea", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _TextArea.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "TextAreaProps", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _TextArea.TextAreaProps;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "TextAreaInputBase", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _styled.TextAreaInputBase;
22
+ }
23
+ });
24
+
25
+ var _TextArea = _interopRequireWildcard(require("./TextArea"));
26
+
27
+ var _styled = require("./styled");
28
+
29
+ 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); }
30
+
31
+ 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; }
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/molecules/TextArea/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA","sourcesContent":["export { default as TextArea, TextAreaProps } from './TextArea';\nexport { TextAreaInputBase } from './styled';\n"],"file":"index.js"}
@@ -0,0 +1,7 @@
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 TextAreaInputBase: import("@emotion/native").StyledComponent<any, {}, {
6
+ ref?: import("react").Ref<any> | undefined;
7
+ }>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TextAreaInputBase = exports.StyledInputContainer = void 0;
7
+
8
+ var _native = _interopRequireDefault(require("@emotion/native"));
9
+
10
+ var _reactCore = require("@tecsinapse/react-core");
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ const StyledInputContainer = (0, _native.default)(_reactCore.InputContainer)`
15
+ min-height: 50px;
16
+ `;
17
+ exports.StyledInputContainer = StyledInputContainer;
18
+ const TextAreaInputBase = (0, _native.default)(_reactCore.InputElement)`
19
+ max-height: ${({
20
+ theme,
21
+ numberOfLines
22
+ }) => `${(0, _reactCore.extractNumbersFromString)(theme.typography.h5.lineHeight) * (numberOfLines || 1)}px`};
23
+ width: 100%;
24
+ padding: 0;
25
+ margin: 3px 0;
26
+ `;
27
+ exports.TextAreaInputBase = TextAreaInputBase;
28
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/molecules/TextArea/styled.ts"],"names":["StyledInputContainer","InputContainer","TextAreaInputBase","InputElement","theme","numberOfLines","typography","h5","lineHeight"],"mappings":";;;;;;;AAAA;;AACA;;;;AAQO,MAAMA,oBAAoB,GAAG,qBAAOC,yBAAP,CAA4C;AAChF;AACA,CAFO;;AAIA,MAAMC,iBAAiB,GAAG,qBAAOC,uBAAP,CAE/B;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,CAXO","sourcesContent":["import styled from '@emotion/native';\nimport {\n extractNumbersFromString,\n InputContainer,\n InputElement,\n StyleProps,\n} from '@tecsinapse/react-core';\nimport { TextAreaProps } from './TextArea';\n\nexport const StyledInputContainer = styled(InputContainer)<Partial<StyleProps>>`\n min-height: 50px;\n`;\n\nexport const TextAreaInputBase = 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"],"file":"styled.js"}
package/dist/index.d.ts CHANGED
@@ -24,6 +24,7 @@ export { DateTimeSelector, DateTimeSelectorMode, DateTimeSelectorProps, } from '
24
24
  export { InputPasswordIcon } from './components/molecules/InputPassword';
25
25
  export { Snackbar, SnackbarProps } from './components/molecules/Snackbar';
26
26
  export { HintInputContainer, HintInputContainerProps, } from './components/molecules/HintInputContainer';
27
+ export { TextArea, TextAreaProps, TextAreaInputBase, } from './components/molecules/TextArea';
27
28
  export * from './styles/definitions';
28
29
  export * from './styles/light';
29
30
  export { default as ThemeProvider } from './styles/ThemeProvider';
package/dist/index.js CHANGED
@@ -79,6 +79,9 @@ var _exportNames = {
79
79
  SnackbarProps: true,
80
80
  HintInputContainer: true,
81
81
  HintInputContainerProps: true,
82
+ TextArea: true,
83
+ TextAreaProps: true,
84
+ TextAreaInputBase: true,
82
85
  ThemeProvider: true
83
86
  };
84
87
  Object.defineProperty(exports, "Avatar", {
@@ -531,6 +534,24 @@ Object.defineProperty(exports, "HintInputContainerProps", {
531
534
  return _HintInputContainer.HintInputContainerProps;
532
535
  }
533
536
  });
537
+ Object.defineProperty(exports, "TextArea", {
538
+ enumerable: true,
539
+ get: function () {
540
+ return _TextArea.TextArea;
541
+ }
542
+ });
543
+ Object.defineProperty(exports, "TextAreaProps", {
544
+ enumerable: true,
545
+ get: function () {
546
+ return _TextArea.TextAreaProps;
547
+ }
548
+ });
549
+ Object.defineProperty(exports, "TextAreaInputBase", {
550
+ enumerable: true,
551
+ get: function () {
552
+ return _TextArea.TextAreaInputBase;
553
+ }
554
+ });
534
555
  Object.defineProperty(exports, "ThemeProvider", {
535
556
  enumerable: true,
536
557
  get: function () {
@@ -590,6 +611,8 @@ var _Snackbar = require("./components/molecules/Snackbar");
590
611
 
591
612
  var _HintInputContainer = require("./components/molecules/HintInputContainer");
592
613
 
614
+ var _TextArea = require("./components/molecules/TextArea");
615
+
593
616
  var _definitions = require("./styles/definitions");
594
617
 
595
618
  Object.keys(_definitions).forEach(function (key) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAgBA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AAIA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export { Avatar, AvatarProps } from './components/atoms/Avatar';\nexport { Badge, BadgeProps } from './components/atoms/Badge';\nexport { BoxContent, BoxContentProps } from './components/atoms/BoxContent';\nexport {\n Button,\n ButtonProps,\n ButtonSizeType,\n ButtonStateProps,\n ButtonStateType,\n Error,\n Loading,\n Success,\n} from './components/atoms/Button';\nexport { Card, CardProps } from './components/atoms/Card';\nexport { Footer, FooterProps } from './components/atoms/Card/Footer';\nexport { Header, HeaderProps } from './components/atoms/Card/Header';\nexport { Checkbox, CheckboxProps } from './components/atoms/Checkbox';\nexport { Divider, DividerProps } from './components/atoms/Divider';\nexport {\n GroupButton,\n GroupButtonOption,\n GroupButtonOptionProps,\n GroupButtonProps,\n GroupButtonValue,\n} from './components/atoms/GroupButton';\nexport { Icon, IconProps } from './components/atoms/Icon';\nexport {\n Hint,\n InputContainer,\n InputContainerProps,\n InputElement,\n InputElementProps,\n InputVariantType,\n Masks,\n PressableInputContainer,\n PressableInputContainerProps,\n StyledBorderKeeper,\n useCurrencyMask,\n useInputFocus,\n useMask,\n disabledInputStyles,\n} from './components/atoms/Input';\nexport { Paper, PaperProps } from './components/atoms/Paper';\nexport {\n PressableSurface,\n PressableSurfaceProps,\n} from './components/atoms/PressableSurface';\nexport { ProgressBar, ProgressBarProps } from './components/atoms/ProgressBar';\nexport { RadioButton, RadioButtonProps } from './components/atoms/RadioButton';\nexport { Switch, SwitchProps } from './components/atoms/Switch';\nexport { Tag, TagProps } from './components/atoms/Tag';\nexport { Text, TextProps } from './components/atoms/Text';\nexport {\n Calendar,\n CalendarProps,\n DateRange,\n SelectionType,\n} from './components/molecules/Calendar';\nexport { DatePicker, DatePickerProps } from './components/molecules/DatePicker';\nexport {\n DateTimePicker,\n DateTimePickerProps,\n} from './components/molecules/DateTimePicker';\nexport {\n DateTimeSelector,\n DateTimeSelectorMode,\n DateTimeSelectorProps,\n} from './components/molecules/DateTimeSelector';\nexport { InputPasswordIcon } from './components/molecules/InputPassword';\nexport { Snackbar, SnackbarProps } from './components/molecules/Snackbar';\nexport {\n HintInputContainer,\n HintInputContainerProps,\n} from './components/molecules/HintInputContainer';\nexport * from './styles/definitions';\nexport * from './styles/light';\nexport { default as ThemeProvider } from './styles/ThemeProvider';\nexport * from './types/defaults';\nexport * from './utils';\nexport * from './hooks';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAgBA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AAIA;;AAKA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export { Avatar, AvatarProps } from './components/atoms/Avatar';\nexport { Badge, BadgeProps } from './components/atoms/Badge';\nexport { BoxContent, BoxContentProps } from './components/atoms/BoxContent';\nexport {\n Button,\n ButtonProps,\n ButtonSizeType,\n ButtonStateProps,\n ButtonStateType,\n Error,\n Loading,\n Success,\n} from './components/atoms/Button';\nexport { Card, CardProps } from './components/atoms/Card';\nexport { Footer, FooterProps } from './components/atoms/Card/Footer';\nexport { Header, HeaderProps } from './components/atoms/Card/Header';\nexport { Checkbox, CheckboxProps } from './components/atoms/Checkbox';\nexport { Divider, DividerProps } from './components/atoms/Divider';\nexport {\n GroupButton,\n GroupButtonOption,\n GroupButtonOptionProps,\n GroupButtonProps,\n GroupButtonValue,\n} from './components/atoms/GroupButton';\nexport { Icon, IconProps } from './components/atoms/Icon';\nexport {\n Hint,\n InputContainer,\n InputContainerProps,\n InputElement,\n InputElementProps,\n InputVariantType,\n Masks,\n PressableInputContainer,\n PressableInputContainerProps,\n StyledBorderKeeper,\n useCurrencyMask,\n useInputFocus,\n useMask,\n disabledInputStyles,\n} from './components/atoms/Input';\nexport { Paper, PaperProps } from './components/atoms/Paper';\nexport {\n PressableSurface,\n PressableSurfaceProps,\n} from './components/atoms/PressableSurface';\nexport { ProgressBar, ProgressBarProps } from './components/atoms/ProgressBar';\nexport { RadioButton, RadioButtonProps } from './components/atoms/RadioButton';\nexport { Switch, SwitchProps } from './components/atoms/Switch';\nexport { Tag, TagProps } from './components/atoms/Tag';\nexport { Text, TextProps } from './components/atoms/Text';\nexport {\n Calendar,\n CalendarProps,\n DateRange,\n SelectionType,\n} from './components/molecules/Calendar';\nexport { DatePicker, DatePickerProps } from './components/molecules/DatePicker';\nexport {\n DateTimePicker,\n DateTimePickerProps,\n} from './components/molecules/DateTimePicker';\nexport {\n DateTimeSelector,\n DateTimeSelectorMode,\n DateTimeSelectorProps,\n} from './components/molecules/DateTimeSelector';\nexport { InputPasswordIcon } from './components/molecules/InputPassword';\nexport { Snackbar, SnackbarProps } from './components/molecules/Snackbar';\nexport {\n HintInputContainer,\n HintInputContainerProps,\n} from './components/molecules/HintInputContainer';\nexport {\n TextArea,\n TextAreaProps,\n TextAreaInputBase,\n} from './components/molecules/TextArea';\nexport * from './styles/definitions';\nexport * from './styles/light';\nexport { default as ThemeProvider } from './styles/ThemeProvider';\nexport * from './types/defaults';\nexport * from './utils';\nexport * from './hooks';\n"],"file":"index.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.6.5",
4
+ "version": "1.7.0",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -31,5 +31,5 @@
31
31
  "react-native": ">=0.64.0",
32
32
  "react-native-vector-icons": ">=8.1.0"
33
33
  },
34
- "gitHead": "eaf7b5bb177a5ed25f3b63840b385878c9858479"
34
+ "gitHead": "bf5441b7a5f34f14ad2bfd3becc7bcfa78a508da"
35
35
  }
@@ -0,0 +1,99 @@
1
+ import React, { FC } from 'react';
2
+ import {
3
+ FontStackType,
4
+ FontWeightType,
5
+ Hint,
6
+ InputContainerProps,
7
+ InputElementProps,
8
+ TextProps,
9
+ } from '@tecsinapse/react-core';
10
+ import { View } from 'react-native';
11
+ import { StyledInputContainer } from './styled';
12
+ import { Text } from '../../atoms/Text';
13
+
14
+ export interface TextAreaProps
15
+ extends Omit<InputElementProps, 'style' | 'multiline' | 'value'>,
16
+ InputContainerProps {
17
+ inputFontStack?: FontStackType;
18
+ inputFontWeight?: FontWeightType;
19
+ maxCharCount?: number;
20
+ value: string;
21
+ // Omit below
22
+ TextComponent?: FC<TextProps>;
23
+ focused?: boolean;
24
+ }
25
+
26
+ const TextArea: FC<TextAreaProps> = ({
27
+ label,
28
+ labelColor,
29
+ labelColorVariant,
30
+ labelColorTone,
31
+ labelTypography,
32
+ labelStack,
33
+ labelWeight,
34
+ leftComponent,
35
+ rightComponent,
36
+ disabled,
37
+ style,
38
+ borderColor,
39
+ borderColorGradation,
40
+ inputContainerStyle,
41
+ variant = 'default',
42
+ hintComponent,
43
+ hint,
44
+ TextComponent = Text,
45
+ focused,
46
+ children,
47
+ maxLength: _maxLenght,
48
+ value: _value,
49
+ }) => {
50
+ let length = _value.length;
51
+ const maxLength = _maxLenght;
52
+ if (maxLength && length > maxLength) {
53
+ length = maxLength;
54
+ }
55
+
56
+ const _hint = hintComponent || (
57
+ <Hint TextComponent={TextComponent} text={hint} variant={variant} />
58
+ );
59
+
60
+ return (
61
+ <View style={style}>
62
+ <StyledInputContainer
63
+ label={label}
64
+ labelColor={labelColor}
65
+ labelColorVariant={labelColorVariant}
66
+ labelColorTone={labelColorTone}
67
+ labelTypography={labelTypography}
68
+ labelStack={labelStack}
69
+ labelWeight={labelWeight}
70
+ LabelComponent={TextComponent}
71
+ leftComponent={leftComponent}
72
+ rightComponent={rightComponent}
73
+ borderColor={borderColor}
74
+ borderColorGradation={borderColorGradation}
75
+ inputContainerStyle={inputContainerStyle}
76
+ focused={focused}
77
+ disabled={disabled}
78
+ variant={variant}
79
+ >
80
+ {children}
81
+ {maxLength && (
82
+ <TextComponent
83
+ colorVariant={'secondary'}
84
+ colorTone={'medium'}
85
+ typography={'label'}
86
+ fontStack={'default'}
87
+ fontWeight={'bold'}
88
+ style={{ textAlign: 'right' }}
89
+ >
90
+ {`${length}/${maxLength}`}
91
+ </TextComponent>
92
+ )}
93
+ </StyledInputContainer>
94
+ {hint && _hint}
95
+ </View>
96
+ );
97
+ };
98
+
99
+ export default TextArea;
@@ -0,0 +1,2 @@
1
+ export { default as TextArea, TextAreaProps } from './TextArea';
2
+ export { TextAreaInputBase } from './styled';
@@ -0,0 +1,25 @@
1
+ import styled from '@emotion/native';
2
+ import {
3
+ extractNumbersFromString,
4
+ InputContainer,
5
+ InputElement,
6
+ StyleProps,
7
+ } from '@tecsinapse/react-core';
8
+ import { TextAreaProps } from './TextArea';
9
+
10
+ export const StyledInputContainer = styled(InputContainer)<Partial<StyleProps>>`
11
+ min-height: 50px;
12
+ `;
13
+
14
+ export const TextAreaInputBase = styled(InputElement)<
15
+ Partial<TextAreaProps> & Partial<StyleProps>
16
+ >`
17
+ max-height: ${({ theme, numberOfLines }) =>
18
+ `${
19
+ extractNumbersFromString(theme.typography.h5.lineHeight) *
20
+ (numberOfLines || 1)
21
+ }px`};
22
+ width: 100%;
23
+ padding: 0;
24
+ margin: 3px 0;
25
+ `;
package/src/index.ts CHANGED
@@ -72,6 +72,11 @@ export {
72
72
  HintInputContainer,
73
73
  HintInputContainerProps,
74
74
  } from './components/molecules/HintInputContainer';
75
+ export {
76
+ TextArea,
77
+ TextAreaProps,
78
+ TextAreaInputBase,
79
+ } from './components/molecules/TextArea';
75
80
  export * from './styles/definitions';
76
81
  export * from './styles/light';
77
82
  export { default as ThemeProvider } from './styles/ThemeProvider';