react-native-ui-lib 7.39.0-snapshot.6537 → 7.39.0-snapshot.6539

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.39.0-snapshot.6537",
3
+ "version": "7.39.0-snapshot.6539",
4
4
  "main": "src/index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
@@ -32,7 +32,6 @@
32
32
  "pre-push": "npm run build:dev && npm run test",
33
33
  "docs:deploy": "./scripts/docs/deployDocs.sh",
34
34
  "docs:build": "node scripts/docs/buildDocs.js",
35
- "docs:start": "(cd docuilib && yarn start)",
36
35
  "calendar:createMocks": "node scripts/createCalendarMockData.js",
37
36
  "snippets:build": "node scripts/generateSnippets.js",
38
37
  "release": "node ./scripts/release/release.js",
@@ -7,7 +7,6 @@ const fs = require('fs');
7
7
 
8
8
  const COMPONENTS_DOCS_DIR = './docs/components';
9
9
  const SERVICES_DOCS_DIR = './docs/services';
10
- const FOUNDATION_DOCS_DIR = './docs/foundation';
11
10
 
12
11
  const VALID_COMPONENTS_CATEGORIES = [
13
12
  'foundation',
@@ -31,9 +30,6 @@ const VALID_COMPONENTS_CATEGORIES = [
31
30
 
32
31
  function buildDocs(apiFolders, componentsPreProcess) {
33
32
  let components = readComponentsFromApiFiles(apiFolders);
34
-
35
- logStatistics(components);
36
-
37
33
  components = componentsPreProcess?.(components) ?? components;
38
34
  resetDocsDir();
39
35
  processComponents(components);
@@ -96,22 +92,14 @@ function processComponents(components) {
96
92
  content += `${buildOldDocs(component)}\n`;
97
93
  }
98
94
 
95
+
99
96
  let dirPath;
100
- switch (component.category) {
101
- case 'services': {
102
- dirPath = `${SERVICES_DOCS_DIR}`;
103
- break;
104
- }
105
- case 'foundation': {
106
- dirPath = `${FOUNDATION_DOCS_DIR}`;
107
- break;
108
- }
109
- default: {
110
- const componentParentDir =
111
- componentParentName || isParentComponent ? `/${componentParentName || componentName}` : '';
112
- dirPath = `${COMPONENTS_DOCS_DIR}/${component.category}${componentParentDir}`;
113
- break;
114
- }
97
+ if (component.category === 'services') {
98
+ dirPath = `${SERVICES_DOCS_DIR}`;
99
+ } else {
100
+ const componentParentDir =
101
+ componentParentName || isParentComponent ? `/${componentParentName || componentName}` : '';
102
+ dirPath = `${COMPONENTS_DOCS_DIR}/${component.category}${componentParentDir}`;
115
103
  }
116
104
 
117
105
  if (!fs.existsSync(dirPath)) {
@@ -137,22 +125,6 @@ function generateExtendsLink(extendsLink) {
137
125
  return extendsText;
138
126
  }
139
127
 
140
- function logStatistics(components) {
141
- const groupedComponents = _.countBy(components, 'name');
142
- const duplicateComponents = Object.entries(groupedComponents)
143
- .filter(([_, count]) => count > 1)
144
- .map(([name, count]) => `${name} (${count} times)`);
145
-
146
- if (duplicateComponents.length > 0) {
147
- console.log('Components with multiple occurrences:\n-', duplicateComponents.join('\n- '));
148
- }
149
-
150
- const componentsWithoutSnippet = components.filter(c => !c.snippet).map(c => c.name);
151
- if (componentsWithoutSnippet.length > 0) {
152
- console.log('Components missing snippet:\n-', componentsWithoutSnippet.join('\n- '));
153
- }
154
- }
155
-
156
128
  function buildOldDocs(component) {
157
129
  let content = '';
158
130
  content += `import UILivePreview from '@site/src/components/UILivePreview';\n\n`;
@@ -212,10 +184,12 @@ function buildOldDocs(component) {
212
184
  /* Snippet */
213
185
  if (component.snippet) {
214
186
  content += `### Usage\n`;
215
- content += `<UILivePreview componentName={"${component.name}"} code={\`${component.snippet
187
+ content += `<UILivePreview code={\`${component.snippet
216
188
  ?.map(item => _.replace(item, new RegExp(/\$[1-9]/, 'g'), ''))
217
189
  .join('\n')
218
190
  .toString()}\`}/>\n\n`;
191
+ } else {
192
+ console.warn(`${component.name} does not have a snippet`);
219
193
  }
220
194
 
221
195
  /* Props */
@@ -47,7 +47,6 @@ declare const constants: {
47
47
  };
48
48
  backspaceKey: string;
49
49
  enterKey: string;
50
- getFontScale: () => number;
51
50
  };
52
51
  export default constants;
53
52
  export declare const _reset: () => void;
@@ -1,4 +1,4 @@
1
- import { Platform, Dimensions, NativeModules, I18nManager, AccessibilityInfo, StatusBar, PixelRatio } from 'react-native';
1
+ import { Platform, Dimensions, NativeModules, I18nManager, AccessibilityInfo, StatusBar } from 'react-native';
2
2
  export let orientations = /*#__PURE__*/function (orientations) {
3
3
  orientations["PORTRAIT"] = "portrait";
4
4
  orientations["LANDSCAPE"] = "landscape";
@@ -166,9 +166,7 @@ const constants = {
166
166
  },
167
167
  /* Keyboard */
168
168
  backspaceKey: 'Backspace',
169
- enterKey: 'Enter',
170
- /* Font scale */
171
- getFontScale: PixelRatio.getFontScale
169
+ enterKey: 'Enter'
172
170
  };
173
171
  setStatusBarHeight();
174
172
  Dimensions.addEventListener('change', updateConstants);
@@ -1,5 +1,5 @@
1
1
  import React, { useRef } from 'react';
2
- import { StyleSheet, TextInput, I18nManager } from 'react-native';
2
+ import { StyleSheet, TextInput, PixelRatio, I18nManager } from 'react-native';
3
3
  import { Colors, Typography } from "../../style";
4
4
  import { BORDER_RADIUS, getHexString, getTextColor } from "./ColorPickerPresenter";
5
5
  import View from "../view";
@@ -19,7 +19,7 @@ const ColorPickerPreview = props => {
19
19
  const textInput = useRef(null);
20
20
  const hex = getHexString(color);
21
21
  const textColor = getTextColor(hex);
22
- const fontScale = Constants.getFontScale();
22
+ const fontScale = PixelRatio.getFontScale();
23
23
  const value = Colors.isTransparent(text) ? '000000' : text;
24
24
  return <View style={[styles.preview, {
25
25
  backgroundColor: hex
@@ -159,37 +159,13 @@
159
159
  ],
160
160
  "items": [
161
161
  {
162
- "title": "Left",
163
- "content": [
164
- {
165
- "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_alignment_left_top.png"
166
- },
167
- {
168
- "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_alignment_left_bottom.png"
169
- }
170
- ]
162
+ "title": "Left"
171
163
  },
172
164
  {
173
- "title": "Center",
174
- "content": [
175
- {
176
- "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_alignment_center_top.png"
177
- },
178
- {
179
- "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_alignment_center_bottom.png"
180
- }
181
- ]
165
+ "title": "Center"
182
166
  },
183
167
  {
184
- "title": "Right",
185
- "content": [
186
- {
187
- "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_alignment_right_top.png"
188
- },
189
- {
190
- "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_alignment_right_bottom.png"
191
- }
192
- ]
168
+ "title": "Right"
193
169
  }
194
170
  ],
195
171
  "title": "Alignment",
@@ -203,20 +179,10 @@
203
179
  ],
204
180
  "items": [
205
181
  {
206
- "title": "None",
207
- "content": [
208
- {
209
- "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_accessories_none.png"
210
- }
211
- ]
182
+ "title": "None"
212
183
  },
213
184
  {
214
- "title": "Icon",
215
- "content": [
216
- {
217
- "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_accessories_icon.png"
218
- }
219
- ]
185
+ "title": "Icon"
220
186
  }
221
187
  ],
222
188
  "title": "Accessories"
@@ -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 PickerSelectionStatusToolbar from "./PickerSelectionStatusToolbar";
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
39
41
  } = props;
40
42
  const context = useContext(PickerContext);
41
43
  const [wheelPickerValue, setWheelPickerValue] = useState(context.value ?? items?.[0]?.value);
@@ -130,10 +132,14 @@ const PickerItemsList = props => {
130
132
  <ActivityIndicator />
131
133
  </View>;
132
134
  };
135
+ const renderSelectionStatus = useMemo(() => {
136
+ return <PickerSelectionStatusToolbar {...selectionStatus} availableItems={context?.availableItems} value={context?.value} toggleAllItemsSelection={context?.toggleAllItemsSelection} />;
137
+ }, [selectionStatus, context?.value, context?.availableItems, context?.toggleAllItemsSelection]);
133
138
  const renderContent = () => {
134
139
  return useWheelPicker ? renderWheel() : <>
135
140
  {renderSearchInput()}
136
141
  {renderCustomTopElement?.(context.value)}
142
+ {mode === PickerModes.MULTI && selectionStatus && renderSelectionStatus}
137
143
  {renderList()}
138
144
  </>;
139
145
  };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { PickerProps, PickerContextProps, PickerMultiValue, ButtonSelectionStatus, CheckboxSelectionStatus } from './types';
3
+ export type PickerSelectionStatusToolbarBaseProps = PickerProps['selectionStatus'] & {
4
+ value?: PickerMultiValue;
5
+ availableItems?: PickerMultiValue;
6
+ };
7
+ export type PickerSelectionStatusToolbarProps = (Partial<PickerContextProps> & (ButtonSelectionStatus & PickerSelectionStatusToolbarBaseProps)) | (Partial<PickerContextProps> & (CheckboxSelectionStatus & PickerSelectionStatusToolbarBaseProps));
8
+ export default function PickerSelectionStatusToolbar(props: PickerSelectionStatusToolbarProps): React.JSX.Element;
@@ -0,0 +1,63 @@
1
+ import React, { useCallback } from 'react';
2
+ import Button from "../button";
3
+ import Checkbox from "../checkbox";
4
+ import View from "../view";
5
+ import Text from "../text";
6
+ import { PickerSelectAllType } from "./types";
7
+ export default function PickerSelectionStatusToolbar(props) {
8
+ const {
9
+ containerStyle,
10
+ getLabel,
11
+ availableItems = [],
12
+ selectAllType = 'none',
13
+ showLabel = true,
14
+ toggleAllItemsSelection,
15
+ value = [],
16
+ renderTopCustomElement,
17
+ renderBottomCustomElement
18
+ } = props;
19
+ const isAllSelected = value.length === availableItems.length;
20
+ const checkboxIndeterminate = value.length > 0 && value.length < availableItems.length;
21
+ const label = getLabel?.({
22
+ selectedCount: value.length,
23
+ value,
24
+ isAllSelected
25
+ }) ?? `${value.length} Selected ${isAllSelected ? '(All)' : ''}`;
26
+ let buttonProps;
27
+ let checkboxProps;
28
+ switch (props.selectAllType) {
29
+ case PickerSelectAllType.button:
30
+ buttonProps = props.buttonProps;
31
+ break;
32
+ case PickerSelectAllType.checkbox:
33
+ checkboxProps = props.checkboxProps;
34
+ break;
35
+ }
36
+ const handlePress = useCallback(() => {
37
+ const newSelectionState = !isAllSelected;
38
+ toggleAllItemsSelection?.(newSelectionState);
39
+ buttonProps?.onPress?.(availableItems);
40
+ checkboxProps?.onValueChange?.(newSelectionState);
41
+ }, [isAllSelected, toggleAllItemsSelection, availableItems, buttonProps, checkboxProps]);
42
+ const renderSelectionStatus = () => {
43
+ if (selectAllType === 'button') {
44
+ return <Button label={isAllSelected ? 'Deselect All' : 'Select All'} link {...buttonProps} onPress={handlePress} />;
45
+ } else if (selectAllType === 'checkbox') {
46
+ return <Checkbox {...checkboxProps} value={value.length > 0} indeterminate={checkboxIndeterminate} onValueChange={handlePress} />;
47
+ }
48
+ };
49
+ const renderLabel = () => {
50
+ if (showLabel) {
51
+ return <Text>{label}</Text>;
52
+ }
53
+ return null;
54
+ };
55
+ return <View>
56
+ {renderTopCustomElement?.()}
57
+ <View row spread centerV paddingH-page style={containerStyle}>
58
+ {renderLabel()}
59
+ {renderSelectionStatus()}
60
+ </View>
61
+ {renderBottomCustomElement?.()}
62
+ </View>;
63
+ }
@@ -1,6 +1,6 @@
1
1
  import { RefObject } from 'react';
2
2
  import { PickerProps, PickerValue, PickerSingleValue, PickerMultiValue } from '../types';
3
- interface UsePickerSelectionProps extends Pick<PickerProps, 'migrate' | 'value' | 'onChange' | 'getItemValue' | 'topBarProps' | 'mode'> {
3
+ interface UsePickerSelectionProps extends Pick<PickerProps, 'migrate' | 'value' | 'onChange' | 'getItemValue' | 'topBarProps' | 'mode' | 'items'> {
4
4
  pickerExpandableRef: RefObject<any>;
5
5
  setSearchValue: (searchValue: string) => void;
6
6
  }
@@ -9,5 +9,8 @@ declare const usePickerSelection: (props: UsePickerSelectionProps) => {
9
9
  onDoneSelecting: (item: PickerValue) => void;
10
10
  toggleItemSelection: (item: PickerSingleValue) => void;
11
11
  cancelSelect: () => void;
12
+ setMultiFinalValue: import("react").Dispatch<import("react").SetStateAction<PickerMultiValue>>;
13
+ availableItems: PickerMultiValue;
14
+ toggleAllItemsSelection: (selectAll: boolean) => void;
12
15
  };
13
16
  export default usePickerSelection;
@@ -1,6 +1,6 @@
1
1
  import _xor from "lodash/xor";
2
2
  import _xorBy from "lodash/xorBy";
3
- import { useCallback, useState, useEffect } from 'react';
3
+ import { useCallback, useState, useEffect, useMemo } from 'react';
4
4
  import { PickerModes } from "../types";
5
5
  const usePickerSelection = props => {
6
6
  const {
@@ -11,7 +11,8 @@ const usePickerSelection = props => {
11
11
  pickerExpandableRef,
12
12
  getItemValue,
13
13
  setSearchValue,
14
- mode
14
+ mode,
15
+ items
15
16
  } = props;
16
17
  const [multiDraftValue, setMultiDraftValue] = useState(value);
17
18
  const [multiFinalValue, setMultiFinalValue] = useState(value);
@@ -43,11 +44,20 @@ const usePickerSelection = props => {
43
44
  pickerExpandableRef.current?.closeExpandable?.();
44
45
  topBarProps?.onCancel?.();
45
46
  }, [multiFinalValue, topBarProps]);
47
+ const availableItems = useMemo(() => {
48
+ return items?.filter(item => !item.disabled).map(item => item.value) || [];
49
+ }, [items]);
50
+ const toggleAllItemsSelection = useCallback(selectAll => {
51
+ setMultiDraftValue(selectAll ? availableItems : []);
52
+ }, [availableItems]);
46
53
  return {
47
54
  multiDraftValue,
48
55
  onDoneSelecting,
49
56
  toggleItemSelection,
50
- cancelSelect
57
+ cancelSelect,
58
+ setMultiFinalValue,
59
+ availableItems,
60
+ toggleAllItemsSelection
51
61
  };
52
62
  };
53
63
  export default usePickerSelection;
@@ -1,15 +1,16 @@
1
1
  import React from 'react';
2
2
  import PickerItem from './PickerItem';
3
3
  import { extractPickerItems } from './PickerPresenter';
4
- import { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods } from './types';
4
+ import { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods, PickerSelectAllType } from './types';
5
5
  type PickerStatics = {
6
6
  Item: typeof PickerItem;
7
7
  modes: typeof PickerModes;
8
8
  fieldTypes: typeof PickerFieldTypes;
9
9
  extractPickerItems: typeof extractPickerItems;
10
+ selectAllType: typeof PickerSelectAllType;
10
11
  };
11
12
  declare const Picker: React.ForwardRefExoticComponent<PickerProps & React.RefAttributes<unknown>>;
12
- export { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods };
13
+ export { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods, PickerSelectAllType };
13
14
  export { Picker };
14
15
  declare const _default: React.ForwardRefExoticComponent<PickerProps & React.RefAttributes<unknown>> & PickerStatics;
15
16
  export default _default;
@@ -18,7 +18,7 @@ import useFieldType from "./helpers/useFieldType";
18
18
  import useNewPickerProps from "./helpers/useNewPickerProps";
19
19
  // import usePickerMigrationWarnings from './helpers/usePickerMigrationWarnings';
20
20
  import { extractPickerItems } from "./PickerPresenter";
21
- import { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods } from "./types";
21
+ import { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods, PickerSelectAllType } from "./types";
22
22
  const DEFAULT_DIALOG_PROPS = {
23
23
  bottom: true,
24
24
  width: '100%'
@@ -58,6 +58,7 @@ const Picker = React.forwardRef((props, ref) => {
58
58
  showLoader,
59
59
  customLoaderElement,
60
60
  renderCustomTopElement,
61
+ selectionStatus,
61
62
  ...others
62
63
  } = themeProps;
63
64
  const {
@@ -101,7 +102,9 @@ const Picker = React.forwardRef((props, ref) => {
101
102
  multiDraftValue,
102
103
  onDoneSelecting,
103
104
  toggleItemSelection,
104
- cancelSelect
105
+ cancelSelect,
106
+ availableItems,
107
+ toggleAllItemsSelection
105
108
  } = usePickerSelection({
106
109
  migrate,
107
110
  value,
@@ -110,7 +113,8 @@ const Picker = React.forwardRef((props, ref) => {
110
113
  getItemValue,
111
114
  topBarProps,
112
115
  setSearchValue,
113
- mode
116
+ mode,
117
+ items
114
118
  });
115
119
  const {
116
120
  label,
@@ -154,9 +158,11 @@ const Picker = React.forwardRef((props, ref) => {
154
158
  getItemLabel,
155
159
  onSelectedLayout: onSelectedItemLayout,
156
160
  renderItem,
157
- selectionLimit
161
+ selectionLimit,
162
+ availableItems,
163
+ toggleAllItemsSelection
158
164
  };
159
- }, [migrate, mode, value, multiDraftValue, renderItem, getItemValue, getItemLabel, selectionLimit, onSelectedItemLayout, toggleItemSelection, onDoneSelecting]);
165
+ }, [migrate, mode, value, multiDraftValue, renderItem, getItemValue, getItemLabel, selectionLimit, onSelectedItemLayout, toggleItemSelection, onDoneSelecting, availableItems, toggleAllItemsSelection]);
160
166
  const renderPickerItem = useCallback((item, index) => {
161
167
  return <PickerItem key={`${index}-${item.value}`} {...item} />;
162
168
  }, []);
@@ -201,7 +207,7 @@ const Picker = React.forwardRef((props, ref) => {
201
207
  ...topBarProps,
202
208
  onCancel: cancelSelect,
203
209
  onDone: mode === PickerModes.MULTI ? () => onDoneSelecting(multiDraftValue) : undefined
204
- }} showSearch={showSearch} searchStyle={searchStyle} searchPlaceholder={searchPlaceholder} onSearchChange={_onSearchChange} renderCustomSearch={renderCustomSearch} renderHeader={renderHeader} listProps={listProps} useSafeArea={useSafeArea} showLoader={showLoader} customLoaderElement={customLoaderElement} renderCustomTopElement={renderCustomTopElement}>
210
+ }} showSearch={showSearch} searchStyle={searchStyle} searchPlaceholder={searchPlaceholder} onSearchChange={_onSearchChange} renderCustomSearch={renderCustomSearch} renderHeader={renderHeader} listProps={listProps} useSafeArea={useSafeArea} showLoader={showLoader} customLoaderElement={customLoaderElement} renderCustomTopElement={renderCustomTopElement} selectionStatus={selectionStatus}>
205
211
  {filteredItems}
206
212
  </PickerItemsList>;
207
213
  }, [testID, mode, useDialog, selectedItemPosition, topBarProps, cancelSelect, onDoneSelecting, multiDraftValue, showSearch, searchStyle, searchPlaceholder, _onSearchChange, renderCustomSearch, renderHeader, listProps, filteredItems, useSafeArea, useWheelPicker, items, showLoader]);
@@ -221,6 +227,8 @@ Picker.modes = PickerModes;
221
227
  Picker.fieldTypes = PickerFieldTypes;
222
228
  // @ts-expect-error
223
229
  Picker.extractPickerItems = extractPickerItems;
224
- export { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods };
230
+ //@ts-ignore
231
+ Picker.selectAllType = PickerSelectAllType;
232
+ export { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods, PickerSelectAllType };
225
233
  export { Picker }; // For tests
226
234
  export default Picker;
@@ -4,6 +4,8 @@ import { ExpandableOverlayProps, ExpandableOverlayMethods } from '../../incubato
4
4
  import { ModalTopBarProps } from '../modal/TopBar';
5
5
  import { TextFieldMethods, TextFieldProps } from '../textField';
6
6
  import { TouchableOpacityProps } from '../touchableOpacity';
7
+ import { ButtonProps } from '../button';
8
+ import { CheckboxProps } from '../checkbox';
7
9
  export declare enum PickerModes {
8
10
  SINGLE = "SINGLE",
9
11
  MULTI = "MULTI"
@@ -13,6 +15,10 @@ export declare enum PickerFieldTypes {
13
15
  filter = "filter",
14
16
  settings = "settings"
15
17
  }
18
+ export declare enum PickerSelectAllType {
19
+ button = "button",
20
+ checkbox = "checkbox"
21
+ }
16
22
  export type PickerSingleValue = string | number;
17
23
  export type PickerMultiValue = PickerSingleValue[];
18
24
  export type PickerValue = PickerSingleValue | PickerMultiValue | undefined;
@@ -147,6 +153,53 @@ type PickerExpandableOverlayProps = {
147
153
  */
148
154
  enableModalBlur?: boolean;
149
155
  };
156
+ interface PickerSelectionStatusLabelOptions {
157
+ selectedCount: number;
158
+ value: PickerMultiValue;
159
+ isAllSelected: boolean;
160
+ }
161
+ export type ButtonSelectionStatus = {
162
+ /**
163
+ * Select all element type
164
+ */
165
+ selectAllType?: PickerSelectAllType.button | `${PickerSelectAllType.button}`;
166
+ /**
167
+ * Button props
168
+ */
169
+ buttonProps?: ButtonProps;
170
+ };
171
+ export type CheckboxSelectionStatus = {
172
+ /**
173
+ * Select all element type
174
+ */
175
+ selectAllType?: PickerSelectAllType.checkbox | `${PickerSelectAllType.checkbox}`;
176
+ /**
177
+ * Checkbox props
178
+ */
179
+ checkboxProps?: CheckboxProps;
180
+ };
181
+ type PickerSelectionStatusProps = {
182
+ /**
183
+ * A function that related data to show in the label
184
+ */
185
+ getLabel?: (data: PickerSelectionStatusLabelOptions) => string;
186
+ /**
187
+ * Custom container style
188
+ */
189
+ containerStyle?: StyleProp<ViewStyle>;
190
+ /**
191
+ * Control weather to show the label or not
192
+ */
193
+ showLabel?: boolean;
194
+ /**
195
+ * Top element to render above the selection toolbar
196
+ */
197
+ renderTopCustomElement?: () => React.ReactElement;
198
+ /**
199
+ * Bottom element to render under the selection toolbar
200
+ */
201
+ renderBottomCustomElement?: () => React.ReactElement;
202
+ } & (ButtonSelectionStatus | CheckboxSelectionStatus);
150
203
  export type PickerBaseProps = Omit<TextFieldProps, 'value' | 'onChange'> & PickerPropsDeprecation & PickerExpandableOverlayProps & PickerListProps & {
151
204
  /**
152
205
  * Use dialog instead of modal picker
@@ -193,6 +246,10 @@ export type PickerBaseProps = Omit<TextFieldProps, 'value' | 'onChange'> & Picke
193
246
  * Render custom top element
194
247
  */
195
248
  renderCustomTopElement?: (value?: PickerValue) => React.ReactElement;
249
+ /**
250
+ *
251
+ */
252
+ selectionStatus?: PickerSelectionStatusProps;
196
253
  /**
197
254
  * Add onPress callback for when pressing the picker
198
255
  */
@@ -286,8 +343,10 @@ export interface PickerContextProps extends Pick<PickerProps, 'migrate' | 'value
286
343
  isMultiMode: boolean;
287
344
  onSelectedLayout: (event: any) => any;
288
345
  selectionLimit: PickerProps['selectionLimit'];
346
+ availableItems: PickerMultiValue;
347
+ toggleAllItemsSelection?: (selectAll: boolean) => void;
289
348
  }
290
- export type PickerItemsListProps = Pick<PropsWithChildren<PickerProps>, 'topBarProps' | 'listProps' | 'renderHeader' | 'useSafeArea' | 'showLoader' | 'customLoaderElement' | 'renderCustomTopElement' | 'showSearch' | 'searchStyle' | 'searchPlaceholder' | 'onSearchChange' | 'renderCustomSearch' | 'children' | 'useWheelPicker' | 'useDialog' | 'mode' | 'testID'> & {
349
+ export type PickerItemsListProps = Pick<PropsWithChildren<PickerProps>, 'topBarProps' | 'listProps' | 'renderHeader' | 'useSafeArea' | 'showLoader' | 'customLoaderElement' | 'renderCustomTopElement' | 'selectionStatus' | 'showSearch' | 'searchStyle' | 'searchPlaceholder' | 'onSearchChange' | 'renderCustomSearch' | 'children' | 'useWheelPicker' | 'useDialog' | 'mode' | 'testID'> & {
291
350
  items?: {
292
351
  value: any;
293
352
  label: any;
@@ -10,6 +10,11 @@ export let PickerFieldTypes = /*#__PURE__*/function (PickerFieldTypes) {
10
10
  PickerFieldTypes["settings"] = "settings";
11
11
  return PickerFieldTypes;
12
12
  }({});
13
+ export let PickerSelectAllType = /*#__PURE__*/function (PickerSelectAllType) {
14
+ PickerSelectAllType["button"] = "button";
15
+ PickerSelectAllType["checkbox"] = "checkbox";
16
+ return PickerSelectAllType;
17
+ }({});
13
18
 
14
19
  // TODO: Remove type
15
20
  // type PickerValueDeprecated = {value: string | number; label: string};
@@ -285,6 +285,38 @@
285
285
  "description": "html:<h2>Title</h2><p>This is a html content</p><ul><li>item 1</li><li>item 2</li></ul>"
286
286
  }
287
287
  ]
288
+ },
289
+ {
290
+ "title": "Code",
291
+ "sections": [
292
+ {
293
+ "title": "Usage",
294
+ "type": "usage"
295
+ },
296
+ {
297
+ "type": "info"
298
+ },
299
+ {
300
+ "type": "tip"
301
+ },
302
+ {
303
+ "type": "banner",
304
+ "title": "NOTE",
305
+ "description": "This is an interesting information"
306
+ },
307
+ {
308
+ "type": "banner",
309
+ "title": "Banner",
310
+ "description": "This is some massage to the user",
311
+ "color": "pink",
312
+ "icon": ""
313
+ },
314
+ {
315
+ "type": "props",
316
+ "title": "API",
317
+ "description": "This is the list of additional props for the Text component"
318
+ }
319
+ ]
288
320
  }
289
321
  ]
290
322
  }
@@ -29,18 +29,30 @@
29
29
  }
30
30
  ],
31
31
  "snippet": [
32
- "<Timeline",
33
- " topLine={{type: Timeline.lineTypes.DASHED}}",
34
- " bottomLine={{state: Timeline.states.SUCCESS}}",
35
- " point={{state: Timeline.states.SUCCESS}}",
32
+ "<Timeline ",
33
+ " topLine={{",
34
+ " state: Timeline.states.ERROR",
35
+ " }$1}",
36
+ " bottomLine={{",
37
+ " type: Timeline.lineTypes.DASHED,",
38
+ " color: Colors.orange40",
39
+ " }$2}",
40
+ " point={{",
41
+ " type: Timeline.pointTypes.OUTLINE,",
42
+ " color: Colors.orange40,",
43
+ " icon: Assets.icons.demo.camera,",
44
+ " anchorRef: alignToTitle ? titleRef : undefined",
45
+ " }$3}",
36
46
  ">",
37
- " <View padding-20 bg-grey60 br30>",
38
- " <Text text70BO>Title</Text>",
39
- " <View marginT-5 padding-8 bg-white br30>",
40
- " <Text>Description</Text>",
41
- " </View>",
42
- " </View>",
43
- " </Timeline>"
47
+ " <View flex centerH paddingH-20>",
48
+ " <Text text70 dark10 ref={titleRef}>",
49
+ " {title}",
50
+ " </Text>",
51
+ " <Text dark40>",
52
+ " {description}",
53
+ " </Text>",
54
+ " </View>",
55
+ "</Timeline>"
44
56
  ],
45
57
  "docs": {
46
58
  "hero": {
@@ -126,7 +138,29 @@
126
138
  "title": "Current",
127
139
  "content": [
128
140
  {
129
- "snippet": "<Timeline topLine={{state: Timeline.states.CURRENT}} bottomLine={{state: Timeline.states.CURRENT}} point={{state: Timeline.states.CURRENT}}><View style={{height: 88}}/></Timeline>"
141
+ "props": {
142
+ "state": "current",
143
+ "point": {
144
+ "type": {
145
+ "type": "bullet"
146
+ }
147
+ },
148
+ "bottomLine": {
149
+ "type": {
150
+ "type": "solid"
151
+ }
152
+ }
153
+ }
154
+ },
155
+ {
156
+ "props": {
157
+ "point": {
158
+ "type": {
159
+ "type": "bullet",
160
+ "color": "#116DFF"
161
+ }
162
+ }
163
+ }
130
164
  }
131
165
  ],
132
166
  "description": "state: current"
@@ -135,7 +169,19 @@
135
169
  "title": "Next",
136
170
  "content": [
137
171
  {
138
- "snippet": "<Timeline topLine={{state: Timeline.states.NEXT}} bottomLine={{state: Timeline.states.NEXT}} point={{state: Timeline.states.NEXT, type: Timeline.pointTypes.CIRCLE}}><View style={{height: 88}}/></Timeline>"
172
+ "props": {
173
+ "state": "next",
174
+ "point": {
175
+ "type": {
176
+ "type": "bullet"
177
+ }
178
+ },
179
+ "bottomLine": {
180
+ "type": {
181
+ "type": "solid"
182
+ }
183
+ }
184
+ }
139
185
  }
140
186
  ],
141
187
  "description": "state: next"
@@ -144,7 +190,19 @@
144
190
  "title": "Error",
145
191
  "content": [
146
192
  {
147
- "snippet": "<Timeline topLine={{state: Timeline.states.ERROR}} bottomLine={{state: Timeline.states.ERROR}} point={{state: Timeline.states.ERROR}}><View style={{height: 88}}/></Timeline>"
193
+ "props": {
194
+ "state": "error",
195
+ "point": {
196
+ "type": {
197
+ "type": "bullet"
198
+ }
199
+ },
200
+ "bottomLine": {
201
+ "type": {
202
+ "type": "solid"
203
+ }
204
+ }
205
+ }
148
206
  }
149
207
  ],
150
208
  "description": "state: error"
@@ -153,7 +211,19 @@
153
211
  "title": "Success",
154
212
  "content": [
155
213
  {
156
- "snippet": "<Timeline topLine={{state: Timeline.states.SUCCESS}} bottomLine={{state: Timeline.states.SUCCESS}} point={{state: Timeline.states.SUCCESS}}><View style={{height: 88}}/></Timeline>"
214
+ "props": {
215
+ "state": "success",
216
+ "point": {
217
+ "type": {
218
+ "type": "bullet"
219
+ }
220
+ },
221
+ "bottomLine": {
222
+ "type": {
223
+ "type": "solid"
224
+ }
225
+ }
226
+ }
157
227
  }
158
228
  ],
159
229
  "description": "state: success"
@@ -168,30 +238,15 @@
168
238
  "items": [
169
239
  {
170
240
  "title": "Bullet",
171
- "description": "type: bullet",
172
- "content": [
173
- {
174
- "snippet": "<Timeline point={{type: Timeline.pointTypes.BULLET}}><View style={{height: 88}}/></Timeline>"
175
- }
176
- ]
241
+ "description": "type: bullet"
177
242
  },
178
243
  {
179
244
  "title": "Circle",
180
- "description": "type: circle",
181
- "content": [
182
- {
183
- "snippet": "<Timeline point={{state: Timeline.states.NEXT, type: Timeline.pointTypes.CIRCLE}}><View style={{height: 88}}/></Timeline>"
184
- }
185
- ]
245
+ "description": "type: circle"
186
246
  },
187
247
  {
188
248
  "title": "Outline",
189
- "description": "type: outline",
190
- "content": [
191
- {
192
- "snippet": "<Timeline point={{type: Timeline.pointTypes.OUTLINE}}><View style={{height: 88}}/></Timeline>"
193
- }
194
- ]
249
+ "description": "type: outline"
195
250
  }
196
251
  ],
197
252
  "title": "Point",
@@ -205,7 +260,14 @@
205
260
  "title": "Text",
206
261
  "content": [
207
262
  {
208
- "snippet": "<Timeline point={{label: '1'}}><View style={{height: 88}}/></Timeline>"
263
+ "props": {
264
+ "state": "current",
265
+ "bottomLine": {
266
+ "type": {
267
+ "type": "solid"
268
+ }
269
+ }
270
+ }
209
271
  }
210
272
  ],
211
273
  "description": "text: “1”"
@@ -214,18 +276,20 @@
214
276
  "title": "Icon",
215
277
  "content": [
216
278
  {
217
- "snippet": "<Timeline point={{state: Timeline.states.SUCCESS, icon: Assets.icons.checkSmall}}><View style={{height: 88}}/></Timeline>"
279
+ "props": {
280
+ "state": "current",
281
+ "bottomLine": {
282
+ "type": {
283
+ "type": "dashed"
284
+ }
285
+ }
286
+ }
218
287
  }
219
288
  ],
220
289
  "description": "icon: Assets.icons.general.checkmarkSmall"
221
290
  },
222
291
  {
223
292
  "title": "Icon without background",
224
- "content": [
225
- {
226
- "snippet": "<Timeline point={{state: Timeline.states.SUCCESS, icon: Assets.icons.search, removeIconBackground: true}}><View style={{height: 88}}/></Timeline>"
227
- }
228
- ],
229
293
  "description": "icon: Assets.icons.general.favorite, removeIconBackground: true"
230
294
  }
231
295
  ],
@@ -237,20 +301,10 @@
237
301
  "items": [
238
302
  {
239
303
  "title": "Solid",
240
- "content": [
241
- {
242
- "snippet": "<Timeline topLine={{state: Timeline.states.CURRENT}} point={{removeIconBackground: true}}><View style={{height: 88}}/></Timeline>"
243
- }
244
- ],
245
304
  "description": "type: solid"
246
305
  },
247
306
  {
248
307
  "title": "Dashed",
249
- "content": [
250
- {
251
- "snippet": "<Timeline topLine={{state: Timeline.states.CURRENT, type: Timeline.lineTypes.DASHED}} point={{removeIconBackground: true}}><View style={{height: 88}}/></Timeline>"
252
- }
253
- ],
254
308
  "description": "type: dashed"
255
309
  }
256
310
  ],
@@ -263,11 +317,6 @@
263
317
  "items": [
264
318
  {
265
319
  "title": "Entry",
266
- "content": [
267
- {
268
- "snippet": "<Timeline topLine={{state: Timeline.states.NEXT, entry: true}} bottomLine={{state: Timeline.states.NEXT, entry: true}} point={{removeIconBackground: true}}><View style={{height: 88}}/></Timeline>"
269
- }
270
- ],
271
320
  "description": "entry: true"
272
321
  }
273
322
  ],
@@ -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,
@@ -104,7 +104,7 @@
104
104
  {
105
105
  "props": {
106
106
  "visible": true,
107
- "message": "Mika Or was saved to contacts."
107
+ "message": "\"Mika Or\" was saved to contacts."
108
108
  }
109
109
  }
110
110
  ]
package/src/index.d.ts CHANGED
@@ -67,7 +67,7 @@ export { default as PanningContext } from './components/panningViews/panningCont
67
67
  export { default as PanningProvider, PanningDirections, PanLocationProps, PanAmountsProps, PanDirectionsProps } from './components/panningViews/panningProvider';
68
68
  export { default as PanResponderView, PanResponderViewProps } from './components/panningViews/panResponderView';
69
69
  export { default as asPanViewConsumer } from './components/panningViews/asPanViewConsumer';
70
- export { default as Picker, PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods } from './components/picker';
70
+ export { default as Picker, PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods, PickerSelectAllType } from './components/picker';
71
71
  export { default as PieChart, type PieChartProps, PieChartSegmentProps } from './components/pieChart';
72
72
  export { default as ProgressBar, ProgressBarProps } from './components/progressBar';
73
73
  export { default as ProgressiveImage, ProgressiveImageProps } from './components/progressiveImage';
package/src/index.js CHANGED
@@ -166,6 +166,7 @@ var _exportNames = {
166
166
  RenderCustomModalProps: true,
167
167
  PickerItemsListProps: true,
168
168
  PickerMethods: true,
169
+ PickerSelectAllType: true,
169
170
  PieChart: true,
170
171
  PieChartSegmentProps: true,
171
172
  ProgressBar: true,
@@ -1110,6 +1111,12 @@ Object.defineProperty(exports, "PickerSearchStyle", {
1110
1111
  return _picker().PickerSearchStyle;
1111
1112
  }
1112
1113
  });
1114
+ Object.defineProperty(exports, "PickerSelectAllType", {
1115
+ enumerable: true,
1116
+ get: function () {
1117
+ return _picker().PickerSelectAllType;
1118
+ }
1119
+ });
1113
1120
  Object.defineProperty(exports, "PickerValue", {
1114
1121
  enumerable: true,
1115
1122
  get: function () {