@itcase/ui-react-native 1.10.86 → 1.10.89

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 (52) hide show
  1. package/package.json +2 -2
  2. package/src/components/Avatar/Avatar.interface.ts +4 -3
  3. package/src/components/Badge/Badge.interface.ts +4 -4
  4. package/src/components/Button/Button.interface.ts +3 -3
  5. package/src/components/Button/Button.tsx +1 -7
  6. package/src/components/Button/stories/ButtonDefault.stories.tsx +2 -2
  7. package/src/components/Button/stories/ButtonGallery.stories.tsx +1 -1
  8. package/src/components/Button/stories/ButtonIcon.stories.tsx +1 -1
  9. package/src/components/Checkbox/Checkbox.interface.ts +22 -23
  10. package/src/components/Checkmark/Checkmark.tsx +1 -1
  11. package/src/components/Chips/Chips.interface.ts +7 -6
  12. package/src/components/Choice/Choice.interface.ts +22 -22
  13. package/src/components/Choice/Choice.tsx +1 -13
  14. package/src/components/Code/Code.interface.ts +13 -13
  15. package/src/components/Code/Code.tsx +1 -12
  16. package/src/components/ColorInput/ColorInput.interface.ts +8 -9
  17. package/src/components/DatePicker/DatePicker.interface.ts +3 -1
  18. package/src/components/Divider/Divider.interface.ts +3 -2
  19. package/src/components/Drawer/Drawer.interface.ts +2 -1
  20. package/src/components/Dropdown/Dropdown.interface.ts +4 -4
  21. package/src/components/HeroTitle/HeroTitle.interface.ts +2 -2
  22. package/src/components/Icon/Icon.interface.ts +2 -2
  23. package/src/components/Input/Input.interface.ts +17 -22
  24. package/src/components/Input/Input.tsx +3 -11
  25. package/src/components/InputNumber/InputNumber.interface.ts +19 -21
  26. package/src/components/InputNumber/InputNumber.tsx +3 -11
  27. package/src/components/InputPassword/InputPassword.interface.ts +24 -25
  28. package/src/components/InputPassword/InputPassword.tsx +3 -11
  29. package/src/components/Label/Label.interface.ts +3 -3
  30. package/src/components/Label/Label.tsx +0 -1
  31. package/src/components/Link/Link.interface.ts +6 -5
  32. package/src/components/Link/Link.tsx +3 -7
  33. package/src/components/Link/stories/Link.stories.tsx +1 -1
  34. package/src/components/List/List.interface.ts +3 -2
  35. package/src/components/Loader/Loader.interface.ts +3 -3
  36. package/src/components/Loader/Loader.tsx +1 -13
  37. package/src/components/MenuItem/MenuItem.interface.ts +5 -4
  38. package/src/components/Pagination/Pagination.tsx +5 -4
  39. package/src/components/Pressable/Pressable.interface.ts +2 -2
  40. package/src/components/Pressable/stories/PressableGallery.stories.tsx +1 -1
  41. package/src/components/Radio/Radio.interface.ts +15 -15
  42. package/src/components/Search/Search.tsx +10 -3
  43. package/src/components/Segmented/Segmented.interface.ts +2 -2
  44. package/src/components/Select/Select.interface.ts +5 -4
  45. package/src/components/Switch/Switch.interface.ts +10 -10
  46. package/src/components/Switch/Switch.tsx +2 -19
  47. package/src/components/Textarea/Textarea.interface.ts +19 -20
  48. package/src/components/Textarea/Textarea.tsx +3 -11
  49. package/src/components/Tile/Tile.interface.ts +4 -3
  50. package/src/components/Tile/stories/TileSwap.stories.tsx +3 -9
  51. package/src/components/Tooltip/Tooltip.interface.ts +2 -3
  52. package/src/components/Warning/Warning.interface.ts +3 -3
@@ -1,10 +1,5 @@
1
1
  import type { ReactNode } from 'react'
2
- import type {
3
- StyleProp,
4
- TextInputFocusEvent,
5
- TextInputSubmitEditingEvent,
6
- ViewStyle,
7
- } from 'react-native'
2
+ import type { StyleProp, TextInputProps, ViewStyle } from 'react-native'
8
3
 
9
4
  import type {
10
5
  AppearanceConfig,
@@ -40,17 +35,6 @@ interface InputAppearanceProps {
40
35
  width?: WidthProps
41
36
  }
42
37
 
43
- type InputAppearanceKey = AppearanceKeysState | CompositeAppearanceStateDefault
44
- type InputConfig = AppearanceConfig<AppearanceKeysState, InputAppearanceProps>
45
- type InputAppearance = InputConfig['appearance']
46
- type InputAppearanceStyle = AppearanceRecord<
47
- AppearanceStyleKey,
48
- InputAppearanceProps,
49
- 'borderColor' | 'fill'
50
- >
51
- type InputAppearanceShape = Partial<
52
- Record<AppearanceShapeKey, Partial<Pick<InputAppearanceProps, 'shape'>>>
53
- >
54
38
  type InputAppearanceSize = AppearancePartialRecord<
55
39
  AppearanceSizeKey,
56
40
  InputAppearanceProps,
@@ -61,13 +45,12 @@ interface InputProps extends InputAppearanceProps {
61
45
  isDisabled?: boolean
62
46
  isError?: boolean
63
47
  isReadOnly?: boolean
64
- onBlur?: (event: TextInputFocusEvent) => void
48
+ onBlur?: TextInputProps['onBlur']
65
49
  onChangeText?: (text: string) => void
66
- onFocus?: (event: TextInputFocusEvent) => void
67
- onSubmitEditing?: (event: TextInputSubmitEditingEvent) => void
50
+ onFocus?: TextInputProps['onFocus']
51
+ onSubmitEditing?: TextInputProps['onSubmitEditing']
68
52
  after?: ReactNode
69
- appearance?: InputAppearanceKey
70
- appearanceStyle?: AppearanceStyleKey
53
+ appearance?: CompositeAppearanceStateDefault
71
54
  before?: ReactNode
72
55
  maxLength?: number
73
56
  placeholder?: string
@@ -75,6 +58,18 @@ interface InputProps extends InputAppearanceProps {
75
58
  value?: string
76
59
  }
77
60
 
61
+ type InputConfig = AppearanceConfig<AppearanceKeysState, InputAppearanceProps>
62
+ type InputAppearance = InputConfig['appearance']
63
+ type InputAppearanceStyle = AppearanceRecord<
64
+ AppearanceStyleKey,
65
+ InputAppearanceProps,
66
+ 'borderColor' | 'fill'
67
+ >
68
+ type InputAppearanceShape = Partial<
69
+ Record<AppearanceShapeKey, Partial<Pick<InputAppearanceProps, 'shape'>>>
70
+ >
71
+ type InputAppearanceKey = NonNullable<InputProps['appearance']>
72
+
78
73
  type InputGalleryStory = ComponentGalleryArgs &
79
74
  Pick<InputProps, 'isDisabled' | 'placeholder' | 'value'>
80
75
 
@@ -26,7 +26,6 @@ function Input(props: InputProps) {
26
26
  const {
27
27
  appearance = 'defaultPrimary sizeXL solid rounded',
28
28
  maxLength,
29
- appearanceStyle,
30
29
  placeholder,
31
30
  style,
32
31
  value,
@@ -42,19 +41,12 @@ function Input(props: InputProps) {
42
41
  } = props
43
42
 
44
43
  const resolvedAppearance = useMemo(() => {
45
- const appearanceTokens = appearance.split(' ')
46
- const isCompositeAppearance = appearanceTokens.length > 1
47
-
48
- let result = isCompositeAppearance
49
- ? appearance
50
- : mergeAppearanceKeys(appearance, appearanceStyle || 'solid')
51
-
52
44
  if (isError) {
53
- result = mergeAppearanceKeys(result, 'errorPrimary')
45
+ return mergeAppearanceKeys(appearance, 'errorPrimary')
54
46
  }
55
47
 
56
- return result
57
- }, [appearance, appearanceStyle, isError])
48
+ return appearance
49
+ }, [appearance, isError])
58
50
 
59
51
  const appearanceConfig = useAppearanceConfig(
60
52
  resolvedAppearance,
@@ -1,4 +1,4 @@
1
- import type { StyleProp, TextInputFocusEvent, ViewStyle } from 'react-native'
1
+ import type { StyleProp, TextInputProps, ViewStyle } from 'react-native'
2
2
 
3
3
  import type {
4
4
  AppearanceConfig,
@@ -16,7 +16,7 @@ import type {
16
16
 
17
17
  import type { ComponentGalleryArgs } from '../../storybook'
18
18
  import type { buttonSizePropsType } from '../Button/styles/buttonSize'
19
- import type { SvgIconComponent } from '../Icon/Icon.interface'
19
+ import type { IconProps, SvgIconComponent } from '../Icon/Icon.interface'
20
20
  import type { iconSizePropsType } from '../Icon/styles/iconSize'
21
21
  import type { inputNumberShapePropsType } from './styles/inputNumberShape'
22
22
  import type { inputNumberSizePropsType } from './styles/inputNumberSize'
@@ -26,7 +26,7 @@ interface InputNumberAppearanceProps {
26
26
  buttonFill?: FillProps
27
27
  buttonSize?: buttonSizePropsType
28
28
  fill?: FillProps
29
- iconAppearance?: string
29
+ iconAppearance?: IconProps['appearance']
30
30
  iconFill?: FillProps
31
31
  iconFillIcon?: ItemFillActiveProps
32
32
  iconMinus?: SvgIconComponent
@@ -40,13 +40,27 @@ interface InputNumberAppearanceProps {
40
40
  width?: WidthProps
41
41
  }
42
42
 
43
- type InputNumberAppearanceKey =
44
- AppearanceKeysState | CompositeAppearanceStateDefault
43
+ interface InputNumberProps extends InputNumberAppearanceProps {
44
+ isDisabled?: boolean
45
+ isError?: boolean
46
+ onBlur?: TextInputProps['onBlur']
47
+ onChange?: (value: number) => void
48
+ onFocus?: TextInputProps['onFocus']
49
+ appearance?: CompositeAppearanceStateDefault
50
+ max?: number
51
+ min?: number
52
+ step?: number
53
+ style?: StyleProp<ViewStyle>
54
+ type?: InputNumberType
55
+ value?: number
56
+ }
57
+
45
58
  type InputNumberConfig = AppearanceConfig<
46
59
  AppearanceKeysState,
47
60
  InputNumberAppearanceProps
48
61
  >
49
62
  type InputNumberAppearance = InputNumberConfig['appearance']
63
+ type InputNumberAppearanceKey = NonNullable<InputNumberProps['appearance']>
50
64
 
51
65
  type InputNumberType = 'custom' | 'native'
52
66
 
@@ -56,22 +70,6 @@ interface OnChangeValueParams {
56
70
  text?: string
57
71
  }
58
72
 
59
- interface InputNumberProps extends InputNumberAppearanceProps {
60
- isDisabled?: boolean
61
- isError?: boolean
62
- onBlur?: (event: TextInputFocusEvent) => void
63
- onChange?: (value: number) => void
64
- onFocus?: (event: TextInputFocusEvent) => void
65
- appearance?: InputNumberAppearanceKey
66
- appearanceStyle?: AppearanceStyleKey
67
- max?: number
68
- min?: number
69
- step?: number
70
- style?: StyleProp<ViewStyle>
71
- type?: InputNumberType
72
- value?: number
73
- }
74
-
75
73
  type InputNumberGalleryStory = ComponentGalleryArgs &
76
74
  Pick<InputNumberProps, 'type' | 'value'>
77
75
 
@@ -38,7 +38,6 @@ function InputNumber(props: InputNumberProps) {
38
38
  type = 'custom',
39
39
  min = 0,
40
40
  max = Number.MAX_SAFE_INTEGER,
41
- appearanceStyle,
42
41
  step = 1,
43
42
  style,
44
43
  value = 0,
@@ -101,19 +100,12 @@ function InputNumber(props: InputNumberProps) {
101
100
  }, [onChangeValue])
102
101
 
103
102
  const resolvedAppearance = useMemo(() => {
104
- const appearanceTokens = appearance.split(' ')
105
- const isCompositeAppearance = appearanceTokens.length > 1
106
-
107
- let result = isCompositeAppearance
108
- ? appearance
109
- : mergeAppearanceKeys(appearance, appearanceStyle || 'solid')
110
-
111
103
  if (isError) {
112
- result = mergeAppearanceKeys(result, 'errorPrimary')
104
+ return mergeAppearanceKeys(appearance, 'errorPrimary')
113
105
  }
114
106
 
115
- return result
116
- }, [appearance, appearanceStyle, isError])
107
+ return appearance
108
+ }, [appearance, isError])
117
109
 
118
110
  const appearanceConfig = useAppearanceConfig(
119
111
  resolvedAppearance,
@@ -1,4 +1,4 @@
1
- import type { StyleProp, TextInputFocusEvent, ViewStyle } from 'react-native'
1
+ import type { StyleProp, TextInputProps, ViewStyle } from 'react-native'
2
2
 
3
3
  import type {
4
4
  AppearanceConfig,
@@ -19,7 +19,7 @@ import type {
19
19
  } from '@itcase/types-ui'
20
20
 
21
21
  import type { ComponentGalleryArgs } from '../../storybook'
22
- import type { SvgIconComponent } from '../Icon/Icon.interface'
22
+ import type { IconProps, SvgIconComponent } from '../Icon/Icon.interface'
23
23
  import type { iconSizePropsType } from '../Icon/styles/iconSize'
24
24
  import type { inputPasswordShapePropsType } from './styles/inputPasswordShape'
25
25
  import type { inputPasswordSizePropsType } from './styles/inputPasswordSize'
@@ -28,7 +28,7 @@ interface InputPasswordAppearanceProps {
28
28
  borderColor?: BorderColorProps
29
29
  caret?: ItemFillActiveProps
30
30
  fill?: FillProps
31
- iconAppearance?: string
31
+ iconAppearance?: IconProps['appearance']
32
32
  iconFill?: ItemFillActiveProps
33
33
  iconRevealableHide?: SvgIconComponent
34
34
  iconRevealableShow?: SvgIconComponent
@@ -42,24 +42,6 @@ interface InputPasswordAppearanceProps {
42
42
  width?: WidthProps
43
43
  }
44
44
 
45
- type InputPasswordAppearanceKey =
46
- AppearanceKeysState | CompositeAppearanceStateDefault
47
- type InputPasswordConfig = AppearanceConfig<
48
- AppearanceKeysState,
49
- InputPasswordAppearanceProps
50
- >
51
- type InputPasswordAppearance = InputPasswordConfig['appearance']
52
- type InputPasswordAppearanceStyle = AppearanceRecord<
53
- AppearanceStyleKey,
54
- InputPasswordAppearanceProps,
55
- 'borderColor' | 'fill'
56
- >
57
- type InputPasswordAppearanceShape = Partial<
58
- Record<
59
- AppearanceShapeKey,
60
- Partial<Pick<InputPasswordAppearanceProps, 'shape'>>
61
- >
62
- >
63
45
  type InputPasswordAppearanceSize = AppearancePartialRecord<
64
46
  AppearanceSizeKey,
65
47
  InputPasswordAppearanceProps,
@@ -71,17 +53,34 @@ interface InputPasswordProps extends InputPasswordAppearanceProps {
71
53
  isError?: boolean
72
54
  isReadOnly?: boolean
73
55
  isRevealed?: boolean
74
- onBlur?: (event: TextInputFocusEvent) => void
56
+ onBlur?: TextInputProps['onBlur']
75
57
  onChangeText?: (text: string) => void
76
- onFocus?: (event: TextInputFocusEvent) => void
77
- appearance?: InputPasswordAppearanceKey
78
- appearanceStyle?: AppearanceStyleKey
58
+ onFocus?: TextInputProps['onFocus']
59
+ appearance?: CompositeAppearanceStateDefault
79
60
  maxLength?: number
80
61
  placeholder?: string
81
62
  style?: StyleProp<ViewStyle>
82
63
  value?: string
83
64
  }
84
65
 
66
+ type InputPasswordConfig = AppearanceConfig<
67
+ AppearanceKeysState,
68
+ InputPasswordAppearanceProps
69
+ >
70
+ type InputPasswordAppearance = InputPasswordConfig['appearance']
71
+ type InputPasswordAppearanceStyle = AppearanceRecord<
72
+ AppearanceStyleKey,
73
+ InputPasswordAppearanceProps,
74
+ 'borderColor' | 'fill'
75
+ >
76
+ type InputPasswordAppearanceShape = Partial<
77
+ Record<
78
+ AppearanceShapeKey,
79
+ Partial<Pick<InputPasswordAppearanceProps, 'shape'>>
80
+ >
81
+ >
82
+ type InputPasswordAppearanceKey = NonNullable<InputPasswordProps['appearance']>
83
+
85
84
  type InputPasswordGalleryStory = ComponentGalleryArgs &
86
85
  Pick<
87
86
  InputPasswordProps,
@@ -36,7 +36,6 @@ function InputPassword(props: InputPasswordProps) {
36
36
  const {
37
37
  appearance = 'defaultPrimary sizeXL solid rounded',
38
38
  maxLength,
39
- appearanceStyle,
40
39
  placeholder,
41
40
  style,
42
41
  value,
@@ -58,19 +57,12 @@ function InputPassword(props: InputPasswordProps) {
58
57
  }, [])
59
58
 
60
59
  const resolvedAppearance = useMemo(() => {
61
- const appearanceTokens = appearance.split(' ')
62
- const isCompositeAppearance = appearanceTokens.length > 1
63
-
64
- let result = isCompositeAppearance
65
- ? appearance
66
- : mergeAppearanceKeys(appearance, appearanceStyle || 'solid')
67
-
68
60
  if (isError) {
69
- result = mergeAppearanceKeys(result, 'errorPrimary')
61
+ return mergeAppearanceKeys(appearance, 'errorPrimary')
70
62
  }
71
63
 
72
- return result
73
- }, [appearance, appearanceStyle, isError])
64
+ return appearance
65
+ }, [appearance, isError])
74
66
 
75
67
  const appearanceConfig = useAppearanceConfig(
76
68
  resolvedAppearance,
@@ -2,7 +2,6 @@ import type { StyleProp, TextStyle, ViewStyle } from 'react-native'
2
2
 
3
3
  import type {
4
4
  AppearanceConfig,
5
- AppearanceKeys,
6
5
  AppearanceKeysDefault,
7
6
  AppearancePartialRecord,
8
7
  AppearanceRecord,
@@ -48,7 +47,6 @@ interface LabelAppearanceProps {
48
47
  width?: WidthProps
49
48
  }
50
49
 
51
- type LabelAppearanceKey = AppearanceKeys | CompositeAppearanceKeys
52
50
  type LabelConfig = AppearanceConfig<AppearanceKeysDefault, LabelAppearanceProps>
53
51
  type LabelAppearance = LabelConfig['appearance']
54
52
  type LabelAppearanceStyle = AppearanceRecord<
@@ -76,7 +74,7 @@ type LabelAppearanceSize = AppearancePartialRecord<
76
74
  interface LabelProps extends LabelAppearanceProps {
77
75
  isDisabled?: boolean
78
76
  isSkeleton?: boolean
79
- appearance?: LabelAppearanceKey
77
+ appearance?: CompositeAppearanceKeys
80
78
  dataTestId?: string
81
79
  iconAfter?: SvgIconComponent
82
80
  iconBefore?: SvgIconComponent
@@ -84,6 +82,8 @@ interface LabelProps extends LabelAppearanceProps {
84
82
  text?: string
85
83
  }
86
84
 
85
+ type LabelAppearanceKey = NonNullable<LabelProps['appearance']>
86
+
87
87
  type LabelGalleryStory = ComponentGalleryArgs &
88
88
  Pick<LabelProps, 'isDisabled' | 'isSkeleton' | 'text'> & {
89
89
  iconAfter?: boolean
@@ -77,7 +77,6 @@ function Label(props: LabelProps) {
77
77
  const isWhiteText =
78
78
  !textColor &&
79
79
  (hasGradient ||
80
- appearance === 'surfaceQuaternary' ||
81
80
  appearance?.includes('surfaceQuaternary') ||
82
81
  appearance?.includes('gradientPrimary'))
83
82
 
@@ -6,6 +6,7 @@ import type {
6
6
  AppearanceKeysDefault,
7
7
  AppearanceRecord,
8
8
  AppearanceStyleKey,
9
+ CompositeAppearanceKeys,
9
10
  FillProps,
10
11
  TextColorProps,
11
12
  TextSizeProps,
@@ -20,9 +21,6 @@ interface LinkAppearanceProps {
20
21
  textWeight?: TextWeightProps
21
22
  }
22
23
 
23
- type LinkAppearanceKey = AppearanceKeysDefault
24
- type LinkConfig = AppearanceConfig<AppearanceKeysDefault, LinkAppearanceProps>
25
- type LinkAppearance = LinkConfig['appearance']
26
24
  type LinkAppearanceStyle = AppearanceRecord<
27
25
  AppearanceStyleKey,
28
26
  LinkAppearanceProps,
@@ -33,8 +31,7 @@ interface LinkProps extends LinkAppearanceProps {
33
31
  isDisabled?: boolean
34
32
  onPress?: (event: GestureResponderEvent) => void
35
33
  after?: ReactNode
36
- appearance?: LinkAppearanceKey
37
- appearanceStyle?: AppearanceStyleKey
34
+ appearance?: CompositeAppearanceKeys
38
35
  before?: ReactNode
39
36
  children?: ReactNode
40
37
  href?: string
@@ -44,6 +41,10 @@ interface LinkProps extends LinkAppearanceProps {
44
41
  underline?: boolean
45
42
  }
46
43
 
44
+ type LinkConfig = AppearanceConfig<AppearanceKeysDefault, LinkAppearanceProps>
45
+ type LinkAppearance = LinkConfig['appearance']
46
+ type LinkAppearanceKey = NonNullable<LinkProps['appearance']>
47
+
47
48
  type LinkStoryArgs = Omit<LinkProps, 'appearance'> & {
48
49
  appearanceStyle: string
49
50
  appearanceType: string
@@ -1,11 +1,10 @@
1
- import { useCallback, useMemo } from 'react'
1
+ import { useCallback } from 'react'
2
2
  import { Alert, Linking, Pressable } from 'react-native'
3
3
 
4
4
  import {
5
5
  useAppearanceConfig,
6
6
  useDevicePropsGenerator,
7
7
  } from '@itcase/ui-core/hooks'
8
- import { mergeAppearanceKeys } from '@itcase/ui-core/utils'
9
8
 
10
9
  import { tokens } from '../../styles/tokens'
11
10
  import { Text } from '../Text'
@@ -24,6 +23,7 @@ linkConfig.setAppearance(linkAppearance)
24
23
 
25
24
  function Link(props: LinkProps) {
26
25
  const {
26
+ appearance = 'accentPrimary sizeM solid rounded',
27
27
  text,
28
28
  href,
29
29
  link,
@@ -36,12 +36,8 @@ function Link(props: LinkProps) {
36
36
  children,
37
37
  } = props
38
38
 
39
- const resolvedAppearance = useMemo(() => {
40
- return mergeAppearanceKeys(props.appearance, props.appearanceStyle)
41
- }, [props.appearance, props.appearanceStyle])
42
-
43
39
  const appearanceConfig = useAppearanceConfig(
44
- resolvedAppearance,
40
+ appearance,
45
41
  linkConfig,
46
42
  isDisabled,
47
43
  )
@@ -6,7 +6,7 @@ const meta = {
6
6
  title: 'Atoms / Link',
7
7
  component: Link,
8
8
  args: {
9
- appearance: 'accentPrimary',
9
+ appearance: 'accentPrimary sizeM solid rounded',
10
10
  text: 'Link',
11
11
  href: 'https://itcase.pro',
12
12
  },
@@ -40,7 +40,6 @@ type ListAppearanceSize = AppearancePartialRecord<
40
40
  ListAppearanceProps,
41
41
  'size'
42
42
  >
43
- type ListAppearanceKey = AppearanceKeysDefault | CompositeAppearanceKeys
44
43
 
45
44
  interface ListContextValue {
46
45
  bulletFill?: FillProps
@@ -51,7 +50,7 @@ interface ListContextValue {
51
50
  }
52
51
 
53
52
  interface ListProps extends ListAppearanceProps {
54
- appearance?: ListAppearanceKey
53
+ appearance?: CompositeAppearanceKeys
55
54
  bulletFill?: FillProps
56
55
  bulletSize?: TextSizeProps
57
56
  bulletTextColor?: TextColorProps
@@ -79,6 +78,8 @@ interface ListItemProps extends ListItemAppearanceProps {
79
78
  text?: string
80
79
  }
81
80
 
81
+ type ListAppearanceKey = NonNullable<ListProps['appearance']>
82
+
82
83
  export type {
83
84
  ListAppearance,
84
85
  ListAppearanceKey,
@@ -50,11 +50,9 @@ type LoaderAppearanceSize = AppearancePartialRecord<
50
50
  LoaderAppearanceProps,
51
51
  'size' | 'textSize'
52
52
  >
53
- type LoaderAppearanceKey = AppearanceKeysDefault | CompositeAppearanceKeys
54
53
 
55
54
  interface LoaderProps extends LoaderAppearanceProps {
56
- appearance?: LoaderAppearanceKey
57
- appearanceStyle?: AppearanceStyleKey
55
+ appearance?: CompositeAppearanceKeys
58
56
  loaderColor?: ColorValue
59
57
  loaderSize?: number | 'large' | 'small'
60
58
  loaderTextColor?: TextColorProps
@@ -65,6 +63,8 @@ interface LoaderProps extends LoaderAppearanceProps {
65
63
  text?: string
66
64
  }
67
65
 
66
+ type LoaderAppearanceKey = NonNullable<LoaderProps['appearance']>
67
+
68
68
  type LoaderGalleryStory = ComponentGalleryArgs & Pick<LoaderProps, 'text'>
69
69
 
70
70
  type LoaderStoryArgs = Omit<LoaderProps, 'appearance'> & {
@@ -1,11 +1,9 @@
1
- import { useMemo } from 'react'
2
1
  import { ActivityIndicator, View } from 'react-native'
3
2
 
4
3
  import {
5
4
  useAppearanceConfig,
6
5
  useDevicePropsGenerator,
7
6
  } from '@itcase/ui-core/hooks'
8
- import { mergeAppearanceKeys } from '@itcase/ui-core/utils'
9
7
 
10
8
  import { tokens } from '../../styles/tokens'
11
9
  import { Text } from '../Text'
@@ -66,7 +64,6 @@ function Loader(props: LoaderProps) {
66
64
  const {
67
65
  appearance = 'accentPrimary sizeL solid rounded',
68
66
  text,
69
- appearanceStyle,
70
67
  loaderColor,
71
68
  loaderSize,
72
69
  loaderTextColor,
@@ -74,16 +71,7 @@ function Loader(props: LoaderProps) {
74
71
  style,
75
72
  } = props
76
73
 
77
- const resolvedAppearance = useMemo(() => {
78
- const appearanceTokens = appearance.split(' ')
79
- const isCompositeAppearance = appearanceTokens.length > 1
80
-
81
- return isCompositeAppearance
82
- ? appearance
83
- : mergeAppearanceKeys(appearance, appearanceStyle || 'solid')
84
- }, [appearance, appearanceStyle])
85
-
86
- const appearanceConfig = useAppearanceConfig(resolvedAppearance, loaderConfig)
74
+ const appearanceConfig = useAppearanceConfig(appearance, loaderConfig)
87
75
  const propsGenerator = useDevicePropsGenerator(props, appearanceConfig)
88
76
 
89
77
  const { size, fill, borderColor, textColor, textSize, itemFill, shape } =
@@ -30,13 +30,13 @@ interface MenuItemAppearanceProps {
30
30
  fill?: FillProps
31
31
  fillActive?: FillActiveProps
32
32
  iconAfter?: SvgIconComponent
33
- iconAfterAppearance?: string
33
+ iconAfterAppearance?: IconProps['appearance']
34
34
  iconAfterFill?: IconProps['fill']
35
35
  iconAfterFillIcon?: IconProps['iconFill']
36
36
  iconAfterShape?: IconProps['shape']
37
37
  iconAfterSize?: IconProps['size']
38
38
  iconBefore?: SvgIconComponent
39
- iconBeforeAppearance?: string
39
+ iconBeforeAppearance?: IconProps['appearance']
40
40
  iconBeforeFill?: IconProps['fill']
41
41
  iconBeforeFillIcon?: IconProps['iconFill']
42
42
  iconBeforeShape?: IconProps['shape']
@@ -70,14 +70,13 @@ type MenuItemAppearanceSize = AppearancePartialRecord<
70
70
  MenuItemAppearanceProps,
71
71
  'iconAfterSize' | 'iconBeforeSize' | 'labelTextSize' | 'size'
72
72
  >
73
- type MenuItemAppearanceKey = AppearanceKeysDefault | CompositeAppearanceKeys
74
73
 
75
74
  interface MenuItemProps extends MenuItemAppearanceProps {
76
75
  isActive?: boolean
77
76
  isDisabled?: boolean
78
77
  onPress?: (event: GestureResponderEvent) => void
79
78
  after?: ReactNode
80
- appearance?: MenuItemAppearanceKey
79
+ appearance?: CompositeAppearanceKeys
81
80
  before?: ReactNode
82
81
  children?: ReactNode
83
82
  desc?: string
@@ -90,6 +89,8 @@ interface MenuItemProps extends MenuItemAppearanceProps {
90
89
  style?: StyleProp<ViewStyle>
91
90
  }
92
91
 
92
+ type MenuItemAppearanceKey = NonNullable<MenuItemProps['appearance']>
93
+
93
94
  export type {
94
95
  MenuItemAppearance,
95
96
  MenuItemAppearanceKey,
@@ -7,6 +7,7 @@ import {
7
7
 
8
8
  import { tokens } from '../../styles/tokens'
9
9
  import { Button } from '../Button'
10
+ import type { ButtonProps } from '../Button/Button.interface'
10
11
  import { Text } from '../Text'
11
12
  import { paginationAppearance } from './Pagination.appearance'
12
13
  import type { PaginationConfig, PaginationProps } from './Pagination.interface'
@@ -46,14 +47,15 @@ function Pagination(props: PaginationProps) {
46
47
  const sizeKey = size || DEFAULT_PAGINATION_SIZE
47
48
  const isPrevDisabled = isDisabled || page <= 1
48
49
  const isNextDisabled = isDisabled || page >= pageCount
50
+ const paginationButtonAppearance =
51
+ `surfaceSecondary size${sizeKey.toUpperCase()} solid rounded` as ButtonProps['appearance']
49
52
 
50
53
  return (
51
54
  <View
52
55
  style={[styles.pagination, styles[`pagination_size_${sizeKey}`], style]}
53
56
  >
54
57
  <Button
55
- appearance="surfaceSecondary"
56
- size={sizeKey}
58
+ appearance={paginationButtonAppearance}
57
59
  label="‹"
58
60
  isDisabled={isPrevDisabled}
59
61
  onPress={() => {
@@ -81,8 +83,7 @@ function Pagination(props: PaginationProps) {
81
83
  / {pageCount}
82
84
  </Text>
83
85
  <Button
84
- appearance="surfaceSecondary"
85
- size={sizeKey}
86
+ appearance={paginationButtonAppearance}
86
87
  label="›"
87
88
  isDisabled={isNextDisabled}
88
89
  onPress={() => {
@@ -8,7 +8,7 @@ import type {
8
8
  AppearanceShapeKey,
9
9
  AppearanceStyleKey,
10
10
  BorderColorProps,
11
- CompositeAppearanceKeys,
11
+ CompositeAppearanceWithoutSizeKeys,
12
12
  FillActiveProps,
13
13
  FillProps,
14
14
  ShapeProps,
@@ -41,7 +41,7 @@ type PressableAppearanceShape = Partial<
41
41
  interface PressableProps extends PressableAppearanceProps {
42
42
  isDisabled?: boolean
43
43
  onPress?: (event: GestureResponderEvent) => void
44
- appearance?: string | AppearanceKeysDefault | CompositeAppearanceKeys
44
+ appearance?: CompositeAppearanceWithoutSizeKeys
45
45
  children?: ReactNode
46
46
  style?: StyleProp<ViewStyle>
47
47
  }
@@ -60,7 +60,7 @@ export const WithIcon: Story = {
60
60
  onPress={() => undefined}
61
61
  >
62
62
  <Icon
63
- appearance="surfacePrimary size24_24 ghost"
63
+ appearance="surfacePrimary size24_24 ghost rounded"
64
64
  SVGIcon={icons24.Placeholder.Default}
65
65
  />
66
66
  </Pressable>