@cdek-it/react-native-ui-kit 0.2.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/LICENSE +21 -0
- package/README.md +151 -0
- package/dist/components/Accordion/Accordion.d.ts +39 -0
- package/dist/components/Accordion/Accordion.js +103 -0
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/Accordion/index.js +1 -0
- package/dist/components/Avatar/Avatar.d.ts +96 -0
- package/dist/components/Avatar/Avatar.js +121 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Avatar/index.js +1 -0
- package/dist/components/Badge/Badge.d.ts +35 -0
- package/dist/components/Badge/Badge.js +74 -0
- package/dist/components/Badge/index.d.ts +1 -0
- package/dist/components/Badge/index.js +1 -0
- package/dist/components/Button/BaseButton.d.ts +5 -0
- package/dist/components/Button/BaseButton.js +62 -0
- package/dist/components/Button/Button.d.ts +16 -0
- package/dist/components/Button/Button.js +21 -0
- package/dist/components/Button/ButtonBadge.d.ts +21 -0
- package/dist/components/Button/ButtonBadge.js +53 -0
- package/dist/components/Button/ButtonSeverity.d.ts +17 -0
- package/dist/components/Button/ButtonSeverity.js +22 -0
- package/dist/components/Button/index.d.ts +4 -0
- package/dist/components/Button/index.js +3 -0
- package/dist/components/Button/styles/index.d.ts +2 -0
- package/dist/components/Button/styles/index.js +2 -0
- package/dist/components/Button/styles/useBasicButtonStyles.d.ts +98 -0
- package/dist/components/Button/styles/useBasicButtonStyles.js +81 -0
- package/dist/components/Button/styles/useDangerButtonStyles.d.ts +63 -0
- package/dist/components/Button/styles/useDangerButtonStyles.js +57 -0
- package/dist/components/Button/styles/useInfoButtonStyles.d.ts +63 -0
- package/dist/components/Button/styles/useInfoButtonStyles.js +56 -0
- package/dist/components/Button/styles/useSeverityButtonStyles.d.ts +64 -0
- package/dist/components/Button/styles/useSeverityButtonStyles.js +29 -0
- package/dist/components/Button/styles/useSuccessButtonStyles.d.ts +63 -0
- package/dist/components/Button/styles/useSuccessButtonStyles.js +61 -0
- package/dist/components/Button/styles/useWarningButtonStyles.d.ts +63 -0
- package/dist/components/Button/styles/useWarningButtonStyles.js +61 -0
- package/dist/components/Button/types.d.ts +107 -0
- package/dist/components/Button/types.js +0 -0
- package/dist/components/Button/utils/ButtonActivityIndicator.d.ts +3 -0
- package/dist/components/Button/utils/ButtonActivityIndicator.js +17 -0
- package/dist/components/Button/utils/ButtonContainer.d.ts +7 -0
- package/dist/components/Button/utils/ButtonContainer.js +10 -0
- package/dist/components/Button/utils/ButtonIcon.d.ts +4 -0
- package/dist/components/Button/utils/ButtonIcon.js +11 -0
- package/dist/components/Button/utils/ButtonLabel.d.ts +4 -0
- package/dist/components/Button/utils/ButtonLabel.js +13 -0
- package/dist/components/Button/utils/ButtonLeftArea.d.ts +4 -0
- package/dist/components/Button/utils/ButtonLeftArea.js +13 -0
- package/dist/components/Button/utils/ButtonRightArea.d.ts +3 -0
- package/dist/components/Button/utils/ButtonRightArea.js +13 -0
- package/dist/components/Button/utils/index.d.ts +4 -0
- package/dist/components/Button/utils/index.js +4 -0
- package/dist/components/Button/utils/useButtonContainerCallbackStyle.d.ts +3 -0
- package/dist/components/Button/utils/useButtonContainerCallbackStyle.js +141 -0
- package/dist/components/Button/utils/useButtonLabelStyle.d.ts +3 -0
- package/dist/components/Button/utils/useButtonLabelStyle.js +40 -0
- package/dist/components/Button/utils/useIconStyle.d.ts +7 -0
- package/dist/components/Button/utils/useIconStyle.js +35 -0
- package/dist/components/Button/utils/useTypeBasedStyle.d.ts +2 -0
- package/dist/components/Button/utils/useTypeBasedStyle.js +4 -0
- package/dist/components/Checkbox/Checkbox.d.ts +31 -0
- package/dist/components/Checkbox/Checkbox.js +55 -0
- package/dist/components/Checkbox/hooks/usePressableStyles.d.ts +15 -0
- package/dist/components/Checkbox/hooks/usePressableStyles.js +91 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.js +1 -0
- package/dist/components/Chip/Chip.d.ts +30 -0
- package/dist/components/Chip/Chip.js +70 -0
- package/dist/components/Chip/index.d.ts +1 -0
- package/dist/components/Chip/index.js +1 -0
- package/dist/components/Dialog/Dialog.d.ts +14 -0
- package/dist/components/Dialog/Dialog.js +96 -0
- package/dist/components/Dialog/DialogComponent.d.ts +7 -0
- package/dist/components/Dialog/DialogComponent.js +34 -0
- package/dist/components/Dialog/DialogHeader.d.ts +12 -0
- package/dist/components/Dialog/DialogHeader.js +68 -0
- package/dist/components/Dialog/index.d.ts +3 -0
- package/dist/components/Dialog/index.js +3 -0
- package/dist/components/Divider/Divider.d.ts +42 -0
- package/dist/components/Divider/Divider.js +95 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/Divider/index.js +1 -0
- package/dist/components/Input/FloatLabel.d.ts +22 -0
- package/dist/components/Input/FloatLabel.js +19 -0
- package/dist/components/Input/InputGroup.d.ts +21 -0
- package/dist/components/Input/InputGroup.js +52 -0
- package/dist/components/Input/InputGroupAddon.d.ts +17 -0
- package/dist/components/Input/InputGroupAddon.js +57 -0
- package/dist/components/Input/InputSwitch/InputSwitch.d.ts +8 -0
- package/dist/components/Input/InputSwitch/InputSwitch.js +16 -0
- package/dist/components/Input/InputSwitch/index.d.ts +1 -0
- package/dist/components/Input/InputSwitch/index.js +1 -0
- package/dist/components/Input/InputSwitch/styles/index.d.ts +2 -0
- package/dist/components/Input/InputSwitch/styles/index.js +2 -0
- package/dist/components/Input/InputSwitch/styles/useHandleStyles.d.ts +13 -0
- package/dist/components/Input/InputSwitch/styles/useHandleStyles.js +47 -0
- package/dist/components/Input/InputSwitch/styles/useSliderStyles.d.ts +17 -0
- package/dist/components/Input/InputSwitch/styles/useSliderStyles.js +95 -0
- package/dist/components/Input/InputText.d.ts +13 -0
- package/dist/components/Input/InputText.js +14 -0
- package/dist/components/Input/InputTextBase/InputTextBase.d.ts +13 -0
- package/dist/components/Input/InputTextBase/InputTextBase.js +124 -0
- package/dist/components/Input/InputTextBase/testIds.d.ts +11 -0
- package/dist/components/Input/InputTextBase/testIds.js +11 -0
- package/dist/components/Input/InputTextBase/types.d.ts +41 -0
- package/dist/components/Input/InputTextBase/types.js +0 -0
- package/dist/components/Input/InputTextBase/useStyles.d.ts +86 -0
- package/dist/components/Input/InputTextBase/useStyles.js +78 -0
- package/dist/components/Input/index.d.ts +5 -0
- package/dist/components/Input/index.js +4 -0
- package/dist/components/List/Base/ListBase.d.ts +32 -0
- package/dist/components/List/Base/ListBase.js +88 -0
- package/dist/components/List/Base/index.d.ts +1 -0
- package/dist/components/List/Base/index.js +1 -0
- package/dist/components/MenuItem/MenuItemAccessory.d.ts +11 -0
- package/dist/components/MenuItem/MenuItemAccessory.js +23 -0
- package/dist/components/MenuItem/MenuItemIcon.d.ts +36 -0
- package/dist/components/MenuItem/MenuItemIcon.js +33 -0
- package/dist/components/MenuItem/Template/MenuItemTemplate.d.ts +42 -0
- package/dist/components/MenuItem/Template/MenuItemTemplate.js +79 -0
- package/dist/components/MenuItem/index.d.ts +1 -0
- package/dist/components/MenuItem/index.js +1 -0
- package/dist/components/Message/Message.d.ts +65 -0
- package/dist/components/Message/Message.js +126 -0
- package/dist/components/Message/index.d.ts +1 -0
- package/dist/components/Message/index.js +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +33 -0
- package/dist/components/ProgressBar/ProgressBar.js +62 -0
- package/dist/components/ProgressBar/index.d.ts +1 -0
- package/dist/components/ProgressBar/index.js +1 -0
- package/dist/components/ProgressSpinner/ProgressSpinner.d.ts +17 -0
- package/dist/components/ProgressSpinner/ProgressSpinner.js +68 -0
- package/dist/components/ProgressSpinner/index.d.ts +1 -0
- package/dist/components/ProgressSpinner/index.js +1 -0
- package/dist/components/RadioButton/RadioButton.d.ts +18 -0
- package/dist/components/RadioButton/RadioButton.js +134 -0
- package/dist/components/RadioButton/index.d.ts +1 -0
- package/dist/components/RadioButton/index.js +1 -0
- package/dist/components/Rating/Rating.d.ts +48 -0
- package/dist/components/Rating/Rating.js +37 -0
- package/dist/components/Rating/RatingClear.d.ts +14 -0
- package/dist/components/Rating/RatingClear.js +28 -0
- package/dist/components/Rating/RatingItem.d.ts +19 -0
- package/dist/components/Rating/RatingItem.js +44 -0
- package/dist/components/Rating/RatingItemContainer.d.ts +37 -0
- package/dist/components/Rating/RatingItemContainer.js +30 -0
- package/dist/components/Rating/index.d.ts +1 -0
- package/dist/components/Rating/index.js +1 -0
- package/dist/components/SelectButton/SelectButton.d.ts +32 -0
- package/dist/components/SelectButton/SelectButton.js +75 -0
- package/dist/components/SelectButton/SelectButtonItem.d.ts +35 -0
- package/dist/components/SelectButton/SelectButtonItem.js +133 -0
- package/dist/components/SelectButton/index.d.ts +1 -0
- package/dist/components/SelectButton/index.js +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +15 -0
- package/dist/components/Skeleton/Skeleton.js +53 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Skeleton/index.js +1 -0
- package/dist/components/Slider/Slider.d.ts +36 -0
- package/dist/components/Slider/Slider.js +153 -0
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.js +1 -0
- package/dist/components/Tabs/TabItem/TabItem.d.ts +24 -0
- package/dist/components/Tabs/TabItem/TabItem.js +82 -0
- package/dist/components/Tabs/TabItem/index.d.ts +1 -0
- package/dist/components/Tabs/TabItem/index.js +1 -0
- package/dist/components/Tabs/TabPanel/TabPanel.d.ts +9 -0
- package/dist/components/Tabs/TabPanel/TabPanel.js +11 -0
- package/dist/components/Tabs/TabPanel/index.d.ts +1 -0
- package/dist/components/Tabs/TabPanel/index.js +1 -0
- package/dist/components/Tabs/Tabs.d.ts +15 -0
- package/dist/components/Tabs/Tabs.js +48 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Tag/Tag.d.ts +33 -0
- package/dist/components/Tag/Tag.js +71 -0
- package/dist/components/Tag/index.d.ts +1 -0
- package/dist/components/Tag/index.js +1 -0
- package/dist/components/Timer/Timer.d.ts +18 -0
- package/dist/components/Timer/Timer.js +74 -0
- package/dist/components/Timer/TimerFlip.d.ts +7 -0
- package/dist/components/Timer/TimerFlip.js +69 -0
- package/dist/components/Timer/constants.d.ts +1 -0
- package/dist/components/Timer/constants.js +1 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +45 -0
- package/dist/components/ToggleButton/ToggleButton.js +85 -0
- package/dist/components/ToggleButton/hooks/useIconSize.d.ts +14 -0
- package/dist/components/ToggleButton/hooks/useIconSize.js +26 -0
- package/dist/components/ToggleButton/hooks/useLabelSize.d.ts +8 -0
- package/dist/components/ToggleButton/hooks/useLabelSize.js +19 -0
- package/dist/components/ToggleButton/hooks/useStateStyles.d.ts +11 -0
- package/dist/components/ToggleButton/hooks/useStateStyles.js +92 -0
- package/dist/components/ToggleButton/index.d.ts +1 -0
- package/dist/components/ToggleButton/index.js +1 -0
- package/dist/components/Typography/Anchor.d.ts +31 -0
- package/dist/components/Typography/Anchor.js +75 -0
- package/dist/components/Typography/Body.d.ts +9 -0
- package/dist/components/Typography/Body.js +32 -0
- package/dist/components/Typography/Caption.d.ts +9 -0
- package/dist/components/Typography/Caption.js +38 -0
- package/dist/components/Typography/Service.d.ts +25 -0
- package/dist/components/Typography/Service.js +63 -0
- package/dist/components/Typography/Subtitle.d.ts +18 -0
- package/dist/components/Typography/Subtitle.js +23 -0
- package/dist/components/Typography/Title.d.ts +5 -0
- package/dist/components/Typography/Title.js +24 -0
- package/dist/components/Typography/index.d.ts +6 -0
- package/dist/components/Typography/index.js +6 -0
- package/dist/components/index.d.ts +23 -0
- package/dist/components/index.js +23 -0
- package/dist/hooks/useChangeTheme.d.ts +1 -0
- package/dist/hooks/useChangeTheme.js +5 -0
- package/dist/hooks/useFonts.d.ts +1 -0
- package/dist/hooks/useFonts.js +5 -0
- package/dist/hooks/useLoadingRotationAnimation.d.ts +5 -0
- package/dist/hooks/useLoadingRotationAnimation.js +19 -0
- package/dist/hooks/useMakeTestId.d.ts +3 -0
- package/dist/hooks/useMakeTestId.js +7 -0
- package/dist/hooks/useTheme.d.ts +1 -0
- package/dist/hooks/useTheme.js +5 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/theme/ThemeContext.d.ts +15 -0
- package/dist/theme/ThemeContext.js +20 -0
- package/dist/theme/assets/background.json +149 -0
- package/dist/theme/assets/border.json +103 -0
- package/dist/theme/assets/customCommon.d.ts +4 -0
- package/dist/theme/assets/customCommon.js +4 -0
- package/dist/theme/assets/customDark.d.ts +5 -0
- package/dist/theme/assets/customDark.js +15 -0
- package/dist/theme/assets/customLight.d.ts +15 -0
- package/dist/theme/assets/customLight.js +15 -0
- package/dist/theme/assets/effects.json +15 -0
- package/dist/theme/assets/global.json +114 -0
- package/dist/theme/assets/primaryColors.json +14 -0
- package/dist/theme/assets/shadow.d.ts +6 -0
- package/dist/theme/assets/shadow.js +6 -0
- package/dist/theme/assets/sizing.json +78 -0
- package/dist/theme/assets/spacing.json +48 -0
- package/dist/theme/assets/themeDark.json +1141 -0
- package/dist/theme/assets/themeLight.json +1141 -0
- package/dist/theme/assets/typography.json +45 -0
- package/dist/theme/commonTheme.d.ts +582 -0
- package/dist/theme/commonTheme.js +22 -0
- package/dist/theme/darkTheme.d.ts +2 -0
- package/dist/theme/darkTheme.js +7 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.js +4 -0
- package/dist/theme/lightTheme.d.ts +2 -0
- package/dist/theme/lightTheme.js +7 -0
- package/dist/theme/types.d.ts +40 -0
- package/dist/theme/types.js +5 -0
- package/dist/utils/SvgUniversal.d.ts +29 -0
- package/dist/utils/SvgUniversal.js +28 -0
- package/dist/utils/genericMemo.d.ts +1 -0
- package/dist/utils/genericMemo.js +2 -0
- package/dist/utils/makeStyles.d.ts +11 -0
- package/dist/utils/makeStyles.js +19 -0
- package/package.json +159 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ButtonSeverityProps } from '../types';
|
|
2
|
+
export declare const useSeverityButtonStyles: (severity: ButtonSeverityProps["severity"]) => {
|
|
3
|
+
containerVariantStyles: {
|
|
4
|
+
basic: {
|
|
5
|
+
borderColor: string;
|
|
6
|
+
backgroundColor: string;
|
|
7
|
+
};
|
|
8
|
+
outlined: {
|
|
9
|
+
borderColor: string;
|
|
10
|
+
backgroundColor: string;
|
|
11
|
+
};
|
|
12
|
+
text: {
|
|
13
|
+
borderColor: string;
|
|
14
|
+
backgroundColor: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
labelVariantStyles: {
|
|
18
|
+
basic: {
|
|
19
|
+
color: string;
|
|
20
|
+
};
|
|
21
|
+
outlined: {
|
|
22
|
+
color: string;
|
|
23
|
+
};
|
|
24
|
+
text: {
|
|
25
|
+
color: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
pressedVariantStyles: {
|
|
29
|
+
basic: {
|
|
30
|
+
borderColor: string;
|
|
31
|
+
backgroundColor: string;
|
|
32
|
+
};
|
|
33
|
+
outlined: {
|
|
34
|
+
borderColor: string;
|
|
35
|
+
backgroundColor: string;
|
|
36
|
+
};
|
|
37
|
+
text: {
|
|
38
|
+
borderColor: string;
|
|
39
|
+
backgroundColor: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
iconVariantStyles: {
|
|
43
|
+
basic: {
|
|
44
|
+
color: string;
|
|
45
|
+
};
|
|
46
|
+
outlined: {
|
|
47
|
+
color: string;
|
|
48
|
+
};
|
|
49
|
+
text: {
|
|
50
|
+
color: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
pressedLabelVariantStyles: {
|
|
54
|
+
basic: {
|
|
55
|
+
color: string;
|
|
56
|
+
};
|
|
57
|
+
outlined: {
|
|
58
|
+
color: string;
|
|
59
|
+
};
|
|
60
|
+
text: {
|
|
61
|
+
color: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useDangerButtonStyles } from './useDangerButtonStyles';
|
|
3
|
+
import { useInfoButtonStyles } from './useInfoButtonStyles';
|
|
4
|
+
import { useSuccessButtonStyles } from './useSuccessButtonStyles';
|
|
5
|
+
import { useWarningButtonStyles } from './useWarningButtonStyles';
|
|
6
|
+
export const useSeverityButtonStyles = (severity) => {
|
|
7
|
+
const dangerButtonStyles = useDangerButtonStyles();
|
|
8
|
+
const warningButtonStyles = useWarningButtonStyles();
|
|
9
|
+
const infoButtonStyles = useInfoButtonStyles();
|
|
10
|
+
const successButtonStyles = useSuccessButtonStyles();
|
|
11
|
+
return useMemo(() => {
|
|
12
|
+
switch (severity) {
|
|
13
|
+
case 'danger':
|
|
14
|
+
return dangerButtonStyles;
|
|
15
|
+
case 'warning':
|
|
16
|
+
return warningButtonStyles;
|
|
17
|
+
case 'info':
|
|
18
|
+
return infoButtonStyles;
|
|
19
|
+
case 'success':
|
|
20
|
+
return successButtonStyles;
|
|
21
|
+
}
|
|
22
|
+
}, [
|
|
23
|
+
dangerButtonStyles,
|
|
24
|
+
infoButtonStyles,
|
|
25
|
+
severity,
|
|
26
|
+
successButtonStyles,
|
|
27
|
+
warningButtonStyles,
|
|
28
|
+
]);
|
|
29
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare const useSuccessButtonStyles: () => {
|
|
2
|
+
containerVariantStyles: {
|
|
3
|
+
basic: {
|
|
4
|
+
borderColor: string;
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
};
|
|
7
|
+
outlined: {
|
|
8
|
+
borderColor: string;
|
|
9
|
+
backgroundColor: string;
|
|
10
|
+
};
|
|
11
|
+
text: {
|
|
12
|
+
borderColor: string;
|
|
13
|
+
backgroundColor: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
labelVariantStyles: {
|
|
17
|
+
basic: {
|
|
18
|
+
color: string;
|
|
19
|
+
};
|
|
20
|
+
outlined: {
|
|
21
|
+
color: string;
|
|
22
|
+
};
|
|
23
|
+
text: {
|
|
24
|
+
color: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
pressedVariantStyles: {
|
|
28
|
+
basic: {
|
|
29
|
+
borderColor: string;
|
|
30
|
+
backgroundColor: string;
|
|
31
|
+
};
|
|
32
|
+
outlined: {
|
|
33
|
+
borderColor: string;
|
|
34
|
+
backgroundColor: string;
|
|
35
|
+
};
|
|
36
|
+
text: {
|
|
37
|
+
borderColor: string;
|
|
38
|
+
backgroundColor: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
iconVariantStyles: {
|
|
42
|
+
basic: {
|
|
43
|
+
color: string;
|
|
44
|
+
};
|
|
45
|
+
outlined: {
|
|
46
|
+
color: string;
|
|
47
|
+
};
|
|
48
|
+
text: {
|
|
49
|
+
color: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
pressedLabelVariantStyles: {
|
|
53
|
+
basic: {
|
|
54
|
+
color: string;
|
|
55
|
+
};
|
|
56
|
+
outlined: {
|
|
57
|
+
color: string;
|
|
58
|
+
};
|
|
59
|
+
text: {
|
|
60
|
+
color: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { makeStyles } from '../../../utils/makeStyles';
|
|
2
|
+
export const useSuccessButtonStyles = () => {
|
|
3
|
+
const labelVariantStyles = useLabelVariantStyles();
|
|
4
|
+
const pressedVariantStyles = usePressedVariantStyles();
|
|
5
|
+
const containerVariantStyles = useContainerVariantStyles();
|
|
6
|
+
const iconVariantStyles = useIconVariantStyles();
|
|
7
|
+
return {
|
|
8
|
+
containerVariantStyles,
|
|
9
|
+
labelVariantStyles,
|
|
10
|
+
pressedVariantStyles,
|
|
11
|
+
iconVariantStyles,
|
|
12
|
+
pressedLabelVariantStyles: labelVariantStyles,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
const useLabelVariantStyles = makeStyles(({ theme }) => ({
|
|
16
|
+
basic: { color: theme.Button.Severity.Success.Basic.successButtonTextColor },
|
|
17
|
+
outlined: {
|
|
18
|
+
color: theme.Button.Severity.Success.Outlined.successOutlinedButtonTextColor,
|
|
19
|
+
},
|
|
20
|
+
text: {
|
|
21
|
+
color: theme.Button.Severity.Success.Text.successTextButtonTextColor,
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
const usePressedVariantStyles = makeStyles(({ theme }) => ({
|
|
25
|
+
basic: {
|
|
26
|
+
borderColor: theme.Button.Severity.Success.Basic.successButtonBorderColor,
|
|
27
|
+
backgroundColor: theme.Button.Severity.Success.Basic.successButtonHoverBg,
|
|
28
|
+
},
|
|
29
|
+
outlined: {
|
|
30
|
+
borderColor: theme.Button.Severity.Success.Outlined
|
|
31
|
+
.successOutlinedButtonHoverBorderColor,
|
|
32
|
+
backgroundColor: theme.Button.Severity.Success.Outlined.successOutlinedButtonHoverBg,
|
|
33
|
+
},
|
|
34
|
+
text: {
|
|
35
|
+
borderColor: theme.Surface['surface-transparent'],
|
|
36
|
+
backgroundColor: theme.Button.Severity.Success.Text.successTextButtonHoverBg,
|
|
37
|
+
},
|
|
38
|
+
}));
|
|
39
|
+
const useContainerVariantStyles = makeStyles(({ theme }) => ({
|
|
40
|
+
basic: {
|
|
41
|
+
borderColor: theme.Button.Severity.Success.Basic.successButtonBorderColor,
|
|
42
|
+
backgroundColor: theme.Button.Severity.Success.Basic.successButtonBg,
|
|
43
|
+
},
|
|
44
|
+
outlined: {
|
|
45
|
+
borderColor: theme.Button.Severity.Success.Outlined.successOutlinedButtonBorderColor,
|
|
46
|
+
backgroundColor: theme.Button.Severity.Success.Outlined.successOutlinedButtonBg,
|
|
47
|
+
},
|
|
48
|
+
text: {
|
|
49
|
+
borderColor: theme.Button.Severity.Success.Basic.successButtonBorderColor,
|
|
50
|
+
backgroundColor: theme.Button.Severity.Success.Text.successTextButtonBg,
|
|
51
|
+
},
|
|
52
|
+
}));
|
|
53
|
+
const useIconVariantStyles = makeStyles(({ theme }) => ({
|
|
54
|
+
basic: { color: theme.Button.Severity.Success.Basic.successButtonTextColor },
|
|
55
|
+
outlined: {
|
|
56
|
+
color: theme.Button.Severity.Success.Outlined.successOutlinedButtonTextColor,
|
|
57
|
+
},
|
|
58
|
+
text: {
|
|
59
|
+
color: theme.Button.Severity.Success.Text.successTextButtonTextColor,
|
|
60
|
+
},
|
|
61
|
+
}));
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare const useWarningButtonStyles: () => {
|
|
2
|
+
containerVariantStyles: {
|
|
3
|
+
basic: {
|
|
4
|
+
borderColor: string;
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
};
|
|
7
|
+
outlined: {
|
|
8
|
+
borderColor: string;
|
|
9
|
+
backgroundColor: string;
|
|
10
|
+
};
|
|
11
|
+
text: {
|
|
12
|
+
borderColor: string;
|
|
13
|
+
backgroundColor: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
labelVariantStyles: {
|
|
17
|
+
basic: {
|
|
18
|
+
color: string;
|
|
19
|
+
};
|
|
20
|
+
outlined: {
|
|
21
|
+
color: string;
|
|
22
|
+
};
|
|
23
|
+
text: {
|
|
24
|
+
color: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
pressedVariantStyles: {
|
|
28
|
+
basic: {
|
|
29
|
+
borderColor: string;
|
|
30
|
+
backgroundColor: string;
|
|
31
|
+
};
|
|
32
|
+
outlined: {
|
|
33
|
+
borderColor: string;
|
|
34
|
+
backgroundColor: string;
|
|
35
|
+
};
|
|
36
|
+
text: {
|
|
37
|
+
borderColor: string;
|
|
38
|
+
backgroundColor: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
iconVariantStyles: {
|
|
42
|
+
basic: {
|
|
43
|
+
color: string;
|
|
44
|
+
};
|
|
45
|
+
outlined: {
|
|
46
|
+
color: string;
|
|
47
|
+
};
|
|
48
|
+
text: {
|
|
49
|
+
color: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
pressedLabelVariantStyles: {
|
|
53
|
+
basic: {
|
|
54
|
+
color: string;
|
|
55
|
+
};
|
|
56
|
+
outlined: {
|
|
57
|
+
color: string;
|
|
58
|
+
};
|
|
59
|
+
text: {
|
|
60
|
+
color: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { makeStyles } from '../../../utils/makeStyles';
|
|
2
|
+
export const useWarningButtonStyles = () => {
|
|
3
|
+
const labelVariantStyles = useLabelVariantStyles();
|
|
4
|
+
const pressedVariantStyles = usePressedVariantStyles();
|
|
5
|
+
const containerVariantStyles = useContainerVariantStyles();
|
|
6
|
+
const iconVariantStyles = useIconVariantStyles();
|
|
7
|
+
return {
|
|
8
|
+
containerVariantStyles,
|
|
9
|
+
labelVariantStyles,
|
|
10
|
+
pressedVariantStyles,
|
|
11
|
+
iconVariantStyles,
|
|
12
|
+
pressedLabelVariantStyles: labelVariantStyles,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
const useLabelVariantStyles = makeStyles(({ theme }) => ({
|
|
16
|
+
basic: { color: theme.Button.Severity.Warning.Basic.warningButtonTextColor },
|
|
17
|
+
outlined: {
|
|
18
|
+
color: theme.Button.Severity.Warning.Outlined.warningOutlinedButtonTextColor,
|
|
19
|
+
},
|
|
20
|
+
text: {
|
|
21
|
+
color: theme.Button.Severity.Warning.Text.warningTextButtonTextColor,
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
const usePressedVariantStyles = makeStyles(({ theme }) => ({
|
|
25
|
+
basic: {
|
|
26
|
+
borderColor: theme.Button.Severity.Warning.Basic.warningButtonBorderColor,
|
|
27
|
+
backgroundColor: theme.Button.Severity.Warning.Basic.warningButtonHoverBg,
|
|
28
|
+
},
|
|
29
|
+
outlined: {
|
|
30
|
+
borderColor: theme.Button.Severity.Warning.Outlined
|
|
31
|
+
.warningOutlinedButtonHoverBorderColor,
|
|
32
|
+
backgroundColor: theme.Button.Severity.Warning.Outlined.warningOutlinedButtonHoverBg,
|
|
33
|
+
},
|
|
34
|
+
text: {
|
|
35
|
+
borderColor: theme.Surface['surface-transparent'],
|
|
36
|
+
backgroundColor: theme.Button.Severity.Warning.Text.warningTextButtonHoverBg,
|
|
37
|
+
},
|
|
38
|
+
}));
|
|
39
|
+
const useContainerVariantStyles = makeStyles(({ theme }) => ({
|
|
40
|
+
basic: {
|
|
41
|
+
borderColor: theme.Button.Severity.Warning.Basic.warningButtonBorderColor,
|
|
42
|
+
backgroundColor: theme.Button.Severity.Warning.Basic.warningButtonBg,
|
|
43
|
+
},
|
|
44
|
+
outlined: {
|
|
45
|
+
borderColor: theme.Button.Severity.Warning.Outlined.warningOutlinedButtonBorderColor,
|
|
46
|
+
backgroundColor: theme.Button.Severity.Warning.Outlined.warningOutlinedButtonBg,
|
|
47
|
+
},
|
|
48
|
+
text: {
|
|
49
|
+
borderColor: theme.Button.Severity.Warning.Basic.warningButtonBorderColor,
|
|
50
|
+
backgroundColor: theme.Button.Severity.Warning.Text.warningTextButtonBg,
|
|
51
|
+
},
|
|
52
|
+
}));
|
|
53
|
+
const useIconVariantStyles = makeStyles(({ theme }) => ({
|
|
54
|
+
basic: { color: theme.Button.Severity.Warning.Basic.warningButtonTextColor },
|
|
55
|
+
outlined: {
|
|
56
|
+
color: theme.Button.Severity.Warning.Outlined.warningOutlinedButtonTextColor,
|
|
57
|
+
},
|
|
58
|
+
text: {
|
|
59
|
+
color: theme.Button.Severity.Warning.Text.warningTextButtonTextColor,
|
|
60
|
+
},
|
|
61
|
+
}));
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { Ref } from 'react';
|
|
2
|
+
import type { ColorValue, PressableProps, TextStyle, View, ViewStyle } from 'react-native';
|
|
3
|
+
import type { SvgSource } from '../../utils/SvgUniversal';
|
|
4
|
+
import type { BadgeSeverity } from '../Badge/Badge';
|
|
5
|
+
export type ButtonBaseVariant = 'primary' | 'secondary' | 'tertiary' | 'text' | 'link';
|
|
6
|
+
export type ButtonSeverityVariant = 'basic' | 'outlined' | 'text';
|
|
7
|
+
export type ButtonVariant = ButtonBaseVariant | ButtonSeverityVariant;
|
|
8
|
+
export type ButtonSize = 'xlarge' | 'large' | 'base' | 'small';
|
|
9
|
+
export type ButtonShape = 'square' | 'circle';
|
|
10
|
+
export type ButtonIconPosition =
|
|
11
|
+
/** @deprecated */
|
|
12
|
+
'left'
|
|
13
|
+
/** @deprecated */
|
|
14
|
+
| 'right' | 'prefix' | 'postfix';
|
|
15
|
+
export interface BaseButtonProps<Variant extends ButtonVariant> extends PressableProps {
|
|
16
|
+
/**
|
|
17
|
+
* Controls button size
|
|
18
|
+
* @default 'base'
|
|
19
|
+
*/
|
|
20
|
+
size?: ButtonSize;
|
|
21
|
+
/**
|
|
22
|
+
* Controls button shape
|
|
23
|
+
* @default 'square'
|
|
24
|
+
*/
|
|
25
|
+
shape?: ButtonShape;
|
|
26
|
+
/**
|
|
27
|
+
* Controls button loading state
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Button visual presentation type
|
|
33
|
+
*/
|
|
34
|
+
variant?: Variant;
|
|
35
|
+
/**
|
|
36
|
+
* Icon position
|
|
37
|
+
*
|
|
38
|
+
* Важно: значения left и right - deprecated!!! Используйте prefix и postfix
|
|
39
|
+
*
|
|
40
|
+
* @default 'prefix'
|
|
41
|
+
*/
|
|
42
|
+
iconPosition?: ButtonIconPosition;
|
|
43
|
+
/**
|
|
44
|
+
* Controls icon only button variant
|
|
45
|
+
*/
|
|
46
|
+
iconOnly?: unknown;
|
|
47
|
+
/**
|
|
48
|
+
* SVG icon
|
|
49
|
+
* @default undefined
|
|
50
|
+
*/
|
|
51
|
+
Icon?: SvgSource;
|
|
52
|
+
/**
|
|
53
|
+
* Label in button
|
|
54
|
+
*/
|
|
55
|
+
label?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Ref for the pressable component
|
|
58
|
+
*/
|
|
59
|
+
pressableRef?: Ref<View>;
|
|
60
|
+
}
|
|
61
|
+
export interface IconTextButton<Variant extends ButtonVariant> extends BaseButtonProps<Variant> {
|
|
62
|
+
label: string;
|
|
63
|
+
iconOnly?: never;
|
|
64
|
+
}
|
|
65
|
+
export interface IconOnlyButtonProps<Variant extends ButtonVariant> extends BaseButtonProps<Variant> {
|
|
66
|
+
Icon: SvgSource;
|
|
67
|
+
iconOnly: true;
|
|
68
|
+
iconPosition?: never;
|
|
69
|
+
label?: never;
|
|
70
|
+
}
|
|
71
|
+
export type ButtonProps<Variant extends ButtonVariant> = IconTextButton<Variant> | IconOnlyButtonProps<Variant>;
|
|
72
|
+
export type LabelVariantStyles<Variant extends ButtonVariant> = Record<Required<BaseButtonProps<Variant>>['variant'], TextStyle>;
|
|
73
|
+
export type PressedVariantStyles<Variant extends ButtonVariant> = Record<Required<BaseButtonProps<Variant>>['variant'], ViewStyle>;
|
|
74
|
+
export type ContainerVariantStyles<Variant extends ButtonVariant> = Record<Required<BaseButtonProps<Variant>>['variant'], ViewStyle>;
|
|
75
|
+
export type IconVariantStyles<Variant extends ButtonVariant> = Record<Required<BaseButtonProps<Variant>>['variant'], {
|
|
76
|
+
color: ColorValue;
|
|
77
|
+
}>;
|
|
78
|
+
export type PressedLabelVariantStyles<Variant extends ButtonVariant> = Record<Required<BaseButtonProps<Variant>>['variant'], {
|
|
79
|
+
color: ColorValue;
|
|
80
|
+
}>;
|
|
81
|
+
export interface VariantStyles<Variant extends ButtonVariant> {
|
|
82
|
+
containerVariantStyles: ContainerVariantStyles<Variant>;
|
|
83
|
+
pressedVariantStyles: PressedVariantStyles<Variant>;
|
|
84
|
+
labelVariantStyles: LabelVariantStyles<Variant>;
|
|
85
|
+
iconVariantStyles: IconVariantStyles<Variant>;
|
|
86
|
+
pressedLabelVariantStyles: PressedLabelVariantStyles<Variant>;
|
|
87
|
+
}
|
|
88
|
+
export type ButtonSeverity = 'info' | 'success' | 'warning' | 'danger';
|
|
89
|
+
export interface ButtonSeverityProps {
|
|
90
|
+
/**
|
|
91
|
+
* Controls severity button styling variant
|
|
92
|
+
*/
|
|
93
|
+
severity: ButtonSeverity;
|
|
94
|
+
variant?: ButtonSeverityVariant;
|
|
95
|
+
}
|
|
96
|
+
export interface ButtonBadgeProps {
|
|
97
|
+
/**
|
|
98
|
+
* Controls color of Badge component
|
|
99
|
+
*
|
|
100
|
+
* @type {BadgeSeverity}
|
|
101
|
+
*/
|
|
102
|
+
badgeSeverity: BadgeSeverity;
|
|
103
|
+
/**
|
|
104
|
+
* Текст внутри бейджа. Если не указан, то бейдж будет в форме точки.
|
|
105
|
+
*/
|
|
106
|
+
badgeLabel?: string;
|
|
107
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { BaseButtonProps, ButtonVariant } from '../types';
|
|
2
|
+
export type ButtonActivityIndicatorProps<Variant extends ButtonVariant> = Pick<Required<BaseButtonProps<Variant>>, 'size'>;
|
|
3
|
+
export declare const ButtonActivityIndicator: <Variant extends ButtonVariant>({ size, }: ButtonActivityIndicatorProps<Variant>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ActivityIndicator } from 'react-native';
|
|
2
|
+
import { genericMemo } from '../../../utils/genericMemo';
|
|
3
|
+
import { makeStyles } from '../../../utils/makeStyles';
|
|
4
|
+
import { useTypeBasedStyle } from './useTypeBasedStyle';
|
|
5
|
+
const ButtonActivityIndicatorComponent = ({ size, }) => {
|
|
6
|
+
const styles = useStyles();
|
|
7
|
+
const sizeBasedStyle = useTypeBasedStyle(size, styles);
|
|
8
|
+
return (<ActivityIndicator color={styles.activityIndicator.color} size={sizeBasedStyle.height ?? 'small'} testID='Button_ActivityIndicator'/>);
|
|
9
|
+
};
|
|
10
|
+
const useStyles = makeStyles(({ theme }) => ({
|
|
11
|
+
xlarge: { height: 21 },
|
|
12
|
+
large: { height: 21 },
|
|
13
|
+
base: { height: 17.5 },
|
|
14
|
+
small: { height: 14 },
|
|
15
|
+
activityIndicator: { color: theme.Button.Disabled.disabledButtonTextColor },
|
|
16
|
+
}));
|
|
17
|
+
export const ButtonActivityIndicator = genericMemo(ButtonActivityIndicatorComponent);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { BaseButtonProps, ButtonVariant, VariantStyles } from '../types';
|
|
3
|
+
export type ButtonContainerComponentProps<Variant extends ButtonVariant> = Omit<BaseButtonProps<Variant>, 'size' | 'variant' | 'disabled' | 'loading' | 'shape' | 'Icon' | 'iconPosition' | 'label'> & Pick<Required<BaseButtonProps<Variant>>, 'size' | 'variant' | 'disabled' | 'loading' | 'shape'> & {
|
|
4
|
+
readonly children: ReactNode;
|
|
5
|
+
} & Pick<VariantStyles<Variant>, 'containerVariantStyles' | 'pressedVariantStyles'>;
|
|
6
|
+
export declare const ButtonContainerComponent: <Variant extends ButtonVariant>({ style, size, disabled, loading, variant, shape, iconOnly, children, containerVariantStyles, pressedVariantStyles, pressableRef, ...props }: ButtonContainerComponentProps<Variant>) => import("react").JSX.Element;
|
|
7
|
+
export declare const ButtonContainer: <Variant extends ButtonVariant>({ style, size, disabled, loading, variant, shape, iconOnly, children, containerVariantStyles, pressedVariantStyles, pressableRef, ...props }: ButtonContainerComponentProps<Variant>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Pressable } from 'react-native';
|
|
2
|
+
import { genericMemo } from '../../../utils/genericMemo';
|
|
3
|
+
import { useButtonContainerCallbackStyle } from './useButtonContainerCallbackStyle';
|
|
4
|
+
export const ButtonContainerComponent = ({ style, size, disabled, loading, variant, shape, iconOnly, children, containerVariantStyles, pressedVariantStyles, pressableRef, ...props }) => {
|
|
5
|
+
const containerCallbackStyle = useButtonContainerCallbackStyle(size, variant, shape, disabled, loading, iconOnly, style, containerVariantStyles, pressedVariantStyles);
|
|
6
|
+
return (<Pressable accessibilityRole='button' disabled={disabled || loading} ref={pressableRef} style={containerCallbackStyle} {...props}>
|
|
7
|
+
{children}
|
|
8
|
+
</Pressable>);
|
|
9
|
+
};
|
|
10
|
+
export const ButtonContainer = genericMemo(ButtonContainerComponent);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BaseButtonProps, ButtonVariant, VariantStyles } from '../types';
|
|
2
|
+
export type ButtonIconComponentProps<Variant extends ButtonVariant> = Pick<Required<BaseButtonProps<Variant>>, 'size' | 'variant' | 'disabled' | 'loading'> & Pick<BaseButtonProps<Variant>, 'Icon'> & Pick<VariantStyles<Variant>, 'iconVariantStyles'>;
|
|
3
|
+
export declare const ButtonIconComponent: <Variant extends ButtonVariant>({ size, variant, disabled, loading, Icon, iconVariantStyles, }: ButtonIconComponentProps<Variant>) => import("react").JSX.Element | null;
|
|
4
|
+
export declare const ButtonIcon: <Variant extends ButtonVariant>({ size, variant, disabled, loading, Icon, iconVariantStyles, }: ButtonIconComponentProps<Variant>) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SvgUniversal } from '../../../utils/SvgUniversal';
|
|
2
|
+
import { genericMemo } from '../../../utils/genericMemo';
|
|
3
|
+
import { useIconStyle } from './useIconStyle';
|
|
4
|
+
export const ButtonIconComponent = ({ size, variant, disabled, loading, Icon, iconVariantStyles, }) => {
|
|
5
|
+
const iconStyle = useIconStyle(size, variant, disabled, loading, iconVariantStyles);
|
|
6
|
+
if (!Icon) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return (<SvgUniversal height={iconStyle.height} source={Icon} style={iconStyle} testID='Button_Icon' width={iconStyle.width}/>);
|
|
10
|
+
};
|
|
11
|
+
export const ButtonIcon = genericMemo(ButtonIconComponent);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BaseButtonProps, ButtonVariant, VariantStyles } from '../types';
|
|
2
|
+
export type ButtonLabelComponentProps<Variant extends ButtonVariant> = Pick<BaseButtonProps<Variant>, 'iconOnly' | 'label'> & Pick<Required<BaseButtonProps<Variant>>, 'size' | 'variant' | 'disabled' | 'loading'> & Pick<VariantStyles<Variant>, 'labelVariantStyles'>;
|
|
3
|
+
export declare const ButtonLabelComponent: <Variant extends ButtonVariant>({ label, iconOnly, size, disabled, loading, variant, labelVariantStyles, }: ButtonLabelComponentProps<Variant>) => import("react").JSX.Element | null;
|
|
4
|
+
export declare const ButtonLabel: <Variant extends ButtonVariant>({ label, iconOnly, size, disabled, loading, variant, labelVariantStyles, }: ButtonLabelComponentProps<Variant>) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Text } from 'react-native';
|
|
2
|
+
import { genericMemo } from '../../../utils/genericMemo';
|
|
3
|
+
import { useButtonLabelStyle } from './useButtonLabelStyle';
|
|
4
|
+
export const ButtonLabelComponent = ({ label, iconOnly, size, disabled, loading, variant, labelVariantStyles, }) => {
|
|
5
|
+
const labelStyle = useButtonLabelStyle(size, variant, disabled, loading, labelVariantStyles);
|
|
6
|
+
if (iconOnly) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return (<Text style={labelStyle} testID='Button_Text'>
|
|
10
|
+
{label}
|
|
11
|
+
</Text>);
|
|
12
|
+
};
|
|
13
|
+
export const ButtonLabel = genericMemo(ButtonLabelComponent);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BaseButtonProps, ButtonVariant, VariantStyles } from '../types';
|
|
2
|
+
export type ButtonLeftAreaComponentProps<Variant extends ButtonVariant> = Pick<BaseButtonProps<Variant>, 'iconPosition' | 'Icon'> & Pick<Required<BaseButtonProps<Variant>>, 'size' | 'variant' | 'loading' | 'disabled'> & Pick<VariantStyles<Variant>, 'iconVariantStyles'>;
|
|
3
|
+
export declare const ButtonLeftAreaComponent: <Variant extends ButtonVariant>({ size, iconPosition, variant, Icon, loading, disabled, iconVariantStyles, }: ButtonLeftAreaComponentProps<Variant>) => import("react").JSX.Element | null;
|
|
4
|
+
export declare const ButtonLeftArea: <Variant extends ButtonVariant>({ size, iconPosition, variant, Icon, loading, disabled, iconVariantStyles, }: ButtonLeftAreaComponentProps<Variant>) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { genericMemo } from '../../../utils/genericMemo';
|
|
2
|
+
import { ButtonActivityIndicator } from './ButtonActivityIndicator';
|
|
3
|
+
import { ButtonIcon } from './ButtonIcon';
|
|
4
|
+
export const ButtonLeftAreaComponent = ({ size, iconPosition, variant, Icon, loading, disabled, iconVariantStyles, }) => {
|
|
5
|
+
if (iconPosition === 'left' || iconPosition === 'prefix') {
|
|
6
|
+
if (loading && !disabled) {
|
|
7
|
+
return <ButtonActivityIndicator size={size}/>;
|
|
8
|
+
}
|
|
9
|
+
return (<ButtonIcon {...{ size, variant, disabled, loading, Icon, iconVariantStyles }}/>);
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
};
|
|
13
|
+
export const ButtonLeftArea = genericMemo(ButtonLeftAreaComponent);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { BaseButtonProps, ButtonVariant, VariantStyles } from '../types';
|
|
2
|
+
export type ButtonRightAreaComponentProps<Variant extends ButtonVariant> = Pick<BaseButtonProps<Variant>, 'iconPosition' | 'Icon'> & Pick<Required<BaseButtonProps<Variant>>, 'size' | 'variant' | 'loading' | 'disabled'> & Pick<VariantStyles<Variant>, 'iconVariantStyles'>;
|
|
3
|
+
export declare const ButtonRightArea: <Variant extends ButtonVariant>({ size, iconPosition, variant, Icon, loading, disabled, iconVariantStyles, }: ButtonRightAreaComponentProps<Variant>) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { genericMemo } from '../../../utils/genericMemo';
|
|
2
|
+
import { ButtonActivityIndicator } from './ButtonActivityIndicator';
|
|
3
|
+
import { ButtonIcon } from './ButtonIcon';
|
|
4
|
+
const ButtonRightAreaComponent = ({ size, iconPosition, variant, Icon, loading, disabled, iconVariantStyles, }) => {
|
|
5
|
+
if (iconPosition === 'right' || iconPosition === 'postfix') {
|
|
6
|
+
if (loading && !disabled) {
|
|
7
|
+
return <ButtonActivityIndicator size={size}/>;
|
|
8
|
+
}
|
|
9
|
+
return (<ButtonIcon {...{ size, variant, disabled, loading, Icon, iconVariantStyles }}/>);
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
};
|
|
13
|
+
export const ButtonRightArea = genericMemo(ButtonRightAreaComponent);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type PressableStateCallbackType, type ViewStyle } from 'react-native';
|
|
2
|
+
import type { BaseButtonProps, ButtonVariant, ContainerVariantStyles, PressedVariantStyles } from '../types';
|
|
3
|
+
export declare const useButtonContainerCallbackStyle: <Variant extends ButtonVariant>(size: Required<BaseButtonProps<Variant>>["size"], variant: Required<BaseButtonProps<Variant>>["variant"], shape: Required<BaseButtonProps<Variant>>["shape"], disabled: Required<BaseButtonProps<Variant>>["disabled"], loading: Required<BaseButtonProps<Variant>>["loading"], iconOnly: Required<BaseButtonProps<Variant>>["iconOnly"], style: BaseButtonProps<Variant>["style"], containerVariantStyles: ContainerVariantStyles<Variant>, pressedVariantStyles: PressedVariantStyles<Variant>) => ({ pressed }: PressableStateCallbackType) => ViewStyle;
|