viewkitjs 0.35.0 → 0.37.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 +112 -0
- package/MIGRATION.md +7 -0
- package/package.json +1 -1
- package/views/dist/atoms/types.d.ts +32 -4
- package/views/dist/contract.d.ts +32 -9
- package/views/dist/contract.js +35 -1
- package/views/dist/controls/avatar/avatar.d.ts +3 -1
- package/views/dist/controls/avatar/avatar.js +2 -2
- package/views/dist/controls/button/own-look-moved.d.ts +11 -0
- package/views/dist/controls/button/own-look-moved.js +3 -0
- package/views/dist/controls/compound-editor/map-parts-body.js +2 -0
- package/views/dist/controls/compound-editor/name-parts.js +1 -1
- package/views/dist/controls/compound-editor/place-parts.js +1 -1
- package/views/dist/controls/compound-editor/range-parts.js +1 -1
- 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 +10 -3
- package/views/dist/controls/customize/customize.js +147 -63
- 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 +7 -4
- package/views/dist/controls/customize/words.d.ts +2 -0
- package/views/dist/controls/customize/words.js +1 -0
- package/views/dist/controls/date-editor/date-behaviour.d.ts +80 -0
- package/views/dist/controls/date-editor/date-behaviour.js +187 -0
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -2
- package/views/dist/controls/date-editor/date-editor.js +29 -166
- package/views/dist/controls/field/field.d.ts +3 -2
- package/views/dist/controls/field/field.js +7 -2
- package/views/dist/controls/field/looks.d.ts +1 -1
- package/views/dist/controls/field/looks.js +5 -4
- package/views/dist/controls/field.css +4 -0
- package/views/dist/controls/filter-editor/block.js +5 -2
- package/views/dist/controls/filter-editor/filter-editor.d.ts +14 -1
- package/views/dist/controls/filter-editor/filter-editor.js +21 -13
- 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 +2 -0
- package/views/dist/controls/filter-editor/parts.js +13 -12
- 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 +4 -2
- package/views/dist/controls/index.js +3 -1
- package/views/dist/controls/inline-input.css +9 -0
- 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 +14 -1
- 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.js +1 -1
- package/views/dist/controls/internal/phone.d.ts +1 -1
- package/views/dist/controls/internal/phone.js +3 -2
- package/views/dist/controls/list/tokens.d.ts +1 -1
- package/views/dist/controls/list/tokens.js +1 -1
- package/views/dist/controls/list.css +5 -2
- package/views/dist/controls/menu/menu.d.ts +1 -1
- package/views/dist/controls/menu/menu.js +1 -1
- package/views/dist/controls/menu-list/menu-list.js +3 -2
- package/views/dist/controls/menu.css +4 -4
- 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/pane.css +1 -1
- 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.js +3 -26
- package/views/dist/controls/picker/map-picker.d.ts +2 -1
- package/views/dist/controls/picker/map-picker.js +4 -2
- package/views/dist/controls/picker/picker.js +9 -2
- package/views/dist/controls/picker/rows.d.ts +3 -1
- package/views/dist/controls/picker.css +7 -3
- package/views/dist/controls/popover/looks.d.ts +1 -1
- package/views/dist/controls/popover/looks.js +5 -0
- package/views/dist/controls/popover/tokens.d.ts +13 -1
- package/views/dist/controls/popover/tokens.js +4 -1
- package/views/dist/controls/popover.css +59 -8
- 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 +2 -0
- package/views/dist/controls/select/select.js +4 -2
- 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 +3 -1
- package/views/dist/controls/sort-editor/sort-editor.js +6 -4
- package/views/dist/controls/sort-editor.css +4 -2
- 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/text-editor.css +6 -0
- package/views/dist/controls/toolbar/toolbar.d.ts +12 -4
- package/views/dist/controls/toolbar/toolbar.js +7 -2
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +1 -1
- package/views/dist/controls/toolbar.css +5 -0
- package/views/dist/controls/tooltip/tokens.d.ts +1 -1
- package/views/dist/controls/tooltip/tokens.js +1 -1
- package/views/dist/controls/tooltip.css +5 -3
- package/views/dist/controls/values-editor.css +20 -5
- 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/entity-chip.d.ts +7 -1
- package/views/dist/display/entity-chip.js +2 -1
- package/views/dist/display/option-badges.d.ts +3 -2
- package/views/dist/display/option-badges.js +2 -2
- package/views/dist/field-row/FieldRow.js +12 -8
- package/views/dist/grid/chrome/GridAddColumn.d.ts +7 -2
- package/views/dist/grid/chrome/GridAddColumn.js +5 -4
- package/views/dist/grid/chrome/GridCellEditors.d.ts +4 -1
- package/views/dist/grid/chrome/GridCellEditors.js +3 -2
- package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -5
- package/views/dist/grid/chrome/GridCellOutline.js +3 -5
- package/views/dist/grid/chrome/GridChipsEditor.js +1 -1
- package/views/dist/grid/chrome/GridDateEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridDateEditor.js +1 -1
- package/views/dist/grid/chrome/GridHeader.js +3 -1
- package/views/dist/grid/chrome/GridLongTextEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridLongTextEditor.js +8 -5
- package/views/dist/grid/chrome/GridNameEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridNameEditor.js +1 -1
- package/views/dist/grid/chrome/GridNumberEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridNumberEditor.js +2 -2
- package/views/dist/grid/chrome/GridPlaceEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridPlaceEditor.js +1 -1
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +2 -2
- package/views/dist/grid/chrome/GridRangeEditor.js +1 -1
- package/views/dist/grid/chrome/GridRelationEditor.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +7 -1
- package/views/dist/grid/chrome/GridRowCells.js +6 -5
- package/views/dist/grid/chrome/GridSelectEditor.js +1 -1
- package/views/dist/grid/chrome/GridTable.d.ts +2 -1
- package/views/dist/grid/chrome/GridTable.js +7 -2
- package/views/dist/grid/chrome/GridTableSurface.js +2 -1
- package/views/dist/grid/chrome/GridTextEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridTextEditor.js +2 -2
- package/views/dist/grid/chrome/GridValueListEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridValueListEditor.js +1 -1
- package/views/dist/grid/chrome/grid-body-place.d.ts +7 -2
- package/views/dist/grid/chrome/grid-body-place.js +8 -4
- package/views/dist/grid/chrome/grid-cell-classes.js +2 -2
- package/views/dist/grid/chrome/grid-edit-session.d.ts +4 -0
- package/views/dist/grid/chrome/grid-edit-session.js +10 -1
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +10 -0
- package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
- package/views/dist/grid/chrome/grid-fitted-box.d.ts +9 -6
- package/views/dist/grid/chrome/grid-fitted-box.js +15 -7
- package/views/dist/grid/chrome/grid-hover.d.ts +3 -3
- package/views/dist/grid/chrome/grid-hover.js +2 -3
- package/views/dist/grid/chrome/grid-row-props.d.ts +6 -2
- package/views/dist/grid/chrome/grid-styles.d.ts +1 -5
- package/views/dist/grid/chrome/grid-styles.js +0 -1
- package/views/dist/grid/chrome/grid-table-props.d.ts +6 -2
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +0 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +2 -10
- package/views/dist/grid/chrome/useGridScaleStyles.d.ts +9 -1
- package/views/dist/grid/chrome/useGridScaleStyles.js +1 -4
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +3 -1
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +24 -1
- package/views/dist/grid/core/useGridEditing.d.ts +3 -0
- package/views/dist/grid/core/useGridEditing.js +2 -0
- 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 +9 -20
- package/views/dist/grid/useGridTablePrefs.d.ts +1 -1
- package/views/dist/grid/useGridTableSettings.d.ts +1 -1
- package/views/dist/internal/screen-forms.d.ts +11 -0
- package/views/dist/internal/screen-forms.js +31 -0
- package/views/dist/list/list.js +4 -3
- package/views/dist/list/menu.d.ts +5 -4
- package/views/dist/list/parts.d.ts +8 -2
- package/views/dist/list/parts.js +31 -7
- package/views/dist/list/toolbar.js +11 -5
- package/views/dist/looks/index.d.ts +1 -0
- package/views/dist/looks/index.js +1 -0
- package/views/dist/panels/customize-body.d.ts +1 -1
- package/views/dist/panels/customize-body.js +8 -1
- package/views/dist/panels/model.d.ts +5 -0
- package/views/dist/panels/react/customize-body.js +11 -2
- package/views/dist/panels/react/customize.d.ts +3 -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/popover.d.ts +3 -1
- package/views/dist/panels/react/popover.js +2 -2
- package/views/dist/panels/react/sort/SortEditor.js +3 -1
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +15 -4
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +12 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +5 -1
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +5 -3
- package/views/dist/panels/react/toolbar/ToolbarButton.js +3 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -3
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +1 -1
- 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 +28 -20
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/context.d.ts +3 -2
- 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 +26 -11
- 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 +7 -10
- package/views/dist/panels/react/views-row/more-views.d.ts +2 -0
- package/views/dist/panels/react/views-row/more-views.js +3 -0
- 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/toolbar/model.d.ts +2 -2
- package/views/dist/provider/components.d.ts +88 -8
- package/views/dist/provider/desktop.d.ts +2 -1
- package/views/dist/provider/desktop.js +5 -2
- package/views/dist/react.d.ts +1 -1
- package/views/dist/styles.css +198 -84
- package/views/dist/styles.unlayered.css +198 -84
- package/views/docs/contract.md +87 -32
- package/views/docs/controls/list.md +2 -0
- package/views/docs/controls/menu.md +2 -0
- package/views/docs/controls/picker.md +2 -0
- package/views/docs/controls/popover.md +7 -0
- package/views/docs/controls/tooltip.md +2 -0
- package/views/docs/guides/atoms.md +11 -10
- package/views/docs/guides/the-grid.md +7 -5
- package/views/docs/guides/the-provider.md +2 -2
- package/views/docs/reference/controls.md +24 -18
- package/views/docs/reference/display.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +4 -4
- package/views/docs/reference/list.md +30 -11
- package/views/docs/reference/looks.md +4 -1
- package/views/docs/reference/panels-react.md +7 -6
- package/views/docs/reference/panels.md +2 -2
- package/views/docs/reference/react.md +22 -10
- package/views/docs/reference/views.md +2 -2
- package/views/docs/reshaping.md +2 -2
- package/views/skills/views/SKILL.md +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { useViews } from "../../provider/context.js";
|
|
5
|
+
import { FieldsFrame } from "./fields-frame.js";
|
|
5
6
|
import { Picker } from "./picker.js";
|
|
6
7
|
import { pickerWordsOf } from "./map-picker.js";
|
|
7
8
|
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
@@ -39,33 +40,9 @@ export function fieldsBodyHandlers({ onPick, onDone }, held = { current: false }
|
|
|
39
40
|
export function MapFieldsBody(props) {
|
|
40
41
|
return _jsx(PanelControlsFromViews, { children: _jsx(FieldsBodyInner, { ...props }) });
|
|
41
42
|
}
|
|
42
|
-
function FieldsBodyInner({ label, search, fields, own, form, onPick, onDone }) {
|
|
43
|
+
function FieldsBodyInner({ label, search, fields, own, ownRelation, form, onPick, onDone }) {
|
|
43
44
|
const { messages } = useViews();
|
|
44
45
|
const picked = React.useRef(false);
|
|
45
46
|
const on = () => fieldsBodyHandlers({ onPick, onDone }, picked);
|
|
46
|
-
|
|
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() }) });
|
|
47
|
+
return _jsx(FieldsFrame, { children: _jsx(Picker, { label: label, items: fieldItemsOf(fields, messages({ key: "views.panels.related-records" })), value: own === undefined ? null : ownRelation !== undefined ? farValue(ownRelation, own) : own, search: search, searchShown: true, form: form, words: pickerWordsOf(messages), onValueChange: (v) => on().onValueChange(v), onDone: () => on().onDone() }) });
|
|
71
48
|
}
|
|
@@ -17,7 +17,8 @@ type AppIcon = ComponentType<{
|
|
|
17
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
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
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.
|
|
20
|
+
* option's derived one included), each with its icon; this needs a provider, which the Picker always stands in. Held among the
|
|
21
|
+
* search's chips (the look Chips), a category stands as the app's Tag with its remove (VK-1059).
|
|
21
22
|
*/
|
|
22
23
|
export declare function pickerItemsOf(items: readonly ViewsPickerItem[], { AppIcon, steps, cells }?: {
|
|
23
24
|
AppIcon?: AppIcon;
|
|
@@ -26,8 +26,10 @@ export function pickerItemsOf(items, { AppIcon, steps, cells } = {}) {
|
|
|
26
26
|
item.as = { mark: i.glyph };
|
|
27
27
|
else if (i.slot && cells)
|
|
28
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
|
-
|
|
29
|
+
else if (i.color && cells) {
|
|
30
|
+
const { label, color, icon } = i;
|
|
31
|
+
item.as = { chip: _jsx(OptionCategory, { label: label, color: color, icon: icon }), removable: (onRemove) => _jsx(OptionCategory, { label: label, color: color, icon: icon, onRemove: onRemove }) };
|
|
32
|
+
}
|
|
31
33
|
else if (i.slot) {
|
|
32
34
|
const status = statusPlaceOf(i.slot);
|
|
33
35
|
item.as = status !== "between" ? { status } : { status, quarters: onSteps.includes(i) ? quartersOf(onSteps, i) : 2 };
|
|
@@ -844,10 +844,17 @@ function usePickerAt(props, under) {
|
|
|
844
844
|
});
|
|
845
845
|
const soft = props.searchLook === "soft" && !chips;
|
|
846
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 });
|
|
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("
|
|
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")) {
|
|
848
848
|
e.preventDefault();
|
|
849
849
|
input.current?.focus();
|
|
850
|
-
} }, 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))] }))] }))] })] }));
|
|
851
858
|
const value_ = (multiple ? heldEntries : heldEntries[0] ?? null);
|
|
852
859
|
const highlighted = (v, d) => {
|
|
853
860
|
lit.current = d.index;
|
|
@@ -5,11 +5,13 @@ import type { MenuEntry } from "../menu-list/menu-list.js";
|
|
|
5
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
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
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
|
|
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. */
|
|
9
10
|
export type PickerAs = {
|
|
10
11
|
option: true;
|
|
11
12
|
} | {
|
|
12
13
|
chip: ReactNode;
|
|
14
|
+
removable?: (onRemove: () => void) => ReactNode;
|
|
13
15
|
} | {
|
|
14
16
|
status: StatusPlace;
|
|
15
17
|
quarters?: 1 | 2 | 3;
|
|
@@ -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); }
|
|
@@ -61,14 +63,14 @@
|
|
|
61
63
|
|
|
62
64
|
/* ── On a computer it follows the list's rules, so a Picker and a Select's list side by
|
|
63
65
|
side match. Its rows are the list's: the Input box's corners or Row corners, square at padding 0 (list.css), 8½ rows at most
|
|
64
|
-
(list-rows), a row's room round the one brought into view. And a Popover holding it, and no editor, draws the list's panel in
|
|
66
|
+
(--vk-list-rows, the app's, or its old name --list-rows), a row's room round the one brought into view. And a Popover holding it, and no editor, draws the list's panel in
|
|
65
67
|
place of its own options: the list's Edge (its lines' colour with it), Shadow and Padding, its corners the Input box's plus the padding, never past 2xl,
|
|
66
68
|
and its Corner smoothing (the list's smooth outline, or round), the Popover's own smooth outline not drawn. A body picks the shell's
|
|
67
69
|
options it needs; the Popover knows nothing of what it holds. ── */
|
|
68
70
|
.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
71
|
--list-row-pill-in: var(--list-row-corners-pill, var(--list-row-pill, var(--list-box-pill, 0))); }
|
|
70
72
|
.o-picker[data-picker-form="computer"] .o-picker-rows {
|
|
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));
|
|
73
|
+
max-height: calc(var(--vk-list-rows, 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
74
|
}
|
|
73
75
|
/* ViewKit's field list (CONTROLS.FieldsBody, wrapped in .o-fields-body, which draws no box) stands as wide as its widest row:
|
|
74
76
|
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
|
|
@@ -78,7 +80,9 @@
|
|
|
78
80
|
/* Never narrower than it opened nor than its search's placeholder (map-fields-body.tsx measures both as it opens). */
|
|
79
81
|
.o-fields-body .o-picker[data-picker-form="computer"] { min-width: var(--picker-floor, 0px); }
|
|
80
82
|
.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"]) {
|
|
83
|
+
.o-popover:has(> .o-popover-cut > .o-fields-body .o-picker[data-picker-form="computer"]) {
|
|
84
|
+
width: var(--popover-size-w, fit-content); max-width: min(var(--popover-size-w, calc(var(--vk-spacing) * 72)), var(--available-width, 100%));
|
|
85
|
+
}
|
|
82
86
|
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])) {
|
|
83
87
|
--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));
|
|
84
88
|
--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)));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PieceLooks } from "../../looks/looks.js";
|
|
2
|
-
export type PopoverLookOptionId = "corners" | "smoothing" | "shadow" | "edge" | "padding" | "gap";
|
|
2
|
+
export type PopoverLookOptionId = "corners" | "smoothing" | "shadow" | "edge" | "padding" | "gap" | "motion" | "distance" | "open" | "close" | "ease";
|
|
3
3
|
/** The Popover's options. */
|
|
4
4
|
export declare const POPOVER_LOOKS: PieceLooks<PopoverLookOptionId>;
|
|
@@ -6,5 +6,10 @@ const options = [
|
|
|
6
6
|
{ id: "edge", name: "Edge", device: "desktop", def: "outline", values: [{ id: "outline", name: "Outline" }, { id: "subtle", name: "Subtle" }, { id: "none", name: "None" }] },
|
|
7
7
|
{ id: "padding", name: "Padding", device: "desktop", def: "8", kind: "steps", values: steps(["0", "4", "8", "12", "16"]) },
|
|
8
8
|
{ id: "gap", name: "Gap", device: "desktop", def: "4", kind: "steps", values: steps(["0", "4", "8"]) },
|
|
9
|
+
{ id: "motion", name: "How it comes", device: "desktop", def: "nudge", values: [{ id: "fade", name: "Fades" }, { id: "nudge", name: "Fades and nudges" }, { id: "scale", name: "Fades and grows" }, { id: "none", name: "None" }] },
|
|
10
|
+
{ id: "distance", name: "How far", device: "desktop", def: "medium", kind: "steps", unless: ["motion", ["fade", "none"]], values: [{ id: "small", name: "Small" }, { id: "medium", name: "Medium" }, { id: "large", name: "Large" }] },
|
|
11
|
+
{ id: "open", name: "Opens in", device: "desktop", def: "150", kind: "steps", unless: ["motion", "none"], values: steps(["100", "150", "200", "300"]) },
|
|
12
|
+
{ id: "close", name: "Closes in", device: "desktop", def: "150", kind: "steps", unless: ["motion", "none"], values: steps(["75", "100", "150", "200"]) },
|
|
13
|
+
{ id: "ease", name: "Ease", device: "desktop", def: "out", unless: ["motion", "none"], values: [{ id: "out", name: "Ease out" }, { id: "sharp", name: "Sharp" }, { id: "smooth", name: "Ease in and out" }, { id: "spring", name: "Spring" }] },
|
|
9
14
|
];
|
|
10
15
|
export const POPOVER_LOOKS = { id: "popover", name: "Popover", options, looks: [] };
|
|
@@ -78,6 +78,18 @@ export declare const POPOVER_TOKENS: readonly [{
|
|
|
78
78
|
readonly name: "--vk-ease-in";
|
|
79
79
|
readonly kind: "motion";
|
|
80
80
|
readonly outright: "--ease-in";
|
|
81
|
+
}, {
|
|
82
|
+
readonly name: "--vk-ease-out-sharp";
|
|
83
|
+
readonly kind: "motion";
|
|
84
|
+
readonly outright: "--ease-out-sharp";
|
|
85
|
+
}, {
|
|
86
|
+
readonly name: "--vk-ease-in-out";
|
|
87
|
+
readonly kind: "motion";
|
|
88
|
+
readonly outright: "--ease-in-out";
|
|
89
|
+
}, {
|
|
90
|
+
readonly name: "--vk-ease-spring";
|
|
91
|
+
readonly kind: "motion";
|
|
92
|
+
readonly outright: "--ease-spring";
|
|
81
93
|
}];
|
|
82
94
|
/** The prefixes of its own machinery, set and read by it alone: not public. */
|
|
83
|
-
export declare const POPOVER_PRIVATE: readonly ["--popover-", "--divider-", "--anchor-", "--available-"];
|
|
95
|
+
export declare const POPOVER_PRIVATE: readonly ["--popover-", "--divider-", "--anchor-", "--available-", "--transform-origin"];
|
|
@@ -19,5 +19,8 @@ export const POPOVER_TOKENS = [
|
|
|
19
19
|
{ name: "--vk-duration-fast", kind: "motion", outright: "--duration-fast" },
|
|
20
20
|
{ name: "--vk-ease-out", kind: "motion", outright: "--ease-out" },
|
|
21
21
|
{ name: "--vk-ease-in", kind: "motion", outright: "--ease-in" },
|
|
22
|
+
{ name: "--vk-ease-out-sharp", kind: "motion", outright: "--ease-out-sharp" },
|
|
23
|
+
{ name: "--vk-ease-in-out", kind: "motion", outright: "--ease-in-out" },
|
|
24
|
+
{ name: "--vk-ease-spring", kind: "motion", outright: "--ease-spring" },
|
|
22
25
|
];
|
|
23
|
-
export const POPOVER_PRIVATE = ["--popover-", "--divider-", "--anchor-", "--available-"];
|
|
26
|
+
export const POPOVER_PRIVATE = ["--popover-", "--divider-", "--anchor-", "--available-", "--transform-origin"];
|
|
@@ -12,6 +12,17 @@
|
|
|
12
12
|
data-popover-padding 0 · 4 · 8 · 12 · 16 how far what it holds stands from its edge
|
|
13
13
|
data-popover-gap 0 · 4 · 8 how far it stands from what opened it (none laid over it)
|
|
14
14
|
|
|
15
|
+
How it moves is every popup's (this one, the Menu's and the Select's list, the Tooltip), by the contract's popup motion names
|
|
16
|
+
(docs/contract.md, Tokens): --vk-popup-open-duration, --vk-popup-close-duration, --vk-popup-open-ease, --vk-popup-close-ease,
|
|
17
|
+
--vk-popup-nudge and --vk-popup-scale, each read with today's motion where none is declared. The Popover's picks set them on
|
|
18
|
+
the frame itself, so every popup inside it, an app's own too, moves the same; a default pick sets nothing:
|
|
19
|
+
|
|
20
|
+
data-popover-motion fade · nudge · scale · none fades; fades and nudges out from what opened it; fades and grows; none
|
|
21
|
+
data-popover-distance small · medium · large how far it nudges (2, 4 or 8px), or what it grows from (98, 95 or 90%)
|
|
22
|
+
data-popover-open 100 · 150 · 200 · 300 how many ms it takes to open
|
|
23
|
+
data-popover-close 75 · 100 · 150 · 200 how many ms it takes to close
|
|
24
|
+
data-popover-ease out · sharp · smooth · spring its ease: out, then in as it goes; sharp; in and out both ways; a spring
|
|
25
|
+
|
|
15
26
|
On the popup itself, `data-popover-chrome="menu"` marks a popup that holds a list (the components map's `chrome`): the Outright
|
|
16
27
|
look draws it as its card, as its editors were approved; an app's own styles may draw it otherwise.
|
|
17
28
|
|
|
@@ -31,12 +42,31 @@
|
|
|
31
42
|
--popover-gap: var(--vk-spacing); --popover-edge: var(--vk-border); --divider-colour: var(--vk-border);
|
|
32
43
|
--divider-reach: max(0px, calc(var(--popover-pad) - var(--vk-border-width)));
|
|
33
44
|
box-sizing: border-box; display: flex; flex-direction: column;
|
|
34
|
-
|
|
45
|
+
--popover-size-w: initial; --popover-size-h: initial;
|
|
46
|
+
width: var(--popover-size-w, calc(var(--vk-spacing) * 72)); min-width: var(--popover-size-w, var(--anchor-width, auto));
|
|
47
|
+
max-width: var(--available-width, 100%); max-height: var(--popover-size-h, var(--available-height, none));
|
|
35
48
|
border-radius: var(--popover-corners); background-color: var(--vk-overlay); box-shadow: var(--popover-shadow); color: var(--vk-fg);
|
|
36
49
|
font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); outline: none;
|
|
37
|
-
|
|
50
|
+
--popover-nudge: var(--vk-popup-nudge, var(--vk-spacing)); transform-origin: var(--transform-origin);
|
|
51
|
+
transition-property: opacity, translate, scale;
|
|
52
|
+
transition-duration: var(--vk-popup-open-duration, var(--vk-duration-fast));
|
|
53
|
+
transition-timing-function: var(--vk-popup-open-ease, var(--vk-ease-out));
|
|
38
54
|
}
|
|
39
55
|
|
|
56
|
+
/* ── Its size, by what it holds (VK-992): a toolbar panel's, marked by its slot, the app's --vk-panel-w and --vk-panel-max-h; a field
|
|
57
|
+
editor's, the app's --vk-editor-w and --vk-editor-max-h (docs/contract.md, Tokens). Undeclared, the size here is invalid, so each
|
|
58
|
+
place's own width stands (above, or a rule of what it holds reading --popover-size-w first); declared, it is the width, and the
|
|
59
|
+
height at the most, never past the room on screen. ─────────────────────────────────────────────────────────── */
|
|
60
|
+
.o-popover:where([data-slot^="vk-toolbar-"][data-slot$="-panel"]) {
|
|
61
|
+
--popover-size-w: var(--vk-panel-w); --popover-size-h: min(var(--vk-panel-max-h), var(--available-height, 100dvh));
|
|
62
|
+
}
|
|
63
|
+
.o-popover:where([data-slot="vk-grid-editor"], [data-slot="vk-editor-panel"]) {
|
|
64
|
+
--popover-size-w: var(--vk-editor-w); --popover-size-h: min(var(--vk-editor-max-h), var(--available-height, 100dvh));
|
|
65
|
+
}
|
|
66
|
+
/* A grid editor over its cell stands a step left of it (the grid's overCell offsets): at the least the cell's width and two
|
|
67
|
+
steps, so it covers the cell's far line too and a press where the cell was lands inside it. */
|
|
68
|
+
.o-popover:where([data-slot="vk-grid-editor"]) { min-width: var(--popover-size-w, calc(var(--anchor-width, 0px) + var(--vk-spacing) * 2)); }
|
|
69
|
+
|
|
40
70
|
/* What it holds, inside its edge, scrolling there when the screen is shorter. The edge is drawn as two shapes, never a
|
|
41
71
|
border, as the Modal's is: its colour (::before), and the ground just inside it (::after), one line narrower. Each
|
|
42
72
|
takes its own corner, its inset less, so the edge follows the corners exactly, round or smooth. */
|
|
@@ -53,12 +83,14 @@
|
|
|
53
83
|
/* Laid over what opens it (a negative sideOffset), it stands on it: no gap. */
|
|
54
84
|
.o-popover[data-over] { margin: 0; }
|
|
55
85
|
|
|
56
|
-
/* It fades in and moves 4px out from what opened it
|
|
57
|
-
.o-popover[data-ending-style] {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.o-popover
|
|
61
|
-
.o-popover[data-side="
|
|
86
|
+
/* It fades in and moves 4px out from what opened it, in 150ms, and leaves the same way, easing in; or as the popup motion names say. */
|
|
87
|
+
.o-popover[data-ending-style] {
|
|
88
|
+
transition-duration: var(--vk-popup-close-duration, var(--vk-duration-fast)); transition-timing-function: var(--vk-popup-close-ease, var(--vk-ease-in));
|
|
89
|
+
}
|
|
90
|
+
.o-popover:is([data-starting-style], [data-ending-style]) { opacity: 0; translate: 0 calc(var(--popover-nudge) * -1); scale: var(--vk-popup-scale, none); }
|
|
91
|
+
.o-popover[data-side="top"]:is([data-starting-style], [data-ending-style]) { translate: 0 var(--popover-nudge); }
|
|
92
|
+
.o-popover[data-side="left"]:is([data-starting-style], [data-ending-style]) { translate: var(--popover-nudge) 0; }
|
|
93
|
+
.o-popover[data-side="right"]:is([data-starting-style], [data-ending-style]) { translate: calc(var(--popover-nudge) * -1) 0; }
|
|
62
94
|
|
|
63
95
|
/* ── What an app sets once ───────────────────────────────────────────────────────────────────────────────────── */
|
|
64
96
|
[data-popover-corners="lg"] .o-popover { --popover-corners: var(--vk-radius-lg); }
|
|
@@ -75,6 +107,25 @@
|
|
|
75
107
|
[data-popover-gap="0"] .o-popover { --popover-gap: 0px; }
|
|
76
108
|
[data-popover-gap="8"] .o-popover { --popover-gap: calc(var(--vk-spacing) * 2); }
|
|
77
109
|
|
|
110
|
+
/* How it moves: on the frame itself, the public names every popup inside it reads. Each value is the pick's own (a frame need declare
|
|
111
|
+
no token for it), the eases the motion tokens; None comes last, so it stills whatever the times say. */
|
|
112
|
+
[data-popover-distance="small"] { --vk-popup-nudge: 2px; }
|
|
113
|
+
[data-popover-distance="large"] { --vk-popup-nudge: 8px; }
|
|
114
|
+
:is([data-popover-motion="fade"], [data-popover-motion="scale"]) { --vk-popup-nudge: 0px; }
|
|
115
|
+
[data-popover-motion="scale"] { --vk-popup-scale: 0.95; }
|
|
116
|
+
[data-popover-motion="scale"][data-popover-distance="small"] { --vk-popup-scale: 0.98; }
|
|
117
|
+
[data-popover-motion="scale"][data-popover-distance="large"] { --vk-popup-scale: 0.9; }
|
|
118
|
+
[data-popover-open="100"] { --vk-popup-open-duration: 100ms; }
|
|
119
|
+
[data-popover-open="200"] { --vk-popup-open-duration: 200ms; }
|
|
120
|
+
[data-popover-open="300"] { --vk-popup-open-duration: 300ms; }
|
|
121
|
+
[data-popover-close="75"] { --vk-popup-close-duration: 75ms; }
|
|
122
|
+
[data-popover-close="100"] { --vk-popup-close-duration: 100ms; }
|
|
123
|
+
[data-popover-close="200"] { --vk-popup-close-duration: 200ms; }
|
|
124
|
+
[data-popover-ease="sharp"] { --vk-popup-open-ease: var(--vk-ease-out-sharp); }
|
|
125
|
+
[data-popover-ease="smooth"] { --vk-popup-open-ease: var(--vk-ease-in-out); --vk-popup-close-ease: var(--vk-ease-in-out); }
|
|
126
|
+
[data-popover-ease="spring"] { --vk-popup-open-ease: var(--vk-ease-spring); }
|
|
127
|
+
[data-popover-motion="none"] { --vk-popup-open-duration: 0s; --vk-popup-close-duration: 0s; }
|
|
128
|
+
|
|
78
129
|
/* ── Its corners smooth: the smooth outline (smooth.css), Apple's curve as measured, so every browser that knows
|
|
79
130
|
shape() shows it; one that doesn't keeps the corners above. The shell keeps its shadow, which a cut would take with
|
|
80
131
|
it, so .o-popover-cut inside it is cut instead, and the edge's two shapes each by the same outline at its own corner,
|
|
@@ -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);
|
|
@@ -98,6 +98,8 @@ export interface SelectListProps extends SelectFieldProps {
|
|
|
98
98
|
chips?: boolean;
|
|
99
99
|
/** A row at the top that clears the field ("No owner"), while it has a value. */
|
|
100
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;
|
|
101
103
|
/** Its list's own words (the Picker's: "Nothing matches", "Selected"), each the app's where handed. */
|
|
102
104
|
pickerWords?: Partial<PickerWords>;
|
|
103
105
|
/** A search on top of the list, with what it says before anything is typed ("Find someone"). */
|
|
@@ -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"];
|
|
@@ -113,17 +114,18 @@ function TypedBox({ p, f, trigger, field, hint, search }) {
|
|
|
113
114
|
return () => watch.disconnect();
|
|
114
115
|
}, [several, names, n, q]);
|
|
115
116
|
const small = p.size === "2xs" || p.size === "xs";
|
|
117
|
+
const kitWords = React.useContext(KitWordsContext), clearLabel = p.clearLabel ?? kitWords.clear;
|
|
116
118
|
const one = !multiple && f.chosen.length === 1 ? f.chosen[0] : undefined;
|
|
117
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")] }));
|
|
118
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"] }) }));
|
|
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":
|
|
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, "") })] }));
|
|
120
122
|
}
|
|
121
123
|
const gapOf = (at) => spacingPx(1, at), edgeOf = (at) => spacingPx(1.25, at);
|
|
122
124
|
function listNeed(at, rows, lines) {
|
|
123
125
|
const probe = at.ownerDocument.createElement("div");
|
|
124
126
|
probe.style.cssText = "position:absolute;visibility:hidden;pointer-events:none;height:var(--list-row-h, calc(var(--vk-spacing) * 8));padding-top:var(--list-pad, calc(var(--vk-spacing) * 1.5));margin-top:calc(var(--vk-spacing) * 11)";
|
|
125
127
|
at.parentElement?.append(probe);
|
|
126
|
-
const s = getComputedStyle(probe), most = parseFloat(
|
|
128
|
+
const s = getComputedStyle(probe), own = getComputedStyle(at), most = parseFloat(own.getPropertyValue("--vk-list-rows")) || parseFloat(own.getPropertyValue("--list-rows")) || 8.5;
|
|
127
129
|
const need = Math.min(rows, most) * parseFloat(s.height) + 2 * parseFloat(s.paddingTop) + lines * parseFloat(s.marginTop);
|
|
128
130
|
probe.remove();
|
|
129
131
|
return need * drawnAt(at);
|
|
@@ -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";
|
|
@@ -43,6 +44,8 @@ export interface SortEditorProps {
|
|
|
43
44
|
addSort?: boolean;
|
|
44
45
|
/** Its words; English unless handed. */
|
|
45
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;
|
|
46
49
|
}
|
|
47
50
|
export interface SortEditorParts {
|
|
48
51
|
body: React.ReactNode;
|
|
@@ -54,7 +57,6 @@ export interface SortEditorParts {
|
|
|
54
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
|
|
55
58
|
* (what Sort on the row's right, and on the filter bar the empty Sort, open on a computer, KIT-623). */
|
|
56
59
|
export declare const sortableFields: (fields: PickerItem[], rules: SortRule[], fieldOf?: FieldOf, sorted?: string) => PickerItem[];
|
|
57
|
-
/** The sort editor's state and the parts a shell pours in. */
|
|
58
60
|
export declare function useSortEditor(props: SortEditorProps): SortEditorParts;
|
|
59
61
|
/** The body alone, for a shell that holds only a body (the Popover). */
|
|
60
62
|
export declare function SortEditor(props: SortEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,6 +8,7 @@ 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
14
|
import { addSort, canAddSort, dropAside, openPlaces, putBack, repoint, SORT_MAX, takenBy } from "./rules.js";
|
|
@@ -28,8 +29,9 @@ function fieldsFor(fields, rules, sorted, own, fieldOf) {
|
|
|
28
29
|
: f.value !== own && takenBy(rules, f.value, own, fieldOf) ? { ...f, disabled: true, line: sorted } : f));
|
|
29
30
|
}
|
|
30
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"]);
|
|
31
33
|
export function useSortEditor(props) {
|
|
32
|
-
const { label, fields, rules, onRulesChange, max = SORT_MAX, onDone, opens, fieldOf, addSort: adds = true, clearAll: clears = true } = props;
|
|
34
|
+
const { label, fields, rules, onRulesChange, max = SORT_MAX, onDone, opens, fieldOf, addSort: adds = true, clearAll: clears = true, items } = props;
|
|
33
35
|
const { Button, Select, Menu, Popover, Tooltip } = usePanelControls();
|
|
34
36
|
const aside = React.useMemo(() => props.aside ?? [], [props.aside]);
|
|
35
37
|
const w = sortWords(props.words), search = props.search ?? w.search, DIRECTIONS = directionsOf(w);
|
|
@@ -114,11 +116,11 @@ export function useSortEditor(props) {
|
|
|
114
116
|
setPop((p) => (p?.list === "add" ? null : { list: "add", rule: -1, at })); }, children: w.add }) }));
|
|
115
117
|
const closePop = () => setPop(null);
|
|
116
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 });
|
|
117
|
-
const asideEntries = (a) => [
|
|
119
|
+
const asideEntries = (a) => shapeMenu([
|
|
118
120
|
{ icon: null, label: a.why, disabled: a.why, slot: { slot: "vk-sort-rule-action", key: "why" } },
|
|
119
121
|
...(a.back != null ? [{ icon: null, label: w.putBack, onSelect: () => backOn(a.key), slot: { slot: "vk-sort-rule-action", key: "put-back" } }] : []),
|
|
120
122
|
{ icon: glyph(TRASH), label: w.delete, danger: true, onSelect: () => drop(a.key), slot: { slot: "vk-sort-rule-action", key: "delete" } },
|
|
121
|
-
];
|
|
123
|
+
], items, { menu: "aside", field: a.key, form: phone ? "phone" : "computer" }, "vk-sort-rule-action", ASIDE_KEYS);
|
|
122
124
|
if (phone || narrow) {
|
|
123
125
|
const size = phone ? "44" : "sm";
|
|
124
126
|
const more = (name) => (phone
|
|
@@ -136,7 +138,7 @@ export function useSortEditor(props) {
|
|
|
136
138
|
setPop((p) => (p?.list === "direction" && p.rule === i ? null : { list: "direction", rule: i, at }));
|
|
137
139
|
else
|
|
138
140
|
setStep({ list: "direction", rule: i });
|
|
139
|
-
}, 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)] });
|
|
140
142
|
return phone
|
|
141
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)
|
|
142
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);
|
|
@@ -43,8 +43,10 @@
|
|
|
43
43
|
/* ViewKit's own Popover holding the rules on a computer (the ready toolbar's Sort): as wide as its rows, so each rule's grip, field,
|
|
44
44
|
direction and × stand inside it, never under the 288 it opens Add sort's fields at, and never past the room on screen (its own
|
|
45
45
|
--available-width, popover.css). Keyed on what it holds, so the fields with no rule keep their 288; an app's own Popover, or its own
|
|
46
|
-
width on this one, is the app's (VK-977). */
|
|
47
|
-
.o-popover:has(.o-sort-editor[data-sort-form="computer"]) {
|
|
46
|
+
width on this one, is the app's (VK-977), and the app's --vk-panel-w sets it (--popover-size-w, VK-992). */
|
|
47
|
+
.o-popover:has(.o-sort-editor[data-sort-form="computer"]) {
|
|
48
|
+
width: var(--popover-size-w, max-content); min-width: var(--popover-size-w, max(var(--anchor-width, 0px), calc(var(--vk-spacing) * 72)));
|
|
49
|
+
}
|
|
48
50
|
|
|
49
51
|
/* A list a page shows standing open: under what opens it, over the rules, as the Select's list stands, as wide as its rows, never
|
|
50
52
|
under 192 nor its box, never past 288 (listWidth, select.css). Scoped to the editor, so it wins over the smooth list's own
|
|
@@ -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);
|