@pega/cosmos-react-work 10.0.0-build.2.0 → 10.0.0-build.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +7 -3
- package/lib/components/CaseView/CaseView.styles.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.js +168 -26
- package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts +216 -9
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.js +142 -57
- package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.types.d.ts +14 -2
- package/lib/components/GenAICoach/GenAICoach.types.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.types.js.map +1 -1
- package/lib/components/GenAICoach/GenAIMessage.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAIMessage.js +22 -17
- package/lib/components/GenAICoach/GenAIMessage.js.map +1 -1
- package/lib/components/Stages/Stages.styles.d.ts +43 -0
- package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
- package/lib/components/Stages/Stages.styles.js +110 -30
- package/lib/components/Stages/Stages.styles.js.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.js +2 -2
- package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.types.d.ts +1 -1
- package/lib/components/Stakeholders/Stakeholders.types.d.ts.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.types.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAIMessage.js","sourceRoot":"","sources":["../../../src/components/GenAIC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I,EAAC,SAAS,gBACF,SAAS,EACrB,GAAG,EAAE,GAAG,aAEP,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,CACpD,KAAC,qBAAqB,IAAC,IAAI,EAAC,SAAS,EAAC,KAAK,EAAE,KAAK,CAAC,WAAW,GAAI,CACnE,EACA,KAAK,CAAC,OAAO,IAAI,KAAC,cAAc,IAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAC,UAAU,GAAG,IAC1D,CACrB,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QACrF,MAAM,eAAe,GAAG,OAAO,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC;QACxF,OAAO,CACL,KAAC,mBAAmB,IAClB,OAAO,EAAE,KAAK,CAAC,OAAO,iBACT,OAAO,CAAC,WAAW,gBACpB,eAAe,EAC3B,GAAG,EAAE,GAAG,YAEP,cAAc,GACK,CACvB,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { createContext, forwardRef, useEffect, useMemo, useRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport {\n Button,\n Flex,\n Progress,\n registerIcon,\n useI18n,\n useTestIds,\n ErrorState,\n markdownToPlainText,\n type ForwardRefForwardPropsComponent,\n Actions,\n Icon,\n useModalManager\n} from '@pega/cosmos-react-core';\nimport * as polarisSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/polaris-solid.icon';\nimport * as brainIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/brain.icon';\nimport { RichTextViewer } from '@pega/cosmos-react-rte';\nimport { useAnimatedText } from '@pega/cosmos-react-core';\n\nimport type { CoachLoadingContentProps, GenAIMessageProps } from './GenAICoach.types';\nimport {\n StyledActionsContainer,\n StyledAttachmentsList,\n StyledMessage,\n StyledSuggestion,\n StyledSuggestionsContainer,\n StyledSystemMessage,\n StyledUserMessage\n} from './GenAICoach.styles';\nimport { getGenAICoachTestIds } from './GenAICoach.test-ids';\nimport { isCoachMessage, isUserMessage } from './GenAICoach.utils';\nimport GenAIMessageProgress from './GenAIMessageProgress';\nimport ToolConfirmationMessage from './ToolConfirmationMessage';\nimport GenAIMessageFeedbackButtons from './GenAIMessageFeedback';\nimport ToolCandidates from './ToolCandidates';\n\nregisterIcon(polarisSolidIcon, brainIcon);\n\ntype StreamingContextProps = {\n isStreamingMessage?: boolean;\n isStreamingInProgress?: boolean;\n};\n\n/** Metadata Context */\nexport const StreamingContext = createContext<StreamingContextProps | undefined>({\n isStreamingMessage: false\n});\n\nconst LoadingContent = ({\n message,\n markdownMap,\n progressSteps,\n progressStepsCompleted\n}: CoachLoadingContentProps) => {\n if (!progressSteps?.length) {\n return <GenAIMessageProgress messages={message ? [message] : undefined} />;\n }\n\n if (message) {\n return (\n <>\n <RichTextViewer content={message} type='markdown' markdownMap={markdownMap} />\n <Progress variant='ellipsis' placement='inline' />\n </>\n );\n }\n\n return <GenAIMessageProgress messages={progressSteps} completedSteps={progressStepsCompleted} />;\n};\n\nconst GenAIMessage: ForwardRefForwardPropsComponent<GenAIMessageProps> = forwardRef(\n function GenAIMessage(props: PropsWithoutRef<GenAIMessageProps>, ref: GenAIMessageProps['ref']) {\n const testIds = useTestIds(props.testId, getGenAICoachTestIds);\n const t = useI18n();\n const { create } = useModalManager();\n\n const modalMethodsRef = useRef<ReturnType<typeof create> | null>(null);\n\n const { message, announceInteraction, ...restProps } = props;\n const isStringMessage = typeof message === 'string';\n const rawPlainTextMessage = isStringMessage ? markdownToPlainText(message ?? '') : '';\n\n let fallbackAriaLabel = '';\n if (isCoachMessage(props)) {\n fallbackAriaLabel = t('agent_message');\n } else if (isUserMessage(props)) {\n fallbackAriaLabel = t('user_message');\n }\n const plainTextMessage = rawPlainTextMessage || fallbackAriaLabel;\n let ariaLabel = plainTextMessage;\n\n const toolCandidates = isCoachMessage(props) ? props.toolCandidates : undefined;\n\n const isStreamingMessage = isCoachMessage(props) && props.enableStreaming;\n const allChunksReceived = isCoachMessage(props) && props.allChunksReceived;\n const enableStreaming = !!isStreamingMessage && !allChunksReceived;\n\n const {\n text: streamingMessage,\n isAnimationDone: isStreamingDone,\n animatedTillCursor\n } = useAnimatedText({\n text: isStringMessage ? message : '',\n allContentReceived: allChunksReceived === undefined ? true : allChunksReceived,\n enabled: isStringMessage && enableStreaming,\n tokenizeMarkdown: true,\n cursorStartIndex:\n isCoachMessage(props) && props.animationInitialCursorPos\n ? props.animationInitialCursorPos\n : undefined\n });\n\n useEffect(() => {\n if (isCoachMessage(props) && props.onAnimationCursorUpdate) {\n props.onAnimationCursorUpdate(animatedTillCursor);\n }\n }, [animatedTillCursor]);\n\n useEffect(() => {\n if (isStreamingMessage && props.onStreamingUpdate) {\n props.onStreamingUpdate(!!allChunksReceived && isStreamingDone);\n }\n }, [enableStreaming, isStreamingDone, allChunksReceived]);\n\n useEffect(() => {\n if (isCoachMessage(props) && toolCandidates && modalMethodsRef.current) {\n modalMethodsRef.current.update({\n loading: toolCandidates.toolState?.loading,\n error: toolCandidates.toolState?.error,\n renderCandidatesTable: toolCandidates.toolState?.renderCandidatesTable\n });\n }\n }, [toolCandidates]);\n\n useEffect(() => {\n return () => {\n const modalMethods = modalMethodsRef.current;\n\n if (!modalMethods) {\n return;\n }\n\n modalMethods.dismiss();\n modalMethods.unmount();\n };\n }, []);\n\n const streamingContext: StreamingContextProps = useMemo(() => {\n return { isStreamingMessage, isStreamingInProgress: isCoachMessage(props) && props.loading };\n }, [isStreamingMessage, props]);\n\n if (isCoachMessage(props)) {\n const {\n id: messageId,\n coachName,\n suggestions,\n onSend,\n loading,\n error,\n feedback,\n markdownMap,\n messageActions\n } = props;\n\n const { reaction } = feedback ?? {};\n const { toolState, onViewToolsConsidered } = toolCandidates ?? {};\n\n let selectedFeedbackResponse;\n\n let feedbackAriaLabel = t('sender_replied_message', [coachName, plainTextMessage ?? '']);\n\n if (feedback && reaction) {\n selectedFeedbackResponse = t('selected_noun', [\n reaction === 'liked' ? t('good_response') : t('bad_response')\n ]);\n\n feedbackAriaLabel = `${feedbackAriaLabel} ${selectedFeedbackResponse}`;\n }\n\n ariaLabel =\n suggestions && suggestions.length > 0\n ? `${feedbackAriaLabel} ${t('suggestions_in_message', [suggestions.length])}`\n : feedbackAriaLabel;\n\n const hasInteractiveContent = !!(\n suggestions?.length ||\n feedback ||\n messageActions ||\n toolState?.renderCandidatesTable\n );\n\n if (announceInteraction && hasInteractiveContent) {\n ariaLabel = `${ariaLabel} ${t('interaction_message')}`;\n }\n\n const onClickToolsConsidered = () => {\n modalMethodsRef.current = create(ToolCandidates, {\n loading: toolState?.loading,\n error: toolState?.error,\n renderCandidatesTable: toolState?.renderCandidatesTable\n });\n\n onViewToolsConsidered?.(messageId);\n };\n\n const streamingContent = isStreamingMessage && (\n <>\n {message ? (\n <>\n <StreamingContext.Provider value={streamingContext}>\n {isStringMessage ? (\n <RichTextViewer\n content={isStreamingMessage ? streamingMessage : message}\n type='markdown'\n markdownMap={markdownMap}\n />\n ) : (\n message\n )}\n </StreamingContext.Provider>\n\n {loading && <Progress variant='ellipsis' placement='inline' />}\n </>\n ) : (\n (loading || props.progressSteps?.length) && (\n <GenAIMessageProgress\n messages={props.progressSteps?.length ? props.progressSteps : undefined}\n completedSteps={\n props.progressSteps?.length ? props.progressStepsCompleted : undefined\n }\n />\n )\n )}\n </>\n );\n\n return (\n <Flex\n as='li'\n data-testid={testIds.coachMessage}\n {...restProps}\n container={{ direction: 'row', pad: [1, 0], gap: 1 }}\n type='message'\n aria-label={ariaLabel}\n ref={ref}\n >\n <StyledMessage>\n {/* Streaming loader and content */}\n {streamingContent}\n\n {loading || error ? (\n <>\n {loading && !isStreamingMessage && (\n <LoadingContent\n message={isStringMessage ? message : undefined}\n markdownMap={markdownMap}\n progressSteps={props.progressSteps}\n progressStepsCompleted={props.progressStepsCompleted}\n />\n )}\n {error && <ErrorState message={error} />}\n </>\n ) : (\n <>\n {/* Non streaming content */}\n {!isStreamingMessage &&\n message &&\n (isStringMessage ? (\n <RichTextViewer content={message} type='markdown' markdownMap={markdownMap} />\n ) : (\n message\n ))}\n\n {props.isToolConfirmation && <ToolConfirmationMessage {...props} />}\n\n {(feedback || messageActions || onViewToolsConsidered) && (\n <Flex\n container={{\n direction: 'row',\n gap: 1,\n pad: [1, undefined],\n alignItems: 'center'\n }}\n as={StyledActionsContainer}\n >\n {feedback && (\n <GenAIMessageFeedbackButtons messageId={messageId} feedback={feedback} />\n )}\n\n {onViewToolsConsidered && (\n <Button\n label={t('semantic_discovery_results')}\n variant='simple'\n icon\n compact\n onClick={onClickToolsConsidered}\n >\n <Icon name='brain' />\n </Button>\n )}\n\n {messageActions && <Actions {...messageActions} />}\n </Flex>\n )}\n\n {suggestions && suggestions.length > 0 && (\n <Flex\n as={StyledSuggestionsContainer}\n container={{ gap: 1, justify: 'end', wrap: 'wrap' }}\n >\n {suggestions.map(({ id, message: prompt, selected }) => {\n return (\n <Button\n as={StyledSuggestion}\n onClick={onSend ? () => onSend({ id, message: prompt }) : undefined}\n key={id}\n variant={selected ? 'primary' : undefined}\n >\n {prompt}\n </Button>\n );\n })}\n </Flex>\n )}\n </>\n )}\n </StyledMessage>\n </Flex>\n );\n }\n\n if (isUserMessage(props)) {\n if (plainTextMessage) {\n ariaLabel = t('you_asked', [plainTextMessage]);\n }\n\n if (announceInteraction) {\n ariaLabel = `${ariaLabel} ${t('interaction_message')}`;\n }\n\n return (\n <StyledUserMessage\n as={StyledUserMessage}\n data-testid={testIds.userMessage}\n {...restProps}\n // @ts-expect-error FIXME: Need to validate if we can remove message, and double 'as'\n type='message'\n aria-label={ariaLabel}\n ref={ref}\n >\n {props.attachments && props.attachments.length > 0 && (\n <StyledAttachmentsList type='display' items={props.attachments} />\n )}\n {props.message && <RichTextViewer content={props.message} type='markdown' />}\n </StyledUserMessage>\n );\n }\n\n if (props.from === 'system') {\n const displayMessage = props.stopped && !message ? t('generation_stopped') : message;\n const systemAriaLabel = typeof displayMessage === 'string' ? displayMessage : ariaLabel;\n return (\n <StyledSystemMessage\n stopped={props.stopped}\n data-testid={testIds.userMessage}\n aria-label={systemAriaLabel}\n ref={ref}\n >\n {displayMessage}\n </StyledSystemMessage>\n );\n }\n\n return null;\n }\n);\n\nexport default GenAIMessage;\n"]}
|
|
1
|
+
{"version":3,"file":"GenAIMessage.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAIMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG9E,OAAO,EACL,MAAM,EACN,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,UAAU,EACV,UAAU,EACV,mBAAmB,EAEnB,OAAO,EACP,IAAI,EACJ,eAAe,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,gBAAgB,MAAM,sEAAsE,CAAC;AACzG,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,0BAA0B,EAC1B,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,cAAc,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AC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QACrF,MAAM,eAAe,GAAG,OAAO,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC;QACxF,OAAO,CACL,KAAC,mBAAmB,IAClB,OAAO,EAAE,KAAK,CAAC,OAAO,iBACT,OAAO,CAAC,WAAW,gBACpB,eAAe,EAC3B,GAAG,EAAE,GAAG,YAEP,cAAc,GACK,CACvB,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { createContext, forwardRef, useEffect, useMemo, useRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport {\n Avatar,\n Button,\n Flex,\n Progress,\n registerIcon,\n useI18n,\n useTestIds,\n ErrorState,\n markdownToPlainText,\n type ForwardRefForwardPropsComponent,\n Actions,\n Icon,\n useModalManager\n} from '@pega/cosmos-react-core';\nimport * as polarisSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/polaris-solid.icon';\nimport * as brainIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/brain.icon';\nimport { RichTextViewer } from '@pega/cosmos-react-rte';\nimport { useAnimatedText } from '@pega/cosmos-react-core';\n\nimport type { CoachLoadingContentProps, GenAIMessageProps } from './GenAICoach.types';\nimport {\n StyledActionsContainer,\n StyledAttachmentsList,\n StyledGenAIAvatar,\n StyledMessageSender,\n StyledMessage,\n StyledSuggestion,\n StyledSuggestionsContainer,\n StyledSystemMessage,\n StyledUserMessage\n} from './GenAICoach.styles';\nimport { getGenAICoachTestIds } from './GenAICoach.test-ids';\nimport { isCoachMessage, isUserMessage } from './GenAICoach.utils';\nimport GenAIMessageProgress from './GenAIMessageProgress';\nimport ToolConfirmationMessage from './ToolConfirmationMessage';\nimport GenAIMessageFeedbackButtons from './GenAIMessageFeedback';\nimport ToolCandidates from './ToolCandidates';\n\nregisterIcon(polarisSolidIcon, brainIcon);\n\ntype StreamingContextProps = {\n isStreamingMessage?: boolean;\n isStreamingInProgress?: boolean;\n};\n\n/** Metadata Context */\nexport const StreamingContext = createContext<StreamingContextProps | undefined>({\n isStreamingMessage: false\n});\n\nconst LoadingContent = ({\n message,\n markdownMap,\n progressSteps,\n progressStepsCompleted\n}: CoachLoadingContentProps) => {\n if (!progressSteps?.length) {\n return <GenAIMessageProgress messages={message ? [message] : undefined} />;\n }\n\n if (message) {\n return (\n <>\n <RichTextViewer content={message} type='markdown' markdownMap={markdownMap} />\n <Progress variant='ellipsis' placement='inline' />\n </>\n );\n }\n\n return <GenAIMessageProgress messages={progressSteps} completedSteps={progressStepsCompleted} />;\n};\n\nconst GenAIMessage: ForwardRefForwardPropsComponent<GenAIMessageProps> = forwardRef(\n function GenAIMessage(props: PropsWithoutRef<GenAIMessageProps>, ref: GenAIMessageProps['ref']) {\n const testIds = useTestIds(props.testId, getGenAICoachTestIds);\n const t = useI18n();\n const { create } = useModalManager();\n\n const modalMethodsRef = useRef<ReturnType<typeof create> | null>(null);\n\n const { message, announceInteraction, simplifiedAgent, ...restProps } = props;\n const isStringMessage = typeof message === 'string';\n const rawPlainTextMessage = isStringMessage ? markdownToPlainText(message ?? '') : '';\n\n let fallbackAriaLabel = '';\n if (isCoachMessage(props)) {\n fallbackAriaLabel = t('agent_message');\n } else if (isUserMessage(props)) {\n fallbackAriaLabel = t('user_message');\n }\n const plainTextMessage = rawPlainTextMessage || fallbackAriaLabel;\n let ariaLabel = plainTextMessage;\n\n const toolCandidates = isCoachMessage(props) ? props.toolCandidates : undefined;\n\n const isStreamingMessage = isCoachMessage(props) && props.enableStreaming;\n const allChunksReceived = isCoachMessage(props) && props.allChunksReceived;\n const enableStreaming = !!isStreamingMessage && !allChunksReceived;\n\n const {\n text: streamingMessage,\n isAnimationDone: isStreamingDone,\n animatedTillCursor\n } = useAnimatedText({\n text: isStringMessage ? message : '',\n allContentReceived: allChunksReceived === undefined ? true : allChunksReceived,\n enabled: isStringMessage && enableStreaming,\n tokenizeMarkdown: true,\n cursorStartIndex:\n isCoachMessage(props) && props.animationInitialCursorPos\n ? props.animationInitialCursorPos\n : undefined\n });\n\n useEffect(() => {\n if (isCoachMessage(props) && props.onAnimationCursorUpdate) {\n props.onAnimationCursorUpdate(animatedTillCursor);\n }\n }, [animatedTillCursor]);\n\n useEffect(() => {\n if (isStreamingMessage && props.onStreamingUpdate) {\n props.onStreamingUpdate(!!allChunksReceived && isStreamingDone);\n }\n }, [enableStreaming, isStreamingDone, allChunksReceived]);\n\n useEffect(() => {\n if (isCoachMessage(props) && toolCandidates && modalMethodsRef.current) {\n modalMethodsRef.current.update({\n loading: toolCandidates.toolState?.loading,\n error: toolCandidates.toolState?.error,\n renderCandidatesTable: toolCandidates.toolState?.renderCandidatesTable\n });\n }\n }, [toolCandidates]);\n\n useEffect(() => {\n return () => {\n const modalMethods = modalMethodsRef.current;\n\n if (!modalMethods) {\n return;\n }\n\n modalMethods.dismiss();\n modalMethods.unmount();\n };\n }, []);\n\n const streamingContext: StreamingContextProps = useMemo(() => {\n return { isStreamingMessage, isStreamingInProgress: isCoachMessage(props) && props.loading };\n }, [isStreamingMessage, props]);\n\n if (isCoachMessage(props)) {\n const {\n id: messageId,\n coachName,\n suggestions,\n onSend,\n loading,\n error,\n feedback,\n markdownMap,\n messageActions,\n showSenderInfo\n } = props;\n\n const { reaction } = feedback ?? {};\n const { toolState, onViewToolsConsidered } = toolCandidates ?? {};\n\n let selectedFeedbackResponse;\n\n let feedbackAriaLabel = t('sender_replied_message', [coachName, plainTextMessage ?? '']);\n\n if (feedback && reaction) {\n selectedFeedbackResponse = t('selected_noun', [\n reaction === 'liked' ? t('good_response') : t('bad_response')\n ]);\n\n feedbackAriaLabel = `${feedbackAriaLabel} ${selectedFeedbackResponse}`;\n }\n\n ariaLabel =\n suggestions && suggestions.length > 0\n ? `${feedbackAriaLabel} ${t('suggestions_in_message', [suggestions.length])}`\n : feedbackAriaLabel;\n\n const hasInteractiveContent = !!(\n suggestions?.length ||\n feedback ||\n messageActions ||\n toolState?.renderCandidatesTable\n );\n\n if (announceInteraction && hasInteractiveContent) {\n ariaLabel = `${ariaLabel} ${t('interaction_message')}`;\n }\n\n const onClickToolsConsidered = () => {\n modalMethodsRef.current = create(ToolCandidates, {\n loading: toolState?.loading,\n error: toolState?.error,\n renderCandidatesTable: toolState?.renderCandidatesTable\n });\n\n onViewToolsConsidered?.(messageId);\n };\n\n const streamingContent = isStreamingMessage && (\n <>\n {message ? (\n <>\n <StreamingContext.Provider value={streamingContext}>\n {isStringMessage ? (\n <RichTextViewer\n content={isStreamingMessage ? streamingMessage : message}\n type='markdown'\n markdownMap={markdownMap}\n />\n ) : (\n message\n )}\n </StreamingContext.Provider>\n\n {loading && <Progress variant='ellipsis' placement='inline' />}\n </>\n ) : (\n (loading || props.progressSteps?.length) && (\n <GenAIMessageProgress\n messages={props.progressSteps?.length ? props.progressSteps : undefined}\n completedSteps={\n props.progressSteps?.length ? props.progressStepsCompleted : undefined\n }\n />\n )\n )}\n </>\n );\n\n const messageContent = (\n <StyledMessage simplified={simplifiedAgent && !showSenderInfo}>\n {/* Streaming loader and content */}\n {streamingContent}\n\n {loading || error ? (\n <>\n {loading && !isStreamingMessage && (\n <LoadingContent\n message={isStringMessage ? message : undefined}\n markdownMap={markdownMap}\n progressSteps={props.progressSteps}\n progressStepsCompleted={props.progressStepsCompleted}\n />\n )}\n {error && <ErrorState message={error} />}\n </>\n ) : (\n <>\n {/* Non streaming content */}\n {!isStreamingMessage &&\n message &&\n (isStringMessage ? (\n <RichTextViewer content={message} type='markdown' markdownMap={markdownMap} />\n ) : (\n message\n ))}\n\n {props.isToolConfirmation && <ToolConfirmationMessage {...props} />}\n\n {(feedback || messageActions || onViewToolsConsidered) && (\n <Flex\n container={{\n direction: 'row',\n gap: 1,\n pad: [1, undefined],\n alignItems: 'center'\n }}\n as={StyledActionsContainer}\n >\n {feedback && (\n <GenAIMessageFeedbackButtons messageId={messageId} feedback={feedback} />\n )}\n\n {onViewToolsConsidered && (\n <Button\n label={t('semantic_discovery_results')}\n variant='simple'\n icon\n compact\n onClick={onClickToolsConsidered}\n >\n <Icon name='brain' />\n </Button>\n )}\n\n {messageActions && <Actions {...messageActions} />}\n </Flex>\n )}\n\n {suggestions && suggestions.length > 0 && (\n <Flex\n as={StyledSuggestionsContainer}\n container={{ gap: 1, justify: 'end', wrap: 'wrap' }}\n >\n {suggestions.map(({ id, message: prompt, selected }) => {\n return (\n <Button\n as={StyledSuggestion}\n onClick={onSend ? () => onSend({ id, message: prompt }) : undefined}\n key={id}\n variant={selected ? 'primary' : undefined}\n >\n {prompt}\n </Button>\n );\n })}\n </Flex>\n )}\n </>\n )}\n </StyledMessage>\n );\n\n return (\n <Flex\n as='li'\n data-testid={testIds.coachMessage}\n {...restProps}\n container={{ direction: 'row', pad: [1, 0], gap: 1 }}\n type='message'\n aria-label={ariaLabel}\n ref={ref}\n >\n {simplifiedAgent ? (\n <>\n {showSenderInfo && (\n <StyledGenAIAvatar size='l' name={coachName ?? t('agent')} icon='polaris-solid' />\n )}\n <Flex item={{ grow: 1 }} container={{ direction: 'column', gap: 0.75 }}>\n {coachName && showSenderInfo && (\n <StyledMessageSender variant='primary'>{coachName}</StyledMessageSender>\n )}\n {messageContent}\n </Flex>\n </>\n ) : (\n messageContent\n )}\n </Flex>\n );\n }\n\n if (isUserMessage(props)) {\n if (plainTextMessage) {\n ariaLabel = t('you_asked', [plainTextMessage]);\n }\n\n if (announceInteraction) {\n ariaLabel = `${ariaLabel} ${t('interaction_message')}`;\n }\n\n const attachmentsAndMessage = (\n <>\n {props.attachments && props.attachments.length > 0 && (\n <StyledAttachmentsList type='display' items={props.attachments} />\n )}\n {props.message && <RichTextViewer content={props.message} type='markdown' />}\n </>\n );\n\n if (!simplifiedAgent) {\n return (\n <StyledUserMessage\n data-testid={testIds.userMessage}\n {...restProps}\n // @ts-expect-error FIXME: Need to validate if we can remove message, and double 'as'\n type='message'\n aria-label={ariaLabel}\n ref={ref}\n >\n {attachmentsAndMessage}\n </StyledUserMessage>\n );\n }\n\n return (\n <Flex\n as='li'\n data-testid={testIds.userMessage}\n {...restProps}\n container={{ direction: 'row', gap: 1, justify: 'end', alignItems: 'start' }}\n type='message'\n aria-label={ariaLabel}\n ref={ref}\n >\n <Flex container={{ direction: 'column', alignItems: 'end', gap: 0.75 }}>\n {props.userName !== undefined && (\n <StyledMessageSender variant='primary'>\n {props.userName.split(' ')[0] || t('you')}\n </StyledMessageSender>\n )}\n <StyledUserMessage as='div'>{attachmentsAndMessage}</StyledUserMessage>\n </Flex>\n {props.userName && <Avatar name={props.userName} size='l' shape='circle' />}\n </Flex>\n );\n }\n\n if (props.from === 'system') {\n const displayMessage = props.stopped && !message ? t('generation_stopped') : message;\n const systemAriaLabel = typeof displayMessage === 'string' ? displayMessage : ariaLabel;\n return (\n <StyledSystemMessage\n stopped={props.stopped}\n data-testid={testIds.userMessage}\n aria-label={systemAriaLabel}\n ref={ref}\n >\n {displayMessage}\n </StyledSystemMessage>\n );\n }\n\n return null;\n }\n);\n\nexport default GenAIMessage;\n"]}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outer wrapper `<div>` for the stages bar. Applies layered scroll-fade masks and
|
|
3
|
+
* reserves scrollbar space so the fade gradient does not overlap the scrollbar track.
|
|
4
|
+
*/
|
|
1
5
|
export declare const StyledStagesWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
|
+
/**
|
|
7
|
+
* Scrollable `<ol>` containing all stage chevron items. Sets the `--chevron-spacing`
|
|
8
|
+
* and `--chevron-border-thickness` custom properties consumed by child elements.
|
|
9
|
+
*/
|
|
2
10
|
export declare const StyledStages: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, never>> & string;
|
|
3
11
|
/**
|
|
4
12
|
* A sentinel is an invisible 1 px <li> placed at each end of the scrollable stage list.
|
|
@@ -13,29 +21,64 @@ export declare const StyledStages: import("styled-components/dist/types").IStyle
|
|
|
13
21
|
* offset by 1 at each end to skip the sentinels and target only real stage items.
|
|
14
22
|
*/
|
|
15
23
|
export declare const StyledSentinel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>> & string;
|
|
24
|
+
/**
|
|
25
|
+
* Inner `<span>` holding stage label content. Optionally applies `text-overflow: ellipsis`
|
|
26
|
+
* for stages with long labels.
|
|
27
|
+
*/
|
|
16
28
|
export declare const StyledInnerStage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
17
29
|
ellipsis?: boolean;
|
|
18
30
|
}>> & string;
|
|
31
|
+
/**
|
|
32
|
+
* Clickable `<button>` for a single stage. Renders the chevron clip-path shape and
|
|
33
|
+
* applies status-based background and foreground colours.
|
|
34
|
+
*/
|
|
19
35
|
export declare const StyledStage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
20
36
|
status: "completed" | "current" | "pending";
|
|
21
37
|
readOnly?: boolean;
|
|
22
38
|
}>> & string;
|
|
39
|
+
/**
|
|
40
|
+
* Checkmark icon shown inside completed stages, tinted to match the stage foreground colour.
|
|
41
|
+
*/
|
|
23
42
|
export declare const StyledStageCompleteIcon: 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>>;
|
|
43
|
+
/**
|
|
44
|
+
* Stage label text. Renders in bold weight when the stage is the current active stage.
|
|
45
|
+
*/
|
|
24
46
|
export declare const StyledStageText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<import("@pega/cosmos-react-core").TextProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement | HTMLSpanElement> & import("@pega/cosmos-react-core").ForwardProps, "ref"> & {
|
|
25
47
|
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;
|
|
26
48
|
}, {
|
|
27
49
|
isCurrent?: boolean;
|
|
28
50
|
}>> & string & Omit<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").TextProps>, keyof import("react").Component<any, {}, any>>;
|
|
51
|
+
/**
|
|
52
|
+
* `<li>` container for a single stage item. Manages negative-margin chevron overlap,
|
|
53
|
+
* pseudo-element positioning, and z-index stacking for interactive states.
|
|
54
|
+
*/
|
|
29
55
|
export declare const StyledStageContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {
|
|
30
56
|
readOnly?: boolean;
|
|
31
57
|
}>> & string;
|
|
58
|
+
/**
|
|
59
|
+
* `<ol>` list of sub-step items displayed below the stages bar when a stage is expanded.
|
|
60
|
+
*/
|
|
32
61
|
export declare const StyledStepsContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, never>> & string;
|
|
62
|
+
/**
|
|
63
|
+
* Individual step `<li>` within a stage. Dims text and icon at reduced opacity when completed.
|
|
64
|
+
*/
|
|
33
65
|
export declare const StyledStep: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {
|
|
34
66
|
completed: boolean;
|
|
35
67
|
}>> & string;
|
|
68
|
+
/**
|
|
69
|
+
* Small datetime label rendered beneath a step. Displayed at the `xs` font size
|
|
70
|
+
* and reduced opacity.
|
|
71
|
+
*/
|
|
36
72
|
export declare const StyledDateTimeDisplay: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("@pega/cosmos-react-core").DateTimeDisplayProps, "ref"> & import("react").RefAttributes<HTMLSpanElement> & import("@pega/cosmos-react-core").ForwardProps, "ref"> & {
|
|
37
73
|
ref?: ((instance: 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<HTMLSpanElement> | null | undefined;
|
|
38
74
|
}, never>> & string & Omit<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").DateTimeDisplayProps>, keyof import("react").Component<any, {}, any>>;
|
|
75
|
+
/**
|
|
76
|
+
* Container `<div>` for the stage glimpse preview panel, constrained to a small max-width.
|
|
77
|
+
*/
|
|
39
78
|
export declare const StyledStageGlimpse: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
79
|
+
/**
|
|
80
|
+
* Visually hidden `<p>` providing an accessible description for the stages list,
|
|
81
|
+
* announced by screen readers but not displayed on screen.
|
|
82
|
+
*/
|
|
40
83
|
export declare const StyledStagesDescription: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
|
|
41
84
|
//# sourceMappingURL=Stages.styles.d.ts.map
|
|
@@ -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":"AAiIA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,6NAmF9B,CAAC;AAIH;;;GAGG;AACH,eAAO,MAAM,YAAY,mOAmCvB,CAAC;AAIH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,6NA6B1B,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,gBAAgB;eAA4B,OAAO;YAe9D,CAAC;AAIH;;;GAGG;AACH,eAAO,MAAM,WAAW;YACd,WAAW,GAAG,SAAS,GAAG,SAAS;eAChC,OAAO;YA8FnB,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,uBAAuB,kaAiBlC,CAAC;AAGH;;GAEG;AACH,eAAO,MAAM,eAAe;;;gBAA8B,OAAO;kLAIhE,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,oBAAoB;eACpB,OAAO;YA6MnB,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,oBAAoB,mOAS/B,CAAC;AAIH;;GAEG;AACH,eAAO,MAAM,UAAU;eAA0B,OAAO;YAoBtD,CAAC;AAIH;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;oMAMhC,CAAC;AAIH;;GAEG;AACH,eAAO,MAAM,kBAAkB,6NAI7B,CAAC;AAIH;;;GAGG;AACH,eAAO,MAAM,uBAAuB,yOAEnC,CAAC"}
|
|
@@ -35,22 +35,23 @@ const stageClipPath = (leftNotch, rightPoint, mirrored = false) => {
|
|
|
35
35
|
const chevronConfig = {
|
|
36
36
|
// Horizontal projection of the rotated border-square forming the chevron point (fine pointer).
|
|
37
37
|
// Derived from the border-square size × cos(45° + skew). Tuned to visually align with the stage height.
|
|
38
|
-
|
|
38
|
+
// All values scaled by 1.25× relative to the original 4× spacing design (now 5× spacing height).
|
|
39
|
+
width: 'calc(1.445 * var(--chevron-spacing))',
|
|
39
40
|
// Same horizontal projection for coarse/touch pointer (larger square, proportionally wider point).
|
|
40
|
-
coarseWidth: 'calc(1.
|
|
41
|
-
// Side length of the rotated border-square forming the chevron (fine pointer: 3× base spacing).
|
|
42
|
-
squareSize: 'calc(3 * var(--chevron-spacing))',
|
|
43
|
-
// Side length of the rotated border-square for coarse/touch pointer (
|
|
44
|
-
coarseSquareSize: 'calc(
|
|
41
|
+
coarseWidth: 'calc(1.797 * var(--chevron-spacing))',
|
|
42
|
+
// Side length of the rotated border-square forming the chevron (fine pointer: 3.75× base spacing).
|
|
43
|
+
squareSize: 'calc(3.75 * var(--chevron-spacing))',
|
|
44
|
+
// Side length of the rotated border-square for coarse/touch pointer (5× base spacing).
|
|
45
|
+
coarseSquareSize: 'calc(5 * var(--chevron-spacing))',
|
|
45
46
|
// Distance to inset the ::before notch from the left edge of the stage (fine pointer).
|
|
46
|
-
// 0.
|
|
47
|
-
offsetLeft: 'calc(0.
|
|
47
|
+
// 0.86 ≈ width − half-border-overlap, keeps the notch flush with the preceding chevron point.
|
|
48
|
+
offsetLeft: 'calc(0.86 * var(--chevron-spacing))',
|
|
48
49
|
// Distance to inset the ::after point from the right edge of the stage (fine pointer).
|
|
49
50
|
// Equal to `width` so the point extends exactly one chevron-width beyond the stage boundary.
|
|
50
|
-
offsetRight: 'calc(1.
|
|
51
|
+
offsetRight: 'calc(1.445 * var(--chevron-spacing))',
|
|
51
52
|
// Coarse-pointer equivalents of offsetLeft/offsetRight, scaled to match coarseWidth/coarseSquareSize.
|
|
52
|
-
coarseOffsetLeft: 'calc(1.
|
|
53
|
-
coarseOffsetRight: 'calc(1.
|
|
53
|
+
coarseOffsetLeft: 'calc(1.2875 * var(--chevron-spacing))',
|
|
54
|
+
coarseOffsetRight: 'calc(1.797 * var(--chevron-spacing))'
|
|
54
55
|
};
|
|
55
56
|
// === Chevron Helpers ===
|
|
56
57
|
// After team discussion we decided to use logical properties throughout — `inset-block-start`
|
|
@@ -104,23 +105,45 @@ const createChevronInteractiveStates = (config, borderThicknessVar, includeHover
|
|
|
104
105
|
border-block-start-width: calc(2 * ${borderThicknessVar});
|
|
105
106
|
}
|
|
106
107
|
`;
|
|
108
|
+
/**
|
|
109
|
+
* Outer wrapper `<div>` for the stages bar. Applies layered scroll-fade masks and
|
|
110
|
+
* reserves scrollbar space so the fade gradient does not overlap the scrollbar track.
|
|
111
|
+
*/
|
|
107
112
|
export const StyledStagesWrapper = styled.div(({ theme }) => {
|
|
108
113
|
return css `
|
|
109
114
|
--stages-fade-width: calc(${theme.base.spacing} * 2);
|
|
110
115
|
--stages-fade-start: 0;
|
|
111
116
|
--stages-fade-end: 0;
|
|
112
117
|
--stages-scrollbar-reserve: calc(${theme.base.spacing} * 0.25);
|
|
118
|
+
|
|
119
|
+
/* Places gradient stops one physical pixel outside the element boundary,
|
|
120
|
+
* preventing browser anti-aliasing from creating a semi-transparent seam
|
|
121
|
+
* at mask edges. 1px is the correct unit here: it must be exactly one CSS pixel
|
|
122
|
+
* (independent of font-size), so the mask boundary doesn't introduce a seam at the
|
|
123
|
+
* element edge due to anti-aliasing.
|
|
124
|
+
* See also StyledSentinel, which uses 1px for the same reason.
|
|
125
|
+
*/
|
|
126
|
+
/* stylelint-disable-next-line unit-allowed-list -- 1px is intentional; see comment above */
|
|
127
|
+
--mask-edge-overhang: 1px;
|
|
113
128
|
position: relative;
|
|
114
129
|
width: 100%;
|
|
115
130
|
overflow: hidden;
|
|
116
131
|
border-radius: ${theme.components.card['border-radius']};
|
|
132
|
+
border-end-start-radius: var(
|
|
133
|
+
--stages-wrapper-bottom-radius,
|
|
134
|
+
${theme.components.card['border-radius']}
|
|
135
|
+
);
|
|
136
|
+
border-end-end-radius: var(
|
|
137
|
+
--stages-wrapper-bottom-radius,
|
|
138
|
+
${theme.components.card['border-radius']}
|
|
139
|
+
);
|
|
117
140
|
mask-image: linear-gradient(black, black),
|
|
118
141
|
linear-gradient(
|
|
119
142
|
to right,
|
|
120
|
-
transparent
|
|
143
|
+
transparent calc(-1 * var(--mask-edge-overhang)),
|
|
121
144
|
black var(--stages-fade-start),
|
|
122
145
|
black calc(100% - var(--stages-fade-end)),
|
|
123
|
-
transparent 100%
|
|
146
|
+
transparent calc(100% + var(--mask-edge-overhang))
|
|
124
147
|
);
|
|
125
148
|
mask-size:
|
|
126
149
|
100% var(--stages-scrollbar-reserve),
|
|
@@ -134,10 +157,10 @@ export const StyledStagesWrapper = styled.div(({ theme }) => {
|
|
|
134
157
|
mask-image: linear-gradient(black, black),
|
|
135
158
|
linear-gradient(
|
|
136
159
|
to right,
|
|
137
|
-
transparent
|
|
160
|
+
transparent calc(-1 * var(--mask-edge-overhang)),
|
|
138
161
|
black var(--stages-fade-end),
|
|
139
162
|
black calc(100% - var(--stages-fade-start)),
|
|
140
|
-
transparent 100%
|
|
163
|
+
transparent calc(100% + var(--mask-edge-overhang))
|
|
141
164
|
);
|
|
142
165
|
}
|
|
143
166
|
|
|
@@ -149,10 +172,10 @@ export const StyledStagesWrapper = styled.div(({ theme }) => {
|
|
|
149
172
|
--stages-fade-width: calc(${theme.base.spacing} * 3);
|
|
150
173
|
mask-image: linear-gradient(
|
|
151
174
|
to right,
|
|
152
|
-
transparent
|
|
175
|
+
transparent calc(-1 * var(--mask-edge-overhang)),
|
|
153
176
|
black var(--stages-fade-start),
|
|
154
177
|
black calc(100% - var(--stages-fade-end)),
|
|
155
|
-
transparent 100%
|
|
178
|
+
transparent calc(100% + var(--mask-edge-overhang))
|
|
156
179
|
);
|
|
157
180
|
mask-size: 100% 100%;
|
|
158
181
|
mask-position: 0 0;
|
|
@@ -161,16 +184,20 @@ export const StyledStagesWrapper = styled.div(({ theme }) => {
|
|
|
161
184
|
[dir='rtl'] & {
|
|
162
185
|
mask-image: linear-gradient(
|
|
163
186
|
to right,
|
|
164
|
-
transparent
|
|
187
|
+
transparent calc(-1 * var(--mask-edge-overhang)),
|
|
165
188
|
black var(--stages-fade-end),
|
|
166
189
|
black calc(100% - var(--stages-fade-start)),
|
|
167
|
-
transparent 100%
|
|
190
|
+
transparent calc(100% + var(--mask-edge-overhang))
|
|
168
191
|
);
|
|
169
192
|
}
|
|
170
193
|
}
|
|
171
194
|
`;
|
|
172
195
|
});
|
|
173
196
|
StyledStagesWrapper.defaultProps = defaultThemeProp;
|
|
197
|
+
/**
|
|
198
|
+
* Scrollable `<ol>` containing all stage chevron items. Sets the `--chevron-spacing`
|
|
199
|
+
* and `--chevron-border-thickness` custom properties consumed by child elements.
|
|
200
|
+
*/
|
|
174
201
|
export const StyledStages = styled.ol(({ theme }) => {
|
|
175
202
|
return css `
|
|
176
203
|
--chevron-spacing: ${theme.base.spacing};
|
|
@@ -224,8 +251,9 @@ export const StyledSentinel = styled.li `
|
|
|
224
251
|
flex-shrink: 0;
|
|
225
252
|
|
|
226
253
|
/* NOTE: the sentinel must occupy
|
|
227
|
-
|
|
228
|
-
|
|
254
|
+
* a single physical pixel so IntersectionObserver can detect it at threshold 0 while having
|
|
255
|
+
* negligible layout impact. A rem value could collapse to zero at small font sizes.
|
|
256
|
+
*/
|
|
229
257
|
/* stylelint-disable-next-line unit-allowed-list -- 1px is intentional */
|
|
230
258
|
width: 1px;
|
|
231
259
|
/* stylelint-disable-next-line unit-allowed-list -- 1px is intentional */
|
|
@@ -233,8 +261,27 @@ export const StyledSentinel = styled.li `
|
|
|
233
261
|
padding: 0;
|
|
234
262
|
margin: 0;
|
|
235
263
|
pointer-events: none;
|
|
264
|
+
|
|
265
|
+
/* Collapse the sentinel's layout footprint to zero on the side facing the stages.
|
|
266
|
+
* Without this, each 1px sentinel creates a visible gap between the stage buttons
|
|
267
|
+
* and the left/right edges of the wrapper. The sentinel remains in flow (required
|
|
268
|
+
* for IntersectionObserver scroll detection) but no longer displaces stage content.
|
|
269
|
+
*/
|
|
270
|
+
&:first-of-type {
|
|
271
|
+
/* stylelint-disable-next-line unit-allowed-list -- 1px matches sentinel width */
|
|
272
|
+
margin-inline-end: -1px;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
&:last-of-type {
|
|
276
|
+
/* stylelint-disable-next-line unit-allowed-list -- 1px matches sentinel width */
|
|
277
|
+
margin-inline-start: -1px;
|
|
278
|
+
}
|
|
236
279
|
`;
|
|
237
280
|
StyledSentinel.defaultProps = defaultThemeProp;
|
|
281
|
+
/**
|
|
282
|
+
* Inner `<span>` holding stage label content. Optionally applies `text-overflow: ellipsis`
|
|
283
|
+
* for stages with long labels.
|
|
284
|
+
*/
|
|
238
285
|
export const StyledInnerStage = styled.span(({ theme, ellipsis }) => {
|
|
239
286
|
return css `
|
|
240
287
|
display: inline-flex;
|
|
@@ -252,6 +299,10 @@ export const StyledInnerStage = styled.span(({ theme, ellipsis }) => {
|
|
|
252
299
|
`;
|
|
253
300
|
});
|
|
254
301
|
StyledInnerStage.defaultProps = defaultThemeProp;
|
|
302
|
+
/**
|
|
303
|
+
* Clickable `<button>` for a single stage. Renders the chevron clip-path shape and
|
|
304
|
+
* applies status-based background and foreground colours.
|
|
305
|
+
*/
|
|
255
306
|
export const StyledStage = styled.button(({ theme: { base: { palette, 'hit-area': hitArea, transparency, 'font-weight': fontWeight }, components: { 'case-view': { stages } } }, status, readOnly }) => {
|
|
256
307
|
const stageForeground = calculateForegroundColor(stages.status[status].background, stages.status[status]['foreground-color']);
|
|
257
308
|
return css `
|
|
@@ -266,7 +317,7 @@ export const StyledStage = styled.button(({ theme: { base: { palette, 'hit-area'
|
|
|
266
317
|
/* Browsers do not reliably apply flex align-items: stretch to <button> elements.
|
|
267
318
|
* Adding 0.0625rem (1px at default font size) to min-height compensates so the button fills its <li> container,
|
|
268
319
|
* keeping the clipped chevron background flush with the top and bottom borders. */
|
|
269
|
-
min-height: calc(
|
|
320
|
+
min-height: calc(5 * var(--chevron-spacing) + 0.0625rem);
|
|
270
321
|
padding-inline-start: calc(2 * var(--chevron-spacing));
|
|
271
322
|
padding-inline-end: var(--chevron-spacing);
|
|
272
323
|
margin-inline-start: 0;
|
|
@@ -332,6 +383,9 @@ export const StyledStage = styled.button(({ theme: { base: { palette, 'hit-area'
|
|
|
332
383
|
`;
|
|
333
384
|
});
|
|
334
385
|
StyledStage.defaultProps = defaultThemeProp;
|
|
386
|
+
/**
|
|
387
|
+
* Checkmark icon shown inside completed stages, tinted to match the stage foreground colour.
|
|
388
|
+
*/
|
|
335
389
|
export const StyledStageCompleteIcon = styled(Icon)(({ theme: { components: { 'case-view': { stages: { status: { completed: { 'foreground-color': foregroundColor, background } } } } } } }) => {
|
|
336
390
|
const stageForeground = calculateForegroundColor(background, foregroundColor);
|
|
337
391
|
return css `
|
|
@@ -339,10 +393,17 @@ export const StyledStageCompleteIcon = styled(Icon)(({ theme: { components: { 'c
|
|
|
339
393
|
`;
|
|
340
394
|
});
|
|
341
395
|
StyledStageCompleteIcon.defaultProps = defaultThemeProp;
|
|
396
|
+
/**
|
|
397
|
+
* Stage label text. Renders in bold weight when the stage is the current active stage.
|
|
398
|
+
*/
|
|
342
399
|
export const StyledStageText = styled(Text)(({ theme, isCurrent }) => css `
|
|
343
400
|
font-weight: ${isCurrent ? theme.base['font-weight'].bold : theme.base['font-weight'].normal};
|
|
344
401
|
`);
|
|
345
402
|
StyledStageText.defaultProps = defaultThemeProp;
|
|
403
|
+
/**
|
|
404
|
+
* `<li>` container for a single stage item. Manages negative-margin chevron overlap,
|
|
405
|
+
* pseudo-element positioning, and z-index stacking for interactive states.
|
|
406
|
+
*/
|
|
346
407
|
export const StyledStageContainer = styled.li(({ theme: { base: { palette }, components: { card: { 'border-radius': borderRadius } } }, readOnly }) => {
|
|
347
408
|
return css `
|
|
348
409
|
display: flex;
|
|
@@ -357,7 +418,8 @@ export const StyledStageContainer = styled.li(({ theme: { base: { palette }, com
|
|
|
357
418
|
* All non-last <li>s have z-index:1 so the later (right) <li>'s ::before paints on top
|
|
358
419
|
* at internal boundaries; the last <li> has no z-index so its left neighbor's ::after
|
|
359
420
|
* wins at the final boundary. On hover/focus/active, the interacting <li> gains z:2/3
|
|
360
|
-
* and its own pseudo-element surfaces for that boundary, regardless of which side.
|
|
421
|
+
* and its own pseudo-element surfaces for that boundary, regardless of which side.
|
|
422
|
+
*/
|
|
361
423
|
&:not(:nth-last-of-type(-n + 2)) {
|
|
362
424
|
z-index: 1;
|
|
363
425
|
}
|
|
@@ -386,7 +448,8 @@ export const StyledStageContainer = styled.li(({ theme: { base: { palette }, com
|
|
|
386
448
|
* causes thicker interactive-state borders (3×) to look thinner on the left boundary
|
|
387
449
|
* than on the right (::after, which paints last and is always fully visible).
|
|
388
450
|
* The ::before tip's rightmost extent is at --stage-chevron-width from the <li> start,
|
|
389
|
-
* which is before the stage text (padding-inline-start: 2 × spacing), so no content overlap.
|
|
451
|
+
* which is before the stage text (padding-inline-start: 2 × spacing), so no content overlap.
|
|
452
|
+
*/
|
|
390
453
|
z-index: 1;
|
|
391
454
|
}
|
|
392
455
|
|
|
@@ -395,7 +458,8 @@ export const StyledStageContainer = styled.li(({ theme: { base: { palette }, com
|
|
|
395
458
|
}
|
|
396
459
|
|
|
397
460
|
/* Chevron positioning: 45° rotated squares create visual tips via offsets:
|
|
398
|
-
* left ≈ 0.
|
|
461
|
+
* left ≈ 0.86 × spacing, right ≈ 1.445 × spacing (accounts for skew correction)
|
|
462
|
+
*/
|
|
399
463
|
|
|
400
464
|
[dir='rtl'] &::before,
|
|
401
465
|
[dir='rtl'] &::after {
|
|
@@ -403,19 +467,18 @@ export const StyledStageContainer = styled.li(({ theme: { base: { palette }, com
|
|
|
403
467
|
}
|
|
404
468
|
|
|
405
469
|
/* Thicken chevrons to visually match button top/bottom border on any colored state.
|
|
406
|
-
*
|
|
470
|
+
* At 45° rotation, border appears 1/sin(45°) ≈ 0.707× thinner, so 2× border ≈ 1.4× horizontal border weight.
|
|
471
|
+
*/
|
|
407
472
|
${createChevronBaseStyles(chevronConfig, 'var(--chevron-border-thickness)')}
|
|
408
473
|
${createChevronInteractiveStates(chevronConfig, 'var(--chevron-border-thickness)', !readOnly)}
|
|
409
|
-
|
|
410
|
-
${!readOnly &&
|
|
474
|
+
${!readOnly &&
|
|
411
475
|
css `
|
|
412
476
|
&:has(button:hover)::before,
|
|
413
477
|
&:has(button:hover)::after {
|
|
414
478
|
border-color: ${palette['border-line']};
|
|
415
479
|
}
|
|
416
480
|
`}
|
|
417
|
-
|
|
418
|
-
&:has(button:focus-visible)::before,
|
|
481
|
+
&:has(button:focus-visible)::before,
|
|
419
482
|
&:has(button:focus-visible)::after {
|
|
420
483
|
border-color: ${palette.interactive};
|
|
421
484
|
}
|
|
@@ -529,6 +592,9 @@ export const StyledStageContainer = styled.li(({ theme: { base: { palette }, com
|
|
|
529
592
|
`;
|
|
530
593
|
});
|
|
531
594
|
StyledStageContainer.defaultProps = defaultThemeProp;
|
|
595
|
+
/**
|
|
596
|
+
* `<ol>` list of sub-step items displayed below the stages bar when a stage is expanded.
|
|
597
|
+
*/
|
|
532
598
|
export const StyledStepsContainer = styled.ol(({ theme }) => {
|
|
533
599
|
return css `
|
|
534
600
|
list-style-type: none;
|
|
@@ -540,6 +606,9 @@ export const StyledStepsContainer = styled.ol(({ theme }) => {
|
|
|
540
606
|
`;
|
|
541
607
|
});
|
|
542
608
|
StyledStepsContainer.defaultProps = defaultThemeProp;
|
|
609
|
+
/**
|
|
610
|
+
* Individual step `<li>` within a stage. Dims text and icon at reduced opacity when completed.
|
|
611
|
+
*/
|
|
543
612
|
export const StyledStep = styled.li(({ completed, theme }) => {
|
|
544
613
|
const textOpacity = completed ? theme.base.transparency['transparent-2'] : 1;
|
|
545
614
|
return css `
|
|
@@ -561,6 +630,10 @@ export const StyledStep = styled.li(({ completed, theme }) => {
|
|
|
561
630
|
`;
|
|
562
631
|
});
|
|
563
632
|
StyledStep.defaultProps = defaultThemeProp;
|
|
633
|
+
/**
|
|
634
|
+
* Small datetime label rendered beneath a step. Displayed at the `xs` font size
|
|
635
|
+
* and reduced opacity.
|
|
636
|
+
*/
|
|
564
637
|
export const StyledDateTimeDisplay = styled(DateTimeDisplay)(({ theme }) => {
|
|
565
638
|
const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
|
|
566
639
|
return css `
|
|
@@ -569,12 +642,19 @@ export const StyledDateTimeDisplay = styled(DateTimeDisplay)(({ theme }) => {
|
|
|
569
642
|
`;
|
|
570
643
|
});
|
|
571
644
|
StyledDateTimeDisplay.defaultProps = defaultThemeProp;
|
|
645
|
+
/**
|
|
646
|
+
* Container `<div>` for the stage glimpse preview panel, constrained to a small max-width.
|
|
647
|
+
*/
|
|
572
648
|
export const StyledStageGlimpse = styled.div(({ theme }) => {
|
|
573
649
|
return css `
|
|
574
650
|
max-width: ${theme.base['content-width'].sm};
|
|
575
651
|
`;
|
|
576
652
|
});
|
|
577
653
|
StyledStageGlimpse.defaultProps = defaultThemeProp;
|
|
654
|
+
/**
|
|
655
|
+
* Visually hidden `<p>` providing an accessible description for the stages list,
|
|
656
|
+
* announced by screen readers but not displayed on screen.
|
|
657
|
+
*/
|
|
578
658
|
export const StyledStagesDescription = styled.p `
|
|
579
659
|
display: none;
|
|
580
660
|
`;
|