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

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.6539",
3
+ "version": "7.39.0-snapshot.6543",
4
4
  "main": "src/index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
@@ -32,6 +32,7 @@
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)",
35
36
  "calendar:createMocks": "node scripts/createCalendarMockData.js",
36
37
  "snippets:build": "node scripts/generateSnippets.js",
37
38
  "release": "node ./scripts/release/release.js",
@@ -7,6 +7,7 @@ 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';
10
11
 
11
12
  const VALID_COMPONENTS_CATEGORIES = [
12
13
  'foundation',
@@ -30,6 +31,9 @@ const VALID_COMPONENTS_CATEGORIES = [
30
31
 
31
32
  function buildDocs(apiFolders, componentsPreProcess) {
32
33
  let components = readComponentsFromApiFiles(apiFolders);
34
+
35
+ logStatistics(components);
36
+
33
37
  components = componentsPreProcess?.(components) ?? components;
34
38
  resetDocsDir();
35
39
  processComponents(components);
@@ -84,22 +88,26 @@ function processComponents(components) {
84
88
  content += `sidebar_label: ${componentName}\n`;
85
89
  content += '---\n\n';
86
90
 
87
- if (component.docs) {
88
- content += `import ComponentPage from '@site/src/components/ComponentPage';\n\n`;
89
- const componentObject = JSON.stringify(component);
90
- content += `<ComponentPage component={${componentObject}}/>\n`;
91
- } else {
92
- content += `${buildOldDocs(component)}\n`;
93
- }
94
-
91
+ content += `import ComponentPage from '@site/src/components/ComponentPage';\n\n`;
92
+ const componentObject = JSON.stringify(component);
93
+ content += `<ComponentPage component={${componentObject}}/>\n`;
95
94
 
96
95
  let dirPath;
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}`;
96
+ switch (component.category) {
97
+ case 'services': {
98
+ dirPath = `${SERVICES_DOCS_DIR}`;
99
+ break;
100
+ }
101
+ case 'foundation': {
102
+ dirPath = `${FOUNDATION_DOCS_DIR}`;
103
+ break;
104
+ }
105
+ default: {
106
+ const componentParentDir =
107
+ componentParentName || isParentComponent ? `/${componentParentName || componentName}` : '';
108
+ dirPath = `${COMPONENTS_DOCS_DIR}/${component.category}${componentParentDir}`;
109
+ break;
110
+ }
103
111
  }
104
112
 
105
113
  if (!fs.existsSync(dirPath)) {
@@ -125,86 +133,20 @@ function generateExtendsLink(extendsLink) {
125
133
  return extendsText;
126
134
  }
127
135
 
128
- function buildOldDocs(component) {
129
- let content = '';
130
- content += `import UILivePreview from '@site/src/components/UILivePreview';\n\n`;
131
-
132
- /* General Info */
133
- content += `${component.description} \n`;
134
- if (typeof component.example === 'string') {
135
- content += `[(code example)](${component.example})\n`;
136
- } else if (Array.isArray(component.example)) {
137
- content += '(code examples: ';
138
- component.example.forEach((example, index) => {
139
- const slashIndex = example.lastIndexOf('/');
140
- const dotIndex = example.lastIndexOf('.');
141
- content += `${index > 0 ? ', ' : ''}[${example.slice(slashIndex + 1, dotIndex)}](${example})`;
142
- });
143
- content += ')\n';
144
- }
145
-
146
- if (component.extends) {
147
- let extendsText = component.extends?.join(', ');
148
- if (component.extendsLink) {
149
- extendsText = `[${extendsText}](${component.extendsLink})`;
150
- } else {
151
- extendsText = _.map(component.extends, generateExtendsLink).join(', ');
152
- }
153
- content += ':::info\n';
154
- content += `This component extends **${extendsText}** props.\n`;
155
- content += ':::\n';
156
- }
157
-
158
- if (component.modifiers) {
159
- content += ':::tip\n';
160
- content += `This component support **${component.modifiers?.join(', ')}** modifiers.\n`;
161
- content += ':::\n';
162
- }
163
-
164
- if (component.caution) {
165
- content += ':::caution\n';
166
- content += `${component.caution}\n`;
167
- content += ':::\n';
168
- }
136
+ function logStatistics(components) {
137
+ const groupedComponents = _.countBy(components, 'name');
138
+ const duplicateComponents = Object.entries(groupedComponents)
139
+ .filter(([_, count]) => count > 1)
140
+ .map(([name, count]) => `${name} (${count} times)`);
169
141
 
170
- if (component.note) {
171
- content += ':::note\n';
172
- content += `${component.note}\n`;
173
- content += ':::\n';
142
+ if (duplicateComponents.length > 0) {
143
+ console.log('Components with multiple occurrences:\n-', duplicateComponents.join('\n- '));
174
144
  }
175
145
 
176
- /* Images */
177
- content += `<div style={{display: 'flex', flexDirection: 'row', overflowX: 'auto', maxHeight: '500px', alignItems: 'center'}}>`;
178
- component.images?.forEach(image => {
179
- content += `<img style={{maxHeight: '420px'}} src={'${image}'}/>`;
180
- content += '\n\n';
181
- });
182
- content += '</div>\n\n';
183
-
184
- /* Snippet */
185
- if (component.snippet) {
186
- content += `### Usage\n`;
187
- content += `<UILivePreview code={\`${component.snippet
188
- ?.map(item => _.replace(item, new RegExp(/\$[1-9]/, 'g'), ''))
189
- .join('\n')
190
- .toString()}\`}/>\n\n`;
191
- } else {
192
- console.warn(`${component.name} does not have a snippet`);
146
+ const componentsWithoutSnippet = components.filter(c => !c.snippet).map(c => c.name);
147
+ if (componentsWithoutSnippet.length > 0) {
148
+ console.log('Components missing snippet:\n-', componentsWithoutSnippet.join('\n- '));
193
149
  }
194
-
195
- /* Props */
196
- content += '## API\n';
197
- _.sortBy(component.props, p => p.name)?.forEach(prop => {
198
- content += `### ${prop.name}\n`;
199
- if (prop.note) {
200
- content += `#### ${prop.note}\n`;
201
- }
202
- content += `${prop.description}\n`;
203
- // content += `<span style={{color: 'grey'}}>${_.escape(prop.type)}</span>\n\n`;
204
- content += `\`${prop.type} \` \n\n`;
205
- });
206
-
207
- return content;
208
150
  }
209
151
 
210
152
  module.exports = {buildDocs};
@@ -47,6 +47,7 @@ declare const constants: {
47
47
  };
48
48
  backspaceKey: string;
49
49
  enterKey: string;
50
+ getFontScale: () => number;
50
51
  };
51
52
  export default constants;
52
53
  export declare const _reset: () => void;
@@ -1,4 +1,4 @@
1
- import { Platform, Dimensions, NativeModules, I18nManager, AccessibilityInfo, StatusBar } from 'react-native';
1
+ import { Platform, Dimensions, NativeModules, I18nManager, AccessibilityInfo, StatusBar, PixelRatio } from 'react-native';
2
2
  export let orientations = /*#__PURE__*/function (orientations) {
3
3
  orientations["PORTRAIT"] = "portrait";
4
4
  orientations["LANDSCAPE"] = "landscape";
@@ -166,7 +166,9 @@ const constants = {
166
166
  },
167
167
  /* Keyboard */
168
168
  backspaceKey: 'Backspace',
169
- enterKey: 'Enter'
169
+ enterKey: 'Enter',
170
+ /* Font scale */
171
+ getFontScale: PixelRatio.getFontScale
170
172
  };
171
173
  setStatusBarHeight();
172
174
  Dimensions.addEventListener('change', updateConstants);
@@ -1,5 +1,5 @@
1
1
  import React, { useRef } from 'react';
2
- import { StyleSheet, TextInput, PixelRatio, I18nManager } from 'react-native';
2
+ import { StyleSheet, TextInput, 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 = PixelRatio.getFontScale();
22
+ const fontScale = Constants.getFontScale();
23
23
  const value = Colors.isTransparent(text) ? '000000' : text;
24
24
  return <View style={[styles.preview, {
25
25
  backgroundColor: hex
@@ -159,13 +159,37 @@
159
159
  ],
160
160
  "items": [
161
161
  {
162
- "title": "Left"
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
+ ]
163
171
  },
164
172
  {
165
- "title": "Center"
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
+ ]
166
182
  },
167
183
  {
168
- "title": "Right"
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
+ ]
169
193
  }
170
194
  ],
171
195
  "title": "Alignment",
@@ -179,10 +203,20 @@
179
203
  ],
180
204
  "items": [
181
205
  {
182
- "title": "None"
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
+ ]
183
212
  },
184
213
  {
185
- "title": "Icon"
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
+ ]
186
220
  }
187
221
  ],
188
222
  "title": "Accessories"
@@ -15,7 +15,6 @@ 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";
19
18
  const keyExtractor = (_item, index) => index.toString();
20
19
  const PickerItemsList = props => {
21
20
  const {
@@ -36,8 +35,7 @@ const PickerItemsList = props => {
36
35
  testID,
37
36
  showLoader,
38
37
  customLoaderElement,
39
- renderCustomTopElement,
40
- selectionStatus
38
+ renderCustomTopElement
41
39
  } = props;
42
40
  const context = useContext(PickerContext);
43
41
  const [wheelPickerValue, setWheelPickerValue] = useState(context.value ?? items?.[0]?.value);
@@ -132,14 +130,10 @@ const PickerItemsList = props => {
132
130
  <ActivityIndicator />
133
131
  </View>;
134
132
  };
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]);
138
133
  const renderContent = () => {
139
134
  return useWheelPicker ? renderWheel() : <>
140
135
  {renderSearchInput()}
141
136
  {renderCustomTopElement?.(context.value)}
142
- {mode === PickerModes.MULTI && selectionStatus && renderSelectionStatus}
143
137
  {renderList()}
144
138
  </>;
145
139
  };
@@ -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' | 'items'> {
3
+ interface UsePickerSelectionProps extends Pick<PickerProps, 'migrate' | 'value' | 'onChange' | 'getItemValue' | 'topBarProps' | 'mode'> {
4
4
  pickerExpandableRef: RefObject<any>;
5
5
  setSearchValue: (searchValue: string) => void;
6
6
  }
@@ -9,8 +9,5 @@ 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;
15
12
  };
16
13
  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, useMemo } from 'react';
3
+ import { useCallback, useState, useEffect } from 'react';
4
4
  import { PickerModes } from "../types";
5
5
  const usePickerSelection = props => {
6
6
  const {
@@ -11,8 +11,7 @@ const usePickerSelection = props => {
11
11
  pickerExpandableRef,
12
12
  getItemValue,
13
13
  setSearchValue,
14
- mode,
15
- items
14
+ mode
16
15
  } = props;
17
16
  const [multiDraftValue, setMultiDraftValue] = useState(value);
18
17
  const [multiFinalValue, setMultiFinalValue] = useState(value);
@@ -44,20 +43,11 @@ const usePickerSelection = props => {
44
43
  pickerExpandableRef.current?.closeExpandable?.();
45
44
  topBarProps?.onCancel?.();
46
45
  }, [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]);
53
46
  return {
54
47
  multiDraftValue,
55
48
  onDoneSelecting,
56
49
  toggleItemSelection,
57
- cancelSelect,
58
- setMultiFinalValue,
59
- availableItems,
60
- toggleAllItemsSelection
50
+ cancelSelect
61
51
  };
62
52
  };
63
53
  export default usePickerSelection;
@@ -1,16 +1,15 @@
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, PickerSelectAllType } from './types';
4
+ import { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods } 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;
11
10
  };
12
11
  declare const Picker: React.ForwardRefExoticComponent<PickerProps & React.RefAttributes<unknown>>;
13
- export { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods, PickerSelectAllType };
12
+ export { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods };
14
13
  export { Picker };
15
14
  declare const _default: React.ForwardRefExoticComponent<PickerProps & React.RefAttributes<unknown>> & PickerStatics;
16
15
  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, PickerSelectAllType } from "./types";
21
+ import { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods } from "./types";
22
22
  const DEFAULT_DIALOG_PROPS = {
23
23
  bottom: true,
24
24
  width: '100%'
@@ -58,7 +58,6 @@ const Picker = React.forwardRef((props, ref) => {
58
58
  showLoader,
59
59
  customLoaderElement,
60
60
  renderCustomTopElement,
61
- selectionStatus,
62
61
  ...others
63
62
  } = themeProps;
64
63
  const {
@@ -102,9 +101,7 @@ const Picker = React.forwardRef((props, ref) => {
102
101
  multiDraftValue,
103
102
  onDoneSelecting,
104
103
  toggleItemSelection,
105
- cancelSelect,
106
- availableItems,
107
- toggleAllItemsSelection
104
+ cancelSelect
108
105
  } = usePickerSelection({
109
106
  migrate,
110
107
  value,
@@ -113,8 +110,7 @@ const Picker = React.forwardRef((props, ref) => {
113
110
  getItemValue,
114
111
  topBarProps,
115
112
  setSearchValue,
116
- mode,
117
- items
113
+ mode
118
114
  });
119
115
  const {
120
116
  label,
@@ -158,11 +154,9 @@ const Picker = React.forwardRef((props, ref) => {
158
154
  getItemLabel,
159
155
  onSelectedLayout: onSelectedItemLayout,
160
156
  renderItem,
161
- selectionLimit,
162
- availableItems,
163
- toggleAllItemsSelection
157
+ selectionLimit
164
158
  };
165
- }, [migrate, mode, value, multiDraftValue, renderItem, getItemValue, getItemLabel, selectionLimit, onSelectedItemLayout, toggleItemSelection, onDoneSelecting, availableItems, toggleAllItemsSelection]);
159
+ }, [migrate, mode, value, multiDraftValue, renderItem, getItemValue, getItemLabel, selectionLimit, onSelectedItemLayout, toggleItemSelection, onDoneSelecting]);
166
160
  const renderPickerItem = useCallback((item, index) => {
167
161
  return <PickerItem key={`${index}-${item.value}`} {...item} />;
168
162
  }, []);
@@ -207,7 +201,7 @@ const Picker = React.forwardRef((props, ref) => {
207
201
  ...topBarProps,
208
202
  onCancel: cancelSelect,
209
203
  onDone: mode === PickerModes.MULTI ? () => onDoneSelecting(multiDraftValue) : undefined
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}>
204
+ }} showSearch={showSearch} searchStyle={searchStyle} searchPlaceholder={searchPlaceholder} onSearchChange={_onSearchChange} renderCustomSearch={renderCustomSearch} renderHeader={renderHeader} listProps={listProps} useSafeArea={useSafeArea} showLoader={showLoader} customLoaderElement={customLoaderElement} renderCustomTopElement={renderCustomTopElement}>
211
205
  {filteredItems}
212
206
  </PickerItemsList>;
213
207
  }, [testID, mode, useDialog, selectedItemPosition, topBarProps, cancelSelect, onDoneSelecting, multiDraftValue, showSearch, searchStyle, searchPlaceholder, _onSearchChange, renderCustomSearch, renderHeader, listProps, filteredItems, useSafeArea, useWheelPicker, items, showLoader]);
@@ -227,8 +221,6 @@ Picker.modes = PickerModes;
227
221
  Picker.fieldTypes = PickerFieldTypes;
228
222
  // @ts-expect-error
229
223
  Picker.extractPickerItems = extractPickerItems;
230
- //@ts-ignore
231
- Picker.selectAllType = PickerSelectAllType;
232
- export { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods, PickerSelectAllType };
224
+ export { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods };
233
225
  export { Picker }; // For tests
234
226
  export default Picker;
@@ -4,8 +4,6 @@ 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';
9
7
  export declare enum PickerModes {
10
8
  SINGLE = "SINGLE",
11
9
  MULTI = "MULTI"
@@ -15,10 +13,6 @@ export declare enum PickerFieldTypes {
15
13
  filter = "filter",
16
14
  settings = "settings"
17
15
  }
18
- export declare enum PickerSelectAllType {
19
- button = "button",
20
- checkbox = "checkbox"
21
- }
22
16
  export type PickerSingleValue = string | number;
23
17
  export type PickerMultiValue = PickerSingleValue[];
24
18
  export type PickerValue = PickerSingleValue | PickerMultiValue | undefined;
@@ -153,53 +147,6 @@ type PickerExpandableOverlayProps = {
153
147
  */
154
148
  enableModalBlur?: boolean;
155
149
  };
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);
203
150
  export type PickerBaseProps = Omit<TextFieldProps, 'value' | 'onChange'> & PickerPropsDeprecation & PickerExpandableOverlayProps & PickerListProps & {
204
151
  /**
205
152
  * Use dialog instead of modal picker
@@ -246,10 +193,6 @@ export type PickerBaseProps = Omit<TextFieldProps, 'value' | 'onChange'> & Picke
246
193
  * Render custom top element
247
194
  */
248
195
  renderCustomTopElement?: (value?: PickerValue) => React.ReactElement;
249
- /**
250
- *
251
- */
252
- selectionStatus?: PickerSelectionStatusProps;
253
196
  /**
254
197
  * Add onPress callback for when pressing the picker
255
198
  */
@@ -343,10 +286,8 @@ export interface PickerContextProps extends Pick<PickerProps, 'migrate' | 'value
343
286
  isMultiMode: boolean;
344
287
  onSelectedLayout: (event: any) => any;
345
288
  selectionLimit: PickerProps['selectionLimit'];
346
- availableItems: PickerMultiValue;
347
- toggleAllItemsSelection?: (selectAll: boolean) => void;
348
289
  }
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'> & {
290
+ export type PickerItemsListProps = Pick<PropsWithChildren<PickerProps>, 'topBarProps' | 'listProps' | 'renderHeader' | 'useSafeArea' | 'showLoader' | 'customLoaderElement' | 'renderCustomTopElement' | 'showSearch' | 'searchStyle' | 'searchPlaceholder' | 'onSearchChange' | 'renderCustomSearch' | 'children' | 'useWheelPicker' | 'useDialog' | 'mode' | 'testID'> & {
350
291
  items?: {
351
292
  value: any;
352
293
  label: any;
@@ -10,11 +10,6 @@ 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
- }({});
18
13
 
19
14
  // TODO: Remove type
20
15
  // type PickerValueDeprecated = {value: string | number; label: string};
@@ -285,38 +285,6 @@
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
- ]
320
288
  }
321
289
  ]
322
290
  }
@@ -29,30 +29,18 @@
29
29
  }
30
30
  ],
31
31
  "snippet": [
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}",
32
+ "<Timeline",
33
+ " topLine={{type: Timeline.lineTypes.DASHED}}",
34
+ " bottomLine={{state: Timeline.states.SUCCESS}}",
35
+ " point={{state: Timeline.states.SUCCESS}}",
46
36
  ">",
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>"
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>"
56
44
  ],
57
45
  "docs": {
58
46
  "hero": {
@@ -138,29 +126,7 @@
138
126
  "title": "Current",
139
127
  "content": [
140
128
  {
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
- }
129
+ "snippet": "<Timeline topLine={{state: Timeline.states.CURRENT}} bottomLine={{state: Timeline.states.CURRENT}} point={{state: Timeline.states.CURRENT}}><View style={{height: 88}}/></Timeline>"
164
130
  }
165
131
  ],
166
132
  "description": "state: current"
@@ -169,19 +135,7 @@
169
135
  "title": "Next",
170
136
  "content": [
171
137
  {
172
- "props": {
173
- "state": "next",
174
- "point": {
175
- "type": {
176
- "type": "bullet"
177
- }
178
- },
179
- "bottomLine": {
180
- "type": {
181
- "type": "solid"
182
- }
183
- }
184
- }
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>"
185
139
  }
186
140
  ],
187
141
  "description": "state: next"
@@ -190,19 +144,7 @@
190
144
  "title": "Error",
191
145
  "content": [
192
146
  {
193
- "props": {
194
- "state": "error",
195
- "point": {
196
- "type": {
197
- "type": "bullet"
198
- }
199
- },
200
- "bottomLine": {
201
- "type": {
202
- "type": "solid"
203
- }
204
- }
205
- }
147
+ "snippet": "<Timeline topLine={{state: Timeline.states.ERROR}} bottomLine={{state: Timeline.states.ERROR}} point={{state: Timeline.states.ERROR}}><View style={{height: 88}}/></Timeline>"
206
148
  }
207
149
  ],
208
150
  "description": "state: error"
@@ -211,19 +153,7 @@
211
153
  "title": "Success",
212
154
  "content": [
213
155
  {
214
- "props": {
215
- "state": "success",
216
- "point": {
217
- "type": {
218
- "type": "bullet"
219
- }
220
- },
221
- "bottomLine": {
222
- "type": {
223
- "type": "solid"
224
- }
225
- }
226
- }
156
+ "snippet": "<Timeline topLine={{state: Timeline.states.SUCCESS}} bottomLine={{state: Timeline.states.SUCCESS}} point={{state: Timeline.states.SUCCESS}}><View style={{height: 88}}/></Timeline>"
227
157
  }
228
158
  ],
229
159
  "description": "state: success"
@@ -238,15 +168,30 @@
238
168
  "items": [
239
169
  {
240
170
  "title": "Bullet",
241
- "description": "type: bullet"
171
+ "description": "type: bullet",
172
+ "content": [
173
+ {
174
+ "snippet": "<Timeline point={{type: Timeline.pointTypes.BULLET}}><View style={{height: 88}}/></Timeline>"
175
+ }
176
+ ]
242
177
  },
243
178
  {
244
179
  "title": "Circle",
245
- "description": "type: 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
+ ]
246
186
  },
247
187
  {
248
188
  "title": "Outline",
249
- "description": "type: outline"
189
+ "description": "type: outline",
190
+ "content": [
191
+ {
192
+ "snippet": "<Timeline point={{type: Timeline.pointTypes.OUTLINE}}><View style={{height: 88}}/></Timeline>"
193
+ }
194
+ ]
250
195
  }
251
196
  ],
252
197
  "title": "Point",
@@ -260,14 +205,7 @@
260
205
  "title": "Text",
261
206
  "content": [
262
207
  {
263
- "props": {
264
- "state": "current",
265
- "bottomLine": {
266
- "type": {
267
- "type": "solid"
268
- }
269
- }
270
- }
208
+ "snippet": "<Timeline point={{label: '1'}}><View style={{height: 88}}/></Timeline>"
271
209
  }
272
210
  ],
273
211
  "description": "text: “1”"
@@ -276,20 +214,18 @@
276
214
  "title": "Icon",
277
215
  "content": [
278
216
  {
279
- "props": {
280
- "state": "current",
281
- "bottomLine": {
282
- "type": {
283
- "type": "dashed"
284
- }
285
- }
286
- }
217
+ "snippet": "<Timeline point={{state: Timeline.states.SUCCESS, icon: Assets.icons.checkSmall}}><View style={{height: 88}}/></Timeline>"
287
218
  }
288
219
  ],
289
220
  "description": "icon: Assets.icons.general.checkmarkSmall"
290
221
  },
291
222
  {
292
223
  "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
+ ],
293
229
  "description": "icon: Assets.icons.general.favorite, removeIconBackground: true"
294
230
  }
295
231
  ],
@@ -301,10 +237,20 @@
301
237
  "items": [
302
238
  {
303
239
  "title": "Solid",
240
+ "content": [
241
+ {
242
+ "snippet": "<Timeline topLine={{state: Timeline.states.CURRENT}} point={{removeIconBackground: true}}><View style={{height: 88}}/></Timeline>"
243
+ }
244
+ ],
304
245
  "description": "type: solid"
305
246
  },
306
247
  {
307
248
  "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
+ ],
308
254
  "description": "type: dashed"
309
255
  }
310
256
  ],
@@ -317,6 +263,11 @@
317
263
  "items": [
318
264
  {
319
265
  "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
+ ],
320
271
  "description": "entry: true"
321
272
  }
322
273
  ],
@@ -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,
@@ -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, PickerSelectAllType } from './components/picker';
70
+ export { default as Picker, PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods } 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,7 +166,6 @@ var _exportNames = {
166
166
  RenderCustomModalProps: true,
167
167
  PickerItemsListProps: true,
168
168
  PickerMethods: true,
169
- PickerSelectAllType: true,
170
169
  PieChart: true,
171
170
  PieChartSegmentProps: true,
172
171
  ProgressBar: true,
@@ -1111,12 +1110,6 @@ Object.defineProperty(exports, "PickerSearchStyle", {
1111
1110
  return _picker().PickerSearchStyle;
1112
1111
  }
1113
1112
  });
1114
- Object.defineProperty(exports, "PickerSelectAllType", {
1115
- enumerable: true,
1116
- get: function () {
1117
- return _picker().PickerSelectAllType;
1118
- }
1119
- });
1120
1113
  Object.defineProperty(exports, "PickerValue", {
1121
1114
  enumerable: true,
1122
1115
  get: function () {
@@ -1,8 +0,0 @@
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;
@@ -1,63 +0,0 @@
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
- }