@burdenoff/microfe-healthybowl 2026.630.2 → 2026.630.3
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.
|
@@ -18,10 +18,10 @@ var c = ({ onSend: c, disabled: l = !1, placeholder: u = "Ask anything...", tool
|
|
|
18
18
|
return /* @__PURE__ */ s("div", {
|
|
19
19
|
className: "px-4 pb-4 pt-2",
|
|
20
20
|
children: [/* @__PURE__ */ o("style", { children: "@keyframes hb-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}" }), /* @__PURE__ */ s("div", {
|
|
21
|
-
className: "relative
|
|
21
|
+
className: "relative rounded-2xl border border-border-default bg-bg-sunken px-1.5 pb-2 pt-1.5 shadow-sm transition-all focus-within:border-action-primary-bg focus-within:shadow-md focus-within:ring-2 focus-within:ring-action-primary-bg/15",
|
|
22
22
|
children: [
|
|
23
23
|
y && /* @__PURE__ */ o("div", {
|
|
24
|
-
className: "pointer-events-none absolute inset-0 z-0",
|
|
24
|
+
className: "pointer-events-none absolute inset-0 z-0 overflow-hidden rounded-2xl",
|
|
25
25
|
"aria-hidden": "true",
|
|
26
26
|
"data-testid": "composer-shimmer",
|
|
27
27
|
children: /* @__PURE__ */ o("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantChatInput.js","names":[],"sources":["../../../src/components/assistant/AssistantChatInput.tsx"],"sourcesContent":["import { useRef, useState, useCallback, type FC, type KeyboardEvent, type ReactNode } from 'react';\nimport { ArrowUp, Loader2 } from 'lucide-react';\nimport { useTr } from '../../shared/hooks/useTr';\n\ninterface Props {\n onSend: (message: string) => void;\n disabled?: boolean;\n placeholder?: string;\n /** Rendered inline on the left of the composer toolbar (e.g. the mode chip). */\n toolbarStart?: ReactNode;\n}\n\n/**\n * Composer — a large rounded \"card\" (Google-Stitch / Gemini style): a roomy\n * input area on top with a controls toolbar pinned at the bottom (the mode chip\n * on the left, a circular send up-arrow on the right). The whole card lifts its\n * border on focus. Uses HB semantic tokens only.\n */\nexport const AssistantChatInput: FC<Props> = ({\n onSend,\n disabled = false,\n placeholder = 'Ask anything...',\n toolbarStart,\n}) => {\n const tr = useTr();\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n // Track whether there's text so the send button can switch between its\n // inactive (empty) and active (ready) states, like Gemini's composer.\n const [hasText, setHasText] = useState(false);\n\n const handleSend = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n\n const value = textarea.value.trim();\n if (!value || disabled) return;\n\n onSend(value);\n textarea.value = '';\n textarea.style.height = 'auto';\n setHasText(false);\n }, [onSend, disabled]);\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n handleSend();\n }\n },\n [handleSend]\n );\n\n const handleInput = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n textarea.style.height = 'auto';\n textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`;\n setHasText(textarea.value.trim().length > 0);\n }, []);\n\n // `disabled` from the parent means the assistant is busy processing a turn.\n const isProcessing = disabled;\n const canSend = hasText && !isProcessing;\n\n return (\n <div className=\"px-4 pb-4 pt-2\">\n <style>{'@keyframes hb-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}'}</style>\n {/* Large two-row composer card: a roomy input area on top, the controls\n toolbar pinned at the bottom (mode chip left, circular send right).\n While processing, a soft shimmer glides across the card. */}\n <div className=\"relative
|
|
1
|
+
{"version":3,"file":"AssistantChatInput.js","names":[],"sources":["../../../src/components/assistant/AssistantChatInput.tsx"],"sourcesContent":["import { useRef, useState, useCallback, type FC, type KeyboardEvent, type ReactNode } from 'react';\nimport { ArrowUp, Loader2 } from 'lucide-react';\nimport { useTr } from '../../shared/hooks/useTr';\n\ninterface Props {\n onSend: (message: string) => void;\n disabled?: boolean;\n placeholder?: string;\n /** Rendered inline on the left of the composer toolbar (e.g. the mode chip). */\n toolbarStart?: ReactNode;\n}\n\n/**\n * Composer — a large rounded \"card\" (Google-Stitch / Gemini style): a roomy\n * input area on top with a controls toolbar pinned at the bottom (the mode chip\n * on the left, a circular send up-arrow on the right). The whole card lifts its\n * border on focus. Uses HB semantic tokens only.\n */\nexport const AssistantChatInput: FC<Props> = ({\n onSend,\n disabled = false,\n placeholder = 'Ask anything...',\n toolbarStart,\n}) => {\n const tr = useTr();\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n // Track whether there's text so the send button can switch between its\n // inactive (empty) and active (ready) states, like Gemini's composer.\n const [hasText, setHasText] = useState(false);\n\n const handleSend = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n\n const value = textarea.value.trim();\n if (!value || disabled) return;\n\n onSend(value);\n textarea.value = '';\n textarea.style.height = 'auto';\n setHasText(false);\n }, [onSend, disabled]);\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n handleSend();\n }\n },\n [handleSend]\n );\n\n const handleInput = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n textarea.style.height = 'auto';\n textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`;\n setHasText(textarea.value.trim().length > 0);\n }, []);\n\n // `disabled` from the parent means the assistant is busy processing a turn.\n const isProcessing = disabled;\n const canSend = hasText && !isProcessing;\n\n return (\n <div className=\"px-4 pb-4 pt-2\">\n <style>{'@keyframes hb-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}'}</style>\n {/* Large two-row composer card: a roomy input area on top, the controls\n toolbar pinned at the bottom (mode chip left, circular send right).\n While processing, a soft shimmer glides across the card. */}\n {/* NOTE: the card must NOT clip overflow — the mode dropdown opens upward\n and would be cut off. The shimmer is clipped on its own layer instead. */}\n <div className=\"relative rounded-2xl border border-border-default bg-bg-sunken px-1.5 pb-2 pt-1.5 shadow-sm transition-all focus-within:border-action-primary-bg focus-within:shadow-md focus-within:ring-2 focus-within:ring-action-primary-bg/15\">\n {isProcessing && (\n <div\n className=\"pointer-events-none absolute inset-0 z-0 overflow-hidden rounded-2xl\"\n aria-hidden=\"true\"\n data-testid=\"composer-shimmer\"\n >\n <div\n className=\"h-full w-full bg-gradient-to-r from-transparent via-action-primary-bg/12 to-transparent\"\n style={{ animation: 'hb-shimmer 1.6s linear infinite' }}\n />\n </div>\n )}\n <textarea\n ref={textareaRef}\n onKeyDown={handleKeyDown}\n onInput={handleInput}\n disabled={isProcessing}\n placeholder={placeholder}\n rows={3}\n className=\"relative z-[1] min-h-[84px] w-full resize-none bg-transparent px-3 pb-2 pt-2.5 text-[15px] leading-relaxed text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50\"\n aria-label={tr('healthybowl.assistant.chatInput.ariaLabel', 'Message input')}\n data-testid=\"assistant-input\"\n />\n <div className=\"relative z-[1] flex items-center justify-between gap-2 px-1.5 pb-0.5 pt-1\">\n <div className=\"flex min-w-0 items-center gap-1.5\">{toolbarStart}</div>\n <button\n type=\"button\"\n onClick={handleSend}\n disabled={!canSend}\n className={`flex size-9 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${\n canSend\n ? 'bg-action-primary-bg text-action-primary-text hover:scale-105 hover:bg-action-primary-bg-hover'\n : 'bg-bg-elevated text-text-muted'\n }`}\n aria-label={tr('healthybowl.assistant.chatInput.send', 'Send message')}\n data-testid=\"assistant-send\"\n >\n {isProcessing ? <Loader2 className=\"size-4 animate-spin\" /> : <ArrowUp className=\"size-4\" />}\n </button>\n </div>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;AAkBA,IAAa,KAAiC,EAC5C,WACA,cAAW,IACX,iBAAc,mBACd,sBACI;CACJ,IAAM,IAAK,GAAO,EACZ,IAAc,EAA4B,KAAK,EAG/C,CAAC,GAAS,KAAc,EAAS,GAAM,EAEvC,IAAa,QAAkB;EACnC,IAAM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