@royaloperahouse/harmonic 0.12.0-d → 0.12.0-f
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/dist/components/molecules/Accordion/Accordion.style.d.ts +3 -1
- package/dist/harmonic.cjs.development.js +79 -20
- 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 +79 -20
- package/dist/harmonic.esm.js.map +1 -1
- package/dist/types/image.d.ts +5 -9
- package/package.json +1 -1
|
@@ -4,7 +4,9 @@ export declare const AccordionContainer: import("styled-components").StyledCompo
|
|
|
4
4
|
export declare const ChildrenContainer: import("styled-components").StyledComponent<"div", any, {
|
|
5
5
|
isVisible: boolean;
|
|
6
6
|
}, never>;
|
|
7
|
-
export declare const TitleContainer: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
+
export declare const TitleContainer: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
+
hasChildren?: boolean | undefined;
|
|
9
|
+
}, never>;
|
|
8
10
|
export declare const TitleText: import("styled-components").StyledComponent<({ children, size, color, className, tag: Tag, }: import("../../../types/typography").ITaggedTypographyProps) => import("react").JSX.Element, any, {}, never>;
|
|
9
11
|
export declare const ContentContainer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../../types/typography").ITaggedTypographyProps & import("react").RefAttributes<HTMLParagraphElement>>, any, {
|
|
10
12
|
textHeight?: string | undefined;
|
|
@@ -3476,6 +3476,11 @@ var RotatorButtons = function RotatorButtons(_ref) {
|
|
|
3476
3476
|
onClickFullscreen();
|
|
3477
3477
|
}
|
|
3478
3478
|
};
|
|
3479
|
+
var onFullscreenKeyDownHandler = function onFullscreenKeyDownHandler(e) {
|
|
3480
|
+
if (e.key === 'Enter') {
|
|
3481
|
+
onClickFullscreenHandler();
|
|
3482
|
+
}
|
|
3483
|
+
};
|
|
3479
3484
|
var renderPrevIcon = function renderPrevIcon() {
|
|
3480
3485
|
return /*#__PURE__*/React__default.createElement(Icon, {
|
|
3481
3486
|
iconName: "CarouselArrow",
|
|
@@ -3518,6 +3523,7 @@ var RotatorButtons = function RotatorButtons(_ref) {
|
|
|
3518
3523
|
"data-testid": "iconnextnoavailable"
|
|
3519
3524
|
}, renderNextIcon())), showFullscreen && (/*#__PURE__*/React__default.createElement(FullscreenIconWrapper, {
|
|
3520
3525
|
onClick: onClickFullscreenHandler,
|
|
3526
|
+
onKeyDown: onFullscreenKeyDownHandler,
|
|
3521
3527
|
tabIndex: 0,
|
|
3522
3528
|
"data-testid": "iconfullscreen",
|
|
3523
3529
|
className: "carousel-icon-wrapper-fullscreen",
|
|
@@ -8126,15 +8132,21 @@ var ChildrenContainer = /*#__PURE__*/styled__default.div(_templateObject2$D || (
|
|
|
8126
8132
|
var isVisible = _ref3.isVisible;
|
|
8127
8133
|
return isVisible ? 'auto' : 'none';
|
|
8128
8134
|
}, devices.mobile);
|
|
8129
|
-
var TitleContainer$3 = /*#__PURE__*/styled__default.div(_templateObject3$r || (_templateObject3$r = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n padding-top: 28px;\n padding-bottom: 28px;\n color: var(--color-primary-black);\n\n && svg {\n width: 24px;\n height: 24px;\n }\n\n :hover {\n cursor: pointer;\n }\n"])))
|
|
8135
|
+
var TitleContainer$3 = /*#__PURE__*/styled__default.div(_templateObject3$r || (_templateObject3$r = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n padding-top: 28px;\n padding-bottom: 28px;\n color: var(--color-primary-black);\n\n && svg {\n width: 24px;\n height: 24px;\n }\n\n :hover {\n cursor: ", ";\n pointer-events: ", ";\n }\n\n @media ", " {\n padding-top: 16px;\n padding-bottom: 16px;\n }\n"])), function (_ref4) {
|
|
8136
|
+
var hasChildren = _ref4.hasChildren;
|
|
8137
|
+
return hasChildren ? 'pointer' : 'default';
|
|
8138
|
+
}, function (_ref5) {
|
|
8139
|
+
var hasChildren = _ref5.hasChildren;
|
|
8140
|
+
return hasChildren ? 'auto' : 'none';
|
|
8141
|
+
}, devices.mobile);
|
|
8130
8142
|
var TitleText$1 = /*#__PURE__*/styled__default(HarmonicSubtitle)(_templateObject4$n || (_templateObject4$n = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: calc(100% - 32px);\n"])));
|
|
8131
8143
|
var ExtendedBodyCopyHarmonic = /*#__PURE__*/styled__default(BodyCopyHarmonic)(_templateObject5$h || (_templateObject5$h = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n overflow: auto;\n transition: max-height 0.2s ease;\n font-feature-settings: var(--font-feature-settings-body);\n text-transform: var(--text-transform-body);\n"])));
|
|
8132
8144
|
var ContentContainer = /*#__PURE__*/styled__default(ExtendedBodyCopyHarmonic).withConfig({
|
|
8133
8145
|
shouldForwardProp: function shouldForwardProp(prop) {
|
|
8134
8146
|
return prop !== 'textHeight';
|
|
8135
8147
|
}
|
|
8136
|
-
})(_templateObject6$d || (_templateObject6$d = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-height: ", ";\n\n @media print {\n max-height: max-content;\n }\n\n & em {\n font-family: var(--font-family-body-italics);\n }\n\n & u {\n font-size: var(--font-size-body-1);\n font-family: var(--font-family-body);\n }\n\n @media ", " {\n transition: 100% 0.2s ease;\n }\n"])), function (
|
|
8137
|
-
var textHeight =
|
|
8148
|
+
})(_templateObject6$d || (_templateObject6$d = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-height: ", ";\n\n @media print {\n max-height: max-content;\n }\n\n & em {\n font-family: var(--font-family-body-italics);\n }\n\n & u {\n font-size: var(--font-size-body-1);\n font-family: var(--font-family-body);\n }\n\n @media ", " {\n transition: 100% 0.2s ease;\n }\n"])), function (_ref6) {
|
|
8149
|
+
var textHeight = _ref6.textHeight;
|
|
8138
8150
|
return textHeight;
|
|
8139
8151
|
}, devices.mobile);
|
|
8140
8152
|
var PrintHideWrapper = /*#__PURE__*/styled__default.div(_templateObject7$a || (_templateObject7$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n @media print {\n display: none;\n }\n"])));
|
|
@@ -8192,7 +8204,8 @@ var Accordion = function Accordion(_ref) {
|
|
|
8192
8204
|
role: "button",
|
|
8193
8205
|
"aria-label": title,
|
|
8194
8206
|
"aria-expanded": openAccordion,
|
|
8195
|
-
"aria-controls": contentContainerId
|
|
8207
|
+
"aria-controls": contentContainerId,
|
|
8208
|
+
hasChildren: !!children
|
|
8196
8209
|
}, /*#__PURE__*/React__default.createElement(TitleText$1, null, title), children && (/*#__PURE__*/React__default.createElement(PrintHideWrapper, null, /*#__PURE__*/React__default.createElement(Icon, {
|
|
8197
8210
|
iconName: iconName
|
|
8198
8211
|
})))), /*#__PURE__*/React__default.createElement(ContentContainer, {
|
|
@@ -8201,7 +8214,8 @@ var Accordion = function Accordion(_ref) {
|
|
|
8201
8214
|
textHeight: textHeight,
|
|
8202
8215
|
id: contentContainerId,
|
|
8203
8216
|
"aria-live": "polite",
|
|
8204
|
-
tag: "div"
|
|
8217
|
+
tag: "div",
|
|
8218
|
+
size: "large"
|
|
8205
8219
|
}, /*#__PURE__*/React__default.createElement(ChildrenContainer, {
|
|
8206
8220
|
isVisible: childrenVisibility
|
|
8207
8221
|
}, children)));
|
|
@@ -8782,6 +8796,7 @@ var Editorial = function Editorial(_ref) {
|
|
|
8782
8796
|
tag: "span"
|
|
8783
8797
|
}, subtitle) : null, /*#__PURE__*/React__default.createElement(EditorialText, {
|
|
8784
8798
|
tag: "div",
|
|
8799
|
+
size: "large",
|
|
8785
8800
|
dangerouslySetInnerHTML: {
|
|
8786
8801
|
__html: text
|
|
8787
8802
|
}
|
|
@@ -11353,7 +11368,7 @@ var SelectComponent$1 = function SelectComponent(_ref) {
|
|
|
11353
11368
|
};
|
|
11354
11369
|
|
|
11355
11370
|
var _templateObject$1h, _templateObject2$_;
|
|
11356
|
-
var Wrapper$8 = /*#__PURE__*/styled__default.figure(_templateObject$1h || (_templateObject$1h = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n
|
|
11371
|
+
var Wrapper$8 = /*#__PURE__*/styled__default.figure(_templateObject$1h || (_templateObject$1h = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n margin: 0;\n\n ", " {\n height: calc(100% - 34px);\n @supports not (aspect-ratio: ", ") {\n width: ", ";\n }\n\n @media ", " {\n height: calc(100% - 30px);\n @supports not (aspect-ratio: ", ") {\n width: ", ";\n }\n }\n }\n"])), StyledImageAspectRatioWrapper, function (_ref) {
|
|
11357
11372
|
var _ref$aspectRatio = _ref.aspectRatio,
|
|
11358
11373
|
aspectRatio = _ref$aspectRatio === void 0 ? exports.AspectRatio['1:1'] : _ref$aspectRatio;
|
|
11359
11374
|
return aspectRatio;
|
|
@@ -11372,38 +11387,82 @@ var Wrapper$8 = /*#__PURE__*/styled__default.figure(_templateObject$1h || (_temp
|
|
|
11372
11387
|
height = _ref4.height;
|
|
11373
11388
|
return "calc(calc(" + height + "px - 30px) * " + AspectRatioWidth[aspectRatio] + ")";
|
|
11374
11389
|
});
|
|
11375
|
-
var CaptionWrapper = /*#__PURE__*/styled__default(Caption)(_templateObject2$_ || (_templateObject2$_ = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 12px;\n height: 22px;\n font-feature-settings: var(--font-feature-settings-body);\n text-transform: var(--text-transform-body);\n word-break: var(--word-break-body);\n
|
|
11390
|
+
var CaptionWrapper = /*#__PURE__*/styled__default(Caption)(_templateObject2$_ || (_templateObject2$_ = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n && {\n margin-top: 12px;\n max-width: var(--caption-max-width, 100%);\n width: 100%;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n overflow-wrap: normal;\n }\n height: 22px;\n font-feature-settings: var(--font-feature-settings-body);\n text-transform: var(--text-transform-body);\n word-break: var(--word-break-body);\n\n @media ", " {\n height: 18px;\n }\n"])), devices.mobile);
|
|
11376
11391
|
|
|
11377
11392
|
var ImageWithCaption = function ImageWithCaption(_ref) {
|
|
11378
11393
|
var caption = _ref.caption,
|
|
11394
|
+
altText = _ref.altText,
|
|
11379
11395
|
children = _ref.children,
|
|
11380
11396
|
aspectRatio = _ref.aspectRatio;
|
|
11381
11397
|
var wrapperRef = React.useRef(null);
|
|
11398
|
+
var imgRef = React.useRef(null);
|
|
11382
11399
|
var _useState = React.useState(0),
|
|
11383
11400
|
height = _useState[0],
|
|
11384
11401
|
setHeight = _useState[1];
|
|
11402
|
+
var updateWrapperHeight = React__default.useCallback(function () {
|
|
11403
|
+
var _wrapperRef$current;
|
|
11404
|
+
setHeight((wrapperRef == null || (_wrapperRef$current = wrapperRef.current) == null ? void 0 : _wrapperRef$current.offsetHeight) || 0);
|
|
11405
|
+
}, []);
|
|
11406
|
+
var updateCaptionWidth = React__default.useCallback(function () {
|
|
11407
|
+
var img = imgRef.current;
|
|
11408
|
+
var wrapper = wrapperRef.current;
|
|
11409
|
+
if (img && wrapper) {
|
|
11410
|
+
var w = img.getBoundingClientRect().width;
|
|
11411
|
+
wrapper.style.setProperty('--caption-max-width', Math.round(w) + "px");
|
|
11412
|
+
}
|
|
11413
|
+
}, []);
|
|
11385
11414
|
React.useEffect(function () {
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
|
|
11390
|
-
|
|
11391
|
-
|
|
11415
|
+
updateWrapperHeight();
|
|
11416
|
+
updateCaptionWidth();
|
|
11417
|
+
window.addEventListener('resize', updateWrapperHeight);
|
|
11418
|
+
window.addEventListener('resize', updateCaptionWidth);
|
|
11419
|
+
var imageResizeObserver = null;
|
|
11420
|
+
if (typeof ResizeObserver !== 'undefined' && imgRef.current) {
|
|
11421
|
+
imageResizeObserver = new ResizeObserver(updateCaptionWidth);
|
|
11422
|
+
imageResizeObserver.observe(imgRef.current);
|
|
11423
|
+
}
|
|
11392
11424
|
return function () {
|
|
11393
|
-
|
|
11425
|
+
window.removeEventListener('resize', updateWrapperHeight);
|
|
11426
|
+
window.removeEventListener('resize', updateCaptionWidth);
|
|
11427
|
+
if (imageResizeObserver && imgRef.current) imageResizeObserver.unobserve(imgRef.current);
|
|
11394
11428
|
};
|
|
11395
|
-
}, []);
|
|
11429
|
+
}, [updateWrapperHeight, updateCaptionWidth]);
|
|
11430
|
+
var clonedChildren = React__default.Children.map(children, function (child) {
|
|
11431
|
+
if (! /*#__PURE__*/React__default.isValidElement(child)) return child;
|
|
11432
|
+
var childElement = child;
|
|
11433
|
+
var originalRef = child.ref;
|
|
11434
|
+
var newProps = {
|
|
11435
|
+
alt: altText,
|
|
11436
|
+
tabIndex: 0,
|
|
11437
|
+
onKeyDown: function onKeyDown(e) {
|
|
11438
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
11439
|
+
var _imgRef$current;
|
|
11440
|
+
e.preventDefault();
|
|
11441
|
+
(_imgRef$current = imgRef.current) == null || _imgRef$current.click();
|
|
11442
|
+
}
|
|
11443
|
+
var originalOnKeyDownHandler = childElement.props.onKeyDown;
|
|
11444
|
+
if (originalOnKeyDownHandler) originalOnKeyDownHandler(e);
|
|
11445
|
+
},
|
|
11446
|
+
ref: function ref(node) {
|
|
11447
|
+
imgRef.current = node;
|
|
11448
|
+
if (node) updateCaptionWidth();
|
|
11449
|
+
if (!originalRef) return;
|
|
11450
|
+
if (typeof originalRef === 'function') {
|
|
11451
|
+
originalRef(node);
|
|
11452
|
+
} else {
|
|
11453
|
+
originalRef.current = node;
|
|
11454
|
+
}
|
|
11455
|
+
}
|
|
11456
|
+
};
|
|
11457
|
+
return /*#__PURE__*/React__default.cloneElement(childElement, newProps);
|
|
11458
|
+
});
|
|
11396
11459
|
return /*#__PURE__*/React__default.createElement(Wrapper$8, {
|
|
11397
11460
|
aspectRatio: aspectRatio,
|
|
11398
11461
|
ref: wrapperRef,
|
|
11399
11462
|
height: height
|
|
11400
11463
|
}, /*#__PURE__*/React__default.createElement(ImageAspectRatioWrapper, {
|
|
11401
11464
|
aspectRatio: aspectRatio
|
|
11402
|
-
}, React__default.
|
|
11403
|
-
return /*#__PURE__*/React__default.isValidElement(child) ? /*#__PURE__*/React__default.cloneElement(child, {
|
|
11404
|
-
alt: child.props.alt || 'Visual representation'
|
|
11405
|
-
}) : child;
|
|
11406
|
-
})), caption && /*#__PURE__*/React__default.createElement(CaptionWrapper, {
|
|
11465
|
+
}, clonedChildren), caption && /*#__PURE__*/React__default.createElement(CaptionWrapper, {
|
|
11407
11466
|
tag: "figcaption"
|
|
11408
11467
|
}, caption));
|
|
11409
11468
|
};
|