viewkitjs 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +173 -0
- package/MIGRATION.md +7 -0
- package/package.json +1 -1
- package/views/README.md +1 -1
- package/views/dist/atoms/Avatar.js +2 -1
- package/views/dist/atoms/RelationChip.d.ts +2 -0
- package/views/dist/atoms/RelationChip.js +5 -0
- package/views/dist/atoms/RowMenu.d.ts +1 -1
- package/views/dist/atoms/RowMenu.js +15 -3
- package/views/dist/atoms/defaults.js +2 -0
- package/views/dist/atoms/types.d.ts +40 -4
- package/views/dist/cells/relation-wrap.js +9 -2
- package/views/dist/contract.d.ts +27 -7
- package/views/dist/contract.js +25 -2
- package/views/dist/controls/avatar/avatar-mark.d.ts +4 -0
- package/views/dist/controls/avatar/avatar-mark.js +5 -0
- package/views/dist/controls/avatar/avatar.d.ts +10 -5
- package/views/dist/controls/avatar/avatar.js +12 -6
- package/views/dist/controls/avatar/looks.d.ts +1 -1
- package/views/dist/controls/avatar/looks.js +3 -0
- package/views/dist/controls/avatar/record-mark.d.ts +16 -0
- package/views/dist/controls/avatar/record-mark.js +13 -0
- package/views/dist/controls/avatar/tokens.d.ts +12 -0
- package/views/dist/controls/avatar/tokens.js +3 -0
- package/views/dist/controls/avatar.css +54 -17
- package/views/dist/controls/bulk-bar/bulk-bar.js +4 -5
- package/views/dist/controls/bulk-bar/map-selection-bar.js +2 -1
- package/views/dist/controls/compound-editor/compound-editor.d.ts +3 -0
- package/views/dist/controls/compound-editor/map-parts-body.d.ts +1 -1
- package/views/dist/controls/compound-editor/map-parts-body.js +8 -1
- package/views/dist/controls/compound-editor/name-parts.js +3 -2
- package/views/dist/controls/compound-editor/place-parts.js +3 -3
- package/views/dist/controls/compound-editor/range-parts.js +11 -10
- package/views/dist/controls/compound-editor/words.d.ts +3 -0
- package/views/dist/controls/compound-editor/words.js +2 -0
- package/views/dist/controls/customize/customize.d.ts +22 -6
- package/views/dist/controls/customize/customize.js +154 -73
- package/views/dist/controls/customize/items.d.ts +49 -0
- package/views/dist/controls/customize/items.js +104 -0
- package/views/dist/controls/customize/map-customize-body.js +19 -15
- package/views/dist/controls/customize/words.d.ts +5 -3
- package/views/dist/controls/customize/words.js +1 -0
- package/views/dist/controls/filter-editor/block.js +5 -2
- package/views/dist/controls/filter-editor/filter-editor.d.ts +16 -1
- package/views/dist/controls/filter-editor/filter-editor.js +22 -16
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +3 -2
- package/views/dist/controls/filter-editor/map-filter-body.js +16 -2
- package/views/dist/controls/filter-editor/map-rules.d.ts +9 -2
- package/views/dist/controls/filter-editor/map-rules.js +18 -13
- package/views/dist/controls/filter-editor/parts.d.ts +1 -1
- package/views/dist/controls/filter-editor/parts.js +16 -15
- package/views/dist/controls/filter-editor/rules.d.ts +4 -4
- package/views/dist/controls/filter-editor/rules.js +6 -3
- package/views/dist/controls/filter-editor/words.d.ts +2 -0
- package/views/dist/controls/filter-editor/words.js +1 -0
- package/views/dist/controls/group-editor/group-editor.d.ts +3 -0
- package/views/dist/controls/group-editor/group-editor.js +21 -15
- package/views/dist/controls/group-editor/map-group-body.js +1 -0
- package/views/dist/controls/index.d.ts +1 -1
- package/views/dist/controls/internal/kit-words.d.ts +11 -0
- package/views/dist/controls/internal/kit-words.js +7 -0
- package/views/dist/controls/internal/map-panel-controls.d.ts +4 -1
- package/views/dist/controls/internal/map-panel-controls.js +23 -6
- package/views/dist/controls/internal/menu-items.d.ts +9 -0
- package/views/dist/controls/internal/menu-items.js +97 -0
- package/views/dist/controls/internal/panel-controls.d.ts +27 -3
- package/views/dist/controls/internal/panel-controls.js +142 -13
- package/views/dist/controls/links-editor/links-editor.js +5 -7
- package/views/dist/controls/links-editor/map-links-body.d.ts +1 -1
- package/views/dist/controls/links-editor/map-links-body.js +5 -1
- package/views/dist/controls/menu/menu.d.ts +4 -1
- package/views/dist/controls/menu/menu.js +3 -2
- package/views/dist/controls/number-editor/map-number-body.js +2 -0
- package/views/dist/controls/number-editor/number-editor.js +1 -1
- package/views/dist/controls/number-editor/words.d.ts +3 -0
- package/views/dist/controls/number-editor/words.js +2 -0
- package/views/dist/controls/picker/fields-frame.d.ts +5 -0
- package/views/dist/controls/picker/fields-frame.js +30 -0
- package/views/dist/controls/picker/map-fields-body.d.ts +2 -2
- package/views/dist/controls/picker/map-fields-body.js +7 -26
- package/views/dist/controls/picker/map-picker.d.ts +9 -3
- package/views/dist/controls/picker/map-picker.js +16 -3
- package/views/dist/controls/picker/picker.js +20 -10
- package/views/dist/controls/picker/rows.d.ts +9 -2
- package/views/dist/controls/picker.css +2 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +2 -1
- package/views/dist/controls/quick-filters/quick-filters.js +4 -4
- package/views/dist/controls/quick-filters/reminder.js +2 -2
- package/views/dist/controls/quick-filters/rules.d.ts +4 -1
- package/views/dist/controls/quick-filters/words.d.ts +2 -0
- package/views/dist/controls/quick-filters/words.js +1 -0
- package/views/dist/controls/select/map-select.d.ts +1 -1
- package/views/dist/controls/select/map-select.js +4 -1
- package/views/dist/controls/select/select.d.ts +5 -0
- package/views/dist/controls/select/select.js +11 -3
- package/views/dist/controls/sheet/bottom-sheet.d.ts +6 -1
- package/views/dist/controls/sheet/bottom-sheet.js +3 -3
- package/views/dist/controls/sort-editor/map-sort-body.js +1 -0
- package/views/dist/controls/sort-editor/sort-editor.d.ts +5 -1
- package/views/dist/controls/sort-editor/sort-editor.js +9 -8
- package/views/dist/controls/tag/tag.js +4 -2
- package/views/dist/controls/text-editor/map-text-body.js +4 -1
- package/views/dist/controls/text-editor/text-editor.js +2 -2
- package/views/dist/controls/text-editor/words.d.ts +3 -0
- package/views/dist/controls/text-editor/words.js +1 -1
- package/views/dist/controls/toolbar/toolbar.d.ts +31 -12
- package/views/dist/controls/toolbar/toolbar.js +15 -20
- package/views/dist/controls/toolbar.css +0 -5
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +4 -2
- package/views/dist/controls/values-editor/map-values-body.d.ts +1 -2
- package/views/dist/controls/values-editor/map-values-body.js +5 -1
- package/views/dist/controls/values-editor/values-editor.js +8 -7
- package/views/dist/controls/views-list/map-views-list-body.js +9 -1
- package/views/dist/controls/views-list/rules.d.ts +1 -0
- package/views/dist/controls/views-list/rules.js +2 -2
- package/views/dist/controls/views-list/view-menu.js +2 -2
- package/views/dist/controls/views-list/words.d.ts +4 -0
- package/views/dist/controls/views-list/words.js +2 -1
- package/views/dist/display/option-badges.d.ts +17 -0
- package/views/dist/display/option-badges.js +11 -0
- package/views/dist/display/relation-link.d.ts +12 -0
- package/views/dist/display/relation-link.js +17 -0
- package/views/dist/display/relation.d.ts +1 -1
- package/views/dist/display/relation.js +10 -3
- package/views/dist/display/select.js +1 -8
- package/views/dist/editors/EditorPanel.js +1 -1
- package/views/dist/editors/RangeEditor.d.ts +3 -0
- package/views/dist/editors/RangeEditor.js +2 -2
- package/views/dist/editors/SelectEditor.d.ts +2 -2
- package/views/dist/editors/SelectEditor.js +1 -1
- package/views/dist/editors/TextEditor.js +4 -2
- package/views/dist/editors/ValueListEditor.js +2 -1
- package/views/dist/field-row/FieldRow.js +32 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +2 -1
- package/views/dist/grid/chrome/GridAddColumn.d.ts +7 -2
- package/views/dist/grid/chrome/GridAddColumn.js +13 -9
- package/views/dist/grid/chrome/GridCellEditors.js +1 -1
- package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -1
- package/views/dist/grid/chrome/GridCellOutline.js +16 -6
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +7 -4
- package/views/dist/grid/chrome/GridFooter.d.ts +4 -1
- package/views/dist/grid/chrome/GridFooter.js +4 -4
- package/views/dist/grid/chrome/GridGroupMenu.js +39 -14
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -1
- package/views/dist/grid/chrome/GridHeader.js +4 -3
- package/views/dist/grid/chrome/GridNumberEditor.js +1 -1
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +4 -1
- package/views/dist/grid/chrome/GridRangeEditor.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +11 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +4 -1
- package/views/dist/grid/chrome/GridRowActions.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +3 -2
- package/views/dist/grid/chrome/GridStructure.js +1 -1
- package/views/dist/grid/chrome/GridTable.js +32 -20
- package/views/dist/grid/chrome/GridTableSurface.js +2 -1
- package/views/dist/grid/chrome/checks.d.ts +1 -1
- package/views/dist/grid/chrome/checks.js +4 -1
- package/views/dist/grid/chrome/grid-cell-classes.d.ts +6 -2
- package/views/dist/grid/chrome/grid-cell-classes.js +10 -5
- package/views/dist/grid/chrome/grid-fitted-box.d.ts +5 -2
- package/views/dist/grid/chrome/grid-fitted-box.js +14 -4
- package/views/dist/grid/chrome/grid-hover.d.ts +10 -2
- package/views/dist/grid/chrome/grid-hover.js +14 -4
- package/views/dist/grid/chrome/grid-row-props.d.ts +4 -0
- package/views/dist/grid/chrome/grid-rows-menu.js +9 -4
- package/views/dist/grid/chrome/grid-table-props.d.ts +16 -4
- package/views/dist/grid/chrome/useGridScaleStyles.d.ts +9 -1
- package/views/dist/grid/chrome/useGridScaleStyles.js +1 -4
- package/views/dist/grid/grid-format-props.d.ts +1 -1
- package/views/dist/grid/grid-format-props.js +18 -5
- package/views/dist/grid/grid.css +11 -1
- package/views/dist/grid/looks.d.ts +3 -1
- package/views/dist/grid/looks.js +10 -4
- package/views/dist/grid/useGridTablePrefs.d.ts +1 -1
- package/views/dist/grid/useGridTableSettings.d.ts +1 -1
- package/views/dist/list/layer.d.ts +8 -0
- package/views/dist/list/layer.js +7 -0
- package/views/dist/list/list.js +2 -2
- package/views/dist/list/menu.d.ts +5 -4
- package/views/dist/list/store.d.ts +1 -1
- package/views/dist/list/toolbar.js +47 -20
- package/views/dist/list/views.js +1 -0
- package/views/dist/panels/availability.d.ts +5 -0
- package/views/dist/panels/availability.js +4 -5
- package/views/dist/panels/customize-body.d.ts +5 -1
- package/views/dist/panels/customize-body.js +21 -12
- package/views/dist/panels/model.d.ts +14 -4
- package/views/dist/panels/react/customize-body.js +15 -3
- package/views/dist/panels/react/customize.d.ts +8 -0
- package/views/dist/panels/react/filter/FilterEditor.d.ts +6 -0
- package/views/dist/panels/react/filter/FilterEditor.js +7 -0
- package/views/dist/panels/react/filter/FilterFieldList.d.ts +3 -1
- package/views/dist/panels/react/filter/FilterFieldList.js +2 -2
- package/views/dist/panels/react/filter/filter-body.js +3 -1
- package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -1
- package/views/dist/panels/react/filter/filter-part-body.js +2 -2
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +3 -1
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +7 -3
- package/views/dist/panels/react/sort/SortEditor.js +3 -1
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -2
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +11 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +16 -6
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +5 -3
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +12 -5
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +7 -3
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +18 -8
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +9 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +5 -4
- package/views/dist/panels/react/toolbar/ToolbarSort.d.ts +7 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +6 -3
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +3 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +4 -4
- package/views/dist/panels/react/toolbar/editor-menus.d.ts +8 -0
- package/views/dist/panels/react/toolbar/editor-menus.js +3 -0
- package/views/dist/panels/react/views-row/FoldingViewRow.js +3 -5
- package/views/dist/panels/react/views-row/HScrollRow.d.ts +4 -2
- package/views/dist/panels/react/views-row/HScrollRow.js +6 -2
- package/views/dist/panels/react/views-row/ViewAxes.js +6 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +8 -3
- package/views/dist/panels/react/views-row/new-view.d.ts +11 -0
- package/views/dist/panels/react/views-row/new-view.js +21 -0
- package/views/dist/panels/react.d.ts +1 -1
- package/views/dist/panels/settings/layout.js +6 -38
- package/views/dist/panels/toolbar/page-resets.d.ts +17 -0
- package/views/dist/panels/toolbar/page-resets.js +62 -0
- package/views/dist/panels/toolbar/same-item.d.ts +7 -0
- package/views/dist/panels/toolbar/same-item.js +9 -0
- package/views/dist/panels/view-state.d.ts +4 -0
- package/views/dist/provider/ViewsProvider.d.ts +9 -4
- package/views/dist/provider/ViewsProvider.js +13 -2
- package/views/dist/provider/components.d.ts +109 -7
- package/views/dist/provider/components.js +1 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/styles.css +115 -27
- package/views/dist/styles.unlayered.css +115 -27
- package/views/docs/contract.md +55 -35
- package/views/docs/controls/avatar.md +3 -0
- package/views/docs/controls/bulk-bar.md +3 -1
- package/views/docs/controls/compound-editor.md +2 -0
- package/views/docs/controls/customize.md +1 -1
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/links-editor.md +2 -0
- package/views/docs/controls/pane.md +1 -1
- package/views/docs/controls/picker.md +2 -0
- package/views/docs/controls/quick-filters.md +1 -1
- package/views/docs/controls/text-editor.md +1 -1
- package/views/docs/controls/values-editor.md +2 -0
- package/views/docs/guides/atoms.md +54 -3
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/looks.md +1 -1
- package/views/docs/guides/the-grid.md +4 -2
- package/views/docs/guides/the-provider.md +2 -2
- package/views/docs/index.md +2 -2
- package/views/docs/install.md +198 -104
- package/views/docs/reference/controls.md +27 -24
- package/views/docs/reference/editors-range.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +6 -5
- package/views/docs/reference/list.md +27 -7
- package/views/docs/reference/looks.md +5 -5
- package/views/docs/reference/panels-react.md +15 -14
- package/views/docs/reference/panels.md +5 -5
- package/views/docs/reference/react.md +25 -11
- package/views/docs/reference/views.md +2 -2
- package/views/docs/reshaping.md +22 -6
- package/views/skills/views/SKILL.md +2 -2
|
@@ -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));
|
|
@@ -841,10 +844,17 @@ function usePickerAt(props, under) {
|
|
|
841
844
|
});
|
|
842
845
|
const soft = props.searchLook === "soft" && !chips;
|
|
843
846
|
const backButton = level && !byHolder && _jsx(Button, { kind: "quiet", shape: "icon", size: "2xs", className: "o-picker-back", "data-slot": "vk-picker-back", "aria-label": w.back(level.label), icon: glyph(BACK), onMouseDown: (e) => e.preventDefault(), onClick: (e) => back(e.detail === 0), children: null });
|
|
844
|
-
const list = (_jsxs("div", { ref: under ? placeRoot : root, className: "o-picker o-smooth o-smooth-ease", "data-slot": "vk-picker", "data-kit": "picker", "data-picker-form": form, ...phoneMark(!!host || small), "data-standing": props.standing ? "" : undefined, "data-rest": atRest ? "" : undefined, onKeyDown: keys, children: [inBox && level && _jsx("div", { className: "o-picker-search o-popup-line", children: backButton }), !inBox && soft && (_jsx("div", { className: cx("o-picker-search o-picker-search-soft", !shown && "sr-only"), "data-hidden": shown ? undefined : "", children: _jsxs(InputGroup, { size: "sm", chrome: "soft", "data-slot": "vk-picker-search", children: [_jsx(InputGroupAddon, { children: backButton || glyph(SEARCH) }), _jsx(Input, { combobox: true, autofill: false, ref: searchBox, className: "o-picker-input", placeholder: search, "aria-label": search ?? label, onKeyDown: ends, ...restAttrs })] }) })), !inBox && !soft && (_jsxs("div", { className: cx("o-picker-search o-popup-line", !shown && !chips && "sr-only"), "data-slot": "vk-picker-search", "data-hidden": shown || chips ? undefined : "", children: [backButton || glyph(SEARCH), chips ? (_jsxs(BaseCombobox.Chips, { className: "o-picker-chips", "data-slot": "vk-picker-chips", onMouseDown: (e) => { if (e.target.closest("
|
|
847
|
+
const list = (_jsxs("div", { ref: under ? placeRoot : root, className: "o-picker o-smooth o-smooth-ease", "data-slot": "vk-picker", "data-kit": "picker", "data-picker-form": form, ...phoneMark(!!host || small), "data-standing": props.standing ? "" : undefined, "data-rest": atRest ? "" : undefined, onKeyDown: keys, children: [inBox && level && _jsx("div", { className: "o-picker-search o-popup-line", children: backButton }), !inBox && soft && (_jsx("div", { className: cx("o-picker-search o-picker-search-soft", !shown && "sr-only"), "data-hidden": shown ? undefined : "", children: _jsxs(InputGroup, { size: "sm", chrome: "soft", "data-slot": "vk-picker-search", children: [_jsx(InputGroupAddon, { children: backButton || glyph(SEARCH) }), _jsx(Input, { combobox: true, autofill: false, ref: searchBox, className: "o-picker-input", placeholder: search, "aria-label": search ?? label, onKeyDown: ends, ...restAttrs })] }) })), !inBox && !soft && (_jsxs("div", { className: cx("o-picker-search o-popup-line", !shown && !chips && "sr-only"), "data-slot": "vk-picker-search", "data-hidden": shown || chips ? undefined : "", children: [backButton || glyph(SEARCH), chips ? (_jsxs(BaseCombobox.Chips, { className: "o-picker-chips", "data-slot": "vk-picker-chips", onMouseDown: (e) => { if (e.target.closest("button")) {
|
|
845
848
|
e.preventDefault();
|
|
846
849
|
input.current?.focus();
|
|
847
|
-
} }, children: [heldEntries.map((e) =>
|
|
850
|
+
} }, children: [heldEntries.map((e) => {
|
|
851
|
+
const remove = () => onValueChange(held.filter((v) => `item:${v}` !== e.key));
|
|
852
|
+
const as = e.kind === "item" ? e.item.as : undefined, own = as && "chip" in as ? as.removable : undefined;
|
|
853
|
+
const keys = { "data-slot": "vk-picker-chip", "data-key": e.key.replace(/^item:/, "") };
|
|
854
|
+
return own
|
|
855
|
+
? _jsx(BaseCombobox.Chip, { ...keys, className: "o-picker-chip", render: _jsx("span", {}), children: own(remove) }, e.key)
|
|
856
|
+
: _jsx(BaseCombobox.Chip, { ...keys, render: _jsx(Option, { onRemove: remove }), children: entryLabel(e) }, e.key);
|
|
857
|
+
}), _jsx(Input, { combobox: true, chrome: "bare", autofill: false, ref: searchBox, className: "o-picker-input", placeholder: held.length ? undefined : search, "aria-label": search ?? label, onKeyDown: ends, ...restAttrs })] })) : _jsx(Input, { combobox: true, chrome: "bare", autofill: false, ref: searchBox, className: "o-picker-input", placeholder: search, "aria-label": search ?? label, onKeyDown: ends, ...restAttrs })] })), multiple && worn.picked === "count" && held.length > 0 && _jsxs("div", { className: "o-picker-count", "data-slot": "vk-picker-count", children: [_jsx("span", { children: around(w.chosen(held.length), String(held.length)) }), _jsx(Button, { ref: focusesInPlace, kind: "text", size: "2xs", "data-slot": "vk-picker-clear", onClick: () => onValueChange([]), children: w.clearAll })] }), message, _jsxs(BaseCombobox.List, { className: "o-picker-listbox", "data-slot": "vk-picker-list", "aria-label": label, children: [_jsxs("div", { className: "o-picker-rows", children: [parent ? _jsxs(_Fragment, { children: [row(parent, -1), _jsx("div", { className: "o-picker-level", children: groups })] }) : groups, rows.some((r) => r.kind === "more") && _jsxs("div", { ref: more, className: "o-picker-more", "data-slot": "vk-picker-loading", children: [_jsx(Spinner, { size: 14, label: "" }), w.loadingMore] }), first && action(first)] }), _jsx(Scrollbar, {}), (footCreate || actionsShown) && (_jsxs("div", { className: "o-picker-foot o-popup-line", "data-slot": "vk-picker-foot", "data-at": "foot", children: [footCreate && row(footCreate, -1, true), actionsShown && (_jsxs(BaseCombobox.Group, { children: [worn.heading === "shown" && _jsx(BaseCombobox.GroupLabel, { className: "o-list-heading", "data-slot": "vk-picker-heading", children: w.actions }), actions.map((a) => action(a, true))] }))] }))] })] }));
|
|
848
858
|
const value_ = (multiple ? heldEntries : heldEntries[0] ?? null);
|
|
849
859
|
const highlighted = (v, d) => {
|
|
850
860
|
lit.current = d.index;
|
|
@@ -2,10 +2,16 @@ 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; with `removable`, a function of a remove, how it stands held among the search's chips under the look
|
|
9
|
+
* Chips, its × removing it, VK-1059, else the plain Option there), or, left out, plain words. */
|
|
7
10
|
export type PickerAs = {
|
|
8
11
|
option: true;
|
|
12
|
+
} | {
|
|
13
|
+
chip: ReactNode;
|
|
14
|
+
removable?: (onRemove: () => void) => ReactNode;
|
|
9
15
|
} | {
|
|
10
16
|
status: StatusPlace;
|
|
11
17
|
quarters?: 1 | 2 | 3;
|
|
@@ -13,6 +19,7 @@ export type PickerAs = {
|
|
|
13
19
|
avatar: "person" | "company";
|
|
14
20
|
id?: string;
|
|
15
21
|
src?: string;
|
|
22
|
+
kind?: string;
|
|
16
23
|
} | {
|
|
17
24
|
sign: string;
|
|
18
25
|
} | {
|
|
@@ -40,6 +40,8 @@
|
|
|
40
40
|
.o-picker-search-soft { flex: none; padding-bottom: calc(var(--vk-spacing) * 1); }
|
|
41
41
|
/* What is picked as chips (the option Chips): the Options with their × before the words typed, wrapping. */
|
|
42
42
|
.o-picker-chips { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: calc(var(--vk-spacing) * 1.5); }
|
|
43
|
+
/* A held value drawn as its cell draws it (the app's Tag, its × its own): the chip stands whole in its holder. */
|
|
44
|
+
.o-picker-chip { display: inline-flex; max-width: 100%; }
|
|
43
45
|
|
|
44
46
|
/* ── How many are picked, and Clear all, when several can be ────────────────────────────────────────────────────── */
|
|
45
47
|
.o-picker-count { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--vk-spacing) * 1.5) calc(var(--vk-spacing) * 2); font-size: var(--vk-font-size-xs); line-height: calc(var(--vk-font-size-xs) * var(--vk-line-height-xs)); color: var(--vk-fg-subtle); }
|
|
@@ -30,7 +30,7 @@ function markOf(item) {
|
|
|
30
30
|
return as.quarters ? { status, quarters: as.quarters } : { status };
|
|
31
31
|
}
|
|
32
32
|
if ("avatar" in as)
|
|
33
|
-
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 } : {}) };
|
|
34
34
|
return undefined;
|
|
35
35
|
}
|
|
36
36
|
export function quickFiltersFieldsOf(fields) {
|
|
@@ -50,6 +50,7 @@ export const quickFiltersWordsOf = (say) => ({
|
|
|
50
50
|
search: (field) => say({ key: "views.panels.quick-search", values: { field } }),
|
|
51
51
|
clear: say({ key: "views.panels.quick-clear-value" }),
|
|
52
52
|
none: say({ key: "views.panels.quick-none" }),
|
|
53
|
+
nothing: say({ key: "views.panels.filter-no-options" }),
|
|
53
54
|
});
|
|
54
55
|
export function MapQuickFiltersBody(props) {
|
|
55
56
|
return _jsx(PanelControlsFromViews, { children: _jsx(QuickFiltersBodyInner, { ...props }) });
|
|
@@ -2,7 +2,7 @@
|
|
|
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 {
|
|
5
|
+
import { RecordMark } from "../avatar/record-mark.js";
|
|
6
6
|
import { InputGroup, InputGroupAddon } from "../input/input.js";
|
|
7
7
|
import { usePanelControls } from "../internal/panel-controls.js";
|
|
8
8
|
import { Icon } from "../internal/icons.js";
|
|
@@ -30,7 +30,7 @@ function Mark({ value, phone }) {
|
|
|
30
30
|
return null;
|
|
31
31
|
return _jsx("span", { className: "o-quick-filters-mark", "aria-hidden": "true", children: "status" in m
|
|
32
32
|
? _jsx(StatusGlyph, { place: m.status, quarters: m.quarters })
|
|
33
|
-
: _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 }) });
|
|
34
34
|
}
|
|
35
35
|
function Values({ field, values, held, several, onPress, search, phone, clear }) {
|
|
36
36
|
const [at, setAt] = React.useState(() => Math.max(0, values.findIndex((v) => held.includes(v.value)))), rows = React.useRef([]);
|
|
@@ -85,7 +85,7 @@ export function QuickFilters({ fields, holds, onHoldsChange, open: openGiven, on
|
|
|
85
85
|
root.current?.querySelector(".o-quick-filters-value")?.focus();
|
|
86
86
|
};
|
|
87
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])
|
|
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
|
|
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
|
|
89
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}`)
|
|
90
|
-
: _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 })] }));
|
|
91
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 = {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ViewsSelectProps } from "../../provider/components.js";
|
|
2
|
-
/** ViewKit's Select, handed the map's props. */
|
|
2
|
+
/** ViewKit's Select, handed the map's props, its × named in the app's words (VK-997). */
|
|
3
3
|
export declare function MapSelect({ items, size, ...rest }: ViewsSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ViewsContext } from "../../provider/context.js";
|
|
2
4
|
import { markOwnControl } from "../../provider/own-control.js";
|
|
3
5
|
import { Select } from "./select.js";
|
|
4
6
|
const asItems = (items) => items.map(({ icon, level, ...row }) => ({ ...row, ...(icon != null ? { mark: icon } : {}), ...(level ? { level: asItems(level) } : {}) }));
|
|
5
7
|
export function MapSelect({ items, size, ...rest }) {
|
|
6
|
-
|
|
8
|
+
const messages = React.useContext(ViewsContext)?.messages;
|
|
9
|
+
return _jsx(Select, { listWidth: "rows", size: size === "default" ? "md" : "sm", items: asItems(items), ...(messages && { clearLabel: messages({ key: "views.menus.clear" }) }), ...rest });
|
|
7
10
|
}
|
|
8
11
|
markOwnControl(MapSelect);
|
|
@@ -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. */
|
|
@@ -95,6 +98,8 @@ export interface SelectListProps extends SelectFieldProps {
|
|
|
95
98
|
chips?: boolean;
|
|
96
99
|
/** A row at the top that clears the field ("No owner"), while it has a value. */
|
|
97
100
|
clear?: string;
|
|
101
|
+
/** The × that empties it, by name: by default the kit's shared word, the app's inside ViewKit's panels (VK-997). */
|
|
102
|
+
clearLabel?: string;
|
|
98
103
|
/** Its list's own words (the Picker's: "Nothing matches", "Selected"), each the app's where handed. */
|
|
99
104
|
pickerWords?: Partial<PickerWords>;
|
|
100
105
|
/** A search on top of the list, with what it says before anything is typed ("Find someone"). */
|
|
@@ -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";
|
|
@@ -20,6 +20,7 @@ import { listSide } from "./side.js";
|
|
|
20
20
|
import { chipsThatFit } from "./fit.js";
|
|
21
21
|
import { filledMatch } from "./filled.js";
|
|
22
22
|
import { SaveMark } from "../input/save-mark.js";
|
|
23
|
+
import { KitWordsContext } from "../internal/kit-words.js";
|
|
23
24
|
const glyph = (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)) }));
|
|
24
25
|
const CHEVRON = ["M6 9l6 6l6 -6"], PLUS = ["M12 5v14", "M5 12h14"], X = ["M18 6l-12 12", "M6 6l12 12"];
|
|
25
26
|
const SEARCH = ["M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0", "M21 21l-6 -6"];
|
|
@@ -42,7 +43,13 @@ export function Select(props) {
|
|
|
42
43
|
return _jsx(SheetSelect, { ...props });
|
|
43
44
|
return _jsx(PickerSelect, { ...props });
|
|
44
45
|
}
|
|
45
|
-
const chipMark = (
|
|
46
|
+
const chipMark = ({ mark, avatar }) => {
|
|
47
|
+
if (!React.isValidElement(mark))
|
|
48
|
+
return mark;
|
|
49
|
+
if (isAvatarMark(mark.type))
|
|
50
|
+
return React.cloneElement(mark, { size: 16 });
|
|
51
|
+
return avatar ? React.cloneElement(mark, { size: "chip" }) : mark;
|
|
52
|
+
};
|
|
46
53
|
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
54
|
as: chips ? { option: true } : i.mark ? { mark: i.mark } : undefined, ...(i.level ? { level: toPickerItems(i.level, chips) } : {}) }));
|
|
48
55
|
const titleOf = (p) => (typeof p.label === "string" ? p.label : p["aria-label"] ?? p.placeholder ?? "Choose");
|
|
@@ -107,10 +114,11 @@ function TypedBox({ p, f, trigger, field, hint, search }) {
|
|
|
107
114
|
return () => watch.disconnect();
|
|
108
115
|
}, [several, names, n, q]);
|
|
109
116
|
const small = p.size === "2xs" || p.size === "xs";
|
|
117
|
+
const kitWords = React.useContext(KitWordsContext), clearLabel = p.clearLabel ?? kitWords.clear;
|
|
110
118
|
const one = !multiple && f.chosen.length === 1 ? f.chosen[0] : undefined;
|
|
111
119
|
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
120
|
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
|
|
121
|
+
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": clearLabel, 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": kitWords.showEvery(typeof p.label === "string" ? p.label.toLowerCase() : undefined), children: glyph(CHEVRON, "") })] }));
|
|
114
122
|
}
|
|
115
123
|
const gapOf = (at) => spacingPx(1, at), edgeOf = (at) => spacingPx(1.25, at);
|
|
116
124
|
function listNeed(at, rows, lines) {
|
|
@@ -109,6 +109,11 @@ export interface SheetProps {
|
|
|
109
109
|
* live and free to scroll, and only a press inside it, on its dim, closes it. The container holds fixed positions
|
|
110
110
|
* itself (a transform). */
|
|
111
111
|
standing?: boolean;
|
|
112
|
+
/** Mounted open, it stands at its stop from its first frame and plays no rise: for an app drawing a sheet again where one
|
|
113
|
+
* already stood (a window redrawn in another form, its record still open). No entrance plays, so `onOpenChangeComplete`
|
|
114
|
+
* isn't called for that mount. Closed and opened again, it rises as any sheet does. Left out, a sheet mounted open rises,
|
|
115
|
+
* as one a press opens does. */
|
|
116
|
+
risen?: boolean;
|
|
112
117
|
/** Where focus goes once it shuts. Nothing found, or left out, focus goes back to what opened it. */
|
|
113
118
|
finalFocus?: () => HTMLElement | null;
|
|
114
119
|
/** A class on the sheet itself, after its own. */
|
|
@@ -119,4 +124,4 @@ export interface SheetProps {
|
|
|
119
124
|
children: React.ReactNode;
|
|
120
125
|
}
|
|
121
126
|
/** What rises from the bottom of the phone, in a form, at stops. What it holds is poured in. */
|
|
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;
|
|
127
|
+
export declare function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form, stops, openAt, stop, onStopChange, mark: marked, container, standing: stands, risen, finalFocus, className, "data-slot": slot, children }: SheetProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -248,10 +248,10 @@ 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, "data-slot": slot, children }) {
|
|
251
|
+
export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form = "full", stops, openAt, stop, onStopChange, mark: marked = "[data-sheet-mark]", container, standing: stands, risen = false, finalFocus, className, "data-slot": slot, children }) {
|
|
252
252
|
const closeBelow = React.useContext(CloseAll), stacked = closeBelow !== null;
|
|
253
253
|
const standsBelow = React.useContext(Standing), standing = stands || standsBelow;
|
|
254
|
-
const [armed, setArmed] = React.useState(
|
|
254
|
+
const [armed, setArmed] = React.useState(risen);
|
|
255
255
|
React.useEffect(() => setArmed(true), []);
|
|
256
256
|
React.useEffect(() => {
|
|
257
257
|
if (!open || standing || !container)
|
|
@@ -271,7 +271,7 @@ export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form =
|
|
|
271
271
|
const bindPopup = React.useCallback((el) => { popupRef.current = el; setPopup(el); }, []);
|
|
272
272
|
const list = stops ?? FORMS[form].stops, first = openAt ?? list[0];
|
|
273
273
|
const [at, setAt] = React.useState(first), [mark, setMark] = React.useState(null);
|
|
274
|
-
const [wasOpen, setWasOpen] = React.useState(open), [coming, setComing] = React.useState(open);
|
|
274
|
+
const [wasOpen, setWasOpen] = React.useState(open), [coming, setComing] = React.useState(open && !risen);
|
|
275
275
|
if (open !== wasOpen) {
|
|
276
276
|
setWasOpen(open);
|
|
277
277
|
if (open) {
|
|
@@ -63,6 +63,7 @@ export function sortEditorPropsOf(p, words, say = resolveViewsMessage) {
|
|
|
63
63
|
fieldOf: placeOf,
|
|
64
64
|
onDone: p.onDone,
|
|
65
65
|
words,
|
|
66
|
+
...(p.items && { items: p.items }),
|
|
66
67
|
onRulesChange: (rules, aside) => p.onRulesChange(rules.map((r) => ({ value: r.field, dir: VIEWKIT[r.direction] })), ...(aside ? [aside.map((a) => held.find((h) => h.fieldKey === a.key)).filter((h) => !!h)] : [])),
|
|
67
68
|
};
|
|
68
69
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { ViewsSortEditorItems } from "../../provider/components.js";
|
|
2
3
|
import { type PickerItem } from "../picker/picker.js";
|
|
3
4
|
import type { SheetHeadProps } from "../sheet/bottom-sheet.js";
|
|
4
5
|
import { type FieldOf, type SortAside, type SortRule } from "./rules.js";
|
|
@@ -12,6 +13,8 @@ export type SortEditorOpens = {
|
|
|
12
13
|
export interface SortEditorProps {
|
|
13
14
|
/** What it sorts, as its shell names it ("Sort"): the Sheet's title on a phone, and the rules' name to a screen reader. */
|
|
14
15
|
label: string;
|
|
16
|
+
/** Clear all at its foot; default on. Off inside Customize, where its page's Reset stands in its place (VK-1034). */
|
|
17
|
+
clearAll?: boolean;
|
|
15
18
|
/** The fields a list sorts by, each with its type's mark; one leading one level in (a deal's Company) holds its own. */
|
|
16
19
|
fields: PickerItem[];
|
|
17
20
|
/** The view's rules, the first sorting first. */
|
|
@@ -41,6 +44,8 @@ export interface SortEditorProps {
|
|
|
41
44
|
addSort?: boolean;
|
|
42
45
|
/** Its words; English unless handed. */
|
|
43
46
|
words?: Partial<SortEditorWords>;
|
|
47
|
+
/** Its menus as data (VK-1063): a rule's ⋯ (a phone's and the narrow form's) and a set-aside rule's, handed their default items. */
|
|
48
|
+
items?: ViewsSortEditorItems;
|
|
44
49
|
}
|
|
45
50
|
export interface SortEditorParts {
|
|
46
51
|
body: React.ReactNode;
|
|
@@ -52,7 +57,6 @@ export interface SortEditorParts {
|
|
|
52
57
|
/** The fields as a list's Sort offers them to add a rule: those the rules sort by already greyed with "Sorted", one level in too
|
|
53
58
|
* (what Sort on the row's right, and on the filter bar the empty Sort, open on a computer, KIT-623). */
|
|
54
59
|
export declare const sortableFields: (fields: PickerItem[], rules: SortRule[], fieldOf?: FieldOf, sorted?: string) => PickerItem[];
|
|
55
|
-
/** The sort editor's state and the parts a shell pours in. */
|
|
56
60
|
export declare function useSortEditor(props: SortEditorProps): SortEditorParts;
|
|
57
61
|
/** The body alone, for a shell that holds only a body (the Popover). */
|
|
58
62
|
export declare function SortEditor(props: SortEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,9 +8,9 @@ import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
|
|
|
8
8
|
import { usePanelControls } from "../internal/panel-controls.js";
|
|
9
9
|
import { moved, useReorder } from "../internal/reorder.js";
|
|
10
10
|
import { useStepReturn } from "../internal/step-return.js";
|
|
11
|
+
import { shapeMenu } from "../internal/menu-items.js";
|
|
11
12
|
import { Picker, usePicker } from "../picker/picker.js";
|
|
12
13
|
import { findItem, itemLabel } from "../picker/rows.js";
|
|
13
|
-
import { Tooltip } from "../tooltip/tooltip.js";
|
|
14
14
|
import { addSort, canAddSort, dropAside, openPlaces, putBack, repoint, SORT_MAX, takenBy } from "./rules.js";
|
|
15
15
|
import { sortWords } from "./words.js";
|
|
16
16
|
const ASCENDING = ["M4 6l7 0", "M4 12l7 0", "M4 18l9 0", "M15 9l3 -3l3 3", "M18 6l0 12"];
|
|
@@ -29,9 +29,10 @@ function fieldsFor(fields, rules, sorted, own, fieldOf) {
|
|
|
29
29
|
: f.value !== own && takenBy(rules, f.value, own, fieldOf) ? { ...f, disabled: true, line: sorted } : f));
|
|
30
30
|
}
|
|
31
31
|
export const sortableFields = (fields, rules, fieldOf, sorted = sortWords().sorted) => fieldsFor(fields, rules, sorted, undefined, fieldOf);
|
|
32
|
+
const RULE_KEYS = new Set(["delete"]), ASIDE_KEYS = new Set(["why", "put-back", "delete"]);
|
|
32
33
|
export function useSortEditor(props) {
|
|
33
|
-
const { label, fields, rules, onRulesChange, max = SORT_MAX, onDone, opens, fieldOf, addSort: adds = true } = props;
|
|
34
|
-
const { Button, Select, Menu, Popover } = usePanelControls();
|
|
34
|
+
const { label, fields, rules, onRulesChange, max = SORT_MAX, onDone, opens, fieldOf, addSort: adds = true, clearAll: clears = true, items } = props;
|
|
35
|
+
const { Button, Select, Menu, Popover, Tooltip } = usePanelControls();
|
|
35
36
|
const aside = React.useMemo(() => props.aside ?? [], [props.aside]);
|
|
36
37
|
const w = sortWords(props.words), search = props.search ?? w.search, DIRECTIONS = directionsOf(w);
|
|
37
38
|
const words = w.picker ? { words: w.picker } : {};
|
|
@@ -115,11 +116,11 @@ export function useSortEditor(props) {
|
|
|
115
116
|
setPop((p) => (p?.list === "add" ? null : { list: "add", rule: -1, at })); }, children: w.add }) }));
|
|
116
117
|
const closePop = () => setPop(null);
|
|
117
118
|
const addPicker = _jsx(Picker, { label: w.add, items: pickable(), value: null, search: search, searchShown: true, form: "computer", defaultLevel: props.level, onDone: closePop, onValueChange: (v) => { addField(v); }, ...words });
|
|
118
|
-
const asideEntries = (a) => [
|
|
119
|
+
const asideEntries = (a) => shapeMenu([
|
|
119
120
|
{ icon: null, label: a.why, disabled: a.why, slot: { slot: "vk-sort-rule-action", key: "why" } },
|
|
120
121
|
...(a.back != null ? [{ icon: null, label: w.putBack, onSelect: () => backOn(a.key), slot: { slot: "vk-sort-rule-action", key: "put-back" } }] : []),
|
|
121
122
|
{ icon: glyph(TRASH), label: w.delete, danger: true, onSelect: () => drop(a.key), slot: { slot: "vk-sort-rule-action", key: "delete" } },
|
|
122
|
-
];
|
|
123
|
+
], items, { menu: "aside", field: a.key, form: phone ? "phone" : "computer" }, "vk-sort-rule-action", ASIDE_KEYS);
|
|
123
124
|
if (phone || narrow) {
|
|
124
125
|
const size = phone ? "44" : "sm";
|
|
125
126
|
const more = (name) => (phone
|
|
@@ -137,7 +138,7 @@ export function useSortEditor(props) {
|
|
|
137
138
|
setPop((p) => (p?.list === "direction" && p.rule === i ? null : { list: "direction", rule: i, at }));
|
|
138
139
|
else
|
|
139
140
|
setStep({ list: "direction", rule: i });
|
|
140
|
-
}, children: [mark, _jsxs("span", { className: "o-sort-editor-words", children: [_jsx("span", { className: "o-sort-editor-name", children: name }), _jsx("span", { className: "o-sort-editor-way", children: r.direction === "ascending" ? w.ascending : w.descending })] })] }), _jsx(Menu, { label: w.sortBy(name), align: "end", entries: [{ icon: glyph(TRASH), label: w.delete, danger: true, onSelect: () => change(now.current.filter((_, k) => k !== i)), slot: { slot: "vk-sort-rule-action", key: "delete" } }], trigger: more(name) }), standing && shownList(DIRECTIONS, r.direction, w.direction, false)] });
|
|
141
|
+
}, children: [mark, _jsxs("span", { className: "o-sort-editor-words", children: [_jsx("span", { className: "o-sort-editor-name", children: name }), _jsx("span", { className: "o-sort-editor-way", children: r.direction === "ascending" ? w.ascending : w.descending })] })] }), _jsx(Menu, { label: w.sortBy(name), align: "end", entries: shapeMenu([{ icon: glyph(TRASH), label: w.delete, danger: true, onSelect: () => change(now.current.filter((_, k) => k !== i)), slot: { slot: "vk-sort-rule-action", key: "delete" } }], items, { menu: "rule", field: r.field, index: i, form: phone ? "phone" : "computer" }, "vk-sort-rule-action", RULE_KEYS), trigger: more(name) }), standing && shownList(DIRECTIONS, r.direction, w.direction, false)] });
|
|
141
142
|
return phone
|
|
142
143
|
? _jsx(FieldRow, { as: "div", role: "listitem", className: "o-sort-editor-rule", "data-slot": "vk-sort-rule", "data-key": r.field, "data-index": i, "data-row": i, "data-lifted": liftedAt(i), style: lift(i), children: inner }, r.field)
|
|
143
144
|
: _jsx("div", { role: "listitem", className: "o-sort-editor-rule", "data-slot": "vk-sort-rule", "data-key": r.field, "data-index": i, "data-row": i, "data-lifted": liftedAt(i), style: lift(i), children: inner }, r.field);
|
|
@@ -157,7 +158,7 @@ export function useSortEditor(props) {
|
|
|
157
158
|
const popAside = pop?.list === "repoint" ? aside.find((a) => a.key === pop.key) : undefined;
|
|
158
159
|
const body = (_jsxs("div", { ref: placeRoot, className: "o-sort-editor", "data-slot": "vk-sort", "data-kit": "sort-editor", "data-sort-form": way, role: narrow ? "group" : undefined, "aria-label": narrow ? label : undefined, tabIndex: -1, style: room ? { paddingBottom: room } : undefined, ...phoneMark(!!screen || small), "data-sort-step": stepTitle !== undefined ? step?.list : undefined, children: [stepTitle !== undefined ? stepList.body : _jsxs(_Fragment, { children: [rules.length || aside.length ? (phone
|
|
159
160
|
? _jsxs(FieldRows, { look: ROWS, className: "o-sort-editor-card", "data-slot": "vk-sort-rules", role: "list", "aria-label": label, children: [rules.map(ruleRow), aside.map(asideRow)] })
|
|
160
|
-
: _jsxs("div", { className: "o-sort-editor-rules", "data-slot": "vk-sort-rules", role: "list", "aria-label": label, children: [rules.map(ruleRow), aside.map(asideRow)] })) : (_jsxs("div", { className: "o-sort-editor-none", "data-slot": "vk-sort-none", children: [_jsx("p", { className: "o-sort-editor-none-head", children: w.none }), _jsx("p", { className: "o-sort-editor-none-line", children: w.noneLine })] })), _jsxs("div", { className: "o-sort-editor-acts", "data-slot": "vk-sort-foot", children: [addButton(size), rules.length > 0 && _jsx(Button, { kind: "quiet", size: size, className: "o-sort-editor-clear", "data-slot": "vk-sort-clear", onClick: () => change([]), children: w.clearAll })] })] }), narrow && (_jsx(Popover, { open: !!pop && (pop.list === "add" || !!popRule || !!popAside), onOpenChange: (o) => { if (!o)
|
|
161
|
+
: _jsxs("div", { className: "o-sort-editor-rules", "data-slot": "vk-sort-rules", role: "list", "aria-label": label, children: [rules.map(ruleRow), aside.map(asideRow)] })) : (_jsxs("div", { className: "o-sort-editor-none", "data-slot": "vk-sort-none", children: [_jsx("p", { className: "o-sort-editor-none-head", children: w.none }), _jsx("p", { className: "o-sort-editor-none-line", children: w.noneLine })] })), _jsxs("div", { className: "o-sort-editor-acts", "data-slot": "vk-sort-foot", children: [addButton(size), clears && rules.length > 0 && _jsx(Button, { kind: "quiet", size: size, className: "o-sort-editor-clear", "data-slot": "vk-sort-clear", onClick: () => change([]), children: w.clearAll })] })] }), narrow && (_jsx(Popover, { open: !!pop && (pop.list === "add" || !!popRule || !!popAside), onOpenChange: (o) => { if (!o)
|
|
161
162
|
closePop(); }, anchor: pop?.at, className: "o-sort-editor-pop", "aria-label": pop?.list === "add" ? w.add : popAside ? w.fieldNamed(popAside.label) : popRule ? nameOf(popRule.field) : label, children: pop?.list === "add"
|
|
162
163
|
? addPicker
|
|
163
164
|
: popAside ? _jsx(Picker, { label: w.fieldNamed(popAside.label), items: pickable(), value: null, search: search, searchShown: true, form: "computer", defaultLevel: props.level, onDone: closePop, onValueChange: (v) => { pointAt(popAside.key)(v); closePop(); }, ...words })
|
|
@@ -169,7 +170,7 @@ export function useSortEditor(props) {
|
|
|
169
170
|
const items = pickable(r.field);
|
|
170
171
|
return (_jsxs("div", { role: "listitem", className: "o-sort-editor-rule", "data-slot": "vk-sort-rule", "data-key": r.field, "data-index": i, "data-row": i, "data-lifted": liftedAt(i), style: lift(i), children: [_jsx(Grip, { label: w.move(name), className: "o-sort-editor-grip", "data-slot": "vk-sort-grip", ...g }), _jsxs("div", { className: "o-sort-editor-field", children: [_jsx(Select, { size: "xs", listWidth: "rows", "aria-label": w.field, "data-slot": "vk-sort-field", items: asSelect(items), value: r.field, search: search, "data-force": open === "field" ? "focus" : undefined, onValueChange: (v) => { if (typeof v === "string" && v !== r.field && !takenBy(now.current, v, r.field, fieldOf))
|
|
171
172
|
change(now.current.map((x, k) => (k === i ? { ...x, field: v } : x))); } }), open === "field" && shownList(items, r.field, w.field, true)] }), _jsxs("div", { className: "o-sort-editor-direction", children: [_jsx(Select, { size: "xs", listWidth: "rows", "aria-label": w.direction, "data-slot": "vk-sort-direction", items: asSelect(DIRECTIONS), value: r.direction, "data-force": open === "direction" ? "focus" : undefined, onValueChange: turn(i) }), _jsx(DirectionFit, { items: asSelect(DIRECTIONS) }), open === "direction" && shownList(DIRECTIONS, r.direction, w.direction, false)] }), _jsx(Button, { kind: "quiet", shape: "icon", size: "2xs", look: X_LOOK, className: "o-sort-editor-remove", "data-slot": "vk-sort-remove", "aria-label": w.remove(name), icon: glyph(X), onClick: () => remove(i) })] }, r.field));
|
|
172
|
-
}), aside.map((a) => (_jsxs("div", { role: "listitem", className: "o-sort-editor-rule o-sort-editor-aside", "data-slot": "vk-sort-rule", "data-key": a.key, "data-aside": "", "data-aside-key": a.key, children: [_jsx("span", { className: "o-sort-editor-grip-place", "aria-hidden": "true" }), _jsx("div", { className: "o-sort-editor-field", children: _jsx(Tooltip, { label: a.why, side: "bottom", children: _jsx("span", { className: "o-sort-editor-why", children: _jsx(Select, { size: "xs", listWidth: "rows", "aria-label": w.fieldNamed(a.label), "data-slot": "vk-sort-field", items: asSelect(pickable()), value: null, placeholder: a.label, search: search, onValueChange: pointAt(a.key) }) }) }) }), _jsxs("div", { className: "o-sort-editor-direction", children: [_jsx(Tooltip, { label: a.why, side: "bottom", children: _jsx("span", { className: "o-sort-editor-why", children: _jsx(Select, { size: "xs", listWidth: "rows", "aria-label": w.direction, "data-slot": "vk-sort-direction", items: asSelect(DIRECTIONS), value: a.direction, disabled: true, onValueChange: () => { } }) }) }), _jsx(DirectionFit, { items: asSelect(DIRECTIONS) })] }), _jsx(Menu, { label: w.sortBy(a.label), align: "end", entries: asideEntries(a), trigger: _jsx(Button, { kind: "quiet", shape: "icon", size: "2xs", look: X_LOOK, className: "o-sort-editor-more", "data-slot": "vk-sort-rule-more", "aria-label": w.actionsFor(a.label), icon: glyph(DOTS) }) })] }, `aside-${a.key}`)))] }), (adds || rules.length > 0) && _jsxs("div", { className: "o-sort-editor-foot", "data-slot": "vk-sort-foot", children: [adds && addButton("sm"), rules.length > 0 && _jsx(Button, { kind: "quiet", size: "sm", className: "o-sort-editor-clear", "data-slot": "vk-sort-clear", onClick: () => { closePop(); change([]); if (!asideNow.current.length)
|
|
173
|
+
}), aside.map((a) => (_jsxs("div", { role: "listitem", className: "o-sort-editor-rule o-sort-editor-aside", "data-slot": "vk-sort-rule", "data-key": a.key, "data-aside": "", "data-aside-key": a.key, children: [_jsx("span", { className: "o-sort-editor-grip-place", "aria-hidden": "true" }), _jsx("div", { className: "o-sort-editor-field", children: _jsx(Tooltip, { label: a.why, side: "bottom", children: _jsx("span", { className: "o-sort-editor-why", children: _jsx(Select, { size: "xs", listWidth: "rows", "aria-label": w.fieldNamed(a.label), "data-slot": "vk-sort-field", items: asSelect(pickable()), value: null, placeholder: a.label, search: search, onValueChange: pointAt(a.key) }) }) }) }), _jsxs("div", { className: "o-sort-editor-direction", children: [_jsx(Tooltip, { label: a.why, side: "bottom", children: _jsx("span", { className: "o-sort-editor-why", children: _jsx(Select, { size: "xs", listWidth: "rows", "aria-label": w.direction, "data-slot": "vk-sort-direction", items: asSelect(DIRECTIONS), value: a.direction, disabled: true, onValueChange: () => { } }) }) }), _jsx(DirectionFit, { items: asSelect(DIRECTIONS) })] }), _jsx(Menu, { label: w.sortBy(a.label), align: "end", entries: asideEntries(a), trigger: _jsx(Button, { kind: "quiet", shape: "icon", size: "2xs", look: X_LOOK, className: "o-sort-editor-more", "data-slot": "vk-sort-rule-more", "aria-label": w.actionsFor(a.label), icon: glyph(DOTS) }) })] }, `aside-${a.key}`)))] }), (adds || (clears && rules.length > 0)) && _jsxs("div", { className: "o-sort-editor-foot", "data-slot": "vk-sort-foot", children: [adds && addButton("sm"), clears && rules.length > 0 && _jsx(Button, { kind: "quiet", size: "sm", className: "o-sort-editor-clear", "data-slot": "vk-sort-clear", onClick: () => { closePop(); change([]); if (!asideNow.current.length)
|
|
173
174
|
onDone?.(); }, children: w.clearAllSorts })] }), _jsx(Popover, { open: pop?.list === "add", onOpenChange: (o) => { if (!o)
|
|
174
175
|
closePop(); }, anchor: pop?.at, className: "o-sort-editor-pop", "aria-label": w.add, children: pop?.list === "add" && addPicker })] }) }));
|
|
175
176
|
return { body, head: {} };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button as BaseButton } from "@base-ui/react/button";
|
|
3
|
+
import * as React from "react";
|
|
3
4
|
import { cx } from "../../internal/cx.js";
|
|
5
|
+
import { KitWordsContext } from "../internal/kit-words.js";
|
|
4
6
|
import { phoneMark, usePhoneForm } from "../internal/phone.js";
|
|
5
7
|
const TAG = ["M7.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3z"];
|
|
6
8
|
const X = ["M18 6l-12 12", "M6 6l12 12"];
|
|
@@ -16,6 +18,6 @@ export function TagCut() {
|
|
|
16
18
|
return _jsx("span", { className: "o-tag-cut o-smooth o-smooth-ease", "aria-hidden": "true" });
|
|
17
19
|
}
|
|
18
20
|
export function TagRemove({ word, onRemove, force }) {
|
|
19
|
-
const phone = usePhoneForm();
|
|
20
|
-
return _jsx(BaseButton, { type: "button", className: "o-tag-remove", "aria-label": word
|
|
21
|
+
const phone = usePhoneForm(), kit = React.useContext(KitWordsContext);
|
|
22
|
+
return _jsx(BaseButton, { type: "button", className: "o-tag-remove", "aria-label": kit.remove(word), "data-force": force, onClick: onRemove, ...phoneMark(phone), children: glyph(X, "", 2.5) });
|
|
21
23
|
}
|
|
@@ -12,7 +12,10 @@ export function textEditorPropsOf({ label, kind, paragraph, value, onValueChange
|
|
|
12
12
|
return { label, kind: as, value, onValueChange, onDone, check, autoFocus, form, ...(place ? { place } : {}), draft: "shell", ...(region ? { country: region } : {}) };
|
|
13
13
|
}
|
|
14
14
|
export function textEditorWordsOf(say) {
|
|
15
|
-
return {
|
|
15
|
+
return {
|
|
16
|
+
country: say({ key: "views.editors.place-country" }), searchCountry: say({ key: "views.editors.place-country-search" }),
|
|
17
|
+
close: say({ key: "views.panels.close" }), save: say({ key: "views.editors.save" }), picker: pickerWordsOf(say),
|
|
18
|
+
};
|
|
16
19
|
}
|
|
17
20
|
export function MapTextBody(props) {
|
|
18
21
|
return _jsx(PanelControlsFromViews, { children: _jsx(TextBodyInner, { ...props }) });
|
|
@@ -240,8 +240,8 @@ export function useTextEditor(props) {
|
|
|
240
240
|
if (shell)
|
|
241
241
|
return { body, head: {} };
|
|
242
242
|
const head = {
|
|
243
|
-
left: _jsx(SheetButton, { "data-slot": "vk-editor-close", "aria-label":
|
|
244
|
-
right: _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label":
|
|
243
|
+
left: _jsx(SheetButton, { "data-slot": "vk-editor-close", "aria-label": w.close, icon: glyph(X), onClick: leave }),
|
|
244
|
+
right: _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": w.save, icon: glyph(TICK), onClick: keep }),
|
|
245
245
|
};
|
|
246
246
|
return { body, head };
|
|
247
247
|
}
|
|
@@ -4,6 +4,9 @@ export interface TextEditorWords {
|
|
|
4
4
|
country: string;
|
|
5
5
|
/** The countries' search. */
|
|
6
6
|
searchCountry: string;
|
|
7
|
+
/** A phone's head where no holder keeps the draft: its ✕ and ✓ (VK-997). */
|
|
8
|
+
close: string;
|
|
9
|
+
save: string;
|
|
7
10
|
/** The words of the countries' list. */
|
|
8
11
|
picker?: Partial<PickerWords>;
|
|
9
12
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const TEXT_EDITOR_WORDS = { country: "Country", searchCountry: "Search for a country" };
|
|
1
|
+
export const TEXT_EDITOR_WORDS = { country: "Country", searchCountry: "Search for a country", close: "Close", save: "Save" };
|
|
2
2
|
export const textWords = (given) => (given ? { ...TEXT_EDITOR_WORDS, ...given } : TEXT_EDITOR_WORDS);
|