viewkitjs 0.29.0 → 0.30.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 +111 -0
- package/MIGRATION.md +97 -8
- package/package.json +1 -1
- package/views/dist/cells/cell-format.d.ts +2 -2
- package/views/dist/cells/cell-values.js +0 -2
- package/views/dist/contract.d.ts +15 -18
- package/views/dist/contract.js +13 -27
- package/views/dist/controls/controls.d.ts +2 -4
- package/views/dist/controls/controls.js +2 -2
- package/views/dist/controls/customize/customize.d.ts +51 -0
- package/views/dist/controls/customize/customize.js +128 -23
- package/views/dist/controls/customize/map-customize-body.d.ts +0 -3
- package/views/dist/controls/customize/map-customize-body.js +46 -11
- package/views/dist/controls/customize/map-ranges.d.ts +23 -0
- package/views/dist/controls/customize/map-ranges.js +41 -0
- package/views/dist/controls/customize/rules.d.ts +17 -1
- package/views/dist/controls/customize/rules.js +2 -0
- package/views/dist/controls/customize/words.d.ts +7 -0
- package/views/dist/controls/customize/words.js +5 -0
- package/views/dist/controls/customize.css +3 -0
- package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +1 -0
- package/views/dist/controls/filter-editor/rules.d.ts +1 -2
- package/views/dist/controls/index.d.ts +8 -8
- package/views/dist/controls/index.js +8 -8
- package/views/dist/controls/menu-list/menu-list.d.ts +16 -1
- package/views/dist/controls/menu-list/menu-list.js +26 -8
- package/views/dist/controls/menu-list.css +8 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +1 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +6 -3
- package/views/dist/controls/sheet/map-sheet.js +1 -1
- package/views/dist/controls/text-editor/map-text-body.d.ts +1 -1
- package/views/dist/controls/text-editor/map-text-body.js +2 -2
- package/views/dist/controls/text-editor/text-editor.d.ts +3 -0
- package/views/dist/controls/text-editor/text-editor.js +16 -2
- package/views/dist/controls/text-editor.css +11 -0
- package/views/dist/controls/values-editor/values.js +6 -2
- package/views/dist/display/options.d.ts +1 -1
- package/views/dist/display/rich-text.js +0 -1
- package/views/dist/editors/ChipsEditor.d.ts +4 -5
- package/views/dist/editors/ChipsEditor.js +12 -78
- package/views/dist/editors/DateEditor.d.ts +12 -16
- package/views/dist/editors/DateEditor.js +40 -191
- package/views/dist/editors/EditorPanel.d.ts +2 -6
- package/views/dist/editors/EditorPanel.js +2 -2
- package/views/dist/editors/LocationEditor.d.ts +11 -19
- package/views/dist/editors/LocationEditor.js +19 -211
- package/views/dist/editors/NameEditor.d.ts +8 -16
- package/views/dist/editors/NameEditor.js +11 -100
- package/views/dist/editors/NumberEditor.d.ts +14 -21
- package/views/dist/editors/NumberEditor.js +22 -49
- package/views/dist/editors/RangeEditor.d.ts +9 -33
- package/views/dist/editors/RangeEditor.js +12 -97
- package/views/dist/editors/RelationEditor.d.ts +6 -9
- package/views/dist/editors/RelationEditor.js +11 -30
- package/views/dist/editors/RelationSetEditor.d.ts +13 -24
- package/views/dist/editors/RelationSetEditor.js +33 -101
- package/views/dist/editors/SelectEditor.d.ts +15 -17
- package/views/dist/editors/SelectEditor.js +15 -94
- package/views/dist/editors/TextEditor.d.ts +23 -26
- package/views/dist/editors/TextEditor.js +11 -48
- package/views/dist/editors/ValueListEditor.d.ts +14 -23
- package/views/dist/editors/ValueListEditor.js +16 -202
- package/views/dist/editors/body-panel.d.ts +13 -7
- package/views/dist/editors/body-panel.js +3 -7
- package/views/dist/editors/edit-cores.d.ts +15 -15
- package/views/dist/editors/edit-cores.js +14 -14
- package/views/dist/editors/number-body.d.ts +1 -1
- package/views/dist/editors/number-step.d.ts +0 -34
- package/views/dist/editors/number-step.js +0 -37
- package/views/dist/editors/option-add-flow.d.ts +1 -13
- package/views/dist/editors/option-add-flow.js +0 -22
- package/views/dist/editors/relation-links-body.d.ts +2 -3
- package/views/dist/editors/relation-picker.d.ts +13 -3
- package/views/dist/editors/relation-source.d.ts +0 -22
- package/views/dist/editors/relation-source.js +0 -21
- package/views/dist/field-row/FieldRow.js +5 -6
- package/views/dist/field-row/FieldRowLane.js +0 -1
- package/views/dist/field-row/editors/RowChipsEditor.js +2 -2
- package/views/dist/field-row/editors/RowDateEditor.d.ts +2 -2
- package/views/dist/field-row/editors/RowDateEditor.js +2 -2
- package/views/dist/field-row/editors/RowNameEditor.d.ts +2 -5
- package/views/dist/field-row/editors/RowNameEditor.js +7 -12
- package/views/dist/field-row/editors/RowNumberEditor.d.ts +1 -1
- package/views/dist/field-row/editors/RowNumberEditor.js +4 -4
- package/views/dist/field-row/editors/RowPlaceEditor.js +3 -3
- package/views/dist/field-row/editors/RowRangeEditor.d.ts +2 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +7 -14
- package/views/dist/field-row/editors/RowRelationEditor.js +3 -3
- package/views/dist/field-row/editors/RowSelectEditor.js +2 -2
- package/views/dist/field-row/editors/RowTextEditor.d.ts +1 -1
- package/views/dist/field-row/editors/RowTextEditor.js +3 -4
- package/views/dist/field-row/editors/RowValueListEditor.js +5 -5
- package/views/dist/field-row/field-row-button.d.ts +6 -9
- package/views/dist/field-row/field-row-button.js +1 -6
- package/views/dist/field-row/field-row-checkbox.d.ts +1 -1
- package/views/dist/field-row/row-target.d.ts +0 -7
- package/views/dist/field-row/row-target.js +0 -2
- package/views/dist/grid/chrome/GridAddColumn.d.ts +2 -1
- package/views/dist/grid/chrome/GridAddColumn.js +8 -66
- package/views/dist/grid/chrome/GridAggregateMenu.d.ts +5 -7
- package/views/dist/grid/chrome/GridAggregateMenu.js +20 -39
- package/views/dist/grid/chrome/GridCellEditors.d.ts +2 -2
- package/views/dist/grid/chrome/GridCellEditors.js +12 -12
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -3
- package/views/dist/grid/chrome/GridColumnMenu.d.ts +11 -12
- package/views/dist/grid/chrome/GridColumnMenu.js +32 -93
- package/views/dist/grid/chrome/GridDateEditor.d.ts +6 -6
- package/views/dist/grid/chrome/GridDateEditor.js +3 -3
- package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -6
- package/views/dist/grid/chrome/GridGroupMenu.js +21 -62
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -2
- package/views/dist/grid/chrome/GridHeader.js +2 -2
- package/views/dist/grid/chrome/GridLongTextEditor.d.ts +17 -38
- package/views/dist/grid/chrome/GridLongTextEditor.js +6 -7
- package/views/dist/grid/chrome/GridNameEditor.js +4 -4
- package/views/dist/grid/chrome/GridNumberEditor.d.ts +4 -5
- package/views/dist/grid/chrome/GridNumberEditor.js +3 -4
- package/views/dist/grid/chrome/GridPlaceEditor.d.ts +2 -5
- package/views/dist/grid/chrome/GridPlaceEditor.js +5 -5
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +6 -12
- package/views/dist/grid/chrome/GridRangeEditor.js +7 -15
- package/views/dist/grid/chrome/GridRelationEditor.js +5 -5
- package/views/dist/grid/chrome/GridRow.js +0 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +1 -1
- package/views/dist/grid/chrome/GridRowActions.js +0 -5
- package/views/dist/grid/chrome/GridRowCells.js +9 -6
- package/views/dist/grid/chrome/GridSelectEditor.js +3 -3
- package/views/dist/grid/chrome/GridStructure.js +0 -1
- package/views/dist/grid/chrome/GridTable.js +1 -1
- package/views/dist/grid/chrome/GridTextEditor.d.ts +5 -7
- package/views/dist/grid/chrome/GridTextEditor.js +4 -17
- package/views/dist/grid/chrome/GridValueListEditor.js +4 -4
- package/views/dist/grid/chrome/grid-body-place.d.ts +2 -3
- package/views/dist/grid/chrome/grid-body-place.js +4 -8
- package/views/dist/grid/chrome/grid-button.d.ts +7 -10
- package/views/dist/grid/chrome/grid-button.js +1 -6
- package/views/dist/grid/chrome/grid-cell-classes.js +1 -1
- package/views/dist/grid/chrome/grid-column-menu-items.d.ts +4 -4
- package/views/dist/grid/chrome/grid-column-menu-items.js +10 -6
- package/views/dist/grid/chrome/grid-group-menu-parts.d.ts +5 -9
- package/views/dist/grid/chrome/grid-group-menu-parts.js +1 -3
- package/views/dist/grid/chrome/grid-hover.js +0 -1
- package/views/dist/grid/chrome/grid-menu-focus.d.ts +7 -31
- package/views/dist/grid/chrome/grid-menu-focus.js +7 -47
- package/views/dist/grid/chrome/grid-styles.d.ts +0 -3
- package/views/dist/grid/chrome/grid-styles.js +0 -1
- package/views/dist/grid/chrome/grid-table-props.d.ts +6 -10
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -4
- package/views/dist/grid/core/editing-controller.d.ts +2 -1
- package/views/dist/grid/core/editing-controller.js +10 -2
- package/views/dist/grid/core/refusal-sentence.d.ts +3 -0
- package/views/dist/grid/core/refusal-sentence.js +2 -2
- package/views/dist/grid/core/write-states.d.ts +3 -1
- package/views/dist/grid/core/write-states.js +6 -2
- package/views/dist/grid/grid.css +1 -1
- package/views/dist/model/body-frame.d.ts +0 -32
- package/views/dist/model/body-frame.js +1 -15
- package/views/dist/model/column-inspect.d.ts +5 -5
- package/views/dist/model/column-inspect.js +2 -2
- package/views/dist/panels/customize-body.d.ts +1 -10
- package/views/dist/panels/customize-body.js +0 -3
- package/views/dist/panels/filter/MenuSelect.js +0 -5
- package/views/dist/panels/filter/RangeFilterBody.js +0 -1
- package/views/dist/panels/filter/details.d.ts +1 -5
- package/views/dist/panels/filter/details.js +0 -13
- package/views/dist/panels/filter/filter-list.d.ts +0 -1
- package/views/dist/panels/filter/filter-list.js +1 -1
- package/views/dist/panels/panel-button.d.ts +10 -12
- package/views/dist/panels/panel-button.js +1 -6
- package/views/dist/panels/react/chrome.d.ts +0 -17
- package/views/dist/panels/react/chrome.js +0 -8
- package/views/dist/panels/react/customize-body.d.ts +9 -12
- package/views/dist/panels/react/customize-body.js +57 -11
- package/views/dist/panels/react/customize.d.ts +9 -12
- package/views/dist/panels/react/customize.js +3 -112
- package/views/dist/panels/react/filter/FilterEditor.d.ts +4 -18
- package/views/dist/panels/react/filter/FilterEditor.js +6 -330
- package/views/dist/panels/react/filter/FilterFieldList.d.ts +1 -1
- package/views/dist/panels/react/filter/FilterFieldList.js +27 -59
- package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +1 -11
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +8 -144
- package/views/dist/panels/react/filter/editor-ctx.d.ts +1 -33
- package/views/dist/panels/react/filter/editor-ctx.js +5 -33
- package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -6
- package/views/dist/panels/react/filter/filter-part-body.js +0 -5
- package/views/dist/panels/react/filter/rule-writes.d.ts +1 -26
- package/views/dist/panels/react/filter/rule-writes.js +4 -95
- package/views/dist/panels/react/order-details.d.ts +1 -26
- package/views/dist/panels/react/order-details.js +3 -69
- package/views/dist/panels/react/panel-header.js +0 -1
- package/views/dist/panels/react/popover.d.ts +4 -7
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +2 -4
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +16 -137
- package/views/dist/panels/react/sort/SortEditor.d.ts +4 -4
- package/views/dist/panels/react/sort/SortEditor.js +8 -245
- package/views/dist/panels/react/sort/SortFieldList.d.ts +1 -1
- package/views/dist/panels/react/sort/SortFieldList.js +11 -25
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -16
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +0 -4
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +0 -1
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +3 -3
- package/views/dist/panels/react/view-actions.js +0 -1
- package/views/dist/panels/react/views-row/FoldingViewRow.js +2 -5
- package/views/dist/panels/react/views-row/ViewCreatePill.js +0 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +7 -43
- package/views/dist/panels/react/views-row/ViewPickerRow.js +0 -2
- package/views/dist/panels/react/views-row/menu-classes.d.ts +0 -4
- package/views/dist/panels/react/views-row/menu-classes.js +0 -2
- package/views/dist/panels/react.d.ts +5 -12
- package/views/dist/panels/react.js +5 -12
- package/views/dist/provider/ViewsProvider.d.ts +2 -46
- package/views/dist/provider/ViewsProvider.js +2 -22
- package/views/dist/provider/components.d.ts +153 -106
- package/views/dist/provider/context.d.ts +1 -21
- package/views/dist/provider/missing-slot.d.ts +3 -7
- package/views/dist/provider/missing-slot.js +2 -9
- package/views/dist/react.d.ts +1 -2
- package/views/dist/selection/SelectionBar.js +2 -3
- package/views/dist/styles.css +40 -168
- package/views/dist/styles.unlayered.css +40 -168
- package/views/docs/contract.md +99 -123
- package/views/docs/getting-started.md +222 -2
- package/views/docs/guides/cells.md +222 -2
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/editors.md +235 -20
- package/views/docs/guides/ports.md +1 -1
- package/views/docs/guides/selection.md +1 -1
- package/views/docs/guides/the-grid.md +14 -16
- package/views/docs/guides/the-provider.md +9 -15
- package/views/docs/reference/cells.md +1 -1
- package/views/docs/reference/controls.md +26 -13
- package/views/docs/reference/editors-chips.md +2 -2
- package/views/docs/reference/editors-date.md +4 -4
- package/views/docs/reference/editors-location.md +4 -7
- package/views/docs/reference/editors-name.md +3 -5
- package/views/docs/reference/editors-number.md +10 -10
- package/views/docs/reference/editors-panel.md +3 -3
- package/views/docs/reference/editors-range.md +3 -5
- package/views/docs/reference/editors-relation.md +4 -4
- package/views/docs/reference/editors-select.md +3 -3
- package/views/docs/reference/editors-text.md +3 -4
- package/views/docs/reference/editors-value-list.md +3 -3
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +2 -2
- package/views/docs/reference/panels-react.md +20 -34
- package/views/docs/reference/react.md +11 -18
- package/views/docs/reference/views.md +5 -5
- package/views/skills/views/SKILL.md +1 -1
- package/views/dist/editors/relation-panel.d.ts +0 -69
- package/views/dist/editors/relation-panel.js +0 -46
- package/views/dist/grid/chrome/GridColumnColorSection.d.ts +0 -13
- package/views/dist/grid/chrome/GridColumnColorSection.js +0 -40
- package/views/dist/grid/chrome/GridColumnDateSection.d.ts +0 -28
- package/views/dist/grid/chrome/GridColumnDateSection.js +0 -23
- package/views/dist/grid/chrome/GridColumnDurationSection.d.ts +0 -23
- package/views/dist/grid/chrome/GridColumnDurationSection.js +0 -24
- package/views/dist/grid/chrome/GridColumnNumberSection.d.ts +0 -29
- package/views/dist/grid/chrome/GridColumnNumberSection.js +0 -27
- package/views/dist/grid/chrome/GridColumnPercentSection.d.ts +0 -16
- package/views/dist/grid/chrome/GridColumnPercentSection.js +0 -16
- package/views/dist/grid/chrome/GridColumnSortSection.d.ts +0 -38
- package/views/dist/grid/chrome/GridColumnSortSection.js +0 -33
- package/views/dist/grid/chrome/GridFlyout.d.ts +0 -44
- package/views/dist/grid/chrome/GridFlyout.js +0 -80
- package/views/dist/grid/chrome/GridMenuRow.d.ts +0 -15
- package/views/dist/grid/chrome/GridMenuRow.js +0 -15
- package/views/dist/grid/chrome/grid-menu-search.d.ts +0 -7
- package/views/dist/grid/chrome/grid-menu-search.js +0 -7
- package/views/dist/panels/react/GroupBucketsList.d.ts +0 -16
- package/views/dist/panels/react/GroupBucketsList.js +0 -44
- package/views/dist/panels/react/LayoutColumnsList.d.ts +0 -24
- package/views/dist/panels/react/LayoutColumnsList.js +0 -101
- package/views/dist/panels/react/PopoverColumnDetail.d.ts +0 -11
- package/views/dist/panels/react/PopoverColumnDetail.js +0 -24
- package/views/dist/panels/react/drag.d.ts +0 -2
- package/views/dist/panels/react/drag.js +0 -5
- package/views/dist/panels/react/layout-detail.d.ts +0 -4
- package/views/dist/panels/react/layout-detail.js +0 -29
- package/views/dist/panels/react/root-list.d.ts +0 -6
- package/views/dist/panels/react/root-list.js +0 -31
- package/views/dist/panels/react/sort/use-sort-drag.d.ts +0 -17
- package/views/dist/panels/react/sort/use-sort-drag.js +0 -39
- package/views/dist/panels/react/view-footer.d.ts +0 -20
- package/views/dist/panels/react/view-footer.js +0 -41
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ViewsContext } from "../../provider/context.js";
|
|
5
|
+
import { MenuList, MenuListPanelRows } from "../menu-list/menu-list.js";
|
|
6
|
+
const CUSTOM = "\u0000custom";
|
|
7
|
+
function Month({ from, to, onSelect, minNights }) {
|
|
8
|
+
const views = React.useContext(ViewsContext);
|
|
9
|
+
if (!views)
|
|
10
|
+
return null;
|
|
11
|
+
const RangeCalendar = views.atoms.RangeCalendar;
|
|
12
|
+
return _jsx(RangeCalendar, { mode: "range", from: from, to: to, onSelect: onSelect, locale: views.conventions.locale, ...(minNights !== undefined && { minNights }) });
|
|
13
|
+
}
|
|
14
|
+
export function useTimeRange(time, label, phone) {
|
|
15
|
+
const [custom, setCustom] = React.useState(false);
|
|
16
|
+
const back = React.useCallback(() => setCustom(false), []);
|
|
17
|
+
const on = time?.custom?.on === true;
|
|
18
|
+
const open = React.useCallback(() => setCustom(on), [on]);
|
|
19
|
+
const level = time?.custom && custom ? { name: time.custom.label, back } : null;
|
|
20
|
+
const body = (done) => {
|
|
21
|
+
if (!time)
|
|
22
|
+
return null;
|
|
23
|
+
if (time.custom && custom)
|
|
24
|
+
return _jsx(Month, { from: time.custom.from, to: time.custom.to, minNights: 1, onSelect: time.custom.onPress });
|
|
25
|
+
const c = time.custom;
|
|
26
|
+
const rows = [{ kind: "pick", value: c?.on ? CUSTOM : time.value,
|
|
27
|
+
choices: [...time.options.map((o) => ({ value: o.value, label: o.label })), ...(c ? [{ value: CUSTOM, label: c.label, ...(c.says !== undefined && { detail: c.says }) }] : [])],
|
|
28
|
+
onChoose: (v) => { if (v === CUSTOM) {
|
|
29
|
+
setCustom(true);
|
|
30
|
+
return;
|
|
31
|
+
} if (v !== time.value)
|
|
32
|
+
time.onChange(v); done(); } }];
|
|
33
|
+
return phone ? _jsx(MenuList, { label: label, entries: rows }) : _jsx(MenuListPanelRows, { label: label, entries: rows });
|
|
34
|
+
};
|
|
35
|
+
return { body, level, open };
|
|
36
|
+
}
|
|
37
|
+
export function DateRangeBody({ dates, clear, phone }) {
|
|
38
|
+
const standing = dates.from != null || dates.to != null;
|
|
39
|
+
const rows = [{ icon: null, label: clear, onSelect: () => dates.onChange({ from: null, to: null }) }];
|
|
40
|
+
return (_jsxs(_Fragment, { children: [_jsx(Month, { from: dates.from, to: dates.to, onSelect: (next) => dates.onChange(next) }), standing && (phone ? _jsx(MenuList, { label: clear, entries: rows }) : _jsx(MenuListPanelRows, { label: clear, entries: rows }))] }));
|
|
41
|
+
}
|
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import type { CustomizeChoice, CustomizeToggle } from "./customize.js";
|
|
2
3
|
import type { CustomizeWords } from "./words.js";
|
|
3
|
-
/** A column of the view: its id, its name, whether it is shown, whether it is locked (always shown, never moved), its type's mark
|
|
4
|
+
/** A column of the view: its id, its name, whether it is shown, whether it is locked (always shown, never moved), its type's mark;
|
|
5
|
+
* and what opens one level in from its row (VK-890): its own settings, and the app's rows for its field (Edit field, Archive
|
|
6
|
+
* field) under them. On a card layout, `line`: whether it starts a new line on the card, and why it can't where it can't. */
|
|
4
7
|
export interface CustomizeColumn {
|
|
5
8
|
id: string;
|
|
6
9
|
label: string;
|
|
7
10
|
shown: boolean;
|
|
8
11
|
locked?: boolean;
|
|
9
12
|
mark?: ReactNode;
|
|
13
|
+
settings?: {
|
|
14
|
+
choices: CustomizeChoice[];
|
|
15
|
+
toggles: CustomizeToggle[];
|
|
16
|
+
};
|
|
17
|
+
rows?: ReactNode;
|
|
18
|
+
line?: {
|
|
19
|
+
on: boolean;
|
|
20
|
+
refused?: string;
|
|
21
|
+
};
|
|
10
22
|
}
|
|
23
|
+
/** Whether a column opens a level of its own: it has a choice, a toggle or the app's rows. */
|
|
24
|
+
export declare const columnOpens: (c: CustomizeColumn) => boolean;
|
|
25
|
+
/** Whether a column has settings of its own: a choice or a toggle. */
|
|
26
|
+
export declare const columnOpensBySettings: (c: CustomizeColumn) => boolean;
|
|
11
27
|
/** What the Columns section says on Customize's list: how many are shown ("6 shown"), in the handed words. */
|
|
12
28
|
export declare const columnsSay: (columns: CustomizeColumn[], words?: Pick<CustomizeWords, "shown">) => string;
|
|
13
29
|
/** The columns with one shown or hidden, in its place; a locked column stays shown. */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export const columnOpens = (c) => columnOpensBySettings(c) || !(c.rows == null || typeof c.rows === "boolean" || c.rows === "");
|
|
2
|
+
export const columnOpensBySettings = (c) => (c.settings?.choices.length ?? 0) > 0 || (c.settings?.toggles.length ?? 0) > 0;
|
|
1
3
|
export const columnsSay = (columns, words) => {
|
|
2
4
|
const n = columns.filter((c) => c.shown).length;
|
|
3
5
|
return words ? words.shown(n) : `${n} shown`;
|
|
@@ -50,6 +50,13 @@ export interface CustomizeWords {
|
|
|
50
50
|
toggleReset: (label: string) => string;
|
|
51
51
|
/** The shared view moved after the reader's changes began. */
|
|
52
52
|
stale: string;
|
|
53
|
+
/** A column's own level (VK-890): its Shown row, the name of the › that opens it, and its new-line Toggle's two names. */
|
|
54
|
+
columnShown: string;
|
|
55
|
+
columnSettings: (label: string) => string;
|
|
56
|
+
newLineOn: (label: string) => string;
|
|
57
|
+
newLineStart: (label: string) => string;
|
|
58
|
+
/** A per-field filter's screen with nothing to pick (VK-891). */
|
|
59
|
+
nothingToPick: string;
|
|
53
60
|
/** The rows' own words (the Menu list's: a column's grip, how the columns move, a Switch's two words). */
|
|
54
61
|
rows?: Partial<MenuListWords>;
|
|
55
62
|
}
|
|
@@ -33,5 +33,10 @@ export const CUSTOMIZE_WORDS = {
|
|
|
33
33
|
columnsReset: "Reset columns",
|
|
34
34
|
toggleReset: (label) => `Reset ${label}`,
|
|
35
35
|
stale: "Everyone's view changed since you started.",
|
|
36
|
+
columnShown: "Shown",
|
|
37
|
+
columnSettings: (label) => `${label} settings`,
|
|
38
|
+
newLineOn: (label) => `${label} starts a new line`,
|
|
39
|
+
newLineStart: (label) => `Start a new line at ${label}`,
|
|
40
|
+
nothingToPick: "Nothing to pick",
|
|
36
41
|
};
|
|
37
42
|
export const customizeWords = (given) => (given ? { ...CUSTOMIZE_WORDS, ...given } : CUSTOMIZE_WORDS);
|
|
@@ -46,6 +46,9 @@
|
|
|
46
46
|
[data-customize-form="phone"] .o-customize-heading-words { margin-top: calc(var(--vk-spacing) * 2); padding: 0 calc(var(--vk-spacing) * 1); font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); }
|
|
47
47
|
[data-customize-form="phone"] .o-customize-heading > .o-customize-heading-words { padding: 0; }
|
|
48
48
|
|
|
49
|
+
/* ── A column's own level (VK-890): the app's rows for its field under its settings, a line over them; the app's rows under Columns' ── */
|
|
50
|
+
.o-customize-rows, .o-customize-foot-rows { display: flex; flex-direction: column; min-width: 0; }
|
|
51
|
+
|
|
49
52
|
/* ── Nothing found by a search ── */
|
|
50
53
|
.o-customize-none { margin: 0; padding: calc(var(--vk-spacing) * 2); font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); color: var(--vk-fg-subtle); }
|
|
51
54
|
|
|
@@ -54,5 +54,7 @@ export interface FilterEditorParts {
|
|
|
54
54
|
}
|
|
55
55
|
/** The filter editor's state and the parts a shell pours in. */
|
|
56
56
|
export declare function useFilterEditor(props: FilterEditorProps): FilterEditorParts;
|
|
57
|
+
/** @deprecated `useFilterEditor`, under the name the controls door gave it until the panels' older filter editor took a host's name. */
|
|
58
|
+
export declare const useFilterEditorParts: typeof useFilterEditor;
|
|
57
59
|
/** The body alone, for a shell that holds only a body (the Popover). */
|
|
58
60
|
export declare function FilterEditor(props: FilterEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -245,6 +245,7 @@ export function useFilterEditor(props) {
|
|
|
245
245
|
const body = (_jsx("div", { ref: placeRoot, className: "o-filter-editor", "data-kit": "filter-editor", "data-filter-form": "computer", role: "group", "aria-label": label, tabIndex: -1, "data-filter-fields": fieldsAlone ? "" : undefined, style: room ? { paddingBottom: room } : undefined, ...phoneMark(!!screen || small), children: !fieldsAlone ? _jsxs(_Fragment, { children: [top, level(filter, 0), _jsxs("div", { className: "o-filter-editor-foot", children: [addButton(filter.id, "outline", "sm"), _jsx(Button, { kind: "quiet", size: "sm", className: "o-filter-editor-clear", onClick: clear, children: w.clearAllFilters }), props.excludable && groupMore(filter)] }), addingPopover] }) : (_jsx(Picker, { label: label, items: fields, value: null, onValueChange: (v) => add(filter.id, v), search: w.search, searchShown: true, form: "computer", ...words })) }));
|
|
246
246
|
return { body, head: {} };
|
|
247
247
|
}
|
|
248
|
+
export const useFilterEditorParts = useFilterEditor;
|
|
248
249
|
export function FilterEditor(props) {
|
|
249
250
|
return _jsx(_Fragment, { children: useFilterEditor(props).body });
|
|
250
251
|
}
|
|
@@ -96,8 +96,7 @@ export declare const setQuantifier: (f: FilterGroup, id: string, quantifier: Qua
|
|
|
96
96
|
/** The rule `ruleId`, on a related field and not inside a block, turned into a block of that relation with `quantifier`, holding
|
|
97
97
|
* it, its id never one in the filter or in `taken`; anything else, or a rule `levels` deep, stays. "any" changes nothing. */
|
|
98
98
|
export declare function toBlock(f: FilterGroup, ruleId: string, quantifier: Quantifier, fields: FilterField[], taken?: readonly string[], levels?: number): FilterGroup;
|
|
99
|
-
/** Whether Every fits a block's rules: at least one of them, at any depth, is whole (isWhole) and not set aside
|
|
100
|
-
* everyBlocked counts. */
|
|
99
|
+
/** Whether Every fits a block's rules: at least one of them, at any depth, is whole (isWhole) and not set aside. */
|
|
101
100
|
export declare const everyFits: (rules: FilterItem[], fields: FilterField[]) => boolean;
|
|
102
101
|
/** A set-aside rule put back: its `aside` dropped, so it is written as a rule again; anything else stays. */
|
|
103
102
|
export declare function putBack(f: FilterGroup, id: string): FilterGroup;
|
|
@@ -56,7 +56,7 @@ export { filledMatch } from "./select/filled.js";
|
|
|
56
56
|
export { Pane, PaneBody, PaneClose, PaneFoot, PaneHead, PaneTitle, paneAfter, usePane, type PaneChangeDetails, type PaneCloseReason, type PanePress, type PaneProps, type PaneState } from "./pane/pane.js";
|
|
57
57
|
export { InToolbar, ToolbarButtonControl, useToolbarButtonWorn, type ToolbarButtonGround, type ToolbarButtonProps, type ToolbarButtonSize, type ToolbarButtonSmoothing, type ToolbarButtonWords, } from "./toolbar-button/toolbar-button.js";
|
|
58
58
|
export { Radio, RadioGroup, type RadioGroupProps, type RadioProps } from "./radio/radio.js";
|
|
59
|
-
export { sortableFields, useSortEditor as useSortEditorParts, type SortEditorOpens, type SortEditorParts, type SortEditorProps } from "./sort-editor/sort-editor.js";
|
|
59
|
+
export { SortEditor, sortableFields, useSortEditor, useSortEditor as useSortEditorParts, type SortEditorOpens, type SortEditorParts, type SortEditorProps } from "./sort-editor/sort-editor.js";
|
|
60
60
|
export { SORT_MAX, addSort, canAddSort, dropAside, openPlaces, putBack, repoint, sortLabel, sortedFields, takenBy, type FieldOf, type SortAside } from "./sort-editor/rules.js";
|
|
61
61
|
export { SORT_EDITOR_WORDS, sortWords, type SortEditorWords } from "./sort-editor/words.js";
|
|
62
62
|
export { LOCK, useViewsList, useViewsListWorn, ViewsList, type ViewsListParts } from "./views-list/views-list.js";
|
|
@@ -64,15 +64,15 @@ export { canDelete, columnsLabel, copyName, deleteLine, JUST_ME, listed, SHARED,
|
|
|
64
64
|
export { VIEWS_LIST_ATTRS, viewsListWornOf, type ViewsListWorn } from "./views-list/looks.js";
|
|
65
65
|
export { VIEW_MENU_WORDS, VIEWS_LIST_WORDS, viewsListWords, type ViewMenuWords, type ViewsListWords } from "./views-list/words.js";
|
|
66
66
|
export { useViewMenu, type ViewMenuAsk, type ViewMenuParts, type ViewMenuProps, type ViewMenuShows, type ViewMenuStep } from "./views-list/view-menu.js";
|
|
67
|
-
export { useFilterEditor
|
|
67
|
+
export { FilterEditor, useFilterEditor, useFilterEditorParts, type FilterEditorParts, type FilterEditorProps, type FilterOwn } from "./filter-editor/filter-editor.js";
|
|
68
68
|
export { FILTER_SEARCH, FilterPartBody, PairValue, valuePlaceholder, type FilterPart, type FilterPartProps } from "./filter-editor/parts.js";
|
|
69
69
|
export { CHECKED, HOW, wayOf, type FilterField, type FilterWay, type Takes } from "./filter-editor/how.js";
|
|
70
|
-
export { FILTER_DEPTH, NO_FILTER, OWN_WAY, addRule, barOf, canGroup, changeRule, clearAll, depthOf, fieldOf, idsOf, isAdvanced, isGroup, isOwnWay, isPair, isSetAside, isWhole, itemOf, removeRule, ruleText, rulesOf, setGroup, setJoin, takesOf, toAdvanced, toGroup, valueText, type BarFilter, type FilterAside } from "./filter-editor/rules.js";
|
|
70
|
+
export { FILTER_DEPTH, NO_FILTER, OWN_WAY, addRule, barOf, canGroup, changeRule, clearAll, depthOf, fieldOf, idsOf, isAdvanced, isGroup, isOwnWay, isPair, isSetAside, isWhole, itemOf, putBack as putFilterBack, removeRule, ruleText, rulesOf, setGroup, setJoin, takesOf, toAdvanced, toGroup, valueText, type BarFilter, type FilterAside, type FilterItem } from "./filter-editor/rules.js";
|
|
71
71
|
export { FILTER_EDITOR_WORDS, filterWords, type FilterEditorWords } from "./filter-editor/words.js";
|
|
72
|
-
export { useGroupEditor, type GroupEditorLevel, type GroupEditorParts, type GroupEditorProps, type GroupEditorValue } from "./group-editor/group-editor.js";
|
|
72
|
+
export { GroupEditor, useGroupEditor, type GroupEditorLevel, type GroupEditorParts, type GroupEditorProps, type GroupEditorValue } from "./group-editor/group-editor.js";
|
|
73
73
|
export { directionTurns, groupLabel, groupOrders, hideAllGroups, moveGroup, noneShown, orderedGroups, setGroupShown, showAllGroups, startGroup, type GroupDirection, type GroupOrder, type GroupValue } from "./group-editor/rules.js";
|
|
74
74
|
export { GROUP_EDITOR_WORDS, groupWords, type GroupEditorWords } from "./group-editor/words.js";
|
|
75
|
-
export { layoutMark, useCustomize, useCustomizeWorn, type CustomizeChoice, type CustomizeLayout, type CustomizeLayoutSettings, type CustomizeParts, type CustomizeProps, type CustomizeScreen, type CustomizeSection, type CustomizeToggle, type CustomizeView } from "./customize/customize.js";
|
|
75
|
+
export { Customize, layoutMark, useCustomize, useCustomizeWorn, type CustomizeChoice, type CustomizeField, type CustomizeLayout, type CustomizeLayoutSettings, type CustomizeParts, type CustomizeProps, type CustomizeScreen, type CustomizeSection, type CustomizeToggle, type CustomizeView } from "./customize/customize.js";
|
|
76
76
|
export { columnsSay, findColumns, hideAll, moveColumn, setShown, showAll, type CustomizeColumn } from "./customize/rules.js";
|
|
77
77
|
export { reduced, slideTime, useGlide } from "./customize/glide.js";
|
|
78
78
|
export { CUSTOMIZE_ATTRS, customizeWornOf, type CustomizeWorn } from "./customize/looks.js";
|
|
@@ -98,13 +98,13 @@ export { QUICK_FILTERS_REMINDER_WORDS, quickFiltersReminderWords, type QuickFilt
|
|
|
98
98
|
export { BulkBar, useBulkBarWorn, type BulkBarProps, type BulkDone, type BulkNoun, type BulkRun, type BulkVerb, type BulkVerbItem } from "./bulk-bar/bulk-bar.js";
|
|
99
99
|
export { BULK_BAR_ATTRS, bulkBarWornOf } from "./bulk-bar/looks.js";
|
|
100
100
|
export { BULK_BAR_WORDS, bulkBarWords, type BulkBarWords } from "./bulk-bar/words.js";
|
|
101
|
-
export { useTextEditor, type TextEditorParts } from "./text-editor/text-editor.js";
|
|
101
|
+
export { TextEditor, useTextEditor, type TextEditorParts, type TextEditorProps } from "./text-editor/text-editor.js";
|
|
102
102
|
export { TEXT_KEYS, enterDoes, kept, lineOf, midWord, ownChange, textRefusal, tidy, type TextKeys, type TextKind } from "./text-editor/check.js";
|
|
103
103
|
export { DIALS, countryName, dialOf, exampleOf, patternOf, phoneHanded, phoneOf, phoneParts, type Dial } from "./text-editor/phone-number.js";
|
|
104
104
|
export { TEXT_EDITOR_ATTRS, textEditorWornOf, type TextEditorWorn } from "./text-editor/looks.js";
|
|
105
105
|
export { TEXT_EDITOR_WORDS, textWords, type TextEditorWords } from "./text-editor/words.js";
|
|
106
106
|
export { pickerItemsOf } from "./picker/map-picker.js";
|
|
107
|
-
export { useDateEditor, useDateEditorWorn, type DateEditorParts, type DateEditorProps } from "./date-editor/date-editor.js";
|
|
107
|
+
export { DateEditor, useDateEditor, useDateEditorWorn, type DateEditorParts, type DateEditorProps } from "./date-editor/date-editor.js";
|
|
108
108
|
export { DateParts, type DatePartsProps } from "./date-editor/date-parts.js";
|
|
109
109
|
export { DateDays, type DateDaysProps } from "./date-editor/date-days.js";
|
|
110
110
|
export { DATE_ERROR_WORDS, MONTH_NAMES, QUARTERS, WEEK, addDays, addMonths, cellText, dateNames, iso, lineDay, lineText, monthGrid, parts, quickPick, readDate, readTime, todayOf, weekday, type DateErrorWords, type DateNames, type DatePick } from "./date-editor/calendar.js";
|
|
@@ -118,7 +118,7 @@ export type { Range } from "./compound-editor/range.js";
|
|
|
118
118
|
export { compoundEditorRead, compoundEditorWornOf, type CompoundEditorWorn } from "./compound-editor/looks.js";
|
|
119
119
|
export { COMPOUND_EDITOR_WORDS, compoundWords, type CompoundEditorWords } from "./compound-editor/words.js";
|
|
120
120
|
export { Flag } from "./flag/flag.js";
|
|
121
|
-
export { useNumberEditor, useNumberEditorWorn, type NumberEditorParts, type NumberEditorProps } from "./number-editor/number-editor.js";
|
|
121
|
+
export { NumberEditor, useNumberEditor, useNumberEditorWorn, type NumberEditorParts, type NumberEditorProps } from "./number-editor/number-editor.js";
|
|
122
122
|
export { boxLocale, numberText, readTyped, type Currency, type NumberKind, type Unit, type Units } from "./number-editor/format.js";
|
|
123
123
|
export { NUMBER_EDITOR_ATTRS, numberEditorWornOf, type NumberEditorWorn } from "./number-editor/looks.js";
|
|
124
124
|
export { NUMBER_EDITOR_WORDS, numberWords, type NumberEditorWords } from "./number-editor/words.js";
|
|
@@ -50,7 +50,7 @@ export { filledMatch } from "./select/filled.js";
|
|
|
50
50
|
export { Pane, PaneBody, PaneClose, PaneFoot, PaneHead, PaneTitle, paneAfter, usePane } from "./pane/pane.js";
|
|
51
51
|
export { InToolbar, ToolbarButtonControl, useToolbarButtonWorn, } from "./toolbar-button/toolbar-button.js";
|
|
52
52
|
export { Radio, RadioGroup } from "./radio/radio.js";
|
|
53
|
-
export { sortableFields, useSortEditor as useSortEditorParts } from "./sort-editor/sort-editor.js";
|
|
53
|
+
export { SortEditor, sortableFields, useSortEditor, useSortEditor as useSortEditorParts } from "./sort-editor/sort-editor.js";
|
|
54
54
|
export { SORT_MAX, addSort, canAddSort, dropAside, openPlaces, putBack, repoint, sortLabel, sortedFields, takenBy } from "./sort-editor/rules.js";
|
|
55
55
|
export { SORT_EDITOR_WORDS, sortWords } from "./sort-editor/words.js";
|
|
56
56
|
export { LOCK, useViewsList, useViewsListWorn, ViewsList } from "./views-list/views-list.js";
|
|
@@ -58,15 +58,15 @@ export { canDelete, columnsLabel, copyName, deleteLine, JUST_ME, listed, SHARED,
|
|
|
58
58
|
export { VIEWS_LIST_ATTRS, viewsListWornOf } from "./views-list/looks.js";
|
|
59
59
|
export { VIEW_MENU_WORDS, VIEWS_LIST_WORDS, viewsListWords } from "./views-list/words.js";
|
|
60
60
|
export { useViewMenu } from "./views-list/view-menu.js";
|
|
61
|
-
export { useFilterEditor
|
|
61
|
+
export { FilterEditor, useFilterEditor, useFilterEditorParts } from "./filter-editor/filter-editor.js";
|
|
62
62
|
export { FILTER_SEARCH, FilterPartBody, PairValue, valuePlaceholder } from "./filter-editor/parts.js";
|
|
63
63
|
export { CHECKED, HOW, wayOf } from "./filter-editor/how.js";
|
|
64
|
-
export { FILTER_DEPTH, NO_FILTER, OWN_WAY, addRule, barOf, canGroup, changeRule, clearAll, depthOf, fieldOf, idsOf, isAdvanced, isGroup, isOwnWay, isPair, isSetAside, isWhole, itemOf, removeRule, ruleText, rulesOf, setGroup, setJoin, takesOf, toAdvanced, toGroup, valueText } from "./filter-editor/rules.js";
|
|
64
|
+
export { FILTER_DEPTH, NO_FILTER, OWN_WAY, addRule, barOf, canGroup, changeRule, clearAll, depthOf, fieldOf, idsOf, isAdvanced, isGroup, isOwnWay, isPair, isSetAside, isWhole, itemOf, putBack as putFilterBack, removeRule, ruleText, rulesOf, setGroup, setJoin, takesOf, toAdvanced, toGroup, valueText } from "./filter-editor/rules.js";
|
|
65
65
|
export { FILTER_EDITOR_WORDS, filterWords } from "./filter-editor/words.js";
|
|
66
|
-
export { useGroupEditor } from "./group-editor/group-editor.js";
|
|
66
|
+
export { GroupEditor, useGroupEditor } from "./group-editor/group-editor.js";
|
|
67
67
|
export { directionTurns, groupLabel, groupOrders, hideAllGroups, moveGroup, noneShown, orderedGroups, setGroupShown, showAllGroups, startGroup } from "./group-editor/rules.js";
|
|
68
68
|
export { GROUP_EDITOR_WORDS, groupWords } from "./group-editor/words.js";
|
|
69
|
-
export { layoutMark, useCustomize, useCustomizeWorn } from "./customize/customize.js";
|
|
69
|
+
export { Customize, layoutMark, useCustomize, useCustomizeWorn } from "./customize/customize.js";
|
|
70
70
|
export { columnsSay, findColumns, hideAll, moveColumn, setShown, showAll } from "./customize/rules.js";
|
|
71
71
|
export { reduced, slideTime, useGlide } from "./customize/glide.js";
|
|
72
72
|
export { CUSTOMIZE_ATTRS, customizeWornOf } from "./customize/looks.js";
|
|
@@ -91,13 +91,13 @@ export { QUICK_FILTERS_REMINDER_WORDS, quickFiltersReminderWords } from "./quick
|
|
|
91
91
|
export { BulkBar, useBulkBarWorn } from "./bulk-bar/bulk-bar.js";
|
|
92
92
|
export { BULK_BAR_ATTRS, bulkBarWornOf } from "./bulk-bar/looks.js";
|
|
93
93
|
export { BULK_BAR_WORDS, bulkBarWords } from "./bulk-bar/words.js";
|
|
94
|
-
export { useTextEditor } from "./text-editor/text-editor.js";
|
|
94
|
+
export { TextEditor, useTextEditor } from "./text-editor/text-editor.js";
|
|
95
95
|
export { TEXT_KEYS, enterDoes, kept, lineOf, midWord, ownChange, textRefusal, tidy } from "./text-editor/check.js";
|
|
96
96
|
export { DIALS, countryName, dialOf, exampleOf, patternOf, phoneHanded, phoneOf, phoneParts } from "./text-editor/phone-number.js";
|
|
97
97
|
export { TEXT_EDITOR_ATTRS, textEditorWornOf } from "./text-editor/looks.js";
|
|
98
98
|
export { TEXT_EDITOR_WORDS, textWords } from "./text-editor/words.js";
|
|
99
99
|
export { pickerItemsOf } from "./picker/map-picker.js";
|
|
100
|
-
export { useDateEditor, useDateEditorWorn } from "./date-editor/date-editor.js";
|
|
100
|
+
export { DateEditor, useDateEditor, useDateEditorWorn } from "./date-editor/date-editor.js";
|
|
101
101
|
export { DateParts } from "./date-editor/date-parts.js";
|
|
102
102
|
export { DateDays } from "./date-editor/date-days.js";
|
|
103
103
|
export { DATE_ERROR_WORDS, MONTH_NAMES, QUARTERS, WEEK, addDays, addMonths, cellText, dateNames, iso, lineDay, lineText, monthGrid, parts, quickPick, readDate, readTime, todayOf, weekday } from "./date-editor/calendar.js";
|
|
@@ -110,7 +110,7 @@ export { ATTIO_ROWS, PLACE_PARTS, countriesOf, placeLine, placeOf, placeText, re
|
|
|
110
110
|
export { compoundEditorRead, compoundEditorWornOf } from "./compound-editor/looks.js";
|
|
111
111
|
export { COMPOUND_EDITOR_WORDS, compoundWords } from "./compound-editor/words.js";
|
|
112
112
|
export { Flag } from "./flag/flag.js";
|
|
113
|
-
export { useNumberEditor, useNumberEditorWorn } from "./number-editor/number-editor.js";
|
|
113
|
+
export { NumberEditor, useNumberEditor, useNumberEditorWorn } from "./number-editor/number-editor.js";
|
|
114
114
|
export { boxLocale, numberText, readTyped } from "./number-editor/format.js";
|
|
115
115
|
export { NUMBER_EDITOR_ATTRS, numberEditorWornOf } from "./number-editor/looks.js";
|
|
116
116
|
export { NUMBER_EDITOR_WORDS, numberWords } from "./number-editor/words.js";
|
|
@@ -38,6 +38,20 @@ MenuAction
|
|
|
38
38
|
defaultChecked?: boolean;
|
|
39
39
|
onCheckedChange?: (checked: boolean) => void;
|
|
40
40
|
disabled?: string;
|
|
41
|
+
/** It opens a level of its own too (a column's settings, VK-890): the name of the › after its tick, which opens it, as → on
|
|
42
|
+
* the row does; Enter and Space still tick it. Its holder shows the level, handed the entry through `onOpen`. Drawn by
|
|
43
|
+
* `MenuListPanelRows` and `MenuList`; a menu's rows (`MenuListRows`, `MenuListShown`) leave it and `toggle` out. */
|
|
44
|
+
opens?: string;
|
|
45
|
+
/** One Toggle of its own before its tick (a card's field starting a new line, VK-890): its mark, its name, whether it is on
|
|
46
|
+
* and its press; `disabled` says why it can't be pressed, its tooltip, and a press writes nothing. The Toggle and the › keep
|
|
47
|
+
* working on a row that can't be ticked (`disabled`): a locked column's settings still open. */
|
|
48
|
+
toggle?: {
|
|
49
|
+
icon: React.ReactNode;
|
|
50
|
+
label: string;
|
|
51
|
+
on: boolean;
|
|
52
|
+
onPress: () => void;
|
|
53
|
+
disabled?: string;
|
|
54
|
+
};
|
|
41
55
|
}
|
|
42
56
|
/** A choice one level in: what it sets and what it is now; its choices open against the menu's edge. `detail` says what it is
|
|
43
57
|
* now in words of its own, in place of its choice's name (a colour's "Blue" while Automatic is ticked). */
|
|
@@ -137,7 +151,8 @@ export interface MenuListPanelRowsProps {
|
|
|
137
151
|
label: string;
|
|
138
152
|
/** Its rows, in the Menu's order. */
|
|
139
153
|
entries: MenuListEntry[];
|
|
140
|
-
/** A row one level in (a choice or actions row) was pressed: what it opens is its holder's to
|
|
154
|
+
/** A row one level in (a choice or actions row, or a tick row's › by `opens`) was pressed: what it opens is its holder's to
|
|
155
|
+
* show, in place. */
|
|
141
156
|
onOpen?: (entry: MenuListEntry) => void;
|
|
142
157
|
/** How a tick is drawn: the tick box before its name, as in a menu (the default), the Switch at its end, or an eye at its end,
|
|
143
158
|
* crossed while it is off. */
|
|
@@ -10,8 +10,10 @@ import { Icon, iconPaths } from "../internal/icons.js";
|
|
|
10
10
|
import { phoneMark, usePhoneForm } from "../internal/phone.js";
|
|
11
11
|
import { msOf, pxOf, spacingPx } from "../internal/read-token.js";
|
|
12
12
|
import { useReorder } from "../internal/reorder.js";
|
|
13
|
+
import { Button } from "../button/button.js";
|
|
13
14
|
import { Scrollbar } from "../scrollbar/scrollbar.js";
|
|
14
15
|
import { Switch } from "../switch/switch.js";
|
|
16
|
+
import { Toggle } from "../toggle/toggle.js";
|
|
15
17
|
import { rowFor, rowStarting } from "./keys.js";
|
|
16
18
|
import { MENU_LIST_LOOKS } from "./looks.js";
|
|
17
19
|
const optionOf = (el, id) => el?.closest(`[data-menu-list-${id}]`)?.getAttribute(`data-menu-list-${id}`) ?? MENU_LIST_LOOKS.options.find((o) => o.id === id).def;
|
|
@@ -42,6 +44,13 @@ function Eye({ on, className }) {
|
|
|
42
44
|
const eyeOf = (on, className) => _jsx(Eye, { on: on, className: className });
|
|
43
45
|
const MORE = ["M9 6l6 6l-6 6"], TICK = ["M5 12l5 5l10 -10"], AWAY = ["M17 7l-10 10", "M8 7l9 0l0 9"];
|
|
44
46
|
const strokeGlyph = (paths, className, strokeWidth = 2) => (_jsx("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: strokeWidth, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths.map((d) => _jsx("path", { d: d }, d)) }));
|
|
47
|
+
const keepRow = (ev) => {
|
|
48
|
+
ev.preventDefault();
|
|
49
|
+
const row = ev.currentTarget.closest("[data-item], .o-menu-list-row");
|
|
50
|
+
(row?.tagName === "LABEL" ? row.querySelector('[role="switch"]') : row)?.focus({ preventScroll: true });
|
|
51
|
+
};
|
|
52
|
+
const rowToggle = (t) => t ? (_jsx(Toggle, { kind: "quiet", shape: "icon", size: "xs", className: "o-menu-toggle", tabIndex: -1, "aria-label": t.label, icon: t.icon, pressed: t.on, readOnly: !!t.disabled, ...(t.disabled ? { title: t.disabled } : {}), onPressedChange: () => t.onPress(), onMouseDown: keepRow, onClick: (ev) => ev.stopPropagation() })) : null;
|
|
53
|
+
const rowOpen = (name, glyphOf, onOpen) => name ? (_jsx(Button, { kind: "quiet", shape: "icon", size: "xs", className: "o-menu-open", tabIndex: -1, "aria-label": name, icon: glyphOf, onMouseDown: keepRow, onClick: (ev) => { ev.stopPropagation(); onOpen?.(); } })) : null;
|
|
45
54
|
const part = (id, p) => (id ? `${id}-${p}` : undefined);
|
|
46
55
|
const named = (id) => ["n", "v", "k", "c"].map((p) => `${id}-${p}`).join(" ");
|
|
47
56
|
const actionBody = (e, id) => (_jsxs(_Fragment, { children: [e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), e.keys && _jsx("span", { className: "o-menu-keys", id: part(id, "k"), children: e.keys.map((k) => _jsx("kbd", { children: k }, k)) }), e.count != null && _jsx("span", { className: "o-menu-count", id: part(id, "c"), children: e.count })] }));
|
|
@@ -123,14 +132,16 @@ export function MenuListShown({ entries, label, open, on = [], className }) {
|
|
|
123
132
|
}
|
|
124
133
|
const grippedOf = (list) => list.flatMap((e) => (e.kind === "group" ? grippedOf(e.entries) : e.kind !== "separator" && e.kind !== "pick" && e.grip && !("disabled" in e && e.disabled) ? [e] : []));
|
|
125
134
|
const disabledProps = (why) => (why ? { "aria-disabled": true, "data-disabled": "", title: why } : {});
|
|
126
|
-
function PanelCheck({ e, item, ticks, grip, id, words = MENU_LIST_WORDS }) {
|
|
135
|
+
function PanelCheck({ e, item, ticks, grip, id, words = MENU_LIST_WORDS, onOpen }) {
|
|
127
136
|
const [own, setOwn] = React.useState(!!e.defaultChecked), on = e.checked ?? own;
|
|
128
137
|
const press = () => { if (e.disabled)
|
|
129
138
|
return; const next = !on; if (e.checked === undefined)
|
|
130
139
|
setOwn(next); e.onCheckedChange?.(next); };
|
|
140
|
+
const level = e.opens ? { "data-level": "" } : {}, toggle = rowToggle(e.toggle), open = rowOpen(e.opens, strokeGlyph(MORE, "o-menu-more"), onOpen);
|
|
141
|
+
const off = e.opens && e.disabled ? { "data-disabled": "", title: e.disabled } : disabledProps(e.disabled);
|
|
131
142
|
if (ticks === "eye")
|
|
132
|
-
return (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...
|
|
133
|
-
return ticks === "switch" ? (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...
|
|
143
|
+
return (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...off, ...level, ...item, onClick: press, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-eyed", children: [grip, e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), toggle, eyeOf(on, "o-menu-eye"), open] }));
|
|
144
|
+
return ticks === "switch" ? (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...off, ...level, ...item, onClick: press, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-switch", children: [grip, e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), toggle, _jsx(Switch, { size: "sm", checked: on, onCheckedChange: () => { }, disabled: !!e.disabled, tabIndex: -1, "aria-hidden": true, words: [words.on, words.off], onMouseDown: (ev) => { ev.preventDefault(); ev.currentTarget.closest("[data-item]")?.focus({ preventScroll: true }); } }), open] })) : (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...off, ...level, ...item, onClick: press, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-check", children: [grip, checkBody(e, id), toggle, open] }));
|
|
134
145
|
}
|
|
135
146
|
export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMove, className, words: given }) {
|
|
136
147
|
const w = listWords(given);
|
|
@@ -188,6 +199,12 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
|
|
|
188
199
|
}
|
|
189
200
|
return;
|
|
190
201
|
}
|
|
202
|
+
const opener = ev.key === "ArrowRight" ? row.querySelector(":scope > .o-menu-open") : null;
|
|
203
|
+
if (opener) {
|
|
204
|
+
ev.preventDefault();
|
|
205
|
+
opener.click();
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
191
208
|
if (ev.key === "Enter" || ev.key === " " || (ev.key === "ArrowRight" && row.hasAttribute("data-level"))) {
|
|
192
209
|
if (ev.key === "Enter" && row.tagName === "A")
|
|
193
210
|
return;
|
|
@@ -260,7 +277,7 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
|
|
|
260
277
|
if (e.kind === "pick")
|
|
261
278
|
return (_jsxs("div", { role: "group", "aria-label": e.heading, children: [e.heading && _jsx("p", { className: "o-list-heading", children: e.heading }), e.choices.map((c) => _jsx("div", { role: "menuitemradio", "aria-checked": c.value === e.value, ...item(), onClick: () => e.onChoose?.(c.value), className: ROW, children: choiceBody(c) }, c.value))] }, k));
|
|
262
279
|
if (e.kind === "check")
|
|
263
|
-
return _jsx(PanelCheck, { e: e, item: item(e), ticks: ticks, grip: gripFor(e), id: idOf(e), words: w }, k);
|
|
280
|
+
return _jsx(PanelCheck, { e: e, item: item(e), ticks: ticks, grip: gripFor(e), id: idOf(e), words: w, onOpen: () => onOpen?.(e) }, k);
|
|
264
281
|
if (e.kind === "link") {
|
|
265
282
|
const attrs = { role: "menuitem", ...item(e), className: ROW, onClick: e.onSelect, ...(e.external ? { target: "_blank", rel: "noreferrer" } : {}) };
|
|
266
283
|
return e.render ? React.cloneElement(e.render, { key: k, ...attrs }, gripFor(e), linkBody(e, idOf(e))) : _jsxs("a", { href: e.href, ...attrs, children: [gripFor(e), linkBody(e, idOf(e))] }, k);
|
|
@@ -314,10 +331,11 @@ function PhoneRow({ row, onOpen, move, room, ticks = "switch", words = MENU_LIST
|
|
|
314
331
|
const mv = move ? { "data-row": move.at, ...(move.lifted ? { "data-lifted": "" } : {}), style: move.style, ...move.drag } : {};
|
|
315
332
|
const how = move ? { "aria-describedby": move.how } : {};
|
|
316
333
|
const lead = move ? glyph(GRIP, "o-menu-list-grip") : room ? React.cloneElement(glyph(GRIP, "o-menu-list-grip"), { "data-room": "" }) : null;
|
|
334
|
+
const tickId = React.useId(), named = row.kind === "check" && row.toggle ? { label: { htmlFor: tickId }, tick: { id: tickId } } : { label: {}, tick: {} };
|
|
317
335
|
if (row.kind === "check" && ticks === "eye")
|
|
318
|
-
return _jsx(PhoneEye, { row: row, lead: lead, mv: mv, how: how });
|
|
336
|
+
return _jsx(PhoneEye, { row: row, lead: lead, mv: mv, how: how, onOpen: onOpen && (() => onOpen(row)) });
|
|
319
337
|
if (row.kind === "check")
|
|
320
|
-
return (_jsxs("label", { className: "o-menu-list-row", ...mv, children: [lead, row.icon && _jsx("span", { className: "o-menu-list-mark", children: row.icon }), _jsxs("span", { className: "o-menu-list-name", children: [_jsx("span", { children: row.label }), (row.disabled ?? row.note) != null && _jsx("span", { className: "o-menu-list-note", children: row.disabled ?? row.note })] }), _jsx(Switch, { size: "lg", checked: row.checked, defaultChecked: row.defaultChecked, onCheckedChange: (c) => row.onCheckedChange?.(c), disabled: !!row.disabled, words: [words.on, words.off], ...how })] }));
|
|
338
|
+
return (_jsxs("label", { className: "o-menu-list-row", ...mv, ...named.label, children: [lead, row.icon && _jsx("span", { className: "o-menu-list-mark", children: row.icon }), _jsxs("span", { className: "o-menu-list-name", children: [_jsx("span", { children: row.label }), (row.disabled ?? row.note) != null && _jsx("span", { className: "o-menu-list-note", children: row.disabled ?? row.note })] }), rowToggle(row.toggle), _jsx(Switch, { size: "lg", checked: row.checked, defaultChecked: row.defaultChecked, onCheckedChange: (c) => row.onCheckedChange?.(c), disabled: !!row.disabled, words: [words.on, words.off], ...how, ...named.tick }), rowOpen(row.opens, glyph(MORE, "o-menu-list-more"), onOpen && (() => onOpen(row)))] }));
|
|
321
339
|
if (row.kind === "link") {
|
|
322
340
|
const attrs = { className: "o-menu-list-row", ...mv, ...how, ...(row.external ? { target: "_blank", rel: "noreferrer" } : {}) };
|
|
323
341
|
const inside = _jsxs(_Fragment, { children: [lead, body(row), endOf(row), row.external ? glyph(AWAY, "o-menu-list-more") : glyph(MORE, "o-menu-list-more")] });
|
|
@@ -334,11 +352,11 @@ function PhoneRow({ row, onOpen, move, room, ticks = "switch", words = MENU_LIST
|
|
|
334
352
|
export function MenuListRow({ label, value, onSelect, className }) {
|
|
335
353
|
return _jsxs(BaseButton, { className: cx("o-menu-list-row", className), onClick: onSelect, children: [_jsx("span", { className: "o-menu-list-name", children: _jsx("span", { children: label }) }), _jsx("span", { className: "o-menu-list-value", children: value })] });
|
|
336
354
|
}
|
|
337
|
-
function PhoneEye({ row, lead, mv, how }) {
|
|
355
|
+
function PhoneEye({ row, lead, mv, how, onOpen }) {
|
|
338
356
|
const [own, setOwn] = React.useState(!!row.defaultChecked), on = row.checked ?? own;
|
|
339
357
|
const press = () => { const next = !on; if (row.checked === undefined)
|
|
340
358
|
setOwn(next); row.onCheckedChange?.(next); };
|
|
341
|
-
return (_jsxs(BaseButton, { className: "o-menu-list-row", ...mv, ...how, role: "switch", "aria-checked": on, disabled: !!row.disabled, focusableWhenDisabled: true, onClick: press, children: [lead, row.icon && _jsx("span", { className: "o-menu-list-mark", children: row.icon }), _jsxs("span", { className: "o-menu-list-name", children: [_jsx("span", { children: row.label }), (row.disabled ?? row.note) != null && _jsx("span", { className: "o-menu-list-note", children: row.disabled ?? row.note })] }), eyeOf(on, "o-menu-list-eye")] }));
|
|
359
|
+
return (_jsxs(BaseButton, { className: "o-menu-list-row", ...mv, ...how, role: "switch", "aria-checked": on, disabled: !!row.disabled, focusableWhenDisabled: true, onClick: press, ...(row.toggle || row.opens ? { nativeButton: false, render: _jsx("div", {}) } : {}), children: [lead, row.icon && _jsx("span", { className: "o-menu-list-mark", children: row.icon }), _jsxs("span", { className: "o-menu-list-name", children: [_jsx("span", { children: row.label }), (row.disabled ?? row.note) != null && _jsx("span", { className: "o-menu-list-note", children: row.disabled ?? row.note })] }), rowToggle(row.toggle), eyeOf(on, "o-menu-list-eye"), rowOpen(row.opens, glyph(MORE, "o-menu-list-more"), onOpen)] }));
|
|
342
360
|
}
|
|
343
361
|
export function MenuList({ label, entries, tiles, onOpen, onClose, closeWord = "Close", onMove, ticks, className, words: given }) {
|
|
344
362
|
const w = listWords(given);
|
|
@@ -232,6 +232,14 @@
|
|
|
232
232
|
.o-menu-rows .o-list-row { --list-row-rad: var(--list-row-corners-in); --list-row-pill-in: var(--list-row-corners-pill, var(--list-row-pill, var(--list-box-pill, 0))); }
|
|
233
233
|
/* A tick as the Switch, at its end. */
|
|
234
234
|
.o-menu-switch > .o-switch { flex: none; margin-left: calc(var(--vk-spacing) * 4); }
|
|
235
|
+
/* A tick row's own Toggle before its tick (a card's field starting a new line) and its › after it, opening its level (VK-890): each a
|
|
236
|
+
quiet icon Button at the row's end, its tick nearer the Toggle than the name, the › as near the row's end as a level row's ›. */
|
|
237
|
+
:is(.o-menu-row, .o-menu-list-row) > .o-menu-toggle { flex: none; margin-left: calc(var(--vk-spacing) * 2); }
|
|
238
|
+
:is(.o-menu-row, .o-menu-list-row) > .o-menu-toggle + :is(.o-switch, .o-menu-eye, .o-menu-list-eye) { margin-left: calc(var(--vk-spacing) * 2); }
|
|
239
|
+
/* A Toggle that can't be pressed here (a card's first field, a hidden one) is drawn quieter, its reason its tooltip. */
|
|
240
|
+
:is(.o-menu-row, .o-menu-list-row) > .o-menu-toggle[aria-disabled="true"] { color: var(--vk-fg-disabled); }
|
|
241
|
+
:is(.o-menu-row, .o-menu-list-row) > .o-menu-open { flex: none; margin-left: calc(var(--vk-spacing) * 1); margin-right: calc(var(--vk-spacing) * -1); color: var(--vk-fg-subtlest); }
|
|
242
|
+
.o-menu-row > .o-menu-open > .o-menu-more { margin-right: 0; }
|
|
235
243
|
/* A value in force (a filter's "1", a sort's "Amount +1"): in the brand. */
|
|
236
244
|
.o-menu-value[data-on] { color: var(--vk-fg-accent); }
|
|
237
245
|
/* A tick as an eye, at its end: open while it is on, crossed while off, quieter; greyed on a row that can't be used. */
|
|
@@ -27,5 +27,5 @@ export type QuickFiltersFieldIn = {
|
|
|
27
27
|
export declare function quickFiltersFieldsOf(fields: readonly QuickFiltersFieldIn[]): QuickField[];
|
|
28
28
|
/** The quick filters' words in the app's messages. */
|
|
29
29
|
export declare const quickFiltersWordsOf: (say: ViewsMessageResolver) => QuickFiltersWords;
|
|
30
|
-
export declare function MapQuickFiltersBody({ fields, hold, several, showCounts, form, onHoldChange, onDone }: ViewsQuickFiltersBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function MapQuickFiltersBody({ label, fields, hold, several, showCounts, form, onHoldChange, onDone, actions }: ViewsQuickFiltersBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
31
31
|
export {};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { resolveViewsMessage } from "../../contract.js";
|
|
5
5
|
import { ViewsContext } from "../../provider/context.js";
|
|
6
|
+
import { glyph, X } from "../internal/editor-parts.js";
|
|
7
|
+
import { HeaderBar } from "../phone-header/header-bar.js";
|
|
6
8
|
import { pickerItemsOf } from "../picker/map-picker.js";
|
|
9
|
+
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
7
10
|
import { QuickFilters } from "./quick-filters.js";
|
|
8
11
|
export function quickHoldsOf(hold) {
|
|
9
12
|
return Object.fromEntries(hold.filter((h) => h.values.length).map((h) => [h.fieldKey, [...h.values]]));
|
|
@@ -47,10 +50,10 @@ export const quickFiltersWordsOf = (say) => ({
|
|
|
47
50
|
clear: say({ key: "views.panels.quick-clear-value" }),
|
|
48
51
|
none: say({ key: "views.panels.quick-none" }),
|
|
49
52
|
});
|
|
50
|
-
export function MapQuickFiltersBody({ fields, hold, several, showCounts, form, onHoldChange, onDone }) {
|
|
53
|
+
export function MapQuickFiltersBody({ label, fields, hold, several, showCounts, form, onHoldChange, onDone, actions }) {
|
|
51
54
|
const views = React.useContext(ViewsContext);
|
|
52
55
|
const messages = views?.messages ?? resolveViewsMessage;
|
|
53
56
|
const words = React.useMemo(() => quickFiltersWordsOf(messages), [messages]);
|
|
54
57
|
const quick = React.useMemo(() => quickFiltersFieldsOf(fields), [fields]);
|
|
55
|
-
return (_jsx("div", { "data-quick-filters-holds": several ? "several" : "one", style: { display: "contents" }, children: _jsx(QuickFilters, { fields: quick, holds: quickHoldsOf(hold), onHoldsChange: (next) => onHoldChange(quickListHoldOf(next, hold)), counts: showCounts, form: form, onDone: onDone, words: words }) }));
|
|
58
|
+
return (_jsxs(_Fragment, { children: [actions && (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-quick-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: label }), right: _jsx("span", {}), left: _jsx(SheetButton, { "aria-label": actions.close.label, icon: glyph(X), onClick: actions.close.onPress }) }) })), _jsx("div", { "data-quick-filters-holds": several ? "several" : "one", style: { display: "contents" }, children: _jsx(QuickFilters, { fields: quick, holds: quickHoldsOf(hold), onHoldsChange: (next) => onHoldChange(quickListHoldOf(next, hold)), counts: showCounts, form: form, onDone: onDone, words: words }) })] }));
|
|
56
59
|
}
|
|
@@ -22,5 +22,5 @@ export function MapSheet({ open, onOpenChange, title, label, description, action
|
|
|
22
22
|
? _jsx(SheetHead, { title: parts.title, ...parts.head, words: words })
|
|
23
23
|
: actions && left
|
|
24
24
|
? _jsx(SheetHead, { title: shown, titleLabel: titleLabel, description: description, left: _jsx(SheetButton, { "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, { kind: "primary", "aria-label": actions.done.label, icon: _jsx(Check, {}), onClick: actions.done.onPress }) : _jsx("span", {}) })
|
|
25
|
-
: _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 })] }));
|
|
25
|
+
: (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
26
|
}
|
|
@@ -3,7 +3,7 @@ import type { ViewsTextBodyProps } from "../../provider/components.js";
|
|
|
3
3
|
import { type TextEditorProps } from "./text-editor.js";
|
|
4
4
|
import type { TextEditorWords } from "./words.js";
|
|
5
5
|
/** ViewKit's text body's props as the Text editor's, held as a shell that keeps the draft. */
|
|
6
|
-
export declare function textEditorPropsOf({ label, kind, paragraph, value, onValueChange, onDone, check, region, autoFocus, form }: ViewsTextBodyProps): TextEditorProps;
|
|
6
|
+
export declare function textEditorPropsOf({ label, kind, paragraph, value, onValueChange, onDone, check, region, autoFocus, form, place }: ViewsTextBodyProps): TextEditorProps;
|
|
7
7
|
/** The Text editor's words in the app's messages: a place's country and its search, as the old location editor's, and the
|
|
8
8
|
* list's own (the Picker's). */
|
|
9
9
|
export declare function textEditorWordsOf(say: ViewsMessageResolver): TextEditorWords;
|
|
@@ -6,9 +6,9 @@ import { ViewsContext } from "../../provider/context.js";
|
|
|
6
6
|
import { pickerWordsOf } from "../picker/map-picker.js";
|
|
7
7
|
import { useToldStep } from "../internal/told-step.js";
|
|
8
8
|
import { useTextEditor } from "./text-editor.js";
|
|
9
|
-
export function textEditorPropsOf({ label, kind, paragraph, value, onValueChange, onDone, check, region, autoFocus, form }) {
|
|
9
|
+
export function textEditorPropsOf({ label, kind, paragraph, value, onValueChange, onDone, check, region, autoFocus, form, place }) {
|
|
10
10
|
const as = paragraph || kind === "rich_text" ? "long" : kind === "url" ? "link" : kind;
|
|
11
|
-
return { label, kind: as, value, onValueChange, onDone, check, autoFocus, form, draft: "shell", ...(region ? { country: region } : {}) };
|
|
11
|
+
return { label, kind: as, value, onValueChange, onDone, check, autoFocus, form, ...(place ? { place } : {}), draft: "shell", ...(region ? { country: region } : {}) };
|
|
12
12
|
}
|
|
13
13
|
export function textEditorWordsOf(say) {
|
|
14
14
|
return { country: say({ key: "views.editors.place-country" }), searchCountry: say({ key: "views.editors.place-country-search" }), picker: pickerWordsOf(say) };
|
|
@@ -33,6 +33,9 @@ export interface TextEditorProps {
|
|
|
33
33
|
country?: string;
|
|
34
34
|
/** Which form; by default the phone's in a phone's window or in a PhoneHost screen, else the computer's. */
|
|
35
35
|
form?: "computer" | "phone";
|
|
36
|
+
/** Where it stands on a computer: `cell` (the default), over a cell whose box it fills, growing over the rows below; `row`,
|
|
37
|
+
* in a record's row, in the row's flow, as tall as its text up to its cap, so the row grows with it. */
|
|
38
|
+
place?: "cell" | "row";
|
|
36
39
|
/** Where the draft, the close and a phone's ✕ and ✓ stand: `own` (the default), the Text editor's; `shell`, its holder's
|
|
37
40
|
* (ViewKit's text editor, CONTROLS.TextBody): it hands every change through onValueChange as it is made,
|
|
38
41
|
* the whole text each time (a phone with its country as phoneHanded hands it), and its own change coming back as its value
|
|
@@ -43,6 +43,7 @@ export function useTextEditor(props) {
|
|
|
43
43
|
const w = textWords(props.words), language = props.language ?? "en";
|
|
44
44
|
const host = React.useContext(PhoneHost), small = usePhone();
|
|
45
45
|
const form = props.form ?? (host || small ? "phone" : "computer");
|
|
46
|
+
const place = props.place ?? "cell";
|
|
46
47
|
const long = kind === "long", keys = TEXT_KEYS[kind];
|
|
47
48
|
const [root, setRoot] = React.useState(null);
|
|
48
49
|
const worn = useWorn(root);
|
|
@@ -182,6 +183,19 @@ export function useTextEditor(props) {
|
|
|
182
183
|
React.useLayoutEffect(() => {
|
|
183
184
|
if (!root || form !== "computer")
|
|
184
185
|
return;
|
|
186
|
+
if (place === "row") {
|
|
187
|
+
const fit = () => {
|
|
188
|
+
const b = boxRef.current;
|
|
189
|
+
if (!(b instanceof HTMLTextAreaElement))
|
|
190
|
+
return;
|
|
191
|
+
b.style.height = "0px";
|
|
192
|
+
b.style.height = `${b.scrollHeight + b.offsetHeight - b.clientHeight}px`;
|
|
193
|
+
};
|
|
194
|
+
fit();
|
|
195
|
+
const watch = new ResizeObserver(fit);
|
|
196
|
+
watch.observe(root);
|
|
197
|
+
return () => watch.disconnect();
|
|
198
|
+
}
|
|
185
199
|
const size = () => {
|
|
186
200
|
const at = root.getBoundingClientRect(), k = drawnAt(root), row = at.height / k || 36;
|
|
187
201
|
let edge = window.innerWidth;
|
|
@@ -215,7 +229,7 @@ export function useTextEditor(props) {
|
|
|
215
229
|
const watch = new ResizeObserver(size);
|
|
216
230
|
watch.observe(root);
|
|
217
231
|
return () => watch.disconnect();
|
|
218
|
-
}, [root, form, draft, worn.box, worn.long, worn.phone, kind, long, shown]);
|
|
232
|
+
}, [root, form, place, draft, worn.box, worn.long, worn.phone, kind, long, shown]);
|
|
219
233
|
if (form === "phone") {
|
|
220
234
|
const step = withCountry && open;
|
|
221
235
|
const field = withCountry ? (_jsxs(InputGroup, { size: "lg", children: [_jsxs(InputGroupAddon, { side: "start", children: [_jsx(InputGroupButton, { className: "o-text-editor-country", "aria-label": `${w.country}: ${countryName(phone.country, language)}`, iconEnd: glyph(DOWN), onClick: () => setOpen(true), children: _jsx("span", { className: "o-text-editor-country-code", children: phone.country }) }), _jsx("span", { className: "o-text-editor-dial", children: dialOf(phone.country) })] }), _jsx(Input, { ref: number, autofill: false, type: "tel", inputMode: "tel", enterKeyHint: "done", value: phone.digits, ...common, placeholder: patternOf(phone.country), spellCheck: false, onChange: (e) => movePhone({ digits: e.target.value }), onKeyDown: onKeyDown })] })) : (_jsx(Input, { ref: box, size: "lg", autofill: false, multiline: long || kind === "text", grow: long || kind === "text", className: long ? "o-text-editor-tall" : undefined, type: long || kind === "text" ? undefined : keys.type, inputMode: keys.inputMode, enterKeyHint: long ? undefined : "done", value: draft, ...common, onChange: change, onKeyDown: long ? undefined : onKeyDown }));
|
|
@@ -239,7 +253,7 @@ export function useTextEditor(props) {
|
|
|
239
253
|
keep();
|
|
240
254
|
};
|
|
241
255
|
const note = refused && _jsxs("div", { className: "o-text-editor-note", id: noteId, role: "alert", children: [glyph(["M12 8v5", "M12 16.5v.01", "M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"]), _jsx("span", { children: refused })] });
|
|
242
|
-
const body = (_jsxs("div", { ref: placeRoot, className: "o-text-editor", "data-kit": "text-editor", "data-text-form": "computer", ...phoneMark(!!host || small), "data-text-kind": kind, "data-text-box": worn.box, "data-refused": refused ? "" : undefined, onBlur: blur, children: [withCountry ? _jsxs(_Fragment, { children: [_jsxs(InlineInputGroup, { className: "o-text-editor-phone", "data-refused": refused ? "" : undefined, children: [_jsx(InputGroupAddon, { side: "start", children: _jsx(InputGroupButton, { className: "o-text-editor-country", look: COUNTRY, "aria-label": `${w.country}: ${countryName(phone.country, language)}`, "aria-haspopup": "listbox", "aria-expanded": open, iconEnd: glyph(DOWN), onClick: () => setOpen((o) => !o), children: _jsx("span", { className: "o-text-editor-country-code", children: phone.country }) }) }), _jsx(InputGroupAddon, { side: "start", children: _jsx("span", { className: "o-text-editor-dial", children: dialOf(phone.country) }) }), _jsx(Input, { ref: number, className: "o-text-editor-number", type: "tel", inputMode: "tel", enterKeyHint: "done", value: phone.digits, ...common, autofill: false, placeholder: patternOf(phone.country), spellCheck: false, onChange: (e) => movePhone({ digits: e.target.value }), onKeyDown: onKeyDown, "aria-invalid": refused ? true : undefined, "aria-describedby": refused ? noteId : undefined })] }), _jsx(Popover, { open: open, onOpenChange: (o, d) => {
|
|
256
|
+
const body = (_jsxs("div", { ref: placeRoot, className: "o-text-editor", "data-kit": "text-editor", "data-text-form": "computer", ...phoneMark(!!host || small), "data-text-kind": kind, "data-text-box": worn.box, "data-text-place": place, "data-refused": refused ? "" : undefined, onBlur: blur, children: [withCountry ? _jsxs(_Fragment, { children: [_jsxs(InlineInputGroup, { className: "o-text-editor-phone", "data-refused": refused ? "" : undefined, children: [_jsx(InputGroupAddon, { side: "start", children: _jsx(InputGroupButton, { className: "o-text-editor-country", look: COUNTRY, "aria-label": `${w.country}: ${countryName(phone.country, language)}`, "aria-haspopup": "listbox", "aria-expanded": open, iconEnd: glyph(DOWN), onClick: () => setOpen((o) => !o), children: _jsx("span", { className: "o-text-editor-country-code", children: phone.country }) }) }), _jsx(InputGroupAddon, { side: "start", children: _jsx("span", { className: "o-text-editor-dial", children: dialOf(phone.country) }) }), _jsx(Input, { ref: number, className: "o-text-editor-number", type: "tel", inputMode: "tel", enterKeyHint: "done", value: phone.digits, ...common, autofill: false, placeholder: patternOf(phone.country), spellCheck: false, onChange: (e) => movePhone({ digits: e.target.value }), onKeyDown: onKeyDown, "aria-invalid": refused ? true : undefined, "aria-describedby": refused ? noteId : undefined })] }), _jsx(Popover, { open: open, onOpenChange: (o, d) => {
|
|
243
257
|
setOpen(o);
|
|
244
258
|
if (shell)
|
|
245
259
|
return;
|
|
@@ -62,6 +62,17 @@
|
|
|
62
62
|
}
|
|
63
63
|
.o-text-editor-note svg { flex: none; width: calc(var(--vk-spacing) * 3.5); height: calc(var(--vk-spacing) * 3.5); margin-top: var(--vk-border-width); color: var(--vk-danger); }
|
|
64
64
|
|
|
65
|
+
/* ── In a record's row (data-text-place="row"): the box stands in the row's flow, a line one list row high (28), long text
|
|
66
|
+
as tall as its text up to 320, then it scrolls; a phone's box and what is refused stand under it in the flow too. The row
|
|
67
|
+
grows with it, so a section that clips the row never cuts its edge (VK-889). (0,4,0): over the cell's looks. ────── */
|
|
68
|
+
.o-text-editor[data-text-place="row"][data-text-form="computer"] { height: auto; --inline-input-row: calc(var(--vk-spacing) * 7); }
|
|
69
|
+
.o-text-editor[data-text-place="row"][data-text-form] .o-text-editor-box {
|
|
70
|
+
position: relative; top: auto; left: auto; width: 100%; min-width: 0; max-width: none; height: auto; min-height: var(--inline-input-row);
|
|
71
|
+
max-height: calc(var(--vk-spacing) * 80); box-shadow: inset 0 0 0 var(--inline-input-ring, 0px) var(--inline-input-colour);
|
|
72
|
+
}
|
|
73
|
+
.o-text-editor[data-text-place="row"][data-text-form] .o-text-editor-phone { position: relative; top: auto; left: auto; width: 100%; height: var(--inline-input-row); }
|
|
74
|
+
.o-text-editor[data-text-place="row"][data-text-form] .o-text-editor-note { position: relative; top: auto; left: auto; margin-top: var(--vk-spacing); max-width: 100%; }
|
|
75
|
+
|
|
65
76
|
/* ── On a phone: the Input at the phone's size; long text one tall box; a phone's country in the box's start side ──── */
|
|
66
77
|
.o-text-editor[data-text-form="phone"] { display: grid; }
|
|
67
78
|
.o-text-editor[data-text-form="phone"] .o-text-editor-country { gap: calc(var(--vk-spacing) * 0.75); }
|
|
@@ -51,8 +51,12 @@ export function valuesText(values) {
|
|
|
51
51
|
return list.length ? `${list[0].value}${list.length > 1 ? ` +${list.length - 1}` : ""}` : "";
|
|
52
52
|
}
|
|
53
53
|
export function openOf(kind, value) {
|
|
54
|
-
if (kind === "phone")
|
|
55
|
-
|
|
54
|
+
if (kind === "phone") {
|
|
55
|
+
const [number = "", extension] = value.split(/\s*(?:;\s*ext=|ext\.?|x|#)\s*/i);
|
|
56
|
+
const digits = (text) => text.replace(/[^\d+]/g, "");
|
|
57
|
+
const ext = extension ? digits(extension) : "";
|
|
58
|
+
return { href: `tel:${digits(number)}${ext ? `;ext=${ext}` : ""}`, label: `Call ${value}` };
|
|
59
|
+
}
|
|
56
60
|
if (kind === "email")
|
|
57
61
|
return { href: `mailto:${value}`, label: `Write to ${value}` };
|
|
58
62
|
return { href: /^https?:\/\//i.test(value) ? value : `https://${value}`, label: `Open ${value}` };
|