viewkitjs 0.32.0 → 0.34.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 +98 -0
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/query/evaluate.d.ts +7 -0
- package/fields/dist/query/exact-number.d.ts +8 -2
- package/fields/dist/query/exact-number.js +14 -1
- package/fields/dist/query/sort.js +13 -10
- package/fields/dist/registry.js +5 -1
- package/fields/dist/types.d.ts +4 -1
- package/fields/dist/zod.d.ts +5 -0
- package/fields/dist/zod.js +10 -1
- package/fields/docs/guides/contact-values.md +12 -0
- package/fields/docs/guides/field-types.md +1 -1
- package/fields/docs/guides/queries.md +3 -1
- package/fields/docs/reference/fields.md +1 -0
- package/package.json +1 -1
- package/postgres/dist/check.js +4 -1
- package/postgres/dist/definitions/formula-forms.js +3 -1
- package/postgres/dist/definitions/money.js +2 -1
- package/postgres/dist/page.js +6 -3
- package/postgres/dist/rules.d.ts +15 -1
- package/postgres/dist/rules.js +16 -0
- package/postgres/dist/sort.js +7 -2
- package/postgres/docs/guides/definitions.md +1 -1
- package/postgres/docs/guides/field-map.md +1 -1
- package/postgres/docs/reference/definitions.md +1 -1
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/atoms/ToolbarButton.d.ts +1 -1
- package/views/dist/atoms/ToolbarButton.js +4 -3
- package/views/dist/atoms/frame-parts.d.ts +6 -0
- package/views/dist/atoms/frame-parts.js +15 -0
- package/views/dist/atoms/types.d.ts +16 -7
- package/views/dist/cells/cell-title.d.ts +3 -1
- package/views/dist/cells/cell-title.js +2 -2
- package/views/dist/cells/cell-values.js +2 -2
- package/views/dist/contract.d.ts +46 -11
- package/views/dist/contract.js +157 -0
- package/views/dist/controls/alert/alert.js +2 -1
- package/views/dist/controls/alert-dialog/alert-dialog.js +3 -2
- package/views/dist/controls/bulk-bar/bulk-bar.js +25 -22
- package/views/dist/controls/button/map-button.js +2 -0
- package/views/dist/controls/checkbox/checkbox.d.ts +3 -2
- package/views/dist/controls/checkbox/checkbox.js +2 -2
- package/views/dist/controls/compound-editor/compound-editor.d.ts +1 -1
- package/views/dist/controls/compound-editor/name-parts.js +4 -4
- package/views/dist/controls/compound-editor/place-parts.js +19 -19
- package/views/dist/controls/compound-editor/range-parts.js +14 -14
- package/views/dist/controls/compound-editor/row.d.ts +3 -1
- package/views/dist/controls/compound-editor/row.js +2 -2
- package/views/dist/controls/controls.d.ts +4 -0
- package/views/dist/controls/controls.js +4 -0
- package/views/dist/controls/customize/customize.js +43 -39
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
- package/views/dist/controls/customize/map-customize-body.js +7 -2
- package/views/dist/controls/date-editor/date-days.js +2 -2
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -0
- package/views/dist/controls/date-editor/date-editor.js +27 -21
- package/views/dist/controls/date-editor/date-parts.js +6 -6
- package/views/dist/controls/date-editor/map-calendar.js +3 -1
- 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/date-editor.css +2 -2
- package/views/dist/controls/field/field.d.ts +3 -0
- package/views/dist/controls/field/field.js +6 -6
- package/views/dist/controls/filter-editor/block.d.ts +2 -2
- package/views/dist/controls/filter-editor/block.js +5 -5
- package/views/dist/controls/filter-editor/filter-editor.js +31 -33
- package/views/dist/controls/filter-editor/how.d.ts +3 -1
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +3 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +11 -4
- package/views/dist/controls/filter-editor/map-rules.js +1 -1
- package/views/dist/controls/filter-editor/parts.d.ts +3 -1
- package/views/dist/controls/filter-editor/parts.js +8 -6
- package/views/dist/controls/group-editor/group-editor.js +17 -14
- 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 +2 -0
- package/views/dist/controls/index.js +1 -0
- package/views/dist/controls/input/input.js +4 -3
- package/views/dist/controls/input/map-input.js +2 -0
- package/views/dist/controls/internal/editor-parts.js +1 -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.d.ts +8 -0
- package/views/dist/controls/internal/map-panel-controls.js +20 -0
- package/views/dist/controls/internal/panel-controls.d.ts +58 -0
- package/views/dist/controls/internal/panel-controls.js +240 -0
- package/views/dist/controls/internal/part-slot.d.ts +12 -0
- package/views/dist/controls/internal/part-slot.js +5 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +1 -1
- package/views/dist/controls/links-editor/links-editor.js +27 -27
- package/views/dist/controls/menu/map-menu.d.ts +2 -2
- package/views/dist/controls/menu/map-menu.js +15 -12
- package/views/dist/controls/menu/menu.d.ts +3 -0
- package/views/dist/controls/menu/menu.js +5 -5
- package/views/dist/controls/menu-list/menu-list.d.ts +14 -4
- package/views/dist/controls/menu-list/menu-list.js +23 -22
- package/views/dist/controls/modal/modal.js +5 -3
- package/views/dist/controls/notice/notice.d.ts +3 -1
- package/views/dist/controls/notice/notice.js +2 -2
- package/views/dist/controls/number-editor/map-number-body.js +5 -1
- package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
- package/views/dist/controls/number-editor/number-editor.js +16 -16
- package/views/dist/controls/number-field/number-field.js +5 -3
- 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/pane/pane.d.ts +4 -2
- package/views/dist/controls/pane/pane.js +4 -4
- package/views/dist/controls/picker/map-fields-body.js +25 -1
- package/views/dist/controls/picker/picker.d.ts +2 -0
- package/views/dist/controls/picker/picker.js +37 -36
- package/views/dist/controls/picker/rows.d.ts +4 -0
- package/views/dist/controls/picker.css +10 -1
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +4 -2
- 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 +7 -3
- package/views/dist/controls/quick-filters/quick-filters.js +8 -6
- package/views/dist/controls/radio/radio.d.ts +3 -0
- package/views/dist/controls/radio/radio.js +4 -3
- package/views/dist/controls/select/map-select.d.ts +3 -0
- package/views/dist/controls/select/map-select.js +8 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +3 -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 +8 -2
- package/views/dist/controls/sheet/bottom-sheet.js +4 -4
- package/views/dist/controls/sheet/map-sheet.js +1 -1
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +1 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +8 -4
- package/views/dist/controls/sort-editor/sort-editor.js +24 -26
- package/views/dist/controls/sort-editor.css +5 -0
- package/views/dist/controls/text-editor/map-text-body.js +5 -1
- package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
- package/views/dist/controls/text-editor/text-editor.js +11 -10
- package/views/dist/controls/toolbar/toolbar.d.ts +4 -2
- package/views/dist/controls/toolbar/toolbar.js +2 -2
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +3 -3
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +7 -6
- package/views/dist/controls/values-editor/values-editor.d.ts +1 -1
- package/views/dist/controls/values-editor/values-editor.js +22 -22
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -2
- package/views/dist/controls/views-list/map-view-menu.js +7 -3
- 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 +9 -10
- package/views/dist/controls/views-list/views-list.js +6 -6
- package/views/dist/editors/EditorPanel.js +4 -4
- package/views/dist/field-row/FieldRow.js +13 -0
- package/views/dist/fields/money.d.ts +5 -2
- package/views/dist/fields/money.js +14 -2
- package/views/dist/grid/chrome/GridTable.js +4 -1
- package/views/dist/grid/chrome/cell-clipboard.d.ts +4 -2
- package/views/dist/grid/chrome/cell-clipboard.js +2 -2
- package/views/dist/grid/chrome/cells.js +3 -1
- package/views/dist/grid/chrome/grid-row-menu-items.js +1 -1
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +29 -6
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +9 -2
- package/views/dist/grid/core/clipboard-model.d.ts +3 -1
- package/views/dist/grid/core/clipboard-model.js +9 -8
- package/views/dist/grid/core/editing-controller.d.ts +3 -0
- package/views/dist/grid/core/editing-controller.js +6 -0
- package/views/dist/grid/core/edits-sink.d.ts +19 -0
- package/views/dist/grid/core/edits-sink.js +2 -0
- package/views/dist/grid/core/spreadsheet-operations.js +1 -1
- package/views/dist/grid/core/useGridEditing.d.ts +5 -0
- package/views/dist/grid/core/useGridEditing.js +6 -0
- package/views/dist/list/answer.d.ts +40 -0
- package/views/dist/list/answer.js +43 -0
- package/views/dist/list/bulk-bar.d.ts +7 -0
- package/views/dist/list/bulk-bar.js +10 -0
- package/views/dist/list/columns.d.ts +24 -0
- package/views/dist/list/columns.js +27 -0
- package/views/dist/list/edits.d.ts +19 -0
- package/views/dist/list/edits.js +56 -0
- package/views/dist/list/grid.d.ts +11 -0
- package/views/dist/list/grid.js +76 -0
- package/views/dist/list/index.d.ts +14 -1
- package/views/dist/list/index.js +4 -1
- package/views/dist/list/link.d.ts +8 -0
- package/views/dist/list/link.js +78 -0
- package/views/dist/list/list.d.ts +74 -0
- package/views/dist/list/list.js +18 -0
- package/views/dist/list/parts.js +11 -3
- package/views/dist/list/root-base.d.ts +46 -0
- package/views/dist/list/root-base.js +137 -0
- package/views/dist/list/root.d.ts +35 -34
- package/views/dist/list/root.js +153 -113
- package/views/dist/list/source-answers.d.ts +39 -0
- package/views/dist/list/source-answers.js +225 -0
- package/views/dist/list/store.d.ts +37 -5
- package/views/dist/list/store.js +31 -0
- package/views/dist/list/toolbar.d.ts +3 -2
- package/views/dist/list/toolbar.js +23 -5
- package/views/dist/list/views-axis.js +4 -2
- package/views/dist/list/views.d.ts +7 -2
- package/views/dist/list/views.js +16 -5
- package/views/dist/model/column-capabilities.d.ts +13 -0
- package/views/dist/model/column-capabilities.js +23 -2
- package/views/dist/model/column-schema.d.ts +11 -1
- package/views/dist/model/view-rules.js +1 -0
- package/views/dist/panels/model.d.ts +2 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +21 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +2 -2
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +12 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +20 -6
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +4 -3
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -4
- package/views/dist/panels/react/toolbar/ToolbarButton.js +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilter.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +4 -3
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +5 -4
- package/views/dist/panels/react/toolbar/ToolbarNew.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +8 -5
- package/views/dist/panels/react/toolbar/context.d.ts +31 -1
- 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.d.ts +4 -1
- package/views/dist/panels/react/toolbar/panel-part.js +7 -4
- package/views/dist/panels/react.d.ts +1 -1
- package/views/dist/panels/settings/filter-groups.js +6 -1
- package/views/dist/provider/ViewsProvider.d.ts +7 -2
- package/views/dist/provider/ViewsProvider.js +18 -1
- package/views/dist/provider/components.d.ts +90 -2
- package/views/dist/provider/components.js +1 -1
- package/views/dist/provider/context.d.ts +4 -1
- package/views/dist/provider/own-control.d.ts +4 -0
- package/views/dist/provider/own-control.js +7 -0
- package/views/dist/provider/select-items.d.ts +3 -0
- package/views/dist/provider/select-items.js +6 -0
- package/views/dist/react.d.ts +4 -2
- package/views/dist/react.js +2 -0
- package/views/dist/styles.css +107 -80
- package/views/dist/styles.unlayered.css +107 -80
- package/views/docs/contract.md +310 -7
- package/views/docs/controls/alert-dialog.md +4 -0
- package/views/docs/controls/alert.md +4 -0
- package/views/docs/controls/bulk-bar.md +4 -0
- package/views/docs/controls/compound-editor.md +4 -0
- package/views/docs/controls/customize.md +8 -0
- package/views/docs/controls/date-editor.md +6 -0
- package/views/docs/controls/field.md +4 -0
- package/views/docs/controls/filter-editor.md +8 -0
- package/views/docs/controls/group-editor.md +8 -0
- package/views/docs/controls/input.md +4 -0
- package/views/docs/controls/links-editor.md +4 -0
- package/views/docs/controls/menu-list.md +8 -0
- package/views/docs/controls/menu.md +6 -0
- package/views/docs/controls/modal.md +4 -0
- package/views/docs/controls/notice.md +4 -0
- package/views/docs/controls/number-editor.md +6 -0
- package/views/docs/controls/pane.md +4 -0
- package/views/docs/controls/picker.md +8 -0
- package/views/docs/controls/quick-filters.md +8 -0
- package/views/docs/controls/radio.md +4 -0
- package/views/docs/controls/select.md +8 -0
- package/views/docs/controls/sheet.md +4 -0
- package/views/docs/controls/sort-editor.md +8 -0
- package/views/docs/controls/text-editor.md +6 -0
- package/views/docs/controls/toolbar.md +4 -0
- package/views/docs/controls/values-editor.md +4 -0
- package/views/docs/controls/views-list.md +8 -0
- package/views/docs/guides/the-grid.md +2 -2
- package/views/docs/guides/the-provider.md +19 -2
- package/views/docs/reference/controls.md +11 -7
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +1 -1
- package/views/docs/reference/list.md +143 -11
- package/views/docs/reference/looks.md +1 -1
- package/views/docs/reference/panels-react.md +6 -5
- package/views/docs/reference/react.md +19 -12
- package/views/docs/reference/views.md +11 -5
- package/views/docs/reshaping.md +17 -1
- package/views/skills/views/SKILL.md +1 -1
|
@@ -222,7 +222,7 @@ export function useValuesEditor(props) {
|
|
|
222
222
|
const lifted = (r, i) => (dragging === i || posed?.id === r.id ? "" : undefined);
|
|
223
223
|
const grip = (r, i, icon, size, look) => {
|
|
224
224
|
const g = gripProps(i);
|
|
225
|
-
return _jsx(Button, { kind: "quiet", shape: "icon", size: size, look: look, className: "o-values-editor-grip", "aria-label": w.move(r.value), icon: glyph(icon), ...g, onPointerDown: (e) => { setPosed(null); setMainHeld(rows[0]?.id); g.onPointerDown(e); } });
|
|
225
|
+
return _jsx(Button, { 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
226
|
};
|
|
227
227
|
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
228
|
React.useLayoutEffect(() => {
|
|
@@ -314,17 +314,17 @@ export function useValuesEditor(props) {
|
|
|
314
314
|
if (!finishEdit() && shell)
|
|
315
315
|
onDone?.();
|
|
316
316
|
} };
|
|
317
|
-
const card = (_jsxs(_Fragment, { children: [_jsxs(FieldRows, { look: ATTIO_ROWS, className: "o-values-editor-card", role: "list", "aria-label": label, children: [rows.map((r, i) => {
|
|
317
|
+
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
318
|
const act = openOf(kind, r.value);
|
|
319
|
-
return (_jsxs(React.Fragment, { children: [_jsxs(FieldRow, { as: "div", role: "listitem", className: "o-values-editor-row", "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", 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(InputGroupButton, { className: "o-values-editor-edit-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", onClick: () => { if (!finishEdit())
|
|
320
|
-
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", children: r.label }), _jsxs("span", { className: "o-values-editor-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", 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", "aria-label": w.remove(r.value), onClick: () => remove(i), icon: glyph(TRASH) })] })] })] }), bad[i] && !shell && _jsx("p", { className: "o-values-editor-error", role: "alert", children: bad[i] })] }, r.id));
|
|
321
|
-
}), showLine && (_jsxs("div", { className: "o-values-editor-line", "data-bad": refusal ? "" : undefined, children: [kind === "phone"
|
|
322
|
-
? _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", "aria-label": w.countryIs(countryName(reading, language)), onClick: () => go("dial"), iconEnd: glyph(DOWN), children: reading }), _jsx("span", { className: "o-values-editor-prefix", children: dialOf(reading) })] })
|
|
323
|
-
: _jsx("span", { className: "o-values-editor-plus", 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", role: "alert", children: refusal })] }));
|
|
324
|
-
const cards = (_jsxs(FieldRows, { look: MIHAI_CARDS, className: "o-values-editor-cards", role: "list", "aria-label": label, children: [rows.map((r, i) => (_jsxs("div", { role: "listitem", "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", "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", "aria-label": w.labelIs(r.label ?? w.noLabel), onClick: () => go("label", i), children: r.label ?? w.label }), _jsx(Button, { kind: "danger", shape: "round", size: "2xs", look: { edge: "none", words: "inherit", colour: "inherit", hover: "none" }, className: "o-values-editor-minus", "aria-label": w.remove(r.value), onClick: () => remove(i), children: _jsx("span", {}) })] }), bad[i] && !shell && _jsx("p", { className: "o-values-editor-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", 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", "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", 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", onClick: add, children: w.addButton })] }), refusal && !shell && _jsx("p", { className: "o-values-editor-error", role: "alert", children: refusal })] }));
|
|
325
|
-
const body = (_jsx("div", { ref: placeRoot, className: "o-values-editor", "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 }));
|
|
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(InputGroupButton, { 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
|
+
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
|
+
}), showLine && (_jsxs("div", { className: "o-values-editor-line", "data-slot": "vk-values-line", "data-bad": refusal ? "" : undefined, children: [kind === "phone"
|
|
322
|
+
? _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
|
+
: _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(Button, { 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
|
+
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
326
|
if (view !== "rows")
|
|
327
|
-
return { body, head: { onBack: back, close: false }, title: view === "label" ? w.label : w.countryCode };
|
|
327
|
+
return { body, head: { onBack: back, backSlot: "vk-editor-back", close: false }, title: view === "label" ? w.label : w.countryCode };
|
|
328
328
|
const save = () => {
|
|
329
329
|
if (edit != null && !finishEdit())
|
|
330
330
|
return;
|
|
@@ -341,7 +341,7 @@ export function useValuesEditor(props) {
|
|
|
341
341
|
};
|
|
342
342
|
if (shell)
|
|
343
343
|
return { body, head: {} };
|
|
344
|
-
return { body, head: { left: _jsx(SheetButton, { "aria-label": w.close, icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { kind: "primary", "aria-label": w.save, icon: glyph(TICK), onClick: save }) } };
|
|
344
|
+
return { body, head: { left: _jsx(SheetButton, { "data-slot": "vk-editor-close", "aria-label": w.close, icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": w.save, icon: glyph(TICK), onClick: save }) } };
|
|
345
345
|
}
|
|
346
346
|
const onBlur = (e) => {
|
|
347
347
|
if (shell || settled.current || swapping.current || drop || !(e.target instanceof Node) || !e.currentTarget.contains(e.target))
|
|
@@ -407,21 +407,21 @@ export function useValuesEditor(props) {
|
|
|
407
407
|
};
|
|
408
408
|
const editRefusal = editing != null && editText.trim() ? rule(keepAs(editText)) : null;
|
|
409
409
|
const showLine = !(one && rows.length > 0);
|
|
410
|
-
const labelButton = (r, i) => labels.length > 0 && (_jsx(InputGroupAddon, { side: "end", children: _jsx(InputGroupButton, { className: "o-values-editor-edit-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
|
-
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", "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", "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
|
-
const line = (_jsxs("div", { className: cx("o-values-editor-line", !attio && "o-popup-line"), "data-at": attio ? undefined : "foot", "data-bad": refusal ? "" : undefined, children: [kind === "phone"
|
|
413
|
-
? _jsxs(_Fragment, { children: [code, attio ? _jsx("span", { className: "o-values-editor-prefix", children: dialOf(reading) }) : dial?.code && _jsx("span", { className: "o-values-editor-prefix", children: dial.code })] })
|
|
414
|
-
: attio ? _jsx("span", { className: "o-values-editor-plus", children: glyph(PLUS) }) : glyph(ICON[kind]), _jsx(Input, { chrome: "bare", numeric: true, className: "o-values-editor-line-input", "aria-label": w.add[kind], placeholder: kind === "phone" ? (attio ? patternOf(reading) : hint) : attio ? w.line[kind] : hint, value: typed, type: keys.type, inputMode: keys.inputMode, autofill: false, spellCheck: false, "aria-invalid": refusal ? true : undefined, onChange: (e) => setTyped(e.target.value), onKeyDown: lineKeys })] }));
|
|
415
|
-
const body = (_jsx("div", { ref: placeRoot, className: "o-values-editor", "data-kit": "values-editor", ...device, "data-values-form": "computer", "data-values-view": view, "data-values-holds": one ? "one" : "several", "data-values-rows": worn.rows, "data-values-main": worn.main, "data-values-line": worn.line, "data-values-lists": worn.lists, ...(view !== "rows" ? { [EDITOR_INNER_ESCAPE]: "" } : {}), role: "group", "aria-label": label, tabIndex: -1, onBlur: onBlur, onFocus: () => { settled.current = false; }, onKeyDown: onKeyDown, children: view === "rows" ? _jsxs(_Fragment, { children: [rows.length > 0 && (_jsx("div", { className: "o-values-editor-rows", role: "list", "aria-label": label, children: rows.map((r, i) => (_jsxs("div", { role: "listitem", className: "o-values-editor-row", "data-row": r.id, "data-lifted": lifted(r, i), style: lift(i), onPointerLeave: () => { if (copied === r.id)
|
|
416
|
-
setCopied(null); }, children: [!one && grip(r, i, GRIP, worn.rows === "copy" ? "2xs" : "20x24", { radius: worn.rows === "copy" ? "sm" : "md", corner: "round", edge: "none", words: "inherit", colour: "faint", cursor: "grab", hover: "none" }), editing === i ? (_jsxs(InlineInputGroup, { className: "o-values-editor-edit", style: ROW_28, "data-bad": editRefusal ? "" : undefined, children: [_jsx(Input, { numeric: true, "aria-label": w.change(r.value), value: editText, type: keys.type, inputMode: keys.inputMode, autofill: false, spellCheck: false, "aria-invalid": editRefusal ? true : undefined, onChange: (e) => setEditText(e.target.value), onKeyDown: editKeys, onBlur: (e) => { const to = e.relatedTarget; if (to && to !== root.current && root.current?.contains(to) && !e.currentTarget.parentElement?.contains(to) && !swapping.current)
|
|
410
|
+
const labelButton = (r, i) => labels.length > 0 && (_jsx(InputGroupAddon, { side: "end", children: _jsx(InputGroupButton, { 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
|
+
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
|
+
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
|
+
? _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 })] })
|
|
414
|
+
: attio ? _jsx("span", { className: "o-values-editor-plus", "data-slot": "vk-values-prefix", children: glyph(PLUS) }) : glyph(ICON[kind]), _jsx(Input, { chrome: "bare", numeric: true, className: "o-values-editor-line-input", "aria-label": w.add[kind], placeholder: kind === "phone" ? (attio ? patternOf(reading) : hint) : attio ? w.line[kind] : hint, value: typed, type: keys.type, inputMode: keys.inputMode, autofill: false, spellCheck: false, "aria-invalid": refusal ? true : undefined, onChange: (e) => setTyped(e.target.value), onKeyDown: lineKeys })] }));
|
|
415
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-values-editor", "data-slot": "vk-values", "data-kit": "values-editor", ...device, "data-values-form": "computer", "data-values-view": view, "data-values-holds": one ? "one" : "several", "data-values-rows": worn.rows, "data-values-main": worn.main, "data-values-line": worn.line, "data-values-lists": worn.lists, ...(view !== "rows" ? { [EDITOR_INNER_ESCAPE]: "" } : {}), role: "group", "aria-label": label, tabIndex: -1, onBlur: onBlur, onFocus: () => { settled.current = false; }, onKeyDown: onKeyDown, children: view === "rows" ? _jsxs(_Fragment, { children: [rows.length > 0 && (_jsx("div", { className: "o-values-editor-rows", "data-slot": "vk-values-rows", role: "list", "aria-label": label, children: rows.map((r, i) => (_jsxs("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), onPointerLeave: () => { if (copied === r.id)
|
|
416
|
+
setCopied(null); }, children: [!one && grip(r, i, GRIP, worn.rows === "copy" ? "2xs" : "20x24", { radius: worn.rows === "copy" ? "sm" : "md", corner: "round", edge: "none", words: "inherit", colour: "faint", cursor: "grab", hover: "none" }), editing === i ? (_jsxs(InlineInputGroup, { className: "o-values-editor-edit", "data-slot": "vk-values-edit", style: ROW_28, "data-bad": editRefusal ? "" : undefined, children: [_jsx(Input, { numeric: true, "aria-label": w.change(r.value), value: editText, type: keys.type, inputMode: keys.inputMode, autofill: false, spellCheck: false, "aria-invalid": editRefusal ? true : undefined, onChange: (e) => setEditText(e.target.value), onKeyDown: editKeys, onBlur: (e) => { const to = e.relatedTarget; if (to && to !== root.current && root.current?.contains(to) && !e.currentTarget.parentElement?.contains(to) && !swapping.current)
|
|
417
417
|
finishEdit(); } }), labelButton(r, i)] })) : _jsxs(_Fragment, { children: [(() => {
|
|
418
418
|
const parts = kind === "email" ? splitEmail(r.value) : null;
|
|
419
|
-
const value = _jsx("button", { type: "button", className: "o-values-editor-value", "aria-label": r.value, onClick: () => { hold(); if (!finishEdit()) {
|
|
419
|
+
const value = _jsx("button", { type: "button", className: "o-values-editor-value", "data-slot": "vk-values-value", "aria-label": r.value, onClick: () => { hold(); if (!finishEdit()) {
|
|
420
420
|
setFocusTo(".o-values-editor-edit input");
|
|
421
421
|
return;
|
|
422
422
|
} setEditing(i); setEditText(r.value); setFocusTo(".o-values-editor-edit input"); }, children: parts ? _jsxs(_Fragment, { children: [_jsx("span", { className: "o-values-editor-name", "data-name": parts[0], children: parts[0] }), _jsx("span", { className: "o-values-editor-domain", children: parts[1] })] }) : r.value });
|
|
423
|
-
return worn.rows === "copy" ? (_jsxs("span", { className: "o-values-editor-pill", children: [value, _jsx(Button, { kind: "quiet", shape: "icon", size: "20", look: { radius: "xs", corner: "round", edge: "none", words: "inherit", colour: "link", icon: "15", hover: "none" }, className: "o-values-editor-copy", "aria-label": w.copy(r.value), "data-copied": copied === r.id ? "" : undefined, onClick: copy(r), icon: glyph(copied === r.id ? TICK : COPY) })] })) : value;
|
|
424
|
-
})(), !one && worn.main === "pill" && r.id === mainId && _jsx("span", { className: "o-values-editor-main", children: w.main }), r.label && !one && _jsx("span", { className: "o-values-editor-label", children: r.label }), _jsx(Button, { kind: "quiet", shape: "icon", size: worn.rows === "copy" ? "2xs" : "22", look: worn.rows === "copy" ? { radius: "sm", corner: "round", edge: "none", words: "inherit", icon: "16" } : { radius: "md", corner: "round", edge: "none", words: "inherit" }, className: "o-values-editor-remove", "aria-label": w.remove(r.value), icon: glyph(worn.rows === "copy" ? TRASH : X), onClick: () => { hold(); remove(i); setFocusTo(editing != null ? ".o-values-editor-edit input" : ".o-values-editor-line-input"); } })] })] }, r.id))) })), editRefusal && !shell && _jsx("p", { className: "o-values-editor-error", role: "alert", children: editRefusal }), showLine && line, refusal && !shell && _jsx("p", { className: "o-values-editor-error", role: "alert", children: refusal }), under && (_jsx(Popover, { open: !!drop, popupData: props.popupData, anchor: drop?.at, side: "bottom", align: "start", sideOffset: spacingPx(1, drop?.at), finalFocus: dropBack, "aria-label": drop?.what === "label" ? w.label : w.country, style: { width: drop?.what === "label" ? "calc(var(--vk-spacing) * 48)" : "calc(var(--vk-spacing) * 60)" }, onOpenChange: (o, d) => {
|
|
423
|
+
return worn.rows === "copy" ? (_jsxs("span", { className: "o-values-editor-pill", "data-slot": "vk-values-pill", children: [value, _jsx(Button, { kind: "quiet", shape: "icon", size: "20", look: { radius: "xs", corner: "round", edge: "none", words: "inherit", colour: "link", icon: "15", hover: "none" }, className: "o-values-editor-copy", "data-slot": "vk-values-copy", "aria-label": w.copy(r.value), "data-copied": copied === r.id ? "" : undefined, onClick: copy(r), icon: glyph(copied === r.id ? TICK : COPY) })] })) : value;
|
|
424
|
+
})(), !one && worn.main === "pill" && r.id === mainId && _jsx("span", { className: "o-values-editor-main", "data-slot": "vk-values-main", children: w.main }), r.label && !one && _jsx("span", { className: "o-values-editor-label", "data-slot": "vk-values-label", children: r.label }), _jsx(Button, { kind: "quiet", shape: "icon", size: worn.rows === "copy" ? "2xs" : "22", look: worn.rows === "copy" ? { radius: "sm", corner: "round", edge: "none", words: "inherit", icon: "16" } : { radius: "md", corner: "round", edge: "none", words: "inherit" }, className: "o-values-editor-remove", "data-slot": "vk-values-remove", "aria-label": w.remove(r.value), icon: glyph(worn.rows === "copy" ? TRASH : X), onClick: () => { hold(); remove(i); setFocusTo(editing != null ? ".o-values-editor-edit input" : ".o-values-editor-line-input"); } })] })] }, r.id))) })), editRefusal && !shell && _jsx("p", { className: "o-values-editor-error", "data-slot": "vk-values-error", role: "alert", children: editRefusal }), showLine && line, refusal && !shell && _jsx("p", { className: "o-values-editor-error", "data-slot": "vk-values-error", role: "alert", children: refusal }), under && (_jsx(Popover, { open: !!drop, popupData: props.popupData, anchor: drop?.at, side: "bottom", align: "start", sideOffset: spacingPx(1, drop?.at), finalFocus: dropBack, "aria-label": drop?.what === "label" ? w.label : w.country, style: { width: drop?.what === "label" ? "calc(var(--vk-spacing) * 48)" : "calc(var(--vk-spacing) * 60)" }, onOpenChange: (o, d) => {
|
|
425
425
|
if (o)
|
|
426
426
|
return;
|
|
427
427
|
closeDrop();
|
|
@@ -430,7 +430,7 @@ export function useValuesEditor(props) {
|
|
|
430
430
|
}, onOutsidePress: (e) => (e.target instanceof Node && drop?.at.contains(e.target) ? false : undefined), children: _jsx("div", { ref: popup, children: drop?.what === "label"
|
|
431
431
|
? _jsx(Picker, { label: w.label, items: labelItems, value: labelOf != null ? rows[labelOf]?.label ?? null : null, onValueChange: setLabel, onCreate: (t) => t.trim(), onDone: closeDrop, search: w.labelFind, form: "computer", fromHeld: true, ...(w.picker ? { words: w.picker } : {}) })
|
|
432
432
|
: drop && _jsx(Picker, { label: w.country, items: attio ? countryItems(language) : dialItems, value: attio ? reading : country ?? null, onValueChange: (c) => { if (typeof c === "string")
|
|
433
|
-
setCountry(c); }, onDone: closeDrop, search: w.searchCountry, form: "computer", fromHeld: true, ...(w.picker ? { words: w.picker } : {}) }) }) }))] }) : _jsxs(_Fragment, { children: [_jsxs("div", { className: "o-values-editor-back o-popup-line", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "xs", "aria-label": w.backTo(label.toLowerCase()), icon: glyph(LEFT), onClick: back }), _jsx("span", { children: view === "label" ? w.label : w.countryCode })] }), view === "label"
|
|
433
|
+
setCountry(c); }, onDone: closeDrop, search: w.searchCountry, form: "computer", fromHeld: true, ...(w.picker ? { words: w.picker } : {}) }) }) }))] }) : _jsxs(_Fragment, { children: [_jsxs("div", { className: "o-values-editor-back o-popup-line", "data-slot": "vk-values-back", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "xs", "aria-label": w.backTo(label.toLowerCase()), icon: glyph(LEFT), onClick: back }), _jsx("span", { children: view === "label" ? w.label : w.countryCode })] }), view === "label"
|
|
434
434
|
? _jsx(Picker, { label: w.label, items: labelItems, value: labelOf != null ? rows[labelOf]?.label ?? null : null, onValueChange: setLabel, onCreate: (t) => t.trim(), onDone: back, search: w.labelFind, form: "computer", fromHeld: true, ...(w.picker ? { words: w.picker } : {}) })
|
|
435
435
|
: _jsx(Picker, { label: w.countryCode, items: attio ? countryItems(language) : dialItems, value: attio ? reading : country ?? null, onValueChange: (c) => { if (typeof c === "string")
|
|
436
436
|
setCountry(c); }, onDone: back, search: w.findCountry, form: "computer", fromHeld: true, ...(w.picker ? { words: w.picker } : {}) })] }) }));
|
|
@@ -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;
|
|
@@ -21,5 +25,5 @@ export function MapViewMenu({ open, onOpenChange, anchor, align, view, views, va
|
|
|
21
25
|
if (creating)
|
|
22
26
|
return _jsx(_Fragment, { children: menu.dialogs });
|
|
23
27
|
const label = views.find((v) => v.value === view)?.label ?? "";
|
|
24
|
-
return (_jsxs(_Fragment, { children: [_jsx(Menu, { open: open, onOpenChange: onOpenChange, anchor: anchor, align: align ?? "start", label: label, items: open ? menu.items(view) : [] }), menu.dialogs] }));
|
|
28
|
+
return (_jsxs(_Fragment, { children: [_jsx(Menu, { open: open, onOpenChange: onOpenChange, anchor: anchor, align: align ?? "start", label: label, items: open ? menu.items(view) : [], "data-slot": "vk-view-menu" }), menu.dialogs] }));
|
|
25
29
|
}
|
|
@@ -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 = {
|
|
@@ -11,7 +11,8 @@ import { MenuList, tilesOf, useMenuListOption, useMenuListRows } from "../menu-l
|
|
|
11
11
|
import { menuEntries } from "../menu/map-menu.js";
|
|
12
12
|
import { menuWordsOf, pickerWordsOf } from "../picker/map-picker.js";
|
|
13
13
|
import { useViewsList } from "./views-list.js";
|
|
14
|
-
import {
|
|
14
|
+
import { PanelHeadButton } from "../internal/head-button.js";
|
|
15
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
15
16
|
import { SheetPartsFrom } from "../sheet/sheet-parts.js";
|
|
16
17
|
import { Icon } from "../internal/icons.js";
|
|
17
18
|
export function viewsListWordsOf(say, createLabel) {
|
|
@@ -59,7 +60,7 @@ export function viewsListPropsOf(p, words, notNow, AppIcon) {
|
|
|
59
60
|
}
|
|
60
61
|
},
|
|
61
62
|
onDone: p.onDone,
|
|
62
|
-
entries: (id) => menuEntries(menuOf(id) ?? [], notNow),
|
|
63
|
+
entries: (id) => menuEntries(menuOf(id) ?? [], notNow, "vk-view-menu-row"),
|
|
63
64
|
...(p.onCreate ? { onNew: p.onCreate } : {}),
|
|
64
65
|
privateViews: p.views.some((v) => v.private),
|
|
65
66
|
reorder: !!p.onReorder,
|
|
@@ -105,7 +106,7 @@ export function viewMenuWordsOf(say) {
|
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
108
|
export function MapViewsListBody(props) {
|
|
108
|
-
return props.verbs ? _jsx(WithVerbs, { ...props, verbs: props.verbs }) : _jsx(Plain, { ...props });
|
|
109
|
+
return _jsx(PanelControlsFromViews, { children: props.verbs ? _jsx(WithVerbs, { ...props, verbs: props.verbs }) : _jsx(Plain, { ...props }) });
|
|
109
110
|
}
|
|
110
111
|
const _menuChangeIsTheSlots = true;
|
|
111
112
|
const _menuAskIsTheConfirmPort = true;
|
|
@@ -116,7 +117,7 @@ function useStepHead(step, props) {
|
|
|
116
117
|
const setParts = React.useContext(SheetPartsFrom);
|
|
117
118
|
React.useLayoutEffect(() => { setParts?.(step ? { title: step.title, head: { onBack: step.onBack } } : null); });
|
|
118
119
|
React.useLayoutEffect(() => () => setParts?.(null), [setParts]);
|
|
119
|
-
return step && props.actions?.back && !setParts ? (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-views-list-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: step.title }), right: _jsx("span", {}), left: _jsx(
|
|
120
|
+
return step && props.actions?.back && !setParts ? (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-views-list-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: step.title }), right: _jsx("span", {}), left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-back", "aria-label": props.actions.back.label, className: "o-sheet-back", icon: _jsx(Icon, { name: "left" }), onClick: props.actions.back.onPress }) }) })) : null;
|
|
120
121
|
}
|
|
121
122
|
function Plain(props) {
|
|
122
123
|
const context = React.useContext(ViewsContext);
|
|
@@ -129,7 +130,7 @@ function Plain(props) {
|
|
|
129
130
|
const shown = props.form === "phone" ? props.views.find((v) => v.value === menuFor) : undefined;
|
|
130
131
|
const step = shown ? {
|
|
131
132
|
title: shown.label, onBack: () => setMenuFor(null),
|
|
132
|
-
body: _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: shown.label, ...tilesOf(leavingFirst(base.entries(shown.value), () => setMenuFor(null))), ...(closeRow ? { onClose: () => setMenuFor(null) } : {}), closeWord: words.menu?.close ?? say({ key: "views.panels.close" }) }) }),
|
|
133
|
+
body: _jsx("div", { style: { display: "contents" }, "data-slot": "vk-view-menu", ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: shown.label, ...tilesOf(leavingFirst(base.entries(shown.value), () => setMenuFor(null))), ...(closeRow ? { onClose: () => setMenuFor(null) } : {}), closeWord: words.menu?.close ?? say({ key: "views.panels.close" }) }) }),
|
|
133
134
|
} : null;
|
|
134
135
|
const list = useViewsList({ ...base, onMenu: setMenuFor, step });
|
|
135
136
|
const head = useStepHead(step, props);
|
|
@@ -2,11 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Alert } from "../alert/alert.js";
|
|
4
4
|
import { AlertDialog } from "../alert-dialog/alert-dialog.js";
|
|
5
|
-
import { Button } from "../button/button.js";
|
|
6
5
|
import { Field } from "../field/field.js";
|
|
7
|
-
import { Input } from "../input/input.js";
|
|
8
6
|
import { asSelect, OnTop } from "../internal/editor-parts.js";
|
|
9
7
|
import { Icon } from "../internal/icons.js";
|
|
8
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
10
9
|
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
11
10
|
import { menuEntries } from "../menu/map-menu.js";
|
|
12
11
|
import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
|
|
@@ -14,7 +13,6 @@ import { MenuList, tilesOf, useMenuListOption, useMenuListRows } from "../menu-l
|
|
|
14
13
|
import { Modal } from "../modal/modal.js";
|
|
15
14
|
import { Picker } from "../picker/picker.js";
|
|
16
15
|
import { Radio, RadioGroup } from "../radio/radio.js";
|
|
17
|
-
import { Select } from "../select/select.js";
|
|
18
16
|
import { useInToast, useToast } from "../toast/toast.js";
|
|
19
17
|
import { canDelete, deleteLine } from "./rules.js";
|
|
20
18
|
import { LOCK, useViewsListWorn } from "./views-list.js";
|
|
@@ -30,6 +28,7 @@ function ToastBridge({ onSend }) {
|
|
|
30
28
|
}
|
|
31
29
|
export function useViewMenu(props) {
|
|
32
30
|
const { views, open, layouts, columns, records, onChange, onDone, ask: askPort, report } = props;
|
|
31
|
+
const { Button, Input, Select } = usePanelControls();
|
|
33
32
|
const w = React.useMemo(() => ({ ...VIEW_MENU_WORDS, ...props.words }), [props.words]);
|
|
34
33
|
const screen = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (screen || small ? "phone" : "computer")) === "phone";
|
|
35
34
|
const stepping = phone && !!props.steps;
|
|
@@ -151,25 +150,25 @@ export function useViewMenu(props) {
|
|
|
151
150
|
];
|
|
152
151
|
return props.reshape ? props.reshape(all, id) : all;
|
|
153
152
|
};
|
|
154
|
-
const entries = (id) => menuEntries(items(id));
|
|
153
|
+
const entries = (id) => menuEntries(items(id), undefined, "vk-view-menu-row");
|
|
155
154
|
const where = props.container ?? undefined, standing = props.standing;
|
|
156
155
|
const target = asked && (asked.what === "rename" || asked.what === "delete" || asked.what === "menu") ? viewOf(asked.id) : undefined;
|
|
157
156
|
const asking = shown;
|
|
158
|
-
const nameField = (run) => (_jsx(Field, { label: w.name, children: _jsx(Input, { ref: box, value: name, onValueChange: (v) => setName(v), onKeyDown: enter(run), autoComplete: "off" }) }));
|
|
157
|
+
const nameField = (run) => (_jsx(Field, { label: w.name, children: _jsx(Input, { ref: box, "data-slot": "vk-view-menu-name", value: name, onValueChange: (v) => setName(v), onKeyDown: enter(run), autoComplete: "off" }) }));
|
|
159
158
|
const columnsField = chosen?.columns && columns && (phone
|
|
160
|
-
? _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: w.columns(chosen.name), entries: [{ kind: "choices", icon: null, label: w.columns(chosen.name), value: column, choices: columns.fields.map((f) => ({ value: f.value, label: f.label })) }], onOpen: () => (stepping ? ask({ what: "columns" }) : setPicking({ open: true })) }) })
|
|
161
|
-
: _jsx(Field, { label: w.columns(chosen.name), nativeLabel: false, children: _jsx(Select, { "aria-label": w.columns(chosen.name), items: asSelect(columns.fields), value: column, onValueChange: (v) => { if (typeof v === "string")
|
|
159
|
+
? _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: w.columns(chosen.name), entries: [{ kind: "choices", icon: null, label: w.columns(chosen.name), value: column, slot: { slot: "vk-view-menu-columns" }, choices: columns.fields.map((f) => ({ value: f.value, label: f.label })) }], onOpen: () => (stepping ? ask({ what: "columns" }) : setPicking({ open: true })) }) })
|
|
160
|
+
: _jsx(Field, { label: w.columns(chosen.name), nativeLabel: false, children: _jsx(Select, { "aria-label": w.columns(chosen.name), "data-slot": "vk-view-menu-columns", items: asSelect(columns.fields), value: column, onValueChange: (v) => { if (typeof v === "string")
|
|
162
161
|
setColumn(v); } }) }));
|
|
163
162
|
const newForm = (_jsxs("div", { className: "o-views-list-form", children: [_jsx(RadioGroup, { row: true, label: w.layout, value: layout, onValueChange: (v) => { if (typeof v === "string")
|
|
164
|
-
setLayout(v); }, children: layouts.map((l) => _jsx(Radio, { value: l.id, mark: l.mark, label: l.name, note: l.line }, l.id)) }), nameField(create), columnsField] }));
|
|
163
|
+
setLayout(v); }, children: layouts.map((l) => _jsx(Radio, { value: l.id, mark: l.mark, label: l.name, note: l.line, "data-slot": "vk-view-menu-layout", "data-key": l.id }, l.id)) }), nameField(create), columnsField] }));
|
|
165
164
|
const modalWords = { close: w.close };
|
|
166
165
|
const stepOf = () => {
|
|
167
166
|
if (!stepping || !asked || !shown)
|
|
168
167
|
return null;
|
|
169
|
-
const done = (run, disabled, label) => (_jsx("div", { className: "o-views-list-step-foot", children: _jsx(Button, { kind: "primary", className: "o-views-list-step-act", disabled: disabled, onClick: () => { run(); toList(); }, children: label }) }));
|
|
168
|
+
const done = (run, disabled, label) => (_jsx("div", { className: "o-views-list-step-foot", children: _jsx(Button, { kind: "primary", className: "o-views-list-step-act", "data-slot": "vk-view-menu-act", disabled: disabled, onClick: () => { run(); toList(); }, children: label }) }));
|
|
170
169
|
if (asked.what === "menu" && target) {
|
|
171
170
|
const leaving = (list) => list.map((e) => e.kind === undefined || e.kind === "action" ? { ...e, onSelect: () => { toList(); e.onSelect?.(); } } : e.kind === "group" ? { ...e, entries: leaving(e.entries) } : e);
|
|
172
|
-
return { title: target.name, onBack: toList, body: _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: target.name, ...tilesOf(leaving(entries(target.id))), ...(closeRow ? { onClose: toList } : {}), closeWord: w.close }) }) };
|
|
171
|
+
return { title: target.name, onBack: toList, body: _jsx("div", { style: { display: "contents" }, "data-slot": "vk-view-menu", ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: target.name, ...tilesOf(leaving(entries(target.id))), ...(closeRow ? { onClose: toList } : {}), closeWord: w.close }) }) };
|
|
173
172
|
}
|
|
174
173
|
if (asked.what === "rename" && target)
|
|
175
174
|
return { title: w.renameTitle, onBack: () => ask({ what: "menu", id: target.id }), body: _jsxs(_Fragment, { children: [_jsx("div", { className: "o-views-list-form", children: nameField(saveName) }), done(saveName, !name.trim(), w.save)] }) };
|
|
@@ -5,7 +5,7 @@ import { Icon } from "../internal/icons.js";
|
|
|
5
5
|
import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
|
|
6
6
|
import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
|
|
7
7
|
import { usePicker } from "../picker/picker.js";
|
|
8
|
-
import {
|
|
8
|
+
import { PanelHeadButton } from "../internal/head-button.js";
|
|
9
9
|
import { openerAt, useStepReturn } from "../internal/step-return.js";
|
|
10
10
|
import { VIEWS_LIST_ATTRS, viewsListWornOf } from "./looks.js";
|
|
11
11
|
import { listed } from "./rules.js";
|
|
@@ -36,7 +36,7 @@ export function useViewsList(props) {
|
|
|
36
36
|
return mark == null ? {} : { as: { mark: _jsx("span", { className: "o-views-list-mark", children: mark }) } };
|
|
37
37
|
};
|
|
38
38
|
const items = listed(views, privateViews).map((v) => ({
|
|
39
|
-
value: v.id, label: v.name, ...markOf(v.layout),
|
|
39
|
+
value: v.id, label: v.name, ...markOf(v.layout), slot: { slot: "vk-views-list-row", key: v.id },
|
|
40
40
|
...(props.entries ? { menu: props.entries(v.id) } : {}),
|
|
41
41
|
...(typeof v.count === "number" ? { count: v.count } : {}),
|
|
42
42
|
...(privateViews ? { group: v.private ? w.justMe : w.shared, ...(v.private ? { after: LOCK } : {}) } : {}),
|
|
@@ -50,7 +50,7 @@ export function useViewsList(props) {
|
|
|
50
50
|
...(props.onNew ? { actions: [{ id: "new", label: w.newView, icon: _jsx(Icon, { name: "plus" }), onSelect: () => { setOpener(null); props.onNew(); } }] } : {}),
|
|
51
51
|
search: phone ? w.find : w.search, searchShown: true, heldInPlace: true, actionsUnder: true, fromHeld: true,
|
|
52
52
|
...(w.none ? { none: w.none } : {}), ...(w.picker ? { words: w.picker } : {}), ...(w.menu ? { menuWords: w.menu } : {}),
|
|
53
|
-
menuFrame: MENU_LIST_CARD_FRAME,
|
|
53
|
+
menuFrame: MENU_LIST_CARD_FRAME, menuSlot: "vk-view-menu",
|
|
54
54
|
...(phone && props.onMenu ? { onRowMenu: (id) => { setOpener(views.find((v) => v.id === id)?.name ?? null); props.onMenu(id); } } : {}),
|
|
55
55
|
});
|
|
56
56
|
const step = phone ? props.step ?? null : null;
|
|
@@ -58,13 +58,13 @@ export function useViewsList(props) {
|
|
|
58
58
|
const placeRoot = React.useCallback((el) => { rootRef.current = el; setRoot(el); }, [setRoot]);
|
|
59
59
|
useStepReturn(rootRef, step && opener ? [openerAt(() => `[role="option"][data-name="${CSS.escape(opener)}"] .o-picker-row-menu`)] : []);
|
|
60
60
|
if (step) {
|
|
61
|
-
const back = _jsx(
|
|
61
|
+
const back = _jsx(PanelHeadButton, { "data-slot": "vk-editor-back", "aria-label": w.back, className: "o-sheet-back", icon: _jsx(Icon, { name: "left" }), onClick: step.onBack });
|
|
62
62
|
return {
|
|
63
|
-
body: _jsx("div", { ref: placeRoot, className: "o-views-list", "data-kit": "views-list", "data-views-form": "phone", "data-views-step": "", ...phoneMark(!!screen || small), children: step.body }),
|
|
63
|
+
body: _jsx("div", { ref: placeRoot, className: "o-views-list", "data-slot": "vk-views-list", "data-kit": "views-list", "data-views-form": "phone", "data-views-step": "", ...phoneMark(!!screen || small), children: step.body }),
|
|
64
64
|
head: { left: back, children: step.title, right: _jsx("span", {}) },
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
const body = (_jsx("div", { ref: placeRoot, className: "o-views-list", "data-kit": "views-list", "data-views-form": phone ? "phone" : "computer", ...phoneMark(!!screen || small), children: picker.body }));
|
|
67
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-views-list", "data-slot": "vk-views-list", "data-kit": "views-list", "data-views-form": phone ? "phone" : "computer", ...phoneMark(!!screen || small), children: picker.body }));
|
|
68
68
|
return { body, head: picker.head };
|
|
69
69
|
}
|
|
70
70
|
export function ViewsList(props) {
|
|
@@ -140,9 +140,9 @@ export function EditorPanel({ session, title, anchor, inPlace = false, sheetOnPh
|
|
|
140
140
|
const back = () => stepRef.current?.onBack();
|
|
141
141
|
const actions = views.sheetActions === "head"
|
|
142
142
|
? {
|
|
143
|
-
close: { label: discardLabel, onPress: () => close("escape") },
|
|
144
|
-
...(!savesOnPick && { done: { label: saveLabel, onPress: () => close("enter") } }),
|
|
145
|
-
...(step && { back: { label: backLabel, onPress: back } }),
|
|
143
|
+
close: { label: discardLabel, onPress: () => close("escape"), slot: "vk-editor-close" },
|
|
144
|
+
...(!savesOnPick && { done: { label: saveLabel, onPress: () => close("enter"), slot: "vk-editor-save" } }),
|
|
145
|
+
...(step && { back: { label: backLabel, onPress: back, slot: "vk-editor-back" } }),
|
|
146
146
|
}
|
|
147
147
|
: undefined;
|
|
148
148
|
const sheetTitle = step ? step.title : title;
|
|
@@ -155,5 +155,5 @@ export function EditorPanel({ session, title, anchor, inPlace = false, sheetOnPh
|
|
|
155
155
|
if (details?.reason === "escape-key" && (inMarkedStep(document.activeElement) || goBack()))
|
|
156
156
|
return;
|
|
157
157
|
close("escape");
|
|
158
|
-
}, title: sheetTitle, ...(typeof sheetTitle === "string" || typeof sheetTitle === "number" ? { label: String(sheetTitle) } : {}), ...(actions && { actions }), snap: snap, children: _jsxs("div", { ref: panelRef, "data-slot": "vk-editor-panel", children: [actions ? null : (_jsxs("div", { "data-slot": "vk-editor-bar", className: "flex items-center justify-between px-2 pb-1", children: [step ? (_jsx(Button, { variant: "ghost", size: "icon", "aria-label": backLabel, onClick: back, children: _jsx(Back, { className: "size-4" }) })) : (_jsx(Button, { variant: "ghost", size: "icon", "aria-label": discardLabel, onClick: () => close("escape"), children: _jsx(Discard, { className: "size-4" }) })), _jsx(Button, { variant: "ghost", size: "icon", "aria-label": saveLabel, onClick: () => close("enter"), children: _jsx(Save, { className: "size-4" }) })] })), _jsx(BodyStepContext.Provider, { value: hold, children: editor }), reason] }) }) }));
|
|
158
|
+
}, title: sheetTitle, ...(typeof sheetTitle === "string" || typeof sheetTitle === "number" ? { label: String(sheetTitle) } : {}), ...(actions && { actions }), snap: snap, children: _jsxs("div", { ref: panelRef, "data-slot": "vk-editor-panel", children: [actions ? null : (_jsxs("div", { "data-slot": "vk-editor-bar", className: "flex items-center justify-between px-2 pb-1", children: [step ? (_jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-back", "aria-label": backLabel, onClick: back, children: _jsx(Back, { className: "size-4" }) })) : (_jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-close", "aria-label": discardLabel, onClick: () => close("escape"), children: _jsx(Discard, { className: "size-4" }) })), _jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-save", "aria-label": saveLabel, onClick: () => close("enter"), children: _jsx(Save, { className: "size-4" }) })] })), _jsx(BodyStepContext.Provider, { value: hold, children: editor }), reason] }) }) }));
|
|
159
159
|
}
|
|
@@ -204,9 +204,22 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
|
|
|
204
204
|
const glyph = binding.icon ? (_jsx(AppIcon, { name: binding.icon, className: "h-3.5 w-3.5 text-(color:--vk-fg-subtlest)" })) : (_jsx(TypeGlyph, { className: "h-3.5 w-3.5 text-(color:--vk-fg-subtlest)" }));
|
|
205
205
|
const menuItems = fieldRowMenuItems(menu, ready, messages);
|
|
206
206
|
const valueNode = (_jsxs("span", { ref: valueRef, className: "flex min-w-0 flex-1 items-center gap-2", children: [_jsx("span", { className: "min-w-0 wrap-break-word", children: body }), meta ? _jsx("span", { className: "shrink-0 text-xs text-(color:--vk-fg-subtle)", children: meta }) : null] }));
|
|
207
|
+
const handOver = () => {
|
|
208
|
+
const row = rowRef.current;
|
|
209
|
+
if (!row || !buttonRef.current || document.activeElement !== buttonRef.current)
|
|
210
|
+
return;
|
|
211
|
+
row.tabIndex = -1;
|
|
212
|
+
row.style.outline = "none";
|
|
213
|
+
row.focus({ preventScroll: true });
|
|
214
|
+
row.addEventListener("blur", () => {
|
|
215
|
+
row.removeAttribute("tabindex");
|
|
216
|
+
row.style.removeProperty("outline");
|
|
217
|
+
}, { once: true });
|
|
218
|
+
};
|
|
207
219
|
const open = (byKey) => {
|
|
208
220
|
if (pending)
|
|
209
221
|
return;
|
|
222
|
+
handOver();
|
|
210
223
|
setError(null);
|
|
211
224
|
setByKey(byKey);
|
|
212
225
|
setEditing(true);
|
|
@@ -25,6 +25,7 @@ export type MoneyColumn<Row> = DenominatedColumn<Row> & {
|
|
|
25
25
|
accessor?: ((row: Row) => unknown) | null;
|
|
26
26
|
aggAccessor?: (row: Row) => number | null;
|
|
27
27
|
editAccessor?: ((row: Row) => unknown) | null;
|
|
28
|
+
sortAccessor?: (row: Row) => number | null;
|
|
28
29
|
};
|
|
29
30
|
export declare function isMoneyOpensOn(value: unknown): value is MoneyOpensOn;
|
|
30
31
|
/** The reading a declaration opens on, for this reader. */
|
|
@@ -45,8 +46,10 @@ export declare function convertMoney<Row>(money: MoneyDeclaration<Row>, row: Row
|
|
|
45
46
|
/** The column, read the given way. Every derivation starts from `money`, so
|
|
46
47
|
* reading a column twice is the same as reading it once. `C` keeps the
|
|
47
48
|
* caller's column type (a grid `ListColumn`, a server `SourceColumn`); the
|
|
48
|
-
* intersection is what lets `Row` be inferred from the declaration.
|
|
49
|
-
|
|
49
|
+
* intersection is what lets `Row` be inferred from the declaration. Under the
|
|
50
|
+
* Original reading, `sortIn` (the reader's default currency, which
|
|
51
|
+
* `readMoneyColumns` hands) gives the column its `sortAccessor`. */
|
|
52
|
+
export declare function readMoneyColumn<Row, C extends MoneyColumn<Row>>(column: C & MoneyColumn<Row>, reading: MoneyReading, sortIn?: DisplayCurrency): C;
|
|
50
53
|
/** Every money column read the reader's way: their `gridCurrencies` by FIELD
|
|
51
54
|
* key, else a host's legacy choice (read once, never written), else what the
|
|
52
55
|
* column opens on — for this reader's default currency. */
|
|
@@ -19,7 +19,7 @@ export function convertMoney(money, row, value, to) {
|
|
|
19
19
|
return null;
|
|
20
20
|
return convertRowAmount({ currency: money.code(row), fx: rates }, value, to);
|
|
21
21
|
}
|
|
22
|
-
export function readMoneyColumn(column, reading) {
|
|
22
|
+
export function readMoneyColumn(column, reading, sortIn) {
|
|
23
23
|
const money = column.money;
|
|
24
24
|
if (!money)
|
|
25
25
|
return column;
|
|
@@ -35,6 +35,17 @@ export function readMoneyColumn(column, reading) {
|
|
|
35
35
|
delete next.aggAccessor;
|
|
36
36
|
next.currencyAccessor = money.code;
|
|
37
37
|
delete next.surfaceOwnsCurrency;
|
|
38
|
+
if (sortIn !== undefined)
|
|
39
|
+
next.sortAccessor = (row) => {
|
|
40
|
+
try {
|
|
41
|
+
return convertMoney(money, row, money.amount(row), sortIn);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
else
|
|
48
|
+
delete next.sortAccessor;
|
|
38
49
|
}
|
|
39
50
|
else {
|
|
40
51
|
format.currency = reading;
|
|
@@ -46,6 +57,7 @@ export function readMoneyColumn(column, reading) {
|
|
|
46
57
|
else
|
|
47
58
|
delete next.aggAccessor;
|
|
48
59
|
delete next.currencyAccessor;
|
|
60
|
+
delete next.sortAccessor;
|
|
49
61
|
next.surfaceOwnsCurrency = true;
|
|
50
62
|
}
|
|
51
63
|
next.format = format;
|
|
@@ -58,7 +70,7 @@ export function readMoneyColumns(columns, readings, defaultCurrency, legacy) {
|
|
|
58
70
|
const reading = readings[column.field.key] ??
|
|
59
71
|
legacy?.(column) ??
|
|
60
72
|
resolveOpensOn(column.money.opensOn, defaultCurrency);
|
|
61
|
-
return readMoneyColumn(column, reading);
|
|
73
|
+
return readMoneyColumn(column, reading, defaultCurrency);
|
|
62
74
|
});
|
|
63
75
|
}
|
|
64
76
|
export function moneyReadingOf(column) {
|
|
@@ -24,6 +24,7 @@ import { groupMenuParts } from "./grid-group-menu-parts.js";
|
|
|
24
24
|
import { GRID_HEAD_KEY } from "../core/grid-focus.js";
|
|
25
25
|
import { gridAriaLayout } from "../core/grid-aria.js";
|
|
26
26
|
import { GridBody } from "./GridStructure.js";
|
|
27
|
+
import { withEditThroughLocks } from "../../model/column-capabilities.js";
|
|
27
28
|
import { useGridScaleStyles } from "./useGridScaleStyles.js";
|
|
28
29
|
import { useGridTableInteractionModel } from "./useGridTableInteractionModel.js";
|
|
29
30
|
import { useGridRowOpener } from "./useGridRowOpener.js";
|
|
@@ -89,7 +90,9 @@ function GridRowsWait({ gridProps, waiting, RowsWait, loading, }) {
|
|
|
89
90
|
return null;
|
|
90
91
|
return (_jsx(GridWaitContext.Provider, { value: wait, children: _jsx(GridRowsSlotContext.Provider, { value: slot, children: _jsx("div", { className: "contents", inert: holding, children: grid }) }) }));
|
|
91
92
|
}
|
|
92
|
-
function GridTableContent(
|
|
93
|
+
function GridTableContent(given) {
|
|
94
|
+
const widenedConfig = useMemo(() => withEditThroughLocks(given.listConfig, given.columns.map((column) => column.field)), [given.listConfig, given.columns]);
|
|
95
|
+
const props = useMemo(() => (widenedConfig === given.listConfig ? given : { ...given, listConfig: widenedConfig }), [given, widenedConfig]);
|
|
93
96
|
const { groups, grouped, getRowId, columns, isCollapsed, onToggleGroup, renderGroupLabel, onHideGroup, renderAggregate, countOf, onOpenRow, onPrefetchRow, rowHref, rowClassName, onRowDelete, rowActions, rowIcon, showRowIcon = true, freezeIdentity = true, selection, loadMore, pages, emptyState, sort, sortMark, groupBy, sortOptions, groupSummary, aggregates, onAggregateChange, onGroupSummaryChange, groupFigures, countNoun, optionColors, onOptionColorChange, dateStyles, onDateStyleChange, durationStyles, onDurationStyleChange, numberFormats, onNumberFormatChange, showTimeOverrides, onShowTimeChange, percentDisplays, onPercentDisplayChange, columnState, onColumnStateChange, listConfig, } = props;
|
|
94
97
|
const leaveScope = useEditLeaveScope();
|
|
95
98
|
const rowsWait = useContext(GridWaitContext);
|
|
@@ -5,6 +5,8 @@ export { cellClearPrev, cellCopyShown, cellEditBaseline, cellPrevPayload, rowHol
|
|
|
5
5
|
export declare function getGridClipboard(): GridCellClipboard | null;
|
|
6
6
|
/** Puts one cell's text on the system clipboard through the app's port, and keeps the typed entry
|
|
7
7
|
* the grid pastes from — which survives a refused system write. The text reads `shown` (`cellCopyShown`: a
|
|
8
|
-
* relation as its cell shows it), the entry keeps `baseline`. */
|
|
9
|
-
export declare function copyCell<Row>(write: ViewsClipboardPort["writeText"], col: ListColumn<Row>, baseline: unknown, unit?: string, shown?: unknown
|
|
8
|
+
* relation as its cell shows it, a place's country in `language`), the entry keeps `baseline`. */
|
|
9
|
+
export declare function copyCell<Row>(write: ViewsClipboardPort["writeText"], col: ListColumn<Row>, baseline: unknown, unit?: string, shown?: unknown,
|
|
10
|
+
/** The names language a place's country is written in (`conventions.language`). */
|
|
11
|
+
language?: string): Promise<string>;
|
|
10
12
|
export declare function copyCells(write: ViewsClipboardPort["writeText"], matrix: GridClipboardCell[][]): Promise<string>;
|
|
@@ -4,8 +4,8 @@ let clipboard = null;
|
|
|
4
4
|
export function getGridClipboard() {
|
|
5
5
|
return clipboard;
|
|
6
6
|
}
|
|
7
|
-
export async function copyCell(write, col, baseline, unit, shown = baseline) {
|
|
8
|
-
const text = cellCopyText(col, shown);
|
|
7
|
+
export async function copyCell(write, col, baseline, unit, shown = baseline, language) {
|
|
8
|
+
const text = cellCopyText(col, shown, language);
|
|
9
9
|
clipboard = { text, value: baseline, type: col.type, unit };
|
|
10
10
|
try {
|
|
11
11
|
await write(text);
|
|
@@ -7,7 +7,9 @@ export function renderTypedCell(col, row, opts) {
|
|
|
7
7
|
const cell = renderTypedCellValue(col, row, opts);
|
|
8
8
|
if (col.type === "title")
|
|
9
9
|
return cell;
|
|
10
|
-
const indicator = col.indicator?.(row
|
|
10
|
+
const indicator = col.indicator?.(row, {
|
|
11
|
+
value: opts?.valueOverride !== undefined ? opts.valueOverride : col.accessor?.(row),
|
|
12
|
+
});
|
|
11
13
|
if (!indicator)
|
|
12
14
|
return cell;
|
|
13
15
|
return (_jsxs("span", { className: "flex h-(--vk-line-h) min-w-0 flex-1 flex-wrap content-start items-center gap-x-1.5 overflow-hidden leading-(--vk-line-h)", children: [_jsx("span", { className: "max-w-full flex-none truncate", children: cell }), indicator] }));
|
|
@@ -74,7 +74,7 @@ export function gridRowMenuItems(menuRow, menuColumnId, views) {
|
|
|
74
74
|
? columns.find((column) => column.id === menuColumnId)
|
|
75
75
|
: undefined;
|
|
76
76
|
const editBaseline = (column) => cellEditBaseline(column, row, pendingByCol);
|
|
77
|
-
const copy = (column, unit) => void copyCell(ports.clipboard.writeText, column, editBaseline(column), unit, cellCopyShown(column, row, pendingByCol));
|
|
77
|
+
const copy = (column, unit) => void copyCell(ports.clipboard.writeText, column, editBaseline(column), unit, cellCopyShown(column, row, pendingByCol), conventions.language);
|
|
78
78
|
const canEdit = (column) => editingEnabled && rowWritable && columnWritable(column);
|
|
79
79
|
const off = (reason) => reason === null ? { disabled: false } : { disabled: true, disabledReason: reason };
|
|
80
80
|
const nothingToPaste = messages({ key: "views.grid.paste-empty" });
|
|
@@ -3,9 +3,10 @@ import { type GridCellPos } from "../core/coordinates.js";
|
|
|
3
3
|
import type { GridCellRange } from "../core/useGridRange.js";
|
|
4
4
|
import type { ListSettingsConfig } from "../../model/column-capabilities.js";
|
|
5
5
|
import type { ListColumn } from "../../model/column-schema.js";
|
|
6
|
+
import { type GridEditsState } from "../core/edits-sink.js";
|
|
6
7
|
import type { GridRangeVerbs } from "./useGridRangeActions.js";
|
|
7
8
|
import { type GridChromeTarget, type GridFocusShape } from "../core/grid-focus.js";
|
|
8
|
-
export declare function useGridKeyboard<Row>({ rootRef, focusedCell, editingCell, editingEnabled, listConfig, rowWritable, visibleRowIds, rowByKey, visibleColIds, visibleColumns, rows, getRowId, pendingByRow, rangeVerbsRef, focusCell, clearFocus, startEdit, cancelEdit, commitEdit, refuseEdit, undo, redo, isLastEdited, rangeSetRect, rangeExtendTo, ranges, revealCell, releaseToFrame, lastCellRef, chrome, setChrome, shape, toggleGroup, }: {
|
|
9
|
+
export declare function useGridKeyboard<Row>({ rootRef, focusedCell, editingCell, editingEnabled, listConfig, rowWritable, visibleRowIds, rowByKey, visibleColIds, visibleColumns, rows, getRowId, pendingByRow, rangeVerbsRef, focusCell, clearFocus, startEdit, cancelEdit, commitEdit, refuseEdit, undo, redo, isLastEdited, editsState, rangeSetRect, rangeExtendTo, ranges, revealCell, releaseToFrame, lastCellRef, chrome, setChrome, shape, toggleGroup, }: {
|
|
9
10
|
rootRef: RefObject<HTMLDivElement | null>;
|
|
10
11
|
/** A column name, a footer cell, a bar or a checkbox holding the focus (`useGridFocus`); null: a data cell, or
|
|
11
12
|
* nothing. */
|
|
@@ -63,6 +64,8 @@ export declare function useGridKeyboard<Row>({ rootRef, focusedCell, editingCell
|
|
|
63
64
|
/** This grid is the one the page edited last (`useGridEditing`'s `isLastEdited`): with the focus in no grid's frame,
|
|
64
65
|
* only it answers ⌘Z. Absent: it always is. */
|
|
65
66
|
isLastEdited?: () => boolean;
|
|
67
|
+
/** The edits' state a sink above the grid reads (`GridEditsSinkContext`). Absent: nothing to tell. */
|
|
68
|
+
editsState?: () => GridEditsState;
|
|
66
69
|
}): {
|
|
67
70
|
onEditorTab: (rowId: string, columnId: string, backwards: boolean) => void;
|
|
68
71
|
onEditorEnter: (rowId: string, columnId: string) => void;
|