@pega/cosmos-react-work 9.0.0-build.23.1 → 9.0.0-build.23.3
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/SearchResults/SearchResults.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.js +9 -2
- package/lib/components/SearchResults/SearchResults.js.map +1 -1
- package/lib/components/Stages/Stages.d.ts.map +1 -1
- package/lib/components/Stages/Stages.js +4 -2
- package/lib/components/Stages/Stages.js.map +1 -1
- package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
- package/lib/components/Stages/Stages.styles.js +253 -103
- package/lib/components/Stages/Stages.styles.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchResults.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchResults.d.ts","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,+BAA+B,EAAgB,MAAM,yBAAyB,CAAC;AAI7F,OAAO,KAAK,EACV,kBAAkB,EAInB,MAAM,uBAAuB,CAAC;AAgF/B,QAAA,MAAM,aAAa,EAAE,+BAA+B,CAAC,kBAAkB,CAyQtE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useContext, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
|
-
import { Button, Count, Flex, Grid, Icon, registerIcon, Modal, EmptyState, SearchInput, Text, useModalManager, useI18n, useBreakpoint, useAfterInitialEffect, SummaryItem, Avatar, useTheme, AppShellContext, Progress, useLiveLog } from '@pega/cosmos-react-core';
|
|
4
|
+
import { Button, Count, Flex, Grid, Icon, registerIcon, Modal, EmptyState, SearchInput, Text, useModalManager, useI18n, useBreakpoint, useAfterInitialEffect, useConsolidatedRef, SummaryItem, Avatar, focusHeadingOrContainer, useTheme, AppShellContext, Progress, useLiveLog } from '@pega/cosmos-react-core';
|
|
5
5
|
import * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';
|
|
6
6
|
import * as filterOnIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter-on.icon';
|
|
7
7
|
import SearchResult from './SearchResult';
|
|
@@ -32,6 +32,7 @@ const SearchResults = forwardRef(function SearchResults({ results, searchInputPr
|
|
|
32
32
|
const { base: { palette: { 'brand-primary': primary } } } = useTheme();
|
|
33
33
|
const [accent, setAccent] = useState();
|
|
34
34
|
const [submittedSearchValue, setSubmittedSearchValue] = useState(searchInputProps.value);
|
|
35
|
+
const pageRef = useConsolidatedRef(ref);
|
|
35
36
|
const activeFilters = filters.flatMap(group => {
|
|
36
37
|
if (group.type === 'select') {
|
|
37
38
|
return group.items.flatMap(item => {
|
|
@@ -79,6 +80,12 @@ const SearchResults = forwardRef(function SearchResults({ results, searchInputPr
|
|
|
79
80
|
if (filters.length)
|
|
80
81
|
announcePolite({ message: t('search_filter_update_message') });
|
|
81
82
|
}, []);
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
const focusContainer = pageRef.current;
|
|
85
|
+
if (!loading && submittedSearchValue && focusContainer) {
|
|
86
|
+
focusHeadingOrContainer(focusContainer, t('search'));
|
|
87
|
+
}
|
|
88
|
+
}, [loading, submittedSearchValue, t]);
|
|
82
89
|
const searchTitle = (_jsx(SummaryItem, { as: StyledSearchSummaryItem, visual: _jsx(Avatar, { icon: 'search', name: 'search', shape: 'squircle', backgroundColor: primary, color: 'white' }), primary: _jsx(Text, { variant: 'h1', children: t('search') }), actions: onClearAllFilters &&
|
|
83
90
|
isMedium &&
|
|
84
91
|
!!activeFilters.length && (_jsx(Button, { variant: 'link', onClick: onClearAllFilters, "aria-label": t('search_results_clear_all_filters'), children: t('clear_all') })) }));
|
|
@@ -86,7 +93,7 @@ const SearchResults = forwardRef(function SearchResults({ results, searchInputPr
|
|
|
86
93
|
searchInputProps.onSearchSubmit?.(val);
|
|
87
94
|
setSubmittedSearchValue(val);
|
|
88
95
|
}, placeholder: searchInputProps.placeholder }));
|
|
89
|
-
return (_jsxs(Grid, { ...restProps, as: StyledSearchResults, ref:
|
|
96
|
+
return (_jsxs(Grid, { ...restProps, as: StyledSearchResults, ref: pageRef, md: filters.length
|
|
90
97
|
? {
|
|
91
98
|
container: {
|
|
92
99
|
cols: '15rem auto'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchResults.js","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EACL,MAAM,EACN,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,UAAU,EACV,WAAW,EACX,IAAI,EACJ,eAAe,EACf,OAAO,EACP,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,MAAM,EACN,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,UAAU,MAAM,+DAA+D,CAAC;AAC5F,OAAO,KAAK,YAAY,MAAM,kEAAkE,CAAC;AAQjG,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,YAAY,MAAM,gBAAg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,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { forwardRef, useContext, useEffect, useRef, useState } from 'react';\nimport type { PropsWithoutRef, ComponentProps } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport {\n Button,\n Count,\n Flex,\n Grid,\n Icon,\n registerIcon,\n Modal,\n EmptyState,\n SearchInput,\n Text,\n useModalManager,\n useI18n,\n useBreakpoint,\n useAfterInitialEffect,\n SummaryItem,\n Avatar,\n useTheme,\n AppShellContext,\n Progress,\n useLiveLog\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent, ModalMethods } from '@pega/cosmos-react-core';\nimport * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';\nimport * as filterOnIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter-on.icon';\n\nimport type {\n SearchResultsProps,\n SearchResultProps,\n FilterProps,\n ActiveFilters\n} from './SearchResults.types';\nimport SearchResult from './SearchResult';\nimport Filter from './Filter';\nimport {\n StyledModalFilterContent,\n StyledCountText,\n StyledSelectedFilters,\n StyledSearchResults,\n StyledResults,\n StyledFilters,\n StyledSearchSummaryItem\n} from './SearchResults.styles';\nimport ActiveFilter from './ActiveFilter';\n\nregisterIcon(filterIcon, filterOnIcon);\n\nconst FilterModal = (\n props: Pick<\n SearchResultsProps,\n 'count' | 'filters' | 'onFilterChange' | 'onClearFilter' | 'onClearAllFilters'\n > & {\n activeFilters: ActiveFilters[];\n }\n) => {\n const { activeFilters, count, filters, onFilterChange, onClearFilter, onClearAllFilters } = props;\n const t = useI18n();\n\n return (\n <Modal heading={t('filters')}>\n <Grid as={StyledModalFilterContent} container={{ rowGap: 2 }}>\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n <Text as={StyledCountText} variant='secondary'>\n {t('results_count', [count], { count })}\n </Text>\n {onClearAllFilters && !!activeFilters.length && (\n <Button variant='link' onClick={onClearAllFilters}>\n {t('clear_all')}\n </Button>\n )}\n </Flex>\n {!!activeFilters.length && (\n <Flex\n as={StyledSelectedFilters}\n container={{ gap: 1 }}\n aria-label={t('search_results_active_filters')}\n >\n {activeFilters.map(filter => {\n return (\n <ActiveFilter\n key={filter.id}\n name={`${filter.groupName}: ${filter.name}`}\n onRemove={() =>\n onFilterChange?.({\n name: filter.groupName,\n type: filter.type,\n value: filter.resetValue\n })\n }\n />\n );\n })}\n </Flex>\n )}\n <div>\n {filters.map((filter: FilterProps) => {\n return (\n <Filter\n key={filter.name}\n onFilterChange={onFilterChange}\n onClearFilter={onClearFilter}\n {...filter}\n />\n );\n })}\n </div>\n </Grid>\n </Modal>\n );\n};\n\nconst SearchResults: ForwardRefForwardPropsComponent<SearchResultsProps> = forwardRef(\n function SearchResults(\n {\n results,\n searchInputProps,\n count,\n filters,\n onFilterChange,\n onClearAllFilters,\n onClearFilter,\n onShowMore,\n loading = false,\n ...restProps\n }: PropsWithoutRef<SearchResultsProps>,\n ref: SearchResultsProps['ref']\n ) {\n const t = useI18n();\n const isMedium = useBreakpoint('md');\n const { create } = useModalManager();\n const { searchContainerEl } = useContext(AppShellContext);\n const { announcePolite } = useLiveLog();\n const filtersMethods = useRef<ModalMethods<ComponentProps<typeof FilterModal>>>();\n const {\n base: {\n palette: { 'brand-primary': primary }\n }\n } = useTheme();\n const [accent, setAccent] = useState<undefined | RegExp>();\n const [submittedSearchValue, setSubmittedSearchValue] = useState(searchInputProps.value);\n\n const activeFilters: ActiveFilters[] = filters.flatMap(group => {\n if (group.type === 'select') {\n return group.items.flatMap(item => {\n if (item.checked) {\n return {\n id: item.id,\n name: item.name,\n resetValue: { ...item, checked: false },\n groupName: group.name,\n type: group.type\n };\n }\n return [];\n });\n }\n return [];\n });\n\n const openFiltersModal = () => {\n filtersMethods.current = create(FilterModal, {\n activeFilters,\n count,\n filters,\n onFilterChange,\n onClearFilter,\n onClearAllFilters\n });\n };\n\n useAfterInitialEffect(() => {\n if (filtersMethods.current) {\n filtersMethods.current.update({\n activeFilters,\n count,\n filters\n });\n }\n }, [activeFilters, count, filters]);\n\n useAfterInitialEffect(() => {\n if (isMedium && filtersMethods.current) filtersMethods.current.dismiss();\n }, [isMedium]);\n\n useAfterInitialEffect(() => {\n setAccent(submittedSearchValue ? new RegExp(submittedSearchValue, 'gi') : undefined);\n }, [submittedSearchValue]);\n\n useEffect(() => {\n if (filters.length) announcePolite({ message: t('search_filter_update_message') });\n }, []);\n\n const searchTitle = (\n <SummaryItem\n as={StyledSearchSummaryItem}\n visual={\n <Avatar\n icon='search'\n name='search'\n shape='squircle'\n backgroundColor={primary}\n color='white'\n />\n }\n primary={<Text variant='h1'>{t('search')}</Text>}\n actions={\n onClearAllFilters &&\n isMedium &&\n !!activeFilters.length && (\n <Button\n variant='link'\n onClick={onClearAllFilters}\n aria-label={t('search_results_clear_all_filters')}\n >\n {t('clear_all')}\n </Button>\n )\n }\n />\n );\n const searchInput = (\n <SearchInput\n {...searchInputProps}\n onSearchSubmit={val => {\n searchInputProps.onSearchSubmit?.(val);\n setSubmittedSearchValue(val);\n }}\n placeholder={searchInputProps.placeholder}\n />\n );\n\n return (\n <Grid\n {...restProps}\n as={StyledSearchResults}\n ref={ref}\n md={\n filters.length\n ? {\n container: {\n cols: '15rem auto'\n }\n }\n : undefined\n }\n sm={\n filters.length\n ? {\n container: {\n cols: 'auto',\n rowGap: 2\n }\n }\n : undefined\n }\n container={{\n rows: 'auto auto',\n cols: 'auto 1fr',\n areas: '\"filters results\"'\n }}\n >\n {isMedium && !!filters.length && (\n <Grid item={{ area: 'filters', alignSelf: 'start' }} as={StyledFilters}>\n {searchTitle}\n {filters.map((filter: FilterProps) => {\n return (\n <Filter\n key={filter.name}\n onFilterChange={onFilterChange}\n onClearFilter={onClearFilter}\n {...filter}\n />\n );\n })}\n </Grid>\n )}\n <Grid\n item={{ alignSelf: 'start', area: 'results' }}\n container={{\n alignItems: 'center',\n rowGap: 2,\n rows: 'auto auto 1fr',\n areas: '\"search\" \"meta\" \"items\"'\n }}\n as={StyledResults}\n >\n {loading && <Progress placement='local' />}\n {searchContainerEl && isMedium ? (\n createPortal(searchInput, searchContainerEl)\n ) : (\n <Grid item={{ area: 'search' }}>\n {!isMedium && searchTitle}\n {searchInput}\n </Grid>\n )}\n <Grid item={{ area: 'meta' }} container={{ rowGap: 1 }}>\n <Flex container={{ justify: 'between', alignItems: 'center' }}>\n {!loading && (\n <Text as={StyledCountText} variant='secondary'>\n {submittedSearchValue !== '' || results.length > 0\n ? t('results_count', [count], { count })\n : ''}\n </Text>\n )}\n {!isMedium && !!filters.length && (\n <Button variant='secondary' onClick={openFiltersModal}>\n <Icon name={activeFilters.length > 0 ? 'filter-on' : 'filter'} />\n {t('filters')} \n <Count>{activeFilters.length}</Count>\n </Button>\n )}\n </Flex>\n {!!activeFilters.length && (\n <Flex\n as={StyledSelectedFilters}\n container={{ gap: 1, wrap: 'wrap' }}\n aria-label={t('search_results_active_filters')}\n >\n {activeFilters.map(filter => {\n return (\n <ActiveFilter\n key={filter.id}\n name={`${filter.groupName}: ${filter.name}`}\n onRemove={() =>\n onFilterChange?.({\n name: filter.groupName,\n type: filter.type,\n value: filter.resetValue\n })\n }\n />\n );\n })}\n </Flex>\n )}\n </Grid>\n <Grid\n item={{ area: 'items', alignSelf: results.length ? 'start' : 'stretch' }}\n container={{ rowGap: 2 }}\n >\n {!loading && (\n <>\n {results.length ? (\n results.map((result: SearchResultProps) => {\n return <SearchResult key={result.id} {...result} accent={accent} />;\n })\n ) : (\n <Grid item={{ alignSelf: 'stretch' }}>\n <EmptyState\n message={submittedSearchValue === '' ? t('empty_search') : undefined}\n />\n </Grid>\n )}\n {onShowMore && (\n <Flex container={{ justify: 'center' }}>\n <Button variant='link' onClick={onShowMore}>\n {t('show_more')}\n </Button>\n </Flex>\n )}\n </>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n }\n);\n\nexport default SearchResults;\n"]}
|
|
1
|
+
{"version":3,"file":"SearchResults.js","sourceRoot":"","sources":["../../../src/components/SearchResults/SearchResults.tsx"],"names":[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G,EAAE,CACb,cAAc,EAAE,CAAC;4CACf,IAAI,EAAE,MAAM,CAAC,SAAS;4CACtB,IAAI,EAAE,MAAM,CAAC,IAAI;4CACjB,KAAK,EAAE,MAAM,CAAC,UAAU;yCACzB,CAAC,IAPC,MAAM,CAAC,EAAE,CASd,CACH,CAAC;gCACJ,CAAC,CAAC,GACG,CACR,IACI,EACP,KAAC,IAAI,IACH,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,EACxE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,YAEvB,CAAC,OAAO,IAAI,CACX,8BACG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAChB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAyB,EAAE,EAAE;oCACxC,OAAO,KAAC,YAAY,OAAqB,MAAM,EAAE,MAAM,EAAE,MAAM,IAArC,MAAM,CAAC,EAAE,CAAgC,CAAC;gCACtE,CAAC,CAAC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,YAClC,KAAC,UAAU,IACT,OAAO,EAAE,oBAAoB,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,GACpE,GACG,CACR,EACA,UAAU,IAAI,CACb,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,YACpC,KAAC,MAAM,IAAC,OAAO,EAAC,MAAM,EAAC,OAAO,EAAE,UAAU,YACvC,CAAC,CAAC,WAAW,CAAC,GACR,GACJ,CACR,IACA,CACJ,GACI,IACF,IACF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { forwardRef, useContext, useEffect, useRef, useState } from 'react';\nimport type { PropsWithoutRef, ComponentProps } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport {\n Button,\n Count,\n Flex,\n Grid,\n Icon,\n registerIcon,\n Modal,\n EmptyState,\n SearchInput,\n Text,\n useModalManager,\n useI18n,\n useBreakpoint,\n useAfterInitialEffect,\n useConsolidatedRef,\n SummaryItem,\n Avatar,\n focusHeadingOrContainer,\n useTheme,\n AppShellContext,\n Progress,\n useLiveLog\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent, ModalMethods } from '@pega/cosmos-react-core';\nimport * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';\nimport * as filterOnIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter-on.icon';\n\nimport type {\n SearchResultsProps,\n SearchResultProps,\n FilterProps,\n ActiveFilters\n} from './SearchResults.types';\nimport SearchResult from './SearchResult';\nimport Filter from './Filter';\nimport {\n StyledModalFilterContent,\n StyledCountText,\n StyledSelectedFilters,\n StyledSearchResults,\n StyledResults,\n StyledFilters,\n StyledSearchSummaryItem\n} from './SearchResults.styles';\nimport ActiveFilter from './ActiveFilter';\n\nregisterIcon(filterIcon, filterOnIcon);\n\nconst FilterModal = (\n props: Pick<\n SearchResultsProps,\n 'count' | 'filters' | 'onFilterChange' | 'onClearFilter' | 'onClearAllFilters'\n > & {\n activeFilters: ActiveFilters[];\n }\n) => {\n const { activeFilters, count, filters, onFilterChange, onClearFilter, onClearAllFilters } = props;\n const t = useI18n();\n\n return (\n <Modal heading={t('filters')}>\n <Grid as={StyledModalFilterContent} container={{ rowGap: 2 }}>\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n <Text as={StyledCountText} variant='secondary'>\n {t('results_count', [count], { count })}\n </Text>\n {onClearAllFilters && !!activeFilters.length && (\n <Button variant='link' onClick={onClearAllFilters}>\n {t('clear_all')}\n </Button>\n )}\n </Flex>\n {!!activeFilters.length && (\n <Flex\n as={StyledSelectedFilters}\n container={{ gap: 1 }}\n aria-label={t('search_results_active_filters')}\n >\n {activeFilters.map(filter => {\n return (\n <ActiveFilter\n key={filter.id}\n name={`${filter.groupName}: ${filter.name}`}\n onRemove={() =>\n onFilterChange?.({\n name: filter.groupName,\n type: filter.type,\n value: filter.resetValue\n })\n }\n />\n );\n })}\n </Flex>\n )}\n <div>\n {filters.map((filter: FilterProps) => {\n return (\n <Filter\n key={filter.name}\n onFilterChange={onFilterChange}\n onClearFilter={onClearFilter}\n {...filter}\n />\n );\n })}\n </div>\n </Grid>\n </Modal>\n );\n};\n\nconst SearchResults: ForwardRefForwardPropsComponent<SearchResultsProps> = forwardRef(\n function SearchResults(\n {\n results,\n searchInputProps,\n count,\n filters,\n onFilterChange,\n onClearAllFilters,\n onClearFilter,\n onShowMore,\n loading = false,\n ...restProps\n }: PropsWithoutRef<SearchResultsProps>,\n ref: SearchResultsProps['ref']\n ) {\n const t = useI18n();\n const isMedium = useBreakpoint('md');\n const { create } = useModalManager();\n const { searchContainerEl } = useContext(AppShellContext);\n const { announcePolite } = useLiveLog();\n const filtersMethods = useRef<ModalMethods<ComponentProps<typeof FilterModal>>>();\n const {\n base: {\n palette: { 'brand-primary': primary }\n }\n } = useTheme();\n const [accent, setAccent] = useState<undefined | RegExp>();\n const [submittedSearchValue, setSubmittedSearchValue] = useState(searchInputProps.value);\n const pageRef = useConsolidatedRef(ref);\n\n const activeFilters: ActiveFilters[] = filters.flatMap(group => {\n if (group.type === 'select') {\n return group.items.flatMap(item => {\n if (item.checked) {\n return {\n id: item.id,\n name: item.name,\n resetValue: { ...item, checked: false },\n groupName: group.name,\n type: group.type\n };\n }\n return [];\n });\n }\n return [];\n });\n\n const openFiltersModal = () => {\n filtersMethods.current = create(FilterModal, {\n activeFilters,\n count,\n filters,\n onFilterChange,\n onClearFilter,\n onClearAllFilters\n });\n };\n\n useAfterInitialEffect(() => {\n if (filtersMethods.current) {\n filtersMethods.current.update({\n activeFilters,\n count,\n filters\n });\n }\n }, [activeFilters, count, filters]);\n\n useAfterInitialEffect(() => {\n if (isMedium && filtersMethods.current) filtersMethods.current.dismiss();\n }, [isMedium]);\n\n useAfterInitialEffect(() => {\n setAccent(submittedSearchValue ? new RegExp(submittedSearchValue, 'gi') : undefined);\n }, [submittedSearchValue]);\n\n useEffect(() => {\n if (filters.length) announcePolite({ message: t('search_filter_update_message') });\n }, []);\n\n useEffect(() => {\n const focusContainer = pageRef.current;\n\n if (!loading && submittedSearchValue && focusContainer) {\n focusHeadingOrContainer(focusContainer, t('search'));\n }\n }, [loading, submittedSearchValue, t]);\n\n const searchTitle = (\n <SummaryItem\n as={StyledSearchSummaryItem}\n visual={\n <Avatar\n icon='search'\n name='search'\n shape='squircle'\n backgroundColor={primary}\n color='white'\n />\n }\n primary={<Text variant='h1'>{t('search')}</Text>}\n actions={\n onClearAllFilters &&\n isMedium &&\n !!activeFilters.length && (\n <Button\n variant='link'\n onClick={onClearAllFilters}\n aria-label={t('search_results_clear_all_filters')}\n >\n {t('clear_all')}\n </Button>\n )\n }\n />\n );\n const searchInput = (\n <SearchInput\n {...searchInputProps}\n onSearchSubmit={val => {\n searchInputProps.onSearchSubmit?.(val);\n setSubmittedSearchValue(val);\n }}\n placeholder={searchInputProps.placeholder}\n />\n );\n\n return (\n <Grid\n {...restProps}\n as={StyledSearchResults}\n ref={pageRef}\n md={\n filters.length\n ? {\n container: {\n cols: '15rem auto'\n }\n }\n : undefined\n }\n sm={\n filters.length\n ? {\n container: {\n cols: 'auto',\n rowGap: 2\n }\n }\n : undefined\n }\n container={{\n rows: 'auto auto',\n cols: 'auto 1fr',\n areas: '\"filters results\"'\n }}\n >\n {isMedium && !!filters.length && (\n <Grid item={{ area: 'filters', alignSelf: 'start' }} as={StyledFilters}>\n {searchTitle}\n {filters.map((filter: FilterProps) => {\n return (\n <Filter\n key={filter.name}\n onFilterChange={onFilterChange}\n onClearFilter={onClearFilter}\n {...filter}\n />\n );\n })}\n </Grid>\n )}\n <Grid\n item={{ alignSelf: 'start', area: 'results' }}\n container={{\n alignItems: 'center',\n rowGap: 2,\n rows: 'auto auto 1fr',\n areas: '\"search\" \"meta\" \"items\"'\n }}\n as={StyledResults}\n >\n {loading && <Progress placement='local' />}\n {searchContainerEl && isMedium ? (\n createPortal(searchInput, searchContainerEl)\n ) : (\n <Grid item={{ area: 'search' }}>\n {!isMedium && searchTitle}\n {searchInput}\n </Grid>\n )}\n <Grid item={{ area: 'meta' }} container={{ rowGap: 1 }}>\n <Flex container={{ justify: 'between', alignItems: 'center' }}>\n {!loading && (\n <Text as={StyledCountText} variant='secondary'>\n {submittedSearchValue !== '' || results.length > 0\n ? t('results_count', [count], { count })\n : ''}\n </Text>\n )}\n {!isMedium && !!filters.length && (\n <Button variant='secondary' onClick={openFiltersModal}>\n <Icon name={activeFilters.length > 0 ? 'filter-on' : 'filter'} />\n {t('filters')} \n <Count>{activeFilters.length}</Count>\n </Button>\n )}\n </Flex>\n {!!activeFilters.length && (\n <Flex\n as={StyledSelectedFilters}\n container={{ gap: 1, wrap: 'wrap' }}\n aria-label={t('search_results_active_filters')}\n >\n {activeFilters.map(filter => {\n return (\n <ActiveFilter\n key={filter.id}\n name={`${filter.groupName}: ${filter.name}`}\n onRemove={() =>\n onFilterChange?.({\n name: filter.groupName,\n type: filter.type,\n value: filter.resetValue\n })\n }\n />\n );\n })}\n </Flex>\n )}\n </Grid>\n <Grid\n item={{ area: 'items', alignSelf: results.length ? 'start' : 'stretch' }}\n container={{ rowGap: 2 }}\n >\n {!loading && (\n <>\n {results.length ? (\n results.map((result: SearchResultProps) => {\n return <SearchResult key={result.id} {...result} accent={accent} />;\n })\n ) : (\n <Grid item={{ alignSelf: 'stretch' }}>\n <EmptyState\n message={submittedSearchValue === '' ? t('empty_search') : undefined}\n />\n </Grid>\n )}\n {onShowMore && (\n <Flex container={{ justify: 'center' }}>\n <Button variant='link' onClick={onShowMore}>\n {t('show_more')}\n </Button>\n </Flex>\n )}\n </>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n }\n);\n\nexport default SearchResults;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stages.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Stages.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,+BAA+B,EAAgB,MAAM,yBAAyB,CAAC;AAG7F,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAe/D,QAAA,MAAM,MAAM,EAAE,+BAA+B,CAAC,WAAW,CA6MvD,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useEffect, forwardRef, Fragment } from 'react';
|
|
3
3
|
import { remToPx } from 'polished';
|
|
4
|
-
import { Icon, registerIcon, Flex, useI18n, Button, Modal, useBreakpoint, debounce, useModalManager, useConsolidatedRef, useUID, InfoDialog, useArrows, useAfterInitialEffect, VisuallyHiddenText, tryCatch } from '@pega/cosmos-react-core';
|
|
4
|
+
import { Icon, registerIcon, Flex, useI18n, Button, Modal, useBreakpoint, debounce, useModalManager, useConsolidatedRef, useUID, InfoDialog, useArrows, useDirection, useAfterInitialEffect, VisuallyHiddenText, tryCatch } from '@pega/cosmos-react-core';
|
|
5
5
|
import * as checkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/check.icon';
|
|
6
6
|
import StageGlimpse from './StageGlimpse';
|
|
7
7
|
import { StyledInnerStage, StyledStageCompleteIcon, StyledStage, StyledStageContainer, StyledStageGlimpse, StyledStages, StyledStagesDescription, StyledStageText } from './Stages.styles';
|
|
@@ -17,7 +17,9 @@ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadSt
|
|
|
17
17
|
const isSmallOrAbove = useBreakpoint('sm');
|
|
18
18
|
const [compressedView, setCompressedView] = useState(false);
|
|
19
19
|
const [minExpandedWidth, setMinExpandedWidth] = useState(0);
|
|
20
|
+
const { rtl } = useDirection();
|
|
20
21
|
useArrows(stagesRef, {
|
|
22
|
+
cycle: false,
|
|
21
23
|
selector: ':scope > li > button:not([aria-expanded])',
|
|
22
24
|
dir: 'left-right',
|
|
23
25
|
initialFocusElement: stagesRefs.current.find(stage => stage.ariaCurrent)
|
|
@@ -80,7 +82,7 @@ const Stages = forwardRef(function Stages({ current, stages, caseTitle, onLoadSt
|
|
|
80
82
|
children: renderModalStages()
|
|
81
83
|
});
|
|
82
84
|
}, [stagesToLoad.length]);
|
|
83
|
-
return (_jsxs(_Fragment, { children: [_jsx(Flex, { ...restProps, container: true, as: StyledStages, ref: stagesRef, "aria-label": t('stages_label'), "aria-describedby": descriptionId, children: stages.map((stage, index) => {
|
|
85
|
+
return (_jsxs(_Fragment, { children: [_jsx(Flex, { ...restProps, container: true, as: StyledStages, ref: stagesRef, dir: rtl ? 'rtl' : 'ltr', "aria-label": t('stages_label'), "aria-describedby": descriptionId, children: stages.map((stage, index) => {
|
|
84
86
|
const isCurrent = stage.id === current;
|
|
85
87
|
let stageStatusText = t(stage.completed ? 'completed' : 'not_started');
|
|
86
88
|
if (isCurrent)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stages.js","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,aAAa,EACb,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EAClB,QAAQ,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,IAAC,EAAE,EAAE,aAAa,YACvC,CAAC,CAAC,oBAAoB,CAAC,GACA,IACzB,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC","sourcesContent":["import { useState, useRef, useEffect, forwardRef, Fragment } from 'react';\nimport type { MouseEvent, PropsWithoutRef } from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n Icon,\n registerIcon,\n Flex,\n useI18n,\n Button,\n Modal,\n useBreakpoint,\n debounce,\n useModalManager,\n useConsolidatedRef,\n useUID,\n InfoDialog,\n useArrows,\n useAfterInitialEffect,\n VisuallyHiddenText,\n tryCatch\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent, ModalMethods } from '@pega/cosmos-react-core';\nimport * as checkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/check.icon';\n\nimport type { StagesProps, StageStatus } from './Stages.types';\nimport StageGlimpse from './StageGlimpse';\nimport {\n StyledInnerStage,\n StyledStageCompleteIcon,\n StyledStage,\n StyledStageContainer,\n StyledStageGlimpse,\n StyledStages,\n StyledStagesDescription,\n StyledStageText\n} from './Stages.styles';\n\nregisterIcon(checkIcon);\n\nconst Stages: ForwardRefForwardPropsComponent<StagesProps> = forwardRef(function Stages(\n { current, stages, caseTitle, onLoadStage, ...restProps }: PropsWithoutRef<StagesProps>,\n ref: StagesProps['ref']\n) {\n const t = useI18n();\n\n const stagesRef = useConsolidatedRef(ref);\n const stagesRefs = useRef<HTMLButtonElement[]>([]);\n\n const [target, setTarget] = useState<HTMLButtonElement | null>(null);\n\n const { create: createModal } = useModalManager();\n const modalMethods = useRef<ModalMethods>();\n const [showModal, setShowModal] = useState(false);\n\n const isSmallOrAbove = useBreakpoint('sm');\n const [compressedView, setCompressedView] = useState(false);\n const [minExpandedWidth, setMinExpandedWidth] = useState(0);\n\n useArrows(stagesRef, {\n selector: ':scope > li > button:not([aria-expanded])',\n dir: 'left-right',\n initialFocusElement: stagesRefs.current.find(stage => stage.ariaCurrent)\n });\n\n const dialogId = useUID();\n const descriptionId = useUID();\n\n useEffect(() => {\n if (stagesRef.current) {\n if (compressedView) {\n const resizeObserver = new ResizeObserver(\n debounce((entries: ResizeObserverEntry[]) => {\n if (entries[0].contentRect.width > minExpandedWidth) {\n setCompressedView(false);\n }\n }, 100)\n );\n resizeObserver.observe(stagesRef.current);\n return () => resizeObserver.disconnect();\n }\n\n const intersectionObserver = new IntersectionObserver(\n entries => {\n if (!entries[0].isIntersecting) {\n setCompressedView(true);\n if (entries[0].rootBounds) setMinExpandedWidth(entries[0].rootBounds.width);\n }\n },\n {\n root: stagesRef.current,\n rootMargin: tryCatch(\n () => remToPx(0.0625),\n () => '1px'\n ),\n threshold: 1\n }\n );\n\n if (stagesRef.current.lastElementChild) {\n intersectionObserver.observe(stagesRef.current.lastElementChild);\n return () => intersectionObserver.disconnect();\n }\n }\n }, [minExpandedWidth, compressedView, stages.length]);\n\n const stagesToLoad = onLoadStage\n ? stages.filter(stage => !Array.isArray(stage.steps)).map(stage => stage.id)\n : [];\n\n const renderModalStages = () =>\n stages.map(stage => (\n <Fragment key={stage.id}>\n <Flex container={{ alignItems: 'start', gap: 0.5 }}>\n {stage.completed && <StyledStageCompleteIcon name='check' />}\n <StyledStageText variant='h3' isCurrent={stage.id === current}>\n {stage.name}\n {stage.completed && <VisuallyHiddenText>{`- ${t('completed')}`}</VisuallyHiddenText>}\n </StyledStageText>\n </Flex>\n <StageGlimpse stage={stage} />\n </Fragment>\n ));\n\n const openModal = () => {\n setShowModal(true);\n if (stagesToLoad.length > 0) onLoadStage?.(stagesToLoad);\n modalMethods.current = createModal(Modal, {\n heading: caseTitle\n ? t('stages_case_lifecycle', [caseTitle])\n : t('stages_default_case_lifecycle'),\n progress: stagesToLoad.length > 0,\n children: renderModalStages(),\n onBeforeClose: () => {\n setShowModal(false);\n target?.focus();\n setTarget(null);\n modalMethods.current = undefined;\n }\n });\n };\n\n useAfterInitialEffect(() => {\n modalMethods.current?.update({\n progress: stagesToLoad.length > 0,\n children: renderModalStages()\n });\n }, [stagesToLoad.length]);\n\n return (\n <>\n <Flex\n {...restProps}\n container\n as={StyledStages}\n ref={stagesRef}\n aria-label={t('stages_label')}\n aria-describedby={descriptionId}\n >\n {stages.map((stage, index) => {\n const isCurrent = stage.id === current;\n let stageStatusText = t(stage.completed ? 'completed' : 'not_started');\n if (isCurrent) stageStatusText = t('current');\n\n const hasToLoad = stagesToLoad.includes(stage.id);\n\n let stageStatus: StageStatus;\n\n if (stage.completed) {\n stageStatus = 'completed';\n } else if (isCurrent) {\n stageStatus = 'current';\n } else {\n stageStatus = 'pending';\n }\n\n return (\n <Fragment key={stage.id}>\n <Flex as={StyledStageContainer} item={{ grow: 1, shrink: 0 }}>\n <Flex\n container={{ justify: 'center', alignItems: 'center' }}\n as={StyledStage}\n item={{\n grow: compressedView && !isCurrent ? 0 : 1,\n shrink: compressedView && isCurrent ? 1 : 0\n }}\n status={stageStatus}\n aria-current={isCurrent ? 'step' : undefined}\n aria-label={t('stages_stage_label', [stage.name, stageStatusText])}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n if (isSmallOrAbove) {\n if (hasToLoad) onLoadStage?.([stage.id]);\n setTarget(e.currentTarget);\n } else {\n openModal();\n }\n }}\n ref={(el: HTMLButtonElement) => {\n stagesRefs.current[index] = el;\n }}\n aria-expanded={target && isSmallOrAbove}\n aria-controls={target ? dialogId : undefined}\n aria-haspopup\n >\n {stage.completed && <Icon name='check' />}\n {(!compressedView || isCurrent || !stage.completed) && (\n <StyledInnerStage ellipsis={isCurrent && compressedView}>\n {!isCurrent && compressedView ? index + 1 : stage.name}\n </StyledInnerStage>\n )}\n </Flex>\n </Flex>\n {target && stagesRefs.current[index] === target && isSmallOrAbove && !showModal && (\n <InfoDialog\n heading={stage.name}\n target={target}\n progress={hasToLoad ? t('loading') : undefined}\n onDismiss={() => {\n setTarget(null);\n }}\n placement='bottom-start'\n >\n {!hasToLoad && (\n <StyledStageGlimpse>\n <StageGlimpse stage={stage} />\n <Button variant='secondary' onClick={openModal}>\n {t('stages_see_full_lifecycle')}\n </Button>\n </StyledStageGlimpse>\n )}\n </InfoDialog>\n )}\n </Fragment>\n );\n })}\n </Flex>\n <StyledStagesDescription id={descriptionId}>\n {t('stages_description')}\n </StyledStagesDescription>\n </>\n );\n});\n\nexport default Stages;\n"]}
|
|
1
|
+
{"version":3,"file":"Stages.js","sourceRoot":"","sources":["../../../src/components/Stages/Stages.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,aAAa,EACb,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,SAAS,EACT,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,EAClB,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAG1F,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,uBAAuB,EACvB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,CAAC,SAAS,CAAC,CAAC;AAExB,MAAM,MAAM,GAAiD,UAAU,CAAC,SAAS,MAAM,CACrF,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,SAAS,EAAgC,EACvF,GAAuB;IAEvB,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,MAAM,CAAs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,cAAc,YACpD,CAAC,SAAS,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,GACrC,CACpB,IACI,GACF,EACN,MAAM,IAAI,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,MAAM,IAAI,cAAc,IAAI,CAAC,SAAS,IAAI,CACjF,KAAC,UAAU,IACT,OAAO,EAAE,KAAK,CAAC,IAAI,EACnB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,EAC9C,SAAS,EAAE,GAAG,EAAE;oCACd,SAAS,CAAC,IAAI,CAAC,CAAC;gCAClB,CAAC,EACD,SAAS,EAAC,cAAc,YAEvB,CAAC,SAAS,IAAI,CACb,MAAC,kBAAkB,eACjB,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI,EAC9B,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,SAAS,YAC3C,CAAC,CAAC,2BAA2B,CAAC,GACxB,IACU,CACtB,GACU,CACd,KAtDY,KAAK,CAAC,EAAE,CAuDZ,CACZ,CAAC;gBACJ,CAAC,CAAC,GACG,EACP,KAAC,uBAAuB,IAAC,EAAE,EAAE,aAAa,YACvC,CAAC,CAAC,oBAAoB,CAAC,GACA,IACzB,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC","sourcesContent":["import { useState, useRef, useEffect, forwardRef, Fragment } from 'react';\nimport type { MouseEvent, PropsWithoutRef } from 'react';\nimport { remToPx } from 'polished';\n\nimport {\n Icon,\n registerIcon,\n Flex,\n useI18n,\n Button,\n Modal,\n useBreakpoint,\n debounce,\n useModalManager,\n useConsolidatedRef,\n useUID,\n InfoDialog,\n useArrows,\n useDirection,\n useAfterInitialEffect,\n VisuallyHiddenText,\n tryCatch\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent, ModalMethods } from '@pega/cosmos-react-core';\nimport * as checkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/check.icon';\n\nimport type { StagesProps, StageStatus } from './Stages.types';\nimport StageGlimpse from './StageGlimpse';\nimport {\n StyledInnerStage,\n StyledStageCompleteIcon,\n StyledStage,\n StyledStageContainer,\n StyledStageGlimpse,\n StyledStages,\n StyledStagesDescription,\n StyledStageText\n} from './Stages.styles';\n\nregisterIcon(checkIcon);\n\nconst Stages: ForwardRefForwardPropsComponent<StagesProps> = forwardRef(function Stages(\n { current, stages, caseTitle, onLoadStage, ...restProps }: PropsWithoutRef<StagesProps>,\n ref: StagesProps['ref']\n) {\n const t = useI18n();\n\n const stagesRef = useConsolidatedRef(ref);\n const stagesRefs = useRef<HTMLButtonElement[]>([]);\n\n const [target, setTarget] = useState<HTMLButtonElement | null>(null);\n\n const { create: createModal } = useModalManager();\n const modalMethods = useRef<ModalMethods>();\n const [showModal, setShowModal] = useState(false);\n\n const isSmallOrAbove = useBreakpoint('sm');\n const [compressedView, setCompressedView] = useState(false);\n const [minExpandedWidth, setMinExpandedWidth] = useState(0);\n\n const { rtl } = useDirection();\n\n useArrows(stagesRef, {\n cycle: false,\n selector: ':scope > li > button:not([aria-expanded])',\n dir: 'left-right',\n initialFocusElement: stagesRefs.current.find(stage => stage.ariaCurrent)\n });\n\n const dialogId = useUID();\n const descriptionId = useUID();\n\n useEffect(() => {\n if (stagesRef.current) {\n if (compressedView) {\n const resizeObserver = new ResizeObserver(\n debounce((entries: ResizeObserverEntry[]) => {\n if (entries[0].contentRect.width > minExpandedWidth) {\n setCompressedView(false);\n }\n }, 100)\n );\n resizeObserver.observe(stagesRef.current);\n return () => resizeObserver.disconnect();\n }\n\n const intersectionObserver = new IntersectionObserver(\n entries => {\n if (!entries[0].isIntersecting) {\n setCompressedView(true);\n if (entries[0].rootBounds) setMinExpandedWidth(entries[0].rootBounds.width);\n }\n },\n {\n root: stagesRef.current,\n rootMargin: tryCatch(\n () => remToPx(0.0625),\n () => '1px'\n ),\n threshold: 1\n }\n );\n\n if (stagesRef.current.lastElementChild) {\n intersectionObserver.observe(stagesRef.current.lastElementChild);\n return () => intersectionObserver.disconnect();\n }\n }\n }, [minExpandedWidth, compressedView, stages.length]);\n\n const stagesToLoad = onLoadStage\n ? stages.filter(stage => !Array.isArray(stage.steps)).map(stage => stage.id)\n : [];\n\n const renderModalStages = () =>\n stages.map(stage => (\n <Fragment key={stage.id}>\n <Flex container={{ alignItems: 'start', gap: 0.5 }}>\n {stage.completed && <StyledStageCompleteIcon name='check' />}\n <StyledStageText variant='h3' isCurrent={stage.id === current}>\n {stage.name}\n {stage.completed && <VisuallyHiddenText>{`- ${t('completed')}`}</VisuallyHiddenText>}\n </StyledStageText>\n </Flex>\n <StageGlimpse stage={stage} />\n </Fragment>\n ));\n\n const openModal = () => {\n setShowModal(true);\n if (stagesToLoad.length > 0) onLoadStage?.(stagesToLoad);\n modalMethods.current = createModal(Modal, {\n heading: caseTitle\n ? t('stages_case_lifecycle', [caseTitle])\n : t('stages_default_case_lifecycle'),\n progress: stagesToLoad.length > 0,\n children: renderModalStages(),\n onBeforeClose: () => {\n setShowModal(false);\n target?.focus();\n setTarget(null);\n modalMethods.current = undefined;\n }\n });\n };\n\n useAfterInitialEffect(() => {\n modalMethods.current?.update({\n progress: stagesToLoad.length > 0,\n children: renderModalStages()\n });\n }, [stagesToLoad.length]);\n\n return (\n <>\n <Flex\n {...restProps}\n container\n as={StyledStages}\n ref={stagesRef}\n dir={rtl ? 'rtl' : 'ltr'}\n aria-label={t('stages_label')}\n aria-describedby={descriptionId}\n >\n {stages.map((stage, index) => {\n const isCurrent = stage.id === current;\n let stageStatusText = t(stage.completed ? 'completed' : 'not_started');\n if (isCurrent) stageStatusText = t('current');\n\n const hasToLoad = stagesToLoad.includes(stage.id);\n\n let stageStatus: StageStatus;\n\n if (stage.completed) {\n stageStatus = 'completed';\n } else if (isCurrent) {\n stageStatus = 'current';\n } else {\n stageStatus = 'pending';\n }\n\n return (\n <Fragment key={stage.id}>\n <Flex as={StyledStageContainer} item={{ grow: 1, shrink: 0 }}>\n <Flex\n container={{ justify: 'center', alignItems: 'center' }}\n as={StyledStage}\n item={{\n grow: compressedView && !isCurrent ? 0 : 1,\n shrink: compressedView && isCurrent ? 1 : 0\n }}\n status={stageStatus}\n aria-current={isCurrent ? 'step' : undefined}\n aria-label={t('stages_stage_label', [stage.name, stageStatusText])}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n if (isSmallOrAbove) {\n if (hasToLoad) onLoadStage?.([stage.id]);\n setTarget(e.currentTarget);\n } else {\n openModal();\n }\n }}\n ref={(el: HTMLButtonElement) => {\n stagesRefs.current[index] = el;\n }}\n aria-expanded={target && isSmallOrAbove}\n aria-controls={target ? dialogId : undefined}\n aria-haspopup\n >\n {stage.completed && <Icon name='check' />}\n {(!compressedView || isCurrent || !stage.completed) && (\n <StyledInnerStage ellipsis={isCurrent && compressedView}>\n {!isCurrent && compressedView ? index + 1 : stage.name}\n </StyledInnerStage>\n )}\n </Flex>\n </Flex>\n {target && stagesRefs.current[index] === target && isSmallOrAbove && !showModal && (\n <InfoDialog\n heading={stage.name}\n target={target}\n progress={hasToLoad ? t('loading') : undefined}\n onDismiss={() => {\n setTarget(null);\n }}\n placement='bottom-start'\n >\n {!hasToLoad && (\n <StyledStageGlimpse>\n <StageGlimpse stage={stage} />\n <Button variant='secondary' onClick={openModal}>\n {t('stages_see_full_lifecycle')}\n </Button>\n </StyledStageGlimpse>\n )}\n </InfoDialog>\n )}\n </Fragment>\n );\n })}\n </Flex>\n <StyledStagesDescription id={descriptionId}>\n {t('stages_description')}\n </StyledStagesDescription>\n </>\n );\n});\n\nexport default Stages;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stages.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Stages.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Stages/Stages.styles.ts"],"names":[],"mappings":"AA8GA,eAAO,MAAM,YAAY,mOAgBvB,CAAC;AAIH,eAAO,MAAM,gBAAgB;eAA4B,OAAO;YAW9D,CAAC;AAIH,eAAO,MAAM,WAAW;YAA2B,WAAW,GAAG,SAAS,GAAG,SAAS;YAgGrF,CAAC;AAIF,eAAO,MAAM,uBAAuB,kaAiBlC,CAAC;AAGH,eAAO,MAAM,eAAe;;;gBAA8B,OAAO;kLAIhE,CAAC;AAIF,eAAO,MAAM,oBAAoB,6NAyKhC,CAAC;AAIF,eAAO,MAAM,oBAAoB,mOAS/B,CAAC;AAIH,eAAO,MAAM,UAAU;eAA0B,OAAO;YAoBtD,CAAC;AAIH,eAAO,MAAM,qBAAqB;;oMAMhC,CAAC;AAIH,eAAO,MAAM,kBAAkB,6NAI7B,CAAC;AAIH,eAAO,MAAM,uBAAuB,yOAEnC,CAAC"}
|
|
@@ -1,9 +1,100 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
|
-
import { calculateFontSize, DateTimeDisplay, defaultThemeProp, Icon, Text, StyledIcon,
|
|
2
|
+
import { calculateFontSize, DateTimeDisplay, defaultThemeProp, Icon, Text, StyledIcon, calculateForegroundColor } from '@pega/cosmos-react-core';
|
|
3
|
+
const stageClipPath = (leftNotch, rightPoint, mirrored = false) => {
|
|
4
|
+
if (mirrored) {
|
|
5
|
+
// RTL: mirror the LTR clip-path polygon
|
|
6
|
+
const points = ['100% 0', '0 0'];
|
|
7
|
+
if (leftNotch) {
|
|
8
|
+
points.push('var(--stage-chevron-width) 0', '0 50%', 'var(--stage-chevron-width) 100%');
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
points.push('0 100%');
|
|
12
|
+
}
|
|
13
|
+
points.push('100% 100%');
|
|
14
|
+
if (rightPoint) {
|
|
15
|
+
points.push('calc(100% - var(--stage-chevron-width)) 50%');
|
|
16
|
+
}
|
|
17
|
+
return `clip-path: polygon(${points.join(', ')});`;
|
|
18
|
+
}
|
|
19
|
+
const points = ['0 0', '100% 0'];
|
|
20
|
+
if (rightPoint) {
|
|
21
|
+
points.push('calc(100% - var(--stage-chevron-width)) 0', '100% 50%', 'calc(100% - var(--stage-chevron-width)) 100%');
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
points.push('100% 100%');
|
|
25
|
+
}
|
|
26
|
+
points.push('0 100%');
|
|
27
|
+
if (leftNotch) {
|
|
28
|
+
points.push('var(--stage-chevron-width) 50%');
|
|
29
|
+
}
|
|
30
|
+
return `clip-path: polygon(${points.join(', ')});`;
|
|
31
|
+
};
|
|
32
|
+
// === Chevron Configuration ===
|
|
33
|
+
// Centralizes spacing and border thickness via CSS custom properties set at StyledStages
|
|
34
|
+
const chevronConfig = {
|
|
35
|
+
width: 'calc(1.156 * var(--chevron-spacing))',
|
|
36
|
+
coarseWidth: 'calc(1.4375 * var(--chevron-spacing))',
|
|
37
|
+
squareSize: 'calc(3 * var(--chevron-spacing))',
|
|
38
|
+
coarseSquareSize: 'calc(3.5 * var(--chevron-spacing))',
|
|
39
|
+
offsetLeft: 'calc(0.688 * var(--chevron-spacing))',
|
|
40
|
+
offsetRight: 'calc(1.156 * var(--chevron-spacing))',
|
|
41
|
+
coarseOffsetLeft: 'calc(0.688 * var(--chevron-spacing))',
|
|
42
|
+
coarseOffsetRight: 'calc(1.5 * var(--chevron-spacing))'
|
|
43
|
+
};
|
|
44
|
+
// === Chevron Helpers ===
|
|
45
|
+
// After team discussion we decided to use logical properties throughout — `inset-block-start`
|
|
46
|
+
// instead of `top`, and `border-block-start/end-width` instead of `border-top/bottom-width` —
|
|
47
|
+
// for consistency with the rest of the file (which already uses logical inline-axis properties).
|
|
48
|
+
const createChevronPseudo = (borderWidth, borderColor, size) => `
|
|
49
|
+
content: '';
|
|
50
|
+
position: absolute;
|
|
51
|
+
display: block;
|
|
52
|
+
inset-block-start: calc(50% - ${size} / 2);
|
|
53
|
+
width: ${size};
|
|
54
|
+
height: ${size};
|
|
55
|
+
border-style: solid;
|
|
56
|
+
border-color: ${borderColor};
|
|
57
|
+
border-inline-end-width: ${borderWidth};
|
|
58
|
+
border-inline-start-width: 0;
|
|
59
|
+
border-block-start-width: ${borderWidth};
|
|
60
|
+
border-block-end-width: 0;
|
|
61
|
+
transform: rotateZ(45deg) skew(15deg, 15deg);
|
|
62
|
+
pointer-events: none;
|
|
63
|
+
`;
|
|
64
|
+
const createChevronBaseStyles = (config, borderThicknessVar) => css `
|
|
65
|
+
&:not(:first-of-type)::before,
|
|
66
|
+
&:not(:last-of-type)::after {
|
|
67
|
+
border-inline-end-width: calc(1.5 * ${borderThicknessVar});
|
|
68
|
+
border-block-start-width: calc(1.5 * ${borderThicknessVar});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:not(:first-of-type)::before {
|
|
72
|
+
inset-inline-start: calc(-1 * ${config.width} - ${config.offsetLeft});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&:not(:last-of-type)::after {
|
|
76
|
+
inset-inline-end: calc(-1 * ${config.width} + ${config.offsetRight});
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
const createChevronInteractiveStates = (config, borderThicknessVar) => css `
|
|
80
|
+
&:has(button:hover)::before,
|
|
81
|
+
&:has(button:hover)::after,
|
|
82
|
+
&:has(button:focus-visible)::before,
|
|
83
|
+
&:has(button:focus-visible)::after,
|
|
84
|
+
&:has(button:active)::before,
|
|
85
|
+
&:has(button:active)::after {
|
|
86
|
+
border-inline-end-width: calc(2 * ${borderThicknessVar});
|
|
87
|
+
border-block-start-width: calc(2 * ${borderThicknessVar});
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
3
90
|
export const StyledStages = styled.ol(({ theme }) => {
|
|
4
91
|
return css `
|
|
92
|
+
--chevron-spacing: ${theme.base.spacing};
|
|
93
|
+
--chevron-border-thickness: ${theme.components.button['border-width']};
|
|
5
94
|
background-color: ${theme.base.palette['primary-background']};
|
|
6
95
|
border-radius: ${theme.components.card['border-radius']};
|
|
96
|
+
display: flex;
|
|
97
|
+
padding: 0;
|
|
7
98
|
width: 100%;
|
|
8
99
|
overflow: hidden;
|
|
9
100
|
list-style: none;
|
|
@@ -26,110 +117,59 @@ export const StyledInnerStage = styled.span(props => {
|
|
|
26
117
|
`}
|
|
27
118
|
`;
|
|
28
119
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const thickBorderWidth = '0.125rem';
|
|
32
|
-
const { rtl } = useDirection();
|
|
120
|
+
StyledInnerStage.defaultProps = defaultThemeProp;
|
|
121
|
+
export const StyledStage = styled.button(({ theme: { base: { palette, 'hit-area': hitArea, transparency, 'font-weight': fontWeight }, components: { 'case-view': { stages } } }, status }) => {
|
|
33
122
|
const stageForeground = calculateForegroundColor(stages.status[status].background, stages.status[status]['foreground-color']);
|
|
34
123
|
return css `
|
|
35
124
|
background: ${stages.status[status].background};
|
|
36
125
|
color: ${stageForeground};
|
|
37
126
|
outline: none;
|
|
38
127
|
border-color: transparent;
|
|
39
|
-
border-width:
|
|
128
|
+
border-width: calc(2 * var(--chevron-border-thickness)) 0;
|
|
40
129
|
border-style: solid;
|
|
41
130
|
position: relative;
|
|
42
|
-
height: calc(4 * ${spacing});
|
|
43
|
-
padding-inline-start: calc(2 * ${spacing});
|
|
44
|
-
padding-inline-end: ${spacing};
|
|
45
|
-
width: 100%;
|
|
46
|
-
|
|
47
|
-
&::before,
|
|
48
|
-
&::after {
|
|
49
|
-
content: '';
|
|
50
|
-
position: absolute;
|
|
51
|
-
display: block;
|
|
52
|
-
width: calc(2.25 * ${spacing});
|
|
53
|
-
height: calc(2.25 * ${spacing});
|
|
54
|
-
border-style: solid;
|
|
55
|
-
border-color: ${palette['border-line']};
|
|
56
|
-
border-inline-end-width: ${thinBorderWidth};
|
|
57
|
-
border-inline-start-width: 0;
|
|
58
|
-
border-top-width: ${rtl ? 0 : thinBorderWidth};
|
|
59
|
-
border-bottom-width: ${rtl ? thinBorderWidth : 0};
|
|
60
|
-
transform: rotateZ(45deg) skew(15deg, 15deg);
|
|
61
|
-
|
|
62
|
-
@media (pointer: coarse) {
|
|
63
|
-
width: calc(2.875 * ${spacing});
|
|
64
|
-
height: calc(2.875 * ${spacing});
|
|
65
|
-
transform: rotateZ(45deg) skew(20deg, 20deg);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
131
|
|
|
69
|
-
|
|
70
|
-
|
|
132
|
+
/* Browsers do not reliably apply flex align-items: stretch to <button> elements.
|
|
133
|
+
* Adding 0.0625rem (1px at default font size) to min-height compensates so the button fills its <li> container,
|
|
134
|
+
* keeping the clipped chevron background flush with the top and bottom borders. */
|
|
135
|
+
min-height: calc(4 * var(--chevron-spacing) + 0.0625rem);
|
|
136
|
+
padding-inline-start: calc(2 * var(--chevron-spacing));
|
|
137
|
+
padding-inline-end: var(--chevron-spacing);
|
|
138
|
+
margin-inline-start: 0;
|
|
139
|
+
margin-inline-end: 0;
|
|
140
|
+
width: calc(100% + ${chevronConfig.width});
|
|
141
|
+
--stage-chevron-width: ${chevronConfig.width};
|
|
71
142
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
143
|
+
${StyledIcon}, ${StyledInnerStage} {
|
|
144
|
+
transform: translateX(calc(-0.25 * var(--chevron-spacing)));
|
|
75
145
|
}
|
|
146
|
+
${stageClipPath(true, true)}
|
|
76
147
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
148
|
+
[dir='rtl'] & ${StyledIcon},
|
|
149
|
+
[dir='rtl'] & ${StyledInnerStage} {
|
|
150
|
+
transform: translateX(calc(0.25 * var(--chevron-spacing)));
|
|
151
|
+
}
|
|
81
152
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
153
|
+
[dir='rtl'] & {
|
|
154
|
+
${stageClipPath(true, true, true)}
|
|
85
155
|
}
|
|
86
156
|
|
|
87
|
-
&:hover
|
|
88
|
-
&:hover::before,
|
|
89
|
-
&:hover::after {
|
|
157
|
+
&:hover {
|
|
90
158
|
border-color: ${palette['border-line']};
|
|
91
159
|
}
|
|
92
160
|
|
|
93
|
-
&:focus
|
|
94
|
-
&:active,
|
|
95
|
-
&:focus::before,
|
|
96
|
-
&:active::before,
|
|
97
|
-
&:focus::after,
|
|
98
|
-
&:active::after {
|
|
161
|
+
&:focus-visible {
|
|
99
162
|
border-color: ${palette.interactive};
|
|
100
163
|
}
|
|
101
164
|
|
|
102
|
-
&:focus {
|
|
103
|
-
border-width: ${thickBorderWidth} 0;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
&:focus::before,
|
|
107
|
-
&:focus::after {
|
|
108
|
-
z-index: 1;
|
|
109
|
-
border-inline-end-width: ${thickBorderWidth};
|
|
110
|
-
border-top-width: ${rtl ? 0 : thickBorderWidth};
|
|
111
|
-
border-bottom-width: ${rtl ? thickBorderWidth : 0};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
&:focus::before {
|
|
115
|
-
pointer-events: none;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
165
|
&:active {
|
|
119
|
-
border-
|
|
166
|
+
border-color: ${palette.interactive};
|
|
120
167
|
|
|
121
168
|
${StyledInnerStage} {
|
|
122
169
|
opacity: ${transparency['transparent-3']};
|
|
123
170
|
}
|
|
124
171
|
}
|
|
125
172
|
|
|
126
|
-
&:active::before,
|
|
127
|
-
&:active::after {
|
|
128
|
-
border-inline-end-width: ${thinBorderWidth};
|
|
129
|
-
border-top-width: ${rtl ? 0 : thinBorderWidth};
|
|
130
|
-
border-bottom-width: ${rtl ? thinBorderWidth : 0};
|
|
131
|
-
}
|
|
132
|
-
|
|
133
173
|
&[aria-current] {
|
|
134
174
|
${StyledInnerStage} {
|
|
135
175
|
font-weight: ${fontWeight.bold};
|
|
@@ -144,8 +184,10 @@ export const StyledStage = styled.button(({ theme: { base: { spacing, palette, '
|
|
|
144
184
|
}
|
|
145
185
|
|
|
146
186
|
@media (pointer: coarse) {
|
|
147
|
-
height: ${hitArea['finger-min']};
|
|
148
|
-
padding-inline-start: calc(2.25 *
|
|
187
|
+
min-height: ${hitArea['finger-min']};
|
|
188
|
+
padding-inline-start: calc(2.25 * var(--chevron-spacing));
|
|
189
|
+
width: calc(100% + ${chevronConfig.coarseWidth});
|
|
190
|
+
--stage-chevron-width: ${chevronConfig.coarseWidth};
|
|
149
191
|
}
|
|
150
192
|
|
|
151
193
|
${StyledIcon} {
|
|
@@ -171,49 +213,156 @@ export const StyledStageText = styled(Text)(({ theme, isCurrent }) => css `
|
|
|
171
213
|
font-weight: ${isCurrent ? theme.base['font-weight'].bold : theme.base['font-weight'].normal};
|
|
172
214
|
`);
|
|
173
215
|
StyledStageText.defaultProps = defaultThemeProp;
|
|
174
|
-
export const StyledStageContainer = styled.li(({ theme: { base: {
|
|
175
|
-
const thinBorderWidth = '0.0625rem';
|
|
176
|
-
const thickBorderWidth = '0.125rem';
|
|
216
|
+
export const StyledStageContainer = styled.li(({ theme: { base: { palette }, components: { card: { 'border-radius': borderRadius } } } }) => {
|
|
177
217
|
return css `
|
|
218
|
+
display: flex;
|
|
219
|
+
position: relative;
|
|
220
|
+
margin-inline-start: calc(-1 * ${chevronConfig.width});
|
|
221
|
+
|
|
222
|
+
&:first-of-type {
|
|
223
|
+
margin-inline-start: 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* Resting z-index: for same-z siblings, DOM order determines paint order.
|
|
227
|
+
* All non-last <li>s have z-index:1 so the later (right) <li>'s ::before paints on top
|
|
228
|
+
* at internal boundaries; the last <li> has no z-index so its left neighbor's ::after
|
|
229
|
+
* wins at the final boundary. On hover/focus/active, the interacting <li> gains z:2/3
|
|
230
|
+
* and its own pseudo-element surfaces for that boundary, regardless of which side. */
|
|
231
|
+
&:not(:last-of-type) {
|
|
232
|
+
z-index: 1;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
&:has(button:focus-visible),
|
|
236
|
+
&:has(button:active) {
|
|
237
|
+
z-index: 2;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
&:has(button:hover) {
|
|
241
|
+
z-index: 3;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@media (pointer: coarse) {
|
|
245
|
+
margin-inline-start: calc(-1 * ${chevronConfig.coarseWidth});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
&:not(:first-of-type)::before {
|
|
249
|
+
${createChevronPseudo('calc(2 * var(--chevron-border-thickness))', palette['border-line'], chevronConfig.squareSize)}
|
|
250
|
+
/* Elevate ::before above the button so it renders via the same pathway as ::after.
|
|
251
|
+
* Without z-index, ::before (first in DOM) is painted first and then covered by the
|
|
252
|
+
* button, making it only partially visible through the clip-path notch window. This
|
|
253
|
+
* causes thicker interactive-state borders (3×) to look thinner on the left boundary
|
|
254
|
+
* than on the right (::after, which paints last and is always fully visible).
|
|
255
|
+
* The ::before tip's rightmost extent is at --stage-chevron-width from the <li> start,
|
|
256
|
+
* which is before the stage text (padding-inline-start: 2 × spacing), so no content overlap. */
|
|
257
|
+
z-index: 1;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
&:not(:last-of-type)::after {
|
|
261
|
+
${createChevronPseudo('calc(2 * var(--chevron-border-thickness))', palette['border-line'], chevronConfig.squareSize)}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* Chevron positioning: 45° rotated squares create visual tips via offsets:
|
|
265
|
+
* left ≈ 0.688 × spacing, right ≈ 1.15 × spacing (accounts for skew correction) */
|
|
266
|
+
|
|
267
|
+
[dir='rtl'] &::before,
|
|
268
|
+
[dir='rtl'] &::after {
|
|
269
|
+
transform: rotateZ(-45deg) skew(-15deg, -15deg);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/* Thicken chevrons to visually match button top/bottom border on any colored state.
|
|
273
|
+
* At 45° rotation, border appears 1/sin(45°) ≈ 0.707× thinner, so 2× border ≈ 1.4× horizontal border weight. */
|
|
274
|
+
${createChevronBaseStyles(chevronConfig, 'var(--chevron-border-thickness)')}
|
|
275
|
+
${createChevronInteractiveStates(chevronConfig, 'var(--chevron-border-thickness)')}
|
|
276
|
+
|
|
277
|
+
&:has(button:hover)::before,
|
|
278
|
+
&:has(button:hover)::after {
|
|
279
|
+
border-color: ${palette['border-line']};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
&:has(button:focus-visible)::before,
|
|
283
|
+
&:has(button:focus-visible)::after {
|
|
284
|
+
border-color: ${palette.interactive};
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
&:has(button:active)::before,
|
|
288
|
+
&:has(button:active)::after {
|
|
289
|
+
border-color: ${palette.interactive};
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
@media (pointer: coarse) {
|
|
293
|
+
&:not(:first-of-type)::before,
|
|
294
|
+
&:not(:last-of-type)::after {
|
|
295
|
+
inset-block-start: calc(50% - ${chevronConfig.coarseSquareSize} / 2);
|
|
296
|
+
width: ${chevronConfig.coarseSquareSize};
|
|
297
|
+
height: ${chevronConfig.coarseSquareSize};
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
&:not(:first-of-type)::before {
|
|
301
|
+
inset-inline-start: calc(
|
|
302
|
+
-1 * ${chevronConfig.coarseWidth} - ${chevronConfig.coarseOffsetLeft}
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
&:not(:last-of-type)::after {
|
|
307
|
+
inset-inline-end: calc(
|
|
308
|
+
-1 * ${chevronConfig.coarseWidth} + ${chevronConfig.coarseOffsetRight}
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
178
313
|
&:first-of-type > ${StyledStage} {
|
|
314
|
+
--stage-chevron-width: ${chevronConfig.width};
|
|
179
315
|
border-start-start-radius: ${borderRadius};
|
|
180
316
|
border-end-start-radius: ${borderRadius};
|
|
181
|
-
|
|
182
|
-
padding-inline-start:
|
|
317
|
+
width: calc(100% + (2 * var(--stage-chevron-width)));
|
|
318
|
+
padding-inline-start: calc(var(--chevron-spacing));
|
|
319
|
+
${stageClipPath(false, true)}
|
|
183
320
|
|
|
184
|
-
|
|
185
|
-
|
|
321
|
+
/* Inline-start interactive indicator via inset shadow — avoids border-color bleeding through gradient backgrounds */
|
|
322
|
+
&:hover {
|
|
323
|
+
box-shadow: inset calc(2 * var(--chevron-border-thickness)) 0 0 ${palette['border-line']};
|
|
324
|
+
|
|
325
|
+
[dir='rtl'] & {
|
|
326
|
+
box-shadow: inset calc(-2 * var(--chevron-border-thickness)) 0 0
|
|
327
|
+
${palette['border-line']};
|
|
328
|
+
}
|
|
186
329
|
}
|
|
187
330
|
|
|
188
|
-
&:focus
|
|
189
|
-
|
|
190
|
-
|
|
331
|
+
&:focus-visible,
|
|
332
|
+
&:active {
|
|
333
|
+
box-shadow: inset calc(2 * var(--chevron-border-thickness)) 0 0 ${palette.interactive};
|
|
334
|
+
|
|
335
|
+
[dir='rtl'] & {
|
|
336
|
+
box-shadow: inset calc(-2 * var(--chevron-border-thickness)) 0 0 ${palette.interactive};
|
|
337
|
+
}
|
|
191
338
|
}
|
|
192
339
|
|
|
193
|
-
|
|
194
|
-
|
|
340
|
+
@media (pointer: coarse) {
|
|
341
|
+
--stage-chevron-width: ${chevronConfig.coarseWidth};
|
|
342
|
+
width: calc(100% + (2 * var(--stage-chevron-width)));
|
|
195
343
|
}
|
|
196
344
|
}
|
|
197
345
|
|
|
198
346
|
&:last-of-type > ${StyledStage} {
|
|
347
|
+
--stage-chevron-width: ${chevronConfig.width};
|
|
199
348
|
border-start-end-radius: ${borderRadius};
|
|
200
349
|
border-end-end-radius: ${borderRadius};
|
|
201
|
-
border-inline-end-width:
|
|
202
|
-
padding-inline-end:
|
|
350
|
+
border-inline-end-width: calc(2 * var(--chevron-border-thickness));
|
|
351
|
+
padding-inline-end: 0;
|
|
352
|
+
width: 100%;
|
|
353
|
+
${stageClipPath(true, false)}
|
|
203
354
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
padding-inline-end: ${spacing};
|
|
355
|
+
@media (pointer: coarse) {
|
|
356
|
+
--stage-chevron-width: ${chevronConfig.coarseWidth};
|
|
207
357
|
}
|
|
358
|
+
}
|
|
208
359
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
360
|
+
[dir='rtl'] &:first-of-type > ${StyledStage} {
|
|
361
|
+
${stageClipPath(true, false, true)}
|
|
362
|
+
}
|
|
213
363
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
364
|
+
[dir='rtl'] &:last-of-type > ${StyledStage} {
|
|
365
|
+
${stageClipPath(false, true, true)}
|
|
217
366
|
}
|
|
218
367
|
`;
|
|
219
368
|
});
|
|
@@ -267,4 +416,5 @@ StyledStageGlimpse.defaultProps = defaultThemeProp;
|
|
|
267
416
|
export const StyledStagesDescription = styled.p `
|
|
268
417
|
display: none;
|
|
269
418
|
`;
|
|
419
|
+
StyledStagesDescription.defaultProps = defaultThemeProp;
|
|
270
420
|
//# sourceMappingURL=Stages.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stages.styles.js","sourceRoot":"","sources":["../../../src/components/Stages/Stages.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAClD,OAAO,GAAG,CAAA;wBACY,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;qBAC3C,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC;;;;;;oBAMvC,KAAK,CAAC,IAAI,CAAC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AAG,CAAA;iBACK,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE;GAC5C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,CAAC,CAAA;;CAE9C,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport {\n calculateFontSize,\n DateTimeDisplay,\n defaultThemeProp,\n Icon,\n Text,\n StyledIcon,\n useDirection,\n calculateForegroundColor\n} from '@pega/cosmos-react-core';\n\nexport const StyledStages = styled.ol(({ theme }) => {\n return css`\n background-color: ${theme.base.palette['primary-background']};\n border-radius: ${theme.components.card['border-radius']};\n width: 100%;\n overflow: hidden;\n list-style: none;\n\n &:has(:focus-visible) {\n box-shadow: ${theme.base.shadow['focus-group']};\n }\n `;\n});\n\nStyledStages.defaultProps = defaultThemeProp;\n\nexport const StyledInnerStage = styled.span<{ ellipsis?: boolean }>(props => {\n return css`\n display: inline-block;\n text-align: center;\n white-space: nowrap;\n ${props.ellipsis &&\n css`\n overflow: hidden;\n text-overflow: ellipsis;\n `}\n `;\n});\n\nexport const StyledStage = styled.button<{ status: 'completed' | 'current' | 'pending' }>(\n ({\n theme: {\n base: { spacing, palette, 'hit-area': hitArea, transparency, 'font-weight': fontWeight },\n components: {\n 'case-view': { stages }\n }\n },\n status\n }) => {\n const thinBorderWidth = '0.0625rem';\n const thickBorderWidth = '0.125rem';\n const { rtl } = useDirection();\n const stageForeground = calculateForegroundColor(\n stages.status[status].background,\n stages.status[status]['foreground-color']\n );\n\n return css`\n background: ${stages.status[status].background};\n color: ${stageForeground};\n outline: none;\n border-color: transparent;\n border-width: ${thinBorderWidth} 0;\n border-style: solid;\n position: relative;\n height: calc(4 * ${spacing});\n padding-inline-start: calc(2 * ${spacing});\n padding-inline-end: ${spacing};\n width: 100%;\n\n &::before,\n &::after {\n content: '';\n position: absolute;\n display: block;\n width: calc(2.25 * ${spacing});\n height: calc(2.25 * ${spacing});\n border-style: solid;\n border-color: ${palette['border-line']};\n border-inline-end-width: ${thinBorderWidth};\n border-inline-start-width: 0;\n border-top-width: ${rtl ? 0 : thinBorderWidth};\n border-bottom-width: ${rtl ? thinBorderWidth : 0};\n transform: rotateZ(45deg) skew(15deg, 15deg);\n\n @media (pointer: coarse) {\n width: calc(2.875 * ${spacing});\n height: calc(2.875 * ${spacing});\n transform: rotateZ(45deg) skew(20deg, 20deg);\n }\n }\n\n &::before {\n inset-inline-start: calc(-1.125 * ${spacing});\n\n @media (pointer: coarse) {\n inset-inline-start: calc(-1.375 * ${spacing});\n }\n }\n\n &::after {\n inset-inline-end: calc(-1.125 * ${spacing});\n z-index: 1;\n background-color: ${stages.status[status].background};\n\n @media (pointer: coarse) {\n inset-inline-end: calc(-1.375 * ${spacing});\n }\n }\n\n &:hover,\n &:hover::before,\n &:hover::after {\n border-color: ${palette['border-line']};\n }\n\n &:focus,\n &:active,\n &:focus::before,\n &:active::before,\n &:focus::after,\n &:active::after {\n border-color: ${palette.interactive};\n }\n\n &:focus {\n border-width: ${thickBorderWidth} 0;\n }\n\n &:focus::before,\n &:focus::after {\n z-index: 1;\n border-inline-end-width: ${thickBorderWidth};\n border-top-width: ${rtl ? 0 : thickBorderWidth};\n border-bottom-width: ${rtl ? thickBorderWidth : 0};\n }\n\n &:focus::before {\n pointer-events: none;\n }\n\n &:active {\n border-width: ${thinBorderWidth} 0;\n\n ${StyledInnerStage} {\n opacity: ${transparency['transparent-3']};\n }\n }\n\n &:active::before,\n &:active::after {\n border-inline-end-width: ${thinBorderWidth};\n border-top-width: ${rtl ? 0 : thinBorderWidth};\n border-bottom-width: ${rtl ? thinBorderWidth : 0};\n }\n\n &[aria-current] {\n ${StyledInnerStage} {\n font-weight: ${fontWeight.bold};\n opacity: 1;\n }\n\n &:hover {\n ${StyledInnerStage} {\n opacity: ${transparency['transparent-2']};\n }\n }\n }\n\n @media (pointer: coarse) {\n height: ${hitArea['finger-min']};\n padding-inline-start: calc(2.25 * ${spacing});\n }\n\n ${StyledIcon} {\n & ~ ${StyledInnerStage} {\n margin-inline-start: 0.25rem;\n }\n }\n\n ${StyledInnerStage} {\n opacity: ${transparency['transparent-2']};\n }\n `;\n }\n);\n\nStyledStage.defaultProps = defaultThemeProp;\n\nexport const StyledStageCompleteIcon = styled(Icon)(({\n theme: {\n components: {\n 'case-view': {\n stages: {\n status: {\n completed: { 'foreground-color': foregroundColor, background }\n }\n }\n }\n }\n }\n}) => {\n const stageForeground = calculateForegroundColor(background, foregroundColor);\n return css`\n color: ${stageForeground};\n `;\n});\nStyledStageCompleteIcon.defaultProps = defaultThemeProp;\n\nexport const StyledStageText = styled(Text)<{ isCurrent?: boolean }>(\n ({ theme, isCurrent }) => css`\n font-weight: ${isCurrent ? theme.base['font-weight'].bold : theme.base['font-weight'].normal};\n `\n);\n\nStyledStageText.defaultProps = defaultThemeProp;\n\nexport const StyledStageContainer = styled.li(\n ({\n theme: {\n base: { spacing },\n components: {\n card: { 'border-radius': borderRadius }\n }\n }\n }) => {\n const thinBorderWidth = '0.0625rem';\n const thickBorderWidth = '0.125rem';\n\n return css`\n &:first-of-type > ${StyledStage} {\n border-start-start-radius: ${borderRadius};\n border-end-start-radius: ${borderRadius};\n border-inline-start-width: ${thinBorderWidth};\n padding-inline-start: ${spacing};\n\n &:active {\n padding-inline-start: ${spacing};\n }\n\n &:focus {\n border-inline-start-width: ${thickBorderWidth};\n padding-inline-start: calc(${spacing} - ${thickBorderWidth} + ${thinBorderWidth});\n }\n\n &::before {\n display: none;\n }\n }\n\n &:last-of-type > ${StyledStage} {\n border-start-end-radius: ${borderRadius};\n border-end-end-radius: ${borderRadius};\n border-inline-end-width: ${thinBorderWidth};\n padding-inline-end: ${spacing};\n\n &:active {\n border-inline-end-width: ${thinBorderWidth};\n padding-inline-end: ${spacing};\n }\n\n &:focus {\n border-inline-end-width: ${thickBorderWidth};\n padding-inline-end: calc(${spacing} - ${thinBorderWidth});\n }\n\n &::after {\n display: none;\n }\n }\n `;\n }\n);\n\nStyledStageContainer.defaultProps = defaultThemeProp;\n\nexport const StyledStepsContainer = styled.ol(({ theme }) => {\n return css`\n list-style-type: none;\n margin: calc(2 * ${theme.base.spacing}) 0 calc(3 * ${theme.base.spacing});\n\n &:empty {\n margin-block-end: 0;\n }\n `;\n});\n\nStyledStepsContainer.defaultProps = defaultThemeProp;\n\nexport const StyledStep = styled.li<{ completed: boolean }>(({ completed, theme }) => {\n const textOpacity = completed ? theme.base.transparency['transparent-2'] : 1;\n\n return css`\n border-radius: 0;\n margin-block-end: calc(${theme.base.spacing});\n color: ${theme.base.palette['foreground-color']};\n\n &:last-child {\n margin-block-end: 0;\n }\n\n & > ${StyledIcon} {\n text-align: center;\n }\n\n div {\n opacity: ${textOpacity};\n }\n `;\n});\n\nStyledStep.defaultProps = defaultThemeProp;\n\nexport const StyledDateTimeDisplay = styled(DateTimeDisplay)(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n return css`\n font-size: ${fontSize.xs};\n opacity: ${theme.base.transparency['transparent-2']};\n `;\n});\n\nStyledDateTimeDisplay.defaultProps = defaultThemeProp;\n\nexport const StyledStageGlimpse = styled.div(({ theme }) => {\n return css`\n max-width: ${theme.base['content-width'].sm};\n `;\n});\n\nStyledStageGlimpse.defaultProps = defaultThemeProp;\n\nexport const StyledStagesDescription = styled.p`\n display: none;\n`;\n"]}
|
|
1
|
+
{"version":3,"file":"Stages.styles.js","sourceRoot":"","sources":["../../../src/components/Stages/Stages.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,aAAa,GAAG,CAAC,SAAkB,EAAE,UAAm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AAC;AACJ,CAAC,CAAC,CAAC;AAEH,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACzD,OAAO,GAAG,CAAA;iBACK,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE;GAC5C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,CAAC,CAAA;;CAE9C,CAAC;AAEF,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport {\n calculateFontSize,\n DateTimeDisplay,\n defaultThemeProp,\n Icon,\n Text,\n StyledIcon,\n calculateForegroundColor\n} from '@pega/cosmos-react-core';\n\nconst stageClipPath = (leftNotch: boolean, rightPoint: boolean, mirrored = false): string => {\n if (mirrored) {\n // RTL: mirror the LTR clip-path polygon\n const points = ['100% 0', '0 0'];\n if (leftNotch) {\n points.push('var(--stage-chevron-width) 0', '0 50%', 'var(--stage-chevron-width) 100%');\n } else {\n points.push('0 100%');\n }\n points.push('100% 100%');\n if (rightPoint) {\n points.push('calc(100% - var(--stage-chevron-width)) 50%');\n }\n return `clip-path: polygon(${points.join(', ')});`;\n }\n\n const points = ['0 0', '100% 0'];\n if (rightPoint) {\n points.push(\n 'calc(100% - var(--stage-chevron-width)) 0',\n '100% 50%',\n 'calc(100% - var(--stage-chevron-width)) 100%'\n );\n } else {\n points.push('100% 100%');\n }\n points.push('0 100%');\n if (leftNotch) {\n points.push('var(--stage-chevron-width) 50%');\n }\n return `clip-path: polygon(${points.join(', ')});`;\n};\n\n// === Chevron Configuration ===\n// Centralizes spacing and border thickness via CSS custom properties set at StyledStages\nconst chevronConfig = {\n width: 'calc(1.156 * var(--chevron-spacing))',\n coarseWidth: 'calc(1.4375 * var(--chevron-spacing))',\n squareSize: 'calc(3 * var(--chevron-spacing))',\n coarseSquareSize: 'calc(3.5 * var(--chevron-spacing))',\n offsetLeft: 'calc(0.688 * var(--chevron-spacing))',\n offsetRight: 'calc(1.156 * var(--chevron-spacing))',\n coarseOffsetLeft: 'calc(0.688 * var(--chevron-spacing))',\n coarseOffsetRight: 'calc(1.5 * var(--chevron-spacing))'\n} as const;\n\n// === Chevron Helpers ===\n// After team discussion we decided to use logical properties throughout — `inset-block-start`\n// instead of `top`, and `border-block-start/end-width` instead of `border-top/bottom-width` —\n// for consistency with the rest of the file (which already uses logical inline-axis properties).\nconst createChevronPseudo = (borderWidth: string, borderColor: string, size: string): string => `\n content: '';\n position: absolute;\n display: block;\n inset-block-start: calc(50% - ${size} / 2);\n width: ${size};\n height: ${size};\n border-style: solid;\n border-color: ${borderColor};\n border-inline-end-width: ${borderWidth};\n border-inline-start-width: 0;\n border-block-start-width: ${borderWidth};\n border-block-end-width: 0;\n transform: rotateZ(45deg) skew(15deg, 15deg);\n pointer-events: none;\n`;\n\nconst createChevronBaseStyles = (config: typeof chevronConfig, borderThicknessVar: string) => css`\n &:not(:first-of-type)::before,\n &:not(:last-of-type)::after {\n border-inline-end-width: calc(1.5 * ${borderThicknessVar});\n border-block-start-width: calc(1.5 * ${borderThicknessVar});\n }\n\n &:not(:first-of-type)::before {\n inset-inline-start: calc(-1 * ${config.width} - ${config.offsetLeft});\n }\n\n &:not(:last-of-type)::after {\n inset-inline-end: calc(-1 * ${config.width} + ${config.offsetRight});\n }\n`;\n\nconst createChevronInteractiveStates = (\n config: typeof chevronConfig,\n borderThicknessVar: string\n) => css`\n &:has(button:hover)::before,\n &:has(button:hover)::after,\n &:has(button:focus-visible)::before,\n &:has(button:focus-visible)::after,\n &:has(button:active)::before,\n &:has(button:active)::after {\n border-inline-end-width: calc(2 * ${borderThicknessVar});\n border-block-start-width: calc(2 * ${borderThicknessVar});\n }\n`;\n\nexport const StyledStages = styled.ol(({ theme }) => {\n return css`\n --chevron-spacing: ${theme.base.spacing};\n --chevron-border-thickness: ${theme.components.button['border-width']};\n background-color: ${theme.base.palette['primary-background']};\n border-radius: ${theme.components.card['border-radius']};\n display: flex;\n padding: 0;\n width: 100%;\n overflow: hidden;\n list-style: none;\n\n &:has(:focus-visible) {\n box-shadow: ${theme.base.shadow['focus-group']};\n }\n `;\n});\n\nStyledStages.defaultProps = defaultThemeProp;\n\nexport const StyledInnerStage = styled.span<{ ellipsis?: boolean }>(props => {\n return css`\n display: inline-block;\n text-align: center;\n white-space: nowrap;\n ${props.ellipsis &&\n css`\n overflow: hidden;\n text-overflow: ellipsis;\n `}\n `;\n});\n\nStyledInnerStage.defaultProps = defaultThemeProp;\n\nexport const StyledStage = styled.button<{ status: 'completed' | 'current' | 'pending' }>(\n ({\n theme: {\n base: { palette, 'hit-area': hitArea, transparency, 'font-weight': fontWeight },\n components: {\n 'case-view': { stages }\n }\n },\n status\n }) => {\n const stageForeground = calculateForegroundColor(\n stages.status[status].background,\n stages.status[status]['foreground-color']\n );\n\n return css`\n background: ${stages.status[status].background};\n color: ${stageForeground};\n outline: none;\n border-color: transparent;\n border-width: calc(2 * var(--chevron-border-thickness)) 0;\n border-style: solid;\n position: relative;\n\n /* Browsers do not reliably apply flex align-items: stretch to <button> elements.\n * Adding 0.0625rem (1px at default font size) to min-height compensates so the button fills its <li> container,\n * keeping the clipped chevron background flush with the top and bottom borders. */\n min-height: calc(4 * var(--chevron-spacing) + 0.0625rem);\n padding-inline-start: calc(2 * var(--chevron-spacing));\n padding-inline-end: var(--chevron-spacing);\n margin-inline-start: 0;\n margin-inline-end: 0;\n width: calc(100% + ${chevronConfig.width});\n --stage-chevron-width: ${chevronConfig.width};\n\n ${StyledIcon}, ${StyledInnerStage} {\n transform: translateX(calc(-0.25 * var(--chevron-spacing)));\n }\n ${stageClipPath(true, true)}\n\n [dir='rtl'] & ${StyledIcon},\n [dir='rtl'] & ${StyledInnerStage} {\n transform: translateX(calc(0.25 * var(--chevron-spacing)));\n }\n\n [dir='rtl'] & {\n ${stageClipPath(true, true, true)}\n }\n\n &:hover {\n border-color: ${palette['border-line']};\n }\n\n &:focus-visible {\n border-color: ${palette.interactive};\n }\n\n &:active {\n border-color: ${palette.interactive};\n\n ${StyledInnerStage} {\n opacity: ${transparency['transparent-3']};\n }\n }\n\n &[aria-current] {\n ${StyledInnerStage} {\n font-weight: ${fontWeight.bold};\n opacity: 1;\n }\n\n &:hover {\n ${StyledInnerStage} {\n opacity: ${transparency['transparent-2']};\n }\n }\n }\n\n @media (pointer: coarse) {\n min-height: ${hitArea['finger-min']};\n padding-inline-start: calc(2.25 * var(--chevron-spacing));\n width: calc(100% + ${chevronConfig.coarseWidth});\n --stage-chevron-width: ${chevronConfig.coarseWidth};\n }\n\n ${StyledIcon} {\n & ~ ${StyledInnerStage} {\n margin-inline-start: 0.25rem;\n }\n }\n\n ${StyledInnerStage} {\n opacity: ${transparency['transparent-2']};\n }\n `;\n }\n);\n\nStyledStage.defaultProps = defaultThemeProp;\n\nexport const StyledStageCompleteIcon = styled(Icon)(({\n theme: {\n components: {\n 'case-view': {\n stages: {\n status: {\n completed: { 'foreground-color': foregroundColor, background }\n }\n }\n }\n }\n }\n}) => {\n const stageForeground = calculateForegroundColor(background, foregroundColor);\n return css`\n color: ${stageForeground};\n `;\n});\nStyledStageCompleteIcon.defaultProps = defaultThemeProp;\n\nexport const StyledStageText = styled(Text)<{ isCurrent?: boolean }>(\n ({ theme, isCurrent }) => css`\n font-weight: ${isCurrent ? theme.base['font-weight'].bold : theme.base['font-weight'].normal};\n `\n);\n\nStyledStageText.defaultProps = defaultThemeProp;\n\nexport const StyledStageContainer = styled.li(\n ({\n theme: {\n base: { palette },\n components: {\n card: { 'border-radius': borderRadius }\n }\n }\n }) => {\n return css`\n display: flex;\n position: relative;\n margin-inline-start: calc(-1 * ${chevronConfig.width});\n\n &:first-of-type {\n margin-inline-start: 0;\n }\n\n /* Resting z-index: for same-z siblings, DOM order determines paint order.\n * All non-last <li>s have z-index:1 so the later (right) <li>'s ::before paints on top\n * at internal boundaries; the last <li> has no z-index so its left neighbor's ::after\n * wins at the final boundary. On hover/focus/active, the interacting <li> gains z:2/3\n * and its own pseudo-element surfaces for that boundary, regardless of which side. */\n &:not(:last-of-type) {\n z-index: 1;\n }\n\n &:has(button:focus-visible),\n &:has(button:active) {\n z-index: 2;\n }\n\n &:has(button:hover) {\n z-index: 3;\n }\n\n @media (pointer: coarse) {\n margin-inline-start: calc(-1 * ${chevronConfig.coarseWidth});\n }\n\n &:not(:first-of-type)::before {\n ${createChevronPseudo(\n 'calc(2 * var(--chevron-border-thickness))',\n palette['border-line'],\n chevronConfig.squareSize\n )}\n /* Elevate ::before above the button so it renders via the same pathway as ::after.\n * Without z-index, ::before (first in DOM) is painted first and then covered by the\n * button, making it only partially visible through the clip-path notch window. This\n * causes thicker interactive-state borders (3×) to look thinner on the left boundary\n * than on the right (::after, which paints last and is always fully visible).\n * The ::before tip's rightmost extent is at --stage-chevron-width from the <li> start,\n * which is before the stage text (padding-inline-start: 2 × spacing), so no content overlap. */\n z-index: 1;\n }\n\n &:not(:last-of-type)::after {\n ${createChevronPseudo(\n 'calc(2 * var(--chevron-border-thickness))',\n palette['border-line'],\n chevronConfig.squareSize\n )}\n }\n\n /* Chevron positioning: 45° rotated squares create visual tips via offsets:\n * left ≈ 0.688 × spacing, right ≈ 1.15 × spacing (accounts for skew correction) */\n\n [dir='rtl'] &::before,\n [dir='rtl'] &::after {\n transform: rotateZ(-45deg) skew(-15deg, -15deg);\n }\n\n /* Thicken chevrons to visually match button top/bottom border on any colored state.\n * At 45° rotation, border appears 1/sin(45°) ≈ 0.707× thinner, so 2× border ≈ 1.4× horizontal border weight. */\n ${createChevronBaseStyles(chevronConfig, 'var(--chevron-border-thickness)')}\n ${createChevronInteractiveStates(chevronConfig, 'var(--chevron-border-thickness)')}\n\n &:has(button:hover)::before,\n &:has(button:hover)::after {\n border-color: ${palette['border-line']};\n }\n\n &:has(button:focus-visible)::before,\n &:has(button:focus-visible)::after {\n border-color: ${palette.interactive};\n }\n\n &:has(button:active)::before,\n &:has(button:active)::after {\n border-color: ${palette.interactive};\n }\n\n @media (pointer: coarse) {\n &:not(:first-of-type)::before,\n &:not(:last-of-type)::after {\n inset-block-start: calc(50% - ${chevronConfig.coarseSquareSize} / 2);\n width: ${chevronConfig.coarseSquareSize};\n height: ${chevronConfig.coarseSquareSize};\n }\n\n &:not(:first-of-type)::before {\n inset-inline-start: calc(\n -1 * ${chevronConfig.coarseWidth} - ${chevronConfig.coarseOffsetLeft}\n );\n }\n\n &:not(:last-of-type)::after {\n inset-inline-end: calc(\n -1 * ${chevronConfig.coarseWidth} + ${chevronConfig.coarseOffsetRight}\n );\n }\n }\n\n &:first-of-type > ${StyledStage} {\n --stage-chevron-width: ${chevronConfig.width};\n border-start-start-radius: ${borderRadius};\n border-end-start-radius: ${borderRadius};\n width: calc(100% + (2 * var(--stage-chevron-width)));\n padding-inline-start: calc(var(--chevron-spacing));\n ${stageClipPath(false, true)}\n\n /* Inline-start interactive indicator via inset shadow — avoids border-color bleeding through gradient backgrounds */\n &:hover {\n box-shadow: inset calc(2 * var(--chevron-border-thickness)) 0 0 ${palette['border-line']};\n\n [dir='rtl'] & {\n box-shadow: inset calc(-2 * var(--chevron-border-thickness)) 0 0\n ${palette['border-line']};\n }\n }\n\n &:focus-visible,\n &:active {\n box-shadow: inset calc(2 * var(--chevron-border-thickness)) 0 0 ${palette.interactive};\n\n [dir='rtl'] & {\n box-shadow: inset calc(-2 * var(--chevron-border-thickness)) 0 0 ${palette.interactive};\n }\n }\n\n @media (pointer: coarse) {\n --stage-chevron-width: ${chevronConfig.coarseWidth};\n width: calc(100% + (2 * var(--stage-chevron-width)));\n }\n }\n\n &:last-of-type > ${StyledStage} {\n --stage-chevron-width: ${chevronConfig.width};\n border-start-end-radius: ${borderRadius};\n border-end-end-radius: ${borderRadius};\n border-inline-end-width: calc(2 * var(--chevron-border-thickness));\n padding-inline-end: 0;\n width: 100%;\n ${stageClipPath(true, false)}\n\n @media (pointer: coarse) {\n --stage-chevron-width: ${chevronConfig.coarseWidth};\n }\n }\n\n [dir='rtl'] &:first-of-type > ${StyledStage} {\n ${stageClipPath(true, false, true)}\n }\n\n [dir='rtl'] &:last-of-type > ${StyledStage} {\n ${stageClipPath(false, true, true)}\n }\n `;\n }\n);\n\nStyledStageContainer.defaultProps = defaultThemeProp;\n\nexport const StyledStepsContainer = styled.ol(({ theme }) => {\n return css`\n list-style-type: none;\n margin: calc(2 * ${theme.base.spacing}) 0 calc(3 * ${theme.base.spacing});\n\n &:empty {\n margin-block-end: 0;\n }\n `;\n});\n\nStyledStepsContainer.defaultProps = defaultThemeProp;\n\nexport const StyledStep = styled.li<{ completed: boolean }>(({ completed, theme }) => {\n const textOpacity = completed ? theme.base.transparency['transparent-2'] : 1;\n\n return css`\n border-radius: 0;\n margin-block-end: calc(${theme.base.spacing});\n color: ${theme.base.palette['foreground-color']};\n\n &:last-child {\n margin-block-end: 0;\n }\n\n & > ${StyledIcon} {\n text-align: center;\n }\n\n div {\n opacity: ${textOpacity};\n }\n `;\n});\n\nStyledStep.defaultProps = defaultThemeProp;\n\nexport const StyledDateTimeDisplay = styled(DateTimeDisplay)(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n return css`\n font-size: ${fontSize.xs};\n opacity: ${theme.base.transparency['transparent-2']};\n `;\n});\n\nStyledDateTimeDisplay.defaultProps = defaultThemeProp;\n\nexport const StyledStageGlimpse = styled.div(({ theme }) => {\n return css`\n max-width: ${theme.base['content-width'].sm};\n `;\n});\n\nStyledStageGlimpse.defaultProps = defaultThemeProp;\n\nexport const StyledStagesDescription = styled.p`\n display: none;\n`;\n\nStyledStagesDescription.defaultProps = defaultThemeProp;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-work",
|
|
3
|
-
"version": "9.0.0-build.23.
|
|
3
|
+
"version": "9.0.0-build.23.3",
|
|
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.23.
|
|
18
|
-
"@pega/cosmos-react-rte": "9.0.0-build.23.
|
|
17
|
+
"@pega/cosmos-react-core": "9.0.0-build.23.3",
|
|
18
|
+
"@pega/cosmos-react-rte": "9.0.0-build.23.3",
|
|
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",
|