@royaloperahouse/chord 1.18.0 → 1.18.1-dev-chord-development
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 +37 -3
- package/dist/chord.cjs.development.js +88 -19
- package/dist/chord.cjs.development.js.map +1 -1
- package/dist/chord.cjs.production.min.js +1 -1
- package/dist/chord.cjs.production.min.js.map +1 -1
- package/dist/chord.esm.js +88 -19
- package/dist/chord.esm.js.map +1 -1
- package/dist/components/atoms/Basket/Basket.d.ts +1 -1
- package/dist/components/atoms/Basket/helpers.d.ts +3 -0
- package/dist/components/atoms/VideoControls/VideoControls.style.d.ts +1 -1
- package/dist/components/molecules/PageHeading/index.d.ts +1 -1
- package/dist/types/navigation.d.ts +9 -1
- package/package.json +1 -1
- package/README.GIT +0 -67
package/dist/chord.esm.js
CHANGED
|
@@ -3503,11 +3503,6 @@ var VolumeControlsWrapper = /*#__PURE__*/styled.div(_templateObject7$1 || (_temp
|
|
|
3503
3503
|
return volumeHidden ? '40px' : '100px';
|
|
3504
3504
|
}, trackStyles, trackStyles, trackStyles, trackStyles, trackStyles, thumbStyes, thumbStyes, thumbStyes);
|
|
3505
3505
|
|
|
3506
|
-
var isIOS = function isIOS() {
|
|
3507
|
-
return ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform) || // iPad on iOS 13 detection
|
|
3508
|
-
navigator.userAgent.includes('Mac') && 'ontouchend' in document;
|
|
3509
|
-
};
|
|
3510
|
-
|
|
3511
3506
|
var VideoControls = function VideoControls(_ref) {
|
|
3512
3507
|
var videoElementId = _ref.videoElementId,
|
|
3513
3508
|
_ref$defaultMuted = _ref.defaultMuted,
|
|
@@ -3529,10 +3524,8 @@ var VideoControls = function VideoControls(_ref) {
|
|
|
3529
3524
|
|
|
3530
3525
|
var getVideoElement = function getVideoElement() {
|
|
3531
3526
|
return document.querySelector("#" + videoElementId);
|
|
3532
|
-
};
|
|
3533
|
-
|
|
3527
|
+
};
|
|
3534
3528
|
|
|
3535
|
-
var iOS = isIOS();
|
|
3536
3529
|
var handlePlay = useCallback(function () {
|
|
3537
3530
|
var video = getVideoElement();
|
|
3538
3531
|
if (!video) return;
|
|
@@ -3584,9 +3577,7 @@ var VideoControls = function VideoControls(_ref) {
|
|
|
3584
3577
|
"aria-label": !playing ? 'Play' : 'Pause'
|
|
3585
3578
|
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
3586
3579
|
iconName: !playing ? 'Play' : 'Pause'
|
|
3587
|
-
})), /*#__PURE__*/React__default.createElement(VolumeControlsWrapper, {
|
|
3588
|
-
volumeHidden: iOS
|
|
3589
|
-
}, /*#__PURE__*/React__default.createElement(VideoMute, {
|
|
3580
|
+
})), /*#__PURE__*/React__default.createElement(VolumeControlsWrapper, null, /*#__PURE__*/React__default.createElement(VideoMute, {
|
|
3590
3581
|
id: "mute",
|
|
3591
3582
|
className: "video-mute-button",
|
|
3592
3583
|
"data-testid": "video-mute-button",
|
|
@@ -3596,7 +3587,7 @@ var VideoControls = function VideoControls(_ref) {
|
|
|
3596
3587
|
"data-testid": "mute-icon",
|
|
3597
3588
|
iconName: muted ? 'Muted' : 'Volume',
|
|
3598
3589
|
color: "white"
|
|
3599
|
-
})),
|
|
3590
|
+
})), /*#__PURE__*/React__default.createElement(VideoVolume, {
|
|
3600
3591
|
id: "vol-control",
|
|
3601
3592
|
type: "range",
|
|
3602
3593
|
min: "0",
|
|
@@ -3661,12 +3652,12 @@ var _templateObject$t;
|
|
|
3661
3652
|
var NavTopContainer$1 = /*#__PURE__*/styled.div(_templateObject$t || (_templateObject$t = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n column-gap: 16px;\n justify-content: flex-end;\n height: 26px;\n\n @media ", " {\n column-gap: 8px;\n }\n"])), devices.mobile);
|
|
3662
3653
|
|
|
3663
3654
|
var _templateObject$u, _templateObject2$f, _templateObject3$9, _templateObject4$5;
|
|
3664
|
-
var BasketContainer = /*#__PURE__*/styled.div(_templateObject$u || (_templateObject$u = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: inline-flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n cursor: pointer;\n border-bottom: 1px solid var(--base-color-transparent);\n\n ", "\n\n :hover {\n border-bottom: 1px solid var(--base-color-", ");\n && a {\n color: var(--base-color-", ");\n }\n && svg path {\n fill: var(--base-color-", ");\n }\n }\n"])), function (_ref) {
|
|
3655
|
+
var BasketContainer = /*#__PURE__*/styled.div(_templateObject$u || (_templateObject$u = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: inline-flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n cursor: pointer;\n border-bottom: 1px solid var(--base-color-transparent);\n\n ", "\n\n :hover {\n border-bottom: 1px solid var(--base-color-", ");\n && a {\n color: var(--base-color-", ");\n }\n && svg path {\n fill: var(--base-color-", ");\n }\n }\n\n ", "\n"])), function (_ref) {
|
|
3665
3656
|
var selected = _ref.selected,
|
|
3666
3657
|
colorPrimary = _ref.colorPrimary;
|
|
3667
3658
|
|
|
3668
3659
|
if (selected) {
|
|
3669
|
-
return "\n border-bottom: 1px solid var(--base-color-" + colorPrimary + ");\n && a {\n color: var(--base-color-" + colorPrimary + ");\n }
|
|
3660
|
+
return "\n border-bottom: 1px solid var(--base-color-" + colorPrimary + ");\n && a {\n color: var(--base-color-" + colorPrimary + ");\n }\n && svg path {\n fill: var(--base-color-" + colorPrimary + ");\n }\n ";
|
|
3670
3661
|
}
|
|
3671
3662
|
|
|
3672
3663
|
return '';
|
|
@@ -3679,10 +3670,37 @@ var BasketContainer = /*#__PURE__*/styled.div(_templateObject$u || (_templateObj
|
|
|
3679
3670
|
}, function (_ref4) {
|
|
3680
3671
|
var colorPrimary = _ref4.colorPrimary;
|
|
3681
3672
|
return colorPrimary;
|
|
3673
|
+
}, function (_ref5) {
|
|
3674
|
+
var isActive = _ref5.isActive,
|
|
3675
|
+
colorPrimary = _ref5.colorPrimary;
|
|
3676
|
+
|
|
3677
|
+
if (isActive) {
|
|
3678
|
+
return "\n && a {\n color: var(--base-color-" + colorPrimary + ");\n }\n && svg path {\n fill: var(--base-color-" + colorPrimary + ");\n }\n ";
|
|
3679
|
+
}
|
|
3680
|
+
|
|
3681
|
+
return '';
|
|
3682
3682
|
});
|
|
3683
3683
|
var SvgContainer = /*#__PURE__*/styled.div(_templateObject2$f || (_templateObject2$f = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n\n svg {\n width: var(--navigation-large-gap);\n height: var(--navigation-large-gap);\n }\n"])));
|
|
3684
3684
|
var NumContainer = /*#__PURE__*/styled.div(_templateObject3$9 || (_templateObject3$9 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n width: 12px;\n height: 12px;\n position: absolute;\n top: 8px;\n margin-left: 6px;\n\n & .basket-num {\n color: white;\n font-size: 10px;\n font-family: var(--font-family-navigation);\n }\n"])));
|
|
3685
|
-
var BasketText = /*#__PURE__*/styled.a(_templateObject4$5 || (_templateObject4$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: var(--font-size-navigation);\n font-family: var(--font-family-navigation);\n color: var(--base-color-black);\n margin-left: 6px;\n text-decoration: none;\n
|
|
3685
|
+
var BasketText = /*#__PURE__*/styled.a(_templateObject4$5 || (_templateObject4$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: var(--font-size-navigation);\n font-family: var(--font-family-navigation);\n color: var(--base-color-black);\n margin-left: 6px;\n text-decoration: none;\n"])));
|
|
3686
|
+
|
|
3687
|
+
var checkTimeRed = function checkTimeRed(seconds) {
|
|
3688
|
+
if (seconds <= 0) {
|
|
3689
|
+
return false;
|
|
3690
|
+
}
|
|
3691
|
+
|
|
3692
|
+
return seconds / 60 <= 5;
|
|
3693
|
+
};
|
|
3694
|
+
var formatTime = function formatTime(seconds) {
|
|
3695
|
+
if (seconds > 60) {
|
|
3696
|
+
return Math.ceil(seconds / 60) + " mins";
|
|
3697
|
+
}
|
|
3698
|
+
|
|
3699
|
+
return seconds + " sec" + (seconds === 1 ? '' : 's');
|
|
3700
|
+
};
|
|
3701
|
+
var initSeconds = function initSeconds(expiryDate) {
|
|
3702
|
+
return expiryDate ? Math.ceil((new Date(expiryDate).getTime() - new Date().getTime()) / 1000) : 0;
|
|
3703
|
+
};
|
|
3686
3704
|
|
|
3687
3705
|
var Basket$1 = function Basket(_ref) {
|
|
3688
3706
|
var text = _ref.text,
|
|
@@ -3693,7 +3711,28 @@ var Basket$1 = function Basket(_ref) {
|
|
|
3693
3711
|
numItems = _ref$numItems === void 0 ? 0 : _ref$numItems,
|
|
3694
3712
|
onClick = _ref.onClick,
|
|
3695
3713
|
_ref$colorPrimary = _ref.colorPrimary,
|
|
3696
|
-
colorPrimary = _ref$colorPrimary === void 0 ? 'primary' : _ref$colorPrimary
|
|
3714
|
+
colorPrimary = _ref$colorPrimary === void 0 ? 'primary' : _ref$colorPrimary,
|
|
3715
|
+
expiryDate = _ref.expiryDate;
|
|
3716
|
+
|
|
3717
|
+
var _useState = useState(numItems),
|
|
3718
|
+
basketItems = _useState[0],
|
|
3719
|
+
setBasketItems = _useState[1];
|
|
3720
|
+
|
|
3721
|
+
var _useState2 = useState(initSeconds(expiryDate)),
|
|
3722
|
+
seconds = _useState2[0],
|
|
3723
|
+
setSeconds = _useState2[1];
|
|
3724
|
+
|
|
3725
|
+
var _useState3 = useState(formatTime(seconds)),
|
|
3726
|
+
countdownText = _useState3[0],
|
|
3727
|
+
setCountdownText = _useState3[1];
|
|
3728
|
+
|
|
3729
|
+
var _useState4 = useState(),
|
|
3730
|
+
timer = _useState4[0],
|
|
3731
|
+
setTimer = _useState4[1];
|
|
3732
|
+
|
|
3733
|
+
var _useState5 = useState(checkTimeRed(seconds)),
|
|
3734
|
+
isActive = _useState5[0],
|
|
3735
|
+
setIsActive = _useState5[1];
|
|
3697
3736
|
|
|
3698
3737
|
var onClickHandler = function onClickHandler() {
|
|
3699
3738
|
if (onClick) {
|
|
@@ -3707,12 +3746,42 @@ var Basket$1 = function Basket(_ref) {
|
|
|
3707
3746
|
}
|
|
3708
3747
|
};
|
|
3709
3748
|
|
|
3710
|
-
|
|
3749
|
+
useEffect(function () {
|
|
3750
|
+
if (timer) {
|
|
3751
|
+
clearInterval(timer); // clears the old timer before setting a new one
|
|
3752
|
+
}
|
|
3753
|
+
|
|
3754
|
+
if (!expiryDate || !numItems) return;
|
|
3755
|
+
var interval = setInterval(function () {
|
|
3756
|
+
setSeconds(function (prev) {
|
|
3757
|
+
return prev - 1;
|
|
3758
|
+
});
|
|
3759
|
+
}, 1000);
|
|
3760
|
+
setTimer(interval);
|
|
3761
|
+
return function () {
|
|
3762
|
+
return clearInterval(interval);
|
|
3763
|
+
};
|
|
3764
|
+
}, [expiryDate]);
|
|
3765
|
+
useEffect(function () {
|
|
3766
|
+
if (!timer) return;
|
|
3767
|
+
|
|
3768
|
+
if (seconds > 0) {
|
|
3769
|
+
setCountdownText(formatTime(seconds));
|
|
3770
|
+
setIsActive(checkTimeRed(seconds));
|
|
3771
|
+
} else {
|
|
3772
|
+
clearInterval(timer);
|
|
3773
|
+
setBasketItems(0);
|
|
3774
|
+
setCountdownText('');
|
|
3775
|
+
setIsActive(false);
|
|
3776
|
+
}
|
|
3777
|
+
}, [seconds, timer]);
|
|
3778
|
+
var empty = basketItems <= 0;
|
|
3711
3779
|
return /*#__PURE__*/React__default.createElement(BasketContainer, {
|
|
3712
3780
|
selected: selected,
|
|
3713
3781
|
onClick: onClickHandler,
|
|
3714
3782
|
onKeyDown: onKeyDownHandler,
|
|
3715
3783
|
colorPrimary: colorPrimary,
|
|
3784
|
+
isActive: isActive,
|
|
3716
3785
|
tabIndex: 0
|
|
3717
3786
|
}, /*#__PURE__*/React__default.createElement(SvgContainer, null, empty ? /*#__PURE__*/React__default.createElement(Icon, {
|
|
3718
3787
|
iconName: "Basket"
|
|
@@ -3720,9 +3789,9 @@ var Basket$1 = function Basket(_ref) {
|
|
|
3720
3789
|
iconName: "BasketFull"
|
|
3721
3790
|
}), /*#__PURE__*/React__default.createElement(NumContainer, null, /*#__PURE__*/React__default.createElement("span", {
|
|
3722
3791
|
className: "basket-num"
|
|
3723
|
-
},
|
|
3792
|
+
}, basketItems)))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(BasketText, {
|
|
3724
3793
|
"data-testid": "baskettext"
|
|
3725
|
-
},
|
|
3794
|
+
}, expiryDate ? countdownText : text)));
|
|
3726
3795
|
};
|
|
3727
3796
|
|
|
3728
3797
|
var _templateObject$v, _templateObject2$g;
|