react-native-ui-lib 7.38.0-snapshot.6282 → 7.38.0-snapshot.6285
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/checkbox/index.d.ts +0 -1
- package/src/components/checkbox/index.js +1 -4
- package/src/components/colorPicker/ColorPickerDialog.d.ts +25 -4
- package/src/components/colorPicker/ColorPickerDialog.js +6 -2
- package/src/components/colorPicker/ColorPickerDialogHeader.d.ts +1 -1
- package/src/components/colorPicker/ColorPickerDialogHeader.js +9 -3
- package/src/components/radioButton/index.js +1 -8
package/package.json
CHANGED
|
@@ -117,7 +117,6 @@ declare class Checkbox extends Component<CheckboxProps, CheckboxState> {
|
|
|
117
117
|
getLabelStyle: () => {
|
|
118
118
|
color: string;
|
|
119
119
|
};
|
|
120
|
-
getAccessibleHitSlop(size: number): number;
|
|
121
120
|
renderCheckbox(): React.JSX.Element;
|
|
122
121
|
render(): React.JSX.Element;
|
|
123
122
|
validate: () => void;
|
|
@@ -144,9 +144,6 @@ 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
|
-
}
|
|
150
147
|
renderCheckbox() {
|
|
151
148
|
const {
|
|
152
149
|
selectedIcon,
|
|
@@ -159,7 +156,7 @@ class Checkbox extends Component {
|
|
|
159
156
|
} = this.props;
|
|
160
157
|
return (
|
|
161
158
|
//@ts-ignore
|
|
162
|
-
<TouchableOpacity {...this.getAccessibilityProps()} activeOpacity={1} testID={testID} {...others} style={[this.getBorderStyle(), style, !label && containerStyle]} onPress={this.onPress}
|
|
159
|
+
<TouchableOpacity {...this.getAccessibilityProps()} activeOpacity={1} testID={testID} {...others} style={[this.getBorderStyle(), style, !label && containerStyle]} onPress={this.onPress}>
|
|
163
160
|
{<Animated.View style={[this.styles.container, {
|
|
164
161
|
opacity: this.animationStyle.opacity
|
|
165
162
|
}, {
|
|
@@ -1,6 +1,21 @@
|
|
|
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
|
+
};
|
|
4
19
|
export interface ColorPickerDialogProps extends DialogProps {
|
|
5
20
|
/**
|
|
6
21
|
* The initial color to pass the picker dialog
|
|
@@ -21,15 +36,21 @@ export interface ColorPickerDialogProps extends DialogProps {
|
|
|
21
36
|
/**
|
|
22
37
|
* Accessibility labels as an object of strings, ex. {addButton: 'add custom color using hex code', dismissButton: 'dismiss', doneButton: 'done', input: 'custom hex color code'}
|
|
23
38
|
*/
|
|
24
|
-
/**
|
|
25
|
-
* Ok (v) button color
|
|
26
|
-
*/
|
|
27
|
-
doneButtonColor?: string;
|
|
28
39
|
accessibilityLabels?: {
|
|
29
40
|
dismissButton?: string;
|
|
30
41
|
doneButton?: string;
|
|
31
42
|
input?: string;
|
|
32
43
|
};
|
|
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;
|
|
33
54
|
/**
|
|
34
55
|
* Whether to use the new Slider implementation using Reanimated
|
|
35
56
|
*/
|
|
@@ -8,6 +8,9 @@ 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
|
+
|
|
11
14
|
const KEYBOARD_HEIGHT = 216;
|
|
12
15
|
const MODAL_PROPS = {
|
|
13
16
|
supportedOrientations: ['portrait', 'landscape', 'landscape-left', 'landscape-right'] // iOS only
|
|
@@ -27,7 +30,8 @@ const ColorPickerDialog = props => {
|
|
|
27
30
|
accessibilityLabels,
|
|
28
31
|
doneButtonColor,
|
|
29
32
|
previewInputStyle,
|
|
30
|
-
migrate
|
|
33
|
+
migrate,
|
|
34
|
+
colorPickerHeaderProps
|
|
31
35
|
} = props;
|
|
32
36
|
const [keyboardHeight, setKeyboardHeight] = useState(KEYBOARD_HEIGHT);
|
|
33
37
|
const [color, setColor] = useState(Colors.getHSL(initialColor));
|
|
@@ -111,7 +115,7 @@ const ColorPickerDialog = props => {
|
|
|
111
115
|
}, []);
|
|
112
116
|
return <Dialog visible={visible} //TODO: pass all Dialog props instead
|
|
113
117
|
width="100%" bottom centerH onDismiss={onDismiss} containerStyle={styles.dialog} testID={`${testID}.dialog`} modalProps={MODAL_PROPS} {...dialogProps}>
|
|
114
|
-
<ColorPickerDialogHeader accessibilityLabels={accessibilityLabels} valid={valid} onDonePressed={onDonePressed} testID={testID} doneButtonColor={doneButtonColor} onDismiss={onDismiss} />
|
|
118
|
+
<ColorPickerDialogHeader accessibilityLabels={accessibilityLabels} valid={valid} onDonePressed={onDonePressed} testID={testID} doneButtonColor={doneButtonColor} onDismiss={onDismiss} colorPickerHeaderProps={colorPickerHeaderProps} />
|
|
115
119
|
<ColorPickerPreview color={color} text={text} valid={valid} accessibilityLabels={accessibilityLabels} previewInputStyle={previewInputStyle} testID={testID} onFocus={onFocus} onChangeText={onChangeText} />
|
|
116
120
|
<ColorPickerDialogSliders keyboardHeight={keyboardHeight} color={color} onSliderValueChange={updateColor} migrate={migrate} />
|
|
117
121
|
</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' | 'colorPickerHeaderProps'> & {
|
|
4
4
|
valid: boolean;
|
|
5
5
|
onDismiss: () => void;
|
|
6
6
|
onDonePressed: () => void;
|
|
@@ -13,13 +13,19 @@ const ColorPickerDialogHeader = props => {
|
|
|
13
13
|
testID,
|
|
14
14
|
doneButtonColor,
|
|
15
15
|
valid,
|
|
16
|
-
onDonePressed
|
|
16
|
+
onDonePressed,
|
|
17
|
+
colorPickerHeaderProps
|
|
17
18
|
} = props;
|
|
19
|
+
const {
|
|
20
|
+
doneButtonProps,
|
|
21
|
+
dismissButtonProps,
|
|
22
|
+
doneButtonColor: doneButtonHeaderColorProp
|
|
23
|
+
} = colorPickerHeaderProps || {};
|
|
18
24
|
return <View row spread bg-$backgroundDefault paddingH-20 style={styles.header}>
|
|
19
25
|
<Button link iconSource={Assets.icons.x} iconStyle={{
|
|
20
26
|
tintColor: Colors.$iconDefault
|
|
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`} />
|
|
27
|
+
}} onPress={onDismiss} accessibilityLabel={_get(accessibilityLabels, 'dismissButton')} testID={`${testID}.dialog.cancel`} {...dismissButtonProps} />
|
|
28
|
+
<Button color={doneButtonColor || doneButtonHeaderColorProp} disabled={!valid} link iconSource={Assets.icons.check} onPress={onDonePressed} accessibilityLabel={_get(accessibilityLabels, 'doneButton')} testID={`${testID}.dialog.done`} {...doneButtonProps} />
|
|
23
29
|
</View>;
|
|
24
30
|
};
|
|
25
31
|
export default ColorPickerDialogHeader;
|
|
@@ -179,13 +179,6 @@ 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
|
-
}
|
|
189
182
|
render() {
|
|
190
183
|
const {
|
|
191
184
|
onPress,
|
|
@@ -197,7 +190,7 @@ class RadioButton extends PureComponent {
|
|
|
197
190
|
const Container = onPress || onValueChange ? TouchableOpacity : View;
|
|
198
191
|
return (
|
|
199
192
|
// @ts-ignore
|
|
200
|
-
<Container row centerV activeOpacity={1} {...others} style={containerStyle} onPress={this.onPress} {...this.getAccessibilityProps()}
|
|
193
|
+
<Container row centerV activeOpacity={1} {...others} style={containerStyle} onPress={this.onPress} {...this.getAccessibilityProps()}>
|
|
201
194
|
{!contentOnLeft && this.renderButton()}
|
|
202
195
|
{this.props.iconOnRight ? this.renderLabel() : this.renderIcon()}
|
|
203
196
|
{this.props.iconOnRight ? this.renderIcon() : this.renderLabel()}
|