@royaloperahouse/chord 1.18.0 → 1.18.1-b-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 +39 -2
- package/dist/chord.cjs.development.js +112 -14
- 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 +112 -14
- 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/helpers/devices.d.ts +1 -1
- package/dist/types/navigation.d.ts +9 -1
- package/package.json +1 -1
- package/README.GIT +0 -67
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
## [1.18.1]
|
|
2
|
+
- Fix iOS exception on VideoControls
|
|
3
|
+
|
|
1
4
|
## [1.18.0]
|
|
2
5
|
- Add Compact PageHeading component
|
|
3
6
|
|
|
@@ -16,7 +19,7 @@
|
|
|
16
19
|
- Change to pagination component to align page numbers with URL numbers.
|
|
17
20
|
|
|
18
21
|
## [1.15.0]
|
|
19
|
-
-
|
|
22
|
+
- Add Compact PageHeading component
|
|
20
23
|
|
|
21
24
|
## [1.14.0]
|
|
22
25
|
- Added standfirst functionality to Accordion/ Accordions component and theme for Schools Platform
|
|
@@ -36,21 +39,55 @@
|
|
|
36
39
|
## [1.12.0]
|
|
37
40
|
- Search: Extend ContentSummary and SearchBar components to support new search results
|
|
38
41
|
|
|
42
|
+
## [1.11.0-a]
|
|
43
|
+
- Pagination: add new component
|
|
44
|
+
|
|
39
45
|
## [1.11.0]
|
|
40
46
|
- Carousels: Rewrite logic that cuts description, to support older browsers
|
|
41
47
|
|
|
48
|
+
## [1.10.0-a]
|
|
49
|
+
- ContentSummary: make image clickable
|
|
50
|
+
|
|
42
51
|
## [1.10.0]
|
|
43
52
|
- PageHeadingImpact: Replace CSS background-image with HTML image element
|
|
44
53
|
|
|
45
54
|
## [1.9.0]
|
|
46
55
|
- Card: Add a new prop for the hover line color
|
|
56
|
+
## [1.9.0-c]
|
|
57
|
+
- ContentSummary: make image clickable
|
|
58
|
+
|
|
59
|
+
## [1.9.0-b]
|
|
60
|
+
- ContentSummary: change image size
|
|
61
|
+
- SearchBar: Export component
|
|
62
|
+
|
|
63
|
+
## [1.9.0-a]
|
|
64
|
+
- ContentSummary: change image props
|
|
65
|
+
|
|
66
|
+
## [1.9.0]
|
|
67
|
+
- Card: Add a new prop for the hover line color
|
|
68
|
+
|
|
69
|
+
## [1.8.1-h]
|
|
70
|
+
- ContentSummary: add exports
|
|
71
|
+
|
|
72
|
+
## [1.8.1-g]
|
|
73
|
+
- ContentSummary: refactor
|
|
74
|
+
|
|
75
|
+
## [1.8.1-f]
|
|
76
|
+
- ContentSummary: update conditional rendering
|
|
77
|
+
|
|
78
|
+
## [1.8.1-c]
|
|
79
|
+
- ContentSummary: update for Search results
|
|
80
|
+
- ContentSummarySection: remove
|
|
81
|
+
|
|
82
|
+
## [1.8.1-b]
|
|
83
|
+
- Card: add new prop for the line color on hover
|
|
47
84
|
|
|
48
85
|
## [1.8.0]
|
|
49
86
|
- SearchBar: Disable
|
|
50
87
|
|
|
51
88
|
## [1.7.2]
|
|
52
89
|
- Add imageAltText to Card component
|
|
53
|
-
|
|
90
|
+
|
|
54
91
|
## [1.7.0]
|
|
55
92
|
- Add new ContentSummary component
|
|
56
93
|
- Add new ContentSummarySection component
|
|
@@ -3500,8 +3500,28 @@ var VolumeControlsWrapper = /*#__PURE__*/styled__default.div(_templateObject7$1
|
|
|
3500
3500
|
}, trackStyles, trackStyles, trackStyles, trackStyles, trackStyles, thumbStyes, thumbStyes, thumbStyes);
|
|
3501
3501
|
|
|
3502
3502
|
var isIOS = function isIOS() {
|
|
3503
|
-
|
|
3504
|
-
|
|
3503
|
+
try {
|
|
3504
|
+
console.warn('Do not use this on server side rendering, it may throw an error.');
|
|
3505
|
+
if (typeof navigator === undefined) return false;
|
|
3506
|
+
return ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform) || // iPad on iOS 13 detection
|
|
3507
|
+
navigator.userAgent.includes('Mac') && 'ontouchend' in document;
|
|
3508
|
+
} catch (e) {
|
|
3509
|
+
console.warn('Error checking if device is iOS.');
|
|
3510
|
+
return false;
|
|
3511
|
+
}
|
|
3512
|
+
}; // React hook version of isIOS
|
|
3513
|
+
|
|
3514
|
+
|
|
3515
|
+
var useIOS = function useIOS() {
|
|
3516
|
+
var _useState = React.useState(false),
|
|
3517
|
+
IOS = _useState[0],
|
|
3518
|
+
setIOS = _useState[1];
|
|
3519
|
+
|
|
3520
|
+
React.useEffect(function () {
|
|
3521
|
+
if (typeof navigator === undefined) return;
|
|
3522
|
+
setIOS(isIOS());
|
|
3523
|
+
}, []);
|
|
3524
|
+
return IOS;
|
|
3505
3525
|
};
|
|
3506
3526
|
|
|
3507
3527
|
var VideoControls = function VideoControls(_ref) {
|
|
@@ -3523,12 +3543,12 @@ var VideoControls = function VideoControls(_ref) {
|
|
|
3523
3543
|
volume = _React$useState3[0],
|
|
3524
3544
|
setVolume = _React$useState3[1];
|
|
3525
3545
|
|
|
3546
|
+
var isIOS = useIOS();
|
|
3547
|
+
|
|
3526
3548
|
var getVideoElement = function getVideoElement() {
|
|
3527
3549
|
return document.querySelector("#" + videoElementId);
|
|
3528
|
-
};
|
|
3529
|
-
|
|
3550
|
+
};
|
|
3530
3551
|
|
|
3531
|
-
var iOS = isIOS();
|
|
3532
3552
|
var handlePlay = React.useCallback(function () {
|
|
3533
3553
|
var video = getVideoElement();
|
|
3534
3554
|
if (!video) return;
|
|
@@ -3581,7 +3601,7 @@ var VideoControls = function VideoControls(_ref) {
|
|
|
3581
3601
|
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
3582
3602
|
iconName: !playing ? 'Play' : 'Pause'
|
|
3583
3603
|
})), /*#__PURE__*/React__default.createElement(VolumeControlsWrapper, {
|
|
3584
|
-
volumeHidden:
|
|
3604
|
+
volumeHidden: isIOS
|
|
3585
3605
|
}, /*#__PURE__*/React__default.createElement(VideoMute, {
|
|
3586
3606
|
id: "mute",
|
|
3587
3607
|
className: "video-mute-button",
|
|
@@ -3592,7 +3612,7 @@ var VideoControls = function VideoControls(_ref) {
|
|
|
3592
3612
|
"data-testid": "mute-icon",
|
|
3593
3613
|
iconName: muted ? 'Muted' : 'Volume',
|
|
3594
3614
|
color: "white"
|
|
3595
|
-
})), !
|
|
3615
|
+
})), !isIOS && /*#__PURE__*/React__default.createElement(VideoVolume, {
|
|
3596
3616
|
id: "vol-control",
|
|
3597
3617
|
type: "range",
|
|
3598
3618
|
min: "0",
|
|
@@ -3657,12 +3677,12 @@ var _templateObject$t;
|
|
|
3657
3677
|
var NavTopContainer$1 = /*#__PURE__*/styled__default.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);
|
|
3658
3678
|
|
|
3659
3679
|
var _templateObject$u, _templateObject2$f, _templateObject3$9, _templateObject4$5;
|
|
3660
|
-
var BasketContainer = /*#__PURE__*/styled__default.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) {
|
|
3680
|
+
var BasketContainer = /*#__PURE__*/styled__default.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) {
|
|
3661
3681
|
var selected = _ref.selected,
|
|
3662
3682
|
colorPrimary = _ref.colorPrimary;
|
|
3663
3683
|
|
|
3664
3684
|
if (selected) {
|
|
3665
|
-
return "\n border-bottom: 1px solid var(--base-color-" + colorPrimary + ");\n && a {\n color: var(--base-color-" + colorPrimary + ");\n }
|
|
3685
|
+
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 ";
|
|
3666
3686
|
}
|
|
3667
3687
|
|
|
3668
3688
|
return '';
|
|
@@ -3675,10 +3695,37 @@ var BasketContainer = /*#__PURE__*/styled__default.div(_templateObject$u || (_te
|
|
|
3675
3695
|
}, function (_ref4) {
|
|
3676
3696
|
var colorPrimary = _ref4.colorPrimary;
|
|
3677
3697
|
return colorPrimary;
|
|
3698
|
+
}, function (_ref5) {
|
|
3699
|
+
var isActive = _ref5.isActive,
|
|
3700
|
+
colorPrimary = _ref5.colorPrimary;
|
|
3701
|
+
|
|
3702
|
+
if (isActive) {
|
|
3703
|
+
return "\n && a {\n color: var(--base-color-" + colorPrimary + ");\n }\n && svg path {\n fill: var(--base-color-" + colorPrimary + ");\n }\n ";
|
|
3704
|
+
}
|
|
3705
|
+
|
|
3706
|
+
return '';
|
|
3678
3707
|
});
|
|
3679
3708
|
var SvgContainer = /*#__PURE__*/styled__default.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"])));
|
|
3680
3709
|
var NumContainer = /*#__PURE__*/styled__default.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"])));
|
|
3681
|
-
var BasketText = /*#__PURE__*/styled__default.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
|
|
3710
|
+
var BasketText = /*#__PURE__*/styled__default.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"])));
|
|
3711
|
+
|
|
3712
|
+
var checkTimeRed = function checkTimeRed(seconds) {
|
|
3713
|
+
if (seconds <= 0) {
|
|
3714
|
+
return false;
|
|
3715
|
+
}
|
|
3716
|
+
|
|
3717
|
+
return seconds / 60 <= 5;
|
|
3718
|
+
};
|
|
3719
|
+
var formatTime = function formatTime(seconds) {
|
|
3720
|
+
if (seconds > 60) {
|
|
3721
|
+
return Math.ceil(seconds / 60) + " mins";
|
|
3722
|
+
}
|
|
3723
|
+
|
|
3724
|
+
return seconds + " sec" + (seconds === 1 ? '' : 's');
|
|
3725
|
+
};
|
|
3726
|
+
var initSeconds = function initSeconds(expiryDate) {
|
|
3727
|
+
return expiryDate ? Math.ceil((new Date(expiryDate).getTime() - new Date().getTime()) / 1000) : 0;
|
|
3728
|
+
};
|
|
3682
3729
|
|
|
3683
3730
|
var Basket$1 = function Basket(_ref) {
|
|
3684
3731
|
var text = _ref.text,
|
|
@@ -3689,7 +3736,28 @@ var Basket$1 = function Basket(_ref) {
|
|
|
3689
3736
|
numItems = _ref$numItems === void 0 ? 0 : _ref$numItems,
|
|
3690
3737
|
onClick = _ref.onClick,
|
|
3691
3738
|
_ref$colorPrimary = _ref.colorPrimary,
|
|
3692
|
-
colorPrimary = _ref$colorPrimary === void 0 ? 'primary' : _ref$colorPrimary
|
|
3739
|
+
colorPrimary = _ref$colorPrimary === void 0 ? 'primary' : _ref$colorPrimary,
|
|
3740
|
+
expiryDate = _ref.expiryDate;
|
|
3741
|
+
|
|
3742
|
+
var _useState = React.useState(numItems),
|
|
3743
|
+
basketItems = _useState[0],
|
|
3744
|
+
setBasketItems = _useState[1];
|
|
3745
|
+
|
|
3746
|
+
var _useState2 = React.useState(initSeconds(expiryDate)),
|
|
3747
|
+
seconds = _useState2[0],
|
|
3748
|
+
setSeconds = _useState2[1];
|
|
3749
|
+
|
|
3750
|
+
var _useState3 = React.useState(formatTime(seconds)),
|
|
3751
|
+
countdownText = _useState3[0],
|
|
3752
|
+
setCountdownText = _useState3[1];
|
|
3753
|
+
|
|
3754
|
+
var _useState4 = React.useState(),
|
|
3755
|
+
timer = _useState4[0],
|
|
3756
|
+
setTimer = _useState4[1];
|
|
3757
|
+
|
|
3758
|
+
var _useState5 = React.useState(checkTimeRed(seconds)),
|
|
3759
|
+
isActive = _useState5[0],
|
|
3760
|
+
setIsActive = _useState5[1];
|
|
3693
3761
|
|
|
3694
3762
|
var onClickHandler = function onClickHandler() {
|
|
3695
3763
|
if (onClick) {
|
|
@@ -3703,12 +3771,42 @@ var Basket$1 = function Basket(_ref) {
|
|
|
3703
3771
|
}
|
|
3704
3772
|
};
|
|
3705
3773
|
|
|
3706
|
-
|
|
3774
|
+
React.useEffect(function () {
|
|
3775
|
+
if (timer) {
|
|
3776
|
+
clearInterval(timer); // clears the old timer before setting a new one
|
|
3777
|
+
}
|
|
3778
|
+
|
|
3779
|
+
if (!expiryDate || !numItems) return;
|
|
3780
|
+
var interval = setInterval(function () {
|
|
3781
|
+
setSeconds(function (prev) {
|
|
3782
|
+
return prev - 1;
|
|
3783
|
+
});
|
|
3784
|
+
}, 1000);
|
|
3785
|
+
setTimer(interval);
|
|
3786
|
+
return function () {
|
|
3787
|
+
return clearInterval(interval);
|
|
3788
|
+
};
|
|
3789
|
+
}, [expiryDate]);
|
|
3790
|
+
React.useEffect(function () {
|
|
3791
|
+
if (!timer) return;
|
|
3792
|
+
|
|
3793
|
+
if (seconds > 0) {
|
|
3794
|
+
setCountdownText(formatTime(seconds));
|
|
3795
|
+
setIsActive(checkTimeRed(seconds));
|
|
3796
|
+
} else {
|
|
3797
|
+
clearInterval(timer);
|
|
3798
|
+
setBasketItems(0);
|
|
3799
|
+
setCountdownText('');
|
|
3800
|
+
setIsActive(false);
|
|
3801
|
+
}
|
|
3802
|
+
}, [seconds, timer]);
|
|
3803
|
+
var empty = basketItems <= 0;
|
|
3707
3804
|
return /*#__PURE__*/React__default.createElement(BasketContainer, {
|
|
3708
3805
|
selected: selected,
|
|
3709
3806
|
onClick: onClickHandler,
|
|
3710
3807
|
onKeyDown: onKeyDownHandler,
|
|
3711
3808
|
colorPrimary: colorPrimary,
|
|
3809
|
+
isActive: isActive,
|
|
3712
3810
|
tabIndex: 0
|
|
3713
3811
|
}, /*#__PURE__*/React__default.createElement(SvgContainer, null, empty ? /*#__PURE__*/React__default.createElement(Icon, {
|
|
3714
3812
|
iconName: "Basket"
|
|
@@ -3716,9 +3814,9 @@ var Basket$1 = function Basket(_ref) {
|
|
|
3716
3814
|
iconName: "BasketFull"
|
|
3717
3815
|
}), /*#__PURE__*/React__default.createElement(NumContainer, null, /*#__PURE__*/React__default.createElement("span", {
|
|
3718
3816
|
className: "basket-num"
|
|
3719
|
-
},
|
|
3817
|
+
}, basketItems)))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(BasketText, {
|
|
3720
3818
|
"data-testid": "baskettext"
|
|
3721
|
-
},
|
|
3819
|
+
}, expiryDate ? countdownText : text)));
|
|
3722
3820
|
};
|
|
3723
3821
|
|
|
3724
3822
|
var _templateObject$v, _templateObject2$g;
|