@pega/cosmos-react-demos 3.0.0-dev.28.0 → 3.0.0-dev.29.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/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts +4 -0
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts.map +1 -1
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.js +23 -1
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.js.map +1 -1
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts +4 -1
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts.map +1 -1
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.jsx +28 -5
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.jsx.map +1 -1
- package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.styles.d.ts +1 -1
- package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.styles.d.ts.map +1 -1
- package/jsx/condition-builder/PromotedFilters/PromotedFilters.mocks.d.ts.map +1 -1
- package/jsx/condition-builder/PromotedFilters/PromotedFilters.mocks.js +32 -16
- package/jsx/condition-builder/PromotedFilters/PromotedFilters.mocks.js.map +1 -1
- package/jsx/core/DateTime/DateTime.stories.d.ts +2 -1
- package/jsx/core/DateTime/DateTime.stories.d.ts.map +1 -1
- package/jsx/core/DateTime/DateTime.stories.jsx +40 -6
- package/jsx/core/DateTime/DateTime.stories.jsx.map +1 -1
- package/jsx/core/DateTime/DateTimePicker.stories.d.ts.map +1 -1
- package/jsx/core/DateTime/DateTimePicker.stories.jsx +1 -1
- package/jsx/core/DateTime/DateTimePicker.stories.jsx.map +1 -1
- package/jsx/core/Location/locationTestUtils.d.ts +3 -0
- package/jsx/core/Location/locationTestUtils.d.ts.map +1 -0
- package/jsx/core/Location/locationTestUtils.js +29 -0
- package/jsx/core/Location/locationTestUtils.js.map +1 -0
- package/jsx/core/Number/Number.stories.d.ts +2 -1
- package/jsx/core/Number/Number.stories.d.ts.map +1 -1
- package/jsx/core/Number/Number.stories.jsx +91 -1
- package/jsx/core/Number/Number.stories.jsx.map +1 -1
- package/jsx/core/Popover/Popover.stories.jsx +6 -6
- package/jsx/core/Popover/Popover.stories.jsx.map +1 -1
- package/jsx/social/Chat/Chat.stories.jsx +4 -4
- package/jsx/social/Chat/Chat.stories.jsx.map +1 -1
- package/jsx/social/Email/Email.stories.jsx +2 -2
- package/jsx/social/Email/Email.stories.jsx.map +1 -1
- package/jsx/tools/DevTools/DevTools.mocks.d.ts +3 -0
- package/jsx/tools/DevTools/DevTools.mocks.d.ts.map +1 -0
- package/jsx/tools/DevTools/DevTools.mocks.js +3 -0
- package/jsx/tools/DevTools/DevTools.mocks.js.map +1 -0
- package/jsx/tools/DevTools/DevTools.stories.d.ts +10 -0
- package/jsx/tools/DevTools/DevTools.stories.d.ts.map +1 -0
- package/jsx/tools/DevTools/DevTools.stories.jsx +35 -0
- package/jsx/tools/DevTools/DevTools.stories.jsx.map +1 -0
- package/jsx/tools/PreviewShell/PreviewShell.stories.d.ts +1 -0
- package/jsx/tools/PreviewShell/PreviewShell.stories.d.ts.map +1 -1
- package/jsx/tools/PreviewShell/PreviewShell.stories.jsx +53 -7
- package/jsx/tools/PreviewShell/PreviewShell.stories.jsx.map +1 -1
- package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts +4 -0
- package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts.map +1 -1
- package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.js +23 -1
- package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.js.map +1 -1
- package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts +4 -1
- package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts.map +1 -1
- package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.js +28 -5
- package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.js.map +1 -1
- package/lib/condition-builder/ConditionBuilder/ConditionBuilder.styles.d.ts +1 -1
- package/lib/condition-builder/ConditionBuilder/ConditionBuilder.styles.d.ts.map +1 -1
- package/lib/condition-builder/PromotedFilters/PromotedFilters.mocks.d.ts.map +1 -1
- package/lib/condition-builder/PromotedFilters/PromotedFilters.mocks.js +32 -16
- package/lib/condition-builder/PromotedFilters/PromotedFilters.mocks.js.map +1 -1
- package/lib/core/DateTime/DateTime.stories.d.ts +2 -1
- package/lib/core/DateTime/DateTime.stories.d.ts.map +1 -1
- package/lib/core/DateTime/DateTime.stories.js +40 -6
- package/lib/core/DateTime/DateTime.stories.js.map +1 -1
- package/lib/core/DateTime/DateTimePicker.stories.d.ts.map +1 -1
- package/lib/core/DateTime/DateTimePicker.stories.js +1 -1
- package/lib/core/DateTime/DateTimePicker.stories.js.map +1 -1
- package/lib/core/Location/locationTestUtils.d.ts +3 -0
- package/lib/core/Location/locationTestUtils.d.ts.map +1 -0
- package/lib/core/Location/locationTestUtils.js +30 -0
- package/lib/core/Location/locationTestUtils.js.map +1 -0
- package/lib/core/Number/Number.stories.d.ts +2 -1
- package/lib/core/Number/Number.stories.d.ts.map +1 -1
- package/lib/core/Number/Number.stories.js +91 -1
- package/lib/core/Number/Number.stories.js.map +1 -1
- package/lib/core/Popover/Popover.stories.js +1 -1
- package/lib/core/Popover/Popover.stories.js.map +1 -1
- package/lib/social/Chat/Chat.stories.js +2 -2
- package/lib/social/Chat/Chat.stories.js.map +1 -1
- package/lib/social/Email/Email.stories.js +1 -1
- package/lib/social/Email/Email.stories.js.map +1 -1
- package/lib/tools/DevTools/DevTools.mocks.d.ts +3 -0
- package/lib/tools/DevTools/DevTools.mocks.d.ts.map +1 -0
- package/lib/tools/DevTools/DevTools.mocks.js +3 -0
- package/lib/tools/DevTools/DevTools.mocks.js.map +1 -0
- package/lib/tools/DevTools/DevTools.stories.d.ts +10 -0
- package/lib/tools/DevTools/DevTools.stories.d.ts.map +1 -0
- package/lib/tools/DevTools/DevTools.stories.js +31 -0
- package/lib/tools/DevTools/DevTools.stories.js.map +1 -0
- package/lib/tools/PreviewShell/PreviewShell.stories.d.ts +1 -0
- package/lib/tools/PreviewShell/PreviewShell.stories.d.ts.map +1 -1
- package/lib/tools/PreviewShell/PreviewShell.stories.js +53 -7
- package/lib/tools/PreviewShell/PreviewShell.stories.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
|
-
import { useState } from 'react';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
4
|
import { PreviewShell } from '@pega/cosmos-react-tools';
|
|
5
5
|
import { footerMenuMock, footerTabsMockContent, footerTabsMock } from './PreviewShell.mocks';
|
|
6
6
|
export default {
|
|
@@ -12,6 +12,8 @@ export default {
|
|
|
12
12
|
};
|
|
13
13
|
export const PreviewShellSkeleton = (args) => {
|
|
14
14
|
const [tabContent, setTabContent] = useState('Tab 1 content');
|
|
15
|
+
const [currentTabId, setCurrentTabId] = useState(footerTabsMock[0].id);
|
|
16
|
+
const [newWindow, setNewWindow] = useState(null);
|
|
15
17
|
return (_jsx(PreviewShell, { frameurl: '', header: {
|
|
16
18
|
appName: args.appName,
|
|
17
19
|
status: {
|
|
@@ -32,11 +34,30 @@ export const PreviewShellSkeleton = (args) => {
|
|
|
32
34
|
}, footer: {
|
|
33
35
|
tabs: footerTabsMock,
|
|
34
36
|
tabContent,
|
|
37
|
+
currentTabId,
|
|
35
38
|
onTabClick: (id) => {
|
|
36
39
|
setTabContent(`Tab ${+id + 1} content`);
|
|
40
|
+
setCurrentTabId(id);
|
|
37
41
|
},
|
|
38
42
|
expanded: args.expandFooter,
|
|
39
|
-
|
|
43
|
+
onContinueDebug: newWindow
|
|
44
|
+
? () => {
|
|
45
|
+
newWindow?.focus();
|
|
46
|
+
}
|
|
47
|
+
: undefined,
|
|
48
|
+
onNewWindowClick: args.onNewWindowClick ??
|
|
49
|
+
(() => {
|
|
50
|
+
const newWindowObj = window.open(`${window.location.origin}/iframe.html?id=tools-devtools--dev-tools-demo&args=&viewMode=story`);
|
|
51
|
+
setNewWindow(newWindowObj);
|
|
52
|
+
newWindowObj?.addEventListener('load', () => {
|
|
53
|
+
newWindowObj?.addEventListener('beforeunload', () => {
|
|
54
|
+
setNewWindow(null);
|
|
55
|
+
});
|
|
56
|
+
newWindowObj?.addEventListener('unload', () => {
|
|
57
|
+
document.querySelector('button[aria-label="Open in new window"]')?.focus();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}),
|
|
40
61
|
menu: { items: footerMenuMock }
|
|
41
62
|
} }));
|
|
42
63
|
};
|
|
@@ -45,7 +66,8 @@ PreviewShellSkeleton.args = {
|
|
|
45
66
|
statusVariant: 'pending',
|
|
46
67
|
statusText: 'status',
|
|
47
68
|
operatorName: 'Cindy Turner',
|
|
48
|
-
expandFooter: true
|
|
69
|
+
expandFooter: true,
|
|
70
|
+
onNewWindowClick: undefined
|
|
49
71
|
};
|
|
50
72
|
PreviewShellSkeleton.argTypes = {
|
|
51
73
|
appName: { control: { type: 'text' } },
|
|
@@ -55,11 +77,26 @@ PreviewShellSkeleton.argTypes = {
|
|
|
55
77
|
},
|
|
56
78
|
statusText: { control: { type: 'text' } },
|
|
57
79
|
operatorName: { control: { type: 'text' } },
|
|
58
|
-
expandFooter: { control: { type: 'boolean' } }
|
|
80
|
+
expandFooter: { control: { type: 'boolean' } },
|
|
81
|
+
onNewWindowClick: { table: { disable: true } }
|
|
59
82
|
};
|
|
60
83
|
export const PreviewShellDemo = (args) => {
|
|
61
|
-
const [tabContent, setTabContent] = useState(footerTabsMockContent[
|
|
62
|
-
|
|
84
|
+
const [tabContent, setTabContent] = useState(footerTabsMockContent[1]);
|
|
85
|
+
const [currentTabId, setCurrentTabId] = useState(footerTabsMock[1].id);
|
|
86
|
+
const [newWindow, setNewWindow] = useState(null);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (newWindow?.self) {
|
|
89
|
+
newWindow.onload = () => {
|
|
90
|
+
newWindow.onbeforeunload = () => {
|
|
91
|
+
setNewWindow(null);
|
|
92
|
+
};
|
|
93
|
+
newWindow.onunload = () => {
|
|
94
|
+
document.querySelector('button[aria-label="Open in new window"]')?.focus();
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}, [newWindow]);
|
|
99
|
+
return (_jsx(PreviewShell, { frameurl: `${window.location.href.split('?')[0]}?id=core-pagetemplates--tabbed-page-demo&args=&viewMode=story`, header: {
|
|
63
100
|
appName: args.appName,
|
|
64
101
|
onClick: action('Clicked application name'),
|
|
65
102
|
status: {
|
|
@@ -79,12 +116,21 @@ export const PreviewShellDemo = (args) => {
|
|
|
79
116
|
}
|
|
80
117
|
}, footer: {
|
|
81
118
|
tabs: footerTabsMock,
|
|
119
|
+
currentTabId,
|
|
82
120
|
tabContent,
|
|
83
121
|
onTabClick: (id) => {
|
|
84
122
|
setTabContent(footerTabsMockContent[Number(id)]);
|
|
123
|
+
setCurrentTabId(id);
|
|
85
124
|
},
|
|
86
125
|
expanded: args.expandFooter,
|
|
87
|
-
|
|
126
|
+
onContinueDebug: newWindow
|
|
127
|
+
? () => {
|
|
128
|
+
newWindow?.focus();
|
|
129
|
+
}
|
|
130
|
+
: undefined,
|
|
131
|
+
onNewWindowClick: () => {
|
|
132
|
+
setNewWindow(window.open(`${window.location.href.split('?')[0]}?id=tools-devtools--dev-tools-demo&args=&viewMode=story`, 'Dev Tools', 'popup=true,width=800,height=500'));
|
|
133
|
+
},
|
|
88
134
|
menu: { items: footerMenuMock }
|
|
89
135
|
} }));
|
|
90
136
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewShell.stories.js","sourceRoot":"","sources":["../../../src/tools/PreviewShell/PreviewShell.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,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,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC;QACzD,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC5B;IACD,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IACzC,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IAC3C,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;CAC/C,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\nimport { action } from '@storybook/addon-actions';\nimport { useState } from 'react';\n\nimport { PreviewShell, PreviewShellProps } from '@pega/cosmos-react-tools';\nimport { StatusProps } from '@pega/cosmos-react-core';\n\nimport { footerMenuMock, footerTabsMockContent, footerTabsMock } from './PreviewShell.mocks';\n\nexport default {\n title: 'Tools/PreviewShell',\n component: PreviewShell,\n parameters: {\n layout: 'fullscreen'\n }\n} as Meta;\n\ninterface PreviewShellStoryProps extends PreviewShellProps {\n appName: PreviewShellProps['header']['appName'];\n statusVariant: StatusProps['variant'];\n statusText: string;\n operatorName: PreviewShellProps['header']['operator']['avatar']['name'];\n expandFooter: PreviewShellProps['footer']['expanded'];\n}\n\nexport const PreviewShellSkeleton: Story<PreviewShellStoryProps> = (\n args: PreviewShellStoryProps\n) => {\n const [tabContent, setTabContent] = useState('Tab 1 content');\n\n return (\n <PreviewShell\n frameurl=''\n header={{\n appName: args.appName,\n status: {\n variant: args.statusVariant,\n children: args.statusText\n },\n operator: {\n avatar: { name: args.operatorName || '' },\n actions: [\n { primary: 'Profile', id: 'profile' },\n { primary: 'Settings', id: 'settings' },\n { primary: 'My applications', id: 'apps' },\n { primary: 'Help center', id: 'help' },\n { primary: 'Log out', id: 'logout' }\n ],\n name: args.operatorName\n }\n }}\n footer={{\n tabs: footerTabsMock,\n tabContent,\n onTabClick: (id: string) => {\n setTabContent(`Tab ${+id + 1} content`);\n },\n expanded: args.expandFooter,\n newTabHref: 'https://www.pega.com',\n menu: { items: footerMenuMock }\n }}\n />\n );\n};\n\nPreviewShellSkeleton.args = {\n appName: 'Title',\n statusVariant: 'pending',\n statusText: 'status',\n operatorName: 'Cindy Turner',\n expandFooter: true\n};\n\nPreviewShellSkeleton.argTypes = {\n appName: { control: { type: 'text' } },\n statusVariant: {\n options: ['success', 'urgent', 'warn', 'pending', 'info'],\n control: { type: 'select' }\n },\n statusText: { control: { type: 'text' } },\n operatorName: { control: { type: 'text' } },\n expandFooter: { control: { type: 'boolean' } }\n};\n\nexport const PreviewShellDemo: Story<PreviewShellStoryProps> = (args: PreviewShellStoryProps) => {\n const [tabContent, setTabContent] = useState(footerTabsMockContent[0]);\n\n return (\n <PreviewShell\n frameurl={`${window.location.origin}/iframe.html?id=core-pagetemplates--tabbed-page-demo&args=&viewMode=story`}\n header={{\n appName: args.appName,\n onClick: action('Clicked application name'),\n status: {\n variant: args.statusVariant,\n children: args.statusText\n },\n operator: {\n avatar: { name: args.operatorName },\n actions: [\n { primary: 'Profile', id: 'profile' },\n { primary: 'Settings', id: 'settings' },\n { primary: 'My applications', id: 'apps' },\n { primary: 'Help center', id: 'help' },\n { primary: 'Log out', id: 'logout' }\n ],\n name: args.operatorName\n }\n }}\n footer={{\n tabs: footerTabsMock,\n tabContent,\n onTabClick: (id: string) => {\n setTabContent(footerTabsMockContent[Number(id)]);\n },\n expanded: args.expandFooter,\n newTabHref: 'https://www.pega.com',\n menu: { items: footerMenuMock }\n }}\n />\n );\n};\n\nPreviewShellDemo.args = {\n appName: 'U+ Desk',\n statusVariant: 'pending',\n statusText: 'development',\n operatorName: 'Cindy Turner',\n expandFooter: false\n};\n\nPreviewShellDemo.argTypes = {\n appName: { control: { type: 'text' } },\n statusVariant: {\n options: ['success', 'urgent', 'warn', 'pending', 'info'],\n control: { type: 'select' }\n },\n statusText: { control: { type: 'text' } },\n operatorName: { control: { type: 'text' } },\n expandFooter: { control: { type: 'boolean'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M,EAAE,EAAE;IAC3C,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;CAC/C,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\nimport { action } from '@storybook/addon-actions';\nimport { useEffect, useState } from 'react';\n\nimport { PreviewShell, PreviewShellProps } from '@pega/cosmos-react-tools';\nimport { StatusProps } from '@pega/cosmos-react-core';\n\nimport { footerMenuMock, footerTabsMockContent, footerTabsMock } from './PreviewShell.mocks';\n\nexport default {\n title: 'Tools/PreviewShell',\n component: PreviewShell,\n parameters: {\n layout: 'fullscreen'\n }\n} as Meta;\n\ninterface PreviewShellStoryProps extends PreviewShellProps {\n appName: PreviewShellProps['header']['appName'];\n statusVariant: StatusProps['variant'];\n statusText: string;\n operatorName: PreviewShellProps['header']['operator']['avatar']['name'];\n expandFooter: PreviewShellProps['footer']['expanded'];\n onNewWindowClick: PreviewShellProps['footer']['onNewWindowClick'];\n}\n\nexport const PreviewShellSkeleton: Story<PreviewShellStoryProps> = (\n args: PreviewShellStoryProps\n) => {\n const [tabContent, setTabContent] = useState('Tab 1 content');\n const [currentTabId, setCurrentTabId] = useState(footerTabsMock[0].id);\n const [newWindow, setNewWindow] = useState<Window | null>(null);\n\n return (\n <PreviewShell\n frameurl=''\n header={{\n appName: args.appName,\n status: {\n variant: args.statusVariant,\n children: args.statusText\n },\n operator: {\n avatar: { name: args.operatorName || '' },\n actions: [\n { primary: 'Profile', id: 'profile' },\n { primary: 'Settings', id: 'settings' },\n { primary: 'My applications', id: 'apps' },\n { primary: 'Help center', id: 'help' },\n { primary: 'Log out', id: 'logout' }\n ],\n name: args.operatorName\n }\n }}\n footer={{\n tabs: footerTabsMock,\n tabContent,\n currentTabId,\n onTabClick: (id: string) => {\n setTabContent(`Tab ${+id + 1} content`);\n setCurrentTabId(id);\n },\n expanded: args.expandFooter,\n onContinueDebug: newWindow\n ? () => {\n newWindow?.focus();\n }\n : undefined,\n onNewWindowClick:\n args.onNewWindowClick ??\n (() => {\n const newWindowObj = window.open(\n `${window.location.origin}/iframe.html?id=tools-devtools--dev-tools-demo&args=&viewMode=story`\n );\n setNewWindow(newWindowObj);\n newWindowObj?.addEventListener('load', () => {\n newWindowObj?.addEventListener('beforeunload', () => {\n setNewWindow(null);\n });\n newWindowObj?.addEventListener('unload', () => {\n (\n document.querySelector('button[aria-label=\"Open in new window\"]') as HTMLElement\n )?.focus();\n });\n });\n }),\n menu: { items: footerMenuMock }\n }}\n />\n );\n};\n\nPreviewShellSkeleton.args = {\n appName: 'Title',\n statusVariant: 'pending',\n statusText: 'status',\n operatorName: 'Cindy Turner',\n expandFooter: true,\n onNewWindowClick: undefined\n};\n\nPreviewShellSkeleton.argTypes = {\n appName: { control: { type: 'text' } },\n statusVariant: {\n options: ['success', 'urgent', 'warn', 'pending', 'info'],\n control: { type: 'select' }\n },\n statusText: { control: { type: 'text' } },\n operatorName: { control: { type: 'text' } },\n expandFooter: { control: { type: 'boolean' } },\n onNewWindowClick: { table: { disable: true } }\n};\n\nexport const PreviewShellDemo: Story<PreviewShellStoryProps> = (args: PreviewShellStoryProps) => {\n const [tabContent, setTabContent] = useState(footerTabsMockContent[1]);\n const [currentTabId, setCurrentTabId] = useState(footerTabsMock[1].id);\n const [newWindow, setNewWindow] = useState<Window | null>(null);\n\n useEffect(() => {\n if (newWindow?.self) {\n newWindow.onload = () => {\n newWindow.onbeforeunload = () => {\n setNewWindow(null);\n };\n newWindow.onunload = () => {\n (\n document.querySelector('button[aria-label=\"Open in new window\"]') as HTMLElement\n )?.focus();\n };\n };\n }\n }, [newWindow]);\n\n return (\n <PreviewShell\n frameurl={`${\n window.location.href.split('?')[0]\n }?id=core-pagetemplates--tabbed-page-demo&args=&viewMode=story`}\n header={{\n appName: args.appName,\n onClick: action('Clicked application name'),\n status: {\n variant: args.statusVariant,\n children: args.statusText\n },\n operator: {\n avatar: { name: args.operatorName },\n actions: [\n { primary: 'Profile', id: 'profile' },\n { primary: 'Settings', id: 'settings' },\n { primary: 'My applications', id: 'apps' },\n { primary: 'Help center', id: 'help' },\n { primary: 'Log out', id: 'logout' }\n ],\n name: args.operatorName\n }\n }}\n footer={{\n tabs: footerTabsMock,\n currentTabId,\n tabContent,\n onTabClick: (id: string) => {\n setTabContent(footerTabsMockContent[Number(id)]);\n setCurrentTabId(id);\n },\n expanded: args.expandFooter,\n onContinueDebug: newWindow\n ? () => {\n newWindow?.focus();\n }\n : undefined,\n onNewWindowClick: () => {\n setNewWindow(\n window.open(\n `${\n window.location.href.split('?')[0]\n }?id=tools-devtools--dev-tools-demo&args=&viewMode=story`,\n 'Dev Tools',\n 'popup=true,width=800,height=500'\n )\n );\n },\n menu: { items: footerMenuMock }\n }}\n />\n );\n};\n\nPreviewShellDemo.args = {\n appName: 'U+ Desk',\n statusVariant: 'pending',\n statusText: 'development',\n operatorName: 'Cindy Turner',\n expandFooter: false\n};\n\nPreviewShellDemo.argTypes = {\n appName: { control: { type: 'text' } },\n statusVariant: {\n options: ['success', 'urgent', 'warn', 'pending', 'info'],\n control: { type: 'select' }\n },\n statusText: { control: { type: 'text' } },\n operatorName: { control: { type: 'text' } },\n expandFooter: { control: { type: 'boolean' } }\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-demos",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.29.0",
|
|
4
4
|
"author": "Pegasystems",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"build": "tsc -b"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@pega/cosmos-react-build": "3.0.0-dev.
|
|
24
|
-
"@pega/cosmos-react-condition-builder": "3.0.0-dev.
|
|
25
|
-
"@pega/cosmos-react-core": "3.0.0-dev.
|
|
26
|
-
"@pega/cosmos-react-cs": "3.0.0-dev.
|
|
27
|
-
"@pega/cosmos-react-dnd": "3.0.0-dev.
|
|
28
|
-
"@pega/cosmos-react-rte": "3.0.0-dev.
|
|
29
|
-
"@pega/cosmos-react-social": "3.0.0-dev.
|
|
30
|
-
"@pega/cosmos-react-work": "3.0.0-dev.
|
|
23
|
+
"@pega/cosmos-react-build": "3.0.0-dev.29.0",
|
|
24
|
+
"@pega/cosmos-react-condition-builder": "3.0.0-dev.29.0",
|
|
25
|
+
"@pega/cosmos-react-core": "3.0.0-dev.29.0",
|
|
26
|
+
"@pega/cosmos-react-cs": "3.0.0-dev.29.0",
|
|
27
|
+
"@pega/cosmos-react-dnd": "3.0.0-dev.29.0",
|
|
28
|
+
"@pega/cosmos-react-rte": "3.0.0-dev.29.0",
|
|
29
|
+
"@pega/cosmos-react-social": "3.0.0-dev.29.0",
|
|
30
|
+
"@pega/cosmos-react-work": "3.0.0-dev.29.0",
|
|
31
31
|
"@types/emoji-mart": "^3.0.4",
|
|
32
32
|
"@types/react": "^16.14.24 || ^17.0.38",
|
|
33
33
|
"@types/react-dom": "^16.9.14 || ^17.0.11",
|