viewkitjs 0.38.0 → 0.40.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 +134 -0
- package/MIGRATION.md +32 -0
- package/fields/dist/derived.d.ts +7 -0
- package/fields/dist/derived.js +4 -0
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/messages.d.ts +5 -1
- package/fields/dist/messages.js +3 -0
- package/fields/dist/query/evaluate.d.ts +7 -1
- package/fields/dist/query/evaluate.js +8 -5
- 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/dist/query/filter.d.ts +7 -0
- package/fields/dist/query/filter.js +7 -1
- package/fields/dist/query/kit.d.ts +3 -2
- package/fields/dist/query/kit.js +1 -1
- package/fields/dist/query/layer.d.ts +6 -0
- package/fields/dist/query/layer.js +3 -0
- package/fields/dist/query/number.d.ts +3 -2
- package/fields/dist/query/number.js +5 -3
- package/fields/dist/query/read-rule.d.ts +1 -1
- package/fields/dist/query/read-rule.js +3 -0
- package/fields/docs/guides/queries.md +28 -24
- package/fields/docs/reference/fields.md +1 -0
- package/fields/docs/reference/query.md +9 -7
- package/package.json +2 -4
- package/postgres/dist/check.js +3 -1
- package/postgres/dist/definitions/storage.d.ts +3 -1
- package/postgres/dist/definitions/storage.js +3 -1
- package/postgres/dist/definitions/stored.js +13 -2
- package/postgres/dist/map.d.ts +5 -1
- package/postgres/dist/map.js +4 -0
- package/postgres/dist/records.js +6 -1
- package/postgres/docs/guides/definitions.md +1 -1
- package/postgres/docs/guides/field-map.md +3 -3
- package/postgres/docs/reference/postgres.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 +38 -9
- package/views/dist/contract.js +64 -6
- package/views/dist/controls/avatar.css +1 -1
- package/views/dist/controls/customize/map-customize-body.js +1 -1
- package/views/dist/controls/field/field.d.ts +2 -14
- package/views/dist/controls/field/field.js +4 -9
- package/views/dist/controls/field/looks.d.ts +1 -1
- package/views/dist/controls/field/looks.js +7 -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 +33 -0
- 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 +15 -2
- package/views/dist/controls/filter-editor/filter-editor.js +49 -16
- package/views/dist/controls/filter-editor/how.d.ts +11 -1
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +4 -2
- package/views/dist/controls/filter-editor/map-filter-body.js +21 -11
- package/views/dist/controls/filter-editor/map-rules.d.ts +6 -4
- package/views/dist/controls/filter-editor/map-rules.js +7 -4
- package/views/dist/controls/filter-editor/parts.d.ts +14 -1
- package/views/dist/controls/filter-editor/parts.js +14 -0
- package/views/dist/controls/filter-editor.css +4 -1
- package/views/dist/controls/index.d.ts +0 -3
- package/views/dist/controls/index.js +0 -3
- package/views/dist/controls/input.css +1 -1
- 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/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/menu-list.css +1 -1
- package/views/dist/controls/picker/looks.d.ts +1 -1
- package/views/dist/controls/picker.css +2 -2
- 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/press.css +0 -1
- package/views/dist/controls/radio/radio.d.ts +1 -1
- package/views/dist/controls/radio/radio.js +1 -16
- package/views/dist/controls/sheet/bottom-sheet.d.ts +2 -2
- package/views/dist/controls/sheet/bottom-sheet.js +31 -24
- 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.css +22 -0
- package/views/dist/controls/tokens.js +0 -6
- package/views/dist/controls/toolbar/toolbar.js +2 -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/editors/EditorPanel.js +1 -1
- package/views/dist/field-row/FieldRow.js +38 -16
- 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 +28 -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 +9 -6
- package/views/dist/field-row/field-row-button.js +3 -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/filters/duration-bound.d.ts +7 -0
- package/views/dist/filters/duration-bound.js +9 -0
- package/views/dist/filters/filter-model.d.ts +4 -0
- package/views/dist/filters/number-refused.d.ts +8 -0
- package/views/dist/filters/number-refused.js +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/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/GridResizeHandle.d.ts +7 -3
- package/views/dist/grid/chrome/GridResizeHandle.js +2 -3
- package/views/dist/grid/chrome/GridTable.js +1 -1
- package/views/dist/grid/chrome/GridTableSurface.js +1 -1
- package/views/dist/grid/chrome/grid-body-place.d.ts +2 -4
- package/views/dist/grid/chrome/grid-body-place.js +4 -5
- package/views/dist/grid/chrome/grid-figure-value.js +10 -4
- package/views/dist/grid/chrome/grid-table-props.d.ts +15 -4
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +12 -2
- package/views/dist/grid/core/clipboard-model.js +42 -8
- package/views/dist/grid/core/commit-model.d.ts +3 -0
- package/views/dist/grid/core/editing-controller.d.ts +29 -1
- package/views/dist/grid/core/editing-controller.js +142 -12
- package/views/dist/grid/core/pending-reconciliation.d.ts +14 -0
- package/views/dist/grid/core/pending-reconciliation.js +20 -8
- package/views/dist/grid/core/save-path.d.ts +4 -2
- package/views/dist/grid/core/save-path.js +1 -1
- package/views/dist/grid/core/spreadsheet-operations.js +43 -5
- package/views/dist/grid/core/useGridEditing.d.ts +5 -1
- package/views/dist/grid/core/useGridEditing.js +4 -4
- package/views/dist/grid/core/written-alongside.d.ts +16 -0
- package/views/dist/grid/core/written-alongside.js +30 -0
- package/views/dist/grid/grid.css +8 -4
- package/views/dist/grid/index.d.ts +1 -1
- package/views/dist/grid/looks.d.ts +2 -2
- package/views/dist/internal/before-paint.d.ts +5 -0
- package/views/dist/internal/before-paint.js +17 -0
- package/views/dist/internal/field-rows.d.ts +0 -8
- package/views/dist/internal/field-rows.js +1 -3
- 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 +8 -0
- package/views/dist/list/bar-keys.js +3 -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 +19 -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 +21 -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 +97 -0
- package/views/dist/list/buttons/shared.js +137 -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 +38 -0
- package/views/dist/list/editor-menus.d.ts +13 -0
- package/views/dist/list/editor-menus.js +13 -0
- package/views/dist/list/edits.d.ts +3 -1
- package/views/dist/list/index.d.ts +41 -0
- package/views/dist/list/index.js +19 -0
- package/views/dist/list/layer.d.ts +13 -3
- package/views/dist/list/layer.js +13 -3
- package/views/dist/list/line.d.ts +58 -0
- package/views/dist/list/line.js +229 -0
- package/views/dist/list/list.d.ts +7 -1
- package/views/dist/list/list.js +2 -2
- 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 +73 -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 +26 -0
- package/views/dist/list/panels/shared.js +36 -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 +19 -1
- package/views/dist/list/root-base.js +13 -3
- package/views/dist/list/root.d.ts +1 -1
- package/views/dist/list/root.js +2 -2
- package/views/dist/list/store.d.ts +29 -0
- package/views/dist/list/store.js +48 -2
- package/views/dist/list/toolbar-model.d.ts +99 -0
- package/views/dist/list/toolbar-model.js +195 -0
- package/views/dist/list/toolbar.js +142 -329
- package/views/dist/list/views-axis.js +15 -4
- package/views/dist/list/views.d.ts +1 -1
- package/views/dist/list/views.js +4 -1
- package/views/dist/looks/index.d.ts +0 -1
- package/views/dist/looks/index.js +0 -1
- package/views/dist/looks/looks.d.ts +1 -1
- package/views/dist/looks/pieces.js +0 -2
- package/views/dist/model/aggregates.d.ts +18 -8
- package/views/dist/model/aggregates.js +16 -22
- package/views/dist/model/column-filters.js +10 -3
- package/views/dist/model/view-rules.js +1 -0
- package/views/dist/panels/filter/NumberFilterBody.js +6 -8
- package/views/dist/panels/labels.js +7 -2
- package/views/dist/panels/model.d.ts +3 -0
- 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 +7 -3
- 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 +84 -0
- package/views/dist/panels/react/toolbar/ToolbarButton.d.ts +1 -1
- package/views/dist/panels/react/toolbar/ToolbarButton.js +5 -3
- 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/context.d.ts +4 -0
- package/views/dist/panels/react/toolbar/context.js +1 -0
- 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 +10 -3
- 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 +12 -0
- package/views/dist/panels/settings/input.d.ts +11 -0
- package/views/dist/panels/settings/layout.js +26 -0
- package/views/dist/panels/settings/person.d.ts +15 -0
- package/views/dist/panels/settings/person.js +6 -0
- package/views/dist/panels/toolbar/page-resets.js +14 -3
- package/views/dist/provider/components.d.ts +47 -4
- package/views/dist/react.d.ts +1 -1
- package/views/dist/styles.css +116 -257
- package/views/dist/styles.unlayered.css +116 -257
- package/views/docs/contract.md +28 -18
- package/views/docs/controls/field.md +2 -1
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/menu.md +1 -1
- package/views/docs/controls/sort-editor.md +1 -1
- package/views/docs/guides/atoms.md +1 -0
- package/views/docs/guides/looks.md +1 -1
- package/views/docs/guides/the-grid.md +6 -4
- package/views/docs/guides/toolbar-parts.md +337 -0
- package/views/docs/index.md +4 -0
- package/views/docs/reference/controls.md +6 -44
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +8 -7
- package/views/docs/reference/list.md +184 -11
- package/views/docs/reference/looks.md +13 -16
- package/views/docs/reference/panels-react.md +7 -7
- package/views/docs/reference/panels.md +1 -1
- package/views/docs/reference/react.md +14 -11
- package/views/docs/reference/views.md +9 -7
- package/views/skills/views/SKILL.md +2 -1
- package/views/dist/controls/setting-row/looks.d.ts +0 -10
- package/views/dist/controls/setting-row/looks.js +0 -22
- package/views/dist/controls/setting-row/setting-row.d.ts +0 -102
- package/views/dist/controls/setting-row/setting-row.js +0 -135
- package/views/dist/controls/setting-row/tokens.d.ts +0 -156
- package/views/dist/controls/setting-row/tokens.js +0 -41
- package/views/dist/controls/setting-row.css +0 -216
- package/views/dist/controls/switch-row/switch-row.d.ts +0 -1
- package/views/dist/controls/switch-row/switch-row.js +0 -1
- package/views/dist/controls/switch-row/tokens.d.ts +0 -39
- package/views/dist/controls/switch-row/tokens.js +0 -12
- package/views/dist/controls/switch-row.css +0 -35
- package/views/dist/controls/tag-field/tag-field.d.ts +0 -24
- package/views/dist/controls/tag-field/tag-field.js +0 -25
- package/views/dist/controls/tag-field/tokens.d.ts +0 -23
- package/views/dist/controls/tag-field/tokens.js +0 -8
- package/views/dist/controls/tag-field.css +0 -32
- package/views/docs/controls/setting-row.md +0 -44
- package/views/docs/controls/switch-row.md +0 -15
- package/views/docs/controls/tag-field.md +0 -11
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { FilterOwn } from "./filter-editor.js";
|
|
3
|
-
import { type FilterField } from "./how.js";
|
|
3
|
+
import { type DurationBox, type FilterField } from "./how.js";
|
|
4
4
|
import { type FilterGroup, type FilterRule } from "./rules.js";
|
|
5
5
|
import { type FilterEditorWords } from "./words.js";
|
|
6
6
|
/** Which part of a filter was pressed: its field, how it compares, or its value. */
|
|
@@ -46,5 +46,18 @@ export declare function PairValue({ name, value, onValue, size, onKeyDown, words
|
|
|
46
46
|
/** Its public name, on the pair: the filter bar's popover hands `vk-filter-part-pair` (VK-1003). */
|
|
47
47
|
slot?: string;
|
|
48
48
|
}): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
/** A duration's box (VK-1121): the Input, the stored bound written as a duration (`1m 30s`), and what is typed handed on with each
|
|
50
|
+
* key as the bound it reads as (`90` and `1m 30s` alike), null for what reads as none. What is typed stays as typed while it means
|
|
51
|
+
* the value; a value from elsewhere (a view switched, Clear all) is written afresh. */
|
|
52
|
+
export declare function DurationValue({ duration, value, onValue, ...rest }: {
|
|
53
|
+
duration: DurationBox;
|
|
54
|
+
value: number | null;
|
|
55
|
+
onValue: (v: number | null) => void;
|
|
56
|
+
"aria-label": string;
|
|
57
|
+
placeholder?: string;
|
|
58
|
+
size?: "sm" | "lg";
|
|
59
|
+
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
60
|
+
"data-slot"?: string;
|
|
61
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
49
62
|
/** A whole number's format: Base UI's Number Field rounds what is typed to it (VK-22). */
|
|
50
63
|
export declare const WHOLE: Intl.NumberFormatOptions;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
3
4
|
import { DateEditor } from "../date-editor/date-editor.js";
|
|
4
5
|
import { usePanelControls } from "../internal/panel-controls.js";
|
|
5
6
|
import { Picker } from "../picker/picker.js";
|
|
@@ -65,6 +66,17 @@ export function PairValue({ name, value, onValue, size, onKeyDown, words: given,
|
|
|
65
66
|
const { NumberBox } = usePanelControls();
|
|
66
67
|
return (_jsxs("div", { className: "o-filter-editor-pair", ...(slot ? { "data-slot": slot } : {}), children: [_jsx(NumberBox, { size: size, steppers: false, "aria-label": w.fromOf(name), placeholder: w.from, value: from, onValueChange: (v) => onValue([v ?? null, to]), onKeyDown: onKeyDown }), _jsx("span", { className: "o-filter-editor-dash", "aria-hidden": "true", children: "\u2013" }), _jsx(NumberBox, { size: size, steppers: false, "aria-label": w.toOf(name), placeholder: w.to, value: to, onValueChange: (v) => onValue([from, v ?? null]), onKeyDown: onKeyDown })] }));
|
|
67
68
|
}
|
|
69
|
+
export function DurationValue({ duration, value, onValue, ...rest }) {
|
|
70
|
+
const { Input } = usePanelControls();
|
|
71
|
+
const written = (v) => (v === null ? "" : duration.write(v));
|
|
72
|
+
const [draft, setDraft] = React.useState(() => written(value));
|
|
73
|
+
if (duration.read(draft) !== value) {
|
|
74
|
+
const now = written(value);
|
|
75
|
+
if (now !== draft)
|
|
76
|
+
setDraft(now);
|
|
77
|
+
}
|
|
78
|
+
return _jsx(Input, { ...rest, value: draft, onChange: (e) => { setDraft(e.target.value); onValue(duration.read(e.target.value)); } });
|
|
79
|
+
}
|
|
68
80
|
export const WHOLE = { maximumFractionDigits: 0 };
|
|
69
81
|
function TypedValue({ rule: r, field, name, set, onDone, w }) {
|
|
70
82
|
const enter = (e) => { if (e.key === "Enter") {
|
|
@@ -72,6 +84,8 @@ function TypedValue({ rule: r, field, name, set, onDone, w }) {
|
|
|
72
84
|
onDone();
|
|
73
85
|
} };
|
|
74
86
|
const { Input, NumberBox } = usePanelControls();
|
|
87
|
+
if (field.duration)
|
|
88
|
+
return _jsx(DurationValue, { "data-slot": "vk-filter-part-value", "aria-label": name, placeholder: valuePlaceholder(field, w), duration: field.duration, value: typeof r.value === "number" ? r.value : null, onValue: (v) => set({ value: v }), onKeyDown: enter });
|
|
75
89
|
return field.type === "number" || field.type === "range"
|
|
76
90
|
? _jsx(NumberBox, { "data-slot": "vk-filter-part-value", "aria-label": name, placeholder: valuePlaceholder(field, w), value: typeof r.value === "number" ? r.value : null, format: field.integer ? WHOLE : undefined, onValueChange: (v) => set({ value: v ?? null }), onKeyDown: enter })
|
|
77
91
|
: _jsx(Input, { "data-slot": "vk-filter-part-value", "aria-label": name, placeholder: valuePlaceholder(field, w), value: typeof r.value === "string" ? r.value : "", onChange: (e) => set({ value: e.target.value }), onKeyDown: enter });
|
|
@@ -125,7 +125,10 @@
|
|
|
125
125
|
/* ── VK-827: a group that excludes its matches says so over its rules; a relation rule's block is a group's well with a head, its
|
|
126
126
|
relation's name and its quantifier's box, laid out as ViewKit's own block (Mihai, 29 Nov 2026: built from the kit's parts); a
|
|
127
127
|
group's ⋮ ends its foot, after Delete group, as a rule's ends its row ─────────────────────────────────────────────────────── */
|
|
128
|
-
|
|
128
|
+
/* Why a whole rule filters nothing (VK-17), on a line of its own under the rule's boxes. */
|
|
129
|
+
.o-filter-editor-boxes:has(> .o-filter-editor-note) { flex-wrap: wrap; }
|
|
130
|
+
.o-filter-editor-note { flex: 1 1 100%; }
|
|
131
|
+
.o-filter-editor-excluded, .o-filter-editor-note {
|
|
129
132
|
margin: 0; color: var(--vk-fg-subtle); font-size: var(--vk-font-size-xs); font-weight: var(--vk-font-weight-medium);
|
|
130
133
|
line-height: calc(var(--vk-font-size-xs) * var(--vk-line-height-xs));
|
|
131
134
|
}
|
|
@@ -133,7 +133,4 @@ export { VALUES_EDITOR_WORDS, valuesWords, type ValuesEditorWords } from "./valu
|
|
|
133
133
|
export { LinksEditor, useLinksEditor, type LinksEditorAction, type LinksEditorLead, type LinksEditorOpens, type LinksEditorParts, type LinksEditorProps, } from "./links-editor/links-editor.js";
|
|
134
134
|
export { found, heldOf, leadAfter, offered, removed, said, saidShort, setValue, ticked, type LinkChoice, type LinkField, type LinkFieldKind, type LinkValue, } from "./links-editor/links.js";
|
|
135
135
|
export { LINKS_EDITOR_WORDS, linksWords, type LinksEditorWords } from "./links-editor/words.js";
|
|
136
|
-
export { TagField, type TagFieldProps } from "./tag-field/tag-field.js";
|
|
137
|
-
export { SettingChevron, SettingIcon, SettingRow, SettingRows, SwitchRow, SwitchRows, useSettingRowWorn, useSettingRowsRow, type SettingAction, type SettingRowProps, type SettingRowsProps, type SettingState, type SwitchRowProps } from "./setting-row/setting-row.js";
|
|
138
|
-
export { SETTING_ROW_ATTRS, settingRowWornOf } from "./setting-row/looks.js";
|
|
139
136
|
export type { PartSlot } from "./internal/part-slot.js";
|
|
@@ -125,6 +125,3 @@ export { VALUES_EDITOR_WORDS, valuesWords } from "./values-editor/words.js";
|
|
|
125
125
|
export { LinksEditor, useLinksEditor, } from "./links-editor/links-editor.js";
|
|
126
126
|
export { found, heldOf, leadAfter, offered, removed, said, saidShort, setValue, ticked, } from "./links-editor/links.js";
|
|
127
127
|
export { LINKS_EDITOR_WORDS, linksWords } from "./links-editor/words.js";
|
|
128
|
-
export { TagField } from "./tag-field/tag-field.js";
|
|
129
|
-
export { SettingChevron, SettingIcon, SettingRow, SettingRows, SwitchRow, SwitchRows, useSettingRowWorn, useSettingRowsRow } from "./setting-row/setting-row.js";
|
|
130
|
-
export { SETTING_ROW_ATTRS, settingRowWornOf } from "./setting-row/looks.js";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
drawn round an Input and its addons (at the end of this file). The field around it, its label, note and
|
|
6
6
|
error, is field.css.
|
|
7
7
|
|
|
8
|
-
It is the one field: the Select's field
|
|
8
|
+
It is the one field: the Select's field is .o-input too, so every state and option
|
|
9
9
|
here draws them. A Select's open list (data-popup-open) is its focus, and a field's state is read from
|
|
10
10
|
its control (.o-input-control) wherever inside it sits, among a Select's chips too.
|
|
11
11
|
|
|
@@ -5,5 +5,7 @@ import type { MenuEntry } from "../menu-list/menu-list.js";
|
|
|
5
5
|
export declare function itemsOfEntries(entries: readonly MenuEntry[], names?: Readonly<Record<string, string>>): ViewsMenuItem[];
|
|
6
6
|
/** The entries the items draw: disabled first, then a default key (ViewKit's entry), then the app's rows. */
|
|
7
7
|
export declare function entriesOfItems<E extends MenuEntry>(items: readonly ViewsMenuItem[], own: ReadonlyMap<string, E>, appSlot: string, defaults: ReadonlySet<string>): E[];
|
|
8
|
+
/** A key handed twice kept once (the first, at any depth). */
|
|
9
|
+
export declare function once(items: ViewsMenuItem[], seen?: Set<string>): ViewsMenuItem[];
|
|
8
10
|
/** A menu's entries through the app's function: none handed, the very entries. `defaults` names every key the menu can hold. */
|
|
9
11
|
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[];
|
|
@@ -76,7 +76,7 @@ export function entriesOfItems(items, own, appSlot, defaults) {
|
|
|
76
76
|
}
|
|
77
77
|
return tidy(out);
|
|
78
78
|
}
|
|
79
|
-
function once(items, seen = new Set()) {
|
|
79
|
+
export function once(items, seen = new Set()) {
|
|
80
80
|
return items.flatMap((i) => {
|
|
81
81
|
if (seen.has(i.key))
|
|
82
82
|
return [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const partAttrs = (p) => {
|
|
2
2
|
if (!p)
|
|
3
3
|
return {};
|
|
4
|
-
return { "data-slot": p.slot, ...(p.key !== undefined ? { "data-key": p.key } : {}), ...(p.index !== undefined ? { "data-index": String(p.index) } : {}) };
|
|
4
|
+
return { ...(p.slot !== undefined ? { "data-slot": p.slot } : {}), ...(p.key !== undefined ? { "data-key": p.key } : {}), ...(p.index !== undefined ? { "data-index": String(p.index) } : {}) };
|
|
5
5
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ViewsMenuItem } from "../../provider/components.js";
|
|
3
|
+
import type { ButtonProps } from "../button/button.js";
|
|
4
|
+
import type { ButtonOwnLook } from "../button/own-look.js";
|
|
5
|
+
/** What a default draws: its words (a text button's text, an icon button's name), its icon, and why it is greyed. */
|
|
6
|
+
export type ActionShown = {
|
|
7
|
+
label: string;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
disabled?: string;
|
|
10
|
+
};
|
|
11
|
+
/** One of a place's own buttons: its key, its words and icon as handed to the app, why it is greyed this time (Add sort at the most,
|
|
12
|
+
* handed to the app as `disabled`), and how it draws, `shown` absent with no function. */
|
|
13
|
+
export type OwnAction = {
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
icon?: React.ReactNode;
|
|
17
|
+
disabled?: string;
|
|
18
|
+
draw: (shown?: ActionShown) => React.ReactNode;
|
|
19
|
+
};
|
|
20
|
+
/** How an app's own button draws in this place. */
|
|
21
|
+
export type AppActionLook = {
|
|
22
|
+
slot: string;
|
|
23
|
+
size: ButtonProps["size"];
|
|
24
|
+
look?: ButtonOwnLook;
|
|
25
|
+
};
|
|
26
|
+
/** A place's buttons through the app's function: none handed, each default as it draws itself. `defaults` names every key the place
|
|
27
|
+
* can hold. */
|
|
28
|
+
export declare function shapeActions<C>(own: readonly OwnAction[], fn: ((items: ViewsMenuItem[], ctx: C) => ViewsMenuItem[]) | undefined, ctx: C, defaults: ReadonlySet<string>, app: AppActionLook): React.ReactNode[];
|
|
29
|
+
/** The app's own button in a rule's end or a foot: quiet, at the place's size; with an icon, an icon button named by its label. */
|
|
30
|
+
export declare function AppAction({ item, look }: {
|
|
31
|
+
item: ViewsMenuItem;
|
|
32
|
+
look: AppActionLook;
|
|
33
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { once } from "./menu-items.js";
|
|
5
|
+
import { usePanelControls } from "./panel-controls.js";
|
|
6
|
+
export function shapeActions(own, fn, ctx, defaults, app) {
|
|
7
|
+
if (!fn)
|
|
8
|
+
return own.map((o) => _jsx(React.Fragment, { children: o.draw() }, o.key));
|
|
9
|
+
const handed = once(fn(own.map(({ key, label, icon, disabled }) => ({ key, label, ...(icon != null && { icon }), ...(disabled && { disabled: true, disabledReason: disabled }) })), ctx));
|
|
10
|
+
return handed.flatMap((item) => {
|
|
11
|
+
if (item.children !== undefined || item.checked !== undefined)
|
|
12
|
+
return [];
|
|
13
|
+
const mine = own.find((o) => o.key === item.key);
|
|
14
|
+
if (mine) {
|
|
15
|
+
const shown = { label: item.label, icon: item.icon !== undefined ? item.icon : mine.icon, ...(item.disabled && { disabled: item.disabledReason || mine.disabled || item.label }) };
|
|
16
|
+
return [_jsx(React.Fragment, { children: mine.draw(shown) }, item.key)];
|
|
17
|
+
}
|
|
18
|
+
if (defaults.has(item.key))
|
|
19
|
+
return [];
|
|
20
|
+
return [_jsx(AppAction, { item: item, look: app }, item.key)];
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export function AppAction({ item, look }) {
|
|
24
|
+
const { Button, Tooltip } = usePanelControls();
|
|
25
|
+
const icon = item.icon != null;
|
|
26
|
+
const button = (_jsx(Button, { kind: "quiet", size: look.size, "data-slot": look.slot, "data-key": item.key, ...(item.disabled && { disabled: true, focusableWhenDisabled: true }), ...(icon ? { shape: "icon", icon: item.icon, "aria-label": item.label, ...(look.look && { look: look.look }) } : {}), ...(item.onSelect && !item.disabled && { onClick: () => item.onSelect?.() }), children: icon ? null : item.label }));
|
|
27
|
+
return item.disabled ? _jsx(Tooltip, { label: item.disabledReason || item.label, reason: true, side: "top", children: button }) : button;
|
|
28
|
+
}
|
|
@@ -14,7 +14,7 @@ function choiceOf(run, rowSlot) {
|
|
|
14
14
|
onChoose: (key) => run.find((i) => i.key === key)?.onSelect?.(),
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
const named = (rowSlot, key, own) => (
|
|
17
|
+
const named = (rowSlot, key, own) => ({ slot: { ...((own ?? rowSlot) !== undefined && { slot: own ?? rowSlot }), key } });
|
|
18
18
|
const onlyTicks = (items) => (items.length > 0 && items.every(closingTick) && !items.slice(1).some((i) => i.separatorBefore) ? items : null);
|
|
19
19
|
export function menuEntries(items, notNow = NO_REASON, rowSlot) {
|
|
20
20
|
const out = [];
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
A fifth, data-menu-list-close (hidden · shown), is read by the Menu, not here: a Close row over its rows.
|
|
14
14
|
|
|
15
|
-
Nothing set draws
|
|
15
|
+
Nothing set draws Words, rows 56 high, corners 2xl, lines full width. Each rule keyed on one of those values has a
|
|
16
16
|
twin on the same subject, :not([data-menu-list-<option>] *), at the same weight, so a frame that sets the option turns it off;
|
|
17
17
|
the bare rules draw the rest (Card, Inset, 52, xl). The nearest frame wins: each rule keyed on a value stands down inside a
|
|
18
18
|
frame of another value set within it, by a :where() of no weight, so a piece that pins its own rows (Customize's settings, a
|
|
@@ -15,5 +15,5 @@ export type PickerWorn = {
|
|
|
15
15
|
};
|
|
16
16
|
/** The data attributes pickerWornOf reads, for an observer that reads them again as an app's picks change. */
|
|
17
17
|
export declare const pickerRead: string[];
|
|
18
|
-
/** The options worn around `el`, each read off the nearest frame that sets it; outside any frame, the defaults (
|
|
18
|
+
/** The options worn around `el`, each read off the nearest frame that sets it; outside any frame, the defaults (ViewKit's own). */
|
|
19
19
|
export declare function pickerWornOf(el: Element | null): PickerWorn;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
.o-picker .o-list-main { flex: 0 1 auto; }
|
|
19
19
|
.o-picker .o-list-line { flex: 1 1 0; min-width: 0; }
|
|
20
20
|
[data-picker-line="below"] .o-picker .o-list-text { display: grid; gap: var(--vk-border-width); }
|
|
21
|
-
/* Below is the default
|
|
21
|
+
/* Below is the default: where no frame picks a second line, at the picked rule's weight. */
|
|
22
22
|
.o-picker:not([data-picker-line] *) .o-list-text { display: grid; gap: var(--vk-border-width); }
|
|
23
23
|
|
|
24
24
|
/* The check in the brand's circle at a row's end (Held: Check, Attio's), seen only on the row the field holds. */
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
.o-picker-message-text { flex: 0 1 auto; }
|
|
203
203
|
[data-picker-doing="start"] .o-picker-message { justify-content: flex-start; text-align: left; }
|
|
204
204
|
[data-picker-doing="start"] .o-picker-message-text { flex: 1; }
|
|
205
|
-
/* At the start is the default
|
|
205
|
+
/* At the start is the default: where no frame picks what the list is doing, at the picked rules' weight. */
|
|
206
206
|
.o-picker-message:not([data-picker-doing] *) { justify-content: flex-start; text-align: left; }
|
|
207
207
|
.o-picker-message-text:not([data-picker-doing] *) { flex: 1; }
|
|
208
208
|
.o-picker-more { 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); }
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ViewsPopoverProps } from "../../provider/components.js";
|
|
2
2
|
/** ViewKit's popup, drawn as the kit's Popover. */
|
|
3
|
-
export declare function MapPopover({ open, onOpenChange, anchor, side, align, sideOffset, alignOffset, initialFocus, onOutsidePress, onEscape, chrome, onPanelClick, panelData, style, className, label, children }: ViewsPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function MapPopover({ open, onOpenChange, anchor, side, align, sideOffset, alignOffset, initialFocus, finalFocus, onOutsidePress, onEscape, chrome, onPanelClick, panelData, style, className, label, children }: ViewsPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Popover } from "./popover.js";
|
|
3
3
|
import { markOwnControl } from "../../provider/own-control.js";
|
|
4
|
-
export function MapPopover({ open, onOpenChange, anchor, side, align, sideOffset, alignOffset, initialFocus, onOutsidePress, onEscape, chrome, onPanelClick, panelData, style, className, label, children }) {
|
|
5
|
-
return (_jsx(Popover, { open: open, onOpenChange: (next, d) => onOpenChange(next, { reason: d.reason }), anchor: anchor, side: side, align: align, sideOffset: sideOffset, alignOffset: alignOffset, initialFocus: initialFocus, onOutsidePress: onOutsidePress, onEscape: onEscape, style: style, onPopupClick: onPanelClick, popupData: chrome === "menu" ? { ...panelData, "data-popover-chrome": "menu" } : panelData, className: className, "aria-label": label, children: children }));
|
|
4
|
+
export function MapPopover({ open, onOpenChange, anchor, side, align, sideOffset, alignOffset, initialFocus, finalFocus, onOutsidePress, onEscape, chrome, onPanelClick, panelData, style, className, label, children }) {
|
|
5
|
+
return (_jsx(Popover, { open: open, onOpenChange: (next, d) => onOpenChange(next, { reason: d.reason }), anchor: anchor, side: side, align: align, sideOffset: sideOffset, alignOffset: alignOffset, initialFocus: initialFocus, finalFocus: finalFocus, onOutsidePress: onOutsidePress, onEscape: onEscape, style: style, onPopupClick: onPanelClick, popupData: chrome === "menu" ? { ...panelData, "data-popover-chrome": "menu" } : panelData, className: className, "aria-label": label, children: children }));
|
|
6
6
|
}
|
|
7
7
|
markOwnControl(MapPopover);
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
.o-input-addon:is([data-side="start"], [data-side="end"]) > .o-button { --pressing-room-x: calc(var(--vk-spacing) * 0.75); }
|
|
38
38
|
.o-input-addon:is([data-side="top"], [data-side="bottom"]) > .o-button { --pressing-room-x: calc(var(--vk-spacing) * 0.5); }
|
|
39
39
|
:is(.o-check:not(.o-check-row), .o-radio):not(.o-radio-row > *, :has(.o-choice-note)):is(:has(+ :is(.o-check, .o-radio)), :is(.o-check, .o-radio) + *) > :is(.o-check-box, .o-radio-ring) { --pressing-room-y: calc(var(--vk-spacing) * 2); }
|
|
40
|
-
.o-tag-field .o-tag-remove { --pressing-room-x: calc(var(--vk-spacing) * 0.75); --pressing-room-y: calc(var(--vk-spacing) * 1.5); }
|
|
41
40
|
.o-select-chips .o-tag-remove { --pressing-room-x: calc(var(--vk-spacing) * 0.5); --pressing-room-y: calc(var(--vk-spacing) * 1); }
|
|
42
41
|
/* Options side by side, 6px apart in a row and between their lines: a link half that each way. */
|
|
43
42
|
.o-options > .o-option[data-link] { --pressing-room-x: calc(var(--vk-spacing) * 0.75); --pressing-room-y: calc(var(--vk-spacing) * 0.75); }
|
|
@@ -16,7 +16,7 @@ export interface RadioGroupProps extends Omit<React.ComponentProps<typeof BaseRa
|
|
|
16
16
|
}
|
|
17
17
|
/** Exactly one of a few choices, all of them in sight: its name, then its Radios. With a name, the group is a
|
|
18
18
|
* FieldSet, its name the legend (Base UI names the radio group by it). */
|
|
19
|
-
export declare function RadioGroup(props: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function RadioGroup({ label, row, tiles, className, children, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
export interface RadioProps extends Omit<React.ComponentProps<typeof BaseRadio.Root>, "className"> {
|
|
21
21
|
/** Its public name where a panel names it (VK-988), drawn on its label with `data-key`: `vk-customize-layout`, say. */
|
|
22
22
|
"data-slot"?: string;
|
|
@@ -4,24 +4,9 @@ import * as React from "react";
|
|
|
4
4
|
import { Radio as BaseRadio } from "@base-ui/react/radio";
|
|
5
5
|
import { RadioGroup as BaseRadioGroup } from "@base-ui/react/radio-group";
|
|
6
6
|
import { cx } from "../../internal/cx.js";
|
|
7
|
-
import { AtSettingRowEnd } from "../../internal/field-rows.js";
|
|
8
7
|
import { FieldSet } from "../field/field.js";
|
|
9
8
|
import { phoneMark, usePhoneForm } from "../internal/phone.js";
|
|
10
|
-
|
|
11
|
-
export function RadioGroup(props) {
|
|
12
|
-
const end = React.useContext(AtSettingRowEnd), radios = radiosOf(props.children);
|
|
13
|
-
if (end && !radios.some((r) => r.props.swatch != null))
|
|
14
|
-
return _jsx(RadioSelect, { ...props, radios: radios, name: end.name });
|
|
15
|
-
return _jsx(RadioChoices, { ...props });
|
|
16
|
-
}
|
|
17
|
-
const radiosOf = (children) => React.Children.toArray(children).filter((c) => React.isValidElement(c) && c.type === Radio);
|
|
18
|
-
const asWords = (v) => (v == null ? undefined : String(v));
|
|
19
|
-
function RadioSelect({ radios, name, value, defaultValue, onValueChange, disabled, className, ...props }) {
|
|
20
|
-
const items = radios.map(({ props: r }) => ({ value: String(r.value), label: typeof r.label === "string" ? r.label : String(r.value) }));
|
|
21
|
-
return (_jsx(Select, { size: "md", className: cx("o-setting-row-select", className), items: items, value: asWords(value), defaultValue: asWords(defaultValue), disabled: disabled, "aria-label": props["aria-label"] ?? name ?? "Choose", onValueChange: (v) => { if (typeof v === "string")
|
|
22
|
-
onValueChange?.(v, undefined); } }));
|
|
23
|
-
}
|
|
24
|
-
function RadioChoices({ label, row = false, tiles = false, className, children, ...props }) {
|
|
9
|
+
export function RadioGroup({ label, row = false, tiles = false, className, children, ...props }) {
|
|
25
10
|
const phone = usePhoneForm();
|
|
26
11
|
const group = (_jsx(BaseRadioGroup, { className: cx("o-radio-group", row && "o-radio-row", tiles && "o-radio-tiles", label == null && className), ...phoneMark(phone), ...props, children: children }));
|
|
27
12
|
return label != null ? _jsx(FieldSet, { legend: label, disabled: props.disabled, className: className, children: group }) : group;
|
|
@@ -2,8 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
import { type CloseReason } from "../internal/close-reason.js";
|
|
3
3
|
import { type SheetForm, type SheetStop } from "./forms.js";
|
|
4
4
|
export type { SheetForm, SheetStop } from "./forms.js";
|
|
5
|
-
/** Closes every sheet open under this one and this one
|
|
6
|
-
* only the top one. */
|
|
5
|
+
/** Closes every sheet open under this one and this one, an app's own sheet or dialog on Base UI under it included: a
|
|
6
|
+
* choice that finishes the job. A drag, the dim or Back close only the top one. */
|
|
7
7
|
export declare const useSheetCloseAll: () => (() => void) | null;
|
|
8
8
|
/** A close that is a button of its own: a head's Cancel. */
|
|
9
9
|
export declare const SheetClose: ({ children }: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
3
4
|
import { Drawer as Base } from "@base-ui/react/drawer";
|
|
4
5
|
import { cx } from "../../internal/cx.js";
|
|
5
6
|
import { OutOfFieldRows } from "../../internal/field-rows.js";
|
|
@@ -249,7 +250,9 @@ function useKeyboardFoot(popup, on) {
|
|
|
249
250
|
}, [typing, popup]);
|
|
250
251
|
}
|
|
251
252
|
export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form = "full", stops, openAt, stop, onStopChange, mark: marked = "[data-sheet-mark]", container, standing: stands, risen = false, finalFocus, className, "data-slot": slot, children }) {
|
|
252
|
-
const closeBelow = React.useContext(CloseAll)
|
|
253
|
+
const closeBelow = React.useContext(CloseAll);
|
|
254
|
+
const [overApp, setOverApp] = React.useState(false), appClose = React.useRef(null);
|
|
255
|
+
const stacked = closeBelow !== null || overApp;
|
|
253
256
|
const standsBelow = React.useContext(Standing), standing = stands || standsBelow;
|
|
254
257
|
const [armed, setArmed] = React.useState(risen);
|
|
255
258
|
React.useEffect(() => setArmed(true), []);
|
|
@@ -269,6 +272,7 @@ export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form =
|
|
|
269
272
|
const [popup, setPopup] = React.useState(null), [viewport, setViewport] = React.useState(null);
|
|
270
273
|
const backdrop = React.useRef(null), popupRef = React.useRef(null);
|
|
271
274
|
const bindPopup = React.useCallback((el) => { popupRef.current = el; setPopup(el); }, []);
|
|
275
|
+
React.useLayoutEffect(() => setOverApp(!!popup && closeBelow === null && popup.hasAttribute("data-nested")), [popup, closeBelow]);
|
|
272
276
|
const list = stops ?? FORMS[form].stops, first = openAt ?? list[0];
|
|
273
277
|
const [at, setAt] = React.useState(first), [mark, setMark] = React.useState(null);
|
|
274
278
|
const [wasOpen, setWasOpen] = React.useState(open), [coming, setComing] = React.useState(open && !risen);
|
|
@@ -336,7 +340,10 @@ export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form =
|
|
|
336
340
|
b.scrollTop = 0;
|
|
337
341
|
} }, [expanded, popup]);
|
|
338
342
|
const close = React.useCallback((reason) => onOpenChange(false, { reason }), [onOpenChange]);
|
|
339
|
-
const closeAll = React.useCallback(() => {
|
|
343
|
+
const closeAll = React.useCallback(() => { if (closeBelow)
|
|
344
|
+
closeBelow();
|
|
345
|
+
else
|
|
346
|
+
appClose.current?.click(); release("closed"); close("item-press"); }, [closeBelow, release, close]);
|
|
340
347
|
const body = React.useMemo(() => ({
|
|
341
348
|
onBodyWheel: (e) => { const s = stopAfterWheel(current, e.deltaY); if (s !== current)
|
|
342
349
|
moveTo(s); },
|
|
@@ -353,27 +360,27 @@ export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form =
|
|
|
353
360
|
document.addEventListener("focusin", on, true);
|
|
354
361
|
return () => document.removeEventListener("focusin", on, true);
|
|
355
362
|
}, [open, standing, container, viewport]);
|
|
356
|
-
return (_jsx(Base.Root, { open: open && armed, onOpenChangeComplete: (o) => { setComing(false); onOpenChangeComplete?.(o); }, swipeDirection: "down", modal: !standing, disablePointerDismissal: standing, onOpenChange: (o, details) => {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
release("closed");
|
|
365
|
-
onOpenChange(o, { reason: closeReasonOf(details.reason) });
|
|
366
|
-
}, snapPoints: points, snapPoint: point, snapToSequentialPoints: true, onSnapPointChange: (p, details) => {
|
|
367
|
-
if (p === null) {
|
|
368
|
-
release("closed", details.event?.timeStamp);
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
if (!open || details.reason !== "swipe")
|
|
372
|
-
return;
|
|
373
|
-
release(offsetOf(p, popup.offsetHeight, viewport.clientHeight), details.event?.timeStamp);
|
|
374
|
-
moveTo(stopOf(p === mark ? "mark" : p, list));
|
|
375
|
-
}, children: _jsxs(Base.Portal, { container: container, children: [_jsx(Base.Backdrop, { ref: backdrop, forceRender: stacked, className: "o-sheet-backdrop", "data-stacked": stacked ? "" : undefined }), _jsxs(Base.Viewport, { ref: setViewport, className: "o-sheet-viewport", "data-sheet-form": form, onClick: standing ? (e) => { if (e.target === e.currentTarget) {
|
|
363
|
+
return (_jsxs(_Fragment, { children: [overApp && popup && createPortal(_jsx(Base.Close, { ref: appClose, hidden: true, tabIndex: -1, "aria-hidden": "true" }), popup.ownerDocument.body), _jsx(Base.Root, { open: open && armed, onOpenChangeComplete: (o) => { setComing(false); onOpenChangeComplete?.(o); }, swipeDirection: "down", modal: !standing, disablePointerDismissal: standing, onOpenChange: (o, details) => {
|
|
364
|
+
const from = details.event?.target;
|
|
365
|
+
const elsewhere = from instanceof Element && (from === document.body ? !focusedIn.current : !(container ?? viewport)?.contains(from));
|
|
366
|
+
if (!o && standing && details.reason === "escape-key" && elsewhere) {
|
|
367
|
+
details.cancel();
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
if (!o && details.reason !== "swipe")
|
|
376
371
|
release("closed");
|
|
377
|
-
|
|
378
|
-
|
|
372
|
+
onOpenChange(o, { reason: closeReasonOf(details.reason) });
|
|
373
|
+
}, snapPoints: points, snapPoint: point, snapToSequentialPoints: true, onSnapPointChange: (p, details) => {
|
|
374
|
+
if (p === null) {
|
|
375
|
+
release("closed", details.event?.timeStamp);
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
if (!open || details.reason !== "swipe")
|
|
379
|
+
return;
|
|
380
|
+
release(offsetOf(p, popup.offsetHeight, viewport.clientHeight), details.event?.timeStamp);
|
|
381
|
+
moveTo(stopOf(p === mark ? "mark" : p, list));
|
|
382
|
+
}, children: _jsxs(Base.Portal, { container: container, children: [_jsx(Base.Backdrop, { ref: backdrop, forceRender: stacked, className: "o-sheet-backdrop", "data-stacked": stacked ? "" : undefined }), _jsxs(Base.Viewport, { ref: setViewport, className: "o-sheet-viewport", "data-sheet-form": form, onClick: standing ? (e) => { if (e.target === e.currentTarget) {
|
|
383
|
+
release("closed");
|
|
384
|
+
close("outside-press");
|
|
385
|
+
} } : undefined, children: [_jsx(Base.Popup, { ref: bindPopup, initialFocus: popupRef, finalFocus: finalFocus ? () => finalFocus() ?? true : undefined, className: cx("o-sheet o-smooth", className), "data-sheet-form": form, "aria-label": label, "data-slot": slot, "data-kit": "sheet", children: _jsxs("div", { className: "o-sheet-cut", children: [_jsx("div", { className: "o-sheet-handle", "aria-hidden": "true" }), _jsx(Standing.Provider, { value: standing, children: _jsx(Body.Provider, { value: body, children: _jsx(CloseAll.Provider, { value: closeAll, children: _jsx(OutOfFieldRows, { children: children }) }) }) })] }) }), coming && _jsx("div", { className: "o-sheet-shield", "aria-hidden": "true", "data-sheet-shield": "", onPointerDown: (e) => { e.preventDefault(); e.stopPropagation(); }, onMouseDown: (e) => { e.preventDefault(); e.stopPropagation(); }, onClick: (e) => e.stopPropagation() })] })] }) })] }));
|
|
379
386
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { useViews } from "../../provider/context.js";
|
|
4
|
+
import { PhoneHost } from "../internal/phone.js";
|
|
5
|
+
import { usePopupHost } from "../internal/popup-host.js";
|
|
4
6
|
import { Sheet, SheetBody, SheetButton, SheetFoot, SheetHead } from "./bottom-sheet.js";
|
|
5
7
|
import { STOPS } from "./forms.js";
|
|
6
8
|
import { SheetPartsFrom } from "./sheet-parts.js";
|
|
@@ -13,14 +15,15 @@ export const SNAP_FORM = {
|
|
|
13
15
|
export function MapSheet({ open, onOpenChange, title, label, description, actions, snap, className, children }) {
|
|
14
16
|
const { icons, messages } = useViews();
|
|
15
17
|
const [parts, setParts] = React.useState(null);
|
|
18
|
+
const mark = React.useRef(null), host = usePopupHost(mark), screen = React.useContext(PhoneHost);
|
|
16
19
|
const words = { close: messages({ key: "views.panels.close" }), back: messages({ key: "views.panels.back" }) };
|
|
17
20
|
const name = label ?? "", shown = title ?? name;
|
|
18
21
|
const titleLabel = title != null && title !== name && label ? label : undefined;
|
|
19
22
|
const left = actions?.back ?? actions?.close;
|
|
20
23
|
const Back = icons.back, Close = icons.close, Check = icons.check;
|
|
21
|
-
return (_jsxs(Sheet, { open: open, onOpenChange: (next, d) => onOpenChange(next, { reason: d.reason }), label: name, ...SNAP_FORM[snap ?? "full"], className: className, children: [parts
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: mark, hidden: true }), _jsxs(Sheet, { open: open, onOpenChange: (next, d) => onOpenChange(next, { reason: d.reason }), label: name, ...SNAP_FORM[snap ?? "full"], container: screen ?? host, standing: !!screen, className: className, children: [parts
|
|
25
|
+
? _jsx(SheetHead, { title: parts.title, ...parts.head, words: words })
|
|
26
|
+
: actions && left
|
|
27
|
+
? _jsx(SheetHead, { title: shown, titleLabel: titleLabel, description: description, left: _jsx(SheetButton, { "data-slot": actions.back ? "vk-editor-back" : "vk-editor-close", "aria-label": left.label, className: actions.back ? "o-sheet-back" : undefined, icon: actions.back ? _jsx(Back, {}) : _jsx(Close, {}), onClick: left.onPress }), right: actions.done ? _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": actions.done.label, icon: _jsx(Check, {}), onClick: actions.done.onPress }) : _jsx("span", {}) })
|
|
28
|
+
: (title != null || description != null) && _jsx(SheetHead, { title: shown, titleLabel: titleLabel, description: description, words: words }), _jsx(SheetBody, { children: _jsx(SheetPartsFrom.Provider, { value: setParts, children: children }) }), parts?.foot && _jsx(SheetFoot, { children: parts.foot })] })] }));
|
|
26
29
|
}
|
|
@@ -42,9 +42,13 @@ export interface SortEditorProps {
|
|
|
42
42
|
fieldOf?: FieldOf;
|
|
43
43
|
/** On a computer, Add sort at the foot: what holds it has no + of its own to add a rule with. True unless said. */
|
|
44
44
|
addSort?: boolean;
|
|
45
|
+
/** What its computer form shows with no rule (VK-1091): nothing but its foot (`fields`, the default, for what opens the fields
|
|
46
|
+
* itself while none stands), or that nothing sorts yet, with Add sort (`editor`), as its stacked forms do. */
|
|
47
|
+
empty?: "fields" | "editor";
|
|
45
48
|
/** Its words; English unless handed. */
|
|
46
49
|
words?: Partial<SortEditorWords>;
|
|
47
|
-
/** Its menus as data (VK-1063): a rule's ⋯ (a phone's and the narrow form's) and a set-aside rule's, handed their default items
|
|
50
|
+
/** Its menus as data (VK-1063): a rule's ⋯ (a phone's and the narrow form's) and a set-aside rule's, handed their default items;
|
|
51
|
+
* and (VK-1065) a rule's end (`row`) and its foot (`foot`). */
|
|
48
52
|
items?: ViewsSortEditorItems;
|
|
49
53
|
}
|
|
50
54
|
export interface SortEditorParts {
|