@applicaster/zapp-react-native-ui-components 16.0.0-alpha.1263110541 → 16.0.0-alpha.1334507601
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/GeneralContentScreen/GeneralContentScreenHookAdapter.tsx +15 -0
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +5 -1
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/ActionButtonController.tsx +19 -4
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/__tests__/ActionButtonController.test.tsx +43 -1
- package/Components/MasterCell/DefaultComponents/Button.tsx +1 -0
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/factory.test.ts +32 -0
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +1 -2
- package/Components/ModalComponent/ActionsBottomSheet/ActionButton.tsx +4 -2
- package/Components/ModalComponent/ActionsBottomSheet/__tests__/openActionsBottomSheet.test.ts +38 -0
- package/Components/ModalComponent/ActionsBottomSheet/boundActionButton.tsx +5 -2
- package/Components/ModalComponent/ActionsBottomSheet/openActionsBottomSheet.ts +4 -1
- package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +70 -73
- package/Components/ModalComponent/AudioPlayer/Components/Header.tsx +1 -36
- package/Components/ModalComponent/AudioPlayer/Components/Input.tsx +1 -26
- package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +180 -47
- package/Components/ModalComponent/AudioPlayer/Components/NowPlayingHeaderSection.tsx +13 -20
- package/Components/ModalComponent/AudioPlayer/Components/__tests__/Item.test.tsx +113 -0
- package/Components/ModalComponent/AudioPlayer/Components/index.ts +0 -2
- package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +248 -0
- package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +194 -19
- package/Components/ModalComponent/BottomSheetModalContent.tsx +94 -66
- package/Components/ModalComponent/Header/CloseButton.tsx +12 -0
- package/Components/ModalComponent/Header/__tests__/CloseButton.test.tsx +72 -0
- package/Components/ModalComponent/SortableList.tsx +38 -23
- package/Components/ModalComponent/SortableList.web.tsx +1 -1
- package/Components/ModalComponent/TextInputContent.tsx +15 -3
- package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +37 -5
- package/Components/ModalComponent/__tests__/TextInputContent.test.tsx +36 -0
- package/Components/ModalComponent/index.tsx +7 -9
- package/Components/ModalComponent/presets/__tests__/getCell.test.ts +24 -0
- package/Components/ModalComponent/presets/dynamicCollectionCell.tsx +1 -1
- package/Components/ModalComponent/presets/selectableCell.tsx +1 -1
- package/Components/ModalComponent/utils.ts +6 -1
- package/Components/OfflineHandler/hooks.ts +0 -12
- package/Components/River/ComponentsMap/ComponentsMap.tsx +85 -59
- package/Components/River/River.tsx +4 -0
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +138 -75
- package/Components/River/__tests__/componentsMap.test.js +8 -3
- package/Components/River/__tests__/resultCallback.test.tsx +47 -0
- package/Components/Screen/__tests__/Screen.test.tsx +24 -0
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -0
- package/Components/Screen/index.tsx +5 -0
- package/Components/Screen/navigationHandler.ts +8 -8
- package/Components/ScreenRevealManager/ScreenRevealManager.ts +18 -2
- package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +36 -0
- package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +56 -0
- package/Components/ScreenRevealManager/withScreenRevealManager.tsx +21 -4
- package/Contexts/ModalNavigationContext/__tests__/index.test.tsx +15 -0
- package/Contexts/ModalNavigationContext/index.tsx +2 -2
- package/package.json +5 -5
- package/Components/ModalComponent/AudioPlayer/Components/Action.tsx +0 -314
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mergeItemConfiguration,
|
|
3
|
+
mergeButtonConfiguration,
|
|
4
|
+
} from "../mergeStyles";
|
|
5
|
+
|
|
6
|
+
const base = {
|
|
7
|
+
background: {
|
|
8
|
+
defaultColor: "transparent",
|
|
9
|
+
focusedColor: "rgba(62, 62, 62, 1)",
|
|
10
|
+
cornerRadius: 12,
|
|
11
|
+
},
|
|
12
|
+
image: {
|
|
13
|
+
width: 48,
|
|
14
|
+
height: 48,
|
|
15
|
+
borderWidth: 1,
|
|
16
|
+
borderColor: "rgba(255, 255, 255, 0.1)",
|
|
17
|
+
cornerRadius: 6,
|
|
18
|
+
},
|
|
19
|
+
nowPlayingAsset: {},
|
|
20
|
+
nowPlayingLabel: { fontColor: "#fff", fontSize: 12 },
|
|
21
|
+
textLabel1: { fontColor: "#fff", fontSize: 15 },
|
|
22
|
+
textLabel2: { fontColor: "#999", fontSize: 13 },
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
describe("mergeItemConfiguration background", () => {
|
|
26
|
+
it("applies Studio focus background to focusedColor", () => {
|
|
27
|
+
const merged = mergeItemConfiguration(base as any, {
|
|
28
|
+
background: {
|
|
29
|
+
default: { backgroundColor: "transparent" },
|
|
30
|
+
focused: { backgroundColor: "#FF3B30" },
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
expect(merged.background.defaultColor).toBe("transparent");
|
|
35
|
+
expect(merged.background.focusedColor).toBe("#FF3B30");
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("accepts focus alias bucket from parser output", () => {
|
|
39
|
+
const merged = mergeItemConfiguration(base as any, {
|
|
40
|
+
background: {
|
|
41
|
+
default: { backgroundColor: "transparent" },
|
|
42
|
+
focus: { backgroundColor: "#00FF66" },
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
expect(merged.background.focusedColor).toBe("#00FF66");
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("merges text label lineHeight from Studio keys", () => {
|
|
50
|
+
const merged = mergeItemConfiguration(base as any, {
|
|
51
|
+
textLabel1: {
|
|
52
|
+
default: { fontSize: 28, lineHeight: 40 },
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
expect(merged.textLabel1.fontSize).toBe(28);
|
|
57
|
+
expect(merged.textLabel1.lineHeight).toBe(40);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("does not merge Studio item background padding (white spec field)", () => {
|
|
61
|
+
const merged = mergeItemConfiguration(base as any, {
|
|
62
|
+
background: {
|
|
63
|
+
default: {
|
|
64
|
+
backgroundColor: "#2E7D32",
|
|
65
|
+
paddingTop: 32,
|
|
66
|
+
paddingBottom: 32,
|
|
67
|
+
paddingLeft: 40,
|
|
68
|
+
paddingRight: 40,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
expect(merged.background.defaultColor).toBe("#2E7D32");
|
|
74
|
+
expect(merged.background.paddingTop).toBeUndefined();
|
|
75
|
+
expect(merged.background.paddingBottom).toBeUndefined();
|
|
76
|
+
expect(merged.background.paddingLeft).toBeUndefined();
|
|
77
|
+
expect(merged.background.paddingRight).toBeUndefined();
|
|
78
|
+
expect(merged.background.focusedColor).toBe("rgba(62, 62, 62, 1)");
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("preserves base focusedColor when only default background is set", () => {
|
|
82
|
+
const merged = mergeItemConfiguration(base as any, {
|
|
83
|
+
background: {
|
|
84
|
+
default: { backgroundColor: "#2E7D32" },
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
expect(merged.background.defaultColor).toBe("#2E7D32");
|
|
89
|
+
expect(merged.background.focusedColor).toBe("rgba(62, 62, 62, 1)");
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("applies Studio checkbox assets onto checkboxAssets", () => {
|
|
93
|
+
const merged = mergeItemConfiguration(base as any, {
|
|
94
|
+
checkbox: {
|
|
95
|
+
default: {
|
|
96
|
+
asset: "https://placehold.co/24x24/FF3B30/FFFFFF/png?text=CB",
|
|
97
|
+
checkedAsset: "https://placehold.co/24x24/FFD60A/000000/png?text=CK",
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
expect(merged.checkboxAssets?.asset).toBe(
|
|
103
|
+
"https://placehold.co/24x24/FF3B30/FFFFFF/png?text=CB"
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
expect(merged.checkboxAssets?.checkedAsset).toBe(
|
|
107
|
+
"https://placehold.co/24x24/FFD60A/000000/png?text=CK"
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("applies Studio reorder/remove assets onto actionButtonAssets", () => {
|
|
112
|
+
const merged = mergeItemConfiguration(base as any, {
|
|
113
|
+
actionButtons: {
|
|
114
|
+
default: {
|
|
115
|
+
removeAsset: "https://placehold.co/24x24/00FF00/000000/png?text=RM",
|
|
116
|
+
dragAsset: "https://placehold.co/24x24/FF3B30/FFFFFF/png?text=RH",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
expect(merged.actionButtonAssets?.removeAsset).toBe(
|
|
122
|
+
"https://placehold.co/24x24/00FF00/000000/png?text=RM"
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
expect(merged.actionButtonAssets?.dragAsset).toBe(
|
|
126
|
+
"https://placehold.co/24x24/FF3B30/FFFFFF/png?text=RH"
|
|
127
|
+
);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
describe("mergeButtonConfiguration background", () => {
|
|
132
|
+
const buttonBase = {
|
|
133
|
+
background: {
|
|
134
|
+
defaultColor: "#FFFFFF",
|
|
135
|
+
focusedColor: "#E0E0E0",
|
|
136
|
+
inactiveColor: "#CCCCCC",
|
|
137
|
+
cornerRadius: 12,
|
|
138
|
+
paddingTop: 12,
|
|
139
|
+
paddingRight: 12,
|
|
140
|
+
paddingBottom: 12,
|
|
141
|
+
paddingLeft: 12,
|
|
142
|
+
horizontalGutter: 8,
|
|
143
|
+
},
|
|
144
|
+
title: {
|
|
145
|
+
fontColor: "#000000",
|
|
146
|
+
focusedFontColor: "#000000",
|
|
147
|
+
inactiveFontColor: "#666666",
|
|
148
|
+
iosFontFamily: "SFProText-Semibold",
|
|
149
|
+
androidFontFamily: "Roboto-Medium",
|
|
150
|
+
fontSize: 15,
|
|
151
|
+
lineHeight: 24,
|
|
152
|
+
iosLetterSpacing: 0,
|
|
153
|
+
androidLetterSpacing: 0,
|
|
154
|
+
textTransform: "default" as const,
|
|
155
|
+
},
|
|
156
|
+
icons: {
|
|
157
|
+
width: 24,
|
|
158
|
+
height: 24,
|
|
159
|
+
leadingIcon: { enabled: true },
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
it("applies Studio button focus background to focusedColor", () => {
|
|
164
|
+
const merged = mergeButtonConfiguration(buttonBase as any, {
|
|
165
|
+
background: {
|
|
166
|
+
default: { backgroundColor: "#FFFFFF" },
|
|
167
|
+
focused: { backgroundColor: "#00FF00" },
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
expect(merged.background.defaultColor).toBe("#FFFFFF");
|
|
172
|
+
expect(merged.background.focusedColor).toBe("#00FF00");
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it("applies Studio button title lineHeight", () => {
|
|
176
|
+
const merged = mergeButtonConfiguration(buttonBase as any, {
|
|
177
|
+
title: {
|
|
178
|
+
default: { fontColor: "#000000", fontSize: 15, lineHeight: 40 },
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
expect(merged.title.lineHeight).toBe(40);
|
|
183
|
+
expect(merged.title.fontSize).toBe(15);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it("applies Studio button background padding", () => {
|
|
187
|
+
const merged = mergeButtonConfiguration(buttonBase as any, {
|
|
188
|
+
background: {
|
|
189
|
+
default: {
|
|
190
|
+
backgroundColor: "#FFFFFF",
|
|
191
|
+
paddingTop: 32,
|
|
192
|
+
paddingRight: 20,
|
|
193
|
+
paddingBottom: 8,
|
|
194
|
+
paddingLeft: 4,
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
expect(merged.background.paddingTop).toBe(32);
|
|
200
|
+
expect(merged.background.paddingRight).toBe(20);
|
|
201
|
+
expect(merged.background.paddingBottom).toBe(8);
|
|
202
|
+
expect(merged.background.paddingLeft).toBe(4);
|
|
203
|
+
expect(merged.background.focusedColor).toBe("#E0E0E0");
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it("preserves base button focusedColor when only default background is set", () => {
|
|
207
|
+
const merged = mergeButtonConfiguration(buttonBase as any, {
|
|
208
|
+
background: {
|
|
209
|
+
default: { backgroundColor: "#ABCDEF" },
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
expect(merged.background.defaultColor).toBe("#ABCDEF");
|
|
214
|
+
expect(merged.background.focusedColor).toBe("#E0E0E0");
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it("applies Studio create-new leading icon asset", () => {
|
|
218
|
+
const merged = mergeButtonConfiguration(buttonBase as any, {
|
|
219
|
+
leadingIcon: {
|
|
220
|
+
default: {
|
|
221
|
+
asset: "https://placehold.co/24x24/FF00FF/FFFFFF/png?text=CN",
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
expect(merged.icons.leadingIcon.asset).toBe(
|
|
227
|
+
"https://placehold.co/24x24/FF00FF/FFFFFF/png?text=CN"
|
|
228
|
+
);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it("applies Studio button title typography (fontFamily, letterSpacing, textTransform)", () => {
|
|
232
|
+
const merged = mergeButtonConfiguration(buttonBase as any, {
|
|
233
|
+
title: {
|
|
234
|
+
default: {
|
|
235
|
+
fontFamily: "CustomFont",
|
|
236
|
+
letterSpacing: -0.5,
|
|
237
|
+
textTransform: "uppercase",
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
expect(merged.title.iosFontFamily).toBe("CustomFont");
|
|
243
|
+
expect(merged.title.androidFontFamily).toBe("CustomFont");
|
|
244
|
+
expect(merged.title.iosLetterSpacing).toBe(-0.5);
|
|
245
|
+
expect(merged.title.androidLetterSpacing).toBe(-0.5);
|
|
246
|
+
expect(merged.title.textTransform).toBe("uppercase");
|
|
247
|
+
});
|
|
248
|
+
});
|
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
ImageConfiguration as ItemImageConfiguration,
|
|
4
4
|
LabelConfiguration as ItemLabelConfiguration,
|
|
5
5
|
NowPlayingAssetConfiguration as ItemNowPlayingAssetConfiguration,
|
|
6
|
+
CheckboxAssetsConfiguration as ItemCheckboxAssetsConfiguration,
|
|
7
|
+
ActionButtonAssetsConfiguration as ItemActionButtonAssetsConfiguration,
|
|
6
8
|
ItemConfiguration,
|
|
7
9
|
} from "../Components/Item";
|
|
8
10
|
import {
|
|
@@ -21,20 +23,27 @@ import {
|
|
|
21
23
|
|
|
22
24
|
function mergeItemBackground(
|
|
23
25
|
base: ItemBackgroundConfiguration,
|
|
24
|
-
|
|
26
|
+
defaultOverride?: Record<string, any>,
|
|
27
|
+
focusedOverride?: Record<string, any>
|
|
25
28
|
): ItemBackgroundConfiguration {
|
|
26
|
-
if (!
|
|
29
|
+
if (!defaultOverride && !focusedOverride) return base;
|
|
30
|
+
|
|
31
|
+
// Only take focused color from the focused/pressed bucket (or legacy
|
|
32
|
+
// mis-parsed focus* aliases). Never fall back to default background —
|
|
33
|
+
// that would overwrite base.focusedColor whenever Studio only sets default.
|
|
34
|
+
const focusedColor =
|
|
35
|
+
focusedOverride?.backgroundColor ??
|
|
36
|
+
defaultOverride?.focusColor ??
|
|
37
|
+
defaultOverride?.focusBackgroundColor;
|
|
27
38
|
|
|
28
39
|
return {
|
|
29
40
|
...base,
|
|
30
|
-
...(
|
|
31
|
-
? { defaultColor:
|
|
32
|
-
: {}),
|
|
33
|
-
...(override.focusColor || override.backgroundColor
|
|
34
|
-
? { focusedColor: override.focusColor || override.backgroundColor }
|
|
41
|
+
...(defaultOverride?.backgroundColor
|
|
42
|
+
? { defaultColor: defaultOverride.backgroundColor }
|
|
35
43
|
: {}),
|
|
36
|
-
...(
|
|
37
|
-
|
|
44
|
+
...(focusedColor != null && focusedColor !== "" ? { focusedColor } : {}),
|
|
45
|
+
...(defaultOverride?.borderRadius !== undefined
|
|
46
|
+
? { cornerRadius: defaultOverride.borderRadius }
|
|
38
47
|
: {}),
|
|
39
48
|
};
|
|
40
49
|
}
|
|
@@ -69,6 +78,36 @@ function mergeItemLabel(
|
|
|
69
78
|
...base,
|
|
70
79
|
...(override.fontColor ? { fontColor: override.fontColor } : {}),
|
|
71
80
|
...(override.fontSize !== undefined ? { fontSize: override.fontSize } : {}),
|
|
81
|
+
...(override.lineHeight !== undefined
|
|
82
|
+
? { lineHeight: override.lineHeight }
|
|
83
|
+
: {}),
|
|
84
|
+
...(override.fontFamily
|
|
85
|
+
? {
|
|
86
|
+
iosFontFamily: override.fontFamily,
|
|
87
|
+
androidFontFamily: override.fontFamily,
|
|
88
|
+
}
|
|
89
|
+
: {}),
|
|
90
|
+
...(override.iosFontFamily
|
|
91
|
+
? { iosFontFamily: override.iosFontFamily }
|
|
92
|
+
: {}),
|
|
93
|
+
...(override.androidFontFamily
|
|
94
|
+
? { androidFontFamily: override.androidFontFamily }
|
|
95
|
+
: {}),
|
|
96
|
+
...(override.letterSpacing !== undefined
|
|
97
|
+
? {
|
|
98
|
+
iosLetterSpacing: override.letterSpacing,
|
|
99
|
+
androidLetterSpacing: override.letterSpacing,
|
|
100
|
+
}
|
|
101
|
+
: {}),
|
|
102
|
+
...(override.iosLetterSpacing !== undefined
|
|
103
|
+
? { iosLetterSpacing: override.iosLetterSpacing }
|
|
104
|
+
: {}),
|
|
105
|
+
...(override.androidLetterSpacing !== undefined
|
|
106
|
+
? { androidLetterSpacing: override.androidLetterSpacing }
|
|
107
|
+
: {}),
|
|
108
|
+
...(override.textTransform
|
|
109
|
+
? { textTransform: override.textTransform }
|
|
110
|
+
: {}),
|
|
72
111
|
};
|
|
73
112
|
}
|
|
74
113
|
|
|
@@ -84,13 +123,45 @@ function mergeItemNowPlayingAsset(
|
|
|
84
123
|
};
|
|
85
124
|
}
|
|
86
125
|
|
|
126
|
+
function mergeItemCheckboxAssets(
|
|
127
|
+
base: ItemCheckboxAssetsConfiguration,
|
|
128
|
+
override?: Record<string, any>
|
|
129
|
+
): ItemCheckboxAssetsConfiguration {
|
|
130
|
+
if (!override) return base;
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
...base,
|
|
134
|
+
...(override.asset ? { asset: override.asset } : {}),
|
|
135
|
+
...(override.checkedAsset ? { checkedAsset: override.checkedAsset } : {}),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function mergeItemActionButtonAssets(
|
|
140
|
+
base: ItemActionButtonAssetsConfiguration,
|
|
141
|
+
override?: Record<string, any>
|
|
142
|
+
): ItemActionButtonAssetsConfiguration {
|
|
143
|
+
if (!override) return base;
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
...base,
|
|
147
|
+
...(override.removeAsset ? { removeAsset: override.removeAsset } : {}),
|
|
148
|
+
...(override.dragAsset ? { dragAsset: override.dragAsset } : {}),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
87
152
|
export function mergeItemConfiguration(
|
|
88
153
|
base: ItemConfiguration,
|
|
89
154
|
itemBlock?: Record<string, any>
|
|
90
155
|
): ItemConfiguration {
|
|
91
156
|
if (!itemBlock) return base;
|
|
92
157
|
|
|
93
|
-
const
|
|
158
|
+
const bgDefault = itemBlock.background?.default || itemBlock.background;
|
|
159
|
+
|
|
160
|
+
const bgFocused =
|
|
161
|
+
itemBlock.background?.focused ||
|
|
162
|
+
itemBlock.background?.focus ||
|
|
163
|
+
itemBlock.background?.pressed;
|
|
164
|
+
|
|
94
165
|
const img = itemBlock.image?.default || itemBlock.image;
|
|
95
166
|
const label1 = itemBlock.textLabel1?.default || itemBlock.textLabel1;
|
|
96
167
|
const label2 = itemBlock.textLabel2?.default || itemBlock.textLabel2;
|
|
@@ -101,14 +172,27 @@ export function mergeItemConfiguration(
|
|
|
101
172
|
const npAsset =
|
|
102
173
|
itemBlock.nowPlayingAsset?.default || itemBlock.nowPlayingAsset;
|
|
103
174
|
|
|
175
|
+
const checkbox = itemBlock.checkbox?.default || itemBlock.checkbox;
|
|
176
|
+
|
|
177
|
+
const actionButtons =
|
|
178
|
+
itemBlock.actionButtons?.default || itemBlock.actionButtons;
|
|
179
|
+
|
|
104
180
|
return {
|
|
105
181
|
...base,
|
|
106
|
-
background: mergeItemBackground(base.background,
|
|
182
|
+
background: mergeItemBackground(base.background, bgDefault, bgFocused),
|
|
107
183
|
image: mergeItemImage(base.image, img),
|
|
108
184
|
textLabel1: mergeItemLabel(base.textLabel1, label1),
|
|
109
185
|
textLabel2: mergeItemLabel(base.textLabel2, label2),
|
|
110
186
|
nowPlayingLabel: mergeItemLabel(base.nowPlayingLabel, npLabel),
|
|
111
187
|
nowPlayingAsset: mergeItemNowPlayingAsset(base.nowPlayingAsset, npAsset),
|
|
188
|
+
checkboxAssets: mergeItemCheckboxAssets(
|
|
189
|
+
base.checkboxAssets || {},
|
|
190
|
+
checkbox
|
|
191
|
+
),
|
|
192
|
+
actionButtonAssets: mergeItemActionButtonAssets(
|
|
193
|
+
base.actionButtonAssets || {},
|
|
194
|
+
actionButtons
|
|
195
|
+
),
|
|
112
196
|
};
|
|
113
197
|
}
|
|
114
198
|
|
|
@@ -150,17 +234,37 @@ export function mergeHeaderConfiguration(
|
|
|
150
234
|
|
|
151
235
|
function mergeButtonBackground(
|
|
152
236
|
base: ButtonBackgroundConfiguration,
|
|
153
|
-
|
|
237
|
+
defaultOverride?: Record<string, any>,
|
|
238
|
+
focusedOverride?: Record<string, any>
|
|
154
239
|
): ButtonBackgroundConfiguration {
|
|
155
|
-
if (!
|
|
240
|
+
if (!defaultOverride && !focusedOverride) return base;
|
|
241
|
+
|
|
242
|
+
// Same as mergeItemBackground: do not use default background as focusedColor.
|
|
243
|
+
const focusedColor =
|
|
244
|
+
focusedOverride?.backgroundColor ??
|
|
245
|
+
defaultOverride?.focusColor ??
|
|
246
|
+
defaultOverride?.focusBackgroundColor;
|
|
156
247
|
|
|
157
248
|
return {
|
|
158
249
|
...base,
|
|
159
|
-
...(
|
|
160
|
-
? { defaultColor:
|
|
250
|
+
...(defaultOverride?.backgroundColor
|
|
251
|
+
? { defaultColor: defaultOverride.backgroundColor }
|
|
161
252
|
: {}),
|
|
162
|
-
...(
|
|
163
|
-
|
|
253
|
+
...(focusedColor != null && focusedColor !== "" ? { focusedColor } : {}),
|
|
254
|
+
...(defaultOverride?.borderRadius !== undefined
|
|
255
|
+
? { cornerRadius: defaultOverride.borderRadius }
|
|
256
|
+
: {}),
|
|
257
|
+
...(defaultOverride?.paddingTop !== undefined
|
|
258
|
+
? { paddingTop: defaultOverride.paddingTop }
|
|
259
|
+
: {}),
|
|
260
|
+
...(defaultOverride?.paddingRight !== undefined
|
|
261
|
+
? { paddingRight: defaultOverride.paddingRight }
|
|
262
|
+
: {}),
|
|
263
|
+
...(defaultOverride?.paddingBottom !== undefined
|
|
264
|
+
? { paddingBottom: defaultOverride.paddingBottom }
|
|
265
|
+
: {}),
|
|
266
|
+
...(defaultOverride?.paddingLeft !== undefined
|
|
267
|
+
? { paddingLeft: defaultOverride.paddingLeft }
|
|
164
268
|
: {}),
|
|
165
269
|
};
|
|
166
270
|
}
|
|
@@ -175,6 +279,65 @@ function mergeButtonTitle(
|
|
|
175
279
|
...base,
|
|
176
280
|
...(override.fontColor ? { fontColor: override.fontColor } : {}),
|
|
177
281
|
...(override.fontSize !== undefined ? { fontSize: override.fontSize } : {}),
|
|
282
|
+
...(override.lineHeight !== undefined
|
|
283
|
+
? { lineHeight: override.lineHeight }
|
|
284
|
+
: {}),
|
|
285
|
+
...(override.fontFamily
|
|
286
|
+
? {
|
|
287
|
+
iosFontFamily: override.fontFamily,
|
|
288
|
+
androidFontFamily: override.fontFamily,
|
|
289
|
+
}
|
|
290
|
+
: {}),
|
|
291
|
+
...(override.iosFontFamily
|
|
292
|
+
? { iosFontFamily: override.iosFontFamily }
|
|
293
|
+
: {}),
|
|
294
|
+
...(override.androidFontFamily
|
|
295
|
+
? { androidFontFamily: override.androidFontFamily }
|
|
296
|
+
: {}),
|
|
297
|
+
...(override.letterSpacing !== undefined
|
|
298
|
+
? {
|
|
299
|
+
iosLetterSpacing: override.letterSpacing,
|
|
300
|
+
androidLetterSpacing: override.letterSpacing,
|
|
301
|
+
}
|
|
302
|
+
: {}),
|
|
303
|
+
...(override.iosLetterSpacing !== undefined
|
|
304
|
+
? { iosLetterSpacing: override.iosLetterSpacing }
|
|
305
|
+
: {}),
|
|
306
|
+
...(override.androidLetterSpacing !== undefined
|
|
307
|
+
? { androidLetterSpacing: override.androidLetterSpacing }
|
|
308
|
+
: {}),
|
|
309
|
+
...(override.textTransform
|
|
310
|
+
? { textTransform: override.textTransform }
|
|
311
|
+
: {}),
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function mergeButtonIcons(
|
|
316
|
+
base: ButtonConfiguration["icons"],
|
|
317
|
+
iconsOverride?: Record<string, any>,
|
|
318
|
+
leadingOverride?: Record<string, any>
|
|
319
|
+
): ButtonConfiguration["icons"] {
|
|
320
|
+
if (!iconsOverride && !leadingOverride) return base;
|
|
321
|
+
|
|
322
|
+
const iconsDefault = iconsOverride?.default || iconsOverride;
|
|
323
|
+
const leadingDefault = leadingOverride?.default || leadingOverride;
|
|
324
|
+
|
|
325
|
+
return {
|
|
326
|
+
...base,
|
|
327
|
+
...(iconsDefault?.width !== undefined ? { width: iconsDefault.width } : {}),
|
|
328
|
+
...(iconsDefault?.height !== undefined
|
|
329
|
+
? { height: iconsDefault.height }
|
|
330
|
+
: {}),
|
|
331
|
+
leadingIcon: {
|
|
332
|
+
...base.leadingIcon,
|
|
333
|
+
...(leadingDefault?.enabled !== undefined
|
|
334
|
+
? { enabled: leadingDefault.enabled }
|
|
335
|
+
: {}),
|
|
336
|
+
...(leadingDefault?.actionType
|
|
337
|
+
? { actionType: leadingDefault.actionType }
|
|
338
|
+
: {}),
|
|
339
|
+
...(leadingDefault?.asset ? { asset: leadingDefault.asset } : {}),
|
|
340
|
+
},
|
|
178
341
|
};
|
|
179
342
|
}
|
|
180
343
|
|
|
@@ -185,15 +348,27 @@ export function mergeButtonConfiguration(
|
|
|
185
348
|
): ButtonConfiguration {
|
|
186
349
|
if (!buttonBlock && !actionBlock) return base;
|
|
187
350
|
|
|
188
|
-
const
|
|
351
|
+
const bgDefault =
|
|
189
352
|
buttonBlock?.background?.default || actionBlock?.background?.default;
|
|
190
353
|
|
|
354
|
+
const bgFocused =
|
|
355
|
+
buttonBlock?.background?.focused ||
|
|
356
|
+
buttonBlock?.background?.focus ||
|
|
357
|
+
actionBlock?.background?.focused ||
|
|
358
|
+
actionBlock?.background?.focus ||
|
|
359
|
+
buttonBlock?.background?.pressed ||
|
|
360
|
+
actionBlock?.background?.pressed;
|
|
361
|
+
|
|
191
362
|
const titleOverride =
|
|
192
363
|
buttonBlock?.title?.default || actionBlock?.title?.default;
|
|
193
364
|
|
|
365
|
+
const iconsOverride = buttonBlock?.icons || actionBlock?.icons;
|
|
366
|
+
const leadingOverride = buttonBlock?.leadingIcon || actionBlock?.leadingIcon;
|
|
367
|
+
|
|
194
368
|
return {
|
|
195
369
|
...base,
|
|
196
|
-
background: mergeButtonBackground(base.background,
|
|
370
|
+
background: mergeButtonBackground(base.background, bgDefault, bgFocused),
|
|
197
371
|
title: mergeButtonTitle(base.title, titleOverride),
|
|
372
|
+
icons: mergeButtonIcons(base.icons, iconsOverride, leadingOverride),
|
|
198
373
|
};
|
|
199
374
|
}
|