@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
package/dist/harmonic.esm.js
CHANGED
|
@@ -3500,6 +3500,11 @@ var RotatorButtons = function RotatorButtons(_ref) {
|
|
|
3500
3500
|
onClickFullscreen();
|
|
3501
3501
|
}
|
|
3502
3502
|
};
|
|
3503
|
+
var onFullscreenKeyDownHandler = function onFullscreenKeyDownHandler(e) {
|
|
3504
|
+
if (e.key === 'Enter') {
|
|
3505
|
+
onClickFullscreenHandler();
|
|
3506
|
+
}
|
|
3507
|
+
};
|
|
3503
3508
|
var renderPrevIcon = function renderPrevIcon() {
|
|
3504
3509
|
return /*#__PURE__*/React__default.createElement(Icon, {
|
|
3505
3510
|
iconName: "CarouselArrow",
|
|
@@ -3542,6 +3547,7 @@ var RotatorButtons = function RotatorButtons(_ref) {
|
|
|
3542
3547
|
"data-testid": "iconnextnoavailable"
|
|
3543
3548
|
}, renderNextIcon())), showFullscreen && (/*#__PURE__*/React__default.createElement(FullscreenIconWrapper, {
|
|
3544
3549
|
onClick: onClickFullscreenHandler,
|
|
3550
|
+
onKeyDown: onFullscreenKeyDownHandler,
|
|
3545
3551
|
tabIndex: 0,
|
|
3546
3552
|
"data-testid": "iconfullscreen",
|
|
3547
3553
|
className: "carousel-icon-wrapper-fullscreen",
|
|
@@ -8167,15 +8173,21 @@ var ChildrenContainer = /*#__PURE__*/styled.div(_templateObject2$D || (_template
|
|
|
8167
8173
|
var isVisible = _ref3.isVisible;
|
|
8168
8174
|
return isVisible ? 'auto' : 'none';
|
|
8169
8175
|
}, devices.mobile);
|
|
8170
|
-
var TitleContainer$3 = /*#__PURE__*/styled.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"])))
|
|
8176
|
+
var TitleContainer$3 = /*#__PURE__*/styled.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) {
|
|
8177
|
+
var hasChildren = _ref4.hasChildren;
|
|
8178
|
+
return hasChildren ? 'pointer' : 'default';
|
|
8179
|
+
}, function (_ref5) {
|
|
8180
|
+
var hasChildren = _ref5.hasChildren;
|
|
8181
|
+
return hasChildren ? 'auto' : 'none';
|
|
8182
|
+
}, devices.mobile);
|
|
8171
8183
|
var TitleText$1 = /*#__PURE__*/styled(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"])));
|
|
8172
8184
|
var ExtendedBodyCopyHarmonic = /*#__PURE__*/styled(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"])));
|
|
8173
8185
|
var ContentContainer = /*#__PURE__*/styled(ExtendedBodyCopyHarmonic).withConfig({
|
|
8174
8186
|
shouldForwardProp: function shouldForwardProp(prop) {
|
|
8175
8187
|
return prop !== 'textHeight';
|
|
8176
8188
|
}
|
|
8177
|
-
})(_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 (
|
|
8178
|
-
var textHeight =
|
|
8189
|
+
})(_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) {
|
|
8190
|
+
var textHeight = _ref6.textHeight;
|
|
8179
8191
|
return textHeight;
|
|
8180
8192
|
}, devices.mobile);
|
|
8181
8193
|
var PrintHideWrapper = /*#__PURE__*/styled.div(_templateObject7$a || (_templateObject7$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n @media print {\n display: none;\n }\n"])));
|
|
@@ -8233,7 +8245,8 @@ var Accordion = function Accordion(_ref) {
|
|
|
8233
8245
|
role: "button",
|
|
8234
8246
|
"aria-label": title,
|
|
8235
8247
|
"aria-expanded": openAccordion,
|
|
8236
|
-
"aria-controls": contentContainerId
|
|
8248
|
+
"aria-controls": contentContainerId,
|
|
8249
|
+
hasChildren: !!children
|
|
8237
8250
|
}, /*#__PURE__*/React__default.createElement(TitleText$1, null, title), children && (/*#__PURE__*/React__default.createElement(PrintHideWrapper, null, /*#__PURE__*/React__default.createElement(Icon, {
|
|
8238
8251
|
iconName: iconName
|
|
8239
8252
|
})))), /*#__PURE__*/React__default.createElement(ContentContainer, {
|
|
@@ -8242,7 +8255,8 @@ var Accordion = function Accordion(_ref) {
|
|
|
8242
8255
|
textHeight: textHeight,
|
|
8243
8256
|
id: contentContainerId,
|
|
8244
8257
|
"aria-live": "polite",
|
|
8245
|
-
tag: "div"
|
|
8258
|
+
tag: "div",
|
|
8259
|
+
size: "large"
|
|
8246
8260
|
}, /*#__PURE__*/React__default.createElement(ChildrenContainer, {
|
|
8247
8261
|
isVisible: childrenVisibility
|
|
8248
8262
|
}, children)));
|
|
@@ -8823,6 +8837,7 @@ var Editorial = function Editorial(_ref) {
|
|
|
8823
8837
|
tag: "span"
|
|
8824
8838
|
}, subtitle) : null, /*#__PURE__*/React__default.createElement(EditorialText, {
|
|
8825
8839
|
tag: "div",
|
|
8840
|
+
size: "large",
|
|
8826
8841
|
dangerouslySetInnerHTML: {
|
|
8827
8842
|
__html: text
|
|
8828
8843
|
}
|
|
@@ -11394,7 +11409,7 @@ var SelectComponent$1 = function SelectComponent(_ref) {
|
|
|
11394
11409
|
};
|
|
11395
11410
|
|
|
11396
11411
|
var _templateObject$1h, _templateObject2$_;
|
|
11397
|
-
var Wrapper$8 = /*#__PURE__*/styled.figure(_templateObject$1h || (_templateObject$1h = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n
|
|
11412
|
+
var Wrapper$8 = /*#__PURE__*/styled.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) {
|
|
11398
11413
|
var _ref$aspectRatio = _ref.aspectRatio,
|
|
11399
11414
|
aspectRatio = _ref$aspectRatio === void 0 ? AspectRatio['1:1'] : _ref$aspectRatio;
|
|
11400
11415
|
return aspectRatio;
|
|
@@ -11413,38 +11428,82 @@ var Wrapper$8 = /*#__PURE__*/styled.figure(_templateObject$1h || (_templateObjec
|
|
|
11413
11428
|
height = _ref4.height;
|
|
11414
11429
|
return "calc(calc(" + height + "px - 30px) * " + AspectRatioWidth[aspectRatio] + ")";
|
|
11415
11430
|
});
|
|
11416
|
-
var CaptionWrapper = /*#__PURE__*/styled(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
|
|
11431
|
+
var CaptionWrapper = /*#__PURE__*/styled(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);
|
|
11417
11432
|
|
|
11418
11433
|
var ImageWithCaption = function ImageWithCaption(_ref) {
|
|
11419
11434
|
var caption = _ref.caption,
|
|
11435
|
+
altText = _ref.altText,
|
|
11420
11436
|
children = _ref.children,
|
|
11421
11437
|
aspectRatio = _ref.aspectRatio;
|
|
11422
11438
|
var wrapperRef = useRef(null);
|
|
11439
|
+
var imgRef = useRef(null);
|
|
11423
11440
|
var _useState = useState(0),
|
|
11424
11441
|
height = _useState[0],
|
|
11425
11442
|
setHeight = _useState[1];
|
|
11443
|
+
var updateWrapperHeight = React__default.useCallback(function () {
|
|
11444
|
+
var _wrapperRef$current;
|
|
11445
|
+
setHeight((wrapperRef == null || (_wrapperRef$current = wrapperRef.current) == null ? void 0 : _wrapperRef$current.offsetHeight) || 0);
|
|
11446
|
+
}, []);
|
|
11447
|
+
var updateCaptionWidth = React__default.useCallback(function () {
|
|
11448
|
+
var img = imgRef.current;
|
|
11449
|
+
var wrapper = wrapperRef.current;
|
|
11450
|
+
if (img && wrapper) {
|
|
11451
|
+
var w = img.getBoundingClientRect().width;
|
|
11452
|
+
wrapper.style.setProperty('--caption-max-width', Math.round(w) + "px");
|
|
11453
|
+
}
|
|
11454
|
+
}, []);
|
|
11426
11455
|
useEffect(function () {
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11456
|
+
updateWrapperHeight();
|
|
11457
|
+
updateCaptionWidth();
|
|
11458
|
+
window.addEventListener('resize', updateWrapperHeight);
|
|
11459
|
+
window.addEventListener('resize', updateCaptionWidth);
|
|
11460
|
+
var imageResizeObserver = null;
|
|
11461
|
+
if (typeof ResizeObserver !== 'undefined' && imgRef.current) {
|
|
11462
|
+
imageResizeObserver = new ResizeObserver(updateCaptionWidth);
|
|
11463
|
+
imageResizeObserver.observe(imgRef.current);
|
|
11464
|
+
}
|
|
11433
11465
|
return function () {
|
|
11434
|
-
|
|
11466
|
+
window.removeEventListener('resize', updateWrapperHeight);
|
|
11467
|
+
window.removeEventListener('resize', updateCaptionWidth);
|
|
11468
|
+
if (imageResizeObserver && imgRef.current) imageResizeObserver.unobserve(imgRef.current);
|
|
11435
11469
|
};
|
|
11436
|
-
}, []);
|
|
11470
|
+
}, [updateWrapperHeight, updateCaptionWidth]);
|
|
11471
|
+
var clonedChildren = React__default.Children.map(children, function (child) {
|
|
11472
|
+
if (! /*#__PURE__*/React__default.isValidElement(child)) return child;
|
|
11473
|
+
var childElement = child;
|
|
11474
|
+
var originalRef = child.ref;
|
|
11475
|
+
var newProps = {
|
|
11476
|
+
alt: altText,
|
|
11477
|
+
tabIndex: 0,
|
|
11478
|
+
onKeyDown: function onKeyDown(e) {
|
|
11479
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
11480
|
+
var _imgRef$current;
|
|
11481
|
+
e.preventDefault();
|
|
11482
|
+
(_imgRef$current = imgRef.current) == null || _imgRef$current.click();
|
|
11483
|
+
}
|
|
11484
|
+
var originalOnKeyDownHandler = childElement.props.onKeyDown;
|
|
11485
|
+
if (originalOnKeyDownHandler) originalOnKeyDownHandler(e);
|
|
11486
|
+
},
|
|
11487
|
+
ref: function ref(node) {
|
|
11488
|
+
imgRef.current = node;
|
|
11489
|
+
if (node) updateCaptionWidth();
|
|
11490
|
+
if (!originalRef) return;
|
|
11491
|
+
if (typeof originalRef === 'function') {
|
|
11492
|
+
originalRef(node);
|
|
11493
|
+
} else {
|
|
11494
|
+
originalRef.current = node;
|
|
11495
|
+
}
|
|
11496
|
+
}
|
|
11497
|
+
};
|
|
11498
|
+
return /*#__PURE__*/React__default.cloneElement(childElement, newProps);
|
|
11499
|
+
});
|
|
11437
11500
|
return /*#__PURE__*/React__default.createElement(Wrapper$8, {
|
|
11438
11501
|
aspectRatio: aspectRatio,
|
|
11439
11502
|
ref: wrapperRef,
|
|
11440
11503
|
height: height
|
|
11441
11504
|
}, /*#__PURE__*/React__default.createElement(ImageAspectRatioWrapper, {
|
|
11442
11505
|
aspectRatio: aspectRatio
|
|
11443
|
-
}, React__default.
|
|
11444
|
-
return /*#__PURE__*/React__default.isValidElement(child) ? /*#__PURE__*/React__default.cloneElement(child, {
|
|
11445
|
-
alt: child.props.alt || 'Visual representation'
|
|
11446
|
-
}) : child;
|
|
11447
|
-
})), caption && /*#__PURE__*/React__default.createElement(CaptionWrapper, {
|
|
11506
|
+
}, clonedChildren), caption && /*#__PURE__*/React__default.createElement(CaptionWrapper, {
|
|
11448
11507
|
tag: "figcaption"
|
|
11449
11508
|
}, caption));
|
|
11450
11509
|
};
|