@payfit/unity-components
Version:
67 lines (66 loc) • 2.44 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 { useTranslation as o } from "react-i18next";
//#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 { t: d } = o("unity"), 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((e) => e.unity.module.aiKit.composer.structuredInput.navigation),
children: [
/* @__PURE__ */ i(e, {
asElement: "button",
type: "button",
size: "default",
color: "content.neutral",
"aria-controls": f.stepPanelId,
icon: "CaretLeftOutlined",
title: d((e) => e.unity.module.aiKit.composer.structuredInput.previousQuestion),
isDisabled: !f.canGoToPreviousStep,
onPress: f.goToPreviousStep
}),
/* @__PURE__ */ i(t, {
"aria-live": "polite",
"aria-atomic": "true",
variant: "bodySmall",
color: "content.neutral.lowest",
children: d((e) => e.unity.module.aiKit.composer.structuredInput.questionCount, {
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((e) => e.unity.module.aiKit.composer.structuredInput.nextQuestion),
isDisabled: !f.canGoToNextStep,
onPress: f.goToNextStep
})
]
})]
});
});
s.displayName = "AIStructuredInputStepTitle";
//#endregion
export { s as AIStructuredInputStepTitle };