@pega/cosmos-react-wss 9.11.0 → 9.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.js +33 -5
- package/lib/components/CaseView/CaseView.js.map +1 -1
- package/lib/components/CaseView/CaseView.styles.d.ts +6 -0
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +56 -6
- package/lib/components/CaseView/CaseView.styles.js.map +1 -1
- package/lib/components/CaseView/CaseView.types.d.ts +2 -0
- package/lib/components/CaseView/CaseView.types.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.types.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CaseView.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AAqB7D,OAAO,KAAK,EAAE,YAAY,EAAO,MAAM,yBAAyB,CAAC;AAYjE,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,kBAAkB,CAAC;AAE9D,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,GAAG,YAAY,CAyS9C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,12 +1,40 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { parseToHsl } from 'polished';
|
|
2
3
|
import { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { useBreakpoint, Card, CardContent, Flex, Tabs, TabPanel, Text, MenuButton, useI18n, Icon, useAfterInitialEffect, getEdge, useDirection, throttle } from '@pega/cosmos-react-core';
|
|
4
|
+
import { useBreakpoint, Card, CardContent, Flex, Tabs, TabPanel, Text, MenuButton, useI18n, Icon, useAfterInitialEffect, getEdge, useDirection, throttle, readableColor, tryCatch, useTheme } from '@pega/cosmos-react-core';
|
|
4
5
|
import { StyledCaseHeaderPromotedAction } from '@pega/cosmos-react-work/lib/components/CaseView/CaseView.styles';
|
|
5
|
-
import { StyledAside, StyledCaseHeader, StyledCaseView, StyledContentContainer, StyledContent } from './CaseView.styles';
|
|
6
|
-
const CaseView = ({ caseId, heading, actions, stages, tasks, summary, details, feed, utility, promotedActions = [], ...restProps }) => {
|
|
6
|
+
import { StyledAside, StyledCaseHeader, StyledCaseView, StyledCaseViewIcon, StyledContentContainer, StyledContent, resolveCaseTypeColor } from './CaseView.styles';
|
|
7
|
+
const CaseView = ({ caseId, heading, icon, color, actions, stages, tasks, summary, details, feed, utility, promotedActions = [], ...restProps }) => {
|
|
7
8
|
const isMediumOrAbove = useBreakpoint('md');
|
|
8
9
|
const t = useI18n();
|
|
9
10
|
const tabsRef = useRef(null);
|
|
11
|
+
const theme = useTheme();
|
|
12
|
+
const { iconForeground, iconBackground } = useMemo(() => {
|
|
13
|
+
const backgroundSetting = theme.components['case-view'].icon.background;
|
|
14
|
+
const foregroundSetting = theme.components['case-view'].icon.color;
|
|
15
|
+
const headerForeground = theme.components['case-view'].header['foreground-color'];
|
|
16
|
+
const headerBackground = theme.components['case-view'].header.background;
|
|
17
|
+
const resolvedIconBackground = backgroundSetting !== 'auto'
|
|
18
|
+
? backgroundSetting
|
|
19
|
+
: tryCatch(() => {
|
|
20
|
+
const { lightness } = parseToHsl(headerBackground);
|
|
21
|
+
return lightness > 0.35 ? 'rgba(0, 0, 0, 0.2)' : 'rgba(255, 255, 255, 0.2)';
|
|
22
|
+
}, () => 'transparent') ?? 'transparent';
|
|
23
|
+
let resolvedIconForeground = foregroundSetting !== 'auto' ? foregroundSetting : headerForeground;
|
|
24
|
+
if (resolvedIconForeground === 'auto') {
|
|
25
|
+
const caseTypeIconColor = color && theme.base['case-type-colors'] !== 'ignored'
|
|
26
|
+
? resolveCaseTypeColor(theme, color)
|
|
27
|
+
: resolvedIconBackground;
|
|
28
|
+
resolvedIconForeground = readableColor(caseTypeIconColor ?? resolvedIconBackground, {
|
|
29
|
+
mode: 'light',
|
|
30
|
+
level: 'AANonText'
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
iconForeground: resolvedIconForeground,
|
|
35
|
+
iconBackground: resolvedIconBackground
|
|
36
|
+
};
|
|
37
|
+
}, [theme, color]);
|
|
10
38
|
const tabs = useMemo(() => {
|
|
11
39
|
if (isMediumOrAbove)
|
|
12
40
|
return [];
|
|
@@ -73,13 +101,13 @@ const CaseView = ({ caseId, heading, actions, stages, tasks, summary, details, f
|
|
|
73
101
|
resizeObserver.disconnect();
|
|
74
102
|
};
|
|
75
103
|
}, [contentEl, actionsContainerEl, headerEl, promotedActions, heading, wrapPromotedActions]);
|
|
76
|
-
return (_jsxs(StyledCaseView, { ...restProps, children: [_jsx(StyledCaseHeader, { computeButtonFgColor: !isMediumOrAbove || promotedActions.length > 0, children: _jsxs(Flex, { container: {
|
|
104
|
+
return (_jsxs(StyledCaseView, { ...restProps, children: [_jsx(StyledCaseHeader, { computeButtonFgColor: !isMediumOrAbove || promotedActions.length > 0, "$color": color, children: _jsxs(Flex, { container: {
|
|
77
105
|
direction: 'column',
|
|
78
106
|
justify: 'between',
|
|
79
107
|
pad: 2,
|
|
80
108
|
alignItems: 'center',
|
|
81
109
|
gap: 2
|
|
82
|
-
}, ref: contentEl, as: StyledContentContainer, children: [_jsxs(Flex, { container: { justify: 'between', alignItems: 'center', gap: 2 }, item: { grow: 1 }, children: [_jsx(Text, { variant: 'h1', ref: headerEl, children: heading }), (promotedActions.length > 0 || actions) && (_jsxs(Flex, { container: {
|
|
110
|
+
}, ref: contentEl, as: StyledContentContainer, children: [_jsxs(Flex, { container: { justify: 'between', alignItems: 'center', gap: 2 }, item: { grow: 1 }, children: [_jsxs(Flex, { container: { alignItems: 'center', gap: 2 }, item: { grow: 2 }, children: [icon && (_jsx(StyledCaseViewIcon, { name: icon, "$caseTypeColor": color, foreground: iconForeground, background: iconBackground })), _jsx(Text, { variant: 'h1', ref: headerEl, children: heading })] }), (promotedActions.length > 0 || actions) && (_jsxs(Flex, { container: {
|
|
83
111
|
gap: 1
|
|
84
112
|
}, ref: actionsContainerEl, children: [!wrapPromotedActions &&
|
|
85
113
|
promotedActions.map(action => (_jsx(StyledCaseHeaderPromotedAction, { variant: 'secondary', onClick: (e) => action.onClick?.(action.id, e), children: action.text }, action.id))), actions && actions.length > 0 && (_jsx(MenuButton, { icon: promotedActions.length > 0 || !isMediumOrAbove ? 'more' : undefined, iconOnly: promotedActions.length > 0 || !isMediumOrAbove, variant: 'simple', text: t('actions'), "aria-label": t('actions_for', [caseId]), menu: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGnE,OAAO,EACL,aAAa,EACb,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,OAAO,EACP,IAAI,EACJ,qBAAqB,EACrB,OAAO,EACP,YAAY,EACZ,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,8BAA8B,EAAE,MAAM,iEAAiE,CAAC;AAEjH,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,aAAa,EACd,MAAM,mBAAmB,CAAC;AAG3B,MAAM,QAAQ,GAAqC,CAAC,EAClD,MAAM,EACN,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,EACL,OAAO,EACP,OAAO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Aa,IAAI,EAAE,KAAK,YACvC,IAAI,CAAC,OAAO,GACT,CACP,IACI,IACF,CACR,IACI,IACQ,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import { useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport type { FC, MouseEvent, PropsWithoutRef } from 'react';\n\nimport {\n useBreakpoint,\n Card,\n CardContent,\n Flex,\n Tabs,\n TabPanel,\n Text,\n MenuButton,\n useI18n,\n Icon,\n useAfterInitialEffect,\n getEdge,\n useDirection,\n throttle\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps, Tab } from '@pega/cosmos-react-core';\nimport { StyledCaseHeaderPromotedAction } from '@pega/cosmos-react-work/lib/components/CaseView/CaseView.styles';\n\nimport {\n StyledAside,\n StyledCaseHeader,\n StyledCaseView,\n StyledContentContainer,\n StyledContent\n} from './CaseView.styles';\nimport type { CaseViewProps, Region } from './CaseView.types';\n\nconst CaseView: FC<CaseViewProps & ForwardProps> = ({\n caseId,\n heading,\n actions,\n stages,\n tasks,\n summary,\n details,\n feed,\n utility,\n promotedActions = [],\n ...restProps\n}: PropsWithoutRef<CaseViewProps>) => {\n const isMediumOrAbove = useBreakpoint('md');\n const t = useI18n();\n const tabsRef = useRef<HTMLElement>(null);\n\n const tabs = useMemo(() => {\n if (isMediumOrAbove) return [];\n const tabsArr: { name: Tab['name']; content: Region['content'] }[] = [];\n\n if (summary)\n tabsArr.push({\n name: 'Summary',\n content: summary.content\n });\n if (details) tabsArr.push({ name: details.label, content: details.content });\n if (feed) tabsArr.push({ name: 'Feed', content: feed.content });\n if (utility)\n tabsArr.push({\n name: 'Utility',\n content: utility.content\n });\n\n return tabsArr.map(tab => ({ ...tab, id: tab.name }));\n }, [isMediumOrAbove, summary, details, feed, utility]);\n\n const [currentTabId, setCurrentTabId] = useState(tabs && tabs.length > 0 ? tabs[0].id : null);\n const [wrapPromotedActions, setWrapPromotedActions] = useState(false);\n const actionsContainerEl = useRef<HTMLDivElement>(null);\n const contentEl = useRef<HTMLDivElement>(null);\n const headerEl = useRef<HTMLDivElement>(null);\n const wrapActionsBreakpoint = useRef<number | null>(null);\n const { ltr } = useDirection();\n\n useAfterInitialEffect(() => {\n if (tabs.length > 0) setCurrentTabId(cur => cur ?? tabs[0].id);\n }, [tabs]);\n\n useLayoutEffect(() => {\n if (\n !wrapPromotedActions &&\n contentEl.current &&\n actionsContainerEl.current &&\n headerEl.current\n ) {\n const contentStart = getEdge({\n el: contentEl.current,\n side: 'leading',\n ltr\n });\n\n const headerGroupEnd = getEdge({\n el: headerEl.current,\n side: 'trailing',\n ltr\n });\n const actionsContainerWidth = actionsContainerEl.current.getBoundingClientRect().width;\n\n wrapActionsBreakpoint.current =\n Math.abs(Math.ceil(contentStart) - Math.ceil(headerGroupEnd)) +\n Math.ceil(actionsContainerWidth);\n }\n\n const promotedActionsWrapHandler = () => {\n if (wrapActionsBreakpoint.current && contentEl.current) {\n const availableWidth = Math.ceil(contentEl.current.offsetWidth) - 20;\n setWrapPromotedActions(availableWidth < wrapActionsBreakpoint.current);\n }\n };\n\n const resizeObserver = new ResizeObserver(throttle(promotedActionsWrapHandler, 30));\n promotedActionsWrapHandler();\n\n if (contentEl.current) {\n resizeObserver.observe(contentEl.current, { box: 'border-box' });\n }\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [contentEl, actionsContainerEl, headerEl, promotedActions, heading, wrapPromotedActions]);\n\n return (\n <StyledCaseView {...restProps}>\n <StyledCaseHeader computeButtonFgColor={!isMediumOrAbove || promotedActions.length > 0}>\n <Flex\n container={{\n direction: 'column',\n justify: 'between',\n pad: 2,\n alignItems: 'center',\n gap: 2\n }}\n ref={contentEl}\n as={StyledContentContainer}\n >\n <Flex container={{ justify: 'between', alignItems: 'center', gap: 2 }} item={{ grow: 1 }}>\n <Text variant='h1' ref={headerEl}>\n {heading}\n </Text>\n\n {(promotedActions.length > 0 || actions) && (\n <Flex\n container={{\n gap: 1\n }}\n ref={actionsContainerEl}\n >\n {!wrapPromotedActions &&\n promotedActions.map(action => (\n <StyledCaseHeaderPromotedAction\n variant='secondary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => action.onClick?.(action.id, e)}\n key={action.id}\n >\n {action.text}\n </StyledCaseHeaderPromotedAction>\n ))}\n {actions && actions.length > 0 && (\n <MenuButton\n icon={promotedActions.length > 0 || !isMediumOrAbove ? 'more' : undefined}\n iconOnly={promotedActions.length > 0 || !isMediumOrAbove}\n variant='simple'\n text={t('actions')}\n aria-label={t('actions_for', [caseId])}\n menu={{\n items: actions.map(action => ({\n ...action,\n primary: action.text,\n visual: action.icon ? <Icon name={action.icon} /> : undefined\n })),\n scrollAt: 20\n }}\n />\n )}\n </Flex>\n )}\n </Flex>\n\n {wrapPromotedActions && promotedActions.length > 0 && (\n <Flex\n item={{ grow: 1 }}\n container={{\n justify: 'start',\n gap: 1,\n alignItems: 'center',\n wrap: 'wrap'\n }}\n >\n {promotedActions.map(action => (\n <StyledCaseHeaderPromotedAction\n variant='secondary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => action.onClick?.(action.id, e)}\n key={action.id}\n >\n {action.text}\n </StyledCaseHeaderPromotedAction>\n ))}\n </Flex>\n )}\n </Flex>\n </StyledCaseHeader>\n\n <Flex container={{ direction: 'column', gap: 2, pad: 2 }} as={StyledContentContainer}>\n {stages?.content}\n {tabs.length > 0 && currentTabId && (\n <>\n {tasks?.content}\n <div>\n <Tabs\n tabs={tabs}\n onTabClick={setCurrentTabId}\n currentTabId={currentTabId}\n ref={tabsRef}\n />\n\n {tabs.map(tab => (\n <TabPanel\n tabId={tab.id}\n currentTabId={currentTabId}\n key={tab.id}\n tablistRef={tabsRef}\n >\n <StyledContent>{tab.content}</StyledContent>\n </TabPanel>\n ))}\n </div>\n </>\n )}\n\n {tabs.length === 0 && (\n <Flex container={{ gap: 2 }}>\n {(utility || summary) && (\n <Flex as={StyledAside} container={{ direction: 'column', gap: 2 }}>\n {summary?.content && (\n <div role='region' aria-label={summary?.label}>\n {summary?.content}\n </div>\n )}\n {utility?.content && (\n <div role='region' aria-label={utility?.label}>\n {utility?.content}\n </div>\n )}\n </Flex>\n )}\n <Flex container={{ direction: 'column', gap: 2 }} item={{ grow: 1 }}>\n {tasks?.content && (\n <div role='region' aria-label={tasks?.label}>\n {tasks.content}\n </div>\n )}\n {details?.content && (\n <div role='region' aria-label={details?.label}>\n <Card>\n <CardContent>\n <StyledContent>{details?.content}</StyledContent>\n </CardContent>\n </Card>\n </div>\n )}\n {feed?.content && (\n <div role='region' aria-label={feed?.label}>\n {feed.content}\n </div>\n )}\n </Flex>\n </Flex>\n )}\n </Flex>\n </StyledCaseView>\n );\n};\n\nexport default CaseView;\n"]}
|
|
1
|
+
{"version":3,"file":"CaseView.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGnE,OAAO,EACL,aAAa,EACb,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,OAAO,EACP,IAAI,EACJ,qBAAqB,EACrB,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,8BAA8B,EAAE,MAAM,iEAAiE,CAAC;AAEjH,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,QAAQ,GAAqC,CAAC,EAClD,MAAM,EACN,OAAO,EACP,IAAI,EACJ,KAAK,EACL,OAAO,EACP,MAAM,EACN,KAAK,EACL,OAAO,EACP,OAAO,EACP,IAAI,EACJ,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SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,aAChE,KAAK,EAAE,OAAO,IAAI,CACjB,cAAK,IAAI,EAAC,QAAQ,gBAAa,KAAK,EAAE,KAAK,YACxC,KAAK,CAAC,OAAO,GACV,CACP,EACA,OAAO,EAAE,OAAO,IAAI,CACnB,cAAK,IAAI,EAAC,QAAQ,gBAAa,OAAO,EAAE,KAAK,YAC3C,KAAC,IAAI,cACH,KAAC,WAAW,cACV,KAAC,aAAa,cAAE,OAAO,EAAE,OAAO,GAAiB,GACrC,GACT,GACH,CACP,EACA,IAAI,EAAE,OAAO,IAAI,CAChB,cAAK,IAAI,EAAC,QAAQ,gBAAa,IAAI,EAAE,KAAK,YACvC,IAAI,CAAC,OAAO,GACT,CACP,IACI,IACF,CACR,IACI,IACQ,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import { parseToHsl } from 'polished';\nimport { useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport type { FC, MouseEvent, PropsWithoutRef } from 'react';\n\nimport {\n useBreakpoint,\n Card,\n CardContent,\n Flex,\n Tabs,\n TabPanel,\n Text,\n MenuButton,\n useI18n,\n Icon,\n useAfterInitialEffect,\n getEdge,\n useDirection,\n throttle,\n readableColor,\n tryCatch,\n useTheme\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps, Tab } from '@pega/cosmos-react-core';\nimport { StyledCaseHeaderPromotedAction } from '@pega/cosmos-react-work/lib/components/CaseView/CaseView.styles';\n\nimport {\n StyledAside,\n StyledCaseHeader,\n StyledCaseView,\n StyledCaseViewIcon,\n StyledContentContainer,\n StyledContent,\n resolveCaseTypeColor\n} from './CaseView.styles';\nimport type { CaseViewProps, Region } from './CaseView.types';\n\nconst CaseView: FC<CaseViewProps & ForwardProps> = ({\n caseId,\n heading,\n icon,\n color,\n actions,\n stages,\n tasks,\n summary,\n details,\n feed,\n utility,\n promotedActions = [],\n ...restProps\n}: PropsWithoutRef<CaseViewProps>) => {\n const isMediumOrAbove = useBreakpoint('md');\n const t = useI18n();\n const tabsRef = useRef<HTMLElement>(null);\n const theme = useTheme();\n\n const { iconForeground, iconBackground } = useMemo(() => {\n const backgroundSetting = theme.components['case-view'].icon.background;\n const foregroundSetting = theme.components['case-view'].icon.color;\n const headerForeground = theme.components['case-view'].header['foreground-color'];\n const headerBackground = theme.components['case-view'].header.background;\n\n const resolvedIconBackground =\n backgroundSetting !== 'auto'\n ? backgroundSetting\n : tryCatch(\n () => {\n const { lightness } = parseToHsl(headerBackground);\n return lightness > 0.35 ? 'rgba(0, 0, 0, 0.2)' : 'rgba(255, 255, 255, 0.2)';\n },\n () => 'transparent'\n ) ?? 'transparent';\n\n let resolvedIconForeground =\n foregroundSetting !== 'auto' ? foregroundSetting : headerForeground;\n\n if (resolvedIconForeground === 'auto') {\n const caseTypeIconColor =\n color && theme.base['case-type-colors'] !== 'ignored'\n ? resolveCaseTypeColor(theme, color)\n : resolvedIconBackground;\n\n resolvedIconForeground = readableColor(caseTypeIconColor ?? resolvedIconBackground, {\n mode: 'light',\n level: 'AANonText'\n });\n }\n\n return {\n iconForeground: resolvedIconForeground,\n iconBackground: resolvedIconBackground\n };\n }, [theme, color]);\n\n const tabs = useMemo(() => {\n if (isMediumOrAbove) return [];\n const tabsArr: { name: Tab['name']; content: Region['content'] }[] = [];\n\n if (summary)\n tabsArr.push({\n name: 'Summary',\n content: summary.content\n });\n if (details) tabsArr.push({ name: details.label, content: details.content });\n if (feed) tabsArr.push({ name: 'Feed', content: feed.content });\n if (utility)\n tabsArr.push({\n name: 'Utility',\n content: utility.content\n });\n\n return tabsArr.map(tab => ({ ...tab, id: tab.name }));\n }, [isMediumOrAbove, summary, details, feed, utility]);\n\n const [currentTabId, setCurrentTabId] = useState(tabs && tabs.length > 0 ? tabs[0].id : null);\n const [wrapPromotedActions, setWrapPromotedActions] = useState(false);\n const actionsContainerEl = useRef<HTMLDivElement>(null);\n const contentEl = useRef<HTMLDivElement>(null);\n const headerEl = useRef<HTMLDivElement>(null);\n const wrapActionsBreakpoint = useRef<number | null>(null);\n const { ltr } = useDirection();\n\n useAfterInitialEffect(() => {\n if (tabs.length > 0) setCurrentTabId(cur => cur ?? tabs[0].id);\n }, [tabs]);\n\n useLayoutEffect(() => {\n if (\n !wrapPromotedActions &&\n contentEl.current &&\n actionsContainerEl.current &&\n headerEl.current\n ) {\n const contentStart = getEdge({\n el: contentEl.current,\n side: 'leading',\n ltr\n });\n\n const headerGroupEnd = getEdge({\n el: headerEl.current,\n side: 'trailing',\n ltr\n });\n const actionsContainerWidth = actionsContainerEl.current.getBoundingClientRect().width;\n\n wrapActionsBreakpoint.current =\n Math.abs(Math.ceil(contentStart) - Math.ceil(headerGroupEnd)) +\n Math.ceil(actionsContainerWidth);\n }\n\n const promotedActionsWrapHandler = () => {\n if (wrapActionsBreakpoint.current && contentEl.current) {\n const availableWidth = Math.ceil(contentEl.current.offsetWidth) - 20;\n setWrapPromotedActions(availableWidth < wrapActionsBreakpoint.current);\n }\n };\n\n const resizeObserver = new ResizeObserver(throttle(promotedActionsWrapHandler, 30));\n promotedActionsWrapHandler();\n\n if (contentEl.current) {\n resizeObserver.observe(contentEl.current, { box: 'border-box' });\n }\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [contentEl, actionsContainerEl, headerEl, promotedActions, heading, wrapPromotedActions]);\n\n return (\n <StyledCaseView {...restProps}>\n <StyledCaseHeader\n computeButtonFgColor={!isMediumOrAbove || promotedActions.length > 0}\n $color={color}\n >\n <Flex\n container={{\n direction: 'column',\n justify: 'between',\n pad: 2,\n alignItems: 'center',\n gap: 2\n }}\n ref={contentEl}\n as={StyledContentContainer}\n >\n <Flex container={{ justify: 'between', alignItems: 'center', gap: 2 }} item={{ grow: 1 }}>\n <Flex container={{ alignItems: 'center', gap: 2 }} item={{ grow: 2 }}>\n {icon && (\n <StyledCaseViewIcon\n name={icon}\n $caseTypeColor={color}\n foreground={iconForeground}\n background={iconBackground}\n />\n )}\n <Text variant='h1' ref={headerEl}>\n {heading}\n </Text>\n </Flex>\n\n {(promotedActions.length > 0 || actions) && (\n <Flex\n container={{\n gap: 1\n }}\n ref={actionsContainerEl}\n >\n {!wrapPromotedActions &&\n promotedActions.map(action => (\n <StyledCaseHeaderPromotedAction\n variant='secondary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => action.onClick?.(action.id, e)}\n key={action.id}\n >\n {action.text}\n </StyledCaseHeaderPromotedAction>\n ))}\n {actions && actions.length > 0 && (\n <MenuButton\n icon={promotedActions.length > 0 || !isMediumOrAbove ? 'more' : undefined}\n iconOnly={promotedActions.length > 0 || !isMediumOrAbove}\n variant='simple'\n text={t('actions')}\n aria-label={t('actions_for', [caseId])}\n menu={{\n items: actions.map(action => ({\n ...action,\n primary: action.text,\n visual: action.icon ? <Icon name={action.icon} /> : undefined\n })),\n scrollAt: 20\n }}\n />\n )}\n </Flex>\n )}\n </Flex>\n\n {wrapPromotedActions && promotedActions.length > 0 && (\n <Flex\n item={{ grow: 1 }}\n container={{\n justify: 'start',\n gap: 1,\n alignItems: 'center',\n wrap: 'wrap'\n }}\n >\n {promotedActions.map(action => (\n <StyledCaseHeaderPromotedAction\n variant='secondary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => action.onClick?.(action.id, e)}\n key={action.id}\n >\n {action.text}\n </StyledCaseHeaderPromotedAction>\n ))}\n </Flex>\n )}\n </Flex>\n </StyledCaseHeader>\n\n <Flex container={{ direction: 'column', gap: 2, pad: 2 }} as={StyledContentContainer}>\n {stages?.content}\n {tabs.length > 0 && currentTabId && (\n <>\n {tasks?.content}\n <div>\n <Tabs\n tabs={tabs}\n onTabClick={setCurrentTabId}\n currentTabId={currentTabId}\n ref={tabsRef}\n />\n\n {tabs.map(tab => (\n <TabPanel\n tabId={tab.id}\n currentTabId={currentTabId}\n key={tab.id}\n tablistRef={tabsRef}\n >\n <StyledContent>{tab.content}</StyledContent>\n </TabPanel>\n ))}\n </div>\n </>\n )}\n\n {tabs.length === 0 && (\n <Flex container={{ gap: 2 }}>\n {(utility || summary) && (\n <Flex as={StyledAside} container={{ direction: 'column', gap: 2 }}>\n {summary?.content && (\n <div role='region' aria-label={summary?.label}>\n {summary?.content}\n </div>\n )}\n {utility?.content && (\n <div role='region' aria-label={utility?.label}>\n {utility?.content}\n </div>\n )}\n </Flex>\n )}\n <Flex container={{ direction: 'column', gap: 2 }} item={{ grow: 1 }}>\n {tasks?.content && (\n <div role='region' aria-label={tasks?.label}>\n {tasks.content}\n </div>\n )}\n {details?.content && (\n <div role='region' aria-label={details?.label}>\n <Card>\n <CardContent>\n <StyledContent>{details?.content}</StyledContent>\n </CardContent>\n </Card>\n </div>\n )}\n {feed?.content && (\n <div role='region' aria-label={feed?.label}>\n {feed.content}\n </div>\n )}\n </Flex>\n </Flex>\n )}\n </Flex>\n </StyledCaseView>\n );\n};\n\nexport default CaseView;\n"]}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import type { DefaultTheme } from 'styled-components';
|
|
1
2
|
export declare const StyledCaseView: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const resolveCaseTypeColor: (theme: DefaultTheme, color: string) => string;
|
|
2
4
|
export declare const StyledCaseHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {
|
|
3
5
|
computeButtonFgColor: boolean;
|
|
6
|
+
$color?: string;
|
|
4
7
|
}>> & string;
|
|
8
|
+
export declare const StyledCaseViewIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("@pega/cosmos-react-core").IconProps & import("styled-components/dist/types").BaseObject, {
|
|
9
|
+
$caseTypeColor?: string;
|
|
10
|
+
}>> & string & Omit<import("react").ForwardRefExoticComponent<import("@pega/cosmos-react-core").IconProps>, keyof import("react").Component<any, {}, any>>;
|
|
5
11
|
export declare const StyledAside: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
12
|
export declare const StyledContentContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
13
|
export declare const StyledContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.styles.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CaseView.styles.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAkBtD,eAAO,MAAM,cAAc,6NAAe,CAAC;AAE3C,eAAO,MAAM,oBAAoB,GAAI,OAAO,YAAY,EAAE,OAAO,MAAM,KAAG,MAGzE,CAAC;AAEF,eAAO,MAAM,gBAAgB;0BAAyC,OAAO;aAAW,MAAM;YAyC7F,CAAC;AAIF,eAAO,MAAM,kBAAkB;qBACZ,MAAM;0JAsCvB,CAAC;AAIH,eAAO,MAAM,WAAW,6NAKtB,CAAC;AAIH,eAAO,MAAM,sBAAsB,6NAwBjC,CAAC;AAIH,eAAO,MAAM,aAAa,6NAaxB,CAAC"}
|
|
@@ -1,30 +1,80 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
|
-
import {
|
|
2
|
+
import { mix } from 'polished';
|
|
3
|
+
import { defaultThemeProp, Icon, StyledButton, calculateForegroundColor, isSolidColor, readableColor, resolveSupplementalColor, StyledCard } from '@pega/cosmos-react-core';
|
|
3
4
|
import { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';
|
|
4
5
|
import { StyledTabs } from '@pega/cosmos-react-core/lib/components/Tabs/Tabs.styles';
|
|
5
6
|
import { StyledSummaryPrimaryList } from '@pega/cosmos-react-work/lib/components/CaseView/CaseView.styles';
|
|
6
7
|
import { StyledStagesWrapper } from '@pega/cosmos-react-work/lib/components/Stages/Stages.styles';
|
|
7
8
|
export const StyledCaseView = styled.div ``;
|
|
8
|
-
export const
|
|
9
|
+
export const resolveCaseTypeColor = (theme, color) => {
|
|
10
|
+
const supplementalColor = resolveSupplementalColor(theme, color);
|
|
11
|
+
return supplementalColor ?? color;
|
|
12
|
+
};
|
|
13
|
+
export const StyledCaseHeader = styled.header(({ theme, computeButtonFgColor, $color }) => {
|
|
9
14
|
const { components: { 'case-view': { header: { background, 'foreground-color': foregroundColor } } } } = theme;
|
|
10
|
-
const
|
|
15
|
+
const resolvedCaseTypeColor = $color ? resolveCaseTypeColor(theme, $color) : undefined;
|
|
16
|
+
const caseTypeBackground = $color &&
|
|
17
|
+
theme.base['case-type-colors'] === 'header-and-icon' &&
|
|
18
|
+
isSolidColor(theme.components.card.background)
|
|
19
|
+
? mix(0.85, theme.components.card.background, resolveCaseTypeColor(theme, $color))
|
|
20
|
+
: undefined;
|
|
21
|
+
const headerBackground = caseTypeBackground ?? background;
|
|
22
|
+
const fgColor = resolvedCaseTypeColor && theme.base['case-type-colors'] === 'header-and-icon'
|
|
23
|
+
? readableColor(headerBackground)
|
|
24
|
+
: calculateForegroundColor(headerBackground, foregroundColor);
|
|
11
25
|
return css `
|
|
12
26
|
position: relative;
|
|
13
|
-
background: ${
|
|
27
|
+
background: ${headerBackground};
|
|
14
28
|
|
|
15
29
|
h1 {
|
|
16
|
-
color: ${
|
|
30
|
+
color: ${fgColor};
|
|
17
31
|
}
|
|
18
32
|
|
|
19
33
|
${computeButtonFgColor &&
|
|
20
34
|
css `
|
|
21
35
|
button {
|
|
22
|
-
color: ${
|
|
36
|
+
color: ${fgColor};
|
|
23
37
|
}
|
|
24
38
|
`}
|
|
25
39
|
`;
|
|
26
40
|
});
|
|
27
41
|
StyledCaseHeader.defaultProps = defaultThemeProp;
|
|
42
|
+
export const StyledCaseViewIcon = styled(Icon)(({ theme, $caseTypeColor }) => {
|
|
43
|
+
const caseTypeColorsEnabled = theme.base['case-type-colors'] === 'icon-only' ||
|
|
44
|
+
theme.base['case-type-colors'] === 'header-and-icon';
|
|
45
|
+
const resolvedCaseTypeColor = caseTypeColorsEnabled && $caseTypeColor !== undefined
|
|
46
|
+
? resolveCaseTypeColor(theme, $caseTypeColor)
|
|
47
|
+
: undefined;
|
|
48
|
+
return css `
|
|
49
|
+
--icon-color: ${resolvedCaseTypeColor ?? theme.base.palette['brand-accent']};
|
|
50
|
+
--gradient-start: oklch(from var(--icon-color) calc(l - 0.3) calc(c * 1.5) h);
|
|
51
|
+
--gradient-mid: oklch(from var(--icon-color) l c h);
|
|
52
|
+
--gradient-end: oklch(from var(--icon-color) calc(l + 0.5) calc(c * 1.5) h);
|
|
53
|
+
|
|
54
|
+
${theme.components['case-view'].icon.color !== 'auto' &&
|
|
55
|
+
css `
|
|
56
|
+
color: ${theme.components['case-view'].icon.color};
|
|
57
|
+
`}
|
|
58
|
+
|
|
59
|
+
${theme.components['case-view'].icon.background !== 'auto' &&
|
|
60
|
+
css `
|
|
61
|
+
background: ${theme.components['case-view'].icon.background};
|
|
62
|
+
`}
|
|
63
|
+
|
|
64
|
+
${theme.components['case-view'].icon.background === 'auto' &&
|
|
65
|
+
caseTypeColorsEnabled &&
|
|
66
|
+
resolvedCaseTypeColor &&
|
|
67
|
+
css `
|
|
68
|
+
background: ${resolvedCaseTypeColor};
|
|
69
|
+
`}
|
|
70
|
+
|
|
71
|
+
${theme.components['case-view'].icon['box-shadow'] !== 'auto' &&
|
|
72
|
+
css `
|
|
73
|
+
box-shadow: ${theme.components['case-view'].icon['box-shadow']};
|
|
74
|
+
`}
|
|
75
|
+
`;
|
|
76
|
+
});
|
|
77
|
+
StyledCaseViewIcon.defaultProps = defaultThemeProp;
|
|
28
78
|
export const StyledAside = styled.div(({ theme }) => {
|
|
29
79
|
return css `
|
|
30
80
|
min-width: ${theme.base['content-width'].sm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.styles.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACxB,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,yDAAyD,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iEAAiE,CAAC;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,6DAA6D,CAAC;AAElG,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAC3C,CAAC,EAAE,KAAK,EAAE,oBAAoB,EAAE,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"CaseView.styles.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EACL,gBAAgB,EAChB,IAAI,EACJ,YAAY,EACZ,wBAAwB,EACxB,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N,wBAAwB;;6BAED,KAAK,CAAC,IAAI,CAAC,OAAO;;MAEzC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ;QAChC,GAAG,CAAA;WACI,UAAU,MAAM,gBAAgB;;;KAGtC;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,aAAa,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\nimport { mix } from 'polished';\n\nimport {\n defaultThemeProp,\n Icon,\n StyledButton,\n calculateForegroundColor,\n isSolidColor,\n readableColor,\n resolveSupplementalColor,\n StyledCard\n} from '@pega/cosmos-react-core';\nimport { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\nimport { StyledTabs } from '@pega/cosmos-react-core/lib/components/Tabs/Tabs.styles';\nimport { StyledSummaryPrimaryList } from '@pega/cosmos-react-work/lib/components/CaseView/CaseView.styles';\nimport { StyledStagesWrapper } from '@pega/cosmos-react-work/lib/components/Stages/Stages.styles';\n\nexport const StyledCaseView = styled.div``;\n\nexport const resolveCaseTypeColor = (theme: DefaultTheme, color: string): string => {\n const supplementalColor = resolveSupplementalColor(theme, color);\n return supplementalColor ?? color;\n};\n\nexport const StyledCaseHeader = styled.header<{ computeButtonFgColor: boolean; $color?: string }>(\n ({ theme, computeButtonFgColor, $color }) => {\n const {\n components: {\n 'case-view': {\n header: { background, 'foreground-color': foregroundColor }\n }\n }\n } = theme;\n\n const resolvedCaseTypeColor = $color ? resolveCaseTypeColor(theme, $color) : undefined;\n\n const caseTypeBackground =\n $color &&\n theme.base['case-type-colors'] === 'header-and-icon' &&\n isSolidColor(theme.components.card.background)\n ? mix(0.85, theme.components.card.background, resolveCaseTypeColor(theme, $color))\n : undefined;\n\n const headerBackground = caseTypeBackground ?? background;\n const fgColor =\n resolvedCaseTypeColor && theme.base['case-type-colors'] === 'header-and-icon'\n ? readableColor(headerBackground)\n : calculateForegroundColor(headerBackground, foregroundColor);\n\n return css`\n position: relative;\n background: ${headerBackground};\n\n h1 {\n color: ${fgColor};\n }\n\n ${computeButtonFgColor &&\n css`\n button {\n color: ${fgColor};\n }\n `}\n `;\n }\n);\n\nStyledCaseHeader.defaultProps = defaultThemeProp;\n\nexport const StyledCaseViewIcon = styled(Icon)<{\n $caseTypeColor?: string;\n}>(({ theme, $caseTypeColor }) => {\n const caseTypeColorsEnabled =\n theme.base['case-type-colors'] === 'icon-only' ||\n theme.base['case-type-colors'] === 'header-and-icon';\n const resolvedCaseTypeColor =\n caseTypeColorsEnabled && $caseTypeColor !== undefined\n ? resolveCaseTypeColor(theme, $caseTypeColor)\n : undefined;\n\n return css`\n --icon-color: ${resolvedCaseTypeColor ?? theme.base.palette['brand-accent']};\n --gradient-start: oklch(from var(--icon-color) calc(l - 0.3) calc(c * 1.5) h);\n --gradient-mid: oklch(from var(--icon-color) l c h);\n --gradient-end: oklch(from var(--icon-color) calc(l + 0.5) calc(c * 1.5) h);\n\n ${theme.components['case-view'].icon.color !== 'auto' &&\n css`\n color: ${theme.components['case-view'].icon.color};\n `}\n\n ${theme.components['case-view'].icon.background !== 'auto' &&\n css`\n background: ${theme.components['case-view'].icon.background};\n `}\n\n ${theme.components['case-view'].icon.background === 'auto' &&\n caseTypeColorsEnabled &&\n resolvedCaseTypeColor &&\n css`\n background: ${resolvedCaseTypeColor};\n `}\n\n ${theme.components['case-view'].icon['box-shadow'] !== 'auto' &&\n css`\n box-shadow: ${theme.components['case-view'].icon['box-shadow']};\n `}\n `;\n});\n\nStyledCaseViewIcon.defaultProps = defaultThemeProp;\n\nexport const StyledAside = styled.div(({ theme }) => {\n return css`\n min-width: ${theme.base['content-width'].sm};\n max-width: 40%;\n `;\n});\n\nStyledAside.defaultProps = defaultThemeProp;\n\nexport const StyledContentContainer = styled.div(({ theme }) => {\n return css`\n width: 100%;\n max-width: 75rem;\n margin-inline: auto;\n\n h1 {\n min-width: ${theme.base['content-width'].xs};\n }\n\n & > div {\n width: 100%;\n }\n\n ${StyledButton} {\n margin-inline-start: 0;\n }\n\n &:has(${StyledTabs}) {\n ${StyledStagesWrapper} {\n --stages-wrapper-bottom-radius: 0;\n }\n }\n `;\n});\n\nStyledContentContainer.defaultProps = defaultThemeProp;\n\nexport const StyledContent = styled.div(({ theme }) => {\n return css`\n ${StyledSummaryPrimaryList} {\n grid-template-columns: auto 1fr;\n column-gap: calc(2 * ${theme.base.spacing});\n }\n ${theme.components.tabs.detached &&\n css`\n && ${StyledCard} > ${StyledCardHeader} {\n padding-inline: 0;\n }\n `}\n `;\n});\n\nStyledContent.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -11,6 +11,8 @@ export interface CaseViewProps extends NoChildrenProp, BaseProps {
|
|
|
11
11
|
heading: string;
|
|
12
12
|
/** An icon to serve as a visual for the CaseView. */
|
|
13
13
|
icon?: IconName;
|
|
14
|
+
/** A contextual color for the case type. */
|
|
15
|
+
color?: string;
|
|
14
16
|
/** A secondary text rendered below the heading. */
|
|
15
17
|
subheading?: string;
|
|
16
18
|
/** Case level promoted actions available in the CaseView header. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.types.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAE3F,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc,EAAE,SAAS;IAC9D,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
|
|
1
|
+
{"version":3,"file":"CaseView.types.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAE3F,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc,EAAE,SAAS;IAC9D,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.types.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { NoChildrenProp, Action, BaseProps, IconName } from '@pega/cosmos-react-core';\n\nexport interface Region {\n label: string;\n content: ReactNode;\n}\n\nexport interface CaseViewProps extends NoChildrenProp, BaseProps {\n /** A unique identifier for the case instance. */\n caseId: string;\n /** A text region for the title of the CaseView. */\n heading: string;\n /** An icon to serve as a visual for the CaseView. */\n icon?: IconName;\n /** A secondary text rendered below the heading. */\n subheading?: string;\n /** Case level promoted actions available in the CaseView header. */\n promotedActions?: Action[];\n /** Case level actions available in an action menu. */\n actions?: Action[];\n /** A region to display any summary information about the CaseView. */\n summary?: Region;\n /** A region to hold a Stages component. */\n stages?: Region;\n /** A region to hold a Tasks component. */\n tasks?: Region;\n /** A region to hold the main details/tabs content. */\n details?: Region;\n /** A region to hold a Feed component. */\n feed?: Region;\n /** A region to hold a Utilities component. */\n utility?: Region;\n /** Whether to show the Pulse region. */\n showPulse?: boolean;\n /** Whether to show the Utility region. */\n showUtility?: boolean;\n /** Whether the case is in a create stage. */\n isCreateStage?: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CaseView.types.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { NoChildrenProp, Action, BaseProps, IconName } from '@pega/cosmos-react-core';\n\nexport interface Region {\n label: string;\n content: ReactNode;\n}\n\nexport interface CaseViewProps extends NoChildrenProp, BaseProps {\n /** A unique identifier for the case instance. */\n caseId: string;\n /** A text region for the title of the CaseView. */\n heading: string;\n /** An icon to serve as a visual for the CaseView. */\n icon?: IconName;\n /** A contextual color for the case type. */\n color?: string;\n /** A secondary text rendered below the heading. */\n subheading?: string;\n /** Case level promoted actions available in the CaseView header. */\n promotedActions?: Action[];\n /** Case level actions available in an action menu. */\n actions?: Action[];\n /** A region to display any summary information about the CaseView. */\n summary?: Region;\n /** A region to hold a Stages component. */\n stages?: Region;\n /** A region to hold a Tasks component. */\n tasks?: Region;\n /** A region to hold the main details/tabs content. */\n details?: Region;\n /** A region to hold a Feed component. */\n feed?: Region;\n /** A region to hold a Utilities component. */\n utility?: Region;\n /** Whether to show the Pulse region. */\n showPulse?: boolean;\n /** Whether to show the Utility region. */\n showUtility?: boolean;\n /** Whether the case is in a create stage. */\n isCreateStage?: boolean;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-wss",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.13.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"author": "Pegasystems",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"build": "tsc -b tsconfig.build.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pega/cosmos-react-core": "9.
|
|
18
|
-
"@pega/cosmos-react-work": "9.
|
|
17
|
+
"@pega/cosmos-react-core": "9.13.0",
|
|
18
|
+
"@pega/cosmos-react-work": "9.13.0",
|
|
19
19
|
"@types/react": "^17.0.62 || ^18.3.3",
|
|
20
20
|
"@types/react-dom": "^17.0.20 || ^18.3.0",
|
|
21
21
|
"polished": "^4.1.0",
|