@pega/cosmos-react-work 2.1.3 → 2.1.6

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 (225) hide show
  1. package/package.json +2 -2
  2. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts +0 -33
  3. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +0 -1
  4. package/lib/components/AppAnnouncement/AppAnnouncement.js +0 -91
  5. package/lib/components/AppAnnouncement/AppAnnouncement.js.map +0 -1
  6. package/lib/components/AppAnnouncement/index.d.ts +0 -3
  7. package/lib/components/AppAnnouncement/index.d.ts.map +0 -1
  8. package/lib/components/AppAnnouncement/index.js +0 -2
  9. package/lib/components/AppAnnouncement/index.js.map +0 -1
  10. package/lib/components/CaseHeader/CaseHeader.d.ts +0 -30
  11. package/lib/components/CaseHeader/CaseHeader.d.ts.map +0 -1
  12. package/lib/components/CaseHeader/CaseHeader.js +0 -119
  13. package/lib/components/CaseHeader/CaseHeader.js.map +0 -1
  14. package/lib/components/CaseHeader/index.d.ts +0 -4
  15. package/lib/components/CaseHeader/index.d.ts.map +0 -1
  16. package/lib/components/CaseHeader/index.js +0 -3
  17. package/lib/components/CaseHeader/index.js.map +0 -1
  18. package/lib/components/CasePreview/CasePreview.d.ts +0 -22
  19. package/lib/components/CasePreview/CasePreview.d.ts.map +0 -1
  20. package/lib/components/CasePreview/CasePreview.js +0 -80
  21. package/lib/components/CasePreview/CasePreview.js.map +0 -1
  22. package/lib/components/CasePreview/index.d.ts +0 -3
  23. package/lib/components/CasePreview/index.d.ts.map +0 -1
  24. package/lib/components/CasePreview/index.js +0 -2
  25. package/lib/components/CasePreview/index.js.map +0 -1
  26. package/lib/components/CaseSummary/CaseSummary.d.ts +0 -36
  27. package/lib/components/CaseSummary/CaseSummary.d.ts.map +0 -1
  28. package/lib/components/CaseSummary/CaseSummary.js +0 -130
  29. package/lib/components/CaseSummary/CaseSummary.js.map +0 -1
  30. package/lib/components/CaseSummary/index.d.ts +0 -4
  31. package/lib/components/CaseSummary/index.d.ts.map +0 -1
  32. package/lib/components/CaseSummary/index.js +0 -3
  33. package/lib/components/CaseSummary/index.js.map +0 -1
  34. package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts +0 -22
  35. package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts.map +0 -1
  36. package/lib/components/CaseSummaryFields/CaseSummaryFields.js +0 -25
  37. package/lib/components/CaseSummaryFields/CaseSummaryFields.js.map +0 -1
  38. package/lib/components/CaseSummaryFields/index.d.ts +0 -4
  39. package/lib/components/CaseSummaryFields/index.d.ts.map +0 -1
  40. package/lib/components/CaseSummaryFields/index.js +0 -3
  41. package/lib/components/CaseSummaryFields/index.js.map +0 -1
  42. package/lib/components/CaseView/CaseView.d.ts +0 -31
  43. package/lib/components/CaseView/CaseView.d.ts.map +0 -1
  44. package/lib/components/CaseView/CaseView.js +0 -259
  45. package/lib/components/CaseView/CaseView.js.map +0 -1
  46. package/lib/components/CaseView/CaseView.styles.d.ts +0 -23
  47. package/lib/components/CaseView/CaseView.styles.d.ts.map +0 -1
  48. package/lib/components/CaseView/CaseView.styles.js +0 -106
  49. package/lib/components/CaseView/CaseView.styles.js.map +0 -1
  50. package/lib/components/CaseView/MobileCaseView.d.ts +0 -13
  51. package/lib/components/CaseView/MobileCaseView.d.ts.map +0 -1
  52. package/lib/components/CaseView/MobileCaseView.js +0 -25
  53. package/lib/components/CaseView/MobileCaseView.js.map +0 -1
  54. package/lib/components/CaseView/UtilitiesSummary.d.ts +0 -12
  55. package/lib/components/CaseView/UtilitiesSummary.d.ts.map +0 -1
  56. package/lib/components/CaseView/UtilitiesSummary.js +0 -21
  57. package/lib/components/CaseView/UtilitiesSummary.js.map +0 -1
  58. package/lib/components/CaseView/index.d.ts +0 -6
  59. package/lib/components/CaseView/index.d.ts.map +0 -1
  60. package/lib/components/CaseView/index.js +0 -4
  61. package/lib/components/CaseView/index.js.map +0 -1
  62. package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts +0 -4
  63. package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts.map +0 -1
  64. package/lib/components/ConfigurableLayout/ConfigurableLayout.js +0 -93
  65. package/lib/components/ConfigurableLayout/ConfigurableLayout.js.map +0 -1
  66. package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts +0 -43
  67. package/lib/components/ConfigurableLayout/ConfigurableLayout.types.d.ts.map +0 -1
  68. package/lib/components/ConfigurableLayout/ConfigurableLayout.types.js +0 -2
  69. package/lib/components/ConfigurableLayout/ConfigurableLayout.types.js.map +0 -1
  70. package/lib/components/ConfigurableLayout/LayoutCell.d.ts +0 -6
  71. package/lib/components/ConfigurableLayout/LayoutCell.d.ts.map +0 -1
  72. package/lib/components/ConfigurableLayout/LayoutCell.js +0 -64
  73. package/lib/components/ConfigurableLayout/LayoutCell.js.map +0 -1
  74. package/lib/components/ConfigurableLayout/defaults.d.ts +0 -4
  75. package/lib/components/ConfigurableLayout/defaults.d.ts.map +0 -1
  76. package/lib/components/ConfigurableLayout/defaults.js +0 -4
  77. package/lib/components/ConfigurableLayout/defaults.js.map +0 -1
  78. package/lib/components/ConfigurableLayout/index.d.ts +0 -4
  79. package/lib/components/ConfigurableLayout/index.d.ts.map +0 -1
  80. package/lib/components/ConfigurableLayout/index.js +0 -3
  81. package/lib/components/ConfigurableLayout/index.js.map +0 -1
  82. package/lib/components/ConfigurableLayout/options.d.ts +0 -10
  83. package/lib/components/ConfigurableLayout/options.d.ts.map +0 -1
  84. package/lib/components/ConfigurableLayout/options.js +0 -10
  85. package/lib/components/ConfigurableLayout/options.js.map +0 -1
  86. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts +0 -7
  87. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts.map +0 -1
  88. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.js +0 -37
  89. package/lib/components/ConfigurableLayout/useTrackWrappedRegions.js.map +0 -1
  90. package/lib/components/Confirmation/Confirmation.d.ts +0 -19
  91. package/lib/components/Confirmation/Confirmation.d.ts.map +0 -1
  92. package/lib/components/Confirmation/Confirmation.js +0 -14
  93. package/lib/components/Confirmation/Confirmation.js.map +0 -1
  94. package/lib/components/Confirmation/index.d.ts +0 -3
  95. package/lib/components/Confirmation/index.d.ts.map +0 -1
  96. package/lib/components/Confirmation/index.js +0 -2
  97. package/lib/components/Confirmation/index.js.map +0 -1
  98. package/lib/components/Details/Details.d.ts +0 -13
  99. package/lib/components/Details/Details.d.ts.map +0 -1
  100. package/lib/components/Details/Details.js +0 -38
  101. package/lib/components/Details/Details.js.map +0 -1
  102. package/lib/components/Details/index.d.ts +0 -4
  103. package/lib/components/Details/index.d.ts.map +0 -1
  104. package/lib/components/Details/index.js +0 -3
  105. package/lib/components/Details/index.js.map +0 -1
  106. package/lib/components/Glimpse/Glimpse.d.ts +0 -20
  107. package/lib/components/Glimpse/Glimpse.d.ts.map +0 -1
  108. package/lib/components/Glimpse/Glimpse.js +0 -22
  109. package/lib/components/Glimpse/Glimpse.js.map +0 -1
  110. package/lib/components/Glimpse/index.d.ts +0 -3
  111. package/lib/components/Glimpse/index.d.ts.map +0 -1
  112. package/lib/components/Glimpse/index.js +0 -3
  113. package/lib/components/Glimpse/index.js.map +0 -1
  114. package/lib/components/SearchResults/Filter.d.ts +0 -8
  115. package/lib/components/SearchResults/Filter.d.ts.map +0 -1
  116. package/lib/components/SearchResults/Filter.js +0 -45
  117. package/lib/components/SearchResults/Filter.js.map +0 -1
  118. package/lib/components/SearchResults/SearchResult.d.ts +0 -4
  119. package/lib/components/SearchResults/SearchResult.d.ts.map +0 -1
  120. package/lib/components/SearchResults/SearchResult.js +0 -21
  121. package/lib/components/SearchResults/SearchResult.js.map +0 -1
  122. package/lib/components/SearchResults/SearchResults.d.ts +0 -6
  123. package/lib/components/SearchResults/SearchResults.d.ts.map +0 -1
  124. package/lib/components/SearchResults/SearchResults.js +0 -102
  125. package/lib/components/SearchResults/SearchResults.js.map +0 -1
  126. package/lib/components/SearchResults/SearchResults.styles.d.ts +0 -8
  127. package/lib/components/SearchResults/SearchResults.styles.d.ts.map +0 -1
  128. package/lib/components/SearchResults/SearchResults.styles.js +0 -67
  129. package/lib/components/SearchResults/SearchResults.styles.js.map +0 -1
  130. package/lib/components/SearchResults/SearchResults.types.d.ts +0 -96
  131. package/lib/components/SearchResults/SearchResults.types.d.ts.map +0 -1
  132. package/lib/components/SearchResults/SearchResults.types.js +0 -2
  133. package/lib/components/SearchResults/SearchResults.types.js.map +0 -1
  134. package/lib/components/SearchResults/index.d.ts +0 -3
  135. package/lib/components/SearchResults/index.d.ts.map +0 -1
  136. package/lib/components/SearchResults/index.js +0 -2
  137. package/lib/components/SearchResults/index.js.map +0 -1
  138. package/lib/components/Stages/Stages.d.ts +0 -6
  139. package/lib/components/Stages/Stages.d.ts.map +0 -1
  140. package/lib/components/Stages/Stages.js +0 -129
  141. package/lib/components/Stages/Stages.js.map +0 -1
  142. package/lib/components/Stages/Stages.styles.d.ts +0 -16
  143. package/lib/components/Stages/Stages.styles.d.ts.map +0 -1
  144. package/lib/components/Stages/Stages.styles.js +0 -280
  145. package/lib/components/Stages/Stages.styles.js.map +0 -1
  146. package/lib/components/Stages/Stages.types.d.ts +0 -23
  147. package/lib/components/Stages/Stages.types.d.ts.map +0 -1
  148. package/lib/components/Stages/Stages.types.js +0 -2
  149. package/lib/components/Stages/Stages.types.js.map +0 -1
  150. package/lib/components/Stages/Steps.d.ts +0 -8
  151. package/lib/components/Stages/Steps.d.ts.map +0 -1
  152. package/lib/components/Stages/Steps.js +0 -12
  153. package/lib/components/Stages/Steps.js.map +0 -1
  154. package/lib/components/Stages/StepsContainer.d.ts +0 -8
  155. package/lib/components/Stages/StepsContainer.d.ts.map +0 -1
  156. package/lib/components/Stages/StepsContainer.js +0 -11
  157. package/lib/components/Stages/StepsContainer.js.map +0 -1
  158. package/lib/components/Stages/index.d.ts +0 -3
  159. package/lib/components/Stages/index.d.ts.map +0 -1
  160. package/lib/components/Stages/index.js +0 -2
  161. package/lib/components/Stages/index.js.map +0 -1
  162. package/lib/components/Stakeholders/StakeholderForm.d.ts +0 -7
  163. package/lib/components/Stakeholders/StakeholderForm.d.ts.map +0 -1
  164. package/lib/components/Stakeholders/StakeholderForm.js +0 -49
  165. package/lib/components/Stakeholders/StakeholderForm.js.map +0 -1
  166. package/lib/components/Stakeholders/Stakeholders.d.ts +0 -6
  167. package/lib/components/Stakeholders/Stakeholders.d.ts.map +0 -1
  168. package/lib/components/Stakeholders/Stakeholders.js +0 -215
  169. package/lib/components/Stakeholders/Stakeholders.js.map +0 -1
  170. package/lib/components/Stakeholders/Stakeholders.types.d.ts +0 -83
  171. package/lib/components/Stakeholders/Stakeholders.types.d.ts.map +0 -1
  172. package/lib/components/Stakeholders/Stakeholders.types.js +0 -2
  173. package/lib/components/Stakeholders/Stakeholders.types.js.map +0 -1
  174. package/lib/components/Stakeholders/index.d.ts +0 -3
  175. package/lib/components/Stakeholders/index.d.ts.map +0 -1
  176. package/lib/components/Stakeholders/index.js +0 -2
  177. package/lib/components/Stakeholders/index.js.map +0 -1
  178. package/lib/components/Tags/Tags.d.ts +0 -34
  179. package/lib/components/Tags/Tags.d.ts.map +0 -1
  180. package/lib/components/Tags/Tags.js +0 -227
  181. package/lib/components/Tags/Tags.js.map +0 -1
  182. package/lib/components/Tags/index.d.ts +0 -2
  183. package/lib/components/Tags/index.d.ts.map +0 -1
  184. package/lib/components/Tags/index.js +0 -2
  185. package/lib/components/Tags/index.js.map +0 -1
  186. package/lib/components/Tasks/TaskList.d.ts +0 -25
  187. package/lib/components/Tasks/TaskList.d.ts.map +0 -1
  188. package/lib/components/Tasks/TaskList.js +0 -25
  189. package/lib/components/Tasks/TaskList.js.map +0 -1
  190. package/lib/components/Tasks/Tasks.d.ts +0 -22
  191. package/lib/components/Tasks/Tasks.d.ts.map +0 -1
  192. package/lib/components/Tasks/Tasks.js +0 -35
  193. package/lib/components/Tasks/Tasks.js.map +0 -1
  194. package/lib/components/Tasks/index.d.ts +0 -6
  195. package/lib/components/Tasks/index.d.ts.map +0 -1
  196. package/lib/components/Tasks/index.js +0 -3
  197. package/lib/components/Tasks/index.js.map +0 -1
  198. package/lib/components/Timeline/Timeline.d.ts +0 -6
  199. package/lib/components/Timeline/Timeline.d.ts.map +0 -1
  200. package/lib/components/Timeline/Timeline.js +0 -24
  201. package/lib/components/Timeline/Timeline.js.map +0 -1
  202. package/lib/components/Timeline/Timeline.styles.d.ts +0 -22
  203. package/lib/components/Timeline/Timeline.styles.d.ts.map +0 -1
  204. package/lib/components/Timeline/Timeline.styles.js +0 -183
  205. package/lib/components/Timeline/Timeline.styles.js.map +0 -1
  206. package/lib/components/Timeline/Timeline.types.d.ts +0 -45
  207. package/lib/components/Timeline/Timeline.types.d.ts.map +0 -1
  208. package/lib/components/Timeline/Timeline.types.js +0 -2
  209. package/lib/components/Timeline/Timeline.types.js.map +0 -1
  210. package/lib/components/Timeline/TimelineItem.d.ts +0 -13
  211. package/lib/components/Timeline/TimelineItem.d.ts.map +0 -1
  212. package/lib/components/Timeline/TimelineItem.js +0 -21
  213. package/lib/components/Timeline/TimelineItem.js.map +0 -1
  214. package/lib/components/Timeline/index.d.ts +0 -3
  215. package/lib/components/Timeline/index.d.ts.map +0 -1
  216. package/lib/components/Timeline/index.js +0 -2
  217. package/lib/components/Timeline/index.js.map +0 -1
  218. package/lib/components/Timeline/utils.d.ts +0 -14
  219. package/lib/components/Timeline/utils.d.ts.map +0 -1
  220. package/lib/components/Timeline/utils.js +0 -63
  221. package/lib/components/Timeline/utils.js.map +0 -1
  222. package/lib/index.d.ts +0 -33
  223. package/lib/index.d.ts.map +0 -1
  224. package/lib/index.js +0 -34
  225. package/lib/index.js.map +0 -1
@@ -1,102 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useContext, useRef } from 'react';
3
- import { Button, Card, CardContent, Count, Flex, Grid, Icon, registerIcon, Modal, ModalManagerContext, EmptyState, SearchInput, Selectable, Text, useI18n, useBreakpoint, useAfterInitialEffect } from '@pega/cosmos-react-core';
4
- import * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';
5
- import * as filterOnIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter-on.icon';
6
- import SearchResult from './SearchResult';
7
- import Filter from './Filter';
8
- import { StyledModalFilterContent, StyledCountText, StyledSelectedFilters, StyledSearchResults, StyledFilterTitle } from './SearchResults.styles';
9
- registerIcon(filterIcon, filterOnIcon);
10
- const FilterModal = (props) => {
11
- const { activeFilters, count, filters, onFilterChange, onClearFilter, onClearAllFilters } = props;
12
- const t = useI18n();
13
- return (_jsx(Modal, { heading: t('filters'), autoWidth: true, children: _jsxs(Grid, { as: StyledModalFilterContent, container: { rowGap: 2 }, children: [_jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, children: [_jsx(Text, { as: StyledCountText, variant: 'secondary', children: t('results_count', [count], { count }) }, void 0), onClearAllFilters && !!activeFilters.length && (_jsx(Button, { variant: 'link', onClick: onClearAllFilters, children: t('clear_all') }, void 0))] }, void 0), !!activeFilters.length && (_jsx(Flex, { as: StyledSelectedFilters, container: { gap: 1 }, children: activeFilters.map(filter => {
14
- return (_jsx(Selectable, { id: filter.id, onRemove: () => onFilterChange?.({
15
- name: filter.groupName,
16
- type: filter.type,
17
- value: filter.resetValue
18
- }), children: `${filter.groupName}: ${filter.name}` }, filter.id));
19
- }) }, void 0)), _jsx("div", { children: filters.map((filter) => {
20
- return (_jsx(Filter, { onFilterChange: onFilterChange, onClearFilter: onClearFilter, ...filter }, filter.name));
21
- }) }, void 0)] }, void 0) }, void 0));
22
- };
23
- const SearchResults = forwardRef(({ results, searchInputProps, count, filters, onFilterChange, onClearAllFilters, onClearFilter, onShowMore, ...restProps }, ref) => {
24
- const t = useI18n();
25
- const isMedium = useBreakpoint('md');
26
- const { create } = useContext(ModalManagerContext);
27
- const filtersMethods = useRef();
28
- const { placeholder = t('search_placeholder_default') } = searchInputProps;
29
- const activeFilters = filters.flatMap(group => {
30
- if (group.type === 'select') {
31
- return group.items.flatMap(item => {
32
- if (item.checked) {
33
- return {
34
- id: item.id,
35
- name: item.name,
36
- resetValue: { ...item, checked: false },
37
- groupName: group.name,
38
- type: group.type
39
- };
40
- }
41
- return [];
42
- });
43
- }
44
- return [];
45
- });
46
- const openFiltersModal = () => {
47
- filtersMethods.current = create(FilterModal, {
48
- activeFilters,
49
- count,
50
- filters,
51
- onFilterChange,
52
- onClearFilter,
53
- onClearAllFilters
54
- });
55
- };
56
- useAfterInitialEffect(() => {
57
- if (filtersMethods.current) {
58
- filtersMethods.current.update({
59
- activeFilters,
60
- count,
61
- filters
62
- });
63
- }
64
- }, [activeFilters, count, filters]);
65
- useAfterInitialEffect(() => {
66
- if (isMedium && filtersMethods.current)
67
- filtersMethods.current.dismiss();
68
- }, [isMedium]);
69
- return (_jsx(Card, { children: _jsx(CardContent, { children: _jsxs(Grid, { ...restProps, as: StyledSearchResults, ref: ref, md: filters.length
70
- ? {
71
- container: {
72
- cols: '15rem auto',
73
- areas: '"search search" "filters results"'
74
- }
75
- }
76
- : {}, s: filters.length
77
- ? {
78
- container: {
79
- cols: 'auto'
80
- }
81
- }
82
- : {}, container: { rows: '1fr auto', areas: '"search" "results"', rowGap: 2, colGap: 4 }, children: [_jsx(Grid, { item: { area: 'search' }, children: _jsx(SearchInput, { ...searchInputProps, placeholder: placeholder }, void 0) }, void 0), isMedium && !!filters.length && (_jsxs(Grid, { item: { area: 'filters', alignSelf: 'start' }, children: [_jsxs(Flex, { as: StyledFilterTitle, container: { justify: 'between' }, children: [_jsx(Text, { variant: 'h2', children: t('filters') }, void 0), onClearAllFilters && !!activeFilters.length && (_jsx(Button, { variant: 'link', onClick: onClearAllFilters, children: t('clear_all') }, void 0))] }, void 0), filters.map((filter) => {
83
- return (_jsx(Filter, { onFilterChange: onFilterChange, onClearFilter: onClearFilter, ...filter }, filter.name));
84
- })] }, void 0)), _jsxs(Grid, { item: { area: 'results' }, container: {
85
- alignItems: 'center',
86
- rowGap: 2,
87
- rows: 'auto 1fr',
88
- areas: '"meta" "items"'
89
- }, children: [_jsxs(Grid, { item: { area: 'meta' }, container: { rowGap: 1 }, children: [_jsxs(Flex, { container: { justify: 'between', alignItems: 'center' }, children: [_jsx(Text, { as: StyledCountText, variant: 'secondary', children: searchInputProps.value !== '' || results.length > 0
90
- ? t('results_count', [count], { count })
91
- : '' }, void 0), !isMedium && !!filters.length && (_jsxs(Button, { variant: 'simple', onClick: openFiltersModal, children: [_jsx(Icon, { name: activeFilters.length > 0 ? 'filter-on' : 'filter' }, void 0), "\u00A0", t('filters'), "\u00A0", _jsx(Count, { children: activeFilters.length }, void 0)] }, void 0))] }, void 0), !!activeFilters.length && (_jsx(Flex, { as: StyledSelectedFilters, container: { gap: 1 }, children: activeFilters.map(filter => {
92
- return (_jsx(Selectable, { id: filter.id, onRemove: () => onFilterChange?.({
93
- name: filter.groupName,
94
- type: filter.type,
95
- value: filter.resetValue
96
- }), children: `${filter.groupName}: ${filter.name}` }, filter.id));
97
- }) }, void 0))] }, void 0), _jsx(Grid, { item: { area: 'items', alignSelf: results.length ? 'start' : 'center' }, container: { rowGap: 4 }, children: results.length ? (results.map((result) => {
98
- return _jsx(SearchResult, { ...result }, result.id);
99
- })) : (_jsx(Grid, { item: { alignSelf: 'stretch' }, children: _jsx(EmptyState, { message: searchInputProps.value === '' ? t('empty_search') : undefined }, void 0) }, void 0)) }, void 0), onShowMore && (_jsx(Flex, { container: { justify: 'center' }, children: _jsx(Button, { variant: 'link', onClick: onShowMore, children: t('show_more') }, void 0) }, void 0))] }, void 0)] }, void 0) }, void 0) }, void 0));
100
- });
101
- export default SearchResults;
102
- //# sourceMappingURL=SearchResults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SearchResults.js","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,MAAM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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,8 +0,0 @@
1
- export declare const StyledSearchResults: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
2
- export declare const StyledFilterTitle: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
3
- export declare const StyledCountText: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
4
- export declare const StyledModalFilterContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
- export declare const StyledSelectedFilters: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
6
- export declare const StyledFilter: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
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
- //# sourceMappingURL=SearchResults.styles.d.ts.map
@@ -1 +0,0 @@
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,67 +0,0 @@
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 ``;
4
- StyledSearchResults.defaultProps = defaultThemeProp;
5
- export const StyledFilterTitle = styled.span(({ theme: { base } }) => {
6
- return css `
7
- padding-bottom: calc(2 * ${base.spacing});
8
- `;
9
- });
10
- StyledFilterTitle.defaultProps = defaultThemeProp;
11
- export const StyledCountText = styled.span(({ theme: { base } }) => {
12
- return css `
13
- font-weight: ${base['font-weight']['semi-bold']};
14
- `;
15
- });
16
- StyledCountText.defaultProps = defaultThemeProp;
17
- export const StyledModalFilterContent = styled.div(({ theme: { base: { spacing } } }) => {
18
- return css `
19
- margin-top: calc(0.25 * ${spacing});
20
- width: 25rem;
21
- `;
22
- });
23
- StyledModalFilterContent.defaultProps = defaultThemeProp;
24
- export const StyledSelectedFilters = styled.div(({ theme: { base: { spacing } } }) => {
25
- return css `
26
- overflow-x: auto;
27
- padding-bottom: calc(0.5 * ${spacing});
28
- `;
29
- });
30
- 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
- });
43
- StyledFilter.defaultProps = defaultThemeProp;
44
- export const StyledFilterButton = styled(Button)(({ theme: { base } }) => {
45
- const fontSize = calculateFontSize(base['font-size'], base['font-scale']);
46
- const { rtl } = useDirection();
47
- return css `
48
- display: inline-flex;
49
- font-size: ${fontSize.xl};
50
-
51
- ${StyledIcon} {
52
- height: 1em;
53
- width: 1em;
54
- transition: transform ${base.animation.speed} ${base.animation.timing.ease};
55
- }
56
-
57
- &[aria-expanded='true'] ${StyledIcon} {
58
- transform: rotate(0);
59
- }
60
-
61
- &[aria-expanded='false'] ${StyledIcon} {
62
- transform: rotate(calc(${rtl ? '1' : '-1'} * 90deg));
63
- }
64
- `;
65
- });
66
- StyledFilterButton.defaultProps = defaultThemeProp;
67
- //# sourceMappingURL=SearchResults.styles.js.map
@@ -1 +0,0 @@
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,EAA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IACvE,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAE1E,MAAM,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;IAC/B,OAAO,GAAG,CAAA;;iBAEK,QAAQ,CAAC,EAAE;;MAEtB,UAAU;;;8BAGc,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI;;;8BAGlD,UAAU;;;;+BAIT,UAAU;+BACV,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI;;GAE5C,CAAC;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,96 +0,0 @@
1
- import { Ref } from 'react';
2
- import { LinkProps, MetaListProps, NoChildrenProp, OmitStrict, RadioCheckProps, SearchInputProps } from '@pega/cosmos-react-core';
3
- interface BaseFilterProps {
4
- /** The name of the filter. */
5
- name: string;
6
- /**
7
- * Determines if the filter will start in an expanded state.
8
- * @default true
9
- */
10
- expanded?: boolean;
11
- }
12
- export interface SelectFilterItemProps {
13
- /** The id for the filter option. */
14
- id: NonNullable<RadioCheckProps['id']>;
15
- /** The label for the filter option. */
16
- label: RadioCheckProps['label'];
17
- /** Determines if the filter option is active or not. */
18
- checked: RadioCheckProps['checked'];
19
- /** The name for the filter item that will show in the selected filters section */
20
- name: NonNullable<RadioCheckProps['name']>;
21
- }
22
- export interface SelectFilterProps extends BaseFilterProps {
23
- /** Internal prop designating this object as a select filter. */
24
- type: 'select';
25
- /** The set of options for the filter. */
26
- items: SelectFilterItemProps[];
27
- /**
28
- * Determines if the filter will render as a RadioButtonGroup or CheckboxGroup.
29
- * @default "multi-select"
30
- */
31
- selectType?: 'single-select' | 'multi-select';
32
- }
33
- export interface ActiveSelectFilter {
34
- id: SelectFilterItemProps['id'];
35
- name: SelectFilterItemProps['name'];
36
- resetValue: SelectFilterItemProps & {
37
- checked: false;
38
- };
39
- groupName: SelectFilterProps['name'];
40
- type: SelectFilterProps['type'];
41
- }
42
- export interface TextFilterProps extends BaseFilterProps {
43
- /** Internal prop designating this object as a text filter. */
44
- type: 'text';
45
- /** The value of the filter. */
46
- value?: string;
47
- /**
48
- * Placeholder text. The default value is a locale translation of 'Search…'
49
- * @default "Search…"
50
- */
51
- placeholder?: string;
52
- }
53
- export declare type FilterProps = SelectFilterProps;
54
- export declare type ActiveFilters = ActiveSelectFilter;
55
- export interface SearchResultProps {
56
- /** The id of the search result to be displayed. */
57
- id: string;
58
- /** The title of the search result. */
59
- title: string;
60
- /** LinkProps to be passed to . */
61
- link: OmitStrict<LinkProps, 'children' | 'variant' | 'icon'>;
62
- /** A description for the search result. */
63
- description?: string;
64
- /** A list of elements to be rendered within a MetaList categorizing the result. */
65
- meta?: MetaListProps['items'];
66
- }
67
- interface BaseFilterEvent {
68
- name: string;
69
- }
70
- interface SelectFilterEvent extends BaseFilterEvent {
71
- type: 'select';
72
- value: SelectFilterItemProps;
73
- }
74
- export declare type FilterEvent = SelectFilterEvent;
75
- export interface SearchResultsProps extends NoChildrenProp {
76
- /** A set of results to render for a given search. */
77
- results: SearchResultProps[];
78
- /** Props related to the SearchInput. */
79
- searchInputProps: SearchInputProps;
80
- /** The number of total results related to a given search. */
81
- count: number;
82
- /** A set of filters and their current states for a given search. */
83
- filters: FilterProps[];
84
- /** Callback that is fired when the value of a filter changes. */
85
- onFilterChange?: (filter: FilterEvent) => void;
86
- /** Callback that is fired when the Clear all button is clicked. */
87
- onClearAllFilters?: () => void;
88
- /** Callback that is fired when the Clear button is clicked within a filter. */
89
- onClearFilter?: (name: BaseFilterProps['name']) => void;
90
- /** Callback that will render a Show more button at the bottom of the results and is fired when that button is clicked. */
91
- onShowMore?: () => void;
92
- /** A ref for the wrapping element. */
93
- ref?: Ref<HTMLDivElement>;
94
- }
95
- export {};
96
- //# sourceMappingURL=SearchResults.types.d.ts.map
@@ -1 +0,0 @@
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,MAAM,CAAC,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,gEAAgE;IAChE,IAAI,EAAE,QAAQ,CAAC;IACf,yCAAyC;IACzC,KAAK,EAAE,qBAAqB,EAAE,CAAC;IAC/B;;;OAGG;IACH,UAAU,CAAC,EAAE,eAAe,GAAG,cAAc,CAAC;CAC/C;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACpC,UAAU,EAAE,qBAAqB,GAAG;QAAE,OAAO,EAAE,KAAK,CAAA;KAAE,CAAC;IACvD,SAAS,EAAE,iBAAiB,CAAC,MAAM,C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,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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=SearchResults.types.js.map
@@ -1 +0,0 @@
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,3 +0,0 @@
1
- export { default } from './SearchResults';
2
- export { SearchResultsProps, SearchResultProps, FilterEvent } from './SearchResults.types';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { default } from './SearchResults';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SearchResults/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { default } from './SearchResults';\nexport { SearchResultsProps, SearchResultProps, FilterEvent } from './SearchResults.types';\n"]}
@@ -1,6 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- import { ForwardProps } from '@pega/cosmos-react-core';
3
- import { StagesProps } from './Stages.types';
4
- declare const Stages: FunctionComponent<StagesProps & ForwardProps>;
5
- export default Stages;
6
- //# sourceMappingURL=Stages.d.ts.map
@@ -1 +0,0 @@
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,129 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState, useRef, useEffect, useContext, useCallback } from 'react';
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';
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;
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);
20
- const [popoverEl, setPopoverRef] = useElement();
21
- const [showPopover, setShowPopover] = useState(false);
22
- const popoverContentRef = useRef(null);
23
- const isSmallOrAbove = useBreakpoint('sm');
24
- const focusableElements = getFocusables(popoverContentRef);
25
- const [compressedView, setCompressedView] = useState(false);
26
- 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 });
39
- 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);
78
- }
79
- }
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
- };
102
- const openModal = () => {
103
- setShowPopover(false);
104
- create(RenderModal);
105
- };
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']
124
- }
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
- };
128
- export default Stages;
129
- //# sourceMappingURL=Stages.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Stages.js","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,IAAI,EACJ,YAAY,E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,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC;6BACpD;yBACF;qBACF,aAED,KAAC,cAAc,IAAC,YAAY,EAAE,CAAC,cAAc,CAAC,WAAI,EAClD,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,SAAS,YAC3C,CAAC,CAAC,0BAA0B,CAAC,WACvB,YACD,WACL,YACN,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import { FunctionComponent, useState, useRef, useEffect, useContext, useCallback } from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n Icon,\n registerIcon,\n Flex,\n ForwardProps,\n useElement,\n useOuterEvent,\n Popover,\n useI18n,\n Button,\n ModalManagerContext,\n ModalProps,\n Modal,\n getFocusables,\n useBreakpoint,\n debounce,\n useTheme\n} from '@pega/cosmos-react-core';\nimport * as checkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/check.icon';\n\nimport { StagesProps } from './Stages.types';\nimport StepsContainer from './StepsContainer';\nimport { StyledInnerStage, StyledStage, StyledStagePopover, StyledStages } from './Stages.styles';\n\nregisterIcon(checkIcon);\n\nconst Stages: FunctionComponent<StagesProps & ForwardProps> = (props: StagesProps) => {\n const { current, stages, caseTitle, ...restProps } = props;\n const t = useI18n();\n\n const [stagesEl, setStagesEl] = useElement<HTMLDivElement>();\n const [currentStageNameEl, setCurrentStageNameEl] = useElement<HTMLSpanElement>();\n const [currentStageButtonEl, setCurrentStageButtonEl] = useElement<HTMLButtonElement>();\n\n const [activeStageIndex, setActiveStageIndex] = useState<number>(0);\n const activeStageObj = stages[activeStageIndex];\n const stagesRefs = useRef<HTMLElement[]>([]);\n const activeStageEl = stagesRefs.current[activeStageIndex];\n const { create } = useContext(ModalManagerContext);\n const [popoverEl, setPopoverRef] = useElement<HTMLElement>();\n const [showPopover, setShowPopover] = useState(false);\n const popoverContentRef = useRef(null);\n const isSmallOrAbove = useBreakpoint('sm');\n const focusableElements = getFocusables(popoverContentRef);\n\n const [compressedView, setCompressedView] = useState(false);\n const [minExpandedWidth, setMinExpandedWidth] = useState(0);\n\n const resizeObserver = new ResizeObserver(\n debounce((entries: ResizeObserverEntry[]) => {\n if (entries[0].contentRect.width > minExpandedWidth) setCompressedView(false);\n }, 100)\n );\n\n const theme = useTheme();\n\n const intersectionObserver = new IntersectionObserver(\n entries => {\n if (entries[0].intersectionRatio < 1) {\n if (stagesEl) setMinExpandedWidth(Math.max(minExpandedWidth, stagesEl.offsetWidth + 1));\n setCompressedView(true);\n }\n },\n { root: currentStageButtonEl, rootMargin: `0px -${remToPx(theme.base.spacing)}`, threshold: 1 }\n );\n\n useEffect(() => {\n if (stagesEl && currentStageNameEl) {\n intersectionObserver.observe(currentStageNameEl as Element);\n resizeObserver.observe(stagesEl);\n\n return () => {\n intersectionObserver.disconnect();\n resizeObserver.disconnect();\n };\n }\n }, [stagesEl, currentStageNameEl, compressedView]);\n\n useOuterEvent('mousedown', [popoverEl, activeStageEl], e => {\n if (showPopover) {\n setShowPopover(false);\n e.preventDefault();\n }\n });\n\n const onMouseDown = (ev: React.MouseEvent<HTMLElement>) => {\n if (!showPopover) ev.preventDefault();\n };\n\n const onKeyDown = useCallback(\n ({ key }: KeyboardEvent) => {\n if (key === 'Escape') {\n setShowPopover(false);\n activeStageEl?.focus();\n }\n },\n [activeStageEl]\n );\n\n const onKeyDownPopover = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'Tab' && event.shiftKey) {\n const firstFocusable = focusableElements[0];\n\n if (document.activeElement === firstFocusable) {\n stagesRefs.current[activeStageIndex + 1]?.focus();\n setShowPopover(false);\n }\n }\n\n if (event.key === 'Tab' && !event.shiftKey) {\n const lastFocusable = focusableElements[focusableElements.length - 1];\n\n if (document.activeElement === lastFocusable) {\n activeStageEl?.focus();\n setShowPopover(false);\n }\n }\n },\n [activeStageEl, focusableElements, activeStageIndex]\n );\n\n useEffect(() => {\n document.addEventListener('keydown', onKeyDown);\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n };\n }, [onKeyDown]);\n\n useEffect(() => {\n if (focusableElements.length) focusableElements[0].focus();\n }, [popoverEl]);\n\n const [requestDismiss, setRequestDismiss] = useState(false);\n\n useEffect(() => {\n if (requestDismiss) {\n setShowPopover(false);\n activeStageEl?.focus();\n setRequestDismiss(false);\n }\n }, [activeStageEl, requestDismiss]);\n\n const RenderModal = ({\n heading = t('lifecycle', [caseTitle || 'Case'])\n }: Partial<ModalProps>) => {\n return (\n <Modal {...restProps} heading={heading} onRequestDismiss={() => setRequestDismiss(true)}>\n {stages.map((stage, id) => (\n <StepsContainer currentStage={[stage]} key={id.toString()} />\n ))}\n </Modal>\n );\n };\n\n const openModal = () => {\n setShowPopover(false);\n create(RenderModal);\n };\n\n const isCurrent = (stageId: string) => current === stageId;\n\n return (\n <>\n <Flex container as={StyledStages} ref={setStagesEl} {...restProps}>\n {stages.map((stage, index) => (\n <Flex\n container={{ justify: 'center', alignItems: 'center' }}\n as={StyledStage}\n item={{ grow: compressedView && !isCurrent(stage.id) ? 0 : 1, shrink: 1 }}\n aria-current={isCurrent(stage.id) ? 'step' : undefined}\n aria-label={`Stage ${stage.name}`}\n key={`stage-${stage.id}`}\n ref={(el: HTMLButtonElement) => {\n stagesRefs.current[index] = el;\n if (isCurrent(stage.id)) setCurrentStageButtonEl(el);\n }}\n onMouseDown={onMouseDown}\n onClick={() => {\n setActiveStageIndex(index);\n if (isSmallOrAbove) {\n setShowPopover(!showPopover);\n } else {\n openModal();\n }\n }}\n >\n {stage.complete && <Icon name='check' />}\n {!(stage.complete && compressedView) && (\n <StyledInnerStage\n ref={isCurrent(stage.id) ? setCurrentStageNameEl : undefined}\n ellipsis={isCurrent(stage.id) && compressedView}\n >\n {!isCurrent(stage.id) && compressedView ? index + 1 : stage.name}\n </StyledInnerStage>\n )}\n </Flex>\n ))}\n </Flex>\n <Flex ref={popoverContentRef}>\n <Popover\n as={StyledStagePopover}\n show={showPopover && isSmallOrAbove}\n target={stagesRefs.current[activeStageIndex]}\n id='id'\n ref={setPopoverRef}\n arrow\n placement='bottom-start'\n onKeyDown={onKeyDownPopover}\n modifiers={[\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['bottom-end', 'right', 'left']\n }\n }\n ]}\n >\n <StepsContainer currentStage={[activeStageObj]} />\n <Button variant='secondary' onClick={openModal}>\n {t('stage_see_full_lifecycle')}\n </Button>\n </Popover>\n </Flex>\n </>\n );\n};\n\nexport default Stages;\n"]}
@@ -1,16 +0,0 @@
1
- export declare const StyledStages: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
2
- export declare const StyledInnerStage: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
3
- ellipsis?: boolean | undefined;
4
- }, never>;
5
- export declare const StyledStage: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
6
- export declare const StyledStagePopover: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
- export declare const StyledStepsContainer: import("styled-components").StyledComponent<"ol", import("styled-components").DefaultTheme, {}, never>;
8
- export declare const StyledStep: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {
9
- complete: boolean;
10
- }, never>;
11
- export declare const StyledSteps: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
12
- export declare const StyledInnerStep: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
13
- complete: boolean;
14
- }, never>;
15
- export declare const StyledDateTimeDisplay: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
16
- //# sourceMappingURL=Stages.styles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Stages.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.styles.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY,yGAMvB,CAAC;AAIH,eAAO,MAAM,gBAAgB;;SAW3B,CAAC;AAEH,eAAO,MAAM,WAAW,4GA4LvB,CAAC;AAIF,eAAO,MAAM,kBAAkB,yGAM7B,CAAC;AAIH,eAAO,MAAM,oBAAoB,wGAU/B,CAAC;AAIH,eAAO,MAAM,UAAU;cAAyB,OAAO;SA0BrD,CAAC;AAIH,eAAO,MAAM,WAAW,yGAGvB,CAAC;AAIF,eAAO,MAAM,eAAe;cAA2B,OAAO;SAmB5D,CAAC;AAIH,eAAO,MAAM,qBAAqB,0GAMhC,CAAC"}