@pega/cosmos-react-build 4.0.0-dev.7.0 → 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/AppShell/AppShell.d.ts +3 -2
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +41 -79
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +10 -15
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +153 -248
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +57 -30
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js +3 -5
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/AppShell/NavigationList.d.ts +6 -0
- package/lib/components/AppShell/NavigationList.d.ts.map +1 -0
- package/lib/components/AppShell/NavigationList.js +91 -0
- package/lib/components/AppShell/NavigationList.js.map +1 -0
- package/lib/components/AppShell/index.d.ts +1 -1
- package/lib/components/AppShell/index.d.ts.map +1 -1
- package/lib/components/AppShell/index.js.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +5 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +10 -3
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.js +10 -28
- package/lib/components/FlowModeller/Node/NodeTemplates.js.map +1 -1
- package/lib/components/MobileBuildSummary/MobileBuildSummary.d.ts +0 -1
- package/lib/components/MobileBuildSummary/MobileBuildSummary.d.ts.map +1 -1
- package/lib/components/MobileBuildSummary/MobileBuildSummary.js +5 -16
- package/lib/components/MobileBuildSummary/MobileBuildSummary.js.map +1 -1
- package/lib/components/MobileBuildSummary/MobileBuildSummary.types.d.ts +2 -0
- package/lib/components/MobileBuildSummary/MobileBuildSummary.types.d.ts.map +1 -1
- package/lib/components/MobileBuildSummary/MobileBuildSummary.types.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.types.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"","sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"AppShell.types.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"","sourcesContent":["import { KeyboardEvent, MouseEvent, ReactNode } from 'react';\n\nimport { AsProp, BaseProps, NoChildrenProp } from '@pega/cosmos-react-core';\nimport { openCloseStates } from '@pega/cosmos-react-core/lib/hooks/useTransitionState';\n\nimport { AppHeaderProps } from './Header/AppHeader.types';\n\nexport interface NestedNavItemProps {\n /** Unique id for the nav item. */\n id: string;\n /** The display text of the nav item. */\n label: string;\n /** URL or DOM id to navigate to. This will render the nav item as a link. */\n href?: string;\n /** Click handler for the nav item. */\n onClick?: (id: string, e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;\n /** A set of nested nav items. */\n items?: NestedNavItemProps[];\n}\n\ninterface ParentNavItemProps {\n /** A set of nested nav items. */\n items?: NestedNavItemProps[];\n href?: never;\n onClick?: never;\n}\n\ninterface NavLinkProps {\n /** URL or DOM id to navigate to. This will render the nav item as a link. */\n href?: string;\n /** Click handler for the link. If no href if passed, this will render the nav item as a button. */\n onClick?: (id: string, e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;\n items?: never;\n}\n\nexport type NavItemProps = {\n /** Unique id for the nav item. */\n id: string;\n /** The display text of the nav item. */\n label: string;\n /** The name of the Cosmos Icon to render as a visual. Only applies to top-level nav items. */\n icon: string;\n} & (ParentNavItemProps | NavLinkProps);\n\nexport interface NavProps {\n /** A set of nav items that will render as a list in the App Shell. */\n items: NavItemProps[];\n /** The id of the active nav item. */\n currentItemId?: NavItemProps['id'];\n}\n\nexport interface AppShellProps extends NoChildrenProp {\n /** The content of the application. */\n main: ReactNode;\n /** Props related to the App Shell header. */\n appHeader: AppHeaderProps;\n /** Props related to the App Shell side navigation. */\n nav: NavProps;\n}\n\nexport interface AppShellContextValue {\n navOpen: boolean;\n navState: typeof openCloseStates[keyof typeof openCloseStates];\n openNav: () => void;\n}\n\nexport interface NavItemRenderProps extends AsProp, BaseProps, NoChildrenProp {\n id: NavItemProps['id'];\n label: NavItemProps['label'];\n visual: ReactNode;\n href?: NavLinkProps['href'];\n onClick?: NavLinkProps['onClick'];\n items?: NestedNavItemProps['items'];\n currentItemId?: NavItemProps['id'];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShellContext.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShellContext.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,QAAA,MAAM,eAAe,+
|
|
1
|
+
{"version":3,"file":"AppShellContext.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShellContext.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,QAAA,MAAM,eAAe,+CAInB,CAAC;AAEH,eAAe,eAAe,CAAC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
const AppShellContext = createContext({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
setDrawerData: () => { },
|
|
7
|
-
navState: 'expanded'
|
|
3
|
+
navOpen: false,
|
|
4
|
+
navState: 'closed',
|
|
5
|
+
openNav: () => { }
|
|
8
6
|
});
|
|
9
7
|
export default AppShellContext;
|
|
10
8
|
//# sourceMappingURL=AppShellContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShellContext.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShellContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,MAAM,eAAe,GAAG,aAAa,CAAuB;IAC1D,
|
|
1
|
+
{"version":3,"file":"AppShellContext.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShellContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,MAAM,eAAe,GAAG,aAAa,CAAuB;IAC1D,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,QAAQ;IAClB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;CAClB,CAAC,CAAC;AAEH,eAAe,eAAe,CAAC","sourcesContent":["import { createContext } from 'react';\n\nimport { AppShellContextValue } from './AppShell.types';\n\nconst AppShellContext = createContext<AppShellContextValue>({\n navOpen: false,\n navState: 'closed',\n openNav: () => {}\n});\n\nexport default AppShellContext;\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { NavProps, NavItemRenderProps } from './AppShell.types';
|
|
3
|
+
export declare const NavLinkItem: FunctionComponent<NavItemRenderProps>;
|
|
4
|
+
declare const NavigationList: FunctionComponent<NavProps>;
|
|
5
|
+
export default NavigationList;
|
|
6
|
+
//# sourceMappingURL=NavigationList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationList.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAkBf,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AA2HhE,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,kBAAkB,CAgC7D,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,QAAQ,CA6B/C,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { useTheme, useEscape, useDirection, Icon, Tooltip, ExpandCollapse, useElement, StandardTree, treeHelpers, useAfterInitialEffect } from '@pega/cosmos-react-core';
|
|
4
|
+
import BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';
|
|
5
|
+
import { StyledNavList, StyledAppShellCaretIcon, StyledNavListItem } from './AppShell.styles';
|
|
6
|
+
import AppShellContext from './AppShellContext';
|
|
7
|
+
const transformItems = (items, expandedIds) => {
|
|
8
|
+
if (!items)
|
|
9
|
+
return [];
|
|
10
|
+
return items.map(item => ({
|
|
11
|
+
id: item.id,
|
|
12
|
+
label: item.label,
|
|
13
|
+
onClick: (id, e) => {
|
|
14
|
+
e.stopPropagation();
|
|
15
|
+
item.onClick?.(id, e);
|
|
16
|
+
},
|
|
17
|
+
expanded: item.items ? expandedIds.has(item.id) : undefined,
|
|
18
|
+
href: item.href,
|
|
19
|
+
nodes: item.items ? transformItems(item.items, expandedIds) : undefined
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
const NavParentItem = ({ id, label, visual, items, currentItemId }) => {
|
|
23
|
+
const { navOpen, navState, openNav } = useContext(AppShellContext);
|
|
24
|
+
const { end } = useDirection();
|
|
25
|
+
const { base: { animation } } = useTheme();
|
|
26
|
+
const [collapsed, setCollapsed] = useState(true);
|
|
27
|
+
const [managedItems, setManagedItems] = useState(() => transformItems(items, new Set()));
|
|
28
|
+
const buttonRef = useRef(null);
|
|
29
|
+
const treeRef = useRef(null);
|
|
30
|
+
const toggleCollapsed = (e) => {
|
|
31
|
+
e.stopPropagation();
|
|
32
|
+
if (!navOpen) {
|
|
33
|
+
setCollapsed(false);
|
|
34
|
+
openNav();
|
|
35
|
+
}
|
|
36
|
+
else
|
|
37
|
+
setCollapsed(state => !state);
|
|
38
|
+
};
|
|
39
|
+
useEscape(() => {
|
|
40
|
+
setCollapsed(true);
|
|
41
|
+
buttonRef.current?.focus();
|
|
42
|
+
}, treeRef);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (currentItemId && treeHelpers.getNode(managedItems, currentItemId)) {
|
|
45
|
+
setManagedItems(nodes => treeHelpers.expandTo(nodes, currentItemId));
|
|
46
|
+
setCollapsed(false);
|
|
47
|
+
}
|
|
48
|
+
}, []);
|
|
49
|
+
useAfterInitialEffect(() => {
|
|
50
|
+
setManagedItems(cur => {
|
|
51
|
+
const expandedIds = new Set();
|
|
52
|
+
treeHelpers.forEachNode(cur, node => {
|
|
53
|
+
if (node.expanded)
|
|
54
|
+
expandedIds.add(node.id);
|
|
55
|
+
});
|
|
56
|
+
return transformItems(items, expandedIds);
|
|
57
|
+
});
|
|
58
|
+
}, [items]);
|
|
59
|
+
return (_jsxs(_Fragment, { children: [_jsxs(BareButton, { id: id, ref: buttonRef, "aria-expanded": !collapsed, "aria-controls": `${id}-tree`, "aria-label": label, onClick: toggleCollapsed, children: [visual, _jsx("span", { children: label }), navState === 'open' && (_jsx(Icon, { name: `caret-${end}`, as: StyledAppShellCaretIcon, nestedListCollapsed: collapsed }))] }), _jsx(ExpandCollapse, { id: `${id}-tree`, collapsed: collapsed || !navOpen, transitionSpeed: managedItems.length >= 10 ? `calc(2 * ${animation.speed})` : animation.speed, children: _jsx(StandardTree, { ref: treeRef, nodes: managedItems, currentNodeId: currentItemId, selectableParents: false, onNodeToggle: nodeId => {
|
|
60
|
+
setManagedItems(nodes => treeHelpers.mapNode(nodes, nodeId, node => {
|
|
61
|
+
return {
|
|
62
|
+
...node,
|
|
63
|
+
expanded: !node.expanded
|
|
64
|
+
};
|
|
65
|
+
}));
|
|
66
|
+
} }) })] }));
|
|
67
|
+
};
|
|
68
|
+
export const NavLinkItem = ({ id, label, visual, href, onClick }) => {
|
|
69
|
+
const { navOpen } = useContext(AppShellContext);
|
|
70
|
+
const { end } = useDirection();
|
|
71
|
+
const [listItemEl, setListItemEl] = useElement();
|
|
72
|
+
return (_jsxs(_Fragment, { children: [_jsxs(BareButton, { ref: setListItemEl, href: href, onClick: (e) => {
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
onClick?.(id, e);
|
|
75
|
+
}, "aria-label": label, children: [visual, _jsx("span", { children: label })] }), !navOpen && (_jsx(Tooltip, { target: listItemEl, placement: end, showDelay: 'none', hideDelay: 'none', children: label }))] }));
|
|
76
|
+
};
|
|
77
|
+
const NavigationList = ({ items, currentItemId }) => {
|
|
78
|
+
let ItemComponent;
|
|
79
|
+
return (_jsx(StyledNavList, { children: items.map(item => {
|
|
80
|
+
if (item.items) {
|
|
81
|
+
ItemComponent = NavParentItem;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
ItemComponent = NavLinkItem;
|
|
85
|
+
}
|
|
86
|
+
const ariaCurrent = item.href ? 'page' : 'true';
|
|
87
|
+
return (_jsx(StyledNavListItem, { "aria-current": currentItemId === item.id ? ariaCurrent : undefined, id: item.id, children: _jsx(ItemComponent, { ...item, visual: _jsx(Icon, { name: item.icon }), currentItemId: currentItemId }) }, item.id));
|
|
88
|
+
}) }));
|
|
89
|
+
};
|
|
90
|
+
export default NavigationList;
|
|
91
|
+
//# sourceMappingURL=NavigationList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationList.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAKL,UAAU,EACV,SAAS,EACT,MAAM,EACN,Q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,CAAC;aAC/B;iBAAM;gBACL,aAAa,GAAG,WAAW,CAAC;aAC7B;YAED,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;YAChD,OAAO,CACL,KAAC,iBAAiB,oBACF,aAAa,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAEjE,EAAE,EAAE,IAAI,CAAC,EAAE,YAEX,KAAC,aAAa,OACR,IAAI,EACR,MAAM,EAAE,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI,EACjC,aAAa,EAAE,aAAa,GAC5B,IAPG,IAAI,CAAC,EAAE,CAQM,CACrB,CAAC;QACJ,CAAC,CAAC,GACY,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n ElementType,\n FunctionComponent,\n KeyboardEvent,\n MouseEvent,\n useContext,\n useEffect,\n useRef,\n useState\n} from 'react';\n\nimport {\n useTheme,\n useEscape,\n useDirection,\n Icon,\n Tooltip,\n ExpandCollapse,\n useElement,\n StandardTree,\n StandardTreeNode,\n StandardTreeProps,\n treeHelpers,\n useAfterInitialEffect\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nimport { NavProps, NavItemRenderProps } from './AppShell.types';\nimport { StyledNavList, StyledAppShellCaretIcon, StyledNavListItem } from './AppShell.styles';\nimport AppShellContext from './AppShellContext';\n\nconst transformItems = (\n items: NavItemRenderProps['items'],\n expandedIds: Set<StandardTreeNode['id']>\n): StandardTreeProps['nodes'] => {\n if (!items) return [];\n\n return items.map(item => ({\n id: item.id,\n label: item.label,\n onClick: (id: string, e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => {\n e.stopPropagation();\n item.onClick?.(id, e);\n },\n expanded: item.items ? expandedIds.has(item.id) : undefined,\n href: item.href,\n nodes: item.items ? transformItems(item.items, expandedIds) : undefined\n }));\n};\n\nconst NavParentItem: FunctionComponent<NavItemRenderProps> = ({\n id,\n label,\n visual,\n items,\n currentItemId\n}) => {\n const { navOpen, navState, openNav } = useContext(AppShellContext);\n const { end } = useDirection();\n const {\n base: { animation }\n } = useTheme();\n const [collapsed, setCollapsed] = useState(true);\n const [managedItems, setManagedItems] = useState<StandardTreeProps['nodes']>(() =>\n transformItems(items, new Set())\n );\n\n const buttonRef = useRef<HTMLButtonElement>(null);\n const treeRef = useRef<HTMLUListElement>(null);\n\n const toggleCollapsed = (e: MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n if (!navOpen) {\n setCollapsed(false);\n openNav();\n } else setCollapsed(state => !state);\n };\n\n useEscape(() => {\n setCollapsed(true);\n buttonRef.current?.focus();\n }, treeRef);\n\n useEffect(() => {\n if (currentItemId && treeHelpers.getNode(managedItems, currentItemId)) {\n setManagedItems(nodes => treeHelpers.expandTo(nodes, currentItemId));\n setCollapsed(false);\n }\n }, []);\n\n useAfterInitialEffect(() => {\n setManagedItems(cur => {\n const expandedIds = new Set<StandardTreeNode['id']>();\n\n treeHelpers.forEachNode(cur, node => {\n if (node.expanded) expandedIds.add(node.id);\n });\n\n return transformItems(items, expandedIds);\n });\n }, [items]);\n\n return (\n <>\n <BareButton\n id={id}\n ref={buttonRef}\n aria-expanded={!collapsed}\n aria-controls={`${id}-tree`}\n aria-label={label}\n onClick={toggleCollapsed}\n >\n {visual}\n <span>{label}</span>\n {navState === 'open' && (\n <Icon\n name={`caret-${end}`}\n as={StyledAppShellCaretIcon}\n nestedListCollapsed={collapsed}\n />\n )}\n </BareButton>\n <ExpandCollapse\n id={`${id}-tree`}\n collapsed={collapsed || !navOpen}\n transitionSpeed={\n managedItems.length >= 10 ? `calc(2 * ${animation.speed})` : animation.speed\n }\n >\n <StandardTree\n ref={treeRef}\n nodes={managedItems as StandardTreeNode[]}\n currentNodeId={currentItemId}\n selectableParents={false}\n onNodeToggle={nodeId => {\n setManagedItems(nodes =>\n treeHelpers.mapNode(nodes, nodeId, node => {\n return {\n ...node,\n expanded: !node.expanded\n };\n })\n );\n }}\n />\n </ExpandCollapse>\n </>\n );\n};\n\nexport const NavLinkItem: FunctionComponent<NavItemRenderProps> = ({\n id,\n label,\n visual,\n href,\n onClick\n}) => {\n const { navOpen } = useContext(AppShellContext);\n const { end } = useDirection();\n const [listItemEl, setListItemEl] = useElement<HTMLAnchorElement | HTMLButtonElement>();\n\n return (\n <>\n <BareButton\n ref={setListItemEl}\n href={href}\n onClick={(e: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {\n e.stopPropagation();\n onClick?.(id, e);\n }}\n aria-label={label}\n >\n {visual}\n <span>{label}</span>\n </BareButton>\n {!navOpen && (\n <Tooltip target={listItemEl} placement={end} showDelay='none' hideDelay='none'>\n {label}\n </Tooltip>\n )}\n </>\n );\n};\n\nconst NavigationList: FunctionComponent<NavProps> = ({ items, currentItemId }) => {\n let ItemComponent: ElementType;\n\n return (\n <StyledNavList>\n {items.map(item => {\n if (item.items) {\n ItemComponent = NavParentItem;\n } else {\n ItemComponent = NavLinkItem;\n }\n\n const ariaCurrent = item.href ? 'page' : 'true';\n return (\n <StyledNavListItem\n aria-current={currentItemId === item.id ? ariaCurrent : undefined}\n key={item.id}\n id={item.id}\n >\n <ItemComponent\n {...item}\n visual={<Icon name={item.icon} />}\n currentItemId={currentItemId}\n />\n </StyledNavListItem>\n );\n })}\n </StyledNavList>\n );\n};\n\nexport default NavigationList;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default } from './AppShell';
|
|
2
|
-
export { AppShellProps } from './AppShell.types';
|
|
2
|
+
export { AppShellProps, NavProps, NavItemProps, NestedNavItemProps } from './AppShell.types';
|
|
3
3
|
export { AppHeaderProps } from './Header/AppHeader.types';
|
|
4
4
|
export { BranchButtonProps } from './Header/BranchButton';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { default } from './AppShell';\nexport { AppShellProps } from './AppShell.types';\nexport { AppHeaderProps } from './Header/AppHeader.types';\nexport { BranchButtonProps } from './Header/BranchButton';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { default } from './AppShell';\nexport { AppShellProps, NavProps, NavItemProps, NestedNavItemProps } from './AppShell.types';\nexport { AppHeaderProps } from './Header/AppHeader.types';\nexport { BranchButtonProps } from './Header/BranchButton';\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { Icon } from '@pega/cosmos-react-core';
|
|
2
3
|
import { NodeType } from './Node.types';
|
|
3
4
|
export declare const StyledCircle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
4
5
|
export declare const StyledLabel: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").TextProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {
|
|
@@ -6,7 +7,9 @@ export declare const StyledLabel: import("styled-components").StyledComponent<im
|
|
|
6
7
|
}, never>;
|
|
7
8
|
export declare const StyledIcon: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
8
9
|
export declare const StyledNodeTemplateHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {}, never>;
|
|
9
|
-
export declare const StyledText: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").TextProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {
|
|
10
|
+
export declare const StyledText: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").TextProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {
|
|
11
|
+
error?: string | undefined;
|
|
12
|
+
}, never>;
|
|
10
13
|
export declare const StyledNodeTemplate: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").CardProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {
|
|
11
14
|
highlight: boolean;
|
|
12
15
|
}, never>;
|
|
@@ -15,4 +18,5 @@ export declare const StyledNodeTempleteContent: import("styled-components").Styl
|
|
|
15
18
|
export declare const StyledAdditionalData: import("styled-components").StyledComponent<"dl", import("styled-components").DefaultTheme, {}, never>;
|
|
16
19
|
export declare const StyledAdditionalDataItem: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
17
20
|
export declare const StyledTextWithEllipsis: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").TextProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
21
|
+
export declare const StyledErrorIcon: typeof Icon;
|
|
18
22
|
//# sourceMappingURL=NodeTemplate.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTemplate.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplate.styles.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"NodeTemplate.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplate.styles.ts"],"names":[],"mappings":";AAEA,OAAO,EAA4C,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEzF,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,YAAY,yGAYvB,CAAC;AAIH,eAAO,MAAM,WAAW;cAA4B,QAAQ;SAW1D,CAAC;AAIH,eAAO,MAAM,UAAU,yGAWrB,CAAC;AAIH,eAAO,MAAM,wBAAwB,4GAOnC,CAAC;AAIH,eAAO,MAAM,UAAU;YAA0B,MAAM,GAAG,SAAS;SAOjE,CAAC;AAIH,eAAO,MAAM,kBAAkB;eAA6B,OAAO;SAoCjE,CAAC;AAIH,eAAO,MAAM,wBAAwB,yOAOnC,CAAC;AAIH,eAAO,MAAM,yBAAyB,yGAapC,CAAC;AAIH,eAAO,MAAM,oBAAoB,wGAEhC,CAAC;AAEF,eAAO,MAAM,wBAAwB,yGAMnC,CAAC;AAIH,eAAO,MAAM,sBAAsB,mOAQjC,CAAC;AAIH,eAAO,MAAM,eAAe,EAAE,OAAO,IAKnC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
|
-
import { defaultThemeProp, Card, Text, CardFooter } from '@pega/cosmos-react-core';
|
|
2
|
+
import { defaultThemeProp, Card, Text, CardFooter, Icon } from '@pega/cosmos-react-core';
|
|
3
3
|
export const StyledCircle = styled.div(({ theme }) => {
|
|
4
4
|
return css `
|
|
5
5
|
height: 2rem;
|
|
@@ -49,12 +49,12 @@ export const StyledNodeTemplateHeader = styled.header(({ theme }) => {
|
|
|
49
49
|
`;
|
|
50
50
|
});
|
|
51
51
|
StyledNodeTemplateHeader.defaultProps = defaultThemeProp;
|
|
52
|
-
export const StyledText = styled(Text)(({ theme }) => {
|
|
52
|
+
export const StyledText = styled(Text)(({ error, theme }) => {
|
|
53
53
|
return css `
|
|
54
54
|
padding-inline-end: ${theme.base.spacing};
|
|
55
55
|
overflow: hidden;
|
|
56
56
|
text-overflow: ellipsis;
|
|
57
|
-
max-width:
|
|
57
|
+
max-width: ${error ? '20ch' : '23ch'};
|
|
58
58
|
`;
|
|
59
59
|
});
|
|
60
60
|
StyledText.defaultProps = defaultThemeProp;
|
|
@@ -141,4 +141,11 @@ export const StyledTextWithEllipsis = styled(Text)(() => {
|
|
|
141
141
|
`;
|
|
142
142
|
});
|
|
143
143
|
StyledTextWithEllipsis.defaultProps = defaultThemeProp;
|
|
144
|
+
export const StyledErrorIcon = styled(Icon)(({ theme }) => {
|
|
145
|
+
return css `
|
|
146
|
+
color: ${theme.base.palette.urgent};
|
|
147
|
+
margin-inline-end: ${theme.base.spacing};
|
|
148
|
+
`;
|
|
149
|
+
});
|
|
150
|
+
StyledErrorIcon.defaultProps = defaultThemeProp;
|
|
144
151
|
//# sourceMappingURL=NodeTemplate.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTemplate.styles.js","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplate.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"NodeTemplate.styles.js","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplate.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,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;GACxC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { defaultThemeProp, Card, Text, CardFooter, Icon } from '@pega/cosmos-react-core';\n\nimport { NodeType } from './Node.types';\n\nexport const StyledCircle = styled.div(({ theme }) => {\n return css`\n height: 2rem;\n width: 2rem;\n background: var(--bg-color);\n border-radius: 50%;\n align-self: center;\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledCircle.defaultProps = defaultThemeProp;\n\nexport const StyledLabel = styled(Text)<{ nodeType: NodeType }>(({ nodeType, theme }) => {\n return css`\n align-self: center;\n ${nodeType.name === 'start'\n ? css`\n padding-block-end: ${theme.base.spacing};\n `\n : css`\n padding-block-start: ${theme.base.spacing};\n `}\n `;\n});\n\nStyledLabel.defaultProps = defaultThemeProp;\n\nexport const StyledIcon = styled.div(({ theme }) => {\n return css`\n min-height: 2rem;\n min-width: 2rem;\n padding: calc(0.5 * ${theme.base.spacing});\n margin-inline-end: ${theme.base.spacing};\n text-align: center;\n background-color: var(--bg-color);\n color: var(--fg-color);\n border-radius: ${theme.base['border-radius']};\n `;\n});\n\nStyledIcon.defaultProps = defaultThemeProp;\n\nexport const StyledNodeTemplateHeader = styled.header(({ theme }) => {\n return css`\n white-space: nowrap;\n button {\n border-radius: ${theme.base['border-radius']};\n }\n `;\n});\n\nStyledNodeTemplateHeader.defaultProps = defaultThemeProp;\n\nexport const StyledText = styled(Text)<{ error?: string | undefined }>(({ error, theme }) => {\n return css`\n padding-inline-end: ${theme.base.spacing};\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: ${error ? '20ch' : '23ch'};\n `;\n});\n\nStyledText.defaultProps = defaultThemeProp;\n\nexport const StyledNodeTemplate = styled(Card)<{ highlight: boolean }>(({ highlight, theme }) => {\n return css`\n width: 17.5rem;\n height: 7.5rem;\n align-self: center;\n overflow: hidden;\n border: 0.125rem solid transparent;\n\n ${highlight &&\n css`\n &&& {\n color: ${theme.base.colors.black};\n background-color: ${theme.base.colors.red['extra-light']};\n border-radius: 0.25rem;\n box-shadow: 0 0 0 0.125rem ${theme.base.colors.red.medium};\n }\n `}\n\n &&& {\n border-radius: ${theme.base['border-radius']};\n }\n\n &:hover {\n cursor: pointer;\n }\n\n :focus-visible {\n box-shadow: ${theme.base.shadow.focus};\n }\n\n &[aria-current='location'] {\n box-shadow: none;\n border: 0.125rem solid ${theme.base.palette.interactive};\n cursor: pointer;\n }\n `;\n});\n\nStyledNodeTemplate.defaultProps = defaultThemeProp;\n\nexport const StyledNodeTemplateFooter = styled(CardFooter)(({ theme }) => {\n return css`\n margin-top: auto;\n &:not(${StyledNodeTemplate} ${StyledNodeTemplate} > &) {\n padding: ${theme.base.spacing};\n }\n `;\n});\n\nStyledNodeTemplateFooter.defaultProps = defaultThemeProp;\n\nexport const StyledNodeTempleteContent = styled.div(({ theme }) => {\n return css`\n padding: ${theme.base.spacing};\n padding-block-start: 0;\n max-height: 2.5rem;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: pre-wrap;\n word-wrap: break-word;\n `;\n});\n\nStyledNodeTempleteContent.defaultProps = defaultThemeProp;\n\nexport const StyledAdditionalData = styled.dl`\n overflow: hidden;\n`;\n\nexport const StyledAdditionalDataItem = styled.div(({ theme }) => {\n return css`\n padding: 0 calc(0.5 * ${theme.base.spacing});\n background-color: ${theme.base.palette['secondary-background']};\n border-radius: ${theme.base['border-radius']};\n `;\n});\n\nStyledAdditionalDataItem.defaultProps = defaultThemeProp;\n\nexport const StyledTextWithEllipsis = styled(Text)(() => {\n return css`\n overflow: hidden;\n width: auto;\n display: inline-block;\n white-space: nowrap;\n text-overflow: ellipsis;\n `;\n});\n\nStyledTextWithEllipsis.defaultProps = defaultThemeProp;\n\nexport const StyledErrorIcon: typeof Icon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.urgent};\n margin-inline-end: ${theme.base.spacing};\n `;\n});\n\nStyledErrorIcon.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTemplates.d.ts","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplates.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,
|
|
1
|
+
{"version":3,"file":"NodeTemplates.d.ts","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplates.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAOhB,MAAM,OAAO,CAAC;AAuBf,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAA2B,MAAM,cAAc,CAAC;AA6CtF,eAAO,MAAM,WAAW,0JAerB,kBAAkB,gBAkGpB,CAAC;AAEF,eAAO,MAAM,SAAS,oBAAqB,gBAAgB,SAAS,CAAC,gBAgBpE,CAAC;AAEF,eAAO,MAAM,OAAO,oBAAqB,gBAAgB,SAAS,CAAC,gBAgBlE,CAAC"}
|
|
@@ -1,29 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback,
|
|
2
|
+
import { useCallback, useContext } from 'react';
|
|
3
3
|
import { readableColor } from 'polished';
|
|
4
|
-
import { MenuButton, Icon, Flex,
|
|
4
|
+
import { MenuButton, Icon, Flex, useI18n, Text, registerIcon } from '@pega/cosmos-react-core';
|
|
5
|
+
import * as warnSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/warn-solid.icon';
|
|
5
6
|
import { colorMap } from '../../../utils';
|
|
6
7
|
import FlowModellerContext from '../FlowModellerContext';
|
|
7
|
-
import { StyledLabel, StyledCircle, StyledIcon, StyledNodeTemplateHeader, StyledNodeTempleteContent, StyledNodeTemplate, StyledText, StyledTextWithEllipsis, StyledAdditionalData, StyledNodeTemplateFooter, StyledAdditionalDataItem } from './NodeTemplate.styles';
|
|
8
|
+
import { StyledLabel, StyledCircle, StyledIcon, StyledNodeTemplateHeader, StyledNodeTempleteContent, StyledNodeTemplate, StyledText, StyledTextWithEllipsis, StyledAdditionalData, StyledNodeTemplateFooter, StyledAdditionalDataItem, StyledErrorIcon } from './NodeTemplate.styles';
|
|
9
|
+
registerIcon(warnSolidIcon);
|
|
8
10
|
const MetaListItem = ({ label, value }) => {
|
|
9
|
-
|
|
10
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Flex, { as: StyledAdditionalDataItem, container: { wrap: 'nowrap', pad: 0.25, gap: 0.25 }, item: { grow: 1 }, ref: setNodeAdditionalDataItem, children: [_jsx(StyledTextWithEllipsis, { as: 'dd', children: label }), _jsx(Text, { role: 'separator', variant: 'secondary', "aria-hidden": 'true', children: ":\u00A0" }), _jsx(StyledTextWithEllipsis, { as: 'dt', children: value })] }), _jsx(Tooltip, { target: nodeAdditionalDataItem, hideDelay: 'none', children: `${label}:${value}` })] }));
|
|
11
|
+
return (_jsx(_Fragment, { children: _jsxs(Flex, { as: StyledAdditionalDataItem, container: { wrap: 'nowrap', pad: 0.25, gap: 0.25 }, item: { grow: 1 }, children: [_jsx(StyledTextWithEllipsis, { as: 'dd', children: label }), _jsx(Text, { role: 'separator', variant: 'secondary', "aria-hidden": 'true', children: ":\u00A0" }), _jsx(StyledTextWithEllipsis, { as: 'dt', children: value })] }) }));
|
|
11
12
|
};
|
|
12
13
|
const MetaList = ({ metadata }) => {
|
|
13
|
-
const [nodeAdditionalData, setNodeAdditionalData] = useElement();
|
|
14
|
-
let additionalDataValue = '';
|
|
15
|
-
metadata?.forEach((item, index) => {
|
|
16
|
-
if (index > 1) {
|
|
17
|
-
additionalDataValue += `${item.label}: ${item.value}
|
|
18
|
-
`;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
14
|
return (_jsxs(Flex, { as: StyledAdditionalData, container: { wrap: 'nowrap', colGap: 1, rowGap: 0.25 }, children: [metadata?.map((data, index) => {
|
|
22
15
|
if (index >= 2) {
|
|
23
16
|
return;
|
|
24
17
|
}
|
|
25
18
|
return _jsx(MetaListItem, { ...data }, data.id);
|
|
26
|
-
}), metadata && metadata.length > 2 && (
|
|
19
|
+
}), metadata && metadata.length > 2 && (_jsx(_Fragment, { children: _jsx(Flex, { as: StyledAdditionalDataItem, container: { pad: 0.25 }, item: { grow: 1, shrink: 0 }, children: _jsx(StyledTextWithEllipsis, { as: 'dt', children: `+${metadata?.length - 2}` }) }) }))] }));
|
|
27
20
|
};
|
|
28
21
|
export const DefaultNode = ({ id, label, type, description, additionalData, actions, onActionClick, onClick, onDelete, reference, error, selected, referencedNode, ...restProps }) => {
|
|
29
22
|
const t = useI18n();
|
|
@@ -55,25 +48,14 @@ export const DefaultNode = ({ id, label, type, description, additionalData, acti
|
|
|
55
48
|
onClick?.(id, e);
|
|
56
49
|
}
|
|
57
50
|
}, [onClick]);
|
|
58
|
-
const [nodeLabel, setNodeLabel] = useElement();
|
|
59
|
-
const [nodeDescription, setNodeDescription] = useElement();
|
|
60
|
-
const [nodeIcon, setNodeIcon] = useElement();
|
|
61
|
-
const [nodeErrorToolTip, setNodeErrorToolTip] = useElement();
|
|
62
51
|
const color = readableColor(colorMap[type.color]);
|
|
63
52
|
const { readOnly, highlights } = useContext(FlowModellerContext);
|
|
64
|
-
|
|
65
|
-
if (error) {
|
|
66
|
-
setNodeDescription(null);
|
|
67
|
-
setNodeLabel(null);
|
|
68
|
-
setNodeIcon(null);
|
|
69
|
-
}
|
|
70
|
-
}, [error]);
|
|
71
|
-
return (_jsxs(StyledNodeTemplate, { "aria-label": error || label, "aria-current": selected ? 'location' : undefined, onClick: (e) => onClick?.(id, e), onKeyDown: handleEnterKeyDown, ref: setNodeErrorToolTip, highlight: error ? true : !!highlights?.nodes?.[id], error: error, id: `modeller-node-${id}`, ...restProps, children: [_jsxs(Flex, { as: StyledNodeTemplateHeader, container: { alignItems: 'center', pad: 1, justify: 'between' }, children: [_jsxs(Flex, { container: { alignItems: 'center' }, children: [_jsx(StyledIcon, { id: id, style: {
|
|
53
|
+
return (_jsxs(StyledNodeTemplate, { "aria-label": error ? t('step_name_error', [label]) : label, "aria-current": selected ? 'location' : undefined, onClick: (e) => onClick?.(id, e), onKeyDown: handleEnterKeyDown, id: `modeller-node-${id}`, highlight: !!highlights?.nodes?.[id], ...restProps, children: [_jsxs(Flex, { as: StyledNodeTemplateHeader, container: { alignItems: 'center', pad: 1, justify: 'between' }, children: [_jsxs(Flex, { container: { alignItems: 'center' }, children: [error && _jsx(StyledErrorIcon, { name: 'warn-solid' }), _jsx(StyledIcon, { id: id, style: {
|
|
72
54
|
'--bg-color': colorMap[type.color],
|
|
73
55
|
'--fg-color': color
|
|
74
|
-
},
|
|
56
|
+
}, children: _jsx(Icon, { name: type.icon }) }), _jsx(StyledText, { variant: 'h4', children: label })] }), !readOnly && actionItems && (_jsx(MenuButton, { portal: true, variant: 'simple', text: t('actions'), icon: 'more', iconOnly: true, onClick: (e) => e.stopPropagation(), onKeyDown: (e) => e.stopPropagation(), menu: {
|
|
75
57
|
items: actionItems
|
|
76
|
-
} }))] }), description &&
|
|
58
|
+
} }))] }), description && _jsx(StyledNodeTempleteContent, { children: description }), additionalData && type.minConnectors > 0 && (_jsx(StyledNodeTemplateFooter, { children: _jsx(MetaList, { metadata: additionalData }) })), references && type.minConnectors < 1 && (_jsx(StyledNodeTemplateFooter, { children: _jsx(MetaList, { metadata: references }) }))] }));
|
|
77
59
|
};
|
|
78
60
|
export const StartNode = ({ type, label }) => {
|
|
79
61
|
return (_jsxs(Flex, { container: { justify: 'center', direction: 'column' }, children: [_jsx(StyledLabel, { nodeType: type, children: label }), _jsx(StyledCircle, { style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTemplates.js","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplates.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,WAAW,EAIX,SAAS,EACT,UAAU,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E,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,aACzD,KAAC,YAAY,IACX,KAAK,EACH;oBACE,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;iBAClB,EAEpB,QAAQ,EAAE,CAAC,gBACC,KAAK,EACjB,IAAI,EAAC,QAAQ,GACb,EACF,KAAC,WAAW,IAAC,QAAQ,EAAE,IAAI,YAAG,KAAK,GAAe,IAC7C,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n PropsWithoutRef,\n CSSProperties,\n useCallback,\n MouseEvent,\n KeyboardEvent,\n FC,\n useEffect,\n useContext\n} from 'react';\nimport { readableColor } from 'polished';\n\nimport {\n MenuButton,\n Icon,\n Flex,\n Tooltip,\n useElement,\n useI18n,\n cap,\n Text\n} from '@pega/cosmos-react-core';\n\nimport { colorMap } from '../../../utils';\nimport FlowModellerContext from '../FlowModellerContext';\n\nimport {\n StyledLabel,\n StyledCircle,\n StyledIcon,\n StyledNodeTemplateHeader,\n StyledNodeTempleteContent,\n StyledNodeTemplate,\n StyledText,\n StyledTextWithEllipsis,\n StyledAdditionalData,\n StyledNodeTemplateFooter,\n StyledAdditionalDataItem\n} from './NodeTemplate.styles';\nimport { NodeProps, NodeComponentProps, AdditionalDataItemProps } from './Node.types';\n\nconst MetaListItem = ({ label, value }: AdditionalDataItemProps) => {\n const [nodeAdditionalDataItem, setNodeAdditionalDataItem] = useElement();\n return (\n <>\n <Flex\n as={StyledAdditionalDataItem}\n container={{ wrap: 'nowrap', pad: 0.25, gap: 0.25 }}\n item={{ grow: 1 }}\n ref={setNodeAdditionalDataItem}\n >\n <StyledTextWithEllipsis as='dd'>{label}</StyledTextWithEllipsis>\n <Text role='separator' variant='secondary' aria-hidden='true'>\n : \n </Text>\n <StyledTextWithEllipsis as='dt'>{value}</StyledTextWithEllipsis>\n </Flex>\n <Tooltip target={nodeAdditionalDataItem} hideDelay='none'>\n {`${label}:${value}`}\n </Tooltip>\n </>\n );\n};\n\nconst MetaList: FC<{ metadata: NodeProps['additionalData'] }> = ({ metadata }) => {\n const [nodeAdditionalData, setNodeAdditionalData] = useElement();\n let additionalDataValue = '';\n metadata?.forEach((item: AdditionalDataItemProps, index: number) => {\n if (index > 1) {\n additionalDataValue += `${item.label}: ${item.value}\n `;\n }\n });\n return (\n <Flex as={StyledAdditionalData} container={{ wrap: 'nowrap', colGap: 1, rowGap: 0.25 }}>\n {metadata?.map((data: AdditionalDataItemProps, index: number) => {\n if (index >= 2) {\n return;\n }\n return <MetaListItem key={data.id} {...data} />;\n })}\n {metadata && metadata.length > 2 && (\n <>\n <Flex\n as={StyledAdditionalDataItem}\n container={{ pad: 0.25 }}\n item={{ grow: 1, shrink: 0 }}\n ref={setNodeAdditionalData}\n >\n <StyledTextWithEllipsis as='dt'>{`+${metadata?.length - 2}`}</StyledTextWithEllipsis>\n </Flex>\n {additionalDataValue && (\n <Tooltip target={nodeAdditionalData} hideDelay='none'>\n {additionalDataValue}\n </Tooltip>\n )}\n </>\n )}\n </Flex>\n );\n};\nexport const DefaultNode = ({\n id,\n label,\n type,\n description,\n additionalData,\n actions,\n onActionClick,\n onClick,\n onDelete,\n reference,\n error,\n selected,\n referencedNode,\n ...restProps\n}: NodeComponentProps) => {\n const t = useI18n();\n\n const actionItems = actions?.map(actionItem => {\n return {\n id: actionItem.id,\n primary: actionItem.text,\n onClick: (actionId: string, e: MouseEvent) => {\n e.stopPropagation();\n onActionClick?.({ actionId, nodeId: id }, e);\n }\n };\n });\n\n const references = referencedNode && [\n { id: referencedNode?.id, label: t('go_to_noun'), value: referencedNode?.label }\n ];\n\n if (onDelete !== undefined) {\n actionItems?.push({\n id: 'flowmodeller-delete-node',\n primary: t('delete'),\n onClick: (actionId: string, e: MouseEvent) => {\n e.stopPropagation();\n onDelete?.({ actionId, nodeId: id }, e);\n }\n });\n }\n\n const handleEnterKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n onClick?.(id, e);\n }\n },\n [onClick]\n );\n\n const [nodeLabel, setNodeLabel] = useElement();\n const [nodeDescription, setNodeDescription] = useElement();\n\n const [nodeIcon, setNodeIcon] = useElement();\n const [nodeErrorToolTip, setNodeErrorToolTip] = useElement();\n const color = readableColor(colorMap[type.color]);\n const { readOnly, highlights } = useContext(FlowModellerContext);\n\n useEffect(() => {\n if (error) {\n setNodeDescription(null);\n setNodeLabel(null);\n setNodeIcon(null);\n }\n }, [error]);\n\n return (\n <StyledNodeTemplate\n aria-label={error || label}\n aria-current={selected ? 'location' : undefined}\n onClick={(e: MouseEvent) => onClick?.(id, e)}\n onKeyDown={handleEnterKeyDown}\n ref={setNodeErrorToolTip}\n highlight={error ? true : !!highlights?.nodes?.[id]}\n error={error}\n id={`modeller-node-${id}`}\n {...restProps}\n >\n <Flex\n as={StyledNodeTemplateHeader}\n container={{ alignItems: 'center', pad: 1, justify: 'between' }}\n >\n <Flex container={{ alignItems: 'center' }}>\n <StyledIcon\n id={id}\n style={\n {\n '--bg-color': colorMap[type.color],\n '--fg-color': color\n } as CSSProperties\n }\n ref={setNodeIcon}\n >\n <Icon name={type.icon} />\n </StyledIcon>\n <Tooltip target={nodeIcon} hideDelay='none'>\n {cap(type.name)}\n </Tooltip>\n <StyledText variant='h4' ref={setNodeLabel}>\n {label}\n </StyledText>\n <Tooltip describeTarget={false} target={nodeLabel} hideDelay='none'>\n {label}\n </Tooltip>\n </Flex>\n {!readOnly && actionItems && (\n <MenuButton\n portal\n variant='simple'\n text={t('actions')}\n icon='more'\n iconOnly\n onClick={(e: MouseEvent) => e.stopPropagation()}\n onKeyDown={(e: KeyboardEvent) => e.stopPropagation()}\n menu={{\n items: actionItems\n }}\n />\n )}\n </Flex>\n {description && (\n <>\n <StyledNodeTempleteContent ref={setNodeDescription}>\n {description}\n </StyledNodeTempleteContent>\n <Tooltip describeTarget={false} target={nodeDescription} hideDelay='none'>\n {description}\n </Tooltip>\n </>\n )}\n {additionalData && type.minConnectors > 0 && (\n <StyledNodeTemplateFooter>\n <MetaList metadata={additionalData} />\n </StyledNodeTemplateFooter>\n )}\n {references && type.minConnectors < 1 && (\n <StyledNodeTemplateFooter>\n <MetaList metadata={references} />\n </StyledNodeTemplateFooter>\n )}\n {error && (\n <Tooltip target={nodeErrorToolTip} hideDelay='none'>\n {error}\n </Tooltip>\n )}\n </StyledNodeTemplate>\n );\n};\n\nexport const StartNode = ({ type, label }: PropsWithoutRef<NodeProps>) => {\n return (\n <Flex container={{ justify: 'center', direction: 'column' }}>\n <StyledLabel nodeType={type}>{label}</StyledLabel>\n <StyledCircle\n style={\n {\n '--bg-color': colorMap[type.color]\n } as CSSProperties\n }\n tabIndex={0}\n aria-label={label}\n role='button'\n />\n </Flex>\n );\n};\n\nexport const EndNode = ({ type, label }: PropsWithoutRef<NodeProps>) => {\n return (\n <Flex container={{ justify: 'center', direction: 'column' }}>\n <StyledCircle\n style={\n {\n '--bg-color': colorMap[type.color]\n } as CSSProperties\n }\n tabIndex={0}\n aria-label={label}\n role='button'\n />\n <StyledLabel nodeType={type}>{label}</StyledLabel>\n </Flex>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"NodeTemplates.js","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplates.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,WAAW,EAIX,UAAU,EACX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AAEnG,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,mBAAmB,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,wBAAwB,EACxB,yBAAy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AE;IACvE,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,aACzD,KAAC,WAAW,IAAC,QAAQ,EAAE,IAAI,YAAG,KAAK,GAAe,EAClD,KAAC,YAAY,IACX,KAAK,EACH;oBACE,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;iBAClB,EAEpB,QAAQ,EAAE,CAAC,gBACC,KAAK,EACjB,IAAI,EAAC,QAAQ,GACb,IACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAA8B,EAAE,EAAE;IACrE,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,aACzD,KAAC,YAAY,IACX,KAAK,EACH;oBACE,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;iBAClB,EAEpB,QAAQ,EAAE,CAAC,gBACC,KAAK,EACjB,IAAI,EAAC,QAAQ,GACb,EACF,KAAC,WAAW,IAAC,QAAQ,EAAE,IAAI,YAAG,KAAK,GAAe,IAC7C,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n PropsWithoutRef,\n CSSProperties,\n useCallback,\n MouseEvent,\n KeyboardEvent,\n FC,\n useContext\n} from 'react';\nimport { readableColor } from 'polished';\n\nimport { MenuButton, Icon, Flex, useI18n, Text, registerIcon } from '@pega/cosmos-react-core';\nimport * as warnSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/warn-solid.icon';\n\nimport { colorMap } from '../../../utils';\nimport FlowModellerContext from '../FlowModellerContext';\n\nimport {\n StyledLabel,\n StyledCircle,\n StyledIcon,\n StyledNodeTemplateHeader,\n StyledNodeTempleteContent,\n StyledNodeTemplate,\n StyledText,\n StyledTextWithEllipsis,\n StyledAdditionalData,\n StyledNodeTemplateFooter,\n StyledAdditionalDataItem,\n StyledErrorIcon\n} from './NodeTemplate.styles';\nimport { NodeProps, NodeComponentProps, AdditionalDataItemProps } from './Node.types';\n\nregisterIcon(warnSolidIcon);\n\nconst MetaListItem = ({ label, value }: AdditionalDataItemProps) => {\n return (\n <>\n <Flex\n as={StyledAdditionalDataItem}\n container={{ wrap: 'nowrap', pad: 0.25, gap: 0.25 }}\n item={{ grow: 1 }}\n >\n <StyledTextWithEllipsis as='dd'>{label}</StyledTextWithEllipsis>\n <Text role='separator' variant='secondary' aria-hidden='true'>\n : \n </Text>\n <StyledTextWithEllipsis as='dt'>{value}</StyledTextWithEllipsis>\n </Flex>\n </>\n );\n};\n\nconst MetaList: FC<{ metadata: NodeProps['additionalData'] }> = ({ metadata }) => {\n return (\n <Flex as={StyledAdditionalData} container={{ wrap: 'nowrap', colGap: 1, rowGap: 0.25 }}>\n {metadata?.map((data: AdditionalDataItemProps, index: number) => {\n if (index >= 2) {\n return;\n }\n return <MetaListItem key={data.id} {...data} />;\n })}\n {metadata && metadata.length > 2 && (\n <>\n <Flex\n as={StyledAdditionalDataItem}\n container={{ pad: 0.25 }}\n item={{ grow: 1, shrink: 0 }}\n >\n <StyledTextWithEllipsis as='dt'>{`+${metadata?.length - 2}`}</StyledTextWithEllipsis>\n </Flex>\n </>\n )}\n </Flex>\n );\n};\nexport const DefaultNode = ({\n id,\n label,\n type,\n description,\n additionalData,\n actions,\n onActionClick,\n onClick,\n onDelete,\n reference,\n error,\n selected,\n referencedNode,\n ...restProps\n}: NodeComponentProps) => {\n const t = useI18n();\n\n const actionItems = actions?.map(actionItem => {\n return {\n id: actionItem.id,\n primary: actionItem.text,\n onClick: (actionId: string, e: MouseEvent) => {\n e.stopPropagation();\n onActionClick?.({ actionId, nodeId: id }, e);\n }\n };\n });\n\n const references = referencedNode && [\n { id: referencedNode?.id, label: t('go_to_noun'), value: referencedNode?.label }\n ];\n\n if (onDelete !== undefined) {\n actionItems?.push({\n id: 'flowmodeller-delete-node',\n primary: t('delete'),\n onClick: (actionId: string, e: MouseEvent) => {\n e.stopPropagation();\n onDelete?.({ actionId, nodeId: id }, e);\n }\n });\n }\n\n const handleEnterKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n onClick?.(id, e);\n }\n },\n [onClick]\n );\n\n const color = readableColor(colorMap[type.color]);\n const { readOnly, highlights } = useContext(FlowModellerContext);\n\n return (\n <StyledNodeTemplate\n aria-label={error ? t('step_name_error', [label]) : label}\n aria-current={selected ? 'location' : undefined}\n onClick={(e: MouseEvent) => onClick?.(id, e)}\n onKeyDown={handleEnterKeyDown}\n id={`modeller-node-${id}`}\n highlight={!!highlights?.nodes?.[id]}\n {...restProps}\n >\n <Flex\n as={StyledNodeTemplateHeader}\n container={{ alignItems: 'center', pad: 1, justify: 'between' }}\n >\n <Flex container={{ alignItems: 'center' }}>\n {error && <StyledErrorIcon name='warn-solid' />}\n <StyledIcon\n id={id}\n style={\n {\n '--bg-color': colorMap[type.color],\n '--fg-color': color\n } as CSSProperties\n }\n >\n <Icon name={type.icon} />\n </StyledIcon>\n <StyledText variant='h4'>{label}</StyledText>\n </Flex>\n {!readOnly && actionItems && (\n <MenuButton\n portal\n variant='simple'\n text={t('actions')}\n icon='more'\n iconOnly\n onClick={(e: MouseEvent) => e.stopPropagation()}\n onKeyDown={(e: KeyboardEvent) => e.stopPropagation()}\n menu={{\n items: actionItems\n }}\n />\n )}\n </Flex>\n {description && <StyledNodeTempleteContent>{description}</StyledNodeTempleteContent>}\n {additionalData && type.minConnectors > 0 && (\n <StyledNodeTemplateFooter>\n <MetaList metadata={additionalData} />\n </StyledNodeTemplateFooter>\n )}\n {references && type.minConnectors < 1 && (\n <StyledNodeTemplateFooter>\n <MetaList metadata={references} />\n </StyledNodeTemplateFooter>\n )}\n </StyledNodeTemplate>\n );\n};\n\nexport const StartNode = ({ type, label }: PropsWithoutRef<NodeProps>) => {\n return (\n <Flex container={{ justify: 'center', direction: 'column' }}>\n <StyledLabel nodeType={type}>{label}</StyledLabel>\n <StyledCircle\n style={\n {\n '--bg-color': colorMap[type.color]\n } as CSSProperties\n }\n tabIndex={0}\n aria-label={label}\n role='button'\n />\n </Flex>\n );\n};\n\nexport const EndNode = ({ type, label }: PropsWithoutRef<NodeProps>) => {\n return (\n <Flex container={{ justify: 'center', direction: 'column' }}>\n <StyledCircle\n style={\n {\n '--bg-color': colorMap[type.color]\n } as CSSProperties\n }\n tabIndex={0}\n aria-label={label}\n role='button'\n />\n <StyledLabel nodeType={type}>{label}</StyledLabel>\n </Flex>\n );\n};\n"]}
|
|
@@ -2,7 +2,6 @@ import { FunctionComponent } from 'react';
|
|
|
2
2
|
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
3
|
import { MobileBuildSummaryProps } from './MobileBuildSummary.types';
|
|
4
4
|
export declare const StyledInteractionTimerIconWrapper: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
-
export declare const StyledQRWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
6
5
|
export declare const StyledContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
7
6
|
declare const MobileBuildSummary: FunctionComponent<MobileBuildSummaryProps & ForwardProps>;
|
|
8
7
|
export default MobileBuildSummary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileBuildSummary.d.ts","sourceRoot":"","sources":["../../../src/components/MobileBuildSummary/MobileBuildSummary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAGvE,OAAO,EAUL,YAAY,
|
|
1
|
+
{"version":3,"file":"MobileBuildSummary.d.ts","sourceRoot":"","sources":["../../../src/components/MobileBuildSummary/MobileBuildSummary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAGvE,OAAO,EAUL,YAAY,EAUb,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAIrE,eAAO,MAAM,iCAAiC,0GAG7C,CAAC;AAIF,eAAO,MAAM,aAAa,yGAEzB,CAAC;AAIF,QAAA,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,GAAG,YAAY,CAkGjF,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import styled
|
|
4
|
-
import { Button, Card, CardContent, CardHeader, defaultThemeProp, EmptyState, FieldValueList, Flex, formatNumber, Icon, Link, Progress, registerIcon, Text, useConfiguration, useI18n, useUID } from '@pega/cosmos-react-core';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Button, Card, CardContent, CardHeader, defaultThemeProp, EmptyState, FieldValueList, Flex, formatNumber, Icon, Link, Progress, QRCode, registerIcon, Text, useConfiguration, useI18n, useUID } from '@pega/cosmos-react-core';
|
|
5
5
|
import * as osAndroid from '@pega/cosmos-react-core/lib/components/Icon/icons/os-android.icon';
|
|
6
6
|
import * as osApple from '@pega/cosmos-react-core/lib/components/Icon/icons/os-apple.icon';
|
|
7
|
-
|
|
8
|
-
registerIcon(galaxyIcon, osAndroid, osApple);
|
|
7
|
+
registerIcon(osAndroid, osApple);
|
|
9
8
|
export const StyledInteractionTimerIconWrapper = styled.span `
|
|
10
9
|
position: relative;
|
|
11
10
|
min-height: 4rem;
|
|
12
11
|
`;
|
|
13
12
|
StyledInteractionTimerIconWrapper.defaultProps = defaultThemeProp;
|
|
14
|
-
export const StyledQRWrapper = styled.div(({ theme }) => {
|
|
15
|
-
return css `
|
|
16
|
-
height: ${theme.base['content-width'].xs};
|
|
17
|
-
width: ${theme.base['content-width'].xs};
|
|
18
|
-
border: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
19
|
-
border-radius: calc(${theme.base['border-radius']} / 2);
|
|
20
|
-
text-align: center;
|
|
21
|
-
`;
|
|
22
|
-
});
|
|
23
|
-
StyledQRWrapper.defaultProps = defaultThemeProp;
|
|
24
13
|
export const StyledContent = styled.div `
|
|
25
14
|
min-height: 10rem;
|
|
26
15
|
`;
|
|
@@ -32,13 +21,13 @@ const MobileBuildSummary = forwardRef(({ type, progress = undefined, onBuild, bu
|
|
|
32
21
|
return (_jsxs(Card, { ...restProps, ref: ref, children: [_jsxs(CardHeader, { container: { alignItems: 'center', itemGap: 1 }, children: [_jsx(Icon, { name: type === 'android' ? 'os-android' : 'os-apple' }), _jsx(Text, { variant: 'h3', children: type === 'android' ? 'Android' : 'iOS' })] }), _jsx(CardContent, { children: _jsxs(_Fragment, { children: [progress === undefined && !buildSummary && (_jsxs(Flex, { container: { alignItems: 'center', gap: 1, direction: 'column', justify: 'center' }, as: StyledContent, children: [_jsx(EmptyState, { message: t('no_app_build') }), onBuild && (_jsx(Button, { variant: 'secondary', onClick: onBuild, children: t('build_app') }))] })), progress !== undefined && (_jsxs(Flex, { container: { alignItems: 'center', gap: 1, direction: 'column', justify: 'center' }, as: StyledContent, children: [_jsx(StyledInteractionTimerIconWrapper, { children: _jsx(Progress, { "aria-describedby": progressId, variant: 'ring', placement: 'local', message: formatNumber(progress / 100, {
|
|
33
22
|
locale,
|
|
34
23
|
options: { style: 'percent' }
|
|
35
|
-
}), value: progress, minValue: 0, maxValue: 100 }) }), _jsx(Text, { variant: 'secondary', id: progressId, children: t('build_in_progress') })] })), buildSummary && !progress && (_jsxs(Flex, { container: { wrap: 'wrap', gap: 2 }, as: StyledContent, children: [
|
|
24
|
+
}), value: progress, minValue: 0, maxValue: 100 }) }), _jsx(Text, { variant: 'secondary', id: progressId, children: t('build_in_progress') })] })), buildSummary && !progress && (_jsxs(Flex, { container: { wrap: 'wrap', gap: 2 }, as: StyledContent, children: [_jsx(Flex, { container: {
|
|
36
25
|
direction: 'column',
|
|
37
26
|
alignItems: 'center',
|
|
38
27
|
justify: 'center',
|
|
39
28
|
gap: 1,
|
|
40
29
|
pad: 2
|
|
41
|
-
},
|
|
30
|
+
}, children: _jsx(QRCode, { value: buildSummary.qrCodeUrl ?? buildSummary.downloadUrl }) }), _jsxs(Flex, { container: { direction: 'column', gap: 2 }, children: [_jsx(FieldValueList, { variant: 'inline', fields: buildSummary.summaryFields }), _jsxs(Flex, { container: { wrap: 'wrap', rowGap: 1 }, children: [onBuild && (_jsx(Button, { variant: 'secondary', onClick: onBuild, children: t('rebuild_app') })), _jsx(Link, { href: buildSummary.downloadUrl, variant: 'secondary', onClick: buildSummary.onDownload, children: t('download_app') })] })] })] }))] }) })] }));
|
|
42
31
|
});
|
|
43
32
|
export default MobileBuildSummary;
|
|
44
33
|
//# sourceMappingURL=MobileBuildSummary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileBuildSummary.js","sourceRoot":"","sources":["../../../src/components/MobileBuildSummary/MobileBuildSummary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmB,MAAM,OAAO,CAAC;AACvE,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"MobileBuildSummary.js","sourceRoot":"","sources":["../../../src/components/MobileBuildSummary/MobileBuildSummary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmB,MAAM,OAAO,CAAC;AACvE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,IAAI,EACJ,YAAY,EAEZ,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,gBAAgB,EAChB,OAAO,EACP,MAAM,EACP,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,SAAS,MA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EAAE,YAAY,CAAC,SAAS,IAAI,YAAY,CAAC,WAAW,GAAI,GAChE,EACP,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aAC9C,KAAC,cAAc,IAAC,OAAO,EAAC,QAAQ,EAAC,MAAM,EAAE,YAAY,CAAC,aAAa,GAAI,EACvE,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,aACzC,OAAO,IAAI,CACV,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,OAAO,YACzC,CAAC,CAAC,aAAa,CAAC,GACV,CACV,EAED,KAAC,IAAI,IACH,IAAI,EAAE,YAAY,CAAC,WAAW,EAC9B,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,YAAY,CAAC,UAAU,YAE/B,CAAC,CAAC,cAAc,CAAC,GACb,IACF,IACF,IACF,CACR,IACA,GACS,IACT,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\n\nimport {\n Button,\n Card,\n CardContent,\n CardHeader,\n defaultThemeProp,\n EmptyState,\n FieldValueList,\n Flex,\n formatNumber,\n ForwardProps,\n Icon,\n Link,\n Progress,\n QRCode,\n registerIcon,\n Text,\n useConfiguration,\n useI18n,\n useUID\n} from '@pega/cosmos-react-core';\nimport * as osAndroid from '@pega/cosmos-react-core/lib/components/Icon/icons/os-android.icon';\nimport * as osApple from '@pega/cosmos-react-core/lib/components/Icon/icons/os-apple.icon';\n\nimport { MobileBuildSummaryProps } from './MobileBuildSummary.types';\n\nregisterIcon(osAndroid, osApple);\n\nexport const StyledInteractionTimerIconWrapper = styled.span`\n position: relative;\n min-height: 4rem;\n`;\n\nStyledInteractionTimerIconWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledContent = styled.div`\n min-height: 10rem;\n`;\n\nStyledContent.defaultProps = defaultThemeProp;\n\nconst MobileBuildSummary: FunctionComponent<MobileBuildSummaryProps & ForwardProps> = forwardRef(\n (\n {\n type,\n progress = undefined,\n onBuild,\n buildSummary,\n ...restProps\n }: PropsWithoutRef<MobileBuildSummaryProps>,\n ref: MobileBuildSummaryProps['ref']\n ) => {\n const progressId = useUID();\n const { locale } = useConfiguration();\n const t = useI18n();\n\n return (\n <Card {...restProps} ref={ref}>\n <CardHeader container={{ alignItems: 'center', itemGap: 1 }}>\n <Icon name={type === 'android' ? 'os-android' : 'os-apple'} />\n <Text variant='h3'>{type === 'android' ? 'Android' : 'iOS'}</Text>\n </CardHeader>\n <CardContent>\n <>\n {progress === undefined && !buildSummary && (\n <Flex\n container={{ alignItems: 'center', gap: 1, direction: 'column', justify: 'center' }}\n as={StyledContent}\n >\n <EmptyState message={t('no_app_build')} />\n {onBuild && (\n <Button variant='secondary' onClick={onBuild}>\n {t('build_app')}\n </Button>\n )}\n </Flex>\n )}\n {progress !== undefined && (\n <Flex\n container={{ alignItems: 'center', gap: 1, direction: 'column', justify: 'center' }}\n as={StyledContent}\n >\n <StyledInteractionTimerIconWrapper>\n <Progress\n aria-describedby={progressId}\n variant='ring'\n placement='local'\n message={formatNumber(progress / 100, {\n locale,\n options: { style: 'percent' }\n })}\n value={progress}\n minValue={0}\n maxValue={100}\n />\n </StyledInteractionTimerIconWrapper>\n <Text variant='secondary' id={progressId}>\n {t('build_in_progress')}\n </Text>\n </Flex>\n )}\n {buildSummary && !progress && (\n <Flex container={{ wrap: 'wrap', gap: 2 }} as={StyledContent}>\n <Flex\n container={{\n direction: 'column',\n alignItems: 'center',\n justify: 'center',\n gap: 1,\n pad: 2\n }}\n >\n <QRCode value={buildSummary.qrCodeUrl ?? buildSummary.downloadUrl} />\n </Flex>\n <Flex container={{ direction: 'column', gap: 2 }}>\n <FieldValueList variant='inline' fields={buildSummary.summaryFields} />\n <Flex container={{ wrap: 'wrap', rowGap: 1 }}>\n {onBuild && (\n <Button variant='secondary' onClick={onBuild}>\n {t('rebuild_app')}\n </Button>\n )}\n\n <Link\n href={buildSummary.downloadUrl}\n variant='secondary'\n onClick={buildSummary.onDownload}\n >\n {t('download_app')}\n </Link>\n </Flex>\n </Flex>\n </Flex>\n )}\n </>\n </CardContent>\n </Card>\n );\n }\n);\n\nexport default MobileBuildSummary;\n"]}
|
|
@@ -3,6 +3,8 @@ import { BaseProps, FieldValueListItemProps } from '@pega/cosmos-react-core';
|
|
|
3
3
|
export interface AppBuildProps {
|
|
4
4
|
/** URL to the application resource. */
|
|
5
5
|
downloadUrl: string;
|
|
6
|
+
/** QR code url. */
|
|
7
|
+
qrCodeUrl?: string;
|
|
6
8
|
/** Click handler for the download link. */
|
|
7
9
|
onDownload?: MouseEventHandler<HTMLAnchorElement>;
|
|
8
10
|
/** The set of field values to render in the list. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileBuildSummary.types.d.ts","sourceRoot":"","sources":["../../../src/components/MobileBuildSummary/MobileBuildSummary.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAE7E,MAAM,WAAW,aAAa;IAC5B,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAClD,qDAAqD;IACrD,aAAa,EAAE,uBAAuB,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,uBAAwB,SAAQ,SAAS;IACxD,yDAAyD;IACzD,IAAI,EAAE,SAAS,GAAG,KAAK,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,0BAA0B;IAC1B,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
|
|
1
|
+
{"version":3,"file":"MobileBuildSummary.types.d.ts","sourceRoot":"","sources":["../../../src/components/MobileBuildSummary/MobileBuildSummary.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAE7E,MAAM,WAAW,aAAa;IAC5B,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAClD,qDAAqD;IACrD,aAAa,EAAE,uBAAuB,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,uBAAwB,SAAQ,SAAS;IACxD,yDAAyD;IACzD,IAAI,EAAE,SAAS,GAAG,KAAK,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,0BAA0B;IAC1B,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
|