@royaloperahouse/harmonic 1.0.5-c → 1.0.5-e

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [1.0.5-e]
2
+ - PrimaryButton hover only for device detected hover functionality
3
+
4
+
1
5
  ## [1.0.5-c]
2
6
  - Harmonic :
3
7
  - Added new CustomStrategy filter
@@ -8,6 +12,8 @@
8
12
  - CastFilter: prevent duplicate screen reader announcements for actor images and ensure tapping an actor image ring toggles selection.
9
13
 
10
14
  ## [Proposed: 1.0.4]
15
+
16
+ ## [1.0.4]
11
17
  - Castfilter: fix NDVA issues
12
18
 
13
19
  ## [1.0.3]
@@ -1,19 +1,70 @@
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
- }>;
1
+ import React from 'react';
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
+ * Called when a tab is clicked. Receives the full clicked item (including
24
+ * `allowedSelectedWith`). The parent is responsible for computing the next
25
+ * `items` array and passing it back down with updated `isSelected` values.
26
+ * as long as no return statement `type` is inferred automatically as void
27
+ *
28
+ * @param [customViewConfig]
29
+ * Optional visual configuration used to customize:
30
+ * - selected tab icon
31
+ * - selected/unselected background colors
32
+ * - selected/unselected text colors
33
+ * - hover color
34
+ * - pressed color
35
+ *
36
+ * Any omitted configuration values will fall back to the component defaults.
37
+ *
38
+ * @returns { React.JSX.Element}
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * * @example Controlled selection with custom rules
43
+ * * The component does not manage selection itself. The parent owns `items` (including
44
+ * * `isSelected`) and updates that state in `onClick`. Use `allowedSelectedWith` on each
45
+ * * item to describe which other tab IDs may stay selected when that tab is chosen.
46
+ * *
47
+ * * ```tsx
48
+ * * const [items, setItems] = useState<TCustomStrategyTabsFilterItem[]>([
49
+ * * { id: 'all', text: 'All events', isSelected: true, allowedSelectedWith: [] },
50
+ * * { id: 'opera', text: 'Opera', isSelected: false, allowedSelectedWith: ['ballet'] },
51
+ * * { id: 'ballet', text: 'Ballet', isSelected: false, allowedSelectedWith: ['opera'] },
52
+ * * ]);
53
+ * *
54
+ * * const handleClick = (clickedItem: TCustomStrategyTabsFilterItem) => {
55
+ * * setItems((current) =>
56
+ * * current.map((item) => {
57
+ * * if (item.id === clickedItem.id) {
58
+ * * return { ...item, isSelected: !item.isSelected };
59
+ * * }
60
+ * *
61
+ * * const mayStaySelected = clickedItem.allowedSelectedWith?.includes(item.id);
62
+ * * return { ...item, isSelected: mayStaySelected ? !item.isSelected : false };
63
+ * * })
64
+ * * );
65
+ * * };
66
+ * *
67
+ * * return <CustomStrategyTabsFilter items={items} onClick={handleClick} />;
68
+ */
69
+ declare const CustomStrategyTabsFilter: ({ items, className, onClick, customViewConfig, }: TCustomStrategyTabsFilterProps) => React.JSX.Element;
19
70
  export default CustomStrategyTabsFilter;
@@ -1,6 +1,4 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  import { ICarouselProps } from '../../../../types/carousel';
3
- declare const Carousel: FunctionComponent<ICarouselProps & Partial<{
4
- titleFontFamily: 'Victor' | 'Grey' | undefined;
5
- }>>;
3
+ declare const Carousel: FunctionComponent<ICarouselProps>;
6
4
  export default Carousel;
@@ -1,16 +1,4 @@
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
- declare const HighlightsCarousel: FunctionComponent<IHighlightsCarouselProps & Partial<{
12
- titleFontFamily: 'Victor' | 'Grey' | undefined;
13
- }> & {
14
- customConfig?: Partial<IDefaultConfig> | undefined;
15
- }>;
3
+ declare const HighlightsCarousel: FunctionComponent<IHighlightsCarouselProps>;
16
4
  export default HighlightsCarousel;
@@ -3072,7 +3072,7 @@ var getPressedColor = function getPressedColor(_ref4) {
3072
3072
  };
3073
3073
 
3074
3074
  var _templateObject$6, _templateObject2$3;
3075
- var PrimaryButtonWrapper = /*#__PURE__*/styled__default(Button)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: ", ";\n background-color: ", ";\n border-color: ", ";\n pointer-events: ", ";\n\n path {\n fill: ", ";\n }\n\n :hover:not(:active) {\n background-color: ", ";\n border-color: ", ";\n\n path {\n fill: ", ";\n }\n }\n\n :active {\n background-color: ", ";\n border-color: ", ";\n\n path {\n fill: ", ";\n }\n }\n"])), getTextColor$1, getBackgroundColor$1, getBackgroundColor$1, getPointerEvents, getTextColor$1, getHoveredColor, getHoveredColor, getTextColor$1, getPressedColor, getPressedColor, getTextColor$1);
3075
+ var PrimaryButtonWrapper = /*#__PURE__*/styled__default(Button)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: ", ";\n background-color: ", ";\n border-color: ", ";\n pointer-events: ", ";\n\n path {\n fill: ", ";\n }\n\n @media (hover: hover) and (pointer: fine) {\n :hover:not(:active) {\n background-color: ", ";\n border-color: ", ";\n\n path {\n fill: ", ";\n }\n }\n }\n\n :active {\n background-color: ", ";\n border-color: ", ";\n\n path {\n fill: ", ";\n }\n }\n"])), getTextColor$1, getBackgroundColor$1, getBackgroundColor$1, getPointerEvents, getTextColor$1, getHoveredColor, getHoveredColor, getTextColor$1, getPressedColor, getPressedColor, getTextColor$1);
3076
3076
  var AriaDescription = /*#__PURE__*/styled__default.span(_templateObject2$3 || (_templateObject2$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n left: -9999px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n"])));
3077
3077
 
3078
3078
  var _excluded$4 = ["children", "disabled", "className"];
@@ -7364,20 +7364,74 @@ 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
+ * Called when a tab is clicked. Receives the full clicked item (including
7388
+ * `allowedSelectedWith`). The parent is responsible for computing the next
7389
+ * `items` array and passing it back down with updated `isSelected` values.
7390
+ * as long as no return statement `type` is inferred automatically as void
7391
+ *
7392
+ * @param [customViewConfig]
7393
+ * Optional visual configuration used to customize:
7394
+ * - selected tab icon
7395
+ * - selected/unselected background colors
7396
+ * - selected/unselected text colors
7397
+ * - hover color
7398
+ * - pressed color
7399
+ *
7400
+ * Any omitted configuration values will fall back to the component defaults.
7401
+ *
7402
+ * @returns { React.JSX.Element}
7403
+ *
7404
+ * @example
7405
+ * ```tsx
7406
+ * * @example Controlled selection with custom rules
7407
+ * * The component does not manage selection itself. The parent owns `items` (including
7408
+ * * `isSelected`) and updates that state in `onClick`. Use `allowedSelectedWith` on each
7409
+ * * item to describe which other tab IDs may stay selected when that tab is chosen.
7410
+ * *
7411
+ * * ```tsx
7412
+ * * const [items, setItems] = useState<TCustomStrategyTabsFilterItem[]>([
7413
+ * * { id: 'all', text: 'All events', isSelected: true, allowedSelectedWith: [] },
7414
+ * * { id: 'opera', text: 'Opera', isSelected: false, allowedSelectedWith: ['ballet'] },
7415
+ * * { id: 'ballet', text: 'Ballet', isSelected: false, allowedSelectedWith: ['opera'] },
7416
+ * * ]);
7417
+ * *
7418
+ * * const handleClick = (clickedItem: TCustomStrategyTabsFilterItem) => {
7419
+ * * setItems((current) =>
7420
+ * * current.map((item) => {
7421
+ * * if (item.id === clickedItem.id) {
7422
+ * * return { ...item, isSelected: !item.isSelected };
7423
+ * * }
7424
+ * *
7425
+ * * const mayStaySelected = clickedItem.allowedSelectedWith?.includes(item.id);
7426
+ * * return { ...item, isSelected: mayStaySelected ? !item.isSelected : false };
7427
+ * * })
7428
+ * * );
7429
+ * * };
7430
+ * *
7431
+ * * return <CustomStrategyTabsFilter items={items} onClick={handleClick} />;
7432
+ */
7380
7433
  var CustomStrategyTabsFilter = function CustomStrategyTabsFilter(_ref) {
7434
+ var _customViewConfig$bac, _customViewConfig$bac2, _customViewConfig$tex, _customViewConfig$tex2;
7381
7435
  var items = _ref.items,
7382
7436
  className = _ref.className,
7383
7437
  onClick = _ref.onClick,
@@ -7385,7 +7439,20 @@ var CustomStrategyTabsFilter = function CustomStrategyTabsFilter(_ref) {
7385
7439
  var handleClick = React__default.useCallback(function (item) {
7386
7440
  onClick(item);
7387
7441
  }, [onClick]);
7388
- var config = customViewConfig ? _extends({}, defaultConfig, customViewConfig) : defaultConfig;
7442
+ // in case of any partially passed configuration, config defaults non defined
7443
+ var config = {
7444
+ selectIcon: (customViewConfig == null ? void 0 : customViewConfig.selectIcon) || 'Confirm',
7445
+ backgroundColor: {
7446
+ select: (customViewConfig == null || (_customViewConfig$bac = customViewConfig.backgroundColor) == null ? void 0 : _customViewConfig$bac.select) || 'base-black',
7447
+ unselect: (customViewConfig == null || (_customViewConfig$bac2 = customViewConfig.backgroundColor) == null ? void 0 : _customViewConfig$bac2.unselect) || 'base-white'
7448
+ },
7449
+ textColor: {
7450
+ select: (customViewConfig == null || (_customViewConfig$tex = customViewConfig.textColor) == null ? void 0 : _customViewConfig$tex.select) || 'base-white',
7451
+ unselect: (customViewConfig == null || (_customViewConfig$tex2 = customViewConfig.textColor) == null ? void 0 : _customViewConfig$tex2.unselect) || 'base-black'
7452
+ },
7453
+ hoveredColor: (customViewConfig == null ? void 0 : customViewConfig.hoveredColor) || 'base-black',
7454
+ pressedColor: (customViewConfig == null ? void 0 : customViewConfig.pressedColor) || 'black-pressed'
7455
+ };
7389
7456
  return /*#__PURE__*/React__default.createElement(ScrollContainer, {
7390
7457
  className: className
7391
7458
  }, /*#__PURE__*/React__default.createElement(TabsContainerWrapper, null, items.map(function (item) {
@@ -12622,7 +12689,7 @@ var Carousel = function Carousel(_ref) {
12622
12689
  return (_swipeRef$current$has = (_swipeRef$current = swipeRef.current) == null ? void 0 : _swipeRef$current.hasNext()) != null ? _swipeRef$current$has : childrenCount > 1;
12623
12690
  });
12624
12691
  }
12625
- }, [childrenCount]);
12692
+ }, [childrenCount, infinite]);
12626
12693
  React.useEffect(function () {
12627
12694
  if (type !== exports.CarouselType.Image) return undefined;
12628
12695
  var handleFullscreenChange = function handleFullscreenChange() {
@@ -13000,23 +13067,18 @@ var SwipeCarousel = function SwipeCarousel(_ref2) {
13000
13067
  };
13001
13068
 
13002
13069
  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
13070
  var HighlightsCarousel = function HighlightsCarousel(_ref) {
13012
- var _customConfig$title, _customConfig$title2, _customConfig$title3;
13013
13071
  var logo = _ref.logo,
13014
13072
  carouselTitle = _ref.carouselTitle,
13015
13073
  slides = _ref.slides,
13016
- titleSemanticLevel = _ref.titleSemanticLevel,
13074
+ _ref$titleSemanticLev = _ref.titleSemanticLevel,
13075
+ titleSemanticLevel = _ref$titleSemanticLev === void 0 ? 2 : _ref$titleSemanticLev,
13017
13076
  className = _ref.className,
13018
13077
  titleFontFamily = _ref.titleFontFamily,
13019
- customConfig = _ref.customConfig;
13078
+ _ref$titleSize = _ref.titleSize,
13079
+ titleSize = _ref$titleSize === void 0 ? 'medium' : _ref$titleSize,
13080
+ _ref$titleClassName = _ref.titleClassName,
13081
+ titleClassName = _ref$titleClassName === void 0 ? TYPOGRAPHY_CLASS_NAME : _ref$titleClassName;
13020
13082
  var slidesMedia = React.useMemo(function () {
13021
13083
  return slides.map(function (_ref2) {
13022
13084
  var mediaContent = _ref2.mediaContent;
@@ -13034,8 +13096,7 @@ var HighlightsCarousel = function HighlightsCarousel(_ref) {
13034
13096
  return !isVideoSlide(slide);
13035
13097
  });
13036
13098
  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);
13099
+ var titleSemanticLevelValue = titleHierarchyMap.get(titleSemanticLevel);
13039
13100
  var carouselRef = React.useRef(null);
13040
13101
  var onNext = function onNext() {
13041
13102
  var _carouselRef$current;
@@ -13059,10 +13120,10 @@ var HighlightsCarousel = function HighlightsCarousel(_ref) {
13059
13120
  }, /*#__PURE__*/React__default.createElement(HeaderWrapper, {
13060
13121
  id: carouselTitleId
13061
13122
  }, /*#__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,
13123
+ size: titleSize,
13064
13124
  serif: isVictorTitleFont,
13065
- hierarchy: titleSemanticLevelValue
13125
+ hierarchy: titleSemanticLevelValue,
13126
+ className: titleClassName
13066
13127
  }, carouselTitle))), hasMultipleSlides && (/*#__PURE__*/React__default.createElement(RotatorButtonsWrapperMobile$1, null, /*#__PURE__*/React__default.createElement(RotatorButtons, {
13067
13128
  onClickNext: onNext,
13068
13129
  onClickPrev: onPrev