rdesign/frontend/node_modules/@copilotkitnext/react/dist/components/chat/CopilotChatSuggestionPill.cjs

42 lines
2.5 KiB
JavaScript

const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
const require_utils = require('../../lib/utils.cjs');
let react = require("react");
react = require_runtime.__toESM(react);
let lucide_react = require("lucide-react");
let react_jsx_runtime = require("react/jsx-runtime");
//#region src/components/chat/CopilotChatSuggestionPill.tsx
const baseClasses = "group cpk:inline-flex cpk:h-7 cpk:sm:h-8 cpk:items-center cpk:gap-1 cpk:sm:gap-1.5 cpk:rounded-full cpk:border cpk:border-border/60 cpk:bg-background cpk:px-2.5 cpk:sm:px-3 cpk:text-[11px] cpk:sm:text-xs cpk:leading-none cpk:text-foreground cpk:transition-colors cpk:cursor-pointer cpk:hover:bg-accent/60 cpk:hover:text-foreground cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-ring cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background cpk:disabled:cursor-not-allowed cpk:disabled:text-muted-foreground cpk:disabled:hover:bg-background cpk:disabled:hover:text-muted-foreground cpk:pointer-events-auto";
const labelClasses = "cpk:whitespace-nowrap cpk:font-medium cpk:leading-none";
const CopilotChatSuggestionPill = react.default.forwardRef(function CopilotChatSuggestionPill({ className, children, icon, isLoading, type, ...props }, ref) {
const showIcon = !isLoading && icon;
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
ref,
"data-copilotkit": true,
"data-testid": "copilot-suggestion",
"data-slot": "suggestion-pill",
className: require_utils.cn(baseClasses, className),
type: type ?? "button",
"aria-busy": isLoading || void 0,
disabled: isLoading || props.disabled,
...props,
children: [isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
className: "cpk:flex cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:items-center cpk:justify-center cpk:text-muted-foreground",
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, {
className: "cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:animate-spin",
"aria-hidden": "true"
})
}) : showIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
className: "cpk:flex cpk:h-3.5 cpk:sm:h-4 cpk:w-3.5 cpk:sm:w-4 cpk:items-center cpk:justify-center cpk:text-muted-foreground",
children: icon
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
className: labelClasses,
children
})]
});
});
CopilotChatSuggestionPill.displayName = "CopilotChatSuggestionPill";
//#endregion
exports.default = CopilotChatSuggestionPill;
//# sourceMappingURL=CopilotChatSuggestionPill.cjs.map