@pega/cosmos-react-work 4.0.0-dev.23.1 → 4.0.0-dev.24.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.map +1 -1
- package/lib/components/AppAnnouncement/AppAnnouncement.js +1 -1
- package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
- package/lib/components/Article/Article.d.ts +49 -0
- package/lib/components/Article/Article.d.ts.map +1 -0
- package/lib/components/Article/Article.js +73 -0
- package/lib/components/Article/Article.js.map +1 -0
- package/lib/components/Article/ArticleFooter.d.ts +40 -0
- package/lib/components/Article/ArticleFooter.d.ts.map +1 -0
- package/lib/components/Article/ArticleFooter.js +54 -0
- package/lib/components/Article/ArticleFooter.js.map +1 -0
- package/lib/components/Article/ArticleMeta.d.ts +13 -0
- package/lib/components/Article/ArticleMeta.d.ts.map +1 -0
- package/lib/components/Article/ArticleMeta.js +24 -0
- package/lib/components/Article/ArticleMeta.js.map +1 -0
- package/lib/components/Article/index.d.ts +5 -0
- package/lib/components/Article/index.d.ts.map +1 -0
- package/lib/components/Article/index.js +3 -0
- package/lib/components/Article/index.js.map +1 -0
- package/lib/components/ArticleList/ArticleList.d.ts +6 -0
- package/lib/components/ArticleList/ArticleList.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleList.js +112 -0
- package/lib/components/ArticleList/ArticleList.js.map +1 -0
- package/lib/components/ArticleList/ArticleList.types.d.ts +79 -0
- package/lib/components/ArticleList/ArticleList.types.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleList.types.js +2 -0
- package/lib/components/ArticleList/ArticleList.types.js.map +1 -0
- package/lib/components/ArticleList/ArticleListFilter.d.ts +6 -0
- package/lib/components/ArticleList/ArticleListFilter.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleListFilter.js +60 -0
- package/lib/components/ArticleList/ArticleListFilter.js.map +1 -0
- package/lib/components/ArticleList/ArticleListHeader.d.ts +5 -0
- package/lib/components/ArticleList/ArticleListHeader.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleListHeader.js +20 -0
- package/lib/components/ArticleList/ArticleListHeader.js.map +1 -0
- package/lib/components/ArticleList/ArticleSummary.d.ts +7 -0
- package/lib/components/ArticleList/ArticleSummary.d.ts.map +1 -0
- package/lib/components/ArticleList/ArticleSummary.js +46 -0
- package/lib/components/ArticleList/ArticleSummary.js.map +1 -0
- package/lib/components/ArticleList/index.d.ts +6 -0
- package/lib/components/ArticleList/index.d.ts.map +1 -0
- package/lib/components/ArticleList/index.js +4 -0
- package/lib/components/ArticleList/index.js.map +1 -0
- package/lib/components/CasePreview/CasePreview.js +1 -1
- package/lib/components/CasePreview/CasePreview.js.map +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.d.ts.map +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.js +1 -1
- package/lib/components/ConfigurableLayout/ConfigurableLayout.js.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.map +1 -1
- package/lib/components/Details/Details.js +1 -1
- package/lib/components/Details/Details.js.map +1 -1
- package/lib/components/Glimpse/Glimpse.d.ts.map +1 -1
- package/lib/components/Glimpse/Glimpse.js +1 -1
- package/lib/components/Glimpse/Glimpse.js.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +1 -1
- package/lib/components/Predictions/Predictions.d.ts.map +1 -1
- package/lib/components/Predictions/Predictions.js +2 -2
- package/lib/components/Predictions/Predictions.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.js +1 -1
- package/lib/components/SearchResults/SearchResults.js.map +1 -1
- package/lib/components/Stages/Stages.d.ts.map +1 -1
- package/lib/components/Stages/Stages.js +1 -1
- package/lib/components/Stages/Stages.js.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.js +1 -1
- 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 +1 -1
- package/lib/components/Tags/Tags.js.map +1 -1
- package/lib/components/Tasks/TaskList.d.ts.map +1 -1
- package/lib/components/Tasks/TaskList.js +1 -1
- package/lib/components/Tasks/TaskList.js.map +1 -1
- package/lib/components/Timeline/Timeline.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.js +1 -1
- package/lib/components/Timeline/Timeline.js.map +1 -1
- package/lib/components/Timeline/TimelineToolbar.js +1 -1
- package/lib/components/Timeline/TimelineToolbar.js.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { MouseEvent, MouseEventHandler } from 'react';
|
|
2
|
+
import { Action, BaseProps, ComboBoxProps, OmitStrict, RequireAtLeastOne, SearchInputProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import { ArticleMetaProps } from '../Article/ArticleMeta';
|
|
4
|
+
export interface ArticleSummaryProps extends BaseProps {
|
|
5
|
+
/** Unique id of article */
|
|
6
|
+
articleId: string;
|
|
7
|
+
/** URL or DOM id to navigate to. This will render the nav item as a link. */
|
|
8
|
+
href?: string;
|
|
9
|
+
/** Article title */
|
|
10
|
+
title: string;
|
|
11
|
+
/** Article content */
|
|
12
|
+
abstract: string;
|
|
13
|
+
/** Callback fired when article title is clicked */
|
|
14
|
+
onTitleClick?: (id?: string, event?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
15
|
+
/** Primary actions which needs to be displayed with an icon */
|
|
16
|
+
primaryActions?: Action[];
|
|
17
|
+
/** A list of elements to be rendered within a MetaList. */
|
|
18
|
+
meta?: ArticleMetaProps;
|
|
19
|
+
/** Quick filters to filter articles */
|
|
20
|
+
quickFilters?: QuickFilter[];
|
|
21
|
+
/** callback fired when quick filter is clicked */
|
|
22
|
+
onQuickFilterClick?: ArticleListProps['onQuickFilterClick'];
|
|
23
|
+
}
|
|
24
|
+
export interface Articles {
|
|
25
|
+
/** List of articles */
|
|
26
|
+
articles: ArticleSummaryProps[];
|
|
27
|
+
/** count of articles */
|
|
28
|
+
count?: number;
|
|
29
|
+
/** Props related to the Search Input. */
|
|
30
|
+
searchInput: OmitStrict<SearchInputProps, 'placeholder' | 'onSearchSubmit' | 'searchResults' | 'recentSearches' | 'advancedSearchLink' | 'resultsPopover'>;
|
|
31
|
+
/** Props related to the Category Input. */
|
|
32
|
+
category?: OmitStrict<ComboBoxProps, 'id' | 'labelHidden' | 'required' | 'disabled' | 'readOnly' | 'status' | 'info' | 'actions' | 'additionalInfo'>;
|
|
33
|
+
/** Props related to the SortBy Input. */
|
|
34
|
+
sortBy?: OmitStrict<ComboBoxProps, 'id' | 'labelHidden' | 'required' | 'disabled' | 'readOnly' | 'status' | 'info' | 'mode' | 'actions' | 'additionalInfo' | 'onChange' | 'value'>;
|
|
35
|
+
/** Callback fired when clear button is clicked */
|
|
36
|
+
onClearClick?: MouseEventHandler<HTMLButtonElement>;
|
|
37
|
+
/** Quick filters to filter articles */
|
|
38
|
+
quickFilters?: QuickFilter[];
|
|
39
|
+
/** Callback fired when applied quick filter is removed */
|
|
40
|
+
handleQuickFilterRemove?: (id: string) => void;
|
|
41
|
+
/** Prop to enable show / hide results */
|
|
42
|
+
showResults?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface ArticleListHeaderProps {
|
|
45
|
+
/** Title of article list */
|
|
46
|
+
title: string;
|
|
47
|
+
/** Article list header icon */
|
|
48
|
+
icon?: string;
|
|
49
|
+
/** Actions which needs to be displayed with an icon */
|
|
50
|
+
actions?: Action[];
|
|
51
|
+
}
|
|
52
|
+
export type ArticleListProps = RequireAtLeastOne<{
|
|
53
|
+
/** Props related to article list header */
|
|
54
|
+
header?: ArticleListHeaderProps;
|
|
55
|
+
/** Data of suggested articles */
|
|
56
|
+
suggested?: Pick<Articles, 'articles' | 'count'>;
|
|
57
|
+
/** Data of followed articles */
|
|
58
|
+
followed?: Articles;
|
|
59
|
+
/** Data of search articles */
|
|
60
|
+
search?: Articles;
|
|
61
|
+
/** current active tab whose list has to be rendered */
|
|
62
|
+
activeTab: string;
|
|
63
|
+
/** Callback fired when tab is clicked */
|
|
64
|
+
onTabClick?: (name: string, event?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Optionally renders an indeterminate progress indicator while articles are being fetched.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
loading?: boolean;
|
|
70
|
+
/** callback fired when quick filter is clicked */
|
|
71
|
+
onQuickFilterClick?: (quickFilterParam: QuickFilter, event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
72
|
+
}, 'suggested' | 'followed' | 'search'>;
|
|
73
|
+
export interface QuickFilter {
|
|
74
|
+
/** Unique id of quick Filter */
|
|
75
|
+
id: string;
|
|
76
|
+
/** Name of quick Filter */
|
|
77
|
+
name: string;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=ArticleList.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArticleList.types.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleList.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EACL,MAAM,EACN,SAAS,EACT,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM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
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArticleList.types.js","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleList.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEvent, MouseEventHandler } from 'react';\n\nimport {\n Action,\n BaseProps,\n ComboBoxProps,\n OmitStrict,\n RequireAtLeastOne,\n SearchInputProps\n} from '@pega/cosmos-react-core';\n\nimport { ArticleMetaProps } from '../Article/ArticleMeta';\n\nexport interface ArticleSummaryProps extends BaseProps {\n /** Unique id of article */\n articleId: string;\n /** URL or DOM id to navigate to. This will render the nav item as a link. */\n href?: string;\n /** Article title */\n title: string;\n /** Article content */\n abstract: string;\n /** Callback fired when article title is clicked */\n onTitleClick?: (id?: string, event?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n /** Primary actions which needs to be displayed with an icon */\n primaryActions?: Action[];\n /** A list of elements to be rendered within a MetaList. */\n meta?: ArticleMetaProps;\n /** Quick filters to filter articles */\n quickFilters?: QuickFilter[];\n /** callback fired when quick filter is clicked */\n onQuickFilterClick?: ArticleListProps['onQuickFilterClick'];\n}\n\nexport interface Articles {\n /** List of articles */\n articles: ArticleSummaryProps[];\n /** count of articles */\n count?: number;\n /** Props related to the Search Input. */\n searchInput: OmitStrict<\n SearchInputProps,\n | 'placeholder'\n | 'onSearchSubmit'\n | 'searchResults'\n | 'recentSearches'\n | 'advancedSearchLink'\n | 'resultsPopover'\n >;\n /** Props related to the Category Input. */\n category?: OmitStrict<\n ComboBoxProps,\n | 'id'\n | 'labelHidden'\n | 'required'\n | 'disabled'\n | 'readOnly'\n | 'status'\n | 'info'\n | 'actions'\n | 'additionalInfo'\n >;\n /** Props related to the SortBy Input. */\n sortBy?: OmitStrict<\n ComboBoxProps,\n | 'id'\n | 'labelHidden'\n | 'required'\n | 'disabled'\n | 'readOnly'\n | 'status'\n | 'info'\n | 'mode'\n | 'actions'\n | 'additionalInfo'\n | 'onChange'\n | 'value'\n >;\n /** Callback fired when clear button is clicked */\n onClearClick?: MouseEventHandler<HTMLButtonElement>;\n /** Quick filters to filter articles */\n quickFilters?: QuickFilter[];\n /** Callback fired when applied quick filter is removed */\n handleQuickFilterRemove?: (id: string) => void;\n /** Prop to enable show / hide results */\n showResults?: boolean;\n}\n\nexport interface ArticleListHeaderProps {\n /** Title of article list */\n title: string;\n /** Article list header icon */\n icon?: string;\n /** Actions which needs to be displayed with an icon */\n actions?: Action[];\n}\n\nexport type ArticleListProps = RequireAtLeastOne<\n {\n /** Props related to article list header */\n header?: ArticleListHeaderProps;\n /** Data of suggested articles */\n suggested?: Pick<Articles, 'articles' | 'count'>;\n /** Data of followed articles */\n followed?: Articles;\n /** Data of search articles */\n search?: Articles;\n /** current active tab whose list has to be rendered */\n activeTab: string;\n /** Callback fired when tab is clicked */\n onTabClick?: (name: string, event?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n /**\n * Optionally renders an indeterminate progress indicator while articles are being fetched.\n * @default false\n */\n loading?: boolean;\n /** callback fired when quick filter is clicked */\n onQuickFilterClick?: (\n quickFilterParam: QuickFilter,\n event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>\n ) => void;\n },\n 'suggested' | 'followed' | 'search'\n>;\n\nexport interface QuickFilter {\n /** Unique id of quick Filter */\n id: string;\n /** Name of quick Filter */\n name: string;\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import { ArticleListProps } from './ArticleList.types';
|
|
4
|
+
declare const ArticleListFilter: FunctionComponent<ArticleListProps['search'] & ForwardProps>;
|
|
5
|
+
export default ArticleListFilter;
|
|
6
|
+
//# sourceMappingURL=ArticleListFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArticleListFilter.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleListFilter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAqB,MAAM,OAAO,CAAC;AAG7D,OAAO,EAOL,YAAY,EAIb,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AA6CvD,QAAA,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,YAAY,CA2DnF,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { Button, Flex, SearchInput, useI18n, defaultThemeProp, ComboBox, StyledSearchInput, Text, Selectable } from '@pega/cosmos-react-core';
|
|
5
|
+
import { StyledFormContent } from '@pega/cosmos-react-core/lib/components/MultiStepForm/MultiStepForm';
|
|
6
|
+
const StyledClearButton = styled(Button)(({ theme }) => {
|
|
7
|
+
return css `
|
|
8
|
+
margin-block-start: calc(4.5 * ${theme.base.spacing});
|
|
9
|
+
`;
|
|
10
|
+
});
|
|
11
|
+
StyledClearButton.defaultProps = defaultThemeProp;
|
|
12
|
+
const StyledFilterContainer = styled(Flex) `
|
|
13
|
+
flex-grow: 1;
|
|
14
|
+
`;
|
|
15
|
+
const StyledSelectable = styled(Selectable)(({ theme }) => {
|
|
16
|
+
return css `
|
|
17
|
+
line-height: calc(2 * ${theme.base.spacing});
|
|
18
|
+
margin: calc(0.25 * ${theme.base.spacing});
|
|
19
|
+
`;
|
|
20
|
+
});
|
|
21
|
+
StyledSelectable.defaultProps = defaultThemeProp;
|
|
22
|
+
const StyledSearchFilters = styled.div(({ theme }) => {
|
|
23
|
+
return css `
|
|
24
|
+
width: 100%;
|
|
25
|
+
gap: 0;
|
|
26
|
+
|
|
27
|
+
> div:last-child {
|
|
28
|
+
margin: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
${StyledFormContent} {
|
|
32
|
+
gap: ${theme.base.spacing};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
${StyledFilterContainer} > div {
|
|
36
|
+
margin-top: calc(1.5 * ${theme.base.spacing});
|
|
37
|
+
width: 100%;
|
|
38
|
+
}
|
|
39
|
+
${StyledSearchInput} {
|
|
40
|
+
flex-grow: 1;
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
});
|
|
44
|
+
StyledSearchFilters.defaultProps = defaultThemeProp;
|
|
45
|
+
const ArticleListFilter = (props) => {
|
|
46
|
+
const { searchInput, category, sortBy, onClearClick, articles, quickFilters = [], showResults = false, handleQuickFilterRemove, ...restProps } = props || {};
|
|
47
|
+
const t = useI18n();
|
|
48
|
+
const searchResults = t('results_count', [articles?.length ?? 0]);
|
|
49
|
+
const quickFiltersRef = useRef([]);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (quickFilters.length > 0 && quickFiltersRef.current.length > 0) {
|
|
52
|
+
quickFiltersRef.current[quickFilters.length - 1]?.focus();
|
|
53
|
+
}
|
|
54
|
+
}, [articles]);
|
|
55
|
+
return (_jsxs(StyledSearchFilters, { ...restProps, children: [_jsx(Flex, { container: { alignItems: 'center', gap: 1, pad: [0.5, undefined] }, children: _jsx(SearchInput, { ...searchInput }) }), quickFilters.map(({ id, name }, i) => (_jsx(StyledSelectable, { id: id, ref: (el) => {
|
|
56
|
+
quickFiltersRef.current[i] = el;
|
|
57
|
+
}, onRemove: handleQuickFilterRemove ? () => handleQuickFilterRemove?.(id) : undefined, onClick: handleQuickFilterRemove ? () => handleQuickFilterRemove?.(id) : undefined, children: name }))), _jsxs(StyledFilterContainer, { container: { gap: 1, alignItems: 'start' }, children: [category && _jsx(ComboBox, { ...category }), sortBy && _jsx(ComboBox, { ...sortBy }), onClearClick && (_jsx(StyledClearButton, { variant: 'link', label: t('clear'), "aria-label": t('clear_filters'), onClick: onClearClick, children: t('clear') }))] }), showResults && _jsx(Text, { variant: 'secondary', children: searchResults })] }));
|
|
58
|
+
};
|
|
59
|
+
export default ArticleListFilter;
|
|
60
|
+
//# sourceMappingURL=ArticleListFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArticleListFilter.js","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleListFilter.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,QAAQ,EAER,iBAAiB,EACjB,IAAI,EACJ,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oEAAoE,CAAC;AAIvG,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACrD,OAAO,GAAG,CAAA;qCACyB,KAAK,CAAC,IAAI,CAAC,OAAO;GACpD,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,qBAAqB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAEzC,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACxD,OAAO,GAAG,CAAA;4BACgB,KAAK,CAAC,IAAI,CAAC,OAAO;0BACpB,KAAK,CAAC,IAAI,CAAC,OAAO;GACzC,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEjD,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACnD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AE,EAAE,CAAC,EAAE,EAAE,CAAC,CACrC,KAAC,gBAAgB,IACf,EAAE,EAAE,EAAE,EACN,GAAG,EAAE,CAAC,EAAqB,EAAE,EAAE;oBAC7B,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;gBAClC,CAAC,EACD,QAAQ,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,uBAAuB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,EACnF,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,uBAAuB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,YAEjF,IAAI,GACY,CACpB,CAAC,EACF,MAAC,qBAAqB,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,aAC9D,QAAQ,IAAI,KAAC,QAAQ,OAAK,QAAQ,GAAI,EACtC,MAAM,IAAI,KAAC,QAAQ,OAAK,MAAM,GAAI,EAClC,YAAY,IAAI,CACf,KAAC,iBAAiB,IAChB,OAAO,EAAC,MAAM,EACd,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,gBACL,CAAC,CAAC,eAAe,CAAC,EAC9B,OAAO,EAAE,YAAY,YAEpB,CAAC,CAAC,OAAO,CAAC,GACO,CACrB,IACqB,EACvB,WAAW,IAAI,KAAC,IAAI,IAAC,OAAO,EAAC,WAAW,YAAE,aAAa,GAAQ,IAC5C,CACvB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { FunctionComponent, useEffect, useRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Flex,\n SearchInput,\n useI18n,\n defaultThemeProp,\n ComboBox,\n ForwardProps,\n StyledSearchInput,\n Text,\n Selectable\n} from '@pega/cosmos-react-core';\nimport { StyledFormContent } from '@pega/cosmos-react-core/lib/components/MultiStepForm/MultiStepForm';\n\nimport { ArticleListProps } from './ArticleList.types';\n\nconst StyledClearButton = styled(Button)(({ theme }) => {\n return css`\n margin-block-start: calc(4.5 * ${theme.base.spacing});\n `;\n});\nStyledClearButton.defaultProps = defaultThemeProp;\n\nconst StyledFilterContainer = styled(Flex)`\n flex-grow: 1;\n`;\n\nconst StyledSelectable = styled(Selectable)(({ theme }) => {\n return css`\n line-height: calc(2 * ${theme.base.spacing});\n margin: calc(0.25 * ${theme.base.spacing});\n `;\n});\nStyledSelectable.defaultProps = defaultThemeProp;\n\nconst StyledSearchFilters = styled.div(({ theme }) => {\n return css`\n width: 100%;\n gap: 0;\n\n > div:last-child {\n margin: 0;\n }\n\n ${StyledFormContent} {\n gap: ${theme.base.spacing};\n }\n\n ${StyledFilterContainer} > div {\n margin-top: calc(1.5 * ${theme.base.spacing});\n width: 100%;\n }\n ${StyledSearchInput} {\n flex-grow: 1;\n }\n `;\n});\nStyledSearchFilters.defaultProps = defaultThemeProp;\n\nconst ArticleListFilter: FunctionComponent<ArticleListProps['search'] & ForwardProps> = (\n props: ArticleListProps['search']\n) => {\n const {\n searchInput,\n category,\n sortBy,\n onClearClick,\n articles,\n quickFilters = [],\n showResults = false,\n handleQuickFilterRemove,\n ...restProps\n } = props || {};\n const t = useI18n();\n const searchResults = t('results_count', [articles?.length ?? 0]);\n\n const quickFiltersRef = useRef<HTMLButtonElement[]>([]);\n\n useEffect(() => {\n if (quickFilters.length > 0 && quickFiltersRef.current.length > 0) {\n quickFiltersRef.current[quickFilters.length - 1]?.focus();\n }\n }, [articles]);\n\n return (\n <StyledSearchFilters {...restProps}>\n <Flex container={{ alignItems: 'center', gap: 1, pad: [0.5, undefined] }}>\n <SearchInput {...searchInput} />\n </Flex>\n {quickFilters.map(({ id, name }, i) => (\n <StyledSelectable\n id={id}\n ref={(el: HTMLButtonElement) => {\n quickFiltersRef.current[i] = el;\n }}\n onRemove={handleQuickFilterRemove ? () => handleQuickFilterRemove?.(id) : undefined}\n onClick={handleQuickFilterRemove ? () => handleQuickFilterRemove?.(id) : undefined}\n >\n {name}\n </StyledSelectable>\n ))}\n <StyledFilterContainer container={{ gap: 1, alignItems: 'start' }}>\n {category && <ComboBox {...category} />}\n {sortBy && <ComboBox {...sortBy} />}\n {onClearClick && (\n <StyledClearButton\n variant='link'\n label={t('clear')}\n aria-label={t('clear_filters')}\n onClick={onClearClick}\n >\n {t('clear')}\n </StyledClearButton>\n )}\n </StyledFilterContainer>\n {showResults && <Text variant='secondary'>{searchResults}</Text>}\n </StyledSearchFilters>\n );\n};\n\nexport default ArticleListFilter;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArticleListHeader.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleListHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAuB7D,QAAA,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,sBAAsB,CAQhE,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { Flex, Icon, Actions, Text, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
4
|
+
const StyledHeaderText = styled(Text) `
|
|
5
|
+
text-overflow: ellipsis;
|
|
6
|
+
white-space: nowrap;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
flex-grow: 1;
|
|
9
|
+
`;
|
|
10
|
+
const StyledIcon = styled(Icon)(({ theme: { base: { spacing } } }) => {
|
|
11
|
+
return css `
|
|
12
|
+
min-width: calc(3 * ${spacing});
|
|
13
|
+
`;
|
|
14
|
+
});
|
|
15
|
+
StyledIcon.defaultProps = defaultThemeProp;
|
|
16
|
+
const ArticleListHeader = ({ icon, title, actions }) => {
|
|
17
|
+
return (_jsxs(Flex, { container: { alignItems: 'center', gap: 1 }, children: [icon && _jsx(StyledIcon, { name: icon }), _jsx(StyledHeaderText, { variant: 'h2', children: title }), actions && _jsx(Actions, { items: actions })] }));
|
|
18
|
+
};
|
|
19
|
+
export default ArticleListHeader;
|
|
20
|
+
//# sourceMappingURL=ArticleListHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArticleListHeader.js","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleListHeader.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAItF,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;;;CAKpC,CAAC;AAEF,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAC7B,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,OAAO,EAAE,EAClB,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;4BACc,OAAO;KAC9B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3C,MAAM,iBAAiB,GAA8C,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE;IAChG,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aAC9C,IAAI,IAAI,KAAC,UAAU,IAAC,IAAI,EAAE,IAAI,GAAI,EACnC,KAAC,gBAAgB,IAAC,OAAO,EAAC,IAAI,YAAE,KAAK,GAAoB,EACxD,OAAO,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,OAAO,GAAI,IAClC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { FunctionComponent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { Flex, Icon, Actions, Text, defaultThemeProp } from '@pega/cosmos-react-core';\n\nimport { ArticleListHeaderProps } from './ArticleList.types';\n\nconst StyledHeaderText = styled(Text)`\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n flex-grow: 1;\n`;\n\nconst StyledIcon = styled(Icon)(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n min-width: calc(3 * ${spacing});\n `;\n }\n);\n\nStyledIcon.defaultProps = defaultThemeProp;\n\nconst ArticleListHeader: FunctionComponent<ArticleListHeaderProps> = ({ icon, title, actions }) => {\n return (\n <Flex container={{ alignItems: 'center', gap: 1 }}>\n {icon && <StyledIcon name={icon} />}\n <StyledHeaderText variant='h2'>{title}</StyledHeaderText>\n {actions && <Actions items={actions} />}\n </Flex>\n );\n};\n\nexport default ArticleListHeader;\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import { ArticleSummaryProps } from './ArticleList.types';
|
|
4
|
+
export declare const StyledQuickFilters: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
+
declare const ArticleSummary: FunctionComponent<ArticleSummaryProps & ForwardProps>;
|
|
6
|
+
export default ArticleSummary;
|
|
7
|
+
//# sourceMappingURL=ArticleSummary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArticleSummary.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleSummary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAML,YAAY,EAMb,MAAM,yBAAyB,CAAC;AASjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AA2B1D,eAAO,MAAM,kBAAkB,yGAW7B,CAAC;AAGH,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CAkDzE,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { CardHeader, CardContent, CardFooter, Link, Text, StyledText, Actions, Flex, Tag, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
4
|
+
import { StyledCard } from '@pega/cosmos-react-core/lib/components/Card/Card';
|
|
5
|
+
import { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';
|
|
6
|
+
import { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';
|
|
7
|
+
import { StyledCardFooter } from '@pega/cosmos-react-core/lib/components/Card/CardFooter';
|
|
8
|
+
import { StyledBareButton } from '@pega/cosmos-react-core/lib/components/Button/BareButton';
|
|
9
|
+
import ArticleMeta from '../Article/ArticleMeta';
|
|
10
|
+
const ArticleCard = styled(StyledCard)(({ theme: { base: { spacing } } }) => {
|
|
11
|
+
return css `
|
|
12
|
+
&&& {
|
|
13
|
+
> ${StyledCardHeader}, > ${StyledCardContent}, > ${StyledCardFooter} {
|
|
14
|
+
padding-inline: 0;
|
|
15
|
+
}
|
|
16
|
+
> ${StyledCardContent} {
|
|
17
|
+
padding-block-end: ${spacing};
|
|
18
|
+
}
|
|
19
|
+
> ${StyledCardContent} > ${StyledText} {
|
|
20
|
+
display: -webkit-box;
|
|
21
|
+
-webkit-line-clamp: 3;
|
|
22
|
+
-webkit-box-orient: vertical;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
});
|
|
28
|
+
export const StyledQuickFilters = styled.div(({ theme }) => {
|
|
29
|
+
const { base: { spacing } } = theme;
|
|
30
|
+
return css `
|
|
31
|
+
${StyledBareButton} {
|
|
32
|
+
margin-inline-start: 0;
|
|
33
|
+
margin-block-start: ${spacing};
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
});
|
|
37
|
+
StyledQuickFilters.defaultProps = defaultThemeProp;
|
|
38
|
+
const ArticleSummary = (props) => {
|
|
39
|
+
const { articleId, href, title, abstract, onTitleClick, primaryActions, meta, quickFilters, onQuickFilterClick, ...restProps } = props;
|
|
40
|
+
return (_jsxs(ArticleCard, { as: 'li', role: 'article', ...restProps, children: [_jsxs(CardHeader, { container: { alignItems: 'start', justify: 'between' }, children: [_jsx(Link, { href: href ?? '/', onClick: onTitleClick, children: title }), primaryActions?.length && _jsx(Actions, { items: primaryActions })] }), _jsx(CardContent, { children: _jsx(Text, { children: abstract }) }), _jsxs(CardFooter, { children: [meta && _jsx(ArticleMeta, { ...meta }), quickFilters && quickFilters.length > 0 && (_jsx(Flex, { container: { gap: 0.5, pad: [0.5, undefined], wrap: 'wrap' }, item: {
|
|
41
|
+
grow: 1,
|
|
42
|
+
basis: '100%'
|
|
43
|
+
}, as: StyledQuickFilters, children: quickFilters.map(({ id, name }) => (_jsx(Tag, { onClick: onQuickFilterClick ? e => onQuickFilterClick?.({ id, name }, e) : undefined, children: `#${name}` }))) }))] })] }, articleId));
|
|
44
|
+
};
|
|
45
|
+
export default ArticleSummary;
|
|
46
|
+
//# sourceMappingURL=ArticleSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArticleSummary.js","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleSummary.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,UAAU,EACV,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EAEJ,UAAU,EACV,OAAO,EACP,IAAI,EACJ,GAAG,EACH,gBAAgB,EACjB,MAA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,SAAS,aAC/D,MAAC,UAAU,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAChE,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,IAAI,GAAG,EAAE,OAAO,EAAE,YAAY,YAC3C,KAAK,GACD,EACN,cAAc,EAAE,MAAM,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,cAAc,GAAI,IAClD,EACb,KAAC,WAAW,cACV,KAAC,IAAI,cAAE,QAAQ,GAAQ,GACX,EACd,MAAC,UAAU,eACR,IAAI,IAAI,KAAC,WAAW,OAAK,IAAI,GAAI,EACjC,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,CAC1C,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAC5D,IAAI,EAAE;4BACJ,IAAI,EAAE,CAAC;4BACP,KAAK,EAAE,MAAM;yBACd,EACD,EAAE,EAAE,kBAAkB,YAErB,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAClC,KAAC,GAAG,IACF,OAAO,EACL,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,kBAAkB,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,YAE7E,IAAI,IAAI,EAAE,GAAO,CACpB,CAAC,GACG,CACR,IACU,KA9B0B,SAAS,CA+BpC,CACf,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { FunctionComponent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n CardHeader,\n CardContent,\n CardFooter,\n Link,\n Text,\n ForwardProps,\n StyledText,\n Actions,\n Flex,\n Tag,\n defaultThemeProp\n} from '@pega/cosmos-react-core';\nimport { StyledCard } from '@pega/cosmos-react-core/lib/components/Card/Card';\nimport { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport { StyledCardFooter } from '@pega/cosmos-react-core/lib/components/Card/CardFooter';\nimport { StyledBareButton } from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nimport ArticleMeta from '../Article/ArticleMeta';\n\nimport { ArticleSummaryProps } from './ArticleList.types';\n\nconst ArticleCard = styled(StyledCard)(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n &&& {\n > ${StyledCardHeader}, > ${StyledCardContent}, > ${StyledCardFooter} {\n padding-inline: 0;\n }\n > ${StyledCardContent} {\n padding-block-end: ${spacing};\n }\n > ${StyledCardContent} > ${StyledText} {\n display: -webkit-box;\n -webkit-line-clamp: 3;\n -webkit-box-orient: vertical;\n overflow: hidden;\n }\n }\n `;\n }\n);\n\nexport const StyledQuickFilters = styled.div(({ theme }) => {\n const {\n base: { spacing }\n } = theme;\n\n return css`\n ${StyledBareButton} {\n margin-inline-start: 0;\n margin-block-start: ${spacing};\n }\n `;\n});\nStyledQuickFilters.defaultProps = defaultThemeProp;\n\nconst ArticleSummary: FunctionComponent<ArticleSummaryProps & ForwardProps> = (\n props: ArticleSummaryProps\n) => {\n const {\n articleId,\n href,\n title,\n abstract,\n onTitleClick,\n primaryActions,\n meta,\n quickFilters,\n onQuickFilterClick,\n ...restProps\n } = props;\n\n return (\n <ArticleCard as='li' role='article' key={articleId} {...restProps}>\n <CardHeader container={{ alignItems: 'start', justify: 'between' }}>\n <Link href={href ?? '/'} onClick={onTitleClick}>\n {title}\n </Link>\n {primaryActions?.length && <Actions items={primaryActions} />}\n </CardHeader>\n <CardContent>\n <Text>{abstract}</Text>\n </CardContent>\n <CardFooter>\n {meta && <ArticleMeta {...meta} />}\n {quickFilters && quickFilters.length > 0 && (\n <Flex\n container={{ gap: 0.5, pad: [0.5, undefined], wrap: 'wrap' }}\n item={{\n grow: 1,\n basis: '100%'\n }}\n as={StyledQuickFilters}\n >\n {quickFilters.map(({ id, name }) => (\n <Tag\n onClick={\n onQuickFilterClick ? e => onQuickFilterClick?.({ id, name }, e) : undefined\n }\n >{`#${name}`}</Tag>\n ))}\n </Flex>\n )}\n </CardFooter>\n </ArticleCard>\n );\n};\n\nexport default ArticleSummary;\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default } from './ArticleList';
|
|
2
|
+
export type { ArticleListProps } from './ArticleList.types';
|
|
3
|
+
export { default as ArticleSummary } from './ArticleSummary';
|
|
4
|
+
export type { ArticleSummaryProps, Articles, QuickFilter } from './ArticleList.types';
|
|
5
|
+
export { default as ArticleListFilter } from './ArticleListFilter';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ArticleList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["export { default } from './ArticleList';\nexport type { ArticleListProps } from './ArticleList.types';\nexport { default as ArticleSummary } from './ArticleSummary';\nexport type { ArticleSummaryProps, Articles, QuickFilter } from './ArticleList.types';\nexport { default as ArticleListFilter } from './ArticleListFilter';\n"]}
|
|
@@ -55,7 +55,7 @@ const StyledPreviewDrawer = styled(StyledCaseDrawer)(({ theme }) => {
|
|
|
55
55
|
`;
|
|
56
56
|
});
|
|
57
57
|
StyledPreviewDrawer.defaultProps = defaultThemeProp;
|
|
58
|
-
const CasePreview = forwardRef((props, ref)
|
|
58
|
+
const CasePreview = forwardRef(function CasePreview(props, ref) {
|
|
59
59
|
const { testId, open: openProp, caseId, heading, subheading, caseLink, parentCases, icon, followed, onFollowedChange, summaryFields, tabs, stages, tasks, tabContent, utilities, utilitiesSummaryItems, actions, banners, onEdit, ...restProps } = props;
|
|
60
60
|
const testIds = useTestIds(testId, getCasePreviewTestIds);
|
|
61
61
|
const t = useI18n();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CasePreview.js","sourceRoot":"","sources":["../../../src/components/CasePreview/CasePreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAIV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAEhB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,OAAO,EACP,eAAe,EAIf,UAAU,EACV,WAAW,EACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAE1F,OAAO,QAAQ,EAAE,EAEf,cAAc,EACd,qBAAqB,EACrB,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AAE,SAAS,EACpB,qBAAqB,EAAE,qBAAqB,EAC5C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,SACT,IACK,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useState,\n useCallback,\n useEffect,\n useContext\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Drawer,\n Icon,\n registerIcon,\n Button,\n Flex,\n tryCatch,\n defaultThemeProp,\n ForwardProps,\n useBreakpoint,\n useElement,\n useDirection,\n useI18n,\n AppShellContext,\n BaseProps,\n TestIdProp,\n NoChildrenProp,\n useTestIds,\n withTestIds\n} from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nimport CaseView, {\n CaseViewProps,\n StyledCaseView,\n StyledCaseViewContent,\n StyledCaseDrawer,\n StyledSummaryRegion\n} from '../CaseView';\nimport { CaseViewContextValue } from '../CaseView/CaseView.types';\n\nimport { getCasePreviewTestIds } from './CasePreview.test-ids';\n\nregisterIcon(timesIcon);\n\nexport interface CasePreviewProps\n extends Pick<\n CaseViewProps,\n | 'caseId'\n | 'heading'\n | 'subheading'\n | 'parentCases'\n | 'icon'\n | 'followed'\n | 'onFollowedChange'\n | 'actions'\n | 'promotedActions'\n | 'onEdit'\n | 'summaryFields'\n | 'tabs'\n | 'tabContent'\n | 'stages'\n | 'tasks'\n | 'banners'\n | 'utilities'\n | 'utilitiesSummaryItems'\n >,\n NoChildrenProp,\n TestIdProp,\n BaseProps {\n /** A set of props including an href that will be forwarded to the case preview's heading and subheading. */\n caseLink?: CaseViewContextValue['caseLink'];\n /** If true, the Case Preview will be visible. */\n open: boolean;\n /** Callback fired before Case Preview opens. */\n onBeforeOpen?: () => void;\n /** Callback fired after Case Preview opens. */\n onAfterOpen?: () => void;\n /** Callback fired before Case Preview closes. */\n onBeforeClose?: () => void;\n /** Callback fired after Case Preview closes. */\n onAfterClose?: () => void;\n /** Callback fired when a click action occurs outside of the Case Preview. */\n onOuterClick?: () => void;\n /** Reference to the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledPreviewHeader = styled.div(({ theme }) => {\n return css`\n z-index: ${theme.base['z-index'].drawer};\n background-color: ${theme.base.palette['primary-background']};\n `;\n});\n\nStyledPreviewHeader.defaultProps = defaultThemeProp;\n\nconst StyledPreviewActions = styled.div(\n ({\n theme: {\n base: {\n spacing,\n palette: { 'brand-primary': brandPrimary }\n }\n }\n }) => {\n const buttonColor = tryCatch(() => readableColor(brandPrimary));\n\n return css`\n background-color: ${brandPrimary};\n padding: ${spacing} calc(2 * ${spacing}) 0;\n\n button {\n color: ${buttonColor};\n }\n `;\n }\n);\n\nStyledPreviewActions.defaultProps = defaultThemeProp;\n\nconst StyledPreviewDrawer = styled(StyledCaseDrawer)(({ theme }) => {\n return css`\n height: calc(100vh - var(--appshell-offset, 0rem));\n top: var(--appshell-offset, 0);\n z-index: calc(${theme.base['z-index'].drawer} + 500);\n\n ${StyledCaseView} {\n height: calc(100vh - ${theme.base.spacing} - ${theme.base['hit-area']['mouse-min']});\n\n @media (pointer: coarse) {\n height: calc(100vh - ${theme.base.spacing} - ${theme.base['hit-area']['finger-min']});\n }\n\n ${StyledSummaryRegion} {\n position: relative;\n top: 0;\n }\n }\n\n ${StyledCaseViewContent} {\n overflow-y: auto;\n\n & > :last-child {\n padding-bottom: calc(2 * ${theme.base.spacing});\n }\n }\n `;\n});\n\nStyledPreviewDrawer.defaultProps = defaultThemeProp;\n\nconst CasePreview: FunctionComponent<CasePreviewProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<CasePreviewProps>, ref: CasePreviewProps['ref']) => {\n const {\n testId,\n open: openProp,\n caseId,\n heading,\n subheading,\n caseLink,\n parentCases,\n icon,\n followed,\n onFollowedChange,\n summaryFields,\n tabs,\n stages,\n tasks,\n tabContent,\n utilities,\n utilitiesSummaryItems,\n actions,\n banners,\n onEdit,\n ...restProps\n } = props;\n const testIds = useTestIds(testId, getCasePreviewTestIds);\n\n const t = useI18n();\n const { previewTriggerRef } = useContext(AppShellContext);\n const [closeButtonEl, setCloseButtonEl] = useElement<HTMLButtonElement>();\n const isSmallOrAbove = useBreakpoint('sm');\n const [open, setOpen] = useState(openProp);\n const direction = useDirection();\n\n const closePreview = useCallback(() => {\n setOpen(false);\n previewTriggerRef.current?.focus();\n }, []);\n\n useEffect(() => {\n setOpen(openProp);\n }, [openProp]);\n\n useEffect(() => {\n if (openProp && closeButtonEl) {\n closeButtonEl.focus();\n }\n }, [openProp, closeButtonEl]);\n\n return (\n <Drawer\n data-testid={testIds.root}\n {...restProps}\n as={StyledPreviewDrawer}\n role='complementary'\n forwardedAs={Flex}\n container={{ direction: 'column' }}\n ref={ref}\n open={open && isSmallOrAbove}\n position='fixed'\n placement={direction.end}\n aria-label={t('preview_of_noun', [heading])}\n shadow\n nullWhenClosed\n >\n <StyledPreviewActions>\n <Button\n data-testid={testIds.close}\n variant='simple'\n icon\n onClick={closePreview}\n ref={setCloseButtonEl}\n label={t('close_preview')}\n >\n <Icon name='times' />\n </Button>\n </StyledPreviewActions>\n\n <CaseView\n caseId={caseId}\n parentCases={parentCases}\n heading={heading}\n subheading={subheading}\n caseLink={caseLink}\n icon={icon}\n followed={followed}\n onFollowedChange={onFollowedChange}\n summaryFields={summaryFields}\n tabs={tabs}\n stages={stages}\n tasks={tasks}\n tabContent={tabContent}\n utilities={utilities}\n utilitiesSummaryItems={utilitiesSummaryItems}\n actions={actions}\n banners={banners}\n onEdit={onEdit}\n isPreview\n />\n </Drawer>\n );\n }\n);\n\nexport default withTestIds(CasePreview, getCasePreviewTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"CasePreview.js","sourceRoot":"","sources":["../../../src/components/CasePreview/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AAO,EAAC,QAAQ,EAChB,IAAI,QACJ,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE,CAAC,CAAC,eAAe,CAAC,YAEzB,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,GACd,GACY,EAEvB,KAAC,QAAQ,IACP,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,qBAAqB,EAAE,qBAAqB,EAC5C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,SACT,IACK,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useState,\n useCallback,\n useEffect,\n useContext\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Drawer,\n Icon,\n registerIcon,\n Button,\n Flex,\n tryCatch,\n defaultThemeProp,\n ForwardProps,\n useBreakpoint,\n useElement,\n useDirection,\n useI18n,\n AppShellContext,\n BaseProps,\n TestIdProp,\n NoChildrenProp,\n useTestIds,\n withTestIds\n} from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nimport CaseView, {\n CaseViewProps,\n StyledCaseView,\n StyledCaseViewContent,\n StyledCaseDrawer,\n StyledSummaryRegion\n} from '../CaseView';\nimport { CaseViewContextValue } from '../CaseView/CaseView.types';\n\nimport { getCasePreviewTestIds } from './CasePreview.test-ids';\n\nregisterIcon(timesIcon);\n\nexport interface CasePreviewProps\n extends Pick<\n CaseViewProps,\n | 'caseId'\n | 'heading'\n | 'subheading'\n | 'parentCases'\n | 'icon'\n | 'followed'\n | 'onFollowedChange'\n | 'actions'\n | 'promotedActions'\n | 'onEdit'\n | 'summaryFields'\n | 'tabs'\n | 'tabContent'\n | 'stages'\n | 'tasks'\n | 'banners'\n | 'utilities'\n | 'utilitiesSummaryItems'\n >,\n NoChildrenProp,\n TestIdProp,\n BaseProps {\n /** A set of props including an href that will be forwarded to the case preview's heading and subheading. */\n caseLink?: CaseViewContextValue['caseLink'];\n /** If true, the Case Preview will be visible. */\n open: boolean;\n /** Callback fired before Case Preview opens. */\n onBeforeOpen?: () => void;\n /** Callback fired after Case Preview opens. */\n onAfterOpen?: () => void;\n /** Callback fired before Case Preview closes. */\n onBeforeClose?: () => void;\n /** Callback fired after Case Preview closes. */\n onAfterClose?: () => void;\n /** Callback fired when a click action occurs outside of the Case Preview. */\n onOuterClick?: () => void;\n /** Reference to the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledPreviewHeader = styled.div(({ theme }) => {\n return css`\n z-index: ${theme.base['z-index'].drawer};\n background-color: ${theme.base.palette['primary-background']};\n `;\n});\n\nStyledPreviewHeader.defaultProps = defaultThemeProp;\n\nconst StyledPreviewActions = styled.div(\n ({\n theme: {\n base: {\n spacing,\n palette: { 'brand-primary': brandPrimary }\n }\n }\n }) => {\n const buttonColor = tryCatch(() => readableColor(brandPrimary));\n\n return css`\n background-color: ${brandPrimary};\n padding: ${spacing} calc(2 * ${spacing}) 0;\n\n button {\n color: ${buttonColor};\n }\n `;\n }\n);\n\nStyledPreviewActions.defaultProps = defaultThemeProp;\n\nconst StyledPreviewDrawer = styled(StyledCaseDrawer)(({ theme }) => {\n return css`\n height: calc(100vh - var(--appshell-offset, 0rem));\n top: var(--appshell-offset, 0);\n z-index: calc(${theme.base['z-index'].drawer} + 500);\n\n ${StyledCaseView} {\n height: calc(100vh - ${theme.base.spacing} - ${theme.base['hit-area']['mouse-min']});\n\n @media (pointer: coarse) {\n height: calc(100vh - ${theme.base.spacing} - ${theme.base['hit-area']['finger-min']});\n }\n\n ${StyledSummaryRegion} {\n position: relative;\n top: 0;\n }\n }\n\n ${StyledCaseViewContent} {\n overflow-y: auto;\n\n & > :last-child {\n padding-bottom: calc(2 * ${theme.base.spacing});\n }\n }\n `;\n});\n\nStyledPreviewDrawer.defaultProps = defaultThemeProp;\n\nconst CasePreview: FunctionComponent<CasePreviewProps & ForwardProps> = forwardRef(\n function CasePreview(props: PropsWithoutRef<CasePreviewProps>, ref: CasePreviewProps['ref']) {\n const {\n testId,\n open: openProp,\n caseId,\n heading,\n subheading,\n caseLink,\n parentCases,\n icon,\n followed,\n onFollowedChange,\n summaryFields,\n tabs,\n stages,\n tasks,\n tabContent,\n utilities,\n utilitiesSummaryItems,\n actions,\n banners,\n onEdit,\n ...restProps\n } = props;\n const testIds = useTestIds(testId, getCasePreviewTestIds);\n\n const t = useI18n();\n const { previewTriggerRef } = useContext(AppShellContext);\n const [closeButtonEl, setCloseButtonEl] = useElement<HTMLButtonElement>();\n const isSmallOrAbove = useBreakpoint('sm');\n const [open, setOpen] = useState(openProp);\n const direction = useDirection();\n\n const closePreview = useCallback(() => {\n setOpen(false);\n previewTriggerRef.current?.focus();\n }, []);\n\n useEffect(() => {\n setOpen(openProp);\n }, [openProp]);\n\n useEffect(() => {\n if (openProp && closeButtonEl) {\n closeButtonEl.focus();\n }\n }, [openProp, closeButtonEl]);\n\n return (\n <Drawer\n data-testid={testIds.root}\n {...restProps}\n as={StyledPreviewDrawer}\n role='complementary'\n forwardedAs={Flex}\n container={{ direction: 'column' }}\n ref={ref}\n open={open && isSmallOrAbove}\n position='fixed'\n placement={direction.end}\n aria-label={t('preview_of_noun', [heading])}\n shadow\n nullWhenClosed\n >\n <StyledPreviewActions>\n <Button\n data-testid={testIds.close}\n variant='simple'\n icon\n onClick={closePreview}\n ref={setCloseButtonEl}\n label={t('close_preview')}\n >\n <Icon name='times' />\n </Button>\n </StyledPreviewActions>\n\n <CaseView\n caseId={caseId}\n parentCases={parentCases}\n heading={heading}\n subheading={subheading}\n caseLink={caseLink}\n icon={icon}\n followed={followed}\n onFollowedChange={onFollowedChange}\n summaryFields={summaryFields}\n tabs={tabs}\n stages={stages}\n tasks={tasks}\n tabContent={tabContent}\n utilities={utilities}\n utilitiesSummaryItems={utilitiesSummaryItems}\n actions={actions}\n banners={banners}\n onEdit={onEdit}\n isPreview\n />\n </Drawer>\n );\n }\n);\n\nexport default withTestIds(CasePreview, getCasePreviewTestIds);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurableLayout.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/ConfigurableLayout.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AA+B1E,QAAA,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ConfigurableLayout.d.ts","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/ConfigurableLayout.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AA+B1E,QAAA,MAAM,kBAAkB,iHA+EtB,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
|
|
@@ -27,7 +27,7 @@ const StyledContainerRuler = styled.div(({ theme }) => {
|
|
|
27
27
|
`;
|
|
28
28
|
});
|
|
29
29
|
StyledContainerRuler.defaultProps = defaultThemeProp;
|
|
30
|
-
const ConfigurableLayout = forwardRef(({ items, arrangement }, ref)
|
|
30
|
+
const ConfigurableLayout = forwardRef(function ConfigurableLayout({ items, arrangement }, ref) {
|
|
31
31
|
const containerRulerRef = useRef(null);
|
|
32
32
|
const renderMode = useMemo(() => {
|
|
33
33
|
const activeArrangement = arrangement?.hasWrapped !== undefined && !arrangement.hasWrapped;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurableLayout.js","sourceRoot":"","sources":["../../../src/components/ConfigurableLayout/ConfigurableLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAwB,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE;IAC/C,OAAO,GAAG,CAAA;;GAET,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC9C,OAAO,GAAG,CAAA;;;yBAGa,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO;6BAC/B,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO;0BACtC,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO;kCACvB,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO;GAC9D,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE/C,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,OAAO,GAAG,CAAA;0BACc,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO;yBAChC,OAAO,GAAG,CAAC,MAAM,KA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KAAK,EAAE,KAAK;gCACZ,KAAK,EAAE,MAAM;gCACb,KAAK,EAAE,MAAM;gCACb,KAAK,EAAE,MAAM;gCACb,IAAI,EAAE,MAAM;6BACb,CAAC;4BAEF,MAAM,CAAC,YAAY,CAAC,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;4BAEnE,MAAM;yBACP;wBACD,KAAK,MAAM;4BACT,MAAM,CAAC,YAAY,CAAC,KAAK,GAAG,MAAM,CAAC;4BACnC,MAAM;wBACR;4BACE,MAAM,CAAC,YAAY,CAAC,KAAK,GAAG,MAAM,CAAC;4BACnC,MAAM;qBACT;iBACF;gBAED,OAAO,KAAC,UAAU,IAA0B,MAAM,EAAE,MAAM,IAAlC,GAAG,UAAU,CAAC,EAAE,EAAE,CAAoB,CAAC;YACjE,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;IAExB,OAAO,CACL,KAAC,wBAAwB,cACvB,MAAC,IAAI,IACH,EAAE,EAAE,cAAc,EAClB,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,EACtE,IAAI,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,EAAE,EAC3C,GAAG,EAAE,GAAG,aAER,KAAC,oBAAoB,IAAC,GAAG,EAAE,iBAAiB,GAAI,EAC/C,OAAO,IACH,GACkB,CAC5B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, useRef, useMemo } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { Flex, defaultThemeProp } from '@pega/cosmos-react-core';\n\nimport type { ConfigurableLayoutProps } from './ConfigurableLayout.types';\nimport { containerMinWidth, cellGap } from './defaults';\nimport widthConfigOptions from './options';\nimport LayoutCell from './LayoutCell';\n\nconst StyledConfigurableLayout = styled.div(() => {\n return css`\n overflow: hidden;\n `;\n});\n\nconst StyledCellGrid = styled.div(({ theme }) => {\n return css`\n /* Note: inset position used to negate \"column\" inline margin on items */\n position: relative;\n width: calc(100% + ${cellGap * 2} * ${theme.base.spacing});\n max-width: calc(100% + ${cellGap * 2} * ${theme.base.spacing});\n inset-inline: calc(-${cellGap} * ${theme.base.spacing});\n margin-block-end: calc(-2 * ${cellGap} * ${theme.base.spacing});\n `;\n});\nStyledCellGrid.defaultProps = defaultThemeProp;\n\nconst StyledContainerRuler = styled.div(({ theme }) => {\n return css`\n margin-inline: calc(${cellGap} * ${theme.base.spacing});\n width: calc(100% - ${cellGap * 2} * ${theme.base.spacing});\n `;\n});\nStyledContainerRuler.defaultProps = defaultThemeProp;\n\nconst ConfigurableLayout = forwardRef(function ConfigurableLayout(\n { items, arrangement }: PropsWithoutRef<ConfigurableLayoutProps>,\n ref: Ref<HTMLElement>\n) {\n const containerRulerRef = useRef<HTMLDivElement>(null);\n\n const renderMode = useMemo(() => {\n const activeArrangement = arrangement?.hasWrapped !== undefined && !arrangement.hasWrapped;\n\n if (activeArrangement) {\n switch (arrangement.size) {\n case 'main':\n return 'direct';\n case 'half':\n return 'double';\n case 'narrow':\n return 'full';\n default:\n return 'direct';\n }\n }\n\n // Use direct by default\n return 'direct';\n }, [arrangement]);\n\n const content = useMemo(() => {\n if (items && !!items.length) {\n return items.map(itemConfig => {\n const config = {\n ...itemConfig,\n layoutConfig: { ...itemConfig.layoutConfig }\n };\n\n if (renderMode !== 'direct') {\n switch (renderMode) {\n case 'double': {\n const doubleWidth: { [key: string]: keyof typeof widthConfigOptions } = {\n '1/4': '1/2',\n '1/3': '2/3',\n '1/2': 'full',\n '2/3': 'full',\n '3/4': 'full',\n full: 'full'\n };\n\n config.layoutConfig.width = doubleWidth[config.layoutConfig.width];\n\n break;\n }\n case 'full':\n config.layoutConfig.width = 'full';\n break;\n default:\n config.layoutConfig.width = 'full';\n break;\n }\n }\n\n return <LayoutCell key={`${itemConfig.id}`} config={config} />;\n });\n }\n\n return null;\n }, [items, renderMode]);\n\n return (\n <StyledConfigurableLayout>\n <Flex\n as={StyledCellGrid}\n container={{ wrap: 'wrap', justify: 'stretch', alignItems: 'stretch' }}\n item={{ basis: containerMinWidth, grow: 1 }}\n ref={ref}\n >\n <StyledContainerRuler ref={containerRulerRef} />\n {content}\n </Flex>\n </StyledConfigurableLayout>\n );\n});\n\nexport default ConfigurableLayout;\n"]}
|
|
@@ -14,7 +14,7 @@ const StyledConfirmationDetails = styled.div(() => {
|
|
|
14
14
|
}
|
|
15
15
|
`;
|
|
16
16
|
});
|
|
17
|
-
const Confirmation = forwardRef(({ title, details, whatsNext, tasks, onClose, ...restProps }, ref)
|
|
17
|
+
const Confirmation = forwardRef(function Confirmation({ title, details, whatsNext, tasks, onClose, ...restProps }, ref) {
|
|
18
18
|
const t = useI18n();
|
|
19
19
|
const detailsContext = useContext(DetailsContext);
|
|
20
20
|
const detailsCtxValue = useMemo(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Confirmation.js","sourceRoot":"","sources":["../../../src/components/Confirmation/Confirmation.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAKV,UAAU,EACV,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,WAAW,EAEX,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,MAAM,EACN,gBAAgB,EAGhB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEvF,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;;CAEhD,CAAC;AAEF,mBAAmB,CAAC,YA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o\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Card,\n CardContent,\n ForwardProps,\n Flex,\n Text,\n useI18n,\n UnorderedList,\n Button,\n defaultThemeProp,\n UnorderedListProps,\n NoChildrenProp,\n VisuallyHiddenText\n} from '@pega/cosmos-react-core';\n\nimport { StyledDetails, StyledFieldValueGroupLabel, DetailsContext } from '../Details';\n\nconst StyledWhatsNextList = styled(UnorderedList)`\n padding-inline-start: 0;\n`;\n\nStyledWhatsNextList.defaultProps = defaultThemeProp;\n\nexport interface ConfirmationProps extends NoChildrenProp {\n /** The title of the confirmation */\n title?: string;\n /** Region for a Field Value List component */\n details?: ReactNode;\n /** Array of React nodes to be put into a list */\n whatsNext?: UnorderedListProps['items'];\n /** Region for a Tasks component */\n tasks?: ReactNode;\n /** Called when the done/close button is clicked */\n onClose?: () => void;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLElement>;\n}\n\nconst StyledConfirmationDetails = styled.div(() => {\n return css`\n > ${StyledDetails} > ${StyledFieldValueGroupLabel}:first-child {\n margin-block-start: 0;\n }\n `;\n});\n\nconst Confirmation: FunctionComponent<ConfirmationProps & ForwardProps> = forwardRef(\n function Confirmation(\n { title, details, whatsNext, tasks, onClose, ...restProps }: PropsWithoutRef<ConfirmationProps>,\n ref\n ) {\n const t = useI18n();\n const detailsContext = useContext(DetailsContext);\n\n const detailsCtxValue = useMemo(() => {\n return {\n ...detailsContext,\n depth: 4\n };\n }, [detailsContext]);\n\n return (\n <Card {...restProps} ref={ref}>\n <CardContent>\n <Flex container={{ gap: 3, direction: 'column' }}>\n {title && <Text variant='h3'>{title}</Text>}\n\n {details && (\n <DetailsContext.Provider value={detailsCtxValue}>\n <StyledConfirmationDetails>{details}</StyledConfirmationDetails>\n </DetailsContext.Provider>\n )}\n\n {whatsNext && (\n <Flex container={{ gap: 1, direction: 'column' }}>\n <Text variant='h4'>{t('confirmation_whats_next')}</Text>\n <StyledWhatsNextList items={whatsNext} as={StyledWhatsNextList} />\n </Flex>\n )}\n\n {tasks}\n\n {onClose && (\n <Flex container={{ justify: 'end' }}>\n <Button onClick={onClose} variant='primary'>\n {t('done')}\n {title ? <VisuallyHiddenText>{`- ${title}`}</VisuallyHiddenText> : null}\n </Button>\n </Flex>\n )}\n </Flex>\n </CardContent>\n </Card>\n );\n }\n);\n\nexport default Confirmation;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Details.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,EAEF,SAAS,EACT,GAAG,EAKJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAKL,YAAY,EAQb,MAAM,yBAAyB,CAAC;AAWjC,MAAM,WAAW,YAAY;IAC3B,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAED,QAAA,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"Details.d.ts","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,EAEF,SAAS,EACT,GAAG,EAKJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAKL,YAAY,EAQb,MAAM,yBAAyB,CAAC;AAWjC,MAAM,WAAW,YAAY;IAC3B,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAED,QAAA,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,GAAG,YAAY,CA8K3C,CAAC;AAEH,eAAe,OAAO,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { remToPx } from 'polished';
|
|
|
4
4
|
import { Text, useBreakpoint, useConsolidatedRef, useTheme, ExpandCollapse, Button, Flex, Icon, useChToPxConversionFactor, useI18n } from '@pega/cosmos-react-core';
|
|
5
5
|
import DetailsContext from './DetailsContext';
|
|
6
6
|
import { StyledFieldValueGroupLabel, StyledDetails, StyledDetailList, StyledHighlightedDetailList, flexGapProp } from './Details.styles';
|
|
7
|
-
const Details = forwardRef(({ highlightedData, children, name, columnCount = 1, nested = false, asFlex = false, valueComparison = false, collapsible = false }, ref)
|
|
7
|
+
const Details = forwardRef(function Details({ highlightedData, children, name, columnCount = 1, nested = false, asFlex = false, valueComparison = false, collapsible = false }, ref) {
|
|
8
8
|
const { longestLabelLength, mobileView: inMobileView, depth, ...context } = useContext(DetailsContext);
|
|
9
9
|
const { base: { 'content-width': { sm: smContentWidth } } } = useTheme();
|
|
10
10
|
const isSmallOrAbove = useBreakpoint('sm');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Details.js","sourceRoot":"","sources":["../../../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1C,MAAC,aAAa,eACX,IAAI,IAAI,CACP,KAAC,0BAA0B,cACxB,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;4BACZ,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;wBACvB,CAAC,mBACc,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,gBAC1B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC,YAE7D,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAC,MAAM,aAC5D,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,EAC1B,QAAQ,IACJ,GACA,CACV,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,GAC0B,CAC9B,EAEA,WAAW,CAAC,CAAC,CAAC,KAAC,cAAc,IAAC,SAAS,EAAE,CAAC,IAAI,YAAG,OAAO,GAAkB,CAAC,CAAC,CAAC,OAAO,IACvE,GACQ,CAC3B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import {\n forwardRef,\n FC,\n Fragment,\n ReactNode,\n Ref,\n useState,\n useContext,\n useEffect,\n useMemo\n} from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n Text,\n useBreakpoint,\n useConsolidatedRef,\n useTheme,\n ForwardProps,\n ExpandCollapse,\n Button,\n Flex,\n Icon,\n useChToPxConversionFactor,\n useI18n,\n HeadingTag\n} from '@pega/cosmos-react-core';\n\nimport DetailsContext from './DetailsContext';\nimport {\n StyledFieldValueGroupLabel,\n StyledDetails,\n StyledDetailList,\n StyledHighlightedDetailList,\n flexGapProp\n} from './Details.styles';\n\nexport interface DetailsProps {\n highlightedData?: ReactNode[];\n children?: ReactNode;\n /** Text used as heading of list */\n name?: string;\n /**\n * Whether the items children can be collapsed (only applies if name is provided)\n * @default false\n */\n collapsible?: boolean;\n /**\n * Number of columns in detail layout\n * @default 1\n */\n columnCount?: 1 | 2 | 3;\n /** Whether detail list is rendering within another detail list\n * @default false\n */\n nested?: boolean;\n /** Whether detail list is rendering multiple sub-lists in columns (passed as children)\n * @default false\n */\n asFlex?: boolean;\n /** Whether to apply `value-comparison` styles to list items\n * @default false\n */\n valueComparison?: boolean;\n ref?: Ref<HTMLDListElement>;\n}\n\nconst Details: FC<DetailsProps & ForwardProps> = forwardRef(\n (\n {\n highlightedData,\n children,\n name,\n columnCount = 1,\n nested = false,\n asFlex = false,\n valueComparison = false,\n collapsible = false\n },\n ref\n ) => {\n const {\n longestLabelLength,\n mobileView: inMobileView,\n depth,\n ...context\n } = useContext(DetailsContext);\n const {\n base: {\n 'content-width': { sm: smContentWidth }\n }\n } = useTheme();\n const isSmallOrAbove = useBreakpoint('sm');\n const listRef = useConsolidatedRef<HTMLDListElement>(ref);\n const isXsContentWidthOrAbove = useBreakpoint('xs', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const isMdContentWidthOrAbove = useBreakpoint('md', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const flexRow = useBreakpoint(columnCount > 2 ? 'lg' : 'md', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const t = useI18n();\n\n const [flexContextMobileView, setFlexContextMobileView] = useState(false);\n const [open, setOpen] = useState(true);\n\n const labelLength = Math.max(14, Math.min(longestLabelLength ?? 16, 40));\n const headingDepth = depth ?? 1;\n const applyMobileView =\n inMobileView ||\n !isSmallOrAbove ||\n !isXsContentWidthOrAbove ||\n (asFlex && flexRow && flexContextMobileView);\n\n const chToPxConversionFactor = useChToPxConversionFactor();\n\n // Mount resize observer to update flex context mobile view & run initial check.\n useEffect(() => {\n const checkBreakpoint = (elementWidth: number) => {\n const minWidthPx = parseInt(smContentWidth, 10) * chToPxConversionFactor;\n const oneRemInPx = parseInt(remToPx(1), 10);\n const colGapPxAllowance = oneRemInPx * (0.5 * flexGapProp) * (columnCount - 1);\n const mobileViewBreakpoint = minWidthPx * columnCount + colGapPxAllowance;\n\n setFlexContextMobileView(elementWidth < mobileViewBreakpoint);\n };\n const resizeObserver = new ResizeObserver(entries => {\n const containerPxWidth = entries[0].contentRect.width;\n checkBreakpoint(containerPxWidth);\n });\n\n if (listRef.current) {\n checkBreakpoint(listRef.current.offsetWidth);\n resizeObserver.observe(listRef.current);\n }\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [listRef, columnCount]);\n\n const contextValue = useMemo(() => {\n return {\n mobileView: applyMobileView,\n depth: name ? headingDepth + 1 : headingDepth,\n longestLabelLength,\n ...context\n };\n }, [applyMobileView, name, headingDepth, longestLabelLength, context]);\n\n const nameText = useMemo(() => {\n return <Text variant={`h${Math.min(headingDepth, 6)}` as HeadingTag}>{name}</Text>;\n }, [name, headingDepth]);\n\n const details = useMemo(() => {\n return (\n <>\n {highlightedData && (\n <>\n <Flex\n as={StyledHighlightedDetailList}\n forwardedAs={nested ? 'div' : 'dl'}\n container={{ wrap: 'wrap', colGap: 10, rowGap: 1, alignItems: 'start' }}\n >\n {highlightedData.map((child, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={i}>{child}</Fragment>\n ))}\n </Flex>\n\n <hr />\n </>\n )}\n\n {children ? (\n <StyledDetailList\n ref={listRef}\n as={nested ? 'div' : 'dl'}\n columnCount={columnCount}\n labelLength={labelLength}\n stacked={applyMobileView}\n nested={nested}\n flex={asFlex}\n wrapped={asFlex ? !flexRow : false}\n variant={valueComparison ? 'value-comparison' : undefined}\n narrow={!isMdContentWidthOrAbove}\n >\n {children}\n </StyledDetailList>\n ) : null}\n </>\n );\n }, [\n highlightedData,\n nested,\n columnCount,\n labelLength,\n applyMobileView,\n name,\n asFlex,\n flexRow,\n valueComparison,\n children\n ]);\n\n if (!name && !children && !highlightedData) return null;\n\n return (\n <DetailsContext.Provider value={contextValue}>\n <StyledDetails>\n {name && (\n <StyledFieldValueGroupLabel>\n {collapsible ? (\n <Button\n type='button'\n variant='text'\n onClick={() => {\n setOpen(cur => !cur);\n }}\n aria-expanded={open ? 'true' : 'false'}\n aria-label={t(open ? 'collapse_noun' : 'expand_noun', [name])}\n >\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as='span'>\n <Icon name='caret-right' />\n {nameText}\n </Flex>\n </Button>\n ) : (\n nameText\n )}\n </StyledFieldValueGroupLabel>\n )}\n\n {collapsible ? <ExpandCollapse collapsed={!open}>{details}</ExpandCollapse> : details}\n </StyledDetails>\n </DetailsContext.Provider>\n );\n }\n);\n\nexport default Details;\n"]}
|
|
1
|
+
{"version":3,"file":"Details.js","sourceRoot":"","sources":["../../../src/components/Details/Details.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAEV,QAAQ,EAGR,QAAQ,EACR,UAAU,EACV,SAAS,EACT,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,IAAI,EACJ,aAAa,EACb,kBAAkB,EAClB,QAAQ,EAER,cAAc,EACd,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,yBAAyB,EACzB,OAAO,EAER,MAAM,yBAAyB,CAAC;AAEjC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,gBAAgB,EAChB,2BAA2B,EAC3B,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAgC1B,MAAM,OAAO,GAAoC,UAAU,CAAC,SAAS,OAAO,CAC1E,EACE,eAAe,EACf,QAAQ,EACR,IAAI,EACJ,WAAW,GAAG,CAAC,EACf,MAAM,GAAG,KAAK,EACd,MAAM,GAAG,KAAK,EACd,eAAe,GAAG,KAAK,EACvB,WAAW,GAAG,KAAK,EACp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AAC,cAAc,IAAC,SAAS,EAAE,CAAC,IAAI,YAAG,OAAO,GAAkB,CAAC,CAAC,CAAC,OAAO,IACvE,GACQ,CAC3B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,OAAO,CAAC","sourcesContent":["import {\n forwardRef,\n FC,\n Fragment,\n ReactNode,\n Ref,\n useState,\n useContext,\n useEffect,\n useMemo\n} from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n Text,\n useBreakpoint,\n useConsolidatedRef,\n useTheme,\n ForwardProps,\n ExpandCollapse,\n Button,\n Flex,\n Icon,\n useChToPxConversionFactor,\n useI18n,\n HeadingTag\n} from '@pega/cosmos-react-core';\n\nimport DetailsContext from './DetailsContext';\nimport {\n StyledFieldValueGroupLabel,\n StyledDetails,\n StyledDetailList,\n StyledHighlightedDetailList,\n flexGapProp\n} from './Details.styles';\n\nexport interface DetailsProps {\n highlightedData?: ReactNode[];\n children?: ReactNode;\n /** Text used as heading of list */\n name?: string;\n /**\n * Whether the items children can be collapsed (only applies if name is provided)\n * @default false\n */\n collapsible?: boolean;\n /**\n * Number of columns in detail layout\n * @default 1\n */\n columnCount?: 1 | 2 | 3;\n /** Whether detail list is rendering within another detail list\n * @default false\n */\n nested?: boolean;\n /** Whether detail list is rendering multiple sub-lists in columns (passed as children)\n * @default false\n */\n asFlex?: boolean;\n /** Whether to apply `value-comparison` styles to list items\n * @default false\n */\n valueComparison?: boolean;\n ref?: Ref<HTMLDListElement>;\n}\n\nconst Details: FC<DetailsProps & ForwardProps> = forwardRef(function Details(\n {\n highlightedData,\n children,\n name,\n columnCount = 1,\n nested = false,\n asFlex = false,\n valueComparison = false,\n collapsible = false\n },\n ref\n) {\n const {\n longestLabelLength,\n mobileView: inMobileView,\n depth,\n ...context\n } = useContext(DetailsContext);\n const {\n base: {\n 'content-width': { sm: smContentWidth }\n }\n } = useTheme();\n const isSmallOrAbove = useBreakpoint('sm');\n const listRef = useConsolidatedRef<HTMLDListElement>(ref);\n const isXsContentWidthOrAbove = useBreakpoint('xs', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const isMdContentWidthOrAbove = useBreakpoint('md', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const flexRow = useBreakpoint(columnCount > 2 ? 'lg' : 'md', {\n breakpointRef: listRef,\n themeProp: 'content-width'\n });\n const t = useI18n();\n\n const [flexContextMobileView, setFlexContextMobileView] = useState(false);\n const [open, setOpen] = useState(true);\n\n const labelLength = Math.max(14, Math.min(longestLabelLength ?? 16, 40));\n const headingDepth = depth ?? 1;\n const applyMobileView =\n inMobileView ||\n !isSmallOrAbove ||\n !isXsContentWidthOrAbove ||\n (asFlex && flexRow && flexContextMobileView);\n\n const chToPxConversionFactor = useChToPxConversionFactor();\n\n // Mount resize observer to update flex context mobile view & run initial check.\n useEffect(() => {\n const checkBreakpoint = (elementWidth: number) => {\n const minWidthPx = parseInt(smContentWidth, 10) * chToPxConversionFactor;\n const oneRemInPx = parseInt(remToPx(1), 10);\n const colGapPxAllowance = oneRemInPx * (0.5 * flexGapProp) * (columnCount - 1);\n const mobileViewBreakpoint = minWidthPx * columnCount + colGapPxAllowance;\n\n setFlexContextMobileView(elementWidth < mobileViewBreakpoint);\n };\n const resizeObserver = new ResizeObserver(entries => {\n const containerPxWidth = entries[0].contentRect.width;\n checkBreakpoint(containerPxWidth);\n });\n\n if (listRef.current) {\n checkBreakpoint(listRef.current.offsetWidth);\n resizeObserver.observe(listRef.current);\n }\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [listRef, columnCount]);\n\n const contextValue = useMemo(() => {\n return {\n mobileView: applyMobileView,\n depth: name ? headingDepth + 1 : headingDepth,\n longestLabelLength,\n ...context\n };\n }, [applyMobileView, name, headingDepth, longestLabelLength, context]);\n\n const nameText = useMemo(() => {\n return <Text variant={`h${Math.min(headingDepth, 6)}` as HeadingTag}>{name}</Text>;\n }, [name, headingDepth]);\n\n const details = useMemo(() => {\n return (\n <>\n {highlightedData && (\n <>\n <Flex\n as={StyledHighlightedDetailList}\n forwardedAs={nested ? 'div' : 'dl'}\n container={{ wrap: 'wrap', colGap: 10, rowGap: 1, alignItems: 'start' }}\n >\n {highlightedData.map((child, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={i}>{child}</Fragment>\n ))}\n </Flex>\n\n <hr />\n </>\n )}\n\n {children ? (\n <StyledDetailList\n ref={listRef}\n as={nested ? 'div' : 'dl'}\n columnCount={columnCount}\n labelLength={labelLength}\n stacked={applyMobileView}\n nested={nested}\n flex={asFlex}\n wrapped={asFlex ? !flexRow : false}\n variant={valueComparison ? 'value-comparison' : undefined}\n narrow={!isMdContentWidthOrAbove}\n >\n {children}\n </StyledDetailList>\n ) : null}\n </>\n );\n }, [\n highlightedData,\n nested,\n columnCount,\n labelLength,\n applyMobileView,\n name,\n asFlex,\n flexRow,\n valueComparison,\n children\n ]);\n\n if (!name && !children && !highlightedData) return null;\n\n return (\n <DetailsContext.Provider value={contextValue}>\n <StyledDetails>\n {name && (\n <StyledFieldValueGroupLabel>\n {collapsible ? (\n <Button\n type='button'\n variant='text'\n onClick={() => {\n setOpen(cur => !cur);\n }}\n aria-expanded={open ? 'true' : 'false'}\n aria-label={t(open ? 'collapse_noun' : 'expand_noun', [name])}\n >\n <Flex container={{ alignItems: 'center', gap: 0.5 }} as='span'>\n <Icon name='caret-right' />\n {nameText}\n </Flex>\n </Button>\n ) : (\n nameText\n )}\n </StyledFieldValueGroupLabel>\n )}\n\n {collapsible ? <ExpandCollapse collapsed={!open}>{details}</ExpandCollapse> : details}\n </StyledDetails>\n </DetailsContext.Provider>\n );\n});\n\nexport default Details;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Glimpse.d.ts","sourceRoot":"","sources":["../../../src/components/Glimpse/Glimpse.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,iBAAiB,EAEjB,GAAG,EACJ,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,SAAS,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AE,MAAM,CAAC;IACX,qDAAqD;IACrD,OAAO,CAAC,EAAE,wBAAwB,CAAC;IACnC,qDAAqD;IACrD,MAAM,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACvC,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,oGAAoG;IACpG,aAAa,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACrD,gGAAgG;IAChG,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC5B;AAED,QAAA,MAAM,OAAO,EAAE,iBAAiB,CAAC,YAAY,GAAG,YAAY,CAyC1D,CAAC;AAEH,eAAe,OAAO,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { Button, FieldValueList, Flex, InfoDialog, useI18n } from '@pega/cosmos-react-core';
|
|
4
|
-
const Glimpse = forwardRef(({ heading, fields = [], target, onDismiss, href, progress, onViewProfile, ...restProps }, ref)
|
|
4
|
+
const Glimpse = forwardRef(function Glimpse({ heading, fields = [], target, onDismiss, href, progress, onViewProfile, ...restProps }, ref) {
|
|
5
5
|
const t = useI18n();
|
|
6
6
|
return (_jsx(InfoDialog, { ...restProps, target: target, heading: heading, progress: progress, onDismiss: onDismiss, ref: ref, children: _jsxs(Flex, { container: { direction: 'column', alignItems: 'start', gap: 2 }, children: [fields.length > 0 && _jsx(FieldValueList, { fields: fields }), (onViewProfile || href) && (_jsx(Button, { href: href, onClick: (e) => {
|
|
7
7
|
onViewProfile?.(e);
|