viewkitjs 0.26.0 → 0.28.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 +95 -0
- package/MIGRATION.md +122 -7
- package/package.json +1 -1
- package/views/dist/cells/cell-format.d.ts +3 -1
- package/views/dist/cells/cell-format.js +2 -2
- package/views/dist/cells/use-cell-format.d.ts +8 -1
- package/views/dist/cells/use-cell-format.js +13 -2
- package/views/dist/contract.d.ts +240 -3
- package/views/dist/contract.js +238 -0
- package/views/dist/controls/alert/alert.d.ts +46 -0
- package/views/dist/controls/alert/alert.js +11 -0
- package/views/dist/controls/alert/looks.d.ts +4 -0
- package/views/dist/controls/alert/looks.js +19 -0
- package/views/dist/controls/alert/tokens.d.ts +92 -0
- package/views/dist/controls/alert/tokens.js +25 -0
- package/views/dist/controls/alert-dialog/alert-dialog.d.ts +50 -0
- package/views/dist/controls/alert-dialog/alert-dialog.js +67 -0
- package/views/dist/controls/alert-dialog/confirm.d.ts +13 -0
- package/views/dist/controls/alert-dialog/confirm.js +11 -0
- package/views/dist/controls/alert-dialog/looks.d.ts +4 -0
- package/views/dist/controls/alert-dialog/looks.js +17 -0
- package/views/dist/controls/alert-dialog/tokens.d.ts +119 -0
- package/views/dist/controls/alert-dialog/tokens.js +32 -0
- package/views/dist/controls/alert-dialog.css +95 -0
- package/views/dist/controls/alert.css +51 -0
- package/views/dist/controls/collapsible/collapsible.d.ts +39 -0
- package/views/dist/controls/collapsible/collapsible.js +18 -0
- package/views/dist/controls/collapsible/looks.d.ts +4 -0
- package/views/dist/controls/collapsible/looks.js +5 -0
- package/views/dist/controls/collapsible/map-collapse.d.ts +2 -0
- package/views/dist/controls/collapsible/map-collapse.js +6 -0
- package/views/dist/controls/collapsible/tokens.d.ts +68 -0
- package/views/dist/controls/collapsible/tokens.js +19 -0
- package/views/dist/controls/collapsible.css +83 -0
- package/views/dist/controls/compound-editor/map-parts-body.js +2 -1
- package/views/dist/controls/compound-editor/name-parts.js +10 -2
- package/views/dist/controls/compound-editor/place-parts.js +5 -1
- package/views/dist/controls/compound-editor/place.d.ts +2 -1
- package/views/dist/controls/compound-editor/place.js +2 -0
- package/views/dist/controls/controls.d.ts +17 -0
- package/views/dist/controls/controls.js +17 -0
- package/views/dist/controls/date-editor/date-editor.d.ts +2 -1
- package/views/dist/controls/date-editor/map-calendar.js +3 -1
- package/views/dist/controls/filter-editor/filter-editor.d.ts +56 -0
- package/views/dist/controls/filter-editor/filter-editor.js +208 -0
- package/views/dist/controls/filter-editor/how.d.ts +23 -0
- package/views/dist/controls/filter-editor/how.js +13 -0
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +18 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +164 -0
- package/views/dist/controls/filter-editor/map-rules.d.ts +85 -0
- package/views/dist/controls/filter-editor/map-rules.js +273 -0
- package/views/dist/controls/filter-editor/parts.d.ts +46 -0
- package/views/dist/controls/filter-editor/parts.js +75 -0
- package/views/dist/controls/filter-editor/rules.d.ts +104 -0
- package/views/dist/controls/filter-editor/rules.js +148 -0
- package/views/dist/controls/filter-editor/tokens.d.ts +83 -0
- package/views/dist/controls/filter-editor/tokens.js +23 -0
- package/views/dist/controls/filter-editor/words.d.ts +59 -0
- package/views/dist/controls/filter-editor/words.js +40 -0
- package/views/dist/controls/filter-editor.css +124 -0
- package/views/dist/controls/group-editor/group-editor.d.ts +56 -0
- package/views/dist/controls/group-editor/group-editor.js +126 -0
- package/views/dist/controls/group-editor/map-group-body.d.ts +19 -0
- package/views/dist/controls/group-editor/map-group-body.js +106 -0
- package/views/dist/controls/group-editor/rules.d.ts +48 -0
- package/views/dist/controls/group-editor/rules.js +41 -0
- package/views/dist/controls/group-editor/tokens.d.ts +15 -0
- package/views/dist/controls/group-editor/tokens.js +6 -0
- package/views/dist/controls/group-editor/words.d.ts +39 -0
- package/views/dist/controls/group-editor/words.js +21 -0
- package/views/dist/controls/group-editor.css +20 -0
- package/views/dist/controls/index.d.ts +35 -1
- package/views/dist/controls/index.js +35 -1
- package/views/dist/controls/internal/editor-parts.d.ts +47 -0
- package/views/dist/controls/internal/editor-parts.js +48 -0
- package/views/dist/controls/internal/step-return.d.ts +9 -0
- package/views/dist/controls/internal/step-return.js +27 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +80 -0
- package/views/dist/controls/links-editor/links-editor.js +329 -0
- package/views/dist/controls/links-editor/links.d.ts +62 -0
- package/views/dist/controls/links-editor/links.js +50 -0
- package/views/dist/controls/links-editor/map-links-body.d.ts +10 -0
- package/views/dist/controls/links-editor/map-links-body.js +74 -0
- package/views/dist/controls/links-editor/tokens.d.ts +71 -0
- package/views/dist/controls/links-editor/tokens.js +20 -0
- package/views/dist/controls/links-editor/words.d.ts +56 -0
- package/views/dist/controls/links-editor/words.js +33 -0
- package/views/dist/controls/links-editor.css +132 -0
- package/views/dist/controls/menu-list/menu-list.d.ts +17 -2
- package/views/dist/controls/menu-list/menu-list.js +25 -16
- package/views/dist/controls/modal/looks.d.ts +4 -0
- package/views/dist/controls/modal/looks.js +25 -0
- package/views/dist/controls/modal/modal.d.ts +69 -0
- package/views/dist/controls/modal/modal.js +62 -0
- package/views/dist/controls/modal/tokens.d.ts +192 -0
- package/views/dist/controls/modal/tokens.js +50 -0
- package/views/dist/controls/modal.css +130 -0
- package/views/dist/controls/notice/notice.d.ts +49 -0
- package/views/dist/controls/notice/notice.js +35 -0
- package/views/dist/controls/notice/tokens.d.ts +99 -0
- package/views/dist/controls/notice/tokens.js +27 -0
- package/views/dist/controls/notice.css +100 -0
- package/views/dist/controls/number-editor/format.d.ts +31 -0
- package/views/dist/controls/number-editor/format.js +79 -0
- package/views/dist/controls/number-editor/looks.d.ts +14 -0
- package/views/dist/controls/number-editor/looks.js +17 -0
- package/views/dist/controls/number-editor/map-number-body.d.ts +16 -0
- package/views/dist/controls/number-editor/map-number-body.js +57 -0
- package/views/dist/controls/number-editor/number-editor.d.ts +72 -0
- package/views/dist/controls/number-editor/number-editor.js +202 -0
- package/views/dist/controls/number-editor/tokens.d.ts +28 -0
- package/views/dist/controls/number-editor/tokens.js +9 -0
- package/views/dist/controls/number-editor/words.d.ts +23 -0
- package/views/dist/controls/number-editor/words.js +13 -0
- package/views/dist/controls/number-editor.css +37 -0
- package/views/dist/controls/number-field/number-field.js +57 -5
- package/views/dist/controls/pane/looks.d.ts +4 -0
- package/views/dist/controls/pane/looks.js +11 -0
- package/views/dist/controls/pane/pane.d.ts +63 -0
- package/views/dist/controls/pane/pane.js +98 -0
- package/views/dist/controls/pane/state.d.ts +14 -0
- package/views/dist/controls/pane/state.js +7 -0
- package/views/dist/controls/pane/tokens.d.ts +79 -0
- package/views/dist/controls/pane/tokens.js +22 -0
- package/views/dist/controls/pane.css +104 -0
- package/views/dist/controls/picker/rows.d.ts +4 -2
- package/views/dist/controls/picker/rows.js +4 -3
- package/views/dist/controls/radio/radio.d.ts +33 -0
- package/views/dist/controls/radio/radio.js +19 -0
- package/views/dist/controls/radio/tokens.d.ts +127 -0
- package/views/dist/controls/radio/tokens.js +34 -0
- package/views/dist/controls/radio.css +104 -0
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +9 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +81 -0
- package/views/dist/controls/sort-editor/rules.d.ts +48 -0
- package/views/dist/controls/sort-editor/rules.js +24 -0
- package/views/dist/controls/sort-editor/sort-editor.d.ts +58 -0
- package/views/dist/controls/sort-editor/sort-editor.js +180 -0
- package/views/dist/controls/sort-editor/tokens.d.ts +79 -0
- package/views/dist/controls/sort-editor/tokens.js +22 -0
- package/views/dist/controls/sort-editor/words.d.ts +48 -0
- package/views/dist/controls/sort-editor/words.js +25 -0
- package/views/dist/controls/sort-editor.css +96 -0
- package/views/dist/controls/text-editor/phone-number.d.ts +4 -0
- package/views/dist/controls/text-editor/phone-number.js +20 -0
- package/views/dist/controls/text-editor/text-editor.js +2 -19
- package/views/dist/controls/toast/toast.d.ts +75 -0
- package/views/dist/controls/toast/toast.js +99 -0
- package/views/dist/controls/toast/tokens.d.ts +100 -0
- package/views/dist/controls/toast/tokens.js +27 -0
- package/views/dist/controls/toast.css +93 -0
- package/views/dist/controls/tokens.js +30 -0
- package/views/dist/controls/values-editor/looks.d.ts +16 -0
- package/views/dist/controls/values-editor/looks.js +19 -0
- package/views/dist/controls/values-editor/map-values-body.d.ts +12 -0
- package/views/dist/controls/values-editor/map-values-body.js +71 -0
- package/views/dist/controls/values-editor/tokens.d.ts +132 -0
- package/views/dist/controls/values-editor/tokens.js +35 -0
- package/views/dist/controls/values-editor/values-editor.d.ts +62 -0
- package/views/dist/controls/values-editor/values-editor.js +441 -0
- package/views/dist/controls/values-editor/values.d.ts +71 -0
- package/views/dist/controls/values-editor/values.js +59 -0
- package/views/dist/controls/values-editor/words.d.ts +50 -0
- package/views/dist/controls/values-editor/words.js +29 -0
- package/views/dist/controls/values-editor.css +207 -0
- package/views/dist/controls/views-list/looks.d.ts +13 -0
- package/views/dist/controls/views-list/looks.js +12 -0
- package/views/dist/controls/views-list/map-views-list-body.d.ts +19 -0
- package/views/dist/controls/views-list/map-views-list-body.js +65 -0
- package/views/dist/controls/views-list/rules.d.ts +72 -0
- package/views/dist/controls/views-list/rules.js +4 -0
- package/views/dist/controls/views-list/tokens.d.ts +11 -0
- package/views/dist/controls/views-list/tokens.js +5 -0
- package/views/dist/controls/views-list/views-list.d.ts +44 -0
- package/views/dist/controls/views-list/views-list.js +57 -0
- package/views/dist/controls/views-list/words.d.ts +22 -0
- package/views/dist/controls/views-list/words.js +3 -0
- package/views/dist/controls/views-list.css +8 -0
- package/views/dist/display/date.js +2 -2
- package/views/dist/display/format.js +10 -2
- package/views/dist/display/options.d.ts +3 -1
- package/views/dist/display/use-display-options.d.ts +3 -0
- package/views/dist/display/use-display-options.js +10 -2
- package/views/dist/display/viewer.d.ts +1 -1
- package/views/dist/display/viewer.js +1 -1
- package/views/dist/editors/DateEditor.js +11 -9
- package/views/dist/editors/NumberEditor.js +3 -1
- package/views/dist/editors/relation-panel.js +7 -1
- package/views/dist/editors/relation-picker.d.ts +2 -1
- package/views/dist/editors/relation-picker.js +4 -3
- package/views/dist/editors/relation-source.d.ts +4 -1
- package/views/dist/editors/relation-source.js +5 -2
- package/views/dist/field-row/editors/RowNumberEditor.js +2 -2
- package/views/dist/fields/number-edit.d.ts +6 -0
- package/views/dist/fields/number-edit.js +8 -1
- package/views/dist/grid/chrome/GridCellEditors.js +3 -3
- package/views/dist/grid/chrome/GridColumnDateSection.d.ts +4 -3
- package/views/dist/grid/chrome/GridColumnDateSection.js +4 -4
- package/views/dist/grid/chrome/GridColumnDurationSection.js +2 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +6 -4
- package/views/dist/grid/chrome/GridDateEditor.d.ts +3 -1
- package/views/dist/grid/chrome/GridDateEditor.js +2 -1
- package/views/dist/grid/chrome/GridFooter.js +2 -2
- package/views/dist/grid/chrome/grid-column-menu-items.js +4 -2
- package/views/dist/grid/chrome/useGridBandFigures.js +2 -2
- package/views/dist/grid/chrome/useGridFittedWidths.d.ts +3 -0
- package/views/dist/grid/chrome/useGridFittedWidths.js +9 -3
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +5 -2
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -1
- package/views/dist/grid/core/commit-model.d.ts +7 -0
- package/views/dist/grid/core/commit-model.js +5 -1
- package/views/dist/grid/core/editing-controller.js +10 -2
- package/views/dist/grid/core/editing-model.js +3 -7
- package/views/dist/grid/core/undo-owner.d.ts +6 -0
- package/views/dist/grid/core/undo-owner.js +13 -0
- package/views/dist/grid/core/useGridEditing.d.ts +2 -0
- package/views/dist/grid/core/useGridEditing.js +4 -0
- package/views/dist/looks/index.d.ts +8 -0
- package/views/dist/looks/index.js +8 -0
- package/views/dist/looks/pieces.js +16 -0
- package/views/dist/panels/model.d.ts +6 -1
- package/views/dist/panels/react/customize-body.d.ts +4 -2
- package/views/dist/panels/react/customize-body.js +3 -3
- package/views/dist/panels/react/customize.js +4 -2
- package/views/dist/panels/react/filter/FilterEditor.js +2 -2
- package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +8 -2
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +9 -6
- package/views/dist/panels/react/filter/filter-body.d.ts +8 -5
- package/views/dist/panels/react/filter/filter-body.js +17 -6
- package/views/dist/panels/react/filter/filter-part-body.d.ts +4 -1
- package/views/dist/panels/react/filter/filter-part-body.js +3 -1
- package/views/dist/panels/react/panel-sheet.d.ts +5 -1
- package/views/dist/panels/react/panel-sheet.js +6 -2
- package/views/dist/panels/react/panel-step.d.ts +12 -0
- package/views/dist/panels/react/panel-step.js +26 -0
- package/views/dist/panels/react/sort/SortEditor.d.ts +4 -0
- package/views/dist/panels/react/sort/SortEditor.js +5 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +8 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +84 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +16 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +49 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +3 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +36 -21
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +5 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +15 -6
- package/views/dist/panels/react/toolbar/panel-part.d.ts +5 -1
- package/views/dist/panels/react/toolbar/panel-part.js +2 -2
- package/views/dist/panels/react/toolbar/use-filter-add.d.ts +16 -0
- package/views/dist/panels/react/toolbar/use-filter-add.js +32 -0
- package/views/dist/panels/react.d.ts +1 -0
- package/views/dist/panels/react.js +1 -0
- package/views/dist/panels/settings/filter-groups.js +35 -1
- package/views/dist/panels/settings/group-buckets.js +1 -0
- package/views/dist/provider/ViewsProvider.d.ts +7 -1
- package/views/dist/provider/ViewsProvider.js +23 -3
- package/views/dist/provider/components.d.ts +34 -4
- package/views/dist/provider/moment.d.ts +6 -0
- package/views/dist/provider/moment.js +10 -0
- package/views/dist/styles.css +1276 -51
- package/views/dist/styles.unlayered.css +1277 -51
- package/views/docs/contract.md +23 -15
- package/views/docs/controls/alert-dialog.md +37 -0
- package/views/docs/controls/alert.md +30 -0
- package/views/docs/controls/collapsible.md +22 -0
- package/views/docs/controls/filter-editor.md +28 -0
- package/views/docs/controls/group-editor.md +11 -0
- package/views/docs/controls/links-editor.md +25 -0
- package/views/docs/controls/modal.md +55 -0
- package/views/docs/controls/notice.md +32 -0
- package/views/docs/controls/number-editor.md +12 -0
- package/views/docs/controls/pane.md +25 -0
- package/views/docs/controls/radio.md +39 -0
- package/views/docs/controls/sort-editor.md +27 -0
- package/views/docs/controls/toast.md +32 -0
- package/views/docs/controls/values-editor.md +40 -0
- package/views/docs/controls/views-list.md +8 -0
- package/views/docs/guides/cells.md +1 -1
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/the-grid.md +1 -1
- package/views/docs/guides/the-provider.md +19 -0
- package/views/docs/reference/cells.md +2 -2
- package/views/docs/reference/controls.md +326 -8
- package/views/docs/reference/display.md +2 -2
- package/views/docs/reference/editors-relation.md +1 -1
- package/views/docs/reference/looks.md +20 -3
- package/views/docs/reference/panels-react.md +7 -6
- package/views/docs/reference/panels.md +1 -1
- package/views/docs/reference/react.md +8 -8
- package/views/docs/reference/views.md +1 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ViewsMessageResolver } from "../../contract.js";
|
|
2
|
+
import type { ViewsLinksBodyProps, ViewsResolvedComponents } from "../../provider/components.js";
|
|
3
|
+
import { type LinksEditorProps } from "./links-editor.js";
|
|
4
|
+
import type { LinksEditorWords } from "./words.js";
|
|
5
|
+
/** The Links editor's words in the app's messages: the Picker's keys where the words are the same, the rest its own. */
|
|
6
|
+
export declare function linksEditorWordsOf(say: ViewsMessageResolver, makeLead?: string): LinksEditorWords;
|
|
7
|
+
/** ViewKit's links body's props as the Links editor's, its roles' column named `rolesWord`. */
|
|
8
|
+
export declare function linksEditorPropsOf(p: ViewsLinksBodyProps, words: LinksEditorWords, rolesWord: string, AppIcon?: ViewsResolvedComponents["AppIcon"]): LinksEditorProps;
|
|
9
|
+
/** ViewKit's links body, drawn as the Links editor. */
|
|
10
|
+
export declare function MapLinksBody(props: ViewsLinksBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { resolveViewsMessage } from "../../contract.js";
|
|
5
|
+
import { EDITOR_INNER_ESCAPE } from "../../editors/inner-escape.js";
|
|
6
|
+
import { ViewsContext } from "../../provider/context.js";
|
|
7
|
+
import { pickerItemsOf, pickerWordsOf } from "../picker/map-picker.js";
|
|
8
|
+
import { useToldStep } from "../internal/told-step.js";
|
|
9
|
+
import { useLinksEditor } from "./links-editor.js";
|
|
10
|
+
import { heldOf } from "./links.js";
|
|
11
|
+
const ROLES = "roles";
|
|
12
|
+
export function linksEditorWordsOf(say, makeLead) {
|
|
13
|
+
const searchRoles = say({ key: "views.editors.links-search-roles" }), add = say({ key: "views.editors.links-add" });
|
|
14
|
+
return {
|
|
15
|
+
add,
|
|
16
|
+
addKind: () => add,
|
|
17
|
+
addTo: (label) => say({ key: "views.editors.links-add-to", values: { label } }),
|
|
18
|
+
linkName: (label) => say({ key: "views.editors.links-link", values: { label } }),
|
|
19
|
+
unlink: say({ key: "views.editors.links-unlink" }),
|
|
20
|
+
unlinkName: (label) => say({ key: "views.editors.links-unlink-record", values: { label } }),
|
|
21
|
+
setLead: (lead) => makeLead ?? lead,
|
|
22
|
+
isLead: (label, lead) => say({ key: "views.editors.links-is-lead", values: { label, lead } }),
|
|
23
|
+
actionsFor: (label) => say({ key: "views.picker.row-actions", values: { label } }),
|
|
24
|
+
linkMenu: (label) => say({ key: "views.editors.links-menu", values: { label } }),
|
|
25
|
+
editLink: (label) => say({ key: "views.editors.links-edit", values: { label } }),
|
|
26
|
+
backTo: (label) => say({ key: "views.picker.back", values: { label } }),
|
|
27
|
+
fieldAt: (field, label) => say({ key: "views.editors.links-field-at", values: { field, label } }),
|
|
28
|
+
searchField: () => searchRoles,
|
|
29
|
+
search: say({ key: "views.editors.links-search" }),
|
|
30
|
+
none: say({ key: "views.editors.links-none" }),
|
|
31
|
+
noDetails: say({ key: "views.editors.links-no-details" }),
|
|
32
|
+
yes: say({ key: "views.editors.links-yes" }),
|
|
33
|
+
no: say({ key: "views.editors.links-no" }),
|
|
34
|
+
everythingLinked: say({ key: "views.editors.links-all-linked" }),
|
|
35
|
+
nothingMatches: say({ key: "views.picker.nothing-matches" }),
|
|
36
|
+
nothingMatchesTyped: (typed) => say({ key: "views.picker.none-typed", values: { typed } }),
|
|
37
|
+
close: say({ key: "views.panels.close" }),
|
|
38
|
+
done: say({ key: "views.editors.links-done" }),
|
|
39
|
+
save: say({ key: "views.picker.save" }),
|
|
40
|
+
searching: say({ key: "views.picker.searching" }),
|
|
41
|
+
failed: say({ key: "views.picker.failed" }),
|
|
42
|
+
retry: say({ key: "views.picker.retry" }),
|
|
43
|
+
loadingMore: say({ key: "views.picker.loading-more" }),
|
|
44
|
+
picker: pickerWordsOf(say),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function linksEditorPropsOf(p, words, rolesWord, AppIcon) {
|
|
48
|
+
const roles = { id: ROLES, label: rolesWord, kind: "several",
|
|
49
|
+
choices: p.roles.map((r) => ({ value: r.value, label: r.label, ...(r.archived ? { archived: true } : {}) })) };
|
|
50
|
+
const lead = p.lead;
|
|
51
|
+
return {
|
|
52
|
+
label: p.label, kind: p.label, records: pickerItemsOf(p.items, AppIcon ? { AppIcon } : {}), fields: p.roles.length ? [roles] : [],
|
|
53
|
+
links: p.links.map((l) => ({ value: l.value, values: { [ROLES]: [...l.roles] } })),
|
|
54
|
+
onLinksChange: (next) => p.onLinksChange(next.map((l) => ({ value: l.value, roles: heldOf(l.values[ROLES]) }))),
|
|
55
|
+
onDone: p.onDone, form: p.form, words, popupData: { [EDITOR_INNER_ESCAPE]: "" },
|
|
56
|
+
...(p.autoFocus !== undefined ? { autoFocus: p.autoFocus } : {}),
|
|
57
|
+
...(lead ? { lead: { value: lead.value, label: lead.label, onLead: (v) => { if (v != null)
|
|
58
|
+
lead.onLead(v); } } } : {}),
|
|
59
|
+
...(p.search ? { search: p.search } : {}), ...(p.typed != null ? { typed: p.typed } : {}),
|
|
60
|
+
...(p.onSearch ? { onSearch: p.onSearch } : {}), ...(p.doing ? { doing: p.doing } : {}),
|
|
61
|
+
...(p.onRetry ? { onRetry: p.onRetry } : {}), ...(p.onMore ? { onMore: p.onMore } : {}),
|
|
62
|
+
...(p.actions ? { actions: p.actions.map((a) => ({ key: a.key, label: a.label, ...(a.icon != null ? { icon: a.icon } : {}), onSelect: a.onSelect })) } : {}),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export function MapLinksBody(props) {
|
|
66
|
+
const views = React.useContext(ViewsContext);
|
|
67
|
+
const messages = views?.messages ?? resolveViewsMessage;
|
|
68
|
+
const makeLead = props.lead?.makeLabel;
|
|
69
|
+
const words = React.useMemo(() => linksEditorWordsOf(messages, makeLead), [messages, makeLead]);
|
|
70
|
+
const rolesWord = messages({ key: "views.editors.links-roles" });
|
|
71
|
+
const parts = useLinksEditor(linksEditorPropsOf(props, words, rolesWord, views?.components.AppIcon));
|
|
72
|
+
useToldStep(parts, props.onStepChange);
|
|
73
|
+
return _jsx(_Fragment, { children: parts.body });
|
|
74
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export declare const LINKS_EDITOR_TOKENS: readonly [{
|
|
2
|
+
readonly name: "--vk-danger";
|
|
3
|
+
readonly kind: "colour";
|
|
4
|
+
readonly outright: "--text-danger";
|
|
5
|
+
}, {
|
|
6
|
+
readonly name: "--vk-duration-fast";
|
|
7
|
+
readonly kind: "motion";
|
|
8
|
+
readonly outright: "--duration-fast";
|
|
9
|
+
}, {
|
|
10
|
+
readonly name: "--vk-ease-out";
|
|
11
|
+
readonly kind: "motion";
|
|
12
|
+
readonly outright: "--ease-out";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "--vk-fg";
|
|
15
|
+
readonly kind: "colour";
|
|
16
|
+
readonly outright: "--text";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "--vk-fg-subtle";
|
|
19
|
+
readonly kind: "colour";
|
|
20
|
+
readonly outright: "--text-subtle";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "--vk-fg-subtlest";
|
|
23
|
+
readonly kind: "colour";
|
|
24
|
+
readonly outright: "--text-subtlest";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "--vk-font-size-base";
|
|
27
|
+
readonly kind: "size";
|
|
28
|
+
readonly outright: "--text-base";
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "--vk-font-size-sm";
|
|
31
|
+
readonly kind: "size";
|
|
32
|
+
readonly outright: "--text-sm";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "--vk-font-size-xs";
|
|
35
|
+
readonly kind: "size";
|
|
36
|
+
readonly outright: "--text-xs";
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "--vk-font-weight-medium";
|
|
39
|
+
readonly kind: "size";
|
|
40
|
+
readonly outright: "--font-weight-medium";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "--vk-font-weight-normal";
|
|
43
|
+
readonly kind: "size";
|
|
44
|
+
readonly outright: "--font-weight-normal";
|
|
45
|
+
}, {
|
|
46
|
+
readonly name: "--vk-layer-popup";
|
|
47
|
+
readonly kind: "size";
|
|
48
|
+
readonly outright: "--layer-popup";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "--vk-line-height-base";
|
|
51
|
+
readonly kind: "size";
|
|
52
|
+
readonly outright: "--text-base--line-height";
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "--vk-line-height-sm";
|
|
55
|
+
readonly kind: "size";
|
|
56
|
+
readonly outright: "--text-sm--line-height";
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "--vk-line-height-xs";
|
|
59
|
+
readonly kind: "size";
|
|
60
|
+
readonly outright: "--text-xs--line-height";
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "--vk-overlay";
|
|
63
|
+
readonly kind: "colour";
|
|
64
|
+
readonly outright: "--surface-overlay";
|
|
65
|
+
}, {
|
|
66
|
+
readonly name: "--vk-spacing";
|
|
67
|
+
readonly kind: "size";
|
|
68
|
+
readonly outright: "--spacing";
|
|
69
|
+
}];
|
|
70
|
+
/** The prefixes of the Links editor's own machinery, set and read by it alone: not public. */
|
|
71
|
+
export declare const LINKS_EDITOR_PRIVATE: readonly ["--links-"];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const LINKS_EDITOR_TOKENS = [
|
|
2
|
+
{ name: "--vk-danger", kind: "colour", outright: "--text-danger" },
|
|
3
|
+
{ name: "--vk-duration-fast", kind: "motion", outright: "--duration-fast" },
|
|
4
|
+
{ name: "--vk-ease-out", kind: "motion", outright: "--ease-out" },
|
|
5
|
+
{ name: "--vk-fg", kind: "colour", outright: "--text" },
|
|
6
|
+
{ name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
|
|
7
|
+
{ name: "--vk-fg-subtlest", kind: "colour", outright: "--text-subtlest" },
|
|
8
|
+
{ name: "--vk-font-size-base", kind: "size", outright: "--text-base" },
|
|
9
|
+
{ name: "--vk-font-size-sm", kind: "size", outright: "--text-sm" },
|
|
10
|
+
{ name: "--vk-font-size-xs", kind: "size", outright: "--text-xs" },
|
|
11
|
+
{ name: "--vk-font-weight-medium", kind: "size", outright: "--font-weight-medium" },
|
|
12
|
+
{ name: "--vk-font-weight-normal", kind: "size", outright: "--font-weight-normal" },
|
|
13
|
+
{ name: "--vk-layer-popup", kind: "size", outright: "--layer-popup" },
|
|
14
|
+
{ name: "--vk-line-height-base", kind: "size", outright: "--text-base--line-height" },
|
|
15
|
+
{ name: "--vk-line-height-sm", kind: "size", outright: "--text-sm--line-height" },
|
|
16
|
+
{ name: "--vk-line-height-xs", kind: "size", outright: "--text-xs--line-height" },
|
|
17
|
+
{ name: "--vk-overlay", kind: "colour", outright: "--surface-overlay" },
|
|
18
|
+
{ name: "--vk-spacing", kind: "size", outright: "--spacing" },
|
|
19
|
+
];
|
|
20
|
+
export const LINKS_EDITOR_PRIVATE = ["--links-"];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { PickerWords } from "../picker/picker.js";
|
|
2
|
+
export interface LinksEditorWords {
|
|
3
|
+
/** The heading over the records to add, once linked records stand over them. */
|
|
4
|
+
add: string;
|
|
5
|
+
/** The phone's heading over the records to add, by the records' kind ("Add a company"). */
|
|
6
|
+
addKind: (kind: string) => string;
|
|
7
|
+
/** The records to add's name to a screen reader, by the field's. */
|
|
8
|
+
addTo: (label: string) => string;
|
|
9
|
+
/** A record to add's name to a screen reader, on a phone. */
|
|
10
|
+
linkName: (name: string) => string;
|
|
11
|
+
/** A link's Unlink, in its menu and on a phone's link's fields. */
|
|
12
|
+
unlink: string;
|
|
13
|
+
/** A row's ✕. */
|
|
14
|
+
unlinkName: (name: string) => string;
|
|
15
|
+
/** A link's menu row making it the lead, by the lead's word. */
|
|
16
|
+
setLead: (lead: string) => string;
|
|
17
|
+
/** A row's radio, and the phone's lead switch. */
|
|
18
|
+
isLead: (name: string, lead: string) => string;
|
|
19
|
+
/** A link's ⋯ on a phone. */
|
|
20
|
+
actionsFor: (name: string) => string;
|
|
21
|
+
/** The menu that ⋯ opens, by its record. */
|
|
22
|
+
linkMenu: (name: string) => string;
|
|
23
|
+
/** A link's settings button, with several fields. */
|
|
24
|
+
editLink: (name: string) => string;
|
|
25
|
+
/** A link's fields' ‹, back to the list. */
|
|
26
|
+
backTo: (label: string) => string;
|
|
27
|
+
/** A field's control on one link. */
|
|
28
|
+
fieldAt: (field: string, name: string) => string;
|
|
29
|
+
/** A field's list's search. */
|
|
30
|
+
searchField: (field: string) => string;
|
|
31
|
+
/** The search, before anything is typed, unless handed its own. */
|
|
32
|
+
search: string;
|
|
33
|
+
/** A list field holding nothing. */
|
|
34
|
+
none: string;
|
|
35
|
+
/** A link holding nothing, on a phone with several fields. */
|
|
36
|
+
noDetails: string;
|
|
37
|
+
yes: string;
|
|
38
|
+
no: string;
|
|
39
|
+
everythingLinked: string;
|
|
40
|
+
nothingMatches: string;
|
|
41
|
+
nothingMatchesTyped: (typed: string) => string;
|
|
42
|
+
/** The phone's link's fields' ✕ and ✓, and the Sheet head's ✕ and ✓ round the editor. */
|
|
43
|
+
close: string;
|
|
44
|
+
done: string;
|
|
45
|
+
save: string;
|
|
46
|
+
/** A list the editor finds: in flight, failed, its ask again, and more rows coming. */
|
|
47
|
+
searching: string;
|
|
48
|
+
failed: string;
|
|
49
|
+
retry: string;
|
|
50
|
+
loadingMore: string;
|
|
51
|
+
/** The roles list's own words (the Picker's). */
|
|
52
|
+
picker?: Partial<PickerWords>;
|
|
53
|
+
}
|
|
54
|
+
export declare const LINKS_EDITOR_WORDS: LinksEditorWords;
|
|
55
|
+
/** The words handed over the English. */
|
|
56
|
+
export declare const linksWords: (given?: Partial<LinksEditorWords>) => LinksEditorWords;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const a = (word) => (/^[aeiou]/i.test(word) ? "an" : "a");
|
|
2
|
+
export const LINKS_EDITOR_WORDS = {
|
|
3
|
+
add: "Add",
|
|
4
|
+
addKind: (kind) => `Add ${a(kind)} ${kind.toLowerCase()}`,
|
|
5
|
+
addTo: (label) => `Add to ${label}`,
|
|
6
|
+
linkName: (name) => `Link ${name}`,
|
|
7
|
+
unlink: "Unlink",
|
|
8
|
+
unlinkName: (name) => `Unlink ${name}`,
|
|
9
|
+
setLead: (lead) => `Set as ${lead.toLowerCase()}`,
|
|
10
|
+
isLead: (name, lead) => `${name} is the ${lead.toLowerCase()}`,
|
|
11
|
+
actionsFor: (name) => `Actions for ${name}`,
|
|
12
|
+
linkMenu: (name) => `the link to ${name}`,
|
|
13
|
+
editLink: (name) => `Edit the link to ${name}`,
|
|
14
|
+
backTo: (label) => `Back to ${label}`,
|
|
15
|
+
fieldAt: (field, name) => `${field} at ${name}`,
|
|
16
|
+
searchField: (field) => `Search ${field.toLowerCase()}…`,
|
|
17
|
+
search: "Search…",
|
|
18
|
+
none: "None",
|
|
19
|
+
noDetails: "No details",
|
|
20
|
+
yes: "Yes",
|
|
21
|
+
no: "No",
|
|
22
|
+
everythingLinked: "Everything is linked.",
|
|
23
|
+
nothingMatches: "Nothing matches.",
|
|
24
|
+
nothingMatchesTyped: (typed) => `Nothing matches “${typed}”.`,
|
|
25
|
+
close: "Close",
|
|
26
|
+
done: "Done",
|
|
27
|
+
save: "Save",
|
|
28
|
+
searching: "Searching…",
|
|
29
|
+
failed: "Couldn't search.",
|
|
30
|
+
retry: "Try again",
|
|
31
|
+
loadingMore: "Loading more…",
|
|
32
|
+
};
|
|
33
|
+
export const linksWords = (given) => (given ? { ...LINKS_EDITOR_WORDS, ...given } : LINKS_EDITOR_WORDS);
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* The Links editor: what a record's links are edited in, in its Table form. Every value is a public name
|
|
2
|
+
(links-editor/tokens.ts). On a computer, what the Popover holds, as wide as the Popover is handed (480 with
|
|
3
|
+
one field on a link, 600 with several): the search across its top (popup-line.css), then one list scrolling as one, 10½ rows
|
|
4
|
+
of 32 at most: the columns' names in the smallest subtle words, standing while it scrolls; a row per linked record, 32 high (its
|
|
5
|
+
face 20 and its name, cut with "…", taking what is left and never under 152; a column per field, 12 apart: several 192, one 40,
|
|
6
|
+
yes or no 40; Lead 32; the last 24); a line, "Add" and the records to add on the list's rows (list.css). One field's short
|
|
7
|
+
button stands as wide as its words, its words where the column's name starts. A link's fields open as a step: a line on top
|
|
8
|
+
with ‹, the face and the name, a row per field (its name 64 wide, then its control), Unlink under them.
|
|
9
|
+
|
|
10
|
+
The rules sit in the components layer, so a utility class still wins. */
|
|
11
|
+
@layer components {
|
|
12
|
+
|
|
13
|
+
.o-links-editor { position: relative; display: flex; flex-direction: column; min-width: 0; color: var(--vk-fg); font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); }
|
|
14
|
+
.o-links-editor:focus { outline: none; }
|
|
15
|
+
|
|
16
|
+
/* ── The search: the shared line across the popup's top, 6 above and below, 4 over the list ─ */
|
|
17
|
+
.o-links-editor-search { --popup-line-pad-block: calc(var(--vk-spacing) * 1.5); --popup-line-under: var(--vk-spacing); }
|
|
18
|
+
.o-links-editor-search > svg { flex: none; width: calc(var(--vk-spacing) * 3.75); height: calc(var(--vk-spacing) * 3.75); }
|
|
19
|
+
.o-input-control.o-links-editor-input { flex: 1; min-width: calc(var(--vk-spacing) * 16); font-size: var(--vk-font-size-sm); }
|
|
20
|
+
|
|
21
|
+
/* ── The one list: 10½ rows at most, scrolling as one ─ */
|
|
22
|
+
/* It scrolls with no bar at all (Mihai, 18 Nov 2026): the browser's own, which macOS draws taking room with a mouse plugged in, hidden. */
|
|
23
|
+
.o-links-editor-list { display: flex; flex-direction: column; min-height: 0; max-height: calc(10.5 * var(--vk-spacing) * 8); overflow-y: auto; overscroll-behavior: contain; outline: none; scrollbar-width: none; }
|
|
24
|
+
.o-links-editor-list::-webkit-scrollbar { display: none; }
|
|
25
|
+
/* A field's list, the Picker in its own Popover: its rows scroll with no bar too, as the editor's list does. */
|
|
26
|
+
.o-links-editor-pop .o-picker-rows, .o-links-editor-shown .o-picker-rows { scrollbar-width: none; }
|
|
27
|
+
.o-links-editor-pop .o-picker-rows::-webkit-scrollbar, .o-links-editor-shown .o-picker-rows::-webkit-scrollbar { display: none; }
|
|
28
|
+
.o-links-editor-list > *, .o-links-editor-adds > * { flex: none; }
|
|
29
|
+
.o-links-editor-list[data-head] { scroll-padding-top: calc(var(--vk-spacing) * 7); }
|
|
30
|
+
.o-links-editor-adds { display: flex; flex-direction: column; }
|
|
31
|
+
|
|
32
|
+
/* The columns' names and a linked record's row: the same columns, 12 apart. */
|
|
33
|
+
.o-links-editor-head, .o-links-editor-row { display: flex; align-items: center; gap: calc(var(--vk-spacing) * 3); box-sizing: border-box; min-width: 0; padding: 0 calc(var(--vk-spacing) * 1) 0 calc(var(--vk-spacing) * 2); }
|
|
34
|
+
.o-links-editor-head {
|
|
35
|
+
position: sticky; top: 0; z-index: 1; min-height: calc(var(--vk-spacing) * 7);
|
|
36
|
+
background-color: var(--vk-overlay); color: var(--vk-fg-subtlest); font-size: var(--vk-font-size-xs); line-height: calc(var(--vk-font-size-xs) * var(--vk-line-height-xs));
|
|
37
|
+
}
|
|
38
|
+
.o-links-editor-row { min-height: calc(var(--vk-spacing) * 8); }
|
|
39
|
+
.o-radio-group.o-links-editor-rows, .o-links-editor-rows { display: flex; flex-direction: column; gap: 0; }
|
|
40
|
+
.o-links-editor-who { flex: 1 1 0; display: flex; align-items: center; gap: calc(var(--vk-spacing) * 2); min-width: calc(var(--vk-spacing) * 38); }
|
|
41
|
+
.o-links-editor-who > .o-avatar { flex: none; }
|
|
42
|
+
.o-links-editor-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
43
|
+
.o-links-editor-cell { flex: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
44
|
+
.o-links-editor-row > .o-links-editor-cell { color: var(--vk-fg-subtle); }
|
|
45
|
+
.o-links-editor-cell[data-kind="several"] { width: calc(var(--vk-spacing) * 48); }
|
|
46
|
+
.o-links-editor-cell:is([data-kind="one"], [data-kind="yes-no"]) { width: calc(var(--vk-spacing) * 10); }
|
|
47
|
+
/* With one field its column holds its short button, 192 whatever its kind. */
|
|
48
|
+
.o-links-editor[data-links-fields="one"] .o-links-editor-cell { width: calc(var(--vk-spacing) * 48); }
|
|
49
|
+
.o-links-editor-lead { flex: none; display: flex; justify-content: center; width: calc(var(--vk-spacing) * 8); }
|
|
50
|
+
.o-links-editor-head > .o-links-editor-lead { display: block; text-align: center; }
|
|
51
|
+
.o-links-editor-lead .o-radio-ring { margin-top: 0; }
|
|
52
|
+
.o-links-editor-end { flex: none; display: flex; justify-content: center; width: calc(var(--vk-spacing) * 6); }
|
|
53
|
+
|
|
54
|
+
/* One field: a short quiet button, as wide as its words and its chevron, its words where the column's name starts; none, the
|
|
55
|
+
field's name in the faintest words; its chevron turns while its list is open. */
|
|
56
|
+
.o-links-editor-cell:has(> .o-links-editor-short) { overflow: visible; }
|
|
57
|
+
.o-links-editor-short.o-button { max-width: calc(100% + var(--vk-spacing) * 2); margin-left: calc(var(--vk-spacing) * -2); font-weight: var(--vk-font-weight-normal); color: var(--vk-fg-subtle); }
|
|
58
|
+
.o-links-editor-short > [data-slot="vk-button-label"] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
59
|
+
.o-links-editor-short[data-none] { color: var(--vk-fg-subtlest); }
|
|
60
|
+
.o-links-editor-short > [data-slot="vk-button-icon"] { color: var(--vk-fg-subtlest); transition: rotate var(--vk-duration-fast) var(--vk-ease-out); }
|
|
61
|
+
.o-links-editor-short:is([data-popup-open], [aria-expanded="true"]) > [data-slot="vk-button-icon"] { rotate: 180deg; }
|
|
62
|
+
|
|
63
|
+
/* The records to add: the list's rows, the face before the name. */
|
|
64
|
+
.o-links-editor-add > .o-avatar { flex: none; }
|
|
65
|
+
.o-links-editor-add { cursor: pointer; }
|
|
66
|
+
/* Everything linked, or nothing found: what it says, quiet, in the list's middle. */
|
|
67
|
+
.o-links-editor-message { padding: calc(var(--vk-spacing) * 3) calc(var(--vk-spacing) * 2); color: var(--vk-fg-subtle); text-align: center; }
|
|
68
|
+
|
|
69
|
+
/* A list a page shows standing open: under its button, over the rows, as the Popover would stand it, as wide as its rows. */
|
|
70
|
+
.o-links-editor .o-links-editor-shown { position: absolute; z-index: var(--vk-layer-popup); width: max-content; min-width: calc(var(--vk-spacing) * 48); max-width: calc(var(--vk-spacing) * 72); }
|
|
71
|
+
|
|
72
|
+
/* ── A link's fields, a step inside the popup ─ */
|
|
73
|
+
.o-links-editor-step-head { --popup-line-under: var(--vk-spacing); --popup-line-pad: calc(var(--vk-spacing) * 2); }
|
|
74
|
+
.o-links-editor-step-head > .o-avatar { flex: none; }
|
|
75
|
+
.o-links-editor-step-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--vk-font-weight-medium); }
|
|
76
|
+
.o-links-editor-fields { display: grid; gap: calc(var(--vk-spacing) * 2); padding: calc(var(--vk-spacing) * 2) calc(var(--vk-spacing) * 2) 0; }
|
|
77
|
+
.o-links-editor-field { display: flex; align-items: center; gap: calc(var(--vk-spacing) * 3); min-width: 0; min-height: calc(var(--vk-spacing) * 8); }
|
|
78
|
+
.o-links-editor-field-label { flex: none; width: calc(var(--vk-spacing) * 16); color: var(--vk-fg-subtle); }
|
|
79
|
+
.o-links-editor-field-control { flex: 1; display: flex; min-width: 0; }
|
|
80
|
+
.o-links-editor-field-control[data-kind="one"] { flex: none; width: calc(var(--vk-spacing) * 28); }
|
|
81
|
+
.o-links-editor-field-control > .o-select { width: 100%; }
|
|
82
|
+
.o-links-editor-step-foot { display: flex; padding: calc(var(--vk-spacing) * 2) 0 0; }
|
|
83
|
+
|
|
84
|
+
/* ── On a phone: what the Sheet holds, filling its body: a card per linked record, 12 apart (its head 56, its face 24 and its name,
|
|
85
|
+
"Lead" on the leading one, ⋯ or the settings button; then its field's row, or what it holds in quiet words); then "Add a
|
|
86
|
+
company" and the records to add, each its face 40, its name and +; then the search at the foot, over a fade to the ground. Every
|
|
87
|
+
target 44 at least. ─ */
|
|
88
|
+
.o-links-editor[data-links-form="phone"] { min-height: var(--links-room, auto); font-size: var(--vk-font-size-base); line-height: calc(var(--vk-font-size-base) * var(--vk-line-height-base)); }
|
|
89
|
+
.o-links-editor-cards { display: grid; gap: calc(var(--vk-spacing) * 3); }
|
|
90
|
+
.o-links-editor-card-head { padding-right: calc(var(--vk-spacing) * 1); }
|
|
91
|
+
.o-links-editor-card-head > .o-avatar { flex: none; }
|
|
92
|
+
.o-links-editor-card-name { flex: 1; display: flex; align-items: baseline; gap: calc(var(--vk-spacing) * 2); min-width: 0; font-weight: var(--vk-font-weight-medium); }
|
|
93
|
+
.o-links-editor-card-name > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
94
|
+
.o-links-editor-lead-word { flex: none; color: var(--vk-fg-subtle); 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-normal); }
|
|
95
|
+
.o-links-editor-more, .o-links-editor[data-links-form="phone"] .o-links-editor-config { flex: none; }
|
|
96
|
+
.o-links-editor-card-line {
|
|
97
|
+
margin-top: calc(var(--vk-spacing) * -2); padding: 0 calc(var(--vk-spacing) * 4) calc(var(--vk-spacing) * 3.5) calc(var(--vk-spacing) * 13);
|
|
98
|
+
color: var(--vk-fg-subtle); font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm));
|
|
99
|
+
}
|
|
100
|
+
.o-links-editor-card-line[data-none] { color: var(--vk-fg-subtlest); }
|
|
101
|
+
/* A field's row: its name, its words at its end, cut with "…", and ›. */
|
|
102
|
+
.o-links-editor-open-name { flex: none; }
|
|
103
|
+
.o-links-editor-open-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; color: var(--vk-fg-subtle); }
|
|
104
|
+
.o-links-editor-open-mark { flex: none; width: calc(var(--vk-spacing) * 4.5); height: calc(var(--vk-spacing) * 4.5); margin-right: calc(var(--vk-spacing) * -1); color: var(--vk-fg-subtlest); }
|
|
105
|
+
.o-links-editor-label { margin: calc(var(--vk-spacing) * 6) var(--vk-spacing) calc(var(--vk-spacing) * 2); font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); color: var(--vk-fg-subtle); }
|
|
106
|
+
.o-links-editor-add-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
107
|
+
.o-links-editor-add-mark { flex: none; width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); color: var(--vk-fg-subtlest); }
|
|
108
|
+
.o-links-editor-note { padding: calc(var(--vk-spacing) * 9) calc(var(--vk-spacing) * 4); text-align: center; color: var(--vk-fg-subtle); }
|
|
109
|
+
|
|
110
|
+
/* ── A list its editor finds: more records coming as its end comes into sight, the ask again after a failed search, and the create
|
|
111
|
+
rows after the records to add (a mark before the words where one is handed) ─ */
|
|
112
|
+
.o-links-editor-loading { display: flex; align-items: center; justify-content: center; gap: calc(var(--vk-spacing) * 2); min-height: calc(var(--vk-spacing) * 8); font-size: var(--vk-font-size-xs); color: var(--vk-fg-subtle); }
|
|
113
|
+
.o-links-editor[data-links-form="phone"] .o-links-editor-loading { min-height: calc(var(--vk-spacing) * 12); font-size: var(--vk-font-size-sm); }
|
|
114
|
+
.o-links-editor-retry { margin-inline-start: calc(var(--vk-spacing) * 2); }
|
|
115
|
+
.o-links-editor-action-mark { flex: none; display: grid; place-items: center; width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); color: var(--vk-fg-subtle); }
|
|
116
|
+
.o-links-editor-action-mark > svg { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); }
|
|
117
|
+
.o-links-editor-bar {
|
|
118
|
+
position: sticky; bottom: calc(-1 * var(--links-under, 0px)); z-index: 1; display: flex; align-items: center;
|
|
119
|
+
margin-top: auto; margin-bottom: calc(-1 * var(--links-under, 0px)); padding: calc(var(--vk-spacing) * 8) 0 calc(var(--vk-spacing) * 2 + var(--links-under, 0px));
|
|
120
|
+
background-image: linear-gradient(to bottom, transparent, var(--vk-overlay) calc(var(--vk-spacing) * 8));
|
|
121
|
+
}
|
|
122
|
+
.o-links-editor-pill { flex: 1; }
|
|
123
|
+
/* A link's fields, a step of the phone's Sheet: a field's words at its row's end; a switch at its end; Unlink its own card, in red. */
|
|
124
|
+
.o-links-editor-fields .o-links-editor-open-value { flex: 1; }
|
|
125
|
+
.o-links-editor-switch { flex: none; margin-left: auto; }
|
|
126
|
+
.o-links-editor-fields-foot { margin-top: calc(var(--vk-spacing) * 6); }
|
|
127
|
+
.o-links-editor-unlink.o-field-row { color: var(--vk-danger); }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* ── On the phone the search's words are 16px, so iOS never zooms in (KIT-369) ── */
|
|
131
|
+
/* On a phone (`data-vk-phone`, the body's own mark from the device): the search's words at the base size, so iOS never zooms. */
|
|
132
|
+
.o-input-control.o-links-editor-input:where([data-vk-phone], [data-vk-phone] *) { font-size: var(--vk-font-size-base); }
|
|
@@ -100,6 +100,17 @@ export declare const menuListCloseOf: (el: Element | null) => boolean;
|
|
|
100
100
|
export declare function useMenuListOption(frame: HTMLElement | null, id: MenuListLookOptionId): string;
|
|
101
101
|
/** What its rows stand on, as worn around `frame`, kept up to date as an app changes it. */
|
|
102
102
|
export declare const useMenuListRows: (frame: HTMLElement | null) => string;
|
|
103
|
+
/** The words its rows with a grip and its Switches say: a grip's name, how the rows move on a computer and on a phone, each move as
|
|
104
|
+
* it is said, and the Switch's two words. English unless handed (the group editor hands the app's, VK-839). */
|
|
105
|
+
export interface MenuListWords {
|
|
106
|
+
move: (label: string) => string;
|
|
107
|
+
howKeys: string;
|
|
108
|
+
howHold: string;
|
|
109
|
+
movedTo: (label: string, at: number, of: number) => string;
|
|
110
|
+
on: string;
|
|
111
|
+
off: string;
|
|
112
|
+
}
|
|
113
|
+
export declare const MENU_LIST_WORDS: MenuListWords;
|
|
103
114
|
/** What scrolls in a menu's panel: its rows, alone, when the panel is taller than the room on screen, the Scrollbar over
|
|
104
115
|
* them: the menu's panel and each level in. Not the menu list's rows in a panel that is no menu (`.o-menu-rows`). */
|
|
105
116
|
export declare const MenuScroll: ({ children }: {
|
|
@@ -133,6 +144,8 @@ export interface MenuListPanelRowsProps {
|
|
|
133
144
|
ticks?: "box" | "switch" | "eye";
|
|
134
145
|
/** A row with a grip moved, handed on as it is made: its place and the place it moved to, counted among the rows with a grip. */
|
|
135
146
|
onMove?: (from: number, to: number) => void;
|
|
147
|
+
/** Its grips' and Switches' words; English unless handed. */
|
|
148
|
+
words?: Partial<MenuListWords>;
|
|
136
149
|
className?: string;
|
|
137
150
|
}
|
|
138
151
|
/** A menu's rows on a computer standing in a panel that is no menu (the Pane, a Popover): the same rows, pressed and keyed by
|
|
@@ -140,7 +153,7 @@ export interface MenuListPanelRowsProps {
|
|
|
140
153
|
* a row one level in handed to its holder, which shows what it opens in place. It draws no panel: its holder's is round it.
|
|
141
154
|
* Its rows are one tab stop, as a menu's are; the pointer lights the row under it, and moves the focus there only while the
|
|
142
155
|
* focus is already in it, so it never takes the focus from its holder's other controls. */
|
|
143
|
-
export declare function MenuListPanelRows({ label, entries, onOpen, ticks, onMove, className }: MenuListPanelRowsProps): import("react/jsx-runtime").JSX.Element;
|
|
156
|
+
export declare function MenuListPanelRows({ label, entries, onOpen, ticks, onMove, className, words: given }: MenuListPanelRowsProps): import("react/jsx-runtime").JSX.Element;
|
|
144
157
|
export declare function tilesOf(entries: MenuEntry[], allRows?: boolean): {
|
|
145
158
|
tiles?: MenuListTile[];
|
|
146
159
|
entries: MenuEntry[];
|
|
@@ -190,9 +203,11 @@ export interface MenuListProps {
|
|
|
190
203
|
onMove?: (from: number, to: number) => void;
|
|
191
204
|
/** How a tick is drawn: the Switch (the default), or an eye at its end, crossed while it is off. */
|
|
192
205
|
ticks?: "switch" | "eye";
|
|
206
|
+
/** Its grips' and Switches' words; English unless handed. */
|
|
207
|
+
words?: Partial<MenuListWords>;
|
|
193
208
|
className?: string;
|
|
194
209
|
}
|
|
195
210
|
/** What you can do with something, as rows you press: tiles if it has them, then its rows in sections. Pour it into a Sheet; it owns
|
|
196
211
|
* no way of opening or closing. No search: a menu long enough to need one is a wrong menu. */
|
|
197
|
-
export declare function MenuList({ label, entries, tiles, onOpen, onClose, closeWord, onMove, ticks, className }: MenuListProps): import("react/jsx-runtime").JSX.Element;
|
|
212
|
+
export declare function MenuList({ label, entries, tiles, onOpen, onClose, closeWord, onMove, ticks, className, words: given }: MenuListProps): import("react/jsx-runtime").JSX.Element;
|
|
198
213
|
export {};
|
|
@@ -49,10 +49,17 @@ const linkBody = (e, id) => _jsxs(_Fragment, { children: [e.icon, _jsx("span", {
|
|
|
49
49
|
const checkBody = (e, id) => _jsxs(_Fragment, { children: [_jsx(CheckboxMark, {}), _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label })] });
|
|
50
50
|
const actionsBody = (e, id) => _jsxs(_Fragment, { children: [e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), e.detail != null && _jsx("span", { className: "o-menu-value", id: part(id, "v"), "data-on": e.inForce ? "" : undefined, children: e.detail }), strokeGlyph(MORE, "o-menu-more")] });
|
|
51
51
|
const choicesBody = (e, id) => (_jsxs(_Fragment, { children: [e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), _jsx("span", { className: "o-menu-value", id: part(id, "v"), children: e.detail ?? e.choices.find((c) => c.value === e.value)?.label }), strokeGlyph(MORE, "o-menu-more")] }));
|
|
52
|
-
const
|
|
53
|
-
|
|
52
|
+
export const MENU_LIST_WORDS = {
|
|
53
|
+
move: (label) => `Move ${label}`,
|
|
54
|
+
howKeys: "Left arrow for its grip, then up or down arrow to move it",
|
|
55
|
+
howHold: "Hold, then drag to move it",
|
|
56
|
+
movedTo: (label, at, of) => `${label}, ${at} of ${of}`,
|
|
57
|
+
on: "On",
|
|
58
|
+
off: "Off",
|
|
59
|
+
};
|
|
60
|
+
const listWords = (given) => (given ? { ...MENU_LIST_WORDS, ...given } : MENU_LIST_WORDS);
|
|
54
61
|
const HOLD = { delay: (row) => msOf(row, "--menu-list-hold"), swipe: (row) => spacingPx(2, row) };
|
|
55
|
-
const movedTo = (list, from, to) =>
|
|
62
|
+
const movedTo = (list, from, to, w = MENU_LIST_WORDS) => w.movedTo("label" in list[from] ? list[from].label : "", to + 1, list.length);
|
|
56
63
|
function Says({ id, how, said }) {
|
|
57
64
|
return _jsxs(_Fragment, { children: [_jsx("span", { id: id, hidden: true, children: how }), _jsx("span", { role: "status", className: "o-menu-said", children: said })] });
|
|
58
65
|
}
|
|
@@ -116,16 +123,17 @@ export function MenuListShown({ entries, label, open, on = [], className }) {
|
|
|
116
123
|
}
|
|
117
124
|
const grippedOf = (list) => list.flatMap((e) => (e.kind === "group" ? grippedOf(e.entries) : e.kind !== "separator" && e.kind !== "pick" && e.grip && !("disabled" in e && e.disabled) ? [e] : []));
|
|
118
125
|
const disabledProps = (why) => (why ? { "aria-disabled": true, "data-disabled": "", title: why } : {});
|
|
119
|
-
function PanelCheck({ e, item, ticks, grip, id }) {
|
|
126
|
+
function PanelCheck({ e, item, ticks, grip, id, words = MENU_LIST_WORDS }) {
|
|
120
127
|
const [own, setOwn] = React.useState(!!e.defaultChecked), on = e.checked ?? own;
|
|
121
128
|
const press = () => { if (e.disabled)
|
|
122
129
|
return; const next = !on; if (e.checked === undefined)
|
|
123
130
|
setOwn(next); e.onCheckedChange?.(next); };
|
|
124
131
|
if (ticks === "eye")
|
|
125
132
|
return (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...disabledProps(e.disabled), ...item, onClick: press, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-eyed", children: [grip, e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), eyeOf(on, "o-menu-eye")] }));
|
|
126
|
-
return ticks === "switch" ? (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...disabledProps(e.disabled), ...item, onClick: press, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-switch", children: [grip, e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), _jsx(Switch, { size: "sm", checked: on, onCheckedChange: () => { }, disabled: !!e.disabled, tabIndex: -1, "aria-hidden": true, onMouseDown: (ev) => { ev.preventDefault(); ev.currentTarget.closest("[data-item]")?.focus({ preventScroll: true }); } })] })) : (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...disabledProps(e.disabled), ...item, onClick: press, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-check", children: [grip, checkBody(e, id)] }));
|
|
133
|
+
return ticks === "switch" ? (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...disabledProps(e.disabled), ...item, onClick: press, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-switch", children: [grip, e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), _jsx(Switch, { size: "sm", checked: on, onCheckedChange: () => { }, disabled: !!e.disabled, tabIndex: -1, "aria-hidden": true, words: [words.on, words.off], onMouseDown: (ev) => { ev.preventDefault(); ev.currentTarget.closest("[data-item]")?.focus({ preventScroll: true }); } })] })) : (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...disabledProps(e.disabled), ...item, onClick: press, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-check", children: [grip, checkBody(e, id)] }));
|
|
127
134
|
}
|
|
128
|
-
export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMove, className }) {
|
|
135
|
+
export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMove, className, words: given }) {
|
|
136
|
+
const w = listWords(given);
|
|
129
137
|
const root = React.useRef(null), mark = phoneMark(usePhoneForm());
|
|
130
138
|
const [lit, setLit] = React.useState(null), [stop, setStop] = React.useState(0);
|
|
131
139
|
const typed = React.useRef({ text: "", at: 0 });
|
|
@@ -143,7 +151,7 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
|
|
|
143
151
|
};
|
|
144
152
|
setLit((l) => (l == null ? l : at(l)));
|
|
145
153
|
setStop(at);
|
|
146
|
-
setSaid(movedTo(gripped, from, to));
|
|
154
|
+
setSaid(movedTo(gripped, from, to, w));
|
|
147
155
|
onMove?.(from, to);
|
|
148
156
|
} });
|
|
149
157
|
const rowsNow = () => [...(root.current?.querySelectorAll("[data-item]") ?? [])];
|
|
@@ -229,7 +237,7 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
|
|
|
229
237
|
if (g < 0 || !("label" in e))
|
|
230
238
|
return null;
|
|
231
239
|
const own = gripProps(g);
|
|
232
|
-
return (_jsx(Grip, { label:
|
|
240
|
+
return (_jsx(Grip, { label: w.move(e.label), className: "o-menu-grip", tabIndex: -1, ...own, onClick: (ev) => ev.stopPropagation(), onKeyDown: (ev) => {
|
|
233
241
|
if (ev.key === "ArrowRight" || ev.key === "Escape") {
|
|
234
242
|
ev.preventDefault();
|
|
235
243
|
ev.stopPropagation();
|
|
@@ -252,7 +260,7 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
|
|
|
252
260
|
if (e.kind === "pick")
|
|
253
261
|
return (_jsxs("div", { role: "group", "aria-label": e.heading, children: [e.heading && _jsx("p", { className: "o-list-heading", children: e.heading }), e.choices.map((c) => _jsx("div", { role: "menuitemradio", "aria-checked": c.value === e.value, ...item(), onClick: () => e.onChoose?.(c.value), className: ROW, children: choiceBody(c) }, c.value))] }, k));
|
|
254
262
|
if (e.kind === "check")
|
|
255
|
-
return _jsx(PanelCheck, { e: e, item: item(e), ticks: ticks, grip: gripFor(e), id: idOf(e) }, k);
|
|
263
|
+
return _jsx(PanelCheck, { e: e, item: item(e), ticks: ticks, grip: gripFor(e), id: idOf(e), words: w }, k);
|
|
256
264
|
if (e.kind === "link") {
|
|
257
265
|
const attrs = { role: "menuitem", ...item(e), className: ROW, onClick: e.onSelect, ...(e.external ? { target: "_blank", rel: "noreferrer" } : {}) };
|
|
258
266
|
return e.render ? React.cloneElement(e.render, { key: k, ...attrs }, gripFor(e), linkBody(e, idOf(e))) : _jsxs("a", { href: e.href, ...attrs, children: [gripFor(e), linkBody(e, idOf(e))] }, k);
|
|
@@ -262,7 +270,7 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
|
|
|
262
270
|
return _jsxs("div", { role: "menuitem", ...disabledProps(e.disabled), ...item(e), onClick: () => { if (!e.disabled)
|
|
263
271
|
e.onSelect?.(); }, className: rowClass(e), children: [gripFor(e), actionBody(e, idOf(e))] }, k);
|
|
264
272
|
});
|
|
265
|
-
return (_jsxs("div", { ref: root, role: "menu", "aria-label": label, className: cx("o-menu-rows", className), "data-kit": "menu-list", ...mark, onKeyDown: onKeyDown, onPointerLeave: onPointerLeave, onBlur: onBlur, children: [rows(entries), gripped.length > 0 && _jsx(Says, { id: `${ids}how`, how:
|
|
273
|
+
return (_jsxs("div", { ref: root, role: "menu", "aria-label": label, className: cx("o-menu-rows", className), "data-kit": "menu-list", ...mark, onKeyDown: onKeyDown, onPointerLeave: onPointerLeave, onBlur: onBlur, children: [rows(entries), gripped.length > 0 && _jsx(Says, { id: `${ids}how`, how: w.howKeys, said: said })] }));
|
|
266
274
|
}
|
|
267
275
|
export function tilesOf(entries, allRows) {
|
|
268
276
|
if (allRows)
|
|
@@ -302,14 +310,14 @@ const endOf = (r) => {
|
|
|
302
310
|
const end = r.end ?? (r.kind === "actions" ? r.detail : r.kind === undefined || r.kind === "action" ? r.count : undefined);
|
|
303
311
|
return end != null ? _jsx("span", { className: "o-menu-list-end", "data-on": r.kind === "actions" && r.inForce ? "" : undefined, children: end }) : null;
|
|
304
312
|
};
|
|
305
|
-
function PhoneRow({ row, onOpen, move, room, ticks = "switch" }) {
|
|
313
|
+
function PhoneRow({ row, onOpen, move, room, ticks = "switch", words = MENU_LIST_WORDS }) {
|
|
306
314
|
const mv = move ? { "data-row": move.at, ...(move.lifted ? { "data-lifted": "" } : {}), style: move.style, ...move.drag } : {};
|
|
307
315
|
const how = move ? { "aria-describedby": move.how } : {};
|
|
308
316
|
const lead = move ? glyph(GRIP, "o-menu-list-grip") : room ? React.cloneElement(glyph(GRIP, "o-menu-list-grip"), { "data-room": "" }) : null;
|
|
309
317
|
if (row.kind === "check" && ticks === "eye")
|
|
310
318
|
return _jsx(PhoneEye, { row: row, lead: lead, mv: mv, how: how });
|
|
311
319
|
if (row.kind === "check")
|
|
312
|
-
return (_jsxs("label", { className: "o-menu-list-row", ...mv, 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.disabled ?? row.note) != null && _jsx("span", { className: "o-menu-list-note", children: row.disabled ?? row.note })] }), _jsx(Switch, { size: "lg", checked: row.checked, defaultChecked: row.defaultChecked, onCheckedChange: (c) => row.onCheckedChange?.(c), disabled: !!row.disabled, ...how })] }));
|
|
320
|
+
return (_jsxs("label", { className: "o-menu-list-row", ...mv, 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.disabled ?? row.note) != null && _jsx("span", { className: "o-menu-list-note", children: row.disabled ?? row.note })] }), _jsx(Switch, { size: "lg", checked: row.checked, defaultChecked: row.defaultChecked, onCheckedChange: (c) => row.onCheckedChange?.(c), disabled: !!row.disabled, words: [words.on, words.off], ...how })] }));
|
|
313
321
|
if (row.kind === "link") {
|
|
314
322
|
const attrs = { className: "o-menu-list-row", ...mv, ...how, ...(row.external ? { target: "_blank", rel: "noreferrer" } : {}) };
|
|
315
323
|
const inside = _jsxs(_Fragment, { children: [lead, body(row), endOf(row), row.external ? glyph(AWAY, "o-menu-list-more") : glyph(MORE, "o-menu-list-more")] });
|
|
@@ -332,18 +340,19 @@ function PhoneEye({ row, lead, mv, how }) {
|
|
|
332
340
|
setOwn(next); row.onCheckedChange?.(next); };
|
|
333
341
|
return (_jsxs(BaseButton, { className: "o-menu-list-row", ...mv, ...how, role: "switch", "aria-checked": on, disabled: !!row.disabled, focusableWhenDisabled: true, onClick: press, 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.disabled ?? row.note) != null && _jsx("span", { className: "o-menu-list-note", children: row.disabled ?? row.note })] }), eyeOf(on, "o-menu-list-eye")] }));
|
|
334
342
|
}
|
|
335
|
-
export function MenuList({ label, entries, tiles, onOpen, onClose, closeWord = "Close", onMove, ticks, className }) {
|
|
343
|
+
export function MenuList({ label, entries, tiles, onOpen, onClose, closeWord = "Close", onMove, ticks, className, words: given }) {
|
|
344
|
+
const w = listWords(given);
|
|
336
345
|
const sections = React.useMemo(() => sectionsOf(entries).filter((s) => s.rows.length), [entries]);
|
|
337
346
|
const root = React.useRef(null), gripped = grippedOf(entries);
|
|
338
347
|
const ids = React.useId(), [said, setSaid] = React.useState("");
|
|
339
|
-
const { gripProps, lift, dragging } = useReorder({ count: gripped.length, grip: "[data-drag-start]", onMove: (from, to) => { setSaid(movedTo(gripped, from, to)); onMove?.(from, to); } });
|
|
348
|
+
const { gripProps, lift, dragging } = useReorder({ count: gripped.length, grip: "[data-drag-start]", onMove: (from, to) => { setSaid(movedTo(gripped, from, to, w)); onMove?.(from, to); } });
|
|
340
349
|
const phoneDrag = useHoldDrag(root, gripProps, HOLD, gripped.length > 0);
|
|
341
350
|
const moveOf = (r) => {
|
|
342
351
|
const at = gripped.indexOf(r);
|
|
343
352
|
return at < 0 ? undefined : { at, lifted: dragging === at, style: lift(at), drag: phoneDrag(at), how: `${ids}how` };
|
|
344
353
|
};
|
|
345
354
|
return (_jsxs("div", { ref: root, role: "group", "aria-label": label, className: cx("o-menu-list", className), "data-kit": "menu-list", children: [onClose && _jsx("div", { className: "o-menu-list-section", children: _jsx(PhoneRow, { row: { icon: _jsx(Icon, { name: "x", size: 22 }), label: closeWord, onSelect: onClose } }) }), tiles && (_jsx("div", { className: "o-menu-list-tiles", children: tiles.map((t) => _jsxs(BaseButton, { className: "o-menu-list-tile", disabled: t.disabled, onClick: t.onSelect, children: [_jsx("span", { className: "o-menu-list-mark", children: t.icon }), _jsx("span", { className: "o-menu-list-tile-name", children: t.label })] }, t.label)) })), sections.map((s, i) => {
|
|
346
|
-
const card = (_jsx("div", { role: s.name ? "group" : undefined, "aria-labelledby": s.name ? `${ids}h${i}` : undefined, className: "o-menu-list-section", children: s.rows.map((r) => _jsx(PhoneRow, { row: r, onOpen: onOpen, move: moveOf(r), room: gripped.length > 0, ticks: ticks }, r.label)) }, s.name ?? i));
|
|
355
|
+
const card = (_jsx("div", { role: s.name ? "group" : undefined, "aria-labelledby": s.name ? `${ids}h${i}` : undefined, className: "o-menu-list-section", children: s.rows.map((r) => _jsx(PhoneRow, { row: r, onOpen: onOpen, move: moveOf(r), room: gripped.length > 0, ticks: ticks, words: w }, r.label)) }, s.name ?? i));
|
|
347
356
|
return s.name ? _jsxs("div", { className: "o-menu-list-group", children: [_jsx("p", { id: `${ids}h${i}`, className: "o-list-heading", children: s.name }), card] }, `${i}${s.name}`) : card;
|
|
348
|
-
}), gripped.length > 0 && _jsx(Says, { id: `${ids}how`, how:
|
|
357
|
+
}), gripped.length > 0 && _jsx(Says, { id: `${ids}how`, how: w.howHold, said: said })] }));
|
|
349
358
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PieceLooks } from "../../looks/looks.js";
|
|
2
|
+
export type ModalOptionId = "edge" | "lines" | "buttons" | "head" | "size" | "corners" | "smoothing" | "padding" | "behind" | "strength" | "blur" | "shadow";
|
|
3
|
+
/** The Modal's options and its looks: Framed is Attio's, Outlined Linear's. */
|
|
4
|
+
export declare const MODAL_LOOKS: PieceLooks<ModalOptionId>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const steps = (ids) => ids.map((id) => ({ id, name: id }));
|
|
2
|
+
const options = [
|
|
3
|
+
{ id: "edge", name: "Edge", device: "desktop", def: "ring", values: [{ id: "ring", name: "Ring" }, { id: "outline", name: "Outline" }] },
|
|
4
|
+
{ id: "lines", name: "Lines", device: "desktop", def: "shown", values: [{ id: "shown", name: "Head and foot" }, { id: "none", name: "None" }] },
|
|
5
|
+
{ id: "buttons", name: "Buttons", device: "desktop", def: "own", values: [{ id: "own", name: "The Button's" }, { id: "pill", name: "Pill" }] },
|
|
6
|
+
{ id: "head", name: "Head and foot", device: "desktop", def: "bar", values: [{ id: "bar", name: "Bar" }, { id: "margin", name: "Margin" }] },
|
|
7
|
+
{ id: "size", name: "Button size", device: "desktop", def: "28", kind: "steps", values: steps(["28", "32", "36"]) },
|
|
8
|
+
{ id: "corners", name: "Corners", device: "desktop", def: "xl", kind: "steps", values: steps(["lg", "xl", "2xl"]) },
|
|
9
|
+
{ id: "smoothing", name: "Corner smoothing", device: "desktop", def: "smooth", values: [{ id: "round", name: "Round" }, { id: "smooth", name: "Smooth" }] },
|
|
10
|
+
{ id: "padding", name: "Padding", device: "desktop", def: "20", kind: "steps", values: steps(["16", "20", "24"]) },
|
|
11
|
+
{ id: "behind", name: "What's behind", device: "desktop", def: "dim", values: [{ id: "dim", name: "Dim" }, { id: "veil", name: "Veil" }] },
|
|
12
|
+
{ id: "strength", name: "Strength", device: "desktop", def: "light", kind: "steps", values: [{ id: "light", name: "Light" }, { id: "medium", name: "Medium" }, { id: "deep", name: "Deep" }] },
|
|
13
|
+
{ id: "blur", name: "Blur", device: "desktop", def: "0", kind: "steps", values: [{ id: "0", name: "None" }, ...steps(["4", "8", "12", "24"])] },
|
|
14
|
+
{ id: "shadow", name: "Shadow", device: "desktop", def: "2xl", kind: "steps", values: [{ id: "none", name: "None" }, { id: "lg", name: "Large" }, { id: "xl", name: "Extra large" }, { id: "2xl", name: "Largest" }] },
|
|
15
|
+
];
|
|
16
|
+
const shared = { size: "28", corners: "xl", smoothing: "smooth", padding: "20", behind: "dim", strength: "light", blur: "0", shadow: "2xl" };
|
|
17
|
+
export const MODAL_LOOKS = {
|
|
18
|
+
id: "modal",
|
|
19
|
+
name: "Modal",
|
|
20
|
+
options,
|
|
21
|
+
looks: [
|
|
22
|
+
{ id: "framed", name: "Framed", device: "desktop", picks: { ...shared, edge: "ring", lines: "shown", buttons: "own", head: "bar" } },
|
|
23
|
+
{ id: "outlined", name: "Outlined", device: "desktop", picks: { ...shared, edge: "outline", lines: "none", buttons: "pill", head: "margin" } },
|
|
24
|
+
],
|
|
25
|
+
};
|