@mistriwork/kit 1.0.0-rc.39 → 1.0.0-rc.40

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.
@@ -12,7 +12,7 @@ import { useRef, useState } from 'react';
12
12
  import { formatBytes } from '../locale.js';
13
13
  import { toast } from '../core.js';
14
14
  import { Empty } from './Notes.js';
15
- import { Button, buttonClass } from '@mistriwork/ui/Button.js';
15
+ import { Button, ButtonLink } from '@mistriwork/ui/Button.js';
16
16
  import { Field } from '@mistriwork/ui/Field.js';
17
17
  import { Modal } from '@mistriwork/ui/Modal.js';
18
18
  import { DropItem, DropMenu } from '@mistriwork/ui/DropMenu.js';
@@ -119,7 +119,7 @@ export function AttachmentList({ items, emptyText, empty, upload }) {
119
119
  return (_jsxs("li", { className: "attachments-item", children: [_jsx("span", { className: "attachments-badge", "aria-hidden": "true", children: badge(item.name) }), renaming === item.id && item.rename ? (_jsx(RenameRow, { item: item, onDone: () => setRenaming(undefined) })) : (_jsxs(_Fragment, { children: [_jsxs("span", { className: "attachments-text", children: [preview ? (_jsx("button", { type: "button", className: "attachments-name", title: say('preview', { name: item.name }), onClick: (event) => {
120
120
  back.current = event.currentTarget;
121
121
  setPreviewing(preview);
122
- }, children: item.name })) : (_jsx("a", { className: "attachments-name", href: item.href, download: item.name, onClick: saveOnLease(item), children: item.name })), item.meta.length > 0 && _jsx("span", { className: "attachments-meta", children: item.meta.join(' · ') })] }), _jsxs("span", { className: "attachments-actions", children: [_jsx("a", { className: buttonClass({ intent: 'quiet', size: 'compact', className: 'attachments-download' }), href: item.href, download: item.name, onClick: saveOnLease(item), "aria-label": say('downloadName', { name: item.name }), children: say('download') }), (item.onOpen || item.rename || item.remove) && (_jsxs(DropMenu, { className: "row-actions-menu", triggerClassName: "ghost row-actions-trigger", triggerTitle: say('more', { name: item.name }), triggerLabel: say('more', { name: item.name }), label: "\u22EF", popupClassName: "page-actions-popup", align: "end", children: [item.onOpen && (_jsx(DropItem, { className: "page-actions-item", onClick: item.onOpen, children: say('detailsItem') })), item.rename && (_jsx(DropItem, { className: "page-actions-item", onClick: () => setRenaming(item.id), children: say('common.rename') })), item.remove && (_jsx(DropItem, { className: "page-actions-item is-danger", onClick: () => setRemoving(item), children: say('removeMore') }))] }))] })] }))] }, item.id));
122
+ }, children: item.name })) : (_jsx("a", { className: "attachments-name", href: item.href, download: item.name, onClick: saveOnLease(item), children: item.name })), item.meta.length > 0 && _jsx("span", { className: "attachments-meta", children: item.meta.join(' · ') })] }), _jsxs("span", { className: "attachments-actions", children: [_jsx(ButtonLink, { intent: "quiet", size: "compact", className: "attachments-download", href: item.href, download: item.name, onClick: saveOnLease(item), "aria-label": say('downloadName', { name: item.name }), children: say('download') }), (item.onOpen || item.rename || item.remove) && (_jsxs(DropMenu, { className: "row-actions-menu", triggerClassName: "ghost row-actions-trigger", triggerTitle: say('more', { name: item.name }), triggerLabel: say('more', { name: item.name }), label: "\u22EF", popupClassName: "page-actions-popup", align: "end", children: [item.onOpen && (_jsx(DropItem, { className: "page-actions-item", onClick: item.onOpen, children: say('detailsItem') })), item.rename && (_jsx(DropItem, { className: "page-actions-item", onClick: () => setRenaming(item.id), children: say('common.rename') })), item.remove && (_jsx(DropItem, { className: "page-actions-item is-danger", onClick: () => setRemoving(item), children: say('removeMore') }))] }))] })] }))] }, item.id));
123
123
  }) })) : ((empty ?? _jsx(Empty, { className: "attachments-empty", text: emptyText }))), previewing && _jsx(FilePreview, { file: previewing, onClose: () => setPreviewing(undefined), finalFocus: back }), removing && _jsx(RemoveConfirm, { item: removing, onClose: () => setRemoving(undefined) })] }));
124
124
  }
125
125
  /** The name, edited where it stood: Enter saves, Escape puts it back. */
@@ -11,7 +11,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  * to learn and no examples to fetch.
12
12
  */
13
13
  import { useEffect, useRef, useState } from 'react';
14
- import { currentEntry, state, trapFocus } from '../core.js';
14
+ import { Modal } from '@mistriwork/ui/Modal.js';
15
+ import { currentEntry, state } from '../core.js';
15
16
  import { SECTIONS, buildExamples, runExample, sampleRows } from '../helpContent.js';
16
17
  import { say } from '../copy/workbench/components/HelpPanel.js';
17
18
  import '../help.css';
@@ -45,17 +46,12 @@ function useExamples(enabled) {
45
46
  return built;
46
47
  }
47
48
  export function HelpPanel({ onClose, keysOnly = false }) {
48
- const backdrop = useRef(null);
49
49
  const close = useRef(null);
50
50
  const built = useExamples(!keysOnly);
51
- useEffect(() => {
52
- const release = trapFocus(backdrop.current);
53
- close.current?.focus();
54
- return () => release?.();
55
- }, []);
56
51
  useEffect(() => {
57
52
  const onKey = (e) => {
58
- if (e.key === 'Escape' || e.key === '?') {
53
+ /* Escape is the dialog's own (Modal); `?` is the key that opened the panel, so it closes it too. */
54
+ if (e.key === '?') {
59
55
  e.preventDefault();
60
56
  e.stopPropagation();
61
57
  onClose();
@@ -77,10 +73,7 @@ export function HelpPanel({ onClose, keysOnly = false }) {
77
73
  ...offered.filter((spec) => !(here && spec.rooms?.includes(here))),
78
74
  ];
79
75
  const title = keysOnly ? say('keyboard') : say('queryLanguage');
80
- return (_jsx("div", { ref: backdrop, className: "help-backdrop", onPointerDown: (e) => {
81
- if (e.target === e.currentTarget)
82
- onClose();
83
- }, children: _jsxs("div", { className: "help-panel", role: "dialog", "aria-modal": "true", "aria-label": title, children: [_jsxs("header", { className: "help-head", children: [_jsxs("div", { children: [_jsx("h2", { className: "help-title", children: title }), _jsx("p", { className: "help-sub", children: keysOnly ? say('theKeysThisPage') : say('everyExampleBelowRuns', { label }) })] }), _jsx("button", { ref: close, type: "button", className: "help-close", "aria-label": say('common.close'), title: say('closeParenEsc'), onClick: onClose, children: _jsx("span", { "aria-hidden": "true", children: "\u00D7" }) })] }), _jsx("div", { className: "help-body", children: ordered.map((spec) => (_jsx(Section, { spec: spec, examples: built.examples, onRun: onClose, here: Boolean(here && spec.rooms?.includes(here)) }, spec.title))) })] }) }));
76
+ return (_jsxs(Modal, { className: "help-panel", onClose: onClose, ariaLabel: title, initialFocus: close, fullscreen: false, children: [_jsxs("header", { className: "help-head", children: [_jsxs("div", { children: [_jsx("h2", { className: "help-title", children: title }), _jsx("p", { className: "help-sub", children: keysOnly ? say('theKeysThisPage') : say('everyExampleBelowRuns', { label }) })] }), _jsx("button", { ref: close, type: "button", className: "help-close", "aria-label": say('common.close'), title: say('closeParenEsc'), onClick: onClose, children: _jsx("span", { "aria-hidden": "true", children: "\u00D7" }) })] }), _jsx("div", { className: "help-body", children: ordered.map((spec) => (_jsx(Section, { spec: spec, examples: built.examples, onRun: onClose, here: Boolean(here && spec.rooms?.includes(here)) }, spec.title))) })] }));
84
77
  }
85
78
  function Section({ spec, examples, onRun, here, }) {
86
79
  /* A section with no `keys` is static reference and must not reach for examples it never claimed. */
@@ -59,14 +59,13 @@
59
59
 
60
60
  /* ---------- the panel ---------- */
61
61
 
62
- .help-backdrop {
63
- position: fixed; inset: 0; z-index: 60;
64
- background: var(--scrim);
65
- display: flex; justify-content: center;
66
- padding: 8vh var(--space-5) var(--space-5);
67
- }
68
- .help-panel {
69
- width: min(720px, 96vw); max-height: 84vh;
62
+ /* A Modal (HelpPanel.tsx): the scrim is its backdrop, and the box hangs from the top rather than sitting centered, so
63
+ the sections do not jump as the examples sharpen. */
64
+ .modal-backdrop.help-panel-backdrop { background: var(--scrim); }
65
+ .modal.help-panel {
66
+ inset: 8vh 0 auto; margin: 0 auto; padding: 0;
67
+ width: min(720px, 96vw); max-width: none; height: auto; max-height: 84vh;
68
+ color: var(--ink);
70
69
  display: flex; flex-direction: column;
71
70
  background: var(--surface);
72
71
  border: 1px solid var(--line-strong);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mistriwork/kit",
3
- "version": "1.0.0-rc.39",
3
+ "version": "1.0.0-rc.40",
4
4
  "description": "The shared React client both shells are drawn with: the walk and the address, Grid, Value, the record page, lists, filters and charts.",
5
5
  "homepage": "https://mistriwork.dev",
6
6
  "bugs": {
@@ -83,8 +83,8 @@
83
83
  "./package.json": "./package.json"
84
84
  },
85
85
  "dependencies": {
86
- "@mistriwork/engine": "1.0.0-rc.39",
87
- "@mistriwork/ui": "1.0.0-rc.39",
86
+ "@mistriwork/engine": "1.0.0-rc.40",
87
+ "@mistriwork/ui": "1.0.0-rc.40",
88
88
  "intl-messageformat": "12.1.2",
89
89
  "qrcode-generator": "^2.0.4"
90
90
  },