@particle-academy/react-fancy 5.37.0 → 5.38.0
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/CHANGELOG.md +76 -0
- package/dist/autocomplete.cjs +3 -3
- package/dist/autocomplete.js +2 -2
- package/dist/{chunk-FXP4JLGU.cjs → chunk-AR3JOPGT.cjs} +3 -3
- package/dist/{chunk-FXP4JLGU.cjs.map → chunk-AR3JOPGT.cjs.map} +1 -1
- package/dist/{chunk-35EN5AYE.js → chunk-CF5KRDN4.js} +6 -3
- package/dist/chunk-CF5KRDN4.js.map +1 -0
- package/dist/{chunk-6ASZUE4T.js → chunk-FQLL2JI7.js} +3 -3
- package/dist/{chunk-6ASZUE4T.js.map → chunk-FQLL2JI7.js.map} +1 -1
- package/dist/{chunk-ZH3SPBVB.js → chunk-IECPLOSZ.js} +3 -3
- package/dist/{chunk-ZH3SPBVB.js.map → chunk-IECPLOSZ.js.map} +1 -1
- package/dist/{chunk-E2SZBIAV.cjs → chunk-IWQ3ZFLZ.cjs} +5 -5
- package/dist/{chunk-E2SZBIAV.cjs.map → chunk-IWQ3ZFLZ.cjs.map} +1 -1
- package/dist/{chunk-QBNR5IVM.cjs → chunk-MFBUK4RV.cjs} +3 -3
- package/dist/{chunk-QBNR5IVM.cjs.map → chunk-MFBUK4RV.cjs.map} +1 -1
- package/dist/{chunk-DNV7MUEE.cjs → chunk-QLL7MWAU.cjs} +4 -4
- package/dist/{chunk-DNV7MUEE.cjs.map → chunk-QLL7MWAU.cjs.map} +1 -1
- package/dist/chunk-RYKPYILS.cjs +699 -0
- package/dist/chunk-RYKPYILS.cjs.map +1 -0
- package/dist/{chunk-O3WEV562.js → chunk-WUV3XDJH.js} +3 -3
- package/dist/{chunk-O3WEV562.js.map → chunk-WUV3XDJH.js.map} +1 -1
- package/dist/{chunk-ISPCXIJZ.cjs → chunk-X7H75WVP.cjs} +6 -3
- package/dist/chunk-X7H75WVP.cjs.map +1 -0
- package/dist/chunk-Z4GO6N6N.js +695 -0
- package/dist/chunk-Z4GO6N6N.js.map +1 -0
- package/dist/{chunk-O2ZHORSC.js → chunk-Z6RVBZQ4.js} +3 -3
- package/dist/{chunk-O2ZHORSC.js.map → chunk-Z6RVBZQ4.js.map} +1 -1
- package/dist/composer.cjs +9 -2
- package/dist/composer.d.cts +1 -1
- package/dist/composer.d.ts +1 -1
- package/dist/composer.js +4 -1
- package/dist/editor.cjs +1 -1
- package/dist/editor.js +1 -1
- package/dist/{index-C8PKWA_5.d.cts → index-CazpqSsk.d.cts} +103 -4
- package/dist/{index-C8PKWA_5.d.ts → index-CazpqSsk.d.ts} +103 -4
- package/dist/index.cjs +39 -35
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/dist/inputs.cjs +3 -3
- package/dist/inputs.js +2 -2
- package/dist/json-editor.cjs +14 -14
- package/dist/json-editor.js +3 -3
- package/dist/prompt-input.cjs +3 -3
- package/dist/prompt-input.js +2 -2
- package/dist/select.cjs +3 -3
- package/dist/select.js +2 -2
- package/dist/tooltip.cjs +2 -2
- package/dist/tooltip.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-23FTDEGR.cjs +0 -218
- package/dist/chunk-23FTDEGR.cjs.map +0 -1
- package/dist/chunk-2XAVAPDA.js +0 -215
- package/dist/chunk-2XAVAPDA.js.map +0 -1
- package/dist/chunk-35EN5AYE.js.map +0 -1
- package/dist/chunk-ISPCXIJZ.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-paste-pills.ts","../src/components/Composer/paste-markers.ts","../src/components/Composer/InlinePasteEditor.tsx","../src/components/Composer/Composer.tsx"],"names":["InlinePasteEditor","useRef","useCallback","range","jsx","jsxs","forwardRef","Composer"],"mappings":";;;;;;;AAgIO,SAAS,aAAA,CAAc;AAAA,EAC5B,SAAA;AAAA,EACA,UAAA,EAAY,oBAAA;AAAA,EACZ;AACF,C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AAAA,gBACvB,SAAA,EAAU,mLAAA;AAAA,gBACX,QAAA,EAAA;AAAA;AAAA;AAED,WAAA,EACF;AAAA;AAAA;AAAA,KACF;AAAA,EAEJ;AACF;AAEA,QAAA,CAAS,WAAA,GAAc,UAAA","file":"chunk-Z4GO6N6N.js","sourcesContent":["import { useCallback, useRef } from \"react\";\nimport { useControllableState } from \"./use-controllable-state\";\n\n/**\n * A paste held beside a composer rather than inserted into it.\n *\n * There is deliberately **no `length` field.** It would be `text.length` and\n * nothing else, and a derived value stored beside its source is a value that can\n * disagree with it — the two drift the moment anything edits one. Read\n * `paste.text.length`.\n */\nexport interface HeldPaste {\n id: string;\n text: string;\n}\n\n/**\n * The minimum of a clipboard event this hook touches.\n *\n * Structural rather than `React.ClipboardEvent` so a host can call it from a\n * native listener, a synthetic one, or a test double. React's own event satisfies\n * it.\n */\nexport interface PasteEventLike {\n clipboardData?: { getData(type: string): string } | null;\n preventDefault(): void;\n}\n\nexport interface UsePastePillsOptions {\n /**\n * Hold a paste of at least this many characters. Try 500 — about a long\n * paragraph.\n *\n * **No default, on purpose.** Paste is a fundamental interaction, so holding one\n * is something a host asks for rather than something it discovers. Omit this and\n * `handlePaste` always returns `false` and touches nothing.\n */\n threshold?: number;\n /** Own the list yourself. Omit to let the hook keep it. */\n heldPastes?: HeldPaste[];\n onHeldPastesChange?: (pastes: HeldPaste[]) => void;\n}\n\nexport interface UsePastePillsResult {\n heldPastes: HeldPaste[];\n /**\n * Call this from your OWN paste handler. Returns `true` if it took the paste —\n * in which case it has already called `preventDefault()` — and `false` if it\n * declined, having touched nothing.\n *\n * Composable on purpose: a host whose handler already intercepts paste for its\n * own reasons needs to ask \"did you want this?\" rather than hand over the event.\n *\n * function onPaste(e) {\n * if (pills.handlePaste(e)) return;\n * // ...your own handling\n * }\n */\n handlePaste: (event: PasteEventLike) => boolean;\n /**\n * Hold `text` unconditionally and return the new pill's id.\n *\n * For a host that decides for itself what to hold and needs to know WHICH pill\n * it made — `Composer`'s inline placement puts the pill at the caret, so it needs\n * the id at paste time. Ignores `threshold`; the caller has already decided.\n */\n hold: (text: string) => string;\n /**\n * Removes the paste and returns its text, for the host to insert into its own\n * surface. `undefined` if there is no such id.\n *\n * The hook cannot insert it — it owns no DOM and does not know what a host's\n * surface is. That is the point.\n */\n expand: (id: string) => string | undefined;\n /** Discard one without returning it. */\n remove: (id: string) => void;\n /** Empty the list, e.g. after a send. */\n clear: () => void;\n}\n\n/**\n * Hold a large paste as state, so a composer can show it as a pill instead of\n * turning itself into a scrolling wall.\n *\n * ---------------------------------------------------------------------------\n * Why this is a hook and not just a feature of `Composer`\n * ---------------------------------------------------------------------------\n *\n * `Composer` shipped the behaviour in 5.31.0 and the MOIC estate, who specified it,\n * then established something I had missed: their chat input is a contenteditable\n * rendering inline `[deal:42|Acme]` badges, so they **cannot** adopt `Composer` (a\n * plain textarea) however much they want its behaviour. Their plan to delete their\n * own composer when ours landed could never have worked.\n *\n * So the logic lives here and **`Composer` is its first caller.** One\n * implementation rather than two, which matters more than the convenience: two\n * copies of a rule drift, and the copy nobody reads is the one that rots. The rule\n * that must not drift is the one in `Composer`'s own tests — a send with pills\n * still closed carries the text.\n *\n * It owns no DOM. The host renders the pills.\n *\n * ---------------------------------------------------------------------------\n * Who actually calls this (as of 5.32.0): `Composer`, and nothing else\n * ---------------------------------------------------------------------------\n *\n * The estate that specified it **withdrew before adopting it**, hours after it\n * shipped — their design moved the pill INTO the message as a `[paste:id|label]`\n * marker in the same grammar as their other object tags, which makes the message\n * itself the record of what is attached. A parallel `heldPastes` array would then be\n * a second place answering \"what am I sending?\", and the two would disagree the\n * moment someone backspaced a badge. Their reasoning was better than the spec.\n *\n * Recorded because a reader should not infer an extension point under active\n * external use. It is kept rather than withdrawn for two reasons that are about\n * cost, not optimism: it is published API on a 5.x package, so removing it needs a\n * major; and `Composer` calls it, so it is exercised by that component's tests on\n * every run and cannot rot unnoticed.\n *\n * **It gets no further surface without a real caller.** No extra options, no second\n * hook. An API with one hypothetical consumer is how a package accumulates surface\n * nobody uses.\n *\n * `hold` (5.38.0) met that bar: `Composer`'s inline placement — MOIC's\n * pill-inside-the-message design, built into the component — needs the id of the\n * pill it just made so it can put it at the caret.\n */\nexport function usePastePills({\n threshold,\n heldPastes: controlledHeldPastes,\n onHeldPastesChange,\n}: UsePastePillsOptions = {}): UsePastePillsResult {\n const [heldPastes, setHeldPastes] = useControllableState<HeldPaste[]>(\n controlledHeldPastes,\n [],\n onHeldPastesChange,\n );\n\n /*\n * A counter rather than `crypto.randomUUID()` or an index.\n *\n * An index is not an id — removing the first pill renumbers the rest, and a host\n * keying its DOM on that remounts every pill and loses hover state. A counter in\n * a ref is stable for the life of the component and needs no platform API that a\n * server renderer might lack.\n */\n const nextId = useRef(0);\n\n const hold = useCallback(\n (text: string): string => {\n /*\n * Skip any id the list already holds. A controlled list can arrive seeded\n * (restored drafts, an agent attaching a paste) before this counter has\n * counted anything, and minting `paste-1` beside an existing `paste-1` gives\n * two pills one id — expanding either then takes both.\n */\n let id: string;\n do {\n nextId.current += 1;\n id = `paste-${nextId.current}`;\n } while (heldPastes.some((p) => p.id === id));\n\n setHeldPastes((current) => [...current, { id, text }]);\n\n return id;\n },\n [heldPastes, setHeldPastes],\n );\n\n const handlePaste = useCallback(\n (event: PasteEventLike): boolean => {\n if (!threshold || threshold <= 0) return false;\n\n const text = event.clipboardData?.getData(\"text/plain\") ?? \"\";\n\n // Below the threshold, decline WITHOUT touching the event. A host calling\n // this from inside its own handler has to be able to carry on as if the hook\n // were not there.\n if (text.length < threshold) return false;\n\n event.preventDefault();\n hold(text);\n\n return true;\n },\n [threshold, hold],\n );\n\n const expand = useCallback(\n (id: string): string | undefined => {\n const found = heldPastes.find((p) => p.id === id);\n\n if (found === undefined) return undefined;\n\n setHeldPastes((current) => current.filter((p) => p.id !== id));\n\n return found.text;\n },\n [heldPastes, setHeldPastes],\n );\n\n const remove = useCallback(\n (id: string) => setHeldPastes((current) => current.filter((p) => p.id !== id)),\n [setHeldPastes],\n );\n\n const clear = useCallback(() => setHeldPastes([]), [setHeldPastes]);\n\n return { heldPastes, handlePaste, hold, expand, remove, clear };\n}\n","import type { HeldPaste } from \"../../hooks/use-paste-pills\";\n\n/**\n * An image pasted into a `Composer` and held as a pill.\n *\n * `label` is stored rather than derived because the number in it is the order of\n * ARRIVAL: \"Pasted image 2\" must stay 2 after image 1 is deleted, and nothing left\n * in the list could recompute that.\n */\nexport interface HeldImage {\n id: string;\n file: File;\n label: string;\n}\n\n/**\n * U+FFFC OBJECT REPLACEMENT CHARACTER — Unicode's own \"an embedded object sits\n * here\". A marker is the id wrapped in a pair of them.\n *\n * Why the message carries a marker at all: with inline placement the message\n * ITSELF is the record of what is attached and where, so there is one answer to\n * \"what am I sending?\" rather than a text plus a parallel list that can disagree\n * the moment someone backspaces a pill. This is the MOIC estate's design for their\n * own composer, and the reason they withdrew from the beside-the-input layout.\n *\n * Only a marker whose id the composer actually holds is a pill; anything else is\n * left as text, so a stray U+FFFC in pasted content cannot invent an attachment.\n */\nexport const PILL_MARK = \"\\uFFFC\";\n\nconst MARKER = /\\uFFFC([^\\uFFFC\\n]+)\\uFFFC/g;\n\n/** The marker for a held paste or image, for a host or agent writing `value` itself. */\nexport function pasteMarker(id: string): string {\n return `${PILL_MARK}${id}${PILL_MARK}`;\n}\n\nexport type ValueSegment =\n | { type: \"text\"; text: string }\n | { type: \"pill\"; id: string };\n\n/** Split a value into text and pills. Markers for ids not in `known` stay text. */\nexport function segmentValue(value: string, known: ReadonlySet<string>): ValueSegment[] {\n const out: ValueSegment[] = [];\n let last = 0;\n\n for (const match of value.matchAll(MARKER)) {\n const id = match[1];\n if (!known.has(id)) continue;\n\n const start = match.index ?? 0;\n if (start > last) out.push({ type: \"text\", text: value.slice(last, start) });\n out.push({ type: \"pill\", id });\n last = start + match[0].length;\n }\n\n if (last < value.length) out.push({ type: \"text\", text: value.slice(last) });\n\n return out;\n}\n\n/** The id of every marker the value contains, in order, held or not. */\nexport function markedIds(value: string): string[] {\n return Array.from(value.matchAll(MARKER), (m) => m[1]);\n}\n\n/**\n * What actually gets sent: every text pill replaced by its full text, every image\n * pill by `[Pasted image N]` so the reader of the message can see where the image\n * sat. The images themselves go to `onSubmit`'s second argument.\n */\nexport function expandMarkers(\n value: string,\n pastes: readonly HeldPaste[],\n images: readonly HeldImage[],\n): string {\n const text = new Map(pastes.map((p) => [p.id, p.text]));\n const image = new Map(images.map((i) => [i.id, `[${i.label}]`]));\n\n return value.replace(MARKER, (whole, id: string) => text.get(id) ?? image.get(id) ?? whole);\n}\n","import {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n} from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { PILL_MARK, pasteMarker, segmentValue } from \"./paste-markers\";\n\n/** The attribute on the placeholder span a pill is portalled into. */\nexport const HOST_ATTR = \"data-react-fancy-composer-paste-host\";\n\n/** What a paste becomes, as decided by `Composer`. `block` pills get their own line. */\nexport interface PillToInsert {\n id: string;\n block: boolean;\n}\n\nexport interface InlinePasteEditorHandle {\n focus(): void;\n /** Swap a pill for plain text, where it sits. */\n replacePill(id: string, text: string): void;\n}\n\ninterface InlinePasteEditorProps {\n value: string;\n /** Ids the composer holds. A marker for anything else stays text. */\n known: ReadonlySet<string>;\n onChange(value: string): void;\n onSubmit(): void;\n /** Return the pills a paste becomes, or null to insert its text as typed. */\n onPaste(data: DataTransfer | null): PillToInsert[] | null;\n /** Every pill placeholder currently in the editor, for the composer to portal into. */\n onHostsChange(hosts: ReadonlyMap<string, HTMLElement>): void;\n placeholder: string;\n disabled: boolean;\n className?: string;\n}\n\n/**\n * Walk a node's children back into a value string.\n *\n * `<br>` as the LAST child of its parent is filler — browsers put one in an empty\n * line, and this editor puts one after a trailing newline so the caret has a line\n * to sit on — so it counts for nothing. Block elements a browser invents count as\n * a line break before them. Non-breaking spaces become spaces: a browser inserts\n * them for typed spaces it fears would collapse, not because anyone asked.\n */\nfunction serialize(parent: Node, keep: (id: string) => boolean): string {\n let out = \"\";\n const children = Array.from(parent.childNodes);\n\n children.forEach((node, i) => {\n if (node.nodeType === Node.TEXT_NODE) {\n out += (node.textContent ?? \"\").replace(/\\u00A0/g, \" \");\n return;\n }\n if (!(node instanceof HTMLElement)) return;\n\n const id = node.getAttribute(HOST_ATTR);\n if (id !== null) {\n if (keep(id)) out += pasteMarker(id);\n return;\n }\n if (node.tagName === \"BR\") {\n if (i !== children.length - 1) out += \"\\n\";\n return;\n }\n if (/^(DIV|P)$/.test(node.tagName) && out.length > 0 && !out.endsWith(\"\\n\")) {\n out += \"\\n\";\n }\n out += serialize(node, keep);\n });\n\n return out;\n}\n\nfunction makeHost(id: string): HTMLElement {\n const host = document.createElement(\"span\");\n host.setAttribute(\"contenteditable\", \"false\");\n host.setAttribute(HOST_ATTR, id);\n host.className = \"inline-block align-baseline\";\n return host;\n}\n\n/** A value ending in a newline needs a `<br>` after it, or the caret has no line to sit on. */\nfunction ensureTrailingBreak(root: HTMLElement, value: string) {\n const last = root.lastChild;\n const hasBreak = last instanceof HTMLElement && last.tagName === \"BR\";\n\n if (value.endsWith(\"\\n\") && !hasBreak) root.append(document.createElement(\"br\"));\n if (!value.endsWith(\"\\n\") && hasBreak && value.length > 0) last.remove();\n}\n\nfunction placeCaretAfter(node: Node) {\n const selection = window.getSelection();\n if (!selection) return;\n\n const range = document.createRange();\n range.setStartAfter(node);\n range.collapse(true);\n selection.removeAllRanges();\n selection.addRange(range);\n}\n\n/**\n * The plain-text-plus-pills surface behind `Composer`'s inline placement.\n *\n * The DOM is the source of truth WHILE TYPING and `value` is its serialisation;\n * the DOM is rebuilt from `value` only when `value` changes from outside (a send,\n * a host, an agent). Rebuilding on every keystroke would throw the caret away.\n *\n * Every insertion is done here by hand, never by the browser: a paste is always\n * intercepted, so no foreign HTML ever lands in the editor, and Enter is handled\n * so a browser never invents a `<div>` per line.\n */\nexport const InlinePasteEditor = forwardRef<InlinePasteEditorHandle, InlinePasteEditorProps>(\n function InlinePasteEditor(\n { value, known, onChange, onSubmit, onPaste, onHostsChange, placeholder, disabled, className },\n ref,\n ) {\n const rootRef = useRef<HTMLDivElement>(null);\n /** The last value this editor produced or rendered. Anything else came from outside. */\n const lastValue = useRef<string | null>(null);\n /**\n * Ids inserted here whose hold has not reached `known` yet. A pill is held and\n * placed in the same event, and the composer's state lands a render later.\n */\n const pending = useRef(new Set<string>());\n const knownRef = useRef(known);\n knownRef.current = known;\n\n const keep = useCallback(\n (id: string) => knownRef.current.has(id) || pending.current.has(id),\n [],\n );\n\n const reportHosts = useCallback(() => {\n const root = rootRef.current;\n if (!root) return;\n\n const hosts = new Map<string, HTMLElement>();\n root.querySelectorAll<HTMLElement>(`[${HOST_ATTR}]`).forEach((el) => {\n const id = el.getAttribute(HOST_ATTR)!;\n if (keep(id)) hosts.set(id, el);\n });\n onHostsChange(hosts);\n }, [keep, onHostsChange]);\n\n /** Read the DOM back into a value and tell the composer. */\n const emit = useCallback(() => {\n const root = rootRef.current;\n if (!root) return;\n\n const next = serialize(root, keep);\n ensureTrailingBreak(root, next);\n reportHosts();\n\n if (next !== lastValue.current) {\n lastValue.current = next;\n onChange(next);\n }\n }, [keep, onChange, reportHosts]);\n\n /** The caret's range, or the end of the editor if the caret is elsewhere. */\n const caret = useCallback((): Range => {\n const root = rootRef.current!;\n const selection = window.getSelection();\n\n if (selection && selection.rangeCount > 0) {\n const range = selection.getRangeAt(0);\n if (root.contains(range.commonAncestorContainer)) return range;\n }\n\n const range = document.createRange();\n range.selectNodeContents(root);\n range.collapse(false);\n const last = root.lastChild;\n if (last instanceof HTMLElement && last.tagName === \"BR\") {\n range.setStartBefore(last);\n range.collapse(true);\n }\n return range;\n }, []);\n\n /** Replace the selection with `nodes` and leave the caret after them. */\n const insert = useCallback(\n (build: (before: string, after: string) => Node[]) => {\n const root = rootRef.current!;\n const range = caret();\n range.deleteContents();\n\n const head = document.createRange();\n head.selectNodeContents(root);\n head.setEnd(range.startContainer, range.startOffset);\n const tail = document.createRange();\n tail.selectNodeContents(root);\n tail.setStart(range.endContainer, range.endOffset);\n\n const nodes = build(\n serialize(head.cloneContents(), () => true),\n serialize(tail.cloneContents(), () => true),\n );\n if (nodes.length === 0) return;\n\n const fragment = document.createDocumentFragment();\n nodes.forEach((n) => fragment.append(n));\n range.insertNode(fragment);\n placeCaretAfter(nodes[nodes.length - 1]);\n emit();\n },\n [caret, emit],\n );\n\n const insertText = useCallback(\n (text: string) => insert(() => (text ? [document.createTextNode(text)] : [])),\n [insert],\n );\n\n /*\n * Rebuild from `value` when it changed from outside — or when `known` now\n * disagrees with the pills on screen, e.g. a host set a marker and then the\n * paste it names. Never on our own edits: that would discard the caret.\n */\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!root) return;\n\n for (const id of pending.current) if (known.has(id)) pending.current.delete(id);\n\n const wanted = segmentValue(value, known)\n .flatMap((s) => (s.type === \"pill\" ? [s.id] : []))\n .join(PILL_MARK);\n const onScreen = Array.from(root.querySelectorAll(`[${HOST_ATTR}]`))\n .map((el) => el.getAttribute(HOST_ATTR))\n .filter((id): id is string => id !== null && keep(id))\n .join(PILL_MARK);\n\n if (value === lastValue.current && wanted === onScreen) return;\n\n root.replaceChildren();\n for (const segment of segmentValue(value, known)) {\n if (segment.type === \"text\") {\n root.append(document.createTextNode(segment.text));\n } else {\n root.append(makeHost(segment.id));\n }\n }\n ensureTrailingBreak(root, value);\n lastValue.current = value;\n reportHosts();\n }, [value, known, keep, reportHosts]);\n\n useImperativeHandle(\n ref,\n () => ({\n focus() {\n const root = rootRef.current;\n if (!root) return;\n root.focus();\n const range = caret();\n const selection = window.getSelection();\n selection?.removeAllRanges();\n selection?.addRange(range);\n },\n replacePill(id, text) {\n const root = rootRef.current;\n const host = Array.from(\n root?.querySelectorAll(`[${HOST_ATTR}]`) ?? [],\n ).find((el) => el.getAttribute(HOST_ATTR) === id);\n if (!root || !host) return;\n\n const node = document.createTextNode(text);\n host.replaceWith(node);\n root.focus();\n placeCaretAfter(node);\n emit();\n },\n }),\n [caret, emit],\n );\n\n const handlePaste = (e: React.ClipboardEvent<HTMLDivElement>) => {\n // ALWAYS intercepted: a browser left to paste into a contenteditable inserts\n // the clipboard's HTML, styles and all.\n e.preventDefault();\n if (disabled) return;\n\n const pills = onPaste(e.clipboardData);\n\n if (pills === null) {\n insertText((e.clipboardData?.getData(\"text/plain\") ?? \"\").replace(/\\r\\n?/g, \"\\n\"));\n return;\n }\n\n for (const { id } of pills) pending.current.add(id);\n\n insert((before, after) => {\n const nodes: Node[] = [];\n\n for (const { id, block } of pills) {\n if (block) {\n // A text pill gets a line to itself: a newline above unless it is\n // already at the start of one, and below unless one follows.\n const precededByBreak =\n nodes.length === 0\n ? before === \"\" || before.endsWith(\"\\n\")\n : nodes[nodes.length - 1].textContent === \"\\n\";\n if (!precededByBreak) nodes.push(document.createTextNode(\"\\n\"));\n nodes.push(makeHost(id));\n nodes.push(document.createTextNode(\"\\n\"));\n } else {\n nodes.push(makeHost(id));\n }\n }\n\n // The trailing newline of a block pill is redundant if one already follows.\n const last = nodes[nodes.length - 1];\n if (last.textContent === \"\\n\" && after.startsWith(\"\\n\")) nodes.pop();\n\n return nodes;\n });\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key !== \"Enter\" || e.nativeEvent.isComposing) return;\n\n e.preventDefault();\n if (e.shiftKey) {\n insertText(\"\\n\");\n } else {\n onSubmit();\n }\n };\n\n return (\n <div className=\"relative\">\n {value === \"\" && (\n <span\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute left-4 top-3 text-sm text-zinc-400\"\n >\n {placeholder}\n </span>\n )}\n <div\n ref={rootRef}\n data-react-fancy-composer-input=\"\"\n role=\"textbox\"\n aria-multiline=\"true\"\n aria-placeholder={placeholder}\n aria-disabled={disabled || undefined}\n contentEditable={!disabled}\n suppressContentEditableWarning\n onInput={emit}\n onPaste={handlePaste}\n onKeyDown={handleKeyDown}\n className={cn(\n \"max-h-72 min-h-[4.5rem] w-full overflow-y-auto whitespace-pre-wrap break-words bg-transparent px-4 pt-3 text-sm outline-none\",\n className,\n )}\n />\n </div>\n );\n },\n);\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../../utils/cn\";\nimport { useControllableState } from \"../../hooks/use-controllable-state\";\nimport { usePastePills, type HeldPaste } from \"../../hooks/use-paste-pills\";\nimport { Tooltip } from \"../Tooltip\";\nimport {\n InlinePasteEditor,\n type InlinePasteEditorHandle,\n type PillToInsert,\n} from \"./InlinePasteEditor\";\nimport { expandMarkers, markedIds, type HeldImage } from \"./paste-markers\";\nimport type {\n ComposerPasteClassNames,\n ComposerPastePreview,\n ComposerProps,\n} from \"./Composer.types\";\n\n/** Characters of a held paste shown at each end of the hover preview, unless `previewChars` says otherwise. */\nconst PREVIEW_CHARS = 20;\n\n/**\n * Thousands separators, written out rather than left to `toLocaleString()`.\n *\n * The number exists so someone can size the paste at a glance, and `2,036` sizes\n * faster than `2036`. It is not left to the runtime locale because the label beside\n * it (\"Pasted text\") is not localised either, so a locale-formatted number next to\n * an English noun would be half a translation.\n */\nfunction withSeparators(n: number): string {\n return String(n).replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n}\n\n/** First and last N characters, middle elided. The ends say WHICH paste this is. */\nfunction endsOf(text: string, chars: number): string {\n if (text.length <= chars * 2) return text;\n\n return `${text.slice(0, chars)} … ${text.slice(-chars)}`;\n}\n\nconst PILL_BASE =\n \"inline-flex select-none items-center rounded-md px-2 py-0.5 text-xs leading-5 transition-colors\";\nconst TEXT_PILL =\n \"cursor-pointer bg-zinc-100 text-zinc-700 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-200 dark:hover:bg-zinc-700\";\nconst IMAGE_PILL =\n \"bg-rose-100 font-medium text-rose-600 dark:bg-rose-500/20 dark:text-rose-300\";\nconst PREVIEW_BASE = \"max-w-xs whitespace-pre-wrap break-all text-xs\";\n\n/** An image's thumbnail, made from the File only while the preview is open. */\nfunction ImageThumb({ file }: { file: File }) {\n const [url, setUrl] = useState<string | null>(null);\n\n useEffect(() => {\n if (typeof URL.createObjectURL !== \"function\") return;\n const made = URL.createObjectURL(file);\n setUrl(made);\n return () => URL.revokeObjectURL(made);\n }, [file]);\n\n return url ? (\n <img src={url} alt=\"\" className=\"max-h-40 max-w-[16rem] rounded\" />\n ) : (\n <span>{file.name}</span>\n );\n}\n\ninterface InlinePillProps {\n preview: ComposerPastePreview;\n previewChars: number;\n renderPastePreview?: (preview: ComposerPastePreview) => ReactNode;\n classNames?: ComposerPasteClassNames;\n disabled: boolean;\n onExpand: (id: string) => void;\n}\n\n/**\n * One pill inside the message. The hover preview is a portalled `Tooltip`, so the\n * scrolling input cannot clip it.\n */\nfunction InlinePill({\n preview,\n previewChars,\n renderPastePreview,\n classNames,\n disabled,\n onExpand,\n}: InlinePillProps) {\n const id = preview.kind === \"text\" ? preview.paste.id : preview.image.id;\n const content = (\n <span data-react-fancy-composer-paste-pill-preview={id}>\n {renderPastePreview?.(preview) ??\n (preview.kind === \"text\" ? (\n endsOf(preview.paste.text, previewChars)\n ) : (\n <ImageThumb file={preview.image.file} />\n ))}\n </span>\n );\n const tooltipClass = cn(PREVIEW_BASE, classNames?.preview);\n\n if (preview.kind === \"image\") {\n return (\n <Tooltip content={content} className={tooltipClass}>\n <span\n data-react-fancy-composer-image-pill={id}\n role=\"img\"\n aria-label={preview.image.label}\n className={cn(PILL_BASE, IMAGE_PILL, classNames?.pill, classNames?.imagePill)}\n >\n {preview.image.label}\n </span>\n </Tooltip>\n );\n }\n\n const count = withSeparators(preview.paste.text.length);\n\n return (\n <Tooltip content={content} className={tooltipClass}>\n <button\n type=\"button\"\n data-react-fancy-composer-paste-pill={id}\n onClick={() => onExpand(id)}\n disabled={disabled}\n aria-label={`Insert this pasted text, ${count} characters`}\n className={cn(PILL_BASE, TEXT_PILL, classNames?.pill, classNames?.textPill)}\n >\n Pasted text · {count} characters\n </button>\n </Tooltip>\n );\n}\n\nexport const Composer = forwardRef<HTMLDivElement, ComposerProps>(\n function Composer(\n {\n value: controlledValue,\n defaultValue = \"\",\n onChange,\n onSubmit,\n placeholder = \"Type a message...\",\n actions,\n disabled = false,\n className,\n pasteThreshold,\n pastePlacement = \"above\",\n pasteImages = false,\n previewChars = PREVIEW_CHARS,\n renderPastePreview,\n classNames,\n heldPastes: controlledHeldPastes,\n onHeldPastesChange,\n heldImages: controlledHeldImages,\n onHeldImagesChange,\n },\n ref,\n ) {\n const inline = pastePlacement === \"inline\";\n const [value, setValue] = useControllableState(\n controlledValue,\n defaultValue,\n onChange,\n );\n /*\n * The holding logic lives in `usePastePills` and this is its first caller.\n *\n * It moved out in 5.32.0 because the estate that specified the feature cannot\n * use this component at all — their chat input is a contenteditable rendering\n * inline tag badges, which a textarea cannot do. One implementation rather than\n * two: two copies of a rule drift, and the copy nobody reads is the one that\n * rots. The rule that must not drift is the one below — a send with pills still\n * closed carries the text.\n */\n const pills = usePastePills({\n threshold: pasteThreshold,\n heldPastes: controlledHeldPastes,\n onHeldPastesChange,\n });\n const heldPastes = pills.heldPastes;\n const [heldImages, setHeldImages] = useControllableState<HeldImage[]>(\n controlledHeldImages,\n [],\n onHeldImagesChange,\n );\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const editorRef = useRef<InlinePasteEditorHandle>(null);\n const imageCount = useRef(0);\n\n const known = useMemo(\n () => new Set([...heldPastes.map((p) => p.id), ...heldImages.map((i) => i.id)]),\n [heldPastes, heldImages],\n );\n\n const handlePaste = useCallback(\n (e: React.ClipboardEvent<HTMLTextAreaElement>) => {\n // Composable by design, so this reads as a question rather than a handover.\n // Nothing else here wants the paste, so the answer is simply ignored.\n pills.handlePaste(e);\n },\n [pills],\n );\n\n const holdImage = useCallback(\n (file: File): string => {\n let id: string;\n do {\n imageCount.current += 1;\n id = `image-${imageCount.current}`;\n } while (heldImages.some((i) => i.id === id));\n\n const image = { id, file, label: `Pasted image ${imageCount.current}` };\n setHeldImages((current) => [...current, image]);\n\n return id;\n },\n [heldImages, setHeldImages],\n );\n\n /** Inline placement: decide what a paste becomes. `null` means \"just text\". */\n const decidePaste = useCallback(\n (data: DataTransfer | null): PillToInsert[] | null => {\n const text = data?.getData(\"text/plain\") ?? \"\";\n\n // Only a PURE image paste: a clipboard with text as well usually carries a\n // picture OF that text (copying from a document), and holding it would turn\n // every pasted sentence into a screenshot of the sentence.\n if (pasteImages && text === \"\") {\n const files = Array.from(data?.files ?? []).filter((f) =>\n f.type.startsWith(\"image/\"),\n );\n if (files.length > 0) {\n return files.map((file) => ({ id: holdImage(file), block: false }));\n }\n }\n\n if (pasteThreshold && pasteThreshold > 0 && text.length >= pasteThreshold) {\n return [{ id: pills.hold(text), block: true }];\n }\n\n return null;\n },\n [pasteImages, pasteThreshold, holdImage, pills],\n );\n\n /*\n * Inline placement: the message is the record of what is attached. A pill\n * backspaced out of it is no longer attached, so its held entry goes too —\n * otherwise state would say \"attached\" about something the message no longer\n * contains, which is the second-place-to-answer problem markers exist to end.\n */\n const handleInlineChange = useCallback(\n (next: string) => {\n setValue(next);\n\n const present = new Set(markedIds(next));\n for (const paste of heldPastes) if (!present.has(paste.id)) pills.remove(paste.id);\n if (heldImages.some((i) => !present.has(i.id))) {\n setHeldImages((current) => current.filter((i) => present.has(i.id)));\n }\n },\n [setValue, heldPastes, heldImages, pills, setHeldImages],\n );\n\n const [hosts, setHosts] = useState<ReadonlyMap<string, HTMLElement>>(new Map());\n const handleHostsChange = useCallback((next: ReadonlyMap<string, HTMLElement>) => {\n setHosts((prev) => {\n if (prev.size === next.size && [...next].every(([id, el]) => prev.get(id) === el)) {\n return prev;\n }\n return next;\n });\n }, []);\n\n /** Everything the person believes they are sending, in the order they built it. */\n const composeOutgoing = useCallback(() => {\n if (inline) return expandMarkers(value, heldPastes, heldImages);\n\n return [value, ...heldPastes.map((p) => p.text)].filter(Boolean).join(\"\\n\\n\");\n }, [inline, value, heldPastes, heldImages]);\n\n const hasContent = value.trim().length > 0 || (!inline && heldPastes.length > 0);\n\n const focusInput = useCallback(() => {\n if (inline) editorRef.current?.focus();\n else textareaRef.current?.focus();\n }, [inline]);\n\n const handleSubmit = useCallback(() => {\n if (!hasContent || disabled) return;\n\n /*\n * THE DANGEROUS STATE, and the reason this feature needed a spec rather than\n * a guess. A pill reads as \"your paste is attached\" — so a send that drops it\n * means asking a question about a document without the document, and nobody\n * can tell: the sender believes it went, the receiver sees a question about\n * nothing.\n *\n * Above the input, held pastes go out in arrival order after what was typed,\n * because people type the question BEFORE pasting the thing it is about.\n * Inline, every pill goes out exactly where it sits.\n */\n const order = markedIds(value);\n const images = inline\n ? order.flatMap((id) => heldImages.filter((i) => i.id === id))\n : [];\n\n onSubmit?.(composeOutgoing(), { images });\n setValue(\"\");\n pills.clear();\n setHeldImages([]);\n focusInput();\n }, [\n hasContent,\n disabled,\n value,\n inline,\n heldImages,\n onSubmit,\n composeOutgoing,\n setValue,\n pills,\n setHeldImages,\n focusInput,\n ]);\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n handleSubmit();\n }\n };\n\n /** Above the input: click a pill to dump it in, APPENDED to what is already typed. */\n const insertPaste = useCallback(\n (paste: HeldPaste) => {\n // `expand` removes it and hands back the text; inserting is this\n // component's job because the hook owns no DOM.\n const text = pills.expand(paste.id);\n\n if (text === undefined) return;\n\n setValue((current) => (current ? `${current}\\n\\n${text}` : text));\n textareaRef.current?.focus();\n },\n [pills, setValue],\n );\n\n /** Inline: click a text pill and its full text takes the pill's place. */\n const expandInline = useCallback(\n (id: string) => {\n const text = pills.expand(id);\n\n if (text === undefined) return;\n\n editorRef.current?.replacePill(id, text);\n },\n [pills],\n );\n\n return (\n <div\n data-react-fancy-composer=\"\"\n ref={ref}\n className={cn(\n \"rounded-xl border border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-900\",\n disabled && \"opacity-50\",\n className,\n )}\n >\n {!inline && heldPastes.length > 0 && (\n <div\n data-react-fancy-composer-paste-pills=\"\"\n className=\"flex flex-wrap gap-1.5 px-3 pt-3\"\n >\n {heldPastes.map((paste) => (\n // `group` + `group-hover` rather than hover state: the preview is\n // presentation, and a useState for it would be one more thing an\n // agent could desynchronise.\n <span key={paste.id} className=\"group relative inline-flex\">\n <button\n type=\"button\"\n data-react-fancy-composer-paste-pill={paste.id}\n onClick={() => insertPaste(paste)}\n disabled={disabled}\n // No `title`. A native tooltip plus the hover preview below\n // renders TWO tooltips on the same hover, at different delays.\n // The label says what clicking does; the preview says what the\n // text is, and it is linked rather than merely adjacent so a\n // screen reader reaches it too.\n aria-label={`Insert this pasted text, ${withSeparators(paste.text.length)} characters`}\n aria-describedby={`${paste.id}-preview`}\n // `pr-7` leaves room for the absolutely-positioned × that sits\n // over this button's right edge. With a smaller right padding the\n // × lands on top of the label.\n className={cn(\n \"inline-flex items-center gap-1.5 rounded-full border border-zinc-200 bg-zinc-50 py-1 pl-2.5 pr-7 text-xs text-zinc-700 transition-colors hover:bg-zinc-100 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-200 dark:hover:bg-zinc-700\",\n classNames?.pill,\n classNames?.textPill,\n )}\n >\n <span>\n Pasted text · {withSeparators(paste.text.length)} characters\n </span>\n </button>\n\n <button\n type=\"button\"\n data-react-fancy-composer-paste-pill-remove={paste.id}\n onClick={() => pills.remove(paste.id)}\n disabled={disabled}\n aria-label=\"Discard this pasted text\"\n className={cn(\n \"absolute right-1 top-1/2 -translate-y-1/2 rounded-full px-1 text-xs text-zinc-400 transition-colors hover:text-zinc-700 dark:hover:text-zinc-100\",\n classNames?.remove,\n )}\n >\n ×\n </button>\n\n <span\n id={`${paste.id}-preview`}\n data-react-fancy-composer-paste-pill-preview={paste.id}\n role=\"tooltip\"\n className={cn(\n \"pointer-events-none absolute bottom-full left-0 z-10 mb-1 hidden max-w-xs whitespace-pre-wrap break-all rounded-md bg-zinc-900 px-2 py-1 text-xs text-white group-hover:block dark:bg-zinc-100 dark:text-zinc-900\",\n classNames?.preview,\n )}\n >\n {renderPastePreview?.({ kind: \"text\", paste }) ??\n endsOf(paste.text, previewChars)}\n </span>\n </span>\n ))}\n </div>\n )}\n\n {inline ? (\n <>\n <InlinePasteEditor\n ref={editorRef}\n value={value}\n known={known}\n onChange={handleInlineChange}\n onSubmit={handleSubmit}\n onPaste={decidePaste}\n onHostsChange={handleHostsChange}\n placeholder={placeholder}\n disabled={disabled}\n className={classNames?.input}\n />\n {Array.from(hosts, ([id, host]) => {\n const paste = heldPastes.find((p) => p.id === id);\n const image = paste ? undefined : heldImages.find((i) => i.id === id);\n const preview: ComposerPastePreview | null = paste\n ? { kind: \"text\", paste }\n : image\n ? { kind: \"image\", image }\n : null;\n\n return preview\n ? createPortal(\n <InlinePill\n preview={preview}\n previewChars={previewChars}\n renderPastePreview={renderPastePreview}\n classNames={classNames}\n disabled={disabled}\n onExpand={expandInline}\n />,\n host,\n id,\n )\n : null;\n })}\n </>\n ) : (\n <textarea\n ref={textareaRef}\n value={value}\n onChange={(e) => setValue(e.target.value)}\n onKeyDown={handleKeyDown}\n onPaste={handlePaste}\n placeholder={placeholder}\n disabled={disabled}\n rows={3}\n className={cn(\n \"w-full resize-none bg-transparent px-4 pt-3 text-sm outline-none placeholder:text-zinc-400\",\n classNames?.input,\n )}\n />\n )}\n <div className=\"flex items-center justify-between border-t border-zinc-100 px-3 py-2 dark:border-zinc-800\">\n <div className=\"flex items-center gap-1\">{actions}</div>\n <button\n type=\"button\"\n onClick={handleSubmit}\n disabled={disabled || !hasContent}\n className=\"rounded-lg bg-zinc-900 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-zinc-800 disabled:opacity-50 dark:bg-white dark:text-zinc-900 dark:hover:bg-zinc-100\"\n >\n Send\n </button>\n </div>\n </div>\n );\n },\n);\n\nComposer.displayName = \"Composer\";\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useFloatingPosition } from './chunk-MQ6VGG62.js';
|
|
2
1
|
import { useInlineEdit } from './chunk-OL53XYHF.js';
|
|
3
2
|
import { useFieldMode } from './chunk-NRXK42LO.js';
|
|
3
|
+
import { useFloatingPosition } from './chunk-MQ6VGG62.js';
|
|
4
4
|
import { Portal } from './chunk-WHEXTDPV.js';
|
|
5
5
|
import { useOutsideClick } from './chunk-RGANGU7X.js';
|
|
6
6
|
import { useEscapeKey } from './chunk-JXE5XID6.js';
|
|
@@ -196,5 +196,5 @@ function HighlightMatch({ text, query }) {
|
|
|
196
196
|
Autocomplete.displayName = "Autocomplete";
|
|
197
197
|
|
|
198
198
|
export { Autocomplete };
|
|
199
|
-
//# sourceMappingURL=chunk-
|
|
200
|
-
//# sourceMappingURL=chunk-
|
|
199
|
+
//# sourceMappingURL=chunk-Z6RVBZQ4.js.map
|
|
200
|
+
//# sourceMappingURL=chunk-Z6RVBZQ4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Autocomplete/Autocomplete.tsx"],"names":["Autocomplete"],"mappings":";;;;;;;;;;;AAWO,IAAM,YAAA,GAAe,UAAA;AAAA,EAC1B,SAASA,aAAAA,CACP;AAAA,IACE,KAAA,EAAO,eAAA;AAAA,IACP,YAAA,GAAe,EAAA;AAAA,IACf,QAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA,GAAU,KAAA;AAAA,IACV,YAAA,GAAe,mBAAA;AAAA,IACf,QAAA,GAAW,KAAA;AAAA,IACX,SAAA;AAAA,IACA;AAAA,KAEF,GAAA,EACA;AACA,IAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,oBAAA;AAAA,MACxB,eAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAM,YAAA,GAAe,aAAa,IAAI,CAAA;AACtC,IAAA,MAAM,EAAE,aAAa,WAAA,EAAa,SAAA,EA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A,IAAA,IAAA,CAAK,KAAA,CAAM,GAAG,GAAG,CAAA;AAAA,oBAClB,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,6CAAA,EACb,QAAA,EAAA,IAAA,CAAK,MAAM,GAAA,EAAK,GAAA,GAAM,KAAA,CAAM,MAAM,CAAA,EACrC,CAAA;AAAA,IACC,IAAA,CAAK,KAAA,CAAM,GAAA,GAAM,KAAA,CAAM,MAAM;AAAA,GAAA,EAChC,CAAA;AAEJ;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA","file":"chunk-O2ZHORSC.js","sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Portal } from \"../Portal\";\nimport { useControllableState } from \"../../hooks/use-controllable-state\";\nimport { useFloatingPosition } from \"../../hooks/use-floating-position\";\nimport { useOutsideClick } from \"../../hooks/use-outside-click\";\nimport { useEscapeKey } from \"../../hooks/use-escape-key\";\nimport { useFieldMode } from \"../inputs/mode/FieldMode.context\";\nimport { useInlineEdit } from \"../inputs/mode/useInlineEdit\";\nimport type { AutocompleteProps } from \"./Autocomplete.types\";\n\nexport const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(\n function Autocomplete(\n {\n value: controlledValue,\n defaultValue = \"\",\n onChange,\n onSearch,\n options,\n placeholder,\n loading = false,\n emptyMessage = \"No results found.\",\n disabled = false,\n className,\n mode,\n },\n ref,\n ) {\n const [value, setValue] = useControllableState(\n controlledValue,\n defaultValue,\n onChange,\n );\n const resolvedMode = useFieldMode(mode);\n const { showControl, interactive, enterEdit, exitEdit } = useInlineEdit(resolvedMode, disabled);\n const [query, setQuery] = useState(value);\n const [open, setOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState(-1);\n\n const anchorRef = useRef<HTMLInputElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n const position = useFloatingPosition(anchorRef, listRef, {\n placement: \"bottom-start\",\n offset: 4,\n enabled: open,\n });\n\n const close = useCallback(() => {\n setOpen(false);\n setActiveIndex(-1);\n }, []);\n\n useOutsideClick(wrapperRef, close, open);\n useEscapeKey(close, open);\n\n const filtered = options.filter((o) =>\n o.label.toLowerCase().includes(query.toLowerCase()),\n );\n\n const select = useCallback(\n (val: string) => {\n setValue(val);\n const opt = options.find((o) => o.value === val);\n setQuery(opt?.label ?? val);\n close();\n },\n [setValue, options, close],\n );\n\n useEffect(() => {\n onSearch?.(query);\n }, [query, onSearch]);\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (!open) {\n if (e.key === \"ArrowDown\") {\n setOpen(true);\n return;\n }\n return;\n }\n\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setActiveIndex((i) => Math.min(i + 1, filtered.length - 1));\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n setActiveIndex((i) => Math.max(i - 1, 0));\n } else if (e.key === \"Enter\" && activeIndex >= 0) {\n e.preventDefault();\n const item = filtered[activeIndex];\n if (item && !item.disabled) select(item.value);\n }\n };\n\n if (!showControl) {\n const matched = options.find((o) => o.value === value);\n return (\n <div\n data-react-fancy-autocomplete=\"\"\n data-mode=\"view\"\n ref={wrapperRef}\n role={interactive ? \"button\" : undefined}\n tabIndex={interactive ? 0 : undefined}\n title={interactive ? \"Click to edit\" : undefined}\n onClick={interactive ? enterEdit : undefined}\n onKeyDown={\n interactive\n ? (e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n enterEdit();\n }\n }\n : undefined\n }\n className={cn(\n \"text-sm text-zinc-900 dark:text-zinc-100\",\n !value && \"text-zinc-400 dark:text-zinc-500\",\n interactive &&\n \"cursor-pointer rounded-md outline-none transition-colors hover:bg-zinc-100 focus-visible:ring-2 focus-visible:ring-blue-500/40 dark:hover:bg-zinc-800\",\n className,\n )}\n >\n {matched?.label ?? value ?? \"—\"}\n </div>\n );\n }\n\n return (\n <div\n data-react-fancy-autocomplete=\"\"\n ref={wrapperRef}\n className={cn(\"relative\", className)}\n onBlur={(e) => {\n // Options live in a Portal; only exit when closed and focus left.\n if (interactive && !open && !e.currentTarget.contains(e.relatedTarget as Node)) {\n exitEdit();\n }\n }}\n >\n <input\n ref={(node) => {\n (anchorRef as React.MutableRefObject<HTMLInputElement | null>).current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLInputElement | null>).current = node;\n }}\n type=\"text\"\n value={query}\n onChange={(e) => {\n setQuery(e.target.value);\n setOpen(true);\n setActiveIndex(-1);\n }}\n onFocus={() => setOpen(true)}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled}\n autoFocus={interactive}\n role=\"combobox\"\n aria-expanded={open}\n aria-autocomplete=\"list\"\n className=\"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm text-zinc-900 placeholder:text-zinc-400 outline-none transition-[border-color,box-shadow] duration-150 focus:border-blue-500 focus:ring-2 focus:ring-blue-500/40 dark:border-zinc-700 dark:bg-[#1e1e24] dark:text-zinc-100 dark:placeholder:text-zinc-500 dark:focus:border-blue-400 dark:focus:ring-blue-400/20\"\n />\n {open && (\n <Portal>\n <div\n ref={listRef}\n role=\"listbox\"\n className=\"fixed z-50 max-h-60 min-w-[8rem] overflow-y-auto rounded-xl border border-zinc-200 bg-white p-1 shadow-lg dark:border-zinc-700 dark:bg-zinc-900 dark:shadow-zinc-950/50 fancy-scale-in\"\n style={{\n left: position.x,\n top: position.y,\n width: anchorRef.current?.offsetWidth,\n }}\n >\n {loading ? (\n <div className=\"px-3 py-2 text-sm text-zinc-400\">Loading...</div>\n ) : filtered.length === 0 ? (\n <div className=\"px-3 py-2 text-sm text-zinc-400\">\n {emptyMessage}\n </div>\n ) : (\n filtered.map((option, i) => (\n <button\n key={option.value}\n type=\"button\"\n role=\"option\"\n aria-selected={i === activeIndex}\n disabled={option.disabled}\n onClick={() => select(option.value)}\n className={cn(\n \"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-zinc-700 transition-colors dark:text-zinc-200\",\n i === activeIndex\n ? \"bg-zinc-100 dark:bg-zinc-800\"\n : \"hover:bg-zinc-50 dark:hover:bg-zinc-800/50\",\n option.disabled && \"cursor-not-allowed opacity-50\",\n )}\n >\n <HighlightMatch text={option.label} query={query} />\n </button>\n ))\n )}\n </div>\n </Portal>\n )}\n </div>\n );\n },\n);\n\nfunction HighlightMatch({ text, query }: { text: string; query: string }) {\n if (!query) return <>{text}</>;\n\n const idx = text.toLowerCase().indexOf(query.toLowerCase());\n if (idx === -1) return <>{text}</>;\n\n return (\n <>\n {text.slice(0, idx)}\n <span className=\"font-semibold text-zinc-900 dark:text-white\">\n {text.slice(idx, idx + query.length)}\n </span>\n {text.slice(idx + query.length)}\n </>\n );\n}\n\nAutocomplete.displayName = \"Autocomplete\";\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/Autocomplete/Autocomplete.tsx"],"names":["Autocomplete"],"mappings":";;;;;;;;;;;AAWO,IAAM,YAAA,GAAe,UAAA;AAAA,EAC1B,SAASA,aAAAA,CACP;AAAA,IACE,KAAA,EAAO,eAAA;AAAA,IACP,YAAA,GAAe,EAAA;AAAA,IACf,QAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA,GAAU,KAAA;AAAA,IACV,YAAA,GAAe,mBAAA;AAAA,IACf,QAAA,GAAW,KAAA;AAAA,IACX,SAAA;AAAA,IACA;AAAA,KAEF,GAAA,EACA;AACA,IAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,oBAAA;AAAA,MACxB,eAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAM,YAAA,GAAe,aAAa,IAAI,CAAA;AACtC,IAAA,MAAM,EAAE,aAAa,WAAA,EAAa,SAAA,EAAW,UAAS,GAAI,aAAA,CAAc,cAAc,QAAQ,CAAA;AAC9F,IAAA,MAAM,CAAC,KAAA,EAAO,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AA,EAAK,SAAA,EAAU,6CAAA,EACb,QAAA,EAAA,IAAA,CAAK,MAAM,GAAA,EAAK,GAAA,GAAM,KAAA,CAAM,MAAM,CAAA,EACrC,CAAA;AAAA,IACC,IAAA,CAAK,KAAA,CAAM,GAAA,GAAM,KAAA,CAAM,MAAM;AAAA,GAAA,EAChC,CAAA;AAEJ;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA","file":"chunk-Z6RVBZQ4.js","sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Portal } from \"../Portal\";\nimport { useControllableState } from \"../../hooks/use-controllable-state\";\nimport { useFloatingPosition } from \"../../hooks/use-floating-position\";\nimport { useOutsideClick } from \"../../hooks/use-outside-click\";\nimport { useEscapeKey } from \"../../hooks/use-escape-key\";\nimport { useFieldMode } from \"../inputs/mode/FieldMode.context\";\nimport { useInlineEdit } from \"../inputs/mode/useInlineEdit\";\nimport type { AutocompleteProps } from \"./Autocomplete.types\";\n\nexport const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(\n function Autocomplete(\n {\n value: controlledValue,\n defaultValue = \"\",\n onChange,\n onSearch,\n options,\n placeholder,\n loading = false,\n emptyMessage = \"No results found.\",\n disabled = false,\n className,\n mode,\n },\n ref,\n ) {\n const [value, setValue] = useControllableState(\n controlledValue,\n defaultValue,\n onChange,\n );\n const resolvedMode = useFieldMode(mode);\n const { showControl, interactive, enterEdit, exitEdit } = useInlineEdit(resolvedMode, disabled);\n const [query, setQuery] = useState(value);\n const [open, setOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState(-1);\n\n const anchorRef = useRef<HTMLInputElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n const position = useFloatingPosition(anchorRef, listRef, {\n placement: \"bottom-start\",\n offset: 4,\n enabled: open,\n });\n\n const close = useCallback(() => {\n setOpen(false);\n setActiveIndex(-1);\n }, []);\n\n useOutsideClick(wrapperRef, close, open);\n useEscapeKey(close, open);\n\n const filtered = options.filter((o) =>\n o.label.toLowerCase().includes(query.toLowerCase()),\n );\n\n const select = useCallback(\n (val: string) => {\n setValue(val);\n const opt = options.find((o) => o.value === val);\n setQuery(opt?.label ?? val);\n close();\n },\n [setValue, options, close],\n );\n\n useEffect(() => {\n onSearch?.(query);\n }, [query, onSearch]);\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (!open) {\n if (e.key === \"ArrowDown\") {\n setOpen(true);\n return;\n }\n return;\n }\n\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setActiveIndex((i) => Math.min(i + 1, filtered.length - 1));\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n setActiveIndex((i) => Math.max(i - 1, 0));\n } else if (e.key === \"Enter\" && activeIndex >= 0) {\n e.preventDefault();\n const item = filtered[activeIndex];\n if (item && !item.disabled) select(item.value);\n }\n };\n\n if (!showControl) {\n const matched = options.find((o) => o.value === value);\n return (\n <div\n data-react-fancy-autocomplete=\"\"\n data-mode=\"view\"\n ref={wrapperRef}\n role={interactive ? \"button\" : undefined}\n tabIndex={interactive ? 0 : undefined}\n title={interactive ? \"Click to edit\" : undefined}\n onClick={interactive ? enterEdit : undefined}\n onKeyDown={\n interactive\n ? (e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n enterEdit();\n }\n }\n : undefined\n }\n className={cn(\n \"text-sm text-zinc-900 dark:text-zinc-100\",\n !value && \"text-zinc-400 dark:text-zinc-500\",\n interactive &&\n \"cursor-pointer rounded-md outline-none transition-colors hover:bg-zinc-100 focus-visible:ring-2 focus-visible:ring-blue-500/40 dark:hover:bg-zinc-800\",\n className,\n )}\n >\n {matched?.label ?? value ?? \"—\"}\n </div>\n );\n }\n\n return (\n <div\n data-react-fancy-autocomplete=\"\"\n ref={wrapperRef}\n className={cn(\"relative\", className)}\n onBlur={(e) => {\n // Options live in a Portal; only exit when closed and focus left.\n if (interactive && !open && !e.currentTarget.contains(e.relatedTarget as Node)) {\n exitEdit();\n }\n }}\n >\n <input\n ref={(node) => {\n (anchorRef as React.MutableRefObject<HTMLInputElement | null>).current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLInputElement | null>).current = node;\n }}\n type=\"text\"\n value={query}\n onChange={(e) => {\n setQuery(e.target.value);\n setOpen(true);\n setActiveIndex(-1);\n }}\n onFocus={() => setOpen(true)}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled}\n autoFocus={interactive}\n role=\"combobox\"\n aria-expanded={open}\n aria-autocomplete=\"list\"\n className=\"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm text-zinc-900 placeholder:text-zinc-400 outline-none transition-[border-color,box-shadow] duration-150 focus:border-blue-500 focus:ring-2 focus:ring-blue-500/40 dark:border-zinc-700 dark:bg-[#1e1e24] dark:text-zinc-100 dark:placeholder:text-zinc-500 dark:focus:border-blue-400 dark:focus:ring-blue-400/20\"\n />\n {open && (\n <Portal>\n <div\n ref={listRef}\n role=\"listbox\"\n className=\"fixed z-50 max-h-60 min-w-[8rem] overflow-y-auto rounded-xl border border-zinc-200 bg-white p-1 shadow-lg dark:border-zinc-700 dark:bg-zinc-900 dark:shadow-zinc-950/50 fancy-scale-in\"\n style={{\n left: position.x,\n top: position.y,\n width: anchorRef.current?.offsetWidth,\n }}\n >\n {loading ? (\n <div className=\"px-3 py-2 text-sm text-zinc-400\">Loading...</div>\n ) : filtered.length === 0 ? (\n <div className=\"px-3 py-2 text-sm text-zinc-400\">\n {emptyMessage}\n </div>\n ) : (\n filtered.map((option, i) => (\n <button\n key={option.value}\n type=\"button\"\n role=\"option\"\n aria-selected={i === activeIndex}\n disabled={option.disabled}\n onClick={() => select(option.value)}\n className={cn(\n \"flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-zinc-700 transition-colors dark:text-zinc-200\",\n i === activeIndex\n ? \"bg-zinc-100 dark:bg-zinc-800\"\n : \"hover:bg-zinc-50 dark:hover:bg-zinc-800/50\",\n option.disabled && \"cursor-not-allowed opacity-50\",\n )}\n >\n <HighlightMatch text={option.label} query={query} />\n </button>\n ))\n )}\n </div>\n </Portal>\n )}\n </div>\n );\n },\n);\n\nfunction HighlightMatch({ text, query }: { text: string; query: string }) {\n if (!query) return <>{text}</>;\n\n const idx = text.toLowerCase().indexOf(query.toLowerCase());\n if (idx === -1) return <>{text}</>;\n\n return (\n <>\n {text.slice(0, idx)}\n <span className=\"font-semibold text-zinc-900 dark:text-white\">\n {text.slice(idx, idx + query.length)}\n </span>\n {text.slice(idx + query.length)}\n </>\n );\n}\n\nAutocomplete.displayName = \"Autocomplete\";\n"]}
|
package/dist/composer.cjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkRYKPYILS_cjs = require('./chunk-RYKPYILS.cjs');
|
|
4
|
+
require('./chunk-X7H75WVP.cjs');
|
|
5
|
+
require('./chunk-J2DI6RMR.cjs');
|
|
6
|
+
require('./chunk-NBZC6LOB.cjs');
|
|
4
7
|
require('./chunk-SNHU2AI4.cjs');
|
|
5
8
|
require('./chunk-ZU5Q77OT.cjs');
|
|
6
9
|
|
|
@@ -8,7 +11,11 @@ require('./chunk-ZU5Q77OT.cjs');
|
|
|
8
11
|
|
|
9
12
|
Object.defineProperty(exports, "Composer", {
|
|
10
13
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkRYKPYILS_cjs.Composer; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "pasteMarker", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkRYKPYILS_cjs.pasteMarker; }
|
|
12
19
|
});
|
|
13
20
|
//# sourceMappingURL=composer.cjs.map
|
|
14
21
|
//# sourceMappingURL=composer.cjs.map
|
package/dist/composer.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as Composer, a as ComposerProps, H as HeldPaste } from './index-
|
|
1
|
+
export { C as Composer, a as ComposerPasteClassNames, b as ComposerPastePreview, c as ComposerProps, d as ComposerSubmitExtras, H as HeldImage, e as HeldPaste, p as pasteMarker } from './index-CazpqSsk.cjs';
|
|
2
2
|
import 'react';
|
package/dist/composer.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as Composer, a as ComposerProps, H as HeldPaste } from './index-
|
|
1
|
+
export { C as Composer, a as ComposerPasteClassNames, b as ComposerPastePreview, c as ComposerProps, d as ComposerSubmitExtras, H as HeldImage, e as HeldPaste, p as pasteMarker } from './index-CazpqSsk.js';
|
|
2
2
|
import 'react';
|
package/dist/composer.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export { Composer } from './chunk-
|
|
1
|
+
export { Composer, pasteMarker } from './chunk-Z4GO6N6N.js';
|
|
2
|
+
import './chunk-CF5KRDN4.js';
|
|
3
|
+
import './chunk-MQ6VGG62.js';
|
|
4
|
+
import './chunk-WHEXTDPV.js';
|
|
2
5
|
import './chunk-EDYAXGUM.js';
|
|
3
6
|
import './chunk-MMW2JGKZ.js';
|
|
4
7
|
//# sourceMappingURL=composer.js.map
|
package/dist/editor.cjs
CHANGED
|
@@ -8,8 +8,8 @@ require('./chunk-G7227RTY.cjs');
|
|
|
8
8
|
require('./chunk-TXTRTTG7.cjs');
|
|
9
9
|
require('./chunk-3WGRVDQR.cjs');
|
|
10
10
|
require('./chunk-BFKCVSNK.cjs');
|
|
11
|
-
require('./chunk-J2DI6RMR.cjs');
|
|
12
11
|
require('./chunk-L3V3BYVS.cjs');
|
|
12
|
+
require('./chunk-J2DI6RMR.cjs');
|
|
13
13
|
require('./chunk-57FQGQJK.cjs');
|
|
14
14
|
require('./chunk-RXDRYWVD.cjs');
|
|
15
15
|
require('./chunk-SNHU2AI4.cjs');
|
package/dist/editor.js
CHANGED
|
@@ -6,8 +6,8 @@ import './chunk-FBWUXSKH.js';
|
|
|
6
6
|
import './chunk-5U2DZ7AV.js';
|
|
7
7
|
import './chunk-CHADHN6M.js';
|
|
8
8
|
import './chunk-XJXQG34J.js';
|
|
9
|
-
import './chunk-MQ6VGG62.js';
|
|
10
9
|
import './chunk-NRXK42LO.js';
|
|
10
|
+
import './chunk-MQ6VGG62.js';
|
|
11
11
|
import './chunk-RGANGU7X.js';
|
|
12
12
|
import './chunk-JXE5XID6.js';
|
|
13
13
|
import './chunk-EDYAXGUM.js';
|
|
@@ -56,6 +56,14 @@ interface UsePastePillsResult {
|
|
|
56
56
|
* }
|
|
57
57
|
*/
|
|
58
58
|
handlePaste: (event: PasteEventLike) => boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Hold `text` unconditionally and return the new pill's id.
|
|
61
|
+
*
|
|
62
|
+
* For a host that decides for itself what to hold and needs to know WHICH pill
|
|
63
|
+
* it made — `Composer`'s inline placement puts the pill at the caret, so it needs
|
|
64
|
+
* the id at paste time. Ignores `threshold`; the caller has already decided.
|
|
65
|
+
*/
|
|
66
|
+
hold: (text: string) => string;
|
|
59
67
|
/**
|
|
60
68
|
* Removes the paste and returns its text, for the host to insert into its own
|
|
61
69
|
* surface. `undefined` if there is no such id.
|
|
@@ -111,21 +119,78 @@ interface UsePastePillsResult {
|
|
|
111
119
|
* **It gets no further surface without a real caller.** No extra options, no second
|
|
112
120
|
* hook. An API with one hypothetical consumer is how a package accumulates surface
|
|
113
121
|
* nobody uses.
|
|
122
|
+
*
|
|
123
|
+
* `hold` (5.38.0) met that bar: `Composer`'s inline placement — MOIC's
|
|
124
|
+
* pill-inside-the-message design, built into the component — needs the id of the
|
|
125
|
+
* pill it just made so it can put it at the caret.
|
|
114
126
|
*/
|
|
115
127
|
declare function usePastePills({ threshold, heldPastes: controlledHeldPastes, onHeldPastesChange, }?: UsePastePillsOptions): UsePastePillsResult;
|
|
116
128
|
|
|
129
|
+
/**
|
|
130
|
+
* An image pasted into a `Composer` and held as a pill.
|
|
131
|
+
*
|
|
132
|
+
* `label` is stored rather than derived because the number in it is the order of
|
|
133
|
+
* ARRIVAL: "Pasted image 2" must stay 2 after image 1 is deleted, and nothing left
|
|
134
|
+
* in the list could recompute that.
|
|
135
|
+
*/
|
|
136
|
+
interface HeldImage {
|
|
137
|
+
id: string;
|
|
138
|
+
file: File;
|
|
139
|
+
label: string;
|
|
140
|
+
}
|
|
141
|
+
/** The marker for a held paste or image, for a host or agent writing `value` itself. */
|
|
142
|
+
declare function pasteMarker(id: string): string;
|
|
143
|
+
|
|
144
|
+
/** What a hover preview is being asked to show. */
|
|
145
|
+
type ComposerPastePreview = {
|
|
146
|
+
kind: "text";
|
|
147
|
+
paste: HeldPaste;
|
|
148
|
+
} | {
|
|
149
|
+
kind: "image";
|
|
150
|
+
image: HeldImage;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Classes for the paste pills, MERGED onto the defaults rather than replacing them,
|
|
154
|
+
* so a restyle can be one class or a whole new look.
|
|
155
|
+
*/
|
|
156
|
+
interface ComposerPasteClassNames {
|
|
157
|
+
/** Every pill, text or image. */
|
|
158
|
+
pill?: string;
|
|
159
|
+
/** Text pills only — `Pasted text · 669 characters`. */
|
|
160
|
+
textPill?: string;
|
|
161
|
+
/** Image pills only — `Pasted image 1`. */
|
|
162
|
+
imagePill?: string;
|
|
163
|
+
/** The hover popover. */
|
|
164
|
+
preview?: string;
|
|
165
|
+
/** The × discard control (beside-the-input placement only; inline pills are backspaced). */
|
|
166
|
+
remove?: string;
|
|
167
|
+
/** The editable surface itself. */
|
|
168
|
+
input?: string;
|
|
169
|
+
}
|
|
170
|
+
interface ComposerSubmitExtras {
|
|
171
|
+
/**
|
|
172
|
+
* Images still pasted into the message when it was sent, in the order they
|
|
173
|
+
* appear in it. Each one's place in the sent text is marked `[Pasted image N]`,
|
|
174
|
+
* matching its `label`.
|
|
175
|
+
*/
|
|
176
|
+
images: HeldImage[];
|
|
177
|
+
}
|
|
117
178
|
interface ComposerProps {
|
|
118
179
|
value?: string;
|
|
119
180
|
defaultValue?: string;
|
|
120
181
|
onChange?: (value: string) => void;
|
|
121
|
-
|
|
182
|
+
/**
|
|
183
|
+
* The second argument only ever carries anything with `pasteImages` on. A
|
|
184
|
+
* one-argument handler stays valid.
|
|
185
|
+
*/
|
|
186
|
+
onSubmit?: (value: string, extras: ComposerSubmitExtras) => void;
|
|
122
187
|
placeholder?: string;
|
|
123
188
|
actions?: ReactNode;
|
|
124
189
|
disabled?: boolean;
|
|
125
190
|
className?: string;
|
|
126
191
|
/**
|
|
127
|
-
* Hold a paste of at least this many characters
|
|
128
|
-
*
|
|
192
|
+
* Hold a paste of at least this many characters as a pill, instead of inserting
|
|
193
|
+
* it. Try 500 — about a long paragraph.
|
|
129
194
|
*
|
|
130
195
|
* **Omit it and paste behaves exactly as it always has.** Opt-in on purpose:
|
|
131
196
|
* paste is a fundamental interaction and this library is past 1.0, so a minor
|
|
@@ -136,6 +201,37 @@ interface ComposerProps {
|
|
|
136
201
|
* ceremony for an address or a name.
|
|
137
202
|
*/
|
|
138
203
|
pasteThreshold?: number;
|
|
204
|
+
/**
|
|
205
|
+
* Where a pill goes.
|
|
206
|
+
*
|
|
207
|
+
* - `"above"` (default, and the only behaviour before 5.38.0) — in a row above
|
|
208
|
+
* the input; a send appends held text after what was typed.
|
|
209
|
+
* - `"inline"` — **in the message, where the paste happened.** A text pill gets
|
|
210
|
+
* a line to itself; clicking it puts the full text back exactly there; an
|
|
211
|
+
* image pill sits in the sentence. Backspace deletes a pill like a character.
|
|
212
|
+
*
|
|
213
|
+
* With `"inline"`, `value` carries a marker for each pill (see `pasteMarker`),
|
|
214
|
+
* because the message is then the one record of what is attached and where.
|
|
215
|
+
* `onSubmit` always receives the expanded text, never a marker.
|
|
216
|
+
*/
|
|
217
|
+
pastePlacement?: "above" | "inline";
|
|
218
|
+
/**
|
|
219
|
+
* Hold a pasted IMAGE as a pill (`"inline"` placement only). Off by default —
|
|
220
|
+
* turning it on is a promise to read `onSubmit`'s second argument, because a pill
|
|
221
|
+
* reads as "attached" and an image a host never sends is an attachment the
|
|
222
|
+
* person believes went and did not.
|
|
223
|
+
*
|
|
224
|
+
* A clipboard carrying text as well as an image (copying from a document often
|
|
225
|
+
* includes a picture of the selection) pastes the TEXT: the image there is a
|
|
226
|
+
* rendering, not the thing that was copied.
|
|
227
|
+
*/
|
|
228
|
+
pasteImages?: boolean;
|
|
229
|
+
/** Characters of a held text paste shown at EACH end of its hover preview. Default 20. */
|
|
230
|
+
previewChars?: number;
|
|
231
|
+
/** Replace the hover popover's content. Its box is styled by `classNames.preview`. */
|
|
232
|
+
renderPastePreview?: (preview: ComposerPastePreview) => ReactNode;
|
|
233
|
+
/** Restyle the pills and their popover. */
|
|
234
|
+
classNames?: ComposerPasteClassNames;
|
|
139
235
|
/**
|
|
140
236
|
* The held pastes, if you want to own them.
|
|
141
237
|
*
|
|
@@ -146,8 +242,11 @@ interface ComposerProps {
|
|
|
146
242
|
*/
|
|
147
243
|
heldPastes?: HeldPaste[];
|
|
148
244
|
onHeldPastesChange?: (pastes: HeldPaste[]) => void;
|
|
245
|
+
/** The held images, if you want to own them. Same reasoning as `heldPastes`. */
|
|
246
|
+
heldImages?: HeldImage[];
|
|
247
|
+
onHeldImagesChange?: (images: HeldImage[]) => void;
|
|
149
248
|
}
|
|
150
249
|
|
|
151
250
|
declare const Composer: react.ForwardRefExoticComponent<ComposerProps & react.RefAttributes<HTMLDivElement>>;
|
|
152
251
|
|
|
153
|
-
export { Composer as C, type
|
|
252
|
+
export { Composer as C, type HeldImage as H, type PasteEventLike as P, type UsePastePillsOptions as U, type ComposerPasteClassNames as a, type ComposerPastePreview as b, type ComposerProps as c, type ComposerSubmitExtras as d, type HeldPaste as e, type UsePastePillsResult as f, pasteMarker as p, usePastePills as u };
|
|
@@ -56,6 +56,14 @@ interface UsePastePillsResult {
|
|
|
56
56
|
* }
|
|
57
57
|
*/
|
|
58
58
|
handlePaste: (event: PasteEventLike) => boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Hold `text` unconditionally and return the new pill's id.
|
|
61
|
+
*
|
|
62
|
+
* For a host that decides for itself what to hold and needs to know WHICH pill
|
|
63
|
+
* it made — `Composer`'s inline placement puts the pill at the caret, so it needs
|
|
64
|
+
* the id at paste time. Ignores `threshold`; the caller has already decided.
|
|
65
|
+
*/
|
|
66
|
+
hold: (text: string) => string;
|
|
59
67
|
/**
|
|
60
68
|
* Removes the paste and returns its text, for the host to insert into its own
|
|
61
69
|
* surface. `undefined` if there is no such id.
|
|
@@ -111,21 +119,78 @@ interface UsePastePillsResult {
|
|
|
111
119
|
* **It gets no further surface without a real caller.** No extra options, no second
|
|
112
120
|
* hook. An API with one hypothetical consumer is how a package accumulates surface
|
|
113
121
|
* nobody uses.
|
|
122
|
+
*
|
|
123
|
+
* `hold` (5.38.0) met that bar: `Composer`'s inline placement — MOIC's
|
|
124
|
+
* pill-inside-the-message design, built into the component — needs the id of the
|
|
125
|
+
* pill it just made so it can put it at the caret.
|
|
114
126
|
*/
|
|
115
127
|
declare function usePastePills({ threshold, heldPastes: controlledHeldPastes, onHeldPastesChange, }?: UsePastePillsOptions): UsePastePillsResult;
|
|
116
128
|
|
|
129
|
+
/**
|
|
130
|
+
* An image pasted into a `Composer` and held as a pill.
|
|
131
|
+
*
|
|
132
|
+
* `label` is stored rather than derived because the number in it is the order of
|
|
133
|
+
* ARRIVAL: "Pasted image 2" must stay 2 after image 1 is deleted, and nothing left
|
|
134
|
+
* in the list could recompute that.
|
|
135
|
+
*/
|
|
136
|
+
interface HeldImage {
|
|
137
|
+
id: string;
|
|
138
|
+
file: File;
|
|
139
|
+
label: string;
|
|
140
|
+
}
|
|
141
|
+
/** The marker for a held paste or image, for a host or agent writing `value` itself. */
|
|
142
|
+
declare function pasteMarker(id: string): string;
|
|
143
|
+
|
|
144
|
+
/** What a hover preview is being asked to show. */
|
|
145
|
+
type ComposerPastePreview = {
|
|
146
|
+
kind: "text";
|
|
147
|
+
paste: HeldPaste;
|
|
148
|
+
} | {
|
|
149
|
+
kind: "image";
|
|
150
|
+
image: HeldImage;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Classes for the paste pills, MERGED onto the defaults rather than replacing them,
|
|
154
|
+
* so a restyle can be one class or a whole new look.
|
|
155
|
+
*/
|
|
156
|
+
interface ComposerPasteClassNames {
|
|
157
|
+
/** Every pill, text or image. */
|
|
158
|
+
pill?: string;
|
|
159
|
+
/** Text pills only — `Pasted text · 669 characters`. */
|
|
160
|
+
textPill?: string;
|
|
161
|
+
/** Image pills only — `Pasted image 1`. */
|
|
162
|
+
imagePill?: string;
|
|
163
|
+
/** The hover popover. */
|
|
164
|
+
preview?: string;
|
|
165
|
+
/** The × discard control (beside-the-input placement only; inline pills are backspaced). */
|
|
166
|
+
remove?: string;
|
|
167
|
+
/** The editable surface itself. */
|
|
168
|
+
input?: string;
|
|
169
|
+
}
|
|
170
|
+
interface ComposerSubmitExtras {
|
|
171
|
+
/**
|
|
172
|
+
* Images still pasted into the message when it was sent, in the order they
|
|
173
|
+
* appear in it. Each one's place in the sent text is marked `[Pasted image N]`,
|
|
174
|
+
* matching its `label`.
|
|
175
|
+
*/
|
|
176
|
+
images: HeldImage[];
|
|
177
|
+
}
|
|
117
178
|
interface ComposerProps {
|
|
118
179
|
value?: string;
|
|
119
180
|
defaultValue?: string;
|
|
120
181
|
onChange?: (value: string) => void;
|
|
121
|
-
|
|
182
|
+
/**
|
|
183
|
+
* The second argument only ever carries anything with `pasteImages` on. A
|
|
184
|
+
* one-argument handler stays valid.
|
|
185
|
+
*/
|
|
186
|
+
onSubmit?: (value: string, extras: ComposerSubmitExtras) => void;
|
|
122
187
|
placeholder?: string;
|
|
123
188
|
actions?: ReactNode;
|
|
124
189
|
disabled?: boolean;
|
|
125
190
|
className?: string;
|
|
126
191
|
/**
|
|
127
|
-
* Hold a paste of at least this many characters
|
|
128
|
-
*
|
|
192
|
+
* Hold a paste of at least this many characters as a pill, instead of inserting
|
|
193
|
+
* it. Try 500 — about a long paragraph.
|
|
129
194
|
*
|
|
130
195
|
* **Omit it and paste behaves exactly as it always has.** Opt-in on purpose:
|
|
131
196
|
* paste is a fundamental interaction and this library is past 1.0, so a minor
|
|
@@ -136,6 +201,37 @@ interface ComposerProps {
|
|
|
136
201
|
* ceremony for an address or a name.
|
|
137
202
|
*/
|
|
138
203
|
pasteThreshold?: number;
|
|
204
|
+
/**
|
|
205
|
+
* Where a pill goes.
|
|
206
|
+
*
|
|
207
|
+
* - `"above"` (default, and the only behaviour before 5.38.0) — in a row above
|
|
208
|
+
* the input; a send appends held text after what was typed.
|
|
209
|
+
* - `"inline"` — **in the message, where the paste happened.** A text pill gets
|
|
210
|
+
* a line to itself; clicking it puts the full text back exactly there; an
|
|
211
|
+
* image pill sits in the sentence. Backspace deletes a pill like a character.
|
|
212
|
+
*
|
|
213
|
+
* With `"inline"`, `value` carries a marker for each pill (see `pasteMarker`),
|
|
214
|
+
* because the message is then the one record of what is attached and where.
|
|
215
|
+
* `onSubmit` always receives the expanded text, never a marker.
|
|
216
|
+
*/
|
|
217
|
+
pastePlacement?: "above" | "inline";
|
|
218
|
+
/**
|
|
219
|
+
* Hold a pasted IMAGE as a pill (`"inline"` placement only). Off by default —
|
|
220
|
+
* turning it on is a promise to read `onSubmit`'s second argument, because a pill
|
|
221
|
+
* reads as "attached" and an image a host never sends is an attachment the
|
|
222
|
+
* person believes went and did not.
|
|
223
|
+
*
|
|
224
|
+
* A clipboard carrying text as well as an image (copying from a document often
|
|
225
|
+
* includes a picture of the selection) pastes the TEXT: the image there is a
|
|
226
|
+
* rendering, not the thing that was copied.
|
|
227
|
+
*/
|
|
228
|
+
pasteImages?: boolean;
|
|
229
|
+
/** Characters of a held text paste shown at EACH end of its hover preview. Default 20. */
|
|
230
|
+
previewChars?: number;
|
|
231
|
+
/** Replace the hover popover's content. Its box is styled by `classNames.preview`. */
|
|
232
|
+
renderPastePreview?: (preview: ComposerPastePreview) => ReactNode;
|
|
233
|
+
/** Restyle the pills and their popover. */
|
|
234
|
+
classNames?: ComposerPasteClassNames;
|
|
139
235
|
/**
|
|
140
236
|
* The held pastes, if you want to own them.
|
|
141
237
|
*
|
|
@@ -146,8 +242,11 @@ interface ComposerProps {
|
|
|
146
242
|
*/
|
|
147
243
|
heldPastes?: HeldPaste[];
|
|
148
244
|
onHeldPastesChange?: (pastes: HeldPaste[]) => void;
|
|
245
|
+
/** The held images, if you want to own them. Same reasoning as `heldPastes`. */
|
|
246
|
+
heldImages?: HeldImage[];
|
|
247
|
+
onHeldImagesChange?: (images: HeldImage[]) => void;
|
|
149
248
|
}
|
|
150
249
|
|
|
151
250
|
declare const Composer: react.ForwardRefExoticComponent<ComposerProps & react.RefAttributes<HTMLDivElement>>;
|
|
152
251
|
|
|
153
|
-
export { Composer as C, type
|
|
252
|
+
export { Composer as C, type HeldImage as H, type PasteEventLike as P, type UsePastePillsOptions as U, type ComposerPasteClassNames as a, type ComposerPastePreview as b, type ComposerProps as c, type ComposerSubmitExtras as d, type HeldPaste as e, type UsePastePillsResult as f, pasteMarker as p, usePastePills as u };
|