@pega/cosmos-react-wss 10.0.0-build.4.7 → 10.0.0-build.4.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"CaseView.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AAkB7D,OAAO,KAAK,EAAE,YAAY,EAAO,MAAM,yBAAyB,CAAC;AAUjE,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,kBAAkB,CAAC;AAE9D,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,GAAG,YAAY,CAmP9C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
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,EACP,IAAI,EACJ,OAAO,EACP,eAAe,GAAG,EAAE,EACpB,GAAG,SAAS,EACmB,EAAE,EAAE;IACnC,MAAM,eAAe,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,OAAO,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IAE1C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE;QACxB,IAAI,eAAe;YAAE,OAAO,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAwD,EAAE,CAAC;QAExE,IAAI,OAAO;YACT,OAAO,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,OAAO,CAAC,OAAO;aACzB,CAAC,CAAC;QACL,IAAI,OAAO;YAAE,OAAO,CAAC,IAAI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gBAAa,OAAO,EAAE,KAAK,YAC1C,OAAO,EAAE,OAAO,GACb,CACP,EACA,OAAO,EAAE,OAAO,IAAI,CACnB,cAAK,IAAI,EAAC,QAAQ,gBAAa,OAAO,EAAE,KAAK,YAC1C,OAAO,EAAE,OAAO,GACb,CACP,IACI,CACR,EACD,MAAC,IAAI,IAAC,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 { 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,OAA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ACT,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":"AAaA,eAAO,MAAM,cAAc,6NAAe,CAAC;AAE3C,eAAO,MAAM,gBAAgB;0BAAyC,OAAO;YA2B5E,CAAC;AAIF,eAAO,MAAM,WAAW,6NAKtB,CAAC;AAIH,eAAO,MAAM,sBAAsB,6NAwBjC,CAAC;AAIH,eAAO,MAAM,aAAa,6NAaxB,CAAC"}
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 { defaultThemeProp, StyledButton, calculateForegroundColor, StyledCard } from '@pega/cosmos-react-core';
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 StyledCaseHeader = styled.header(({ theme, computeButtonFgColor }) => {
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 color = calculateForegroundColor(background, foregroundColor);
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: ${background};
27
+ background: ${headerBackground};
14
28
 
15
29
  h1 {
16
- color: ${color};
30
+ color: ${fgColor};
17
31
  }
18
32
 
19
33
  ${computeButtonFgColor &&
20
34
  css `
21
35
  button {
22
- color: ${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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AAC,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';\n\nimport {\n defaultThemeProp,\n StyledButton,\n calculateForegroundColor,\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 StyledCaseHeader = styled.header<{ computeButtonFgColor: boolean }>(\n ({ theme, computeButtonFgColor }) => {\n const {\n components: {\n 'case-view': {\n header: { background, 'foreground-color': foregroundColor }\n }\n }\n } = theme;\n const color = calculateForegroundColor(background, foregroundColor);\n\n return css`\n position: relative;\n background: ${background};\n\n h1 {\n color: ${color};\n }\n\n ${computeButtonFgColor &&\n css`\n button {\n color: ${color};\n }\n `}\n `;\n }\n);\n\nStyledCaseHeader.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"]}
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,YAAY,EACZ,aAAa,EACb,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,oBAAoB,GAAG,CAAC,KAAmB,EAAE,KAAa,EAAU,EAAE;IACjF,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACjE,OAAO,iBAAiB,IAAI,KAAK,CAAC;AACpC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAC3C,CAAC,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,EAAE,EAAE;IAC1C,MAAM,EACJ,UAAU,EAAE,EACV,WAAW,EAAE,EACX,MAAM,EAAE,E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W,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE5C,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7D,OAAO,GAAG,CAAA;;;;;;mBAMO,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE;;;;;;;MAO3C,YAAY;;;;YAIN,UAAU;QACd,mBAAmB;;;;GAIxB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEvD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,OAAO,GAAG,CAAA;MACN,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,M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,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"]}
@@ -28,9 +28,6 @@ export declare const StyledQuickCreateButton: import("styled-components/dist/typ
28
28
  export declare const StyledQuickCreateSecondaryText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("@pega/cosmos-react-core").TextProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement | HTMLSpanElement> & import("@pega/cosmos-react-core").ForwardProps, "ref"> & {
29
29
  ref?: ((instance: HTMLHeadingElement | HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLHeadingElement | HTMLSpanElement> | null | undefined;
30
30
  }, never>> & string & Omit<ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").TextProps>, keyof import("react").Component<any, {}, any>>;
31
- export declare const StyledCaseIcon: 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, {
32
- displayVariant: QuickCreateVariant;
33
- }>> & string & Omit<import("react").ForwardRefExoticComponent<import("@pega/cosmos-react-core").IconProps>, keyof import("react").Component<any, {}, any>>;
34
31
  declare const QuickCreate: ForwardRefForwardPropsComponent<QuickCreateProps>;
35
32
  export default QuickCreate;
36
33
  //# sourceMappingURL=QuickCreate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuickCreate.d.ts","sourceRoot":"","sources":["../../../src/components/QuickCreate/QuickCreate.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAwBpD,OAAO,KAAK,EACV,SAAS,EACT,+BAA+B,EAC/B,cAAc,EACf,MAAM,yBAAyB,CAAC;AAIjC,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,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEtD,MAAM,WAAW,gBAAiB,SAAQ,SAAS,EAAE,cAAc;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAiBD,eAAO,MAAM,iBAAiB;iBAAsC,OAAO;0MAazE,CAAC;AAIH,eAAO,MAAM,uBAAuB;;;oBAClB,kBAAkB;sBAChB,MAAM;kJAkBxB,CAAC;AAkDH,eAAO,MAAM,8BAA8B;;uJAIzC,CAAC;AAoBH,QAAA,MAAM,WAAW,EAAE,+BAA+B,CAAC,gBAAgB,CA+KlE,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -37,7 +37,6 @@ export const StyledQuickCreateButton = styled(Button)(({ theme, displayVariant,
37
37
  height: 100%;
38
38
  width: 100%;
39
39
  max-height: none;
40
- min-height: ${displayVariant === 'stacked' ? `calc(${theme.base.spacing} * 12.5)` : 'auto'};
41
40
  padding-block: calc(${theme.base.spacing} * 1.5);
42
41
  padding-inline: calc(${theme.base.spacing} * 2);
43
42
  border-radius: ${theme.base['border-radius']};
@@ -52,7 +51,7 @@ export const StyledQuickCreateButton = styled(Button)(({ theme, displayVariant,
52
51
  StyledQuickCreateButton.defaultProps = defaultThemeProp;
53
52
  const StyledButtonText = styled.span(({ theme }) => {
54
53
  return css `
55
- ${lineClamp(2)}
54
+ ${lineClamp(3)}
56
55
  font-weight: ${theme.base['font-weight']['semi-bold']};
57
56
  font-size: 1em;
58
57
  color: CanvasText;
@@ -88,14 +87,12 @@ const StyledStackedRow = styled(Flex)(() => {
88
87
  StyledStackedRow.defaultProps = defaultThemeProp;
89
88
  export const StyledQuickCreateSecondaryText = styled(Text)(() => {
90
89
  return css `
91
- ${lineClamp(2)}
90
+ ${lineClamp(3)}
92
91
  `;
93
92
  });
94
93
  StyledQuickCreateSecondaryText.defaultProps = defaultThemeProp;
95
94
  const StyledArrowSection = styled(Flex)(() => {
96
95
  return css `
97
- min-width: 2rem;
98
-
99
96
  ${StyledIconShape} {
100
97
  height: 1rem;
101
98
  }
@@ -108,16 +105,6 @@ const StyledArrowSection = styled(Flex)(() => {
108
105
  `;
109
106
  });
110
107
  StyledArrowSection.defaultProps = defaultThemeProp;
111
- export const StyledCaseIcon = styled(Icon)(({ displayVariant }) => {
112
- return css `
113
- ${displayVariant === 'stacked' &&
114
- css `
115
- height: 3rem;
116
- width: 3rem;
117
- `}
118
- `;
119
- });
120
- StyledCaseIcon.defaultProps = defaultThemeProp;
121
108
  const QuickCreate = forwardRef(function QuickCreate({ heading, actions, className, variant = 'inline', backgroundColor, showHeader = true, ...restProps }, ref) {
122
109
  const theme = useTheme();
123
110
  const consolidatedRef = useConsolidatedRef(ref);
@@ -137,14 +124,18 @@ const QuickCreate = forwardRef(function QuickCreate({ heading, actions, classNam
137
124
  return supplementalColorsList[idx % supplementalColorsList.length];
138
125
  };
139
126
  const getIconComp = (iconName, iconBackground) => {
140
- return iconBackground !== undefined ? (_jsx(StyledCaseIcon, { name: iconName, foreground: readableColor(iconBackground, {
127
+ return iconBackground !== undefined ? (_jsx(Icon, { name: iconName, foreground: readableColor(iconBackground, {
141
128
  mode: 'light',
142
129
  level: 'AANonText'
143
- }), background: iconBackground, displayVariant: displayVariant })) : (_jsx(StyledCaseIcon, { size: 'm', name: iconName, displayVariant: displayVariant }));
130
+ }), background: iconBackground })) : (_jsx(Icon, { size: 'm', name: iconName }));
144
131
  };
145
132
  const getGridCols = () => {
146
- if (isMediumOrAbove)
147
- return 'repeat(4, minmax(0, 1fr))';
133
+ if (isMediumOrAbove) {
134
+ if (actions.length === 1)
135
+ return 'repeat(2, minmax(0, 1fr))';
136
+ const cols = Math.min(Math.max(actions.length, 1), 4);
137
+ return `repeat(${cols}, minmax(0, 1fr))`;
138
+ }
148
139
  if (isSmallOrAbove)
149
140
  return 'repeat(2, minmax(0, 1fr))';
150
141
  return `repeat(auto-fill, minmax(min(calc(${theme.base.spacing} * 30), 100%), 1fr))`;
@@ -155,7 +146,10 @@ const QuickCreate = forwardRef(function QuickCreate({ heading, actions, classNam
155
146
  ...(showHeader ? {} : { justifyContent: 'center' })
156
147
  }, children: actions.map(({ label, icon, description, color, onClick }, idx) => {
157
148
  const iconBackground = getActionColor(color, idx);
158
- return (_jsx("li", { children: _jsx(StyledQuickCreateButton, { onClick: onClick, variant: 'secondary', displayVariant: displayVariant, backgroundColor: backgroundColor, children: isStacked ? (_jsxs(StyledQuickCreateContainer, { variant: displayVariant, container: { gap: 0.75, alignItems: 'center', direction: 'column' }, children: [icon && (_jsx(StyledStackedRow, { container: true, children: _jsx(StyledIconSection, { variant: displayVariant, container: true, children: getIconComp(icon, iconBackground) }) })), _jsx(StyledStackedRow, { container: true, children: _jsx(StyledButtonText, { as: 'span', children: label }) }), description && (_jsx(StyledStackedRow, { container: true, children: _jsx(StyledQuickCreateSecondaryText, { variant: 'secondary', forwardedAs: 'p', children: description }) }))] })) : (_jsxs(StyledQuickCreateContainer, { variant: displayVariant, container: { gap: 0, alignItems: 'center' }, children: [_jsxs(Flex, { container: { gap: 1.5, alignItems: 'center' }, item: { grow: 1 }, children: [icon && (_jsx(StyledIconSection, { variant: displayVariant, container: true, children: getIconComp(icon, iconBackground) })), _jsxs(StyledMiddleSection, { container: {
149
+ return (_jsx("li", { children: _jsx(StyledQuickCreateButton, { onClick: onClick, variant: 'secondary', displayVariant: displayVariant, backgroundColor: backgroundColor, children: isStacked ? (_jsxs(StyledQuickCreateContainer, { variant: displayVariant, container: { gap: 0.75, alignItems: 'center', direction: 'column' }, children: [icon && (_jsx(StyledStackedRow, { container: true, children: _jsx(StyledIconSection, { variant: displayVariant, container: true, children: getIconComp(icon, iconBackground) }) })), _jsx(StyledStackedRow, { container: true, children: _jsx(StyledButtonText, { as: 'span', children: label }) }), description && (_jsx(StyledStackedRow, { container: true, children: _jsx(StyledQuickCreateSecondaryText, { variant: 'secondary', forwardedAs: 'p', children: description }) }))] })) : (_jsxs(StyledQuickCreateContainer, { variant: displayVariant, container: { gap: 0, alignItems: 'center' }, children: [_jsxs(Flex, { container: {
150
+ gap: 1.5,
151
+ alignItems: description ? 'start' : 'center'
152
+ }, item: { grow: 1 }, children: [icon && (_jsx(StyledIconSection, { variant: displayVariant, container: true, children: getIconComp(icon, iconBackground) })), _jsxs(StyledMiddleSection, { container: {
159
153
  direction: 'column',
160
154
  gap: 0.25,
161
155
  alignItems: 'start',
@@ -1 +1 @@
1
- {"version":3,"file":"QuickCreate.js","sourceRoot":"","sources":["../../../src/components/QuickCreate/QuickCreate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,kBAAkB,EAClB,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAqBnF,MAAM,qBAAqB,GAAG,MAAM,CAAC,IAAI,CAAC,CAA2B,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE;IAC7F,MAAM,U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,EAAC,aAAa,EAAC,IAAI,EAAC,GAAG,GAAG,GACjB,IACM,CAC9B,GACuB,IApEnB,KAAK,CAqET,CACN,CAAC;oBACJ,CAAC,CAAC,GACG,GACW,IACE,CACzB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { Ref, MouseEventHandler } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Card,\n CardContent,\n CardHeader,\n defaultThemeProp,\n Flex,\n Grid,\n StyledIcon,\n Icon,\n Text,\n VisuallyHiddenText,\n useBreakpoint,\n useTheme,\n supplementalColors,\n resolveSupplementalColor,\n isSolidColor,\n readableColor,\n useConsolidatedRef,\n createClassName\n} from '@pega/cosmos-react-core';\nimport type {\n BaseProps,\n ForwardRefForwardPropsComponent,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\nimport { lineClamp } from '@pega/cosmos-react-core/lib/styles/mixins';\nimport { StyledIconShape } from '@pega/cosmos-react-core/lib/components/Icon/Icon';\n\nexport interface QuickCreateAction {\n label: string;\n icon?: string;\n description?: string;\n color?: string;\n onClick: MouseEventHandler;\n}\n\nexport type QuickCreateVariant = 'inline' | 'stacked';\n\nexport interface QuickCreateProps extends BaseProps, NoChildrenProp {\n heading: string;\n actions: QuickCreateAction[];\n variant?: QuickCreateVariant;\n showHeader?: boolean;\n backgroundColor?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledQuickCreateCard = styled(Card)<{ showHeader?: boolean }>(({ theme, showHeader }) => {\n const background = showHeader ? theme.components.card.background : 'transparent';\n\n return css`\n background: ${background};\n\n ${!showHeader &&\n css`\n padding: 0;\n `}\n `;\n});\n\nStyledQuickCreateCard.defaultProps = defaultThemeProp;\n\nexport const StyledQuickCreate = styled(CardContent)<{ showHeader?: boolean }>(({ showHeader }) => {\n return css`\n ${!showHeader &&\n css`\n &&&& {\n padding: 0;\n }\n `}\n\n ul {\n list-style: none;\n }\n `;\n});\n\nStyledQuickCreate.defaultProps = defaultThemeProp;\n\nexport const StyledQuickCreateButton = styled(Button)<{\n displayVariant: QuickCreateVariant;\n backgroundColor?: string;\n}>(({ theme, displayVariant, backgroundColor }) => {\n const background = backgroundColor || theme.base.palette['primary-background'];\n\n return css`\n height: 100%;\n width: 100%;\n max-height: none;\n min-height: ${displayVariant === 'stacked' ? `calc(${theme.base.spacing} * 12.5)` : 'auto'};\n padding-block: calc(${theme.base.spacing} * 1.5);\n padding-inline: calc(${theme.base.spacing} * 2);\n border-radius: ${theme.base['border-radius']};\n border-color: ${theme.base.palette['border-line']};\n justify-content: ${displayVariant === 'stacked' ? 'center' : 'start'};\n text-align: ${displayVariant === 'stacked' ? 'center' : 'start'};\n white-space: break-spaces;\n word-break: break-word;\n background: ${background};\n `;\n});\n\nStyledQuickCreateButton.defaultProps = defaultThemeProp;\n\nconst StyledButtonText = styled.span(({ theme }) => {\n return css`\n ${lineClamp(2)}\n font-weight: ${theme.base['font-weight']['semi-bold']};\n font-size: 1em;\n color: CanvasText;\n `;\n});\n\nStyledButtonText.defaultProps = defaultThemeProp;\n\nconst StyledQuickCreateContainer = styled(Flex)<{ variant: QuickCreateVariant }>(({ variant }) => {\n return css`\n width: 100%;\n\n ${variant === 'stacked' &&\n css`\n text-align: center;\n `}\n `;\n});\n\nStyledQuickCreateContainer.defaultProps = defaultThemeProp;\n\nconst StyledIconSection = styled(Flex)<{ variant: QuickCreateVariant }>(({ variant }) => {\n return css`\n min-width: ${variant === 'stacked' ? 'auto' : '2rem'};\n stroke-width: 50%;\n `;\n});\n\nStyledIconSection.defaultProps = defaultThemeProp;\n\nconst StyledMiddleSection = styled(Flex)``;\n\nStyledMiddleSection.defaultProps = defaultThemeProp;\n\nconst StyledStackedRow = styled(Flex)(() => {\n return css`\n width: 100%;\n justify-content: center;\n `;\n});\n\nStyledStackedRow.defaultProps = defaultThemeProp;\n\nexport const StyledQuickCreateSecondaryText = styled(Text)(() => {\n return css`\n ${lineClamp(2)}\n `;\n});\n\nStyledQuickCreateSecondaryText.defaultProps = defaultThemeProp;\n\nconst StyledArrowSection = styled(Flex)(() => {\n return css`\n min-width: 2rem;\n\n ${StyledIconShape} {\n height: 1rem;\n }\n\n ${StyledIcon} {\n fill: CanvasText;\n height: 100%;\n align-self: flex-end;\n }\n `;\n});\n\nStyledArrowSection.defaultProps = defaultThemeProp;\n\nexport const StyledCaseIcon = styled(Icon)<{ displayVariant: QuickCreateVariant }>(({\n displayVariant\n}) => {\n return css`\n ${displayVariant === 'stacked' &&\n css`\n height: 3rem;\n width: 3rem;\n `}\n `;\n});\n\nStyledCaseIcon.defaultProps = defaultThemeProp;\n\nconst QuickCreate: ForwardRefForwardPropsComponent<QuickCreateProps> = forwardRef(\n function QuickCreate(\n {\n heading,\n actions,\n className,\n variant = 'inline',\n backgroundColor,\n showHeader = true,\n ...restProps\n }: QuickCreateProps,\n ref: QuickCreateProps['ref']\n ) {\n const theme = useTheme();\n const consolidatedRef = useConsolidatedRef<HTMLDivElement>(ref);\n\n const isSmallOrAbove = useBreakpoint('sm', { breakpointRef: consolidatedRef });\n const isMediumOrAbove = useBreakpoint('md', { breakpointRef: consolidatedRef });\n\n const displayVariant: QuickCreateVariant = variant === 'stacked' ? 'stacked' : 'inline';\n const isStacked = displayVariant === 'stacked';\n\n const supplementalColorsList = supplementalColors(theme);\n\n const getActionColor = (actionColor: string | undefined, idx: number): string | undefined => {\n const isColorIgnored = theme.base['case-type-colors'] === 'ignored';\n\n if (isColorIgnored) return undefined;\n\n if (actionColor !== undefined) {\n const supplementalColor = resolveSupplementalColor(theme, actionColor);\n\n return supplementalColor ?? (isSolidColor(actionColor) ? actionColor : undefined);\n }\n\n return supplementalColorsList[idx % supplementalColorsList.length];\n };\n\n const getIconComp = (iconName: string, iconBackground: string | undefined) => {\n return iconBackground !== undefined ? (\n <StyledCaseIcon\n name={iconName}\n foreground={readableColor(iconBackground, {\n mode: 'light',\n level: 'AANonText'\n })}\n background={iconBackground}\n displayVariant={displayVariant}\n />\n ) : (\n <StyledCaseIcon size='m' name={iconName} displayVariant={displayVariant} />\n );\n };\n\n const getGridCols = () => {\n if (isMediumOrAbove) return 'repeat(4, minmax(0, 1fr))';\n if (isSmallOrAbove) return 'repeat(2, minmax(0, 1fr))';\n\n return `repeat(auto-fill, minmax(min(calc(${theme.base.spacing} * 30), 100%), 1fr))`;\n };\n\n return (\n <StyledQuickCreateCard\n {...restProps}\n ref={consolidatedRef}\n showHeader={showHeader}\n className={createClassName('quick-create', className)}\n >\n {showHeader ? (\n <CardHeader>\n <Text variant='h2'>{heading}</Text>\n </CardHeader>\n ) : (\n <VisuallyHiddenText as='h2'>{heading}</VisuallyHiddenText>\n )}\n\n <StyledQuickCreate showHeader={showHeader}>\n <Grid\n as='ul'\n container={{\n gap: 1.5,\n cols: getGridCols(),\n ...(showHeader ? {} : { justifyContent: 'center' })\n }}\n >\n {actions.map(({ label, icon, description, color, onClick }, idx) => {\n const iconBackground = getActionColor(color, idx);\n\n return (\n <li key={label}>\n <StyledQuickCreateButton\n onClick={onClick}\n variant='secondary'\n displayVariant={displayVariant}\n backgroundColor={backgroundColor}\n >\n {isStacked ? (\n <StyledQuickCreateContainer\n variant={displayVariant}\n container={{ gap: 0.75, alignItems: 'center', direction: 'column' }}\n >\n {icon && (\n <StyledStackedRow container>\n <StyledIconSection variant={displayVariant} container>\n {getIconComp(icon, iconBackground)}\n </StyledIconSection>\n </StyledStackedRow>\n )}\n\n <StyledStackedRow container>\n <StyledButtonText as='span'>{label}</StyledButtonText>\n </StyledStackedRow>\n\n {description && (\n <StyledStackedRow container>\n <StyledQuickCreateSecondaryText variant='secondary' forwardedAs='p'>\n {description}\n </StyledQuickCreateSecondaryText>\n </StyledStackedRow>\n )}\n </StyledQuickCreateContainer>\n ) : (\n <StyledQuickCreateContainer\n variant={displayVariant}\n container={{ gap: 0, alignItems: 'center' }}\n >\n <Flex container={{ gap: 1.5, alignItems: 'center' }} item={{ grow: 1 }}>\n {icon && (\n <StyledIconSection variant={displayVariant} container>\n {getIconComp(icon, iconBackground)}\n </StyledIconSection>\n )}\n\n <StyledMiddleSection\n container={{\n direction: 'column',\n gap: 0.25,\n alignItems: 'start',\n justify: 'center'\n }}\n item={{ grow: 1 }}\n >\n <StyledButtonText as='span'>{label}</StyledButtonText>\n\n {description && (\n <StyledQuickCreateSecondaryText variant='secondary' forwardedAs='p'>\n {description}\n </StyledQuickCreateSecondaryText>\n )}\n </StyledMiddleSection>\n </Flex>\n\n <StyledArrowSection container>\n <Icon name='arrow-right' size='s' />\n </StyledArrowSection>\n </StyledQuickCreateContainer>\n )}\n </StyledQuickCreateButton>\n </li>\n );\n })}\n </Grid>\n </StyledQuickCreate>\n </StyledQuickCreateCard>\n );\n }\n);\n\nexport default QuickCreate;\n"]}
1
+ {"version":3,"file":"QuickCreate.js","sourceRoot":"","sources":["../../../src/components/QuickCreate/QuickCreate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,kBAAkB,EAClB,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAqBnF,MAAM,qBAAqB,GAAG,MAAM,CAAC,IAAI,CAAC,CAA2B,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE;IAC7F,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,UAA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AW,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { Ref, MouseEventHandler } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Card,\n CardContent,\n CardHeader,\n defaultThemeProp,\n Flex,\n Grid,\n StyledIcon,\n Icon,\n Text,\n VisuallyHiddenText,\n useBreakpoint,\n useTheme,\n supplementalColors,\n resolveSupplementalColor,\n isSolidColor,\n readableColor,\n useConsolidatedRef,\n createClassName\n} from '@pega/cosmos-react-core';\nimport type {\n BaseProps,\n ForwardRefForwardPropsComponent,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\nimport { lineClamp } from '@pega/cosmos-react-core/lib/styles/mixins';\nimport { StyledIconShape } from '@pega/cosmos-react-core/lib/components/Icon/Icon';\n\nexport interface QuickCreateAction {\n label: string;\n icon?: string;\n description?: string;\n color?: string;\n onClick: MouseEventHandler;\n}\n\nexport type QuickCreateVariant = 'inline' | 'stacked';\n\nexport interface QuickCreateProps extends BaseProps, NoChildrenProp {\n heading: string;\n actions: QuickCreateAction[];\n variant?: QuickCreateVariant;\n showHeader?: boolean;\n backgroundColor?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledQuickCreateCard = styled(Card)<{ showHeader?: boolean }>(({ theme, showHeader }) => {\n const background = showHeader ? theme.components.card.background : 'transparent';\n\n return css`\n background: ${background};\n\n ${!showHeader &&\n css`\n padding: 0;\n `}\n `;\n});\n\nStyledQuickCreateCard.defaultProps = defaultThemeProp;\n\nexport const StyledQuickCreate = styled(CardContent)<{ showHeader?: boolean }>(({ showHeader }) => {\n return css`\n ${!showHeader &&\n css`\n &&&& {\n padding: 0;\n }\n `}\n\n ul {\n list-style: none;\n }\n `;\n});\n\nStyledQuickCreate.defaultProps = defaultThemeProp;\n\nexport const StyledQuickCreateButton = styled(Button)<{\n displayVariant: QuickCreateVariant;\n backgroundColor?: string;\n}>(({ theme, displayVariant, backgroundColor }) => {\n const background = backgroundColor || theme.base.palette['primary-background'];\n\n return css`\n height: 100%;\n width: 100%;\n max-height: none;\n padding-block: calc(${theme.base.spacing} * 1.5);\n padding-inline: calc(${theme.base.spacing} * 2);\n border-radius: ${theme.base['border-radius']};\n border-color: ${theme.base.palette['border-line']};\n justify-content: ${displayVariant === 'stacked' ? 'center' : 'start'};\n text-align: ${displayVariant === 'stacked' ? 'center' : 'start'};\n white-space: break-spaces;\n word-break: break-word;\n background: ${background};\n `;\n});\n\nStyledQuickCreateButton.defaultProps = defaultThemeProp;\n\nconst StyledButtonText = styled.span(({ theme }) => {\n return css`\n ${lineClamp(3)}\n font-weight: ${theme.base['font-weight']['semi-bold']};\n font-size: 1em;\n color: CanvasText;\n `;\n});\n\nStyledButtonText.defaultProps = defaultThemeProp;\n\nconst StyledQuickCreateContainer = styled(Flex)<{ variant: QuickCreateVariant }>(({ variant }) => {\n return css`\n width: 100%;\n\n ${variant === 'stacked' &&\n css`\n text-align: center;\n `}\n `;\n});\n\nStyledQuickCreateContainer.defaultProps = defaultThemeProp;\n\nconst StyledIconSection = styled(Flex)<{ variant: QuickCreateVariant }>(({ variant }) => {\n return css`\n min-width: ${variant === 'stacked' ? 'auto' : '2rem'};\n stroke-width: 50%;\n `;\n});\n\nStyledIconSection.defaultProps = defaultThemeProp;\n\nconst StyledMiddleSection = styled(Flex)``;\n\nStyledMiddleSection.defaultProps = defaultThemeProp;\n\nconst StyledStackedRow = styled(Flex)(() => {\n return css`\n width: 100%;\n justify-content: center;\n `;\n});\n\nStyledStackedRow.defaultProps = defaultThemeProp;\n\nexport const StyledQuickCreateSecondaryText = styled(Text)(() => {\n return css`\n ${lineClamp(3)}\n `;\n});\n\nStyledQuickCreateSecondaryText.defaultProps = defaultThemeProp;\n\nconst StyledArrowSection = styled(Flex)(() => {\n return css`\n ${StyledIconShape} {\n height: 1rem;\n }\n\n ${StyledIcon} {\n fill: CanvasText;\n height: 100%;\n align-self: flex-end;\n }\n `;\n});\n\nStyledArrowSection.defaultProps = defaultThemeProp;\n\nconst QuickCreate: ForwardRefForwardPropsComponent<QuickCreateProps> = forwardRef(\n function QuickCreate(\n {\n heading,\n actions,\n className,\n variant = 'inline',\n backgroundColor,\n showHeader = true,\n ...restProps\n }: QuickCreateProps,\n ref: QuickCreateProps['ref']\n ) {\n const theme = useTheme();\n const consolidatedRef = useConsolidatedRef<HTMLDivElement>(ref);\n\n const isSmallOrAbove = useBreakpoint('sm', { breakpointRef: consolidatedRef });\n const isMediumOrAbove = useBreakpoint('md', { breakpointRef: consolidatedRef });\n\n const displayVariant: QuickCreateVariant = variant === 'stacked' ? 'stacked' : 'inline';\n const isStacked = displayVariant === 'stacked';\n\n const supplementalColorsList = supplementalColors(theme);\n\n const getActionColor = (actionColor: string | undefined, idx: number): string | undefined => {\n const isColorIgnored = theme.base['case-type-colors'] === 'ignored';\n\n if (isColorIgnored) return undefined;\n\n if (actionColor !== undefined) {\n const supplementalColor = resolveSupplementalColor(theme, actionColor);\n\n return supplementalColor ?? (isSolidColor(actionColor) ? actionColor : undefined);\n }\n\n return supplementalColorsList[idx % supplementalColorsList.length];\n };\n\n const getIconComp = (iconName: string, iconBackground: string | undefined) => {\n return iconBackground !== undefined ? (\n <Icon\n name={iconName}\n foreground={readableColor(iconBackground, {\n mode: 'light',\n level: 'AANonText'\n })}\n background={iconBackground}\n />\n ) : (\n <Icon size='m' name={iconName} />\n );\n };\n\n const getGridCols = () => {\n if (isMediumOrAbove) {\n if (actions.length === 1) return 'repeat(2, minmax(0, 1fr))';\n const cols = Math.min(Math.max(actions.length, 1), 4);\n return `repeat(${cols}, minmax(0, 1fr))`;\n }\n if (isSmallOrAbove) return 'repeat(2, minmax(0, 1fr))';\n\n return `repeat(auto-fill, minmax(min(calc(${theme.base.spacing} * 30), 100%), 1fr))`;\n };\n\n return (\n <StyledQuickCreateCard\n {...restProps}\n ref={consolidatedRef}\n showHeader={showHeader}\n className={createClassName('quick-create', className)}\n >\n {showHeader ? (\n <CardHeader>\n <Text variant='h2'>{heading}</Text>\n </CardHeader>\n ) : (\n <VisuallyHiddenText as='h2'>{heading}</VisuallyHiddenText>\n )}\n\n <StyledQuickCreate showHeader={showHeader}>\n <Grid\n as='ul'\n container={{\n gap: 1.5,\n cols: getGridCols(),\n ...(showHeader ? {} : { justifyContent: 'center' })\n }}\n >\n {actions.map(({ label, icon, description, color, onClick }, idx) => {\n const iconBackground = getActionColor(color, idx);\n\n return (\n <li key={label}>\n <StyledQuickCreateButton\n onClick={onClick}\n variant='secondary'\n displayVariant={displayVariant}\n backgroundColor={backgroundColor}\n >\n {isStacked ? (\n <StyledQuickCreateContainer\n variant={displayVariant}\n container={{ gap: 0.75, alignItems: 'center', direction: 'column' }}\n >\n {icon && (\n <StyledStackedRow container>\n <StyledIconSection variant={displayVariant} container>\n {getIconComp(icon, iconBackground)}\n </StyledIconSection>\n </StyledStackedRow>\n )}\n\n <StyledStackedRow container>\n <StyledButtonText as='span'>{label}</StyledButtonText>\n </StyledStackedRow>\n\n {description && (\n <StyledStackedRow container>\n <StyledQuickCreateSecondaryText variant='secondary' forwardedAs='p'>\n {description}\n </StyledQuickCreateSecondaryText>\n </StyledStackedRow>\n )}\n </StyledQuickCreateContainer>\n ) : (\n <StyledQuickCreateContainer\n variant={displayVariant}\n container={{ gap: 0, alignItems: 'center' }}\n >\n <Flex\n container={{\n gap: 1.5,\n alignItems: description ? 'start' : 'center'\n }}\n item={{ grow: 1 }}\n >\n {icon && (\n <StyledIconSection variant={displayVariant} container>\n {getIconComp(icon, iconBackground)}\n </StyledIconSection>\n )}\n\n <StyledMiddleSection\n container={{\n direction: 'column',\n gap: 0.25,\n alignItems: 'start',\n justify: 'center'\n }}\n item={{ grow: 1 }}\n >\n <StyledButtonText as='span'>{label}</StyledButtonText>\n\n {description && (\n <StyledQuickCreateSecondaryText variant='secondary' forwardedAs='p'>\n {description}\n </StyledQuickCreateSecondaryText>\n )}\n </StyledMiddleSection>\n </Flex>\n\n <StyledArrowSection container>\n <Icon name='arrow-right' size='s' />\n </StyledArrowSection>\n </StyledQuickCreateContainer>\n )}\n </StyledQuickCreateButton>\n </li>\n );\n })}\n </Grid>\n </StyledQuickCreate>\n </StyledQuickCreateCard>\n );\n }\n);\n\nexport default QuickCreate;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-wss",
3
- "version": "10.0.0-build.4.7",
3
+ "version": "10.0.0-build.4.8",
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": "10.0.0-build.4.7",
18
- "@pega/cosmos-react-work": "10.0.0-build.4.7",
17
+ "@pega/cosmos-react-core": "10.0.0-build.4.8",
18
+ "@pega/cosmos-react-work": "10.0.0-build.4.8",
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",