@cdek-it/react-native-ui-kit 0.6.9 → 1.0.0-beta.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 (129) hide show
  1. package/README.md +9 -0
  2. package/dist/components/Accordion/Accordion.js +9 -10
  3. package/dist/components/Avatar/Avatar.js +7 -9
  4. package/dist/components/Badge/Badge.js +28 -20
  5. package/dist/components/Button/BaseButton.d.ts +3 -3
  6. package/dist/components/Button/BaseButton.js +12 -41
  7. package/dist/components/Button/Button.js +6 -4
  8. package/dist/components/Button/ButtonBadge.js +13 -12
  9. package/dist/components/Button/ButtonSeverity.js +6 -4
  10. package/dist/components/Button/index.d.ts +1 -1
  11. package/dist/components/Button/types.d.ts +2 -25
  12. package/dist/components/Button/utils/ButtonActivityIndicator.d.ts +3 -3
  13. package/dist/components/Button/utils/ButtonActivityIndicator.js +16 -12
  14. package/dist/components/Button/utils/ButtonContainer.d.ts +15 -6
  15. package/dist/components/Button/utils/ButtonContainer.js +424 -4
  16. package/dist/components/Button/utils/ButtonIcon.d.ts +8 -4
  17. package/dist/components/Button/utils/ButtonIcon.js +147 -4
  18. package/dist/components/Button/utils/ButtonLabel.d.ts +9 -4
  19. package/dist/components/Button/utils/ButtonLabel.js +139 -4
  20. package/dist/components/Button/utils/ButtonLeftArea.d.ts +9 -4
  21. package/dist/components/Button/utils/ButtonLeftArea.js +3 -3
  22. package/dist/components/Button/utils/ButtonPressedContext.d.ts +1 -0
  23. package/dist/components/Button/utils/ButtonPressedContext.js +2 -0
  24. package/dist/components/Button/utils/ButtonRightArea.d.ts +9 -3
  25. package/dist/components/Button/utils/ButtonRightArea.js +3 -3
  26. package/dist/components/Button/utils/ButtonVariantContext.d.ts +6 -0
  27. package/dist/components/Button/utils/ButtonVariantContext.js +4 -0
  28. package/dist/components/Checkbox/Checkbox.d.ts +6 -7
  29. package/dist/components/Checkbox/Checkbox.js +74 -22
  30. package/dist/components/Chip/Chip.js +13 -7
  31. package/dist/components/Dialog/DialogComponent.js +2 -3
  32. package/dist/components/Dialog/DialogHeader.js +17 -13
  33. package/dist/components/Divider/Divider.js +6 -6
  34. package/dist/components/Input/InputGroup.js +6 -13
  35. package/dist/components/Input/InputGroupAddon.js +5 -5
  36. package/dist/components/Input/InputOtp/InputOtp.js +2 -3
  37. package/dist/components/Input/InputOtp/InputOtpItem.js +2 -3
  38. package/dist/components/Input/InputSwitch/InputSwitch.js +2 -2
  39. package/dist/components/Input/InputSwitch/styles/useHandleStyles.js +13 -11
  40. package/dist/components/Input/InputSwitch/styles/useSliderStyles.d.ts +6 -5
  41. package/dist/components/Input/InputSwitch/styles/useSliderStyles.js +36 -29
  42. package/dist/components/Input/InputTextBase/InputTextBase.d.ts +0 -5
  43. package/dist/components/Input/InputTextBase/InputTextBase.js +41 -26
  44. package/dist/components/Input/InputTextBase/useInputStyles.d.ts +6 -5
  45. package/dist/components/Input/InputTextBase/useInputStyles.js +6 -9
  46. package/dist/components/Input/index.d.ts +0 -1
  47. package/dist/components/Input/index.js +0 -1
  48. package/dist/components/List/Base/ListBase.js +9 -12
  49. package/dist/components/MenuItem/MenuItemAccessory.js +5 -5
  50. package/dist/components/MenuItem/MenuItemIcon.js +4 -5
  51. package/dist/components/MenuItem/Template/MenuItemTemplate.js +8 -5
  52. package/dist/components/Message/Message.js +54 -38
  53. package/dist/components/ProgressBar/ProgressBar.js +2 -3
  54. package/dist/components/ProgressSpinner/ProgressSpinner.js +3 -4
  55. package/dist/components/RadioButton/RadioButton.js +87 -104
  56. package/dist/components/Rating/Rating.js +2 -3
  57. package/dist/components/Rating/RatingClear.js +10 -11
  58. package/dist/components/Rating/RatingItem.js +23 -24
  59. package/dist/components/Rating/RatingItemContainer.js +2 -3
  60. package/dist/components/SelectButton/SelectButton.js +2 -3
  61. package/dist/components/SelectButton/SelectButtonItem.js +22 -49
  62. package/dist/components/Skeleton/Skeleton.js +2 -3
  63. package/dist/components/Slider/Slider.js +4 -6
  64. package/dist/components/Tabs/TabItem/TabItem.js +12 -21
  65. package/dist/components/Tabs/Tabs.js +2 -3
  66. package/dist/components/Tag/Tag.js +44 -29
  67. package/dist/components/Timer/Timer.js +2 -3
  68. package/dist/components/Timer/TimerFlip.js +2 -3
  69. package/dist/components/ToggleButton/ToggleButton.js +159 -35
  70. package/dist/components/Typography/Anchor.js +11 -7
  71. package/dist/components/Typography/Body.js +2 -3
  72. package/dist/components/Typography/Caption.js +9 -4
  73. package/dist/components/Typography/Service.js +13 -7
  74. package/dist/components/Typography/Subtitle.js +3 -6
  75. package/dist/components/Typography/Title.js +3 -6
  76. package/dist/hooks/useChangeTheme.d.ts +2 -1
  77. package/dist/hooks/useChangeTheme.js +10 -3
  78. package/dist/hooks/useFonts.d.ts +2 -1
  79. package/dist/hooks/useFonts.js +3 -3
  80. package/dist/hooks/useTheme.d.ts +2 -1
  81. package/dist/hooks/useTheme.js +6 -4
  82. package/dist/index.d.ts +3 -2
  83. package/dist/index.js +2 -1
  84. package/dist/theme/ThemeContext.d.ts +9 -7
  85. package/dist/theme/ThemeContext.js +21 -14
  86. package/dist/theme/darkTheme.js +1 -0
  87. package/dist/theme/index.d.ts +1 -1
  88. package/dist/theme/index.js +1 -1
  89. package/dist/theme/lightTheme.js +1 -0
  90. package/dist/theme/types.d.ts +1 -0
  91. package/dist/utils/SvgUniversal.d.ts +9 -14
  92. package/dist/utils/SvgUniversal.js +10 -2
  93. package/dist/utils/index.d.ts +1 -0
  94. package/dist/utils/index.js +1 -0
  95. package/package.json +18 -8
  96. package/dist/components/Button/styles/index.d.ts +0 -2
  97. package/dist/components/Button/styles/index.js +0 -2
  98. package/dist/components/Button/styles/useBasicButtonStyles.d.ts +0 -98
  99. package/dist/components/Button/styles/useBasicButtonStyles.js +0 -81
  100. package/dist/components/Button/styles/useDangerButtonStyles.d.ts +0 -63
  101. package/dist/components/Button/styles/useDangerButtonStyles.js +0 -57
  102. package/dist/components/Button/styles/useInfoButtonStyles.d.ts +0 -63
  103. package/dist/components/Button/styles/useInfoButtonStyles.js +0 -56
  104. package/dist/components/Button/styles/useSeverityButtonStyles.d.ts +0 -64
  105. package/dist/components/Button/styles/useSeverityButtonStyles.js +0 -29
  106. package/dist/components/Button/styles/useSuccessButtonStyles.d.ts +0 -63
  107. package/dist/components/Button/styles/useSuccessButtonStyles.js +0 -61
  108. package/dist/components/Button/styles/useWarningButtonStyles.d.ts +0 -63
  109. package/dist/components/Button/styles/useWarningButtonStyles.js +0 -61
  110. package/dist/components/Button/utils/useButtonContainerCallbackStyle.d.ts +0 -3
  111. package/dist/components/Button/utils/useButtonContainerCallbackStyle.js +0 -141
  112. package/dist/components/Button/utils/useButtonLabelStyle.d.ts +0 -3
  113. package/dist/components/Button/utils/useButtonLabelStyle.js +0 -40
  114. package/dist/components/Button/utils/useIconStyle.d.ts +0 -7
  115. package/dist/components/Button/utils/useIconStyle.js +0 -35
  116. package/dist/components/Button/utils/useTypeBasedStyle.d.ts +0 -2
  117. package/dist/components/Button/utils/useTypeBasedStyle.js +0 -4
  118. package/dist/components/Checkbox/hooks/usePressableStyles.d.ts +0 -15
  119. package/dist/components/Checkbox/hooks/usePressableStyles.js +0 -91
  120. package/dist/components/Input/FloatLabel.d.ts +0 -22
  121. package/dist/components/Input/FloatLabel.js +0 -19
  122. package/dist/components/ToggleButton/hooks/useIconSize.d.ts +0 -14
  123. package/dist/components/ToggleButton/hooks/useIconSize.js +0 -26
  124. package/dist/components/ToggleButton/hooks/useLabelSize.d.ts +0 -8
  125. package/dist/components/ToggleButton/hooks/useLabelSize.js +0 -19
  126. package/dist/components/ToggleButton/hooks/useStateStyles.d.ts +0 -11
  127. package/dist/components/ToggleButton/hooks/useStateStyles.js +0 -92
  128. package/dist/utils/makeStyles.d.ts +0 -11
  129. package/dist/utils/makeStyles.js +0 -19
@@ -1,13 +1,148 @@
1
+ import { useContext } from 'react';
1
2
  import { Text } from 'react-native';
3
+ import { StyleSheet } from 'react-native-unistyles';
2
4
  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);
5
+ import { ButtonPressedContext } from './ButtonPressedContext';
6
+ import { ButtonVariantContext } from './ButtonVariantContext';
7
+ const ButtonLabelComponent = ({ label, iconOnly, size, disabled, loading, }) => {
8
+ const pressed = useContext(ButtonPressedContext);
9
+ const { variant, severity } = useContext(ButtonVariantContext);
10
+ buttonLabelStyles.useVariants({
11
+ size,
12
+ variant,
13
+ severity,
14
+ pressed: pressed ? 'true' : 'false',
15
+ disabled: disabled || loading ? 'true' : 'false',
16
+ });
6
17
  if (iconOnly) {
7
18
  return null;
8
19
  }
9
- return (<Text style={labelStyle} testID='Button_Text'>
20
+ return (<Text style={buttonLabelStyles.label} testID='Button_Text'>
10
21
  {label}
11
22
  </Text>);
12
23
  };
13
24
  export const ButtonLabel = genericMemo(ButtonLabelComponent);
25
+ const buttonLabelStyles = StyleSheet.create(({ theme, typography, fonts }) => ({
26
+ label: {
27
+ fontWeight: 600,
28
+ includeFontPadding: false,
29
+ verticalAlign: 'middle',
30
+ fontFamily: fonts.primary,
31
+ variants: {
32
+ size: {
33
+ xlarge: { fontSize: typography.Size['text-xl'] },
34
+ large: { fontSize: typography.Size['text-xl'] },
35
+ base: { fontSize: typography.Size['text-base'] },
36
+ small: { fontSize: typography.Size['text-sm'] },
37
+ },
38
+ variant: {
39
+ primary: { color: theme.Button.Brand.buttonTextColor },
40
+ secondary: { color: theme.Button.Primary.secondaryButtonTextColor },
41
+ tertiary: { color: theme.Button.Secondary.helpButtonTextColor },
42
+ text: { color: theme.Button.Text.textButtonTextColor },
43
+ link: { color: theme.Button.Text.textButtonTextColor },
44
+ basic: { color: theme.Button.Brand.buttonTextColor },
45
+ outlined: { color: theme.Button.Brand.buttonTextColor },
46
+ },
47
+ severity: { info: {}, success: {}, warning: {}, danger: {} },
48
+ pressed: { true: {}, false: {} },
49
+ disabled: {
50
+ true: { color: theme.Button.Disabled.disabledButtonTextColor },
51
+ false: {},
52
+ },
53
+ },
54
+ compoundVariants: [
55
+ // link pressed color change
56
+ {
57
+ variant: 'link',
58
+ pressed: 'true',
59
+ styles: { color: typography.Color.Common['text-color-secondary'] },
60
+ },
61
+ // severity label colors
62
+ {
63
+ variant: 'basic',
64
+ severity: 'info',
65
+ styles: { color: theme.Button.Severity.Info.Basic.infoButtonTextColor },
66
+ },
67
+ {
68
+ variant: 'outlined',
69
+ severity: 'info',
70
+ styles: {
71
+ color: theme.Button.Severity.Info.Outlined.infoOutlinedButtonTextColor,
72
+ },
73
+ },
74
+ {
75
+ variant: 'text',
76
+ severity: 'info',
77
+ styles: {
78
+ color: theme.Button.Severity.Info.Text.infoTextButtonTextColor,
79
+ },
80
+ },
81
+ {
82
+ variant: 'basic',
83
+ severity: 'success',
84
+ styles: {
85
+ color: theme.Button.Severity.Success.Basic.successButtonTextColor,
86
+ },
87
+ },
88
+ {
89
+ variant: 'outlined',
90
+ severity: 'success',
91
+ styles: {
92
+ color: theme.Button.Severity.Success.Outlined
93
+ .successOutlinedButtonTextColor,
94
+ },
95
+ },
96
+ {
97
+ variant: 'text',
98
+ severity: 'success',
99
+ styles: {
100
+ color: theme.Button.Severity.Success.Text.successTextButtonTextColor,
101
+ },
102
+ },
103
+ {
104
+ variant: 'basic',
105
+ severity: 'warning',
106
+ styles: {
107
+ color: theme.Button.Severity.Warning.Basic.warningButtonTextColor,
108
+ },
109
+ },
110
+ {
111
+ variant: 'outlined',
112
+ severity: 'warning',
113
+ styles: {
114
+ color: theme.Button.Severity.Warning.Outlined
115
+ .warningOutlinedButtonTextColor,
116
+ },
117
+ },
118
+ {
119
+ variant: 'text',
120
+ severity: 'warning',
121
+ styles: {
122
+ color: theme.Button.Severity.Warning.Text.warningTextButtonTextColor,
123
+ },
124
+ },
125
+ {
126
+ variant: 'basic',
127
+ severity: 'danger',
128
+ styles: {
129
+ color: theme.Button.Severity.Danger.Basic.dangerButtonTextColor,
130
+ },
131
+ },
132
+ {
133
+ variant: 'outlined',
134
+ severity: 'danger',
135
+ styles: {
136
+ color: theme.Button.Severity.Danger.Outlined.dangerOutlinedButtonTextColor,
137
+ },
138
+ },
139
+ {
140
+ variant: 'text',
141
+ severity: 'danger',
142
+ styles: {
143
+ color: theme.Button.Severity.Danger.Text.dangerTextButtonTextColor,
144
+ },
145
+ },
146
+ ],
147
+ },
148
+ }));
@@ -1,4 +1,9 @@
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;
1
+ import type { BaseButtonProps, ButtonSize } from '../types';
2
+ export interface ButtonLeftAreaProps {
3
+ readonly size: ButtonSize;
4
+ readonly iconPosition?: BaseButtonProps<never>['iconPosition'];
5
+ readonly loading: boolean;
6
+ readonly disabled: boolean;
7
+ readonly Icon?: BaseButtonProps<never>['Icon'];
8
+ }
9
+ export declare const ButtonLeftArea: ({ size, iconPosition, Icon, loading, disabled, }: ButtonLeftAreaProps) => import("react").JSX.Element | null;
@@ -1,12 +1,12 @@
1
1
  import { genericMemo } from '../../../utils/genericMemo';
2
2
  import { ButtonActivityIndicator } from './ButtonActivityIndicator';
3
3
  import { ButtonIcon } from './ButtonIcon';
4
- export const ButtonLeftAreaComponent = ({ size, iconPosition, variant, Icon, loading, disabled, iconVariantStyles, }) => {
5
- if (iconPosition === 'left' || iconPosition === 'prefix') {
4
+ const ButtonLeftAreaComponent = ({ size, iconPosition, Icon, loading, disabled, }) => {
5
+ if (iconPosition === 'prefix') {
6
6
  if (loading && !disabled) {
7
7
  return <ButtonActivityIndicator size={size}/>;
8
8
  }
9
- return (<ButtonIcon {...{ size, variant, disabled, loading, Icon, iconVariantStyles }}/>);
9
+ return <ButtonIcon {...{ size, disabled, loading, Icon }}/>;
10
10
  }
11
11
  return null;
12
12
  };
@@ -0,0 +1 @@
1
+ export declare const ButtonPressedContext: import("react").Context<boolean>;
@@ -0,0 +1,2 @@
1
+ import { createContext } from 'react';
2
+ export const ButtonPressedContext = createContext(false);
@@ -1,3 +1,9 @@
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;
1
+ import type { BaseButtonProps, ButtonSize } from '../types';
2
+ export interface ButtonRightAreaProps {
3
+ readonly size: ButtonSize;
4
+ readonly iconPosition?: BaseButtonProps<never>['iconPosition'];
5
+ readonly loading: boolean;
6
+ readonly disabled: boolean;
7
+ readonly Icon?: BaseButtonProps<never>['Icon'];
8
+ }
9
+ export declare const ButtonRightArea: ({ size, iconPosition, Icon, loading, disabled, }: ButtonRightAreaProps) => import("react").JSX.Element | null;
@@ -1,12 +1,12 @@
1
1
  import { genericMemo } from '../../../utils/genericMemo';
2
2
  import { ButtonActivityIndicator } from './ButtonActivityIndicator';
3
3
  import { ButtonIcon } from './ButtonIcon';
4
- const ButtonRightAreaComponent = ({ size, iconPosition, variant, Icon, loading, disabled, iconVariantStyles, }) => {
5
- if (iconPosition === 'right' || iconPosition === 'postfix') {
4
+ const ButtonRightAreaComponent = ({ size, iconPosition, Icon, loading, disabled, }) => {
5
+ if (iconPosition === 'postfix') {
6
6
  if (loading && !disabled) {
7
7
  return <ButtonActivityIndicator size={size}/>;
8
8
  }
9
- return (<ButtonIcon {...{ size, variant, disabled, loading, Icon, iconVariantStyles }}/>);
9
+ return <ButtonIcon {...{ size, disabled, loading, Icon }}/>;
10
10
  }
11
11
  return null;
12
12
  };
@@ -0,0 +1,6 @@
1
+ import type { ButtonSeverity, ButtonVariant } from '../types';
2
+ export interface ButtonVariantContextValue {
3
+ variant: ButtonVariant;
4
+ severity?: ButtonSeverity;
5
+ }
6
+ export declare const ButtonVariantContext: import("react").Context<ButtonVariantContextValue>;
@@ -0,0 +1,4 @@
1
+ import { createContext } from 'react';
2
+ export const ButtonVariantContext = createContext({
3
+ variant: 'primary',
4
+ });
@@ -1,31 +1,30 @@
1
- import React from 'react';
2
1
  import { type AccessibilityProps } from 'react-native';
3
2
  import type { ViewProps } from 'react-native-svg/lib/typescript/fabric/utils';
4
3
  type CheckboxState = 'default' | 'danger';
5
4
  export interface CheckboxProps extends AccessibilityProps, Pick<ViewProps, 'testID'> {
6
5
  /** Обработчик нажатия на чекбокс */
7
- readonly onPress: () => void;
6
+ onPress: () => void;
8
7
  /**
9
8
  * true, если необходим компонент в активном состоянии
10
9
  * @default false
11
10
  */
12
- readonly checked?: boolean;
11
+ checked?: boolean;
13
12
  /**
14
13
  * true, если необходим компонент в неопределенном состоянии
15
14
  * @default false
16
15
  */
17
- readonly indeterminate?: boolean;
16
+ indeterminate?: boolean;
18
17
  /**
19
18
  * Управление доступностью компонента
20
19
  * @default false
21
20
  */
22
- readonly disabled?: boolean;
21
+ disabled?: boolean;
23
22
  /** Выбор состояния компонента */
24
- readonly state: CheckboxState;
23
+ state: CheckboxState;
25
24
  }
26
25
  /**
27
26
  * Используется для множественного выбора элементов
28
27
  * @see https://www.figma.com/design/4TYeki0MDLhfPGJstbIicf/UI-kit-PrimeFace-(DS)?node-id=484-5316
29
28
  */
30
- export declare const Checkbox: React.NamedExoticComponent<CheckboxProps>;
29
+ export declare const Checkbox: import("react").NamedExoticComponent<CheckboxProps>;
31
30
  export {};
@@ -1,14 +1,21 @@
1
1
  import { IconCheck, IconMinus } from '@tabler/icons-react-native';
2
- import React, { memo, useCallback, useMemo, useState } from 'react';
3
- import { Pressable, StyleSheet, View, } from 'react-native';
4
- import { makeStyles } from '../../utils/makeStyles';
5
- import { usePressableStyles } from './hooks/usePressableStyles';
2
+ import { memo, useCallback, useMemo, useState } from 'react';
3
+ import { StyleSheet as RNStyleSheet, Pressable, View, } from 'react-native';
4
+ import { StyleSheet } from 'react-native-unistyles';
5
+ import { SvgUniversal } from '../../utils';
6
6
  /**
7
7
  * Используется для множественного выбора элементов
8
8
  * @see https://www.figma.com/design/4TYeki0MDLhfPGJstbIicf/UI-kit-PrimeFace-(DS)?node-id=484-5316
9
9
  */
10
10
  export const Checkbox = memo(({ onPress, checked = false, disabled = false, indeterminate = false, testID, state, }) => {
11
11
  const [isPressed, setIsPressed] = useState(false);
12
+ const filled = checked || indeterminate;
13
+ styles.useVariants({
14
+ filled: filled ? 'true' : 'false',
15
+ pressed: isPressed ? 'true' : 'false',
16
+ state: state === 'danger' ? 'danger' : undefined,
17
+ disabled: disabled ? 'true' : 'false',
18
+ });
12
19
  const Icon = useMemo(() => {
13
20
  if (indeterminate) {
14
21
  return IconMinus;
@@ -18,38 +25,83 @@ export const Checkbox = memo(({ onPress, checked = false, disabled = false, inde
18
25
  }
19
26
  return null;
20
27
  }, [indeterminate, checked]);
21
- const getPressableStyles = usePressableStyles({
22
- checked,
23
- indeterminate,
24
- disabled,
25
- state,
26
- });
27
- const styles = useStyles();
28
28
  const onPressIn = useCallback(() => {
29
29
  setIsPressed(true);
30
30
  }, []);
31
31
  const onPressOut = useCallback(() => {
32
32
  setIsPressed(false);
33
33
  }, []);
34
- const pressableStyles = useMemo(() => {
35
- return getPressableStyles(isPressed);
36
- }, [getPressableStyles, isPressed]);
37
34
  return (<Pressable accessibilityRole='button' disabled={disabled} hitSlop={10} style={styles.container} testID={testID || 'CheckboxButton_Pressable'} onPress={onPress} onPressIn={onPressIn} onPressOut={onPressOut}>
38
- <View style={[styles.background, pressableStyles]}/>
39
- {Icon ? (<Icon height={styles.icon.height} style={styles.icon} width={styles.icon.width}/>) : null}
35
+ <View style={[styles.background, styles.backgroundState]}/>
36
+ {Icon ? (<SvgUniversal {...styles.icon} source={Icon} uniProps={({ theme }) => ({
37
+ color: theme.Form.Checkbox.checkboxIconActiveColor,
38
+ })}/>) : null}
40
39
  </Pressable>);
41
40
  });
42
- const useStyles = makeStyles(({ theme, sizing }) => ({
41
+ const styles = StyleSheet.create(({ theme, border, sizing }) => ({
43
42
  container: {
44
43
  justifyContent: 'center',
45
44
  alignItems: 'center',
46
45
  width: theme.Form.Checkbox.checkboxWidth,
47
46
  height: theme.Form.Checkbox.checkboxHeight,
48
47
  },
49
- background: { ...StyleSheet.absoluteFillObject },
50
- icon: {
51
- height: sizing.Height['h-1'],
52
- width: sizing.Width['w-1'],
53
- color: theme.Form.Checkbox.checkboxIconActiveColor,
48
+ background: { ...RNStyleSheet.absoluteFillObject },
49
+ backgroundState: {
50
+ borderRadius: border.Radius['rounded-lg'],
51
+ borderWidth: border.Width.border,
52
+ variants: {
53
+ filled: {
54
+ true: {
55
+ backgroundColor: theme.Form.Checkbox.checkboxActiveBg,
56
+ borderColor: theme.Form.Checkbox.checkboxActiveBorderColor,
57
+ },
58
+ false: {
59
+ backgroundColor: theme.Form.InputText.inputBg,
60
+ borderColor: theme.Form.InputText.inputBorderColor,
61
+ },
62
+ },
63
+ pressed: {
64
+ true: { borderColor: theme.Form.InputText.inputHoverBorderColor },
65
+ false: {},
66
+ },
67
+ state: {
68
+ danger: {
69
+ borderColor: theme.Form.InputText.inputErrorBorderColor,
70
+ outlineStyle: 'solid',
71
+ outlineColor: theme.General.focusOutlineErrorColor,
72
+ outlineWidth: Math.round(theme.General.focusShadowWidth),
73
+ },
74
+ },
75
+ disabled: { true: { outlineWidth: 0 }, false: {} },
76
+ },
77
+ compoundVariants: [
78
+ {
79
+ filled: 'true',
80
+ pressed: 'true',
81
+ styles: {
82
+ backgroundColor: theme.Form.Checkbox.checkboxActiveHoverBg,
83
+ borderColor: theme.Form.Checkbox.checkboxActiveHoverBorderColor,
84
+ },
85
+ },
86
+ {
87
+ filled: 'false',
88
+ disabled: 'true',
89
+ styles: {
90
+ backgroundColor: theme.Button.Disabled.disabledButtonBg,
91
+ borderColor: theme.Form.InputText.inputBorderColor,
92
+ mixBlendMode: 'luminosity',
93
+ },
94
+ },
95
+ {
96
+ filled: 'true',
97
+ disabled: 'true',
98
+ styles: {
99
+ borderColor: theme.Form.Checkbox.checkboxActiveBorderColor,
100
+ opacity: 0.2,
101
+ mixBlendMode: 'luminosity',
102
+ },
103
+ },
104
+ ],
54
105
  },
106
+ icon: { height: sizing.Height['h-1'], width: sizing.Width['w-1'] },
55
107
  }));
@@ -1,28 +1,36 @@
1
1
  import { IconX } from '@tabler/icons-react-native';
2
2
  import { memo } from 'react';
3
3
  import { Text, Pressable } from 'react-native';
4
+ import { StyleSheet } from 'react-native-unistyles';
4
5
  import { SvgUniversal } from '../../utils/SvgUniversal';
5
- import { makeStyles } from '../../utils/makeStyles';
6
6
  /**
7
7
  * Компонет Нажимабельного тега с возможностью закрытия
8
8
  * Используется для представления массива данных в виде меток
9
9
  * @see https://www.figma.com/design/4TYeki0MDLhfPGJstbIicf/UI-kit-PrimeFace-(DS)?node-id=484-5126&t=jMMaE0JO924pG1ga-4
10
10
  */
11
11
  export const Chip = memo(({ Icon, label, disabled, testID, onClose, showClose = !!onClose, showIcon = true, ...rest }) => {
12
- const styles = useStyles();
12
+ const iconUniProps = ({ theme }) => ({
13
+ color: disabled
14
+ ? theme.Button.Disabled.disabledButtonTextColor
15
+ : theme.Misc.Chip.chipTextColor,
16
+ });
13
17
  return (<Pressable {...rest} disabled={disabled} style={[styles.chip, disabled && styles.disabledChip]} testID={testID || TestId.Container}>
14
- {showIcon && Icon ? (<SvgUniversal color={disabled ? styles.disabledIcon.color : styles.icon.color} height={styles.icon.height} source={Icon} width={styles.icon.width}/>) : null}
18
+ {showIcon && Icon ? (<SvgUniversal {...styles.icon} source={Icon} uniProps={iconUniProps}/>) : null}
15
19
 
16
20
  <Text numberOfLines={1} style={[styles.text, disabled && styles.disabledText]}>
17
21
  {label}
18
22
  </Text>
19
23
 
20
24
  {showClose ? (<Pressable disabled={disabled} testID={TestId.RemoveButton} onPress={onClose}>
21
- {({ pressed }) => (<IconX color={disabled ? styles.disabledIcon.color : styles.icon.color} height={styles.icon.height} style={pressed ? styles.pressedClose : null} width={styles.icon.width}/>)}
25
+ {({ pressed }) => (<SvgUniversal {...styles.icon} source={IconX} style={pressed ? styles.pressedClose : null} uniProps={({ theme }) => ({
26
+ color: disabled
27
+ ? theme.Button.Disabled.disabledButtonTextColor
28
+ : theme.Misc.Chip.chipTextColor,
29
+ })}/>)}
22
30
  </Pressable>) : null}
23
31
  </Pressable>);
24
32
  });
25
- const useStyles = makeStyles(({ theme, typography, border, fonts }) => ({
33
+ const styles = StyleSheet.create(({ theme, typography, border, fonts }) => ({
26
34
  chip: {
27
35
  height: theme.Misc.Chip.chipHeight,
28
36
  alignSelf: 'flex-start',
@@ -46,9 +54,7 @@ const useStyles = makeStyles(({ theme, typography, border, fonts }) => ({
46
54
  icon: {
47
55
  width: typography.Size['text-base'],
48
56
  height: typography.Size['text-base'],
49
- color: theme.Misc.Chip.chipTextColor,
50
57
  },
51
- disabledIcon: { color: theme.Button.Disabled.disabledButtonTextColor },
52
58
  text: {
53
59
  fontSize: typography.Size['text-base'],
54
60
  verticalAlign: 'middle',
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
2
  import { View, useWindowDimensions } from 'react-native';
3
- import { makeStyles } from '../../utils/makeStyles';
3
+ import { StyleSheet } from 'react-native-unistyles';
4
4
  export const DialogComponent = ({ body: Body, footer: Footer, header = null, }) => {
5
- const styles = useStyles();
6
5
  const { width, height } = useWindowDimensions();
7
6
  const maxSize = { maxWidth: width - 40, maxHeight: height - 100 };
8
7
  return (<View style={[styles.root, maxSize]}>
@@ -17,7 +16,7 @@ export const DialogComponent = ({ body: Body, footer: Footer, header = null, })
17
16
  </View>) : null}
18
17
  </View>);
19
18
  };
20
- const useStyles = makeStyles(({ theme }) => ({
19
+ const styles = StyleSheet.create(({ theme }) => ({
21
20
  root: {
22
21
  backgroundColor: theme.Overlay.Dialog.Header.dialogHeaderBg,
23
22
  borderColor: theme.Overlay.Overlay.overlayContentBorderColor,
@@ -1,7 +1,8 @@
1
1
  import { IconAlertTriangle, IconCircleCheck, IconCircleX, IconHelpCircle, IconInfoCircle, IconX, } from '@tabler/icons-react-native';
2
2
  import { useMemo } from 'react';
3
3
  import { TouchableOpacity, View } from 'react-native';
4
- import { makeStyles } from '../../utils/makeStyles';
4
+ import { StyleSheet } from 'react-native-unistyles';
5
+ import { SvgUniversal } from '../../utils';
5
6
  import { Title } from '../Typography';
6
7
  const iconsMap = {
7
8
  danger: IconCircleX,
@@ -11,14 +12,21 @@ const iconsMap = {
11
12
  help: IconHelpCircle,
12
13
  };
13
14
  export const DialogHeader = ({ title, onClose, severity, }) => {
14
- const styles = useStyles();
15
15
  const tids = DialogHeaderTestId;
16
16
  const icon = useMemo(() => {
17
17
  if (!severity)
18
18
  return null;
19
- const Icon = iconsMap[severity];
20
- return <Icon {...styles.severityIcon} {...styles[severity]}/>;
21
- }, [severity, styles]);
19
+ const source = iconsMap[severity];
20
+ return (<SvgUniversal {...styles.severityIcon} source={source} uniProps={({ typography: t }) => ({
21
+ color: {
22
+ danger: t.Color.Service['text-danger'],
23
+ warning: t.Color.Service['text-warning'],
24
+ info: t.Color.Service['text-info'],
25
+ success: t.Color.Service['text-success'],
26
+ help: t.Color.Service['text-help'],
27
+ }[severity],
28
+ })}/>);
29
+ }, [severity]);
22
30
  return (<>
23
31
  <View style={styles.header}>
24
32
  {icon}
@@ -26,14 +34,16 @@ export const DialogHeader = ({ title, onClose, severity, }) => {
26
34
  {title}
27
35
  </Title>
28
36
  {onClose ? (<TouchableOpacity style={styles.closeTouchable} testID={tids.closeButton} onPress={onClose}>
29
- <IconX {...styles.closeIcon}/>
37
+ <SvgUniversal {...styles.closeIcon} source={IconX} uniProps={({ theme }) => ({
38
+ color: theme.General.actionIconColor,
39
+ })}/>
30
40
  </TouchableOpacity>) : null}
31
41
  </View>
32
42
 
33
43
  <View style={styles.separator}/>
34
44
  </>);
35
45
  };
36
- const useStyles = makeStyles(({ theme, spacing, typography, border }) => ({
46
+ const styles = StyleSheet.create(({ theme, spacing, typography, border }) => ({
37
47
  text: { flex: 1 },
38
48
  header: {
39
49
  flexDirection: 'row',
@@ -50,17 +60,11 @@ const useStyles = makeStyles(({ theme, spacing, typography, border }) => ({
50
60
  closeIcon: {
51
61
  width: typography.Size['text-base'],
52
62
  height: typography.Size['text-base'],
53
- color: theme.General.actionIconColor,
54
63
  },
55
64
  severityIcon: {
56
65
  width: typography.Size['text-2xl'],
57
66
  height: typography.Size['text-2xl'],
58
67
  },
59
- danger: { color: typography.Color.Service['text-danger'] },
60
- warning: { color: typography.Color.Service['text-warning'] },
61
- info: { color: typography.Color.Service['text-info'] },
62
- success: { color: typography.Color.Service['text-success'] },
63
- help: { color: typography.Color.Service['text-help'] },
64
68
  }));
65
69
  export const DialogHeaderTestId = {
66
70
  title: 'DialogTitle',
@@ -1,18 +1,17 @@
1
1
  import { memo, useMemo } from 'react';
2
2
  import { View } from 'react-native';
3
+ import { StyleSheet } from 'react-native-unistyles';
3
4
  import { SvgUniversal } from '../../utils/SvgUniversal';
4
- import { makeStyles } from '../../utils/makeStyles';
5
5
  import { Subtitle } from '../Typography';
6
6
  /**
7
7
  * Используется для визуального разделения контента
8
8
  * @see https://www.figma.com/design/4TYeki0MDLhfPGJstbIicf/UI-kit-PrimeFace-(DS)?node-id=484-5178
9
9
  */
10
10
  export const Divider = memo(({ align = 'center', layout = 'horizontal', showContent: showContentProp = true, showIcon: showIconProp = true, text, type = 'solid', style, Icon, }) => {
11
- const styles = useStyles();
12
11
  const isVertical = useMemo(() => layout === 'vertical', [layout]);
13
12
  const showIcon = useMemo(() => !!(showIconProp && Icon), [Icon, showIconProp]);
14
13
  const showContent = useMemo(() => !!(showContentProp && (showIcon || text)), [showContentProp, showIcon, text]);
15
- const lineStyle = useMemo(() => [styles.line, type === 'dash' && styles.lineDash], [styles.line, styles.lineDash, type]);
14
+ const lineStyle = useMemo(() => [styles.line, type === 'dash' && styles.lineDash], [type]);
16
15
  return (<View style={[
17
16
  styles.container,
18
17
  isVertical && styles.containerVertical,
@@ -32,7 +31,9 @@ export const Divider = memo(({ align = 'center', layout = 'horizontal', showCont
32
31
  </View>
33
32
 
34
33
  <View style={[styles.content, isVertical && styles.contentVertical]}>
35
- {showIcon && Icon ? (<SvgUniversal height={styles.icon.height} source={Icon} style={styles.icon} width={styles.icon.width}/>) : null}
34
+ {showIcon && Icon ? (<SvgUniversal {...styles.icon} source={Icon} uniProps={({ theme }) => ({
35
+ color: theme.General.textSecondaryColor,
36
+ })}/>) : null}
36
37
  {text ? (<Subtitle color='secondary' style={styles.text}>
37
38
  {text}
38
39
  </Subtitle>) : null}
@@ -44,7 +45,7 @@ export const Divider = memo(({ align = 'center', layout = 'horizontal', showCont
44
45
  </View>
45
46
  </View>);
46
47
  });
47
- const useStyles = makeStyles(({ spacing, theme, sizing, typography }) => ({
48
+ const styles = StyleSheet.create(({ spacing, theme, sizing, typography }) => ({
48
49
  container: {
49
50
  minHeight: sizing.Height['h-2'],
50
51
  flexDirection: 'row',
@@ -89,7 +90,6 @@ const useStyles = makeStyles(({ spacing, theme, sizing, typography }) => ({
89
90
  icon: {
90
91
  width: typography.Size['text-base'],
91
92
  height: typography.Size['text-base'],
92
- color: theme.General.textSecondaryColor,
93
93
  },
94
94
  text: { flexShrink: 1 },
95
95
  }));
@@ -1,6 +1,6 @@
1
1
  import { memo, useCallback, useImperativeHandle, useMemo, useRef } from 'react';
2
- import { View, StyleSheet, } from 'react-native';
3
- import { makeStyles } from '../../utils/makeStyles';
2
+ import { View, StyleSheet as RNStyleSheet, } from 'react-native';
3
+ import { StyleSheet } from 'react-native-unistyles';
4
4
  import { InputGroupAddon } from './InputGroupAddon';
5
5
  import { InputTextBase } from './InputTextBase/InputTextBase';
6
6
  /**
@@ -10,23 +10,16 @@ import { InputTextBase } from './InputTextBase/InputTextBase';
10
10
  * @see InputGroupAddon
11
11
  */
12
12
  export const InputGroup = memo(({ left, right, style, disabled, inputRef: propsInputRef, ...otherProps }) => {
13
- const styles = useStyles();
14
13
  const inputRef = useRef(null);
15
14
  const focus = useCallback(() => inputRef.current?.focus(), [inputRef]);
16
- useImperativeHandle(propsInputRef, () => (inputRef.current ? inputRef.current : null), [inputRef]);
15
+ useImperativeHandle(propsInputRef, () => inputRef.current, [inputRef]);
17
16
  const containerStyle = useMemo(() => {
18
- return StyleSheet.flatten([
17
+ return RNStyleSheet.flatten([
19
18
  styles.inputContainer,
20
19
  !!left && styles.inputContainerForLeftAddon,
21
20
  !!right && styles.inputContainerForRightAddon,
22
21
  ]);
23
- }, [
24
- left,
25
- right,
26
- styles.inputContainer,
27
- styles.inputContainerForLeftAddon,
28
- styles.inputContainerForRightAddon,
29
- ]);
22
+ }, [left, right]);
30
23
  return (<View style={[styles.container, style]}>
31
24
  {left ? (<InputGroupAddon content={left} disabled={disabled} position='left' onPress={focus}/>) : null}
32
25
 
@@ -37,7 +30,7 @@ export const InputGroup = memo(({ left, right, style, disabled, inputRef: propsI
37
30
  {right ? (<InputGroupAddon content={right} disabled={disabled} position='right' onPress={focus}/>) : null}
38
31
  </View>);
39
32
  });
40
- const useStyles = makeStyles(() => ({
33
+ const styles = StyleSheet.create(() => ({
41
34
  container: { flexDirection: 'row' },
42
35
  inputWrapper: { flexGrow: 1, zIndex: 10 },
43
36
  inputContainer: { flexGrow: 1 },