@tecsinapse/react-core 1.11.0 → 1.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/components/atoms/Switch/Switch.js +1 -1
  3. package/dist/components/atoms/Switch/Switch.js.map +1 -1
  4. package/dist/components/molecules/DatePicker/DatePicker.js +10 -2
  5. package/dist/components/molecules/DatePicker/DatePicker.js.map +1 -1
  6. package/dist/components/molecules/DateTimePicker/DateTimePicker.js +3 -1
  7. package/dist/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
  8. package/dist/components/molecules/Grid/Grid.d.ts +10 -0
  9. package/dist/components/molecules/Grid/Grid.js +57 -0
  10. package/dist/components/molecules/Grid/Grid.js.map +1 -0
  11. package/dist/components/molecules/Grid/Item/Item.d.ts +25 -0
  12. package/dist/components/molecules/Grid/Item/Item.js +57 -0
  13. package/dist/components/molecules/Grid/Item/Item.js.map +1 -0
  14. package/dist/components/molecules/Grid/Item/index.d.ts +1 -0
  15. package/dist/components/molecules/Grid/Item/index.js +24 -0
  16. package/dist/components/molecules/Grid/Item/index.js.map +1 -0
  17. package/dist/components/molecules/Grid/index.d.ts +2 -0
  18. package/dist/components/molecules/Grid/index.js +38 -0
  19. package/dist/components/molecules/Grid/index.js.map +1 -0
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.js +30 -0
  22. package/dist/index.js.map +1 -1
  23. package/package.json +2 -2
  24. package/src/components/atoms/Switch/Switch.tsx +13 -13
  25. package/src/components/molecules/DatePicker/DatePicker.tsx +5 -3
  26. package/src/components/molecules/DateTimePicker/DateTimePicker.tsx +3 -1
  27. package/src/components/molecules/Grid/Grid.stories.tsx +132 -0
  28. package/src/components/molecules/Grid/Grid.tsx +80 -0
  29. package/src/components/molecules/Grid/Item/Item.tsx +73 -0
  30. package/src/components/molecules/Grid/Item/index.ts +1 -0
  31. package/src/components/molecules/Grid/index.ts +2 -0
  32. package/src/index.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,56 @@
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.12.2](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.12.1...@tecsinapse/react-core@1.12.2) (2021-12-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * spacing grid ([4929fd8](https://github.com/tecsinapse/design-system/commit/4929fd83cb91484959e19aeee2dfc8cfcce6f009))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.12.1](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.12.0...@tecsinapse/react-core@1.12.1) (2021-12-21)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * wrapper on gridItem. ([db99917](https://github.com/tecsinapse/design-system/commit/db999176d1440ed12b91a041fbfb850f76b3b867))
23
+
24
+
25
+
26
+
27
+
28
+ # [1.12.0](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.11.1...@tecsinapse/react-core@1.12.0) (2021-12-21)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * extractNumbersFromString spacing GridItem ([65a88e6](https://github.com/tecsinapse/design-system/commit/65a88e660418d8a7903faa249e6e322b21d6791a))
34
+
35
+
36
+ ### Features
37
+
38
+ * add grid element based on flex layout ([732f6c4](https://github.com/tecsinapse/design-system/commit/732f6c455c270325cb71c487ae01f2eee1869e0f))
39
+
40
+
41
+
42
+
43
+
44
+ ## [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)
45
+
46
+
47
+ ### Bug Fixes
48
+
49
+ * complement active on transitionSwitch ([969a047](https://github.com/tecsinapse/design-system/commit/969a04748dc74107e22be6bc103e12c813ee232d))
50
+ * missing some locales on datetime formats ([97ca962](https://github.com/tecsinapse/design-system/commit/97ca9621dd67daf4b4d1f9e58783b3ba721a2e31))
51
+
52
+
53
+
54
+
55
+
6
56
  # [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
57
 
8
58
 
@@ -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;;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,GAAG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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;AA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G;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,SACE,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,CADF;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"}
@@ -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;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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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,SA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Gf,oBAAC,sCAAD;AACE,IAAA,OAAO,EAAEV,OADX;AAEE,IAAA,SAAS,EAAEJ,KAFb;AAGE,IAAA,OAAO,EAAEW,gBAHX;AAIE,IAAA,QAAQ,EAAEtB,QAJZ;AAKE,IAAA,aAAa,EAAEE,aALjB;AAME,IAAA,cAAc,EAAEG,aANlB;AAOE,IAAA,OAAO,EAAED,OAPX;AAQE,IAAA,IAAI,EAAED,IARR;AASE,IAAA,cAAc,EACZ,0CACE,oBAAC,oBAAD;AAAc,MAAA,IAAI,EAAC,gBAAnB;AAAoC,MAAA,IAAI,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, { 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,MAxBqD;AAyBrDC,EAAAA,QAzBqD;AA0BrDC,EAAAA,gBA1BqD;AA2BrDC,EAAAA,aA3BqD;AA4BrDC,EAAAA,IA5BqD;AA6BrDC,EAAAA,OAAO,GAAG,SA7B2C;AA8BrDC,EAAAA,aAAa,GAAGC,UA9BqC;AA+BrDC,EAAAA,yBA/BqD;AAgCrDC,EAAAA,YAhCqD;AAiCrDC,EAAAA,cAjCqD;AAkCrDC,EAAAA,aAAa,GAAG,MAlCqC;AAmCrDC,EAAAA,KAnCqD;AAoCrD,KAAGC;AApCkD,CAAD,KAqChD;AACJ,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,UAAX;AAAuBC,IAAAA;AAAvB,MAAuC,0BAC3CjB,OAD2C,EAE3CC,MAF2C,EAG3C,CAACC,QAH0C,CAA7C;AAMA,QAAM,C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AJlB;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,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","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,U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AAqB,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"}
@@ -0,0 +1,10 @@
1
+ import { ViewProps } from 'react-native';
2
+ import { SpacingType } from '@tecsinapse/react-core';
3
+ export interface IGrid extends ViewProps {
4
+ children: JSX.Element[];
5
+ layout?: number[][];
6
+ columns?: number;
7
+ spacing?: SpacingType;
8
+ }
9
+ declare const Grid: ({ children, columns, layout, style, spacing, ...rest }: IGrid) => JSX.Element;
10
+ export default Grid;
@@ -0,0 +1,57 @@
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 _reactNative = require("react-native");
11
+
12
+ var _Item = require("./Item");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
17
+
18
+ const Grid = ({
19
+ children,
20
+ columns = 12,
21
+ layout,
22
+ style,
23
+ spacing,
24
+ ...rest
25
+ }) => {
26
+ if (layout) {
27
+ const flatLayout = layout.flat();
28
+ return _react.default.createElement(_reactNative.View, _extends({
29
+ style: [style, {
30
+ display: 'flex',
31
+ flexDirection: 'row',
32
+ flexWrap: 'wrap'
33
+ }]
34
+ }, rest), _react.default.Children.map(children, (child, index) => _react.default.createElement(_Item.GridItem, {
35
+ columns: columns,
36
+ span: flatLayout[index],
37
+ spacing: spacing
38
+ }, child)));
39
+ }
40
+
41
+ return _react.default.createElement(_reactNative.View, _extends({
42
+ style: [style, {
43
+ display: 'flex',
44
+ flexDirection: 'row',
45
+ flexWrap: 'wrap'
46
+ }]
47
+ }, rest), _react.default.Children.map(children, child => {
48
+ return _react.default.cloneElement(child, { ...(child === null || child === void 0 ? void 0 : child.props),
49
+ columns,
50
+ spacing: (child === null || child === void 0 ? void 0 : child.props.spacing) ?? spacing
51
+ });
52
+ }));
53
+ };
54
+
55
+ var _default = Grid;
56
+ exports.default = _default;
57
+ //# sourceMappingURL=Grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/molecules/Grid/Grid.tsx"],"names":["Grid","children","columns","layout","style","spacing","rest","flatLayout","flat","display","flexDirection","flexWrap","React","Children","map","child","index","cloneElement","props"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;AAmBA,MAAMA,IAAI,GAAG,CAAC;AACZC,EAAAA,QADY;AAEZC,EAAAA,OAAO,GAAG,EAFE;AAGZC,EAAAA,MAHY;AAIZC,EAAAA,KAJY;AAKZC,EAAAA,OALY;AAMZ,KAAGC;AANS,CAAD,KAOA;AACX,MAAIH,MAAJ,EAAY;AACV,UAAMI,UAAU,GAAGJ,MAAM,CAACK,IAAP,EAAnB;AACA,WACE,6BAAC,iBAAD;AACE,MAAA,KAAK,EAAE,CACLJ,KADK,EAEL;AACEK,QAAAA,OAAO,EAAE,MADX;AAEEC,QAAAA,aAAa,EAAE,KAFjB;AAGEC,QAAAA,QAAQ,EAAE;AAHZ,OAFK;AADT,OASML,IATN,GAWGM,eAAMC,QAAN,CAAeC,GAAf,CAAmBb,QAAnB,EAA6B,CAACc,KAAD,EAAQC,KAAR,KAC5B,6BAAC,cAAD;AACE,MAAA,OAAO,EAAEd,OADX;AAEE,MAAA,IAAI,EAAEK,UAAU,CAACS,KAAD,CAFlB;AAGE,MAAA,OAAO,EAAEX;AAHX,OAKGU,KALH,CADD,CAXH,CADF;AAuBD;;AAED,SACE,6BAAC,iBAAD;AACE,IAAA,KAAK,EAAE,CACLX,KADK,EAEL;AACEK,MAAAA,OAAO,EAAE,MADX;AAEEC,MAAAA,aAAa,EAAE,KAFjB;AAGEC,MAAAA,QAAQ,EAAE;AAHZ,KAFK;AADT,KASML,IATN,GAWGM,eAAMC,QAAN,CAAeC,GAAf,CAAmBb,QAAnB,EAA6Bc,KAAK,IAAI;AACrC,WAAOH,eAAMK,YAAN,CAAmBF,KAAnB,EAA0B,EAC/B,IAAGA,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEG,KAAV,CAD+B;AAE/BhB,MAAAA,OAF+B;AAG/BG,MAAAA,OAAO,EAAE,CAAAU,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEG,KAAP,CAAab,OAAb,KAAwBA;AAHF,KAA1B,CAAP;AAKD,GANA,CAXH,CADF;AAqBD,CAxDD;;eA0DeL,I","sourcesContent":["import React from 'react';\nimport { View, ViewProps } from 'react-native';\nimport { GridItem } from './Item';\nimport { SpacingType } from '@tecsinapse/react-core';\n\nexport interface IGrid extends ViewProps {\n children: JSX.Element[];\n /** Layout should represent the multiplier of columns to fill the rows properly.\n * Example:\n * const layout = [\n * [6, 6], // Two elements on row\n * [4, 4, 4], // Three elements on row\n * [12], // One element on row\n * ];\n * */\n layout?: number[][];\n /** Number of grid columns to be considered (not the number of elements per row) */\n columns?: number;\n spacing?: SpacingType;\n}\n\nconst Grid = ({\n children,\n columns = 12,\n layout,\n style,\n spacing,\n ...rest\n}: IGrid) => {\n if (layout) {\n const flatLayout = layout.flat();\n return (\n <View\n style={[\n style,\n {\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n },\n ]}\n {...rest}\n >\n {React.Children.map(children, (child, index) => (\n <GridItem\n columns={columns}\n span={flatLayout[index]}\n spacing={spacing}\n >\n {child}\n </GridItem>\n ))}\n </View>\n );\n }\n\n return (\n <View\n style={[\n style,\n {\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n },\n ]}\n {...rest}\n >\n {React.Children.map(children, child => {\n return React.cloneElement(child, {\n ...child?.props,\n columns,\n spacing: child?.props.spacing ?? spacing,\n });\n })}\n </View>\n );\n};\n\nexport default Grid;\n"],"file":"Grid.js"}
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { SpacingType } from '@tecsinapse/react-core';
3
+ declare type FlexPositioning = 'flex-start' | 'flex-end' | 'center';
4
+ declare type FlexAlignBase = FlexPositioning | 'stretch';
5
+ declare type FlexAlignType = FlexAlignBase | 'baseline';
6
+ declare type FlexSpacing = 'space-between' | 'space-around';
7
+ export interface IGridItem {
8
+ children: React.ReactElement;
9
+ span: number;
10
+ columns?: number;
11
+ loading?: boolean;
12
+ loadingComponent?: React.ReactElement;
13
+ alignContent?: FlexAlignBase | FlexSpacing;
14
+ alignItems?: FlexAlignType;
15
+ alignSelf?: 'auto' | FlexAlignType;
16
+ flex?: number;
17
+ flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
18
+ flexGrow?: number;
19
+ flexShrink?: number;
20
+ justifyContent?: FlexPositioning | FlexSpacing | 'space-evenly';
21
+ spacing?: SpacingType;
22
+ wrapper?: boolean;
23
+ }
24
+ declare const GridItem: ({ children, span, columns, loadingComponent, loading, spacing: _spacing, wrapper, ...rest }: IGridItem) => JSX.Element;
25
+ export default GridItem;
@@ -0,0 +1,57 @@
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
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ const GridItem = ({
17
+ children,
18
+ span,
19
+ columns = 12,
20
+ loadingComponent,
21
+ loading = false,
22
+ spacing: _spacing,
23
+ wrapper = false,
24
+ ...rest
25
+ }) => {
26
+ const {
27
+ spacing
28
+ } = (0, _reactCore.useTheme)();
29
+
30
+ if (!_react.default.Children.only(children)) {
31
+ throw new Error('The number of children in GridItem should be one');
32
+ }
33
+
34
+ if (loadingComponent && loading) {
35
+ return loadingComponent;
36
+ }
37
+
38
+ const style = { ...rest,
39
+ boxSizing: 'border-box',
40
+ flexBasis: `${100 / (columns / span)}%`,
41
+ padding: _spacing ? (0, _reactCore.extractNumbersFromString)(spacing[_spacing]) : undefined
42
+ };
43
+
44
+ const clone = _react.default.cloneElement(children, { ...(children === null || children === void 0 ? void 0 : children.props),
45
+ style: wrapper ? children === null || children === void 0 ? void 0 : children.props.style : { ...style,
46
+ ...(children === null || children === void 0 ? void 0 : children.props.style)
47
+ }
48
+ });
49
+
50
+ return wrapper ? _react.default.createElement(_reactNative.View, {
51
+ style: style
52
+ }, clone) : clone;
53
+ };
54
+
55
+ var _default = GridItem;
56
+ exports.default = _default;
57
+ //# sourceMappingURL=Item.js.map
@@ -0,0 +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","style","boxSizing","flexBasis","padding","undefined","clone","cloneElement","props"],"mappings":";;;;;;;AAAA;;AACA;;AAKA;;;;AA+BA,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,EAAAA,OAAO,GAAG,KAPM;AAQhB,KAAGC;AARa,CAAD,KASA;AACf,QAAM;AAAEH,IAAAA;AAAF,MAAc,0BAApB;;AACA,MAAI,CAACI,eAAMC,QAAN,CAAeC,IAAf,CAAoBX,QAApB,CAAL,EAAoC;AAClC,UAAM,IAAIY,KAAJ,CAAU,kDAAV,CAAN;AACD;;AACD,MAAIT,gBAAgB,IAAIC,OAAxB,EAAiC;AAC/B,WAAOD,gBAAP;AACD;;AAED,QAAMU,KAAK,GAAG,EACZ,GAAGL,IADS;AAEZM,IAAAA,SAAS,EAAE,YAFC;AAGZC,IAAAA,SAAS,EAAG,GAAE,OAAOb,OAAO,GAAGD,IAAjB,CAAuB,GAHzB;AAIZe,IAAAA,OAAO,EAAEV,QAAQ,GAAG,yCAAyBD,OAAO,CAACC,QAAD,CAAhC,CAAH,GAAiDW;AAJtD,GAAd;;AAOA,QAAMC,KAAK,GAAGT,eAAMU,YAAN,CAAmBnB,QAAnB,EAA6B,EACzC,IAAGA,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,CAAEoB,KAAb,CADyC;AAEzCP,IAAAA,KAAK,EAAEN,OAAO,GACVP,QADU,aACVA,QADU,uBACVA,QAAQ,CAAEoB,KAAV,CAAgBP,KADN,GAEV,EAAE,GAAGA,KAAL;AAAY,UAAGb,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,CAAEoB,KAAV,CAAgBP,KAAnB;AAAZ;AAJqC,GAA7B,CAAd;;AAOA,SAAON,OAAO,GAAG,6BAAC,iBAAD;AAAM,IAAA,KAAK,EAAEM;AAAb,KAAqBK,KAArB,CAAH,GAAwCA,KAAtD;AACD,CAjCD;;eAmCenB,Q","sourcesContent":["import React from 'react';\nimport {\n extractNumbersFromString,\n SpacingType,\n useTheme,\n} from '@tecsinapse/react-core';\nimport { View } from 'react-native';\n\ntype FlexPositioning = 'flex-start' | 'flex-end' | 'center';\ntype FlexAlignBase = FlexPositioning | 'stretch';\ntype FlexAlignType = FlexAlignBase | 'baseline';\ntype FlexSpacing = 'space-between' | 'space-around';\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?: SpacingType;\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 style = {\n ...rest,\n boxSizing: 'border-box',\n flexBasis: `${100 / (columns / span)}%`,\n padding: _spacing ? extractNumbersFromString(spacing[_spacing]) : undefined,\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"}
@@ -0,0 +1 @@
1
+ export { default as GridItem, IGridItem } from './Item';
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "GridItem", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Item.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "IGridItem", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _Item.IGridItem;
16
+ }
17
+ });
18
+
19
+ var _Item = _interopRequireWildcard(require("./Item"));
20
+
21
+ 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); }
22
+
23
+ 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; }
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/molecules/Grid/Item/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["export { default as GridItem, IGridItem } from './Item';\n"],"file":"index.js"}
@@ -0,0 +1,2 @@
1
+ export { GridItem, IGridItem } from './Item';
2
+ export { default as Grid, IGrid } from './Grid';
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "GridItem", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Item.GridItem;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "IGridItem", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _Item.IGridItem;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "Grid", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _Grid.default;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "IGrid", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _Grid.IGrid;
28
+ }
29
+ });
30
+
31
+ var _Item = require("./Item");
32
+
33
+ var _Grid = _interopRequireWildcard(require("./Grid"));
34
+
35
+ 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); }
36
+
37
+ 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; }
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/molecules/Grid/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA","sourcesContent":["export { GridItem, IGridItem } from './Item';\nexport { default as Grid, IGrid } from './Grid';\n"],"file":"index.js"}
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ 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
27
  export { TextArea, TextAreaProps, TextAreaInputBase, } from './components/molecules/TextArea';
28
+ export { GridItem, Grid, IGridItem, IGrid } from './components/molecules/Grid';
28
29
  export * from './styles/definitions';
29
30
  export * from './styles/light';
30
31
  export { default as ThemeProvider } from './styles/ThemeProvider';
package/dist/index.js CHANGED
@@ -84,6 +84,10 @@ var _exportNames = {
84
84
  TextArea: true,
85
85
  TextAreaProps: true,
86
86
  TextAreaInputBase: true,
87
+ GridItem: true,
88
+ Grid: true,
89
+ IGridItem: true,
90
+ IGrid: true,
87
91
  ThemeProvider: true
88
92
  };
89
93
  Object.defineProperty(exports, "Avatar", {
@@ -566,6 +570,30 @@ Object.defineProperty(exports, "TextAreaInputBase", {
566
570
  return _TextArea.TextAreaInputBase;
567
571
  }
568
572
  });
573
+ Object.defineProperty(exports, "GridItem", {
574
+ enumerable: true,
575
+ get: function () {
576
+ return _Grid.GridItem;
577
+ }
578
+ });
579
+ Object.defineProperty(exports, "Grid", {
580
+ enumerable: true,
581
+ get: function () {
582
+ return _Grid.Grid;
583
+ }
584
+ });
585
+ Object.defineProperty(exports, "IGridItem", {
586
+ enumerable: true,
587
+ get: function () {
588
+ return _Grid.IGridItem;
589
+ }
590
+ });
591
+ Object.defineProperty(exports, "IGrid", {
592
+ enumerable: true,
593
+ get: function () {
594
+ return _Grid.IGrid;
595
+ }
596
+ });
569
597
  Object.defineProperty(exports, "ThemeProvider", {
570
598
  enumerable: true,
571
599
  get: function () {
@@ -627,6 +655,8 @@ var _HintInputContainer = require("./components/molecules/HintInputContainer");
627
655
 
628
656
  var _TextArea = require("./components/molecules/TextArea");
629
657
 
658
+ var _Grid = require("./components/molecules/Grid");
659
+
630
660
  var _definitions = require("./styles/definitions");
631
661
 
632
662
  Object.keys(_definitions).forEach(function (key) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAkBA;;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 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} 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"}
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;;AAMA;;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} 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"}
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.12.2",
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": "b7e0f13351b82b8687b03ab059f7dc90ff975a10"
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
  <>
@@ -0,0 +1,132 @@
1
+ import React from 'react';
2
+ import { Story } from '@storybook/react';
3
+ import Grid, { IGrid } from './Grid';
4
+ import { GridItem } from './Item';
5
+ import { Text } from '@tecsinapse/react-core';
6
+ import { View } from 'react-native';
7
+ import styled from '@emotion/native';
8
+
9
+ export default {
10
+ title: 'Hybrid/Grid',
11
+ component: Grid,
12
+ subcomponents: { GridItem },
13
+ };
14
+
15
+ const Container = styled(View)`
16
+ background-color: orange;
17
+ padding: 2px;
18
+ border-width: 1px;
19
+ border-color: white;
20
+ border-style: solid;
21
+ border-radius: 8px;
22
+ `;
23
+
24
+ const TemplateGrid: Story<IGrid> = args => {
25
+ return (
26
+ <Grid {...args}>
27
+ <GridItem span={12}>
28
+ <Container>
29
+ <Text>Box</Text>
30
+ </Container>
31
+ </GridItem>
32
+
33
+ <GridItem span={6}>
34
+ <Container>
35
+ <Text>Box</Text>
36
+ </Container>
37
+ </GridItem>
38
+ <GridItem span={6}>
39
+ <Container>
40
+ <Text>Box</Text>
41
+ </Container>
42
+ </GridItem>
43
+
44
+ <GridItem span={4} flexShrink={1}>
45
+ <Container>
46
+ <Text>Box</Text>
47
+ </Container>
48
+ </GridItem>
49
+ <GridItem span={4} flexGrow={1}>
50
+ <Container>
51
+ <Text>Box</Text>
52
+ </Container>
53
+ </GridItem>
54
+ <GridItem span={4} flexShrink={1}>
55
+ <Container>
56
+ <Text>Box</Text>
57
+ </Container>
58
+ </GridItem>
59
+
60
+ <GridItem span={3}>
61
+ <Container>
62
+ <Text>Box</Text>
63
+ </Container>
64
+ </GridItem>
65
+ <GridItem span={3}>
66
+ <Container>
67
+ <Text>Box</Text>
68
+ </Container>
69
+ </GridItem>
70
+ <GridItem span={3}>
71
+ <Container>
72
+ <Text>Box</Text>
73
+ </Container>
74
+ </GridItem>
75
+ <GridItem span={3}>
76
+ <Container>
77
+ <Text>Box</Text>
78
+ </Container>
79
+ </GridItem>
80
+ </Grid>
81
+ );
82
+ };
83
+
84
+ export const WithGridItem = TemplateGrid.bind({});
85
+
86
+ WithGridItem.args = {
87
+ spacing: 'mili',
88
+ };
89
+
90
+ const TemplateLayout: Story<IGrid> = args => {
91
+ return (
92
+ <Grid {...args}>
93
+ <Container>
94
+ <Text>Box</Text>
95
+ </Container>
96
+ <Container>
97
+ <Text>Box</Text>
98
+ </Container>
99
+ <Container>
100
+ <Text>Box</Text>
101
+ </Container>
102
+ <Container>
103
+ <Text>Box</Text>
104
+ </Container>
105
+ <Container>
106
+ <Text>Box</Text>
107
+ </Container>
108
+ <Container>
109
+ <Text>Box</Text>
110
+ </Container>
111
+ <Container>
112
+ <Text>Box</Text>
113
+ </Container>
114
+ <Container>
115
+ <Text>Box</Text>
116
+ </Container>
117
+ <Container>
118
+ <Text>Box</Text>
119
+ </Container>
120
+ <Container>
121
+ <Text>Box</Text>
122
+ </Container>
123
+ </Grid>
124
+ );
125
+ };
126
+
127
+ export const WithLayout = TemplateLayout.bind({});
128
+
129
+ WithLayout.args = {
130
+ layout: [[12], [6, 6], [4, 4, 4], [3, 3, 3, 3]],
131
+ spacing: 'mili',
132
+ };
@@ -0,0 +1,80 @@
1
+ import React from 'react';
2
+ import { View, ViewProps } from 'react-native';
3
+ import { GridItem } from './Item';
4
+ import { SpacingType } from '@tecsinapse/react-core';
5
+
6
+ export interface IGrid extends ViewProps {
7
+ children: JSX.Element[];
8
+ /** Layout should represent the multiplier of columns to fill the rows properly.
9
+ * Example:
10
+ * const layout = [
11
+ * [6, 6], // Two elements on row
12
+ * [4, 4, 4], // Three elements on row
13
+ * [12], // One element on row
14
+ * ];
15
+ * */
16
+ layout?: number[][];
17
+ /** Number of grid columns to be considered (not the number of elements per row) */
18
+ columns?: number;
19
+ spacing?: SpacingType;
20
+ }
21
+
22
+ const Grid = ({
23
+ children,
24
+ columns = 12,
25
+ layout,
26
+ style,
27
+ spacing,
28
+ ...rest
29
+ }: IGrid) => {
30
+ if (layout) {
31
+ const flatLayout = layout.flat();
32
+ return (
33
+ <View
34
+ style={[
35
+ style,
36
+ {
37
+ display: 'flex',
38
+ flexDirection: 'row',
39
+ flexWrap: 'wrap',
40
+ },
41
+ ]}
42
+ {...rest}
43
+ >
44
+ {React.Children.map(children, (child, index) => (
45
+ <GridItem
46
+ columns={columns}
47
+ span={flatLayout[index]}
48
+ spacing={spacing}
49
+ >
50
+ {child}
51
+ </GridItem>
52
+ ))}
53
+ </View>
54
+ );
55
+ }
56
+
57
+ return (
58
+ <View
59
+ style={[
60
+ style,
61
+ {
62
+ display: 'flex',
63
+ flexDirection: 'row',
64
+ flexWrap: 'wrap',
65
+ },
66
+ ]}
67
+ {...rest}
68
+ >
69
+ {React.Children.map(children, child => {
70
+ return React.cloneElement(child, {
71
+ ...child?.props,
72
+ columns,
73
+ spacing: child?.props.spacing ?? spacing,
74
+ });
75
+ })}
76
+ </View>
77
+ );
78
+ };
79
+
80
+ export default Grid;
@@ -0,0 +1,73 @@
1
+ import React from 'react';
2
+ import {
3
+ extractNumbersFromString,
4
+ SpacingType,
5
+ useTheme,
6
+ } from '@tecsinapse/react-core';
7
+ import { View } from 'react-native';
8
+
9
+ type FlexPositioning = 'flex-start' | 'flex-end' | 'center';
10
+ type FlexAlignBase = FlexPositioning | 'stretch';
11
+ type FlexAlignType = FlexAlignBase | 'baseline';
12
+ type FlexSpacing = 'space-between' | 'space-around';
13
+
14
+ export interface IGridItem {
15
+ children: React.ReactElement;
16
+ /** Number of columns to fill */
17
+ span: number;
18
+ /** You don't have to give this property since is inherited from Grid */
19
+ columns?: number;
20
+ loading?: boolean;
21
+ /** If your GridItem has a loading state, specify the component here (Skeleton) */
22
+ loadingComponent?: React.ReactElement;
23
+ /** Flex properties below */
24
+ alignContent?: FlexAlignBase | FlexSpacing;
25
+ alignItems?: FlexAlignType;
26
+ alignSelf?: 'auto' | FlexAlignType;
27
+ flex?: number;
28
+ flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
29
+ flexGrow?: number;
30
+ flexShrink?: number;
31
+ justifyContent?: FlexPositioning | FlexSpacing | 'space-evenly';
32
+ /** You don't have to give this property since is inherited from Grid */
33
+ spacing?: SpacingType;
34
+ /** Used to wrap children in a View when its style extrapolates the dimensions*/
35
+ wrapper?: boolean;
36
+ }
37
+
38
+ const GridItem = ({
39
+ children,
40
+ span,
41
+ columns = 12,
42
+ loadingComponent,
43
+ loading = false,
44
+ spacing: _spacing,
45
+ wrapper = false,
46
+ ...rest
47
+ }: IGridItem) => {
48
+ const { spacing } = useTheme();
49
+ if (!React.Children.only(children)) {
50
+ throw new Error('The number of children in GridItem should be one');
51
+ }
52
+ if (loadingComponent && loading) {
53
+ return loadingComponent;
54
+ }
55
+
56
+ const style = {
57
+ ...rest,
58
+ boxSizing: 'border-box',
59
+ flexBasis: `${100 / (columns / span)}%`,
60
+ padding: _spacing ? extractNumbersFromString(spacing[_spacing]) : undefined,
61
+ };
62
+
63
+ const clone = React.cloneElement(children, {
64
+ ...children?.props,
65
+ style: wrapper
66
+ ? children?.props.style
67
+ : { ...style, ...children?.props.style },
68
+ });
69
+
70
+ return wrapper ? <View style={style}>{clone}</View> : clone;
71
+ };
72
+
73
+ export default GridItem;
@@ -0,0 +1 @@
1
+ export { default as GridItem, IGridItem } from './Item';
@@ -0,0 +1,2 @@
1
+ export { GridItem, IGridItem } from './Item';
2
+ export { default as Grid, IGrid } from './Grid';
package/src/index.ts CHANGED
@@ -79,6 +79,7 @@ export {
79
79
  TextAreaProps,
80
80
  TextAreaInputBase,
81
81
  } from './components/molecules/TextArea';
82
+ export { GridItem, Grid, IGridItem, IGrid } from './components/molecules/Grid';
82
83
  export * from './styles/definitions';
83
84
  export * from './styles/light';
84
85
  export { default as ThemeProvider } from './styles/ThemeProvider';