@royaloperahouse/harmonic 1.0.5-c → 1.0.5-d

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.
@@ -1,19 +1,77 @@
1
1
  import { FunctionComponent } from 'react';
2
- import { IconNameType, TCustomStrategyTabsFilterProps, ThemeColor } from '../../../types';
3
- export interface ICustomConfig {
4
- selectIcon: IconNameType;
5
- backgroundColor: {
6
- select: ThemeColor;
7
- unselect: ThemeColor;
8
- };
9
- textColor: {
10
- select: ThemeColor;
11
- unselect: ThemeColor;
12
- };
13
- hoveredColor: ThemeColor;
14
- pressedColor: ThemeColor;
15
- }
16
- declare const CustomStrategyTabsFilter: FunctionComponent<TCustomStrategyTabsFilterProps & {
17
- customViewConfig?: ICustomConfig;
18
- }>;
2
+ import { TCustomStrategyTabsFilterProps } from '../../../types';
3
+ /**
4
+ * A horizontally scrollable tabs filter component used to display
5
+ * selectable strategy tabs with configurable styling and selection behavior.
6
+ *
7
+ * Features:
8
+ * - Supports both single-select and multi-select tab scenarios
9
+ * - Displays an optional icon on selected tabs
10
+ * - Allows customization of colors and selected icon through `customViewConfig`
11
+ * - Applies default styling when configuration values are omitted
12
+ * - Emits the clicked tab item through `onClick`
13
+ *
14
+ * @component
15
+ *
16
+ * @param {TCustomStrategyTabsFilterProps['items']} items
17
+ * Collection of tabs to render.
18
+ *
19
+ * @param {string} [className]
20
+ * Optional CSS class name applied to the root scroll container.
21
+ *
22
+ * @param {<T>(item: TCustomStrategyTabsFilterProps['items'][number]) => T} onClick
23
+ * Generic callback invoked when a tab is clicked.
24
+ *
25
+ * @param [customViewConfig]
26
+ * Optional visual configuration used to customize:
27
+ * - selected tab icon
28
+ * - selected/unselected background colors
29
+ * - selected/unselected text colors
30
+ * - hover color
31
+ * - pressed color
32
+ *
33
+ * Any omitted configuration values will fall back to the component defaults.
34
+ *
35
+ * @returns { React.JSX.Element}
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * <CustomStrategyTabsFilter
40
+ * items={[
41
+ * {
42
+ * id: 'all',
43
+ * text: 'All',
44
+ * isSelected: true,
45
+ * allowedSelectedWith: [],
46
+ * },
47
+ * {
48
+ * id: 'open',
49
+ * text: 'Open',
50
+ * isSelected: false,
51
+ * },
52
+ * ]}
53
+ * onClick={(item) => console.log(item)}
54
+ * />
55
+ * ```
56
+ *
57
+ * @example
58
+ * ```tsx
59
+ * <CustomStrategyTabsFilter
60
+ * items={items}
61
+ * onClick={handleFilterClick}
62
+ * customViewConfig={{
63
+ * selectIcon: 'Check',
64
+ * backgroundColor: {
65
+ * select: 'primary',
66
+ * unselect: 'base-white',
67
+ * },
68
+ * textColor: {
69
+ * select: 'base-white',
70
+ * unselect: 'base-black',
71
+ * },
72
+ * }}
73
+ * />
74
+ * ```
75
+ */
76
+ declare const CustomStrategyTabsFilter: FunctionComponent<TCustomStrategyTabsFilterProps>;
19
77
  export default CustomStrategyTabsFilter;
@@ -1,16 +1,6 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  import { IHighlightsCarouselProps } from '../../../../types/carousel';
3
- import { HarmonicSize, TypographyLevel } from '../../../../types/typography';
4
- interface IDefaultConfig {
5
- title: {
6
- className: string;
7
- size?: HarmonicSize | undefined;
8
- titleSemanticLevel: TypographyLevel;
9
- };
10
- }
11
3
  declare const HighlightsCarousel: FunctionComponent<IHighlightsCarouselProps & Partial<{
12
4
  titleFontFamily: 'Victor' | 'Grey' | undefined;
13
- }> & {
14
- customConfig?: Partial<IDefaultConfig> | undefined;
15
- }>;
5
+ }>>;
16
6
  export default HighlightsCarousel;
@@ -7364,20 +7364,81 @@ var TabsContainerWrapper = /*#__PURE__*/styled__default.div(_templateObject2$C |
7364
7364
  var StyledTab = /*#__PURE__*/styled__default(PrimaryButton)(_templateObject3$p || (_templateObject3$p = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 1px solid var(--color-base-black);\n min-width: fit-content;\n\n :hover {\n color: var(--color-base-white);\n }\n"])));
7365
7365
 
7366
7366
  var _excluded$j = ["text", "id", "isSelected"];
7367
- var defaultConfig = {
7368
- selectIcon: 'Confirm',
7369
- backgroundColor: {
7370
- select: 'base-black',
7371
- unselect: 'base-white'
7372
- },
7373
- textColor: {
7374
- select: 'base-white',
7375
- unselect: 'base-black'
7376
- },
7377
- hoveredColor: 'base-black',
7378
- pressedColor: 'black-pressed'
7379
- };
7367
+ /**
7368
+ * A horizontally scrollable tabs filter component used to display
7369
+ * selectable strategy tabs with configurable styling and selection behavior.
7370
+ *
7371
+ * Features:
7372
+ * - Supports both single-select and multi-select tab scenarios
7373
+ * - Displays an optional icon on selected tabs
7374
+ * - Allows customization of colors and selected icon through `customViewConfig`
7375
+ * - Applies default styling when configuration values are omitted
7376
+ * - Emits the clicked tab item through `onClick`
7377
+ *
7378
+ * @component
7379
+ *
7380
+ * @param {TCustomStrategyTabsFilterProps['items']} items
7381
+ * Collection of tabs to render.
7382
+ *
7383
+ * @param {string} [className]
7384
+ * Optional CSS class name applied to the root scroll container.
7385
+ *
7386
+ * @param {<T>(item: TCustomStrategyTabsFilterProps['items'][number]) => T} onClick
7387
+ * Generic callback invoked when a tab is clicked.
7388
+ *
7389
+ * @param [customViewConfig]
7390
+ * Optional visual configuration used to customize:
7391
+ * - selected tab icon
7392
+ * - selected/unselected background colors
7393
+ * - selected/unselected text colors
7394
+ * - hover color
7395
+ * - pressed color
7396
+ *
7397
+ * Any omitted configuration values will fall back to the component defaults.
7398
+ *
7399
+ * @returns { React.JSX.Element}
7400
+ *
7401
+ * @example
7402
+ * ```tsx
7403
+ * <CustomStrategyTabsFilter
7404
+ * items={[
7405
+ * {
7406
+ * id: 'all',
7407
+ * text: 'All',
7408
+ * isSelected: true,
7409
+ * allowedSelectedWith: [],
7410
+ * },
7411
+ * {
7412
+ * id: 'open',
7413
+ * text: 'Open',
7414
+ * isSelected: false,
7415
+ * },
7416
+ * ]}
7417
+ * onClick={(item) => console.log(item)}
7418
+ * />
7419
+ * ```
7420
+ *
7421
+ * @example
7422
+ * ```tsx
7423
+ * <CustomStrategyTabsFilter
7424
+ * items={items}
7425
+ * onClick={handleFilterClick}
7426
+ * customViewConfig={{
7427
+ * selectIcon: 'Check',
7428
+ * backgroundColor: {
7429
+ * select: 'primary',
7430
+ * unselect: 'base-white',
7431
+ * },
7432
+ * textColor: {
7433
+ * select: 'base-white',
7434
+ * unselect: 'base-black',
7435
+ * },
7436
+ * }}
7437
+ * />
7438
+ * ```
7439
+ */
7380
7440
  var CustomStrategyTabsFilter = function CustomStrategyTabsFilter(_ref) {
7441
+ var _customViewConfig$bac, _customViewConfig$bac2, _customViewConfig$tex, _customViewConfig$tex2;
7381
7442
  var items = _ref.items,
7382
7443
  className = _ref.className,
7383
7444
  onClick = _ref.onClick,
@@ -7385,7 +7446,20 @@ var CustomStrategyTabsFilter = function CustomStrategyTabsFilter(_ref) {
7385
7446
  var handleClick = React__default.useCallback(function (item) {
7386
7447
  onClick(item);
7387
7448
  }, [onClick]);
7388
- var config = customViewConfig ? _extends({}, defaultConfig, customViewConfig) : defaultConfig;
7449
+ // in case of any partially passed configuration, config defaults non defined
7450
+ var config = {
7451
+ selectIcon: (customViewConfig == null ? void 0 : customViewConfig.selectIcon) || 'Confirm',
7452
+ backgroundColor: {
7453
+ select: (customViewConfig == null || (_customViewConfig$bac = customViewConfig.backgroundColor) == null ? void 0 : _customViewConfig$bac.select) || 'base-black',
7454
+ unselect: (customViewConfig == null || (_customViewConfig$bac2 = customViewConfig.backgroundColor) == null ? void 0 : _customViewConfig$bac2.unselect) || 'base-white'
7455
+ },
7456
+ textColor: {
7457
+ select: (customViewConfig == null || (_customViewConfig$tex = customViewConfig.textColor) == null ? void 0 : _customViewConfig$tex.select) || 'base-white',
7458
+ unselect: (customViewConfig == null || (_customViewConfig$tex2 = customViewConfig.textColor) == null ? void 0 : _customViewConfig$tex2.unselect) || 'base-black'
7459
+ },
7460
+ hoveredColor: (customViewConfig == null ? void 0 : customViewConfig.hoveredColor) || 'base-black',
7461
+ pressedColor: (customViewConfig == null ? void 0 : customViewConfig.pressedColor) || 'black-pressed'
7462
+ };
7389
7463
  return /*#__PURE__*/React__default.createElement(ScrollContainer, {
7390
7464
  className: className
7391
7465
  }, /*#__PURE__*/React__default.createElement(TabsContainerWrapper, null, items.map(function (item) {
@@ -12622,7 +12696,7 @@ var Carousel = function Carousel(_ref) {
12622
12696
  return (_swipeRef$current$has = (_swipeRef$current = swipeRef.current) == null ? void 0 : _swipeRef$current.hasNext()) != null ? _swipeRef$current$has : childrenCount > 1;
12623
12697
  });
12624
12698
  }
12625
- }, [childrenCount]);
12699
+ }, [childrenCount, infinite]);
12626
12700
  React.useEffect(function () {
12627
12701
  if (type !== exports.CarouselType.Image) return undefined;
12628
12702
  var handleFullscreenChange = function handleFullscreenChange() {
@@ -13000,23 +13074,18 @@ var SwipeCarousel = function SwipeCarousel(_ref2) {
13000
13074
  };
13001
13075
 
13002
13076
  var titleHierarchyMap = /*#__PURE__*/new Map([[1, 'h1'], [2, 'h2'], [3, 'h3']]);
13003
- // Default confic might be exteneded in case on any other changes
13004
- var defaultCarouselConfig = {
13005
- title: {
13006
- size: 'medium',
13007
- className: TYPOGRAPHY_CLASS_NAME,
13008
- titleSemanticLevel: 2
13009
- }
13010
- };
13011
13077
  var HighlightsCarousel = function HighlightsCarousel(_ref) {
13012
- var _customConfig$title, _customConfig$title2, _customConfig$title3;
13013
13078
  var logo = _ref.logo,
13014
13079
  carouselTitle = _ref.carouselTitle,
13015
13080
  slides = _ref.slides,
13016
- titleSemanticLevel = _ref.titleSemanticLevel,
13081
+ _ref$titleSemanticLev = _ref.titleSemanticLevel,
13082
+ titleSemanticLevel = _ref$titleSemanticLev === void 0 ? 2 : _ref$titleSemanticLev,
13017
13083
  className = _ref.className,
13018
13084
  titleFontFamily = _ref.titleFontFamily,
13019
- customConfig = _ref.customConfig;
13085
+ _ref$titleSize = _ref.titleSize,
13086
+ titleSize = _ref$titleSize === void 0 ? 'medium' : _ref$titleSize,
13087
+ _ref$titleClassName = _ref.titleClassName,
13088
+ titleClassName = _ref$titleClassName === void 0 ? TYPOGRAPHY_CLASS_NAME : _ref$titleClassName;
13020
13089
  var slidesMedia = React.useMemo(function () {
13021
13090
  return slides.map(function (_ref2) {
13022
13091
  var mediaContent = _ref2.mediaContent;
@@ -13034,8 +13103,7 @@ var HighlightsCarousel = function HighlightsCarousel(_ref) {
13034
13103
  return !isVideoSlide(slide);
13035
13104
  });
13036
13105
  var carouselTitleId = "highlights-carousel-title-" + carouselTitle;
13037
- var semanticLevel = titleSemanticLevel || (customConfig == null || (_customConfig$title = customConfig.title) == null ? void 0 : _customConfig$title.titleSemanticLevel);
13038
- var titleSemanticLevelValue = semanticLevel && titleHierarchyMap.has(semanticLevel) ? titleHierarchyMap.get(semanticLevel) : titleHierarchyMap.get(defaultCarouselConfig.title.titleSemanticLevel);
13106
+ var titleSemanticLevelValue = titleHierarchyMap.get(titleSemanticLevel);
13039
13107
  var carouselRef = React.useRef(null);
13040
13108
  var onNext = function onNext() {
13041
13109
  var _carouselRef$current;
@@ -13059,10 +13127,10 @@ var HighlightsCarousel = function HighlightsCarousel(_ref) {
13059
13127
  }, /*#__PURE__*/React__default.createElement(HeaderWrapper, {
13060
13128
  id: carouselTitleId
13061
13129
  }, /*#__PURE__*/React__default.createElement(HarmonicHeader, {
13062
- className: (customConfig == null || (_customConfig$title2 = customConfig.title) == null ? void 0 : _customConfig$title2.className) || defaultCarouselConfig.title.className,
13063
- size: (customConfig == null || (_customConfig$title3 = customConfig.title) == null ? void 0 : _customConfig$title3.size) || defaultCarouselConfig.title.size,
13130
+ size: titleSize,
13064
13131
  serif: isVictorTitleFont,
13065
- hierarchy: titleSemanticLevelValue
13132
+ hierarchy: titleSemanticLevelValue,
13133
+ className: titleClassName
13066
13134
  }, carouselTitle))), hasMultipleSlides && (/*#__PURE__*/React__default.createElement(RotatorButtonsWrapperMobile$1, null, /*#__PURE__*/React__default.createElement(RotatorButtons, {
13067
13135
  onClickNext: onNext,
13068
13136
  onClickPrev: onPrev