viewkitjs 0.34.0 → 0.36.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 +173 -0
- package/MIGRATION.md +7 -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 +27 -7
- package/views/dist/contract.js +25 -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 +10 -5
- package/views/dist/controls/avatar/avatar.js +12 -6
- 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 +8 -1
- package/views/dist/controls/compound-editor/name-parts.js +3 -2
- package/views/dist/controls/compound-editor/place-parts.js +3 -3
- package/views/dist/controls/compound-editor/range-parts.js +11 -10
- package/views/dist/controls/compound-editor/words.d.ts +3 -0
- package/views/dist/controls/compound-editor/words.js +2 -0
- package/views/dist/controls/customize/customize.d.ts +22 -6
- package/views/dist/controls/customize/customize.js +154 -73
- package/views/dist/controls/customize/items.d.ts +49 -0
- package/views/dist/controls/customize/items.js +104 -0
- package/views/dist/controls/customize/map-customize-body.js +19 -15
- package/views/dist/controls/customize/words.d.ts +5 -3
- package/views/dist/controls/customize/words.js +1 -0
- package/views/dist/controls/filter-editor/block.js +5 -2
- package/views/dist/controls/filter-editor/filter-editor.d.ts +16 -1
- package/views/dist/controls/filter-editor/filter-editor.js +22 -16
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +3 -2
- package/views/dist/controls/filter-editor/map-filter-body.js +16 -2
- package/views/dist/controls/filter-editor/map-rules.d.ts +9 -2
- package/views/dist/controls/filter-editor/map-rules.js +18 -13
- package/views/dist/controls/filter-editor/parts.d.ts +1 -1
- package/views/dist/controls/filter-editor/parts.js +16 -15
- package/views/dist/controls/filter-editor/rules.d.ts +4 -4
- package/views/dist/controls/filter-editor/rules.js +6 -3
- package/views/dist/controls/filter-editor/words.d.ts +2 -0
- package/views/dist/controls/filter-editor/words.js +1 -0
- package/views/dist/controls/group-editor/group-editor.d.ts +3 -0
- package/views/dist/controls/group-editor/group-editor.js +21 -15
- package/views/dist/controls/group-editor/map-group-body.js +1 -0
- package/views/dist/controls/index.d.ts +1 -1
- package/views/dist/controls/internal/kit-words.d.ts +11 -0
- package/views/dist/controls/internal/kit-words.js +7 -0
- package/views/dist/controls/internal/map-panel-controls.d.ts +4 -1
- package/views/dist/controls/internal/map-panel-controls.js +23 -6
- package/views/dist/controls/internal/menu-items.d.ts +9 -0
- package/views/dist/controls/internal/menu-items.js +97 -0
- package/views/dist/controls/internal/panel-controls.d.ts +27 -3
- package/views/dist/controls/internal/panel-controls.js +142 -13
- 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 +4 -1
- package/views/dist/controls/menu/menu.js +3 -2
- package/views/dist/controls/number-editor/map-number-body.js +2 -0
- package/views/dist/controls/number-editor/number-editor.js +1 -1
- package/views/dist/controls/number-editor/words.d.ts +3 -0
- package/views/dist/controls/number-editor/words.js +2 -0
- package/views/dist/controls/picker/fields-frame.d.ts +5 -0
- package/views/dist/controls/picker/fields-frame.js +30 -0
- package/views/dist/controls/picker/map-fields-body.d.ts +2 -2
- package/views/dist/controls/picker/map-fields-body.js +7 -26
- package/views/dist/controls/picker/map-picker.d.ts +9 -3
- package/views/dist/controls/picker/map-picker.js +16 -3
- package/views/dist/controls/picker/picker.js +20 -10
- package/views/dist/controls/picker/rows.d.ts +9 -2
- package/views/dist/controls/picker.css +2 -0
- 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/map-select.d.ts +1 -1
- package/views/dist/controls/select/map-select.js +4 -1
- package/views/dist/controls/select/select.d.ts +5 -0
- package/views/dist/controls/select/select.js +11 -3
- package/views/dist/controls/sheet/bottom-sheet.d.ts +6 -1
- package/views/dist/controls/sheet/bottom-sheet.js +3 -3
- package/views/dist/controls/sort-editor/map-sort-body.js +1 -0
- package/views/dist/controls/sort-editor/sort-editor.d.ts +5 -1
- package/views/dist/controls/sort-editor/sort-editor.js +9 -8
- package/views/dist/controls/tag/tag.js +4 -2
- package/views/dist/controls/text-editor/map-text-body.js +4 -1
- package/views/dist/controls/text-editor/text-editor.js +2 -2
- package/views/dist/controls/text-editor/words.d.ts +3 -0
- package/views/dist/controls/text-editor/words.js +1 -1
- package/views/dist/controls/toolbar/toolbar.d.ts +31 -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/controls/views-list/map-views-list-body.js +9 -1
- package/views/dist/controls/views-list/rules.d.ts +1 -0
- package/views/dist/controls/views-list/rules.js +2 -2
- package/views/dist/controls/views-list/view-menu.js +2 -2
- package/views/dist/controls/views-list/words.d.ts +4 -0
- package/views/dist/controls/views-list/words.js +2 -1
- package/views/dist/display/option-badges.d.ts +17 -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.d.ts +7 -2
- package/views/dist/grid/chrome/GridAddColumn.js +13 -9
- 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 +4 -3
- package/views/dist/grid/chrome/GridNumberEditor.js +1 -1
- 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 +11 -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/GridTableSurface.js +2 -1
- 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-fitted-box.d.ts +5 -2
- package/views/dist/grid/chrome/grid-fitted-box.js +14 -4
- 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 +16 -4
- package/views/dist/grid/chrome/useGridScaleStyles.d.ts +9 -1
- package/views/dist/grid/chrome/useGridScaleStyles.js +1 -4
- package/views/dist/grid/grid-format-props.d.ts +1 -1
- package/views/dist/grid/grid-format-props.js +18 -5
- package/views/dist/grid/grid.css +11 -1
- package/views/dist/grid/looks.d.ts +3 -1
- package/views/dist/grid/looks.js +10 -4
- package/views/dist/grid/useGridTablePrefs.d.ts +1 -1
- package/views/dist/grid/useGridTableSettings.d.ts +1 -1
- package/views/dist/list/layer.d.ts +8 -0
- package/views/dist/list/layer.js +7 -0
- package/views/dist/list/list.js +2 -2
- package/views/dist/list/menu.d.ts +5 -4
- package/views/dist/list/store.d.ts +1 -1
- package/views/dist/list/toolbar.js +47 -20
- 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 +5 -1
- package/views/dist/panels/customize-body.js +21 -12
- package/views/dist/panels/model.d.ts +14 -4
- package/views/dist/panels/react/customize-body.js +15 -3
- package/views/dist/panels/react/customize.d.ts +8 -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/filter/FilterFieldList.d.ts +3 -1
- package/views/dist/panels/react/filter/FilterFieldList.js +2 -2
- package/views/dist/panels/react/filter/filter-body.js +3 -1
- package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -1
- package/views/dist/panels/react/filter/filter-part-body.js +2 -2
- 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/sort/SortEditor.js +3 -1
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -2
- 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/ToolbarBarFilter.js +5 -3
- 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 +9 -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/toolbar/editor-menus.d.ts +8 -0
- package/views/dist/panels/react/toolbar/editor-menus.js +3 -0
- package/views/dist/panels/react/views-row/FoldingViewRow.js +3 -5
- package/views/dist/panels/react/views-row/HScrollRow.d.ts +4 -2
- package/views/dist/panels/react/views-row/HScrollRow.js +6 -2
- package/views/dist/panels/react/views-row/ViewAxes.js +6 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +8 -3
- package/views/dist/panels/react/views-row/new-view.d.ts +11 -0
- package/views/dist/panels/react/views-row/new-view.js +21 -0
- 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 +109 -7
- package/views/dist/provider/components.js +1 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/styles.css +115 -27
- package/views/dist/styles.unlayered.css +115 -27
- package/views/docs/contract.md +55 -35
- 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 +27 -24
- package/views/docs/reference/editors-range.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +6 -5
- package/views/docs/reference/list.md +27 -7
- package/views/docs/reference/looks.md +5 -5
- package/views/docs/reference/panels-react.md +15 -14
- package/views/docs/reference/panels.md +5 -5
- package/views/docs/reference/react.md +25 -11
- package/views/docs/reference/views.md +2 -2
- package/views/docs/reshaping.md +22 -6
- package/views/skills/views/SKILL.md +2 -2
|
@@ -55,6 +55,8 @@ export interface FilterEditorWords {
|
|
|
55
55
|
putBack: string;
|
|
56
56
|
/** A block's quantifier, as its box and a related rule's ⋮ say it ("none where"). */
|
|
57
57
|
quantifier: (q: Quantifier) => string;
|
|
58
|
+
/** The any/none/every choice in a related rule's ⋮ as one row of an app's menus (VK-1063). */
|
|
59
|
+
relationRows: string;
|
|
58
60
|
/** Why Every can't be picked yet, by the relation's name in lower case. */
|
|
59
61
|
everyNeedsWhere: (one: string) => string;
|
|
60
62
|
/** A group's ⋮, to a screen reader, and its menu's (or its phone step's) name. */
|
|
@@ -37,6 +37,7 @@ export const FILTER_EDITOR_WORDS = {
|
|
|
37
37
|
save: "Save",
|
|
38
38
|
putBack: "Put back",
|
|
39
39
|
quantifier: (q) => `${q} where`,
|
|
40
|
+
relationRows: "Which related records",
|
|
40
41
|
everyNeedsWhere: (one) => `Pick a ${one} field under Where first`,
|
|
41
42
|
groupActions: "Actions for this group",
|
|
42
43
|
exclude: "Exclude matches",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { ViewsGroupEditorItems } from "../../provider/components.js";
|
|
2
3
|
import { type PickerItem } from "../picker/picker.js";
|
|
3
4
|
import { type GroupOrder, type GroupValue, type ListGroup } from "./rules.js";
|
|
4
5
|
import { type GroupEditorWords } from "./words.js";
|
|
@@ -41,6 +42,8 @@ export interface GroupEditorProps {
|
|
|
41
42
|
}[]>;
|
|
42
43
|
/** Its words; English unless handed. A `search` handed wins over `words.search`. */
|
|
43
44
|
words?: Partial<GroupEditorWords>;
|
|
45
|
+
/** Its rows as data (VK-1063): its settings and its foot (Remove grouping), handed their default items. */
|
|
46
|
+
items?: ViewsGroupEditorItems;
|
|
44
47
|
}
|
|
45
48
|
export interface GroupEditorParts {
|
|
46
49
|
body: React.ReactNode;
|
|
@@ -4,6 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { usePanelControls } from "../internal/panel-controls.js";
|
|
5
5
|
import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
|
|
6
6
|
import { useStepReturn } from "../internal/step-return.js";
|
|
7
|
+
import { shapeMenu } from "../internal/menu-items.js";
|
|
7
8
|
import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
|
|
8
9
|
import { MenuList, MenuListPanelRows } from "../menu-list/menu-list.js";
|
|
9
10
|
import { Picker, usePicker } from "../picker/picker.js";
|
|
@@ -11,17 +12,17 @@ import { openLevels } from "../picker/rows.js";
|
|
|
11
12
|
import { SheetStep } from "../sheet/bottom-sheet.js";
|
|
12
13
|
import { directionTurns, groupLabel, groupOrders, hideAllGroups, moveGroup, noneShown, orderedGroups, setGroupShown, showAllGroups, startGroup } from "./rules.js";
|
|
13
14
|
import { groupWords } from "./words.js";
|
|
15
|
+
const SETTING_KEYS = new Set(["field", "order", "direction", "step", "empty"]), FOOT_KEYS = new Set(["remove"]);
|
|
14
16
|
function FieldsOnPhone(props) {
|
|
15
17
|
return _jsx(_Fragment, { children: usePicker({ label: props.label, items: props.items, value: props.value, search: props.search, searchShown: true, form: "phone", words: props.words,
|
|
16
18
|
levels: props.levels, onLevelsChange: props.onLevelsChange, onValueChange: (v) => { if (typeof v === "string")
|
|
17
19
|
props.onPick(v); } }).body });
|
|
18
20
|
}
|
|
19
21
|
export function useGroupEditor(props) {
|
|
20
|
-
const { label, fields, ownOrders = {}, group, values, onGroupChange, opens, orders = {}, manualOrder = true, steps = {} } = props;
|
|
22
|
+
const { label, fields, ownOrders = {}, group, values, onGroupChange, opens, orders = {}, manualOrder = true, steps = {}, items } = props;
|
|
21
23
|
const { Button } = usePanelControls();
|
|
22
24
|
const w = groupWords(props.words), search = props.search ?? w.search;
|
|
23
25
|
const NAMES = { field: w.groupBy, order: w.order, direction: w.direction, step: w.dateStep };
|
|
24
|
-
const LEVEL_OF = Object.fromEntries(Object.entries(NAMES).map(([k, v]) => [v, k]));
|
|
25
26
|
const DIRECTIONS = [{ value: "ascending", label: w.ascending }, { value: "descending", label: w.descending }];
|
|
26
27
|
const ordersOf = (field) => {
|
|
27
28
|
const named = orders[field];
|
|
@@ -32,7 +33,8 @@ export function useGroupEditor(props) {
|
|
|
32
33
|
const screen = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (screen || small ? "phone" : "computer")) === "phone";
|
|
33
34
|
const now = React.useRef(group);
|
|
34
35
|
React.useLayoutEffect(() => { now.current = group; });
|
|
35
|
-
const
|
|
36
|
+
const latest = React.useMemo(() => ({ get group() { return now.current; }, set group(next) { now.current = next; } }), []);
|
|
37
|
+
const change = (next) => { latest.group = next; onGroupChange(next); };
|
|
36
38
|
const [level, setLevel] = React.useState(opens ?? null), [wentBack, setWentBack] = React.useState(false);
|
|
37
39
|
const [fieldLevels, setFieldLevels] = React.useState(opens === "field" && props.opensLevel ? [props.opensLevel] : []);
|
|
38
40
|
const [focusTo, setFocusTo] = React.useState(null), root = React.useRef(null);
|
|
@@ -45,20 +47,20 @@ export function useGroupEditor(props) {
|
|
|
45
47
|
return;
|
|
46
48
|
setFocusTo(null);
|
|
47
49
|
const rows = [...(root.current?.querySelectorAll("[data-item]") ?? [])];
|
|
48
|
-
const to = focusTo === "ticked" ? rows.find((r) => r.getAttribute("aria-checked") === "true") :
|
|
50
|
+
const to = focusTo === "ticked" ? rows.find((r) => r.getAttribute("aria-checked") === "true") : root.current?.querySelector(`[data-slot=vk-group-setting][data-key="${CSS.escape(focusTo)}"]`);
|
|
49
51
|
to?.focus({ preventScroll: true });
|
|
50
52
|
}, [focusTo, phone]);
|
|
51
53
|
const open = (to) => { setWentBack(false); setLevel(to); setFieldLevels([]); if (to !== "field")
|
|
52
54
|
setFocusTo("ticked"); };
|
|
53
55
|
const back = () => { const from = level; setWentBack(true); setLevel(null); setFieldLevels([]); if (from)
|
|
54
|
-
setFocusTo(
|
|
56
|
+
setFocusTo(from); };
|
|
55
57
|
const levelName = level && (level === "field" || group) ? NAMES[level] : null;
|
|
56
|
-
useStepReturn(root, phone && levelName ? [(r) =>
|
|
58
|
+
useStepReturn(root, phone && levelName && level ? [(r) => r.querySelector(`[data-slot=vk-group-setting][data-key="${CSS.escape(level)}"]`)] : []);
|
|
57
59
|
const onFieldLevels = (next) => { setWentBack(next.length < fieldLevels.length); setFieldLevels(next); };
|
|
58
60
|
const backField = () => { setWentBack(true); setFieldLevels((l) => l.slice(0, -1)); };
|
|
59
61
|
const dateSteps = group ? stepsOf(group.field) : [], heldStep = group?.step ?? dateSteps[0]?.value ?? "";
|
|
60
|
-
const hideEmptyTo = (on) => { if (
|
|
61
|
-
change({ ...
|
|
62
|
+
const hideEmptyTo = (on) => { const g = latest.group; if (g)
|
|
63
|
+
change({ ...g, hideEmpty: on }); };
|
|
62
64
|
const setting = (key) => ({ slot: "vk-group-setting", key });
|
|
63
65
|
const named = (cs) => cs.map((c) => ({ ...c, slot: { slot: "vk-group-choice", key: c.value } }));
|
|
64
66
|
const settings = [
|
|
@@ -72,8 +74,11 @@ export function useGroupEditor(props) {
|
|
|
72
74
|
{ kind: "check", label: w.hideEmpty, checked: group.hideEmpty, onCheckedChange: hideEmptyTo, slot: setting("empty") },
|
|
73
75
|
] : []),
|
|
74
76
|
];
|
|
75
|
-
const opened = (e) => {
|
|
76
|
-
open(
|
|
77
|
+
const opened = (e) => { const at = "slot" in e ? e.slot : undefined; if (at?.slot === "vk-group-setting" && at.key && at.key in NAMES)
|
|
78
|
+
open(at.key); };
|
|
79
|
+
const form0 = phone ? "phone" : "computer";
|
|
80
|
+
const shownSettings = shapeMenu(settings, items, { menu: "settings", ...(group && { field: group.field }), form: form0 }, "vk-group-row", SETTING_KEYS);
|
|
81
|
+
const nameOf = (l) => { const e = shownSettings.find((x) => "slot" in x && x.slot?.key === l); return e && "label" in e ? e.label : NAMES[l]; };
|
|
77
82
|
const groups = group ? orderedGroups(values, group).map((v) => ({ kind: "check", label: v.label, icon: v.mark, checked: !group.hidden.includes(v.value), grip: true,
|
|
78
83
|
slot: { slot: "vk-group-value", key: v.value }, onCheckedChange: (on) => { if (now.current)
|
|
79
84
|
change(setGroupShown(now.current, v.value, on)); } })) : [];
|
|
@@ -82,8 +87,9 @@ export function useGroupEditor(props) {
|
|
|
82
87
|
const none = !!group && noneShown(group, values);
|
|
83
88
|
const heading = (_jsxs("div", { className: "o-group-editor-heading", "data-slot": "vk-group-heading", children: [_jsx("p", { className: "o-list-heading", children: w.groups }), _jsx(Button, { kind: "link", size: "line", "data-slot": "vk-group-hide-all", onClick: () => { if (now.current)
|
|
84
89
|
change(none ? showAllGroups(now.current) : hideAllGroups(now.current, values)); }, children: none ? w.showAll : w.hideAll })] }));
|
|
85
|
-
const removeRow = { icon: null, label: w.remove, danger: true, slot: { slot: "vk-group-remove" }, onSelect: () => { change(null); setLevel(null); setFocusTo(
|
|
86
|
-
const
|
|
90
|
+
const removeRow = { icon: null, label: w.remove, danger: true, slot: { slot: "vk-group-remove", key: "remove" }, onSelect: () => { change(null); setLevel(null); setFocusTo("field"); } };
|
|
91
|
+
const footRows = shapeMenu([removeRow], items, { menu: "foot", form: form0 }, "vk-group-row", FOOT_KEYS);
|
|
92
|
+
const foot = footRows.length ? [{ kind: "separator" }, ...footRows] : [];
|
|
87
93
|
const pickField = (v) => {
|
|
88
94
|
if (v !== now.current?.field)
|
|
89
95
|
change(startGroup(v, v in ownOrders, now.current?.hideEmpty ?? false, stepsOf(v)[0]?.value));
|
|
@@ -114,15 +120,15 @@ export function useGroupEditor(props) {
|
|
|
114
120
|
pickField(v); } }) });
|
|
115
121
|
}
|
|
116
122
|
else if (at) {
|
|
117
|
-
content = phone ? _jsx(MenuList, { words: w.list, label:
|
|
123
|
+
content = phone ? _jsx(MenuList, { words: w.list, label: nameOf(at), entries: choices(at) }) : _jsx(MenuListPanelRows, { words: w.list, label: nameOf(at), entries: choices(at) });
|
|
118
124
|
}
|
|
119
125
|
else {
|
|
120
|
-
content = phone ? (_jsxs(_Fragment, { children: [_jsx(MenuList, { words: w.list, label: label, entries:
|
|
126
|
+
content = phone ? (_jsxs(_Fragment, { children: [_jsx(MenuList, { words: w.list, label: label, entries: shownSettings, onOpen: opened }), group && _jsxs(_Fragment, { children: [values.length > 0 && _jsxs(_Fragment, { children: [heading, _jsx(MenuList, { words: w.list, label: w.groups, entries: groups, onMove: move })] }), _jsx(MenuList, { words: w.list, label: w.remove, entries: footRows })] })] })) : (_jsxs(_Fragment, { children: [_jsx(MenuListPanelRows, { words: w.list, label: label, entries: shownSettings, ticks: "switch", onOpen: opened }), group && _jsxs(_Fragment, { children: [values.length > 0 && _jsxs(_Fragment, { children: [heading, _jsx(MenuListPanelRows, { words: w.list, label: w.groups, entries: groups, ticks: "switch", onMove: move })] }), _jsx(MenuListPanelRows, { words: w.list, label: w.remove, entries: foot })] })] }));
|
|
121
127
|
}
|
|
122
128
|
const fieldLevel = at === "field" ? openLevels(fields, fieldLevels).slice(-1)[0] : undefined;
|
|
123
129
|
const step = fieldLevel ? `field:${fieldLevels.join(">")}` : at ?? "settings";
|
|
124
130
|
const body = (_jsx("div", { ref: placeRoot, className: "o-group-editor", "data-slot": "vk-group", "data-kit": "group-editor", "data-group-form": form, "data-group-level": at ?? "settings", ...phoneMark(!!screen || small), ...MENU_LIST_CARD_FRAME, children: phone ? _jsx(SheetStep, { step: step, back: wentBack, children: _jsx("div", { className: "o-group-editor-step", children: content }) }) : content }));
|
|
125
|
-
return { body, level: fieldLevel ? { name: fieldLevel.label, back: backField } : at ? { name:
|
|
131
|
+
return { body, level: fieldLevel ? { name: fieldLevel.label, back: backField } : at ? { name: nameOf(at), back } : null };
|
|
126
132
|
}
|
|
127
133
|
export function GroupEditor(props) {
|
|
128
134
|
return _jsx(_Fragment, { children: useGroupEditor(props).body });
|
|
@@ -92,7 +92,7 @@ export { QUICK_FILTERS_RULES } from "./quick-filters/rules.js";
|
|
|
92
92
|
export { QUICK_FILTERS_ATTRS, quickFiltersWornOf } from "./quick-filters/looks.js";
|
|
93
93
|
export { QUICK_FILTERS_WORDS, quickFiltersWords, type QuickFiltersWords } from "./quick-filters/words.js";
|
|
94
94
|
export { quickFiltersFieldsOf, quickHoldsOf, quickListHoldOf, type QuickFiltersFieldIn } from "./quick-filters/map-quick-filters-body.js";
|
|
95
|
-
export { ToolbarControl, ToolbarFolds, ToolbarInput, ToolbarSeparatorControl, ToolbarSpacer, toolbarSteps, useToolbarWorn, type ToolbarAt, type ToolbarFoldsProps, type ToolbarInputProps, type ToolbarPlace, type ToolbarProps, } from "./toolbar/toolbar.js";
|
|
95
|
+
export { ToolbarControl, ToolbarFolds, ToolbarInput, ToolbarSeparatorControl, ToolbarSpacer, toolbarSteps, useToolbarWorn, type ToolbarAt, type ToolbarFoldsProps, type ToolbarInputProps, type ToolbarMoreControl, type ToolbarOverflowControl, type ToolbarOwnButtonProps, type ToolbarPlace, type ToolbarProps, } from "./toolbar/toolbar.js";
|
|
96
96
|
export { TOOLBAR_ATTRS, toolbarWornOf } from "./toolbar/looks.js";
|
|
97
97
|
export { TOOLBAR_WORDS, toolbarWords, type ToolbarWords } from "./toolbar/words.js";
|
|
98
98
|
export { QuickFiltersReminderControl, type QuickFiltersReminderProps } from "./quick-filters/reminder.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type KitWords = {
|
|
3
|
+
/** The Select's ×, which empties it. */
|
|
4
|
+
clear: string;
|
|
5
|
+
/** A chip's × (the Tag's, the Option's), named by its words where it has them. */
|
|
6
|
+
remove: (word?: string) => string;
|
|
7
|
+
/** The typed Select's chevron, which shows every choice, named by the Select's label where it has one. */
|
|
8
|
+
showEvery: (label?: string) => string;
|
|
9
|
+
};
|
|
10
|
+
export declare const KIT_WORDS: KitWords;
|
|
11
|
+
export declare const KitWordsContext: React.Context<KitWords>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { type KitWords } from "./kit-words.js";
|
|
2
3
|
import { type AppPanelControls } from "./panel-controls.js";
|
|
3
4
|
/** The app's controls for the panels, as the provider names them; none outside a provider or with nothing opted in. */
|
|
4
5
|
export declare function useAppPanelControls(): AppPanelControls;
|
|
5
|
-
/**
|
|
6
|
+
/** The kit's shared words in the app's messages (VK-997); ViewKit's English outside a provider. */
|
|
7
|
+
export declare function useKitWords(): KitWords | null;
|
|
8
|
+
/** Its children drawn with the app's controls for the panels, and the kit's shared words in the app's (VK-997). */
|
|
6
9
|
export declare function PanelControlsFromViews({ children }: {
|
|
7
10
|
children: React.ReactNode;
|
|
8
11
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
+
import { parseNumber } from "viewkitjs/fields";
|
|
4
5
|
import { ViewsContext } from "../../provider/context.js";
|
|
6
|
+
import { KitWordsContext } from "./kit-words.js";
|
|
5
7
|
import { NO_APP_CONTROLS, PanelControlsContext } from "./panel-controls.js";
|
|
6
8
|
export function useAppPanelControls() {
|
|
7
9
|
const views = React.useContext(ViewsContext);
|
|
8
|
-
const components = views?.components, names = views?.panelControls;
|
|
10
|
+
const components = views?.components, atoms = views?.atoms, names = views?.panelControls, conventions = views?.conventions;
|
|
9
11
|
return React.useMemo(() => {
|
|
10
|
-
if (!components || !names?.size)
|
|
12
|
+
if (!components || !atoms || !names?.size)
|
|
11
13
|
return NO_APP_CONTROLS;
|
|
12
14
|
const out = {};
|
|
13
15
|
for (const name of names)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
if (name !== "RelationChip")
|
|
17
|
+
out[name] = name === "Avatar" ? atoms.Avatar : components[name];
|
|
18
|
+
if (out.Input)
|
|
19
|
+
out.parseNumber = (typed) => parseNumber(typed, conventions);
|
|
20
|
+
return Object.keys(out).length ? out : NO_APP_CONTROLS;
|
|
21
|
+
}, [components, atoms, names, conventions]);
|
|
22
|
+
}
|
|
23
|
+
export function useKitWords() {
|
|
24
|
+
const messages = React.useContext(ViewsContext)?.messages;
|
|
25
|
+
return React.useMemo(() => messages
|
|
26
|
+
? {
|
|
27
|
+
clear: messages({ key: "views.menus.clear" }),
|
|
28
|
+
remove: (word) => (word ? messages({ key: "views.editors.tag-remove", values: { label: word } }) : messages({ key: "views.picker.remove" })),
|
|
29
|
+
showEvery: (label) => (label ? messages({ key: "views.picker.show-every", values: { label } }) : messages({ key: "views.picker.show-all" })),
|
|
30
|
+
}
|
|
31
|
+
: null, [messages]);
|
|
17
32
|
}
|
|
18
33
|
export function PanelControlsFromViews({ children }) {
|
|
19
|
-
|
|
34
|
+
const words = useKitWords();
|
|
35
|
+
const drawn = _jsx(PanelControlsContext.Provider, { value: useAppPanelControls(), children: children });
|
|
36
|
+
return words ? _jsx(KitWordsContext.Provider, { value: words, children: drawn }) : drawn;
|
|
20
37
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ViewsMenuItem } from "../../provider/components.js";
|
|
2
|
+
import type { MenuEntry } from "../menu-list/menu-list.js";
|
|
3
|
+
/** A menu's entries as keyed items: each entry with a public key, the pick a group of its choices (`<key>:<choice>`), a line
|
|
4
|
+
* before an entry its `separatorBefore`. */
|
|
5
|
+
export declare function itemsOfEntries(entries: readonly MenuEntry[], names?: Readonly<Record<string, string>>): ViewsMenuItem[];
|
|
6
|
+
/** The entries the items draw: disabled first, then a default key (ViewKit's entry), then the app's rows. */
|
|
7
|
+
export declare function entriesOfItems<E extends MenuEntry>(items: readonly ViewsMenuItem[], own: ReadonlyMap<string, E>, appSlot: string, defaults: ReadonlySet<string>): E[];
|
|
8
|
+
/** A menu's entries through the app's function: none handed, the very entries. `defaults` names every key the menu can hold. */
|
|
9
|
+
export declare function shapeMenu<E extends MenuEntry, C>(entries: E[], fn: ((items: ViewsMenuItem[], ctx: C) => ViewsMenuItem[]) | undefined, ctx: C, appSlot: string, defaults: ReadonlySet<string>, names?: Readonly<Record<string, string>>): E[];
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
const slotOf = (e) => ("slot" in e ? e.slot : undefined);
|
|
2
|
+
const isSep = (e) => "kind" in e && e.kind === "separator";
|
|
3
|
+
export function itemsOfEntries(entries, names = {}) {
|
|
4
|
+
const out = [];
|
|
5
|
+
let line = false;
|
|
6
|
+
for (const e of entries) {
|
|
7
|
+
if (isSep(e)) {
|
|
8
|
+
line = true;
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
const key = slotOf(e)?.key;
|
|
12
|
+
if (key === undefined)
|
|
13
|
+
continue;
|
|
14
|
+
const before = line && out.length > 0;
|
|
15
|
+
line = false;
|
|
16
|
+
if ("kind" in e && e.kind === "pick") {
|
|
17
|
+
out.push({ key, label: e.heading ?? names[key] ?? key, children: e.choices.map((c) => ({ key: `${key}:${c.value}`, label: c.label })), ...(before && { separatorBefore: true }) });
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const x = e;
|
|
21
|
+
out.push({ key, label: x.label, ...(x.icon != null && { icon: x.icon }), ...(x.disabled !== undefined && { disabled: true, disabledReason: x.disabled }),
|
|
22
|
+
...(x.danger && { destructive: true }), ...(x.kind === "check" && { checked: !!x.checked }), ...(before && { separatorBefore: true }) });
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
function tidy(entries) {
|
|
27
|
+
const out = [];
|
|
28
|
+
for (const e of entries) {
|
|
29
|
+
if (isSep(e) && (out.length === 0 || isSep(out[out.length - 1])))
|
|
30
|
+
continue;
|
|
31
|
+
out.push(e);
|
|
32
|
+
}
|
|
33
|
+
while (out.length && isSep(out[out.length - 1]))
|
|
34
|
+
out.pop();
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
export function entriesOfItems(items, own, appSlot, defaults) {
|
|
38
|
+
const out = [];
|
|
39
|
+
const sep = { kind: "separator" };
|
|
40
|
+
for (const item of items) {
|
|
41
|
+
const mine = own.get(item.key);
|
|
42
|
+
if (!mine && defaults.has(item.key))
|
|
43
|
+
continue;
|
|
44
|
+
const slot = (mine && slotOf(mine)) ?? { slot: appSlot, key: item.key };
|
|
45
|
+
if (mine && "kind" in mine && mine.kind === "pick") {
|
|
46
|
+
const kept = item.children === undefined ? mine.choices
|
|
47
|
+
: item.children.flatMap((c) => { const v = c.key.slice(item.key.length + 1), ch = mine.choices.find((x) => x.value === v); return ch ? [{ ...ch, label: c.label }] : []; });
|
|
48
|
+
if (kept.length)
|
|
49
|
+
out.push(sep, { ...mine, choices: kept }, sep);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (item.separatorBefore)
|
|
53
|
+
out.push(sep);
|
|
54
|
+
const ownReason = mine && "label" in mine ? mine.disabled : undefined;
|
|
55
|
+
if (item.disabled && mine) {
|
|
56
|
+
out.push({ ...mine, label: item.label, ...(item.icon !== undefined && { icon: item.icon }), disabled: item.disabledReason || ownReason || item.label });
|
|
57
|
+
}
|
|
58
|
+
else if (item.disabled) {
|
|
59
|
+
out.push({ icon: item.icon ?? null, label: item.label, disabled: item.disabledReason || item.label, slot });
|
|
60
|
+
}
|
|
61
|
+
else if (mine) {
|
|
62
|
+
out.push({ ...mine, label: item.label, ...(item.icon !== undefined && { icon: item.icon }) });
|
|
63
|
+
}
|
|
64
|
+
else if (item.children !== undefined) {
|
|
65
|
+
const entries = entriesOfItems(item.children, own, appSlot, defaults);
|
|
66
|
+
if (entries.length)
|
|
67
|
+
out.push({ kind: "group", heading: item.label, entries });
|
|
68
|
+
}
|
|
69
|
+
else if (item.checked !== undefined) {
|
|
70
|
+
const onSelect = item.onSelect;
|
|
71
|
+
out.push({ kind: "check", label: item.label, ...(item.icon != null && { icon: item.icon }), checked: item.checked, onCheckedChange: () => onSelect?.(), slot });
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
out.push({ icon: item.icon ?? null, label: item.label, ...(item.onSelect && { onSelect: item.onSelect }), ...(item.destructive && { danger: true }), slot });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return tidy(out);
|
|
78
|
+
}
|
|
79
|
+
function once(items, seen = new Set()) {
|
|
80
|
+
return items.flatMap((i) => {
|
|
81
|
+
if (seen.has(i.key))
|
|
82
|
+
return [];
|
|
83
|
+
seen.add(i.key);
|
|
84
|
+
return [i.children ? { ...i, children: once(i.children, seen) } : i];
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export function shapeMenu(entries, fn, ctx, appSlot, defaults, names) {
|
|
88
|
+
if (!fn)
|
|
89
|
+
return entries;
|
|
90
|
+
const own = new Map();
|
|
91
|
+
for (const e of entries) {
|
|
92
|
+
const key = slotOf(e)?.key;
|
|
93
|
+
if (key !== undefined)
|
|
94
|
+
own.set(key, e);
|
|
95
|
+
}
|
|
96
|
+
return entriesOfItems(once(fn(itemsOfEntries(entries, names), ctx)), own, appSlot, defaults);
|
|
97
|
+
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ViewsAvatarProps } from "../../atoms/types.js";
|
|
3
|
+
import type { ViewsButtonProps, ViewsCalendarProps, ViewsInputProps, ViewsMenuItem, ViewsMenuProps, ViewsPopoverProps, ViewsSelectProps, ViewsTooltipProps } from "../../provider/components.js";
|
|
3
4
|
import { type ButtonProps } from "../button/button.js";
|
|
5
|
+
import { type GlassButtonProps } from "../glass-button/glass-button.js";
|
|
4
6
|
import { type InputProps } from "../input/input.js";
|
|
5
7
|
import { type MenuProps } from "../menu/menu.js";
|
|
8
|
+
import { type NumberFieldProps } from "../number-field/number-field.js";
|
|
6
9
|
import type { MenuEntry } from "../menu-list/menu-list.js";
|
|
7
10
|
import { type PopoverProps } from "../popover/popover.js";
|
|
8
11
|
import { type SelectListProps, type SelectProps } from "../select/select.js";
|
|
12
|
+
import { type TooltipProps } from "../tooltip/tooltip.js";
|
|
9
13
|
/** The app's own controls the panels draw, by name; a name left out is ViewKit's own. */
|
|
10
14
|
export type AppPanelControls = {
|
|
11
15
|
Button?: React.ComponentType<ViewsButtonProps>;
|
|
@@ -15,6 +19,13 @@ export type AppPanelControls = {
|
|
|
15
19
|
Input?: React.ComponentType<ViewsInputProps>;
|
|
16
20
|
/** The date editor's month (VK-1021). */
|
|
17
21
|
Calendar?: React.ComponentType<ViewsCalendarProps>;
|
|
22
|
+
/** The panels' tooltips (VK-1015). */
|
|
23
|
+
Tooltip?: React.ComponentType<ViewsTooltipProps>;
|
|
24
|
+
/** The app's Avatar atom: every record's mark a panel draws (VK-1044, controls/avatar/record-mark.tsx). */
|
|
25
|
+
Avatar?: React.ComponentType<ViewsAvatarProps>;
|
|
26
|
+
/** How a number box drawn by the app's Input reads what is typed (VK-1018): the provider's conventions, handed by the map body
|
|
27
|
+
* with the Input; a plain reading of the digits where none is. */
|
|
28
|
+
parseNumber?: (typed: string) => number | null;
|
|
18
29
|
};
|
|
19
30
|
/** No app control: what a panel drawn alone reads. */
|
|
20
31
|
export declare const NO_APP_CONTROLS: AppPanelControls;
|
|
@@ -37,20 +48,33 @@ export type PanelControls = {
|
|
|
37
48
|
GroupButton: React.ComponentType<ButtonLike>;
|
|
38
49
|
/** The app's Calendar, or null: the date editor then draws its own month (VK-1021). */
|
|
39
50
|
Calendar: React.ComponentType<ViewsCalendarProps> | null;
|
|
51
|
+
/** The phone's round glass button (the Picker's Back and ⋯): ViewKit's GlassButton, or the app's Button as a quiet one (VK-1022). */
|
|
52
|
+
RoundButton: React.ComponentType<RoundLike>;
|
|
53
|
+
/** A tooltip in a panel: ViewKit's Tooltip, or the app's handed its words, side and whether they are a reason (VK-1015). */
|
|
54
|
+
Tooltip: React.ComponentType<TooltipProps>;
|
|
55
|
+
/** A number's box in a panel (the filter's value, a range's From and To): ViewKit's Number field, or the app's Input with
|
|
56
|
+
* ViewKit reading what is typed (VK-1018). */
|
|
57
|
+
NumberBox: React.ComponentType<NumberFieldProps>;
|
|
58
|
+
};
|
|
59
|
+
type RoundLike = GlassButtonProps & {
|
|
60
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
40
61
|
};
|
|
41
62
|
/** The controls a panel draws: the app's where the context holds them, else ViewKit's own, the same components. */
|
|
42
63
|
export declare function usePanelControls(): PanelControls;
|
|
43
64
|
/** ViewKit's Button props as the map's: its kind a variant, its size and form one of the map's three sizes, its icons in its
|
|
44
65
|
* children; one that can't be used but keeps its focus says so and takes no press. ViewKit's own look is never handed. */
|
|
45
66
|
export declare function buttonPropsOf(p: ButtonLike): ViewsButtonProps;
|
|
67
|
+
/** Whether a component is the hook's app Button: it takes ViewKit's Button props, so the Toolbar holds it as it holds ViewKit's
|
|
68
|
+
* Button, one of its stops (the bulk bar, VK-1023). */
|
|
69
|
+
export declare const isAppButton: (type: unknown) => boolean;
|
|
46
70
|
/** ViewKit's Select props as the map's: its rows, value, pick, name and size, and anything else a ViewKit part hands it (an
|
|
47
71
|
* `aria-describedby`, a handler) on the rest; never its list's width or its own look. */
|
|
48
72
|
export declare function selectPropsOf(p: SelectListProps): ViewsSelectProps;
|
|
49
73
|
/** A menu's rows as the map's: an action, a tick, a pick's choices (under its heading when it has one), a line before the next row.
|
|
50
74
|
* Each row keeps its public name and which one it is. A kind the map has no word for is left out, with a warning. */
|
|
51
|
-
export declare function menuItemsOf(entries: MenuEntry[], label: string): ViewsMenuItem[];
|
|
75
|
+
export declare function menuItemsOf(entries: MenuEntry[], label: string, within?: string): ViewsMenuItem[];
|
|
52
76
|
/** ViewKit's Popover props as the map's: open, where, what closes it, its name, its popup's marks and click (an editor's inner
|
|
53
|
-
* Escape rides those marks, VK-1021); a trigger of its own
|
|
77
|
+
* Escape rides those marks, VK-1021); a trigger of its own is opened by TriggeredPopover (VK-1022). A `finalFocus` ref is honoured by AppPopover itself. */
|
|
54
78
|
export declare function popoverPropsOf(p: PopoverProps): ViewsPopoverProps;
|
|
55
79
|
/** ViewKit's Input props as the map's: a value typed handed as its change, in the app's field frame, or bare where a ViewKit box
|
|
56
80
|
* frames it (a box group) or the part says so (VK-1021); never ViewKit's own look. */
|