viewkitjs 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +139 -0
- package/package.json +1 -1
- package/views/README.md +1 -1
- package/views/dist/atoms/Avatar.js +2 -1
- package/views/dist/atoms/RelationChip.d.ts +2 -0
- package/views/dist/atoms/RelationChip.js +5 -0
- package/views/dist/atoms/RowMenu.d.ts +1 -1
- package/views/dist/atoms/RowMenu.js +15 -3
- package/views/dist/atoms/defaults.js +2 -0
- package/views/dist/atoms/types.d.ts +40 -4
- package/views/dist/cells/relation-wrap.js +9 -2
- package/views/dist/contract.d.ts +27 -14
- package/views/dist/contract.js +40 -4
- package/views/dist/controls/alert/alert.js +2 -1
- package/views/dist/controls/alert-dialog/alert-dialog.js +3 -2
- package/views/dist/controls/avatar/avatar-mark.d.ts +4 -0
- package/views/dist/controls/avatar/avatar-mark.js +5 -0
- package/views/dist/controls/avatar/avatar.d.ts +7 -4
- package/views/dist/controls/avatar/avatar.js +10 -4
- package/views/dist/controls/avatar/looks.d.ts +1 -1
- package/views/dist/controls/avatar/looks.js +3 -0
- package/views/dist/controls/avatar/record-mark.d.ts +16 -0
- package/views/dist/controls/avatar/record-mark.js +13 -0
- package/views/dist/controls/avatar/tokens.d.ts +12 -0
- package/views/dist/controls/avatar/tokens.js +3 -0
- package/views/dist/controls/avatar.css +54 -17
- package/views/dist/controls/bulk-bar/bulk-bar.js +29 -27
- package/views/dist/controls/bulk-bar/map-selection-bar.js +2 -1
- package/views/dist/controls/compound-editor/compound-editor.d.ts +3 -0
- package/views/dist/controls/compound-editor/map-parts-body.d.ts +1 -1
- package/views/dist/controls/compound-editor/map-parts-body.js +6 -1
- package/views/dist/controls/compound-editor/name-parts.js +2 -1
- package/views/dist/controls/compound-editor/place-parts.js +2 -2
- package/views/dist/controls/compound-editor/range-parts.js +10 -9
- package/views/dist/controls/controls.d.ts +2 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/customize/customize.d.ts +14 -5
- package/views/dist/controls/customize/customize.js +19 -20
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -2
- package/views/dist/controls/customize/map-customize-body.js +15 -13
- package/views/dist/controls/customize/words.d.ts +3 -3
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -0
- package/views/dist/controls/date-editor/date-editor.js +13 -7
- package/views/dist/controls/date-editor/map-calendar.js +2 -0
- package/views/dist/controls/date-editor/map-date-body.d.ts +1 -1
- package/views/dist/controls/date-editor/map-date-body.js +7 -3
- package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +4 -6
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +2 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -4
- package/views/dist/controls/filter-editor/parts.d.ts +4 -2
- package/views/dist/controls/filter-editor/parts.js +8 -7
- package/views/dist/controls/group-editor/group-editor.js +2 -1
- package/views/dist/controls/group-editor/map-group-body.d.ts +1 -0
- package/views/dist/controls/group-editor/map-group-body.js +5 -1
- package/views/dist/controls/index.d.ts +1 -1
- package/views/dist/controls/input/input.js +2 -1
- package/views/dist/controls/internal/head-button.d.ts +9 -0
- package/views/dist/controls/internal/head-button.js +13 -0
- package/views/dist/controls/internal/map-panel-controls.js +9 -5
- package/views/dist/controls/internal/panel-controls.d.ts +38 -6
- package/views/dist/controls/internal/panel-controls.js +191 -19
- package/views/dist/controls/links-editor/links-editor.js +5 -7
- package/views/dist/controls/links-editor/map-links-body.d.ts +1 -1
- package/views/dist/controls/links-editor/map-links-body.js +5 -1
- package/views/dist/controls/menu/menu.d.ts +5 -1
- package/views/dist/controls/menu/menu.js +4 -3
- package/views/dist/controls/modal/modal.js +5 -3
- package/views/dist/controls/number-editor/map-number-body.js +5 -1
- package/views/dist/controls/number-editor/number-editor.js +6 -6
- package/views/dist/controls/pane/map-pane.d.ts +3 -0
- package/views/dist/controls/pane/map-pane.js +5 -0
- package/views/dist/controls/picker/map-fields-body.d.ts +2 -2
- package/views/dist/controls/picker/map-fields-body.js +30 -2
- package/views/dist/controls/picker/map-picker.d.ts +8 -3
- package/views/dist/controls/picker/map-picker.js +14 -3
- package/views/dist/controls/picker/picker.js +11 -8
- package/views/dist/controls/picker/rows.d.ts +7 -2
- package/views/dist/controls/picker.css +10 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +2 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +9 -4
- package/views/dist/controls/quick-filters/quick-filters.js +8 -6
- package/views/dist/controls/quick-filters/reminder.js +2 -2
- package/views/dist/controls/quick-filters/rules.d.ts +4 -1
- package/views/dist/controls/quick-filters/words.d.ts +2 -0
- package/views/dist/controls/quick-filters/words.js +1 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +9 -3
- package/views/dist/controls/setting-row/looks.js +5 -5
- package/views/dist/controls/setting-row/setting-row.d.ts +3 -1
- package/views/dist/controls/setting-row/setting-row.js +3 -1
- package/views/dist/controls/setting-row.css +3 -2
- package/views/dist/controls/sheet/bottom-sheet.d.ts +3 -1
- package/views/dist/controls/sheet/bottom-sheet.js +2 -2
- package/views/dist/controls/sort-editor/map-sort-body.js +4 -4
- package/views/dist/controls/sort-editor/sort-editor.d.ts +2 -0
- package/views/dist/controls/sort-editor/sort-editor.js +4 -5
- package/views/dist/controls/text-editor/map-text-body.js +5 -1
- package/views/dist/controls/text-editor/text-editor.js +5 -4
- package/views/dist/controls/toolbar/toolbar.d.ts +29 -14
- package/views/dist/controls/toolbar/toolbar.js +17 -22
- package/views/dist/controls/toolbar.css +0 -5
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +4 -2
- package/views/dist/controls/values-editor/map-values-body.d.ts +1 -2
- package/views/dist/controls/values-editor/map-values-body.js +5 -1
- package/views/dist/controls/values-editor/values-editor.js +8 -7
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -2
- package/views/dist/controls/views-list/map-view-menu.js +6 -2
- package/views/dist/controls/views-list/map-views-list-body.d.ts +2 -1
- package/views/dist/controls/views-list/map-views-list-body.js +6 -5
- package/views/dist/controls/views-list/view-menu.js +3 -4
- package/views/dist/controls/views-list/views-list.js +2 -2
- package/views/dist/display/option-badges.d.ts +16 -0
- package/views/dist/display/option-badges.js +11 -0
- package/views/dist/display/relation-link.d.ts +12 -0
- package/views/dist/display/relation-link.js +17 -0
- package/views/dist/display/relation.d.ts +1 -1
- package/views/dist/display/relation.js +10 -3
- package/views/dist/display/select.js +1 -8
- package/views/dist/editors/EditorPanel.js +4 -4
- package/views/dist/editors/RangeEditor.d.ts +3 -0
- package/views/dist/editors/RangeEditor.js +2 -2
- package/views/dist/editors/SelectEditor.d.ts +2 -2
- package/views/dist/editors/SelectEditor.js +1 -1
- package/views/dist/editors/TextEditor.js +4 -2
- package/views/dist/editors/ValueListEditor.js +2 -1
- package/views/dist/field-row/FieldRow.js +32 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +2 -1
- package/views/dist/grid/chrome/GridAddColumn.js +9 -6
- package/views/dist/grid/chrome/GridCellEditors.js +1 -1
- package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -1
- package/views/dist/grid/chrome/GridCellOutline.js +16 -6
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +7 -4
- package/views/dist/grid/chrome/GridFooter.d.ts +4 -1
- package/views/dist/grid/chrome/GridFooter.js +4 -4
- package/views/dist/grid/chrome/GridGroupMenu.js +39 -14
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -1
- package/views/dist/grid/chrome/GridHeader.js +1 -2
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +4 -1
- package/views/dist/grid/chrome/GridRangeEditor.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +5 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +4 -1
- package/views/dist/grid/chrome/GridRowActions.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +3 -2
- package/views/dist/grid/chrome/GridStructure.js +1 -1
- package/views/dist/grid/chrome/GridTable.js +32 -20
- package/views/dist/grid/chrome/checks.d.ts +1 -1
- package/views/dist/grid/chrome/checks.js +4 -1
- package/views/dist/grid/chrome/grid-cell-classes.d.ts +6 -2
- package/views/dist/grid/chrome/grid-cell-classes.js +10 -5
- package/views/dist/grid/chrome/grid-hover.d.ts +10 -2
- package/views/dist/grid/chrome/grid-hover.js +14 -4
- package/views/dist/grid/chrome/grid-row-props.d.ts +4 -0
- package/views/dist/grid/chrome/grid-rows-menu.js +9 -4
- package/views/dist/grid/chrome/grid-table-props.d.ts +10 -2
- package/views/dist/grid/grid.css +6 -0
- package/views/dist/grid/looks.d.ts +3 -1
- package/views/dist/grid/looks.js +10 -4
- package/views/dist/list/layer.d.ts +8 -0
- package/views/dist/list/layer.js +7 -0
- package/views/dist/list/list.d.ts +6 -2
- package/views/dist/list/list.js +6 -2
- package/views/dist/list/parts.js +3 -2
- package/views/dist/list/store.d.ts +1 -1
- package/views/dist/list/toolbar.js +51 -20
- package/views/dist/list/views.js +1 -0
- package/views/dist/panels/availability.d.ts +5 -0
- package/views/dist/panels/availability.js +4 -5
- package/views/dist/panels/customize-body.d.ts +4 -0
- package/views/dist/panels/customize-body.js +13 -11
- package/views/dist/panels/model.d.ts +9 -4
- package/views/dist/panels/react/customize-body.js +5 -2
- package/views/dist/panels/react/customize.d.ts +5 -0
- package/views/dist/panels/react/filter/FilterEditor.d.ts +6 -0
- package/views/dist/panels/react/filter/FilterEditor.js +7 -0
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +3 -1
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +7 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +17 -1
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +15 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +24 -9
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +3 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +14 -6
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +7 -3
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +21 -10
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +5 -4
- package/views/dist/panels/react/toolbar/ToolbarSort.d.ts +7 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +6 -3
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +3 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +7 -6
- package/views/dist/panels/react/toolbar/context.d.ts +21 -0
- package/views/dist/panels/react/toolbar/context.js +4 -0
- package/views/dist/panels/react/toolbar/pane-host.d.ts +6 -0
- package/views/dist/panels/react/toolbar/pane-host.js +17 -0
- package/views/dist/panels/react/toolbar/panel-part.js +3 -2
- package/views/dist/panels/react/views-row/ViewPicker.js +13 -5
- package/views/dist/panels/react.d.ts +2 -2
- package/views/dist/panels/settings/layout.js +6 -38
- package/views/dist/panels/toolbar/page-resets.d.ts +17 -0
- package/views/dist/panels/toolbar/page-resets.js +62 -0
- package/views/dist/panels/toolbar/same-item.d.ts +7 -0
- package/views/dist/panels/toolbar/same-item.js +9 -0
- package/views/dist/panels/view-state.d.ts +4 -0
- package/views/dist/provider/ViewsProvider.d.ts +9 -3
- package/views/dist/provider/ViewsProvider.js +13 -2
- package/views/dist/provider/components.d.ts +59 -8
- package/views/dist/provider/components.js +1 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/styles.css +194 -100
- package/views/dist/styles.unlayered.css +194 -100
- package/views/docs/contract.md +96 -27
- package/views/docs/controls/alert-dialog.md +4 -0
- package/views/docs/controls/alert.md +4 -0
- package/views/docs/controls/avatar.md +3 -0
- package/views/docs/controls/bulk-bar.md +7 -1
- package/views/docs/controls/compound-editor.md +2 -0
- package/views/docs/controls/customize.md +3 -1
- package/views/docs/controls/date-editor.md +2 -0
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/group-editor.md +2 -0
- package/views/docs/controls/links-editor.md +2 -0
- package/views/docs/controls/menu.md +3 -1
- package/views/docs/controls/modal.md +4 -0
- package/views/docs/controls/number-editor.md +2 -0
- package/views/docs/controls/pane.md +1 -1
- package/views/docs/controls/picker.md +2 -0
- package/views/docs/controls/quick-filters.md +4 -2
- package/views/docs/controls/sheet.md +1 -1
- package/views/docs/controls/text-editor.md +3 -1
- package/views/docs/controls/toolbar.md +4 -0
- package/views/docs/controls/values-editor.md +2 -0
- package/views/docs/controls/views-list.md +2 -0
- package/views/docs/guides/atoms.md +54 -3
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/looks.md +1 -1
- package/views/docs/guides/the-grid.md +4 -2
- package/views/docs/guides/the-provider.md +4 -4
- package/views/docs/index.md +2 -2
- package/views/docs/install.md +198 -104
- package/views/docs/reference/controls.md +21 -17
- package/views/docs/reference/editors-range.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +2 -1
- package/views/docs/reference/list.md +7 -5
- package/views/docs/reference/looks.md +6 -6
- package/views/docs/reference/panels-react.md +17 -15
- package/views/docs/reference/panels.md +4 -4
- package/views/docs/reference/react.md +15 -12
- package/views/docs/reference/views.md +6 -4
- package/views/docs/reshaping.md +32 -5
- package/views/skills/views/SKILL.md +3 -3
|
@@ -12,6 +12,8 @@ export type SortEditorOpens = {
|
|
|
12
12
|
export interface SortEditorProps {
|
|
13
13
|
/** 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
14
|
label: string;
|
|
15
|
+
/** Clear all at its foot; default on. Off inside Customize, where its page's Reset stands in its place (VK-1034). */
|
|
16
|
+
clearAll?: boolean;
|
|
15
17
|
/** 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
18
|
fields: PickerItem[];
|
|
17
19
|
/** The view's rules, the first sorting first. */
|
|
@@ -10,7 +10,6 @@ import { moved, useReorder } from "../internal/reorder.js";
|
|
|
10
10
|
import { useStepReturn } from "../internal/step-return.js";
|
|
11
11
|
import { Picker, usePicker } from "../picker/picker.js";
|
|
12
12
|
import { findItem, itemLabel } from "../picker/rows.js";
|
|
13
|
-
import { Tooltip } from "../tooltip/tooltip.js";
|
|
14
13
|
import { addSort, canAddSort, dropAside, openPlaces, putBack, repoint, SORT_MAX, takenBy } from "./rules.js";
|
|
15
14
|
import { sortWords } from "./words.js";
|
|
16
15
|
const ASCENDING = ["M4 6l7 0", "M4 12l7 0", "M4 18l9 0", "M15 9l3 -3l3 3", "M18 6l0 12"];
|
|
@@ -30,8 +29,8 @@ function fieldsFor(fields, rules, sorted, own, fieldOf) {
|
|
|
30
29
|
}
|
|
31
30
|
export const sortableFields = (fields, rules, fieldOf, sorted = sortWords().sorted) => fieldsFor(fields, rules, sorted, undefined, fieldOf);
|
|
32
31
|
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();
|
|
32
|
+
const { label, fields, rules, onRulesChange, max = SORT_MAX, onDone, opens, fieldOf, addSort: adds = true, clearAll: clears = true } = props;
|
|
33
|
+
const { Button, Select, Menu, Popover, Tooltip } = usePanelControls();
|
|
35
34
|
const aside = React.useMemo(() => props.aside ?? [], [props.aside]);
|
|
36
35
|
const w = sortWords(props.words), search = props.search ?? w.search, DIRECTIONS = directionsOf(w);
|
|
37
36
|
const words = w.picker ? { words: w.picker } : {};
|
|
@@ -157,7 +156,7 @@ export function useSortEditor(props) {
|
|
|
157
156
|
const popAside = pop?.list === "repoint" ? aside.find((a) => a.key === pop.key) : undefined;
|
|
158
157
|
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
158
|
? _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)
|
|
159
|
+
: _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
160
|
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
161
|
? addPicker
|
|
163
162
|
: 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 +168,7 @@ export function useSortEditor(props) {
|
|
|
169
168
|
const items = pickable(r.field);
|
|
170
169
|
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
170
|
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)
|
|
171
|
+
}), 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
172
|
onDone?.(); }, children: w.clearAllSorts })] }), _jsx(Popover, { open: pop?.list === "add", onOpenChange: (o) => { if (!o)
|
|
174
173
|
closePop(); }, anchor: pop?.at, className: "o-sort-editor-pop", "aria-label": w.add, children: pop?.list === "add" && addPicker })] }) }));
|
|
175
174
|
return { body, head: {} };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { resolveViewsMessage } from "../../contract.js";
|
|
5
5
|
import { ViewsContext } from "../../provider/context.js";
|
|
6
6
|
import { pickerWordsOf } from "../picker/map-picker.js";
|
|
7
7
|
import { useToldStep } from "../internal/told-step.js";
|
|
8
8
|
import { useTextEditor } from "./text-editor.js";
|
|
9
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
9
10
|
export function textEditorPropsOf({ label, kind, paragraph, value, onValueChange, onDone, check, region, autoFocus, form, place }) {
|
|
10
11
|
const as = paragraph || kind === "rich_text" ? "long" : kind === "url" ? "link" : kind;
|
|
11
12
|
return { label, kind: as, value, onValueChange, onDone, check, autoFocus, form, ...(place ? { place } : {}), draft: "shell", ...(region ? { country: region } : {}) };
|
|
@@ -14,6 +15,9 @@ export function textEditorWordsOf(say) {
|
|
|
14
15
|
return { country: say({ key: "views.editors.place-country" }), searchCountry: say({ key: "views.editors.place-country-search" }), picker: pickerWordsOf(say) };
|
|
15
16
|
}
|
|
16
17
|
export function MapTextBody(props) {
|
|
18
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(TextBodyInner, { ...props }) });
|
|
19
|
+
}
|
|
20
|
+
function TextBodyInner(props) {
|
|
17
21
|
const views = React.useContext(ViewsContext), messages = views?.messages ?? resolveViewsMessage;
|
|
18
22
|
const words = React.useMemo(() => textEditorWordsOf(messages), [messages]);
|
|
19
23
|
const parts = useTextEditor({ ...textEditorPropsOf(props), words, ...(views ? { language: views.conventions.language } : {}) });
|
|
@@ -2,9 +2,8 @@
|
|
|
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 { Field } from "../field/field.js";
|
|
5
|
-
import {
|
|
5
|
+
import { InputGroup, InputGroupAddon } from "../input/input.js";
|
|
6
6
|
import { InlineInput, InlineInputGroup } from "../inline-input/inline-input.js";
|
|
7
|
-
import { Popover } from "../popover/popover.js";
|
|
8
7
|
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
9
8
|
import { drawnAt } from "../internal/scroll.js";
|
|
10
9
|
import { spacingPx } from "../internal/read-token.js";
|
|
@@ -15,6 +14,7 @@ import { TEXT_EDITOR_ATTRS, textEditorWornOf } from "./looks.js";
|
|
|
15
14
|
import { Countries } from "./countries.js";
|
|
16
15
|
import { textWords } from "./words.js";
|
|
17
16
|
import { keepTypedRun } from "../internal/typed-run.js";
|
|
17
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
18
18
|
const COUNTRY = { edge: "none", corner: "round", radius: "sm", words: "inherit", colour: "text", pad: "6-4", gap: "3", icon: "14", iconColour: "subtle", hover: "neutral", open: "neutral" };
|
|
19
19
|
const glyph = (paths) => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths.map((d) => _jsx("path", { d: d }, d)) }));
|
|
20
20
|
const X = ["M18 6l-12 12", "M6 6l12 12"], TICK = ["M5 12l5 5l10 -10"], DOWN = ["M6 9l6 6l6 -6"];
|
|
@@ -39,6 +39,7 @@ function useWorn(el) {
|
|
|
39
39
|
return worn;
|
|
40
40
|
}
|
|
41
41
|
export function useTextEditor(props) {
|
|
42
|
+
const { Input, GroupButton, Popover } = usePanelControls();
|
|
42
43
|
const { label, kind = "text", value, onValueChange, onDone, check, placeholder, typed, tried = false, autoFocus = true } = props;
|
|
43
44
|
const w = textWords(props.words), language = props.language ?? "en";
|
|
44
45
|
const host = React.useContext(PhoneHost), small = usePhone();
|
|
@@ -232,7 +233,7 @@ export function useTextEditor(props) {
|
|
|
232
233
|
}, [root, form, place, draft, worn.box, worn.long, worn.phone, kind, long, shown]);
|
|
233
234
|
if (form === "phone") {
|
|
234
235
|
const step = withCountry && open;
|
|
235
|
-
const field = withCountry ? (_jsxs(InputGroup, { size: "lg", "data-slot": "vk-text-box", children: [_jsxs(InputGroupAddon, { side: "start", children: [_jsx(
|
|
236
|
+
const field = withCountry ? (_jsxs(InputGroup, { size: "lg", "data-slot": "vk-text-box", children: [_jsxs(InputGroupAddon, { side: "start", children: [_jsx(GroupButton, { className: "o-text-editor-country", "data-slot": "vk-text-country", "aria-label": `${w.country}: ${countryName(phone.country, language)}`, iconEnd: glyph(DOWN), onClick: () => setOpen(true), children: _jsx("span", { className: "o-text-editor-country-code", children: phone.country }) }), _jsx("span", { className: "o-text-editor-dial", "data-slot": "vk-text-dial", children: dialOf(phone.country) })] }), _jsx(Input, { ref: number, autofill: false, type: "tel", inputMode: "tel", enterKeyHint: "done", value: phone.digits, ...common, placeholder: patternOf(phone.country), spellCheck: false, onChange: (e) => movePhone({ digits: e.target.value }), onKeyDown: onKeyDown })] })) : (_jsx(Input, { ref: box, size: "lg", "data-slot": "vk-text-box", autofill: false, multiline: long || kind === "text", grow: long || kind === "text", className: long ? "o-text-editor-tall" : undefined, type: long || kind === "text" ? undefined : keys.type, inputMode: keys.inputMode, enterKeyHint: long ? undefined : "done", value: draft, ...common, onChange: change, onKeyDown: long ? undefined : onKeyDown }));
|
|
236
237
|
const body = (_jsx("div", { ref: placeRoot, className: "o-text-editor", "data-slot": "vk-text", "data-kit": "text-editor", "data-text-form": "phone", ...phoneMark(!!host || small), "data-text-kind": kind, "data-text-view": step ? "country" : undefined, children: step ? countriesList : _jsx(Field, { error: refused ?? undefined, children: field }) }));
|
|
237
238
|
if (step)
|
|
238
239
|
return { body, head: { onBack: () => setOpen(false), backSlot: "vk-editor-back", close: false }, title: w.country };
|
|
@@ -253,7 +254,7 @@ export function useTextEditor(props) {
|
|
|
253
254
|
keep();
|
|
254
255
|
};
|
|
255
256
|
const note = refused && _jsxs("div", { className: "o-text-editor-note", "data-slot": "vk-text-note", id: noteId, role: "alert", children: [glyph(["M12 8v5", "M12 16.5v.01", "M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"]), _jsx("span", { children: refused })] });
|
|
256
|
-
const body = (_jsxs("div", { ref: placeRoot, className: "o-text-editor", "data-slot": "vk-text", "data-kit": "text-editor", "data-text-form": "computer", ...phoneMark(!!host || small), "data-text-kind": kind, "data-text-box": worn.box, "data-text-place": place, "data-refused": refused ? "" : undefined, onBlur: blur, children: [withCountry ? _jsxs(_Fragment, { children: [_jsxs(InlineInputGroup, { className: "o-text-editor-phone", "data-slot": "vk-text-box", "data-refused": refused ? "" : undefined, children: [_jsx(InputGroupAddon, { side: "start", children: _jsx(
|
|
257
|
+
const body = (_jsxs("div", { ref: placeRoot, className: "o-text-editor", "data-slot": "vk-text", "data-kit": "text-editor", "data-text-form": "computer", ...phoneMark(!!host || small), "data-text-kind": kind, "data-text-box": worn.box, "data-text-place": place, "data-refused": refused ? "" : undefined, onBlur: blur, children: [withCountry ? _jsxs(_Fragment, { children: [_jsxs(InlineInputGroup, { className: "o-text-editor-phone", "data-slot": "vk-text-box", "data-refused": refused ? "" : undefined, children: [_jsx(InputGroupAddon, { side: "start", children: _jsx(GroupButton, { className: "o-text-editor-country", "data-slot": "vk-text-country", look: COUNTRY, "aria-label": `${w.country}: ${countryName(phone.country, language)}`, "aria-haspopup": "listbox", "aria-expanded": open, iconEnd: glyph(DOWN), onClick: () => setOpen((o) => !o), children: _jsx("span", { className: "o-text-editor-country-code", children: phone.country }) }) }), _jsx(InputGroupAddon, { side: "start", children: _jsx("span", { className: "o-text-editor-dial", "data-slot": "vk-text-dial", children: dialOf(phone.country) }) }), _jsx(Input, { ref: number, className: "o-text-editor-number", type: "tel", inputMode: "tel", enterKeyHint: "done", value: phone.digits, ...common, autofill: false, placeholder: patternOf(phone.country), spellCheck: false, onChange: (e) => movePhone({ digits: e.target.value }), onKeyDown: onKeyDown, "aria-invalid": refused ? true : undefined, "aria-describedby": refused ? noteId : undefined })] }), _jsx(Popover, { open: open, onOpenChange: (o, d) => {
|
|
257
258
|
setOpen(o);
|
|
258
259
|
if (shell)
|
|
259
260
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
3
3
|
import { type InputProps } from "../input/input.js";
|
|
4
|
-
import { type
|
|
4
|
+
import { type ToolbarButtonProps } from "../toolbar-button/toolbar-button.js";
|
|
5
5
|
import { type ToolbarPicks } from "./looks.js";
|
|
6
6
|
import { type ToolbarWords } from "./words.js";
|
|
7
7
|
/** Where a list's part stands: on the row (where it begins), on the row's right, on the filter bar, or on a phone's one line. */
|
|
@@ -57,13 +57,16 @@ export interface ToolbarProps extends Omit<BaseToolbar.Root.Props, "className" |
|
|
|
57
57
|
spacing?: number;
|
|
58
58
|
/** Whether what doesn't fit gives way (words to icons, then into ⋯); otherwise it runs past its end. */
|
|
59
59
|
fold?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
*
|
|
62
|
-
* it
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
|
|
60
|
+
/** ⋯ as the app draws it, where what doesn't fit folds (VK-1031): `icon`, its glyph over ViewKit's dots; `className`, put on
|
|
61
|
+
* it; `button`, the app's own button drawn in place of the Toolbar button, handed the very props it would get (`ref`, and what
|
|
62
|
+
* its Menu sets to open from it, included): spread them on your button. Absent, ViewKit's own ⋯. */
|
|
63
|
+
overflow?: ToolbarOverflowControl;
|
|
64
|
+
/** "+N" on the view tabs as the app draws it (VK-1037): `className`, put on it; `button`, the app's own button drawn in place of
|
|
65
|
+
* the Toolbar button, handed the very props it would get (`ref`, its words, and what its Menu, or `onMoreViews`, sets to open
|
|
66
|
+
* from it, included): spread them on your button. Absent, ViewKit's own "+N". */
|
|
67
|
+
moreViews?: ToolbarMoreControl;
|
|
68
|
+
/** "+N filters" as the app draws it, the same way as `moreViews` (VK-1037). Absent, ViewKit's own. */
|
|
69
|
+
moreFilters?: ToolbarMoreControl;
|
|
67
70
|
/** Holds every line as it stands, giving way no further and taking no step back: while what a folded item opened stands open
|
|
68
71
|
* under the button that holds it ("+N filters", ⋯), so that button keeps its place (KIT-624). */
|
|
69
72
|
holds?: boolean;
|
|
@@ -77,6 +80,17 @@ export interface ToolbarProps extends Omit<BaseToolbar.Root.Props, "className" |
|
|
|
77
80
|
className?: string;
|
|
78
81
|
style?: React.CSSProperties;
|
|
79
82
|
}
|
|
83
|
+
/** ⋯ as the app draws it: its glyph, its class, or its whole button, handed a Toolbar button's props. */
|
|
84
|
+
export type ToolbarOverflowControl = {
|
|
85
|
+
icon?: React.ReactNode;
|
|
86
|
+
className?: string;
|
|
87
|
+
button?: React.ComponentType<ToolbarButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
88
|
+
};
|
|
89
|
+
/** "+N" or "+N filters" as the app draws it: its class, or its whole button, handed a Toolbar button's props (VK-1037). */
|
|
90
|
+
export type ToolbarMoreControl = {
|
|
91
|
+
className?: string;
|
|
92
|
+
button?: React.ComponentType<ToolbarButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
93
|
+
};
|
|
80
94
|
type Step = {
|
|
81
95
|
i: number;
|
|
82
96
|
to: "icon" | "fold";
|
|
@@ -94,16 +108,17 @@ export interface ToolbarFoldsProps {
|
|
|
94
108
|
export declare function ToolbarFolds({ children }: ToolbarFoldsProps): React.ReactNode;
|
|
95
109
|
/** The steps a line takes as it narrows, in order: words to icons from its end; then the view tabs fold into "+N" from their end,
|
|
96
110
|
* the views giving way before the tools, as the portal's row does; then the filters fold into "+N filters" from their end, only
|
|
97
|
-
* once nothing else gives words up (KIT-624); then the rest folds into ⋯ from its end.
|
|
98
|
-
|
|
99
|
-
declare function stepsOf(items: React.ReactElement[], fill?: boolean): Step[];
|
|
111
|
+
* once nothing else gives words up (KIT-624); then the rest folds into ⋯ from its end. */
|
|
112
|
+
declare function stepsOf(items: React.ReactElement[]): Step[];
|
|
100
113
|
/** The steps a line takes as it narrows, for a test (stepsOf). */
|
|
101
114
|
export declare const toolbarSteps: typeof stepsOf;
|
|
102
115
|
/** The row and, under it, the filter bar: Base UI's toolbar, one Tab stop for the whole of it, the arrows inside. */
|
|
103
|
-
export declare function ToolbarControl({ label, children, bar, barLabel: barNamed, words: given, views, settings, search, add, sort, filter, filters, save, quick, added, picks: said, size, barSize, spacing, fold,
|
|
104
|
-
/** A line between what belongs together and what doesn't, across a line.
|
|
105
|
-
|
|
116
|
+
export declare function ToolbarControl({ label, children, bar, barLabel: barNamed, words: given, views, settings, search, add, sort, filter, filters, save, quick, added, picks: said, size, barSize, spacing, fold, overflow, moreViews: ownViews, moreFilters: ownFilters, holds, form, onMoreViews, moreViewsOpen, className, style, onKeyDown, ...props }: ToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
117
|
+
/** A line between what belongs together and what doesn't, across a line. `data-slot`, its public name where a part names it
|
|
118
|
+
* (VK-1023: the bulk bar's `vk-bulk-separator`). */
|
|
119
|
+
export declare function ToolbarSeparatorControl({ className, "data-slot": slot }: {
|
|
106
120
|
className?: string;
|
|
121
|
+
"data-slot"?: string;
|
|
107
122
|
}): import("react/jsx-runtime").JSX.Element;
|
|
108
123
|
/** Room that pushes what follows it to its line's far end (New, at the end of the row). */
|
|
109
124
|
export declare function ToolbarSpacer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,6 +7,7 @@ import { cx as cn } from "../../internal/cx.js";
|
|
|
7
7
|
import { Button, ButtonGroup } from "../button/button.js";
|
|
8
8
|
import { Input, InputGroup, InputGroupAddon, InputGroupButton } from "../input/input.js";
|
|
9
9
|
import { Icon } from "../internal/icons.js";
|
|
10
|
+
import { isAppButton } from "../internal/panel-controls.js";
|
|
10
11
|
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
11
12
|
import { watchFrame } from "../internal/watch-frame.js";
|
|
12
13
|
import { Menu } from "../menu/menu.js";
|
|
@@ -42,7 +43,7 @@ const isFolds = (el) => el.type === ToolbarFolds;
|
|
|
42
43
|
export function ToolbarFolds({ children }) {
|
|
43
44
|
return children(0);
|
|
44
45
|
}
|
|
45
|
-
const isButton = (el) => el.type === Button;
|
|
46
|
+
const isButton = (el) => el.type === Button || isAppButton(el.type);
|
|
46
47
|
const words = (n) => (typeof n === "string" || typeof n === "number" ? String(n) : null);
|
|
47
48
|
const flat = (nodes) => React.Children.toArray(nodes).flatMap((n) => !React.isValidElement(n) ? [] : n.type === React.Fragment ? flat(n.props.children) : [n]);
|
|
48
49
|
const itemsOf = (nodes, line) => {
|
|
@@ -62,14 +63,12 @@ const isJoined = (el) => isGroup(el) && !!el.props["aria-label"] && flat(el.prop
|
|
|
62
63
|
const folds = (el) => (isToolbarButton(el) && !el.props.stays)
|
|
63
64
|
|| (isJoined(el) && el.props["data-open"] == null);
|
|
64
65
|
const isFilter = (el) => !!el && (isJoined(el) || (isToolbarButton(el) && !!el.props.filter));
|
|
65
|
-
function stepsOf(items
|
|
66
|
-
const
|
|
67
|
-
const from = (test, to) => items.flatMap((el, i) => (i !== lead && test(el) ? [{ i, to }] : [])).reverse();
|
|
66
|
+
function stepsOf(items) {
|
|
67
|
+
const from = (test, to) => items.flatMap((el, i) => (test(el) ? [{ i, to }] : [])).reverse();
|
|
68
68
|
const held = (kind) => (el, i) => isFolds(el) && el.props.kind === kind ? Array.from({ length: Math.max(0, el.props.count) }, () => ({ i, to: "fold" })) : [];
|
|
69
69
|
const fromWith = (test, kind) => items.flatMap((el, i) => (test(el) ? [{ i, to: "fold" }] : held(kind)(el, i))).reverse();
|
|
70
|
-
const last = lead < 0 ? [] : [{ i: lead, to: "icon" }, ...(folds(items[lead]) ? [{ i: lead, to: "fold" }] : [])];
|
|
71
70
|
return [...from(sheds, "icon"), ...fromWith((el) => folds(el) && isTab(el), "tabs"), ...fromWith((el) => folds(el) && isFilter(el), "filters"),
|
|
72
|
-
...from((el) => folds(el) && !isTab(el) && !isFilter(el), "fold")
|
|
71
|
+
...from((el) => folds(el) && !isTab(el) && !isFilter(el), "fold")];
|
|
73
72
|
}
|
|
74
73
|
export const toolbarSteps = stepsOf;
|
|
75
74
|
function overflows(line) {
|
|
@@ -158,7 +157,7 @@ function useGiveWay(line, max, on, holds = false) {
|
|
|
158
157
|
}, [line, on, look]);
|
|
159
158
|
return stage;
|
|
160
159
|
}
|
|
161
|
-
export function ToolbarControl({ label, children, bar, barLabel: barNamed, words: given, views, settings, search, add, sort, filter, filters, save, quick, added = false, picks: said, size, barSize, spacing, fold = true,
|
|
160
|
+
export function ToolbarControl({ label, children, bar, barLabel: barNamed, words: given, views, settings, search, add, sort, filter, filters, save, quick, added = false, picks: said, size, barSize, spacing, fold = true, overflow, moreViews: ownViews, moreFilters: ownFilters, holds = false, form, onMoreViews, moreViewsOpen, className, style, onKeyDown, ...props }) {
|
|
162
161
|
const spoken = toolbarWords(given), barLabel = barNamed ?? spoken.bar;
|
|
163
162
|
const host = React.useContext(PhoneHost), narrow = usePhone();
|
|
164
163
|
const phone = form ? form === "phone" : host != null || narrow;
|
|
@@ -227,7 +226,7 @@ export function ToolbarControl({ label, children, bar, barLabel: barNamed, words
|
|
|
227
226
|
e.preventDefault();
|
|
228
227
|
to.focus();
|
|
229
228
|
};
|
|
230
|
-
return (_jsx(BaseToolbar.Root, { ref: setRoot, "aria-label": label, orientation: "horizontal", className: cn("o-toolbar", className), "data-kit": "toolbar", "data-screen": phone ? "phone" : "computer", "data-size": height, "data-lines": listed && !phone ? picks.lines : undefined,
|
|
229
|
+
return (_jsx(BaseToolbar.Root, { ref: setRoot, "aria-label": label, orientation: "horizontal", className: cn("o-toolbar", className), "data-kit": "toolbar", "data-screen": phone ? "phone" : "computer", "data-size": height, "data-lines": listed && !phone ? picks.lines : undefined, style: spacing != null ? { ...style, "--toolbar-spacing": spacing } : style, onKeyDown: ends, ...props, children: _jsx(Said.Provider, { value: spoken, children: lines.map((l) => (_jsx(InToolbar.Provider, { value: { size: l.size, form: phone ? "phone" : "computer" }, children: _jsx(Line, { id: l.id, label: l.label, items: l.items, size: l.size, fold: fold, overflow: overflow, own: { views: ownViews, filters: ownFilters }, holds: holds, more: onMoreViews ? { press: onMoreViews, open: !!moreViewsOpen } : undefined }) }, l.id))) }) }));
|
|
231
230
|
}
|
|
232
231
|
function dressNew(el, form, ground) {
|
|
233
232
|
if (!isButton(el))
|
|
@@ -236,10 +235,10 @@ function dressNew(el, form, ground) {
|
|
|
236
235
|
const kind = form.startsWith("primary") ? "primary" : form.startsWith("outline") ? "outline" : KIND_OF_GROUND[ground];
|
|
237
236
|
return React.cloneElement(el, { kind, ...(form.endsWith("-icon") ? { shape: "icon", children: undefined, "aria-label": p["aria-label"] ?? said ?? undefined } : {}) });
|
|
238
237
|
}
|
|
239
|
-
function Line({ id, label, items, size, fold,
|
|
238
|
+
function Line({ id, label, items, size, fold, overflow, own, holds, more: moreViews }) {
|
|
240
239
|
const [line, setLine] = React.useState(null);
|
|
241
240
|
const said = React.useContext(Said);
|
|
242
|
-
const steps = fold ? stepsOf(items
|
|
241
|
+
const steps = fold ? stepsOf(items) : [];
|
|
243
242
|
const stage = useGiveWay(line, steps.length, fold, holds);
|
|
244
243
|
const iconAlone = new Set(), folded = new Set(), foldedIn = new Map();
|
|
245
244
|
for (const s of steps.slice(0, stage)) {
|
|
@@ -263,22 +262,20 @@ function Line({ id, label, items, size, fold, fill, entries, holds, more: moreVi
|
|
|
263
262
|
return [{ icon: p.icon ?? null, label: words(p.children) ?? p.label, count: p.count, disabled: p.disabled ? said.cantUse : undefined,
|
|
264
263
|
onSelect: () => pressAt(p.onClick, line?.querySelector(at)) }];
|
|
265
264
|
};
|
|
266
|
-
const
|
|
267
|
-
const
|
|
268
|
-
? [...[...otherFolded].sort((a, b) => a - b).flatMap((i) => entryOf(items[i], "[data-more]")), ...entries]
|
|
269
|
-
: otherFolded.flatMap((i) => entryOf(items[i], "[data-more]"));
|
|
270
|
-
const more = (_jsx(Menu, { label: said.moreOf(label), align: "end", entries: moreEntries, trigger: _jsx(ToolbarButton, { label: said.more, icon: _jsx(Icon, { name: "dots" }), words: "icon", stays: true, "data-more": "" }) }, "more"));
|
|
265
|
+
const Dots = overflow?.button ?? ToolbarButton;
|
|
266
|
+
const more = (_jsx(Menu, { label: said.moreOf(label), align: "end", entries: otherFolded.flatMap((i) => entryOf(items[i], "[data-more]")), trigger: _jsx(Dots, { label: said.more, icon: overflow?.icon ?? _jsx(Icon, { name: "dots" }), words: "icon", stays: true, "data-more": "", ...(overflow?.className && { className: overflow.className }) }) }, "more"));
|
|
271
267
|
const firstTab = items.find(isTab);
|
|
272
|
-
const
|
|
268
|
+
const Plus = own.views?.button ?? ToolbarButton, MoreFilters = own.filters?.button ?? ToolbarButton;
|
|
269
|
+
const plusN = (p = {}) => (_jsx(Plus, { label: said.moreViews(tabFolded.length), words: "word", current: false, stays: true, "data-more-tabs": "", ground: firstTab?.props.ground, corners: firstTab?.props.corners, ...(own.views?.className && { className: own.views.className }), ...p, children: `+${tabFolded.length}` }, "more-tabs"));
|
|
273
270
|
const moreTabs = !tabFolded.length ? null : moreViews
|
|
274
271
|
? plusN({ "aria-haspopup": "dialog", "aria-expanded": moreViews.open, onClick: (e) => moreViews.press(e.currentTarget) })
|
|
275
272
|
: _jsx(Menu, { label: said.moreViewsOf(label), align: "start", entries: tabFolded.flatMap((i) => entryOf(items[i], "[data-more-tabs]")), trigger: plusN() }, "more-tabs");
|
|
276
273
|
const n = filterFolded.length;
|
|
277
|
-
const moreFilters = n ? (_jsx(Menu, { label: said.moreFiltersOf(label), align: "start", entries: filterFolded.flatMap((i) => entryOf(items[i], "[data-more-filters]")), trigger: _jsx(
|
|
274
|
+
const moreFilters = n ? (_jsx(Menu, { label: said.moreFiltersOf(label), align: "start", entries: filterFolded.flatMap((i) => entryOf(items[i], "[data-more-filters]")), trigger: _jsx(MoreFilters, { label: said.moreFiltersName(n), words: "word", ground: "filled", stays: true, "data-more-filters": "", ...(own.filters?.className && { className: own.filters.className }), children: said.moreFilters(n) }) }, "more-filters")) : null;
|
|
278
275
|
const drawn = [];
|
|
279
276
|
items.forEach((el, i) => {
|
|
280
277
|
if (folded.has(i)) {
|
|
281
|
-
if (i === moreAt
|
|
278
|
+
if (i === moreAt)
|
|
282
279
|
drawn.push(more);
|
|
283
280
|
if (i === tabsAt)
|
|
284
281
|
drawn.push(moreTabs);
|
|
@@ -292,8 +289,6 @@ function Line({ id, label, items, size, fold, fill, entries, holds, more: moreVi
|
|
|
292
289
|
}
|
|
293
290
|
drawn.push(dress(el, iconAlone.has(i), size));
|
|
294
291
|
});
|
|
295
|
-
if (always || (given && otherFolded.length > 0))
|
|
296
|
-
drawn.push(more);
|
|
297
292
|
const shown = drawn.filter((n, k) => {
|
|
298
293
|
if (!isSeparator(n))
|
|
299
294
|
return true;
|
|
@@ -340,9 +335,9 @@ function dress(el, alone, height) {
|
|
|
340
335
|
return el;
|
|
341
336
|
}
|
|
342
337
|
const isSeparator = (n) => React.isValidElement(n) && n.type === ToolbarSeparatorControl;
|
|
343
|
-
export function ToolbarSeparatorControl({ className }) {
|
|
338
|
+
export function ToolbarSeparatorControl({ className, "data-slot": slot }) {
|
|
344
339
|
const row = React.useContext(InToolbar);
|
|
345
|
-
return row ? _jsx(BaseToolbar.Separator, { className: cn("o-toolbar-sep", className) }) : _jsx("span", { role: "separator", className: cn("o-toolbar-sep", className) });
|
|
340
|
+
return row ? _jsx(BaseToolbar.Separator, { className: cn("o-toolbar-sep", className), "data-slot": slot }) : _jsx("span", { role: "separator", className: cn("o-toolbar-sep", className), "data-slot": slot });
|
|
346
341
|
}
|
|
347
342
|
export function ToolbarSpacer() {
|
|
348
343
|
return _jsx("span", { className: "o-toolbar-spacer", "aria-hidden": "true" });
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
search on its own line (data-line="search"), above it
|
|
7
7
|
data-screen computer · phone the room between what a line holds; a phone's is one line
|
|
8
8
|
data-lines across · none a list's lines in bands with a line across under each, or not
|
|
9
|
-
data-fill (set) · none its row's worded buttons grow to share it (a record's actions)
|
|
10
9
|
--toolbar-spacing how far apart what a line holds stands, in spacing steps, when what holds it says so
|
|
11
10
|
--toolbar-inset the room at each side of each line, when what holds it gives one (0 unless said)
|
|
12
11
|
|
|
@@ -29,10 +28,6 @@
|
|
|
29
28
|
|
|
30
29
|
/* What a line holds keeps its width; only a text box gives some up, from its own width down to its narrowest. */
|
|
31
30
|
.o-toolbar-line > * { flex: none; }
|
|
32
|
-
/* Filling its row (fill: a record's actions, Attio's way): the row's worded buttons grow from their own width to share the line, their
|
|
33
|
-
words in their middle; a square one (its icon alone) keeps its own. None shrinks under its own width, so what doesn't fit still
|
|
34
|
-
gives way. */
|
|
35
|
-
.o-toolbar[data-fill] > .o-toolbar-line[data-line="row"] > .o-button:not(.o-button-icon, .o-button-round) { flex: 1 0 auto; }
|
|
36
31
|
.o-toolbar-line > :is(.o-toolbar-input, .o-input-group:has(.o-toolbar-input)) { flex: 0 1 calc(var(--vk-spacing) * 55); min-width: calc(var(--vk-spacing) * 30); }
|
|
37
32
|
|
|
38
33
|
/* A list's search: on a phone's line of its own it fills it; open on a phone's one line it takes the room the others left. */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ViewsTooltipProps } from "../../provider/components.js";
|
|
2
2
|
/** ViewKit's tooltip, drawn as the kit's Tooltip: what it names is its child itself, no element round it. */
|
|
3
|
-
export declare function MapTooltip({ content, children, side, align, delayMs, className }: ViewsTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function MapTooltip({ content, children, reason, side, align, delayMs, className }: ViewsTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { markOwnControl } from "../../provider/own-control.js";
|
|
2
3
|
import { Tooltip } from "./tooltip.js";
|
|
3
|
-
export function MapTooltip({ content, children, side, align, delayMs, className }) {
|
|
4
|
-
return _jsx(Tooltip, { label: content, side: side, align: align, delay: delayMs, className: className, children: children });
|
|
4
|
+
export function MapTooltip({ content, children, reason, side, align, delayMs, className }) {
|
|
5
|
+
return _jsx(Tooltip, { label: content, reason: reason, side: side, align: align, delay: delayMs, className: className, children: children });
|
|
5
6
|
}
|
|
7
|
+
markOwnControl(MapTooltip);
|
|
@@ -7,6 +7,5 @@ import type { ValuesEditorWords } from "./words.js";
|
|
|
7
7
|
export declare function valuesEditorWordsOf(say: ViewsMessageResolver): ValuesEditorWords;
|
|
8
8
|
/** ViewKit's values body's props as the Values editor's, held as a shell that keeps the draft. */
|
|
9
9
|
export declare function valuesBodyPropsOf(p: ViewsValuesBodyProps, words?: ValuesEditorWords, language?: string): ValuesEditorProps;
|
|
10
|
-
/** ViewKit's values body,
|
|
11
|
-
* provider (a page drawing the body alone), ViewKit's English. */
|
|
10
|
+
/** ViewKit's values body, its controls the app's where the provider's `panelControls` names them (VK-1022). */
|
|
12
11
|
export declare function MapValuesBody(props: ViewsValuesBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { resolveViewsMessage } from "../../contract.js";
|
|
5
5
|
import { EDITOR_INNER_ESCAPE } from "../../editors/inner-escape.js";
|
|
6
6
|
import { ViewsContext } from "../../provider/context.js";
|
|
7
7
|
import { pickerWordsOf } from "../picker/map-picker.js";
|
|
8
8
|
import { useToldStep } from "../internal/told-step.js";
|
|
9
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
9
10
|
import { useValuesEditor } from "./values-editor.js";
|
|
10
11
|
export function valuesEditorWordsOf(say) {
|
|
11
12
|
return {
|
|
@@ -63,6 +64,9 @@ export function valuesBodyPropsOf(p, words, language) {
|
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
export function MapValuesBody(props) {
|
|
67
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(ValuesBodyInner, { ...props }) });
|
|
68
|
+
}
|
|
69
|
+
function ValuesBodyInner(props) {
|
|
66
70
|
const views = React.useContext(ViewsContext), messages = views?.messages ?? resolveViewsMessage;
|
|
67
71
|
const words = React.useMemo(() => valuesEditorWordsOf(messages), [messages]);
|
|
68
72
|
const parts = useValuesEditor(valuesBodyPropsOf(props, words, views?.conventions.language));
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { Button } from "../button/button.js";
|
|
4
|
+
import { Button as OwnButton } from "../button/button.js";
|
|
5
5
|
import { Picker, usePicker } from "../picker/picker.js";
|
|
6
|
-
import { Popover } from "../popover/popover.js";
|
|
7
6
|
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
8
7
|
import { Flag } from "../flag/flag.js";
|
|
9
8
|
import { phoneMark, usePhoneForm } from "../internal/phone.js";
|
|
@@ -13,7 +12,8 @@ import { VALUES_EDITOR_ATTRS, valuesEditorWornOf } from "./looks.js";
|
|
|
13
12
|
import { added, handedList, labelFor, labelsOf, listOf, openOf, charsThatFit, splitEmail } from "./values.js";
|
|
14
13
|
import { valuesWords } from "./words.js";
|
|
15
14
|
import { FieldRowsRow as FieldRow, FieldRows } from "../field/field.js";
|
|
16
|
-
import {
|
|
15
|
+
import { InputGroupAddon } from "../input/input.js";
|
|
16
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
17
17
|
import { InlineInputGroup } from "../inline-input/inline-input.js";
|
|
18
18
|
import { cx } from "../../internal/cx.js";
|
|
19
19
|
import { moved, useReorder } from "../internal/reorder.js";
|
|
@@ -73,6 +73,7 @@ const countryItems = (language) => {
|
|
|
73
73
|
return countries.get(language);
|
|
74
74
|
};
|
|
75
75
|
export function useValuesEditor(props) {
|
|
76
|
+
const { Button, Popover, Input, GroupButton } = usePanelControls();
|
|
76
77
|
const { label, kind, value, onValueChange, onDone, dialCodes = [], autoFocus = true } = props;
|
|
77
78
|
const one = props.holds === "one", shell = props.draft === "shell";
|
|
78
79
|
const w = valuesWords(props.words), language = props.language ?? "en";
|
|
@@ -222,7 +223,7 @@ export function useValuesEditor(props) {
|
|
|
222
223
|
const lifted = (r, i) => (dragging === i || posed?.id === r.id ? "" : undefined);
|
|
223
224
|
const grip = (r, i, icon, size, look) => {
|
|
224
225
|
const g = gripProps(i);
|
|
225
|
-
return _jsx(
|
|
226
|
+
return _jsx(OwnButton, { kind: "quiet", shape: "icon", size: size, look: look, className: "o-values-editor-grip", "data-slot": "vk-values-grip", "aria-label": w.move(r.value), icon: glyph(icon), ...g, onPointerDown: (e) => { setPosed(null); setMainHeld(rows[0]?.id); g.onPointerDown(e); } });
|
|
226
227
|
};
|
|
227
228
|
const [focusTo, setFocusTo] = React.useState(autoFocus && !phone ? (first.editing != null ? ".o-values-editor-edit input" : props.holds === "one" && first.rows.length ? ROOT : ".o-values-editor-line-input") : null);
|
|
228
229
|
React.useLayoutEffect(() => {
|
|
@@ -316,12 +317,12 @@ export function useValuesEditor(props) {
|
|
|
316
317
|
} };
|
|
317
318
|
const card = (_jsxs(_Fragment, { children: [_jsxs(FieldRows, { look: ATTIO_ROWS, className: "o-values-editor-card", "data-slot": "vk-values-rows", role: "list", "aria-label": label, children: [rows.map((r, i) => {
|
|
318
319
|
const act = openOf(kind, r.value);
|
|
319
|
-
return (_jsxs(React.Fragment, { children: [_jsxs(FieldRow, { as: "div", role: "listitem", className: "o-values-editor-row", "data-slot": "vk-values-row", "data-index": i, "data-row": r.id, "data-lifted": lifted(r, i), style: lift(i), children: [!one && grip(r, i, GRIP, "32x44", { radius: "md", corner: "round", edge: "none", words: "inherit", colour: "faint", cursor: "grab", hover: "none", icon: "16" }), editing === i ? (_jsxs(InlineInputGroup, { className: "o-values-editor-edit", "data-slot": "vk-values-edit", style: ROW_40, children: [_jsx(Input, { "aria-label": w.change(r.value), value: editText, type: keys.type, inputMode: keys.inputMode, autofill: false, autoCapitalize: keys.autoCapitalize, enterKeyHint: "done", onChange: (e) => setEditText(e.target.value), onKeyDown: editKeys }), labels.length > 0 && _jsx(InputGroupAddon, { side: "end", children: _jsx(
|
|
320
|
+
return (_jsxs(React.Fragment, { children: [_jsxs(FieldRow, { as: "div", role: "listitem", className: "o-values-editor-row", "data-slot": "vk-values-row", "data-index": i, "data-row": r.id, "data-lifted": lifted(r, i), style: lift(i), children: [!one && grip(r, i, GRIP, "32x44", { radius: "md", corner: "round", edge: "none", words: "inherit", colour: "faint", cursor: "grab", hover: "none", icon: "16" }), editing === i ? (_jsxs(InlineInputGroup, { className: "o-values-editor-edit", "data-slot": "vk-values-edit", style: ROW_40, children: [_jsx(Input, { "aria-label": w.change(r.value), value: editText, type: keys.type, inputMode: keys.inputMode, autofill: false, autoCapitalize: keys.autoCapitalize, enterKeyHint: "done", onChange: (e) => setEditText(e.target.value), onKeyDown: editKeys }), labels.length > 0 && _jsx(InputGroupAddon, { side: "end", children: _jsx(GroupButton, { className: "o-values-editor-edit-label", "data-slot": "vk-values-label", size: "line", look: { radius: "none", corner: "round", edge: "none", words: "sm", icon: "14", hover: "words" }, "aria-label": w.labelIs(r.label ?? w.noLabel), onClick: () => go("label", i), iconEnd: glyph(DOWN), children: r.label ?? w.label }) })] })) : _jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "o-values-editor-value", "data-slot": "vk-values-value", onClick: () => { if (!finishEdit())
|
|
320
321
|
return; setEditing(i); setEditText(r.value); setFocusTo(".o-values-editor-edit input"); }, children: r.value }), r.label && labels.length > 0 && _jsx("span", { className: "o-values-editor-label", "data-slot": "vk-values-label", children: r.label }), _jsxs("span", { className: "o-values-editor-acts", "data-slot": "vk-values-acts", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "40x44", look: { radius: "md", corner: "round", edge: "none", words: "inherit", icon: "20", hover: "none", press: "card" }, className: "o-values-editor-open", "data-slot": "vk-values-open", nativeButton: false, render: _jsx("a", { href: act.href }), "aria-label": w.open[kind](r.value), icon: glyph(kind === "phone" ? CALL : kind === "email" ? MAIL : OPEN) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "40x44", look: { radius: "md", corner: "round", edge: "none", words: "inherit", icon: "20", hover: "none", press: "card" }, className: "o-values-editor-remove", "data-slot": "vk-values-remove", "aria-label": w.remove(r.value), onClick: () => remove(i), icon: glyph(TRASH) })] })] })] }), bad[i] && !shell && _jsx("p", { className: "o-values-editor-error", "data-slot": "vk-values-error", role: "alert", children: bad[i] })] }, r.id));
|
|
321
322
|
}), showLine && (_jsxs("div", { className: "o-values-editor-line", "data-slot": "vk-values-line", "data-bad": refusal ? "" : undefined, children: [kind === "phone"
|
|
322
323
|
? _jsxs(_Fragment, { children: [_jsx(Button, { kind: "quiet", size: "sm", look: { radius: "md", corner: "round", edge: "none", words: "inherit", colour: "text", icon: "12", iconColour: "faint", pad: "8", gap: "4" }, className: "o-values-editor-code", "data-slot": "vk-values-code", "aria-label": w.countryIs(countryName(reading, language)), onClick: () => go("dial"), iconEnd: glyph(DOWN), children: reading }), _jsx("span", { className: "o-values-editor-prefix", "data-slot": "vk-values-prefix", children: dialOf(reading) })] })
|
|
323
324
|
: _jsx("span", { className: "o-values-editor-plus", "data-slot": "vk-values-prefix", children: glyph(PLUS) }), _jsx(Input, { chrome: "bare", numeric: true, className: "o-values-editor-line-input", "aria-label": w.add[kind], value: typed, placeholder: kind === "phone" ? patternOf(reading) : w.cardLine[kind], type: keys.type, inputMode: keys.inputMode, autofill: false, autoCapitalize: keys.autoCapitalize, enterKeyHint: "enter", onChange: (e) => setTyped(e.target.value), onKeyDown: lineKeys })] }))] }), refusal && !shell && _jsx("p", { className: "o-values-editor-error", "data-slot": "vk-values-error", role: "alert", children: refusal })] }));
|
|
324
|
-
const cards = (_jsxs(FieldRows, { look: MIHAI_CARDS, className: "o-values-editor-cards", "data-slot": "vk-values-rows", role: "list", "aria-label": label, children: [rows.map((r, i) => (_jsxs("div", { role: "listitem", "data-slot": "vk-values-row", "data-index": i, "data-row": r.id, "data-lifted": lifted(r, i), style: lift(i), children: [_jsxs(FieldRow, { as: "div", className: "o-values-editor-card", children: [!one && grip(r, i, LINES, "20x24", { radius: "md", corner: "round", edge: "none", words: "inherit", colour: "faint", cursor: "grab", hover: "none", icon: "20" }), _jsx(Input, { chrome: "bare", numeric: true, className: "o-values-editor-card-input", "data-slot": "vk-values-value", "aria-label": w.nth[kind](i + 1), value: r.value, type: keys.type, inputMode: keys.inputMode, autofill: false, autoCapitalize: keys.autoCapitalize, onChange: (e) => setRows((rs) => rs.map((x) => (x.id === r.id ? { ...x, value: e.target.value } : x))) }), labels.length > 0 && _jsx(Button, { kind: "quiet", size: "line", look: { radius: "none", corner: "round", edge: "none", words: "sm", hover: "none" }, className: "o-values-editor-label", "data-slot": "vk-values-label", "aria-label": w.labelIs(r.label ?? w.noLabel), onClick: () => go("label", i), children: r.label ?? w.label }), _jsx(
|
|
325
|
+
const cards = (_jsxs(FieldRows, { look: MIHAI_CARDS, className: "o-values-editor-cards", "data-slot": "vk-values-rows", role: "list", "aria-label": label, children: [rows.map((r, i) => (_jsxs("div", { role: "listitem", "data-slot": "vk-values-row", "data-index": i, "data-row": r.id, "data-lifted": lifted(r, i), style: lift(i), children: [_jsxs(FieldRow, { as: "div", className: "o-values-editor-card", children: [!one && grip(r, i, LINES, "20x24", { radius: "md", corner: "round", edge: "none", words: "inherit", colour: "faint", cursor: "grab", hover: "none", icon: "20" }), _jsx(Input, { chrome: "bare", numeric: true, className: "o-values-editor-card-input", "data-slot": "vk-values-value", "aria-label": w.nth[kind](i + 1), value: r.value, type: keys.type, inputMode: keys.inputMode, autofill: false, autoCapitalize: keys.autoCapitalize, onChange: (e) => setRows((rs) => rs.map((x) => (x.id === r.id ? { ...x, value: e.target.value } : x))) }), labels.length > 0 && _jsx(Button, { kind: "quiet", size: "line", look: { radius: "none", corner: "round", edge: "none", words: "sm", hover: "none" }, className: "o-values-editor-label", "data-slot": "vk-values-label", "aria-label": w.labelIs(r.label ?? w.noLabel), onClick: () => go("label", i), children: r.label ?? w.label }), _jsx(OwnButton, { kind: "danger", shape: "round", size: "2xs", look: { edge: "none", words: "inherit", colour: "inherit", hover: "none" }, className: "o-values-editor-minus", "data-slot": "vk-values-remove", "aria-label": w.remove(r.value), onClick: () => remove(i), children: _jsx("span", {}) })] }), bad[i] && !shell && _jsx("p", { className: "o-values-editor-error", "data-slot": "vk-values-error", role: "alert", children: bad[i] })] }, r.id))), showLine && _jsxs("div", { className: "o-values-editor-adding", children: [_jsxs(FieldRow, { className: "o-values-editor-card o-values-editor-new", "data-slot": "vk-values-line", children: [kind === "phone" ? _jsxs(_Fragment, { children: [dial && _jsx(Button, { kind: "quiet", shape: "icon", size: "line", look: { radius: "md", corner: "round", edge: "none", words: "xs-medium", colour: "text", disabled: "plain" }, className: "o-values-editor-code", "data-slot": "vk-values-code", "aria-label": w.countryCodeIs(dial.country), disabled: dialCodes.length < 2, onClick: () => go("dial"), icon: _jsx(Flag, { code: dial.country, size: "lg" }) }), dial && _jsx("span", { className: "o-values-editor-prefix", "data-slot": "vk-values-prefix", children: dial.code })] }) : glyph(ICON[kind]), _jsx(Input, { chrome: "bare", numeric: true, className: "o-values-editor-card-input", value: typed, placeholder: w.add[kind], type: keys.type, inputMode: keys.inputMode, autofill: false, autoCapitalize: keys.autoCapitalize, enterKeyHint: "done", onChange: (e) => setTyped(e.target.value), onKeyDown: lineKeys })] }), _jsx(Button, { kind: "soft", size: "lg", "data-slot": "vk-values-add", onClick: add, children: w.addButton })] }), refusal && !shell && _jsx("p", { className: "o-values-editor-error", "data-slot": "vk-values-error", role: "alert", children: refusal })] }));
|
|
325
326
|
const body = (_jsx("div", { ref: placeRoot, className: "o-values-editor", "data-slot": "vk-values", "data-kit": "values-editor", ...device, "data-values-form": "phone", "data-values-view": view, "data-values-holds": one ? "one" : "several", "data-values-phone": worn.phone, children: view === "label" ? labelList.body : view === "dial" ? dialList.body : cardsLook ? cards : card }));
|
|
326
327
|
if (view !== "rows")
|
|
327
328
|
return { body, head: { onBack: back, backSlot: "vk-editor-back", close: false }, title: view === "label" ? w.label : w.countryCode };
|
|
@@ -407,7 +408,7 @@ export function useValuesEditor(props) {
|
|
|
407
408
|
};
|
|
408
409
|
const editRefusal = editing != null && editText.trim() ? rule(keepAs(editText)) : null;
|
|
409
410
|
const showLine = !(one && rows.length > 0);
|
|
410
|
-
const labelButton = (r, i) => labels.length > 0 && (_jsx(InputGroupAddon, { side: "end", children: _jsx(
|
|
411
|
+
const labelButton = (r, i) => labels.length > 0 && (_jsx(InputGroupAddon, { side: "end", children: _jsx(GroupButton, { className: "o-values-editor-edit-label", "data-slot": "vk-values-label", size: "line", look: under ? { radius: "xs", corner: "round", edge: "none", words: "sm", iconColour: "faint", pad: "4", hover: "words", open: "hovered" } : { radius: "none", corner: "round", edge: "none", words: "xs", hover: "words" }, "aria-label": w.labelIs(r.label ?? w.noLabel), "aria-haspopup": under ? "listbox" : undefined, "aria-expanded": under ? drop?.what === "label" : undefined, onClick: open("label", i), iconEnd: under ? glyph(DOWN) : undefined, children: r.label ?? w.label }) }));
|
|
411
412
|
const code = attio ? (_jsx(Button, { kind: "quiet", size: "2xs", look: { radius: "sm", corner: "round", edge: "none", words: "inherit", colour: "text", icon: "12", iconColour: "faint", pad: "6", open: "hovered" }, className: "o-values-editor-code", "data-slot": "vk-values-code", "aria-label": w.countryIs(countryName(reading, language)), "aria-haspopup": "listbox", "aria-expanded": drop?.what === "dial", onClick: open("dial"), iconEnd: glyph(DOWN), children: reading })) : dial && (_jsx(Button, { kind: "quiet", size: "26", look: { radius: "md", corner: "round", edge: "none", words: "xs-medium", colour: "text", disabled: "plain", icon: "12", iconColour: "faint" }, className: "o-values-editor-code", "data-slot": "vk-values-code", "aria-label": w.countryCodeIs(dial.country), disabled: dialCodes.length < 2, onClick: open("dial"), icon: _jsx(Flag, { code: dial.country }), iconEnd: dialCodes.length > 1 ? glyph(DOWN) : undefined, children: dial.country }));
|
|
412
413
|
const line = (_jsxs("div", { className: cx("o-values-editor-line", !attio && "o-popup-line"), "data-slot": "vk-values-line", "data-at": attio ? undefined : "foot", "data-bad": refusal ? "" : undefined, children: [kind === "phone"
|
|
413
414
|
? _jsxs(_Fragment, { children: [code, attio ? _jsx("span", { className: "o-values-editor-prefix", "data-slot": "vk-values-prefix", children: dialOf(reading) }) : dial?.code && _jsx("span", { className: "o-values-editor-prefix", "data-slot": "vk-values-prefix", children: dial.code })] })
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { ViewsViewMenuProps } from "../../provider/components.js";
|
|
2
|
-
/** ViewKit's view menu at a views row's pill
|
|
3
|
-
|
|
2
|
+
/** ViewKit's view menu at a views row's pill: Rename's and New view's boxes, and the Modal and alert they open, the app's where the
|
|
3
|
+
* provider's `panelControls` names them (VK-1014). */
|
|
4
|
+
export declare function MapViewMenu(props: ViewsViewMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { ViewsContext } from "../../provider/context.js";
|
|
5
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
5
6
|
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
6
7
|
import { MapMenu } from "../menu/map-menu.js";
|
|
7
8
|
import { useVerbsMenu } from "./map-views-list-body.js";
|
|
8
|
-
export function MapViewMenu(
|
|
9
|
+
export function MapViewMenu(props) {
|
|
10
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(ViewMenuInner, { ...props }) });
|
|
11
|
+
}
|
|
12
|
+
function ViewMenuInner({ open, onOpenChange, anchor, align, view, views, value, verbs, onDone, onHold }) {
|
|
9
13
|
const Menu = React.useContext(ViewsContext)?.components.Menu ?? MapMenu;
|
|
10
14
|
const screen = React.useContext(PhoneHost), small = usePhone();
|
|
11
15
|
const creating = view === undefined;
|
|
@@ -19,7 +19,8 @@ export declare function orderToWrite(views: readonly Pick<ViewsViewsListItem, "v
|
|
|
19
19
|
export declare function viewsListPropsOf(p: ViewsViewsListBodyProps, words: ViewsListWords, notNow: string, AppIcon?: AppIcon): ViewsListProps;
|
|
20
20
|
/** A view's menu's words in the app's messages. */
|
|
21
21
|
export declare function viewMenuWordsOf(say: ViewsMessageResolver): ViewMenuWords;
|
|
22
|
-
/** ViewKit's views list body, drawn as the views list
|
|
22
|
+
/** ViewKit's views list body, drawn as the views list, with the app's controls where the provider's `panelControls` names them
|
|
23
|
+
* (VK-1014). */
|
|
23
24
|
export declare function MapViewsListBody(props: ViewsViewsListBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
/** What a view's menu drawn from the axis's verbs is handed: the views list body's (VK-823), and a pill's (`ViewMenu`, VK-947). */
|
|
25
26
|
export type VerbsMenuProps = {
|