@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.
Files changed (261) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +151 -0
  3. package/dist/components/Accordion/Accordion.d.ts +39 -0
  4. package/dist/components/Accordion/Accordion.js +103 -0
  5. package/dist/components/Accordion/index.d.ts +1 -0
  6. package/dist/components/Accordion/index.js +1 -0
  7. package/dist/components/Avatar/Avatar.d.ts +96 -0
  8. package/dist/components/Avatar/Avatar.js +121 -0
  9. package/dist/components/Avatar/index.d.ts +1 -0
  10. package/dist/components/Avatar/index.js +1 -0
  11. package/dist/components/Badge/Badge.d.ts +35 -0
  12. package/dist/components/Badge/Badge.js +74 -0
  13. package/dist/components/Badge/index.d.ts +1 -0
  14. package/dist/components/Badge/index.js +1 -0
  15. package/dist/components/Button/BaseButton.d.ts +5 -0
  16. package/dist/components/Button/BaseButton.js +62 -0
  17. package/dist/components/Button/Button.d.ts +16 -0
  18. package/dist/components/Button/Button.js +21 -0
  19. package/dist/components/Button/ButtonBadge.d.ts +21 -0
  20. package/dist/components/Button/ButtonBadge.js +53 -0
  21. package/dist/components/Button/ButtonSeverity.d.ts +17 -0
  22. package/dist/components/Button/ButtonSeverity.js +22 -0
  23. package/dist/components/Button/index.d.ts +4 -0
  24. package/dist/components/Button/index.js +3 -0
  25. package/dist/components/Button/styles/index.d.ts +2 -0
  26. package/dist/components/Button/styles/index.js +2 -0
  27. package/dist/components/Button/styles/useBasicButtonStyles.d.ts +98 -0
  28. package/dist/components/Button/styles/useBasicButtonStyles.js +81 -0
  29. package/dist/components/Button/styles/useDangerButtonStyles.d.ts +63 -0
  30. package/dist/components/Button/styles/useDangerButtonStyles.js +57 -0
  31. package/dist/components/Button/styles/useInfoButtonStyles.d.ts +63 -0
  32. package/dist/components/Button/styles/useInfoButtonStyles.js +56 -0
  33. package/dist/components/Button/styles/useSeverityButtonStyles.d.ts +64 -0
  34. package/dist/components/Button/styles/useSeverityButtonStyles.js +29 -0
  35. package/dist/components/Button/styles/useSuccessButtonStyles.d.ts +63 -0
  36. package/dist/components/Button/styles/useSuccessButtonStyles.js +61 -0
  37. package/dist/components/Button/styles/useWarningButtonStyles.d.ts +63 -0
  38. package/dist/components/Button/styles/useWarningButtonStyles.js +61 -0
  39. package/dist/components/Button/types.d.ts +107 -0
  40. package/dist/components/Button/types.js +0 -0
  41. package/dist/components/Button/utils/ButtonActivityIndicator.d.ts +3 -0
  42. package/dist/components/Button/utils/ButtonActivityIndicator.js +17 -0
  43. package/dist/components/Button/utils/ButtonContainer.d.ts +7 -0
  44. package/dist/components/Button/utils/ButtonContainer.js +10 -0
  45. package/dist/components/Button/utils/ButtonIcon.d.ts +4 -0
  46. package/dist/components/Button/utils/ButtonIcon.js +11 -0
  47. package/dist/components/Button/utils/ButtonLabel.d.ts +4 -0
  48. package/dist/components/Button/utils/ButtonLabel.js +13 -0
  49. package/dist/components/Button/utils/ButtonLeftArea.d.ts +4 -0
  50. package/dist/components/Button/utils/ButtonLeftArea.js +13 -0
  51. package/dist/components/Button/utils/ButtonRightArea.d.ts +3 -0
  52. package/dist/components/Button/utils/ButtonRightArea.js +13 -0
  53. package/dist/components/Button/utils/index.d.ts +4 -0
  54. package/dist/components/Button/utils/index.js +4 -0
  55. package/dist/components/Button/utils/useButtonContainerCallbackStyle.d.ts +3 -0
  56. package/dist/components/Button/utils/useButtonContainerCallbackStyle.js +141 -0
  57. package/dist/components/Button/utils/useButtonLabelStyle.d.ts +3 -0
  58. package/dist/components/Button/utils/useButtonLabelStyle.js +40 -0
  59. package/dist/components/Button/utils/useIconStyle.d.ts +7 -0
  60. package/dist/components/Button/utils/useIconStyle.js +35 -0
  61. package/dist/components/Button/utils/useTypeBasedStyle.d.ts +2 -0
  62. package/dist/components/Button/utils/useTypeBasedStyle.js +4 -0
  63. package/dist/components/Checkbox/Checkbox.d.ts +31 -0
  64. package/dist/components/Checkbox/Checkbox.js +55 -0
  65. package/dist/components/Checkbox/hooks/usePressableStyles.d.ts +15 -0
  66. package/dist/components/Checkbox/hooks/usePressableStyles.js +91 -0
  67. package/dist/components/Checkbox/index.d.ts +1 -0
  68. package/dist/components/Checkbox/index.js +1 -0
  69. package/dist/components/Chip/Chip.d.ts +30 -0
  70. package/dist/components/Chip/Chip.js +70 -0
  71. package/dist/components/Chip/index.d.ts +1 -0
  72. package/dist/components/Chip/index.js +1 -0
  73. package/dist/components/Dialog/Dialog.d.ts +14 -0
  74. package/dist/components/Dialog/Dialog.js +96 -0
  75. package/dist/components/Dialog/DialogComponent.d.ts +7 -0
  76. package/dist/components/Dialog/DialogComponent.js +34 -0
  77. package/dist/components/Dialog/DialogHeader.d.ts +12 -0
  78. package/dist/components/Dialog/DialogHeader.js +68 -0
  79. package/dist/components/Dialog/index.d.ts +3 -0
  80. package/dist/components/Dialog/index.js +3 -0
  81. package/dist/components/Divider/Divider.d.ts +42 -0
  82. package/dist/components/Divider/Divider.js +95 -0
  83. package/dist/components/Divider/index.d.ts +1 -0
  84. package/dist/components/Divider/index.js +1 -0
  85. package/dist/components/Input/FloatLabel.d.ts +22 -0
  86. package/dist/components/Input/FloatLabel.js +19 -0
  87. package/dist/components/Input/InputGroup.d.ts +21 -0
  88. package/dist/components/Input/InputGroup.js +52 -0
  89. package/dist/components/Input/InputGroupAddon.d.ts +17 -0
  90. package/dist/components/Input/InputGroupAddon.js +57 -0
  91. package/dist/components/Input/InputSwitch/InputSwitch.d.ts +8 -0
  92. package/dist/components/Input/InputSwitch/InputSwitch.js +16 -0
  93. package/dist/components/Input/InputSwitch/index.d.ts +1 -0
  94. package/dist/components/Input/InputSwitch/index.js +1 -0
  95. package/dist/components/Input/InputSwitch/styles/index.d.ts +2 -0
  96. package/dist/components/Input/InputSwitch/styles/index.js +2 -0
  97. package/dist/components/Input/InputSwitch/styles/useHandleStyles.d.ts +13 -0
  98. package/dist/components/Input/InputSwitch/styles/useHandleStyles.js +47 -0
  99. package/dist/components/Input/InputSwitch/styles/useSliderStyles.d.ts +17 -0
  100. package/dist/components/Input/InputSwitch/styles/useSliderStyles.js +95 -0
  101. package/dist/components/Input/InputText.d.ts +13 -0
  102. package/dist/components/Input/InputText.js +14 -0
  103. package/dist/components/Input/InputTextBase/InputTextBase.d.ts +13 -0
  104. package/dist/components/Input/InputTextBase/InputTextBase.js +124 -0
  105. package/dist/components/Input/InputTextBase/testIds.d.ts +11 -0
  106. package/dist/components/Input/InputTextBase/testIds.js +11 -0
  107. package/dist/components/Input/InputTextBase/types.d.ts +41 -0
  108. package/dist/components/Input/InputTextBase/types.js +0 -0
  109. package/dist/components/Input/InputTextBase/useStyles.d.ts +86 -0
  110. package/dist/components/Input/InputTextBase/useStyles.js +78 -0
  111. package/dist/components/Input/index.d.ts +5 -0
  112. package/dist/components/Input/index.js +4 -0
  113. package/dist/components/List/Base/ListBase.d.ts +32 -0
  114. package/dist/components/List/Base/ListBase.js +88 -0
  115. package/dist/components/List/Base/index.d.ts +1 -0
  116. package/dist/components/List/Base/index.js +1 -0
  117. package/dist/components/MenuItem/MenuItemAccessory.d.ts +11 -0
  118. package/dist/components/MenuItem/MenuItemAccessory.js +23 -0
  119. package/dist/components/MenuItem/MenuItemIcon.d.ts +36 -0
  120. package/dist/components/MenuItem/MenuItemIcon.js +33 -0
  121. package/dist/components/MenuItem/Template/MenuItemTemplate.d.ts +42 -0
  122. package/dist/components/MenuItem/Template/MenuItemTemplate.js +79 -0
  123. package/dist/components/MenuItem/index.d.ts +1 -0
  124. package/dist/components/MenuItem/index.js +1 -0
  125. package/dist/components/Message/Message.d.ts +65 -0
  126. package/dist/components/Message/Message.js +126 -0
  127. package/dist/components/Message/index.d.ts +1 -0
  128. package/dist/components/Message/index.js +1 -0
  129. package/dist/components/ProgressBar/ProgressBar.d.ts +33 -0
  130. package/dist/components/ProgressBar/ProgressBar.js +62 -0
  131. package/dist/components/ProgressBar/index.d.ts +1 -0
  132. package/dist/components/ProgressBar/index.js +1 -0
  133. package/dist/components/ProgressSpinner/ProgressSpinner.d.ts +17 -0
  134. package/dist/components/ProgressSpinner/ProgressSpinner.js +68 -0
  135. package/dist/components/ProgressSpinner/index.d.ts +1 -0
  136. package/dist/components/ProgressSpinner/index.js +1 -0
  137. package/dist/components/RadioButton/RadioButton.d.ts +18 -0
  138. package/dist/components/RadioButton/RadioButton.js +134 -0
  139. package/dist/components/RadioButton/index.d.ts +1 -0
  140. package/dist/components/RadioButton/index.js +1 -0
  141. package/dist/components/Rating/Rating.d.ts +48 -0
  142. package/dist/components/Rating/Rating.js +37 -0
  143. package/dist/components/Rating/RatingClear.d.ts +14 -0
  144. package/dist/components/Rating/RatingClear.js +28 -0
  145. package/dist/components/Rating/RatingItem.d.ts +19 -0
  146. package/dist/components/Rating/RatingItem.js +44 -0
  147. package/dist/components/Rating/RatingItemContainer.d.ts +37 -0
  148. package/dist/components/Rating/RatingItemContainer.js +30 -0
  149. package/dist/components/Rating/index.d.ts +1 -0
  150. package/dist/components/Rating/index.js +1 -0
  151. package/dist/components/SelectButton/SelectButton.d.ts +32 -0
  152. package/dist/components/SelectButton/SelectButton.js +75 -0
  153. package/dist/components/SelectButton/SelectButtonItem.d.ts +35 -0
  154. package/dist/components/SelectButton/SelectButtonItem.js +133 -0
  155. package/dist/components/SelectButton/index.d.ts +1 -0
  156. package/dist/components/SelectButton/index.js +1 -0
  157. package/dist/components/Skeleton/Skeleton.d.ts +15 -0
  158. package/dist/components/Skeleton/Skeleton.js +53 -0
  159. package/dist/components/Skeleton/index.d.ts +1 -0
  160. package/dist/components/Skeleton/index.js +1 -0
  161. package/dist/components/Slider/Slider.d.ts +36 -0
  162. package/dist/components/Slider/Slider.js +153 -0
  163. package/dist/components/Slider/index.d.ts +1 -0
  164. package/dist/components/Slider/index.js +1 -0
  165. package/dist/components/Tabs/TabItem/TabItem.d.ts +24 -0
  166. package/dist/components/Tabs/TabItem/TabItem.js +82 -0
  167. package/dist/components/Tabs/TabItem/index.d.ts +1 -0
  168. package/dist/components/Tabs/TabItem/index.js +1 -0
  169. package/dist/components/Tabs/TabPanel/TabPanel.d.ts +9 -0
  170. package/dist/components/Tabs/TabPanel/TabPanel.js +11 -0
  171. package/dist/components/Tabs/TabPanel/index.d.ts +1 -0
  172. package/dist/components/Tabs/TabPanel/index.js +1 -0
  173. package/dist/components/Tabs/Tabs.d.ts +15 -0
  174. package/dist/components/Tabs/Tabs.js +48 -0
  175. package/dist/components/Tabs/index.d.ts +2 -0
  176. package/dist/components/Tabs/index.js +2 -0
  177. package/dist/components/Tag/Tag.d.ts +33 -0
  178. package/dist/components/Tag/Tag.js +71 -0
  179. package/dist/components/Tag/index.d.ts +1 -0
  180. package/dist/components/Tag/index.js +1 -0
  181. package/dist/components/Timer/Timer.d.ts +18 -0
  182. package/dist/components/Timer/Timer.js +74 -0
  183. package/dist/components/Timer/TimerFlip.d.ts +7 -0
  184. package/dist/components/Timer/TimerFlip.js +69 -0
  185. package/dist/components/Timer/constants.d.ts +1 -0
  186. package/dist/components/Timer/constants.js +1 -0
  187. package/dist/components/ToggleButton/ToggleButton.d.ts +45 -0
  188. package/dist/components/ToggleButton/ToggleButton.js +85 -0
  189. package/dist/components/ToggleButton/hooks/useIconSize.d.ts +14 -0
  190. package/dist/components/ToggleButton/hooks/useIconSize.js +26 -0
  191. package/dist/components/ToggleButton/hooks/useLabelSize.d.ts +8 -0
  192. package/dist/components/ToggleButton/hooks/useLabelSize.js +19 -0
  193. package/dist/components/ToggleButton/hooks/useStateStyles.d.ts +11 -0
  194. package/dist/components/ToggleButton/hooks/useStateStyles.js +92 -0
  195. package/dist/components/ToggleButton/index.d.ts +1 -0
  196. package/dist/components/ToggleButton/index.js +1 -0
  197. package/dist/components/Typography/Anchor.d.ts +31 -0
  198. package/dist/components/Typography/Anchor.js +75 -0
  199. package/dist/components/Typography/Body.d.ts +9 -0
  200. package/dist/components/Typography/Body.js +32 -0
  201. package/dist/components/Typography/Caption.d.ts +9 -0
  202. package/dist/components/Typography/Caption.js +38 -0
  203. package/dist/components/Typography/Service.d.ts +25 -0
  204. package/dist/components/Typography/Service.js +63 -0
  205. package/dist/components/Typography/Subtitle.d.ts +18 -0
  206. package/dist/components/Typography/Subtitle.js +23 -0
  207. package/dist/components/Typography/Title.d.ts +5 -0
  208. package/dist/components/Typography/Title.js +24 -0
  209. package/dist/components/Typography/index.d.ts +6 -0
  210. package/dist/components/Typography/index.js +6 -0
  211. package/dist/components/index.d.ts +23 -0
  212. package/dist/components/index.js +23 -0
  213. package/dist/hooks/useChangeTheme.d.ts +1 -0
  214. package/dist/hooks/useChangeTheme.js +5 -0
  215. package/dist/hooks/useFonts.d.ts +1 -0
  216. package/dist/hooks/useFonts.js +5 -0
  217. package/dist/hooks/useLoadingRotationAnimation.d.ts +5 -0
  218. package/dist/hooks/useLoadingRotationAnimation.js +19 -0
  219. package/dist/hooks/useMakeTestId.d.ts +3 -0
  220. package/dist/hooks/useMakeTestId.js +7 -0
  221. package/dist/hooks/useTheme.d.ts +1 -0
  222. package/dist/hooks/useTheme.js +5 -0
  223. package/dist/index.d.ts +6 -0
  224. package/dist/index.js +6 -0
  225. package/dist/theme/ThemeContext.d.ts +15 -0
  226. package/dist/theme/ThemeContext.js +20 -0
  227. package/dist/theme/assets/background.json +149 -0
  228. package/dist/theme/assets/border.json +103 -0
  229. package/dist/theme/assets/customCommon.d.ts +4 -0
  230. package/dist/theme/assets/customCommon.js +4 -0
  231. package/dist/theme/assets/customDark.d.ts +5 -0
  232. package/dist/theme/assets/customDark.js +15 -0
  233. package/dist/theme/assets/customLight.d.ts +15 -0
  234. package/dist/theme/assets/customLight.js +15 -0
  235. package/dist/theme/assets/effects.json +15 -0
  236. package/dist/theme/assets/global.json +114 -0
  237. package/dist/theme/assets/primaryColors.json +14 -0
  238. package/dist/theme/assets/shadow.d.ts +6 -0
  239. package/dist/theme/assets/shadow.js +6 -0
  240. package/dist/theme/assets/sizing.json +78 -0
  241. package/dist/theme/assets/spacing.json +48 -0
  242. package/dist/theme/assets/themeDark.json +1141 -0
  243. package/dist/theme/assets/themeLight.json +1141 -0
  244. package/dist/theme/assets/typography.json +45 -0
  245. package/dist/theme/commonTheme.d.ts +582 -0
  246. package/dist/theme/commonTheme.js +22 -0
  247. package/dist/theme/darkTheme.d.ts +2 -0
  248. package/dist/theme/darkTheme.js +7 -0
  249. package/dist/theme/index.d.ts +4 -0
  250. package/dist/theme/index.js +4 -0
  251. package/dist/theme/lightTheme.d.ts +2 -0
  252. package/dist/theme/lightTheme.js +7 -0
  253. package/dist/theme/types.d.ts +40 -0
  254. package/dist/theme/types.js +5 -0
  255. package/dist/utils/SvgUniversal.d.ts +29 -0
  256. package/dist/utils/SvgUniversal.js +28 -0
  257. package/dist/utils/genericMemo.d.ts +1 -0
  258. package/dist/utils/genericMemo.js +2 -0
  259. package/dist/utils/makeStyles.d.ts +11 -0
  260. package/dist/utils/makeStyles.js +19 -0
  261. package/package.json +159 -0
@@ -0,0 +1,62 @@
1
+ import { useCallback, useState } from 'react';
2
+ import { genericMemo } from '../../utils/genericMemo';
3
+ import { ButtonLeftArea, ButtonRightArea, ButtonLabel, ButtonContainer, } from './utils';
4
+ const BaseButtonComponent = ({ size = 'base', shape = 'square', loading = false, variant, disabled = false, iconOnly, iconPosition = 'prefix', Icon, label, style, containerVariantStyles, labelVariantStyles, pressedVariantStyles, iconVariantStyles, pressedLabelVariantStyles, onPressIn: onPressInProp, onPressOut: onPressOutProp, ...props }) => {
5
+ const [pressed, setPressed] = useState(false);
6
+ const onPressIn = useCallback((event) => {
7
+ onPressInProp?.(event);
8
+ setPressed(true);
9
+ }, [onPressInProp]);
10
+ const onPressOut = useCallback((event) => {
11
+ onPressOutProp?.(event);
12
+ setPressed(false);
13
+ }, [onPressOutProp]);
14
+ return (<ButtonContainer {...{
15
+ size,
16
+ variant,
17
+ shape,
18
+ disabled,
19
+ loading,
20
+ iconOnly,
21
+ style,
22
+ containerVariantStyles,
23
+ pressedVariantStyles,
24
+ onPressIn,
25
+ onPressOut,
26
+ }} {...props}>
27
+ <ButtonLeftArea {...{
28
+ size,
29
+ variant,
30
+ loading,
31
+ disabled,
32
+ Icon,
33
+ iconPosition,
34
+ iconVariantStyles: pressed
35
+ ? pressedLabelVariantStyles
36
+ : iconVariantStyles,
37
+ }}/>
38
+ <ButtonLabel {...{
39
+ size,
40
+ variant,
41
+ loading,
42
+ disabled,
43
+ iconOnly,
44
+ label,
45
+ labelVariantStyles: pressed
46
+ ? pressedLabelVariantStyles
47
+ : labelVariantStyles,
48
+ }}/>
49
+ <ButtonRightArea {...{
50
+ size,
51
+ variant,
52
+ loading,
53
+ disabled,
54
+ Icon,
55
+ iconPosition,
56
+ iconVariantStyles: pressed
57
+ ? pressedLabelVariantStyles
58
+ : iconVariantStyles,
59
+ }}/>
60
+ </ButtonContainer>);
61
+ };
62
+ export const BaseButton = genericMemo(BaseButtonComponent);
@@ -0,0 +1,16 @@
1
+ import type { ButtonBaseVariant, ButtonProps } from './types';
2
+ /**
3
+ * Button component
4
+ * @param size - button size
5
+ * @param shape - button shape
6
+ * @param loading - button loading state
7
+ * @param variant - button variant
8
+ * @param disabled - button disabled state
9
+ * @param iconOnly - button with only Icon
10
+ * @param iconPosition - icon position
11
+ * @param Icon - Tabler icon
12
+ * @param label - button label
13
+ * @param style - external style control for component
14
+ * @see BaseButton
15
+ */
16
+ export declare const Button: import("react").NamedExoticComponent<ButtonProps<ButtonBaseVariant>>;
@@ -0,0 +1,21 @@
1
+ import { memo } from 'react';
2
+ import { BaseButton } from './BaseButton';
3
+ import { useBasicButtonStyles } from './styles';
4
+ /**
5
+ * Button component
6
+ * @param size - button size
7
+ * @param shape - button shape
8
+ * @param loading - button loading state
9
+ * @param variant - button variant
10
+ * @param disabled - button disabled state
11
+ * @param iconOnly - button with only Icon
12
+ * @param iconPosition - icon position
13
+ * @param Icon - Tabler icon
14
+ * @param label - button label
15
+ * @param style - external style control for component
16
+ * @see BaseButton
17
+ */
18
+ export const Button = memo(({ variant = 'primary', ...props }) => {
19
+ const buttonStyles = useBasicButtonStyles();
20
+ return <BaseButton variant={variant} {...props} {...buttonStyles}/>;
21
+ });
@@ -0,0 +1,21 @@
1
+ import type { ButtonBadgeProps, ButtonBaseVariant, ButtonProps } from './types';
2
+ /**
3
+ * Button component with badge
4
+ * @param size - button size
5
+ * @param shape - button shape
6
+ * @param loading - button loading state
7
+ * @param variant - button variant
8
+ * @param disabled - button disabled state
9
+ * @param iconOnly - button with only Icon
10
+ * @param iconPosition - icon position
11
+ * @param Icon - Tabler icon
12
+ * @param label - button label
13
+ * @param style - external style control for component
14
+ * @param badgeSeverity - badge component severity level
15
+ * @param badgeLabel - text label inside badge
16
+ * @see BaseButton
17
+ */
18
+ export declare const ButtonBadge: import("react").NamedExoticComponent<ButtonProps<ButtonBaseVariant> & ButtonBadgeProps>;
19
+ export declare const ButtonBadgeTestId: {
20
+ badge: string;
21
+ };
@@ -0,0 +1,53 @@
1
+ import { memo, useCallback, useMemo, useState } from 'react';
2
+ import { View, } from 'react-native';
3
+ import { makeStyles } from '../../utils/makeStyles';
4
+ import { Badge } from '../Badge';
5
+ import { BaseButton } from './BaseButton';
6
+ import { useBasicButtonStyles } from './styles';
7
+ /**
8
+ * Button component with badge
9
+ * @param size - button size
10
+ * @param shape - button shape
11
+ * @param loading - button loading state
12
+ * @param variant - button variant
13
+ * @param disabled - button disabled state
14
+ * @param iconOnly - button with only Icon
15
+ * @param iconPosition - icon position
16
+ * @param Icon - Tabler icon
17
+ * @param label - button label
18
+ * @param style - external style control for component
19
+ * @param badgeSeverity - badge component severity level
20
+ * @param badgeLabel - text label inside badge
21
+ * @see BaseButton
22
+ */
23
+ export const ButtonBadge = memo(({ badgeLabel, badgeSeverity, variant = 'primary', ...props }) => {
24
+ const buttonStyles = useBasicButtonStyles();
25
+ const styles = useStyles();
26
+ const [badgeLayout, setBadgeLayout] = useState();
27
+ const badgeContainerStyle = useMemo(() => ({
28
+ position: 'absolute',
29
+ top: badgeLayout ? -Math.round(badgeLayout.height / 2) : 0,
30
+ right: badgeLayout ? -Math.round(badgeLayout.width / 2) : 0,
31
+ }), [badgeLayout]);
32
+ const onLayout = useCallback((e) => setBadgeLayout(e.nativeEvent.layout), []);
33
+ const badgeCommonProps = useMemo(() => ({ severity: badgeSeverity, testID: ButtonBadgeTestId.badge }), [badgeSeverity]);
34
+ return (<View style={styles.root}>
35
+ <View style={[
36
+ styles.contentContainer,
37
+ props.iconOnly && styles.iconOnlyContainer,
38
+ ]}>
39
+ <BaseButton variant={variant} {...props} {...buttonStyles}/>
40
+
41
+ {badgeLabel ? (<Badge {...badgeCommonProps} style={badgeContainerStyle} onLayout={onLayout}>
42
+ {badgeLabel}
43
+ </Badge>) : (<Badge {...badgeCommonProps} dot style={styles.badgeDot}/>)}
44
+ </View>
45
+ </View>);
46
+ });
47
+ const useStyles = makeStyles(() => ({
48
+ root: { flexDirection: 'row' },
49
+ contentContainer: { flex: 1 },
50
+ iconOnlyContainer: { flex: 0 },
51
+ badgeDot: { position: 'absolute', top: 0, right: -0.5 },
52
+ }));
53
+ export const ButtonBadgeTestId = { badge: 'Badge' };
@@ -0,0 +1,17 @@
1
+ import type { ButtonProps, ButtonSeverityProps, ButtonSeverityVariant } from './types';
2
+ /**
3
+ * Button component
4
+ * @param size - button size
5
+ * @param shape - button shape
6
+ * @param loading - button loading state
7
+ * @param variant - button variant
8
+ * @param disabled - button disabled state
9
+ * @param iconOnly - button with only Icon
10
+ * @param iconPosition - icon position
11
+ * @param Icon - Tabler icon
12
+ * @param label - button label
13
+ * @param style - external style control for component
14
+ * @param severity - severity button styling variant
15
+ * @see BaseButton
16
+ */
17
+ export declare const ButtonSeverity: import("react").NamedExoticComponent<ButtonProps<ButtonSeverityVariant> & ButtonSeverityProps>;
@@ -0,0 +1,22 @@
1
+ import { memo } from 'react';
2
+ import { BaseButton } from './BaseButton';
3
+ import { useSeverityButtonStyles } from './styles';
4
+ /**
5
+ * Button component
6
+ * @param size - button size
7
+ * @param shape - button shape
8
+ * @param loading - button loading state
9
+ * @param variant - button variant
10
+ * @param disabled - button disabled state
11
+ * @param iconOnly - button with only Icon
12
+ * @param iconPosition - icon position
13
+ * @param Icon - Tabler icon
14
+ * @param label - button label
15
+ * @param style - external style control for component
16
+ * @param severity - severity button styling variant
17
+ * @see BaseButton
18
+ */
19
+ export const ButtonSeverity = memo(({ severity, variant = 'basic', ...props }) => {
20
+ const buttonStyles = useSeverityButtonStyles(severity);
21
+ return <BaseButton variant={variant} {...props} {...buttonStyles}/>;
22
+ });
@@ -0,0 +1,4 @@
1
+ export { Button } from './Button';
2
+ export { ButtonBadge } from './ButtonBadge';
3
+ export { ButtonSeverity } from './ButtonSeverity';
4
+ export type { ButtonProps, ButtonBadgeProps, ButtonSeverityProps, VariantStyles, } from './types';
@@ -0,0 +1,3 @@
1
+ export { Button } from './Button';
2
+ export { ButtonBadge } from './ButtonBadge';
3
+ export { ButtonSeverity } from './ButtonSeverity';
@@ -0,0 +1,2 @@
1
+ export { useBasicButtonStyles } from './useBasicButtonStyles';
2
+ export { useSeverityButtonStyles } from './useSeverityButtonStyles';
@@ -0,0 +1,2 @@
1
+ export { useBasicButtonStyles } from './useBasicButtonStyles';
2
+ export { useSeverityButtonStyles } from './useSeverityButtonStyles';
@@ -0,0 +1,98 @@
1
+ export declare const useBasicButtonStyles: () => {
2
+ containerVariantStyles: {
3
+ primary: {
4
+ borderColor: string;
5
+ backgroundColor: string;
6
+ };
7
+ secondary: {
8
+ borderColor: string;
9
+ backgroundColor: string;
10
+ };
11
+ tertiary: {
12
+ borderColor: string;
13
+ backgroundColor: string;
14
+ };
15
+ text: {
16
+ borderColor: string;
17
+ backgroundColor: string;
18
+ };
19
+ link: {
20
+ paddingHorizontal: number;
21
+ paddingVertical: number;
22
+ height: "auto";
23
+ minHeight: "auto";
24
+ borderColor: string;
25
+ backgroundColor: string;
26
+ };
27
+ };
28
+ labelVariantStyles: {
29
+ primary: {
30
+ color: string;
31
+ };
32
+ secondary: {
33
+ color: string;
34
+ };
35
+ tertiary: {
36
+ color: string;
37
+ };
38
+ text: {
39
+ color: string;
40
+ };
41
+ link: {
42
+ color: string;
43
+ };
44
+ };
45
+ pressedVariantStyles: {
46
+ primary: {
47
+ borderColor: string;
48
+ backgroundColor: string;
49
+ };
50
+ secondary: {
51
+ borderColor: string;
52
+ backgroundColor: string;
53
+ };
54
+ tertiary: {
55
+ borderColor: string;
56
+ backgroundColor: string;
57
+ };
58
+ text: {
59
+ borderColor: string;
60
+ backgroundColor: string;
61
+ };
62
+ link: {};
63
+ };
64
+ iconVariantStyles: {
65
+ primary: {
66
+ color: string;
67
+ };
68
+ secondary: {
69
+ color: string;
70
+ };
71
+ tertiary: {
72
+ color: string;
73
+ };
74
+ text: {
75
+ color: string;
76
+ };
77
+ link: {
78
+ color: string;
79
+ };
80
+ };
81
+ pressedLabelVariantStyles: {
82
+ primary: {
83
+ color: string;
84
+ };
85
+ secondary: {
86
+ color: string;
87
+ };
88
+ tertiary: {
89
+ color: string;
90
+ };
91
+ text: {
92
+ color: string;
93
+ };
94
+ link: {
95
+ color: string;
96
+ };
97
+ };
98
+ };
@@ -0,0 +1,81 @@
1
+ import { makeStyles } from '../../../utils/makeStyles';
2
+ export const useBasicButtonStyles = () => {
3
+ const labelVariantStyles = useLabelVariantStyles();
4
+ const pressedVariantStyles = usePressedVariantStyles();
5
+ const containerVariantStyles = useContainerVariantStyles();
6
+ const iconVariantStyles = useIconVariantStyles();
7
+ const pressedLabelVariantStyles = usePressedLabelVariantStyles();
8
+ return {
9
+ containerVariantStyles,
10
+ labelVariantStyles,
11
+ pressedVariantStyles,
12
+ iconVariantStyles,
13
+ pressedLabelVariantStyles,
14
+ };
15
+ };
16
+ const useLabelVariantStyles = makeStyles(({ theme }) => ({
17
+ primary: { color: theme.Button.Brand.buttonTextColor },
18
+ secondary: { color: theme.Button.Primary.secondaryButtonTextColor },
19
+ tertiary: { color: theme.Button.Secondary.helpButtonTextColor },
20
+ text: { color: theme.Button.Text.textButtonTextColor },
21
+ link: { color: theme.Button.Text.textButtonTextColor },
22
+ }));
23
+ const usePressedVariantStyles = makeStyles(({ theme }) => ({
24
+ primary: {
25
+ borderColor: theme.Button.Brand.buttonBorderColor,
26
+ backgroundColor: theme.Button.Brand.buttonHoverBg,
27
+ },
28
+ secondary: {
29
+ borderColor: theme.Button.Primary.secondaryButtonHoverBorderColor,
30
+ backgroundColor: theme.Button.Primary.secondaryButtonHoverBg,
31
+ },
32
+ tertiary: {
33
+ borderColor: theme.Button.Secondary.helpButtonHoverBorderColor,
34
+ backgroundColor: theme.Button.Secondary.helpButtonHoverBg,
35
+ },
36
+ text: {
37
+ borderColor: theme.Button.Brand.buttonBorderColor,
38
+ backgroundColor: theme.Button.Text.textButtonHoverBg,
39
+ },
40
+ link: {},
41
+ }));
42
+ const useContainerVariantStyles = makeStyles(({ theme, spacing }) => ({
43
+ primary: {
44
+ borderColor: theme.Button.Brand.buttonBorderColor,
45
+ backgroundColor: theme.Button.Brand.buttonBg,
46
+ },
47
+ secondary: {
48
+ borderColor: theme.Button.Primary.secondaryButtonBorderColor,
49
+ backgroundColor: theme.Button.Primary.secondaryButtonBg,
50
+ },
51
+ tertiary: {
52
+ borderColor: theme.Button.Secondary.helpButtonBorderColor,
53
+ backgroundColor: theme.Button.Secondary.helpButtonBg,
54
+ },
55
+ text: {
56
+ borderColor: theme.Button.Brand.buttonBorderColor,
57
+ backgroundColor: theme.Button.Text.textButtonBg,
58
+ },
59
+ link: {
60
+ paddingHorizontal: 0,
61
+ paddingVertical: spacing.Padding['p-1'],
62
+ height: 'auto',
63
+ minHeight: 'auto',
64
+ borderColor: theme.Button.Brand.buttonBorderColor,
65
+ backgroundColor: theme.Button.Text.textButtonBg,
66
+ },
67
+ }));
68
+ const useIconVariantStyles = makeStyles(({ theme }) => ({
69
+ primary: { color: theme.Button.Brand.buttonTextColor },
70
+ secondary: { color: theme.Button.Primary.secondaryButtonTextColor },
71
+ tertiary: { color: theme.Button.Secondary.helpButtonTextColor },
72
+ text: { color: theme.Button.Text.textButtonTextColor },
73
+ link: { color: theme.Button.Text.textButtonTextColor },
74
+ }));
75
+ const usePressedLabelVariantStyles = makeStyles(({ theme, typography }) => ({
76
+ primary: { color: theme.Button.Brand.buttonTextColor },
77
+ secondary: { color: theme.Button.Primary.secondaryButtonTextColor },
78
+ tertiary: { color: theme.Button.Secondary.helpButtonTextColor },
79
+ text: { color: theme.Button.Text.textButtonTextColor },
80
+ link: { color: typography.Color.Common['text-color-secondary'] },
81
+ }));
@@ -0,0 +1,63 @@
1
+ export declare const useDangerButtonStyles: () => {
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,57 @@
1
+ import { makeStyles } from '../../../utils/makeStyles';
2
+ export const useDangerButtonStyles = () => {
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.Danger.Basic.dangerButtonTextColor },
17
+ outlined: {
18
+ color: theme.Button.Severity.Danger.Outlined.dangerOutlinedButtonTextColor,
19
+ },
20
+ text: { color: theme.Button.Severity.Danger.Text.dangerTextButtonTextColor },
21
+ }));
22
+ const usePressedVariantStyles = makeStyles(({ theme }) => ({
23
+ basic: {
24
+ borderColor: theme.Button.Severity.Danger.Basic.dangerButtonBorderColor,
25
+ backgroundColor: theme.Button.Severity.Danger.Basic.dangerButtonHoverBg,
26
+ },
27
+ outlined: {
28
+ borderColor: theme.Button.Severity.Danger.Outlined
29
+ .dangerOutlinedButtonHoverBorderColor,
30
+ backgroundColor: theme.Button.Severity.Danger.Outlined.dangerOutlinedButtonHoverBg,
31
+ },
32
+ text: {
33
+ borderColor: theme.Surface['surface-transparent'],
34
+ backgroundColor: theme.Button.Severity.Danger.Text.dangerTextButtonHoverBg,
35
+ },
36
+ }));
37
+ const useContainerVariantStyles = makeStyles(({ theme }) => ({
38
+ basic: {
39
+ borderColor: theme.Button.Severity.Danger.Basic.dangerButtonBorderColor,
40
+ backgroundColor: theme.Button.Severity.Danger.Basic.dangerButtonBg,
41
+ },
42
+ outlined: {
43
+ borderColor: theme.Button.Severity.Danger.Outlined.dangerOutlinedButtonBorderColor,
44
+ backgroundColor: theme.Button.Severity.Danger.Outlined.dangerOutlinedButtonBg,
45
+ },
46
+ text: {
47
+ borderColor: theme.Button.Severity.Danger.Basic.dangerButtonBorderColor,
48
+ backgroundColor: theme.Button.Severity.Danger.Text.dangerTextButtonBg,
49
+ },
50
+ }));
51
+ const useIconVariantStyles = makeStyles(({ theme }) => ({
52
+ basic: { color: theme.Button.Severity.Danger.Basic.dangerButtonTextColor },
53
+ outlined: {
54
+ color: theme.Button.Severity.Danger.Outlined.dangerOutlinedButtonTextColor,
55
+ },
56
+ text: { color: theme.Button.Severity.Danger.Text.dangerTextButtonTextColor },
57
+ }));
@@ -0,0 +1,63 @@
1
+ export declare const useInfoButtonStyles: () => {
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,56 @@
1
+ import { makeStyles } from '../../../utils/makeStyles';
2
+ export const useInfoButtonStyles = () => {
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.Info.Basic.infoButtonTextColor },
17
+ outlined: {
18
+ color: theme.Button.Severity.Info.Outlined.infoOutlinedButtonTextColor,
19
+ },
20
+ text: { color: theme.Button.Severity.Info.Text.infoTextButtonTextColor },
21
+ }));
22
+ const usePressedVariantStyles = makeStyles(({ theme }) => ({
23
+ basic: {
24
+ borderColor: theme.Button.Severity.Info.Basic.infoButtonBorderColor,
25
+ backgroundColor: theme.Button.Severity.Info.Basic.infoButtonHoverBg,
26
+ },
27
+ outlined: {
28
+ borderColor: theme.Button.Severity.Info.Outlined.infoOutlinedButtonHoverBorderColor,
29
+ backgroundColor: theme.Button.Severity.Info.Outlined.infoOutlinedButtonHoverBg,
30
+ },
31
+ text: {
32
+ borderColor: theme.Surface['surface-transparent'],
33
+ backgroundColor: theme.Button.Severity.Info.Text.infoTextButtonHoverBg,
34
+ },
35
+ }));
36
+ const useContainerVariantStyles = makeStyles(({ theme }) => ({
37
+ basic: {
38
+ borderColor: theme.Button.Severity.Info.Basic.infoButtonBorderColor,
39
+ backgroundColor: theme.Button.Severity.Info.Basic.infoButtonBg,
40
+ },
41
+ outlined: {
42
+ borderColor: theme.Button.Severity.Info.Outlined.infoOutlinedButtonBorderColor,
43
+ backgroundColor: theme.Button.Severity.Info.Outlined.infoOutlinedButtonBg,
44
+ },
45
+ text: {
46
+ borderColor: theme.Button.Severity.Info.Basic.infoButtonBorderColor,
47
+ backgroundColor: theme.Button.Severity.Info.Text.infoTextButtonBg,
48
+ },
49
+ }));
50
+ const useIconVariantStyles = makeStyles(({ theme }) => ({
51
+ basic: { color: theme.Button.Severity.Info.Basic.infoButtonTextColor },
52
+ outlined: {
53
+ color: theme.Button.Severity.Info.Outlined.infoOutlinedButtonTextColor,
54
+ },
55
+ text: { color: theme.Button.Severity.Info.Text.infoTextButtonTextColor },
56
+ }));