@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.
- package/package.json +2 -2
- package/src/components/Avatar/Avatar.interface.ts +4 -3
- package/src/components/Badge/Badge.interface.ts +4 -4
- package/src/components/Button/Button.interface.ts +3 -3
- package/src/components/Button/Button.tsx +1 -7
- package/src/components/Button/stories/ButtonDefault.stories.tsx +2 -2
- package/src/components/Button/stories/ButtonGallery.stories.tsx +1 -1
- package/src/components/Button/stories/ButtonIcon.stories.tsx +1 -1
- package/src/components/Checkbox/Checkbox.interface.ts +22 -23
- package/src/components/Checkmark/Checkmark.tsx +1 -1
- package/src/components/Chips/Chips.interface.ts +7 -6
- package/src/components/Choice/Choice.interface.ts +22 -22
- package/src/components/Choice/Choice.tsx +1 -13
- package/src/components/Code/Code.interface.ts +13 -13
- package/src/components/Code/Code.tsx +1 -12
- package/src/components/ColorInput/ColorInput.interface.ts +8 -9
- package/src/components/DatePicker/DatePicker.interface.ts +3 -1
- package/src/components/Divider/Divider.interface.ts +3 -2
- package/src/components/Drawer/Drawer.interface.ts +2 -1
- package/src/components/Dropdown/Dropdown.interface.ts +4 -4
- package/src/components/HeroTitle/HeroTitle.interface.ts +2 -2
- package/src/components/Icon/Icon.interface.ts +2 -2
- package/src/components/Input/Input.interface.ts +13 -13
- package/src/components/Input/Input.tsx +3 -11
- package/src/components/InputNumber/InputNumber.interface.ts +18 -20
- package/src/components/InputNumber/InputNumber.tsx +3 -11
- package/src/components/InputPassword/InputPassword.interface.ts +21 -22
- package/src/components/InputPassword/InputPassword.tsx +3 -11
- package/src/components/Label/Label.interface.ts +3 -3
- package/src/components/Label/Label.tsx +0 -1
- package/src/components/Link/Link.interface.ts +6 -5
- package/src/components/Link/Link.tsx +3 -7
- package/src/components/Link/stories/Link.stories.tsx +1 -1
- package/src/components/List/List.interface.ts +3 -2
- package/src/components/Loader/Loader.interface.ts +3 -3
- package/src/components/Loader/Loader.tsx +1 -13
- package/src/components/MenuItem/MenuItem.interface.ts +5 -4
- package/src/components/Pagination/Pagination.tsx +5 -4
- package/src/components/Pressable/Pressable.interface.ts +2 -2
- package/src/components/Pressable/stories/PressableGallery.stories.tsx +1 -1
- package/src/components/Radio/Radio.interface.ts +15 -15
- package/src/components/Search/Search.tsx +10 -3
- package/src/components/Segmented/Segmented.interface.ts +2 -2
- package/src/components/Select/Select.interface.ts +5 -4
- package/src/components/Switch/Switch.interface.ts +10 -10
- package/src/components/Switch/Switch.tsx +2 -19
- package/src/components/Textarea/Textarea.interface.ts +16 -17
- package/src/components/Textarea/Textarea.tsx +3 -11
- package/src/components/Tile/Tile.interface.ts +4 -3
- package/src/components/Tile/stories/TileSwap.stories.tsx +3 -9
- package/src/components/Tooltip/Tooltip.interface.ts +2 -3
- package/src/components/Warning/Warning.interface.ts +3 -3
|
@@ -40,17 +40,6 @@ interface InputAppearanceProps {
|
|
|
40
40
|
width?: WidthProps
|
|
41
41
|
}
|
|
42
42
|
|
|
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
43
|
type InputAppearanceSize = AppearancePartialRecord<
|
|
55
44
|
AppearanceSizeKey,
|
|
56
45
|
InputAppearanceProps,
|
|
@@ -66,8 +55,7 @@ interface InputProps extends InputAppearanceProps {
|
|
|
66
55
|
onFocus?: (event: TextInputFocusEvent) => void
|
|
67
56
|
onSubmitEditing?: (event: TextInputSubmitEditingEvent) => void
|
|
68
57
|
after?: ReactNode
|
|
69
|
-
appearance?:
|
|
70
|
-
appearanceStyle?: AppearanceStyleKey
|
|
58
|
+
appearance?: CompositeAppearanceStateDefault
|
|
71
59
|
before?: ReactNode
|
|
72
60
|
maxLength?: number
|
|
73
61
|
placeholder?: string
|
|
@@ -75,6 +63,18 @@ interface InputProps extends InputAppearanceProps {
|
|
|
75
63
|
value?: string
|
|
76
64
|
}
|
|
77
65
|
|
|
66
|
+
type InputConfig = AppearanceConfig<AppearanceKeysState, InputAppearanceProps>
|
|
67
|
+
type InputAppearance = InputConfig['appearance']
|
|
68
|
+
type InputAppearanceStyle = AppearanceRecord<
|
|
69
|
+
AppearanceStyleKey,
|
|
70
|
+
InputAppearanceProps,
|
|
71
|
+
'borderColor' | 'fill'
|
|
72
|
+
>
|
|
73
|
+
type InputAppearanceShape = Partial<
|
|
74
|
+
Record<AppearanceShapeKey, Partial<Pick<InputAppearanceProps, 'shape'>>>
|
|
75
|
+
>
|
|
76
|
+
type InputAppearanceKey = NonNullable<InputProps['appearance']>
|
|
77
|
+
|
|
78
78
|
type InputGalleryStory = ComponentGalleryArgs &
|
|
79
79
|
Pick<InputProps, 'isDisabled' | 'placeholder' | 'value'>
|
|
80
80
|
|
|
@@ -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
|
-
|
|
45
|
+
return mergeAppearanceKeys(appearance, 'errorPrimary')
|
|
54
46
|
}
|
|
55
47
|
|
|
56
|
-
return
|
|
57
|
-
}, [appearance,
|
|
48
|
+
return appearance
|
|
49
|
+
}, [appearance, isError])
|
|
58
50
|
|
|
59
51
|
const appearanceConfig = useAppearanceConfig(
|
|
60
52
|
resolvedAppearance,
|
|
@@ -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?:
|
|
29
|
+
iconAppearance?: IconProps['appearance']
|
|
30
30
|
iconFill?: FillProps
|
|
31
31
|
iconFillIcon?: ItemFillActiveProps
|
|
32
32
|
iconMinus?: SvgIconComponent
|
|
@@ -40,30 +40,13 @@ interface InputNumberAppearanceProps {
|
|
|
40
40
|
width?: WidthProps
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
type InputNumberAppearanceKey =
|
|
44
|
-
AppearanceKeysState | CompositeAppearanceStateDefault
|
|
45
|
-
type InputNumberConfig = AppearanceConfig<
|
|
46
|
-
AppearanceKeysState,
|
|
47
|
-
InputNumberAppearanceProps
|
|
48
|
-
>
|
|
49
|
-
type InputNumberAppearance = InputNumberConfig['appearance']
|
|
50
|
-
|
|
51
|
-
type InputNumberType = 'custom' | 'native'
|
|
52
|
-
|
|
53
|
-
interface OnChangeValueParams {
|
|
54
|
-
mode?: 'button' | 'input'
|
|
55
|
-
operation?: 'minus' | 'plus'
|
|
56
|
-
text?: string
|
|
57
|
-
}
|
|
58
|
-
|
|
59
43
|
interface InputNumberProps extends InputNumberAppearanceProps {
|
|
60
44
|
isDisabled?: boolean
|
|
61
45
|
isError?: boolean
|
|
62
46
|
onBlur?: (event: TextInputFocusEvent) => void
|
|
63
47
|
onChange?: (value: number) => void
|
|
64
48
|
onFocus?: (event: TextInputFocusEvent) => void
|
|
65
|
-
appearance?:
|
|
66
|
-
appearanceStyle?: AppearanceStyleKey
|
|
49
|
+
appearance?: CompositeAppearanceStateDefault
|
|
67
50
|
max?: number
|
|
68
51
|
min?: number
|
|
69
52
|
step?: number
|
|
@@ -72,6 +55,21 @@ interface InputNumberProps extends InputNumberAppearanceProps {
|
|
|
72
55
|
value?: number
|
|
73
56
|
}
|
|
74
57
|
|
|
58
|
+
type InputNumberConfig = AppearanceConfig<
|
|
59
|
+
AppearanceKeysState,
|
|
60
|
+
InputNumberAppearanceProps
|
|
61
|
+
>
|
|
62
|
+
type InputNumberAppearance = InputNumberConfig['appearance']
|
|
63
|
+
type InputNumberAppearanceKey = NonNullable<InputNumberProps['appearance']>
|
|
64
|
+
|
|
65
|
+
type InputNumberType = 'custom' | 'native'
|
|
66
|
+
|
|
67
|
+
interface OnChangeValueParams {
|
|
68
|
+
mode?: 'button' | 'input'
|
|
69
|
+
operation?: 'minus' | 'plus'
|
|
70
|
+
text?: string
|
|
71
|
+
}
|
|
72
|
+
|
|
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
|
-
|
|
104
|
+
return mergeAppearanceKeys(appearance, 'errorPrimary')
|
|
113
105
|
}
|
|
114
106
|
|
|
115
|
-
return
|
|
116
|
-
}, [appearance,
|
|
107
|
+
return appearance
|
|
108
|
+
}, [appearance, isError])
|
|
117
109
|
|
|
118
110
|
const appearanceConfig = useAppearanceConfig(
|
|
119
111
|
resolvedAppearance,
|
|
@@ -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?:
|
|
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,
|
|
@@ -74,14 +56,31 @@ interface InputPasswordProps extends InputPasswordAppearanceProps {
|
|
|
74
56
|
onBlur?: (event: TextInputFocusEvent) => void
|
|
75
57
|
onChangeText?: (text: string) => void
|
|
76
58
|
onFocus?: (event: TextInputFocusEvent) => void
|
|
77
|
-
appearance?:
|
|
78
|
-
appearanceStyle?: AppearanceStyleKey
|
|
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
|
-
|
|
61
|
+
return mergeAppearanceKeys(appearance, 'errorPrimary')
|
|
70
62
|
}
|
|
71
63
|
|
|
72
|
-
return
|
|
73
|
-
}, [appearance,
|
|
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?:
|
|
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
|
|
@@ -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?:
|
|
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
|
|
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
|
-
|
|
40
|
+
appearance,
|
|
45
41
|
linkConfig,
|
|
46
42
|
isDisabled,
|
|
47
43
|
)
|
|
@@ -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?:
|
|
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?:
|
|
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
|
|
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?:
|
|
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?:
|
|
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?:
|
|
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=
|
|
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=
|
|
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
|
-
|
|
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?:
|
|
44
|
+
appearance?: CompositeAppearanceWithoutSizeKeys
|
|
45
45
|
children?: ReactNode
|
|
46
46
|
style?: StyleProp<ViewStyle>
|
|
47
47
|
}
|
|
@@ -40,19 +40,6 @@ interface RadioAppearanceProps {
|
|
|
40
40
|
size?: radioSizePropsType
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
type RadioAppearanceKey = AppearanceKeysState | CompositeAppearanceStateDefault
|
|
44
|
-
type RadioConfig = AppearanceConfig<AppearanceKeysState, RadioAppearanceProps>
|
|
45
|
-
type RadioAppearance = RadioConfig['appearance']
|
|
46
|
-
type RadioAppearanceStyle = AppearanceRecord<
|
|
47
|
-
AppearanceStyleKey,
|
|
48
|
-
RadioAppearanceProps,
|
|
49
|
-
'borderColor' | 'borderRadioColor' | 'borderRadioColorActive' | 'fill'
|
|
50
|
-
>
|
|
51
|
-
type RadioAppearanceShape = AppearancePartialRecord<
|
|
52
|
-
AppearanceShapeKey,
|
|
53
|
-
RadioAppearanceProps,
|
|
54
|
-
'shape'
|
|
55
|
-
>
|
|
56
43
|
type RadioAppearanceSize = AppearancePartialRecord<
|
|
57
44
|
AppearanceSizeKey,
|
|
58
45
|
RadioAppearanceProps,
|
|
@@ -64,14 +51,27 @@ interface RadioProps extends RadioAppearanceProps {
|
|
|
64
51
|
isChecked?: boolean
|
|
65
52
|
isDisabled?: boolean
|
|
66
53
|
onPress?: (event: GestureResponderEvent) => void
|
|
67
|
-
appearance?:
|
|
68
|
-
appearanceStyle?: AppearanceStyleKey
|
|
54
|
+
appearance?: CompositeAppearanceStateDefault
|
|
69
55
|
checked?: boolean
|
|
70
56
|
desc?: string
|
|
71
57
|
label?: string
|
|
72
58
|
style?: StyleProp<ViewStyle>
|
|
73
59
|
}
|
|
74
60
|
|
|
61
|
+
type RadioConfig = AppearanceConfig<AppearanceKeysState, RadioAppearanceProps>
|
|
62
|
+
type RadioAppearance = RadioConfig['appearance']
|
|
63
|
+
type RadioAppearanceStyle = AppearanceRecord<
|
|
64
|
+
AppearanceStyleKey,
|
|
65
|
+
RadioAppearanceProps,
|
|
66
|
+
'borderColor' | 'borderRadioColor' | 'borderRadioColorActive' | 'fill'
|
|
67
|
+
>
|
|
68
|
+
type RadioAppearanceShape = AppearancePartialRecord<
|
|
69
|
+
AppearanceShapeKey,
|
|
70
|
+
RadioAppearanceProps,
|
|
71
|
+
'shape'
|
|
72
|
+
>
|
|
73
|
+
type RadioAppearanceKey = NonNullable<RadioProps['appearance']>
|
|
74
|
+
|
|
75
75
|
type RadioGalleryStory = ComponentGalleryArgs &
|
|
76
76
|
Pick<RadioProps, 'checked' | 'desc' | 'isDisabled' | 'label'>
|
|
77
77
|
|