@applicaster/zapp-react-native-ui-components 15.1.13 → 15.1.15-alpha.4236143002
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/MasterCell/DefaultComponents/ActionButton.tsx +4 -1
- package/Components/ModalComponent/ActionsBottomSheet/ActionButton.tsx +56 -0
- package/Components/ModalComponent/ActionsBottomSheet/__tests__/openActionsBottomSheet.test.ts +38 -0
- package/Components/ModalComponent/ActionsBottomSheet/boundActionButton.tsx +24 -0
- package/Components/ModalComponent/ActionsBottomSheet/index.ts +9 -0
- package/Components/ModalComponent/ActionsBottomSheet/openActionsBottomSheet.ts +61 -0
- package/Components/ModalComponent/AudioPlayer/Components/Action.tsx +33 -87
- package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +57 -74
- package/Components/ModalComponent/AudioPlayer/Components/Header.tsx +142 -107
- package/Components/ModalComponent/AudioPlayer/Components/Input.tsx +653 -0
- package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +427 -159
- package/Components/ModalComponent/AudioPlayer/Components/NowPlayingHeaderSection.tsx +89 -0
- package/Components/ModalComponent/AudioPlayer/Components/__tests__/Item.test.tsx +66 -0
- package/Components/ModalComponent/AudioPlayer/Components/index.ts +8 -4
- package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +230 -0
- package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +332 -0
- package/Components/ModalComponent/BottomSheetModalContent.tsx +379 -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/SortableList.web.tsx +102 -0
- package/Components/ModalComponent/TextInputContent.tsx +112 -0
- package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +238 -0
- package/Components/ModalComponent/__tests__/TextInputContent.test.tsx +156 -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 +90 -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 +82 -21
- package/Components/VideoLive/LiveImageManager.ts +8 -2
- package/Hooks/useEntryActionsExpander.ts +63 -0
- package/package.json +6 -5
- /package/Decorators/ZappPipesDataConnector/__tests__/{Hero.js → Hero.tsx} +0 -0
|
@@ -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,36 @@ export function defaultItemProps(
|
|
|
24
29
|
modal_bottom_sheet_item_padding_top,
|
|
25
30
|
} = config;
|
|
26
31
|
|
|
32
|
+
const bgDefault = blockItemStyle?.background?.default;
|
|
33
|
+
|
|
34
|
+
const bgFocused =
|
|
35
|
+
blockItemStyle?.background?.focused || blockItemStyle?.background?.focus;
|
|
36
|
+
|
|
27
37
|
return {
|
|
28
|
-
backgroundColor:
|
|
29
|
-
|
|
38
|
+
backgroundColor:
|
|
39
|
+
bgDefault?.backgroundColor || modal_bottom_sheet_item_background_color,
|
|
40
|
+
focusedBackgroundColor:
|
|
41
|
+
bgFocused?.backgroundColor ||
|
|
42
|
+
modal_bottom_sheet_item_focus_background_color,
|
|
30
43
|
selectedBackgroundColor: modal_bottom_sheet_item_selected_background_color,
|
|
31
44
|
focusedSelectedBackgroundColor:
|
|
32
45
|
modal_bottom_sheet_item_focused_selected_background_color,
|
|
33
|
-
borderRadius:
|
|
46
|
+
borderRadius: toNumberWithDefault(
|
|
47
|
+
modal_bottom_sheet_item_corner_radius,
|
|
48
|
+
bgDefault?.borderRadius
|
|
49
|
+
),
|
|
34
50
|
marginBottom: modal_bottom_sheet_item_margin_bottom,
|
|
35
51
|
marginTop: modal_bottom_sheet_item_margin_top,
|
|
36
52
|
marginLeft: modal_bottom_sheet_item_margin_left,
|
|
37
53
|
marginRight: modal_bottom_sheet_item_margin_right,
|
|
38
|
-
paddingTop:
|
|
39
|
-
|
|
54
|
+
paddingTop: toNumberWithDefault(
|
|
55
|
+
modal_bottom_sheet_item_padding_top,
|
|
56
|
+
bgDefault?.paddingTop
|
|
57
|
+
),
|
|
58
|
+
paddingBottom: toNumberWithDefault(
|
|
59
|
+
modal_bottom_sheet_item_padding_bottom,
|
|
60
|
+
bgDefault?.paddingBottom
|
|
61
|
+
),
|
|
40
62
|
paddingRight: modal_bottom_sheet_item_padding_right,
|
|
41
63
|
paddingLeft: modal_bottom_sheet_item_padding_left,
|
|
42
64
|
maxWidth,
|
|
@@ -45,7 +67,8 @@ export function defaultItemProps(
|
|
|
45
67
|
|
|
46
68
|
export function defaultItemLabelProps(
|
|
47
69
|
config: PluginConfiguration,
|
|
48
|
-
sheetWidth: number
|
|
70
|
+
sheetWidth: number,
|
|
71
|
+
blockItemStyle?: Record<string, any>
|
|
49
72
|
): ItemLabelProps {
|
|
50
73
|
const {
|
|
51
74
|
modal_bottom_sheet_item_label_android_letter_spacing,
|
|
@@ -72,15 +95,48 @@ export function defaultItemLabelProps(
|
|
|
72
95
|
modal_bottom_sheet_item_padding_right,
|
|
73
96
|
} = config;
|
|
74
97
|
|
|
75
|
-
const
|
|
98
|
+
const iconWidth = toNumberWithDefaultZero(modal_bottom_sheet_item_icon_width);
|
|
99
|
+
|
|
100
|
+
const iconMarginLeft = toNumberWithDefaultZero(
|
|
101
|
+
modal_bottom_sheet_item_icon_margin_left
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const iconMarginRight = toNumberWithDefaultZero(
|
|
105
|
+
modal_bottom_sheet_item_icon_margin_right
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const itemMarginLeft = toNumberWithDefaultZero(
|
|
109
|
+
modal_bottom_sheet_item_margin_left
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const itemMarginRight = toNumberWithDefaultZero(
|
|
113
|
+
modal_bottom_sheet_item_margin_right
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const itemPaddingLeft = toNumberWithDefaultZero(
|
|
117
|
+
modal_bottom_sheet_item_padding_left
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
const itemPaddingRight = toNumberWithDefaultZero(
|
|
121
|
+
modal_bottom_sheet_item_padding_right
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const calculatedMaxWidth =
|
|
76
125
|
sheetWidth -
|
|
77
|
-
(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
126
|
+
(iconWidth +
|
|
127
|
+
iconMarginLeft +
|
|
128
|
+
iconMarginRight +
|
|
129
|
+
itemMarginLeft +
|
|
130
|
+
itemMarginRight +
|
|
131
|
+
itemPaddingLeft +
|
|
132
|
+
itemPaddingRight);
|
|
133
|
+
|
|
134
|
+
const maxWidth =
|
|
135
|
+
Number.isNaN(calculatedMaxWidth) || calculatedMaxWidth <= 0
|
|
136
|
+
? sheetWidth
|
|
137
|
+
: calculatedMaxWidth;
|
|
138
|
+
|
|
139
|
+
const label1Default = blockItemStyle?.textLabel1?.default;
|
|
84
140
|
|
|
85
141
|
return {
|
|
86
142
|
fontFamily: platformSelect({
|
|
@@ -91,8 +147,11 @@ export function defaultItemLabelProps(
|
|
|
91
147
|
ios: modal_bottom_sheet_item_label_ios_letter_spacing,
|
|
92
148
|
android: modal_bottom_sheet_item_label_android_letter_spacing,
|
|
93
149
|
}),
|
|
94
|
-
fontSize:
|
|
95
|
-
|
|
150
|
+
fontSize: toNumberWithDefault(
|
|
151
|
+
modal_bottom_sheet_item_label_font_size,
|
|
152
|
+
label1Default?.fontSize
|
|
153
|
+
),
|
|
154
|
+
color: label1Default?.fontColor || modal_bottom_sheet_item_label_font_color,
|
|
96
155
|
focusColor: modal_bottom_sheet_item_label_focus_font_color,
|
|
97
156
|
hoverSelectedColor: modal_bottom_sheet_item_label_hover_selected_font_color,
|
|
98
157
|
selectedColor: modal_bottom_sheet_item_label_selected_font_color,
|
|
@@ -146,7 +205,8 @@ export function getItemLabelProps(
|
|
|
146
205
|
width: number,
|
|
147
206
|
labelProps?:
|
|
148
207
|
| ((theme: PluginConfiguration, width: number) => ItemLabelProps)
|
|
149
|
-
| ItemLabelProps
|
|
208
|
+
| ItemLabelProps,
|
|
209
|
+
blockItemStyle?: Record<string, any>
|
|
150
210
|
) {
|
|
151
211
|
if (labelProps) {
|
|
152
212
|
return typeof labelProps === "function"
|
|
@@ -154,7 +214,7 @@ export function getItemLabelProps(
|
|
|
154
214
|
: labelProps;
|
|
155
215
|
}
|
|
156
216
|
|
|
157
|
-
return defaultItemLabelProps(theme, width);
|
|
217
|
+
return defaultItemLabelProps(theme, width, blockItemStyle);
|
|
158
218
|
}
|
|
159
219
|
|
|
160
220
|
export function getItemProps(
|
|
@@ -162,7 +222,8 @@ export function getItemProps(
|
|
|
162
222
|
width: number,
|
|
163
223
|
itemProps?:
|
|
164
224
|
| ((theme: PluginConfiguration, width: number) => ItemProps)
|
|
165
|
-
| ItemProps
|
|
225
|
+
| ItemProps,
|
|
226
|
+
blockItemStyle?: Record<string, any>
|
|
166
227
|
) {
|
|
167
228
|
if (itemProps) {
|
|
168
229
|
return typeof itemProps === "function"
|
|
@@ -170,5 +231,5 @@ export function getItemProps(
|
|
|
170
231
|
: itemProps;
|
|
171
232
|
}
|
|
172
233
|
|
|
173
|
-
return defaultItemProps(theme, width);
|
|
234
|
+
return defaultItemProps(theme, width, blockItemStyle);
|
|
174
235
|
}
|
|
@@ -213,10 +213,16 @@ export class LiveImageManager implements PlayerLifecycleListener {
|
|
|
213
213
|
log_debug(
|
|
214
214
|
`pauseItem: live-image not ready, ${item.playerId} - ${item.tag}`
|
|
215
215
|
);
|
|
216
|
-
} else {
|
|
217
|
-
item.player.pause();
|
|
218
216
|
}
|
|
219
217
|
|
|
218
|
+
// Pause even when the player is not ready yet: the underlying player may
|
|
219
|
+
// still be loading and would otherwise start playing on its own once it
|
|
220
|
+
// has buffered, leaving the live-image audible underneath the primary
|
|
221
|
+
// player. Note this is best effort - the web controller's pause() only
|
|
222
|
+
// logs while the player component is unmounted - so the player itself also
|
|
223
|
+
// refuses buffer-driven starts when it was never asked to play.
|
|
224
|
+
item.player.pause();
|
|
225
|
+
|
|
220
226
|
// Fake close event, because we unmount native view
|
|
221
227
|
item.player.onPlayerClose();
|
|
222
228
|
item.setMode?.(LiveImageType.Image);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { ActionExecutorContext } from "@applicaster/zapp-react-native-utils/actionsExecutor/ActionExecutorContext";
|
|
4
|
+
import {
|
|
5
|
+
buildEntryActions,
|
|
6
|
+
EntryActionDeps,
|
|
7
|
+
} from "@applicaster/zapp-react-native-utils/entryActions";
|
|
8
|
+
import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
9
|
+
import { useScreenStateStore } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useScreenStateStore";
|
|
10
|
+
import {
|
|
11
|
+
useCurrentScreenData,
|
|
12
|
+
useScreenContext,
|
|
13
|
+
} from "@applicaster/zapp-react-native-utils/reactHooks/screen";
|
|
14
|
+
import { RegisteredAction } from "@applicaster/zapp-react-native-utils/uiActionsRegistrator";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Expands `entry.extensions.entry_action` into invokable actions, against the
|
|
18
|
+
* screen this hook is called from.
|
|
19
|
+
*
|
|
20
|
+
* Entry actions are data on the entry, not an installed capability, so there is
|
|
21
|
+
* nothing to look up by identifier: the surface showing the entry expands them.
|
|
22
|
+
* That also decides which screen they execute against — the one whose tree this
|
|
23
|
+
* hook runs in, rather than whichever screen happened to be current when a
|
|
24
|
+
* global provider was registered.
|
|
25
|
+
*
|
|
26
|
+
* Pass the result to `resolveActionIdentifiers` / `resolvePlayerActions` as
|
|
27
|
+
* `expandEntryActions`.
|
|
28
|
+
*/
|
|
29
|
+
export function useEntryActionsExpander(): (
|
|
30
|
+
entry: ZappEntry | ZappFeed
|
|
31
|
+
) => RegisteredAction[] {
|
|
32
|
+
const { pathname } = useRoute();
|
|
33
|
+
|
|
34
|
+
const screenContext = useScreenContext();
|
|
35
|
+
const screenData = useCurrentScreenData();
|
|
36
|
+
const screenState = screenContext?.options;
|
|
37
|
+
const screenStateStore = useScreenStateStore();
|
|
38
|
+
const actionExecutor = React.useContext(ActionExecutorContext);
|
|
39
|
+
|
|
40
|
+
// Read through a ref so the returned expander keeps a stable identity: it
|
|
41
|
+
// feeds `useMemo` dependency lists on surfaces that re-resolve their actions
|
|
42
|
+
// on every registry change.
|
|
43
|
+
const depsRef = React.useRef<EntryActionDeps>();
|
|
44
|
+
|
|
45
|
+
depsRef.current = {
|
|
46
|
+
actionExecutor,
|
|
47
|
+
actionContext: {
|
|
48
|
+
screenData,
|
|
49
|
+
screenState,
|
|
50
|
+
screenRoute: pathname,
|
|
51
|
+
screenStateStore,
|
|
52
|
+
// From the screen context, the way `useCellClick` builds the same bag.
|
|
53
|
+
// The ZappPipes entry context is a route-keyed map, so reading `.data`
|
|
54
|
+
// off it was always undefined.
|
|
55
|
+
screenEntry: screenContext?.entry,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return React.useCallback(
|
|
60
|
+
(entry: ZappEntry | ZappFeed) => buildEntryActions(entry, depsRef.current),
|
|
61
|
+
[]
|
|
62
|
+
);
|
|
63
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "15.1.
|
|
3
|
+
"version": "15.1.15-alpha.4236143002",
|
|
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": "15.1.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "15.1.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "15.1.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "15.1.
|
|
31
|
+
"@applicaster/applicaster-types": "15.1.15-alpha.4236143002",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "15.1.15-alpha.4236143002",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "15.1.15-alpha.4236143002",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "15.1.15-alpha.4236143002",
|
|
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
|