@pega/cosmos-react-work 3.0.0-dev.8.0 → 3.0.0-rc.1
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.
- package/lib/components/AppAnnouncement/AppAnnouncement.d.ts +4 -0
- package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
- package/lib/components/AppAnnouncement/AppAnnouncement.js +3 -2
- package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
- package/lib/components/CasePreview/CasePreview.d.ts +2 -2
- package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
- package/lib/components/CasePreview/CasePreview.js +2 -2
- package/lib/components/CasePreview/CasePreview.js.map +1 -1
- package/lib/components/CaseView/CaseHeader.d.ts +4 -0
- package/lib/components/CaseView/CaseHeader.d.ts.map +1 -0
- package/lib/components/CaseView/CaseHeader.js +49 -0
- package/lib/components/CaseView/CaseHeader.js.map +1 -0
- package/lib/components/CaseView/CaseSummary.d.ts +4 -0
- package/lib/components/CaseView/CaseSummary.d.ts.map +1 -0
- package/lib/components/CaseView/CaseSummary.js +13 -0
- package/lib/components/CaseView/CaseSummary.js.map +1 -0
- package/lib/components/CaseView/CaseSummaryFields.d.ts +6 -0
- package/lib/components/CaseView/CaseSummaryFields.d.ts.map +1 -0
- package/lib/components/CaseView/CaseSummaryFields.js +8 -0
- package/lib/components/CaseView/CaseSummaryFields.js.map +1 -0
- package/lib/components/CaseView/CaseView.context.d.ts +5 -0
- package/lib/components/CaseView/CaseView.context.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.context.js +5 -0
- package/lib/components/CaseView/CaseView.context.js.map +1 -0
- package/lib/components/CaseView/CaseView.d.ts +2 -27
- package/lib/components/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.js +218 -190
- package/lib/components/CaseView/CaseView.js.map +1 -1
- package/lib/components/CaseView/CaseView.styles.d.ts +14 -17
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +235 -41
- package/lib/components/CaseView/CaseView.styles.js.map +1 -1
- package/lib/components/CaseView/CaseView.types.d.ts +99 -0
- package/lib/components/CaseView/CaseView.types.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.types.js +2 -0
- package/lib/components/CaseView/CaseView.types.js.map +1 -0
- package/lib/components/CaseView/UtilitiesSummary.d.ts +4 -6
- package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -1
- package/lib/components/CaseView/UtilitiesSummary.js +6 -2
- package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
- package/lib/components/CaseView/index.d.ts +5 -2
- package/lib/components/CaseView/index.d.ts.map +1 -1
- package/lib/components/CaseView/index.js +4 -1
- package/lib/components/CaseView/index.js.map +1 -1
- package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts +1 -1
- package/lib/components/ConfigurableLayout/useTrackWrappedRegions.d.ts.map +1 -1
- package/lib/components/Confirmation/Confirmation.d.ts +2 -2
- package/lib/components/Confirmation/Confirmation.d.ts.map +1 -1
- package/lib/components/Confirmation/Confirmation.js +1 -1
- package/lib/components/Confirmation/Confirmation.js.map +1 -1
- package/lib/components/Details/Details.d.ts +31 -10
- package/lib/components/Details/Details.d.ts.map +1 -1
- package/lib/components/Details/Details.js +77 -35
- package/lib/components/Details/Details.js.map +1 -1
- package/lib/components/Details/Details.styles.d.ts +47 -0
- package/lib/components/Details/Details.styles.d.ts.map +1 -0
- package/lib/components/Details/Details.styles.js +243 -0
- package/lib/components/Details/Details.styles.js.map +1 -0
- package/lib/components/Details/DetailsContext.d.ts +9 -0
- package/lib/components/Details/DetailsContext.d.ts.map +1 -0
- package/lib/components/Details/DetailsContext.js +9 -0
- package/lib/components/Details/DetailsContext.js.map +1 -0
- package/lib/components/Details/index.d.ts +2 -2
- package/lib/components/Details/index.d.ts.map +1 -1
- package/lib/components/Details/index.js +2 -1
- package/lib/components/Details/index.js.map +1 -1
- package/lib/components/SearchResults/SearchResult.d.ts +1 -1
- package/lib/components/SearchResults/SearchResult.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResult.js +9 -3
- package/lib/components/SearchResults/SearchResult.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.js +56 -37
- package/lib/components/SearchResults/SearchResults.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.styles.d.ts +3 -0
- package/lib/components/SearchResults/SearchResults.styles.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.styles.js +38 -17
- package/lib/components/SearchResults/SearchResults.styles.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.types.d.ts +4 -0
- package/lib/components/SearchResults/SearchResults.types.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.types.js.map +1 -1
- package/lib/components/Stages/StageGlimpse.d.ts +10 -0
- package/lib/components/Stages/StageGlimpse.d.ts.map +1 -0
- package/lib/components/Stages/StageGlimpse.js +11 -0
- package/lib/components/Stages/StageGlimpse.js.map +1 -0
- package/lib/components/Stages/Stages.d.ts +1 -1
- package/lib/components/Stages/Stages.d.ts.map +1 -1
- package/lib/components/Stages/Stages.js +105 -112
- package/lib/components/Stages/Stages.js.map +1 -1
- package/lib/components/Stages/Stages.styles.d.ts +5 -7
- package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
- package/lib/components/Stages/Stages.styles.js +180 -189
- package/lib/components/Stages/Stages.styles.js.map +1 -1
- package/lib/components/Stages/Stages.types.d.ts +19 -4
- package/lib/components/Stages/Stages.types.d.ts.map +1 -1
- package/lib/components/Stages/Stages.types.js.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.js +10 -4
- package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
- package/lib/components/Tags/Tags.d.ts.map +1 -1
- package/lib/components/Tags/Tags.js +23 -9
- package/lib/components/Tags/Tags.js.map +1 -1
- package/lib/components/Tasks/TaskList.d.ts +8 -5
- package/lib/components/Tasks/TaskList.d.ts.map +1 -1
- package/lib/components/Tasks/TaskList.js +12 -4
- package/lib/components/Tasks/TaskList.js.map +1 -1
- package/lib/components/Tasks/Tasks.d.ts.map +1 -1
- package/lib/components/Tasks/Tasks.js +2 -1
- package/lib/components/Tasks/Tasks.js.map +1 -1
- package/lib/components/Timeline/Timeline.styles.d.ts +1 -1
- package/lib/components/Timeline/Timeline.styles.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.styles.js +1 -0
- package/lib/components/Timeline/Timeline.styles.js.map +1 -1
- package/lib/components/Timeline/TimelineItem.d.ts.map +1 -1
- package/lib/components/Timeline/TimelineItem.js +2 -2
- package/lib/components/Timeline/TimelineItem.js.map +1 -1
- package/lib/index.d.ts +0 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -6
- package/lib/index.js.map +1 -1
- package/package.json +7 -4
- package/lib/components/CaseHeader/CaseHeader.d.ts +0 -30
- package/lib/components/CaseHeader/CaseHeader.d.ts.map +0 -1
- package/lib/components/CaseHeader/CaseHeader.js +0 -119
- package/lib/components/CaseHeader/CaseHeader.js.map +0 -1
- package/lib/components/CaseHeader/index.d.ts +0 -4
- package/lib/components/CaseHeader/index.d.ts.map +0 -1
- package/lib/components/CaseHeader/index.js +0 -3
- package/lib/components/CaseHeader/index.js.map +0 -1
- package/lib/components/CaseSummary/CaseSummary.d.ts +0 -36
- package/lib/components/CaseSummary/CaseSummary.d.ts.map +0 -1
- package/lib/components/CaseSummary/CaseSummary.js +0 -130
- package/lib/components/CaseSummary/CaseSummary.js.map +0 -1
- package/lib/components/CaseSummary/index.d.ts +0 -4
- package/lib/components/CaseSummary/index.d.ts.map +0 -1
- package/lib/components/CaseSummary/index.js +0 -3
- package/lib/components/CaseSummary/index.js.map +0 -1
- package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts +0 -22
- package/lib/components/CaseSummaryFields/CaseSummaryFields.d.ts.map +0 -1
- package/lib/components/CaseSummaryFields/CaseSummaryFields.js +0 -25
- package/lib/components/CaseSummaryFields/CaseSummaryFields.js.map +0 -1
- package/lib/components/CaseSummaryFields/index.d.ts +0 -4
- package/lib/components/CaseSummaryFields/index.d.ts.map +0 -1
- package/lib/components/CaseSummaryFields/index.js +0 -3
- package/lib/components/CaseSummaryFields/index.js.map +0 -1
- package/lib/components/Stages/Steps.d.ts +0 -8
- package/lib/components/Stages/Steps.d.ts.map +0 -1
- package/lib/components/Stages/Steps.js +0 -12
- package/lib/components/Stages/Steps.js.map +0 -1
- package/lib/components/Stages/StepsContainer.d.ts +0 -8
- package/lib/components/Stages/StepsContainer.d.ts.map +0 -1
- package/lib/components/Stages/StepsContainer.js +0 -11
- package/lib/components/Stages/StepsContainer.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetailsContext.d.ts","sourceRoot":"","sources":["../../../src/components/Details/DetailsContext.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,cAAc,8CAKlB,CAAC;AAEH,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
const DetailsContext = createContext({
|
|
3
|
+
longestLabelLength: undefined,
|
|
4
|
+
setLongestLabelLength: () => { },
|
|
5
|
+
mobileView: false,
|
|
6
|
+
depth: 1
|
|
7
|
+
});
|
|
8
|
+
export default DetailsContext;
|
|
9
|
+
//# sourceMappingURL=DetailsContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetailsContext.js","sourceRoot":"","sources":["../../../src/components/Details/DetailsContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAStC,MAAM,cAAc,GAAG,aAAa,CAAsB;IACxD,kBAAkB,EAAE,SAAS;IAC7B,qBAAqB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC/B,UAAU,EAAE,KAAK;IACjB,KAAK,EAAE,CAAC;CACT,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC","sourcesContent":["import { createContext } from 'react';\n\nexport interface DetailsContextValue {\n longestLabelLength?: number;\n setLongestLabelLength?: (val: number) => void;\n mobileView?: boolean;\n depth?: number;\n}\n\nconst DetailsContext = createContext<DetailsContextValue>({\n longestLabelLength: undefined,\n setLongestLabelLength: () => {},\n mobileView: false,\n depth: 1\n});\n\nexport default DetailsContext;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default } from './Details';
|
|
2
|
-
export {
|
|
3
|
-
export { StyledDetails,
|
|
2
|
+
export { default as DetailsContext } from './DetailsContext';
|
|
3
|
+
export { StyledFieldValueGroupLabel, StyledDetailList, StyledDetails, StyledHighlightedDetailList } from './Details.styles';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Details/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Details/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,aAAa,EACb,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default } from './Details';
|
|
2
|
-
export {
|
|
2
|
+
export { default as DetailsContext } from './DetailsContext';
|
|
3
|
+
export { StyledFieldValueGroupLabel, StyledDetailList, StyledDetails, StyledHighlightedDetailList } from './Details.styles';
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Details/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Details/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,aAAa,EACb,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC","sourcesContent":["export { default } from './Details';\nexport { default as DetailsContext } from './DetailsContext';\nexport {\n StyledFieldValueGroupLabel,\n StyledDetailList,\n StyledDetails,\n StyledHighlightedDetailList\n} from './Details.styles';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SearchResultProps } from './SearchResults.types';
|
|
2
|
-
declare const SearchResult: ({
|
|
2
|
+
declare const SearchResult: ({ title, link, description, meta, accent }: SearchResultProps) => JSX.Element;
|
|
3
3
|
export default SearchResult;
|
|
4
4
|
//# sourceMappingURL=SearchResult.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchResult.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResult.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchResult.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResult.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAyB1D,QAAA,MAAM,YAAY,+CAMf,iBAAiB,KAAG,WActB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
|
-
import { defaultThemeProp, Text, MetaList, Link, Flex, StyledPopover, calculateFontSize } from '@pega/cosmos-react-core';
|
|
3
|
+
import { defaultThemeProp, Text, MetaList, Link, Flex, StyledPopover, calculateFontSize, replaceMatchWithElement, Mark } from '@pega/cosmos-react-core';
|
|
4
4
|
const StyledSearchResult = styled.article(({ theme }) => {
|
|
5
5
|
const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
|
|
6
6
|
return css `
|
|
@@ -8,14 +8,20 @@ const StyledSearchResult = styled.article(({ theme }) => {
|
|
|
8
8
|
font-size: ${fontSize.s};
|
|
9
9
|
font-weight: ${theme.base['font-weight'].normal};
|
|
10
10
|
}
|
|
11
|
+
padding-block-end: calc(2 * ${theme.base.spacing});
|
|
12
|
+
border-bottom: 0.0125rem solid ${theme.base.palette['border-line']};
|
|
13
|
+
|
|
14
|
+
&:last-of-type {
|
|
15
|
+
border-bottom: none;
|
|
16
|
+
}
|
|
11
17
|
`;
|
|
12
18
|
});
|
|
13
19
|
StyledSearchResult.defaultProps = defaultThemeProp;
|
|
14
20
|
const StyledDescription = styled(Text) `
|
|
15
21
|
word-break: break-word;
|
|
16
22
|
`;
|
|
17
|
-
const SearchResult = ({
|
|
18
|
-
return (_jsxs(Flex, { as: StyledSearchResult, container: { direction: 'column', gap: 1 }, children: [_jsxs(Flex, { container: { direction: 'column
|
|
23
|
+
const SearchResult = ({ title, link, description, meta = [], accent }) => {
|
|
24
|
+
return (_jsxs(Flex, { as: StyledSearchResult, container: { direction: 'column', gap: 1 }, children: [_jsxs(Flex, { container: { direction: 'column' }, children: [_jsx(Text, { variant: 'h2', children: _jsx(Link, { ...link, children: accent ? replaceMatchWithElement(title, accent, match => _jsx(Mark, { children: match })) : title }) }), !!meta.length && _jsx(MetaList, { items: meta })] }), description && _jsx(StyledDescription, { forwardedAs: 'p', children: description })] }));
|
|
19
25
|
};
|
|
20
26
|
export default SearchResult;
|
|
21
27
|
//# sourceMappingURL=SearchResult.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchResult.js","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResult.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAChB,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,iBAAiB,
|
|
1
|
+
{"version":3,"file":"SearchResult.js","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResult.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAChB,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,IAAI,EACL,MAAM,yBAAyB,CAAC;AAIjC,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACtD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtF,OAAO,GAAG,CAAA;SACH,aAAa;mBACH,QAAQ,CAAC,CAAC;qBACR,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM;;kCAEnB,KAAK,CAAC,IAAI,CAAC,OAAO;qCACf,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;;;;;GAKnE,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEnD,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAErC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,EACpB,KAAK,EACL,IAAI,EACJ,WAAW,EACX,IAAI,GAAG,EAAE,EACT,MAAM,EACY,EAAe,EAAE;IACnC,OAAO,CACL,MAAC,IAAI,IAAC,EAAE,EAAE,kBAAkB,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aACtE,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,aACtC,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAChB,KAAC,IAAI,OAAK,IAAI,YACX,MAAM,CAAC,CAAC,CAAC,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,KAAC,IAAI,cAAE,KAAK,GAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,GAClF,GACF,EACN,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,KAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,GAAI,IACtC,EACN,WAAW,IAAI,KAAC,iBAAiB,IAAC,WAAW,EAAC,GAAG,YAAE,WAAW,GAAqB,IAC/E,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport {\n defaultThemeProp,\n Text,\n MetaList,\n Link,\n Flex,\n StyledPopover,\n calculateFontSize,\n replaceMatchWithElement,\n Mark\n} from '@pega/cosmos-react-core';\n\nimport { SearchResultProps } from './SearchResults.types';\n\nconst StyledSearchResult = styled.article(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n h2 ${StyledPopover} {\n font-size: ${fontSize.s};\n font-weight: ${theme.base['font-weight'].normal};\n }\n padding-block-end: calc(2 * ${theme.base.spacing});\n border-bottom: 0.0125rem solid ${theme.base.palette['border-line']};\n\n &:last-of-type {\n border-bottom: none;\n }\n `;\n});\n\nStyledSearchResult.defaultProps = defaultThemeProp;\n\nconst StyledDescription = styled(Text)`\n word-break: break-word;\n`;\n\nconst SearchResult = ({\n title,\n link,\n description,\n meta = [],\n accent\n}: SearchResultProps): JSX.Element => {\n return (\n <Flex as={StyledSearchResult} container={{ direction: 'column', gap: 1 }}>\n <Flex container={{ direction: 'column' }}>\n <Text variant='h2'>\n <Link {...link}>\n {accent ? replaceMatchWithElement(title, accent, match => <Mark>{match}</Mark>) : title}\n </Link>\n </Text>\n {!!meta.length && <MetaList items={meta} />}\n </Flex>\n {description && <StyledDescription forwardedAs='p'>{description}</StyledDescription>}\n </Flex>\n );\n};\n\nexport default SearchResult;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchResults.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"SearchResults.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAIlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAIL,YAAY,EAmBb,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EACL,kBAAkB,EAInB,MAAM,uBAAuB,CAAC;AA6E/B,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAsPvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useContext, useRef } from 'react';
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useContext, useRef, useState } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { Button, Count, Flex, Grid, Icon, registerIcon, Modal, EmptyState, SearchInput, Selectable, Text, useModalManager, useI18n, useBreakpoint, useAfterInitialEffect, SummaryItem, Avatar, useTheme, AppShellContext, Progress } from '@pega/cosmos-react-core';
|
|
4
5
|
import * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';
|
|
5
6
|
import * as filterOnIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter-on.icon';
|
|
6
7
|
import SearchResult from './SearchResult';
|
|
7
8
|
import Filter from './Filter';
|
|
8
|
-
import { StyledModalFilterContent, StyledCountText, StyledSelectedFilters, StyledSearchResults,
|
|
9
|
+
import { StyledModalFilterContent, StyledCountText, StyledSelectedFilters, StyledSearchResults, StyledResults, StyledFilters, StyledSearchSummaryItem } from './SearchResults.styles';
|
|
9
10
|
registerIcon(filterIcon, filterOnIcon);
|
|
10
11
|
const FilterModal = (props) => {
|
|
11
12
|
const { activeFilters, count, filters, onFilterChange, onClearFilter, onClearAllFilters } = props;
|
|
@@ -20,12 +21,16 @@ const FilterModal = (props) => {
|
|
|
20
21
|
return (_jsx(Filter, { onFilterChange: onFilterChange, onClearFilter: onClearFilter, ...filter }, filter.name));
|
|
21
22
|
}) })] }) }));
|
|
22
23
|
};
|
|
23
|
-
const SearchResults = forwardRef(({ results, searchInputProps, count, filters, onFilterChange, onClearAllFilters, onClearFilter, onShowMore, ...restProps }, ref) => {
|
|
24
|
+
const SearchResults = forwardRef(({ results, searchInputProps, count, filters, onFilterChange, onClearAllFilters, onClearFilter, onShowMore, loading = false, ...restProps }, ref) => {
|
|
24
25
|
const t = useI18n();
|
|
25
26
|
const isMedium = useBreakpoint('md');
|
|
26
|
-
const { create } =
|
|
27
|
+
const { create } = useModalManager();
|
|
28
|
+
const { searchContainerEl } = useContext(AppShellContext);
|
|
27
29
|
const filtersMethods = useRef();
|
|
28
30
|
const { placeholder = t('search_placeholder_default') } = searchInputProps;
|
|
31
|
+
const { base: { palette: { 'brand-primary': primary } } } = useTheme();
|
|
32
|
+
const [accent, setAccent] = useState();
|
|
33
|
+
const [submittedSearchValue, setSubmittedSearchValue] = useState(searchInputProps.value);
|
|
29
34
|
const activeFilters = filters.flatMap(group => {
|
|
30
35
|
if (group.type === 'select') {
|
|
31
36
|
return group.items.flatMap(item => {
|
|
@@ -66,37 +71,51 @@ const SearchResults = forwardRef(({ results, searchInputProps, count, filters, o
|
|
|
66
71
|
if (isMedium && filtersMethods.current)
|
|
67
72
|
filtersMethods.current.dismiss();
|
|
68
73
|
}, [isMedium]);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
74
|
+
useAfterInitialEffect(() => {
|
|
75
|
+
setAccent(submittedSearchValue ? new RegExp(submittedSearchValue, 'gi') : undefined);
|
|
76
|
+
}, [submittedSearchValue]);
|
|
77
|
+
const searchTitle = (_jsx(SummaryItem, { as: StyledSearchSummaryItem, visual: _jsx(Avatar, { icon: 'search', name: 'search', shape: 'squircle', backgroundColor: primary, color: 'white' }), primary: _jsx(Text, { variant: 'h1', children: "Search" }), actions: onClearAllFilters &&
|
|
78
|
+
isMedium &&
|
|
79
|
+
!!activeFilters.length && (_jsx(Button, { variant: 'link', onClick: onClearAllFilters, children: t('clear_all') })) }));
|
|
80
|
+
const searchInput = (_jsx(SearchInput, { ...searchInputProps, onSearchSubmit: val => {
|
|
81
|
+
searchInputProps.onSearchSubmit?.(val);
|
|
82
|
+
setSubmittedSearchValue(val);
|
|
83
|
+
}, placeholder: placeholder }));
|
|
84
|
+
return (_jsxs(Grid, { ...restProps, as: StyledSearchResults, ref: ref, md: filters.length
|
|
85
|
+
? {
|
|
86
|
+
container: {
|
|
87
|
+
cols: '15rem auto'
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
: undefined, sm: filters.length
|
|
91
|
+
? {
|
|
92
|
+
container: {
|
|
93
|
+
cols: 'auto',
|
|
94
|
+
rowGap: 2
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
: undefined, container: {
|
|
98
|
+
rows: 'auto auto',
|
|
99
|
+
cols: 'auto 1fr',
|
|
100
|
+
areas: '"filters results"'
|
|
101
|
+
}, children: [isMedium && !!filters.length && (_jsxs(Grid, { item: { area: 'filters', alignSelf: 'start' }, as: StyledFilters, children: [searchTitle, filters.map((filter) => {
|
|
102
|
+
return (_jsx(Filter, { onFilterChange: onFilterChange, onClearFilter: onClearFilter, ...filter }, filter.name));
|
|
103
|
+
})] })), _jsxs(Grid, { item: { alignSelf: 'start', area: 'results' }, container: {
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
rowGap: 2,
|
|
106
|
+
rows: 'auto auto 1fr',
|
|
107
|
+
areas: '"search" "meta" "items"'
|
|
108
|
+
}, as: StyledResults, children: [loading && _jsx(Progress, { placement: 'local' }), searchContainerEl && isMedium ? (createPortal(searchInput, searchContainerEl)) : (_jsxs(Grid, { item: { area: 'search' }, children: [!isMedium && searchTitle, searchInput] })), _jsxs(Grid, { item: { area: 'meta' }, container: { rowGap: 1 }, children: [_jsxs(Flex, { container: { justify: 'between', alignItems: 'center' }, children: [!loading && (_jsx(Text, { as: StyledCountText, variant: 'secondary', children: submittedSearchValue !== '' || results.length > 0
|
|
109
|
+
? t('results_count', [count], { count })
|
|
110
|
+
: '' })), !isMedium && !!filters.length && (_jsxs(Button, { variant: 'simple', onClick: openFiltersModal, children: [_jsx(Icon, { name: activeFilters.length > 0 ? 'filter-on' : 'filter' }), "\u00A0", t('filters'), "\u00A0", _jsx(Count, { children: activeFilters.length })] }))] }), !!activeFilters.length && (_jsx(Flex, { as: StyledSelectedFilters, container: { gap: 1, wrap: 'wrap' }, children: activeFilters.map(filter => {
|
|
111
|
+
return (_jsx(Selectable, { id: filter.id, onRemove: () => onFilterChange?.({
|
|
112
|
+
name: filter.groupName,
|
|
113
|
+
type: filter.type,
|
|
114
|
+
value: filter.resetValue
|
|
115
|
+
}), children: `${filter.groupName}: ${filter.name}` }, filter.id));
|
|
116
|
+
}) }))] }), _jsx(Grid, { item: { area: 'items', alignSelf: results.length ? 'start' : 'stretch' }, container: { rowGap: 2 }, children: !loading && (_jsxs(_Fragment, { children: [results.length ? (results.map((result) => {
|
|
117
|
+
return _jsx(SearchResult, { ...result, accent: accent }, result.id);
|
|
118
|
+
})) : (_jsx(Grid, { item: { alignSelf: 'stretch' }, children: _jsx(EmptyState, { message: submittedSearchValue === '' ? t('empty_search') : undefined }) })), onShowMore && (_jsx(Flex, { container: { justify: 'center' }, children: _jsx(Button, { variant: 'link', onClick: onShowMore, children: t('show_more') }) }))] })) })] })] }));
|
|
100
119
|
});
|
|
101
120
|
export default SearchResults;
|
|
102
121
|
//# sourceMappingURL=SearchResults.js.map
|
|
@@ -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,CAA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ACT,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 {t('filters')} \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,EAA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CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,EACxE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,YAEvB,CAAC,OAAO,IAAI,CACX,8BACG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAChB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAyB,EAAE,EAAE;oCACxC,OAAO,KAAC,YAAY,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 {t('filters')} \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":"
|
|
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.
|
|
20
|
-
width:
|
|
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(
|
|
29
|
+
padding-bottom: calc(1 * ${spacing});
|
|
28
30
|
`;
|
|
29
31
|
});
|
|
30
32
|
StyledSelectedFilters.defaultProps = defaultThemeProp;
|
|
31
|
-
export const StyledFilter = styled.div
|
|
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,
|
|
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,gBAAg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,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,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,CAAC,CAAC;IACrC,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAGD,oBAAY,WAAW,GAAG,iBAAiB,CAAC;AAE5C,oBAAY,aAAa,GAAG,kBAAkB,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,IAAI,EAAE,UAAU,CAAC,SAAS,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC,CAAC;IAC7D,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,IAAI,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;
|
|
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,EA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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,
|
|
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"}
|