@tecsinapse/react-native-kit 1.18.6 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/dist/components/atoms/Avatar/Avatar.js +4 -2
- package/dist/components/atoms/Avatar/Avatar.js.map +1 -1
- package/dist/components/atoms/Avatar/index.js +9 -4
- package/dist/components/atoms/Avatar/index.js.map +1 -1
- package/dist/components/atoms/Badge/Badge.js +11 -8
- package/dist/components/atoms/Badge/Badge.js.map +1 -1
- package/dist/components/atoms/Badge/index.js +15 -5
- package/dist/components/atoms/Badge/index.js.map +1 -1
- package/dist/components/atoms/BottomNavigator/BottomNavigator.js +13 -10
- package/dist/components/atoms/BottomNavigator/BottomNavigator.js.map +1 -1
- package/dist/components/atoms/BottomNavigator/Item.js +11 -8
- package/dist/components/atoms/BottomNavigator/Item.js.map +1 -1
- package/dist/components/atoms/BottomNavigator/index.js +21 -7
- package/dist/components/atoms/BottomNavigator/index.js.map +1 -1
- package/dist/components/atoms/BottomNavigator/styled.js +64 -45
- package/dist/components/atoms/BottomNavigator/styled.js.map +1 -1
- package/dist/components/atoms/Button/Button.d.ts +2 -2
- package/dist/components/atoms/Button/Button.js +11 -8
- package/dist/components/atoms/Button/Button.js.map +1 -1
- package/dist/components/atoms/Button/States/Error.js +4 -2
- package/dist/components/atoms/Button/States/Error.js.map +1 -1
- package/dist/components/atoms/Button/States/Loading.js +4 -2
- package/dist/components/atoms/Button/States/Loading.js.map +1 -1
- package/dist/components/atoms/Button/States/Success.js +4 -2
- package/dist/components/atoms/Button/States/Success.js.map +1 -1
- package/dist/components/atoms/Button/States/index.js +21 -8
- package/dist/components/atoms/Button/States/index.js.map +1 -1
- package/dist/components/atoms/Button/index.js +33 -9
- package/dist/components/atoms/Button/index.js.map +1 -1
- package/dist/components/atoms/GroupButton/GroupButtonOption.js +4 -2
- package/dist/components/atoms/GroupButton/GroupButtonOption.js.map +1 -1
- package/dist/components/atoms/GroupButton/index.js +9 -4
- package/dist/components/atoms/GroupButton/index.js.map +1 -1
- package/dist/components/atoms/Header/Header.js +19 -16
- package/dist/components/atoms/Header/Header.js.map +1 -1
- package/dist/components/atoms/Header/index.js +15 -5
- package/dist/components/atoms/Header/index.js.map +1 -1
- package/dist/components/atoms/Header/styled.js +17 -17
- package/dist/components/atoms/Header/styled.js.map +1 -1
- package/dist/components/atoms/Input/Input.d.ts +3 -2
- package/dist/components/atoms/Input/Input.js +31 -28
- package/dist/components/atoms/Input/Input.js.map +1 -1
- package/dist/components/atoms/Input/index.js +15 -5
- package/dist/components/atoms/Input/index.js.map +1 -1
- package/dist/components/atoms/Input/styled.js +13 -8
- package/dist/components/atoms/Input/styled.js.map +1 -1
- package/dist/components/atoms/InputMask/InputMask.js +32 -28
- package/dist/components/atoms/InputMask/InputMask.js.map +1 -1
- package/dist/components/atoms/InputMask/index.js +15 -5
- package/dist/components/atoms/InputMask/index.js.map +1 -1
- package/dist/components/atoms/InputMask/styled.js +14 -11
- package/dist/components/atoms/InputMask/styled.js.map +1 -1
- package/dist/components/atoms/Modal/ModalGroupManager.js +10 -7
- package/dist/components/atoms/Modal/ModalGroupManager.js.map +1 -1
- package/dist/components/atoms/Modal/ModalLifecycleHandler.d.ts +2 -2
- package/dist/components/atoms/Modal/ModalLifecycleHandler.js +31 -25
- package/dist/components/atoms/Modal/ModalLifecycleHandler.js.map +1 -1
- package/dist/components/atoms/Modal/index.js +45 -8
- package/dist/components/atoms/Modal/index.js.map +1 -1
- package/dist/components/atoms/Modal/ui/BaseModalView.d.ts +2 -2
- package/dist/components/atoms/Modal/ui/BaseModalView.js +19 -16
- package/dist/components/atoms/Modal/ui/BaseModalView.js.map +1 -1
- package/dist/components/atoms/Modal/ui/styled.js +19 -21
- package/dist/components/atoms/Modal/ui/styled.js.map +1 -1
- package/dist/components/atoms/Modal/ui/types.d.ts +1 -1
- package/dist/components/atoms/Modal/ui/types.js +3 -1
- package/dist/components/atoms/Modal/ui/types.js.map +1 -1
- package/dist/components/atoms/Modal/useLazyModalManager.d.ts +2 -2
- package/dist/components/atoms/Modal/useLazyModalManager.js +4 -2
- package/dist/components/atoms/Modal/useLazyModalManager.js.map +1 -1
- package/dist/components/atoms/Modal/useModalManager.d.ts +2 -2
- package/dist/components/atoms/Modal/useModalManager.js +4 -2
- package/dist/components/atoms/Modal/useModalManager.js.map +1 -1
- package/dist/components/atoms/Modal/useModalRemoteControl.js +3 -1
- package/dist/components/atoms/Modal/useModalRemoteControl.js.map +1 -1
- package/dist/components/atoms/Skeleton/Pulse.js +16 -11
- package/dist/components/atoms/Skeleton/Pulse.js.map +1 -1
- package/dist/components/atoms/Skeleton/Skeleton.js +14 -11
- package/dist/components/atoms/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/atoms/Skeleton/Wave.js +17 -12
- package/dist/components/atoms/Skeleton/Wave.js.map +1 -1
- package/dist/components/atoms/Skeleton/animation.js +4 -2
- package/dist/components/atoms/Skeleton/animation.js.map +1 -1
- package/dist/components/atoms/Skeleton/index.js +15 -5
- package/dist/components/atoms/Skeleton/index.js.map +1 -1
- package/dist/components/atoms/Skeleton/styled.js +25 -15
- package/dist/components/atoms/Skeleton/styled.js.map +1 -1
- package/dist/components/atoms/Skeleton/types.js +3 -1
- package/dist/components/atoms/Skeleton/types.js.map +1 -1
- package/dist/components/atoms/SnappingSlider/SnappingSlider.js +12 -9
- package/dist/components/atoms/SnappingSlider/SnappingSlider.js.map +1 -1
- package/dist/components/atoms/SnappingSlider/index.js +15 -5
- package/dist/components/atoms/SnappingSlider/index.js.map +1 -1
- package/dist/components/atoms/Tag/Tag.js +9 -6
- package/dist/components/atoms/Tag/Tag.js.map +1 -1
- package/dist/components/atoms/Tag/index.js +15 -5
- package/dist/components/atoms/Tag/index.js.map +1 -1
- package/dist/components/atoms/Text/Text.js +8 -5
- package/dist/components/atoms/Text/Text.js.map +1 -1
- package/dist/components/atoms/Text/index.js +15 -5
- package/dist/components/atoms/Text/index.js.map +1 -1
- package/dist/components/atoms/Text/styled.js +17 -13
- package/dist/components/atoms/Text/styled.js.map +1 -1
- package/dist/components/atoms/TextArea/TextArea.js +31 -28
- package/dist/components/atoms/TextArea/TextArea.js.map +1 -1
- package/dist/components/atoms/TextArea/index.js +15 -5
- package/dist/components/atoms/TextArea/index.js.map +1 -1
- package/dist/components/atoms/TextArea/styled.js +3 -1
- package/dist/components/atoms/TextArea/styled.js.map +1 -1
- package/dist/components/molecules/Calendar/Calendar.js +10 -7
- package/dist/components/molecules/Calendar/Calendar.js.map +1 -1
- package/dist/components/molecules/Calendar/index.js +9 -4
- package/dist/components/molecules/Calendar/index.js.map +1 -1
- package/dist/components/molecules/DatePicker/DatePicker.js +17 -13
- package/dist/components/molecules/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/molecules/DatePicker/index.js +15 -5
- package/dist/components/molecules/DatePicker/index.js.map +1 -1
- package/dist/components/molecules/DatePicker/styled.js +13 -6
- package/dist/components/molecules/DatePicker/styled.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js +15 -11
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/index.js +15 -5
- package/dist/components/molecules/DateTimePicker/index.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/DateTimeSelector.js +10 -7
- package/dist/components/molecules/DateTimeSelector/DateTimeSelector.js.map +1 -1
- package/dist/components/molecules/DateTimeSelector/index.js +9 -4
- package/dist/components/molecules/DateTimeSelector/index.js.map +1 -1
- package/dist/components/molecules/Grid/Grid.d.ts +5 -0
- package/dist/components/molecules/Grid/Grid.js +63 -0
- package/dist/components/molecules/Grid/Grid.js.map +1 -0
- package/dist/components/molecules/Grid/Item/Item.d.ts +7 -0
- package/dist/components/molecules/Grid/Item/Item.js +81 -0
- package/dist/components/molecules/Grid/Item/Item.js.map +1 -0
- package/dist/components/molecules/Grid/Item/index.d.ts +1 -0
- package/dist/components/molecules/Grid/Item/index.js +24 -0
- package/dist/components/molecules/Grid/Item/index.js.map +1 -0
- package/dist/components/molecules/Grid/index.d.ts +2 -0
- package/dist/components/molecules/Grid/index.js +24 -0
- package/dist/components/molecules/Grid/index.js.map +1 -0
- package/dist/components/molecules/IconTextButton/IconTextButton.d.ts +6 -0
- package/dist/components/molecules/IconTextButton/IconTextButton.js +53 -0
- package/dist/components/molecules/IconTextButton/IconTextButton.js.map +1 -0
- package/dist/components/molecules/IconTextButton/TextComponent.d.ts +12 -0
- package/dist/components/molecules/IconTextButton/TextComponent.js +39 -0
- package/dist/components/molecules/IconTextButton/TextComponent.js.map +1 -0
- package/dist/components/molecules/IconTextButton/index.d.ts +1 -0
- package/dist/components/molecules/IconTextButton/index.js +24 -0
- package/dist/components/molecules/IconTextButton/index.js.map +1 -0
- package/dist/components/molecules/IconTextButton/styled.d.ts +2 -0
- package/dist/components/molecules/IconTextButton/styled.js +48 -0
- package/dist/components/molecules/IconTextButton/styled.js.map +1 -0
- package/dist/components/molecules/InputPassword/InputPassword.d.ts +3 -2
- package/dist/components/molecules/InputPassword/InputPassword.js +9 -6
- package/dist/components/molecules/InputPassword/InputPassword.js.map +1 -1
- package/dist/components/molecules/InputPassword/index.js +15 -5
- package/dist/components/molecules/InputPassword/index.js.map +1 -1
- package/dist/components/molecules/LabeledSwitch/LabelComponent.d.ts +13 -0
- package/dist/components/molecules/LabeledSwitch/LabelComponent.js +41 -0
- package/dist/components/molecules/LabeledSwitch/LabelComponent.js.map +1 -0
- package/dist/components/molecules/LabeledSwitch/LabeledSwitch.d.ts +8 -0
- package/dist/components/molecules/LabeledSwitch/LabeledSwitch.js +56 -0
- package/dist/components/molecules/LabeledSwitch/LabeledSwitch.js.map +1 -0
- package/dist/components/molecules/LabeledSwitch/index.d.ts +1 -0
- package/dist/components/molecules/LabeledSwitch/index.js +24 -0
- package/dist/components/molecules/LabeledSwitch/index.js.map +1 -0
- package/dist/components/molecules/LabeledSwitch/styled.d.ts +9 -0
- package/dist/components/molecules/LabeledSwitch/styled.js +32 -0
- package/dist/components/molecules/LabeledSwitch/styled.js.map +1 -0
- package/dist/components/molecules/Select/Modal.d.ts +1 -1
- package/dist/components/molecules/Select/Modal.js +45 -39
- package/dist/components/molecules/Select/Modal.js.map +1 -1
- package/dist/components/molecules/Select/Select.js +39 -36
- package/dist/components/molecules/Select/Select.js.map +1 -1
- package/dist/components/molecules/Select/index.js +15 -5
- package/dist/components/molecules/Select/index.js.map +1 -1
- package/dist/components/molecules/Select/styled.js +78 -85
- package/dist/components/molecules/Select/styled.js.map +1 -1
- package/dist/components/molecules/Snackbar/Snackbar.js +14 -11
- package/dist/components/molecules/Snackbar/Snackbar.js.map +1 -1
- package/dist/components/molecules/Snackbar/index.js +15 -5
- package/dist/components/molecules/Snackbar/index.js.map +1 -1
- package/dist/components/molecules/Snackbar/styled.js +18 -9
- package/dist/components/molecules/Snackbar/styled.js.map +1 -1
- package/dist/index.d.ts +17 -14
- package/dist/index.js +379 -116
- package/dist/index.js.map +1 -1
- package/dist/utils/date.js +3 -1
- package/dist/utils/date.js.map +1 -1
- package/package.json +5 -5
- package/src/components/atoms/BottomNavigator/BottomNavigator.tsx +3 -6
- package/src/components/atoms/Button/Button.tsx +19 -13
- package/src/components/atoms/Button/index.ts +1 -1
- package/src/components/atoms/Input/Input.tsx +8 -6
- package/src/components/atoms/Input/styled.ts +1 -3
- package/src/components/atoms/Modal/ModalGroupManager.tsx +22 -17
- package/src/components/atoms/Modal/ModalLifecycleHandler.ts +139 -126
- package/src/components/atoms/Modal/index.ts +7 -7
- package/src/components/atoms/Modal/ui/BaseModalView.tsx +150 -127
- package/src/components/atoms/Modal/ui/styled.ts +17 -17
- package/src/components/atoms/Modal/ui/types.ts +9 -8
- package/src/components/atoms/Modal/useLazyModalManager.ts +32 -31
- package/src/components/atoms/Modal/useModalManager.ts +28 -26
- package/src/components/atoms/Modal/useModalRemoteControl.ts +16 -18
- package/src/components/molecules/Calendar/Calendar.tsx +5 -1
- package/src/components/molecules/DatePicker/DatePicker.tsx +26 -17
- package/src/components/molecules/DatePicker/styled.ts +4 -4
- package/src/components/molecules/DateTimePicker/DateTimePicker.tsx +18 -16
- package/src/components/molecules/DateTimeSelector/DateTimeSelector.tsx +4 -1
- package/src/components/molecules/Grid/Grid.tsx +68 -0
- package/src/components/molecules/Grid/Item/Item.tsx +77 -0
- package/src/components/molecules/Grid/Item/index.ts +1 -0
- package/src/components/molecules/Grid/index.ts +2 -0
- package/src/components/molecules/IconTextButton/IconTextButton.tsx +55 -0
- package/src/components/molecules/IconTextButton/TextComponent.tsx +43 -0
- package/src/components/molecules/IconTextButton/index.ts +4 -0
- package/src/components/molecules/IconTextButton/styled.ts +35 -0
- package/src/components/molecules/InputPassword/InputPassword.tsx +3 -2
- package/src/components/molecules/LabeledSwitch/LabelComponent.tsx +46 -0
- package/src/components/molecules/LabeledSwitch/LabeledSwitch.tsx +59 -0
- package/src/components/molecules/LabeledSwitch/index.ts +4 -0
- package/src/components/molecules/LabeledSwitch/styled.ts +27 -0
- package/src/components/molecules/Select/Modal.tsx +88 -66
- package/src/components/molecules/Select/Select.tsx +1 -1
- package/src/index.ts +38 -29
|
@@ -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<
|
|
11
|
+
export type NativeDateTimePickerProps = Omit<
|
|
12
|
+
DateTimePickerProps,
|
|
13
|
+
| 'DateTimeSelectorComponent'
|
|
14
|
+
| 'renderSelector'
|
|
15
|
+
| 'requestCloseSelector'
|
|
16
|
+
| 'requestShowSelector'
|
|
17
|
+
>;
|
|
12
18
|
|
|
13
|
-
export const DateTimePicker: FC<NativeDateTimePickerProps> = ({
|
|
14
|
-
|
|
15
|
-
|
|
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) =>
|
|
26
|
-
<NativeModal onClose={blur}>
|
|
27
|
-
|
|
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
|
-
|
|
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> = ({
|
|
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,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,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, {
|
|
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
|
|
8
|
+
const InputPassword = React.forwardRef<TextInput, InputPasswordNativeProps>(
|
|
8
9
|
({ rightComponent, ...rest }, ref) => {
|
|
9
10
|
const [revealed, setRevealed] = useState(false);
|
|
10
11
|
return (
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FontColor,
|
|
3
|
+
FontWeight,
|
|
4
|
+
LabelPositionOptions,
|
|
5
|
+
} from '@tecsinapse/react-core';
|
|
6
|
+
import React, { FC } from 'react';
|
|
7
|
+
import { Pressable, PressableProps } from 'react-native';
|
|
8
|
+
import { TextNativeProps } from '../../atoms/Text';
|
|
9
|
+
import { StyledLabel } from './styled';
|
|
10
|
+
|
|
11
|
+
export interface LabelComponentProps extends PressableProps {
|
|
12
|
+
label: string;
|
|
13
|
+
labelPosition: LabelPositionOptions;
|
|
14
|
+
labelProps?: TextNativeProps;
|
|
15
|
+
active: boolean;
|
|
16
|
+
switchDisabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const LabelComponent: FC<LabelComponentProps> = ({
|
|
20
|
+
label,
|
|
21
|
+
labelPosition,
|
|
22
|
+
labelProps,
|
|
23
|
+
active,
|
|
24
|
+
switchDisabled = false,
|
|
25
|
+
...rest
|
|
26
|
+
}) => {
|
|
27
|
+
const defaultFontColor: keyof FontColor =
|
|
28
|
+
active && !switchDisabled ? 'dark' : 'medium';
|
|
29
|
+
const defaultFontWeight: keyof FontWeight =
|
|
30
|
+
active && !switchDisabled ? 'bold' : 'regular';
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Pressable {...rest}>
|
|
34
|
+
<StyledLabel
|
|
35
|
+
labelPosition={labelPosition}
|
|
36
|
+
fontColor={labelProps?.fontColor ?? defaultFontColor}
|
|
37
|
+
fontWeight={labelProps?.fontWeight ?? defaultFontWeight}
|
|
38
|
+
{...labelProps}
|
|
39
|
+
>
|
|
40
|
+
{label}
|
|
41
|
+
</StyledLabel>
|
|
42
|
+
</Pressable>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default React.memo(LabelComponent);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LabeledSwitchProps, Switch } from '@tecsinapse/react-core';
|
|
2
|
+
import React, { FC } from 'react';
|
|
3
|
+
import { TextNativeProps } from '../../atoms/Text';
|
|
4
|
+
import LabelComponent from './LabelComponent';
|
|
5
|
+
import { StyledView } from './styled';
|
|
6
|
+
|
|
7
|
+
export type LabeledSwitchNativeProps = LabeledSwitchProps & {
|
|
8
|
+
labelProps?: TextNativeProps;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const LabeledSwitch: FC<LabeledSwitchNativeProps> = ({
|
|
12
|
+
label,
|
|
13
|
+
labelPosition = 'right',
|
|
14
|
+
labelProps,
|
|
15
|
+
pressableLabel = false,
|
|
16
|
+
active,
|
|
17
|
+
disabled,
|
|
18
|
+
onChange,
|
|
19
|
+
...rest
|
|
20
|
+
}) => {
|
|
21
|
+
return (
|
|
22
|
+
<StyledView>
|
|
23
|
+
{labelPosition === 'left' ? (
|
|
24
|
+
<LabelComponent
|
|
25
|
+
active={active}
|
|
26
|
+
label={label}
|
|
27
|
+
labelPosition={'left'}
|
|
28
|
+
labelProps={labelProps}
|
|
29
|
+
disabled={!pressableLabel || disabled}
|
|
30
|
+
switchDisabled={disabled}
|
|
31
|
+
onPress={() => onChange(!active)}
|
|
32
|
+
/>
|
|
33
|
+
) : (
|
|
34
|
+
<></>
|
|
35
|
+
)}
|
|
36
|
+
<Switch
|
|
37
|
+
active={active}
|
|
38
|
+
onChange={onChange}
|
|
39
|
+
disabled={disabled}
|
|
40
|
+
{...rest}
|
|
41
|
+
/>
|
|
42
|
+
{labelPosition === 'right' ? (
|
|
43
|
+
<LabelComponent
|
|
44
|
+
active={active}
|
|
45
|
+
label={label}
|
|
46
|
+
labelPosition={'right'}
|
|
47
|
+
labelProps={labelProps}
|
|
48
|
+
disabled={!pressableLabel || disabled}
|
|
49
|
+
switchDisabled={disabled}
|
|
50
|
+
onPress={() => onChange(!active)}
|
|
51
|
+
/>
|
|
52
|
+
) : (
|
|
53
|
+
<></>
|
|
54
|
+
)}
|
|
55
|
+
</StyledView>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default LabeledSwitch;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import styled, { css } from '@emotion/native';
|
|
2
|
+
import { LabelPositionOptions, StyleProps } from '@tecsinapse/react-core';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { Text } from '../../atoms/Text';
|
|
5
|
+
|
|
6
|
+
export const StyledView = styled(View)`
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
align-items: center;
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
export const StyledLabel = styled(Text)<
|
|
13
|
+
Partial<StyleProps> & {
|
|
14
|
+
labelPosition: LabelPositionOptions;
|
|
15
|
+
}
|
|
16
|
+
>`
|
|
17
|
+
${({ theme, labelPosition }) => {
|
|
18
|
+
if (labelPosition === 'right')
|
|
19
|
+
return css`
|
|
20
|
+
margin-left: ${theme?.spacing.centi};
|
|
21
|
+
`;
|
|
22
|
+
else if (labelPosition === 'left')
|
|
23
|
+
return css`
|
|
24
|
+
margin-right: ${theme?.spacing.centi};
|
|
25
|
+
`;
|
|
26
|
+
}}
|
|
27
|
+
`;
|