@wix/web5-core 1.63.18 → 1.63.20
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/cjs/components/ui/SearchSection.css +0 -36
- package/dist/cjs/components/ui/SearchSection.js +18 -36
- package/dist/cjs/components/ui/SearchSection.js.map +1 -1
- package/dist/cjs/components/ui/UserQuery.css +106 -0
- package/dist/cjs/components/ui/UserQuery.js +64 -19
- package/dist/cjs/components/ui/UserQuery.js.map +1 -1
- package/dist/cjs/index.js +5 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/answerSettledEvent.js +25 -0
- package/dist/cjs/types/answerSettledEvent.js.map +1 -0
- package/dist/esm/components/ui/SearchSection.css +0 -36
- package/dist/esm/components/ui/SearchSection.js +1 -7
- package/dist/esm/components/ui/SearchSection.js.map +1 -1
- package/dist/esm/components/ui/UserQuery.css +106 -0
- package/dist/esm/components/ui/UserQuery.js +19 -4
- package/dist/esm/components/ui/UserQuery.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/answerSettledEvent.js +21 -0
- package/dist/esm/types/answerSettledEvent.js.map +1 -0
- package/dist/types/components/ui/SearchSection.d.ts.map +1 -1
- package/dist/types/components/ui/UserQuery.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types/answerSettledEvent.d.ts +33 -0
- package/dist/types/types/answerSettledEvent.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/components/ui/SearchSection.css +0 -36
- package/src/components/ui/UserQuery.css +106 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.WEB5_ANSWER_SETTLED_EVENT = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Cross-bundle `web5:answer-settled` broadcast event.
|
|
7
|
+
*
|
|
8
|
+
* Sibling to `web5:answer-updated`, and deliberately NOT the same event.
|
|
9
|
+
* `answer-updated` means "the conversation advanced, regenerate your
|
|
10
|
+
* suggestions" and therefore fires only when an answer actually rendered.
|
|
11
|
+
* `answer-settled` means "the turn is over, however it ended" — success,
|
|
12
|
+
* failure, or a redirect away — and is what a UI holding a *busy* state needs.
|
|
13
|
+
*
|
|
14
|
+
* The distinction is load-bearing. An input widget that turns itself into a
|
|
15
|
+
* progress indicator on submit has to be told when to stop, and a listener that
|
|
16
|
+
* only ever hears about successes stays spinning forever on a failed answer.
|
|
17
|
+
* Overloading `answer-updated` to fire on errors would fix that listener by
|
|
18
|
+
* lying to the chip generators already consuming it.
|
|
19
|
+
*
|
|
20
|
+
* Like `web5:user-query`, a plain (non-cancelable) broadcast — any number of
|
|
21
|
+
* consumers may handle it; there is no "claim".
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const WEB5_ANSWER_SETTLED_EVENT = exports.WEB5_ANSWER_SETTLED_EVENT = 'web5:answer-settled';
|
|
25
|
+
//# sourceMappingURL=answerSettledEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WEB5_ANSWER_SETTLED_EVENT","exports"],"sources":["../../../src/types/answerSettledEvent.ts"],"sourcesContent":["/**\n * Cross-bundle `web5:answer-settled` broadcast event.\n *\n * Sibling to `web5:answer-updated`, and deliberately NOT the same event.\n * `answer-updated` means \"the conversation advanced, regenerate your\n * suggestions\" and therefore fires only when an answer actually rendered.\n * `answer-settled` means \"the turn is over, however it ended\" — success,\n * failure, or a redirect away — and is what a UI holding a *busy* state needs.\n *\n * The distinction is load-bearing. An input widget that turns itself into a\n * progress indicator on submit has to be told when to stop, and a listener that\n * only ever hears about successes stays spinning forever on a failed answer.\n * Overloading `answer-updated` to fire on errors would fix that listener by\n * lying to the chip generators already consuming it.\n *\n * Like `web5:user-query`, a plain (non-cancelable) broadcast — any number of\n * consumers may handle it; there is no \"claim\".\n */\n\nexport const WEB5_ANSWER_SETTLED_EVENT = 'web5:answer-settled';\n\nexport type Web5AnswerSettledStatus = 'ready' | 'error' | 'redirect';\n\nexport interface Web5AnswerSettledEventDetail {\n /** How the turn ended. `redirect` means the page is navigating away. */\n status: Web5AnswerSettledStatus;\n /** The `web5_id` the answering turn ran under, when known. */\n web5Id?: string;\n}\n\nexport type Web5AnswerSettledEvent = CustomEvent<Web5AnswerSettledEventDetail>;\n\ndeclare global {\n interface WindowEventMap {\n [WEB5_ANSWER_SETTLED_EVENT]: Web5AnswerSettledEvent;\n }\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,yBAAyB,GAAAC,OAAA,CAAAD,yBAAA,GAAG,qBAAqB","ignoreList":[]}
|
|
@@ -373,39 +373,6 @@
|
|
|
373
373
|
transform: translateY(-50%);
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
-
.web5-prompt-hint {
|
|
377
|
-
display: inline-flex;
|
|
378
|
-
align-items: center;
|
|
379
|
-
gap: 4px;
|
|
380
|
-
margin-right: 4px;
|
|
381
|
-
color: var(--pi-field-placeholder);
|
|
382
|
-
font-family: var(--pi-field-font-family);
|
|
383
|
-
font-size: 12px;
|
|
384
|
-
line-height: 1;
|
|
385
|
-
white-space: nowrap;
|
|
386
|
-
pointer-events: none;
|
|
387
|
-
user-select: none;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
.web5-prompt-hint__key {
|
|
391
|
-
display: inline-flex;
|
|
392
|
-
align-items: center;
|
|
393
|
-
justify-content: center;
|
|
394
|
-
min-width: 16px;
|
|
395
|
-
padding: 1px 4px;
|
|
396
|
-
border: 1px solid var(--pi-field-placeholder);
|
|
397
|
-
border-radius: 3px;
|
|
398
|
-
background: transparent;
|
|
399
|
-
font-family: inherit;
|
|
400
|
-
font-size: 11px;
|
|
401
|
-
line-height: 1;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
@media (pointer: coarse) {
|
|
405
|
-
.web5-prompt-hint {
|
|
406
|
-
display: none;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
376
|
|
|
410
377
|
.web5-prompt-field--multiline .web5-prompt-actions {
|
|
411
378
|
top: auto;
|
|
@@ -589,7 +556,4 @@
|
|
|
589
556
|
height: 20px;
|
|
590
557
|
}
|
|
591
558
|
|
|
592
|
-
.web5-prompt-hint {
|
|
593
|
-
display: none;
|
|
594
|
-
}
|
|
595
559
|
}
|
|
@@ -243,7 +243,6 @@ export const SearchSection = /*#__PURE__*/forwardRef(function SearchSection(_ref
|
|
|
243
243
|
const handleExpandClick = () => {
|
|
244
244
|
focusInput();
|
|
245
245
|
};
|
|
246
|
-
const showHint = inputValue === '' && !isFocused && !isCollapsed;
|
|
247
246
|
return /*#__PURE__*/React.createElement("div", {
|
|
248
247
|
className: cn('web5-prompt-shell', isCollapsed && 'web5-prompt-shell--collapsed',
|
|
249
248
|
// Widens the pill while the field or a chip holds focus. Driven by
|
|
@@ -290,12 +289,7 @@ export const SearchSection = /*#__PURE__*/forwardRef(function SearchSection(_ref
|
|
|
290
289
|
tabIndex: isCollapsed ? -1 : undefined
|
|
291
290
|
}), /*#__PURE__*/React.createElement("div", {
|
|
292
291
|
className: "web5-prompt-actions"
|
|
293
|
-
},
|
|
294
|
-
className: "web5-prompt-hint",
|
|
295
|
-
"aria-hidden": "true"
|
|
296
|
-
}, "Press ", /*#__PURE__*/React.createElement("kbd", {
|
|
297
|
-
className: "web5-prompt-hint__key"
|
|
298
|
-
}, "/"), ' ', "to search"), onVoiceInput && /*#__PURE__*/React.createElement("button", {
|
|
292
|
+
}, onVoiceInput && /*#__PURE__*/React.createElement("button", {
|
|
299
293
|
type: "button",
|
|
300
294
|
onClick: onVoiceInput,
|
|
301
295
|
className: "web5-prompt-voice",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useEffect","useImperativeHandle","useState","useRef","useCallback","useLayoutEffect","cn","isWeb5Url","ArrowDownIcon","createElement","xmlns","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","d","MicrophoneIcon","props","_extends","ArrowRightIcon","PromptSendIcon","SearchSection","_ref","ref","onSubmit","placeholder","submitLabel","collapsedLabel","onCollapsedChange","chips","chipDisplayMode","chipPosition","onVoiceInput","progressMessage","className","contextBanner","hasContext","canSubmitEmpty","hasContent","isBottomZoneVisible","onChipClick","onFocusChange","inputValue","setInputValue","isFocused","setIsFocused","hasFocusInside","setHasFocusInside","isMultiline","setIsMultiline","isCollapsed","setIsCollapsed","inputRef","hasExpandedWhileZoneVisibleRef","previouslyFocusedElementRef","showChips","length","effectiveCollapsedLabel","replace","handleSubmit","trimmedValue","trim","element","current","computedStyles","window","getComputedStyle","lineHeight","Number","parseFloat","hasValue","style","nextHeight","Math","min","max","scrollHeight","hasFocusInsideRef","onFocusChangeRef","focusInput","active","document","activeElement","HTMLElement","body","requestAnimationFrame","_inputRef$current","focus","_inputRef$current2","blurInput","_inputRef$current3","blur","handleKeyDown","e","key","_inputRef$current4","preventDefault","prev","shiftKey","handleInputChange","target","value","handleInputFocus","relatedTarget","handleContentFocus","handleContentBlur","next","currentTarget","contains","role","canSubmit","chipsMarkup","map","chip","label","href","onMouseDown","onClick","_inputRef$current5","tabIndex","handleExpandClick","showHint","type","onFocus","onBlur","rows","onChange","onKeyDown","undefined","disabled","Fragment"],"sources":["../../../../src/components/ui/SearchSection.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useState,\n useRef,\n useCallback,\n useLayoutEffect,\n} from 'react';\nimport { cn } from '../../lib/utils';\nimport { isWeb5Url } from '../../types/link-types';\n\nexport interface ScrollChip {\n label: string;\n href: string;\n iconHint?: string;\n}\n\nexport interface SearchSectionProps {\n onSubmit?: (value: string) => void;\n placeholder?: string;\n /**\n * When set, the submit control renders as a labeled CTA button (text +\n * right arrow) instead of the icon-only send button. Used by the empty\n * state (e.g. \"Find Your Pair\").\n */\n submitLabel?: string;\n collapsedLabel?: string;\n onCollapsedChange?: (isCollapsed: boolean) => void;\n chips?: ScrollChip[];\n chipDisplayMode?: 'focus' | 'always';\n chipPosition?: 'top' | 'bottom';\n onVoiceInput?: () => void;\n progressMessage?: string;\n className?: string;\n contextBanner?: React.ReactNode;\n hasContext?: boolean;\n canSubmitEmpty?: boolean;\n hasContent?: boolean;\n isBottomZoneVisible?: boolean;\n onChipClick?: (e: React.MouseEvent<HTMLAnchorElement>, href: string) => void;\n onFocusChange?: (focused: boolean) => void;\n}\n\nexport interface SearchSectionHandle {\n focusInput: () => void;\n blurInput: () => void;\n}\n\nconst ArrowDownIcon: React.FC = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M12 5v14\" />\n <path d=\"m19 12-7 7-7-7\" />\n </svg>\n);\n\nconst MicrophoneIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n stroke=\"none\"\n aria-hidden=\"true\"\n {...props}\n >\n <path d=\"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z\" />\n <path\n d=\"M19 10v2a7 7 0 0 1-14 0v-2M12 19v3\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n fill=\"none\"\n />\n </svg>\n);\n\nconst ArrowRightIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n {...props}\n >\n <path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" />\n </svg>\n);\n\nconst PromptSendIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n aria-hidden=\"true\"\n {...props}\n >\n <path\n d=\"M13.0306 7.53114C12.9609 7.60106 12.8781 7.65654 12.787 7.69439C12.6958 7.73224 12.5981 7.75173 12.4993 7.75173C12.4006 7.75173 12.3029 7.73224 12.2117 7.69439C12.1206 7.65654 12.0378 7.60106 11.9681 7.53114L8.74997 4.31301V13.5005C8.74997 13.6994 8.67095 13.8902 8.5303 14.0308C8.38965 14.1715 8.19888 14.2505 7.99997 14.2505C7.80106 14.2505 7.61029 14.1715 7.46964 14.0308C7.32899 13.8902 7.24997 13.6994 7.24997 13.5005V4.31301L4.0306 7.53114C3.8897 7.67203 3.69861 7.75119 3.49935 7.75119C3.30009 7.75119 3.10899 7.67203 2.9681 7.53114C2.8272 7.39024 2.74805 7.19915 2.74805 6.99989C2.74805 6.80063 2.8272 6.60953 2.9681 6.46864L7.4681 1.96864C7.53778 1.89872 7.62057 1.84324 7.71173 1.80539C7.8029 1.76753 7.90064 1.74805 7.99935 1.74805C8.09806 1.74805 8.1958 1.76753 8.28696 1.80539C8.37813 1.84324 8.46092 1.89872 8.5306 1.96864L13.0306 6.46864C13.1005 6.53832 13.156 6.62111 13.1938 6.71227C13.2317 6.80344 13.2512 6.90118 13.2512 6.99989C13.2512 7.0986 13.2317 7.19634 13.1938 7.2875C13.156 7.37867 13.1005 7.46146 13.0306 7.53114Z\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport const SearchSection = forwardRef<\n SearchSectionHandle,\n SearchSectionProps\n>(function SearchSection(\n {\n onSubmit,\n placeholder = 'Talk to us',\n submitLabel,\n collapsedLabel,\n onCollapsedChange,\n chips = [],\n chipDisplayMode = 'focus',\n chipPosition = 'top',\n onVoiceInput,\n progressMessage,\n className = '',\n contextBanner,\n hasContext,\n canSubmitEmpty = false,\n hasContent = false,\n isBottomZoneVisible = false,\n onChipClick,\n onFocusChange,\n },\n ref,\n) {\n const [inputValue, setInputValue] = useState('');\n const [isFocused, setIsFocused] = useState(false);\n const [hasFocusInside, setHasFocusInside] = useState(false);\n const [isMultiline, setIsMultiline] = useState(false);\n const [isCollapsed, setIsCollapsed] = useState(false);\n const inputRef = useRef<HTMLTextAreaElement>(null);\n const hasExpandedWhileZoneVisibleRef = useRef(false);\n const previouslyFocusedElementRef = useRef<HTMLElement | null>(null);\n const showChips =\n chips.length > 0 &&\n !hasContext &&\n (chipDisplayMode === 'always' || hasFocusInside);\n const effectiveCollapsedLabel =\n collapsedLabel ?? placeholder.replace(/\\.\\.\\.$/, '');\n\n const handleSubmit = useCallback(() => {\n const trimmedValue = inputValue.trim();\n if (trimmedValue || canSubmitEmpty) {\n onSubmit?.(trimmedValue);\n setInputValue('');\n }\n }, [canSubmitEmpty, inputValue, onSubmit]);\n\n useLayoutEffect(() => {\n const element = inputRef.current;\n if (!element) {\n return;\n }\n\n const computedStyles = window.getComputedStyle(element);\n const lineHeight = Number.parseFloat(computedStyles.lineHeight) || 32;\n\n const hasValue = inputValue.trim().length > 0;\n element.style.height = 'auto';\n const nextHeight = hasValue\n ? Math.min(Math.max(element.scrollHeight, lineHeight), 175)\n : lineHeight;\n element.style.height = `${nextHeight}px`;\n setIsMultiline(hasValue && nextHeight > lineHeight);\n }, [inputValue]);\n\n useEffect(() => {\n if (progressMessage || !hasContent) {\n setIsCollapsed(false);\n hasExpandedWhileZoneVisibleRef.current = false;\n return;\n }\n\n if (!isBottomZoneVisible) {\n hasExpandedWhileZoneVisibleRef.current = false;\n setIsCollapsed(false);\n return;\n }\n\n if (!hasExpandedWhileZoneVisibleRef.current) {\n setIsCollapsed(true);\n }\n }, [hasContent, isBottomZoneVisible, progressMessage]);\n\n useEffect(() => {\n onCollapsedChange?.(isCollapsed);\n }, [isCollapsed, onCollapsedChange]);\n\n const hasFocusInsideRef = useRef(hasFocusInside);\n hasFocusInsideRef.current = hasFocusInside;\n const onFocusChangeRef = useRef(onFocusChange);\n onFocusChangeRef.current = onFocusChange;\n\n useEffect(() => {\n onFocusChange?.(hasFocusInside);\n }, [hasFocusInside, onFocusChange]);\n\n useEffect(() => {\n return () => {\n if (hasFocusInsideRef.current) {\n onFocusChangeRef.current?.(false);\n }\n };\n }, []);\n\n const focusInput = useCallback(() => {\n const active = document.activeElement;\n if (\n active instanceof HTMLElement &&\n active !== inputRef.current &&\n active !== document.body\n ) {\n previouslyFocusedElementRef.current = active;\n }\n if (isCollapsed) {\n hasExpandedWhileZoneVisibleRef.current = true;\n setIsCollapsed(false);\n window.requestAnimationFrame(() => {\n inputRef.current?.focus();\n });\n } else {\n inputRef.current?.focus();\n }\n }, [isCollapsed]);\n\n const blurInput = useCallback(() => {\n inputRef.current?.blur();\n }, []);\n\n useImperativeHandle(ref, () => ({ focusInput, blurInput }), [\n focusInput,\n blurInput,\n ]);\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n const prev = previouslyFocusedElementRef.current;\n previouslyFocusedElementRef.current = null;\n inputRef.current?.blur();\n prev?.focus?.();\n return;\n }\n if (\n e.key === 'Enter' &&\n !e.shiftKey &&\n (inputValue.trim() || canSubmitEmpty)\n ) {\n e.preventDefault();\n handleSubmit();\n }\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInputValue(e.target.value);\n };\n\n const handleInputFocus = (e: React.FocusEvent<HTMLTextAreaElement>) => {\n setIsFocused(true);\n if (\n e.relatedTarget instanceof HTMLElement &&\n e.relatedTarget !== inputRef.current\n ) {\n previouslyFocusedElementRef.current = e.relatedTarget;\n }\n };\n\n const handleContentFocus = () => {\n setHasFocusInside(true);\n };\n\n const handleContentBlur = (e: React.FocusEvent<HTMLDivElement>) => {\n const next = e.relatedTarget as Node | null;\n if (!next || !e.currentTarget.contains(next)) {\n setHasFocusInside(false);\n }\n };\n\n if (progressMessage) {\n return (\n <div\n className={cn('web5-prompt-progress', className)}\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n <div className=\"web5-prompt-progress__indicator\" aria-hidden=\"true\">\n <ArrowDownIcon />\n </div>\n <div className=\"web5-prompt-progress__message\">{progressMessage}</div>\n </div>\n );\n }\n\n const canSubmit = inputValue.trim().length > 0 || canSubmitEmpty;\n const chipsMarkup =\n chips.length > 0 ? (\n <div\n className={cn(\n 'web5-prompt-shell__chips',\n chipPosition === 'bottom'\n ? 'web5-prompt-shell__chips--bottom'\n : 'web5-prompt-shell__chips--top',\n showChips\n ? 'web5-prompt-shell__chips--visible'\n : 'web5-prompt-shell__chips--hidden',\n )}\n aria-hidden={isCollapsed || !showChips}\n >\n {chips.map((chip) => (\n <a\n key={chip.label}\n href={isWeb5Url(chip.href) ? '#' : chip.href}\n onMouseDown={(e) => e.preventDefault()}\n onClick={(e) => {\n e.preventDefault();\n onChipClick?.(e, chip.href);\n setInputValue('');\n inputRef.current?.blur();\n }}\n tabIndex={!isCollapsed && showChips ? 0 : -1}\n // `has-custom-focus` opts out of Wix Thunderbolt's global keyboard focus ring\n // so our inset :focus-visible ring isn't overwritten when embedded in a Wix site.\n className=\"web5-prompt-chip has-custom-focus\"\n >\n {chip.label}\n <PromptSendIcon\n aria-hidden=\"true\"\n className=\"web5-prompt-send-icon\"\n />\n </a>\n ))}\n </div>\n ) : null;\n\n const handleExpandClick = () => {\n focusInput();\n };\n\n const showHint = inputValue === '' && !isFocused && !isCollapsed;\n\n return (\n <div\n className={cn(\n 'web5-prompt-shell',\n isCollapsed && 'web5-prompt-shell--collapsed',\n // Widens the pill while the field or a chip holds focus. Driven by\n // `hasFocusInside` rather than `isFocused` so clicking a chip (which\n // preventDefaults its mousedown) doesn't collapse the width mid-click.\n hasFocusInside && !isCollapsed && 'web5-prompt-shell--focused',\n className,\n )}\n >\n <div className=\"web5-prompt-shell__stage\">\n <button\n type=\"button\"\n className=\"web5-prompt-shell__collapsed-button has-custom-focus\"\n onClick={handleExpandClick}\n aria-label={effectiveCollapsedLabel}\n aria-hidden={!isCollapsed}\n tabIndex={isCollapsed ? 0 : -1}\n >\n {effectiveCollapsedLabel}\n </button>\n\n <div\n className=\"web5-prompt-shell__content\"\n aria-hidden={isCollapsed}\n onFocus={handleContentFocus}\n onBlur={handleContentBlur}\n >\n {contextBanner}\n <div className=\"web5-prompt-shell__panel\">\n <div\n className={cn(\n 'web5-prompt-shell__stack',\n chipPosition === 'top' && 'web5-prompt-shell__stack--chips-top',\n )}\n >\n <div className=\"web5-prompt-search\" role=\"search\">\n <div className=\"web5-prompt-search__inner\">\n <div\n className={cn(\n 'web5-prompt-field',\n isFocused && 'web5-prompt-field--focused',\n isMultiline && 'web5-prompt-field--multiline',\n )}\n >\n <textarea\n ref={inputRef}\n rows={1}\n value={inputValue}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n onFocus={handleInputFocus}\n onBlur={() => setIsFocused(false)}\n placeholder={placeholder}\n aria-label=\"Search or ask a question\"\n aria-keyshortcuts=\"/ Control+K\"\n className=\"web5-prompt-input has-custom-focus placeholder:text-search-input-hint\"\n tabIndex={isCollapsed ? -1 : undefined}\n />\n\n <div className=\"web5-prompt-actions\">\n {showHint && (\n <span className=\"web5-prompt-hint\" aria-hidden=\"true\">\n Press <kbd className=\"web5-prompt-hint__key\">/</kbd>{' '}\n to search\n </span>\n )}\n {onVoiceInput && (\n <button\n type=\"button\"\n onClick={onVoiceInput}\n className=\"web5-prompt-voice\"\n aria-label=\"Voice input\"\n tabIndex={isCollapsed ? -1 : undefined}\n >\n <MicrophoneIcon />\n </button>\n )}\n <button\n type=\"button\"\n onClick={handleSubmit}\n className={cn(\n 'web5-prompt-submit',\n submitLabel && 'web5-prompt-submit--labeled',\n canSubmit && 'web5-prompt-submit--active',\n )}\n aria-label={submitLabel ?? 'Submit'}\n disabled={!canSubmit || isCollapsed}\n tabIndex={isCollapsed ? -1 : undefined}\n >\n {submitLabel ? (\n <>\n <span className=\"web5-prompt-submit__label\">\n {submitLabel}\n </span>\n <ArrowRightIcon\n aria-hidden=\"true\"\n className=\"web5-prompt-send-icon\"\n />\n </>\n ) : (\n <PromptSendIcon\n aria-hidden=\"true\"\n className=\"web5-prompt-send-icon\"\n />\n )}\n </button>\n </div>\n </div>\n </div>\n </div>\n\n {chipsMarkup}\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n});\n"],"mappings":";AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,QAAQ,EACRC,MAAM,EACNC,WAAW,EACXC,eAAe,QACV,OAAO;AACd,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,wBAAwB;AAuClD,MAAMC,aAAuB,GAAGA,CAAA,kBAC9BV,KAAA,CAAAW,aAAA;EACEC,KAAK,EAAC,4BAA4B;EAClCC,KAAK,EAAC,IAAI;EACVC,MAAM,EAAC,IAAI;EACXC,OAAO,EAAC,WAAW;EACnBC,IAAI,EAAC,MAAM;EACXC,MAAM,EAAC,cAAc;EACrBC,WAAW,EAAC,GAAG;EACfC,aAAa,EAAC,OAAO;EACrBC,cAAc,EAAC,OAAO;EACtB,eAAY;AAAM,gBAElBpB,KAAA,CAAAW,aAAA;EAAMU,CAAC,EAAC;AAAU,CAAE,CAAC,eACrBrB,KAAA,CAAAW,aAAA;EAAMU,CAAC,EAAC;AAAgB,CAAE,CACvB,CACN;AAED,MAAMC,cAAuD,GAAIC,KAAK,iBACpEvB,KAAA,CAAAW,aAAA,QAAAa,QAAA;EACEZ,KAAK,EAAC,4BAA4B;EAClCC,KAAK,EAAC,IAAI;EACVC,MAAM,EAAC,IAAI;EACXC,OAAO,EAAC,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AC;EAA2B,GACxCR,WACG,CAAC,eACPhC,KAAA,CAAAW,aAAA,CAACc,cAAc;IACb,eAAY,MAAM;IAClBe,SAAS,EAAC;EAAuB,CAClC,CACD,CAAC,gBAEHxC,KAAA,CAAAW,aAAA,CAACe,cAAc;IACb,eAAY,MAAM;IAClBc,SAAS,EAAC;EAAuB,CAClC,CAEG,CACL,CACF,CACF,CACF,CAAC,EAEL6E,WACE,CACF,CACF,CACF,CACF,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useEffect","useImperativeHandle","useState","useRef","useCallback","useLayoutEffect","cn","isWeb5Url","ArrowDownIcon","createElement","xmlns","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","d","MicrophoneIcon","props","_extends","ArrowRightIcon","PromptSendIcon","SearchSection","_ref","ref","onSubmit","placeholder","submitLabel","collapsedLabel","onCollapsedChange","chips","chipDisplayMode","chipPosition","onVoiceInput","progressMessage","className","contextBanner","hasContext","canSubmitEmpty","hasContent","isBottomZoneVisible","onChipClick","onFocusChange","inputValue","setInputValue","isFocused","setIsFocused","hasFocusInside","setHasFocusInside","isMultiline","setIsMultiline","isCollapsed","setIsCollapsed","inputRef","hasExpandedWhileZoneVisibleRef","previouslyFocusedElementRef","showChips","length","effectiveCollapsedLabel","replace","handleSubmit","trimmedValue","trim","element","current","computedStyles","window","getComputedStyle","lineHeight","Number","parseFloat","hasValue","style","nextHeight","Math","min","max","scrollHeight","hasFocusInsideRef","onFocusChangeRef","focusInput","active","document","activeElement","HTMLElement","body","requestAnimationFrame","_inputRef$current","focus","_inputRef$current2","blurInput","_inputRef$current3","blur","handleKeyDown","e","key","_inputRef$current4","preventDefault","prev","shiftKey","handleInputChange","target","value","handleInputFocus","relatedTarget","handleContentFocus","handleContentBlur","next","currentTarget","contains","role","canSubmit","chipsMarkup","map","chip","label","href","onMouseDown","onClick","_inputRef$current5","tabIndex","handleExpandClick","type","onFocus","onBlur","rows","onChange","onKeyDown","undefined","disabled","Fragment"],"sources":["../../../../src/components/ui/SearchSection.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useState,\n useRef,\n useCallback,\n useLayoutEffect,\n} from 'react';\nimport { cn } from '../../lib/utils';\nimport { isWeb5Url } from '../../types/link-types';\n\nexport interface ScrollChip {\n label: string;\n href: string;\n iconHint?: string;\n}\n\nexport interface SearchSectionProps {\n onSubmit?: (value: string) => void;\n placeholder?: string;\n /**\n * When set, the submit control renders as a labeled CTA button (text +\n * right arrow) instead of the icon-only send button. Used by the empty\n * state (e.g. \"Find Your Pair\").\n */\n submitLabel?: string;\n collapsedLabel?: string;\n onCollapsedChange?: (isCollapsed: boolean) => void;\n chips?: ScrollChip[];\n chipDisplayMode?: 'focus' | 'always';\n chipPosition?: 'top' | 'bottom';\n onVoiceInput?: () => void;\n progressMessage?: string;\n className?: string;\n contextBanner?: React.ReactNode;\n hasContext?: boolean;\n canSubmitEmpty?: boolean;\n hasContent?: boolean;\n isBottomZoneVisible?: boolean;\n onChipClick?: (e: React.MouseEvent<HTMLAnchorElement>, href: string) => void;\n onFocusChange?: (focused: boolean) => void;\n}\n\nexport interface SearchSectionHandle {\n focusInput: () => void;\n blurInput: () => void;\n}\n\nconst ArrowDownIcon: React.FC = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M12 5v14\" />\n <path d=\"m19 12-7 7-7-7\" />\n </svg>\n);\n\nconst MicrophoneIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n stroke=\"none\"\n aria-hidden=\"true\"\n {...props}\n >\n <path d=\"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z\" />\n <path\n d=\"M19 10v2a7 7 0 0 1-14 0v-2M12 19v3\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n fill=\"none\"\n />\n </svg>\n);\n\nconst ArrowRightIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n {...props}\n >\n <path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" />\n </svg>\n);\n\nconst PromptSendIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n aria-hidden=\"true\"\n {...props}\n >\n <path\n d=\"M13.0306 7.53114C12.9609 7.60106 12.8781 7.65654 12.787 7.69439C12.6958 7.73224 12.5981 7.75173 12.4993 7.75173C12.4006 7.75173 12.3029 7.73224 12.2117 7.69439C12.1206 7.65654 12.0378 7.60106 11.9681 7.53114L8.74997 4.31301V13.5005C8.74997 13.6994 8.67095 13.8902 8.5303 14.0308C8.38965 14.1715 8.19888 14.2505 7.99997 14.2505C7.80106 14.2505 7.61029 14.1715 7.46964 14.0308C7.32899 13.8902 7.24997 13.6994 7.24997 13.5005V4.31301L4.0306 7.53114C3.8897 7.67203 3.69861 7.75119 3.49935 7.75119C3.30009 7.75119 3.10899 7.67203 2.9681 7.53114C2.8272 7.39024 2.74805 7.19915 2.74805 6.99989C2.74805 6.80063 2.8272 6.60953 2.9681 6.46864L7.4681 1.96864C7.53778 1.89872 7.62057 1.84324 7.71173 1.80539C7.8029 1.76753 7.90064 1.74805 7.99935 1.74805C8.09806 1.74805 8.1958 1.76753 8.28696 1.80539C8.37813 1.84324 8.46092 1.89872 8.5306 1.96864L13.0306 6.46864C13.1005 6.53832 13.156 6.62111 13.1938 6.71227C13.2317 6.80344 13.2512 6.90118 13.2512 6.99989C13.2512 7.0986 13.2317 7.19634 13.1938 7.2875C13.156 7.37867 13.1005 7.46146 13.0306 7.53114Z\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport const SearchSection = forwardRef<\n SearchSectionHandle,\n SearchSectionProps\n>(function SearchSection(\n {\n onSubmit,\n placeholder = 'Talk to us',\n submitLabel,\n collapsedLabel,\n onCollapsedChange,\n chips = [],\n chipDisplayMode = 'focus',\n chipPosition = 'top',\n onVoiceInput,\n progressMessage,\n className = '',\n contextBanner,\n hasContext,\n canSubmitEmpty = false,\n hasContent = false,\n isBottomZoneVisible = false,\n onChipClick,\n onFocusChange,\n },\n ref,\n) {\n const [inputValue, setInputValue] = useState('');\n const [isFocused, setIsFocused] = useState(false);\n const [hasFocusInside, setHasFocusInside] = useState(false);\n const [isMultiline, setIsMultiline] = useState(false);\n const [isCollapsed, setIsCollapsed] = useState(false);\n const inputRef = useRef<HTMLTextAreaElement>(null);\n const hasExpandedWhileZoneVisibleRef = useRef(false);\n const previouslyFocusedElementRef = useRef<HTMLElement | null>(null);\n const showChips =\n chips.length > 0 &&\n !hasContext &&\n (chipDisplayMode === 'always' || hasFocusInside);\n const effectiveCollapsedLabel =\n collapsedLabel ?? placeholder.replace(/\\.\\.\\.$/, '');\n\n const handleSubmit = useCallback(() => {\n const trimmedValue = inputValue.trim();\n if (trimmedValue || canSubmitEmpty) {\n onSubmit?.(trimmedValue);\n setInputValue('');\n }\n }, [canSubmitEmpty, inputValue, onSubmit]);\n\n useLayoutEffect(() => {\n const element = inputRef.current;\n if (!element) {\n return;\n }\n\n const computedStyles = window.getComputedStyle(element);\n const lineHeight = Number.parseFloat(computedStyles.lineHeight) || 32;\n\n const hasValue = inputValue.trim().length > 0;\n element.style.height = 'auto';\n const nextHeight = hasValue\n ? Math.min(Math.max(element.scrollHeight, lineHeight), 175)\n : lineHeight;\n element.style.height = `${nextHeight}px`;\n setIsMultiline(hasValue && nextHeight > lineHeight);\n }, [inputValue]);\n\n useEffect(() => {\n if (progressMessage || !hasContent) {\n setIsCollapsed(false);\n hasExpandedWhileZoneVisibleRef.current = false;\n return;\n }\n\n if (!isBottomZoneVisible) {\n hasExpandedWhileZoneVisibleRef.current = false;\n setIsCollapsed(false);\n return;\n }\n\n if (!hasExpandedWhileZoneVisibleRef.current) {\n setIsCollapsed(true);\n }\n }, [hasContent, isBottomZoneVisible, progressMessage]);\n\n useEffect(() => {\n onCollapsedChange?.(isCollapsed);\n }, [isCollapsed, onCollapsedChange]);\n\n const hasFocusInsideRef = useRef(hasFocusInside);\n hasFocusInsideRef.current = hasFocusInside;\n const onFocusChangeRef = useRef(onFocusChange);\n onFocusChangeRef.current = onFocusChange;\n\n useEffect(() => {\n onFocusChange?.(hasFocusInside);\n }, [hasFocusInside, onFocusChange]);\n\n useEffect(() => {\n return () => {\n if (hasFocusInsideRef.current) {\n onFocusChangeRef.current?.(false);\n }\n };\n }, []);\n\n const focusInput = useCallback(() => {\n const active = document.activeElement;\n if (\n active instanceof HTMLElement &&\n active !== inputRef.current &&\n active !== document.body\n ) {\n previouslyFocusedElementRef.current = active;\n }\n if (isCollapsed) {\n hasExpandedWhileZoneVisibleRef.current = true;\n setIsCollapsed(false);\n window.requestAnimationFrame(() => {\n inputRef.current?.focus();\n });\n } else {\n inputRef.current?.focus();\n }\n }, [isCollapsed]);\n\n const blurInput = useCallback(() => {\n inputRef.current?.blur();\n }, []);\n\n useImperativeHandle(ref, () => ({ focusInput, blurInput }), [\n focusInput,\n blurInput,\n ]);\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n const prev = previouslyFocusedElementRef.current;\n previouslyFocusedElementRef.current = null;\n inputRef.current?.blur();\n prev?.focus?.();\n return;\n }\n if (\n e.key === 'Enter' &&\n !e.shiftKey &&\n (inputValue.trim() || canSubmitEmpty)\n ) {\n e.preventDefault();\n handleSubmit();\n }\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInputValue(e.target.value);\n };\n\n const handleInputFocus = (e: React.FocusEvent<HTMLTextAreaElement>) => {\n setIsFocused(true);\n if (\n e.relatedTarget instanceof HTMLElement &&\n e.relatedTarget !== inputRef.current\n ) {\n previouslyFocusedElementRef.current = e.relatedTarget;\n }\n };\n\n const handleContentFocus = () => {\n setHasFocusInside(true);\n };\n\n const handleContentBlur = (e: React.FocusEvent<HTMLDivElement>) => {\n const next = e.relatedTarget as Node | null;\n if (!next || !e.currentTarget.contains(next)) {\n setHasFocusInside(false);\n }\n };\n\n if (progressMessage) {\n return (\n <div\n className={cn('web5-prompt-progress', className)}\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n <div className=\"web5-prompt-progress__indicator\" aria-hidden=\"true\">\n <ArrowDownIcon />\n </div>\n <div className=\"web5-prompt-progress__message\">{progressMessage}</div>\n </div>\n );\n }\n\n const canSubmit = inputValue.trim().length > 0 || canSubmitEmpty;\n const chipsMarkup =\n chips.length > 0 ? (\n <div\n className={cn(\n 'web5-prompt-shell__chips',\n chipPosition === 'bottom'\n ? 'web5-prompt-shell__chips--bottom'\n : 'web5-prompt-shell__chips--top',\n showChips\n ? 'web5-prompt-shell__chips--visible'\n : 'web5-prompt-shell__chips--hidden',\n )}\n aria-hidden={isCollapsed || !showChips}\n >\n {chips.map((chip) => (\n <a\n key={chip.label}\n href={isWeb5Url(chip.href) ? '#' : chip.href}\n onMouseDown={(e) => e.preventDefault()}\n onClick={(e) => {\n e.preventDefault();\n onChipClick?.(e, chip.href);\n setInputValue('');\n inputRef.current?.blur();\n }}\n tabIndex={!isCollapsed && showChips ? 0 : -1}\n // `has-custom-focus` opts out of Wix Thunderbolt's global keyboard focus ring\n // so our inset :focus-visible ring isn't overwritten when embedded in a Wix site.\n className=\"web5-prompt-chip has-custom-focus\"\n >\n {chip.label}\n <PromptSendIcon\n aria-hidden=\"true\"\n className=\"web5-prompt-send-icon\"\n />\n </a>\n ))}\n </div>\n ) : null;\n\n const handleExpandClick = () => {\n focusInput();\n };\n\n\n return (\n <div\n className={cn(\n 'web5-prompt-shell',\n isCollapsed && 'web5-prompt-shell--collapsed',\n // Widens the pill while the field or a chip holds focus. Driven by\n // `hasFocusInside` rather than `isFocused` so clicking a chip (which\n // preventDefaults its mousedown) doesn't collapse the width mid-click.\n hasFocusInside && !isCollapsed && 'web5-prompt-shell--focused',\n className,\n )}\n >\n <div className=\"web5-prompt-shell__stage\">\n <button\n type=\"button\"\n className=\"web5-prompt-shell__collapsed-button has-custom-focus\"\n onClick={handleExpandClick}\n aria-label={effectiveCollapsedLabel}\n aria-hidden={!isCollapsed}\n tabIndex={isCollapsed ? 0 : -1}\n >\n {effectiveCollapsedLabel}\n </button>\n\n <div\n className=\"web5-prompt-shell__content\"\n aria-hidden={isCollapsed}\n onFocus={handleContentFocus}\n onBlur={handleContentBlur}\n >\n {contextBanner}\n <div className=\"web5-prompt-shell__panel\">\n <div\n className={cn(\n 'web5-prompt-shell__stack',\n chipPosition === 'top' && 'web5-prompt-shell__stack--chips-top',\n )}\n >\n <div className=\"web5-prompt-search\" role=\"search\">\n <div className=\"web5-prompt-search__inner\">\n <div\n className={cn(\n 'web5-prompt-field',\n isFocused && 'web5-prompt-field--focused',\n isMultiline && 'web5-prompt-field--multiline',\n )}\n >\n <textarea\n ref={inputRef}\n rows={1}\n value={inputValue}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n onFocus={handleInputFocus}\n onBlur={() => setIsFocused(false)}\n placeholder={placeholder}\n aria-label=\"Search or ask a question\"\n aria-keyshortcuts=\"/ Control+K\"\n className=\"web5-prompt-input has-custom-focus placeholder:text-search-input-hint\"\n tabIndex={isCollapsed ? -1 : undefined}\n />\n\n <div className=\"web5-prompt-actions\">\n {onVoiceInput && (\n <button\n type=\"button\"\n onClick={onVoiceInput}\n className=\"web5-prompt-voice\"\n aria-label=\"Voice input\"\n tabIndex={isCollapsed ? -1 : undefined}\n >\n <MicrophoneIcon />\n </button>\n )}\n <button\n type=\"button\"\n onClick={handleSubmit}\n className={cn(\n 'web5-prompt-submit',\n submitLabel && 'web5-prompt-submit--labeled',\n canSubmit && 'web5-prompt-submit--active',\n )}\n aria-label={submitLabel ?? 'Submit'}\n disabled={!canSubmit || isCollapsed}\n tabIndex={isCollapsed ? -1 : undefined}\n >\n {submitLabel ? (\n <>\n <span className=\"web5-prompt-submit__label\">\n {submitLabel}\n </span>\n <ArrowRightIcon\n aria-hidden=\"true\"\n className=\"web5-prompt-send-icon\"\n />\n </>\n ) : (\n <PromptSendIcon\n aria-hidden=\"true\"\n className=\"web5-prompt-send-icon\"\n />\n )}\n </button>\n </div>\n </div>\n </div>\n </div>\n\n {chipsMarkup}\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n});\n"],"mappings":";AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,QAAQ,EACRC,MAAM,EACNC,WAAW,EACXC,eAAe,QACV,OAAO;AACd,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,wBAAwB;AAuClD,MAAMC,aAAuB,GAAGA,CAAA,kBAC9BV,KAAA,CAAAW,aAAA;EACEC,KAAK,EAAC,4BAA4B;EAClCC,KAAK,EAAC,IAAI;EACVC,MAAM,EAAC,IAAI;EACXC,OAAO,EAAC,WAAW;EACnBC,IAAI,EAAC,MAAM;EACXC,MAAM,EAAC,cAAc;EACrBC,WAAW,EAAC,GAAG;EACfC,aAAa,EAAC,OAAO;EACrBC,cAAc,EAAC,OAAO;EACtB,eAAY;AAAM,gBAElBpB,KAAA,CAAAW,aAAA;EAAMU,CAAC,EAAC;AAAU,CAAE,CAAC,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AW,aAAA,CAACc,cAAc;IACb,eAAY,MAAM;IAClBe,SAAS,EAAC;EAAuB,CAClC,CACD,CAAC,gBAEHxC,KAAA,CAAAW,aAAA,CAACe,cAAc;IACb,eAAY,MAAM;IAClBc,SAAS,EAAC;EAAuB,CAClC,CAEG,CACL,CACF,CACF,CACF,CAAC,EAEL6E,WACE,CACF,CACF,CACF,CACF,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
|
@@ -70,3 +70,109 @@
|
|
|
70
70
|
.web5-user-query__product-back:hover .web5-user-query__product-back-title {
|
|
71
71
|
text-decoration: underline;
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* Keyboard hint — "Press / to search", beside the Share action.
|
|
76
|
+
*
|
|
77
|
+
* It lived inside the prompt field until it was moved here: there it competed
|
|
78
|
+
* with the placeholder for the same space and vanished the moment the reader
|
|
79
|
+
* focused the input, so the shortcut was only ever shown to someone not using
|
|
80
|
+
* it. Its colour still comes from the prompt-input token family, which keeps
|
|
81
|
+
* it in step with the input it describes and themeable by the same knob.
|
|
82
|
+
*/
|
|
83
|
+
.web5-prompt-hint {
|
|
84
|
+
display: inline-flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
gap: 4px;
|
|
87
|
+
color: var(--pi-field-placeholder);
|
|
88
|
+
font-family: var(--pi-field-font-family);
|
|
89
|
+
font-size: 12px;
|
|
90
|
+
line-height: 1;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
pointer-events: none;
|
|
93
|
+
user-select: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.web5-prompt-hint__key {
|
|
97
|
+
display: inline-flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
justify-content: center;
|
|
100
|
+
min-width: 16px;
|
|
101
|
+
padding: 1px 4px;
|
|
102
|
+
border: 1px solid var(--pi-field-placeholder);
|
|
103
|
+
border-radius: 3px;
|
|
104
|
+
background: transparent;
|
|
105
|
+
font-family: inherit;
|
|
106
|
+
font-size: 11px;
|
|
107
|
+
line-height: 1;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* No physical keyboard, no shortcut worth advertising. */
|
|
111
|
+
@media (pointer: coarse) {
|
|
112
|
+
.web5-prompt-hint {
|
|
113
|
+
display: none;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Mobile: the header is tight and there is no keyboard anyway. */
|
|
118
|
+
@media (max-width: 768px) {
|
|
119
|
+
.web5-prompt-hint {
|
|
120
|
+
display: none;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/*
|
|
125
|
+
* Action tooltips — "Share this", "New conversation".
|
|
126
|
+
*
|
|
127
|
+
* Brand-coloured via the theme tokens rather than the header's own greys, so a
|
|
128
|
+
* client that rebrands gets tooltips that match. `--primary` is the brand
|
|
129
|
+
* accent every client already sets; the copied-state toast beside this
|
|
130
|
+
* deliberately keeps its own near-black, because that one is a status message
|
|
131
|
+
* rather than a label and should not read as an action.
|
|
132
|
+
*
|
|
133
|
+
* Hover and focus-visible both, so a keyboard user gets the same affordance —
|
|
134
|
+
* the buttons are icon-only below the `sm` breakpoint, where the label is the
|
|
135
|
+
* only thing naming them.
|
|
136
|
+
*/
|
|
137
|
+
.web5-user-query__tooltip {
|
|
138
|
+
position: absolute;
|
|
139
|
+
top: calc(100% + 6px);
|
|
140
|
+
right: 0;
|
|
141
|
+
z-index: 20;
|
|
142
|
+
padding: 5px 10px;
|
|
143
|
+
border-radius: 6px;
|
|
144
|
+
background: hsl(var(--primary, 262 83% 58%));
|
|
145
|
+
color: hsl(var(--primary-foreground, 0 0% 100%));
|
|
146
|
+
font-size: 12px;
|
|
147
|
+
line-height: 1.4;
|
|
148
|
+
white-space: nowrap;
|
|
149
|
+
pointer-events: none;
|
|
150
|
+
opacity: 0;
|
|
151
|
+
transform: translateY(-2px);
|
|
152
|
+
transition:
|
|
153
|
+
opacity 120ms ease-out,
|
|
154
|
+
transform 120ms ease-out;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.web5-user-query__action:hover .web5-user-query__tooltip,
|
|
158
|
+
.web5-user-query__action:focus-within .web5-user-query__tooltip {
|
|
159
|
+
opacity: 1;
|
|
160
|
+
transform: translateY(0);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/*
|
|
164
|
+
* Touch has no hover, so a tooltip there is either permanently invisible or
|
|
165
|
+
* permanently in the way. The buttons carry `aria-label`, which is what
|
|
166
|
+
* actually names them for anyone who needs it.
|
|
167
|
+
*/
|
|
168
|
+
@media (pointer: coarse) {
|
|
169
|
+
.web5-user-query__tooltip {
|
|
170
|
+
display: none;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@media (prefers-reduced-motion: reduce) {
|
|
175
|
+
.web5-user-query__tooltip {
|
|
176
|
+
transition: none;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -181,24 +181,39 @@ export const UserQuery = _ref => {
|
|
|
181
181
|
className: "w-6 h-6 flex items-center justify-center text-text-body hover:text-black transition-colors bg-transparent border-0 cursor-pointer disabled:opacity-30 disabled:cursor-default"
|
|
182
182
|
}, /*#__PURE__*/React.createElement(RedoIcon, null)))), /*#__PURE__*/React.createElement("div", {
|
|
183
183
|
className: "flex items-center gap-[10px] ml-[10px] sm:ml-0 shrink-0"
|
|
184
|
-
}, /*#__PURE__*/React.createElement("
|
|
185
|
-
className: "
|
|
184
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
185
|
+
className: "web5-prompt-hint",
|
|
186
|
+
"aria-hidden": "true"
|
|
187
|
+
}, "Press ", /*#__PURE__*/React.createElement("kbd", {
|
|
188
|
+
className: "web5-prompt-hint__key"
|
|
189
|
+
}, "/"), " to search"), /*#__PURE__*/React.createElement("div", {
|
|
190
|
+
className: "web5-user-query__action group relative"
|
|
186
191
|
}, /*#__PURE__*/React.createElement("button", {
|
|
187
192
|
type: "button",
|
|
193
|
+
"aria-label": "Share this",
|
|
188
194
|
onClick: handleShare,
|
|
189
195
|
disabled: isLoading || isCopied,
|
|
190
196
|
className: `web5-user-query__share flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 border-0 cursor-pointer transition-colors disabled:cursor-default
|
|
191
197
|
${isCopied ? 'is-copied bg-[#2b2b2b] text-white' : 'text-text-body bg-white hover:bg-gray-50'}`
|
|
192
198
|
}, isCopied ? /*#__PURE__*/React.createElement(CheckIcon, null) : /*#__PURE__*/React.createElement(ShareIcon, null), /*#__PURE__*/React.createElement("span", {
|
|
193
199
|
className: "hidden sm:inline"
|
|
194
|
-
}, isLoading ? 'Sharing…' : isCopied ? copiedLabel : 'Share')), isCopied && /*#__PURE__*/React.createElement("
|
|
200
|
+
}, isLoading ? 'Sharing…' : isCopied ? copiedLabel : 'Share')), !isCopied && /*#__PURE__*/React.createElement("span", {
|
|
201
|
+
className: "web5-user-query__tooltip",
|
|
202
|
+
role: "tooltip"
|
|
203
|
+
}, "Share this"), isCopied && /*#__PURE__*/React.createElement("div", {
|
|
195
204
|
className: "web5-user-query__copied-toast sm:hidden absolute top-full right-0 mt-1 flex items-center gap-2 bg-[#2b2b2b] text-white text-[12px] leading-none px-3 py-2 rounded-[8px] whitespace-nowrap"
|
|
196
|
-
}, /*#__PURE__*/React.createElement(CheckIcon, null), copiedLabel)), onNewConversation && /*#__PURE__*/React.createElement("
|
|
205
|
+
}, /*#__PURE__*/React.createElement(CheckIcon, null), copiedLabel)), onNewConversation && /*#__PURE__*/React.createElement("div", {
|
|
206
|
+
className: "web5-user-query__action group relative"
|
|
207
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
197
208
|
type: "button",
|
|
209
|
+
"aria-label": newConversationLabel,
|
|
198
210
|
onClick: handleNewConversation,
|
|
199
211
|
className: "web5-user-query__new-conversation flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 text-text-body bg-white border-0 cursor-pointer hover:bg-gray-50 transition-colors"
|
|
200
212
|
}, /*#__PURE__*/React.createElement(PlusIcon, null), /*#__PURE__*/React.createElement("span", {
|
|
201
213
|
className: "hidden sm:inline"
|
|
214
|
+
}, newConversationLabel)), /*#__PURE__*/React.createElement("span", {
|
|
215
|
+
className: "web5-user-query__tooltip",
|
|
216
|
+
role: "tooltip"
|
|
202
217
|
}, newConversationLabel)), onToggleCommentMode && /*#__PURE__*/React.createElement("button", {
|
|
203
218
|
type: "button",
|
|
204
219
|
onClick: onToggleCommentMode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useMemo","useState","ShareIcon","CheckIcon","PlusIcon","UndoIcon","RedoIcon","CommentIcon","getForwardStack","pushToForwardStack","popFromForwardStack","clearForwardStack","DEFAULT_LOADING_MESSAGES","headerClassName","UserQuery","_ref","query","onNewConversation","onNavigateToTriggerId","predecessorTriggerId","currentTriggerId","onShare","onToggleCommentMode","commentMode","commentCount","loading","newConversationLabel","copiedLabel","copiedDurationMs","productBackContext","onBackToProduct","forwardStack","canGoForward","length","canGoBack","hasNavigation","handleBack","handleForward","nextTid","handleNewConversation","shareState","setShareState","productImageError","setProductImageError","imageUrl","handleShare","urlToCopy","window","location","href","err","console","warn","navigator","clipboard","writeText","catch","setTimeout","cyclingMessages","messages","cycledMessage","setCycledMessage","progressMessage","index","interval","setInterval","clearInterval","isCopied","isLoading","productBadge","title","backUrl","label","canNavigateBack","content","createElement","Fragment","className","src","alt","onError","type","onClick","progressText","role","pendingQuery","disabled"],"sources":["../../../../src/components/ui/UserQuery.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useMemo, useState } from 'react';\nimport { ShareIcon } from './icons/ShareIcon';\nimport { CheckIcon } from './icons/CheckIcon';\nimport { PlusIcon } from './icons/PlusIcon';\nimport { UndoIcon } from './icons/UndoIcon';\nimport { RedoIcon } from './icons/RedoIcon';\nimport { CommentIcon } from './icons/CommentIcon';\nimport {\n getForwardStack,\n pushToForwardStack,\n popFromForwardStack,\n clearForwardStack,\n} from '../../utils/navigationStack';\n\ntype ShareState = 'idle' | 'loading' | 'copied';\n\nconst DEFAULT_LOADING_MESSAGES = [\n 'Thinking…',\n 'Recognizing intent…',\n 'Connecting the dots…',\n 'Synthesizing insights…',\n 'Formulating a response…',\n];\n\nconst headerClassName =\n 'web5-user-query sticky top-0 z-10 flex items-center justify-between bg-white/60 backdrop-blur-sm pl-5 pr-[10px] py-[7px] sm:px-[30px] sm:py-[17px]';\n\nexport interface UserQueryLoadingState {\n pendingQuery: string;\n /** Static progress message. If omitted, falls back to cycling through `messages`. */\n progressMessage?: string;\n /** Messages cycled while loading when `progressMessage` is not set. */\n messages?: string[];\n}\n\n/**\n * Product the visitor was redirected from (DL #114). Rendered as a back badge\n * above the query: back arrow + thumbnail + product name. All fields are\n * resolved and validated app-side (allowed-domain `backUrl`, `https:`\n * `imageUrl`) before reaching this presentational component.\n */\nexport interface ProductBackContext {\n /** Product display name. Required — without it the badge does not render. */\n title: string;\n /** Validated product thumbnail URL. Omitted/failed to load → arrow + title only. */\n imageUrl?: string;\n /** Validated product-page URL to return to. Omitted → badge is non-clickable. */\n backUrl?: string;\n /** Accessible label override. Defaults to `Back to ${title}`. */\n label?: string;\n}\n\nexport interface UserQueryProps {\n query: string;\n onNewConversation?: () => void;\n onNavigateToTriggerId?: (triggerId: string) => void;\n predecessorTriggerId?: string;\n currentTriggerId?: string;\n onShare?: (triggerId: string) => Promise<string>;\n /** Optional comment-mode toggle. When provided, render the chat-bubble\n * toggle button next to Share. The button reflects `commentMode` via\n * `is-on` styling and `aria-pressed`. */\n onToggleCommentMode?: () => void;\n commentMode?: boolean;\n /** Total number of comments on this response — shown as a badge next to the\n * toggle when > 0. */\n commentCount?: number;\n loading?: UserQueryLoadingState;\n /** Label for the \"new conversation\" action. Defaults to \"New conversation\". */\n newConversationLabel?: string;\n /** Label shown after the share link is copied. Defaults to \"Link Copied\". */\n copiedLabel?: string;\n /** How long the copied state stays visible, in ms. Defaults to 2000. */\n copiedDurationMs?: number;\n /** When set (visitor arrived from a product page), render a back-to-product\n * badge above the query (DL #114). */\n productBackContext?: ProductBackContext;\n /** Invoked with the validated `backUrl` when the badge is activated. */\n onBackToProduct?: (backUrl: string) => void;\n}\n\nexport const UserQuery: FC<UserQueryProps> = ({\n query,\n onNewConversation,\n onNavigateToTriggerId,\n predecessorTriggerId,\n currentTriggerId,\n onShare,\n onToggleCommentMode,\n commentMode = false,\n commentCount = 0,\n loading,\n newConversationLabel = 'New conversation',\n copiedLabel = 'Link Copied',\n copiedDurationMs = 2000,\n productBackContext,\n onBackToProduct,\n}) => {\n const forwardStack = useMemo(() => getForwardStack(), [currentTriggerId]);\n const canGoForward = forwardStack.length > 0;\n const canGoBack = !!predecessorTriggerId;\n const hasNavigation = canGoBack || canGoForward;\n\n const handleBack = useCallback(() => {\n if (!predecessorTriggerId || !currentTriggerId || !onNavigateToTriggerId) {\n return;\n }\n pushToForwardStack(currentTriggerId);\n onNavigateToTriggerId(predecessorTriggerId);\n }, [predecessorTriggerId, currentTriggerId, onNavigateToTriggerId]);\n\n const handleForward = useCallback(() => {\n if (!onNavigateToTriggerId) {\n return;\n }\n const nextTid = popFromForwardStack();\n if (!nextTid) {\n return;\n }\n onNavigateToTriggerId(nextTid);\n }, [onNavigateToTriggerId]);\n\n const handleNewConversation = useCallback(() => {\n clearForwardStack();\n onNewConversation?.();\n }, [onNewConversation]);\n\n const [shareState, setShareState] = useState<ShareState>('idle');\n\n const [productImageError, setProductImageError] = useState(false);\n useEffect(() => {\n setProductImageError(false);\n }, [productBackContext?.imageUrl]);\n\n const handleShare = useCallback(async () => {\n if (shareState !== 'idle') {\n return;\n }\n setShareState('loading');\n let urlToCopy = window.location.href;\n try {\n if (onShare && currentTriggerId) {\n urlToCopy = await onShare(currentTriggerId);\n }\n } catch (err) {\n console.warn('[share] failed, falling back to current URL:', err);\n }\n navigator.clipboard\n .writeText(urlToCopy)\n .catch((err) => console.warn('[share] clipboard write failed:', err));\n setShareState('copied');\n setTimeout(() => setShareState('idle'), copiedDurationMs);\n }, [shareState, onShare, currentTriggerId, copiedDurationMs]);\n\n const cyclingMessages = useMemo(\n () =>\n loading?.messages && loading.messages.length > 0\n ? loading.messages\n : DEFAULT_LOADING_MESSAGES,\n [loading?.messages],\n );\n const [cycledMessage, setCycledMessage] = useState(cyclingMessages[0]);\n\n useEffect(() => {\n if (!loading || loading.progressMessage) {\n return;\n }\n setCycledMessage(cyclingMessages[0]);\n if (cyclingMessages.length <= 1) {\n return;\n }\n let index = 0;\n const interval = setInterval(() => {\n index = (index + 1) % cyclingMessages.length;\n setCycledMessage(cyclingMessages[index]);\n }, 4000);\n return () => clearInterval(interval);\n }, [loading, cyclingMessages]);\n\n if (!query && !loading) {\n return null;\n }\n\n const isCopied = shareState === 'copied';\n const isLoading = shareState === 'loading';\n\n const productBadge = productBackContext\n ? (() => {\n const { title, imageUrl, backUrl, label } = productBackContext;\n const canNavigateBack = !!backUrl && !!onBackToProduct;\n const content = (\n <>\n <UndoIcon className=\"web5-user-query__product-back-icon\" />\n {imageUrl && !productImageError && (\n <span className=\"web5-user-query__product-back-thumb\">\n <img\n src={imageUrl}\n alt=\"\"\n onError={() => setProductImageError(true)}\n />\n </span>\n )}\n <span className=\"web5-user-query__product-back-title\">{title}</span>\n </>\n );\n return canNavigateBack ? (\n <button\n type=\"button\"\n onClick={() => onBackToProduct?.(backUrl!)}\n aria-label={label ?? `Back to ${title}`}\n className=\"web5-user-query__product-back\"\n >\n {content}\n </button>\n ) : (\n <div className=\"web5-user-query__product-back web5-user-query__product-back--static\">\n {content}\n </div>\n );\n })()\n : null;\n\n if (loading) {\n const progressText = loading.progressMessage ?? cycledMessage;\n return (\n <div\n className={headerClassName}\n role=\"status\"\n aria-busy=\"true\"\n aria-live=\"polite\"\n >\n <div className=\"web5-user-query__left flex-1\">\n {productBadge}\n <p\n className=\"text-[14px] leading-5 text-text-body truncate min-w-0 max-w-[700px]\"\n title={`Asking: ${loading.pendingQuery}`}\n >\n <span className=\"text-text-body/70\">Asking: </span>\n {loading.pendingQuery}\n </p>\n </div>\n {progressText && (\n <div className=\"hidden sm:flex items-center gap-2 ml-[10px] shrink-0 min-w-0\">\n <div\n className=\"w-4 h-4 shrink-0 animate-spin inline-block border-[2px] border-current border-t-transparent text-blue-600 dark:text-blue-500 rounded-full\"\n aria-hidden=\"true\"\n />\n <p className=\"text-[13px] leading-5 text-text-body/70 truncate max-w-[240px]\">\n {progressText}\n </p>\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div className={headerClassName}>\n <div className=\"flex items-center gap-[30px] flex-1 min-w-0\">\n <div className=\"web5-user-query__left\">\n {productBadge}\n <p\n className=\"web5-user-query__title text-[14px] leading-5 text-text-body truncate min-w-0 max-w-[700px]\"\n title={query}\n >\n {query}\n </p>\n </div>\n {hasNavigation && (\n <div className=\"flex items-center gap-[9px]\">\n <button\n type=\"button\"\n onClick={handleBack}\n disabled={!canGoBack}\n title=\"Go to previous conversation\"\n aria-label=\"Go to previous conversation\"\n className=\"w-6 h-6 flex items-center justify-center text-text-body hover:text-black transition-colors bg-transparent border-0 cursor-pointer disabled:opacity-30 disabled:cursor-default\"\n >\n <UndoIcon />\n </button>\n <button\n type=\"button\"\n onClick={handleForward}\n disabled={!canGoForward}\n title=\"Go to next conversation\"\n aria-label=\"Go to next conversation\"\n className=\"w-6 h-6 flex items-center justify-center text-text-body hover:text-black transition-colors bg-transparent border-0 cursor-pointer disabled:opacity-30 disabled:cursor-default\"\n >\n <RedoIcon />\n </button>\n </div>\n )}\n </div>\n <div className=\"flex items-center gap-[10px] ml-[10px] sm:ml-0 shrink-0\">\n {/* Share button — wraps button + mobile tooltip in a relative container */}\n <div className=\"relative\">\n <button\n type=\"button\"\n onClick={handleShare}\n disabled={isLoading || isCopied}\n className={`web5-user-query__share flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 border-0 cursor-pointer transition-colors disabled:cursor-default\n ${\n isCopied\n ? 'is-copied bg-[#2b2b2b] text-white'\n : 'text-text-body bg-white hover:bg-gray-50'\n }`}\n >\n {isCopied ? <CheckIcon /> : <ShareIcon />}\n <span className=\"hidden sm:inline\">\n {isLoading ? 'Sharing…' : isCopied ? copiedLabel : 'Share'}\n </span>\n </button>\n {/* Mobile-only tooltip: drops below the button when link is copied */}\n {isCopied && (\n <div className=\"web5-user-query__copied-toast sm:hidden absolute top-full right-0 mt-1 flex items-center gap-2 bg-[#2b2b2b] text-white text-[12px] leading-none px-3 py-2 rounded-[8px] whitespace-nowrap\">\n <CheckIcon />\n {copiedLabel}\n </div>\n )}\n </div>\n {onNewConversation && (\n <button\n type=\"button\"\n onClick={handleNewConversation}\n className=\"web5-user-query__new-conversation flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 text-text-body bg-white border-0 cursor-pointer hover:bg-gray-50 transition-colors\"\n >\n <PlusIcon />\n <span className=\"hidden sm:inline\">{newConversationLabel}</span>\n </button>\n )}\n {onToggleCommentMode && (\n <button\n type=\"button\"\n onClick={onToggleCommentMode}\n aria-pressed={commentMode}\n title=\"Add a comment\"\n aria-label=\"Add a comment\"\n className={`relative flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 border-0 cursor-pointer transition-colors ${\n commentMode\n ? 'bg-[#2b2b2b] text-white'\n : 'text-text-body bg-white hover:bg-gray-50'\n }`}\n >\n <CommentIcon />\n {commentCount > 0 && (\n <span\n className={`absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 rounded-full text-[10px] leading-[18px] text-center font-semibold ${\n commentMode ? 'bg-white text-[#2b2b2b]' : 'bg-[#2b2b2b] text-white'\n }`}\n >\n {commentCount}\n </span>\n )}\n </button>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC5E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;IAC/BsC,SAAS,EAAC;EAAoN,gBAE9NhF,KAAA,CAAA8E,aAAA,CAACvE,QAAQ,MAAE,CAAC,eACZP,KAAA,CAAA8E,aAAA;IAAME,SAAS,EAAC;EAAkB,GAAEnD,oBAA2B,CACzD,CACT,EACAJ,mBAAmB,iBAClBzB,KAAA,CAAA8E,aAAA;IACEM,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAE5D,mBAAoB;IAC7B,gBAAcC,WAAY;IAC1B+C,KAAK,EAAC,eAAe;IACrB,cAAW,eAAe;IAC1BO,SAAS,EAAE,oJACTtD,WAAW,GACP,yBAAyB,GACzB,0CAA0C;EAC7C,gBAEH1B,KAAA,CAAA8E,aAAA,CAACpE,WAAW,MAAE,CAAC,EACdiB,YAAY,GAAG,CAAC,iBACf3B,KAAA,CAAA8E,aAAA;IACEE,SAAS,EAAE,yHACTtD,WAAW,GAAG,yBAAyB,GAAG,yBAAyB;EAClE,GAEFC,YACG,CAEF,CAEP,CACF,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useMemo","useState","ShareIcon","CheckIcon","PlusIcon","UndoIcon","RedoIcon","CommentIcon","getForwardStack","pushToForwardStack","popFromForwardStack","clearForwardStack","DEFAULT_LOADING_MESSAGES","headerClassName","UserQuery","_ref","query","onNewConversation","onNavigateToTriggerId","predecessorTriggerId","currentTriggerId","onShare","onToggleCommentMode","commentMode","commentCount","loading","newConversationLabel","copiedLabel","copiedDurationMs","productBackContext","onBackToProduct","forwardStack","canGoForward","length","canGoBack","hasNavigation","handleBack","handleForward","nextTid","handleNewConversation","shareState","setShareState","productImageError","setProductImageError","imageUrl","handleShare","urlToCopy","window","location","href","err","console","warn","navigator","clipboard","writeText","catch","setTimeout","cyclingMessages","messages","cycledMessage","setCycledMessage","progressMessage","index","interval","setInterval","clearInterval","isCopied","isLoading","productBadge","title","backUrl","label","canNavigateBack","content","createElement","Fragment","className","src","alt","onError","type","onClick","progressText","role","pendingQuery","disabled"],"sources":["../../../../src/components/ui/UserQuery.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useMemo, useState } from 'react';\nimport { ShareIcon } from './icons/ShareIcon';\nimport { CheckIcon } from './icons/CheckIcon';\nimport { PlusIcon } from './icons/PlusIcon';\nimport { UndoIcon } from './icons/UndoIcon';\nimport { RedoIcon } from './icons/RedoIcon';\nimport { CommentIcon } from './icons/CommentIcon';\nimport {\n getForwardStack,\n pushToForwardStack,\n popFromForwardStack,\n clearForwardStack,\n} from '../../utils/navigationStack';\n\ntype ShareState = 'idle' | 'loading' | 'copied';\n\nconst DEFAULT_LOADING_MESSAGES = [\n 'Thinking…',\n 'Recognizing intent…',\n 'Connecting the dots…',\n 'Synthesizing insights…',\n 'Formulating a response…',\n];\n\nconst headerClassName =\n 'web5-user-query sticky top-0 z-10 flex items-center justify-between bg-white/60 backdrop-blur-sm pl-5 pr-[10px] py-[7px] sm:px-[30px] sm:py-[17px]';\n\nexport interface UserQueryLoadingState {\n pendingQuery: string;\n /** Static progress message. If omitted, falls back to cycling through `messages`. */\n progressMessage?: string;\n /** Messages cycled while loading when `progressMessage` is not set. */\n messages?: string[];\n}\n\n/**\n * Product the visitor was redirected from (DL #114). Rendered as a back badge\n * above the query: back arrow + thumbnail + product name. All fields are\n * resolved and validated app-side (allowed-domain `backUrl`, `https:`\n * `imageUrl`) before reaching this presentational component.\n */\nexport interface ProductBackContext {\n /** Product display name. Required — without it the badge does not render. */\n title: string;\n /** Validated product thumbnail URL. Omitted/failed to load → arrow + title only. */\n imageUrl?: string;\n /** Validated product-page URL to return to. Omitted → badge is non-clickable. */\n backUrl?: string;\n /** Accessible label override. Defaults to `Back to ${title}`. */\n label?: string;\n}\n\nexport interface UserQueryProps {\n query: string;\n onNewConversation?: () => void;\n onNavigateToTriggerId?: (triggerId: string) => void;\n predecessorTriggerId?: string;\n currentTriggerId?: string;\n onShare?: (triggerId: string) => Promise<string>;\n /** Optional comment-mode toggle. When provided, render the chat-bubble\n * toggle button next to Share. The button reflects `commentMode` via\n * `is-on` styling and `aria-pressed`. */\n onToggleCommentMode?: () => void;\n commentMode?: boolean;\n /** Total number of comments on this response — shown as a badge next to the\n * toggle when > 0. */\n commentCount?: number;\n loading?: UserQueryLoadingState;\n /** Label for the \"new conversation\" action. Defaults to \"New conversation\". */\n newConversationLabel?: string;\n /** Label shown after the share link is copied. Defaults to \"Link Copied\". */\n copiedLabel?: string;\n /** How long the copied state stays visible, in ms. Defaults to 2000. */\n copiedDurationMs?: number;\n /** When set (visitor arrived from a product page), render a back-to-product\n * badge above the query (DL #114). */\n productBackContext?: ProductBackContext;\n /** Invoked with the validated `backUrl` when the badge is activated. */\n onBackToProduct?: (backUrl: string) => void;\n}\n\nexport const UserQuery: FC<UserQueryProps> = ({\n query,\n onNewConversation,\n onNavigateToTriggerId,\n predecessorTriggerId,\n currentTriggerId,\n onShare,\n onToggleCommentMode,\n commentMode = false,\n commentCount = 0,\n loading,\n newConversationLabel = 'New conversation',\n copiedLabel = 'Link Copied',\n copiedDurationMs = 2000,\n productBackContext,\n onBackToProduct,\n}) => {\n const forwardStack = useMemo(() => getForwardStack(), [currentTriggerId]);\n const canGoForward = forwardStack.length > 0;\n const canGoBack = !!predecessorTriggerId;\n const hasNavigation = canGoBack || canGoForward;\n\n const handleBack = useCallback(() => {\n if (!predecessorTriggerId || !currentTriggerId || !onNavigateToTriggerId) {\n return;\n }\n pushToForwardStack(currentTriggerId);\n onNavigateToTriggerId(predecessorTriggerId);\n }, [predecessorTriggerId, currentTriggerId, onNavigateToTriggerId]);\n\n const handleForward = useCallback(() => {\n if (!onNavigateToTriggerId) {\n return;\n }\n const nextTid = popFromForwardStack();\n if (!nextTid) {\n return;\n }\n onNavigateToTriggerId(nextTid);\n }, [onNavigateToTriggerId]);\n\n const handleNewConversation = useCallback(() => {\n clearForwardStack();\n onNewConversation?.();\n }, [onNewConversation]);\n\n const [shareState, setShareState] = useState<ShareState>('idle');\n\n const [productImageError, setProductImageError] = useState(false);\n useEffect(() => {\n setProductImageError(false);\n }, [productBackContext?.imageUrl]);\n\n const handleShare = useCallback(async () => {\n if (shareState !== 'idle') {\n return;\n }\n setShareState('loading');\n let urlToCopy = window.location.href;\n try {\n if (onShare && currentTriggerId) {\n urlToCopy = await onShare(currentTriggerId);\n }\n } catch (err) {\n console.warn('[share] failed, falling back to current URL:', err);\n }\n navigator.clipboard\n .writeText(urlToCopy)\n .catch((err) => console.warn('[share] clipboard write failed:', err));\n setShareState('copied');\n setTimeout(() => setShareState('idle'), copiedDurationMs);\n }, [shareState, onShare, currentTriggerId, copiedDurationMs]);\n\n const cyclingMessages = useMemo(\n () =>\n loading?.messages && loading.messages.length > 0\n ? loading.messages\n : DEFAULT_LOADING_MESSAGES,\n [loading?.messages],\n );\n const [cycledMessage, setCycledMessage] = useState(cyclingMessages[0]);\n\n useEffect(() => {\n if (!loading || loading.progressMessage) {\n return;\n }\n setCycledMessage(cyclingMessages[0]);\n if (cyclingMessages.length <= 1) {\n return;\n }\n let index = 0;\n const interval = setInterval(() => {\n index = (index + 1) % cyclingMessages.length;\n setCycledMessage(cyclingMessages[index]);\n }, 4000);\n return () => clearInterval(interval);\n }, [loading, cyclingMessages]);\n\n if (!query && !loading) {\n return null;\n }\n\n const isCopied = shareState === 'copied';\n const isLoading = shareState === 'loading';\n\n const productBadge = productBackContext\n ? (() => {\n const { title, imageUrl, backUrl, label } = productBackContext;\n const canNavigateBack = !!backUrl && !!onBackToProduct;\n const content = (\n <>\n <UndoIcon className=\"web5-user-query__product-back-icon\" />\n {imageUrl && !productImageError && (\n <span className=\"web5-user-query__product-back-thumb\">\n <img\n src={imageUrl}\n alt=\"\"\n onError={() => setProductImageError(true)}\n />\n </span>\n )}\n <span className=\"web5-user-query__product-back-title\">{title}</span>\n </>\n );\n return canNavigateBack ? (\n <button\n type=\"button\"\n onClick={() => onBackToProduct?.(backUrl!)}\n aria-label={label ?? `Back to ${title}`}\n className=\"web5-user-query__product-back\"\n >\n {content}\n </button>\n ) : (\n <div className=\"web5-user-query__product-back web5-user-query__product-back--static\">\n {content}\n </div>\n );\n })()\n : null;\n\n if (loading) {\n const progressText = loading.progressMessage ?? cycledMessage;\n return (\n <div\n className={headerClassName}\n role=\"status\"\n aria-busy=\"true\"\n aria-live=\"polite\"\n >\n <div className=\"web5-user-query__left flex-1\">\n {productBadge}\n <p\n className=\"text-[14px] leading-5 text-text-body truncate min-w-0 max-w-[700px]\"\n title={`Asking: ${loading.pendingQuery}`}\n >\n <span className=\"text-text-body/70\">Asking: </span>\n {loading.pendingQuery}\n </p>\n </div>\n {progressText && (\n <div className=\"hidden sm:flex items-center gap-2 ml-[10px] shrink-0 min-w-0\">\n <div\n className=\"w-4 h-4 shrink-0 animate-spin inline-block border-[2px] border-current border-t-transparent text-blue-600 dark:text-blue-500 rounded-full\"\n aria-hidden=\"true\"\n />\n <p className=\"text-[13px] leading-5 text-text-body/70 truncate max-w-[240px]\">\n {progressText}\n </p>\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div className={headerClassName}>\n <div className=\"flex items-center gap-[30px] flex-1 min-w-0\">\n <div className=\"web5-user-query__left\">\n {productBadge}\n <p\n className=\"web5-user-query__title text-[14px] leading-5 text-text-body truncate min-w-0 max-w-[700px]\"\n title={query}\n >\n {query}\n </p>\n </div>\n {hasNavigation && (\n <div className=\"flex items-center gap-[9px]\">\n <button\n type=\"button\"\n onClick={handleBack}\n disabled={!canGoBack}\n title=\"Go to previous conversation\"\n aria-label=\"Go to previous conversation\"\n className=\"w-6 h-6 flex items-center justify-center text-text-body hover:text-black transition-colors bg-transparent border-0 cursor-pointer disabled:opacity-30 disabled:cursor-default\"\n >\n <UndoIcon />\n </button>\n <button\n type=\"button\"\n onClick={handleForward}\n disabled={!canGoForward}\n title=\"Go to next conversation\"\n aria-label=\"Go to next conversation\"\n className=\"w-6 h-6 flex items-center justify-center text-text-body hover:text-black transition-colors bg-transparent border-0 cursor-pointer disabled:opacity-30 disabled:cursor-default\"\n >\n <RedoIcon />\n </button>\n </div>\n )}\n </div>\n <div className=\"flex items-center gap-[10px] ml-[10px] sm:ml-0 shrink-0\">\n {/*\n Keyboard hint. It used to sit inside the prompt field, which was the\n wrong home for it twice over: it competed with the placeholder for the\n same space, and it disappeared exactly when the reader engaged with\n the input — so the shortcut was only ever advertised to someone who\n was not using it. Here it sits with the other page-level affordances\n and stays legible while the reader types.\n\n `aria-hidden` because the shortcut is already announced on the input\n itself via `aria-keyshortcuts`; this is the visual reminder, and\n repeating it to assistive tech would just be noise.\n */}\n <span className=\"web5-prompt-hint\" aria-hidden=\"true\">\n Press <kbd className=\"web5-prompt-hint__key\">/</kbd> to search\n </span>\n {/* Share button — wraps button + tooltips in a relative container */}\n <div className=\"web5-user-query__action group relative\">\n <button\n type=\"button\"\n aria-label=\"Share this\"\n onClick={handleShare}\n disabled={isLoading || isCopied}\n className={`web5-user-query__share flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 border-0 cursor-pointer transition-colors disabled:cursor-default\n ${\n isCopied\n ? 'is-copied bg-[#2b2b2b] text-white'\n : 'text-text-body bg-white hover:bg-gray-50'\n }`}\n >\n {isCopied ? <CheckIcon /> : <ShareIcon />}\n <span className=\"hidden sm:inline\">\n {isLoading ? 'Sharing…' : isCopied ? copiedLabel : 'Share'}\n </span>\n </button>\n {/*\n Hover tooltip. Suppressed once the link is copied, because the\n copied state is its own message and two overlapping bubbles saying\n different things is worse than none.\n */}\n {!isCopied && (\n <span className=\"web5-user-query__tooltip\" role=\"tooltip\">\n Share this\n </span>\n )}\n {/* Mobile-only tooltip: drops below the button when link is copied */}\n {isCopied && (\n <div className=\"web5-user-query__copied-toast sm:hidden absolute top-full right-0 mt-1 flex items-center gap-2 bg-[#2b2b2b] text-white text-[12px] leading-none px-3 py-2 rounded-[8px] whitespace-nowrap\">\n <CheckIcon />\n {copiedLabel}\n </div>\n )}\n </div>\n {onNewConversation && (\n <div className=\"web5-user-query__action group relative\">\n <button\n type=\"button\"\n aria-label={newConversationLabel}\n onClick={handleNewConversation}\n className=\"web5-user-query__new-conversation flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 text-text-body bg-white border-0 cursor-pointer hover:bg-gray-50 transition-colors\"\n >\n <PlusIcon />\n <span className=\"hidden sm:inline\">{newConversationLabel}</span>\n </button>\n <span className=\"web5-user-query__tooltip\" role=\"tooltip\">\n {newConversationLabel}\n </span>\n </div>\n )}\n {onToggleCommentMode && (\n <button\n type=\"button\"\n onClick={onToggleCommentMode}\n aria-pressed={commentMode}\n title=\"Add a comment\"\n aria-label=\"Add a comment\"\n className={`relative flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 border-0 cursor-pointer transition-colors ${\n commentMode\n ? 'bg-[#2b2b2b] text-white'\n : 'text-text-body bg-white hover:bg-gray-50'\n }`}\n >\n <CommentIcon />\n {commentCount > 0 && (\n <span\n className={`absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 rounded-full text-[10px] leading-[18px] text-center font-semibold ${\n commentMode ? 'bg-white text-[#2b2b2b]' : 'bg-[#2b2b2b] text-white'\n }`}\n >\n {commentCount}\n </span>\n )}\n </button>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC5E,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SACEC,eAAe,EACfC,kBAAkB,EAClBC,mBAAmB,EACnBC,iBAAiB,QACZ,6BAA6B;AAIpC,MAAMC,wBAAwB,GAAG,CAC/B,WAAW,EAC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,QAAQ;IACb,cAAYvD,oBAAqB;IACjCwD,OAAO,EAAE3C,qBAAsB;IAC/BsC,SAAS,EAAC;EAAoN,gBAE9NhF,KAAA,CAAA8E,aAAA,CAACvE,QAAQ,MAAE,CAAC,eACZP,KAAA,CAAA8E,aAAA;IAAME,SAAS,EAAC;EAAkB,GAAEnD,oBAA2B,CACzD,CAAC,eACT7B,KAAA,CAAA8E,aAAA;IAAME,SAAS,EAAC,0BAA0B;IAACO,IAAI,EAAC;EAAS,GACtD1D,oBACG,CACH,CACN,EACAJ,mBAAmB,iBAClBzB,KAAA,CAAA8E,aAAA;IACEM,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAE5D,mBAAoB;IAC7B,gBAAcC,WAAY;IAC1B+C,KAAK,EAAC,eAAe;IACrB,cAAW,eAAe;IAC1BO,SAAS,EAAE,oJACTtD,WAAW,GACP,yBAAyB,GACzB,0CAA0C;EAC7C,gBAEH1B,KAAA,CAAA8E,aAAA,CAACpE,WAAW,MAAE,CAAC,EACdiB,YAAY,GAAG,CAAC,iBACf3B,KAAA,CAAA8E,aAAA;IACEE,SAAS,EAAE,yHACTtD,WAAW,GAAG,yBAAyB,GAAG,yBAAyB;EAClE,GAEFC,YACG,CAEF,CAEP,CACF,CAAC;AAEV,CAAC","ignoreList":[]}
|
package/dist/esm/index.js
CHANGED
|
@@ -125,6 +125,7 @@ export { WEB5_USER_QUERY_EVENT } from './types/userQueryEvent.js';
|
|
|
125
125
|
|
|
126
126
|
// Cross-bundle answer-updated broadcast event (B2B-4121)
|
|
127
127
|
export { WEB5_ANSWER_UPDATED_EVENT } from './types/answerUpdatedEvent.js';
|
|
128
|
+
export { WEB5_ANSWER_SETTLED_EVENT } from './types/answerSettledEvent.js';
|
|
128
129
|
|
|
129
130
|
// Cross-bundle redirect broadcast event (DL #098 D3)
|
|
130
131
|
export { WEB5_REDIRECT_EVENT } from './types/redirectEvent.js';
|