@pega/cosmos-react-demos 3.0.0-dev.22.0 → 3.0.0-dev.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/jsx/build/AppHeader/AppHeader.stories.jsx +1 -1
  2. package/jsx/build/AppHeader/AppHeader.stories.jsx.map +1 -1
  3. package/jsx/build/ObjectSelect/ObjectSelect.mocks.d.ts.map +1 -1
  4. package/jsx/build/ObjectSelect/ObjectSelect.mocks.jsx +2 -1
  5. package/jsx/build/ObjectSelect/ObjectSelect.mocks.jsx.map +1 -1
  6. package/jsx/condition-builder/PromotedFilters/PromotedFilters.mocks.d.ts.map +1 -1
  7. package/jsx/condition-builder/PromotedFilters/PromotedFilters.mocks.js +91 -0
  8. package/jsx/condition-builder/PromotedFilters/PromotedFilters.mocks.js.map +1 -1
  9. package/jsx/core/AppShell/AppShell.stories.d.ts +1 -0
  10. package/jsx/core/AppShell/AppShell.stories.d.ts.map +1 -1
  11. package/jsx/core/AppShell/AppShell.stories.jsx +1 -1
  12. package/jsx/core/AppShell/AppShell.stories.jsx.map +1 -1
  13. package/jsx/core/Banner/Banner.stories.d.ts +0 -1
  14. package/jsx/core/Banner/Banner.stories.d.ts.map +1 -1
  15. package/jsx/core/Banner/Banner.stories.jsx +0 -8
  16. package/jsx/core/Banner/Banner.stories.jsx.map +1 -1
  17. package/jsx/core/CreditCard/CreditCard.stories.jsx +1 -1
  18. package/jsx/core/CreditCard/CreditCard.stories.jsx.map +1 -1
  19. package/jsx/core/Currency/Currency.stories.d.ts +5 -3
  20. package/jsx/core/Currency/Currency.stories.d.ts.map +1 -1
  21. package/jsx/core/Currency/Currency.stories.jsx +2 -2
  22. package/jsx/core/Currency/Currency.stories.jsx.map +1 -1
  23. package/jsx/core/DateTime/DateTime.stories.d.ts.map +1 -1
  24. package/jsx/core/DateTime/DateTime.stories.jsx +3 -0
  25. package/jsx/core/DateTime/DateTime.stories.jsx.map +1 -1
  26. package/jsx/core/FieldGroup/FieldGroupList.stories.d.ts.map +1 -1
  27. package/jsx/core/FieldGroup/FieldGroupList.stories.jsx +4 -0
  28. package/jsx/core/FieldGroup/FieldGroupList.stories.jsx.map +1 -1
  29. package/jsx/core/FieldValueList/FieldValueList.stories.jsx +1 -1
  30. package/jsx/core/FieldValueList/FieldValueList.stories.jsx.map +1 -1
  31. package/jsx/core/FieldValueList/FieldValueList.styles.d.ts +2 -0
  32. package/jsx/core/FieldValueList/FieldValueList.styles.d.ts.map +1 -0
  33. package/{lib/core/FieldValueList/FieldValueList.mocks.js → jsx/core/FieldValueList/FieldValueList.styles.js} +2 -3
  34. package/jsx/core/FieldValueList/FieldValueList.styles.js.map +1 -0
  35. package/jsx/core/Number/Number.stories.d.ts +1 -1
  36. package/jsx/core/Number/Number.stories.d.ts.map +1 -1
  37. package/jsx/core/Number/Number.stories.jsx +4 -4
  38. package/jsx/core/Number/Number.stories.jsx.map +1 -1
  39. package/jsx/cs/CallControlPanel/CallControlPanel.stories.d.ts.map +1 -1
  40. package/jsx/cs/CallControlPanel/CallControlPanel.stories.jsx +12 -1
  41. package/jsx/cs/CallControlPanel/CallControlPanel.stories.jsx.map +1 -1
  42. package/jsx/cs/IntelligentGuidance/IntelligentGuidance.stories.jsx +2 -2
  43. package/jsx/cs/IntelligentGuidance/IntelligentGuidance.stories.jsx.map +1 -1
  44. package/jsx/cs/InteractionNotification/InteractionNotification.stories.d.ts +1 -0
  45. package/jsx/cs/InteractionNotification/InteractionNotification.stories.d.ts.map +1 -1
  46. package/jsx/cs/InteractionNotification/InteractionNotification.stories.jsx +6 -6
  47. package/jsx/cs/InteractionNotification/InteractionNotification.stories.jsx.map +1 -1
  48. package/jsx/social/Email/Email.stories.d.ts.map +1 -1
  49. package/jsx/social/Email/Email.stories.jsx +19 -0
  50. package/jsx/social/Email/Email.stories.jsx.map +1 -1
  51. package/jsx/social/Feed/Feed.stories.d.ts.map +1 -1
  52. package/jsx/social/Feed/Feed.stories.jsx +6 -2
  53. package/jsx/social/Feed/Feed.stories.jsx.map +1 -1
  54. package/jsx/social/Feed/FeedNewPost.stories.d.ts.map +1 -1
  55. package/jsx/social/Feed/FeedNewPost.stories.jsx +1 -1
  56. package/jsx/social/Feed/FeedNewPost.stories.jsx.map +1 -1
  57. package/jsx/social/Feed/FeedPost.stories.d.ts.map +1 -1
  58. package/jsx/social/Feed/FeedPost.stories.jsx +2 -2
  59. package/jsx/social/Feed/FeedPost.stories.jsx.map +1 -1
  60. package/jsx/social/Feed/FeedReply.stories.d.ts.map +1 -1
  61. package/jsx/social/Feed/FeedReply.stories.jsx +1 -1
  62. package/jsx/social/Feed/FeedReply.stories.jsx.map +1 -1
  63. package/jsx/social/Feed/FeedReplyInput.stories.d.ts.map +1 -1
  64. package/jsx/social/Feed/FeedReplyInput.stories.jsx +1 -1
  65. package/jsx/social/Feed/FeedReplyInput.stories.jsx.map +1 -1
  66. package/jsx/work/CaseView/CaseView.mocks.d.ts +74 -2
  67. package/jsx/work/CaseView/CaseView.mocks.d.ts.map +1 -1
  68. package/jsx/work/CaseView/CaseView.mocks.jsx +198 -9
  69. package/jsx/work/CaseView/CaseView.mocks.jsx.map +1 -1
  70. package/jsx/work/CaseView/CaseView.stories.d.ts +3 -22
  71. package/jsx/work/CaseView/CaseView.stories.d.ts.map +1 -1
  72. package/jsx/work/CaseView/CaseView.stories.jsx +49 -238
  73. package/jsx/work/CaseView/CaseView.stories.jsx.map +1 -1
  74. package/jsx/wss/AppShell/AppShell.mocks.d.ts +11 -0
  75. package/jsx/wss/AppShell/AppShell.mocks.d.ts.map +1 -1
  76. package/jsx/wss/AppShell/AppShell.mocks.jsx +11 -0
  77. package/jsx/wss/AppShell/AppShell.mocks.jsx.map +1 -1
  78. package/jsx/wss/AppShell/AppShell.stories.d.ts +11 -9
  79. package/jsx/wss/AppShell/AppShell.stories.d.ts.map +1 -1
  80. package/jsx/wss/AppShell/AppShell.stories.jsx +11 -19
  81. package/jsx/wss/AppShell/AppShell.stories.jsx.map +1 -1
  82. package/jsx/wss/PageTemplates/PageTemplates.stories.d.ts +15 -0
  83. package/jsx/wss/PageTemplates/PageTemplates.stories.d.ts.map +1 -0
  84. package/jsx/wss/PageTemplates/PageTemplates.stories.jsx +48 -0
  85. package/jsx/wss/PageTemplates/PageTemplates.stories.jsx.map +1 -0
  86. package/lib/build/AppHeader/AppHeader.stories.js +1 -1
  87. package/lib/build/AppHeader/AppHeader.stories.js.map +1 -1
  88. package/lib/build/ObjectSelect/ObjectSelect.mocks.d.ts.map +1 -1
  89. package/lib/build/ObjectSelect/ObjectSelect.mocks.js +2 -1
  90. package/lib/build/ObjectSelect/ObjectSelect.mocks.js.map +1 -1
  91. package/lib/condition-builder/PromotedFilters/PromotedFilters.mocks.d.ts.map +1 -1
  92. package/lib/condition-builder/PromotedFilters/PromotedFilters.mocks.js +91 -0
  93. package/lib/condition-builder/PromotedFilters/PromotedFilters.mocks.js.map +1 -1
  94. package/lib/core/AppShell/AppShell.stories.d.ts +1 -0
  95. package/lib/core/AppShell/AppShell.stories.d.ts.map +1 -1
  96. package/lib/core/AppShell/AppShell.stories.js +1 -1
  97. package/lib/core/AppShell/AppShell.stories.js.map +1 -1
  98. package/lib/core/Banner/Banner.stories.d.ts +0 -1
  99. package/lib/core/Banner/Banner.stories.d.ts.map +1 -1
  100. package/lib/core/Banner/Banner.stories.js +0 -11
  101. package/lib/core/Banner/Banner.stories.js.map +1 -1
  102. package/lib/core/CreditCard/CreditCard.stories.js +1 -1
  103. package/lib/core/CreditCard/CreditCard.stories.js.map +1 -1
  104. package/lib/core/Currency/Currency.stories.d.ts +5 -3
  105. package/lib/core/Currency/Currency.stories.d.ts.map +1 -1
  106. package/lib/core/Currency/Currency.stories.js +2 -2
  107. package/lib/core/Currency/Currency.stories.js.map +1 -1
  108. package/lib/core/DateTime/DateTime.stories.d.ts.map +1 -1
  109. package/lib/core/DateTime/DateTime.stories.js +3 -0
  110. package/lib/core/DateTime/DateTime.stories.js.map +1 -1
  111. package/lib/core/FieldGroup/FieldGroupList.stories.d.ts.map +1 -1
  112. package/lib/core/FieldGroup/FieldGroupList.stories.js +4 -0
  113. package/lib/core/FieldGroup/FieldGroupList.stories.js.map +1 -1
  114. package/lib/core/FieldValueList/FieldValueList.stories.js +1 -1
  115. package/lib/core/FieldValueList/FieldValueList.stories.js.map +1 -1
  116. package/lib/core/FieldValueList/FieldValueList.styles.d.ts +2 -0
  117. package/lib/core/FieldValueList/FieldValueList.styles.d.ts.map +1 -0
  118. package/{jsx/core/FieldValueList/FieldValueList.mocks.js → lib/core/FieldValueList/FieldValueList.styles.js} +2 -3
  119. package/lib/core/FieldValueList/FieldValueList.styles.js.map +1 -0
  120. package/lib/core/Number/Number.stories.d.ts +1 -1
  121. package/lib/core/Number/Number.stories.d.ts.map +1 -1
  122. package/lib/core/Number/Number.stories.js +4 -4
  123. package/lib/core/Number/Number.stories.js.map +1 -1
  124. package/lib/cs/CallControlPanel/CallControlPanel.stories.d.ts.map +1 -1
  125. package/lib/cs/CallControlPanel/CallControlPanel.stories.js +12 -1
  126. package/lib/cs/CallControlPanel/CallControlPanel.stories.js.map +1 -1
  127. package/lib/cs/IntelligentGuidance/IntelligentGuidance.stories.js +2 -2
  128. package/lib/cs/IntelligentGuidance/IntelligentGuidance.stories.js.map +1 -1
  129. package/lib/cs/InteractionNotification/InteractionNotification.stories.d.ts +1 -0
  130. package/lib/cs/InteractionNotification/InteractionNotification.stories.d.ts.map +1 -1
  131. package/lib/cs/InteractionNotification/InteractionNotification.stories.js +24 -22
  132. package/lib/cs/InteractionNotification/InteractionNotification.stories.js.map +1 -1
  133. package/lib/social/Email/Email.stories.d.ts.map +1 -1
  134. package/lib/social/Email/Email.stories.js +19 -0
  135. package/lib/social/Email/Email.stories.js.map +1 -1
  136. package/lib/social/Feed/Feed.stories.d.ts.map +1 -1
  137. package/lib/social/Feed/Feed.stories.js +6 -2
  138. package/lib/social/Feed/Feed.stories.js.map +1 -1
  139. package/lib/social/Feed/FeedNewPost.stories.d.ts.map +1 -1
  140. package/lib/social/Feed/FeedNewPost.stories.js +1 -1
  141. package/lib/social/Feed/FeedNewPost.stories.js.map +1 -1
  142. package/lib/social/Feed/FeedPost.stories.d.ts.map +1 -1
  143. package/lib/social/Feed/FeedPost.stories.js +2 -2
  144. package/lib/social/Feed/FeedPost.stories.js.map +1 -1
  145. package/lib/social/Feed/FeedReply.stories.d.ts.map +1 -1
  146. package/lib/social/Feed/FeedReply.stories.js +1 -1
  147. package/lib/social/Feed/FeedReply.stories.js.map +1 -1
  148. package/lib/social/Feed/FeedReplyInput.stories.d.ts.map +1 -1
  149. package/lib/social/Feed/FeedReplyInput.stories.js +1 -1
  150. package/lib/social/Feed/FeedReplyInput.stories.js.map +1 -1
  151. package/lib/work/CaseView/CaseView.mocks.d.ts +74 -2
  152. package/lib/work/CaseView/CaseView.mocks.d.ts.map +1 -1
  153. package/lib/work/CaseView/CaseView.mocks.js +188 -9
  154. package/lib/work/CaseView/CaseView.mocks.js.map +1 -1
  155. package/lib/work/CaseView/CaseView.stories.d.ts +3 -22
  156. package/lib/work/CaseView/CaseView.stories.d.ts.map +1 -1
  157. package/lib/work/CaseView/CaseView.stories.js +44 -248
  158. package/lib/work/CaseView/CaseView.stories.js.map +1 -1
  159. package/lib/wss/AppShell/AppShell.mocks.d.ts +11 -0
  160. package/lib/wss/AppShell/AppShell.mocks.d.ts.map +1 -1
  161. package/lib/wss/AppShell/AppShell.mocks.js +11 -0
  162. package/lib/wss/AppShell/AppShell.mocks.js.map +1 -1
  163. package/lib/wss/AppShell/AppShell.stories.d.ts +11 -9
  164. package/lib/wss/AppShell/AppShell.stories.d.ts.map +1 -1
  165. package/lib/wss/AppShell/AppShell.stories.js +12 -19
  166. package/lib/wss/AppShell/AppShell.stories.js.map +1 -1
  167. package/lib/wss/PageTemplates/PageTemplates.stories.d.ts +15 -0
  168. package/lib/wss/PageTemplates/PageTemplates.stories.d.ts.map +1 -0
  169. package/lib/wss/PageTemplates/PageTemplates.stories.js +41 -0
  170. package/lib/wss/PageTemplates/PageTemplates.stories.js.map +1 -0
  171. package/package.json +10 -11
  172. package/jsx/core/FieldValueList/FieldValueList.mocks.d.ts +0 -3
  173. package/jsx/core/FieldValueList/FieldValueList.mocks.d.ts.map +0 -1
  174. package/jsx/core/FieldValueList/FieldValueList.mocks.js.map +0 -1
  175. package/jsx/cs/CSCaseView/CSAppShell.mocks.d.ts +0 -73
  176. package/jsx/cs/CSCaseView/CSAppShell.mocks.d.ts.map +0 -1
  177. package/jsx/cs/CSCaseView/CSAppShell.mocks.jsx +0 -299
  178. package/jsx/cs/CSCaseView/CSAppShell.mocks.jsx.map +0 -1
  179. package/jsx/cs/CSCaseView/CSAppShell.stories.d.ts +0 -13
  180. package/jsx/cs/CSCaseView/CSAppShell.stories.d.ts.map +0 -1
  181. package/jsx/cs/CSCaseView/CSAppShell.stories.jsx +0 -228
  182. package/jsx/cs/CSCaseView/CSAppShell.stories.jsx.map +0 -1
  183. package/lib/core/FieldValueList/FieldValueList.mocks.d.ts +0 -3
  184. package/lib/core/FieldValueList/FieldValueList.mocks.d.ts.map +0 -1
  185. package/lib/core/FieldValueList/FieldValueList.mocks.js.map +0 -1
  186. package/lib/cs/CSCaseView/CSAppShell.mocks.d.ts +0 -73
  187. package/lib/cs/CSCaseView/CSAppShell.mocks.d.ts.map +0 -1
  188. package/lib/cs/CSCaseView/CSAppShell.mocks.js +0 -280
  189. package/lib/cs/CSCaseView/CSAppShell.mocks.js.map +0 -1
  190. package/lib/cs/CSCaseView/CSAppShell.stories.d.ts +0 -13
  191. package/lib/cs/CSCaseView/CSAppShell.stories.d.ts.map +0 -1
  192. package/lib/cs/CSCaseView/CSAppShell.stories.js +0 -210
  193. package/lib/cs/CSCaseView/CSAppShell.stories.js.map +0 -1
@@ -1,27 +1,8 @@
1
- import { ReactElement } from 'react';
2
1
  import { Meta, Story } from '@storybook/react';
3
- import { MenuItemProps } from '@pega/cosmos-react-core';
4
- import { CaseViewProps, CaseHeaderProps, CaseSummaryFieldsProps } from '@pega/cosmos-react-work';
5
2
  declare const _default: Meta<import("@storybook/react").Args>;
6
3
  export default _default;
7
- export interface CaseViewStoryProps {
8
- banners?: CaseViewProps['banners'];
9
- persistentUtility?: CaseViewProps['persistentUtility'];
10
- caseId?: string;
11
- heading?: string;
12
- icon?: ReactElement;
13
- parentCases?: MenuItemProps[];
14
- primaryFields?: CaseSummaryFieldsProps['primaryFields'];
15
- secondaryFields?: CaseSummaryFieldsProps['secondaryFields'];
16
- actions?: CaseHeaderProps['actions'];
17
- tabs?: any;
18
- tasksWidget?: ReactElement;
19
- stages?: boolean;
20
- showUtilities?: boolean;
21
- showFollowedIcon?: boolean;
22
- defaultCollapsedUtilities?: boolean;
4
+ export interface CaseViewStoryArgs {
5
+ persistentUtility?: boolean;
23
6
  }
24
- export declare const CaseViewDemo: Story<CaseViewStoryProps>;
25
- export declare const CaseViewWithAppShell: Story;
26
- export declare const CaseViewWithChat: Story;
7
+ export declare const CaseViewDemo: Story<CaseViewStoryArgs>;
27
8
  //# sourceMappingURL=CaseView.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CaseView.stories.d.ts","sourceRoot":"","sources":["../../../src/work/CaseView/CaseView.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAW,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAML,aAAa,EAEd,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAEL,aAAa,EAEb,eAAe,EAEf,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;;AAiBjC,wBAOU;AAEV,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACnC,iBAAiB,CAAC,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,WAAW,CAAC,EAAE,aAAa,EAAE,CAAC;IAC9B,aAAa,CAAC,EAAE,sBAAsB,CAAC,eAAe,CAAC,CAAC;IACxD,eAAe,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAC5D,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAUD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,kBAAkB,CA2WlD,CAAC;AAYF,eAAO,MAAM,oBAAoB,EAAE,KAElC,CAAC;AAuBF,eAAO,MAAM,gBAAgB,EAAE,KAY9B,CAAC"}
1
+ {"version":3,"file":"CaseView.stories.d.ts","sourceRoot":"","sources":["../../../src/work/CaseView/CaseView.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;;AA2B/C,wBAOU;AAEV,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,iBAAiB,CA2HjD,CAAC"}
@@ -1,20 +1,13 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState, useMemo } from 'react';
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
3
  import { action } from '@storybook/addon-actions';
4
- import { Icon, registerIcon, Status, Link, Grid, useBreakpoint } from '@pega/cosmos-react-core';
4
+ import { Icon, registerIcon, Grid, useBreakpoint } from '@pega/cosmos-react-core';
5
5
  import * as userSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/user-solid.icon';
6
6
  import { CaseView, CasePreview, CaseSummaryFields } from '@pega/cosmos-react-work';
7
7
  import { TasksDemo } from '../Tasks/Tasks.stories';
8
8
  import { AppShellDemo } from '../../core/AppShell/AppShell.stories';
9
- import { TableDemo } from '../../core/Table/Table.stories';
10
- import { StandardChat } from '../../social/Chat/Chat.stories';
11
- import { TagsDemo } from '../Tags/Tags.stories';
12
9
  import { StagesDemo } from '../Stages/Stages.stories';
13
- import { StakeHoldersDemo } from '../Stakeholders/Stakeholders.stories';
14
- import { Details } from './Details.mocks';
15
- import { PulseMock } from './Pulse.mocks';
16
- import { AttachmentsMock } from './Attachments.mocks';
17
- import { getTabs, MockOperatorFieldValue, MockSummaryList } from './CaseView.mocks';
10
+ import { baseCaseTabs, casePreviewPrimaryFields, casePreviewSecondaryFields, getCaseActions, getParentCases, getPrimaryFields, getPromotedActions, getSecondaryFields, getTabContent, getUtilitiesSummaryItems, PersistentUtilityContent, Utilities } from './CaseView.mocks';
18
11
  registerIcon(userSolidIcon);
19
12
  export default {
20
13
  title: 'Work/CaseView',
@@ -24,250 +17,50 @@ export default {
24
17
  layout: 'fullscreen'
25
18
  }
26
19
  };
27
- /*
28
- _____ _ _ _
29
- / __ \ | | | (_)
30
- | / \/ __ _ ___ ___ | | | |_ _____ __
31
- | | / _` / __|/ _ \| | | | |/ _ \ \ /\ / /
32
- | \__/\ (_| \__ \ __/\ \_/ / | __/\ V V /
33
- \____/\__,_|___/\___| \___/|_|\___| \_/\_/
34
- */
35
- export const CaseViewDemo = ({ banners, persistentUtility, caseId = 'C-456', parentCases, heading = 'Cosmos demo case', icon = _jsx(Icon, { name: 'user-solid' }), tasksWidget = _jsx(TasksDemo, {}), primaryFields, secondaryFields, actions, tabs, stages = true, showUtilities = true, defaultCollapsedUtilities = false, showFollowedIcon = true }) => {
36
- const previewTabItems = getTabs();
37
- const [preview, setPreview] = useState(null);
38
- const [previewCurrentTabId, setPreviewCurrentTabId] = useState(previewTabItems[0].id);
20
+ export const CaseViewDemo = (args) => {
21
+ const caseId = 'C-456';
22
+ const heading = 'Cosmos demo case';
23
+ const [previewCaseId, setPreviewCaseId] = useState(null);
24
+ const [previewCurrentTabId, setPreviewCurrentTabId] = useState(baseCaseTabs[0].id);
39
25
  const [followed, setFollowed] = useState(false);
40
26
  const isMediumOrAbove = useBreakpoint('md');
41
- const PreviewLinkComponent = ({ token: linkToken }) => {
42
- return (_jsx(Link, { href: linkToken.href, previewable: true, onPreview: () => {
43
- setPreview({ id: linkToken.href, name: 'Previewable Case' });
44
- setPreviewCurrentTabId(`summary-${linkToken.href}`);
45
- }, children: linkToken.text }));
46
- };
47
- const pulseMarkdownMap = {
48
- link: (linkToken) => {
49
- if (linkToken.href?.startsWith('C-'))
50
- return PreviewLinkComponent;
51
- }
52
- };
53
- const pulseOnMentionPreview = ({ id, type, text }) => {
54
- if (type === 'case') {
55
- setPreview({ id, name: text });
56
- setPreviewCurrentTabId(`summary-${id}`);
57
- }
58
- };
59
- const demoTabItems = tabs || getTabs();
60
- const [demoCurrentTabId, setDemoCurrentTabId] = useState(isMediumOrAbove ? demoTabItems[0].id : `summary-${caseId}`);
27
+ const [demoCurrentTabId, setDemoCurrentTabId] = useState(isMediumOrAbove ? baseCaseTabs[0].id : `summary-${caseId}`);
61
28
  const demoTabs = {
62
- items: demoTabItems,
29
+ items: baseCaseTabs,
63
30
  currentTabId: demoCurrentTabId,
64
- onClick: (id) => setDemoCurrentTabId(id)
31
+ onClick: setDemoCurrentTabId
65
32
  };
66
- const demoStages = stages ? _jsx(StagesDemo, { currentStage: 3 }) : undefined;
67
- const demoTabContent = useMemo(() => {
68
- return [
69
- {
70
- id: 'Details',
71
- content: _jsx(Details, {})
72
- },
73
- {
74
- id: 'Pulse',
75
- content: (_jsx(PulseMock, { markdownMap: pulseMarkdownMap, onMentionPreview: pulseOnMentionPreview }))
76
- },
77
- {
78
- id: 'Accounts',
79
- content: _jsx(TableDemo, {})
80
- },
81
- {
82
- id: 'not found',
83
- content: _jsx("h2", { children: "Not Found" })
84
- }
85
- ];
86
- }, []);
87
33
  const previewTabs = {
88
- items: previewTabItems,
34
+ items: baseCaseTabs,
89
35
  currentTabId: previewCurrentTabId,
90
- onClick: (id) => setPreviewCurrentTabId(id)
36
+ onClick: setPreviewCurrentTabId
91
37
  };
92
- const previewTabContent = useMemo(() => {
93
- return [
94
- {
95
- id: 'Details',
96
- content: _jsx(Details, {})
97
- },
98
- {
99
- id: 'Pulse',
100
- content: _jsx(PulseMock, { markdownMap: pulseMarkdownMap })
101
- },
102
- {
103
- id: 'Accounts',
104
- content: _jsx(TableDemo, {})
105
- },
106
- {
107
- id: 'not found',
108
- content: _jsx("h2", { children: "Not Found" })
109
- }
110
- ];
111
- }, []);
112
- const demoPrimaryFields = primaryFields ||
113
- [
114
- {
115
- name: 'Member ID',
116
- value: 'M205435569FD'
117
- },
118
- {
119
- name: 'Priority',
120
- value: '95'
121
- }
122
- ].map((f, i) => ({ ...f, id: `p-${i}` }));
123
- const createDate = new Date(2016, 1, 8);
124
- const msInYear = 1000 * 60 * 60 * 24 * 365;
125
- const diffInYears = Math.floor((Date.now() - createDate.getTime()) / msInYear);
126
- const demoSecondaryFields = secondaryFields ||
127
- [
128
- {
129
- name: 'Status',
130
- value: _jsx(Status, { variant: 'info', children: "New" })
131
- },
132
- {
133
- name: 'Assigned to',
134
- value: 'Dean Thomas'
135
- },
136
- {
137
- name: 'Create date',
138
- value: createDate.toDateString()
139
- },
140
- {
141
- name: 'Update date',
142
- value: `${diffInYears} years ago`
143
- },
144
- {
145
- name: 'Created by',
146
- value: _jsx(MockOperatorFieldValue, {})
147
- },
148
- {
149
- name: 'Previewable Case',
150
- value: (_jsx(Link, { href: '/cases/C-789', previewable: true, onPreview: () => {
151
- setPreview({ id: 'C-789', name: 'Previewable Case' });
152
- setPreviewCurrentTabId('summary-C-789');
153
- }, children: "Previewable Case - C-789" }))
154
- }
155
- ].map((f, i) => ({ ...f, id: `s-${i}` }));
156
- const demoParentCases = useMemo(() => {
157
- if (parentCases) {
158
- return parentCases.map(parentCase => {
159
- return {
160
- ...parentCase,
161
- onPreview: () => {
162
- setPreview({ id: parentCase.id, name: parentCase.primary });
163
- setPreviewCurrentTabId(`summary-${parentCase.id}`);
164
- }
165
- };
166
- });
167
- }
168
- const ids = new Set([caseId]);
169
- return Array.from({ length: 5 }, (_, i) => {
170
- let id;
171
- // Ensure parent ids are unique.
172
- do {
173
- id = `C-${Math.floor(Math.random() * 200 + 100)}`;
174
- } while (ids.has(id));
175
- ids.add(id);
176
- const name = `Parent ${5 - i}`;
177
- return {
178
- id,
179
- primary: `${name} - ${id}`,
180
- href: `/cases/${id}`,
181
- previewable: true,
182
- onPreview: () => {
183
- setPreview({ id, name });
184
- setPreviewCurrentTabId(`summary-${id}`);
185
- }
186
- };
187
- });
188
- }, [caseId, parentCases]);
189
- return (_jsxs(_Fragment, { children: [_jsx(CasePreview, { open: !!preview, caseId: preview?.id ?? '', parentCases: [...demoParentCases]
190
- .splice(0, demoParentCases.findIndex(c => c.id === preview?.id))
191
- .map(c => {
192
- return { ...c, id: `preview-${c.id}` };
193
- }), heading: preview?.name ?? '', caseLink: { href: `/cases/${preview?.id}`, target: '_blank' }, icon: icon, followed: showFollowedIcon ? !followed : undefined, onEdit: action('Case Preview Edit was clicked'), actions: actions ||
194
- Array.from({ length: 12 }, (_, i) => {
195
- return {
196
- text: `Action ${i + 1}`,
197
- id: `${i + 1}`,
198
- onClick: action(`Clicked Option Number ${i + 1}`)
199
- };
200
- }), summary: _jsx(CaseSummaryFields, { primaryFields: [
201
- {
202
- name: 'Member ID',
203
- value: 'M204859F438G'
204
- },
205
- {
206
- name: 'Priority',
207
- value: '95'
208
- }
209
- ].map((f, i) => ({ ...f, id: `p-${i}` })), secondaryFields: [
210
- {
211
- name: 'Status',
212
- value: _jsx(Status, { variant: 'info', children: "New" })
213
- },
214
- {
215
- name: 'Assigned to',
216
- value: 'Dean Thomas'
217
- },
218
- {
219
- name: 'Create date',
220
- value: createDate.toDateString()
221
- },
222
- {
223
- name: 'Update date',
224
- value: `${diffInYears} years ago`
225
- }
226
- ].map((f, i) => ({ ...f, id: `s-${i}` })) }), stages: demoStages, tasks: tasksWidget, tabs: previewTabs, tabContent: previewTabContent, utilities: showUtilities ? (_jsxs(Grid, { container: { rowGap: 2 }, children: [_jsx(AttachmentsMock, {}), _jsx(StakeHoldersDemo, {}), _jsx(MockSummaryList, { icon: 'user-star', name: 'Followers' }), _jsx(TagsDemo, {})] })) : (_jsx(Grid, { container: { rowGap: 2 }, children: _jsx(AttachmentsMock, {}) })), onBeforeClose: () => {
227
- // TODO: Maybe should handle syncing state to avoid additional render with duplicate prop value
228
- if (preview) {
229
- setPreview(null);
230
- }
231
- } }), _jsx(CaseView, { caseId: caseId, parentCases: demoParentCases, heading: heading, icon: icon, followed: showFollowedIcon ? followed : undefined, onFollowedChange: showFollowedIcon ? setFollowed : undefined, actions: actions ||
232
- Array.from({ length: 12 }, (_, i) => {
233
- return {
234
- text: `Action ${i + 1}`,
235
- id: `${i + 1}`,
236
- onClick: action(`Clicked Option Number ${i + 1}`)
237
- };
238
- }), promotedActions: [
239
- { text: 'Action 13', id: '13', onClick: action('Clicked Option Number 13') }
240
- ], onEdit: action('Case View Edit was clicked'), summary: _jsx(CaseSummaryFields, { primaryFields: demoPrimaryFields, secondaryFields: demoSecondaryFields }), tabs: demoTabs, banners: banners, persistentUtility: persistentUtility, stages: demoStages, tasks: tasksWidget, tabContent: demoTabContent, defaultCollapsedUtilities: defaultCollapsedUtilities, utilities: showUtilities ? (_jsxs(_Fragment, { children: [_jsx(AttachmentsMock, {}), _jsx(StakeHoldersDemo, {}), _jsx(MockSummaryList, { icon: 'user-star', name: 'Followers' }), _jsx(TagsDemo, {})] })) : (_jsx(AttachmentsMock, {})), utilitiesSummaryItems: showUtilities
241
- ? [
242
- { iconName: 'paper-clip', count: 4 },
243
- { iconName: 'user-search-solid', count: 10 },
244
- { iconName: 'user-star-solid', count: 5 },
245
- { iconName: 'tag', count: 10 }
246
- ]
247
- : [{ iconName: 'paper-clip', count: 4 }] })] }));
38
+ const tabContent = getTabContent({ setPreviewCaseId, setPreviewCurrentTabId });
39
+ const parentCases = getParentCases({
40
+ caseId,
41
+ setPreviewCaseId,
42
+ setPreviewCurrentTabId
43
+ });
44
+ const demoStages = _jsx(StagesDemo, { currentStage: 3 });
45
+ const [summaryExpanded, setSummaryExpanded] = useState(true);
46
+ const [utilitiesCollapsed, setUtilitiesCollapsed] = useState(true);
47
+ return (_jsx(AppShellDemo, { appHeader: true, main: _jsxs(_Fragment, { children: [previewCaseId && (_jsx(CasePreview, { open: true, onAfterClose: () => {
48
+ setPreviewCaseId(null);
49
+ }, caseId: previewCaseId, parentCases: [...parentCases]
50
+ .filter(c => c.id !== previewCaseId)
51
+ .map(c => ({ ...c, id: `preview-${c.id}` })), heading: 'Previewable demo case', caseLink: { href: `/cases/${previewCaseId}`, target: '_blank' }, icon: _jsx(Icon, { name: 'user-solid' }), followed: !followed, onEdit: action('Case Preview Edit was clicked'), actions: getCaseActions(), summary: _jsx(CaseSummaryFields, { primaryFields: casePreviewPrimaryFields, secondaryFields: casePreviewSecondaryFields }), stages: demoStages, tasks: _jsx(TasksDemo, {}), tabs: previewTabs, tabContent: tabContent, utilities: _jsx(Grid, { container: { rowGap: 2 }, children: _jsx(Utilities, {}) }) })), _jsx(CaseView, { caseId: caseId, parentCases: getParentCases({
52
+ caseId,
53
+ setPreviewCaseId,
54
+ setPreviewCurrentTabId
55
+ }), heading: heading, icon: _jsx(Icon, { name: 'user-solid' }), followed: followed, onFollowedChange: setFollowed, actions: getCaseActions(), promotedActions: getPromotedActions(), onEdit: action('Case View Edit was clicked'), summary: _jsx(CaseSummaryFields, { primaryFields: getPrimaryFields(), secondaryFields: getSecondaryFields({ setPreviewCaseId, setPreviewCurrentTabId }) }), summaryExpanded: summaryExpanded, onToggleSummary: () => {
56
+ setSummaryExpanded(cur => !cur);
57
+ }, tabs: demoTabs, banners: null, persistentUtility: args.persistentUtility
58
+ ? { title: 'Persistent utility', content: _jsx(PersistentUtilityContent, {}) }
59
+ : undefined, stages: demoStages, tasks: _jsx(TasksDemo, {}), tabContent: tabContent, utilities: _jsx(Utilities, {}), utilitiesSummaryItems: getUtilitiesSummaryItems(), utilitiesExpanded: utilitiesCollapsed, onToggleUtilities: () => {
60
+ setUtilitiesCollapsed(cur => !cur);
61
+ } })] }) }));
248
62
  };
249
- /*
250
- _____ _ _ _ ___ _____ _ _ _
251
- / __ \ | | | (_) / _ \ / ___| | | | |
252
- | / \/ __ _ ___ ___ | | | |_ _____ ________/ /_\ \_ __ _ __ \ `--.| |__ ___| | |
253
- | | / _` / __|/ _ \| | | | |/ _ \ \ /\ / /______| _ | '_ \| '_ \ `--. \ '_ \ / _ \ | |
254
- | \__/\ (_| \__ \ __/\ \_/ / | __/\ V V / | | | | |_) | |_) /\__/ / | | | __/ | |
255
- \____/\__,_|___/\___| \___/|_|\___| \_/\_/ \_| |_/ .__/| .__/\____/|_| |_|\___|_|_|
256
- | | | |
257
- |_| |_|
258
- */
259
- export const CaseViewWithAppShell = (props) => {
260
- return _jsx(AppShellDemo, { appHeader: true, main: _jsx(CaseViewDemo, { ...props }) });
261
- };
262
- /*
263
- _____ _ _ _ _____ _ _
264
- / __ \ | | | (_) / __ \ | | |
265
- | / \/ __ _ ___ ___ | | | |_ _____ ________| / \/ |__ __ _| |_
266
- | | / _` / __|/ _ \| | | | |/ _ \ \ /\ / /______| | | '_ \ / _` | __|
267
- | \__/\ (_| \__ \ __/\ \_/ / | __/\ V V / | \__/\ | | | (_| | |_
268
- \____/\__,_|___/\___| \___/|_|\___| \_/\_/ \____/_| |_|\__,_|\__|
269
- */
270
- CaseViewWithAppShell.parameters = {
63
+ CaseViewDemo.parameters = {
271
64
  eyes: {
272
65
  runBefore: () => {
273
66
  document
@@ -278,7 +71,10 @@ CaseViewWithAppShell.parameters = {
278
71
  }
279
72
  }
280
73
  };
281
- export const CaseViewWithChat = (props) => {
282
- return (_jsx(AppShellDemo, { appHeader: true, main: _jsx(CaseViewDemo, { persistentUtility: { content: _jsx(StandardChat, { chatWidth: '100%' }), title: 'Chat' }, ...props }) }));
74
+ CaseViewDemo.args = {
75
+ persistentUtility: false
76
+ };
77
+ CaseViewDemo.argTypes = {
78
+ persistentUtility: { control: { type: 'boolean' } }
283
79
  };
284
80
  //# sourceMappingURL=CaseView.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CaseView.stories.js","sourceRoot":"","sources":["../../../src/work/CaseView/CaseView.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAgB,OAAO,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,IAAI,EACJ,IAAI,EAEJ,aAAa,EACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,EACL,QAAQ,EAER,WAAW,EAEX,iBAAiB,EAElB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,SAAS,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AY,IACX,SAAS,QACT,IAAI,EACF,KAAC,YAAY,IACX,iBAAiB,EAAE,EAAE,OAAO,EAAE,KAAC,YAAY,IAAC,SAAS,EAAC,MAAM,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAC5E,KAAK,GACT,GAEJ,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useState, ReactElement, useMemo } from 'react';\nimport { action } from '@storybook/addon-actions';\nimport { Meta, Story } from '@storybook/react';\n\nimport {\n Icon,\n registerIcon,\n Status,\n Link,\n Grid,\n MenuItemProps,\n useBreakpoint\n} from '@pega/cosmos-react-core';\nimport { TokenMap } from '@pega/cosmos-react-rte';\nimport * as userSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/user-solid.icon';\nimport {\n CaseView,\n CaseViewProps,\n CasePreview,\n CaseHeaderProps,\n CaseSummaryFields,\n CaseSummaryFieldsProps\n} from '@pega/cosmos-react-work';\n\nimport { TasksDemo } from '../Tasks/Tasks.stories';\nimport { AppShellDemo } from '../../core/AppShell/AppShell.stories';\nimport { TableDemo } from '../../core/Table/Table.stories';\nimport { StandardChat } from '../../social/Chat/Chat.stories';\nimport { TagsDemo } from '../Tags/Tags.stories';\nimport { StagesDemo } from '../Stages/Stages.stories';\nimport { StakeHoldersDemo } from '../Stakeholders/Stakeholders.stories';\n\nimport { Details } from './Details.mocks';\nimport { PulseMock } from './Pulse.mocks';\nimport { AttachmentsMock } from './Attachments.mocks';\nimport { getTabs, MockOperatorFieldValue, MockSummaryList } from './CaseView.mocks';\n\nregisterIcon(userSolidIcon);\n\nexport default {\n title: 'Work/CaseView',\n component: CaseView,\n includeStories: ['CaseViewDemo', 'CaseViewWithAppShell', 'CaseViewWithChat'],\n parameters: {\n layout: 'fullscreen'\n }\n} as Meta;\n\nexport interface CaseViewStoryProps {\n banners?: CaseViewProps['banners'];\n persistentUtility?: CaseViewProps['persistentUtility'];\n caseId?: string;\n heading?: string;\n icon?: ReactElement;\n parentCases?: MenuItemProps[];\n primaryFields?: CaseSummaryFieldsProps['primaryFields'];\n secondaryFields?: CaseSummaryFieldsProps['secondaryFields'];\n actions?: CaseHeaderProps['actions'];\n tabs?: any;\n tasksWidget?: ReactElement;\n stages?: boolean;\n showUtilities?: boolean;\n showFollowedIcon?: boolean;\n defaultCollapsedUtilities?: boolean;\n}\n\n/*\n _____ _ _ _\n/ __ \\ | | | (_)\n| / \\/ __ _ ___ ___ | | | |_ _____ __\n| | / _` / __|/ _ \\| | | | |/ _ \\ \\ /\\ / /\n| \\__/\\ (_| \\__ \\ __/\\ \\_/ / | __/\\ V V /\n \\____/\\__,_|___/\\___| \\___/|_|\\___| \\_/\\_/\n */\nexport const CaseViewDemo: Story<CaseViewStoryProps> = ({\n banners,\n persistentUtility,\n caseId = 'C-456',\n parentCases,\n heading = 'Cosmos demo case',\n icon = <Icon name='user-solid' />,\n tasksWidget = <TasksDemo />,\n primaryFields,\n secondaryFields,\n actions,\n tabs,\n stages = true,\n showUtilities = true,\n defaultCollapsedUtilities = false,\n showFollowedIcon = true\n}: CaseViewStoryProps) => {\n const previewTabItems = getTabs();\n const [preview, setPreview] = useState<null | { id: string; name: string }>(null);\n const [previewCurrentTabId, setPreviewCurrentTabId] = useState(previewTabItems[0].id);\n const [followed, setFollowed] = useState(false);\n\n const isMediumOrAbove = useBreakpoint('md');\n\n const PreviewLinkComponent = ({ token: linkToken }: { token: TokenMap['link'] }) => {\n return (\n <Link\n href={linkToken.href}\n previewable\n onPreview={() => {\n setPreview({ id: linkToken.href, name: 'Previewable Case' });\n setPreviewCurrentTabId(`summary-${linkToken.href}`);\n }}\n >\n {linkToken.text}\n </Link>\n );\n };\n\n const pulseMarkdownMap = {\n link: (linkToken: TokenMap['link']) => {\n if (linkToken.href?.startsWith('C-')) return PreviewLinkComponent;\n }\n };\n\n const pulseOnMentionPreview = ({\n id,\n type,\n text\n }: {\n id: string;\n type: string;\n text: string;\n }) => {\n if (type === 'case') {\n setPreview({ id, name: text });\n setPreviewCurrentTabId(`summary-${id}`);\n }\n };\n\n const demoTabItems = tabs || getTabs();\n\n const [demoCurrentTabId, setDemoCurrentTabId] = useState(\n isMediumOrAbove ? demoTabItems[0].id : `summary-${caseId}`\n );\n\n const demoTabs = {\n items: demoTabItems,\n currentTabId: demoCurrentTabId,\n onClick: (id: string) => setDemoCurrentTabId(id)\n };\n\n const demoStages = stages ? <StagesDemo currentStage={3} /> : undefined;\n\n const demoTabContent = useMemo(() => {\n return [\n {\n id: 'Details',\n content: <Details />\n },\n {\n id: 'Pulse',\n content: (\n <PulseMock markdownMap={pulseMarkdownMap} onMentionPreview={pulseOnMentionPreview} />\n )\n },\n {\n id: 'Accounts',\n content: <TableDemo />\n },\n {\n id: 'not found',\n content: <h2>Not Found</h2>\n }\n ];\n }, []);\n\n const previewTabs = {\n items: previewTabItems,\n currentTabId: previewCurrentTabId,\n onClick: (id: string) => setPreviewCurrentTabId(id)\n };\n\n const previewTabContent = useMemo(() => {\n return [\n {\n id: 'Details',\n content: <Details />\n },\n {\n id: 'Pulse',\n content: <PulseMock markdownMap={pulseMarkdownMap} />\n },\n {\n id: 'Accounts',\n content: <TableDemo />\n },\n {\n id: 'not found',\n content: <h2>Not Found</h2>\n }\n ];\n }, []);\n\n const demoPrimaryFields =\n primaryFields ||\n [\n {\n name: 'Member ID',\n value: 'M205435569FD'\n },\n {\n name: 'Priority',\n value: '95'\n }\n ].map((f, i) => ({ ...f, id: `p-${i}` }));\n\n const createDate = new Date(2016, 1, 8);\n const msInYear = 1000 * 60 * 60 * 24 * 365;\n const diffInYears = Math.floor((Date.now() - createDate.getTime()) / msInYear);\n\n const demoSecondaryFields =\n secondaryFields ||\n [\n {\n name: 'Status',\n value: <Status variant='info'>New</Status>\n },\n {\n name: 'Assigned to',\n value: 'Dean Thomas'\n },\n {\n name: 'Create date',\n value: createDate.toDateString()\n },\n {\n name: 'Update date',\n value: `${diffInYears} years ago`\n },\n {\n name: 'Created by',\n value: <MockOperatorFieldValue />\n },\n {\n name: 'Previewable Case',\n value: (\n <Link\n href='/cases/C-789'\n previewable\n onPreview={() => {\n setPreview({ id: 'C-789', name: 'Previewable Case' });\n setPreviewCurrentTabId('summary-C-789');\n }}\n >\n Previewable Case - C-789\n </Link>\n )\n }\n ].map((f, i) => ({ ...f, id: `s-${i}` }));\n\n const demoParentCases = useMemo(() => {\n if (parentCases) {\n return parentCases.map(parentCase => {\n return {\n ...parentCase,\n onPreview: () => {\n setPreview({ id: parentCase.id, name: parentCase.primary });\n setPreviewCurrentTabId(`summary-${parentCase.id}`);\n }\n };\n });\n }\n\n const ids = new Set([caseId]);\n\n return Array.from({ length: 5 }, (_, i) => {\n let id: string;\n // Ensure parent ids are unique.\n do {\n id = `C-${Math.floor(Math.random() * 200 + 100)}`;\n } while (ids.has(id));\n ids.add(id);\n\n const name = `Parent ${5 - i}`;\n\n return {\n id,\n primary: `${name} - ${id}`,\n href: `/cases/${id}`,\n previewable: true,\n onPreview: () => {\n setPreview({ id, name });\n setPreviewCurrentTabId(`summary-${id}`);\n }\n };\n });\n }, [caseId, parentCases]);\n\n return (\n <>\n <CasePreview\n open={!!preview}\n caseId={preview?.id ?? ''}\n parentCases={[...demoParentCases]\n .splice(\n 0,\n demoParentCases.findIndex(c => c.id === preview?.id)\n )\n .map(c => {\n return { ...c, id: `preview-${c.id}` };\n })}\n heading={preview?.name ?? ''}\n caseLink={{ href: `/cases/${preview?.id}`, target: '_blank' }}\n icon={icon}\n followed={showFollowedIcon ? !followed : undefined}\n onEdit={action('Case Preview Edit was clicked')}\n actions={\n actions ||\n Array.from({ length: 12 }, (_, i) => {\n return {\n text: `Action ${i + 1}`,\n id: `${i + 1}`,\n onClick: action(`Clicked Option Number ${i + 1}`)\n };\n })\n }\n summary={\n <CaseSummaryFields\n primaryFields={[\n {\n name: 'Member ID',\n value: 'M204859F438G'\n },\n {\n name: 'Priority',\n value: '95'\n }\n ].map((f, i) => ({ ...f, id: `p-${i}` }))}\n secondaryFields={[\n {\n name: 'Status',\n value: <Status variant='info'>New</Status>\n },\n {\n name: 'Assigned to',\n value: 'Dean Thomas'\n },\n {\n name: 'Create date',\n value: createDate.toDateString()\n },\n {\n name: 'Update date',\n value: `${diffInYears} years ago`\n }\n ].map((f, i) => ({ ...f, id: `s-${i}` }))}\n />\n }\n stages={demoStages}\n tasks={tasksWidget}\n tabs={previewTabs}\n tabContent={previewTabContent}\n utilities={\n showUtilities ? (\n <Grid container={{ rowGap: 2 }}>\n <AttachmentsMock />\n <StakeHoldersDemo />\n <MockSummaryList icon='user-star' name='Followers' />\n <TagsDemo />\n </Grid>\n ) : (\n <Grid container={{ rowGap: 2 }}>\n <AttachmentsMock />\n </Grid>\n )\n }\n onBeforeClose={() => {\n // TODO: Maybe should handle syncing state to avoid additional render with duplicate prop value\n if (preview) {\n setPreview(null);\n }\n }}\n />\n <CaseView\n caseId={caseId}\n parentCases={demoParentCases}\n heading={heading}\n icon={icon}\n followed={showFollowedIcon ? followed : undefined}\n onFollowedChange={showFollowedIcon ? setFollowed : undefined}\n actions={\n actions ||\n Array.from({ length: 12 }, (_, i) => {\n return {\n text: `Action ${i + 1}`,\n id: `${i + 1}`,\n onClick: action(`Clicked Option Number ${i + 1}`)\n };\n })\n }\n promotedActions={[\n { text: 'Action 13', id: '13', onClick: action('Clicked Option Number 13') }\n ]}\n onEdit={action('Case View Edit was clicked')}\n summary={\n <CaseSummaryFields\n primaryFields={demoPrimaryFields}\n secondaryFields={demoSecondaryFields}\n />\n }\n tabs={demoTabs}\n banners={banners}\n persistentUtility={persistentUtility}\n stages={demoStages}\n tasks={tasksWidget}\n tabContent={demoTabContent}\n defaultCollapsedUtilities={defaultCollapsedUtilities}\n utilities={\n showUtilities ? (\n <>\n <AttachmentsMock />\n <StakeHoldersDemo />\n <MockSummaryList icon='user-star' name='Followers' />\n <TagsDemo />\n </>\n ) : (\n <AttachmentsMock />\n )\n }\n utilitiesSummaryItems={\n showUtilities\n ? [\n { iconName: 'paper-clip', count: 4 },\n { iconName: 'user-search-solid', count: 10 },\n { iconName: 'user-star-solid', count: 5 },\n { iconName: 'tag', count: 10 }\n ]\n : [{ iconName: 'paper-clip', count: 4 }]\n }\n />\n </>\n );\n};\n\n/*\n _____ _ _ _ ___ _____ _ _ _\n/ __ \\ | | | (_) / _ \\ / ___| | | | |\n| / \\/ __ _ ___ ___ | | | |_ _____ ________/ /_\\ \\_ __ _ __ \\ `--.| |__ ___| | |\n| | / _` / __|/ _ \\| | | | |/ _ \\ \\ /\\ / /______| _ | '_ \\| '_ \\ `--. \\ '_ \\ / _ \\ | |\n| \\__/\\ (_| \\__ \\ __/\\ \\_/ / | __/\\ V V / | | | | |_) | |_) /\\__/ / | | | __/ | |\n \\____/\\__,_|___/\\___| \\___/|_|\\___| \\_/\\_/ \\_| |_/ .__/| .__/\\____/|_| |_|\\___|_|_|\n | | | |\n |_| |_|\n */\nexport const CaseViewWithAppShell: Story = (props: CaseViewStoryProps) => {\n return <AppShellDemo appHeader main={<CaseViewDemo {...props} />} />;\n};\n\n/*\n _____ _ _ _ _____ _ _\n/ __ \\ | | | (_) / __ \\ | | |\n| / \\/ __ _ ___ ___ | | | |_ _____ ________| / \\/ |__ __ _| |_\n| | / _` / __|/ _ \\| | | | |/ _ \\ \\ /\\ / /______| | | '_ \\ / _` | __|\n| \\__/\\ (_| \\__ \\ __/\\ \\_/ / | __/\\ V V / | \\__/\\ | | | (_| | |_\n \\____/\\__,_|___/\\___| \\___/|_|\\___| \\_/\\_/ \\____/_| |_|\\__,_|\\__|\n */\nCaseViewWithAppShell.parameters = {\n eyes: {\n runBefore: () => {\n document\n .querySelector<HTMLButtonElement>(\n // Find the case actions menu.\n '[aria-label=\"Actions\"]'\n )\n ?.click();\n }\n }\n};\n\nexport const CaseViewWithChat: Story = (props: CaseViewStoryProps) => {\n return (\n <AppShellDemo\n appHeader\n main={\n <CaseViewDemo\n persistentUtility={{ content: <StandardChat chatWidth='100%' />, title: 'Chat' }}\n {...props}\n />\n }\n />\n );\n};\n"]}
1
+ {"version":3,"file":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} from '@storybook/addon-actions';\nimport { Meta, Story } from '@storybook/react';\n\nimport { Icon, registerIcon, Grid, useBreakpoint } from '@pega/cosmos-react-core';\nimport * as userSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/user-solid.icon';\nimport { CaseView, CasePreview, CaseSummaryFields } from '@pega/cosmos-react-work';\n\nimport { TasksDemo } from '../Tasks/Tasks.stories';\nimport { AppShellDemo } from '../../core/AppShell/AppShell.stories';\nimport { StagesDemo } from '../Stages/Stages.stories';\n\nimport {\n baseCaseTabs,\n casePreviewPrimaryFields,\n casePreviewSecondaryFields,\n getCaseActions,\n getParentCases,\n getPrimaryFields,\n getPromotedActions,\n getSecondaryFields,\n getTabContent,\n getUtilitiesSummaryItems,\n PersistentUtilityContent,\n Utilities\n} from './CaseView.mocks';\n\nregisterIcon(userSolidIcon);\n\nexport default {\n title: 'Work/CaseView',\n component: CaseView,\n includeStories: ['CaseViewDemo', 'CaseViewWithAppShell', 'CaseViewWithChat'],\n parameters: {\n layout: 'fullscreen'\n }\n} as Meta;\n\nexport interface CaseViewStoryArgs {\n persistentUtility?: boolean;\n}\n\nexport const CaseViewDemo: Story<CaseViewStoryArgs> = (args: CaseViewStoryArgs) => {\n const caseId = 'C-456';\n const heading = 'Cosmos demo case';\n\n const [previewCaseId, setPreviewCaseId] = useState<null | string>(null);\n const [previewCurrentTabId, setPreviewCurrentTabId] = useState(baseCaseTabs[0].id);\n const [followed, setFollowed] = useState(false);\n\n const isMediumOrAbove = useBreakpoint('md');\n\n const [demoCurrentTabId, setDemoCurrentTabId] = useState(\n isMediumOrAbove ? baseCaseTabs[0].id : `summary-${caseId}`\n );\n\n const demoTabs = {\n items: baseCaseTabs,\n currentTabId: demoCurrentTabId,\n onClick: setDemoCurrentTabId\n };\n\n const previewTabs = {\n items: baseCaseTabs,\n currentTabId: previewCurrentTabId,\n onClick: setPreviewCurrentTabId\n };\n\n const tabContent = getTabContent({ setPreviewCaseId, setPreviewCurrentTabId });\n\n const parentCases = getParentCases({\n caseId,\n setPreviewCaseId,\n setPreviewCurrentTabId\n });\n\n const demoStages = <StagesDemo currentStage={3} />;\n\n const [summaryExpanded, setSummaryExpanded] = useState(true);\n const [utilitiesCollapsed, setUtilitiesCollapsed] = useState(true);\n\n return (\n <AppShellDemo\n appHeader\n main={\n <>\n {previewCaseId && (\n <CasePreview\n open\n onAfterClose={() => {\n setPreviewCaseId(null);\n }}\n caseId={previewCaseId}\n parentCases={[...parentCases]\n .filter(c => c.id !== previewCaseId)\n .map(c => ({ ...c, id: `preview-${c.id}` }))}\n heading='Previewable demo case'\n caseLink={{ href: `/cases/${previewCaseId}`, target: '_blank' }}\n icon={<Icon name='user-solid' />}\n followed={!followed}\n onEdit={action('Case Preview Edit was clicked')}\n actions={getCaseActions()}\n summary={\n <CaseSummaryFields\n primaryFields={casePreviewPrimaryFields}\n secondaryFields={casePreviewSecondaryFields}\n />\n }\n stages={demoStages}\n tasks={<TasksDemo />}\n tabs={previewTabs}\n tabContent={tabContent}\n utilities={\n <Grid container={{ rowGap: 2 }}>\n <Utilities />\n </Grid>\n }\n />\n )}\n\n <CaseView\n caseId={caseId}\n parentCases={getParentCases({\n caseId,\n setPreviewCaseId,\n setPreviewCurrentTabId\n })}\n heading={heading}\n icon={<Icon name='user-solid' />}\n followed={followed}\n onFollowedChange={setFollowed}\n actions={getCaseActions()}\n promotedActions={getPromotedActions()}\n onEdit={action('Case View Edit was clicked')}\n summary={\n <CaseSummaryFields\n primaryFields={getPrimaryFields()}\n secondaryFields={getSecondaryFields({ setPreviewCaseId, setPreviewCurrentTabId })}\n />\n }\n summaryExpanded={summaryExpanded}\n onToggleSummary={() => {\n setSummaryExpanded(cur => !cur);\n }}\n tabs={demoTabs}\n banners={null}\n persistentUtility={\n args.persistentUtility\n ? { title: 'Persistent utility', content: <PersistentUtilityContent /> }\n : undefined\n }\n stages={demoStages}\n tasks={<TasksDemo />}\n tabContent={tabContent}\n utilities={<Utilities />}\n utilitiesSummaryItems={getUtilitiesSummaryItems()}\n utilitiesExpanded={utilitiesCollapsed}\n onToggleUtilities={() => {\n setUtilitiesCollapsed(cur => !cur);\n }}\n />\n </>\n }\n />\n );\n};\n\nCaseViewDemo.parameters = {\n eyes: {\n runBefore: () => {\n document\n .querySelector<HTMLButtonElement>(\n // Find the case actions menu.\n '[aria-label=\"Actions\"]'\n )\n ?.click();\n }\n }\n};\n\nCaseViewDemo.args = {\n persistentUtility: false\n};\n\nCaseViewDemo.argTypes = {\n persistentUtility: { control: { type: 'boolean' } }\n};\n"]}
@@ -21,4 +21,15 @@ export declare const notificationItems: ({
21
21
  unread: boolean;
22
22
  visual?: undefined;
23
23
  })[];
24
+ export declare const defaultAppDemoProps: {
25
+ readonly imageSrc: "https://www.pega.com/themes/custom/pegawww_theme/images/pega-logo.svg";
26
+ readonly appName: "Service Desk";
27
+ readonly numberOfNavLinks: 3;
28
+ readonly navAlignment: "end";
29
+ readonly navPosition: "inline";
30
+ readonly operatorName: "Cindy Turner";
31
+ readonly operatorTitle: "Account";
32
+ readonly notificationsEmpty: false;
33
+ readonly notificationsLoading: false;
34
+ };
24
35
  //# sourceMappingURL=AppShell.mocks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.mocks.d.ts","sourceRoot":"","sources":["../../../src/wss/AppShell/AppShell.mocks.tsx"],"names":[],"mappings":";AAIA,eAAO,MAAM,kBAAkB;aAA4B,MAAM;iBAQhE,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;IAyD7B,CAAC"}
1
+ {"version":3,"file":"AppShell.mocks.d.ts","sourceRoot":"","sources":["../../../src/wss/AppShell/AppShell.mocks.tsx"],"names":[],"mappings":";AAIA,eAAO,MAAM,kBAAkB;aAA4B,MAAM;iBAQhE,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;IAyD7B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;CAUtB,CAAC"}
@@ -56,4 +56,15 @@ export const notificationItems = [
56
56
  unread: true
57
57
  }
58
58
  ];
59
+ export const defaultAppDemoProps = {
60
+ imageSrc: 'https://www.pega.com/themes/custom/pegawww_theme/images/pega-logo.svg',
61
+ appName: 'Service Desk',
62
+ numberOfNavLinks: 3,
63
+ navAlignment: 'end',
64
+ navPosition: 'inline',
65
+ operatorName: 'Cindy Turner',
66
+ operatorTitle: 'Account',
67
+ notificationsEmpty: false,
68
+ notificationsLoading: false
69
+ };
59
70
  //# sourceMappingURL=AppShell.mocks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.mocks.js","sourceRoot":"","sources":["../../../src/wss/AppShell/AppShell.mocks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAE,OAAO,EAAuB,EAAE,EAAE,CAAC,CACtE,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,iBAAiB,YACjF,KAAC,IAAI,cACH,KAAC,WAAW,cACV,MAAC,IAAI,IAAC,OAAO,EAAC,IAAI,aAAE,OAAO,gBAAgB,GAC/B,GACT,GACF,CACR,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B;QACE,EAAE,EAAE,KAAK;QACT,OAAO,EACL,4FAA4F;QAC9F,SAAS,EAAE,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC;QACtE,MAAM,EAAE,KAAC,MAAM,IAAC,IAAI,EAAC,aAAa,GAAG;QACrC,MAAM,EAAE,IAAI;KACb;IACD;QACE,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AAC;QACpE,MAAM,EAAE,KAAC,MAAM,IAAC,IAAI,EAAC,aAAa,GAAG;QACrC,MAAM,EAAE,IAAI;KACb;IACD;QACE,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,+DAA+D;QACxE,SAAS,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC;QACxD,MAAM,EAAE,IAAI;KACb;CACF,CAAC","sourcesContent":["import { Avatar, Card, CardContent, Flex, Text } from '@pega/cosmos-react-core';\n\nimport { StyledMainContent } from './AppShell.styles';\n\nexport const DefaultMainContent = ({ content }: { content: string }) => (\n <Flex container={{ justify: 'center', alignItems: 'center' }} as={StyledMainContent}>\n <Card>\n <CardContent>\n <Text variant='h2'>{content} content</Text>\n </CardContent>\n </Card>\n </Flex>\n);\n\nexport const notificationItems = [\n {\n id: '123',\n primary:\n \"Dean Thomas mentioned your team in a bug 'Button does not initiate onClick event handler'.\",\n secondary: ['BUG-12345', new Date(2020, 8, 31, 13, 23).toDateString()],\n visual: <Avatar name='Dean Thomas' />,\n unread: true\n },\n {\n id: '456',\n primary: \"Seth DeAngelo mentioned your team in a bug 'Text variant h1 renders as h3 in DOM'.\",\n visual: <Avatar name='Seth DeAngelo' />,\n unread: true\n },\n {\n id: '789',\n primary:\n \"Janet Moore mentioned your team in a bug 'Tree expanded state does not match the state that was set on the component'.\",\n secondary: ['BUG-12345', new Date(2020, 9, 2, 9, 22).toDateString()],\n visual: <Avatar name='Janet Moore' />,\n unread: true\n },\n {\n id: '000',\n primary: 'You have been awarded Employee of the Month! Congratulations!',\n secondary: [new Date(2020, 9, 8, 14, 46).toDateString()],\n unread: true\n },\n {\n id: '111',\n primary:\n \"Dean Thomas mentioned your team in a bug 'Button does not initiate onClick event handler'.\",\n secondary: ['BUG-12345', new Date(2020, 8, 31, 13, 23).toDateString()],\n visual: <Avatar name='Dean Thomas' />,\n unread: true\n },\n {\n id: '222',\n primary: \"Seth DeAngelo mentioned your team in a bug 'Text variant h1 renders as h3 in DOM'.\",\n visual: <Avatar name='Seth DeAngelo' />,\n unread: true\n },\n {\n id: '333',\n primary:\n \"Janet Moore mentioned your team in a bug 'Tree expanded state does not match the state that was set on the component'.\",\n secondary: ['BUG-12345', new Date(2020, 9, 2, 9, 22).toDateString()],\n visual: <Avatar name='Janet Moore' />,\n unread: true\n },\n {\n id: '444',\n primary: 'You have been awarded Employee of the Month! Congratulations!',\n secondary: [new Date(2020, 9, 8, 14, 46).toDateString()],\n unread: true\n }\n];\n"]}
1
+ {"version":3,"file":"AppShell.mocks.js","sourceRoot":"","sources":["../../../src/wss/AppShell/AppShell.mocks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAE,OAAO,EAAuB,EAAE,EAAE,CAAC,CACtE,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,iBAAiB,YACjF,KAAC,IAAI,cACH,KAAC,WAAW,cACV,MAAC,IAAI,IAAC,OAAO,EAAC,IAAI,aAAE,OAAO,gBAAgB,GAC/B,GACT,GACF,CACR,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B;QACE,EAAE,EAAE,KAAK;QACT,OAAO,EACL,4FAA4F;QAC9F,SAAS,EAAE,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC;QACtE,MAAM,EAAE,KAAC,MAAM,IAAC,IAAI,EAAC,aAAa,GAAG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C,EAAE,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC;QACpE,MAAM,EAAE,KAAC,MAAM,IAAC,IAAI,EAAC,aAAa,GAAG;QACrC,MAAM,EAAE,IAAI;KACb;IACD;QACE,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,+DAA+D;QACxE,SAAS,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC;QACxD,MAAM,EAAE,IAAI;KACb;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,QAAQ,EAAE,uEAAuE;IACjF,OAAO,EAAE,cAAc;IACvB,gBAAgB,EAAE,CAAC;IACnB,YAAY,EAAE,KAAK;IACnB,WAAW,EAAE,QAAQ;IACrB,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,SAAS;IACxB,kBAAkB,EAAE,KAAK;IACzB,oBAAoB,EAAE,KAAK;CACnB,CAAC","sourcesContent":["import { Avatar, Card, CardContent, Flex, Text } from '@pega/cosmos-react-core';\n\nimport { StyledMainContent } from './AppShell.styles';\n\nexport const DefaultMainContent = ({ content }: { content: string }) => (\n <Flex container={{ justify: 'center', alignItems: 'center' }} as={StyledMainContent}>\n <Card>\n <CardContent>\n <Text variant='h2'>{content} content</Text>\n </CardContent>\n </Card>\n </Flex>\n);\n\nexport const notificationItems = [\n {\n id: '123',\n primary:\n \"Dean Thomas mentioned your team in a bug 'Button does not initiate onClick event handler'.\",\n secondary: ['BUG-12345', new Date(2020, 8, 31, 13, 23).toDateString()],\n visual: <Avatar name='Dean Thomas' />,\n unread: true\n },\n {\n id: '456',\n primary: \"Seth DeAngelo mentioned your team in a bug 'Text variant h1 renders as h3 in DOM'.\",\n visual: <Avatar name='Seth DeAngelo' />,\n unread: true\n },\n {\n id: '789',\n primary:\n \"Janet Moore mentioned your team in a bug 'Tree expanded state does not match the state that was set on the component'.\",\n secondary: ['BUG-12345', new Date(2020, 9, 2, 9, 22).toDateString()],\n visual: <Avatar name='Janet Moore' />,\n unread: true\n },\n {\n id: '000',\n primary: 'You have been awarded Employee of the Month! Congratulations!',\n secondary: [new Date(2020, 9, 8, 14, 46).toDateString()],\n unread: true\n },\n {\n id: '111',\n primary:\n \"Dean Thomas mentioned your team in a bug 'Button does not initiate onClick event handler'.\",\n secondary: ['BUG-12345', new Date(2020, 8, 31, 13, 23).toDateString()],\n visual: <Avatar name='Dean Thomas' />,\n unread: true\n },\n {\n id: '222',\n primary: \"Seth DeAngelo mentioned your team in a bug 'Text variant h1 renders as h3 in DOM'.\",\n visual: <Avatar name='Seth DeAngelo' />,\n unread: true\n },\n {\n id: '333',\n primary:\n \"Janet Moore mentioned your team in a bug 'Tree expanded state does not match the state that was set on the component'.\",\n secondary: ['BUG-12345', new Date(2020, 9, 2, 9, 22).toDateString()],\n visual: <Avatar name='Janet Moore' />,\n unread: true\n },\n {\n id: '444',\n primary: 'You have been awarded Employee of the Month! Congratulations!',\n secondary: [new Date(2020, 9, 8, 14, 46).toDateString()],\n unread: true\n }\n];\n\nexport const defaultAppDemoProps = {\n imageSrc: 'https://www.pega.com/themes/custom/pegawww_theme/images/pega-logo.svg',\n appName: 'Service Desk',\n numberOfNavLinks: 3,\n navAlignment: 'end',\n navPosition: 'inline',\n operatorName: 'Cindy Turner',\n operatorTitle: 'Account',\n notificationsEmpty: false,\n notificationsLoading: false\n} as const;\n"]}
@@ -1,17 +1,19 @@
1
1
  import { Meta, Story } from '@storybook/react';
2
+ import { ReactNode } from 'react';
2
3
  import { AppShellProps } from '@pega/cosmos-react-wss';
3
4
  declare const _default: Meta<import("@storybook/react").Args>;
4
5
  export default _default;
5
6
  interface AppShellDemoProps {
6
- appName: AppShellProps['appInfo']['appName'];
7
- imageSrc: AppShellProps['appInfo']['imageSrc'];
8
- numberOfNavLinks: number;
9
- navAlignment: AppShellProps['navAlignment'];
10
- navPosition: AppShellProps['navPosition'];
11
- operatorName: AppShellProps['operator']['avatar']['name'];
12
- operatorTitle: AppShellProps['operator']['title'];
13
- notificationsEmpty: boolean;
14
- notificationsLoading: boolean;
7
+ appName?: AppShellProps['appInfo']['appName'];
8
+ imageSrc?: AppShellProps['appInfo']['imageSrc'];
9
+ numberOfNavLinks?: number;
10
+ navAlignment?: AppShellProps['navAlignment'];
11
+ navPosition?: AppShellProps['navPosition'];
12
+ operatorName?: AppShellProps['operator']['avatar']['name'];
13
+ operatorTitle?: AppShellProps['operator']['title'];
14
+ notificationsEmpty?: boolean;
15
+ notificationsLoading?: boolean;
16
+ mainContent?: ReactNode;
15
17
  }
16
18
  export declare const AppShellDemo: Story<AppShellDemoProps>;
17
19
  //# sourceMappingURL=AppShell.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.stories.d.ts","sourceRoot":"","sources":["../../../src/wss/AppShell/AppShell.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAY,aAAa,EAAoB,MAAM,wBAAwB,CAAC;;AAInF,wBAMU;AAEV,UAAU,iBAAiB;IACzB,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC;IAC7C,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;IAC/C,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAC5C,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAC1C,YAAY,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;IAC1D,aAAa,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC;IAClD,kBAAkB,EAAE,OAAO,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,iBAAiB,CA2DjD,CAAC"}
1
+ {"version":3,"file":"AppShell.stories.d.ts","sourceRoot":"","sources":["../../../src/wss/AppShell/AppShell.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAY,aAAa,EAAoB,MAAM,wBAAwB,CAAC;;AAInF,wBAMU;AAEV,UAAU,iBAAiB;IACzB,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC;IAC9C,QAAQ,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;IAChD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAC7C,WAAW,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAC3C,YAAY,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3D,aAAa,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC;IACnD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,iBAAiB,CA6DjD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { AppShell } from '@pega/cosmos-react-wss';
4
- import { DefaultMainContent, notificationItems } from './AppShell.mocks';
4
+ import { DefaultMainContent, notificationItems, defaultAppDemoProps } from './AppShell.mocks';
5
5
  export default {
6
6
  title: 'Web Self Service/AppShell',
7
7
  component: AppShell,
@@ -20,11 +20,13 @@ export const AppShellDemo = (args) => {
20
20
  ...item
21
21
  })));
22
22
  };
23
- return (_jsx(AppShell, { main: _jsx(DefaultMainContent, { content: mainContent }), appInfo: {
24
- appName: args.appName,
25
- imageSrc: args.imageSrc,
23
+ return (_jsx(AppShell, { main: args.mainContent ?? _jsx(DefaultMainContent, { content: mainContent }), appInfo: {
24
+ appName: args.appName ?? defaultAppDemoProps.appName,
25
+ imageSrc: args.imageSrc ?? defaultAppDemoProps.imageSrc,
26
26
  onClick: () => setMainContent('Home')
27
- }, navLinks: Array.from({ length: args.numberOfNavLinks }).map((_, index) => {
27
+ }, navLinks: Array.from({
28
+ length: args.numberOfNavLinks ?? defaultAppDemoProps.numberOfNavLinks
29
+ }).map((_, index) => {
28
30
  const navName = `Navigation ${index + 1}`;
29
31
  return {
30
32
  id: `nav-${index + 1}`,
@@ -34,8 +36,8 @@ export const AppShellDemo = (args) => {
34
36
  current: navName === mainContent
35
37
  };
36
38
  }), operator: {
37
- avatar: { name: args.operatorName },
38
- title: args.operatorTitle,
39
+ avatar: { name: args.operatorName ?? defaultAppDemoProps.operatorName },
40
+ title: args.operatorTitle ?? defaultAppDemoProps.operatorTitle,
39
41
  actions: [
40
42
  { id: 'profile', primary: 'My profile', href: '#' },
41
43
  { id: 'settings', primary: 'Settings', href: '#' },
@@ -46,23 +48,14 @@ export const AppShellDemo = (args) => {
46
48
  count: numNewNotifications,
47
49
  items: args.notificationsEmpty ? [] : notifications,
48
50
  onItemClick: handleNotificationClick,
49
- loading: args.notificationsLoading,
51
+ loading: args.notificationsLoading ?? defaultAppDemoProps.notificationsLoading,
50
52
  onNotificationsOpen: () => {
51
53
  setNumNewNotifications(0);
52
54
  }
53
55
  }, navAlignment: args.navAlignment, navPosition: args.navPosition }));
54
56
  };
55
- AppShellDemo.args = {
56
- appName: 'Service Desk',
57
- imageSrc: 'https://www.pega.com/themes/custom/pegawww_theme/images/pega-logo.svg',
58
- numberOfNavLinks: 3,
59
- navAlignment: 'end',
60
- navPosition: 'inline',
61
- operatorName: 'Cindy Turner',
62
- operatorTitle: 'Account',
63
- notificationsEmpty: false,
64
- notificationsLoading: false
65
- };
57
+ AppShellDemo.args = defaultAppDemoProps;
58
+ // eslint-disable-next-line demo-patterns/args-match-types
66
59
  AppShellDemo.argTypes = {
67
60
  imageSrc: { control: { type: 'text' } },
68
61
  appName: { control: { type: 'text' } },