viewkitjs 0.33.0 → 0.35.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 +139 -0
- package/package.json +1 -1
- package/views/README.md +1 -1
- package/views/dist/atoms/Avatar.js +2 -1
- package/views/dist/atoms/RelationChip.d.ts +2 -0
- package/views/dist/atoms/RelationChip.js +5 -0
- package/views/dist/atoms/RowMenu.d.ts +1 -1
- package/views/dist/atoms/RowMenu.js +15 -3
- package/views/dist/atoms/defaults.js +2 -0
- package/views/dist/atoms/types.d.ts +40 -4
- package/views/dist/cells/relation-wrap.js +9 -2
- package/views/dist/contract.d.ts +27 -14
- package/views/dist/contract.js +40 -4
- package/views/dist/controls/alert/alert.js +2 -1
- package/views/dist/controls/alert-dialog/alert-dialog.js +3 -2
- package/views/dist/controls/avatar/avatar-mark.d.ts +4 -0
- package/views/dist/controls/avatar/avatar-mark.js +5 -0
- package/views/dist/controls/avatar/avatar.d.ts +7 -4
- package/views/dist/controls/avatar/avatar.js +10 -4
- package/views/dist/controls/avatar/looks.d.ts +1 -1
- package/views/dist/controls/avatar/looks.js +3 -0
- package/views/dist/controls/avatar/record-mark.d.ts +16 -0
- package/views/dist/controls/avatar/record-mark.js +13 -0
- package/views/dist/controls/avatar/tokens.d.ts +12 -0
- package/views/dist/controls/avatar/tokens.js +3 -0
- package/views/dist/controls/avatar.css +54 -17
- package/views/dist/controls/bulk-bar/bulk-bar.js +29 -27
- package/views/dist/controls/bulk-bar/map-selection-bar.js +2 -1
- package/views/dist/controls/compound-editor/compound-editor.d.ts +3 -0
- package/views/dist/controls/compound-editor/map-parts-body.d.ts +1 -1
- package/views/dist/controls/compound-editor/map-parts-body.js +6 -1
- package/views/dist/controls/compound-editor/name-parts.js +2 -1
- package/views/dist/controls/compound-editor/place-parts.js +2 -2
- package/views/dist/controls/compound-editor/range-parts.js +10 -9
- package/views/dist/controls/controls.d.ts +2 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/customize/customize.d.ts +14 -5
- package/views/dist/controls/customize/customize.js +19 -20
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -2
- package/views/dist/controls/customize/map-customize-body.js +15 -13
- package/views/dist/controls/customize/words.d.ts +3 -3
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -0
- package/views/dist/controls/date-editor/date-editor.js +13 -7
- package/views/dist/controls/date-editor/map-calendar.js +2 -0
- package/views/dist/controls/date-editor/map-date-body.d.ts +1 -1
- package/views/dist/controls/date-editor/map-date-body.js +7 -3
- package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +4 -6
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +2 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -4
- package/views/dist/controls/filter-editor/parts.d.ts +4 -2
- package/views/dist/controls/filter-editor/parts.js +8 -7
- package/views/dist/controls/group-editor/group-editor.js +2 -1
- package/views/dist/controls/group-editor/map-group-body.d.ts +1 -0
- package/views/dist/controls/group-editor/map-group-body.js +5 -1
- package/views/dist/controls/index.d.ts +1 -1
- package/views/dist/controls/input/input.js +2 -1
- package/views/dist/controls/internal/head-button.d.ts +9 -0
- package/views/dist/controls/internal/head-button.js +13 -0
- package/views/dist/controls/internal/map-panel-controls.js +9 -5
- package/views/dist/controls/internal/panel-controls.d.ts +38 -6
- package/views/dist/controls/internal/panel-controls.js +191 -19
- package/views/dist/controls/links-editor/links-editor.js +5 -7
- package/views/dist/controls/links-editor/map-links-body.d.ts +1 -1
- package/views/dist/controls/links-editor/map-links-body.js +5 -1
- package/views/dist/controls/menu/menu.d.ts +5 -1
- package/views/dist/controls/menu/menu.js +4 -3
- package/views/dist/controls/modal/modal.js +5 -3
- package/views/dist/controls/number-editor/map-number-body.js +5 -1
- package/views/dist/controls/number-editor/number-editor.js +6 -6
- package/views/dist/controls/pane/map-pane.d.ts +3 -0
- package/views/dist/controls/pane/map-pane.js +5 -0
- package/views/dist/controls/picker/map-fields-body.d.ts +2 -2
- package/views/dist/controls/picker/map-fields-body.js +30 -2
- package/views/dist/controls/picker/map-picker.d.ts +8 -3
- package/views/dist/controls/picker/map-picker.js +14 -3
- package/views/dist/controls/picker/picker.js +11 -8
- package/views/dist/controls/picker/rows.d.ts +7 -2
- package/views/dist/controls/picker.css +10 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +2 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +9 -4
- package/views/dist/controls/quick-filters/quick-filters.js +8 -6
- package/views/dist/controls/quick-filters/reminder.js +2 -2
- package/views/dist/controls/quick-filters/rules.d.ts +4 -1
- package/views/dist/controls/quick-filters/words.d.ts +2 -0
- package/views/dist/controls/quick-filters/words.js +1 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +9 -3
- package/views/dist/controls/setting-row/looks.js +5 -5
- package/views/dist/controls/setting-row/setting-row.d.ts +3 -1
- package/views/dist/controls/setting-row/setting-row.js +3 -1
- package/views/dist/controls/setting-row.css +3 -2
- package/views/dist/controls/sheet/bottom-sheet.d.ts +3 -1
- package/views/dist/controls/sheet/bottom-sheet.js +2 -2
- package/views/dist/controls/sort-editor/map-sort-body.js +4 -4
- package/views/dist/controls/sort-editor/sort-editor.d.ts +2 -0
- package/views/dist/controls/sort-editor/sort-editor.js +4 -5
- package/views/dist/controls/text-editor/map-text-body.js +5 -1
- package/views/dist/controls/text-editor/text-editor.js +5 -4
- package/views/dist/controls/toolbar/toolbar.d.ts +29 -14
- package/views/dist/controls/toolbar/toolbar.js +17 -22
- package/views/dist/controls/toolbar.css +0 -5
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +4 -2
- package/views/dist/controls/values-editor/map-values-body.d.ts +1 -2
- package/views/dist/controls/values-editor/map-values-body.js +5 -1
- package/views/dist/controls/values-editor/values-editor.js +8 -7
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -2
- package/views/dist/controls/views-list/map-view-menu.js +6 -2
- package/views/dist/controls/views-list/map-views-list-body.d.ts +2 -1
- package/views/dist/controls/views-list/map-views-list-body.js +6 -5
- package/views/dist/controls/views-list/view-menu.js +3 -4
- package/views/dist/controls/views-list/views-list.js +2 -2
- package/views/dist/display/option-badges.d.ts +16 -0
- package/views/dist/display/option-badges.js +11 -0
- package/views/dist/display/relation-link.d.ts +12 -0
- package/views/dist/display/relation-link.js +17 -0
- package/views/dist/display/relation.d.ts +1 -1
- package/views/dist/display/relation.js +10 -3
- package/views/dist/display/select.js +1 -8
- package/views/dist/editors/EditorPanel.js +4 -4
- package/views/dist/editors/RangeEditor.d.ts +3 -0
- package/views/dist/editors/RangeEditor.js +2 -2
- package/views/dist/editors/SelectEditor.d.ts +2 -2
- package/views/dist/editors/SelectEditor.js +1 -1
- package/views/dist/editors/TextEditor.js +4 -2
- package/views/dist/editors/ValueListEditor.js +2 -1
- package/views/dist/field-row/FieldRow.js +32 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +2 -1
- package/views/dist/grid/chrome/GridAddColumn.js +9 -6
- package/views/dist/grid/chrome/GridCellEditors.js +1 -1
- package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -1
- package/views/dist/grid/chrome/GridCellOutline.js +16 -6
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +7 -4
- package/views/dist/grid/chrome/GridFooter.d.ts +4 -1
- package/views/dist/grid/chrome/GridFooter.js +4 -4
- package/views/dist/grid/chrome/GridGroupMenu.js +39 -14
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -1
- package/views/dist/grid/chrome/GridHeader.js +1 -2
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +4 -1
- package/views/dist/grid/chrome/GridRangeEditor.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +5 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +4 -1
- package/views/dist/grid/chrome/GridRowActions.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +3 -2
- package/views/dist/grid/chrome/GridStructure.js +1 -1
- package/views/dist/grid/chrome/GridTable.js +32 -20
- package/views/dist/grid/chrome/checks.d.ts +1 -1
- package/views/dist/grid/chrome/checks.js +4 -1
- package/views/dist/grid/chrome/grid-cell-classes.d.ts +6 -2
- package/views/dist/grid/chrome/grid-cell-classes.js +10 -5
- package/views/dist/grid/chrome/grid-hover.d.ts +10 -2
- package/views/dist/grid/chrome/grid-hover.js +14 -4
- package/views/dist/grid/chrome/grid-row-props.d.ts +4 -0
- package/views/dist/grid/chrome/grid-rows-menu.js +9 -4
- package/views/dist/grid/chrome/grid-table-props.d.ts +10 -2
- package/views/dist/grid/grid.css +6 -0
- package/views/dist/grid/looks.d.ts +3 -1
- package/views/dist/grid/looks.js +10 -4
- package/views/dist/list/layer.d.ts +8 -0
- package/views/dist/list/layer.js +7 -0
- package/views/dist/list/list.d.ts +6 -2
- package/views/dist/list/list.js +6 -2
- package/views/dist/list/parts.js +3 -2
- package/views/dist/list/store.d.ts +1 -1
- package/views/dist/list/toolbar.js +51 -20
- package/views/dist/list/views.js +1 -0
- package/views/dist/panels/availability.d.ts +5 -0
- package/views/dist/panels/availability.js +4 -5
- package/views/dist/panels/customize-body.d.ts +4 -0
- package/views/dist/panels/customize-body.js +13 -11
- package/views/dist/panels/model.d.ts +9 -4
- package/views/dist/panels/react/customize-body.js +5 -2
- package/views/dist/panels/react/customize.d.ts +5 -0
- package/views/dist/panels/react/filter/FilterEditor.d.ts +6 -0
- package/views/dist/panels/react/filter/FilterEditor.js +7 -0
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +3 -1
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +7 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +17 -1
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +15 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +24 -9
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +3 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +14 -6
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +7 -3
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +21 -10
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +5 -4
- package/views/dist/panels/react/toolbar/ToolbarSort.d.ts +7 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +6 -3
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +3 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +7 -6
- package/views/dist/panels/react/toolbar/context.d.ts +21 -0
- package/views/dist/panels/react/toolbar/context.js +4 -0
- package/views/dist/panels/react/toolbar/pane-host.d.ts +6 -0
- package/views/dist/panels/react/toolbar/pane-host.js +17 -0
- package/views/dist/panels/react/toolbar/panel-part.js +3 -2
- package/views/dist/panels/react/views-row/ViewPicker.js +13 -5
- package/views/dist/panels/react.d.ts +2 -2
- package/views/dist/panels/settings/layout.js +6 -38
- package/views/dist/panels/toolbar/page-resets.d.ts +17 -0
- package/views/dist/panels/toolbar/page-resets.js +62 -0
- package/views/dist/panels/toolbar/same-item.d.ts +7 -0
- package/views/dist/panels/toolbar/same-item.js +9 -0
- package/views/dist/panels/view-state.d.ts +4 -0
- package/views/dist/provider/ViewsProvider.d.ts +9 -3
- package/views/dist/provider/ViewsProvider.js +13 -2
- package/views/dist/provider/components.d.ts +59 -8
- package/views/dist/provider/components.js +1 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/styles.css +194 -100
- package/views/dist/styles.unlayered.css +194 -100
- package/views/docs/contract.md +96 -27
- package/views/docs/controls/alert-dialog.md +4 -0
- package/views/docs/controls/alert.md +4 -0
- package/views/docs/controls/avatar.md +3 -0
- package/views/docs/controls/bulk-bar.md +7 -1
- package/views/docs/controls/compound-editor.md +2 -0
- package/views/docs/controls/customize.md +3 -1
- package/views/docs/controls/date-editor.md +2 -0
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/group-editor.md +2 -0
- package/views/docs/controls/links-editor.md +2 -0
- package/views/docs/controls/menu.md +3 -1
- package/views/docs/controls/modal.md +4 -0
- package/views/docs/controls/number-editor.md +2 -0
- package/views/docs/controls/pane.md +1 -1
- package/views/docs/controls/picker.md +2 -0
- package/views/docs/controls/quick-filters.md +4 -2
- package/views/docs/controls/sheet.md +1 -1
- package/views/docs/controls/text-editor.md +3 -1
- package/views/docs/controls/toolbar.md +4 -0
- package/views/docs/controls/values-editor.md +2 -0
- package/views/docs/controls/views-list.md +2 -0
- package/views/docs/guides/atoms.md +54 -3
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/looks.md +1 -1
- package/views/docs/guides/the-grid.md +4 -2
- package/views/docs/guides/the-provider.md +4 -4
- package/views/docs/index.md +2 -2
- package/views/docs/install.md +198 -104
- package/views/docs/reference/controls.md +21 -17
- package/views/docs/reference/editors-range.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +2 -1
- package/views/docs/reference/list.md +7 -5
- package/views/docs/reference/looks.md +6 -6
- package/views/docs/reference/panels-react.md +17 -15
- package/views/docs/reference/panels.md +4 -4
- package/views/docs/reference/react.md +15 -12
- package/views/docs/reference/views.md +6 -4
- package/views/docs/reshaping.md +32 -5
- package/views/skills/views/SKILL.md +3 -3
|
@@ -4,6 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { useViews } from "../../provider/context.js";
|
|
5
5
|
import { Picker } from "./picker.js";
|
|
6
6
|
import { pickerWordsOf } from "./map-picker.js";
|
|
7
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
7
8
|
const SEP = "\u0000";
|
|
8
9
|
export const farValue = (relation, key) => `${relation}${SEP}${key}`;
|
|
9
10
|
export const pickOf = (value) => {
|
|
@@ -35,9 +36,36 @@ export function fieldsBodyHandlers({ onPick, onDone }, held = { current: false }
|
|
|
35
36
|
},
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
|
-
export function MapFieldsBody(
|
|
39
|
+
export function MapFieldsBody(props) {
|
|
40
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(FieldsBodyInner, { ...props }) });
|
|
41
|
+
}
|
|
42
|
+
function FieldsBodyInner({ label, search, fields, own, form, onPick, onDone }) {
|
|
39
43
|
const { messages } = useViews();
|
|
40
44
|
const picked = React.useRef(false);
|
|
41
45
|
const on = () => fieldsBodyHandlers({ onPick, onDone }, picked);
|
|
42
|
-
|
|
46
|
+
const box = React.useRef(null);
|
|
47
|
+
React.useLayoutEffect(() => {
|
|
48
|
+
const at = box.current;
|
|
49
|
+
let gone = false;
|
|
50
|
+
const hold = () => {
|
|
51
|
+
const list = at?.querySelector('.o-picker[data-picker-form="computer"]'), input = list?.querySelector(".o-picker-search input");
|
|
52
|
+
if (gone || !at || !list || !input)
|
|
53
|
+
return;
|
|
54
|
+
at.style.removeProperty("--picker-floor");
|
|
55
|
+
const s = getComputedStyle(input), line = input.closest(".o-picker-search"), pen = document.createElement("canvas").getContext("2d");
|
|
56
|
+
const px = (v) => parseFloat(v) || 0, edge = list.getBoundingClientRect(), field = input.getBoundingClientRect();
|
|
57
|
+
const round = field.left + px(s.borderLeftWidth) + px(s.paddingLeft) - edge.left
|
|
58
|
+
+ px(s.paddingRight) + px(s.borderRightWidth) + px(getComputedStyle(line).paddingRight) + (edge.right - line.getBoundingClientRect().right);
|
|
59
|
+
let words = 0;
|
|
60
|
+
if (pen && input.placeholder) {
|
|
61
|
+
pen.font = `${s.fontStyle} ${s.fontWeight} ${s.fontSize} ${s.fontFamily}`;
|
|
62
|
+
words = pen.measureText(input.placeholder).width;
|
|
63
|
+
}
|
|
64
|
+
at.style.setProperty("--picker-floor", `${Math.ceil(Math.max(edge.width, round + words))}px`);
|
|
65
|
+
};
|
|
66
|
+
hold();
|
|
67
|
+
void document.fonts?.ready.then(hold);
|
|
68
|
+
return () => { gone = true; };
|
|
69
|
+
}, []);
|
|
70
|
+
return _jsx("span", { ref: box, className: "o-fields-body", children: _jsx(Picker, { label: label, items: fieldItemsOf(fields, messages({ key: "views.panels.related-records" })), value: own ?? null, search: search, searchShown: true, form: form, words: pickerWordsOf(messages), onValueChange: (v) => on().onValueChange(v), onDone: () => on().onDone() }) });
|
|
43
71
|
}
|
|
@@ -10,14 +10,19 @@ type AppIcon = ComponentType<{
|
|
|
10
10
|
/**
|
|
11
11
|
* ViewKit's rows as the Picker's (the public rule; the editors' own `pickerItemOf` is another, internal one). The words, the
|
|
12
12
|
* second line, the group and whether it can be picked stay as they are; the kind's word comes from the badge; then how its name
|
|
13
|
-
* draws, the first that applies: an avatar where ViewKit hands one (a person, or a company by its kind
|
|
13
|
+
* draws, the first that applies: an avatar where ViewKit hands one (a person, or a company by its kind; the kind itself carried
|
|
14
|
+
* for the app's Avatar atom, so a deal stays a deal, VK-1044), the record's own glyph,
|
|
14
15
|
* a status step, an option, the app's icon (`AppIcon`; without it, none). A step between stands at its quarters among the steps
|
|
15
16
|
* between: the status's active steps when `steps` names them, so one that isn't a step (an archived option held) stands nowhere,
|
|
16
17
|
* as its cell does; else every row on a step between. A category's colour isn't drawn: the Option in the list has one look.
|
|
18
|
+
* With `cells` (ViewKit's Picker, VK-1056), a status and a category are drawn as their cells draw them instead: the app's
|
|
19
|
+
* StatusBadge at its place among the steps and the app's Tag in its colour (the colour the editor resolved, an undeclared
|
|
20
|
+
* option's derived one included), each with its icon; this needs a provider, which the Picker always stands in.
|
|
17
21
|
*/
|
|
18
|
-
export declare function pickerItemsOf(items: readonly ViewsPickerItem[], { AppIcon, steps }?: {
|
|
22
|
+
export declare function pickerItemsOf(items: readonly ViewsPickerItem[], { AppIcon, steps, cells }?: {
|
|
19
23
|
AppIcon?: AppIcon;
|
|
20
24
|
steps?: readonly string[];
|
|
25
|
+
cells?: boolean;
|
|
21
26
|
}): PickerItem[];
|
|
22
27
|
/** The Picker's words in the app's: each from its `views.picker.*` message. */
|
|
23
28
|
export declare function pickerWordsOf(say: ViewsMessageResolver): PickerWords;
|
|
@@ -26,6 +31,6 @@ export declare function pickerWordsOf(say: ViewsMessageResolver): PickerWords;
|
|
|
26
31
|
export declare const menuWordsOf: (say: ViewsMessageResolver) => MenuWords;
|
|
27
32
|
/** What the Picker is handed for ViewKit's props: its rows read as the Picker's, an action's key its id, the shell's draft, its words and its menus'. */
|
|
28
33
|
export declare function pickerPropsOf({ items, actions, steps, ...rest }: ViewsPickerProps, AppIcon?: AppIcon, words?: PickerWords, menuWords?: MenuWords): PickerProps;
|
|
29
|
-
/** ViewKit's pick list,
|
|
34
|
+
/** ViewKit's pick list, its controls the app's where the provider's `panelControls` names them, wherever it stands (VK-1022). */
|
|
30
35
|
export declare function MapPicker(props: ViewsPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
31
36
|
export {};
|
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useViews } from "../../provider/context.js";
|
|
4
4
|
import { quartersOf, statusPlaceOf } from "../status/atom-status-badge.js";
|
|
5
|
+
import { OptionCategory, OptionStatus } from "../../display/option-badges.js";
|
|
6
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
5
7
|
import { Picker } from "./picker.js";
|
|
6
|
-
export function pickerItemsOf(items, { AppIcon, steps } = {}) {
|
|
8
|
+
export function pickerItemsOf(items, { AppIcon, steps, cells } = {}) {
|
|
7
9
|
const between = (i) => i.avatarUrl === undefined && !i.glyph && !!i.slot && statusPlaceOf(i.slot) === "between";
|
|
8
10
|
const onSteps = items.filter((i) => between(i) && (!steps || steps.includes(i.value)));
|
|
11
|
+
const stepOptions = items.filter((i) => i.avatarUrl === undefined && !i.glyph && !!i.slot && (!steps || steps.includes(i.value))).map((i) => ({ value: i.value, label: i.label, slot: i.slot }));
|
|
12
|
+
const placeOf = (value) => { const index = stepOptions.findIndex((o) => o.value === value); return index < 0 ? undefined : { index, options: stepOptions }; };
|
|
9
13
|
return items.map((i) => {
|
|
10
14
|
const item = { value: i.value, label: i.label };
|
|
11
15
|
if (i.line !== undefined)
|
|
@@ -17,9 +21,13 @@ export function pickerItemsOf(items, { AppIcon, steps } = {}) {
|
|
|
17
21
|
if (i.badge !== undefined)
|
|
18
22
|
item.kind = i.badge;
|
|
19
23
|
if (i.avatarUrl !== undefined)
|
|
20
|
-
item.as = { avatar: i.kind === "company" ? "company" : "person", id: i.value, ...(i.avatarUrl ? { src: i.avatarUrl } : {}) };
|
|
24
|
+
item.as = { avatar: i.kind === "company" ? "company" : "person", id: i.value, ...(i.avatarUrl ? { src: i.avatarUrl } : {}), ...(i.kind !== undefined ? { kind: i.kind } : {}) };
|
|
21
25
|
else if (i.glyph)
|
|
22
26
|
item.as = { mark: i.glyph };
|
|
27
|
+
else if (i.slot && cells)
|
|
28
|
+
item.as = { chip: _jsx(OptionStatus, { slot: i.slot, label: i.label, icon: i.icon, place: placeOf(i.value) }) };
|
|
29
|
+
else if (i.color && cells)
|
|
30
|
+
item.as = { chip: _jsx(OptionCategory, { label: i.label, color: i.color, icon: i.icon }) };
|
|
23
31
|
else if (i.slot) {
|
|
24
32
|
const status = statusPlaceOf(i.slot);
|
|
25
33
|
item.as = status !== "between" ? { status } : { status, quarters: onSteps.includes(i) ? quartersOf(onSteps, i) : 2 };
|
|
@@ -65,12 +73,15 @@ export function pickerPropsOf({ items, actions, steps, ...rest }, AppIcon, words
|
|
|
65
73
|
...rest,
|
|
66
74
|
...(words ? { words } : {}),
|
|
67
75
|
...(menuWords ? { menuWords } : {}),
|
|
68
|
-
items: pickerItemsOf(items, { ...(AppIcon ? { AppIcon } : {}), ...(steps ? { steps } : {}) }),
|
|
76
|
+
items: pickerItemsOf(items, { ...(AppIcon ? { AppIcon } : {}), ...(steps ? { steps } : {}), cells: true }),
|
|
69
77
|
...(actions ? { actions: actions.map((a) => ({ id: a.key, label: a.label, icon: a.icon ?? null, onSelect: a.onSelect })) } : {}),
|
|
70
78
|
draft: "shell",
|
|
71
79
|
};
|
|
72
80
|
}
|
|
73
81
|
export function MapPicker(props) {
|
|
82
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(PickerInner, { ...props }) });
|
|
83
|
+
}
|
|
84
|
+
function PickerInner(props) {
|
|
74
85
|
const { components, messages } = useViews();
|
|
75
86
|
return _jsx(Picker, { ...pickerPropsOf(props, components.AppIcon, pickerWordsOf(messages), menuWordsOf(messages)) });
|
|
76
87
|
}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Combobox as BaseCombobox } from "@base-ui/react/combobox";
|
|
4
|
-
import {
|
|
5
|
-
import { Button } from "../button/button.js";
|
|
4
|
+
import { RecordMark } from "../avatar/record-mark.js";
|
|
6
5
|
import { CheckboxMark } from "../checkbox/checkbox.js";
|
|
7
|
-
import { GlassButton } from "../glass-button/glass-button.js";
|
|
8
6
|
import { Input, InputGroup, InputGroupAddon } from "../input/input.js";
|
|
9
7
|
import { Kbd } from "../kbd/kbd.js";
|
|
10
|
-
import {
|
|
8
|
+
import { menuDotsProps } from "../menu/menu.js";
|
|
11
9
|
import { Option } from "../option/option.js";
|
|
12
10
|
import { Spinner } from "../spinner/spinner.js";
|
|
13
11
|
import { StatusGlyph } from "../status/status.js";
|
|
14
12
|
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
15
13
|
import { partAttrs } from "../internal/part-slot.js";
|
|
14
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
16
15
|
import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
|
|
17
16
|
import { cx } from "../../internal/cx.js";
|
|
18
17
|
import { Icon } from "../internal/icons.js";
|
|
@@ -66,6 +65,7 @@ export const PICKER_WORDS = {
|
|
|
66
65
|
you: "you",
|
|
67
66
|
};
|
|
68
67
|
function LeadMark({ lead, value }) {
|
|
68
|
+
const { Button } = usePanelControls();
|
|
69
69
|
if (lead.value === value)
|
|
70
70
|
return _jsx("span", { className: "o-picker-lead", "data-slot": "vk-picker-lead", children: lead.label });
|
|
71
71
|
const stop = (e) => e.stopPropagation();
|
|
@@ -92,6 +92,8 @@ function Name({ item, phone }) {
|
|
|
92
92
|
const as = item.as;
|
|
93
93
|
if (as && "option" in as)
|
|
94
94
|
return _jsx(Option, { size: phone ? "lg" : undefined, children: item.label });
|
|
95
|
+
if (as && "chip" in as)
|
|
96
|
+
return _jsx(_Fragment, { children: as.chip });
|
|
95
97
|
if (as && "status" in as)
|
|
96
98
|
return _jsxs(_Fragment, { children: [_jsx("span", { className: "o-picker-mark", children: _jsx(StatusGlyph, { place: as.status, quarters: as.quarters }) }), item.label] });
|
|
97
99
|
if (as && "sign" in as)
|
|
@@ -104,7 +106,7 @@ function Face({ item, phone, size = 20 }) {
|
|
|
104
106
|
const as = item.as;
|
|
105
107
|
if (!as || !("avatar" in as))
|
|
106
108
|
return null;
|
|
107
|
-
return _jsx(
|
|
109
|
+
return _jsx(RecordMark, { label: item.label, shape: as.avatar === "company" ? "thing" : "person", id: as.id, src: as.src, kind: as.kind, size: phone ? 40 : size });
|
|
108
110
|
}
|
|
109
111
|
const After = ({ item }) => (item.after == null ? null : _jsx("span", { className: "o-picker-after", children: item.after }));
|
|
110
112
|
const lineOf = (item, kind) => kind === "line" && item.kind ? (item.line ? `${item.kind} · ${item.line}` : item.kind) : item.line;
|
|
@@ -182,6 +184,7 @@ export function usePicker(props) {
|
|
|
182
184
|
return usePickerAt(props);
|
|
183
185
|
}
|
|
184
186
|
function usePickerAt(props, under) {
|
|
187
|
+
const { Button, Menu, RoundButton } = usePanelControls();
|
|
185
188
|
const { label, items, multiple, value, onDone, empty, search, onSearch, doing, onRetry, onMore, nothingYet, actions = [], readOnly, none: noneWords } = props;
|
|
186
189
|
const w = { ...PICKER_WORDS, ...props.words };
|
|
187
190
|
const menuWords = { ...props.menuWords, ...(props.words ? { picker: props.words } : {}) };
|
|
@@ -623,7 +626,7 @@ function usePickerAt(props, under) {
|
|
|
623
626
|
setRowMenu({ value: item.value, anchor: e.currentTarget });
|
|
624
627
|
};
|
|
625
628
|
return form === "phone"
|
|
626
|
-
? _jsx(
|
|
629
|
+
? _jsx(Button, { ...menuDotsProps(w.rowActions(item.label), "o-picker-row-menu"), "data-slot": "vk-picker-row-more", "data-key": item.value, onClick: open, onKeyDown: stopKeys })
|
|
627
630
|
: _jsx(Button, { kind: "quiet", shape: "icon", size: "20", tabIndex: -1, className: "o-picker-row-menu", "data-slot": "vk-picker-row-more", "data-key": item.value, "data-shown": props.rowMenus ?? "always", "aria-label": w.rowActions(item.label), icon: glyph(DOTS_V), onClick: open, onKeyDown: stopKeys });
|
|
628
631
|
};
|
|
629
632
|
const hasMenu = (item) => !!item.menu?.length;
|
|
@@ -807,10 +810,10 @@ function usePickerAt(props, under) {
|
|
|
807
810
|
const menu = under ? [] : actions.map((a) => ({ icon: a.icon, label: a.label, onSelect: a.onSelect, slot: { slot: "vk-picker-action", key: a.id } }));
|
|
808
811
|
const underActions = under && !typed && actions.length > 0 && (_jsx("div", { className: "o-picker-under", children: actions.map((a) => _jsx(Button, { kind: "outline", size: "44", icon: a.icon, "data-slot": "vk-picker-action", "data-key": a.id, onClick: a.onSelect, children: a.label }, a.id)) }));
|
|
809
812
|
const showBar = !none && (pill || creatable || addable || menu.length > 0 || (!!level && !byHolder));
|
|
810
|
-
const bar = showBar && (_jsxs("div", { className: "o-picker-bar", children: [level && !byHolder && _jsx(
|
|
813
|
+
const bar = showBar && (_jsxs("div", { className: "o-picker-bar", children: [level && !byHolder && _jsx(RoundButton, { "aria-label": w.back(level.label), icon: glyph(BACK), className: "o-picker-round", "data-slot": "vk-picker-back", "data-back": "", onMouseDown: (e) => e.preventDefault(), onClick: () => back() }), pill && (_jsxs(InputGroup, { size: "lg", className: "o-picker-pill", "data-slot": "vk-picker-search", ...pillTap, children: [_jsx(InputGroupAddon, { side: "start", children: glyph(SEARCH) }), _jsx(Input, { combobox: true, autofill: false, ref: pillInput, placeholder: search, "aria-label": search ?? label, onKeyDown: (e) => { if (!backKey(e))
|
|
811
814
|
enter(e); } })] })), addable ? _jsx(Button, { kind: "primary", size: "lg", icon: glyph(PLUS), loading: adding !== undefined, className: "o-picker-create-button", "data-slot": "vk-picker-add", onClick: () => onAdd(typed), children: w.addButton })
|
|
812
815
|
: creatable && !add ? _jsx(Button, { kind: "primary", size: "lg", icon: glyph(PLUS), className: "o-picker-create-button", "data-slot": "vk-picker-create", onClick: createTyped, children: w.createButton })
|
|
813
|
-
: menu.length > 0 && _jsx(Menu, { label: label, entries: menu, words: menuWords, trigger: _jsx(
|
|
816
|
+
: menu.length > 0 && _jsx(Menu, { label: label, entries: menu, words: menuWords, trigger: _jsx(RoundButton, { "aria-label": w.actions, icon: glyph(DOTS), className: "o-picker-round", "data-slot": "vk-picker-more" }) })] }));
|
|
814
817
|
const menuOpen = (item) => (menuOpenFor(item.value) ? { "data-menu-open": "" } : {});
|
|
815
818
|
const heldHere = (v) => inPlace && kept.includes(v);
|
|
816
819
|
const rowValue = (item) => (heldHere(item.value) && !changing ? { key: `unpick:${item.value}`, kind: "unpick", item } : itemEntry(item));
|
|
@@ -2,10 +2,14 @@ import type { PartSlot } from "../internal/part-slot.js";
|
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type { StatusPlace } from "../status/status.js";
|
|
4
4
|
import type { MenuEntry } from "../menu-list/menu-list.js";
|
|
5
|
-
/** How a row draws its name: an Option chip (a select's value), a step with its Status glyph, an Avatar before it
|
|
6
|
-
*
|
|
5
|
+
/** How a row draws its name: an Option chip (a select's value), a step with its Status glyph, an Avatar before it (its `kind` the
|
|
6
|
+
* record's kind as the app names it, handed to the app's Avatar atom where the provider opts it in, VK-1044), a sign
|
|
7
|
+
* before it (a currency's €), a mark before it (a country's flag), a chip drawn in place of its words (a field's option as its
|
|
8
|
+
* cell draws it, VK-1056), or, left out, plain words. */
|
|
7
9
|
export type PickerAs = {
|
|
8
10
|
option: true;
|
|
11
|
+
} | {
|
|
12
|
+
chip: ReactNode;
|
|
9
13
|
} | {
|
|
10
14
|
status: StatusPlace;
|
|
11
15
|
quarters?: 1 | 2 | 3;
|
|
@@ -13,6 +17,7 @@ export type PickerAs = {
|
|
|
13
17
|
avatar: "person" | "company";
|
|
14
18
|
id?: string;
|
|
15
19
|
src?: string;
|
|
20
|
+
kind?: string;
|
|
16
21
|
} | {
|
|
17
22
|
sign: string;
|
|
18
23
|
} | {
|
|
@@ -68,8 +68,17 @@
|
|
|
68
68
|
.o-picker[data-picker-form="computer"] .o-list-row { --list-row-rad: var(--list-row-corners, var(--list-row-r, var(--list-box-r, var(--vk-radius-lg))));
|
|
69
69
|
--list-row-pill-in: var(--list-row-corners-pill, var(--list-row-pill, var(--list-box-pill, 0))); }
|
|
70
70
|
.o-picker[data-picker-form="computer"] .o-picker-rows {
|
|
71
|
-
max-height: calc(var(--list-rows) * var(--list-row-h, calc(var(--vk-spacing) * 8))); scroll-padding-block: var(--list-row-h, calc(var(--vk-spacing) * 8));
|
|
71
|
+
max-height: calc(var(--list-rows, 8.5) * var(--list-row-h, calc(var(--vk-spacing) * 8))); scroll-padding-block: var(--list-row-h, calc(var(--vk-spacing) * 8));
|
|
72
72
|
}
|
|
73
|
+
/* ViewKit's field list (CONTROLS.FieldsBody, wrapped in .o-fields-body, which draws no box) stands as wide as its widest row:
|
|
74
|
+
its search fills that width and never sets it, though its placeholder reads whole, a row's check takes room only on the row the field holds, and ViewKit's
|
|
75
|
+
Popover holding it fits it, never past the 288 it stands at otherwise nor the room on screen, at least what opened it. */
|
|
76
|
+
.o-fields-body { display: contents; }
|
|
77
|
+
.o-fields-body .o-picker[data-picker-form="computer"] .o-picker-search { contain: inline-size; }
|
|
78
|
+
/* Never narrower than it opened nor than its search's placeholder (map-fields-body.tsx measures both as it opens). */
|
|
79
|
+
.o-fields-body .o-picker[data-picker-form="computer"] { min-width: var(--picker-floor, 0px); }
|
|
80
|
+
.o-fields-body .o-picker[data-picker-form="computer"] .o-list-row:not([data-selected], [aria-selected="true"]) > .o-picker-check { display: none; }
|
|
81
|
+
.o-popover:has(> .o-popover-cut > .o-fields-body .o-picker[data-picker-form="computer"]) { width: fit-content; max-width: min(calc(var(--vk-spacing) * 72), var(--available-width, 100%)); }
|
|
73
82
|
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])) {
|
|
74
83
|
--popover-edge: var(--list-edge, var(--vk-border)); --divider-colour: var(--list-sep-colour, var(--vk-border)); --popover-shadow: var(--list-shadow, var(--vk-shadow-xl)); --popover-pad: var(--list-pad, calc(var(--vk-spacing) * 1.5));
|
|
75
84
|
--popover-corners: calc(min(var(--list-box-r, var(--vk-radius-lg)), var(--vk-radius-2xl)) + var(--list-pad, calc(var(--vk-spacing) * 1.5)));
|
|
@@ -27,5 +27,6 @@ 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
|
-
|
|
30
|
+
/** ViewKit's quick filters, drawing the app's controls where the provider's `panelControls` names them (VK-1014). */
|
|
31
|
+
export declare function MapQuickFiltersBody(props: ViewsQuickFiltersBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
31
32
|
export {};
|
|
@@ -6,7 +6,8 @@ import { ViewsContext } from "../../provider/context.js";
|
|
|
6
6
|
import { glyph, X } from "../internal/editor-parts.js";
|
|
7
7
|
import { HeaderBar } from "../phone-header/header-bar.js";
|
|
8
8
|
import { pickerItemsOf } from "../picker/map-picker.js";
|
|
9
|
-
import {
|
|
9
|
+
import { PanelHeadButton } from "../internal/head-button.js";
|
|
10
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
10
11
|
import { QuickFilters } from "./quick-filters.js";
|
|
11
12
|
export function quickHoldsOf(hold) {
|
|
12
13
|
return Object.fromEntries(hold.filter((h) => h.values.length).map((h) => [h.fieldKey, [...h.values]]));
|
|
@@ -29,7 +30,7 @@ function markOf(item) {
|
|
|
29
30
|
return as.quarters ? { status, quarters: as.quarters } : { status };
|
|
30
31
|
}
|
|
31
32
|
if ("avatar" in as)
|
|
32
|
-
return { avatar: as.avatar, ...(as.id ? { id: as.id } : {}) };
|
|
33
|
+
return { avatar: as.avatar, ...(as.id ? { id: as.id } : {}), ...(as.src ? { src: as.src } : {}), ...(as.kind !== undefined ? { kind: as.kind } : {}) };
|
|
33
34
|
return undefined;
|
|
34
35
|
}
|
|
35
36
|
export function quickFiltersFieldsOf(fields) {
|
|
@@ -49,11 +50,15 @@ export const quickFiltersWordsOf = (say) => ({
|
|
|
49
50
|
search: (field) => say({ key: "views.panels.quick-search", values: { field } }),
|
|
50
51
|
clear: say({ key: "views.panels.quick-clear-value" }),
|
|
51
52
|
none: say({ key: "views.panels.quick-none" }),
|
|
53
|
+
nothing: say({ key: "views.panels.filter-no-options" }),
|
|
52
54
|
});
|
|
53
|
-
export function MapQuickFiltersBody(
|
|
55
|
+
export function MapQuickFiltersBody(props) {
|
|
56
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(QuickFiltersBodyInner, { ...props }) });
|
|
57
|
+
}
|
|
58
|
+
function QuickFiltersBodyInner({ label, fields, hold, several, showCounts, form, onHoldChange, onDone, actions }) {
|
|
54
59
|
const views = React.useContext(ViewsContext);
|
|
55
60
|
const messages = views?.messages ?? resolveViewsMessage;
|
|
56
61
|
const words = React.useMemo(() => quickFiltersWordsOf(messages), [messages]);
|
|
57
62
|
const quick = React.useMemo(() => quickFiltersFieldsOf(fields), [fields]);
|
|
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(
|
|
63
|
+
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(PanelHeadButton, { "data-slot": "vk-editor-close", "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 }) })] }));
|
|
59
64
|
}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cx } from "../../internal/cx.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { RecordMark } from "../avatar/record-mark.js";
|
|
6
|
+
import { InputGroup, InputGroupAddon } from "../input/input.js";
|
|
7
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
7
8
|
import { Icon } from "../internal/icons.js";
|
|
8
9
|
import { usePhoneForm } from "../internal/phone.js";
|
|
9
10
|
import { Scrollbar } from "../scrollbar/scrollbar.js";
|
|
@@ -29,7 +30,7 @@ function Mark({ value, phone }) {
|
|
|
29
30
|
return null;
|
|
30
31
|
return _jsx("span", { className: "o-quick-filters-mark", "aria-hidden": "true", children: "status" in m
|
|
31
32
|
? _jsx(StatusGlyph, { place: m.status, quarters: m.quarters })
|
|
32
|
-
: _jsx(
|
|
33
|
+
: _jsx(RecordMark, { label: value.label, shape: m.avatar === "company" ? "thing" : "person", id: m.id, picture: m.src, kind: m.kind, size: phone ? 24 : 20 }) });
|
|
33
34
|
}
|
|
34
35
|
function Values({ field, values, held, several, onPress, search, phone, clear }) {
|
|
35
36
|
const [at, setAt] = React.useState(() => Math.max(0, values.findIndex((v) => held.includes(v.value)))), rows = React.useRef([]);
|
|
@@ -50,13 +51,14 @@ function Values({ field, values, held, several, onPress, search, phone, clear })
|
|
|
50
51
|
onPress(values[i].value);
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "o-quick-filters-values", role: "listbox", "aria-label": field.name, "aria-multiselectable": several || undefined, "data-quiet": held.length ? "" : undefined, children: values.map((v, i) => {
|
|
54
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "o-quick-filters-values", "data-slot": "vk-quick-values", "data-key": field.id, role: "listbox", "aria-label": field.name, "aria-multiselectable": several || undefined, "data-quiet": held.length ? "" : undefined, children: values.map((v, i) => {
|
|
54
55
|
const on = held.includes(v.value);
|
|
55
56
|
return (_jsxs("div", { ref: (el) => { rows.current[i] = el; }, role: "option", "aria-selected": on, tabIndex: i === here ? 0 : -1, className: "o-quick-filters-value", "data-slot": "vk-quick-value", "data-key": v.value, "data-held": on ? "" : undefined, onClick: () => { setAt(i); onPress(v.value); }, onKeyDown: (e) => keys(e, i), children: [_jsx(Mark, { value: v, phone: phone }), _jsx("span", { className: "o-quick-filters-name", children: v.label }), on && _jsx("span", { className: "o-quick-filters-clear", "data-slot": "vk-quick-clear", "aria-hidden": "true", children: clear }), v.count !== undefined && _jsx("span", { className: "o-quick-filters-count", "data-slot": "vk-quick-count", children: v.count.toLocaleString("en-GB") })] }, v.value));
|
|
56
57
|
}) }), _jsx(Scrollbar, {})] }));
|
|
57
58
|
}
|
|
58
59
|
export function QuickFilters({ fields, holds, onHoldsChange, open: openGiven, onOpenChange, counts = true, form: given, onDone, words, className }) {
|
|
59
60
|
const phone = usePhoneForm(given), form = phone ? "phone" : "computer", w = quickFiltersWords(words);
|
|
61
|
+
const { Input } = usePanelControls();
|
|
60
62
|
const root = React.useRef(null), searchBox = React.useRef(null), holding = useHolding(root);
|
|
61
63
|
const [own, setOwn] = React.useState(() => firstOpen(fields, holds)), [query, setQuery] = React.useState("");
|
|
62
64
|
const open = openGiven ?? own;
|
|
@@ -83,7 +85,7 @@ export function QuickFilters({ fields, holds, onHoldsChange, open: openGiven, on
|
|
|
83
85
|
root.current?.querySelector(".o-quick-filters-value")?.focus();
|
|
84
86
|
};
|
|
85
87
|
return (_jsxs("div", { ref: root, className: cx("o-quick-filters", className), "data-slot": "vk-quick", "data-kit": "quick-filters", "data-form": form, children: [_jsxs("div", { className: "o-quick-filters-top", children: [_jsx(ToggleGroup, { "aria-label": w.fields, kind: "pill", size: phone ? "sm" : "xs", spacing: phone ? 2 : 1.5, value: [field.id], onValueChange: (v) => { if (v[0])
|
|
86
|
-
show(v[0]); }, className: "o-quick-filters-strip", children: fields.map((f) => _jsx(Toggle, { value: f.id, "data-slot": "vk-quick-field", "data-key": f.id, children: f.name }, f.id)) }), searching && (_jsxs(InputGroup, { size: phone ? "lg" : "sm", chrome: "soft", "data-slot": "vk-quick-search", children: [_jsx(InputGroupAddon, { children: _jsx(Icon, { name: "search" }) }), _jsx(Input, { ref: searchBox, value: query, onValueChange: setQuery, placeholder: field.search, "aria-label": field.search ?? w.search(field.name), onKeyDown: toFirst })] }))] }), values.length
|
|
88
|
+
show(v[0]); }, className: "o-quick-filters-strip", "data-slot": "vk-quick-strip", children: fields.map((f) => _jsx(Toggle, { value: f.id, "data-slot": "vk-quick-field", "data-key": f.id, children: f.name }, f.id)) }), searching && (_jsxs(InputGroup, { size: phone ? "lg" : "sm", chrome: "soft", "data-slot": "vk-quick-search", children: [_jsx(InputGroupAddon, { children: _jsx(Icon, { name: "search" }) }), _jsx(Input, { ref: searchBox, value: query, onValueChange: setQuery, placeholder: field.search, "aria-label": field.search ?? w.search(field.name), onKeyDown: toFirst })] }))] }), values.length
|
|
87
89
|
? _jsx(Values, { field: field, values: values, held: heldIn(holds, field.id), several: holding === "several", onPress: press, search: searchBox, phone: phone, clear: w.clear }, `${field.id}:${query}`)
|
|
88
|
-
: _jsx("p", { className: "o-quick-filters-none", "data-slot": "vk-quick-none", role: "status", children: w.none })] }));
|
|
90
|
+
: _jsx("p", { className: "o-quick-filters-none", "data-slot": "vk-quick-none", role: "status", children: query ? w.none : w.nothing })] }));
|
|
89
91
|
}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
5
5
|
import { cx as cn } from "../../internal/cx.js";
|
|
6
|
-
import {
|
|
6
|
+
import { RecordMark } from "../avatar/record-mark.js";
|
|
7
7
|
import { Button } from "../button/button.js";
|
|
8
8
|
import { Icon } from "../internal/icons.js";
|
|
9
9
|
import { StatusGlyph } from "../status/status.js";
|
|
@@ -16,7 +16,7 @@ function Mark({ held }) {
|
|
|
16
16
|
return null;
|
|
17
17
|
return _jsx("span", { className: "o-quick-filters-mark", "aria-hidden": "true", children: "status" in m
|
|
18
18
|
? _jsx(StatusGlyph, { place: m.status, quarters: m.quarters })
|
|
19
|
-
: _jsx(
|
|
19
|
+
: _jsx(RecordMark, { label: held.name, shape: m.avatar === "company" ? "thing" : "person", id: m.id, picture: m.src, kind: m.kind, size: 24 }) });
|
|
20
20
|
}
|
|
21
21
|
export function QuickFiltersReminderControl({ fields, holds, onOpen, onClear, words: given, className }) {
|
|
22
22
|
const spoken = quickFiltersReminderWords(given);
|
|
@@ -18,13 +18,16 @@ export interface QuickValue {
|
|
|
18
18
|
mark?: QuickMark;
|
|
19
19
|
count?: number;
|
|
20
20
|
}
|
|
21
|
-
/** A value's mark: a stage's Status glyph, or a person's or a company's face
|
|
21
|
+
/** A value's mark: a stage's Status glyph, or a person's or a company's face; its `src` and `kind` (the record's kind as the app
|
|
22
|
+
* names it) are handed only to the app's Avatar atom, where the provider's `panelControls` names `Avatar` (VK-1044). */
|
|
22
23
|
export type QuickMark = {
|
|
23
24
|
status: "start" | "between" | "won" | "lost";
|
|
24
25
|
quarters?: 1 | 2 | 3;
|
|
25
26
|
} | {
|
|
26
27
|
avatar: "person" | "company";
|
|
27
28
|
id?: string;
|
|
29
|
+
src?: string;
|
|
30
|
+
kind?: string;
|
|
28
31
|
};
|
|
29
32
|
/** A field's values past this many show a search over them (round 9: "past a handful"; the kit's lists search past 8). */
|
|
30
33
|
export declare const SEARCH_PAST = 8;
|
|
@@ -7,6 +7,8 @@ export interface QuickFiltersWords {
|
|
|
7
7
|
clear: string;
|
|
8
8
|
/** What a search that finds nothing says ("Nothing matches."). */
|
|
9
9
|
none: string;
|
|
10
|
+
/** What a field with no value to pick says, nothing typed ("Nothing to pick."). */
|
|
11
|
+
nothing: string;
|
|
10
12
|
}
|
|
11
13
|
export declare const QUICK_FILTERS_WORDS: QuickFiltersWords;
|
|
12
14
|
/** The words handed, each left out the English. */
|
|
@@ -3,6 +3,7 @@ export const QUICK_FILTERS_WORDS = {
|
|
|
3
3
|
search: (field) => `Search ${field}`,
|
|
4
4
|
clear: "Clear filter",
|
|
5
5
|
none: "Nothing matches.",
|
|
6
|
+
nothing: "Nothing to pick.",
|
|
6
7
|
};
|
|
7
8
|
export const quickFiltersWords = (given) => given ? { ...QUICK_FILTERS_WORDS, ...Object.fromEntries(Object.entries(given).filter(([, w]) => w !== undefined)) } : QUICK_FILTERS_WORDS;
|
|
8
9
|
export const QUICK_FILTERS_REMINDER_WORDS = {
|
|
@@ -10,6 +10,9 @@ export interface SelectItem {
|
|
|
10
10
|
mark?: React.ReactNode;
|
|
11
11
|
you?: boolean;
|
|
12
12
|
group?: string;
|
|
13
|
+
/** Its mark is your own Avatar atom (`ViewsAvatarProps`): a typed field's chip draws it again at `size: "chip"` (VK-1044).
|
|
14
|
+
* ViewKit's own Avatar needs no flag: it is drawn again at 16. */
|
|
15
|
+
avatar?: boolean;
|
|
13
16
|
/** It can't be picked: greyed, passed over by the keys. */
|
|
14
17
|
disabled?: boolean;
|
|
15
18
|
/** A line above it, setting it apart from the rows before. */
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Combobox as BaseCombobox } from "@base-ui/react/combobox";
|
|
5
5
|
import { Field as BaseField } from "@base-ui/react/field";
|
|
6
|
-
import {
|
|
6
|
+
import { isAvatarMark } from "../avatar/avatar-mark.js";
|
|
7
7
|
import { Button, buttonClass } from "../button/button.js";
|
|
8
8
|
import { Field } from "../field/field.js";
|
|
9
9
|
import { Input, InputGroupAddon } from "../input/input.js";
|
|
@@ -42,7 +42,13 @@ export function Select(props) {
|
|
|
42
42
|
return _jsx(SheetSelect, { ...props });
|
|
43
43
|
return _jsx(PickerSelect, { ...props });
|
|
44
44
|
}
|
|
45
|
-
const chipMark = (
|
|
45
|
+
const chipMark = ({ mark, avatar }) => {
|
|
46
|
+
if (!React.isValidElement(mark))
|
|
47
|
+
return mark;
|
|
48
|
+
if (isAvatarMark(mark.type))
|
|
49
|
+
return React.cloneElement(mark, { size: 16 });
|
|
50
|
+
return avatar ? React.cloneElement(mark, { size: "chip" }) : mark;
|
|
51
|
+
};
|
|
46
52
|
export const toPickerItems = (items, chips) => items.map((i) => ({ value: i.value, label: i.label, line: i.line, you: i.you, group: i.group, disabled: i.disabled, divider: i.divider,
|
|
47
53
|
as: chips ? { option: true } : i.mark ? { mark: i.mark } : undefined, ...(i.level ? { level: toPickerItems(i.level, chips) } : {}) }));
|
|
48
54
|
const titleOf = (p) => (typeof p.label === "string" ? p.label : p["aria-label"] ?? p.placeholder ?? "Choose");
|
|
@@ -110,7 +116,7 @@ function TypedBox({ p, f, trigger, field, hint, search }) {
|
|
|
110
116
|
const one = !multiple && f.chosen.length === 1 ? f.chosen[0] : undefined;
|
|
111
117
|
const slot = one?.mark != null && (_jsxs(InputGroupAddon, { side: "start", className: "o-select-mark", "aria-hidden": "true", "data-searching": q !== one.label ? "" : undefined, children: [_jsx("span", { className: "o-select-mark-own", children: one.mark }), glyph(SEARCH, "o-select-mark-search")] }));
|
|
112
118
|
const box = (_jsx(Input, { combobox: true, chrome: "bare", ref: input, className: "o-select-typed-input", placeholder: multiple && f.chosen.length ? undefined : hint, onKeyDown: search.onKeyDown, ...search.attrs, ...(p.label != null ? {} : { "aria-label": p["aria-label"] }) }));
|
|
113
|
-
return (_jsxs(BaseCombobox.InputGroup, { ref: field, className: cx("o-input o-input-group o-select-field o-select-typed o-smooth o-smooth-ease", sized(p.size)), "data-force": p["data-force"], "data-slot": p["data-slot"], "data-key": p["data-key"], "data-kit": "select", ...mark, ...busy(p), onMouseDown: keep, children: [slot, multiple ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "o-select-measure", "aria-hidden": "true", inert: true, children: _jsxs("span", { ref: measure, children: [f.chosen.map((i) => _jsx(Option, { icon: chipMark(i
|
|
119
|
+
return (_jsxs(BaseCombobox.InputGroup, { ref: field, className: cx("o-input o-input-group o-select-field o-select-typed o-smooth o-smooth-ease", sized(p.size)), "data-force": p["data-force"], "data-slot": p["data-slot"], "data-key": p["data-key"], "data-kit": "select", ...mark, ...busy(p), onMouseDown: keep, children: [slot, multiple ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "o-select-measure", "aria-hidden": "true", inert: true, children: _jsxs("span", { ref: measure, children: [f.chosen.map((i) => _jsx(Option, { icon: chipMark(i), onRemove: () => { }, children: i.label }, i.value)), _jsx(Option, { count: n }), _jsx("span", { className: "o-select-measure-words", children: q })] }) }), _jsxs(BaseCombobox.Chips, { ref: chipsBox, className: "o-select-chips", children: [f.chosen.map((i, at) => _jsx(BaseCombobox.Chip, { "data-over": at >= fit ? "" : undefined, render: _jsx(Option, { icon: chipMark(i), onRemove: () => f.setValue(f.value.filter((v) => v !== i.value)) }), children: i.label }, i.value)), fit < n && _jsx(Option, { count: n - fit }), box] })] })) : box, !small && !disabled && !p.readOnly && f.chosen.length > 0 && (_jsx(BaseCombobox.Clear, { render: (props) => _jsx(Button, { ...props, kind: "quiet", size: "2xs", shape: "icon", className: "o-select-clear", "aria-label": "Clear", icon: glyph(X, ""), children: null }) })), _jsx(SaveMark, { saving: p.saving, saved: p.saved }), _jsx(BaseCombobox.Trigger, { ref: trigger, className: "o-select-chevron o-select-typed-trigger", tabIndex: -1, "aria-label": `Show every ${typeof p.label === "string" ? p.label.toLowerCase() : "choice"}`, children: glyph(CHEVRON, "") })] }));
|
|
114
120
|
}
|
|
115
121
|
const gapOf = (at) => spacingPx(1, at), edgeOf = (at) => spacingPx(1.25, at);
|
|
116
122
|
function listNeed(at, rows, lines) {
|
|
@@ -3,11 +3,11 @@ const OUTRIGHT = { card: "outlined", rows: "snug", end: "buttons", fields: "boxe
|
|
|
3
3
|
const ATTIO = { card: "raised", rows: "roomy", end: "buttons", fields: "boxes", icon: "line" };
|
|
4
4
|
const LINEAR = { card: "edged", rows: "inset", end: "words", fields: "end", icon: "line" };
|
|
5
5
|
const options = [
|
|
6
|
-
{ id: "card", name: "Card", device: "desktop", def:
|
|
7
|
-
{ id: "rows", name: "Rows", device: "desktop", def:
|
|
8
|
-
{ id: "end", name: "End", device: "desktop", def:
|
|
9
|
-
{ id: "fields", name: "Fields", device: "desktop", def:
|
|
10
|
-
{ id: "icon", name: "Icon", device: "phone", def:
|
|
6
|
+
{ id: "card", name: "Card", device: "desktop", def: ATTIO.card, values: [{ id: "outlined", name: "Outlined" }, { id: "raised", name: "Raised" }, { id: "edged", name: "Edged" }] },
|
|
7
|
+
{ id: "rows", name: "Rows", device: "desktop", def: ATTIO.rows, values: [{ id: "snug", name: "Snug" }, { id: "roomy", name: "Roomy" }, { id: "inset", name: "Inset" }] },
|
|
8
|
+
{ id: "end", name: "End", device: "desktop", def: ATTIO.end, values: [{ id: "buttons", name: "Buttons" }, { id: "words", name: "Words" }] },
|
|
9
|
+
{ id: "fields", name: "Fields", device: "desktop", def: ATTIO.fields, values: [{ id: "boxes", name: "Boxes" }, { id: "end", name: "At the end" }] },
|
|
10
|
+
{ id: "icon", name: "Icon", device: "phone", def: ATTIO.icon, values: [{ id: "line", name: "Line" }, { id: "tile", name: "Tile" }] },
|
|
11
11
|
];
|
|
12
12
|
const looks = [
|
|
13
13
|
{ id: "outright", name: "Outright", picks: OUTRIGHT },
|
|
@@ -54,7 +54,9 @@ export type SettingRowProps = SettingRowBase & (({
|
|
|
54
54
|
} & No<"switch" | "select" | "onOpen">) | ({
|
|
55
55
|
onOpen: () => void;
|
|
56
56
|
value?: React.ReactNode;
|
|
57
|
-
} & No<"switch" | "select" | "action">)
|
|
57
|
+
} & No<"switch" | "select" | "action">)
|
|
58
|
+
/** The plain kind (VK-1036): no control and no ›, a row that only says, opening nothing. */
|
|
59
|
+
| No<"switch" | "select" | "action" | "onOpen" | "value">);
|
|
58
60
|
export interface SettingRowsProps {
|
|
59
61
|
/** The danger zone's: a red edge, each row's button the Button's danger kind unless its action says outline, on a phone its
|
|
60
62
|
* names red. */
|
|
@@ -56,7 +56,7 @@ function SettingRowOf(props) {
|
|
|
56
56
|
const phone = !!rows?.phone, worn = rows ? rows.worn : ownWorn, inWords = !phone && worn.end === "words";
|
|
57
57
|
const shut = locked != null && locked !== false;
|
|
58
58
|
const reason = shut && locked !== true ? locked : null;
|
|
59
|
-
const kind = props.switch ? "switch" : props.select ? "select" : props.action ? "action" : "open";
|
|
59
|
+
const kind = props.switch ? "switch" : props.select ? "select" : props.action ? "action" : props.onOpen ? "open" : "plain";
|
|
60
60
|
const begins = mark != null ? "mark" : icon != null || (phone && danger && props.action?.icon != null) ? "icon" : undefined;
|
|
61
61
|
const ownCard = alone && !rows && !device && worn.card === "edged";
|
|
62
62
|
const root = { className: cx("o-setting-row", phone && "o-field-row", props.switch && "o-switch-row", ownCard && "o-smooth o-smooth-ease", className), "data-setting-row-kind": kind,
|
|
@@ -102,6 +102,8 @@ function SettingRowOf(props) {
|
|
|
102
102
|
: _jsx(Button, { kind: kindOf, size: "sm", icon: a.icon, disabled: shut || a.disabled, onClick: a.onClick, children: a.label });
|
|
103
103
|
return (_jsxs("div", { ...root, children: [start, words, _jsxs("span", { className: "o-setting-row-end", children: [value, lead, act] })] }));
|
|
104
104
|
}
|
|
105
|
+
if (!props.onOpen)
|
|
106
|
+
return _jsxs("div", { ...root, children: [start, words, lead != null && _jsx("span", { className: "o-setting-row-end", children: lead })] });
|
|
105
107
|
return (_jsxs("button", { type: "button", ...root, disabled: shut, onClick: shut ? undefined : props.onOpen, children: [start, words, _jsxs("span", { className: "o-setting-row-end", children: [lead, props.value != null && _jsx("span", { className: "o-setting-row-value", children: props.value }), chevron] })] }));
|
|
106
108
|
}
|
|
107
109
|
const firstOf = (v) => (Array.isArray(v) ? v : v == null ? [] : [v]);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/* The setting row and its card, as the Outright kit draws them (setting-row/setting-row.tsx): one setting as a row, its words
|
|
2
2
|
(choice.css) on the left, its control at its end (the Switch, the Select, a Button, or its value and ›), its mark or icon at
|
|
3
3
|
its start; the rows in a card, a line between each; the danger zone's card with a red edge; a lone row bare. Two options, each
|
|
4
|
-
a computer's, picked on the frame or the app around it (looks.ts): the card (outlined,
|
|
5
|
-
and the rows (snug,
|
|
4
|
+
a computer's, picked on the frame or the app around it (looks.ts): the card (outlined, or raised on its ground, the default)
|
|
5
|
+
and the rows (snug, or roomy, 64 tall, the default). The defaults are Attio's look, which lookAttrs writes when nothing is
|
|
6
|
+
picked (VK-1035); a frame with no attribute at all still draws outlined and snug, as SwitchRows did (switch-row.css); a switch's row is no
|
|
6
7
|
press of its own, only its Switch is (KIT-969). On a phone the card and its rows are
|
|
7
8
|
Field rows' (field.css), and this sheet adds what a setting puts in them, as iOS's Settings draws it (KIT-972): the name taking
|
|
8
9
|
the room; the value in the quietest grey, cut with …, before iOS's ›; a button's words in the link colour at the end; a lone
|
|
@@ -113,8 +113,10 @@ export interface SheetProps {
|
|
|
113
113
|
finalFocus?: () => HTMLElement | null;
|
|
114
114
|
/** A class on the sheet itself, after its own. */
|
|
115
115
|
className?: string;
|
|
116
|
+
/** Its public name where a part names it (VK-1023: the bulk bar's `vk-bulk-field-sheet`; a Menu's on a phone), on the sheet. */
|
|
117
|
+
"data-slot"?: string;
|
|
116
118
|
/** Its head and its body. */
|
|
117
119
|
children: React.ReactNode;
|
|
118
120
|
}
|
|
119
121
|
/** What rises from the bottom of the phone, in a form, at stops. What it holds is poured in. */
|
|
120
|
-
export declare function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form, stops, openAt, stop, onStopChange, mark: marked, container, standing: stands, finalFocus, className, children }: SheetProps): import("react/jsx-runtime").JSX.Element;
|
|
122
|
+
export declare function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form, stops, openAt, stop, onStopChange, mark: marked, container, standing: stands, finalFocus, className, "data-slot": slot, children }: SheetProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -248,7 +248,7 @@ function useKeyboardFoot(popup, on) {
|
|
|
248
248
|
return () => { vv.removeEventListener("resize", read); vv.removeEventListener("scroll", read); popup.style.removeProperty("--sheet-keyboard"); };
|
|
249
249
|
}, [typing, popup]);
|
|
250
250
|
}
|
|
251
|
-
export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form = "full", stops, openAt, stop, onStopChange, mark: marked = "[data-sheet-mark]", container, standing: stands, finalFocus, className, children }) {
|
|
251
|
+
export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form = "full", stops, openAt, stop, onStopChange, mark: marked = "[data-sheet-mark]", container, standing: stands, finalFocus, className, "data-slot": slot, children }) {
|
|
252
252
|
const closeBelow = React.useContext(CloseAll), stacked = closeBelow !== null;
|
|
253
253
|
const standsBelow = React.useContext(Standing), standing = stands || standsBelow;
|
|
254
254
|
const [armed, setArmed] = React.useState(false);
|
|
@@ -375,5 +375,5 @@ export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form =
|
|
|
375
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) {
|
|
376
376
|
release("closed");
|
|
377
377
|
close("outside-press");
|
|
378
|
-
} } : 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-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() })] })] }) }));
|
|
378
|
+
} } : 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
379
|
}
|
|
@@ -4,11 +4,11 @@ import * as React from "react";
|
|
|
4
4
|
import { resolveViewsMessage } from "../../contract.js";
|
|
5
5
|
import { ViewsContext } from "../../provider/context.js";
|
|
6
6
|
import { glyph, TICK, X } from "../internal/editor-parts.js";
|
|
7
|
+
import { PanelHeadButton } from "../internal/head-button.js";
|
|
7
8
|
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
8
9
|
import { useToldStep } from "../internal/told-step.js";
|
|
9
10
|
import { pickerWordsOf } from "../picker/map-picker.js";
|
|
10
11
|
import { HeaderBar } from "../phone-header/header-bar.js";
|
|
11
|
-
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
12
12
|
import { useSortEditor } from "./sort-editor.js";
|
|
13
13
|
const KIT = { asc: "ascending", desc: "descending" };
|
|
14
14
|
const VIEWKIT = { ascending: "asc", descending: "desc" };
|
|
@@ -78,8 +78,8 @@ function SortBodyInner(props) {
|
|
|
78
78
|
const { actions } = props;
|
|
79
79
|
if (!actions)
|
|
80
80
|
return _jsx(_Fragment, { children: parts.body });
|
|
81
|
-
const done = actions.done && _jsx(
|
|
81
|
+
const done = actions.done && _jsx(PanelHeadButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": actions.done.label, icon: glyph(TICK), onClick: actions.done.onPress });
|
|
82
82
|
return (_jsxs(_Fragment, { children: [parts.title !== undefined
|
|
83
|
-
? _jsx(BodyHead, { title: parts.title, left: _jsx(
|
|
84
|
-
: _jsx(BodyHead, { title: props.label, left: _jsx(
|
|
83
|
+
? _jsx(BodyHead, { title: parts.title, left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-back", "aria-label": words.back, className: "o-sheet-back", icon: glyph(BACK), onClick: parts.head.onBack }), right: done || _jsx("span", {}) })
|
|
84
|
+
: _jsx(BodyHead, { title: props.label, left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-close", "aria-label": actions.close.label, icon: glyph(X), onClick: actions.close.onPress }), right: done || _jsx("span", {}) }), parts.body] }));
|
|
85
85
|
}
|