@tecsinapse/react-native-kit 1.18.5 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/components/atoms/Avatar/Avatar.js +1 -1
  3. package/dist/components/atoms/Avatar/Avatar.js.map +1 -1
  4. package/dist/components/atoms/Avatar/index.js.map +1 -1
  5. package/dist/components/atoms/Badge/Badge.js +1 -1
  6. package/dist/components/atoms/Badge/Badge.js.map +1 -1
  7. package/dist/components/atoms/Badge/index.js.map +1 -1
  8. package/dist/components/atoms/BottomNavigator/BottomNavigator.js +1 -1
  9. package/dist/components/atoms/BottomNavigator/BottomNavigator.js.map +1 -1
  10. package/dist/components/atoms/BottomNavigator/Item.js +1 -1
  11. package/dist/components/atoms/BottomNavigator/Item.js.map +1 -1
  12. package/dist/components/atoms/BottomNavigator/index.js +1 -1
  13. package/dist/components/atoms/BottomNavigator/index.js.map +1 -1
  14. package/dist/components/atoms/BottomNavigator/styled.js +1 -1
  15. package/dist/components/atoms/BottomNavigator/styled.js.map +1 -1
  16. package/dist/components/atoms/Button/Button.d.ts +2 -2
  17. package/dist/components/atoms/Button/Button.js +1 -1
  18. package/dist/components/atoms/Button/Button.js.map +1 -1
  19. package/dist/components/atoms/Button/States/Error.js +1 -1
  20. package/dist/components/atoms/Button/States/Error.js.map +1 -1
  21. package/dist/components/atoms/Button/States/Loading.js +1 -1
  22. package/dist/components/atoms/Button/States/Loading.js.map +1 -1
  23. package/dist/components/atoms/Button/States/Success.js +1 -1
  24. package/dist/components/atoms/Button/States/Success.js.map +1 -1
  25. package/dist/components/atoms/Button/States/index.js.map +1 -1
  26. package/dist/components/atoms/Button/index.js.map +1 -1
  27. package/dist/components/atoms/GroupButton/GroupButtonOption.js +1 -1
  28. package/dist/components/atoms/GroupButton/GroupButtonOption.js.map +1 -1
  29. package/dist/components/atoms/GroupButton/index.js.map +1 -1
  30. package/dist/components/atoms/Header/Header.js +1 -1
  31. package/dist/components/atoms/Header/Header.js.map +1 -1
  32. package/dist/components/atoms/Header/index.js.map +1 -1
  33. package/dist/components/atoms/Header/styled.js +1 -1
  34. package/dist/components/atoms/Header/styled.js.map +1 -1
  35. package/dist/components/atoms/Input/Input.d.ts +3 -2
  36. package/dist/components/atoms/Input/Input.js +1 -2
  37. package/dist/components/atoms/Input/Input.js.map +1 -1
  38. package/dist/components/atoms/Input/index.js.map +1 -1
  39. package/dist/components/atoms/Input/styled.js.map +1 -1
  40. package/dist/components/atoms/InputMask/InputMask.js +1 -1
  41. package/dist/components/atoms/InputMask/InputMask.js.map +1 -1
  42. package/dist/components/atoms/InputMask/index.js.map +1 -1
  43. package/dist/components/atoms/InputMask/styled.js.map +1 -1
  44. package/dist/components/atoms/Modal/ModalGroupManager.js +2 -2
  45. package/dist/components/atoms/Modal/ModalGroupManager.js.map +1 -1
  46. package/dist/components/atoms/Modal/ModalLifecycleHandler.d.ts +2 -2
  47. package/dist/components/atoms/Modal/ModalLifecycleHandler.js +76 -85
  48. package/dist/components/atoms/Modal/ModalLifecycleHandler.js.map +1 -1
  49. package/dist/components/atoms/Modal/index.js.map +1 -1
  50. package/dist/components/atoms/Modal/ui/BaseModalView.d.ts +2 -2
  51. package/dist/components/atoms/Modal/ui/BaseModalView.js +4 -4
  52. package/dist/components/atoms/Modal/ui/BaseModalView.js.map +1 -1
  53. package/dist/components/atoms/Modal/ui/styled.js +12 -12
  54. package/dist/components/atoms/Modal/ui/styled.js.map +1 -1
  55. package/dist/components/atoms/Modal/ui/types.d.ts +1 -1
  56. package/dist/components/atoms/Modal/ui/types.js.map +1 -1
  57. package/dist/components/atoms/Modal/useLazyModalManager.d.ts +2 -2
  58. package/dist/components/atoms/Modal/useLazyModalManager.js.map +1 -1
  59. package/dist/components/atoms/Modal/useModalManager.d.ts +2 -2
  60. package/dist/components/atoms/Modal/useModalManager.js.map +1 -1
  61. package/dist/components/atoms/Modal/useModalRemoteControl.js.map +1 -1
  62. package/dist/components/atoms/Skeleton/Pulse.js.map +1 -1
  63. package/dist/components/atoms/Skeleton/Skeleton.js +1 -1
  64. package/dist/components/atoms/Skeleton/Skeleton.js.map +1 -1
  65. package/dist/components/atoms/Skeleton/Wave.js.map +1 -1
  66. package/dist/components/atoms/Skeleton/animation.js +1 -1
  67. package/dist/components/atoms/Skeleton/animation.js.map +1 -1
  68. package/dist/components/atoms/Skeleton/index.js.map +1 -1
  69. package/dist/components/atoms/Skeleton/styled.js.map +1 -1
  70. package/dist/components/atoms/Skeleton/types.js.map +1 -1
  71. package/dist/components/atoms/SnappingSlider/SnappingSlider.js +1 -1
  72. package/dist/components/atoms/SnappingSlider/SnappingSlider.js.map +1 -1
  73. package/dist/components/atoms/SnappingSlider/index.js.map +1 -1
  74. package/dist/components/atoms/Tag/Tag.js +1 -1
  75. package/dist/components/atoms/Tag/Tag.js.map +1 -1
  76. package/dist/components/atoms/Tag/index.js.map +1 -1
  77. package/dist/components/atoms/Text/Text.js.map +1 -1
  78. package/dist/components/atoms/Text/index.js.map +1 -1
  79. package/dist/components/atoms/Text/styled.js +1 -1
  80. package/dist/components/atoms/Text/styled.js.map +1 -1
  81. package/dist/components/atoms/TextArea/TextArea.js +1 -1
  82. package/dist/components/atoms/TextArea/TextArea.js.map +1 -1
  83. package/dist/components/atoms/TextArea/index.js.map +1 -1
  84. package/dist/components/atoms/TextArea/styled.js.map +1 -1
  85. package/dist/components/molecules/Calendar/Calendar.js +1 -1
  86. package/dist/components/molecules/Calendar/Calendar.js.map +1 -1
  87. package/dist/components/molecules/Calendar/index.js.map +1 -1
  88. package/dist/components/molecules/DatePicker/DatePicker.js +1 -1
  89. package/dist/components/molecules/DatePicker/DatePicker.js.map +1 -1
  90. package/dist/components/molecules/DatePicker/index.js.map +1 -1
  91. package/dist/components/molecules/DatePicker/styled.js +1 -1
  92. package/dist/components/molecules/DatePicker/styled.js.map +1 -1
  93. package/dist/components/molecules/DateTimePicker/DateTimePicker.js +1 -1
  94. package/dist/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
  95. package/dist/components/molecules/DateTimePicker/index.js.map +1 -1
  96. package/dist/components/molecules/DateTimeSelector/DateTimeSelector.js +1 -1
  97. package/dist/components/molecules/DateTimeSelector/DateTimeSelector.js.map +1 -1
  98. package/dist/components/molecules/DateTimeSelector/index.js.map +1 -1
  99. package/dist/components/molecules/Grid/Grid.d.ts +5 -0
  100. package/dist/components/molecules/Grid/Grid.js +57 -0
  101. package/dist/components/molecules/Grid/Grid.js.map +1 -0
  102. package/dist/components/molecules/Grid/Item/Item.d.ts +7 -0
  103. package/dist/components/molecules/Grid/Item/Item.js +78 -0
  104. package/dist/components/molecules/Grid/Item/Item.js.map +1 -0
  105. package/dist/components/molecules/Grid/Item/index.d.ts +1 -0
  106. package/dist/components/molecules/Grid/Item/index.js +14 -0
  107. package/dist/components/molecules/Grid/Item/index.js.map +1 -0
  108. package/dist/components/molecules/Grid/index.d.ts +2 -0
  109. package/dist/components/molecules/Grid/index.js +15 -0
  110. package/dist/components/molecules/Grid/index.js.map +1 -0
  111. package/dist/components/molecules/IconTextButton/IconTextButton.d.ts +6 -0
  112. package/dist/components/molecules/IconTextButton/IconTextButton.js +50 -0
  113. package/dist/components/molecules/IconTextButton/IconTextButton.js.map +1 -0
  114. package/dist/components/molecules/IconTextButton/TextComponent.d.ts +12 -0
  115. package/dist/components/molecules/IconTextButton/TextComponent.js +34 -0
  116. package/dist/components/molecules/IconTextButton/TextComponent.js.map +1 -0
  117. package/dist/components/molecules/IconTextButton/index.d.ts +1 -0
  118. package/dist/components/molecules/IconTextButton/index.js +14 -0
  119. package/dist/components/molecules/IconTextButton/index.js.map +1 -0
  120. package/dist/components/molecules/IconTextButton/styled.d.ts +2 -0
  121. package/dist/components/molecules/IconTextButton/styled.js +46 -0
  122. package/dist/components/molecules/IconTextButton/styled.js.map +1 -0
  123. package/dist/components/molecules/InputPassword/InputPassword.d.ts +3 -2
  124. package/dist/components/molecules/InputPassword/InputPassword.js +1 -1
  125. package/dist/components/molecules/InputPassword/InputPassword.js.map +1 -1
  126. package/dist/components/molecules/InputPassword/index.js.map +1 -1
  127. package/dist/components/molecules/LabeledSwitch/LabelComponent.d.ts +13 -0
  128. package/dist/components/molecules/LabeledSwitch/LabelComponent.js +36 -0
  129. package/dist/components/molecules/LabeledSwitch/LabelComponent.js.map +1 -0
  130. package/dist/components/molecules/LabeledSwitch/LabeledSwitch.d.ts +8 -0
  131. package/dist/components/molecules/LabeledSwitch/LabeledSwitch.js +53 -0
  132. package/dist/components/molecules/LabeledSwitch/LabeledSwitch.js.map +1 -0
  133. package/dist/components/molecules/LabeledSwitch/index.d.ts +1 -0
  134. package/dist/components/molecules/LabeledSwitch/index.js +14 -0
  135. package/dist/components/molecules/LabeledSwitch/index.js.map +1 -0
  136. package/dist/components/molecules/LabeledSwitch/styled.d.ts +9 -0
  137. package/dist/components/molecules/LabeledSwitch/styled.js +35 -0
  138. package/dist/components/molecules/LabeledSwitch/styled.js.map +1 -0
  139. package/dist/components/molecules/Select/Modal.d.ts +1 -1
  140. package/dist/components/molecules/Select/Modal.js +1 -2
  141. package/dist/components/molecules/Select/Modal.js.map +1 -1
  142. package/dist/components/molecules/Select/Select.js +3 -3
  143. package/dist/components/molecules/Select/Select.js.map +1 -1
  144. package/dist/components/molecules/Select/index.js.map +1 -1
  145. package/dist/components/molecules/Select/styled.js +1 -1
  146. package/dist/components/molecules/Select/styled.js.map +1 -1
  147. package/dist/components/molecules/Snackbar/Snackbar.js +1 -1
  148. package/dist/components/molecules/Snackbar/Snackbar.js.map +1 -1
  149. package/dist/components/molecules/Snackbar/index.js.map +1 -1
  150. package/dist/components/molecules/Snackbar/styled.js.map +1 -1
  151. package/dist/index.d.ts +17 -14
  152. package/dist/index.js +112 -91
  153. package/dist/index.js.map +1 -1
  154. package/dist/utils/date.js.map +1 -1
  155. package/package.json +5 -5
  156. package/src/components/atoms/BottomNavigator/BottomNavigator.tsx +3 -6
  157. package/src/components/atoms/Button/Button.tsx +19 -13
  158. package/src/components/atoms/Button/index.ts +1 -1
  159. package/src/components/atoms/Input/Input.tsx +8 -6
  160. package/src/components/atoms/Input/styled.ts +1 -3
  161. package/src/components/atoms/Modal/ModalGroupManager.tsx +22 -17
  162. package/src/components/atoms/Modal/ModalLifecycleHandler.ts +139 -126
  163. package/src/components/atoms/Modal/index.ts +7 -7
  164. package/src/components/atoms/Modal/ui/BaseModalView.tsx +150 -127
  165. package/src/components/atoms/Modal/ui/styled.ts +17 -17
  166. package/src/components/atoms/Modal/ui/types.ts +9 -8
  167. package/src/components/atoms/Modal/useLazyModalManager.ts +32 -31
  168. package/src/components/atoms/Modal/useModalManager.ts +28 -26
  169. package/src/components/atoms/Modal/useModalRemoteControl.ts +16 -18
  170. package/src/components/molecules/Calendar/Calendar.tsx +5 -1
  171. package/src/components/molecules/DatePicker/DatePicker.tsx +26 -17
  172. package/src/components/molecules/DatePicker/styled.ts +4 -4
  173. package/src/components/molecules/DateTimePicker/DateTimePicker.tsx +18 -16
  174. package/src/components/molecules/DateTimeSelector/DateTimeSelector.tsx +4 -1
  175. package/src/components/molecules/Grid/Grid.tsx +68 -0
  176. package/src/components/molecules/Grid/Item/Item.tsx +77 -0
  177. package/src/components/molecules/Grid/Item/index.ts +1 -0
  178. package/src/components/molecules/Grid/index.ts +2 -0
  179. package/src/components/molecules/IconTextButton/IconTextButton.tsx +55 -0
  180. package/src/components/molecules/IconTextButton/TextComponent.tsx +43 -0
  181. package/src/components/molecules/IconTextButton/index.ts +4 -0
  182. package/src/components/molecules/IconTextButton/styled.ts +35 -0
  183. package/src/components/molecules/InputPassword/InputPassword.tsx +3 -2
  184. package/src/components/molecules/LabeledSwitch/LabelComponent.tsx +46 -0
  185. package/src/components/molecules/LabeledSwitch/LabeledSwitch.tsx +59 -0
  186. package/src/components/molecules/LabeledSwitch/index.ts +4 -0
  187. package/src/components/molecules/LabeledSwitch/styled.ts +27 -0
  188. package/src/components/molecules/Select/Modal.tsx +88 -66
  189. package/src/components/molecules/Select/Select.tsx +2 -2
  190. package/src/index.ts +38 -29
@@ -1,13 +1,14 @@
1
-
2
1
  /**
3
2
  * Defines a modal interface and allows you implement your own modal component.
4
3
  */
4
+ import React from 'react';
5
+
5
6
  export interface IBaseModal {
6
- visible?: boolean
7
- BoxComponent?: React.FC<any>
8
- frozen?: boolean
9
- isLastShown?: boolean
10
- showCloseBar?: boolean
11
- close?: () => void
12
- onClose?: () => void
7
+ visible?: boolean;
8
+ BoxComponent?: React.FC<any>;
9
+ frozen?: boolean;
10
+ isLastShown?: boolean;
11
+ showCloseBar?: boolean;
12
+ close?: () => void;
13
+ onClose?: () => void;
13
14
  }
@@ -1,43 +1,44 @@
1
- import { ReactElement, useCallback, useEffect, useState } from "react"
2
- import { v4 as uuidv4 } from 'uuid'
3
- import { modalLifecycle } from "./ModalGroupManager"
4
- import { IBaseModal } from "./ui/types"
1
+ import { ReactElement, useCallback, useEffect, useState } from 'react';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+ import { modalLifecycle } from './ModalGroupManager';
4
+ import { IBaseModal } from './ui/types';
5
5
 
6
6
  /**
7
7
  * Use this hook to tell the modal lifecycle handler that you want to add
8
- * a new modal component.
9
- *
10
- * @param id
11
- * @param modal
8
+ * a new modal component.
9
+ *
12
10
  * @returns
11
+ * @param modalId
13
12
  */
14
13
  export const useLazyModalManager = (modalId?: string) => {
14
+ const [id] = useState(modalId ?? uuidv4());
15
15
 
16
- const [id] = useState(modalId ?? uuidv4())
16
+ const requestUpdate = useCallback(() => modalLifecycle.update(), []);
17
17
 
18
- const requestUpdate = useCallback(() => modalLifecycle.update(), [])
18
+ const sync = useCallback(
19
+ (modal: ReactElement<IBaseModal>) => {
20
+ modalLifecycle.sync(id, () => modal);
21
+ return null;
22
+ },
23
+ [id]
24
+ );
19
25
 
20
- const sync = useCallback((modal: ReactElement<IBaseModal>) => {
21
- modalLifecycle.sync(id, () => modal)
22
- return null
23
- }, [id])
26
+ const show = useCallback(() => {
27
+ modalLifecycle.show(id);
28
+ }, [id]);
24
29
 
25
- const show = useCallback(() => {
26
- modalLifecycle.show(id)
27
- }, [id])
30
+ const close = useCallback(() => {
31
+ modalLifecycle.close(id);
32
+ }, [id]);
28
33
 
29
- const close = useCallback(() => {
30
- modalLifecycle.close(id)
31
- }, [id])
32
-
33
- useEffect(() => {
34
- return () => modalLifecycle.destroy(id)
35
- }, [])
34
+ useEffect(() => {
35
+ return () => modalLifecycle.destroy(id);
36
+ }, []);
36
37
 
37
- return {
38
- requestUpdate,
39
- sync,
40
- show,
41
- close
42
- }
43
- }
38
+ return {
39
+ requestUpdate,
40
+ sync,
41
+ show,
42
+ close,
43
+ };
44
+ };
@@ -1,35 +1,37 @@
1
- import { ReactElement, useCallback, useEffect, useState } from "react"
2
- import { v4 as uuidv4 } from 'uuid'
3
- import { modalLifecycle } from "./ModalGroupManager"
4
- import { IBaseModal } from "./ui/types"
1
+ import { ReactElement, useCallback, useEffect, useState } from 'react';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+ import { modalLifecycle } from './ModalGroupManager';
4
+ import { IBaseModal } from './ui/types';
5
5
 
6
6
  /**
7
7
  * Use this hook to tell the modal lifecycle handler that you want to add
8
- * a new modal component.
9
- *
10
- * @param id
11
- * @param modal
8
+ * a new modal component.
9
+ *
10
+ * @param id
11
+ * @param modal
12
12
  * @returns
13
13
  */
14
- export const useModalManager = (modal: () => ReactElement<IBaseModal>, modalId?: string) => {
14
+ export const useModalManager = (
15
+ modal: () => ReactElement<IBaseModal>,
16
+ modalId?: string
17
+ ) => {
18
+ const [id] = useState(modalId ?? uuidv4());
19
+ modalLifecycle.sync(id, modal);
15
20
 
16
- const [id] = useState(modalId ?? uuidv4())
17
- modalLifecycle.sync(id, modal)
21
+ const show = useCallback(() => {
22
+ modalLifecycle.show(id);
23
+ }, [id]);
18
24
 
19
- const show = useCallback(() => {
20
- modalLifecycle.show(id)
21
- }, [id])
25
+ const close = useCallback(() => {
26
+ modalLifecycle.close(id);
27
+ }, [id]);
22
28
 
23
- const close = useCallback(() => {
24
- modalLifecycle.close(id)
25
- }, [id])
26
-
27
- useEffect(() => {
28
- return () => modalLifecycle.destroy(id)
29
- }, [])
29
+ useEffect(() => {
30
+ return () => modalLifecycle.destroy(id);
31
+ }, []);
30
32
 
31
- return {
32
- show,
33
- close
34
- }
35
- }
33
+ return {
34
+ show,
35
+ close,
36
+ };
37
+ };
@@ -1,26 +1,24 @@
1
- import { useCallback } from "react"
2
- import { modalLifecycle } from "./ModalGroupManager"
1
+ import { useCallback } from 'react';
2
+ import { modalLifecycle } from './ModalGroupManager';
3
3
 
4
4
  /**
5
5
  * Use it to control a specific modal wherever it's.
6
6
  * Just provide an id of a specific instance.
7
- *
8
- * @param modalId
9
- * @returns
7
+ *
8
+ * @param modalId
9
+ * @returns
10
10
  */
11
11
  export const useModalRemoteControl = (modalId: string) => {
12
+ const show = useCallback(() => {
13
+ modalLifecycle.show(modalId);
14
+ }, [modalId]);
12
15
 
13
- const show = useCallback(() => {
14
- modalLifecycle.show(modalId)
15
- }, [modalId])
16
+ const close = useCallback(() => {
17
+ modalLifecycle.close(modalId);
18
+ }, [modalId]);
16
19
 
17
- const close = useCallback(() => {
18
- modalLifecycle.close(modalId)
19
- }, [modalId])
20
-
21
- return {
22
- show,
23
- close
24
- }
25
-
26
- }
20
+ return {
21
+ show,
22
+ close,
23
+ };
24
+ };
@@ -1,4 +1,8 @@
1
- import { Calendar as CalendarCore, CalendarProps, SelectionType } from '@tecsinapse/react-core';
1
+ import {
2
+ Calendar as CalendarCore,
3
+ CalendarProps,
4
+ SelectionType,
5
+ } from '@tecsinapse/react-core';
2
6
  import React from 'react';
3
7
  import { getLocale } from '../../../utils/date';
4
8
  import { Text } from '../../atoms/Text';
@@ -1,5 +1,8 @@
1
1
  import {
2
- DatePicker as DatePickerCore, DatePickerProps, SelectionType, Value
2
+ DatePicker as DatePickerCore,
3
+ DatePickerProps,
4
+ SelectionType,
5
+ Value,
3
6
  } from '@tecsinapse/react-core';
4
7
  import React, { FC } from 'react';
5
8
  import { getLocale } from '../../../utils/date';
@@ -8,17 +11,26 @@ import { Text } from '../../atoms/Text';
8
11
  import { Calendar } from '../Calendar';
9
12
  import { CalendarBoxContent } from './styled';
10
13
 
11
- export type NativeDatePickerProps<T extends SelectionType> = Omit<DatePickerProps<T>, 'CalendarComponent' | 'renderCalendar' | 'requestCloseCalendar' | 'requestShowCalendar'>
14
+ export type NativeDatePickerProps<T extends SelectionType> = Omit<
15
+ DatePickerProps<T>,
16
+ | 'CalendarComponent'
17
+ | 'renderCalendar'
18
+ | 'requestCloseCalendar'
19
+ | 'requestShowCalendar'
20
+ >;
12
21
 
13
- export const DatePicker = <T extends SelectionType>({ locale, onChange, ...rest }: NativeDatePickerProps<T>): JSX.Element => {
22
+ export const DatePicker = <T extends SelectionType>({
23
+ locale,
24
+ onChange,
25
+ ...rest
26
+ }: NativeDatePickerProps<T>): JSX.Element => {
27
+ const modal = useLazyModalManager();
14
28
 
15
- const modal = useLazyModalManager()
16
-
17
29
  const handleChange = (value?: Value<T>) => {
18
- onChange?.(value)
19
- modal.requestUpdate()
20
- }
21
-
30
+ onChange?.(value);
31
+ modal.requestUpdate();
32
+ };
33
+
22
34
  return (
23
35
  <DatePickerCore
24
36
  {...rest}
@@ -28,14 +40,11 @@ export const DatePicker = <T extends SelectionType>({ locale, onChange, ...rest
28
40
  onChange={handleChange}
29
41
  requestShowCalendar={() => modal.show()}
30
42
  requestCloseCalendar={() => modal.close()}
31
- renderCalendar={(calendar, blur) => modal.sync(
32
- <NativeModal onClose={blur}>
33
- {calendar}
34
- </NativeModal>
35
- )}
43
+ renderCalendar={(calendar, blur) =>
44
+ modal.sync(<NativeModal onClose={blur}>{calendar}</NativeModal>)
45
+ }
36
46
  />
37
47
  );
38
-
39
48
  };
40
49
 
41
50
  const NativeModal: FC<IBaseModal> = ({ children, ...others }) => {
@@ -43,5 +52,5 @@ const NativeModal: FC<IBaseModal> = ({ children, ...others }) => {
43
52
  <ModalView BoxComponent={CalendarBoxContent} {...others}>
44
53
  {children}
45
54
  </ModalView>
46
- )
47
- }
55
+ );
56
+ };
@@ -1,6 +1,6 @@
1
- import styled from "@emotion/native";
2
- import { BoxContent, StyleProps } from "@tecsinapse/react-core";
1
+ import styled from '@emotion/native';
2
+ import { BoxContent, StyleProps } from '@tecsinapse/react-core';
3
3
 
4
4
  export const CalendarBoxContent = styled(BoxContent)<Partial<StyleProps>>`
5
- background-color: ${({ theme }) => theme.color.secondary.xlight};
6
- `
5
+ background-color: ${({ theme }) => theme.color.secondary.xlight};
6
+ `;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DateTimePicker as DateTimePickerCore,
3
- DateTimePickerProps
3
+ DateTimePickerProps,
4
4
  } from '@tecsinapse/react-core';
5
5
  import React, { FC } from 'react';
6
6
  import { getLocale } from '../../../utils/date';
@@ -8,11 +8,19 @@ import { IBaseModal, ModalView, useLazyModalManager } from '../../atoms/Modal';
8
8
  import { Text } from '../../atoms/Text';
9
9
  import { DateTimeSelector } from '../DateTimeSelector';
10
10
 
11
- export type NativeDateTimePickerProps = Omit<DateTimePickerProps, 'DateTimeSelectorComponent' | 'renderSelector' | 'requestCloseSelector' | 'requestShowSelector'>
11
+ export type NativeDateTimePickerProps = Omit<
12
+ DateTimePickerProps,
13
+ | 'DateTimeSelectorComponent'
14
+ | 'renderSelector'
15
+ | 'requestCloseSelector'
16
+ | 'requestShowSelector'
17
+ >;
12
18
 
13
- export const DateTimePicker: FC<NativeDateTimePickerProps> = ({ locale, ...rest }) => {
14
-
15
- const modal = useLazyModalManager()
19
+ export const DateTimePicker: FC<NativeDateTimePickerProps> = ({
20
+ locale,
21
+ ...rest
22
+ }) => {
23
+ const modal = useLazyModalManager();
16
24
 
17
25
  return (
18
26
  <DateTimePickerCore
@@ -22,19 +30,13 @@ export const DateTimePicker: FC<NativeDateTimePickerProps> = ({ locale, ...rest
22
30
  locale={locale ?? getLocale()}
23
31
  requestShowSelector={() => modal.show()}
24
32
  requestCloseSelector={() => modal.close()}
25
- renderSelector={(selector, blur) => modal.sync(
26
- <NativeModal onClose={blur}>
27
- {selector}
28
- </NativeModal>
29
- )}
33
+ renderSelector={(selector, blur) =>
34
+ modal.sync(<NativeModal onClose={blur}>{selector}</NativeModal>)
35
+ }
30
36
  />
31
37
  );
32
38
  };
33
39
 
34
40
  const NativeModal: FC<IBaseModal> = ({ children, ...others }) => {
35
- return (
36
- <ModalView {...others}>
37
- {children}
38
- </ModalView>
39
- )
40
- }
41
+ return <ModalView {...others}>{children}</ModalView>;
42
+ };
@@ -6,7 +6,10 @@ import React, { FC } from 'react';
6
6
  import { Text } from '../../atoms/Text';
7
7
  import { getLocale } from '../../../utils/date';
8
8
 
9
- export const DateTimeSelector: FC<DateTimeSelectorProps> = ({locale, ...rest}) => {
9
+ export const DateTimeSelector: FC<DateTimeSelectorProps> = ({
10
+ locale,
11
+ ...rest
12
+ }) => {
10
13
  return (
11
14
  <DateTimeSelectorCore
12
15
  {...rest}
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ import { View, ViewProps } from 'react-native';
3
+ import { GridItem } from './Item';
4
+ import { IGrid } from '@tecsinapse/react-core';
5
+
6
+ export type IGridNative = IGrid & ViewProps;
7
+
8
+ const Grid = ({
9
+ children,
10
+ columns = 12,
11
+ layout,
12
+ style,
13
+ spacing,
14
+ ...rest
15
+ }: IGridNative): JSX.Element => {
16
+ if (layout) {
17
+ const flatLayout = layout.flat();
18
+ return (
19
+ <View
20
+ style={[
21
+ style,
22
+ {
23
+ display: 'flex',
24
+ flexDirection: 'row',
25
+ flexWrap: 'wrap',
26
+ },
27
+ ]}
28
+ {...rest}
29
+ >
30
+ {React.Children.map(children, (child, index) => (
31
+ <GridItem
32
+ key={`child-${index}`}
33
+ columns={columns}
34
+ span={flatLayout[index]}
35
+ spacing={spacing}
36
+ >
37
+ {child}
38
+ </GridItem>
39
+ ))}
40
+ </View>
41
+ );
42
+ }
43
+
44
+ return (
45
+ <View
46
+ style={[
47
+ style,
48
+ {
49
+ display: 'flex',
50
+ flexDirection: 'row',
51
+ flexWrap: 'wrap',
52
+ },
53
+ ]}
54
+ {...rest}
55
+ >
56
+ {React.Children.map(children, (child, index) => {
57
+ return React.cloneElement(child, {
58
+ ...child?.props,
59
+ columns,
60
+ spacing: child?.props.spacing ?? spacing,
61
+ key: `child-${index}`,
62
+ });
63
+ })}
64
+ </View>
65
+ );
66
+ };
67
+
68
+ export default Grid;
@@ -0,0 +1,77 @@
1
+ import React from 'react';
2
+ import { View, ViewProps } from 'react-native';
3
+ import {
4
+ IGridItem,
5
+ useTheme,
6
+ getGridItemColumSpan,
7
+ getGridItemPadding,
8
+ } from '@tecsinapse/react-core';
9
+
10
+ export type IGridItemNative = IGridItem &
11
+ ViewProps & {
12
+ /** Only specify this property if the GridItem will be 'dynamic', adjusting itself to content. Use this with `wrapper` for better result. */
13
+ flexBasis?: string | 'auto';
14
+ };
15
+
16
+ const GridItem = ({
17
+ children,
18
+ span,
19
+ columns = 12,
20
+ loadingComponent,
21
+ loading = false,
22
+ spacing: _spacing,
23
+ wrapper = false,
24
+ alignContent,
25
+ alignItems,
26
+ alignSelf,
27
+ flex,
28
+ flexDirection,
29
+ flexGrow,
30
+ flexShrink,
31
+ justifyContent,
32
+ flexBasis,
33
+ style,
34
+ ...rest
35
+ }: IGridItemNative): JSX.Element => {
36
+ const { spacing } = useTheme();
37
+ if (!React.Children.only(children)) {
38
+ throw new Error('The number of children in GridItem should be one');
39
+ }
40
+ if (loadingComponent && loading) {
41
+ return loadingComponent;
42
+ }
43
+
44
+ const _style = {
45
+ alignContent,
46
+ alignItems,
47
+ alignSelf,
48
+ flex,
49
+ flexDirection,
50
+ flexGrow,
51
+ flexShrink,
52
+ justifyContent,
53
+ boxSizing: 'border-box',
54
+ flexBasis: flexBasis ?? `${getGridItemColumSpan(columns, span)}%`,
55
+ paddingTop: getGridItemPadding('top', _spacing, spacing),
56
+ paddingBottom: getGridItemPadding('bottom', _spacing, spacing),
57
+ paddingRight: getGridItemPadding('right', _spacing, spacing),
58
+ paddingLeft: getGridItemPadding('left', _spacing, spacing),
59
+ };
60
+
61
+ const clone = React.cloneElement(children, {
62
+ ...children?.props,
63
+ style: wrapper
64
+ ? children?.props.style
65
+ : { ..._style, ...children?.props.style },
66
+ });
67
+
68
+ return wrapper ? (
69
+ <View {...rest} style={[style, _style]}>
70
+ {clone}
71
+ </View>
72
+ ) : (
73
+ clone
74
+ );
75
+ };
76
+
77
+ export default GridItem;
@@ -0,0 +1 @@
1
+ export { default as GridItem, IGridItemNative } from './Item';
@@ -0,0 +1,2 @@
1
+ export { GridItem } from './Item';
2
+ export { default as Grid } from './Grid';
@@ -0,0 +1,55 @@
1
+ import {
2
+ fontColorVC,
3
+ IconComponent,
4
+ IconTextButtonProps,
5
+ } from '@tecsinapse/react-core';
6
+ import React from 'react';
7
+ import { ButtonNativeProps } from '../../atoms/Button';
8
+ import { StyledIconTextButton } from './styled';
9
+ import TextComponent from './TextComponent';
10
+
11
+ export type NativeIconTextButtonProps = IconTextButtonProps &
12
+ Omit<ButtonNativeProps, 'ButtonProps'>;
13
+
14
+ const IconTextButton: React.FC<NativeIconTextButtonProps> = ({
15
+ iconProps,
16
+ iconPosition = 'left',
17
+ textProps,
18
+ label,
19
+ variant = 'filled',
20
+ size = 'default',
21
+ ...rest
22
+ }) => {
23
+ return (
24
+ <StyledIconTextButton boxed={!label} variant={variant} {...rest}>
25
+ {iconPosition === 'left' ? (
26
+ <IconComponent
27
+ iconProps={iconProps}
28
+ size={size}
29
+ defaultFontColor={fontColorVC[variant]}
30
+ />
31
+ ) : (
32
+ <></>
33
+ )}
34
+ <TextComponent
35
+ label={label}
36
+ defaultFontColor={fontColorVC[variant]}
37
+ hasIcon={!!iconProps}
38
+ iconPosition={iconPosition}
39
+ textProps={textProps}
40
+ size={size}
41
+ />
42
+ {iconPosition === 'right' ? (
43
+ <IconComponent
44
+ iconProps={iconProps}
45
+ size={size}
46
+ defaultFontColor={fontColorVC[variant]}
47
+ />
48
+ ) : (
49
+ <></>
50
+ )}
51
+ </StyledIconTextButton>
52
+ );
53
+ };
54
+
55
+ export default IconTextButton;
@@ -0,0 +1,43 @@
1
+ import {
2
+ ButtonSizeType,
3
+ FontColor,
4
+ IconPositionOptions,
5
+ TextProps,
6
+ } from '@tecsinapse/react-core';
7
+ import React, { FC } from 'react';
8
+ import { StyledText } from './styled';
9
+
10
+ interface TextComponentProps {
11
+ textProps?: TextProps;
12
+ size?: ButtonSizeType;
13
+ defaultFontColor: keyof FontColor;
14
+ label?: string;
15
+ iconPosition?: IconPositionOptions;
16
+ hasIcon?: boolean;
17
+ }
18
+
19
+ const TextComponent: FC<TextComponentProps> = ({
20
+ textProps,
21
+ size = 'default',
22
+ defaultFontColor,
23
+ label,
24
+ iconPosition = 'left',
25
+ hasIcon = false,
26
+ }) => {
27
+ return label ? (
28
+ <StyledText
29
+ typography={textProps?.typography ?? size === 'small' ? 'sub' : 'base'}
30
+ fontWeight={textProps?.fontWeight ?? 'bold'}
31
+ fontColor={textProps?.fontColor ?? defaultFontColor}
32
+ iconPosition={iconPosition}
33
+ hasIcon={hasIcon}
34
+ {...textProps}
35
+ >
36
+ {label}
37
+ </StyledText>
38
+ ) : (
39
+ <></>
40
+ );
41
+ };
42
+
43
+ export default React.memo(TextComponent);
@@ -0,0 +1,4 @@
1
+ export {
2
+ default as IconTextButton,
3
+ NativeIconTextButtonProps,
4
+ } from './IconTextButton';
@@ -0,0 +1,35 @@
1
+ import styled, { css } from '@emotion/native';
2
+ import { IconPositionOptions, StyleProps } from '@tecsinapse/react-core';
3
+ import { Button } from '../../atoms/Button';
4
+ import { Text } from '../../atoms/Text';
5
+
6
+ const boxedStyle = ({ theme }: Partial<StyleProps>) => `
7
+ padding: ${theme?.spacing.centi};
8
+ aspect-ratio: 1;
9
+ `;
10
+
11
+ export const StyledIconTextButton = styled(Button)<
12
+ Partial<StyleProps> & {
13
+ boxed: boolean;
14
+ }
15
+ >`
16
+ ${({ boxed, theme }) => boxed && boxedStyle({ theme })};
17
+ `;
18
+
19
+ export const StyledText = styled(Text)<
20
+ Partial<StyleProps> & {
21
+ iconPosition: IconPositionOptions;
22
+ hasIcon?: boolean;
23
+ }
24
+ >`
25
+ ${({ theme, iconPosition, hasIcon = false }) => {
26
+ if (hasIcon && iconPosition === 'left')
27
+ return css`
28
+ margin-left: ${theme?.spacing.mili};
29
+ `;
30
+ else if (hasIcon && iconPosition === 'right')
31
+ return css`
32
+ margin-right: ${theme?.spacing.mili};
33
+ `;
34
+ }}
35
+ `;
@@ -1,10 +1,11 @@
1
1
  import { InputPasswordIcon } from '@tecsinapse/react-core';
2
- import React, { FC, useState } from 'react';
2
+ import React, { useState } from 'react';
3
3
  import { Input, InputNativeProps } from '../../atoms/Input';
4
+ import { TextInput } from 'react-native';
4
5
 
5
6
  export type InputPasswordNativeProps = InputNativeProps;
6
7
 
7
- const InputPassword: FC<InputPasswordNativeProps> = React.forwardRef(
8
+ const InputPassword = React.forwardRef<TextInput, InputPasswordNativeProps>(
8
9
  ({ rightComponent, ...rest }, ref) => {
9
10
  const [revealed, setRevealed] = useState(false);
10
11
  return (