viewkitjs 0.36.0 → 0.38.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 +75 -0
- package/package.json +1 -1
- package/views/dist/atoms/types.d.ts +32 -4
- package/views/dist/contract.d.ts +18 -9
- package/views/dist/contract.js +18 -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 +7 -4
- package/views/dist/controls/field.css +64 -1
- 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/glyphs/glyphs.js +2 -0
- package/views/dist/controls/index.d.ts +3 -1
- package/views/dist/controls/index.js +3 -1
- package/views/dist/controls/inline-input.css +10 -0
- package/views/dist/controls/internal/phone.d.ts +1 -1
- package/views/dist/controls/internal/phone.js +3 -2
- package/views/dist/controls/internal/read-token.d.ts +2 -1
- package/views/dist/controls/internal/read-token.js +2 -1
- 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/number-editor/tokens.d.ts +8 -0
- package/views/dist/controls/number-editor/tokens.js +2 -0
- package/views/dist/controls/number-editor.css +20 -0
- 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/tokens.d.ts +8 -0
- package/views/dist/controls/text-editor/tokens.js +2 -0
- package/views/dist/controls/text-editor.css +28 -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/tooltip.js +2 -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 +25 -12
- package/views/dist/field-row/field-row-button.d.ts +12 -0
- package/views/dist/field-row/field-row-button.js +5 -0
- package/views/dist/fields/binding.d.ts +4 -0
- 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 +15 -5
- package/views/dist/grid/chrome/GridCellOutline.js +20 -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 +3 -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/GridStructure.js +3 -3
- 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 +4 -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 +9 -4
- package/views/dist/grid/chrome/grid-cell-classes.js +2 -2
- package/views/dist/grid/chrome/grid-edit-session.d.ts +8 -0
- package/views/dist/grid/chrome/grid-edit-session.js +21 -3
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +11 -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 +5 -2
- package/views/dist/grid/chrome/useGridKeyboard.js +11 -15
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +3 -1
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +30 -2
- 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/length.d.ts +2 -0
- package/views/dist/internal/length.js +16 -0
- 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 +8 -7
- package/views/dist/provider/desktop.d.ts +2 -1
- package/views/dist/provider/desktop.js +5 -2
- package/views/dist/selection/bar-overflow.d.ts +2 -0
- package/views/dist/selection/bar-overflow.js +2 -1
- package/views/dist/selection/bar-props.d.ts +1 -1
- package/views/dist/selection/verbs.d.ts +2 -2
- package/views/dist/styles.css +341 -80
- package/views/dist/styles.unlayered.css +341 -80
- package/views/docs/contract.md +77 -23
- package/views/docs/controls/list.md +2 -0
- package/views/docs/controls/menu.md +2 -0
- package/views/docs/controls/number-editor.md +2 -0
- package/views/docs/controls/picker.md +2 -0
- package/views/docs/controls/popover.md +7 -0
- package/views/docs/controls/text-editor.md +2 -0
- package/views/docs/controls/tooltip.md +2 -0
- package/views/docs/guides/atoms.md +11 -10
- package/views/docs/guides/selection.md +1 -1
- 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/selection.md +1 -1
- package/views/docs/reference/views.md +3 -3
- package/views/docs/reshaping.md +2 -2
- package/views/skills/views/SKILL.md +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PhoneLine } from "../../internal/phone-line.js";
|
|
3
|
+
import { ScreenTold } from "../../internal/screen-forms.js";
|
|
3
4
|
export { PhoneLine };
|
|
4
5
|
const canAsk = () => typeof window !== "undefined" && typeof window.matchMedia === "function";
|
|
5
6
|
export const PhoneHost = React.createContext(null);
|
|
6
7
|
export const COMPUTER_HOST = "data-computer-host";
|
|
7
8
|
export const ComputerHost = React.createContext(false);
|
|
8
9
|
export const usePhone = (asked = true) => {
|
|
9
|
-
const line = React.useContext(PhoneLine), computer = React.useContext(ComputerHost);
|
|
10
|
+
const line = React.useContext(PhoneLine), computer = React.useContext(ComputerHost), told = React.useContext(ScreenTold);
|
|
10
11
|
const subscribe = React.useCallback((change) => {
|
|
11
12
|
if (!asked || !canAsk())
|
|
12
13
|
return () => { };
|
|
@@ -15,7 +16,7 @@ export const usePhone = (asked = true) => {
|
|
|
15
16
|
return () => m.removeEventListener("change", change);
|
|
16
17
|
}, [line, asked]);
|
|
17
18
|
const narrow = React.useSyncExternalStore(subscribe, () => asked && canAsk() && !matchMedia(line).matches, () => false);
|
|
18
|
-
return narrow && !computer;
|
|
19
|
+
return (told && asked ? told === "phone" : narrow) && !computer;
|
|
19
20
|
};
|
|
20
21
|
export function usePhoneForm(form, asked = true) {
|
|
21
22
|
const host = React.useContext(PhoneHost), small = usePhone(asked);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** A time in milliseconds ("500ms" is 500, "4s" 4000), 0 where nothing declares it. */
|
|
2
2
|
export declare function msOf(el: Element | null | undefined, prop: `--${string}`): number;
|
|
3
|
-
/** A length in px ("1px" is 1
|
|
3
|
+
/** A length in px ("1px" is 1, "0.25rem" 4 under a 16px root: whatever unit the app declares it in), 0 where nothing
|
|
4
|
+
* declares it. */
|
|
4
5
|
export declare function pxOf(el: Element | null | undefined, prop: `--${string}`): number;
|
|
5
6
|
/** Steps of the spacing name, in px (1.5 steps is 6px at the default 4px), read off `el`; with no element (a popup outside any
|
|
6
7
|
* popup host), off the page's root, where the ready stylesheet declares it. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { lengthPx } from "../../internal/length.js";
|
|
1
2
|
const read = (el, prop) => !el || typeof getComputedStyle === "undefined" ? "" : getComputedStyle(el).getPropertyValue(prop).trim();
|
|
2
3
|
export function msOf(el, prop) {
|
|
3
4
|
const v = read(el, prop), n = parseFloat(v);
|
|
@@ -6,6 +7,6 @@ export function msOf(el, prop) {
|
|
|
6
7
|
return /\dms$/.test(v) ? n : /\ds$/.test(v) ? n * 1000 : n;
|
|
7
8
|
}
|
|
8
9
|
export function pxOf(el, prop) {
|
|
9
|
-
return
|
|
10
|
+
return lengthPx(el, prop);
|
|
10
11
|
}
|
|
11
12
|
export const spacingPx = (steps, el) => pxOf(el ?? (typeof document === "undefined" ? undefined : document.documentElement), "--vk-spacing") * steps;
|
|
@@ -136,4 +136,4 @@ export declare const LIST_TOKENS: readonly [{
|
|
|
136
136
|
readonly outright: "--ease-out";
|
|
137
137
|
}];
|
|
138
138
|
/** The list's own machinery: its options' values set on the frame, its rows' and panel's measures, and the lines between groups. */
|
|
139
|
-
export declare const LIST_PRIVATE: readonly ["--list-", "--divider-", "--dividers-"];
|
|
139
|
+
export declare const LIST_PRIVATE: readonly ["--list-", "--divider-", "--dividers-", "--transform-origin"];
|
|
@@ -34,4 +34,4 @@ export const LIST_TOKENS = [
|
|
|
34
34
|
{ name: "--vk-duration-fast", kind: "motion", outright: "--duration-fast" },
|
|
35
35
|
{ name: "--vk-ease-out", kind: "motion", outright: "--ease-out" },
|
|
36
36
|
];
|
|
37
|
-
export const LIST_PRIVATE = ["--list-", "--divider-", "--dividers-"];
|
|
37
|
+
export const LIST_PRIVATE = ["--list-", "--divider-", "--dividers-", "--transform-origin"];
|
|
@@ -79,9 +79,12 @@
|
|
|
79
79
|
box-sizing: border-box; display: grid; padding: var(--list-pad, calc(var(--vk-spacing) * 1.5));
|
|
80
80
|
border: var(--vk-border-width) solid var(--list-edge, var(--vk-border)); border-radius: calc(min(var(--list-box-r, var(--vk-radius-lg)), var(--vk-radius-2xl)) + var(--list-pad, calc(var(--vk-spacing) * 1.5)));
|
|
81
81
|
background-color: var(--vk-overlay); box-shadow: var(--list-shadow, var(--vk-shadow-xl)); color: var(--vk-fg); outline: none;
|
|
82
|
-
|
|
82
|
+
transform-origin: var(--transform-origin); transition-property: opacity, translate, scale;
|
|
83
|
+
transition-duration: var(--vk-popup-open-duration, var(--vk-duration-fast)); transition-timing-function: var(--vk-popup-open-ease, var(--vk-ease-out));
|
|
83
84
|
}
|
|
84
|
-
.
|
|
85
|
+
/* As every popup moves (popover.css): in 150ms each way, easing out both ways, or as the popup motion names say. */
|
|
86
|
+
.o-list[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)); }
|
|
87
|
+
.o-list:is([data-starting-style], [data-ending-style]) { opacity: 0; translate: 0 calc(var(--vk-popup-nudge, var(--vk-spacing)) * -1); scale: var(--vk-popup-scale, none); }
|
|
85
88
|
.o-list-positioner { z-index: var(--vk-layer-popup); outline: none; }
|
|
86
89
|
|
|
87
90
|
/* ── A row: 32px, the radius's corners, text-sm; under the pointer or the keyboard the overlay's hover ─ */
|
|
@@ -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); }
|
|
@@ -18,6 +18,14 @@ export declare const NUMBER_EDITOR_TOKENS: readonly [{
|
|
|
18
18
|
readonly name: "--vk-font-size-sm";
|
|
19
19
|
readonly kind: "size";
|
|
20
20
|
readonly outright: "--text-sm";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "--vk-shadow-field-focus";
|
|
23
|
+
readonly kind: "shadow";
|
|
24
|
+
readonly outright: "--shadow-field-focus";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "--vk-shadow-field-focus-danger";
|
|
27
|
+
readonly kind: "shadow";
|
|
28
|
+
readonly outright: "--shadow-field-focus-danger";
|
|
21
29
|
}, {
|
|
22
30
|
readonly name: "--vk-spacing";
|
|
23
31
|
readonly kind: "size";
|
|
@@ -4,6 +4,8 @@ export const NUMBER_EDITOR_TOKENS = [
|
|
|
4
4
|
{ name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
|
|
5
5
|
{ name: "--vk-font-size-base", kind: "size", outright: "--text-base" },
|
|
6
6
|
{ name: "--vk-font-size-sm", kind: "size", outright: "--text-sm" },
|
|
7
|
+
{ name: "--vk-shadow-field-focus", kind: "shadow", outright: "--shadow-field-focus" },
|
|
8
|
+
{ name: "--vk-shadow-field-focus-danger", kind: "shadow", outright: "--shadow-field-focus-danger" },
|
|
7
9
|
{ name: "--vk-spacing", kind: "size", outright: "--spacing" },
|
|
8
10
|
];
|
|
9
11
|
export const NUMBER_EDITOR_PRIVATE = ["--number-editor-"];
|
|
@@ -24,6 +24,26 @@ span.o-number-editor-code { color: var(--vk-fg-subtle); }
|
|
|
24
24
|
.o-number-editor-sign, .o-number-editor-unit { flex: none; color: var(--vk-fg-subtle); }
|
|
25
25
|
.o-number-editor[data-number-form="computer"] .o-number-editor-sign { margin-right: auto; }
|
|
26
26
|
|
|
27
|
+
/* ── In a record's row that wears the Field's Box (data-field-row-box="box" on a frame round the rows; the row marks its open
|
|
28
|
+
editor data-field-row-editor): on a computer the number's box is the row's own, as the Text editor's is (text-editor.css):
|
|
29
|
+
where the row's hover and press drew it, as tall, its words as far in, no edge of its own, the row's ground, its ring
|
|
30
|
+
outside it, red when refused. ─────────────────────────────────────────────────────────────────────────────────────────── */
|
|
31
|
+
:where([data-field-row-box="box"] [data-field-row-editor]) .o-number-editor[data-number-form="computer"] {
|
|
32
|
+
--inline-input-row: var(--field-row-box-h); --inline-input-edge: 0px; --inline-input-ring: 0px;
|
|
33
|
+
width: calc(100% + var(--field-row-box-x) * 2); height: var(--field-row-box-h);
|
|
34
|
+
margin: calc(var(--field-row-box-y) * -1) calc(var(--field-row-box-x) * -1);
|
|
35
|
+
}
|
|
36
|
+
:where([data-field-row-box="box"] [data-field-row-editor]) .o-number-editor[data-number-form="computer"] :is(.o-number-editor-field, .o-number-editor-field > .o-inline-input-group) {
|
|
37
|
+
height: var(--field-row-box-h); min-height: var(--field-row-box-h);
|
|
38
|
+
}
|
|
39
|
+
:where([data-field-row-box="box"] [data-field-row-editor]) .o-number-editor[data-number-form="computer"] .o-inline-input {
|
|
40
|
+
--inline-input-words: var(--field-row-box-x); border-radius: var(--field-row-box-r); background-color: transparent;
|
|
41
|
+
box-shadow: 0 0 0 var(--vk-border-width) var(--inline-input-colour), var(--vk-shadow-field-focus);
|
|
42
|
+
}
|
|
43
|
+
:where([data-field-row-box="box"] [data-field-row-editor]) .o-number-editor[data-number-form="computer"] .o-inline-input:is([aria-invalid="true"], :has(.o-input-control[aria-invalid="true"])) {
|
|
44
|
+
box-shadow: 0 0 0 var(--vk-border-width) var(--inline-input-colour), var(--vk-shadow-field-focus-danger);
|
|
45
|
+
}
|
|
46
|
+
|
|
27
47
|
/* ── On a phone: the box and what is under it ───────────────────────────────────────────────────────────────────── */
|
|
28
48
|
.o-number-editor[data-number-form="phone"] { display: grid; gap: calc(var(--vk-spacing) * 2); }
|
|
29
49
|
|
|
@@ -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
|
|
@@ -46,6 +46,14 @@ export declare const TEXT_EDITOR_TOKENS: readonly [{
|
|
|
46
46
|
readonly name: "--vk-radius-md";
|
|
47
47
|
readonly kind: "size";
|
|
48
48
|
readonly outright: "--radius-md";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "--vk-shadow-field-focus";
|
|
51
|
+
readonly kind: "shadow";
|
|
52
|
+
readonly outright: "--shadow-field-focus";
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "--vk-shadow-field-focus-danger";
|
|
55
|
+
readonly kind: "shadow";
|
|
56
|
+
readonly outright: "--shadow-field-focus-danger";
|
|
49
57
|
}, {
|
|
50
58
|
readonly name: "--vk-shadow-lg";
|
|
51
59
|
readonly kind: "shadow";
|
|
@@ -11,6 +11,8 @@ export const TEXT_EDITOR_TOKENS = [
|
|
|
11
11
|
{ name: "--vk-line-height-xs", kind: "size", outright: "--text-xs--line-height" },
|
|
12
12
|
{ name: "--vk-overlay", kind: "colour", outright: "--surface-overlay" },
|
|
13
13
|
{ name: "--vk-radius-md", kind: "size", outright: "--radius-md" },
|
|
14
|
+
{ name: "--vk-shadow-field-focus", kind: "shadow", outright: "--shadow-field-focus" },
|
|
15
|
+
{ name: "--vk-shadow-field-focus-danger", kind: "shadow", outright: "--shadow-field-focus-danger" },
|
|
14
16
|
{ name: "--vk-shadow-lg", kind: "shadow", outright: "--shadow-lg" },
|
|
15
17
|
{ name: "--vk-shadow-menu", kind: "shadow", outright: "--shadow-menu" },
|
|
16
18
|
{ name: "--vk-spacing", kind: "size", outright: "--spacing" },
|
|
@@ -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 wears only
|
|
39
|
+
the selected cell's ring. (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;
|
|
@@ -73,6 +79,28 @@
|
|
|
73
79
|
.o-text-editor[data-text-place="row"][data-text-form] .o-text-editor-phone { position: relative; top: auto; left: auto; width: 100%; height: var(--inline-input-row); }
|
|
74
80
|
.o-text-editor[data-text-place="row"][data-text-form] .o-text-editor-note { position: relative; top: auto; left: auto; margin-top: var(--vk-spacing); max-width: 100%; }
|
|
75
81
|
|
|
82
|
+
/* ── In a record's row that wears the Field's Box (data-field-row-box="box" on a frame round the rows; the row marks its open
|
|
83
|
+
editor data-field-row-editor): on a computer the box is the row's own, the rectangle its hover and its press drew. It stands
|
|
84
|
+
where that rectangle stood, pulled out by the box's reach and its height round the row's one line (the row's
|
|
85
|
+
--field-row-box-* variables, field.css), its words that reach in, no edge of its own, the row's ground: so
|
|
86
|
+
not a pixel of the words moves and the row keeps its height. Its ring is drawn outside it, a line of the brand and the
|
|
87
|
+
focus glow, red when refused. A line of text stays one line, scrolling sideways; long text still grows. A phone's form is
|
|
88
|
+
the phone's own. ─────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
89
|
+
:where([data-field-row-box="box"] [data-field-row-editor]) .o-text-editor[data-text-place="row"][data-text-form="computer"] {
|
|
90
|
+
--inline-input-row: var(--field-row-box-h); --inline-input-edge: 0px; --inline-input-ring: 0px;
|
|
91
|
+
width: calc(100% + var(--field-row-box-x) * 2); margin: calc(var(--field-row-box-y) * -1) calc(var(--field-row-box-x) * -1);
|
|
92
|
+
}
|
|
93
|
+
:where([data-field-row-box="box"] [data-field-row-editor]) .o-text-editor[data-text-place="row"][data-text-form="computer"] :is(.o-text-editor-box, .o-text-editor-phone) {
|
|
94
|
+
--inline-input-words: var(--field-row-box-x); border-radius: var(--field-row-box-r); background-color: transparent;
|
|
95
|
+
box-shadow: 0 0 0 var(--vk-border-width) var(--inline-input-colour), var(--vk-shadow-field-focus);
|
|
96
|
+
}
|
|
97
|
+
:where([data-field-row-box="box"] [data-field-row-editor]) .o-text-editor[data-text-place="row"][data-text-form="computer"] :is(.o-text-editor-box, .o-text-editor-phone):is([aria-invalid="true"], [data-refused]) {
|
|
98
|
+
box-shadow: 0 0 0 var(--vk-border-width) var(--inline-input-colour), var(--vk-shadow-field-focus-danger);
|
|
99
|
+
}
|
|
100
|
+
:where([data-field-row-box="box"] [data-field-row-editor]) .o-text-editor[data-text-place="row"][data-text-form="computer"]:not([data-text-kind="long"]) .o-text-editor-box {
|
|
101
|
+
white-space: pre; overflow: hidden;
|
|
102
|
+
}
|
|
103
|
+
|
|
76
104
|
/* ── On a phone: the Input at the phone's size; long text one tall box; a phone's country in the box's start side ──── */
|
|
77
105
|
.o-text-editor[data-text-form="phone"] { display: grid; }
|
|
78
106
|
.o-text-editor[data-text-form="phone"] .o-text-editor-country { gap: calc(var(--vk-spacing) * 0.75); }
|
|
@@ -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"];
|
|
@@ -3,6 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip";
|
|
4
4
|
import { cx } from "../../internal/cx.js";
|
|
5
5
|
import { usePopupHost } from "../internal/popup-host.js";
|
|
6
|
+
import { pxOf } from "../internal/read-token.js";
|
|
6
7
|
import { Kbd } from "../kbd/kbd.js";
|
|
7
8
|
export const TOOLTIP_TIMING = { delay: 500, warm: 300, tap: 4000 };
|
|
8
9
|
function readMs(el, name, fallback) {
|
|
@@ -11,7 +12,7 @@ function readMs(el, name, fallback) {
|
|
|
11
12
|
}
|
|
12
13
|
const GroupWarm = React.createContext(null);
|
|
13
14
|
const Box = ({ label, keys }) => _jsxs(_Fragment, { children: [label, keys && _jsx(Kbd, { keys: keys })] });
|
|
14
|
-
const gap = (trigger, popup) => (
|
|
15
|
+
const gap = (trigger, popup) => (pxOf(popup, "--vk-spacing") || 4) * (trigger?.closest('[data-tooltip-arrow="soft"]') ? 2.5 : 1.5);
|
|
15
16
|
export function Tooltip({ label, keys, reason, side = "top", align = "center", sideOffset, alignOffset = 0, open, defaultOpen, onOpenChange, disabled, delay, className, children }) {
|
|
16
17
|
const ref = React.useRef(null), popup = React.useRef(null), host = usePopupHost(ref), id = React.useId();
|
|
17
18
|
const [wait, setWait] = React.useState(TOOLTIP_TIMING.delay), tellWarm = React.useContext(GroupWarm);
|