@tecsinapse/react-core 1.12.5 → 1.12.9
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 +35 -0
- package/dist/components/atoms/Input/hooks/useCurrencyMask.js +2 -2
- package/dist/components/atoms/Input/hooks/useCurrencyMask.js.map +1 -1
- package/dist/components/atoms/Input/hooks/useMask.js +2 -2
- package/dist/components/atoms/Input/hooks/useMask.js.map +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.js +6 -6
- package/dist/components/atoms/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/atoms/Switch/Switch.js +30 -22
- package/dist/components/atoms/Switch/Switch.js.map +1 -1
- package/dist/components/atoms/Switch/animation.d.ts +1 -1
- package/dist/components/atoms/Switch/animation.js +24 -16
- package/dist/components/atoms/Switch/animation.js.map +1 -1
- package/dist/components/atoms/Switch/styled.d.ts +3 -2
- package/dist/components/atoms/Switch/styled.js +7 -3
- package/dist/components/atoms/Switch/styled.js.map +1 -1
- package/dist/components/atoms/shared/PaperAndCard.js +3 -4
- package/dist/components/atoms/shared/PaperAndCard.js.map +1 -1
- package/dist/components/molecules/Calendar/index.d.ts +1 -1
- package/dist/components/molecules/Calendar/index.js +6 -0
- package/dist/components/molecules/Calendar/index.js.map +1 -1
- package/dist/components/molecules/Calendar/styled.js +0 -17
- package/dist/components/molecules/Calendar/styled.js.map +1 -1
- package/dist/components/molecules/DatePicker/DatePicker.d.ts +6 -5
- package/dist/components/molecules/DatePicker/DatePicker.js +22 -32
- package/dist/components/molecules/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/molecules/DatePicker/styled.d.ts +0 -14
- package/dist/components/molecules/DatePicker/styled.js +1 -46
- package/dist/components/molecules/DatePicker/styled.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/DateTimePicker.d.ts +5 -4
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js +35 -37
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/styled.d.ts +0 -21
- package/dist/components/molecules/DateTimePicker/styled.js +3 -51
- package/dist/components/molecules/DateTimePicker/styled.js.map +1 -1
- package/dist/components/molecules/Grid/Item/Item.d.ts +1 -1
- package/dist/components/molecules/Grid/Item/Item.js +7 -5
- package/dist/components/molecules/Grid/Item/Item.js.map +1 -1
- package/dist/components/molecules/HintInputContainer/HintInputContainer.d.ts +3 -2
- package/dist/components/molecules/HintInputContainer/HintInputContainer.js +4 -4
- package/dist/components/molecules/HintInputContainer/HintInputContainer.js.map +1 -1
- package/dist/components/molecules/TextArea/TextArea.d.ts +3 -1
- package/dist/components/molecules/TextArea/TextArea.js +4 -4
- package/dist/components/molecules/TextArea/TextArea.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/definitions.js +1 -1
- package/dist/styles/definitions.js.map +1 -1
- package/dist/utils/extractNumbersFromString.js +1 -1
- package/dist/utils/extractNumbersFromString.js.map +1 -1
- package/package.json +2 -2
- package/src/components/atoms/Input/hooks/useCurrencyMask.ts +2 -2
- package/src/components/atoms/Input/hooks/useMask.ts +1 -1
- package/src/components/atoms/ProgressBar/ProgressBar.tsx +5 -5
- package/src/components/atoms/Switch/Switch.tsx +29 -32
- package/src/components/atoms/Switch/animation.ts +26 -16
- package/src/components/atoms/Switch/styled.ts +6 -4
- package/src/components/atoms/shared/PaperAndCard.ts +4 -5
- package/src/components/molecules/Calendar/index.ts +1 -0
- package/src/components/molecules/Calendar/styled.ts +0 -22
- package/src/components/molecules/DatePicker/DatePicker.tsx +32 -41
- package/src/components/molecules/DatePicker/styled.ts +0 -40
- package/src/components/molecules/DateTimePicker/DateTimePicker.tsx +46 -52
- package/src/components/molecules/DateTimePicker/styled.ts +1 -49
- package/src/components/molecules/Grid/Item/Item.tsx +3 -5
- package/src/components/molecules/HintInputContainer/HintInputContainer.tsx +3 -8
- package/src/components/molecules/TextArea/TextArea.tsx +3 -9
- package/src/index.ts +1 -0
- package/src/styles/definitions.ts +1 -1
- package/src/utils/extractNumbersFromString.ts +4 -5
- package/dist/components/molecules/DatePicker/Modal.d.ts +0 -8
- package/dist/components/molecules/DatePicker/Modal.js +0 -60
- package/dist/components/molecules/DatePicker/Modal.js.map +0 -1
- package/dist/components/molecules/DateTimePicker/Modal.d.ts +0 -7
- package/dist/components/molecules/DateTimePicker/Modal.js +0 -89
- package/dist/components/molecules/DateTimePicker/Modal.js.map +0 -1
- package/src/components/molecules/DatePicker/DatePicker.stories.tsx +0 -44
- package/src/components/molecules/DatePicker/Modal.tsx +0 -51
- package/src/components/molecules/DateTimePicker/DateTimePicker.stories.tsx +0 -26
- package/src/components/molecules/DateTimePicker/Modal.tsx +0 -84
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/molecules/Grid/Item/Item.tsx"],"names":["GridItem","children","span","columns","loadingComponent","loading","spacing","_spacing","wrapper","rest","React","Children","only","Error","getPadding","pos","undefined","style","boxSizing","flexBasis","paddingTop","paddingBottom","paddingRight","paddingLeft","clone","cloneElement","props"],"mappings":";;;;;;;AAAA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/molecules/Grid/Item/Item.tsx"],"names":["GridItem","children","span","columns","loadingComponent","loading","spacing","_spacing","wrapper","rest","React","Children","only","Error","getPadding","pos","undefined","style","boxSizing","flexBasis","paddingTop","paddingBottom","paddingRight","paddingLeft","clone","cloneElement","props"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;AAwCA,MAAMA,QAAQ,GAAG,CAAC;AAChBC,EAAAA,QADgB;AAEhBC,EAAAA,IAFgB;AAGhBC,EAAAA,OAAO,GAAG,EAHM;AAIhBC,EAAAA,gBAJgB;AAKhBC,EAAAA,OAAO,GAAG,KALM;AAMhBC,EAAAA,OAAO,EAAEC,QANO;AAOhBC,E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uBACVA,QAAQ,CAAEyB,KAAV,CAAgBT,KADN,GAEV,EAAE,GAAGA,KAAL;AAAY,UAAGhB,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,CAAEyB,KAAV,CAAgBT,KAAnB;AAAZ;AAJqC,GAA7B,CAAd;;AAOA,SAAOT,OAAO,GAAG,6BAAC,iBAAD;AAAM,IAAA,KAAK,EAAES;AAAb,KAAqBO,KAArB,CAAH,GAAwCA,KAAtD;AACD,CA9CD;;eAgDexB,Q","sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { useTheme } from '../../../../hooks';\nimport { SpacingType } from '../../../../types/defaults';\nimport { extractNumbersFromString } from '../../../../utils';\n\ntype FlexPositioning = 'flex-start' | 'flex-end' | 'center';\ntype FlexAlignBase = FlexPositioning | 'stretch';\ntype FlexAlignType = FlexAlignBase | 'baseline';\ntype FlexSpacing = 'space-between' | 'space-around';\n\ntype PaddingPosition = 'top' | 'right' | 'bottom' | 'left';\n\nexport interface IGridItem {\n children: React.ReactElement;\n /** Number of columns to fill */\n span: number;\n /** You don't have to give this property since is inherited from Grid */\n columns?: number;\n loading?: boolean;\n /** If your GridItem has a loading state, specify the component here (Skeleton) */\n loadingComponent?: React.ReactElement;\n /** Flex properties below */\n alignContent?: FlexAlignBase | FlexSpacing;\n alignItems?: FlexAlignType;\n alignSelf?: 'auto' | FlexAlignType;\n flex?: number;\n flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';\n flexGrow?: number;\n flexShrink?: number;\n justifyContent?: FlexPositioning | FlexSpacing | 'space-evenly';\n /** You don't have to give this property since is inherited from Grid */\n spacing?:\n | SpacingType\n | {\n top?: SpacingType;\n right?: SpacingType;\n bottom?: SpacingType;\n left?: SpacingType;\n };\n /** Used to wrap children in a View when its style extrapolates the dimensions*/\n wrapper?: boolean;\n}\n\nconst GridItem = ({\n children,\n span,\n columns = 12,\n loadingComponent,\n loading = false,\n spacing: _spacing,\n wrapper = false,\n ...rest\n}: IGridItem) => {\n const { spacing } = useTheme();\n if (!React.Children.only(children)) {\n throw new Error('The number of children in GridItem should be one');\n }\n if (loadingComponent && loading) {\n return loadingComponent;\n }\n\n const getPadding = (pos: PaddingPosition) => {\n if (_spacing) {\n if (typeof _spacing === 'string')\n return extractNumbersFromString(spacing[_spacing]);\n else if (typeof _spacing === 'object' && _spacing[pos]) {\n return extractNumbersFromString(spacing[_spacing[pos]!]);\n } else return undefined;\n } else return undefined;\n };\n\n const style = {\n ...rest,\n boxSizing: 'border-box',\n flexBasis: `${100 / (columns / span)}%`,\n paddingTop: getPadding('top'),\n paddingBottom: getPadding('bottom'),\n paddingRight: getPadding('right'),\n paddingLeft: getPadding('left'),\n };\n\n const clone = React.cloneElement(children, {\n ...children?.props,\n style: wrapper\n ? children?.props.style\n : { ...style, ...children?.props.style },\n });\n\n return wrapper ? <View style={style}>{clone}</View> : clone;\n};\n\nexport default GridItem;\n"],"file":"Item.js"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { InputVariantType, PressableInputContainerProps, TextProps } from '@tecsinapse/react-core';
|
|
2
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
1
|
import * as React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { InputVariantType, PressableInputContainerProps } from '../../atoms/Input';
|
|
4
|
+
import { TextProps } from '../../atoms/Text';
|
|
4
5
|
export interface HintInputContainerProps extends PressableInputContainerProps {
|
|
5
6
|
viewStyle?: StyleProp<ViewStyle>;
|
|
6
7
|
focused: boolean;
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _reactNative = require("react-native");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _Input = require("../../atoms/Input");
|
|
13
13
|
|
|
14
14
|
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); }
|
|
15
15
|
|
|
@@ -30,7 +30,7 @@ const HintInputContainer = ({
|
|
|
30
30
|
hintComponent,
|
|
31
31
|
...rest
|
|
32
32
|
}) => {
|
|
33
|
-
const _hint = hintComponent || React.createElement(
|
|
33
|
+
const _hint = hintComponent || React.createElement(_Input.Hint, {
|
|
34
34
|
TextComponent: LabelComponent,
|
|
35
35
|
text: hint,
|
|
36
36
|
variant: variant
|
|
@@ -38,7 +38,7 @@ const HintInputContainer = ({
|
|
|
38
38
|
|
|
39
39
|
return React.createElement(_reactNative.View, {
|
|
40
40
|
style: viewStyle
|
|
41
|
-
}, React.createElement(
|
|
41
|
+
}, React.createElement(_Input.PressableInputContainer, _extends({
|
|
42
42
|
onPress: onPress,
|
|
43
43
|
focused: focused,
|
|
44
44
|
disabled: disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/HintInputContainer/HintInputContainer.tsx"],"names":["HintInputContainer","viewStyle","onPress","focused","disabled","LabelComponent","variant","rightComponent","children","hint","hintComponent","rest","_hint"],"mappings":";;;;;;;AAAA;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/molecules/HintInputContainer/HintInputContainer.tsx"],"names":["HintInputContainer","viewStyle","onPress","focused","disabled","LabelComponent","variant","rightComponent","children","hint","hintComponent","rest","_hint"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;AAeA,MAAMA,kBAAqD,GAAG,CAAC;AAC7DC,EAAAA,SAD6D;AAE7DC,EAAAA,OAF6D;AAG7DC,EAAAA,OAH6D;AAI7DC,EAAAA,QAJ6D;AAK7DC,EAAAA,cAL6D;AAM7DC,EAAAA,OAAO,GAAG,SANmD;AAO7DC,EAAAA,cAP6D;AAQ7DC,EAAAA,QAR6D;AAS7DC,EAAAA,IAT6D;AAU7DC,EAAAA,aAV6D;AAW7D,KAAGC;AAX0D,CAAD,KAYxD;AACJ,QAAMC,KAAK,GAAGF,aAAa,IACzB,oBAAC,WAAD;AAAM,IAAA,aAAa,EAAEL,cAArB;AAAqC,IAAA,IAAI,EAAEI,IAA3C;AAAiD,IAAA,OAAO,EAAEH;AAA1D,IADF;;AAIA,SACE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAEL;AAAb,KACE,oBAAC,8BAAD;AACE,IAAA,OAAO,EAAEC,OADX;AAEE,IAAA,OAAO,EAAEC,OAFX;AAGE,IAAA,QAAQ,EAAEC,QAHZ;AAIE,IAAA,cAAc,EAAEC,cAJlB;AAKE,IAAA,OAAO,EAAEC,OALX;AAME,IAAA,cAAc,EAAEC;AANlB,KAOMI,IAPN,GASGH,QATH,CADF,EAYGC,IAAI,IAAIG,KAZX,CADF;AAgBD,CAjCD;;eAmCeZ,kB","sourcesContent":["import * as React from 'react';\nimport { StyleProp, View, ViewStyle } from 'react-native';\nimport { Hint, InputVariantType, PressableInputContainer, PressableInputContainerProps } from '../../atoms/Input';\nimport { TextProps } from '../../atoms/Text';\n\nexport interface HintInputContainerProps extends PressableInputContainerProps {\n viewStyle?: StyleProp<ViewStyle>;\n focused: boolean;\n LabelComponent?: React.FC<TextProps>;\n onPress?: () => void | never;\n disabled?: boolean;\n hint?: string;\n hintComponent?: JSX.Element;\n variant?: InputVariantType;\n rightComponent?: JSX.Element;\n}\n\nconst HintInputContainer: React.FC<HintInputContainerProps> = ({\n viewStyle,\n onPress,\n focused,\n disabled,\n LabelComponent,\n variant = 'default',\n rightComponent,\n children,\n hint,\n hintComponent,\n ...rest\n}) => {\n const _hint = hintComponent || (\n <Hint TextComponent={LabelComponent} text={hint} variant={variant} />\n );\n\n return (\n <View style={viewStyle}>\n <PressableInputContainer\n onPress={onPress}\n focused={focused}\n disabled={disabled}\n LabelComponent={LabelComponent}\n variant={variant}\n rightComponent={rightComponent}\n {...rest}\n >\n {children}\n </PressableInputContainer>\n {hint && _hint}\n </View>\n );\n};\n\nexport default HintInputContainer;\n"],"file":"HintInputContainer.js"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { FontStackType, FontWeightType
|
|
2
|
+
import { FontStackType, FontWeightType } from '../../../types/defaults';
|
|
3
|
+
import { InputContainerProps, InputElementProps } from '../../atoms/Input';
|
|
4
|
+
import { TextProps } from '../../atoms/Text';
|
|
3
5
|
export interface TextAreaProps extends Omit<InputElementProps, 'style' | 'multiline' | 'value'>, InputContainerProps {
|
|
4
6
|
inputFontStack?: FontStackType;
|
|
5
7
|
inputFontWeight?: FontWeightType;
|
|
@@ -7,14 +7,14 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
-
var _reactCore = require("@tecsinapse/react-core");
|
|
11
|
-
|
|
12
10
|
var _reactNative = require("react-native");
|
|
13
11
|
|
|
14
|
-
var
|
|
12
|
+
var _Input = require("../../atoms/Input");
|
|
15
13
|
|
|
16
14
|
var _Text = require("../../atoms/Text");
|
|
17
15
|
|
|
16
|
+
var _styled = require("./styled");
|
|
17
|
+
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
20
20
|
const TextArea = ({
|
|
@@ -48,7 +48,7 @@ const TextArea = ({
|
|
|
48
48
|
length = maxLength;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
const _hint = hintComponent || _react.default.createElement(
|
|
51
|
+
const _hint = hintComponent || _react.default.createElement(_Input.Hint, {
|
|
52
52
|
TextComponent: TextComponent,
|
|
53
53
|
text: hint,
|
|
54
54
|
variant: variant
|
|
@@ -1 +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;;
|
|
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;;AAEA;;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,WAAD;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 { View } from 'react-native';\nimport { FontStackType, FontWeightType } from '../../../types/defaults';\nimport { Hint, InputContainerProps, InputElementProps } from '../../atoms/Input';\nimport { Text, TextProps } from '../../atoms/Text';\nimport { StyledInputContainer } 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 // 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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export { RadioButton, RadioButtonProps } from './components/atoms/RadioButton';
|
|
|
17
17
|
export { Switch, SwitchProps } from './components/atoms/Switch';
|
|
18
18
|
export { Tag, TagProps } from './components/atoms/Tag';
|
|
19
19
|
export { Text, TextProps } from './components/atoms/Text';
|
|
20
|
-
export { Calendar, CalendarProps, DateRange, SelectionType, } from './components/molecules/Calendar';
|
|
20
|
+
export { Calendar, CalendarProps, DateRange, SelectionType, Value } from './components/molecules/Calendar';
|
|
21
21
|
export { DatePicker, DatePickerProps } from './components/molecules/DatePicker';
|
|
22
22
|
export { DateTimePicker, DateTimePickerProps, } from './components/molecules/DateTimePicker';
|
|
23
23
|
export { DateTimeSelector, DateTimeSelectorMode, DateTimeSelectorProps, } from './components/molecules/DateTimeSelector';
|
package/dist/index.js
CHANGED
|
@@ -69,6 +69,7 @@ var _exportNames = {
|
|
|
69
69
|
CalendarProps: true,
|
|
70
70
|
DateRange: true,
|
|
71
71
|
SelectionType: true,
|
|
72
|
+
Value: true,
|
|
72
73
|
DatePicker: true,
|
|
73
74
|
DatePickerProps: true,
|
|
74
75
|
DateTimePicker: true,
|
|
@@ -480,6 +481,12 @@ Object.defineProperty(exports, "SelectionType", {
|
|
|
480
481
|
return _Calendar.SelectionType;
|
|
481
482
|
}
|
|
482
483
|
});
|
|
484
|
+
Object.defineProperty(exports, "Value", {
|
|
485
|
+
enumerable: true,
|
|
486
|
+
get: function () {
|
|
487
|
+
return _Calendar.Value;
|
|
488
|
+
}
|
|
489
|
+
});
|
|
483
490
|
Object.defineProperty(exports, "DatePicker", {
|
|
484
491
|
enumerable: true,
|
|
485
492
|
get: function () {
|
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;;AAkBA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AAIA;;AAKA;;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;;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 IMask,\n IMaskValue,\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 Value\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 { GridItem, Grid, IGridItem, IGrid } from './components/molecules/Grid';\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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/styles/definitions.ts"],"names":["statusColor","error","xlight","light","medium","dark","xdark","warning","success","info","hex2rgba","hex","alpha","r","g","b","match","map","x","parseInt","miscellaneous","shadow","overlay","bodyColor","surfaceColor","spacing","nano","micro","mili","centi","deca","kilo","mega","giga","tera","peta","hexa","iconSize","borderRadius","pill","borderWidth","pico","typography","h5","fontSize","lineHeight","h4","h3","h2","h1","base","sub","label","fontStack","default","mono","fontWeight","regular","bold","black","fontFiles","fontColor","orange","zIndex","absolute","select","input","popover","tooltip","header","backdrop","drawer","sidebar","modal"],"mappings":";;;;;;;AAYA;;AAEO,MAAMA,WAAW,GAAG;AACzBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE,SADH;AAELC,IAAAA,KAAK,EAAE,SAFF;AAGLC,IAAAA,MAAM,EAAE,SAHH;AAILC,IAAAA,IAAI,EAAE,SAJD;AAKLC,IAAAA,KAAK,EAAE;AALF,GADkB;AAQzBC,EAAAA,OAAO,EAAE;AACPL,IAAAA,MAAM,EAAE,SADD;AAEPC,IAAAA,KAAK,EAAE,SAFA;AAGPC,IAAAA,MAAM,EAAE,SAHD;AAIPC,IAAAA,IAAI,EAAE,SAJC;AAKPC,IAAAA,KAAK,EAAE;AALA,GARgB;AAezBE,EAAAA,OAAO,EAAE;AACPN,IAAAA,MAAM,EAAE,SADD;AAEPC,IAAAA,KAAK,EAAE,SAFA;AAGPC,IAAAA,MAAM,EAAE,SAHD;AAIPC,IAAAA,IAAI,EAAE,SAJC;AAKPC,IAAAA,KAAK,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OAAO,EAAE,CADmB;AAE5BU,EAAAA,QAAQ,EAAE,CAFkB;AAG5BC,EAAAA,MAAM,EAAE,EAHoB;AAI5BC,EAAAA,KAAK,EAAE,EAJqB;AAK5BC,EAAAA,OAAO,EAAE,EALmB;AAM5BC,EAAAA,OAAO,EAAE,EANmB;AAO5BC,EAAAA,MAAM,EAAE,GAPoB;AAQ5BC,EAAAA,QAAQ,EAAE,GARkB;AAS5BC,EAAAA,MAAM,EAAE,GAToB;AAU5BC,EAAAA,OAAO,EAAE,GAVmB;AAW5BC,EAAAA,KAAK,EAAE;AAXqB,CAAvB","sourcesContent":["import {\n BorderRadius,\n BorderWidth,\n FontColor,\n FontStack,\n FontWeight,\n IconSize,\n Miscellaneous,\n Spacing,\n TypographyVariation,\n ZIndex\n} from '../types/defaults';\nimport { RFValueStr } from '../utils';\n\nexport const statusColor = {\n error: {\n xlight: '#fdf3f2',\n light: '#ee9891',\n medium: '#e04638',\n dark: '#9b2318',\n xdark: '#58240e',\n },\n warning: {\n xlight: '#fffcf0',\n light: '#ffe380',\n medium: '#ffc700',\n dark: '#cc9f00',\n xdark: '#665000',\n },\n success: {\n xlight: '#f3fcf8',\n light: '#99e6c9',\n medium: '#2db783',\n dark: '#238f67',\n xdark: '#14523b',\n },\n info: {\n xlight: '#f0f8fe',\n light: '#85c7fa',\n medium: '#239bf6',\n dark: '#0873c4',\n xdark: '#043962',\n },\n};\n\nexport const hex2rgba: (hex, alpha?: number) => string = (hex, alpha = 1) => {\n const [r, g, b] = hex.match(/\\w\\w/g).map(x => parseInt(x, 16));\n return `rgba(${r},${g},${b},${alpha})`;\n};\n\nexport const miscellaneous: Miscellaneous = {\n shadow: '#
|
|
1
|
+
{"version":3,"sources":["../../src/styles/definitions.ts"],"names":["statusColor","error","xlight","light","medium","dark","xdark","warning","success","info","hex2rgba","hex","alpha","r","g","b","match","map","x","parseInt","miscellaneous","shadow","overlay","bodyColor","surfaceColor","spacing","nano","micro","mili","centi","deca","kilo","mega","giga","tera","peta","hexa","iconSize","borderRadius","pill","borderWidth","pico","typography","h5","fontSize","lineHeight","h4","h3","h2","h1","base","sub","label","fontStack","default","mono","fontWeight","regular","bold","black","fontFiles","fontColor","orange","zIndex","absolute","select","input","popover","tooltip","header","backdrop","drawer","sidebar","modal"],"mappings":";;;;;;;AAYA;;AAEO,MAAMA,WAAW,GAAG;AACzBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE,SADH;AAELC,IAAAA,KAAK,EAAE,SAFF;AAGLC,IAAAA,MAAM,EAAE,SAHH;AAILC,IAAAA,IAAI,EAAE,SAJD;AAKLC,IAAAA,KAAK,EAAE;AALF,GADkB;AAQzBC,EAAAA,OAAO,EAAE;AACPL,IAAAA,MAAM,EAAE,SADD;AAEPC,IAAAA,KAAK,EAAE,SAFA;AAGPC,IAAAA,MAAM,EAAE,SAHD;AAIPC,IAAAA,IAAI,EAAE,SAJC;AAKPC,IAAAA,KAAK,EAAE;AALA,GARgB;AAezBE,EAAAA,OAAO,EAAE;AACPN,IAAAA,MAAM,EAAE,SADD;AAEPC,IAAAA,KAAK,EAAE,SAFA;AAGPC,IAAAA,MAAM,EAAE,SAHD;AAIPC,IAAAA,IAAI,EAAE,SAJC;AAKPC,IAAAA,KAAK,EAAE;AALA,GAfgB;AAsBzBG,EAAAA,IAAI,EAAE;AACJP,IAAAA,MAAM,EAAE,SADJ;AAEJC,IAAAA,KAAK,EAAE,SAFH;AAGJC,IAAAA,MAAM,EAAE,SAHJ;AAIJC,IAAAA,IAAI,EAAE,SAJF;AAKJC,IAAAA,KAAK,EAAE;AALH;AAtBmB,CAApB;;;AA+BA,MAAMI,QAAyC,GAAG,CAACC,GAAD,EAAMC,KAAK,GAAG,CAAd,KAAoB;AAC3E,QAAM,CAACC,CAAD,EAAIC,CAAJ,EAAOC,CAAP,IAAYJ,GAAG,CAACK,KAAJ,CAAU,OAAV,EAAmBC,GAAnB,CAAuBC,CAAC,IAAIC,QAAQ,CAACD,CAAD,EAAI,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,\n Spacing,\n TypographyVariation,\n ZIndex\n} from '../types/defaults';\nimport { RFValueStr } from '../utils';\n\nexport const statusColor = {\n error: {\n xlight: '#fdf3f2',\n light: '#ee9891',\n medium: '#e04638',\n dark: '#9b2318',\n xdark: '#58240e',\n },\n warning: {\n xlight: '#fffcf0',\n light: '#ffe380',\n medium: '#ffc700',\n dark: '#cc9f00',\n xdark: '#665000',\n },\n success: {\n xlight: '#f3fcf8',\n light: '#99e6c9',\n medium: '#2db783',\n dark: '#238f67',\n xdark: '#14523b',\n },\n info: {\n xlight: '#f0f8fe',\n light: '#85c7fa',\n medium: '#239bf6',\n dark: '#0873c4',\n xdark: '#043962',\n },\n};\n\nexport const hex2rgba: (hex, alpha?: number) => string = (hex, alpha = 1) => {\n const [r, g, b] = hex.match(/\\w\\w/g).map(x => parseInt(x, 16));\n return `rgba(${r},${g},${b},${alpha})`;\n};\n\nexport const miscellaneous: Miscellaneous = {\n shadow: '#000000', // black\n overlay: '#282625', // rgba(40, 38, 37, 0.5)\n bodyColor: '#f8f7f7',\n surfaceColor: '#ffffff', //input, group button, cards\n};\n\nexport const spacing: Spacing = {\n nano: RFValueStr('2px'),\n micro: RFValueStr('4px'),\n mili: RFValueStr('8px'),\n centi: RFValueStr('12px'),\n deca: RFValueStr('16px'),\n kilo: RFValueStr('24px'),\n mega: RFValueStr('32px'),\n giga: RFValueStr('40px'),\n tera: RFValueStr('48px'),\n peta: RFValueStr('56px'),\n hexa: RFValueStr('64px'),\n};\n\nexport const iconSize: IconSize = {\n micro: RFValueStr('12px'),\n mili: RFValueStr('14px'),\n centi: RFValueStr('16px'), // '1rem'\n deca: RFValueStr('18px'), // '1.5rem'\n kilo: RFValueStr('24px'), // '1.6rem'\n mega: RFValueStr('32px'), // '2rem'\n};\n\nexport const borderRadius: BorderRadius = {\n nano: RFValueStr('2px'),\n micro: RFValueStr('4px'),\n mili: RFValueStr('8px'),\n centi: RFValueStr('16px'),\n deca: RFValueStr('24px'),\n pill: RFValueStr('999999px'), // also circle\n};\n\nexport const borderWidth: BorderWidth = {\n pico: RFValueStr('1px'),\n nano: RFValueStr('2px'),\n};\n\nexport const typography: TypographyVariation = {\n h5: {\n fontSize: RFValueStr('16px'), // '1rem'\n lineHeight: RFValueStr('24px'), // '1.5rem'\n },\n h4: {\n fontSize: RFValueStr('18px'), // '1.125rem'\n lineHeight: RFValueStr('27px'), // '1.688rem'\n },\n h3: {\n fontSize: RFValueStr('20px'), // '1.25rem'\n lineHeight: RFValueStr('32px'), // '2rem'\n },\n h2: {\n fontSize: RFValueStr('26px'), // '1.625rem'\n lineHeight: RFValueStr('38px'), // '2.375rem'\n },\n h1: {\n fontSize: RFValueStr('32px'), // '2rem'\n lineHeight: RFValueStr('42px'), // '2.625rem'\n },\n base: {\n fontSize: RFValueStr('14px'), // '0.875rem'\n lineHeight: RFValueStr('21px'), // '1.313rem'\n },\n sub: {\n fontSize: RFValueStr('12px'), // '0.75rem'\n lineHeight: RFValueStr('18px'), // '1.125rem'\n },\n label: {\n fontSize: RFValueStr('10px'),\n lineHeight: RFValueStr('12px'),\n },\n};\n\nexport const fontStack: FontStack = {\n default: 'Lato',\n mono: 'Consolas, monaco, monospace',\n};\n\nexport const fontWeight: FontWeight = {\n regular: '400',\n bold: '700',\n black: '900',\n};\n\nexport const fontFiles: FontWeight = {\n black: '{0}-Black',\n bold: '{0}-Bold',\n regular: '{0}-Regular',\n};\n\nexport const fontColor: FontColor = {\n light: '#fff',\n medium: '#85807a',\n dark: '#353231', // default\n orange: '#f89907',\n};\n\nexport const zIndex: ZIndex = {\n default: 0,\n absolute: 1,\n select: 20,\n input: 20,\n popover: 30,\n tooltip: 40,\n header: 600,\n backdrop: 700,\n drawer: 700,\n sidebar: 800,\n modal: 1000,\n};\n\nexport type IconType =\n | 'material'\n | 'material-community'\n | 'simple-line-icon'\n | 'zocial'\n | 'font-awesome'\n | 'octicon'\n | 'ionicon'\n | 'foundation'\n | 'evilicon'\n | 'entypo'\n | 'antdesign'\n | 'font-awesome-5'\n | string;\n"],"file":"definitions.js"}
|
|
@@ -9,7 +9,7 @@ const extractNumbersFromString = value => Number(extractDigitsFromString(value))
|
|
|
9
9
|
|
|
10
10
|
exports.extractNumbersFromString = extractNumbersFromString;
|
|
11
11
|
|
|
12
|
-
const extractDigitsFromString = value => value.replace(/[
|
|
12
|
+
const extractDigitsFromString = value => value.replace(/[^0-9]/g, '');
|
|
13
13
|
|
|
14
14
|
exports.extractDigitsFromString = extractDigitsFromString;
|
|
15
15
|
//# sourceMappingURL=extractNumbersFromString.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/extractNumbersFromString.ts"],"names":["extractNumbersFromString","value","Number","extractDigitsFromString","replace"],"mappings":";;;;;;;AAAO,MAAMA,wBAAwB,GAAIC,KAAD,
|
|
1
|
+
{"version":3,"sources":["../../src/utils/extractNumbersFromString.ts"],"names":["extractNumbersFromString","value","Number","extractDigitsFromString","replace"],"mappings":";;;;;;;AAAO,MAAMA,wBAAwB,GAAIC,KAAD,IACtCC,MAAM,CAACC,uBAAuB,CAACF,KAAD,CAAxB,CADD;;;;AAGA,MAAME,uBAAuB,GAAIF,KAAD,IACrCA,KAAK,CAACG,OAAN,CAAc,SAAd,EAAyB,EAAzB,CADK","sourcesContent":["export const extractNumbersFromString = (value: string): number =>\n Number(extractDigitsFromString(value));\n\nexport const extractDigitsFromString = (value: string): string =>\n value.replace(/[^0-9]/g, '');\n"],"file":"extractNumbersFromString.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.12.
|
|
4
|
+
"version": "1.12.9",
|
|
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": "7b090c696311b6aa4d412b8839fba00ccf5f7fd6"
|
|
35
35
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import currency from 'currency.js';
|
|
2
2
|
import { useCallback, useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { extractNumbersFromString } from '../../../../utils';
|
|
4
|
+
import { IMask, IMaskValue } from './useMask';
|
|
5
5
|
|
|
6
6
|
type CurrencyOptions = currency.Options;
|
|
7
7
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { useTheme } from '@emotion/react';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { Animated, ViewProps } from 'react-native';
|
|
3
|
-
import { Container, Progress, Segment } from './styled';
|
|
4
|
-
import { useTheme } from '@emotion/react';
|
|
5
4
|
import {
|
|
6
5
|
ColorGradationType,
|
|
7
6
|
ColorType,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from '
|
|
7
|
+
ThemeProp
|
|
8
|
+
} from '../../../types/defaults';
|
|
9
|
+
import { extractNumbersFromString } from '../../../utils';
|
|
10
|
+
import { Container, Progress, Segment } from './styled';
|
|
11
11
|
|
|
12
12
|
export interface ProgressBarProps extends ViewProps {
|
|
13
13
|
/** Number of segments. Defaults to 1. Set to 1 when 0 or less */
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { useTheme } from '@emotion/react';
|
|
2
2
|
import React, { FC, useCallback, useEffect } from 'react';
|
|
3
|
-
import { Animated, StyleProp, ViewStyle
|
|
3
|
+
import { Animated, LayoutChangeEvent, StyleProp, ViewStyle } from 'react-native';
|
|
4
4
|
import {
|
|
5
5
|
ColorGradationType,
|
|
6
6
|
ColorType,
|
|
7
|
-
ThemeProp
|
|
7
|
+
ThemeProp
|
|
8
8
|
} from '../../../types/defaults';
|
|
9
|
+
import { extractNumbersFromString, lightenDarkenColor, RFValueStr } from '../../../utils';
|
|
9
10
|
import { PressableSurface } from '../PressableSurface';
|
|
10
|
-
import { StyledSwitch } from './styled';
|
|
11
11
|
import { transitionSwitch } from './animation';
|
|
12
|
-
import {
|
|
12
|
+
import { StyledSwitch, StyledSwitchContent, SWITCH_PIN_WIDTH } from './styled';
|
|
13
13
|
|
|
14
14
|
export interface SwitchProps {
|
|
15
15
|
onChange: (active: boolean) => void;
|
|
@@ -36,44 +36,43 @@ const Switch: FC<SwitchProps> = ({
|
|
|
36
36
|
}): JSX.Element => {
|
|
37
37
|
const theme = useTheme() as ThemeProp;
|
|
38
38
|
|
|
39
|
-
const
|
|
40
|
-
|
|
39
|
+
const width = React.useRef(0)
|
|
40
|
+
const transitionValue = React.useRef(new Animated.Value(0)).current
|
|
41
|
+
const animatedColor = React.useRef(new Animated.Value(0)).current
|
|
42
|
+
|
|
43
|
+
const calculateTranslate = () => {
|
|
44
|
+
if (width.current > 0) {
|
|
45
|
+
return width.current - (extractNumbersFromString(theme.spacing.micro) * 2) - (extractNumbersFromString(RFValueStr(SWITCH_PIN_WIDTH)))
|
|
46
|
+
}
|
|
47
|
+
return 0
|
|
48
|
+
}
|
|
41
49
|
|
|
42
|
-
const
|
|
43
|
-
.
|
|
44
|
-
|
|
45
|
-
const getBackgroundColor = (color: string, variation: number) => {
|
|
46
|
-
return disabled ? lightenDarkenColor(color, variation) : color;
|
|
50
|
+
const getBackgroundColor = (color: string) => {
|
|
51
|
+
return disabled ? lightenDarkenColor(theme.color[inactiveColor][inactiveColorTone], 20) : color;
|
|
47
52
|
};
|
|
48
53
|
|
|
49
54
|
const interpolateColor = animatedColor.interpolate({
|
|
50
55
|
inputRange: [0, 1],
|
|
51
56
|
outputRange: [
|
|
52
|
-
getBackgroundColor(theme.color[inactiveColor][inactiveColorTone]
|
|
53
|
-
getBackgroundColor(theme.color[activeColor][activeColorTone]
|
|
54
|
-
]
|
|
57
|
+
getBackgroundColor(theme.color[inactiveColor][inactiveColorTone]),
|
|
58
|
+
getBackgroundColor(theme.color[activeColor][activeColorTone]),
|
|
59
|
+
]
|
|
55
60
|
});
|
|
56
61
|
|
|
57
|
-
const animatedStyle = {
|
|
58
|
-
backgroundColor: interpolateColor,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
62
|
useEffect(() => {
|
|
62
|
-
|
|
63
|
+
const translate = calculateTranslate()
|
|
64
|
+
transitionSwitch(active, translate, transitionValue, animatedColor);
|
|
63
65
|
}, [active]);
|
|
64
66
|
|
|
65
67
|
const handleChange = useCallback(() => {
|
|
66
68
|
onChange(!active);
|
|
67
69
|
}, [active, onChange]);
|
|
68
70
|
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
width: 40,
|
|
75
|
-
height: 22,
|
|
76
|
-
};
|
|
71
|
+
const handleSwitchLayout = (lce: LayoutChangeEvent) => {
|
|
72
|
+
width.current = lce.nativeEvent.layout.width
|
|
73
|
+
const translate = calculateTranslate()
|
|
74
|
+
transitionSwitch(active, translate, transitionValue, animatedColor);
|
|
75
|
+
}
|
|
77
76
|
|
|
78
77
|
return (
|
|
79
78
|
<PressableSurface
|
|
@@ -82,11 +81,9 @@ const Switch: FC<SwitchProps> = ({
|
|
|
82
81
|
effect="none"
|
|
83
82
|
disabled={disabled}
|
|
84
83
|
>
|
|
85
|
-
<
|
|
86
|
-
<StyledSwitch
|
|
87
|
-
|
|
88
|
-
/>
|
|
89
|
-
</Animated.View>
|
|
84
|
+
<StyledSwitchContent onLayout={handleSwitchLayout} style={{ backgroundColor: interpolateColor }}>
|
|
85
|
+
<StyledSwitch style={[dotStyle, { transform: [{ translateX: transitionValue }] }]}/>
|
|
86
|
+
</StyledSwitchContent>
|
|
90
87
|
</PressableSurface>
|
|
91
88
|
);
|
|
92
89
|
};
|
|
@@ -1,31 +1,41 @@
|
|
|
1
|
-
import { Animated } from 'react-native';
|
|
1
|
+
import { Animated, Easing } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const ANIMATION_SPEED = 140
|
|
2
4
|
|
|
3
5
|
export const transitionSwitch = (
|
|
4
6
|
active: boolean,
|
|
7
|
+
translate: number,
|
|
5
8
|
transitionValue: Animated.Value,
|
|
6
9
|
animatedColor: Animated.Value
|
|
7
10
|
): void => {
|
|
11
|
+
|
|
12
|
+
if (translate <= 0) return
|
|
13
|
+
|
|
8
14
|
if (active) {
|
|
9
15
|
Animated.timing(transitionValue, {
|
|
10
|
-
toValue:
|
|
11
|
-
duration:
|
|
12
|
-
|
|
13
|
-
}).start();
|
|
14
|
-
Animated.timing(animatedColor, {
|
|
15
|
-
toValue: 0,
|
|
16
|
-
duration: 150,
|
|
17
|
-
useNativeDriver: false,
|
|
18
|
-
}).start();
|
|
19
|
-
} else {
|
|
20
|
-
Animated.timing(transitionValue, {
|
|
21
|
-
toValue: 16.5,
|
|
22
|
-
duration: 150,
|
|
16
|
+
toValue: translate,
|
|
17
|
+
duration: ANIMATION_SPEED,
|
|
18
|
+
easing: Easing.out(Easing.ease),
|
|
23
19
|
useNativeDriver: true,
|
|
24
20
|
}).start();
|
|
25
21
|
Animated.timing(animatedColor, {
|
|
26
22
|
toValue: 1,
|
|
27
|
-
duration:
|
|
23
|
+
duration: ANIMATION_SPEED,
|
|
28
24
|
useNativeDriver: false,
|
|
29
25
|
}).start();
|
|
30
|
-
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
Animated.timing(transitionValue, {
|
|
30
|
+
toValue: 0,
|
|
31
|
+
duration: ANIMATION_SPEED,
|
|
32
|
+
easing: Easing.out(Easing.ease),
|
|
33
|
+
useNativeDriver: true,
|
|
34
|
+
}).start();
|
|
35
|
+
Animated.timing(animatedColor, {
|
|
36
|
+
toValue: 0,
|
|
37
|
+
duration: ANIMATION_SPEED,
|
|
38
|
+
useNativeDriver: false,
|
|
39
|
+
}).start();
|
|
40
|
+
|
|
31
41
|
};
|
|
@@ -2,21 +2,23 @@ import styled from '@emotion/native';
|
|
|
2
2
|
import { Animated } from 'react-native';
|
|
3
3
|
import { StyleProps } from '../../../types/defaults';
|
|
4
4
|
import { RFValueStr } from '../../../utils';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
export const SWITCH_BODY_WIDTH = '40px'
|
|
7
|
+
export const SWITCH_PIN_WIDTH = '16px'
|
|
6
8
|
|
|
7
9
|
export const StyledSwitchContent = styled(Animated.View)<
|
|
8
|
-
Partial<
|
|
10
|
+
Partial<StyleProps>
|
|
9
11
|
>`
|
|
10
12
|
border-radius: ${({ theme }) => theme.borderRadius.pill};
|
|
11
13
|
padding: 0 ${({ theme }) => theme.spacing.micro};
|
|
12
14
|
justify-content: center;
|
|
13
|
-
width: ${RFValueStr(
|
|
15
|
+
width: ${RFValueStr(SWITCH_BODY_WIDTH)};
|
|
14
16
|
height: ${RFValueStr('22px')};
|
|
15
17
|
`;
|
|
16
18
|
|
|
17
19
|
export const StyledSwitch = styled(Animated.View)<Partial<StyleProps>>`
|
|
18
20
|
border-radius: ${({ theme }) => theme.borderRadius.pill};
|
|
19
21
|
background-color: ${({ theme }) => theme.miscellaneous.surfaceColor};
|
|
20
|
-
width: ${RFValueStr(
|
|
22
|
+
width: ${RFValueStr(SWITCH_PIN_WIDTH)};
|
|
21
23
|
height: ${RFValueStr('16px')};
|
|
22
24
|
`;
|
|
@@ -5,7 +5,6 @@ import { StyleProps } from '@tecsinapse/react-core';
|
|
|
5
5
|
export const baseStyles = ({ theme }: StyleProps): any => css`
|
|
6
6
|
border-radius: ${theme.borderRadius.mili};
|
|
7
7
|
background-color: ${theme.miscellaneous.surfaceColor};
|
|
8
|
-
overflow: hidden;
|
|
9
8
|
`;
|
|
10
9
|
|
|
11
10
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -16,10 +15,10 @@ export const elevatedStyles = ({
|
|
|
16
15
|
elevated && [
|
|
17
16
|
css({
|
|
18
17
|
shadowColor: theme.miscellaneous.shadow,
|
|
19
|
-
shadowOffset: { width: 0, height:
|
|
20
|
-
shadowOpacity: 0.
|
|
21
|
-
shadowRadius:
|
|
22
|
-
elevation: 2
|
|
18
|
+
shadowOffset: { width: 0, height: 2 },
|
|
19
|
+
shadowOpacity: 0.05,
|
|
20
|
+
shadowRadius: 5,
|
|
21
|
+
elevation: 2
|
|
23
22
|
}),
|
|
24
23
|
];
|
|
25
24
|
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
@@ -19,26 +19,6 @@ export const TitleContainer = styled.View<Partial<StyleProps>>`
|
|
|
19
19
|
background-color: ${({ theme }) => theme.color.secondary.xlight};
|
|
20
20
|
`;
|
|
21
21
|
|
|
22
|
-
const surfaceBorderRight = ({
|
|
23
|
-
isRright,
|
|
24
|
-
theme,
|
|
25
|
-
}: ButtonBorders & Partial<StyleProps>) =>
|
|
26
|
-
!isWeb &&
|
|
27
|
-
isRright &&
|
|
28
|
-
css`
|
|
29
|
-
border-top-right-radius: ${theme?.borderRadius.deca};
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
const surfaceBorderLeft = ({
|
|
33
|
-
isLeft,
|
|
34
|
-
theme,
|
|
35
|
-
}: ButtonBorders & Partial<StyleProps>) =>
|
|
36
|
-
!isWeb &&
|
|
37
|
-
isLeft &&
|
|
38
|
-
css`
|
|
39
|
-
border-top-left-radius: ${theme?.borderRadius.deca};
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
22
|
export const Control = styled(PressableSurface)(
|
|
43
23
|
(
|
|
44
24
|
props: Partial<StyleProps> & ButtonBorders & { align: 'start' | 'end' }
|
|
@@ -47,8 +27,6 @@ export const Control = styled(PressableSurface)(
|
|
|
47
27
|
padding: ${props.theme?.spacing.centi};
|
|
48
28
|
border-radius: ${props.theme?.borderRadius.mili};
|
|
49
29
|
margin: ${props.theme?.spacing.mili};
|
|
50
|
-
${surfaceBorderRight(props)}
|
|
51
|
-
${surfaceBorderLeft(props)}
|
|
52
30
|
`
|
|
53
31
|
);
|
|
54
32
|
|