@adea-ai/ui 0.150.0 → 0.151.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/dist/components/composites/inline-citation/inline-citation.d.ts +2 -1
- package/dist/components/composites/inline-citation/inline-citation.d.ts.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.js +36 -3
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.d.ts +5 -0
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.d.ts.map +1 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js +54 -23
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +9 -4
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/dialog/dialog.js +1 -1
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.d.ts +18 -3
- package/dist/components/ui/modal-dialog/modal-dialog.d.ts.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js +29 -3
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +53 -4
- package/dist/r/src/components/layout/contextual-sidebar/contextual-sidebar.tsx +76 -28
- package/dist/r/src/components/ui/alert-dialog/alert-dialog.tsx +11 -2
- package/dist/r/src/components/ui/dialog/dialog.tsx +1 -1
- package/dist/r/src/components/ui/modal-dialog/modal-dialog.tsx +33 -4
- package/package.json +1 -1
- package/src/components/composites/inline-citation/inline-citation.tsx +53 -4
- package/src/components/layout/contextual-sidebar/contextual-sidebar.tsx +76 -28
- package/src/components/ui/alert-dialog/alert-dialog.tsx +11 -2
- package/src/components/ui/dialog/dialog.tsx +1 -1
- package/src/components/ui/modal-dialog/modal-dialog.tsx +33 -4
|
@@ -17,7 +17,8 @@ import { type Source } from '../sources/source';
|
|
|
17
17
|
*
|
|
18
18
|
* - **Hover or keyboard focus peeks.** The popover opens without taking focus
|
|
19
19
|
* and closes when the pointer or focus leaves. Touch has no hover, so a touch
|
|
20
|
-
* never peeks.
|
|
20
|
+
* never peeks. A keyboard peek's card is inert, so Tab moves on from the badge
|
|
21
|
+
* to the next control on the page instead of into a card that is closing.
|
|
21
22
|
* - **Click, tap, Enter or Space pins.** Focus moves into the popover so its
|
|
22
23
|
* link and Previous/Next are reachable; it stays until Escape, an outside press,
|
|
23
24
|
* or the badge is pressed again, and focus returns to the badge. Pressing a badge
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-citation.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/inline-citation/inline-citation.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAGxD,OAAO,EAML,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAA;AAU1B
|
|
1
|
+
{"version":3,"file":"inline-citation.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/inline-citation/inline-citation.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAGxD,OAAO,EAML,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAA;AAU1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,0DAA0D;IAC1D,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAID,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,kCAiMxD;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,gBAAgB,CAa7E"}
|
|
@@ -7,7 +7,7 @@ import { boundText, safeSourceUrl, sourceHost, sourceTitle } from "../sources/so
|
|
|
7
7
|
import { citationLabel, citationName, nextCitationMode, wrapIndex } from "./citation.js";
|
|
8
8
|
import { createComponent, insert, memo, template } from "solid-js/web";
|
|
9
9
|
import { ChevronLeft, ChevronRight } from "lucide-solid";
|
|
10
|
-
import { Show, createSignal, onCleanup, splitProps } from "solid-js";
|
|
10
|
+
import { Show, createEffect, createSignal, onCleanup, splitProps } from "solid-js";
|
|
11
11
|
// src/components/composites/inline-citation/inline-citation.tsx
|
|
12
12
|
var _tmpl$ = /*#__PURE__*/ template(`<span aria-hidden=true class="max-w-32 truncate">`);
|
|
13
13
|
var _tmpl$2 = /*#__PURE__*/ template(`<span aria-hidden=true>+`);
|
|
@@ -31,6 +31,18 @@ function InlineCitation(props) {
|
|
|
31
31
|
let content;
|
|
32
32
|
let pressing = false;
|
|
33
33
|
let restoringFocus = false;
|
|
34
|
+
const [keyboardPeek, setKeyboardPeek] = createSignal(false);
|
|
35
|
+
let focusInCard = false;
|
|
36
|
+
let escapeClosedTooltip = false;
|
|
37
|
+
const onWindowKeyDown = (event) => {
|
|
38
|
+
if (event.key !== "Escape") return;
|
|
39
|
+
escapeClosedTooltip = content?.ownerDocument.querySelector("[data-slot=\"tooltip-content\"][data-expanded]") != null;
|
|
40
|
+
};
|
|
41
|
+
createEffect(() => {
|
|
42
|
+
if (mode() !== "pinned" || typeof window === "undefined") return;
|
|
43
|
+
window.addEventListener("keydown", onWindowKeyDown, true);
|
|
44
|
+
onCleanup(() => window.removeEventListener("keydown", onWindowKeyDown, true));
|
|
45
|
+
});
|
|
34
46
|
const count = () => local.sources.length;
|
|
35
47
|
const active = () => local.sources[wrapIndex(position(), count())];
|
|
36
48
|
const clear = () => {
|
|
@@ -38,7 +50,12 @@ function InlineCitation(props) {
|
|
|
38
50
|
timer = void 0;
|
|
39
51
|
};
|
|
40
52
|
onCleanup(clear);
|
|
41
|
-
const dispatch = (event) => setMode((current) =>
|
|
53
|
+
const dispatch = (event) => setMode((current) => {
|
|
54
|
+
const next = nextCitationMode(current, event);
|
|
55
|
+
if (next !== "peek") setKeyboardPeek(false);
|
|
56
|
+
else if (current === "closed") setKeyboardPeek(event === "focus");
|
|
57
|
+
return next;
|
|
58
|
+
});
|
|
42
59
|
const schedule = (event, delay) => {
|
|
43
60
|
clear();
|
|
44
61
|
timer = setTimeout(() => dispatch(event), delay);
|
|
@@ -115,11 +132,27 @@ function InlineCitation(props) {
|
|
|
115
132
|
}
|
|
116
133
|
}), createComponent(PopoverContent, {
|
|
117
134
|
ref: (element) => content = element,
|
|
135
|
+
get inert() {
|
|
136
|
+
return keyboardPeek() || mode() === "closed" || void 0;
|
|
137
|
+
},
|
|
118
138
|
"class": "w-72 max-w-full",
|
|
119
139
|
onOpenAutoFocus: (event) => {
|
|
120
140
|
if (mode() === "peek") event.preventDefault();
|
|
121
141
|
},
|
|
122
|
-
|
|
142
|
+
onFocusIn: () => {
|
|
143
|
+
focusInCard = true;
|
|
144
|
+
},
|
|
145
|
+
onKeyDown: (event) => {
|
|
146
|
+
if (event.key !== "Escape" || escapeClosedTooltip || mode() !== "pinned") return;
|
|
147
|
+
dispatch("dismiss");
|
|
148
|
+
},
|
|
149
|
+
onCloseAutoFocus: (event) => {
|
|
150
|
+
const returnFocus = focusInCard;
|
|
151
|
+
focusInCard = false;
|
|
152
|
+
if (!returnFocus) {
|
|
153
|
+
event.preventDefault();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
123
156
|
restoringFocus = true;
|
|
124
157
|
queueMicrotask(() => {
|
|
125
158
|
restoringFocus = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-citation.js","names":["ChevronLeft","ChevronRight","createSignal","onCleanup","Show","splitProps","cn","ActionButton","Button","MessageCitations","Popover","PopoverContent","PopoverTitle","PopoverTrigger","TextLink","SOURCE_SNIPPET_LIMIT","boundText","safeSourceUrl","sourceHost","sourceTitle","Source","citationLabel","citationName","nextCitationMode","wrapIndex","CitationEvent","CitationMode","InlineCitationProps","sources","index","hoverDelay","class","LEAVE_DELAY","InlineCitation","props","local","mode","setMode","position","setPosition","timer","ReturnType","setTimeout","content","HTMLElement","pressing","restoringFocus","count","length","active","clear","undefined","clearTimeout","dispatch","event","current","schedule","delay","onPointerEnter","PointerEvent","pointerType","onPointerLeave","onClick","wasPeeking","queueMicrotask","focus","_$createComponent","when","children","open","onOpenChange","next","placement","gutter","as","variant","size","touchTarget","aria-label","onFocus","FocusEvent","currentTarget","matches","onBlur","_el$","_tmpl$","_$insert","_el$2","_tmpl$2","_el$3","firstChild","ref","element","onOpenAutoFocus","Event","preventDefault","onCloseAutoFocus","source","_el$4","_tmpl$4","_el$5","_tmpl$3","_el$6","_el$7","_el$9","nextSibling","_el$8","_el$0","tooltip","value","CitationDetails","messageCitations","render","numbers","flatMap","number","href","url","host","snippet","withheld","_el$1","_tmpl$5","target","rel","_$memo","_tmpl$8","_tmpl$6","_el$11","_tmpl$7","_$createComponent","_$memo"],"sources":["../../../../src/components/composites/inline-citation/inline-citation.tsx"],"sourcesContent":["import { ChevronLeft, ChevronRight } from 'lucide-solid'\nimport { createSignal, onCleanup, Show, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { ActionButton } from '../action-button'\nimport { Button } from '../../ui/button'\nimport type { MessageCitations } from '../../ui/message'\nimport { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from '../../ui/popover'\nimport { TextLink } from '../../ui/text-link'\nimport {\n SOURCE_SNIPPET_LIMIT,\n boundText,\n safeSourceUrl,\n sourceHost,\n sourceTitle,\n type Source,\n} from '../sources/source'\nimport {\n citationLabel,\n citationName,\n nextCitationMode,\n wrapIndex,\n type CitationEvent,\n type CitationMode,\n} from './citation'\n\n/**\n * InlineCitation.\n *\n * A small badge inside a sentence — \"1\", or a host — that opens the source(s)\n * behind the claim: title, host, address, snippet, and Previous/Next when several\n * sources share one marker. It is an inline element for prose such as\n * `MessageText`: it never breaks across lines, stays on the text baseline, and\n * adds no block of its own. For the list of everything a reply used, reach for\n * `Sources`; the two number sources the same way.\n *\n * ## One popover, two ways to open it\n *\n * A hover card would exclude everyone who is not holding a mouse, so this is a\n * `Popover` that a pointer can also *peek* at:\n *\n * - **Hover or keyboard focus peeks.** The popover opens without taking focus\n * and closes when the pointer or focus leaves. Touch has no hover, so a touch\n * never peeks.\n * - **Click, tap, Enter or Space pins.** Focus moves into the popover so its\n * link and Previous/Next are reachable; it stays until Escape, an outside press,\n * or the badge is pressed again, and focus returns to the badge. Pressing a badge\n * that is only peeking pins it rather than toggling it shut — the transitions\n * are the pure `nextCitationMode`.\n *\n * Kobalte's trigger toggles on every press, so `open` is controlled and its own\n * close request is ignored for the press that we already decided (`pressing`).\n * Without that, hover-then-click, the commonest pointer path, would close the card.\n *\n * ## It makes no claim without sources\n *\n * No sources renders nothing: a marker that points nowhere is not a citation.\n * The address is a link only when `safeSourceUrl` allows it; the host comes from\n * the parsed URL; titles and snippets are clipped, cleaned of direction\n * overrides and rendered as text. The badge's accessible name carries the title\n * and host (the visible label is only a number or a host), so a reader hears\n * what is cited without opening anything.\n */\nexport type InlineCitationProps = {\n /** One source, or several that support the same claim. */\n sources: readonly Source[]\n /**\n * The 1-based number to show, matching the source's position in `Sources`.\n * Omit it to show the host instead; a number is never guessed.\n */\n index?: number\n /** Milliseconds a pointer rests before the peek opens. */\n hoverDelay?: number\n class?: string\n}\n\nconst LEAVE_DELAY = 200\n\nexport function InlineCitation(props: InlineCitationProps) {\n const [local] = splitProps(props, ['sources', 'index', 'hoverDelay', 'class'])\n const [mode, setMode] = createSignal<CitationMode>('closed')\n const [position, setPosition] = createSignal(0)\n let timer: ReturnType<typeof setTimeout> | undefined\n let content: HTMLElement | undefined\n let pressing = false\n // Focus handed back to the badge as the popover closes is not a request to\n // peek again; without this, Escape from a pinned card reopens it as a preview.\n let restoringFocus = false\n\n const count = () => local.sources.length\n const active = () => local.sources[wrapIndex(position(), count())]\n const clear = () => {\n if (timer !== undefined) clearTimeout(timer)\n timer = undefined\n }\n onCleanup(clear)\n\n const dispatch = (event: CitationEvent) => setMode((current) => nextCitationMode(current, event))\n const schedule = (event: CitationEvent, delay: number) => {\n clear()\n timer = setTimeout(() => dispatch(event), delay)\n }\n\n const onPointerEnter = (event: PointerEvent) => {\n if (event.pointerType === 'touch') return\n schedule('enter', local.hoverDelay ?? 150)\n }\n const onPointerLeave = (event: PointerEvent) => {\n if (event.pointerType === 'touch') return\n schedule('leave', LEAVE_DELAY)\n }\n\n const onClick = () => {\n clear()\n const wasPeeking = mode() === 'peek'\n dispatch('press')\n // Kobalte toggles right after this handler; its request is not a dismissal.\n pressing = true\n queueMicrotask(() => {\n pressing = false\n })\n // The peek never took focus; a deliberate press must hand it over.\n if (wasPeeking) queueMicrotask(() => content?.focus())\n }\n\n return (\n <Show when={count() > 0}>\n <Popover\n open={mode() !== 'closed'}\n onOpenChange={(next) => {\n if (!next && !pressing) dispatch('dismiss')\n }}\n placement=\"bottom\"\n gutter={6}\n >\n <PopoverTrigger\n as={Button}\n variant=\"subtle\"\n size=\"2xs\"\n touchTarget=\"comfortable\"\n data-slot=\"inline-citation\"\n aria-label={citationName(local.sources, local.index)}\n class={cn('mx-0.5 align-baseline tabular-nums', local.class)}\n onClick={onClick}\n onPointerEnter={onPointerEnter}\n onPointerLeave={onPointerLeave}\n onFocus={(event: FocusEvent & { currentTarget: HTMLElement }) => {\n // Mouse focus follows the press; only keyboard focus peeks.\n if (restoringFocus) return\n if (event.currentTarget.matches(':focus-visible')) dispatch('focus')\n }}\n onBlur={() => dispatch('blur')}\n >\n <span aria-hidden=\"true\" class=\"max-w-32 truncate\">\n {citationLabel(local.index, local.sources[0])}\n </span>\n <Show when={count() > 1}>\n <span aria-hidden=\"true\">+{count() - 1}</span>\n </Show>\n </PopoverTrigger>\n <PopoverContent\n ref={(element: HTMLElement) => (content = element)}\n class=\"w-72 max-w-full\"\n onOpenAutoFocus={(event: Event) => {\n if (mode() === 'peek') event.preventDefault()\n }}\n onCloseAutoFocus={() => {\n // The focus move that follows is synchronous; the microtask ends the window.\n restoringFocus = true\n queueMicrotask(() => {\n restoringFocus = false\n })\n }}\n onPointerEnter={(event: PointerEvent) => {\n if (event.pointerType !== 'touch') clear()\n }}\n onPointerLeave={onPointerLeave}\n >\n <Show when={active()}>\n {(source) => (\n <div class=\"flex min-w-0 flex-col gap-1.5 px-2 py-1.5\">\n <Show when={count() > 1}>\n <div class=\"flex items-center justify-between gap-2\">\n <span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>\n <span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>\n </div>\n </Show>\n <PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>\n <CitationDetails source={source()} />\n </div>\n )}\n </Show>\n </PopoverContent>\n </Popover>\n </Show>\n )\n}\n\n/**\n * Citation markers for `MessageText`, from the sources a reply really used.\n *\n * `[^2]` in the text becomes the second source's badge; `[^1,3]` one badge for\n * sources 1 and 3. A number beyond the list leaves the marker as written, and an\n * empty list makes every marker literal, so text can never cite a source the host\n * did not supply.\n *\n * <MessageText text={reply} citations={messageCitations(sources)} />\n */\nexport function messageCitations(sources: readonly Source[]): MessageCitations {\n return {\n count: sources.length,\n render: (numbers) => (\n <InlineCitation\n index={numbers[0]}\n sources={numbers.flatMap((number) => {\n const source = sources[number - 1]\n return source ? [source] : []\n })}\n />\n ),\n }\n}\n\nfunction CitationDetails(props: { source: Source }) {\n const href = () => safeSourceUrl(props.source.url)\n const host = () => sourceHost(props.source.url)\n const snippet = () =>\n props.source.snippet ? boundText(props.source.snippet, SOURCE_SNIPPET_LIMIT) : ''\n const withheld = () => props.source.url !== undefined && props.source.url !== '' && !href()\n\n return (\n <>\n <Show when={host()}>\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">{host()}</p>\n </Show>\n <Show when={href()}>\n {(url) => (\n <TextLink\n href={url()}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class=\"w-fit max-w-full text-xs [overflow-wrap:anywhere]\"\n >\n {boundText(url(), 96)}\n <span class=\"visually-hidden\"> (opens in a new tab)</span>\n </TextLink>\n )}\n </Show>\n <Show when={withheld()}>\n <p class=\"m-0 text-xs text-muted-foreground\">Address not linked</p>\n </Show>\n <Show when={snippet()}>\n <p class=\"m-0 line-clamp-6 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {snippet()}\n </p>\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2EA,IAAMgC,cAAc;AAEpB,SAAgBC,eAAeC,OAA4B;CACzD,MAAM,CAACC,SAAS9B,WAAW6B,OAAO;EAAC;EAAW;EAAS;EAAc;CAAO,CAAC;CAC7E,MAAM,CAACE,MAAMC,WAAWnC,aAA2B,QAAQ;CAC3D,MAAM,CAACoC,UAAUC,eAAerC,aAAa,CAAC;CAC9C,IAAIsC;CACJ,IAAIG;CACJ,IAAIE,WAAW;CAGf,IAAIC,iBAAiB;CAErB,MAAMC,cAAcZ,MAAMP,QAAQoB;CAClC,MAAMC,eAAed,MAAMP,QAAQJ,UAAUc,SAAS,GAAGS,MAAM,CAAC;CAChE,MAAMG,cAAc;EAClB,IAAIV,UAAUW,KAAAA,GAAWC,aAAaZ,KAAK;E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A4D,SAAAC,QAAA;IAAA3C,OAAA0C,QAEhBT,OAAO;IAAA,OAAAS;GAAA;EAAA,CAAA;CAAA;AAKlB"}
|
|
1
|
+
{"version":3,"file":"inline-citation.js","names":["ChevronLeft","ChevronRight","createEffect","createSignal","onCleanup","Show","splitProps","cn","ActionButton","Button","MessageCitations","Popover","PopoverContent","PopoverTitle","PopoverTrigger","TextLink","SOURCE_SNIPPET_LIMIT","boundText","safeSourceUrl","sourceHost","sourceTitle","Source","citationLabel","citationName","nextCitationMode","wrapIndex","CitationEvent","CitationMode","InlineCitationProps","sources","index","hoverDelay","class","LEAVE_DELAY","InlineCitation","props","local","mode","setMode","position","setPosition","timer","ReturnType","setTimeout","content","HTMLElement","pressing","restoringFocus","keyboardPeek","setKeyboardPeek","focusInCard","escapeClosedTooltip","onWindowKeyDown","event","KeyboardEvent","key","ownerDocument","querySelector","window","addEventListener","removeEventListener","count","length","active","clear","undefined","clearTimeout","dispatch","current","next","schedule","delay","onPointerEnter","PointerEvent","pointerType","onPointerLeave","onClick","wasPeeking","queueMicrotask","focus","_$createComponent","when","children","open","onOpenChange","placement","gutter","as","variant","size","touchTarget","aria-label","onFocus","FocusEvent","currentTarget","matches","onBlur","_el$","_tmpl$","_$insert","_el$2","_tmpl$2","_el$3","firstChild","ref","element","inert","onOpenAutoFocus","Event","preventDefault","onFocusIn","onKeyDown","onCloseAutoFocus","returnFocus","source","_el$4","_tmpl$4","_el$5","_tmpl$3","_el$6","_el$7","_el$9","nextSibling","_el$8","_el$0","tooltip","value","CitationDetails","messageCitations","render","numbers","flatMap","number","href","url","host","snippet","withheld","_el$1","_tmpl$5","target","rel","_$memo","_tmpl$8","_tmpl$6","_el$11","_tmpl$7","_$createComponent","_$memo"],"sources":["../../../../src/components/composites/inline-citation/inline-citation.tsx"],"sourcesContent":["import { ChevronLeft, ChevronRight } from 'lucide-solid'\nimport { createEffect, createSignal, onCleanup, Show, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { ActionButton } from '../action-button'\nimport { Button } from '../../ui/button'\nimport type { MessageCitations } from '../../ui/message'\nimport { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from '../../ui/popover'\nimport { TextLink } from '../../ui/text-link'\nimport {\n SOURCE_SNIPPET_LIMIT,\n boundText,\n safeSourceUrl,\n sourceHost,\n sourceTitle,\n type Source,\n} from '../sources/source'\nimport {\n citationLabel,\n citationName,\n nextCitationMode,\n wrapIndex,\n type CitationEvent,\n type CitationMode,\n} from './citation'\n\n/**\n * InlineCitation.\n *\n * A small badge inside a sentence — \"1\", or a host — that opens the source(s)\n * behind the claim: title, host, address, snippet, and Previous/Next when several\n * sources share one marker. It is an inline element for prose such as\n * `MessageText`: it never breaks across lines, stays on the text baseline, and\n * adds no block of its own. For the list of everything a reply used, reach for\n * `Sources`; the two number sources the same way.\n *\n * ## One popover, two ways to open it\n *\n * A hover card would exclude everyone who is not holding a mouse, so this is a\n * `Popover` that a pointer can also *peek* at:\n *\n * - **Hover or keyboard focus peeks.** The popover opens without taking focus\n * and closes when the pointer or focus leaves. Touch has no hover, so a touch\n * never peeks. A keyboard peek's card is inert, so Tab moves on from the badge\n * to the next control on the page instead of into a card that is closing.\n * - **Click, tap, Enter or Space pins.** Focus moves into the popover so its\n * link and Previous/Next are reachable; it stays until Escape, an outside press,\n * or the badge is pressed again, and focus returns to the badge. Pressing a badge\n * that is only peeking pins it rather than toggling it shut — the transitions\n * are the pure `nextCitationMode`.\n *\n * Kobalte's trigger toggles on every press, so `open` is controlled and its own\n * close request is ignored for the press that we already decided (`pressing`).\n * Without that, hover-then-click, the commonest pointer path, would close the card.\n *\n * ## It makes no claim without sources\n *\n * No sources renders nothing: a marker that points nowhere is not a citation.\n * The address is a link only when `safeSourceUrl` allows it; the host comes from\n * the parsed URL; titles and snippets are clipped, cleaned of direction\n * overrides and rendered as text. The badge's accessible name carries the title\n * and host (the visible label is only a number or a host), so a reader hears\n * what is cited without opening anything.\n */\nexport type InlineCitationProps = {\n /** One source, or several that support the same claim. */\n sources: readonly Source[]\n /**\n * The 1-based number to show, matching the source's position in `Sources`.\n * Omit it to show the host instead; a number is never guessed.\n */\n index?: number\n /** Milliseconds a pointer rests before the peek opens. */\n hoverDelay?: number\n class?: string\n}\n\nconst LEAVE_DELAY = 200\n\nexport function InlineCitation(props: InlineCitationProps) {\n const [local] = splitProps(props, ['sources', 'index', 'hoverDelay', 'class'])\n const [mode, setMode] = createSignal<CitationMode>('closed')\n const [position, setPosition] = createSignal(0)\n let timer: ReturnType<typeof setTimeout> | undefined\n let content: HTMLElement | undefined\n let pressing = false\n // Focus handed back to the badge as the popover closes is not a request to\n // peek again; without this, Escape from a pinned card reopens it as a preview.\n let restoringFocus = false\n // A keyboard peek is a preview of the badge the reader is already on. Its card\n // sits in a portal at the end of the document, so if it stayed tabbable, Tab\n // from the badge would walk into the card, the card would close behind the\n // focus as the badge blurred, and focus would fall to <body> and be pulled\n // back to the badge: a keyboard trap. The card is inert until Enter or Space\n // pins it, and while it closes. A pointer peek stays interactive.\n const [keyboardPeek, setKeyboardPeek] = createSignal(false)\n // Focus goes back to the badge only when it was in the card. A peek never\n // held focus, and its close (finishing after its exit animation) must not\n // pull the reader back from wherever Tab has taken them since.\n let focusInCard = false\n // Escape closes the innermost layer first: an open Previous/Next tooltip, then\n // the card. Kobalte only lets the top-most layer take Escape, and a tooltip\n // that just closed stays the top layer while it animates out, so a second\n // Escape pressed during that exit used to vanish and leave the card open.\n // Whether a tooltip was open is read before any handler runs (window,\n // capture); an Escape that closed nothing else closes the card itself.\n let escapeClosedTooltip = false\n const onWindowKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return\n escapeClosedTooltip =\n content?.ownerDocument.querySelector('[data-slot=\"tooltip-content\"][data-expanded]') != null\n }\n createEffect(() => {\n if (mode() !== 'pinned' || typeof window === 'undefined') return\n window.addEventListener('keydown', onWindowKeyDown, true)\n onCleanup(() => window.removeEventListener('keydown', onWindowKeyDown, true))\n })\n\n const count = () => local.sources.length\n const active = () => local.sources[wrapIndex(position(), count())]\n const clear = () => {\n if (timer !== undefined) clearTimeout(timer)\n timer = undefined\n }\n onCleanup(clear)\n\n const dispatch = (event: CitationEvent) =>\n setMode((current) => {\n const next = nextCitationMode(current, event)\n if (next !== 'peek') setKeyboardPeek(false)\n else if (current === 'closed') setKeyboardPeek(event === 'focus')\n return next\n })\n const schedule = (event: CitationEvent, delay: number) => {\n clear()\n timer = setTimeout(() => dispatch(event), delay)\n }\n\n const onPointerEnter = (event: PointerEvent) => {\n if (event.pointerType === 'touch') return\n schedule('enter', local.hoverDelay ?? 150)\n }\n const onPointerLeave = (event: PointerEvent) => {\n if (event.pointerType === 'touch') return\n schedule('leave', LEAVE_DELAY)\n }\n\n const onClick = () => {\n clear()\n const wasPeeking = mode() === 'peek'\n dispatch('press')\n // Kobalte toggles right after this handler; its request is not a dismissal.\n pressing = true\n queueMicrotask(() => {\n pressing = false\n })\n // The peek never took focus; a deliberate press must hand it over.\n if (wasPeeking) queueMicrotask(() => content?.focus())\n }\n\n return (\n <Show when={count() > 0}>\n <Popover\n open={mode() !== 'closed'}\n onOpenChange={(next) => {\n if (!next && !pressing) dispatch('dismiss')\n }}\n placement=\"bottom\"\n gutter={6}\n >\n <PopoverTrigger\n as={Button}\n variant=\"subtle\"\n size=\"2xs\"\n touchTarget=\"comfortable\"\n data-slot=\"inline-citation\"\n aria-label={citationName(local.sources, local.index)}\n class={cn('mx-0.5 align-baseline tabular-nums', local.class)}\n onClick={onClick}\n onPointerEnter={onPointerEnter}\n onPointerLeave={onPointerLeave}\n onFocus={(event: FocusEvent & { currentTarget: HTMLElement }) => {\n // Mouse focus follows the press; only keyboard focus peeks.\n if (restoringFocus) return\n if (event.currentTarget.matches(':focus-visible')) dispatch('focus')\n }}\n onBlur={() => dispatch('blur')}\n >\n <span aria-hidden=\"true\" class=\"max-w-32 truncate\">\n {citationLabel(local.index, local.sources[0])}\n </span>\n <Show when={count() > 1}>\n <span aria-hidden=\"true\">+{count() - 1}</span>\n </Show>\n </PopoverTrigger>\n <PopoverContent\n ref={(element: HTMLElement) => (content = element)}\n inert={keyboardPeek() || mode() === 'closed' || undefined}\n class=\"w-72 max-w-full\"\n onOpenAutoFocus={(event: Event) => {\n if (mode() === 'peek') event.preventDefault()\n }}\n onFocusIn={() => {\n focusInCard = true\n }}\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key !== 'Escape' || escapeClosedTooltip || mode() !== 'pinned') return\n dispatch('dismiss')\n }}\n onCloseAutoFocus={(event: Event) => {\n const returnFocus = focusInCard\n focusInCard = false\n if (!returnFocus) {\n event.preventDefault()\n return\n }\n // The focus move that follows is synchronous; the microtask ends the window.\n restoringFocus = true\n queueMicrotask(() => {\n restoringFocus = false\n })\n }}\n onPointerEnter={(event: PointerEvent) => {\n if (event.pointerType !== 'touch') clear()\n }}\n onPointerLeave={onPointerLeave}\n >\n <Show when={active()}>\n {(source) => (\n <div class=\"flex min-w-0 flex-col gap-1.5 px-2 py-1.5\">\n <Show when={count() > 1}>\n <div class=\"flex items-center justify-between gap-2\">\n <span\n role=\"status\"\n aria-live=\"polite\"\n class=\"text-xs text-muted-foreground tabular-nums\"\n >\n Source {wrapIndex(position(), count()) + 1} of {count()}\n </span>\n <span class=\"flex items-center gap-0.5\">\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Previous source\"\n tooltip=\"Previous source\"\n onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}\n >\n <ChevronLeft />\n </ActionButton>\n <ActionButton\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label=\"Next source\"\n tooltip=\"Next source\"\n onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}\n >\n <ChevronRight />\n </ActionButton>\n </span>\n </div>\n </Show>\n <PopoverTitle class=\"p-0 [overflow-wrap:anywhere]\">\n {sourceTitle(source())}\n </PopoverTitle>\n <CitationDetails source={source()} />\n </div>\n )}\n </Show>\n </PopoverContent>\n </Popover>\n </Show>\n )\n}\n\n/**\n * Citation markers for `MessageText`, from the sources a reply really used.\n *\n * `[^2]` in the text becomes the second source's badge; `[^1,3]` one badge for\n * sources 1 and 3. A number beyond the list leaves the marker as written, and an\n * empty list makes every marker literal, so text can never cite a source the host\n * did not supply.\n *\n * <MessageText text={reply} citations={messageCitations(sources)} />\n */\nexport function messageCitations(sources: readonly Source[]): MessageCitations {\n return {\n count: sources.length,\n render: (numbers) => (\n <InlineCitation\n index={numbers[0]}\n sources={numbers.flatMap((number) => {\n const source = sources[number - 1]\n return source ? [source] : []\n })}\n />\n ),\n }\n}\n\nfunction CitationDetails(props: { source: Source }) {\n const href = () => safeSourceUrl(props.source.url)\n const host = () => sourceHost(props.source.url)\n const snippet = () =>\n props.source.snippet ? boundText(props.source.snippet, SOURCE_SNIPPET_LIMIT) : ''\n const withheld = () => props.source.url !== undefined && props.source.url !== '' && !href()\n\n return (\n <>\n <Show when={host()}>\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">{host()}</p>\n </Show>\n <Show when={href()}>\n {(url) => (\n <TextLink\n href={url()}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class=\"w-fit max-w-full text-xs [overflow-wrap:anywhere]\"\n >\n {boundText(url(), 96)}\n <span class=\"visually-hidden\"> (opens in a new tab)</span>\n </TextLink>\n )}\n </Show>\n <Show when={withheld()}>\n <p class=\"m-0 text-xs text-muted-foreground\">Address not linked</p>\n </Show>\n <Show when={snippet()}>\n <p class=\"m-0 line-clamp-6 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {snippet()}\n </p>\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4EA,IAAMiC,cAAc;AAEpB,SAAgBC,eAAeC,OAA4B;CACzD,MAAM,CAACC,SAAS9B,WAAW6B,OAAO;EAAC;EAAW;EAAS;EAAc;CAAO,CAAC;CAC7E,MAAM,CAACE,MAAMC,WAAWnC,aAA2B,QAAQ;CAC3D,MAAM,CAACoC,UAAUC,eAAer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AAA;CAAA;AAKlB"}
|
|
@@ -22,6 +22,11 @@ export type ContextualSidebarProps = {
|
|
|
22
22
|
/** Host-controlled expanded state for the desktop panel and mobile dialog. */
|
|
23
23
|
open: boolean;
|
|
24
24
|
onOpenChange(open: boolean): void;
|
|
25
|
+
/**
|
|
26
|
+
* Presentation mode. `auto` (default) uses the built-in viewport breakpoint;
|
|
27
|
+
* hosts can select `desktop` or the shared mobile `Sheet` themselves.
|
|
28
|
+
*/
|
|
29
|
+
responsiveMode?: 'auto' | 'desktop' | 'mobile';
|
|
25
30
|
/** Current host-owned pixel width, reflected by the resize handle. */
|
|
26
31
|
width: number;
|
|
27
32
|
minimum: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextual-sidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/contextual-sidebar/contextual-sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAe7C,MAAM,MAAM,8BAA8B,GAAG;IAC3C,wEAAwE;IACxE,MAAM,EAAE,OAAO,CAAA;IACf,qFAAqF;IACrF,WAAW,IAAI,WAAW,GAAG,SAAS,CAAA;CACvC,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,qDAAqD;IACrD,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAA;IACb;;;;;OAKG;IACH,eAAe,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IACrC,8EAA8E;IAC9E,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;IACjC,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,gFAAgF;IAChF,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,sEAAsE;IACtE,eAAe,CAAC,EAAE,QAAQ,CAAC,WAAW,GAAG,SAAS,CAAC,CAAA;IACnD,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IAC9E,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACnD,iEAAiE;IACjE,MAAM,CAAC,CAAC,OAAO,EAAE,8BAA8B,GAAG,GAAG,CAAC,OAAO,CAAA;IAC7D,0EAA0E;IAC1E,OAAO,CAAC,OAAO,EAAE,8BAA8B,GAAG,GAAG,CAAC,OAAO,CAAA;IAC7D,oEAAoE;IACpE,MAAM,CAAC,CAAC,OAAO,EAAE,8BAA8B,GAAG,GAAG,CAAC,OAAO,CAAA;IAC7D,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"contextual-sidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/contextual-sidebar/contextual-sidebar.tsx"],"names":[],"mappings":"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C,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACnD,iEAAiE;IACjE,MAAM,CAAC,CAAC,OAAO,EAAE,8BAA8B,GAAG,GAAG,CAAC,OAAO,CAAA;IAC7D,0EAA0E;IAC1E,OAAO,CAAC,OAAO,EAAE,8BAA8B,GAAG,GAAG,CAAC,OAAO,CAAA;IAC7D,oEAAoE;IACpE,MAAM,CAAC,CAAC,OAAO,EAAE,8BAA8B,GAAG,GAAG,CAAC,OAAO,CAAA;IAC7D,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eA+L9D"}
|
|
@@ -2,7 +2,7 @@ import { cn } from "../../../lib/utils.js";
|
|
|
2
2
|
import { SidebarNav, SidebarNavContent, SidebarNavFooter, SidebarNavHeader, SidebarNavTitle } from "../sidebar-nav/sidebar-nav.js";
|
|
3
3
|
import { PixelResizeHandle } from "../pixel-resize-handle/pixel-resize-handle.js";
|
|
4
4
|
import { createComponent, memo } from "solid-js/web";
|
|
5
|
-
import { Show, createSignal, createUniqueId, onCleanup,
|
|
5
|
+
import { Show, createEffect, createSignal, createUniqueId, onCleanup, untrack } from "solid-js";
|
|
6
6
|
// src/components/layout/contextual-sidebar/contextual-sidebar.tsx
|
|
7
7
|
/**
|
|
8
8
|
* ContextualSidebar.
|
|
@@ -12,16 +12,28 @@ import { Show, createSignal, createUniqueId, onCleanup, onMount } from "solid-js
|
|
|
12
12
|
* persisted preference, open state, and view-specific navigation content.
|
|
13
13
|
*/
|
|
14
14
|
function ContextualSidebar(props) {
|
|
15
|
-
const [
|
|
15
|
+
const [isMobile, setIsMobile] = createSignal(false);
|
|
16
16
|
const [mobileLoad, setMobileLoad] = createSignal();
|
|
17
|
-
let
|
|
17
|
+
let mobileLoadGeneration = 0;
|
|
18
|
+
let mobileLoadPending = false;
|
|
19
|
+
let mobileLoadSettled = false;
|
|
20
|
+
let responsiveModeInitialized = false;
|
|
18
21
|
const loadMobile = () => {
|
|
19
|
-
if (
|
|
20
|
-
|
|
22
|
+
if (mobileLoadPending || mobileLoadSettled) return;
|
|
23
|
+
mobileLoadPending = true;
|
|
24
|
+
const generation = ++mobileLoadGeneration;
|
|
21
25
|
import("./mobile-contextual-sidebar.js").then((module) => {
|
|
22
|
-
if (
|
|
26
|
+
if (generation === mobileLoadGeneration) {
|
|
27
|
+
mobileLoadPending = false;
|
|
28
|
+
mobileLoadSettled = true;
|
|
29
|
+
setMobileLoad(module);
|
|
30
|
+
}
|
|
23
31
|
}, (error) => {
|
|
24
|
-
if (
|
|
32
|
+
if (generation === mobileLoadGeneration) {
|
|
33
|
+
mobileLoadPending = false;
|
|
34
|
+
mobileLoadSettled = true;
|
|
35
|
+
setMobileLoad({ error });
|
|
36
|
+
}
|
|
25
37
|
});
|
|
26
38
|
};
|
|
27
39
|
const [mobileMount, setMobileMount] = createSignal();
|
|
@@ -31,22 +43,41 @@ function ContextualSidebar(props) {
|
|
|
31
43
|
const mount = mobileMount();
|
|
32
44
|
return mount?.connected && mount.element.isConnected ? mount.element : void 0;
|
|
33
45
|
};
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (media.matches && !wasNarrow) props.onOpenChange(false);
|
|
40
|
-
setIsNarrowViewport(media.matches);
|
|
41
|
-
};
|
|
42
|
-
if (media.matches) loadMobile();
|
|
43
|
-
if (media.matches && props.wideViewportAtLoad && props.open) props.onOpenChange(false);
|
|
44
|
-
setIsNarrowViewport(media.matches);
|
|
45
|
-
media.addEventListener("change", updateViewport);
|
|
46
|
+
createEffect(() => {
|
|
47
|
+
const mode = props.responsiveMode ?? "auto";
|
|
48
|
+
const wasMobile = untrack(isMobile);
|
|
49
|
+
let media;
|
|
50
|
+
let viewportListener;
|
|
46
51
|
onCleanup(() => {
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
mobileLoadGeneration += 1;
|
|
53
|
+
mobileLoadPending = false;
|
|
54
|
+
if (media && viewportListener) media.removeEventListener("change", viewportListener);
|
|
49
55
|
});
|
|
56
|
+
if (mode === "desktop") setIsMobile(false);
|
|
57
|
+
else if (mode === "mobile") {
|
|
58
|
+
if (responsiveModeInitialized ? !wasMobile && untrack(() => props.open) : untrack(() => props.wideViewportAtLoad && props.open)) untrack(() => props.onOpenChange(false));
|
|
59
|
+
loadMobile();
|
|
60
|
+
setIsMobile(true);
|
|
61
|
+
} else {
|
|
62
|
+
const mediaQuery = window.matchMedia("(max-width: 48rem)");
|
|
63
|
+
media = mediaQuery;
|
|
64
|
+
const updateViewport = () => {
|
|
65
|
+
const nextIsMobile = mediaQuery.matches;
|
|
66
|
+
const wasNarrow = untrack(isMobile);
|
|
67
|
+
if (nextIsMobile) loadMobile();
|
|
68
|
+
if (nextIsMobile && !wasNarrow) props.onOpenChange(false);
|
|
69
|
+
setIsMobile(nextIsMobile);
|
|
70
|
+
};
|
|
71
|
+
viewportListener = updateViewport;
|
|
72
|
+
if (media.matches) {
|
|
73
|
+
if (!responsiveModeInitialized && untrack(() => props.wideViewportAtLoad && props.open)) untrack(() => props.onOpenChange(false));
|
|
74
|
+
else if (responsiveModeInitialized && !wasMobile) untrack(() => props.onOpenChange(false));
|
|
75
|
+
loadMobile();
|
|
76
|
+
}
|
|
77
|
+
setIsMobile(mediaQuery.matches);
|
|
78
|
+
mediaQuery.addEventListener("change", updateViewport);
|
|
79
|
+
}
|
|
80
|
+
responsiveModeInitialized = true;
|
|
50
81
|
});
|
|
51
82
|
const renderSidebar = (mobile) => {
|
|
52
83
|
let element;
|
|
@@ -194,7 +225,7 @@ function ContextualSidebar(props) {
|
|
|
194
225
|
};
|
|
195
226
|
return [createComponent(Show, {
|
|
196
227
|
get when() {
|
|
197
|
-
return !
|
|
228
|
+
return !isMobile();
|
|
198
229
|
},
|
|
199
230
|
children: (_wide) => renderSidebar(false)
|
|
200
231
|
}), createComponent(Show, {
|
|
@@ -206,7 +237,7 @@ function ContextualSidebar(props) {
|
|
|
206
237
|
if ("error" in loaded) throw loaded.error;
|
|
207
238
|
return createComponent(loaded.MobileSidebar, {
|
|
208
239
|
get open() {
|
|
209
|
-
return memo(() => !!
|
|
240
|
+
return memo(() => !!isMobile())() && props.open;
|
|
210
241
|
},
|
|
211
242
|
get onOpenChange() {
|
|
212
243
|
return props.onOpenChange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextual-sidebar.js","names":["Accessor","JSX","Show","createSignal","createUniqueId","onCleanup","onMount","cn","SidebarNav","SidebarNavContent","SidebarNavFooter","SidebarNavHeader","SidebarNavTitle","PixelResizeHandle","MobileModule","MobileLoad","error","ContextualSidebarRenderContext","mobile","portalMount","HTMLElement","ContextualSidebarProps","id","label","title","titleVisibility","open","onOpenChange","width","minimum","maximum","step","wideViewportAtLoad","resizeLabel","resizeGrip","restoreFocusRef","onSidebarElement","element","sidebarClass","sheetClass","headerClass","contentClass","footerClass","headingAs","header","context","Element","content","footer","onWidthChange","onWidthCommit","ContextualSidebar","props","isNarrowViewport","setIsNarrowViewport","mobileLoad","setMobileLoad","mobileRequested","loadMobile","then","module","mobileMount","setMobileMount","connected","mount","isConnected","undefined","media","window","matchMedia","updateViewport","wasNarrow","matches","addEventListener","removeEventListener","renderSidebar","navigationId","_$createComponent","as","aria-label","aria-hidden","inert","data-open","String","ref","node","queueMicrotask","class","children","when","side","value","grip","controls","onChange","onCommit","fallback","_$memo","_wide","keyed","loaded","MobileSidebar","_$createComponent","_$memo"],"sources":["../../../../src/components/layout/contextual-sidebar/contextual-sidebar.tsx"],"sourcesContent":["import type { Accessor, JSX } from 'solid-js'\nimport { Show, createSignal, createUniqueId, onCleanup, onMount } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport {\n SidebarNav,\n SidebarNavContent,\n SidebarNavFooter,\n SidebarNavHeader,\n SidebarNavTitle,\n} from '../sidebar-nav/sidebar-nav'\nimport { PixelResizeHandle } from '../pixel-resize-handle/pixel-resize-handle'\n\ntype MobileModule = typeof import('./mobile-contextual-sidebar')\ntype MobileLoad = MobileModule | { error: unknown }\n\nexport type ContextualSidebarRenderContext = {\n /** Whether the slot is being rendered inside the modal mobile sheet. */\n mobile: boolean\n /** Mount nested popovers and menus inside the mobile dialog's accessibility tree. */\n portalMount(): HTMLElement | undefined\n}\n\nexport type ContextualSidebarProps = {\n /** Stable host id prefix; generated when omitted. */\n id?: string\n /** Landmark name shared by the desktop and mobile navigation. */\n label: string\n /** Visible navigation title and mobile dialog title. */\n title: string\n /**\n * Where the title row shows. `always` (default) draws it on desktop and in\n * the mobile sheet; `mobile` keeps the desktop title for assistive\n * technology only and drops the desktop row, for hosts whose top bar\n * already names the context. A `header` slot keeps the row visible.\n */\n titleVisibility?: 'always' | 'mobile'\n /** Host-controlled expanded state for the desktop panel and mobile dialog. */\n open: boolean\n onOpenChange(open: boolean): void\n /** Current host-owned pixel width, reflected by the resize handle. */\n width: number\n minimum: number\n maximum: number\n step?: number\n /** Pass the host's initial viewport seed to distinguish stale desktop state. */\n wideViewportAtLoad?: boolean\n resizeLabel?: string\n /**\n * The resize edge's grip: the quieter rung by default, or the bordered chip\n * for hosts that want the heavier affordance.\n */\n resizeGrip?: 'chip' | 'rung'\n /** Stable external opener used when the modal mobile sheet closes. */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n /** Called with the nav node so a host can project width onto its layout root. */\n onSidebarElement?: (element: HTMLElement | undefined, mobile: boolean) => void\n /** Host-owned layout classes applied to both nav instances. */\n sidebarClass?: string\n /** Host-owned responsive constraints for the modal sheet. */\n sheetClass?: string\n headerClass?: string\n contentClass?: string\n footerClass?: string\n headingAs?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n /** Optional action/content slot alongside the shared heading. */\n header?(context: ContextualSidebarRenderContext): JSX.Element\n /** View-specific navigation rows, projects, rooms, files, or sessions. */\n content(context: ContextualSidebarRenderContext): JSX.Element\n /** Optional view-specific footer, such as an archive affordance. */\n footer?(context: ContextualSidebarRenderContext): JSX.Element\n onWidthChange(width: number): void\n onWidthCommit?(width: number): void\n}\n\n/**\n * ContextualSidebar.\n *\n * Shared navigation geometry and interaction policy for an application's\n * contextual sidebar. The host keeps ownership of the actual grid width,\n * persisted preference, open state, and view-specific navigation content.\n */\nexport function ContextualSidebar(props: ContextualSidebarProps) {\n const [isNarrowViewport, setIsNarrowViewport] = createSignal(false)\n const [mobileLoad, setMobileLoad] = createSignal<MobileLoad>()\n let mobileRequested = false\n // Keep the resolved component mounted across viewport changes for Sheet cleanup.\n const loadMobile = () => {\n if (mobileRequested) return\n mobileRequested = true\n // Native module caching shares successful loads without keeping a rejected promise.\n void import('./mobile-contextual-sidebar').then(\n (module) => {\n if (mobileRequested) setMobileLoad(module)\n },\n (error: unknown) => {\n if (mobileRequested) setMobileLoad({ error })\n }\n )\n }\n const [mobileMount, setMobileMount] = createSignal<\n { element: HTMLElement; connected: boolean } | undefined\n >()\n const id = props.id ?? `contextual-sidebar-${createUniqueId()}`\n const resizeLabel = () => props.resizeLabel ?? `Resize ${props.label}`\n const portalMount = () => {\n const mount = mobileMount()\n return mount?.connected && mount.element.isConnected ? mount.element : undefined\n }\n\n onMount(() => {\n const media = window.matchMedia('(max-width: 48rem)')\n const updateViewport = () => {\n const wasNarrow = isNarrowViewport()\n if (media.matches) loadMobile()\n // Close before mounting a modal. A desktop-expanded host state is not\n // mobile intent, and opening the Sheet for one frame can steal focus.\n if (media.matches && !wasNarrow) props.onOpenChange(false)\n setIsNarrowViewport(media.matches)\n }\n\n // A route can mount after a wide-loaded host crosses into mobile. Clear\n // that stale seed, but preserve a sidebar intentionally opened at a\n // narrow boot viewport.\n if (media.matches) loadMobile()\n if (media.matches && props.wideViewportAtLoad && props.open) props.onOpenChange(false)\n setIsNarrowViewport(media.matches)\n media.addEventListener('change', updateViewport)\n onCleanup(() => {\n mobileRequested = false\n media.removeEventListener('change', updateViewport)\n })\n })\n\n const renderSidebar = (mobile: boolean) => {\n let element: HTMLElement | undefined\n const context: ContextualSidebarRenderContext = {\n mobile,\n portalMount: () => (mobile ? portalMount() : undefined),\n }\n const navigationId = `${id}-${mobile ? 'mobile' : 'desktop'}`\n\n onCleanup(() => {\n if (mobile && mobileMount()?.element === element) setMobileMount(undefined)\n element = undefined\n props.onSidebarElement?.(undefined, mobile)\n })\n\n return (\n <SidebarNav\n as=\"aside\"\n id={navigationId}\n aria-label={props.label}\n aria-hidden={!mobile && !props.open ? 'true' : undefined}\n inert={!mobile && !props.open}\n data-contextual-sidebar={mobile ? 'mobile' : 'desktop'}\n data-open={mobile ? undefined : String(props.open)}\n ref={(node) => {\n element = node\n if (mobile) {\n setMobileMount({ element: node, connected: node.isConnected })\n queueMicrotask(() => {\n if (node.isConnected && mobileMount()?.element === node)\n setMobileMount({ element: node, connected: true })\n })\n }\n props.onSidebarElement?.(node, mobile)\n }}\n class={cn('relative h-full w-full max-w-full', props.sidebarClass)}\n >\n <Show when={!mobile && props.open}>\n <PixelResizeHandle\n // The ruler spans the sidebar as a pointer-events-none overlay; lift\n // it above the neighbouring pane so the edge stays grabbable.\n class=\"z-(--z-docked)\"\n side=\"left\"\n value={props.width}\n minimum={props.minimum}\n maximum={props.maximum}\n step={props.step}\n label={resizeLabel()}\n grip={props.resizeGrip ?? 'rung'}\n controls={navigationId}\n onChange={props.onWidthChange}\n onCommit={props.onWidthCommit}\n />\n </Show>\n <Show when={!mobile || mobileMount()?.connected}>\n <Show\n when={mobile || props.titleVisibility !== 'mobile' || props.header}\n fallback={\n <SidebarNavTitle as={props.headingAs ?? 'h2'} class=\"sr-only\">\n {props.title}\n </SidebarNavTitle>\n }\n >\n <SidebarNavHeader class={cn(mobile && 'pe-12', props.headerClass)}>\n <SidebarNavTitle as={props.headingAs ?? 'h2'}>{props.title}</SidebarNavTitle>\n {props.header?.(context)}\n </SidebarNavHeader>\n </Show>\n <SidebarNavContent class={props.contentClass}>{props.content(context)}</SidebarNavContent>\n {props.footer ? (\n <SidebarNavFooter class={props.footerClass}>{props.footer(context)}</SidebarNavFooter>\n ) : null}\n </Show>\n </SidebarNav>\n )\n }\n\n return (\n <>\n <Show when={!isNarrowViewport()}>{(_wide) => renderSidebar(false)}</Show>\n <Show when={mobileLoad()} keyed>\n {(loaded) => {\n if ('error' in loaded) throw loaded.error\n return (\n <loaded.MobileSidebar\n open={isNarrowViewport() && props.open}\n onOpenChange={props.onOpenChange}\n label={props.label}\n sheetClass={props.sheetClass}\n restoreFocusRef={props.restoreFocusRef}\n renderSidebar={() => renderSidebar(true)}\n />\n )\n }}\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAiFA,SAAgBmD,kBAAkBC,OAA+B;CAC/D,MAAM,CAACC,kBAAkBC,uBAAuBnD,aAAa,KAAK;CAClE,MAAM,CAACoD,YAAYC,iBAAiBrD,aAAyB;CAC7D,IAAIsD,kBAAkB;CAEtB,MAAMC,mBAAmB;EACvB,IAAID,iBAAiB;EACrBA,kBAAkB;EAElB,OAAY,iCAA8B,CAACE,MACxCC,WAAW;GACV,IAAIH,iBAAiBD,cAAcI,MAAM;EAC3C,IACC5C,UAAmB;GAClB,IAAIyC,iBAAiBD,cAAc,EAAExC,MAAM,CAAC;EAC9C,CACF;CACF;CACA,MAAM,CAAC6C,aAAaC,kBAAkB3D,aAEpC;CACF,MAAMmB,KAAK8B,MAAM9B,MAAM,sBAAsBlB,eAAe;CAC5D,MAAM6B,oBAAoBmB,MAAMnB,eAAe,UAAUmB,MAAM7B;CAC/D,MAAMJ,oBAAoB;EACxB,MAAM6C,QAAQH,YAAY;EAC1B,OAAOG,OAAOD,aAAaC,MAAM3B,QAAQ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OAAI;GAAA,OAAElC,WAAW;EAAC;EAAE4C,OAAK;EAAAX,WAC3BY,WAAW;GACX,IAAI,WAAWA,QAAQ,MAAMA,OAAOpF;GACpC,OAAA6D,gBACGuB,OAAOC,eAAa;IAAA,IACnB3E,OAAI;KAAA,OAAEuE,WAAA,CAAA,CAAA5C,iBAAiB,CAAC,CAAA,CAAA,KAAID,MAAM1B;IAAI;IAAA,IACtCC,eAAY;KAAA,OAAEyB,MAAMzB;IAAY;IAAA,IAChCJ,QAAK;KAAA,OAAE6B,MAAM7B;IAAK;IAAA,IAClBgB,aAAU;KAAA,OAAEa,MAAMb;IAAU;IAAA,IAC5BJ,kBAAe;KAAA,OAAEiB,MAAMjB;IAAe;IACtCwC,qBAAqBA,cAAc,IAAI;GAAC,CAAA;EAG9C;CAAC,CAAA,CAAA;AAIT"}
|
|
1
|
+
{"version":3,"file":"contextual-sidebar.js","names":["Accessor","JSX","Show","createEffect","createSignal","createUniqueId","onCleanup","untrack","cn","SidebarNav","SidebarNavContent","SidebarNavFooter","SidebarNavHeader","SidebarNavTitle","PixelResizeHandle","MobileModule","MobileLoad","error","ContextualSidebarRenderContext","mobile","portalMount","HTMLElement","ContextualSidebarProps","id","label","title","titleVisibility","open","onOpenChange","responsiveMode","width","minimum","maximum","step","wideViewportAtLoad","resizeLabel","resizeGrip","restoreFocusRef","onSidebarElement","element","sidebarClass","sheetClass","headerClass","contentClass","footerClass","headingAs","header","context","Element","content","footer","onWidthChange","onWidthCommit","ContextualSidebar","props","isMobile","setIsMobile","mobileLoad","setMobileLoad","mobileLoadGeneration","mobileLoadPending","mobileLoadSettled","responsiveModeInitialized","loadMobile","generation","then","module","mobileMount","setMobileMount","connected","mount","isConnected","undefined","mode","wasMobile","media","MediaQueryList","viewportListener","removeEventListener","shouldCloseStaleOpen","mediaQuery","window","matchMedia","updateViewport","nextIsMobile","matches","wasNarrow","addEventListener","renderSidebar","navigationId","_$createComponent","as","aria-label","aria-hidden","inert","data-open","String","ref","node","queueMicrotask","class","children","when","side","value","grip","controls","onChange","onCommit","fallback","_$memo","_wide","keyed","loaded","MobileSidebar","_$createComponent","_$memo"],"sources":["../../../../src/components/layout/contextual-sidebar/contextual-sidebar.tsx"],"sourcesContent":["import type { Accessor, JSX } from 'solid-js'\nimport { Show, createEffect, createSignal, createUniqueId, onCleanup, untrack } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport {\n SidebarNav,\n SidebarNavContent,\n SidebarNavFooter,\n SidebarNavHeader,\n SidebarNavTitle,\n} from '../sidebar-nav/sidebar-nav'\nimport { PixelResizeHandle } from '../pixel-resize-handle/pixel-resize-handle'\n\ntype MobileModule = typeof import('./mobile-contextual-sidebar')\ntype MobileLoad = MobileModule | { error: unknown }\n\nexport type ContextualSidebarRenderContext = {\n /** Whether the slot is being rendered inside the modal mobile sheet. */\n mobile: boolean\n /** Mount nested popovers and menus inside the mobile dialog's accessibility tree. */\n portalMount(): HTMLElement | undefined\n}\n\nexport type ContextualSidebarProps = {\n /** Stable host id prefix; generated when omitted. */\n id?: string\n /** Landmark name shared by the desktop and mobile navigation. */\n label: string\n /** Visible navigation title and mobile dialog title. */\n title: string\n /**\n * Where the title row shows. `always` (default) draws it on desktop and in\n * the mobile sheet; `mobile` keeps the desktop title for assistive\n * technology only and drops the desktop row, for hosts whose top bar\n * already names the context. A `header` slot keeps the row visible.\n */\n titleVisibility?: 'always' | 'mobile'\n /** Host-controlled expanded state for the desktop panel and mobile dialog. */\n open: boolean\n onOpenChange(open: boolean): void\n /**\n * Presentation mode. `auto` (default) uses the built-in viewport breakpoint;\n * hosts can select `desktop` or the shared mobile `Sheet` themselves.\n */\n responsiveMode?: 'auto' | 'desktop' | 'mobile'\n /** Current host-owned pixel width, reflected by the resize handle. */\n width: number\n minimum: number\n maximum: number\n step?: number\n /** Pass the host's initial viewport seed to distinguish stale desktop state. */\n wideViewportAtLoad?: boolean\n resizeLabel?: string\n /**\n * The resize edge's grip: the quieter rung by default, or the bordered chip\n * for hosts that want the heavier affordance.\n */\n resizeGrip?: 'chip' | 'rung'\n /** Stable external opener used when the modal mobile sheet closes. */\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n /** Called with the nav node so a host can project width onto its layout root. */\n onSidebarElement?: (element: HTMLElement | undefined, mobile: boolean) => void\n /** Host-owned layout classes applied to both nav instances. */\n sidebarClass?: string\n /** Host-owned responsive constraints for the modal sheet. */\n sheetClass?: string\n headerClass?: string\n contentClass?: string\n footerClass?: string\n headingAs?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n /** Optional action/content slot alongside the shared heading. */\n header?(context: ContextualSidebarRenderContext): JSX.Element\n /** View-specific navigation rows, projects, rooms, files, or sessions. */\n content(context: ContextualSidebarRenderContext): JSX.Element\n /** Optional view-specific footer, such as an archive affordance. */\n footer?(context: ContextualSidebarRenderContext): JSX.Element\n onWidthChange(width: number): void\n onWidthCommit?(width: number): void\n}\n\n/**\n * ContextualSidebar.\n *\n * Shared navigation geometry and interaction policy for an application's\n * contextual sidebar. The host keeps ownership of the actual grid width,\n * persisted preference, open state, and view-specific navigation content.\n */\nexport function ContextualSidebar(props: ContextualSidebarProps) {\n const [isMobile, setIsMobile] = createSignal(false)\n const [mobileLoad, setMobileLoad] = createSignal<MobileLoad>()\n let mobileLoadGeneration = 0\n let mobileLoadPending = false\n let mobileLoadSettled = false\n let responsiveModeInitialized = false\n // Keep the resolved component mounted across viewport changes for Sheet cleanup.\n const loadMobile = () => {\n if (mobileLoadPending || mobileLoadSettled) return\n mobileLoadPending = true\n const generation = ++mobileLoadGeneration\n // Native module caching shares successful loads without keeping a rejected promise.\n void import('./mobile-contextual-sidebar').then(\n (module) => {\n if (generation === mobileLoadGeneration) {\n mobileLoadPending = false\n mobileLoadSettled = true\n setMobileLoad(module)\n }\n },\n (error: unknown) => {\n if (generation === mobileLoadGeneration) {\n mobileLoadPending = false\n mobileLoadSettled = true\n setMobileLoad({ error })\n }\n }\n )\n }\n const [mobileMount, setMobileMount] = createSignal<\n { element: HTMLElement; connected: boolean } | undefined\n >()\n const id = props.id ?? `contextual-sidebar-${createUniqueId()}`\n const resizeLabel = () => props.resizeLabel ?? `Resize ${props.label}`\n const portalMount = () => {\n const mount = mobileMount()\n return mount?.connected && mount.element.isConnected ? mount.element : undefined\n }\n\n createEffect(() => {\n const mode = props.responsiveMode ?? 'auto'\n const wasMobile = untrack(isMobile)\n let media: MediaQueryList | undefined\n let viewportListener: (() => void) | undefined\n\n onCleanup(() => {\n mobileLoadGeneration += 1\n mobileLoadPending = false\n if (media && viewportListener) media.removeEventListener('change', viewportListener)\n })\n\n if (mode === 'desktop') {\n setIsMobile(false)\n } else if (mode === 'mobile') {\n // An explicit host transition into mobile must not briefly open a Sheet\n // with stale desktop-expanded state. An initial wide-loaded seed still\n // marks an open value as stale, including in host-selected mobile mode.\n const shouldCloseStaleOpen = responsiveModeInitialized\n ? !wasMobile && untrack(() => props.open)\n : untrack(() => props.wideViewportAtLoad && props.open)\n if (shouldCloseStaleOpen) untrack(() => props.onOpenChange(false))\n loadMobile()\n setIsMobile(true)\n } else {\n const mediaQuery = window.matchMedia('(max-width: 48rem)')\n media = mediaQuery\n const updateViewport = () => {\n const nextIsMobile = mediaQuery.matches\n const wasNarrow = untrack(isMobile)\n if (nextIsMobile) loadMobile()\n // Close before mounting a modal. A desktop-expanded host state is not\n // mobile intent, and opening the Sheet for one frame can steal focus.\n if (nextIsMobile && !wasNarrow) props.onOpenChange(false)\n setIsMobile(nextIsMobile)\n }\n viewportListener = updateViewport\n\n // Preserve a narrow-boot open intent. Initial auto and mobile modes use\n // the viewport seed to clear stale state; runtime transitions close it.\n if (media.matches) {\n if (!responsiveModeInitialized && untrack(() => props.wideViewportAtLoad && props.open)) {\n untrack(() => props.onOpenChange(false))\n } else if (responsiveModeInitialized && !wasMobile) {\n untrack(() => props.onOpenChange(false))\n }\n loadMobile()\n }\n setIsMobile(mediaQuery.matches)\n mediaQuery.addEventListener('change', updateViewport)\n }\n\n responsiveModeInitialized = true\n })\n\n const renderSidebar = (mobile: boolean) => {\n let element: HTMLElement | undefined\n const context: ContextualSidebarRenderContext = {\n mobile,\n portalMount: () => (mobile ? portalMount() : undefined),\n }\n const navigationId = `${id}-${mobile ? 'mobile' : 'desktop'}`\n\n onCleanup(() => {\n if (mobile && mobileMount()?.element === element) setMobileMount(undefined)\n element = undefined\n props.onSidebarElement?.(undefined, mobile)\n })\n\n return (\n <SidebarNav\n as=\"aside\"\n id={navigationId}\n aria-label={props.label}\n aria-hidden={!mobile && !props.open ? 'true' : undefined}\n inert={!mobile && !props.open}\n data-contextual-sidebar={mobile ? 'mobile' : 'desktop'}\n data-open={mobile ? undefined : String(props.open)}\n ref={(node) => {\n element = node\n if (mobile) {\n setMobileMount({ element: node, connected: node.isConnected })\n queueMicrotask(() => {\n if (node.isConnected && mobileMount()?.element === node)\n setMobileMount({ element: node, connected: true })\n })\n }\n props.onSidebarElement?.(node, mobile)\n }}\n class={cn('relative h-full w-full max-w-full', props.sidebarClass)}\n >\n <Show when={!mobile && props.open}>\n <PixelResizeHandle\n // The ruler spans the sidebar as a pointer-events-none overlay; lift\n // it above the neighbouring pane so the edge stays grabbable.\n class=\"z-(--z-docked)\"\n side=\"left\"\n value={props.width}\n minimum={props.minimum}\n maximum={props.maximum}\n step={props.step}\n label={resizeLabel()}\n grip={props.resizeGrip ?? 'rung'}\n controls={navigationId}\n onChange={props.onWidthChange}\n onCommit={props.onWidthCommit}\n />\n </Show>\n <Show when={!mobile || mobileMount()?.connected}>\n <Show\n when={mobile || props.titleVisibility !== 'mobile' || props.header}\n fallback={\n <SidebarNavTitle as={props.headingAs ?? 'h2'} class=\"sr-only\">\n {props.title}\n </SidebarNavTitle>\n }\n >\n <SidebarNavHeader class={cn(mobile && 'pe-12', props.headerClass)}>\n <SidebarNavTitle as={props.headingAs ?? 'h2'}>{props.title}</SidebarNavTitle>\n {props.header?.(context)}\n </SidebarNavHeader>\n </Show>\n <SidebarNavContent class={props.contentClass}>{props.content(context)}</SidebarNavContent>\n {props.footer ? (\n <SidebarNavFooter class={props.footerClass}>{props.footer(context)}</SidebarNavFooter>\n ) : null}\n </Show>\n </SidebarNav>\n )\n }\n\n return (\n <>\n <Show when={!isMobile()}>{(_wide) => renderSidebar(false)}</Show>\n <Show when={mobileLoad()} keyed>\n {(loaded) => {\n if ('error' in loaded) throw loaded.error\n return (\n <loaded.MobileSidebar\n open={isMobile() && props.open}\n onOpenChange={props.onOpenChange}\n label={props.label}\n sheetClass={props.sheetClass}\n restoreFocusRef={props.restoreFocusRef}\n renderSidebar={() => renderSidebar(true)}\n />\n )\n }}\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAsFA,SAAgBqD,kBAAkBC,OAA+B;CAC/D,MAAM,CAACC,UAAUC,eAAepD,aAAa,KAAK;CAClD,MAAM,CAACqD,YAAYC,iBAAiBtD,aAAyB;CAC7D,IAAIuD,uBAAuB;CAC3B,IAAIC,oBAAoB;CACxB,IAAIC,oBAAoB;CACxB,IAAIC,4BAA4B;CAEhC,MAAMC,mBAAmB;EACvB,IAAIH,qBAAqBC,mBAAmB;EAC5CD,oBAAoB;EACpB,MAAMI,aAAa,EAAEL;EAErB,OAAY,iCAA8B,CAACM,MACxCC,WAAW;GACV,IAAIF,eAAeL,sBAAsB;IACvCC,oBAAoB;IACpBC,oBAAoB;IACpBH,cAAcQ,MAAM;GACtB;EACF,IACCjD,UAAmB;GAClB,IAAI+C,eAAeL,sBAAsB;IACvCC,oBAAoB;IACpBC,oBAAoB;IACpBH,cAAc,EAAEzC,MAAM,CAAC;GACzB;EACF,CACF;CACF;CACA,MAAM,CAACkD,aAAaC,kBAAkBhE,aAEpC;CACF,MAAMmB,KAAK+B,MAAM/B,MAAM,sBAAsBlB,eAAe;CAC5D,MAAM8B,oBAAoBmB,MAAMnB,eAAe,UAAUmB,MAAM9B;CAC/D,MAAMJ,oBAAoB;EACxB,MAAMkD,QAAQH,YAAY;EAC1B,OAAOG,OAAOD,aAAaC,MAAM/B,QAA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sx"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,IAAI,kBAAkB,EACjC,OAAO,IAAI,yBAAyB,EACrC,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAW9C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,kCAE3E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,OAAO,CAAC,kCAE1F;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,MAAM,CAAC,kCAExF;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,OAAO,CAAC,kCAY1F;AA+BD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,yBAAyB,CAAC,
|
|
1
|
+
{"version":3,"file":"alert-dialog.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/alert-dialog/alert-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,IAAI,kBAAkB,EACjC,OAAO,IAAI,yBAAyB,EACrC,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAW9C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,kCAE3E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,OAAO,CAAC,kCAE1F;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,MAAM,CAAC,kCAExF;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,OAAO,CAAC,kCAY1F;AA+BD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,yBAAyB,CAAC,kCAoBzF;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,kCAS7D;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,kCAS7D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,KAAK,CAAC,kCAGtF;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,WAAW,CAAC,kCAS7D;AA0CD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,WAAW,CAAC,kCAE7F;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,WAAW,CAAC,kCAE7F"}
|
|
@@ -74,7 +74,7 @@ function AlertDialogContent(props) {
|
|
|
74
74
|
var _el$ = _tmpl$();
|
|
75
75
|
className(_el$, overlayPositioner);
|
|
76
76
|
insert(_el$, createComponent(Content, mergeProps(blockDismissal, { get ["class"]() {
|
|
77
|
-
return cn(dialogSurface, overlayMotion, "grid w-full max-w-md gap-4 p-5", local.class);
|
|
77
|
+
return cn(dialogSurface, overlayMotion, "grid max-h-full w-full max-w-md gap-4 overflow-y-auto p-5", local.class);
|
|
78
78
|
} }, rest)));
|
|
79
79
|
return _el$;
|
|
80
80
|
})()];
|
|
@@ -142,9 +142,14 @@ function AlertDialogChoice(props) {
|
|
|
142
142
|
return (() => {
|
|
143
143
|
var _el$4 = _tmpl$4();
|
|
144
144
|
use(setWrapper, _el$4);
|
|
145
|
-
insert(_el$4, createComponent(AlertDialog.CloseButton, mergeProps({
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
insert(_el$4, createComponent(AlertDialog.CloseButton, mergeProps({
|
|
146
|
+
get ["class"]() {
|
|
147
|
+
return cn(local.class);
|
|
148
|
+
},
|
|
149
|
+
get ["aria-label"]() {
|
|
150
|
+
return local["aria-label"];
|
|
151
|
+
}
|
|
152
|
+
}, rest)));
|
|
148
153
|
return _el$4;
|
|
149
154
|
})();
|
|
150
155
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog.js","names":["AlertDialog","KobalteAlertDialog","Content","KobalteAlertDialogContent","ComponentProps","createEffect","createSignal","splitProps","dialogSurface","overlayMotion","overlayPositioner","overlayScrim","overlayTitle","cn","props","_$createComponent","AlertDialogTrigger","Trigger","AlertDialogPortal","Portal","AlertDialogOverlay","Overlay","local","rest","_$mergeProps","class","blockDismissal","onPointerDownOutside","event","Event","preventDefault","onFocusOutside","onInteractOutside","const","AlertDialogContent","children","_el$","_tmpl$","_$className","_$insert","AlertDialogHeader","_el$2","_tmpl$2","_$spread","AlertDialogFooter","_el$3","_tmpl$3","AlertDialogTitle","Title","AlertDialogDescription","Description","AlertDialogChoice","CloseButton","wrapper","setWrapper","HTMLSpanElement","root","undefined","querySelector","removeAttribute","_el$4","_tmpl$4","_$use","AlertDialogAction","AlertDialogCancel","AlertDialog","_$createComponent","KobalteAlertDialog","_$mergeProps","KobalteAlertDialogContent"],"sources":["../../../../src/components/ui/alert-dialog/alert-dialog.tsx"],"sourcesContent":["import {\n AlertDialog as KobalteAlertDialog,\n Content as KobalteAlertDialogContent,\n} from '@kobalte/core/alert-dialog'\n// Use the alert-specific export rather than DialogRoot.Content, which other imports can replace.\nimport type { ComponentProps } from 'solid-js'\nimport { createEffect, createSignal, splitProps } from 'solid-js'\nimport {\n dialogSurface,\n overlayMotion,\n overlayPositioner,\n overlayScrim,\n overlayTitle,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * AlertDialog.\n *\n * A dialog that cannot be dismissed by accident: a click on the scrim does nothing,\n * and the user must choose one of the actions. Escape is the keyboard's Cancel: it\n * closes the dialog exactly as the cancel action does, so nothing is confirmed. That\n * is the whole difference from Dialog, and it is why this exists as its own\n * component rather than a prop — a caller has to reach for it deliberately.\n *\n * The consequence is a rule of use: this is for confirming a destructive or\n * irreversible step. Wrapping an ordinary form in an AlertDialog traps someone who\n * wants to back out.\n *\n * There is deliberately no close button in the corner. An X has no label, and the\n * point of this surface is that every exit is a named choice.\n */\nexport function AlertDialog(props: ComponentProps<typeof KobalteAlertDialog>) {\n return <KobalteAlertDialog {...props} />\n}\n\nexport function AlertDialogTrigger(props: ComponentProps<typeof KobalteAlertDialog.Trigger>) {\n return <KobalteAlertDialog.Trigger {...props} />\n}\n\nexport function AlertDialogPortal(props: ComponentProps<typeof KobalteAlertDialog.Portal>) {\n return <KobalteAlertDialog.Portal {...props} />\n}\n\nexport function AlertDialogOverlay(props: ComponentProps<typeof KobalteAlertDialog.Overlay>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteAlertDialog.Overlay\n class={cn(\n overlayScrim,\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0',\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/**\n * The panel.\n *\n * Kobalte's `AlertDialog.Content` is `Dialog.Content` with `role=\"alertdialog\"`\n * and nothing else — an outside click dismisses it exactly as it dismisses a\n * Dialog. That is a real gap in the primitive, so the blocking is implemented\n * here, and it is the whole difference between this component and a Dialog:\n *\n * - Pointer and focus interactions outside are prevented, including the scrim\n * click, because a stray click that closes a confirmation is a click that\n * makes \"confirm\" meaningless.\n *\n * Escape is deliberately left to the primitive. It can only ever cancel, never\n * confirm, so it is not an accident that matters; refusing it traps a keyboard\n * user who has changed their mind, and the WAI-ARIA alertdialog pattern says\n * Escape closes. It reports `onOpenChange(false)` and restores focus to the\n * trigger, which is what the cancel action does, and as the topmost layer it\n * closes only the confirmation, not a dialog underneath it.\n *\n * There is deliberately no prop to turn the scrim blocking off. A surface that can be escaped\n * accidentally does not need to be an AlertDialog; it is a Dialog, and using this\n * one would be a claim about the flow that is not true.\n */\nconst blockDismissal = {\n onPointerDownOutside: (event: Event) => event.preventDefault(),\n onFocusOutside: (event: Event) => event.preventDefault(),\n onInteractOutside: (event: Event) => event.preventDefault(),\n} as const\n\nexport function AlertDialogContent(props: ComponentProps<typeof KobalteAlertDialogContent>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteAlertDialog.Portal>\n <AlertDialogOverlay />\n <div class={overlayPositioner}>\n <KobalteAlertDialogContent\n {...blockDismissal}\n class={cn(dialogSurface, overlayMotion, 'grid w-full max-w-md gap-4 p-5', local.class)}\n {...rest}\n />\n </div>\n </KobalteAlertDialog.Portal>\n )\n}\n\nexport function AlertDialogHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"alert-dialog-header\"\n class={cn('flex flex-col gap-1.5 text-start', local.class)}\n {...rest}\n />\n )\n}\n\nexport function AlertDialogFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"alert-dialog-footer\"\n class={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', local.class)}\n {...rest}\n />\n )\n}\n\nexport function AlertDialogTitle(props: ComponentProps<typeof KobalteAlertDialog.Title>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteAlertDialog.Title class={cn(overlayTitle, local.class)} {...rest} />\n}\n\nexport function AlertDialogDescription(\n props: ComponentProps<typeof KobalteAlertDialog.Description>\n) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteAlertDialog.Description\n class={cn('text-muted-foreground text-sm', local.class)}\n {...rest}\n />\n )\n}\n\n/**\n * One of the dialog's two named choices.\n *\n * Kobalte labels its close button \"Dismiss\" by default, because a generic close\n * button is usually an icon with no text of its own. In an AlertDialog it is\n * something else: the named choices. An `aria-label` there *replaces* the visible\n * text, so a screen reader hears \"Dismiss\" twice and the user cannot tell the\n * destructive action from the safe one.\n *\n * The injected label is removed rather than overridden with an empty one. An empty\n * `aria-label` is not reliably ignored — some name computations treat its presence\n * as an explicit empty name, which leaves the button unnamed — so the attribute\n * has to go, and the visible text becomes the name. A caller whose button is an\n * icon passes its own `aria-label`, and that one is left alone.\n *\n * Applied through a layout-neutral wrapper because Kobalte keeps the `ref` for its\n * own dismissable layer and does not forward it. The wrapper is `display: contents`\n * so the button remains the flex item its parent lays out.\n */\nfunction AlertDialogChoice(props: ComponentProps<typeof KobalteAlertDialog.CloseButton>) {\n const [local, rest] = splitProps(props, ['class', 'aria-label'])\n const [wrapper, setWrapper] = createSignal<HTMLSpanElement>()\n\n createEffect(() => {\n const root = wrapper()\n if (!root || local['aria-label'] !== undefined) return\n root.querySelector('button')?.removeAttribute('aria-label')\n })\n\n return (\n <span ref={setWrapper} class=\"contents\">\n <KobalteAlertDialog.CloseButton class={cn(local.class)} {...rest} />\n </span>\n )\n}\n\nexport function AlertDialogAction(props: ComponentProps<typeof KobalteAlertDialog.CloseButton>) {\n return <AlertDialogChoice {...props} />\n}\n\nexport function AlertDialogCancel(props: ComponentProps<typeof KobalteAlertDialog.CloseButton>) {\n return <AlertDialogChoice {...props} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAgBA,cAAYc,OAAkD;CAC5E,OAAAC,gBAAQd,aAAuBa,KAAK;AACtC;AAEA,SAAgBE,mBAAmBF,OAA0D;CAC3F,OAAAC,gBAAQd,YAAmBgB,SAAYH,KAAK;AAC9C;AAEA,SAAgBI,kBAAkBJ,OAAyD;CACzF,OAAAC,gBAAQd,YAAmBkB,QAAWL,KAAK;AAC7C;AAEA,SAAgBM,mBAAmBN,OAA0D;CAC3F,MAAM,CAACQ,OAAOC,QAAQhB,WAAWO,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAC,gBACGd,YAAmBoB,SAAOG,WAAA,EAAA,KAAA,WAAA;EAAA,OAClBX,GACLF,cACA,mGACAW,MAAMG,KACR;CAAC,EAAA,G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EA,SAAgBkD,kBAAkBlD,OAA8D;CAC9F,OAAAC,gBAAQoC,mBAAsBrC,KAAK;AACrC"}
|
|
1
|
+
{"version":3,"file":"alert-dialog.js","names":["AlertDialog","KobalteAlertDialog","Content","KobalteAlertDialogContent","ComponentProps","createEffect","createSignal","splitProps","dialogSurface","overlayMotion","overlayPositioner","overlayScrim","overlayTitle","cn","props","_$createComponent","AlertDialogTrigger","Trigger","AlertDialogPortal","Portal","AlertDialogOverlay","Overlay","local","rest","_$mergeProps","class","blockDismissal","onPointerDownOutside","event","Event","preventDefault","onFocusOutside","onInteractOutside","const","AlertDialogContent","children","_el$","_tmpl$","_$className","_$insert","AlertDialogHeader","_el$2","_tmpl$2","_$spread","AlertDialogFooter","_el$3","_tmpl$3","AlertDialogTitle","Title","AlertDialogDescription","Description","AlertDialogChoice","CloseButton","wrapper","setWrapper","HTMLSpanElement","root","undefined","querySelector","removeAttribute","_el$4","_tmpl$4","_$use","aria-label","AlertDialogAction","AlertDialogCancel","AlertDialog","_$createComponent","KobalteAlertDialog","_$mergeProps","KobalteAlertDialogContent"],"sources":["../../../../src/components/ui/alert-dialog/alert-dialog.tsx"],"sourcesContent":["import {\n AlertDialog as KobalteAlertDialog,\n Content as KobalteAlertDialogContent,\n} from '@kobalte/core/alert-dialog'\n// Use the alert-specific export rather than DialogRoot.Content, which other imports can replace.\nimport type { ComponentProps } from 'solid-js'\nimport { createEffect, createSignal, splitProps } from 'solid-js'\nimport {\n dialogSurface,\n overlayMotion,\n overlayPositioner,\n overlayScrim,\n overlayTitle,\n} from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * AlertDialog.\n *\n * A dialog that cannot be dismissed by accident: a click on the scrim does nothing,\n * and the user must choose one of the actions. Escape is the keyboard's Cancel: it\n * closes the dialog exactly as the cancel action does, so nothing is confirmed. That\n * is the whole difference from Dialog, and it is why this exists as its own\n * component rather than a prop — a caller has to reach for it deliberately.\n *\n * The consequence is a rule of use: this is for confirming a destructive or\n * irreversible step. Wrapping an ordinary form in an AlertDialog traps someone who\n * wants to back out.\n *\n * There is deliberately no close button in the corner. An X has no label, and the\n * point of this surface is that every exit is a named choice.\n */\nexport function AlertDialog(props: ComponentProps<typeof KobalteAlertDialog>) {\n return <KobalteAlertDialog {...props} />\n}\n\nexport function AlertDialogTrigger(props: ComponentProps<typeof KobalteAlertDialog.Trigger>) {\n return <KobalteAlertDialog.Trigger {...props} />\n}\n\nexport function AlertDialogPortal(props: ComponentProps<typeof KobalteAlertDialog.Portal>) {\n return <KobalteAlertDialog.Portal {...props} />\n}\n\nexport function AlertDialogOverlay(props: ComponentProps<typeof KobalteAlertDialog.Overlay>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteAlertDialog.Overlay\n class={cn(\n overlayScrim,\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0',\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/**\n * The panel.\n *\n * Kobalte's `AlertDialog.Content` is `Dialog.Content` with `role=\"alertdialog\"`\n * and nothing else — an outside click dismisses it exactly as it dismisses a\n * Dialog. That is a real gap in the primitive, so the blocking is implemented\n * here, and it is the whole difference between this component and a Dialog:\n *\n * - Pointer and focus interactions outside are prevented, including the scrim\n * click, because a stray click that closes a confirmation is a click that\n * makes \"confirm\" meaningless.\n *\n * Escape is deliberately left to the primitive. It can only ever cancel, never\n * confirm, so it is not an accident that matters; refusing it traps a keyboard\n * user who has changed their mind, and the WAI-ARIA alertdialog pattern says\n * Escape closes. It reports `onOpenChange(false)` and restores focus to the\n * trigger, which is what the cancel action does, and as the topmost layer it\n * closes only the confirmation, not a dialog underneath it.\n *\n * There is deliberately no prop to turn the scrim blocking off. A surface that can be escaped\n * accidentally does not need to be an AlertDialog; it is a Dialog, and using this\n * one would be a claim about the flow that is not true.\n */\nconst blockDismissal = {\n onPointerDownOutside: (event: Event) => event.preventDefault(),\n onFocusOutside: (event: Event) => event.preventDefault(),\n onInteractOutside: (event: Event) => event.preventDefault(),\n} as const\n\nexport function AlertDialogContent(props: ComponentProps<typeof KobalteAlertDialogContent>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <KobalteAlertDialog.Portal>\n <AlertDialogOverlay />\n <div class={overlayPositioner}>\n <KobalteAlertDialogContent\n {...blockDismissal}\n class={cn(\n dialogSurface,\n overlayMotion,\n 'grid max-h-full w-full max-w-md gap-4 overflow-y-auto p-5',\n local.class\n )}\n {...rest}\n />\n </div>\n </KobalteAlertDialog.Portal>\n )\n}\n\nexport function AlertDialogHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"alert-dialog-header\"\n class={cn('flex flex-col gap-1.5 text-start', local.class)}\n {...rest}\n />\n )\n}\n\nexport function AlertDialogFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"alert-dialog-footer\"\n class={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', local.class)}\n {...rest}\n />\n )\n}\n\nexport function AlertDialogTitle(props: ComponentProps<typeof KobalteAlertDialog.Title>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteAlertDialog.Title class={cn(overlayTitle, local.class)} {...rest} />\n}\n\nexport function AlertDialogDescription(\n props: ComponentProps<typeof KobalteAlertDialog.Description>\n) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteAlertDialog.Description\n class={cn('text-muted-foreground text-sm', local.class)}\n {...rest}\n />\n )\n}\n\n/**\n * One of the dialog's two named choices.\n *\n * Kobalte labels its close button \"Dismiss\" by default, because a generic close\n * button is usually an icon with no text of its own. In an AlertDialog it is\n * something else: the named choices. An `aria-label` there *replaces* the visible\n * text, so a screen reader hears \"Dismiss\" twice and the user cannot tell the\n * destructive action from the safe one.\n *\n * The injected label is removed rather than overridden with an empty one. An empty\n * `aria-label` is not reliably ignored — some name computations treat its presence\n * as an explicit empty name, which leaves the button unnamed — so the attribute\n * has to go, and the visible text becomes the name. A caller whose button is an\n * icon passes its own `aria-label`, and that one is left alone.\n *\n * Applied through a layout-neutral wrapper because Kobalte keeps the `ref` for its\n * own dismissable layer and does not forward it. The wrapper is `display: contents`\n * so the button remains the flex item its parent lays out.\n */\nfunction AlertDialogChoice(props: ComponentProps<typeof KobalteAlertDialog.CloseButton>) {\n const [local, rest] = splitProps(props, ['class', 'aria-label'])\n const [wrapper, setWrapper] = createSignal<HTMLSpanElement>()\n\n createEffect(() => {\n const root = wrapper()\n if (!root || local['aria-label'] !== undefined) return\n root.querySelector('button')?.removeAttribute('aria-label')\n })\n\n return (\n <span ref={setWrapper} class=\"contents\">\n <KobalteAlertDialog.CloseButton\n class={cn(local.class)}\n aria-label={local['aria-label']}\n {...rest}\n />\n </span>\n )\n}\n\nexport function AlertDialogAction(props: ComponentProps<typeof KobalteAlertDialog.CloseButton>) {\n return <AlertDialogChoice {...props} />\n}\n\nexport function AlertDialogCancel(props: ComponentProps<typeof KobalteAlertDialog.CloseButton>) {\n return <AlertDialogChoice {...props} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAgBA,cAAYc,OAAkD;CAC5E,OAAAC,gBAAQd,aAAuBa,KAAK;AACtC;AAEA,SAAgBE,mBAAmBF,OAA0D;CAC3F,OAAAC,gBAAQd,YAAmBgB,SAAYH,KAAK;AAC9C;AAEA,SAAgBI,kBAAkBJ,OAAyD;CACzF,OAAAC,gBAAQd,YAAmBkB,QAAWL,KAAK;AAC7C;AAEA,SAAgBM,mBAAmBN,OAA0D;CAC3F,MAAM,CAACQ,OAAOC,QAAQhB,WAAWO,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAC,gBACGd,YAAmBoB,SAAOG,WAAA,EAAA,KAAA,WAAA;EAAA,OAClBX,GACLF,cACA,mGACAW,MAAMG,KACR;CAAC,EAAA,GACGF,IAAI,CAAA;AAGd;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAMG,iBAAiB;CACrBC,uBAAuBC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C,mBAAsBrC,KAAK;AACrC"}
|
|
@@ -178,7 +178,7 @@ function DialogContent(props) {
|
|
|
178
178
|
return [createComponent(DialogOverlay, {}), (() => {
|
|
179
179
|
var _el$ = _tmpl$();
|
|
180
180
|
insert(_el$, createComponent(Content, mergeProps({ get ["class"]() {
|
|
181
|
-
return cn(dialogSurface, overlayMotion, "relative grid w-full gap-4 p-5", dialogContentSizes[local.size ?? "md"], local.class);
|
|
181
|
+
return cn(dialogSurface, overlayMotion, "relative grid max-h-full w-full gap-4 overflow-y-auto p-5", dialogContentSizes[local.size ?? "md"], local.class);
|
|
182
182
|
} }, rest, { get children() {
|
|
183
183
|
return [memo(() => local.children), createComponent(Show, {
|
|
184
184
|
get when() {
|