react-native-ui-lib 7.38.0-snapshot.6285 → 7.38.0-snapshot.6286
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 +1 -1
- package/src/components/button/index.js +1 -1
- package/src/components/checkbox/index.d.ts +1 -0
- package/src/components/checkbox/index.js +4 -1
- package/src/components/colorPicker/ColorPickerDialog.d.ts +4 -25
- package/src/components/colorPicker/ColorPickerDialog.js +2 -6
- package/src/components/colorPicker/ColorPickerDialogHeader.d.ts +1 -1
- package/src/components/colorPicker/ColorPickerDialogHeader.js +3 -9
- package/src/components/radioButton/index.js +8 -1
package/package.json
CHANGED
|
@@ -387,7 +387,7 @@ class Button extends PureComponent {
|
|
|
387
387
|
const borderRadiusStyle = this.getBorderRadiusStyle();
|
|
388
388
|
return <TouchableOpacity row centerV style={[this.styles.container, animateLayout && this.getAnimationDirectionStyle(), containerSizeStyle, this.isLink && this.styles.innerContainerLink, shadowStyle, margins, paddings, {
|
|
389
389
|
backgroundColor
|
|
390
|
-
}, borderRadiusStyle, outlineStyle, style]} activeOpacity={0.6} activeBackgroundColor={this.getActiveBackgroundColor()} onLayout={this.onLayout} onPress={onPress} disabled={disabled} testID={testID} {...others} ref={forwardedRef}
|
|
390
|
+
}, borderRadiusStyle, outlineStyle, style]} activeOpacity={0.6} activeBackgroundColor={this.getActiveBackgroundColor()} onLayout={this.onLayout} onPress={onPress} disabled={disabled} testID={testID} hitSlop={this.getAccessibleHitSlop()} {...others} ref={forwardedRef}>
|
|
391
391
|
{this.props.children}
|
|
392
392
|
{this.props.iconOnRight ? this.renderLabel() : this.renderIcon()}
|
|
393
393
|
{this.props.iconOnRight ? this.renderIcon() : this.renderLabel()}
|
|
@@ -117,6 +117,7 @@ declare class Checkbox extends Component<CheckboxProps, CheckboxState> {
|
|
|
117
117
|
getLabelStyle: () => {
|
|
118
118
|
color: string;
|
|
119
119
|
};
|
|
120
|
+
getAccessibleHitSlop(size: number): number;
|
|
120
121
|
renderCheckbox(): React.JSX.Element;
|
|
121
122
|
render(): React.JSX.Element;
|
|
122
123
|
validate: () => void;
|
|
@@ -144,6 +144,9 @@ class Checkbox extends Component {
|
|
|
144
144
|
color: this.props.disabled ? Colors.$textDisabled : this.state.showError ? Colors.$textDangerLight : Colors.$textDefault
|
|
145
145
|
};
|
|
146
146
|
};
|
|
147
|
+
getAccessibleHitSlop(size) {
|
|
148
|
+
return Math.max(0, (48 - size) / 2);
|
|
149
|
+
}
|
|
147
150
|
renderCheckbox() {
|
|
148
151
|
const {
|
|
149
152
|
selectedIcon,
|
|
@@ -156,7 +159,7 @@ class Checkbox extends Component {
|
|
|
156
159
|
} = this.props;
|
|
157
160
|
return (
|
|
158
161
|
//@ts-ignore
|
|
159
|
-
<TouchableOpacity {...this.getAccessibilityProps()} activeOpacity={1} testID={testID} {...others} style={[this.getBorderStyle(), style, !label && containerStyle]} onPress={this.onPress}>
|
|
162
|
+
<TouchableOpacity {...this.getAccessibilityProps()} activeOpacity={1} testID={testID} {...others} style={[this.getBorderStyle(), style, !label && containerStyle]} onPress={this.onPress} hitSlop={this.getAccessibleHitSlop(this.props.size || DEFAULT_SIZE)}>
|
|
160
163
|
{<Animated.View style={[this.styles.container, {
|
|
161
164
|
opacity: this.animationStyle.opacity
|
|
162
165
|
}, {
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import { DialogProps } from '../../incubator/dialog';
|
|
4
|
-
import { ButtonProps } from '../button';
|
|
5
|
-
type ColorPickerHeaderButtonProps = {
|
|
6
|
-
/**
|
|
7
|
-
* Ok (v) button color
|
|
8
|
-
*/
|
|
9
|
-
doneButtonColor?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Done button props
|
|
12
|
-
*/
|
|
13
|
-
doneButtonProps?: Pick<ButtonProps, 'iconSource' | 'iconStyle'>;
|
|
14
|
-
/**
|
|
15
|
-
* Dismiss button props
|
|
16
|
-
*/
|
|
17
|
-
dismissButtonProps?: Pick<ButtonProps, 'iconSource' | 'iconStyle'>;
|
|
18
|
-
};
|
|
19
4
|
export interface ColorPickerDialogProps extends DialogProps {
|
|
20
5
|
/**
|
|
21
6
|
* The initial color to pass the picker dialog
|
|
@@ -36,21 +21,15 @@ export interface ColorPickerDialogProps extends DialogProps {
|
|
|
36
21
|
/**
|
|
37
22
|
* Accessibility labels as an object of strings, ex. {addButton: 'add custom color using hex code', dismissButton: 'dismiss', doneButton: 'done', input: 'custom hex color code'}
|
|
38
23
|
*/
|
|
24
|
+
/**
|
|
25
|
+
* Ok (v) button color
|
|
26
|
+
*/
|
|
27
|
+
doneButtonColor?: string;
|
|
39
28
|
accessibilityLabels?: {
|
|
40
29
|
dismissButton?: string;
|
|
41
30
|
doneButton?: string;
|
|
42
31
|
input?: string;
|
|
43
32
|
};
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated
|
|
46
|
-
* Ok (v) button color
|
|
47
|
-
* Pass doneButtonColor via colorPickerHeaderProps
|
|
48
|
-
*/
|
|
49
|
-
doneButtonColor?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Color Picker header button props, done and dismiss button customize props
|
|
52
|
-
*/
|
|
53
|
-
colorPickerHeaderProps?: ColorPickerHeaderButtonProps;
|
|
54
33
|
/**
|
|
55
34
|
* Whether to use the new Slider implementation using Reanimated
|
|
56
35
|
*/
|
|
@@ -8,9 +8,6 @@ import { getColorValue, getValidColorString, getTextColor, BORDER_RADIUS } from
|
|
|
8
8
|
import ColorPickerDialogHeader from "./ColorPickerDialogHeader";
|
|
9
9
|
import ColorPickerPreview from "./ColorPickerPreview";
|
|
10
10
|
import ColorPickerDialogSliders from "./ColorPickerDialogSliders";
|
|
11
|
-
|
|
12
|
-
// TODO: deprecate doneButtonColor prop
|
|
13
|
-
|
|
14
11
|
const KEYBOARD_HEIGHT = 216;
|
|
15
12
|
const MODAL_PROPS = {
|
|
16
13
|
supportedOrientations: ['portrait', 'landscape', 'landscape-left', 'landscape-right'] // iOS only
|
|
@@ -30,8 +27,7 @@ const ColorPickerDialog = props => {
|
|
|
30
27
|
accessibilityLabels,
|
|
31
28
|
doneButtonColor,
|
|
32
29
|
previewInputStyle,
|
|
33
|
-
migrate
|
|
34
|
-
colorPickerHeaderProps
|
|
30
|
+
migrate
|
|
35
31
|
} = props;
|
|
36
32
|
const [keyboardHeight, setKeyboardHeight] = useState(KEYBOARD_HEIGHT);
|
|
37
33
|
const [color, setColor] = useState(Colors.getHSL(initialColor));
|
|
@@ -115,7 +111,7 @@ const ColorPickerDialog = props => {
|
|
|
115
111
|
}, []);
|
|
116
112
|
return <Dialog visible={visible} //TODO: pass all Dialog props instead
|
|
117
113
|
width="100%" bottom centerH onDismiss={onDismiss} containerStyle={styles.dialog} testID={`${testID}.dialog`} modalProps={MODAL_PROPS} {...dialogProps}>
|
|
118
|
-
<ColorPickerDialogHeader accessibilityLabels={accessibilityLabels} valid={valid} onDonePressed={onDonePressed} testID={testID} doneButtonColor={doneButtonColor} onDismiss={onDismiss}
|
|
114
|
+
<ColorPickerDialogHeader accessibilityLabels={accessibilityLabels} valid={valid} onDonePressed={onDonePressed} testID={testID} doneButtonColor={doneButtonColor} onDismiss={onDismiss} />
|
|
119
115
|
<ColorPickerPreview color={color} text={text} valid={valid} accessibilityLabels={accessibilityLabels} previewInputStyle={previewInputStyle} testID={testID} onFocus={onFocus} onChangeText={onChangeText} />
|
|
120
116
|
<ColorPickerDialogSliders keyboardHeight={keyboardHeight} color={color} onSliderValueChange={updateColor} migrate={migrate} />
|
|
121
117
|
</Dialog>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ColorPickerDialogProps } from './ColorPickerDialog';
|
|
3
|
-
type HeaderProps = Pick<ColorPickerDialogProps, 'doneButtonColor' | 'accessibilityLabels' | 'testID'
|
|
3
|
+
type HeaderProps = Pick<ColorPickerDialogProps, 'doneButtonColor' | 'accessibilityLabels' | 'testID'> & {
|
|
4
4
|
valid: boolean;
|
|
5
5
|
onDismiss: () => void;
|
|
6
6
|
onDonePressed: () => void;
|
|
@@ -13,19 +13,13 @@ const ColorPickerDialogHeader = props => {
|
|
|
13
13
|
testID,
|
|
14
14
|
doneButtonColor,
|
|
15
15
|
valid,
|
|
16
|
-
onDonePressed
|
|
17
|
-
colorPickerHeaderProps
|
|
16
|
+
onDonePressed
|
|
18
17
|
} = props;
|
|
19
|
-
const {
|
|
20
|
-
doneButtonProps,
|
|
21
|
-
dismissButtonProps,
|
|
22
|
-
doneButtonColor: doneButtonHeaderColorProp
|
|
23
|
-
} = colorPickerHeaderProps || {};
|
|
24
18
|
return <View row spread bg-$backgroundDefault paddingH-20 style={styles.header}>
|
|
25
19
|
<Button link iconSource={Assets.icons.x} iconStyle={{
|
|
26
20
|
tintColor: Colors.$iconDefault
|
|
27
|
-
}} onPress={onDismiss} accessibilityLabel={_get(accessibilityLabels, 'dismissButton')} testID={`${testID}.dialog.cancel`}
|
|
28
|
-
<Button color={doneButtonColor
|
|
21
|
+
}} onPress={onDismiss} accessibilityLabel={_get(accessibilityLabels, 'dismissButton')} testID={`${testID}.dialog.cancel`} />
|
|
22
|
+
<Button color={doneButtonColor} disabled={!valid} link iconSource={Assets.icons.check} onPress={onDonePressed} accessibilityLabel={_get(accessibilityLabels, 'doneButton')} testID={`${testID}.dialog.done`} />
|
|
29
23
|
</View>;
|
|
30
24
|
};
|
|
31
25
|
export default ColorPickerDialogHeader;
|
|
@@ -179,6 +179,13 @@ class RadioButton extends PureComponent {
|
|
|
179
179
|
}]} />
|
|
180
180
|
</View>;
|
|
181
181
|
}
|
|
182
|
+
getAccessibleHitSlop(size) {
|
|
183
|
+
const verticalPadding = Math.max(0, (48 - size) / 2);
|
|
184
|
+
return {
|
|
185
|
+
top: verticalPadding,
|
|
186
|
+
bottom: verticalPadding
|
|
187
|
+
};
|
|
188
|
+
}
|
|
182
189
|
render() {
|
|
183
190
|
const {
|
|
184
191
|
onPress,
|
|
@@ -190,7 +197,7 @@ class RadioButton extends PureComponent {
|
|
|
190
197
|
const Container = onPress || onValueChange ? TouchableOpacity : View;
|
|
191
198
|
return (
|
|
192
199
|
// @ts-ignore
|
|
193
|
-
<Container row centerV activeOpacity={1} {...others} style={containerStyle} onPress={this.onPress} {...this.getAccessibilityProps()}>
|
|
200
|
+
<Container row centerV activeOpacity={1} {...others} style={containerStyle} onPress={this.onPress} {...this.getAccessibilityProps()} hitSlop={this.getAccessibleHitSlop(this.props.size || DEFAULT_SIZE)}>
|
|
194
201
|
{!contentOnLeft && this.renderButton()}
|
|
195
202
|
{this.props.iconOnRight ? this.renderLabel() : this.renderIcon()}
|
|
196
203
|
{this.props.iconOnRight ? this.renderIcon() : this.renderLabel()}
|