@pega/cosmos-react-core 5.0.0-dev.9.2 → 6.0.0
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/SECURITY.md +11 -0
- package/lib/components/AdditionalInfo/AdditionalInfo.d.ts +8 -6
- package/lib/components/AdditionalInfo/AdditionalInfo.d.ts.map +1 -1
- package/lib/components/AdditionalInfo/AdditionalInfo.js +3 -2
- package/lib/components/AdditionalInfo/AdditionalInfo.js.map +1 -1
- package/lib/components/AppShell/AppShell.js +1 -1
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/Drawer.d.ts.map +1 -1
- package/lib/components/AppShell/Drawer.js +3 -3
- package/lib/components/AppShell/Drawer.js.map +1 -1
- package/lib/components/AppShell/Operator.d.ts.map +1 -1
- package/lib/components/AppShell/Operator.js +5 -2
- package/lib/components/AppShell/Operator.js.map +1 -1
- package/lib/components/Badges/Keyboard.d.ts.map +1 -1
- package/lib/components/Badges/Keyboard.js +10 -10
- package/lib/components/Badges/Keyboard.js.map +1 -1
- package/lib/components/Badges/Status.d.ts.map +1 -1
- package/lib/components/Badges/Status.js +2 -0
- package/lib/components/Badges/Status.js.map +1 -1
- package/lib/components/Banner/Banner.d.ts +5 -3
- package/lib/components/Banner/Banner.d.ts.map +1 -1
- package/lib/components/Banner/Banner.js +22 -15
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Banner/Banner.test-ids.d.ts +2 -0
- package/lib/components/Banner/Banner.test-ids.d.ts.map +1 -0
- package/lib/components/Banner/Banner.test-ids.js +10 -0
- package/lib/components/Banner/Banner.test-ids.js.map +1 -0
- package/lib/components/Button/Button.js +1 -1
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
- package/lib/components/Configuration/Configuration.d.ts +3 -0
- package/lib/components/Configuration/Configuration.d.ts.map +1 -1
- package/lib/components/Configuration/Configuration.js +20 -12
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/Configuration/index.d.ts +1 -0
- package/lib/components/Configuration/index.d.ts.map +1 -1
- package/lib/components/Configuration/index.js +1 -0
- package/lib/components/Configuration/index.js.map +1 -1
- package/lib/components/Configuration/withConfiguration.d.ts +8 -0
- package/lib/components/Configuration/withConfiguration.d.ts.map +1 -0
- package/lib/components/Configuration/withConfiguration.js +9 -0
- package/lib/components/Configuration/withConfiguration.js.map +1 -0
- package/lib/components/DateTime/DateTime.types.d.ts +1 -4
- package/lib/components/DateTime/DateTime.types.d.ts.map +1 -1
- package/lib/components/DateTime/DateTime.types.js.map +1 -1
- package/lib/components/DateTime/DurationDisplay.d.ts +7 -3
- package/lib/components/DateTime/DurationDisplay.d.ts.map +1 -1
- package/lib/components/DateTime/DurationDisplay.js +2 -2
- package/lib/components/DateTime/DurationDisplay.js.map +1 -1
- package/lib/components/DateTime/Input/DateInput.d.ts +3 -5
- package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +2 -17
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.d.ts +2 -4
- package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.js +33 -84
- package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.js +2 -1
- package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts +3 -0
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +20 -38
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/NumberUnit.d.ts.map +1 -1
- package/lib/components/DateTime/Input/Duration/NumberUnit.js +2 -1
- package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.d.ts +5 -0
- package/lib/components/DateTime/Input/MonthInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/MonthInput.js +14 -6
- package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
- package/lib/components/DateTime/Input/PartInput.js +1 -1
- package/lib/components/DateTime/Input/PartInput.js.map +1 -1
- package/lib/components/DateTime/Input/QuarterInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/QuarterInput.js +5 -0
- package/lib/components/DateTime/Input/QuarterInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +13 -24
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeRangeInput.d.ts +2 -4
- package/lib/components/DateTime/Input/TimeRangeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeRangeInput.js +25 -64
- package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -1
- package/lib/components/DateTime/Input/utils.d.ts +3 -2
- package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
- package/lib/components/DateTime/Input/utils.js +19 -16
- package/lib/components/DateTime/Input/utils.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.js +3 -3
- package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.styles.d.ts +2 -0
- package/lib/components/DateTime/Picker/DatePicker.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.styles.js +37 -1
- package/lib/components/DateTime/Picker/DatePicker.styles.js.map +1 -1
- package/lib/components/DateTime/Picker/DateRangePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DateRangePicker.js +3 -3
- package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.js +1 -1
- package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
- package/lib/components/DateTime/utils.d.ts +13 -2
- package/lib/components/DateTime/utils.d.ts.map +1 -1
- package/lib/components/DateTime/utils.js +7 -13
- package/lib/components/DateTime/utils.js.map +1 -1
- package/lib/components/Dialog/FormDialog.js +1 -1
- package/lib/components/Dialog/FormDialog.js.map +1 -1
- package/lib/components/Dialog/InfoDialog.js +1 -1
- package/lib/components/Dialog/InfoDialog.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.d.ts +23 -15
- package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +3 -3
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.d.ts +2 -2
- package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.js +5 -2
- package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
- package/lib/components/FormControl/FormControl.d.ts +1 -1
- package/lib/components/FormControl/FormControl.d.ts.map +1 -1
- package/lib/components/FormControl/FormControl.js.map +1 -1
- package/lib/components/FormField/FormField.d.ts +1 -0
- package/lib/components/FormField/FormField.d.ts.map +1 -1
- package/lib/components/FormField/FormField.js +7 -3
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/HTML/HTML.js +1 -1
- package/lib/components/HTML/HTML.js.map +1 -1
- package/lib/components/Lightbox/Lightbox.d.ts +1 -1
- package/lib/components/Lightbox/Lightbox.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.js +66 -19
- package/lib/components/Lightbox/Lightbox.js.map +1 -1
- package/lib/components/Lightbox/Lightbox.styles.d.ts +3 -3
- package/lib/components/Lightbox/Lightbox.styles.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.styles.js +29 -16
- package/lib/components/Lightbox/Lightbox.styles.js.map +1 -1
- package/lib/components/Lightbox/Lightbox.test-ids.d.ts +1 -1
- package/lib/components/Lightbox/Lightbox.test-ids.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.test-ids.js +3 -1
- package/lib/components/Lightbox/Lightbox.test-ids.js.map +1 -1
- package/lib/components/Lightbox/Lightbox.types.d.ts +19 -8
- package/lib/components/Lightbox/Lightbox.types.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.types.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.js +61 -51
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts +4 -0
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.js +41 -8
- package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.test-ids.d.ts +1 -1
- package/lib/components/ListToolbar/ListToolbar.test-ids.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.test-ids.js +2 -1
- package/lib/components/ListToolbar/ListToolbar.test-ids.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.d.ts +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/Menu/MenuItem.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +8 -4
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
- package/lib/components/Modal/MinimizedModal.js +3 -3
- package/lib/components/Modal/MinimizedModal.js.map +1 -1
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/Modal/Modal.js +4 -4
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/MultiStepForm/FormProgress.styles.d.ts +2 -0
- package/lib/components/MultiStepForm/FormProgress.styles.d.ts.map +1 -1
- package/lib/components/MultiStepForm/FormProgress.styles.js +26 -2
- package/lib/components/MultiStepForm/FormProgress.styles.js.map +1 -1
- package/lib/components/MultiStepForm/HorizontalFormProgress.d.ts +0 -1
- package/lib/components/MultiStepForm/HorizontalFormProgress.d.ts.map +1 -1
- package/lib/components/MultiStepForm/HorizontalFormProgress.js +26 -29
- package/lib/components/MultiStepForm/HorizontalFormProgress.js.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.js +27 -11
- package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
- package/lib/components/NoValue/NoValue.d.ts.map +1 -1
- package/lib/components/NoValue/NoValue.js +6 -1
- package/lib/components/NoValue/NoValue.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +9 -0
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.js +3 -1
- package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
- package/lib/components/SearchInput/SearchInput.styles.js +15 -0
- package/lib/components/SearchInput/SearchInput.styles.js.map +1 -1
- package/lib/components/ShortcutManager/ShortcutManager.js +1 -1
- package/lib/components/ShortcutManager/ShortcutManager.js.map +1 -1
- package/lib/components/TextArea/TextArea.d.ts +1 -1
- package/lib/components/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.js +16 -8
- package/lib/components/TextArea/TextArea.js.map +1 -1
- package/lib/components/TextArea/TextArea.styles.d.ts +1 -0
- package/lib/components/TextArea/TextArea.styles.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.styles.js +32 -4
- package/lib/components/TextArea/TextArea.styles.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.js +1 -1
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/hooks/useArrows.d.ts +2 -1
- package/lib/hooks/useArrows.d.ts.map +1 -1
- package/lib/hooks/useArrows.js +47 -22
- package/lib/hooks/useArrows.js.map +1 -1
- package/lib/hooks/useFocusTrap.d.ts.map +1 -1
- package/lib/hooks/useFocusTrap.js +30 -3
- package/lib/hooks/useFocusTrap.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +21 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/i18n/default.d.ts +21 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +25 -2
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +21 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/styles/GlobalStyle.d.ts.map +1 -1
- package/lib/styles/GlobalStyle.js +11 -1
- package/lib/styles/GlobalStyle.js.map +1 -1
- package/lib/utils/focusHeadingOrContainer.d.ts +1 -1
- package/lib/utils/focusHeadingOrContainer.d.ts.map +1 -1
- package/lib/utils/focusHeadingOrContainer.js +1 -1
- package/lib/utils/focusHeadingOrContainer.js.map +1 -1
- package/lib/utils/getFocusables.d.ts +7 -3
- package/lib/utils/getFocusables.d.ts.map +1 -1
- package/lib/utils/getFocusables.js +31 -9
- package/lib/utils/getFocusables.js.map +1 -1
- package/package.json +6 -5
package/lib/hooks/useArrows.js
CHANGED
|
@@ -16,28 +16,31 @@ cycle = true,
|
|
|
16
16
|
/** A query selector that will determine which elements to cycle through with the arrow keys. The selector will be used in conjunction with [querySelectorAll](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll#selectors). */
|
|
17
17
|
selector = focusable,
|
|
18
18
|
/** Which keys are used to navigate through the list */
|
|
19
|
-
dir = 'up-down', allowTabFocus = true, updateTabIndex = true
|
|
19
|
+
dir = 'up-down', allowTabFocus = true, updateTabIndex = true,
|
|
20
|
+
/** When focus enters the ref, which element should receive focus first if available */
|
|
21
|
+
initialFocusElement } = {},
|
|
20
22
|
/** Pass this prop in the internal dependencies when list is dynamic */
|
|
21
23
|
dependencies = []) => {
|
|
22
24
|
const [NextKey, PrevKey] = dir === 'up-down' ? ['ArrowDown', 'ArrowUp'] : ['ArrowRight', 'ArrowLeft'];
|
|
23
25
|
const setTabIndexes = useCallback((el) => {
|
|
24
|
-
// don't set tabindex -1 for first element, or an element with a checked input inside of it to be able to focus it
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
focusableElements.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
// don't set tabindex -1 for first element, or the initialFocusElement, or an element with a checked input inside of it to be able to focus it
|
|
27
|
+
const focusableElements = Array.from(el.querySelectorAll(selector));
|
|
28
|
+
if (focusableElements.length > 0) {
|
|
29
|
+
let focusIndex = focusableElements.findIndex(focusEl => focusEl === initialFocusElement);
|
|
30
|
+
if (focusIndex === -1)
|
|
31
|
+
focusIndex = 0;
|
|
32
|
+
if (allowTabFocus)
|
|
33
|
+
focusableElements[focusIndex].tabIndex = 0;
|
|
34
|
+
focusableElements.splice(focusIndex, 1);
|
|
35
|
+
focusableElements.forEach(item => {
|
|
36
|
+
if (item instanceof HTMLElement) {
|
|
37
|
+
const checked = item.checked;
|
|
38
|
+
if (!checked)
|
|
39
|
+
item.tabIndex = -1;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}, [selector, initialFocusElement, ...dependencies]);
|
|
41
44
|
const listener = useCallback((e) => {
|
|
42
45
|
const el = ref.current;
|
|
43
46
|
if (!el)
|
|
@@ -56,7 +59,9 @@ dependencies = []) => {
|
|
|
56
59
|
const lastIdx = items.length - 1;
|
|
57
60
|
let newFocusIdx;
|
|
58
61
|
if (e.key === 'Home' || (e.key === NextKey && focusIdx === -1)) {
|
|
59
|
-
|
|
62
|
+
const focusableElements = Array.from(el.querySelectorAll(selector));
|
|
63
|
+
const focusIndex = focusableElements.findIndex(focusEl => focusEl === initialFocusElement);
|
|
64
|
+
newFocusIdx = focusIndex === -1 ? 0 : focusIndex;
|
|
60
65
|
}
|
|
61
66
|
else if (e.key === 'End' || (e.key === PrevKey && focusIdx === -1)) {
|
|
62
67
|
newFocusIdx = lastIdx;
|
|
@@ -87,23 +92,43 @@ dependencies = []) => {
|
|
|
87
92
|
newFocusIdx = focusIdx - 1;
|
|
88
93
|
}
|
|
89
94
|
}
|
|
95
|
+
else if (e.key === 'Tab' && initialFocusElement) {
|
|
96
|
+
// We need to reset the tabIndex for the initial focused element when leaving the group. 0 second timeout necessary to avoid focusing this element instad of leaving the group.
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
initialFocusElement.tabIndex = 0;
|
|
99
|
+
}, 0);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
90
102
|
else {
|
|
91
103
|
return;
|
|
92
104
|
}
|
|
105
|
+
// If there is an initial focused element other than the default, the tabIndex must be set to -1 the moment arrow keys are used to prevent that element from being tabbable while within the group focus.
|
|
106
|
+
if ((e.key === PrevKey || e.key === NextKey) && initialFocusElement) {
|
|
107
|
+
initialFocusElement.tabIndex = -1;
|
|
108
|
+
}
|
|
93
109
|
items[newFocusIdx].focus();
|
|
94
|
-
}, [ref.current, cycle, selector, ...dependencies]);
|
|
110
|
+
}, [ref.current, cycle, selector, initialFocusElement, ...dependencies]);
|
|
95
111
|
useEffect(() => {
|
|
96
112
|
const el = ref.current;
|
|
97
113
|
if (!el)
|
|
98
114
|
return;
|
|
99
115
|
if (updateTabIndex) {
|
|
100
|
-
|
|
116
|
+
if (initialFocusElement) {
|
|
117
|
+
// If there is an element defined that should receive default focus, no timeout is necessary
|
|
118
|
+
setTabIndexes(el);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
// 0 second timeout added because DOM needs to be up to date after list is updated before running query
|
|
122
|
+
setTimeout(() => {
|
|
123
|
+
setTabIndexes(el);
|
|
124
|
+
}, 0);
|
|
125
|
+
}
|
|
101
126
|
}
|
|
102
127
|
el.addEventListener('keydown', listener);
|
|
103
128
|
return () => {
|
|
104
129
|
el.removeEventListener('keydown', listener);
|
|
105
130
|
};
|
|
106
|
-
}, [ref.current, selector, listener, ...dependencies]);
|
|
131
|
+
}, [ref.current, selector, listener, initialFocusElement, ...dependencies]);
|
|
107
132
|
};
|
|
108
133
|
export default useArrows;
|
|
109
134
|
//# sourceMappingURL=useArrows.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useArrows.js","sourceRoot":"","sources":["../../src/hooks/useArrows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,SAAS,GAAG;;;;;CAKjB,CAAC;AAEF;;;GAGG;AACH,MAAM,SAAS,GAAG,CAChB,GAA2B,EAC3B;AACE,yKAAyK;AACzK,KAAK,GAAG,IAAI;AACZ,wPAAwP;AACxP,QAAQ,GAAG,SAAS;AACpB,uDAAuD;AACvD,GAAG,GAAG,SAAS,EACf,aAAa,GAAG,IAAI,EACpB,cAAc,GAAG,IAAI,KAOnB,EAAE;AACN,uEAAuE;AACvE,eAA+B,EAAE,EACjC,EAAE;IACF,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GACtB,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAE7E,MAAM,aAAa,GAAG,WAAW,CAC/B,CAAC,EAAe,EAAE,EAAE;QAClB,kHAAkH;QAElH,uGAAuG;QACvG,UAA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;QAED,KAAK,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC,EACD,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC,CAChD,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE;YAAE,OAAO;QAChB,IAAI,cAAc,EAAE;YAClB,aAAa,CAAC,EAAE,CAAC,CAAC;SACnB;QACD,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAEzC,OAAO,GAAG,EAAE;YACV,EAAE,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC9C,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;AACzD,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { useEffect, useCallback } from 'react';\nimport type { RefObject, DependencyList } from 'react';\n\nimport { documentIsAvailable } from '../utils';\n\nconst focusable = `\n a[href],\n button:enabled,\n input[type='checkbox']:enabled,\n input[type='radio']:enabled\n`;\n\n/**\n * @example useArrows(ref, { cycle, selector });\n * @param ref - A reference to the element that will be navigated through. [React RefObject](https://reactjs.org/docs/refs-and-the-dom.html)\n */\nconst useArrows = (\n ref: RefObject<HTMLElement>,\n {\n /** If true, the down or up arrow key will navigate to the first or last element if the element currently focused is the last or first index of the selected elements. */\n cycle = true,\n /** A query selector that will determine which elements to cycle through with the arrow keys. The selector will be used in conjunction with [querySelectorAll](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll#selectors). */\n selector = focusable,\n /** Which keys are used to navigate through the list */\n dir = 'up-down',\n allowTabFocus = true,\n updateTabIndex = true\n }: {\n cycle?: boolean;\n selector?: string;\n dir?: 'up-down' | 'left-right';\n allowTabFocus?: boolean;\n updateTabIndex?: boolean;\n } = {},\n /** Pass this prop in the internal dependencies when list is dynamic */\n dependencies: DependencyList = []\n) => {\n const [NextKey, PrevKey] =\n dir === 'up-down' ? ['ArrowDown', 'ArrowUp'] : ['ArrowRight', 'ArrowLeft'];\n\n const setTabIndexes = useCallback(\n (el: HTMLElement) => {\n // don't set tabindex -1 for first element, or an element with a checked input inside of it to be able to focus it\n\n // 0 second timeout added because DOM needs to be up to date after list is updated before running query\n setTimeout(() => {\n const focusableElements = Array.from(el.querySelectorAll(selector));\n\n if (focusableElements.length > 0) {\n if (allowTabFocus) (focusableElements[0] as HTMLElement).tabIndex = 0;\n focusableElements.slice(1).forEach(item => {\n if (item instanceof HTMLElement) {\n const checked = (item as HTMLInputElement).checked;\n if (!checked) item.tabIndex = -1;\n }\n });\n }\n }, 0);\n },\n [selector, ...dependencies]\n );\n\n const listener = useCallback(\n (e: KeyboardEvent) => {\n const el = ref.current;\n if (!el) return;\n if (['Home', 'End', NextKey, PrevKey].includes(e.key)) e.preventDefault();\n\n if (!documentIsAvailable) return;\n\n const items = Array.from(el.querySelectorAll(selector)).filter(\n (item): item is HTMLElement => item instanceof HTMLElement\n );\n\n if (!items.length) return;\n\n const rootNode = el.getRootNode();\n\n if (!(rootNode instanceof Document) && !(rootNode instanceof ShadowRoot)) return;\n\n const focusIdx = items.indexOf(rootNode.activeElement as HTMLElement);\n const lastIdx = items.length - 1;\n let newFocusIdx;\n\n if (e.key === 'Home' || (e.key === NextKey && focusIdx === -1)) {\n newFocusIdx = 0;\n } else if (e.key === 'End' || (e.key === PrevKey && focusIdx === -1)) {\n newFocusIdx = lastIdx;\n } else if (e.key === 'Enter') {\n if (updateTabIndex) {\n setTabIndexes(el);\n }\n return;\n } else if (e.key === NextKey) {\n if (focusIdx === lastIdx) {\n if (!cycle) return;\n newFocusIdx = 0;\n } else {\n newFocusIdx = focusIdx + 1;\n }\n } else if (e.key === PrevKey) {\n if (focusIdx === 0) {\n if (!cycle) return;\n newFocusIdx = lastIdx;\n } else {\n newFocusIdx = focusIdx - 1;\n }\n } else {\n return;\n }\n\n items[newFocusIdx].focus();\n },\n [ref.current, cycle, selector, ...dependencies]\n );\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n if (updateTabIndex) {\n setTabIndexes(el);\n }\n el.addEventListener('keydown', listener);\n\n return () => {\n el.removeEventListener('keydown', listener);\n };\n }, [ref.current, selector, listener, ...dependencies]);\n};\n\nexport default useArrows;\n"]}
|
|
1
|
+
{"version":3,"file":"useArrows.js","sourceRoot":"","sources":["../../src/hooks/useArrows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,SAAS,GAAG;;;;;CAKjB,CAAC;AAEF;;;GAGG;AACH,MAAM,SAAS,GAAG,CAChB,GAA2B,EAC3B;AACE,yKAAyK;AACzK,KAAK,GAAG,IAAI;AACZ,wPAAwP;AACxP,QAAQ,GAAG,SAAS;AACpB,uDAAuD;AACvD,GAAG,GAAG,SAAS,EACf,aAAa,GAAG,IAAI,EACpB,cAAc,GAAG,IAAI;AACrB,uFAAuF;AACvF,mBAAmB,KAQjB,EAAE;AACN,uEAAuE;AACvE,eAA+B,EAAE,EACjC,EAAE;IACF,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GACtB,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAE7E,MAAM,aAAa,GAAG,WAAW,CAC/B,CAAC,EAAe,EAAE,EAAE;QAClB,8IAA8I;QAC9I,MAAM,iBAAiB,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAEpE,IAAI,iBAAiB,CA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ACF;QACD,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAEzC,OAAO,GAAG,EAAE;YACV,EAAE,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC9C,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;AAC9E,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { useEffect, useCallback } from 'react';\nimport type { RefObject, DependencyList } from 'react';\n\nimport { documentIsAvailable } from '../utils';\n\nconst focusable = `\n a[href],\n button:enabled,\n input[type='checkbox']:enabled,\n input[type='radio']:enabled\n`;\n\n/**\n * @example useArrows(ref, { cycle, selector });\n * @param ref - A reference to the element that will be navigated through. [React RefObject](https://reactjs.org/docs/refs-and-the-dom.html)\n */\nconst useArrows = (\n ref: RefObject<HTMLElement>,\n {\n /** If true, the down or up arrow key will navigate to the first or last element if the element currently focused is the last or first index of the selected elements. */\n cycle = true,\n /** A query selector that will determine which elements to cycle through with the arrow keys. The selector will be used in conjunction with [querySelectorAll](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll#selectors). */\n selector = focusable,\n /** Which keys are used to navigate through the list */\n dir = 'up-down',\n allowTabFocus = true,\n updateTabIndex = true,\n /** When focus enters the ref, which element should receive focus first if available */\n initialFocusElement\n }: {\n cycle?: boolean;\n selector?: string;\n dir?: 'up-down' | 'left-right';\n allowTabFocus?: boolean;\n updateTabIndex?: boolean;\n initialFocusElement?: Element | null;\n } = {},\n /** Pass this prop in the internal dependencies when list is dynamic */\n dependencies: DependencyList = []\n) => {\n const [NextKey, PrevKey] =\n dir === 'up-down' ? ['ArrowDown', 'ArrowUp'] : ['ArrowRight', 'ArrowLeft'];\n\n const setTabIndexes = useCallback(\n (el: HTMLElement) => {\n // don't set tabindex -1 for first element, or the initialFocusElement, or an element with a checked input inside of it to be able to focus it\n const focusableElements = Array.from(el.querySelectorAll(selector));\n\n if (focusableElements.length > 0) {\n let focusIndex = focusableElements.findIndex(focusEl => focusEl === initialFocusElement);\n if (focusIndex === -1) focusIndex = 0;\n\n if (allowTabFocus) (focusableElements[focusIndex] as HTMLElement).tabIndex = 0;\n focusableElements.splice(focusIndex, 1);\n focusableElements.forEach(item => {\n if (item instanceof HTMLElement) {\n const checked = (item as HTMLInputElement).checked;\n if (!checked) item.tabIndex = -1;\n }\n });\n }\n },\n [selector, initialFocusElement, ...dependencies]\n );\n\n const listener = useCallback(\n (e: KeyboardEvent) => {\n const el = ref.current;\n if (!el) return;\n if (['Home', 'End', NextKey, PrevKey].includes(e.key)) e.preventDefault();\n\n if (!documentIsAvailable) return;\n\n const items = Array.from(el.querySelectorAll(selector)).filter(\n (item): item is HTMLElement => item instanceof HTMLElement\n );\n\n if (!items.length) return;\n\n const rootNode = el.getRootNode();\n\n if (!(rootNode instanceof Document) && !(rootNode instanceof ShadowRoot)) return;\n\n const focusIdx = items.indexOf(rootNode.activeElement as HTMLElement);\n const lastIdx = items.length - 1;\n let newFocusIdx;\n\n if (e.key === 'Home' || (e.key === NextKey && focusIdx === -1)) {\n const focusableElements = Array.from(el.querySelectorAll(selector));\n const focusIndex = focusableElements.findIndex(focusEl => focusEl === initialFocusElement);\n newFocusIdx = focusIndex === -1 ? 0 : focusIndex;\n } else if (e.key === 'End' || (e.key === PrevKey && focusIdx === -1)) {\n newFocusIdx = lastIdx;\n } else if (e.key === 'Enter') {\n if (updateTabIndex) {\n setTabIndexes(el);\n }\n return;\n } else if (e.key === NextKey) {\n if (focusIdx === lastIdx) {\n if (!cycle) return;\n newFocusIdx = 0;\n } else {\n newFocusIdx = focusIdx + 1;\n }\n } else if (e.key === PrevKey) {\n if (focusIdx === 0) {\n if (!cycle) return;\n newFocusIdx = lastIdx;\n } else {\n newFocusIdx = focusIdx - 1;\n }\n } else if (e.key === 'Tab' && initialFocusElement) {\n // We need to reset the tabIndex for the initial focused element when leaving the group. 0 second timeout necessary to avoid focusing this element instad of leaving the group.\n setTimeout(() => {\n (initialFocusElement as HTMLElement).tabIndex = 0;\n }, 0);\n return;\n } else {\n return;\n }\n\n // If there is an initial focused element other than the default, the tabIndex must be set to -1 the moment arrow keys are used to prevent that element from being tabbable while within the group focus.\n if ((e.key === PrevKey || e.key === NextKey) && initialFocusElement) {\n (initialFocusElement as HTMLElement).tabIndex = -1;\n }\n\n items[newFocusIdx].focus();\n },\n [ref.current, cycle, selector, initialFocusElement, ...dependencies]\n );\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n if (updateTabIndex) {\n if (initialFocusElement) {\n // If there is an element defined that should receive default focus, no timeout is necessary\n setTabIndexes(el);\n } else {\n // 0 second timeout added because DOM needs to be up to date after list is updated before running query\n setTimeout(() => {\n setTabIndexes(el);\n }, 0);\n }\n }\n el.addEventListener('keydown', listener);\n\n return () => {\n el.removeEventListener('keydown', listener);\n };\n }, [ref.current, selector, listener, initialFocusElement, ...dependencies]);\n};\n\nexport default useArrows;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusTrap.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocusTrap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAMvD;;;;;GAKG;AACH,QAAA,MAAM,YAAY,eACJ,UAAU,WAAW,CAAC,qBAChB,OAAO,
|
|
1
|
+
{"version":3,"file":"useFocusTrap.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocusTrap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAMvD;;;;;GAKG;AACH,QAAA,MAAM,YAAY,eACJ,UAAU,WAAW,CAAC,qBAChB,OAAO,wCAgD1B,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -16,13 +16,40 @@ const useFocusTrap = (elementRef, attachToDocument = true, dependencies = []) =>
|
|
|
16
16
|
const requiresFocus = activeEl === elementRef.current ||
|
|
17
17
|
!elementRef.current?.contains(activeEl) ||
|
|
18
18
|
(elementRef.current?.contains(activeEl) && !focusables.includes(activeEl));
|
|
19
|
-
if (
|
|
20
|
-
firstFocusable?.focus();
|
|
19
|
+
if (requiresFocus) {
|
|
21
20
|
e.preventDefault();
|
|
21
|
+
if (activeEl) {
|
|
22
|
+
const focusablesWithActiveEl = getFocusables(elementRef, { includeActiveEl: true });
|
|
23
|
+
const activeElIndex = focusablesWithActiveEl.findIndex(el => el === activeEl);
|
|
24
|
+
if (activeElIndex !== -1) {
|
|
25
|
+
if (e.shiftKey) {
|
|
26
|
+
focusablesWithActiveEl[(activeElIndex - 1) % focusablesWithActiveEl.length].focus();
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
focusablesWithActiveEl[(activeElIndex + 1) % focusablesWithActiveEl.length].focus();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (e.shiftKey) {
|
|
33
|
+
lastFocusable?.focus();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
firstFocusable?.focus();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if (e.shiftKey) {
|
|
40
|
+
lastFocusable?.focus();
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
firstFocusable?.focus();
|
|
44
|
+
}
|
|
22
45
|
}
|
|
23
|
-
else if (e.shiftKey &&
|
|
46
|
+
else if (e.shiftKey && activeEl === firstFocusable) {
|
|
47
|
+
e.preventDefault();
|
|
24
48
|
lastFocusable?.focus();
|
|
49
|
+
}
|
|
50
|
+
else if (!e.shiftKey && activeEl === lastFocusable) {
|
|
25
51
|
e.preventDefault();
|
|
52
|
+
firstFocusable?.focus();
|
|
26
53
|
}
|
|
27
54
|
}
|
|
28
55
|
}, dependencies);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusTrap.js","sourceRoot":"","sources":["../../src/hooks/useFocusTrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CACnB,UAAkC,EAClC,mBAA4B,IAAI,EAChC,eAA+B,EAAE,EACjC,EAAE;IACF,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,CAAgB,EAAE,EAAE;QACjD,IAAI,CAAC,CAAC,GAAG,KAAK,KAAK,EAAE;YACnB,MAAM,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;YAC7C,MAAM,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC;YACjF,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;YAEpC,MAAM,aAAa,GACjB,QAAQ,KAAK,UAAU,CAAC,OAAO;gBAC/B,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC;gBACvC,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAuB,CAAC,CAAC,CAAC;YAE5F,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"useFocusTrap.js","sourceRoot":"","sources":["../../src/hooks/useFocusTrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;;;;GAKG;AACH,MAAM,YAAY,GAAG,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,EAAE,CAAC;yBACrF;qBACF;yBAAM,IAAI,CAAC,CAAC,QAAQ,EAAE;wBACrB,aAAa,EAAE,KAAK,EAAE,CAAC;qBACxB;yBAAM;wBACL,cAAc,EAAE,KAAK,EAAE,CAAC;qBACzB;iBACF;qBAAM,IAAI,CAAC,CAAC,QAAQ,EAAE;oBACrB,aAAa,EAAE,KAAK,EAAE,CAAC;iBACxB;qBAAM;oBACL,cAAc,EAAE,KAAK,EAAE,CAAC;iBACzB;aACF;iBAAM,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,KAAK,cAAc,EAAE;gBACpD,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,aAAa,EAAE,KAAK,EAAE,CAAC;aACxB;iBAAM,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,QAAQ,KAAK,aAAa,EAAE;gBACpD,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,cAAc,EAAE,KAAK,EAAE,CAAC;aACzB;SACF;IACH,CAAC,EAAE,YAAY,CAAC,CAAC;IAEjB,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC;AACxF,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useCallback } from 'react';\nimport type { RefObject, DependencyList } from 'react';\n\nimport { getFocusables, getActiveElement } from '../utils';\n\nimport useEvent from './useEvent';\n\n/**\n * @example useFocusTrap(elementRef)\n * @param elementRef ref of the element in which focus needs to be retained\n * @param addToDocument boolean value to specify if event to be attached to document or to be taken from elementRef, defaults to true\n * @param dependencies list of variables or functions that will initiate this hook when they are updated.\n */\nconst useFocusTrap = (\n elementRef: RefObject<HTMLElement>,\n attachToDocument: boolean = true,\n dependencies: DependencyList = []\n) => {\n const onKeydown = useCallback((e: KeyboardEvent) => {\n if (e.key === 'Tab') {\n const focusables = getFocusables(elementRef);\n const { 0: firstFocusable, [focusables.length - 1]: lastFocusable } = focusables;\n const activeEl = getActiveElement();\n\n const requiresFocus =\n activeEl === elementRef.current ||\n !elementRef.current?.contains(activeEl) ||\n (elementRef.current?.contains(activeEl) && !focusables.includes(activeEl as HTMLElement));\n\n if (requiresFocus) {\n e.preventDefault();\n\n if (activeEl) {\n const focusablesWithActiveEl = getFocusables(elementRef, { includeActiveEl: true });\n const activeElIndex = focusablesWithActiveEl.findIndex(el => el === activeEl);\n\n if (activeElIndex !== -1) {\n if (e.shiftKey) {\n focusablesWithActiveEl[(activeElIndex - 1) % focusablesWithActiveEl.length].focus();\n } else {\n focusablesWithActiveEl[(activeElIndex + 1) % focusablesWithActiveEl.length].focus();\n }\n } else if (e.shiftKey) {\n lastFocusable?.focus();\n } else {\n firstFocusable?.focus();\n }\n } else if (e.shiftKey) {\n lastFocusable?.focus();\n } else {\n firstFocusable?.focus();\n }\n } else if (e.shiftKey && activeEl === firstFocusable) {\n e.preventDefault();\n lastFocusable?.focus();\n } else if (!e.shiftKey && activeEl === lastFocusable) {\n e.preventDefault();\n firstFocusable?.focus();\n }\n }\n }, dependencies);\n\n useEvent('keydown', onKeydown, { target: attachToDocument ? undefined : elementRef });\n};\n\nexport default useFocusTrap;\n"]}
|
package/lib/hooks/useI18n.d.ts
CHANGED
|
@@ -187,6 +187,7 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
187
187
|
app_shell_main_navigation_label: string;
|
|
188
188
|
shortcut_NextRegion: string;
|
|
189
189
|
shortcut_PrevRegion: string;
|
|
190
|
+
app_shell_user_account: string;
|
|
190
191
|
combobox_open_close: string;
|
|
191
192
|
combobox_search_instructions: string;
|
|
192
193
|
combobox_open_list_button_a11y: string;
|
|
@@ -206,6 +207,9 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
206
207
|
modal_maximize: string;
|
|
207
208
|
modal_dock: string;
|
|
208
209
|
modal_close: string;
|
|
210
|
+
minimize: string;
|
|
211
|
+
maximize: string;
|
|
212
|
+
dock: string;
|
|
209
213
|
selected_date_a11y: string;
|
|
210
214
|
open_calendar_button_a11y: string;
|
|
211
215
|
close_calendar_button_a11y: string;
|
|
@@ -260,6 +264,8 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
260
264
|
enter_a_number: string;
|
|
261
265
|
skip_navigation_menu_label: string;
|
|
262
266
|
tab_error_tooltip: string;
|
|
267
|
+
non_previewable: string;
|
|
268
|
+
content_load_error: string;
|
|
263
269
|
assignments: string;
|
|
264
270
|
article_list_label_a11y: string;
|
|
265
271
|
article_list_filter_label_a11y: string;
|
|
@@ -272,6 +278,9 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
272
278
|
disclaimer: string;
|
|
273
279
|
references: string;
|
|
274
280
|
result_available: string;
|
|
281
|
+
ask: string;
|
|
282
|
+
error_message: string;
|
|
283
|
+
add_a_comment: string;
|
|
275
284
|
article_label_a11y: string;
|
|
276
285
|
article_related_links: string;
|
|
277
286
|
article_more_like_this: string;
|
|
@@ -349,6 +358,11 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
349
358
|
shortcut_GoToIncomingInteraction: string;
|
|
350
359
|
shortcut_DismissIncomingInteraction: string;
|
|
351
360
|
rte_heading_style: string;
|
|
361
|
+
rte_heading_style_normal: string;
|
|
362
|
+
rte_heading_style_heading_1: string;
|
|
363
|
+
rte_heading_style_heading_2: string;
|
|
364
|
+
rte_heading_style_heading_3: string;
|
|
365
|
+
rte_heading_style_heading_4: string;
|
|
352
366
|
rte_bold: string;
|
|
353
367
|
rte_italic: string;
|
|
354
368
|
rte_strike_through: string;
|
|
@@ -488,7 +502,11 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
488
502
|
collapse_suggested_replies: string;
|
|
489
503
|
replies_count: string;
|
|
490
504
|
no_suggestion: string;
|
|
505
|
+
suggestion: string;
|
|
491
506
|
suggested_reply_copied_to_input_field: string;
|
|
507
|
+
dialogue: string;
|
|
508
|
+
pega_genAI: string;
|
|
509
|
+
suggest_reply: string;
|
|
492
510
|
unique_entities: {
|
|
493
511
|
zero: string;
|
|
494
512
|
one: string;
|
|
@@ -637,10 +655,13 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
637
655
|
follow_up_tasks: string;
|
|
638
656
|
add_follow_up_task: string;
|
|
639
657
|
agents_utterance: string;
|
|
658
|
+
due_on: string;
|
|
640
659
|
sentiment_positive: string;
|
|
641
660
|
sentiment_negative: string;
|
|
642
661
|
sentiment_neutral: string;
|
|
643
662
|
no_recommendations: string;
|
|
663
|
+
items_added_to_previous_list: string;
|
|
664
|
+
items_added_to_current_list: string;
|
|
644
665
|
condition_builder_advanced_condition_label: string;
|
|
645
666
|
condition_builder_advanced_condition_placeholder: string;
|
|
646
667
|
condition_builder_advanced_mode_button_label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,QAAA,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/lib/i18n/default.d.ts
CHANGED
|
@@ -183,6 +183,7 @@ declare const _default: {
|
|
|
183
183
|
app_shell_main_navigation_label: string;
|
|
184
184
|
shortcut_NextRegion: string;
|
|
185
185
|
shortcut_PrevRegion: string;
|
|
186
|
+
app_shell_user_account: string;
|
|
186
187
|
combobox_open_close: string;
|
|
187
188
|
combobox_search_instructions: string;
|
|
188
189
|
combobox_open_list_button_a11y: string;
|
|
@@ -202,6 +203,9 @@ declare const _default: {
|
|
|
202
203
|
modal_maximize: string;
|
|
203
204
|
modal_dock: string;
|
|
204
205
|
modal_close: string;
|
|
206
|
+
minimize: string;
|
|
207
|
+
maximize: string;
|
|
208
|
+
dock: string;
|
|
205
209
|
selected_date_a11y: string;
|
|
206
210
|
open_calendar_button_a11y: string;
|
|
207
211
|
close_calendar_button_a11y: string;
|
|
@@ -256,6 +260,8 @@ declare const _default: {
|
|
|
256
260
|
enter_a_number: string;
|
|
257
261
|
skip_navigation_menu_label: string;
|
|
258
262
|
tab_error_tooltip: string;
|
|
263
|
+
non_previewable: string;
|
|
264
|
+
content_load_error: string;
|
|
259
265
|
assignments: string;
|
|
260
266
|
article_list_label_a11y: string;
|
|
261
267
|
article_list_filter_label_a11y: string;
|
|
@@ -268,6 +274,9 @@ declare const _default: {
|
|
|
268
274
|
disclaimer: string;
|
|
269
275
|
references: string;
|
|
270
276
|
result_available: string;
|
|
277
|
+
ask: string;
|
|
278
|
+
error_message: string;
|
|
279
|
+
add_a_comment: string;
|
|
271
280
|
article_label_a11y: string;
|
|
272
281
|
article_related_links: string;
|
|
273
282
|
article_more_like_this: string;
|
|
@@ -345,6 +354,11 @@ declare const _default: {
|
|
|
345
354
|
shortcut_GoToIncomingInteraction: string;
|
|
346
355
|
shortcut_DismissIncomingInteraction: string;
|
|
347
356
|
rte_heading_style: string;
|
|
357
|
+
rte_heading_style_normal: string;
|
|
358
|
+
rte_heading_style_heading_1: string;
|
|
359
|
+
rte_heading_style_heading_2: string;
|
|
360
|
+
rte_heading_style_heading_3: string;
|
|
361
|
+
rte_heading_style_heading_4: string;
|
|
348
362
|
rte_bold: string;
|
|
349
363
|
rte_italic: string;
|
|
350
364
|
rte_strike_through: string;
|
|
@@ -484,7 +498,11 @@ declare const _default: {
|
|
|
484
498
|
collapse_suggested_replies: string;
|
|
485
499
|
replies_count: string;
|
|
486
500
|
no_suggestion: string;
|
|
501
|
+
suggestion: string;
|
|
487
502
|
suggested_reply_copied_to_input_field: string;
|
|
503
|
+
dialogue: string;
|
|
504
|
+
pega_genAI: string;
|
|
505
|
+
suggest_reply: string;
|
|
488
506
|
unique_entities: {
|
|
489
507
|
zero: string;
|
|
490
508
|
one: string;
|
|
@@ -633,10 +651,13 @@ declare const _default: {
|
|
|
633
651
|
follow_up_tasks: string;
|
|
634
652
|
add_follow_up_task: string;
|
|
635
653
|
agents_utterance: string;
|
|
654
|
+
due_on: string;
|
|
636
655
|
sentiment_positive: string;
|
|
637
656
|
sentiment_negative: string;
|
|
638
657
|
sentiment_neutral: string;
|
|
639
658
|
no_recommendations: string;
|
|
659
|
+
items_added_to_previous_list: string;
|
|
660
|
+
items_added_to_current_list: string;
|
|
640
661
|
condition_builder_advanced_condition_label: string;
|
|
641
662
|
condition_builder_advanced_condition_placeholder: string;
|
|
642
663
|
condition_builder_advanced_mode_button_label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/i18n/default.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/i18n/default.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBA8pCE"}
|
package/lib/i18n/default.js
CHANGED
|
@@ -203,6 +203,7 @@ export default {
|
|
|
203
203
|
app_shell_main_navigation_label: 'Main',
|
|
204
204
|
shortcut_NextRegion: 'Next region',
|
|
205
205
|
shortcut_PrevRegion: 'Previous region',
|
|
206
|
+
app_shell_user_account: 'Account',
|
|
206
207
|
/* core:ComboBox */
|
|
207
208
|
combobox_open_close: 'Arrow down to open, press escape to close.',
|
|
208
209
|
combobox_search_instructions: 'Start typing to search',
|
|
@@ -223,8 +224,11 @@ export default {
|
|
|
223
224
|
/* core:Modal */
|
|
224
225
|
modal_minimize: 'Minimize modal',
|
|
225
226
|
modal_maximize: 'Maximize modal',
|
|
226
|
-
modal_dock: 'Dock
|
|
227
|
+
modal_dock: 'Dock modal',
|
|
227
228
|
modal_close: 'Close modal',
|
|
229
|
+
minimize: 'Minimize',
|
|
230
|
+
maximize: 'Maximize',
|
|
231
|
+
dock: 'Dock',
|
|
228
232
|
/* core:Datetime */
|
|
229
233
|
selected_date_a11y: 'Selected date:',
|
|
230
234
|
open_calendar_button_a11y: 'Open calendar',
|
|
@@ -293,6 +297,9 @@ export default {
|
|
|
293
297
|
skip_navigation_menu_label: 'Skip navigation menu',
|
|
294
298
|
/* core:Tabs */
|
|
295
299
|
tab_error_tooltip: '{0} has errors',
|
|
300
|
+
/* core:LightBox */
|
|
301
|
+
non_previewable: "{0} file can't be previewed in your browser",
|
|
302
|
+
content_load_error: 'Error loading content',
|
|
296
303
|
/* work:Assignments */
|
|
297
304
|
assignments: 'Assignments',
|
|
298
305
|
/* work:ArticleList */
|
|
@@ -307,6 +314,9 @@ export default {
|
|
|
307
314
|
disclaimer: 'Disclaimer',
|
|
308
315
|
references: 'References',
|
|
309
316
|
result_available: 'Result available',
|
|
317
|
+
ask: 'Ask',
|
|
318
|
+
error_message: 'Unable to retrieve data at the moment. Please try again.',
|
|
319
|
+
add_a_comment: 'Add a comment',
|
|
310
320
|
/* work:Article */
|
|
311
321
|
article_label_a11y: 'Article',
|
|
312
322
|
article_related_links: 'Related links',
|
|
@@ -397,6 +407,11 @@ export default {
|
|
|
397
407
|
shortcut_DismissIncomingInteraction: 'Dismiss incoming interaction popup.',
|
|
398
408
|
/* rte:RichTextEditor */
|
|
399
409
|
rte_heading_style: 'Heading style',
|
|
410
|
+
rte_heading_style_normal: 'Normal',
|
|
411
|
+
rte_heading_style_heading_1: 'Heading 1',
|
|
412
|
+
rte_heading_style_heading_2: 'Heading 2',
|
|
413
|
+
rte_heading_style_heading_3: 'Heading 3',
|
|
414
|
+
rte_heading_style_heading_4: 'Heading 4',
|
|
400
415
|
rte_bold: 'Bold',
|
|
401
416
|
rte_italic: 'Italic',
|
|
402
417
|
rte_strike_through: 'Strike-through',
|
|
@@ -539,7 +554,11 @@ export default {
|
|
|
539
554
|
collapse_suggested_replies: 'Collapse suggested replies',
|
|
540
555
|
replies_count: '{0} of {1}',
|
|
541
556
|
no_suggestion: 'No suggestions',
|
|
557
|
+
suggestion: 'Suggestion',
|
|
542
558
|
suggested_reply_copied_to_input_field: 'Suggested reply copied to input field',
|
|
559
|
+
dialogue: 'Dialogue',
|
|
560
|
+
pega_genAI: 'Pega GenAI',
|
|
561
|
+
suggest_reply: 'Suggest reply',
|
|
543
562
|
/* cs:Email */
|
|
544
563
|
unique_entities: {
|
|
545
564
|
zero: 'No unique entities',
|
|
@@ -691,13 +710,17 @@ export default {
|
|
|
691
710
|
download_transcript: 'Download transcript',
|
|
692
711
|
follow_up_tasks: 'Follow-up tasks',
|
|
693
712
|
add_follow_up_task: 'Add follow-up task',
|
|
694
|
-
agents_utterance: "Agent's
|
|
713
|
+
agents_utterance: "Agent's commitment in context",
|
|
714
|
+
/* cs:FollowUpTask */
|
|
715
|
+
due_on: 'Due on {0}',
|
|
695
716
|
/* cs:Sentiment */
|
|
696
717
|
sentiment_positive: 'Positive',
|
|
697
718
|
sentiment_negative: 'Negative',
|
|
698
719
|
sentiment_neutral: 'Neutral',
|
|
699
720
|
/* cs:IntelligentGuidance */
|
|
700
721
|
no_recommendations: 'No recommendations',
|
|
722
|
+
items_added_to_previous_list: 'Items added to previous list',
|
|
723
|
+
items_added_to_current_list: 'Items added to current list',
|
|
701
724
|
/* condition-builder:ConditionBuilder */
|
|
702
725
|
condition_builder_advanced_condition_label: 'Advanced condition',
|
|
703
726
|
condition_builder_advanced_condition_placeholder: 'Advanced condition',
|