@pega/cosmos-react-core 3.0.0-dev.4.1 → 3.0.0-dev.4.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/lib/components/Badges/Selection.d.ts.map +1 -1
- package/lib/components/Badges/Selection.js +3 -2
- package/lib/components/Badges/Selection.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +10 -3
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +8 -6
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
- package/lib/components/Drawer/Drawer.d.ts.map +1 -1
- package/lib/components/Drawer/Drawer.js +1 -1
- package/lib/components/Drawer/Drawer.js.map +1 -1
- package/lib/components/Icon/icons/open.icon.js +1 -1
- package/lib/components/Icon/icons/open.icon.js.map +1 -1
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.js +10 -39
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/hooks/index.d.ts +1 -1
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/index.js +1 -1
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useActiveDescendant.d.ts +9 -0
- package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
- package/lib/hooks/useActiveDescendant.js +29 -0
- package/lib/hooks/useActiveDescendant.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 +3 -2
- package/lib/hooks/useArrows.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +24 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useItemIntersection.d.ts.map +1 -1
- package/lib/hooks/useItemIntersection.js +18 -20
- package/lib/hooks/useItemIntersection.js.map +1 -1
- package/lib/i18n/default.d.ts +24 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +25 -0
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +48 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/theme/themes/buildTheme.json +1 -2
- package/package.json +1 -2
|
@@ -47,5 +47,14 @@ declare const useActiveDescendant: ({ focusEl, scope, scopeSelector, selector, f
|
|
|
47
47
|
activeDescendant: CurrentDescendant;
|
|
48
48
|
descendants: Descendants;
|
|
49
49
|
};
|
|
50
|
+
export declare const useLazyDescendant: ({ loading, descendants, previousActiveDescendant, activeDescendant, focusReturnEl, setFocusReturnEl, scrollEl }: {
|
|
51
|
+
loading: boolean;
|
|
52
|
+
descendants: Descendants;
|
|
53
|
+
previousActiveDescendant: CurrentDescendant;
|
|
54
|
+
activeDescendant: CurrentDescendant;
|
|
55
|
+
focusReturnEl: UseActiveDescendantConfig['focusReturnEl'];
|
|
56
|
+
setFocusReturnEl: (el: HTMLElement | null | undefined) => void;
|
|
57
|
+
scrollEl?: HTMLElement | null | undefined;
|
|
58
|
+
}) => void;
|
|
50
59
|
export default useActiveDescendant;
|
|
51
60
|
//# sourceMappingURL=useActiveDescendant.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActiveDescendant.d.ts","sourceRoot":"","sources":["../../src/hooks/useActiveDescendant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,cAAc,EAAuB,MAAM,OAAO,CAAC;AAIjF,MAAM,WAAW,yBAAyB;IACxC,4DAA4D;IAC5D,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,wCAAwC;IACxC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;I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BAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC;;OAEG;IACH,aAAa,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACnC,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,WAAW,KAAK,IAAI,CAAC;IACrD;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,wDAAwD;IACxD,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC;;OAEG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED,aAAK,iBAAiB,GAAG,WAAW,GAAG,SAAS,CAAC;AACjD,aAAK,WAAW,GAAG,WAAW,EAAE,GAAG,IAAI,CAAC;AAExC,QAAA,MAAM,mBAAmB,6NAepB,yBAAyB;sBAGV,iBAAiB;iBACtB,WAAW;CA6OzB,CAAC;AAEF,eAAO,MAAM,iBAAiB;aASnB,OAAO;iBACH,WAAW;8BACE,iBAAiB;sBACzB,iBAAiB;mBACpB,yBAAyB,CAAC,eAAe,CAAC;2BAClC,WAAW,GAAG,IAAI,GAAG,SAAS,KAAK,IAAI;;UAgC/D,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -203,5 +203,34 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusDes
|
|
|
203
203
|
descendants: descendants || null
|
|
204
204
|
};
|
|
205
205
|
};
|
|
206
|
+
export const useLazyDescendant = ({ loading, descendants, previousActiveDescendant, activeDescendant, focusReturnEl, setFocusReturnEl, scrollEl }) => {
|
|
207
|
+
// Bump scroll & set return element when descendant focused in loading state.
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
if (loading && descendants && descendants.length && activeDescendant) {
|
|
210
|
+
const descendantList = [...descendants];
|
|
211
|
+
const lastItem = descendantList.pop();
|
|
212
|
+
const lastId = lastItem?.id || undefined;
|
|
213
|
+
if (lastId === activeDescendant.id) {
|
|
214
|
+
if (scrollEl) {
|
|
215
|
+
scrollEl.scrollTop = scrollEl.scrollHeight - scrollEl.offsetHeight;
|
|
216
|
+
}
|
|
217
|
+
if (focusReturnEl?.id !== activeDescendant.id) {
|
|
218
|
+
// Set focus return to AD on 'nextTick', to avoid reset of AD on update
|
|
219
|
+
setTimeout(() => {
|
|
220
|
+
setFocusReturnEl(lastItem);
|
|
221
|
+
}, 0);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
// If not last item
|
|
225
|
+
else if (focusReturnEl?.id !== activeDescendant.id) {
|
|
226
|
+
// Set focus return to AD on 'nextTick' to avoid reset of AD on update
|
|
227
|
+
// Do not D.R.Y to avoid conflicting calls with immediately prior elements.
|
|
228
|
+
setTimeout(() => {
|
|
229
|
+
setFocusReturnEl(activeDescendant);
|
|
230
|
+
}, 0);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}, [loading, descendants, previousActiveDescendant, activeDescendant, scrollEl, focusReturnEl]);
|
|
234
|
+
};
|
|
206
235
|
export default useActiveDescendant;
|
|
207
236
|
//# sourceMappingURL=useActiveDescendant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActiveDescendant.js","sourceRoot":"","sources":["../../src/hooks/useActiveDescendant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAgDrC,MAAM,mBAAmB,GAAG,CAC1B,EACE,OAAO,EACP,KAAK,EACL,aAAa,EACb,QAAQ,EACR,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,EACP,oBAAoB,EACpB,yBAAyB,GAAG,KAAK,EACjC,kBAAk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gB,EAAE,YAAY,KAAK,IAAI,IAAI,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS;QAC9F,WAAW,EAAE,WAAW,IAAI,IAAI;KACjC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { useEffect, useState, DependencyList, useCallback, useRef } from 'react';\n\nimport { createUID } from '../utils';\n\nexport interface UseActiveDescendantConfig {\n /** DOM element which controls and has active descendants */\n focusEl: HTMLElement | null;\n /** Root scope for descendant options */\n scope: HTMLElement | null;\n /** Custom selector for specific descendant scope in root descendant scope */\n scopeSelector?: string;\n /** Custom selector for descendant options */\n selector?: string;\n /** One-time override for the focused descendant, triggers re-evaluation.\n * Include `clearFocusDescendantEl` for cleanup.\n */\n focusDescendantEl?: HTMLElement | null;\n /** Callback to clear focusDescendantEl after use. */\n clearFocusDescendant?: () => void;\n /** One-time override for focused element on NEXT re-evaluation of active descendants.\n * Include `clearFocusReturn` for cleanup.\n */\n focusReturnEl?: HTMLElement | null;\n /** Callback to clear focusReturnEl after use. */\n clearFocusReturn?: () => void;\n /**\n * Descendant ID used for continuous override of current active descendant,\n * used for external focus control / keyDown bindings (see RTE).\n * NOTE: setting currentDescendantId once effectively disables the keybindings of this hook.\n * If you only need to set the current element once, use focusReturnEl & clearFocusReturn.\n * @deprecated\n */\n currentDescendantId?: string;\n /** Explicit onClick handler called on keydown 'enter' event */\n onClick?: (currentDescendantEl: HTMLElement) => void;\n /** Prevent scrolling to the active descendant on the initial render.\n * Include `preventInitialScroll` for cleanup.\n */\n preventInitialScroll?: boolean;\n /** Callback to clear preventInitialScroll after use. */\n clearPreventScroll?: () => void;\n /** Boolean to prevent descendant evaluation.\n * @default false\n */\n pauseDescendantEvaluation?: boolean;\n}\n\ntype CurrentDescendant = HTMLElement | undefined;\ntype Descendants = HTMLElement[] | null;\n\nconst useActiveDescendant = (\n {\n focusEl,\n scope,\n scopeSelector,\n selector,\n focusDescendantEl,\n clearFocusDescendant,\n focusReturnEl,\n clearFocusReturn,\n currentDescendantId,\n onClick,\n preventInitialScroll,\n pauseDescendantEvaluation = false,\n clearPreventScroll\n }: UseActiveDescendantConfig,\n dependencyArray: DependencyList = []\n): {\n activeDescendant: CurrentDescendant;\n descendants: Descendants;\n} => {\n const [resetId, setResetId] = useState(0);\n const previousActiveId = useRef('');\n const [focusDescendantElIndex, setFocusDescendantElIndex] = useState<number | null>(null);\n const [currentIndex, setCurrentIndex] = useState<number | null>(null);\n const [descendants, setDescendants] = useState<Descendants>();\n\n const clearThenSetDescendants = useCallback(\n (setVal: NodeListOf<Element> | null) => {\n descendants?.forEach(node => {\n node.setAttribute('data-current', 'false');\n });\n\n setDescendants(\n setVal\n ? Array.from(setVal).filter((item): item is HTMLElement => item instanceof HTMLElement)\n : null\n );\n },\n [descendants]\n );\n\n // ## Toggle active scope data attr.\n useEffect(() => {\n if (!scope || !focusEl) return;\n\n scope.setAttribute('data-active-scope', document.activeElement === focusEl ? 'true' : 'false');\n\n const onFocus = () => {\n scope.setAttribute('data-active-scope', 'true');\n };\n const onBlur = () => {\n scope.setAttribute('data-active-scope', 'false');\n };\n\n focusEl.addEventListener('focus', onFocus);\n focusEl.addEventListener('blur', onBlur);\n\n return () => {\n focusEl.removeEventListener('focus', onFocus);\n focusEl.removeEventListener('blur', onBlur);\n };\n }, [scope, focusEl]);\n\n // ## Update descendants\n useEffect(() => {\n if (!pauseDescendantEvaluation) {\n // 0 second timeout added because descendantScope needs to be up to date before running query after dependencyArray change\n setTimeout(() => {\n let hasScope = scope;\n\n if (hasScope && hasScope instanceof HTMLElement) {\n if (scopeSelector) {\n hasScope = hasScope.querySelector(scopeSelector);\n }\n\n if (!hasScope) {\n clearThenSetDescendants(null);\n return;\n }\n\n if (selector) {\n clearThenSetDescendants(hasScope.querySelectorAll(selector));\n } else {\n clearThenSetDescendants(\n hasScope.querySelectorAll(\n 'a, button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"])'\n )\n );\n }\n } else {\n clearThenSetDescendants(null);\n }\n }, 0);\n }\n }, [pauseDescendantEvaluation, scope, scopeSelector, selector, focusEl, ...dependencyArray]);\n\n // ## Set IDs and aria-owns\n useEffect(() => {\n const ownedIds: string[] = [];\n setCurrentIndex(0);\n\n if (descendants && descendants.length) {\n descendants.forEach(node => {\n node.id = node.id || createUID();\n ownedIds.push(node.id);\n });\n }\n\n focusEl?.setAttribute('aria-owns', ownedIds.join(' '));\n\n return () => {\n focusEl?.removeAttribute('aria-owns');\n };\n }, [focusEl, descendants]);\n\n // ## Bind focus el keyDown\n useEffect(() => {\n const onKeyDown = (e: KeyboardEvent) => {\n if (descendants && descendants.length) {\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n // Focus next or first\n clearFocusReturn?.();\n clearPreventScroll?.();\n if (currentIndex !== null && currentIndex + 1 < descendants.length) {\n setCurrentIndex(currentIndex + 1);\n } else {\n setCurrentIndex(0);\n }\n break;\n case 'ArrowUp':\n e.preventDefault();\n // Focus previous or last\n clearFocusReturn?.();\n clearPreventScroll?.();\n if (currentIndex !== null && currentIndex - 1 > -1) {\n setCurrentIndex(currentIndex - 1);\n } else {\n setCurrentIndex(descendants.length - 1);\n }\n break;\n case 'Enter':\n e.preventDefault();\n // Click focused item\n if (descendants && descendants.length && currentIndex !== null) {\n if (onClick) {\n onClick(descendants[currentIndex]);\n break;\n }\n\n const nodeName = descendants[currentIndex].nodeName.toLowerCase();\n if (nodeName === 'input' || nodeName === 'button' || nodeName === 'a') {\n descendants[currentIndex].click();\n } else {\n descendants[currentIndex].querySelector<HTMLElement>('button, a, input')?.click();\n }\n }\n break;\n default:\n break;\n }\n }\n };\n\n // Do not rebind once / if `currentDescendantId` control is defined\n if (focusEl && descendants?.length && !currentDescendantId) {\n focusEl.addEventListener('keydown', onKeyDown);\n }\n\n return () => {\n focusEl?.removeEventListener('keydown', onKeyDown);\n };\n }, [focusEl, currentIndex, descendants]);\n\n // ## Handle independent control update\n useEffect(() => {\n if (descendants && currentDescendantId) {\n descendants.forEach((node, index) => {\n if (node.id === currentDescendantId) {\n setCurrentIndex(index);\n }\n });\n }\n }, [currentDescendantId, descendants]);\n\n // ## Set and scroll to current descendant\n useEffect(() => {\n const nextIndex = focusDescendantElIndex || currentIndex;\n const focusReturnId = focusReturnEl?.id;\n let focusReturnIndex;\n const focusDescendantElId = focusDescendantEl?.id;\n let focusDescendantIndex;\n let foundFocusDescendantEl = false;\n\n if (descendants && descendants.length) {\n // clear previous & catch focusReturn / focusDescendantEl index\n descendants.forEach((node, index) => {\n if (focusDescendantElIndex === null && node.id === focusDescendantElId) {\n focusDescendantIndex = index;\n foundFocusDescendantEl = true;\n setFocusDescendantElIndex(index);\n }\n if (node.id === focusReturnId) {\n focusReturnIndex = index;\n }\n node.setAttribute('data-current', 'false');\n });\n\n // early return for focusReturn / focusDescendantEl\n if (focusReturnIndex && focusReturnIndex !== currentIndex) {\n setCurrentIndex(focusReturnIndex);\n clearFocusReturn?.();\n return;\n }\n if (foundFocusDescendantEl && focusDescendantIndex !== undefined) {\n // hard reset to continue focusDescendantEl process even if it is the active descendant\n setResetId(Math.random());\n setCurrentIndex(focusDescendantIndex);\n return;\n }\n\n // set new\n if (nextIndex !== null && descendants[nextIndex]) {\n const itemEl = descendants[nextIndex!];\n itemEl.setAttribute('data-current', 'true');\n focusEl?.setAttribute('aria-activedescendant', itemEl.id);\n\n // scroll to element\n if (itemEl.id !== previousActiveId.current && !preventInitialScroll) {\n const scrollTo: (this: Element, arg: boolean) => void =\n Element.prototype.scrollIntoViewIfNeeded ?? Element.prototype.scrollIntoView;\n\n scrollTo?.call(itemEl, false);\n }\n\n // focusDescendantEl cleanup\n if (focusDescendantElIndex !== null) {\n setFocusDescendantElIndex(null);\n clearFocusDescendant?.();\n }\n\n previousActiveId.current = itemEl.id;\n }\n }\n\n return () => {\n focusEl?.removeAttribute('aria-activedescendant');\n };\n }, [descendants, currentIndex, focusDescendantEl, focusEl, resetId]);\n\n return {\n activeDescendant: currentIndex !== null && descendants ? descendants[currentIndex] : undefined,\n descendants: descendants || null\n };\n};\n\nexport default useActiveDescendant;\n"]}
|
|
1
|
+
{"version":3,"file":"useActiveDescendant.js","sourceRoot":"","sources":["../../src/hooks/useActiveDescendant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAgDrC,MAAM,mBAAmB,GAAG,CAC1B,EACE,OAAO,EACP,KAAK,EACL,aAAa,EACb,QAAQ,EACR,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,EACP,oBAAoB,EACpB,yBAAyB,GAAG,KAAK,EACjC,kBAAkB,EACQ,EAC5B,kBAAkC,EAAE,EAIpC,EAAE;IACF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC1C,MAAM,gBAAgB,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;IACpC,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAC1F,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACtE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,EAAe,CAAC;IAE9D,MAAM,uBAAuB,GAAG,WAAW,CACzC,CAAC,MAAkC,EAAE,EAAE;QACrC,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE;YAC1B,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,cAAc,CACZ,MAAM;YACJ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC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,QAAQ,CAAC,SAAS,GAAG,QAAQ,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;iBACpE;gBAED,IAAI,aAAa,EAAE,EAAE,KAAK,gBAAgB,CAAC,EAAE,EAAE;oBAC7C,uEAAuE;oBACvE,UAAU,CAAC,GAAG,EAAE;wBACd,gBAAgB,CAAC,QAAQ,CAAC,CAAC;oBAC7B,CAAC,EAAE,CAAC,CAAC,CAAC;iBACP;aACF;YACD,mBAAmB;iBACd,IAAI,aAAa,EAAE,EAAE,KAAK,gBAAgB,CAAC,EAAE,EAAE;gBAClD,sEAAsE;gBACtE,2EAA2E;gBAC3E,UAAU,CAAC,GAAG,EAAE;oBACd,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;gBACrC,CAAC,EAAE,CAAC,CAAC,CAAC;aACP;SACF;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;AAClG,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { useEffect, useState, DependencyList, useCallback, useRef } from 'react';\n\nimport { createUID } from '../utils';\n\nexport interface UseActiveDescendantConfig {\n /** DOM element which controls and has active descendants */\n focusEl: HTMLElement | null;\n /** Root scope for descendant options */\n scope: HTMLElement | null;\n /** Custom selector for specific descendant scope in root descendant scope */\n scopeSelector?: string;\n /** Custom selector for descendant options */\n selector?: string;\n /** One-time override for the focused descendant, triggers re-evaluation.\n * Include `clearFocusDescendantEl` for cleanup.\n */\n focusDescendantEl?: HTMLElement | null;\n /** Callback to clear focusDescendantEl after use. */\n clearFocusDescendant?: () => void;\n /** One-time override for focused element on NEXT re-evaluation of active descendants.\n * Include `clearFocusReturn` for cleanup.\n */\n focusReturnEl?: HTMLElement | null;\n /** Callback to clear focusReturnEl after use. */\n clearFocusReturn?: () => void;\n /**\n * Descendant ID used for continuous override of current active descendant,\n * used for external focus control / keyDown bindings (see RTE).\n * NOTE: setting currentDescendantId once effectively disables the keybindings of this hook.\n * If you only need to set the current element once, use focusReturnEl & clearFocusReturn.\n * @deprecated\n */\n currentDescendantId?: string;\n /** Explicit onClick handler called on keydown 'enter' event */\n onClick?: (currentDescendantEl: HTMLElement) => void;\n /** Prevent scrolling to the active descendant on the initial render.\n * Include `preventInitialScroll` for cleanup.\n */\n preventInitialScroll?: boolean;\n /** Callback to clear preventInitialScroll after use. */\n clearPreventScroll?: () => void;\n /** Boolean to prevent descendant evaluation.\n * @default false\n */\n pauseDescendantEvaluation?: boolean;\n}\n\ntype CurrentDescendant = HTMLElement | undefined;\ntype Descendants = HTMLElement[] | null;\n\nconst useActiveDescendant = (\n {\n focusEl,\n scope,\n scopeSelector,\n selector,\n focusDescendantEl,\n clearFocusDescendant,\n focusReturnEl,\n clearFocusReturn,\n currentDescendantId,\n onClick,\n preventInitialScroll,\n pauseDescendantEvaluation = false,\n clearPreventScroll\n }: UseActiveDescendantConfig,\n dependencyArray: DependencyList = []\n): {\n activeDescendant: CurrentDescendant;\n descendants: Descendants;\n} => {\n const [resetId, setResetId] = useState(0);\n const previousActiveId = useRef('');\n const [focusDescendantElIndex, setFocusDescendantElIndex] = useState<number | null>(null);\n const [currentIndex, setCurrentIndex] = useState<number | null>(null);\n const [descendants, setDescendants] = useState<Descendants>();\n\n const clearThenSetDescendants = useCallback(\n (setVal: NodeListOf<Element> | null) => {\n descendants?.forEach(node => {\n node.setAttribute('data-current', 'false');\n });\n\n setDescendants(\n setVal\n ? Array.from(setVal).filter((item): item is HTMLElement => item instanceof HTMLElement)\n : null\n );\n },\n [descendants]\n );\n\n // ## Toggle active scope data attr.\n useEffect(() => {\n if (!scope || !focusEl) return;\n\n scope.setAttribute('data-active-scope', document.activeElement === focusEl ? 'true' : 'false');\n\n const onFocus = () => {\n scope.setAttribute('data-active-scope', 'true');\n };\n const onBlur = () => {\n scope.setAttribute('data-active-scope', 'false');\n };\n\n focusEl.addEventListener('focus', onFocus);\n focusEl.addEventListener('blur', onBlur);\n\n return () => {\n focusEl.removeEventListener('focus', onFocus);\n focusEl.removeEventListener('blur', onBlur);\n };\n }, [scope, focusEl]);\n\n // ## Update descendants\n useEffect(() => {\n if (!pauseDescendantEvaluation) {\n // 0 second timeout added because descendantScope needs to be up to date before running query after dependencyArray change\n setTimeout(() => {\n let hasScope = scope;\n\n if (hasScope && hasScope instanceof HTMLElement) {\n if (scopeSelector) {\n hasScope = hasScope.querySelector(scopeSelector);\n }\n\n if (!hasScope) {\n clearThenSetDescendants(null);\n return;\n }\n\n if (selector) {\n clearThenSetDescendants(hasScope.querySelectorAll(selector));\n } else {\n clearThenSetDescendants(\n hasScope.querySelectorAll(\n 'a, button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"])'\n )\n );\n }\n } else {\n clearThenSetDescendants(null);\n }\n }, 0);\n }\n }, [pauseDescendantEvaluation, scope, scopeSelector, selector, focusEl, ...dependencyArray]);\n\n // ## Set IDs and aria-owns\n useEffect(() => {\n const ownedIds: string[] = [];\n setCurrentIndex(0);\n\n if (descendants && descendants.length) {\n descendants.forEach(node => {\n node.id = node.id || createUID();\n ownedIds.push(node.id);\n });\n }\n\n focusEl?.setAttribute('aria-owns', ownedIds.join(' '));\n\n return () => {\n focusEl?.removeAttribute('aria-owns');\n };\n }, [focusEl, descendants]);\n\n // ## Bind focus el keyDown\n useEffect(() => {\n const onKeyDown = (e: KeyboardEvent) => {\n if (descendants && descendants.length) {\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n // Focus next or first\n clearFocusReturn?.();\n clearPreventScroll?.();\n if (currentIndex !== null && currentIndex + 1 < descendants.length) {\n setCurrentIndex(currentIndex + 1);\n } else {\n setCurrentIndex(0);\n }\n break;\n case 'ArrowUp':\n e.preventDefault();\n // Focus previous or last\n clearFocusReturn?.();\n clearPreventScroll?.();\n if (currentIndex !== null && currentIndex - 1 > -1) {\n setCurrentIndex(currentIndex - 1);\n } else {\n setCurrentIndex(descendants.length - 1);\n }\n break;\n case 'Enter':\n e.preventDefault();\n // Click focused item\n if (descendants && descendants.length && currentIndex !== null) {\n if (onClick) {\n onClick(descendants[currentIndex]);\n break;\n }\n\n const nodeName = descendants[currentIndex].nodeName.toLowerCase();\n if (nodeName === 'input' || nodeName === 'button' || nodeName === 'a') {\n descendants[currentIndex].click();\n } else {\n descendants[currentIndex].querySelector<HTMLElement>('button, a, input')?.click();\n }\n }\n break;\n default:\n break;\n }\n }\n };\n\n // Do not rebind once / if `currentDescendantId` control is defined\n if (focusEl && descendants?.length && !currentDescendantId) {\n focusEl.addEventListener('keydown', onKeyDown);\n }\n\n return () => {\n focusEl?.removeEventListener('keydown', onKeyDown);\n };\n }, [focusEl, currentIndex, descendants]);\n\n // ## Handle independent control update\n useEffect(() => {\n if (descendants && currentDescendantId) {\n descendants.forEach((node, index) => {\n if (node.id === currentDescendantId) {\n setCurrentIndex(index);\n }\n });\n }\n }, [currentDescendantId, descendants]);\n\n // ## Set and scroll to current descendant\n useEffect(() => {\n const nextIndex = focusDescendantElIndex || currentIndex;\n const focusReturnId = focusReturnEl?.id;\n let focusReturnIndex;\n const focusDescendantElId = focusDescendantEl?.id;\n let focusDescendantIndex;\n let foundFocusDescendantEl = false;\n\n if (descendants && descendants.length) {\n // clear previous & catch focusReturn / focusDescendantEl index\n descendants.forEach((node, index) => {\n if (focusDescendantElIndex === null && node.id === focusDescendantElId) {\n focusDescendantIndex = index;\n foundFocusDescendantEl = true;\n setFocusDescendantElIndex(index);\n }\n if (node.id === focusReturnId) {\n focusReturnIndex = index;\n }\n node.setAttribute('data-current', 'false');\n });\n\n // early return for focusReturn / focusDescendantEl\n if (focusReturnIndex && focusReturnIndex !== currentIndex) {\n setCurrentIndex(focusReturnIndex);\n clearFocusReturn?.();\n return;\n }\n if (foundFocusDescendantEl && focusDescendantIndex !== undefined) {\n // hard reset to continue focusDescendantEl process even if it is the active descendant\n setResetId(Math.random());\n setCurrentIndex(focusDescendantIndex);\n return;\n }\n\n // set new\n if (nextIndex !== null && descendants[nextIndex]) {\n const itemEl = descendants[nextIndex!];\n itemEl.setAttribute('data-current', 'true');\n focusEl?.setAttribute('aria-activedescendant', itemEl.id);\n\n // scroll to element\n if (itemEl.id !== previousActiveId.current && !preventInitialScroll) {\n const scrollTo: (this: Element, arg: boolean) => void =\n Element.prototype.scrollIntoViewIfNeeded ?? Element.prototype.scrollIntoView;\n\n scrollTo?.call(itemEl, false);\n }\n\n // focusDescendantEl cleanup\n if (focusDescendantElIndex !== null) {\n setFocusDescendantElIndex(null);\n clearFocusDescendant?.();\n }\n\n previousActiveId.current = itemEl.id;\n }\n }\n\n return () => {\n focusEl?.removeAttribute('aria-activedescendant');\n };\n }, [descendants, currentIndex, focusDescendantEl, focusEl, resetId]);\n\n return {\n activeDescendant: currentIndex !== null && descendants ? descendants[currentIndex] : undefined,\n descendants: descendants || null\n };\n};\n\nexport const useLazyDescendant = ({\n loading,\n descendants,\n previousActiveDescendant,\n activeDescendant,\n focusReturnEl,\n setFocusReturnEl,\n scrollEl\n}: {\n loading: boolean;\n descendants: Descendants;\n previousActiveDescendant: CurrentDescendant;\n activeDescendant: CurrentDescendant;\n focusReturnEl: UseActiveDescendantConfig['focusReturnEl'];\n setFocusReturnEl: (el: HTMLElement | null | undefined) => void;\n scrollEl?: HTMLElement | null;\n}) => {\n // Bump scroll & set return element when descendant focused in loading state.\n useEffect(() => {\n if (loading && descendants && descendants.length && activeDescendant) {\n const descendantList = [...descendants];\n const lastItem = descendantList.pop();\n const lastId = lastItem?.id || undefined;\n\n if (lastId === activeDescendant.id) {\n if (scrollEl) {\n scrollEl.scrollTop = scrollEl.scrollHeight - scrollEl.offsetHeight;\n }\n\n if (focusReturnEl?.id !== activeDescendant.id) {\n // Set focus return to AD on 'nextTick', to avoid reset of AD on update\n setTimeout(() => {\n setFocusReturnEl(lastItem);\n }, 0);\n }\n }\n // If not last item\n else if (focusReturnEl?.id !== activeDescendant.id) {\n // Set focus return to AD on 'nextTick' to avoid reset of AD on update\n // Do not D.R.Y to avoid conflicting calls with immediately prior elements.\n setTimeout(() => {\n setFocusReturnEl(activeDescendant);\n }, 0);\n }\n }\n }, [loading, descendants, previousActiveDescendant, activeDescendant, scrollEl, focusReturnEl]);\n};\n\nexport default useActiveDescendant;\n"]}
|
package/lib/hooks/useArrows.d.ts
CHANGED
|
@@ -3,10 +3,11 @@ import { RefObject, DependencyList } from 'react';
|
|
|
3
3
|
* @example useArrows(ref, { cycle, selector });
|
|
4
4
|
* @param ref - A reference to the element that will be navigated through. [React RefObject](https://reactjs.org/docs/refs-and-the-dom.html)
|
|
5
5
|
*/
|
|
6
|
-
declare const useArrows: (ref: RefObject<HTMLElement>, { cycle, selector, dir }?: {
|
|
6
|
+
declare const useArrows: (ref: RefObject<HTMLElement>, { cycle, selector, dir, allowTabFocus }?: {
|
|
7
7
|
cycle?: boolean | undefined;
|
|
8
8
|
selector?: string | undefined;
|
|
9
9
|
dir?: "up-down" | "left-right" | undefined;
|
|
10
|
+
allowTabFocus?: boolean | undefined;
|
|
10
11
|
}, dependencies?: DependencyList) => void;
|
|
11
12
|
export default useArrows;
|
|
12
13
|
//# sourceMappingURL=useArrows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useArrows.d.ts","sourceRoot":"","sources":["../../src/hooks/useArrows.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAW1E;;;GAGG;AACH,QAAA,MAAM,SAAS,QACR,UAAU,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"useArrows.d.ts","sourceRoot":"","sources":["../../src/hooks/useArrows.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAW1E;;;GAGG;AACH,QAAA,MAAM,SAAS,QACR,UAAU,WAAW,CAAC;;;;;yCA2G5B,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/lib/hooks/useArrows.js
CHANGED
|
@@ -16,7 +16,7 @@ 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' } = {},
|
|
19
|
+
dir = 'up-down', allowTabFocus = true } = {},
|
|
20
20
|
/** Pass this prop in the internal dependencies when list is dynamic */
|
|
21
21
|
dependencies = []) => {
|
|
22
22
|
const [NextKey, PrevKey] = dir === 'up-down' ? ['ArrowDown', 'ArrowUp'] : ['ArrowRight', 'ArrowLeft'];
|
|
@@ -26,7 +26,8 @@ dependencies = []) => {
|
|
|
26
26
|
setTimeout(() => {
|
|
27
27
|
const focusableElements = Array.from(el.querySelectorAll(selector));
|
|
28
28
|
if (focusableElements.length > 0) {
|
|
29
|
-
|
|
29
|
+
if (allowTabFocus)
|
|
30
|
+
focusableElements[0].tabIndex = 0;
|
|
30
31
|
focusableElements.slice(1).forEach(item => {
|
|
31
32
|
if (item instanceof HTMLElement) {
|
|
32
33
|
const checked = item.checked;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useArrows.js","sourceRoot":"","sources":["../../src/hooks/useArrows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAA6B,MAAM,OAAO,CAAC;AAE1E,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,
|
|
1
|
+
{"version":3,"file":"useArrows.js","sourceRoot":"","sources":["../../src/hooks/useArr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AY,CAAC,CAAC,CAAC;AACzD,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { useEffect, useCallback, 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 }: {\n cycle?: boolean;\n selector?: string;\n dir?: 'up-down' | 'left-right';\n allowTabFocus?: 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 if (['Home', 'End', NextKey, PrevKey].includes(e.key)) e.preventDefault();\n\n if (!documentIsAvailable) return;\n\n const el = ref.current;\n if (!el) 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 setTabIndexes(el);\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\n setTabIndexes(el);\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"]}
|
package/lib/hooks/useI18n.d.ts
CHANGED
|
@@ -237,6 +237,8 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
237
237
|
rte_height_in_pixels: string;
|
|
238
238
|
rte_image_settings: string;
|
|
239
239
|
rte_image_key_command: string;
|
|
240
|
+
expand_forwarded_message: string;
|
|
241
|
+
collapse_forwarded_message: string;
|
|
240
242
|
feed_new_post: string;
|
|
241
243
|
feed_cancel_conversation: string;
|
|
242
244
|
feed_context: string;
|
|
@@ -275,6 +277,23 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
275
277
|
feed_post_removed: string;
|
|
276
278
|
feed_reply_removed: string;
|
|
277
279
|
showing_num_of_num: string;
|
|
280
|
+
feed_new_post_added: {
|
|
281
|
+
zero: string;
|
|
282
|
+
one: string;
|
|
283
|
+
two: string;
|
|
284
|
+
few: string;
|
|
285
|
+
many: string;
|
|
286
|
+
other: string;
|
|
287
|
+
};
|
|
288
|
+
new_item_added: {
|
|
289
|
+
zero: string;
|
|
290
|
+
one: string;
|
|
291
|
+
two: string;
|
|
292
|
+
few: string;
|
|
293
|
+
many: string;
|
|
294
|
+
other: string;
|
|
295
|
+
};
|
|
296
|
+
loading_post: string;
|
|
278
297
|
scroll_to_latest_message: string;
|
|
279
298
|
scroll_to_unread_messages: string;
|
|
280
299
|
suggested_replies_current_of_total: string;
|
|
@@ -318,6 +337,7 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
318
337
|
email_add_attachment: string;
|
|
319
338
|
email_disable_attachment: string;
|
|
320
339
|
email_remove_attachment: string;
|
|
340
|
+
loading_email: string;
|
|
321
341
|
article_list_label_a11y: string;
|
|
322
342
|
article_list_filter_label_a11y: string;
|
|
323
343
|
article_list_header_submit_label: string;
|
|
@@ -641,6 +661,10 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
641
661
|
add_alternate_stage: string;
|
|
642
662
|
add_node: string;
|
|
643
663
|
search_nodes: string;
|
|
664
|
+
delete_decision_step: string;
|
|
665
|
+
delete_decision_step_title: string;
|
|
666
|
+
delete_decision_step_outcome: string;
|
|
667
|
+
delete_all_outcomes: string;
|
|
644
668
|
zoom_level: string;
|
|
645
669
|
close_configuration_panel: string;
|
|
646
670
|
clear_object_summary: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,QAAA,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useItemIntersection.d.ts","sourceRoot":"","sources":["../../src/hooks/useItemIntersection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAE7C;;;;;;;GAOG;AAEH,QAAA,MAAM,mBAAmB,iBACT,UAAU,WAAW,CAAC,UAC5B,MAAM,MACV,MAAM,IAAI,gBACA,MAAM,
|
|
1
|
+
{"version":3,"file":"useItemIntersection.d.ts","sourceRoot":"","sources":["../../src/hooks/useItemIntersection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAE7C;;;;;;;GAOG;AAEH,QAAA,MAAM,mBAAmB,iBACT,UAAU,WAAW,CAAC,UAC5B,MAAM,MACV,MAAM,IAAI,gBACA,MAAM,SA8BrB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -9,28 +9,26 @@ import { useEffect } from 'react';
|
|
|
9
9
|
*/
|
|
10
10
|
const useItemIntersection = (containerRef, offset, cb, itemSelector) => {
|
|
11
11
|
useEffect(() => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
item = items[offset];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
if (item) {
|
|
21
|
-
const intersectionObserver = new IntersectionObserver((entries) => {
|
|
22
|
-
if (entries[0].isIntersecting) {
|
|
23
|
-
cb();
|
|
24
|
-
}
|
|
25
|
-
}, {
|
|
26
|
-
root: containerRef.current
|
|
27
|
-
});
|
|
28
|
-
intersectionObserver.observe(item);
|
|
29
|
-
return () => {
|
|
30
|
-
intersectionObserver.disconnect();
|
|
31
|
-
};
|
|
12
|
+
let item = null;
|
|
13
|
+
if (offset > 0) {
|
|
14
|
+
const items = (containerRef.current === null ? document.body : containerRef.current).querySelectorAll(itemSelector);
|
|
15
|
+
if (items.length > offset) {
|
|
16
|
+
item = items[offset];
|
|
32
17
|
}
|
|
33
18
|
}
|
|
19
|
+
if (item) {
|
|
20
|
+
const intersectionObserver = new IntersectionObserver((entries) => {
|
|
21
|
+
if (entries[0].isIntersecting) {
|
|
22
|
+
cb();
|
|
23
|
+
}
|
|
24
|
+
}, {
|
|
25
|
+
root: containerRef.current
|
|
26
|
+
});
|
|
27
|
+
intersectionObserver.observe(item);
|
|
28
|
+
return () => {
|
|
29
|
+
intersectionObserver.disconnect();
|
|
30
|
+
};
|
|
31
|
+
}
|
|
34
32
|
}, [cb, containerRef.current, offset]);
|
|
35
33
|
};
|
|
36
34
|
export default useItemIntersection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useItemIntersection.js","sourceRoot":"","sources":["../../src/hooks/useItemIntersection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7C;;;;;;;GAOG;AAEH,MAAM,mBAAmB,GAAG,CAC1B,YAAoC,EACpC,MAAc,EACd,EAAc,EACd,YAAoB,EACpB,EAAE;IACF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,
|
|
1
|
+
{"version":3,"file":"useItemIntersection.js","sourceRoot":"","sources":["../../src/hooks/useItemIntersection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7C;;;;;;;GAOG;AAEH,MAAM,mBAAmB,GAAG,CAC1B,YAAoC,EACpC,MAAc,EACd,EAAc,EACd,YAAoB,EACpB,EAAE;IACF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,GAAuB,IAAI,CAAC;QACpC,IAAI,MAAM,GAAG,CAAC,EAAE;YACd,MAAM,KAAK,GAA4B,CACrC,YAAY,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CACrE,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;YAEjC,IAAI,KAAK,CAAC,MAAM,GAAG,MAAM,EAAE;gBACzB,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;aACtB;SACF;QACD,IAAI,IAAI,EAAE;YACR,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,CACnD,CAAC,OAAoC,EAAE,EAAE;gBACvC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE;oBAC7B,EAAE,EAAE,CAAC;iBACN;YACH,CAAC,EACD;gBACE,IAAI,EAAE,YAAY,CAAC,OAAO;aAC3B,CACF,CAAC;YACF,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnC,OAAO,GAAG,EAAE;gBACV,oBAAoB,CAAC,UAAU,EAAE,CAAC;YACpC,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,EAAE,EAAE,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { RefObject, useEffect } from 'react';\n\n/**\n * @example useItemIntersection(listRef,offset,() => { do_some_thing; });\n * @param containerRef The ref of the List.\n * @param offset Index of the list item which needs to be observed.\n * @param cb Callback that needs to be fired on intersect\n * @param itemSelector Selector used to get the node list of items\n * @returns void.\n */\n\nconst useItemIntersection = (\n containerRef: RefObject<HTMLElement>,\n offset: number,\n cb: () => void,\n itemSelector: string\n) => {\n useEffect(() => {\n let item: HTMLElement | null = null;\n if (offset > 0) {\n const items: NodeListOf<HTMLElement> = (\n containerRef.current === null ? document.body : containerRef.current\n ).querySelectorAll(itemSelector);\n\n if (items.length > offset) {\n item = items[offset];\n }\n }\n if (item) {\n const intersectionObserver = new IntersectionObserver(\n (entries: IntersectionObserverEntry[]) => {\n if (entries[0].isIntersecting) {\n cb();\n }\n },\n {\n root: containerRef.current\n }\n );\n intersectionObserver.observe(item);\n return () => {\n intersectionObserver.disconnect();\n };\n }\n }, [cb, containerRef.current, offset]);\n};\n\nexport default useItemIntersection;\n"]}
|
package/lib/i18n/default.d.ts
CHANGED
|
@@ -233,6 +233,8 @@ declare const _default: {
|
|
|
233
233
|
rte_height_in_pixels: string;
|
|
234
234
|
rte_image_settings: string;
|
|
235
235
|
rte_image_key_command: string;
|
|
236
|
+
expand_forwarded_message: string;
|
|
237
|
+
collapse_forwarded_message: string;
|
|
236
238
|
feed_new_post: string;
|
|
237
239
|
feed_cancel_conversation: string;
|
|
238
240
|
feed_context: string;
|
|
@@ -271,6 +273,23 @@ declare const _default: {
|
|
|
271
273
|
feed_post_removed: string;
|
|
272
274
|
feed_reply_removed: string;
|
|
273
275
|
showing_num_of_num: string;
|
|
276
|
+
feed_new_post_added: {
|
|
277
|
+
zero: string;
|
|
278
|
+
one: string;
|
|
279
|
+
two: string;
|
|
280
|
+
few: string;
|
|
281
|
+
many: string;
|
|
282
|
+
other: string;
|
|
283
|
+
};
|
|
284
|
+
new_item_added: {
|
|
285
|
+
zero: string;
|
|
286
|
+
one: string;
|
|
287
|
+
two: string;
|
|
288
|
+
few: string;
|
|
289
|
+
many: string;
|
|
290
|
+
other: string;
|
|
291
|
+
};
|
|
292
|
+
loading_post: string;
|
|
274
293
|
scroll_to_latest_message: string;
|
|
275
294
|
scroll_to_unread_messages: string;
|
|
276
295
|
suggested_replies_current_of_total: string;
|
|
@@ -314,6 +333,7 @@ declare const _default: {
|
|
|
314
333
|
email_add_attachment: string;
|
|
315
334
|
email_disable_attachment: string;
|
|
316
335
|
email_remove_attachment: string;
|
|
336
|
+
loading_email: string;
|
|
317
337
|
article_list_label_a11y: string;
|
|
318
338
|
article_list_filter_label_a11y: string;
|
|
319
339
|
article_list_header_submit_label: string;
|
|
@@ -637,6 +657,10 @@ declare const _default: {
|
|
|
637
657
|
add_alternate_stage: string;
|
|
638
658
|
add_node: string;
|
|
639
659
|
search_nodes: string;
|
|
660
|
+
delete_decision_step: string;
|
|
661
|
+
delete_decision_step_title: string;
|
|
662
|
+
delete_decision_step_outcome: string;
|
|
663
|
+
delete_all_outcomes: string;
|
|
640
664
|
zoom_level: string;
|
|
641
665
|
close_configuration_panel: string;
|
|
642
666
|
clear_object_summary: 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,wBAiwBE"}
|
package/lib/i18n/default.js
CHANGED
|
@@ -268,6 +268,9 @@ export default {
|
|
|
268
268
|
rte_height_in_pixels: 'Height (in pixels)',
|
|
269
269
|
rte_image_settings: 'Image settings',
|
|
270
270
|
rte_image_key_command: 'Press enter to edit the image',
|
|
271
|
+
/* social:Email */
|
|
272
|
+
expand_forwarded_message: 'Expand forwarded message',
|
|
273
|
+
collapse_forwarded_message: 'Collapse forwarded message',
|
|
271
274
|
/* social:Feed */
|
|
272
275
|
feed_new_post: 'New post',
|
|
273
276
|
feed_cancel_conversation: 'Cancel conversation',
|
|
@@ -307,6 +310,23 @@ export default {
|
|
|
307
310
|
feed_post_removed: 'Post has been removed',
|
|
308
311
|
feed_reply_removed: 'Reply has been removed',
|
|
309
312
|
showing_num_of_num: 'Showing {0} of {1}',
|
|
313
|
+
feed_new_post_added: {
|
|
314
|
+
zero: 'No posts added',
|
|
315
|
+
one: '{0} post added',
|
|
316
|
+
two: '{0} posts added',
|
|
317
|
+
few: '{0} posts added',
|
|
318
|
+
many: '{0} posts added',
|
|
319
|
+
other: '{0} posts added'
|
|
320
|
+
},
|
|
321
|
+
new_item_added: {
|
|
322
|
+
zero: 'No items added',
|
|
323
|
+
one: '{0} new item added',
|
|
324
|
+
two: '{0} new items added',
|
|
325
|
+
few: '{0} new items added',
|
|
326
|
+
many: '{0} new items added',
|
|
327
|
+
other: '{0} new items added'
|
|
328
|
+
},
|
|
329
|
+
loading_post: 'Loading post',
|
|
310
330
|
/* cs:Chat */
|
|
311
331
|
scroll_to_latest_message: 'Scroll to latest message',
|
|
312
332
|
scroll_to_unread_messages: 'Scroll to unread messages',
|
|
@@ -352,6 +372,7 @@ export default {
|
|
|
352
372
|
email_add_attachment: 'Add attachment, the maximum number of attachments allowed is {0}.',
|
|
353
373
|
email_disable_attachment: 'Adding attachments are disabled, the maximum number of attachments allowed is {0}.',
|
|
354
374
|
email_remove_attachment: 'Remove attachment',
|
|
375
|
+
loading_email: 'Loading email',
|
|
355
376
|
/* cs:ArticleList */
|
|
356
377
|
article_list_label_a11y: 'Article list',
|
|
357
378
|
article_list_filter_label_a11y: 'Article lists filter',
|
|
@@ -686,6 +707,10 @@ export default {
|
|
|
686
707
|
/* build:FlowModeller */
|
|
687
708
|
add_node: 'Add node',
|
|
688
709
|
search_nodes: 'Search nodes',
|
|
710
|
+
delete_decision_step: 'Select outcome that you want to retain. The remaining highlighted outcome and steps will be deleted',
|
|
711
|
+
delete_decision_step_title: 'Delete step',
|
|
712
|
+
delete_decision_step_outcome: 'Outcome to keep',
|
|
713
|
+
delete_all_outcomes: 'None (delete all outcomes)',
|
|
689
714
|
/* build:Workbench */
|
|
690
715
|
zoom_level: 'Zoom level',
|
|
691
716
|
close_configuration_panel: 'Close configuration panel',
|