@applicaster/zapp-react-native-ui-components 16.0.0-rc.56 → 16.0.0-rc.58
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/Components/ModalComponent/AudioPlayer/Components/Action.tsx +0 -18
- package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +17 -24
- package/Components/ModalComponent/AudioPlayer/Components/Header.tsx +25 -73
- package/Components/ModalComponent/AudioPlayer/Components/Input.tsx +0 -18
- package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +75 -79
- package/Components/ModalComponent/AudioPlayer/Components/NowPlayingHeaderSection.tsx +89 -0
- package/Components/ModalComponent/AudioPlayer/Components/index.ts +3 -1
- package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +199 -0
- package/Components/ModalComponent/BottomSheetModalContent.tsx +382 -61
- package/Components/ModalComponent/Button/index.tsx +5 -3
- package/Components/ModalComponent/Header/index.tsx +20 -7
- package/Components/ModalComponent/Header/utils.ts +1 -1
- package/Components/ModalComponent/ModalBlocksStyleContext.tsx +10 -0
- package/Components/ModalComponent/SortableList.tsx +142 -0
- package/Components/ModalComponent/TextInputContent.tsx +100 -0
- package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +238 -0
- package/Components/ModalComponent/__tests__/TextInputContent.test.tsx +120 -0
- package/Components/ModalComponent/__tests__/showTextInput.test.ts +95 -0
- package/Components/ModalComponent/index.tsx +11 -0
- package/Components/ModalComponent/presets/__tests__/getCell.test.ts +66 -0
- package/Components/ModalComponent/presets/dynamicCollectionCell.tsx +78 -0
- package/Components/ModalComponent/presets/index.ts +27 -0
- package/Components/ModalComponent/presets/selectableCell.tsx +28 -0
- package/Components/ModalComponent/presets/standardCell.tsx +41 -0
- package/Components/ModalComponent/presets/types.ts +35 -0
- package/Components/ModalComponent/showTextInput.ts +43 -0
- package/Components/ModalComponent/utils.ts +76 -20
- package/package.json +6 -5
- /package/Decorators/ZappPipesDataConnector/__tests__/{Hero.js → Hero.tsx} +0 -0
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import React, { useCallback, useState } from "react";
|
|
2
|
+
import { actionExecutor } from "@applicaster/zapp-react-native-utils/actionsExecutor/ActionExecutor";
|
|
2
3
|
|
|
3
4
|
import { BasicMeasurementsPortal as MeasurementsPortal } from "@applicaster/zapp-react-native-ui-components/Components/MeasurmentsPortal";
|
|
4
5
|
import { BottomSheetModalContent } from "./BottomSheetModalContent";
|
|
6
|
+
import { showTextInputAction } from "./showTextInput";
|
|
7
|
+
|
|
8
|
+
actionExecutor.registerAction("showTextInput", showTextInputAction);
|
|
9
|
+
|
|
10
|
+
export { SortableList, type SortableListProps } from "./SortableList";
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
TextInputContent,
|
|
14
|
+
type TextInputContentProps,
|
|
15
|
+
} from "./TextInputContent";
|
|
5
16
|
|
|
6
17
|
export type PluginConfiguration = {
|
|
7
18
|
[key: string]: any;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { getCell } from "../index";
|
|
2
|
+
import { standardCell } from "../standardCell";
|
|
3
|
+
import { selectableCell } from "../selectableCell";
|
|
4
|
+
import { dynamicCollectionCell } from "../dynamicCollectionCell";
|
|
5
|
+
import { mapMenuItemToPlaylistData } from "../../AudioPlayer/Components/Item";
|
|
6
|
+
|
|
7
|
+
describe("getCell", () => {
|
|
8
|
+
it("returns selectable cell for collection_selector", () => {
|
|
9
|
+
expect(getCell("collection_selector")).toBe(selectableCell);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("returns selectable cell for preference_editor", () => {
|
|
13
|
+
expect(getCell("preference_editor")).toBe(selectableCell);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("returns standard cell when role is undefined", () => {
|
|
17
|
+
expect(getCell(undefined)).toBe(standardCell);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("returns standard cell for unknown roles", () => {
|
|
21
|
+
expect(getCell("unknown_role")).toBe(standardCell);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("returns the dynamic collection cell for dynamic_collection", () => {
|
|
25
|
+
expect(getCell("dynamic_collection")).toBe(dynamicCollectionCell);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("does not use behavior to select the cell family", () => {
|
|
29
|
+
expect(getCell(undefined, { selectMode: "multi" })).toBe(standardCell);
|
|
30
|
+
|
|
31
|
+
expect(getCell("collection_selector", { selectMode: "single" })).toBe(
|
|
32
|
+
selectableCell
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe("mapMenuItemToPlaylistData", () => {
|
|
38
|
+
const item = {
|
|
39
|
+
title: "Playlist 1",
|
|
40
|
+
summary: "5 items",
|
|
41
|
+
icon: "https://example.com/icon.png",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
it("defaults to multiSelect trailing button when selectMode is multi or undefined", () => {
|
|
45
|
+
const data1 = mapMenuItemToPlaylistData(item, { selectMode: "multi" });
|
|
46
|
+
expect(data1.trailingButton).toBe("multiSelect");
|
|
47
|
+
|
|
48
|
+
const data2 = mapMenuItemToPlaylistData(item);
|
|
49
|
+
expect(data2.trailingButton).toBe("multiSelect");
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("omits trailing button when behavior selectMode is none", () => {
|
|
53
|
+
const data = mapMenuItemToPlaylistData(item, { selectMode: "none" });
|
|
54
|
+
expect(data.trailingButton).toBeUndefined();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("omits trailing button when item trailingButton is explicitly none", () => {
|
|
58
|
+
const itemWithNone = { ...item, trailingButton: "none" };
|
|
59
|
+
|
|
60
|
+
const data = mapMenuItemToPlaylistData(itemWithNone, {
|
|
61
|
+
selectMode: "multi",
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
expect(data.trailingButton).toBeUndefined();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
AudioPlayerTrackItem,
|
|
4
|
+
VARIANT_QUEUED_ITEM,
|
|
5
|
+
ItemData,
|
|
6
|
+
} from "../AudioPlayer/Components/Item";
|
|
7
|
+
import type { CellRenderer, RenderItemArgs } from "./types";
|
|
8
|
+
import {
|
|
9
|
+
MenuItem,
|
|
10
|
+
OPERATIONS,
|
|
11
|
+
hasOperation,
|
|
12
|
+
} from "@applicaster/zapp-react-native-utils/modalState";
|
|
13
|
+
|
|
14
|
+
function mapMenuItemToDynamicData(
|
|
15
|
+
item: MenuItem,
|
|
16
|
+
operations: string[]
|
|
17
|
+
): ItemData {
|
|
18
|
+
const hasRemove = hasOperation(operations, OPERATIONS.REMOVE);
|
|
19
|
+
const hasReorder = hasOperation(operations, OPERATIONS.REORDER);
|
|
20
|
+
|
|
21
|
+
const title =
|
|
22
|
+
typeof item?.title === "string"
|
|
23
|
+
? item.title
|
|
24
|
+
: item?.title != null
|
|
25
|
+
? String(item.title)
|
|
26
|
+
: "";
|
|
27
|
+
|
|
28
|
+
const summary =
|
|
29
|
+
typeof item?.summary === "string"
|
|
30
|
+
? item.summary
|
|
31
|
+
: item?.summary != null
|
|
32
|
+
? String(item.summary)
|
|
33
|
+
: "";
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
imageUri: item?.icon,
|
|
37
|
+
textLabel1: title,
|
|
38
|
+
textLabel2: summary,
|
|
39
|
+
leadingButton: hasRemove ? "remove" : undefined,
|
|
40
|
+
trailingButton: hasReorder ? "drag" : undefined,
|
|
41
|
+
isSelected: item?.isSelected,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const dynamicCollectionCell: CellRenderer = {
|
|
46
|
+
renderItem: ({
|
|
47
|
+
item,
|
|
48
|
+
index,
|
|
49
|
+
onPress,
|
|
50
|
+
context,
|
|
51
|
+
renderHandle,
|
|
52
|
+
}: RenderItemArgs) => {
|
|
53
|
+
const { editableCollection } = context;
|
|
54
|
+
const operations = editableCollection?.operations || [];
|
|
55
|
+
|
|
56
|
+
const handleRemove = () => {
|
|
57
|
+
if (editableCollection?.remove) {
|
|
58
|
+
editableCollection.remove(index);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const handleDrag = () => {
|
|
63
|
+
// Drag is managed by SortableList drag handle context
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<AudioPlayerTrackItem
|
|
68
|
+
key={item.id}
|
|
69
|
+
configuration={VARIANT_QUEUED_ITEM}
|
|
70
|
+
data={mapMenuItemToDynamicData(item, operations)}
|
|
71
|
+
onPress={() => onPress(item)}
|
|
72
|
+
onLeadingButtonPress={handleRemove}
|
|
73
|
+
onTrailingButtonPress={handleDrag}
|
|
74
|
+
renderHandle={renderHandle}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { SelectionBehavior } from "@applicaster/zapp-react-native-utils/modalState";
|
|
2
|
+
import { selectableCell } from "./selectableCell";
|
|
3
|
+
import { standardCell } from "./standardCell";
|
|
4
|
+
import type { CellRenderer } from "./types";
|
|
5
|
+
|
|
6
|
+
export type { CellRenderer, RenderItemArgs, SheetRenderContext } from "./types";
|
|
7
|
+
|
|
8
|
+
export { standardCell } from "./standardCell";
|
|
9
|
+
|
|
10
|
+
export { selectableCell } from "./selectableCell";
|
|
11
|
+
|
|
12
|
+
import { dynamicCollectionCell } from "./dynamicCollectionCell";
|
|
13
|
+
|
|
14
|
+
const SELECTION_ROLES = new Set(["collection_selector", "preference_editor"]);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the row cell from feed role (+ behavior for future config only).
|
|
18
|
+
* Unknown / none -> standard Button cell.
|
|
19
|
+
*/
|
|
20
|
+
export const getCell = (
|
|
21
|
+
role?: string,
|
|
22
|
+
_behavior?: SelectionBehavior
|
|
23
|
+
): CellRenderer => {
|
|
24
|
+
if (role === "dynamic_collection") return dynamicCollectionCell;
|
|
25
|
+
|
|
26
|
+
return role && SELECTION_ROLES.has(role) ? selectableCell : standardCell;
|
|
27
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
AudioPlayerTrackItem,
|
|
4
|
+
mapMenuItemToPlaylistData,
|
|
5
|
+
VARIANT_PLAYLIST_ITEM,
|
|
6
|
+
} from "../AudioPlayer/Components/Item";
|
|
7
|
+
import type { CellRenderer } from "./types";
|
|
8
|
+
|
|
9
|
+
export const selectableCell: CellRenderer = {
|
|
10
|
+
renderItem: ({ item, onPress, context }) => (
|
|
11
|
+
<AudioPlayerTrackItem
|
|
12
|
+
key={item.id}
|
|
13
|
+
configuration={VARIANT_PLAYLIST_ITEM}
|
|
14
|
+
data={mapMenuItemToPlaylistData(item, context?.behavior)}
|
|
15
|
+
onPress={() => onPress(item)}
|
|
16
|
+
onTrailingButtonPress={
|
|
17
|
+
item.secondaryAction?.action
|
|
18
|
+
? () =>
|
|
19
|
+
onPress({
|
|
20
|
+
id: `${item.id}_secondary`,
|
|
21
|
+
title: item.title,
|
|
22
|
+
action: item.secondaryAction!.action,
|
|
23
|
+
})
|
|
24
|
+
: undefined
|
|
25
|
+
}
|
|
26
|
+
/>
|
|
27
|
+
),
|
|
28
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CellRenderer } from "./types";
|
|
3
|
+
|
|
4
|
+
export const standardCell: CellRenderer = {
|
|
5
|
+
renderItem: ({ item, onPress, context }) => {
|
|
6
|
+
if (!item) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
theme,
|
|
12
|
+
ButtonComponent,
|
|
13
|
+
current_selection,
|
|
14
|
+
iconBaseProps,
|
|
15
|
+
itemBaseProps,
|
|
16
|
+
labelBaseProps,
|
|
17
|
+
getSelectedItemIcon,
|
|
18
|
+
getDefaultItemIcon,
|
|
19
|
+
iconPlacement,
|
|
20
|
+
} = context;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<ButtonComponent
|
|
24
|
+
key={item.id}
|
|
25
|
+
configuration={theme}
|
|
26
|
+
selectedItem={current_selection}
|
|
27
|
+
item={item}
|
|
28
|
+
onPress={onPress}
|
|
29
|
+
label={
|
|
30
|
+
theme[(item as any)?.label] ?? ((item as any)?.label || item?.title)
|
|
31
|
+
}
|
|
32
|
+
iconBaseProps={iconBaseProps}
|
|
33
|
+
itemBaseProps={itemBaseProps}
|
|
34
|
+
labelBaseProps={labelBaseProps}
|
|
35
|
+
selectedItemIcon={getSelectedItemIcon(theme)}
|
|
36
|
+
defaultItemIcon={getDefaultItemIcon(theme)}
|
|
37
|
+
iconPlacement={iconPlacement}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type {
|
|
3
|
+
MenuItem,
|
|
4
|
+
SelectionBehavior,
|
|
5
|
+
} from "@applicaster/zapp-react-native-utils/modalState";
|
|
6
|
+
import type { EditableCollection } from "@applicaster/zapp-react-native-utils/modalState/EditableCollection";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Extra props row renderers need.
|
|
10
|
+
*/
|
|
11
|
+
export type SheetRenderContext = {
|
|
12
|
+
theme: any;
|
|
13
|
+
ButtonComponent: React.ComponentType<any>;
|
|
14
|
+
current_selection?: any;
|
|
15
|
+
iconBaseProps: any;
|
|
16
|
+
itemBaseProps: any;
|
|
17
|
+
labelBaseProps: any;
|
|
18
|
+
getSelectedItemIcon: (theme: any) => any;
|
|
19
|
+
getDefaultItemIcon: (theme: any) => any;
|
|
20
|
+
iconPlacement?: "left" | "right";
|
|
21
|
+
editableCollection?: EditableCollection | null;
|
|
22
|
+
behavior?: SelectionBehavior;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type RenderItemArgs = {
|
|
26
|
+
item: MenuItem;
|
|
27
|
+
index: number;
|
|
28
|
+
onPress: (item: MenuItem) => void;
|
|
29
|
+
context: SheetRenderContext;
|
|
30
|
+
renderHandle?: (children: React.ReactElement) => React.ReactElement;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type CellRenderer = {
|
|
34
|
+
renderItem: (args: RenderItemArgs) => React.ReactNode;
|
|
35
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
actionExecutor,
|
|
3
|
+
ActionResult,
|
|
4
|
+
} from "@applicaster/zapp-react-native-utils/actionsExecutor/ActionExecutor";
|
|
5
|
+
import { TextInputContent } from "./TextInputContent";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Opens a text-input bottom sheet driven by action.options.
|
|
9
|
+
* Uses openBottomSheet with content.component as body-only UI;
|
|
10
|
+
* standard ModalHeader (dismiss x) is provided by ModalComponent.
|
|
11
|
+
*/
|
|
12
|
+
export async function showTextInputAction(
|
|
13
|
+
action: ActionType,
|
|
14
|
+
context?: Record<string, any>
|
|
15
|
+
): Promise<ActionResult> {
|
|
16
|
+
const { headerTitle, inputLabel, defaultValue, buttonLabel, actions } =
|
|
17
|
+
action.options || {};
|
|
18
|
+
|
|
19
|
+
if (!headerTitle || !buttonLabel || !actions || !actions.length) {
|
|
20
|
+
return ActionResult.Error;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return actionExecutor.handleAction(
|
|
24
|
+
{
|
|
25
|
+
type: "openBottomSheet",
|
|
26
|
+
options: {
|
|
27
|
+
header: {
|
|
28
|
+
title: headerTitle,
|
|
29
|
+
},
|
|
30
|
+
content: {
|
|
31
|
+
component: TextInputContent,
|
|
32
|
+
props: {
|
|
33
|
+
inputLabel,
|
|
34
|
+
defaultValue: defaultValue ?? "",
|
|
35
|
+
buttonLabel,
|
|
36
|
+
actions,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
context
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
2
|
+
import {
|
|
3
|
+
toNumberWithDefault,
|
|
4
|
+
toNumberWithDefaultZero,
|
|
5
|
+
} from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
2
6
|
import { PluginConfiguration } from "./";
|
|
3
7
|
import { ItemIconProps } from "./Button/ItemIcon";
|
|
4
8
|
import { ItemLabelProps } from "./Button/ItemLabel";
|
|
@@ -6,7 +10,8 @@ import { ItemProps } from "./Button/Item";
|
|
|
6
10
|
|
|
7
11
|
export function defaultItemProps(
|
|
8
12
|
config: PluginConfiguration,
|
|
9
|
-
maxWidth: number
|
|
13
|
+
maxWidth: number,
|
|
14
|
+
blockItemStyle?: Record<string, any>
|
|
10
15
|
): ItemProps {
|
|
11
16
|
const {
|
|
12
17
|
modal_bottom_sheet_item_background_color,
|
|
@@ -24,19 +29,31 @@ export function defaultItemProps(
|
|
|
24
29
|
modal_bottom_sheet_item_padding_top,
|
|
25
30
|
} = config;
|
|
26
31
|
|
|
32
|
+
const bgDefault = blockItemStyle?.background?.default;
|
|
33
|
+
|
|
27
34
|
return {
|
|
28
|
-
backgroundColor:
|
|
35
|
+
backgroundColor:
|
|
36
|
+
bgDefault?.backgroundColor || modal_bottom_sheet_item_background_color,
|
|
29
37
|
focusedBackgroundColor: modal_bottom_sheet_item_focus_background_color,
|
|
30
38
|
selectedBackgroundColor: modal_bottom_sheet_item_selected_background_color,
|
|
31
39
|
focusedSelectedBackgroundColor:
|
|
32
40
|
modal_bottom_sheet_item_focused_selected_background_color,
|
|
33
|
-
borderRadius:
|
|
41
|
+
borderRadius: toNumberWithDefault(
|
|
42
|
+
modal_bottom_sheet_item_corner_radius,
|
|
43
|
+
bgDefault?.borderRadius
|
|
44
|
+
),
|
|
34
45
|
marginBottom: modal_bottom_sheet_item_margin_bottom,
|
|
35
46
|
marginTop: modal_bottom_sheet_item_margin_top,
|
|
36
47
|
marginLeft: modal_bottom_sheet_item_margin_left,
|
|
37
48
|
marginRight: modal_bottom_sheet_item_margin_right,
|
|
38
|
-
paddingTop:
|
|
39
|
-
|
|
49
|
+
paddingTop: toNumberWithDefault(
|
|
50
|
+
modal_bottom_sheet_item_padding_top,
|
|
51
|
+
bgDefault?.paddingTop
|
|
52
|
+
),
|
|
53
|
+
paddingBottom: toNumberWithDefault(
|
|
54
|
+
modal_bottom_sheet_item_padding_bottom,
|
|
55
|
+
bgDefault?.paddingBottom
|
|
56
|
+
),
|
|
40
57
|
paddingRight: modal_bottom_sheet_item_padding_right,
|
|
41
58
|
paddingLeft: modal_bottom_sheet_item_padding_left,
|
|
42
59
|
maxWidth,
|
|
@@ -45,7 +62,8 @@ export function defaultItemProps(
|
|
|
45
62
|
|
|
46
63
|
export function defaultItemLabelProps(
|
|
47
64
|
config: PluginConfiguration,
|
|
48
|
-
sheetWidth: number
|
|
65
|
+
sheetWidth: number,
|
|
66
|
+
blockItemStyle?: Record<string, any>
|
|
49
67
|
): ItemLabelProps {
|
|
50
68
|
const {
|
|
51
69
|
modal_bottom_sheet_item_label_android_letter_spacing,
|
|
@@ -72,15 +90,48 @@ export function defaultItemLabelProps(
|
|
|
72
90
|
modal_bottom_sheet_item_padding_right,
|
|
73
91
|
} = config;
|
|
74
92
|
|
|
75
|
-
const
|
|
93
|
+
const iconWidth = toNumberWithDefaultZero(modal_bottom_sheet_item_icon_width);
|
|
94
|
+
|
|
95
|
+
const iconMarginLeft = toNumberWithDefaultZero(
|
|
96
|
+
modal_bottom_sheet_item_icon_margin_left
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const iconMarginRight = toNumberWithDefaultZero(
|
|
100
|
+
modal_bottom_sheet_item_icon_margin_right
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const itemMarginLeft = toNumberWithDefaultZero(
|
|
104
|
+
modal_bottom_sheet_item_margin_left
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const itemMarginRight = toNumberWithDefaultZero(
|
|
108
|
+
modal_bottom_sheet_item_margin_right
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const itemPaddingLeft = toNumberWithDefaultZero(
|
|
112
|
+
modal_bottom_sheet_item_padding_left
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const itemPaddingRight = toNumberWithDefaultZero(
|
|
116
|
+
modal_bottom_sheet_item_padding_right
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const calculatedMaxWidth =
|
|
76
120
|
sheetWidth -
|
|
77
|
-
(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
121
|
+
(iconWidth +
|
|
122
|
+
iconMarginLeft +
|
|
123
|
+
iconMarginRight +
|
|
124
|
+
itemMarginLeft +
|
|
125
|
+
itemMarginRight +
|
|
126
|
+
itemPaddingLeft +
|
|
127
|
+
itemPaddingRight);
|
|
128
|
+
|
|
129
|
+
const maxWidth =
|
|
130
|
+
Number.isNaN(calculatedMaxWidth) || calculatedMaxWidth <= 0
|
|
131
|
+
? sheetWidth
|
|
132
|
+
: calculatedMaxWidth;
|
|
133
|
+
|
|
134
|
+
const label1Default = blockItemStyle?.textLabel1?.default;
|
|
84
135
|
|
|
85
136
|
return {
|
|
86
137
|
fontFamily: platformSelect({
|
|
@@ -91,8 +142,11 @@ export function defaultItemLabelProps(
|
|
|
91
142
|
ios: modal_bottom_sheet_item_label_ios_letter_spacing,
|
|
92
143
|
android: modal_bottom_sheet_item_label_android_letter_spacing,
|
|
93
144
|
}),
|
|
94
|
-
fontSize:
|
|
95
|
-
|
|
145
|
+
fontSize: toNumberWithDefault(
|
|
146
|
+
modal_bottom_sheet_item_label_font_size,
|
|
147
|
+
label1Default?.fontSize
|
|
148
|
+
),
|
|
149
|
+
color: label1Default?.fontColor || modal_bottom_sheet_item_label_font_color,
|
|
96
150
|
focusColor: modal_bottom_sheet_item_label_focus_font_color,
|
|
97
151
|
hoverSelectedColor: modal_bottom_sheet_item_label_hover_selected_font_color,
|
|
98
152
|
selectedColor: modal_bottom_sheet_item_label_selected_font_color,
|
|
@@ -146,7 +200,8 @@ export function getItemLabelProps(
|
|
|
146
200
|
width: number,
|
|
147
201
|
labelProps?:
|
|
148
202
|
| ((theme: PluginConfiguration, width: number) => ItemLabelProps)
|
|
149
|
-
| ItemLabelProps
|
|
203
|
+
| ItemLabelProps,
|
|
204
|
+
blockItemStyle?: Record<string, any>
|
|
150
205
|
) {
|
|
151
206
|
if (labelProps) {
|
|
152
207
|
return typeof labelProps === "function"
|
|
@@ -154,7 +209,7 @@ export function getItemLabelProps(
|
|
|
154
209
|
: labelProps;
|
|
155
210
|
}
|
|
156
211
|
|
|
157
|
-
return defaultItemLabelProps(theme, width);
|
|
212
|
+
return defaultItemLabelProps(theme, width, blockItemStyle);
|
|
158
213
|
}
|
|
159
214
|
|
|
160
215
|
export function getItemProps(
|
|
@@ -162,7 +217,8 @@ export function getItemProps(
|
|
|
162
217
|
width: number,
|
|
163
218
|
itemProps?:
|
|
164
219
|
| ((theme: PluginConfiguration, width: number) => ItemProps)
|
|
165
|
-
| ItemProps
|
|
220
|
+
| ItemProps,
|
|
221
|
+
blockItemStyle?: Record<string, any>
|
|
166
222
|
) {
|
|
167
223
|
if (itemProps) {
|
|
168
224
|
return typeof itemProps === "function"
|
|
@@ -170,5 +226,5 @@ export function getItemProps(
|
|
|
170
226
|
: itemProps;
|
|
171
227
|
}
|
|
172
228
|
|
|
173
|
-
return defaultItemProps(theme, width);
|
|
229
|
+
return defaultItemProps(theme, width, blockItemStyle);
|
|
174
230
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "16.0.0-rc.
|
|
3
|
+
"version": "16.0.0-rc.58",
|
|
4
4
|
"description": "Applicaster Zapp React Native ui components for the Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,12 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "16.0.0-rc.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "16.0.0-rc.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "16.0.0-rc.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "16.0.0-rc.
|
|
31
|
+
"@applicaster/applicaster-types": "16.0.0-rc.58",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "16.0.0-rc.58",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "16.0.0-rc.58",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "16.0.0-rc.58",
|
|
35
35
|
"fast-json-stable-stringify": "^2.1.0",
|
|
36
36
|
"promise": "^8.3.0",
|
|
37
|
+
"react-native-sortables": "1.7.1",
|
|
37
38
|
"url": "^0.11.0",
|
|
38
39
|
"uuid": "^3.3.2"
|
|
39
40
|
},
|
|
File without changes
|