@itcase/ui-react-native 1.10.86 → 1.10.87

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 +13 -13
  24. package/src/components/Input/Input.tsx +3 -11
  25. package/src/components/InputNumber/InputNumber.interface.ts +18 -20
  26. package/src/components/InputNumber/InputNumber.tsx +3 -11
  27. package/src/components/InputPassword/InputPassword.interface.ts +21 -22
  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 +16 -17
  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
@@ -9,10 +9,17 @@ import {
9
9
  import { tokens } from '../../styles/tokens'
10
10
  import { colorTheme } from '../../utils'
11
11
  import { Icon } from '../Icon'
12
+ import type { IconProps } from '../Icon/Icon.interface'
12
13
  import { searchAppearance } from './Search.appearance'
13
14
  import type { SearchConfig, SearchProps } from './Search.interface'
14
15
  import { styles } from './Search.styles'
15
16
 
17
+ function getSearchIconAppearance(iconSize?: string): IconProps['appearance'] {
18
+ const sizeKey = iconSize === '16' ? 'size16_16' : 'size24_24'
19
+
20
+ return `surfacePrimary ${sizeKey} ghost rounded`
21
+ }
22
+
16
23
  const searchConfig: SearchConfig = {
17
24
  appearance: {},
18
25
  setAppearance: (newComponent) => {
@@ -94,7 +101,7 @@ function Search(props: SearchProps) {
94
101
  >
95
102
  {SearchIcon && (
96
103
  <Icon
97
- appearance="ghost"
104
+ appearance={getSearchIconAppearance(iconBeforeSize)}
98
105
  size={iconBeforeSize}
99
106
  iconFill={iconBeforeFill}
100
107
  iconSize={iconBeforeSize}
@@ -125,7 +132,7 @@ function Search(props: SearchProps) {
125
132
 
126
133
  {resolvedValue && (
127
134
  <Icon
128
- appearance="ghost"
135
+ appearance={getSearchIconAppearance(iconClearSize)}
129
136
  size={iconClearSize}
130
137
  iconFill={iconClearFill}
131
138
  iconSize={iconClearSize}
@@ -138,7 +145,7 @@ function Search(props: SearchProps) {
138
145
 
139
146
  {iconAfter && (
140
147
  <Icon
141
- appearance="ghost"
148
+ appearance={getSearchIconAppearance(iconAfterSize)}
142
149
  size={iconAfterSize}
143
150
  iconFill={iconAfterFill}
144
151
  iconSize={iconAfterSize}
@@ -26,8 +26,8 @@ interface SegmentedAppearanceProps {
26
26
  borderColor?: BorderColorProps
27
27
  fill?: FillProps
28
28
  fillActive?: FillActiveProps
29
- iconAppearance?: string
30
- iconAppearanceActive?: string
29
+ iconAppearance?: IconProps['appearance']
30
+ iconAppearanceActive?: IconProps['appearance']
31
31
  iconFill?: IconProps['iconFill']
32
32
  iconFillActive?: IconProps['iconFill']
33
33
  iconFillDisabled?: IconProps['iconFill']
@@ -17,6 +17,7 @@ import type {
17
17
  } from '@itcase/types-ui'
18
18
 
19
19
  import type { ComponentGalleryArgs } from '../../storybook'
20
+ import type { IconProps } from '../Icon/Icon.interface'
20
21
  import type { selectSizePropsType } from './styles/selectSize'
21
22
 
22
23
  interface SelectOptionItem {
@@ -28,8 +29,8 @@ interface SelectAppearanceProps {
28
29
  borderColor?: BorderColorProps
29
30
  fill?: FillProps
30
31
  fillDisabled?: FillProps
31
- iconAppearance?: string
32
- iconCloseAppearance?: string
32
+ iconAppearance?: IconProps['appearance']
33
+ iconCloseAppearance?: IconProps['appearance']
33
34
  menuFill?: FillProps
34
35
  optionFill?: FillProps
35
36
  optionFillActive?: FillProps
@@ -45,7 +46,7 @@ interface SelectAppearanceProps {
45
46
  interface SelectProps extends SelectAppearanceProps {
46
47
  isDisabled?: boolean
47
48
  onValueChange?: (value: string) => void
48
- appearance?: SelectAppearanceKey
49
+ appearance?: CompositeAppearanceStateDefault
49
50
  menu?: SelectMenu
50
51
  optionsList?: SelectOptionItem[]
51
52
  placeholder?: string
@@ -54,7 +55,6 @@ interface SelectProps extends SelectAppearanceProps {
54
55
  }
55
56
 
56
57
  type SelectMenu = 'bottom' | 'overlay' | 'screen'
57
- type SelectAppearanceKey = AppearanceKeysState | CompositeAppearanceStateDefault
58
58
  type SelectConfig = AppearanceConfig<AppearanceKeysState, SelectAppearanceProps>
59
59
  type SelectAppearance = SelectConfig['appearance']
60
60
  type SelectAppearanceStyle = AppearanceRecord<
@@ -72,6 +72,7 @@ type SelectAppearanceSize = AppearancePartialRecord<
72
72
  SelectAppearanceProps,
73
73
  'size' | 'textSize'
74
74
  >
75
+ type SelectAppearanceKey = NonNullable<SelectProps['appearance']>
75
76
 
76
77
  type SelectGalleryStory = ComponentGalleryArgs & {
77
78
  placeholder?: string
@@ -33,14 +33,6 @@ interface SwitchAppearanceProps {
33
33
  titleTextSize?: TextSizeProps
34
34
  }
35
35
 
36
- type SwitchAppearanceKey = AppearanceKeysState | CompositeAppearanceStateDefault
37
- type SwitchConfig = AppearanceConfig<AppearanceKeysState, SwitchAppearanceProps>
38
- type SwitchAppearance = SwitchConfig['appearance']
39
- type SwitchAppearanceStyle = AppearanceRecord<
40
- AppearanceStyleKey,
41
- SwitchAppearanceProps,
42
- 'borderColor' | 'fill'
43
- >
44
36
  type SwitchAppearanceSize = AppearancePartialRecord<
45
37
  AppearanceSizeKey,
46
38
  SwitchAppearanceProps,
@@ -53,8 +45,7 @@ interface SwitchProps extends SwitchAppearanceProps {
53
45
  onChange?: (isActive: boolean) => void
54
46
  onPress?: (event: GestureResponderEvent) => void
55
47
  align?: switchAlignPropsType
56
- appearance?: SwitchAppearanceKey
57
- appearanceStyle?: AppearanceStyleKey
48
+ appearance?: CompositeAppearanceStateDefault
58
49
  dataTestId?: string
59
50
  defaultIsActive?: boolean
60
51
  desc?: string
@@ -63,6 +54,15 @@ interface SwitchProps extends SwitchAppearanceProps {
63
54
  width?: WidthProps
64
55
  }
65
56
 
57
+ type SwitchConfig = AppearanceConfig<AppearanceKeysState, SwitchAppearanceProps>
58
+ type SwitchAppearance = SwitchConfig['appearance']
59
+ type SwitchAppearanceStyle = AppearanceRecord<
60
+ AppearanceStyleKey,
61
+ SwitchAppearanceProps,
62
+ 'borderColor' | 'fill'
63
+ >
64
+ type SwitchAppearanceKey = NonNullable<SwitchProps['appearance']>
65
+
66
66
  type SwitchGalleryStory = ComponentGalleryArgs &
67
67
  Pick<SwitchProps, 'desc' | 'isActive' | 'isDisabled' | 'title'>
68
68
 
@@ -1,4 +1,4 @@
1
- import { useCallback, useMemo, useState } from 'react'
1
+ import { useCallback, useState } from 'react'
2
2
  import {
3
3
  Animated,
4
4
  Pressable,
@@ -10,7 +10,6 @@ import {
10
10
  useAppearanceConfig,
11
11
  useDevicePropsGenerator,
12
12
  } from '@itcase/ui-core/hooks'
13
- import { mergeAppearanceKeys } from '@itcase/ui-core/utils'
14
13
 
15
14
  import { tokens } from '../../styles/tokens'
16
15
  import { Text } from '../Text'
@@ -39,7 +38,6 @@ function Switch(props: SwitchProps) {
39
38
  fillToggle,
40
39
  title,
41
40
  desc,
42
- appearanceStyle,
43
41
  defaultIsActive = false,
44
42
  style,
45
43
  isActive: isActiveProp,
@@ -70,23 +68,8 @@ function Switch(props: SwitchProps) {
70
68
  [isActive, isControlled, isDisabled, onChange, onPress],
71
69
  )
72
70
 
73
- const resolvedAppearance = useMemo(() => {
74
- const appearanceTokens = appearance.split(' ')
75
- const isCompositeAppearance = appearanceTokens.length > 1
76
-
77
- let result = isCompositeAppearance
78
- ? appearance
79
- : mergeAppearanceKeys(appearance, appearanceStyle || 'solid')
80
-
81
- if (!isCompositeAppearance && size) {
82
- result = mergeAppearanceKeys(result, `size${size.toUpperCase()}`)
83
- }
84
-
85
- return result
86
- }, [appearance, appearanceStyle, size])
87
-
88
71
  const appearanceConfig = useAppearanceConfig(
89
- resolvedAppearance,
72
+ appearance,
90
73
  switchConfig,
91
74
  isDisabled,
92
75
  )
@@ -33,21 +33,6 @@ interface TextareaAppearanceProps {
33
33
  width?: WidthProps
34
34
  }
35
35
 
36
- type TextareaAppearanceKey =
37
- AppearanceKeysState | CompositeAppearanceStateDefault
38
- type TextareaConfig = AppearanceConfig<
39
- AppearanceKeysState,
40
- TextareaAppearanceProps
41
- >
42
- type TextareaAppearance = TextareaConfig['appearance']
43
- type TextareaAppearanceStyle = AppearanceRecord<
44
- AppearanceStyleKey,
45
- TextareaAppearanceProps,
46
- 'borderColor' | 'fill'
47
- >
48
- type TextareaAppearanceShape = Partial<
49
- Record<AppearanceShapeKey, Partial<Pick<TextareaAppearanceProps, 'shape'>>>
50
- >
51
36
  type TextareaAppearanceSize = AppearancePartialRecord<
52
37
  AppearanceSizeKey,
53
38
  TextareaAppearanceProps,
@@ -61,8 +46,7 @@ interface TextareaProps extends TextareaAppearanceProps {
61
46
  onBlur?: (event: TextInputFocusEvent) => void
62
47
  onChangeText?: (text: string) => void
63
48
  onFocus?: (event: TextInputFocusEvent) => void
64
- appearance?: TextareaAppearanceKey
65
- appearanceStyle?: AppearanceStyleKey
49
+ appearance?: CompositeAppearanceStateDefault
66
50
  maxLength?: number
67
51
  minHeight?: number
68
52
  placeholder?: string
@@ -71,6 +55,21 @@ interface TextareaProps extends TextareaAppearanceProps {
71
55
  value?: string
72
56
  }
73
57
 
58
+ type TextareaConfig = AppearanceConfig<
59
+ AppearanceKeysState,
60
+ TextareaAppearanceProps
61
+ >
62
+ type TextareaAppearance = TextareaConfig['appearance']
63
+ type TextareaAppearanceStyle = AppearanceRecord<
64
+ AppearanceStyleKey,
65
+ TextareaAppearanceProps,
66
+ 'borderColor' | 'fill'
67
+ >
68
+ type TextareaAppearanceShape = Partial<
69
+ Record<AppearanceShapeKey, Partial<Pick<TextareaAppearanceProps, 'shape'>>>
70
+ >
71
+ type TextareaAppearanceKey = NonNullable<TextareaProps['appearance']>
72
+
74
73
  export type {
75
74
  TextareaAppearance,
76
75
  TextareaAppearanceKey,
@@ -30,7 +30,6 @@ function Textarea(props: TextareaProps) {
30
30
  appearance = 'defaultPrimary sizeM solid rounded',
31
31
  minHeight,
32
32
  maxLength,
33
- appearanceStyle,
34
33
  placeholder,
35
34
  rows,
36
35
  style,
@@ -44,19 +43,12 @@ function Textarea(props: TextareaProps) {
44
43
  } = props
45
44
 
46
45
  const resolvedAppearance = useMemo(() => {
47
- const appearanceTokens = appearance.split(' ')
48
- const isCompositeAppearance = appearanceTokens.length > 1
49
-
50
- let result = isCompositeAppearance
51
- ? appearance
52
- : mergeAppearanceKeys(appearance, appearanceStyle || 'solid')
53
-
54
46
  if (isError) {
55
- result = mergeAppearanceKeys(result, 'errorPrimary')
47
+ return mergeAppearanceKeys(appearance, 'errorPrimary')
56
48
  }
57
49
 
58
- return result
59
- }, [appearance, appearanceStyle, isError])
50
+ return appearance
51
+ }, [appearance, isError])
60
52
 
61
53
  const appearanceConfig = useAppearanceConfig(
62
54
  resolvedAppearance,
@@ -40,7 +40,7 @@ interface TileAppearanceProps {
40
40
  descTextSize?: TextSizeProps
41
41
  direction?: DirectionProps
42
42
  fill?: FillProps
43
- iconAppearance?: string
43
+ iconAppearance?: IconProps['appearance']
44
44
  iconFill?: IconProps['fill']
45
45
  iconFillIcon?: IconProps['iconFill']
46
46
  iconShape?: IconProps['shape']
@@ -69,13 +69,12 @@ type TileAppearanceSize = AppearancePartialRecord<
69
69
  TileAppearanceProps,
70
70
  'descTextSize' | 'iconSize' | 'size' | 'titleTextSize'
71
71
  >
72
- type TileAppearanceKey = AppearanceKeysDefault | CompositeAppearanceKeys
73
72
 
74
73
  interface TileProps extends TileAppearanceProps {
75
74
  onPress?: (event: GestureResponderEvent) => void
76
75
  onPressIcon?: (event: GestureResponderEvent) => void
77
76
  after?: ReactNode
78
- appearance?: TileAppearanceKey
77
+ appearance?: CompositeAppearanceKeys
79
78
  badgeValue?: BadgeProps['text']
80
79
  before?: ReactNode
81
80
  children?: ReactNode
@@ -87,6 +86,8 @@ interface TileProps extends TileAppearanceProps {
87
86
  title?: string
88
87
  }
89
88
 
89
+ type TileAppearanceKey = NonNullable<TileProps['appearance']>
90
+
90
91
  type TileGalleryStory = ComponentGalleryArgs &
91
92
  Pick<TileProps, 'badgeValue' | 'desc' | 'title'> & {
92
93
  showIcon?: boolean
@@ -21,11 +21,9 @@ export const Before: Story = {
21
21
  args: {
22
22
  before: (
23
23
  <Button
24
- appearance="accentPrimary"
24
+ appearance="accentPrimary sizeXL solid rounded"
25
25
  width="fill"
26
- size="xl"
27
26
  label="Label"
28
- appearanceStyle="solid"
29
27
  />
30
28
  ),
31
29
  },
@@ -35,11 +33,9 @@ export const Children: Story = {
35
33
  args: {
36
34
  children: (
37
35
  <Button
38
- appearance="accentPrimary"
36
+ appearance="accentPrimary sizeXL solid rounded"
39
37
  width="fill"
40
- size="xl"
41
38
  label="Label"
42
- appearanceStyle="solid"
43
39
  />
44
40
  ),
45
41
  },
@@ -49,11 +45,9 @@ export const After: Story = {
49
45
  args: {
50
46
  after: (
51
47
  <Button
52
- appearance="accentPrimary"
48
+ appearance="accentPrimary sizeXL solid rounded"
53
49
  width="fill"
54
- size="xl"
55
50
  label="Label"
56
- appearanceStyle="solid"
57
51
  />
58
52
  ),
59
53
  },
@@ -40,7 +40,7 @@ interface TooltipAppearanceProps {
40
40
  interface TooltipProps extends TooltipAppearanceProps {
41
41
  isVisible?: boolean
42
42
  after?: ReactNode
43
- appearance?: TooltipAppearanceKey
43
+ appearance?: CompositeAppearanceStateDefault
44
44
  before?: ReactNode
45
45
  children?: ReactNode
46
46
  position?: TooltipPosition
@@ -49,8 +49,6 @@ interface TooltipProps extends TooltipAppearanceProps {
49
49
  title?: string
50
50
  }
51
51
 
52
- type TooltipAppearanceKey =
53
- AppearanceKeysState | CompositeAppearanceStateDefault
54
52
  type TooltipConfig = AppearanceConfig<
55
53
  AppearanceKeysState,
56
54
  TooltipAppearanceProps
@@ -71,6 +69,7 @@ type TooltipAppearanceSize = AppearancePartialRecord<
71
69
  TooltipAppearanceProps,
72
70
  'size' | 'textSize' | 'titleSize'
73
71
  >
72
+ type TooltipAppearanceKey = NonNullable<TooltipProps['appearance']>
74
73
 
75
74
  type TooltipGalleryStory = ComponentGalleryArgs &
76
75
  Pick<TooltipProps, 'isVisible' | 'text' | 'title'>
@@ -19,7 +19,7 @@ import type {
19
19
  TextWeightProps,
20
20
  } from '@itcase/types-ui'
21
21
 
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 { warningSizePropsType } from './styles/warningSize'
25
25
 
@@ -29,10 +29,10 @@ interface WarningAppearanceProps {
29
29
  descriptionTextSize?: TextSizeProps
30
30
  fill?: FillProps
31
31
  iconAfter?: SvgIconComponent
32
- iconAfterAppearance?: string
32
+ iconAfterAppearance?: IconProps['appearance']
33
33
  iconAfterFillIcon?: ItemFillActiveProps
34
34
  iconBefore?: SvgIconComponent
35
- iconBeforeAppearance?: string
35
+ iconBeforeAppearance?: IconProps['appearance']
36
36
  iconBeforeFillIcon?: ItemFillActiveProps
37
37
  iconSize?: iconSizePropsType
38
38
  labelTextColor?: TextColorProps