viewkitjs 0.34.0 → 0.35.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 +110 -0
- package/package.json +1 -1
- package/views/README.md +1 -1
- package/views/dist/atoms/Avatar.js +2 -1
- package/views/dist/atoms/RelationChip.d.ts +2 -0
- package/views/dist/atoms/RelationChip.js +5 -0
- package/views/dist/atoms/RowMenu.d.ts +1 -1
- package/views/dist/atoms/RowMenu.js +15 -3
- package/views/dist/atoms/defaults.js +2 -0
- package/views/dist/atoms/types.d.ts +40 -4
- package/views/dist/cells/relation-wrap.js +9 -2
- package/views/dist/contract.d.ts +9 -6
- package/views/dist/contract.js +4 -2
- package/views/dist/controls/avatar/avatar-mark.d.ts +4 -0
- package/views/dist/controls/avatar/avatar-mark.js +5 -0
- package/views/dist/controls/avatar/avatar.d.ts +7 -4
- package/views/dist/controls/avatar/avatar.js +10 -4
- package/views/dist/controls/avatar/looks.d.ts +1 -1
- package/views/dist/controls/avatar/looks.js +3 -0
- package/views/dist/controls/avatar/record-mark.d.ts +16 -0
- package/views/dist/controls/avatar/record-mark.js +13 -0
- package/views/dist/controls/avatar/tokens.d.ts +12 -0
- package/views/dist/controls/avatar/tokens.js +3 -0
- package/views/dist/controls/avatar.css +54 -17
- package/views/dist/controls/bulk-bar/bulk-bar.js +4 -5
- package/views/dist/controls/bulk-bar/map-selection-bar.js +2 -1
- package/views/dist/controls/compound-editor/compound-editor.d.ts +3 -0
- package/views/dist/controls/compound-editor/map-parts-body.d.ts +1 -1
- package/views/dist/controls/compound-editor/map-parts-body.js +6 -1
- package/views/dist/controls/compound-editor/name-parts.js +2 -1
- package/views/dist/controls/compound-editor/place-parts.js +2 -2
- package/views/dist/controls/compound-editor/range-parts.js +10 -9
- package/views/dist/controls/customize/customize.d.ts +14 -5
- package/views/dist/controls/customize/customize.js +11 -14
- package/views/dist/controls/customize/map-customize-body.js +12 -11
- package/views/dist/controls/customize/words.d.ts +3 -3
- package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +4 -6
- package/views/dist/controls/filter-editor/parts.d.ts +1 -1
- package/views/dist/controls/filter-editor/parts.js +4 -4
- package/views/dist/controls/index.d.ts +1 -1
- package/views/dist/controls/internal/map-panel-controls.js +9 -5
- package/views/dist/controls/internal/panel-controls.d.ts +27 -3
- package/views/dist/controls/internal/panel-controls.js +141 -12
- package/views/dist/controls/links-editor/links-editor.js +5 -7
- package/views/dist/controls/links-editor/map-links-body.d.ts +1 -1
- package/views/dist/controls/links-editor/map-links-body.js +5 -1
- package/views/dist/controls/menu/menu.d.ts +3 -0
- package/views/dist/controls/menu/menu.js +2 -1
- package/views/dist/controls/picker/map-fields-body.d.ts +2 -2
- package/views/dist/controls/picker/map-fields-body.js +5 -1
- package/views/dist/controls/picker/map-picker.d.ts +8 -3
- package/views/dist/controls/picker/map-picker.js +14 -3
- package/views/dist/controls/picker/picker.js +11 -8
- package/views/dist/controls/picker/rows.d.ts +7 -2
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +2 -1
- package/views/dist/controls/quick-filters/quick-filters.js +4 -4
- package/views/dist/controls/quick-filters/reminder.js +2 -2
- package/views/dist/controls/quick-filters/rules.d.ts +4 -1
- package/views/dist/controls/quick-filters/words.d.ts +2 -0
- package/views/dist/controls/quick-filters/words.js +1 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +9 -3
- package/views/dist/controls/sort-editor/sort-editor.d.ts +2 -0
- package/views/dist/controls/sort-editor/sort-editor.js +4 -5
- package/views/dist/controls/toolbar/toolbar.d.ts +25 -12
- package/views/dist/controls/toolbar/toolbar.js +15 -20
- package/views/dist/controls/toolbar.css +0 -5
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +4 -2
- package/views/dist/controls/values-editor/map-values-body.d.ts +1 -2
- package/views/dist/controls/values-editor/map-values-body.js +5 -1
- package/views/dist/controls/values-editor/values-editor.js +8 -7
- package/views/dist/display/option-badges.d.ts +16 -0
- package/views/dist/display/option-badges.js +11 -0
- package/views/dist/display/relation-link.d.ts +12 -0
- package/views/dist/display/relation-link.js +17 -0
- package/views/dist/display/relation.d.ts +1 -1
- package/views/dist/display/relation.js +10 -3
- package/views/dist/display/select.js +1 -8
- package/views/dist/editors/EditorPanel.js +1 -1
- package/views/dist/editors/RangeEditor.d.ts +3 -0
- package/views/dist/editors/RangeEditor.js +2 -2
- package/views/dist/editors/SelectEditor.d.ts +2 -2
- package/views/dist/editors/SelectEditor.js +1 -1
- package/views/dist/editors/TextEditor.js +4 -2
- package/views/dist/editors/ValueListEditor.js +2 -1
- package/views/dist/field-row/FieldRow.js +32 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +2 -1
- package/views/dist/grid/chrome/GridAddColumn.js +9 -6
- package/views/dist/grid/chrome/GridCellEditors.js +1 -1
- package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -1
- package/views/dist/grid/chrome/GridCellOutline.js +16 -6
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +7 -4
- package/views/dist/grid/chrome/GridFooter.d.ts +4 -1
- package/views/dist/grid/chrome/GridFooter.js +4 -4
- package/views/dist/grid/chrome/GridGroupMenu.js +39 -14
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -1
- package/views/dist/grid/chrome/GridHeader.js +1 -2
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +4 -1
- package/views/dist/grid/chrome/GridRangeEditor.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +5 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +4 -1
- package/views/dist/grid/chrome/GridRowActions.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +3 -2
- package/views/dist/grid/chrome/GridStructure.js +1 -1
- package/views/dist/grid/chrome/GridTable.js +32 -20
- package/views/dist/grid/chrome/checks.d.ts +1 -1
- package/views/dist/grid/chrome/checks.js +4 -1
- package/views/dist/grid/chrome/grid-cell-classes.d.ts +6 -2
- package/views/dist/grid/chrome/grid-cell-classes.js +10 -5
- package/views/dist/grid/chrome/grid-hover.d.ts +10 -2
- package/views/dist/grid/chrome/grid-hover.js +14 -4
- package/views/dist/grid/chrome/grid-row-props.d.ts +4 -0
- package/views/dist/grid/chrome/grid-rows-menu.js +9 -4
- package/views/dist/grid/chrome/grid-table-props.d.ts +10 -2
- package/views/dist/grid/grid.css +6 -0
- package/views/dist/grid/looks.d.ts +3 -1
- package/views/dist/grid/looks.js +10 -4
- package/views/dist/list/layer.d.ts +8 -0
- package/views/dist/list/layer.js +7 -0
- package/views/dist/list/store.d.ts +1 -1
- package/views/dist/list/toolbar.js +44 -19
- package/views/dist/list/views.js +1 -0
- package/views/dist/panels/availability.d.ts +5 -0
- package/views/dist/panels/availability.js +4 -5
- package/views/dist/panels/customize-body.d.ts +4 -0
- package/views/dist/panels/customize-body.js +13 -11
- package/views/dist/panels/model.d.ts +9 -4
- package/views/dist/panels/react/customize-body.js +5 -2
- package/views/dist/panels/react/customize.d.ts +5 -0
- package/views/dist/panels/react/filter/FilterEditor.d.ts +6 -0
- package/views/dist/panels/react/filter/FilterEditor.js +7 -0
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +3 -1
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +7 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +4 -1
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +11 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +16 -6
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +12 -5
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +7 -3
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +18 -8
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +2 -2
- 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 +5 -4
- package/views/dist/panels/react/toolbar/ToolbarSort.d.ts +7 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +6 -3
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +3 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +4 -4
- package/views/dist/panels/react/views-row/ViewPicker.js +13 -5
- package/views/dist/panels/react.d.ts +1 -1
- package/views/dist/panels/settings/layout.js +6 -38
- package/views/dist/panels/toolbar/page-resets.d.ts +17 -0
- package/views/dist/panels/toolbar/page-resets.js +62 -0
- package/views/dist/panels/toolbar/same-item.d.ts +7 -0
- package/views/dist/panels/toolbar/same-item.js +9 -0
- package/views/dist/panels/view-state.d.ts +4 -0
- package/views/dist/provider/ViewsProvider.d.ts +9 -4
- package/views/dist/provider/ViewsProvider.js +13 -2
- package/views/dist/provider/components.d.ts +27 -5
- package/views/dist/provider/components.js +1 -1
- package/views/dist/react.d.ts +1 -1
- package/views/dist/styles.css +98 -23
- package/views/dist/styles.unlayered.css +98 -23
- package/views/docs/contract.md +38 -25
- package/views/docs/controls/avatar.md +3 -0
- package/views/docs/controls/bulk-bar.md +3 -1
- package/views/docs/controls/compound-editor.md +2 -0
- package/views/docs/controls/customize.md +1 -1
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/links-editor.md +2 -0
- package/views/docs/controls/pane.md +1 -1
- package/views/docs/controls/picker.md +2 -0
- package/views/docs/controls/quick-filters.md +1 -1
- package/views/docs/controls/text-editor.md +1 -1
- package/views/docs/controls/values-editor.md +2 -0
- package/views/docs/guides/atoms.md +54 -3
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/looks.md +1 -1
- package/views/docs/guides/the-grid.md +4 -2
- package/views/docs/guides/the-provider.md +2 -2
- package/views/docs/index.md +2 -2
- package/views/docs/install.md +198 -104
- package/views/docs/reference/controls.md +17 -15
- package/views/docs/reference/editors-range.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +2 -1
- package/views/docs/reference/list.md +2 -2
- package/views/docs/reference/looks.md +5 -5
- package/views/docs/reference/panels-react.md +13 -12
- package/views/docs/reference/panels.md +4 -4
- package/views/docs/reference/react.md +10 -8
- package/views/docs/reference/views.md +2 -2
- package/views/docs/reshaping.md +22 -6
- package/views/skills/views/SKILL.md +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Avatar as BaseAvatar } from "@base-ui/react/avatar";
|
|
4
4
|
import { cx } from "../../internal/cx.js";
|
|
@@ -8,6 +8,7 @@ import { Menu } from "../menu/menu.js";
|
|
|
8
8
|
import { optionColours } from "../option/looks.js";
|
|
9
9
|
import { Icon } from "../internal/icons.js";
|
|
10
10
|
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
11
|
+
import { markAvatar } from "./avatar-mark.js";
|
|
11
12
|
const SIZE = { 16: "o-avatar-2xs", 20: "o-avatar-xs", 24: "o-avatar-sm", 32: "", 40: "o-avatar-lg", 56: "o-avatar-56", 64: "o-avatar-xl", 96: "o-avatar-96" };
|
|
12
13
|
export function initials(name) {
|
|
13
14
|
const words = name.split(/\s+/).filter((w) => /^\p{L}/u.test(w));
|
|
@@ -26,14 +27,19 @@ export function toneOf(id) {
|
|
|
26
27
|
}
|
|
27
28
|
export function Avatar({ name, kind = "person", size = 32, id, tone, colour, src, icon, presence, badge, className }) {
|
|
28
29
|
const person = kind === "person";
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
30
|
+
const record = icon != null && icon !== false && (person || kind === "thing");
|
|
31
|
+
const coloured = (!person || record) && colour && optionColours.includes(colour) ? colour : undefined;
|
|
32
|
+
const letters = kind === "thing" || kind === "agent" ? initials(name).slice(0, 1) : initials(name);
|
|
33
|
+
const fallback = record
|
|
34
|
+
? _jsxs(_Fragment, { children: [_jsx("span", { className: "o-avatar-icon", children: icon }), letters && _jsx("span", { className: "o-avatar-initials", children: letters })] })
|
|
35
|
+
: icon ?? letters;
|
|
36
|
+
const avatar = (_jsxs(BaseAvatar.Root, { role: "img", "aria-label": presence ? `${name}, ${presence}` : name, "data-kit": "avatar", "data-tone": person ? tone ?? toneOf(id ?? name) : undefined, "data-colour": coloured, className: cx("o-avatar", SIZE[size], !person && "o-avatar-thing o-smooth o-smooth-ease", kind === "workspace" && "o-avatar-workspace", kind === "agent" && "o-avatar-agent", className), children: [src && _jsx(BaseAvatar.Image, { className: "o-avatar-image", src: src, alt: "" }), _jsx(BaseAvatar.Fallback, { className: "o-avatar-letters", "aria-hidden": "true", children: fallback })] }));
|
|
32
37
|
if (size === 16 || (!presence && (badge == null || badge === false)))
|
|
33
38
|
return avatar;
|
|
34
39
|
return (_jsxs("span", { className: "o-avatar-badged", "data-size": size, "data-thing": person ? undefined : "", children: [avatar, presence ? _jsx("span", { className: "o-avatar-badge", "data-presence": presence, "aria-hidden": "true" })
|
|
35
40
|
: _jsx("span", { className: "o-avatar-badge", "data-badge": "", "aria-hidden": "true", children: badge === true ? null : badge })] }));
|
|
36
41
|
}
|
|
42
|
+
markAvatar(Avatar);
|
|
37
43
|
const ADD_SIZE = { 20: "20", 24: "2xs", 32: "sm", 40: "md", 64: "lg" };
|
|
38
44
|
export function AvatarStack({ people, max = 3, size = 24, className, label, onPick, onAdd, addButton }) {
|
|
39
45
|
const screen = React.useContext(PhoneHost), phone = usePhone() || !!screen;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PieceLooks } from "../../looks/looks.js";
|
|
2
|
-
export type AvatarLookOptionId = "corners" | "smoothing";
|
|
2
|
+
export type AvatarLookOptionId = "corners" | "smoothing" | "mark" | "ground" | "icon-colour";
|
|
3
3
|
/** The Avatar's options; it has no looks. */
|
|
4
4
|
export declare const AVATAR_LOOKS: PieceLooks<AvatarLookOptionId>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
const options = [
|
|
2
2
|
{ id: "corners", name: "Corners", def: "medium", kind: "steps", values: [{ id: "small", name: "Small" }, { id: "medium", name: "Medium" }, { id: "large", name: "Large" }, { id: "xlarge", name: "Extra large" }] },
|
|
3
3
|
{ id: "smoothing", name: "Corner smoothing", def: "smooth", values: [{ id: "round", name: "Round" }, { id: "smooth", name: "Smooth" }] },
|
|
4
|
+
{ id: "mark", name: "With no picture", def: "icon", values: [{ id: "icon", name: "Icon" }, { id: "initials", name: "Initials" }] },
|
|
5
|
+
{ id: "ground", name: "Ground", def: "quiet", values: [{ id: "quiet", name: "Quiet grey" }, { id: "grey", name: "Grey" }, { id: "outline", name: "Outline" }, { id: "colour", name: "Object's colour" }] },
|
|
6
|
+
{ id: "icon-colour", name: "Icon colour", def: "grey", values: [{ id: "grey", name: "Grey" }, { id: "colour", name: "Object's colour" }] },
|
|
4
7
|
];
|
|
5
8
|
export const AVATAR_LOOKS = { id: "avatar", name: "Avatar", options, looks: [] };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface RecordMarkProps {
|
|
2
|
+
/** The record's name: ViewKit's Avatar's initials and accessible name, the atom's `label`. */
|
|
3
|
+
label: string;
|
|
4
|
+
/** ViewKit's own shape for it: a person's round, a thing's square. */
|
|
5
|
+
shape: "person" | "thing";
|
|
6
|
+
/** A stable id, for a person's tone. */
|
|
7
|
+
id?: string;
|
|
8
|
+
/** The picture ViewKit's own Avatar draws (a panel that drew none leaves it out). */
|
|
9
|
+
src?: string;
|
|
10
|
+
/** The picture the app's atom is handed; left out, `src`. */
|
|
11
|
+
picture?: string;
|
|
12
|
+
/** The record's kind as the app names it (`deal`, `company`, `user`), handed to the app's atom. */
|
|
13
|
+
kind?: string;
|
|
14
|
+
size: 16 | 20 | 24 | 32 | 40;
|
|
15
|
+
}
|
|
16
|
+
export declare const RecordMark: ({ label, shape, id, src, picture, kind, size }: RecordMarkProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { PanelControlsContext } from "../internal/panel-controls.js";
|
|
5
|
+
import { markAvatar } from "./avatar-mark.js";
|
|
6
|
+
import { Avatar } from "./avatar.js";
|
|
7
|
+
export const RecordMark = markAvatar(function RecordMark({ label, shape, id, src, picture, kind, size }) {
|
|
8
|
+
const App = React.useContext(PanelControlsContext).Avatar;
|
|
9
|
+
const own = _jsx(Avatar, { name: label, kind: shape, id: id, src: src, size: size });
|
|
10
|
+
if (!App)
|
|
11
|
+
return own;
|
|
12
|
+
return _jsx(App, { label: label, avatarUrl: picture ?? src ?? null, kind: kind, size: size === 16 ? "chip" : size, fallback: own });
|
|
13
|
+
});
|
|
@@ -114,6 +114,18 @@ export declare const AVATAR_TOKENS: readonly [{
|
|
|
114
114
|
readonly name: "--vk-neutral";
|
|
115
115
|
readonly kind: "colour";
|
|
116
116
|
readonly outright: "--background-neutral";
|
|
117
|
+
}, {
|
|
118
|
+
readonly name: "--vk-neutral-hovered";
|
|
119
|
+
readonly kind: "colour";
|
|
120
|
+
readonly outright: "--background-neutral-hovered";
|
|
121
|
+
}, {
|
|
122
|
+
readonly name: "--vk-neutral-bold";
|
|
123
|
+
readonly kind: "colour";
|
|
124
|
+
readonly outright: "--gray-400";
|
|
125
|
+
}, {
|
|
126
|
+
readonly name: "--vk-border-input";
|
|
127
|
+
readonly kind: "colour";
|
|
128
|
+
readonly outright: "--border-input";
|
|
117
129
|
}, {
|
|
118
130
|
readonly name: "--vk-person-1";
|
|
119
131
|
readonly kind: "colour";
|
|
@@ -28,6 +28,9 @@ export const AVATAR_TOKENS = [
|
|
|
28
28
|
{ name: "--vk-label-pink", kind: "colour", outright: "--label-pink" },
|
|
29
29
|
{ name: "--vk-label-teal", kind: "colour", outright: "--label-teal" },
|
|
30
30
|
{ name: "--vk-neutral", kind: "colour", outright: "--background-neutral" },
|
|
31
|
+
{ name: "--vk-neutral-hovered", kind: "colour", outright: "--background-neutral-hovered" },
|
|
32
|
+
{ name: "--vk-neutral-bold", kind: "colour", outright: "--gray-400" },
|
|
33
|
+
{ name: "--vk-border-input", kind: "colour", outright: "--border-input" },
|
|
31
34
|
{ name: "--vk-person-1", kind: "colour", outright: "--person-1" },
|
|
32
35
|
{ name: "--vk-person-2", kind: "colour", outright: "--person-2" },
|
|
33
36
|
{ name: "--vk-person-3", kind: "colour", outright: "--person-3" },
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/* The Avatar. Every value it draws with is a
|
|
2
2
|
token (control tokens); this file only says which token each kind and size takes. People are circles on
|
|
3
3
|
their own tone (data-tone, 1 to 6); things are squares on a quiet ground; the workspace is the brand; an agent is a thing's
|
|
4
|
-
square holding its own icon; a square handed its own colour (data-colour, a label hue) stands on that hue instead.
|
|
4
|
+
square holding its own icon; a square handed its own colour (data-colour, a label hue) stands on that hue instead. A person or a
|
|
5
|
+
thing handed its object's icon draws it, with no picture, by the last three. Its options, on the frame around it (looks.ts):
|
|
5
6
|
|
|
6
|
-
data-avatar-corners small · medium · large · xlarge a radius token per size; nothing set is Medium
|
|
7
|
+
data-avatar-corners small · medium · large · xlarge a square's radius token per size; nothing set is Medium
|
|
7
8
|
data-avatar-smoothing round · smooth how a square's corners bend; nothing set is Smooth
|
|
9
|
+
data-avatar-mark icon · initials the object's icon, or its letters on today's look; nothing set is Icon
|
|
10
|
+
data-avatar-ground quiet · grey · outline · colour under the icon; nothing set is Quiet grey
|
|
11
|
+
data-avatar-icon-colour grey · colour the icon's ink; nothing set is Grey
|
|
8
12
|
|
|
9
13
|
The rules sit in the components layer, so a utility class on an avatar still wins. */
|
|
10
14
|
@layer components {
|
|
@@ -37,12 +41,12 @@
|
|
|
37
41
|
.o-avatar.o-avatar-96 { width: calc(var(--vk-spacing) * 24); height: calc(var(--vk-spacing) * 24); font-size: var(--vk-font-size-4xl); }
|
|
38
42
|
|
|
39
43
|
/* ── A thing: a square, its corners a step that grows with it, on the neutral ground, its edge inside ─ */
|
|
40
|
-
.o-avatar.o-avatar-thing { border-radius: var(--avatar-r); background-color: var(--vk-neutral); color: var(--vk-fg-subtle); box-shadow: inset 0 0 0 var(--vk-border-width) var(--
|
|
44
|
+
.o-avatar.o-avatar-thing { --avatar-edge: var(--vk-border-subtle); border-radius: var(--avatar-r); background-color: var(--vk-neutral); color: var(--vk-fg-subtle); box-shadow: inset 0 0 0 var(--vk-border-width) var(--avatar-edge); }
|
|
41
45
|
/* The workspace: the one square in the brand. */
|
|
42
|
-
.o-avatar.o-avatar-workspace { background-color: var(--vk-brand); color: var(--vk-fg-on-brand);
|
|
46
|
+
.o-avatar.o-avatar-workspace { --avatar-edge: transparent; background-color: var(--vk-brand); color: var(--vk-fg-on-brand); }
|
|
43
47
|
/* A square's own colour, the workspace's included: on the hue's fill, what it holds in the hue's strong ink, with no edge; grey
|
|
44
48
|
the neutral ground in the quieter ink. */
|
|
45
|
-
.o-avatar.o-avatar-thing[data-colour] {
|
|
49
|
+
.o-avatar.o-avatar-thing[data-colour] { --avatar-edge: transparent; }
|
|
46
50
|
.o-avatar.o-avatar-thing[data-colour="blue"] { background-color: var(--vk-label-blue-fill); color: var(--vk-label-blue-strong); }
|
|
47
51
|
.o-avatar.o-avatar-thing[data-colour="green"] { background-color: var(--vk-label-green-fill); color: var(--vk-label-green-strong); }
|
|
48
52
|
.o-avatar.o-avatar-thing[data-colour="amber"] { background-color: var(--vk-label-amber-fill); color: var(--vk-label-amber-strong); }
|
|
@@ -67,10 +71,43 @@
|
|
|
67
71
|
.o-avatar.o-avatar-agent[data-colour="teal"]:where([data-vk-phone] *) { background-color: var(--vk-label-teal); }
|
|
68
72
|
.o-avatar.o-avatar-agent[data-colour="grey"]:where([data-vk-phone] *) { background-color: var(--vk-fg-subtlest); }
|
|
69
73
|
|
|
70
|
-
/* ──
|
|
71
|
-
|
|
74
|
+
/* ── A record's mark, a person's or a thing's, when the app hands its object's icon (VK-1039, after Attio): with no picture
|
|
75
|
+
(the fallback holds the icon only while no photo or logo has loaded, so a src always wins) the icon, or under Initials its
|
|
76
|
+
letters on today's look. The icon stands on its Ground in its Icon colour, through the private properties below; a person
|
|
77
|
+
keeps its circle. The grey ink follows the ground, as the sketch drew it: the quietest on Quiet grey, the subtle one on the
|
|
78
|
+
rest. The object's colour is the hue handed (data-colour), its fill under the icon, its strong ink on it; handed none, the greys. */
|
|
79
|
+
.o-avatar-letters > :is(.o-avatar-icon, .o-avatar-initials) { display: contents; }
|
|
80
|
+
.o-avatar-letters > .o-avatar-initials { display: none; }
|
|
81
|
+
[data-avatar-mark="initials"] .o-avatar-letters > .o-avatar-initials { display: contents; }
|
|
82
|
+
[data-avatar-mark="initials"] .o-avatar-letters > .o-avatar-icon:has(+ .o-avatar-initials) { display: none; }
|
|
83
|
+
.o-avatar[data-colour="blue"] { --avatar-hue-fill: var(--vk-label-blue-fill); --avatar-hue-ink: var(--vk-label-blue-strong); }
|
|
84
|
+
.o-avatar[data-colour="green"] { --avatar-hue-fill: var(--vk-label-green-fill); --avatar-hue-ink: var(--vk-label-green-strong); }
|
|
85
|
+
.o-avatar[data-colour="amber"] { --avatar-hue-fill: var(--vk-label-amber-fill); --avatar-hue-ink: var(--vk-label-amber-strong); }
|
|
86
|
+
.o-avatar[data-colour="red"] { --avatar-hue-fill: var(--vk-label-red-fill); --avatar-hue-ink: var(--vk-label-red-strong); }
|
|
87
|
+
.o-avatar[data-colour="purple"] { --avatar-hue-fill: var(--vk-label-purple-fill); --avatar-hue-ink: var(--vk-label-purple-strong); }
|
|
88
|
+
.o-avatar[data-colour="pink"] { --avatar-hue-fill: var(--vk-label-pink-fill); --avatar-hue-ink: var(--vk-label-pink-strong); }
|
|
89
|
+
.o-avatar[data-colour="teal"] { --avatar-hue-fill: var(--vk-label-teal-fill); --avatar-hue-ink: var(--vk-label-teal-strong); }
|
|
90
|
+
.o-avatar[data-colour="grey"] { --avatar-hue-fill: var(--vk-neutral-hovered); --avatar-hue-ink: var(--vk-fg-subtle); }
|
|
91
|
+
/* Quiet grey, with nothing set: a step above background-neutral, so it shows on a drawer in dark; no edge. A person's circle
|
|
92
|
+
draws its edge inside, as a square's does without Smooth (a square's own rules draw its edge, the ring under Smooth too). */
|
|
93
|
+
.o-avatar:has(> .o-avatar-letters > .o-avatar-icon):not([data-avatar-mark="initials"] *) {
|
|
94
|
+
--avatar-ground: var(--vk-neutral-hovered); --avatar-grey-ink: var(--vk-fg-subtlest); --avatar-edge: transparent;
|
|
95
|
+
background-color: var(--avatar-ground); color: var(--avatar-ink, var(--avatar-grey-ink));
|
|
96
|
+
}
|
|
97
|
+
.o-avatar:not(.o-avatar-thing):has(> .o-avatar-letters > .o-avatar-icon):not([data-avatar-mark="initials"] *) { box-shadow: inset 0 0 0 var(--vk-border-width) var(--avatar-edge); }
|
|
98
|
+
/* Grey: two steps above. */
|
|
99
|
+
[data-avatar-ground="grey"] .o-avatar:has(> .o-avatar-letters > .o-avatar-icon):not([data-avatar-mark="initials"] *) { --avatar-ground: var(--vk-neutral-bold); --avatar-grey-ink: var(--vk-fg-subtle); }
|
|
100
|
+
/* Outline: no ground, its edge a field's. */
|
|
101
|
+
[data-avatar-ground="outline"] .o-avatar:has(> .o-avatar-letters > .o-avatar-icon):not([data-avatar-mark="initials"] *) { --avatar-ground: transparent; --avatar-grey-ink: var(--vk-fg-subtle); --avatar-edge: var(--vk-border-input); }
|
|
102
|
+
/* The object's colour: its hue's fill. */
|
|
103
|
+
[data-avatar-ground="colour"] .o-avatar[data-colour]:has(> .o-avatar-letters > .o-avatar-icon):not([data-avatar-mark="initials"] *) { --avatar-ground: var(--avatar-hue-fill); --avatar-grey-ink: var(--vk-fg-subtle); }
|
|
104
|
+
/* Icon colour, the object's: its hue's strong ink. */
|
|
105
|
+
[data-avatar-icon-colour="colour"] .o-avatar[data-colour]:has(> .o-avatar-letters > .o-avatar-icon):not([data-avatar-mark="initials"] *) { --avatar-ink: var(--avatar-hue-ink); }
|
|
106
|
+
|
|
107
|
+
/* ── Corners: a radius token per size, in steps, 56 taking 64's and 16 taking 20's; Medium with nothing set: sm at 16, 20, 24 and 32,
|
|
108
|
+
md at 40, lg at 56 and 64, 2xl at 96 (two steps past 64's, as round 3's photo draws it), between Small and Large. At 16 and 20
|
|
109
|
+
each step sits one past 24's (VK-1045): Small xs, Medium sm, Large md, Extra large lg, so Medium is no longer Small there. ── */
|
|
72
110
|
.o-avatar.o-avatar-thing { --avatar-r: var(--vk-radius-sm); }
|
|
73
|
-
.o-avatar.o-avatar-thing:is(.o-avatar-2xs, .o-avatar-xs) { --avatar-r: var(--vk-radius-xs); }
|
|
74
111
|
.o-avatar.o-avatar-thing.o-avatar-lg { --avatar-r: var(--vk-radius-md); }
|
|
75
112
|
.o-avatar.o-avatar-thing:is(.o-avatar-56, .o-avatar-xl) { --avatar-r: var(--vk-radius-lg); }
|
|
76
113
|
.o-avatar.o-avatar-thing.o-avatar-96 { --avatar-r: var(--vk-radius-2xl); }
|
|
@@ -79,15 +116,15 @@
|
|
|
79
116
|
[data-avatar-corners="small"] .o-avatar.o-avatar-thing:is(.o-avatar-2xs, .o-avatar-xs, .o-avatar-sm) { --avatar-r: var(--vk-radius-xs); }
|
|
80
117
|
[data-avatar-corners="small"] .o-avatar.o-avatar-thing:is(.o-avatar-56, .o-avatar-xl) { --avatar-r: var(--vk-radius-md); }
|
|
81
118
|
[data-avatar-corners="small"] .o-avatar.o-avatar-thing.o-avatar-96 { --avatar-r: var(--vk-radius-xl); }
|
|
82
|
-
/* Large, the radii before Medium came:
|
|
119
|
+
/* Large, the radii before Medium came (but 16 and 20's, VK-1045): md at 16 and 20, sm at 24, md at 32, lg at 40, xl at 56 and 64, 3xl at 96. */
|
|
83
120
|
[data-avatar-corners="large"] .o-avatar.o-avatar-thing { --avatar-r: var(--vk-radius-md); }
|
|
84
|
-
[data-avatar-corners="large"] .o-avatar.o-avatar-thing
|
|
121
|
+
[data-avatar-corners="large"] .o-avatar.o-avatar-thing.o-avatar-sm { --avatar-r: var(--vk-radius-sm); }
|
|
85
122
|
[data-avatar-corners="large"] .o-avatar.o-avatar-thing.o-avatar-lg { --avatar-r: var(--vk-radius-lg); }
|
|
86
123
|
[data-avatar-corners="large"] .o-avatar.o-avatar-thing:is(.o-avatar-56, .o-avatar-xl) { --avatar-r: var(--vk-radius-xl); }
|
|
87
124
|
[data-avatar-corners="large"] .o-avatar.o-avatar-thing.o-avatar-96 { --avatar-r: var(--vk-radius-3xl); }
|
|
88
|
-
/* Extra large:
|
|
125
|
+
/* Extra large: lg at 16 and 20 (VK-1045), md at 24, lg at 32, xl at 40, 2xl at 56 and 64, 4xl at 96. */
|
|
89
126
|
[data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing { --avatar-r: var(--vk-radius-lg); }
|
|
90
|
-
[data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing
|
|
127
|
+
[data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing.o-avatar-sm { --avatar-r: var(--vk-radius-md); }
|
|
91
128
|
[data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing.o-avatar-lg { --avatar-r: var(--vk-radius-xl); }
|
|
92
129
|
[data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing:is(.o-avatar-56, .o-avatar-xl) { --avatar-r: var(--vk-radius-2xl); }
|
|
93
130
|
[data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing.o-avatar-96 { --avatar-r: var(--vk-radius-4xl); }
|
|
@@ -97,7 +134,7 @@
|
|
|
97
134
|
smoothing eases off where a side is too short for 1.7 radii at each end, as the canvas drew it (o-smooth-ease, from its size and
|
|
98
135
|
its radius, both tokens, so it follows Corner radius). The outline would cut the edge drawn inside the square, so under it the
|
|
99
136
|
edge is a ring of its own (::before), between the outline and the same outline drawn a hairline in, under whatever the square
|
|
100
|
-
holds
|
|
137
|
+
holds, in --avatar-edge: the workspace and a square on its own colour draw it in none, a record's icon by its Ground. Its smoothing is its own Corner smoothing, never a host's: the outline's amount inherits, and a
|
|
101
138
|
crumb, a tab or a list's card that follows the token sets it on itself, so the square sets it back. ─────── */
|
|
102
139
|
@supports (clip-path: shape(evenodd from 0 0, curve by 1px 1px with 1px 0 / 1px 0, close, move to 0 0, hline to 1px, close)) and (width: calc(tan(atan2(1px, 1px)) * 1px)) {
|
|
103
140
|
.o-avatar.o-avatar-thing { --smooth-amount: initial; }
|
|
@@ -105,11 +142,11 @@
|
|
|
105
142
|
--avatar-rr: min(var(--avatar-r), var(--avatar-size) / 2); --smooth-t: var(--avatar-rr); --smooth-side: var(--avatar-size);
|
|
106
143
|
position: relative; box-shadow: none; clip-path: shape(var(--smooth-outline));
|
|
107
144
|
}
|
|
108
|
-
/* Its edge, a hairline ring along the outline, under the picture or the letters it holds
|
|
109
|
-
own colour
|
|
110
|
-
.o-avatar.o-avatar-thing:not(
|
|
145
|
+
/* Its edge, a hairline ring along the outline, under the picture or the letters it holds, in --avatar-edge: the workspace and a
|
|
146
|
+
square on its own colour draw it in none. */
|
|
147
|
+
.o-avatar.o-avatar-thing:not([data-avatar-smoothing="round"] *)::before {
|
|
111
148
|
--smooth-t: calc(var(--avatar-rr) - var(--vk-border-width)); --smooth-in: var(--vk-border-width);
|
|
112
|
-
content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-color: var(--
|
|
149
|
+
content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-color: var(--avatar-edge);
|
|
113
150
|
clip-path: shape(var(--smooth-ring));
|
|
114
151
|
}
|
|
115
152
|
}
|
|
@@ -3,16 +3,14 @@ import * as React from "react";
|
|
|
3
3
|
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
4
4
|
import { cx as cn } from "../../internal/cx.js";
|
|
5
5
|
import { AlertDialog } from "../alert-dialog/alert-dialog.js";
|
|
6
|
-
import {
|
|
7
|
-
import { Button } from "../button/button.js";
|
|
8
|
-
import { Menu } from "../menu/menu.js";
|
|
6
|
+
import { RecordMark } from "../avatar/record-mark.js";
|
|
9
7
|
import { Picker, usePicker } from "../picker/picker.js";
|
|
10
|
-
import { Popover } from "../popover/popover.js";
|
|
11
8
|
import { Sheet, SheetBody, SheetHead } from "../sheet/bottom-sheet.js";
|
|
12
9
|
import { StatusGlyph } from "../status/status.js";
|
|
13
10
|
import { Toast, createToastManager } from "../toast/toast.js";
|
|
14
11
|
import { ToolbarControl, ToolbarSeparatorControl } from "../toolbar/toolbar.js";
|
|
15
12
|
import { Icon } from "../internal/icons.js";
|
|
13
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
16
14
|
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
17
15
|
import { spacingPx } from "../internal/read-token.js";
|
|
18
16
|
import { fitOnBar, moreRows, wordsOf } from "./bulk-bar-of.js";
|
|
@@ -36,7 +34,7 @@ function markOf(as, label) {
|
|
|
36
34
|
if (!as)
|
|
37
35
|
return undefined;
|
|
38
36
|
if ("avatar" in as)
|
|
39
|
-
return _jsx(
|
|
37
|
+
return _jsx(RecordMark, { label: label, shape: as.avatar === "company" ? "thing" : "person", id: as.id, src: as.src, kind: as.kind, size: 20 });
|
|
40
38
|
if ("status" in as)
|
|
41
39
|
return _jsx(StatusGlyph, { place: as.status, quarters: as.quarters });
|
|
42
40
|
if ("mark" in as)
|
|
@@ -46,6 +44,7 @@ function markOf(as, label) {
|
|
|
46
44
|
const EMPTY = "\u0000empty", DIFFER = "\u0000differ";
|
|
47
45
|
export function BulkBar({ count, noun: given, onClear, verbs, onDelete, deleteLine, deleteLabel, busy = false, form, standing = false, className, words: said }) {
|
|
48
46
|
const w = React.useMemo(() => bulkBarWords(said), [said]);
|
|
47
|
+
const { Button, Menu, Popover } = usePanelControls();
|
|
49
48
|
const noun = given ?? w.noun;
|
|
50
49
|
const host = React.useContext(PhoneHost), narrow = usePhone();
|
|
51
50
|
const phone = form ? form === "phone" : host != null || narrow;
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { resolveViewsMessage } from "../../contract.js";
|
|
5
5
|
import { ViewsContext } from "../../provider/context.js";
|
|
6
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
6
7
|
import { menuWordsOf, pickerItemsOf, pickerWordsOf } from "../picker/map-picker.js";
|
|
7
8
|
import { BulkBar } from "./bulk-bar.js";
|
|
8
9
|
export function bulkBarWordsOf(say) {
|
|
@@ -53,5 +54,5 @@ export function MapSelectionBar({ count, noun, onClear, verbs, busy, onDelete, d
|
|
|
53
54
|
const words = React.useMemo(() => bulkBarWordsOf(messages), [messages]);
|
|
54
55
|
const AppIcon = views?.components.AppIcon;
|
|
55
56
|
const bulk = React.useMemo(() => bulkVerbsOf(verbs, AppIcon), [verbs, AppIcon]);
|
|
56
|
-
return (_jsx(BulkBar, { count: count, onClear: onClear, verbs: bulk, words: words, ...(noun ? { noun } : {}), ...(busy !== undefined ? { busy } : {}), ...(onDelete ? { onDelete: runOf(onDelete) } : {}), ...(deleteLabel !== undefined ? { deleteLabel } : {}), ...(deleteLine !== undefined ? { deleteLine } : {}) }));
|
|
57
|
+
return (_jsx(PanelControlsFromViews, { children: _jsx(BulkBar, { count: count, onClear: onClear, verbs: bulk, words: words, ...(noun ? { noun } : {}), ...(busy !== undefined ? { busy } : {}), ...(onDelete ? { onDelete: runOf(onDelete) } : {}), ...(deleteLabel !== undefined ? { deleteLabel } : {}), ...(deleteLine !== undefined ? { deleteLine } : {}) }) }));
|
|
57
58
|
}
|
|
@@ -65,6 +65,9 @@ export type CompoundEditorProps = PartsCommon & ({
|
|
|
65
65
|
bands?: RangeBand[];
|
|
66
66
|
/** It may be emptied; left out, it may. Can't, both ends cleared keeps the range it had, and says so. */
|
|
67
67
|
empty?: boolean;
|
|
68
|
+
/** The least and most each end may hold: its boxes step within them, and an end typed outside is drawn back as the box is left. */
|
|
69
|
+
min?: number;
|
|
70
|
+
max?: number;
|
|
68
71
|
});
|
|
69
72
|
export type NamePartsProps = Extract<CompoundEditorProps, {
|
|
70
73
|
kind: "name";
|
|
@@ -15,6 +15,6 @@ export declare function placeCountriesOf(p: PlaceBody): Country[];
|
|
|
15
15
|
export declare function compoundEditorWordsOf(say: ViewsMessageResolver): CompoundEditorWords;
|
|
16
16
|
/** ViewKit's parts body's props as the Compound editor's, held as a shell that keeps the draft. */
|
|
17
17
|
export declare function partsBodyPropsOf(p: ViewsPartsBodyProps, words?: CompoundEditorWords): CompoundEditorProps;
|
|
18
|
-
/** ViewKit's parts body,
|
|
18
|
+
/** ViewKit's parts body, its controls the app's where the provider's `panelControls` names them (VK-1022). */
|
|
19
19
|
export declare function MapPartsBody(props: ViewsPartsBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { resolveViewsMessage } from "../../contract.js";
|
|
5
5
|
import { ViewsContext } from "../../provider/context.js";
|
|
6
6
|
import { pickerWordsOf } from "../picker/map-picker.js";
|
|
7
7
|
import { useToldStep } from "../internal/told-step.js";
|
|
8
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
8
9
|
import { useCompoundEditor } from "./compound-editor.js";
|
|
9
10
|
const NO_NAME = { given: "", family: "", full: "" };
|
|
10
11
|
export function placeCountriesOf(p) {
|
|
@@ -58,9 +59,13 @@ export function partsBodyPropsOf(p, words) {
|
|
|
58
59
|
return { ...common, kind: "place", value: codelessRegion(p), parts: [...p.parts], required: [...p.required], countries: placeCountriesOf(p),
|
|
59
60
|
...(p.opens ? { opens: p.opens } : {}), onValueChange: (v) => p.onValueChange(v ?? {}), onDone: () => p.onDone() };
|
|
60
61
|
return { ...common, kind: "range", value: p.value, decimals: p.decimals, unit: p.unit, bands: p.bands ? [...p.bands] : undefined, empty: p.empty,
|
|
62
|
+
...(p.min !== undefined ? { min: p.min } : {}), ...(p.max !== undefined ? { max: p.max } : {}),
|
|
61
63
|
onValueChange: p.onValueChange, onDone: p.onDone };
|
|
62
64
|
}
|
|
63
65
|
export function MapPartsBody(props) {
|
|
66
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(PartsBodyInner, { ...props }) });
|
|
67
|
+
}
|
|
68
|
+
function PartsBodyInner(props) {
|
|
64
69
|
const messages = React.useContext(ViewsContext)?.messages ?? resolveViewsMessage;
|
|
65
70
|
const words = React.useMemo(() => compoundEditorWordsOf(messages), [messages]);
|
|
66
71
|
const parts = useCompoundEditor(partsBodyPropsOf(props, words));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { midWord } from "../text-editor/check.js";
|
|
5
|
-
import {
|
|
5
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
6
6
|
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
7
7
|
import { fullOf, keptName, nameOf, ownOf, sameName } from "./name.js";
|
|
8
8
|
import { QuietField, PartsRow, MIHAI_CARD } from "./row.js";
|
|
@@ -20,6 +20,7 @@ const startOf = (value, typing) => ({
|
|
|
20
20
|
});
|
|
21
21
|
const NO_NAME = { full: "", given: "", family: "" };
|
|
22
22
|
export function useNameParts(props, worn, wornAt) {
|
|
23
|
+
const { Input } = usePanelControls();
|
|
23
24
|
const { label, value, onValueChange, onDone, empty = false, typing, autoFocus = true } = props;
|
|
24
25
|
const phone = usePhoneForm(props.form), device = phoneMark(usePhoneForm()), fields = worn.boxes === "fields", shownAs = worn.shown === "shown";
|
|
25
26
|
const shell = props.draft === "shell", w = compoundWords(props.words);
|
|
@@ -3,8 +3,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { midWord } from "../text-editor/check.js";
|
|
5
5
|
import { Field, FieldRowsRow as FieldRow, FieldRows } from "../field/field.js";
|
|
6
|
-
import {
|
|
7
|
-
import { Select } from "../select/select.js";
|
|
6
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
8
7
|
import { usePicker } from "../picker/picker.js";
|
|
9
8
|
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
10
9
|
import { Flag } from "../flag/flag.js";
|
|
@@ -21,6 +20,7 @@ const X = ["M18 6l-12 12", "M6 6l12 12"], TICK = ["M5 12l5 5l10 -10"];
|
|
|
21
20
|
let EVERY = null;
|
|
22
21
|
const TYPED = "\u0000typed";
|
|
23
22
|
export function usePlaceParts(props, worn, wornAt) {
|
|
23
|
+
const { Input, Select } = usePanelControls();
|
|
24
24
|
const { label, value, onValueChange, onDone, parts = PLACE_PARTS, autoFocus = true } = props;
|
|
25
25
|
const phone = usePhoneForm(props.form), device = phoneMark(usePhoneForm()), fields = worn.boxes === "fields", first = worn.country === "first", attio = !first;
|
|
26
26
|
const shell = props.draft === "shell", w = compoundWords(props.words);
|
|
@@ -20,6 +20,7 @@ export function useRangeParts(props, worn, wornAt) {
|
|
|
20
20
|
const w = compoundWords(props.words), numberWords = { increase: w.increase, decrease: w.decrease, field: w.numberField };
|
|
21
21
|
const ENDS = [["low", w.from], ["high", w.to]];
|
|
22
22
|
const format = React.useMemo(() => bareOf(props.decimals), [props.decimals]);
|
|
23
|
+
const limits = { ...(props.min !== undefined ? { min: props.min } : {}), ...(props.max !== undefined ? { max: props.max } : {}) };
|
|
23
24
|
const phone = usePhoneForm(props.form), device = phoneMark(usePhoneForm()), fields = worn.boxes === "fields";
|
|
24
25
|
const shell = props.draft === "shell";
|
|
25
26
|
const [now, setNow] = React.useState(value);
|
|
@@ -84,7 +85,7 @@ export function useRangeParts(props, worn, wornAt) {
|
|
|
84
85
|
};
|
|
85
86
|
const kit = { "data-parts-kind": "range", "data-parts-boxes": worn.boxes, role: "group", "aria-label": label };
|
|
86
87
|
const note = unit && _jsx("p", { className: "o-compound-editor-note", "data-slot": "vk-parts-note", children: unit });
|
|
87
|
-
const boxes = (arrows, onPhone) => (_jsx(PartsRow, { children: ENDS.map(([k, name], i) => (_jsx(QuietField, { label: name, form: onPhone ? "phone" : "computer", "data-slot": "vk-parts-field", "data-key": k, children: _jsx(EndField, { part: k, words: numberWords, value: now[k], set: set(k), box: i === 0 ? first : undefined, phone: onPhone, arrows: arrows, format: format }) }, k))) }));
|
|
88
|
+
const boxes = (arrows, onPhone) => (_jsx(PartsRow, { children: ENDS.map(([k, name], i) => (_jsx(QuietField, { label: name, form: onPhone ? "phone" : "computer", "data-slot": "vk-parts-field", "data-key": k, children: _jsx(EndField, { part: k, limits: limits, words: numberWords, value: now[k], set: set(k), box: i === 0 ? first : undefined, phone: onPhone, arrows: arrows, format: format }) }, k))) }));
|
|
88
89
|
if (phone) {
|
|
89
90
|
const body = (_jsxs("div", { ref: root, className: "o-compound-editor", "data-slot": "vk-parts", "data-kit": "compound-editor", ...kit, "data-parts-form": "phone", ...device, onKeyDown: (e) => {
|
|
90
91
|
if (e.key !== "Enter" || midWord(e.nativeEvent))
|
|
@@ -97,23 +98,23 @@ export function useRangeParts(props, worn, wornAt) {
|
|
|
97
98
|
ends[1].focus({ preventScroll: true });
|
|
98
99
|
else
|
|
99
100
|
keep();
|
|
100
|
-
}, children: [fields ? (_jsx(FieldRows, { look: MIHAI_CARD, className: "o-compound-editor-card", "data-slot": "vk-parts-card", children: ENDS.map(([k, name], i) => (_jsx(FieldRow, { label: name, className: "o-compound-editor-card-row", "data-slot": "vk-parts-field", "data-key": k, labelClassName: "o-compound-editor-card-label", children: _jsx(CardEnd, { part: k, words: numberWords, value: now[k], set: set(k), box: i === 0 ? first : undefined, format: format }) }, k))) })) : boxes(false, true), note, clearedNote, bandList] }));
|
|
101
|
+
}, children: [fields ? (_jsx(FieldRows, { look: MIHAI_CARD, className: "o-compound-editor-card", "data-slot": "vk-parts-card", children: ENDS.map(([k, name], i) => (_jsx(FieldRow, { label: name, className: "o-compound-editor-card-row", "data-slot": "vk-parts-field", "data-key": k, labelClassName: "o-compound-editor-card-label", children: _jsx(CardEnd, { part: k, limits: limits, words: numberWords, value: now[k], set: set(k), box: i === 0 ? first : undefined, format: format }) }, k))) })) : boxes(false, true), note, clearedNote, bandList] }));
|
|
101
102
|
if (shell)
|
|
102
103
|
return { body, head: {} };
|
|
103
104
|
return { body, head: { left: _jsx(SheetButton, { "data-slot": "vk-editor-close", "aria-label": "Close", icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": "Save", icon: glyph(TICK), onClick: keep }) } };
|
|
104
105
|
}
|
|
105
|
-
const body = (_jsxs("div", { ref: root, className: "o-compound-editor", "data-slot": "vk-parts", "data-kit": "compound-editor", ...kit, "data-parts-form": "computer", ...device, onKeyDown: onKeyDown, onBlur: shell ? undefined : (e) => blurKeeps(settled, keep)(e), onFocus: () => { settled.current = false; }, children: [fields ? (_jsx("div", { className: "o-compound-editor-pair", "data-slot": "vk-parts-pair", children: ENDS.map(([k, name], i) => (_jsxs(React.Fragment, { children: [i === 1 && _jsx("span", { className: "o-compound-editor-dash", "aria-hidden": "true", children: "\u2013" }), _jsx(Field, { label: name, "data-slot": "vk-parts-field", "data-key": k, children: _jsx(PairField, { part: k, words: numberWords, value: now[k], set: set(k), box: i === 0 ? first : undefined, format: format }) })] }, k))) })) : boxes(worn.arrows === "editing", false), note, clearedNote, bandList] }));
|
|
106
|
+
const body = (_jsxs("div", { ref: root, className: "o-compound-editor", "data-slot": "vk-parts", "data-kit": "compound-editor", ...kit, "data-parts-form": "computer", ...device, onKeyDown: onKeyDown, onBlur: shell ? undefined : (e) => blurKeeps(settled, keep)(e), onFocus: () => { settled.current = false; }, children: [fields ? (_jsx("div", { className: "o-compound-editor-pair", "data-slot": "vk-parts-pair", children: ENDS.map(([k, name], i) => (_jsxs(React.Fragment, { children: [i === 1 && _jsx("span", { className: "o-compound-editor-dash", "aria-hidden": "true", children: "\u2013" }), _jsx(Field, { label: name, "data-slot": "vk-parts-field", "data-key": k, children: _jsx(PairField, { part: k, limits: limits, words: numberWords, value: now[k], set: set(k), box: i === 0 ? first : undefined, format: format }) })] }, k))) })) : boxes(worn.arrows === "editing", false), note, clearedNote, bandList] }));
|
|
106
107
|
return { body, head: {} };
|
|
107
108
|
}
|
|
108
|
-
function EndField({ part, words, value, set, box, phone, arrows, format }) {
|
|
109
|
+
function EndField({ part, words, value, set, box, limits, phone, arrows, format }) {
|
|
109
110
|
const root = React.useCallback((el) => box?.(el?.querySelector("input") ?? null), [box]);
|
|
110
|
-
return _jsx(NumberField, { ref: root, "data-slot": "vk-parts-box", "data-key": part, words: words, size: phone ? "lg" : "sm", align: "end", steppers: arrows ? "arrows" : false, autofill: false, value: value, onValueChange: (v) => set(v), format: format });
|
|
111
|
+
return _jsx(NumberField, { ref: root, "data-slot": "vk-parts-box", "data-key": part, words: words, size: phone ? "lg" : "sm", align: "end", steppers: arrows ? "arrows" : false, autofill: false, value: value, onValueChange: (v) => set(v), format: format, ...limits });
|
|
111
112
|
}
|
|
112
|
-
function CardEnd({ part, words, value, set, box, format }) {
|
|
113
|
+
function CardEnd({ part, words, value, set, box, limits, format }) {
|
|
113
114
|
const root = React.useCallback((el) => box?.(el?.querySelector("input") ?? null), [box]);
|
|
114
|
-
return _jsx(NumberField, { ref: root, "data-slot": "vk-parts-box", "data-key": part, words: words, chrome: "bare", autofill: false, value: value, onValueChange: (v) => set(v), format: format });
|
|
115
|
+
return _jsx(NumberField, { ref: root, "data-slot": "vk-parts-box", "data-key": part, words: words, chrome: "bare", autofill: false, value: value, onValueChange: (v) => set(v), format: format, ...limits });
|
|
115
116
|
}
|
|
116
|
-
function PairField({ part, words, value, set, box, format }) {
|
|
117
|
+
function PairField({ part, words, value, set, box, limits, format }) {
|
|
117
118
|
const root = React.useCallback((el) => box?.(el?.querySelector("input") ?? null), [box]);
|
|
118
|
-
return _jsx(NumberField, { ref: root, "data-slot": "vk-parts-box", "data-key": part, words: words, size: "sm", steppers: false, autofill: false, value: value, onValueChange: (v) => set(v), format: format });
|
|
119
|
+
return _jsx(NumberField, { ref: root, "data-slot": "vk-parts-box", "data-key": part, words: words, size: "sm", steppers: false, autofill: false, value: value, onValueChange: (v) => set(v), format: format, ...limits });
|
|
119
120
|
}
|
|
@@ -35,14 +35,16 @@ export interface CustomizeSection {
|
|
|
35
35
|
back: () => void;
|
|
36
36
|
} | null;
|
|
37
37
|
}
|
|
38
|
-
/** A setting turned on or off: its key, words, value and write; `icon`, its mark before its name; `
|
|
39
|
-
*
|
|
38
|
+
/** A setting turned on or off: its key, words, value and write; `icon`, its mark before its name; `section`, the heading it
|
|
39
|
+
* stands under. */
|
|
40
40
|
export interface CustomizeToggle {
|
|
41
41
|
key: string;
|
|
42
42
|
label: string;
|
|
43
43
|
value: boolean;
|
|
44
44
|
onChange: (on: boolean) => void;
|
|
45
45
|
icon?: React.ReactNode;
|
|
46
|
+
/** @deprecated Drawn nowhere since a toggle carries no way back of its own (VK-1033): Customize's Reset is the way back. To be
|
|
47
|
+
* removed in a later release. */
|
|
46
48
|
reset?: () => void;
|
|
47
49
|
section?: string;
|
|
48
50
|
}
|
|
@@ -57,11 +59,11 @@ export interface CustomizeChoice {
|
|
|
57
59
|
}[];
|
|
58
60
|
onChange: (value: string) => void;
|
|
59
61
|
}
|
|
60
|
-
/** Layout's own settings, in place of a table's Freeze and Wrap: its pick-one settings
|
|
61
|
-
* over a shared view, with its way back. */
|
|
62
|
+
/** Layout's own settings, in place of a table's Freeze and Wrap: its pick-one settings and its toggles. */
|
|
62
63
|
export interface CustomizeLayoutSettings {
|
|
63
64
|
toggles: CustomizeToggle[];
|
|
64
65
|
choices: CustomizeChoice[];
|
|
66
|
+
/** @deprecated Drawn nowhere since the Layout page ends at its toggles (VK-1033). To be removed in a later release. */
|
|
65
67
|
personal?: {
|
|
66
68
|
label: string;
|
|
67
69
|
toggles: CustomizeToggle[];
|
|
@@ -131,7 +133,14 @@ export interface CustomizeProps {
|
|
|
131
133
|
toggles?: CustomizeToggle[];
|
|
132
134
|
/** Layout's own settings, in place of a table's Freeze and Wrap from the view. */
|
|
133
135
|
layoutSettings?: CustomizeLayoutSettings;
|
|
134
|
-
/**
|
|
136
|
+
/** Each page's own Reset, while that page differs from the view as saved (VK-1034): drawn on its screen, in the first
|
|
137
|
+
* page's Reset's word and look and place, never on a level the screen opened in place. Handed (even empty), these
|
|
138
|
+
* alone stand: `columnsReset` is not read. */
|
|
139
|
+
resets?: Partial<Record<Exclude<CustomizeScreen, "list">, () => void>>;
|
|
140
|
+
/** A section differs from the view as saved (VK-1048): its value in the brand. Absent, Layout and Columns carry no mark;
|
|
141
|
+
* Filter, Sort and Group carry their own section's `inForce`. */
|
|
142
|
+
differs?: Partial<Record<Exclude<CustomizeScreen, "list">, boolean>>;
|
|
143
|
+
/** @deprecated Columns' page Reset where no `resets` is handed at all. To be removed in a later release. */
|
|
135
144
|
columnsReset?: () => void;
|
|
136
145
|
/** A card's field starting a new line, turned on or off (its column's `line`, VK-890). */
|
|
137
146
|
onLineChange?: (id: string) => void;
|
|
@@ -40,7 +40,7 @@ const LAYOUT_MARKS = {
|
|
|
40
40
|
};
|
|
41
41
|
export const layoutMark = (id) => (LAYOUT_MARKS[id] ? glyph([LAYOUT_MARKS[id]]) : undefined);
|
|
42
42
|
export function useCustomize(props) {
|
|
43
|
-
const { view, onViewChange, layouts, filter, sort, group, changed = false, onReset, onSave, pending = false, stale = false, exportCount, onCopyLink, onExport, toggles, layoutSettings, columnsReset, onLineChange, columnsFoot, fields = [], foldFields = false, onClose, onScreenChange } = props;
|
|
43
|
+
const { view, onViewChange, layouts, filter, sort, group, changed = false, onReset, onSave, pending = false, stale = false, exportCount, onCopyLink, onExport, toggles, layoutSettings, columnsReset, resets, differs, onLineChange, columnsFoot, fields = [], foldFields = false, onClose, onScreenChange } = props;
|
|
44
44
|
const w = customizeWords(props.words);
|
|
45
45
|
const { Button, Input } = usePanelControls();
|
|
46
46
|
const host = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (host || small ? "phone" : "computer")) === "phone";
|
|
@@ -120,10 +120,7 @@ export function useCustomize(props) {
|
|
|
120
120
|
const layout = layouts.find((l) => l.id === view.layout) ?? layouts[0];
|
|
121
121
|
const part = (slot, key) => ({ slot: { slot, ...(key !== undefined ? { key } : {}) } });
|
|
122
122
|
const section = (label, icon, s, key) => s ? [{ kind: "actions", icon, label, detail: s.says, inForce: s.inForce, entries: [], ...part("vk-customize-section", key) }] : [];
|
|
123
|
-
const toggleRows = (ts) => ts.
|
|
124
|
-
{ kind: "check", label: t.label, checked: t.value, onCheckedChange: (on) => t.onChange(on), ...(t.icon != null && { icon: t.icon }), ...part("vk-customize-toggle", t.key) },
|
|
125
|
-
...(t.reset ? [{ icon: null, label: w.toggleReset(t.label), onSelect: t.reset, ...part("vk-customize-toggle-reset", t.key) }] : []),
|
|
126
|
-
]);
|
|
123
|
+
const toggleRows = (ts) => ts.map((t) => ({ kind: "check", label: t.label, checked: t.value, onCheckedChange: (on) => t.onChange(on), ...(t.icon != null && { icon: t.icon }), ...part("vk-customize-toggle", t.key) }));
|
|
127
124
|
const sectionsOfToggles = (ts) => [...new Set(ts.flatMap((t) => (t.section ? [t.section] : [])))];
|
|
128
125
|
const checks = toggles
|
|
129
126
|
? [...toggleRows(toggles.filter((t) => !t.section)),
|
|
@@ -148,8 +145,8 @@ export function useCustomize(props) {
|
|
|
148
145
|
const inForceFields = filterFields.filter((f) => f.inForce).length;
|
|
149
146
|
const foldedFilter = folded ? { says: inForceFields ? String(inForceFields) : w.none, inForce: inForceFields > 0 } : undefined;
|
|
150
147
|
const sections = [
|
|
151
|
-
...(hasLayout ? [{ kind: "actions", icon: layout?.mark, label: w.layout, detail: layout?.name, entries: [], ...part("vk-customize-section", "layout") }] : []),
|
|
152
|
-
...(hasColumns ? [{ kind: "actions", icon: COLUMNS, label: w.columns, detail: columnsSay(view.columns, w), entries: [], ...part("vk-customize-section", "columns") }] : []),
|
|
148
|
+
...(hasLayout ? [{ kind: "actions", icon: layout?.mark, label: w.layout, detail: layout?.name, inForce: !!differs?.layout, entries: [], ...part("vk-customize-section", "layout") }] : []),
|
|
149
|
+
...(hasColumns ? [{ kind: "actions", icon: COLUMNS, label: w.columns, detail: columnsSay(view.columns, w), inForce: !!differs?.columns, entries: [], ...part("vk-customize-section", "columns") }] : []),
|
|
153
150
|
...(folded ? [] : fieldEntries(filterFields, true)),
|
|
154
151
|
...section(w.filter, _jsx(Icon, { name: "filter" }), filter ?? foldedFilter, "filter"), ...section(w.sort, _jsx(Icon, { name: "sort" }), sort, "sort"), ...section(w.group, GROUP, group, "group"),
|
|
155
152
|
...(folded ? [] : fieldEntries(afterFields)),
|
|
@@ -207,7 +204,7 @@ export function useCustomize(props) {
|
|
|
207
204
|
setChoosing(null);
|
|
208
205
|
setBack(true);
|
|
209
206
|
} }, [column, col]);
|
|
210
|
-
const allChoices = screen === "layout" ?
|
|
207
|
+
const allChoices = screen === "layout" ? layoutSettings?.choices ?? [] : col?.settings?.choices ?? [];
|
|
211
208
|
const choiceRows = new Map();
|
|
212
209
|
const choiceOpened = (e) => { const c = choiceRows.get(e); if (c) {
|
|
213
210
|
setBack(false);
|
|
@@ -235,10 +232,9 @@ export function useCustomize(props) {
|
|
|
235
232
|
const ownSettings = (settings, name, lead = [], own) => {
|
|
236
233
|
const bare = settings.toggles.filter((t) => !t.section), sectioned = sectionsOfToggles(settings.toggles);
|
|
237
234
|
const first = [...lead, ...settings.choices.map(choiceRow), ...toggleRows(bare)];
|
|
238
|
-
|
|
239
|
-
return _jsxs(_Fragment, { children: [first.length > 0 && _jsxs(_Fragment, { children: [!own && headingWords(name, own === undefined ? layout?.id ?? name : name), rowsList(own?.list ?? w.layoutSettings(name), first)] }), sectioned.map((s) => _jsxs(React.Fragment, { children: [headingWords(s, s), rowsList(s, toggleRows(settings.toggles.filter((t) => t.section === s)))] }, s)), you && yours.length > 0 && _jsxs(_Fragment, { children: [headingWords(you.label, "you"), rowsList(you.label, yours)] })] });
|
|
235
|
+
return _jsxs(_Fragment, { children: [first.length > 0 && _jsxs(_Fragment, { children: [!own && headingWords(name, own === undefined ? layout?.id ?? name : name), rowsList(own?.list ?? w.layoutSettings(name), first)] }), sectioned.map((s) => _jsxs(React.Fragment, { children: [headingWords(s, s), rowsList(s, toggleRows(settings.toggles.filter((t) => t.section === s)))] }, s))] });
|
|
240
236
|
};
|
|
241
|
-
const layoutScreen = (_jsxs(_Fragment, { children: [_jsx(RadioGroup, { tiles: true, "aria-label": w.layout, value: view.layout, onValueChange: (v) => { if (typeof v === "string")
|
|
237
|
+
const layoutScreen = (_jsxs(_Fragment, { children: [(!phone || layouts.length > 1) && _jsx(RadioGroup, { tiles: true, "aria-label": w.layout, value: view.layout, onValueChange: (v) => { if (typeof v === "string")
|
|
242
238
|
change({ ...latest.view, layout: v }); }, children: layouts.map((l) => _jsx(Radio, { value: l.id, mark: l.mark, label: l.name, disabled: l.later, "data-slot": "vk-customize-layout", "data-key": l.id }, l.id)) }), layoutSettings ? ownSettings(layoutSettings, layout?.name ?? w.layout) : layout?.id === "table" && _jsxs(_Fragment, { children: [headingWords(layout.name, layout.id), rowsList(w.layoutSettings(layout.name), [
|
|
243
239
|
{ kind: "check", label: w.freeze, checked: view.freeze, onCheckedChange: (c) => change({ ...latest.view, freeze: c }), ...part("vk-customize-toggle", "freeze") },
|
|
244
240
|
{ kind: "check", label: w.wrap, checked: view.wrap, onCheckedChange: (c) => change({ ...latest.view, wrap: c }), ...part("vk-customize-toggle", "wrap") },
|
|
@@ -280,7 +276,6 @@ export function useCustomize(props) {
|
|
|
280
276
|
const columnsSearch = phone ? columnsBox : _jsx("div", { className: "o-customize-search", children: columnsBox });
|
|
281
277
|
const shownActs = [
|
|
282
278
|
...(!searching && canHide ? [{ key: "hide-all", label: w.hideAll, onPress: () => press(latest.view.columns.filter((c) => c.shown && !c.locked).map((c) => c.id), false) }] : []),
|
|
283
|
-
...(!searching && columnsReset ? [{ key: "reset", label: w.columnsReset, onPress: columnsReset }] : []),
|
|
284
279
|
];
|
|
285
280
|
const columnsScreen = (_jsxs(_Fragment, { children: [phone && columnsSearch, shownHere && _jsxs(_Fragment, { children: [heading(w.shownHeading, "shown", shownActs), rowsOf(w.shownHeading, true)] }), hiddenHere && _jsxs(_Fragment, { children: [heading(w.hiddenHeading, "hidden", !searching && canShow ? [{ key: "show-all", label: w.showAll, onPress: () => press(latest.view.columns.filter((c) => !c.shown).map((c) => c.id), true) }] : undefined), rowsOf(w.hiddenHeading, false)] }), !found.length && _jsx("p", { className: "o-customize-none", "data-slot": "vk-customize-none", "data-key": "columns", children: w.noColumn(find.trim()) }), columnsFoot != null && _jsx("div", { className: "o-customize-foot-rows", "data-slot": "vk-customize-columns-foot", children: columnsFoot })] }));
|
|
286
281
|
const backFromColumn = () => { setBack(true); setFocusTo(col?.label ?? null); setColumn(null); setChoosing(null); };
|
|
@@ -313,17 +308,19 @@ export function useCustomize(props) {
|
|
|
313
308
|
const named = worn.head === "name" && view.name !== "";
|
|
314
309
|
const name = screen === "list" ? (named ? view.name : w.title) : level?.name ?? NAMES[screen];
|
|
315
310
|
const titled = !named;
|
|
311
|
+
const pageReset = screen !== "list" && !level ? (resets ? resets[screen] : screen === "columns" ? columnsReset : undefined) : undefined;
|
|
312
|
+
const pageWords = (size) => pageReset && (_jsx("div", { className: "o-customize-words", "data-slot": "vk-customize-changes", children: _jsx(Button, { kind: "link", size: size, "data-slot": "vk-customize-action", "data-key": "page-reset", onClick: pageReset, disabled: pending, children: w.reset }) }));
|
|
316
313
|
const step = choice ? (col ? `columns:${col.id}:${choice.key}` : `layout:${choice.key}`) : col ? `columns:${col.id}` : field ? `field:${field.key}` : screen;
|
|
317
314
|
if (phone) {
|
|
318
315
|
const body = (_jsx("div", { ref: placeRoot, className: "o-customize", "data-slot": "vk-customize", "data-kit": "customize", "data-customize-form": form, "data-customize-screen": screen, ...phoneMark(!!host || small), ...MENU_LIST_CARD_FRAME, children: _jsx(SheetStep, { step: step, back: back, children: _jsx("div", { className: "o-customize-step", children: content }) }) }));
|
|
319
|
-
const foot = screen === "list" && (changed || footer.length) ? (_jsxs("div", { className: "o-customize-foot", "data-slot": "vk-customize-foot", ...MENU_LIST_CARD_FRAME, children: [changed && words("44"), footer.length > 0 && _jsx(MenuList, { label: w.share, entries: footer, words: w.rows })] })) : undefined;
|
|
316
|
+
const foot = screen === "list" && (changed || footer.length) ? (_jsxs("div", { className: "o-customize-foot", "data-slot": "vk-customize-foot", ...MENU_LIST_CARD_FRAME, children: [changed && words("44"), footer.length > 0 && _jsx(MenuList, { label: w.share, entries: footer, words: w.rows })] })) : pageReset ? _jsx("div", { className: "o-customize-foot", "data-slot": "vk-customize-foot", ...MENU_LIST_CARD_FRAME, children: pageWords("44") }) : undefined;
|
|
320
317
|
return { body, title: name, head: screen === "list" ? { close: true } : { onBack: backTo, close: titled }, foot, level };
|
|
321
318
|
}
|
|
322
319
|
const title = (words) => (inPane ? _jsx(PaneTitle, { children: words }) : _jsx("h2", { className: "o-pane-title", children: words }));
|
|
323
320
|
const xButton = (extra) => _jsx(Button, { kind: "quiet", shape: "icon", size: "sm", "data-slot": "vk-customize-close", "aria-label": w.close, icon: _jsx(Icon, { name: "x" }), ...extra });
|
|
324
321
|
const close = inPane ? _jsx(PaneClose, { render: xButton() }) : onClose ? xButton({ onClick: onClose }) : null;
|
|
325
322
|
const head = screen !== "list" ? (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-screen", "data-slot": "vk-customize-head", children: [_jsx(Button, { ref: backButton, kind: "quiet", shape: "icon", size: "sm", "data-slot": "vk-customize-back", "aria-label": w.back, icon: _jsx(Icon, { name: "left" }), onClick: backTo }), _jsx("span", { className: "o-customize-title", "data-slot": "vk-customize-title", children: title(name) }), titled && close] })) : titled ? (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-title", "data-slot": "vk-customize-head", children: [_jsx("span", { className: "o-customize-title", "data-slot": "vk-customize-title", children: title(w.title) }), close] })) : (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-name", "data-slot": "vk-customize-head", children: [hasLayout && _jsx(Button, { kind: "outline", shape: "icon", size: "sm", "data-slot": "vk-customize-layout-button", "aria-label": w.layoutButton(layout?.name ?? ""), icon: layout?.mark, onClick: () => go("layout") }), _jsx(ViewName, { name: view.name, label: w.viewName, onRename: (n) => change({ ...latest.view, name: n }) })] }));
|
|
326
|
-
const parts = (_jsxs(_Fragment, { children: [head, screen === "columns" && !col && columnsSearch, _jsx(PaneBody, { children: _jsx("div", { ref: placeRoot, className: "o-customize", "data-slot": "vk-customize", "data-kit": "customize", "data-customize-form": form, "data-customize-screen": screen, ...phoneMark(!!host || small), ...MENU_LIST_CARD_FRAME, children: _jsx(React.Fragment, { children: content }, step) }) }), screen === "list" && changed && words("xs"), footer.length > 0 && _jsx(PaneFoot, { "data-slot": "vk-customize-foot", children: _jsx(MenuListPanelRows, { label: w.share, entries: footer, words: w.rows }) })] }));
|
|
323
|
+
const parts = (_jsxs(_Fragment, { children: [head, screen === "columns" && !col && columnsSearch, _jsx(PaneBody, { children: _jsx("div", { ref: placeRoot, className: "o-customize", "data-slot": "vk-customize", "data-kit": "customize", "data-customize-form": form, "data-customize-screen": screen, ...phoneMark(!!host || small), ...MENU_LIST_CARD_FRAME, children: _jsx(React.Fragment, { children: content }, step) }) }), screen === "list" && changed && words("xs"), pageWords("xs"), footer.length > 0 && _jsx(PaneFoot, { "data-slot": "vk-customize-foot", children: _jsx(MenuListPanelRows, { label: w.share, entries: footer, words: w.rows }) })] }));
|
|
327
324
|
return { body: inPane ? parts : _jsx("div", { className: "o-customize-frame", children: parts }), title: name, head: {}, level };
|
|
328
325
|
}
|
|
329
326
|
function ViewName({ name, label, onRename }) {
|