@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 +6 -0
- package/dist/components/molecules/CustomStrategyTabsFilter/CustomStrategyTabsFilter.d.ts +69 -18
- package/dist/components/organisms/Carousels/Carousel/Carousel.d.ts +1 -3
- package/dist/components/organisms/Carousels/HighlightsCarousel/HighlightsCarousel.d.ts +1 -13
- package/dist/harmonic.cjs.development.js +93 -32
- package/dist/harmonic.cjs.development.js.map +1 -1
- package/dist/harmonic.cjs.production.min.js +1 -1
- package/dist/harmonic.cjs.production.min.js.map +1 -1
- package/dist/harmonic.esm.js +93 -32
- package/dist/harmonic.esm.js.map +1 -1
- package/dist/types/carousel.d.ts +11 -1
- package/dist/types/types.d.ts +43 -2
- package/package.json +1 -1
package/dist/harmonic.esm.js
CHANGED
|
@@ -3095,7 +3095,7 @@ var getPressedColor = function getPressedColor(_ref4) {
|
|
|
3095
3095
|
};
|
|
3096
3096
|
|
|
3097
3097
|
var _templateObject$6, _templateObject2$3;
|
|
3098
|
-
var PrimaryButtonWrapper = /*#__PURE__*/styled(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
|
|
3098
|
+
var PrimaryButtonWrapper = /*#__PURE__*/styled(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);
|
|
3099
3099
|
var AriaDescription = /*#__PURE__*/styled.span(_templateObject2$3 || (_templateObject2$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n left: -9999px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n"])));
|
|
3100
3100
|
|
|
3101
3101
|
var _excluded$4 = ["children", "disabled", "className"];
|
|
@@ -7391,20 +7391,74 @@ var TabsContainerWrapper = /*#__PURE__*/styled.div(_templateObject2$C || (_templ
|
|
|
7391
7391
|
var StyledTab = /*#__PURE__*/styled(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"])));
|
|
7392
7392
|
|
|
7393
7393
|
var _excluded$j = ["text", "id", "isSelected"];
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7394
|
+
/**
|
|
7395
|
+
* A horizontally scrollable tabs filter component used to display
|
|
7396
|
+
* selectable strategy tabs with configurable styling and selection behavior.
|
|
7397
|
+
*
|
|
7398
|
+
* Features:
|
|
7399
|
+
* - Supports both single-select and multi-select tab scenarios
|
|
7400
|
+
* - Displays an optional icon on selected tabs
|
|
7401
|
+
* - Allows customization of colors and selected icon through `customViewConfig`
|
|
7402
|
+
* - Applies default styling when configuration values are omitted
|
|
7403
|
+
* - Emits the clicked tab item through `onClick`
|
|
7404
|
+
*
|
|
7405
|
+
* @component
|
|
7406
|
+
*
|
|
7407
|
+
* @param {TCustomStrategyTabsFilterProps['items']} items
|
|
7408
|
+
* Collection of tabs to render.
|
|
7409
|
+
*
|
|
7410
|
+
* @param {string} [className]
|
|
7411
|
+
* Optional CSS class name applied to the root scroll container.
|
|
7412
|
+
*
|
|
7413
|
+
* @param {<T>(item: TCustomStrategyTabsFilterProps['items'][number]) => T} onClick
|
|
7414
|
+
* Called when a tab is clicked. Receives the full clicked item (including
|
|
7415
|
+
* `allowedSelectedWith`). The parent is responsible for computing the next
|
|
7416
|
+
* `items` array and passing it back down with updated `isSelected` values.
|
|
7417
|
+
* as long as no return statement `type` is inferred automatically as void
|
|
7418
|
+
*
|
|
7419
|
+
* @param [customViewConfig]
|
|
7420
|
+
* Optional visual configuration used to customize:
|
|
7421
|
+
* - selected tab icon
|
|
7422
|
+
* - selected/unselected background colors
|
|
7423
|
+
* - selected/unselected text colors
|
|
7424
|
+
* - hover color
|
|
7425
|
+
* - pressed color
|
|
7426
|
+
*
|
|
7427
|
+
* Any omitted configuration values will fall back to the component defaults.
|
|
7428
|
+
*
|
|
7429
|
+
* @returns { React.JSX.Element}
|
|
7430
|
+
*
|
|
7431
|
+
* @example
|
|
7432
|
+
* ```tsx
|
|
7433
|
+
* * @example Controlled selection with custom rules
|
|
7434
|
+
* * The component does not manage selection itself. The parent owns `items` (including
|
|
7435
|
+
* * `isSelected`) and updates that state in `onClick`. Use `allowedSelectedWith` on each
|
|
7436
|
+
* * item to describe which other tab IDs may stay selected when that tab is chosen.
|
|
7437
|
+
* *
|
|
7438
|
+
* * ```tsx
|
|
7439
|
+
* * const [items, setItems] = useState<TCustomStrategyTabsFilterItem[]>([
|
|
7440
|
+
* * { id: 'all', text: 'All events', isSelected: true, allowedSelectedWith: [] },
|
|
7441
|
+
* * { id: 'opera', text: 'Opera', isSelected: false, allowedSelectedWith: ['ballet'] },
|
|
7442
|
+
* * { id: 'ballet', text: 'Ballet', isSelected: false, allowedSelectedWith: ['opera'] },
|
|
7443
|
+
* * ]);
|
|
7444
|
+
* *
|
|
7445
|
+
* * const handleClick = (clickedItem: TCustomStrategyTabsFilterItem) => {
|
|
7446
|
+
* * setItems((current) =>
|
|
7447
|
+
* * current.map((item) => {
|
|
7448
|
+
* * if (item.id === clickedItem.id) {
|
|
7449
|
+
* * return { ...item, isSelected: !item.isSelected };
|
|
7450
|
+
* * }
|
|
7451
|
+
* *
|
|
7452
|
+
* * const mayStaySelected = clickedItem.allowedSelectedWith?.includes(item.id);
|
|
7453
|
+
* * return { ...item, isSelected: mayStaySelected ? !item.isSelected : false };
|
|
7454
|
+
* * })
|
|
7455
|
+
* * );
|
|
7456
|
+
* * };
|
|
7457
|
+
* *
|
|
7458
|
+
* * return <CustomStrategyTabsFilter items={items} onClick={handleClick} />;
|
|
7459
|
+
*/
|
|
7407
7460
|
var CustomStrategyTabsFilter = function CustomStrategyTabsFilter(_ref) {
|
|
7461
|
+
var _customViewConfig$bac, _customViewConfig$bac2, _customViewConfig$tex, _customViewConfig$tex2;
|
|
7408
7462
|
var items = _ref.items,
|
|
7409
7463
|
className = _ref.className,
|
|
7410
7464
|
onClick = _ref.onClick,
|
|
@@ -7412,7 +7466,20 @@ var CustomStrategyTabsFilter = function CustomStrategyTabsFilter(_ref) {
|
|
|
7412
7466
|
var handleClick = React__default.useCallback(function (item) {
|
|
7413
7467
|
onClick(item);
|
|
7414
7468
|
}, [onClick]);
|
|
7415
|
-
|
|
7469
|
+
// in case of any partially passed configuration, config defaults non defined
|
|
7470
|
+
var config = {
|
|
7471
|
+
selectIcon: (customViewConfig == null ? void 0 : customViewConfig.selectIcon) || 'Confirm',
|
|
7472
|
+
backgroundColor: {
|
|
7473
|
+
select: (customViewConfig == null || (_customViewConfig$bac = customViewConfig.backgroundColor) == null ? void 0 : _customViewConfig$bac.select) || 'base-black',
|
|
7474
|
+
unselect: (customViewConfig == null || (_customViewConfig$bac2 = customViewConfig.backgroundColor) == null ? void 0 : _customViewConfig$bac2.unselect) || 'base-white'
|
|
7475
|
+
},
|
|
7476
|
+
textColor: {
|
|
7477
|
+
select: (customViewConfig == null || (_customViewConfig$tex = customViewConfig.textColor) == null ? void 0 : _customViewConfig$tex.select) || 'base-white',
|
|
7478
|
+
unselect: (customViewConfig == null || (_customViewConfig$tex2 = customViewConfig.textColor) == null ? void 0 : _customViewConfig$tex2.unselect) || 'base-black'
|
|
7479
|
+
},
|
|
7480
|
+
hoveredColor: (customViewConfig == null ? void 0 : customViewConfig.hoveredColor) || 'base-black',
|
|
7481
|
+
pressedColor: (customViewConfig == null ? void 0 : customViewConfig.pressedColor) || 'black-pressed'
|
|
7482
|
+
};
|
|
7416
7483
|
return /*#__PURE__*/React__default.createElement(ScrollContainer, {
|
|
7417
7484
|
className: className
|
|
7418
7485
|
}, /*#__PURE__*/React__default.createElement(TabsContainerWrapper, null, items.map(function (item) {
|
|
@@ -12663,7 +12730,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
12663
12730
|
return (_swipeRef$current$has = (_swipeRef$current = swipeRef.current) == null ? void 0 : _swipeRef$current.hasNext()) != null ? _swipeRef$current$has : childrenCount > 1;
|
|
12664
12731
|
});
|
|
12665
12732
|
}
|
|
12666
|
-
}, [childrenCount]);
|
|
12733
|
+
}, [childrenCount, infinite]);
|
|
12667
12734
|
useEffect(function () {
|
|
12668
12735
|
if (type !== CarouselType.Image) return undefined;
|
|
12669
12736
|
var handleFullscreenChange = function handleFullscreenChange() {
|
|
@@ -13041,23 +13108,18 @@ var SwipeCarousel = function SwipeCarousel(_ref2) {
|
|
|
13041
13108
|
};
|
|
13042
13109
|
|
|
13043
13110
|
var titleHierarchyMap = /*#__PURE__*/new Map([[1, 'h1'], [2, 'h2'], [3, 'h3']]);
|
|
13044
|
-
// Default confic might be exteneded in case on any other changes
|
|
13045
|
-
var defaultCarouselConfig = {
|
|
13046
|
-
title: {
|
|
13047
|
-
size: 'medium',
|
|
13048
|
-
className: TYPOGRAPHY_CLASS_NAME,
|
|
13049
|
-
titleSemanticLevel: 2
|
|
13050
|
-
}
|
|
13051
|
-
};
|
|
13052
13111
|
var HighlightsCarousel = function HighlightsCarousel(_ref) {
|
|
13053
|
-
var _customConfig$title, _customConfig$title2, _customConfig$title3;
|
|
13054
13112
|
var logo = _ref.logo,
|
|
13055
13113
|
carouselTitle = _ref.carouselTitle,
|
|
13056
13114
|
slides = _ref.slides,
|
|
13057
|
-
|
|
13115
|
+
_ref$titleSemanticLev = _ref.titleSemanticLevel,
|
|
13116
|
+
titleSemanticLevel = _ref$titleSemanticLev === void 0 ? 2 : _ref$titleSemanticLev,
|
|
13058
13117
|
className = _ref.className,
|
|
13059
13118
|
titleFontFamily = _ref.titleFontFamily,
|
|
13060
|
-
|
|
13119
|
+
_ref$titleSize = _ref.titleSize,
|
|
13120
|
+
titleSize = _ref$titleSize === void 0 ? 'medium' : _ref$titleSize,
|
|
13121
|
+
_ref$titleClassName = _ref.titleClassName,
|
|
13122
|
+
titleClassName = _ref$titleClassName === void 0 ? TYPOGRAPHY_CLASS_NAME : _ref$titleClassName;
|
|
13061
13123
|
var slidesMedia = useMemo(function () {
|
|
13062
13124
|
return slides.map(function (_ref2) {
|
|
13063
13125
|
var mediaContent = _ref2.mediaContent;
|
|
@@ -13075,8 +13137,7 @@ var HighlightsCarousel = function HighlightsCarousel(_ref) {
|
|
|
13075
13137
|
return !isVideoSlide(slide);
|
|
13076
13138
|
});
|
|
13077
13139
|
var carouselTitleId = "highlights-carousel-title-" + carouselTitle;
|
|
13078
|
-
var
|
|
13079
|
-
var titleSemanticLevelValue = semanticLevel && titleHierarchyMap.has(semanticLevel) ? titleHierarchyMap.get(semanticLevel) : titleHierarchyMap.get(defaultCarouselConfig.title.titleSemanticLevel);
|
|
13140
|
+
var titleSemanticLevelValue = titleHierarchyMap.get(titleSemanticLevel);
|
|
13080
13141
|
var carouselRef = useRef(null);
|
|
13081
13142
|
var onNext = function onNext() {
|
|
13082
13143
|
var _carouselRef$current;
|
|
@@ -13100,10 +13161,10 @@ var HighlightsCarousel = function HighlightsCarousel(_ref) {
|
|
|
13100
13161
|
}, /*#__PURE__*/React__default.createElement(HeaderWrapper, {
|
|
13101
13162
|
id: carouselTitleId
|
|
13102
13163
|
}, /*#__PURE__*/React__default.createElement(HarmonicHeader, {
|
|
13103
|
-
|
|
13104
|
-
size: (customConfig == null || (_customConfig$title3 = customConfig.title) == null ? void 0 : _customConfig$title3.size) || defaultCarouselConfig.title.size,
|
|
13164
|
+
size: titleSize,
|
|
13105
13165
|
serif: isVictorTitleFont,
|
|
13106
|
-
hierarchy: titleSemanticLevelValue
|
|
13166
|
+
hierarchy: titleSemanticLevelValue,
|
|
13167
|
+
className: titleClassName
|
|
13107
13168
|
}, carouselTitle))), hasMultipleSlides && (/*#__PURE__*/React__default.createElement(RotatorButtonsWrapperMobile$1, null, /*#__PURE__*/React__default.createElement(RotatorButtons, {
|
|
13108
13169
|
onClickNext: onNext,
|
|
13109
13170
|
onClickPrev: onPrev
|