react-native-ui-lib 7.39.0 → 7.39.1-snapshot.6736
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -2
- package/scripts/docs/buildDocsCommon.js +16 -83
- package/src/assets/index.js +2 -5
- package/src/assets/internal/icons/index.js +50 -0
- package/src/assets/internal/icons/index.web.js +50 -0
- package/src/assets/internal/images/index.js +26 -0
- package/src/assets/internal/images/index.web.js +26 -0
- package/src/assets/internal/index.d.ts +4 -0
- package/src/assets/internal/index.js +8 -0
- package/src/commons/Constants.d.ts +1 -0
- package/src/commons/Constants.js +4 -2
- package/src/components/KeyboardAwareScrollView/KeyboardAwareScrollView.api.json +40 -0
- package/src/components/avatar/index.d.ts +8 -19
- package/src/components/avatar/index.js +4 -2
- package/src/components/button/button.api.json +25 -85
- package/src/components/card/index.js +1 -1
- package/src/components/checkbox/index.d.ts +4 -1
- package/src/components/checkbox/index.js +7 -5
- package/src/components/chip/index.js +1 -1
- package/src/components/chipsInput/index.js +2 -2
- package/src/components/colorPicker/ColorPickerDialog.js +1 -1
- package/src/components/colorPicker/ColorPickerDialogHeader.js +2 -2
- package/src/components/colorPicker/ColorPickerPreview.js +2 -2
- package/src/components/colorPicker/index.js +1 -1
- package/src/components/colorSwatch/index.js +2 -3
- package/src/components/dateTimePicker/index.js +2 -2
- package/src/components/hint/hint.api.json +39 -5
- package/src/components/hint/index.js +2 -3
- package/src/components/icon/index.d.ts +12 -3
- package/src/components/icon/index.js +18 -9
- package/src/components/image/index.d.ts +1 -1
- package/src/components/modal/TopBar.js +1 -1
- package/src/components/modal/api/modalTopBar.api.json +1 -1
- package/src/components/modal/modal.api.json +54 -0
- package/src/components/overlay/index.js +4 -6
- package/src/components/panningViews/panDismissibleView.js +1 -1
- package/src/components/panningViews/panGestureView.js +1 -1
- package/src/components/panningViews/panListenerView.js +1 -1
- package/src/components/panningViews/panResponderView.js +1 -1
- package/src/components/panningViews/panningContext.js +1 -0
- package/src/components/picker/PickerItem.js +1 -1
- package/src/components/picker/PickerItemsList.js +6 -2
- package/src/components/picker/PickerSelectionStatusBar.d.ts +3 -0
- package/src/components/picker/PickerSelectionStatusBar.js +60 -0
- package/src/components/picker/api/picker.api.json +387 -5
- package/src/components/picker/helpers/useFieldType.js +2 -2
- package/src/components/picker/helpers/usePickerSelection.d.ts +4 -1
- package/src/components/picker/helpers/usePickerSelection.js +19 -3
- package/src/components/picker/index.d.ts +2 -2
- package/src/components/picker/index.js +15 -7
- package/src/components/picker/types.d.ts +48 -1
- package/src/components/scrollBar/index.js +3 -3
- package/src/components/sortableList/SortableList.api.json +7 -7
- package/src/components/stepper/index.js +3 -8
- package/src/components/tabController/apis/pageCarousel.api.json +8 -5
- package/src/components/textField/ClearButton.js +1 -1
- package/src/components/textField/textField.api.json +26 -8
- package/src/components/timeline/timeline.api.json +57 -106
- package/src/components/toast/index.js +1 -1
- package/src/components/wizard/WizardStates.js +3 -4
- package/src/hooks/useScrollTo/index.js +9 -4
- package/src/incubator/dialog/useDialogContent.js +1 -1
- package/src/incubator/expandableOverlay/index.js +1 -0
- package/src/incubator/panView/index.js +1 -1
- package/src/incubator/slider/Thumb.js +8 -1
- package/src/incubator/toast/toast.api.json +57 -7
- package/src/index.d.ts +1 -1
- package/src/index.js +7 -0
- package/src/assets/icons/index.js +0 -26
- package/src/assets/images/index.js +0 -5
- package/src/components/stepper/assets/minusSmall.png +0 -0
- package/src/components/stepper/assets/minusSmall@1.5x.png +0 -0
- package/src/components/stepper/assets/minusSmall@2x.png +0 -0
- package/src/components/stepper/assets/minusSmall@3x.png +0 -0
- package/src/components/stepper/assets/minusSmall@4x.png +0 -0
- package/src/components/stepper/assets/plusSmall.png +0 -0
- package/src/components/stepper/assets/plusSmall@1.5x.png +0 -0
- package/src/components/stepper/assets/plusSmall@2x.png +0 -0
- package/src/components/stepper/assets/plusSmall@3x.png +0 -0
- package/src/components/stepper/assets/plusSmall@4x.png +0 -0
- /package/src/assets/{icons → internal/icons}/check.png +0 -0
- /package/src/assets/{icons → internal/icons}/check@1.5x.png +0 -0
- /package/src/assets/{icons → internal/icons}/check@2x.png +0 -0
- /package/src/assets/{icons → internal/icons}/check@3x.png +0 -0
- /package/src/assets/{icons → internal/icons}/check@4x.png +0 -0
- /package/src/{components/wizard/assets → assets/internal/icons}/checkMarkSmall.png +0 -0
- /package/src/{components/wizard/assets → assets/internal/icons}/checkMarkSmall@1.5x.png +0 -0
- /package/src/{components/wizard/assets → assets/internal/icons}/checkMarkSmall@2x.png +0 -0
- /package/src/{components/wizard/assets → assets/internal/icons}/checkMarkSmall@3x.png +0 -0
- /package/src/{components/wizard/assets → assets/internal/icons}/checkMarkSmall@4x.png +0 -0
- /package/src/assets/{icons/check-small.png → internal/icons/checkSmall.png} +0 -0
- /package/src/assets/{icons/check-small@1.5x.png → internal/icons/checkSmall@1.5x.png} +0 -0
- /package/src/assets/{icons/check-small@2x.png → internal/icons/checkSmall@2x.png} +0 -0
- /package/src/assets/{icons/check-small@3x.png → internal/icons/checkSmall@3x.png} +0 -0
- /package/src/assets/{icons/check-small@4x.png → internal/icons/checkSmall@4x.png} +0 -0
- /package/src/{components/picker/assets/dropdown.png → assets/internal/icons/chevronDown.png} +0 -0
- /package/src/{components/picker/assets/dropdown@1.5x.png → assets/internal/icons/chevronDown@1.5x.png} +0 -0
- /package/src/{components/picker/assets/dropdown@2x.png → assets/internal/icons/chevronDown@2x.png} +0 -0
- /package/src/{components/picker/assets/dropdown@3x.png → assets/internal/icons/chevronDown@3x.png} +0 -0
- /package/src/{components/picker/assets/dropdown@4x.png → assets/internal/icons/chevronDown@4x.png} +0 -0
- /package/src/{components/wizard/assets → assets/internal/icons}/exclamationSmall.png +0 -0
- /package/src/{components/wizard/assets → assets/internal/icons}/exclamationSmall@1.5x.png +0 -0
- /package/src/{components/wizard/assets → assets/internal/icons}/exclamationSmall@2x.png +0 -0
- /package/src/{components/wizard/assets → assets/internal/icons}/exclamationSmall@3x.png +0 -0
- /package/src/{components/wizard/assets → assets/internal/icons}/exclamationSmall@4x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/minusOutline.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/minusOutline@1.5x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/minusOutline@2x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/minusOutline@3x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/minusOutline@4x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/minusOutlineSmall.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/minusOutlineSmall@1.5x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/minusOutlineSmall@2x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/minusOutlineSmall@3x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/minusOutlineSmall@4x.png +0 -0
- /package/src/assets/{icons → internal/icons}/minusSmall.png +0 -0
- /package/src/assets/{icons → internal/icons}/minusSmall@1.5x.png +0 -0
- /package/src/assets/{icons → internal/icons}/minusSmall@2x.png +0 -0
- /package/src/assets/{icons → internal/icons}/minusSmall@3x.png +0 -0
- /package/src/assets/{icons → internal/icons}/minusSmall@4x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/plusOutline.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/plusOutline@1.5x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/plusOutline@2x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/plusOutline@3x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/plusOutline@4x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/plusOutlineSmall.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/plusOutlineSmall@1.5x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/plusOutlineSmall@2x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/plusOutlineSmall@3x.png +0 -0
- /package/src/{components/stepper/assets → assets/internal/icons}/plusOutlineSmall@4x.png +0 -0
- /package/src/assets/{icons → internal/icons}/plusSmall.png +0 -0
- /package/src/assets/{icons → internal/icons}/plusSmall@1.5x.png +0 -0
- /package/src/assets/{icons → internal/icons}/plusSmall@2x.png +0 -0
- /package/src/assets/{icons → internal/icons}/plusSmall@3x.png +0 -0
- /package/src/assets/{icons → internal/icons}/plusSmall@4x.png +0 -0
- /package/src/assets/{icons → internal/icons}/search.png +0 -0
- /package/src/assets/{icons → internal/icons}/search@1.5x.png +0 -0
- /package/src/assets/{icons → internal/icons}/search@2x.png +0 -0
- /package/src/assets/{icons → internal/icons}/search@3x.png +0 -0
- /package/src/assets/{icons → internal/icons}/search@4x.png +0 -0
- /package/src/assets/{icons → internal/icons}/x.png +0 -0
- /package/src/assets/{icons → internal/icons}/x@2x.png +0 -0
- /package/src/assets/{icons → internal/icons}/x@3x.png +0 -0
- /package/src/assets/{icons → internal/icons}/xFlat.png +0 -0
- /package/src/assets/{icons → internal/icons}/xFlat@1.5x.png +0 -0
- /package/src/assets/{icons → internal/icons}/xFlat@2x.png +0 -0
- /package/src/assets/{icons → internal/icons}/xFlat@3x.png +0 -0
- /package/src/assets/{icons → internal/icons}/xFlat@4x.png +0 -0
- /package/src/assets/{icons → internal/icons}/xMedium.png +0 -0
- /package/src/assets/{icons → internal/icons}/xMedium@1.5x.png +0 -0
- /package/src/assets/{icons → internal/icons}/xMedium@2x.png +0 -0
- /package/src/assets/{icons → internal/icons}/xMedium@3x.png +0 -0
- /package/src/assets/{icons → internal/icons}/xMedium@4x.png +0 -0
- /package/src/{components/chipsInput/assets → assets/internal/icons}/xSmall.png +0 -0
- /package/src/{components/chipsInput/assets → assets/internal/icons}/xSmall@1.5x.png +0 -0
- /package/src/{components/chipsInput/assets → assets/internal/icons}/xSmall@2x.png +0 -0
- /package/src/{components/chipsInput/assets → assets/internal/icons}/xSmall@3x.png +0 -0
- /package/src/{components/chipsInput/assets → assets/internal/icons}/xSmall@4x.png +0 -0
- /package/src/assets/{images → internal/images}/gradient.png +0 -0
- /package/src/{components/scrollBar/assets → assets/internal/images}/gradientOverlay.png +0 -0
- /package/src/{components/overlay/assets/GradientOverlayHigh.png → assets/internal/images/gradientOverlayHigh.png} +0 -0
- /package/src/{components/overlay/assets/GradientOverlayHigh@1.5x.png → assets/internal/images/gradientOverlayHigh@1.5x.png} +0 -0
- /package/src/{components/overlay/assets/GradientOverlayHigh@2x.png → assets/internal/images/gradientOverlayHigh@2x.png} +0 -0
- /package/src/{components/overlay/assets/GradientOverlayHigh@3x.png → assets/internal/images/gradientOverlayHigh@3x.png} +0 -0
- /package/src/{components/overlay/assets/GradientOverlayHigh@4x.png → assets/internal/images/gradientOverlayHigh@4x.png} +0 -0
- /package/src/{components/overlay/assets/GradientOverlayLow.png → assets/internal/images/gradientOverlayLow.png} +0 -0
- /package/src/{components/overlay/assets/GradientOverlayLow@1.5x.png → assets/internal/images/gradientOverlayLow@1.5x.png} +0 -0
- /package/src/{components/overlay/assets/GradientOverlayLow@2x.png → assets/internal/images/gradientOverlayLow@2x.png} +0 -0
- /package/src/{components/overlay/assets/GradientOverlayLow@3x.png → assets/internal/images/gradientOverlayLow@3x.png} +0 -0
- /package/src/{components/overlay/assets/GradientOverlayLow@4x.png → assets/internal/images/gradientOverlayLow@4x.png} +0 -0
- /package/src/{components/overlay/assets/GradientOverlayMedium.png → assets/internal/images/gradientOverlayMedium.png} +0 -0
- /package/src/{components/overlay/assets/GradientOverlayMedium@1.5x.png → assets/internal/images/gradientOverlayMedium@1.5x.png} +0 -0
- /package/src/{components/overlay/assets/GradientOverlayMedium@2x.png → assets/internal/images/gradientOverlayMedium@2x.png} +0 -0
- /package/src/{components/overlay/assets/GradientOverlayMedium@3x.png → assets/internal/images/gradientOverlayMedium@3x.png} +0 -0
- /package/src/{components/overlay/assets/GradientOverlayMedium@4x.png → assets/internal/images/gradientOverlayMedium@4x.png} +0 -0
- /package/src/{components/hint/assets → assets/internal/images}/hintTipMiddle.png +0 -0
- /package/src/{components/hint/assets → assets/internal/images}/hintTipMiddle@1.5x.png +0 -0
- /package/src/{components/hint/assets → assets/internal/images}/hintTipMiddle@2x.png +0 -0
- /package/src/{components/hint/assets → assets/internal/images}/hintTipMiddle@3x.png +0 -0
- /package/src/{components/hint/assets → assets/internal/images}/hintTipMiddle@4x.png +0 -0
- /package/src/{components/hint/assets → assets/internal/images}/hintTipSide.png +0 -0
- /package/src/{components/hint/assets → assets/internal/images}/hintTipSide@1.5x.png +0 -0
- /package/src/{components/hint/assets → assets/internal/images}/hintTipSide@2x.png +0 -0
- /package/src/{components/hint/assets → assets/internal/images}/hintTipSide@3x.png +0 -0
- /package/src/{components/hint/assets → assets/internal/images}/hintTipSide@4x.png +0 -0
- /package/src/{components/colorSwatch/assets/transparentSwatch/TransparentSwatch.png → assets/internal/images/transparentSwatch.png} +0 -0
- /package/src/{components/colorSwatch/assets/transparentSwatch/TransparentSwatch@1.5x.png → assets/internal/images/transparentSwatch@1.5x.png} +0 -0
- /package/src/{components/colorSwatch/assets/transparentSwatch/TransparentSwatch@2x.png → assets/internal/images/transparentSwatch@2x.png} +0 -0
- /package/src/{components/colorSwatch/assets/transparentSwatch/TransparentSwatch@3x.png → assets/internal/images/transparentSwatch@3x.png} +0 -0
- /package/src/{components/colorSwatch/assets/transparentSwatch/TransparentSwatch@4x.png → assets/internal/images/transparentSwatch@4x.png} +0 -0
|
@@ -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
|
+
areAllItemsSelected: boolean;
|
|
13
|
+
selectedCount: number;
|
|
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,26 @@ 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 areAllItemsSelected = useMemo(() => {
|
|
51
|
+
return multiDraftValue?.length === availableItems.length;
|
|
52
|
+
}, [multiDraftValue, availableItems]);
|
|
53
|
+
const selectedCount = useMemo(() => {
|
|
54
|
+
return multiDraftValue?.length;
|
|
55
|
+
}, [multiDraftValue]);
|
|
56
|
+
const toggleAllItemsSelection = useCallback(selectAll => {
|
|
57
|
+
setMultiDraftValue(selectAll ? availableItems : []);
|
|
58
|
+
}, [availableItems]);
|
|
46
59
|
return {
|
|
47
60
|
multiDraftValue,
|
|
48
61
|
onDoneSelecting,
|
|
49
62
|
toggleItemSelection,
|
|
50
|
-
cancelSelect
|
|
63
|
+
cancelSelect,
|
|
64
|
+
areAllItemsSelected,
|
|
65
|
+
selectedCount,
|
|
66
|
+
toggleAllItemsSelection
|
|
51
67
|
};
|
|
52
68
|
};
|
|
53
69
|
export default usePickerSelection;
|
|
@@ -1,7 +1,7 @@
|
|
|
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, PickerSelectionStatusProps } from './types';
|
|
5
5
|
type PickerStatics = {
|
|
6
6
|
Item: typeof PickerItem;
|
|
7
7
|
modes: typeof PickerModes;
|
|
@@ -9,7 +9,7 @@ type PickerStatics = {
|
|
|
9
9
|
extractPickerItems: typeof extractPickerItems;
|
|
10
10
|
};
|
|
11
11
|
declare const Picker: React.ForwardRefExoticComponent<PickerProps & React.RefAttributes<unknown>>;
|
|
12
|
-
export { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods };
|
|
12
|
+
export { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods, PickerSelectionStatusProps };
|
|
13
13
|
export { Picker };
|
|
14
14
|
declare const _default: React.ForwardRefExoticComponent<PickerProps & React.RefAttributes<unknown>> & PickerStatics;
|
|
15
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 } from "./types";
|
|
21
|
+
import { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods, PickerSelectionStatusProps } 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,10 @@ const Picker = React.forwardRef((props, ref) => {
|
|
|
101
102
|
multiDraftValue,
|
|
102
103
|
onDoneSelecting,
|
|
103
104
|
toggleItemSelection,
|
|
104
|
-
cancelSelect
|
|
105
|
+
cancelSelect,
|
|
106
|
+
areAllItemsSelected,
|
|
107
|
+
selectedCount,
|
|
108
|
+
toggleAllItemsSelection
|
|
105
109
|
} = usePickerSelection({
|
|
106
110
|
migrate,
|
|
107
111
|
value,
|
|
@@ -110,7 +114,8 @@ const Picker = React.forwardRef((props, ref) => {
|
|
|
110
114
|
getItemValue,
|
|
111
115
|
topBarProps,
|
|
112
116
|
setSearchValue,
|
|
113
|
-
mode
|
|
117
|
+
mode,
|
|
118
|
+
items
|
|
114
119
|
});
|
|
115
120
|
const {
|
|
116
121
|
label,
|
|
@@ -154,9 +159,12 @@ const Picker = React.forwardRef((props, ref) => {
|
|
|
154
159
|
getItemLabel,
|
|
155
160
|
onSelectedLayout: onSelectedItemLayout,
|
|
156
161
|
renderItem,
|
|
157
|
-
selectionLimit
|
|
162
|
+
selectionLimit,
|
|
163
|
+
areAllItemsSelected,
|
|
164
|
+
selectedCount,
|
|
165
|
+
toggleAllItemsSelection
|
|
158
166
|
};
|
|
159
|
-
}, [migrate, mode, value, multiDraftValue, renderItem, getItemValue, getItemLabel, selectionLimit, onSelectedItemLayout, toggleItemSelection, onDoneSelecting]);
|
|
167
|
+
}, [migrate, mode, value, multiDraftValue, renderItem, getItemValue, getItemLabel, selectionLimit, onSelectedItemLayout, toggleItemSelection, onDoneSelecting, areAllItemsSelected, selectedCount, toggleAllItemsSelection]);
|
|
160
168
|
const renderPickerItem = useCallback((item, index) => {
|
|
161
169
|
return <PickerItem key={`${index}-${item.value}`} {...item} />;
|
|
162
170
|
}, []);
|
|
@@ -201,7 +209,7 @@ const Picker = React.forwardRef((props, ref) => {
|
|
|
201
209
|
...topBarProps,
|
|
202
210
|
onCancel: cancelSelect,
|
|
203
211
|
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}>
|
|
212
|
+
}} 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
213
|
{filteredItems}
|
|
206
214
|
</PickerItemsList>;
|
|
207
215
|
}, [testID, mode, useDialog, selectedItemPosition, topBarProps, cancelSelect, onDoneSelecting, multiDraftValue, showSearch, searchStyle, searchPlaceholder, _onSearchChange, renderCustomSearch, renderHeader, listProps, filteredItems, useSafeArea, useWheelPicker, items, showLoader]);
|
|
@@ -221,6 +229,6 @@ Picker.modes = PickerModes;
|
|
|
221
229
|
Picker.fieldTypes = PickerFieldTypes;
|
|
222
230
|
// @ts-expect-error
|
|
223
231
|
Picker.extractPickerItems = extractPickerItems;
|
|
224
|
-
export { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods };
|
|
232
|
+
export { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods, PickerSelectionStatusProps };
|
|
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"
|
|
@@ -147,6 +149,44 @@ type PickerExpandableOverlayProps = {
|
|
|
147
149
|
*/
|
|
148
150
|
enableModalBlur?: boolean;
|
|
149
151
|
};
|
|
152
|
+
interface PickerSelectionStatusLabelData {
|
|
153
|
+
selectedCount: number;
|
|
154
|
+
areAllItemsSelected: boolean;
|
|
155
|
+
}
|
|
156
|
+
export type ButtonSelectionStatus = {
|
|
157
|
+
/**
|
|
158
|
+
* Select all element type
|
|
159
|
+
*/
|
|
160
|
+
selectAllType?: 'button';
|
|
161
|
+
/**
|
|
162
|
+
* Button props
|
|
163
|
+
*/
|
|
164
|
+
buttonProps?: ButtonProps;
|
|
165
|
+
};
|
|
166
|
+
export type CheckboxSelectionStatus = {
|
|
167
|
+
/**
|
|
168
|
+
* Select all element type
|
|
169
|
+
*/
|
|
170
|
+
selectAllType?: 'checkbox';
|
|
171
|
+
/**
|
|
172
|
+
* Checkbox props
|
|
173
|
+
*/
|
|
174
|
+
checkboxProps?: CheckboxProps;
|
|
175
|
+
};
|
|
176
|
+
export type PickerSelectionStatusProps = {
|
|
177
|
+
/**
|
|
178
|
+
* A function that generates a label based on the selected items' count and status
|
|
179
|
+
*/
|
|
180
|
+
getLabel?: (data: PickerSelectionStatusLabelData) => string;
|
|
181
|
+
/**
|
|
182
|
+
* Custom container style
|
|
183
|
+
*/
|
|
184
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
185
|
+
/**
|
|
186
|
+
* Control weather to show the label or not
|
|
187
|
+
*/
|
|
188
|
+
showLabel?: boolean;
|
|
189
|
+
} & (ButtonSelectionStatus | CheckboxSelectionStatus);
|
|
150
190
|
export type PickerBaseProps = Omit<TextFieldProps, 'value' | 'onChange'> & PickerPropsDeprecation & PickerExpandableOverlayProps & PickerListProps & {
|
|
151
191
|
/**
|
|
152
192
|
* Use dialog instead of modal picker
|
|
@@ -193,6 +233,10 @@ export type PickerBaseProps = Omit<TextFieldProps, 'value' | 'onChange'> & Picke
|
|
|
193
233
|
* Render custom top element
|
|
194
234
|
*/
|
|
195
235
|
renderCustomTopElement?: (value?: PickerValue) => React.ReactElement;
|
|
236
|
+
/**
|
|
237
|
+
* Selection status bar props
|
|
238
|
+
*/
|
|
239
|
+
selectionStatus?: PickerSelectionStatusProps;
|
|
196
240
|
/**
|
|
197
241
|
* Add onPress callback for when pressing the picker
|
|
198
242
|
*/
|
|
@@ -286,8 +330,11 @@ export interface PickerContextProps extends Pick<PickerProps, 'migrate' | 'value
|
|
|
286
330
|
isMultiMode: boolean;
|
|
287
331
|
onSelectedLayout: (event: any) => any;
|
|
288
332
|
selectionLimit: PickerProps['selectionLimit'];
|
|
333
|
+
areAllItemsSelected: boolean;
|
|
334
|
+
selectedCount: number;
|
|
335
|
+
toggleAllItemsSelection?: (selectAll: boolean) => void;
|
|
289
336
|
}
|
|
290
|
-
export type PickerItemsListProps = Pick<PropsWithChildren<PickerProps>, 'topBarProps' | 'listProps' | 'renderHeader' | 'useSafeArea' | 'showLoader' | 'customLoaderElement' | 'renderCustomTopElement' | 'showSearch' | 'searchStyle' | 'searchPlaceholder' | 'onSearchChange' | 'renderCustomSearch' | 'children' | 'useWheelPicker' | 'useDialog' | 'mode' | 'testID'> & {
|
|
337
|
+
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
338
|
items?: {
|
|
292
339
|
value: any;
|
|
293
340
|
label: any;
|
|
@@ -8,8 +8,8 @@ import { Colors } from "../../style";
|
|
|
8
8
|
import { Constants, asBaseComponent, forwardRef } from "../../commons/new";
|
|
9
9
|
import View from "../view";
|
|
10
10
|
import Image from "../image";
|
|
11
|
+
import Assets from "../../assets";
|
|
11
12
|
const GRADIENT_WIDTH = 76;
|
|
12
|
-
const defaultImage = () => require("./assets/gradientOverlay.png");
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @description: Scrollable container with animated gradient overlay for horizontal scroll
|
|
@@ -17,7 +17,7 @@ const defaultImage = () => require("./assets/gradientOverlay.png");
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
class ScrollBar extends Component {
|
|
20
|
-
static displayName = '
|
|
20
|
+
static displayName = 'IGNORE';
|
|
21
21
|
static defaultProps = {
|
|
22
22
|
gradientWidth: GRADIENT_WIDTH,
|
|
23
23
|
gradientMargins: 0,
|
|
@@ -175,7 +175,7 @@ class ScrollBar extends Component {
|
|
|
175
175
|
right: !left ? gradientMargins : undefined,
|
|
176
176
|
left: left ? gradientMargins : undefined
|
|
177
177
|
}}>
|
|
178
|
-
<Image source={gradientImage ||
|
|
178
|
+
<Image source={gradientImage || Assets.internal.images.gradientOverlay} style={{
|
|
179
179
|
width: gradientWidth,
|
|
180
180
|
height: heightToUse,
|
|
181
181
|
tintColor: gradientColor,
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"snippet": [
|
|
46
46
|
"function Example(props) {",
|
|
47
47
|
" const data = Array.from({length: 10}, (_, index) => {",
|
|
48
|
-
" let text =
|
|
48
|
+
" let text = `${index}`;",
|
|
49
49
|
" if (index === 3) {",
|
|
50
50
|
" text = 'Locked item';",
|
|
51
51
|
" }",
|
|
52
52
|
" ",
|
|
53
53
|
" return {",
|
|
54
54
|
" text,",
|
|
55
|
-
" id:
|
|
55
|
+
" id: `${index}`,",
|
|
56
56
|
" locked: index === 3",
|
|
57
57
|
" };",
|
|
58
58
|
" });",
|
|
@@ -78,11 +78,11 @@
|
|
|
78
78
|
" }, []);",
|
|
79
79
|
"",
|
|
80
80
|
" const keyExtractor = useCallback((item: Item) => {",
|
|
81
|
-
" return
|
|
81
|
+
" return `${item.id}`;",
|
|
82
82
|
" }, []);",
|
|
83
83
|
"",
|
|
84
84
|
" return (",
|
|
85
|
-
" <
|
|
85
|
+
" <View>",
|
|
86
86
|
" <SortableList",
|
|
87
87
|
" data={data$1}",
|
|
88
88
|
" flexMigration",
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
" renderItem={renderItem$3}",
|
|
91
91
|
" keyExtractor={keyExtractor$4}",
|
|
92
92
|
" />",
|
|
93
|
-
" </
|
|
94
|
-
" )
|
|
95
|
-
"}"
|
|
93
|
+
" </View>",
|
|
94
|
+
" )",
|
|
95
|
+
"};"
|
|
96
96
|
]
|
|
97
97
|
}
|
|
@@ -6,17 +6,12 @@ import { asBaseComponent } from "../../commons/new";
|
|
|
6
6
|
import View from "../view";
|
|
7
7
|
import Text from "../text";
|
|
8
8
|
import Button from "../button";
|
|
9
|
+
import Assets from "../../assets";
|
|
9
10
|
var ActionType = /*#__PURE__*/function (ActionType) {
|
|
10
11
|
ActionType["MINUS"] = "minus";
|
|
11
12
|
ActionType["PLUS"] = "plus";
|
|
12
13
|
return ActionType;
|
|
13
14
|
}(ActionType || {});
|
|
14
|
-
const minusOutline = require("./assets/minusOutline.png");
|
|
15
|
-
const minusOutlineSmall = require("./assets/minusOutlineSmall.png");
|
|
16
|
-
const plusOutline = require("./assets/plusOutline.png");
|
|
17
|
-
const plusOutlineSmall = require("./assets/plusOutlineSmall.png");
|
|
18
|
-
const plusSmall = require("./assets/plusSmall.png");
|
|
19
|
-
const minusSmall = require("./assets/minusSmall.png");
|
|
20
15
|
const DEFAULT_STEP = 1;
|
|
21
16
|
/**
|
|
22
17
|
* @description: A stepper component
|
|
@@ -150,8 +145,8 @@ class Stepper extends PureComponent {
|
|
|
150
145
|
} = this.props;
|
|
151
146
|
const allowStepChange = this.allowStepChange(actionType);
|
|
152
147
|
const isFloatingStepper = type === 'floating';
|
|
153
|
-
const minusButton = isFloatingStepper ? minusSmall : small ? minusOutlineSmall : minusOutline;
|
|
154
|
-
const plusButton = isFloatingStepper ? plusSmall : small ? plusOutlineSmall : plusOutline;
|
|
148
|
+
const minusButton = isFloatingStepper ? Assets.internal.icons.minusSmall : small ? Assets.internal.icons.minusOutlineSmall : Assets.internal.icons.minusOutline;
|
|
149
|
+
const plusButton = isFloatingStepper ? Assets.internal.icons.plusSmall : small ? Assets.internal.icons.plusOutlineSmall : Assets.internal.icons.plusOutline;
|
|
155
150
|
return <Button link color={isFloatingStepper ? Colors.$iconDefault : undefined} iconSource={actionType === ActionType.MINUS ? minusButton : plusButton} disabled={disabled || !allowStepChange} onPress={() => this.handleStepChange(actionType)} testID={actionType === ActionType.MINUS ? `${testID}.minusStep` : `${testID}.plusStep`} />;
|
|
156
151
|
}
|
|
157
152
|
render() {
|
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
"extendsLink": ["https://reactnative.dev/docs/scrollview"],
|
|
8
8
|
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TabControllerScreen/index.tsx",
|
|
9
9
|
"images": [],
|
|
10
|
+
"props": [],
|
|
10
11
|
"snippet": [
|
|
11
|
-
"<TabController
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
12
|
+
"<TabController>",
|
|
13
|
+
" <TabController.PageCarousel>",
|
|
14
|
+
" {_.map(items, (item, key) => {",
|
|
15
|
+
" return <TabController.TabPage index={key}/>;",
|
|
16
|
+
" })}",
|
|
17
|
+
" </TabController.PageCarousel>",
|
|
18
|
+
"</TabController>"
|
|
16
19
|
]
|
|
17
20
|
}
|
|
@@ -54,7 +54,7 @@ const ClearButton = ({
|
|
|
54
54
|
onClear?.();
|
|
55
55
|
};
|
|
56
56
|
return <View reanimated style={style} testID={`${testID}.container`}>
|
|
57
|
-
<Button link iconSource={Assets.icons.xFlat} iconStyle={styles.clearIcon} onPress={clear} hitSlop={hitSlop} accessible={hasValue} accessibilityLabel={'clear'} testID={testID} />
|
|
57
|
+
<Button link iconSource={Assets.internal.icons.xFlat} iconStyle={styles.clearIcon} onPress={clear} hitSlop={hitSlop} accessible={hasValue} accessibilityLabel={'clear'} testID={testID} />
|
|
58
58
|
</View>;
|
|
59
59
|
};
|
|
60
60
|
const styles = StyleSheet.create({
|
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
"name": "TextField",
|
|
3
3
|
"category": "form",
|
|
4
4
|
"description": "An enhanced customizable TextField with validation support",
|
|
5
|
-
"extends": [
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
"extends": [
|
|
6
|
+
"TextInput"
|
|
7
|
+
],
|
|
8
|
+
"extendsLink": [
|
|
9
|
+
"https://reactnative.dev/docs/textinput"
|
|
10
|
+
],
|
|
11
|
+
"modifiers": [
|
|
12
|
+
"margin",
|
|
13
|
+
"color",
|
|
14
|
+
"typography"
|
|
15
|
+
],
|
|
8
16
|
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TextFieldScreen.tsx",
|
|
9
17
|
"images": [
|
|
10
18
|
"https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Incubator.TextField/FloatingPlaceholder.gif?raw=true, https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Incubator.TextField/Validation.gif?raw=true, https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Incubator.TextField/ColorByState.gif?raw=true, https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Incubator.TextField/CharCounter.gif?raw=true, https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Incubator.TextField/Hint.gif?raw=true"
|
|
@@ -276,7 +284,7 @@
|
|
|
276
284
|
"type": "section",
|
|
277
285
|
"layout": "horizontal",
|
|
278
286
|
"title": "Structure",
|
|
279
|
-
"description": "
|
|
287
|
+
"description": "Markdown:\n\n1. **Label**\nDescribes the information that the user needs to enter. The label should be short and clear, preferably a noun. \n2. **Placeholder** (optional) \nPlaceholders can serve as an assistive text that can provide additional aid or context to the user. Don’t use it to display critical information - as it disappears when the users starts typing. \n3. **Helper text** (optional) \nUse this to provide a hint or a disclaimer about the content of the field. For example, “Passwords must contain at least 8 characters” \n4. **Clear button** \nLets the user to easily clear the input value. Appears only when value was typed. \n5. **Character count** \nShould be used if there is a character limit. Displays the amount of typed characters out of total allowed. If the limit is reached, the counter will become red and further typing is disabled. \n6. **Validation message** \nDemonstrates that a required input is missing something or the entry was invalid.",
|
|
280
288
|
"content": [
|
|
281
289
|
{
|
|
282
290
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components Docs/textField/textField_overview_section_03.png"
|
|
@@ -285,7 +293,11 @@
|
|
|
285
293
|
},
|
|
286
294
|
{
|
|
287
295
|
"type": "table",
|
|
288
|
-
"columns": [
|
|
296
|
+
"columns": [
|
|
297
|
+
"Property",
|
|
298
|
+
"Component",
|
|
299
|
+
"New Column"
|
|
300
|
+
],
|
|
289
301
|
"items": [
|
|
290
302
|
{
|
|
291
303
|
"title": "Inactive (default)",
|
|
@@ -374,7 +386,10 @@
|
|
|
374
386
|
},
|
|
375
387
|
{
|
|
376
388
|
"type": "table",
|
|
377
|
-
"columns": [
|
|
389
|
+
"columns": [
|
|
390
|
+
"Property",
|
|
391
|
+
"Component"
|
|
392
|
+
],
|
|
378
393
|
"items": [
|
|
379
394
|
{
|
|
380
395
|
"title": "Outline (Default)",
|
|
@@ -400,7 +415,10 @@
|
|
|
400
415
|
},
|
|
401
416
|
{
|
|
402
417
|
"type": "table",
|
|
403
|
-
"columns": [
|
|
418
|
+
"columns": [
|
|
419
|
+
"Property",
|
|
420
|
+
"Component"
|
|
421
|
+
],
|
|
404
422
|
"items": [
|
|
405
423
|
{
|
|
406
424
|
"title": "Leading Accessory (Prefix)",
|
|
@@ -458,7 +476,7 @@
|
|
|
458
476
|
}
|
|
459
477
|
],
|
|
460
478
|
"title": "Spec",
|
|
461
|
-
"description": "**Label**\nbodySmall, $textNeutralHeavy \n**Placeholder**\nbody, $textNeutralLight \n**Value** \nbody, $textDefault \n**Helper Text** \nsubtext, $textNeutralHeavy \n**Character Count** \nbodySmall, $textNeutralHeavy \n**Validation message** \nMessage - bodySmall, $textDangerLight\nIcon - exclamationFillSmall, $iconDangerLight \n**Prefix & Suffix** \nbody, $textNeutral \n**Clear Button** \nxFlat, $textNeutralLight \n**Warning Message** \nMessage - bodySmall, $textDefault\nIcon - exclamationFillSmall, $iconDefault \n**Validation Success** \nIcon - checkmarkFlatSmall, $iconSuccess \n**Outline - Default/unfocused** \n1p, $outlineNeutral \n**Outline - Focused, typing** \n1p, $outlinePrimary \n**Outline - Validation** \n1p, $outlineDanger \n**Outline - Disabled** \n1p, $outlineDisabled \n**Outline - Read only** \nfill background- $backgroundNeutralLight"
|
|
479
|
+
"description": "Markdown:\n\n**Label**\nbodySmall, $textNeutralHeavy \n**Placeholder**\nbody, $textNeutralLight \n**Value** \nbody, $textDefault \n**Helper Text** \nsubtext, $textNeutralHeavy \n**Character Count** \nbodySmall, $textNeutralHeavy \n**Validation message** \nMessage - bodySmall, $textDangerLight\nIcon - exclamationFillSmall, $iconDangerLight \n**Prefix & Suffix** \nbody, $textNeutral \n**Clear Button** \nxFlat, $textNeutralLight \n**Warning Message** \nMessage - bodySmall, $textDefault\nIcon - exclamationFillSmall, $iconDefault \n**Validation Success** \nIcon - checkmarkFlatSmall, $iconSuccess \n**Outline - Default/unfocused** \n1p, $outlineNeutral \n**Outline - Focused, typing** \n1p, $outlinePrimary \n**Outline - Validation** \n1p, $outlineDanger \n**Outline - Disabled** \n1p, $outlineDisabled \n**Outline - Read only** \nfill background- $backgroundNeutralLight"
|
|
462
480
|
}
|
|
463
481
|
]
|
|
464
482
|
},
|