@arc-lo/ui 0.3.0 → 0.3.1
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/dist/index.cjs +10 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -151,6 +151,10 @@ interface PromptBoxFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
151
151
|
}
|
|
152
152
|
declare const Footer: react.ForwardRefExoticComponent<PromptBoxFooterProps & react.RefAttributes<HTMLDivElement>>;
|
|
153
153
|
interface PromptBoxSubmitProps extends HTMLAttributes<HTMLButtonElement> {
|
|
154
|
+
/** Visual variant. "default" = text, "icon" = arrow icon only, "icon-text" = icon + text. Default: "default" */
|
|
155
|
+
variant?: "default" | "icon" | "icon-text";
|
|
156
|
+
/** Custom loading label. Default: "Sending..." */
|
|
157
|
+
loadingLabel?: string;
|
|
154
158
|
}
|
|
155
159
|
declare const SubmitButton: react.ForwardRefExoticComponent<PromptBoxSubmitProps & react.RefAttributes<HTMLButtonElement>>;
|
|
156
160
|
interface PromptBoxSuggestionsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
package/dist/index.d.ts
CHANGED
|
@@ -151,6 +151,10 @@ interface PromptBoxFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
151
151
|
}
|
|
152
152
|
declare const Footer: react.ForwardRefExoticComponent<PromptBoxFooterProps & react.RefAttributes<HTMLDivElement>>;
|
|
153
153
|
interface PromptBoxSubmitProps extends HTMLAttributes<HTMLButtonElement> {
|
|
154
|
+
/** Visual variant. "default" = text, "icon" = arrow icon only, "icon-text" = icon + text. Default: "default" */
|
|
155
|
+
variant?: "default" | "icon" | "icon-text";
|
|
156
|
+
/** Custom loading label. Default: "Sending..." */
|
|
157
|
+
loadingLabel?: string;
|
|
154
158
|
}
|
|
155
159
|
declare const SubmitButton: react.ForwardRefExoticComponent<PromptBoxSubmitProps & react.RefAttributes<HTMLButtonElement>>;
|
|
156
160
|
interface PromptBoxSuggestionsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
package/dist/index.js
CHANGED
|
@@ -632,10 +632,16 @@ var Footer = forwardRef(
|
|
|
632
632
|
}
|
|
633
633
|
);
|
|
634
634
|
Footer.displayName = "PromptBox.Footer";
|
|
635
|
+
var ArrowUpIcon = () => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M12 19V5M5 12l7-7 7 7" }) });
|
|
635
636
|
var SubmitButton = forwardRef(
|
|
636
|
-
({ children, className, ...props }, ref) => {
|
|
637
|
+
({ children, variant = "default", loadingLabel, className, ...props }, ref) => {
|
|
637
638
|
const { value, isSubmitting, disabled } = usePromptBoxContext();
|
|
638
639
|
const isEmpty = !value.trim();
|
|
640
|
+
const isIcon = variant === "icon";
|
|
641
|
+
const content = children ?? (isIcon ? isSubmitting ? /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", className: "animate-spin", children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) }) : /* @__PURE__ */ jsx(ArrowUpIcon, {}) : variant === "icon-text" ? /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
642
|
+
isSubmitting ? /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", className: "animate-spin", children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) }) : /* @__PURE__ */ jsx(ArrowUpIcon, {}),
|
|
643
|
+
isSubmitting ? loadingLabel ?? "Sending..." : "Send"
|
|
644
|
+
] }) : isSubmitting ? loadingLabel ?? "Sending..." : "Send");
|
|
639
645
|
return /* @__PURE__ */ jsx(
|
|
640
646
|
"button",
|
|
641
647
|
{
|
|
@@ -644,11 +650,12 @@ var SubmitButton = forwardRef(
|
|
|
644
650
|
disabled: isEmpty || isSubmitting || disabled,
|
|
645
651
|
style: { backgroundColor: themeVars.accent, color: themeVars.accentFg },
|
|
646
652
|
className: cn(
|
|
647
|
-
"arclo-prompt-submit ml-auto
|
|
653
|
+
"arclo-prompt-submit ml-auto transition-all hover:brightness-90 disabled:opacity-25 cursor-pointer disabled:cursor-default",
|
|
654
|
+
isIcon ? "rounded-xl p-2" : "rounded-xl px-4 py-2 text-sm font-medium",
|
|
648
655
|
className
|
|
649
656
|
),
|
|
650
657
|
...props,
|
|
651
|
-
children:
|
|
658
|
+
children: content
|
|
652
659
|
}
|
|
653
660
|
);
|
|
654
661
|
}
|