@k2b/ui 0.55.0 → 0.56.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/browser/actions/Toolbar.js +16 -7
- package/dist/browser/actions/Toolbar.js.map +1 -1
- package/dist/browser/chat/ChatComposer.js +28 -27
- package/dist/browser/chat/ChatComposer.js.map +1 -1
- package/dist/browser/content/Lightbox.js +917 -283
- package/dist/browser/content/Lightbox.js.map +1 -1
- package/dist/browser/content/PdfPages.js +8 -3
- package/dist/browser/content/PdfPages.js.map +1 -1
- package/dist/browser/content/PdfThumbnails.js +271 -0
- package/dist/browser/content/PdfThumbnails.js.map +1 -0
- package/dist/browser/content/PdfViewer.js +11 -3
- package/dist/browser/content/PdfViewer.js.map +1 -1
- package/dist/browser/content/Timeline.js +116 -117
- package/dist/browser/content/Timeline.js.map +1 -1
- package/dist/browser/content/code-highlight.js +24 -11
- package/dist/browser/content/code-highlight.js.map +1 -1
- package/dist/browser/content/index.js +5 -1
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/lightbox-messages.js +64 -18
- package/dist/browser/content/lightbox-messages.js.map +1 -1
- package/dist/browser/content/lightbox-renderers.js +6 -0
- package/dist/browser/content/lightbox-renderers.js.map +1 -0
- package/dist/browser/content/map-view-worker.js +3 -3
- package/dist/browser/content/pdf-messages.js +16 -2
- package/dist/browser/content/pdf-messages.js.map +1 -1
- package/dist/browser/content/pdf-viewer-engine.js +15 -15
- package/dist/browser/content/pdf-viewer-worker.js +4 -5
- package/dist/browser/feedback/prompt-confirm.js +2 -0
- package/dist/browser/feedback/prompt-confirm.js.map +1 -1
- package/dist/browser/internal/truncated-title.js +9 -0
- package/dist/browser/internal/truncated-title.js.map +1 -0
- package/dist/browser/layout/DetailPanel.js +3 -5
- package/dist/browser/layout/DetailPanel.js.map +1 -1
- package/dist/browser/layout/PanelDialog.js +3 -1
- package/dist/browser/layout/PanelDialog.js.map +1 -1
- package/dist/ssr/actions/CommandMenu.js +2 -2
- package/dist/ssr/actions/CommandMenu.js.map +1 -1
- package/dist/ssr/actions/Toolbar.js +16 -7
- package/dist/ssr/actions/Toolbar.js.map +1 -1
- package/dist/ssr/chat/ChatComposer.js +31 -30
- package/dist/ssr/chat/ChatComposer.js.map +1 -1
- package/dist/ssr/content/Lightbox.js +659 -150
- package/dist/ssr/content/Lightbox.js.map +1 -1
- package/dist/ssr/content/PdfPages.js +8 -3
- package/dist/ssr/content/PdfPages.js.map +1 -1
- package/dist/ssr/content/PdfThumbnails.js +189 -0
- package/dist/ssr/content/PdfThumbnails.js.map +1 -0
- package/dist/ssr/content/PdfViewer.js +11 -3
- package/dist/ssr/content/PdfViewer.js.map +1 -1
- package/dist/ssr/content/Timeline.js +2 -5
- package/dist/ssr/content/Timeline.js.map +1 -1
- package/dist/ssr/content/code-highlight.js +24 -11
- package/dist/ssr/content/code-highlight.js.map +1 -1
- package/dist/ssr/content/index.js +5 -1
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/lightbox-messages.js +64 -18
- package/dist/ssr/content/lightbox-messages.js.map +1 -1
- package/dist/ssr/content/lightbox-renderers.js +6 -0
- package/dist/ssr/content/lightbox-renderers.js.map +1 -0
- package/dist/ssr/content/pdf-messages.js +16 -2
- package/dist/ssr/content/pdf-messages.js.map +1 -1
- package/dist/ssr/feedback/prompt-confirm.js +1 -0
- package/dist/ssr/feedback/prompt-confirm.js.map +1 -1
- package/dist/ssr/inputs/ChoiceInputs.js +2 -2
- package/dist/ssr/inputs/ChoiceInputs.js.map +1 -1
- package/dist/ssr/inputs/SignatureInput.js +2 -2
- package/dist/ssr/inputs/SignatureInput.js.map +1 -1
- package/dist/ssr/inputs/markdown/SlashCommands.js +2 -2
- package/dist/ssr/inputs/markdown/SlashCommands.js.map +1 -1
- package/dist/ssr/internal/truncated-title.js +9 -0
- package/dist/ssr/internal/truncated-title.js.map +1 -0
- package/dist/ssr/layout/DetailPanel.js +1 -4
- package/dist/ssr/layout/DetailPanel.js.map +1 -1
- package/dist/ssr/layout/PanelDialog.js +1 -0
- package/dist/ssr/layout/PanelDialog.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/Toolbar.d.ts +6 -0
- package/dist/types/chat/ChatComposer.d.ts +1 -0
- package/dist/types/content/Lightbox.d.ts +54 -14
- package/dist/types/content/PdfPages.d.ts +7 -1
- package/dist/types/content/PdfThumbnails.d.ts +26 -0
- package/dist/types/content/PdfViewer.d.ts +12 -3
- package/dist/types/content/index.d.ts +4 -2
- package/dist/types/content/lightbox-messages.d.ts +31 -8
- package/dist/types/content/lightbox-renderers.d.ts +3 -0
- package/dist/types/content/pdf-messages.d.ts +7 -0
- package/dist/types/internal/truncated-title.d.ts +7 -0
- package/package.json +20 -20
|
@@ -21,6 +21,7 @@ var _tmpl$ = /*#__PURE__*/_$template(`<header class=k2b-dialog__header><!$><!/><
|
|
|
21
21
|
_tmpl$8 = /*#__PURE__*/_$template(`<code class=k2b-confirmation-phrase>`);
|
|
22
22
|
import { createSignal, Show } from "solid-js";
|
|
23
23
|
import { TextInput } from "../inputs/TextInput";
|
|
24
|
+
import { showTruncatedTitle } from "../internal/truncated-title";
|
|
24
25
|
import { resolveUiMessages } from "../intl/messages";
|
|
25
26
|
import { dialogCore } from "./dialog-core";
|
|
26
27
|
import { dialogToneIcon, dialogToneLabel } from "./dialog-tone";
|
|
@@ -94,6 +95,7 @@ export const DialogHeader = props => (() => {
|
|
|
94
95
|
},
|
|
95
96
|
children: title => (() => {
|
|
96
97
|
var _el$10 = _$getNextElement(_tmpl$5);
|
|
98
|
+
_$addEventListener(_el$10, "pointerenter", showTruncatedTitle);
|
|
97
99
|
_$insert(_el$10, title);
|
|
98
100
|
return _el$10;
|
|
99
101
|
})()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["feedback/prompt-confirm.tsx"],"sourcesContent":["import { createSignal, type JSX, Show } from \"solid-js\";\nimport { TextInput } from \"../inputs/TextInput\";\nimport { resolveUiMessages } from \"../intl/messages\";\nimport { dialogCore } from \"./dialog-core\";\nimport { type DialogTone, dialogToneIcon, dialogToneLabel } from \"./dialog-tone\";\nimport { resolvePromptMessages } from \"./prompt-messages\";\nimport type { ConfirmOptions, DialogOptions } from \"./prompts\";\nimport { SuccessCheck } from \"./success-check\";\n\n// The dialog frame and `prompts.confirm`, apart from the form prompts: `PanelDialog` asks before discarding changes,\n// and the form prompts render date pickers whose phone sheet is a `PanelDialog`, so one module would be an import cycle.\n\nexport type PromptContent = string | HTMLElement | JSX.Element;\n\nconst PHRASE_SLOT = \"\\u0000\";\n\n/** A prompt's `variant` is its tone too: a success, warning or danger prompt carries the dialog tone of that name. */\nexport const promptTone = (variant: DialogOptions[\"variant\"]): DialogTone | undefined => (variant === \"primary\" ? undefined : variant);\n\n/** A warning asks for care, not for a destructive act: its confirm button stays primary. */\nexport const promptButtonVariant = (variant: DialogOptions[\"variant\"]): \"danger\" | \"primary\" | \"success\" =>\n variant === undefined || variant === \"warning\" ? \"primary\" : variant;\n\nexport const DialogHeader = (props: {\n close: () => void;\n title?: string;\n icon?: string;\n tone?: DialogTone;\n /** A success tone draws its check once when the header appears; see `prompts.success`. */\n celebrate?: boolean;\n}): JSX.Element => (\n <header class=\"k2b-dialog__header\">\n <Show\n when={props.celebrate && props.tone === \"success\"}\n fallback={\n <Show when={props.tone ? dialogToneIcon(props.tone) : props.icon}>\n {(icon) => <i class={icon()} data-tone={props.tone} aria-hidden=\"true\" />}\n </Show>\n }\n >\n <SuccessCheck />\n </Show>\n <Show when={props.tone}>\n {(tone) => (\n <span class=\"k2b-sr-only\" data-dialog-tone-label>\n {dialogToneLabel(resolveUiMessages(), tone())}\n </span>\n )}\n </Show>\n <Show when={props.title} fallback={<span class=\"k2b-dialog__header-spacer\" />}>\n {(title) => <h2>{title()}</h2>}\n </Show>\n <button type=\"button\" class=\"k2b-dialog__close\" aria-label={resolveUiMessages().closeDialog} onClick={props.close}>\n <i class=\"ti ti-x\" aria-hidden=\"true\" />\n </button>\n </header>\n);\n\nexport const panelClass = (options?: Pick<DialogOptions, \"size\" | \"surface\" | \"variant\">): string => {\n const size = options?.size ?? \"medium\";\n const variant = options?.variant && options.variant !== \"primary\" ? ` k2b-dialog--${options.variant}` : \"\";\n return `k2b-dialog k2b-dialog--${size}${variant}${options?.surface === \"bare\" ? \" is-bare\" : \"\"}`;\n};\n\nexport const contentClass = (surface?: DialogOptions[\"surface\"]): string =>\n surface === \"bare\" ? \"k2b-dialog__viewport is-bare\" : \"k2b-dialog__viewport\";\n\nexport const confirmPrompt = (content: PromptContent, options?: ConfirmOptions): Promise<boolean | undefined> => {\n const confirmationPhrase = options?.confirmationPhrase;\n if (confirmationPhrase !== undefined && (confirmationPhrase.trim().length === 0 || /[\\r\\n\\t]/.test(confirmationPhrase))) {\n throw new Error(\"confirmationPhrase must be non-empty, visible, and single-line\");\n }\n let confirmationInput: HTMLInputElement | undefined;\n\n return dialogCore.open<boolean>(\n (close) => {\n if (!confirmationPhrase) {\n return (\n <div class=\"k2b-dialog__panel\">\n <DialogHeader title={options?.title} icon={options?.icon} tone={promptTone(options?.variant)} close={() => close(false)} />\n <div class=\"k2b-dialog__body\">{content}</div>\n <footer class=\"k2b-dialog__actions\">\n <button type=\"button\" class=\"k2b-button\" data-variant=\"secondary\" onClick={() => close(false)}>\n {options?.cancelText || resolveUiMessages().cancel}\n </button>\n <button type=\"button\" class=\"k2b-button\" data-variant={promptButtonVariant(options?.variant)} onClick={() => close(true)}>\n {options?.confirmText || resolvePromptMessages().confirm}\n </button>\n </footer>\n </div>\n );\n }\n\n // The catalog owns word order; the slot marks where the verbatim phrase is rendered as code.\n const [labelBefore, labelAfter] = resolvePromptMessages().typeToConfirm({ phrase: PHRASE_SLOT }).split(PHRASE_SLOT);\n const [confirmationValue, setConfirmationValue] = createSignal(\"\");\n const canConfirm = () => confirmationValue() === confirmationPhrase;\n const submit = (event: SubmitEvent) => {\n event.preventDefault();\n if (canConfirm()) close(true);\n };\n\n return (\n <form class=\"k2b-dialog__panel\" onSubmit={submit}>\n <DialogHeader title={options?.title} icon={options?.icon} tone={promptTone(options?.variant)} close={() => close(false)} />\n <div class=\"k2b-dialog__body k2b-prompt-form\">\n <div class=\"k2b-prompt-copy\">{content}</div>\n <TextInput\n ref={(element) => {\n confirmationInput = element;\n }}\n label={\n <>\n {labelBefore}\n <code class=\"k2b-confirmation-phrase\">{confirmationPhrase}</code>\n {labelAfter}\n </>\n }\n value={confirmationValue}\n onValueChange={setConfirmationValue}\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck={false}\n monospace\n required\n />\n </div>\n <footer class=\"k2b-dialog__actions\">\n <button type=\"button\" class=\"k2b-button\" data-variant=\"secondary\" onClick={() => close(false)}>\n {options?.cancelText || resolveUiMessages().cancel}\n </button>\n <button type=\"submit\" class=\"k2b-button\" data-variant={promptButtonVariant(options?.variant)} disabled={!canConfirm()}>\n {options?.confirmText || resolvePromptMessages().confirm}\n </button>\n </footer>\n </form>\n );\n },\n {\n panelClassName: panelClass(options),\n contentClassName: contentClass(options?.surface),\n initialFocus: confirmationPhrase ? () => confirmationInput ?? null : undefined,\n signal: options?.signal,\n cancelBehavior: options?.cancelBehavior,\n history: options?.history,\n ariaLabel: options?.ariaLabel ?? options?.title ?? resolvePromptMessages().confirmation,\n },\n );\n};\n\n/** `prompts` starts as this object; `PanelDialog` asks through it, so it reaches a replaced `prompts.confirm` too. */\nexport const sharedPrompts = { confirm: confirmPrompt };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,EAAY,IAAI,QAAQ,UAAU;AACvD,SAAS,SAAS,QAAQ,qBAAqB;AAC/C,SAAS,iBAAiB,QAAQ,kBAAkB;AACpD,SAAS,UAAU,QAAQ,eAAe;AAC1C,SAA0B,cAAc,EAAE,eAAe,QAAQ,eAAe;AAChF,SAAS,qBAAqB,QAAQ,mBAAmB;AAEzD,SAAS,YAAY,QAAQ,iBAAiB;;AAE9C;AACA;;AAIA,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;QAAA;QAGf,KAAK,EAAE,iBAAiB;QACxB,aAAa,EAAE,oBAAoB;QACnC,YAAY;QACZ,cAAc;QACd,UAAU,EAAE,KAAK;QACjB,SAAS;QACT,QAAQ;MAAA;MAAA,iBAIiE,MAAM,KAAK,CAAC,KAAK,CAAC;MAAA,uBAC1F,OAAO,EAAE,UAAU,IAAI,iBAAiB,CAAC,CAAC,CAAC,MAAM;MAAA,uBAGjD,OAAO,EAAE,WAAW,IAAI,qBAAqB,CAAC,CAAC,CAAC,OAAO;MAAA;QAAA,WADH,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC;UAAA,OAAY,CAAC,UAAU,CAAC,CAAC;QAAA;QAAA;QAAA;MAAA;QAAA;QAAA;MAAA;MAAA;MAAA;IAAA;EAM7H,CAAC,EACD;IACE,cAAc,EAAE,UAAU,CAAC,OAAO,CAAC;IACnC,gBAAgB,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC;IAChD,YAAY,EAAE,kBAAkB,GAAG,MAAM,iBAAiB,IAAI,IAAI,GAAG,SAAS;IAC9E,MAAM,EAAE,OAAO,EAAE,MAAM;IACvB,cAAc,EAAE,OAAO,EAAE,cAAc;IACvC,OAAO,EAAE,OAAO,EAAE,OAAO;IACzB,SAAS,EAAE,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,KAAK,IAAI,qBAAqB,CAAC,CAAC,CAAC;EAC7E,CACF,CAAC;AACH,CAAC;;AAED;AACA,OAAO,MAAM,aAAa,GAAG;EAAE,OAAO,EAAE;AAAc,CAAC;AAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["feedback/prompt-confirm.tsx"],"sourcesContent":["import { createSignal, type JSX, Show } from \"solid-js\";\nimport { TextInput } from \"../inputs/TextInput\";\nimport { showTruncatedTitle } from \"../internal/truncated-title\";\nimport { resolveUiMessages } from \"../intl/messages\";\nimport { dialogCore } from \"./dialog-core\";\nimport { type DialogTone, dialogToneIcon, dialogToneLabel } from \"./dialog-tone\";\nimport { resolvePromptMessages } from \"./prompt-messages\";\nimport type { ConfirmOptions, DialogOptions } from \"./prompts\";\nimport { SuccessCheck } from \"./success-check\";\n\n// The dialog frame and `prompts.confirm`, apart from the form prompts: `PanelDialog` asks before discarding changes,\n// and the form prompts render date pickers whose phone sheet is a `PanelDialog`, so one module would be an import cycle.\n\nexport type PromptContent = string | HTMLElement | JSX.Element;\n\nconst PHRASE_SLOT = \"\\u0000\";\n\n/** A prompt's `variant` is its tone too: a success, warning or danger prompt carries the dialog tone of that name. */\nexport const promptTone = (variant: DialogOptions[\"variant\"]): DialogTone | undefined => (variant === \"primary\" ? undefined : variant);\n\n/** A warning asks for care, not for a destructive act: its confirm button stays primary. */\nexport const promptButtonVariant = (variant: DialogOptions[\"variant\"]): \"danger\" | \"primary\" | \"success\" =>\n variant === undefined || variant === \"warning\" ? \"primary\" : variant;\n\nexport const DialogHeader = (props: {\n close: () => void;\n title?: string;\n icon?: string;\n tone?: DialogTone;\n /** A success tone draws its check once when the header appears; see `prompts.success`. */\n celebrate?: boolean;\n}): JSX.Element => (\n <header class=\"k2b-dialog__header\">\n <Show\n when={props.celebrate && props.tone === \"success\"}\n fallback={\n <Show when={props.tone ? dialogToneIcon(props.tone) : props.icon}>\n {(icon) => <i class={icon()} data-tone={props.tone} aria-hidden=\"true\" />}\n </Show>\n }\n >\n <SuccessCheck />\n </Show>\n <Show when={props.tone}>\n {(tone) => (\n <span class=\"k2b-sr-only\" data-dialog-tone-label>\n {dialogToneLabel(resolveUiMessages(), tone())}\n </span>\n )}\n </Show>\n <Show when={props.title} fallback={<span class=\"k2b-dialog__header-spacer\" />}>\n {(title) => <h2 onPointerEnter={showTruncatedTitle}>{title()}</h2>}\n </Show>\n <button type=\"button\" class=\"k2b-dialog__close\" aria-label={resolveUiMessages().closeDialog} onClick={props.close}>\n <i class=\"ti ti-x\" aria-hidden=\"true\" />\n </button>\n </header>\n);\n\nexport const panelClass = (options?: Pick<DialogOptions, \"size\" | \"surface\" | \"variant\">): string => {\n const size = options?.size ?? \"medium\";\n const variant = options?.variant && options.variant !== \"primary\" ? ` k2b-dialog--${options.variant}` : \"\";\n return `k2b-dialog k2b-dialog--${size}${variant}${options?.surface === \"bare\" ? \" is-bare\" : \"\"}`;\n};\n\nexport const contentClass = (surface?: DialogOptions[\"surface\"]): string =>\n surface === \"bare\" ? \"k2b-dialog__viewport is-bare\" : \"k2b-dialog__viewport\";\n\nexport const confirmPrompt = (content: PromptContent, options?: ConfirmOptions): Promise<boolean | undefined> => {\n const confirmationPhrase = options?.confirmationPhrase;\n if (confirmationPhrase !== undefined && (confirmationPhrase.trim().length === 0 || /[\\r\\n\\t]/.test(confirmationPhrase))) {\n throw new Error(\"confirmationPhrase must be non-empty, visible, and single-line\");\n }\n let confirmationInput: HTMLInputElement | undefined;\n\n return dialogCore.open<boolean>(\n (close) => {\n if (!confirmationPhrase) {\n return (\n <div class=\"k2b-dialog__panel\">\n <DialogHeader title={options?.title} icon={options?.icon} tone={promptTone(options?.variant)} close={() => close(false)} />\n <div class=\"k2b-dialog__body\">{content}</div>\n <footer class=\"k2b-dialog__actions\">\n <button type=\"button\" class=\"k2b-button\" data-variant=\"secondary\" onClick={() => close(false)}>\n {options?.cancelText || resolveUiMessages().cancel}\n </button>\n <button type=\"button\" class=\"k2b-button\" data-variant={promptButtonVariant(options?.variant)} onClick={() => close(true)}>\n {options?.confirmText || resolvePromptMessages().confirm}\n </button>\n </footer>\n </div>\n );\n }\n\n // The catalog owns word order; the slot marks where the verbatim phrase is rendered as code.\n const [labelBefore, labelAfter] = resolvePromptMessages().typeToConfirm({ phrase: PHRASE_SLOT }).split(PHRASE_SLOT);\n const [confirmationValue, setConfirmationValue] = createSignal(\"\");\n const canConfirm = () => confirmationValue() === confirmationPhrase;\n const submit = (event: SubmitEvent) => {\n event.preventDefault();\n if (canConfirm()) close(true);\n };\n\n return (\n <form class=\"k2b-dialog__panel\" onSubmit={submit}>\n <DialogHeader title={options?.title} icon={options?.icon} tone={promptTone(options?.variant)} close={() => close(false)} />\n <div class=\"k2b-dialog__body k2b-prompt-form\">\n <div class=\"k2b-prompt-copy\">{content}</div>\n <TextInput\n ref={(element) => {\n confirmationInput = element;\n }}\n label={\n <>\n {labelBefore}\n <code class=\"k2b-confirmation-phrase\">{confirmationPhrase}</code>\n {labelAfter}\n </>\n }\n value={confirmationValue}\n onValueChange={setConfirmationValue}\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck={false}\n monospace\n required\n />\n </div>\n <footer class=\"k2b-dialog__actions\">\n <button type=\"button\" class=\"k2b-button\" data-variant=\"secondary\" onClick={() => close(false)}>\n {options?.cancelText || resolveUiMessages().cancel}\n </button>\n <button type=\"submit\" class=\"k2b-button\" data-variant={promptButtonVariant(options?.variant)} disabled={!canConfirm()}>\n {options?.confirmText || resolvePromptMessages().confirm}\n </button>\n </footer>\n </form>\n );\n },\n {\n panelClassName: panelClass(options),\n contentClassName: contentClass(options?.surface),\n initialFocus: confirmationPhrase ? () => confirmationInput ?? null : undefined,\n signal: options?.signal,\n cancelBehavior: options?.cancelBehavior,\n history: options?.history,\n ariaLabel: options?.ariaLabel ?? options?.title ?? resolvePromptMessages().confirmation,\n },\n );\n};\n\n/** `prompts` starts as this object; `PanelDialog` asks through it, so it reaches a replaced `prompts.confirm` too. */\nexport const sharedPrompts = { confirm: confirmPrompt };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,EAAY,IAAI,QAAQ,UAAU;AACvD,SAAS,SAAS,QAAQ,qBAAqB;AAC/C,SAAS,kBAAkB,QAAQ,6BAA6B;AAChE,SAAS,iBAAiB,QAAQ,kBAAkB;AACpD,SAAS,UAAU,QAAQ,eAAe;AAC1C,SAA0B,cAAc,EAAE,eAAe,QAAQ,eAAe;AAChF,SAAS,qBAAqB,QAAQ,mBAAmB;AAEzD,SAAS,YAAY,QAAQ,iBAAiB;;AAE9C;AACA;;AAIA,MAAM,WAAW,GAAG,QAAQ;;AAE5B;AAC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KAAK,EAAE,iBAAiB;QACxB,aAAa,EAAE,oBAAoB;QACnC,YAAY;QACZ,cAAc;QACd,UAAU,EAAE,KAAK;QACjB,SAAS;QACT,QAAQ;MAAA;MAAA,iBAIiE,MAAM,KAAK,CAAC,KAAK,CAAC;MAAA,uBAC1F,OAAO,EAAE,UAAU,IAAI,iBAAiB,CAAC,CAAC,CAAC,MAAM;MAAA,uBAGjD,OAAO,EAAE,WAAW,IAAI,qBAAqB,CAAC,CAAC,CAAC,OAAO;MAAA;QAAA,WADH,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC;UAAA,OAAY,CAAC,UAAU,CAAC,CAAC;QAAA;QAAA;QAAA;MAAA;QAAA;QAAA;MAAA;MAAA;MAAA;IAAA;EAM7H,CAAC,EACD;IACE,cAAc,EAAE,UAAU,CAAC,OAAO,CAAC;IACnC,gBAAgB,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC;IAChD,YAAY,EAAE,kBAAkB,GAAG,MAAM,iBAAiB,IAAI,IAAI,GAAG,SAAS;IAC9E,MAAM,EAAE,OAAO,EAAE,MAAM;IACvB,cAAc,EAAE,OAAO,EAAE,cAAc;IACvC,OAAO,EAAE,OAAO,EAAE,OAAO;IACzB,SAAS,EAAE,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,KAAK,IAAI,qBAAqB,CAAC,CAAC,CAAC;EAC7E,CACF,CAAC;AACH,CAAC;;AAED;AACA,OAAO,MAAM,aAAa,GAAG;EAAE,OAAO,EAAE;AAAc,CAAC;AAAC","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Titles in headers stay on one line and end with an ellipsis, so a long name never moves what follows. Pointing at a
|
|
3
|
+
* cut title shows all of it as the native hint; assistive technology reads the full text content either way.
|
|
4
|
+
*/
|
|
5
|
+
export const showTruncatedTitle = event => {
|
|
6
|
+
const title = event.currentTarget;
|
|
7
|
+
if (title.scrollWidth > title.clientWidth + 1) title.title = title.textContent ?? "";else title.removeAttribute("title");
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=truncated-title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["internal/truncated-title.ts"],"sourcesContent":["/**\n * Titles in headers stay on one line and end with an ellipsis, so a long name never moves what follows. Pointing at a\n * cut title shows all of it as the native hint; assistive technology reads the full text content either way.\n */\nexport const showTruncatedTitle = (event: PointerEvent & { currentTarget: HTMLElement }) => {\n const title = event.currentTarget;\n if (title.scrollWidth > title.clientWidth + 1) title.title = title.textContent ?? \"\";\n else title.removeAttribute(\"title\");\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,OAAO,MAAM,kBAAkB,GAAI,KAAoD,IAAK;EAC1F,MAAM,KAAK,GAAG,KAAK,CAAC,aAAa;EACjC,IAAI,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,GAAG,CAAC,EAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,KAChF,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC;AACrC,CAAC","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
|
5
5
|
import { className as _$className } from "solid-js/web";
|
|
6
6
|
import { effect as _$effect } from "solid-js/web";
|
|
7
7
|
import { getNextMarker as _$getNextMarker } from "solid-js/web";
|
|
8
|
+
import { addEventListener as _$addEventListener } from "solid-js/web";
|
|
8
9
|
import { insert as _$insert } from "solid-js/web";
|
|
9
10
|
import { createComponent as _$createComponent } from "solid-js/web";
|
|
10
11
|
import { getNextElement as _$getNextElement } from "solid-js/web";
|
|
@@ -34,6 +35,7 @@ import { createUniqueId, Show, splitProps } from "solid-js";
|
|
|
34
35
|
import { Button, ButtonLink, IconButton } from "../actions/Button";
|
|
35
36
|
import { Dropdown } from "../actions/Dropdown";
|
|
36
37
|
import { Checkbox } from "../inputs/Checkbox";
|
|
38
|
+
import { showTruncatedTitle } from "../internal/truncated-title";
|
|
37
39
|
import { SectionFrameDefault } from "../surfaces/Section";
|
|
38
40
|
import { useDetailPanelMessages } from "./detail-panel-messages";
|
|
39
41
|
import { createScrollFade } from "./scroll-fade";
|
|
@@ -48,10 +50,6 @@ import { createScrollFade } from "./scroll-fade";
|
|
|
48
50
|
/** A row that only shows something, such as a person and their role: the columns of an action, without a command. */
|
|
49
51
|
|
|
50
52
|
const classNames = (base, extra) => extra ? `${base} ${extra}` : base;
|
|
51
|
-
const showTruncatedTitle = event => {
|
|
52
|
-
const heading = event.currentTarget;
|
|
53
|
-
if (heading.scrollHeight > heading.clientHeight + 1) heading.title = heading.textContent ?? "";else heading.removeAttribute("title");
|
|
54
|
-
};
|
|
55
53
|
const DetailPanelHeader = props => {
|
|
56
54
|
const t = useDetailPanelMessages();
|
|
57
55
|
const menuLabel = () => props.menuLabel ?? t().moreActions;
|
|
@@ -119,7 +117,7 @@ const DetailPanelHeader = props => {
|
|
|
119
117
|
return _el$4;
|
|
120
118
|
}
|
|
121
119
|
}), _el$25, _co$8);
|
|
122
|
-
_el$6
|
|
120
|
+
_$addEventListener(_el$6, "pointerenter", showTruncatedTitle);
|
|
123
121
|
_$insert(_el$6, () => props.title);
|
|
124
122
|
_$insert(_el$5, _$createComponent(Show, {
|
|
125
123
|
get when() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["layout/DetailPanel.tsx"],"sourcesContent":["import { createUniqueId, type JSX, Show, splitProps } from \"solid-js\";\nimport { Button, ButtonLink, type ButtonLinkProps, type ButtonProps, IconButton } from \"../actions/Button\";\nimport { Dropdown, type DropdownItem } from \"../actions/Dropdown\";\nimport { Checkbox } from \"../inputs/Checkbox\";\nimport { SectionFrameDefault } from \"../surfaces/Section\";\nimport { useDetailPanelMessages } from \"./detail-panel-messages\";\nimport { createScrollFade } from \"./scroll-fade\";\n\nexport type DetailPanelProps = {\n /** Plain sections share their host surface, as in AppWorkspace.Detail. */\n surface?: \"default\" | \"plain\";\n children: JSX.Element;\n class?: string;\n};\n\ntype DetailPanelHeaderBaseProps = {\n /**\n * The item's state, such as a \"Done\" or \"Read only\" badge, at the start of the line below the title. Name a type\n * only where one list mixes types that the title and subtitle do not tell apart, such as \"Query\" or \"Action\".\n */\n kind?: JSX.Element;\n title: JSX.Element;\n subtitle?: JSX.Element;\n meta?: JSX.Element;\n /**\n * The resource's \"…\" menu, shown before `actions`. Pass every less frequent command on the shown resource here,\n * so each panel opens its menu from the same place; an empty list shows no button.\n */\n menu?: readonly DropdownItem[];\n /** Accessible name of the \"…\" button. Defaults to \"More actions\". */\n menuLabel?: string;\n actions?: JSX.Element;\n primaryActions?: JSX.Element;\n class?: string;\n};\n\nexport type DetailPanelHeaderProps = DetailPanelHeaderBaseProps &\n (\n | {\n leading?: JSX.Element;\n icon?: never;\n }\n | {\n leading?: never;\n icon?: string;\n }\n );\n\nexport type DetailPanelBodyProps = {\n scrollFade?: boolean;\n children: JSX.Element;\n scrollPreserveKey?: string;\n class?: string;\n};\n\nexport type DetailPanelSummaryProps = {\n title: JSX.Element;\n children: JSX.Element;\n actions?: JSX.Element;\n class?: string;\n};\n\nexport type DetailPanelGroupProps = {\n children: JSX.Element;\n label?: string;\n /**\n * A visible quiet title, such as \"More about this conversation\". Its sections then stand flush as rows below\n * it, which suits collapsed secondary sections with a `summary`.\n */\n title?: JSX.Element;\n class?: string;\n};\n\n/** One direct secondary command, rendered as a sibling icon button at the end of the row. */\nexport type DetailPanelActionSecondary = {\n /** Icon class, for example `ti ti-trash`. */\n icon: string;\n /** Accessible name and tooltip of the icon button. */\n label: string;\n onClick: () => void;\n variant?: \"danger\";\n};\n\n/**\n * A checkbox before the row that toggles on its own, such as \"done\" for a task the row opens. It always shows its\n * state, unlike a secondary action, which waits for hover.\n */\nexport type DetailPanelActionCheckbox = {\n checked: boolean;\n /** Accessible name, after the row, such as \"Done: Call Mrs. Weber\". */\n label: string;\n onChange: (checked: boolean) => void;\n disabled?: boolean;\n};\n\ntype DetailPanelActionBaseProps = {\n title: JSX.Element;\n description?: JSX.Element;\n leading?: JSX.Element;\n trailing?: JSX.Element;\n secondaryAction?: DetailPanelActionSecondary;\n checkbox?: DetailPanelActionCheckbox;\n /** Marks the row of the current place, such as the section in view, in the panel's accent. */\n current?: boolean;\n /** Lets the title wrap to two lines instead of ending with an ellipsis. */\n wrap?: boolean;\n class?: string;\n};\n\ntype DetailPanelActionMenuProps =\n | {\n menuItems?: never;\n menuLabel?: never;\n }\n | {\n menuItems: readonly DropdownItem[];\n menuLabel: string;\n };\n\nexport type DetailPanelActionLinkProps = DetailPanelActionBaseProps &\n DetailPanelActionMenuProps &\n Omit<ButtonLinkProps, \"children\" | \"class\" | \"size\" | \"title\" | \"variant\"> & {\n href: string;\n };\n\nexport type DetailPanelActionButtonProps = DetailPanelActionBaseProps &\n DetailPanelActionMenuProps &\n Omit<ButtonProps, \"children\" | \"class\" | \"size\" | \"title\" | \"variant\"> & {\n href?: never;\n };\n\nexport type DetailPanelActionProps = DetailPanelActionLinkProps | DetailPanelActionButtonProps;\n\n/** A row that only shows something, such as a person and their role: the columns of an action, without a command. */\nexport type DetailPanelRowProps = {\n title: JSX.Element;\n description?: JSX.Element;\n leading?: JSX.Element;\n trailing?: JSX.Element;\n class?: string;\n};\n\ntype DetailPanelComponent = ((props: DetailPanelProps) => JSX.Element) & {\n Header: (props: DetailPanelHeaderProps) => JSX.Element;\n Body: (props: DetailPanelBodyProps) => JSX.Element;\n Summary: (props: DetailPanelSummaryProps) => JSX.Element;\n Group: (props: DetailPanelGroupProps) => JSX.Element;\n Action: (props: DetailPanelActionProps) => JSX.Element;\n Row: (props: DetailPanelRowProps) => JSX.Element;\n};\n\nconst classNames = (base: string, extra?: string): string => (extra ? `${base} ${extra}` : base);\n\nconst showTruncatedTitle = (event: PointerEvent & { currentTarget: HTMLHeadingElement }) => {\n const heading = event.currentTarget;\n if (heading.scrollHeight > heading.clientHeight + 1) heading.title = heading.textContent ?? \"\";\n else heading.removeAttribute(\"title\");\n};\n\nconst DetailPanelHeader = (props: DetailPanelHeaderProps): JSX.Element => {\n const t = useDetailPanelMessages();\n const menuLabel = () => props.menuLabel ?? t().moreActions;\n const menuTrigger = () => (\n <Dropdown.Root items={props.menu ?? []} align=\"end\" label={menuLabel()} phone=\"sheet\">\n <Dropdown.Trigger iconOnly size=\"sm\" variant=\"ghost\" label={menuLabel()} tooltip={menuLabel()}>\n <i class=\"ti ti-dots\" aria-hidden=\"true\" />\n </Dropdown.Trigger>\n </Dropdown.Root>\n );\n // With primary actions, \"…\" ends their row, next to the commands it extends; otherwise it sits beside close.\n const menuInActions = () => Boolean(props.menu?.length) && !props.primaryActions;\n return (\n <header class={classNames(\"k2b-detail-panel__header\", props.class)}>\n <div class=\"k2b-detail-panel__header-main\" data-identity={props.icon || props.leading ? \"true\" : undefined}>\n <Show when={props.icon}>\n {(icon) => (\n <span class=\"k2b-detail-panel__header-icon\" aria-hidden=\"true\">\n <i class={icon()} />\n </span>\n )}\n </Show>\n <Show when={props.leading}>\n <div class=\"k2b-detail-panel__header-leading\">{props.leading}</div>\n </Show>\n <div class=\"k2b-detail-panel__heading\">\n {/* The name comes first, beside the close button. A long title wraps to two lines and ends with an ellipsis;\n then the native hint shows all of it. */}\n <h2 onPointerEnter={showTruncatedTitle}>{props.title}</h2>\n <Show when={props.kind || props.subtitle || props.meta}>\n <div class=\"k2b-detail-panel__supporting\">\n <Show when={props.kind}>\n <div class=\"k2b-detail-panel__kind\">{props.kind}</div>\n </Show>\n <Show when={props.subtitle}>\n <p>{props.subtitle}</p>\n </Show>\n <Show when={props.meta}>\n <div class=\"k2b-detail-panel__meta\">{props.meta}</div>\n </Show>\n </div>\n </Show>\n </div>\n <Show when={menuInActions() || props.actions}>\n <div class=\"k2b-detail-panel__actions\">\n <Show when={menuInActions()}>{menuTrigger()}</Show>\n {props.actions}\n </div>\n </Show>\n </div>\n <Show when={props.primaryActions}>\n <div class=\"k2b-detail-panel__primary-actions\">\n {props.primaryActions}\n <Show when={props.menu?.length}>{menuTrigger()}</Show>\n </div>\n </Show>\n </header>\n );\n};\n\nconst DetailPanelBody = (props: DetailPanelBodyProps): JSX.Element => {\n let body!: HTMLDivElement;\n createScrollFade(\n () => body,\n () => props.scrollFade !== false,\n );\n return (\n <div\n ref={body}\n class={classNames(\"k2b-detail-panel__body\", props.class)}\n data-scroll-fade-mode={props.scrollFade !== false ? \"both\" : undefined}\n data-scroll-preserve={props.scrollPreserveKey}\n >\n {props.children}\n </div>\n );\n};\n\nconst DetailPanelSummary = (props: DetailPanelSummaryProps): JSX.Element => {\n const headingId = `k2b-detail-panel-summary-${createUniqueId()}`;\n\n return (\n <section class={classNames(\"k2b-detail-panel__summary\", props.class)} aria-labelledby={headingId}>\n <header class=\"k2b-detail-panel__summary-header\">\n <h3 id={headingId}>{props.title}</h3>\n <Show when={props.actions}>\n <div class=\"k2b-detail-panel__summary-actions\">{props.actions}</div>\n </Show>\n </header>\n <div class=\"k2b-detail-panel__summary-body\">{props.children}</div>\n </section>\n );\n};\n\nconst DetailPanelGroup = (props: DetailPanelGroupProps): JSX.Element => {\n const titleId = `k2b-detail-panel-group-${createUniqueId()}`;\n return (\n <div\n class={classNames(\"k2b-detail-panel__group\", props.class)}\n role=\"group\"\n aria-label={props.title ? undefined : props.label}\n aria-labelledby={props.title ? titleId : undefined}\n data-titled={props.title ? \"true\" : undefined}\n >\n <Show when={props.title}>\n <div class=\"k2b-detail-panel__group-title\" id={titleId}>\n {props.title}\n </div>\n </Show>\n {props.children}\n </div>\n );\n};\n\nconst DetailPanelActionContent = (props: DetailPanelActionBaseProps): JSX.Element => (\n <>\n {/* Hidden while empty: a row's icon, or its text when it has none, starts on the section's text edge. */}\n <span class=\"k2b-detail-panel__action-leading\">{props.leading}</span>\n <span class=\"k2b-detail-panel__action-copy\">\n <span class=\"k2b-detail-panel__action-title\">{props.title}</span>\n <Show when={props.description}>\n <span class=\"k2b-detail-panel__action-description\">{props.description}</span>\n </Show>\n </span>\n <Show when={props.trailing}>\n <span class=\"k2b-detail-panel__action-trailing\">{props.trailing}</span>\n </Show>\n </>\n);\n\nconst DetailPanelAction = (props: DetailPanelActionProps): JSX.Element => {\n const [local, rest] = splitProps(props, [\n \"class\",\n \"current\",\n \"description\",\n \"href\",\n \"leading\",\n \"menuItems\",\n \"menuLabel\",\n \"secondaryAction\",\n \"checkbox\",\n \"title\",\n \"trailing\",\n \"wrap\",\n ]);\n const className = classNames(\"k2b-detail-panel__action\", local.class);\n const content = () => (\n <DetailPanelActionContent title={local.title} description={local.description} leading={local.leading} trailing={local.trailing} />\n );\n\n const action = () => (\n <Show\n when={local.href !== undefined}\n fallback={\n <Button\n {...(rest as Omit<DetailPanelActionButtonProps, keyof DetailPanelActionBaseProps>)}\n class={className}\n aria-current={local.current ? \"true\" : undefined}\n data-current={local.current ? \"true\" : undefined}\n data-wrap={local.wrap ? \"true\" : undefined}\n variant=\"ghost\"\n size=\"sm\"\n >\n {content()}\n </Button>\n }\n >\n <ButtonLink\n {...(rest as Omit<DetailPanelActionLinkProps, keyof DetailPanelActionBaseProps | \"href\">)}\n href={local.href as string}\n class={className}\n aria-current={local.current ? \"location\" : undefined}\n data-current={local.current ? \"true\" : undefined}\n data-wrap={local.wrap ? \"true\" : undefined}\n variant=\"ghost\"\n size=\"sm\"\n >\n {content()}\n </ButtonLink>\n </Show>\n );\n\n return (\n <Show when={local.secondaryAction || local.menuItems?.length || local.checkbox} fallback={action()}>\n <div class=\"k2b-detail-panel__action-row\" data-checkbox={local.checkbox ? \"true\" : undefined}>\n <Show when={local.checkbox}>\n {(checkbox) => (\n <Checkbox\n class=\"k2b-detail-panel__action-check\"\n aria-label={checkbox().label}\n value={checkbox().checked}\n disabled={checkbox().disabled}\n onValueChange={(checked) => checkbox().onChange(checked)}\n />\n )}\n </Show>\n {action()}\n <Show when={local.secondaryAction}>\n {(secondary) => (\n <IconButton\n size=\"sm\"\n variant=\"ghost\"\n label={secondary().label}\n class=\"k2b-detail-panel__action-secondary\"\n data-tone={secondary().variant}\n onClick={() => secondary().onClick()}\n >\n <i class={secondary().icon} aria-hidden=\"true\" />\n </IconButton>\n )}\n </Show>\n <Show when={local.menuItems?.length}>\n <Dropdown.Root items={local.menuItems ?? []} align=\"end\" label={local.menuLabel} class=\"k2b-detail-panel__action-menu\">\n <Dropdown.Trigger iconOnly size=\"sm\" variant=\"ghost\" label={local.menuLabel} class=\"k2b-detail-panel__action-menu-trigger\">\n <i class=\"ti ti-dots\" aria-hidden=\"true\" />\n </Dropdown.Trigger>\n </Dropdown.Root>\n </Show>\n </div>\n </Show>\n );\n};\n\nconst DetailPanelRow = (props: DetailPanelRowProps): JSX.Element => (\n <div class={classNames(\"k2b-detail-panel__row\", props.class)}>\n <DetailPanelActionContent title={props.title} description={props.description} leading={props.leading} trailing={props.trailing} />\n </div>\n);\n\n/**\n * The panel for one selected object. Its topics are `Section`s; the panel frames them itself, so they stand flat\n * inside it.\n */\nconst DetailPanel = ((props: DetailPanelProps): JSX.Element => (\n <div class={classNames(\"k2b-detail-panel\", props.class)} data-surface={props.surface}>\n <SectionFrameDefault.Provider value=\"none\">{props.children}</SectionFrameDefault.Provider>\n </div>\n)) as DetailPanelComponent;\n\nDetailPanel.Header = DetailPanelHeader;\nDetailPanel.Body = DetailPanelBody;\nDetailPanel.Summary = DetailPanelSummary;\nDetailPanel.Group = DetailPanelGroup;\nDetailPanel.Action = DetailPanelAction;\nDetailPanel.Row = DetailPanelRow;\n\nexport default DetailPanel;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc,EAAY,IAAI,EAAE,UAAU,QAAQ,UAAU;AACrE,SAAS,MAAM,EAAE,UAAU,EAA0C,UAAU,QAAQ,mBAAmB;AAC1G,SAAS,QAAQ,QAA2B,qBAAqB;AACjE,SAAS,QAAQ,QAAQ,oBAAoB;AAC7C,SAAS,mBAAmB,QAAQ,qBAAqB;AACzD,SAAS,sBAAsB,QAAQ,y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D,UAAU,CAAC,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC;MAAA,OAAgB,KAAK,CAAC,OAAO;IAAA;IAAA;IAAA;EAAA;IAAA;IAAA;EAAA;EAAA;AAAA,IAG5D;AAE1B,WAAW,CAAC,MAAM,GAAG,iBAAiB;AACtC,WAAW,CAAC,IAAI,GAAG,eAAe;AAClC,WAAW,CAAC,OAAO,GAAG,kBAAkB;AACxC,WAAW,CAAC,KAAK,GAAG,gBAAgB;AACpC,WAAW,CAAC,MAAM,GAAG,iBAAiB;AACtC,WAAW,CAAC,GAAG,GAAG,cAAc;AAEhC,eAAe,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["layout/DetailPanel.tsx"],"sourcesContent":["import { createUniqueId, type JSX, Show, splitProps } from \"solid-js\";\nimport { Button, ButtonLink, type ButtonLinkProps, type ButtonProps, IconButton } from \"../actions/Button\";\nimport { Dropdown, type DropdownItem } from \"../actions/Dropdown\";\nimport { Checkbox } from \"../inputs/Checkbox\";\nimport { showTruncatedTitle } from \"../internal/truncated-title\";\nimport { SectionFrameDefault } from \"../surfaces/Section\";\nimport { useDetailPanelMessages } from \"./detail-panel-messages\";\nimport { createScrollFade } from \"./scroll-fade\";\n\nexport type DetailPanelProps = {\n /** Plain sections share their host surface, as in AppWorkspace.Detail. */\n surface?: \"default\" | \"plain\";\n children: JSX.Element;\n class?: string;\n};\n\ntype DetailPanelHeaderBaseProps = {\n /**\n * The item's state, such as a \"Done\" or \"Read only\" badge, at the start of the line below the title. Name a type\n * only where one list mixes types that the title and subtitle do not tell apart, such as \"Query\" or \"Action\".\n */\n kind?: JSX.Element;\n title: JSX.Element;\n subtitle?: JSX.Element;\n meta?: JSX.Element;\n /**\n * The resource's \"…\" menu, shown before `actions`. Pass every less frequent command on the shown resource here,\n * so each panel opens its menu from the same place; an empty list shows no button.\n */\n menu?: readonly DropdownItem[];\n /** Accessible name of the \"…\" button. Defaults to \"More actions\". */\n menuLabel?: string;\n actions?: JSX.Element;\n primaryActions?: JSX.Element;\n class?: string;\n};\n\nexport type DetailPanelHeaderProps = DetailPanelHeaderBaseProps &\n (\n | {\n leading?: JSX.Element;\n icon?: never;\n }\n | {\n leading?: never;\n icon?: string;\n }\n );\n\nexport type DetailPanelBodyProps = {\n scrollFade?: boolean;\n children: JSX.Element;\n scrollPreserveKey?: string;\n class?: string;\n};\n\nexport type DetailPanelSummaryProps = {\n title: JSX.Element;\n children: JSX.Element;\n actions?: JSX.Element;\n class?: string;\n};\n\nexport type DetailPanelGroupProps = {\n children: JSX.Element;\n label?: string;\n /**\n * A visible quiet title, such as \"More about this conversation\". Its sections then stand flush as rows below\n * it, which suits collapsed secondary sections with a `summary`.\n */\n title?: JSX.Element;\n class?: string;\n};\n\n/** One direct secondary command, rendered as a sibling icon button at the end of the row. */\nexport type DetailPanelActionSecondary = {\n /** Icon class, for example `ti ti-trash`. */\n icon: string;\n /** Accessible name and tooltip of the icon button. */\n label: string;\n onClick: () => void;\n variant?: \"danger\";\n};\n\n/**\n * A checkbox before the row that toggles on its own, such as \"done\" for a task the row opens. It always shows its\n * state, unlike a secondary action, which waits for hover.\n */\nexport type DetailPanelActionCheckbox = {\n checked: boolean;\n /** Accessible name, after the row, such as \"Done: Call Mrs. Weber\". */\n label: string;\n onChange: (checked: boolean) => void;\n disabled?: boolean;\n};\n\ntype DetailPanelActionBaseProps = {\n title: JSX.Element;\n description?: JSX.Element;\n leading?: JSX.Element;\n trailing?: JSX.Element;\n secondaryAction?: DetailPanelActionSecondary;\n checkbox?: DetailPanelActionCheckbox;\n /** Marks the row of the current place, such as the section in view, in the panel's accent. */\n current?: boolean;\n /** Lets the title wrap to two lines instead of ending with an ellipsis. */\n wrap?: boolean;\n class?: string;\n};\n\ntype DetailPanelActionMenuProps =\n | {\n menuItems?: never;\n menuLabel?: never;\n }\n | {\n menuItems: readonly DropdownItem[];\n menuLabel: string;\n };\n\nexport type DetailPanelActionLinkProps = DetailPanelActionBaseProps &\n DetailPanelActionMenuProps &\n Omit<ButtonLinkProps, \"children\" | \"class\" | \"size\" | \"title\" | \"variant\"> & {\n href: string;\n };\n\nexport type DetailPanelActionButtonProps = DetailPanelActionBaseProps &\n DetailPanelActionMenuProps &\n Omit<ButtonProps, \"children\" | \"class\" | \"size\" | \"title\" | \"variant\"> & {\n href?: never;\n };\n\nexport type DetailPanelActionProps = DetailPanelActionLinkProps | DetailPanelActionButtonProps;\n\n/** A row that only shows something, such as a person and their role: the columns of an action, without a command. */\nexport type DetailPanelRowProps = {\n title: JSX.Element;\n description?: JSX.Element;\n leading?: JSX.Element;\n trailing?: JSX.Element;\n class?: string;\n};\n\ntype DetailPanelComponent = ((props: DetailPanelProps) => JSX.Element) & {\n Header: (props: DetailPanelHeaderProps) => JSX.Element;\n Body: (props: DetailPanelBodyProps) => JSX.Element;\n Summary: (props: DetailPanelSummaryProps) => JSX.Element;\n Group: (props: DetailPanelGroupProps) => JSX.Element;\n Action: (props: DetailPanelActionProps) => JSX.Element;\n Row: (props: DetailPanelRowProps) => JSX.Element;\n};\n\nconst classNames = (base: string, extra?: string): string => (extra ? `${base} ${extra}` : base);\n\nconst DetailPanelHeader = (props: DetailPanelHeaderProps): JSX.Element => {\n const t = useDetailPanelMessages();\n const menuLabel = () => props.menuLabel ?? t().moreActions;\n const menuTrigger = () => (\n <Dropdown.Root items={props.menu ?? []} align=\"end\" label={menuLabel()} phone=\"sheet\">\n <Dropdown.Trigger iconOnly size=\"sm\" variant=\"ghost\" label={menuLabel()} tooltip={menuLabel()}>\n <i class=\"ti ti-dots\" aria-hidden=\"true\" />\n </Dropdown.Trigger>\n </Dropdown.Root>\n );\n // With primary actions, \"…\" ends their row, next to the commands it extends; otherwise it sits beside close.\n const menuInActions = () => Boolean(props.menu?.length) && !props.primaryActions;\n return (\n <header class={classNames(\"k2b-detail-panel__header\", props.class)}>\n <div class=\"k2b-detail-panel__header-main\" data-identity={props.icon || props.leading ? \"true\" : undefined}>\n <Show when={props.icon}>\n {(icon) => (\n <span class=\"k2b-detail-panel__header-icon\" aria-hidden=\"true\">\n <i class={icon()} />\n </span>\n )}\n </Show>\n <Show when={props.leading}>\n <div class=\"k2b-detail-panel__header-leading\">{props.leading}</div>\n </Show>\n <div class=\"k2b-detail-panel__heading\">\n {/* The name comes first, beside the close button. It never wraps: a long title ends with an ellipsis, and\n then the native hint shows all of it. */}\n <h2 onPointerEnter={showTruncatedTitle}>{props.title}</h2>\n <Show when={props.kind || props.subtitle || props.meta}>\n <div class=\"k2b-detail-panel__supporting\">\n <Show when={props.kind}>\n <div class=\"k2b-detail-panel__kind\">{props.kind}</div>\n </Show>\n <Show when={props.subtitle}>\n <p>{props.subtitle}</p>\n </Show>\n <Show when={props.meta}>\n <div class=\"k2b-detail-panel__meta\">{props.meta}</div>\n </Show>\n </div>\n </Show>\n </div>\n <Show when={menuInActions() || props.actions}>\n <div class=\"k2b-detail-panel__actions\">\n <Show when={menuInActions()}>{menuTrigger()}</Show>\n {props.actions}\n </div>\n </Show>\n </div>\n <Show when={props.primaryActions}>\n <div class=\"k2b-detail-panel__primary-actions\">\n {props.primaryActions}\n <Show when={props.menu?.length}>{menuTrigger()}</Show>\n </div>\n </Show>\n </header>\n );\n};\n\nconst DetailPanelBody = (props: DetailPanelBodyProps): JSX.Element => {\n let body!: HTMLDivElement;\n createScrollFade(\n () => body,\n () => props.scrollFade !== false,\n );\n return (\n <div\n ref={body}\n class={classNames(\"k2b-detail-panel__body\", props.class)}\n data-scroll-fade-mode={props.scrollFade !== false ? \"both\" : undefined}\n data-scroll-preserve={props.scrollPreserveKey}\n >\n {props.children}\n </div>\n );\n};\n\nconst DetailPanelSummary = (props: DetailPanelSummaryProps): JSX.Element => {\n const headingId = `k2b-detail-panel-summary-${createUniqueId()}`;\n\n return (\n <section class={classNames(\"k2b-detail-panel__summary\", props.class)} aria-labelledby={headingId}>\n <header class=\"k2b-detail-panel__summary-header\">\n <h3 id={headingId}>{props.title}</h3>\n <Show when={props.actions}>\n <div class=\"k2b-detail-panel__summary-actions\">{props.actions}</div>\n </Show>\n </header>\n <div class=\"k2b-detail-panel__summary-body\">{props.children}</div>\n </section>\n );\n};\n\nconst DetailPanelGroup = (props: DetailPanelGroupProps): JSX.Element => {\n const titleId = `k2b-detail-panel-group-${createUniqueId()}`;\n return (\n <div\n class={classNames(\"k2b-detail-panel__group\", props.class)}\n role=\"group\"\n aria-label={props.title ? undefined : props.label}\n aria-labelledby={props.title ? titleId : undefined}\n data-titled={props.title ? \"true\" : undefined}\n >\n <Show when={props.title}>\n <div class=\"k2b-detail-panel__group-title\" id={titleId}>\n {props.title}\n </div>\n </Show>\n {props.children}\n </div>\n );\n};\n\nconst DetailPanelActionContent = (props: DetailPanelActionBaseProps): JSX.Element => (\n <>\n {/* Hidden while empty: a row's icon, or its text when it has none, starts on the section's text edge. */}\n <span class=\"k2b-detail-panel__action-leading\">{props.leading}</span>\n <span class=\"k2b-detail-panel__action-copy\">\n <span class=\"k2b-detail-panel__action-title\">{props.title}</span>\n <Show when={props.description}>\n <span class=\"k2b-detail-panel__action-description\">{props.description}</span>\n </Show>\n </span>\n <Show when={props.trailing}>\n <span class=\"k2b-detail-panel__action-trailing\">{props.trailing}</span>\n </Show>\n </>\n);\n\nconst DetailPanelAction = (props: DetailPanelActionProps): JSX.Element => {\n const [local, rest] = splitProps(props, [\n \"class\",\n \"current\",\n \"description\",\n \"href\",\n \"leading\",\n \"menuItems\",\n \"menuLabel\",\n \"secondaryAction\",\n \"checkbox\",\n \"title\",\n \"trailing\",\n \"wrap\",\n ]);\n const className = classNames(\"k2b-detail-panel__action\", local.class);\n const content = () => (\n <DetailPanelActionContent title={local.title} description={local.description} leading={local.leading} trailing={local.trailing} />\n );\n\n const action = () => (\n <Show\n when={local.href !== undefined}\n fallback={\n <Button\n {...(rest as Omit<DetailPanelActionButtonProps, keyof DetailPanelActionBaseProps>)}\n class={className}\n aria-current={local.current ? \"true\" : undefined}\n data-current={local.current ? \"true\" : undefined}\n data-wrap={local.wrap ? \"true\" : undefined}\n variant=\"ghost\"\n size=\"sm\"\n >\n {content()}\n </Button>\n }\n >\n <ButtonLink\n {...(rest as Omit<DetailPanelActionLinkProps, keyof DetailPanelActionBaseProps | \"href\">)}\n href={local.href as string}\n class={className}\n aria-current={local.current ? \"location\" : undefined}\n data-current={local.current ? \"true\" : undefined}\n data-wrap={local.wrap ? \"true\" : undefined}\n variant=\"ghost\"\n size=\"sm\"\n >\n {content()}\n </ButtonLink>\n </Show>\n );\n\n return (\n <Show when={local.secondaryAction || local.menuItems?.length || local.checkbox} fallback={action()}>\n <div class=\"k2b-detail-panel__action-row\" data-checkbox={local.checkbox ? \"true\" : undefined}>\n <Show when={local.checkbox}>\n {(checkbox) => (\n <Checkbox\n class=\"k2b-detail-panel__action-check\"\n aria-label={checkbox().label}\n value={checkbox().checked}\n disabled={checkbox().disabled}\n onValueChange={(checked) => checkbox().onChange(checked)}\n />\n )}\n </Show>\n {action()}\n <Show when={local.secondaryAction}>\n {(secondary) => (\n <IconButton\n size=\"sm\"\n variant=\"ghost\"\n label={secondary().label}\n class=\"k2b-detail-panel__action-secondary\"\n data-tone={secondary().variant}\n onClick={() => secondary().onClick()}\n >\n <i class={secondary().icon} aria-hidden=\"true\" />\n </IconButton>\n )}\n </Show>\n <Show when={local.menuItems?.length}>\n <Dropdown.Root items={local.menuItems ?? []} align=\"end\" label={local.menuLabel} class=\"k2b-detail-panel__action-menu\">\n <Dropdown.Trigger iconOnly size=\"sm\" variant=\"ghost\" label={local.menuLabel} class=\"k2b-detail-panel__action-menu-trigger\">\n <i class=\"ti ti-dots\" aria-hidden=\"true\" />\n </Dropdown.Trigger>\n </Dropdown.Root>\n </Show>\n </div>\n </Show>\n );\n};\n\nconst DetailPanelRow = (props: DetailPanelRowProps): JSX.Element => (\n <div class={classNames(\"k2b-detail-panel__row\", props.class)}>\n <DetailPanelActionContent title={props.title} description={props.description} leading={props.leading} trailing={props.trailing} />\n </div>\n);\n\n/**\n * The panel for one selected object. Its topics are `Section`s; the panel frames them itself, so they stand flat\n * inside it.\n */\nconst DetailPanel = ((props: DetailPanelProps): JSX.Element => (\n <div class={classNames(\"k2b-detail-panel\", props.class)} data-surface={props.surface}>\n <SectionFrameDefault.Provider value=\"none\">{props.children}</SectionFrameDefault.Provider>\n </div>\n)) as DetailPanelComponent;\n\nDetailPanel.Header = DetailPanelHeader;\nDetailPanel.Body = DetailPanelBody;\nDetailPanel.Summary = DetailPanelSummary;\nDetailPanel.Group = DetailPanelGroup;\nDetailPanel.Action = DetailPanelAction;\nDetailPanel.Row = DetailPanelRow;\n\nexport default DetailPanel;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc,EAAY,IAAI,EAAE,UAAU,QAAQ,UAAU;AACrE,SAAS,MAAM,EAAE,UAAU,EAA0C,UAAU,QAAQ,mBAAmB;AAC1G,SAAS,QAAQ,QAA2B,qBAAqB;AACjE,SAAS,QAAQ,QAAQ,oBAAoB;AAC7C,SAAS,kBAAkB,QAAQ,6BAA6B;AAChE,SAAS,mBAAmB,QAAQ,qBAAqB;AACzD,SAAS,sBAAsB,QAAQ,yBAAyB;AAChE,SAAS,gBAAgB,QAAQ,eAAe;;AAmEhD;;AAUA;AACA;AACA;AACA;;AA+CA;;AAkBA,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,KAAc,KAAc,KAAK,GAAG,GAAG,IAAI,IAAI,KAAK,EAAE,GAAG,IAAK;AAEhG,MAAM,iBAAiB,GAAI,KAA6B,IAAkB;EACxE,MAAM,CAAC,GAAG,sBAAsB,CAAC,CAAC;EAClC,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW;EAC1D,MAAM,WAAW,GAAG,wBACjB,QAAQ,CAAC,IAAI;IAAA,IAAC,KAAK;MAAA,OAAE,KAAK,CAAC,IAAI,IAAI,EAAE;IAAA;IAAE,KAAK;IAAA,IAAO,KAAK;MAAA,OAAE,SAAS,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KAAK;IAAA;IAAA,IAAE,WAAW;MAAA,OAAE,KAAK,CAAC,WAAW;IAAA;IAAA,IAAE,OAAO;MAAA,OAAE,KAAK,CAAC,OAAO;IAAA;IAAA,IAAE,QAAQ;MAAA,OAAE,KAAK,CAAC,QAAQ;IAAA;EAAA;EAAA,mCADpH,UAAU,CAAC,uBAAuB,EAAE,KAAK,CAAC,KAAK,CAAC;EAAA;AAAA,IAG7D;;AAED;AACA;AACA;AACA;AACA,MAAM,WAAW,GAAK,KAAuB;EAAA;EAAA,mCAExC,mBAAmB,CAAC,QAAQ;IAAC,KAAK;IAAA;MAAA,OAAS,KAAK,CAAC,QAAQ;IAAA;EAAA;EAAA;IAAA,WADhD,UAAU,CAAC,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC;MAAA,OAAgB,KAAK,CAAC,OAAO;IAAA;IAAA;IAAA;EAAA;IAAA;IAAA;EAAA;EAAA;AAAA,IAG5D;AAE1B,WAAW,CAAC,MAAM,GAAG,iBAAiB;AACtC,WAAW,CAAC,IAAI,GAAG,eAAe;AAClC,WAAW,CAAC,OAAO,GAAG,kBAAkB;AACxC,WAAW,CAAC,KAAK,GAAG,gBAAgB;AACpC,WAAW,CAAC,MAAM,GAAG,iBAAiB;AACtC,WAAW,CAAC,GAAG,GAAG,cAAc;AAEhC,eAAe,WAAW","ignoreList":[]}
|
|
@@ -3,8 +3,8 @@ import { delegateEvents as _$delegateEvents } from "solid-js/web";
|
|
|
3
3
|
import { use as _$use } from "solid-js/web";
|
|
4
4
|
import { setProperty as _$setProperty } from "solid-js/web";
|
|
5
5
|
import { runHydrationEvents as _$runHydrationEvents } from "solid-js/web";
|
|
6
|
-
import { addEventListener as _$addEventListener } from "solid-js/web";
|
|
7
6
|
import { getNextMarker as _$getNextMarker } from "solid-js/web";
|
|
7
|
+
import { addEventListener as _$addEventListener } from "solid-js/web";
|
|
8
8
|
import { className as _$className } from "solid-js/web";
|
|
9
9
|
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
10
10
|
import { effect as _$effect } from "solid-js/web";
|
|
@@ -38,6 +38,7 @@ import { dialogToneIcon, dialogToneLabel } from "../feedback/dialog-tone";
|
|
|
38
38
|
import { sharedPrompts } from "../feedback/prompt-confirm";
|
|
39
39
|
import { resolvePromptMessages } from "../feedback/prompt-messages";
|
|
40
40
|
import { SuccessCheck } from "../feedback/success-check";
|
|
41
|
+
import { showTruncatedTitle } from "../internal/truncated-title";
|
|
41
42
|
import { useUiMessages } from "../intl/messages";
|
|
42
43
|
import { usePanelDialogMessages } from "./panel-dialog-messages";
|
|
43
44
|
import { createScrollFade } from "./scroll-fade";
|
|
@@ -137,6 +138,7 @@ const PanelDialogHeader = props => {
|
|
|
137
138
|
return _el$17;
|
|
138
139
|
})()
|
|
139
140
|
}), _el$7, _co$);
|
|
141
|
+
_$addEventListener(_el$4, "pointerenter", showTruncatedTitle);
|
|
140
142
|
_$className(_el$4, media ? "k2b-truncate-fade" : undefined);
|
|
141
143
|
_$insert(_el$4, () => props.title);
|
|
142
144
|
_$insert(_el$3, _$createComponent(Show, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["layout/PanelDialog.tsx"],"sourcesContent":["import { createContext, createEffect, createSignal, createUniqueId, type JSX, Show, useContext } from \"solid-js\";\nimport { Button } from \"../actions/Button\";\nimport { Tabs } from \"../actions/Tabs\";\nimport type { OpenDialogOptions } from \"../feedback/dialog-core\";\nimport { type DialogTone, dialogToneIcon, dialogToneLabel } from \"../feedback/dialog-tone\";\nimport { sharedPrompts } from \"../feedback/prompt-confirm\";\nimport { resolvePromptMessages } from \"../feedback/prompt-messages\";\nimport { SuccessCheck } from \"../feedback/success-check\";\nimport { useUiMessages } from \"../intl/messages\";\nimport { usePanelDialogMessages } from \"./panel-dialog-messages\";\nimport { createScrollFade } from \"./scroll-fade\";\n\nexport type PanelDialogSurface = \"contained\" | \"floating\";\n\nexport type PanelDialogProps = {\n children: JSX.Element;\n surface?: PanelDialogSurface;\n /** A 2 px edge in the tone's colour inside the dialog frame; the header shows the tone's icon instead of its own. */\n tone?: DialogTone;\n /**\n * With `tone=\"success\"`, a finished success such as an issued document: the header draws its check once when it\n * appears. Leave it off for routine saves; other tones ignore it.\n */\n celebrate?: boolean;\n /**\n * The body shows a picture or a video edge to edge, and the header floats over it as glass chips: the title and\n * subtitle in one chip, the actions in a group, and the close button. For documents, text, and tables leave it off.\n */\n media?: boolean;\n};\n\nexport type PanelDialogHeaderProps = {\n title: JSX.Element;\n subtitle?: JSX.Element;\n icon?: string;\n actions?: JSX.Element;\n close?: () => void;\n closeDisabled?: boolean;\n closeLabel?: string;\n};\n\nexport type PanelDialogBodyProps = {\n children: JSX.Element;\n scrollPreserveKey?: string;\n scrollFade?: boolean;\n};\n\nexport type PanelDialogFooterProps = {\n children: JSX.Element;\n};\n\nexport type PanelDialogSectionProps = {\n title: JSX.Element;\n subtitle?: JSX.Element;\n icon?: string;\n actions?: JSX.Element;\n children: JSX.Element;\n} & (\n | { hideable?: false; open?: never; defaultOpen?: never; onOpenChange?: never; disabled?: never }\n | { hideable: true; open?: boolean; defaultOpen?: boolean; onOpenChange?: (open: boolean) => void; disabled?: boolean }\n);\n\nexport type PanelDialogTabOption<T extends string = string> = {\n value: T;\n label: JSX.Element;\n icon?: string;\n disabled?: boolean;\n};\n\nexport type PanelDialogTabsProps<T extends string = string> = {\n options: readonly PanelDialogTabOption<T>[];\n value: T | (() => T);\n onValueChange: (value: T) => void;\n ariaLabel?: string;\n label?: string;\n};\n\ntype PanelDialogComponent = ((props: PanelDialogProps) => JSX.Element) & {\n Header: (props: PanelDialogHeaderProps) => JSX.Element;\n Body: (props: PanelDialogBodyProps) => JSX.Element;\n Footer: (props: PanelDialogFooterProps) => JSX.Element;\n Section: (props: PanelDialogSectionProps) => JSX.Element;\n Tabs: <T extends string>(props: PanelDialogTabsProps<T>) => JSX.Element;\n};\n\nconst PanelDialogSurfaceContext = createContext<PanelDialogSurface>(\"contained\");\nconst usePanelDialogSurface = () => useContext(PanelDialogSurfaceContext);\nconst PanelDialogToneContext = createContext<() => DialogTone | undefined>(() => undefined);\nconst PanelDialogCelebrateContext = createContext<() => boolean>(() => false);\nconst PanelDialogMediaContext = createContext(false);\n\nconst panelDialogBasePanelClass = \"k2b-dialog k2b-panel-dialog-frame\";\n\nexport const panelDialogPanelClass = `${panelDialogBasePanelClass} is-standard`;\nexport const panelDialogOptions = {\n panelClassName: panelDialogPanelClass,\n contentClassName: \"k2b-panel-dialog-viewport\",\n} satisfies OpenDialogOptions;\n\nexport const panelDialogWidePanelClass = `${panelDialogBasePanelClass} is-wide`;\nexport const panelDialogWideOptions = {\n panelClassName: panelDialogWidePanelClass,\n contentClassName: \"k2b-panel-dialog-viewport\",\n} satisfies OpenDialogOptions;\n\nexport const panelDialogFixedPanelClass = `${panelDialogBasePanelClass} is-fixed`;\nexport const panelDialogFixedOptions = {\n panelClassName: panelDialogFixedPanelClass,\n contentClassName: \"k2b-panel-dialog-viewport is-fixed\",\n} satisfies OpenDialogOptions;\n\nexport const panelDialogWorkspacePanelClass = `${panelDialogBasePanelClass} is-workspace`;\nexport const panelDialogWorkspaceOptions = {\n panelClassName: panelDialogWorkspacePanelClass,\n contentClassName: \"k2b-panel-dialog-viewport is-workspace\",\n} satisfies OpenDialogOptions;\n\nexport const confirmDiscardIfDirty = async (dirty: boolean | (() => boolean)): Promise<boolean> => {\n const hasChanges = typeof dirty === \"function\" ? dirty() : dirty;\n if (!hasChanges) return true;\n return Boolean(\n await sharedPrompts.confirm(resolvePromptMessages().discardUnsavedChanges, {\n title: resolvePromptMessages().unsavedChangesTitle,\n variant: \"danger\",\n confirmText: resolvePromptMessages().discard,\n }),\n );\n};\n\nconst PanelDialogHeader = (props: PanelDialogHeaderProps): JSX.Element => {\n const messages = useUiMessages();\n const tone = useContext(PanelDialogToneContext);\n const celebrate = useContext(PanelDialogCelebrateContext);\n const icon = () => {\n const value = tone();\n return value ? dialogToneIcon(value) : props.icon;\n };\n // Over a picture the header's parts are glass layers of their own; the dialog owns them, so it sets the surface.\n const media = useContext(PanelDialogMediaContext);\n const layer = media ? \" k2b-overlay-surface\" : \"\";\n return (\n <header class=\"k2b-panel-dialog__header\" data-surface={usePanelDialogSurface()} data-has-subtitle={Boolean(props.subtitle)}>\n <Show when={icon() && !media}>\n <span class=\"k2b-panel-dialog__icon k2b-icon-tile\" data-tone={tone()} aria-hidden=\"true\">\n <Show when={celebrate() && tone() === \"success\"} fallback={<i class={icon()} />}>\n <SuccessCheck />\n </Show>\n </span>\n </Show>\n <div class={`k2b-panel-dialog__heading${layer}`}>\n <Show when={tone()}>\n {(value) => (\n <span class=\"k2b-sr-only\" data-dialog-tone-label>\n {dialogToneLabel(messages(), value())}\n </span>\n )}\n </Show>\n <h2 class={media ? \"k2b-truncate-fade\" : undefined}>{props.title}</h2>\n <Show when={props.subtitle}>\n <p>{props.subtitle}</p>\n </Show>\n </div>\n <Show when={props.actions}>\n <div class={`k2b-panel-dialog__actions${layer}`}>{props.actions}</div>\n </Show>\n <Show when={props.close}>\n <button\n type=\"button\"\n class={`k2b-dialog__close${layer}`}\n aria-label={props.closeLabel ?? messages().closeDialog}\n disabled={props.closeDisabled}\n onClick={props.close}\n >\n <i class=\"ti ti-x\" aria-hidden=\"true\" />\n </button>\n </Show>\n </header>\n );\n};\n\nconst PanelDialogBody = (props: PanelDialogBodyProps): JSX.Element => {\n let body: HTMLDivElement | undefined;\n createScrollFade(\n () => body,\n () => props.scrollFade !== false,\n );\n return (\n <div\n ref={body}\n class=\"k2b-panel-dialog__body\"\n data-scroll-preserve={props.scrollPreserveKey}\n data-surface={usePanelDialogSurface()}\n data-scroll-fade-mode={props.scrollFade !== false ? \"both\" : undefined}\n >\n {props.children}\n </div>\n );\n};\n\nconst PanelDialogFooter = (props: PanelDialogFooterProps): JSX.Element => (\n <footer class=\"k2b-panel-dialog__footer\" data-surface={usePanelDialogSurface()}>\n {props.children}\n </footer>\n);\n\nconst PanelDialogSection = (props: PanelDialogSectionProps): JSX.Element => {\n const id = `k2b-panel-dialog-section-${createUniqueId()}`;\n const [internalOpen, setInternalOpen] = createSignal(props.defaultOpen ?? false);\n const open = () => !props.hideable || (props.open ?? internalOpen());\n let section: HTMLElement | undefined;\n let expand: HTMLButtonElement | undefined;\n let collapse: HTMLButtonElement | undefined;\n const toggle = (next: boolean) => {\n if (props.disabled) return;\n if (props.open === undefined) setInternalOpen(next);\n props.onOpenChange?.(next);\n };\n createEffect(() => {\n if (!props.hideable) return;\n const expanded = open();\n queueMicrotask(() => {\n if (expanded !== open()) return;\n const active = section?.ownerDocument.activeElement;\n if (expanded && active === expand) collapse?.focus();\n if (!expanded && active && active !== expand && section?.contains(active)) expand?.focus();\n });\n });\n\n return (\n <section\n ref={section}\n class=\"k2b-panel-dialog__section\"\n data-surface={usePanelDialogSurface()}\n data-hideable={props.hideable || undefined}\n data-open={props.hideable ? open() : undefined}\n aria-labelledby={open() ? id : `${id}-closed`}\n >\n <Show when={props.hideable}>\n <div hidden={open()}>\n <Button\n ref={expand}\n variant=\"ghost\"\n class=\"k2b-panel-dialog__section-summary\"\n disabled={props.disabled}\n aria-expanded={false}\n aria-controls={`${id}-body`}\n onClick={() => toggle(true)}\n >\n <Show when={props.icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n <span class=\"k2b-panel-dialog__section-copy\">\n <span id={`${id}-closed`} class=\"k2b-panel-dialog__section-title\">\n {props.title}\n </span>\n <Show when={props.subtitle}>\n <span class=\"k2b-panel-dialog__section-subtitle\">{props.subtitle}</span>\n </Show>\n </span>\n <i class=\"ti ti-eye\" aria-hidden=\"true\" />\n </Button>\n </div>\n </Show>\n <header hidden={!open()}>\n <Show when={props.icon}>\n {(icon) => (\n <span class=\"k2b-panel-dialog__section-icon\">\n <i class={icon()} aria-hidden=\"true\" />\n </span>\n )}\n </Show>\n <div>\n <h3 id={id}>{props.title}</h3>\n <Show when={props.subtitle}>\n <p class=\"k2b-panel-dialog__section-subtitle\">{props.subtitle}</p>\n </Show>\n </div>\n <Show when={props.actions}>\n <div class=\"k2b-panel-dialog__actions\">{props.actions}</div>\n </Show>\n <Show when={props.hideable}>\n <Button\n ref={collapse}\n variant=\"ghost\"\n size=\"sm\"\n class=\"k2b-icon-button\"\n disabled={props.disabled}\n aria-labelledby={id}\n aria-expanded={true}\n aria-controls={`${id}-body`}\n onClick={() => toggle(false)}\n >\n <i class=\"ti ti-eye-off\" aria-hidden=\"true\" />\n </Button>\n </Show>\n </header>\n <div id={`${id}-body`} class=\"k2b-panel-dialog__section-body\" hidden={!open()}>\n {props.children}\n </div>\n </section>\n );\n};\n\nconst PanelDialogTabs = <T extends string>(props: PanelDialogTabsProps<T>): JSX.Element => {\n const panelDialogMessages = usePanelDialogMessages();\n return (\n <Tabs\n class=\"k2b-panel-dialog__tabs\"\n value={props.value}\n onValueChange={props.onValueChange}\n ariaLabel={props.ariaLabel ?? props.label ?? panelDialogMessages().dialogTabs}\n options={props.options}\n />\n );\n};\n\nconst PanelDialog = ((props: PanelDialogProps): JSX.Element => {\n const surface = props.surface ?? \"contained\";\n return (\n <PanelDialogSurfaceContext.Provider value={surface}>\n <PanelDialogToneContext.Provider value={() => props.tone}>\n <PanelDialogCelebrateContext.Provider value={() => Boolean(props.celebrate)}>\n <PanelDialogMediaContext.Provider value={Boolean(props.media)}>\n <div class=\"k2b-panel-dialog\" data-surface={surface} data-tone={props.tone} data-media={props.media ? \"\" : undefined}>\n {props.children}\n </div>\n </PanelDialogMediaContext.Provider>\n </PanelDialogCelebrateContext.Provider>\n </PanelDialogToneContext.Provider>\n </PanelDialogSurfaceContext.Provider>\n );\n}) as PanelDialogComponent;\n\nPanelDialog.Header = PanelDialogHeader;\nPanelDialog.Body = PanelDialogBody;\nPanelDialog.Footer = PanelDialogFooter;\nPanelDialog.Section = PanelDialogSection;\nPanelDialog.Tabs = PanelDialogTabs;\n\nexport default PanelDialog;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,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AI;sBAAA,QAAc,KAAK,CAAC,KAAK,GAAG,EAAE,GAAG,SAAS;oBAAA;oBAAA;oBAAA;kBAAA;oBAAA;oBAAA;kBAAA;kBAAA;gBAAA;cAAA;YAAA;UAAA;QAAA;MAAA;IAAA;EAAA;AAQhI,CAA0B;AAE1B,WAAW,CAAC,MAAM,GAAG,iBAAiB;AACtC,WAAW,CAAC,IAAI,GAAG,eAAe;AAClC,WAAW,CAAC,MAAM,GAAG,iBAAiB;AACtC,WAAW,CAAC,OAAO,GAAG,kBAAkB;AACxC,WAAW,CAAC,IAAI,GAAG,eAAe;AAElC,eAAe,WAAW;AAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["layout/PanelDialog.tsx"],"sourcesContent":["import { createContext, createEffect, createSignal, createUniqueId, type JSX, Show, useContext } from \"solid-js\";\nimport { Button } from \"../actions/Button\";\nimport { Tabs } from \"../actions/Tabs\";\nimport type { OpenDialogOptions } from \"../feedback/dialog-core\";\nimport { type DialogTone, dialogToneIcon, dialogToneLabel } from \"../feedback/dialog-tone\";\nimport { sharedPrompts } from \"../feedback/prompt-confirm\";\nimport { resolvePromptMessages } from \"../feedback/prompt-messages\";\nimport { SuccessCheck } from \"../feedback/success-check\";\nimport { showTruncatedTitle } from \"../internal/truncated-title\";\nimport { useUiMessages } from \"../intl/messages\";\nimport { usePanelDialogMessages } from \"./panel-dialog-messages\";\nimport { createScrollFade } from \"./scroll-fade\";\n\nexport type PanelDialogSurface = \"contained\" | \"floating\";\n\nexport type PanelDialogProps = {\n children: JSX.Element;\n surface?: PanelDialogSurface;\n /** A 2 px edge in the tone's colour inside the dialog frame; the header shows the tone's icon instead of its own. */\n tone?: DialogTone;\n /**\n * With `tone=\"success\"`, a finished success such as an issued document: the header draws its check once when it\n * appears. Leave it off for routine saves; other tones ignore it.\n */\n celebrate?: boolean;\n /**\n * The body shows a picture or a video edge to edge, and the header floats over it as glass chips: the title and\n * subtitle in one chip, the actions in a group, and the close button. For documents, text, and tables leave it off.\n */\n media?: boolean;\n};\n\nexport type PanelDialogHeaderProps = {\n title: JSX.Element;\n subtitle?: JSX.Element;\n icon?: string;\n actions?: JSX.Element;\n close?: () => void;\n closeDisabled?: boolean;\n closeLabel?: string;\n};\n\nexport type PanelDialogBodyProps = {\n children: JSX.Element;\n scrollPreserveKey?: string;\n scrollFade?: boolean;\n};\n\nexport type PanelDialogFooterProps = {\n children: JSX.Element;\n};\n\nexport type PanelDialogSectionProps = {\n title: JSX.Element;\n subtitle?: JSX.Element;\n icon?: string;\n actions?: JSX.Element;\n children: JSX.Element;\n} & (\n | { hideable?: false; open?: never; defaultOpen?: never; onOpenChange?: never; disabled?: never }\n | { hideable: true; open?: boolean; defaultOpen?: boolean; onOpenChange?: (open: boolean) => void; disabled?: boolean }\n);\n\nexport type PanelDialogTabOption<T extends string = string> = {\n value: T;\n label: JSX.Element;\n icon?: string;\n disabled?: boolean;\n};\n\nexport type PanelDialogTabsProps<T extends string = string> = {\n options: readonly PanelDialogTabOption<T>[];\n value: T | (() => T);\n onValueChange: (value: T) => void;\n ariaLabel?: string;\n label?: string;\n};\n\ntype PanelDialogComponent = ((props: PanelDialogProps) => JSX.Element) & {\n Header: (props: PanelDialogHeaderProps) => JSX.Element;\n Body: (props: PanelDialogBodyProps) => JSX.Element;\n Footer: (props: PanelDialogFooterProps) => JSX.Element;\n Section: (props: PanelDialogSectionProps) => JSX.Element;\n Tabs: <T extends string>(props: PanelDialogTabsProps<T>) => JSX.Element;\n};\n\nconst PanelDialogSurfaceContext = createContext<PanelDialogSurface>(\"contained\");\nconst usePanelDialogSurface = () => useContext(PanelDialogSurfaceContext);\nconst PanelDialogToneContext = createContext<() => DialogTone | undefined>(() => undefined);\nconst PanelDialogCelebrateContext = createContext<() => boolean>(() => false);\nconst PanelDialogMediaContext = createContext(false);\n\nconst panelDialogBasePanelClass = \"k2b-dialog k2b-panel-dialog-frame\";\n\nexport const panelDialogPanelClass = `${panelDialogBasePanelClass} is-standard`;\nexport const panelDialogOptions = {\n panelClassName: panelDialogPanelClass,\n contentClassName: \"k2b-panel-dialog-viewport\",\n} satisfies OpenDialogOptions;\n\nexport const panelDialogWidePanelClass = `${panelDialogBasePanelClass} is-wide`;\nexport const panelDialogWideOptions = {\n panelClassName: panelDialogWidePanelClass,\n contentClassName: \"k2b-panel-dialog-viewport\",\n} satisfies OpenDialogOptions;\n\nexport const panelDialogFixedPanelClass = `${panelDialogBasePanelClass} is-fixed`;\nexport const panelDialogFixedOptions = {\n panelClassName: panelDialogFixedPanelClass,\n contentClassName: \"k2b-panel-dialog-viewport is-fixed\",\n} satisfies OpenDialogOptions;\n\nexport const panelDialogWorkspacePanelClass = `${panelDialogBasePanelClass} is-workspace`;\nexport const panelDialogWorkspaceOptions = {\n panelClassName: panelDialogWorkspacePanelClass,\n contentClassName: \"k2b-panel-dialog-viewport is-workspace\",\n} satisfies OpenDialogOptions;\n\nexport const confirmDiscardIfDirty = async (dirty: boolean | (() => boolean)): Promise<boolean> => {\n const hasChanges = typeof dirty === \"function\" ? dirty() : dirty;\n if (!hasChanges) return true;\n return Boolean(\n await sharedPrompts.confirm(resolvePromptMessages().discardUnsavedChanges, {\n title: resolvePromptMessages().unsavedChangesTitle,\n variant: \"danger\",\n confirmText: resolvePromptMessages().discard,\n }),\n );\n};\n\nconst PanelDialogHeader = (props: PanelDialogHeaderProps): JSX.Element => {\n const messages = useUiMessages();\n const tone = useContext(PanelDialogToneContext);\n const celebrate = useContext(PanelDialogCelebrateContext);\n const icon = () => {\n const value = tone();\n return value ? dialogToneIcon(value) : props.icon;\n };\n // Over a picture the header's parts are glass layers of their own; the dialog owns them, so it sets the surface.\n const media = useContext(PanelDialogMediaContext);\n const layer = media ? \" k2b-overlay-surface\" : \"\";\n return (\n <header class=\"k2b-panel-dialog__header\" data-surface={usePanelDialogSurface()} data-has-subtitle={Boolean(props.subtitle)}>\n <Show when={icon() && !media}>\n <span class=\"k2b-panel-dialog__icon k2b-icon-tile\" data-tone={tone()} aria-hidden=\"true\">\n <Show when={celebrate() && tone() === \"success\"} fallback={<i class={icon()} />}>\n <SuccessCheck />\n </Show>\n </span>\n </Show>\n <div class={`k2b-panel-dialog__heading${layer}`}>\n <Show when={tone()}>\n {(value) => (\n <span class=\"k2b-sr-only\" data-dialog-tone-label>\n {dialogToneLabel(messages(), value())}\n </span>\n )}\n </Show>\n <h2 class={media ? \"k2b-truncate-fade\" : undefined} onPointerEnter={showTruncatedTitle}>\n {props.title}\n </h2>\n <Show when={props.subtitle}>\n <p>{props.subtitle}</p>\n </Show>\n </div>\n <Show when={props.actions}>\n <div class={`k2b-panel-dialog__actions${layer}`}>{props.actions}</div>\n </Show>\n <Show when={props.close}>\n <button\n type=\"button\"\n class={`k2b-dialog__close${layer}`}\n aria-label={props.closeLabel ?? messages().closeDialog}\n disabled={props.closeDisabled}\n onClick={props.close}\n >\n <i class=\"ti ti-x\" aria-hidden=\"true\" />\n </button>\n </Show>\n </header>\n );\n};\n\nconst PanelDialogBody = (props: PanelDialogBodyProps): JSX.Element => {\n let body: HTMLDivElement | undefined;\n createScrollFade(\n () => body,\n () => props.scrollFade !== false,\n );\n return (\n <div\n ref={body}\n class=\"k2b-panel-dialog__body\"\n data-scroll-preserve={props.scrollPreserveKey}\n data-surface={usePanelDialogSurface()}\n data-scroll-fade-mode={props.scrollFade !== false ? \"both\" : undefined}\n >\n {props.children}\n </div>\n );\n};\n\nconst PanelDialogFooter = (props: PanelDialogFooterProps): JSX.Element => (\n <footer class=\"k2b-panel-dialog__footer\" data-surface={usePanelDialogSurface()}>\n {props.children}\n </footer>\n);\n\nconst PanelDialogSection = (props: PanelDialogSectionProps): JSX.Element => {\n const id = `k2b-panel-dialog-section-${createUniqueId()}`;\n const [internalOpen, setInternalOpen] = createSignal(props.defaultOpen ?? false);\n const open = () => !props.hideable || (props.open ?? internalOpen());\n let section: HTMLElement | undefined;\n let expand: HTMLButtonElement | undefined;\n let collapse: HTMLButtonElement | undefined;\n const toggle = (next: boolean) => {\n if (props.disabled) return;\n if (props.open === undefined) setInternalOpen(next);\n props.onOpenChange?.(next);\n };\n createEffect(() => {\n if (!props.hideable) return;\n const expanded = open();\n queueMicrotask(() => {\n if (expanded !== open()) return;\n const active = section?.ownerDocument.activeElement;\n if (expanded && active === expand) collapse?.focus();\n if (!expanded && active && active !== expand && section?.contains(active)) expand?.focus();\n });\n });\n\n return (\n <section\n ref={section}\n class=\"k2b-panel-dialog__section\"\n data-surface={usePanelDialogSurface()}\n data-hideable={props.hideable || undefined}\n data-open={props.hideable ? open() : undefined}\n aria-labelledby={open() ? id : `${id}-closed`}\n >\n <Show when={props.hideable}>\n <div hidden={open()}>\n <Button\n ref={expand}\n variant=\"ghost\"\n class=\"k2b-panel-dialog__section-summary\"\n disabled={props.disabled}\n aria-expanded={false}\n aria-controls={`${id}-body`}\n onClick={() => toggle(true)}\n >\n <Show when={props.icon}>{(icon) => <i class={icon()} aria-hidden=\"true\" />}</Show>\n <span class=\"k2b-panel-dialog__section-copy\">\n <span id={`${id}-closed`} class=\"k2b-panel-dialog__section-title\">\n {props.title}\n </span>\n <Show when={props.subtitle}>\n <span class=\"k2b-panel-dialog__section-subtitle\">{props.subtitle}</span>\n </Show>\n </span>\n <i class=\"ti ti-eye\" aria-hidden=\"true\" />\n </Button>\n </div>\n </Show>\n <header hidden={!open()}>\n <Show when={props.icon}>\n {(icon) => (\n <span class=\"k2b-panel-dialog__section-icon\">\n <i class={icon()} aria-hidden=\"true\" />\n </span>\n )}\n </Show>\n <div>\n <h3 id={id}>{props.title}</h3>\n <Show when={props.subtitle}>\n <p class=\"k2b-panel-dialog__section-subtitle\">{props.subtitle}</p>\n </Show>\n </div>\n <Show when={props.actions}>\n <div class=\"k2b-panel-dialog__actions\">{props.actions}</div>\n </Show>\n <Show when={props.hideable}>\n <Button\n ref={collapse}\n variant=\"ghost\"\n size=\"sm\"\n class=\"k2b-icon-button\"\n disabled={props.disabled}\n aria-labelledby={id}\n aria-expanded={true}\n aria-controls={`${id}-body`}\n onClick={() => toggle(false)}\n >\n <i class=\"ti ti-eye-off\" aria-hidden=\"true\" />\n </Button>\n </Show>\n </header>\n <div id={`${id}-body`} class=\"k2b-panel-dialog__section-body\" hidden={!open()}>\n {props.children}\n </div>\n </section>\n );\n};\n\nconst PanelDialogTabs = <T extends string>(props: PanelDialogTabsProps<T>): JSX.Element => {\n const panelDialogMessages = usePanelDialogMessages();\n return (\n <Tabs\n class=\"k2b-panel-dialog__tabs\"\n value={props.value}\n onValueChange={props.onValueChange}\n ariaLabel={props.ariaLabel ?? props.label ?? panelDialogMessages().dialogTabs}\n options={props.options}\n />\n );\n};\n\nconst PanelDialog = ((props: PanelDialogProps): JSX.Element => {\n const surface = props.surface ?? \"contained\";\n return (\n <PanelDialogSurfaceContext.Provider value={surface}>\n <PanelDialogToneContext.Provider value={() => props.tone}>\n <PanelDialogCelebrateContext.Provider value={() => Boolean(props.celebrate)}>\n <PanelDialogMediaContext.Provider value={Boolean(props.media)}>\n <div class=\"k2b-panel-dialog\" data-surface={surface} data-tone={props.tone} data-media={props.media ? \"\" : undefined}>\n {props.children}\n </div>\n </PanelDialogMediaContext.Provider>\n </PanelDialogCelebrateContext.Provider>\n </PanelDialogToneContext.Provider>\n </PanelDialogSurfaceContext.Provider>\n );\n}) as PanelDialogComponent;\n\nPanelDialog.Header = PanelDialogHeader;\nPanelDialog.Body = PanelDialogBody;\nPanelDialog.Footer = PanelDialogFooter;\nPanelDialog.Section = PanelDialogSection;\nPanelDialog.Tabs = PanelDialogTabs;\n\nexport default PanelDialog;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAY,IAAI,EAAE,UAAU,QAAQ,UAAU;AAChH,SAAS,MAAM,QAAQ,mBAAmB;AAC1C,SAAS,IAAI,QAAQ,iBAAiB;AAEtC,SAA0B,cAAc,EAAE,eAAe,QAAQ,yBAAyB;AAC1F,SAAS,aAAa,QAAQ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AAA;AAQhI,CAA0B;AAE1B,WAAW,CAAC,MAAM,GAAG,iBAAiB;AACtC,WAAW,CAAC,IAAI,GAAG,eAAe;AAClC,WAAW,CAAC,MAAM,GAAG,iBAAiB;AACtC,WAAW,CAAC,OAAO,GAAG,kBAAkB;AACxC,WAAW,CAAC,IAAI,GAAG,eAAe;AAElC,eAAe,WAAW;AAAC","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@ import { createComponent as _$createComponent } from "solid-js/web";
|
|
|
3
3
|
import { ssr as _$ssr } from "solid-js/web";
|
|
4
4
|
import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
|
|
5
5
|
import { escape as _$escape } from "solid-js/web";
|
|
6
|
-
var _tmpl$ = ["<label class=\"k2b-dropdown__search\"><i class=\"ti ti-search\" aria-hidden=\"true\"></i><input type=\"search\" role=\"combobox\"", " aria-expanded=\"true\"", " aria-autocomplete=\"list\"", " autocomplete=\"off\" spellcheck=\"false\" enterkeyhint=\"go\"", "></label>"];
|
|
6
|
+
var _tmpl$ = ["<label class=\"k2b-dropdown__search\"><i class=\"ti ti-search\" aria-hidden=\"true\"></i><input type=\"search\" role=\"combobox\"", " aria-expanded=\"true\"", " aria-autocomplete=\"list\"", " autocomplete=\"off\" spellcheck=\"false\" enterkeyhint=\"go\"", "", "></label>"];
|
|
7
7
|
import { createEffect, createSignal, createUniqueId, on, onCleanup } from "solid-js";
|
|
8
8
|
import { replaceTextareaRange } from "../inputs/editor-dom";
|
|
9
9
|
import { CommandList, commandListKey, commandOptionId, createCommandNavigator } from "./CommandList";
|
|
@@ -138,7 +138,7 @@ function CommandMenuRoot(props) {
|
|
|
138
138
|
if (mark === "last") nav.edge("last");
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
|
-
const search = _$ssr(_tmpl$, _$ssrAttribute("aria-label", _$escape(nav.step()?.next?.label ?? props.search, true), false), _$ssrAttribute("aria-controls", _$escape(listId, true), false), _$ssrAttribute("aria-activedescendant", nav.entries()[nav.active()] && !nav.entries()[nav.active()].disabled ? _$escape(commandOptionId(listId, nav.active()), true) : _$escape(undefined, true), false), _$ssrAttribute("placeholder", _$escape(nav.step()?.next?.label ?? props.search, true), false) + _$ssrAttribute("value", _$escape(query(), true), false)
|
|
141
|
+
const search = _$ssr(_tmpl$, _$ssrAttribute("aria-label", _$escape(nav.step()?.next?.label ?? props.search, true), false), _$ssrAttribute("aria-controls", _$escape(listId, true), false), _$ssrAttribute("aria-activedescendant", nav.entries()[nav.active()] && !nav.entries()[nav.active()].disabled ? _$escape(commandOptionId(listId, nav.active()), true) : _$escape(undefined, true), false), _$ssrAttribute("placeholder", _$escape(nav.step()?.next?.label ?? props.search, true), false) + _$ssrAttribute("value", _$escape(query(), true), false), _$ssrAttribute("readonly", nav.busy(), true));
|
|
142
142
|
return _$createComponent(CommandList, {
|
|
143
143
|
navigator: nav,
|
|
144
144
|
id: listId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["actions/CommandMenu.tsx"],"sourcesContent":["import { createEffect, createSignal, createUniqueId, type JSX, on, onCleanup } from \"solid-js\";\nimport { replaceTextareaRange } from \"../inputs/editor-dom\";\nimport { CommandList, commandListKey, commandOptionId, createCommandNavigator } from \"./CommandList\";\nimport { dockCommandList, followComposer } from \"./command-dock\";\nimport { type CommandSource, commandPlace } from \"./command-items\";\nimport {\n Dropdown,\n type DropdownAnchor,\n type DropdownBody,\n type DropdownPosition,\n type DropdownReturnFocus,\n DropdownShell,\n} from \"./Dropdown\";\n\nexport type CommandMenuProps = {\n /** The same entries as `MarkdownEditor`'s `commands`, so the slash menu, a \"+\" button, and a chip offer one list. */\n items: CommandSource;\n /** Names the menu and its first list, such as \"Add to message\". */\n label: string;\n /** Names the search field and is its hint, such as \"Search commands\". A second list shows its own label there. */\n search: string;\n /**\n * The field the commands act on, such as the composer's textarea beside a \"+\" button. Its text and selection are the\n * `context` of an `onSelect`, and `context.insert` and entries with `text` write into it as typing would.\n */\n target?: HTMLTextAreaElement | HTMLInputElement;\n /**\n * The composer box the menu docks to, as the slash list does: as wide as the box, just above it, or below it when\n * there is more room there. Without it, the menu opens beside its trigger.\n */\n dock?: HTMLElement;\n /** Receives inserted text when there is no `target`, such as a snippet the host places itself. */\n onInsert?: (text: string) => void;\n /** The `CommandMenu.Trigger`; leave it out for a menu opened through `openAt` or `attach`. */\n children?: JSX.Element;\n position?: DropdownPosition;\n align?: \"start\" | \"end\";\n /** Receives `open`, which shows the menu beside `anchor` without its trigger; focus returns to `returnFocus`. */\n openAt?: (open: (anchor: DropdownAnchor, returnFocus?: DropdownReturnFocus) => void) => void;\n /** Adopts an element rendered elsewhere, such as a server-rendered chip, as the trigger. */\n attach?: () => HTMLElement | null | undefined;\n onOpenChange?: (open: boolean) => void;\n disabled?: boolean;\n class?: string;\n};\n\n/**\n * A searchable command list beside a trigger or an anchor, with the slash menu's entries and rows: groups, icons,\n * unavailable entries with their reason, and second lists. Focus stays in the search field; Up, Down, Home, and End\n * mark, Enter and Tab choose, Escape or Backspace in an empty field go back, and Escape in the first list closes.\n */\nfunction CommandMenuRoot(props: CommandMenuProps): JSX.Element {\n const body: DropdownBody = (shell) => {\n const listId = `k2b-command-menu-${createUniqueId().replace(/[^a-zA-Z0-9_-]/g, \"-\")}`;\n const [query, setQuery] = createSignal(\"\");\n let input!: HTMLInputElement;\n /** The open menu, kept while an outcome replaces the search field that finds it. */\n let menu: HTMLElement | null = null;\n /** Where the focus was when an outcome took the list's place: inside the menu, or in the target. */\n let focusInMenu = false;\n const nav = createCommandNavigator({\n items: () => props.items,\n query,\n onText: (item) => {\n // Read before closing: closing resets the list.\n const text = item.text ?? \"\";\n const target = props.target;\n shell.close(!target);\n insert(text);\n },\n context: () => {\n const target = props.target;\n const value = target?.value ?? \"\";\n const start = target?.selectionStart ?? 0;\n return {\n ...commandPlace(value, start, start),\n selection: { start, end: target?.selectionEnd ?? start },\n insert: (text: string) => insert(text),\n };\n },\n active: shell.open,\n // The focus goes back to the trigger only from inside the menu: an entry that wrote into the target, or moved\n // the focus elsewhere itself, leaves it there. An outcome keeps the menu open in the list's place: the person\n // writes on in the target, or, without one, the focus rests on the outcome until it clears.\n afterRun: (outcome) => {\n // An outcome replaces the search field before this runs, which leaves the focus on the page's body.\n const focused = document.activeElement;\n const inside = !focused || focused === document.body || Boolean(menu?.contains(focused));\n if (!outcome) return shell.close(inside);\n focusInMenu = inside && !props.target;\n if (inside && props.target) props.target.focus({ preventScroll: true });\n else if (focusInMenu)\n queueMicrotask(() => menu?.querySelector<HTMLElement>(\".k2b-command-outcome\")?.focus({ preventScroll: true }));\n },\n onStep: () => setQuery(\"\"),\n });\n /** Writes into the target at its caret, as typing would, or hands the text to `onInsert`. */\n const insert = (text: string) => {\n const target = props.target;\n if (!target) return props.onInsert?.(text);\n replaceTextareaRange(target as HTMLTextAreaElement, target.selectionStart ?? 0, target.selectionEnd ?? 0, text);\n };\n // An outcome that cleared closes the menu; the focus returns to the trigger only from inside it.\n createEffect(\n on(\n nav.outcome,\n (outcome, previous) => {\n if (menu) {\n if (outcome) menu.dataset.outcome = outcome.state;\n else delete menu.dataset.outcome;\n }\n if (!outcome && previous && shell.open()) shell.close(Boolean(menu?.contains(document.activeElement)) || focusInMenu);\n },\n { defer: true },\n ),\n );\n // Typing on in the target clears an outcome once it showed long enough; keys on the outcome itself do too. When\n // the typing opened another list for the target, such as its slash commands, the outcome gives way at once.\n createEffect(() => {\n const target = props.target;\n if (!target || !nav.outcome()) return;\n const typed = () => {\n nav.typedOn();\n queueMicrotask(() => {\n const controls = target.getAttribute(\"aria-controls\");\n if (controls && controls !== listId) nav.clearOutcome();\n });\n };\n target.addEventListener(\"input\", typed);\n onCleanup(() => target.removeEventListener(\"input\", typed));\n });\n createEffect(\n on(shell.open, (open) => {\n menu = input.closest<HTMLElement>(\".k2b-dropdown__menu\") ?? menu;\n const docked = menu;\n const dock = props.dock;\n if (open && dock && docked) {\n // A phone's keyboard moves the visible viewport, which the menu follows like the slash list.\n const follow = () => {\n if (docked.matches(\":popover-open\")) dockCommandList(docked, dock);\n };\n follow();\n const stop = followComposer(dock, follow);\n const closed = () => {\n if (!docked.matches(\":popover-open\")) {\n stop();\n docked.removeEventListener(\"toggle\", closed);\n }\n };\n docked.addEventListener(\"toggle\", closed);\n return;\n }\n if (open) {\n // The width it opened with stays its least, so filtering never narrows it.\n queueMicrotask(() => {\n if (menu?.matches(\":popover-open\")) menu.style.minWidth = `min(${menu.getBoundingClientRect().width}px, 100vw - 2rem)`;\n });\n return;\n }\n if (menu) menu.style.minWidth = \"\";\n // Closing the menu, with Escape or a press outside, stops a running command and clears its outcome.\n nav.abort();\n nav.clearOutcome();\n nav.reset();\n setQuery(\"\");\n focusInMenu = false;\n }),\n );\n shell.api({\n focus: (mark) => {\n input.focus({ preventScroll: true });\n if (mark === \"last\") nav.edge(\"last\");\n },\n });\n const search = (\n <label class=\"k2b-dropdown__search\">\n <i class=\"ti ti-search\" aria-hidden=\"true\" />\n <input\n ref={input}\n type=\"search\"\n role=\"combobox\"\n aria-label={nav.step()?.next?.label ?? props.search}\n aria-expanded=\"true\"\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={\n nav.entries()[nav.active()] && !nav.entries()[nav.active()]!.disabled ? commandOptionId(listId, nav.active()) : undefined\n }\n autocomplete=\"off\"\n spellcheck={false}\n enterkeyhint=\"go\"\n placeholder={nav.step()?.next?.label ?? props.search}\n value={query()}\n // While a command runs, the list waits for it; the query keeps the running entry in view.\n readOnly={nav.busy()}\n onInput={(event) => setQuery(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (!commandListKey(nav, event, query())) return;\n // Escape that left a second list, and Tab that chose, stay inside the menu.\n event.preventDefault();\n event.stopPropagation();\n }}\n />\n </label>\n );\n return (\n <CommandList\n navigator={nav}\n id={listId}\n label={props.label}\n query={query}\n header={search}\n // After Retry or Close the focus stays where the person works: the target, or the outcome itself.\n onOutcomeAction={() => {\n if (props.target) props.target.focus({ preventScroll: true });\n else menu?.querySelector<HTMLElement>(\".k2b-command-outcome\")?.focus({ preventScroll: true });\n }}\n />\n );\n };\n\n return (\n <DropdownShell\n items={[]}\n body={body}\n label={props.label}\n menuClass=\"k2b-command-menu\"\n placeMenu={props.dock ? (menu) => dockCommandList(menu, props.dock!) : undefined}\n position={props.position}\n align={props.align}\n openAt={props.openAt}\n attach={props.attach}\n onOpenChange={props.onOpenChange}\n disabled={props.disabled}\n class={props.class}\n >\n {props.children}\n </DropdownShell>\n );\n}\n\ntype CommandMenuComponent = ((props: CommandMenuProps) => JSX.Element) & {\n Trigger: typeof Dropdown.Trigger;\n};\n\nexport const CommandMenu = CommandMenuRoot as CommandMenuComponent;\nCommandMenu.Trigger = Dropdown.Trigger;\n"],"mappings":";;;;;;AAAA,SAAS,YAAY,EAAE,YAAY,EAAE,cAAc,EAAY,EAAE,EAAE,SAAS,QAAQ,UAAU;AAC9F,SAAS,oBAAoB,QAAQ,sBAAsB;AAC3D,SAAS,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,sBAAsB,QAAQ,eAAe;AACpG,SAAS,eAAe,EAAE,cAAc,QAAQ,gBAAgB;AAChE,SAA6B,YAAY,QAAQ,iBAAiB;AAClE,SACE,QAAQ,EAKR,aAAa,QACR,YAAY;AAkCnB;AACA;AACA;AACA;AACA;AACA,SAAS,eAAe,CAAC,KAAuB,EAAe;EAC7D,MAAM,IAAkB,GAAI,KAAK,IAAK;IACpC,MAAM,MAAM,GAAG,oBAAoB,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,EAAE;IACrF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,YAAY,CAAC,EAAE,CAAC;IAC1C,IAAI,KAAwB;IAC5B;IACA,IAAI,IAAwB,GAAG,IAAI;IACnC;IACA,IAAI,WAAW,GAAG,KAAK;IACvB,MAAM,GAAG,GAAG,sBAAsB,CAAC;MACjC,KAAK,EAAE,MAAM,KAAK,CAAC,KAAK;MACxB,KAAK;MACL,MA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;QAAK,CAAC,CAAC,CAAC,KACzD,IAAI,EAAE,aAAa,CAAc,sBAAsB,CAAC,EAAE,KAAK,CAAC;UAAE,aAAa,EAAE;QAAK,CAAC,CAAC;MAC/F;IAAC;EAGP,CAAC;EAED,yBACG,aAAa;IACZ,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,IAAI;IAAA,IACV,KAAK;MAAA,OAAE,KAAK,CAAC,KAAK;IAAA;IAClB,SAAS;IAAA,IACT,SAAS;MAAA,OAAE,KAAK,CAAC,IAAI,GAAI,IAAI,IAAK,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,IAAK,CAAC,GAAG,SAAS;IAAA;IAAA,IAChF,QAAQ;MAAA,OAAE,KAAK,CAAC,QAAQ;IAAA;IAAA,IACxB,KAAK;MAAA,OAAE,KAAK,CAAC,KAAK;IAAA;IAAA,IAClB,MAAM;MAAA,OAAE,KAAK,CAAC,MAAM;IAAA;IAAA,IACpB,MAAM;MAAA,OAAE,KAAK,CAAC,MAAM;IAAA;IAAA,IACpB,YAAY;MAAA,OAAE,KAAK,CAAC,YAAY;IAAA;IAAA,IAChC,QAAQ;MAAA,OAAE,KAAK,CAAC,QAAQ;IAAA;IAAA;MAAA,OACjB,KAAK,CAAC,KAAK;IAAA;IAAA;MAAA,OAEjB,KAAK,CAAC,QAAQ;IAAA;EAAA;AAGrB;AAMA,OAAO,MAAM,WAAW,GAAG,eAAuC;AAClE,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["actions/CommandMenu.tsx"],"sourcesContent":["import { createEffect, createSignal, createUniqueId, type JSX, on, onCleanup } from \"solid-js\";\nimport { replaceTextareaRange } from \"../inputs/editor-dom\";\nimport { CommandList, commandListKey, commandOptionId, createCommandNavigator } from \"./CommandList\";\nimport { dockCommandList, followComposer } from \"./command-dock\";\nimport { type CommandSource, commandPlace } from \"./command-items\";\nimport {\n Dropdown,\n type DropdownAnchor,\n type DropdownBody,\n type DropdownPosition,\n type DropdownReturnFocus,\n DropdownShell,\n} from \"./Dropdown\";\n\nexport type CommandMenuProps = {\n /** The same entries as `MarkdownEditor`'s `commands`, so the slash menu, a \"+\" button, and a chip offer one list. */\n items: CommandSource;\n /** Names the menu and its first list, such as \"Add to message\". */\n label: string;\n /** Names the search field and is its hint, such as \"Search commands\". A second list shows its own label there. */\n search: string;\n /**\n * The field the commands act on, such as the composer's textarea beside a \"+\" button. Its text and selection are the\n * `context` of an `onSelect`, and `context.insert` and entries with `text` write into it as typing would.\n */\n target?: HTMLTextAreaElement | HTMLInputElement;\n /**\n * The composer box the menu docks to, as the slash list does: as wide as the box, just above it, or below it when\n * there is more room there. Without it, the menu opens beside its trigger.\n */\n dock?: HTMLElement;\n /** Receives inserted text when there is no `target`, such as a snippet the host places itself. */\n onInsert?: (text: string) => void;\n /** The `CommandMenu.Trigger`; leave it out for a menu opened through `openAt` or `attach`. */\n children?: JSX.Element;\n position?: DropdownPosition;\n align?: \"start\" | \"end\";\n /** Receives `open`, which shows the menu beside `anchor` without its trigger; focus returns to `returnFocus`. */\n openAt?: (open: (anchor: DropdownAnchor, returnFocus?: DropdownReturnFocus) => void) => void;\n /** Adopts an element rendered elsewhere, such as a server-rendered chip, as the trigger. */\n attach?: () => HTMLElement | null | undefined;\n onOpenChange?: (open: boolean) => void;\n disabled?: boolean;\n class?: string;\n};\n\n/**\n * A searchable command list beside a trigger or an anchor, with the slash menu's entries and rows: groups, icons,\n * unavailable entries with their reason, and second lists. Focus stays in the search field; Up, Down, Home, and End\n * mark, Enter and Tab choose, Escape or Backspace in an empty field go back, and Escape in the first list closes.\n */\nfunction CommandMenuRoot(props: CommandMenuProps): JSX.Element {\n const body: DropdownBody = (shell) => {\n const listId = `k2b-command-menu-${createUniqueId().replace(/[^a-zA-Z0-9_-]/g, \"-\")}`;\n const [query, setQuery] = createSignal(\"\");\n let input!: HTMLInputElement;\n /** The open menu, kept while an outcome replaces the search field that finds it. */\n let menu: HTMLElement | null = null;\n /** Where the focus was when an outcome took the list's place: inside the menu, or in the target. */\n let focusInMenu = false;\n const nav = createCommandNavigator({\n items: () => props.items,\n query,\n onText: (item) => {\n // Read before closing: closing resets the list.\n const text = item.text ?? \"\";\n const target = props.target;\n shell.close(!target);\n insert(text);\n },\n context: () => {\n const target = props.target;\n const value = target?.value ?? \"\";\n const start = target?.selectionStart ?? 0;\n return {\n ...commandPlace(value, start, start),\n selection: { start, end: target?.selectionEnd ?? start },\n insert: (text: string) => insert(text),\n };\n },\n active: shell.open,\n // The focus goes back to the trigger only from inside the menu: an entry that wrote into the target, or moved\n // the focus elsewhere itself, leaves it there. An outcome keeps the menu open in the list's place: the person\n // writes on in the target, or, without one, the focus rests on the outcome until it clears.\n afterRun: (outcome) => {\n // An outcome replaces the search field before this runs, which leaves the focus on the page's body.\n const focused = document.activeElement;\n const inside = !focused || focused === document.body || Boolean(menu?.contains(focused));\n if (!outcome) return shell.close(inside);\n focusInMenu = inside && !props.target;\n if (inside && props.target) props.target.focus({ preventScroll: true });\n else if (focusInMenu)\n queueMicrotask(() => menu?.querySelector<HTMLElement>(\".k2b-command-outcome\")?.focus({ preventScroll: true }));\n },\n onStep: () => setQuery(\"\"),\n });\n /** Writes into the target at its caret, as typing would, or hands the text to `onInsert`. */\n const insert = (text: string) => {\n const target = props.target;\n if (!target) return props.onInsert?.(text);\n replaceTextareaRange(target as HTMLTextAreaElement, target.selectionStart ?? 0, target.selectionEnd ?? 0, text);\n };\n // An outcome that cleared closes the menu; the focus returns to the trigger only from inside it.\n createEffect(\n on(\n nav.outcome,\n (outcome, previous) => {\n if (menu) {\n if (outcome) menu.dataset.outcome = outcome.state;\n else delete menu.dataset.outcome;\n }\n if (!outcome && previous && shell.open()) shell.close(Boolean(menu?.contains(document.activeElement)) || focusInMenu);\n },\n { defer: true },\n ),\n );\n // Typing on in the target clears an outcome once it showed long enough; keys on the outcome itself do too. When\n // the typing opened another list for the target, such as its slash commands, the outcome gives way at once.\n createEffect(() => {\n const target = props.target;\n if (!target || !nav.outcome()) return;\n const typed = () => {\n nav.typedOn();\n queueMicrotask(() => {\n const controls = target.getAttribute(\"aria-controls\");\n if (controls && controls !== listId) nav.clearOutcome();\n });\n };\n target.addEventListener(\"input\", typed);\n onCleanup(() => target.removeEventListener(\"input\", typed));\n });\n createEffect(\n on(shell.open, (open) => {\n menu = input.closest<HTMLElement>(\".k2b-dropdown__menu\") ?? menu;\n const docked = menu;\n const dock = props.dock;\n if (open && dock && docked) {\n // A phone's keyboard moves the visible viewport, which the menu follows like the slash list.\n const follow = () => {\n if (docked.matches(\":popover-open\")) dockCommandList(docked, dock);\n };\n follow();\n const stop = followComposer(dock, follow);\n const closed = () => {\n if (!docked.matches(\":popover-open\")) {\n stop();\n docked.removeEventListener(\"toggle\", closed);\n }\n };\n docked.addEventListener(\"toggle\", closed);\n return;\n }\n if (open) {\n // The width it opened with stays its least, so filtering never narrows it.\n queueMicrotask(() => {\n if (menu?.matches(\":popover-open\")) menu.style.minWidth = `min(${menu.getBoundingClientRect().width}px, 100vw - 2rem)`;\n });\n return;\n }\n if (menu) menu.style.minWidth = \"\";\n // Closing the menu, with Escape or a press outside, stops a running command and clears its outcome.\n nav.abort();\n nav.clearOutcome();\n nav.reset();\n setQuery(\"\");\n focusInMenu = false;\n }),\n );\n shell.api({\n focus: (mark) => {\n input.focus({ preventScroll: true });\n if (mark === \"last\") nav.edge(\"last\");\n },\n });\n const search = (\n <label class=\"k2b-dropdown__search\">\n <i class=\"ti ti-search\" aria-hidden=\"true\" />\n <input\n ref={input}\n type=\"search\"\n role=\"combobox\"\n aria-label={nav.step()?.next?.label ?? props.search}\n aria-expanded=\"true\"\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={\n nav.entries()[nav.active()] && !nav.entries()[nav.active()]!.disabled ? commandOptionId(listId, nav.active()) : undefined\n }\n autocomplete=\"off\"\n spellcheck={false}\n enterkeyhint=\"go\"\n placeholder={nav.step()?.next?.label ?? props.search}\n value={query()}\n // While a command runs, the list waits for it; the query keeps the running entry in view.\n readOnly={nav.busy()}\n onInput={(event) => setQuery(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (!commandListKey(nav, event, query())) return;\n // Escape that left a second list, and Tab that chose, stay inside the menu.\n event.preventDefault();\n event.stopPropagation();\n }}\n />\n </label>\n );\n return (\n <CommandList\n navigator={nav}\n id={listId}\n label={props.label}\n query={query}\n header={search}\n // After Retry or Close the focus stays where the person works: the target, or the outcome itself.\n onOutcomeAction={() => {\n if (props.target) props.target.focus({ preventScroll: true });\n else menu?.querySelector<HTMLElement>(\".k2b-command-outcome\")?.focus({ preventScroll: true });\n }}\n />\n );\n };\n\n return (\n <DropdownShell\n items={[]}\n body={body}\n label={props.label}\n menuClass=\"k2b-command-menu\"\n placeMenu={props.dock ? (menu) => dockCommandList(menu, props.dock!) : undefined}\n position={props.position}\n align={props.align}\n openAt={props.openAt}\n attach={props.attach}\n onOpenChange={props.onOpenChange}\n disabled={props.disabled}\n class={props.class}\n >\n {props.children}\n </DropdownShell>\n );\n}\n\ntype CommandMenuComponent = ((props: CommandMenuProps) => JSX.Element) & {\n Trigger: typeof Dropdown.Trigger;\n};\n\nexport const CommandMenu = CommandMenuRoot as CommandMenuComponent;\nCommandMenu.Trigger = Dropdown.Trigger;\n"],"mappings":";;;;;;AAAA,SAAS,YAAY,EAAE,YAAY,EAAE,cAAc,EAAY,EAAE,EAAE,SAAS,QAAQ,UAAU;AAC9F,SAAS,oBAAoB,QAAQ,sBAAsB;AAC3D,SAAS,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,sBAAsB,QAAQ,eAAe;AACpG,SAAS,eAAe,EAAE,cAAc,QAAQ,gBAAgB;AAChE,SAA6B,YAAY,QAAQ,iBAAiB;AAClE,SACE,QAAQ,EAKR,aAAa,QACR,YAAY;AAkCnB;AACA;AACA;AACA;AACA;AACA,SAAS,eAAe,CAAC,KAAuB,EAAe;EAC7D,MAAM,IAAkB,GAAI,KAAK,IAA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AAG,eAAuC;AAClE,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO","ignoreList":[]}
|
|
@@ -253,7 +253,7 @@ const rovingFocus = (root, orientation) => {
|
|
|
253
253
|
* measuring: hiding it, even for a moment, can make the browser drop focus from it or from its open menu. An idle More
|
|
254
254
|
* stays out of the flow but keeps its box, so its width is always known.
|
|
255
255
|
*/
|
|
256
|
-
const measureOverflow = (root, more, actions, available) => {
|
|
256
|
+
const measureOverflow = (root, more, actions, available, pinned = false) => {
|
|
257
257
|
for (const element of root.querySelectorAll(`[${overflowAttribute}]`)) if (element !== more) reveal(element);
|
|
258
258
|
root.removeAttribute(compactAttribute);
|
|
259
259
|
const children = Array.from(root.children).filter(element => element instanceof HTMLElement && element !== more);
|
|
@@ -306,10 +306,11 @@ const measureOverflow = (root, more, actions, available) => {
|
|
|
306
306
|
const candidates = actions
|
|
307
307
|
// An action its application hides, even with `visibility: hidden`, must not reappear as a More row.
|
|
308
308
|
.filter(action => action.props.priority !== undefined && visible(action.element) && getComputedStyle(action.element).visibility !== "hidden").reverse().sort((a, b) => b.props.priority - a.props.priority);
|
|
309
|
-
|
|
310
|
-
|
|
309
|
+
// With rarer commands of its own, More always shows and always takes its room.
|
|
310
|
+
let movedAny = pinned;
|
|
311
|
+
tidy(pinned);
|
|
311
312
|
// Labels go before actions: a toolbar that does not fit with its labels drops them first.
|
|
312
|
-
if (used(
|
|
313
|
+
if (used(pinned) > available && root.querySelector(".k2b-toolbar__action[data-text]")) root.setAttribute(compactAttribute, "");
|
|
313
314
|
for (const action of candidates) {
|
|
314
315
|
if (used(movedAny) <= available) break;
|
|
315
316
|
hide(action.element);
|
|
@@ -346,7 +347,7 @@ export const Toolbar = Object.assign(props => {
|
|
|
346
347
|
// Cleared before measuring so the pending `visibility: hidden` does not hide every action from the check
|
|
347
348
|
// below; the whole measurement still runs before the next paint.
|
|
348
349
|
root.removeAttribute("data-overflow-pending");
|
|
349
|
-
const next = measureOverflow(root, more, ordered, available);
|
|
350
|
+
const next = measureOverflow(root, more, ordered, available, (props.moreItems?.length ?? 0) > 0);
|
|
350
351
|
setMoved(previous => previous.length === next.length && previous.every((action, index) => action === next[index]) ? previous : next);
|
|
351
352
|
navigation?.sync();
|
|
352
353
|
// Focus on an action that moved, on a menu row whose action came back, or on a More that disappeared goes to
|
|
@@ -405,7 +406,15 @@ export const Toolbar = Object.assign(props => {
|
|
|
405
406
|
mutations.disconnect();
|
|
406
407
|
});
|
|
407
408
|
});
|
|
408
|
-
|
|
409
|
+
// Actions that moved come first, in their order and in a group of their own; the host's rarer commands follow.
|
|
410
|
+
const menuItems = () => {
|
|
411
|
+
const movedItems = moved().map(action => action.item);
|
|
412
|
+
const pinnedItems = props.moreItems ?? [];
|
|
413
|
+
if (!pinnedItems.length) return movedItems;
|
|
414
|
+
return movedItems.length ? [{
|
|
415
|
+
items: movedItems
|
|
416
|
+
}, ...pinnedItems] : [...pinnedItems];
|
|
417
|
+
};
|
|
409
418
|
const content = _$createComponent(ToolbarOrientationContext.Provider, {
|
|
410
419
|
value: orientation,
|
|
411
420
|
get children() {
|
|
@@ -429,7 +438,7 @@ export const Toolbar = Object.assign(props => {
|
|
|
429
438
|
return messages().moreActions;
|
|
430
439
|
},
|
|
431
440
|
get disabled() {
|
|
432
|
-
return moved().length === 0;
|
|
441
|
+
return _$memo(() => moved().length === 0)() && !props.moreItems?.length;
|
|
433
442
|
},
|
|
434
443
|
get children() {
|
|
435
444
|
return _$createComponent(Dropdown.Trigger, {
|