viewkitjs 0.36.0 → 0.37.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 +49 -0
- package/package.json +1 -1
- package/views/dist/atoms/types.d.ts +32 -4
- package/views/dist/contract.d.ts +14 -8
- package/views/dist/contract.js +14 -1
- package/views/dist/controls/button/own-look-moved.d.ts +11 -0
- package/views/dist/controls/button/own-look-moved.js +3 -0
- package/views/dist/controls/date-editor/date-behaviour.d.ts +80 -0
- package/views/dist/controls/date-editor/date-behaviour.js +187 -0
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -2
- package/views/dist/controls/date-editor/date-editor.js +29 -166
- package/views/dist/controls/field/field.d.ts +3 -2
- package/views/dist/controls/field/field.js +7 -2
- package/views/dist/controls/field/looks.d.ts +1 -1
- package/views/dist/controls/field/looks.js +5 -4
- package/views/dist/controls/field.css +4 -0
- package/views/dist/controls/filter-editor/filter-editor.js +2 -2
- package/views/dist/controls/filter-editor/parts.d.ts +2 -0
- package/views/dist/controls/filter-editor/parts.js +1 -1
- package/views/dist/controls/index.d.ts +3 -1
- package/views/dist/controls/index.js +3 -1
- package/views/dist/controls/inline-input.css +9 -0
- package/views/dist/controls/internal/phone.d.ts +1 -1
- package/views/dist/controls/internal/phone.js +3 -2
- package/views/dist/controls/list/tokens.d.ts +1 -1
- package/views/dist/controls/list/tokens.js +1 -1
- package/views/dist/controls/list.css +5 -2
- package/views/dist/controls/menu-list/menu-list.js +3 -2
- package/views/dist/controls/menu.css +4 -4
- package/views/dist/controls/pane.css +1 -1
- package/views/dist/controls/picker.css +5 -3
- package/views/dist/controls/popover/looks.d.ts +1 -1
- package/views/dist/controls/popover/looks.js +5 -0
- package/views/dist/controls/popover/tokens.d.ts +13 -1
- package/views/dist/controls/popover/tokens.js +4 -1
- package/views/dist/controls/popover.css +59 -8
- package/views/dist/controls/select/select.js +1 -1
- package/views/dist/controls/sort-editor.css +4 -2
- package/views/dist/controls/text-editor.css +6 -0
- package/views/dist/controls/toolbar/toolbar.d.ts +4 -2
- package/views/dist/controls/toolbar/toolbar.js +7 -2
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +1 -1
- package/views/dist/controls/toolbar.css +5 -0
- package/views/dist/controls/tooltip/tokens.d.ts +1 -1
- package/views/dist/controls/tooltip/tokens.js +1 -1
- package/views/dist/controls/tooltip.css +5 -3
- package/views/dist/controls/values-editor.css +20 -5
- package/views/dist/display/entity-chip.d.ts +7 -1
- package/views/dist/display/entity-chip.js +2 -1
- package/views/dist/field-row/FieldRow.js +12 -8
- package/views/dist/grid/chrome/GridCellEditors.d.ts +4 -1
- package/views/dist/grid/chrome/GridCellEditors.js +3 -2
- package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -5
- package/views/dist/grid/chrome/GridCellOutline.js +3 -5
- package/views/dist/grid/chrome/GridChipsEditor.js +1 -1
- package/views/dist/grid/chrome/GridDateEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridDateEditor.js +1 -1
- package/views/dist/grid/chrome/GridLongTextEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridLongTextEditor.js +8 -5
- package/views/dist/grid/chrome/GridNameEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridNameEditor.js +1 -1
- package/views/dist/grid/chrome/GridNumberEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridNumberEditor.js +2 -2
- package/views/dist/grid/chrome/GridPlaceEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridPlaceEditor.js +1 -1
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +2 -2
- package/views/dist/grid/chrome/GridRangeEditor.js +1 -1
- package/views/dist/grid/chrome/GridRelationEditor.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +6 -5
- package/views/dist/grid/chrome/GridSelectEditor.js +1 -1
- package/views/dist/grid/chrome/GridTable.d.ts +2 -1
- package/views/dist/grid/chrome/GridTable.js +7 -2
- package/views/dist/grid/chrome/GridTextEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridTextEditor.js +2 -2
- package/views/dist/grid/chrome/GridValueListEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridValueListEditor.js +1 -1
- package/views/dist/grid/chrome/grid-body-place.d.ts +7 -2
- package/views/dist/grid/chrome/grid-body-place.js +8 -4
- package/views/dist/grid/chrome/grid-cell-classes.js +2 -2
- package/views/dist/grid/chrome/grid-edit-session.d.ts +4 -0
- package/views/dist/grid/chrome/grid-edit-session.js +10 -1
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +10 -0
- package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
- package/views/dist/grid/chrome/grid-fitted-box.d.ts +4 -4
- package/views/dist/grid/chrome/grid-fitted-box.js +1 -3
- package/views/dist/grid/chrome/grid-hover.d.ts +3 -3
- package/views/dist/grid/chrome/grid-hover.js +2 -3
- package/views/dist/grid/chrome/grid-row-props.d.ts +6 -2
- package/views/dist/grid/chrome/grid-styles.d.ts +1 -5
- package/views/dist/grid/chrome/grid-styles.js +0 -1
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +0 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +2 -10
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +3 -1
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +24 -1
- package/views/dist/grid/core/useGridEditing.d.ts +3 -0
- package/views/dist/grid/core/useGridEditing.js +2 -0
- package/views/dist/grid/grid.css +4 -19
- package/views/dist/internal/screen-forms.d.ts +11 -0
- package/views/dist/internal/screen-forms.js +31 -0
- package/views/dist/list/list.js +2 -1
- package/views/dist/list/parts.d.ts +8 -2
- package/views/dist/list/parts.js +31 -7
- package/views/dist/list/toolbar.js +7 -3
- package/views/dist/looks/index.d.ts +1 -0
- package/views/dist/looks/index.js +1 -0
- package/views/dist/panels/react/popover.d.ts +3 -1
- package/views/dist/panels/react/popover.js +2 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +6 -3
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +12 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +5 -1
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarButton.js +3 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -3
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +28 -20
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/context.d.ts +3 -2
- package/views/dist/panels/react/views-row/FoldingViewRow.js +24 -7
- package/views/dist/panels/react/views-row/ViewPicker.js +1 -1
- package/views/dist/panels/react/views-row/more-views.d.ts +2 -0
- package/views/dist/panels/react/views-row/more-views.js +3 -0
- package/views/dist/panels/react.d.ts +1 -1
- package/views/dist/panels/toolbar/model.d.ts +2 -2
- package/views/dist/provider/components.d.ts +6 -6
- package/views/dist/provider/desktop.d.ts +2 -1
- package/views/dist/provider/desktop.js +5 -2
- package/views/dist/styles.css +181 -80
- package/views/dist/styles.unlayered.css +181 -80
- package/views/docs/contract.md +68 -20
- package/views/docs/controls/list.md +2 -0
- package/views/docs/controls/menu.md +2 -0
- package/views/docs/controls/picker.md +2 -0
- package/views/docs/controls/popover.md +7 -0
- package/views/docs/controls/tooltip.md +2 -0
- package/views/docs/guides/atoms.md +11 -10
- package/views/docs/guides/the-grid.md +7 -5
- package/views/docs/guides/the-provider.md +2 -2
- package/views/docs/reference/controls.md +11 -6
- package/views/docs/reference/display.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/list.md +5 -6
- package/views/docs/reference/looks.md +4 -1
- package/views/docs/reference/panels-react.md +5 -4
- package/views/docs/reference/panels.md +1 -1
- package/views/docs/reference/react.md +6 -6
- package/views/docs/reference/views.md +2 -2
- package/views/docs/reshaping.md +2 -2
- package/views/skills/views/SKILL.md +1 -1
|
@@ -51,6 +51,7 @@ const keepRow = (ev) => {
|
|
|
51
51
|
(row?.tagName === "LABEL" ? row.querySelector('[role="switch"]') : row)?.focus({ preventScroll: true });
|
|
52
52
|
};
|
|
53
53
|
const rowToggle = (t) => t ? (_jsx(Toggle, { kind: "quiet", shape: "icon", size: "xs", className: "o-menu-toggle", tabIndex: -1, "aria-label": t.label, icon: t.icon, pressed: t.on, readOnly: !!t.disabled, ...(t.disabled ? { title: t.disabled } : {}), onPressedChange: () => t.onPress(), onMouseDown: keepRow, onClick: (ev) => ev.stopPropagation() })) : null;
|
|
54
|
+
const saysOf = (row) => row.disabled ?? row.toggle?.disabled ?? row.note;
|
|
54
55
|
const rowOpen = (name, glyphOf, onOpen) => name ? (_jsx(Button, { kind: "quiet", shape: "icon", size: "xs", className: "o-menu-open", tabIndex: -1, "aria-label": name, icon: glyphOf, onMouseDown: keepRow, onClick: (ev) => { ev.stopPropagation(); onOpen?.(); } })) : null;
|
|
55
56
|
const part = (id, p) => (id ? `${id}-${p}` : undefined);
|
|
56
57
|
const named = (id) => ["n", "v", "k", "c"].map((p) => `${id}-${p}`).join(" ");
|
|
@@ -336,7 +337,7 @@ function PhoneRow({ row, onOpen, move, room, ticks = "switch", words = MENU_LIST
|
|
|
336
337
|
if (row.kind === "check" && ticks === "eye")
|
|
337
338
|
return _jsx(PhoneEye, { row: row, lead: lead, mv: mv, how: how, onOpen: onOpen && (() => onOpen(row)) });
|
|
338
339
|
if (row.kind === "check")
|
|
339
|
-
return (_jsxs("label", { className: "o-menu-list-row", ...mv, ...named.label, children: [lead, row.icon && _jsx("span", { className: "o-menu-list-mark", children: row.icon }), _jsxs("span", { className: "o-menu-list-name", children: [_jsx("span", { children: row.label }), (row
|
|
340
|
+
return (_jsxs("label", { className: "o-menu-list-row", ...mv, ...named.label, children: [lead, row.icon && _jsx("span", { className: "o-menu-list-mark", children: row.icon }), _jsxs("span", { className: "o-menu-list-name", children: [_jsx("span", { children: row.label }), saysOf(row) != null && _jsx("span", { className: "o-menu-list-note", children: saysOf(row) })] }), rowToggle(row.toggle), _jsx(Switch, { size: "lg", checked: row.checked, defaultChecked: row.defaultChecked, onCheckedChange: (c) => row.onCheckedChange?.(c), disabled: !!row.disabled, words: [words.on, words.off], ...how, ...named.tick }), rowOpen(row.opens, glyph(MORE, "o-menu-list-more"), onOpen && (() => onOpen(row)))] }));
|
|
340
341
|
if (row.kind === "link") {
|
|
341
342
|
const attrs = { className: "o-menu-list-row", ...mv, ...how, ...(row.external ? { target: "_blank", rel: "noreferrer" } : {}) };
|
|
342
343
|
const inside = _jsxs(_Fragment, { children: [lead, body(row), endOf(row), row.external ? glyph(AWAY, "o-menu-list-more") : glyph(MORE, "o-menu-list-more")] });
|
|
@@ -358,7 +359,7 @@ function PhoneEye({ row, lead, mv, how, onOpen }) {
|
|
|
358
359
|
const [own, setOwn] = React.useState(!!row.defaultChecked), on = row.checked ?? own;
|
|
359
360
|
const press = () => { const next = !on; if (row.checked === undefined)
|
|
360
361
|
setOwn(next); row.onCheckedChange?.(next); };
|
|
361
|
-
return (_jsxs(BaseButton, { className: "o-menu-list-row", ...mv, ...how, role: "switch", "aria-checked": on, disabled: !!row.disabled, focusableWhenDisabled: true, onClick: press, ...(row.toggle || row.opens ? { nativeButton: false, render: _jsx("div", {}) } : {}), children: [lead, row.icon && _jsx("span", { className: "o-menu-list-mark", children: row.icon }), _jsxs("span", { className: "o-menu-list-name", children: [_jsx("span", { children: row.label }), (row
|
|
362
|
+
return (_jsxs(BaseButton, { className: "o-menu-list-row", ...mv, ...how, role: "switch", "aria-checked": on, disabled: !!row.disabled, focusableWhenDisabled: true, onClick: press, ...(row.toggle || row.opens ? { nativeButton: false, render: _jsx("div", {}) } : {}), children: [lead, row.icon && _jsx("span", { className: "o-menu-list-mark", children: row.icon }), _jsxs("span", { className: "o-menu-list-name", children: [_jsx("span", { children: row.label }), saysOf(row) != null && _jsx("span", { className: "o-menu-list-note", children: saysOf(row) })] }), rowToggle(row.toggle), eyeOf(on, "o-menu-list-eye"), rowOpen(row.opens, glyph(MORE, "o-menu-list-more"), onOpen)] }));
|
|
362
363
|
}
|
|
363
364
|
export function MenuList({ label, entries, tiles, onOpen, onClose, closeWord = "Close", onMove, ticks, className, words: given }) {
|
|
364
365
|
const w = listWords(given);
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
takes a press on that overlay's dim and closes alone. ─────────────────────────────────────────────────── */
|
|
11
11
|
.o-menu-portal > [role="presentation"] { z-index: var(--vk-layer-popup); }
|
|
12
12
|
|
|
13
|
-
/* ── The panel: it fits its widest row, 208px to 320px; its shadow, edge, corners and padding the list's options (list.css) ── */
|
|
14
|
-
.o-list.o-menu { width: max-content; min-width: calc(var(--vk-spacing) * 52); max-width: calc(var(--vk-spacing) * 80); }
|
|
15
|
-
/* Never taller than the room on screen: its rows, which alone scroll (MenuScroll, menu-list.css), stand in the panel's
|
|
13
|
+
/* ── The panel: it fits its widest row, 208px to 320px, or stands at the app's --vk-menu-w (docs/contract.md, Tokens); its shadow, edge, corners and padding the list's options (list.css) ── */
|
|
14
|
+
.o-list.o-menu { width: var(--vk-menu-w, max-content); min-width: var(--vk-menu-w, calc(var(--vk-spacing) * 52)); max-width: var(--vk-menu-w, calc(var(--vk-spacing) * 80)); }
|
|
15
|
+
/* Never taller than the room on screen, nor the app's --vk-menu-max-h: its rows, which alone scroll (MenuScroll, menu-list.css), stand in the panel's
|
|
16
16
|
padding, the kit's scrollbar over them; the panel and its edge stay still. */
|
|
17
|
-
.o-list.o-menu { max-height: var(--available-height); grid-template-rows: minmax(0, 1fr); }
|
|
17
|
+
.o-list.o-menu { max-height: min(var(--vk-menu-max-h, var(--available-height)), var(--available-height)); grid-template-rows: minmax(0, 1fr); }
|
|
18
18
|
|
|
19
19
|
/* ── The ⋯ button: under the pointer and while its menu is open, the neutral fill and the text colour ─ */
|
|
20
20
|
.o-button.o-menu-dots { color: var(--vk-fg-subtle); }
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
/* Its title, when what stands in it has one: text-sm at medium weight. */
|
|
59
59
|
.o-pane-title { margin: 0; font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); font-weight: var(--vk-font-weight-medium); color: var(--vk-fg); }
|
|
60
60
|
|
|
61
|
-
/* It fades in and moves a step in from the right
|
|
61
|
+
/* It fades in and moves a step in from the right, in 150ms, and leaves the same way, easing in. */
|
|
62
62
|
.o-pane[data-ending-style] { transition-timing-function: var(--vk-ease-in); }
|
|
63
63
|
.o-pane:is([data-starting-style], [data-ending-style]) { opacity: 0; translate: var(--vk-spacing) 0; }
|
|
64
64
|
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
|
|
64
64
|
/* ── On a computer it follows the list's rules, so a Picker and a Select's list side by
|
|
65
65
|
side match. Its rows are the list's: the Input box's corners or Row corners, square at padding 0 (list.css), 8½ rows at most
|
|
66
|
-
(list-rows), a row's room round the one brought into view. And a Popover holding it, and no editor, draws the list's panel in
|
|
66
|
+
(--vk-list-rows, the app's, or its old name --list-rows), a row's room round the one brought into view. And a Popover holding it, and no editor, draws the list's panel in
|
|
67
67
|
place of its own options: the list's Edge (its lines' colour with it), Shadow and Padding, its corners the Input box's plus the padding, never past 2xl,
|
|
68
68
|
and its Corner smoothing (the list's smooth outline, or round), the Popover's own smooth outline not drawn. A body picks the shell's
|
|
69
69
|
options it needs; the Popover knows nothing of what it holds. ── */
|
|
70
70
|
.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))));
|
|
71
71
|
--list-row-pill-in: var(--list-row-corners-pill, var(--list-row-pill, var(--list-box-pill, 0))); }
|
|
72
72
|
.o-picker[data-picker-form="computer"] .o-picker-rows {
|
|
73
|
-
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));
|
|
73
|
+
max-height: calc(var(--vk-list-rows, 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));
|
|
74
74
|
}
|
|
75
75
|
/* ViewKit's field list (CONTROLS.FieldsBody, wrapped in .o-fields-body, which draws no box) stands as wide as its widest row:
|
|
76
76
|
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
|
|
@@ -80,7 +80,9 @@
|
|
|
80
80
|
/* Never narrower than it opened nor than its search's placeholder (map-fields-body.tsx measures both as it opens). */
|
|
81
81
|
.o-fields-body .o-picker[data-picker-form="computer"] { min-width: var(--picker-floor, 0px); }
|
|
82
82
|
.o-fields-body .o-picker[data-picker-form="computer"] .o-list-row:not([data-selected], [aria-selected="true"]) > .o-picker-check { display: none; }
|
|
83
|
-
.o-popover:has(> .o-popover-cut > .o-fields-body .o-picker[data-picker-form="computer"]) {
|
|
83
|
+
.o-popover:has(> .o-popover-cut > .o-fields-body .o-picker[data-picker-form="computer"]) {
|
|
84
|
+
width: var(--popover-size-w, fit-content); max-width: min(var(--popover-size-w, calc(var(--vk-spacing) * 72)), var(--available-width, 100%));
|
|
85
|
+
}
|
|
84
86
|
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])) {
|
|
85
87
|
--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));
|
|
86
88
|
--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)));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PieceLooks } from "../../looks/looks.js";
|
|
2
|
-
export type PopoverLookOptionId = "corners" | "smoothing" | "shadow" | "edge" | "padding" | "gap";
|
|
2
|
+
export type PopoverLookOptionId = "corners" | "smoothing" | "shadow" | "edge" | "padding" | "gap" | "motion" | "distance" | "open" | "close" | "ease";
|
|
3
3
|
/** The Popover's options. */
|
|
4
4
|
export declare const POPOVER_LOOKS: PieceLooks<PopoverLookOptionId>;
|
|
@@ -6,5 +6,10 @@ const options = [
|
|
|
6
6
|
{ id: "edge", name: "Edge", device: "desktop", def: "outline", values: [{ id: "outline", name: "Outline" }, { id: "subtle", name: "Subtle" }, { id: "none", name: "None" }] },
|
|
7
7
|
{ id: "padding", name: "Padding", device: "desktop", def: "8", kind: "steps", values: steps(["0", "4", "8", "12", "16"]) },
|
|
8
8
|
{ id: "gap", name: "Gap", device: "desktop", def: "4", kind: "steps", values: steps(["0", "4", "8"]) },
|
|
9
|
+
{ id: "motion", name: "How it comes", device: "desktop", def: "nudge", values: [{ id: "fade", name: "Fades" }, { id: "nudge", name: "Fades and nudges" }, { id: "scale", name: "Fades and grows" }, { id: "none", name: "None" }] },
|
|
10
|
+
{ id: "distance", name: "How far", device: "desktop", def: "medium", kind: "steps", unless: ["motion", ["fade", "none"]], values: [{ id: "small", name: "Small" }, { id: "medium", name: "Medium" }, { id: "large", name: "Large" }] },
|
|
11
|
+
{ id: "open", name: "Opens in", device: "desktop", def: "150", kind: "steps", unless: ["motion", "none"], values: steps(["100", "150", "200", "300"]) },
|
|
12
|
+
{ id: "close", name: "Closes in", device: "desktop", def: "150", kind: "steps", unless: ["motion", "none"], values: steps(["75", "100", "150", "200"]) },
|
|
13
|
+
{ id: "ease", name: "Ease", device: "desktop", def: "out", unless: ["motion", "none"], values: [{ id: "out", name: "Ease out" }, { id: "sharp", name: "Sharp" }, { id: "smooth", name: "Ease in and out" }, { id: "spring", name: "Spring" }] },
|
|
9
14
|
];
|
|
10
15
|
export const POPOVER_LOOKS = { id: "popover", name: "Popover", options, looks: [] };
|
|
@@ -78,6 +78,18 @@ export declare const POPOVER_TOKENS: readonly [{
|
|
|
78
78
|
readonly name: "--vk-ease-in";
|
|
79
79
|
readonly kind: "motion";
|
|
80
80
|
readonly outright: "--ease-in";
|
|
81
|
+
}, {
|
|
82
|
+
readonly name: "--vk-ease-out-sharp";
|
|
83
|
+
readonly kind: "motion";
|
|
84
|
+
readonly outright: "--ease-out-sharp";
|
|
85
|
+
}, {
|
|
86
|
+
readonly name: "--vk-ease-in-out";
|
|
87
|
+
readonly kind: "motion";
|
|
88
|
+
readonly outright: "--ease-in-out";
|
|
89
|
+
}, {
|
|
90
|
+
readonly name: "--vk-ease-spring";
|
|
91
|
+
readonly kind: "motion";
|
|
92
|
+
readonly outright: "--ease-spring";
|
|
81
93
|
}];
|
|
82
94
|
/** The prefixes of its own machinery, set and read by it alone: not public. */
|
|
83
|
-
export declare const POPOVER_PRIVATE: readonly ["--popover-", "--divider-", "--anchor-", "--available-"];
|
|
95
|
+
export declare const POPOVER_PRIVATE: readonly ["--popover-", "--divider-", "--anchor-", "--available-", "--transform-origin"];
|
|
@@ -19,5 +19,8 @@ export const POPOVER_TOKENS = [
|
|
|
19
19
|
{ name: "--vk-duration-fast", kind: "motion", outright: "--duration-fast" },
|
|
20
20
|
{ name: "--vk-ease-out", kind: "motion", outright: "--ease-out" },
|
|
21
21
|
{ name: "--vk-ease-in", kind: "motion", outright: "--ease-in" },
|
|
22
|
+
{ name: "--vk-ease-out-sharp", kind: "motion", outright: "--ease-out-sharp" },
|
|
23
|
+
{ name: "--vk-ease-in-out", kind: "motion", outright: "--ease-in-out" },
|
|
24
|
+
{ name: "--vk-ease-spring", kind: "motion", outright: "--ease-spring" },
|
|
22
25
|
];
|
|
23
|
-
export const POPOVER_PRIVATE = ["--popover-", "--divider-", "--anchor-", "--available-"];
|
|
26
|
+
export const POPOVER_PRIVATE = ["--popover-", "--divider-", "--anchor-", "--available-", "--transform-origin"];
|
|
@@ -12,6 +12,17 @@
|
|
|
12
12
|
data-popover-padding 0 · 4 · 8 · 12 · 16 how far what it holds stands from its edge
|
|
13
13
|
data-popover-gap 0 · 4 · 8 how far it stands from what opened it (none laid over it)
|
|
14
14
|
|
|
15
|
+
How it moves is every popup's (this one, the Menu's and the Select's list, the Tooltip), by the contract's popup motion names
|
|
16
|
+
(docs/contract.md, Tokens): --vk-popup-open-duration, --vk-popup-close-duration, --vk-popup-open-ease, --vk-popup-close-ease,
|
|
17
|
+
--vk-popup-nudge and --vk-popup-scale, each read with today's motion where none is declared. The Popover's picks set them on
|
|
18
|
+
the frame itself, so every popup inside it, an app's own too, moves the same; a default pick sets nothing:
|
|
19
|
+
|
|
20
|
+
data-popover-motion fade · nudge · scale · none fades; fades and nudges out from what opened it; fades and grows; none
|
|
21
|
+
data-popover-distance small · medium · large how far it nudges (2, 4 or 8px), or what it grows from (98, 95 or 90%)
|
|
22
|
+
data-popover-open 100 · 150 · 200 · 300 how many ms it takes to open
|
|
23
|
+
data-popover-close 75 · 100 · 150 · 200 how many ms it takes to close
|
|
24
|
+
data-popover-ease out · sharp · smooth · spring its ease: out, then in as it goes; sharp; in and out both ways; a spring
|
|
25
|
+
|
|
15
26
|
On the popup itself, `data-popover-chrome="menu"` marks a popup that holds a list (the components map's `chrome`): the Outright
|
|
16
27
|
look draws it as its card, as its editors were approved; an app's own styles may draw it otherwise.
|
|
17
28
|
|
|
@@ -31,12 +42,31 @@
|
|
|
31
42
|
--popover-gap: var(--vk-spacing); --popover-edge: var(--vk-border); --divider-colour: var(--vk-border);
|
|
32
43
|
--divider-reach: max(0px, calc(var(--popover-pad) - var(--vk-border-width)));
|
|
33
44
|
box-sizing: border-box; display: flex; flex-direction: column;
|
|
34
|
-
|
|
45
|
+
--popover-size-w: initial; --popover-size-h: initial;
|
|
46
|
+
width: var(--popover-size-w, calc(var(--vk-spacing) * 72)); min-width: var(--popover-size-w, var(--anchor-width, auto));
|
|
47
|
+
max-width: var(--available-width, 100%); max-height: var(--popover-size-h, var(--available-height, none));
|
|
35
48
|
border-radius: var(--popover-corners); background-color: var(--vk-overlay); box-shadow: var(--popover-shadow); color: var(--vk-fg);
|
|
36
49
|
font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); outline: none;
|
|
37
|
-
|
|
50
|
+
--popover-nudge: var(--vk-popup-nudge, var(--vk-spacing)); transform-origin: var(--transform-origin);
|
|
51
|
+
transition-property: opacity, translate, scale;
|
|
52
|
+
transition-duration: var(--vk-popup-open-duration, var(--vk-duration-fast));
|
|
53
|
+
transition-timing-function: var(--vk-popup-open-ease, var(--vk-ease-out));
|
|
38
54
|
}
|
|
39
55
|
|
|
56
|
+
/* ── Its size, by what it holds (VK-992): a toolbar panel's, marked by its slot, the app's --vk-panel-w and --vk-panel-max-h; a field
|
|
57
|
+
editor's, the app's --vk-editor-w and --vk-editor-max-h (docs/contract.md, Tokens). Undeclared, the size here is invalid, so each
|
|
58
|
+
place's own width stands (above, or a rule of what it holds reading --popover-size-w first); declared, it is the width, and the
|
|
59
|
+
height at the most, never past the room on screen. ─────────────────────────────────────────────────────────── */
|
|
60
|
+
.o-popover:where([data-slot^="vk-toolbar-"][data-slot$="-panel"]) {
|
|
61
|
+
--popover-size-w: var(--vk-panel-w); --popover-size-h: min(var(--vk-panel-max-h), var(--available-height, 100dvh));
|
|
62
|
+
}
|
|
63
|
+
.o-popover:where([data-slot="vk-grid-editor"], [data-slot="vk-editor-panel"]) {
|
|
64
|
+
--popover-size-w: var(--vk-editor-w); --popover-size-h: min(var(--vk-editor-max-h), var(--available-height, 100dvh));
|
|
65
|
+
}
|
|
66
|
+
/* A grid editor over its cell stands a step left of it (the grid's overCell offsets): at the least the cell's width and two
|
|
67
|
+
steps, so it covers the cell's far line too and a press where the cell was lands inside it. */
|
|
68
|
+
.o-popover:where([data-slot="vk-grid-editor"]) { min-width: var(--popover-size-w, calc(var(--anchor-width, 0px) + var(--vk-spacing) * 2)); }
|
|
69
|
+
|
|
40
70
|
/* What it holds, inside its edge, scrolling there when the screen is shorter. The edge is drawn as two shapes, never a
|
|
41
71
|
border, as the Modal's is: its colour (::before), and the ground just inside it (::after), one line narrower. Each
|
|
42
72
|
takes its own corner, its inset less, so the edge follows the corners exactly, round or smooth. */
|
|
@@ -53,12 +83,14 @@
|
|
|
53
83
|
/* Laid over what opens it (a negative sideOffset), it stands on it: no gap. */
|
|
54
84
|
.o-popover[data-over] { margin: 0; }
|
|
55
85
|
|
|
56
|
-
/* It fades in and moves 4px out from what opened it
|
|
57
|
-
.o-popover[data-ending-style] {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.o-popover
|
|
61
|
-
.o-popover[data-side="
|
|
86
|
+
/* It fades in and moves 4px out from what opened it, in 150ms, and leaves the same way, easing in; or as the popup motion names say. */
|
|
87
|
+
.o-popover[data-ending-style] {
|
|
88
|
+
transition-duration: var(--vk-popup-close-duration, var(--vk-duration-fast)); transition-timing-function: var(--vk-popup-close-ease, var(--vk-ease-in));
|
|
89
|
+
}
|
|
90
|
+
.o-popover:is([data-starting-style], [data-ending-style]) { opacity: 0; translate: 0 calc(var(--popover-nudge) * -1); scale: var(--vk-popup-scale, none); }
|
|
91
|
+
.o-popover[data-side="top"]:is([data-starting-style], [data-ending-style]) { translate: 0 var(--popover-nudge); }
|
|
92
|
+
.o-popover[data-side="left"]:is([data-starting-style], [data-ending-style]) { translate: var(--popover-nudge) 0; }
|
|
93
|
+
.o-popover[data-side="right"]:is([data-starting-style], [data-ending-style]) { translate: calc(var(--popover-nudge) * -1) 0; }
|
|
62
94
|
|
|
63
95
|
/* ── What an app sets once ───────────────────────────────────────────────────────────────────────────────────── */
|
|
64
96
|
[data-popover-corners="lg"] .o-popover { --popover-corners: var(--vk-radius-lg); }
|
|
@@ -75,6 +107,25 @@
|
|
|
75
107
|
[data-popover-gap="0"] .o-popover { --popover-gap: 0px; }
|
|
76
108
|
[data-popover-gap="8"] .o-popover { --popover-gap: calc(var(--vk-spacing) * 2); }
|
|
77
109
|
|
|
110
|
+
/* How it moves: on the frame itself, the public names every popup inside it reads. Each value is the pick's own (a frame need declare
|
|
111
|
+
no token for it), the eases the motion tokens; None comes last, so it stills whatever the times say. */
|
|
112
|
+
[data-popover-distance="small"] { --vk-popup-nudge: 2px; }
|
|
113
|
+
[data-popover-distance="large"] { --vk-popup-nudge: 8px; }
|
|
114
|
+
:is([data-popover-motion="fade"], [data-popover-motion="scale"]) { --vk-popup-nudge: 0px; }
|
|
115
|
+
[data-popover-motion="scale"] { --vk-popup-scale: 0.95; }
|
|
116
|
+
[data-popover-motion="scale"][data-popover-distance="small"] { --vk-popup-scale: 0.98; }
|
|
117
|
+
[data-popover-motion="scale"][data-popover-distance="large"] { --vk-popup-scale: 0.9; }
|
|
118
|
+
[data-popover-open="100"] { --vk-popup-open-duration: 100ms; }
|
|
119
|
+
[data-popover-open="200"] { --vk-popup-open-duration: 200ms; }
|
|
120
|
+
[data-popover-open="300"] { --vk-popup-open-duration: 300ms; }
|
|
121
|
+
[data-popover-close="75"] { --vk-popup-close-duration: 75ms; }
|
|
122
|
+
[data-popover-close="100"] { --vk-popup-close-duration: 100ms; }
|
|
123
|
+
[data-popover-close="200"] { --vk-popup-close-duration: 200ms; }
|
|
124
|
+
[data-popover-ease="sharp"] { --vk-popup-open-ease: var(--vk-ease-out-sharp); }
|
|
125
|
+
[data-popover-ease="smooth"] { --vk-popup-open-ease: var(--vk-ease-in-out); --vk-popup-close-ease: var(--vk-ease-in-out); }
|
|
126
|
+
[data-popover-ease="spring"] { --vk-popup-open-ease: var(--vk-ease-spring); }
|
|
127
|
+
[data-popover-motion="none"] { --vk-popup-open-duration: 0s; --vk-popup-close-duration: 0s; }
|
|
128
|
+
|
|
78
129
|
/* ── Its corners smooth: the smooth outline (smooth.css), Apple's curve as measured, so every browser that knows
|
|
79
130
|
shape() shows it; one that doesn't keeps the corners above. The shell keeps its shadow, which a cut would take with
|
|
80
131
|
it, so .o-popover-cut inside it is cut instead, and the edge's two shapes each by the same outline at its own corner,
|
|
@@ -125,7 +125,7 @@ function listNeed(at, rows, lines) {
|
|
|
125
125
|
const probe = at.ownerDocument.createElement("div");
|
|
126
126
|
probe.style.cssText = "position:absolute;visibility:hidden;pointer-events:none;height:var(--list-row-h, calc(var(--vk-spacing) * 8));padding-top:var(--list-pad, calc(var(--vk-spacing) * 1.5));margin-top:calc(var(--vk-spacing) * 11)";
|
|
127
127
|
at.parentElement?.append(probe);
|
|
128
|
-
const s = getComputedStyle(probe), most = parseFloat(
|
|
128
|
+
const s = getComputedStyle(probe), own = getComputedStyle(at), most = parseFloat(own.getPropertyValue("--vk-list-rows")) || parseFloat(own.getPropertyValue("--list-rows")) || 8.5;
|
|
129
129
|
const need = Math.min(rows, most) * parseFloat(s.height) + 2 * parseFloat(s.paddingTop) + lines * parseFloat(s.marginTop);
|
|
130
130
|
probe.remove();
|
|
131
131
|
return need * drawnAt(at);
|
|
@@ -43,8 +43,10 @@
|
|
|
43
43
|
/* ViewKit's own Popover holding the rules on a computer (the ready toolbar's Sort): as wide as its rows, so each rule's grip, field,
|
|
44
44
|
direction and × stand inside it, never under the 288 it opens Add sort's fields at, and never past the room on screen (its own
|
|
45
45
|
--available-width, popover.css). Keyed on what it holds, so the fields with no rule keep their 288; an app's own Popover, or its own
|
|
46
|
-
width on this one, is the app's (VK-977). */
|
|
47
|
-
.o-popover:has(.o-sort-editor[data-sort-form="computer"]) {
|
|
46
|
+
width on this one, is the app's (VK-977), and the app's --vk-panel-w sets it (--popover-size-w, VK-992). */
|
|
47
|
+
.o-popover:has(.o-sort-editor[data-sort-form="computer"]) {
|
|
48
|
+
width: var(--popover-size-w, max-content); min-width: var(--popover-size-w, max(var(--anchor-width, 0px), calc(var(--vk-spacing) * 72)));
|
|
49
|
+
}
|
|
48
50
|
|
|
49
51
|
/* A list a page shows standing open: under what opens it, over the rules, as the Select's list stands, as wide as its rows, never
|
|
50
52
|
under 192 nor its box, never past 288 (listWidth, select.css). Scoped to the editor, so it wins over the smooth list's own
|
|
@@ -35,6 +35,12 @@
|
|
|
35
35
|
width: max(100%, calc(var(--vk-spacing) * 75)); max-width: none; max-height: calc(var(--vk-spacing) * 80);
|
|
36
36
|
box-shadow: var(--vk-shadow-lg), inset 0 0 0 var(--inline-input-ring, 0px) var(--inline-input-colour);
|
|
37
37
|
}
|
|
38
|
+
/* In a grid's cell (data-inline-input-place="cell", inline-input.css), never lifted, grown or long: the cell typed in shows only
|
|
39
|
+
the caret. (0,5,0): over the two lifts above. */
|
|
40
|
+
[data-inline-input-place="cell"] .o-text-editor[data-text-box][data-grown] .o-text-editor-box,
|
|
41
|
+
[data-inline-input-place="cell"] .o-text-editor[data-text-box][data-text-kind="long"] .o-text-editor-box {
|
|
42
|
+
box-shadow: inset 0 0 0 var(--inline-input-ring, 0px) var(--inline-input-colour);
|
|
43
|
+
}
|
|
38
44
|
/* What a line's own width is read by: the box's font, on one line, unseen. */
|
|
39
45
|
.o-text-editor-mirror {
|
|
40
46
|
position: absolute; top: 0; left: 0; width: max-content; height: 0; overflow: hidden; visibility: hidden; pointer-events: none;
|
|
@@ -118,8 +118,10 @@ export declare function ToolbarFolds({ children }: ToolbarFoldsProps): React.Rea
|
|
|
118
118
|
declare function stepsOf(items: React.ReactElement[]): Step[];
|
|
119
119
|
/** The steps a line takes as it narrows, for a test (stepsOf). */
|
|
120
120
|
export declare const toolbarSteps: typeof stepsOf;
|
|
121
|
-
/** The row and, under it, the filter bar: Base UI's toolbar, one Tab stop for the whole of it, the arrows inside.
|
|
122
|
-
|
|
121
|
+
/** The row and, under it, the filter bar: Base UI's toolbar, one Tab stop for the whole of it, the arrows inside. Server-rendered
|
|
122
|
+
* with no `form` told, outside a PhoneHost and a ComputerHost, it draws the phone's form and the computer's, CSS showing the
|
|
123
|
+
* screen's until the page comes alive (VK-1038). */
|
|
124
|
+
export declare function ToolbarControl(props: ToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
123
125
|
/** A line between what belongs together and what doesn't, across a line. `data-slot`, its public name where a part names it
|
|
124
126
|
* (VK-1023: the bulk bar's `vk-bulk-separator`). */
|
|
125
127
|
export declare function ToolbarSeparatorControl({ className, "data-slot": slot }: {
|
|
@@ -4,11 +4,12 @@ import * as React from "react";
|
|
|
4
4
|
import { flushSync } from "react-dom";
|
|
5
5
|
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
6
6
|
import { cx as cn } from "../../internal/cx.js";
|
|
7
|
+
import { ScreenForms } from "../../internal/screen-forms.js";
|
|
7
8
|
import { Button, ButtonGroup } from "../button/button.js";
|
|
8
9
|
import { Input, InputGroup, InputGroupAddon, InputGroupButton } from "../input/input.js";
|
|
9
10
|
import { Icon } from "../internal/icons.js";
|
|
10
11
|
import { isAppButton } from "../internal/panel-controls.js";
|
|
11
|
-
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
12
|
+
import { ComputerHost, PhoneHost, usePhone } from "../internal/phone.js";
|
|
12
13
|
import { watchFrame } from "../internal/watch-frame.js";
|
|
13
14
|
import { Menu } from "../menu/menu.js";
|
|
14
15
|
import { ToggleGroup } from "../toggle/toggle.js";
|
|
@@ -157,7 +158,11 @@ function useGiveWay(line, max, on, holds = false) {
|
|
|
157
158
|
}, [line, on, look]);
|
|
158
159
|
return stage;
|
|
159
160
|
}
|
|
160
|
-
export function ToolbarControl(
|
|
161
|
+
export function ToolbarControl(props) {
|
|
162
|
+
const host = React.useContext(PhoneHost), computer = React.useContext(ComputerHost);
|
|
163
|
+
return (_jsx(ScreenForms, { off: props.form !== undefined || host != null || computer, children: _jsx(ToolbarOnScreen, { ...props }) }));
|
|
164
|
+
}
|
|
165
|
+
function ToolbarOnScreen({ label, children, bar, barLabel: barNamed, words: given, views, settings, search, add, sort, filter, filters, save, quick, added = false, picks: said, size, barSize, spacing, fold = true, overflow, moreViews: ownViews, moreFilters: ownFilters, holds = false, form, onMoreViews, moreViewsOpen, className, style, onKeyDown, ...props }) {
|
|
161
166
|
const spoken = toolbarWords(given), barLabel = barNamed ?? spoken.bar;
|
|
162
167
|
const host = React.useContext(PhoneHost), narrow = usePhone();
|
|
163
168
|
const phone = form ? form === "phone" : host != null || narrow;
|
|
@@ -39,7 +39,7 @@ export function ToolbarButtonAtom({ icon, label, word, count, more, dot, open, c
|
|
|
39
39
|
if (foot)
|
|
40
40
|
return _jsx(Button, { ref: own, kind: "primary", shape: "round", size: "44", icon: icon, "aria-label": label, className: className, disabled: disabled, onClick: onClick, onPointerDown: onPointerDown, ...opens });
|
|
41
41
|
if (edge && !picks.add.startsWith("like")) {
|
|
42
|
-
const alone = word === null || picks.add.endsWith("-icon");
|
|
42
|
+
const alone = word === null || (icon != null && picks.add.endsWith("-icon"));
|
|
43
43
|
const button = (_jsx(Button, { ref: own, kind: picks.add.startsWith("primary") ? "primary" : "outline", size: BUTTON_SIZE[row?.size ?? "32"], icon: icon, shape: alone ? "icon" : undefined, "aria-label": alone ? label : undefined, className: className, disabled: disabled, onClick: onClick, onPointerDown: onPointerDown, ...opens, children: alone ? undefined : (said ?? label) }));
|
|
44
44
|
return row ? _jsx(BaseToolbar.Button, { render: button, disabled: disabled }) : button;
|
|
45
45
|
}
|
|
@@ -62,4 +62,9 @@
|
|
|
62
62
|
/* A holder's own filters or view tabs (ToolbarFolds, KIT-858): a box keeping the whole width of what it holds, so the line measures it
|
|
63
63
|
as it draws, and folds them a step at a time. */
|
|
64
64
|
.o-toolbar-folds { display: inline-flex; flex: none; min-width: max-content; align-items: center; }
|
|
65
|
+
|
|
66
|
+
/* A phone's first paint (VK-1038): server-rendered, the toolbar and the grid stand twice, the phone's form and the computer's
|
|
67
|
+
(`ScreenForms`, internal/screen-forms.tsx), and this shows the screen's at ViewKit's own line, as the inline rules beside them
|
|
68
|
+
do at the app's: here for a page whose policy refuses an inline style. Kept on one line, as screenFormsCss writes it. */
|
|
69
|
+
[data-vk-screen-forms]{display:contents}[data-vk-twin="computer"][data-vk-twin-line="(min-width: 1024px)"]{display:none}@media (min-width: 1024px){[data-vk-twin="computer"][data-vk-twin-line="(min-width: 1024px)"]{display:contents}[data-vk-twin="phone"][data-vk-twin-line="(min-width: 1024px)"]{display:none}}
|
|
65
70
|
}
|
|
@@ -72,4 +72,4 @@ export declare const TOOLTIP_TOKENS: readonly [{
|
|
|
72
72
|
readonly outright: "--toast-duration";
|
|
73
73
|
}];
|
|
74
74
|
/** The prefix of the tooltip's own machinery, set and read by it alone: not public. */
|
|
75
|
-
export declare const TOOLTIP_PRIVATE: readonly ["--tooltip-"];
|
|
75
|
+
export declare const TOOLTIP_PRIVATE: readonly ["--tooltip-", "--transform-origin"];
|
|
@@ -18,4 +18,4 @@ export const TOOLTIP_TOKENS = [
|
|
|
18
18
|
{ name: "--vk-tooltip-warm", kind: "motion", outright: "--tooltip-warm" },
|
|
19
19
|
{ name: "--vk-toast-duration", kind: "motion", outright: "--toast-duration" },
|
|
20
20
|
];
|
|
21
|
-
export const TOOLTIP_PRIVATE = ["--tooltip-"];
|
|
21
|
+
export const TOOLTIP_PRIVATE = ["--tooltip-", "--transform-origin"];
|
|
@@ -16,14 +16,16 @@
|
|
|
16
16
|
background-color: var(--vk-fg); color: var(--vk-ground);
|
|
17
17
|
font-size: var(--vk-font-size-xs); line-height: calc(var(--vk-font-size-xs) * var(--vk-line-height-xs)); font-weight: var(--vk-font-weight-medium);
|
|
18
18
|
pointer-events: none;
|
|
19
|
-
|
|
19
|
+
transform-origin: var(--transform-origin); transition-property: opacity, translate, scale;
|
|
20
|
+
transition-duration: var(--vk-popup-open-duration, var(--vk-duration-fast)); transition-timing-function: var(--vk-popup-open-ease, var(--vk-ease-out));
|
|
20
21
|
}
|
|
21
22
|
.o-tooltip-positioner { z-index: var(--vk-layer-popup); }
|
|
22
23
|
/* What it names hands its script its times, read there so a look set round it reaches them: the wait before it shows, how long a
|
|
23
24
|
tapped reason stays, and a group's warm time. */
|
|
24
25
|
.o-tooltip-trigger { --tooltip-wait: var(--vk-tooltip-delay); --tooltip-tap: var(--vk-toast-duration); --tooltip-warm-now: var(--vk-tooltip-warm); }
|
|
25
|
-
/* It fades in and rises 2px. */
|
|
26
|
-
.o-tooltip
|
|
26
|
+
/* It fades in and rises 2px, half a popup's nudge, in 150ms each way, easing out both ways (popover.css): or as the popup motion names say. */
|
|
27
|
+
.o-tooltip[data-ending-style] { transition-duration: var(--vk-popup-close-duration, var(--vk-duration-fast)); transition-timing-function: var(--vk-popup-close-ease, var(--vk-ease-out)); }
|
|
28
|
+
.o-tooltip:is([data-starting-style], [data-ending-style]) { opacity: 0; translate: 0 calc(var(--vk-popup-nudge, var(--vk-spacing)) * 0.5); scale: var(--vk-popup-scale, none); }
|
|
27
29
|
|
|
28
30
|
/* ── A longer reason: it wraps, at least 200px wide and at most 320px, in the regular weight ────────── */
|
|
29
31
|
.o-tooltip.o-tooltip-reason { width: auto; min-width: calc(var(--vk-spacing) * 50); font-weight: var(--vk-font-weight-normal); }
|
|
@@ -149,16 +149,31 @@
|
|
|
149
149
|
.o-values-editor[data-values-line="plus"] .o-values-editor-prefix { color: var(--vk-fg-subtlest); }
|
|
150
150
|
.o-values-editor[data-values-line="plus"] .o-values-editor-error { margin: var(--vk-spacing) 0 var(--vk-spacing) calc(var(--vk-spacing) * 7); }
|
|
151
151
|
|
|
152
|
-
/* ── Attio's look on a phone (data-values-phone="rows"): one card, rows 48 high at 16, each with its grip, its
|
|
153
|
-
write or open and its trash; the line in the card under a line; a refusal's words under the card
|
|
152
|
+
/* ── Attio's look on a phone (data-values-phone="rows"): one card, rows 48 high at 16, each with its grip, its value over its
|
|
153
|
+
label, its call, write or open and its trash; the line in the card under a line; a refusal's words under the card ────────── */
|
|
154
154
|
.o-values-editor[data-values-phone="rows"] .o-values-editor-card { white-space: normal; }
|
|
155
|
-
/* Its row's inside: the grip at its start's edge, its acts at its end, the computer's row height let go.
|
|
156
|
-
|
|
155
|
+
/* Its row's inside: the grip at its start's edge, its acts at its end, the computer's row height let go. The value takes the whole
|
|
156
|
+
line between them, its label under it (Mihai, 4 Dec 2026), so a phone number reads whole at 375; a value with no label stands
|
|
157
|
+
alone in the middle; a value edited spans both lines. */
|
|
158
|
+
.o-values-editor[data-values-phone="rows"] .o-values-editor-row {
|
|
159
|
+
display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "grip value acts" "grip label acts"; align-items: center;
|
|
160
|
+
gap: 0; height: auto; padding: 0 var(--vk-spacing) 0 calc(var(--vk-spacing) * 0.5); border-radius: 0;
|
|
161
|
+
}
|
|
162
|
+
.o-values-editor[data-values-phone="rows"] .o-values-editor-row > .o-values-editor-grip { grid-area: grip; }
|
|
163
|
+
.o-values-editor[data-values-phone="rows"] .o-values-editor-row > .o-values-editor-value { grid-area: value; justify-self: start; max-width: 100%; }
|
|
164
|
+
.o-values-editor[data-values-phone="rows"] .o-values-editor-row > .o-values-editor-label { grid-area: label; justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
|
|
165
|
+
.o-values-editor[data-values-phone="rows"] .o-values-editor-row > .o-values-editor-acts { grid-area: acts; }
|
|
166
|
+
.o-values-editor[data-values-phone="rows"] .o-values-editor-row > .o-values-editor-edit { grid-column: 2 / -1; grid-row: 1 / -1; }
|
|
167
|
+
/* With a label under it, the value and its label stand together in the row's height, 4 above and below. */
|
|
168
|
+
.o-values-editor[data-values-phone="rows"] .o-values-editor-row:has(> .o-values-editor-label) { padding-block: var(--vk-spacing); }
|
|
169
|
+
.o-values-editor[data-values-phone="rows"] .o-values-editor-row:has(> .o-values-editor-label) > .o-values-editor-value { min-height: 0; align-self: end; }
|
|
170
|
+
.o-values-editor[data-values-phone="rows"] .o-values-editor-row:has(> .o-values-editor-label) > .o-values-editor-label { align-self: start; }
|
|
157
171
|
@media (hover: hover) { .o-values-editor[data-values-phone="rows"] .o-values-editor-row:hover { background-color: transparent; } }
|
|
158
172
|
.o-values-editor[data-values-phone="rows"] .o-values-editor-row[data-lifted] { background-color: var(--vk-overlay); box-shadow: var(--vk-shadow-lg); }
|
|
159
173
|
.o-values-editor[data-values-holds="one"][data-values-phone="rows"] .o-values-editor-row { padding-left: calc(var(--vk-spacing) * 3); }
|
|
160
174
|
.o-values-editor[data-values-phone="rows"] .o-values-editor-value { flex: 0 1 auto; min-width: 0; min-height: calc(var(--vk-spacing) * 11); cursor: text; text-decoration-color: var(--vk-brand-subtler); text-underline-offset: var(--vk-spacing); }
|
|
161
|
-
|
|
175
|
+
/* Its label under it, where it starts. */
|
|
176
|
+
.o-values-editor[data-values-phone="rows"] .o-values-editor-label { margin-left: 0; padding-left: 0; color: var(--vk-fg-subtlest); font-size: var(--vk-font-size-sm); }
|
|
162
177
|
.o-values-editor-acts { display: flex; flex: none; margin-left: auto; }
|
|
163
178
|
.o-values-editor-label + .o-values-editor-acts { margin-left: 0; }
|
|
164
179
|
.o-values-editor[data-values-phone="rows"] .o-values-editor-remove { opacity: 1; }
|
|
@@ -11,7 +11,13 @@ import type { ReactNode } from "react";
|
|
|
11
11
|
* the data (`avatarUrl` rides the relation value), so "should this show the
|
|
12
12
|
* picture?" is never re-decided per surface.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
14
|
+
* The mark stands in one slot the photo's size (16px), whatever draws in it: the
|
|
15
|
+
* photo, an app's own mark, or a 12px glyph centred. So in a column of chips,
|
|
16
|
+
* a person with a photo above an import with a glyph, every label starts at the
|
|
17
|
+
* same x (VK-1073). The slot sheds the same 2px of line as the photo, so a chip
|
|
18
|
+
* stands no taller than before.
|
|
19
|
+
*
|
|
20
|
+
* Renders a fragment (mark slot + label as siblings) — the CALLER owns the flex
|
|
15
21
|
* container, its gap, and the interactivity around it. That is what lets the
|
|
16
22
|
* grid chip, with its own hover/link contract, and the feed link, with its
|
|
17
23
|
* primary-colored label, share one identity without sharing chrome.
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cx } from "../internal/cx.js";
|
|
4
4
|
import { useViews } from "../provider/context.js";
|
|
5
|
+
const MARK_SLOT = "inline-flex h-4 w-4 -my-0.5 shrink-0 items-center justify-center";
|
|
5
6
|
export function EntityChipIdentity({ label, avatarUrl, kind, iconOverride, fallbackIcon, labelClassName, }) {
|
|
6
7
|
const { Avatar } = useViews().atoms;
|
|
7
|
-
return (_jsxs(_Fragment, { children: [_jsx(Avatar, { label: label, avatarUrl: avatarUrl, kind: kind, size: "chip", fallback: iconOverride ?? fallbackIcon ?? null }), _jsx("span", { className: cx("min-w-0", labelClassName), children: label })] }));
|
|
8
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { className: MARK_SLOT, children: _jsx(Avatar, { label: label, avatarUrl: avatarUrl, kind: kind, size: "chip", fallback: iconOverride ?? fallbackIcon ?? null }) }), _jsx("span", { className: cx("min-w-0", labelClassName), children: label })] }));
|
|
8
9
|
}
|
|
@@ -11,6 +11,7 @@ import { ROW_INTERACTIVE_SELECTOR as OWN_PRESS } from "../selection/row-click.js
|
|
|
11
11
|
import { ELEMENT_RESET } from "../internal/reset.js";
|
|
12
12
|
import { tabbable } from "../editors/tab-ends.js";
|
|
13
13
|
import { useViews } from "../provider/context.js";
|
|
14
|
+
import { ScreenForms } from "../internal/screen-forms.js";
|
|
14
15
|
import { useDesktop } from "../provider/desktop.js";
|
|
15
16
|
import { RowEditor, rowOpensSheet } from "./editors/RowEditor.js";
|
|
16
17
|
import { drawnText } from "./drawn-text.js";
|
|
@@ -23,7 +24,8 @@ import { OpenValueAction, isOpenableType } from "../editors/open-value.js";
|
|
|
23
24
|
import { FIELD_ROW_TARGET as TARGET } from "./row-target.js";
|
|
24
25
|
import { settlementAttributes, useRowSettlement } from "./useRowSettlement.js";
|
|
25
26
|
import { EditLeaveContext, useEditLeaveScope } from "../editors/leave-scope.js";
|
|
26
|
-
const FIELD_ROW_FRAME_READS = "gap-x-(--vk-field-row-gap,calc(var(--spacing)*3)) min-h-(--vk-field-row-h,auto) py-(--vk-field-row-py,calc(var(--spacing)*2.5)) border-b-(length:--vk-field-row-line-w,1px) border-(color:--vk-field-row-line,var(--vk-border)) last:border-0"
|
|
27
|
+
const FIELD_ROW_FRAME_READS = "gap-x-(--vk-field-row-gap,calc(var(--spacing)*3)) min-h-(--vk-field-row-h,auto) py-(--vk-field-row-py,calc(var(--spacing)*2.5)) border-b-(length:--vk-field-row-line-w,1px) border-(color:--vk-field-row-line,var(--vk-border)) last:border-0 " +
|
|
28
|
+
"[[data-vk-screen-forms]:last-child>&]:border-0 [[data-vk-twin=computer]:has(+[data-vk-twin=phone]:last-child)>&]:border-0";
|
|
27
29
|
const EDITOR_PANEL = '[data-slot="vk-editor-panel"]';
|
|
28
30
|
function tabOn(from, by) {
|
|
29
31
|
const root = from.closest('[role="dialog"], [aria-modal="true"]') ?? from.ownerDocument.body;
|
|
@@ -49,6 +51,7 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
|
|
|
49
51
|
const views = useViews();
|
|
50
52
|
const desktop = useDesktop();
|
|
51
53
|
const inRows = inCard && !desktop;
|
|
54
|
+
const form = inRows ? "rows" : desktop ? "computer" : "phone";
|
|
52
55
|
const { atoms, components, conventions, icons, messages, oneValue } = views;
|
|
53
56
|
const { CommandMenu } = atoms;
|
|
54
57
|
const { AppIcon } = components;
|
|
@@ -280,18 +283,19 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
|
|
|
280
283
|
open(false);
|
|
281
284
|
};
|
|
282
285
|
const sheet = inRows && writable && shownDef.type !== "boolean" && !hasMenu && !unread && rowOpensSheet(field, oneValue);
|
|
283
|
-
return (_jsx(EditLeaveContext.Provider, { value: leaveScope, children: _jsxs("div", { ref: rowRef, className: cx(inRows
|
|
286
|
+
return (_jsx(EditLeaveContext.Provider, { value: leaveScope, children: _jsxs("div", { ref: rowRef, "data-form": form, className: cx(inRows
|
|
284
287
|
?
|
|
285
288
|
cx("o-field-row py-3", pressOpens && "cursor-pointer")
|
|
286
|
-
:
|
|
287
|
-
|
|
288
|
-
: "grid grid-cols-[auto_minmax(0,1fr)_auto] content-center items-start gap-y-1", !inRows && FIELD_ROW_FRAME_READS), "aria-busy": pending ? "true" : undefined, onClick: inRows ? onRowPress : undefined, onPointerDown: inRows
|
|
289
|
+
:
|
|
290
|
+
"group/field-row grid content-center items-start data-[form=computer]:grid-cols-[auto_var(--vk-field-row-label-w,calc(var(--spacing)*32))_minmax(0,1fr)_auto] data-[form=computer]:in-data-[field-row-icon=off]:grid-cols-[var(--vk-field-row-label-w,calc(var(--spacing)*32))_minmax(0,1fr)_auto] data-[form=phone]:grid-cols-[auto_minmax(0,1fr)_auto] data-[form=phone]:gap-y-1", !inRows && FIELD_ROW_FRAME_READS), "aria-busy": pending ? "true" : undefined, onClick: inRows ? onRowPress : undefined, onPointerDown: inRows
|
|
289
291
|
? () => {
|
|
290
292
|
downWhileEditing.current = editing;
|
|
291
293
|
}
|
|
292
|
-
: undefined, children: [_jsx("span", { className: inRows
|
|
294
|
+
: undefined, children: [_jsx("span", { className: inRows
|
|
295
|
+
? "o-field-row-glyph"
|
|
296
|
+
: "flex h-5 w-3.5 shrink-0 items-center justify-center group-data-[form=computer]/field-row:in-data-[field-row-icon=off]:hidden", children: glyph }), _jsx("span", { className: inRows
|
|
293
297
|
? "o-field-row-label"
|
|
294
|
-
: "text-sm leading-5 text-(color:--vk-field-row-label-fg,var(--vk-fg-subtle))", children: field.label }), _jsxs("div", { className: cx(inRows ? "min-w-0 flex-1" : "min-w-0 flex-1 text-sm leading-5 text-(color:--vk-fg)", !
|
|
298
|
+
: "text-sm leading-5 text-(color:--vk-field-row-label-fg,var(--vk-fg-subtle))", children: field.label }), _jsxs("div", { className: cx(inRows ? "min-w-0 flex-1" : "min-w-0 flex-1 text-sm leading-5 text-(color:--vk-fg)", !inRows && "group-data-[form=phone]/field-row:col-span-2 group-data-[form=phone]/field-row:col-start-2 group-data-[form=phone]/field-row:row-start-2", settlement.requested && "italic opacity-80"), ...settlementAttributes(settlement.requested, field.provenance, conventions), children: [editing ? (_jsx("div", { children: _jsx(RowEditor, { binding: binding, row: row, initial: retryDraft ? retryDraft.commit : editValue, refused: retryDraft?.reason, shown: shown, conversion: convertedFrom ? body : undefined, anchor: inRows ? (_jsx("span", { className: "flex min-w-0", children: valueNode })) : (_jsx("span", { className: cx(TARGET, "bg-(color:--vk-neutral)"), children: valueNode })), onAttempt: (resolution) => {
|
|
295
299
|
watchLeaving();
|
|
296
300
|
const answer = attempt(resolution);
|
|
297
301
|
if (answer.accepted && leaving.current)
|
|
@@ -313,6 +317,6 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
|
|
|
313
317
|
}
|
|
314
318
|
function FieldRowPlace(props) {
|
|
315
319
|
const inCard = useContext(FieldRowsCardContext) !== null;
|
|
316
|
-
return _jsx(OutOfFieldRows, { children: _jsx(FieldRowImpl, { ...props, inCard: inCard }) });
|
|
320
|
+
return (_jsx(ScreenForms, { off: inCard, children: _jsx(OutOfFieldRows, { children: _jsx(FieldRowImpl, { ...props, inCard: inCard }) }) }));
|
|
317
321
|
}
|
|
318
322
|
export const FieldRow = memo(FieldRowPlace);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { type FieldType } from "viewkitjs/fields";
|
|
2
|
+
import { type CloseReason, type FieldType } from "viewkitjs/fields";
|
|
3
3
|
import type { GridEditorId } from "../../model/column-types.js";
|
|
4
4
|
import { type ListSettingsConfig } from "../../model/column-capabilities.js";
|
|
5
5
|
import type { ListColumn, ListSelectColor } from "../../model/column-schema.js";
|
|
@@ -37,6 +37,9 @@ export type GridCellEditorContext<Row> = {
|
|
|
37
37
|
overlay?: GridCommitOverlay;
|
|
38
38
|
}) => void;
|
|
39
39
|
onCancel: () => void;
|
|
40
|
+
/** Told the moment the editor starts to close (its session accepted an answer), with the reason, before its exit
|
|
41
|
+
* plays: the cell stops wearing `data-editing` then, and a press away lets the pick go. */
|
|
42
|
+
onClosing?: (reason: CloseReason | null) => void;
|
|
40
43
|
onTab: (backwards: boolean) => void;
|
|
41
44
|
onEnter: () => void;
|
|
42
45
|
};
|
|
@@ -19,6 +19,7 @@ import { gridTextOpensBox, isLongTextColumn } from "../../model/column-inspect.j
|
|
|
19
19
|
import { gridClearRefusal, gridColumnEffectiveClearable, gridColumnLocked, gridEditRefusal, gridNormalizeWrite, } from "../../model/column-capabilities.js";
|
|
20
20
|
import { useViews } from "../../provider/context.js";
|
|
21
21
|
import { EditFieldTypeContext, EditOpensListContext } from "../../editors/escape-rule.js";
|
|
22
|
+
import { GridEditClosingContext } from "./grid-edit-session.js";
|
|
22
23
|
import { gridRelationSource } from "../../model/column-types.js";
|
|
23
24
|
import { gridPartWrite } from "../../model/part-write.js";
|
|
24
25
|
function useCellRefusal(col, listConfig, region, row) {
|
|
@@ -35,7 +36,7 @@ function useCellRefusal(col, listConfig, region, row) {
|
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
38
|
export function GridCellInlineEditor({ ctx }) {
|
|
38
|
-
return (_jsx(EditFieldTypeContext.Provider, { value: gridEscapeType(ctx.col), children: _jsx(EditOpensListContext.Provider, { value: ctx.editorKind === "values", children: _jsx(InlineEditor, { ctx: ctx }) }) }));
|
|
39
|
+
return (_jsx(EditFieldTypeContext.Provider, { value: gridEscapeType(ctx.col), children: _jsx(EditOpensListContext.Provider, { value: ctx.editorKind === "values", children: _jsx(GridEditClosingContext.Provider, { value: ctx.onClosing ?? null, children: _jsx(InlineEditor, { ctx: ctx }) }) }) }));
|
|
39
40
|
}
|
|
40
41
|
export function gridEscapeType(col) {
|
|
41
42
|
if (col.field)
|
|
@@ -65,7 +66,7 @@ function InlineEditor({ ctx }) {
|
|
|
65
66
|
return null;
|
|
66
67
|
}
|
|
67
68
|
export function GridCellAnchoredEditor({ ctx, }) {
|
|
68
|
-
return (_jsx(EditFieldTypeContext.Provider, { value: gridEscapeType(ctx.col), children: _jsx(EditOpensListContext.Provider, { value: ctx.editorKind === "values", children: _jsx(AnchoredEditor, { ctx: ctx }) }) }));
|
|
69
|
+
return (_jsx(EditFieldTypeContext.Provider, { value: gridEscapeType(ctx.col), children: _jsx(EditOpensListContext.Provider, { value: ctx.editorKind === "values", children: _jsx(GridEditClosingContext.Provider, { value: ctx.onClosing ?? null, children: _jsx(AnchoredEditor, { ctx: ctx }) }) }) }));
|
|
69
70
|
}
|
|
70
71
|
function AnchoredEditor({ ctx }) {
|
|
71
72
|
const { row, rowId, col, baseline, onCommitCell, onCancel } = ctx;
|
|
@@ -48,8 +48,6 @@ export declare const GRID_CELL_HOVER_SHADOW = "hover:shadow-[var(--vk-outline-ho
|
|
|
48
48
|
* consumer (hairlines ratchet).
|
|
49
49
|
*/
|
|
50
50
|
export declare const GRID_CELL_HOVER_RING = "hover:after:pointer-events-none hover:after:absolute hover:after:inset-0 hover:after:z-1 hover:after:rounded-(--vk-outline-radius,var(--radius-sm)) hover:after:border hover:after:border-(color:--vk-outline-hover,var(--vk-border-bold))";
|
|
51
|
-
/** The selection ring, in the same geometry the hover ring draws.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
editing?: boolean;
|
|
55
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
/** The selection ring, in the same geometry the hover ring draws. Drawn on a selected cell, never while its editor is
|
|
52
|
+
* open: an open editor shows no ring, no lift and no tint on its cell. */
|
|
53
|
+
export declare function GridCellOutline(): import("react/jsx-runtime").JSX.Element;
|