carbon-react
Version:
A library of reusable React components for easily building user interfaces.
2 lines (1 loc) • 1.19 kB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("react");var t=require("../../typography/typography.component.js"),r=require("../../../hooks/__internal__/useLocale/useLocale.js"),a=require("../__internal__/step-flow.context.js"),i=require("../step-flow.style.js");const l=({titleString:l,titleVariant:n,screenReaderOnlyTitle:s})=>{const o=r.default(),{titleRef:p,validatedCurrentStep:d,totalSteps:u,category:c,titleVariant:y}=a.useStepFlowContext();return e.jsx(i.StyledTitleFocusWrapper,{"data-role":"title-text-wrapper","data-element":"title-text-wrapper",tabIndex:-1,ref:p,children:e.jsxs(t.Typography,{variant:n||y||"h1","data-element":"title-text",children:[e.jsx(t.Typography,{fontWeight:"700",fontSize:"var(--fontSizes600)",lineHeight:"var(--sizing375)",variant:"span","aria-hidden":"true","data-element":"visible-title-text","data-role":"visible-title-text",children:l}),d&&u&&e.jsx(t.Typography,{variant:"span","data-element":"visually-hidden-title-text","data-role":"visually-hidden-title-text",screenReaderOnly:!0,children:o.stepFlow.screenReaderOnlyTitle(s||l,d,u,c)})]})})};exports.StepFlowTitle=l,exports.default=l;