react-native-ui-lib 7.39.0 → 7.39.1-snapshot.6736

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.
Files changed (190) hide show
  1. package/package.json +4 -2
  2. package/scripts/docs/buildDocsCommon.js +16 -83
  3. package/src/assets/index.js +2 -5
  4. package/src/assets/internal/icons/index.js +50 -0
  5. package/src/assets/internal/icons/index.web.js +50 -0
  6. package/src/assets/internal/images/index.js +26 -0
  7. package/src/assets/internal/images/index.web.js +26 -0
  8. package/src/assets/internal/index.d.ts +4 -0
  9. package/src/assets/internal/index.js +8 -0
  10. package/src/commons/Constants.d.ts +1 -0
  11. package/src/commons/Constants.js +4 -2
  12. package/src/components/KeyboardAwareScrollView/KeyboardAwareScrollView.api.json +40 -0
  13. package/src/components/avatar/index.d.ts +8 -19
  14. package/src/components/avatar/index.js +4 -2
  15. package/src/components/button/button.api.json +25 -85
  16. package/src/components/card/index.js +1 -1
  17. package/src/components/checkbox/index.d.ts +4 -1
  18. package/src/components/checkbox/index.js +7 -5
  19. package/src/components/chip/index.js +1 -1
  20. package/src/components/chipsInput/index.js +2 -2
  21. package/src/components/colorPicker/ColorPickerDialog.js +1 -1
  22. package/src/components/colorPicker/ColorPickerDialogHeader.js +2 -2
  23. package/src/components/colorPicker/ColorPickerPreview.js +2 -2
  24. package/src/components/colorPicker/index.js +1 -1
  25. package/src/components/colorSwatch/index.js +2 -3
  26. package/src/components/dateTimePicker/index.js +2 -2
  27. package/src/components/hint/hint.api.json +39 -5
  28. package/src/components/hint/index.js +2 -3
  29. package/src/components/icon/index.d.ts +12 -3
  30. package/src/components/icon/index.js +18 -9
  31. package/src/components/image/index.d.ts +1 -1
  32. package/src/components/modal/TopBar.js +1 -1
  33. package/src/components/modal/api/modalTopBar.api.json +1 -1
  34. package/src/components/modal/modal.api.json +54 -0
  35. package/src/components/overlay/index.js +4 -6
  36. package/src/components/panningViews/panDismissibleView.js +1 -1
  37. package/src/components/panningViews/panGestureView.js +1 -1
  38. package/src/components/panningViews/panListenerView.js +1 -1
  39. package/src/components/panningViews/panResponderView.js +1 -1
  40. package/src/components/panningViews/panningContext.js +1 -0
  41. package/src/components/picker/PickerItem.js +1 -1
  42. package/src/components/picker/PickerItemsList.js +6 -2
  43. package/src/components/picker/PickerSelectionStatusBar.d.ts +3 -0
  44. package/src/components/picker/PickerSelectionStatusBar.js +60 -0
  45. package/src/components/picker/api/picker.api.json +387 -5
  46. package/src/components/picker/helpers/useFieldType.js +2 -2
  47. package/src/components/picker/helpers/usePickerSelection.d.ts +4 -1
  48. package/src/components/picker/helpers/usePickerSelection.js +19 -3
  49. package/src/components/picker/index.d.ts +2 -2
  50. package/src/components/picker/index.js +15 -7
  51. package/src/components/picker/types.d.ts +48 -1
  52. package/src/components/scrollBar/index.js +3 -3
  53. package/src/components/sortableList/SortableList.api.json +7 -7
  54. package/src/components/stepper/index.js +3 -8
  55. package/src/components/tabController/apis/pageCarousel.api.json +8 -5
  56. package/src/components/textField/ClearButton.js +1 -1
  57. package/src/components/textField/textField.api.json +26 -8
  58. package/src/components/timeline/timeline.api.json +57 -106
  59. package/src/components/toast/index.js +1 -1
  60. package/src/components/wizard/WizardStates.js +3 -4
  61. package/src/hooks/useScrollTo/index.js +9 -4
  62. package/src/incubator/dialog/useDialogContent.js +1 -1
  63. package/src/incubator/expandableOverlay/index.js +1 -0
  64. package/src/incubator/panView/index.js +1 -1
  65. package/src/incubator/slider/Thumb.js +8 -1
  66. package/src/incubator/toast/toast.api.json +57 -7
  67. package/src/index.d.ts +1 -1
  68. package/src/index.js +7 -0
  69. package/src/assets/icons/index.js +0 -26
  70. package/src/assets/images/index.js +0 -5
  71. package/src/components/stepper/assets/minusSmall.png +0 -0
  72. package/src/components/stepper/assets/minusSmall@1.5x.png +0 -0
  73. package/src/components/stepper/assets/minusSmall@2x.png +0 -0
  74. package/src/components/stepper/assets/minusSmall@3x.png +0 -0
  75. package/src/components/stepper/assets/minusSmall@4x.png +0 -0
  76. package/src/components/stepper/assets/plusSmall.png +0 -0
  77. package/src/components/stepper/assets/plusSmall@1.5x.png +0 -0
  78. package/src/components/stepper/assets/plusSmall@2x.png +0 -0
  79. package/src/components/stepper/assets/plusSmall@3x.png +0 -0
  80. package/src/components/stepper/assets/plusSmall@4x.png +0 -0
  81. /package/src/assets/{icons → internal/icons}/check.png +0 -0
  82. /package/src/assets/{icons → internal/icons}/check@1.5x.png +0 -0
  83. /package/src/assets/{icons → internal/icons}/check@2x.png +0 -0
  84. /package/src/assets/{icons → internal/icons}/check@3x.png +0 -0
  85. /package/src/assets/{icons → internal/icons}/check@4x.png +0 -0
  86. /package/src/{components/wizard/assets → assets/internal/icons}/checkMarkSmall.png +0 -0
  87. /package/src/{components/wizard/assets → assets/internal/icons}/checkMarkSmall@1.5x.png +0 -0
  88. /package/src/{components/wizard/assets → assets/internal/icons}/checkMarkSmall@2x.png +0 -0
  89. /package/src/{components/wizard/assets → assets/internal/icons}/checkMarkSmall@3x.png +0 -0
  90. /package/src/{components/wizard/assets → assets/internal/icons}/checkMarkSmall@4x.png +0 -0
  91. /package/src/assets/{icons/check-small.png → internal/icons/checkSmall.png} +0 -0
  92. /package/src/assets/{icons/check-small@1.5x.png → internal/icons/checkSmall@1.5x.png} +0 -0
  93. /package/src/assets/{icons/check-small@2x.png → internal/icons/checkSmall@2x.png} +0 -0
  94. /package/src/assets/{icons/check-small@3x.png → internal/icons/checkSmall@3x.png} +0 -0
  95. /package/src/assets/{icons/check-small@4x.png → internal/icons/checkSmall@4x.png} +0 -0
  96. /package/src/{components/picker/assets/dropdown.png → assets/internal/icons/chevronDown.png} +0 -0
  97. /package/src/{components/picker/assets/dropdown@1.5x.png → assets/internal/icons/chevronDown@1.5x.png} +0 -0
  98. /package/src/{components/picker/assets/dropdown@2x.png → assets/internal/icons/chevronDown@2x.png} +0 -0
  99. /package/src/{components/picker/assets/dropdown@3x.png → assets/internal/icons/chevronDown@3x.png} +0 -0
  100. /package/src/{components/picker/assets/dropdown@4x.png → assets/internal/icons/chevronDown@4x.png} +0 -0
  101. /package/src/{components/wizard/assets → assets/internal/icons}/exclamationSmall.png +0 -0
  102. /package/src/{components/wizard/assets → assets/internal/icons}/exclamationSmall@1.5x.png +0 -0
  103. /package/src/{components/wizard/assets → assets/internal/icons}/exclamationSmall@2x.png +0 -0
  104. /package/src/{components/wizard/assets → assets/internal/icons}/exclamationSmall@3x.png +0 -0
  105. /package/src/{components/wizard/assets → assets/internal/icons}/exclamationSmall@4x.png +0 -0
  106. /package/src/{components/stepper/assets → assets/internal/icons}/minusOutline.png +0 -0
  107. /package/src/{components/stepper/assets → assets/internal/icons}/minusOutline@1.5x.png +0 -0
  108. /package/src/{components/stepper/assets → assets/internal/icons}/minusOutline@2x.png +0 -0
  109. /package/src/{components/stepper/assets → assets/internal/icons}/minusOutline@3x.png +0 -0
  110. /package/src/{components/stepper/assets → assets/internal/icons}/minusOutline@4x.png +0 -0
  111. /package/src/{components/stepper/assets → assets/internal/icons}/minusOutlineSmall.png +0 -0
  112. /package/src/{components/stepper/assets → assets/internal/icons}/minusOutlineSmall@1.5x.png +0 -0
  113. /package/src/{components/stepper/assets → assets/internal/icons}/minusOutlineSmall@2x.png +0 -0
  114. /package/src/{components/stepper/assets → assets/internal/icons}/minusOutlineSmall@3x.png +0 -0
  115. /package/src/{components/stepper/assets → assets/internal/icons}/minusOutlineSmall@4x.png +0 -0
  116. /package/src/assets/{icons → internal/icons}/minusSmall.png +0 -0
  117. /package/src/assets/{icons → internal/icons}/minusSmall@1.5x.png +0 -0
  118. /package/src/assets/{icons → internal/icons}/minusSmall@2x.png +0 -0
  119. /package/src/assets/{icons → internal/icons}/minusSmall@3x.png +0 -0
  120. /package/src/assets/{icons → internal/icons}/minusSmall@4x.png +0 -0
  121. /package/src/{components/stepper/assets → assets/internal/icons}/plusOutline.png +0 -0
  122. /package/src/{components/stepper/assets → assets/internal/icons}/plusOutline@1.5x.png +0 -0
  123. /package/src/{components/stepper/assets → assets/internal/icons}/plusOutline@2x.png +0 -0
  124. /package/src/{components/stepper/assets → assets/internal/icons}/plusOutline@3x.png +0 -0
  125. /package/src/{components/stepper/assets → assets/internal/icons}/plusOutline@4x.png +0 -0
  126. /package/src/{components/stepper/assets → assets/internal/icons}/plusOutlineSmall.png +0 -0
  127. /package/src/{components/stepper/assets → assets/internal/icons}/plusOutlineSmall@1.5x.png +0 -0
  128. /package/src/{components/stepper/assets → assets/internal/icons}/plusOutlineSmall@2x.png +0 -0
  129. /package/src/{components/stepper/assets → assets/internal/icons}/plusOutlineSmall@3x.png +0 -0
  130. /package/src/{components/stepper/assets → assets/internal/icons}/plusOutlineSmall@4x.png +0 -0
  131. /package/src/assets/{icons → internal/icons}/plusSmall.png +0 -0
  132. /package/src/assets/{icons → internal/icons}/plusSmall@1.5x.png +0 -0
  133. /package/src/assets/{icons → internal/icons}/plusSmall@2x.png +0 -0
  134. /package/src/assets/{icons → internal/icons}/plusSmall@3x.png +0 -0
  135. /package/src/assets/{icons → internal/icons}/plusSmall@4x.png +0 -0
  136. /package/src/assets/{icons → internal/icons}/search.png +0 -0
  137. /package/src/assets/{icons → internal/icons}/search@1.5x.png +0 -0
  138. /package/src/assets/{icons → internal/icons}/search@2x.png +0 -0
  139. /package/src/assets/{icons → internal/icons}/search@3x.png +0 -0
  140. /package/src/assets/{icons → internal/icons}/search@4x.png +0 -0
  141. /package/src/assets/{icons → internal/icons}/x.png +0 -0
  142. /package/src/assets/{icons → internal/icons}/x@2x.png +0 -0
  143. /package/src/assets/{icons → internal/icons}/x@3x.png +0 -0
  144. /package/src/assets/{icons → internal/icons}/xFlat.png +0 -0
  145. /package/src/assets/{icons → internal/icons}/xFlat@1.5x.png +0 -0
  146. /package/src/assets/{icons → internal/icons}/xFlat@2x.png +0 -0
  147. /package/src/assets/{icons → internal/icons}/xFlat@3x.png +0 -0
  148. /package/src/assets/{icons → internal/icons}/xFlat@4x.png +0 -0
  149. /package/src/assets/{icons → internal/icons}/xMedium.png +0 -0
  150. /package/src/assets/{icons → internal/icons}/xMedium@1.5x.png +0 -0
  151. /package/src/assets/{icons → internal/icons}/xMedium@2x.png +0 -0
  152. /package/src/assets/{icons → internal/icons}/xMedium@3x.png +0 -0
  153. /package/src/assets/{icons → internal/icons}/xMedium@4x.png +0 -0
  154. /package/src/{components/chipsInput/assets → assets/internal/icons}/xSmall.png +0 -0
  155. /package/src/{components/chipsInput/assets → assets/internal/icons}/xSmall@1.5x.png +0 -0
  156. /package/src/{components/chipsInput/assets → assets/internal/icons}/xSmall@2x.png +0 -0
  157. /package/src/{components/chipsInput/assets → assets/internal/icons}/xSmall@3x.png +0 -0
  158. /package/src/{components/chipsInput/assets → assets/internal/icons}/xSmall@4x.png +0 -0
  159. /package/src/assets/{images → internal/images}/gradient.png +0 -0
  160. /package/src/{components/scrollBar/assets → assets/internal/images}/gradientOverlay.png +0 -0
  161. /package/src/{components/overlay/assets/GradientOverlayHigh.png → assets/internal/images/gradientOverlayHigh.png} +0 -0
  162. /package/src/{components/overlay/assets/GradientOverlayHigh@1.5x.png → assets/internal/images/gradientOverlayHigh@1.5x.png} +0 -0
  163. /package/src/{components/overlay/assets/GradientOverlayHigh@2x.png → assets/internal/images/gradientOverlayHigh@2x.png} +0 -0
  164. /package/src/{components/overlay/assets/GradientOverlayHigh@3x.png → assets/internal/images/gradientOverlayHigh@3x.png} +0 -0
  165. /package/src/{components/overlay/assets/GradientOverlayHigh@4x.png → assets/internal/images/gradientOverlayHigh@4x.png} +0 -0
  166. /package/src/{components/overlay/assets/GradientOverlayLow.png → assets/internal/images/gradientOverlayLow.png} +0 -0
  167. /package/src/{components/overlay/assets/GradientOverlayLow@1.5x.png → assets/internal/images/gradientOverlayLow@1.5x.png} +0 -0
  168. /package/src/{components/overlay/assets/GradientOverlayLow@2x.png → assets/internal/images/gradientOverlayLow@2x.png} +0 -0
  169. /package/src/{components/overlay/assets/GradientOverlayLow@3x.png → assets/internal/images/gradientOverlayLow@3x.png} +0 -0
  170. /package/src/{components/overlay/assets/GradientOverlayLow@4x.png → assets/internal/images/gradientOverlayLow@4x.png} +0 -0
  171. /package/src/{components/overlay/assets/GradientOverlayMedium.png → assets/internal/images/gradientOverlayMedium.png} +0 -0
  172. /package/src/{components/overlay/assets/GradientOverlayMedium@1.5x.png → assets/internal/images/gradientOverlayMedium@1.5x.png} +0 -0
  173. /package/src/{components/overlay/assets/GradientOverlayMedium@2x.png → assets/internal/images/gradientOverlayMedium@2x.png} +0 -0
  174. /package/src/{components/overlay/assets/GradientOverlayMedium@3x.png → assets/internal/images/gradientOverlayMedium@3x.png} +0 -0
  175. /package/src/{components/overlay/assets/GradientOverlayMedium@4x.png → assets/internal/images/gradientOverlayMedium@4x.png} +0 -0
  176. /package/src/{components/hint/assets → assets/internal/images}/hintTipMiddle.png +0 -0
  177. /package/src/{components/hint/assets → assets/internal/images}/hintTipMiddle@1.5x.png +0 -0
  178. /package/src/{components/hint/assets → assets/internal/images}/hintTipMiddle@2x.png +0 -0
  179. /package/src/{components/hint/assets → assets/internal/images}/hintTipMiddle@3x.png +0 -0
  180. /package/src/{components/hint/assets → assets/internal/images}/hintTipMiddle@4x.png +0 -0
  181. /package/src/{components/hint/assets → assets/internal/images}/hintTipSide.png +0 -0
  182. /package/src/{components/hint/assets → assets/internal/images}/hintTipSide@1.5x.png +0 -0
  183. /package/src/{components/hint/assets → assets/internal/images}/hintTipSide@2x.png +0 -0
  184. /package/src/{components/hint/assets → assets/internal/images}/hintTipSide@3x.png +0 -0
  185. /package/src/{components/hint/assets → assets/internal/images}/hintTipSide@4x.png +0 -0
  186. /package/src/{components/colorSwatch/assets/transparentSwatch/TransparentSwatch.png → assets/internal/images/transparentSwatch.png} +0 -0
  187. /package/src/{components/colorSwatch/assets/transparentSwatch/TransparentSwatch@1.5x.png → assets/internal/images/transparentSwatch@1.5x.png} +0 -0
  188. /package/src/{components/colorSwatch/assets/transparentSwatch/TransparentSwatch@2x.png → assets/internal/images/transparentSwatch@2x.png} +0 -0
  189. /package/src/{components/colorSwatch/assets/transparentSwatch/TransparentSwatch@3x.png → assets/internal/images/transparentSwatch@3x.png} +0 -0
  190. /package/src/{components/colorSwatch/assets/transparentSwatch/TransparentSwatch@4x.png → assets/internal/images/transparentSwatch@4x.png} +0 -0
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "Modal",
3
+ "category": "overlays",
4
+ "description": "Component that present content on top of the invoking screen",
5
+ "example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/ModalScreen.tsx",
6
+ "props": [
7
+ {
8
+ "name": "enableModalBlur",
9
+ "type": "boolean",
10
+ "description": "Blurs the modal background when transparent (iOS only)"
11
+ },
12
+ {
13
+ "name": "blurView",
14
+ "type": "JSX.Element",
15
+ "description": "A custom view to use as a BlueView instead of the default one"
16
+ },
17
+ {
18
+ "name": "onBackgroundPress",
19
+ "type": "function",
20
+ "description": "Allow dismissing a modal when clicking on its background"
21
+ },
22
+ {
23
+ "name": "overlayBackgroundColor",
24
+ "type": "string",
25
+ "description": "The background color of the overlay"
26
+ },
27
+ {
28
+ "name": "useGestureHandlerRootView",
29
+ "type": "boolean",
30
+ "description": "Should add a GestureHandlerRootView"
31
+ },
32
+ {
33
+ "name": "useKeyboardAvoidingView",
34
+ "type": "boolean",
35
+ "description": "Should add a KeyboardAvoidingView (iOS only)"
36
+ },
37
+ {
38
+ "name": "keyboardAvoidingViewProps",
39
+ "type": "object",
40
+ "description": "Send additional props to the KeyboardAvoidingView (iOS only)"
41
+ }
42
+ ],
43
+ "snippet": [
44
+ "<Modal",
45
+ " visible={visible}",
46
+ " onBackgroundPress={() => setVisible(false)}",
47
+ " overlayBackgroundColor=\"rgba(0, 0, 0, 0.7)\"",
48
+ ">",
49
+ " <View>",
50
+ " <Text>Modal Content</Text>",
51
+ " </View>",
52
+ "</Modal>"
53
+ ]
54
+ }
@@ -3,9 +3,7 @@ import React, { PureComponent } from 'react';
3
3
  import { StyleSheet, Image } from 'react-native';
4
4
  import { Colors } from "../../style";
5
5
  import View from "../view";
6
- const gradientImageLow = require("./assets/GradientOverlayLow.png");
7
- const gradientImageMed = require("./assets/GradientOverlayMedium.png");
8
- const gradientImageHigh = require("./assets/GradientOverlayHigh.png");
6
+ import Assets from "../../assets";
9
7
  const OVERLY_TYPES = {
10
8
  VERTICAL: 'vertical',
11
9
  TOP: 'top',
@@ -77,11 +75,11 @@ class Overlay extends PureComponent {
77
75
  getImageSource = (type, intensity) => {
78
76
  if (type !== OVERLY_TYPES.SOLID) {
79
77
  if (intensity === OverlayIntensityType.MEDIUM) {
80
- return gradientImageMed;
78
+ return Assets.internal.images.gradientOverlayMedium;
81
79
  } else if (intensity === OverlayIntensityType.HIGH) {
82
- return gradientImageHigh;
80
+ return Assets.internal.images.gradientOverlayHigh;
83
81
  } else {
84
- return gradientImageLow;
82
+ return Assets.internal.images.gradientOverlayLow;
85
83
  }
86
84
  }
87
85
  };
@@ -23,7 +23,7 @@ const MAXIMUM_DRAGS_AFTER_SWIPE = 2;
23
23
  * @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/PanDismissibleView/PanDismissibleView.gif?raw=true
24
24
  */
25
25
  class PanDismissibleView extends PureComponent {
26
- static displayName = 'PanDismissibleView';
26
+ static displayName = 'IGNORE';
27
27
  static defaultProps = {
28
28
  directions: DEFAULT_DIRECTIONS,
29
29
  animationOptions: DEFAULT_ANIMATION_OPTIONS,
@@ -13,7 +13,7 @@ const BOUNCINESS = 6;
13
13
  * @description: PanGestureView component for drag and swipe gestures (supports only vertical gestures at the moment)
14
14
  */
15
15
  class PanGestureView extends Component {
16
- static displayName = 'PanGestureView';
16
+ static displayName = 'IGNORE';
17
17
  static defaultProps = {
18
18
  direction: GestureDirections.DOWN
19
19
  };
@@ -14,7 +14,7 @@ const DEFAULT_SWIPE_VELOCITY = 1.8;
14
14
  * @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/PanListenerView/PanListenerView.gif?raw=true
15
15
  */
16
16
  class PanListenerView extends PureComponent {
17
- static displayName = 'PanListenerView';
17
+ static displayName = 'IGNORE';
18
18
  static defaultProps = {
19
19
  directions: DEFAULT_DIRECTIONS,
20
20
  panSensitivity: DEFAULT_PAN_SENSITIVITY,
@@ -9,7 +9,7 @@ import asPanViewConsumer from "./asPanViewConsumer";
9
9
  * @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/PanResponderView/PanResponderView.gif?raw=true
10
10
  */
11
11
  class PanResponderView extends PureComponent {
12
- static displayName = 'PanResponderView';
12
+ static displayName = 'IGNORE';
13
13
  static defaultProps = {
14
14
  isAnimated: false
15
15
  };
@@ -1,3 +1,4 @@
1
1
  import React from 'react';
2
2
  const PanningContext = React.createContext({});
3
+ PanningContext.displayName = 'IGNORE';
3
4
  export default PanningContext;
@@ -23,7 +23,7 @@ const PickerItem = props => {
23
23
  label,
24
24
  labelStyle,
25
25
  disabled,
26
- selectedIcon = Assets.icons.check,
26
+ selectedIcon = Assets.internal.icons.check,
27
27
  selectedIconColor = Colors.$iconPrimary,
28
28
  onPress,
29
29
  testID
@@ -15,6 +15,7 @@ import { PickerModes } from "./types";
15
15
  import PickerContext from "./PickerContext";
16
16
  import PickerItem from "./PickerItem";
17
17
  import { Constants } from "../../commons/new";
18
+ import PickerSelectionStatusBar from "./PickerSelectionStatusBar";
18
19
  const keyExtractor = (_item, index) => index.toString();
19
20
  const PickerItemsList = props => {
20
21
  const {
@@ -35,7 +36,8 @@ const PickerItemsList = props => {
35
36
  testID,
36
37
  showLoader,
37
38
  customLoaderElement,
38
- renderCustomTopElement
39
+ renderCustomTopElement,
40
+ selectionStatus: selectionStatusProps
39
41
  } = props;
40
42
  const context = useContext(PickerContext);
41
43
  const [wheelPickerValue, setWheelPickerValue] = useState(context.value ?? items?.[0]?.value);
@@ -45,7 +47,7 @@ const PickerItemsList = props => {
45
47
  return renderCustomSearch(props);
46
48
  }
47
49
  return <View style={styles.searchInputContainer}>
48
- <Icon style={styles.searchIcon} tintColor={Colors.$iconDefault} source={searchStyle.icon || Assets.icons.search} />
50
+ <Icon style={styles.searchIcon} tintColor={Colors.$iconDefault} source={searchStyle.icon || Assets.internal.icons.search} />
49
51
  <TextInput testID={testID}
50
52
  // ref={r => (this.search = r)}
51
53
  style={[styles.searchInput, {
@@ -130,10 +132,12 @@ const PickerItemsList = props => {
130
132
  <ActivityIndicator />
131
133
  </View>;
132
134
  };
135
+ const selectionStatus = useMemo(() => mode === PickerModes.MULTI && selectionStatusProps && <PickerSelectionStatusBar {...selectionStatusProps} />, [selectionStatusProps, mode]);
133
136
  const renderContent = () => {
134
137
  return useWheelPicker ? renderWheel() : <>
135
138
  {renderSearchInput()}
136
139
  {renderCustomTopElement?.(context.value)}
140
+ {selectionStatus}
137
141
  {renderList()}
138
142
  </>;
139
143
  };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { PickerSelectionStatusProps } from './types';
3
+ export default function PickerSelectionStatusBar(props: PickerSelectionStatusProps): React.JSX.Element;
@@ -0,0 +1,60 @@
1
+ import React, { useCallback, useContext } from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import Button from "../button";
4
+ import Checkbox from "../checkbox";
5
+ import View from "../view";
6
+ import Text from "../text";
7
+ import Dividers from "../../style/dividers";
8
+ import PickerContext from "./PickerContext";
9
+ export default function PickerSelectionStatusBar(props) {
10
+ const {
11
+ containerStyle,
12
+ getLabel,
13
+ showLabel = true
14
+ } = props;
15
+ const context = useContext(PickerContext);
16
+ const {
17
+ toggleAllItemsSelection,
18
+ selectedCount,
19
+ areAllItemsSelected
20
+ } = context;
21
+ const checkboxIndeterminate = selectedCount > 0 && !areAllItemsSelected;
22
+ const label = getLabel?.({
23
+ selectedCount,
24
+ areAllItemsSelected
25
+ }) ?? `${selectedCount} Selected ${areAllItemsSelected ? '(All)' : ''}`;
26
+ const handlePress = useCallback(() => {
27
+ const newSelectionState = !areAllItemsSelected;
28
+ toggleAllItemsSelection?.(newSelectionState);
29
+ if (props.selectAllType === 'button') {
30
+ props?.buttonProps?.onPress?.({
31
+ customValue: newSelectionState
32
+ });
33
+ } else if (props.selectAllType === 'checkbox') {
34
+ props?.checkboxProps?.onValueChange?.(newSelectionState);
35
+ }
36
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37
+ }, [areAllItemsSelected, toggleAllItemsSelection]);
38
+ const renderSelectionStatus = () => {
39
+ return <View flexG={!showLabel} style={!showLabel && styles.componentContainer}>
40
+ {props.selectAllType === 'button' ? <Button label={areAllItemsSelected ? 'Deselect All' : 'Select All'} link {...props?.buttonProps} onPress={handlePress} /> : props.selectAllType === 'checkbox' && <Checkbox {...props.checkboxProps} value={selectedCount > 0} indeterminate={checkboxIndeterminate} onValueChange={handlePress} />}
41
+ </View>;
42
+ };
43
+ const renderLabel = () => {
44
+ if (showLabel) {
45
+ return <Text>{label}</Text>;
46
+ }
47
+ };
48
+ return <View>
49
+ <View row spread paddingH-page marginV-s4 style={containerStyle}>
50
+ {renderLabel()}
51
+ {renderSelectionStatus()}
52
+ </View>
53
+ <View style={Dividers.d20} />
54
+ </View>;
55
+ }
56
+ const styles = StyleSheet.create({
57
+ componentContainer: {
58
+ alignItems: 'flex-end'
59
+ }
60
+ });
@@ -108,13 +108,395 @@
108
108
  ],
109
109
  "snippet": [
110
110
  "<Picker",
111
- " value={currentValue$1}",
111
+ " value={2$1}",
112
112
  " placeholder={'Placeholder'$2}",
113
113
  " onChange={() => console.log('changed')$3}",
114
+ " trailingAccessory={<Icon source={Assets.icons.demo.chevronDown}/>}",
115
+ " items={[{label: 'Item 1', value: 1}, {label: 'Item 2', value: 2},{label: 'Item 3', value: 3}]}",
114
116
  ">",
115
- " {_.map(items, item => (",
116
- " return renderItem(item, index);",
117
- " ))$4}",
118
117
  "</Picker>"
119
- ]
118
+ ],
119
+ "docs": {
120
+ "hero": {
121
+ "title": "Picker",
122
+ "description": "Picker allows the user to select an option from a variety of choices available.Pressing the Picker Field, will open a dialog or modal displaying a list of available options for selection.",
123
+ "type": "hero",
124
+ "layout": "horizontal",
125
+ "content": [
126
+ {
127
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_cover.png"
128
+ }
129
+ ]
130
+ },
131
+ "tabs": [
132
+ {
133
+ "title": "Overview",
134
+ "sections": [
135
+ {
136
+ "type": "section",
137
+ "title": "Usage Example",
138
+ "description": "Pickers allow selection of an option or multiple options from a list usually displayed using an actionSheet. Pickers can be used in forms, settings screens or as part of an interactive flow.",
139
+ "content": [
140
+ {
141
+ "value": "https://embed.figma.com/design/xFjvYNkGTmYTGYMLrmz9Ir/Guidelines-to-Docs?node-id=4415-185562&embed-host=share"
142
+ }
143
+ ]
144
+ },
145
+ {
146
+ "type": "list",
147
+ "items": [
148
+ {
149
+ "title": "Form Field (default)",
150
+ "description": "Mainly used as part of a form, works cohesively with the text field component and other form related components.",
151
+ "content": [
152
+ {
153
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_types_form.png"
154
+ }
155
+ ]
156
+ },
157
+ {
158
+ "title": "Filter Field",
159
+ "description": "Used mostly for filtering a screen or part of it. Can be combined with search functionality.\nThe colon symbol in the Label is not part of the component itself and should be included as part of the text string.",
160
+ "content": [
161
+ {
162
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_types_filter.png"
163
+ }
164
+ ]
165
+ },
166
+ {
167
+ "title": "Settings Field",
168
+ "description": "Based on ListItem component.\nUsed mostly when the picker is part of a settings screen.",
169
+ "content": [
170
+ {
171
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_types_settings.png"
172
+ }
173
+ ]
174
+ }
175
+ ],
176
+ "layout": "horizontal",
177
+ "title": "Picker Types",
178
+ "description": "Various types of pickers are available to accommodate different needs and use cases. "
179
+ },
180
+ {
181
+ "type": "section",
182
+ "title": "Picker Types Examples",
183
+ "content": [
184
+ {
185
+ "value": "https://embed.figma.com/design/xFjvYNkGTmYTGYMLrmz9Ir/Guidelines-to-Docs?node-id=4415-185650&embed-host=share"
186
+ }
187
+ ]
188
+ },
189
+ {
190
+ "type": "table",
191
+ "columns": ["State/Type/Preset", "Preview"],
192
+ "items": [
193
+ {
194
+ "title": "Default",
195
+ "content": [
196
+ {
197
+ "flexed": true,
198
+ "snippet": "<Picker preset='outline' placeholder='select' items={[{label: 'Selected Value', value: 1}]} value={1} trailingAccessory={<Icon source={Assets.icons.demo.chevronDown}/>}/>",
199
+ "props": {
200
+ "preset": "outline",
201
+ "label": "Label",
202
+ "placeholder": "Select"
203
+ }
204
+ }
205
+ ]
206
+ },
207
+ {
208
+ "title": "Value selected + icon prefix ",
209
+ "content": [
210
+ {
211
+ "flexed": true,
212
+ "snippet": "<Picker preset='outline' placeholder='select' leadingAccessory={<Icon source={Assets.icons.demo.star} marginR-s2/>} trailingAccessory={<Icon source={Assets.icons.demo.chevronDown}/>} items={[{label: 'Selected Value', value: 1}]} value={1}/>"
213
+ }
214
+ ]
215
+ },
216
+ {
217
+ "title": "Disabled",
218
+ "content": [
219
+ {
220
+ "flexed": true,
221
+ "snippet": "<Picker preset='outline' label='Label' placeholder='Select' editable={false} trailingAccessory={<Icon source={Assets.icons.demo.chevronDown}/>} />"
222
+ }
223
+ ]
224
+ },
225
+ {
226
+ "title": "Validation error (value not selected)",
227
+ "content": [
228
+ {
229
+ "flexed": true,
230
+ "snippet": "<Picker preset='outline' label='Label' placeholder='Select' validationMessage='Validation Message' trailingAccessory={<Icon source={Assets.icons.demo.chevronDown}/>} />"
231
+ }
232
+ ]
233
+ }
234
+ ],
235
+ "title": "Form Field"
236
+ },
237
+ {
238
+ "type": "table",
239
+ "columns": ["State/Type/Preset", "Preview"],
240
+ "items": [
241
+ {
242
+ "title": "Default",
243
+ "content": [
244
+ {
245
+ "props": {
246
+ "items": [
247
+ {
248
+ "label": "Selected Value",
249
+ "value": 1
250
+ }
251
+ ],
252
+ "value": 1,
253
+ "fieldType": "filter"
254
+ }
255
+ }
256
+ ]
257
+ },
258
+ {
259
+ "title": "With label",
260
+ "content": [
261
+ {
262
+ "props": {
263
+ "label": "Label: ",
264
+ "items": [
265
+ {
266
+ "label": "Selected Value",
267
+ "value": 1
268
+ }
269
+ ],
270
+ "value": 1,
271
+ "fieldType": "filter"
272
+ }
273
+ }
274
+ ]
275
+ },
276
+ {
277
+ "title": "Multiple values selected",
278
+ "content": [
279
+ {
280
+ "props": {
281
+ "mode": "MULTI",
282
+ "items": [
283
+ {
284
+ "label": "Value 1",
285
+ "value": 1
286
+ },
287
+ {
288
+ "label": "Value 2",
289
+ "value": 2
290
+ }
291
+ ],
292
+ "value": [1, 2],
293
+ "fieldType": "filter"
294
+ }
295
+ }
296
+ ]
297
+ }
298
+ ],
299
+ "title": "Filter Field"
300
+ },
301
+ {
302
+ "type": "table",
303
+ "columns": ["State/Type/Preset", "Preview"],
304
+ "items": [
305
+ {
306
+ "title": "Default",
307
+ "content": [
308
+ {
309
+ "background": "#E8ECF0",
310
+ "flexed": true,
311
+ "snippet": "<Picker label='Label' placeholder='Select' fieldType='settings' containerStyle={{padding: 20, backgroundColor: Colors.$backgroundDefault}}/>"
312
+ }
313
+ ]
314
+ },
315
+ {
316
+ "title": "Value selected + icon prefix ",
317
+ "content": [
318
+ {
319
+ "background": "#E8ECF0",
320
+ "flexed": true,
321
+ "snippet": "<Picker label='Label' placeholder='Select' value={1} fieldType='settings' items={[{label: 'Selected value', value: 1}]} containerStyle={{padding: 20, backgroundColor: Colors.$backgroundDefault}}/>",
322
+ "props": {
323
+ "label": "Label",
324
+ "placeholder": "Select",
325
+ "fieldType": "settings",
326
+ "items": [
327
+ {
328
+ "label": "Selected Value",
329
+ "value": 1
330
+ }
331
+ ],
332
+ "value": 1
333
+ }
334
+ }
335
+ ]
336
+ }
337
+ ],
338
+ "title": "Settings Field"
339
+ },
340
+ {
341
+ "type": "list",
342
+ "items": [
343
+ {
344
+ "title": "Dialog",
345
+ "description": "Recommended for short value lists.",
346
+ "content": [
347
+ {
348
+ "value": "https://embed.figma.com/design/xFjvYNkGTmYTGYMLrmz9Ir/Guidelines-to-Docs?node-id=4415-185705&embed-host=share"
349
+ }
350
+ ]
351
+ },
352
+ {
353
+ "title": "Modal",
354
+ "description": "Used for longer lists like country selection, currency selection or a language picker.",
355
+ "content": [
356
+ {
357
+ "value": "https://embed.figma.com/design/xFjvYNkGTmYTGYMLrmz9Ir/Guidelines-to-Docs?node-id=4415-185740&embed-host=share"
358
+ }
359
+ ]
360
+ }
361
+ ],
362
+ "layout": "horizontal",
363
+ "title": "Picker Values display options",
364
+ "description": "The Picker component serves as an entry point to a list of selectable values, usually displayed in a modal or a dialog."
365
+ },
366
+ {
367
+ "type": "list",
368
+ "items": [
369
+ {
370
+ "title": "Single selection",
371
+ "description": "Tapping on an item will select it and close the dialog. In scrollable long lists, the selected item will be displayed at the top of the list to stay visible. ",
372
+ "content": [
373
+ {
374
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_values_dialog_single.png"
375
+ }
376
+ ]
377
+ },
378
+ {
379
+ "title": "Multi-select",
380
+ "description": "In multi-select dialogs, a clear CTA for “Done” or “Save” is required to confirm the selection and dismiss the dialog.",
381
+ "content": [
382
+ {
383
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_values_dialog_multiple.png"
384
+ }
385
+ ]
386
+ }
387
+ ],
388
+ "layout": "horizontal",
389
+ "title": "Values displayed in Dialog",
390
+ "description": "The Picker component serves as an entry point to a list of selectable values, usually displayed in a modal or a dialog."
391
+ },
392
+ {
393
+ "type": "list",
394
+ "items": [
395
+ {
396
+ "title": "Maximum Selected",
397
+ "description": "When the user reaches the limited amount of options allowed to select, the non-selected options will become disabled to restrict the user from selecting more options.",
398
+ "content": [
399
+ {
400
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_dialog_states_max.png"
401
+ }
402
+ ]
403
+ },
404
+ {
405
+ "title": "Validation Error",
406
+ "description": "markdown:Product can set the minimum amount for the selected options. If the user selects less options than the minimum: \n- Display a validation error in the picker header. The error text should explain the user should select at least one option.\n- The dialog CTA will become disabled.\n- If the user will close the dialog, the changes won’t be saved.\n- When the user selects the minimum required options, the validation error will disappear and the CTA will become active.",
407
+ "content": [
408
+ {
409
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_dialog_states_validation.png"
410
+ }
411
+ ]
412
+ },
413
+ {
414
+ "title": "Loading Data",
415
+ "description": "If the data can't be loaded before opening the dialog, a Loader should be shown to let the user know that content is being fetched.\nThe search input is hidden while loading.\nSince the number of items to be loaded is unpredictable, a fixed spacing of 120px below and above the loader has been set.",
416
+ "content": [
417
+ {
418
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_dialog_states_loading.png"
419
+ }
420
+ ]
421
+ }
422
+ ],
423
+ "title": "Dialog States",
424
+ "layout": "horizontal"
425
+ },
426
+ {
427
+ "type": "list",
428
+ "items": [
429
+ {
430
+ "title": "Single selection",
431
+ "description": "Tapping on one of the list items will select it and close the modal. The CTA is optional and disabled by default. It can be added in cases where users might not expect or want the modal to auto-dismiss upon selection.\nThe selected Item is hoisted on top of long lists by default (placed above other values). This can also be set for short lists.\nA search bar can be added on top of the values list.",
432
+ "content": [
433
+ {
434
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_modal_single.png"
435
+ }
436
+ ]
437
+ },
438
+ {
439
+ "title": "Multi-select",
440
+ "description": "In multi-selection dialogs, a CTA for “Done” or “Save” is required to confirm the selection and dismiss the modal.",
441
+ "content": [
442
+ {
443
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_modal_multiple.png"
444
+ }
445
+ ]
446
+ },
447
+ {
448
+ "title": "Select all",
449
+ "description": "Providing a clear “select all” action is a good practice. In case all items are selected, display a “clear all” action. Make sure items number is clearly displayed according to the selection.",
450
+ "content": [
451
+ {
452
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_modal_selectAll.png"
453
+ }
454
+ ]
455
+ },
456
+ {
457
+ "title": "Select all checkbox",
458
+ "description": "In some cases, using checkbox for the “select all” action will be more appropriate. Note that “select all” checkbox can use an “indeterminate” state, if needed. \nMake sure that selected items number is clearly displayed. ",
459
+ "content": [
460
+ {
461
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_modal_selectAll_checkbox.png"
462
+ }
463
+ ]
464
+ },
465
+ {
466
+ "title": "Loading Data",
467
+ "description": "If the data can't be loaded prior to opening the modal, a Loader should be shown, indicating that content is being fetched.\nSearch input is hidden while loading, and the loader is aligned to the center of the screen.",
468
+ "content": [
469
+ {
470
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_modal_loading.png"
471
+ }
472
+ ]
473
+ }
474
+ ],
475
+ "layout": "horizontal",
476
+ "title": "Values displayed in Modal",
477
+ "description": "This type of selection list is used for long lists, e.g. contacts, countries and currencies."
478
+ },
479
+ {
480
+ "type": "section",
481
+ "title": "Picker Presets",
482
+ "description": "Pickers allow selection of an option/value or multiple options/values from a list. Pickers can be used in forms, settings screens or as part of an interactive flow. ",
483
+ "content": [
484
+ {
485
+ "value": "https://embed.figma.com/design/xFjvYNkGTmYTGYMLrmz9Ir/Guidelines-to-Docs?node-id=4418-192956&embed-host=share"
486
+ }
487
+ ]
488
+ },
489
+ {
490
+ "type": "section",
491
+ "title": "Spec",
492
+ "content": [
493
+ {
494
+ "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Picker/picker_spec.png"
495
+ }
496
+ ]
497
+ }
498
+ ]
499
+ }
500
+ ]
501
+ }
120
502
  }
@@ -4,8 +4,8 @@ import { Typography, Colors } from "../../../style";
4
4
  import View from "../../view";
5
5
  import Text from "../../text";
6
6
  import Icon from "../../icon";
7
+ import Assets from "../../../assets";
7
8
  import { PickerFieldTypes } from "../types";
8
- const dropdown = require("../assets/dropdown.png");
9
9
  const useFieldType = props => {
10
10
  const {
11
11
  fieldType,
@@ -30,7 +30,7 @@ const useFieldType = props => {
30
30
  ...Typography.text70,
31
31
  color: Colors.$textNeutral
32
32
  },
33
- trailingAccessory: trailingAccessory ?? <Icon marginL-s1 source={dropdown} />
33
+ trailingAccessory: trailingAccessory ?? <Icon marginL-s1 source={Assets.internal.icons.chevronDown} />
34
34
  };
35
35
  } else if (fieldType === PickerFieldTypes.settings) {
36
36
  return {