viewkitjs 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/query/evaluate.d.ts +7 -0
- package/fields/dist/query/exact-number.d.ts +8 -2
- package/fields/dist/query/exact-number.js +14 -1
- package/fields/dist/query/sort.js +13 -10
- package/fields/dist/registry.js +5 -1
- package/fields/dist/types.d.ts +4 -1
- package/fields/dist/zod.d.ts +5 -0
- package/fields/dist/zod.js +10 -1
- package/fields/docs/guides/contact-values.md +12 -0
- package/fields/docs/guides/field-types.md +1 -1
- package/fields/docs/guides/queries.md +3 -1
- package/fields/docs/reference/fields.md +1 -0
- package/package.json +1 -1
- package/postgres/dist/check.js +4 -1
- package/postgres/dist/definitions/formula-forms.js +3 -1
- package/postgres/dist/definitions/money.js +2 -1
- package/postgres/dist/page.js +6 -3
- package/postgres/dist/rules.d.ts +15 -1
- package/postgres/dist/rules.js +16 -0
- package/postgres/dist/sort.js +7 -2
- package/postgres/docs/guides/definitions.md +1 -1
- package/postgres/docs/guides/field-map.md +1 -1
- package/postgres/docs/reference/definitions.md +1 -1
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/atoms/ToolbarButton.d.ts +1 -1
- package/views/dist/atoms/ToolbarButton.js +4 -3
- package/views/dist/atoms/frame-parts.d.ts +6 -0
- package/views/dist/atoms/frame-parts.js +15 -0
- package/views/dist/atoms/types.d.ts +16 -7
- package/views/dist/cells/cell-title.d.ts +3 -1
- package/views/dist/cells/cell-title.js +2 -2
- package/views/dist/cells/cell-values.js +2 -2
- package/views/dist/contract.d.ts +31 -6
- package/views/dist/contract.js +123 -0
- package/views/dist/controls/button/map-button.js +2 -0
- package/views/dist/controls/checkbox/checkbox.d.ts +3 -2
- package/views/dist/controls/checkbox/checkbox.js +2 -2
- package/views/dist/controls/compound-editor/compound-editor.d.ts +1 -1
- package/views/dist/controls/compound-editor/name-parts.js +4 -4
- package/views/dist/controls/compound-editor/place-parts.js +19 -19
- package/views/dist/controls/compound-editor/range-parts.js +14 -14
- package/views/dist/controls/compound-editor/row.d.ts +3 -1
- package/views/dist/controls/compound-editor/row.js +2 -2
- package/views/dist/controls/controls.d.ts +2 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/customize/customize.js +37 -35
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
- package/views/dist/controls/customize/map-customize-body.js +4 -0
- package/views/dist/controls/date-editor/date-days.js +2 -2
- package/views/dist/controls/date-editor/date-editor.js +18 -18
- package/views/dist/controls/date-editor/date-parts.js +6 -6
- package/views/dist/controls/date-editor/map-calendar.js +1 -1
- package/views/dist/controls/date-editor.css +2 -2
- package/views/dist/controls/field/field.d.ts +3 -0
- package/views/dist/controls/field/field.js +6 -6
- package/views/dist/controls/filter-editor/block.d.ts +2 -2
- package/views/dist/controls/filter-editor/block.js +5 -5
- package/views/dist/controls/filter-editor/filter-editor.js +31 -33
- package/views/dist/controls/filter-editor/how.d.ts +3 -1
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +1 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -3
- package/views/dist/controls/filter-editor/map-rules.js +1 -1
- package/views/dist/controls/filter-editor/parts.js +2 -1
- package/views/dist/controls/group-editor/group-editor.js +15 -13
- package/views/dist/controls/index.d.ts +2 -0
- package/views/dist/controls/index.js +1 -0
- package/views/dist/controls/input/input.js +2 -2
- package/views/dist/controls/input/map-input.js +2 -0
- package/views/dist/controls/internal/editor-parts.js +1 -1
- package/views/dist/controls/internal/map-panel-controls.d.ts +8 -0
- package/views/dist/controls/internal/map-panel-controls.js +20 -0
- package/views/dist/controls/internal/panel-controls.d.ts +50 -0
- package/views/dist/controls/internal/panel-controls.js +197 -0
- package/views/dist/controls/internal/part-slot.d.ts +12 -0
- package/views/dist/controls/internal/part-slot.js +5 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +1 -1
- package/views/dist/controls/links-editor/links-editor.js +27 -27
- package/views/dist/controls/menu/map-menu.d.ts +2 -2
- package/views/dist/controls/menu/map-menu.js +15 -12
- package/views/dist/controls/menu/menu.d.ts +2 -0
- package/views/dist/controls/menu/menu.js +3 -3
- package/views/dist/controls/menu-list/menu-list.d.ts +14 -4
- package/views/dist/controls/menu-list/menu-list.js +23 -22
- package/views/dist/controls/notice/notice.d.ts +3 -1
- package/views/dist/controls/notice/notice.js +2 -2
- package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
- package/views/dist/controls/number-editor/number-editor.js +13 -13
- package/views/dist/controls/number-field/number-field.js +5 -3
- package/views/dist/controls/pane/pane.d.ts +4 -2
- package/views/dist/controls/pane/pane.js +4 -4
- package/views/dist/controls/picker/picker.d.ts +2 -0
- package/views/dist/controls/picker/picker.js +37 -36
- package/views/dist/controls/picker/rows.d.ts +4 -0
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +4 -2
- package/views/dist/controls/quick-filters/quick-filters.js +4 -4
- package/views/dist/controls/radio/radio.d.ts +3 -0
- package/views/dist/controls/radio/radio.js +4 -3
- package/views/dist/controls/select/map-select.d.ts +3 -0
- package/views/dist/controls/select/map-select.js +8 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +3 -3
- package/views/dist/controls/sheet/bottom-sheet.d.ts +5 -1
- package/views/dist/controls/sheet/bottom-sheet.js +2 -2
- package/views/dist/controls/sheet/map-sheet.js +1 -1
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +1 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +7 -3
- package/views/dist/controls/sort-editor/sort-editor.js +24 -26
- package/views/dist/controls/sort-editor.css +5 -0
- package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
- package/views/dist/controls/text-editor/text-editor.js +8 -8
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +3 -3
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +7 -6
- package/views/dist/controls/values-editor/values-editor.d.ts +1 -1
- package/views/dist/controls/values-editor/values-editor.js +22 -22
- package/views/dist/controls/views-list/map-view-menu.js +1 -1
- package/views/dist/controls/views-list/view-menu.js +6 -6
- package/views/dist/controls/views-list/views-list.js +4 -4
- package/views/dist/editors/EditorPanel.js +1 -1
- package/views/dist/field-row/FieldRow.js +13 -0
- package/views/dist/fields/money.d.ts +5 -2
- package/views/dist/fields/money.js +14 -2
- package/views/dist/grid/chrome/GridTable.js +4 -1
- package/views/dist/grid/chrome/cell-clipboard.d.ts +4 -2
- package/views/dist/grid/chrome/cell-clipboard.js +2 -2
- package/views/dist/grid/chrome/cells.js +3 -1
- package/views/dist/grid/chrome/grid-row-menu-items.js +1 -1
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +29 -6
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +9 -2
- package/views/dist/grid/core/clipboard-model.d.ts +3 -1
- package/views/dist/grid/core/clipboard-model.js +9 -8
- package/views/dist/grid/core/editing-controller.d.ts +3 -0
- package/views/dist/grid/core/editing-controller.js +6 -0
- package/views/dist/grid/core/edits-sink.d.ts +19 -0
- package/views/dist/grid/core/edits-sink.js +2 -0
- package/views/dist/grid/core/spreadsheet-operations.js +1 -1
- package/views/dist/grid/core/useGridEditing.d.ts +5 -0
- package/views/dist/grid/core/useGridEditing.js +6 -0
- package/views/dist/list/answer.d.ts +40 -0
- package/views/dist/list/answer.js +43 -0
- package/views/dist/list/bulk-bar.d.ts +7 -0
- package/views/dist/list/bulk-bar.js +10 -0
- package/views/dist/list/columns.d.ts +24 -0
- package/views/dist/list/columns.js +27 -0
- package/views/dist/list/edits.d.ts +19 -0
- package/views/dist/list/edits.js +56 -0
- package/views/dist/list/grid.d.ts +11 -0
- package/views/dist/list/grid.js +76 -0
- package/views/dist/list/index.d.ts +14 -1
- package/views/dist/list/index.js +4 -1
- package/views/dist/list/link.d.ts +8 -0
- package/views/dist/list/link.js +78 -0
- package/views/dist/list/list.d.ts +70 -0
- package/views/dist/list/list.js +14 -0
- package/views/dist/list/parts.js +10 -3
- package/views/dist/list/root-base.d.ts +46 -0
- package/views/dist/list/root-base.js +137 -0
- package/views/dist/list/root.d.ts +35 -34
- package/views/dist/list/root.js +153 -113
- package/views/dist/list/source-answers.d.ts +39 -0
- package/views/dist/list/source-answers.js +225 -0
- package/views/dist/list/store.d.ts +37 -5
- package/views/dist/list/store.js +31 -0
- package/views/dist/list/toolbar.d.ts +3 -2
- package/views/dist/list/toolbar.js +14 -2
- package/views/dist/list/views-axis.js +4 -2
- package/views/dist/list/views.d.ts +7 -2
- package/views/dist/list/views.js +16 -5
- package/views/dist/model/column-capabilities.d.ts +13 -0
- package/views/dist/model/column-capabilities.js +23 -2
- package/views/dist/model/column-schema.d.ts +11 -1
- package/views/dist/model/view-rules.js +1 -0
- package/views/dist/panels/model.d.ts +2 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +8 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +2 -2
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +8 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +12 -3
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -4
- package/views/dist/panels/react/toolbar/ToolbarButton.js +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilter.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarNew.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
- package/views/dist/panels/react/toolbar/context.d.ts +10 -1
- package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
- package/views/dist/panels/react/toolbar/panel-part.js +5 -3
- package/views/dist/panels/settings/filter-groups.js +6 -1
- package/views/dist/provider/ViewsProvider.d.ts +6 -2
- package/views/dist/provider/ViewsProvider.js +18 -1
- package/views/dist/provider/components.d.ts +59 -0
- package/views/dist/provider/components.js +1 -1
- package/views/dist/provider/context.d.ts +4 -1
- package/views/dist/provider/own-control.d.ts +4 -0
- package/views/dist/provider/own-control.js +7 -0
- package/views/dist/provider/select-items.d.ts +3 -0
- package/views/dist/provider/select-items.js +6 -0
- package/views/dist/react.d.ts +4 -2
- package/views/dist/react.js +2 -0
- package/views/dist/styles.css +86 -78
- package/views/dist/styles.unlayered.css +86 -78
- package/views/docs/contract.md +252 -5
- package/views/docs/controls/compound-editor.md +4 -0
- package/views/docs/controls/customize.md +6 -0
- package/views/docs/controls/date-editor.md +4 -0
- package/views/docs/controls/field.md +4 -0
- package/views/docs/controls/filter-editor.md +8 -0
- package/views/docs/controls/group-editor.md +6 -0
- package/views/docs/controls/input.md +4 -0
- package/views/docs/controls/links-editor.md +4 -0
- package/views/docs/controls/menu-list.md +8 -0
- package/views/docs/controls/menu.md +4 -0
- package/views/docs/controls/notice.md +4 -0
- package/views/docs/controls/number-editor.md +4 -0
- package/views/docs/controls/pane.md +4 -0
- package/views/docs/controls/picker.md +8 -0
- package/views/docs/controls/quick-filters.md +6 -0
- package/views/docs/controls/radio.md +4 -0
- package/views/docs/controls/select.md +8 -0
- package/views/docs/controls/sheet.md +4 -0
- package/views/docs/controls/sort-editor.md +8 -0
- package/views/docs/controls/text-editor.md +4 -0
- package/views/docs/controls/values-editor.md +4 -0
- package/views/docs/controls/views-list.md +6 -0
- package/views/docs/guides/the-grid.md +2 -2
- package/views/docs/guides/the-provider.md +19 -2
- package/views/docs/reference/controls.md +7 -5
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +1 -1
- package/views/docs/reference/list.md +141 -11
- package/views/docs/reference/panels-react.md +2 -2
- package/views/docs/reference/react.md +15 -9
- package/views/docs/reference/views.md +8 -4
- package/views/docs/reshaping.md +6 -1
|
@@ -79,8 +79,8 @@ export function useLinksEditor(props) {
|
|
|
79
79
|
asked.current?.(); was = now; });
|
|
80
80
|
seenRef.current.observe(el);
|
|
81
81
|
}, []);
|
|
82
|
-
const more = onMore && !doing ? _jsxs("div", { ref: moreRef, className: "o-links-editor-loading", children: [_jsx(Spinner, { size: 16, label: "" }), _jsx("span", { children: w.loadingMore })] }) : null;
|
|
83
|
-
const doingNote = doing === "searching" ? w.searching : doing === "failed" ? _jsxs(_Fragment, { children: [w.failed, onRetry && _jsx(Button, { kind: "quiet", size: "2xs", className: "o-links-editor-retry", onClick: onRetry, children: w.retry })] }) : null;
|
|
82
|
+
const more = onMore && !doing ? _jsxs("div", { ref: moreRef, className: "o-links-editor-loading", "data-slot": "vk-links-note", children: [_jsx(Spinner, { size: 16, label: "" }), _jsx("span", { children: w.loadingMore })] }) : null;
|
|
83
|
+
const doingNote = doing === "searching" ? w.searching : doing === "failed" ? _jsxs(_Fragment, { children: [w.failed, onRetry && _jsx(Button, { kind: "quiet", size: "2xs", className: "o-links-editor-retry", "data-slot": "vk-links-retry", onClick: onRetry, children: w.retry })] }) : null;
|
|
84
84
|
const byValue = (value) => records.find((r) => r.value === value) ?? { value, label: links.find((l) => l.value === value)?.label ?? value };
|
|
85
85
|
const [root, setRoot] = React.useState(null);
|
|
86
86
|
const searchBox = React.useRef(null), list = React.useRef(null);
|
|
@@ -223,27 +223,27 @@ export function useLinksEditor(props) {
|
|
|
223
223
|
.filter(Boolean).join(" · ");
|
|
224
224
|
const rowWords = (f, v) => { const s = said(f, v, w.yes); return f.kind === "yes-no" ? (v === true ? w.yes : w.no) : s === "–" ? w.none : s; };
|
|
225
225
|
const openList = (value, field) => setTop({ link: value, field });
|
|
226
|
-
const fieldRow = (l, name, f) => (f.kind === "yes-no" ? (_jsxs(FieldRow, { className: "o-links-editor-open", "data-field": f.id, children: [_jsx("span", { className: "o-links-editor-open-name", children: f.label }), _jsx(Switch, { size: "lg", className: "o-links-editor-switch", checked: l.values[f.id] === true, "aria-label": w.fieldAt(f.label, name), onCheckedChange: (c) => setField(l.value, f.id, c) })] }, f.id)) : (_jsxs(FieldRow, { as: "button", className: "o-links-editor-open", "data-field": f.id, "aria-label": w.fieldAt(f.label, name), onClick: () => openList(l.value, f.id), children: [_jsx("span", { className: "o-links-editor-open-name", children: f.label }), _jsx("span", { className: "o-links-editor-open-value", children: rowWords(f, l.values[f.id]) }), glyph(MORE, "o-links-editor-open-mark")] }, f.id)));
|
|
226
|
+
const fieldRow = (l, name, f) => (f.kind === "yes-no" ? (_jsxs(FieldRow, { className: "o-links-editor-open", "data-slot": "vk-links-field", "data-key": f.id, "data-field": f.id, children: [_jsx("span", { className: "o-links-editor-open-name", children: f.label }), _jsx(Switch, { size: "lg", className: "o-links-editor-switch", "data-slot": "vk-links-control", "data-key": f.id, checked: l.values[f.id] === true, "aria-label": w.fieldAt(f.label, name), onCheckedChange: (c) => setField(l.value, f.id, c) })] }, f.id)) : (_jsxs(FieldRow, { as: "button", className: "o-links-editor-open", "data-slot": "vk-links-field", "data-key": f.id, "data-field": f.id, "aria-label": w.fieldAt(f.label, name), onClick: () => openList(l.value, f.id), children: [_jsx("span", { className: "o-links-editor-open-name", children: f.label }), _jsx("span", { className: "o-links-editor-open-value", children: rowWords(f, l.values[f.id]) }), glyph(MORE, "o-links-editor-open-mark")] }, f.id)));
|
|
227
227
|
const card = (r) => {
|
|
228
228
|
const l = links.find((x) => x.value === r.value), name = r.label, leads = lead != null && lead.value === r.value;
|
|
229
229
|
const said_ = holds(l);
|
|
230
|
-
return (_jsxs(FieldRows, { look: CARD, className: "o-links-editor-card", "data-link": r.value, role: "listitem", "aria-label": name, children: [_jsxs(FieldRow, { as: "div", className: "o-links-editor-card-head", children: [_jsx(Face, { record: r, size: 24 }), _jsxs("span", { className: "o-links-editor-card-name", children: [_jsx("span", { children: name }), leads && _jsx("span", { className: "o-links-editor-lead-word", children: lead.label })] }), !several
|
|
231
|
-
? _jsx(Menu, { label: w.linkMenu(name), align: "end", entries: [...(lead && !leads ? [{ icon: _jsx(Icon, { name: "star" }), label: w.setLead(lead.label), onSelect: () => setLead(r.value) }] : []), { icon: glyph(UNLINK), label: w.unlink, danger: true, onSelect: () => unlink(r.value) }], trigger: _jsx(Button, { kind: "quiet", shape: "icon", size: "40x44", look: DOTS_LOOK, className: "o-links-editor-more", "aria-label": w.actionsFor(name), icon: glyph(DOTS) }) })
|
|
232
|
-
: _jsx(Button, { kind: "quiet", shape: "icon", size: "40x44", look: DOTS_LOOK, className: "o-links-editor-config", "aria-label": w.editLink(name), "aria-haspopup": "dialog", icon: _jsx(Icon, { name: "settings", size: 20 }), onClick: () => setFieldsOf(r.value) })] }), !several ? one && fieldRow(l, name, one) : _jsx("div", { className: "o-links-editor-card-line", "data-none": said_ ? undefined : "", children: said_ || w.noDetails })] }, r.value));
|
|
230
|
+
return (_jsxs(FieldRows, { look: CARD, className: "o-links-editor-card", "data-slot": "vk-links-row", "data-key": r.value, "data-link": r.value, role: "listitem", "aria-label": name, children: [_jsxs(FieldRow, { as: "div", className: "o-links-editor-card-head", children: [_jsx(Face, { record: r, size: 24 }), _jsxs("span", { className: "o-links-editor-card-name", "data-slot": "vk-links-name", children: [_jsx("span", { children: name }), leads && _jsx("span", { className: "o-links-editor-lead-word", children: lead.label })] }), !several
|
|
231
|
+
? _jsx(Menu, { label: w.linkMenu(name), align: "end", entries: [...(lead && !leads ? [{ icon: _jsx(Icon, { name: "star" }), label: w.setLead(lead.label), onSelect: () => setLead(r.value), slot: { slot: "vk-links-action", key: "lead" } }] : []), { icon: glyph(UNLINK), label: w.unlink, danger: true, onSelect: () => unlink(r.value), slot: { slot: "vk-links-action", key: "unlink" } }], trigger: _jsx(Button, { kind: "quiet", shape: "icon", size: "40x44", look: DOTS_LOOK, className: "o-links-editor-more", "data-slot": "vk-links-more", "aria-label": w.actionsFor(name), icon: glyph(DOTS) }) })
|
|
232
|
+
: _jsx(Button, { kind: "quiet", shape: "icon", size: "40x44", look: DOTS_LOOK, className: "o-links-editor-config", "data-slot": "vk-links-config", "aria-label": w.editLink(name), "aria-haspopup": "dialog", icon: _jsx(Icon, { name: "settings", size: 20 }), onClick: () => setFieldsOf(r.value) })] }), !several ? one && fieldRow(l, name, one) : _jsx("div", { className: "o-links-editor-card-line", "data-none": said_ ? undefined : "", children: said_ || w.noDetails })] }, r.value));
|
|
233
233
|
};
|
|
234
234
|
const topLink = top ? links.find((l) => l.value === top.link) : undefined, topField = top ? fields.find((f) => f.id === top.field) : undefined;
|
|
235
235
|
const fieldsLink = fieldsOf ? links.find((l) => l.value === fieldsOf) : undefined;
|
|
236
236
|
const fieldsName = fieldsOf ? byValue(fieldsOf).label : "";
|
|
237
237
|
const listStep = top && topLink && topField ? top : null;
|
|
238
238
|
const fieldsStep = several ? fieldsLink ?? null : null;
|
|
239
|
-
const body = (_jsx("div", { ref: placeRoot, className: "o-links-editor", "data-kit": "links-editor", ...mark, "data-links-form": "phone", "data-links-shape": "table", "data-links-fields": several ? "several" : "one", tabIndex: -1, "data-links-step": listStep ? "list" : fieldsStep ? "fields" : undefined, style: sheetRoom ? { "--links-room": `${sheetRoom.height}px`, "--links-under": `${sheetRoom.under}px` } : undefined, children: listStep && topLink && topField ? (_jsx(StepList, { ...listOf(topLink, topField), draft: "shell", form: "phone", onDone: () => setTop(null) }, `${listStep.link}-${listStep.field}`)) : fieldsStep ? _jsxs(_Fragment, { children: [_jsxs(FieldRows, { look: FIELDS, className: "o-links-editor-fields", "data-link": fieldsStep.value, children: [fields.map((f) => f.kind === "yes-no"
|
|
240
|
-
? _jsx(FieldRow, { label: f.label, "data-field": f.id, children: _jsx(Switch, { size: "lg", className: "o-links-editor-switch", checked: fieldsStep.values[f.id] === true, "aria-label": w.fieldAt(f.label, fieldsName), onCheckedChange: (c) => setField(fieldsStep.value, f.id, c) }) }, f.id)
|
|
241
|
-
: _jsxs(FieldRow, { as: "button", label: f.label, className: "o-links-editor-open", "data-field": f.id, "aria-label": w.fieldAt(f.label, fieldsName), onClick: () => openList(fieldsStep.value, f.id), children: [_jsx("span", { className: "o-links-editor-open-value", children: rowWords(f, fieldsStep.values[f.id]) }), glyph(MORE, "o-links-editor-open-mark")] }, f.id)), lead && _jsx(FieldRow, { label: lead.label, "data-field": "lead", children: _jsx(Switch, { size: "lg", className: "o-links-editor-switch", checked: lead.value === fieldsStep.value, "aria-label": w.isLead(fieldsName, lead.label), onCheckedChange: (c) => { if (c)
|
|
242
|
-
setLead(fieldsStep.value); } }) })] }), _jsx(FieldRows, { look: FIELDS, className: "o-links-editor-fields-foot", children: _jsx(FieldRow, { as: "button", className: "o-links-editor-unlink", onClick: () => { const v = fieldsStep.value; setFieldsOf(null); unlink(v); }, children: w.unlink }) })] }) : _jsxs(_Fragment, { children: [linked.length > 0 && _jsx("div", { className: "o-links-editor-cards", role: "list", "aria-label": label, children: linked.map(card) }), (rest.length > 0 || actions.length > 0) && _jsxs(_Fragment, { children: [_jsx("div", { className: "o-links-editor-label", children: addWords }), _jsxs(FieldRows, { look: ADDS, className: "o-links-editor-adds", role: "list", "aria-label": addWords, children: [rest.map((r) => (_jsxs(FieldRow, { as: "button", className: "o-links-editor-add", "data-record": r.value, role: "listitem", "aria-label": w.linkName(r.label), onClick: () => link(r.value), children: [_jsx(Face, { record: r, size: 40 }), _jsx("span", { className: "o-links-editor-add-name", children: r.label }), glyph(PLUS, "o-links-editor-add-mark")] }, r.value))), actions.map((a) => (_jsxs(FieldRow, { as: "button", className: "o-links-editor-add o-links-editor-action", role: "listitem", onClick: a.onSelect, children: [a.icon != null && _jsx("span", { className: "o-links-editor-action-mark", children: a.icon }), _jsx("span", { className: "o-links-editor-add-name", children: a.label })] }, a.key)))] }), more] }), doingNote ? _jsx("div", { className: "o-links-editor-note", children: doingNote }) : _jsxs(_Fragment, { children: [!rest.length && query.trim() && !linked.length && _jsx("div", { className: "o-links-editor-note", children: w.nothingMatchesTyped(query.trim()) }), !rest.length && !query.trim() && linked.length > 0 && _jsx("div", { className: "o-links-editor-note", children: w.everythingLinked })] }), _jsx("div", { className: "o-links-editor-bar", children: _jsxs(InputGroup, { size: "lg", className: "o-links-editor-pill", children: [_jsx(InputGroupAddon, { side: "start", children: glyph(SEARCH) }), _jsx(Input, { autofill: false, ref: searchBox, className: "o-links-editor-input", placeholder: search, "aria-label": search, value: query, onValueChange: (v) => typeQuery(v) })] }) })] }) }));
|
|
239
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-links-editor", "data-slot": "vk-links", "data-kit": "links-editor", ...mark, "data-links-form": "phone", "data-links-shape": "table", "data-links-fields": several ? "several" : "one", tabIndex: -1, "data-links-step": listStep ? "list" : fieldsStep ? "fields" : undefined, style: sheetRoom ? { "--links-room": `${sheetRoom.height}px`, "--links-under": `${sheetRoom.under}px` } : undefined, children: listStep && topLink && topField ? (_jsx(StepList, { ...listOf(topLink, topField), draft: "shell", form: "phone", onDone: () => setTop(null) }, `${listStep.link}-${listStep.field}`)) : fieldsStep ? _jsxs(_Fragment, { children: [_jsxs(FieldRows, { look: FIELDS, className: "o-links-editor-fields", "data-link": fieldsStep.value, children: [fields.map((f) => f.kind === "yes-no"
|
|
240
|
+
? _jsx(FieldRow, { label: f.label, "data-slot": "vk-links-field", "data-key": f.id, "data-field": f.id, children: _jsx(Switch, { size: "lg", className: "o-links-editor-switch", "data-slot": "vk-links-control", "data-key": f.id, checked: fieldsStep.values[f.id] === true, "aria-label": w.fieldAt(f.label, fieldsName), onCheckedChange: (c) => setField(fieldsStep.value, f.id, c) }) }, f.id)
|
|
241
|
+
: _jsxs(FieldRow, { as: "button", label: f.label, className: "o-links-editor-open", "data-slot": "vk-links-field", "data-key": f.id, "data-field": f.id, "aria-label": w.fieldAt(f.label, fieldsName), onClick: () => openList(fieldsStep.value, f.id), children: [_jsx("span", { className: "o-links-editor-open-value", children: rowWords(f, fieldsStep.values[f.id]) }), glyph(MORE, "o-links-editor-open-mark")] }, f.id)), lead && _jsx(FieldRow, { label: lead.label, "data-slot": "vk-links-lead", "data-field": "lead", children: _jsx(Switch, { size: "lg", className: "o-links-editor-switch", "data-slot": "vk-links-control", "data-key": "lead", checked: lead.value === fieldsStep.value, "aria-label": w.isLead(fieldsName, lead.label), onCheckedChange: (c) => { if (c)
|
|
242
|
+
setLead(fieldsStep.value); } }) })] }), _jsx(FieldRows, { look: FIELDS, className: "o-links-editor-fields-foot", children: _jsx(FieldRow, { as: "button", className: "o-links-editor-unlink", "data-slot": "vk-links-unlink", onClick: () => { const v = fieldsStep.value; setFieldsOf(null); unlink(v); }, children: w.unlink }) })] }) : _jsxs(_Fragment, { children: [linked.length > 0 && _jsx("div", { className: "o-links-editor-cards", "data-slot": "vk-links-rows", role: "list", "aria-label": label, children: linked.map(card) }), (rest.length > 0 || actions.length > 0) && _jsxs(_Fragment, { children: [_jsx("div", { className: "o-links-editor-label", children: addWords }), _jsxs(FieldRows, { look: ADDS, className: "o-links-editor-adds", "data-slot": "vk-links-offers", role: "list", "aria-label": addWords, children: [rest.map((r) => (_jsxs(FieldRow, { as: "button", className: "o-links-editor-add", "data-slot": "vk-links-offer", "data-key": r.value, "data-record": r.value, role: "listitem", "aria-label": w.linkName(r.label), onClick: () => link(r.value), children: [_jsx(Face, { record: r, size: 40 }), _jsx("span", { className: "o-links-editor-add-name", children: r.label }), glyph(PLUS, "o-links-editor-add-mark")] }, r.value))), actions.map((a) => (_jsxs(FieldRow, { as: "button", className: "o-links-editor-add o-links-editor-action", "data-slot": "vk-links-offer-action", "data-key": a.key, role: "listitem", onClick: a.onSelect, children: [a.icon != null && _jsx("span", { className: "o-links-editor-action-mark", children: a.icon }), _jsx("span", { className: "o-links-editor-add-name", children: a.label })] }, a.key)))] }), more] }), doingNote ? _jsx("div", { className: "o-links-editor-note", "data-slot": "vk-links-note", children: doingNote }) : _jsxs(_Fragment, { children: [!rest.length && query.trim() && !linked.length && _jsx("div", { className: "o-links-editor-note", "data-slot": "vk-links-note", children: w.nothingMatchesTyped(query.trim()) }), !rest.length && !query.trim() && linked.length > 0 && _jsx("div", { className: "o-links-editor-note", "data-slot": "vk-links-note", children: w.everythingLinked })] }), _jsx("div", { className: "o-links-editor-bar", children: _jsxs(InputGroup, { size: "lg", className: "o-links-editor-pill", "data-slot": "vk-links-search", children: [_jsx(InputGroupAddon, { side: "start", children: glyph(SEARCH) }), _jsx(Input, { autofill: false, ref: searchBox, className: "o-links-editor-input", placeholder: search, "aria-label": search, value: query, onValueChange: (v) => typeQuery(v) })] }) })] }) }));
|
|
243
243
|
if (listStep && topField)
|
|
244
|
-
return { body, head: { onBack: () => setTop(null), close: false }, title: topField.label };
|
|
244
|
+
return { body, head: { onBack: () => setTop(null), backSlot: "vk-editor-back", close: false }, title: topField.label };
|
|
245
245
|
if (fieldsStep)
|
|
246
|
-
return { body, head: { onBack: () => setFieldsOf(null), close: false }, title: fieldsName };
|
|
246
|
+
return { body, head: { onBack: () => setFieldsOf(null), backSlot: "vk-editor-back", close: false }, title: fieldsName };
|
|
247
247
|
return { body, head: decide.head };
|
|
248
248
|
}
|
|
249
249
|
const stepLink = step ? links.find((l) => l.value === step) : undefined;
|
|
@@ -253,18 +253,18 @@ export function useLinksEditor(props) {
|
|
|
253
253
|
const control = (f) => {
|
|
254
254
|
const v = stepLink.values[f.id], words = w.fieldAt(f.label, name);
|
|
255
255
|
if (f.kind === "yes-no")
|
|
256
|
-
return _jsx(Switch, { size: "md", checked: v === true, "aria-label": words, onCheckedChange: (c) => setField(step, f.id, c) });
|
|
256
|
+
return _jsx(Switch, { size: "md", "data-slot": "vk-links-control", "data-key": f.id, checked: v === true, "aria-label": words, onCheckedChange: (c) => setField(step, f.id, c) });
|
|
257
257
|
if (f.kind === "several")
|
|
258
|
-
return _jsx(Select, { size: "sm", multiple: true, listWidth: "rows", items: offered(f, v), value: heldOf(v), placeholder: w.none, "aria-label": words, onValueChange: (next) => tickFrom(step, f, Array.isArray(next) ? next : []) });
|
|
259
|
-
return _jsx(Select, { size: "sm", listWidth: "rows", items: offered(f, v), value: typeof v === "string" ? v : null, placeholder: w.none, "aria-label": words, onValueChange: (next) => setField(step, f.id, typeof next === "string" ? next : null) });
|
|
258
|
+
return _jsx(Select, { size: "sm", "data-slot": "vk-links-control", "data-key": f.id, multiple: true, listWidth: "rows", items: offered(f, v), value: heldOf(v), placeholder: w.none, "aria-label": words, onValueChange: (next) => tickFrom(step, f, Array.isArray(next) ? next : []) });
|
|
259
|
+
return _jsx(Select, { size: "sm", "data-slot": "vk-links-control", "data-key": f.id, listWidth: "rows", items: offered(f, v), value: typeof v === "string" ? v : null, placeholder: w.none, "aria-label": words, onValueChange: (next) => setField(step, f.id, typeof next === "string" ? next : null) });
|
|
260
260
|
};
|
|
261
|
-
const body = (_jsxs("div", { ref: setRoot, className: "o-links-editor", "data-kit": "links-editor", ...mark, "data-links-form": "computer", "data-links-shape": "table", "data-links-fields": several ? "several" : "one", "data-links-step": "", role: "group", "aria-label": name, tabIndex: -1, onKeyDown: (e) => {
|
|
261
|
+
const body = (_jsxs("div", { ref: setRoot, className: "o-links-editor", "data-slot": "vk-links", "data-kit": "links-editor", ...mark, "data-links-form": "computer", "data-links-shape": "table", "data-links-fields": several ? "several" : "one", "data-links-step": "", role: "group", "aria-label": name, tabIndex: -1, onKeyDown: (e) => {
|
|
262
262
|
if (e.key !== "Escape" || e.target.closest?.("[aria-expanded='true']"))
|
|
263
263
|
return;
|
|
264
264
|
e.preventDefault();
|
|
265
265
|
e.stopPropagation();
|
|
266
266
|
leave();
|
|
267
|
-
}, children: [_jsxs("div", { className: "o-links-editor-step-head o-popup-line", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "2xs", className: "o-links-editor-back", "aria-label": w.backTo(label), icon: glyph(BACK), onClick: leave }), _jsx(Face, { record: record, size: 20 }), _jsx("span", { className: "o-links-editor-step-name", children: name })] }), _jsx("div", { className: "o-links-editor-fields", "data-link": step, children: fields.map((f) => (_jsxs("div", { className: "o-links-editor-field", "data-field": f.id, children: [_jsx("span", { className: "o-links-editor-field-label", children: f.label }), _jsx("span", { className: "o-links-editor-field-control", "data-kind": f.kind, children: control(f) })] }, f.id))) }), _jsx("div", { className: "o-links-editor-step-foot", children: _jsx(Button, { kind: "quiet", size: "2xs", className: "o-links-editor-unlink", onClick: () => unlink(step), children: w.unlink }) })] }));
|
|
267
|
+
}, children: [_jsxs("div", { className: "o-links-editor-step-head o-popup-line", "data-slot": "vk-links-step", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "2xs", className: "o-links-editor-back", "data-slot": "vk-links-back", "aria-label": w.backTo(label), icon: glyph(BACK), onClick: leave }), _jsx(Face, { record: record, size: 20 }), _jsx("span", { className: "o-links-editor-step-name", children: name })] }), _jsx("div", { className: "o-links-editor-fields", "data-link": step, children: fields.map((f) => (_jsxs("div", { className: "o-links-editor-field", "data-slot": "vk-links-field", "data-key": f.id, "data-field": f.id, children: [_jsx("span", { className: "o-links-editor-field-label", children: f.label }), _jsx("span", { className: "o-links-editor-field-control", "data-kind": f.kind, children: control(f) })] }, f.id))) }), _jsx("div", { className: "o-links-editor-step-foot", children: _jsx(Button, { kind: "quiet", size: "2xs", className: "o-links-editor-unlink", "data-slot": "vk-links-unlink", onClick: () => unlink(step), children: w.unlink }) })] }));
|
|
268
268
|
return { body, head: {} };
|
|
269
269
|
}
|
|
270
270
|
const keepArrows = (e) => { if (e.key.startsWith("Arrow"))
|
|
@@ -294,17 +294,17 @@ export function useLinksEditor(props) {
|
|
|
294
294
|
};
|
|
295
295
|
const short = (l, name, f) => {
|
|
296
296
|
const words = saidShort(f, l.values[f.id], w.yes), standing = shownList?.link === l.value && shownList.field === f.id;
|
|
297
|
-
const button = (_jsx(Button, { kind: "quiet", size: "2xs", className: "o-links-editor-short", "data-field": f.id, "data-none": words ? undefined : "", "aria-label": w.fieldAt(f.label, name), iconEnd: _jsx(Icon, { name: "down" }), "data-popup-open": standing ? "" : undefined, children: words || f.label }));
|
|
297
|
+
const button = (_jsx(Button, { kind: "quiet", size: "2xs", className: "o-links-editor-short", "data-slot": "vk-links-value", "data-key": f.id, "data-field": f.id, "data-none": words ? undefined : "", "aria-label": w.fieldAt(f.label, name), iconEnd: _jsx(Icon, { name: "down" }), "data-popup-open": standing ? "" : undefined, children: words || f.label }));
|
|
298
298
|
if (standing)
|
|
299
299
|
return button;
|
|
300
|
-
return (_jsx(Popover, { trigger: button, open: open?.link === l.value && open.field === f.id, onOpenChange: (o) => setOpen(o ? { link: l.value, field: f.id } : null), side: "bottom", align: "start", className: "o-links-editor-pop", "aria-label": w.fieldAt(f.label, name), ...
|
|
300
|
+
return (_jsx(Popover, { trigger: button, open: open?.link === l.value && open.field === f.id, onOpenChange: (o) => setOpen(o ? { link: l.value, field: f.id } : null), side: "bottom", align: "start", className: "o-links-editor-pop", "aria-label": w.fieldAt(f.label, name), popupData: { ...props.popupData, "data-slot": "vk-links-pop", "data-key": f.id }, children: _jsx(Picker, { ...listOf(l, f), form: "computer", onDone: () => setOpen(null) }) }));
|
|
301
301
|
};
|
|
302
|
-
const cell = (l, name, f) => (_jsx("span", { className: "o-links-editor-cell", "data-field": f.id, "data-kind": f.kind, onKeyDown: keepArrows, children: one && f.kind === "yes-no" ? _jsx(Switch, { size: "sm", checked: l.values[f.id] === true, "aria-label": w.fieldAt(f.label, name), onCheckedChange: (c) => setField(l.value, f.id, c) })
|
|
302
|
+
const cell = (l, name, f) => (_jsx("span", { className: "o-links-editor-cell", "data-slot": "vk-links-field", "data-key": f.id, "data-field": f.id, "data-kind": f.kind, onKeyDown: keepArrows, children: one && f.kind === "yes-no" ? _jsx(Switch, { size: "sm", "data-slot": "vk-links-control", "data-key": f.id, checked: l.values[f.id] === true, "aria-label": w.fieldAt(f.label, name), onCheckedChange: (c) => setField(l.value, f.id, c) })
|
|
303
303
|
: one ? short(l, name, f) : said(f, l.values[f.id], w.yes) }, f.id));
|
|
304
304
|
const row = (r) => {
|
|
305
305
|
const l = links.find((x) => x.value === r.value), name = r.label;
|
|
306
|
-
return (_jsxs("div", { className: "o-links-editor-row", "data-link": r.value, role: "group", "aria-label": name, children: [_jsxs("span", { className: "o-links-editor-who", children: [_jsx(Face, { record: r, size: 20 }), _jsx("span", { className: "o-links-editor-name", children: name })] }), fields.map((f) => cell(l, name, f)), lead && _jsx("span", { className: "o-links-editor-lead", children: _jsx(Radio, { value: r.value, "aria-label": w.isLead(name, lead.label) }) }), _jsx("span", { className: "o-links-editor-end", onKeyDown: keepArrows, children: !several ? _jsx(Button, { kind: "quiet", shape: "icon", size: "2xs", look: END_LOOK, "aria-label": w.unlinkName(name), icon: glyph(X), onClick: () => unlink(r.value) })
|
|
307
|
-
: _jsx(Button, { kind: "quiet", shape: "icon", size: "2xs", look: END_LOOK, className: "o-links-editor-config", "aria-label": w.editLink(name), icon: _jsx(Icon, { name: "settings" }), onClick: () => { setOpen(null); stepPressed.current = true; setStep(r.value); } }) })] }, r.value));
|
|
306
|
+
return (_jsxs("div", { className: "o-links-editor-row", "data-slot": "vk-links-row", "data-key": r.value, "data-link": r.value, role: "group", "aria-label": name, children: [_jsxs("span", { className: "o-links-editor-who", "data-slot": "vk-links-name", children: [_jsx(Face, { record: r, size: 20 }), _jsx("span", { className: "o-links-editor-name", children: name })] }), fields.map((f) => cell(l, name, f)), lead && _jsx("span", { className: "o-links-editor-lead", "data-slot": "vk-links-lead", children: _jsx(Radio, { value: r.value, "data-slot": "vk-links-control", "data-key": "lead", "aria-label": w.isLead(name, lead.label) }) }), _jsx("span", { className: "o-links-editor-end", onKeyDown: keepArrows, children: !several ? _jsx(Button, { kind: "quiet", shape: "icon", size: "2xs", look: END_LOOK, "aria-label": w.unlinkName(name), icon: glyph(X), "data-slot": "vk-links-remove", onClick: () => unlink(r.value) })
|
|
307
|
+
: _jsx(Button, { kind: "quiet", shape: "icon", size: "2xs", look: END_LOOK, className: "o-links-editor-config", "data-slot": "vk-links-config", "aria-label": w.editLink(name), icon: _jsx(Icon, { name: "settings" }), onClick: () => { setOpen(null); stepPressed.current = true; setStep(r.value); } }) })] }, r.value));
|
|
308
308
|
};
|
|
309
309
|
const rows = linked.map(row);
|
|
310
310
|
const message = doingNote ?? (!lights && (query.trim() ? (!linked.length ? w.nothingMatches : null) : linked.length ? w.everythingLinked : null));
|
|
@@ -314,14 +314,14 @@ export function useLinksEditor(props) {
|
|
|
314
314
|
return null;
|
|
315
315
|
return (_jsx("div", { className: "o-links-editor-shown o-list o-smooth o-smooth-ease", "data-links-shown": "list", ...phoneMark(small), style: shownAt ? { top: shownAt.top, left: shownAt.left } : { visibility: "hidden" }, children: _jsx(Picker, { ...listOf(l, f), form: "computer", standing: true }) }));
|
|
316
316
|
})() : null;
|
|
317
|
-
const body = (_jsxs("div", { ref: setRoot, className: "o-links-editor", "data-kit": "links-editor", ...mark, "data-links-form": "computer", "data-links-shape": "table", "data-links-fields": several ? "several" : "one", role: "group", "aria-label": label, tabIndex: -1, style: room ? { paddingBottom: room } : undefined, children: [_jsxs("div", { className: "o-links-editor-search o-popup-line", children: [glyph(SEARCH), _jsx(Input, { chrome: "bare", autofill: false, ref: searchBox, className: "o-links-editor-input", placeholder: search, "aria-label": search, role: "combobox", "aria-expanded": lights > 0, "aria-autocomplete": "list", "aria-controls": lights ? `${ids}-add` : undefined, "aria-activedescendant": litAt != null ? `${ids}-add-${litAt}` : undefined, value: query, onValueChange: (v) => { typeQuery(v); setLit(v.trim() ? 0 : null); }, onKeyDown: keys })] }), _jsxs("div", { ref: placeList, className: "o-links-editor-list", "data-head": linked.length ? "" : undefined, "data-held": open ? "" : undefined, children: [linked.length > 0 && _jsxs(_Fragment, { children: [_jsxs("div", { className: "o-links-editor-head", "aria-hidden": "true", children: [_jsx("span", { className: "o-links-editor-who", children: kind }), fields.map((f) => _jsx("span", { className: "o-links-editor-cell", "data-field": f.id, "data-kind": f.kind, children: f.label }, f.id)), lead && _jsx("span", { className: "o-links-editor-lead", children: lead.label }), _jsx("span", { className: "o-links-editor-end" })] }), lead
|
|
318
|
-
? _jsx(RadioGroup, { className: "o-links-editor-rows", "aria-label": lead.label, value: lead.value, onValueChange: (v) => setLead(v), children: rows })
|
|
319
|
-
: _jsx("div", { className: "o-links-editor-rows", children: rows })] }), linked.length > 0 && lights > 0 && _jsx("div", { className: "o-list-sep", role: "presentation" }), lights > 0 && _jsxs("div", { id: `${ids}-add`, role: "listbox", "aria-label": w.addTo(label), className: "o-links-editor-adds", onPointerLeave: () => setLit(query.trim() ? 0 : null), children: [linked.length > 0 && _jsx("div", { className: "o-list-heading", "aria-hidden": "true", children: w.add }), rest.map((r, i) => (_jsxs("div", { id: `${ids}-add-${i}`, role: "option", "aria-selected": i === litAt, className: "o-list-row o-smooth o-smooth-ease o-links-editor-add", "data-record": r.value, ...phoneMark(small), "data-highlighted": i === litAt ? "" : undefined, onPointerMove: () => { if (!open && doing !== "searching" && i !== litAt)
|
|
317
|
+
const body = (_jsxs("div", { ref: setRoot, className: "o-links-editor", "data-slot": "vk-links", "data-kit": "links-editor", ...mark, "data-links-form": "computer", "data-links-shape": "table", "data-links-fields": several ? "several" : "one", role: "group", "aria-label": label, tabIndex: -1, style: room ? { paddingBottom: room } : undefined, children: [_jsxs("div", { className: "o-links-editor-search o-popup-line", "data-slot": "vk-links-search", children: [glyph(SEARCH), _jsx(Input, { chrome: "bare", autofill: false, ref: searchBox, className: "o-links-editor-input", placeholder: search, "aria-label": search, role: "combobox", "aria-expanded": lights > 0, "aria-autocomplete": "list", "aria-controls": lights ? `${ids}-add` : undefined, "aria-activedescendant": litAt != null ? `${ids}-add-${litAt}` : undefined, value: query, onValueChange: (v) => { typeQuery(v); setLit(v.trim() ? 0 : null); }, onKeyDown: keys })] }), _jsxs("div", { ref: placeList, className: "o-links-editor-list", "data-slot": "vk-links-list", "data-head": linked.length ? "" : undefined, "data-held": open ? "" : undefined, children: [linked.length > 0 && _jsxs(_Fragment, { children: [_jsxs("div", { className: "o-links-editor-head", "data-slot": "vk-links-head", "aria-hidden": "true", children: [_jsx("span", { className: "o-links-editor-who", "data-slot": "vk-links-name", children: kind }), fields.map((f) => _jsx("span", { className: "o-links-editor-cell", "data-slot": "vk-links-field", "data-key": f.id, "data-field": f.id, "data-kind": f.kind, children: f.label }, f.id)), lead && _jsx("span", { className: "o-links-editor-lead", "data-slot": "vk-links-lead", children: lead.label }), _jsx("span", { className: "o-links-editor-end" })] }), lead
|
|
318
|
+
? _jsx(RadioGroup, { className: "o-links-editor-rows", "data-slot": "vk-links-rows", "aria-label": lead.label, value: lead.value, onValueChange: (v) => setLead(v), children: rows })
|
|
319
|
+
: _jsx("div", { className: "o-links-editor-rows", "data-slot": "vk-links-rows", children: rows })] }), linked.length > 0 && lights > 0 && _jsx("div", { className: "o-list-sep", role: "presentation" }), lights > 0 && _jsxs("div", { id: `${ids}-add`, role: "listbox", "aria-label": w.addTo(label), className: "o-links-editor-adds", "data-slot": "vk-links-offers", onPointerLeave: () => setLit(query.trim() ? 0 : null), children: [linked.length > 0 && _jsx("div", { className: "o-list-heading", "aria-hidden": "true", children: w.add }), rest.map((r, i) => (_jsxs("div", { id: `${ids}-add-${i}`, role: "option", "aria-selected": i === litAt, className: "o-list-row o-smooth o-smooth-ease o-links-editor-add", "data-slot": "vk-links-offer", "data-key": r.value, "data-record": r.value, ...phoneMark(small), "data-highlighted": i === litAt ? "" : undefined, onPointerMove: () => { if (!open && doing !== "searching" && i !== litAt)
|
|
320
320
|
setLit(i); }, onMouseDown: (e) => e.preventDefault(), onClick: () => link(r.value), children: [_jsx(Face, { record: r, size: 20 }), _jsx("span", { className: "o-list-text", children: _jsx("span", { className: "o-list-main", children: r.label }) })] }, r.value))), actions.map((a, j) => {
|
|
321
321
|
const i = rest.length + j;
|
|
322
|
-
return (_jsxs("div", { id: `${ids}-add-${i}`, role: "option", "aria-selected": i === litAt, className: "o-list-row o-smooth o-smooth-ease o-links-editor-add o-links-editor-action", ...phoneMark(small), "data-highlighted": i === litAt ? "" : undefined, onPointerMove: () => { if (!open && doing !== "searching" && i !== litAt)
|
|
322
|
+
return (_jsxs("div", { id: `${ids}-add-${i}`, role: "option", "aria-selected": i === litAt, className: "o-list-row o-smooth o-smooth-ease o-links-editor-add o-links-editor-action", "data-slot": "vk-links-offer-action", "data-key": a.key, ...phoneMark(small), "data-highlighted": i === litAt ? "" : undefined, onPointerMove: () => { if (!open && doing !== "searching" && i !== litAt)
|
|
323
323
|
setLit(i); }, onMouseDown: (e) => e.preventDefault(), onClick: a.onSelect, children: [a.icon != null && _jsx("span", { className: "o-links-editor-action-mark", children: a.icon }), _jsx("span", { className: "o-list-text", children: _jsx("span", { className: "o-list-main", children: a.label }) })] }, a.key));
|
|
324
|
-
})] }), more, message && _jsx("div", { className: "o-links-editor-message", children: message })] }), shown] }));
|
|
324
|
+
})] }), more, message && _jsx("div", { className: "o-links-editor-message", "data-slot": "vk-links-note", children: message })] }), shown] }));
|
|
325
325
|
return { body, head: {} };
|
|
326
326
|
}
|
|
327
327
|
export function LinksEditor(props) {
|
|
@@ -5,7 +5,7 @@ import type { MenuEntry } from "../menu-list/menu-list.js";
|
|
|
5
5
|
* its row is a level in, its choices when its rows are ticks that close, its actions otherwise; a group in place is its rows
|
|
6
6
|
* under its heading, a pick when they are ticks that close; a link and an action as they are. A row's detail, its value in
|
|
7
7
|
* words, rides to a level's end and a choice's. Nothing here closes the menu: the Menu's rows close it as ViewKit's do. */
|
|
8
|
-
export declare function menuEntries(items: ViewsMenuItem[], notNow?: string): MenuEntry[];
|
|
8
|
+
export declare function menuEntries(items: ViewsMenuItem[], notNow?: string, rowSlot?: string): MenuEntry[];
|
|
9
9
|
/** ViewKit's menu, drawn as the Menu at its anchor with no trigger. Every menu ViewKit opens names itself; centred or unsaid,
|
|
10
10
|
* it opens at its anchor's start. */
|
|
11
|
-
export declare function MapMenu({ open, onOpenChange, anchor, items, side, align, label }: ViewsMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function MapMenu({ open, onOpenChange, anchor, items, side, align, label, "data-slot": slot }: ViewsMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,17 +4,19 @@ import { resolveViewsMessage } from "../../contract.js";
|
|
|
4
4
|
import { ViewsContext } from "../../provider/context.js";
|
|
5
5
|
import { menuWordsOf } from "../picker/map-picker.js";
|
|
6
6
|
import { Menu } from "./menu.js";
|
|
7
|
+
import { markOwnControl } from "../../provider/own-control.js";
|
|
7
8
|
const NO_REASON = "Not now";
|
|
8
9
|
const closingTick = (item) => item.checked !== undefined && !item.keepOpen && !item.children && !item.href && !item.disabled;
|
|
9
|
-
function choiceOf(run) {
|
|
10
|
+
function choiceOf(run, rowSlot) {
|
|
10
11
|
return {
|
|
11
12
|
value: run.find((i) => i.checked)?.key ?? "",
|
|
12
|
-
choices: run.map((i) => ({ value: i.key, label: i.label, mark: i.icon, ...(i.detail != null && { detail: i.detail }) })),
|
|
13
|
+
choices: run.map((i) => ({ value: i.key, label: i.label, mark: i.icon, ...(i.detail != null && { detail: i.detail }), ...named(rowSlot, i.key, i.slot) })),
|
|
13
14
|
onChoose: (key) => run.find((i) => i.key === key)?.onSelect?.(),
|
|
14
15
|
};
|
|
15
16
|
}
|
|
17
|
+
const named = (rowSlot, key, own) => (own ? { slot: { slot: own, key } } : rowSlot ? { slot: { slot: rowSlot, key } } : {});
|
|
16
18
|
const onlyTicks = (items) => (items.length > 0 && items.every(closingTick) && !items.slice(1).some((i) => i.separatorBefore) ? items : null);
|
|
17
|
-
export function menuEntries(items, notNow = NO_REASON) {
|
|
19
|
+
export function menuEntries(items, notNow = NO_REASON, rowSlot) {
|
|
18
20
|
const out = [];
|
|
19
21
|
for (let at = 0; at < items.length;) {
|
|
20
22
|
const item = items[at];
|
|
@@ -24,7 +26,7 @@ export function menuEntries(items, notNow = NO_REASON) {
|
|
|
24
26
|
const run = [item];
|
|
25
27
|
while (at + run.length < items.length && closingTick(items[at + run.length]) && !items[at + run.length].separatorBefore)
|
|
26
28
|
run.push(items[at + run.length]);
|
|
27
|
-
out.push({ kind: "pick", ...choiceOf(run) });
|
|
29
|
+
out.push({ kind: "pick", ...choiceOf(run, rowSlot) });
|
|
28
30
|
at += run.length;
|
|
29
31
|
continue;
|
|
30
32
|
}
|
|
@@ -32,22 +34,23 @@ export function menuEntries(items, notNow = NO_REASON) {
|
|
|
32
34
|
const ticks = item.children ? onlyTicks(item.children) : null;
|
|
33
35
|
if (item.children && item.beside)
|
|
34
36
|
out.push(ticks
|
|
35
|
-
? { kind: "choices", icon: item.icon ?? null, label: item.label, ...choiceOf(ticks), ...(item.detail != null && { detail: item.detail }) }
|
|
36
|
-
: { kind: "actions", icon: item.icon ?? null, label: item.label, entries: menuEntries(item.children, notNow), ...(item.detail != null && { detail: item.detail }) });
|
|
37
|
+
? { kind: "choices", icon: item.icon ?? null, label: item.label, ...choiceOf(ticks, rowSlot), ...(item.detail != null && { detail: item.detail }), ...named(rowSlot, item.key, item.slot) }
|
|
38
|
+
: { kind: "actions", icon: item.icon ?? null, label: item.label, entries: menuEntries(item.children, notNow, rowSlot), ...(item.detail != null && { detail: item.detail }), ...named(rowSlot, item.key, item.slot) });
|
|
37
39
|
else if (item.children)
|
|
38
|
-
out.push(ticks ? { kind: "pick", heading: item.label, ...choiceOf(ticks) } : { kind: "group", heading: item.label, entries: menuEntries(item.children, notNow) });
|
|
40
|
+
out.push(ticks ? { kind: "pick", heading: item.label, ...choiceOf(ticks, rowSlot) } : { kind: "group", heading: item.label, entries: menuEntries(item.children, notNow, rowSlot) });
|
|
39
41
|
else if (item.checked !== undefined)
|
|
40
|
-
out.push({ kind: "check", label: item.label, ...(item.icon != null && { icon: item.icon }), checked: item.checked, onCheckedChange: () => item.onSelect?.(), disabled: item.disabled ? item.disabledReason ?? notNow : undefined });
|
|
42
|
+
out.push({ kind: "check", label: item.label, ...(item.icon != null && { icon: item.icon }), checked: item.checked, onCheckedChange: () => item.onSelect?.(), disabled: item.disabled ? item.disabledReason ?? notNow : undefined, ...named(rowSlot, item.key, item.slot) });
|
|
41
43
|
else if (item.href)
|
|
42
|
-
out.push({ kind: "link", icon: item.icon ?? null, label: item.label, href: item.href, onSelect: () => item.onSelect?.() });
|
|
44
|
+
out.push({ kind: "link", icon: item.icon ?? null, label: item.label, href: item.href, onSelect: () => item.onSelect?.(), ...named(rowSlot, item.key, item.slot) });
|
|
43
45
|
else
|
|
44
46
|
out.push({ icon: item.icon ?? null, label: item.label, onSelect: item.onSelect, danger: item.destructive, disabled: item.disabled ? item.disabledReason ?? notNow : undefined,
|
|
45
|
-
keys: item.shortcut ? [item.shortcut] : undefined, ...(item.render && { body: item.render() }) });
|
|
47
|
+
keys: item.shortcut ? [item.shortcut] : undefined, ...(item.render && { body: item.render() }), ...named(rowSlot, item.key, item.slot) });
|
|
46
48
|
}
|
|
47
49
|
return out;
|
|
48
50
|
}
|
|
49
|
-
export function MapMenu({ open, onOpenChange, anchor, items, side, align, label }) {
|
|
51
|
+
export function MapMenu({ open, onOpenChange, anchor, items, side, align, label, "data-slot": slot }) {
|
|
50
52
|
const say = React.useContext(ViewsContext)?.messages ?? resolveViewsMessage;
|
|
51
53
|
const words = React.useMemo(() => menuWordsOf(say), [say]);
|
|
52
|
-
return _jsx(Menu, { words: words, entries: menuEntries(items, say({ key: "views.menus.not-now" })), label: label ?? "", open: open, onOpenChange: (next, d) => onOpenChange(next, { reason: d.reason }), anchor: anchor, side: side, align: align === "center" || align === undefined ? "start" : align });
|
|
54
|
+
return _jsx(Menu, { words: words, entries: menuEntries(items, say({ key: "views.menus.not-now" }), slot ? `${slot}-row` : undefined), "data-slot": slot, label: label ?? "", open: open, onOpenChange: (next, d) => onOpenChange(next, { reason: d.reason }), anchor: anchor, side: side, align: align === "center" || align === undefined ? "start" : align });
|
|
53
55
|
}
|
|
56
|
+
markOwnControl(MapMenu);
|
|
@@ -17,6 +17,8 @@ export interface MenuProps {
|
|
|
17
17
|
words?: MenuWords;
|
|
18
18
|
/** What the menu is for, to screen readers ("Acme Robotics — service portal redesign"). */
|
|
19
19
|
label: string;
|
|
20
|
+
/** Its public name where a panel names it (VK-988: `vk-view-menu`), on its popup on a computer. */
|
|
21
|
+
"data-slot"?: string;
|
|
20
22
|
/** What opens it: the ⋯ button by default (MenuDots), named "Actions for <label>". */
|
|
21
23
|
trigger?: React.ReactElement;
|
|
22
24
|
/** Where it opens when nothing of its own opens it: an element, a ref to one, or a point on the page (a right-click's),
|
|
@@ -44,7 +44,7 @@ function levelOf(entries, label) {
|
|
|
44
44
|
}
|
|
45
45
|
return undefined;
|
|
46
46
|
}
|
|
47
|
-
const pickerItems = (choices) => choices.map((c) => ({ value: c.value, label: c.label, line: c.detail, as: c.mark ? { mark: c.mark } : undefined }));
|
|
47
|
+
const pickerItems = (choices) => choices.map((c) => ({ value: c.value, label: c.label, line: c.detail, as: c.mark ? { mark: c.mark } : undefined, ...(c.slot ? { slot: c.slot } : {}) }));
|
|
48
48
|
const NO_WORDS = {};
|
|
49
49
|
const MenuWordsContext = React.createContext(NO_WORDS);
|
|
50
50
|
function LevelPicker({ entry }) {
|
|
@@ -84,10 +84,10 @@ export function Menu(props) {
|
|
|
84
84
|
return useSheetMenus() && !props.popup ? _jsx(MenuSheet, { ...props }) : _jsx(MenuPopup, { ...props });
|
|
85
85
|
}
|
|
86
86
|
export const useSheetMenus = () => { const phone = usePhone(), screen = React.useContext(PhoneHost); return phone || !!screen; };
|
|
87
|
-
function MenuPopup({ entries, label, trigger, anchor, align = "end", side, open, defaultOpen, onOpenChange, finalFocus, standing }) {
|
|
87
|
+
function MenuPopup({ entries, label, trigger, anchor, align = "end", side, open, defaultOpen, onOpenChange, finalFocus, standing, "data-slot": slot }) {
|
|
88
88
|
const { ref, host } = usePickHost(), anchored = anchor !== undefined, point = !!anchor && !isElement(anchor) && !("current" in anchor);
|
|
89
89
|
const [at, setAt] = React.useState(null), mark = phoneMark(usePhoneForm());
|
|
90
|
-
return (_jsxs(BaseMenu.Root, { open: open, defaultOpen: defaultOpen, modal: !standing, onOpenChange: onOpenChange ? (o, d) => onOpenChange(o, { reason: closeReasonOf(d.reason) }) : undefined, children: [_jsx("span", { ref: ref, hidden: true }), !anchored && _jsx(BaseMenu.Trigger, { render: trigger ?? _jsx(MenuDots, { label: `Actions for ${label}` }) }), _jsx(BaseMenu.Portal, { container: host, className: "o-menu-portal", children: _jsx(BaseMenu.Positioner, { ref: setAt, className: "o-list-positioner", sideOffset: point ? 0 : spacingPx(1, at ?? host), side: side, align: align, collisionPadding: spacingPx(2, at ?? host), anchor: anchored ? positionerAnchor(anchor) : undefined, children: _jsx(BaseMenu.Popup, { className: "o-list o-menu o-smooth o-smooth-ease", "aria-label": label, "data-kit": "menu", ...mark, finalFocus: finalFocus, children: _jsx(MenuScroll, { children: _jsx(MenuListRows, { entries: entries, host: host }) }) }) }) })] }));
|
|
90
|
+
return (_jsxs(BaseMenu.Root, { open: open, defaultOpen: defaultOpen, modal: !standing, onOpenChange: onOpenChange ? (o, d) => onOpenChange(o, { reason: closeReasonOf(d.reason) }) : undefined, children: [_jsx("span", { ref: ref, hidden: true }), !anchored && _jsx(BaseMenu.Trigger, { render: trigger ?? _jsx(MenuDots, { label: `Actions for ${label}` }) }), _jsx(BaseMenu.Portal, { container: host, className: "o-menu-portal", children: _jsx(BaseMenu.Positioner, { ref: setAt, className: "o-list-positioner", sideOffset: point ? 0 : spacingPx(1, at ?? host), side: side, align: align, collisionPadding: spacingPx(2, at ?? host), anchor: anchored ? positionerAnchor(anchor) : undefined, children: _jsx(BaseMenu.Popup, { className: "o-list o-menu o-smooth o-smooth-ease", "aria-label": label, "data-slot": slot, "data-kit": "menu", ...mark, finalFocus: finalFocus, children: _jsx(MenuScroll, { children: _jsx(MenuListRows, { entries: entries, host: host }) }) }) }) })] }));
|
|
91
91
|
}
|
|
92
92
|
export function ContextMenu(props) {
|
|
93
93
|
return useSheetMenus() ? _jsx(ContextMenuSheet, { ...props }) : _jsx(ContextMenuPopup, { ...props });
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { type PartSlot } from "../internal/part-slot.js";
|
|
2
3
|
import { type MenuListLookOptionId } from "./looks.js";
|
|
3
4
|
/** A choice: its value, its name, and its mark (a stage's glyph, a person's face, an icon). */
|
|
4
5
|
export interface MenuChoice {
|
|
5
6
|
value: string;
|
|
6
7
|
label: string;
|
|
7
8
|
mark?: React.ReactNode;
|
|
9
|
+
/** Its public name and which one it is (VK-988): drawn on its row as `data-slot` and `data-key`. */
|
|
10
|
+
slot?: PartSlot;
|
|
8
11
|
/** What it reads as, in words, quiet at its end before its tick: a date style's sample ("14/11/2026"). */
|
|
9
12
|
detail?: string;
|
|
10
13
|
}
|
|
11
14
|
/** A row of the menu, in the order it shows: what's done most first, related rows between lines, the one
|
|
12
|
-
* that takes something away last.
|
|
13
|
-
|
|
15
|
+
* that takes something away last. `slot`, its public name and which one it is (VK-988), drawn on its row in every form as
|
|
16
|
+
* `data-slot`, `data-key` and `data-index`; a `pick` or a `group` names its rows through its choices or its entries. */
|
|
17
|
+
export type MenuEntry = ({
|
|
18
|
+
slot?: PartSlot;
|
|
19
|
+
} & (
|
|
14
20
|
/** An action: its icon and name, its keys when a shortcut works (["⌘", "L"]); `danger` when it takes
|
|
15
21
|
* something away; `disabled` says why it can't be used, as its tooltip. A name that opens something
|
|
16
22
|
* else before it acts ends in "…". */
|
|
@@ -88,7 +94,7 @@ MenuAction
|
|
|
88
94
|
kind: "group";
|
|
89
95
|
heading: string;
|
|
90
96
|
entries: MenuEntry[];
|
|
91
|
-
} | {
|
|
97
|
+
})) | {
|
|
92
98
|
kind: "separator";
|
|
93
99
|
};
|
|
94
100
|
type MenuAction = {
|
|
@@ -192,15 +198,19 @@ export interface MenuListTile {
|
|
|
192
198
|
label: string;
|
|
193
199
|
disabled?: boolean;
|
|
194
200
|
onSelect?: () => void;
|
|
201
|
+
slot?: PartSlot;
|
|
195
202
|
}
|
|
196
203
|
/** A name and its value, as one row standing alone: the choices row with no arrow and no list round it, at the list's own
|
|
197
204
|
* height and inset (menu-list.css), which what holds it may set (`--menu-list-row`, `--menu-list-inset`). Pressing it is its
|
|
198
205
|
* holder's: the Date editor's time row on a phone opens the time's wheels. */
|
|
199
|
-
export declare function MenuListRow({ label, value, onSelect, className }: {
|
|
206
|
+
export declare function MenuListRow({ label, value, onSelect, className, ...part }: {
|
|
200
207
|
label: string;
|
|
201
208
|
value: React.ReactNode;
|
|
202
209
|
onSelect?: () => void;
|
|
203
210
|
className?: string;
|
|
211
|
+
/** Its public name and which one it is (VK-989): a field editor's row (the date's time on a phone). */
|
|
212
|
+
"data-slot"?: string;
|
|
213
|
+
"data-key"?: string;
|
|
204
214
|
}): import("react/jsx-runtime").JSX.Element;
|
|
205
215
|
export interface MenuListProps {
|
|
206
216
|
/** What it acts on, to a screen reader. */
|
|
@@ -7,6 +7,7 @@ import { CheckboxMark } from "../checkbox/checkbox.js";
|
|
|
7
7
|
import { GRIP, Grip } from "../grip/grip.js";
|
|
8
8
|
import { useHoldDrag } from "../internal/hold.js";
|
|
9
9
|
import { Icon, iconPaths } from "../internal/icons.js";
|
|
10
|
+
import { partAttrs } from "../internal/part-slot.js";
|
|
10
11
|
import { phoneMark, usePhoneForm } from "../internal/phone.js";
|
|
11
12
|
import { msOf, pxOf, spacingPx } from "../internal/read-token.js";
|
|
12
13
|
import { useReorder } from "../internal/reorder.js";
|
|
@@ -75,7 +76,7 @@ function Says({ id, how, said }) {
|
|
|
75
76
|
const choiceBody = (c) => _jsxs(_Fragment, { children: [c.mark, _jsx("span", { className: "o-menu-name", children: c.label }), c.detail != null && _jsx("span", { className: "o-menu-detail", children: c.detail }), strokeGlyph(TICK, "o-list-tick", 2.25)] });
|
|
76
77
|
const rowClass = (e) => cx("o-list-row o-smooth o-smooth-ease o-menu-row", e.danger && "o-menu-danger");
|
|
77
78
|
export const MenuScroll = ({ children }) => _jsxs(_Fragment, { children: [_jsx("div", { className: "o-menu-list-scroll", children: children }), _jsx(Scrollbar, {})] });
|
|
78
|
-
function Sub({ trigger, host, children }) {
|
|
79
|
+
function Sub({ trigger, host, slot, children }) {
|
|
79
80
|
const row = React.useRef(null), mark = phoneMark(usePhoneForm());
|
|
80
81
|
const [at, setAt] = React.useState({ delay: 0, step: 0, edge: 0 });
|
|
81
82
|
React.useLayoutEffect(() => {
|
|
@@ -85,7 +86,7 @@ function Sub({ trigger, host, children }) {
|
|
|
85
86
|
if (el)
|
|
86
87
|
setAt({ delay: msOf(el, "--menu-sub-wait"), step: Number.isNaN(pad) ? spacingPx(1, el) : pad, edge: pxOf(el, "--vk-border-width") });
|
|
87
88
|
}, []);
|
|
88
|
-
return (_jsxs(BaseMenu.SubmenuRoot, { children: [_jsx(BaseMenu.SubmenuTrigger, { ref: row, delay: at.delay, className: "o-list-row o-smooth o-smooth-ease o-menu-row", children: trigger }), _jsx(BaseMenu.Portal, { container: host, className: "o-menu-portal", children: _jsx(BaseMenu.Positioner, { className: "o-list-positioner", side: "right", align: "start", sideOffset: at.step, alignOffset: -(at.step + at.edge), children: _jsx(BaseMenu.Popup, { className: "o-list o-menu o-smooth o-smooth-ease", "data-kit": "menu", ...mark, children: _jsx(MenuScroll, { children: children }) }) }) })] }));
|
|
89
|
+
return (_jsxs(BaseMenu.SubmenuRoot, { children: [_jsx(BaseMenu.SubmenuTrigger, { ref: row, delay: at.delay, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...partAttrs(slot), children: trigger }), _jsx(BaseMenu.Portal, { container: host, className: "o-menu-portal", children: _jsx(BaseMenu.Positioner, { className: "o-list-positioner", side: "right", align: "start", sideOffset: at.step, alignOffset: -(at.step + at.edge), children: _jsx(BaseMenu.Popup, { className: "o-list o-menu o-smooth o-smooth-ease", "data-kit": "menu", ...mark, children: _jsx(MenuScroll, { children: children }) }) }) })] }));
|
|
89
90
|
}
|
|
90
91
|
export function MenuListRows({ entries, host }) {
|
|
91
92
|
return _jsx(_Fragment, { children: entries.map((e, i) => {
|
|
@@ -94,22 +95,22 @@ export function MenuListRows({ entries, host }) {
|
|
|
94
95
|
if (e.kind === "group")
|
|
95
96
|
return (_jsxs(BaseMenu.Group, { children: [_jsx(BaseMenu.GroupLabel, { className: "o-list-heading", children: e.heading }), _jsx(MenuListRows, { entries: e.entries, host: host })] }, i));
|
|
96
97
|
if (e.kind === "check")
|
|
97
|
-
return (_jsx(BaseMenu.CheckboxItem, { label: e.label, checked: e.checked, defaultChecked: e.defaultChecked, onCheckedChange: (c) => e.onCheckedChange?.(c), disabled: !!e.disabled, title: e.disabled, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-check", children: checkBody(e) }, i));
|
|
98
|
+
return (_jsx(BaseMenu.CheckboxItem, { label: e.label, checked: e.checked, defaultChecked: e.defaultChecked, onCheckedChange: (c) => e.onCheckedChange?.(c), disabled: !!e.disabled, title: e.disabled, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-check", ...partAttrs(e.slot), children: checkBody(e) }, i));
|
|
98
99
|
if (e.kind === "link")
|
|
99
|
-
return (_jsx(BaseMenu.LinkItem, { href: e.href, render: e.render, label: e.label, onClick: e.onSelect, closeOnClick: true, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...(e.external ? { target: "_blank", rel: "noreferrer" } : {}), children: linkBody(e) }, i));
|
|
100
|
+
return (_jsx(BaseMenu.LinkItem, { href: e.href, render: e.render, label: e.label, onClick: e.onSelect, closeOnClick: true, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...partAttrs(e.slot), ...(e.external ? { target: "_blank", rel: "noreferrer" } : {}), children: linkBody(e) }, i));
|
|
100
101
|
if (e.kind === "actions")
|
|
101
|
-
return _jsx(Sub, { trigger: actionsBody(e), host: host, children: _jsx(MenuListRows, { entries: e.entries, host: host }) }, i);
|
|
102
|
+
return _jsx(Sub, { trigger: actionsBody(e), host: host, slot: e.slot, children: _jsx(MenuListRows, { entries: e.entries, host: host }) }, i);
|
|
102
103
|
if (e.kind === "pick")
|
|
103
|
-
return (_jsxs(BaseMenu.Group, { children: [e.heading && _jsx(BaseMenu.GroupLabel, { className: "o-list-heading", children: e.heading }), _jsx(BaseMenu.RadioGroup, { value: e.value, onValueChange: (v) => e.onChoose?.(v), children: e.choices.map((c) => _jsx(BaseMenu.RadioItem, { value: c.value, closeOnClick: true, className: "o-list-row o-smooth o-smooth-ease o-menu-row", children: choiceBody(c) }, c.value)) })] }, i));
|
|
104
|
+
return (_jsxs(BaseMenu.Group, { children: [e.heading && _jsx(BaseMenu.GroupLabel, { className: "o-list-heading", children: e.heading }), _jsx(BaseMenu.RadioGroup, { value: e.value, onValueChange: (v) => e.onChoose?.(v), children: e.choices.map((c) => _jsx(BaseMenu.RadioItem, { value: c.value, closeOnClick: true, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...partAttrs(c.slot), children: choiceBody(c) }, c.value)) })] }, i));
|
|
104
105
|
if (e.kind === "choices")
|
|
105
|
-
return (_jsx(Sub, { trigger: choicesBody(e), host: host, children: _jsx(BaseMenu.RadioGroup, { value: e.value, onValueChange: (v) => e.onChoose?.(v), children: e.choices.map((c) => _jsx(BaseMenu.RadioItem, { value: c.value, label: c.label, closeOnClick: true, className: "o-list-row o-smooth o-smooth-ease o-menu-row", children: choiceBody(c) }, c.value)) }) }, i));
|
|
106
|
-
return _jsx(BaseMenu.Item, { label: e.label, "aria-label": e.body !== undefined ? e.label : undefined, className: rowClass(e), disabled: !!e.disabled, title: e.disabled, onClick: e.onSelect, children: actionBody(e) }, i);
|
|
106
|
+
return (_jsx(Sub, { trigger: choicesBody(e), host: host, slot: e.slot, children: _jsx(BaseMenu.RadioGroup, { value: e.value, onValueChange: (v) => e.onChoose?.(v), children: e.choices.map((c) => _jsx(BaseMenu.RadioItem, { value: c.value, label: c.label, closeOnClick: true, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...partAttrs(c.slot), children: choiceBody(c) }, c.value)) }) }, i));
|
|
107
|
+
return _jsx(BaseMenu.Item, { label: e.label, "aria-label": e.body !== undefined ? e.label : undefined, className: rowClass(e), disabled: !!e.disabled, title: e.disabled, onClick: e.onSelect, ...partAttrs(e.slot), children: actionBody(e) }, i);
|
|
107
108
|
}) });
|
|
108
109
|
}
|
|
109
110
|
export function MenuListShown({ entries, label, open, on = [], className }) {
|
|
110
111
|
const lit = (name) => (on.includes(name) ? { "data-force": "hover" } : {}), mark = phoneMark(usePhoneForm());
|
|
111
112
|
const panel = (rows, cls = "") => _jsx("div", { className: cx("o-list o-menu o-smooth o-smooth-ease", cls), role: "menu", "aria-label": label, "data-kit": "menu", ...mark, children: rows });
|
|
112
|
-
const choiceRows = (e, prefix = "") => e.choices.map((c) => (_jsx("div", { role: "menuitemradio", "aria-checked": c.value === e.value, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...lit(prefix + c.label), children: choiceBody(c) }, c.value)));
|
|
113
|
+
const choiceRows = (e, prefix = "") => e.choices.map((c) => (_jsx("div", { role: "menuitemradio", "aria-checked": c.value === e.value, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...partAttrs(c.slot), ...lit(prefix + c.label), children: choiceBody(c) }, c.value)));
|
|
113
114
|
const rows = (list, prefix = "") => list.map((e, i) => {
|
|
114
115
|
if (e.kind === "separator")
|
|
115
116
|
return _jsx("div", { role: "separator", className: "o-list-sep" }, i);
|
|
@@ -119,13 +120,13 @@ export function MenuListShown({ entries, label, open, on = [], className }) {
|
|
|
119
120
|
return _jsxs(React.Fragment, { children: [_jsx("p", { className: "o-list-heading", children: e.heading }), rows(e.entries, prefix)] }, i);
|
|
120
121
|
if (e.kind === "check") {
|
|
121
122
|
const ticked = !!(e.checked ?? e.defaultChecked);
|
|
122
|
-
return _jsx("div", { role: "menuitemcheckbox", "aria-checked": ticked, "aria-disabled": e.disabled ? true : undefined, title: e.disabled, ...(e.disabled ? { "data-disabled": "" } : {}), className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-check", ...lit(prefix + e.label), children: checkBody(e) }, i);
|
|
123
|
+
return _jsx("div", { role: "menuitemcheckbox", "aria-checked": ticked, "aria-disabled": e.disabled ? true : undefined, title: e.disabled, ...(e.disabled ? { "data-disabled": "" } : {}), className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-check", ...partAttrs(e.slot), ...lit(prefix + e.label), children: checkBody(e) }, i);
|
|
123
124
|
}
|
|
124
125
|
if (e.kind === "link")
|
|
125
|
-
return _jsx("div", { role: "menuitem", className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...lit(prefix + e.label), children: linkBody(e) }, i);
|
|
126
|
+
return _jsx("div", { role: "menuitem", className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...partAttrs(e.slot), ...lit(prefix + e.label), children: linkBody(e) }, i);
|
|
126
127
|
if (e.kind === "choices" || e.kind === "actions")
|
|
127
|
-
return (_jsxs("div", { className: "o-menu-subwrap", children: [_jsx("div", { role: "menuitem", "aria-haspopup": "menu", "aria-expanded": open === e.label, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...(open === e.label ? { "data-popup-open": "" } : lit(prefix + e.label)), children: e.kind === "choices" ? choicesBody(e) : actionsBody(e) }), open === e.label && panel(e.kind === "choices" ? choiceRows(e, `${e.label}/`) : rows(e.entries, `${e.label}/`), "o-menu-sub")] }, i));
|
|
128
|
-
return _jsx("div", { role: "menuitem", "aria-disabled": e.disabled ? true : undefined, title: e.disabled, ...(e.disabled ? { "data-disabled": "" } : {}), className: rowClass(e), ...lit(prefix + e.label), children: actionBody(e) }, i);
|
|
128
|
+
return (_jsxs("div", { className: "o-menu-subwrap", children: [_jsx("div", { role: "menuitem", "aria-haspopup": "menu", "aria-expanded": open === e.label, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...partAttrs(e.slot), ...(open === e.label ? { "data-popup-open": "" } : lit(prefix + e.label)), children: e.kind === "choices" ? choicesBody(e) : actionsBody(e) }), open === e.label && panel(e.kind === "choices" ? choiceRows(e, `${e.label}/`) : rows(e.entries, `${e.label}/`), "o-menu-sub")] }, i));
|
|
129
|
+
return _jsx("div", { role: "menuitem", "aria-disabled": e.disabled ? true : undefined, title: e.disabled, ...(e.disabled ? { "data-disabled": "" } : {}), className: rowClass(e), ...partAttrs(e.slot), ...lit(prefix + e.label), children: actionBody(e) }, i);
|
|
129
130
|
});
|
|
130
131
|
const menu = panel(rows(entries), className);
|
|
131
132
|
return open ? _jsx("div", { className: "o-menu-pair", children: menu }) : menu;
|
|
@@ -236,7 +237,7 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
|
|
|
236
237
|
firstGrip.current = i;
|
|
237
238
|
return {
|
|
238
239
|
...(g >= 0 ? { "data-row": g, ...(dragging === g ? { "data-lifted": "" } : {}), style: lift(g), "aria-labelledby": named(`${ids}r${g}`), "aria-describedby": `${ids}how` } : {}),
|
|
239
|
-
"data-item": "", tabIndex: i === stop ? 0 : -1, ...(lit === i ? { "data-highlighted": "" } : {}),
|
|
240
|
+
...partAttrs(e && "slot" in e ? e.slot : undefined), "data-item": "", tabIndex: i === stop ? 0 : -1, ...(lit === i ? { "data-highlighted": "" } : {}),
|
|
240
241
|
onFocus: () => { setStop(i); setLit(i); focusIn.current = true; },
|
|
241
242
|
onPointerMove: (ev) => {
|
|
242
243
|
if (lit !== i)
|
|
@@ -275,7 +276,7 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
|
|
|
275
276
|
if (e.kind === "group")
|
|
276
277
|
return _jsxs("div", { role: "group", "aria-label": e.heading, children: [_jsx("p", { className: "o-list-heading", children: e.heading }), rows(e.entries)] }, k);
|
|
277
278
|
if (e.kind === "pick")
|
|
278
|
-
return (_jsxs("div", { role: "group", "aria-label": e.heading, children: [e.heading && _jsx("p", { className: "o-list-heading", children: e.heading }), e.choices.map((c) => _jsx("div", { role: "menuitemradio", "aria-checked": c.value === e.value, ...item(), onClick: () => e.onChoose?.(c.value), className: ROW, children: choiceBody(c) }, c.value))] }, k));
|
|
279
|
+
return (_jsxs("div", { role: "group", "aria-label": e.heading, children: [e.heading && _jsx("p", { className: "o-list-heading", children: e.heading }), e.choices.map((c) => _jsx("div", { role: "menuitemradio", "aria-checked": c.value === e.value, ...item(), ...partAttrs(c.slot), onClick: () => e.onChoose?.(c.value), className: ROW, children: choiceBody(c) }, c.value))] }, k));
|
|
279
280
|
if (e.kind === "check")
|
|
280
281
|
return _jsx(PanelCheck, { e: e, item: item(e), ticks: ticks, grip: gripFor(e), id: idOf(e), words: w, onOpen: () => onOpen?.(e) }, k);
|
|
281
282
|
if (e.kind === "link") {
|
|
@@ -295,7 +296,7 @@ export function tilesOf(entries, allRows) {
|
|
|
295
296
|
const plain = entries.filter((e) => (e.kind === undefined || e.kind === "action") && !e.danger && !e.disabled && e.count == null && e.body === undefined).slice(0, 4);
|
|
296
297
|
if (plain.length < 3)
|
|
297
298
|
return { entries };
|
|
298
|
-
return { tiles: plain.map((e) => ({ icon: e.icon, label: e.label, onSelect: e.onSelect })), entries: entries.filter((e) => !plain.includes(e)) };
|
|
299
|
+
return { tiles: plain.map((e) => ({ icon: e.icon, label: e.label, onSelect: e.onSelect, ...(e.slot ? { slot: e.slot } : {}) })), entries: entries.filter((e) => !plain.includes(e)) };
|
|
299
300
|
}
|
|
300
301
|
function sectionsOf(entries) {
|
|
301
302
|
const out = [];
|
|
@@ -314,7 +315,7 @@ function sectionsOf(entries) {
|
|
|
314
315
|
}
|
|
315
316
|
if (e.kind === "pick") {
|
|
316
317
|
end();
|
|
317
|
-
out.push({ name: e.heading, rows: e.choices.map((c) => ({ kind: "picked", label: c.label, icon: c.mark, chosen: c.value === e.value, onSelect: () => e.onChoose?.(c.value), end: c.detail })) });
|
|
318
|
+
out.push({ name: e.heading, rows: e.choices.map((c) => ({ kind: "picked", label: c.label, icon: c.mark, chosen: c.value === e.value, onSelect: () => e.onChoose?.(c.value), end: c.detail, ...(c.slot ? { slot: c.slot } : {}) })) });
|
|
318
319
|
continue;
|
|
319
320
|
}
|
|
320
321
|
now.push(e);
|
|
@@ -328,7 +329,7 @@ const endOf = (r) => {
|
|
|
328
329
|
return end != null ? _jsx("span", { className: "o-menu-list-end", "data-on": r.kind === "actions" && r.inForce ? "" : undefined, children: end }) : null;
|
|
329
330
|
};
|
|
330
331
|
function PhoneRow({ row, onOpen, move, room, ticks = "switch", words = MENU_LIST_WORDS }) {
|
|
331
|
-
const mv = move ? { "data-row": move.at, ...(move.lifted ? { "data-lifted": "" } : {}), style: move.style, ...move.drag } : {};
|
|
332
|
+
const mv = { ...partAttrs(row.slot), ...(move ? { "data-row": move.at, ...(move.lifted ? { "data-lifted": "" } : {}), style: move.style, ...move.drag } : {}) };
|
|
332
333
|
const how = move ? { "aria-describedby": move.how } : {};
|
|
333
334
|
const lead = move ? glyph(GRIP, "o-menu-list-grip") : room ? React.cloneElement(glyph(GRIP, "o-menu-list-grip"), { "data-room": "" }) : null;
|
|
334
335
|
const tickId = React.useId(), named = row.kind === "check" && row.toggle ? { label: { htmlFor: tickId }, tick: { id: tickId } } : { label: {}, tick: {} };
|
|
@@ -342,7 +343,7 @@ function PhoneRow({ row, onOpen, move, room, ticks = "switch", words = MENU_LIST
|
|
|
342
343
|
return row.render ? React.cloneElement(row.render, attrs, inside) : _jsx("a", { href: row.href, ...attrs, children: inside });
|
|
343
344
|
}
|
|
344
345
|
if (row.kind === "picked")
|
|
345
|
-
return _jsxs(BaseButton, { className: "o-menu-list-row", "aria-pressed": row.chosen, onClick: row.onSelect, children: [body(row), endOf(row), row.chosen && glyph(TICK, "o-menu-list-tick")] });
|
|
346
|
+
return _jsxs(BaseButton, { className: "o-menu-list-row", ...partAttrs(row.slot), "aria-pressed": row.chosen, onClick: row.onSelect, children: [body(row), endOf(row), row.chosen && glyph(TICK, "o-menu-list-tick")] });
|
|
346
347
|
if (row.kind === "actions")
|
|
347
348
|
return _jsxs(BaseButton, { className: "o-menu-list-row", ...mv, ...how, onClick: () => onOpen?.(row), children: [lead, body(row), endOf(row), glyph(MORE, "o-menu-list-more")] });
|
|
348
349
|
if (row.kind === "choices")
|
|
@@ -350,8 +351,8 @@ function PhoneRow({ row, onOpen, move, room, ticks = "switch", words = MENU_LIST
|
|
|
350
351
|
const own = "body" in row && row.body !== undefined ? _jsxs("span", { className: "o-menu-list-name", children: [row.body, row.disabled != null && _jsx("span", { className: "o-menu-list-note", children: row.disabled })] }) : null;
|
|
351
352
|
return _jsxs(BaseButton, { className: cx("o-menu-list-row", row.danger && "o-menu-list-danger"), ...mv, ...how, disabled: !!row.disabled, onClick: row.onSelect, "aria-label": own ? row.label : undefined, children: [lead, own ?? body(row, row.disabled), own ? null : endOf(row)] });
|
|
352
353
|
}
|
|
353
|
-
export function MenuListRow({ label, value, onSelect, className }) {
|
|
354
|
-
return _jsxs(BaseButton, { className: cx("o-menu-list-row", className), onClick: onSelect, children: [_jsx("span", { className: "o-menu-list-name", children: _jsx("span", { children: label }) }), _jsx("span", { className: "o-menu-list-value", children: value })] });
|
|
354
|
+
export function MenuListRow({ label, value, onSelect, className, ...part }) {
|
|
355
|
+
return _jsxs(BaseButton, { className: cx("o-menu-list-row", className), ...part, onClick: onSelect, children: [_jsx("span", { className: "o-menu-list-name", children: _jsx("span", { children: label }) }), _jsx("span", { className: "o-menu-list-value", children: value })] });
|
|
355
356
|
}
|
|
356
357
|
function PhoneEye({ row, lead, mv, how, onOpen }) {
|
|
357
358
|
const [own, setOwn] = React.useState(!!row.defaultChecked), on = row.checked ?? own;
|
|
@@ -370,7 +371,7 @@ export function MenuList({ label, entries, tiles, onOpen, onClose, closeWord = "
|
|
|
370
371
|
const at = gripped.indexOf(r);
|
|
371
372
|
return at < 0 ? undefined : { at, lifted: dragging === at, style: lift(at), drag: phoneDrag(at), how: `${ids}how` };
|
|
372
373
|
};
|
|
373
|
-
return (_jsxs("div", { ref: root, role: "group", "aria-label": label, className: cx("o-menu-list", className), "data-kit": "menu-list", children: [onClose && _jsx("div", { className: "o-menu-list-section", children: _jsx(PhoneRow, { row: { icon: _jsx(Icon, { name: "x", size: 22 }), label: closeWord, onSelect: onClose } }) }), tiles && (_jsx("div", { className: "o-menu-list-tiles", children: tiles.map((t) => _jsxs(BaseButton, { className: "o-menu-list-tile", disabled: t.disabled, onClick: t.onSelect, children: [_jsx("span", { className: "o-menu-list-mark", children: t.icon }), _jsx("span", { className: "o-menu-list-tile-name", children: t.label })] }, t.label)) })), sections.map((s, i) => {
|
|
374
|
+
return (_jsxs("div", { ref: root, role: "group", "aria-label": label, className: cx("o-menu-list", className), "data-kit": "menu-list", children: [onClose && _jsx("div", { className: "o-menu-list-section", children: _jsx(PhoneRow, { row: { icon: _jsx(Icon, { name: "x", size: 22 }), label: closeWord, onSelect: onClose } }) }), tiles && (_jsx("div", { className: "o-menu-list-tiles", children: tiles.map((t) => _jsxs(BaseButton, { className: "o-menu-list-tile", ...partAttrs(t.slot), disabled: t.disabled, onClick: t.onSelect, children: [_jsx("span", { className: "o-menu-list-mark", children: t.icon }), _jsx("span", { className: "o-menu-list-tile-name", children: t.label })] }, t.label)) })), sections.map((s, i) => {
|
|
374
375
|
const card = (_jsx("div", { role: s.name ? "group" : undefined, "aria-labelledby": s.name ? `${ids}h${i}` : undefined, className: "o-menu-list-section", children: s.rows.map((r) => _jsx(PhoneRow, { row: r, onOpen: onOpen, move: moveOf(r), room: gripped.length > 0, ticks: ticks, words: w }, r.label)) }, s.name ?? i));
|
|
375
376
|
return s.name ? _jsxs("div", { className: "o-menu-list-group", children: [_jsx("p", { id: `${ids}h${i}`, className: "o-list-heading", children: s.name }), card] }, `${i}${s.name}`) : card;
|
|
376
377
|
}), gripped.length > 0 && _jsx(Says, { id: `${ids}how`, how: w.howHold, said: said })] }));
|
|
@@ -41,9 +41,11 @@ export interface NoticeProps {
|
|
|
41
41
|
className?: string;
|
|
42
42
|
/** Its × drawn as under the pointer or in focus, as a page that shows it draws it. */
|
|
43
43
|
"data-force"?: "hover" | "focus";
|
|
44
|
+
/** Its public name where a panel names it (VK-988): `vk-customize-stale`, say. */
|
|
45
|
+
"data-slot"?: string;
|
|
44
46
|
/** Its own words, over the English: Retry, Retrying…, and the ×'s name. */
|
|
45
47
|
words?: Partial<NoticeWords>;
|
|
46
48
|
}
|
|
47
49
|
/** A sentence set into the page on its meaning's ground: worth knowing, done, careful, wrong or a plain fact (neutral). It can
|
|
48
50
|
* carry what to do about it, a title, or a way to put it away. */
|
|
49
|
-
export declare function Notice({ meaning, icon, title, children, actions, onRetry, dismissible, onDismiss, urgent, arrived, className, "data-force": force, words }: NoticeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
51
|
+
export declare function Notice({ meaning, icon, title, children, actions, onRetry, dismissible, onDismiss, urgent, arrived, className, "data-force": force, "data-slot": slot, words }: NoticeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -13,7 +13,7 @@ const X = ["M18 6l-12 12", "M6 6l12 12"];
|
|
|
13
13
|
const glyph = (paths, className, strokeWidth = 2) => (_jsx("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: strokeWidth, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths.map((d) => _jsx("path", { d: d }, d)) }));
|
|
14
14
|
const still = () => typeof matchMedia !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
15
15
|
export const NOTICE_WORDS = { retry: "Retry", retrying: "Retrying…", dismiss: "Dismiss" };
|
|
16
|
-
export function Notice({ meaning = "information", icon, title, children, actions = [], onRetry, dismissible, onDismiss, urgent, arrived, className, "data-force": force, words }) {
|
|
16
|
+
export function Notice({ meaning = "information", icon, title, children, actions = [], onRetry, dismissible, onDismiss, urgent, arrived, className, "data-force": force, "data-slot": slot, words }) {
|
|
17
17
|
const said = { ...NOTICE_WORDS, ...words }, phone = usePhoneForm();
|
|
18
18
|
const [phase, setPhase] = React.useState("here"), [retrying, setRetrying] = React.useState(false);
|
|
19
19
|
const away = () => { if (still()) {
|
|
@@ -28,7 +28,7 @@ export function Notice({ meaning = "information", icon, title, children, actions
|
|
|
28
28
|
return null;
|
|
29
29
|
const acts = (onRetry || actions.length > 0) && (_jsxs(_Fragment, { children: [onRetry && _jsx(Button, { kind: "text", size: "xs", "aria-busy": retrying || undefined, onClick: retry, children: retrying ? said.retrying : said.retry }), actions.map((a, i) => !React.isValidElement(a) ? _jsx(Button, { kind: "text", size: "xs", onClick: a.onClick, children: a.label }, a.label)
|
|
30
30
|
: React.cloneElement(a, { key: a.key ?? i, ...(a.type === Button ? { size: "xs" } : {}) }))] }));
|
|
31
|
-
return (_jsxs("div", { role: urgent ? "alert" : "status", "data-meaning": meaning, "data-kit": "notice", ...phoneMark(phone), className: cx("o-notice o-smooth o-smooth-ease", title != null && "o-notice-titled", arrived && "o-notice-arrived", phase === "going" && "o-notice-going", className), onTransitionEnd: (e) => { if (phase === "going" && e.target === e.currentTarget && e.propertyName === "opacity") {
|
|
31
|
+
return (_jsxs("div", { role: urgent ? "alert" : "status", "data-meaning": meaning, "data-slot": slot, "data-kit": "notice", ...phoneMark(phone), className: cx("o-notice o-smooth o-smooth-ease", title != null && "o-notice-titled", arrived && "o-notice-arrived", phase === "going" && "o-notice-going", className), onTransitionEnd: (e) => { if (phase === "going" && e.target === e.currentTarget && e.propertyName === "opacity") {
|
|
32
32
|
setPhase("gone");
|
|
33
33
|
onDismiss?.();
|
|
34
34
|
} }, children: [icon === false ? null : icon != null ? _jsx("span", { className: "o-notice-icon", "aria-hidden": "true", children: icon }) : glyph(NOTICE_ICONS[meaning === "neutral" ? "information" : meaning], "o-notice-icon"), _jsxs("div", { className: "o-notice-body", children: [title != null && _jsx("p", { className: "o-notice-title", children: title }), _jsx("div", { className: "o-notice-text", children: children }), title != null && acts && _jsx("div", { className: "o-notice-below", children: acts })] }), title == null && acts && _jsx("div", { className: "o-notice-acts", children: acts }), dismissible && _jsx(Button, { kind: "quiet", size: "xs", shape: "icon", className: "o-notice-x", "aria-label": said.dismiss, "data-force": force, icon: glyph(X, "", 2.25), onClick: away })] }));
|
|
@@ -8,7 +8,7 @@ export type { Currency, NumberKind, Unit } from "./format.js";
|
|
|
8
8
|
* its own (money's currencies). */
|
|
9
9
|
export interface NumberEditorParts {
|
|
10
10
|
body: React.ReactNode;
|
|
11
|
-
head: Pick<SheetHeadProps, "left" | "right" | "onBack" | "close">;
|
|
11
|
+
head: Pick<SheetHeadProps, "left" | "right" | "onBack" | "backSlot" | "close">;
|
|
12
12
|
title?: string;
|
|
13
13
|
}
|
|
14
14
|
interface Common {
|