@applicaster/zapp-react-native-ui-components 16.0.0-rc.99 → 17.0.0-alpha.1102403272

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 (112) hide show
  1. package/Components/AudioPlayer/index.web.tsx +10 -0
  2. package/Components/Cell/PlatformCellComponent.ts +9 -0
  3. package/Components/Cell/PlatformCellComponent.web.ts +3 -0
  4. package/Components/Cell/index.js +2 -9
  5. package/Components/CellRendererResolver/index.ts +22 -3
  6. package/Components/ComponentResolver/ComponentResolver.ts +6 -2
  7. package/Components/ComponentResolver/__tests__/componentResolver.test.js +13 -5
  8. package/Components/ContentScreen/index.js +2 -2
  9. package/Components/Focusable/index.web.tsx +3 -0
  10. package/Components/FocusableList/hooks/useCheckItemIdsForUnique.ts +2 -7
  11. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +1 -1
  12. package/Components/GeneralContentScreen/hookAdapter/logger.ts +1 -1
  13. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +158 -1
  14. package/Components/GeneralContentScreen/utils/index.ts +2 -2
  15. package/Components/GeneralContentScreen/utils/logger.ts +3 -4
  16. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +32 -10
  17. package/Components/HandlePlayable/utils.ts +2 -7
  18. package/Components/HookRenderer/HookRenderer.tsx +2 -2
  19. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +42 -4
  20. package/Components/MasterCell/DefaultComponents/ButtonContainerView/index.android.tv.tsx +7 -4
  21. package/Components/MasterCell/DefaultComponents/ButtonContainerView/types.ts +1 -0
  22. package/Components/MasterCell/DefaultComponents/FocusableView/index.android.tsx +10 -4
  23. package/Components/MasterCell/DefaultComponents/Image/hoc/utils/__tests__/withDimensions.test.ts +1 -1
  24. package/Components/MasterCell/DefaultComponents/Image/hoc/utils/index.ts +2 -4
  25. package/Components/MasterCell/DefaultComponents/Image/hooks/checkTooBigImageSize.ts +2 -7
  26. package/Components/MasterCell/DefaultComponents/Image/index.web.ts +7 -0
  27. package/Components/MasterCell/DefaultComponents/LiveImage/__tests__/prepareEntry.test.ts +30 -0
  28. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +34 -7
  29. package/Components/MasterCell/DefaultComponents/PressableView.tsx +3 -0
  30. package/Components/MasterCell/DefaultComponents/Text/hooks/useText.ts +2 -7
  31. package/Components/MasterCell/DefaultComponents/__tests__/ActionButton.missingPlugin.test.tsx +66 -0
  32. package/Components/MasterCell/DefaultComponents/__tests__/ActionButton.test.tsx +288 -0
  33. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/ActionButton.tsx +2 -1
  34. package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/PressableView.test.tsx +4 -2
  35. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/factory.test.ts +2 -2
  36. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +2 -1
  37. package/Components/MasterCell/__tests__/masterCell.test.js +116 -0
  38. package/Components/MasterCell/index.tsx +45 -6
  39. package/Components/MasterCell/logger.ts +2 -2
  40. package/Components/MasterCell/utils/__tests__/getFocusableElementId.test.ts +38 -0
  41. package/Components/MasterCell/utils/__tests__/useIsCellSelected.test.ts +91 -0
  42. package/Components/MasterCell/utils/__tests__/withoutFocusedState.test.js +20 -0
  43. package/Components/MasterCell/utils/behaviorProvider.ts +57 -38
  44. package/Components/MasterCell/utils/index.ts +60 -19
  45. package/Components/ModalComponent/ActionsBottomSheet/openActionsBottomSheet.ts +1 -1
  46. package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +7 -3
  47. package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +22 -1
  48. package/Components/ModalComponent/AudioPlayer/Components/__tests__/Item.test.tsx +52 -1
  49. package/Components/ModalComponent/AudioPlayer/utils/__tests__/mergeStyles.test.ts +77 -0
  50. package/Components/ModalComponent/AudioPlayer/utils/mergeStyles.ts +58 -16
  51. package/Components/ModalComponent/BottomSheetDragArea.web.tsx +15 -0
  52. package/Components/ModalComponent/BottomSheetModalContent.tsx +51 -82
  53. package/Components/ModalComponent/Button/index.tsx +3 -1
  54. package/Components/ModalComponent/SortableList.tsx +2 -3
  55. package/Components/ModalComponent/__tests__/BottomSheetDragArea.test.tsx +30 -0
  56. package/Components/ModalComponent/__tests__/BottomSheetModalContent.test.tsx +237 -17
  57. package/Components/ModalComponent/__tests__/showTextInput.test.ts +25 -0
  58. package/Components/ModalComponent/presets/__tests__/getCell.test.ts +29 -2
  59. package/Components/ModalComponent/presets/index.ts +2 -3
  60. package/Components/ModalComponent/showTextInput.ts +2 -0
  61. package/Components/OfflineHandler/__tests__/index.test.tsx +136 -0
  62. package/Components/OfflineHandler/index.tsx +45 -6
  63. package/Components/PlayerContainer/PlayerContainer.tsx +30 -6
  64. package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +51 -0
  65. package/Components/PlayerContainer/logger.ts +9 -5
  66. package/Components/River/ComponentsMap/ComponentsMap.tsx +4 -1
  67. package/Components/River/ComponentsMap/index.web.tsx +3 -0
  68. package/Components/River/RiverItem.tsx +4 -0
  69. package/Components/River/TV/River.tsx +7 -1
  70. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
  71. package/Components/ScreenFeedLoader/ScreenFeedLoader.tsx +2 -2
  72. package/Components/ScreenResolver/index.tsx +6 -4
  73. package/Components/Tabs/TV/index.web.tsx +5 -0
  74. package/Components/TopCutoffOverlay/__tests__/TopCutoffOverlay.test.tsx +56 -10
  75. package/Components/TopCutoffOverlay/index.tsx +41 -10
  76. package/Components/Transitioner/AnimationManager.js +1 -1
  77. package/Components/Transitioner/Scene.tsx +4 -3
  78. package/Components/Transitioner/Transitioner.tsx +71 -33
  79. package/Components/Transitioner/__tests__/transitioner.test.js +372 -3
  80. package/Components/VideoLive/LiveImageManager.ts +126 -12
  81. package/Components/VideoLive/MuteUnmuteController.ts +135 -0
  82. package/Components/VideoLive/PlayerLiveImageComponent.tsx +15 -19
  83. package/Components/VideoLive/__tests__/LiveImageManager.test.ts +30 -0
  84. package/Components/VideoLive/__tests__/LiveImageMuteState.test.ts +311 -0
  85. package/Components/VideoLive/__tests__/MuteUnmuteController.test.ts +135 -0
  86. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +63 -1
  87. package/Components/VideoLive/loggerHelper.ts +2 -2
  88. package/Components/VideoModal/PlayerDetails.tsx +27 -2
  89. package/Components/VideoModal/PlayerWrapper.tsx +9 -2
  90. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +84 -0
  91. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -0
  92. package/Components/VideoModal/__tests__/playerWrapperStyle.test.ts +263 -0
  93. package/Components/VideoModal/__tests__/playerWrapperUtils.test.ts +125 -0
  94. package/Components/VideoModal/hooks/useModalSize.ts +2 -7
  95. package/Components/VideoModal/playerWrapperStyle.ts +62 -23
  96. package/Components/VideoModal/playerWrapperUtils.ts +141 -1
  97. package/Components/__tests__/webVariants.test.js +73 -0
  98. package/Components/default-cell-renderer/containerStyles/index.web.ts +6 -0
  99. package/Components/default-cell-renderer/viewTrees/index.web.ts +10 -0
  100. package/Contexts/ZappPipesContext/ZappPipesContextFactory.tsx +3 -5
  101. package/Decorators/RiverResolver/__tests__/riverResolver.missingRiver.test.tsx +52 -0
  102. package/Decorators/RiverResolver/index.tsx +25 -0
  103. package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +4 -3
  104. package/Decorators/ZappPipesDataConnector/__tests__/screenToolbox.test.ts +347 -0
  105. package/Decorators/ZappPipesDataConnector/__tests__/screenToolboxUnavailable.test.ts +53 -0
  106. package/Decorators/ZappPipesDataConnector/index.tsx +19 -4
  107. package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +2 -21
  108. package/Decorators/ZappPipesDataConnector/screenToolbox.ts +384 -0
  109. package/Decorators/ZappPipesDataConnector/utils/mongoFilter.ts +1 -1
  110. package/Decorators/ZappPipesDataConnector/utils/useFilter.tsx +1 -1
  111. package/Helpers/logger.js +2 -2
  112. package/package.json +5 -5
@@ -6,7 +6,7 @@
6
6
  * Green (configurable): background, image, nowPlayingAsset, nowPlayingLabel,
7
7
  * textLabel1, textLabel2
8
8
  * White (hardcoded): container padding/gutters, nowPlaying container layout,
9
- * button sizes/padding/assets
9
+ * button sizes/padding. Play/pause icons use plugin assets when set.
10
10
  *
11
11
  * Variants (VARIANT_*) are preset configuration bundles — not passed as a field.
12
12
  */
@@ -94,6 +94,10 @@ export type ActionButtonAssetsConfiguration = {
94
94
  removeAsset?: string;
95
95
  /** Trailing drag handle on Edit Order / queue rows. */
96
96
  dragAsset?: string;
97
+ /** Shown on the Now Playing row while the track is paused. */
98
+ playAsset?: string;
99
+ /** Shown on the Now Playing row while the track is playing. */
100
+ pauseAsset?: string;
97
101
  };
98
102
 
99
103
  export type ItemConfiguration = {
@@ -504,6 +508,23 @@ function ItemButton({
504
508
  const renderIcon = () => {
505
509
  switch (action) {
506
510
  case "playPause": {
511
+ const playbackAsset = isSelected
512
+ ? actionButtonAssets?.pauseAsset
513
+ : actionButtonAssets?.playAsset;
514
+
515
+ if (playbackAsset) {
516
+ return (
517
+ <Image
518
+ source={{ uri: playbackAsset }}
519
+ style={{
520
+ width: layout.assetWidth,
521
+ height: layout.assetHeight,
522
+ }}
523
+ resizeMode="contain"
524
+ />
525
+ );
526
+ }
527
+
507
528
  const iconSize = layout.assetWidth;
508
529
  const iconRadius = iconSize / 2;
509
530
 
@@ -1,8 +1,10 @@
1
1
  import React from "react";
2
- import { Pressable } from "react-native";
2
+ import { Image, Pressable } from "react-native";
3
3
  import { fireEvent, render, screen } from "@testing-library/react-native";
4
+ import { ModalBlocksStyleContext } from "../../../ModalBlocksStyleContext";
4
5
  import {
5
6
  AudioPlayerTrackItem,
7
+ VARIANT_NOW_PLAYING,
6
8
  VARIANT_PLAYLIST_ITEM,
7
9
  mapMenuItemToNowPlayingData,
8
10
  } from "../Item";
@@ -101,6 +103,55 @@ describe("mapMenuItemToNowPlayingData", () => {
101
103
  expect(data.textLabel2).toBe("Artist Name");
102
104
  });
103
105
 
106
+ it("uses the plugin play asset while paused and the pause asset while playing", () => {
107
+ const menuItem = {
108
+ id: "item_1",
109
+ title: "Track Title",
110
+ summary: "Artist Name",
111
+ };
112
+
113
+ const style = {
114
+ nowPlayingItem: {
115
+ actionButtons: {
116
+ default: {
117
+ playAsset: "https://example.com/play.png",
118
+ pauseAsset: "https://example.com/pause.png",
119
+ },
120
+ },
121
+ },
122
+ };
123
+
124
+ const { UNSAFE_getAllByType, rerender } = render(
125
+ <ModalBlocksStyleContext.Provider value={style}>
126
+ <AudioPlayerTrackItem
127
+ configuration={VARIANT_NOW_PLAYING}
128
+ data={mapMenuItemToNowPlayingData(menuItem as any, true)}
129
+ />
130
+ </ModalBlocksStyleContext.Provider>
131
+ );
132
+
133
+ expect(
134
+ UNSAFE_getAllByType(Image).some(
135
+ (node) => node.props.source?.uri === "https://example.com/play.png"
136
+ )
137
+ ).toBe(true);
138
+
139
+ rerender(
140
+ <ModalBlocksStyleContext.Provider value={style}>
141
+ <AudioPlayerTrackItem
142
+ configuration={VARIANT_NOW_PLAYING}
143
+ data={mapMenuItemToNowPlayingData(menuItem as any, false)}
144
+ />
145
+ </ModalBlocksStyleContext.Provider>
146
+ );
147
+
148
+ expect(
149
+ UNSAFE_getAllByType(Image).some(
150
+ (node) => node.props.source?.uri === "https://example.com/pause.png"
151
+ )
152
+ ).toBe(true);
153
+ });
154
+
104
155
  it("uses custom nowPlayingLabel when provided", () => {
105
156
  const data = mapMenuItemToNowPlayingData(
106
157
  item as any,
@@ -131,6 +131,43 @@ describe("mergeItemConfiguration background", () => {
131
131
  "https://placehold.co/24x24/FF3B30/FFFFFF/png?text=RH"
132
132
  );
133
133
  });
134
+
135
+ it("applies a text label font family and ignores a non-string font family", () => {
136
+ const withFont = mergeItemConfiguration(base as any, {
137
+ textLabel1: { default: { fontFamily: "Roboto-Bold" } },
138
+ });
139
+
140
+ expect(withFont.textLabel1.iosFontFamily).toBe("Roboto-Bold");
141
+ expect(withFont.textLabel1.androidFontFamily).toBe("Roboto-Bold");
142
+
143
+ const withEmpty = mergeItemConfiguration(base as any, {
144
+ textLabel1: {
145
+ default: { fontFamily: {}, iosFontFamily: "SFProText-Semibold" },
146
+ },
147
+ });
148
+
149
+ expect(withEmpty.textLabel1.iosFontFamily).toBe("SFProText-Semibold");
150
+ expect(withEmpty.textLabel1.androidFontFamily).toBeUndefined();
151
+ });
152
+
153
+ it("applies play and pause assets onto actionButtonAssets", () => {
154
+ const merged = mergeItemConfiguration(base as any, {
155
+ actionButtons: {
156
+ default: {
157
+ playAsset: "https://example.com/play.png",
158
+ pauseAsset: "https://example.com/pause.png",
159
+ },
160
+ },
161
+ });
162
+
163
+ expect(merged.actionButtonAssets?.playAsset).toBe(
164
+ "https://example.com/play.png"
165
+ );
166
+
167
+ expect(merged.actionButtonAssets?.pauseAsset).toBe(
168
+ "https://example.com/pause.png"
169
+ );
170
+ });
134
171
  });
135
172
 
136
173
  describe("mergeButtonConfiguration background", () => {
@@ -250,6 +287,46 @@ describe("mergeButtonConfiguration background", () => {
250
287
  expect(merged.title.androidLetterSpacing).toBe(-0.5);
251
288
  expect(merged.title.textTransform).toBe("uppercase");
252
289
  });
290
+
291
+ it("uses the family string inside a font-selector object and ignores {}", () => {
292
+ const fromObject = mergeButtonConfiguration(buttonBase as any, {
293
+ title: {
294
+ default: { fontFamily: { fontFamily: "GreycliffCF-Bold" } },
295
+ },
296
+ });
297
+
298
+ expect(fromObject.title.iosFontFamily).toBe("GreycliffCF-Bold");
299
+ expect(fromObject.title.androidFontFamily).toBe("GreycliffCF-Bold");
300
+
301
+ const fromEmpty = mergeButtonConfiguration(buttonBase as any, {
302
+ title: {
303
+ default: { fontFamily: {} },
304
+ },
305
+ });
306
+
307
+ expect(fromEmpty.title.iosFontFamily).toBe(buttonBase.title.iosFontFamily);
308
+
309
+ expect(fromEmpty.title.androidFontFamily).toBe(
310
+ buttonBase.title.androidFontFamily
311
+ );
312
+ });
313
+
314
+ it("maps inactive color, gutter, and focused and inactive font colors", () => {
315
+ const merged = mergeButtonConfiguration(buttonBase as any, {
316
+ background: {
317
+ default: { inactiveColor: "#999999", horizontalGutter: 6 },
318
+ },
319
+ title: {
320
+ default: { inactiveFontColor: "#111111" },
321
+ focused: { fontColor: "#222222" },
322
+ },
323
+ });
324
+
325
+ expect(merged.background.inactiveColor).toBe("#999999");
326
+ expect(merged.background.horizontalGutter).toBe(6);
327
+ expect(merged.title.inactiveFontColor).toBe("#111111");
328
+ expect(merged.title.focusedFontColor).toBe("#222222");
329
+ });
253
330
  });
254
331
 
255
332
  describe("mergeHeaderConfiguration section header (Variant 3)", () => {
@@ -82,7 +82,7 @@ function mergeItemLabel(
82
82
  ...(override.lineHeight !== undefined
83
83
  ? { lineHeight: override.lineHeight }
84
84
  : {}),
85
- ...(override.fontFamily
85
+ ...(typeof override.fontFamily === "string" && override.fontFamily
86
86
  ? {
87
87
  iosFontFamily: override.fontFamily,
88
88
  androidFontFamily: override.fontFamily,
@@ -147,6 +147,8 @@ function mergeItemActionButtonAssets(
147
147
  ...base,
148
148
  ...(override.removeAsset ? { removeAsset: override.removeAsset } : {}),
149
149
  ...(override.dragAsset ? { dragAsset: override.dragAsset } : {}),
150
+ ...(override.playAsset ? { playAsset: override.playAsset } : {}),
151
+ ...(override.pauseAsset ? { pauseAsset: override.pauseAsset } : {}),
150
152
  };
151
153
  }
152
154
 
@@ -379,6 +381,22 @@ export function mergeHeaderConfiguration(
379
381
  // Button Merging Helpers
380
382
  // ---------------------------------------------------------------------------
381
383
 
384
+ function fontFamilyName(value: unknown): string | undefined {
385
+ if (typeof value === "string" && value.trim()) {
386
+ return value;
387
+ }
388
+
389
+ if (value && typeof value === "object") {
390
+ const family = (value as { fontFamily?: unknown }).fontFamily;
391
+
392
+ if (typeof family === "string" && family.trim()) {
393
+ return family;
394
+ }
395
+ }
396
+
397
+ return undefined;
398
+ }
399
+
382
400
  function mergeButtonBackground(
383
401
  base: ButtonBackgroundConfiguration,
384
402
  defaultOverride?: Record<string, any>,
@@ -397,6 +415,9 @@ function mergeButtonBackground(
397
415
  ...(defaultOverride?.backgroundColor
398
416
  ? { defaultColor: defaultOverride.backgroundColor }
399
417
  : {}),
418
+ ...(defaultOverride?.inactiveColor
419
+ ? { inactiveColor: defaultOverride.inactiveColor }
420
+ : {}),
400
421
  ...(focusedColor != null && focusedColor !== "" ? { focusedColor } : {}),
401
422
  ...(defaultOverride?.borderRadius !== undefined
402
423
  ? { cornerRadius: defaultOverride.borderRadius }
@@ -413,47 +434,62 @@ function mergeButtonBackground(
413
434
  ...(defaultOverride?.paddingLeft !== undefined
414
435
  ? { paddingLeft: defaultOverride.paddingLeft }
415
436
  : {}),
437
+ ...(defaultOverride?.horizontalGutter !== undefined
438
+ ? { horizontalGutter: defaultOverride.horizontalGutter }
439
+ : {}),
416
440
  };
417
441
  }
418
442
 
419
443
  function mergeButtonTitle(
420
444
  base: ButtonTitleConfiguration,
421
- override?: Record<string, any>
445
+ override?: Record<string, any>,
446
+ focusedOverride?: Record<string, any>
422
447
  ): ButtonTitleConfiguration {
423
- if (!override) return base;
448
+ if (!override && !focusedOverride) return base;
449
+
450
+ const fontFamily = fontFamilyName(override?.fontFamily);
451
+
452
+ const focusedFontColor =
453
+ focusedOverride?.fontColor || override?.focusedFontColor;
454
+
455
+ const inactiveFontColor = override?.inactiveFontColor;
424
456
 
425
457
  return {
426
458
  ...base,
427
- ...(override.fontColor ? { fontColor: override.fontColor } : {}),
428
- ...(override.fontSize !== undefined ? { fontSize: override.fontSize } : {}),
429
- ...(override.lineHeight !== undefined
459
+ ...(override?.fontColor ? { fontColor: override.fontColor } : {}),
460
+ ...(focusedFontColor ? { focusedFontColor } : {}),
461
+ ...(inactiveFontColor ? { inactiveFontColor } : {}),
462
+ ...(override?.fontSize !== undefined
463
+ ? { fontSize: override.fontSize }
464
+ : {}),
465
+ ...(override?.lineHeight !== undefined
430
466
  ? { lineHeight: override.lineHeight }
431
467
  : {}),
432
- ...(override.fontFamily
468
+ ...(fontFamily
433
469
  ? {
434
- iosFontFamily: override.fontFamily,
435
- androidFontFamily: override.fontFamily,
470
+ iosFontFamily: fontFamily,
471
+ androidFontFamily: fontFamily,
436
472
  }
437
473
  : {}),
438
- ...(override.iosFontFamily
474
+ ...(override?.iosFontFamily
439
475
  ? { iosFontFamily: override.iosFontFamily }
440
476
  : {}),
441
- ...(override.androidFontFamily
477
+ ...(override?.androidFontFamily
442
478
  ? { androidFontFamily: override.androidFontFamily }
443
479
  : {}),
444
- ...(override.letterSpacing !== undefined
480
+ ...(override?.letterSpacing !== undefined
445
481
  ? {
446
482
  iosLetterSpacing: override.letterSpacing,
447
483
  androidLetterSpacing: override.letterSpacing,
448
484
  }
449
485
  : {}),
450
- ...(override.iosLetterSpacing !== undefined
486
+ ...(override?.iosLetterSpacing !== undefined
451
487
  ? { iosLetterSpacing: override.iosLetterSpacing }
452
488
  : {}),
453
- ...(override.androidLetterSpacing !== undefined
489
+ ...(override?.androidLetterSpacing !== undefined
454
490
  ? { androidLetterSpacing: override.androidLetterSpacing }
455
491
  : {}),
456
- ...(override.textTransform
492
+ ...(override?.textTransform
457
493
  ? { textTransform: override.textTransform }
458
494
  : {}),
459
495
  };
@@ -509,13 +545,19 @@ export function mergeButtonConfiguration(
509
545
  const titleOverride =
510
546
  buttonBlock?.title?.default || actionBlock?.title?.default;
511
547
 
548
+ const titleFocused =
549
+ buttonBlock?.title?.focused ||
550
+ buttonBlock?.title?.focus ||
551
+ actionBlock?.title?.focused ||
552
+ actionBlock?.title?.focus;
553
+
512
554
  const iconsOverride = buttonBlock?.icons || actionBlock?.icons;
513
555
  const leadingOverride = buttonBlock?.leadingIcon || actionBlock?.leadingIcon;
514
556
 
515
557
  return {
516
558
  ...base,
517
559
  background: mergeButtonBackground(base.background, bgDefault, bgFocused),
518
- title: mergeButtonTitle(base.title, titleOverride),
560
+ title: mergeButtonTitle(base.title, titleOverride, titleFocused),
519
561
  icons: mergeButtonIcons(base.icons, iconsOverride, leadingOverride),
520
562
  };
521
563
  }
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+
3
+ /**
4
+ * Web builds have no draggable bottom sheet: `ModalProvider` renders `null` on web,
5
+ * so nothing mounts `BottomSheetContext` and the native component's `useBottomSheet()`
6
+ * is always null there — it already renders its children unchanged.
7
+ *
8
+ * This variant keeps that behaviour and keeps `react-native-gesture-handler`, which the
9
+ * native implementation imports for `PanGestureHandler`, out of web bundles entirely.
10
+ */
11
+ export const BottomSheetDragArea = ({
12
+ children,
13
+ }: {
14
+ children: React.ReactElement;
15
+ }) => children;
@@ -22,6 +22,7 @@ import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
22
22
  import {
23
23
  ContentViewModel,
24
24
  OPERATIONS,
25
+ type OperationButtons,
25
26
  hasOperation,
26
27
  useBottomSheetContent,
27
28
  } from "@applicaster/zapp-react-native-utils/modalState";
@@ -42,6 +43,7 @@ import {
42
43
  parseModalBlocksConfiguration,
43
44
  } from "@applicaster/zapp-react-native-utils/configurationUtils/modalBlocksParser";
44
45
  import { useLocalizedStrings } from "@applicaster/zapp-react-native-utils/localizationUtils";
46
+ import { VARIANT_TEXT_ONLY } from "./AudioPlayer/Components/Button";
45
47
 
46
48
  const styles = StyleSheet.create({
47
49
  centered: {
@@ -90,10 +92,13 @@ type ModalComponentProps = {
90
92
  /** Optional body that replaces the items list (header stays DefaultModalHeader). */
91
93
  contentComponent?: React.ComponentType<any>;
92
94
  contentComponentProps?: Record<string, any>;
95
+ themePluginId?: string;
93
96
  styleOverrides?: ModalBlocksConfig | Record<string, any>;
94
97
  measurementPhase?: boolean;
95
98
  /** Copy under Next Up when the queue has no upcoming items. */
96
99
  emptyMessage?: string;
100
+ /** Producer-owned title/iconURL for sheet-synthesized operation controls. */
101
+ operationButtons?: OperationButtons;
97
102
  };
98
103
 
99
104
  function _BottomSheetModalContent(props: ModalComponentProps) {
@@ -115,9 +120,10 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
115
120
  iconPlacement,
116
121
  contentComponent: ContentComponent,
117
122
  contentComponentProps = {},
118
- styleOverrides: propStyleOverrides,
123
+ themePluginId: themePluginIdProp,
119
124
  measurementPhase = false,
120
125
  emptyMessage,
126
+ operationButtons,
121
127
  } = props;
122
128
 
123
129
  const route = useRef(currentRoute);
@@ -140,12 +146,14 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
140
146
  role,
141
147
  behavior,
142
148
  editableCollection,
143
- themePluginId,
149
+ themePluginId: themePluginIdFromSheet,
144
150
  } = useBottomSheetContent({
145
151
  onPress,
146
152
  viewModel,
147
153
  });
148
154
 
155
+ const themePluginId = themePluginIdFromSheet || themePluginIdProp;
156
+
149
157
  const plugins = usePlugins();
150
158
 
151
159
  const plugin = useMemo(
@@ -157,78 +165,10 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
157
165
  const configuration =
158
166
  plugin?.configuration || (plugin as any)?.configuration_json;
159
167
 
160
- const parsed =
161
- configuration && themePluginId
162
- ? parseModalBlocksConfiguration(configuration, themePluginId)
163
- : null;
164
-
165
- if (!propStyleOverrides) {
166
- return parsed;
167
- }
168
-
169
- // hydrate(QueueStyles) only emits sectionHeader after the plugin class
170
- // includes it. Until then, Studio/local keys in configuration_json still
171
- // apply via the parser.
172
- const hydratedSection = propStyleOverrides.sectionHeader;
173
-
174
- const hasTitleStyle = (style?: Record<string, any>) =>
175
- Boolean(
176
- style &&
177
- (style.fontColor ||
178
- style.fontSize !== undefined ||
179
- style.lineHeight !== undefined ||
180
- style.fontFamily ||
181
- style.iosFontFamily ||
182
- style.androidFontFamily ||
183
- style.letterSpacing !== undefined ||
184
- style.iosLetterSpacing !== undefined ||
185
- style.androidLetterSpacing !== undefined ||
186
- style.textTransform ||
187
- style.alignment)
188
- );
189
-
190
- const hasActionStyle = (style?: Record<string, any>) =>
191
- Boolean(
192
- style &&
193
- (style.backgroundColor ||
194
- style.fontColor ||
195
- style.fontSize !== undefined ||
196
- style.lineHeight !== undefined ||
197
- style.fontFamily ||
198
- style.iosFontFamily ||
199
- style.androidFontFamily ||
200
- style.letterSpacing !== undefined ||
201
- style.iosLetterSpacing !== undefined ||
202
- style.androidLetterSpacing !== undefined ||
203
- style.textTransform ||
204
- style.borderRadius !== undefined ||
205
- style.cornerRadius !== undefined ||
206
- style.paddingTop !== undefined ||
207
- style.paddingRight !== undefined ||
208
- style.paddingBottom !== undefined ||
209
- style.paddingLeft !== undefined)
210
- );
211
-
212
- const actionNode = hydratedSection?.actionButtons;
213
-
214
- // An empty `default: {}` is truthy and would hide fields set on the flat
215
- // object or on the focused bucket.
216
- const hasHydratedSection =
217
- hasTitleStyle(hydratedSection?.title?.default) ||
218
- hasTitleStyle(hydratedSection?.title) ||
219
- hasActionStyle(actionNode?.default) ||
220
- hasActionStyle(actionNode?.focused) ||
221
- hasActionStyle(actionNode?.focus) ||
222
- hasActionStyle(actionNode);
223
-
224
- return {
225
- ...parsed,
226
- ...propStyleOverrides,
227
- sectionHeader: hasHydratedSection
228
- ? hydratedSection
229
- : parsed?.sectionHeader,
230
- };
231
- }, [propStyleOverrides, plugin, themePluginId]);
168
+ return configuration && themePluginId
169
+ ? parseModalBlocksConfiguration(configuration, themePluginId)
170
+ : null;
171
+ }, [plugin, themePluginId]);
232
172
 
233
173
  const pluginLocalizations = useLocalizedStrings({
234
174
  localizations:
@@ -238,6 +178,28 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
238
178
 
239
179
  const normalizedPluginId = themePluginId?.replace(/-/g, "_");
240
180
 
181
+ const addLabel = operationButtons?.add?.title || "Create New";
182
+ const addIcon = operationButtons?.add?.iconURL;
183
+
184
+ const addButtonConfiguration = useMemo(() => {
185
+ const leadingIcon =
186
+ styleOverrides?.button?.leadingIcon ||
187
+ styleOverrides?.action?.leadingIcon;
188
+
189
+ const configuredIcon = leadingIcon?.default?.asset;
190
+
191
+ return {
192
+ ...VARIANT_TEXT_ONLY,
193
+ icons: {
194
+ ...VARIANT_TEXT_ONLY.icons,
195
+ leadingIcon: {
196
+ enabled: !!(addIcon || configuredIcon),
197
+ asset: addIcon,
198
+ },
199
+ },
200
+ };
201
+ }, [addIcon, styleOverrides]);
202
+
241
203
  const localizedHeaderTitle = normalizedPluginId
242
204
  ? pluginLocalizations?.[`${normalizedPluginId}_header_title`]
243
205
  : undefined;
@@ -394,11 +356,8 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
394
356
  editableCollection?.deleteCollection?.();
395
357
  }, [editableCollection]);
396
358
 
397
- const handleCreatePlaylist = useCallback(() => {
398
- editableCollection?.add?.({
399
- id: "create_new_playlist",
400
- title: "unknown title",
401
- });
359
+ const handleAdd = useCallback(() => {
360
+ editableCollection?.add?.();
402
361
  }, [editableCollection]);
403
362
 
404
363
  const headers = useMemo(() => {
@@ -428,7 +387,11 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
428
387
  <View
429
388
  style={{ paddingHorizontal: 20, paddingTop: 8, paddingBottom: 12 }}
430
389
  >
431
- <AudioPlayerButton onPress={handleCreatePlaylist} />
390
+ <AudioPlayerButton
391
+ configuration={addButtonConfiguration}
392
+ data={{ title: addLabel }}
393
+ onPress={handleAdd}
394
+ />
432
395
  </View>
433
396
  ),
434
397
  });
@@ -445,7 +408,9 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
445
408
  emptyMessage,
446
409
  clearLabel,
447
410
  hasAdd,
448
- handleCreatePlaylist,
411
+ addLabel,
412
+ addButtonConfiguration,
413
+ handleAdd,
449
414
  ]);
450
415
 
451
416
  const _items = useMemo(() => {
@@ -560,7 +525,11 @@ function _BottomSheetModalContent(props: ModalComponentProps) {
560
525
  ) : null}
561
526
  {hasAdd ? (
562
527
  <View style={styles.someStyles}>
563
- <AudioPlayerButton onPress={handleCreatePlaylist} />
528
+ <AudioPlayerButton
529
+ configuration={addButtonConfiguration}
530
+ data={{ title: addLabel }}
531
+ onPress={handleAdd}
532
+ />
564
533
  </View>
565
534
  ) : null}
566
535
  {_items}
@@ -43,7 +43,9 @@ export function Button({
43
43
  }: ButtonProps) {
44
44
  const [focused, setFocused] = useState(false);
45
45
 
46
- const selected = selectedItem && item?.value === selectedItem?.value;
46
+ const selected = Boolean(
47
+ item?.isSelected || (selectedItem && item?.value === selectedItem?.value)
48
+ );
47
49
 
48
50
  const itemIconPropsAssets = useMemo<ItemIconProps["asset"]>(
49
51
  () =>
@@ -87,9 +87,7 @@ export const SortableList = ({
87
87
  const [localData, setLocalData] = useState(sortableData);
88
88
 
89
89
  useEffect(() => {
90
- setLocalData((localData) =>
91
- localData !== sortableData ? sortableData : localData
92
- );
90
+ setLocalData(sortableData);
93
91
  }, [sortableData]);
94
92
 
95
93
  const handleDragEnd = useCallback(
@@ -142,6 +140,7 @@ export const SortableList = ({
142
140
  >
143
141
  {renderHeader}
144
142
  <Sortable.Grid
143
+ key={`sortable-grid-${localData.length}`}
145
144
  scrollableRef={scrollableRef}
146
145
  customHandle
147
146
  columns={columns}
@@ -72,3 +72,33 @@ describe("BottomSheetDragArea", () => {
72
72
  expect(screen.getByTestId("child")).toBeTruthy();
73
73
  });
74
74
  });
75
+
76
+ describe("BottomSheetDragArea.web", () => {
77
+ it("renders children bare, matching the no-sheet path web always takes", () => {
78
+ const {
79
+ BottomSheetDragArea: WebDragArea,
80
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
81
+ } = require("../BottomSheetDragArea.web");
82
+
83
+ render(
84
+ <WebDragArea>
85
+ <Text testID="child">hi</Text>
86
+ </WebDragArea>
87
+ );
88
+
89
+ expect(screen.queryByTestId("drag-pan")).toBeNull();
90
+ expect(screen.getByTestId("child")).toBeTruthy();
91
+ });
92
+
93
+ it("does not pull react-native-gesture-handler into web bundles", () => {
94
+ jest.isolateModules(() => {
95
+ jest.doMock("react-native-gesture-handler", () => {
96
+ throw new Error(
97
+ "react-native-gesture-handler must stay out of web bundles"
98
+ );
99
+ });
100
+
101
+ expect(() => require("../BottomSheetDragArea.web")).not.toThrow();
102
+ });
103
+ });
104
+ });