@pega/cosmos-react-work 10.0.0-build.1.8 → 10.0.0-build.10.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 (232) hide show
  1. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts +8 -4
  2. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
  3. package/lib/components/AppAnnouncement/AppAnnouncement.js +38 -11
  4. package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
  5. package/lib/components/AppAnnouncement/AppAnnouncement.test-ids.d.ts +2 -0
  6. package/lib/components/AppAnnouncement/AppAnnouncement.test-ids.d.ts.map +1 -0
  7. package/lib/components/AppAnnouncement/AppAnnouncement.test-ids.js +8 -0
  8. package/lib/components/AppAnnouncement/AppAnnouncement.test-ids.js.map +1 -0
  9. package/lib/components/Article/ArticleRating.d.ts.map +1 -1
  10. package/lib/components/Article/ArticleRating.js +2 -2
  11. package/lib/components/Article/ArticleRating.js.map +1 -1
  12. package/lib/components/ArticleList/ArticleFeedback.d.ts.map +1 -1
  13. package/lib/components/ArticleList/ArticleFeedback.js +2 -2
  14. package/lib/components/ArticleList/ArticleFeedback.js.map +1 -1
  15. package/lib/components/CasePreview/CasePreview.d.ts +2 -0
  16. package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
  17. package/lib/components/CasePreview/CasePreview.js +33 -13
  18. package/lib/components/CasePreview/CasePreview.js.map +1 -1
  19. package/lib/components/CaseView/CaseHeader/CaseHeader.d.ts.map +1 -1
  20. package/lib/components/CaseView/CaseHeader/CaseHeader.js +5 -3
  21. package/lib/components/CaseView/CaseHeader/CaseHeader.js.map +1 -1
  22. package/lib/components/CaseView/CaseSummary.d.ts +3 -2
  23. package/lib/components/CaseView/CaseSummary.d.ts.map +1 -1
  24. package/lib/components/CaseView/CaseSummary.js +2 -2
  25. package/lib/components/CaseView/CaseSummary.js.map +1 -1
  26. package/lib/components/CaseView/CaseView.d.ts.map +1 -1
  27. package/lib/components/CaseView/CaseView.js +6 -12
  28. package/lib/components/CaseView/CaseView.js.map +1 -1
  29. package/lib/components/CaseView/CaseView.styles.d.ts +2 -2
  30. package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
  31. package/lib/components/CaseView/CaseView.styles.js +193 -153
  32. package/lib/components/CaseView/CaseView.styles.js.map +1 -1
  33. package/lib/components/CaseView/CaseView.types.d.ts +6 -2
  34. package/lib/components/CaseView/CaseView.types.d.ts.map +1 -1
  35. package/lib/components/CaseView/CaseView.types.js.map +1 -1
  36. package/lib/components/CaseView/UtilitiesSummary.js +1 -4
  37. package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
  38. package/lib/components/CaseView/UtilitySummaryItemDialog.d.ts.map +1 -1
  39. package/lib/components/CaseView/UtilitySummaryItemDialog.js +7 -4
  40. package/lib/components/CaseView/UtilitySummaryItemDialog.js.map +1 -1
  41. package/lib/components/Details/Details.d.ts.map +1 -1
  42. package/lib/components/Details/Details.js +9 -6
  43. package/lib/components/Details/Details.js.map +1 -1
  44. package/lib/components/Details/Details.styles.d.ts.map +1 -1
  45. package/lib/components/Details/Details.styles.js +10 -7
  46. package/lib/components/Details/Details.styles.js.map +1 -1
  47. package/lib/components/Details/DetailsList.d.ts.map +1 -1
  48. package/lib/components/Details/DetailsList.js +2 -2
  49. package/lib/components/Details/DetailsList.js.map +1 -1
  50. package/lib/components/GenAICoach/ActiveCases.d.ts.map +1 -1
  51. package/lib/components/GenAICoach/ActiveCases.js +2 -1
  52. package/lib/components/GenAICoach/ActiveCases.js.map +1 -1
  53. package/lib/components/GenAICoach/GenAICoach.d.ts +1 -1
  54. package/lib/components/GenAICoach/GenAICoach.d.ts.map +1 -1
  55. package/lib/components/GenAICoach/GenAICoach.js +267 -73
  56. package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
  57. package/lib/components/GenAICoach/GenAICoach.styles.d.ts +232 -9
  58. package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
  59. package/lib/components/GenAICoach/GenAICoach.styles.js +374 -192
  60. package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
  61. package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts +1 -1
  62. package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts.map +1 -1
  63. package/lib/components/GenAICoach/GenAICoach.test-ids.js +3 -1
  64. package/lib/components/GenAICoach/GenAICoach.test-ids.js.map +1 -1
  65. package/lib/components/GenAICoach/GenAICoach.types.d.ts +36 -3
  66. package/lib/components/GenAICoach/GenAICoach.types.d.ts.map +1 -1
  67. package/lib/components/GenAICoach/GenAICoach.types.js.map +1 -1
  68. package/lib/components/GenAICoach/GenAIMessage.d.ts.map +1 -1
  69. package/lib/components/GenAICoach/GenAIMessage.js +44 -21
  70. package/lib/components/GenAICoach/GenAIMessage.js.map +1 -1
  71. package/lib/components/GenAICoach/GenAIMessageFeedback.d.ts.map +1 -1
  72. package/lib/components/GenAICoach/GenAIMessageFeedback.js +10 -3
  73. package/lib/components/GenAICoach/GenAIMessageFeedback.js.map +1 -1
  74. package/lib/components/GenAICoach/Questionnaire.d.ts.map +1 -1
  75. package/lib/components/GenAICoach/Questionnaire.js +10 -3
  76. package/lib/components/GenAICoach/Questionnaire.js.map +1 -1
  77. package/lib/components/GenAICoach/index.d.ts +1 -1
  78. package/lib/components/GenAICoach/index.d.ts.map +1 -1
  79. package/lib/components/GenAICoach/index.js.map +1 -1
  80. package/lib/components/HeroBanner/HeroBanner.d.ts +7 -0
  81. package/lib/components/HeroBanner/HeroBanner.d.ts.map +1 -0
  82. package/lib/components/HeroBanner/HeroBanner.js +63 -0
  83. package/lib/components/HeroBanner/HeroBanner.js.map +1 -0
  84. package/lib/components/HeroBanner/HeroBanner.styles.d.ts +35 -0
  85. package/lib/components/HeroBanner/HeroBanner.styles.d.ts.map +1 -0
  86. package/lib/components/HeroBanner/HeroBanner.styles.js +118 -0
  87. package/lib/components/HeroBanner/HeroBanner.styles.js.map +1 -0
  88. package/lib/components/HeroBanner/HeroBanner.test-ids.d.ts +2 -0
  89. package/lib/components/HeroBanner/HeroBanner.test-ids.d.ts.map +1 -0
  90. package/lib/components/HeroBanner/HeroBanner.test-ids.js +11 -0
  91. package/lib/components/HeroBanner/HeroBanner.test-ids.js.map +1 -0
  92. package/lib/components/HeroBanner/HeroBanner.types.d.ts +51 -0
  93. package/lib/components/HeroBanner/HeroBanner.types.d.ts.map +1 -0
  94. package/lib/components/HeroBanner/HeroBanner.types.js +2 -0
  95. package/lib/components/HeroBanner/HeroBanner.types.js.map +1 -0
  96. package/lib/components/HeroBanner/index.d.ts +3 -0
  97. package/lib/components/HeroBanner/index.d.ts.map +1 -0
  98. package/lib/components/HeroBanner/index.js +2 -0
  99. package/lib/components/HeroBanner/index.js.map +1 -0
  100. package/lib/components/HeroBanner/utils.d.ts +20 -0
  101. package/lib/components/HeroBanner/utils.d.ts.map +1 -0
  102. package/lib/components/HeroBanner/utils.js +125 -0
  103. package/lib/components/HeroBanner/utils.js.map +1 -0
  104. package/lib/components/HierarchicalAssignments/Assignments.styles.d.ts.map +1 -1
  105. package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.d.ts +5 -1
  106. package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.d.ts.map +1 -1
  107. package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.js.map +1 -1
  108. package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts +5 -1
  109. package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts.map +1 -1
  110. package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js +25 -15
  111. package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js.map +1 -1
  112. package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts.map +1 -1
  113. package/lib/components/IntelligentGuidance/IntelligentGuidance.js +6 -5
  114. package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +1 -1
  115. package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts.map +1 -1
  116. package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js +27 -9
  117. package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js.map +1 -1
  118. package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts +8 -0
  119. package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts.map +1 -1
  120. package/lib/components/IntelligentGuidance/IntelligentGuidance.types.js.map +1 -1
  121. package/lib/components/InteractionNotification/InteractionNotification.d.ts +2 -2
  122. package/lib/components/InteractionNotification/InteractionNotification.d.ts.map +1 -1
  123. package/lib/components/InteractionNotification/InteractionNotification.js +6 -4
  124. package/lib/components/InteractionNotification/InteractionNotification.js.map +1 -1
  125. package/lib/components/MasterDetail/DetailPanelHeader.d.ts +29 -0
  126. package/lib/components/MasterDetail/DetailPanelHeader.d.ts.map +1 -0
  127. package/lib/components/MasterDetail/DetailPanelHeader.js +14 -0
  128. package/lib/components/MasterDetail/DetailPanelHeader.js.map +1 -0
  129. package/lib/components/MasterDetail/MasterDetail.d.ts +6 -0
  130. package/lib/components/MasterDetail/MasterDetail.d.ts.map +1 -0
  131. package/lib/components/MasterDetail/MasterDetail.js +116 -0
  132. package/lib/components/MasterDetail/MasterDetail.js.map +1 -0
  133. package/lib/components/MasterDetail/MasterDetail.styles.d.ts +595 -0
  134. package/lib/components/MasterDetail/MasterDetail.styles.d.ts.map +1 -0
  135. package/lib/components/MasterDetail/MasterDetail.styles.js +246 -0
  136. package/lib/components/MasterDetail/MasterDetail.styles.js.map +1 -0
  137. package/lib/components/MasterDetail/MasterDetail.test-ids.d.ts +2 -0
  138. package/lib/components/MasterDetail/MasterDetail.test-ids.d.ts.map +1 -0
  139. package/lib/components/MasterDetail/MasterDetail.test-ids.js +19 -0
  140. package/lib/components/MasterDetail/MasterDetail.test-ids.js.map +1 -0
  141. package/lib/components/MasterDetail/MasterDetail.types.d.ts +71 -0
  142. package/lib/components/MasterDetail/MasterDetail.types.d.ts.map +1 -0
  143. package/lib/components/MasterDetail/MasterDetail.types.js +2 -0
  144. package/lib/components/MasterDetail/MasterDetail.types.js.map +1 -0
  145. package/lib/components/MasterDetail/MasterDetailActions.d.ts +10 -0
  146. package/lib/components/MasterDetail/MasterDetailActions.d.ts.map +1 -0
  147. package/lib/components/MasterDetail/MasterDetailActions.js +45 -0
  148. package/lib/components/MasterDetail/MasterDetailActions.js.map +1 -0
  149. package/lib/components/MasterDetail/index.d.ts +5 -0
  150. package/lib/components/MasterDetail/index.d.ts.map +1 -0
  151. package/lib/components/MasterDetail/index.js +4 -0
  152. package/lib/components/MasterDetail/index.js.map +1 -0
  153. package/lib/components/SearchResults/SearchResults.d.ts.map +1 -1
  154. package/lib/components/SearchResults/SearchResults.js +11 -7
  155. package/lib/components/SearchResults/SearchResults.js.map +1 -1
  156. package/lib/components/SearchResults/SearchResults.styles.js +3 -3
  157. package/lib/components/SearchResults/SearchResults.styles.js.map +1 -1
  158. package/lib/components/Shortcuts/Shortcuts.d.ts +1 -1
  159. package/lib/components/Shortcuts/Shortcuts.d.ts.map +1 -1
  160. package/lib/components/Shortcuts/Shortcuts.js +40 -18
  161. package/lib/components/Shortcuts/Shortcuts.js.map +1 -1
  162. package/lib/components/Shortcuts/Shortcuts.styles.d.ts +17 -6
  163. package/lib/components/Shortcuts/Shortcuts.styles.d.ts.map +1 -1
  164. package/lib/components/Shortcuts/Shortcuts.styles.js +104 -58
  165. package/lib/components/Shortcuts/Shortcuts.styles.js.map +1 -1
  166. package/lib/components/Shortcuts/Shortcuts.test-ids.d.ts +1 -1
  167. package/lib/components/Shortcuts/Shortcuts.test-ids.d.ts.map +1 -1
  168. package/lib/components/Shortcuts/Shortcuts.test-ids.js +4 -3
  169. package/lib/components/Shortcuts/Shortcuts.test-ids.js.map +1 -1
  170. package/lib/components/Shortcuts/Shortcuts.types.d.ts +18 -2
  171. package/lib/components/Shortcuts/Shortcuts.types.d.ts.map +1 -1
  172. package/lib/components/Shortcuts/Shortcuts.types.js.map +1 -1
  173. package/lib/components/Stages/Stages.d.ts +4 -2
  174. package/lib/components/Stages/Stages.d.ts.map +1 -1
  175. package/lib/components/Stages/Stages.js +123 -88
  176. package/lib/components/Stages/Stages.js.map +1 -1
  177. package/lib/components/Stages/Stages.styles.d.ts +88 -3
  178. package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
  179. package/lib/components/Stages/Stages.styles.js +873 -171
  180. package/lib/components/Stages/Stages.styles.js.map +1 -1
  181. package/lib/components/Stages/Stages.test-ids.d.ts +2 -0
  182. package/lib/components/Stages/Stages.test-ids.d.ts.map +1 -0
  183. package/lib/components/Stages/Stages.test-ids.js +7 -0
  184. package/lib/components/Stages/Stages.test-ids.js.map +1 -0
  185. package/lib/components/Stages/Stages.types.d.ts +9 -3
  186. package/lib/components/Stages/Stages.types.d.ts.map +1 -1
  187. package/lib/components/Stages/Stages.types.js.map +1 -1
  188. package/lib/components/Stages/index.d.ts +2 -1
  189. package/lib/components/Stages/index.d.ts.map +1 -1
  190. package/lib/components/Stages/index.js +1 -0
  191. package/lib/components/Stages/index.js.map +1 -1
  192. package/lib/components/Stages/useStagesScrollbar.d.ts +21 -0
  193. package/lib/components/Stages/useStagesScrollbar.d.ts.map +1 -0
  194. package/lib/components/Stages/useStagesScrollbar.js +152 -0
  195. package/lib/components/Stages/useStagesScrollbar.js.map +1 -0
  196. package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -1
  197. package/lib/components/Stakeholders/Stakeholders.js +13 -11
  198. package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
  199. package/lib/components/Stakeholders/Stakeholders.types.d.ts +1 -1
  200. package/lib/components/Stakeholders/Stakeholders.types.d.ts.map +1 -1
  201. package/lib/components/Stakeholders/Stakeholders.types.js.map +1 -1
  202. package/lib/components/Tags/Tags.d.ts.map +1 -1
  203. package/lib/components/Tags/Tags.js +2 -13
  204. package/lib/components/Tags/Tags.js.map +1 -1
  205. package/lib/components/Tasks/TaskCard.d.ts +8 -0
  206. package/lib/components/Tasks/TaskCard.d.ts.map +1 -0
  207. package/lib/components/Tasks/TaskCard.js +42 -0
  208. package/lib/components/Tasks/TaskCard.js.map +1 -0
  209. package/lib/components/Tasks/TaskCards.d.ts +9 -0
  210. package/lib/components/Tasks/TaskCards.d.ts.map +1 -0
  211. package/lib/components/Tasks/TaskCards.js +40 -0
  212. package/lib/components/Tasks/TaskCards.js.map +1 -0
  213. package/lib/components/Tasks/TaskList.d.ts +13 -1
  214. package/lib/components/Tasks/TaskList.d.ts.map +1 -1
  215. package/lib/components/Tasks/TaskList.js +31 -19
  216. package/lib/components/Tasks/TaskList.js.map +1 -1
  217. package/lib/components/Tasks/Tasks.d.ts +46 -6
  218. package/lib/components/Tasks/Tasks.d.ts.map +1 -1
  219. package/lib/components/Tasks/Tasks.js +11 -5
  220. package/lib/components/Tasks/Tasks.js.map +1 -1
  221. package/lib/components/Tasks/Tasks.test-ids.d.ts +1 -1
  222. package/lib/components/Tasks/Tasks.test-ids.d.ts.map +1 -1
  223. package/lib/components/Tasks/Tasks.test-ids.js +1 -1
  224. package/lib/components/Tasks/Tasks.test-ids.js.map +1 -1
  225. package/lib/components/Tasks/index.d.ts +1 -1
  226. package/lib/components/Tasks/index.d.ts.map +1 -1
  227. package/lib/components/Tasks/index.js.map +1 -1
  228. package/lib/index.d.ts +4 -0
  229. package/lib/index.d.ts.map +1 -1
  230. package/lib/index.js +4 -0
  231. package/lib/index.js.map +1 -1
  232. package/package.json +5 -6
@@ -1,6 +1,6 @@
1
1
  import type { Ref } from 'react';
2
- import type { BaseProps, ForwardRefForwardPropsComponent, NoChildrenProp } from '@pega/cosmos-react-core';
3
- export interface AppAnnouncementProps extends BaseProps, NoChildrenProp {
2
+ import type { BaseProps, ForwardRefForwardPropsComponent, NoChildrenProp, TestIdProp } from '@pega/cosmos-react-core';
3
+ export interface AppAnnouncementProps extends BaseProps, NoChildrenProp, TestIdProp {
4
4
  /** Heading text for the announcement. */
5
5
  heading?: string;
6
6
  /** Description text for the announcement. */
@@ -11,6 +11,8 @@ export interface AppAnnouncementProps extends BaseProps, NoChildrenProp {
11
11
  whatsNewLink?: string;
12
12
  /** Content to populate the announcement button. */
13
13
  whatsNewText?: string;
14
+ /** When provided, the heading renders as a link to this URL and the What's new button is hidden. */
15
+ headingUrl?: string;
14
16
  /** An image source for the decorative background. */
15
17
  image?: string;
16
18
  /**
@@ -23,6 +25,8 @@ export interface AppAnnouncementProps extends BaseProps, NoChildrenProp {
23
25
  }
24
26
  export declare const StyledAppAnnouncementContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
25
27
  export declare const StyledAppAnnouncement: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, Pick<AppAnnouncementProps, "image" | "fitToParent">>> & string;
26
- declare const AppAnnouncement: ForwardRefForwardPropsComponent<AppAnnouncementProps>;
27
- export default AppAnnouncement;
28
+ declare const _default: ForwardRefForwardPropsComponent<AppAnnouncementProps> & {
29
+ getTestIds: (testIdProp?: TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["heading", "description", "dismiss", "whats-new"]>;
30
+ };
31
+ export default _default;
28
32
  //# sourceMappingURL=AppAnnouncement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppAnnouncement.d.ts","sourceRoot":"","sources":["../../../src/components/AppAnnouncement/AppAnnouncement.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAelD,OAAO,KAAK,EACV,SAAS,EACT,+BAA+B,EAC/B,cAAc,EACf,MAAM,yBAAyB,CAAC;AAKjC,MAAM,WAAW,oBAAqB,SAAQ,SAAS,EAAE,cAAc;IACrE,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAOD,eAAO,MAAM,4BAA4B,6NAiCvC,CAAC;AAIH,eAAO,MAAM,qBAAqB,kRA4EhC,CAAC;AAIH,QAAA,MAAM,eAAe,EAAE,+BAA+B,CAAC,oBAAoB,CAwD1E,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"AppAnnouncement.d.ts","sourceRoot":"","sources":["../../../src/components/AppAnnouncement/AppAnnouncement.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAiBlD,OAAO,KAAK,EACV,SAAS,EACT,+BAA+B,EAC/B,cAAc,EACd,UAAU,EACX,MAAM,yBAAyB,CAAC;AAOjC,MAAM,WAAW,oBAAqB,SAAQ,SAAS,EAAE,cAAc,EAAE,UAAU;IACjF,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oGAAoG;IACpG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAaD,eAAO,MAAM,4BAA4B,6NAiCvC,CAAC;AAIH,eAAO,MAAM,qBAAqB,kRAmGhC,CAAC;;;;AAsFH,wBAAuE"}
@@ -1,13 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
- import { Button, StyledButton, Text, Icon, registerIcon, useI18n, defaultThemeProp, useDirection, calculateForegroundColor, HTML } from '@pega/cosmos-react-core';
4
+ import { Button, StyledButton, Text, Icon, registerIcon, useI18n, defaultThemeProp, useDirection, calculateForegroundColor, HTML, useTestIds, withTestIds } from '@pega/cosmos-react-core';
5
5
  import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
6
+ import { getAppAnnouncementTestIds } from './AppAnnouncement.test-ids';
6
7
  registerIcon(timesIcon);
7
8
  const StyledDismissButton = styled.button `
8
9
  font-size: 1.25rem;
9
10
  border: none;
10
11
  `;
12
+ const StyledHeadingLink = styled(Button) `
13
+ color: inherit;
14
+ `;
15
+ StyledHeadingLink.defaultProps = defaultThemeProp;
11
16
  export const StyledAppAnnouncementContent = styled.div(props => {
12
17
  const { theme: { base: { spacing } } } = props;
13
18
  return css `
@@ -39,9 +44,9 @@ export const StyledAppAnnouncementContent = styled.div(props => {
39
44
  });
40
45
  StyledAppAnnouncementContent.defaultProps = defaultThemeProp;
41
46
  export const StyledAppAnnouncement = styled.article(props => {
42
- const { theme: { base: { shadow, spacing }, components: { card: { 'border-radius': borderRadius }, announcement: { background, 'foreground-color': foregroundColor } } }, image } = props;
47
+ const { theme, theme: { base: { shadow, spacing }, components: { card: { 'border-radius': borderRadius }, announcement: { background, 'foreground-color': foregroundColor } } }, image } = props;
43
48
  const { end } = useDirection();
44
- const color = calculateForegroundColor(background, foregroundColor);
49
+ const color = calculateForegroundColor(background, foregroundColor, theme);
45
50
  return css `
46
51
  padding: calc(2 * ${spacing});
47
52
  background: ${background};
@@ -49,7 +54,29 @@ export const StyledAppAnnouncement = styled.article(props => {
49
54
  color: ${color};
50
55
  position: relative;
51
56
 
52
- ${props.fitToParent && 'block-size: 100%;'};
57
+ ${props.fitToParent &&
58
+ css `
59
+ min-block-size: 100%;
60
+ display: flex;
61
+ flex-direction: column;
62
+
63
+ > div {
64
+ flex: 1;
65
+ display: flex;
66
+ flex-direction: column;
67
+ min-height: 0;
68
+
69
+ ${StyledAppAnnouncementContent} {
70
+ flex: 1;
71
+ min-height: 0;
72
+ max-height: none;
73
+ }
74
+
75
+ ${StyledButton} {
76
+ align-self: flex-start;
77
+ }
78
+ }
79
+ `};
53
80
 
54
81
  &::after {
55
82
  background: url('${image}') no-repeat;
@@ -105,12 +132,12 @@ export const StyledAppAnnouncement = styled.article(props => {
105
132
  StyledAppAnnouncement.defaultProps = defaultThemeProp;
106
133
  const AppAnnouncement = forwardRef(function AppAnnouncement(props, ref) {
107
134
  const t = useI18n();
108
- const { heading, description, details, whatsNewLink, whatsNewText = t('app_announcement_whats_new_button_label'), image, onDismiss, ...restProps } = props;
109
- return (_jsxs(StyledAppAnnouncement, { ...restProps, ref: ref, image: image, children: [onDismiss && (_jsx(Button, { as: StyledDismissButton, variant: 'simple', icon: true, onClick: onDismiss, "aria-label": t('app_announcement_dismiss_button_label_a11y'), children: _jsx(Icon, { name: 'times' }) })), _jsx(Text, { variant: 'h2', children: heading || t('app_announcement_details_list_header') }), _jsxs("div", { children: [_jsxs(StyledAppAnnouncementContent, { children: [description && _jsx(HTML, { as: 'p', content: description }), !!details?.length && (_jsx("ul", { children: details.map((item, index) => {
110
- return (
111
- // eslint-disable-next-line react/no-array-index-key
112
- _jsx("li", { children: _jsx(HTML, { content: item }) }, index));
113
- }) }))] }), whatsNewLink && (_jsx(Button, { variant: 'secondary', href: whatsNewLink, target: '_blank', children: whatsNewText }))] })] }));
135
+ const { heading, description, details, whatsNewLink, whatsNewText = t('app_announcement_whats_new_button_label'), headingUrl, image, onDismiss, testId, ...restProps } = props;
136
+ const testIds = useTestIds(testId, getAppAnnouncementTestIds);
137
+ const resolvedHeading = heading || t('app_announcement_details_list_header');
138
+ return (_jsxs(StyledAppAnnouncement, { "data-testid": testIds.root, ...restProps, ref: ref, image: image, children: [onDismiss && (_jsx(Button, { as: StyledDismissButton, variant: 'simple', icon: true, onClick: onDismiss, "aria-label": t('app_announcement_dismiss_button_label_a11y'), children: _jsx(Icon, { name: 'times' }) })), _jsx(Text, { variant: 'h2', "data-testid": testIds.heading, children: headingUrl ? (_jsx(StyledHeadingLink, { variant: 'link', href: headingUrl, target: '_blank', rel: 'noopener noreferrer', children: resolvedHeading })) : (resolvedHeading) }), _jsxs("div", { children: [_jsxs(StyledAppAnnouncementContent, { children: [description && _jsx(HTML, { as: 'p', content: description, "data-testid": testIds.description }), !!details?.length && (_jsx("ul", { children: details.map((item, index) => {
139
+ return (_jsx("li", { children: _jsx(HTML, { content: item }) }, index));
140
+ }) }))] }), !headingUrl && whatsNewLink && (_jsx(Button, { variant: 'secondary', href: whatsNewLink, target: '_blank', "data-testid": testIds.whatsNew, children: whatsNewText }))] })] }));
114
141
  });
115
- export default AppAnnouncement;
142
+ export default withTestIds(AppAnnouncement, getAppAnnouncementTestIds);
116
143
  //# sourceMappingURL=AppAnnouncement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppAnnouncement.js","sourceRoot":"","sources":["../../../src/components/AppAnnouncement/AppAnnouncement.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,YAAY,EACZ,I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OAAO,EAAE,IAAI,GAAI,IADhB,KAAK,CAET,CACN,CAAC;gCACJ,CAAC,CAAC,GACC,CACN,IAC4B,EAC9B,YAAY,IAAI,CACf,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAC,QAAQ,YAC5D,YAAY,GACN,CACV,IACG,IACgB,CACzB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n StyledButton,\n Text,\n Icon,\n registerIcon,\n useI18n,\n defaultThemeProp,\n useDirection,\n calculateForegroundColor,\n HTML\n} from '@pega/cosmos-react-core';\nimport type {\n BaseProps,\n ForwardRefForwardPropsComponent,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nregisterIcon(timesIcon);\n\nexport interface AppAnnouncementProps extends BaseProps, NoChildrenProp {\n /** Heading text for the announcement. */\n heading?: string;\n /** Description text for the announcement. */\n description?: string;\n /** Announcement details to be displayed in form of bulleted list. */\n details?: string[];\n /** Url to open with What's new link. */\n whatsNewLink?: string;\n /** Content to populate the announcement button. */\n whatsNewText?: string;\n /** An image source for the decorative background. */\n image?: string;\n /**\n * Whether to fit AppAnnouncement widget in the parent element.\n */\n fitToParent?: boolean;\n /** Callback when user dismisses the announcements. */\n onDismiss?: () => void;\n ref?: Ref<HTMLElement>;\n}\n\nconst StyledDismissButton = styled.button`\n font-size: 1.25rem;\n border: none;\n`;\n\nexport const StyledAppAnnouncementContent = styled.div(props => {\n const {\n theme: {\n base: { spacing }\n }\n } = props;\n\n return css`\n max-height: 12rem;\n overflow-y: auto;\n margin-block-start: calc(1.5 * ${spacing});\n margin-inline: calc(-2 * ${spacing});\n padding-inline: calc(2 * ${spacing});\n\n p,\n ul {\n line-height: 1.4;\n }\n\n ul {\n padding-inline-start: calc(2 * ${spacing});\n }\n\n p + ul {\n margin-block-start: calc(1.5 * ${spacing});\n }\n\n li {\n &:not(:last-child) {\n margin-block-end: ${spacing};\n }\n }\n `;\n});\n\nStyledAppAnnouncementContent.defaultProps = defaultThemeProp;\n\nexport const StyledAppAnnouncement = styled.article<\n Pick<AppAnnouncementProps, 'image' | 'fitToParent'>\n>(props => {\n const {\n theme: {\n base: { shadow, spacing },\n components: {\n card: { 'border-radius': borderRadius },\n announcement: { background, 'foreground-color': foregroundColor }\n }\n },\n image\n } = props;\n\n const { end } = useDirection();\n const color = calculateForegroundColor(background, foregroundColor);\n\n return css`\n padding: calc(2 * ${spacing});\n background: ${background};\n border-radius: ${borderRadius};\n color: ${color};\n position: relative;\n\n ${props.fitToParent && 'block-size: 100%;'};\n\n &::after {\n background: url('${image}') no-repeat;\n background-position: ${end} bottom;\n background-size: contain;\n background-origin: content-box;\n opacity: 0.2;\n content: '';\n display: block;\n position: absolute;\n width: 50%;\n height: 100%;\n inset-inline-end: 0;\n bottom: 0;\n padding: calc(2 * ${spacing});\n }\n\n h2 {\n position: relative;\n z-index: 2;\n }\n\n ${StyledDismissButton} {\n position: absolute;\n top: 0.75rem;\n inset-inline-end: 0.75rem;\n color: inherit;\n z-index: 3;\n &:enabled:hover {\n background: #ffffff19;\n }\n &:enabled:focus-visible {\n box-shadow: ${shadow.focus};\n }\n }\n\n > div {\n position: relative;\n z-index: 2;\n\n ${StyledButton} {\n margin-top: calc(2 * ${spacing});\n white-space: normal;\n\n &:enabled:focus-visible,\n &:not([disabled]):focus-visible {\n box-shadow: ${shadow.focus};\n }\n }\n }\n `;\n});\n\nStyledAppAnnouncement.defaultProps = defaultThemeProp;\n\nconst AppAnnouncement: ForwardRefForwardPropsComponent<AppAnnouncementProps> = forwardRef(\n function AppAnnouncement(\n props: PropsWithoutRef<AppAnnouncementProps>,\n ref: AppAnnouncementProps['ref']\n ) {\n const t = useI18n();\n const {\n heading,\n description,\n details,\n whatsNewLink,\n whatsNewText = t('app_announcement_whats_new_button_label'),\n image,\n onDismiss,\n ...restProps\n } = props;\n\n return (\n <StyledAppAnnouncement {...restProps} ref={ref} image={image}>\n {onDismiss && (\n <Button\n as={StyledDismissButton}\n variant='simple'\n icon\n onClick={onDismiss}\n aria-label={t('app_announcement_dismiss_button_label_a11y')}\n >\n <Icon name='times' />\n </Button>\n )}\n <Text variant='h2'>{heading || t('app_announcement_details_list_header')}</Text>\n <div>\n <StyledAppAnnouncementContent>\n {description && <HTML as='p' content={description} />}\n {!!details?.length && (\n <ul>\n {details.map((item, index) => {\n return (\n // eslint-disable-next-line react/no-array-index-key\n <li key={index}>\n <HTML content={item} />\n </li>\n );\n })}\n </ul>\n )}\n </StyledAppAnnouncementContent>\n {whatsNewLink && (\n <Button variant='secondary' href={whatsNewLink} target='_blank'>\n {whatsNewText}\n </Button>\n )}\n </div>\n </StyledAppAnnouncement>\n );\n }\n);\n\nexport default AppAnnouncement;\n"]}
1
+ {"version":3,"file":"AppAnnouncement.js","sourceRoot":"","sources":["../../../src/components/AppAnnouncement/AppAnnouncement.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACxB,IAAI,EACJ,UAAU,EACV,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAOjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAE1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,YAAY,CAAC,SAAS,CAAC,CAAC;AA0BxB,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAA;;;CAGxC,CAAC;AAEF,MAAM,iBAAiB,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,0BACE,MAAC,4BAA4B,eAC1B,WAAW,IAAI,KAAC,IAAI,IAAC,EAAE,EAAC,GAAG,EAAC,OAAO,EAAE,WAAW,iBAAe,OAAO,CAAC,WAAW,GAAI,EACtF,CAAC,CAAC,OAAO,EAAE,MAAM,IAAI,CACpB,uBACG,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;oCAC3B,OAAO,CAEL,uBACE,KAAC,IAAI,IAAC,OAAO,EAAE,IAAI,GAAI,IADhB,KAAK,CAET,CACN,CAAC;gCACJ,CAAC,CAAC,GACC,CACN,IAC4B,EAC9B,CAAC,UAAU,IAAI,YAAY,IAAI,CAC9B,KAAC,MAAM,IACL,OAAO,EAAC,WAAW,EACnB,IAAI,EAAE,YAAY,EAClB,MAAM,EAAC,QAAQ,iBACF,OAAO,CAAC,QAAQ,YAE5B,YAAY,GACN,CACV,IACG,IACgB,CACzB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,eAAe,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n StyledButton,\n Text,\n Icon,\n registerIcon,\n useI18n,\n defaultThemeProp,\n useDirection,\n calculateForegroundColor,\n HTML,\n useTestIds,\n withTestIds\n} from '@pega/cosmos-react-core';\nimport type {\n BaseProps,\n ForwardRefForwardPropsComponent,\n NoChildrenProp,\n TestIdProp\n} from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nimport { getAppAnnouncementTestIds } from './AppAnnouncement.test-ids';\n\nregisterIcon(timesIcon);\n\nexport interface AppAnnouncementProps extends BaseProps, NoChildrenProp, TestIdProp {\n /** Heading text for the announcement. */\n heading?: string;\n /** Description text for the announcement. */\n description?: string;\n /** Announcement details to be displayed in form of bulleted list. */\n details?: string[];\n /** Url to open with What's new link. */\n whatsNewLink?: string;\n /** Content to populate the announcement button. */\n whatsNewText?: string;\n /** When provided, the heading renders as a link to this URL and the What's new button is hidden. */\n headingUrl?: string;\n /** An image source for the decorative background. */\n image?: string;\n /**\n * Whether to fit AppAnnouncement widget in the parent element.\n */\n fitToParent?: boolean;\n /** Callback when user dismisses the announcements. */\n onDismiss?: () => void;\n ref?: Ref<HTMLElement>;\n}\n\nconst StyledDismissButton = styled.button`\n font-size: 1.25rem;\n border: none;\n`;\n\nconst StyledHeadingLink = styled(Button)`\n color: inherit;\n`;\n\nStyledHeadingLink.defaultProps = defaultThemeProp;\n\nexport const StyledAppAnnouncementContent = styled.div(props => {\n const {\n theme: {\n base: { spacing }\n }\n } = props;\n\n return css`\n max-height: 12rem;\n overflow-y: auto;\n margin-block-start: calc(1.5 * ${spacing});\n margin-inline: calc(-2 * ${spacing});\n padding-inline: calc(2 * ${spacing});\n\n p,\n ul {\n line-height: 1.4;\n }\n\n ul {\n padding-inline-start: calc(2 * ${spacing});\n }\n\n p + ul {\n margin-block-start: calc(1.5 * ${spacing});\n }\n\n li {\n &:not(:last-child) {\n margin-block-end: ${spacing};\n }\n }\n `;\n});\n\nStyledAppAnnouncementContent.defaultProps = defaultThemeProp;\n\nexport const StyledAppAnnouncement = styled.article<\n Pick<AppAnnouncementProps, 'image' | 'fitToParent'>\n>(props => {\n const {\n theme,\n theme: {\n base: { shadow, spacing },\n components: {\n card: { 'border-radius': borderRadius },\n announcement: { background, 'foreground-color': foregroundColor }\n }\n },\n image\n } = props;\n\n const { end } = useDirection();\n const color = calculateForegroundColor(background, foregroundColor, theme);\n\n return css`\n padding: calc(2 * ${spacing});\n background: ${background};\n border-radius: ${borderRadius};\n color: ${color};\n position: relative;\n\n ${props.fitToParent &&\n css`\n min-block-size: 100%;\n display: flex;\n flex-direction: column;\n\n > div {\n flex: 1;\n display: flex;\n flex-direction: column;\n min-height: 0;\n\n ${StyledAppAnnouncementContent} {\n flex: 1;\n min-height: 0;\n max-height: none;\n }\n\n ${StyledButton} {\n align-self: flex-start;\n }\n }\n `};\n\n &::after {\n background: url('${image}') no-repeat;\n background-position: ${end} bottom;\n background-size: contain;\n background-origin: content-box;\n opacity: 0.2;\n content: '';\n display: block;\n position: absolute;\n width: 50%;\n height: 100%;\n inset-inline-end: 0;\n bottom: 0;\n padding: calc(2 * ${spacing});\n }\n\n h2 {\n position: relative;\n z-index: 2;\n }\n\n ${StyledDismissButton} {\n position: absolute;\n top: 0.75rem;\n inset-inline-end: 0.75rem;\n color: inherit;\n z-index: 3;\n &:enabled:hover {\n background: #ffffff19;\n }\n &:enabled:focus-visible {\n box-shadow: ${shadow.focus};\n }\n }\n\n > div {\n position: relative;\n z-index: 2;\n\n ${StyledButton} {\n margin-top: calc(2 * ${spacing});\n white-space: normal;\n\n &:enabled:focus-visible,\n &:not([disabled]):focus-visible {\n box-shadow: ${shadow.focus};\n }\n }\n }\n `;\n});\n\nStyledAppAnnouncement.defaultProps = defaultThemeProp;\n\nconst AppAnnouncement: ForwardRefForwardPropsComponent<AppAnnouncementProps> = forwardRef(\n function AppAnnouncement(\n props: PropsWithoutRef<AppAnnouncementProps>,\n ref: AppAnnouncementProps['ref']\n ) {\n const t = useI18n();\n const {\n heading,\n description,\n details,\n whatsNewLink,\n whatsNewText = t('app_announcement_whats_new_button_label'),\n headingUrl,\n image,\n onDismiss,\n testId,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getAppAnnouncementTestIds);\n\n const resolvedHeading = heading || t('app_announcement_details_list_header');\n\n return (\n <StyledAppAnnouncement data-testid={testIds.root} {...restProps} ref={ref} image={image}>\n {onDismiss && (\n <Button\n as={StyledDismissButton}\n variant='simple'\n icon\n onClick={onDismiss}\n aria-label={t('app_announcement_dismiss_button_label_a11y')}\n >\n <Icon name='times' />\n </Button>\n )}\n <Text variant='h2' data-testid={testIds.heading}>\n {headingUrl ? (\n <StyledHeadingLink\n variant='link'\n href={headingUrl}\n target='_blank'\n rel='noopener noreferrer'\n >\n {resolvedHeading}\n </StyledHeadingLink>\n ) : (\n resolvedHeading\n )}\n </Text>\n <div>\n <StyledAppAnnouncementContent>\n {description && <HTML as='p' content={description} data-testid={testIds.description} />}\n {!!details?.length && (\n <ul>\n {details.map((item, index) => {\n return (\n // eslint-disable-next-line react/no-array-index-key\n <li key={index}>\n <HTML content={item} />\n </li>\n );\n })}\n </ul>\n )}\n </StyledAppAnnouncementContent>\n {!headingUrl && whatsNewLink && (\n <Button\n variant='secondary'\n href={whatsNewLink}\n target='_blank'\n data-testid={testIds.whatsNew}\n >\n {whatsNewText}\n </Button>\n )}\n </div>\n </StyledAppAnnouncement>\n );\n }\n);\n\nexport default withTestIds(AppAnnouncement, getAppAnnouncementTestIds);\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const getAppAnnouncementTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["heading", "description", "dismiss", "whats-new"]>;
2
+ //# sourceMappingURL=AppAnnouncement.test-ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppAnnouncement.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/AppAnnouncement/AppAnnouncement.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB,uLAK3B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { createTestIds } from '@pega/cosmos-react-core';
2
+ export const getAppAnnouncementTestIds = createTestIds('app-announcement', [
3
+ 'heading',
4
+ 'description',
5
+ 'dismiss',
6
+ 'whats-new'
7
+ ]);
8
+ //# sourceMappingURL=AppAnnouncement.test-ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppAnnouncement.test-ids.js","sourceRoot":"","sources":["../../../src/components/AppAnnouncement/AppAnnouncement.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,yBAAyB,GAAG,aAAa,CAAC,kBAAkB,EAAE;IACzE,SAAS;IACT,aAAa;IACb,SAAS;IACT,WAAW;CACH,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\n\nexport const getAppAnnouncementTestIds = createTestIds('app-announcement', [\n 'heading',\n 'description',\n 'dismiss',\n 'whats-new'\n] as const);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ArticleRating.d.ts","sourceRoot":"","sources":["../../../src/components/Article/ArticleRating.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAqB/C,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAChC,UAAU,EAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAChE;AAED,eAAO,MAAM,uBAAuB,+NAEnC,CAAC;AAIF,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,CAsFxD,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"ArticleRating.d.ts","sourceRoot":"","sources":["../../../src/components/Article/ArticleRating.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAqB/C,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAChC,UAAU,EAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAChE;AAED,eAAO,MAAM,uBAAuB,+NAEnC,CAAC;AAIF,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,CA4FxD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -35,9 +35,9 @@ const ArticleRating = ({ dislikes, likes, reaction, onReaction, ...restProps })
35
35
  : dislikes;
36
36
  return (_jsxs(Flex, { ...restProps, container: { gap: 1 }, children: [_jsxs(Flex, { container: { gap: 0.5, alignItems: 'center' }, children: [_jsx(Button, { variant: 'simple', label: t('like'), icon: true, compact: true, onClick: () => {
37
37
  onReaction(reaction === 'liked' ? undefined : 'liked');
38
- }, "aria-label": `${formattedLikes} ${t('likes')}`, "aria-pressed": reaction === 'liked', children: _jsx(Icon, { name: reaction === 'liked' ? 'thumbs-up-solid' : 'thumbs-up' }) }), formattedLikes && (_jsx(Text, { as: reaction === 'liked' ? StyledReactedPercentage : undefined, variant: 'secondary', "aria-hidden": true, children: formattedLikes }))] }), _jsxs(Flex, { container: { gap: 0.5, alignItems: 'center' }, children: [_jsx(Button, { "aria-label": `${formattedDislikes} ${t('dislikes')}`, variant: 'simple', label: t('dislike'), icon: true, compact: true, "aria-pressed": reaction === 'disliked', onClick: () => {
38
+ }, "aria-label": `${formattedLikes} ${t('likes')}`, "aria-pressed": reaction === 'liked', children: _jsx(Icon, { name: reaction === 'liked' ? 'thumbs-up-solid' : 'thumbs-up', emphasized: reaction === 'liked' }) }), formattedLikes && (_jsx(Text, { as: reaction === 'liked' ? StyledReactedPercentage : undefined, variant: 'secondary', "aria-hidden": true, children: formattedLikes }))] }), _jsxs(Flex, { container: { gap: 0.5, alignItems: 'center' }, children: [_jsx(Button, { "aria-label": `${formattedDislikes} ${t('dislikes')}`, variant: 'simple', label: t('dislike'), icon: true, compact: true, "aria-pressed": reaction === 'disliked', onClick: () => {
39
39
  onReaction(reaction === 'disliked' ? undefined : 'disliked');
40
- }, children: _jsx(Icon, { name: reaction === 'disliked' ? 'thumbs-down-solid' : 'thumbs-down' }) }), formattedDislikes && (_jsx(Text, { as: reaction === 'disliked' ? StyledReactedPercentage : undefined, variant: 'secondary', "aria-hidden": true, children: formattedDislikes }))] })] }));
40
+ }, children: _jsx(Icon, { name: reaction === 'disliked' ? 'thumbs-down-solid' : 'thumbs-down', emphasized: reaction === 'disliked' }) }), formattedDislikes && (_jsx(Text, { as: reaction === 'disliked' ? StyledReactedPercentage : undefined, variant: 'secondary', "aria-hidden": true, children: formattedDislikes }))] })] }));
41
41
  };
42
42
  export default ArticleRating;
43
43
  //# sourceMappingURL=ArticleRating.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArticleRating.js","sourceRoot":"","sources":["../../../src/components/Article/ArticleRating.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,iBAAiB,MAAM,wEAAwE,CAAC;AAC5G,OAAO,KAAK,YAAY,MAAM,kEAAkE,CAAC;AACjG,OAAO,KAAK,mBAAmB,MAAM,0EAA0E,CAAC;AAChH,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AAErG,YAAY,CAAC,iBAAiB,EAAE,YAAY,EAAE,mBAAmB,EAAE,cAAc,CAAC,CAAC;AAWnF,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,IAAI,CAAA;iBACjC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC;CAC7D,CAAC;AAEF,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAExD,MAAM,aAAa,GAA0C,CAAC,EAC5D,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,UAAU,EACV,GAAG,SAAS,EACb,EAAE,EAAE;IACH,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,EA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CAAC,uBAAuB,CAAC,CAAC,CAAC,SAAS,EAC9D,OAAO,EAAC,WAAW,iCAGlB,cAAc,GACV,CACR,IACI,EAEP,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,aACjD,KAAC,MAAM,kBACO,GAAG,iBAAiB,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,EACnD,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC,EACnB,IAAI,QACJ,OAAO,wBACO,QAAQ,KAAK,UAAU,EACrC,OAAO,EAAE,GAAG,EAAE;4BACZ,UAAU,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;wBAC/D,CAAC,YAED,KAAC,IAAI,IAAC,IAAI,EAAE,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,aAAa,GAAI,GACtE,EACR,iBAAiB,IAAI,CACpB,KAAC,IAAI,IACH,EAAE,EAAE,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,SAAS,EACjE,OAAO,EAAC,WAAW,iCAGlB,iBAAiB,GACb,CACR,IACI,IACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import type { FunctionComponent } from 'react';\nimport styled from 'styled-components';\n\nimport {\n registerIcon,\n Flex,\n Button,\n Icon,\n Text,\n useI18n,\n defaultThemeProp,\n formatNumber,\n useConfiguration\n} from '@pega/cosmos-react-core';\nimport * as thumbsUpSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up-solid.icon';\nimport * as thumbsUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up.icon';\nimport * as thumbsDownSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down-solid.icon';\nimport * as thumbsDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down.icon';\n\nregisterIcon(thumbsUpSolidIcon, thumbsUpIcon, thumbsDownSolidIcon, thumbsDownIcon);\n\nexport interface ArticleRatingProps {\n /** Percentage of likes */\n likes?: number;\n /** Percentage of dislikes */\n dislikes?: number;\n reaction?: 'liked' | 'disliked';\n onReaction: (reaction: ArticleRatingProps['reaction']) => void;\n}\n\nexport const StyledReactedPercentage = styled.span`\n font-weight: ${p => p.theme.base['font-weight']['semi-bold']};\n`;\n\nStyledReactedPercentage.defaultProps = defaultThemeProp;\n\nconst ArticleRating: FunctionComponent<ArticleRatingProps> = ({\n dislikes,\n likes,\n reaction,\n onReaction,\n ...restProps\n}) => {\n const t = useI18n();\n const { locale } = useConfiguration();\n\n const formattedLikes =\n likes !== undefined\n ? formatNumber(likes, {\n locale,\n options: {\n style: 'unit',\n unit: 'percent',\n maximumFractionDigits: 0\n }\n })\n : likes;\n const formattedDislikes =\n dislikes !== undefined\n ? formatNumber(dislikes, {\n locale,\n options: {\n style: 'unit',\n unit: 'percent',\n maximumFractionDigits: 0\n }\n })\n : dislikes;\n\n return (\n <Flex {...restProps} container={{ gap: 1 }}>\n <Flex container={{ gap: 0.5, alignItems: 'center' }}>\n <Button\n variant='simple'\n label={t('like')}\n icon\n compact\n onClick={() => {\n onReaction(reaction === 'liked' ? undefined : 'liked');\n }}\n aria-label={`${formattedLikes} ${t('likes')}`}\n aria-pressed={reaction === 'liked'}\n >\n <Icon name={reaction === 'liked' ? 'thumbs-up-solid' : 'thumbs-up'} />\n </Button>\n {formattedLikes && (\n <Text\n as={reaction === 'liked' ? StyledReactedPercentage : undefined}\n variant='secondary'\n aria-hidden\n >\n {formattedLikes}\n </Text>\n )}\n </Flex>\n\n <Flex container={{ gap: 0.5, alignItems: 'center' }}>\n <Button\n aria-label={`${formattedDislikes} ${t('dislikes')}`}\n variant='simple'\n label={t('dislike')}\n icon\n compact\n aria-pressed={reaction === 'disliked'}\n onClick={() => {\n onReaction(reaction === 'disliked' ? undefined : 'disliked');\n }}\n >\n <Icon name={reaction === 'disliked' ? 'thumbs-down-solid' : 'thumbs-down'} />\n </Button>\n {formattedDislikes && (\n <Text\n as={reaction === 'disliked' ? StyledReactedPercentage : undefined}\n variant='secondary'\n aria-hidden\n >\n {formattedDislikes}\n </Text>\n )}\n </Flex>\n </Flex>\n );\n};\n\nexport default ArticleRating;\n"]}
1
+ {"version":3,"file":"ArticleRating.js","sourceRoot":"","sources":["../../../src/components/Article/ArticleRating.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,iBAAiB,MAAM,wEAAwE,CAAC;AAC5G,OAAO,KAAK,YAAY,MAAM,kEAAkE,CAAC;AACjG,OAAO,KAAK,mBAAmB,MAAM,0EAA0E,CAAC;AAChH,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AAErG,YAAY,CAAC,iBAAiB,EAAE,YAAY,EAAE,mBAAmB,EAAE,cAAc,CAAC,CAAC;AAWnF,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,IAAI,CAAA;iBACjC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC;CAC7D,CAAC;AAEF,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAExD,MAAM,aAAa,GAA0C,CAAC,EAC5D,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,UAAU,EACV,GAAG,SAAS,EACb,EAAE,EAAE;IACH,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;I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AAuB,CAAC,CAAC,CAAC,SAAS,EAC9D,OAAO,EAAC,WAAW,iCAGlB,cAAc,GACV,CACR,IACI,EAEP,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,aACjD,KAAC,MAAM,kBACO,GAAG,iBAAiB,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,EACnD,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC,EACnB,IAAI,QACJ,OAAO,wBACO,QAAQ,KAAK,UAAU,EACrC,OAAO,EAAE,GAAG,EAAE;4BACZ,UAAU,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;wBAC/D,CAAC,YAED,KAAC,IAAI,IACH,IAAI,EAAE,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,aAAa,EACnE,UAAU,EAAE,QAAQ,KAAK,UAAU,GACnC,GACK,EACR,iBAAiB,IAAI,CACpB,KAAC,IAAI,IACH,EAAE,EAAE,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,SAAS,EACjE,OAAO,EAAC,WAAW,iCAGlB,iBAAiB,GACb,CACR,IACI,IACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import type { FunctionComponent } from 'react';\nimport styled from 'styled-components';\n\nimport {\n registerIcon,\n Flex,\n Button,\n Icon,\n Text,\n useI18n,\n defaultThemeProp,\n formatNumber,\n useConfiguration\n} from '@pega/cosmos-react-core';\nimport * as thumbsUpSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up-solid.icon';\nimport * as thumbsUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up.icon';\nimport * as thumbsDownSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down-solid.icon';\nimport * as thumbsDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down.icon';\n\nregisterIcon(thumbsUpSolidIcon, thumbsUpIcon, thumbsDownSolidIcon, thumbsDownIcon);\n\nexport interface ArticleRatingProps {\n /** Percentage of likes */\n likes?: number;\n /** Percentage of dislikes */\n dislikes?: number;\n reaction?: 'liked' | 'disliked';\n onReaction: (reaction: ArticleRatingProps['reaction']) => void;\n}\n\nexport const StyledReactedPercentage = styled.span`\n font-weight: ${p => p.theme.base['font-weight']['semi-bold']};\n`;\n\nStyledReactedPercentage.defaultProps = defaultThemeProp;\n\nconst ArticleRating: FunctionComponent<ArticleRatingProps> = ({\n dislikes,\n likes,\n reaction,\n onReaction,\n ...restProps\n}) => {\n const t = useI18n();\n const { locale } = useConfiguration();\n\n const formattedLikes =\n likes !== undefined\n ? formatNumber(likes, {\n locale,\n options: {\n style: 'unit',\n unit: 'percent',\n maximumFractionDigits: 0\n }\n })\n : likes;\n const formattedDislikes =\n dislikes !== undefined\n ? formatNumber(dislikes, {\n locale,\n options: {\n style: 'unit',\n unit: 'percent',\n maximumFractionDigits: 0\n }\n })\n : dislikes;\n\n return (\n <Flex {...restProps} container={{ gap: 1 }}>\n <Flex container={{ gap: 0.5, alignItems: 'center' }}>\n <Button\n variant='simple'\n label={t('like')}\n icon\n compact\n onClick={() => {\n onReaction(reaction === 'liked' ? undefined : 'liked');\n }}\n aria-label={`${formattedLikes} ${t('likes')}`}\n aria-pressed={reaction === 'liked'}\n >\n <Icon\n name={reaction === 'liked' ? 'thumbs-up-solid' : 'thumbs-up'}\n emphasized={reaction === 'liked'}\n />\n </Button>\n {formattedLikes && (\n <Text\n as={reaction === 'liked' ? StyledReactedPercentage : undefined}\n variant='secondary'\n aria-hidden\n >\n {formattedLikes}\n </Text>\n )}\n </Flex>\n\n <Flex container={{ gap: 0.5, alignItems: 'center' }}>\n <Button\n aria-label={`${formattedDislikes} ${t('dislikes')}`}\n variant='simple'\n label={t('dislike')}\n icon\n compact\n aria-pressed={reaction === 'disliked'}\n onClick={() => {\n onReaction(reaction === 'disliked' ? undefined : 'disliked');\n }}\n >\n <Icon\n name={reaction === 'disliked' ? 'thumbs-down-solid' : 'thumbs-down'}\n emphasized={reaction === 'disliked'}\n />\n </Button>\n {formattedDislikes && (\n <Text\n as={reaction === 'disliked' ? StyledReactedPercentage : undefined}\n variant='secondary'\n aria-hidden\n >\n {formattedDislikes}\n </Text>\n )}\n </Flex>\n </Flex>\n );\n};\n\nexport default ArticleRating;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ArticleFeedback.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleFeedback.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAIhE,eAAO,MAAM,yBAAyB;;yLAQpC,CAAC;;AAIH,wBA6FE"}
1
+ {"version":3,"file":"ArticleFeedback.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleFeedback.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAIhE,eAAO,MAAM,yBAAyB;;yLAQpC,CAAC;;AAIH,wBAmGE"}
@@ -21,9 +21,9 @@ export default forwardRef(function ArticleFeedback({ question, comment, reaction
21
21
  useElementFocus(feedbackCommentRef, { shouldFocus: !!reaction });
22
22
  return (_jsx(Flex, { ...restProps, container: { direction: 'column' }, ref: ref, children: !showThankYouMessage ? (_jsxs(_Fragment, { children: [_jsxs(Flex, { container: { gap: 0.5, alignItems: 'center', pad: [0.5, undefined] }, children: [_jsx(Text, { children: question }), _jsxs("div", { role: 'group', "aria-label": t('confirmation_options'), children: [_jsx(Button, { "aria-pressed": reaction === 'liked', label: t('yes'), variant: 'simple', icon: true, compact: true, onClick: () => {
23
23
  onReaction(reaction === 'liked' ? undefined : 'liked');
24
- }, children: _jsx(Icon, { name: reaction === 'liked' ? 'thumbs-up-solid' : 'thumbs-up' }) }), _jsx(Button, { variant: 'simple', label: t('no'), icon: true, compact: true, "aria-pressed": reaction === 'disliked', onClick: () => {
24
+ }, children: _jsx(Icon, { name: reaction === 'liked' ? 'thumbs-up-solid' : 'thumbs-up', emphasized: reaction === 'liked' }) }), _jsx(Button, { variant: 'simple', label: t('no'), icon: true, compact: true, "aria-pressed": reaction === 'disliked', onClick: () => {
25
25
  onReaction(reaction === 'disliked' ? undefined : 'disliked');
26
- }, children: _jsx(Icon, { name: reaction === 'disliked' ? 'thumbs-down-solid' : 'thumbs-down' }) })] })] }), reaction && comment && onSubmit && (_jsxs(Flex, { container: { direction: 'column', gap: 1, pad: [1, undefined] }, children: [_jsx(TextArea, { ...comment, label: t('add_a_comment'), ref: feedbackCommentRef, autoResize: false, maxLength: 200, hardStop: true, onKeyDown: (e) => {
26
+ }, children: _jsx(Icon, { name: reaction === 'disliked' ? 'thumbs-down-solid' : 'thumbs-down', emphasized: reaction === 'disliked' }) })] })] }), reaction && comment && onSubmit && (_jsxs(Flex, { container: { direction: 'column', gap: 1, pad: [1, undefined] }, children: [_jsx(TextArea, { ...comment, label: t('add_a_comment'), ref: feedbackCommentRef, autoResize: false, maxLength: 200, hardStop: true, onKeyDown: (e) => {
27
27
  if (e.key === 'Enter' && !e.shiftKey) {
28
28
  e.preventDefault();
29
29
  if (comment.value?.trim()) {
@@ -1 +1 @@
1
- {"version":3,"file":"ArticleFeedback.js","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleFeedback.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,QAAQ,EACR,gBAAgB,EAChB,IAAI,EACJ,eAAe,EAChB,MAAM,yBAAyB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,eAAe,CAAC,EACzB,GAAG,EAAE,kBAAkB,EACvB,UAAU,EAAE,KAAK,EACjB,SAAS,EAAE,GAAG,EACd,QAAQ,QACR,SAAS,EAAE,CAAC,CAAqC,EAAE,EAAE;gCACnD,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;oCACrC,CAAC,CAAC,cAAc,EAAE,CAAC;oCACnB,IAAI,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC;wCAC1B,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;oCAC1D,CAAC;gCACH,CAAC;4BACH,CAAC,GACD,EACF,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,YACzC,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,CAAC,CAAgC,EAAE,EAAE;oCAC5C,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;gCAC1D,CAAC,YAEA,CAAC,CAAC,QAAQ,CAAC,GACL,GACJ,IACF,CACR,IACA,CACJ,CAAC,CAAC,CAAC,CACF,KAAC,yBAAyB,IAAC,GAAG,EAAE,kBAAkB,EAAE,QAAQ,EAAE,CAAC,CAAC,YAC7D,CAAC,CAAC,qCAAqC,CAAC,GACf,CAC7B,GACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { forwardRef, useRef } from 'react';\nimport type { MouseEvent, KeyboardEvent, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n registerIcon,\n Text,\n Flex,\n useI18n,\n Button,\n TextArea,\n defaultThemeProp,\n Icon,\n useElementFocus\n} from '@pega/cosmos-react-core';\nimport * as thumbsUpSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up-solid.icon';\nimport * as thumbsUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up.icon';\nimport * as thumbsDownSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down-solid.icon';\nimport * as thumbsDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down.icon';\nimport type { RefElement } from '@pega/cosmos-react-core';\n\nimport type { ArticleFeedbackProps } from './ArticleList.types';\n\nregisterIcon(thumbsUpSolidIcon, thumbsUpIcon, thumbsDownSolidIcon, thumbsDownIcon);\n\nexport const StyledAcknowledgementText = styled(Text)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n padding-block: calc(1.5 * ${spacing});\n `;\n});\n\nStyledAcknowledgementText.defaultProps = defaultThemeProp;\n\nexport default forwardRef<RefElement<ArticleFeedbackProps>, PropsWithoutRef<ArticleFeedbackProps>>(\n function ArticleFeedback(\n {\n question,\n comment,\n reaction,\n onReaction,\n onSubmit,\n showThankYouMessage = false,\n ...restProps\n },\n ref\n ) {\n const t = useI18n();\n const acknowledgmentText = useRef<HTMLSpanElement>(null);\n const feedbackCommentRef = useRef<HTMLTextAreaElement>(null);\n\n useElementFocus(acknowledgmentText, { shouldFocus: showThankYouMessage });\n useElementFocus(feedbackCommentRef, { shouldFocus: !!reaction });\n\n return (\n <Flex {...restProps} container={{ direction: 'column' }} ref={ref}>\n {!showThankYouMessage ? (\n <>\n <Flex container={{ gap: 0.5, alignItems: 'center', pad: [0.5, undefined] }}>\n <Text>{question}</Text>\n <div role='group' aria-label={t('confirmation_options')}>\n <Button\n aria-pressed={reaction === 'liked'}\n label={t('yes')}\n variant='simple'\n icon\n compact\n onClick={() => {\n onReaction(reaction === 'liked' ? undefined : 'liked');\n }}\n >\n <Icon name={reaction === 'liked' ? 'thumbs-up-solid' : 'thumbs-up'} />\n </Button>\n <Button\n variant='simple'\n label={t('no')}\n icon\n compact\n aria-pressed={reaction === 'disliked'}\n onClick={() => {\n onReaction(reaction === 'disliked' ? undefined : 'disliked');\n }}\n >\n <Icon name={reaction === 'disliked' ? 'thumbs-down-solid' : 'thumbs-down'} />\n </Button>\n </div>\n </Flex>\n\n {reaction && comment && onSubmit && (\n <Flex container={{ direction: 'column', gap: 1, pad: [1, undefined] }}>\n <TextArea\n {...comment}\n label={t('add_a_comment')}\n ref={feedbackCommentRef}\n autoResize={false}\n maxLength={200}\n hardStop\n onKeyDown={(e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n if (comment.value?.trim()) {\n onSubmit({ reaction, comment: comment.value ?? '' }, e);\n }\n }\n }}\n />\n <Flex container={{ gap: 1, justify: 'end' }}>\n <Button\n variant='primary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n onSubmit({ reaction, comment: comment.value ?? '' }, e);\n }}\n >\n {t('submit')}\n </Button>\n </Flex>\n </Flex>\n )}\n </>\n ) : (\n <StyledAcknowledgementText ref={acknowledgmentText} tabIndex={-1}>\n {t('article_thank_you_for_your_feedback')}\n </StyledAcknowledgementText>\n )}\n </Flex>\n );\n }\n);\n"]}
1
+ {"version":3,"file":"ArticleFeedback.js","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleFeedback.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,QAAQ,EACR,gBAAgB,EAChB,IAAI,EACJ,eAAe,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,iBAAiB,MAAM,wEAAwE,CAAC;AAC5G,OAAO,KAAK,YAAY,MAAM,kEAAkE,CAAC;AACjG,OAAO,KAAK,mBAAmB,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,KAAK,EACjB,SAAS,EAAE,GAAG,EACd,QAAQ,QACR,SAAS,EAAE,CAAC,CAAqC,EAAE,EAAE;gCACnD,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;oCACrC,CAAC,CAAC,cAAc,EAAE,CAAC;oCACnB,IAAI,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC;wCAC1B,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;oCAC1D,CAAC;gCACH,CAAC;4BACH,CAAC,GACD,EACF,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,YACzC,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,CAAC,CAAgC,EAAE,EAAE;oCAC5C,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;gCAC1D,CAAC,YAEA,CAAC,CAAC,QAAQ,CAAC,GACL,GACJ,IACF,CACR,IACA,CACJ,CAAC,CAAC,CAAC,CACF,KAAC,yBAAyB,IAAC,GAAG,EAAE,kBAAkB,EAAE,QAAQ,EAAE,CAAC,CAAC,YAC7D,CAAC,CAAC,qCAAqC,CAAC,GACf,CAC7B,GACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { forwardRef, useRef } from 'react';\nimport type { MouseEvent, KeyboardEvent, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n registerIcon,\n Text,\n Flex,\n useI18n,\n Button,\n TextArea,\n defaultThemeProp,\n Icon,\n useElementFocus\n} from '@pega/cosmos-react-core';\nimport * as thumbsUpSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up-solid.icon';\nimport * as thumbsUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up.icon';\nimport * as thumbsDownSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down-solid.icon';\nimport * as thumbsDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down.icon';\nimport type { RefElement } from '@pega/cosmos-react-core';\n\nimport type { ArticleFeedbackProps } from './ArticleList.types';\n\nregisterIcon(thumbsUpSolidIcon, thumbsUpIcon, thumbsDownSolidIcon, thumbsDownIcon);\n\nexport const StyledAcknowledgementText = styled(Text)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n padding-block: calc(1.5 * ${spacing});\n `;\n});\n\nStyledAcknowledgementText.defaultProps = defaultThemeProp;\n\nexport default forwardRef<RefElement<ArticleFeedbackProps>, PropsWithoutRef<ArticleFeedbackProps>>(\n function ArticleFeedback(\n {\n question,\n comment,\n reaction,\n onReaction,\n onSubmit,\n showThankYouMessage = false,\n ...restProps\n },\n ref\n ) {\n const t = useI18n();\n const acknowledgmentText = useRef<HTMLSpanElement>(null);\n const feedbackCommentRef = useRef<HTMLTextAreaElement>(null);\n\n useElementFocus(acknowledgmentText, { shouldFocus: showThankYouMessage });\n useElementFocus(feedbackCommentRef, { shouldFocus: !!reaction });\n\n return (\n <Flex {...restProps} container={{ direction: 'column' }} ref={ref}>\n {!showThankYouMessage ? (\n <>\n <Flex container={{ gap: 0.5, alignItems: 'center', pad: [0.5, undefined] }}>\n <Text>{question}</Text>\n <div role='group' aria-label={t('confirmation_options')}>\n <Button\n aria-pressed={reaction === 'liked'}\n label={t('yes')}\n variant='simple'\n icon\n compact\n onClick={() => {\n onReaction(reaction === 'liked' ? undefined : 'liked');\n }}\n >\n <Icon\n name={reaction === 'liked' ? 'thumbs-up-solid' : 'thumbs-up'}\n emphasized={reaction === 'liked'}\n />\n </Button>\n <Button\n variant='simple'\n label={t('no')}\n icon\n compact\n aria-pressed={reaction === 'disliked'}\n onClick={() => {\n onReaction(reaction === 'disliked' ? undefined : 'disliked');\n }}\n >\n <Icon\n name={reaction === 'disliked' ? 'thumbs-down-solid' : 'thumbs-down'}\n emphasized={reaction === 'disliked'}\n />\n </Button>\n </div>\n </Flex>\n\n {reaction && comment && onSubmit && (\n <Flex container={{ direction: 'column', gap: 1, pad: [1, undefined] }}>\n <TextArea\n {...comment}\n label={t('add_a_comment')}\n ref={feedbackCommentRef}\n autoResize={false}\n maxLength={200}\n hardStop\n onKeyDown={(e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n if (comment.value?.trim()) {\n onSubmit({ reaction, comment: comment.value ?? '' }, e);\n }\n }\n }}\n />\n <Flex container={{ gap: 1, justify: 'end' }}>\n <Button\n variant='primary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n onSubmit({ reaction, comment: comment.value ?? '' }, e);\n }}\n >\n {t('submit')}\n </Button>\n </Flex>\n </Flex>\n )}\n </>\n ) : (\n <StyledAcknowledgementText ref={acknowledgmentText} tabIndex={-1}>\n {t('article_thank_you_for_your_feedback')}\n </StyledAcknowledgementText>\n )}\n </Flex>\n );\n }\n);\n"]}
@@ -23,6 +23,8 @@ export interface CasePreviewProps extends Pick<CaseViewProps, 'caseId' | 'caseTy
23
23
  onAfterClose?: () => void;
24
24
  /** Callback fired when a click action occurs outside of the Case Preview. */
25
25
  onOuterClick?: () => void;
26
+ /** Renders the preview content in place instead of using the global preview panel. */
27
+ inline?: boolean;
26
28
  /** Reference to the wrapping element. */
27
29
  ref?: Ref<HTMLDivElement>;
28
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CasePreview.d.ts","sourceRoot":"","sources":["../../../src/components/CasePreview/CasePreview.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAelD,OAAO,KAAK,EACV,+BAA+B,EAC/B,SAAS,EACT,UAAU,EACV,cAAc,EACd,eAAe,EAEhB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAQvE,MAAM,WAAW,gBACf,SAAQ,IAAI,CACR,aAAa,EACX,QAAQ,GACR,UAAU,GACV,SAAS,GACT,YAAY,GACZ,aAAa,GACb,MAAM,GACN,OAAO,GACP,UAAU,GACV,kBAAkB,GAClB,SAAS,GACT,iBAAiB,GACjB,QAAQ,GACR,eAAe,GACf,MAAM,GACN,YAAY,GACZ,QAAQ,GACR,OAAO,GACP,SAAS,GACT,WAAW,GACX,uBAAuB,CAC1B,EACD,cAAc,EACd,UAAU,EACV,SAAS;IACX,4GAA4G;IAC5G,QAAQ,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC5C,iDAAiD;IACjD,IAAI,EAAE,OAAO,CAAC;IACd,iEAAiE;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAC1C,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,yCAAyC;IACzC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;;;;AA6OD,wBAA+D"}
1
+ {"version":3,"file":"CasePreview.d.ts","sourceRoot":"","sources":["../../../src/components/CasePreview/CasePreview.tsx"],"names":[],"mappings":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,yCAAyC;IACzC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;;;;AA4RD,wBAA+D"}
@@ -20,25 +20,20 @@ const StyledCasePreviewDrawer = styled(StyledPreviewDrawer)(({ theme }) => {
20
20
  }
21
21
 
22
22
  ${StyledCaseView} {
23
- height: calc(100vh - ${theme.base.spacing} - ${theme.base['hit-area']['mouse-min']});
24
23
  z-index: 1;
25
24
 
26
- @media (pointer: coarse) {
27
- height: calc(100vh - ${theme.base.spacing} - ${theme.base['hit-area']['finger-min']});
28
- }
29
-
30
25
  ${StyledSummaryRegion} {
31
26
  position: relative;
32
27
  top: 0;
28
+
29
+ @media (min-height: ${theme.base.breakpoints.sm}) {
30
+ position: sticky;
31
+ }
33
32
  }
34
33
  }
35
34
 
36
35
  ${StyledCaseViewContent} {
37
36
  overflow-y: auto;
38
-
39
- & > :last-child {
40
- padding-bottom: calc(2 * ${theme.base.spacing});
41
- }
42
37
  }
43
38
 
44
39
  ${StyledGenAICoachContainer} {
@@ -56,10 +51,11 @@ const CasePreviewContent = ({ error, onErrorRetry, caseId, caseType, heading, su
56
51
  return (_jsx(CaseView, { caseId: caseId, caseType: caseType, parentCases: parentCases, heading: heading, subheading: subheading, caseLink: caseLink, icon: icon, color: color, followed: followed, onFollowedChange: onFollowedChange, summaryFields: summaryFields, tabs: tabs, stages: stages, tasks: tasks, tabContent: tabContent, utilities: utilities, utilitiesSummaryItems: utilitiesSummaryItems, actions: actions, banners: banners, onEdit: onEdit, isPreview: true }));
57
52
  };
58
53
  const CasePreview = forwardRef(function CasePreview(props, ref) {
59
- const { testId, open: openProp, progress, error, onErrorRetry, caseId, caseType, heading, subheading, caseLink, parentCases, icon, color, followed, onFollowedChange, summaryFields, tabs, stages, tasks, tabContent, utilities, utilitiesSummaryItems, actions, banners, onEdit, onBeforeOpen, onAfterOpen, onBeforeClose, onAfterClose, ...restProps } = props;
54
+ const { testId, open: openProp, progress, error, onErrorRetry, caseId, caseType, heading, subheading, caseLink, parentCases, icon, color, followed, onFollowedChange, summaryFields, tabs, stages, tasks, tabContent, utilities, utilitiesSummaryItems, actions, banners, onEdit, onBeforeOpen, onAfterOpen, onBeforeClose, onAfterClose, inline = false, ...restProps } = props;
60
55
  const testIds = useTestIds(testId, getCasePreviewTestIds);
61
56
  const { createPreview } = usePreviewManager();
62
57
  const previewMethodsRef = useRef(undefined);
58
+ const afterClosePendingRef = useRef(false);
63
59
  const previewRef = useConsolidatedRef(ref);
64
60
  const isSmallOrAbove = useBreakpoint('sm');
65
61
  const [open, setOpen] = useState(openProp);
@@ -67,6 +63,14 @@ const CasePreview = forwardRef(function CasePreview(props, ref) {
67
63
  setOpen(openProp);
68
64
  }, [openProp]);
69
65
  useEffect(() => {
66
+ if (!open && afterClosePendingRef.current) {
67
+ afterClosePendingRef.current = false;
68
+ onAfterClose?.();
69
+ }
70
+ }, [onAfterClose, open]);
71
+ useEffect(() => {
72
+ if (inline)
73
+ return undefined;
70
74
  if (open && isSmallOrAbove) {
71
75
  const contentProps = {
72
76
  error,
@@ -95,12 +99,14 @@ const CasePreview = forwardRef(function CasePreview(props, ref) {
95
99
  const metadata = {
96
100
  previewProps: {
97
101
  testId: testIds.root,
98
- previewLabel: typeof heading === 'string' ? heading : heading?.text,
102
+ ...(heading !== undefined && {
103
+ previewLabel: typeof heading === 'string' ? heading : heading.text
104
+ }),
99
105
  onBeforeOpen,
100
106
  onAfterOpen,
101
107
  onBeforeClose,
102
108
  onAfterClose: () => {
103
- onAfterClose?.();
109
+ afterClosePendingRef.current = true;
104
110
  setOpen(false);
105
111
  if (previewMethodsRef.current) {
106
112
  previewMethodsRef.current.unmountPreview();
@@ -122,9 +128,23 @@ const CasePreview = forwardRef(function CasePreview(props, ref) {
122
128
  }
123
129
  else if (!open) {
124
130
  // This branch is needed for controlled component via open prop
131
+ previewMethodsRef.current?.unmountPreview();
125
132
  previewMethodsRef.current = undefined;
126
133
  }
127
- }, [open, progress, error, tabs, banners, utilities, utilitiesSummaryItems, isSmallOrAbove]);
134
+ }, [
135
+ open,
136
+ progress,
137
+ error,
138
+ tabs,
139
+ banners,
140
+ utilities,
141
+ utilitiesSummaryItems,
142
+ isSmallOrAbove,
143
+ inline
144
+ ]);
145
+ if (inline) {
146
+ return (_jsx(CasePreviewContent, { error: error, onErrorRetry: onErrorRetry, caseId: caseId, caseType: caseType, heading: heading, subheading: subheading, caseLink: caseLink, parentCases: parentCases, icon: icon, color: color, followed: followed, onFollowedChange: onFollowedChange, summaryFields: summaryFields, tabs: tabs, stages: stages, tasks: tasks, tabContent: tabContent, utilities: utilities, utilitiesSummaryItems: utilitiesSummaryItems, actions: actions, banners: banners, onEdit: onEdit }));
147
+ }
128
148
  return null;
129
149
  });
130
150
  export default withTestIds(CasePreview, getCasePreviewTestIds);
@@ -1 +1 @@
1
- {"version":3,"file":"CasePreview.js","sourceRoot":"","sources":["../../../src/components/CasePreview/CasePreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,OAAO,EACP,UAAU,EACV,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AASjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAE1F,OAAO,QAAQ,EAAE,EAAE,cAAc,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGnG,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAEnG,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,YAAY,CAAC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QAAQ,CAAC,CAAC;YAClE,CAAC;iBAAM,CAAC;gBACN,iBAAiB,CAAC,OAAO,GAAG,aAAa,CAAC,kBAAkB,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;YACxF,CAAC;QACH,CAAC;aAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YACjB,+DAA+D;YAC/D,iBAAiB,CAAC,OAAO,GAAG,SAAS,CAAC;QACxC,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,cAAc,CAAC,CAAC,CAAC;IAE7F,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { forwardRef, useEffect, useState, useRef } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n registerIcon,\n defaultThemeProp,\n useBreakpoint,\n useI18n,\n useTestIds,\n withTestIds,\n ErrorState,\n useConsolidatedRef,\n StyledPreviewDrawer,\n usePreviewManager\n} from '@pega/cosmos-react-core';\nimport type {\n ForwardRefForwardPropsComponent,\n BaseProps,\n TestIdProp,\n NoChildrenProp,\n ErrorStateProps,\n PreviewMethods\n} from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nimport CaseView, { StyledCaseView, StyledCaseViewContent, StyledSummaryRegion } from '../CaseView';\nimport type { CaseViewProps } from '../CaseView';\nimport type { CaseViewContextValue } from '../CaseView/CaseView.types';\nimport { StyledGenAICoachContainer } from '../GenAICoach/GenAICoach.styles';\nimport { StyledSummaryPrimaryList, StyledSummarySecondaryList } from '../CaseView/CaseView.styles';\n\nimport { getCasePreviewTestIds } from './CasePreview.test-ids';\n\nregisterIcon(timesIcon);\n\nexport interface CasePreviewProps\n extends Pick<\n CaseViewProps,\n | 'caseId'\n | 'caseType'\n | 'heading'\n | 'subheading'\n | 'parentCases'\n | 'icon'\n | 'color'\n | 'followed'\n | 'onFollowedChange'\n | 'actions'\n | 'promotedActions'\n | 'onEdit'\n | 'summaryFields'\n | 'tabs'\n | 'tabContent'\n | 'stages'\n | 'tasks'\n | 'banners'\n | 'utilities'\n | 'utilitiesSummaryItems'\n >,\n NoChildrenProp,\n TestIdProp,\n BaseProps {\n /** A set of props including an href that will be forwarded to the case preview's heading and subheading. */\n caseLink?: CaseViewContextValue['caseLink'];\n /** If true, the Case Preview will be visible. */\n open: boolean;\n /** If true, the Case Preview will render in a progress state. */\n progress?: boolean;\n /** If true, the Case Preview will render in an error state. */\n error?: boolean;\n /** Callback fired when \"Try again\" button is clicked in an error state. */\n onErrorRetry?: ErrorStateProps['onRetry'];\n /** Callback fired before Case Preview opens. */\n onBeforeOpen?: () => void;\n /** Callback fired after Case Preview opens. */\n onAfterOpen?: () => void;\n /** Callback fired before Case Preview closes. */\n onBeforeClose?: () => void;\n /** Callback fired after Case Preview closes. */\n onAfterClose?: () => void;\n /** Callback fired when a click action occurs outside of the Case Preview. */\n onOuterClick?: () => void;\n /** Reference to the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledCasePreviewDrawer = styled(StyledPreviewDrawer)(({ theme }) => {\n return css`\n ${StyledSummaryPrimaryList} {\n padding: unset;\n }\n\n ${StyledSummarySecondaryList} {\n padding-block-start: unset;\n padding-inline: unset;\n }\n\n ${StyledCaseView} {\n height: calc(100vh - ${theme.base.spacing} - ${theme.base['hit-area']['mouse-min']});\n z-index: 1;\n\n @media (pointer: coarse) {\n height: calc(100vh - ${theme.base.spacing} - ${theme.base['hit-area']['finger-min']});\n }\n\n ${StyledSummaryRegion} {\n position: relative;\n top: 0;\n }\n }\n\n ${StyledCaseViewContent} {\n overflow-y: auto;\n\n & > :last-child {\n padding-bottom: calc(2 * ${theme.base.spacing});\n }\n }\n\n ${StyledGenAICoachContainer} {\n width: unset;\n min-width: unset;\n }\n `;\n});\n\nStyledCasePreviewDrawer.defaultProps = defaultThemeProp;\n\ntype CasePreviewContentProps = Pick<\n CasePreviewProps,\n | 'error'\n | 'onErrorRetry'\n | 'caseId'\n | 'caseType'\n | 'heading'\n | 'subheading'\n | 'caseLink'\n | 'parentCases'\n | 'icon'\n | 'color'\n | 'followed'\n | 'onFollowedChange'\n | 'summaryFields'\n | 'tabs'\n | 'tabContent'\n | 'stages'\n | 'tasks'\n | 'banners'\n | 'utilities'\n | 'utilitiesSummaryItems'\n | 'actions'\n | 'onEdit'\n>;\n\nconst CasePreviewContent = ({\n error,\n onErrorRetry,\n caseId,\n caseType,\n heading,\n subheading,\n caseLink,\n parentCases,\n icon,\n color,\n followed,\n onFollowedChange,\n summaryFields,\n tabs,\n stages,\n tasks,\n tabContent,\n utilities,\n utilitiesSummaryItems,\n actions,\n banners,\n onEdit\n}: CasePreviewContentProps) => {\n const t = useI18n();\n\n if (error) {\n return <ErrorState message={t('preview_error')} onRetry={onErrorRetry} />;\n }\n\n return (\n <CaseView\n caseId={caseId}\n caseType={caseType}\n parentCases={parentCases}\n heading={heading}\n subheading={subheading}\n caseLink={caseLink}\n icon={icon}\n color={color}\n followed={followed}\n onFollowedChange={onFollowedChange}\n summaryFields={summaryFields}\n tabs={tabs}\n stages={stages}\n tasks={tasks}\n tabContent={tabContent}\n utilities={utilities}\n utilitiesSummaryItems={utilitiesSummaryItems}\n actions={actions}\n banners={banners}\n onEdit={onEdit}\n isPreview\n />\n );\n};\n\nconst CasePreview: ForwardRefForwardPropsComponent<CasePreviewProps> = forwardRef(\n function CasePreview(props: PropsWithoutRef<CasePreviewProps>, ref: CasePreviewProps['ref']) {\n const {\n testId,\n open: openProp,\n progress,\n error,\n onErrorRetry,\n caseId,\n caseType,\n heading,\n subheading,\n caseLink,\n parentCases,\n icon,\n color,\n followed,\n onFollowedChange,\n summaryFields,\n tabs,\n stages,\n tasks,\n tabContent,\n utilities,\n utilitiesSummaryItems,\n actions,\n banners,\n onEdit,\n onBeforeOpen,\n onAfterOpen,\n onBeforeClose,\n onAfterClose,\n ...restProps\n } = props;\n const testIds = useTestIds(testId, getCasePreviewTestIds);\n\n const { createPreview } = usePreviewManager();\n const previewMethodsRef = useRef<PreviewMethods | undefined>(undefined);\n const previewRef = useConsolidatedRef(ref);\n const isSmallOrAbove = useBreakpoint('sm');\n\n const [open, setOpen] = useState(openProp);\n\n useEffect(() => {\n setOpen(openProp);\n }, [openProp]);\n\n useEffect(() => {\n if (open && isSmallOrAbove) {\n const contentProps = {\n error,\n onErrorRetry,\n caseId,\n caseType,\n heading,\n subheading,\n caseLink,\n parentCases,\n icon,\n color,\n followed,\n onFollowedChange,\n summaryFields,\n tabs,\n stages,\n tasks,\n tabContent,\n utilities,\n utilitiesSummaryItems,\n actions,\n banners,\n onEdit\n };\n\n const metadata = {\n previewProps: {\n testId: testIds.root,\n previewLabel: typeof heading === 'string' ? heading : heading?.text,\n onBeforeOpen,\n onAfterOpen,\n onBeforeClose,\n onAfterClose: () => {\n onAfterClose?.();\n setOpen(false);\n if (previewMethodsRef.current) {\n previewMethodsRef.current.unmountPreview();\n previewMethodsRef.current = undefined;\n }\n },\n as: StyledCasePreviewDrawer,\n ref: previewRef,\n progress,\n ...restProps\n }\n };\n if (previewMethodsRef.current) {\n previewMethodsRef.current.updatePreview(contentProps, metadata);\n } else {\n previewMethodsRef.current = createPreview(CasePreviewContent, contentProps, metadata);\n }\n } else if (!open) {\n // This branch is needed for controlled component via open prop\n previewMethodsRef.current = undefined;\n }\n }, [open, progress, error, tabs, banners, utilities, utilitiesSummaryItems, isSmallOrAbove]);\n\n return null;\n }\n);\n\nexport default withTestIds(CasePreview, getCasePreviewTestIds);\n"]}
1
+ {"version":3,"file":"CasePreview.js","sourceRoot":"","sources":["../../../src/components/CasePreview/CasePreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,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cAAc;QACd,MAAM;KACP,CAAC,CAAC;IAEH,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,CACL,KAAC,kBAAkB,IACjB,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,qBAAqB,EAAE,qBAAqB,EAC5C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { forwardRef, useEffect, useState, useRef } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n registerIcon,\n defaultThemeProp,\n useBreakpoint,\n useI18n,\n useTestIds,\n withTestIds,\n ErrorState,\n useConsolidatedRef,\n StyledPreviewDrawer,\n usePreviewManager\n} from '@pega/cosmos-react-core';\nimport type {\n ForwardRefForwardPropsComponent,\n BaseProps,\n TestIdProp,\n NoChildrenProp,\n ErrorStateProps,\n PreviewMethods\n} from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nimport CaseView, { StyledCaseView, StyledCaseViewContent, StyledSummaryRegion } from '../CaseView';\nimport type { CaseViewProps } from '../CaseView';\nimport type { CaseViewContextValue } from '../CaseView/CaseView.types';\nimport { StyledGenAICoachContainer } from '../GenAICoach/GenAICoach.styles';\nimport { StyledSummaryPrimaryList, StyledSummarySecondaryList } from '../CaseView/CaseView.styles';\n\nimport { getCasePreviewTestIds } from './CasePreview.test-ids';\n\nregisterIcon(timesIcon);\n\nexport interface CasePreviewProps\n extends Pick<\n CaseViewProps,\n | 'caseId'\n | 'caseType'\n | 'heading'\n | 'subheading'\n | 'parentCases'\n | 'icon'\n | 'color'\n | 'followed'\n | 'onFollowedChange'\n | 'actions'\n | 'promotedActions'\n | 'onEdit'\n | 'summaryFields'\n | 'tabs'\n | 'tabContent'\n | 'stages'\n | 'tasks'\n | 'banners'\n | 'utilities'\n | 'utilitiesSummaryItems'\n >,\n NoChildrenProp,\n TestIdProp,\n BaseProps {\n /** A set of props including an href that will be forwarded to the case preview's heading and subheading. */\n caseLink?: CaseViewContextValue['caseLink'];\n /** If true, the Case Preview will be visible. */\n open: boolean;\n /** If true, the Case Preview will render in a progress state. */\n progress?: boolean;\n /** If true, the Case Preview will render in an error state. */\n error?: boolean;\n /** Callback fired when \"Try again\" button is clicked in an error state. */\n onErrorRetry?: ErrorStateProps['onRetry'];\n /** Callback fired before Case Preview opens. */\n onBeforeOpen?: () => void;\n /** Callback fired after Case Preview opens. */\n onAfterOpen?: () => void;\n /** Callback fired before Case Preview closes. */\n onBeforeClose?: () => void;\n /** Callback fired after Case Preview closes. */\n onAfterClose?: () => void;\n /** Callback fired when a click action occurs outside of the Case Preview. */\n onOuterClick?: () => void;\n /** Renders the preview content in place instead of using the global preview panel. */\n inline?: boolean;\n /** Reference to the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledCasePreviewDrawer = styled(StyledPreviewDrawer)(({ theme }) => {\n return css`\n ${StyledSummaryPrimaryList} {\n padding: unset;\n }\n\n ${StyledSummarySecondaryList} {\n padding-block-start: unset;\n padding-inline: unset;\n }\n\n ${StyledCaseView} {\n z-index: 1;\n\n ${StyledSummaryRegion} {\n position: relative;\n top: 0;\n\n @media (min-height: ${theme.base.breakpoints.sm}) {\n position: sticky;\n }\n }\n }\n\n ${StyledCaseViewContent} {\n overflow-y: auto;\n }\n\n ${StyledGenAICoachContainer} {\n width: unset;\n min-width: unset;\n }\n `;\n});\n\nStyledCasePreviewDrawer.defaultProps = defaultThemeProp;\n\ntype CasePreviewContentProps = Pick<\n CasePreviewProps,\n | 'error'\n | 'onErrorRetry'\n | 'caseId'\n | 'caseType'\n | 'heading'\n | 'subheading'\n | 'caseLink'\n | 'parentCases'\n | 'icon'\n | 'color'\n | 'followed'\n | 'onFollowedChange'\n | 'summaryFields'\n | 'tabs'\n | 'tabContent'\n | 'stages'\n | 'tasks'\n | 'banners'\n | 'utilities'\n | 'utilitiesSummaryItems'\n | 'actions'\n | 'onEdit'\n>;\n\nconst CasePreviewContent = ({\n error,\n onErrorRetry,\n caseId,\n caseType,\n heading,\n subheading,\n caseLink,\n parentCases,\n icon,\n color,\n followed,\n onFollowedChange,\n summaryFields,\n tabs,\n stages,\n tasks,\n tabContent,\n utilities,\n utilitiesSummaryItems,\n actions,\n banners,\n onEdit\n}: CasePreviewContentProps) => {\n const t = useI18n();\n\n if (error) {\n return <ErrorState message={t('preview_error')} onRetry={onErrorRetry} />;\n }\n\n return (\n <CaseView\n caseId={caseId}\n caseType={caseType}\n parentCases={parentCases}\n heading={heading}\n subheading={subheading}\n caseLink={caseLink}\n icon={icon}\n color={color}\n followed={followed}\n onFollowedChange={onFollowedChange}\n summaryFields={summaryFields}\n tabs={tabs}\n stages={stages}\n tasks={tasks}\n tabContent={tabContent}\n utilities={utilities}\n utilitiesSummaryItems={utilitiesSummaryItems}\n actions={actions}\n banners={banners}\n onEdit={onEdit}\n isPreview\n />\n );\n};\n\nconst CasePreview: ForwardRefForwardPropsComponent<CasePreviewProps> = forwardRef(\n function CasePreview(props: PropsWithoutRef<CasePreviewProps>, ref: CasePreviewProps['ref']) {\n const {\n testId,\n open: openProp,\n progress,\n error,\n onErrorRetry,\n caseId,\n caseType,\n heading,\n subheading,\n caseLink,\n parentCases,\n icon,\n color,\n followed,\n onFollowedChange,\n summaryFields,\n tabs,\n stages,\n tasks,\n tabContent,\n utilities,\n utilitiesSummaryItems,\n actions,\n banners,\n onEdit,\n onBeforeOpen,\n onAfterOpen,\n onBeforeClose,\n onAfterClose,\n inline = false,\n ...restProps\n } = props;\n const testIds = useTestIds(testId, getCasePreviewTestIds);\n\n const { createPreview } = usePreviewManager();\n const previewMethodsRef = useRef<PreviewMethods | undefined>(undefined);\n const afterClosePendingRef = useRef(false);\n const previewRef = useConsolidatedRef(ref);\n const isSmallOrAbove = useBreakpoint('sm');\n\n const [open, setOpen] = useState(openProp);\n\n useEffect(() => {\n setOpen(openProp);\n }, [openProp]);\n\n useEffect(() => {\n if (!open && afterClosePendingRef.current) {\n afterClosePendingRef.current = false;\n onAfterClose?.();\n }\n }, [onAfterClose, open]);\n\n useEffect(() => {\n if (inline) return undefined;\n if (open && isSmallOrAbove) {\n const contentProps = {\n error,\n onErrorRetry,\n caseId,\n caseType,\n heading,\n subheading,\n caseLink,\n parentCases,\n icon,\n color,\n followed,\n onFollowedChange,\n summaryFields,\n tabs,\n stages,\n tasks,\n tabContent,\n utilities,\n utilitiesSummaryItems,\n actions,\n banners,\n onEdit\n };\n\n const metadata = {\n previewProps: {\n testId: testIds.root,\n ...(heading !== undefined && {\n previewLabel: typeof heading === 'string' ? heading : heading.text\n }),\n onBeforeOpen,\n onAfterOpen,\n onBeforeClose,\n onAfterClose: () => {\n afterClosePendingRef.current = true;\n setOpen(false);\n if (previewMethodsRef.current) {\n previewMethodsRef.current.unmountPreview();\n previewMethodsRef.current = undefined;\n }\n },\n as: StyledCasePreviewDrawer,\n ref: previewRef,\n progress,\n ...restProps\n }\n };\n if (previewMethodsRef.current) {\n previewMethodsRef.current.updatePreview(contentProps, metadata);\n } else {\n previewMethodsRef.current = createPreview(CasePreviewContent, contentProps, metadata);\n }\n } else if (!open) {\n // This branch is needed for controlled component via open prop\n previewMethodsRef.current?.unmountPreview();\n previewMethodsRef.current = undefined;\n }\n }, [\n open,\n progress,\n error,\n tabs,\n banners,\n utilities,\n utilitiesSummaryItems,\n isSmallOrAbove,\n inline\n ]);\n\n if (inline) {\n return (\n <CasePreviewContent\n error={error}\n onErrorRetry={onErrorRetry}\n caseId={caseId}\n caseType={caseType}\n heading={heading}\n subheading={subheading}\n caseLink={caseLink}\n parentCases={parentCases}\n icon={icon}\n color={color}\n followed={followed}\n onFollowedChange={onFollowedChange}\n summaryFields={summaryFields}\n tabs={tabs}\n stages={stages}\n tasks={tasks}\n tabContent={tabContent}\n utilities={utilities}\n utilitiesSummaryItems={utilitiesSummaryItems}\n actions={actions}\n banners={banners}\n onEdit={onEdit}\n />\n );\n }\n\n return null;\n }\n);\n\nexport default withTestIds(CasePreview, getCasePreviewTestIds);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CaseHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseView/CaseHeader/CaseHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAc,MAAM,OAAO,CAAC;AA8C5C,QAAA,MAAM,UAAU,EAAE,EAyZjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"CaseHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseView/CaseHeader/CaseHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAc,MAAM,OAAO,CAAC;AA8C5C,QAAA,MAAM,UAAU,EAAE,EA4ZjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -145,10 +145,12 @@ const CaseHeader = () => {
145
145
  useEffect(() => {
146
146
  setHasBrokenImage(undefined);
147
147
  }, [typeof icon === 'string' ? icon : icon?.href]);
148
- const headingText = typeof heading === 'string' ? heading : heading.text;
148
+ if (heading === undefined)
149
+ return null;
150
+ const headingText = typeof heading === 'string' ? heading : heading.text ?? '';
149
151
  return (_jsxs(Flex, { "data-testid": testIds.header, as: StyledCaseHeader, container: { direction: 'column', gap: 1 }, children: [_jsxs(Flex, { container: true, ref: contentsEl, children: [showExpandCollapse && onToggleSummary && !persistentUtility && (_jsx(StyledExpandCollapseSummaryButton, { ref: toggleButtonRef, onClick: onToggleSummary, label: t(summaryExpanded ? 'collapse' : 'expand'), "aria-label": t(summaryExpanded ? 'collapse_summary' : 'expand_summary'), icon: true, compact: true, children: _jsx(Icon, { name: summaryExpanded ? `arrow-micro-${start}` : 'arrow-micro-down' }) })), showIcon && (_jsx(Flex, { container: { pad: [1, 0, 0] }, item: { shrink: 0 }, children: (() => {
150
152
  if (typeof icon === 'string') {
151
- return (_jsx(StyledCaseViewIcon, { "data-testid": testIds.icon, "aria-label": t('case_type_icon', [caseType ?? t('case_type')]), name: icon, foreground: iconForeground, background: iconBackground }));
153
+ return (_jsx(StyledCaseViewIcon, { "data-testid": testIds.icon, "aria-label": t('case_type_icon', [caseType ?? t('case_type')]), name: icon, foreground: iconForeground, background: iconBackground, emphasized: true }));
152
154
  }
153
155
  return (_jsx(StyledIconShape, { background: iconBackground, "data-testid": testIds.icon, children: _jsx(StyledCaseViewImage, { src: icon.href, alt: t('case_image'), onLoad: () => {
154
156
  setHasBrokenImage(false);
@@ -189,7 +191,7 @@ const CaseHeader = () => {
189
191
  ], leafOnly: true }))] }), collapsedMainHeader && !wrapPromotedActions && (_jsx(Summary, { siblingRef: actionsContainerEl }, summaryResetID)), _jsxs(Flex, { as: StyledHeaderActions, item: { shrink: 0 }, container: { alignItems: 'start', pad: [0, 0, 0, 2] }, offsetEnd: !summaryExpanded, ref: actionsContainerEl, children: [collapsedMainHeader &&
190
192
  !wrapPromotedActions &&
191
193
  promotedActions &&
192
- promotedActions.length > 0 ? (_jsx(_Fragment, { children: promotedActions.map(promotedAction => (_jsx(StyledCaseHeaderPromotedAction, { variant: 'secondary', onClick: (e) => promotedAction.onClick?.(promotedAction.id, e), children: promotedAction.text }, promotedAction.id))) })) : null, onEdit && (_jsx(Button, { "data-testid": testIds.edit, icon: true, variant: 'simple', onClick: onEdit, label: t('edit'), "aria-label": `${t('edit')} - ${headingText}`, children: _jsx(Icon, { name: 'pencil' }) })), (actionsLoading || caseActions.length > 0) && (_jsx(Actions, { contextualLabel: typeof heading === 'string' ? heading : heading.text, "data-testid": testIds.actions, iconOnly: true, progress: actionsLoading, items: caseActions, menuAt: actionsLoading ? 0 : 1, filterAt: 5, scrollAt: Infinity }))] })] }), (!collapsedMainHeader || wrapPromotedActions || !aboveSM) &&
194
+ promotedActions.length > 0 ? (_jsx(_Fragment, { children: promotedActions.map(promotedAction => (_jsx(StyledCaseHeaderPromotedAction, { variant: 'secondary', onClick: (e) => promotedAction.onClick?.(promotedAction.id, e), children: promotedAction.text }, promotedAction.id))) })) : null, onEdit && (_jsx(Button, { "data-testid": testIds.edit, icon: true, variant: 'simple', onClick: onEdit, label: t('edit'), "aria-label": `${t('edit')} - ${headingText}`, children: _jsx(Icon, { name: 'pencil' }) })), (actionsLoading || caseActions.length > 0) && (_jsx(Actions, { contextualLabel: headingText, "data-testid": testIds.actions, iconOnly: true, progress: actionsLoading, items: caseActions, menuAt: actionsLoading ? 0 : 1, filterAt: 5, scrollAt: Infinity }))] })] }), (!collapsedMainHeader || wrapPromotedActions || !aboveSM) &&
193
195
  promotedActions &&
194
196
  promotedActions.length > 0 ? (_jsx(Flex, { "data-testid": testIds.promotedActions, container: { justify: 'start', wrap: 'wrap', gap: 1, pad: [0, 0, 0.5] }, children: promotedActions.map(({ id, text, onClick }) => (_jsx("div", { children: _jsx(StyledCaseHeaderPromotedAction, { variant: 'secondary', onClick: (e) => onClick?.(id, e), children: text }) }, text))) })) : null, collaboration] }));
195
197
  };