@pega/cosmos-react-core 3.0.0-dev.26.0 → 3.0.0-dev.27.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/Actions/Actions.d.ts +5 -0
- package/lib/components/Actions/Actions.d.ts.map +1 -1
- package/lib/components/Actions/Actions.js +2 -2
- package/lib/components/Actions/Actions.js.map +1 -1
- package/lib/components/AdditionalInfo/AdditionalInfo.d.ts.map +1 -1
- package/lib/components/AdditionalInfo/AdditionalInfo.js.map +1 -1
- package/lib/components/AdditionalInfo/index.d.ts +1 -2
- package/lib/components/AdditionalInfo/index.d.ts.map +1 -1
- package/lib/components/AdditionalInfo/index.js +1 -1
- package/lib/components/AdditionalInfo/index.js.map +1 -1
- package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.js +7 -7
- package/lib/components/AppShell/AppHeader.js.map +1 -1
- package/lib/components/AppShell/AppShell.js +1 -1
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +1 -1
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/Badges/Count.d.ts.map +1 -1
- package/lib/components/Badges/Count.js +37 -1
- package/lib/components/Badges/Count.js.map +1 -1
- package/lib/components/Dialog/Dialog.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.js +2 -2
- package/lib/components/Dialog/Dialog.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.d.ts +7 -0
- package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +29 -28
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/FormControl/FormControl.d.ts +3 -2
- package/lib/components/FormControl/FormControl.d.ts.map +1 -1
- package/lib/components/FormControl/FormControl.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.js +8 -5
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts +1 -0
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.js +36 -2
- package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.d.ts +4 -0
- package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
- package/lib/components/Menu/MenuItem.d.ts.map +1 -1
- package/lib/components/Menu/MenuItem.js +1 -3
- package/lib/components/Menu/MenuItem.js.map +1 -1
- package/lib/components/Menu/NavItemsList.d.ts +2 -2
- package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
- package/lib/components/Menu/NavItemsList.js +9 -9
- package/lib/components/Menu/NavItemsList.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/lib/components/SearchInput/SearchInput.js +25 -6
- 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 +1 -1
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/Tree/StandardTree.d.ts.map +1 -1
- package/lib/components/Tree/StandardTree.js +27 -13
- package/lib/components/Tree/StandardTree.js.map +1 -1
- package/lib/components/Tree/StandardTree.styles.js +3 -3
- package/lib/components/Tree/StandardTree.styles.js.map +1 -1
- package/lib/components/Tree/StandardTree.types.d.ts +1 -0
- package/lib/components/Tree/StandardTree.types.d.ts.map +1 -1
- package/lib/components/Tree/StandardTree.types.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +4 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/i18n/default.d.ts +4 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +4 -0
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +4 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/theme/themes/buildTheme.json +0 -3
- package/lib/theme/themes/legacyBuildTheme.json +0 -3
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, createContext, useMemo, useContext, useCallback, useState } from 'react';
|
|
3
3
|
import Progress from '../Progress';
|
|
4
|
-
import { useDirection
|
|
4
|
+
import { useDirection } from '../../hooks';
|
|
5
5
|
import Flex from '../Flex';
|
|
6
|
+
import Button from '../Button';
|
|
6
7
|
import Actions from '../Actions';
|
|
7
8
|
import { cap } from '../../utils';
|
|
8
9
|
import { StyledStandardTreeParent, StyledToggleIcon, StyledStandardTreeItemSubTree, StyledStandardTreeLeaf, StyledStandardTree, StyledNodeInteraction, StyledStandardTreeNode, StyledNodeActions, StyledLabelContent, StyledNodeIcon, StyledNodeText } from './StandardTree.styles';
|
|
@@ -11,18 +12,18 @@ const StandardTreeContext = createContext({
|
|
|
11
12
|
currentNodeId: undefined,
|
|
12
13
|
lined: false,
|
|
13
14
|
onNodeClick: () => { },
|
|
15
|
+
onNodeToggle: () => { },
|
|
14
16
|
firstNodeId: undefined,
|
|
15
17
|
lastNodeId: undefined,
|
|
16
18
|
focusedNodeId: undefined,
|
|
17
19
|
changeFocusedNodeId: () => { }
|
|
18
20
|
});
|
|
19
21
|
const NodeRenderer = ({ id, label, icon, depth, hasParentSibling, nodes, expanded = false, loading = false, subTree, actions, onClick }) => {
|
|
20
|
-
const { currentNodeId, onNodeClick, lined, focusedNodeId, changeFocusedNodeId, firstNodeId, lastNodeId } = useContext(StandardTreeContext);
|
|
22
|
+
const { currentNodeId, onNodeClick, onNodeToggle, lined, focusedNodeId, changeFocusedNodeId, firstNodeId, lastNodeId } = useContext(StandardTreeContext);
|
|
21
23
|
const current = currentNodeId === id;
|
|
22
24
|
const focusedEl = focusedNodeId === id;
|
|
23
25
|
const firstNode = firstNodeId === id;
|
|
24
26
|
const { start, end } = useDirection();
|
|
25
|
-
const t = useI18n();
|
|
26
27
|
const tabIndex = useMemo(() => {
|
|
27
28
|
let index = -1;
|
|
28
29
|
if (focusedNodeId) {
|
|
@@ -56,13 +57,13 @@ const NodeRenderer = ({ id, label, icon, depth, hasParentSibling, nodes, expande
|
|
|
56
57
|
changeFocusedNodeId(id, 'right');
|
|
57
58
|
}
|
|
58
59
|
else {
|
|
59
|
-
|
|
60
|
+
onNodeToggle?.(id);
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
break;
|
|
63
64
|
case `Arrow${cap(start)}`:
|
|
64
65
|
if (expanded) {
|
|
65
|
-
|
|
66
|
+
onNodeToggle?.(id);
|
|
66
67
|
}
|
|
67
68
|
else {
|
|
68
69
|
changeFocusedNodeId(id, 'left');
|
|
@@ -88,18 +89,24 @@ const NodeRenderer = ({ id, label, icon, depth, hasParentSibling, nodes, expande
|
|
|
88
89
|
}
|
|
89
90
|
}, [id, end, nodes, expanded, actions, firstNodeId, lastNodeId, changeFocusedNodeId]);
|
|
90
91
|
const actionsJSX = useMemo(() => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
_jsx(StyledNodeActions, { children: _jsx(Actions, { items: actions.map(action => {
|
|
92
|
+
// since Actions may render a frag of buttons and we need a wrapper for flex space-between.
|
|
93
|
+
return actions ? (_jsx(StyledNodeActions, { children: _jsx(Actions, { items: actions.map(action => {
|
|
94
94
|
return {
|
|
95
95
|
...action,
|
|
96
|
-
tabIndex: -1,
|
|
97
96
|
onClick: (actionId, e) => {
|
|
98
97
|
e.stopPropagation();
|
|
99
98
|
action?.onClick?.(actionId, e);
|
|
100
99
|
}
|
|
101
100
|
};
|
|
102
|
-
}), menuAt: 3
|
|
101
|
+
}), menuAt: 3, menuButtonProps: {
|
|
102
|
+
onClick: (e) => e.stopPropagation(),
|
|
103
|
+
onKeyDown: (e) => {
|
|
104
|
+
e.stopPropagation();
|
|
105
|
+
if (['ArrowUp', 'ArrowDown'].includes(e.key)) {
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} }) })) : null;
|
|
103
110
|
}, [actions]);
|
|
104
111
|
const labelContent = useMemo(() => {
|
|
105
112
|
const internal = (
|
|
@@ -124,9 +131,15 @@ const NodeRenderer = ({ id, label, icon, depth, hasParentSibling, nodes, expande
|
|
|
124
131
|
changeFocusedNodeId,
|
|
125
132
|
onKeyDown
|
|
126
133
|
]);
|
|
127
|
-
return (_jsx(StyledStandardTreeNode, { id: id, style: { '--depth': depth, '--has-parent-sibling': Number(hasParentSibling) }, "aria-busy": loading, children: nodes ? (_jsxs(_Fragment, { children: [_jsxs(Flex, { container: { alignItems: 'center', justify: 'between', gap: 2 }, as: StyledStandardTreeParent, role: 'treeitem', "aria-current": current ? 'true' : undefined, tabIndex: tabIndex, variant: 'text', onClick: handleToggleClick, "aria-expanded": expanded ? 'true' : 'false', "aria-label":
|
|
134
|
+
return (_jsx(StyledStandardTreeNode, { id: id, style: { '--depth': depth, '--has-parent-sibling': Number(hasParentSibling) }, "aria-busy": loading, children: nodes ? (_jsxs(_Fragment, { children: [_jsxs(Flex, { container: { alignItems: 'center', justify: 'between', gap: 2 }, as: StyledStandardTreeParent, role: 'treeitem', "aria-current": current ? 'true' : undefined, tabIndex: tabIndex, variant: 'text', onClick: handleToggleClick, "aria-expanded": expanded ? 'true' : 'false', "aria-label": label, onKeyDown: onKeyDown, ref: focusedEl ? (focusedElRef) => focusedElRef?.focus() : undefined, children: [_jsxs(Flex, { container: { alignItems: 'center', gap: 0.5 }, as: 'span', children: [_jsx(Button, { variant: 'simple', icon: true, compact: true, onClick: (e) => {
|
|
135
|
+
if (onNodeToggle) {
|
|
136
|
+
e.stopPropagation();
|
|
137
|
+
onNodeToggle(id, e);
|
|
138
|
+
changeFocusedNodeId(id);
|
|
139
|
+
}
|
|
140
|
+
}, children: _jsx(StyledToggleIcon, { name: 'caret-right' }) }), labelContent] }), actionsJSX] }), _jsxs(StyledStandardTreeItemSubTree, { lined: lined, children: [subTree, loading && _jsx(Progress, { variant: 'ring', placement: 'inline' })] })] })) : (_jsx(StyledStandardTreeLeaf, { children: labelContent })) }));
|
|
128
141
|
};
|
|
129
|
-
const StandardTreeWithNodes = forwardRef(({ nodes, currentNodeId, onNodeClick, lined = false, ...restProps }, ref) => {
|
|
142
|
+
const StandardTreeWithNodes = forwardRef(({ nodes, currentNodeId, onNodeClick, onNodeToggle, lined = false, ...restProps }, ref) => {
|
|
130
143
|
const [focusedNodeId, setFocusedNodedId] = useState();
|
|
131
144
|
const lastNodeId = useMemo(() => {
|
|
132
145
|
return helpers.getDeepestNode(nodes, nodes[nodes.length - 1].id)?.id;
|
|
@@ -168,8 +181,9 @@ const StandardTreeWithNodes = forwardRef(({ nodes, currentNodeId, onNodeClick, l
|
|
|
168
181
|
firstNodeId: nodes[0].id,
|
|
169
182
|
changeFocusedNodeId,
|
|
170
183
|
onNodeClick,
|
|
184
|
+
onNodeToggle,
|
|
171
185
|
lined
|
|
172
|
-
}), [currentNodeId, onNodeClick, lined, focusedNodeId, lastNodeId]), children: _jsx(StyledStandardTree, { ...restProps, ref: ref, nodes: nodes, nodeRenderer: NodeRenderer }) }));
|
|
186
|
+
}), [currentNodeId, onNodeClick, lined, focusedNodeId, lastNodeId, onNodeToggle]), children: _jsx(StyledStandardTree, { ...restProps, ref: ref, nodes: nodes, nodeRenderer: NodeRenderer }) }));
|
|
173
187
|
});
|
|
174
188
|
const StandardTree = forwardRef((props, ref) => {
|
|
175
189
|
return props.nodes.length > 0 ? _jsx(StandardTreeWithNodes, { ...props, ref: ref }) : null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardTree.js","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,OAAO,EACP,UAAU,EACV,WAAW,EACX,QAAQ,EAET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E,GAAG,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACxF,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n forwardRef,\n createContext,\n useMemo,\n useContext,\n useCallback,\n useState,\n KeyboardEvent\n} from 'react';\nimport type { FunctionComponent, PropsWithoutRef, CSSProperties, MouseEvent } from 'react';\n\nimport Progress from '../Progress';\nimport { useDirection, useI18n } from '../../hooks';\nimport Flex from '../Flex';\nimport Actions from '../Actions';\nimport type { Action, ForwardProps } from '../../types';\nimport { cap } from '../../utils';\n\nimport {\n StyledStandardTreeParent,\n StyledToggleIcon,\n StyledStandardTreeItemSubTree,\n StyledStandardTreeLeaf,\n StyledStandardTree,\n StyledNodeInteraction,\n StyledStandardTreeNode,\n StyledNodeActions,\n StyledLabelContent,\n StyledNodeIcon,\n StyledNodeText\n} from './StandardTree.styles';\nimport type { TreeProps } from './Tree';\nimport type {\n StandardTreeContextProps,\n StandardTreeNode,\n StandardTreeProps,\n StandardTreePropsWithDefaults\n} from './StandardTree.types';\nimport helpers from './helpers';\n\nconst StandardTreeContext = createContext<\n Pick<\n StandardTreePropsWithDefaults,\n | 'currentNodeId'\n | 'lined'\n | 'onNodeClick'\n | 'firstNodeId'\n | 'lastNodeId'\n | 'focusedNodeId'\n | 'changeFocusedNodeId'\n >\n>({\n currentNodeId: undefined,\n lined: false,\n onNodeClick: () => {},\n firstNodeId: undefined,\n lastNodeId: undefined,\n focusedNodeId: undefined,\n changeFocusedNodeId: () => {}\n});\n\nconst NodeRenderer: TreeProps<StandardTreeNode>['nodeRenderer'] = ({\n id,\n label,\n icon,\n depth,\n hasParentSibling,\n nodes,\n expanded = false,\n loading = false,\n subTree,\n actions,\n onClick\n}) => {\n const {\n currentNodeId,\n onNodeClick,\n lined,\n focusedNodeId,\n changeFocusedNodeId,\n firstNodeId,\n lastNodeId\n } = useContext(StandardTreeContext);\n const current = currentNodeId === id;\n const focusedEl = focusedNodeId === id;\n const firstNode = firstNodeId === id;\n const { start, end } = useDirection();\n const t = useI18n();\n\n const tabIndex = useMemo(() => {\n let index = -1;\n if (focusedNodeId) {\n index = focusedEl ? 0 : -1;\n } else if (currentNodeId) {\n index = current ? 0 : -1;\n } else {\n index = firstNode ? 0 : -1;\n }\n return index;\n }, [focusedNodeId, currentNodeId, current, focusedEl]);\n\n const handleToggleClick = useCallback(\n (e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => {\n onNodeClick?.(id, e);\n changeFocusedNodeId(id);\n },\n [id, onNodeClick, changeFocusedNodeId]\n );\n\n const onKeyDown = useCallback(\n (e: KeyboardEvent<HTMLElement>) => {\n if (['ArrowUp', 'ArrowDown', 'Enter', 'Home', 'End'].includes(e.key)) e.preventDefault();\n switch (e.key) {\n case 'ArrowUp':\n changeFocusedNodeId(id, 'up');\n break;\n case 'ArrowDown':\n changeFocusedNodeId(id, 'down');\n break;\n case `Arrow${cap(end)}`:\n if (nodes) {\n if (expanded) {\n changeFocusedNodeId(id, 'right');\n } else {\n handleToggleClick(e);\n }\n }\n break;\n case `Arrow${cap(start)}`:\n if (expanded) {\n handleToggleClick(e);\n } else {\n changeFocusedNodeId(id, 'left');\n }\n break;\n case 'Enter':\n if (onClick) {\n onClick(id, e);\n } else {\n handleToggleClick(e);\n }\n break;\n case 'Home':\n if (firstNodeId) changeFocusedNodeId(firstNodeId);\n break;\n case 'End':\n if (lastNodeId) changeFocusedNodeId(lastNodeId);\n break;\n default:\n }\n },\n [id, end, nodes, expanded, actions, firstNodeId, lastNodeId, changeFocusedNodeId]\n );\n\n const actionsJSX = useMemo(() => {\n return actions ? (\n // Wrapping in a div since Actions may render a frag of buttons and we need a wrapper for flex space-between.\n <StyledNodeActions>\n <Actions\n items={actions.map(action => {\n return {\n ...action,\n tabIndex: -1,\n onClick: (\n actionId: Action['id'],\n e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>\n ) => {\n e.stopPropagation();\n action?.onClick?.(actionId, e);\n }\n };\n })}\n menuAt={3}\n />\n </StyledNodeActions>\n ) : null;\n }, [actions]);\n\n const labelContent = useMemo(() => {\n const internal = (\n // Wrapping in a div for handling of flex space-between when there are node actions.\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as={StyledLabelContent}>\n {icon && <StyledNodeIcon name={icon} />}\n <StyledNodeText>{label}</StyledNodeText>\n </Flex>\n );\n\n return !nodes && (onClick ?? onNodeClick) ? (\n <Flex\n container={{ alignItems: 'center', justify: 'between', gap: 2 }}\n as={StyledNodeInteraction}\n role='treeitem'\n aria-current={current ? 'true' : undefined}\n tabIndex={tabIndex}\n onClick={(e: MouseEvent<HTMLElement>) => {\n onClick?.(id, e);\n onNodeClick?.(id, e);\n changeFocusedNodeId(id);\n }}\n onKeyDown={onKeyDown}\n ref={focusedEl ? (focusedRef: HTMLDivElement) => focusedRef?.focus() : undefined}\n >\n {internal}\n {actionsJSX}\n </Flex>\n ) : (\n internal\n );\n }, [\n id,\n label,\n icon,\n nodes,\n actions,\n onClick,\n onNodeClick,\n current,\n focusedEl,\n tabIndex,\n changeFocusedNodeId,\n onKeyDown\n ]);\n\n return (\n <StyledStandardTreeNode\n id={id}\n style={\n { '--depth': depth, '--has-parent-sibling': Number(hasParentSibling) } as CSSProperties\n }\n aria-busy={loading}\n >\n {nodes ? (\n <>\n <Flex\n container={{ alignItems: 'center', justify: 'between', gap: 2 }}\n as={StyledStandardTreeParent}\n role='treeitem'\n aria-current={current ? 'true' : undefined}\n tabIndex={tabIndex}\n variant='text'\n onClick={handleToggleClick}\n aria-expanded={expanded ? 'true' : 'false'}\n aria-label={t(expanded ? 'collapse_noun' : 'expand_noun', [label])}\n onKeyDown={onKeyDown}\n ref={focusedEl ? (focusedElRef: HTMLDivElement) => focusedElRef?.focus() : undefined}\n >\n <Flex container={{ alignItems: 'center', gap: 1 }} as='span'>\n <StyledToggleIcon name='caret-right' />\n {labelContent}\n </Flex>\n {actionsJSX}\n </Flex>\n <StyledStandardTreeItemSubTree lined={lined}>\n {subTree}\n {loading && <Progress variant='ring' placement='inline' />}\n </StyledStandardTreeItemSubTree>\n </>\n ) : (\n <StyledStandardTreeLeaf>{labelContent}</StyledStandardTreeLeaf>\n )}\n </StyledStandardTreeNode>\n );\n};\n\nconst StandardTreeWithNodes: FunctionComponent<StandardTreeProps & ForwardProps> = forwardRef(\n (\n {\n nodes,\n currentNodeId,\n onNodeClick,\n lined = false,\n ...restProps\n }: PropsWithoutRef<StandardTreeProps>,\n ref: StandardTreeProps['ref']\n ) => {\n const [focusedNodeId, setFocusedNodedId] = useState<string | undefined>();\n\n const lastNodeId = useMemo(() => {\n return helpers.getDeepestNode(nodes, nodes[nodes.length - 1].id)?.id;\n }, [nodes]);\n\n const changeFocusedNodeId: StandardTreeContextProps['changeFocusedNodeId'] = useCallback(\n (id, type) => {\n switch (type) {\n case 'up': {\n const previousNode = helpers.getPreviousNode(nodes, id);\n if (previousNode) setFocusedNodedId(previousNode.id);\n break;\n }\n case 'down': {\n const nextNode = helpers.getNextNode(nodes, id);\n if (nextNode) setFocusedNodedId(nextNode.id);\n break;\n }\n case 'left': {\n const parentNode = helpers.getParentNode(nodes, id);\n if (parentNode) setFocusedNodedId(parentNode.id);\n break;\n }\n case 'right': {\n const childNode = helpers.getFirstChildNode(nodes, id);\n if (childNode) setFocusedNodedId(childNode.id);\n break;\n }\n default:\n setFocusedNodedId(id);\n }\n },\n [nodes]\n );\n\n return (\n <StandardTreeContext.Provider\n value={useMemo(\n () => ({\n currentNodeId,\n focusedNodeId,\n lastNodeId,\n firstNodeId: nodes[0].id,\n changeFocusedNodeId,\n onNodeClick,\n lined\n }),\n [currentNodeId, onNodeClick, lined, focusedNodeId, lastNodeId]\n )}\n >\n {/* FIXME: Types are having issues when styled(Tree) is typeof Tree. */}\n <StyledStandardTree {...restProps} ref={ref} nodes={nodes} nodeRenderer={NodeRenderer} />\n </StandardTreeContext.Provider>\n );\n }\n);\n\nconst StandardTree: FunctionComponent<StandardTreeProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<StandardTreeProps>, ref: StandardTreeProps['ref']) => {\n return props.nodes.length > 0 ? <StandardTreeWithNodes {...props} ref={ref} /> : null;\n }\n);\n\nexport default StandardTree;\n"]}
|
|
1
|
+
{"version":3,"file":"StandardTree.js","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,OAAO,EACP,UAAU,EACV,WAAW,EACX,QAAQ,EAET,MAAM,OAAO,CAAC;AAGf,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,6BAA6B,EAC7B,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACf,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,MAAM,mBAAmB,GAAG,aAAa,CAYvC;IACA,aAAa,EAAE,SAAS;IACxB,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;IACrB,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC;IACtB,WAAW,EAAE,SAAS;IACtB,UAAU,EAAE,SAAS;IACrB,aAAa,EAAE,SAAS;IACxB,mBAAmB,EAAE,GAAG,EAAE,GAAE,CAAC;CAC9B,CAAC,CAAC;AAEH,MAAM,YAAY,GAAgD,CAAC,EACjE,EAAE,EACF,KAAK,EACL,IAAI,EACJ,KAAK,EACL,gBAAgB,EAChB,KAAK,EACL,QAAQ,GAAG,KAAK,EACh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CAAC;gBACvD,IAAI,SAAS;oBAAE,iBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;gBAC/C,MAAM;aACP;YACD;gBACE,iBAAiB,CAAC,EAAE,CAAC,CAAC;SACzB;IACH,CAAC,EACD,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,OAAO,CACL,KAAC,mBAAmB,CAAC,QAAQ,IAC3B,KAAK,EAAE,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;YACL,aAAa;YACb,aAAa;YACb,UAAU;YACV,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;YACxB,mBAAmB;YACnB,WAAW;YACX,YAAY;YACZ,KAAK;SACN,CAAC,EACF,CAAC,aAAa,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,CAAC,CAC7E,YAGD,KAAC,kBAAkB,OAAK,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,GAAI,GAC5D,CAChC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,YAAY,GAAwD,UAAU,CAClF,CAAC,KAAyC,EAAE,GAA6B,EAAE,EAAE;IAC3E,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAC,qBAAqB,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACxF,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n forwardRef,\n createContext,\n useMemo,\n useContext,\n useCallback,\n useState,\n KeyboardEvent\n} from 'react';\nimport type { FunctionComponent, PropsWithoutRef, CSSProperties, MouseEvent } from 'react';\n\nimport Progress from '../Progress';\nimport { useDirection } from '../../hooks';\nimport Flex from '../Flex';\nimport Button from '../Button';\nimport Actions from '../Actions';\nimport type { Action, ForwardProps } from '../../types';\nimport { cap } from '../../utils';\n\nimport {\n StyledStandardTreeParent,\n StyledToggleIcon,\n StyledStandardTreeItemSubTree,\n StyledStandardTreeLeaf,\n StyledStandardTree,\n StyledNodeInteraction,\n StyledStandardTreeNode,\n StyledNodeActions,\n StyledLabelContent,\n StyledNodeIcon,\n StyledNodeText\n} from './StandardTree.styles';\nimport type { TreeProps } from './Tree';\nimport type {\n StandardTreeContextProps,\n StandardTreeNode,\n StandardTreeProps,\n StandardTreePropsWithDefaults\n} from './StandardTree.types';\nimport helpers from './helpers';\n\nconst StandardTreeContext = createContext<\n Pick<\n StandardTreePropsWithDefaults,\n | 'currentNodeId'\n | 'lined'\n | 'onNodeClick'\n | 'onNodeToggle'\n | 'firstNodeId'\n | 'lastNodeId'\n | 'focusedNodeId'\n | 'changeFocusedNodeId'\n >\n>({\n currentNodeId: undefined,\n lined: false,\n onNodeClick: () => {},\n onNodeToggle: () => {},\n firstNodeId: undefined,\n lastNodeId: undefined,\n focusedNodeId: undefined,\n changeFocusedNodeId: () => {}\n});\n\nconst NodeRenderer: TreeProps<StandardTreeNode>['nodeRenderer'] = ({\n id,\n label,\n icon,\n depth,\n hasParentSibling,\n nodes,\n expanded = false,\n loading = false,\n subTree,\n actions,\n onClick\n}) => {\n const {\n currentNodeId,\n onNodeClick,\n onNodeToggle,\n lined,\n focusedNodeId,\n changeFocusedNodeId,\n firstNodeId,\n lastNodeId\n } = useContext(StandardTreeContext);\n const current = currentNodeId === id;\n const focusedEl = focusedNodeId === id;\n const firstNode = firstNodeId === id;\n const { start, end } = useDirection();\n\n const tabIndex = useMemo(() => {\n let index = -1;\n if (focusedNodeId) {\n index = focusedEl ? 0 : -1;\n } else if (currentNodeId) {\n index = current ? 0 : -1;\n } else {\n index = firstNode ? 0 : -1;\n }\n return index;\n }, [focusedNodeId, currentNodeId, current, focusedEl]);\n\n const handleToggleClick = useCallback(\n (e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => {\n onNodeClick?.(id, e);\n changeFocusedNodeId(id);\n },\n [id, onNodeClick, changeFocusedNodeId]\n );\n\n const onKeyDown = useCallback(\n (e: KeyboardEvent<HTMLElement>) => {\n if (['ArrowUp', 'ArrowDown', 'Enter', 'Home', 'End'].includes(e.key)) e.preventDefault();\n switch (e.key) {\n case 'ArrowUp':\n changeFocusedNodeId(id, 'up');\n break;\n case 'ArrowDown':\n changeFocusedNodeId(id, 'down');\n break;\n case `Arrow${cap(end)}`:\n if (nodes) {\n if (expanded) {\n changeFocusedNodeId(id, 'right');\n } else {\n onNodeToggle?.(id);\n }\n }\n break;\n case `Arrow${cap(start)}`:\n if (expanded) {\n onNodeToggle?.(id);\n } else {\n changeFocusedNodeId(id, 'left');\n }\n break;\n case 'Enter':\n if (onClick) {\n onClick(id, e);\n } else {\n handleToggleClick(e);\n }\n break;\n case 'Home':\n if (firstNodeId) changeFocusedNodeId(firstNodeId);\n break;\n case 'End':\n if (lastNodeId) changeFocusedNodeId(lastNodeId);\n break;\n default:\n }\n },\n [id, end, nodes, expanded, actions, firstNodeId, lastNodeId, changeFocusedNodeId]\n );\n\n const actionsJSX = useMemo(() => {\n // since Actions may render a frag of buttons and we need a wrapper for flex space-between.\n return actions ? (\n <StyledNodeActions>\n <Actions\n items={actions.map(action => {\n return {\n ...action,\n onClick: (\n actionId: Action['id'],\n e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>\n ) => {\n e.stopPropagation();\n action?.onClick?.(actionId, e);\n }\n };\n })}\n menuAt={3}\n menuButtonProps={{\n onClick: (e: MouseEvent) => e.stopPropagation(),\n onKeyDown: (e: KeyboardEvent) => {\n e.stopPropagation();\n if (['ArrowUp', 'ArrowDown'].includes(e.key)) {\n e.preventDefault();\n }\n }\n }}\n />\n </StyledNodeActions>\n ) : null;\n }, [actions]);\n\n const labelContent = useMemo(() => {\n const internal = (\n // Wrapping in a div for handling of flex space-between when there are node actions.\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as={StyledLabelContent}>\n {icon && <StyledNodeIcon name={icon} />}\n <StyledNodeText>{label}</StyledNodeText>\n </Flex>\n );\n\n return !nodes && (onClick ?? onNodeClick) ? (\n <Flex\n container={{ alignItems: 'center', justify: 'between', gap: 2 }}\n as={StyledNodeInteraction}\n role='treeitem'\n aria-current={current ? 'true' : undefined}\n tabIndex={tabIndex}\n onClick={(e: MouseEvent<HTMLElement>) => {\n onClick?.(id, e);\n onNodeClick?.(id, e);\n changeFocusedNodeId(id);\n }}\n onKeyDown={onKeyDown}\n ref={focusedEl ? (focusedRef: HTMLDivElement) => focusedRef?.focus() : undefined}\n >\n {internal}\n {actionsJSX}\n </Flex>\n ) : (\n internal\n );\n }, [\n id,\n label,\n icon,\n nodes,\n actions,\n onClick,\n onNodeClick,\n current,\n focusedEl,\n tabIndex,\n changeFocusedNodeId,\n onKeyDown\n ]);\n\n return (\n <StyledStandardTreeNode\n id={id}\n style={\n { '--depth': depth, '--has-parent-sibling': Number(hasParentSibling) } as CSSProperties\n }\n aria-busy={loading}\n >\n {nodes ? (\n <>\n <Flex\n container={{ alignItems: 'center', justify: 'between', gap: 2 }}\n as={StyledStandardTreeParent}\n role='treeitem'\n aria-current={current ? 'true' : undefined}\n tabIndex={tabIndex}\n variant='text'\n onClick={handleToggleClick}\n aria-expanded={expanded ? 'true' : 'false'}\n aria-label={label}\n onKeyDown={onKeyDown}\n ref={focusedEl ? (focusedElRef: HTMLDivElement) => focusedElRef?.focus() : undefined}\n >\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as='span'>\n <Button\n variant='simple'\n icon\n compact\n onClick={(e: MouseEvent<HTMLElement>) => {\n if (onNodeToggle) {\n e.stopPropagation();\n onNodeToggle(id, e);\n changeFocusedNodeId(id);\n }\n }}\n >\n <StyledToggleIcon name='caret-right' />\n </Button>\n {labelContent}\n </Flex>\n {actionsJSX}\n </Flex>\n <StyledStandardTreeItemSubTree lined={lined}>\n {subTree}\n {loading && <Progress variant='ring' placement='inline' />}\n </StyledStandardTreeItemSubTree>\n </>\n ) : (\n <StyledStandardTreeLeaf>{labelContent}</StyledStandardTreeLeaf>\n )}\n </StyledStandardTreeNode>\n );\n};\n\nconst StandardTreeWithNodes: FunctionComponent<StandardTreeProps & ForwardProps> = forwardRef(\n (\n {\n nodes,\n currentNodeId,\n onNodeClick,\n onNodeToggle,\n lined = false,\n ...restProps\n }: PropsWithoutRef<StandardTreeProps>,\n ref: StandardTreeProps['ref']\n ) => {\n const [focusedNodeId, setFocusedNodedId] = useState<string | undefined>();\n\n const lastNodeId = useMemo(() => {\n return helpers.getDeepestNode(nodes, nodes[nodes.length - 1].id)?.id;\n }, [nodes]);\n\n const changeFocusedNodeId: StandardTreeContextProps['changeFocusedNodeId'] = useCallback(\n (id, type) => {\n switch (type) {\n case 'up': {\n const previousNode = helpers.getPreviousNode(nodes, id);\n if (previousNode) setFocusedNodedId(previousNode.id);\n break;\n }\n case 'down': {\n const nextNode = helpers.getNextNode(nodes, id);\n if (nextNode) setFocusedNodedId(nextNode.id);\n break;\n }\n case 'left': {\n const parentNode = helpers.getParentNode(nodes, id);\n if (parentNode) setFocusedNodedId(parentNode.id);\n break;\n }\n case 'right': {\n const childNode = helpers.getFirstChildNode(nodes, id);\n if (childNode) setFocusedNodedId(childNode.id);\n break;\n }\n default:\n setFocusedNodedId(id);\n }\n },\n [nodes]\n );\n\n return (\n <StandardTreeContext.Provider\n value={useMemo(\n () => ({\n currentNodeId,\n focusedNodeId,\n lastNodeId,\n firstNodeId: nodes[0].id,\n changeFocusedNodeId,\n onNodeClick,\n onNodeToggle,\n lined\n }),\n [currentNodeId, onNodeClick, lined, focusedNodeId, lastNodeId, onNodeToggle]\n )}\n >\n {/* FIXME: Types are having issues when styled(Tree) is typeof Tree. */}\n <StyledStandardTree {...restProps} ref={ref} nodes={nodes} nodeRenderer={NodeRenderer} />\n </StandardTreeContext.Provider>\n );\n }\n);\n\nconst StandardTree: FunctionComponent<StandardTreeProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<StandardTreeProps>, ref: StandardTreeProps['ref']) => {\n return props.nodes.length > 0 ? <StandardTreeWithNodes {...props} ref={ref} /> : null;\n }\n);\n\nexport default StandardTree;\n"]}
|
|
@@ -50,7 +50,7 @@ export const StyledNodeInteraction = styled.div(({ theme }) => {
|
|
|
50
50
|
*/
|
|
51
51
|
min-height: 2.25rem;
|
|
52
52
|
padding-inline-start: calc(var(--parent-caret-width) * var(--depth) + var(--initial-padding));
|
|
53
|
-
padding-inline-end: var(--initial-padding);
|
|
53
|
+
padding-inline-end: calc(var(--initial-padding) + ${theme.base.spacing});
|
|
54
54
|
cursor: pointer;
|
|
55
55
|
|
|
56
56
|
& > ${StyledNodeActions} {
|
|
@@ -95,7 +95,7 @@ export const StyledStandardTreeLeaf = styled.div(() => {
|
|
|
95
95
|
return css `
|
|
96
96
|
${StyledNodeInteraction} {
|
|
97
97
|
/* 1 when not at root and no parent sibling, 0 otherwise. */
|
|
98
|
-
--include-parent-icon-width: min((1 - var(--has-parent-sibling)), var(--depth));
|
|
98
|
+
--include-parent-icon-width: min((1.5 - var(--has-parent-sibling)), (var(--depth) + 0.5));
|
|
99
99
|
padding-inline-start: calc(
|
|
100
100
|
var(--initial-padding) +
|
|
101
101
|
(var(--parent-caret-width) * (var(--depth) + var(--has-parent-sibling))) +
|
|
@@ -135,7 +135,7 @@ export const StyledStandardTreeParent = styled(StyledNodeInteraction)(({ theme }
|
|
|
135
135
|
});
|
|
136
136
|
StyledStandardTreeParent.defaultProps = defaultThemeProp;
|
|
137
137
|
export const StyledStandardTreeNode = styled.div(({ theme }) => css `
|
|
138
|
-
--initial-padding: calc(${theme.base.spacing} *
|
|
138
|
+
--initial-padding: calc(${theme.base.spacing} * 1);
|
|
139
139
|
--parent-caret-width: calc(1em + ${theme.base.spacing});
|
|
140
140
|
--parent-icon-width: calc(1em + ${theme.base.spacing} / 2);
|
|
141
141
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardTree.styles.js","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.styles.ts"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-components';\nimport { transparentize } from 'polished';\n\nimport { StyledButton } from '../Button';\nimport Icon, { StyledIcon } from '../Icon';\nimport { StyledProgressRing } from '../Progress';\nimport { defaultThemeProp } from '../../theme';\nimport { useDirection } from '../../hooks';\n\nimport Tree, { StyledTreeListItem } from './Tree';\nimport { StandardTreePropsWithDefaults } from './StandardTree.types';\n\nexport const StyledToggleIcon = styled(Icon)``;\n\nexport const StyledNodeActions = styled.div``;\n\nexport const StyledLabelContent = styled.div``;\n\nexport const StyledNodeIcon = styled(Icon)``;\n\nexport const StyledNodeText = styled.span``;\n\nexport const StyledStandardTreeItemSubTree = styled.div<\n Pick<StandardTreePropsWithDefaults, 'lined'>\n>(({ theme, lined }) => {\n return css`\n position: relative;\n\n ${lined &&\n css`\n ::before {\n content: '';\n display: block;\n position: absolute;\n background-color: currentColor;\n inset-block-start: -${theme.base.spacing};\n inset-block-end: 0;\n inset-inline-start: calc(\n 0.5em * (var(--depth) + 1) + (${theme.base.spacing} * var(--depth) + 0.5em * var(--depth)) +\n ${theme.base.spacing} * 1.5\n );\n width: 0.0625rem;\n opacity: 0.2;\n transition: opacity ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n }\n `}\n\n ${StyledProgressRing} {\n margin: calc(${theme.base.spacing} * 1.25) 0;\n margin-inline-start: calc(\n var(--parent-caret-width) * (var(--depth) + 1) + var(--initial-padding)\n );\n }\n `;\n});\n\nStyledStandardTreeItemSubTree.defaultProps = defaultThemeProp;\n\nexport const StyledNodeInteraction = styled.div(({ theme }) => {\n return css`\n /* Could put on Flex pad prop but, needing logical prop below, maybe makes sense to keep here.\n * We should fix Flex/Grid pad arrays to map to logical props...\n */\n min-height: 2.25rem;\n padding-inline-start: calc(var(--parent-caret-width) * var(--depth) + var(--initial-padding));\n padding-inline-end: calc(var(--initial-padding) + ${theme.base.spacing});\n cursor: pointer;\n\n & > ${StyledNodeActions} {\n display: none;\n ${StyledButton} {\n margin-inline-start: calc(${theme.base.spacing} / 2);\n }\n }\n\n &:focus,\n &:focus-within {\n box-shadow: ${theme.base.shadow.focus};\n\n & > ${StyledNodeActions} {\n display: block;\n }\n }\n\n &:focus-visible {\n outline: none;\n }\n\n &:hover {\n background-color: ${transparentize(0.9, theme.base.palette['foreground-color'])};\n\n & > ${StyledNodeActions} {\n display: block;\n }\n }\n\n &[aria-current='true'] {\n background-color: ${transparentize(0.95, theme.base.palette['foreground-color'])};\n\n & > ${StyledLabelContent}, & > :first-child > ${StyledLabelContent} {\n color: ${theme.base.palette.interactive};\n }\n }\n `;\n});\n\nStyledNodeInteraction.defaultProps = defaultThemeProp;\n\nexport const StyledStandardTreeLeaf = styled.div(() => {\n return css`\n ${StyledNodeInteraction} {\n /* 1 when not at root and no parent sibling, 0 otherwise. */\n --include-parent-icon-width: min((1.5 - var(--has-parent-sibling)), (var(--depth) + 0.5));\n padding-inline-start: calc(\n var(--initial-padding) +\n (var(--parent-caret-width) * (var(--depth) + var(--has-parent-sibling))) +\n (var(--parent-icon-width) * var(--include-parent-icon-width))\n );\n }\n `;\n});\n\nStyledStandardTreeLeaf.defaultProps = defaultThemeProp;\n\n// FIXME: any is used since typeof StyledNodeInteraction not playing nicely.\nexport const StyledStandardTreeParent: any = styled(StyledNodeInteraction)(({ theme }) => {\n const { ltr } = useDirection();\n\n return css`\n &[aria-expanded='true'] ${StyledToggleIcon} {\n transform: rotate(90deg);\n }\n\n &[aria-expanded='false'] {\n ${StyledToggleIcon} {\n transform: rotate(${ltr ? '0' : '180'}deg);\n }\n\n + ${StyledStandardTreeItemSubTree} {\n display: none;\n }\n }\n\n &:hover + ${StyledStandardTreeItemSubTree}::before {\n opacity: 0.5;\n }\n\n ${StyledToggleIcon} {\n transition: transform calc(${theme.base.animation.speed} / 2)\n ${theme.base.animation.timing.ease};\n }\n `;\n});\n\nStyledStandardTreeParent.defaultProps = defaultThemeProp;\n\nexport const StyledStandardTreeNode = styled.div(\n ({ theme }) => css`\n --initial-padding: calc(${theme.base.spacing} * 1);\n --parent-caret-width: calc(1em + ${theme.base.spacing});\n --parent-icon-width: calc(1em + ${theme.base.spacing} / 2);\n\n ${StyledIcon} {\n width: 1em;\n height: 1em;\n }\n `\n);\n\nStyledStandardTreeNode.defaultProps = defaultThemeProp;\n\nexport const StyledStandardTree = styled(Tree)`\n ${StyledTreeListItem} {\n display: block;\n }\n`;\n// FIXME: We need to determine why styled-component types are \"eating\" our types.\n(StyledStandardTree as typeof Tree & { defaultProps: object }).defaultProps = defaultThemeProp;\n"]}
|
|
@@ -14,6 +14,7 @@ export interface StandardTreeProps extends TreeProps<StandardTreeNode> {
|
|
|
14
14
|
currentNodeId?: TreeNode['id'];
|
|
15
15
|
lined?: boolean;
|
|
16
16
|
onNodeClick?: (id: TreeNode['id'], e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
|
|
17
|
+
onNodeToggle?: (id: TreeNode['id'], e?: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
|
|
17
18
|
}
|
|
18
19
|
export interface StandardTreeContextProps extends StandardTreeProps {
|
|
19
20
|
firstNodeId?: TreeNode['id'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardTree.types.d.ts","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElD,MAAM,WAAW,gBAAiB,SAAQ,QAAQ;IAChD,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAA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AAG,MAAM,GAAG,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CAC5F;AAED,oBAAY,6BAA6B,GAAG,iBAAiB,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardTree.types.js","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MouseEvent, KeyboardEvent } from 'react';\n\nimport type { Action, PropsWithDefaults } from '../../types';\n\nimport type { TreeProps, TreeNode } from './Tree';\n\nexport interface StandardTreeNode extends TreeNode {\n nodes?: StandardTreeNode[];\n label: string;\n icon?: string;\n expanded?: boolean;\n loading?: boolean;\n actions?: Action[];\n onClick?: (id: TreeNode['id'], e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;\n}\n\nexport interface StandardTreeProps extends TreeProps<StandardTreeNode> {\n currentNodeId?: TreeNode['id'];\n lined?: boolean;\n onNodeClick?: (\n id: TreeNode['id'],\n e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>\n ) => void;\n}\n\nexport interface StandardTreeContextProps extends StandardTreeProps {\n firstNodeId?: TreeNode['id'];\n lastNodeId?: TreeNode['id'];\n focusedNodeId?: TreeNode['id'];\n changeFocusedNodeId: (id: TreeNode['id'], type?: 'up' | 'down' | 'left' | 'right') => void;\n}\n\nexport type StandardTreePropsWithDefaults = PropsWithDefaults<StandardTreeContextProps, 'lined'>;\n"]}
|
|
1
|
+
{"version":3,"file":"StandardTree.types.js","sourceRoot":"","sources":["../../../src/components/Tree/StandardTree.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MouseEvent, KeyboardEvent } from 'react';\n\nimport type { Action, PropsWithDefaults } from '../../types';\n\nimport type { TreeProps, TreeNode } from './Tree';\n\nexport interface StandardTreeNode extends TreeNode {\n nodes?: StandardTreeNode[];\n label: string;\n icon?: string;\n expanded?: boolean;\n loading?: boolean;\n actions?: Action[];\n onClick?: (id: TreeNode['id'], e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;\n}\n\nexport interface StandardTreeProps extends TreeProps<StandardTreeNode> {\n currentNodeId?: TreeNode['id'];\n lined?: boolean;\n onNodeClick?: (\n id: TreeNode['id'],\n e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>\n ) => void;\n onNodeToggle?: (\n id: TreeNode['id'],\n e?: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>\n ) => void;\n}\n\nexport interface StandardTreeContextProps extends StandardTreeProps {\n firstNodeId?: TreeNode['id'];\n lastNodeId?: TreeNode['id'];\n focusedNodeId?: TreeNode['id'];\n changeFocusedNodeId: (id: TreeNode['id'], type?: 'up' | 'down' | 'left' | 'right') => void;\n}\n\nexport type StandardTreePropsWithDefaults = PropsWithDefaults<StandardTreeContextProps, 'lined'>;\n"]}
|
package/lib/hooks/useI18n.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
13
13
|
select_placeholder_default: string;
|
|
14
14
|
description: string;
|
|
15
15
|
all: string;
|
|
16
|
+
default: string;
|
|
17
|
+
app_default: string;
|
|
16
18
|
remove: string;
|
|
17
19
|
follow: string;
|
|
18
20
|
unfollow: string;
|
|
@@ -402,6 +404,7 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
402
404
|
call_panel_new_call_heading: string;
|
|
403
405
|
call_panel_interaction_transfer_heading: string;
|
|
404
406
|
call_panel_interaction_transfer_complete_button_label: string;
|
|
407
|
+
call_panel_incoming_call: string;
|
|
405
408
|
call_panel_conference_heading: string;
|
|
406
409
|
call_panel_consult_with_call_heading: string;
|
|
407
410
|
call_panel_consult_with_call_and_interactions_heading: string;
|
|
@@ -416,6 +419,7 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
416
419
|
call_panel_handover_call_option_label: string;
|
|
417
420
|
call_panel_handover_call_only_option: string;
|
|
418
421
|
call_panel_handover_call_and_interaction_option: string;
|
|
422
|
+
call_panel_handover_interaction_label: string;
|
|
419
423
|
call_panel_merge_call_menu_item: string;
|
|
420
424
|
call_panel_handoff_call_menu_item: string;
|
|
421
425
|
call_panel_send_dtmf_heading: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,QAAA,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/lib/i18n/default.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ declare const _default: {
|
|
|
9
9
|
select_placeholder_default: string;
|
|
10
10
|
description: string;
|
|
11
11
|
all: string;
|
|
12
|
+
default: string;
|
|
13
|
+
app_default: string;
|
|
12
14
|
remove: string;
|
|
13
15
|
follow: string;
|
|
14
16
|
unfollow: string;
|
|
@@ -398,6 +400,7 @@ declare const _default: {
|
|
|
398
400
|
call_panel_new_call_heading: string;
|
|
399
401
|
call_panel_interaction_transfer_heading: string;
|
|
400
402
|
call_panel_interaction_transfer_complete_button_label: string;
|
|
403
|
+
call_panel_incoming_call: string;
|
|
401
404
|
call_panel_conference_heading: string;
|
|
402
405
|
call_panel_consult_with_call_heading: string;
|
|
403
406
|
call_panel_consult_with_call_and_interactions_heading: string;
|
|
@@ -412,6 +415,7 @@ declare const _default: {
|
|
|
412
415
|
call_panel_handover_call_option_label: string;
|
|
413
416
|
call_panel_handover_call_only_option: string;
|
|
414
417
|
call_panel_handover_call_and_interaction_option: string;
|
|
418
|
+
call_panel_handover_interaction_label: string;
|
|
415
419
|
call_panel_merge_call_menu_item: string;
|
|
416
420
|
call_panel_handoff_call_menu_item: string;
|
|
417
421
|
call_panel_send_dtmf_heading: 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,wBA22BE"}
|
package/lib/i18n/default.js
CHANGED
|
@@ -13,6 +13,8 @@ export default {
|
|
|
13
13
|
select_placeholder_default: 'Select…',
|
|
14
14
|
description: 'Description',
|
|
15
15
|
all: 'All',
|
|
16
|
+
default: 'default',
|
|
17
|
+
app_default: 'app default',
|
|
16
18
|
/* Verbs */
|
|
17
19
|
remove: 'Remove',
|
|
18
20
|
follow: 'Follow',
|
|
@@ -443,6 +445,7 @@ export default {
|
|
|
443
445
|
call_panel_new_call_heading: 'New call',
|
|
444
446
|
call_panel_interaction_transfer_heading: 'Interaction transfer has been initiated…',
|
|
445
447
|
call_panel_interaction_transfer_complete_button_label: 'Complete transfer',
|
|
448
|
+
call_panel_incoming_call: 'Incoming call…',
|
|
446
449
|
call_panel_conference_heading: 'Conference',
|
|
447
450
|
call_panel_consult_with_call_heading: 'Consult by call',
|
|
448
451
|
call_panel_consult_with_call_and_interactions_heading: 'Consult by call and interaction',
|
|
@@ -457,6 +460,7 @@ export default {
|
|
|
457
460
|
call_panel_handover_call_option_label: 'Call option',
|
|
458
461
|
call_panel_handover_call_only_option: 'Call only',
|
|
459
462
|
call_panel_handover_call_and_interaction_option: 'Call and interaction',
|
|
463
|
+
call_panel_handover_interaction_label: 'Interaction',
|
|
460
464
|
call_panel_merge_call_menu_item: 'Merge',
|
|
461
465
|
call_panel_handoff_call_menu_item: 'Hand off',
|
|
462
466
|
call_panel_send_dtmf_heading: 'Send DTMF',
|