@tecsinapse/react-core 1.6.2 → 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 +43 -0
- package/dist/components/atoms/Switch/Switch.js +1 -1
- package/dist/components/atoms/Switch/Switch.js.map +1 -1
- package/dist/components/atoms/shared/PaperAndCard.js +1 -0
- package/dist/components/atoms/shared/PaperAndCard.js.map +1 -1
- package/dist/components/molecules/TextArea/TextArea.d.ts +12 -0
- package/dist/components/molecules/TextArea/TextArea.js +90 -0
- package/dist/components/molecules/TextArea/TextArea.js.map +1 -0
- package/dist/components/molecules/TextArea/index.d.ts +2 -0
- package/dist/components/molecules/TextArea/index.js +32 -0
- package/dist/components/molecules/TextArea/index.js.map +1 -0
- package/dist/components/molecules/TextArea/styled.d.ts +7 -0
- package/dist/components/molecules/TextArea/styled.js +28 -0
- package/dist/components/molecules/TextArea/styled.js.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +8 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useTheme.d.ts +2 -0
- package/dist/hooks/useTheme.js +13 -0
- package/dist/hooks/useTheme.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/atoms/Avatar/Avatar.stories.tsx +1 -1
- package/src/components/atoms/BoxContent/BoxContent.stories.tsx +1 -1
- package/src/components/atoms/Card/Card.stories.tsx +1 -1
- package/src/components/atoms/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/components/atoms/Divider/Divider.stories.tsx +1 -3
- package/src/components/atoms/GroupButton/GroupButton.stories.tsx +1 -1
- package/src/components/atoms/Icon/Icon.stories.tsx +1 -1
- package/src/components/atoms/Paper/Paper.stories.tsx +1 -1
- package/src/components/atoms/ProgressBar/ProgressBar.stories.tsx +1 -1
- package/src/components/atoms/RadioButton/RadioButton.stories.tsx +1 -1
- package/src/components/atoms/Switch/Switch.stories.tsx +1 -1
- package/src/components/atoms/Switch/Switch.tsx +1 -1
- package/src/components/atoms/Text/Text.stories.tsx +1 -1
- package/src/components/atoms/shared/PaperAndCard.ts +1 -0
- package/src/components/molecules/Calendar/Calendar.stories.tsx +1 -1
- package/src/components/molecules/DatePicker/DatePicker.stories.tsx +1 -1
- package/src/components/molecules/DateTimePicker/DateTimePicker.stories.tsx +1 -1
- package/src/components/molecules/TextArea/TextArea.tsx +99 -0
- package/src/components/molecules/TextArea/index.ts +2 -0
- package/src/components/molecules/TextArea/styled.ts +25 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useTheme.ts +4 -0
- package/src/index.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
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
|
+
|
|
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)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **switch:** add onChange to switch callback dependency array ([6e46d20](https://github.com/tecsinapse/design-system/commit/6e46d2033b66f9bc351b38647f3097317d3e15d8))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## [1.6.4](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.6.3...@tecsinapse/react-core@1.6.4) (2021-09-16)
|
|
30
|
+
|
|
31
|
+
**Note:** Version bump only for package @tecsinapse/react-core
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## [1.6.3](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.6.2...@tecsinapse/react-core@1.6.3) (2021-09-16)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Bug Fixes
|
|
41
|
+
|
|
42
|
+
* **menubar:** fixing toggle for search items ([330e6b8](https://github.com/tecsinapse/design-system/commit/330e6b8467945c55bbcbaa4876cd160224ef509d))
|
|
43
|
+
* **menubar:** fixing toggle for search items ([3aefce8](https://github.com/tecsinapse/design-system/commit/3aefce867cab7a12bafdef181148fc48654044ff))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
6
49
|
## [1.6.2](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.6.1...@tecsinapse/react-core@1.6.2) (2021-09-15)
|
|
7
50
|
|
|
8
51
|
|
|
@@ -51,7 +51,7 @@ const Switch = ({
|
|
|
51
51
|
const handleChange = (0, _react2.useCallback)(() => {
|
|
52
52
|
onChange(!active);
|
|
53
53
|
(0, _animation.transitionSwitch)(active, transitionValue, animatedColor);
|
|
54
|
-
}, [active]);
|
|
54
|
+
}, [active, onChange]);
|
|
55
55
|
const stylesDefaut = {
|
|
56
56
|
borderRadius: (0, _utils.extractNumbersFromString)(theme.borderRadius.pill),
|
|
57
57
|
paddingHorizontal: (0, _utils.extractNumbersFromString)(theme.spacing.micro),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/Switch/Switch.tsx"],"names":["Switch","onChange","activeColor","activeColorTone","inactiveColor","inactiveColorTone","active","dotStyle","rest","theme","transitionValue","React","useRef","Animated","Value","current","animatedColor","interpolateColor","interpolate","inputRange","outputRange","color","animatedStyle","backgroundColor","handleChange","stylesDefaut","borderRadius","pill","paddingHorizontal","spacing","micro","paddingVertical","justifyContent","width","height","transform","translateX"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;;;;;;;AAaA,MAAMA,MAAuB,GAAG,CAAC;AAC/BC,EAAAA,QAD+B;AAE/BC,EAAAA,WAAW,GAAG,SAFiB;AAG/BC,EAAAA,eAAe,GAAG,QAHa;AAI/BC,EAAAA,aAAa,GAAG,WAJe;AAK/BC,EAAAA,iBAAiB,GAAG,OALW;AAM/BC,EAAAA,MAN+B;AAO/BC,EAAAA,QAP+B;AAQ/B,KAAGC;AAR4B,CAAD,KASb;AACjB,QAAMC,KAAK,GAAG,sBAAd;;AAEA,QAAMC,eAAe,GAAGC,gBAAMC,MAAN,CAAa,IAAIC,sBAASC,KAAb,CAAmBR,MAAM,GAAG,IAAH,GAAU,CAAnC,CAAb,EACrBS,OADH;;AAGA,QAAMC,aAAa,GAAGL,gBAAMC,MAAN,CAAa,IAAIC,sBAASC,KAAb,CAAmBR,MAAM,GAAG,CAAH,GAAO,CAAhC,CAAb,EACnBS,OADH;;AAGA,QAAME,gBAAgB,GAAGD,aAAa,CAACE,WAAd,CAA0B;AACjDC,IAAAA,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,CADqC;AAEjDC,IAAAA,WAAW,EAAE,CACXX,KAAK,CAACY,KAAN,CAAYjB,aAAZ,EAA2BC,iBAA3B,CADW,EAEXI,KAAK,CAACY,KAAN,CAAYnB,WAAZ,EAAyBC,eAAzB,CAFW;AAFoC,GAA1B,CAAzB;AAQA,QAAMmB,aAAa,GAAG;AACpBC,IAAAA,eAAe,EAAEN;AADG,GAAtB;AAIA,QAAMO,YAAY,GAAG,yBAAY,MAAM;AACrCvB,IAAAA,QAAQ,CAAC,CAACK,MAAF,CAAR;AACA,qCAAiBA,MAAjB,EAAyBI,eAAzB,EAA0CM,aAA1C;AACD,GAHoB,EAGlB,CAACV,MAAD,CAHkB,CAArB;AAKA,
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Switch/Switch.tsx"],"names":["Switch","onChange","activeColor","activeColorTone","inactiveColor","inactiveColorTone","active","dotStyle","rest","theme","transitionValue","React","useRef","Animated","Value","current","animatedColor","interpolateColor","interpolate","inputRange","outputRange","color","animatedStyle","backgroundColor","handleChange","stylesDefaut","borderRadius","pill","paddingHorizontal","spacing","micro","paddingVertical","justifyContent","width","height","transform","translateX"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;;;;;;;AAaA,MAAMA,MAAuB,GAAG,CAAC;AAC/BC,EAAAA,QAD+B;AAE/BC,EAAAA,WAAW,GAAG,SAFiB;AAG/BC,EAAAA,eAAe,GAAG,QAHa;AAI/BC,EAAAA,aAAa,GAAG,WAJe;AAK/BC,EAAAA,iBAAiB,GAAG,OALW;AAM/BC,EAAAA,MAN+B;AAO/BC,EAAAA,QAP+B;AAQ/B,KAAGC;AAR4B,CAAD,KASb;AACjB,QAAMC,KAAK,GAAG,sBAAd;;AAEA,QAAMC,eAAe,GAAGC,gBAAMC,MAAN,CAAa,IAAIC,sBAASC,KAAb,CAAmBR,MAAM,GAAG,IAAH,GAAU,CAAnC,CAAb,EACrBS,OADH;;AAGA,QAAMC,aAAa,GAAGL,gBAAMC,MAAN,CAAa,IAAIC,sBAASC,KAAb,CAAmBR,MAAM,GAAG,CAAH,GAAO,CAAhC,CAAb,EACnBS,OADH;;AAGA,QAAME,gBAAgB,GAAGD,aAAa,CAACE,WAAd,CAA0B;AACjDC,IAAAA,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,CADqC;AAEjDC,IAAAA,WAAW,EAAE,CACXX,KAAK,CAACY,KAAN,CAAYjB,aAAZ,EAA2BC,iBAA3B,CADW,EAEXI,KAAK,CAACY,KAAN,CAAYnB,WAAZ,EAAyBC,eAAzB,CAFW;AAFoC,GAA1B,CAAzB;AAQA,QAAMmB,aAAa,GAAG;AACpBC,IAAAA,eAAe,EAAEN;AADG,GAAtB;AAIA,QAAMO,YAAY,GAAG,yBAAY,MAAM;AACrCvB,IAAAA,QAAQ,CAAC,CAACK,MAAF,CAAR;AACA,qCAAiBA,MAAjB,EAAyBI,eAAzB,EAA0CM,aAA1C;AACD,GAHoB,EAGlB,CAACV,MAAD,EAASL,QAAT,CAHkB,CAArB;AAKA,QAAMwB,YAAuB,GAAG;AAC9BC,IAAAA,YAAY,EAAE,qCAAyBjB,KAAK,CAACiB,YAAN,CAAmBC,IAA5C,CADgB;AAE9BC,IAAAA,iBAAiB,EAAE,qCAAyBnB,KAAK,CAACoB,OAAN,CAAcC,KAAvC,CAFW;AAG9BC,IAAAA,eAAe,EAAE,CAHa;AAI9BC,IAAAA,cAAc,EAAE,QAJc;AAK9BC,IAAAA,KAAK,EAAE,EALuB;AAM9BC,IAAAA,MAAM,EAAE;AANsB,GAAhC;AASA,SACE,8BAAC,kCAAD,eAAsB1B,IAAtB;AAA4B,IAAA,OAAO,EAAEgB,YAArC;AAAmD,IAAA,MAAM,EAAC;AAA1D,MACE,8BAAC,qBAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAE,EAAE,GAAGF,aAAL;AAAoB,SAAGG;AAAvB;AAAtB,KACE,8BAAC,oBAAD;AACE,IAAA,KAAK,EAAE,CAAClB,QAAD,EAAW;AAAE4B,MAAAA,SAAS,EAAE,CAAC;AAAEC,QAAAA,UAAU,EAAE1B;AAAd,OAAD;AAAb,KAAX;AADT,IADF,CADF,CADF;AASD,CArDD;;eAuDeV,M","sourcesContent":["import { useTheme } from '@emotion/react';\nimport React, { FC, useCallback } from 'react';\nimport { Animated, StyleProp, ViewStyle } from 'react-native';\nimport {\n ColorGradationType,\n ColorType,\n ThemeProp,\n} from '../../../types/defaults';\nimport { PressableSurface } from '../PressableSurface';\nimport { StyledSwitch } from './styled';\nimport { transitionSwitch } from './animation';\nimport { extractNumbersFromString } from '../../../utils';\n\nexport interface SwitchProps {\n onChange: (active: boolean) => void;\n active: boolean;\n activeColor?: ColorType;\n activeColorTone?: ColorGradationType;\n inactiveColor?: ColorType;\n inactiveColorTone?: ColorGradationType;\n style?: StyleProp<ViewStyle>;\n dotStyle?: StyleProp<ViewStyle>;\n}\n\nconst Switch: FC<SwitchProps> = ({\n onChange,\n activeColor = 'primary',\n activeColorTone = 'medium',\n inactiveColor = 'secondary',\n inactiveColorTone = 'light',\n active,\n dotStyle,\n ...rest\n}): JSX.Element => {\n const theme = useTheme() as ThemeProp;\n\n const transitionValue = React.useRef(new Animated.Value(active ? 16.5 : 0))\n .current;\n\n const animatedColor = React.useRef(new Animated.Value(active ? 1 : 0))\n .current;\n\n const interpolateColor = animatedColor.interpolate({\n inputRange: [0, 1],\n outputRange: [\n theme.color[inactiveColor][inactiveColorTone],\n theme.color[activeColor][activeColorTone],\n ],\n });\n\n const animatedStyle = {\n backgroundColor: interpolateColor,\n };\n\n const handleChange = useCallback(() => {\n onChange(!active);\n transitionSwitch(active, transitionValue, animatedColor);\n }, [active, onChange]);\n\n const stylesDefaut: ViewStyle = {\n borderRadius: extractNumbersFromString(theme.borderRadius.pill),\n paddingHorizontal: extractNumbersFromString(theme.spacing.micro),\n paddingVertical: 0,\n justifyContent: 'center',\n width: 40,\n height: 22,\n };\n\n return (\n <PressableSurface {...rest} onPress={handleChange} effect=\"none\">\n <Animated.View style={{ ...animatedStyle, ...stylesDefaut }}>\n <StyledSwitch\n style={[dotStyle, { transform: [{ translateX: transitionValue }] }]}\n />\n </Animated.View>\n </PressableSurface>\n );\n};\n\nexport default Switch;\n"],"file":"Switch.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/atoms/shared/PaperAndCard.ts"],"names":["baseStyles","theme","spacing","deca","borderRadius","mili","miscellaneous","surfaceColor","elevatedStyles","elevated","shadowColor","shadow","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation"],"mappings":";;;;;;;AAAA;;AAIO,MAAMA,UAAU,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAgC,gBAAI;AAC9D,aAAaA,KAAK,CAACC,OAAN,CAAcC,IAAK;AAChC,mBAAmBF,KAAK,CAACG,YAAN,CAAmBC,IAAK;AAC3C,sBAAsBJ,KAAK,CAACK,aAAN,CAAoBC,YAAa;AACvD,
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/shared/PaperAndCard.ts"],"names":["baseStyles","theme","spacing","deca","borderRadius","mili","miscellaneous","surfaceColor","elevatedStyles","elevated","shadowColor","shadow","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation"],"mappings":";;;;;;;AAAA;;AAIO,MAAMA,UAAU,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAgC,gBAAI;AAC9D,aAAaA,KAAK,CAACC,OAAN,CAAcC,IAAK;AAChC,mBAAmBF,KAAK,CAACG,YAAN,CAAmBC,IAAK;AAC3C,sBAAsBJ,KAAK,CAACK,aAAN,CAAoBC,YAAa;AACvD;AACA,CALO;;;;AAQA,MAAMC,cAAc,GAAG,CAAC;AAC7BP,EAAAA,KAD6B;AAE7BQ,EAAAA,QAAQ,GAAG;AAFkB,CAAD,KAI5BA,QAAQ,IAAI,CACV,iBAAI;AACFC,EAAAA,WAAW,EAAET,KAAK,CAACK,aAAN,CAAoBK,MAD/B;AAEFC,EAAAA,YAAY,EAAE;AAAEC,IAAAA,KAAK,EAAE,CAAT;AAAYC,IAAAA,MAAM,EAAE;AAApB,GAFZ;AAGFC,EAAAA,aAAa,EAAE,GAHb;AAIFC,EAAAA,YAAY,EAAE,GAJZ;AAKFC,EAAAA,SAAS,EAAE;AALT,CAAJ,CADU,CAJP","sourcesContent":["import { css } from '@emotion/native';\nimport { StyleProps } from '@tecsinapse/react-core';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const baseStyles = ({ theme }: StyleProps): any => css`\n padding: ${theme.spacing.deca};\n border-radius: ${theme.borderRadius.mili};\n background-color: ${theme.miscellaneous.surfaceColor};\n overflow: hidden;\n`;\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport const elevatedStyles = ({\n theme,\n elevated = false,\n}: { elevated?: boolean } & StyleProps): any =>\n elevated && [\n css({\n shadowColor: theme.miscellaneous.shadow,\n shadowOffset: { width: 0, height: 1 },\n shadowOpacity: 0.2,\n shadowRadius: 1.4,\n elevation: 2,\n }),\n ];\n/* eslint-enable @typescript-eslint/no-explicit-any */\n"],"file":"PaperAndCard.js"}
|
|
@@ -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,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/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -9,6 +9,14 @@ Object.defineProperty(exports, "useDebouncedState", {
|
|
|
9
9
|
return _useDebouncedState.useDebouncedState;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "useTheme", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _useTheme.useTheme;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
12
18
|
|
|
13
19
|
var _useDebouncedState = require("./useDebouncedState");
|
|
20
|
+
|
|
21
|
+
var _useTheme = require("./useTheme");
|
|
14
22
|
//# sourceMappingURL=index.js.map
|
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA","sourcesContent":["export { useDebouncedState } from './useDebouncedState';\nexport { useTheme } from './useTheme';\n"],"file":"index.js"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useTheme = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("@emotion/react");
|
|
9
|
+
|
|
10
|
+
const useTheme = () => (0, _react.useTheme)();
|
|
11
|
+
|
|
12
|
+
exports.useTheme = useTheme;
|
|
13
|
+
//# sourceMappingURL=useTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useTheme.ts"],"names":["useTheme"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,QAAQ,GAAG,MAAM,sBAAvB","sourcesContent":["import { useTheme as useEmotionTheme } from '@emotion/react';\nimport { ThemeProp } from '../types/defaults';\n\nexport const useTheme = () => useEmotionTheme() as ThemeProp;\n"],"file":"useTheme.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":"
|
|
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.
|
|
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": "
|
|
34
|
+
"gitHead": "bf5441b7a5f34f14ad2bfd3becc7bcfa78a508da"
|
|
35
35
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import styled from '@emotion/native';
|
|
2
1
|
import { Story } from '@storybook/react';
|
|
3
2
|
import React from 'react';
|
|
4
|
-
import { StyleProps } from '../../../../dist';
|
|
5
3
|
import { Card } from '../Card';
|
|
6
4
|
import { Text } from '../Text';
|
|
7
5
|
import Divider, { DividerProps } from './Divider';
|
|
8
6
|
|
|
9
7
|
export default {
|
|
10
|
-
title: '
|
|
8
|
+
title: 'Hybrid/Divider',
|
|
11
9
|
component: Divider,
|
|
12
10
|
};
|
|
13
11
|
|
|
@@ -55,7 +55,7 @@ const Switch: FC<SwitchProps> = ({
|
|
|
55
55
|
const handleChange = useCallback(() => {
|
|
56
56
|
onChange(!active);
|
|
57
57
|
transitionSwitch(active, transitionValue, animatedColor);
|
|
58
|
-
}, [active]);
|
|
58
|
+
}, [active, onChange]);
|
|
59
59
|
|
|
60
60
|
const stylesDefaut: ViewStyle = {
|
|
61
61
|
borderRadius: extractNumbersFromString(theme.borderRadius.pill),
|
|
@@ -6,6 +6,7 @@ export const baseStyles = ({ theme }: StyleProps): any => css`
|
|
|
6
6
|
padding: ${theme.spacing.deca};
|
|
7
7
|
border-radius: ${theme.borderRadius.mili};
|
|
8
8
|
background-color: ${theme.miscellaneous.surfaceColor};
|
|
9
|
+
overflow: hidden;
|
|
9
10
|
`;
|
|
10
11
|
|
|
11
12
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -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,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/hooks/index.ts
CHANGED
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';
|