viewkitjs 0.37.0 → 0.39.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 +7 -0
- package/fields/dist/query/figure-kinds.d.ts +2 -2
- package/fields/dist/query/figure-kinds.js +3 -0
- package/fields/dist/query/figures.d.ts +5 -3
- package/fields/dist/query/figures.js +13 -0
- package/fields/docs/reference/query.md +3 -3
- package/package.json +1 -1
- package/postgres/docs/guides/field-map.md +1 -1
- package/views/dist/atoms/HeaderChrome.d.ts +7 -0
- package/views/dist/atoms/HeaderChrome.js +15 -0
- package/views/dist/atoms/ToolbarButton.d.ts +1 -1
- package/views/dist/atoms/ToolbarButton.js +2 -2
- package/views/dist/atoms/defaults.js +4 -0
- package/views/dist/atoms/types.d.ts +39 -2
- package/views/dist/contract.d.ts +25 -11
- package/views/dist/contract.js +41 -6
- package/views/dist/controls/field/looks.d.ts +1 -1
- package/views/dist/controls/field/looks.js +9 -3
- package/views/dist/controls/field/tokens.d.ts +4 -0
- package/views/dist/controls/field/tokens.js +1 -0
- package/views/dist/controls/field.css +93 -1
- package/views/dist/controls/filter-editor/block.d.ts +3 -1
- package/views/dist/controls/filter-editor/block.js +4 -3
- package/views/dist/controls/filter-editor/filter-editor.d.ts +13 -2
- package/views/dist/controls/filter-editor/filter-editor.js +45 -15
- package/views/dist/controls/filter-editor/how.d.ts +3 -1
- package/views/dist/controls/filter-editor/map-filter-body.js +5 -4
- package/views/dist/controls/filter-editor/map-rules.d.ts +2 -1
- package/views/dist/controls/filter-editor/map-rules.js +3 -3
- package/views/dist/controls/glyphs/glyphs.js +2 -0
- package/views/dist/controls/inline-input.css +3 -2
- package/views/dist/controls/internal/menu-items.d.ts +2 -0
- package/views/dist/controls/internal/menu-items.js +1 -1
- package/views/dist/controls/internal/part-slot.d.ts +1 -1
- package/views/dist/controls/internal/part-slot.js +1 -1
- package/views/dist/controls/internal/read-token.d.ts +2 -1
- package/views/dist/controls/internal/read-token.js +2 -1
- package/views/dist/controls/internal/row-actions.d.ts +33 -0
- package/views/dist/controls/internal/row-actions.js +28 -0
- package/views/dist/controls/menu/map-menu.js +1 -1
- package/views/dist/controls/number-editor/tokens.d.ts +8 -0
- package/views/dist/controls/number-editor/tokens.js +2 -0
- package/views/dist/controls/number-editor.css +20 -0
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +2 -2
- package/views/dist/controls/sheet/map-sheet.js +9 -6
- 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 +41 -13
- package/views/dist/controls/text-editor/tokens.d.ts +8 -0
- package/views/dist/controls/text-editor/tokens.js +2 -0
- package/views/dist/controls/text-editor.css +44 -2
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +1 -1
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +2 -2
- package/views/dist/controls/tooltip/tooltip.js +2 -1
- package/views/dist/editors/EditorPanel.js +1 -1
- package/views/dist/field-row/FieldRow.js +46 -15
- package/views/dist/field-row/editors/RowChipsEditor.js +3 -1
- package/views/dist/field-row/editors/RowDateEditor.js +3 -1
- package/views/dist/field-row/editors/RowNameEditor.js +3 -1
- package/views/dist/field-row/editors/RowPlaceEditor.js +4 -2
- package/views/dist/field-row/editors/RowRangeEditor.js +3 -1
- package/views/dist/field-row/editors/RowRelationEditor.js +5 -2
- package/views/dist/field-row/editors/RowSelectEditor.js +3 -1
- package/views/dist/field-row/editors/RowTextEditor.d.ts +7 -1
- package/views/dist/field-row/editors/RowTextEditor.js +25 -4
- package/views/dist/field-row/editors/RowValueListEditor.js +4 -4
- package/views/dist/field-row/editors/row-place.d.ts +33 -0
- package/views/dist/field-row/editors/row-place.js +141 -0
- package/views/dist/field-row/field-row-button.d.ts +21 -6
- package/views/dist/field-row/field-row-button.js +8 -3
- package/views/dist/field-row/row-target.d.ts +4 -1
- package/views/dist/field-row/row-target.js +1 -1
- package/views/dist/fields/binding.d.ts +4 -0
- package/views/dist/grid/chrome/GridAggregateMenu.d.ts +12 -11
- package/views/dist/grid/chrome/GridAggregateMenu.js +4 -3
- package/views/dist/grid/chrome/GridCellEditors.d.ts +1 -1
- package/views/dist/grid/chrome/GridCellOutline.d.ts +13 -1
- package/views/dist/grid/chrome/GridCellOutline.js +17 -0
- package/views/dist/grid/chrome/GridFooter.d.ts +12 -4
- package/views/dist/grid/chrome/GridFooter.js +11 -9
- package/views/dist/grid/chrome/GridHeader.js +4 -3
- package/views/dist/grid/chrome/GridNumberEditor.js +2 -1
- package/views/dist/grid/chrome/GridResizeHandle.d.ts +7 -3
- package/views/dist/grid/chrome/GridResizeHandle.js +2 -3
- package/views/dist/grid/chrome/GridRowCells.js +1 -1
- package/views/dist/grid/chrome/GridStructure.js +3 -3
- package/views/dist/grid/chrome/GridTable.js +1 -1
- package/views/dist/grid/chrome/GridTableSurface.js +1 -1
- package/views/dist/grid/chrome/GridTextEditor.js +3 -1
- package/views/dist/grid/chrome/grid-body-place.d.ts +2 -4
- package/views/dist/grid/chrome/grid-body-place.js +4 -4
- package/views/dist/grid/chrome/grid-edit-session.d.ts +7 -3
- package/views/dist/grid/chrome/grid-edit-session.js +12 -3
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -4
- package/views/dist/grid/chrome/grid-figure-value.js +10 -4
- package/views/dist/grid/chrome/grid-row-props.d.ts +1 -1
- package/views/dist/grid/chrome/grid-table-props.d.ts +11 -3
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +5 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +9 -5
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -1
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +8 -3
- package/views/dist/grid/grid.css +7 -3
- package/views/dist/internal/length.d.ts +2 -0
- package/views/dist/internal/length.js +16 -0
- package/views/dist/internal/over-cell.d.ts +8 -0
- package/views/dist/internal/over-cell.js +5 -0
- package/views/dist/list/bar-keys.d.ts +5 -0
- package/views/dist/list/bar-keys.js +2 -0
- package/views/dist/list/bar-parts.d.ts +27 -0
- package/views/dist/list/bar-parts.js +38 -0
- package/views/dist/list/buttons/clear-save.d.ts +7 -0
- package/views/dist/list/buttons/clear-save.js +15 -0
- package/views/dist/list/buttons/customize.d.ts +28 -0
- package/views/dist/list/buttons/customize.js +31 -0
- package/views/dist/list/buttons/filter.d.ts +32 -0
- package/views/dist/list/buttons/filter.js +60 -0
- package/views/dist/list/buttons/new.d.ts +18 -0
- package/views/dist/list/buttons/new.js +9 -0
- package/views/dist/list/buttons/quick.d.ts +15 -0
- package/views/dist/list/buttons/quick.js +24 -0
- package/views/dist/list/buttons/search.d.ts +18 -0
- package/views/dist/list/buttons/search.js +17 -0
- package/views/dist/list/buttons/shared.d.ts +91 -0
- package/views/dist/list/buttons/shared.js +131 -0
- package/views/dist/list/buttons/sort-filter.d.ts +6 -0
- package/views/dist/list/buttons/sort-filter.js +16 -0
- package/views/dist/list/buttons/sort.d.ts +17 -0
- package/views/dist/list/buttons/sort.js +34 -0
- package/views/dist/list/buttons/views.d.ts +21 -0
- package/views/dist/list/buttons/views.js +36 -0
- package/views/dist/list/editor-menus.d.ts +13 -0
- package/views/dist/list/editor-menus.js +13 -0
- package/views/dist/list/index.d.ts +41 -0
- package/views/dist/list/index.js +19 -0
- package/views/dist/list/line.d.ts +55 -0
- package/views/dist/list/line.js +221 -0
- package/views/dist/list/pane-box.d.ts +6 -0
- package/views/dist/list/pane-box.js +15 -0
- package/views/dist/list/panels/customize.d.ts +8 -0
- package/views/dist/list/panels/customize.js +23 -0
- package/views/dist/list/panels/filter-bar.d.ts +12 -0
- package/views/dist/list/panels/filter-bar.js +67 -0
- package/views/dist/list/panels/filter.d.ts +8 -0
- package/views/dist/list/panels/filter.js +23 -0
- package/views/dist/list/panels/quick.d.ts +7 -0
- package/views/dist/list/panels/quick.js +16 -0
- package/views/dist/list/panels/shared.d.ts +25 -0
- package/views/dist/list/panels/shared.js +33 -0
- package/views/dist/list/panels/sort.d.ts +8 -0
- package/views/dist/list/panels/sort.js +19 -0
- package/views/dist/list/panels/views.d.ts +13 -0
- package/views/dist/list/panels/views.js +27 -0
- package/views/dist/list/ready.d.ts +35 -0
- package/views/dist/list/ready.js +7 -0
- package/views/dist/list/root-base.d.ts +17 -0
- package/views/dist/list/root-base.js +9 -1
- package/views/dist/list/root.js +2 -2
- package/views/dist/list/store.d.ts +19 -0
- package/views/dist/list/store.js +40 -1
- package/views/dist/list/toolbar-model.d.ts +95 -0
- package/views/dist/list/toolbar-model.js +177 -0
- package/views/dist/list/toolbar.js +140 -328
- package/views/dist/list/views-axis.js +15 -4
- package/views/dist/model/aggregates.d.ts +18 -8
- package/views/dist/model/aggregates.js +16 -22
- package/views/dist/panels/react/filter/FilterEditor.d.ts +3 -1
- package/views/dist/panels/react/filter/FilterEditor.js +2 -2
- package/views/dist/panels/react/filter/filter-body.d.ts +3 -1
- package/views/dist/panels/react/filter/filter-body.js +2 -2
- package/views/dist/panels/react/sort/SortEditor.d.ts +3 -1
- package/views/dist/panels/react/sort/SortEditor.js +4 -4
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +80 -3
- package/views/dist/panels/react/toolbar/Toolbar.js +85 -52
- package/views/dist/panels/react/toolbar/ToolbarBarSorts.d.ts +9 -0
- package/views/dist/panels/react/toolbar/ToolbarBarSorts.js +57 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +30 -0
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -1
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +5 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
- package/views/dist/panels/react/toolbar/ToolbarViews.d.ts +7 -1
- package/views/dist/panels/react/toolbar/ToolbarViews.js +4 -4
- package/views/dist/panels/react/toolbar/sheet-host.d.ts +3 -0
- package/views/dist/panels/react/toolbar/sheet-host.js +6 -0
- package/views/dist/panels/react/toolbar/use-give-way.d.ts +6 -0
- package/views/dist/panels/react/toolbar/use-give-way.js +8 -1
- package/views/dist/panels/react/views-row/ViewPicker.d.ts +8 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +12 -7
- package/views/dist/panels/settings/filter-groups.js +7 -0
- package/views/dist/provider/components.d.ts +38 -3
- package/views/dist/react.d.ts +1 -1
- package/views/dist/selection/bar-overflow.d.ts +2 -0
- package/views/dist/selection/bar-overflow.js +2 -1
- package/views/dist/selection/bar-props.d.ts +1 -1
- package/views/dist/selection/verbs.d.ts +2 -2
- package/views/dist/styles.css +268 -5
- package/views/dist/styles.unlayered.css +268 -5
- package/views/docs/contract.md +29 -15
- package/views/docs/controls/field.md +1 -0
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/menu.md +1 -1
- package/views/docs/controls/number-editor.md +2 -0
- package/views/docs/controls/sort-editor.md +1 -1
- package/views/docs/controls/text-editor.md +2 -0
- package/views/docs/guides/atoms.md +1 -0
- package/views/docs/guides/selection.md +1 -1
- package/views/docs/guides/the-grid.md +3 -3
- package/views/docs/reference/controls.md +3 -3
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +4 -4
- package/views/docs/reference/list.md +168 -6
- package/views/docs/reference/looks.md +1 -1
- package/views/docs/reference/panels-react.md +7 -7
- package/views/docs/reference/react.md +13 -10
- package/views/docs/reference/selection.md +1 -1
- package/views/docs/reference/views.md +9 -7
- package/views/skills/views/SKILL.md +2 -1
package/views/dist/grid/grid.css
CHANGED
|
@@ -197,20 +197,24 @@
|
|
|
197
197
|
margin-inline-start: calc(var(--vk-spacing) * -1);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
/* Figures, Value first (Attio's): the footer's value, then its word in lower case, "13 count",
|
|
201
|
-
"+ Add calculation"
|
|
202
|
-
(vk-grid-figure-*). Word first is the grid's own: the word in capitals
|
|
200
|
+
/* Figures, Value first (Attio's): the footer's value, then its word in lower case, "13 count", both at the rows' size, and
|
|
201
|
+
an empty cell's offer "+ Add calculation" at the rows' size, regular, in the subtlest words, its words the app's message
|
|
202
|
+
(views.grid.figure-pick), its "+" drawn here (vk-grid-figure-*). Word first is the grid's own: the word in 10px capitals
|
|
203
|
+
before the value, "ADD CALCULATION". */
|
|
203
204
|
[data-grid-figures="value"] [data-slot="vk-grid-figure-value"] {
|
|
204
205
|
order: -1;
|
|
205
206
|
color: var(--vk-fg);
|
|
206
207
|
font-weight: var(--vk-font-weight-medium);
|
|
207
208
|
}
|
|
208
209
|
[data-grid-figures="value"] [data-slot="vk-grid-figure-label"] {
|
|
210
|
+
font-size: var(--vk-text);
|
|
209
211
|
text-transform: lowercase;
|
|
210
212
|
letter-spacing: normal;
|
|
211
213
|
color: var(--vk-fg-subtlest);
|
|
212
214
|
}
|
|
213
215
|
[data-grid-figures="value"] [data-slot="vk-grid-figure-pick"] {
|
|
216
|
+
font-size: var(--vk-text);
|
|
217
|
+
color: var(--vk-fg-subtlest);
|
|
214
218
|
text-transform: none;
|
|
215
219
|
letter-spacing: normal;
|
|
216
220
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function lengthPx(el, prop) {
|
|
2
|
+
if (!el || typeof getComputedStyle === "undefined")
|
|
3
|
+
return 0;
|
|
4
|
+
const value = getComputedStyle(el).getPropertyValue(prop).trim();
|
|
5
|
+
if (!value)
|
|
6
|
+
return 0;
|
|
7
|
+
if (/^-?(\d+\.?\d*|\.\d+)(px)?$/.test(value))
|
|
8
|
+
return parseFloat(value);
|
|
9
|
+
const probe = el.ownerDocument.createElement("span");
|
|
10
|
+
probe.style.cssText = "position:absolute;visibility:hidden;pointer-events:none";
|
|
11
|
+
probe.style.setProperty("outline-offset", value);
|
|
12
|
+
el.appendChild(probe);
|
|
13
|
+
const px = parseFloat(getComputedStyle(probe).outlineOffset);
|
|
14
|
+
probe.remove();
|
|
15
|
+
return Number.isFinite(px) ? px : 0;
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The offsets a popover anchored to a box opens at over it. */
|
|
2
|
+
export type OverOffsets = {
|
|
3
|
+
sideOffset: number;
|
|
4
|
+
alignOffset: number;
|
|
5
|
+
};
|
|
6
|
+
/** Over the element's box, one spacing step up and one step left of it: minus its height and a step, minus a step. A step is
|
|
7
|
+
* 0 where no stylesheet declares one. */
|
|
8
|
+
export declare function overCellOffsets(el: HTMLElement): OverOffsets;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** What a placed filter bar places under the root besides `bar` (not on the door): its own, so the ready toolbar leaves it the filters. */
|
|
2
|
+
export declare const FILTER_BAR_KEY = "list-filter-bar";
|
|
3
|
+
/** What a placed filter bar standing by its button places too (not on the door), so a button's `opens="bar"` asks it open (VK-1092), and a rule
|
|
4
|
+
* held while it is hidden opens it (VK-1106). */
|
|
5
|
+
export declare const FILTER_BAR_BUTTON_KEY = "list-filter-bar-button";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ToolbarPanelHost } from "../panels/react/toolbar/panel-part.js";
|
|
3
|
+
import type { ToolbarPanelState } from "../panels/react/toolbar/panel-state.js";
|
|
4
|
+
import type { ListPart } from "./parts.js";
|
|
5
|
+
import type { ToolbarModel } from "./toolbar-model.js";
|
|
6
|
+
export { FILTER_BAR_BUTTON_KEY, FILTER_BAR_KEY } from "./bar-keys.js";
|
|
7
|
+
/** What the filter bar's pieces are built from: the model's, the bar's two panel states, and how it stands. */
|
|
8
|
+
export type FilterBarInput<Row> = Pick<ToolbarModel<Row>, "panels" | "differs" | "held" | "setHeld" | "savedFilter"> & {
|
|
9
|
+
/** It stands always (`bar: "always"`, `shows="always"`): every filter, its empty Filter, the sort standing undiffering. */
|
|
10
|
+
always: boolean;
|
|
11
|
+
/** The sort as the pill (`no`, today's) or its rules edited in place (`yes`; without `panels.sorts`, as `no`). */
|
|
12
|
+
sorts: "no" | "yes";
|
|
13
|
+
sortState: ToolbarPanelState;
|
|
14
|
+
filterState: ToolbarPanelState;
|
|
15
|
+
hosts?: {
|
|
16
|
+
sort?: ToolbarPanelHost;
|
|
17
|
+
filter?: ToolbarPanelHost;
|
|
18
|
+
};
|
|
19
|
+
/** Draws `yes`'s rules (`ToolbarBarSorts`), handed by the placed bar so the ready toolbar never loads it. */
|
|
20
|
+
barSorts?: (sorts: NonNullable<ToolbarModel<Row>["panels"]["sorts"]>, state: ToolbarPanelState) => ReactNode;
|
|
21
|
+
};
|
|
22
|
+
/** The filter bar's pieces as line parts, and whether they hold something (`filled`): a filter standing beyond the saved
|
|
23
|
+
* view's own or a rule held, or its sort part drawn. */
|
|
24
|
+
export declare function filterBarParts<Row>(input: FilterBarInput<Row>): {
|
|
25
|
+
parts: ListPart[];
|
|
26
|
+
holds: boolean;
|
|
27
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { heldStands } from "../panels/react/filter/editor-ctx.js";
|
|
4
|
+
import { ToolbarSeparator } from "../panels/react/toolbar/Toolbar.js";
|
|
5
|
+
import { ToolbarFilters, foldableFilters } from "../panels/react/toolbar/ToolbarFilters.js";
|
|
6
|
+
import { ToolbarSort } from "../panels/react/toolbar/ToolbarSort.js";
|
|
7
|
+
import { ToolbarSortPill } from "../panels/react/toolbar/ToolbarSortPill.js";
|
|
8
|
+
export { FILTER_BAR_BUTTON_KEY, FILTER_BAR_KEY } from "./bar-keys.js";
|
|
9
|
+
export function filterBarParts(input) {
|
|
10
|
+
const { panels, differs, held, setHeld, savedFilter, always, sortState, filterState, hosts } = input;
|
|
11
|
+
const tree = panels.filterTree;
|
|
12
|
+
const filtered = tree ? foldableFilters(tree.tree, null, savedFilter) > 0 || !!heldStands(held, tree.tree) : false;
|
|
13
|
+
const rules = input.sorts === "yes" && panels.sorts && input.barSorts ? panels.sorts : null;
|
|
14
|
+
const sort = rules
|
|
15
|
+
? rules.options.length > 0 && (always || rules.rules.length > 0)
|
|
16
|
+
? input.barSorts(rules, sortState)
|
|
17
|
+
: null
|
|
18
|
+
: (always || !!differs?.sort) && (panels.sorts ?? panels.sort).options.length > 0
|
|
19
|
+
? panels.sorts
|
|
20
|
+
? (_jsx(ToolbarSortPill, { sorts: panels.sorts, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort, addAfter: false }))
|
|
21
|
+
: _jsx(ToolbarSort, { bar: true, sort: panels.sort, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort })
|
|
22
|
+
: null;
|
|
23
|
+
const parts = [
|
|
24
|
+
...(sort ? [{ key: "sort-pill", line: 2, node: sort }] : []),
|
|
25
|
+
...(sort && (filtered || always) ? [{ key: "sep", line: 2, role: "separator", node: _jsx(ToolbarSeparator, {}) }] : []),
|
|
26
|
+
...(tree
|
|
27
|
+
? [
|
|
28
|
+
{
|
|
29
|
+
key: "filters",
|
|
30
|
+
line: 2,
|
|
31
|
+
filters: foldableFilters(tree.tree, held, always ? undefined : savedFilter),
|
|
32
|
+
node: (_jsx(ToolbarFilters, { filterTree: tree, open: filterState.open, onOpenChange: filterState.onOpenChange, held: held, onHeldChange: setHeld, host: hosts?.filter, emptyPlace: always, ...(!always && savedFilter && { saved: savedFilter }) })),
|
|
33
|
+
},
|
|
34
|
+
]
|
|
35
|
+
: []),
|
|
36
|
+
];
|
|
37
|
+
return { parts, holds: filtered || !!sort };
|
|
38
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type ListClearSaveProps = Record<string, never>;
|
|
3
|
+
export declare function ListClearSave(_props: ListClearSaveProps): ReactNode;
|
|
4
|
+
/** Clear and Save in a line (not on the door, VK-1105): as the ready bar's, never folding. */
|
|
5
|
+
export declare const SAVE_ITEM: {
|
|
6
|
+
readonly key: "save";
|
|
7
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import { ToolbarSave } from "../../panels/react/toolbar/ToolbarSave.js";
|
|
5
|
+
import { useToolbarModel } from "../toolbar-model.js";
|
|
6
|
+
import { LineItem } from "../line.js";
|
|
7
|
+
import { ReadyPiece } from "../ready.js";
|
|
8
|
+
import { usePartPhone } from "./shared.js";
|
|
9
|
+
export function ListClearSave(_props) {
|
|
10
|
+
const { view, layered, clearable, resetAll } = useToolbarModel({ phone: usePartPhone(), fromRoot: true });
|
|
11
|
+
const piece = useContext(ReadyPiece);
|
|
12
|
+
const only = piece === "clear" || piece === "save" ? piece : undefined;
|
|
13
|
+
return (_jsx(LineItem, { item: SAVE_ITEM, children: _jsx(ToolbarSave, { view: view, layered: layered, onClear: clearable ? resetAll : undefined, ...(only && { only }) }) }));
|
|
14
|
+
}
|
|
15
|
+
export const SAVE_ITEM = { key: "save" };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { PanelFieldEditor } from "../../panels/react/field-editor.js";
|
|
3
|
+
import type { ViewsCustomizeItems } from "../../provider/components.js";
|
|
4
|
+
import { type ListOpens, type ListWords } from "./shared.js";
|
|
5
|
+
export type ListCustomizeProps = {
|
|
6
|
+
/** Where its panel opens. Default `popover`. */
|
|
7
|
+
opens?: ListOpens;
|
|
8
|
+
words?: ListWords;
|
|
9
|
+
/** The view's name in Customize's head, renamed in place where `onRenameView` is handed too. */
|
|
10
|
+
viewName?: string;
|
|
11
|
+
onRenameView?: (name: string) => void;
|
|
12
|
+
/** Copy link to view, in Customize's foot, where handed. */
|
|
13
|
+
onCopyLink?: () => void;
|
|
14
|
+
/** Export CSV, in Customize's foot, where handed, with what it takes in words (`exportCount`, "12 deals"). */
|
|
15
|
+
onExport?: () => void;
|
|
16
|
+
exportCount?: string;
|
|
17
|
+
fieldEditor?: PanelFieldEditor | null;
|
|
18
|
+
/** Customize's rows as data (as the ready toolbar's `menus.customize`): handed its list's, Layout's and Columns' default rows, it
|
|
19
|
+
* hands back the rows drawn. */
|
|
20
|
+
menu?: ViewsCustomizeItems;
|
|
21
|
+
};
|
|
22
|
+
export declare function ListCustomize({ opens, words, viewName, onRenameView, onCopyLink, onExport, exportCount, fieldEditor, menu }: ListCustomizeProps): ReactNode;
|
|
23
|
+
/** Customize in a line (not on the door, VK-1105): its word, then into ⋯. */
|
|
24
|
+
export declare const CUSTOMIZE_ITEM: {
|
|
25
|
+
readonly key: "options";
|
|
26
|
+
readonly shed: true;
|
|
27
|
+
readonly fold: true;
|
|
28
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ToolbarOptions } from "../../panels/react/toolbar/ToolbarOptions.js";
|
|
4
|
+
import { useViews } from "../../provider/context.js";
|
|
5
|
+
import { LineItem, useLineMore } from "../line.js";
|
|
6
|
+
import { useReadyParts } from "../ready.js";
|
|
7
|
+
import { PartFrame, PlacedButton, PressButton, menuPress, usePartPanel, usePlacedPanel } from "./shared.js";
|
|
8
|
+
export function ListCustomize({ opens, words, viewName, onRenameView, onCopyLink, onExport, exportCount, fieldEditor, menu }) {
|
|
9
|
+
const { icons, messages } = useViews();
|
|
10
|
+
const panel = usePartPanel("ListCustomize", "customize", opens);
|
|
11
|
+
const placed = usePlacedPanel("customize");
|
|
12
|
+
const more = useLineMore();
|
|
13
|
+
const ready = useReadyParts();
|
|
14
|
+
const { fielded, state, host, press } = panel;
|
|
15
|
+
const { inputs, view, layered, clearable, resetAll, resets } = panel.model;
|
|
16
|
+
if (!fielded)
|
|
17
|
+
return null;
|
|
18
|
+
const Glyph = icons.options;
|
|
19
|
+
const item = {
|
|
20
|
+
...CUSTOMIZE_ITEM,
|
|
21
|
+
menu: { label: messages({ key: "views.panels.toolbar-options" }), icon: _jsx(Glyph, { className: "h-4 w-4" }), onSelect: menuPress(placed, press, more, state) },
|
|
22
|
+
};
|
|
23
|
+
const line = (node) => _jsx(LineItem, { item: item, children: node });
|
|
24
|
+
if (placed.placed)
|
|
25
|
+
return line(_jsx(PartFrame, { panel: panel, words: words, children: _jsx(PlacedButton, { part: "options", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: messages({ key: "views.panels.toolbar-options" }), panel: placed }) }));
|
|
26
|
+
if (press)
|
|
27
|
+
return line(_jsx(PartFrame, { panel: panel, words: words, children: _jsx(PressButton, { part: "options", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: messages({ key: "views.panels.toolbar-options" }), onPress: press }) }));
|
|
28
|
+
const foot = ready?.customizeFoot ?? "parts";
|
|
29
|
+
return line(_jsx(PartFrame, { panel: panel, words: words, children: _jsx(ToolbarOptions, { ...inputs, view: view, ...(layered && { layered }), viewFoot: foot === "none" ? "none" : foot === "own" || view ? undefined : "kit", footClear: foot === "parts" && clearable ? resetAll : undefined, resets: resets, customizeItems: menu, fieldEditor: fieldEditor, onClear: resetAll, open: state.open, onOpenChange: state.onOpenChange, page: state.page, onPageChange: state.onPageChange, host: host, ...(viewName !== undefined && { viewName }), ...(onRenameView && { onRenameView }), ...(onCopyLink && { onCopyLink }), ...(onExport && { onExport }), ...(exportCount !== undefined && { exportCount }) }) }));
|
|
30
|
+
}
|
|
31
|
+
export const CUSTOMIZE_ITEM = { key: "options", shed: true, fold: true };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type Pending } from "../../panels/react/filter/editor-ctx.js";
|
|
3
|
+
import type { FilterTree } from "viewkitjs/fields/query";
|
|
4
|
+
import { type ReadyParts } from "../ready.js";
|
|
5
|
+
import { type ListOpens, type ListWords } from "./shared.js";
|
|
6
|
+
export type ListFilterProps = {
|
|
7
|
+
/** Where its panel opens; `bar`: a picked field's filter stands on the filter bar, where one is placed. Default `popover`. */
|
|
8
|
+
opens?: ListOpens | "bar";
|
|
9
|
+
/** What it opens with no filter set: the fields (`fields`, the default), or the filter editor saying so (`editor`). Means
|
|
10
|
+
* nothing with `opens="bar"` (the fields every time), on a phone, or without and/or groups (`filterGroups` false). */
|
|
11
|
+
empty?: "fields" | "editor";
|
|
12
|
+
words?: ListWords;
|
|
13
|
+
};
|
|
14
|
+
export declare function ListFilter({ opens, empty, words }: ListFilterProps): ReactNode;
|
|
15
|
+
/** Filter in a line (not on the door, VK-1105): its word, then into ⋯; its key by `filterItemKey`. */
|
|
16
|
+
export declare const FILTER_ITEM: {
|
|
17
|
+
readonly shed: true;
|
|
18
|
+
readonly fold: true;
|
|
19
|
+
};
|
|
20
|
+
/** Filter's key in a line (not on the door, VK-1106): the bar form's filters `filters`; plain Filter `filter`; else, a placed
|
|
21
|
+
* Filter's, `filter-add` with and/or groups on a computer, `filter` otherwise. */
|
|
22
|
+
export declare function filterItemKey(ready: ReadyParts["filter"] | undefined, tree: boolean, phone: boolean): "filter-add" | "filter" | "filters";
|
|
23
|
+
/** The bar form's filters in a line (not on the door, VK-1106): each filter folding into "+N filters"; while none stands or is
|
|
24
|
+
* held, Filter, whose words may turn to its icon and which may fold into ⋯. */
|
|
25
|
+
export declare function barFiltersItem(tree: FilterTree, held: Pending | null): {
|
|
26
|
+
shed?: true;
|
|
27
|
+
fold?: true;
|
|
28
|
+
filters?: number;
|
|
29
|
+
};
|
|
30
|
+
/** The and/or filters' pill (not on the door, VK-1106): each advanced filter's pill, opening the filter editor, in the ready
|
|
31
|
+
* toolbar after its Filter until the bar takes them; nothing without the groups. */
|
|
32
|
+
export declare function ListAdvancedFilters(): ReactNode;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { barItemsOf } from "../../filters/filter-tree.js";
|
|
4
|
+
import { heldStands } from "../../panels/react/filter/editor-ctx.js";
|
|
5
|
+
import { ToolbarAdvancedFilters } from "../../panels/react/toolbar/ToolbarAdvancedFilters.js";
|
|
6
|
+
import { ToolbarFilter } from "../../panels/react/toolbar/ToolbarFilter.js";
|
|
7
|
+
import { ToolbarFilterAdd } from "../../panels/react/toolbar/ToolbarFilterAdd.js";
|
|
8
|
+
import { ToolbarFilters, foldableFilters } from "../../panels/react/toolbar/ToolbarFilters.js";
|
|
9
|
+
import { useViews } from "../../provider/context.js";
|
|
10
|
+
import { LineItem, useLineMore } from "../line.js";
|
|
11
|
+
import { useReadyParts } from "../ready.js";
|
|
12
|
+
import { useToolbarModel } from "../toolbar-model.js";
|
|
13
|
+
import { PartFrame, PlacedButton, PressButton, menuPress, usePartPanel, usePartPhone, usePlacedPanel } from "./shared.js";
|
|
14
|
+
export function ListFilter({ opens, empty, words }) {
|
|
15
|
+
const { icons, messages } = useViews();
|
|
16
|
+
const panel = usePartPanel("ListFilter", "filter", opens);
|
|
17
|
+
const placed = usePlacedPanel("filter");
|
|
18
|
+
const more = useLineMore();
|
|
19
|
+
const ready = useReadyParts();
|
|
20
|
+
const { phone, fielded, model, state, host, press, bar } = panel;
|
|
21
|
+
const { panels, differs, clear, held, setHeld } = model;
|
|
22
|
+
if (!fielded)
|
|
23
|
+
return null;
|
|
24
|
+
const tree = panels.filterTree;
|
|
25
|
+
const Glyph = icons.filter;
|
|
26
|
+
const menu = { label: messages({ key: "views.panels.filter" }), icon: _jsx(Glyph, { className: "h-4 w-4" }), onSelect: menuPress(placed, press, more, state) };
|
|
27
|
+
if (ready?.filter === "bar" && tree) {
|
|
28
|
+
const flags = barFiltersItem(tree.tree, held);
|
|
29
|
+
return (_jsx(LineItem, { item: { key: filterItemKey("bar", true, phone), ...flags, ...(flags.fold && { menu }) }, children: _jsx(ToolbarFilters, { filterTree: tree, open: state.open, onOpenChange: state.onOpenChange, held: held, onHeldChange: setHeld, host: host }) }));
|
|
30
|
+
}
|
|
31
|
+
const item = { key: filterItemKey(ready?.filter, !!tree, phone), ...FILTER_ITEM, menu };
|
|
32
|
+
const adds = !!tree && !phone && ready?.filter !== "plain";
|
|
33
|
+
const line = (node) => _jsx(LineItem, { item: item, children: node });
|
|
34
|
+
const form = phone ? { form: "phone" } : {};
|
|
35
|
+
if (placed.placed)
|
|
36
|
+
return line(_jsx(PartFrame, { panel: panel, words: words, ...form, children: _jsx(PlacedButton, { part: "filter-add", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: messages({ key: "views.panels.filter" }), changed: !!differs?.filter, panel: placed }) }));
|
|
37
|
+
if (press)
|
|
38
|
+
return line(_jsx(PartFrame, { panel: panel, words: words, ...form, children: _jsx(PressButton, { part: "filter-add", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: messages({ key: "views.panels.filter" }), changed: !!differs?.filter, onPress: press }) }));
|
|
39
|
+
return line(_jsx(PartFrame, { panel: panel, words: words, ...form, children: adds ? (_jsx(ToolbarFilterAdd, { filterTree: tree, onHeldChange: setHeld, open: state.open, onOpenChange: state.onOpenChange, host: host, changed: !!differs?.filter, opens: bar ? "fields" : "filters", ...(empty && !bar && { empty }) })) : (_jsx(ToolbarFilter, { filters: panels.filters, filterTree: tree, onClear: clear("filters"), open: state.open, onOpenChange: state.onOpenChange, page: state.page, onPageChange: state.onPageChange, host: host })) }));
|
|
40
|
+
}
|
|
41
|
+
export const FILTER_ITEM = { shed: true, fold: true };
|
|
42
|
+
export function filterItemKey(ready, tree, phone) {
|
|
43
|
+
if (ready === "bar")
|
|
44
|
+
return tree ? "filters" : "filter";
|
|
45
|
+
if (ready === "plain")
|
|
46
|
+
return "filter";
|
|
47
|
+
return tree && !phone ? "filter-add" : "filter";
|
|
48
|
+
}
|
|
49
|
+
export function barFiltersItem(tree, held) {
|
|
50
|
+
return barItemsOf(tree).length === 0 && !heldStands(held, tree) ? { shed: true, fold: true } : { filters: foldableFilters(tree, held) };
|
|
51
|
+
}
|
|
52
|
+
export function ListAdvancedFilters() {
|
|
53
|
+
const ready = useReadyParts();
|
|
54
|
+
const { panels } = useToolbarModel({ phone: usePartPhone(), fromRoot: true });
|
|
55
|
+
const tree = panels.filterTree;
|
|
56
|
+
if (!tree)
|
|
57
|
+
return null;
|
|
58
|
+
return (_jsx(LineItem, { item: ADVANCED_ITEM, children: _jsx(ToolbarAdvancedFilters, { filterTree: tree, host: ready?.hosts.filter }) }));
|
|
59
|
+
}
|
|
60
|
+
const ADVANCED_ITEM = { key: "advanced-filters" };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ViewsMenuItem } from "../../provider/components.js";
|
|
3
|
+
import { type ListWords } from "./shared.js";
|
|
4
|
+
export type ListNewProps = {
|
|
5
|
+
/** One way to add: New fires it. */
|
|
6
|
+
onAdd?: () => void;
|
|
7
|
+
/** Several ways to add: New opens them as a menu. */
|
|
8
|
+
items?: ViewsMenuItem[];
|
|
9
|
+
/** Default `views.panels.toolbar-new`. */
|
|
10
|
+
label?: string;
|
|
11
|
+
words?: ListWords;
|
|
12
|
+
};
|
|
13
|
+
export declare function ListNew({ onAdd, items, label, words }: ListNewProps): ReactNode;
|
|
14
|
+
/** New in a line (not on the door, VK-1105): its word as the line narrows. */
|
|
15
|
+
export declare const NEW_ITEM: {
|
|
16
|
+
readonly key: "new";
|
|
17
|
+
readonly shed: true;
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ToolbarNew } from "../../panels/react/toolbar/ToolbarNew.js";
|
|
4
|
+
import { LineItem } from "../line.js";
|
|
5
|
+
import { PartSlot } from "./shared.js";
|
|
6
|
+
export function ListNew({ onAdd, items, label, words }) {
|
|
7
|
+
return (_jsx(LineItem, { item: NEW_ITEM, children: _jsx(PartSlot, { words: words, children: _jsx(ToolbarNew, { onAdd: onAdd, items: items, label: label }) }) }));
|
|
8
|
+
}
|
|
9
|
+
export const NEW_ITEM = { key: "new", shed: true };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type ListOpens, type ListWords } from "./shared.js";
|
|
3
|
+
export type ListQuickFiltersProps = {
|
|
4
|
+
/** Where its panel opens. Default `popover`. */
|
|
5
|
+
opens?: ListOpens;
|
|
6
|
+
/** Default `icon`. */
|
|
7
|
+
words?: ListWords;
|
|
8
|
+
};
|
|
9
|
+
export declare function ListQuickFilters({ opens, words }: ListQuickFiltersProps): ReactNode;
|
|
10
|
+
/** The quick filters in a line (not on the door, VK-1105): into ⋯. */
|
|
11
|
+
export declare const QUICK_ITEM: {
|
|
12
|
+
readonly key: "quick";
|
|
13
|
+
readonly shed: true;
|
|
14
|
+
readonly fold: true;
|
|
15
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ToolbarQuickFilters } from "../../panels/react/toolbar/ToolbarQuickFilters.js";
|
|
4
|
+
import { useViews } from "../../provider/context.js";
|
|
5
|
+
import { LineItem, useLineMore } from "../line.js";
|
|
6
|
+
import { useReadyParts } from "../ready.js";
|
|
7
|
+
import { PartFrame, PlacedButton, PressButton, menuPress, usePartPanel, usePlacedPanel } from "./shared.js";
|
|
8
|
+
export function ListQuickFilters({ opens, words }) {
|
|
9
|
+
const { icons, messages } = useViews();
|
|
10
|
+
const panel = usePartPanel("ListQuickFilters", "quick", opens);
|
|
11
|
+
const placed = usePlacedPanel("quick");
|
|
12
|
+
const more = useLineMore();
|
|
13
|
+
const ready = useReadyParts();
|
|
14
|
+
const { quick } = panel.model;
|
|
15
|
+
if (!quick)
|
|
16
|
+
return null;
|
|
17
|
+
const worded = words === "both" || words === "word" || ready?.quickWord === "own";
|
|
18
|
+
const state = ready?.quickState ?? panel.state;
|
|
19
|
+
const Glyph = icons.filterCategory;
|
|
20
|
+
const label = quick.label ?? messages({ key: "views.panels.quick-filters" });
|
|
21
|
+
const item = { ...QUICK_ITEM, menu: { label, icon: _jsx(Glyph, { className: "h-4 w-4" }), onSelect: menuPress(placed, panel.press, more, state) } };
|
|
22
|
+
return (_jsx(LineItem, { item: item, children: _jsx(PartFrame, { panel: panel, words: words, children: placed.placed ? (_jsx(PlacedButton, { part: "quick", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: quick.label ?? messages({ key: "views.panels.quick-filters" }), ...(!worded && { word: null }), panel: placed })) : panel.press ? (_jsx(PressButton, { part: "quick", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: quick.label ?? messages({ key: "views.panels.quick-filters" }), ...(!worded && { word: null }), onPress: panel.press })) : (_jsx(ToolbarQuickFilters, { quickFilters: quick, open: state.open, onOpenChange: state.onOpenChange, host: panel.host, ...(!worded && { word: null }) })) }) }));
|
|
23
|
+
}
|
|
24
|
+
export const QUICK_ITEM = { key: "quick", shed: true, fold: true };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type ListWords } from "./shared.js";
|
|
3
|
+
export type ListSearchProps = {
|
|
4
|
+
/** Default `views.panels.search`. */
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
/** The app's search is under way: a spinner where the glass is, the field still usable. */
|
|
7
|
+
searching?: boolean;
|
|
8
|
+
/** Default `icon`: the glass alone. */
|
|
9
|
+
words?: ListWords;
|
|
10
|
+
/** `button` (the default) opens a field; `input` stands as one. */
|
|
11
|
+
shows?: "button" | "input";
|
|
12
|
+
};
|
|
13
|
+
export declare function ListSearch({ placeholder, searching, words, shows }: ListSearchProps): ReactNode;
|
|
14
|
+
/** The search in a line (not on the door, VK-1105): the line's search. */
|
|
15
|
+
export declare const SEARCH_ITEM: {
|
|
16
|
+
readonly key: "search";
|
|
17
|
+
readonly role: "search";
|
|
18
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ToolbarSearch } from "../../panels/react/toolbar/ToolbarSearch.js";
|
|
4
|
+
import { useList } from "../root-base.js";
|
|
5
|
+
import { searchChange } from "../toolbar-model.js";
|
|
6
|
+
import { LineItem } from "../line.js";
|
|
7
|
+
import { PartSlot } from "./shared.js";
|
|
8
|
+
export function ListSearch({ placeholder, searching, words, shows }) {
|
|
9
|
+
const settings = useList((s) => s.view.settings);
|
|
10
|
+
const setSettings = useList((s) => s.setSettings);
|
|
11
|
+
return (_jsx(LineItem, { item: SEARCH_ITEM, children: _jsx(PartSlot, { words: words, ...(shows === "input" && { fill: true }), children: _jsx(ToolbarSearch, { value: settings.search ?? "", placeholder: placeholder, searching: searching, onChange: (next) => {
|
|
12
|
+
const change = searchChange(settings, next);
|
|
13
|
+
if (Object.keys(change).length > 0)
|
|
14
|
+
setSettings(change);
|
|
15
|
+
} }) }) }));
|
|
16
|
+
}
|
|
17
|
+
export const SEARCH_ITEM = { key: "search", role: "search" };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { type ReactNode, type RefObject } from "react";
|
|
2
|
+
import type { ViewsToolbarButtonPart } from "../../atoms/types.js";
|
|
3
|
+
import type { ToolbarPanelHost } from "../../panels/react/toolbar/panel-part.js";
|
|
4
|
+
import type { ToolbarPanelState } from "../../panels/react/toolbar/panel-state.js";
|
|
5
|
+
import { type ToolbarModel } from "../toolbar-model.js";
|
|
6
|
+
/** A placed button's words: its icon and its word, its icon alone, or its word alone. */
|
|
7
|
+
export type ListWords = "both" | "icon" | "word";
|
|
8
|
+
/** Where a placed button's panel opens: at its button (`popover`), in the map's Pane in the root's `ListPaneBox` (`pane`), in
|
|
9
|
+
* the map's Sheet on a computer (`sheet`; a phone's keeps its own), or nowhere: a function is the app's own, called with the
|
|
10
|
+
* button on a press. */
|
|
11
|
+
export type ListOpens = "popover" | "pane" | "sheet" | ((button: HTMLButtonElement) => void);
|
|
12
|
+
/** The parts that open a panel of their own, and the placed panels and filter bar (not on the door). */
|
|
13
|
+
export type PartKeyName = "sort" | "filter" | "customize" | "quick" | "views" | "barSort" | "barFilters";
|
|
14
|
+
/** The parts' own panel keys (not on the door). */
|
|
15
|
+
export declare const PART_KEYS: Readonly<Record<PartKeyName, string>>;
|
|
16
|
+
/** The panel keys the parts under it use, where they aren't their own (not on the door). */
|
|
17
|
+
export declare const PartKeys: import("react").Context<Partial<Record<PartKeyName, string>>>;
|
|
18
|
+
/** This part's panel key in the root's radio. */
|
|
19
|
+
export declare function usePartKey(name: PartKeyName): string;
|
|
20
|
+
/** A placed part stands on a phone: off the provider's desktop query; in the ready toolbar, its form's (VK-1106). */
|
|
21
|
+
export declare function usePartPhone(): boolean;
|
|
22
|
+
/** Lays `words` (and, for the search, `fill`; for a phone's sheet, `form`) over the slot the part stands in, keeping the rest
|
|
23
|
+
* of it, so a part inside the app's own frame keeps that frame's. Handed none, it adds nothing. */
|
|
24
|
+
export declare function PartSlot({ words, fill, form, children, }: {
|
|
25
|
+
words?: ListWords;
|
|
26
|
+
fill?: boolean;
|
|
27
|
+
form?: "phone";
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
}): ReactNode;
|
|
30
|
+
/** A panel part's root (VK-1091): whether the root holds a list's fields, what the toolbar works out from it, its panel's open
|
|
31
|
+
* state under its key, and where its panel opens: a host (`sheet`: the map's Sheet, on a computer; `pane`: the map's Pane
|
|
32
|
+
* in the root's `ListPaneBox`, where one stands and the map has a Pane, else the popover), the app's own press, or `bar`, a
|
|
33
|
+
* picked rule standing on the filter bar, where one is placed under the root (else the popover, said once in development). */
|
|
34
|
+
export type PartPanel<Row> = {
|
|
35
|
+
phone: boolean;
|
|
36
|
+
fielded: boolean;
|
|
37
|
+
model: ToolbarModel<Row>;
|
|
38
|
+
state: ToolbarPanelState;
|
|
39
|
+
host: ToolbarPanelHost | undefined;
|
|
40
|
+
/** The box the Pane stands in (null until one stands), handed where it opens in the Pane. */
|
|
41
|
+
paneBox: HTMLElement | null | undefined;
|
|
42
|
+
/** The app's own: what a press calls, ViewKit drawing the button alone. */
|
|
43
|
+
press: ((button: HTMLButtonElement) => void) | undefined;
|
|
44
|
+
/** A picked rule stands on the filter bar placed under the root. */
|
|
45
|
+
bar: boolean;
|
|
46
|
+
};
|
|
47
|
+
export declare function usePartPanel<Row>(part: string, name: PartKeyName, opens: ListOpens | "bar" | undefined): PartPanel<Row>;
|
|
48
|
+
/** A panel part's place: its words over its slot, and the Pane's box where its panel stands in the Pane. */
|
|
49
|
+
export declare function PartFrame({ panel, words, form, children, }: {
|
|
50
|
+
panel: Pick<PartPanel<unknown>, "paneBox">;
|
|
51
|
+
words?: ListWords;
|
|
52
|
+
form?: "phone";
|
|
53
|
+
children?: ReactNode;
|
|
54
|
+
}): ReactNode;
|
|
55
|
+
/** A placed button whose panel is the app's own (`opens` a function): ViewKit draws the button alone and calls the app with it
|
|
56
|
+
* on a press. */
|
|
57
|
+
export declare function PressButton({ part, icon, label, changed, word, onPress, }: {
|
|
58
|
+
part: ViewsToolbarButtonPart;
|
|
59
|
+
icon: ReactNode;
|
|
60
|
+
label: string;
|
|
61
|
+
changed?: boolean;
|
|
62
|
+
/** `null`: its icon alone, as the part's own button stands by default (the quick filters'). */
|
|
63
|
+
word?: null;
|
|
64
|
+
onPress: (button: HTMLButtonElement) => void;
|
|
65
|
+
}): ReactNode;
|
|
66
|
+
/** The id of a placed panel's region (VK-1092): `vk-list-<root id>-<key>`, so its button finds it to point to it. */
|
|
67
|
+
export declare function panelId(listId: string, key: string): string;
|
|
68
|
+
/** A button's placed panel (VK-1092): whether one is placed under its key, whether it stands, and the press that shows it,
|
|
69
|
+
* points to it, or hides it. */
|
|
70
|
+
export type PlacedPanel = {
|
|
71
|
+
placed: boolean;
|
|
72
|
+
stands: "alone" | "shown" | null;
|
|
73
|
+
press: () => void;
|
|
74
|
+
};
|
|
75
|
+
export declare function usePlacedPanel(name: PartKeyName): PlacedPanel;
|
|
76
|
+
/** A button whose panel is placed (VK-1092): no popover, `aria-expanded` while its panel stands, a press as
|
|
77
|
+
* `PlacedPanel.press`. */
|
|
78
|
+
export declare function PlacedButton({ part, icon, label, word, changed, panel, }: {
|
|
79
|
+
part: ViewsToolbarButtonPart;
|
|
80
|
+
icon: ReactNode;
|
|
81
|
+
label: string;
|
|
82
|
+
/** `null`: its icon alone, as the part's own button stands by default (the quick filters'). */
|
|
83
|
+
word?: null;
|
|
84
|
+
changed?: boolean;
|
|
85
|
+
panel: PlacedPanel;
|
|
86
|
+
}): ReactNode;
|
|
87
|
+
/** What a folded part's row in ⋯ does (VK-1105, not on the door): what its press does: its placed panel shown or pointed to, the
|
|
88
|
+
* app's own called with ⋯'s button, else its panel opened. */
|
|
89
|
+
export declare function menuPress(placed: Pick<PlacedPanel, "placed" | "press">, press: ((button: HTMLButtonElement) => void) | undefined, more: RefObject<HTMLButtonElement | null> | null, state: {
|
|
90
|
+
onOpenChange: (open: boolean) => void;
|
|
91
|
+
}): () => void;
|