viewkitjs 0.32.0 → 0.33.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 +69 -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 +31 -6
- package/views/dist/contract.js +123 -0
- 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 +2 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/customize/customize.js +37 -35
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
- package/views/dist/controls/customize/map-customize-body.js +4 -0
- package/views/dist/controls/date-editor/date-days.js +2 -2
- package/views/dist/controls/date-editor/date-editor.js +18 -18
- package/views/dist/controls/date-editor/date-parts.js +6 -6
- package/views/dist/controls/date-editor/map-calendar.js +1 -1
- 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 +1 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -3
- package/views/dist/controls/filter-editor/map-rules.js +1 -1
- package/views/dist/controls/filter-editor/parts.js +2 -1
- package/views/dist/controls/group-editor/group-editor.js +15 -13
- package/views/dist/controls/index.d.ts +2 -0
- package/views/dist/controls/index.js +1 -0
- package/views/dist/controls/input/input.js +2 -2
- 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/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 +50 -0
- package/views/dist/controls/internal/panel-controls.js +197 -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 +2 -0
- package/views/dist/controls/menu/menu.js +3 -3
- 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/notice/notice.d.ts +3 -1
- package/views/dist/controls/notice/notice.js +2 -2
- package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
- package/views/dist/controls/number-editor/number-editor.js +13 -13
- package/views/dist/controls/number-field/number-field.js +5 -3
- package/views/dist/controls/pane/pane.d.ts +4 -2
- package/views/dist/controls/pane/pane.js +4 -4
- 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/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +4 -2
- package/views/dist/controls/quick-filters/quick-filters.js +4 -4
- 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/sheet/bottom-sheet.d.ts +5 -1
- package/views/dist/controls/sheet/bottom-sheet.js +2 -2
- 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 +7 -3
- 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/text-editor.d.ts +1 -1
- package/views/dist/controls/text-editor/text-editor.js +8 -8
- 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.js +1 -1
- package/views/dist/controls/views-list/view-menu.js +6 -6
- package/views/dist/controls/views-list/views-list.js +4 -4
- package/views/dist/editors/EditorPanel.js +1 -1
- 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 +70 -0
- package/views/dist/list/list.js +14 -0
- package/views/dist/list/parts.js +10 -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 +14 -2
- 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 +8 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +2 -2
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +8 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +12 -3
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
- 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 +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +2 -2
- 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 +6 -4
- package/views/dist/panels/react/toolbar/context.d.ts +10 -1
- package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
- package/views/dist/panels/react/toolbar/panel-part.js +5 -3
- package/views/dist/panels/settings/filter-groups.js +6 -1
- package/views/dist/provider/ViewsProvider.d.ts +6 -2
- package/views/dist/provider/ViewsProvider.js +18 -1
- package/views/dist/provider/components.d.ts +59 -0
- 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 +86 -78
- package/views/dist/styles.unlayered.css +86 -78
- package/views/docs/contract.md +252 -5
- package/views/docs/controls/compound-editor.md +4 -0
- package/views/docs/controls/customize.md +6 -0
- package/views/docs/controls/date-editor.md +4 -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 +6 -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 +4 -0
- package/views/docs/controls/notice.md +4 -0
- package/views/docs/controls/number-editor.md +4 -0
- package/views/docs/controls/pane.md +4 -0
- package/views/docs/controls/picker.md +8 -0
- package/views/docs/controls/quick-filters.md +6 -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 +4 -0
- package/views/docs/controls/values-editor.md +4 -0
- package/views/docs/controls/views-list.md +6 -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 +7 -5
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +1 -1
- package/views/docs/reference/list.md +141 -11
- package/views/docs/reference/panels-react.md +2 -2
- package/views/docs/reference/react.md +15 -9
- package/views/docs/reference/views.md +8 -4
- package/views/docs/reshaping.md +6 -1
|
@@ -129,7 +129,7 @@ export function usePlaceParts(props, worn, wornAt) {
|
|
|
129
129
|
function pickBox(k) {
|
|
130
130
|
const to = k === "country" ? "countries" : "region";
|
|
131
131
|
const shown = k === "country" ? (country ? _jsxs(_Fragment, { children: [_jsx(Flag, { code: country.code, size: "lg" }), _jsx("span", { className: "o-list-main", children: country.name })] }) : undefined) : draft.region || undefined;
|
|
132
|
-
return (_jsx(QuietField, { label: k === "country" ? w.country : regionWord, form: "phone", required: k === "region" && req("region"), children: _jsx(Select, { opens: "listbox", arrow: "right", size: "lg", shown: shown, placeholder: k === "country" ? w.pick : "", open: list === to, onOpenChange: (o) => (o ? open(to) : back()) }) }));
|
|
132
|
+
return (_jsx(QuietField, { label: k === "country" ? w.country : regionWord, form: "phone", required: k === "region" && req("region"), children: _jsx(Select, { opens: "listbox", arrow: "right", size: "lg", "data-slot": "vk-parts-box", "data-key": k, shown: shown, placeholder: k === "country" ? w.pick : "", open: list === to, onOpenChange: (o) => (o ? open(to) : back()) }) }));
|
|
133
133
|
}
|
|
134
134
|
if (phone) {
|
|
135
135
|
const enter = (e) => {
|
|
@@ -147,21 +147,21 @@ export function usePlaceParts(props, worn, wornAt) {
|
|
|
147
147
|
if (list)
|
|
148
148
|
body = list === "countries" ? countryList.body : regionList.body;
|
|
149
149
|
else if (fields) {
|
|
150
|
-
const countryRow = (_jsxs(FieldRow, { as: "button", label: w.country, className: "o-compound-editor-card-row o-compound-editor-pick", labelClassName: "o-compound-editor-card-label", "data-pick": "country", onPointerDown: () => { wasOpen.current = list === "countries"; }, onClick: () => { if (!wasOpen.current)
|
|
150
|
+
const countryRow = (_jsxs(FieldRow, { as: "button", label: w.country, className: "o-compound-editor-card-row o-compound-editor-pick", labelClassName: "o-compound-editor-card-label", "data-slot": "vk-parts-field", "data-key": "country", "data-pick": "country", onPointerDown: () => { wasOpen.current = list === "countries"; }, onClick: () => { if (!wasOpen.current)
|
|
151
151
|
open("countries"); wasOpen.current = false; }, children: [_jsx("span", { className: "o-compound-editor-value", children: countryShown }), glyph(RIGHT)] }, "country"));
|
|
152
|
-
body = (_jsxs(FieldRows, { look: MIHAI_CARD, className: "o-compound-editor-card", role: "group", "aria-label": label, children: [first && takesCountry && countryRow, flat.map((p) => p === "region" && regionPick ? (_jsxs(FieldRow, { as: "button", label: regionWord, required: req("region"), className: "o-compound-editor-card-row o-compound-editor-pick", labelClassName: "o-compound-editor-card-label", "data-pick": "region", onPointerDown: () => { wasOpen.current = list === "region"; }, onClick: () => { if (!wasOpen.current)
|
|
153
|
-
open("region"); wasOpen.current = false; }, children: [_jsx("span", { className: "o-compound-editor-value", children: regionShown }), glyph(RIGHT)] }, p)) : (_jsx(FieldRow, { label: wordOf(country, p, { phone: true, attio, words: w.parts }), required: req(p), className: "o-compound-editor-card-row", labelClassName: "o-compound-editor-card-label", children: _jsx(Input, { chrome: "bare", className: "o-compound-editor-card-input o-compound-editor-text", "aria-required": req(p) || undefined, value: attio && p === "line1" ? street : draft[p] ?? "", placeholder: wordOf(country, p, { phone: true, attio, words: w.parts }), autofill: false, enterKeyHint: p === lastText ? "done" : "next", onChange: (e) => (attio && p === "line1" ? setStreet(e.target.value) : set(p, e.target.value)), onKeyDown: enter }) }, p))), !first && takesCountry && countryRow] }));
|
|
152
|
+
body = (_jsxs(FieldRows, { look: MIHAI_CARD, className: "o-compound-editor-card", "data-slot": "vk-parts-card", role: "group", "aria-label": label, children: [first && takesCountry && countryRow, flat.map((p) => p === "region" && regionPick ? (_jsxs(FieldRow, { as: "button", label: regionWord, required: req("region"), className: "o-compound-editor-card-row o-compound-editor-pick", labelClassName: "o-compound-editor-card-label", "data-slot": "vk-parts-field", "data-key": "region", "data-pick": "region", onPointerDown: () => { wasOpen.current = list === "region"; }, onClick: () => { if (!wasOpen.current)
|
|
153
|
+
open("region"); wasOpen.current = false; }, children: [_jsx("span", { className: "o-compound-editor-value", children: regionShown }), glyph(RIGHT)] }, p)) : (_jsx(FieldRow, { label: wordOf(country, p, { phone: true, attio, words: w.parts }), required: req(p), className: "o-compound-editor-card-row", labelClassName: "o-compound-editor-card-label", "data-slot": "vk-parts-field", "data-key": p, children: _jsx(Input, { chrome: "bare", className: "o-compound-editor-card-input o-compound-editor-text", "data-slot": "vk-parts-box", "data-key": p, "aria-required": req(p) || undefined, value: attio && p === "line1" ? street : draft[p] ?? "", placeholder: wordOf(country, p, { phone: true, attio, words: w.parts }), autofill: false, enterKeyHint: p === lastText ? "done" : "next", onChange: (e) => (attio && p === "line1" ? setStreet(e.target.value) : set(p, e.target.value)), onKeyDown: enter }) }, p))), !first && takesCountry && countryRow] }));
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
156
|
-
const countryPart = (_jsx("div", { className: "o-compound-editor-cell", "data-part": "country", "data-pick": "country", children: pickBox("country") }, "country"));
|
|
156
|
+
const countryPart = (_jsx("div", { className: "o-compound-editor-cell", "data-slot": "vk-parts-field", "data-key": "country", "data-part": "country", "data-pick": "country", children: pickBox("country") }, "country"));
|
|
157
157
|
body = (_jsxs("div", { className: "o-compound-editor-fields", role: "group", "aria-label": label, children: [first && takesCountry && countryPart, rows.map((row) => _jsx(PartsRow, { children: row.map((p) => box(p, true, enter)) }, row.join())), !first && takesCountry && countryPart] }));
|
|
158
158
|
}
|
|
159
|
-
const shellBody = _jsx("div", { ref: placeRoot, className: "o-compound-editor", "data-kit": "compound-editor", ...kit, "data-parts-form": "phone", ...device, "data-parts-step": list ?? undefined, children: body });
|
|
159
|
+
const shellBody = _jsx("div", { ref: placeRoot, className: "o-compound-editor", "data-slot": "vk-parts", "data-kit": "compound-editor", ...kit, "data-parts-form": "phone", ...device, "data-parts-step": list ?? undefined, children: body });
|
|
160
160
|
if (list)
|
|
161
|
-
return { body: shellBody, head: { onBack: back, close: false }, title: list === "countries" ? w.country : regionWord };
|
|
161
|
+
return { body: shellBody, head: { onBack: back, backSlot: "vk-editor-back", close: false }, title: list === "countries" ? w.country : regionWord };
|
|
162
162
|
if (shell)
|
|
163
163
|
return { body: shellBody, head: {} };
|
|
164
|
-
return { body: shellBody, head: { left: _jsx(SheetButton, { "aria-label": "Close", icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { kind: "primary", "aria-label": "Save", icon: glyph(TICK), onClick: keep }) } };
|
|
164
|
+
return { body: shellBody, head: { left: _jsx(SheetButton, { "data-slot": "vk-editor-close", "aria-label": "Close", icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": "Save", icon: glyph(TICK), onClick: keep }) } };
|
|
165
165
|
}
|
|
166
166
|
const inList = (t) => t instanceof Element && !!t.closest(".o-select-list");
|
|
167
167
|
const onBlur = (e) => { if (!shell && !swapping.current)
|
|
@@ -189,7 +189,7 @@ export function usePlaceParts(props, worn, wornAt) {
|
|
|
189
189
|
function listBox(k) {
|
|
190
190
|
const to = k === "country" ? "countries" : "region", word = k === "country" ? w.country : regionWord;
|
|
191
191
|
const value = k === "country" ? draft.countryCode ?? null : typedRegion ? TYPED : draft.regionCode ?? null;
|
|
192
|
-
const select = (_jsx(Select, { size: "sm", items: k === "country" ? countryListItems : regionListItems, value: value, onValueChange: (v) => { const c = typeof v === "string" ? v : ""; if (k === "country")
|
|
192
|
+
const select = (_jsx(Select, { size: "sm", "data-slot": "vk-parts-box", "data-key": k, items: k === "country" ? countryListItems : regionListItems, value: value, onValueChange: (v) => { const c = typeof v === "string" ? v : ""; if (k === "country")
|
|
193
193
|
pickCountry(c);
|
|
194
194
|
else if (c !== TYPED)
|
|
195
195
|
pickRegion(c); }, search: k === "country" ? countrySearch : regionSearch, clear: attio ? (k === "country" ? w.noCountry : w.noRegion(regionWord)) : undefined, pickerWords: w.picker, placeholder: k === "country" ? (fields ? w.chooseCountry : w.pick) : fields ? w.chooseRegion(regionWord) : "", open: list === to, onOpenChange: (o) => setList(o ? to : null) }));
|
|
@@ -201,25 +201,25 @@ export function usePlaceParts(props, worn, wornAt) {
|
|
|
201
201
|
const word = wordOf(country, p, { attio, phone: onPhone && fields, words: w.parts });
|
|
202
202
|
if (p === "region" && regionPick) {
|
|
203
203
|
return onPhone
|
|
204
|
-
? _jsx("div", { className: "o-compound-editor-cell", "data-part": p, "data-pick": "region", children: pickBox("region") }, p)
|
|
205
|
-
: _jsx("div", { className: "o-compound-editor-cell", "data-part": p, "data-pick": "region", children: listBox("region") }, p);
|
|
204
|
+
? _jsx("div", { className: "o-compound-editor-cell", "data-slot": "vk-parts-field", "data-key": p, "data-part": p, "data-pick": "region", children: pickBox("region") }, p)
|
|
205
|
+
: _jsx("div", { className: "o-compound-editor-cell", "data-slot": "vk-parts-field", "data-key": p, "data-part": p, "data-pick": "region", children: listBox("region") }, p);
|
|
206
206
|
}
|
|
207
207
|
const lines = attio && p === "line1";
|
|
208
208
|
const shown = lines ? street : draft[p] ?? "";
|
|
209
209
|
const change = (v) => (lines ? setStreet(v) : set(p, v));
|
|
210
210
|
if (fields)
|
|
211
|
-
return (_jsx("div", { className: "o-compound-editor-cell", "data-part": p, children: _jsx(Field, { label: word, required: req(p), children: lines
|
|
212
|
-
? _jsx(Input, { size: "sm", multiline: true, className: "o-compound-editor-text", "aria-required": req(p) || undefined, value: shown, placeholder: word, autofill: false, onChange: (e) => change(e.target.value) })
|
|
213
|
-
: _jsx(Input, { size: "sm", className: "o-compound-editor-text", "aria-required": req(p) || undefined, value: shown, placeholder: word, autofill: false, onChange: (e) => change(e.target.value) }) }) }, p));
|
|
211
|
+
return (_jsx("div", { className: "o-compound-editor-cell", "data-slot": "vk-parts-field", "data-key": p, "data-part": p, children: _jsx(Field, { label: word, required: req(p), children: lines
|
|
212
|
+
? _jsx(Input, { size: "sm", multiline: true, className: "o-compound-editor-text", "data-slot": "vk-parts-box", "data-key": p, "aria-required": req(p) || undefined, value: shown, placeholder: word, autofill: false, onChange: (e) => change(e.target.value) })
|
|
213
|
+
: _jsx(Input, { size: "sm", className: "o-compound-editor-text", "data-slot": "vk-parts-box", "data-key": p, "aria-required": req(p) || undefined, value: shown, placeholder: word, autofill: false, onChange: (e) => change(e.target.value) }) }) }, p));
|
|
214
214
|
const size = onPhone ? "lg" : "sm";
|
|
215
|
-
return (_jsx("div", { className: "o-compound-editor-cell", "data-part": p, children: _jsx(QuietField, { label: word, form: onPhone ? "phone" : "computer", required: req(p), children: lines
|
|
216
|
-
? _jsx(Input, { size: size, multiline: true, lines: onPhone ? 4 : 3, className: "o-compound-editor-text", "aria-required": req(p) || undefined, value: shown, autofill: false, onChange: (e) => change(e.target.value), onKeyDown: enter })
|
|
217
|
-
: _jsx(Input, { size: size, className: "o-compound-editor-text", "aria-required": req(p) || undefined, value: shown, autofill: false, enterKeyHint: onPhone && p === lastTextOf() ? "done" : "next", onChange: (e) => change(e.target.value), onKeyDown: enter }) }) }, p));
|
|
215
|
+
return (_jsx("div", { className: "o-compound-editor-cell", "data-slot": "vk-parts-field", "data-key": p, "data-part": p, children: _jsx(QuietField, { label: word, form: onPhone ? "phone" : "computer", required: req(p), children: lines
|
|
216
|
+
? _jsx(Input, { size: size, multiline: true, lines: onPhone ? 4 : 3, className: "o-compound-editor-text", "data-slot": "vk-parts-box", "data-key": p, "aria-required": req(p) || undefined, value: shown, autofill: false, onChange: (e) => change(e.target.value), onKeyDown: enter })
|
|
217
|
+
: _jsx(Input, { size: size, className: "o-compound-editor-text", "data-slot": "vk-parts-box", "data-key": p, "aria-required": req(p) || undefined, value: shown, autofill: false, enterKeyHint: onPhone && p === lastTextOf() ? "done" : "next", onChange: (e) => change(e.target.value), onKeyDown: enter }) }) }, p));
|
|
218
218
|
}
|
|
219
|
-
const countryPart = _jsx("div", { className: "o-compound-editor-cell", "data-part": "country", "data-pick": "country", children: listBox("country") }, "country");
|
|
219
|
+
const countryPart = _jsx("div", { className: "o-compound-editor-cell", "data-slot": "vk-parts-field", "data-key": "country", "data-part": "country", "data-pick": "country", children: listBox("country") }, "country");
|
|
220
220
|
const theParts = (_jsxs("div", { className: "o-compound-editor-fields", children: [first && takesCountry && countryPart, rows.map((row) => fields
|
|
221
221
|
? _jsx("div", { className: "o-compound-editor-frow", children: row.map((p) => box(p, false)) }, row.join())
|
|
222
222
|
: _jsx(PartsRow, { children: row.map((p) => box(p, false)) }, row.join())), !first && takesCountry && countryPart] }));
|
|
223
|
-
const body = (_jsx("div", { ref: placeRoot, className: "o-compound-editor", "data-kit": "compound-editor", ...kit, "data-parts-form": "computer", ...device, "data-parts-view": "fields", role: "group", "aria-label": label, tabIndex: -1, onBlur: onBlur, onFocus: () => { settled.current = false; }, onKeyDown: onKeyDown, children: theParts }));
|
|
223
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-compound-editor", "data-slot": "vk-parts", "data-kit": "compound-editor", ...kit, "data-parts-form": "computer", ...device, "data-parts-view": "fields", role: "group", "aria-label": label, tabIndex: -1, onBlur: onBlur, onFocus: () => { settled.current = false; }, onKeyDown: onKeyDown, children: theParts }));
|
|
224
224
|
return { body, head: {} };
|
|
225
225
|
}
|
|
@@ -63,8 +63,8 @@ export function useRangeParts(props, worn, wornAt) {
|
|
|
63
63
|
onDone?.("pick");
|
|
64
64
|
};
|
|
65
65
|
const held = bands?.find((b) => b.low === now.low && b.high === now.high)?.key ?? null;
|
|
66
|
-
const bandList = bands?.length ? (_jsx("div", { className: "o-compound-editor-bands", children: _jsx(Picker, { label: label, items: bands.map((b) => ({ value: b.key, label: b.label })), value: held, onValueChange: pickBand, searchShown: false, form: phone ? "phone" : "computer", draft: "shell", ...(w.picker ? { words: w.picker } : {}) }) })) : null;
|
|
67
|
-
const clearedNote = cleared && _jsx("p", { className: "o-compound-editor-note", "data-bad": "", role: "alert", children: `This can't be empty. Closing keeps ${rangeText(value)}.` });
|
|
66
|
+
const bandList = bands?.length ? (_jsx("div", { className: "o-compound-editor-bands", "data-slot": "vk-parts-bands", children: _jsx(Picker, { label: label, items: bands.map((b) => ({ value: b.key, label: b.label })), value: held, onValueChange: pickBand, searchShown: false, form: phone ? "phone" : "computer", draft: "shell", ...(w.picker ? { words: w.picker } : {}) }) })) : null;
|
|
67
|
+
const clearedNote = cleared && _jsx("p", { className: "o-compound-editor-note", "data-slot": "vk-parts-note", "data-bad": "", role: "alert", children: `This can't be empty. Closing keeps ${rangeText(value)}.` });
|
|
68
68
|
const onKeyDown = (e) => {
|
|
69
69
|
if (midWord(e.nativeEvent))
|
|
70
70
|
return;
|
|
@@ -83,10 +83,10 @@ export function useRangeParts(props, worn, wornAt) {
|
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
const kit = { "data-parts-kind": "range", "data-parts-boxes": worn.boxes, role: "group", "aria-label": label };
|
|
86
|
-
const note = unit && _jsx("p", { className: "o-compound-editor-note", children: unit });
|
|
87
|
-
const boxes = (arrows, onPhone) => (_jsx(PartsRow, { children: ENDS.map(([k, name], i) => (_jsx(QuietField, { label: name, form: onPhone ? "phone" : "computer", children: _jsx(EndField, { words: numberWords, value: now[k], set: set(k), box: i === 0 ? first : undefined, phone: onPhone, arrows: arrows, format: format }) }, k))) }));
|
|
86
|
+
const note = unit && _jsx("p", { className: "o-compound-editor-note", "data-slot": "vk-parts-note", children: unit });
|
|
87
|
+
const boxes = (arrows, onPhone) => (_jsx(PartsRow, { children: ENDS.map(([k, name], i) => (_jsx(QuietField, { label: name, form: onPhone ? "phone" : "computer", "data-slot": "vk-parts-field", "data-key": k, children: _jsx(EndField, { part: k, words: numberWords, value: now[k], set: set(k), box: i === 0 ? first : undefined, phone: onPhone, arrows: arrows, format: format }) }, k))) }));
|
|
88
88
|
if (phone) {
|
|
89
|
-
const body = (_jsxs("div", { ref: root, className: "o-compound-editor", "data-kit": "compound-editor", ...kit, "data-parts-form": "phone", ...device, onKeyDown: (e) => {
|
|
89
|
+
const body = (_jsxs("div", { ref: root, className: "o-compound-editor", "data-slot": "vk-parts", "data-kit": "compound-editor", ...kit, "data-parts-form": "phone", ...device, onKeyDown: (e) => {
|
|
90
90
|
if (e.key !== "Enter" || midWord(e.nativeEvent))
|
|
91
91
|
return;
|
|
92
92
|
e.preventDefault();
|
|
@@ -97,23 +97,23 @@ export function useRangeParts(props, worn, wornAt) {
|
|
|
97
97
|
ends[1].focus({ preventScroll: true });
|
|
98
98
|
else
|
|
99
99
|
keep();
|
|
100
|
-
}, children: [fields ? (_jsx(FieldRows, { look: MIHAI_CARD, className: "o-compound-editor-card", children: ENDS.map(([k, name], i) => (_jsx(FieldRow, { label: name, className: "o-compound-editor-card-row", labelClassName: "o-compound-editor-card-label", children: _jsx(CardEnd, { words: numberWords, value: now[k], set: set(k), box: i === 0 ? first : undefined, format: format }) }, k))) })) : boxes(false, true), note, clearedNote, bandList] }));
|
|
100
|
+
}, children: [fields ? (_jsx(FieldRows, { look: MIHAI_CARD, className: "o-compound-editor-card", "data-slot": "vk-parts-card", children: ENDS.map(([k, name], i) => (_jsx(FieldRow, { label: name, className: "o-compound-editor-card-row", "data-slot": "vk-parts-field", "data-key": k, labelClassName: "o-compound-editor-card-label", children: _jsx(CardEnd, { part: k, words: numberWords, value: now[k], set: set(k), box: i === 0 ? first : undefined, format: format }) }, k))) })) : boxes(false, true), note, clearedNote, bandList] }));
|
|
101
101
|
if (shell)
|
|
102
102
|
return { body, head: {} };
|
|
103
|
-
return { body, head: { left: _jsx(SheetButton, { "aria-label": "Close", icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { kind: "primary", "aria-label": "Save", icon: glyph(TICK), onClick: keep }) } };
|
|
103
|
+
return { body, head: { left: _jsx(SheetButton, { "data-slot": "vk-editor-close", "aria-label": "Close", icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": "Save", icon: glyph(TICK), onClick: keep }) } };
|
|
104
104
|
}
|
|
105
|
-
const body = (_jsxs("div", { ref: root, className: "o-compound-editor", "data-kit": "compound-editor", ...kit, "data-parts-form": "computer", ...device, onKeyDown: onKeyDown, onBlur: shell ? undefined : (e) => blurKeeps(settled, keep)(e), onFocus: () => { settled.current = false; }, children: [fields ? (_jsx("div", { className: "o-compound-editor-pair", children: ENDS.map(([k, name], i) => (_jsxs(React.Fragment, { children: [i === 1 && _jsx("span", { className: "o-compound-editor-dash", "aria-hidden": "true", children: "\u2013" }), _jsx(Field, { label: name, children: _jsx(PairField, { words: numberWords, value: now[k], set: set(k), box: i === 0 ? first : undefined, format: format }) })] }, k))) })) : boxes(worn.arrows === "editing", false), note, clearedNote, bandList] }));
|
|
105
|
+
const body = (_jsxs("div", { ref: root, className: "o-compound-editor", "data-slot": "vk-parts", "data-kit": "compound-editor", ...kit, "data-parts-form": "computer", ...device, onKeyDown: onKeyDown, onBlur: shell ? undefined : (e) => blurKeeps(settled, keep)(e), onFocus: () => { settled.current = false; }, children: [fields ? (_jsx("div", { className: "o-compound-editor-pair", "data-slot": "vk-parts-pair", children: ENDS.map(([k, name], i) => (_jsxs(React.Fragment, { children: [i === 1 && _jsx("span", { className: "o-compound-editor-dash", "aria-hidden": "true", children: "\u2013" }), _jsx(Field, { label: name, "data-slot": "vk-parts-field", "data-key": k, children: _jsx(PairField, { part: k, words: numberWords, value: now[k], set: set(k), box: i === 0 ? first : undefined, format: format }) })] }, k))) })) : boxes(worn.arrows === "editing", false), note, clearedNote, bandList] }));
|
|
106
106
|
return { body, head: {} };
|
|
107
107
|
}
|
|
108
|
-
function EndField({ words, value, set, box, phone, arrows, format }) {
|
|
108
|
+
function EndField({ part, words, value, set, box, phone, arrows, format }) {
|
|
109
109
|
const root = React.useCallback((el) => box?.(el?.querySelector("input") ?? null), [box]);
|
|
110
|
-
return _jsx(NumberField, { ref: root, words: words, size: phone ? "lg" : "sm", align: "end", steppers: arrows ? "arrows" : false, autofill: false, value: value, onValueChange: (v) => set(v), format: format });
|
|
110
|
+
return _jsx(NumberField, { ref: root, "data-slot": "vk-parts-box", "data-key": part, words: words, size: phone ? "lg" : "sm", align: "end", steppers: arrows ? "arrows" : false, autofill: false, value: value, onValueChange: (v) => set(v), format: format });
|
|
111
111
|
}
|
|
112
|
-
function CardEnd({ words, value, set, box, format }) {
|
|
112
|
+
function CardEnd({ part, words, value, set, box, format }) {
|
|
113
113
|
const root = React.useCallback((el) => box?.(el?.querySelector("input") ?? null), [box]);
|
|
114
|
-
return _jsx(NumberField, { ref: root, words: words, chrome: "bare", autofill: false, value: value, onValueChange: (v) => set(v), format: format });
|
|
114
|
+
return _jsx(NumberField, { ref: root, "data-slot": "vk-parts-box", "data-key": part, words: words, chrome: "bare", autofill: false, value: value, onValueChange: (v) => set(v), format: format });
|
|
115
115
|
}
|
|
116
|
-
function PairField({ words, value, set, box, format }) {
|
|
116
|
+
function PairField({ part, words, value, set, box, format }) {
|
|
117
117
|
const root = React.useCallback((el) => box?.(el?.querySelector("input") ?? null), [box]);
|
|
118
|
-
return _jsx(NumberField, { ref: root, words: words, size: "sm", steppers: false, autofill: false, value: value, onValueChange: (v) => set(v), format: format });
|
|
118
|
+
return _jsx(NumberField, { ref: root, "data-slot": "vk-parts-box", "data-key": part, words: words, size: "sm", steppers: false, autofill: false, value: value, onValueChange: (v) => set(v), format: format });
|
|
119
119
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { FieldRowsLook } from "../field/looks.js";
|
|
3
3
|
/** One part: its quiet label over its control, the Field's. */
|
|
4
|
-
export declare function QuietField({ label, form, required, children }: {
|
|
4
|
+
export declare function QuietField({ label, form, required, children, ...part }: {
|
|
5
5
|
label: string;
|
|
6
6
|
form: "computer" | "phone";
|
|
7
7
|
required?: boolean;
|
|
8
8
|
children: React.ReactNode;
|
|
9
|
+
"data-slot"?: string;
|
|
10
|
+
"data-key"?: string;
|
|
9
11
|
}): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
/** Two parts side by side; one alone spans the width. */
|
|
11
13
|
export declare function PartsRow({ children }: {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Field } from "../field/field.js";
|
|
5
|
-
export function QuietField({ label, form, required, children }) {
|
|
6
|
-
return _jsx(Field, { label: label, quietLabel: true, form: form, required: required, children: children });
|
|
5
|
+
export function QuietField({ label, form, required, children, ...part }) {
|
|
6
|
+
return _jsx(Field, { label: label, quietLabel: true, form: form, required: required, ...part, children: children });
|
|
7
7
|
}
|
|
8
8
|
export function PartsRow({ children }) {
|
|
9
9
|
const n = React.Children.toArray(children).filter(Boolean).length;
|
|
@@ -7,6 +7,7 @@ import { MapSheet } from "./sheet/map-sheet.js";
|
|
|
7
7
|
import { MapCheckbox } from "./checkbox/map-checkbox.js";
|
|
8
8
|
import { MapInput } from "./input/map-input.js";
|
|
9
9
|
import { MapMenu } from "./menu/map-menu.js";
|
|
10
|
+
import { MapSelect } from "./select/map-select.js";
|
|
10
11
|
import { MapSortBody } from "./sort-editor/map-sort-body.js";
|
|
11
12
|
import { MapViewsListBody } from "./views-list/map-views-list-body.js";
|
|
12
13
|
import { MapViewMenu } from "./views-list/map-view-menu.js";
|
|
@@ -36,6 +37,7 @@ export declare const CONTROLS: {
|
|
|
36
37
|
Input: typeof MapInput;
|
|
37
38
|
Checkbox: typeof MapCheckbox;
|
|
38
39
|
Menu: typeof MapMenu;
|
|
40
|
+
Select: typeof MapSelect;
|
|
39
41
|
SortBody: typeof MapSortBody;
|
|
40
42
|
ViewsListBody: typeof MapViewsListBody;
|
|
41
43
|
ViewMenu: typeof MapViewMenu;
|
|
@@ -9,6 +9,7 @@ import { MapSheet } from "./sheet/map-sheet.js";
|
|
|
9
9
|
import { MapCheckbox } from "./checkbox/map-checkbox.js";
|
|
10
10
|
import { MapInput } from "./input/map-input.js";
|
|
11
11
|
import { MapMenu } from "./menu/map-menu.js";
|
|
12
|
+
import { MapSelect } from "./select/map-select.js";
|
|
12
13
|
import { MapSortBody } from "./sort-editor/map-sort-body.js";
|
|
13
14
|
import { MapViewsListBody } from "./views-list/map-views-list-body.js";
|
|
14
15
|
import { MapViewMenu } from "./views-list/map-view-menu.js";
|
|
@@ -38,6 +39,7 @@ export const CONTROLS = carryAtoms({
|
|
|
38
39
|
Input: MapInput,
|
|
39
40
|
Checkbox: MapCheckbox,
|
|
40
41
|
Menu: MapMenu,
|
|
42
|
+
Select: MapSelect,
|
|
41
43
|
SortBody: MapSortBody,
|
|
42
44
|
ViewsListBody: MapViewsListBody,
|
|
43
45
|
ViewMenu: MapViewMenu,
|
|
@@ -117,21 +117,22 @@ export function useCustomize(props) {
|
|
|
117
117
|
h.land();
|
|
118
118
|
} holds.current = []; }, []);
|
|
119
119
|
const layout = layouts.find((l) => l.id === view.layout) ?? layouts[0];
|
|
120
|
-
const
|
|
120
|
+
const part = (slot, key) => ({ slot: { slot, ...(key !== undefined ? { key } : {}) } });
|
|
121
|
+
const section = (label, icon, s, key) => s ? [{ kind: "actions", icon, label, detail: s.says, inForce: s.inForce, entries: [], ...part("vk-customize-section", key) }] : [];
|
|
121
122
|
const toggleRows = (ts) => ts.flatMap((t) => [
|
|
122
|
-
{ kind: "check", label: t.label, checked: t.value, onCheckedChange: (on) => t.onChange(on), ...(t.icon != null && { icon: t.icon }) },
|
|
123
|
-
...(t.reset ? [{ icon: null, label: w.toggleReset(t.label), onSelect: t.reset }] : []),
|
|
123
|
+
{ kind: "check", label: t.label, checked: t.value, onCheckedChange: (on) => t.onChange(on), ...(t.icon != null && { icon: t.icon }), ...part("vk-customize-toggle", t.key) },
|
|
124
|
+
...(t.reset ? [{ icon: null, label: w.toggleReset(t.label), onSelect: t.reset, ...part("vk-customize-toggle-reset", t.key) }] : []),
|
|
124
125
|
]);
|
|
125
126
|
const sectionsOfToggles = (ts) => [...new Set(ts.flatMap((t) => (t.section ? [t.section] : [])))];
|
|
126
127
|
const checks = toggles
|
|
127
128
|
? [...toggleRows(toggles.filter((t) => !t.section)),
|
|
128
129
|
...sectionsOfToggles(toggles).map((s) => ({ kind: "group", heading: s, entries: toggleRows(toggles.filter((t) => t.section === s)) }))]
|
|
129
|
-
: [{ kind: "check", label: w.showCounts, checked: view.counts, onCheckedChange: (c) => change({ ...latest.view, counts: c }) }];
|
|
130
|
+
: [{ kind: "check", label: w.showCounts, checked: view.counts, onCheckedChange: (c) => change({ ...latest.view, counts: c }), ...part("vk-customize-toggle", "counts") }];
|
|
130
131
|
const fieldRows = new Map();
|
|
131
132
|
const fieldRow = (f) => {
|
|
132
133
|
const entry = f.disabled != null
|
|
133
|
-
? { icon: f.icon ?? null, label: f.label, disabled: f.disabled }
|
|
134
|
-
: { kind: "actions", icon: f.icon ?? null, label: f.label, detail: f.says, inForce: f.inForce, entries: [] };
|
|
134
|
+
? { icon: f.icon ?? null, label: f.label, disabled: f.disabled, ...part("vk-customize-field", f.key) }
|
|
135
|
+
: { kind: "actions", icon: f.icon ?? null, label: f.label, detail: f.says, inForce: f.inForce, entries: [], ...part("vk-customize-field", f.key) };
|
|
135
136
|
if (f.disabled == null)
|
|
136
137
|
fieldRows.set(entry, f.key);
|
|
137
138
|
return entry;
|
|
@@ -146,10 +147,10 @@ export function useCustomize(props) {
|
|
|
146
147
|
const inForceFields = filterFields.filter((f) => f.inForce).length;
|
|
147
148
|
const foldedFilter = folded ? { says: inForceFields ? String(inForceFields) : w.none, inForce: inForceFields > 0 } : undefined;
|
|
148
149
|
const sections = [
|
|
149
|
-
...(hasLayout ? [{ kind: "actions", icon: layout?.mark, label: w.layout, detail: layout?.name, entries: [] }] : []),
|
|
150
|
-
...(hasColumns ? [{ kind: "actions", icon: COLUMNS, label: w.columns, detail: columnsSay(view.columns, w), entries: [] }] : []),
|
|
150
|
+
...(hasLayout ? [{ kind: "actions", icon: layout?.mark, label: w.layout, detail: layout?.name, entries: [], ...part("vk-customize-section", "layout") }] : []),
|
|
151
|
+
...(hasColumns ? [{ kind: "actions", icon: COLUMNS, label: w.columns, detail: columnsSay(view.columns, w), entries: [], ...part("vk-customize-section", "columns") }] : []),
|
|
151
152
|
...(folded ? [] : fieldEntries(filterFields, true)),
|
|
152
|
-
...section(w.filter, _jsx(Icon, { name: "filter" }), filter ?? foldedFilter), ...section(w.sort, _jsx(Icon, { name: "sort" }), sort), ...section(w.group, GROUP, group),
|
|
153
|
+
...section(w.filter, _jsx(Icon, { name: "filter" }), filter ?? foldedFilter, "filter"), ...section(w.sort, _jsx(Icon, { name: "sort" }), sort, "sort"), ...section(w.group, GROUP, group, "group"),
|
|
153
154
|
...(folded ? [] : fieldEntries(afterFields)),
|
|
154
155
|
...(checks.length ? [{ kind: "separator" }, ...checks] : []),
|
|
155
156
|
];
|
|
@@ -195,10 +196,10 @@ export function useCustomize(props) {
|
|
|
195
196
|
} if ("label" in e && SCREEN_OF[e.label])
|
|
196
197
|
go(SCREEN_OF[e.label]); };
|
|
197
198
|
const footer = [
|
|
198
|
-
...(onCopyLink ? [{ icon: _jsx(Icon, { name: "link" }), label: w.copyLink, onSelect: onCopyLink }] : []),
|
|
199
|
-
...(onExport ? [{ icon: _jsx(Icon, { name: "export" }), label: w.export, ...(exportCount != null ? { count: exportCount } : {}), onSelect: onExport }] : []),
|
|
199
|
+
...(onCopyLink ? [{ icon: _jsx(Icon, { name: "link" }), label: w.copyLink, onSelect: onCopyLink, ...part("vk-customize-action", "copy-link") }] : []),
|
|
200
|
+
...(onExport ? [{ icon: _jsx(Icon, { name: "export" }), label: w.export, ...(exportCount != null ? { count: exportCount } : {}), onSelect: onExport, ...part("vk-customize-action", "export") }] : []),
|
|
200
201
|
];
|
|
201
|
-
const words = (size) => (_jsxs(_Fragment, { children: [stale && _jsx(Notice, { className: "o-customize-stale", children: w.stale }), _jsxs("div", { className: "o-customize-words", children: [_jsx(Button, { kind: "link", size: size, onClick: onReset, disabled: pending, children: w.reset }), onSave && _jsx(Button, { kind: "link", size: size, onClick: onSave, disabled: pending, children: w.save })] })] }));
|
|
202
|
+
const words = (size) => (_jsxs(_Fragment, { children: [stale && _jsx(Notice, { className: "o-customize-stale", "data-slot": "vk-customize-stale", children: w.stale }), _jsxs("div", { className: "o-customize-words", "data-slot": "vk-customize-changes", children: [_jsx(Button, { kind: "link", size: size, "data-slot": "vk-customize-action", "data-key": "reset", onClick: onReset, disabled: pending, children: w.reset }), onSave && _jsx(Button, { kind: "link", size: size, "data-slot": "vk-customize-action", "data-key": "save", onClick: onSave, disabled: pending, children: w.save })] })] }));
|
|
202
203
|
const col = screen === "columns" && column ? view.columns.find((c) => c.id === column && columnOpens(c)) : undefined;
|
|
203
204
|
React.useLayoutEffect(() => { if (column && !col) {
|
|
204
205
|
setColumn(null);
|
|
@@ -215,30 +216,31 @@ export function useCustomize(props) {
|
|
|
215
216
|
? _jsx(MenuList, { label: label, entries: rows, onOpen: choiceOpened, words: w.rows })
|
|
216
217
|
: _jsx(MenuListPanelRows, { label: label, entries: rows, ticks: "switch", onOpen: choiceOpened, words: w.rows }));
|
|
217
218
|
const choiceRow = (c) => {
|
|
218
|
-
const entry = { kind: "choices", icon: null, label: c.label, value: c.value, choices: c.options.map((o) => ({ value: o.value, label: o.label })),
|
|
219
|
-
detail: c.options.find((o) => o.value === c.value)?.label };
|
|
219
|
+
const entry = { kind: "choices", icon: null, label: c.label, value: c.value, choices: c.options.map((o) => ({ value: o.value, label: o.label, ...part("vk-customize-option", o.value) })),
|
|
220
|
+
detail: c.options.find((o) => o.value === c.value)?.label, ...part("vk-customize-choice", c.key) };
|
|
220
221
|
choiceRows.set(entry, c);
|
|
221
222
|
return entry;
|
|
222
223
|
};
|
|
223
224
|
const choice = allChoices.find((c) => c.key === choosing);
|
|
224
225
|
const backFromChoice = () => { setBack(true); setFocusTo(choice?.label ?? null); setChoosing(null); };
|
|
225
226
|
const choiceLevel = choice && (() => {
|
|
226
|
-
const rows = [{ kind: "pick", value: choice.value, choices: choice.options.map((o) => ({ value: o.value, label: o.label })),
|
|
227
|
+
const rows = [{ kind: "pick", value: choice.value, choices: choice.options.map((o) => ({ value: o.value, label: o.label, ...part("vk-customize-option", o.value) })),
|
|
227
228
|
onChoose: (v) => { if (v !== choice.value)
|
|
228
229
|
choice.onChange(v); backFromChoice(); } }];
|
|
229
230
|
return phone ? _jsx(MenuList, { label: choice.label, entries: rows, words: w.rows }) : _jsx(MenuListPanelRows, { label: choice.label, entries: rows, words: w.rows });
|
|
230
231
|
})();
|
|
231
|
-
const heading = (label, act) => (_jsxs("div", { className: "o-customize-heading", children: [_jsx("p", { className: "o-list-heading o-customize-heading-words", children: label }), act?.map((a) => _jsx(Button, { kind: "link", size: "line", onClick: a.onPress, children: a.label }, a.label))] }));
|
|
232
|
+
const heading = (label, key, act) => (_jsxs("div", { className: "o-customize-heading", "data-slot": "vk-customize-heading", "data-key": key, children: [_jsx("p", { className: "o-list-heading o-customize-heading-words", children: label }), act?.map((a) => _jsx(Button, { kind: "link", size: "line", "data-slot": "vk-customize-columns-action", "data-key": a.key, onClick: a.onPress, children: a.label }, a.label))] }));
|
|
233
|
+
const headingWords = (label, key) => _jsx("p", { className: "o-list-heading o-customize-heading-words", "data-slot": "vk-customize-heading", "data-key": key, children: label });
|
|
232
234
|
const ownSettings = (settings, name, lead = [], own) => {
|
|
233
235
|
const bare = settings.toggles.filter((t) => !t.section), sectioned = sectionsOfToggles(settings.toggles);
|
|
234
236
|
const first = [...lead, ...settings.choices.map(choiceRow), ...toggleRows(bare)];
|
|
235
|
-
const you = settings.personal, yours = you ? [...you.choices.map(choiceRow), ...toggleRows(you.toggles), ...(you.onReset ? [{ icon: null, label: w.personalReset, onSelect: you.onReset }] : [])] : [];
|
|
236
|
-
return _jsxs(_Fragment, { children: [first.length > 0 && _jsxs(_Fragment, { children: [!own &&
|
|
237
|
+
const you = settings.personal, yours = you ? [...you.choices.map(choiceRow), ...toggleRows(you.toggles), ...(you.onReset ? [{ icon: null, label: w.personalReset, onSelect: you.onReset, ...part("vk-customize-toggle-reset", "personal") }] : [])] : [];
|
|
238
|
+
return _jsxs(_Fragment, { children: [first.length > 0 && _jsxs(_Fragment, { children: [!own && headingWords(name, own === undefined ? layout?.id ?? name : name), rowsList(own?.list ?? w.layoutSettings(name), first)] }), sectioned.map((s) => _jsxs(React.Fragment, { children: [headingWords(s, s), rowsList(s, toggleRows(settings.toggles.filter((t) => t.section === s)))] }, s)), you && yours.length > 0 && _jsxs(_Fragment, { children: [headingWords(you.label, "you"), rowsList(you.label, yours)] })] });
|
|
237
239
|
};
|
|
238
240
|
const layoutScreen = (_jsxs(_Fragment, { children: [_jsx(RadioGroup, { tiles: true, "aria-label": w.layout, value: view.layout, onValueChange: (v) => { if (typeof v === "string")
|
|
239
|
-
change({ ...latest.view, layout: v }); }, children: layouts.map((l) => _jsx(Radio, { value: l.id, mark: l.mark, label: l.name, disabled: l.later }, l.id)) }), layoutSettings ? ownSettings(layoutSettings, layout?.name ?? w.layout) : layout?.id === "table" && _jsxs(_Fragment, { children: [
|
|
240
|
-
{ kind: "check", label: w.freeze, checked: view.freeze, onCheckedChange: (c) => change({ ...latest.view, freeze: c }) },
|
|
241
|
-
{ kind: "check", label: w.wrap, checked: view.wrap, onCheckedChange: (c) => change({ ...latest.view, wrap: c }) },
|
|
241
|
+
change({ ...latest.view, layout: v }); }, children: layouts.map((l) => _jsx(Radio, { value: l.id, mark: l.mark, label: l.name, disabled: l.later, "data-slot": "vk-customize-layout", "data-key": l.id }, l.id)) }), layoutSettings ? ownSettings(layoutSettings, layout?.name ?? w.layout) : layout?.id === "table" && _jsxs(_Fragment, { children: [headingWords(layout.name, layout.id), rowsList(w.layoutSettings(layout.name), [
|
|
242
|
+
{ kind: "check", label: w.freeze, checked: view.freeze, onCheckedChange: (c) => change({ ...latest.view, freeze: c }), ...part("vk-customize-toggle", "freeze") },
|
|
243
|
+
{ kind: "check", label: w.wrap, checked: view.wrap, onCheckedChange: (c) => change({ ...latest.view, wrap: c }), ...part("vk-customize-toggle", "wrap") },
|
|
242
244
|
])] })] }));
|
|
243
245
|
const searching = find.trim() !== "", eyes = worn.columns === "eye";
|
|
244
246
|
const found = findColumns(view.columns, find);
|
|
@@ -251,7 +253,7 @@ export function useCustomize(props) {
|
|
|
251
253
|
const block = (shown) => {
|
|
252
254
|
const grips = new Set(gripped(found, shown).map((c) => c.id));
|
|
253
255
|
return found.filter((c) => c.shown === shown).map((c) => {
|
|
254
|
-
const entry = { kind: "check", label: c.label, icon: c.mark, checked: held[c.id] ?? c.shown, grip: grips.has(c.id),
|
|
256
|
+
const entry = { kind: "check", label: c.label, icon: c.mark, checked: held[c.id] ?? c.shown, grip: grips.has(c.id), ...part("vk-customize-column", c.id),
|
|
255
257
|
disabled: c.locked ? w.alwaysShown : undefined, onCheckedChange: (on) => press([c.id], on),
|
|
256
258
|
...(columnOpens(c) && { opens: w.columnSettings(c.label) }),
|
|
257
259
|
...(c.line && { toggle: { icon: lineMark, label: c.line.on ? w.newLineOn(c.label) : w.newLineStart(c.label), on: c.line.on, onPress: () => onLineChange?.(c.id),
|
|
@@ -273,26 +275,26 @@ export function useCustomize(props) {
|
|
|
273
275
|
const canHide = view.columns.some((c) => c.shown && !c.locked), canShow = view.columns.some((c) => !c.shown);
|
|
274
276
|
const shownHere = found.some((c) => c.shown), hiddenHere = found.some((c) => !c.shown);
|
|
275
277
|
const typed = (e) => setFind(e.target.value);
|
|
276
|
-
const columnsBox = (_jsxs(InputGroup, { size: phone ? "lg" : "sm", chrome: "soft", children: [_jsx(InputGroupAddon, { children: _jsx(Icon, { name: "search" }) }), _jsx(Input, { value: find, onChange: typed, placeholder: phone ? w.findColumn : w.searchColumns, "aria-label": phone ? w.findColumn : w.searchColumns })] }));
|
|
278
|
+
const columnsBox = (_jsxs(InputGroup, { size: phone ? "lg" : "sm", chrome: "soft", "data-slot": "vk-customize-search", children: [_jsx(InputGroupAddon, { children: _jsx(Icon, { name: "search" }) }), _jsx(Input, { value: find, onChange: typed, placeholder: phone ? w.findColumn : w.searchColumns, "aria-label": phone ? w.findColumn : w.searchColumns })] }));
|
|
277
279
|
const columnsSearch = phone ? columnsBox : _jsx("div", { className: "o-customize-search", children: columnsBox });
|
|
278
280
|
const shownActs = [
|
|
279
|
-
...(!searching && canHide ? [{ label: w.hideAll, onPress: () => press(latest.view.columns.filter((c) => c.shown && !c.locked).map((c) => c.id), false) }] : []),
|
|
280
|
-
...(!searching && columnsReset ? [{ label: w.columnsReset, onPress: columnsReset }] : []),
|
|
281
|
+
...(!searching && canHide ? [{ key: "hide-all", label: w.hideAll, onPress: () => press(latest.view.columns.filter((c) => c.shown && !c.locked).map((c) => c.id), false) }] : []),
|
|
282
|
+
...(!searching && columnsReset ? [{ key: "reset", label: w.columnsReset, onPress: columnsReset }] : []),
|
|
281
283
|
];
|
|
282
|
-
const columnsScreen = (_jsxs(_Fragment, { children: [phone && columnsSearch, shownHere && _jsxs(_Fragment, { children: [heading(w.shownHeading, shownActs), rowsOf(w.shownHeading, true)] }), hiddenHere && _jsxs(_Fragment, { children: [heading(w.hiddenHeading, !searching && canShow ? [{ label: w.showAll, onPress: () => press(latest.view.columns.filter((c) => !c.shown).map((c) => c.id), true) }] : undefined), rowsOf(w.hiddenHeading, false)] }), !found.length && _jsx("p", { className: "o-customize-none", children: w.noColumn(find.trim()) }), columnsFoot != null && _jsx("div", { className: "o-customize-foot-rows", children: columnsFoot })] }));
|
|
284
|
+
const columnsScreen = (_jsxs(_Fragment, { children: [phone && columnsSearch, shownHere && _jsxs(_Fragment, { children: [heading(w.shownHeading, "shown", shownActs), rowsOf(w.shownHeading, true)] }), hiddenHere && _jsxs(_Fragment, { children: [heading(w.hiddenHeading, "hidden", !searching && canShow ? [{ key: "show-all", label: w.showAll, onPress: () => press(latest.view.columns.filter((c) => !c.shown).map((c) => c.id), true) }] : undefined), rowsOf(w.hiddenHeading, false)] }), !found.length && _jsx("p", { className: "o-customize-none", children: w.noColumn(find.trim()) }), columnsFoot != null && _jsx("div", { className: "o-customize-foot-rows", children: columnsFoot })] }));
|
|
283
285
|
const backFromColumn = () => { setBack(true); setFocusTo(col?.label ?? null); setColumn(null); setChoosing(null); };
|
|
284
|
-
const columnLevel = col && (_jsxs(_Fragment, { children: [ownSettings(col.settings ?? { choices: [], toggles: [] }, col.label, col.locked ? [] : [{ kind: "check", label: w.columnShown, checked: held[col.id] ?? col.shown, onCheckedChange: (on) => press([col.id], on) }], { list: w.columnSettings(col.label) }), col.rows != null && _jsxs("div", { className: "o-customize-rows", children: [(!col.locked || columnOpensBySettings(col)) && _jsx("div", { role: "separator", className: "o-list-sep" }), col.rows] })] }));
|
|
286
|
+
const columnLevel = col && (_jsxs(_Fragment, { children: [ownSettings(col.settings ?? { choices: [], toggles: [] }, col.label, col.locked ? [] : [{ kind: "check", label: w.columnShown, checked: held[col.id] ?? col.shown, onCheckedChange: (on) => press([col.id], on), ...part("vk-customize-toggle", "shown") }], { list: w.columnSettings(col.label) }), col.rows != null && _jsxs("div", { className: "o-customize-rows", children: [(!col.locked || columnOpensBySettings(col)) && _jsx("div", { role: "separator", className: "o-list-sep" }), col.rows] })] }));
|
|
285
287
|
const rowsOfField = (label, rows) => (phone
|
|
286
288
|
? _jsx(MenuList, { label: label, entries: rows, words: w.rows }) : _jsx(MenuListPanelRows, { label: label, entries: rows, ticks: "box", words: w.rows }));
|
|
287
289
|
const fieldScreen = field && (() => {
|
|
288
290
|
const o = field.opens;
|
|
289
291
|
if ("pick" in o)
|
|
290
292
|
return o.pick.choices.length === 0 ? _jsx("p", { className: "o-customize-none", children: w.nothingToPick })
|
|
291
|
-
: rowsOfField(field.label, [{ kind: "pick", value: o.pick.value, choices: o.pick.choices, onChoose: (v) => { if (v !== o.pick.value)
|
|
293
|
+
: rowsOfField(field.label, [{ kind: "pick", value: o.pick.value, choices: o.pick.choices.map((c) => ({ ...c, ...part("vk-customize-option", c.value) })), onChoose: (v) => { if (v !== o.pick.value)
|
|
292
294
|
o.pick.onChoose(v); backFromField(); } }]);
|
|
293
295
|
if ("check" in o)
|
|
294
296
|
return o.check.choices.length === 0 ? _jsx("p", { className: "o-customize-none", children: w.nothingToPick })
|
|
295
|
-
: rowsOfField(field.label, o.check.choices.map((c) => ({ kind: "check", label: c.label, ...(c.mark != null && { icon: c.mark }), checked: o.check.values.includes(c.value),
|
|
297
|
+
: rowsOfField(field.label, o.check.choices.map((c) => ({ kind: "check", label: c.label, ...(c.mark != null && { icon: c.mark }), ...part("vk-customize-option", c.value), checked: o.check.values.includes(c.value),
|
|
296
298
|
onCheckedChange: (on) => o.check.onChange(on ? [...o.check.values, c.value] : o.check.values.filter((v) => v !== c.value)) })));
|
|
297
299
|
return typeof o.body === "function" ? o.body(backFromField) : o.body;
|
|
298
300
|
})();
|
|
@@ -312,15 +314,15 @@ export function useCustomize(props) {
|
|
|
312
314
|
const titled = !named;
|
|
313
315
|
const step = choice ? (col ? `columns:${col.id}:${choice.key}` : `layout:${choice.key}`) : col ? `columns:${col.id}` : field ? `field:${field.key}` : screen;
|
|
314
316
|
if (phone) {
|
|
315
|
-
const body = (_jsx("div", { ref: placeRoot, className: "o-customize", "data-kit": "customize", "data-customize-form": form, "data-customize-screen": screen, ...phoneMark(!!host || small), ...MENU_LIST_CARD_FRAME, children: _jsx(SheetStep, { step: step, back: back, children: _jsx("div", { className: "o-customize-step", children: content }) }) }));
|
|
316
|
-
const foot = screen === "list" && (changed || footer.length) ? (_jsxs("div", { className: "o-customize-foot", ...MENU_LIST_CARD_FRAME, children: [changed && words("44"), footer.length > 0 && _jsx(MenuList, { label: w.share, entries: footer, words: w.rows })] })) : undefined;
|
|
317
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-customize", "data-slot": "vk-customize", "data-kit": "customize", "data-customize-form": form, "data-customize-screen": screen, ...phoneMark(!!host || small), ...MENU_LIST_CARD_FRAME, children: _jsx(SheetStep, { step: step, back: back, children: _jsx("div", { className: "o-customize-step", children: content }) }) }));
|
|
318
|
+
const foot = screen === "list" && (changed || footer.length) ? (_jsxs("div", { className: "o-customize-foot", "data-slot": "vk-customize-foot", ...MENU_LIST_CARD_FRAME, children: [changed && words("44"), footer.length > 0 && _jsx(MenuList, { label: w.share, entries: footer, words: w.rows })] })) : undefined;
|
|
317
319
|
return { body, title: name, head: screen === "list" ? { close: true } : { onBack: backTo, close: titled }, foot, level };
|
|
318
320
|
}
|
|
319
321
|
const title = (words) => (inPane ? _jsx(PaneTitle, { children: words }) : _jsx("h2", { className: "o-pane-title", children: words }));
|
|
320
|
-
const xButton = (extra) => _jsx(Button, { kind: "quiet", shape: "icon", size: "sm", "aria-label": w.close, icon: _jsx(Icon, { name: "x" }), ...extra });
|
|
322
|
+
const xButton = (extra) => _jsx(Button, { kind: "quiet", shape: "icon", size: "sm", "data-slot": "vk-customize-close", "aria-label": w.close, icon: _jsx(Icon, { name: "x" }), ...extra });
|
|
321
323
|
const close = inPane ? _jsx(PaneClose, { render: xButton() }) : onClose ? xButton({ onClick: onClose }) : null;
|
|
322
|
-
const head = screen !== "list" ? (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-screen", children: [_jsx(Button, { ref: backButton, kind: "quiet", shape: "icon", size: "sm", "aria-label": w.back, icon: _jsx(Icon, { name: "left" }), onClick: backTo }), _jsx("span", { className: "o-customize-title", children: title(name) }), titled && close] })) : titled ? (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-title", children: [_jsx("span", { className: "o-customize-title", children: title(w.title) }), close] })) : (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-name", children: [hasLayout && _jsx(Button, { kind: "outline", shape: "icon", size: "sm", "aria-label": w.layoutButton(layout?.name ?? ""), icon: layout?.mark, onClick: () => go("layout") }), _jsx(ViewName, { name: view.name, label: w.viewName, onRename: (n) => change({ ...latest.view, name: n }) })] }));
|
|
323
|
-
const parts = (_jsxs(_Fragment, { children: [head, screen === "columns" && !col && columnsSearch, _jsx(PaneBody, { children: _jsx("div", { ref: placeRoot, className: "o-customize", "data-kit": "customize", "data-customize-form": form, "data-customize-screen": screen, ...phoneMark(!!host || small), ...MENU_LIST_CARD_FRAME, children: _jsx(React.Fragment, { children: content }, step) }) }), screen === "list" && changed && words("xs"), footer.length > 0 && _jsx(PaneFoot, { children: _jsx(MenuListPanelRows, { label: w.share, entries: footer, words: w.rows }) })] }));
|
|
324
|
+
const head = screen !== "list" ? (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-screen", "data-slot": "vk-customize-head", children: [_jsx(Button, { ref: backButton, kind: "quiet", shape: "icon", size: "sm", "data-slot": "vk-customize-back", "aria-label": w.back, icon: _jsx(Icon, { name: "left" }), onClick: backTo }), _jsx("span", { className: "o-customize-title", "data-slot": "vk-customize-title", children: title(name) }), titled && close] })) : titled ? (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-title", "data-slot": "vk-customize-head", children: [_jsx("span", { className: "o-customize-title", "data-slot": "vk-customize-title", children: title(w.title) }), close] })) : (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-name", "data-slot": "vk-customize-head", children: [hasLayout && _jsx(Button, { kind: "outline", shape: "icon", size: "sm", "data-slot": "vk-customize-layout-button", "aria-label": w.layoutButton(layout?.name ?? ""), icon: layout?.mark, onClick: () => go("layout") }), _jsx(ViewName, { name: view.name, label: w.viewName, onRename: (n) => change({ ...latest.view, name: n }) })] }));
|
|
325
|
+
const parts = (_jsxs(_Fragment, { children: [head, screen === "columns" && !col && columnsSearch, _jsx(PaneBody, { children: _jsx("div", { ref: placeRoot, className: "o-customize", "data-slot": "vk-customize", "data-kit": "customize", "data-customize-form": form, "data-customize-screen": screen, ...phoneMark(!!host || small), ...MENU_LIST_CARD_FRAME, children: _jsx(React.Fragment, { children: content }, step) }) }), screen === "list" && changed && words("xs"), footer.length > 0 && _jsx(PaneFoot, { "data-slot": "vk-customize-foot", children: _jsx(MenuListPanelRows, { label: w.share, entries: footer, words: w.rows }) })] }));
|
|
324
326
|
return { body: inPane ? parts : _jsx("div", { className: "o-customize-frame", children: parts }), title: name, head: {}, level };
|
|
325
327
|
}
|
|
326
328
|
function ViewName({ name, label, onRename }) {
|
|
@@ -332,7 +334,7 @@ function ViewName({ name, label, onRename }) {
|
|
|
332
334
|
onRename(n);
|
|
333
335
|
else
|
|
334
336
|
setDraft(name); };
|
|
335
|
-
return (_jsx("span", { className: "o-customize-name", children: _jsx(Input, { size: "sm", "aria-label": label, value: draft, onChange: (e) => setDraft(e.target.value), onBlur: keep, onKeyDown: (e) => {
|
|
337
|
+
return (_jsx("span", { className: "o-customize-name", children: _jsx(Input, { size: "sm", "data-slot": "vk-customize-name", "aria-label": label, value: draft, onChange: (e) => setDraft(e.target.value), onBlur: keep, onKeyDown: (e) => {
|
|
336
338
|
if (e.key === "Enter") {
|
|
337
339
|
e.preventDefault();
|
|
338
340
|
keep();
|
|
@@ -12,4 +12,6 @@ export declare function customizeWordsOf(say: ViewsMessageResolver): CustomizeWo
|
|
|
12
12
|
* refused one writes nothing) and its columns that differs. Columns, one or several shown or hidden (Hide all, Show all) or moved,
|
|
13
13
|
* through ViewKit's own, in one change. */
|
|
14
14
|
export declare function customizeWriteOf(p: ViewsCustomizeBodyProps, own: CustomizeBodyOwn, now: CustomizeView, next: CustomizeView): (() => void) | null;
|
|
15
|
+
/** ViewKit's Customize, its sort and filter drawing the app's controls where the provider's `panelControls` names them
|
|
16
|
+
* (VK-1013); Customize's own controls stay ViewKit's for now (VK-1014). */
|
|
15
17
|
export declare function MapCustomizeBody(props: ViewsCustomizeBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -17,6 +17,7 @@ import { SheetPartsFrom } from "../sheet/sheet-parts.js";
|
|
|
17
17
|
import { sortEditorPropsOf, sortEditorWordsOf } from "../sort-editor/map-sort-body.js";
|
|
18
18
|
import { sortLabel } from "../sort-editor/rules.js";
|
|
19
19
|
import { useSortEditor } from "../sort-editor/sort-editor.js";
|
|
20
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
20
21
|
import { layoutMark, useCustomize } from "./customize.js";
|
|
21
22
|
import { DateRangeBody, useTimeRange } from "./map-ranges.js";
|
|
22
23
|
const BACK = ["M5 12l14 0", "M5 12l6 6", "M5 12l6 -6"];
|
|
@@ -113,6 +114,9 @@ const NO_GROUP = { label: "", dimensions: [], group: { value: "none" }, manualOr
|
|
|
113
114
|
const stay = () => undefined;
|
|
114
115
|
const levelOf = (parts) => parts.title !== undefined && parts.head.onBack ? { name: parts.title, back: parts.head.onBack } : null;
|
|
115
116
|
export function MapCustomizeBody(props) {
|
|
117
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(CustomizeBodyInner, { ...props }) });
|
|
118
|
+
}
|
|
119
|
+
function CustomizeBodyInner(props) {
|
|
116
120
|
const { name, onRename, exportCount, onCopyLink, onExport, ...p } = props;
|
|
117
121
|
const views = React.useContext(ViewsContext);
|
|
118
122
|
const say = views?.messages ?? resolveViewsMessage;
|
|
@@ -16,9 +16,9 @@ export function DateDays({ year, month, keyDay, picked, today, names, weekdays,
|
|
|
16
16
|
};
|
|
17
17
|
React.useEffect(() => { if (moved.current) {
|
|
18
18
|
moved.current = false;
|
|
19
|
-
grid.current?.querySelector("[data-
|
|
19
|
+
grid.current?.querySelector("[data-stop]")?.focus({ preventScroll: true });
|
|
20
20
|
} }, [keyDay]);
|
|
21
21
|
const cells = monthGrid(year, month);
|
|
22
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "o-date-editor-weekdays", "aria-hidden": "true", children: weekdays.map((d, i) => _jsx("span", { children: d }, i)) }), _jsx("div", { ref: grid, role: "grid", "aria-label": `${names.months[month]} ${year}`, className: big ? "o-date-editor-days o-date-editor-days-phone" : "o-date-editor-days", onKeyDown: step, children: [0, 1, 2, 3, 4, 5].map((r) => (_jsx("div", { role: "row", className: "o-date-editor-week", children: cells.slice(r * 7, r * 7 + 7).map((day, i) => (_jsx("div", { role: "gridcell", "aria-selected": day && day === picked ? true : undefined, className: "o-date-editor-cell", children: day && _jsx("button", { type: "button", "aria-label": lineText(day, names), className: "o-date-editor-day", tabIndex: day === keyDay ? 0 : -1, disabled: off?.(day) || undefined, "data-today": day === today ? "" : undefined, "data-
|
|
22
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "o-date-editor-weekdays", "data-slot": "vk-date-weekdays", "aria-hidden": "true", children: weekdays.map((d, i) => _jsx("span", { children: d }, i)) }), _jsx("div", { ref: grid, role: "grid", "aria-label": `${names.months[month]} ${year}`, className: big ? "o-date-editor-days o-date-editor-days-phone" : "o-date-editor-days", "data-slot": "vk-date-days", onKeyDown: step, children: [0, 1, 2, 3, 4, 5].map((r) => (_jsx("div", { role: "row", className: "o-date-editor-week", children: cells.slice(r * 7, r * 7 + 7).map((day, i) => (_jsx("div", { role: "gridcell", "aria-selected": day && day === picked ? true : undefined, className: "o-date-editor-cell", children: day && _jsx("button", { type: "button", "aria-label": lineText(day, names), className: "o-date-editor-day", "data-slot": "vk-date-day", tabIndex: day === keyDay ? 0 : -1, disabled: off?.(day) || undefined, "data-today": day === today ? "" : undefined, "data-stop": day === keyDay ? "" : undefined, "data-picked": day === picked ? "" : undefined, "data-reads": reads && day === reads ? "" : undefined, onKeyDown: (e) => { if (e.key !== "Enter")
|
|
23
23
|
return; e.preventDefault(); (onEnter ?? onPick)(day); }, onClick: () => onPick(day), children: Number(day.slice(8)) }) }, i))) }, r))) })] }));
|
|
24
24
|
}
|