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

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.6288",
3
+ "version": "7.38.0-snapshot.6290",
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} hitSlop={this.getAccessibleHitSlop()} {...others} ref={forwardedRef}>
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()}>
391
391
  {this.props.children}
392
392
  {this.props.iconOnRight ? this.renderLabel() : this.renderIcon()}
393
393
  {this.props.iconOnRight ? this.renderIcon() : this.renderLabel()}
@@ -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} hitSlop={this.getAccessibleHitSlop(this.props.size || DEFAULT_SIZE)}>
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;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { StyleProp, ViewStyle } from 'react-native';
3
3
  import { ColorsModifiers } from '../../commons/new';
4
+ import { ImageProps } from '../image';
4
5
  export interface ColorInfo {
5
6
  index?: number;
6
7
  tintColor?: string;
@@ -42,6 +43,10 @@ interface Props {
42
43
  * Color swatch size
43
44
  */
44
45
  size?: number;
46
+ /**
47
+ * Icon image source
48
+ */
49
+ selectedIconSource?: ImageProps['source'];
45
50
  }
46
51
  export type ColorSwatchProps = Props & ColorsModifiers;
47
52
  export declare const SWATCH_MARGIN = 12;
@@ -124,6 +124,7 @@ class ColorSwatch extends PureComponent {
124
124
  onPress,
125
125
  unavailable,
126
126
  size = DEFAULT_SIZE,
127
+ selectedIconSource,
127
128
  ...others
128
129
  } = this.props;
129
130
  const {
@@ -144,7 +145,7 @@ class ColorSwatch extends PureComponent {
144
145
  {Colors.isTransparent(this.color) && <Image source={transparentImage} style={this.styles.transparentImage} resizeMode={'cover'} />}
145
146
  {unavailable ? <View style={[this.styles.unavailable, {
146
147
  backgroundColor: tintColor
147
- }]} /> : <Animated.Image source={Assets.icons.check} style={{
148
+ }]} /> : <Animated.Image source={selectedIconSource || Assets.icons.check} style={{
148
149
  tintColor,
149
150
  opacity: isSelected,
150
151
  transform: [{
@@ -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()} hitSlop={this.getAccessibleHitSlop(this.props.size || DEFAULT_SIZE)}>
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()}
@@ -7,20 +7,13 @@ 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
- };
17
10
  const Thumb = props => {
18
11
  const {
19
12
  disabled,
20
13
  disableActiveStyling,
21
14
  activeStyle,
22
15
  defaultStyle,
23
- hitSlop = DEFAULT_THUMB_HIT_SLOP,
16
+ hitSlop,
24
17
  onSeekStart,
25
18
  onSeekEnd,
26
19
  start,