react-native-ui-lib 7.39.0-snapshot.6519 → 7.39.0-snapshot.6522

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.6519",
3
+ "version": "7.39.0-snapshot.6522",
4
4
  "main": "src/index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
@@ -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,30 @@ 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
+ // if (component.docs) {
92
+ content += `import ComponentPage from '@site/src/components/ComponentPage';\n\n`;
93
+ const componentObject = JSON.stringify(component);
94
+ content += `<ComponentPage component={${componentObject}}/>\n`;
95
+ // } else {
96
+ // content += `${buildOldDocs(component)}\n`;
97
+ // }
95
98
 
96
99
  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}`;
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
+ }
103
115
  }
104
116
 
105
117
  if (!fs.existsSync(dirPath)) {
@@ -125,6 +137,22 @@ function generateExtendsLink(extendsLink) {
125
137
  return extendsText;
126
138
  }
127
139
 
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
+
128
156
  function buildOldDocs(component) {
129
157
  let content = '';
130
158
  content += `import UILivePreview from '@site/src/components/UILivePreview';\n\n`;
@@ -184,12 +212,10 @@ function buildOldDocs(component) {
184
212
  /* Snippet */
185
213
  if (component.snippet) {
186
214
  content += `### Usage\n`;
187
- content += `<UILivePreview code={\`${component.snippet
215
+ content += `<UILivePreview componentName={"${component.name}"} code={\`${component.snippet
188
216
  ?.map(item => _.replace(item, new RegExp(/\$[1-9]/, 'g'), ''))
189
217
  .join('\n')
190
218
  .toString()}\`}/>\n\n`;
191
- } else {
192
- console.warn(`${component.name} does not have a snippet`);
193
219
  }
194
220
 
195
221
  /* Props */
@@ -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
@@ -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,49 +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
- * Custom label to show next to the selection element.
196
- */
197
- customLabel?: string;
198
- } & (ButtonSelectionStatus | CheckboxSelectionStatus);
199
150
  export type PickerBaseProps = Omit<TextFieldProps, 'value' | 'onChange'> & PickerPropsDeprecation & PickerExpandableOverlayProps & PickerListProps & {
200
151
  /**
201
152
  * Use dialog instead of modal picker
@@ -242,10 +193,6 @@ export type PickerBaseProps = Omit<TextFieldProps, 'value' | 'onChange'> & Picke
242
193
  * Render custom top element
243
194
  */
244
195
  renderCustomTopElement?: (value?: PickerValue) => React.ReactElement;
245
- /**
246
- *
247
- */
248
- selectionStatus?: PickerSelectionStatusProps;
249
196
  /**
250
197
  * Add onPress callback for when pressing the picker
251
198
  */
@@ -339,10 +286,8 @@ export interface PickerContextProps extends Pick<PickerProps, 'migrate' | 'value
339
286
  isMultiMode: boolean;
340
287
  onSelectedLayout: (event: any) => any;
341
288
  selectionLimit: PickerProps['selectionLimit'];
342
- availableItems: PickerMultiValue;
343
- toggleAllItemsSelection?: (selectAll: boolean) => void;
344
289
  }
345
- 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'> & {
346
291
  items?: {
347
292
  value: any;
348
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,57 +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
- } = props;
17
- const isAllSelected = value.length === availableItems.length;
18
- const checkboxIndeterminate = value.length > 0 && value.length < availableItems.length;
19
- const label = getLabel?.({
20
- selectedCount: value.length,
21
- value,
22
- isAllSelected
23
- }) ?? `${value.length} Selected ${isAllSelected ? '(All)' : ''}`;
24
- let buttonProps;
25
- let checkboxProps;
26
- switch (props.selectAllType) {
27
- case PickerSelectAllType.button:
28
- buttonProps = props.buttonProps;
29
- break;
30
- case PickerSelectAllType.checkbox:
31
- checkboxProps = props.checkboxProps;
32
- break;
33
- }
34
- const handlePress = useCallback(() => {
35
- const newSelectionState = !isAllSelected;
36
- toggleAllItemsSelection?.(newSelectionState);
37
- buttonProps?.onPress?.(availableItems);
38
- checkboxProps?.onValueChange?.(newSelectionState);
39
- }, [isAllSelected, toggleAllItemsSelection, availableItems, buttonProps, checkboxProps]);
40
- const renderSelectionStatus = () => {
41
- if (selectAllType === 'button') {
42
- return <Button label={isAllSelected ? 'Deselect All' : 'Select All'} link {...buttonProps} onPress={handlePress} />;
43
- } else if (selectAllType === 'checkbox') {
44
- return <Checkbox {...checkboxProps} value={value.length > 0} indeterminate={checkboxIndeterminate} onValueChange={handlePress} />;
45
- }
46
- };
47
- const renderLabel = () => {
48
- if (showLabel) {
49
- return <Text>{label}</Text>;
50
- }
51
- return null;
52
- };
53
- return <View row spread centerV paddingH-page style={containerStyle}>
54
- {renderLabel()}
55
- {renderSelectionStatus()}
56
- </View>;
57
- }