@tecsinapse/react-core 1.11.0 → 1.11.1

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.11.1](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.11.0...@tecsinapse/react-core@1.11.1) (2021-12-20)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * complement active on transitionSwitch ([969a047](https://github.com/tecsinapse/design-system/commit/969a04748dc74107e22be6bc103e12c813ee232d))
12
+ * missing some locales on datetime formats ([97ca962](https://github.com/tecsinapse/design-system/commit/97ca9621dd67daf4b4d1f9e58783b3ba721a2e31))
13
+
14
+
15
+
16
+
17
+
6
18
  # [1.11.0](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.10.4...@tecsinapse/react-core@1.11.0) (2021-12-17)
7
19
 
8
20
 
@@ -54,7 +54,7 @@ const Switch = ({
54
54
  backgroundColor: interpolateColor
55
55
  };
56
56
  (0, _react2.useEffect)(() => {
57
- (0, _animation.transitionSwitch)(active, transitionValue, animatedColor);
57
+ (0, _animation.transitionSwitch)(!active, transitionValue, animatedColor);
58
58
  }, [active]);
59
59
  const handleChange = (0, _react2.useCallback)(() => {
60
60
  onChange(!active);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/Switch/Switch.tsx"],"names":["Switch","onChange","activeColor","activeColorTone","inactiveColor","inactiveColorTone","active","dotStyle","disabled","rest","theme","transitionValue","React","useRef","Animated","Value","current","animatedColor","getBackgroundColor","color","variation","interpolateColor","interpolate","inputRange","outputRange","animatedStyle","backgroundColor","handleChange","stylesDefault","borderRadius","pill","paddingHorizontal","spacing","micro","paddingVertical","justifyContent","width","height","transform","translateX"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAMA;;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AjB,EAAyBK,eAAzB,EAA0CM,aAA1C;AACD,GAFD,EAEG,CAACX,MAAD,CAFH;AAIA,QAAMqB,YAAY,GAAG,yBAAY,MAAM;AACrC1B,IAAAA,QAAQ,CAAC,CAACK,MAAF,CAAR;AACD,GAFoB,EAElB,CAACA,MAAD,EAASL,QAAT,CAFkB,CAArB;AAIA,QAAM2B,aAAwB,GAAG;AAC/BC,IAAAA,YAAY,EAAE,qCAAyBnB,KAAK,CAACmB,YAAN,CAAmBC,IAA5C,CADiB;AAE/BC,IAAAA,iBAAiB,EAAE,qCAAyBrB,KAAK,CAACsB,OAAN,CAAcC,KAAvC,CAFY;AAG/BC,IAAAA,eAAe,EAAE,CAHc;AAI/BC,IAAAA,cAAc,EAAE,QAJe;AAK/BC,IAAAA,KAAK,EAAE,EALwB;AAM/BC,IAAAA,MAAM,EAAE;AANuB,GAAjC;AASA,SACI,8BAAC,kCAAD,eACM5B,IADN;AAEE,IAAA,OAAO,EAAEkB,YAFX;AAGE,IAAA,MAAM,EAAC,MAHT;AAIE,IAAA,QAAQ,EAAEnB;AAJZ,MAME,8BAAC,qBAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAE,EAAE,GAAGiB,aAAL;AAAoB,SAAGG;AAAvB;AAAtB,KACE,8BAAC,oBAAD;AACE,IAAA,KAAK,EAAE,CAACrB,QAAD,EAAW;AAAE+B,MAAAA,SAAS,EAAE,CAAC;AAAEC,QAAAA,UAAU,EAAE5B;AAAd,OAAD;AAAb,KAAX;AADT,IADF,CANF,CADJ;AAcD,CAlED;;eAoEeX,M","sourcesContent":["import { useTheme } from '@emotion/react';\nimport React, { FC, useCallback, useEffect } from 'react';\nimport { Animated, StyleProp, ViewStyle, Text } 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, lightenDarkenColor } 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 disabled?: boolean;\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 disabled = false,\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 getBackgroundColor = (color: string, variation: number) => {\n return disabled ? lightenDarkenColor(color, variation) : color;\n };\n\n const interpolateColor = animatedColor.interpolate({\n inputRange: [0, 1],\n outputRange: [\n getBackgroundColor(theme.color[inactiveColor][inactiveColorTone], 25),\n getBackgroundColor(theme.color[activeColor][activeColorTone], 50),\n ],\n });\n\n const animatedStyle = {\n backgroundColor: interpolateColor,\n };\n\n useEffect(() => {\n transitionSwitch(active, transitionValue, animatedColor);\n }, [active]);\n\n const handleChange = useCallback(() => {\n onChange(!active);\n }, [active, onChange]);\n\n const stylesDefault: 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\n {...rest}\n onPress={handleChange}\n effect=\"none\"\n disabled={disabled}\n >\n <Animated.View style={{ ...animatedStyle, ...stylesDefault }}>\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
+ {"version":3,"sources":["../../../../src/components/atoms/Switch/Switch.tsx"],"names":["Switch","onChange","activeColor","activeColorTone","inactiveColor","inactiveColorTone","active","dotStyle","disabled","rest","theme","transitionValue","React","useRef","Animated","Value","current","animatedColor","getBackgroundColor","color","variation","interpolateColor","interpolate","inputRange","outputRange","animatedStyle","backgroundColor","handleChange","stylesDefault","borderRadius","pill","paddingHorizontal","spacing","micro","paddingVertical","justifyContent","width","height","transform","translateX"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;;;;;;;AAcA,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/BC,EAAAA,QAAQ,GAAG,KARoB;AAS/B,KAAGC;AAT4B,CAAD,KAUb;AACjB,QAAMC,KAAK,GAAG,sBAAd;;AAEA,QAAMC,eAAe,GAAGC,gBAAMC,MAAN,CAAa,IAAIC,sBAASC,KAAb,CAAmBT,MAAM,GAAG,IAAH,GAAU,CAAnC,CAAb,EACrBU,OADH;;AAGA,QAAMC,aAAa,GAAGL,gBAAMC,MAAN,CAAa,IAAIC,sBAASC,KAAb,CAAmBT,MAAM,GAAG,CAAH,GAAO,CAAhC,CAAb,EACnBU,OADH;;AAGA,QAAME,kBAAkB,GAAG,CAACC,KAAD,EAAgBC,SAAhB,KAAsC;AAC/D,WAAOZ,QAAQ,GAAG,+BAAmBW,KAAnB,EAA0BC,SAA1B,CAAH,GAA0CD,KAAzD;AACD,GAFD;;AAIA,QAAME,gBAAgB,GAAGJ,aAAa,CAACK,WAAd,CAA0B;AACjDC,IAAAA,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,CADqC;AAEjDC,IAAAA,WAAW,EAAE,CACXN,kBAAkB,CAACR,KAAK,CAACS,KAAN,CAA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,CAlED;;eAoEeX,M","sourcesContent":["import { useTheme } from '@emotion/react';\nimport React, { FC, useCallback, useEffect } from 'react';\nimport { Animated, StyleProp, ViewStyle, Text } 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, lightenDarkenColor } 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 disabled?: boolean;\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 disabled = false,\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 getBackgroundColor = (color: string, variation: number) => {\n return disabled ? lightenDarkenColor(color, variation) : color;\n };\n\n const interpolateColor = animatedColor.interpolate({\n inputRange: [0, 1],\n outputRange: [\n getBackgroundColor(theme.color[inactiveColor][inactiveColorTone], 25),\n getBackgroundColor(theme.color[activeColor][activeColorTone], 50),\n ],\n });\n\n const animatedStyle = {\n backgroundColor: interpolateColor,\n };\n\n useEffect(() => {\n transitionSwitch(!active, transitionValue, animatedColor);\n }, [active]);\n\n const handleChange = useCallback(() => {\n onChange(!active);\n }, [active, onChange]);\n\n const stylesDefault: 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\n {...rest}\n onPress={handleChange}\n effect=\"none\"\n disabled={disabled}\n >\n <Animated.View style={{ ...animatedStyle, ...stylesDefault }}>\n <StyledSwitch\n style={[dotStyle, { transform: [{ translateX: transitionValue }] }]}\n />\n </Animated.View>\n </PressableSurface>\n );\n};\n\nexport default Switch;\n"],"file":"Switch.js"}
@@ -69,13 +69,21 @@ function DatePicker({
69
69
  if (!value) return placeholder;
70
70
 
71
71
  if (type === 'day') {
72
- return (0, _dateFns.format)(value, format);
72
+ return (0, _dateFns.format)(value, format, {
73
+ locale: locale
74
+ });
73
75
  } else {
74
76
  const {
75
77
  lowest,
76
78
  highest
77
79
  } = value;
78
- if (highest) return `${(0, _dateFns.format)(lowest, format)} - ${(0, _dateFns.format)(highest, format)}`;else return (0, _dateFns.format)(lowest, format);
80
+ if (highest) return `${(0, _dateFns.format)(lowest, format, {
81
+ locale: locale
82
+ })} - ${(0, _dateFns.format)(highest, format, {
83
+ locale: locale
84
+ })}`;else return (0, _dateFns.format)(lowest, format, {
85
+ locale: locale
86
+ });
79
87
  }
80
88
  };
81
89
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/DatePicker/DatePicker.tsx"],"names":["DatePicker","month","year","onChange","value","type","format","placeholder","onFocus","onBlur","disabled","controlComponent","hintComponent","hint","variant","TextComponent","Text","CalendarComponent","bottomOffset","rightComponent","animationType","style","locale","closeOnPick","rest","focused","handleBlur","handleFocus","modalVisible","setModalVisible","React","useState","handlePressInput","useCallback","handleCloseModal","getDisplayValue","lowest","highest","StyledText","setTimeout"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;AAoBA,SAASA,UAAT,CAA6C;AAE3CC,EAAAA,KAF2C;AAG3CC,EAAAA,IAH2C;AAI3CC,EAAAA,QAJ2C;AAK3CC,EAAAA,KAL2C;AAM3CC,EAAAA,IAN2C;AAO3CC,EAAAA,MAAM,GAAG,YAPkC;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,EAAC,SAAzC;AAAmD,MAAA,IAAI,EAAC;AAAxD,MADF,EAEGM,cAFH;AAVJ,KAeMK,IAfN,GAiBE,oBAAC,UAAD;AAAY,IAAA,UAAU,EAAC,MAAvB;AAA8B,IAAA,QAAQ,EAAEd;AAAxC,KACGyB,eAAe,MAAM,GADxB,CAjBF,CAJJ,EA0BE,oBAAC,YAAD;AACE,IAAA,iBAAiB,EAAElB,iBADrB;AAEE,IAAA,YAAY,EAAEC,YAFhB;AAGE,IAAA,OAAO,EAAEU,YAHX;AAIE,IAAA,cAAc,EAAEM,gBAJlB;AAKE,IAAA,QAAQ,MALV;AAME,IAAA,aAAa,EAAEd,aANjB;AAOE,IAAA,KAAK,EAAEnB,KAPT;AAQE,IAAA,IAAI,EAAEC,IARR;AASE,IAAA,QAAQ,EAAEC,QATZ;AAUE,IAAA,KAAK,EAAEC,KAVT;AAWE,IAAA,IAAI,EAAEC,IAXR;AAYE,IAAA,MAAM,EAAEiB;AAZV,IA1BF,CADF;AA2CD;;eAEctB,U","sourcesContent":["import { format as formatDate } from 'date-fns';\nimport * as React from 'react';\nimport { ModalBaseProps } from 'react-native';\nimport { InputContainerProps, useInputFocus } from '../../atoms/Input';\nimport { Text, TextProps } from '../../atoms/Text';\nimport { CalendarProps, DateRange, SelectionType } from '../Calendar';\nimport { DatePickerModalProps, Modal } from './Modal';\nimport { CalendarIcon, getStyledTextComponent } from './styled';\nimport { HintInputContainer } from '../HintInputContainer';\nimport { useEffect } from 'react';\n\nexport interface DatePickerProps<T extends SelectionType>\n extends InputContainerProps,\n DatePickerModalProps<T>,\n Omit<CalendarProps<T>, 'style'> {\n controlComponent?: (\n onPress: () => void,\n displayValue?: string\n ) => JSX.Element;\n TextComponent?: React.FC<TextProps>;\n animationType?: ModalBaseProps['animationType'];\n placeholder?: string;\n onFocus?: () => void | never;\n onBlur?: () => void | never;\n format?: string;\n closeOnPick?: boolean;\n}\n\nfunction DatePicker<T extends SelectionType>({\n /** DatePicker props */\n month,\n year,\n onChange,\n value,\n type,\n format = 'yyyy-MM-dd',\n\n placeholder,\n onFocus,\n onBlur,\n disabled,\n controlComponent,\n hintComponent,\n hint,\n variant,\n TextComponent = Text,\n CalendarComponent,\n bottomOffset,\n rightComponent,\n animationType = 'fade',\n style,\n locale,\n closeOnPick = false,\n ...rest\n}: DatePickerProps<T>): JSX.Element {\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n const [modalVisible, setModalVisible] = React.useState(false);\n\n const handlePressInput = React.useCallback(() => {\n setModalVisible(true);\n handleFocus();\n }, [handleFocus, setModalVisible]);\n\n const handleCloseModal = React.useCallback(() => {\n setModalVisible(false);\n handleBlur();\n }, [handleBlur, setModalVisible]);\n\n const getDisplayValue = () => {\n if (!value) return placeholder;\n if (type === 'day') {\n return formatDate(value as Date, format);\n } else {\n const { lowest, highest } = value as DateRange;\n if (highest)\n return `${formatDate(lowest, format)} - ${formatDate(highest, format)}`;\n else return formatDate(lowest, format);\n }\n };\n\n const StyledText = getStyledTextComponent(TextComponent);\n\n useEffect(() => {\n if (closeOnPick && value && type === 'day') {\n setTimeout(handleCloseModal, 200);\n }\n if (closeOnPick && value && type === 'range') {\n const { lowest, highest } = value as DateRange;\n lowest && highest && setTimeout(handleCloseModal, 200);\n }\n }, [value, closeOnPick, type, handleCloseModal]);\n\n return (\n <>\n {controlComponent ? (\n controlComponent(handlePressInput, getDisplayValue())\n ) : (\n <HintInputContainer\n focused={focused}\n viewStyle={style}\n onPress={handlePressInput}\n disabled={disabled}\n hintComponent={hintComponent}\n LabelComponent={TextComponent}\n variant={variant}\n hint={hint}\n rightComponent={\n <>\n <CalendarIcon name=\"calendar-sharp\" type=\"ionicon\" size=\"centi\" />\n {rightComponent}\n </>\n }\n {...rest}\n >\n <StyledText fontWeight=\"bold\" disabled={disabled}>\n {getDisplayValue() || ' '}\n </StyledText>\n </HintInputContainer>\n )}\n <Modal\n CalendarComponent={CalendarComponent}\n bottomOffset={bottomOffset}\n visible={modalVisible}\n onRequestClose={handleCloseModal}\n animated\n animationType={animationType}\n month={month}\n year={year}\n onChange={onChange}\n value={value}\n type={type}\n locale={locale}\n />\n </>\n );\n}\n\nexport default DatePicker;\n"],"file":"DatePicker.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/DatePicker/DatePicker.tsx"],"names":["DatePicker","month","year","onChange","value","type","format","placeholder","onFocus","onBlur","disabled","controlComponent","hintComponent","hint","variant","TextComponent","Text","CalendarComponent","bottomOffset","rightComponent","animationType","style","locale","closeOnPick","rest","focused","handleBlur","handleFocus","modalVisible","setModalVisible","React","useState","handlePressInput","useCallback","handleCloseModal","getDisplayValue","lowest","highest","StyledText","setTimeout"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;AAoBA,SAASA,UAAT,CAA6C;AAE3CC,EAAAA,KAF2C;AAG3CC,EAAAA,IAH2C;AAI3CC,EAAAA,QAJ2C;AAK3CC,EAAAA,KAL2C;AAM3CC,EAAAA,IAN2C;AAO3CC,EAAAA,MAAM,GAAG,YAPkC;AAS3CC,EAAAA,WAT2C;AAU3CC,EAAAA,OAV2C;AAW3CC,EAAAA,MAX2C;AAY3CC,EAAAA,QAZ2C;AAa3CC,EAAAA,gBAb2C;AAc3CC,EAAAA,aAd2C;AAe3CC,EAAAA,IAf2C;AAgB3CC,EAAAA,OAhB2C;AAiB3CC,EAAAA,aAAa,GAAGC,UAjB2B;AAkB3CC,EAAAA,iBAlB2C;AAmB3CC,EAAAA,YAnB2C;AAoB3CC,EAAAA,cApB2C;AAqB3CC,EAAAA,aAAa,GAAG,MArB2B;AAsB3CC,EAAAA,KAtB2C;AAuB3CC,EAAAA,MAvB2C;AAwB3CC,EAAAA,WAAW,GAAG,KAxB6B;AAyB3C,KAAGC;AAzBwC,CAA7C,EA0BoC;AAClC,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,UAAX;AAAuBC,IAAAA;AAAvB,MAAuC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,gBAJlB;AAKE,IAAA,QAAQ,MALV;AAME,IAAA,aAAa,EAAEd,aANjB;AAOE,IAAA,KAAK,EAAEnB,KAPT;AAQE,IAAA,IAAI,EAAEC,IARR;AASE,IAAA,QAAQ,EAAEC,QATZ;AAUE,IAAA,KAAK,EAAEC,KAVT;AAWE,IAAA,IAAI,EAAEC,IAXR;AAYE,IAAA,MAAM,EAAEiB;AAZV,IA1BF,CADF;AA2CD;;eAEctB,U","sourcesContent":["import { format as formatDate } from 'date-fns';\nimport * as React from 'react';\nimport { ModalBaseProps } from 'react-native';\nimport { InputContainerProps, useInputFocus } from '../../atoms/Input';\nimport { Text, TextProps } from '../../atoms/Text';\nimport { CalendarProps, DateRange, SelectionType } from '../Calendar';\nimport { DatePickerModalProps, Modal } from './Modal';\nimport { CalendarIcon, getStyledTextComponent } from './styled';\nimport { HintInputContainer } from '../HintInputContainer';\nimport { useEffect } from 'react';\n\nexport interface DatePickerProps<T extends SelectionType>\n extends InputContainerProps,\n DatePickerModalProps<T>,\n Omit<CalendarProps<T>, 'style'> {\n controlComponent?: (\n onPress: () => void,\n displayValue?: string\n ) => JSX.Element;\n TextComponent?: React.FC<TextProps>;\n animationType?: ModalBaseProps['animationType'];\n placeholder?: string;\n onFocus?: () => void | never;\n onBlur?: () => void | never;\n format?: string;\n closeOnPick?: boolean;\n}\n\nfunction DatePicker<T extends SelectionType>({\n /** DatePicker props */\n month,\n year,\n onChange,\n value,\n type,\n format = 'yyyy-MM-dd',\n\n placeholder,\n onFocus,\n onBlur,\n disabled,\n controlComponent,\n hintComponent,\n hint,\n variant,\n TextComponent = Text,\n CalendarComponent,\n bottomOffset,\n rightComponent,\n animationType = 'fade',\n style,\n locale,\n closeOnPick = false,\n ...rest\n}: DatePickerProps<T>): JSX.Element {\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n const [modalVisible, setModalVisible] = React.useState(false);\n\n const handlePressInput = React.useCallback(() => {\n setModalVisible(true);\n handleFocus();\n }, [handleFocus, setModalVisible]);\n\n const handleCloseModal = React.useCallback(() => {\n setModalVisible(false);\n handleBlur();\n }, [handleBlur, setModalVisible]);\n\n const getDisplayValue = () => {\n if (!value) return placeholder;\n if (type === 'day') {\n return formatDate(value as Date, format, { locale: locale });\n } else {\n const { lowest, highest } = value as DateRange;\n if (highest)\n return `${formatDate(lowest, format, {\n locale: locale,\n })} - ${formatDate(highest, format, { locale: locale })}`;\n else return formatDate(lowest, format, { locale: locale });\n }\n };\n\n const StyledText = getStyledTextComponent(TextComponent);\n\n useEffect(() => {\n if (closeOnPick && value && type === 'day') {\n setTimeout(handleCloseModal, 200);\n }\n if (closeOnPick && value && type === 'range') {\n const { lowest, highest } = value as DateRange;\n lowest && highest && setTimeout(handleCloseModal, 200);\n }\n }, [value, closeOnPick, type, handleCloseModal]);\n\n return (\n <>\n {controlComponent ? (\n controlComponent(handlePressInput, getDisplayValue())\n ) : (\n <HintInputContainer\n focused={focused}\n viewStyle={style}\n onPress={handlePressInput}\n disabled={disabled}\n hintComponent={hintComponent}\n LabelComponent={TextComponent}\n variant={variant}\n hint={hint}\n rightComponent={\n <>\n <CalendarIcon name=\"calendar-sharp\" type=\"ionicon\" size=\"centi\" />\n {rightComponent}\n </>\n }\n {...rest}\n >\n <StyledText fontWeight=\"bold\" disabled={disabled}>\n {getDisplayValue() || ' '}\n </StyledText>\n </HintInputContainer>\n )}\n <Modal\n CalendarComponent={CalendarComponent}\n bottomOffset={bottomOffset}\n visible={modalVisible}\n onRequestClose={handleCloseModal}\n animated\n animationType={animationType}\n month={month}\n year={year}\n onChange={onChange}\n value={value}\n type={type}\n locale={locale}\n />\n </>\n );\n}\n\nexport default DatePicker;\n"],"file":"DatePicker.js"}
@@ -79,7 +79,9 @@ const DateTimePicker = ({
79
79
  };
80
80
 
81
81
  const StyledText = (0, _styled.getStyledTextComponent)(TextComponent);
82
- const displayValue = (value ? (0, _dateFns.format)(value, format) : placeholder) || ' ';
82
+ const displayValue = (value ? (0, _dateFns.format)(value, format, {
83
+ locale: locale
84
+ }) : placeholder) || ' ';
83
85
  return React.createElement(React.Fragment, null, controlComponent ? controlComponent(handlePressInput, displayValue) : React.createElement(_HintInputContainer.HintInputContainer, _extends({
84
86
  focused: focused,
85
87
  viewStyle: style,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/molecules/DateTimePicker/DateTimePicker.tsx"],"names":["DateTimePicker","onChange","value","mode","format","locale","upperDateThreshold","lowerDateThreshold","offsetThreshold","upperOffsetThreshold","lowerOffsetThreshold","dateModalTitle","timeModalTitle","dateConfirmButtonText","timeConfirmButtonText","dayLabel","monthLabel","yearLabel","hourLabel","minuteLabel","placeholder","onFocus","onBlur","disabled","controlComponent","hintComponent","hint","variant","TextComponent","Text","DateTimeSelectorComponent","bottomOffset","rightComponent","animationType","style","rest","focused","handleBlur","handleFocus","modalVisible","setModalVisible","React","useState","handlePressInput","handleCloseModal","StyledText","displayValue"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;AAiBA,MAAMA,cAA6C,GAAG,CAAC;AACrDC,EAAAA,QADqD;AAErDC,EAAAA,KAFqD;AAGrDC,EAAAA,IAAI,GAAG,MAH8C;AAIrDC,EAAAA,MAAM,GAAG,qBAJ4C;AAKrDC,EAAAA,MALqD;AAMrDC,EAAAA,kBANqD;AAOrDC,EAAAA,kBAPqD;AAQrDC,EAAAA,eARqD;AASrDC,EAAAA,oBATqD;AAUrDC,EAAAA,oBAVqD;AAYrDC,EAAAA,cAZqD;AAarDC,EAAAA,cAbqD;AAcrDC,EAAAA,qBAdqD;AAerDC,EAAAA,qBAfqD;AAgBrDC,EAAAA,QAhBqD;AAiBrDC,EAAAA,UAjBqD;AAkBrDC,EAAAA,SAlBqD;AAmBrDC,EAAAA,SAnBqD;AAoBrDC,EAAAA,WApBqD;AAsBrDC,EAAAA,WAtBqD;AAuBrDC,EAAAA,OAvBqD;AAwBrDC,EAAAA,MA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F,CADF;AAwDD,CAnHD;;eAqHenB,c","sourcesContent":["import { format as formatDate } from 'date-fns';\nimport * as React from 'react';\nimport { ModalBaseProps } from 'react-native';\nimport { InputContainerProps, useInputFocus } from '../../atoms/Input';\nimport { Text, TextProps } from '../../atoms/Text';\nimport { CalendarIcon, getStyledTextComponent } from '../DatePicker/styled';\nimport { DateTimeSelectorProps } from '../DateTimeSelector';\nimport { DateTimePickerModalProps, Modal } from './Modal';\nimport { HintInputContainer } from '../HintInputContainer';\n\nexport interface DateTimePickerProps\n extends InputContainerProps,\n DateTimePickerModalProps,\n Omit<DateTimeSelectorProps, 'style'> {\n controlComponent?: (\n onPress: () => void,\n displayValue?: string\n ) => JSX.Element;\n TextComponent?: React.FC<TextProps>;\n animationType?: ModalBaseProps['animationType'];\n placeholder?: string;\n onFocus?: () => void | never;\n onBlur?: () => void | never;\n}\n\nconst DateTimePicker: React.FC<DateTimePickerProps> = ({\n onChange,\n value,\n mode = 'date',\n format = 'yyyy-MM-dd hh:mm:ss',\n locale,\n upperDateThreshold,\n lowerDateThreshold,\n offsetThreshold,\n upperOffsetThreshold,\n lowerOffsetThreshold,\n\n dateModalTitle,\n timeModalTitle,\n dateConfirmButtonText,\n timeConfirmButtonText,\n dayLabel,\n monthLabel,\n yearLabel,\n hourLabel,\n minuteLabel,\n\n placeholder,\n onFocus,\n onBlur,\n disabled,\n controlComponent,\n hintComponent,\n hint,\n variant = 'default',\n TextComponent = Text,\n DateTimeSelectorComponent,\n bottomOffset,\n rightComponent,\n animationType = 'fade',\n style,\n ...rest\n}) => {\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n const [modalVisible, setModalVisible] = React.useState(false);\n\n const handlePressInput = () => {\n setModalVisible(true);\n handleFocus();\n };\n\n const handleCloseModal = () => {\n setModalVisible(false);\n handleBlur();\n };\n\n const StyledText = getStyledTextComponent(TextComponent);\n const displayValue = (value ? formatDate(value, format) : placeholder) || ' ';\n\n return (\n <>\n {controlComponent ? (\n controlComponent(handlePressInput, displayValue)\n ) : (\n <HintInputContainer\n focused={focused}\n viewStyle={style}\n onPress={handlePressInput}\n disabled={disabled}\n LabelComponent={TextComponent}\n variant={variant}\n hint={hint}\n hintComponent={hintComponent}\n rightComponent={\n <>\n <CalendarIcon name=\"calendar-sharp\" type=\"ionicon\" size=\"centi\" />\n {rightComponent}\n </>\n }\n {...rest}\n >\n <StyledText fontWeight=\"bold\" disabled={disabled}>\n {displayValue}\n </StyledText>\n </HintInputContainer>\n )}\n <Modal\n DateTimeSelectorComponent={DateTimeSelectorComponent}\n bottomOffset={bottomOffset}\n visible={modalVisible}\n onRequestClose={handleCloseModal}\n animated\n animationType={animationType}\n onChange={onChange}\n value={value}\n mode={mode}\n format={format}\n locale={locale}\n upperDateThreshold={upperDateThreshold}\n lowerDateThreshold={lowerDateThreshold}\n offsetThreshold={offsetThreshold}\n upperOffsetThreshold={upperOffsetThreshold}\n lowerOffsetThreshold={lowerOffsetThreshold}\n dateModalTitle={dateModalTitle}\n timeModalTitle={timeModalTitle}\n dateConfirmButtonText={dateConfirmButtonText}\n timeConfirmButtonText={timeConfirmButtonText}\n dayLabel={dayLabel}\n monthLabel={monthLabel}\n yearLabel={yearLabel}\n hourLabel={hourLabel}\n minuteLabel={minuteLabel}\n />\n </>\n );\n};\n\nexport default DateTimePicker;\n"],"file":"DateTimePicker.js"}
1
+ {"version":3,"sources":["../../../../src/components/molecules/DateTimePicker/DateTimePicker.tsx"],"names":["DateTimePicker","onChange","value","mode","format","locale","upperDateThreshold","lowerDateThreshold","offsetThreshold","upperOffsetThreshold","lowerOffsetThreshold","dateModalTitle","timeModalTitle","dateConfirmButtonText","timeConfirmButtonText","dayLabel","monthLabel","yearLabel","hourLabel","minuteLabel","placeholder","onFocus","onBlur","disabled","controlComponent","hintComponent","hint","variant","TextComponent","Text","DateTimeSelectorComponent","bottomOffset","rightComponent","animationType","style","rest","focused","handleBlur","handleFocus","modalVisible","setModalVisible","React","useState","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JlB;AAKE,IAAA,QAAQ,MALV;AAME,IAAA,aAAa,EAAEX,aANjB;AAOE,IAAA,QAAQ,EAAEhC,QAPZ;AAQE,IAAA,KAAK,EAAEC,KART;AASE,IAAA,IAAI,EAAEC,IATR;AAUE,IAAA,MAAM,EAAEC,MAVV;AAWE,IAAA,MAAM,EAAEC,MAXV;AAYE,IAAA,kBAAkB,EAAEC,kBAZtB;AAaE,IAAA,kBAAkB,EAAEC,kBAbtB;AAcE,IAAA,eAAe,EAAEC,eAdnB;AAeE,IAAA,oBAAoB,EAAEC,oBAfxB;AAgBE,IAAA,oBAAoB,EAAEC,oBAhBxB;AAiBE,IAAA,cAAc,EAAEC,cAjBlB;AAkBE,IAAA,cAAc,EAAEC,cAlBlB;AAmBE,IAAA,qBAAqB,EAAEC,qBAnBzB;AAoBE,IAAA,qBAAqB,EAAEC,qBApBzB;AAqBE,IAAA,QAAQ,EAAEC,QArBZ;AAsBE,IAAA,UAAU,EAAEC,UAtBd;AAuBE,IAAA,SAAS,EAAEC,SAvBb;AAwBE,IAAA,SAAS,EAAEC,SAxBb;AAyBE,IAAA,WAAW,EAAEC;AAzBf,IA1BF,CADF;AAwDD,CArHD;;eAuHenB,c","sourcesContent":["import { format as formatDate } from 'date-fns';\nimport * as React from 'react';\nimport { ModalBaseProps } from 'react-native';\nimport { InputContainerProps, useInputFocus } from '../../atoms/Input';\nimport { Text, TextProps } from '../../atoms/Text';\nimport { CalendarIcon, getStyledTextComponent } from '../DatePicker/styled';\nimport { DateTimeSelectorProps } from '../DateTimeSelector';\nimport { DateTimePickerModalProps, Modal } from './Modal';\nimport { HintInputContainer } from '../HintInputContainer';\n\nexport interface DateTimePickerProps\n extends InputContainerProps,\n DateTimePickerModalProps,\n Omit<DateTimeSelectorProps, 'style'> {\n controlComponent?: (\n onPress: () => void,\n displayValue?: string\n ) => JSX.Element;\n TextComponent?: React.FC<TextProps>;\n animationType?: ModalBaseProps['animationType'];\n placeholder?: string;\n onFocus?: () => void | never;\n onBlur?: () => void | never;\n}\n\nconst DateTimePicker: React.FC<DateTimePickerProps> = ({\n onChange,\n value,\n mode = 'date',\n format = 'yyyy-MM-dd hh:mm:ss',\n locale,\n upperDateThreshold,\n lowerDateThreshold,\n offsetThreshold,\n upperOffsetThreshold,\n lowerOffsetThreshold,\n\n dateModalTitle,\n timeModalTitle,\n dateConfirmButtonText,\n timeConfirmButtonText,\n dayLabel,\n monthLabel,\n yearLabel,\n hourLabel,\n minuteLabel,\n\n placeholder,\n onFocus,\n onBlur,\n disabled,\n controlComponent,\n hintComponent,\n hint,\n variant = 'default',\n TextComponent = Text,\n DateTimeSelectorComponent,\n bottomOffset,\n rightComponent,\n animationType = 'fade',\n style,\n ...rest\n}) => {\n const { focused, handleBlur, handleFocus } = useInputFocus(\n onFocus,\n onBlur,\n !disabled\n );\n\n const [modalVisible, setModalVisible] = React.useState(false);\n\n const handlePressInput = () => {\n setModalVisible(true);\n handleFocus();\n };\n\n const handleCloseModal = () => {\n setModalVisible(false);\n handleBlur();\n };\n\n const StyledText = getStyledTextComponent(TextComponent);\n const displayValue =\n (value ? formatDate(value, format, { locale: locale }) : placeholder) ||\n ' ';\n\n return (\n <>\n {controlComponent ? (\n controlComponent(handlePressInput, displayValue)\n ) : (\n <HintInputContainer\n focused={focused}\n viewStyle={style}\n onPress={handlePressInput}\n disabled={disabled}\n LabelComponent={TextComponent}\n variant={variant}\n hint={hint}\n hintComponent={hintComponent}\n rightComponent={\n <>\n <CalendarIcon name=\"calendar-sharp\" type=\"ionicon\" size=\"centi\" />\n {rightComponent}\n </>\n }\n {...rest}\n >\n <StyledText fontWeight=\"bold\" disabled={disabled}>\n {displayValue}\n </StyledText>\n </HintInputContainer>\n )}\n <Modal\n DateTimeSelectorComponent={DateTimeSelectorComponent}\n bottomOffset={bottomOffset}\n visible={modalVisible}\n onRequestClose={handleCloseModal}\n animated\n animationType={animationType}\n onChange={onChange}\n value={value}\n mode={mode}\n format={format}\n locale={locale}\n upperDateThreshold={upperDateThreshold}\n lowerDateThreshold={lowerDateThreshold}\n offsetThreshold={offsetThreshold}\n upperOffsetThreshold={upperOffsetThreshold}\n lowerOffsetThreshold={lowerOffsetThreshold}\n dateModalTitle={dateModalTitle}\n timeModalTitle={timeModalTitle}\n dateConfirmButtonText={dateConfirmButtonText}\n timeConfirmButtonText={timeConfirmButtonText}\n dayLabel={dayLabel}\n monthLabel={monthLabel}\n yearLabel={yearLabel}\n hourLabel={hourLabel}\n minuteLabel={minuteLabel}\n />\n </>\n );\n};\n\nexport default DateTimePicker;\n"],"file":"DateTimePicker.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.11.0",
4
+ "version": "1.11.1",
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": "27a01035cee1b709734bd4b6b6f518c4320814f6"
34
+ "gitHead": "4334fe0f86e0e31cfdbea1acd24c8a1fe64319f4"
35
35
  }
@@ -59,7 +59,7 @@ const Switch: FC<SwitchProps> = ({
59
59
  };
60
60
 
61
61
  useEffect(() => {
62
- transitionSwitch(active, transitionValue, animatedColor);
62
+ transitionSwitch(!active, transitionValue, animatedColor);
63
63
  }, [active]);
64
64
 
65
65
  const handleChange = useCallback(() => {
@@ -76,18 +76,18 @@ const Switch: FC<SwitchProps> = ({
76
76
  };
77
77
 
78
78
  return (
79
- <PressableSurface
80
- {...rest}
81
- onPress={handleChange}
82
- effect="none"
83
- disabled={disabled}
84
- >
85
- <Animated.View style={{ ...animatedStyle, ...stylesDefault }}>
86
- <StyledSwitch
87
- style={[dotStyle, { transform: [{ translateX: transitionValue }] }]}
88
- />
89
- </Animated.View>
90
- </PressableSurface>
79
+ <PressableSurface
80
+ {...rest}
81
+ onPress={handleChange}
82
+ effect="none"
83
+ disabled={disabled}
84
+ >
85
+ <Animated.View style={{ ...animatedStyle, ...stylesDefault }}>
86
+ <StyledSwitch
87
+ style={[dotStyle, { transform: [{ translateX: transitionValue }] }]}
88
+ />
89
+ </Animated.View>
90
+ </PressableSurface>
91
91
  );
92
92
  };
93
93
 
@@ -74,12 +74,14 @@ function DatePicker<T extends SelectionType>({
74
74
  const getDisplayValue = () => {
75
75
  if (!value) return placeholder;
76
76
  if (type === 'day') {
77
- return formatDate(value as Date, format);
77
+ return formatDate(value as Date, format, { locale: locale });
78
78
  } else {
79
79
  const { lowest, highest } = value as DateRange;
80
80
  if (highest)
81
- return `${formatDate(lowest, format)} - ${formatDate(highest, format)}`;
82
- else return formatDate(lowest, format);
81
+ return `${formatDate(lowest, format, {
82
+ locale: locale,
83
+ })} - ${formatDate(highest, format, { locale: locale })}`;
84
+ else return formatDate(lowest, format, { locale: locale });
83
85
  }
84
86
  };
85
87
 
@@ -80,7 +80,9 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
80
80
  };
81
81
 
82
82
  const StyledText = getStyledTextComponent(TextComponent);
83
- const displayValue = (value ? formatDate(value, format) : placeholder) || ' ';
83
+ const displayValue =
84
+ (value ? formatDate(value, format, { locale: locale }) : placeholder) ||
85
+ ' ';
84
86
 
85
87
  return (
86
88
  <>