@payfit/unity-components
Version:
79 lines (78 loc) • 2.67 kB
JavaScript
import { CircularIconButton as e } from "../../../../../core/components/icon-button/CircularIconButton.js";
import { Text as t } from "../../../../../core/components/text/Text.js";
import { useAIStructuredInputContext as n } from "../AIStructuredInput.context.js";
import { forwardRef as r } from "react";
import { jsx as i, jsxs as a } from "react/jsx-runtime";
import { useIntl as o } from "react-intl";
//#region src/modules/ai-kit/components/ai-structured-input/parts/AIStructuredInputStepTitle.tsx
var s = r(({ children: r, tabIndex: s, asElement: c = "h2", ...l }, u) => {
let d = o(), f = n();
return /* @__PURE__ */ a("div", {
className: "uy:flex uy:w-full uy:min-w-0 uy:items-start uy:justify-between uy:gap-50",
children: [/* @__PURE__ */ i(t, {
...l,
ref: (e) => {
typeof u == "function" ? u(e) : u && (u.current = e), f?.registerStepHeading(f.activeStepId, e);
},
asElement: c,
tabIndex: s ?? -1,
variant: "bodyStrong",
color: "content.neutral",
className: "uy:text-pretty",
children: r
}), f && f.totalSteps > 1 && /* @__PURE__ */ a("div", {
className: "uy:flex uy:shrink-0 uy:items-center",
role: "group",
"aria-label": d.formatMessage({
id: "unity:module:ai-kit:structured-input:navigation",
defaultMessage: "Question navigation controls"
}),
children: [
/* @__PURE__ */ i(e, {
asElement: "button",
type: "button",
size: "default",
color: "content.neutral",
"aria-controls": f.stepPanelId,
icon: "CaretLeftOutlined",
title: d.formatMessage({
id: "unity:module:ai-kit:structured-input:previous-question",
defaultMessage: "Previous question"
}),
isDisabled: !f.canGoToPreviousStep,
onPress: f.goToPreviousStep
}),
/* @__PURE__ */ i(t, {
"aria-live": "polite",
"aria-atomic": "true",
variant: "bodySmall",
color: "content.neutral.lowest",
children: d.formatMessage({
id: "unity:module:ai-kit:structured-input:question-count",
defaultMessage: "{current} of {total}"
}, {
current: f.activeStepIndex + 1,
total: f.totalSteps
})
}),
/* @__PURE__ */ i(e, {
asElement: "button",
type: "button",
size: "default",
color: "content.neutral",
"aria-controls": f.stepPanelId,
icon: "CaretRightOutlined",
title: d.formatMessage({
id: "unity:module:ai-kit:structured-input:next-question",
defaultMessage: "Next question"
}),
isDisabled: !f.canGoToNextStep,
onPress: f.goToNextStep
})
]
})]
});
});
s.displayName = "AIStructuredInputStepTitle";
//#endregion
export { s as AIStructuredInputStepTitle };