@pega/cosmos-react-work 3.0.0-dev.3.0 → 3.0.0-dev.30.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 (177) hide show
  1. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts +4 -0
  2. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
  3. package/lib/components/AppAnnouncement/AppAnnouncement.js +4 -3
  4. package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
  5. package/lib/components/CasePreview/CasePreview.d.ts +2 -2
  6. package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
  7. package/lib/components/CasePreview/CasePreview.js +7 -2
  8. package/lib/components/CasePreview/CasePreview.js.map +1 -1
  9. package/lib/components/CaseView/CaseHeader.d.ts +4 -0
  10. package/lib/components/CaseView/CaseHeader.d.ts.map +1 -0
  11. package/lib/components/CaseView/CaseHeader.js +49 -0
  12. package/lib/components/CaseView/CaseHeader.js.map +1 -0
  13. package/lib/components/CaseView/CaseSummary.d.ts +4 -0
  14. package/lib/components/CaseView/CaseSummary.d.ts.map +1 -0
  15. package/lib/components/CaseView/CaseSummary.js +13 -0
  16. package/lib/components/CaseView/CaseSummary.js.map +1 -0
  17. package/lib/components/CaseView/CaseSummaryFields.d.ts +6 -0
  18. package/lib/components/CaseView/CaseSummaryFields.d.ts.map +1 -0
  19. package/lib/components/CaseView/CaseSummaryFields.js +8 -0
  20. package/lib/components/CaseView/CaseSummaryFields.js.map +1 -0
  21. package/lib/components/CaseView/CaseView.context.d.ts +5 -0
  22. package/lib/components/CaseView/CaseView.context.d.ts.map +1 -0
  23. package/lib/components/CaseView/CaseView.context.js +5 -0
  24. package/lib/components/CaseView/CaseView.context.js.map +1 -0
  25. package/lib/components/CaseView/CaseView.d.ts +2 -27
  26. package/lib/components/CaseView/CaseView.d.ts.map +1 -1
  27. package/lib/components/CaseView/CaseView.js +219 -192
  28. package/lib/components/CaseView/CaseView.js.map +1 -1
  29. package/lib/components/CaseView/CaseView.styles.d.ts +14 -18
  30. package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
  31. package/lib/components/CaseView/CaseView.styles.js +235 -44
  32. package/lib/components/CaseView/CaseView.styles.js.map +1 -1
  33. package/lib/components/CaseView/CaseView.types.d.ts +97 -0
  34. package/lib/components/CaseView/CaseView.types.d.ts.map +1 -0
  35. package/lib/components/CaseView/CaseView.types.js +2 -0
  36. package/lib/components/CaseView/CaseView.types.js.map +1 -0
  37. package/lib/components/CaseView/MobileCaseView.js +1 -1
  38. package/lib/components/CaseView/MobileCaseView.js.map +1 -1
  39. package/lib/components/CaseView/UtilitiesSummary.d.ts +4 -6
  40. package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -1
  41. package/lib/components/CaseView/UtilitiesSummary.js +8 -4
  42. package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
  43. package/lib/components/CaseView/index.d.ts +5 -2
  44. package/lib/components/CaseView/index.d.ts.map +1 -1
  45. package/lib/components/CaseView/index.js +4 -1
  46. package/lib/components/CaseView/index.js.map +1 -1
  47. package/lib/components/ConfigurableLayout/ConfigurableLayout.js +1 -1
  48. package/lib/components/ConfigurableLayout/ConfigurableLayout.js.map +1 -1
  49. package/lib/components/ConfigurableLayout/LayoutCell.js +1 -1
  50. package/lib/components/ConfigurableLayout/LayoutCell.js.map +1 -1
  51. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts +1 -1
  52. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts.map +1 -1
  53. package/lib/components/Confirmation/Confirmation.d.ts +2 -2
  54. package/lib/components/Confirmation/Confirmation.d.ts.map +1 -1
  55. package/lib/components/Confirmation/Confirmation.js +1 -1
  56. package/lib/components/Confirmation/Confirmation.js.map +1 -1
  57. package/lib/components/Details/Details.d.ts +31 -10
  58. package/lib/components/Details/Details.d.ts.map +1 -1
  59. package/lib/components/Details/Details.js +77 -35
  60. package/lib/components/Details/Details.js.map +1 -1
  61. package/lib/components/Details/Details.styles.d.ts +47 -0
  62. package/lib/components/Details/Details.styles.d.ts.map +1 -0
  63. package/lib/components/Details/Details.styles.js +243 -0
  64. package/lib/components/Details/Details.styles.js.map +1 -0
  65. package/lib/components/Details/DetailsContext.d.ts +9 -0
  66. package/lib/components/Details/DetailsContext.d.ts.map +1 -0
  67. package/lib/components/Details/DetailsContext.js +9 -0
  68. package/lib/components/Details/DetailsContext.js.map +1 -0
  69. package/lib/components/Details/index.d.ts +2 -2
  70. package/lib/components/Details/index.d.ts.map +1 -1
  71. package/lib/components/Details/index.js +2 -1
  72. package/lib/components/Details/index.js.map +1 -1
  73. package/lib/components/Glimpse/Glimpse.js +1 -1
  74. package/lib/components/Glimpse/Glimpse.js.map +1 -1
  75. package/lib/components/SearchResults/Filter.js +2 -2
  76. package/lib/components/SearchResults/Filter.js.map +1 -1
  77. package/lib/components/SearchResults/SearchResult.d.ts +1 -1
  78. package/lib/components/SearchResults/SearchResult.d.ts.map +1 -1
  79. package/lib/components/SearchResults/SearchResult.js +9 -3
  80. package/lib/components/SearchResults/SearchResult.js.map +1 -1
  81. package/lib/components/SearchResults/SearchResults.d.ts.map +1 -1
  82. package/lib/components/SearchResults/SearchResults.js +59 -40
  83. package/lib/components/SearchResults/SearchResults.js.map +1 -1
  84. package/lib/components/SearchResults/SearchResults.styles.d.ts +3 -0
  85. package/lib/components/SearchResults/SearchResults.styles.d.ts.map +1 -1
  86. package/lib/components/SearchResults/SearchResults.styles.js +38 -17
  87. package/lib/components/SearchResults/SearchResults.styles.js.map +1 -1
  88. package/lib/components/SearchResults/SearchResults.types.d.ts +4 -0
  89. package/lib/components/SearchResults/SearchResults.types.d.ts.map +1 -1
  90. package/lib/components/SearchResults/SearchResults.types.js.map +1 -1
  91. package/lib/components/Stages/StageGlimpse.d.ts +10 -0
  92. package/lib/components/Stages/StageGlimpse.d.ts.map +1 -0
  93. package/lib/components/Stages/StageGlimpse.js +11 -0
  94. package/lib/components/Stages/StageGlimpse.js.map +1 -0
  95. package/lib/components/Stages/Stages.d.ts +1 -1
  96. package/lib/components/Stages/Stages.d.ts.map +1 -1
  97. package/lib/components/Stages/Stages.js +105 -112
  98. package/lib/components/Stages/Stages.js.map +1 -1
  99. package/lib/components/Stages/Stages.styles.d.ts +5 -7
  100. package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
  101. package/lib/components/Stages/Stages.styles.js +180 -189
  102. package/lib/components/Stages/Stages.styles.js.map +1 -1
  103. package/lib/components/Stages/Stages.types.d.ts +19 -4
  104. package/lib/components/Stages/Stages.types.d.ts.map +1 -1
  105. package/lib/components/Stages/Stages.types.js.map +1 -1
  106. package/lib/components/Stakeholders/StakeholderForm.js +4 -4
  107. package/lib/components/Stakeholders/StakeholderForm.js.map +1 -1
  108. package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -1
  109. package/lib/components/Stakeholders/Stakeholders.js +16 -10
  110. package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
  111. package/lib/components/Tags/Tags.d.ts.map +1 -1
  112. package/lib/components/Tags/Tags.js +16 -17
  113. package/lib/components/Tags/Tags.js.map +1 -1
  114. package/lib/components/Tasks/TaskList.d.ts +8 -5
  115. package/lib/components/Tasks/TaskList.d.ts.map +1 -1
  116. package/lib/components/Tasks/TaskList.js +14 -6
  117. package/lib/components/Tasks/TaskList.js.map +1 -1
  118. package/lib/components/Tasks/Tasks.d.ts.map +1 -1
  119. package/lib/components/Tasks/Tasks.js +5 -4
  120. package/lib/components/Tasks/Tasks.js.map +1 -1
  121. package/lib/components/Timeline/Timeline.js +2 -2
  122. package/lib/components/Timeline/Timeline.js.map +1 -1
  123. package/lib/components/Timeline/Timeline.styles.d.ts +1 -1
  124. package/lib/components/Timeline/Timeline.styles.d.ts.map +1 -1
  125. package/lib/components/Timeline/Timeline.styles.js +1 -0
  126. package/lib/components/Timeline/Timeline.styles.js.map +1 -1
  127. package/lib/components/Timeline/Timeline.types.d.ts +24 -3
  128. package/lib/components/Timeline/Timeline.types.d.ts.map +1 -1
  129. package/lib/components/Timeline/Timeline.types.js.map +1 -1
  130. package/lib/components/Timeline/TimelineItem.d.ts.map +1 -1
  131. package/lib/components/Timeline/TimelineItem.js +4 -4
  132. package/lib/components/Timeline/TimelineItem.js.map +1 -1
  133. package/lib/components/Timeline/TimelineToolbar.d.ts +6 -0
  134. package/lib/components/Timeline/TimelineToolbar.d.ts.map +1 -0
  135. package/lib/components/Timeline/TimelineToolbar.js +68 -0
  136. package/lib/components/Timeline/TimelineToolbar.js.map +1 -0
  137. package/lib/components/Timeline/index.d.ts +1 -0
  138. package/lib/components/Timeline/index.d.ts.map +1 -1
  139. package/lib/components/Timeline/index.js +1 -0
  140. package/lib/components/Timeline/index.js.map +1 -1
  141. package/lib/index.d.ts +0 -6
  142. package/lib/index.d.ts.map +1 -1
  143. package/lib/index.js +0 -6
  144. package/lib/index.js.map +1 -1
  145. package/package.json +17 -11
  146. package/lib/components/CaseHeader/CaseHeader.d.ts +0 -30
  147. package/lib/components/CaseHeader/CaseHeader.d.ts.map +0 -1
  148. package/lib/components/CaseHeader/CaseHeader.js +0 -119
  149. package/lib/components/CaseHeader/CaseHeader.js.map +0 -1
  150. package/lib/components/CaseHeader/index.d.ts +0 -4
  151. package/lib/components/CaseHeader/index.d.ts.map +0 -1
  152. package/lib/components/CaseHeader/index.js +0 -3
  153. package/lib/components/CaseHeader/index.js.map +0 -1
  154. package/lib/components/CaseSummary/CaseSummary.d.ts +0 -36
  155. package/lib/components/CaseSummary/CaseSummary.d.ts.map +0 -1
  156. package/lib/components/CaseSummary/CaseSummary.js +0 -130
  157. package/lib/components/CaseSummary/CaseSummary.js.map +0 -1
  158. package/lib/components/CaseSummary/index.d.ts +0 -4
  159. package/lib/components/CaseSummary/index.d.ts.map +0 -1
  160. package/lib/components/CaseSummary/index.js +0 -3
  161. package/lib/components/CaseSummary/index.js.map +0 -1
  162. package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts +0 -22
  163. package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts.map +0 -1
  164. package/lib/components/CaseSummaryFields/CaseSummaryFields.js +0 -25
  165. package/lib/components/CaseSummaryFields/CaseSummaryFields.js.map +0 -1
  166. package/lib/components/CaseSummaryFields/index.d.ts +0 -4
  167. package/lib/components/CaseSummaryFields/index.d.ts.map +0 -1
  168. package/lib/components/CaseSummaryFields/index.js +0 -3
  169. package/lib/components/CaseSummaryFields/index.js.map +0 -1
  170. package/lib/components/Stages/Steps.d.ts +0 -8
  171. package/lib/components/Stages/Steps.d.ts.map +0 -1
  172. package/lib/components/Stages/Steps.js +0 -12
  173. package/lib/components/Stages/Steps.js.map +0 -1
  174. package/lib/components/Stages/StepsContainer.d.ts +0 -8
  175. package/lib/components/Stages/StepsContainer.d.ts.map +0 -1
  176. package/lib/components/Stages/StepsContainer.js +0 -11
  177. package/lib/components/Stages/StepsContainer.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SearchResults.js","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,MAAM,EAIP,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,KAAK,EACL,IAAI,EAEJ,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,KAAK,EAEL,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,UAAU,EACV,IAAI,EACJ,OAAO,EACP,aAAa,EACb,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,UAAU,MAAM,+DAA+D,CAAC;AAC5F,OAAO,KAAK,YAAY,MAAM,kEAAkE,CAAC;AAQjG,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,wBAAwB,C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AAC,SAAS,KAAK,MAAM,CAAC,IAAI,EAAE,IAVjC,MAAM,CAAC,EAAE,CAWH,CACd,CAAC;wCACJ,CAAC,CAAC,WACG,CACR,YACI,EACP,KAAC,IAAI,IACH,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,EACvE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,YAEvB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAChB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAyB,EAAE,EAAE;oCACxC,OAAO,KAAC,YAAY,OAAqB,MAAM,IAArB,MAAM,CAAC,EAAE,CAAgB,CAAC;gCACtD,CAAC,CAAC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,YAClC,KAAC,UAAU,IACT,OAAO,EAAE,gBAAgB,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,WACtE,WACG,CACR,WACI,EACN,UAAU,IAAI,CACb,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,YACpC,KAAC,MAAM,IAAC,OAAO,EAAC,MAAM,EAAC,OAAO,EAAE,UAAU,YACvC,CAAC,CAAC,WAAW,CAAC,WACR,WACJ,CACR,YACI,YACF,WACK,WACT,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n forwardRef,\n useContext,\n useRef,\n FunctionComponent,\n PropsWithoutRef,\n ComponentProps\n} from 'react';\n\nimport {\n Button,\n Card,\n CardContent,\n Count,\n Flex,\n ForwardProps,\n Grid,\n Icon,\n registerIcon,\n Modal,\n ModalMethods,\n ModalManagerContext,\n EmptyState,\n SearchInput,\n Selectable,\n Text,\n useI18n,\n useBreakpoint,\n useAfterInitialEffect\n} from '@pega/cosmos-react-core';\nimport * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';\nimport * as filterOnIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter-on.icon';\n\nimport {\n SearchResultsProps,\n SearchResultProps,\n FilterProps,\n ActiveFilters\n} from './SearchResults.types';\nimport SearchResult from './SearchResult';\nimport Filter from './Filter';\nimport {\n StyledModalFilterContent,\n StyledCountText,\n StyledSelectedFilters,\n StyledSearchResults,\n StyledFilterTitle\n} from './SearchResults.styles';\n\nregisterIcon(filterIcon, filterOnIcon);\n\nconst FilterModal = (\n props: Pick<\n SearchResultsProps,\n 'count' | 'filters' | 'onFilterChange' | 'onClearFilter' | 'onClearAllFilters'\n > & {\n activeFilters: ActiveFilters[];\n }\n) => {\n const { activeFilters, count, filters, onFilterChange, onClearFilter, onClearAllFilters } = props;\n const t = useI18n();\n\n return (\n <Modal heading={t('filters')} autoWidth>\n <Grid as={StyledModalFilterContent} container={{ rowGap: 2 }}>\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n <Text as={StyledCountText} variant='secondary'>\n {t('results_count', [count], { count })}\n </Text>\n {onClearAllFilters && !!activeFilters.length && (\n <Button variant='link' onClick={onClearAllFilters}>\n {t('clear_all')}\n </Button>\n )}\n </Flex>\n {!!activeFilters.length && (\n <Flex as={StyledSelectedFilters} container={{ gap: 1 }}>\n {activeFilters.map(filter => {\n return (\n <Selectable\n key={filter.id}\n id={filter.id}\n onRemove={() =>\n onFilterChange?.({\n name: filter.groupName,\n type: filter.type,\n value: filter.resetValue\n })\n }\n >\n {`${filter.groupName}: ${filter.name}`}\n </Selectable>\n );\n })}\n </Flex>\n )}\n <div>\n {filters.map((filter: FilterProps) => {\n return (\n <Filter\n key={filter.name}\n onFilterChange={onFilterChange}\n onClearFilter={onClearFilter}\n {...filter}\n />\n );\n })}\n </div>\n </Grid>\n </Modal>\n );\n};\n\nconst SearchResults: FunctionComponent<SearchResultsProps & ForwardProps> = forwardRef(\n (\n {\n results,\n searchInputProps,\n count,\n filters,\n onFilterChange,\n onClearAllFilters,\n onClearFilter,\n onShowMore,\n ...restProps\n }: PropsWithoutRef<SearchResultsProps>,\n ref: SearchResultsProps['ref']\n ) => {\n const t = useI18n();\n const isMedium = useBreakpoint('md');\n const { create } = useContext(ModalManagerContext);\n const filtersMethods = useRef<ModalMethods<ComponentProps<typeof FilterModal>>>();\n const { placeholder = t('search_placeholder_default') } = searchInputProps;\n\n const activeFilters: ActiveFilters[] = filters.flatMap(group => {\n if (group.type === 'select') {\n return group.items.flatMap(item => {\n if (item.checked) {\n return {\n id: item.id,\n name: item.name,\n resetValue: { ...item, checked: false },\n groupName: group.name,\n type: group.type\n };\n }\n return [];\n });\n }\n return [];\n });\n\n const openFiltersModal = () => {\n filtersMethods.current = create(FilterModal, {\n activeFilters,\n count,\n filters,\n onFilterChange,\n onClearFilter,\n onClearAllFilters\n });\n };\n\n useAfterInitialEffect(() => {\n if (filtersMethods.current) {\n filtersMethods.current.update({\n activeFilters,\n count,\n filters\n });\n }\n }, [activeFilters, count, filters]);\n\n useAfterInitialEffect(() => {\n if (isMedium && filtersMethods.current) filtersMethods.current.dismiss();\n }, [isMedium]);\n\n return (\n <Card>\n <CardContent>\n <Grid\n {...restProps}\n as={StyledSearchResults}\n ref={ref}\n md={\n filters.length\n ? {\n container: {\n cols: '15rem auto',\n areas: '\"search search\" \"filters results\"'\n }\n }\n : {}\n }\n s={\n filters.length\n ? {\n container: {\n cols: 'auto'\n }\n }\n : {}\n }\n container={{ rows: '1fr auto', areas: '\"search\" \"results\"', rowGap: 2, colGap: 4 }}\n >\n <Grid item={{ area: 'search' }}>\n <SearchInput {...searchInputProps} placeholder={placeholder} />\n </Grid>\n {isMedium && !!filters.length && (\n <Grid item={{ area: 'filters', alignSelf: 'start' }}>\n <Flex as={StyledFilterTitle} container={{ justify: 'between' }}>\n <Text variant='h2'>{t('filters')}</Text>\n {onClearAllFilters && !!activeFilters.length && (\n <Button variant='link' onClick={onClearAllFilters}>\n {t('clear_all')}\n </Button>\n )}\n </Flex>\n {filters.map((filter: FilterProps) => {\n return (\n <Filter\n key={filter.name}\n onFilterChange={onFilterChange}\n onClearFilter={onClearFilter}\n {...filter}\n />\n );\n })}\n </Grid>\n )}\n <Grid\n item={{ area: 'results' }}\n container={{\n alignItems: 'center',\n rowGap: 2,\n rows: 'auto 1fr',\n areas: '\"meta\" \"items\"'\n }}\n >\n <Grid item={{ area: 'meta' }} container={{ rowGap: 1 }}>\n <Flex container={{ justify: 'between', alignItems: 'center' }}>\n <Text as={StyledCountText} variant='secondary'>\n {searchInputProps.value !== '' || results.length > 0\n ? t('results_count', [count], { count })\n : ''}\n </Text>\n {!isMedium && !!filters.length && (\n <Button variant='simple' onClick={openFiltersModal}>\n <Icon name={activeFilters.length > 0 ? 'filter-on' : 'filter'} />\n &nbsp;{t('filters')}&nbsp;\n <Count>{activeFilters.length}</Count>\n </Button>\n )}\n </Flex>\n {!!activeFilters.length && (\n <Flex as={StyledSelectedFilters} container={{ gap: 1 }}>\n {activeFilters.map(filter => {\n return (\n <Selectable\n key={filter.id}\n id={filter.id}\n onRemove={() =>\n onFilterChange?.({\n name: filter.groupName,\n type: filter.type,\n value: filter.resetValue\n })\n }\n >\n {`${filter.groupName}: ${filter.name}`}\n </Selectable>\n );\n })}\n </Flex>\n )}\n </Grid>\n <Grid\n item={{ area: 'items', alignSelf: results.length ? 'start' : 'center' }}\n container={{ rowGap: 4 }}\n >\n {results.length ? (\n results.map((result: SearchResultProps) => {\n return <SearchResult key={result.id} {...result} />;\n })\n ) : (\n <Grid item={{ alignSelf: 'stretch' }}>\n <EmptyState\n message={searchInputProps.value === '' ? t('empty_search') : undefined}\n />\n </Grid>\n )}\n </Grid>\n {onShowMore && (\n <Flex container={{ justify: 'center' }}>\n <Button variant='link' onClick={onShowMore}>\n {t('show_more')}\n </Button>\n </Flex>\n )}\n </Grid>\n </Grid>\n </CardContent>\n </Card>\n );\n }\n);\n\nexport default SearchResults;\n"]}
1
+ {"version":3,"file":"SearchResults.js","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,MAAM,EAIN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EACL,MAAM,EACN,KAAK,EACL,IAAI,EAEJ,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,KAAK,EAEL,UAAU,EACV,WAAW,EACX,UAAU,EACV,IAAI,EACJ,eAAe,EACf,OAAO,EACP,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,MAAM,EACN,QAAQ,EACR,eAAe,EACf,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,UAAU,MAAM,+DAA+D,CAAC;AAC5F,OAAO,KAAK,YAAY,MAAM,kEAAkE,CAAC;AAQjG,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAEvC,MAAM,WAAW,GAAG,CAClB,KAKC,EACD,EAAE;IACF,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC;IAClG,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,OAAO,CACL,KAAC,KAAK,IAAC,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,SAAS,kBACrC,MAAC,IAAI,IAAC,EAAE,EAAE,wBAAwB,EAAE,SAAS,EAAE,EAA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Y,OAAqB,MAAM,EAAE,MAAM,EAAE,MAAM,IAArC,MAAM,CAAC,EAAE,CAAgC,CAAC;gCACtE,CAAC,CAAC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,YAClC,KAAC,UAAU,IACT,OAAO,EAAE,oBAAoB,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,GACpE,GACG,CACR,EACA,UAAU,IAAI,CACb,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,YACpC,KAAC,MAAM,IAAC,OAAO,EAAC,MAAM,EAAC,OAAO,EAAE,UAAU,YACvC,CAAC,CAAC,WAAW,CAAC,GACR,GACJ,CACR,IACA,CACJ,GACI,IACF,IACF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n forwardRef,\n useContext,\n useRef,\n FunctionComponent,\n PropsWithoutRef,\n ComponentProps,\n useState\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport {\n Button,\n Count,\n Flex,\n ForwardProps,\n Grid,\n Icon,\n registerIcon,\n Modal,\n ModalMethods,\n EmptyState,\n SearchInput,\n Selectable,\n Text,\n useModalManager,\n useI18n,\n useBreakpoint,\n useAfterInitialEffect,\n SummaryItem,\n Avatar,\n useTheme,\n AppShellContext,\n Progress\n} from '@pega/cosmos-react-core';\nimport * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';\nimport * as filterOnIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter-on.icon';\n\nimport {\n SearchResultsProps,\n SearchResultProps,\n FilterProps,\n ActiveFilters\n} from './SearchResults.types';\nimport SearchResult from './SearchResult';\nimport Filter from './Filter';\nimport {\n StyledModalFilterContent,\n StyledCountText,\n StyledSelectedFilters,\n StyledSearchResults,\n StyledResults,\n StyledFilters,\n StyledSearchSummaryItem\n} from './SearchResults.styles';\n\nregisterIcon(filterIcon, filterOnIcon);\n\nconst FilterModal = (\n props: Pick<\n SearchResultsProps,\n 'count' | 'filters' | 'onFilterChange' | 'onClearFilter' | 'onClearAllFilters'\n > & {\n activeFilters: ActiveFilters[];\n }\n) => {\n const { activeFilters, count, filters, onFilterChange, onClearFilter, onClearAllFilters } = props;\n const t = useI18n();\n\n return (\n <Modal heading={t('filters')} autoWidth>\n <Grid as={StyledModalFilterContent} container={{ rowGap: 2 }}>\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n <Text as={StyledCountText} variant='secondary'>\n {t('results_count', [count], { count })}\n </Text>\n {onClearAllFilters && !!activeFilters.length && (\n <Button variant='link' onClick={onClearAllFilters}>\n {t('clear_all')}\n </Button>\n )}\n </Flex>\n {!!activeFilters.length && (\n <Flex as={StyledSelectedFilters} container={{ gap: 1 }}>\n {activeFilters.map(filter => {\n return (\n <Selectable\n key={filter.id}\n id={filter.id}\n onRemove={() =>\n onFilterChange?.({\n name: filter.groupName,\n type: filter.type,\n value: filter.resetValue\n })\n }\n >\n {`${filter.groupName}: ${filter.name}`}\n </Selectable>\n );\n })}\n </Flex>\n )}\n <div>\n {filters.map((filter: FilterProps) => {\n return (\n <Filter\n key={filter.name}\n onFilterChange={onFilterChange}\n onClearFilter={onClearFilter}\n {...filter}\n />\n );\n })}\n </div>\n </Grid>\n </Modal>\n );\n};\n\nconst SearchResults: FunctionComponent<SearchResultsProps & ForwardProps> = forwardRef(\n (\n {\n results,\n searchInputProps,\n count,\n filters,\n onFilterChange,\n onClearAllFilters,\n onClearFilter,\n onShowMore,\n loading = false,\n ...restProps\n }: PropsWithoutRef<SearchResultsProps>,\n ref: SearchResultsProps['ref']\n ) => {\n const t = useI18n();\n const isMedium = useBreakpoint('md');\n const { create } = useModalManager();\n const { searchContainerEl } = useContext(AppShellContext);\n const filtersMethods = useRef<ModalMethods<ComponentProps<typeof FilterModal>>>();\n const { placeholder = t('search_placeholder_default') } = searchInputProps;\n const {\n base: {\n palette: { 'brand-primary': primary }\n }\n } = useTheme();\n const [accent, setAccent] = useState<undefined | RegExp>();\n const [submittedSearchValue, setSubmittedSearchValue] = useState(searchInputProps.value);\n\n const activeFilters: ActiveFilters[] = filters.flatMap(group => {\n if (group.type === 'select') {\n return group.items.flatMap(item => {\n if (item.checked) {\n return {\n id: item.id,\n name: item.name,\n resetValue: { ...item, checked: false },\n groupName: group.name,\n type: group.type\n };\n }\n return [];\n });\n }\n return [];\n });\n\n const openFiltersModal = () => {\n filtersMethods.current = create(FilterModal, {\n activeFilters,\n count,\n filters,\n onFilterChange,\n onClearFilter,\n onClearAllFilters\n });\n };\n\n useAfterInitialEffect(() => {\n if (filtersMethods.current) {\n filtersMethods.current.update({\n activeFilters,\n count,\n filters\n });\n }\n }, [activeFilters, count, filters]);\n\n useAfterInitialEffect(() => {\n if (isMedium && filtersMethods.current) filtersMethods.current.dismiss();\n }, [isMedium]);\n\n useAfterInitialEffect(() => {\n setAccent(submittedSearchValue ? new RegExp(submittedSearchValue, 'gi') : undefined);\n }, [submittedSearchValue]);\n\n const searchTitle = (\n <SummaryItem\n as={StyledSearchSummaryItem}\n visual={\n <Avatar\n icon='search'\n name='search'\n shape='squircle'\n backgroundColor={primary}\n color='white'\n />\n }\n primary={<Text variant='h1'>Search</Text>}\n actions={\n onClearAllFilters &&\n isMedium &&\n !!activeFilters.length && (\n <Button variant='link' onClick={onClearAllFilters}>\n {t('clear_all')}\n </Button>\n )\n }\n />\n );\n const searchInput = (\n <SearchInput\n {...searchInputProps}\n onSearchSubmit={val => {\n searchInputProps.onSearchSubmit?.(val);\n setSubmittedSearchValue(val);\n }}\n placeholder={placeholder}\n />\n );\n\n return (\n <Grid\n {...restProps}\n as={StyledSearchResults}\n ref={ref}\n md={\n filters.length\n ? {\n container: {\n cols: '15rem auto'\n }\n }\n : undefined\n }\n sm={\n filters.length\n ? {\n container: {\n cols: 'auto',\n rowGap: 2\n }\n }\n : undefined\n }\n container={{\n rows: 'auto auto',\n cols: 'auto 1fr',\n areas: '\"filters results\"'\n }}\n >\n {isMedium && !!filters.length && (\n <Grid item={{ area: 'filters', alignSelf: 'start' }} as={StyledFilters}>\n {searchTitle}\n {filters.map((filter: FilterProps) => {\n return (\n <Filter\n key={filter.name}\n onFilterChange={onFilterChange}\n onClearFilter={onClearFilter}\n {...filter}\n />\n );\n })}\n </Grid>\n )}\n <Grid\n item={{ alignSelf: 'start', area: 'results' }}\n container={{\n alignItems: 'center',\n rowGap: 2,\n rows: 'auto auto 1fr',\n areas: '\"search\" \"meta\" \"items\"'\n }}\n as={StyledResults}\n >\n {loading && <Progress placement='local' />}\n {searchContainerEl && isMedium ? (\n createPortal(searchInput, searchContainerEl)\n ) : (\n <Grid item={{ area: 'search' }}>\n {!isMedium && searchTitle}\n {searchInput}\n </Grid>\n )}\n <Grid item={{ area: 'meta' }} container={{ rowGap: 1 }}>\n <Flex container={{ justify: 'between', alignItems: 'center' }}>\n {!loading && (\n <Text as={StyledCountText} variant='secondary'>\n {submittedSearchValue !== '' || results.length > 0\n ? t('results_count', [count], { count })\n : ''}\n </Text>\n )}\n {!isMedium && !!filters.length && (\n <Button variant='simple' onClick={openFiltersModal}>\n <Icon name={activeFilters.length > 0 ? 'filter-on' : 'filter'} />\n &nbsp;{t('filters')}&nbsp;\n <Count>{activeFilters.length}</Count>\n </Button>\n )}\n </Flex>\n {!!activeFilters.length && (\n <Flex as={StyledSelectedFilters} container={{ gap: 1, wrap: 'wrap' }}>\n {activeFilters.map(filter => {\n return (\n <Selectable\n key={filter.id}\n id={filter.id}\n onRemove={() =>\n onFilterChange?.({\n name: filter.groupName,\n type: filter.type,\n value: filter.resetValue\n })\n }\n >\n {`${filter.groupName}: ${filter.name}`}\n </Selectable>\n );\n })}\n </Flex>\n )}\n </Grid>\n <Grid\n item={{ area: 'items', alignSelf: results.length ? 'start' : 'stretch' }}\n container={{ rowGap: 2 }}\n >\n {!loading && (\n <>\n {results.length ? (\n results.map((result: SearchResultProps) => {\n return <SearchResult key={result.id} {...result} accent={accent} />;\n })\n ) : (\n <Grid item={{ alignSelf: 'stretch' }}>\n <EmptyState\n message={submittedSearchValue === '' ? t('empty_search') : undefined}\n />\n </Grid>\n )}\n {onShowMore && (\n <Flex container={{ justify: 'center' }}>\n <Button variant='link' onClick={onShowMore}>\n {t('show_more')}\n </Button>\n </Flex>\n )}\n </>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n }\n);\n\nexport default SearchResults;\n"]}
@@ -5,4 +5,7 @@ export declare const StyledModalFilterContent: import("styled-components").Style
5
5
  export declare const StyledSelectedFilters: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
6
6
  export declare const StyledFilter: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
7
  export declare const StyledFilterButton: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
8
+ export declare const StyledSearchSummaryItem: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
9
+ export declare const StyledFilters: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
10
+ export declare const StyledResults: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
8
11
  //# sourceMappingURL=SearchResults.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SearchResults.styles.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.styles.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,mBAAmB,yGAAe,CAAC;AAIhD,eAAO,MAAM,iBAAiB,0GAI5B,CAAC;AAIH,eAAO,MAAM,eAAe,0GAI1B,CAAC;AAIH,eAAO,MAAM,wBAAwB,yGAWpC,CAAC;AAIF,eAAO,MAAM,qBAAqB,yGAWjC,CAAC;AAIF,eAAO,MAAM,YAAY,yGAWvB,CAAC;AAIH,eAAO,MAAM,kBAAkB,qOAsB7B,CAAC"}
1
+ {"version":3,"file":"SearchResults.styles.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.styles.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,mBAAmB,yGAE/B,CAAC;AAIF,eAAO,MAAM,iBAAiB,0GAI5B,CAAC;AAIH,eAAO,MAAM,eAAe,0GAI1B,CAAC;AAIH,eAAO,MAAM,wBAAwB,yGAWpC,CAAC;AAIF,eAAO,MAAM,qBAAqB,yGAWjC,CAAC;AAIF,eAAO,MAAM,YAAY,yGAAe,CAAC;AAIzC,eAAO,MAAM,kBAAkB,qOAsB7B,CAAC;AAIH,eAAO,MAAM,uBAAuB,yGAYnC,CAAC;AAIF,eAAO,MAAM,aAAa,yGAWxB,CAAC;AAIH,eAAO,MAAM,aAAa,yGAOxB,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import styled, { css } from 'styled-components';
2
- import { Button, calculateFontSize, defaultThemeProp, StyledIcon, useDirection } from '@pega/cosmos-react-core';
3
- export const StyledSearchResults = styled.div ``;
2
+ import { Button, calculateFontSize, defaultThemeProp, StyledIcon, StyledSearchInput, useDirection } from '@pega/cosmos-react-core';
3
+ export const StyledSearchResults = styled.div `
4
+ min-height: inherit;
5
+ `;
4
6
  StyledSearchResults.defaultProps = defaultThemeProp;
5
7
  export const StyledFilterTitle = styled.span(({ theme: { base } }) => {
6
8
  return css `
@@ -16,30 +18,19 @@ export const StyledCountText = styled.span(({ theme: { base } }) => {
16
18
  StyledCountText.defaultProps = defaultThemeProp;
17
19
  export const StyledModalFilterContent = styled.div(({ theme: { base: { spacing } } }) => {
18
20
  return css `
19
- margin-top: calc(0.25 * ${spacing});
20
- width: 25rem;
21
+ margin-top: calc(0.5 * ${spacing});
22
+ width: calc(${spacing} * 50);
21
23
  `;
22
24
  });
23
25
  StyledModalFilterContent.defaultProps = defaultThemeProp;
24
26
  export const StyledSelectedFilters = styled.div(({ theme: { base: { spacing } } }) => {
25
27
  return css `
26
28
  overflow-x: auto;
27
- padding-bottom: calc(0.5 * ${spacing});
29
+ padding-bottom: calc(1 * ${spacing});
28
30
  `;
29
31
  });
30
32
  StyledSelectedFilters.defaultProps = defaultThemeProp;
31
- export const StyledFilter = styled.div(props => {
32
- const { base } = props.theme;
33
- return css `
34
- border-bottom: 0.0625rem solid ${base.palette['border-line']};
35
- padding-bottom: calc(${base.spacing} * 2);
36
- margin-bottom: calc(${base.spacing} * 2);
37
-
38
- > :last-child > :first-child {
39
- padding-block-start: ${base.spacing};
40
- }
41
- `;
42
- });
33
+ export const StyledFilter = styled.div ``;
43
34
  StyledFilter.defaultProps = defaultThemeProp;
44
35
  export const StyledFilterButton = styled(Button)(({ theme: { base } }) => {
45
36
  const fontSize = calculateFontSize(base['font-size'], base['font-scale']);
@@ -64,4 +55,34 @@ export const StyledFilterButton = styled(Button)(({ theme: { base } }) => {
64
55
  `;
65
56
  });
66
57
  StyledFilterButton.defaultProps = defaultThemeProp;
58
+ export const StyledSearchSummaryItem = styled.div(({ theme: { base: { spacing } } }) => css `
59
+ column-gap: calc(${spacing} * 1);
60
+
61
+ + ${StyledSearchInput} {
62
+ margin-block-start: calc(${spacing} * 1);
63
+ }
64
+ `);
65
+ StyledSearchSummaryItem.defaultProps = defaultThemeProp;
66
+ export const StyledFilters = styled.div(({ theme }) => {
67
+ return css `
68
+ position: sticky;
69
+ top: var(--appshell-offset, 0);
70
+ max-height: calc(100vh - var(--appshell-offset, 0rem));
71
+ overflow: auto;
72
+ > ${StyledFilter}, ${StyledSearchSummaryItem} {
73
+ border-bottom: 0.0125rem solid ${theme.base.palette['border-line']};
74
+ padding: calc(${theme.base.spacing} * 2);
75
+ }
76
+ `;
77
+ });
78
+ StyledFilters.defaultProps = defaultThemeProp;
79
+ export const StyledResults = styled.div(({ theme }) => {
80
+ return css `
81
+ background-color: ${theme.base.palette['primary-background']};
82
+ padding: calc(${theme.base.spacing} * 2);
83
+ position: relative;
84
+ min-height: calc(100vh - var(--appshell-offset, 0rem));
85
+ `;
86
+ });
87
+ StyledResults.defaultProps = defaultThemeProp;
67
88
  //# sourceMappingURL=SearchResults.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SearchResults.styles.js","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEhD,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE;IACnE,OAAO,GAAG,CAAA;+BACmB,IAAI,CAAC,OAAO;GACxC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE;IACjE,OAAO,GAAG,CAAA;mBACO,IAAI,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC;GAChD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEhD,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAChD,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,OAAO,EAAE,EAClB,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;gCACkB,OAAO;;KAElC,CAAC;AACJ,CAAC,CACF,CAAC;A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AC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport {\n Button,\n calculateFontSize,\n defaultThemeProp,\n StyledIcon,\n useDirection\n} from '@pega/cosmos-react-core';\n\nexport const StyledSearchResults = styled.div``;\n\nStyledSearchResults.defaultProps = defaultThemeProp;\n\nexport const StyledFilterTitle = styled.span(({ theme: { base } }) => {\n return css`\n padding-bottom: calc(2 * ${base.spacing});\n `;\n});\n\nStyledFilterTitle.defaultProps = defaultThemeProp;\n\nexport const StyledCountText = styled.span(({ theme: { base } }) => {\n return css`\n font-weight: ${base['font-weight']['semi-bold']};\n `;\n});\n\nStyledCountText.defaultProps = defaultThemeProp;\n\nexport const StyledModalFilterContent = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n margin-top: calc(0.25 * ${spacing});\n width: 25rem;\n `;\n }\n);\n\nStyledModalFilterContent.defaultProps = defaultThemeProp;\n\nexport const StyledSelectedFilters = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n overflow-x: auto;\n padding-bottom: calc(0.5 * ${spacing});\n `;\n }\n);\n\nStyledSelectedFilters.defaultProps = defaultThemeProp;\n\nexport const StyledFilter = styled.div(props => {\n const { base } = props.theme;\n return css`\n border-bottom: 0.0625rem solid ${base.palette['border-line']};\n padding-bottom: calc(${base.spacing} * 2);\n margin-bottom: calc(${base.spacing} * 2);\n\n > :last-child > :first-child {\n padding-block-start: ${base.spacing};\n }\n `;\n});\n\nStyledFilter.defaultProps = defaultThemeProp;\n\nexport const StyledFilterButton = styled(Button)(({ theme: { base } }) => {\n const fontSize = calculateFontSize(base['font-size'], base['font-scale']);\n\n const { rtl } = useDirection();\n return css`\n display: inline-flex;\n font-size: ${fontSize.xl};\n\n ${StyledIcon} {\n height: 1em;\n width: 1em;\n transition: transform ${base.animation.speed} ${base.animation.timing.ease};\n }\n\n &[aria-expanded='true'] ${StyledIcon} {\n transform: rotate(0);\n }\n\n &[aria-expanded='false'] ${StyledIcon} {\n transform: rotate(calc(${rtl ? '1' : '-1'} * 90deg));\n }\n `;\n});\n\nStyledFilterButton.defaultProps = defaultThemeProp;\n"]}
1
+ {"version":3,"file":"SearchResults.styles.js","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAE5C,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE;IACnE,OAAO,GAAG,CAAA;+BACmB,IAAI,CAAC,OAAO;GACxC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE;IACjE,OAAO,GAAG,CAAA;mBACO,IAAI,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC;GAChD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEhD,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAChD,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,OAAO,EAAE,EAClB,EACF,EAAE,EAAE;IACH,OAAO,GAAG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AAE,OAAO,EAAE,EAClB,EACF,EAAE,EAAE,CAAC,GAAG,CAAA;uBACY,OAAO;;QAEtB,iBAAiB;iCACQ,OAAO;;GAErC,CACF,CAAC;AAEF,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAExD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,OAAO,GAAG,CAAA;;;;;QAKJ,YAAY,KAAK,uBAAuB;uCACT,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;sBAClD,KAAK,CAAC,IAAI,CAAC,OAAO;;GAErC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,aAAa,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,OAAO,GAAG,CAAA;wBACY,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;oBAC5C,KAAK,CAAC,IAAI,CAAC,OAAO;;;GAGnC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,aAAa,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport {\n Button,\n calculateFontSize,\n defaultThemeProp,\n StyledIcon,\n StyledSearchInput,\n useDirection\n} from '@pega/cosmos-react-core';\n\nexport const StyledSearchResults = styled.div`\n min-height: inherit;\n`;\n\nStyledSearchResults.defaultProps = defaultThemeProp;\n\nexport const StyledFilterTitle = styled.span(({ theme: { base } }) => {\n return css`\n padding-bottom: calc(2 * ${base.spacing});\n `;\n});\n\nStyledFilterTitle.defaultProps = defaultThemeProp;\n\nexport const StyledCountText = styled.span(({ theme: { base } }) => {\n return css`\n font-weight: ${base['font-weight']['semi-bold']};\n `;\n});\n\nStyledCountText.defaultProps = defaultThemeProp;\n\nexport const StyledModalFilterContent = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n margin-top: calc(0.5 * ${spacing});\n width: calc(${spacing} * 50);\n `;\n }\n);\n\nStyledModalFilterContent.defaultProps = defaultThemeProp;\n\nexport const StyledSelectedFilters = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n overflow-x: auto;\n padding-bottom: calc(1 * ${spacing});\n `;\n }\n);\n\nStyledSelectedFilters.defaultProps = defaultThemeProp;\n\nexport const StyledFilter = styled.div``;\n\nStyledFilter.defaultProps = defaultThemeProp;\n\nexport const StyledFilterButton = styled(Button)(({ theme: { base } }) => {\n const fontSize = calculateFontSize(base['font-size'], base['font-scale']);\n\n const { rtl } = useDirection();\n return css`\n display: inline-flex;\n font-size: ${fontSize.xl};\n\n ${StyledIcon} {\n height: 1em;\n width: 1em;\n transition: transform ${base.animation.speed} ${base.animation.timing.ease};\n }\n\n &[aria-expanded='true'] ${StyledIcon} {\n transform: rotate(0);\n }\n\n &[aria-expanded='false'] ${StyledIcon} {\n transform: rotate(calc(${rtl ? '1' : '-1'} * 90deg));\n }\n `;\n});\n\nStyledFilterButton.defaultProps = defaultThemeProp;\n\nexport const StyledSearchSummaryItem = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => css`\n column-gap: calc(${spacing} * 1);\n\n + ${StyledSearchInput} {\n margin-block-start: calc(${spacing} * 1);\n }\n `\n);\n\nStyledSearchSummaryItem.defaultProps = defaultThemeProp;\n\nexport const StyledFilters = styled.div(({ theme }) => {\n return css`\n position: sticky;\n top: var(--appshell-offset, 0);\n max-height: calc(100vh - var(--appshell-offset, 0rem));\n overflow: auto;\n > ${StyledFilter}, ${StyledSearchSummaryItem} {\n border-bottom: 0.0125rem solid ${theme.base.palette['border-line']};\n padding: calc(${theme.base.spacing} * 2);\n }\n `;\n});\n\nStyledFilters.defaultProps = defaultThemeProp;\n\nexport const StyledResults = styled.div(({ theme }) => {\n return css`\n background-color: ${theme.base.palette['primary-background']};\n padding: calc(${theme.base.spacing} * 2);\n position: relative;\n min-height: calc(100vh - var(--appshell-offset, 0rem));\n `;\n});\n\nStyledResults.defaultProps = defaultThemeProp;\n"]}
@@ -63,6 +63,8 @@ export interface SearchResultProps {
63
63
  description?: string;
64
64
  /** A list of elements to be rendered within a MetaList categorizing the result. */
65
65
  meta?: MetaListProps['items'];
66
+ /** Accents the search results with text that matches the regex */
67
+ accent?: RegExp;
66
68
  }
67
69
  interface BaseFilterEvent {
68
70
  name: string;
@@ -89,6 +91,8 @@ export interface SearchResultsProps extends NoChildrenProp {
89
91
  onClearFilter?: (name: BaseFilterProps['name']) => void;
90
92
  /** Callback that will render a Show more button at the bottom of the results and is fired when that button is clicked. */
91
93
  onShowMore?: () => void;
94
+ /** Sets a loading indicator if true */
95
+ loading?: boolean;
92
96
  /** A ref for the wrapping element. */
93
97
  ref?: Ref<HTMLDivElement>;
94
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SearchResults.types.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EACL,SAAS,EACT,aAAa,EACb,cAAc,EACd,UAAU,EACV,eAAe,EACf,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC,UAAU,eAAe;IACvB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,oCAAoC;IACpC,EAAE,EAAE,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,uCAAuC;IACvC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IAChC,wDAAwD;IACxD,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACpC,kFAAkF;IAClF,IAAI,EAAE,WAAW,CAAC,eAAe,CAAC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,eAAe;IACjD,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,qBAAqB,CAAC;CAC9B;AAGD,oBAAY,WAAW,GAAG,iBAAiB,CAAC;AAE5C,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,qDAAqD;IACrD,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,wCAAwC;IACxC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,iEAAiE;IACjE,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC/C,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,+EAA+E;IAC/E,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IACxD,0HAA0H;IAC1H,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,sCAAsC;IACtC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
1
+ {"version":3,"file":"SearchResults.types.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EACL,SAAS,EACT,aAAa,EACb,cAAc,EACd,UAAU,EACV,eAAe,EACf,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC,UAAU,eAAe;IACvB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,oCAAoC;IACpC,EAAE,EAAE,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,uCAAuC;IACvC,KAA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AAC;IACrB,mFAAmF;IACnF,IAAI,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9B,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AACD,UAAU,iBAAkB,SAAQ,eAAe;IACjD,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,qBAAqB,CAAC;CAC9B;AAGD,oBAAY,WAAW,GAAG,iBAAiB,CAAC;AAE5C,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,qDAAqD;IACrD,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,wCAAwC;IACxC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,iEAAiE;IACjE,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC/C,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,+EAA+E;IAC/E,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IACxD,0HAA0H;IAC1H,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sCAAsC;IACtC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"SearchResults.types.js","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Ref } from 'react';\n\nimport {\n LinkProps,\n MetaListProps,\n NoChildrenProp,\n OmitStrict,\n RadioCheckProps,\n SearchInputProps\n} from '@pega/cosmos-react-core';\n\ninterface BaseFilterProps {\n /** The name of the filter. */\n name: string;\n /**\n * Determines if the filter will start in an expanded state.\n * @default true\n */\n expanded?: boolean;\n}\n\nexport interface SelectFilterItemProps {\n /** The id for the filter option. */\n id: NonNullable<RadioCheckProps['id']>;\n /** The label for the filter option. */\n label: RadioCheckProps['label'];\n /** Determines if the filter option is active or not. */\n checked: RadioCheckProps['checked'];\n /** The name for the filter item that will show in the selected filters section */\n name: NonNullable<RadioCheckProps['name']>;\n}\n\nexport interface SelectFilterProps extends BaseFilterProps {\n /** Internal prop designating this object as a select filter. */\n type: 'select';\n /** The set of options for the filter. */\n items: SelectFilterItemProps[];\n /**\n * Determines if the filter will render as a RadioButtonGroup or CheckboxGroup.\n * @default \"multi-select\"\n */\n selectType?: 'single-select' | 'multi-select';\n}\n\nexport interface ActiveSelectFilter {\n id: SelectFilterItemProps['id'];\n name: SelectFilterItemProps['name'];\n resetValue: SelectFilterItemProps & { checked: false };\n groupName: SelectFilterProps['name'];\n type: SelectFilterProps['type'];\n}\n\nexport interface TextFilterProps extends BaseFilterProps {\n /** Internal prop designating this object as a text filter. */\n type: 'text';\n /** The value of the filter. */\n value?: string;\n /**\n * Placeholder text. The default value is a locale translation of 'Search…'\n * @default \"Search…\"\n */\n placeholder?: string;\n}\n\n// For use later: export type FilterProps = TextFilterProps | SelectFilterProps;\nexport type FilterProps = SelectFilterProps;\n\nexport type ActiveFilters = ActiveSelectFilter;\n\nexport interface SearchResultProps {\n /** The id of the search result to be displayed. */\n id: string;\n /** The title of the search result. */\n title: string;\n /** LinkProps to be passed to . */\n link: OmitStrict<LinkProps, 'children' | 'variant' | 'icon'>;\n /** A description for the search result. */\n description?: string;\n /** A list of elements to be rendered within a MetaList categorizing the result. */\n meta?: MetaListProps['items'];\n}\n\ninterface BaseFilterEvent {\n name: string;\n}\ninterface SelectFilterEvent extends BaseFilterEvent {\n type: 'select';\n value: SelectFilterItemProps;\n}\n\n// For use later: export type FilterEvent = SelectFilterEvent | TextFilterEvent;\nexport type FilterEvent = SelectFilterEvent;\n\nexport interface SearchResultsProps extends NoChildrenProp {\n /** A set of results to render for a given search. */\n results: SearchResultProps[];\n /** Props related to the SearchInput. */\n searchInputProps: SearchInputProps;\n /** The number of total results related to a given search. */\n count: number;\n /** A set of filters and their current states for a given search. */\n filters: FilterProps[];\n /** Callback that is fired when the value of a filter changes. */\n onFilterChange?: (filter: FilterEvent) => void;\n /** Callback that is fired when the Clear all button is clicked. */\n onClearAllFilters?: () => void;\n /** Callback that is fired when the Clear button is clicked within a filter. */\n onClearFilter?: (name: BaseFilterProps['name']) => void;\n /** Callback that will render a Show more button at the bottom of the results and is fired when that button is clicked. */\n onShowMore?: () => void;\n /** A ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
1
+ {"version":3,"file":"SearchResults.types.js","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Ref } from 'react';\n\nimport {\n LinkProps,\n MetaListProps,\n NoChildrenProp,\n OmitStrict,\n RadioCheckProps,\n SearchInputProps\n} from '@pega/cosmos-react-core';\n\ninterface BaseFilterProps {\n /** The name of the filter. */\n name: string;\n /**\n * Determines if the filter will start in an expanded state.\n * @default true\n */\n expanded?: boolean;\n}\n\nexport interface SelectFilterItemProps {\n /** The id for the filter option. */\n id: NonNullable<RadioCheckProps['id']>;\n /** The label for the filter option. */\n label: RadioCheckProps['label'];\n /** Determines if the filter option is active or not. */\n checked: RadioCheckProps['checked'];\n /** The name for the filter item that will show in the selected filters section */\n name: NonNullable<RadioCheckProps['name']>;\n}\n\nexport interface SelectFilterProps extends BaseFilterProps {\n /** Internal prop designating this object as a select filter. */\n type: 'select';\n /** The set of options for the filter. */\n items: SelectFilterItemProps[];\n /**\n * Determines if the filter will render as a RadioButtonGroup or CheckboxGroup.\n * @default \"multi-select\"\n */\n selectType?: 'single-select' | 'multi-select';\n}\n\nexport interface ActiveSelectFilter {\n id: SelectFilterItemProps['id'];\n name: SelectFilterItemProps['name'];\n resetValue: SelectFilterItemProps & { checked: false };\n groupName: SelectFilterProps['name'];\n type: SelectFilterProps['type'];\n}\n\nexport interface TextFilterProps extends BaseFilterProps {\n /** Internal prop designating this object as a text filter. */\n type: 'text';\n /** The value of the filter. */\n value?: string;\n /**\n * Placeholder text. The default value is a locale translation of 'Search…'\n * @default \"Search…\"\n */\n placeholder?: string;\n}\n\n// For use later: export type FilterProps = TextFilterProps | SelectFilterProps;\nexport type FilterProps = SelectFilterProps;\n\nexport type ActiveFilters = ActiveSelectFilter;\n\nexport interface SearchResultProps {\n /** The id of the search result to be displayed. */\n id: string;\n /** The title of the search result. */\n title: string;\n /** LinkProps to be passed to . */\n link: OmitStrict<LinkProps, 'children' | 'variant' | 'icon'>;\n /** A description for the search result. */\n description?: string;\n /** A list of elements to be rendered within a MetaList categorizing the result. */\n meta?: MetaListProps['items'];\n /** Accents the search results with text that matches the regex */\n accent?: RegExp;\n}\n\ninterface BaseFilterEvent {\n name: string;\n}\ninterface SelectFilterEvent extends BaseFilterEvent {\n type: 'select';\n value: SelectFilterItemProps;\n}\n\n// For use later: export type FilterEvent = SelectFilterEvent | TextFilterEvent;\nexport type FilterEvent = SelectFilterEvent;\n\nexport interface SearchResultsProps extends NoChildrenProp {\n /** A set of results to render for a given search. */\n results: SearchResultProps[];\n /** Props related to the SearchInput. */\n searchInputProps: SearchInputProps;\n /** The number of total results related to a given search. */\n count: number;\n /** A set of filters and their current states for a given search. */\n filters: FilterProps[];\n /** Callback that is fired when the value of a filter changes. */\n onFilterChange?: (filter: FilterEvent) => void;\n /** Callback that is fired when the Clear all button is clicked. */\n onClearAllFilters?: () => void;\n /** Callback that is fired when the Clear button is clicked within a filter. */\n onClearFilter?: (name: BaseFilterProps['name']) => void;\n /** Callback that will render a Show more button at the bottom of the results and is fired when that button is clicked. */\n onShowMore?: () => void;\n /** Sets a loading indicator if true */\n loading?: boolean;\n /** A ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { Action } from '@pega/cosmos-react-core';
3
+ import { StageProps } from './Stages.types';
4
+ export interface StageGlimpseProps {
5
+ stage: StageProps;
6
+ actions?: Action[];
7
+ }
8
+ declare const StageGlimpse: FunctionComponent<StageGlimpseProps>;
9
+ export default StageGlimpse;
10
+ //# sourceMappingURL=StageGlimpse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StageGlimpse.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/StageGlimpse.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,MAAM,EAA8C,MAAM,yBAAyB,CAAC;AAG7F,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAU5C,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CA6BtD,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Actions, Flex, registerIcon, Text, useI18n } from '@pega/cosmos-react-core';
3
+ import * as checkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/check.icon';
4
+ import { StyledDateTimeDisplay, StyledStep, StyledStepsContainer, StyledStageGlimpse } from './Stages.styles';
5
+ registerIcon(checkIcon);
6
+ const StageGlimpse = ({ stage, actions }) => {
7
+ const t = useI18n();
8
+ return (_jsxs(_Fragment, { children: [_jsxs(Flex, { as: StyledStageGlimpse, container: { justify: 'between', alignItems: 'start' }, children: [_jsxs("div", { children: [_jsx(Text, { variant: 'h2', children: stage.name }), stage.date ? (_jsx(StyledDateTimeDisplay, { value: stage.date, variant: 'relative', format: 'short' })) : (_jsx(Text, { variant: 'secondary', children: t('not_started') }))] }), actions && actions.length > 0 && _jsx(Actions, { items: actions, iconOnly: true })] }), stage.steps && (_jsx(StyledStepsContainer, { children: stage.steps.map(({ id, name, completed }) => (_jsx(Flex, { as: StyledStep, container: { gap: 0.5 }, completed: completed, children: _jsx("div", { children: name }) }, id))) }))] }));
9
+ };
10
+ export default StageGlimpse;
11
+ //# sourceMappingURL=StageGlimpse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StageGlimpse.js","sourceRoot":"","sources":["../../../src/components/Stages/StageGlimpse.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAU,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC7F,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAG1F,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,CAAC,SAAS,CAAC,CAAC;AAOxB,MAAM,YAAY,GAAyC,CAAC,EAC1D,KAAK,EACL,OAAO,EACW,EAAE,EAAE;IACtB,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,OAAO,CACL,8BACE,MAAC,IAAI,IAAC,EAAE,EAAE,kBAAkB,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,aAClF,0BACE,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,KAAK,CAAC,IAAI,GAAQ,EACrC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CACZ,KAAC,qBAAqB,IAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAC,UAAU,EAAC,MAAM,EAAC,OAAO,GAAG,CAC/E,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,OAAO,EAAC,WAAW,YAAE,CAAC,CAAC,aAAa,CAAC,GAAQ,CACpD,IACG,EACL,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAG,IACjE,EACN,KAAK,CAAC,KAAK,IAAI,CACd,KAAC,oBAAoB,cAClB,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAC5C,KAAC,IAAI,IAAC,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAW,SAAS,EAAE,SAAS,YAC1E,wBAAM,IAAI,GAAO,IADiC,EAAE,CAE/C,CACR,CAAC,GACmB,CACxB,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { FunctionComponent } from 'react';\n\nimport { Action, Actions, Flex, registerIcon, Text, useI18n } from '@pega/cosmos-react-core';\nimport * as checkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/check.icon';\n\nimport { StageProps } from './Stages.types';\nimport {\n StyledDateTimeDisplay,\n StyledStep,\n StyledStepsContainer,\n StyledStageGlimpse\n} from './Stages.styles';\n\nregisterIcon(checkIcon);\n\nexport interface StageGlimpseProps {\n stage: StageProps;\n actions?: Action[];\n}\n\nconst StageGlimpse: FunctionComponent<StageGlimpseProps> = ({\n stage,\n actions\n}: StageGlimpseProps) => {\n const t = useI18n();\n return (\n <>\n <Flex as={StyledStageGlimpse} container={{ justify: 'between', alignItems: 'start' }}>\n <div>\n <Text variant='h2'>{stage.name}</Text>\n {stage.date ? (\n <StyledDateTimeDisplay value={stage.date} variant='relative' format='short' />\n ) : (\n <Text variant='secondary'>{t('not_started')}</Text>\n )}\n </div>\n {actions && actions.length > 0 && <Actions items={actions} iconOnly />}\n </Flex>\n {stage.steps && (\n <StyledStepsContainer>\n {stage.steps.map(({ id, name, completed }) => (\n <Flex as={StyledStep} container={{ gap: 0.5 }} key={id} completed={completed}>\n <div>{name}</div>\n </Flex>\n ))}\n </StyledStepsContainer>\n )}\n </>\n );\n};\n\nexport default StageGlimpse;\n"]}
@@ -1,6 +1,6 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  import { ForwardProps } from '@pega/cosmos-react-core';
3
- import { StagesProps } from './Stages.types';
3
+ import type { StagesProps } from './Stages.types';
4
4
  declare const Stages: FunctionComponent<StagesProps & ForwardProps>;
5
5
  export default Stages;
6
6
  //# sourceMappingURL=Stages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Stages.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAwD,MAAM,OAAO,CAAC;AAGhG,OAAO,EAIL,YAAY,EAab,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAM7C,QAAA,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,GAAG,YAAY,CAwMzD,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Stages.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAQlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAIL,YAAY,EAiBb,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAYlD,QAAA,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,GAAG,YAAY,CAiMzD,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,129 +1,122 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState, useRef, useEffect, useContext, useCallback } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useRef, useEffect, forwardRef, Fragment } from 'react';
3
3
  import { remToPx } from 'polished';
4
- import { Icon, registerIcon, Flex, useElement, useOuterEvent, Popover, useI18n, Button, ModalManagerContext, Modal, getFocusables, useBreakpoint, debounce, useTheme } from '@pega/cosmos-react-core';
4
+ import { Icon, registerIcon, Flex, useElement, useOuterEvent, useI18n, Button, Modal, useBreakpoint, debounce, useModalManager, useTheme, useEscape, useConsolidatedRef, CardFooter, Card, useUID, Progress } from '@pega/cosmos-react-core';
5
5
  import * as checkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/check.icon';
6
- import StepsContainer from './StepsContainer';
7
- import { StyledInnerStage, StyledStage, StyledStagePopover, StyledStages } from './Stages.styles';
8
- registerIcon(checkIcon);
9
- const Stages = (props) => {
10
- const { current, stages, caseTitle, ...restProps } = props;
6
+ import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
7
+ import StageGlimpse from './StageGlimpse';
8
+ import { StyledInnerStage, StyledPopoverContent, StyledStage, StyledStagePopover, StyledStages } from './Stages.styles';
9
+ registerIcon(checkIcon, timesIcon);
10
+ const Stages = forwardRef(({ current, stages, caseTitle, onLoadStage, ...restProps }, ref) => {
11
11
  const t = useI18n();
12
- const [stagesEl, setStagesEl] = useElement();
13
- const [currentStageNameEl, setCurrentStageNameEl] = useElement();
14
- const [currentStageButtonEl, setCurrentStageButtonEl] = useElement();
15
- const [activeStageIndex, setActiveStageIndex] = useState(0);
16
- const activeStageObj = stages[activeStageIndex];
17
- const stagesRefs = useRef([]);
18
- const activeStageEl = stagesRefs.current[activeStageIndex];
19
- const { create } = useContext(ModalManagerContext);
12
+ const stagesRef = useConsolidatedRef(ref);
13
+ const currentStageRef = useRef(null);
14
+ const [focusedStageIndex, setFocusedStageIndex] = useState(undefined);
15
+ const focusedStageRef = useRef(null);
16
+ const { create: createModal } = useModalManager();
17
+ const modalMethods = useRef();
20
18
  const [popoverEl, setPopoverRef] = useElement();
21
19
  const [showPopover, setShowPopover] = useState(false);
22
- const popoverContentRef = useRef(null);
23
20
  const isSmallOrAbove = useBreakpoint('sm');
24
- const focusableElements = getFocusables(popoverContentRef);
25
21
  const [compressedView, setCompressedView] = useState(false);
26
22
  const [minExpandedWidth, setMinExpandedWidth] = useState(0);
27
- const resizeObserver = new ResizeObserver(debounce((entries) => {
28
- if (entries[0].contentRect.width > minExpandedWidth)
29
- setCompressedView(false);
30
- }, 100));
31
- const theme = useTheme();
32
- const intersectionObserver = new IntersectionObserver(entries => {
33
- if (entries[0].intersectionRatio < 1) {
34
- if (stagesEl)
35
- setMinExpandedWidth(Math.max(minExpandedWidth, stagesEl.offsetWidth + 1));
36
- setCompressedView(true);
37
- }
38
- }, { root: currentStageButtonEl, rootMargin: `0px -${remToPx(theme.base.spacing)}`, threshold: 1 });
23
+ const { base: { spacing: themeSpacing } } = useTheme();
24
+ const popoverId = useUID();
39
25
  useEffect(() => {
40
- if (stagesEl && currentStageNameEl) {
41
- intersectionObserver.observe(currentStageNameEl);
42
- resizeObserver.observe(stagesEl);
43
- return () => {
44
- intersectionObserver.disconnect();
45
- resizeObserver.disconnect();
46
- };
47
- }
48
- }, [stagesEl, currentStageNameEl, compressedView]);
49
- useOuterEvent('mousedown', [popoverEl, activeStageEl], e => {
50
- if (showPopover) {
51
- setShowPopover(false);
52
- e.preventDefault();
53
- }
54
- });
55
- const onMouseDown = (ev) => {
56
- if (!showPopover)
57
- ev.preventDefault();
58
- };
59
- const onKeyDown = useCallback(({ key }) => {
60
- if (key === 'Escape') {
61
- setShowPopover(false);
62
- activeStageEl?.focus();
63
- }
64
- }, [activeStageEl]);
65
- const onKeyDownPopover = useCallback((event) => {
66
- if (event.key === 'Tab' && event.shiftKey) {
67
- const firstFocusable = focusableElements[0];
68
- if (document.activeElement === firstFocusable) {
69
- stagesRefs.current[activeStageIndex + 1]?.focus();
70
- setShowPopover(false);
71
- }
72
- }
73
- if (event.key === 'Tab' && !event.shiftKey) {
74
- const lastFocusable = focusableElements[focusableElements.length - 1];
75
- if (document.activeElement === lastFocusable) {
76
- activeStageEl?.focus();
77
- setShowPopover(false);
26
+ if (stagesRef.current && currentStageRef.current) {
27
+ if (compressedView) {
28
+ const resizeObserver = new ResizeObserver(debounce((entries) => {
29
+ if (entries[0].contentRect.width > minExpandedWidth)
30
+ setCompressedView(false);
31
+ }, 100));
32
+ resizeObserver.observe(stagesRef.current);
33
+ return () => resizeObserver.disconnect();
78
34
  }
35
+ const intersectionObserver = new IntersectionObserver(entries => {
36
+ if (entries[0].intersectionRatio < 1) {
37
+ if (stagesRef.current)
38
+ setMinExpandedWidth(Math.max(minExpandedWidth, stagesRef.current.offsetWidth + 1));
39
+ setCompressedView(true);
40
+ }
41
+ }, {
42
+ root: currentStageRef.current,
43
+ rootMargin: `0px -${remToPx(themeSpacing)}`,
44
+ threshold: 1
45
+ });
46
+ intersectionObserver.observe(currentStageRef.current.children[0]);
47
+ return () => intersectionObserver.disconnect();
79
48
  }
80
- }, [activeStageEl, focusableElements, activeStageIndex]);
81
- useEffect(() => {
82
- document.addEventListener('keydown', onKeyDown);
83
- return () => {
84
- document.removeEventListener('keydown', onKeyDown);
85
- };
86
- }, [onKeyDown]);
87
- useEffect(() => {
88
- if (focusableElements.length)
89
- focusableElements[0].focus();
90
- }, [popoverEl]);
91
- const [requestDismiss, setRequestDismiss] = useState(false);
92
- useEffect(() => {
93
- if (requestDismiss) {
94
- setShowPopover(false);
95
- activeStageEl?.focus();
96
- setRequestDismiss(false);
97
- }
98
- }, [activeStageEl, requestDismiss]);
99
- const RenderModal = ({ heading = t('lifecycle', [caseTitle || 'Case']) }) => {
100
- return (_jsx(Modal, { ...restProps, heading: heading, onRequestDismiss: () => setRequestDismiss(true), children: stages.map((stage, id) => (_jsx(StepsContainer, { currentStage: [stage] }, id.toString()))) }, void 0));
101
- };
49
+ }, [themeSpacing, minExpandedWidth, compressedView]);
50
+ useOuterEvent('mousedown', [popoverEl, focusedStageRef], () => {
51
+ setShowPopover(false);
52
+ });
53
+ useEscape(() => {
54
+ setShowPopover(false);
55
+ focusedStageRef.current?.focus();
56
+ }, stagesRef);
57
+ const stagesToLoad = onLoadStage
58
+ ? stages.filter(stage => !Array.isArray(stage.steps)).map(stage => stage.id)
59
+ : [];
102
60
  const openModal = () => {
103
61
  setShowPopover(false);
104
- create(RenderModal);
62
+ if (stagesToLoad.length > 0)
63
+ onLoadStage?.(stagesToLoad);
64
+ modalMethods.current = createModal(Modal, {
65
+ heading: caseTitle
66
+ ? t('stages_case_lifecycle', [caseTitle])
67
+ : t('stages_default_case_lifecycle'),
68
+ progress: stagesToLoad.length > 0,
69
+ children: stages.map(stage => _jsx(StageGlimpse, { stage: stage }, stage.id)),
70
+ onAfterClose: () => {
71
+ focusedStageRef.current?.focus();
72
+ modalMethods.current = undefined;
73
+ }
74
+ });
105
75
  };
106
- const isCurrent = (stageId) => current === stageId;
107
- return (_jsxs(_Fragment, { children: [_jsx(Flex, { container: true, as: StyledStages, ref: setStagesEl, ...restProps, children: stages.map((stage, index) => (_jsxs(Flex, { container: { justify: 'center', alignItems: 'center' }, as: StyledStage, item: { grow: compressedView && !isCurrent(stage.id) ? 0 : 1, shrink: 1 }, "aria-current": isCurrent(stage.id) ? 'step' : undefined, "aria-label": `Stage ${stage.name}`, ref: (el) => {
108
- stagesRefs.current[index] = el;
109
- if (isCurrent(stage.id))
110
- setCurrentStageButtonEl(el);
111
- }, onMouseDown: onMouseDown, onClick: () => {
112
- setActiveStageIndex(index);
113
- if (isSmallOrAbove) {
114
- setShowPopover(!showPopover);
115
- }
116
- else {
117
- openModal();
118
- }
119
- }, children: [stage.complete && _jsx(Icon, { name: 'check' }, void 0), !(stage.complete && compressedView) && (_jsx(StyledInnerStage, { ref: isCurrent(stage.id) ? setCurrentStageNameEl : undefined, ellipsis: isCurrent(stage.id) && compressedView, children: !isCurrent(stage.id) && compressedView ? index + 1 : stage.name }, void 0))] }, `stage-${stage.id}`))) }, void 0), _jsx(Flex, { ref: popoverContentRef, children: _jsxs(Popover, { as: StyledStagePopover, show: showPopover && isSmallOrAbove, target: stagesRefs.current[activeStageIndex], id: 'id', ref: setPopoverRef, arrow: true, placement: 'bottom-start', onKeyDown: onKeyDownPopover, modifiers: [
120
- {
121
- name: 'flip',
122
- options: {
123
- fallbackPlacements: ['bottom-end', 'right', 'left']
76
+ useEffect(() => {
77
+ modalMethods.current?.update({
78
+ progress: stagesToLoad.length > 0,
79
+ children: stages.map(stage => _jsx(StageGlimpse, { stage: stage }, stage.id))
80
+ });
81
+ }, [stagesToLoad.length]);
82
+ return (_jsx(Flex, { ...restProps, container: true, as: StyledStages, ref: stagesRef, role: 'region', "aria-label": t('stages_label'), children: stages.map((stage, index) => {
83
+ const isCurrent = stage.id === current;
84
+ let stageStatusText = t(stage.completed ? 'completed' : 'not_started');
85
+ if (isCurrent)
86
+ stageStatusText = t('current');
87
+ const hasToLoad = stagesToLoad.includes(stage.id);
88
+ return (_jsxs(Fragment, { children: [_jsxs(Flex, { container: { justify: 'center', alignItems: 'center' }, as: StyledStage, item: { grow: compressedView && !isCurrent ? 0 : 1, shrink: 1 }, "aria-current": isCurrent ? 'step' : undefined, "aria-label": t('stages_stage_label', [stage.name, stageStatusText]), ref: isCurrent ? currentStageRef : undefined, onClick: () => {
89
+ if (isSmallOrAbove) {
90
+ if (hasToLoad)
91
+ onLoadStage?.([stage.id]);
92
+ setShowPopover(prevShowPopover => !prevShowPopover);
93
+ }
94
+ else {
95
+ openModal();
96
+ }
97
+ }, onFocus: (e) => {
98
+ setShowPopover(false);
99
+ setFocusedStageIndex(index);
100
+ focusedStageRef.current = e.currentTarget;
101
+ }, "aria-expanded": showPopover && isSmallOrAbove, "aria-controls": showPopover ? popoverId : undefined, children: [stage.completed && _jsx(Icon, { name: 'check' }), !(stage.completed && compressedView) && (_jsx(StyledInnerStage, { ellipsis: isCurrent && compressedView, children: !isCurrent && compressedView ? index + 1 : stage.name }))] }), focusedStageIndex === index && showPopover && isSmallOrAbove && (_jsx(StyledStagePopover, { target: focusedStageRef.current, ref: setPopoverRef, arrow: true, placement: 'bottom-start', modifiers: [
102
+ {
103
+ name: 'flip',
104
+ options: {
105
+ fallbackPlacements: ['bottom-end', 'right', 'left']
106
+ }
124
107
  }
125
- }
126
- ], children: [_jsx(StepsContainer, { currentStage: [activeStageObj] }, void 0), _jsx(Button, { variant: 'secondary', onClick: openModal, children: t('stage_see_full_lifecycle') }, void 0)] }, void 0) }, void 0)] }, void 0));
127
- };
108
+ ], id: popoverId, "aria-busy": hasToLoad, children: _jsxs(Card, { children: [_jsx(StyledPopoverContent, { children: !hasToLoad ? (_jsx(StageGlimpse, { stage: stage, actions: [
109
+ {
110
+ id: 'close',
111
+ text: t('close'),
112
+ icon: 'times',
113
+ onClick: () => {
114
+ setShowPopover(false);
115
+ focusedStageRef.current?.focus();
116
+ }
117
+ }
118
+ ] })) : (_jsx(Progress, { placement: 'local', message: t('loading') })) }), _jsx(CardFooter, { children: _jsx(Button, { variant: 'secondary', onClick: openModal, children: t('stages_see_full_lifecycle') }) })] }) }))] }, stage.id));
119
+ }) }));
120
+ });
128
121
  export default Stages;
129
122
  //# sourceMappingURL=Stages.js.map