@royaloperahouse/harmonic 1.0.1-f → 1.0.1-g
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 +3 -7
- package/dist/harmonic.cjs.development.js +63 -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 +63 -20
- package/dist/harmonic.esm.js.map +1 -1
- package/dist/types/modalWindow.d.ts +4 -0
- package/dist/types/types.d.ts +24 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
## [Proposed: 1.0.2]
|
|
2
|
-
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
- Accessibility fixes to CastFilter component
|
|
6
|
-
|
|
7
|
-
## [0.19.3]
|
|
8
|
-
- Carousel title realignment following font change
|
|
2
|
+
- CastFilter: fix VoiceOver selection semantics and option activation (desktop/iOS).
|
|
3
|
+
- CastFilter: add stable id-based selection support (`selectedIds`, `onSelectId`, `onApplyIds`) with backward compatibility for legacy index-based API.
|
|
4
|
+
- ModalWindow: add `closeButtonAriaLabel` and set close icon `aria-hidden="true"`.
|
|
9
5
|
|
|
10
6
|
## [1.0.1]
|
|
11
7
|
- Carousel: fix first click
|
|
@@ -6831,12 +6831,15 @@ var CastFilters = function CastFilters(_ref) {
|
|
|
6831
6831
|
listRoleDescription = _ref.listRoleDescription,
|
|
6832
6832
|
className = _ref.className,
|
|
6833
6833
|
onSelect = _ref.onSelect,
|
|
6834
|
+
onSelectId = _ref.onSelectId,
|
|
6834
6835
|
onApply = _ref.onApply,
|
|
6836
|
+
onApplyIds = _ref.onApplyIds,
|
|
6835
6837
|
onClear = _ref.onClear,
|
|
6836
6838
|
_ref$greyscale = _ref.greyscale,
|
|
6837
6839
|
greyscale = _ref$greyscale === void 0 ? false : _ref$greyscale,
|
|
6838
6840
|
_ref$selectedIndices = _ref.selectedIndices,
|
|
6839
|
-
selectedIndices = _ref$selectedIndices === void 0 ? [] : _ref$selectedIndices
|
|
6841
|
+
selectedIndices = _ref$selectedIndices === void 0 ? [] : _ref$selectedIndices,
|
|
6842
|
+
selectedIds = _ref.selectedIds;
|
|
6840
6843
|
var _useViewport = useViewport(),
|
|
6841
6844
|
isMobile = _useViewport.isMobile;
|
|
6842
6845
|
var castWrapperRef = React.useRef(null);
|
|
@@ -6938,15 +6941,51 @@ var CastFilters = function CastFilters(_ref) {
|
|
|
6938
6941
|
isDraggingRef.current = false;
|
|
6939
6942
|
hasDraggedRef.current = false;
|
|
6940
6943
|
}, [isMobile]);
|
|
6941
|
-
var
|
|
6944
|
+
var getCastItemSelectionId = React.useCallback(function (person) {
|
|
6945
|
+
if (person.id !== undefined && person.id !== null) return String(person.id);
|
|
6946
|
+
if (person.slug !== undefined && person.slug !== null) return String(person.slug);
|
|
6947
|
+
return person.name;
|
|
6948
|
+
}, []);
|
|
6949
|
+
var isIdSelectionMode = selectedIds !== undefined;
|
|
6950
|
+
var selectedIdsSet = React.useMemo(function () {
|
|
6951
|
+
var ids = selectedIds != null ? selectedIds : [];
|
|
6952
|
+
return new Set(ids.map(function (id) {
|
|
6953
|
+
return String(id);
|
|
6954
|
+
}));
|
|
6955
|
+
}, [selectedIds]);
|
|
6956
|
+
var selectedStateIndices = React.useMemo(function () {
|
|
6957
|
+
if (!isIdSelectionMode) return selectedIndices;
|
|
6958
|
+
return cast.flatMap(function (person, index) {
|
|
6959
|
+
var itemId = getCastItemSelectionId(person);
|
|
6960
|
+
return selectedIdsSet.has(itemId) ? [index] : [];
|
|
6961
|
+
});
|
|
6962
|
+
}, [cast, getCastItemSelectionId, isIdSelectionMode, selectedIdsSet, selectedIndices]);
|
|
6963
|
+
var selectedStateIds = React.useMemo(function () {
|
|
6964
|
+
if (isIdSelectionMode) {
|
|
6965
|
+
return cast.filter(function (person) {
|
|
6966
|
+
return selectedIdsSet.has(getCastItemSelectionId(person));
|
|
6967
|
+
}).map(function (person) {
|
|
6968
|
+
return getCastItemSelectionId(person);
|
|
6969
|
+
});
|
|
6970
|
+
}
|
|
6971
|
+
return selectedIndices.map(function (index) {
|
|
6972
|
+
return cast[index];
|
|
6973
|
+
}).filter(function (person) {
|
|
6974
|
+
return person !== undefined;
|
|
6975
|
+
}).map(function (person) {
|
|
6976
|
+
return getCastItemSelectionId(person);
|
|
6977
|
+
});
|
|
6978
|
+
}, [cast, getCastItemSelectionId, isIdSelectionMode, selectedIdsSet, selectedIndices]);
|
|
6979
|
+
var handleClick = React__default.useCallback(function (index, itemId, onClick) {
|
|
6942
6980
|
if (hasDraggedRef.current) return;
|
|
6981
|
+
if (onSelectId) onSelectId(itemId);
|
|
6943
6982
|
if (onSelect) onSelect(index);
|
|
6944
6983
|
if (onClick) onClick();
|
|
6945
|
-
}, [onSelect]);
|
|
6946
|
-
var handlePersonKeydown = React__default.useCallback(function (e, index, onClick) {
|
|
6984
|
+
}, [onSelect, onSelectId]);
|
|
6985
|
+
var handlePersonKeydown = React__default.useCallback(function (e, index, itemId, onClick) {
|
|
6947
6986
|
if (e.key === 'Enter' || e.key === ' ' || e.key === 'Spacebar') {
|
|
6948
6987
|
e.preventDefault();
|
|
6949
|
-
handleClick(index, onClick);
|
|
6988
|
+
handleClick(index, itemId, onClick);
|
|
6950
6989
|
}
|
|
6951
6990
|
}, [handleClick]);
|
|
6952
6991
|
var handleClearKeydown = React__default.useCallback(function (e) {
|
|
@@ -6961,21 +7000,20 @@ var CastFilters = function CastFilters(_ref) {
|
|
|
6961
7000
|
image = person.image,
|
|
6962
7001
|
_onClick = person.onClick,
|
|
6963
7002
|
ariaLabel = person['aria-label'];
|
|
6964
|
-
var
|
|
7003
|
+
var personSelectionId = getCastItemSelectionId(person);
|
|
7004
|
+
var isSelected = isIdSelectionMode ? selectedIdsSet.has(personSelectionId) : selectedIndices.includes(index);
|
|
6965
7005
|
var personImage = image || placeholderImage || defaultPlaceholderImage;
|
|
6966
7006
|
return /*#__PURE__*/React__default.createElement(PersonWrapper, {
|
|
6967
|
-
key:
|
|
7007
|
+
key: personSelectionId,
|
|
6968
7008
|
"aria-selected": isSelected,
|
|
6969
|
-
"aria-label": ariaLabel
|
|
6970
|
-
"aria-posinset": index + 1,
|
|
6971
|
-
"aria-setsize": cast.length,
|
|
7009
|
+
"aria-label": ariaLabel != null ? ariaLabel : name,
|
|
6972
7010
|
role: "option",
|
|
6973
7011
|
tabIndex: 0,
|
|
6974
7012
|
onClick: function onClick() {
|
|
6975
|
-
return handleClick(index, _onClick);
|
|
7013
|
+
return handleClick(index, personSelectionId, _onClick);
|
|
6976
7014
|
},
|
|
6977
7015
|
onKeyDown: function onKeyDown(e) {
|
|
6978
|
-
return handlePersonKeydown(e, index, _onClick);
|
|
7016
|
+
return handlePersonKeydown(e, index, personSelectionId, _onClick);
|
|
6979
7017
|
}
|
|
6980
7018
|
}, /*#__PURE__*/React__default.createElement(PersonToggle, {
|
|
6981
7019
|
isSelected: isSelected
|
|
@@ -7017,7 +7055,8 @@ var CastFilters = function CastFilters(_ref) {
|
|
|
7017
7055
|
ref: castWrapperRef,
|
|
7018
7056
|
role: "listbox",
|
|
7019
7057
|
"aria-roledescription": listRoleDescription != null ? listRoleDescription : 'filter list',
|
|
7020
|
-
"aria-
|
|
7058
|
+
"aria-label": "filter list",
|
|
7059
|
+
"aria-multiselectable": "true",
|
|
7021
7060
|
onMouseDown: handleMouseDown,
|
|
7022
7061
|
onMouseMove: handleMouseMove,
|
|
7023
7062
|
onMouseUp: handleMouseUp,
|
|
@@ -7028,14 +7067,15 @@ var CastFilters = function CastFilters(_ref) {
|
|
|
7028
7067
|
ref: swipeRef,
|
|
7029
7068
|
onOverflowChange: handleOverflowChange,
|
|
7030
7069
|
limitDragToNavigableRange: true
|
|
7031
|
-
}, getPersonCards())))), showActionButtonsSection && (/*#__PURE__*/React__default.createElement(ActionButtons, null,
|
|
7070
|
+
}, getPersonCards())))), showActionButtonsSection && (/*#__PURE__*/React__default.createElement(ActionButtons, null, selectedStateIndices.length === 0 && emptySelectionText && (/*#__PURE__*/React__default.createElement(BodyCopyHarmonic, {
|
|
7032
7071
|
size: "medium",
|
|
7033
7072
|
className: "mobile-only"
|
|
7034
|
-
}, emptySelectionText)),
|
|
7073
|
+
}, emptySelectionText)), selectedStateIndices.length === 0 && !emptySelectionText && /*#__PURE__*/React__default.createElement(EmptySelectionTextSpacer, null), selectedStateIndices.length > 0 && (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, (onApply || onApplyIds) && (/*#__PURE__*/React__default.createElement(PrimaryButton, {
|
|
7035
7074
|
onClick: function onClick() {
|
|
7036
|
-
|
|
7075
|
+
if (onApply) onApply(selectedStateIndices);
|
|
7076
|
+
if (onApplyIds) onApplyIds(selectedStateIds);
|
|
7037
7077
|
}
|
|
7038
|
-
}, ctaText != null ? ctaText : 'Apply'), onClear && (/*#__PURE__*/React__default.createElement(TextLink, {
|
|
7078
|
+
}, ctaText != null ? ctaText : 'Apply')), onClear && (/*#__PURE__*/React__default.createElement(TextLink, {
|
|
7039
7079
|
tabIndex: 0,
|
|
7040
7080
|
role: "button",
|
|
7041
7081
|
onClick: onClear,
|
|
@@ -12214,7 +12254,7 @@ var CloseButton = /*#__PURE__*/styled__default.button(_templateObject2$19 || (_t
|
|
|
12214
12254
|
var ContentWrapper$3 = /*#__PURE__*/styled__default.div(_templateObject3$V || (_templateObject3$V = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
|
|
12215
12255
|
var Overlay = /*#__PURE__*/styled__default(Grid)(_templateObject4$N || (_templateObject4$N = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n align-content: center;\n background-color: rgba(0, 0, 0, 0.4);\n"])));
|
|
12216
12256
|
|
|
12217
|
-
var _excluded$s = ["isOpen", "setIsOpen", "children", "appElementId"];
|
|
12257
|
+
var _excluded$s = ["isOpen", "setIsOpen", "children", "appElementId", "closeButtonAriaLabel"];
|
|
12218
12258
|
var MAX_Z_INDEX = 9999999999;
|
|
12219
12259
|
if (Modal.defaultStyles.content) {
|
|
12220
12260
|
Modal.defaultStyles.content.position = 'static';
|
|
@@ -12288,6 +12328,8 @@ var ModalWindow = function ModalWindow(_ref) {
|
|
|
12288
12328
|
setIsOpen = _ref.setIsOpen,
|
|
12289
12329
|
children = _ref.children,
|
|
12290
12330
|
appElementId = _ref.appElementId,
|
|
12331
|
+
_ref$closeButtonAriaL = _ref.closeButtonAriaLabel,
|
|
12332
|
+
closeButtonAriaLabel = _ref$closeButtonAriaL === void 0 ? 'Close modal window' : _ref$closeButtonAriaL,
|
|
12291
12333
|
modalProps = _objectWithoutPropertiesLoose(_ref, _excluded$s);
|
|
12292
12334
|
var isMobile = useMobile();
|
|
12293
12335
|
var customStyles = {
|
|
@@ -12320,10 +12362,11 @@ var ModalWindow = function ModalWindow(_ref) {
|
|
|
12320
12362
|
columnSpanSmallDevice: 14
|
|
12321
12363
|
}, /*#__PURE__*/React__default.createElement(InnerModal, null, /*#__PURE__*/React__default.createElement(CloseButton, {
|
|
12322
12364
|
onClick: closeModalHandler,
|
|
12323
|
-
"aria-label":
|
|
12365
|
+
"aria-label": closeButtonAriaLabel,
|
|
12324
12366
|
tabIndex: 0
|
|
12325
12367
|
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
12326
|
-
iconName: "Close"
|
|
12368
|
+
iconName: "Close",
|
|
12369
|
+
"aria-hidden": "true"
|
|
12327
12370
|
})), /*#__PURE__*/React__default.createElement(ContentWrapper$3, null, children))), /*#__PURE__*/React__default.createElement(ScrollLock, null)));
|
|
12328
12371
|
};
|
|
12329
12372
|
|