react-native-ui-lib 7.38.0-snapshot.6285 → 7.38.0-snapshot.6288

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ui-lib",
3
- "version": "7.38.0-snapshot.6285",
3
+ "version": "7.38.0-snapshot.6288",
4
4
  "main": "src/index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
@@ -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} hitSlop={this.getAccessibleHitSlop()}>
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} colorPickerHeaderProps={colorPickerHeaderProps} />
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' | 'colorPickerHeaderProps'> & {
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`} {...dismissButtonProps} />
28
- <Button color={doneButtonColor || doneButtonHeaderColorProp} disabled={!valid} link iconSource={Assets.icons.check} onPress={onDonePressed} accessibilityLabel={_get(accessibilityLabels, 'doneButton')} testID={`${testID}.dialog.done`} {...doneButtonProps} />
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()}
@@ -7,13 +7,20 @@ import View from "../../components/view";
7
7
  import { Constants } from "../../commons/new";
8
8
  const SHADOW_RADIUS = 4;
9
9
  const THUMB_SIZE = 24;
10
+ const THUMB_ACCESSIBLE_HITSLOP = Math.max(0, 48 - THUMB_SIZE) / 2;
11
+ const DEFAULT_THUMB_HIT_SLOP = {
12
+ top: THUMB_ACCESSIBLE_HITSLOP,
13
+ bottom: THUMB_ACCESSIBLE_HITSLOP,
14
+ left: THUMB_ACCESSIBLE_HITSLOP,
15
+ right: THUMB_ACCESSIBLE_HITSLOP
16
+ };
10
17
  const Thumb = props => {
11
18
  const {
12
19
  disabled,
13
20
  disableActiveStyling,
14
21
  activeStyle,
15
22
  defaultStyle,
16
- hitSlop,
23
+ hitSlop = DEFAULT_THUMB_HIT_SLOP,
17
24
  onSeekStart,
18
25
  onSeekEnd,
19
26
  start,