viewkitjs 0.33.0 → 0.34.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 +29 -0
- package/package.json +1 -1
- package/views/dist/contract.d.ts +20 -10
- package/views/dist/contract.js +37 -3
- package/views/dist/controls/alert/alert.js +2 -1
- package/views/dist/controls/alert-dialog/alert-dialog.js +3 -2
- package/views/dist/controls/bulk-bar/bulk-bar.js +25 -22
- package/views/dist/controls/controls.d.ts +2 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/customize/customize.js +8 -6
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -2
- package/views/dist/controls/customize/map-customize-body.js +3 -2
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -0
- package/views/dist/controls/date-editor/date-editor.js +13 -7
- package/views/dist/controls/date-editor/map-calendar.js +2 -0
- package/views/dist/controls/date-editor/map-date-body.d.ts +1 -1
- package/views/dist/controls/date-editor/map-date-body.js +7 -3
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +2 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -4
- package/views/dist/controls/filter-editor/parts.d.ts +3 -1
- package/views/dist/controls/filter-editor/parts.js +7 -6
- package/views/dist/controls/group-editor/group-editor.js +2 -1
- package/views/dist/controls/group-editor/map-group-body.d.ts +1 -0
- package/views/dist/controls/group-editor/map-group-body.js +5 -1
- package/views/dist/controls/input/input.js +2 -1
- package/views/dist/controls/internal/head-button.d.ts +9 -0
- package/views/dist/controls/internal/head-button.js +13 -0
- package/views/dist/controls/internal/panel-controls.d.ts +13 -5
- package/views/dist/controls/internal/panel-controls.js +53 -10
- package/views/dist/controls/menu/menu.d.ts +2 -1
- package/views/dist/controls/menu/menu.js +2 -2
- package/views/dist/controls/modal/modal.js +5 -3
- package/views/dist/controls/number-editor/map-number-body.js +5 -1
- package/views/dist/controls/number-editor/number-editor.js +6 -6
- package/views/dist/controls/pane/map-pane.d.ts +3 -0
- package/views/dist/controls/pane/map-pane.js +5 -0
- package/views/dist/controls/picker/map-fields-body.js +25 -1
- package/views/dist/controls/picker.css +10 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +2 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +7 -3
- package/views/dist/controls/quick-filters/quick-filters.js +5 -3
- package/views/dist/controls/setting-row/looks.js +5 -5
- package/views/dist/controls/setting-row/setting-row.d.ts +3 -1
- package/views/dist/controls/setting-row/setting-row.js +3 -1
- package/views/dist/controls/setting-row.css +3 -2
- package/views/dist/controls/sheet/bottom-sheet.d.ts +3 -1
- package/views/dist/controls/sheet/bottom-sheet.js +2 -2
- package/views/dist/controls/sort-editor/map-sort-body.js +4 -4
- package/views/dist/controls/text-editor/map-text-body.js +5 -1
- package/views/dist/controls/text-editor/text-editor.js +5 -4
- package/views/dist/controls/toolbar/toolbar.d.ts +4 -2
- package/views/dist/controls/toolbar/toolbar.js +2 -2
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -2
- package/views/dist/controls/views-list/map-view-menu.js +6 -2
- package/views/dist/controls/views-list/map-views-list-body.d.ts +2 -1
- package/views/dist/controls/views-list/map-views-list-body.js +6 -5
- package/views/dist/controls/views-list/view-menu.js +3 -4
- package/views/dist/controls/views-list/views-list.js +2 -2
- package/views/dist/editors/EditorPanel.js +3 -3
- package/views/dist/list/list.d.ts +6 -2
- package/views/dist/list/list.js +6 -2
- package/views/dist/list/parts.js +3 -2
- package/views/dist/list/toolbar.js +9 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -0
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +4 -0
- package/views/dist/panels/react/toolbar/Toolbar.js +8 -3
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +3 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +3 -2
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +3 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +3 -2
- package/views/dist/panels/react/toolbar/context.d.ts +21 -0
- package/views/dist/panels/react/toolbar/context.js +4 -0
- package/views/dist/panels/react/toolbar/pane-host.d.ts +6 -0
- package/views/dist/panels/react/toolbar/pane-host.js +17 -0
- package/views/dist/panels/react/toolbar/panel-part.js +3 -2
- package/views/dist/panels/react.d.ts +1 -1
- package/views/dist/provider/ViewsProvider.d.ts +4 -3
- package/views/dist/provider/components.d.ts +34 -5
- package/views/dist/provider/components.js +1 -1
- package/views/dist/react.d.ts +1 -1
- package/views/dist/styles.css +97 -78
- package/views/dist/styles.unlayered.css +97 -78
- package/views/docs/contract.md +62 -6
- package/views/docs/controls/alert-dialog.md +4 -0
- package/views/docs/controls/alert.md +4 -0
- package/views/docs/controls/bulk-bar.md +4 -0
- package/views/docs/controls/customize.md +3 -1
- package/views/docs/controls/date-editor.md +2 -0
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/group-editor.md +2 -0
- package/views/docs/controls/menu.md +3 -1
- package/views/docs/controls/modal.md +4 -0
- package/views/docs/controls/number-editor.md +2 -0
- package/views/docs/controls/quick-filters.md +3 -1
- package/views/docs/controls/sheet.md +1 -1
- package/views/docs/controls/text-editor.md +2 -0
- package/views/docs/controls/toolbar.md +4 -0
- package/views/docs/controls/views-list.md +2 -0
- package/views/docs/guides/the-provider.md +4 -4
- package/views/docs/reference/controls.md +5 -3
- package/views/docs/reference/list.md +5 -3
- package/views/docs/reference/looks.md +1 -1
- package/views/docs/reference/panels-react.md +6 -5
- package/views/docs/reference/react.md +7 -6
- package/views/docs/reference/views.md +4 -2
- package/views/docs/reshaping.md +16 -5
- package/views/skills/views/SKILL.md +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { resolveViewsMessage } from "../../contract.js";
|
|
5
5
|
import { EDITOR_INNER_ESCAPE } from "../../editors/inner-escape.js";
|
|
@@ -7,6 +7,7 @@ import { ViewsContext } from "../../provider/context.js";
|
|
|
7
7
|
import { pickerWordsOf } from "../picker/map-picker.js";
|
|
8
8
|
import { useToldStep } from "../internal/told-step.js";
|
|
9
9
|
import { useNumberEditor } from "./number-editor.js";
|
|
10
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
10
11
|
const signs = new Map();
|
|
11
12
|
export function currencyOf(code, locale, language = locale) {
|
|
12
13
|
const key = `${locale}␟${language}␟${code}`;
|
|
@@ -49,6 +50,9 @@ export function numberEditorPropsOf({ label, kind, value, unit, units, onValueCh
|
|
|
49
50
|
return { ...props, ...(min !== undefined && { min }), ...(max !== undefined && { max }), ...(decimal && { decimal }), ...(typed !== undefined && { typed }) };
|
|
50
51
|
}
|
|
51
52
|
export function MapNumberBody(props) {
|
|
53
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(NumberBodyInner, { ...props }) });
|
|
54
|
+
}
|
|
55
|
+
function NumberBodyInner(props) {
|
|
52
56
|
const views = React.useContext(ViewsContext), messages = views?.messages ?? resolveViewsMessage;
|
|
53
57
|
const words = React.useMemo(() => numberEditorWordsOf(messages), [messages]);
|
|
54
58
|
const parts = useNumberEditor(numberEditorPropsOf(props, words, views?.conventions.language));
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { Button } from "../button/button.js";
|
|
5
|
-
import { InputGroupButton } from "../input/input.js";
|
|
6
4
|
import { PhoneHost, phoneMark, usePhone, usePhoneForm } from "../internal/phone.js";
|
|
5
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
7
6
|
import { NumberField } from "../number-field/number-field.js";
|
|
8
7
|
import { Picker, usePicker } from "../picker/picker.js";
|
|
9
|
-
import { Popover } from "../popover/popover.js";
|
|
10
8
|
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
11
9
|
import { boxLocale, readTyped } from "./format.js";
|
|
12
10
|
import { NUMBER_EDITOR_ATTRS, numberEditorWornOf } from "./looks.js";
|
|
@@ -56,6 +54,7 @@ function homeOrEnd(e) {
|
|
|
56
54
|
}
|
|
57
55
|
export function useNumberEditor(props) {
|
|
58
56
|
const { label, kind = "number", value, currency, currencies = [], unit, units = [], onValueChange, onDone, min, max, step = 1, decimals = 2, locale, decimal, align = "end", typed, popupData } = props;
|
|
57
|
+
const { Button, GroupButton, Popover } = usePanelControls();
|
|
59
58
|
const shell = props.draft === "shell";
|
|
60
59
|
const { phone, box } = useKeeping(props);
|
|
61
60
|
const settled = React.useRef(false);
|
|
@@ -162,7 +161,7 @@ export function useNumberEditor(props) {
|
|
|
162
161
|
} };
|
|
163
162
|
const sign = now?.sign ?? now?.code;
|
|
164
163
|
const fieldStart = now ? (pickable
|
|
165
|
-
? _jsx(
|
|
164
|
+
? _jsx(GroupButton, { "data-slot": "vk-number-currency", "aria-label": named, iconEnd: glyph(DOWN), onClick: choose, children: codes || !now.sign ? now.code : `${now.sign} ${now.code}` })
|
|
166
165
|
: codes ? _jsx("span", { className: "o-number-editor-code", "data-slot": "vk-number-unit", "data-key": "code", children: now.code }) : _jsx("span", { className: "o-number-editor-sign", "data-slot": "vk-number-unit", "data-key": "sign", children: sign })) : undefined;
|
|
167
166
|
const boxStart = now ? (pickable
|
|
168
167
|
? _jsx(Button, { kind: "quiet", size: "sm", className: "o-number-editor-code", "data-slot": "vk-number-currency", look: SHEET_CODE, "aria-label": named, iconEnd: glyph(DOWN), onClick: choose, children: codes || !now.sign ? now.code : `${now.sign} ${now.code}` })
|
|
@@ -182,9 +181,10 @@ export function useNumberEditor(props) {
|
|
|
182
181
|
return;
|
|
183
182
|
keep();
|
|
184
183
|
};
|
|
184
|
+
const openAt = (e) => { setChip(e.currentTarget); setChoosing(true); };
|
|
185
185
|
const start = !now ? null : worn.units === "code"
|
|
186
|
-
? (pickable ? _jsx(Button, { ref: setChip, kind: "quiet", size: "xs", className: "o-number-editor-code", "data-slot": "vk-number-currency", "aria-label": named, "aria-expanded": choosing, iconEnd: glyph(DOWN), onClick:
|
|
187
|
-
: (pickable ? _jsx(Button, { ref: setChip, kind: "soft", size: "2xs", className: "o-number-editor-currency", "data-slot": "vk-number-currency", "aria-label": named, iconEnd: glyph(DOWN), onClick:
|
|
186
|
+
? (pickable ? _jsx(Button, { ref: setChip, kind: "quiet", size: "xs", className: "o-number-editor-code", "data-slot": "vk-number-currency", "aria-label": named, "aria-expanded": choosing, iconEnd: glyph(DOWN), onClick: openAt, children: now.code }) : null)
|
|
187
|
+
: (pickable ? _jsx(Button, { ref: setChip, kind: "soft", size: "2xs", className: "o-number-editor-currency", "data-slot": "vk-number-currency", "aria-label": named, iconEnd: glyph(DOWN), onClick: openAt, children: now.sign ?? now.code })
|
|
188
188
|
: _jsx("span", { className: "o-number-editor-sign", "data-slot": "vk-number-unit", "data-key": "sign", children: now.sign ?? now.code }));
|
|
189
189
|
const body = (_jsxs("div", { ref: wornAt, className: "o-number-editor", "data-slot": "vk-number", "data-kit": "number-editor", ...device, "data-number-form": "computer", "data-number-kind": kind, onChange: readChange, onBlur: onBlur, onFocus: () => { settled.current = false; }, children: [_jsx(NumberField, { ref: field, chrome: "inline", align: align, words: steps, steppers: worn.arrows === "editing" ? "arrows" : false, before: start ?? undefined, after: kind === "percent" ? _jsx("span", { className: "o-number-editor-unit", "data-slot": "vk-number-unit", "data-key": "percent", children: "%" }) : undefined, ...shared, "aria-label": label, autofill: false, onKeyDown: onKeyDown, className: "o-number-editor-field", "data-slot": "vk-number-box" }), pickable && chip && (_jsx(Popover, { open: choosing, onOpenChange: (o) => { if (!o)
|
|
190
190
|
back(); }, anchor: chip, "aria-label": words.name, popupData: popupData, children: _jsx(Picker, { label: words.name, items: items, value: code ?? null, onValueChange: (c) => { if (typeof c === "string")
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ViewsPaneProps } from "../../provider/components.js";
|
|
2
|
+
/** ViewKit's panel host at the list's edge, drawn as the controls' Pane. */
|
|
3
|
+
export declare function MapPane({ open, onOpenChange, container, opener, label, children }: ViewsPaneProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Pane } from "./pane.js";
|
|
3
|
+
export function MapPane({ open, onOpenChange, container, opener, label, children }) {
|
|
4
|
+
return (_jsx(Pane, { open: open, onOpenChange: (next) => onOpenChange(next), container: container, opener: opener, "aria-label": label, children: children }));
|
|
5
|
+
}
|
|
@@ -39,5 +39,29 @@ export function MapFieldsBody({ label, search, fields, own, form, onPick, onDone
|
|
|
39
39
|
const { messages } = useViews();
|
|
40
40
|
const picked = React.useRef(false);
|
|
41
41
|
const on = () => fieldsBodyHandlers({ onPick, onDone }, picked);
|
|
42
|
-
|
|
42
|
+
const box = React.useRef(null);
|
|
43
|
+
React.useLayoutEffect(() => {
|
|
44
|
+
const at = box.current;
|
|
45
|
+
let gone = false;
|
|
46
|
+
const hold = () => {
|
|
47
|
+
const list = at?.querySelector('.o-picker[data-picker-form="computer"]'), input = list?.querySelector(".o-picker-search input");
|
|
48
|
+
if (gone || !at || !list || !input)
|
|
49
|
+
return;
|
|
50
|
+
at.style.removeProperty("--picker-floor");
|
|
51
|
+
const s = getComputedStyle(input), line = input.closest(".o-picker-search"), pen = document.createElement("canvas").getContext("2d");
|
|
52
|
+
const px = (v) => parseFloat(v) || 0, edge = list.getBoundingClientRect(), field = input.getBoundingClientRect();
|
|
53
|
+
const round = field.left + px(s.borderLeftWidth) + px(s.paddingLeft) - edge.left
|
|
54
|
+
+ px(s.paddingRight) + px(s.borderRightWidth) + px(getComputedStyle(line).paddingRight) + (edge.right - line.getBoundingClientRect().right);
|
|
55
|
+
let words = 0;
|
|
56
|
+
if (pen && input.placeholder) {
|
|
57
|
+
pen.font = `${s.fontStyle} ${s.fontWeight} ${s.fontSize} ${s.fontFamily}`;
|
|
58
|
+
words = pen.measureText(input.placeholder).width;
|
|
59
|
+
}
|
|
60
|
+
at.style.setProperty("--picker-floor", `${Math.ceil(Math.max(edge.width, round + words))}px`);
|
|
61
|
+
};
|
|
62
|
+
hold();
|
|
63
|
+
void document.fonts?.ready.then(hold);
|
|
64
|
+
return () => { gone = true; };
|
|
65
|
+
}, []);
|
|
66
|
+
return _jsx("span", { ref: box, className: "o-fields-body", children: _jsx(Picker, { label: label, items: fieldItemsOf(fields, messages({ key: "views.panels.related-records" })), value: own ?? null, search: search, searchShown: true, form: form, words: pickerWordsOf(messages), onValueChange: (v) => on().onValueChange(v), onDone: () => on().onDone() }) });
|
|
43
67
|
}
|
|
@@ -68,8 +68,17 @@
|
|
|
68
68
|
.o-picker[data-picker-form="computer"] .o-list-row { --list-row-rad: var(--list-row-corners, var(--list-row-r, var(--list-box-r, var(--vk-radius-lg))));
|
|
69
69
|
--list-row-pill-in: var(--list-row-corners-pill, var(--list-row-pill, var(--list-box-pill, 0))); }
|
|
70
70
|
.o-picker[data-picker-form="computer"] .o-picker-rows {
|
|
71
|
-
max-height: calc(var(--list-rows) * var(--list-row-h, calc(var(--vk-spacing) * 8))); scroll-padding-block: var(--list-row-h, calc(var(--vk-spacing) * 8));
|
|
71
|
+
max-height: calc(var(--list-rows, 8.5) * var(--list-row-h, calc(var(--vk-spacing) * 8))); scroll-padding-block: var(--list-row-h, calc(var(--vk-spacing) * 8));
|
|
72
72
|
}
|
|
73
|
+
/* ViewKit's field list (CONTROLS.FieldsBody, wrapped in .o-fields-body, which draws no box) stands as wide as its widest row:
|
|
74
|
+
its search fills that width and never sets it, though its placeholder reads whole, a row's check takes room only on the row the field holds, and ViewKit's
|
|
75
|
+
Popover holding it fits it, never past the 288 it stands at otherwise nor the room on screen, at least what opened it. */
|
|
76
|
+
.o-fields-body { display: contents; }
|
|
77
|
+
.o-fields-body .o-picker[data-picker-form="computer"] .o-picker-search { contain: inline-size; }
|
|
78
|
+
/* Never narrower than it opened nor than its search's placeholder (map-fields-body.tsx measures both as it opens). */
|
|
79
|
+
.o-fields-body .o-picker[data-picker-form="computer"] { min-width: var(--picker-floor, 0px); }
|
|
80
|
+
.o-fields-body .o-picker[data-picker-form="computer"] .o-list-row:not([data-selected], [aria-selected="true"]) > .o-picker-check { display: none; }
|
|
81
|
+
.o-popover:has(> .o-popover-cut > .o-fields-body .o-picker[data-picker-form="computer"]) { width: fit-content; max-width: min(calc(var(--vk-spacing) * 72), var(--available-width, 100%)); }
|
|
73
82
|
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])) {
|
|
74
83
|
--popover-edge: var(--list-edge, var(--vk-border)); --divider-colour: var(--list-sep-colour, var(--vk-border)); --popover-shadow: var(--list-shadow, var(--vk-shadow-xl)); --popover-pad: var(--list-pad, calc(var(--vk-spacing) * 1.5));
|
|
75
84
|
--popover-corners: calc(min(var(--list-box-r, var(--vk-radius-lg)), var(--vk-radius-2xl)) + var(--list-pad, calc(var(--vk-spacing) * 1.5)));
|
|
@@ -27,5 +27,6 @@ export type QuickFiltersFieldIn = {
|
|
|
27
27
|
export declare function quickFiltersFieldsOf(fields: readonly QuickFiltersFieldIn[]): QuickField[];
|
|
28
28
|
/** The quick filters' words in the app's messages. */
|
|
29
29
|
export declare const quickFiltersWordsOf: (say: ViewsMessageResolver) => QuickFiltersWords;
|
|
30
|
-
|
|
30
|
+
/** ViewKit's quick filters, drawing the app's controls where the provider's `panelControls` names them (VK-1014). */
|
|
31
|
+
export declare function MapQuickFiltersBody(props: ViewsQuickFiltersBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
31
32
|
export {};
|
|
@@ -6,7 +6,8 @@ import { ViewsContext } from "../../provider/context.js";
|
|
|
6
6
|
import { glyph, X } from "../internal/editor-parts.js";
|
|
7
7
|
import { HeaderBar } from "../phone-header/header-bar.js";
|
|
8
8
|
import { pickerItemsOf } from "../picker/map-picker.js";
|
|
9
|
-
import {
|
|
9
|
+
import { PanelHeadButton } from "../internal/head-button.js";
|
|
10
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
10
11
|
import { QuickFilters } from "./quick-filters.js";
|
|
11
12
|
export function quickHoldsOf(hold) {
|
|
12
13
|
return Object.fromEntries(hold.filter((h) => h.values.length).map((h) => [h.fieldKey, [...h.values]]));
|
|
@@ -50,10 +51,13 @@ export const quickFiltersWordsOf = (say) => ({
|
|
|
50
51
|
clear: say({ key: "views.panels.quick-clear-value" }),
|
|
51
52
|
none: say({ key: "views.panels.quick-none" }),
|
|
52
53
|
});
|
|
53
|
-
export function MapQuickFiltersBody(
|
|
54
|
+
export function MapQuickFiltersBody(props) {
|
|
55
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(QuickFiltersBodyInner, { ...props }) });
|
|
56
|
+
}
|
|
57
|
+
function QuickFiltersBodyInner({ label, fields, hold, several, showCounts, form, onHoldChange, onDone, actions }) {
|
|
54
58
|
const views = React.useContext(ViewsContext);
|
|
55
59
|
const messages = views?.messages ?? resolveViewsMessage;
|
|
56
60
|
const words = React.useMemo(() => quickFiltersWordsOf(messages), [messages]);
|
|
57
61
|
const quick = React.useMemo(() => quickFiltersFieldsOf(fields), [fields]);
|
|
58
|
-
return (_jsxs(_Fragment, { children: [actions && (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-quick-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: label }), right: _jsx("span", {}), left: _jsx(
|
|
62
|
+
return (_jsxs(_Fragment, { children: [actions && (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-quick-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: label }), right: _jsx("span", {}), left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-close", "aria-label": actions.close.label, icon: glyph(X), onClick: actions.close.onPress }) }) })), _jsx("div", { "data-quick-filters-holds": several ? "several" : "one", style: { display: "contents" }, children: _jsx(QuickFilters, { fields: quick, holds: quickHoldsOf(hold), onHoldsChange: (next) => onHoldChange(quickListHoldOf(next, hold)), counts: showCounts, form: form, onDone: onDone, words: words }) })] }));
|
|
59
63
|
}
|
|
@@ -3,7 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cx } from "../../internal/cx.js";
|
|
5
5
|
import { Avatar } from "../avatar/avatar.js";
|
|
6
|
-
import {
|
|
6
|
+
import { InputGroup, InputGroupAddon } from "../input/input.js";
|
|
7
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
7
8
|
import { Icon } from "../internal/icons.js";
|
|
8
9
|
import { usePhoneForm } from "../internal/phone.js";
|
|
9
10
|
import { Scrollbar } from "../scrollbar/scrollbar.js";
|
|
@@ -50,13 +51,14 @@ function Values({ field, values, held, several, onPress, search, phone, clear })
|
|
|
50
51
|
onPress(values[i].value);
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "o-quick-filters-values", role: "listbox", "aria-label": field.name, "aria-multiselectable": several || undefined, "data-quiet": held.length ? "" : undefined, children: values.map((v, i) => {
|
|
54
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "o-quick-filters-values", "data-slot": "vk-quick-values", "data-key": field.id, role: "listbox", "aria-label": field.name, "aria-multiselectable": several || undefined, "data-quiet": held.length ? "" : undefined, children: values.map((v, i) => {
|
|
54
55
|
const on = held.includes(v.value);
|
|
55
56
|
return (_jsxs("div", { ref: (el) => { rows.current[i] = el; }, role: "option", "aria-selected": on, tabIndex: i === here ? 0 : -1, className: "o-quick-filters-value", "data-slot": "vk-quick-value", "data-key": v.value, "data-held": on ? "" : undefined, onClick: () => { setAt(i); onPress(v.value); }, onKeyDown: (e) => keys(e, i), children: [_jsx(Mark, { value: v, phone: phone }), _jsx("span", { className: "o-quick-filters-name", children: v.label }), on && _jsx("span", { className: "o-quick-filters-clear", "data-slot": "vk-quick-clear", "aria-hidden": "true", children: clear }), v.count !== undefined && _jsx("span", { className: "o-quick-filters-count", "data-slot": "vk-quick-count", children: v.count.toLocaleString("en-GB") })] }, v.value));
|
|
56
57
|
}) }), _jsx(Scrollbar, {})] }));
|
|
57
58
|
}
|
|
58
59
|
export function QuickFilters({ fields, holds, onHoldsChange, open: openGiven, onOpenChange, counts = true, form: given, onDone, words, className }) {
|
|
59
60
|
const phone = usePhoneForm(given), form = phone ? "phone" : "computer", w = quickFiltersWords(words);
|
|
61
|
+
const { Input } = usePanelControls();
|
|
60
62
|
const root = React.useRef(null), searchBox = React.useRef(null), holding = useHolding(root);
|
|
61
63
|
const [own, setOwn] = React.useState(() => firstOpen(fields, holds)), [query, setQuery] = React.useState("");
|
|
62
64
|
const open = openGiven ?? own;
|
|
@@ -83,7 +85,7 @@ export function QuickFilters({ fields, holds, onHoldsChange, open: openGiven, on
|
|
|
83
85
|
root.current?.querySelector(".o-quick-filters-value")?.focus();
|
|
84
86
|
};
|
|
85
87
|
return (_jsxs("div", { ref: root, className: cx("o-quick-filters", className), "data-slot": "vk-quick", "data-kit": "quick-filters", "data-form": form, children: [_jsxs("div", { className: "o-quick-filters-top", children: [_jsx(ToggleGroup, { "aria-label": w.fields, kind: "pill", size: phone ? "sm" : "xs", spacing: phone ? 2 : 1.5, value: [field.id], onValueChange: (v) => { if (v[0])
|
|
86
|
-
show(v[0]); }, className: "o-quick-filters-strip", children: fields.map((f) => _jsx(Toggle, { value: f.id, "data-slot": "vk-quick-field", "data-key": f.id, children: f.name }, f.id)) }), searching && (_jsxs(InputGroup, { size: phone ? "lg" : "sm", chrome: "soft", "data-slot": "vk-quick-search", children: [_jsx(InputGroupAddon, { children: _jsx(Icon, { name: "search" }) }), _jsx(Input, { ref: searchBox, value: query, onValueChange: setQuery, placeholder: field.search, "aria-label": field.search ?? w.search(field.name), onKeyDown: toFirst })] }))] }), values.length || !query
|
|
88
|
+
show(v[0]); }, className: "o-quick-filters-strip", "data-slot": "vk-quick-strip", children: fields.map((f) => _jsx(Toggle, { value: f.id, "data-slot": "vk-quick-field", "data-key": f.id, children: f.name }, f.id)) }), searching && (_jsxs(InputGroup, { size: phone ? "lg" : "sm", chrome: "soft", "data-slot": "vk-quick-search", children: [_jsx(InputGroupAddon, { children: _jsx(Icon, { name: "search" }) }), _jsx(Input, { ref: searchBox, value: query, onValueChange: setQuery, placeholder: field.search, "aria-label": field.search ?? w.search(field.name), onKeyDown: toFirst })] }))] }), values.length || !query
|
|
87
89
|
? _jsx(Values, { field: field, values: values, held: heldIn(holds, field.id), several: holding === "several", onPress: press, search: searchBox, phone: phone, clear: w.clear }, `${field.id}:${query}`)
|
|
88
90
|
: _jsx("p", { className: "o-quick-filters-none", "data-slot": "vk-quick-none", role: "status", children: w.none })] }));
|
|
89
91
|
}
|
|
@@ -3,11 +3,11 @@ const OUTRIGHT = { card: "outlined", rows: "snug", end: "buttons", fields: "boxe
|
|
|
3
3
|
const ATTIO = { card: "raised", rows: "roomy", end: "buttons", fields: "boxes", icon: "line" };
|
|
4
4
|
const LINEAR = { card: "edged", rows: "inset", end: "words", fields: "end", icon: "line" };
|
|
5
5
|
const options = [
|
|
6
|
-
{ id: "card", name: "Card", device: "desktop", def:
|
|
7
|
-
{ id: "rows", name: "Rows", device: "desktop", def:
|
|
8
|
-
{ id: "end", name: "End", device: "desktop", def:
|
|
9
|
-
{ id: "fields", name: "Fields", device: "desktop", def:
|
|
10
|
-
{ id: "icon", name: "Icon", device: "phone", def:
|
|
6
|
+
{ id: "card", name: "Card", device: "desktop", def: ATTIO.card, values: [{ id: "outlined", name: "Outlined" }, { id: "raised", name: "Raised" }, { id: "edged", name: "Edged" }] },
|
|
7
|
+
{ id: "rows", name: "Rows", device: "desktop", def: ATTIO.rows, values: [{ id: "snug", name: "Snug" }, { id: "roomy", name: "Roomy" }, { id: "inset", name: "Inset" }] },
|
|
8
|
+
{ id: "end", name: "End", device: "desktop", def: ATTIO.end, values: [{ id: "buttons", name: "Buttons" }, { id: "words", name: "Words" }] },
|
|
9
|
+
{ id: "fields", name: "Fields", device: "desktop", def: ATTIO.fields, values: [{ id: "boxes", name: "Boxes" }, { id: "end", name: "At the end" }] },
|
|
10
|
+
{ id: "icon", name: "Icon", device: "phone", def: ATTIO.icon, values: [{ id: "line", name: "Line" }, { id: "tile", name: "Tile" }] },
|
|
11
11
|
];
|
|
12
12
|
const looks = [
|
|
13
13
|
{ id: "outright", name: "Outright", picks: OUTRIGHT },
|
|
@@ -54,7 +54,9 @@ export type SettingRowProps = SettingRowBase & (({
|
|
|
54
54
|
} & No<"switch" | "select" | "onOpen">) | ({
|
|
55
55
|
onOpen: () => void;
|
|
56
56
|
value?: React.ReactNode;
|
|
57
|
-
} & No<"switch" | "select" | "action">)
|
|
57
|
+
} & No<"switch" | "select" | "action">)
|
|
58
|
+
/** The plain kind (VK-1036): no control and no ›, a row that only says, opening nothing. */
|
|
59
|
+
| No<"switch" | "select" | "action" | "onOpen" | "value">);
|
|
58
60
|
export interface SettingRowsProps {
|
|
59
61
|
/** The danger zone's: a red edge, each row's button the Button's danger kind unless its action says outline, on a phone its
|
|
60
62
|
* names red. */
|
|
@@ -56,7 +56,7 @@ function SettingRowOf(props) {
|
|
|
56
56
|
const phone = !!rows?.phone, worn = rows ? rows.worn : ownWorn, inWords = !phone && worn.end === "words";
|
|
57
57
|
const shut = locked != null && locked !== false;
|
|
58
58
|
const reason = shut && locked !== true ? locked : null;
|
|
59
|
-
const kind = props.switch ? "switch" : props.select ? "select" : props.action ? "action" : "open";
|
|
59
|
+
const kind = props.switch ? "switch" : props.select ? "select" : props.action ? "action" : props.onOpen ? "open" : "plain";
|
|
60
60
|
const begins = mark != null ? "mark" : icon != null || (phone && danger && props.action?.icon != null) ? "icon" : undefined;
|
|
61
61
|
const ownCard = alone && !rows && !device && worn.card === "edged";
|
|
62
62
|
const root = { className: cx("o-setting-row", phone && "o-field-row", props.switch && "o-switch-row", ownCard && "o-smooth o-smooth-ease", className), "data-setting-row-kind": kind,
|
|
@@ -102,6 +102,8 @@ function SettingRowOf(props) {
|
|
|
102
102
|
: _jsx(Button, { kind: kindOf, size: "sm", icon: a.icon, disabled: shut || a.disabled, onClick: a.onClick, children: a.label });
|
|
103
103
|
return (_jsxs("div", { ...root, children: [start, words, _jsxs("span", { className: "o-setting-row-end", children: [value, lead, act] })] }));
|
|
104
104
|
}
|
|
105
|
+
if (!props.onOpen)
|
|
106
|
+
return _jsxs("div", { ...root, children: [start, words, lead != null && _jsx("span", { className: "o-setting-row-end", children: lead })] });
|
|
105
107
|
return (_jsxs("button", { type: "button", ...root, disabled: shut, onClick: shut ? undefined : props.onOpen, children: [start, words, _jsxs("span", { className: "o-setting-row-end", children: [lead, props.value != null && _jsx("span", { className: "o-setting-row-value", children: props.value }), chevron] })] }));
|
|
106
108
|
}
|
|
107
109
|
const firstOf = (v) => (Array.isArray(v) ? v : v == null ? [] : [v]);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/* The setting row and its card, as the Outright kit draws them (setting-row/setting-row.tsx): one setting as a row, its words
|
|
2
2
|
(choice.css) on the left, its control at its end (the Switch, the Select, a Button, or its value and ›), its mark or icon at
|
|
3
3
|
its start; the rows in a card, a line between each; the danger zone's card with a red edge; a lone row bare. Two options, each
|
|
4
|
-
a computer's, picked on the frame or the app around it (looks.ts): the card (outlined,
|
|
5
|
-
and the rows (snug,
|
|
4
|
+
a computer's, picked on the frame or the app around it (looks.ts): the card (outlined, or raised on its ground, the default)
|
|
5
|
+
and the rows (snug, or roomy, 64 tall, the default). The defaults are Attio's look, which lookAttrs writes when nothing is
|
|
6
|
+
picked (VK-1035); a frame with no attribute at all still draws outlined and snug, as SwitchRows did (switch-row.css); a switch's row is no
|
|
6
7
|
press of its own, only its Switch is (KIT-969). On a phone the card and its rows are
|
|
7
8
|
Field rows' (field.css), and this sheet adds what a setting puts in them, as iOS's Settings draws it (KIT-972): the name taking
|
|
8
9
|
the room; the value in the quietest grey, cut with …, before iOS's ›; a button's words in the link colour at the end; a lone
|
|
@@ -113,8 +113,10 @@ export interface SheetProps {
|
|
|
113
113
|
finalFocus?: () => HTMLElement | null;
|
|
114
114
|
/** A class on the sheet itself, after its own. */
|
|
115
115
|
className?: string;
|
|
116
|
+
/** Its public name where a part names it (VK-1023: the bulk bar's `vk-bulk-field-sheet`; a Menu's on a phone), on the sheet. */
|
|
117
|
+
"data-slot"?: string;
|
|
116
118
|
/** Its head and its body. */
|
|
117
119
|
children: React.ReactNode;
|
|
118
120
|
}
|
|
119
121
|
/** What rises from the bottom of the phone, in a form, at stops. What it holds is poured in. */
|
|
120
|
-
export declare function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form, stops, openAt, stop, onStopChange, mark: marked, container, standing: stands, finalFocus, className, children }: SheetProps): import("react/jsx-runtime").JSX.Element;
|
|
122
|
+
export declare function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form, stops, openAt, stop, onStopChange, mark: marked, container, standing: stands, finalFocus, className, "data-slot": slot, children }: SheetProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -248,7 +248,7 @@ function useKeyboardFoot(popup, on) {
|
|
|
248
248
|
return () => { vv.removeEventListener("resize", read); vv.removeEventListener("scroll", read); popup.style.removeProperty("--sheet-keyboard"); };
|
|
249
249
|
}, [typing, popup]);
|
|
250
250
|
}
|
|
251
|
-
export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form = "full", stops, openAt, stop, onStopChange, mark: marked = "[data-sheet-mark]", container, standing: stands, finalFocus, className, children }) {
|
|
251
|
+
export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form = "full", stops, openAt, stop, onStopChange, mark: marked = "[data-sheet-mark]", container, standing: stands, finalFocus, className, "data-slot": slot, children }) {
|
|
252
252
|
const closeBelow = React.useContext(CloseAll), stacked = closeBelow !== null;
|
|
253
253
|
const standsBelow = React.useContext(Standing), standing = stands || standsBelow;
|
|
254
254
|
const [armed, setArmed] = React.useState(false);
|
|
@@ -375,5 +375,5 @@ export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form =
|
|
|
375
375
|
}, children: _jsxs(Base.Portal, { container: container, children: [_jsx(Base.Backdrop, { ref: backdrop, forceRender: stacked, className: "o-sheet-backdrop", "data-stacked": stacked ? "" : undefined }), _jsxs(Base.Viewport, { ref: setViewport, className: "o-sheet-viewport", "data-sheet-form": form, onClick: standing ? (e) => { if (e.target === e.currentTarget) {
|
|
376
376
|
release("closed");
|
|
377
377
|
close("outside-press");
|
|
378
|
-
} } : undefined, children: [_jsx(Base.Popup, { ref: bindPopup, initialFocus: popupRef, finalFocus: finalFocus ? () => finalFocus() ?? true : undefined, className: cx("o-sheet o-smooth", className), "data-sheet-form": form, "aria-label": label, "data-kit": "sheet", children: _jsxs("div", { className: "o-sheet-cut", children: [_jsx("div", { className: "o-sheet-handle", "aria-hidden": "true" }), _jsx(Standing.Provider, { value: standing, children: _jsx(Body.Provider, { value: body, children: _jsx(CloseAll.Provider, { value: closeAll, children: _jsx(OutOfFieldRows, { children: children }) }) }) })] }) }), coming && _jsx("div", { className: "o-sheet-shield", "aria-hidden": "true", "data-sheet-shield": "", onPointerDown: (e) => { e.preventDefault(); e.stopPropagation(); }, onMouseDown: (e) => { e.preventDefault(); e.stopPropagation(); }, onClick: (e) => e.stopPropagation() })] })] }) }));
|
|
378
|
+
} } : undefined, children: [_jsx(Base.Popup, { ref: bindPopup, initialFocus: popupRef, finalFocus: finalFocus ? () => finalFocus() ?? true : undefined, className: cx("o-sheet o-smooth", className), "data-sheet-form": form, "aria-label": label, "data-slot": slot, "data-kit": "sheet", children: _jsxs("div", { className: "o-sheet-cut", children: [_jsx("div", { className: "o-sheet-handle", "aria-hidden": "true" }), _jsx(Standing.Provider, { value: standing, children: _jsx(Body.Provider, { value: body, children: _jsx(CloseAll.Provider, { value: closeAll, children: _jsx(OutOfFieldRows, { children: children }) }) }) })] }) }), coming && _jsx("div", { className: "o-sheet-shield", "aria-hidden": "true", "data-sheet-shield": "", onPointerDown: (e) => { e.preventDefault(); e.stopPropagation(); }, onMouseDown: (e) => { e.preventDefault(); e.stopPropagation(); }, onClick: (e) => e.stopPropagation() })] })] }) }));
|
|
379
379
|
}
|
|
@@ -4,11 +4,11 @@ import * as React from "react";
|
|
|
4
4
|
import { resolveViewsMessage } from "../../contract.js";
|
|
5
5
|
import { ViewsContext } from "../../provider/context.js";
|
|
6
6
|
import { glyph, TICK, X } from "../internal/editor-parts.js";
|
|
7
|
+
import { PanelHeadButton } from "../internal/head-button.js";
|
|
7
8
|
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
8
9
|
import { useToldStep } from "../internal/told-step.js";
|
|
9
10
|
import { pickerWordsOf } from "../picker/map-picker.js";
|
|
10
11
|
import { HeaderBar } from "../phone-header/header-bar.js";
|
|
11
|
-
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
12
12
|
import { useSortEditor } from "./sort-editor.js";
|
|
13
13
|
const KIT = { asc: "ascending", desc: "descending" };
|
|
14
14
|
const VIEWKIT = { ascending: "asc", descending: "desc" };
|
|
@@ -78,8 +78,8 @@ function SortBodyInner(props) {
|
|
|
78
78
|
const { actions } = props;
|
|
79
79
|
if (!actions)
|
|
80
80
|
return _jsx(_Fragment, { children: parts.body });
|
|
81
|
-
const done = actions.done && _jsx(
|
|
81
|
+
const done = actions.done && _jsx(PanelHeadButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": actions.done.label, icon: glyph(TICK), onClick: actions.done.onPress });
|
|
82
82
|
return (_jsxs(_Fragment, { children: [parts.title !== undefined
|
|
83
|
-
? _jsx(BodyHead, { title: parts.title, left: _jsx(
|
|
84
|
-
: _jsx(BodyHead, { title: props.label, left: _jsx(
|
|
83
|
+
? _jsx(BodyHead, { title: parts.title, left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-back", "aria-label": words.back, className: "o-sheet-back", icon: glyph(BACK), onClick: parts.head.onBack }), right: done || _jsx("span", {}) })
|
|
84
|
+
: _jsx(BodyHead, { title: props.label, left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-close", "aria-label": actions.close.label, icon: glyph(X), onClick: actions.close.onPress }), right: done || _jsx("span", {}) }), parts.body] }));
|
|
85
85
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { resolveViewsMessage } from "../../contract.js";
|
|
5
5
|
import { ViewsContext } from "../../provider/context.js";
|
|
6
6
|
import { pickerWordsOf } from "../picker/map-picker.js";
|
|
7
7
|
import { useToldStep } from "../internal/told-step.js";
|
|
8
8
|
import { useTextEditor } from "./text-editor.js";
|
|
9
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
9
10
|
export function textEditorPropsOf({ label, kind, paragraph, value, onValueChange, onDone, check, region, autoFocus, form, place }) {
|
|
10
11
|
const as = paragraph || kind === "rich_text" ? "long" : kind === "url" ? "link" : kind;
|
|
11
12
|
return { label, kind: as, value, onValueChange, onDone, check, autoFocus, form, ...(place ? { place } : {}), draft: "shell", ...(region ? { country: region } : {}) };
|
|
@@ -14,6 +15,9 @@ export function textEditorWordsOf(say) {
|
|
|
14
15
|
return { country: say({ key: "views.editors.place-country" }), searchCountry: say({ key: "views.editors.place-country-search" }), picker: pickerWordsOf(say) };
|
|
15
16
|
}
|
|
16
17
|
export function MapTextBody(props) {
|
|
18
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(TextBodyInner, { ...props }) });
|
|
19
|
+
}
|
|
20
|
+
function TextBodyInner(props) {
|
|
17
21
|
const views = React.useContext(ViewsContext), messages = views?.messages ?? resolveViewsMessage;
|
|
18
22
|
const words = React.useMemo(() => textEditorWordsOf(messages), [messages]);
|
|
19
23
|
const parts = useTextEditor({ ...textEditorPropsOf(props), words, ...(views ? { language: views.conventions.language } : {}) });
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Field } from "../field/field.js";
|
|
5
|
-
import {
|
|
5
|
+
import { InputGroup, InputGroupAddon } from "../input/input.js";
|
|
6
6
|
import { InlineInput, InlineInputGroup } from "../inline-input/inline-input.js";
|
|
7
|
-
import { Popover } from "../popover/popover.js";
|
|
8
7
|
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
9
8
|
import { drawnAt } from "../internal/scroll.js";
|
|
10
9
|
import { spacingPx } from "../internal/read-token.js";
|
|
@@ -15,6 +14,7 @@ import { TEXT_EDITOR_ATTRS, textEditorWornOf } from "./looks.js";
|
|
|
15
14
|
import { Countries } from "./countries.js";
|
|
16
15
|
import { textWords } from "./words.js";
|
|
17
16
|
import { keepTypedRun } from "../internal/typed-run.js";
|
|
17
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
18
18
|
const COUNTRY = { edge: "none", corner: "round", radius: "sm", words: "inherit", colour: "text", pad: "6-4", gap: "3", icon: "14", iconColour: "subtle", hover: "neutral", open: "neutral" };
|
|
19
19
|
const glyph = (paths) => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths.map((d) => _jsx("path", { d: d }, d)) }));
|
|
20
20
|
const X = ["M18 6l-12 12", "M6 6l12 12"], TICK = ["M5 12l5 5l10 -10"], DOWN = ["M6 9l6 6l6 -6"];
|
|
@@ -39,6 +39,7 @@ function useWorn(el) {
|
|
|
39
39
|
return worn;
|
|
40
40
|
}
|
|
41
41
|
export function useTextEditor(props) {
|
|
42
|
+
const { Input, GroupButton, Popover } = usePanelControls();
|
|
42
43
|
const { label, kind = "text", value, onValueChange, onDone, check, placeholder, typed, tried = false, autoFocus = true } = props;
|
|
43
44
|
const w = textWords(props.words), language = props.language ?? "en";
|
|
44
45
|
const host = React.useContext(PhoneHost), small = usePhone();
|
|
@@ -232,7 +233,7 @@ export function useTextEditor(props) {
|
|
|
232
233
|
}, [root, form, place, draft, worn.box, worn.long, worn.phone, kind, long, shown]);
|
|
233
234
|
if (form === "phone") {
|
|
234
235
|
const step = withCountry && open;
|
|
235
|
-
const field = withCountry ? (_jsxs(InputGroup, { size: "lg", "data-slot": "vk-text-box", children: [_jsxs(InputGroupAddon, { side: "start", children: [_jsx(
|
|
236
|
+
const field = withCountry ? (_jsxs(InputGroup, { size: "lg", "data-slot": "vk-text-box", children: [_jsxs(InputGroupAddon, { side: "start", children: [_jsx(GroupButton, { className: "o-text-editor-country", "data-slot": "vk-text-country", "aria-label": `${w.country}: ${countryName(phone.country, language)}`, iconEnd: glyph(DOWN), onClick: () => setOpen(true), children: _jsx("span", { className: "o-text-editor-country-code", children: phone.country }) }), _jsx("span", { className: "o-text-editor-dial", "data-slot": "vk-text-dial", children: dialOf(phone.country) })] }), _jsx(Input, { ref: number, autofill: false, type: "tel", inputMode: "tel", enterKeyHint: "done", value: phone.digits, ...common, placeholder: patternOf(phone.country), spellCheck: false, onChange: (e) => movePhone({ digits: e.target.value }), onKeyDown: onKeyDown })] })) : (_jsx(Input, { ref: box, size: "lg", "data-slot": "vk-text-box", autofill: false, multiline: long || kind === "text", grow: long || kind === "text", className: long ? "o-text-editor-tall" : undefined, type: long || kind === "text" ? undefined : keys.type, inputMode: keys.inputMode, enterKeyHint: long ? undefined : "done", value: draft, ...common, onChange: change, onKeyDown: long ? undefined : onKeyDown }));
|
|
236
237
|
const body = (_jsx("div", { ref: placeRoot, className: "o-text-editor", "data-slot": "vk-text", "data-kit": "text-editor", "data-text-form": "phone", ...phoneMark(!!host || small), "data-text-kind": kind, "data-text-view": step ? "country" : undefined, children: step ? countriesList : _jsx(Field, { error: refused ?? undefined, children: field }) }));
|
|
237
238
|
if (step)
|
|
238
239
|
return { body, head: { onBack: () => setOpen(false), backSlot: "vk-editor-back", close: false }, title: w.country };
|
|
@@ -253,7 +254,7 @@ export function useTextEditor(props) {
|
|
|
253
254
|
keep();
|
|
254
255
|
};
|
|
255
256
|
const note = refused && _jsxs("div", { className: "o-text-editor-note", "data-slot": "vk-text-note", id: noteId, role: "alert", children: [glyph(["M12 8v5", "M12 16.5v.01", "M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"]), _jsx("span", { children: refused })] });
|
|
256
|
-
const body = (_jsxs("div", { ref: placeRoot, className: "o-text-editor", "data-slot": "vk-text", "data-kit": "text-editor", "data-text-form": "computer", ...phoneMark(!!host || small), "data-text-kind": kind, "data-text-box": worn.box, "data-text-place": place, "data-refused": refused ? "" : undefined, onBlur: blur, children: [withCountry ? _jsxs(_Fragment, { children: [_jsxs(InlineInputGroup, { className: "o-text-editor-phone", "data-slot": "vk-text-box", "data-refused": refused ? "" : undefined, children: [_jsx(InputGroupAddon, { side: "start", children: _jsx(
|
|
257
|
+
const body = (_jsxs("div", { ref: placeRoot, className: "o-text-editor", "data-slot": "vk-text", "data-kit": "text-editor", "data-text-form": "computer", ...phoneMark(!!host || small), "data-text-kind": kind, "data-text-box": worn.box, "data-text-place": place, "data-refused": refused ? "" : undefined, onBlur: blur, children: [withCountry ? _jsxs(_Fragment, { children: [_jsxs(InlineInputGroup, { className: "o-text-editor-phone", "data-slot": "vk-text-box", "data-refused": refused ? "" : undefined, children: [_jsx(InputGroupAddon, { side: "start", children: _jsx(GroupButton, { className: "o-text-editor-country", "data-slot": "vk-text-country", look: COUNTRY, "aria-label": `${w.country}: ${countryName(phone.country, language)}`, "aria-haspopup": "listbox", "aria-expanded": open, iconEnd: glyph(DOWN), onClick: () => setOpen((o) => !o), children: _jsx("span", { className: "o-text-editor-country-code", children: phone.country }) }) }), _jsx(InputGroupAddon, { side: "start", children: _jsx("span", { className: "o-text-editor-dial", "data-slot": "vk-text-dial", children: dialOf(phone.country) }) }), _jsx(Input, { ref: number, className: "o-text-editor-number", type: "tel", inputMode: "tel", enterKeyHint: "done", value: phone.digits, ...common, autofill: false, placeholder: patternOf(phone.country), spellCheck: false, onChange: (e) => movePhone({ digits: e.target.value }), onKeyDown: onKeyDown, "aria-invalid": refused ? true : undefined, "aria-describedby": refused ? noteId : undefined })] }), _jsx(Popover, { open: open, onOpenChange: (o, d) => {
|
|
257
258
|
setOpen(o);
|
|
258
259
|
if (shell)
|
|
259
260
|
return;
|
|
@@ -101,9 +101,11 @@ declare function stepsOf(items: React.ReactElement[], fill?: boolean): Step[];
|
|
|
101
101
|
export declare const toolbarSteps: typeof stepsOf;
|
|
102
102
|
/** The row and, under it, the filter bar: Base UI's toolbar, one Tab stop for the whole of it, the arrows inside. */
|
|
103
103
|
export declare function ToolbarControl({ label, children, bar, barLabel: barNamed, words: given, views, settings, search, add, sort, filter, filters, save, quick, added, picks: said, size, barSize, spacing, fold, fill, more, holds, form, onMoreViews, moreViewsOpen, className, style, onKeyDown, ...props }: ToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
104
|
-
/** A line between what belongs together and what doesn't, across a line.
|
|
105
|
-
|
|
104
|
+
/** A line between what belongs together and what doesn't, across a line. `data-slot`, its public name where a part names it
|
|
105
|
+
* (VK-1023: the bulk bar's `vk-bulk-separator`). */
|
|
106
|
+
export declare function ToolbarSeparatorControl({ className, "data-slot": slot }: {
|
|
106
107
|
className?: string;
|
|
108
|
+
"data-slot"?: string;
|
|
107
109
|
}): import("react/jsx-runtime").JSX.Element;
|
|
108
110
|
/** Room that pushes what follows it to its line's far end (New, at the end of the row). */
|
|
109
111
|
export declare function ToolbarSpacer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -340,9 +340,9 @@ function dress(el, alone, height) {
|
|
|
340
340
|
return el;
|
|
341
341
|
}
|
|
342
342
|
const isSeparator = (n) => React.isValidElement(n) && n.type === ToolbarSeparatorControl;
|
|
343
|
-
export function ToolbarSeparatorControl({ className }) {
|
|
343
|
+
export function ToolbarSeparatorControl({ className, "data-slot": slot }) {
|
|
344
344
|
const row = React.useContext(InToolbar);
|
|
345
|
-
return row ? _jsx(BaseToolbar.Separator, { className: cn("o-toolbar-sep", className) }) : _jsx("span", { role: "separator", className: cn("o-toolbar-sep", className) });
|
|
345
|
+
return row ? _jsx(BaseToolbar.Separator, { className: cn("o-toolbar-sep", className), "data-slot": slot }) : _jsx("span", { role: "separator", className: cn("o-toolbar-sep", className), "data-slot": slot });
|
|
346
346
|
}
|
|
347
347
|
export function ToolbarSpacer() {
|
|
348
348
|
return _jsx("span", { className: "o-toolbar-spacer", "aria-hidden": "true" });
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { ViewsViewMenuProps } from "../../provider/components.js";
|
|
2
|
-
/** ViewKit's view menu at a views row's pill
|
|
3
|
-
|
|
2
|
+
/** ViewKit's view menu at a views row's pill: Rename's and New view's boxes, and the Modal and alert they open, the app's where the
|
|
3
|
+
* provider's `panelControls` names them (VK-1014). */
|
|
4
|
+
export declare function MapViewMenu(props: ViewsViewMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { ViewsContext } from "../../provider/context.js";
|
|
5
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
5
6
|
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
6
7
|
import { MapMenu } from "../menu/map-menu.js";
|
|
7
8
|
import { useVerbsMenu } from "./map-views-list-body.js";
|
|
8
|
-
export function MapViewMenu(
|
|
9
|
+
export function MapViewMenu(props) {
|
|
10
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(ViewMenuInner, { ...props }) });
|
|
11
|
+
}
|
|
12
|
+
function ViewMenuInner({ open, onOpenChange, anchor, align, view, views, value, verbs, onDone, onHold }) {
|
|
9
13
|
const Menu = React.useContext(ViewsContext)?.components.Menu ?? MapMenu;
|
|
10
14
|
const screen = React.useContext(PhoneHost), small = usePhone();
|
|
11
15
|
const creating = view === undefined;
|
|
@@ -19,7 +19,8 @@ export declare function orderToWrite(views: readonly Pick<ViewsViewsListItem, "v
|
|
|
19
19
|
export declare function viewsListPropsOf(p: ViewsViewsListBodyProps, words: ViewsListWords, notNow: string, AppIcon?: AppIcon): ViewsListProps;
|
|
20
20
|
/** A view's menu's words in the app's messages. */
|
|
21
21
|
export declare function viewMenuWordsOf(say: ViewsMessageResolver): ViewMenuWords;
|
|
22
|
-
/** ViewKit's views list body, drawn as the views list
|
|
22
|
+
/** ViewKit's views list body, drawn as the views list, with the app's controls where the provider's `panelControls` names them
|
|
23
|
+
* (VK-1014). */
|
|
23
24
|
export declare function MapViewsListBody(props: ViewsViewsListBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
/** What a view's menu drawn from the axis's verbs is handed: the views list body's (VK-823), and a pill's (`ViewMenu`, VK-947). */
|
|
25
26
|
export type VerbsMenuProps = {
|
|
@@ -11,7 +11,8 @@ import { MenuList, tilesOf, useMenuListOption, useMenuListRows } from "../menu-l
|
|
|
11
11
|
import { menuEntries } from "../menu/map-menu.js";
|
|
12
12
|
import { menuWordsOf, pickerWordsOf } from "../picker/map-picker.js";
|
|
13
13
|
import { useViewsList } from "./views-list.js";
|
|
14
|
-
import {
|
|
14
|
+
import { PanelHeadButton } from "../internal/head-button.js";
|
|
15
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
15
16
|
import { SheetPartsFrom } from "../sheet/sheet-parts.js";
|
|
16
17
|
import { Icon } from "../internal/icons.js";
|
|
17
18
|
export function viewsListWordsOf(say, createLabel) {
|
|
@@ -59,7 +60,7 @@ export function viewsListPropsOf(p, words, notNow, AppIcon) {
|
|
|
59
60
|
}
|
|
60
61
|
},
|
|
61
62
|
onDone: p.onDone,
|
|
62
|
-
entries: (id) => menuEntries(menuOf(id) ?? [], notNow),
|
|
63
|
+
entries: (id) => menuEntries(menuOf(id) ?? [], notNow, "vk-view-menu-row"),
|
|
63
64
|
...(p.onCreate ? { onNew: p.onCreate } : {}),
|
|
64
65
|
privateViews: p.views.some((v) => v.private),
|
|
65
66
|
reorder: !!p.onReorder,
|
|
@@ -105,7 +106,7 @@ export function viewMenuWordsOf(say) {
|
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
108
|
export function MapViewsListBody(props) {
|
|
108
|
-
return props.verbs ? _jsx(WithVerbs, { ...props, verbs: props.verbs }) : _jsx(Plain, { ...props });
|
|
109
|
+
return _jsx(PanelControlsFromViews, { children: props.verbs ? _jsx(WithVerbs, { ...props, verbs: props.verbs }) : _jsx(Plain, { ...props }) });
|
|
109
110
|
}
|
|
110
111
|
const _menuChangeIsTheSlots = true;
|
|
111
112
|
const _menuAskIsTheConfirmPort = true;
|
|
@@ -116,7 +117,7 @@ function useStepHead(step, props) {
|
|
|
116
117
|
const setParts = React.useContext(SheetPartsFrom);
|
|
117
118
|
React.useLayoutEffect(() => { setParts?.(step ? { title: step.title, head: { onBack: step.onBack } } : null); });
|
|
118
119
|
React.useLayoutEffect(() => () => setParts?.(null), [setParts]);
|
|
119
|
-
return step && props.actions?.back && !setParts ? (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-views-list-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: step.title }), right: _jsx("span", {}), left: _jsx(
|
|
120
|
+
return step && props.actions?.back && !setParts ? (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-views-list-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: step.title }), right: _jsx("span", {}), left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-back", "aria-label": props.actions.back.label, className: "o-sheet-back", icon: _jsx(Icon, { name: "left" }), onClick: props.actions.back.onPress }) }) })) : null;
|
|
120
121
|
}
|
|
121
122
|
function Plain(props) {
|
|
122
123
|
const context = React.useContext(ViewsContext);
|
|
@@ -129,7 +130,7 @@ function Plain(props) {
|
|
|
129
130
|
const shown = props.form === "phone" ? props.views.find((v) => v.value === menuFor) : undefined;
|
|
130
131
|
const step = shown ? {
|
|
131
132
|
title: shown.label, onBack: () => setMenuFor(null),
|
|
132
|
-
body: _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: shown.label, ...tilesOf(leavingFirst(base.entries(shown.value), () => setMenuFor(null))), ...(closeRow ? { onClose: () => setMenuFor(null) } : {}), closeWord: words.menu?.close ?? say({ key: "views.panels.close" }) }) }),
|
|
133
|
+
body: _jsx("div", { style: { display: "contents" }, "data-slot": "vk-view-menu", ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: shown.label, ...tilesOf(leavingFirst(base.entries(shown.value), () => setMenuFor(null))), ...(closeRow ? { onClose: () => setMenuFor(null) } : {}), closeWord: words.menu?.close ?? say({ key: "views.panels.close" }) }) }),
|
|
133
134
|
} : null;
|
|
134
135
|
const list = useViewsList({ ...base, onMenu: setMenuFor, step });
|
|
135
136
|
const head = useStepHead(step, props);
|
|
@@ -2,11 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Alert } from "../alert/alert.js";
|
|
4
4
|
import { AlertDialog } from "../alert-dialog/alert-dialog.js";
|
|
5
|
-
import { Button } from "../button/button.js";
|
|
6
5
|
import { Field } from "../field/field.js";
|
|
7
|
-
import { Input } from "../input/input.js";
|
|
8
6
|
import { asSelect, OnTop } from "../internal/editor-parts.js";
|
|
9
7
|
import { Icon } from "../internal/icons.js";
|
|
8
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
10
9
|
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
11
10
|
import { menuEntries } from "../menu/map-menu.js";
|
|
12
11
|
import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
|
|
@@ -14,7 +13,6 @@ import { MenuList, tilesOf, useMenuListOption, useMenuListRows } from "../menu-l
|
|
|
14
13
|
import { Modal } from "../modal/modal.js";
|
|
15
14
|
import { Picker } from "../picker/picker.js";
|
|
16
15
|
import { Radio, RadioGroup } from "../radio/radio.js";
|
|
17
|
-
import { Select } from "../select/select.js";
|
|
18
16
|
import { useInToast, useToast } from "../toast/toast.js";
|
|
19
17
|
import { canDelete, deleteLine } from "./rules.js";
|
|
20
18
|
import { LOCK, useViewsListWorn } from "./views-list.js";
|
|
@@ -30,6 +28,7 @@ function ToastBridge({ onSend }) {
|
|
|
30
28
|
}
|
|
31
29
|
export function useViewMenu(props) {
|
|
32
30
|
const { views, open, layouts, columns, records, onChange, onDone, ask: askPort, report } = props;
|
|
31
|
+
const { Button, Input, Select } = usePanelControls();
|
|
33
32
|
const w = React.useMemo(() => ({ ...VIEW_MENU_WORDS, ...props.words }), [props.words]);
|
|
34
33
|
const screen = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (screen || small ? "phone" : "computer")) === "phone";
|
|
35
34
|
const stepping = phone && !!props.steps;
|
|
@@ -169,7 +168,7 @@ export function useViewMenu(props) {
|
|
|
169
168
|
const done = (run, disabled, label) => (_jsx("div", { className: "o-views-list-step-foot", children: _jsx(Button, { kind: "primary", className: "o-views-list-step-act", "data-slot": "vk-view-menu-act", disabled: disabled, onClick: () => { run(); toList(); }, children: label }) }));
|
|
170
169
|
if (asked.what === "menu" && target) {
|
|
171
170
|
const leaving = (list) => list.map((e) => e.kind === undefined || e.kind === "action" ? { ...e, onSelect: () => { toList(); e.onSelect?.(); } } : e.kind === "group" ? { ...e, entries: leaving(e.entries) } : e);
|
|
172
|
-
return { title: target.name, onBack: toList, body: _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: target.name, ...tilesOf(leaving(entries(target.id))), ...(closeRow ? { onClose: toList } : {}), closeWord: w.close }) }) };
|
|
171
|
+
return { title: target.name, onBack: toList, body: _jsx("div", { style: { display: "contents" }, "data-slot": "vk-view-menu", ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: target.name, ...tilesOf(leaving(entries(target.id))), ...(closeRow ? { onClose: toList } : {}), closeWord: w.close }) }) };
|
|
173
172
|
}
|
|
174
173
|
if (asked.what === "rename" && target)
|
|
175
174
|
return { title: w.renameTitle, onBack: () => ask({ what: "menu", id: target.id }), body: _jsxs(_Fragment, { children: [_jsx("div", { className: "o-views-list-form", children: nameField(saveName) }), done(saveName, !name.trim(), w.save)] }) };
|