@pega/cosmos-react-core 4.0.0-dev.6.1 → 4.0.0-dev.8.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/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
- package/lib/components/Backdrop/Backdrop.js +22 -2
- package/lib/components/Backdrop/Backdrop.js.map +1 -1
- package/lib/components/Banner/Banner.d.ts +9 -1
- package/lib/components/Banner/Banner.d.ts.map +1 -1
- package/lib/components/Banner/Banner.js +21 -10
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Banner/index.d.ts +1 -1
- package/lib/components/Banner/index.d.ts.map +1 -1
- package/lib/components/Banner/index.js.map +1 -1
- package/lib/components/Card/Card.d.ts +4 -7
- package/lib/components/Card/Card.d.ts.map +1 -1
- package/lib/components/Card/Card.js +2 -9
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Configuration/Configuration.d.ts +4 -1
- package/lib/components/Configuration/Configuration.d.ts.map +1 -1
- package/lib/components/Configuration/Configuration.js +2 -0
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/DateTime/DateTime.types.d.ts +4 -1
- 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/Input/DateInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +12 -1
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.d.ts +4 -2
- package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateRangeInput.js +71 -34
- package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +19 -2
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/PartInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/PartInput.js +2 -2
- package/lib/components/DateTime/Input/PartInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +13 -2
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeRangeInput.d.ts +4 -2
- package/lib/components/DateTime/Input/TimeRangeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeRangeInput.js +70 -27
- package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -1
- package/lib/components/Dialog/FormDialog.d.ts.map +1 -1
- package/lib/components/Dialog/FormDialog.js +2 -6
- package/lib/components/Dialog/FormDialog.js.map +1 -1
- package/lib/components/Dialog/InfoDialog.d.ts.map +1 -1
- package/lib/components/Dialog/InfoDialog.js +2 -6
- package/lib/components/Dialog/InfoDialog.js.map +1 -1
- package/lib/components/FormControl/FormControl.d.ts +4 -0
- package/lib/components/FormControl/FormControl.d.ts.map +1 -1
- package/lib/components/FormControl/FormControl.js.map +1 -1
- package/lib/components/FormControl/index.d.ts +1 -0
- package/lib/components/FormControl/index.d.ts.map +1 -1
- package/lib/components/FormControl/index.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.js +84 -66
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts +2 -0
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.js +37 -5
- package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.d.ts +4 -4
- package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
- package/lib/components/LiveLog/Context.d.ts +3 -0
- package/lib/components/LiveLog/Context.d.ts.map +1 -0
- package/lib/components/LiveLog/Context.js +9 -0
- package/lib/components/LiveLog/Context.js.map +1 -0
- package/lib/components/LiveLog/LiveLog.d.ts +10 -0
- package/lib/components/LiveLog/LiveLog.d.ts.map +1 -0
- package/lib/components/LiveLog/LiveLog.js +99 -0
- package/lib/components/LiveLog/LiveLog.js.map +1 -0
- package/lib/components/LiveLog/LiveLog.styles.d.ts +3 -0
- package/lib/components/LiveLog/LiveLog.styles.d.ts.map +1 -0
- package/lib/components/LiveLog/LiveLog.styles.js +9 -0
- package/lib/components/LiveLog/LiveLog.styles.js.map +1 -0
- package/lib/components/LiveLog/LiveLog.types.d.ts +93 -0
- package/lib/components/LiveLog/LiveLog.types.d.ts.map +1 -0
- package/lib/components/LiveLog/LiveLog.types.js +2 -0
- package/lib/components/LiveLog/LiveLog.types.js.map +1 -0
- package/lib/components/LiveLog/index.d.ts +4 -0
- package/lib/components/LiveLog/index.d.ts.map +1 -0
- package/lib/components/LiveLog/index.js +3 -0
- package/lib/components/LiveLog/index.js.map +1 -0
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.js +2 -0
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/MenuList.d.ts.map +1 -1
- package/lib/components/Menu/MenuList.js +4 -3
- package/lib/components/Menu/MenuList.js.map +1 -1
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/Modal/Modal.js +6 -8
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/Modal/Modal.types.d.ts +1 -0
- package/lib/components/Modal/Modal.types.d.ts.map +1 -1
- package/lib/components/Modal/Modal.types.js.map +1 -1
- package/lib/components/Number/NumberInput.types.d.ts +3 -1
- package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.types.js.map +1 -1
- package/lib/components/Number/NumberRangeInput.d.ts.map +1 -1
- package/lib/components/Number/NumberRangeInput.js +71 -4
- package/lib/components/Number/NumberRangeInput.js.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.js +14 -3
- package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.styles.js +5 -0
- package/lib/components/PageTemplates/CategorySubPage.styles.js.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.js +16 -2
- package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +20 -3
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +2 -5
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.styles.d.ts +0 -1
- package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
- package/lib/components/Popover/Popover.styles.js +0 -6
- package/lib/components/Popover/Popover.styles.js.map +1 -1
- package/lib/components/Popover/modifiers.d.ts +0 -2
- package/lib/components/Popover/modifiers.d.ts.map +1 -1
- package/lib/components/Popover/modifiers.js +1 -32
- package/lib/components/Popover/modifiers.js.map +1 -1
- package/lib/components/Progress/Progress.d.ts.map +1 -1
- package/lib/components/Progress/Progress.js +92 -50
- package/lib/components/Progress/Progress.js.map +1 -1
- package/lib/components/Progress/Progress.styles.d.ts.map +1 -1
- package/lib/components/Progress/Progress.styles.js +0 -1
- package/lib/components/Progress/Progress.styles.js.map +1 -1
- package/lib/components/Progress/Progress.types.d.ts +18 -6
- package/lib/components/Progress/Progress.types.d.ts.map +1 -1
- package/lib/components/Progress/Progress.types.js.map +1 -1
- package/lib/components/Progress/index.d.ts +1 -1
- package/lib/components/Progress/index.d.ts.map +1 -1
- package/lib/components/Progress/index.js.map +1 -1
- package/lib/components/QRCode/QRCode.d.ts +14 -0
- package/lib/components/QRCode/QRCode.d.ts.map +1 -0
- package/lib/components/QRCode/QRCode.js +39 -0
- package/lib/components/QRCode/QRCode.js.map +1 -0
- package/lib/components/QRCode/index.d.ts +3 -0
- package/lib/components/QRCode/index.d.ts.map +1 -0
- package/lib/components/QRCode/index.js +2 -0
- package/lib/components/QRCode/index.js.map +1 -0
- package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/lib/components/SearchInput/SearchInput.js +27 -7
- package/lib/components/SearchInput/SearchInput.js.map +1 -1
- package/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.js +6 -0
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/Toaster/Context.d.ts +1 -0
- package/lib/components/Toaster/Context.d.ts.map +1 -1
- package/lib/components/Toaster/Context.js.map +1 -1
- package/lib/components/Toaster/Toaster.d.ts.map +1 -1
- package/lib/components/Toaster/Toaster.js +5 -1
- package/lib/components/Toaster/Toaster.js.map +1 -1
- package/lib/components/Tree/StandardTree.d.ts.map +1 -1
- package/lib/components/Tree/StandardTree.js +70 -27
- package/lib/components/Tree/StandardTree.js.map +1 -1
- package/lib/components/Tree/StandardTree.styles.d.ts +1 -0
- package/lib/components/Tree/StandardTree.styles.d.ts.map +1 -1
- package/lib/components/Tree/StandardTree.styles.js +32 -18
- package/lib/components/Tree/StandardTree.styles.js.map +1 -1
- package/lib/components/Tree/StandardTree.types.d.ts +27 -0
- package/lib/components/Tree/StandardTree.types.d.ts.map +1 -1
- package/lib/components/Tree/StandardTree.types.js.map +1 -1
- package/lib/components/Tree/helpers.d.ts +11 -9
- package/lib/components/Tree/helpers.d.ts.map +1 -1
- package/lib/components/Tree/helpers.js +25 -5
- package/lib/components/Tree/helpers.js.map +1 -1
- package/lib/components/Tree/index.d.ts +1 -1
- package/lib/components/Tree/index.d.ts.map +1 -1
- package/lib/components/Tree/index.js.map +1 -1
- package/lib/components/URL/URLDisplay.d.ts +2 -2
- package/lib/components/URL/URLDisplay.d.ts.map +1 -1
- package/lib/components/URL/URLDisplay.js +8 -1
- package/lib/components/URL/URLDisplay.js.map +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useArrows.d.ts.map +1 -1
- package/lib/hooks/useArrows.js +3 -3
- package/lib/hooks/useArrows.js.map +1 -1
- package/lib/hooks/useBreakpoint.d.ts.map +1 -1
- package/lib/hooks/useBreakpoint.js +3 -2
- package/lib/hooks/useBreakpoint.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +43 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useLiveLog.d.ts +8 -0
- package/lib/hooks/useLiveLog.d.ts.map +1 -0
- package/lib/hooks/useLiveLog.js +16 -0
- package/lib/hooks/useLiveLog.js.map +1 -0
- package/lib/i18n/default.d.ts +43 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +50 -6
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +43 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/register-contexts.js +2 -0
- package/lib/register-contexts.js.map +1 -1
- package/lib/theme/theme.d.ts +12 -0
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +8 -0
- package/lib/theme/themes/darkTheme.json +3 -1
- package/lib/types/types.d.ts +3 -0
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/package.json +3 -1
- package/lib/components/ListToolbar/QueryOptionPopover.d.ts +0 -12
- package/lib/components/ListToolbar/QueryOptionPopover.d.ts.map +0 -1
- package/lib/components/ListToolbar/QueryOptionPopover.js +0 -36
- package/lib/components/ListToolbar/QueryOptionPopover.js.map +0 -1
|
@@ -1 +1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AAE;YACrD,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;YAChC,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACrE,IAAI,YAAY,KAAK,CAAC,EAAE;gBACtB,YAAY,GAAG,MAAM,CAAC;aACvB;iBAAM;gBACL,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC5E;SACF;aAAM;YACL,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACrD,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;gBAAE,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACtF;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import type { TreeNode } from './Tree';\n\nconst helpers = {\n getNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let found;\n nodes.some(node => {\n if (node.id === id) {\n found = node;\n return true;\n }\n\n if (node.nodes) {\n found = this.getNode(node.nodes, id);\n return !!found;\n }\n\n return false;\n });\n\n return found;\n },\n\n getParentNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let found: T | undefined;\n nodes.some(node => {\n const childNodes = node.nodes || [];\n childNodes.some(childNode => {\n if (childNode.id === id) {\n found = node;\n return true;\n }\n\n if (childNode.nodes) {\n found = this.getParentNode(childNodes, id) as T;\n return !!found;\n }\n\n return false;\n });\n\n return !!found;\n });\n\n return found;\n },\n\n mapTree<T1 extends TreeNode = TreeNode, T2 extends TreeNode = T1>(\n nodes: T1[],\n fn: (node: T1, index: number, nodes: T1[]) => T2\n ): T2[] {\n return nodes.map((node, index, array) => {\n let newNode = node;\n\n if (node.nodes) {\n newNode = {\n ...newNode,\n nodes: this.mapTree(node.nodes as T1[], fn)\n };\n }\n\n return fn(newNode, index, array);\n });\n },\n\n mapNode<T1 extends TreeNode = TreeNode, T2 extends TreeNode = T1>(\n nodes: T1[],\n id: T1['id'],\n fn: (node: T1, index: number, array: T1[]) => T2\n ): (T1 | T2)[] {\n return nodes.map((node, index, array) => {\n let newNode: T1 | T2 = node;\n\n if (node.nodes) {\n newNode = {\n ...newNode,\n nodes: this.mapNode(node.nodes as T1[], id, fn)\n };\n }\n\n if (node.id === id) {\n newNode = fn(newNode, index, array);\n }\n\n return newNode;\n });\n },\n\n flatten<T extends TreeNode = TreeNode>(nodes: T[], ancestors?: T[]): (T & { ancestors?: T[] })[] {\n return nodes.reduce<(T & { ancestors?: T[] })[]>((flatNodes, node) => {\n if (node.nodes) {\n return [\n ...flatNodes,\n node,\n ...this.flatten(node.nodes as T[], ancestors ? [...ancestors, node] : [node])\n ];\n }\n\n return [...flatNodes, ancestors ? { ...node, ancestors } : node];\n }, []);\n },\n\n appendTo<T extends TreeNode = TreeNode>(nodes: T[], id: T['id'], newNodes: T[]): T[] {\n if (id) {\n return this.mapNode(nodes, id, node => ({\n ...node,\n nodes: [...(node.nodes ?? []), ...newNodes]\n }));\n }\n\n return [...nodes, ...newNodes];\n },\n\n expandTo<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T[] {\n return nodes.map(node => {\n // leaf node\n if (node.id === id) {\n return {\n ...node,\n expanded: true\n };\n }\n\n // parent node\n if (node.nodes && !!this.getNode(node.nodes, id)) {\n return {\n ...node,\n nodes: this.expandTo(node.nodes, id),\n expanded: true\n };\n }\n\n return { ...node, expanded: false };\n });\n },\n\n getFirstChildNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let firstChildNode;\n const node = this.getNode(nodes, id);\n if (node && node.expanded && node.nodes && node.nodes.length > 0) {\n const childNodes = node.nodes as T[];\n firstChildNode = childNodes[0];\n }\n return firstChildNode;\n },\n\n getAdjacentNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let nextNode;\n const parent = this.getParentNode(nodes, id);\n if (parent && parent.nodes && parent.nodes.length > 0) {\n const childNodes = parent.nodes as T[];\n const currentIndex = childNodes.map(nodeEl => nodeEl.id).indexOf(id);\n if (currentIndex === childNodes.length - 1) {\n nextNode = this.getAdjacentNode(nodes, parent.id);\n } else {\n nextNode = childNodes[currentIndex + 1];\n }\n } else {\n const index = nodes.map(nodeEl => nodeEl.id).indexOf(id);\n nextNode = nodes[index + 1];\n }\n return nextNode;\n },\n\n getNextNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let nextNode;\n const firstChildNode = this.getFirstChildNode(nodes, id);\n if (firstChildNode) {\n nextNode = firstChildNode;\n } else {\n nextNode = this.getAdjacentNode(nodes, id);\n }\n return nextNode;\n },\n\n getDeepestNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n const node = this.getNode(nodes, id);\n let lastNode = node;\n if (node && node.expanded && node.nodes && node.nodes.length > 0) {\n const childNodes = node.nodes as T[];\n const lastChildNode = childNodes[childNodes.length - 1];\n if (lastChildNode.expanded) {\n lastNode = this.getDeepestNode(nodes, lastChildNode.id);\n } else {\n lastNode = lastChildNode;\n }\n }\n return lastNode;\n },\n\n getPreviousNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n const parent = this.getParentNode(nodes, id);\n let previousNode;\n if (parent && parent.nodes && parent.nodes.length > 0) {\n const childNodes = parent.nodes;\n const currentIndex = childNodes.map(nodeEl => nodeEl.id).indexOf(id);\n if (currentIndex === 0) {\n previousNode = parent;\n } else {\n previousNode = this.getDeepestNode(nodes, childNodes[currentIndex - 1].id);\n }\n } else {\n const index = nodes.map(node => node.id).indexOf(id);\n if (nodes[index - 1]) previousNode = this.getDeepestNode(nodes, nodes[index - 1].id);\n }\n return previousNode;\n }\n};\n\nexport default helpers;\n"]}
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/components/Tree/helpers.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG;IACd,OAAO,CAAgC,KAAU,EAAE,EAAW;QAC5D,IAAI,KAAK,CAAC;QACV,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAChB,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE;gBAClB,KAAK,GAAG,IAAI,CAAC;gBACb,OAAO,IAAI,CAAC;aACb;YAED,IAAI,IAAI,CAAC,KAAK,EAAE;gBACd,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBACrC,OAAO,CAAC,CAAC,KAAK,CAAC;aAChB;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;IAED,aAAa,CAAgC,KAAU,EAAE,EAAW;QAClE,IAAI,KAAoB,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAChB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACpC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;gBAC1B,IAAI,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE;oBACvB,KAAK,GAAG,IAAI,CAAC;oBACb,OAAO,IAAI,CAAC;iBACb;gBAED,IAAI,SAAS,CAAC,KAAK,EAAE;oBACnB,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,CAAM,CAAC;oBAChD,OAAO,CAAC,CAAC,KAAK,CAAC;iBAChB;gBAED,OAAO,KAAK,CAAC;YACf,CAAC,CAAC,CAAC;YAEH,O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,GAAG,MAAM,CAAC;aACvB;iBAAM;gBACL,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aAC5E;SACF;aAAM;YACL,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACrD,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;gBAAE,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACtF;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import type { TreeNode } from './Tree';\n\nconst helpers = {\n getNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let found;\n nodes.some(node => {\n if (node.id === id) {\n found = node;\n return true;\n }\n\n if (node.nodes) {\n found = this.getNode(node.nodes, id);\n return !!found;\n }\n\n return false;\n });\n\n return found;\n },\n\n getParentNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let found: T | undefined;\n nodes.some(node => {\n const childNodes = node.nodes || [];\n childNodes.some(childNode => {\n if (childNode.id === id) {\n found = node;\n return true;\n }\n\n if (childNode.nodes) {\n found = this.getParentNode(childNodes, id) as T;\n return !!found;\n }\n\n return false;\n });\n\n return !!found;\n });\n\n return found;\n },\n\n mapTree<T1 extends TreeNode = TreeNode, T2 extends TreeNode = T1>(\n nodes: T1[],\n fn: (node: T1, index: number, nodes: T1[]) => T2\n ): T2[] {\n return nodes.map((node, index, array) => {\n let newNode = node;\n\n if (node.nodes) {\n newNode = {\n ...newNode,\n nodes: this.mapTree(node.nodes as T1[], fn)\n };\n }\n\n return fn(newNode, index, array);\n });\n },\n\n forEachNode<T extends TreeNode = TreeNode>(\n nodes: T[],\n fn: (node: T, index: number, nodes: T[]) => void\n ): void {\n nodes.forEach((node, index, array) => {\n if (node.nodes) {\n this.forEachNode(node.nodes as T[], fn);\n }\n\n fn(node, index, array);\n });\n },\n\n mapNode<T1 extends TreeNode = TreeNode, T2 extends TreeNode = T1>(\n nodes: T1[],\n id: T1['id'],\n fn: (node: T1, index: number, array: T1[]) => T2\n ): (T1 | T2)[] {\n return nodes.map((node, index, array) => {\n let newNode: T1 | T2 = node;\n\n if (node.nodes) {\n newNode = {\n ...newNode,\n nodes: this.mapNode(node.nodes as T1[], id, fn)\n };\n }\n\n if (node.id === id) {\n newNode = fn(newNode, index, array);\n }\n\n return newNode;\n });\n },\n\n flatten<T extends TreeNode = TreeNode>(nodes: T[], ancestors?: T[]): (T & { ancestors?: T[] })[] {\n return nodes.reduce<(T & { ancestors?: T[] })[]>((flatNodes, node) => {\n if (node.nodes) {\n return [\n ...flatNodes,\n node,\n ...this.flatten(node.nodes as T[], ancestors ? [...ancestors, node] : [node])\n ];\n }\n\n return [...flatNodes, ancestors ? { ...node, ancestors } : node];\n }, []);\n },\n\n getAncestors<T extends TreeNode = TreeNode>(nodes: T[], id: T['id'], ancestors: T[] = []): T[] {\n const directParent = this.getParentNode(nodes, id);\n\n if (directParent) {\n ancestors.push(directParent);\n this.getAncestors(nodes, directParent.id, ancestors);\n }\n\n return ancestors;\n },\n\n appendTo<T extends TreeNode = TreeNode>(nodes: T[], id: T['id'], newNodes: T[]): T[] {\n if (id) {\n return this.mapNode(nodes, id, node => ({\n ...node,\n nodes: [...(node.nodes ?? []), ...newNodes]\n }));\n }\n\n return [...nodes, ...newNodes];\n },\n\n expandTo<T extends TreeNode = TreeNode>(nodes: T[], id: T['id'], collapseOthers = false): T[] {\n return nodes.map(node => {\n // leaf node\n if (node.id === id) {\n return {\n ...node,\n expanded: true\n };\n }\n\n // parent node\n if (node.nodes) {\n let expanded = collapseOthers ? false : node.expanded;\n\n if (this.getNode(node.nodes, id)) {\n expanded = true;\n }\n\n return {\n ...node,\n nodes: this.expandTo(node.nodes, id, collapseOthers),\n expanded\n };\n }\n\n return { ...node, expanded: collapseOthers ? false : node.expanded };\n });\n },\n\n getFirstChildNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let firstChildNode;\n const node = this.getNode(nodes, id);\n if (node && node.expanded && node.nodes && node.nodes.length > 0) {\n const childNodes = node.nodes as T[];\n firstChildNode = childNodes[0];\n }\n return firstChildNode;\n },\n\n getAdjacentNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let nextNode;\n const parent = this.getParentNode(nodes, id);\n if (parent && parent.nodes && parent.nodes.length > 0) {\n const childNodes = parent.nodes as T[];\n const currentIndex = childNodes.map(nodeEl => nodeEl.id).indexOf(id);\n if (currentIndex === childNodes.length - 1) {\n nextNode = this.getAdjacentNode(nodes, parent.id);\n } else {\n nextNode = childNodes[currentIndex + 1];\n }\n } else {\n const index = nodes.map(nodeEl => nodeEl.id).indexOf(id);\n nextNode = nodes[index + 1];\n }\n return nextNode;\n },\n\n getNextNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n let nextNode;\n const firstChildNode = this.getFirstChildNode(nodes, id);\n if (firstChildNode) {\n nextNode = firstChildNode;\n } else {\n nextNode = this.getAdjacentNode(nodes, id);\n }\n return nextNode;\n },\n\n getDeepestNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n const node = this.getNode(nodes, id);\n let lastNode = node;\n if (node && node.expanded && node.nodes && node.nodes.length > 0) {\n const childNodes = node.nodes as T[];\n const lastChildNode = childNodes[childNodes.length - 1];\n if (lastChildNode.expanded) {\n lastNode = this.getDeepestNode(nodes, lastChildNode.id);\n } else {\n lastNode = lastChildNode;\n }\n }\n return lastNode;\n },\n\n getPreviousNode<T extends TreeNode = TreeNode>(nodes: T[], id: T['id']): T | undefined {\n const parent = this.getParentNode(nodes, id);\n let previousNode;\n if (parent && parent.nodes && parent.nodes.length > 0) {\n const childNodes = parent.nodes;\n const currentIndex = childNodes.map(nodeEl => nodeEl.id).indexOf(id);\n if (currentIndex === 0) {\n previousNode = parent;\n } else {\n previousNode = this.getDeepestNode(nodes, childNodes[currentIndex - 1].id);\n }\n } else {\n const index = nodes.map(node => node.id).indexOf(id);\n if (nodes[index - 1]) previousNode = this.getDeepestNode(nodes, nodes[index - 1].id);\n }\n return previousNode;\n }\n};\n\nexport default helpers;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default, TreeProps, StyledTreeList, StyledTreeListItem, TreeNode } from './Tree';
|
|
2
2
|
export { default as StandardTree } from './StandardTree';
|
|
3
|
-
export { StandardTreeProps } from './StandardTree.types';
|
|
3
|
+
export { StandardTreeProps, StandardTreeNode } from './StandardTree.types';
|
|
4
4
|
export { default as treeHelpers } from './helpers';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tree/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tree/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Tree/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAa,cAAc,EAAE,kBAAkB,EAAY,MAAM,QAAQ,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export { default, TreeProps, StyledTreeList, StyledTreeListItem, TreeNode } from './Tree';\nexport { default as StandardTree } from './StandardTree';\nexport { StandardTreeProps } from './StandardTree.types';\nexport { default as treeHelpers } from './helpers';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Tree/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAa,cAAc,EAAE,kBAAkB,EAAY,MAAM,QAAQ,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export { default, TreeProps, StyledTreeList, StyledTreeListItem, TreeNode } from './Tree';\nexport { default as StandardTree } from './StandardTree';\nexport { StandardTreeProps, StandardTreeNode } from './StandardTree.types';\nexport { default as treeHelpers } from './helpers';\n"]}
|
|
@@ -9,9 +9,9 @@ export interface URLDisplayProps extends BaseProps, NoChildrenProp {
|
|
|
9
9
|
* Controls styling of the field.
|
|
10
10
|
* @default "link"
|
|
11
11
|
*/
|
|
12
|
-
variant?: 'link' | 'text';
|
|
12
|
+
variant?: 'link' | 'text' | 'qrcode';
|
|
13
13
|
/** Ref for the wrapping element. */
|
|
14
|
-
ref?: Ref<HTMLAnchorElement | HTMLSpanElement>;
|
|
14
|
+
ref?: Ref<HTMLAnchorElement | HTMLSpanElement | HTMLImageElement | HTMLDivElement>;
|
|
15
15
|
}
|
|
16
16
|
declare const URLDisplay: FunctionComponent<URLDisplayProps & ForwardProps>;
|
|
17
17
|
export default URLDisplay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"URLDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/URL/URLDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAA8B,GAAG,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"URLDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/URL/URLDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAA8B,GAAG,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGtE,MAAM,WAAW,eAAgB,SAAQ,SAAS,EAAE,cAAc;IAChE,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IACrC,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,iBAAiB,GAAG,eAAe,GAAG,gBAAgB,GAAG,cAAc,CAAC,CAAC;CACpF;AA4BD,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CAkCjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import Link from '../Link';
|
|
4
|
+
import QRCode from '../QRCode';
|
|
4
5
|
/**
|
|
5
6
|
* Function gets the url as a string and converts it to a HTML markup with whitespace opportunity elements.
|
|
6
7
|
* It helps breaking a long url correctly to avoid parent container overflow issues
|
|
@@ -27,7 +28,13 @@ const generateUrlMarkup = (url) => {
|
|
|
27
28
|
};
|
|
28
29
|
const URLDisplay = forwardRef(({ value, displayText, variant = 'link', ...restProps }, ref) => {
|
|
29
30
|
const displayValue = value ? (displayText || generateUrlMarkup(value)) : (_jsx("span", { "aria-hidden": 'true', children: "\u2013\u2013" }));
|
|
30
|
-
|
|
31
|
+
if (variant === 'text' || !value) {
|
|
32
|
+
return (_jsx("span", { ref: ref, ...restProps, children: displayValue }));
|
|
33
|
+
}
|
|
34
|
+
if (variant === 'qrcode') {
|
|
35
|
+
return (_jsx(QRCode, { ref: ref, ...restProps, value: value, label: displayText }));
|
|
36
|
+
}
|
|
37
|
+
return (_jsx(Link, { ref: ref, ...restProps, href: value, children: displayValue }));
|
|
31
38
|
});
|
|
32
39
|
export default URLDisplay;
|
|
33
40
|
//# sourceMappingURL=URLDisplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"URLDisplay.js","sourceRoot":"","sources":["../../../src/components/URL/URLDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AAEvF,OAAO,IAAI,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"URLDisplay.js","sourceRoot":"","sources":["../../../src/components/URL/URLDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AAEvF,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAgB/B;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAa,EAAE;IACnD,MAAM,SAAS,GAAG,GAAG;SAClB,KAAK,CAAC,IAAI,CAAC;QACZ,6EAA6E;SAC5E,GAAG,CAAC,G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C;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, ReactNode, Ref } from 'react';\n\nimport Link from '../Link';\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport QRCode from '../QRCode';\n\nexport interface URLDisplayProps extends BaseProps, NoChildrenProp {\n /** URL address, includes scheme, 'http://', 'https://' */\n value?: string;\n /** The text to be displayed. */\n displayText?: string;\n /**\n * Controls styling of the field.\n * @default \"link\"\n */\n variant?: 'link' | 'text' | 'qrcode';\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement | HTMLSpanElement | HTMLImageElement | HTMLDivElement>;\n}\n\n/**\n * Function gets the url as a string and converts it to a HTML markup with whitespace opportunity elements.\n * It helps breaking a long url correctly to avoid parent container overflow issues\n * according to \"The Chicago Manual of Style\" copywriting standard.\n * @param url input url to construct markup for\n * @returns array of nodes\n */\nconst generateUrlMarkup = (url: string): ReactNode => {\n const markedUrl = url\n .split('//')\n /* Insert \\x1f (unit separator) char as a placeholder at correct position. */\n .map(str => {\n return str\n .replace(/:/giu, '$&\\x1f')\n .replace(/[/~.,\\\\-_?#%]/giu, '\\x1f$&')\n .replace(/[=&]/giu, '\\x1f$&\\x1f');\n })\n .join('//\\x1f');\n\n /* Replace unit separator character with <wbr /> element. Create an array of nodes in place of string to pass tags escaping. */\n return markedUrl.split('\\x1f').reduce<ReactNode[]>((urlFragments, part) => {\n urlFragments.push(part, <wbr key={urlFragments.length} />);\n return urlFragments;\n }, []);\n};\n\nconst URLDisplay: FunctionComponent<URLDisplayProps & ForwardProps> = forwardRef(\n (\n { value, displayText, variant = 'link', ...restProps }: PropsWithoutRef<URLDisplayProps>,\n ref: URLDisplayProps['ref']\n ) => {\n const displayValue = value ? (\n displayText || generateUrlMarkup(value)\n ) : (\n <span aria-hidden='true'>––</span>\n );\n\n if (variant === 'text' || !value) {\n return (\n <span ref={ref as Ref<HTMLSpanElement>} {...restProps}>\n {displayValue}\n </span>\n );\n }\n if (variant === 'qrcode') {\n return (\n <QRCode\n ref={ref as Ref<HTMLImageElement>}\n {...restProps}\n value={value}\n label={displayText}\n />\n );\n }\n return (\n <Link ref={ref as Ref<HTMLAnchorElement>} {...restProps} href={value}>\n {displayValue}\n </Link>\n );\n }\n);\n\nexport default URLDisplay;\n"]}
|
package/lib/hooks/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { default as useFocusWithin } from './useFocusWithin';
|
|
|
15
15
|
export { default as useI18n } from './useI18n';
|
|
16
16
|
export { default as useInputFormatter } from './useInputFormatter';
|
|
17
17
|
export { default as useItemIntersection } from './useItemIntersection';
|
|
18
|
+
export { default as useLiveLog } from './useLiveLog';
|
|
18
19
|
export { default as useLongPress } from './useLongPress';
|
|
19
20
|
export { default as useModalContext } from './useModalContext';
|
|
20
21
|
export { default as useModalManager } from './useModalManager';
|
package/lib/hooks/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,mBAAmB,EAC9B,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,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.js
CHANGED
|
@@ -15,6 +15,7 @@ export { default as useFocusWithin } from './useFocusWithin';
|
|
|
15
15
|
export { default as useI18n } from './useI18n';
|
|
16
16
|
export { default as useInputFormatter } from './useInputFormatter';
|
|
17
17
|
export { default as useItemIntersection } from './useItemIntersection';
|
|
18
|
+
export { default as useLiveLog } from './useLiveLog';
|
|
18
19
|
export { default as useLongPress } from './useLongPress';
|
|
19
20
|
export { default as useModalContext } from './useModalContext';
|
|
20
21
|
export { default as useModalManager } from './useModalManager';
|
package/lib/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,mBAAmB,EAE9B,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO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C","sourcesContent":["export {\n default as useActiveDescendant,\n UseActiveDescendantConfig,\n useLazyDescendant\n} from './useActiveDescendant';\nexport { default as useAfterInitialEffect } from './useAfterInitialEffect';\nexport { default as useArrows } from './useArrows';\nexport { default as useAutoResize } from './useAutoResize';\nexport { default as useBreakpoint } from './useBreakpoint';\nexport { default as useConfiguration } from './useConfiguration';\nexport { default as useConsolidatedRef } from './useConsolidatedRef';\nexport { default as useDirection } from './useDirection';\nexport { default as useDraggable } from './useDraggable';\nexport { default as useElement } from './useElement';\nexport { default as useEscape } from './useEscape';\nexport { default as useEvent } from './useEvent';\nexport { default as useFocusTrap } from './useFocusTrap';\nexport { default as useFocusWithin } from './useFocusWithin';\nexport { default as useI18n } from './useI18n';\nexport { default as useInputFormatter } from './useInputFormatter';\nexport { default as useItemIntersection } from './useItemIntersection';\nexport { default as useLongPress } from './useLongPress';\nexport { default as useModalContext } from './useModalContext';\nexport { default as useModalManager } from './useModalManager';\nexport { default as useOS } from './useOS';\nexport { default as useOuterEvent } from './useOuterEvent';\nexport { default as useOverride } from './useOverride';\nexport { default as usePrevious } from './usePrevious';\nexport { default as useScrollStick } from './useScrollStick';\nexport { default as useScrollToggle } from './useScrollToggle';\nexport { default as useTheme } from './useTheme';\nexport { default as useToaster } from './useToaster';\nexport { default as useTransitionState } from './useTransitionState';\nexport { default as useTriggerableEffect } from './useTriggerableEffect';\nexport { default as useTriggerableLayoutEffect } from './useTriggerableLayoutEffect';\nexport { default as useUID } from './useUID';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,mBAAmB,EAE9B,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO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;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export {\n default as useActiveDescendant,\n UseActiveDescendantConfig,\n useLazyDescendant\n} from './useActiveDescendant';\nexport { default as useAfterInitialEffect } from './useAfterInitialEffect';\nexport { default as useArrows } from './useArrows';\nexport { default as useAutoResize } from './useAutoResize';\nexport { default as useBreakpoint } from './useBreakpoint';\nexport { default as useConfiguration } from './useConfiguration';\nexport { default as useConsolidatedRef } from './useConsolidatedRef';\nexport { default as useDirection } from './useDirection';\nexport { default as useDraggable } from './useDraggable';\nexport { default as useElement } from './useElement';\nexport { default as useEscape } from './useEscape';\nexport { default as useEvent } from './useEvent';\nexport { default as useFocusTrap } from './useFocusTrap';\nexport { default as useFocusWithin } from './useFocusWithin';\nexport { default as useI18n } from './useI18n';\nexport { default as useInputFormatter } from './useInputFormatter';\nexport { default as useItemIntersection } from './useItemIntersection';\nexport { default as useLiveLog } from './useLiveLog';\nexport { default as useLongPress } from './useLongPress';\nexport { default as useModalContext } from './useModalContext';\nexport { default as useModalManager } from './useModalManager';\nexport { default as useOS } from './useOS';\nexport { default as useOuterEvent } from './useOuterEvent';\nexport { default as useOverride } from './useOverride';\nexport { default as usePrevious } from './usePrevious';\nexport { default as useScrollStick } from './useScrollStick';\nexport { default as useScrollToggle } from './useScrollToggle';\nexport { default as useTheme } from './useTheme';\nexport { default as useToaster } from './useToaster';\nexport { default as useTransitionState } from './useTransitionState';\nexport { default as useTriggerableEffect } from './useTriggerableEffect';\nexport { default as useTriggerableLayoutEffect } from './useTriggerableLayoutEffect';\nexport { default as useUID } from './useUID';\n"]}
|
|
@@ -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;;;;;yCA0G5B,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/lib/hooks/useArrows.js
CHANGED
|
@@ -39,13 +39,13 @@ dependencies = []) => {
|
|
|
39
39
|
}, 0);
|
|
40
40
|
}, [selector, ...dependencies]);
|
|
41
41
|
const listener = useCallback((e) => {
|
|
42
|
+
const el = ref.current;
|
|
43
|
+
if (!el)
|
|
44
|
+
return;
|
|
42
45
|
if (['Home', 'End', NextKey, PrevKey].includes(e.key))
|
|
43
46
|
e.preventDefault();
|
|
44
47
|
if (!documentIsAvailable)
|
|
45
48
|
return;
|
|
46
|
-
const el = ref.current;
|
|
47
|
-
if (!el)
|
|
48
|
-
return;
|
|
49
49
|
const items = Array.from(el.querySelectorAll(selector)).filter((item) => item instanceof HTMLElement);
|
|
50
50
|
if (!items.length)
|
|
51
51
|
return;
|
|
@@ -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,EACf,aAAa,GAAG,IAAI,KAMlB,EAAE;AACN,wEAAwE;AACxE,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,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,iBAAiB,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;YAEpE,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;gBAChC,IAAI,aAAa;oBAAG,iBAAiB,CAAC,CAAC,CAAiB,CAAC,QAAQ,GAAG,CAAC,CAAC;gBACtE,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;oBACxC,IAAI,IAAI,YAAY,WAAW,E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aAC5B;SACF;aAAM;YACL,OAAO;SACR;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;QAEhB,aAAa,CAAC,EAAE,CAAC,CAAC;QAClB,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, 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 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 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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBreakpoint.d.ts","sourceRoot":"","sources":["../../src/hooks/useBreakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useBreakpoint.d.ts","sourceRoot":"","sources":["../../src/hooks/useBreakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,SAAS,EAAE,MAAM,OAAO,CAAC;AAS1E;;;;;GAKG;AACH,QAAA,MAAM,aAAa,eACL,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;oBAM1B,UAAU,OAAO,CAAC,GAAG,SAAS;;;aAkEjD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useState, useLayoutEffect, useCallback } from 'react';
|
|
2
2
|
import { windowIsAvailable, debounce } from '../utils';
|
|
3
3
|
import useTheme from './useTheme';
|
|
4
|
+
// We should be able to safely capture once as the computed root font size is unlikely to change during normal runtime.
|
|
5
|
+
const rootFontSize = window.getComputedStyle(document.documentElement).fontSize;
|
|
4
6
|
/**
|
|
5
7
|
* @example const breakpointActive = useBreakpoint(breakpoint);
|
|
6
8
|
* @param breakpoint The string indicator for the breakpoint that should be checked for validity.
|
|
@@ -21,8 +23,7 @@ const useBreakpoint = (breakpoint, { breakpointRef, defaultValue = false, themeP
|
|
|
21
23
|
const matchesBreakpoint = entries.some(({ target, contentRect }) => {
|
|
22
24
|
if (target !== breakpointRef.current)
|
|
23
25
|
return;
|
|
24
|
-
|
|
25
|
-
return contentRect.width >= parseFloat(breakpointVal) * parseFloat(fontSize);
|
|
26
|
+
return contentRect.width >= parseFloat(breakpointVal) * parseFloat(rootFontSize);
|
|
26
27
|
});
|
|
27
28
|
setMatches(matchesBreakpoint);
|
|
28
29
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBreakpoint.js","sourceRoot":"","sources":["../../src/hooks/useBreakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAa,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;;;;GAKG;AACH,MAAM,aAAa,GAAG,CACpB,UAA4C,EAC5C,EACE,aAAa,EACb,YAAY,GAAG,KAAK,EACpB,SAAS,GAAG,aAAa,KAKvB,EAAE,EACN,EAAE;IACF,MAAM,EACJ,IAAI,EAAE,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,EACrD,GAAG,QAAQ,EAAE,CAAC;IACf,MAAM,aAAa,GACjB,SAAS,KAAK,eAAe,CAAC,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAErF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CACpC,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,aAAa,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAChG,CAAC;IAEF,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAsB,EAAE,EAAE;QACtD,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,eAAe,CAAC,GAAG,EAAE;QACnB,6CAA6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AAQ,CAAC,CAAC;gBAChD,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;aAChC;iBAAM;gBACL,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;gBACjD,UAAU,CAAC,MAAM,CAAC,UAAU,IAAI,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC;aAC9D;YAED,OAAO,GAAG,EAAE;gBACV,+DAA+D;gBAC/D,IAAI,mBAAmB;oBAAE,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;qBACvE;oBACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;iBACrD;YACH,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAE7B,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useState, useLayoutEffect, useCallback, RefObject } from 'react';\n\nimport { windowIsAvailable, debounce } from '../utils';\n\nimport useTheme from './useTheme';\n\n// We should be able to safely capture once as the computed root font size is unlikely to change during normal runtime.\nconst rootFontSize = window.getComputedStyle(document.documentElement).fontSize;\n\n/**\n * @example const breakpointActive = useBreakpoint(breakpoint);\n * @param breakpoint The string indicator for the breakpoint that should be checked for validity.\n * @param options\n * @returns breakpointActive:: A boolean indicating if the given breakpoint is active or not. If false, the breakpoint is too big for the screen size.\n */\nconst useBreakpoint = (\n breakpoint: 'xs' | 'sm' | 'md' | 'lg' | 'xl',\n {\n breakpointRef,\n defaultValue = false,\n themeProp = 'breakpoints'\n }: {\n breakpointRef?: RefObject<Element> | undefined;\n defaultValue?: boolean;\n themeProp?: 'breakpoints' | 'content-width';\n } = {}\n) => {\n const {\n base: { breakpoints, 'content-width': contentWidth }\n } = useTheme();\n const breakpointVal =\n themeProp === 'content-width' ? contentWidth[breakpoint] : breakpoints[breakpoint];\n\n const [matches, setMatches] = useState(\n windowIsAvailable ? window.matchMedia(`(min-width: ${breakpointVal})`).matches : !!defaultValue\n );\n\n const onResize = useCallback((e: MediaQueryListEvent) => {\n setMatches(e.matches);\n }, []);\n\n useLayoutEffect(() => {\n // Breakpoint handling for contained elements\n if (breakpointRef && breakpointRef.current) {\n const observer = new ResizeObserver(entries => {\n const matchesBreakpoint = entries.some(({ target, contentRect }) => {\n if (target !== breakpointRef.current) return;\n\n return contentRect.width >= parseFloat(breakpointVal) * parseFloat(rootFontSize);\n });\n\n setMatches(matchesBreakpoint);\n });\n\n observer.observe(breakpointRef.current);\n\n return () => {\n observer.disconnect();\n };\n }\n // Breakpoint handling for viewport\n if (windowIsAvailable) {\n const mediaMatch = window.matchMedia(`(min-width: ${breakpointVal})`);\n const mediaMatchAvailable = 'addEventListener' in mediaMatch;\n const resizeHandler = debounce(() => {\n setMatches(window.innerWidth >= parseInt(breakpointVal, 10));\n }, 100);\n\n // Need to check useMatchMedia in order to support unit testing\n if (mediaMatchAvailable) {\n mediaMatch.addEventListener('change', onResize);\n setMatches(mediaMatch.matches);\n } else {\n window.addEventListener('resize', resizeHandler);\n setMatches(window.innerWidth >= parseInt(breakpointVal, 10));\n }\n\n return () => {\n // Need to check useMatchMedia in order to support unit testing\n if (mediaMatchAvailable) mediaMatch.removeEventListener('change', onResize);\n else {\n window.removeEventListener('resize', resizeHandler);\n }\n };\n }\n }, [breakpointRef?.current]);\n\n return matches;\n};\n\nexport default useBreakpoint;\n"]}
|
package/lib/hooks/useI18n.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
19
19
|
opens_in_a_new_tab: string;
|
|
20
20
|
summary: string;
|
|
21
21
|
utilities: string;
|
|
22
|
+
search: string;
|
|
23
|
+
menu: string;
|
|
22
24
|
remove: string;
|
|
23
25
|
follow: string;
|
|
24
26
|
unfollow: string;
|
|
@@ -142,6 +144,14 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
142
144
|
many: string;
|
|
143
145
|
other: string;
|
|
144
146
|
};
|
|
147
|
+
recent_results_count: {
|
|
148
|
+
zero: string;
|
|
149
|
+
one: string;
|
|
150
|
+
two: string;
|
|
151
|
+
few: string;
|
|
152
|
+
many: string;
|
|
153
|
+
other: string;
|
|
154
|
+
};
|
|
145
155
|
new_emails_count: {
|
|
146
156
|
zero: string;
|
|
147
157
|
one: string;
|
|
@@ -159,6 +169,8 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
159
169
|
range_to_numeric: string;
|
|
160
170
|
x_of_y: string;
|
|
161
171
|
preview_link_instruction: string;
|
|
172
|
+
polite_announcements: string;
|
|
173
|
+
assertive_announcements: string;
|
|
162
174
|
go_to_main_content: string;
|
|
163
175
|
main_content: string;
|
|
164
176
|
app_shell_create: string;
|
|
@@ -562,10 +574,13 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
562
574
|
condition_builder_date_function_day: string;
|
|
563
575
|
condition_builder_date_function_hour: string;
|
|
564
576
|
condition_builder_date_function_hour_of_day: string;
|
|
577
|
+
condition_builder_date_function_minute: string;
|
|
578
|
+
condition_builder_date_function_second: string;
|
|
565
579
|
condition_builder_date_function_month_of_year: string;
|
|
566
580
|
condition_builder_date_function_day_of_month: string;
|
|
567
581
|
condition_builder_date_function_day_of_week: string;
|
|
568
582
|
condition_builder_date_part: string;
|
|
583
|
+
condition_builder_relative_dates_second: string;
|
|
569
584
|
condition_builder_relative_dates_minute: string;
|
|
570
585
|
condition_builder_relative_dates_hour: string;
|
|
571
586
|
condition_builder_relative_dates_day: string;
|
|
@@ -573,6 +588,7 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
573
588
|
condition_builder_relative_dates_month: string;
|
|
574
589
|
condition_builder_relative_dates_quarter: string;
|
|
575
590
|
condition_builder_relative_dates_year: string;
|
|
591
|
+
condition_builder_current_second: string;
|
|
576
592
|
condition_builder_current_minute: string;
|
|
577
593
|
condition_builder_current_hour: string;
|
|
578
594
|
condition_builder_current_day: string;
|
|
@@ -580,6 +596,14 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
580
596
|
condition_builder_current_month: string;
|
|
581
597
|
condition_builder_current_quarter: string;
|
|
582
598
|
condition_builder_current_year: string;
|
|
599
|
+
condition_builder_last_X_seconds: {
|
|
600
|
+
zero: string;
|
|
601
|
+
one: string;
|
|
602
|
+
two: string;
|
|
603
|
+
few: string;
|
|
604
|
+
many: string;
|
|
605
|
+
other: string;
|
|
606
|
+
};
|
|
583
607
|
condition_builder_last_X_minutes: {
|
|
584
608
|
zero: string;
|
|
585
609
|
one: string;
|
|
@@ -636,6 +660,14 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
636
660
|
many: string;
|
|
637
661
|
other: string;
|
|
638
662
|
};
|
|
663
|
+
condition_builder_next_X_seconds: {
|
|
664
|
+
zero: string;
|
|
665
|
+
one: string;
|
|
666
|
+
two: string;
|
|
667
|
+
few: string;
|
|
668
|
+
many: string;
|
|
669
|
+
other: string;
|
|
670
|
+
};
|
|
639
671
|
condition_builder_next_X_minutes: {
|
|
640
672
|
zero: string;
|
|
641
673
|
one: string;
|
|
@@ -692,6 +724,14 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
692
724
|
many: string;
|
|
693
725
|
other: string;
|
|
694
726
|
};
|
|
727
|
+
condition_builder_previous_X_seconds: {
|
|
728
|
+
zero: string;
|
|
729
|
+
one: string;
|
|
730
|
+
two: string;
|
|
731
|
+
few: string;
|
|
732
|
+
many: string;
|
|
733
|
+
other: string;
|
|
734
|
+
};
|
|
695
735
|
condition_builder_previous_X_minutes: {
|
|
696
736
|
zero: string;
|
|
697
737
|
one: string;
|
|
@@ -776,6 +816,9 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
776
816
|
process_name: string;
|
|
777
817
|
step_name: string;
|
|
778
818
|
item_error: string;
|
|
819
|
+
step_name_error: string;
|
|
820
|
+
stage_name_error: string;
|
|
821
|
+
process_name_error: string;
|
|
779
822
|
add_node: string;
|
|
780
823
|
search_nodes: string;
|
|
781
824
|
delete_step: 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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '../init';
|
|
2
|
+
/**
|
|
3
|
+
* @example const { announce } = useLiveLog();
|
|
4
|
+
* @returns ...
|
|
5
|
+
*/
|
|
6
|
+
declare const useLiveLog: () => import("../components/LiveLog/LiveLog.types").LiveLogContextValue;
|
|
7
|
+
export default useLiveLog;
|
|
8
|
+
//# sourceMappingURL=useLiveLog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLiveLog.d.ts","sourceRoot":"","sources":["../../src/hooks/useLiveLog.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,CAAC;AAIjB;;;GAGG;AACH,QAAA,MAAM,UAAU,yEAMf,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import '../init';
|
|
3
|
+
import { windowIsAvailable } from '../utils';
|
|
4
|
+
import { LiveLogContext } from '../components/LiveLog/Context';
|
|
5
|
+
/**
|
|
6
|
+
* @example const { announce } = useLiveLog();
|
|
7
|
+
* @returns ...
|
|
8
|
+
*/
|
|
9
|
+
const useLiveLog = () => {
|
|
10
|
+
const context = windowIsAvailable
|
|
11
|
+
? window.cosmos.liveLogContext ?? LiveLogContext
|
|
12
|
+
: LiveLogContext;
|
|
13
|
+
return useContext(context);
|
|
14
|
+
};
|
|
15
|
+
export default useLiveLog;
|
|
16
|
+
//# sourceMappingURL=useLiveLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLiveLog.js","sourceRoot":"","sources":["../../src/hooks/useLiveLog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,SAAS,CAAC;AACjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D;;;GAGG;AACH,MAAM,UAAU,GAAG,GAAG,EAAE;IACtB,MAAM,OAAO,GAAG,iBAAiB;QAC/B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,IAAI,cAAc;QAChD,CAAC,CAAC,cAAc,CAAC;IAEnB,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { useContext } from 'react';\n\nimport '../init';\nimport { windowIsAvailable } from '../utils';\nimport { LiveLogContext } from '../components/LiveLog/Context';\n\n/**\n * @example const { announce } = useLiveLog();\n * @returns ...\n */\nconst useLiveLog = () => {\n const context = windowIsAvailable\n ? window.cosmos.liveLogContext ?? LiveLogContext\n : LiveLogContext;\n\n return useContext(context);\n};\n\nexport default useLiveLog;\n"]}
|
package/lib/i18n/default.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ declare const _default: {
|
|
|
15
15
|
opens_in_a_new_tab: string;
|
|
16
16
|
summary: string;
|
|
17
17
|
utilities: string;
|
|
18
|
+
search: string;
|
|
19
|
+
menu: string;
|
|
18
20
|
remove: string;
|
|
19
21
|
follow: string;
|
|
20
22
|
unfollow: string;
|
|
@@ -138,6 +140,14 @@ declare const _default: {
|
|
|
138
140
|
many: string;
|
|
139
141
|
other: string;
|
|
140
142
|
};
|
|
143
|
+
recent_results_count: {
|
|
144
|
+
zero: string;
|
|
145
|
+
one: string;
|
|
146
|
+
two: string;
|
|
147
|
+
few: string;
|
|
148
|
+
many: string;
|
|
149
|
+
other: string;
|
|
150
|
+
};
|
|
141
151
|
new_emails_count: {
|
|
142
152
|
zero: string;
|
|
143
153
|
one: string;
|
|
@@ -155,6 +165,8 @@ declare const _default: {
|
|
|
155
165
|
range_to_numeric: string;
|
|
156
166
|
x_of_y: string;
|
|
157
167
|
preview_link_instruction: string;
|
|
168
|
+
polite_announcements: string;
|
|
169
|
+
assertive_announcements: string;
|
|
158
170
|
go_to_main_content: string;
|
|
159
171
|
main_content: string;
|
|
160
172
|
app_shell_create: string;
|
|
@@ -558,10 +570,13 @@ declare const _default: {
|
|
|
558
570
|
condition_builder_date_function_day: string;
|
|
559
571
|
condition_builder_date_function_hour: string;
|
|
560
572
|
condition_builder_date_function_hour_of_day: string;
|
|
573
|
+
condition_builder_date_function_minute: string;
|
|
574
|
+
condition_builder_date_function_second: string;
|
|
561
575
|
condition_builder_date_function_month_of_year: string;
|
|
562
576
|
condition_builder_date_function_day_of_month: string;
|
|
563
577
|
condition_builder_date_function_day_of_week: string;
|
|
564
578
|
condition_builder_date_part: string;
|
|
579
|
+
condition_builder_relative_dates_second: string;
|
|
565
580
|
condition_builder_relative_dates_minute: string;
|
|
566
581
|
condition_builder_relative_dates_hour: string;
|
|
567
582
|
condition_builder_relative_dates_day: string;
|
|
@@ -569,6 +584,7 @@ declare const _default: {
|
|
|
569
584
|
condition_builder_relative_dates_month: string;
|
|
570
585
|
condition_builder_relative_dates_quarter: string;
|
|
571
586
|
condition_builder_relative_dates_year: string;
|
|
587
|
+
condition_builder_current_second: string;
|
|
572
588
|
condition_builder_current_minute: string;
|
|
573
589
|
condition_builder_current_hour: string;
|
|
574
590
|
condition_builder_current_day: string;
|
|
@@ -576,6 +592,14 @@ declare const _default: {
|
|
|
576
592
|
condition_builder_current_month: string;
|
|
577
593
|
condition_builder_current_quarter: string;
|
|
578
594
|
condition_builder_current_year: string;
|
|
595
|
+
condition_builder_last_X_seconds: {
|
|
596
|
+
zero: string;
|
|
597
|
+
one: string;
|
|
598
|
+
two: string;
|
|
599
|
+
few: string;
|
|
600
|
+
many: string;
|
|
601
|
+
other: string;
|
|
602
|
+
};
|
|
579
603
|
condition_builder_last_X_minutes: {
|
|
580
604
|
zero: string;
|
|
581
605
|
one: string;
|
|
@@ -632,6 +656,14 @@ declare const _default: {
|
|
|
632
656
|
many: string;
|
|
633
657
|
other: string;
|
|
634
658
|
};
|
|
659
|
+
condition_builder_next_X_seconds: {
|
|
660
|
+
zero: string;
|
|
661
|
+
one: string;
|
|
662
|
+
two: string;
|
|
663
|
+
few: string;
|
|
664
|
+
many: string;
|
|
665
|
+
other: string;
|
|
666
|
+
};
|
|
635
667
|
condition_builder_next_X_minutes: {
|
|
636
668
|
zero: string;
|
|
637
669
|
one: string;
|
|
@@ -688,6 +720,14 @@ declare const _default: {
|
|
|
688
720
|
many: string;
|
|
689
721
|
other: string;
|
|
690
722
|
};
|
|
723
|
+
condition_builder_previous_X_seconds: {
|
|
724
|
+
zero: string;
|
|
725
|
+
one: string;
|
|
726
|
+
two: string;
|
|
727
|
+
few: string;
|
|
728
|
+
many: string;
|
|
729
|
+
other: string;
|
|
730
|
+
};
|
|
691
731
|
condition_builder_previous_X_minutes: {
|
|
692
732
|
zero: string;
|
|
693
733
|
one: string;
|
|
@@ -772,6 +812,9 @@ declare const _default: {
|
|
|
772
812
|
process_name: string;
|
|
773
813
|
step_name: string;
|
|
774
814
|
item_error: string;
|
|
815
|
+
step_name_error: string;
|
|
816
|
+
stage_name_error: string;
|
|
817
|
+
process_name_error: string;
|
|
775
818
|
add_node: string;
|
|
776
819
|
search_nodes: string;
|
|
777
820
|
delete_step: 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,wBA49BE"}
|