@applicaster/zapp-react-native-ui-components 16.0.0-alpha.6861239588 → 16.0.0-alpha.6918106967

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.
Files changed (83) hide show
  1. package/Components/AudioPlayer/tv/__tests__/audioPlayer.test.js +19 -0
  2. package/Components/AudioPlayer/tv/__tests__/index.test.tsx +120 -0
  3. package/Components/AudioPlayer/tv/index.tsx +5 -1
  4. package/Components/Cell/Cell.tsx +3 -6
  5. package/Components/Cell/TvOSCellComponent.tsx +0 -1
  6. package/Components/GeneralContentScreen/GeneralContentScreenHookAdapter.tsx +15 -0
  7. package/Components/GeneralContentScreen/hookAdapter/__tests__/skipExpression.test.ts +294 -0
  8. package/Components/GeneralContentScreen/hookAdapter/__tests__/validationHelper.test.ts +64 -0
  9. package/Components/GeneralContentScreen/hookAdapter/skipExpression.ts +252 -0
  10. package/Components/GeneralContentScreen/hookAdapter/validationHelper.ts +18 -0
  11. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +1 -0
  12. package/Components/MasterCell/DefaultComponents/Button.tsx +1 -0
  13. package/Components/MasterCell/DefaultComponents/Image/hoc/utils/__tests__/withDimensions.test.ts +420 -125
  14. package/Components/MasterCell/DefaultComponents/Image/hoc/utils/index.ts +114 -19
  15. package/Components/MasterCell/DefaultComponents/Image/hoc/withDimensions.tsx +19 -8
  16. package/Components/MasterCell/DefaultComponents/Toggle.tsx +36 -14
  17. package/Components/MasterCell/DefaultComponents/__tests__/Toggle.test.tsx +167 -0
  18. package/Components/ModalComponent/ActionsBottomSheet/ActionButton.tsx +54 -0
  19. package/Components/ModalComponent/ActionsBottomSheet/boundActionButton.tsx +21 -0
  20. package/Components/ModalComponent/ActionsBottomSheet/index.ts +9 -0
  21. package/Components/ModalComponent/ActionsBottomSheet/openActionsBottomSheet.ts +58 -0
  22. package/Components/ModalComponent/AudioPlayer/Components/Action.tsx +0 -18
  23. package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +32 -27
  24. package/Components/ModalComponent/AudioPlayer/Components/Header.tsx +25 -73
  25. package/Components/ModalComponent/AudioPlayer/Components/Input.tsx +0 -18
  26. package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +166 -84
  27. package/Components/ModalComponent/AudioPlayer/Components/NowPlayingHeaderSection.tsx +89 -0
  28. package/Components/ModalComponent/AudioPlayer/Components/index.ts +3 -1
  29. package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +230 -0
  30. package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +332 -0
  31. package/Components/ModalComponent/BottomSheetDragArea.tsx +33 -0
  32. package/Components/ModalComponent/BottomSheetModalContent.tsx +385 -60
  33. package/Components/ModalComponent/Button/index.tsx +5 -3
  34. package/Components/ModalComponent/Header/CloseButton.tsx +12 -0
  35. package/Components/ModalComponent/Header/__tests__/CloseButton.test.tsx +72 -0
  36. package/Components/ModalComponent/Header/index.tsx +20 -7
  37. package/Components/ModalComponent/Header/utils.ts +1 -1
  38. package/Components/ModalComponent/ModalBlocksStyleContext.tsx +10 -0
  39. package/Components/ModalComponent/SortableList.tsx +142 -0
  40. package/Components/ModalComponent/SortableList.web.tsx +34 -0
  41. package/Components/ModalComponent/TextInputContent.tsx +100 -0
  42. package/Components/ModalComponent/__tests__/BottomSheetDragArea.test.tsx +74 -0
  43. package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +238 -0
  44. package/Components/ModalComponent/__tests__/SortableList.web.test.tsx +16 -0
  45. package/Components/ModalComponent/__tests__/TextInputContent.test.tsx +120 -0
  46. package/Components/ModalComponent/__tests__/showTextInput.test.ts +95 -0
  47. package/Components/ModalComponent/index.tsx +11 -0
  48. package/Components/ModalComponent/presets/__tests__/getCell.test.ts +66 -0
  49. package/Components/ModalComponent/presets/dynamicCollectionCell.tsx +78 -0
  50. package/Components/ModalComponent/presets/index.ts +27 -0
  51. package/Components/ModalComponent/presets/selectableCell.tsx +28 -0
  52. package/Components/ModalComponent/presets/standardCell.tsx +41 -0
  53. package/Components/ModalComponent/presets/types.ts +35 -0
  54. package/Components/ModalComponent/showTextInput.ts +43 -0
  55. package/Components/ModalComponent/utils.ts +82 -21
  56. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +4 -85
  57. package/Components/OfflineHandler/__tests__/index.test.tsx +78 -18
  58. package/Components/OfflineHandler/hooks.ts +111 -0
  59. package/Components/OfflineHandler/index.tsx +51 -73
  60. package/Components/OfflineHandler/utils/index.ts +1 -13
  61. package/Components/PlayerContainer/PlayerContainer.tsx +11 -7
  62. package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -4
  63. package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +66 -13
  64. package/Components/PreloaderWrapper/index.tsx +1 -1
  65. package/Components/River/ComponentsMap/ComponentsMap.tsx +79 -51
  66. package/Components/River/River.tsx +4 -0
  67. package/Components/River/__tests__/resultCallback.test.tsx +47 -0
  68. package/Components/ScreenFeedLoader/ScreenFeedLoader.tsx +5 -3
  69. package/Components/ScreenResolverFeedProvider/ScreenResolverFeedProvider.tsx +1 -1
  70. package/Components/ScreenRevealManager/ScreenRevealManager.ts +18 -2
  71. package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +36 -0
  72. package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +56 -0
  73. package/Components/ScreenRevealManager/withScreenRevealManager.tsx +20 -3
  74. package/Components/TopCutoffOverlay/index.tsx +2 -2
  75. package/Components/VideoLive/LiveImageManager.ts +1 -1
  76. package/Hooks/useEntryActionsExpander.ts +63 -0
  77. package/package.json +6 -5
  78. package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +0 -112
  79. package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +0 -107
  80. package/Components/OfflineHandler/NotificationView/NotificationView.tsx +0 -153
  81. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -66
  82. package/Components/OfflineHandler/NotificationView/utils.ts +0 -34
  83. /package/Decorators/ZappPipesDataConnector/__tests__/{Hero.js → Hero.tsx} +0 -0
@@ -32,24 +32,6 @@ const styles = StyleSheet.create({
32
32
  title: {
33
33
  textAlign: "center",
34
34
  },
35
- demoScreen: {
36
- flex: 1,
37
- backgroundColor: "#1C1C1E",
38
- paddingTop: 64,
39
- paddingHorizontal: 24,
40
- gap: 12,
41
- },
42
- demoHeading: {
43
- color: "#FFFFFF",
44
- fontSize: 20,
45
- fontWeight: "600",
46
- marginBottom: 8,
47
- },
48
- demoLabel: {
49
- color: "#999999",
50
- fontSize: 13,
51
- marginTop: 8,
52
- },
53
35
  });
54
36
 
55
37
  // ---------------------------------------------------------------------------
@@ -99,6 +81,8 @@ export type LeadingIconConfiguration = {
99
81
  enabled: boolean;
100
82
  /** Decides which icon will be displayed when enabled */
101
83
  actionType?: ButtonActionType;
84
+ /** Optional Studio / modal-blocks asset URI (overrides actionType mapping) */
85
+ asset?: string;
102
86
  };
103
87
 
104
88
  export type IconsConfiguration = {
@@ -188,7 +172,9 @@ function getTextTransformStyle(
188
172
  }
189
173
 
190
174
  function shouldShowLeadingIcon(leadingIcon: LeadingIconConfiguration) {
191
- return leadingIcon.enabled && !!leadingIcon.actionType;
175
+ return (
176
+ leadingIcon.enabled && (!!leadingIcon.actionType || !!leadingIcon.asset)
177
+ );
192
178
  }
193
179
 
194
180
  // ---------------------------------------------------------------------------
@@ -286,7 +272,7 @@ function ButtonTitle({
286
272
  }
287
273
 
288
274
  type ButtonLeadingIconProps = {
289
- actionType: ButtonActionType;
275
+ actionType?: ButtonActionType;
290
276
  configuration: IconsConfiguration;
291
277
  };
292
278
 
@@ -294,9 +280,17 @@ function ButtonLeadingIcon({
294
280
  actionType,
295
281
  configuration,
296
282
  }: ButtonLeadingIconProps) {
283
+ const asset =
284
+ configuration.leadingIcon.asset ||
285
+ (actionType ? ACTION_ICON_ASSETS[actionType] : undefined);
286
+
287
+ if (!asset) {
288
+ return null;
289
+ }
290
+
297
291
  return (
298
292
  <Image
299
- source={{ uri: ACTION_ICON_ASSETS[actionType] }}
293
+ source={{ uri: asset }}
300
294
  style={{
301
295
  width: configuration.width,
302
296
  height: configuration.height,
@@ -310,6 +304,9 @@ function ButtonLeadingIcon({
310
304
  // AudioPlayerButton — single building block driven by configuration + data
311
305
  // ---------------------------------------------------------------------------
312
306
 
307
+ import { useModalBlocksStyle } from "../../ModalBlocksStyleContext";
308
+ import { mergeButtonConfiguration } from "../utils/mergeStyles";
309
+
313
310
  export function AudioPlayerButton({
314
311
  configuration,
315
312
  data,
@@ -317,11 +314,19 @@ export function AudioPlayerButton({
317
314
  focused = false,
318
315
  onPress,
319
316
  }: AudioPlayerButtonProps) {
317
+ const modalBlocksStyle = useModalBlocksStyle();
318
+ const buttonBlock = modalBlocksStyle?.button;
319
+ const actionBlock = modalBlocksStyle?.action;
320
+
321
+ const effectiveConfig = React.useMemo(() => {
322
+ return mergeButtonConfiguration(configuration, buttonBlock, actionBlock);
323
+ }, [configuration, buttonBlock, actionBlock]);
324
+
320
325
  const {
321
- background: backgroundConfiguration,
322
- title: titleConfiguration,
326
+ background: effectiveBgConfig,
327
+ title: effectiveTitleConfig,
323
328
  icons: iconsConfiguration,
324
- } = configuration;
329
+ } = effectiveConfig;
325
330
 
326
331
  const { title } = data;
327
332
  const isDisabled = disabled ?? data.disabled ?? false;
@@ -333,7 +338,7 @@ export function AudioPlayerButton({
333
338
  <ButtonContainer
334
339
  focused={focused}
335
340
  disabled={isDisabled}
336
- configuration={backgroundConfiguration}
341
+ configuration={effectiveBgConfig}
337
342
  onPress={onPress}
338
343
  >
339
344
  <View style={styles.contentRow}>
@@ -343,14 +348,14 @@ export function AudioPlayerButton({
343
348
  actionType={leadingIcon.actionType}
344
349
  configuration={iconsConfiguration}
345
350
  />
346
- <View style={{ width: backgroundConfiguration.horizontalGutter }} />
351
+ <View style={{ width: effectiveBgConfig.horizontalGutter }} />
347
352
  </>
348
353
  ) : null}
349
354
  <ButtonTitle
350
355
  title={title}
351
356
  focused={focused}
352
357
  disabled={isDisabled}
353
- configuration={titleConfiguration}
358
+ configuration={effectiveTitleConfig}
354
359
  />
355
360
  </View>
356
361
  </ButtonContainer>
@@ -10,6 +10,7 @@
10
10
 
11
11
  import React, { useCallback, useState } from "react";
12
12
  import { Platform, Pressable, StyleSheet, Text, View } from "react-native";
13
+ import { isApplePlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
13
14
 
14
15
  const styles = StyleSheet.create({
15
16
  row: {
@@ -45,29 +46,6 @@ const styles = StyleSheet.create({
45
46
  alignItems: "center",
46
47
  justifyContent: "center",
47
48
  },
48
- demoScreen: {
49
- flex: 1,
50
- backgroundColor: "#1C1C1E",
51
- paddingTop: 64,
52
- paddingHorizontal: 0,
53
- gap: 24,
54
- },
55
- demoBlock: {
56
- gap: 8,
57
- paddingHorizontal: 0,
58
- },
59
- demoHeading: {
60
- color: "#FFFFFF",
61
- fontSize: 20,
62
- fontWeight: "600",
63
- marginBottom: 8,
64
- paddingHorizontal: 24,
65
- },
66
- demoLabel: {
67
- color: "#999999",
68
- fontSize: 13,
69
- paddingHorizontal: 24,
70
- },
71
49
  });
72
50
 
73
51
  // ---------------------------------------------------------------------------
@@ -123,7 +101,7 @@ export type ActionButtonsStyleConfiguration = {
123
101
  };
124
102
 
125
103
  export type HeaderConfiguration = {
126
- paddingTop: undefined;
104
+ paddingTop?: number;
127
105
  variant: HeaderVariant;
128
106
  title: TitleConfiguration;
129
107
  closeButton: CloseButtonConfiguration;
@@ -305,6 +283,8 @@ type HeaderContainerProps = {
305
283
  children: React.ReactNode;
306
284
  };
307
285
 
286
+ const TRANSPARENT = "transparent";
287
+
308
288
  function HeaderContainer({
309
289
  variant,
310
290
  configuration,
@@ -317,6 +297,8 @@ function HeaderContainer({
317
297
  ? configuration.paddingTop
318
298
  : container.paddingTop;
319
299
 
300
+ const backgroundColor = (configuration as any).backgroundColor || TRANSPARENT;
301
+
320
302
  return (
321
303
  <View
322
304
  style={{
@@ -324,6 +306,7 @@ function HeaderContainer({
324
306
  paddingRight: container.paddingRight,
325
307
  paddingBottom: container.paddingBottom,
326
308
  paddingLeft: container.paddingLeft,
309
+ backgroundColor: backgroundColor,
327
310
  }}
328
311
  >
329
312
  {children}
@@ -338,17 +321,18 @@ type HeaderTitleProps = {
338
321
  };
339
322
 
340
323
  function HeaderTitle({ title, configuration, centered }: HeaderTitleProps) {
341
- const letterSpacing =
342
- Platform.OS === "ios"
343
- ? configuration.iosLetterSpacing
344
- : configuration.androidLetterSpacing;
324
+ const { fontColor, fontSize } = configuration;
325
+
326
+ const letterSpacing = isApplePlatform()
327
+ ? configuration.iosLetterSpacing
328
+ : configuration.androidLetterSpacing;
345
329
 
346
330
  return (
347
331
  <Text
348
332
  style={{
349
333
  flex: centered ? undefined : 1,
350
- color: configuration.fontColor,
351
- fontSize: configuration.fontSize,
334
+ color: fontColor,
335
+ fontSize: fontSize,
352
336
  lineHeight: configuration.lineHeight,
353
337
  letterSpacing,
354
338
  fontFamily: Platform.select({
@@ -610,6 +594,9 @@ function CenterAlignedHeaderLayout({
610
594
  // AudioPlayerHeader
611
595
  // ---------------------------------------------------------------------------
612
596
 
597
+ import { useModalBlocksStyle } from "../../ModalBlocksStyleContext";
598
+ import { mergeHeaderConfiguration } from "../utils/mergeStyles";
599
+
613
600
  export function AudioPlayerHeader({
614
601
  configuration,
615
602
  data,
@@ -622,7 +609,14 @@ export function AudioPlayerHeader({
622
609
  onDone,
623
610
  onClear,
624
611
  }: AudioPlayerHeaderProps) {
625
- const { variant, title, closeButton, actionButtons } = configuration;
612
+ const modalBlocksStyle = useModalBlocksStyle();
613
+ const headerBlock = modalBlocksStyle?.header;
614
+
615
+ const effectiveConfig = React.useMemo(() => {
616
+ return mergeHeaderConfiguration(configuration, headerBlock);
617
+ }, [configuration, headerBlock]);
618
+
619
+ const { variant, title, closeButton, actionButtons } = effectiveConfig;
626
620
  const { title: titleText } = data;
627
621
 
628
622
  const container = CONTAINER_SPEC[variant];
@@ -767,45 +761,3 @@ export const VARIANT_SECTION_HEADER: HeaderConfiguration = {
767
761
  closeButton: { enabled: false },
768
762
  actionButtons: DEFAULT_ACTION_BUTTONS_STYLE_CONFIGURATION,
769
763
  };
770
-
771
- export default function App() {
772
- return (
773
- <View style={styles.demoScreen}>
774
- <Text style={styles.demoHeading}>Modal Header Building Block</Text>
775
-
776
- <View style={styles.demoBlock}>
777
- <Text style={styles.demoLabel}>Single Line Header</Text>
778
- <AudioPlayerHeader
779
- configuration={VARIANT_SINGLE_LINE_HEADER}
780
- data={{ title: "Playback Speed" }}
781
- />
782
- </View>
783
-
784
- <View style={styles.demoBlock}>
785
- <Text style={styles.demoLabel}>Header With Actions</Text>
786
- <AudioPlayerHeader
787
- configuration={VARIANT_HEADER_WITH_ACTIONS}
788
- data={{ title: "Playback Speed" }}
789
- />
790
- </View>
791
-
792
- <View style={styles.demoBlock}>
793
- <Text style={styles.demoLabel}>
794
- Header With Actions — single side action
795
- </Text>
796
- <AudioPlayerHeader
797
- configuration={VARIANT_HEADER_WITH_CANCEL_ONLY}
798
- data={{ title: "Playback Speed" }}
799
- />
800
- </View>
801
-
802
- <View style={styles.demoBlock}>
803
- <Text style={styles.demoLabel}>Section Header</Text>
804
- <AudioPlayerHeader
805
- configuration={VARIANT_SECTION_HEADER}
806
- data={{ title: "Next in Queue" }}
807
- />
808
- </View>
809
- </View>
810
- );
811
- }
@@ -37,24 +37,6 @@ const styles = StyleSheet.create({
37
37
  underline: {
38
38
  alignSelf: "stretch",
39
39
  },
40
- demoScreen: {
41
- flex: 1,
42
- backgroundColor: "#1C1C1E",
43
- paddingTop: 64,
44
- paddingHorizontal: 16,
45
- gap: 24,
46
- },
47
- demoHeading: {
48
- color: "#FFFFFF",
49
- fontSize: 20,
50
- fontWeight: "600",
51
- marginBottom: 8,
52
- },
53
- demoLabel: {
54
- color: "#999999",
55
- fontSize: 13,
56
- marginTop: 8,
57
- },
58
40
  });
59
41
 
60
42
  // ---------------------------------------------------------------------------