@pega/cosmos-react-work 9.0.0-build.29.26 → 9.0.0-build.29.27
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/Shortcuts/Shortcuts.d.ts.map +1 -1
- package/lib/components/Shortcuts/Shortcuts.js +21 -29
- package/lib/components/Shortcuts/Shortcuts.js.map +1 -1
- package/lib/components/Shortcuts/Shortcuts.styles.d.ts +11 -28
- package/lib/components/Shortcuts/Shortcuts.styles.d.ts.map +1 -1
- package/lib/components/Shortcuts/Shortcuts.styles.js +63 -190
- package/lib/components/Shortcuts/Shortcuts.styles.js.map +1 -1
- package/lib/components/Shortcuts/Shortcuts.types.d.ts +12 -17
- package/lib/components/Shortcuts/Shortcuts.types.d.ts.map +1 -1
- package/lib/components/Shortcuts/Shortcuts.types.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shortcuts.d.ts","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Shortcuts.d.ts","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,OAAO,CAAC;AAsBxD,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,mBAAmB,CAAC;;;;AAkLtE,wBAA2D"}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, forwardRef } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { parseToRgb } from 'polished';
|
|
4
|
+
import { Card, CardContent, CardHeader, EmptyState, Flex, Text, VisuallyHiddenText, registerIcon, tryCatch, useArrows, useBreakpoint, useI18n, useTestIds, useTheme, withTestIds } from '@pega/cosmos-react-core';
|
|
5
|
+
import * as openNewTabIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/open.icon';
|
|
6
|
+
import { StyledExternalIcon, StyledLabelRow, StyledShortcutsCard, StyledShortcutsCardButton, StyledShortcutsCardsContainer, StyledShortcutsCategoriesContainer, StyledShortcutsCategoryHeading, StyledShortcutsCardIcon } from './Shortcuts.styles';
|
|
5
7
|
import { getShortcutsTestIds } from './Shortcuts.test-ids';
|
|
8
|
+
registerIcon(openNewTabIcon);
|
|
6
9
|
const itemLinkProps = (item) => {
|
|
7
10
|
if (item.type === 'external') {
|
|
8
11
|
return { href: item.href, target: '_blank', rel: 'noopener noreferrer' };
|
|
9
12
|
}
|
|
10
13
|
return { onClick: item.onClick };
|
|
11
14
|
};
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
return (_jsxs(StyledLinksListItem, { isSmallOrAbove: true, children: [_jsxs(StyledShortcutsButton, { isInline: true, variant: 'link', ref: setButtonEl, ...itemLinkProps(item), children: [_jsx(Icon, { name: item.icon, background: iconBackground, shape: 'square' }), _jsx(StyledInlineLinkLabel, { children: item.label })] }), buttonEl && (_jsx(Tooltip, { target: buttonEl, smart: true, children: item.label }))] }));
|
|
15
|
-
};
|
|
16
|
-
const Shortcuts = forwardRef(function Shortcuts({ heading, items = [], categories, displayMode = 'links', showHeader = true, testId, ...restProps }, ref) {
|
|
15
|
+
const CardItem = ({ item, iconBackground, variant }) => (_jsx(StyledShortcutsCard, { children: _jsxs(StyledShortcutsCardButton, { variant: 'link', layoutVariant: variant, ...itemLinkProps(item), children: [_jsx(StyledShortcutsCardIcon, { name: item.icon, background: iconBackground, shape: 'square', layoutVariant: variant }), _jsxs(StyledLabelRow, { children: [_jsx(Text, { as: 'span', variant: 'h3', children: item.label }), item.type === 'external' && _jsx(StyledExternalIcon, { name: 'open' })] })] }) }));
|
|
16
|
+
const Shortcuts = forwardRef(function Shortcuts({ heading, items = [], categories, showHeader = true, variant = 'inline', testId, ...restProps }, ref) {
|
|
17
17
|
const t = useI18n();
|
|
18
18
|
const testIds = useTestIds(testId, getShortcutsTestIds);
|
|
19
|
-
const { base: { palette: {
|
|
19
|
+
const { base: { palette: { 'brand-accent': brandAccent, 'brand-primary': brandPrimary } } } = useTheme();
|
|
20
|
+
const iconBackground = tryCatch(() => {
|
|
21
|
+
parseToRgb(brandAccent);
|
|
22
|
+
return brandAccent;
|
|
23
|
+
}) ?? brandPrimary;
|
|
20
24
|
const flatListRef = useRef(null);
|
|
21
25
|
const categoriesContainerRef = useRef(null);
|
|
22
26
|
useArrows(flatListRef, { dir: 'both', cycle: true });
|
|
@@ -25,31 +29,19 @@ const Shortcuts = forwardRef(function Shortcuts({ heading, items = [], categorie
|
|
|
25
29
|
breakpointRef: categories ? categoriesContainerRef : flatListRef
|
|
26
30
|
});
|
|
27
31
|
const emptyState = _jsx(EmptyState, { message: t('no_items'), "data-testid": testIds.emptyState });
|
|
28
|
-
const
|
|
29
|
-
if (item.type === 'external' && item.preview) {
|
|
30
|
-
return (_jsx(Flex, { container: { direction: 'column' }, as: StyledShortcutsPreviewItem, children: _jsx(StyledPreviewShell, { children: item.preview }) }, item.id));
|
|
31
|
-
}
|
|
32
|
-
return (_jsx(StyledShortcutsCard, { children: _jsxs(StyledShortcutsCardButton, { variant: 'link', ...itemLinkProps(item), children: [_jsx(StyledShortcutsCardIcon, { name: item.icon, background: iconBackground, shape: 'square' }), _jsx(Text, { as: 'span', variant: 'h3', children: item.label })] }) }, item.id));
|
|
33
|
-
};
|
|
34
|
-
const renderStackedLinkItem = (item) => (_jsx(StyledLinksListItem, { isSmallOrAbove: false, children: _jsxs(StyledShortcutsStackedButton, { variant: 'link', ...itemLinkProps(item), children: [_jsx(Icon, { name: item.icon, background: iconBackground, shape: 'square' }), item.label] }) }, item.id));
|
|
35
|
-
const renderCategoryLinkItem = (item) => isWide ? (_jsx(Flex, { container: { alignItems: 'center', pad: [1.5, undefined] }, as: 'li', children: _jsxs(StyledShortcutsButton, { variant: 'link', ...itemLinkProps(item), children: [_jsx(StyledCategoryItemIcon, { name: item.icon, background: iconBackground, shape: 'square' }), item.label] }) }, item.id)) : (renderStackedLinkItem(item));
|
|
36
|
-
const withCardShell = (content) => (_jsxs(Card, { ...restProps, "data-testid": testIds.root, ref: ref, children: [_jsx(StyledShortcutsHeader, { children: _jsx(Text, { variant: 'h2', children: heading ?? t('shortcuts') }) }), _jsx(StyledShortcutCardContent, { isNonCategoryLink: !categories && displayMode === 'links', children: content })] }));
|
|
37
|
-
if (displayMode === 'card' && !categories) {
|
|
38
|
-
const cardGrid = (_jsx(StyledShortcutsCardsContainer, { ref: flatListRef, isSmallOrAbove: isWide, showHeader: showHeader, role: 'list', "data-testid": testIds.list, "aria-label": heading ?? t('shortcuts'), children: items.map(renderCardItem) }));
|
|
39
|
-
if (!showHeader) {
|
|
40
|
-
if (items.length === 0)
|
|
41
|
-
return null;
|
|
42
|
-
return (_jsxs("div", { "data-testid": testIds.root, ...restProps, ref: ref, children: [_jsx(VisuallyHiddenText, { children: heading ?? t('shortcuts') }), cardGrid] }));
|
|
43
|
-
}
|
|
44
|
-
return withCardShell(items.length === 0 ? emptyState : cardGrid);
|
|
45
|
-
}
|
|
32
|
+
const withCardShell = (content) => (_jsxs(Card, { ...restProps, "data-testid": testIds.root, ref: ref, children: [_jsx(CardHeader, { children: _jsx(Text, { variant: 'h2', children: heading ?? t('shortcuts') }) }), _jsx(CardContent, { children: content })] }));
|
|
46
33
|
if (categories) {
|
|
47
34
|
const visibleCategories = categories.filter(cat => cat.items.length > 0);
|
|
48
|
-
const categorySections =
|
|
35
|
+
const categorySections = (_jsx(StyledShortcutsCategoriesContainer, { ref: categoriesContainerRef, isSmallOrAbove: false, children: visibleCategories.map(cat => (_jsxs(Flex, { container: { direction: 'column' }, "aria-labelledby": `cat-${cat.id}`, "data-testid": testIds.categorySection, as: 'section', children: [_jsx(StyledShortcutsCategoryHeading, { id: `cat-${cat.id}`, "data-testid": testIds.categoryHeading, variant: 'h3', children: cat.label }), _jsx(StyledShortcutsCardsContainer, { isSmallOrAbove: isWide, showHeader: true, role: 'list', "aria-label": cat.label, children: cat.items.map(item => (_jsx(CardItem, { item: item, iconBackground: iconBackground, variant: variant }, item.id))) })] }, cat.id))) }));
|
|
49
36
|
return withCardShell(visibleCategories.length === 0 ? emptyState : categorySections);
|
|
50
37
|
}
|
|
51
|
-
const
|
|
52
|
-
|
|
38
|
+
const cardGrid = (_jsx(StyledShortcutsCardsContainer, { ref: flatListRef, isSmallOrAbove: isWide, showHeader: showHeader, role: 'list', "data-testid": testIds.list, "aria-label": heading ?? t('shortcuts'), children: items.map(item => (_jsx(CardItem, { item: item, iconBackground: iconBackground, variant: variant }, item.id))) }));
|
|
39
|
+
if (!showHeader) {
|
|
40
|
+
if (items.length === 0)
|
|
41
|
+
return null;
|
|
42
|
+
return (_jsxs("div", { "data-testid": testIds.root, ...restProps, ref: ref, children: [_jsx(VisuallyHiddenText, { children: heading ?? t('shortcuts') }), cardGrid] }));
|
|
43
|
+
}
|
|
44
|
+
return withCardShell(items.length === 0 ? emptyState : cardGrid);
|
|
53
45
|
});
|
|
54
46
|
export default withTestIds(Shortcuts, getShortcutsTestIds);
|
|
55
47
|
//# sourceMappingURL=Shortcuts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shortcuts.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG3C,OAAO,EACL,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,UAAU,EACV,OAAO,EACP,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB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EAAE,EAAE,iBACN,OAAO,CAAC,eAAe,EACpC,OAAO,EAAC,IAAI,YAEX,GAAG,CAAC,KAAK,GACqB,EAEjC,KAAC,mBAAmB,IAAC,cAAc,EAAE,KAAK,EAAE,IAAI,EAAC,MAAM,gBAAa,GAAG,CAAC,KAAK,YAC1E,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,sBAAsB,CAAC,GAClB,KAfjB,GAAG,CAAC,EAAE,CAgBN,CACR,CAAC,GACiC,CACtC,CAAC;QAEJ,OAAO,aAAa,CAAC,iBAAiB,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACvF,CAAC;IAED,MAAM,YAAY,GAAG,CACnB,KAAC,2BAA2B,cAC1B,KAAC,mBAAmB,IAClB,GAAG,EAAE,WAAW,EAChB,cAAc,EAAE,MAAM,EACtB,IAAI,EAAC,MAAM,iBACE,OAAO,CAAC,IAAI,gBACb,OAAO,IAAI,CAAC,CAAC,WAAW,CAAC,YAEpC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAChB,MAAM,CAAC,CAAC,CAAC,CACP,KAAC,cAAc,IAAe,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,cAAc,IAAnD,IAAI,CAAC,EAAE,CAAgD,CAC7E,CAAC,CAAC,CAAC,CACF,qBAAqB,CAAC,IAAI,CAAC,CAC5B,CACF,GACmB,GACM,CAC/B,CAAC;IAEF,OAAO,aAAa,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;AACvE,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { useRef, forwardRef } from 'react';\nimport type { ReactNode, PropsWithoutRef } from 'react';\n\nimport {\n Card,\n EmptyState,\n Flex,\n Icon,\n Text,\n Tooltip,\n VisuallyHiddenText,\n useArrows,\n useBreakpoint,\n useElement,\n useI18n,\n useTestIds,\n useTheme,\n withTestIds\n} from '@pega/cosmos-react-core';\n\nimport type { ShortcutsProps, ShortcutItem } from './Shortcuts.types';\nimport {\n StyledInlineLinkLabel,\n StyledLinksListItem,\n StyledShortcutsButton,\n StyledShortcutsCard,\n StyledShortcutsCardButton,\n StyledPreviewShell,\n StyledShortcutsPreviewItem,\n StyledShortcutsCardsContainer,\n StyledCategoryItemIcon,\n StyledShortcutsCategoriesContainer,\n StyledShortcutsCategoryHeading,\n StyledShortcutsList,\n StyledShortcutsLinksWrapper,\n StyledShortcutsStackedButton,\n StyledShortcutsCardIcon,\n StyledShortcutsHeader,\n StyledShortcutCardContent\n} from './Shortcuts.styles';\nimport { getShortcutsTestIds } from './Shortcuts.test-ids';\n\nconst itemLinkProps = (\n item: ShortcutItem\n): {\n href?: string;\n target?: string;\n rel?: string;\n onClick?: () => void;\n} => {\n if (item.type === 'external') {\n return { href: item.href, target: '_blank', rel: 'noopener noreferrer' };\n }\n\n return { onClick: item.onClick };\n};\n\nconst InlineLinkItem = ({\n item,\n iconBackground\n}: {\n item: ShortcutItem;\n iconBackground: string;\n}) => {\n const [buttonEl, setButtonEl] = useElement();\n\n return (\n <StyledLinksListItem isSmallOrAbove>\n <StyledShortcutsButton isInline variant='link' ref={setButtonEl} {...itemLinkProps(item)}>\n <Icon name={item.icon} background={iconBackground} shape='square' />\n <StyledInlineLinkLabel>{item.label}</StyledInlineLinkLabel>\n </StyledShortcutsButton>\n\n {buttonEl && (\n <Tooltip target={buttonEl} smart>\n {item.label}\n </Tooltip>\n )}\n </StyledLinksListItem>\n );\n};\n\nconst Shortcuts = forwardRef(function Shortcuts(\n {\n heading,\n items = [],\n categories,\n displayMode = 'links',\n showHeader = true,\n testId,\n ...restProps\n }: PropsWithoutRef<ShortcutsProps>,\n ref: ShortcutsProps['ref']\n) {\n const t = useI18n();\n const testIds = useTestIds(testId, getShortcutsTestIds);\n const {\n base: {\n palette: { interactive: iconBackground }\n }\n } = useTheme();\n\n const flatListRef = useRef<HTMLUListElement>(null);\n const categoriesContainerRef = useRef<HTMLDivElement>(null);\n\n useArrows(flatListRef, { dir: 'both', cycle: true });\n useArrows(categoriesContainerRef, { dir: 'both', cycle: true });\n\n const isWide = useBreakpoint('sm', {\n breakpointRef: categories ? categoriesContainerRef : flatListRef\n });\n\n const emptyState = <EmptyState message={t('no_items')} data-testid={testIds.emptyState} />;\n\n const renderCardItem = (item: ShortcutItem) => {\n if (item.type === 'external' && item.preview) {\n return (\n <Flex container={{ direction: 'column' }} key={item.id} as={StyledShortcutsPreviewItem}>\n <StyledPreviewShell>{item.preview}</StyledPreviewShell>\n </Flex>\n );\n }\n\n return (\n <StyledShortcutsCard key={item.id}>\n <StyledShortcutsCardButton variant='link' {...itemLinkProps(item)}>\n <StyledShortcutsCardIcon name={item.icon} background={iconBackground} shape='square' />\n <Text as='span' variant='h3'>\n {item.label}\n </Text>\n </StyledShortcutsCardButton>\n </StyledShortcutsCard>\n );\n };\n\n const renderStackedLinkItem = (item: ShortcutItem) => (\n <StyledLinksListItem key={item.id} isSmallOrAbove={false}>\n <StyledShortcutsStackedButton variant='link' {...itemLinkProps(item)}>\n <Icon name={item.icon} background={iconBackground} shape='square' />\n {item.label}\n </StyledShortcutsStackedButton>\n </StyledLinksListItem>\n );\n\n const renderCategoryLinkItem = (item: ShortcutItem) =>\n isWide ? (\n <Flex container={{ alignItems: 'center', pad: [1.5, undefined] }} key={item.id} as='li'>\n <StyledShortcutsButton variant='link' {...itemLinkProps(item)}>\n <StyledCategoryItemIcon name={item.icon} background={iconBackground} shape='square' />\n {item.label}\n </StyledShortcutsButton>\n </Flex>\n ) : (\n renderStackedLinkItem(item)\n );\n\n const withCardShell = (content: ReactNode) => (\n <Card {...restProps} data-testid={testIds.root} ref={ref}>\n <StyledShortcutsHeader>\n <Text variant='h2'>{heading ?? t('shortcuts')}</Text>\n </StyledShortcutsHeader>\n\n <StyledShortcutCardContent isNonCategoryLink={!categories && displayMode === 'links'}>\n {content}\n </StyledShortcutCardContent>\n </Card>\n );\n\n if (displayMode === 'card' && !categories) {\n const cardGrid = (\n <StyledShortcutsCardsContainer\n ref={flatListRef}\n isSmallOrAbove={isWide}\n showHeader={showHeader}\n role='list'\n data-testid={testIds.list}\n aria-label={heading ?? t('shortcuts')}\n >\n {items.map(renderCardItem)}\n </StyledShortcutsCardsContainer>\n );\n\n if (!showHeader) {\n if (items.length === 0) return null;\n\n return (\n <div data-testid={testIds.root} {...restProps} ref={ref}>\n <VisuallyHiddenText>{heading ?? t('shortcuts')}</VisuallyHiddenText>\n {cardGrid}\n </div>\n );\n }\n\n return withCardShell(items.length === 0 ? emptyState : cardGrid);\n }\n\n if (categories) {\n const visibleCategories = categories.filter(cat => cat.items.length > 0);\n\n const categorySections =\n displayMode === 'card' ? (\n <StyledShortcutsCategoriesContainer ref={categoriesContainerRef} isSmallOrAbove={false}>\n {visibleCategories.map(cat => (\n <Flex\n container={{ direction: 'column' }}\n key={cat.id}\n aria-labelledby={`cat-${cat.id}`}\n data-testid={testIds.categorySection}\n as='section'\n >\n <StyledShortcutsCategoryHeading\n id={`cat-${cat.id}`}\n data-testid={testIds.categoryHeading}\n variant='h3'\n >\n {cat.label}\n </StyledShortcutsCategoryHeading>\n\n <StyledShortcutsCardsContainer\n isSmallOrAbove={isWide}\n showHeader\n role='list'\n aria-label={cat.label}\n >\n {cat.items.map(renderCardItem)}\n </StyledShortcutsCardsContainer>\n </Flex>\n ))}\n </StyledShortcutsCategoriesContainer>\n ) : (\n <StyledShortcutsCategoriesContainer ref={categoriesContainerRef} isSmallOrAbove={isWide}>\n {visibleCategories.map(cat => (\n <Flex\n container={{ direction: 'column' }}\n key={cat.id}\n aria-labelledby={`cat-${cat.id}`}\n data-testid={testIds.categorySection}\n as='section'\n >\n <StyledShortcutsCategoryHeading\n id={`cat-${cat.id}`}\n data-testid={testIds.categoryHeading}\n variant='h3'\n >\n {cat.label}\n </StyledShortcutsCategoryHeading>\n\n <StyledShortcutsList isSmallOrAbove={false} role='list' aria-label={cat.label}>\n {cat.items.map(renderCategoryLinkItem)}\n </StyledShortcutsList>\n </Flex>\n ))}\n </StyledShortcutsCategoriesContainer>\n );\n\n return withCardShell(visibleCategories.length === 0 ? emptyState : categorySections);\n }\n\n const flatLinkList = (\n <StyledShortcutsLinksWrapper>\n <StyledShortcutsList\n ref={flatListRef}\n isSmallOrAbove={isWide}\n role='list'\n data-testid={testIds.list}\n aria-label={heading ?? t('shortcuts')}\n >\n {items.map(item =>\n isWide ? (\n <InlineLinkItem key={item.id} item={item} iconBackground={iconBackground} />\n ) : (\n renderStackedLinkItem(item)\n )\n )}\n </StyledShortcutsList>\n </StyledShortcutsLinksWrapper>\n );\n\n return withCardShell(items.length === 0 ? emptyState : flatLinkList);\n});\n\nexport default withTestIds(Shortcuts, getShortcutsTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"Shortcuts.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EACL,IAAI,EACJ,WAAW,EACX,UAAU,EACV,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,kBAAkB,EAClB,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,aAAa,EACb,OAAO,EACP,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,cAAc,MAAM,6DAA6D,CAAC;AAG9F,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,yBAAyB,EACzB,6BAA6B,EAC7B,kCAAkC,EAClC,8BAA8B,EAC9B,uBAAuB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D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W,CAAC,YAEpC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACjB,KAAC,QAAQ,IAAe,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,IAArE,IAAI,CAAC,EAAE,CAAkE,CACzF,CAAC,GAC4B,CACjC,CAAC;IAEF,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAEpC,OAAO,CACL,8BAAkB,OAAO,CAAC,IAAI,KAAM,SAAS,EAAE,GAAG,EAAE,GAAG,aACrD,KAAC,kBAAkB,cAAE,OAAO,IAAI,CAAC,CAAC,WAAW,CAAC,GAAsB,EACnE,QAAQ,IACL,CACP,CAAC;IACJ,CAAC;IAED,OAAO,aAAa,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AACnE,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { useRef, forwardRef } from 'react';\nimport type { ReactNode, PropsWithoutRef } from 'react';\nimport { parseToRgb } from 'polished';\n\nimport {\n Card,\n CardContent,\n CardHeader,\n EmptyState,\n Flex,\n Text,\n VisuallyHiddenText,\n registerIcon,\n tryCatch,\n useArrows,\n useBreakpoint,\n useI18n,\n useTestIds,\n useTheme,\n withTestIds\n} from '@pega/cosmos-react-core';\nimport * as openNewTabIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/open.icon';\n\nimport type { ShortcutsProps, ShortcutItem } from './Shortcuts.types';\nimport {\n StyledExternalIcon,\n StyledLabelRow,\n StyledShortcutsCard,\n StyledShortcutsCardButton,\n StyledShortcutsCardsContainer,\n StyledShortcutsCategoriesContainer,\n StyledShortcutsCategoryHeading,\n StyledShortcutsCardIcon\n} from './Shortcuts.styles';\nimport { getShortcutsTestIds } from './Shortcuts.test-ids';\n\nregisterIcon(openNewTabIcon);\n\nconst itemLinkProps = (\n item: ShortcutItem\n): {\n href?: string;\n target?: string;\n rel?: string;\n onClick?: () => void;\n} => {\n if (item.type === 'external') {\n return { href: item.href, target: '_blank', rel: 'noopener noreferrer' };\n }\n\n return { onClick: item.onClick };\n};\n\nconst CardItem = ({\n item,\n iconBackground,\n variant\n}: {\n item: ShortcutItem;\n iconBackground: string;\n variant: 'stacked' | 'inline';\n}) => (\n <StyledShortcutsCard>\n <StyledShortcutsCardButton variant='link' layoutVariant={variant} {...itemLinkProps(item)}>\n <StyledShortcutsCardIcon\n name={item.icon}\n background={iconBackground}\n shape='square'\n layoutVariant={variant}\n />\n <StyledLabelRow>\n <Text as='span' variant='h3'>\n {item.label}\n </Text>\n\n {item.type === 'external' && <StyledExternalIcon name='open' />}\n </StyledLabelRow>\n </StyledShortcutsCardButton>\n </StyledShortcutsCard>\n);\n\nconst Shortcuts = forwardRef(function Shortcuts(\n {\n heading,\n items = [],\n categories,\n showHeader = true,\n variant = 'inline',\n testId,\n ...restProps\n }: PropsWithoutRef<ShortcutsProps>,\n ref: ShortcutsProps['ref']\n) {\n const t = useI18n();\n const testIds = useTestIds(testId, getShortcutsTestIds);\n const {\n base: {\n palette: { 'brand-accent': brandAccent, 'brand-primary': brandPrimary }\n }\n } = useTheme();\n\n const iconBackground =\n tryCatch(() => {\n parseToRgb(brandAccent);\n return brandAccent;\n }) ?? brandPrimary;\n\n const flatListRef = useRef<HTMLUListElement>(null);\n const categoriesContainerRef = useRef<HTMLDivElement>(null);\n\n useArrows(flatListRef, { dir: 'both', cycle: true });\n useArrows(categoriesContainerRef, { dir: 'both', cycle: true });\n\n const isWide = useBreakpoint('sm', {\n breakpointRef: categories ? categoriesContainerRef : flatListRef\n });\n\n const emptyState = <EmptyState message={t('no_items')} data-testid={testIds.emptyState} />;\n\n const withCardShell = (content: ReactNode) => (\n <Card {...restProps} data-testid={testIds.root} ref={ref}>\n <CardHeader>\n <Text variant='h2'>{heading ?? t('shortcuts')}</Text>\n </CardHeader>\n <CardContent>{content}</CardContent>\n </Card>\n );\n\n if (categories) {\n const visibleCategories = categories.filter(cat => cat.items.length > 0);\n\n const categorySections = (\n <StyledShortcutsCategoriesContainer ref={categoriesContainerRef} isSmallOrAbove={false}>\n {visibleCategories.map(cat => (\n <Flex\n container={{ direction: 'column' }}\n key={cat.id}\n aria-labelledby={`cat-${cat.id}`}\n data-testid={testIds.categorySection}\n as='section'\n >\n <StyledShortcutsCategoryHeading\n id={`cat-${cat.id}`}\n data-testid={testIds.categoryHeading}\n variant='h3'\n >\n {cat.label}\n </StyledShortcutsCategoryHeading>\n\n <StyledShortcutsCardsContainer\n isSmallOrAbove={isWide}\n showHeader\n role='list'\n aria-label={cat.label}\n >\n {cat.items.map(item => (\n <CardItem\n key={item.id}\n item={item}\n iconBackground={iconBackground}\n variant={variant}\n />\n ))}\n </StyledShortcutsCardsContainer>\n </Flex>\n ))}\n </StyledShortcutsCategoriesContainer>\n );\n\n return withCardShell(visibleCategories.length === 0 ? emptyState : categorySections);\n }\n\n const cardGrid = (\n <StyledShortcutsCardsContainer\n ref={flatListRef}\n isSmallOrAbove={isWide}\n showHeader={showHeader}\n role='list'\n data-testid={testIds.list}\n aria-label={heading ?? t('shortcuts')}\n >\n {items.map(item => (\n <CardItem key={item.id} item={item} iconBackground={iconBackground} variant={variant} />\n ))}\n </StyledShortcutsCardsContainer>\n );\n\n if (!showHeader) {\n if (items.length === 0) return null;\n\n return (\n <div data-testid={testIds.root} {...restProps} ref={ref}>\n <VisuallyHiddenText>{heading ?? t('shortcuts')}</VisuallyHiddenText>\n {cardGrid}\n </div>\n );\n }\n\n return withCardShell(items.length === 0 ? emptyState : cardGrid);\n});\n\nexport default withTestIds(Shortcuts, getShortcutsTestIds);\n"]}
|
|
@@ -1,39 +1,22 @@
|
|
|
1
|
-
export declare const StyledShortcutsHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
|
|
2
|
-
export declare const StyledShortcutCardContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("@pega/cosmos-react-core").CardContentProps & import("@pega/cosmos-react-core").ForwardProps, {
|
|
3
|
-
isNonCategoryLink?: boolean;
|
|
4
|
-
}>> & string & Omit<import("react").FunctionComponent<import("@pega/cosmos-react-core").CardContentProps & import("@pega/cosmos-react-core").ForwardProps>, keyof import("react").Component<any, {}, any>>;
|
|
5
|
-
export declare const StyledShortcutsLinksWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
|
-
export declare const StyledShortcutsList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {
|
|
7
|
-
isSmallOrAbove: boolean;
|
|
8
|
-
}>> & string;
|
|
9
|
-
export declare const StyledLinksListItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {
|
|
10
|
-
isSmallOrAbove: boolean;
|
|
11
|
-
}>> & string;
|
|
12
|
-
export declare const StyledShortcutsButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<import("@pega/cosmos-react-core").ButtonProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement> & import("@pega/cosmos-react-core").ForwardProps, "ref"> & {
|
|
13
|
-
ref?: ((instance: HTMLAnchorElement | HTMLButtonElement | 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<HTMLAnchorElement | HTMLButtonElement> | null | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
isInline?: boolean;
|
|
16
|
-
}>> & string & Omit<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").ButtonProps>, keyof import("react").Component<any, {}, any>>;
|
|
17
|
-
export declare const StyledInlineLinkLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
18
|
-
export declare const StyledShortcutsStackedButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("@pega/cosmos-react-core").ButtonProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement> & import("@pega/cosmos-react-core").ForwardProps, "ref"> & {
|
|
19
|
-
ref?: ((instance: HTMLAnchorElement | HTMLButtonElement | 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<HTMLAnchorElement | HTMLButtonElement> | null | undefined;
|
|
20
|
-
}, never>> & string & Omit<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").ButtonProps>, keyof import("react").Component<any, {}, any>>;
|
|
21
1
|
export declare const StyledShortcutsCardsContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {
|
|
22
2
|
isSmallOrAbove: boolean;
|
|
23
3
|
showHeader: boolean;
|
|
24
4
|
}>> & string;
|
|
25
|
-
export declare const StyledShortcutsCard: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>> & string;
|
|
26
|
-
export declare const StyledShortcutsPreviewItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>> & string;
|
|
27
|
-
export declare const StyledPreviewShell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
28
|
-
export declare const StyledShortcutsCardButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("@pega/cosmos-react-core").ButtonProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement> & import("@pega/cosmos-react-core").ForwardProps, "ref"> & {
|
|
29
|
-
ref?: ((instance: HTMLAnchorElement | HTMLButtonElement | 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<HTMLAnchorElement | HTMLButtonElement> | null | undefined;
|
|
30
|
-
}, never>> & string & Omit<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").ButtonProps>, keyof import("react").Component<any, {}, any>>;
|
|
31
|
-
export declare const StyledShortcutsCardIcon: 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, import("styled-components/dist/types").BaseObject>> & string & Omit<import("react").ForwardRefExoticComponent<import("@pega/cosmos-react-core").IconProps>, keyof import("react").Component<any, {}, any>>;
|
|
32
5
|
export declare const StyledShortcutsCategoriesContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
33
6
|
isSmallOrAbove: boolean;
|
|
34
7
|
}>> & string;
|
|
35
8
|
export declare const StyledShortcutsCategoryHeading: 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"> & {
|
|
36
9
|
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;
|
|
37
10
|
}, never>> & string & Omit<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").TextProps>, keyof import("react").Component<any, {}, any>>;
|
|
38
|
-
export declare const
|
|
11
|
+
export declare const StyledShortcutsCard: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>> & string;
|
|
12
|
+
export declare const StyledShortcutsCardButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<import("@pega/cosmos-react-core").ButtonProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement> & import("@pega/cosmos-react-core").ForwardProps, "ref"> & {
|
|
13
|
+
ref?: ((instance: HTMLAnchorElement | HTMLButtonElement | 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<HTMLAnchorElement | HTMLButtonElement> | null | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
layoutVariant: "stacked" | "inline";
|
|
16
|
+
}>> & string & Omit<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").ButtonProps>, keyof import("react").Component<any, {}, any>>;
|
|
17
|
+
export declare const StyledShortcutsCardIcon: 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, {
|
|
18
|
+
layoutVariant: "stacked" | "inline";
|
|
19
|
+
}>> & string & Omit<import("react").ForwardRefExoticComponent<import("@pega/cosmos-react-core").IconProps>, keyof import("react").Component<any, {}, any>>;
|
|
20
|
+
export declare const StyledLabelRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
21
|
+
export declare const StyledExternalIcon: 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, import("styled-components/dist/types").BaseObject>> & string & Omit<import("react").ForwardRefExoticComponent<import("@pega/cosmos-react-core").IconProps>, keyof import("react").Component<any, {}, any>>;
|
|
39
22
|
//# sourceMappingURL=Shortcuts.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shortcuts.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Shortcuts.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,6BAA6B;oBACxB,OAAO;gBACX,OAAO;YAqBnB,CAAC;AAIH,eAAO,MAAM,kCAAkC;oBAAgC,OAAO;YAqBrF,CAAC;AAIF,eAAO,MAAM,8BAA8B;;yLAIzC,CAAC;AAIH,eAAO,MAAM,mBAAmB,6NAG/B,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;mBAAmC,SAAS,GAAG,QAAQ;oLAyC3F,CAAC;AAIH,eAAO,MAAM,uBAAuB;mBAAiC,SAAS,GAAG,QAAQ;0JAUxF,CAAC;AAIF,eAAO,MAAM,cAAc,+NAM1B,CAAC;AAIF,eAAO,MAAM,kBAAkB,kaAE9B,CAAC"}
|
|
@@ -1,115 +1,13 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import { mix } from 'polished';
|
|
3
|
-
import { Button,
|
|
4
|
-
export const StyledShortcutsHeader = styled.header(({ theme: { base, components } }) => {
|
|
5
|
-
return css `
|
|
6
|
-
padding: calc(${base.spacing} * 1.5) calc(${components.card.padding} * 2);
|
|
7
|
-
padding-block-end: 0;
|
|
8
|
-
`;
|
|
9
|
-
});
|
|
10
|
-
StyledShortcutsHeader.defaultProps = defaultThemeProp;
|
|
11
|
-
export const StyledShortcutCardContent = styled(CardContent)(({ isNonCategoryLink }) => {
|
|
12
|
-
return css `
|
|
13
|
-
${isNonCategoryLink &&
|
|
14
|
-
css `
|
|
15
|
-
&&&& {
|
|
16
|
-
padding-inline: 0;
|
|
17
|
-
}
|
|
18
|
-
`}
|
|
19
|
-
`;
|
|
20
|
-
});
|
|
21
|
-
StyledShortcutCardContent.defaultProps = defaultThemeProp;
|
|
22
|
-
export const StyledShortcutsLinksWrapper = styled.div(({ theme }) => {
|
|
23
|
-
return css `
|
|
24
|
-
overflow: hidden;
|
|
25
|
-
width: 100%;
|
|
26
|
-
padding-block: calc(${theme.base.spacing} * 0.5);
|
|
27
|
-
margin-block: calc(${theme.base.spacing} * -0.5);
|
|
28
|
-
`;
|
|
29
|
-
});
|
|
30
|
-
StyledShortcutsLinksWrapper.defaultProps = defaultThemeProp;
|
|
31
|
-
export const StyledShortcutsList = styled.ul(({ theme: { base }, isSmallOrAbove }) => {
|
|
32
|
-
return css `
|
|
33
|
-
display: grid;
|
|
34
|
-
grid-template-columns: minmax(0, 1fr);
|
|
35
|
-
list-style: none;
|
|
36
|
-
padding: 0;
|
|
37
|
-
margin: 0;
|
|
38
|
-
width: 100%;
|
|
39
|
-
|
|
40
|
-
${isSmallOrAbove &&
|
|
41
|
-
css `
|
|
42
|
-
grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
|
|
43
|
-
row-gap: calc(${base.spacing} * 1.5);
|
|
44
|
-
margin-inline-start: -0.0625rem;
|
|
45
|
-
`}
|
|
46
|
-
|
|
47
|
-
${!isSmallOrAbove &&
|
|
48
|
-
css `
|
|
49
|
-
padding-inline: calc(${base.spacing} * 2);
|
|
50
|
-
`}
|
|
51
|
-
`;
|
|
52
|
-
});
|
|
53
|
-
StyledShortcutsList.defaultProps = defaultThemeProp;
|
|
54
|
-
export const StyledLinksListItem = styled.li(({ theme: { base }, isSmallOrAbove }) => {
|
|
55
|
-
return css `
|
|
56
|
-
display: flex;
|
|
57
|
-
align-items: center;
|
|
58
|
-
|
|
59
|
-
${isSmallOrAbove &&
|
|
60
|
-
css `
|
|
61
|
-
border-inline-start: 0.0625rem solid ${base.palette['border-line']};
|
|
62
|
-
padding-inline: calc(${base.spacing} * 2);
|
|
63
|
-
min-height: 100%;
|
|
64
|
-
`}
|
|
65
|
-
|
|
66
|
-
${!isSmallOrAbove &&
|
|
67
|
-
css `
|
|
68
|
-
padding-block: calc(${base.spacing} * 1.5);
|
|
69
|
-
padding-inline: calc(${base.spacing} * 1.5);
|
|
70
|
-
width: 100%;
|
|
71
|
-
`}
|
|
72
|
-
`;
|
|
73
|
-
});
|
|
74
|
-
StyledLinksListItem.defaultProps = defaultThemeProp;
|
|
75
|
-
export const StyledShortcutsButton = styled(Button)(({ theme: { base }, isInline }) => {
|
|
76
|
-
return css `
|
|
77
|
-
display: flex;
|
|
78
|
-
align-items: center;
|
|
79
|
-
gap: ${base.spacing};
|
|
80
|
-
|
|
81
|
-
${isInline &&
|
|
82
|
-
css `
|
|
83
|
-
flex: 1 1 0;
|
|
84
|
-
min-width: 0;
|
|
85
|
-
`}
|
|
86
|
-
`;
|
|
87
|
-
});
|
|
88
|
-
StyledShortcutsButton.defaultProps = defaultThemeProp;
|
|
89
|
-
export const StyledInlineLinkLabel = styled.span `
|
|
90
|
-
overflow: hidden;
|
|
91
|
-
text-overflow: ellipsis;
|
|
92
|
-
white-space: nowrap;
|
|
93
|
-
min-width: 0;
|
|
94
|
-
flex: 1;
|
|
95
|
-
`;
|
|
96
|
-
StyledInlineLinkLabel.defaultProps = defaultThemeProp;
|
|
97
|
-
export const StyledShortcutsStackedButton = styled(Button)(({ theme: { base } }) => {
|
|
98
|
-
return css `
|
|
99
|
-
display: flex;
|
|
100
|
-
align-items: center;
|
|
101
|
-
width: 100%;
|
|
102
|
-
gap: calc(${base.spacing} * 2);
|
|
103
|
-
`;
|
|
104
|
-
});
|
|
105
|
-
StyledShortcutsStackedButton.defaultProps = defaultThemeProp;
|
|
3
|
+
import { Button, defaultThemeProp, Icon, Text, tryCatch } from '@pega/cosmos-react-core';
|
|
106
4
|
export const StyledShortcutsCardsContainer = styled.ul(({ theme: { base }, isSmallOrAbove, showHeader }) => {
|
|
107
5
|
return css `
|
|
108
6
|
display: grid;
|
|
109
7
|
grid-template-columns: minmax(0, 1fr);
|
|
110
8
|
gap: ${base.spacing};
|
|
111
9
|
list-style: none;
|
|
112
|
-
padding: 0;
|
|
10
|
+
padding: ${base.spacing} 0;
|
|
113
11
|
margin: 0;
|
|
114
12
|
|
|
115
13
|
${isSmallOrAbove &&
|
|
@@ -125,94 +23,11 @@ export const StyledShortcutsCardsContainer = styled.ul(({ theme: { base }, isSma
|
|
|
125
23
|
`;
|
|
126
24
|
});
|
|
127
25
|
StyledShortcutsCardsContainer.defaultProps = defaultThemeProp;
|
|
128
|
-
export const StyledShortcutsCard = styled.li(({ theme: { base, components } }) => {
|
|
129
|
-
const hoverBackgroundColor = tryCatch(() => mix(0.9, base.palette['primary-background'], components.button['secondary-color']));
|
|
130
|
-
return css `
|
|
131
|
-
display: flex;
|
|
132
|
-
flex-direction: column;
|
|
133
|
-
min-height: 8rem;
|
|
134
|
-
border: 0.0625rem solid ${base.palette['border-line']};
|
|
135
|
-
border-radius: ${base['border-radius']};
|
|
136
|
-
background: ${base.palette['primary-background']};
|
|
137
|
-
box-shadow: ${base.shadow.low};
|
|
138
|
-
|
|
139
|
-
&:hover {
|
|
140
|
-
background: ${hoverBackgroundColor};
|
|
141
|
-
}
|
|
142
|
-
`;
|
|
143
|
-
});
|
|
144
|
-
StyledShortcutsCard.defaultProps = defaultThemeProp;
|
|
145
|
-
export const StyledShortcutsPreviewItem = styled.li `
|
|
146
|
-
min-height: 8rem;
|
|
147
|
-
`;
|
|
148
|
-
StyledShortcutsPreviewItem.defaultProps = defaultThemeProp;
|
|
149
|
-
export const StyledPreviewShell = styled.div(({ theme: { base, components } }) => {
|
|
150
|
-
const hoverBackgroundColor = tryCatch(() => mix(0.9, base.palette['primary-background'], components.button['secondary-color']));
|
|
151
|
-
return css `
|
|
152
|
-
flex: 1;
|
|
153
|
-
min-height: 0;
|
|
154
|
-
display: flex;
|
|
155
|
-
flex-direction: column;
|
|
156
|
-
|
|
157
|
-
&& > * > * > * {
|
|
158
|
-
flex: 1;
|
|
159
|
-
min-height: 0;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
&& > * {
|
|
163
|
-
flex: 1;
|
|
164
|
-
min-height: 0;
|
|
165
|
-
display: flex;
|
|
166
|
-
flex-direction: column;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
&& > * > * {
|
|
170
|
-
flex: 1;
|
|
171
|
-
min-height: 0;
|
|
172
|
-
box-shadow: ${base.shadow.low};
|
|
173
|
-
--border-radius: ${base['border-radius']};
|
|
174
|
-
|
|
175
|
-
&:hover {
|
|
176
|
-
background: ${hoverBackgroundColor};
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
`;
|
|
180
|
-
});
|
|
181
|
-
StyledPreviewShell.defaultProps = defaultThemeProp;
|
|
182
|
-
export const StyledShortcutsCardButton = styled(Button)(({ theme: { base } }) => {
|
|
183
|
-
return css `
|
|
184
|
-
display: flex;
|
|
185
|
-
flex-direction: column;
|
|
186
|
-
align-items: center;
|
|
187
|
-
justify-content: flex-start;
|
|
188
|
-
gap: calc(${base.spacing} * 2);
|
|
189
|
-
padding-block-start: calc(${base.spacing} * 4);
|
|
190
|
-
padding-block-end: calc(${base.spacing} * 3);
|
|
191
|
-
padding-inline: calc(${base.spacing} * 2);
|
|
192
|
-
width: 100%;
|
|
193
|
-
text-align: center;
|
|
194
|
-
flex: 1;
|
|
195
|
-
border-radius: inherit;
|
|
196
|
-
|
|
197
|
-
&:focus-visible {
|
|
198
|
-
outline: none;
|
|
199
|
-
box-shadow: ${base.shadow.focus};
|
|
200
|
-
}
|
|
201
|
-
`;
|
|
202
|
-
});
|
|
203
|
-
StyledShortcutsCardButton.defaultProps = defaultThemeProp;
|
|
204
|
-
export const StyledShortcutsCardIcon = styled(Icon)(() => {
|
|
205
|
-
return css `
|
|
206
|
-
width: 3rem;
|
|
207
|
-
height: 3rem;
|
|
208
|
-
`;
|
|
209
|
-
});
|
|
210
|
-
StyledShortcutsCardIcon.defaultProps = defaultThemeProp;
|
|
211
26
|
export const StyledShortcutsCategoriesContainer = styled.div(({ theme: { base }, isSmallOrAbove }) => {
|
|
212
27
|
return css `
|
|
213
28
|
display: grid;
|
|
214
29
|
grid-template-columns: minmax(0, 1fr);
|
|
215
|
-
gap: calc(${base.spacing} *
|
|
30
|
+
gap: calc(${base.spacing} * 2);
|
|
216
31
|
width: 100%;
|
|
217
32
|
|
|
218
33
|
${isSmallOrAbove &&
|
|
@@ -224,6 +39,7 @@ export const StyledShortcutsCategoriesContainer = styled.div(({ theme: { base },
|
|
|
224
39
|
${!isSmallOrAbove &&
|
|
225
40
|
css `
|
|
226
41
|
padding-inline: calc(${base.spacing} * 0.5);
|
|
42
|
+
padding-block: ${base.spacing};
|
|
227
43
|
`}
|
|
228
44
|
`;
|
|
229
45
|
});
|
|
@@ -234,8 +50,65 @@ export const StyledShortcutsCategoryHeading = styled(Text)(({ theme: { base } })
|
|
|
234
50
|
`;
|
|
235
51
|
});
|
|
236
52
|
StyledShortcutsCategoryHeading.defaultProps = defaultThemeProp;
|
|
237
|
-
export const
|
|
53
|
+
export const StyledShortcutsCard = styled.li `
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
`;
|
|
57
|
+
export const StyledShortcutsCardButton = styled(Button)(({ theme: { base, components }, layoutVariant }) => {
|
|
58
|
+
const hoverBackgroundColor = tryCatch(() => mix(0.9, base.palette['primary-background'], components.button['secondary-color']));
|
|
59
|
+
return css `
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: flex-start;
|
|
63
|
+
flex: 1;
|
|
64
|
+
width: 100%;
|
|
65
|
+
border: 0.0625rem solid ${base.palette['border-line']};
|
|
66
|
+
border-radius: ${base['border-radius']};
|
|
67
|
+
background: ${base.palette['primary-background']};
|
|
68
|
+
padding-inline: calc(${base.spacing} * 2);
|
|
69
|
+
|
|
70
|
+
&:hover {
|
|
71
|
+
background: ${hoverBackgroundColor};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
${layoutVariant === 'stacked' &&
|
|
75
|
+
css `
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
gap: calc(${base.spacing} * 2);
|
|
78
|
+
padding-block-start: calc(${base.spacing} * 4);
|
|
79
|
+
padding-block-end: calc(${base.spacing} * 3);
|
|
80
|
+
text-align: center;
|
|
81
|
+
min-height: 8rem;
|
|
82
|
+
`}
|
|
83
|
+
|
|
84
|
+
${layoutVariant === 'inline' &&
|
|
85
|
+
css `
|
|
86
|
+
flex-direction: row;
|
|
87
|
+
gap: calc(${base.spacing} * 1.5);
|
|
88
|
+
padding-block: calc(${base.spacing} * 1.5);
|
|
89
|
+
text-align: start;
|
|
90
|
+
`}
|
|
91
|
+
`;
|
|
92
|
+
});
|
|
93
|
+
StyledShortcutsCardButton.defaultProps = defaultThemeProp;
|
|
94
|
+
export const StyledShortcutsCardIcon = styled(Icon)(({ layoutVariant }) => css `
|
|
95
|
+
flex-shrink: 0;
|
|
96
|
+
|
|
97
|
+
${layoutVariant === 'stacked' &&
|
|
98
|
+
css `
|
|
99
|
+
width: 3rem;
|
|
100
|
+
height: 3rem;
|
|
101
|
+
`}
|
|
102
|
+
`);
|
|
103
|
+
StyledShortcutsCardIcon.defaultProps = defaultThemeProp;
|
|
104
|
+
export const StyledLabelRow = styled.span(({ theme: { base } }) => css `
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
gap: calc(${base.spacing} * 0.5);
|
|
108
|
+
`);
|
|
109
|
+
StyledLabelRow.defaultProps = defaultThemeProp;
|
|
110
|
+
export const StyledExternalIcon = styled(Icon) `
|
|
238
111
|
flex-shrink: 0;
|
|
239
112
|
`;
|
|
240
|
-
|
|
113
|
+
StyledExternalIcon.defaultProps = defaultThemeProp;
|
|
241
114
|
//# sourceMappingURL=Shortcuts.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shortcuts.styles.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EACL,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE;IACrF,OAAO,GAAG,CAAA;oBACQ,IAAI,CAAC,OAAO,gBAAgB,UA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,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE;IACjF,OAAO,GAAG,CAAA;wBACY,IAAI,CAAC,OAAO;GACjC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,8BAA8B,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAEjD,CAAC;AAEF,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport {\n Button,\n CardContent,\n defaultThemeProp,\n Icon,\n Text,\n tryCatch\n} from '@pega/cosmos-react-core';\n\nexport const StyledShortcutsHeader = styled.header(({ theme: { base, components } }) => {\n return css`\n padding: calc(${base.spacing} * 1.5) calc(${components.card.padding} * 2);\n padding-block-end: 0;\n `;\n});\n\nStyledShortcutsHeader.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutCardContent = styled(CardContent)<{ isNonCategoryLink?: boolean }>(({\n isNonCategoryLink\n}) => {\n return css`\n ${isNonCategoryLink &&\n css`\n &&&& {\n padding-inline: 0;\n }\n `}\n `;\n});\n\nStyledShortcutCardContent.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsLinksWrapper = styled.div(({ theme }) => {\n return css`\n overflow: hidden;\n width: 100%;\n padding-block: calc(${theme.base.spacing} * 0.5);\n margin-block: calc(${theme.base.spacing} * -0.5);\n `;\n});\n\nStyledShortcutsLinksWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsList = styled.ul<{ isSmallOrAbove: boolean }>(\n ({ theme: { base }, isSmallOrAbove }) => {\n return css`\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n list-style: none;\n padding: 0;\n margin: 0;\n width: 100%;\n\n ${isSmallOrAbove &&\n css`\n grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));\n row-gap: calc(${base.spacing} * 1.5);\n margin-inline-start: -0.0625rem;\n `}\n\n ${!isSmallOrAbove &&\n css`\n padding-inline: calc(${base.spacing} * 2);\n `}\n `;\n }\n);\n\nStyledShortcutsList.defaultProps = defaultThemeProp;\n\nexport const StyledLinksListItem = styled.li<{ isSmallOrAbove: boolean }>(\n ({ theme: { base }, isSmallOrAbove }) => {\n return css`\n display: flex;\n align-items: center;\n\n ${isSmallOrAbove &&\n css`\n border-inline-start: 0.0625rem solid ${base.palette['border-line']};\n padding-inline: calc(${base.spacing} * 2);\n min-height: 100%;\n `}\n\n ${!isSmallOrAbove &&\n css`\n padding-block: calc(${base.spacing} * 1.5);\n padding-inline: calc(${base.spacing} * 1.5);\n width: 100%;\n `}\n `;\n }\n);\n\nStyledLinksListItem.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsButton = styled(Button)<{ isInline?: boolean }>(({\n theme: { base },\n isInline\n}) => {\n return css`\n display: flex;\n align-items: center;\n gap: ${base.spacing};\n\n ${isInline &&\n css`\n flex: 1 1 0;\n min-width: 0;\n `}\n `;\n});\n\nStyledShortcutsButton.defaultProps = defaultThemeProp;\n\nexport const StyledInlineLinkLabel = styled.span`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n flex: 1;\n`;\n\nStyledInlineLinkLabel.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsStackedButton = styled(Button)(({ theme: { base } }) => {\n return css`\n display: flex;\n align-items: center;\n width: 100%;\n gap: calc(${base.spacing} * 2);\n `;\n});\n\nStyledShortcutsStackedButton.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCardsContainer = styled.ul<{\n isSmallOrAbove: boolean;\n showHeader: boolean;\n}>(({ theme: { base }, isSmallOrAbove, showHeader }) => {\n return css`\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n gap: ${base.spacing};\n list-style: none;\n padding: 0;\n margin: 0;\n\n ${isSmallOrAbove &&\n css`\n grid-auto-rows: 1fr;\n grid-template-columns: ${showHeader\n ? 'repeat(auto-fill, minmax(14rem, 1fr))'\n : 'repeat(auto-fit, minmax(14rem, 14rem))'};\n justify-content: ${showHeader ? 'start' : 'center'};\n align-items: stretch;\n width: 100%;\n `}\n `;\n});\n\nStyledShortcutsCardsContainer.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCard = styled.li(({ theme: { base, components } }) => {\n const hoverBackgroundColor = tryCatch(() =>\n mix(0.9, base.palette['primary-background'], components.button['secondary-color'])\n );\n\n return css`\n display: flex;\n flex-direction: column;\n min-height: 8rem;\n border: 0.0625rem solid ${base.palette['border-line']};\n border-radius: ${base['border-radius']};\n background: ${base.palette['primary-background']};\n box-shadow: ${base.shadow.low};\n\n &:hover {\n background: ${hoverBackgroundColor};\n }\n `;\n});\n\nStyledShortcutsCard.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsPreviewItem = styled.li`\n min-height: 8rem;\n`;\n\nStyledShortcutsPreviewItem.defaultProps = defaultThemeProp;\n\nexport const StyledPreviewShell = styled.div(({ theme: { base, components } }) => {\n const hoverBackgroundColor = tryCatch(() =>\n mix(0.9, base.palette['primary-background'], components.button['secondary-color'])\n );\n\n return css`\n flex: 1;\n min-height: 0;\n display: flex;\n flex-direction: column;\n\n && > * > * > * {\n flex: 1;\n min-height: 0;\n }\n\n && > * {\n flex: 1;\n min-height: 0;\n display: flex;\n flex-direction: column;\n }\n\n && > * > * {\n flex: 1;\n min-height: 0;\n box-shadow: ${base.shadow.low};\n --border-radius: ${base['border-radius']};\n\n &:hover {\n background: ${hoverBackgroundColor};\n }\n }\n `;\n});\n\nStyledPreviewShell.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCardButton = styled(Button)(({ theme: { base } }) => {\n return css`\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-start;\n gap: calc(${base.spacing} * 2);\n padding-block-start: calc(${base.spacing} * 4);\n padding-block-end: calc(${base.spacing} * 3);\n padding-inline: calc(${base.spacing} * 2);\n width: 100%;\n text-align: center;\n flex: 1;\n border-radius: inherit;\n\n &:focus-visible {\n outline: none;\n box-shadow: ${base.shadow.focus};\n }\n `;\n});\n\nStyledShortcutsCardButton.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCardIcon = styled(Icon)(() => {\n return css`\n width: 3rem;\n height: 3rem;\n `;\n});\n\nStyledShortcutsCardIcon.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCategoriesContainer = styled.div<{ isSmallOrAbove: boolean }>(\n ({ theme: { base }, isSmallOrAbove }) => {\n return css`\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n gap: calc(${base.spacing} * 3);\n width: 100%;\n\n ${isSmallOrAbove &&\n css`\n grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));\n align-items: start;\n `}\n\n ${!isSmallOrAbove &&\n css`\n padding-inline: calc(${base.spacing} * 0.5);\n `}\n `;\n }\n);\n\nStyledShortcutsCategoriesContainer.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCategoryHeading = styled(Text)(({ theme: { base } }) => {\n return css`\n margin-block-end: ${base.spacing};\n `;\n});\n\nStyledShortcutsCategoryHeading.defaultProps = defaultThemeProp;\n\nexport const StyledCategoryItemIcon = styled(Icon)`\n flex-shrink: 0;\n`;\n\nStyledCategoryItemIcon.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"Shortcuts.styles.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEzF,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,EAAE,CAGnD,CAAC,EAAE,KAAK,EAAE,EAA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M,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAE7C,CAAC;AAEF,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport { Button, defaultThemeProp, Icon, Text, tryCatch } from '@pega/cosmos-react-core';\n\nexport const StyledShortcutsCardsContainer = styled.ul<{\n isSmallOrAbove: boolean;\n showHeader: boolean;\n}>(({ theme: { base }, isSmallOrAbove, showHeader }) => {\n return css`\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n gap: ${base.spacing};\n list-style: none;\n padding: ${base.spacing} 0;\n margin: 0;\n\n ${isSmallOrAbove &&\n css`\n grid-auto-rows: 1fr;\n grid-template-columns: ${showHeader\n ? 'repeat(auto-fill, minmax(14rem, 1fr))'\n : 'repeat(auto-fit, minmax(14rem, 14rem))'};\n justify-content: ${showHeader ? 'start' : 'center'};\n align-items: stretch;\n width: 100%;\n `}\n `;\n});\n\nStyledShortcutsCardsContainer.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCategoriesContainer = styled.div<{ isSmallOrAbove: boolean }>(\n ({ theme: { base }, isSmallOrAbove }) => {\n return css`\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n gap: calc(${base.spacing} * 2);\n width: 100%;\n\n ${isSmallOrAbove &&\n css`\n grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));\n align-items: start;\n `}\n\n ${!isSmallOrAbove &&\n css`\n padding-inline: calc(${base.spacing} * 0.5);\n padding-block: ${base.spacing};\n `}\n `;\n }\n);\n\nStyledShortcutsCategoriesContainer.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCategoryHeading = styled(Text)(({ theme: { base } }) => {\n return css`\n margin-block-end: ${base.spacing};\n `;\n});\n\nStyledShortcutsCategoryHeading.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCard = styled.li`\n display: flex;\n flex-direction: column;\n`;\n\nexport const StyledShortcutsCardButton = styled(Button)<{ layoutVariant: 'stacked' | 'inline' }>(({\n theme: { base, components },\n layoutVariant\n}) => {\n const hoverBackgroundColor = tryCatch(() =>\n mix(0.9, base.palette['primary-background'], components.button['secondary-color'])\n );\n\n return css`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n flex: 1;\n width: 100%;\n border: 0.0625rem solid ${base.palette['border-line']};\n border-radius: ${base['border-radius']};\n background: ${base.palette['primary-background']};\n padding-inline: calc(${base.spacing} * 2);\n\n &:hover {\n background: ${hoverBackgroundColor};\n }\n\n ${layoutVariant === 'stacked' &&\n css`\n flex-direction: column;\n gap: calc(${base.spacing} * 2);\n padding-block-start: calc(${base.spacing} * 4);\n padding-block-end: calc(${base.spacing} * 3);\n text-align: center;\n min-height: 8rem;\n `}\n\n ${layoutVariant === 'inline' &&\n css`\n flex-direction: row;\n gap: calc(${base.spacing} * 1.5);\n padding-block: calc(${base.spacing} * 1.5);\n text-align: start;\n `}\n `;\n});\n\nStyledShortcutsCardButton.defaultProps = defaultThemeProp;\n\nexport const StyledShortcutsCardIcon = styled(Icon)<{ layoutVariant: 'stacked' | 'inline' }>(\n ({ layoutVariant }) => css`\n flex-shrink: 0;\n\n ${layoutVariant === 'stacked' &&\n css`\n width: 3rem;\n height: 3rem;\n `}\n `\n);\n\nStyledShortcutsCardIcon.defaultProps = defaultThemeProp;\n\nexport const StyledLabelRow = styled.span(\n ({ theme: { base } }) => css`\n display: flex;\n align-items: center;\n gap: calc(${base.spacing} * 0.5);\n `\n);\n\nStyledLabelRow.defaultProps = defaultThemeProp;\n\nexport const StyledExternalIcon = styled(Icon)`\n flex-shrink: 0;\n`;\n\nStyledExternalIcon.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Ref } from 'react';
|
|
2
2
|
import type { NoChildrenProp, TestIdProp } from '@pega/cosmos-react-core';
|
|
3
3
|
interface ShortcutItemBase {
|
|
4
4
|
/** Unique identifier for this shortcut. */
|
|
@@ -13,11 +13,6 @@ export interface ShortcutLinkItem extends ShortcutItemBase {
|
|
|
13
13
|
type: 'external';
|
|
14
14
|
/** Absolute URL the link navigates to. Opens in a new tab. */
|
|
15
15
|
href: string;
|
|
16
|
-
/**
|
|
17
|
-
* Optional preview content rendered inside the card (e.g. an Open Graph preview card).
|
|
18
|
-
* Only rendered in `card` display mode — ignored in links mode.
|
|
19
|
-
*/
|
|
20
|
-
preview?: ReactNode;
|
|
21
16
|
}
|
|
22
17
|
export interface ShortcutNavItem extends ShortcutItemBase {
|
|
23
18
|
/** Discriminant — this item navigates to a portal landing page. */
|
|
@@ -35,13 +30,11 @@ export interface ShortcutCategory {
|
|
|
35
30
|
items: ShortcutItem[];
|
|
36
31
|
}
|
|
37
32
|
interface ShortcutsWithItems {
|
|
38
|
-
/**
|
|
33
|
+
/** Shortcut items to render as cards. */
|
|
39
34
|
items?: ShortcutItem[];
|
|
40
35
|
categories?: never;
|
|
41
|
-
/** Whether to render each item as an individual card or all items as links inside a single card. */
|
|
42
|
-
displayMode?: 'card' | 'links';
|
|
43
36
|
/**
|
|
44
|
-
*
|
|
37
|
+
* Whether to render the outer card shell with a heading.
|
|
45
38
|
* When `false`, only the card grid is rendered, centered within its container.
|
|
46
39
|
* @default true
|
|
47
40
|
*/
|
|
@@ -49,19 +42,21 @@ interface ShortcutsWithItems {
|
|
|
49
42
|
}
|
|
50
43
|
interface ShortcutsWithCategories {
|
|
51
44
|
items?: never;
|
|
52
|
-
/**
|
|
53
|
-
* Grouped shortcut items.
|
|
54
|
-
*/
|
|
45
|
+
/** Grouped shortcut items, each rendered as cards under a category heading. */
|
|
55
46
|
categories: ShortcutCategory[];
|
|
56
|
-
/** Whether to render each category's items as cards or links. Defaults to `'links'`. */
|
|
57
|
-
displayMode?: 'card' | 'links';
|
|
58
|
-
/** Not applicable for categorized mode — the outer card heading is always shown. */
|
|
59
47
|
showHeader?: never;
|
|
60
48
|
}
|
|
61
49
|
interface ShortcutsBaseProps extends NoChildrenProp, TestIdProp {
|
|
62
50
|
/** Heading displayed above the shortcuts. */
|
|
63
51
|
heading?: string;
|
|
64
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Controls the layout variant of each shortcut card.
|
|
54
|
+
* - `stacked`: large icon above the label (default card style).
|
|
55
|
+
* - `inline`: small icon inline to the left of the label (list/link style).
|
|
56
|
+
* @default 'inline'
|
|
57
|
+
*/
|
|
58
|
+
variant?: 'stacked' | 'inline';
|
|
59
|
+
/** Ref for the root card element. */
|
|
65
60
|
ref?: Ref<HTMLDivElement>;
|
|
66
61
|
}
|
|
67
62
|
export type ShortcutsProps = ShortcutsBaseProps & (ShortcutsWithItems | ShortcutsWithCategories);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shortcuts.types.d.ts","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Shortcuts.types.d.ts","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1E,UAAU,gBAAgB;IACxB,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,6DAA6D;IAC7D,IAAI,EAAE,UAAU,CAAC;IACjB,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAED,UAAU,kBAAkB;IAC1B,yCAAyC;IACzC,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,uBAAuB;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,+EAA+E;IAC/E,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB;AAED,UAAU,kBAAmB,SAAQ,cAAc,EAAE,UAAU;IAC7D,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/B,qCAAqC;IACrC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,CAAC,kBAAkB,GAAG,uBAAuB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shortcuts.types.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"Shortcuts.types.js","sourceRoot":"","sources":["../../../src/components/Shortcuts/Shortcuts.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Ref } from 'react';\n\nimport type { NoChildrenProp, TestIdProp } from '@pega/cosmos-react-core';\n\ninterface ShortcutItemBase {\n /** Unique identifier for this shortcut. */\n id: string;\n /** Display label shown on the shortcut. */\n label: string;\n /** Icon name from the registered icon set. */\n icon: string;\n}\n\nexport interface ShortcutLinkItem extends ShortcutItemBase {\n /** Discriminant — this item navigates to an external URL. */\n type: 'external';\n /** Absolute URL the link navigates to. Opens in a new tab. */\n href: string;\n}\n\nexport interface ShortcutNavItem extends ShortcutItemBase {\n /** Discriminant — this item navigates to a portal landing page. */\n type: 'page';\n /** Callback invoked when the user activates this shortcut. */\n onClick: () => void;\n}\n\nexport type ShortcutItem = ShortcutLinkItem | ShortcutNavItem;\n\nexport interface ShortcutCategory {\n /** Unique identifier for this category. */\n id: string;\n /** Display label shown as the category heading. */\n label: string;\n /** Shortcut items belonging to this category. */\n items: ShortcutItem[];\n}\n\ninterface ShortcutsWithItems {\n /** Shortcut items to render as cards. */\n items?: ShortcutItem[];\n categories?: never;\n /**\n * Whether to render the outer card shell with a heading.\n * When `false`, only the card grid is rendered, centered within its container.\n * @default true\n */\n showHeader?: boolean;\n}\n\ninterface ShortcutsWithCategories {\n items?: never;\n /** Grouped shortcut items, each rendered as cards under a category heading. */\n categories: ShortcutCategory[];\n showHeader?: never;\n}\n\ninterface ShortcutsBaseProps extends NoChildrenProp, TestIdProp {\n /** Heading displayed above the shortcuts. */\n heading?: string;\n /**\n * Controls the layout variant of each shortcut card.\n * - `stacked`: large icon above the label (default card style).\n * - `inline`: small icon inline to the left of the label (list/link style).\n * @default 'inline'\n */\n variant?: 'stacked' | 'inline';\n /** Ref for the root card element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport type ShortcutsProps = ShortcutsBaseProps & (ShortcutsWithItems | ShortcutsWithCategories);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-work",
|
|
3
|
-
"version": "9.0.0-build.29.
|
|
3
|
+
"version": "9.0.0-build.29.27",
|
|
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.0.0-build.29.
|
|
18
|
-
"@pega/cosmos-react-rte": "9.0.0-build.29.
|
|
17
|
+
"@pega/cosmos-react-core": "9.0.0-build.29.27",
|
|
18
|
+
"@pega/cosmos-react-rte": "9.0.0-build.29.27",
|
|
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",
|