@pega/cosmos-react-demos 3.0.0-dev.18.2 → 3.0.0-dev.19.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.
Files changed (111) hide show
  1. package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.mocks.d.ts +1 -1
  2. package/jsx/condition-builder/ConditionBuilder/ConditionBuilder.mocks.d.ts.map +1 -1
  3. package/jsx/core/AppShell/AppShell.stories.jsx +2 -2
  4. package/jsx/core/AppShell/AppShell.stories.jsx.map +1 -1
  5. package/jsx/core/PageTemplates/PageTemplates.mocks.d.ts +1 -1
  6. package/jsx/core/PageTemplates/PageTemplates.mocks.d.ts.map +1 -1
  7. package/jsx/core/Tree/Tree.mocks.d.ts +1 -1
  8. package/jsx/core/Tree/Tree.mocks.d.ts.map +1 -1
  9. package/jsx/cs/CSCaseView/{CSCaseView.mocks.d.ts → CSAppShell.mocks.d.ts} +8 -1
  10. package/jsx/cs/CSCaseView/CSAppShell.mocks.d.ts.map +1 -0
  11. package/jsx/cs/CSCaseView/{CSCaseView.mocks.jsx → CSAppShell.mocks.jsx} +52 -6
  12. package/jsx/cs/CSCaseView/CSAppShell.mocks.jsx.map +1 -0
  13. package/jsx/cs/CSCaseView/CSAppShell.stories.d.ts.map +1 -1
  14. package/jsx/cs/CSCaseView/CSAppShell.stories.jsx +11 -35
  15. package/jsx/cs/CSCaseView/CSAppShell.stories.jsx.map +1 -1
  16. package/jsx/cs/TaskManager/TaskManager.mocks.d.ts +12 -0
  17. package/jsx/cs/TaskManager/TaskManager.mocks.d.ts.map +1 -1
  18. package/jsx/cs/TaskManager/TaskManager.mocks.js +86 -0
  19. package/jsx/cs/TaskManager/TaskManager.mocks.js.map +1 -1
  20. package/jsx/cs/TaskManager/TaskManager.stories.d.ts.map +1 -1
  21. package/jsx/cs/TaskManager/TaskManager.stories.jsx +81 -20
  22. package/jsx/cs/TaskManager/TaskManager.stories.jsx.map +1 -1
  23. package/jsx/cs/TaskManager/TaskManager.styles.js +2 -1
  24. package/jsx/cs/TaskManager/TaskManager.styles.js.map +1 -1
  25. package/jsx/rte/RichTextEditor/RichTextViewer.stories.jsx +1 -1
  26. package/jsx/rte/RichTextEditor/RichTextViewer.stories.jsx.map +1 -1
  27. package/jsx/social/Email/Email.mocks.d.ts +24 -1
  28. package/jsx/social/Email/Email.mocks.d.ts.map +1 -1
  29. package/jsx/social/Email/Email.mocks.jsx +107 -0
  30. package/jsx/social/Email/Email.mocks.jsx.map +1 -1
  31. package/jsx/social/Email/Email.stories.d.ts +22 -23
  32. package/jsx/social/Email/Email.stories.d.ts.map +1 -1
  33. package/jsx/social/Email/Email.stories.jsx +149 -369
  34. package/jsx/social/Email/Email.stories.jsx.map +1 -1
  35. package/jsx/social/Email/Email.styles.d.ts +0 -1
  36. package/jsx/social/Email/Email.styles.d.ts.map +1 -1
  37. package/jsx/social/Email/Email.styles.js +0 -3
  38. package/jsx/social/Email/Email.styles.js.map +1 -1
  39. package/jsx/work/Confirmation/Confirmation.stories.d.ts +3 -0
  40. package/jsx/work/Confirmation/Confirmation.stories.d.ts.map +1 -1
  41. package/jsx/work/Confirmation/Confirmation.stories.jsx +12 -8
  42. package/jsx/work/Confirmation/Confirmation.stories.jsx.map +1 -1
  43. package/jsx/work/Details/Details.stories.d.ts.map +1 -1
  44. package/jsx/work/Details/Details.stories.jsx +53 -64
  45. package/jsx/work/Details/Details.stories.jsx.map +1 -1
  46. package/jsx/work/Tasks/Tasks.stories.d.ts +4 -1
  47. package/jsx/work/Tasks/Tasks.stories.d.ts.map +1 -1
  48. package/jsx/work/Tasks/Tasks.stories.jsx +20 -9
  49. package/jsx/work/Tasks/Tasks.stories.jsx.map +1 -1
  50. package/jsx/wss/QuickCreate/QuickCreate.stories.d.ts +10 -0
  51. package/jsx/wss/QuickCreate/QuickCreate.stories.d.ts.map +1 -0
  52. package/jsx/wss/QuickCreate/QuickCreate.stories.jsx +37 -0
  53. package/jsx/wss/QuickCreate/QuickCreate.stories.jsx.map +1 -0
  54. package/lib/condition-builder/ConditionBuilder/ConditionBuilder.mocks.d.ts +1 -1
  55. package/lib/condition-builder/ConditionBuilder/ConditionBuilder.mocks.d.ts.map +1 -1
  56. package/lib/core/AppShell/AppShell.stories.js +2 -2
  57. package/lib/core/AppShell/AppShell.stories.js.map +1 -1
  58. package/lib/core/PageTemplates/PageTemplates.mocks.d.ts +1 -1
  59. package/lib/core/PageTemplates/PageTemplates.mocks.d.ts.map +1 -1
  60. package/lib/core/Tree/Tree.mocks.d.ts +1 -1
  61. package/lib/core/Tree/Tree.mocks.d.ts.map +1 -1
  62. package/lib/cs/CSCaseView/{CSCaseView.mocks.d.ts → CSAppShell.mocks.d.ts} +8 -1
  63. package/lib/cs/CSCaseView/CSAppShell.mocks.d.ts.map +1 -0
  64. package/lib/cs/CSCaseView/{CSCaseView.mocks.js → CSAppShell.mocks.js} +46 -6
  65. package/lib/cs/CSCaseView/CSAppShell.mocks.js.map +1 -0
  66. package/lib/cs/CSCaseView/CSAppShell.stories.d.ts.map +1 -1
  67. package/lib/cs/CSCaseView/CSAppShell.stories.js +15 -36
  68. package/lib/cs/CSCaseView/CSAppShell.stories.js.map +1 -1
  69. package/lib/cs/TaskManager/TaskManager.mocks.d.ts +12 -0
  70. package/lib/cs/TaskManager/TaskManager.mocks.d.ts.map +1 -1
  71. package/lib/cs/TaskManager/TaskManager.mocks.js +86 -0
  72. package/lib/cs/TaskManager/TaskManager.mocks.js.map +1 -1
  73. package/lib/cs/TaskManager/TaskManager.stories.d.ts.map +1 -1
  74. package/lib/cs/TaskManager/TaskManager.stories.js +81 -20
  75. package/lib/cs/TaskManager/TaskManager.stories.js.map +1 -1
  76. package/lib/cs/TaskManager/TaskManager.styles.js +2 -1
  77. package/lib/cs/TaskManager/TaskManager.styles.js.map +1 -1
  78. package/lib/rte/RichTextEditor/RichTextViewer.stories.js +1 -1
  79. package/lib/rte/RichTextEditor/RichTextViewer.stories.js.map +1 -1
  80. package/lib/social/Email/Email.mocks.d.ts +24 -1
  81. package/lib/social/Email/Email.mocks.d.ts.map +1 -1
  82. package/lib/social/Email/Email.mocks.js +108 -1
  83. package/lib/social/Email/Email.mocks.js.map +1 -1
  84. package/lib/social/Email/Email.stories.d.ts +22 -23
  85. package/lib/social/Email/Email.stories.d.ts.map +1 -1
  86. package/lib/social/Email/Email.stories.js +148 -363
  87. package/lib/social/Email/Email.stories.js.map +1 -1
  88. package/lib/social/Email/Email.styles.d.ts +0 -1
  89. package/lib/social/Email/Email.styles.d.ts.map +1 -1
  90. package/lib/social/Email/Email.styles.js +0 -3
  91. package/lib/social/Email/Email.styles.js.map +1 -1
  92. package/lib/work/Confirmation/Confirmation.stories.d.ts +3 -0
  93. package/lib/work/Confirmation/Confirmation.stories.d.ts.map +1 -1
  94. package/lib/work/Confirmation/Confirmation.stories.js +12 -8
  95. package/lib/work/Confirmation/Confirmation.stories.js.map +1 -1
  96. package/lib/work/Details/Details.stories.d.ts.map +1 -1
  97. package/lib/work/Details/Details.stories.js +14 -59
  98. package/lib/work/Details/Details.stories.js.map +1 -1
  99. package/lib/work/Tasks/Tasks.stories.d.ts +4 -1
  100. package/lib/work/Tasks/Tasks.stories.d.ts.map +1 -1
  101. package/lib/work/Tasks/Tasks.stories.js +20 -9
  102. package/lib/work/Tasks/Tasks.stories.js.map +1 -1
  103. package/lib/wss/QuickCreate/QuickCreate.stories.d.ts +10 -0
  104. package/lib/wss/QuickCreate/QuickCreate.stories.d.ts.map +1 -0
  105. package/lib/wss/QuickCreate/QuickCreate.stories.js +36 -0
  106. package/lib/wss/QuickCreate/QuickCreate.stories.js.map +1 -0
  107. package/package.json +10 -10
  108. package/jsx/cs/CSCaseView/CSCaseView.mocks.d.ts.map +0 -1
  109. package/jsx/cs/CSCaseView/CSCaseView.mocks.jsx.map +0 -1
  110. package/lib/cs/CSCaseView/CSCaseView.mocks.d.ts.map +0 -1
  111. package/lib/cs/CSCaseView/CSCaseView.mocks.js.map +0 -1
@@ -2,25 +2,38 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  // cSpell:words calibri Trichy Nagercoil
3
3
  import { useState, useRef, useCallback, useEffect, createRef } from 'react';
4
4
  import { action } from '@storybook/addon-actions';
5
- import { Card, CardContent, createUID, MenuButton, Icon, registerIcon, Flex, Button, menuHelpers, CardHeader, Text, SummaryList, Grid, FieldValueList, StyledLabel } from '@pega/cosmos-react-core';
5
+ import { useMemo } from '@storybook/addons';
6
+ import { Card, CardContent, createUID, MenuButton, Icon, registerIcon, Flex, Button, menuHelpers, CardHeader, Text, SummaryList, Grid, FieldValueList, StyledLabel, EmptyState } from '@pega/cosmos-react-core';
6
7
  import * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';
7
8
  import { Email as EmailComponent, EmailConversation, EmailComposer, EmailShell, EmailSummaryItem, EmailSummaryList, EntityList, EmailManager } from '@pega/cosmos-react-social';
8
- import { TagsDemo } from '../../work/Tags/Tags.stories';
9
- import { StakeHoldersDemo } from '../../work/Stakeholders/Stakeholders.stories';
10
- import { MockSummaryList } from '../../work/CaseView/CaseView.mocks';
11
- import { AttachmentsMock } from '../../work/CaseView/Attachments.mocks';
12
9
  import { AppShellDemo } from '../../core/AppShell/AppShell.stories';
13
- import { bccParticipants, ccParticipants, emailBodyContent, participants, toParticipants, emailAttachments, EntityListMockData, viewAnalysisEmailHeaderMock, topicListMock, emailActions, generateEmailConversationParticipants, templates, handleExternalEntry, emailDemoActions, LaunchAction, baseComposerProps, sentiment, emailSummaryItems, mockEmails, mockSuggestedReplies, mockEmailBodyTemplates, forwardedContent, getCompositeId, emptyFieldErrorMessage, fieldValidation } from './Email.mocks';
14
- import { StyledEmailCardContent, StyledViewAnalysis } from './Email.styles';
10
+ import { bccParticipants, ccParticipants, emailBodyContent, participants, toParticipants, emailAttachments, EntityListMockData, viewAnalysisEmailHeaderMock, topicListMock, emailActions, generateEmailConversationParticipants, templates, handleExternalEntry, emailDemoActions, LaunchAction, baseComposerProps, sentiment, emailSummaryItems, mockEmails, mockSuggestedReplies, mockEmailBodyTemplates, forwardedContent, getCompositeId, emptyFieldErrorMessage, fieldValidation, emailWorklistItemsMock, contextMenuItemsMock, highlightedEntitiesMock } from './Email.mocks';
11
+ import { StyledEmailCardContent } from './Email.styles';
15
12
  registerIcon(filterIcon);
16
13
  export default {
17
14
  title: 'Social/Email',
18
15
  component: EmailComponent
19
16
  };
20
17
  export const Email = (args) => {
21
- return (_jsx(Card, { children: _jsx(StyledEmailCardContent, { children: _jsx(EmailComponent, { id: createUID(), timeStamp: '2022-02-24T09:12', from: mockEmails['Laura Stevens'], cc: [mockEmails['Adam Gillchrist'], mockEmails['John Paul']], bcc: [mockEmails['Anton, Randy'], mockEmails['Hugh Phillips']], to: [mockEmails['Sara Davis'], mockEmails['John Brown'], mockEmails['Joe Stevens']], body: '<div> Hi Team, <br /> <br /> <div>Please find the below conversation & let us know the best fare (including taxes) per person.</div><br />Regards, <br /> Laura Stevens </div>', forwardedContent: args.forwardedContent, subject: 'Regarding flight booking', onReply: action('On reply'), onReplyAll: action('On reply all'), onForward: action('On forward'), onSuggestionClick: action('On Suggested reply clicked'), sentiment: {
22
- variant: 'positive'
23
- }, actions: emailActions, suggestions: mockSuggestedReplies, attachments: [
18
+ const emailImperativeHandle = useRef(null);
19
+ const timeout = useRef(null);
20
+ const handleRightClick = () => {
21
+ if (timeout.current) {
22
+ clearTimeout(timeout.current);
23
+ }
24
+ timeout.current = window.setTimeout(() => {
25
+ emailImperativeHandle.current?.setContextMenuItems(contextMenuItemsMock);
26
+ }, 1000);
27
+ };
28
+ return (_jsx(Card, { children: _jsx(StyledEmailCardContent, { children: _jsx(EmailComponent, { id: createUID(), timeStamp: '2021-01-05T09:12', from: mockEmails['Laura Stevens'], cc: [mockEmails['Adam Gillchrist'], mockEmails['John Paul']], bcc: [mockEmails['Anton, Randy'], mockEmails['Hugh Phillips']], to: [mockEmails['Sara Davis'], mockEmails['John Brown'], mockEmails['Joe Stevens']], body: '<div>Hi,<br/><p>I am one of the customer of Indian Overseas Bank, <b><i>Nagercoil</i></b> branch, with code <b><a href="www.google.com"><i>3967</i></a></b>. I have a saving bank account here. My account number is <i>6785420965476</i>.</p><br/><p>I have been given a debit cum ATM card from this bank and the same has been lost when I was traveling from Nagercoil to Trichy by Bus on Jan 04, 2021. I remember that my ATM card number was 1920 6746 8653 1256.</p><br/>I hereby request you to block my debit card immediately to prevent misuse of the same by some others. Also I request you to give me an new debit card as early as possible.<br/><br/>Regards,<br/>Laura Stevens</div>', forwardedContent: args.forwardedContent, entityHighlightMapping: args.enableEntityHighlighting ? highlightedEntitiesMock : undefined, subject: 'I lost my debit card', onReply: action('On reply'), onReplyAll: action('On reply all'), onForward: action('On forward'), onSuggestionClick: action('On Suggested reply clicked'), sentiment: {
29
+ variant: 'neutral'
30
+ }, actions: emailActions, suggestions: mockSuggestedReplies, contextMenu: args.enableContextMenu
31
+ ? {
32
+ onItemClick: action('onItemClick'),
33
+ onContextMenu: handleRightClick,
34
+ handle: emailImperativeHandle
35
+ }
36
+ : undefined, attachments: [
24
37
  {
25
38
  id: 'attachment_0',
26
39
  value: 'https://pega.com/media/document.doc',
@@ -40,246 +53,23 @@ export const Email = (args) => {
40
53
  }) }) }) }));
41
54
  };
42
55
  Email.args = {
56
+ enableEntityHighlighting: false,
57
+ enableContextMenu: false,
43
58
  // eslint-disable-next-line demo-patterns/literal-args
44
- forwardedContent: `
45
- <div id="pega-email-message-forward" style="font-family:OpenSans,sans-serif; border-left: 1px solid #c4c4c4; padding-left: 8px;">
46
- <div>
47
- <p class="pega-email-forward-header" style="font-size:smaller;color:#90909D;">--------------------Forwarded message--------------------<br />From: Person, Example &lt;example.person@pega.com&gt; &nbsp;<br />Date: Feb 23, 2022 9:29:59 PM&nbsp;<br />Subject: Regarding flight booking &nbsp;<br />To: Laura, Stevens &lt;laurastevens@example.com&gt;<br />&nbsp;</p>
48
- </div>
49
- <div class="pega-email-forward-content">
50
- <div class="WordSection1">
51
- <p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:'calibri' , sans-serif"><span style="color:black">Hi,&nbsp; </span></p>
52
- <p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:'calibri' , sans-serif"><span style="color:black">&nbsp;&nbsp; </span></p>
53
- <p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:'calibri' , sans-serif"><span style="color:black">I need to book a flight from Hyderabad to Chennai.&nbsp; </span></p>
54
- <p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:'calibri' , sans-serif"><span style="color:black">Please let me know the fare including taxes per each person. </span></p>
55
- <p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:'calibri' , sans-serif"><span style="color:black">&nbsp;&nbsp; </span></p>
56
- <p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:'calibri' , sans-serif"><span style="color:black">Thanks,&nbsp; </span></p>
57
- <p class="MsoNormal" style="margin:0cm;font-size:11pt;font-family:'calibri' , sans-serif"><span style="color:black">Goutham </span></p>
58
- </div>
59
- </div>
60
- </div>
61
- `
59
+ forwardedContent
62
60
  };
63
61
  Email.argTypes = {
64
- forwardedContent: { control: { type: 'text' } }
65
- };
66
- export const ViewAnalysis = (args) => {
67
- const itemCounter = useRef(3);
68
- const imperativeHandle = useRef(null);
69
- const headerProps = {
70
- icon: 'list-number',
71
- text: 'Entities'
72
- };
73
- const itemsToRender = topicListMock.map(items => {
74
- return {
75
- ...items,
76
- primary: _jsx(StyledLabel, { children: items.primary }),
77
- secondary: (_jsxs(Flex, { container: { direction: 'row', justify: 'between' }, children: [_jsx(Text, { variant: 'primary', children: items.secondary.indicator }), _jsx(StyledLabel, { children: items.secondary.value })] }))
78
- };
79
- });
80
- const handleRightClick = () => {
81
- itemCounter.current += 1;
82
- setTimeout(() => {
83
- imperativeHandle.current?.setContextMenuItems(args.enableContextMenu
84
- ? [
85
- {
86
- id: 'item_0',
87
- primary: 'Field 1',
88
- selected: itemCounter.current % 2 === 0
89
- },
90
- {
91
- id: 'item_1',
92
- primary: 'Field 2',
93
- selected: true
94
- },
95
- {
96
- id: 'item_2',
97
- primary: 'Field 3',
98
- selected: true
99
- },
100
- {
101
- id: `item_${itemCounter.current}`,
102
- primary: `Field ${itemCounter.current + 1}`,
103
- selected: true
104
- }
105
- ]
106
- : []);
107
- }, 3000);
108
- };
109
- return (_jsx(StyledViewAnalysis, { children: _jsxs(Grid, { container: { rowGap: 2 }, children: [_jsx(EntityList, { header: headerProps, content: EntityListMockData, contextMenu: {
110
- onItemClick: action('onItemClick'),
111
- onContextMenu: args.onContextMenu || handleRightClick,
112
- handle: imperativeHandle
113
- } }), _jsxs(Card, { children: [_jsxs(CardHeader, { container: { alignItems: 'center', gap: 1 }, children: [_jsx(Icon, { name: 'document-doc' }), _jsx(Text, { variant: 'h3', children: "Email header" })] }), _jsx(CardContent, { children: _jsx(FieldValueList, { fields: viewAnalysisEmailHeaderMock, variant: 'stacked' }) })] }), _jsx(SummaryList, { name: 'Topics', icon: 'headline', items: itemsToRender, noItemsText: 'No items' })] }) }));
114
- };
115
- ViewAnalysis.args = {
116
- enableContextMenu: true
117
- };
118
- ViewAnalysis.argTypes = {
119
- enableContextMenu: { control: { type: 'boolean' } }
120
- };
121
- export const EmailEntities = (args) => {
122
- const nestedEntities = ['Place: Nagercoil, Hyderabad', 'Location: Nagercoil'];
123
- const emailImperativeHandle = useRef(null);
124
- const itemCounter = useRef(3);
125
- const handleRightClick = (id) => {
126
- itemCounter.current += 1;
127
- setTimeout(() => {
128
- emailImperativeHandle.current?.setContextMenuItems(args.enableContextMenu
129
- ? [
130
- {
131
- id: 'item_0',
132
- primary: 'Field 1',
133
- selected: itemCounter.current % 2 === 0
134
- },
135
- {
136
- id: 'item_1',
137
- primary: 'Field 2',
138
- selected: true
139
- },
140
- {
141
- id: `item_2 ${id}`,
142
- primary: 'Field 3',
143
- selected: true
144
- },
145
- {
146
- id: `item_${itemCounter.current}`,
147
- primary: `Field ${itemCounter.current + 1}`,
148
- selected: true
149
- }
150
- ]
151
- : []);
152
- }, 3000);
153
- };
154
- return (_jsx(Card, { children: _jsx(StyledEmailCardContent, { children: _jsx(EmailComponent, { id: createUID(), timeStamp: '2021-01-05T09:12', from: mockEmails['Laura Stevens'], cc: [mockEmails['Adam Gillchrist'], mockEmails['John Paul']], bcc: [mockEmails['Anton, Randy'], mockEmails['Hugh Phillips']], to: [mockEmails['Sara Davis'], mockEmails['John Brown'], mockEmails['Joe Stevens']], body: '<div>Hi,<br/><p>I am one of the customer of Indian Overseas Bank, <b><i>Nagercoil</i></b> branch, with code <b><a href="www.google.com"><i>3967</i></a></b>. I have a saving bank account here. My account number is <i>6785420965476</i>.</p><br/><p>I have been given a debit cum ATM card from this bank and the same has been lost when I was traveling from Nagercoil to Trichy by Bus on Jan 04, 2021. I remember that my ATM card number was 1920 6746 8653 1256.</p><br/>I hereby request you to block my debit card immediately to prevent misuse of the same by some others. Also I request you to give me an new debit card as early as possible.<br/><br/>Regards,<br/>Laura Stevens</div>', entityHighlightMapping: args.enableEntityHighlighting
155
- ? [
156
- {
157
- value: '3967',
158
- type: 'system',
159
- name: 'BranchCode',
160
- variant: 0,
161
- description: 'Branch Code'
162
- },
163
- {
164
- value: 'Laura Stevens',
165
- type: 'system',
166
- name: 'Name',
167
- variant: 1,
168
- description: 'Name'
169
- },
170
- {
171
- value: 'Nagercoil',
172
- type: 'system',
173
- name: 'Location',
174
- variant: 2,
175
- description: nestedEntities
176
- },
177
- {
178
- value: 'Trichy',
179
- type: 'system',
180
- name: 'Location',
181
- variant: 2,
182
- description: 'Location'
183
- },
184
- {
185
- value: '6785420965476',
186
- type: 'system',
187
- name: 'AccountNumber',
188
- variant: 3,
189
- description: 'Account Number'
190
- },
191
- {
192
- value: '1920 6746 8653 1256',
193
- type: 'system',
194
- name: 'CardNumber',
195
- variant: 4,
196
- description: 'Card Number'
197
- },
198
- {
199
- value: 'Debit Card',
200
- type: 'system',
201
- name: 'CardType',
202
- variant: 5,
203
- description: 'Card Type'
204
- },
205
- {
206
- value: 'Jan 04, 2021',
207
- type: 'system',
208
- name: 'Date',
209
- variant: 6,
210
- description: 'Date'
211
- }
212
- ]
213
- : undefined, subject: 'I lost my debit card', onReply: action('On reply'), onReplyAll: action('On reply all'), onForward: action('On forward'), onSuggestionClick: action('On Suggested reply clicked'), sentiment: {
214
- variant: 'neutral'
215
- }, actions: emailActions, suggestions: mockSuggestedReplies, contextMenu: {
216
- onItemClick: action('onItemClick'),
217
- onContextMenu: handleRightClick,
218
- handle: emailImperativeHandle
219
- } }) }) }));
220
- };
221
- EmailEntities.args = {
222
- enableEntityHighlighting: true,
223
- enableContextMenu: true
224
- };
225
- EmailEntities.argTypes = {
226
62
  enableEntityHighlighting: { control: { type: 'boolean' } },
227
- enableContextMenu: { control: { type: 'boolean' } }
228
- };
229
- /*
230
-
231
- _____ _ _ ____ _ _
232
- | ____|_ __ ___ __ _(_) | / ___|___ _ ____ _____ _ __ ___ __ _| |_(_) ___ _ __
233
- | _| | '_ ` _ \ / _` | | | | | / _ \| '_ \ \ / / _ \ '__/ __|/ _` | __| |/ _ \| '_ \
234
- | |___| | | | | | (_| | | | | |__| (_) | | | \ V / __/ | \__ \ (_| | |_| | (_) | | | |
235
- |_____|_| |_| |_|\__,_|_|_| \____\___/|_| |_|\_/ \___|_| |___/\__,_|\__|_|\___/|_| |_|
236
-
237
-
238
- */
239
- export const EmailConversationDemo = () => {
240
- const emailArr = [
241
- {
242
- id: 'item_0',
243
- timeStamp: '2021-01-05T09:12',
244
- from: mockEmails['Laura Stevens'],
245
- cc: [mockEmails['Adam Gillchrist'], mockEmails['John Paul']],
246
- bcc: [mockEmails['Anton, Randy'], mockEmails['Hugh Phillips']],
247
- to: [mockEmails['Sara Davis'], mockEmails['John Brown'], mockEmails['Joe Stevens']],
248
- body: '<div> Hi, <br /> <br /> <div>Sure.. Here is your E-Ticket !! </div> <br /><br /> Regards, <br /> Laura Stevens </div>',
249
- unRead: true,
250
- onReply: action('On reply'),
251
- onForward: action('On forward'),
252
- onSuggestionClick: action('On Suggested reply clicked'),
253
- actions: emailActions,
254
- suggestions: mockSuggestedReplies
255
- },
256
- {
257
- id: 'item_1',
258
- timeStamp: '2021-01-02T03:12',
259
- from: mockEmails['Sara Davis'],
260
- cc: [mockEmails['Adam Gillchrist'], mockEmails['John Paul']],
261
- bcc: [mockEmails['Anton, Randy'], mockEmails['Hugh Phillips']],
262
- to: [mockEmails['Laura Stevens'], mockEmails['John Brown'], mockEmails['Joe Stevens']],
263
- body: '<div> Hi, <br /> <br /> <div>I’m still at the airport, I need help now!! </div> <br /><br /> Regards, <br /> Sara Davis </div>',
264
- onReply: action('On reply'),
265
- onForward: action('On forward'),
266
- onSuggestionClick: action('On Suggested reply clicked'),
267
- actions: emailActions
268
- }
269
- ];
270
- return (_jsx(EmailConversation, { participants: generateEmailConversationParticipants(emailArr), from: generateEmailConversationParticipants(emailArr, ['from'])[0], to: generateEmailConversationParticipants(emailArr, ['to']), id: createUID(), timeStamp: emailArr[0].timeStamp, unReadEmailCount: emailArr.filter(item => item.unRead).length, emails: emailArr }));
63
+ enableContextMenu: { control: { type: 'boolean' } },
64
+ forwardedContent: { control: { type: 'text' } }
271
65
  };
272
- /*
273
-
274
- _____ _ _ ____
275
- | ____|_ __ ___ __ _(_) | / ___|___ _ __ ___ _ __ ___ ___ ___ _ __
276
- | _| | '_ ` _ \ / _` | | | | | / _ \| '_ ` _ \| '_ \ / _ \/ __|/ _ \ '__|
277
- | |___| | | | | | (_| | | | | |__| (_) | | | | | | |_) | (_) \__ \ __/ |
278
- |_____|_| |_| |_|\__,_|_|_| \____\___/|_| |_| |_| .__/ \___/|___/\___|_|
279
- |_|
280
-
281
- */
282
- export const EmailComposerDemo = () => {
66
+ // ______ ______ .___ ___. .______ ______ _______. _______ .______
67
+ // / | / __ \ | \/ | | _ \ / __ \ / || ____|| _ \
68
+ // | ,----'| | | | | \ / | | |_) | | | | | | (----`| |__ | |_) |
69
+ // | | | | | | | |\/| | | ___/ | | | | \ \ | __| | /
70
+ // | `----.| `--' | | | | | | | | `--' | .----) | | |____ | |\ \----.
71
+ // \______| \______/ |__| |__| | _| \______/ |_______/ |_______|| _| `._____|
72
+ export const Composer = () => {
283
73
  const [composerProgress, setComposerProgress] = useState(false);
284
74
  const composerHandle = useRef(null);
285
75
  const [data, setData] = useState({
@@ -401,7 +191,46 @@ export const EmailComposerDemo = () => {
401
191
  };
402
192
  return (_jsx(EmailComposer, { handle: composerHandle, progress: composerProgress, onSend: handleOnSend, onCancel: action('On cancel'), externalValidator: handleExternalEntry, participants: participants, onChange: handleOnChange, data: data, templates: templates, onImageAdded: action('On Image added') }));
403
193
  };
404
- export const EmailDemo = (args) => {
194
+ // ______ ______ .__ __. ____ ____ _______ .______ _______. ___ .___________. __ ______ .__ __.
195
+ // / | / __ \ | \ | | \ \ / / | ____|| _ \ / | / \ | || | / __ \ | \ | |
196
+ // | ,----'| | | | | \| | \ \/ / | |__ | |_) | | (----` / ^ \ `---| |----`| | | | | | | \| |
197
+ // | | | | | | | . ` | \ / | __| | / \ \ / /_\ \ | | | | | | | | | . ` |
198
+ // | `----.| `--' | | |\ | \ / | |____ | |\ \----.----) | / _____ \ | | | | | `--' | | |\ |
199
+ // \______| \______/ |__| \__| \__/ |_______|| _| `._____|_______/ /__/ \__\ |__| |__| \______/ |__| \__|
200
+ export const Conversation = () => {
201
+ const emailArr = [
202
+ {
203
+ id: 'item_0',
204
+ timeStamp: '2021-01-05T09:12',
205
+ from: mockEmails['Laura Stevens'],
206
+ cc: [mockEmails['Adam Gillchrist'], mockEmails['John Paul']],
207
+ bcc: [mockEmails['Anton, Randy'], mockEmails['Hugh Phillips']],
208
+ to: [mockEmails['Sara Davis'], mockEmails['John Brown'], mockEmails['Joe Stevens']],
209
+ body: '<div> Hi, <br /> <br /> <div>Sure.. Here is your E-Ticket !! </div> <br /><br /> Regards, <br /> Laura Stevens </div>',
210
+ unRead: true,
211
+ onReply: action('On reply'),
212
+ onForward: action('On forward'),
213
+ onSuggestionClick: action('On Suggested reply clicked'),
214
+ actions: emailActions,
215
+ suggestions: mockSuggestedReplies
216
+ },
217
+ {
218
+ id: 'item_1',
219
+ timeStamp: '2021-01-02T03:12',
220
+ from: mockEmails['Sara Davis'],
221
+ cc: [mockEmails['Adam Gillchrist'], mockEmails['John Paul']],
222
+ bcc: [mockEmails['Anton, Randy'], mockEmails['Hugh Phillips']],
223
+ to: [mockEmails['Laura Stevens'], mockEmails['John Brown'], mockEmails['Joe Stevens']],
224
+ body: '<div> Hi, <br /> <br /> <div>I’m still at the airport, I need help now!! </div> <br /><br /> Regards, <br /> Sara Davis </div>',
225
+ onReply: action('On reply'),
226
+ onForward: action('On forward'),
227
+ onSuggestionClick: action('On Suggested reply clicked'),
228
+ actions: emailActions
229
+ }
230
+ ];
231
+ return (_jsx(EmailConversation, { participants: generateEmailConversationParticipants(emailArr), from: generateEmailConversationParticipants(emailArr, ['from'])[0], to: generateEmailConversationParticipants(emailArr, ['to']), id: createUID(), timeStamp: emailArr[0].timeStamp, unReadEmailCount: emailArr.filter(item => item.unRead).length, emails: emailArr }));
232
+ };
233
+ export const EmailShellDemo = (args) => {
405
234
  const actions = ['Transfer', 'End conversation'].map(name => ({
406
235
  primary: name,
407
236
  id: name,
@@ -751,11 +580,7 @@ export const EmailDemo = (args) => {
751
580
  emails: emailsData
752
581
  }
753
582
  ];
754
- return (_jsxs(_Fragment, { children: [_jsx(EmailShell, { style: {
755
- height: args.height,
756
- width: args.width,
757
- margin: args.margin
758
- }, headerProps: {
583
+ return (_jsxs(_Fragment, { children: [_jsx(EmailShell, { headerProps: {
759
584
  actions: (_jsxs(Flex, { container: {
760
585
  alignItems: 'center',
761
586
  gap: 0
@@ -765,50 +590,49 @@ export const EmailDemo = (args) => {
765
590
  return _jsx(EmailComposer, { ...composersData[guid] }, guid);
766
591
  }) })] }));
767
592
  };
768
- EmailDemo.args = {
593
+ EmailShellDemo.args = {
769
594
  autoCollapse: true,
770
595
  hideSuggestions: false,
771
- singleConversation: true,
772
- height: '100vh',
773
- width: '30rem',
774
- margin: 'auto'
596
+ singleConversation: true
775
597
  };
776
- EmailDemo.argTypes = {
598
+ EmailShellDemo.argTypes = {
777
599
  autoCollapse: { control: { type: 'boolean' } },
778
600
  hideSuggestions: { control: { type: 'boolean' } },
779
- singleConversation: { control: { type: 'boolean' } },
780
- width: {
781
- table: {
782
- disable: true
783
- }
784
- },
785
- height: {
786
- table: {
787
- disable: true
788
- }
789
- },
790
- margin: {
791
- table: {
792
- disable: true
601
+ singleConversation: { control: { type: 'boolean' } }
602
+ };
603
+ export const EntityListDemo = (args) => {
604
+ const itemCounter = useRef(3);
605
+ const timeout = useRef(null);
606
+ const imperativeHandle = useRef(null);
607
+ const headerProps = {
608
+ icon: 'list-number',
609
+ text: 'Entities'
610
+ };
611
+ const handleRightClick = () => {
612
+ itemCounter.current += 1;
613
+ if (timeout.current) {
614
+ clearTimeout(timeout.current);
793
615
  }
794
- }
616
+ timeout.current = window.setTimeout(() => {
617
+ imperativeHandle.current?.setContextMenuItems(contextMenuItemsMock);
618
+ }, 1000);
619
+ };
620
+ return (_jsx(EntityList, { header: headerProps, content: EntityListMockData, contextMenu: args.enableContextMenu
621
+ ? {
622
+ onItemClick: action('onItemClick'),
623
+ onContextMenu: args.onContextMenu || handleRightClick,
624
+ handle: imperativeHandle
625
+ }
626
+ : undefined }));
795
627
  };
796
- EmailDemo.parameters = {
797
- layout: 'fullscreen'
628
+ EntityListDemo.args = {
629
+ enableContextMenu: true
630
+ };
631
+ EntityListDemo.argTypes = {
632
+ enableContextMenu: { control: { type: 'boolean' } }
798
633
  };
799
- /*
800
- ______ _ _ _____ _____ _
801
- | ____| (_) | / ____| |_ _| |
802
- | |__ _ __ ___ __ _ _| | | (___ _ _ _ __ ___ _ __ ___ __ _ _ __ _ _ | | | |_ ___ _ __ ___
803
- | __| | '_ ` _ \ / _` | | | \___ \| | | | '_ ` _ \| '_ ` _ \ / _` | '__| | | | | | | __/ _ \ '_ ` _ \
804
- | |____| | | | | | (_| | | | ____) | |_| | | | | | | | | | | | (_| | | | |_| | _| |_| || __/ | | | | |
805
- |______|_| |_| |_|\__,_|_|_| |_____/ \__,_|_| |_| |_|_| |_| |_|\__,_|_| \__, | |_____|\__\___|_| |_| |_|
806
- __/ |
807
- |___/
808
- */
809
- export const EmailSummaryItemDemo = () => {
810
- const [active, setActive] = useState(false);
811
- return (_jsx(EmailSummaryItem, { style: { width: '25rem' }, id: createUID(), activeParticipants: [
634
+ export const EmailSummaryItemDemo = (args) => {
635
+ return (_jsx(EmailSummaryItem, { id: createUID(), activeParticipants: [
812
636
  {
813
637
  shortName: 'Robert',
814
638
  fullName: 'Robert Downer',
@@ -819,43 +643,24 @@ export const EmailSummaryItemDemo = () => {
819
643
  fullName: 'Nathan Swanson',
820
644
  emailAddress: 'nathan.swanson@example.com'
821
645
  }
822
- ], message: 'I have a quick question on traveling to India. How do I reach Hyderabad?', timeStamp: new Date(Date.UTC(new Date().getUTCFullYear(), new Date().getUTCMonth(), 24)), topic: 'Missing Luggage', sentiment: sentiment, urgency: 10, unreadEmailCount: active ? 0 : 8, active: active, onSelect: (id) => {
823
- setActive(true);
646
+ ], message: 'I have a quick question on traveling to India. How do I reach Hyderabad?', timeStamp: new Date(Date.UTC(new Date().getUTCFullYear(), new Date().getUTCMonth(), 24)), topic: 'Missing Luggage', sentiment: sentiment, urgency: 10, unreadEmailCount: args.unreadEmailCount, active: args.isActive, onSelect: (id) => {
824
647
  action('onSelect')(id);
825
648
  } }));
826
649
  };
650
+ EmailSummaryItemDemo.args = {
651
+ unreadEmailCount: 0,
652
+ isActive: false
653
+ };
654
+ EmailSummaryItemDemo.argTypes = {
655
+ unreadEmailCount: { control: { type: 'number' } },
656
+ isActive: { control: { type: 'boolean' } }
657
+ };
827
658
  export const EmailSummaryListDemo = (args) => {
828
659
  const INITIAL_CHUNK_SIZE = 9;
829
660
  const APPEND_CHUNK_SIZE = 1;
830
661
  const emailSummaryListRef = useRef(null);
831
662
  const [allEmailItems, setAllEmailItems] = useState(emailSummaryItems.slice(0, INITIAL_CHUNK_SIZE));
832
- const [categories, setCategories] = useState([
833
- {
834
- id: 'item_0',
835
- primary: 'Default worklist',
836
- selected: false
837
- },
838
- {
839
- id: 'item_1',
840
- primary: 'Authors',
841
- selected: false
842
- },
843
- {
844
- id: 'item_2',
845
- primary: 'Administrators',
846
- selected: false
847
- },
848
- {
849
- id: 'item_3',
850
- primary: 'Managers',
851
- selected: false
852
- },
853
- {
854
- id: 'item_4',
855
- primary: 'Users',
856
- selected: false
857
- }
858
- ]);
663
+ const [categories, setCategories] = useState(emailWorklistItemsMock);
859
664
  const handleItemClick = (id) => {
860
665
  const index = allEmailItems.findIndex(emailItem => {
861
666
  return emailItem.id === id;
@@ -885,59 +690,23 @@ export const EmailSummaryListDemo = (args) => {
885
690
  }, 1500);
886
691
  }
887
692
  }, [loading]);
888
- return (_jsx(EmailSummaryList, { style: { width: args.width, margin: args.margin, height: args.height }, ref: emailSummaryListRef, unreadEmailCount: 99, categories: categories, items: args.items || allEmailItems, onItemClick: args.onItemClick || handleItemClick, onCategoryClick: onCategoryClick, onLoadMore: args.onLoadMore || (hasMore ? loadMore : undefined), loading: args.loading || loading, emptyMessage: 'No emails.' }));
889
- };
890
- EmailSummaryListDemo.argTypes = {
891
- width: {
892
- table: {
893
- disable: true
894
- }
895
- },
896
- height: {
897
- table: {
898
- disable: true
899
- }
900
- },
901
- margin: {
902
- table: {
903
- disable: true
904
- }
905
- }
906
- };
907
- EmailSummaryListDemo.args = {
908
- height: '100vh',
909
- width: '30rem',
910
- margin: 'auto'
693
+ return (_jsx(EmailSummaryList, { ref: emailSummaryListRef, unreadEmailCount: 99, categories: categories, items: args.items || allEmailItems, onItemClick: args.onItemClick || handleItemClick, onCategoryClick: onCategoryClick, onLoadMore: args.onLoadMore || (hasMore ? loadMore : undefined), loading: args.loading || loading, emptyMessage: 'No emails.' }));
911
694
  };
912
- EmailSummaryListDemo.parameters = {
913
- layout: 'fullscreen'
914
- };
915
- export const EmailManagerDemo = () => {
695
+ export const EmailManagerAppShell = (args) => {
916
696
  const INITIAL_CHUNK_SIZE = 9;
917
697
  const APPEND_CHUNK_SIZE = 1;
918
- const initialEmailContent = (_jsxs(_Fragment, { children: [_jsx(Email, { forwardedContent: forwardedContent }), _jsx(Email, { forwardedContent: forwardedContent }), _jsx(Email, { forwardedContent: forwardedContent }), _jsx(Email, { forwardedContent: forwardedContent }), _jsx(Email, { forwardedContent: forwardedContent })] }));
919
- const demoUtilities = (_jsxs(_Fragment, { children: [_jsx(AttachmentsMock, {}), _jsx(StakeHoldersDemo, {}), _jsx(MockSummaryList, { icon: 'user-star', name: 'Followers' }), _jsx(TagsDemo, {})] }));
920
- const [content, setContent] = useState(initialEmailContent);
921
- const [utilities, setUtilities] = useState(demoUtilities);
698
+ const [activeItemId, setActiveItemId] = useState();
922
699
  const [emailList, setEmailList] = useState(emailSummaryItems.slice(0, INITIAL_CHUNK_SIZE));
923
700
  const [loading, setLoading] = useState(false);
924
701
  const [hasMore, setHasMore] = useState(true);
925
702
  const handleEmailItemClick = (id) => {
703
+ setActiveItemId(id);
926
704
  const index = emailList.findIndex(emailItem => {
927
705
  return emailItem.id === id;
928
706
  });
929
707
  const newEmailList = [...emailList];
930
708
  newEmailList.splice(index, 1, { ...emailList[index], unreadEmailCount: 0 });
931
709
  setEmailList(newEmailList);
932
- /** Show email content and utilities based on the selected email item */
933
- if (index % 2 === 0) {
934
- setContent(_jsx(EmailDemo, {}));
935
- setUtilities(_jsxs(_Fragment, { children: [_jsx(AttachmentsMock, {}), _jsx(MockSummaryList, { icon: 'user-star', name: 'Followers' })] }));
936
- }
937
- else {
938
- setContent(_jsx(EmailDemo, { singleConversation: true }));
939
- setUtilities(demoUtilities);
940
- }
941
710
  };
942
711
  const onLoadMore = useCallback(() => {
943
712
  if (!loading) {
@@ -955,17 +724,33 @@ export const EmailManagerDemo = () => {
955
724
  }, 1500);
956
725
  }
957
726
  }, [loading]);
727
+ const activeItemIndex = useMemo(() => emailList.findIndex(emailItem => emailItem.id === activeItemId), [activeItemId, emailList]);
728
+ const content = activeItemId === undefined ? (_jsx(EmptyState, { message: 'No item selected!' })) : (_jsx(EmailShellDemo, { singleConversation: activeItemIndex % 2 === 0 }));
729
+ const utilities = activeItemId === undefined ? null : (
730
+ // View analysis utility
731
+ _jsxs(Grid, { container: { rowGap: 2 }, children: [_jsx(EntityListDemo, { onContextMenu: args.onContextMenu, enableContextMenu: args.enableContextMenu }), _jsxs(Card, { children: [_jsxs(CardHeader, { container: { alignItems: 'center', gap: 1 }, children: [_jsx(Icon, { name: 'document-doc' }), _jsx(Text, { variant: 'h3', children: "Email header" })] }), _jsx(CardContent, { children: _jsx(FieldValueList, { fields: viewAnalysisEmailHeaderMock, variant: 'stacked' }) })] }), _jsx(SummaryList, { name: 'Topics', icon: 'headline', items: topicListMock.map(items => ({
732
+ ...items,
733
+ primary: _jsx(StyledLabel, { children: items.primary }),
734
+ secondary: (_jsxs(Flex, { container: { direction: 'row', justify: 'between' }, children: [_jsx(Text, { variant: 'primary', children: items.secondary.indicator }), _jsx(StyledLabel, { children: items.secondary.value })] }))
735
+ })), noItemsText: 'No items' })] }));
958
736
  return (_jsx(AppShellDemo, { appHeader: true, main: _jsx(EmailManager, { header: {
959
737
  icon: 'mail',
960
738
  title: 'Inbox'
961
- }, list: _jsx(EmailSummaryListDemo, { width: 'unset', margin: 'unset', onItemClick: handleEmailItemClick, items: emailList, onLoadMore: hasMore ? onLoadMore : undefined, loading: loading }), content: content, utilities: utilities, utilitiesSummaryItems: [
962
- { iconName: 'paper-clip', count: 4 },
963
- { iconName: 'user-search-solid', count: 10 },
964
- { iconName: 'user-star-solid', count: 5 },
965
- { iconName: 'tag', count: 10 }
966
- ], defaultCollapsedUtilities: false }) }));
739
+ }, list: _jsx(EmailSummaryListDemo, { onItemClick: handleEmailItemClick, items: emailList, onLoadMore: hasMore ? onLoadMore : undefined, loading: loading }), content: content, utilities: utilities, utilitiesSummaryItems: utilities
740
+ ? [
741
+ { iconName: 'list-number', count: 7 },
742
+ { iconName: 'document-doc', count: 1 },
743
+ { iconName: 'headline', count: 4 }
744
+ ]
745
+ : undefined, defaultCollapsedUtilities: !!utilities }) }));
746
+ };
747
+ EmailManagerAppShell.args = {
748
+ enableContextMenu: true
749
+ };
750
+ EmailManagerAppShell.argTypes = {
751
+ enableContextMenu: { control: { type: 'boolean' } }
967
752
  };
968
- EmailManagerDemo.parameters = {
753
+ EmailManagerAppShell.parameters = {
969
754
  layout: 'fullscreen'
970
755
  };
971
756
  //# sourceMappingURL=Email.stories.js.map