@geotab/zenith 3.10.0-beta.1 → 3.10.0-beta.2
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/README.md +9 -6
- package/dist/betaPill/betaPill.d.ts +9 -4
- package/dist/betaPill/betaPill.js +8 -7
- package/dist/card/card.d.ts +2 -1
- package/dist/card/card.js +4 -2
- package/dist/card/components/title.d.ts +3 -1
- package/dist/card/components/title.js +5 -3
- package/dist/checkboxListWithAction/checkboxListWithAction.js +2 -1
- package/dist/commonStyles/colors/colorsConstant.d.ts +44 -0
- package/dist/commonStyles/colors/colorsConstant.js +361 -0
- package/dist/commonStyles/typography/components/typographyItem.d.ts +8 -0
- package/dist/commonStyles/typography/components/typographyItem.js +45 -0
- package/dist/dropdown/dropdown.js +1 -1
- package/dist/dropdownRaw/dropdownList.d.ts +4 -2
- package/dist/dropdownRaw/dropdownList.js +15 -36
- package/dist/dropdownRaw/dropdownRaw.js +9 -23
- package/dist/dropdownRaw/stateReducer/stateReducer.d.ts +1 -0
- package/dist/dropdownRaw/stateReducer/stateReducer.js +13 -14
- package/dist/dropdownRaw/stateReducer/stateReducerHelper.d.ts +1 -2
- package/dist/dropdownRaw/stateReducer/stateReducerHelper.js +5 -12
- package/dist/headerTitle/headerTitle.d.ts +9 -3
- package/dist/headerTitle/headerTitle.js +3 -2
- package/dist/index.css +34 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/testHelpers/fakeFetch.d.ts +1 -0
- package/dist/testHelpers/fakeFetch.js +14 -0
- package/dist/testHelpers/geotab-axe/index.d.ts +2 -0
- package/dist/testHelpers/geotab-axe/index.js +81 -0
- package/dist/testHelpers/jestRetry.d.ts +0 -0
- package/dist/testHelpers/jestRetry.js +2 -0
- package/dist/testHelpers/renderAsync.d.ts +2 -0
- package/dist/testHelpers/renderAsync.js +12 -0
- package/dist/testHelpers/setReadonlyHtmlProperty.d.ts +1 -0
- package/dist/testHelpers/setReadonlyHtmlProperty.js +15 -0
- package/dist/testHelpers/styled-output.d.ts +30 -0
- package/dist/testHelpers/styled-output.js +42 -0
- package/esm/betaPill/betaPill.d.ts +9 -4
- package/esm/betaPill/betaPill.js +8 -7
- package/esm/card/card.d.ts +2 -1
- package/esm/card/card.js +4 -2
- package/esm/card/components/title.d.ts +3 -1
- package/esm/card/components/title.js +5 -3
- package/esm/checkboxListWithAction/checkboxListWithAction.js +2 -1
- package/esm/dropdown/dropdown.js +1 -1
- package/esm/dropdownRaw/dropdownList.d.ts +4 -2
- package/esm/dropdownRaw/dropdownList.js +15 -36
- package/esm/dropdownRaw/dropdownRaw.js +10 -24
- package/esm/dropdownRaw/stateReducer/stateReducer.d.ts +1 -0
- package/esm/dropdownRaw/stateReducer/stateReducer.js +14 -15
- package/esm/dropdownRaw/stateReducer/stateReducerHelper.d.ts +1 -2
- package/esm/dropdownRaw/stateReducer/stateReducerHelper.js +3 -10
- package/esm/headerTitle/headerTitle.d.ts +9 -3
- package/esm/headerTitle/headerTitle.js +3 -2
- package/esm/index.d.ts +3 -1
- package/esm/index.js +1 -0
- package/package.json +1 -1
|
@@ -174,33 +174,6 @@ injectString("zh-Hans", "Apply", "\u5E94\u7528");
|
|
|
174
174
|
injectString("zh-TW", "Apply", "\u5957\u7528");
|
|
175
175
|
injectString("ro-RO", "Apply", "Aplica\u021Bi");
|
|
176
176
|
injectString("ar-SA", "Apply", "\u062A\u0637\u0628\u064A\u0642");
|
|
177
|
-
injectString("cs", "Deselect all", "Zru\u0161it v\xFDb\u011Br v\u0161ech");
|
|
178
|
-
injectString("da-DK", "Deselect all", "Frav\xE6lg alle");
|
|
179
|
-
injectString("de", "Deselect all", "Auswahl f\xFCr alle aufheben");
|
|
180
|
-
injectString("en", "Deselect all", "Deselect all");
|
|
181
|
-
injectString("es", "Deselect all", "Deseleccionar todo");
|
|
182
|
-
injectString("fi-FI", "Deselect all", "Poista kaikki valinnat");
|
|
183
|
-
injectString("fr", "Deselect all", "D\xE9s\xE9lectionner tout");
|
|
184
|
-
injectString("fr-FR", "Deselect all", "D\xE9s\xE9lectionner tout");
|
|
185
|
-
injectString("hu-HU", "Deselect all", "Ne v\xE1lassz ki semmit.");
|
|
186
|
-
injectString("id", "Deselect all", "Batalkan pilih semua");
|
|
187
|
-
injectString("it", "Deselect all", "Deselezionare tutto");
|
|
188
|
-
injectString("ja", "Deselect all", "\u3059\u3079\u3066\u3092\u9078\u629E\u89E3\u9664");
|
|
189
|
-
injectString("ko-KR", "Deselect all", "\uBAA8\uB450 \uC120\uD0DD \uCDE8\uC18C");
|
|
190
|
-
injectString("ms", "Deselect all", "Nyahpilih semua");
|
|
191
|
-
injectString("nb-NO", "Deselect all", "Fjern alle valg");
|
|
192
|
-
injectString("nl", "Deselect all", "Alles deselecteren");
|
|
193
|
-
injectString("pl", "Deselect all", "Usu\u0144 wyb\xF3r wszystkich");
|
|
194
|
-
injectString("pt-BR", "Deselect all", "Desmarcar tudo");
|
|
195
|
-
injectString("pt-PT", "Deselect all", "Desmarcar tudo");
|
|
196
|
-
injectString("sk-SK", "Deselect all", "Zru\u0161 v\xFDber v\u0161etk\xFDch.");
|
|
197
|
-
injectString("sv", "Deselect all", "Avmarkera alla");
|
|
198
|
-
injectString("th", "Deselect all", "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01\u0E01\u0E32\u0E23\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14");
|
|
199
|
-
injectString("tr", "Deselect all", "T\xFCm\xFCn\xFCn se\xE7imini iptal et");
|
|
200
|
-
injectString("zh-Hans", "Deselect all", "\u53D6\u6D88\u5168\u9009");
|
|
201
|
-
injectString("zh-TW", "Deselect all", "\u53D6\u6D88\u5168\u9078");
|
|
202
|
-
injectString("ro-RO", "Deselect all", "Deselecta\u021Bi tot");
|
|
203
|
-
injectString("ar-SA", "Deselect all", "\u0625\u0644\u063A\u0627\u0621 \u062A\u062D\u062F\u064A\u062F \u0627\u0644\u0643\u0644");
|
|
204
177
|
injectString("cs", "Select all", "Vybrat v\u0161e");
|
|
205
178
|
injectString("da-DK", "Select all", "V\xE6lg alle");
|
|
206
179
|
injectString("de", "Select all", "Alle ausw\xE4hlen");
|
|
@@ -359,7 +332,8 @@ const DropdownList = ({
|
|
|
359
332
|
onSelect,
|
|
360
333
|
onSingleSelect,
|
|
361
334
|
listData,
|
|
362
|
-
|
|
335
|
+
isSelectAllActive,
|
|
336
|
+
shouldBlockItems,
|
|
363
337
|
backButtonName,
|
|
364
338
|
width,
|
|
365
339
|
minWidth,
|
|
@@ -388,7 +362,7 @@ const DropdownList = ({
|
|
|
388
362
|
const internalListId = (0, react_1.useId)();
|
|
389
363
|
const selectListId = listId || internalListId;
|
|
390
364
|
const handleSelectAllClick = () => {
|
|
391
|
-
onSelectAllClick(
|
|
365
|
+
onSelectAllClick(isSelectAllActive === true);
|
|
392
366
|
};
|
|
393
367
|
const handleBackButtonKeyDown = (0, react_1.useCallback)(event => {
|
|
394
368
|
if (event.key === "ArrowLeft") {
|
|
@@ -416,13 +390,14 @@ const DropdownList = ({
|
|
|
416
390
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
417
391
|
forceSelection ? onSingleSelect(false, newActiveEl || activeValue) : onSingleSelect(false, newActiveEl);
|
|
418
392
|
}, [activeValue, forceSelection, onSingleSelect]);
|
|
419
|
-
const selectButtonLabel =
|
|
420
|
-
const getActionButton = (label, title, icon, isDisabled, clickHandler, size, onKeyDown) => (0, jsx_runtime_1.jsx)("button", {
|
|
393
|
+
const selectButtonLabel = translate("Select all");
|
|
394
|
+
const getActionButton = (label, title, icon, isDisabled, clickHandler, size, onKeyDown, isSelected) => (0, jsx_runtime_1.jsx)("button", {
|
|
421
395
|
type: "button",
|
|
422
396
|
disabled: isDisabled,
|
|
423
397
|
onClick: clickHandler,
|
|
424
398
|
onKeyDown: onKeyDown,
|
|
425
|
-
|
|
399
|
+
"aria-pressed": isSelected,
|
|
400
|
+
className: (0, classNames_1.classNames)(["zen-dropdown-list__item zen-dropdown-list__item--interactive zen-dropdown-list__action-button zen-dropdown-list__action-button-back", isSelected ? "zen-dropdown-list__action-button--selected" : ""]),
|
|
426
401
|
title: title,
|
|
427
402
|
children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
|
|
428
403
|
children: [react_1.default.createElement(icon, {
|
|
@@ -458,11 +433,15 @@ const DropdownList = ({
|
|
|
458
433
|
});
|
|
459
434
|
return values;
|
|
460
435
|
};
|
|
436
|
+
const multiselectOptions = shouldBlockItems ? listData.map(item => Object.assign(Object.assign({}, item), {
|
|
437
|
+
blocked: true,
|
|
438
|
+
checked: false
|
|
439
|
+
})) : listData;
|
|
461
440
|
return (0, jsx_runtime_1.jsx)("div", {
|
|
462
441
|
className: "zen-dropdown-list__elements",
|
|
463
442
|
ref: listElementRef,
|
|
464
443
|
children: isMultiselect ? (0, jsx_runtime_1.jsx)(checkboxListWithAction_1.CheckboxListWithAction, {
|
|
465
|
-
options:
|
|
444
|
+
options: multiselectOptions,
|
|
466
445
|
label: "",
|
|
467
446
|
onChange: handleChange,
|
|
468
447
|
onClick: handleClick
|
|
@@ -478,7 +457,7 @@ const DropdownList = ({
|
|
|
478
457
|
value: createValue(listData, activeValue)
|
|
479
458
|
})
|
|
480
459
|
});
|
|
481
|
-
}, [listElementRef, isMultiselect, listData, handleChange, handleClick, handleSingleChange, translate, selectListId, forceSelection, activeValue]);
|
|
460
|
+
}, [listElementRef, isMultiselect, shouldBlockItems, listData, handleChange, handleClick, handleSingleChange, translate, selectListId, forceSelection, activeValue]);
|
|
482
461
|
return (0, jsx_runtime_1.jsxs)("div", Object.assign({
|
|
483
462
|
className: (0, classNames_1.classNames)(["zen-dropdown-list", driveComponentClass || ""])
|
|
484
463
|
}, styleWidth, {
|
|
@@ -496,7 +475,7 @@ const DropdownList = ({
|
|
|
496
475
|
}) : null, backButtonName ? (0, jsx_runtime_1.jsx)("div", {
|
|
497
476
|
className: "zen-dropdown-list__item-wrapper",
|
|
498
477
|
children: getActionButton(backButtonName, translate("Back"), iconBackArrow_1.IconBackArrow, false, onBackButtonClick, "large", handleBackButtonKeyDown)
|
|
499
|
-
}) : null, hasSelectAllButton ? getActionButton(selectButtonLabel, selectButtonLabel, iconCheckRadio_1.IconCheckRadio, !!isSelectAllButtonDisable, handleSelectAllClick, isDrive ? "huger" : "huge") : null, listDataComponent, isWithFooter ? (0, jsx_runtime_1.jsxs)("div", {
|
|
478
|
+
}) : null, hasSelectAllButton ? getActionButton(selectButtonLabel, selectButtonLabel, iconCheckRadio_1.IconCheckRadio, !!isSelectAllButtonDisable, handleSelectAllClick, isDrive ? "huger" : "huge", undefined, isSelectAllActive) : null, listDataComponent, isWithFooter ? (0, jsx_runtime_1.jsxs)("div", {
|
|
500
479
|
className: "zen-dropdown-list__footer",
|
|
501
480
|
children: [(0, jsx_runtime_1.jsx)(button_1.Button, {
|
|
502
481
|
onClick: isMultiselect ? onClearClick : handleClearClick,
|
|
@@ -525,4 +504,4 @@ const DropdownList = ({
|
|
|
525
504
|
}));
|
|
526
505
|
};
|
|
527
506
|
exports.DropdownList = DropdownList;
|
|
528
|
-
exports.TRANSLATIONS = ["Select all", "
|
|
507
|
+
exports.TRANSLATIONS = ["Select all", "Clear", "Back", "No data"];
|
|
@@ -399,23 +399,6 @@ const DropdownRaw = props => {
|
|
|
399
399
|
payload: state.currentId || state.rootId
|
|
400
400
|
});
|
|
401
401
|
}, [isFullSelectionMode, state.currentId, state.rootId]);
|
|
402
|
-
const handleSelectAllInSearch = (0, react_1.useCallback)(isAllSelect => {
|
|
403
|
-
if (isFullSelectionMode && state.isAllSelected) {
|
|
404
|
-
dispatchState({
|
|
405
|
-
type: stateActionType_1.StateActionType.DeselectItemsFromAllSelected,
|
|
406
|
-
payload: undefined
|
|
407
|
-
});
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
const dataForChange = (0, dropdownHelper_1.getDataForChange)((0, dropdownHelper_1.getListDataWithDisabled)(state.listData, state.isNestedList), state.selectedIds, isAllSelect);
|
|
411
|
-
dispatchState({
|
|
412
|
-
type: stateActionType_1.StateActionType.ChangeBulkSelection,
|
|
413
|
-
payload: {
|
|
414
|
-
itemsIds: dataForChange,
|
|
415
|
-
value: !isAllSelect
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
}, [isFullSelectionMode, state.isAllSelected, state.listData, state.isNestedList, state.selectedIds]);
|
|
419
402
|
const handleClearClick = (0, react_1.useCallback)(() => {
|
|
420
403
|
var _a, _b;
|
|
421
404
|
dispatchState({
|
|
@@ -862,13 +845,14 @@ const DropdownRaw = props => {
|
|
|
862
845
|
});
|
|
863
846
|
}
|
|
864
847
|
if (state.showList) {
|
|
865
|
-
const isSearchMode = state.inputValue && !state.currentId;
|
|
848
|
+
const isSearchMode = Boolean(state.inputValue) && !state.currentId;
|
|
866
849
|
const currentListData = (0, dropdownHelper_1.createListDataOptions)(state, translate, isSearchMode ? (0, dropdownHelper_1.sortDropdownItemArray)(state.listData, sortFn).slice(0, listLimit).filter(el => el.id !== state.rootId) :
|
|
867
850
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
868
851
|
(0, dropdownHelper_1.sortDropdownItemArray)(((_b = state.groupsMap[state.currentId || state.rootId]) === null || _b === void 0 ? void 0 : _b.children) || [], sortFn).slice(0, listLimit) || [], multiselect, currentAllSelected);
|
|
852
|
+
const selectAllActiveForCurrentLevel = state.selectAllActiveForId === (state.currentId || state.rootId);
|
|
869
853
|
return (0, jsx_runtime_1.jsx)(dropdownList_1.DropdownList, {
|
|
870
854
|
onBackButtonClick: handleBackButtonClick,
|
|
871
|
-
onSelectAllClick:
|
|
855
|
+
onSelectAllClick: handleSelectAllClick,
|
|
872
856
|
onClearClick: handleClearClick,
|
|
873
857
|
onCancelClick: handleCancelClick,
|
|
874
858
|
onApplyClick: handleApplyClick,
|
|
@@ -879,15 +863,17 @@ const DropdownRaw = props => {
|
|
|
879
863
|
backButtonName: state.currentId && state.groupsMap[state.currentId] ? (0, groupsHelper_1.getGroupDescription)(state.groupsMap[state.currentId], translate) : undefined,
|
|
880
864
|
filterName: isMobile ? undefined : filterName,
|
|
881
865
|
isAllSelected: currentAllSelected ? currentAllSelected : isSearchMode ? (0, dropdownHelper_1.isEveryItemSelected)((0, dropdownHelper_1.getListDataWithDisabled)(state.listData, state.isNestedList), state.selectedIds) : currentAllSelected === undefined ? (0, dropdownHelper_1.isAllChildrenSelected)(state, state.currentId || state.rootId) : false,
|
|
866
|
+
isSelectAllActive: isFullSelectionMode ? currentAllSelected : selectAllActiveForCurrentLevel,
|
|
867
|
+
shouldBlockItems: !state.inputValue && !isFullSelectionMode && selectAllActiveForCurrentLevel,
|
|
882
868
|
isMultiselect: multiselect,
|
|
883
869
|
forceSelection: forceSelection,
|
|
884
870
|
listData: currentListData,
|
|
885
871
|
width: width || currentWidth === 180 ? undefined : currentWidth,
|
|
886
872
|
minWidth: currentWidth,
|
|
887
|
-
hasSelectAllButton: selectAllButton && multiselect,
|
|
873
|
+
hasSelectAllButton: selectAllButton && multiselect && !state.inputValue,
|
|
888
874
|
hasApplyButton: hasApplyButton,
|
|
889
875
|
isApplyDisabled: memoizedIsApplyButtonDisabled,
|
|
890
|
-
isSelectAllButtonDisable: currentListData.length === 0 || isSearchMode
|
|
876
|
+
isSelectAllButtonDisable: currentListData.length === 0 || isSearchMode && state.isNestedList && (0, dropdownHelper_1.isAllItemsHasOneParent)(state.listData.filter(el => el.id !== state.rootId), (((_c = state.groupsMap[state.rootId]) === null || _c === void 0 ? void 0 : _c.children) || []).map(el => el.id)),
|
|
891
877
|
isClearButtonDisabled: memoizedIsClearButtonDisabled,
|
|
892
878
|
isWithFooter: memoizedWithFooter && !isMobile,
|
|
893
879
|
isMobile: isMobile,
|
|
@@ -899,7 +885,7 @@ const DropdownRaw = props => {
|
|
|
899
885
|
});
|
|
900
886
|
}
|
|
901
887
|
return null;
|
|
902
|
-
}, [state, isLoading, isQueryMode, fetchState === null || fetchState === void 0 ? void 0 : fetchState.isLoading, fetchState === null || fetchState === void 0 ? void 0 : fetchState.error, handleClearClick, handleCancelClick, handleApplyClick, hasApplyButton, memoizedWithFooter, translate, sortFn, listLimit, multiselect, currentAllSelected, handleBackButtonClick,
|
|
888
|
+
}, [state, isLoading, isQueryMode, fetchState === null || fetchState === void 0 ? void 0 : fetchState.isLoading, fetchState === null || fetchState === void 0 ? void 0 : fetchState.error, handleClearClick, handleCancelClick, handleApplyClick, hasApplyButton, memoizedWithFooter, translate, sortFn, listLimit, multiselect, currentAllSelected, handleBackButtonClick, handleSelectAllClick, handleSelect, handleChangeCurrentId, handleSingleSelection, isMobile, filterName, forceSelection, width, selectAllButton, memoizedIsApplyButtonDisabled, memoizedIsClearButtonDisabled, isCheckboxMode, handleCheckboxChange, checkboxLabel, selectListId, isFullSelectionMode]);
|
|
903
889
|
const currentStringFromSelected = isFullSelectionMode && hasApplyButton && state.globalIsAllSelected || isFullSelectionMode && !hasApplyButton && state.isAllSelected ? (0, dropdownHelper_1.getStringFromAllSelected)(state.groupsMap, translate, state.rootId) : (0, dropdownHelper_1.getStringFromSelected)(hasApplyButton ? state.globalSelectedIds : state.selectedIds, state.groupsMapSelected, translate, state.rootId);
|
|
904
890
|
const memoizedCurrentSelection = (0, react_1.useMemo)(() => showSelection && !state.inputValue ? currentStringFromSelected : "", [showSelection, state.inputValue, currentStringFromSelected]);
|
|
905
891
|
const parentTriggerWidth = ((_b = comboboxRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect().width) || 420;
|
|
@@ -997,4 +983,4 @@ const DropdownRaw = props => {
|
|
|
997
983
|
};
|
|
998
984
|
exports.DropdownRaw = DropdownRaw;
|
|
999
985
|
exports.DropdownRaw.displayName = "DropdownRaw";
|
|
1000
|
-
exports.TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "
|
|
986
|
+
exports.TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "Clear", "Back", "No data"];
|
|
@@ -77,10 +77,12 @@ function stateReducer(state, action) {
|
|
|
77
77
|
}
|
|
78
78
|
const isCurrentListNested = Object.keys(updatedGroupsMap).length > 0 &&
|
|
79
79
|
(updatedGroupsMap[exports.ROOT_GROUP_ID].children || []).some(el => el.children && el.children.length);
|
|
80
|
-
|
|
81
|
-
const
|
|
80
|
+
const groupsMapLength = Object.keys(updatedGroupsMap).length - 1;
|
|
81
|
+
const newResultsExceedListLimit = groupsMapLength >= state.listLimit;
|
|
82
|
+
const selectedInNewMap = state.selectedIds.filter(id => id in updatedGroupsMap).length;
|
|
83
|
+
const newIsAllSelected = (0, stateReducerHelper_1.computeIsAllSelected)(state.isAllSelected, state.isFullSelectionMode, newResultsExceedListLimit, groupsMapLength, selectedInNewMap);
|
|
82
84
|
const rootId = (0, stateReducerHelper_1.getRootId)(updatedGroupsMap, exports.ROOT_GROUP_ID, state.firstParentNodeIsVisible);
|
|
83
|
-
return Object.assign(Object.assign(
|
|
85
|
+
return Object.assign(Object.assign({}, state), { groupsMap: updatedGroupsMap, rootId: rootId || exports.ROOT_GROUP_ID, namelessIds: newNamelessIds, isNestedList: state.isNestedList ? state.isNestedList : isCurrentListNested, resultsExceedListLimit: newResultsExceedListLimit, isAllSelected: newIsAllSelected });
|
|
84
86
|
}
|
|
85
87
|
case stateActionType_1.StateActionType.SetListData: {
|
|
86
88
|
state.selectedIds.forEach(id => {
|
|
@@ -105,9 +107,9 @@ function stateReducer(state, action) {
|
|
|
105
107
|
case stateActionType_1.StateActionType.SetIsOpenCombo:
|
|
106
108
|
return Object.assign(Object.assign({}, state), { isOpenCombo: payload });
|
|
107
109
|
case stateActionType_1.StateActionType.ResetSelection:
|
|
108
|
-
return Object.assign(Object.assign({}, state), { selectedIds: [...state.defaultValue], isAllSelected: state.defaultValueIsAllSelected, isChecked: typeof state.isChecked === "boolean" ? state.defaultValueIsChecked || false : undefined });
|
|
110
|
+
return Object.assign(Object.assign({}, state), { selectedIds: [...state.defaultValue], isAllSelected: state.defaultValueIsAllSelected, isChecked: typeof state.isChecked === "boolean" ? state.defaultValueIsChecked || false : undefined, selectAllActiveForId: undefined });
|
|
109
111
|
case stateActionType_1.StateActionType.ResetStateToGlobal:
|
|
110
|
-
return Object.assign(Object.assign({}, state), { selectedIds: [...state.globalSelectedIds], isAllSelected: state.globalIsAllSelected, isChecked: state.globalIsChecked });
|
|
112
|
+
return Object.assign(Object.assign({}, state), { selectedIds: [...state.globalSelectedIds], isAllSelected: state.globalIsAllSelected, isChecked: state.globalIsChecked, selectAllActiveForId: undefined });
|
|
111
113
|
case stateActionType_1.StateActionType.NothingToShow:
|
|
112
114
|
return Object.assign(Object.assign({}, state), { showWaiting: false, showEmptyList: false, showList: false });
|
|
113
115
|
case stateActionType_1.StateActionType.Show:
|
|
@@ -223,8 +225,7 @@ function stateReducer(state, action) {
|
|
|
223
225
|
state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
|
|
224
226
|
}
|
|
225
227
|
});
|
|
226
|
-
|
|
227
|
-
return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) }), additionalStateUpdates);
|
|
228
|
+
return Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds), selectAllActiveForId: undefined, isAllSelected: state.isAllSelected });
|
|
228
229
|
}
|
|
229
230
|
case stateActionType_1.StateActionType.ChangeBulkSelection: {
|
|
230
231
|
const { itemsIds, value } = payload;
|
|
@@ -257,8 +258,7 @@ function stateReducer(state, action) {
|
|
|
257
258
|
state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
|
|
258
259
|
}
|
|
259
260
|
});
|
|
260
|
-
|
|
261
|
-
return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) }), additionalStateUpdates);
|
|
261
|
+
return Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds), selectAllActiveForId: undefined });
|
|
262
262
|
}
|
|
263
263
|
case stateActionType_1.StateActionType.SelectAllChildren: {
|
|
264
264
|
const currentEl = state.groupsMap[payload];
|
|
@@ -295,7 +295,7 @@ function stateReducer(state, action) {
|
|
|
295
295
|
state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
|
|
296
296
|
}
|
|
297
297
|
});
|
|
298
|
-
return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected) });
|
|
298
|
+
return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected), selectAllActiveForId: payload });
|
|
299
299
|
}
|
|
300
300
|
case stateActionType_1.StateActionType.DeselectItemsFromAllSelected: {
|
|
301
301
|
const currentEl = state.groupsMap[state.rootId];
|
|
@@ -319,7 +319,7 @@ function stateReducer(state, action) {
|
|
|
319
319
|
state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
|
|
320
320
|
}
|
|
321
321
|
});
|
|
322
|
-
return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected), isAllSelected: state.isFullSelectionMode ? false : undefined });
|
|
322
|
+
return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected), isAllSelected: state.isFullSelectionMode ? false : undefined, selectAllActiveForId: undefined });
|
|
323
323
|
}
|
|
324
324
|
case stateActionType_1.StateActionType.ToggleValueForAllSelected: {
|
|
325
325
|
const currentEl = state.groupsMap[state.rootId];
|
|
@@ -338,8 +338,7 @@ function stateReducer(state, action) {
|
|
|
338
338
|
}
|
|
339
339
|
});
|
|
340
340
|
const updatedIsAllSelectedValue = state.isFullSelectionMode ? !state.isAllSelected : undefined;
|
|
341
|
-
|
|
342
|
-
return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: state.isAllSelected ? Array.from(newSelected) : [], isAllSelected: updatedIsAllSelectedValue }), additionalStateUpdates);
|
|
341
|
+
return Object.assign(Object.assign({}, state), { selectedIds: state.isAllSelected ? Array.from(newSelected) : [], isAllSelected: updatedIsAllSelectedValue });
|
|
343
342
|
}
|
|
344
343
|
case stateActionType_1.StateActionType.DeselectAllChildren: {
|
|
345
344
|
const childrenForDeselect = [];
|
|
@@ -351,7 +350,7 @@ function stateReducer(state, action) {
|
|
|
351
350
|
});
|
|
352
351
|
const newSelected = new Set(state.selectedIds);
|
|
353
352
|
childrenForDeselect.forEach(childId => newSelected.delete(childId));
|
|
354
|
-
return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected) });
|
|
353
|
+
return Object.assign(Object.assign({}, state), { selectedIds: Array.from(newSelected), selectAllActiveForId: undefined });
|
|
355
354
|
}
|
|
356
355
|
case stateActionType_1.StateActionType.SetFirstParentNodeIsVisible: {
|
|
357
356
|
if (state.firstParentNodeIsVisible === payload) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { IDropdownState } from "./stateReducer";
|
|
2
1
|
import { IDropdownRawItem } from "../types";
|
|
3
2
|
import { IGroupTree, ITypedHash } from "../../groupsFilterRaw/groupsFilterInterfaces";
|
|
4
3
|
export declare function getChildList(childArr: IDropdownRawItem[] | undefined): IDropdownRawItem[];
|
|
5
|
-
export declare const
|
|
4
|
+
export declare const computeIsAllSelected: (currentIsAllSelected: boolean | undefined, isFullSelectionMode: boolean, resultsExceedListLimit: boolean | undefined, groupsMapLength: number, selectedCount: number) => boolean | undefined;
|
|
6
5
|
export declare const getRootId: (groupsMap: ITypedHash<IGroupTree>, rootIdKey: string, firstParentNodeIsVisible?: boolean) => string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRootId = exports.
|
|
3
|
+
exports.getRootId = exports.computeIsAllSelected = exports.getChildList = void 0;
|
|
4
4
|
const groupsHelper_1 = require("../../groupsFilterRaw/groupsHelper");
|
|
5
5
|
function getChildList(childArr) {
|
|
6
6
|
const list = [];
|
|
@@ -17,17 +17,10 @@ function getChildList(childArr) {
|
|
|
17
17
|
return list;
|
|
18
18
|
}
|
|
19
19
|
exports.getChildList = getChildList;
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (totalSelected >= groupsMapLength) {
|
|
25
|
-
additionalStateUpdates.isAllSelected = true;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return additionalStateUpdates;
|
|
29
|
-
};
|
|
30
|
-
exports.updateAllSelectedStateValueBasedOnTotalSelected = updateAllSelectedStateValueBasedOnTotalSelected;
|
|
20
|
+
const computeIsAllSelected = (currentIsAllSelected, isFullSelectionMode, resultsExceedListLimit, groupsMapLength, selectedCount) => !resultsExceedListLimit && currentIsAllSelected === false && isFullSelectionMode && groupsMapLength > 0 && selectedCount >= groupsMapLength
|
|
21
|
+
? true
|
|
22
|
+
: currentIsAllSelected;
|
|
23
|
+
exports.computeIsAllSelected = computeIsAllSelected;
|
|
31
24
|
const getRootId = (groupsMap, rootIdKey, firstParentNodeIsVisible) => {
|
|
32
25
|
var _a;
|
|
33
26
|
if (Object.keys(groupsMap).length === 0) {
|
|
@@ -3,6 +3,14 @@ import "./headerTitle.less";
|
|
|
3
3
|
import { IZenComponentProps } from "../commonHelpers/zenComponent";
|
|
4
4
|
import { IBetaPillActions } from "../betaPill/betaPill";
|
|
5
5
|
export declare const HeaderTitleDisplayName = "PageHeader";
|
|
6
|
+
/**
|
|
7
|
+
* @internal - temporary escape hatch
|
|
8
|
+
* @deprecated DO NOT USE in external consumers
|
|
9
|
+
*/
|
|
10
|
+
export interface IHeaderTitleInternal {
|
|
11
|
+
betaPillName?: string;
|
|
12
|
+
betaPillDescription?: string;
|
|
13
|
+
}
|
|
6
14
|
export interface IHeaderTitle extends IZenComponentProps {
|
|
7
15
|
id?: string;
|
|
8
16
|
pageName: string;
|
|
@@ -16,11 +24,9 @@ export interface IHeaderTitle extends IZenComponentProps {
|
|
|
16
24
|
allowBookmarkWithBack?: boolean;
|
|
17
25
|
feedBackAction?: IBetaPillActions;
|
|
18
26
|
betaOptionAction?: IBetaPillActions;
|
|
19
|
-
betaPillName?: string;
|
|
20
|
-
betaPillDescription?: string;
|
|
21
27
|
}
|
|
22
28
|
export declare const HeaderTitle: {
|
|
23
|
-
(
|
|
29
|
+
(props: IHeaderTitle): import("react/jsx-runtime").JSX.Element;
|
|
24
30
|
displayName: string;
|
|
25
31
|
};
|
|
26
32
|
export declare const TRANSLATIONS: string[];
|
|
@@ -10,7 +10,8 @@ const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
|
|
|
10
10
|
const headerBack_1 = require("../header/headerBack");
|
|
11
11
|
const bookmark_1 = require("../bookmark/bookmark");
|
|
12
12
|
exports.HeaderTitleDisplayName = "PageHeader";
|
|
13
|
-
const HeaderTitle = (
|
|
13
|
+
const HeaderTitle = (props) => {
|
|
14
|
+
const { id, children, className, pageName, subline, isBeta, isMobile: isMobileProp, allowBookmarkWithBack, feedBackAction, betaOptionAction, betaPillName, betaPillDescription } = props;
|
|
14
15
|
const isMobile = (0, useMobile_1.useMobile)();
|
|
15
16
|
const driveMainLineClassName = (0, useDriveClassName_1.useDriveClassName)("zen-page-header__main-line");
|
|
16
17
|
const drivePageNameClassName = (0, useDriveClassName_1.useDriveClassName)("zen-page-header__page-name");
|
|
@@ -33,7 +34,7 @@ const HeaderTitle = ({ id, children, className, pageName, subline, isBeta, isMob
|
|
|
33
34
|
});
|
|
34
35
|
return [b, b.length && !allowBookmarkWithBack ? o.filter(el => el.type !== bookmark_1.Bookmark) : o];
|
|
35
36
|
}, [children, allowBookmarkWithBack]);
|
|
36
|
-
return ((0, jsx_runtime_1.jsxs)("header", { id: id, className: clsNames, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-page-header__main-line", driveMainLineClassName || ""]), children: [back.length ? back : null, pageName ? (0, jsx_runtime_1.jsx)("h1", { className: (0, classNames_1.classNames)(["zen-page-header__page-name", drivePageNameClassName || ""]), children: pageName }) : null, isBeta ? ((0, jsx_runtime_1.jsx)(betaPill_1.BetaPill, { feedbackAction: feedBackAction, betaOptionAction: betaOptionAction,
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)("header", { id: id, className: clsNames, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-page-header__main-line", driveMainLineClassName || ""]), children: [back.length ? back : null, pageName ? (0, jsx_runtime_1.jsx)("h1", { className: (0, classNames_1.classNames)(["zen-page-header__page-name", drivePageNameClassName || ""]), children: pageName }) : null, isBeta ? ((0, jsx_runtime_1.jsx)(betaPill_1.BetaPill, Object.assign({ feedbackAction: feedBackAction, betaOptionAction: betaOptionAction, className: "zen-page-header__beta" }, { name: betaPillName, description: betaPillDescription }))) : null, other.length ? other : null] }), subline || ""] }));
|
|
37
38
|
};
|
|
38
39
|
exports.HeaderTitle = HeaderTitle;
|
|
39
40
|
exports.HeaderTitle.displayName = exports.HeaderTitleDisplayName;
|
package/dist/index.css
CHANGED
|
@@ -3031,6 +3031,10 @@ html:lang(ar) .zen-title-text--drive {
|
|
|
3031
3031
|
font-family: var(--arabic-font-family);
|
|
3032
3032
|
}
|
|
3033
3033
|
.zen-card-title {
|
|
3034
|
+
margin: 0;
|
|
3035
|
+
padding: 0;
|
|
3036
|
+
font-size: inherit;
|
|
3037
|
+
font-weight: inherit;
|
|
3034
3038
|
display: flex;
|
|
3035
3039
|
gap: 8px;
|
|
3036
3040
|
align-items: center;
|
|
@@ -4884,10 +4888,12 @@ html:lang(ar) .zen-checkbox__label-text {
|
|
|
4884
4888
|
.zen-checkbox:has(.zen-checkbox__input:disabled) .zen-checkbox__label {
|
|
4885
4889
|
fill: var(--text-reverse-primary);
|
|
4886
4890
|
color: var(--text-button-disabled);
|
|
4891
|
+
cursor: default;
|
|
4887
4892
|
}
|
|
4888
4893
|
.zen-checkbox:has(.zen-checkbox__input:disabled) .zen-checkbox__box {
|
|
4889
4894
|
border-color: var(--borders-general);
|
|
4890
4895
|
background-color: var(--backgrounds-field-disabled);
|
|
4896
|
+
cursor: default;
|
|
4891
4897
|
}
|
|
4892
4898
|
.zen-checkbox:has(.zen-checkbox__input:disabled:checked) .zen-checkbox__box,
|
|
4893
4899
|
.zen-checkbox:has(.zen-checkbox__input:disabled:indeterminate) .zen-checkbox__box {
|
|
@@ -7609,6 +7615,11 @@ html:lang(ar) .zen-checkbox-list-with-action__label {
|
|
|
7609
7615
|
color: var(--text-hyperlink);
|
|
7610
7616
|
fill: var(--text-hyperlink);
|
|
7611
7617
|
}
|
|
7618
|
+
.zen-checkbox-list-with-action__label--action:disabled {
|
|
7619
|
+
cursor: default;
|
|
7620
|
+
color: var(--text-disabled);
|
|
7621
|
+
fill: var(--text-disabled);
|
|
7622
|
+
}
|
|
7612
7623
|
.zen-checkbox-list-with-action__label-text {
|
|
7613
7624
|
display: flex;
|
|
7614
7625
|
flex-grow: 1;
|
|
@@ -7824,8 +7835,8 @@ html:lang(ar) .zen-dropdown-list__label {
|
|
|
7824
7835
|
.zen-dropdown-list__item--interactive:not(:disabled) {
|
|
7825
7836
|
cursor: pointer;
|
|
7826
7837
|
}
|
|
7827
|
-
.zen-dropdown-list__item--interactive:not(:disabled):hover,
|
|
7828
|
-
.zen-dropdown-list__item--interactive:not(:disabled):focus {
|
|
7838
|
+
.zen-dropdown-list__item--interactive:not(:disabled):hover:not(.zen-dropdown-list__action-button--selected),
|
|
7839
|
+
.zen-dropdown-list__item--interactive:not(:disabled):focus:not(.zen-dropdown-list__action-button--selected) {
|
|
7829
7840
|
color: var(--text-primary);
|
|
7830
7841
|
fill: var(--action-secondary--default);
|
|
7831
7842
|
outline: none;
|
|
@@ -7895,6 +7906,27 @@ html:lang(ar) .zen-dropdown-list__action-label {
|
|
|
7895
7906
|
.zen-dropdown-list__action-button:disabled svg {
|
|
7896
7907
|
fill: var(--text-button-disabled);
|
|
7897
7908
|
}
|
|
7909
|
+
.zen-dropdown-list__action-button--selected {
|
|
7910
|
+
background-color: var(--action-primary--default);
|
|
7911
|
+
}
|
|
7912
|
+
.zen-dropdown-list__action-button--selected.zen-dropdown-list__item--interactive:not(:disabled):hover,
|
|
7913
|
+
.zen-dropdown-list__action-button--selected.zen-dropdown-list__item--interactive:not(:disabled):focus {
|
|
7914
|
+
background-color: var(--action-primary--default);
|
|
7915
|
+
fill: var(--text-reverse-primary);
|
|
7916
|
+
color: var(--text-reverse-primary);
|
|
7917
|
+
}
|
|
7918
|
+
.zen-dropdown-list__action-button--selected.zen-dropdown-list__item--interactive:not(:disabled):focus-visible {
|
|
7919
|
+
border-color: var(--backgrounds-content-1);
|
|
7920
|
+
outline: 1px solid var(--borders-form-field--active);
|
|
7921
|
+
outline-offset: 2px;
|
|
7922
|
+
}
|
|
7923
|
+
.zen-dropdown-list__action-button--selected .zen-dropdown-list__icon {
|
|
7924
|
+
color: var(--text-reverse-primary);
|
|
7925
|
+
fill: var(--text-reverse-primary);
|
|
7926
|
+
}
|
|
7927
|
+
.zen-dropdown-list__action-button--selected .zen-dropdown-list__action-label {
|
|
7928
|
+
color: var(--text-reverse-primary);
|
|
7929
|
+
}
|
|
7898
7930
|
.zen-dropdown-list__footer {
|
|
7899
7931
|
display: flex;
|
|
7900
7932
|
justify-content: flex-start;
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export { type ICardButton, CardButton } from "./card/components/cardButton/cardB
|
|
|
20
20
|
export { type ICardToggle, CardToggle } from "./card/components/cardToggle/cardToggle";
|
|
21
21
|
export { type IContent, Content } from "./card/components/content";
|
|
22
22
|
export { type TCardStatus, Status } from "./card/components/status";
|
|
23
|
-
export { Title } from "./card/components/title";
|
|
23
|
+
export { type THeadingTag, Title } from "./card/components/title";
|
|
24
24
|
export { TitleLink } from "./card/components/titleLink";
|
|
25
25
|
export { getDefaultFullWidthValue } from "./card/helpers/getDefaultFullWidthValue";
|
|
26
26
|
export { getIconFromStatus } from "./card/helpers/getIconFromStatus";
|
|
@@ -774,6 +774,8 @@ export { HeaderButtonsProvider } from "./utils/headerButtons/headerButtonsProvid
|
|
|
774
774
|
export { getNewFocusableItem, getFirstFocusableItem } from "./utils/keyboardHelpers";
|
|
775
775
|
export { LanguageProvider } from "./utils/localization/languageProvider";
|
|
776
776
|
export { dictionaries, injectString } from "./utils/localization/translationsDictionary";
|
|
777
|
+
export { directionContext } from "./utils/localization/directionContext";
|
|
778
|
+
export type { TTextDirection } from "./utils/localization/getTextDirection";
|
|
777
779
|
export { useDirection } from "./utils/localization/useDirection";
|
|
778
780
|
export { useLanguage } from "./utils/localization/useLanguage";
|
|
779
781
|
export { ThemeDark } from "./utils/theme/themeDark";
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ exports.IconShield3 = exports.IconShield2 = exports.IconShield = exports.IconSha
|
|
|
17
17
|
exports.IconVolumeHalf = exports.IconVolumeFull = exports.IconVolumeDown = exports.IconVoice = exports.IconVisitPage = exports.IconVideoReplay = exports.IconVideo2 = exports.IconVideo = exports.IconUsbHub = exports.IconUsb = exports.IconUpload = exports.IconUnlocked = exports.IconUndock = exports.IconUndo2 = exports.IconUndo = exports.IconUnderline = exports.IconUmbrella = exports.IconTrailer = exports.IconThumbsUp = exports.IconThumbsDown = exports.IconThermometer = exports.IconThermograph = exports.IconTextSize = exports.IconTelevision2 = exports.IconTelevision = exports.IconTarget3 = exports.IconTarget2 = exports.IconTarget = exports.IconTachographTimeCard = exports.IconTachograph = exports.IconTable = exports.IconSupport = exports.IconSun = exports.IconStrikeThrough = exports.IconStore = exports.IconStorage = exports.IconStopwatch = exports.IconStarFilled = exports.IconStarAi = exports.IconStar = exports.IconSquare = exports.IconSpeaker = exports.IconSortVertical = exports.IconSortHorizontal = exports.IconSort2Vertical = exports.IconSort2Horizontal = exports.IconSmiley = exports.IconSign = exports.IconSidebar = exports.IconShield4 = void 0;
|
|
18
18
|
exports.isButton = exports.findPrevFocusable = exports.findNextFocusable = exports.findLastFocusable = exports.findFirstFocusable = exports.Menu = exports.ControlledMenu = exports.isDragNotClick = exports.changeOrder = exports.ListItem = exports.List = exports.ItemData = exports.ItemCompact = exports.LineChartMini = exports.getDefaultDatasetStyle = exports.htmlLegendPlugin = exports.LEGEND_PLUGIN_ID = exports.LineChart = exports.useLayoutSize = exports.LayoutFullScreenProvider = exports.useLayoutFullScreen = exports.LayoutFullScreenElementProvider = exports.useLayoutFullScreenElement = exports.Layout = exports.ImageTapToUpload = exports.ImageNothingFound = exports.ImageNoMatchingAssets = exports.ImageLooking = exports.ImageCloudUpload = exports.ImageAdjustFilter = exports.IconZoom2 = exports.IconZoom = exports.IconZone = exports.IconYen = exports.IconWrite = exports.IconWrench = exports.IconWorld = exports.IconWorkday = exports.IconWifi2 = exports.IconWifi = exports.IconWhisper = exports.IconWebcam = exports.IconWatch2 = exports.IconWatch = exports.IconWarning = exports.IconWallet1 = exports.IconWallet = exports.IconVolumeOn = exports.IconVolumeOff = exports.IconVolumeMinimum = void 0;
|
|
19
19
|
exports.SummaryTileBarDisplayName = exports.SummaryTileBar = exports.getTypeClassName = exports.SummaryTileTrigger = exports.SummaryTile = exports.SummaryTileDisplayName = exports.SummaryTileSize = exports.SummaryTileType = exports.Summary = exports.Summaries = exports.Stepper = exports.SortControl = exports.SortDirections = exports.Skeleton = exports.LazyContent = exports.SidePanel = exports.CUSTOM_POPUP_COMPONENT_CLASSNAME = exports.SidePanelCloseReason = exports.isChildPopup = exports.SelectField = exports.Select = exports.SearchInput = exports.Range = exports.RadioGroup = exports.Radio = exports.ProgressBar = exports.ProgreesBarSize = exports.ProgressBarType = exports.PrimaryIcon = exports.Popup = exports.PillExpandable = exports.Pill = exports.PaginationType = exports.Pagination = exports.PageLayout = exports.PageContentLayout = exports.PageHeaderMenu = exports.PageHeaderMenuDisplayName = exports.PageHeaderButton = exports.PageHeaderButtonDisplayName = exports.PageHeader = exports.PageHeaderDisplayName = exports.Notification = exports.getPredefinedFocusableItem = exports.DialogContentNew = exports.Modal = exports.MobileSheet = exports.MiniTabs = exports.MiniTabsSize = exports.isLink = void 0;
|
|
20
|
-
exports.Waiting = exports.UserFormatProvider = exports.useDrive = exports.ThemeProvider = exports.ThemeDrive = exports.ThemeDark = exports.useLanguage = exports.useDirection = exports.injectString = exports.dictionaries = exports.LanguageProvider = exports.getFirstFocusableItem = exports.getNewFocusableItem = exports.HeaderButtonsProvider = exports.AbortablePromise = exports.Tooltip = exports.removeArrowClasses = exports.calculateArrowPosition = exports.ToggleButtonRaw = exports.ToggleButton = exports.Toast = exports.useToast = exports.TimePicker = exports.TextareaRaw = exports.Textarea = exports.TextInputRaw = exports.TextInput = exports.TextIconButton = exports.ButtonIconPosition = exports.Tabs = exports.TabsDisplayName = exports.ActionLinkColumn = exports.CheckboxColumn = exports.MainColumn = exports.ActionsColumn = exports.getSortableValue = exports.ColumnSortDirection = exports.getEmptySelection = exports.Table = exports.useNestedRows = exports.NestedData = exports.TabBarContent = exports.TabBar = void 0;
|
|
20
|
+
exports.Waiting = exports.UserFormatProvider = exports.useDrive = exports.ThemeProvider = exports.ThemeDrive = exports.ThemeDark = exports.useLanguage = exports.useDirection = exports.directionContext = exports.injectString = exports.dictionaries = exports.LanguageProvider = exports.getFirstFocusableItem = exports.getNewFocusableItem = exports.HeaderButtonsProvider = exports.AbortablePromise = exports.Tooltip = exports.removeArrowClasses = exports.calculateArrowPosition = exports.ToggleButtonRaw = exports.ToggleButton = exports.Toast = exports.useToast = exports.TimePicker = exports.TextareaRaw = exports.Textarea = exports.TextInputRaw = exports.TextInput = exports.TextIconButton = exports.ButtonIconPosition = exports.Tabs = exports.TabsDisplayName = exports.ActionLinkColumn = exports.CheckboxColumn = exports.MainColumn = exports.ActionsColumn = exports.getSortableValue = exports.ColumnSortDirection = exports.getEmptySelection = exports.Table = exports.useNestedRows = exports.NestedData = exports.TabBarContent = exports.TabBar = void 0;
|
|
21
21
|
/* eslint-disable max-len */
|
|
22
22
|
var absolute_1 = require("./absolute/absolute");
|
|
23
23
|
Object.defineProperty(exports, "Absolute", { enumerable: true, get: function () { return absolute_1.Absolute; } });
|
|
@@ -1663,6 +1663,8 @@ Object.defineProperty(exports, "LanguageProvider", { enumerable: true, get: func
|
|
|
1663
1663
|
var translationsDictionary_1 = require("./utils/localization/translationsDictionary");
|
|
1664
1664
|
Object.defineProperty(exports, "dictionaries", { enumerable: true, get: function () { return translationsDictionary_1.dictionaries; } });
|
|
1665
1665
|
Object.defineProperty(exports, "injectString", { enumerable: true, get: function () { return translationsDictionary_1.injectString; } });
|
|
1666
|
+
var directionContext_1 = require("./utils/localization/directionContext");
|
|
1667
|
+
Object.defineProperty(exports, "directionContext", { enumerable: true, get: function () { return directionContext_1.directionContext; } });
|
|
1666
1668
|
var useDirection_1 = require("./utils/localization/useDirection");
|
|
1667
1669
|
Object.defineProperty(exports, "useDirection", { enumerable: true, get: function () { return useDirection_1.useDirection; } });
|
|
1668
1670
|
var useLanguage_1 = require("./utils/localization/useLanguage");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fetchData: () => Promise<string>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchData = void 0;
|
|
4
|
+
const zen_1 = require("../utils/zen");
|
|
5
|
+
let loadTimeout = null;
|
|
6
|
+
const fetchData = () => {
|
|
7
|
+
var _a;
|
|
8
|
+
loadTimeout && ((_a = zen_1.zen.clearTimeout) === null || _a === void 0 ? void 0 : _a.call(zen_1.zen, loadTimeout));
|
|
9
|
+
return new Promise((res, rej) => {
|
|
10
|
+
var _a;
|
|
11
|
+
loadTimeout = (_a = zen_1.zen.setTimeout) === null || _a === void 0 ? void 0 : _a.call(zen_1.zen, () => Math.random() > 0.5 ? res("Fetched Data") : rej(new Error("Error while fetching data")), 5000);
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
exports.fetchData = fetchData;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference path="./index.d.ts" />
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const axe_core_1 = __importDefault(require("axe-core"));
|
|
8
|
+
const styled_output_1 = require("../styled-output");
|
|
9
|
+
const domParser = new DOMParser();
|
|
10
|
+
const lineBreak = "\n\n";
|
|
11
|
+
const horizontalLine = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
12
|
+
const runAxe = (el) => new Promise(resolve => {
|
|
13
|
+
const parent = el.parentNode;
|
|
14
|
+
const sibling = el.nextSibling;
|
|
15
|
+
document === null || document === void 0 ? void 0 : document.body.appendChild(el);
|
|
16
|
+
axe_core_1.default.configure({
|
|
17
|
+
rules: [{
|
|
18
|
+
id: "target-size",
|
|
19
|
+
enabled: true
|
|
20
|
+
}],
|
|
21
|
+
checks: [
|
|
22
|
+
{
|
|
23
|
+
// color contrast checking doesnt work in a jsdom environment.
|
|
24
|
+
id: "color-contrast",
|
|
25
|
+
enabled: false
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
axe_core_1.default.run(el, {}, (err, results) => {
|
|
30
|
+
if (err) {
|
|
31
|
+
throw err;
|
|
32
|
+
}
|
|
33
|
+
resolve(results);
|
|
34
|
+
parent ? parent.insertBefore(el, sibling) : document === null || document === void 0 ? void 0 : document.body.removeChild(el);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
const toHtml = (str) => {
|
|
38
|
+
if (str.indexOf("<html") > -1) {
|
|
39
|
+
return domParser.parseFromString(str, "text/html").body;
|
|
40
|
+
}
|
|
41
|
+
const html = document === null || document === void 0 ? void 0 : document.createElement("template");
|
|
42
|
+
html.insertAdjacentHTML("afterbegin", str);
|
|
43
|
+
return html;
|
|
44
|
+
};
|
|
45
|
+
const formatViolations = (violations) => {
|
|
46
|
+
if (violations.length === 0) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
return violations.map(violation => {
|
|
50
|
+
const errorText = violation.nodes.map(node => {
|
|
51
|
+
const selector = node.target.join(", ");
|
|
52
|
+
const expectedText = `Availability violation for selector $('${selector}'):` + lineBreak;
|
|
53
|
+
return (expectedText +
|
|
54
|
+
(0, styled_output_1.stylize)(node.html, styled_output_1.Color.Gray) +
|
|
55
|
+
lineBreak +
|
|
56
|
+
(0, styled_output_1.stylize)(`---Explanation---`, styled_output_1.Color.Black, styled_output_1.BackgroundColor.White, styled_output_1.Style.Bold, styled_output_1.Style.Underline) +
|
|
57
|
+
lineBreak +
|
|
58
|
+
`${violation.help} (${violation.id})` +
|
|
59
|
+
lineBreak +
|
|
60
|
+
(0, styled_output_1.stylize)(node.failureSummary || "", styled_output_1.Color.Yellow) +
|
|
61
|
+
lineBreak + (violation.helpUrl
|
|
62
|
+
? `You can find more about it here: \n${(0, styled_output_1.stylize)(violation.helpUrl, styled_output_1.Color.Blue)}`
|
|
63
|
+
: ""));
|
|
64
|
+
}).join(lineBreak);
|
|
65
|
+
return (errorText);
|
|
66
|
+
}).join(lineBreak + horizontalLine + lineBreak);
|
|
67
|
+
};
|
|
68
|
+
const toBeAccessible = async (element, errorMsg) => {
|
|
69
|
+
if (!element) {
|
|
70
|
+
return { pass: true, message: () => "ok" };
|
|
71
|
+
}
|
|
72
|
+
const html = element instanceof Node ? element : toHtml(element);
|
|
73
|
+
const results = await runAxe(html);
|
|
74
|
+
if (results.violations.length) {
|
|
75
|
+
const formatedViolations = formatViolations(results.violations);
|
|
76
|
+
const message = () => (errorMsg ? errorMsg + lineBreak : "") + formatedViolations;
|
|
77
|
+
return { pass: false, message };
|
|
78
|
+
}
|
|
79
|
+
return { pass: true, message: () => "ok" };
|
|
80
|
+
};
|
|
81
|
+
expect.extend({ toBeAccessible });
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderAsync = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_2 = require("@testing-library/react");
|
|
6
|
+
const renderAsync = async (component) => (0, react_1.act)(async () => {
|
|
7
|
+
const result = (0, react_2.render)(component);
|
|
8
|
+
await Promise.resolve();
|
|
9
|
+
await Promise.resolve();
|
|
10
|
+
return result;
|
|
11
|
+
});
|
|
12
|
+
exports.renderAsync = renderAsync;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const setReadonlyHtmlProperty: (propName: keyof HTMLElement, values: Map<string, Required<HTMLElement>[keyof HTMLElement]>) => void;
|