viewkitjs 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +139 -0
- package/package.json +1 -1
- package/views/README.md +1 -1
- package/views/dist/atoms/Avatar.js +2 -1
- package/views/dist/atoms/RelationChip.d.ts +2 -0
- package/views/dist/atoms/RelationChip.js +5 -0
- package/views/dist/atoms/RowMenu.d.ts +1 -1
- package/views/dist/atoms/RowMenu.js +15 -3
- package/views/dist/atoms/defaults.js +2 -0
- package/views/dist/atoms/types.d.ts +40 -4
- package/views/dist/cells/relation-wrap.js +9 -2
- package/views/dist/contract.d.ts +27 -14
- package/views/dist/contract.js +40 -4
- package/views/dist/controls/alert/alert.js +2 -1
- package/views/dist/controls/alert-dialog/alert-dialog.js +3 -2
- package/views/dist/controls/avatar/avatar-mark.d.ts +4 -0
- package/views/dist/controls/avatar/avatar-mark.js +5 -0
- package/views/dist/controls/avatar/avatar.d.ts +7 -4
- package/views/dist/controls/avatar/avatar.js +10 -4
- package/views/dist/controls/avatar/looks.d.ts +1 -1
- package/views/dist/controls/avatar/looks.js +3 -0
- package/views/dist/controls/avatar/record-mark.d.ts +16 -0
- package/views/dist/controls/avatar/record-mark.js +13 -0
- package/views/dist/controls/avatar/tokens.d.ts +12 -0
- package/views/dist/controls/avatar/tokens.js +3 -0
- package/views/dist/controls/avatar.css +54 -17
- package/views/dist/controls/bulk-bar/bulk-bar.js +29 -27
- package/views/dist/controls/bulk-bar/map-selection-bar.js +2 -1
- package/views/dist/controls/compound-editor/compound-editor.d.ts +3 -0
- package/views/dist/controls/compound-editor/map-parts-body.d.ts +1 -1
- package/views/dist/controls/compound-editor/map-parts-body.js +6 -1
- package/views/dist/controls/compound-editor/name-parts.js +2 -1
- package/views/dist/controls/compound-editor/place-parts.js +2 -2
- package/views/dist/controls/compound-editor/range-parts.js +10 -9
- package/views/dist/controls/controls.d.ts +2 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/customize/customize.d.ts +14 -5
- package/views/dist/controls/customize/customize.js +19 -20
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -2
- package/views/dist/controls/customize/map-customize-body.js +15 -13
- package/views/dist/controls/customize/words.d.ts +3 -3
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -0
- package/views/dist/controls/date-editor/date-editor.js +13 -7
- package/views/dist/controls/date-editor/map-calendar.js +2 -0
- package/views/dist/controls/date-editor/map-date-body.d.ts +1 -1
- package/views/dist/controls/date-editor/map-date-body.js +7 -3
- package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +4 -6
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +2 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -4
- package/views/dist/controls/filter-editor/parts.d.ts +4 -2
- package/views/dist/controls/filter-editor/parts.js +8 -7
- package/views/dist/controls/group-editor/group-editor.js +2 -1
- package/views/dist/controls/group-editor/map-group-body.d.ts +1 -0
- package/views/dist/controls/group-editor/map-group-body.js +5 -1
- package/views/dist/controls/index.d.ts +1 -1
- package/views/dist/controls/input/input.js +2 -1
- package/views/dist/controls/internal/head-button.d.ts +9 -0
- package/views/dist/controls/internal/head-button.js +13 -0
- package/views/dist/controls/internal/map-panel-controls.js +9 -5
- package/views/dist/controls/internal/panel-controls.d.ts +38 -6
- package/views/dist/controls/internal/panel-controls.js +191 -19
- package/views/dist/controls/links-editor/links-editor.js +5 -7
- package/views/dist/controls/links-editor/map-links-body.d.ts +1 -1
- package/views/dist/controls/links-editor/map-links-body.js +5 -1
- package/views/dist/controls/menu/menu.d.ts +5 -1
- package/views/dist/controls/menu/menu.js +4 -3
- package/views/dist/controls/modal/modal.js +5 -3
- package/views/dist/controls/number-editor/map-number-body.js +5 -1
- package/views/dist/controls/number-editor/number-editor.js +6 -6
- package/views/dist/controls/pane/map-pane.d.ts +3 -0
- package/views/dist/controls/pane/map-pane.js +5 -0
- package/views/dist/controls/picker/map-fields-body.d.ts +2 -2
- package/views/dist/controls/picker/map-fields-body.js +30 -2
- package/views/dist/controls/picker/map-picker.d.ts +8 -3
- package/views/dist/controls/picker/map-picker.js +14 -3
- package/views/dist/controls/picker/picker.js +11 -8
- package/views/dist/controls/picker/rows.d.ts +7 -2
- package/views/dist/controls/picker.css +10 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +2 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +9 -4
- package/views/dist/controls/quick-filters/quick-filters.js +8 -6
- package/views/dist/controls/quick-filters/reminder.js +2 -2
- package/views/dist/controls/quick-filters/rules.d.ts +4 -1
- package/views/dist/controls/quick-filters/words.d.ts +2 -0
- package/views/dist/controls/quick-filters/words.js +1 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +9 -3
- package/views/dist/controls/setting-row/looks.js +5 -5
- package/views/dist/controls/setting-row/setting-row.d.ts +3 -1
- package/views/dist/controls/setting-row/setting-row.js +3 -1
- package/views/dist/controls/setting-row.css +3 -2
- package/views/dist/controls/sheet/bottom-sheet.d.ts +3 -1
- package/views/dist/controls/sheet/bottom-sheet.js +2 -2
- package/views/dist/controls/sort-editor/map-sort-body.js +4 -4
- package/views/dist/controls/sort-editor/sort-editor.d.ts +2 -0
- package/views/dist/controls/sort-editor/sort-editor.js +4 -5
- package/views/dist/controls/text-editor/map-text-body.js +5 -1
- package/views/dist/controls/text-editor/text-editor.js +5 -4
- package/views/dist/controls/toolbar/toolbar.d.ts +29 -14
- package/views/dist/controls/toolbar/toolbar.js +17 -22
- package/views/dist/controls/toolbar.css +0 -5
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +4 -2
- package/views/dist/controls/values-editor/map-values-body.d.ts +1 -2
- package/views/dist/controls/values-editor/map-values-body.js +5 -1
- package/views/dist/controls/values-editor/values-editor.js +8 -7
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -2
- package/views/dist/controls/views-list/map-view-menu.js +6 -2
- package/views/dist/controls/views-list/map-views-list-body.d.ts +2 -1
- package/views/dist/controls/views-list/map-views-list-body.js +6 -5
- package/views/dist/controls/views-list/view-menu.js +3 -4
- package/views/dist/controls/views-list/views-list.js +2 -2
- package/views/dist/display/option-badges.d.ts +16 -0
- package/views/dist/display/option-badges.js +11 -0
- package/views/dist/display/relation-link.d.ts +12 -0
- package/views/dist/display/relation-link.js +17 -0
- package/views/dist/display/relation.d.ts +1 -1
- package/views/dist/display/relation.js +10 -3
- package/views/dist/display/select.js +1 -8
- package/views/dist/editors/EditorPanel.js +4 -4
- package/views/dist/editors/RangeEditor.d.ts +3 -0
- package/views/dist/editors/RangeEditor.js +2 -2
- package/views/dist/editors/SelectEditor.d.ts +2 -2
- package/views/dist/editors/SelectEditor.js +1 -1
- package/views/dist/editors/TextEditor.js +4 -2
- package/views/dist/editors/ValueListEditor.js +2 -1
- package/views/dist/field-row/FieldRow.js +32 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +2 -1
- package/views/dist/grid/chrome/GridAddColumn.js +9 -6
- package/views/dist/grid/chrome/GridCellEditors.js +1 -1
- package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -1
- package/views/dist/grid/chrome/GridCellOutline.js +16 -6
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +7 -4
- package/views/dist/grid/chrome/GridFooter.d.ts +4 -1
- package/views/dist/grid/chrome/GridFooter.js +4 -4
- package/views/dist/grid/chrome/GridGroupMenu.js +39 -14
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -1
- package/views/dist/grid/chrome/GridHeader.js +1 -2
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +4 -1
- package/views/dist/grid/chrome/GridRangeEditor.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +5 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +4 -1
- package/views/dist/grid/chrome/GridRowActions.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +3 -2
- package/views/dist/grid/chrome/GridStructure.js +1 -1
- package/views/dist/grid/chrome/GridTable.js +32 -20
- package/views/dist/grid/chrome/checks.d.ts +1 -1
- package/views/dist/grid/chrome/checks.js +4 -1
- package/views/dist/grid/chrome/grid-cell-classes.d.ts +6 -2
- package/views/dist/grid/chrome/grid-cell-classes.js +10 -5
- package/views/dist/grid/chrome/grid-hover.d.ts +10 -2
- package/views/dist/grid/chrome/grid-hover.js +14 -4
- package/views/dist/grid/chrome/grid-row-props.d.ts +4 -0
- package/views/dist/grid/chrome/grid-rows-menu.js +9 -4
- package/views/dist/grid/chrome/grid-table-props.d.ts +10 -2
- package/views/dist/grid/grid.css +6 -0
- package/views/dist/grid/looks.d.ts +3 -1
- package/views/dist/grid/looks.js +10 -4
- package/views/dist/list/layer.d.ts +8 -0
- package/views/dist/list/layer.js +7 -0
- package/views/dist/list/list.d.ts +6 -2
- package/views/dist/list/list.js +6 -2
- package/views/dist/list/parts.js +3 -2
- package/views/dist/list/store.d.ts +1 -1
- package/views/dist/list/toolbar.js +51 -20
- package/views/dist/list/views.js +1 -0
- package/views/dist/panels/availability.d.ts +5 -0
- package/views/dist/panels/availability.js +4 -5
- package/views/dist/panels/customize-body.d.ts +4 -0
- package/views/dist/panels/customize-body.js +13 -11
- package/views/dist/panels/model.d.ts +9 -4
- package/views/dist/panels/react/customize-body.js +5 -2
- package/views/dist/panels/react/customize.d.ts +5 -0
- package/views/dist/panels/react/filter/FilterEditor.d.ts +6 -0
- package/views/dist/panels/react/filter/FilterEditor.js +7 -0
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +3 -1
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +7 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +17 -1
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +15 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +24 -9
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +3 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +14 -6
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +7 -3
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +21 -10
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +5 -4
- package/views/dist/panels/react/toolbar/ToolbarSort.d.ts +7 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +6 -3
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +3 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +7 -6
- package/views/dist/panels/react/toolbar/context.d.ts +21 -0
- package/views/dist/panels/react/toolbar/context.js +4 -0
- package/views/dist/panels/react/toolbar/pane-host.d.ts +6 -0
- package/views/dist/panels/react/toolbar/pane-host.js +17 -0
- package/views/dist/panels/react/toolbar/panel-part.js +3 -2
- package/views/dist/panels/react/views-row/ViewPicker.js +13 -5
- package/views/dist/panels/react.d.ts +2 -2
- package/views/dist/panels/settings/layout.js +6 -38
- package/views/dist/panels/toolbar/page-resets.d.ts +17 -0
- package/views/dist/panels/toolbar/page-resets.js +62 -0
- package/views/dist/panels/toolbar/same-item.d.ts +7 -0
- package/views/dist/panels/toolbar/same-item.js +9 -0
- package/views/dist/panels/view-state.d.ts +4 -0
- package/views/dist/provider/ViewsProvider.d.ts +9 -3
- package/views/dist/provider/ViewsProvider.js +13 -2
- package/views/dist/provider/components.d.ts +59 -8
- package/views/dist/provider/components.js +1 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/styles.css +194 -100
- package/views/dist/styles.unlayered.css +194 -100
- package/views/docs/contract.md +96 -27
- package/views/docs/controls/alert-dialog.md +4 -0
- package/views/docs/controls/alert.md +4 -0
- package/views/docs/controls/avatar.md +3 -0
- package/views/docs/controls/bulk-bar.md +7 -1
- package/views/docs/controls/compound-editor.md +2 -0
- package/views/docs/controls/customize.md +3 -1
- package/views/docs/controls/date-editor.md +2 -0
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/group-editor.md +2 -0
- package/views/docs/controls/links-editor.md +2 -0
- package/views/docs/controls/menu.md +3 -1
- package/views/docs/controls/modal.md +4 -0
- package/views/docs/controls/number-editor.md +2 -0
- package/views/docs/controls/pane.md +1 -1
- package/views/docs/controls/picker.md +2 -0
- package/views/docs/controls/quick-filters.md +4 -2
- package/views/docs/controls/sheet.md +1 -1
- package/views/docs/controls/text-editor.md +3 -1
- package/views/docs/controls/toolbar.md +4 -0
- package/views/docs/controls/values-editor.md +2 -0
- package/views/docs/controls/views-list.md +2 -0
- package/views/docs/guides/atoms.md +54 -3
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/looks.md +1 -1
- package/views/docs/guides/the-grid.md +4 -2
- package/views/docs/guides/the-provider.md +4 -4
- package/views/docs/index.md +2 -2
- package/views/docs/install.md +198 -104
- package/views/docs/reference/controls.md +21 -17
- package/views/docs/reference/editors-range.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +2 -1
- package/views/docs/reference/list.md +7 -5
- package/views/docs/reference/looks.md +6 -6
- package/views/docs/reference/panels-react.md +17 -15
- package/views/docs/reference/panels.md +4 -4
- package/views/docs/reference/react.md +15 -12
- package/views/docs/reference/views.md +6 -4
- package/views/docs/reshaping.md +32 -5
- package/views/skills/views/SKILL.md +3 -3
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cx } from "../../internal/cx.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { InputGroup, InputGroupAddon } from "../input/input.js";
|
|
6
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
7
7
|
import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
|
|
8
8
|
import { scrollInList } from "../internal/scroll.js";
|
|
9
9
|
import { MenuListRow } from "../menu-list/menu-list.js";
|
|
@@ -73,6 +73,7 @@ const STANDS_PRESSED = { pressed: "hovered" };
|
|
|
73
73
|
const wornAttrs = (w) => ({ "data-date-line": w.line, "data-date-time": w.time, "data-date-days": w.days, "data-date-year": w.year, "data-date-picks": w.picks, "data-date-calendar": w.calendar });
|
|
74
74
|
const wheelOf = (opens) => (opens === "years" || opens === "months" ? "date" : opens === "time" ? "time" : "none");
|
|
75
75
|
export function useDateEditor(props) {
|
|
76
|
+
const { Button, Input, Calendar } = usePanelControls();
|
|
76
77
|
const [wornRef, worn] = useDateEditorWorn(props.worn);
|
|
77
78
|
const w = dateWords(props.words), names = dateNames(props.language);
|
|
78
79
|
const root = React.useRef(null);
|
|
@@ -186,6 +187,8 @@ export function useDateEditor(props) {
|
|
|
186
187
|
const [sy, sm] = parts(shownKey);
|
|
187
188
|
const dayGrid = (big, weekdays) => (_jsx(DateDays, { year: sy, month: sm, keyDay: shownKey, picked: date, today: today, names: names, weekdays: weekdays, big: big, off: off, reads: reading && "date" in reading ? reading.date : null, onPick: pick, onKeyMove: setKey, onEnter: (day) => { pick(day); if (phone || time)
|
|
188
189
|
keep(day, clock); } }));
|
|
190
|
+
const calendar = Calendar && (_jsx(Calendar, { "data-slot": "vk-calendar", value: date, month: `${sy}-${String(sm + 1).padStart(2, "0")}`, locale: props.locale ?? props.language ?? "en", onMonthChange: (m) => setKey(`${m}-01`), onChange: (day) => { const to = day ?? date; if (to)
|
|
191
|
+
pick(to); } }));
|
|
189
192
|
const row = phone ? worn.calendar === "plain" : worn.picks === "row";
|
|
190
193
|
const quick = (_jsx("div", { className: "o-date-editor-picks", "data-slot": "vk-date-picks", children: picks.map((p) => (_jsx(Button, { kind: "quiet", size: phone ? "lg" : row ? "2xs" : "sm", className: "o-date-editor-pick", "data-slot": "vk-date-pick", "data-key": p, look: phone ? (row ? PICK_PLAIN : PICK_CARDS) : row ? PICK_ROW : PICK_TWO, icon: glyph(row ? ROW_PICKS[p] : PICKS[p].icon), onClick: () => pick(p === "none" ? null : quickPick(p, today)), children: w[PICK_WORD[p]] }, p))) }));
|
|
191
194
|
if (phone) {
|
|
@@ -202,11 +205,12 @@ export function useDateEditor(props) {
|
|
|
202
205
|
setTime("09:00"); setWheel(wheel === w ? "none" : w); };
|
|
203
206
|
const plain = (_jsxs("div", { ref: placeRoot, className: "o-date-editor", "data-slot": "vk-date", "data-kit": "date-editor", "data-date-form": "phone", ...phoneMark(!!host || small), ...wornAttrs(worn), children: [_jsxs(InputGroup, { size: "lg", className: "o-date-editor-line", "data-slot": "vk-date-line", "data-bad": error ? "" : undefined, children: [_jsx(Input, { ref: line, className: "o-date-editor-input", "aria-label": label, placeholder: `${w.type}…`, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? "", enterKeyHint: "done", onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onKeyDown: (e) => { if (e.key !== "Enter" || e.nativeEvent.isComposing)
|
|
204
207
|
return; e.preventDefault(); if (take())
|
|
205
|
-
keep(dayOfLine(), clock); } }), reading && "date" in reading && _jsx(InputGroupAddon, { side: "end", children: _jsx("span", { className: "o-date-editor-reads", "data-slot": "vk-date-reads", children: lineText(reading.date, names) }) })] }), error && _jsx("p", { className: "o-date-editor-error", "data-slot": "vk-date-error", role: "alert", children: error }), _jsxs("div", { className: "o-date-editor-head", "data-slot": "vk-date-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-prev", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => setKey(addMonths(shownKey, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => setKey(addMonths(shownKey, 1)) }), _jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-heading", "data-slot": "vk-date-month", look: PLAIN_HEADING, "aria-expanded": wheel === "date", onClick: () => toggle("date"), children: names.months[sm] }), _jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-year", "data-slot": "vk-date-year", look: PLAIN_YEAR, "aria-expanded": wheel === "date", onClick: () => toggle("date"), children: String(sy) })] }), wheels ?? _jsx(_Fragment, { children: dayGrid(true, names.week) }), time && _jsx(DateParts, { form: "phone", words: w, onEnter: () => { if (take())
|
|
206
|
-
keep(dayOfLine(), clock); }, date: date, clock: clock, today: today, wheel: wheel, onWheel:
|
|
208
|
+
keep(dayOfLine(), clock); } }), reading && "date" in reading && _jsx(InputGroupAddon, { side: "end", children: _jsx("span", { className: "o-date-editor-reads", "data-slot": "vk-date-reads", children: lineText(reading.date, names) }) })] }), error && _jsx("p", { className: "o-date-editor-error", "data-slot": "vk-date-error", role: "alert", children: error }), !calendar && _jsxs("div", { className: "o-date-editor-head", "data-slot": "vk-date-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-prev", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => setKey(addMonths(shownKey, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => setKey(addMonths(shownKey, 1)) }), _jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-heading", "data-slot": "vk-date-month", look: PLAIN_HEADING, "aria-expanded": wheel === "date", onClick: () => toggle("date"), children: names.months[sm] }), _jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-year", "data-slot": "vk-date-year", look: PLAIN_YEAR, "aria-expanded": wheel === "date", onClick: () => toggle("date"), children: String(sy) })] }), calendar ? (wheel === "time" ? wheels : calendar) : wheels ?? _jsx(_Fragment, { children: dayGrid(true, names.week) }), time && _jsx(DateParts, { form: "phone", words: w, onEnter: () => { if (take())
|
|
209
|
+
keep(dayOfLine(), clock); }, date: date, clock: clock, today: today, wheel: wheel, onWheel: calendar ? (which) => { if (which === "time")
|
|
210
|
+
toggle(which); } : toggle, onDate: (d) => { setDate(d); setKey(d); hand(d, clock); }, onClock: setTime }), quick] }));
|
|
207
211
|
return { body: plain, head: shell ? {} : head };
|
|
208
212
|
}
|
|
209
|
-
const body = (_jsxs("div", { ref: placeRoot, className: "o-date-editor", "data-slot": "vk-date", "data-kit": "date-editor", "data-date-form": "phone", ...phoneMark(!!host || small), ...wornAttrs(worn), children: [
|
|
213
|
+
const body = (_jsxs("div", { ref: placeRoot, className: "o-date-editor", "data-slot": "vk-date", "data-kit": "date-editor", "data-date-form": "phone", ...phoneMark(!!host || small), ...wornAttrs(worn), children: [_jsx("div", { className: "o-date-editor-card", "data-slot": "vk-date-card", "data-key": "date", children: calendar || _jsxs(_Fragment, { children: [_jsxs("div", { className: "o-date-editor-card-head", "data-slot": "vk-date-head", children: [_jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-heading", "data-slot": "vk-date-month", look: CARD_HEADING, "aria-expanded": wheel === "date", iconEnd: glyph(wheel === "date" ? DOWN : RIGHT), onClick: () => setWheel(wheel === "date" ? "none" : "date"), children: `${names.months[sm]} ${sy}` }), wheel !== "date" && _jsxs("span", { className: "o-date-editor-arrows", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-prev", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => setKey(addMonths(shownKey, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => setKey(addMonths(shownKey, 1)) })] })] }), wheel === "date" ? (_jsxs("div", { className: "o-date-editor-wheels", "data-slot": "vk-date-wheels", children: [_jsx(Wheel, { name: "month", label: w.month, items: months, value: String(sm), onChange: (v) => setKey(addMonths(shownKey, Number(v) - sm)) }, "month"), _jsx(Wheel, { name: "year", label: w.year, items: years, value: String(sy), onChange: (v) => setKey(addMonths(shownKey, (Number(v) - sy) * 12)) }, "year")] })) : (_jsx(_Fragment, { children: dayGrid(true, names.weekUpper) }))] }) }), time && (_jsx("div", { className: "o-date-editor-card", "data-slot": "vk-date-card", "data-key": "time", children: wheel === "time" ? (_jsxs("div", { className: "o-date-editor-wheels", "data-slot": "vk-date-wheels", children: [_jsx(Wheel, { name: "hour", label: w.hour, items: hours, value: hh, onChange: (v) => setTime(`${v}:${mm}`) }, "hour"), _jsx(Wheel, { name: "minute", label: w.minute, items: mins, value: mm, onChange: (v) => setTime(`${hh}:${v}`) }, "minute")] })) : (_jsx(MenuListRow, { "data-slot": "vk-date-time", label: w.time, value: clock ?? w.addTime, onSelect: () => { if (!clock)
|
|
210
214
|
setTime("09:00"); setWheel("time"); } })) })), quick] }));
|
|
211
215
|
return { body, head: shell ? {} : head };
|
|
212
216
|
}
|
|
@@ -244,6 +248,8 @@ export function useDateEditor(props) {
|
|
|
244
248
|
e.preventDefault();
|
|
245
249
|
return;
|
|
246
250
|
} lineKeys(e); } }), reading && "date" in reading && _jsx(InputGroupAddon, { side: "end", children: _jsx("span", { className: "o-date-editor-reads", "data-slot": "vk-date-reads", children: lineText(reading.date, names) }) }), time && !inParts && _jsx(InputGroupAddon, { side: "end", flush: true, children: timeButton })] }));
|
|
251
|
+
const shownView = calendar && (view === "months" || view === "years") ? "days" : view;
|
|
252
|
+
const daysShown = shownView === "days" || (inParts && shownView === "time");
|
|
247
253
|
const refocus = (sel) => requestAnimationFrame(() => root.current?.querySelector(sel)?.focus({ preventScroll: true }));
|
|
248
254
|
const body = (_jsxs("div", { ref: rootRef, className: "o-date-editor", "data-slot": "vk-date", "data-kit": "date-editor", "data-date-form": "computer", ...phoneMark(!!host || small), ...wornAttrs(worn), onBlur: onBlur, onFocus: () => { settled.current = false; }, onKeyDown: shell ? undefined : (e) => { if (e.key === "Escape") {
|
|
249
255
|
e.preventDefault();
|
|
@@ -260,7 +266,7 @@ export function useDateEditor(props) {
|
|
|
260
266
|
setTyped("");
|
|
261
267
|
handTyped("");
|
|
262
268
|
return;
|
|
263
|
-
} lineKeys(e); } }), reading && "date" in reading && _jsx("span", { className: "o-date-editor-reads", "data-slot": "vk-date-reads", children: lineText(reading.date, names) }), time && !inParts && _jsxs(_Fragment, { children: [_jsx("span", { className: "o-date-editor-bar", "aria-hidden": "true" }), timeButton] })] }), error && _jsx("p", { className: "o-date-editor-error", "data-slot": "vk-date-error", role: "alert", children: error }), _jsxs("div", { className: "o-date-editor-head", "data-slot": "vk-date-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "data-slot": "vk-date-prev", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => moveMonth(-1) }), _jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => moveMonth(1) }), _jsx(Button, { kind: "quiet", size: "xs", className: "o-date-editor-month", "data-slot": "vk-date-month", look: STANDS_PRESSED, "aria-pressed": view === "months", onClick: () => setView(view === "months" ? "days" : "months"), children: names.months[sm] }), _jsx("span", { className: "o-date-editor-space" }), worn.year === "typed" && view === "years"
|
|
269
|
+
} lineKeys(e); } }), reading && "date" in reading && _jsx("span", { className: "o-date-editor-reads", "data-slot": "vk-date-reads", children: lineText(reading.date, names) }), time && !inParts && _jsxs(_Fragment, { children: [_jsx("span", { className: "o-date-editor-bar", "aria-hidden": "true" }), timeButton] })] }), error && _jsx("p", { className: "o-date-editor-error", "data-slot": "vk-date-error", role: "alert", children: error }), calendar && daysShown ? calendar : _jsxs("div", { className: "o-date-editor-head", "data-slot": "vk-date-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "data-slot": "vk-date-prev", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => moveMonth(-1) }), _jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => moveMonth(1) }), !calendar && _jsx(Button, { kind: "quiet", size: "xs", className: "o-date-editor-month", "data-slot": "vk-date-month", look: STANDS_PRESSED, "aria-pressed": view === "months", onClick: () => setView(view === "months" ? "days" : "months"), children: names.months[sm] }), _jsx("span", { className: "o-date-editor-space" }), calendar ? null : worn.year === "typed" && view === "years"
|
|
264
270
|
? _jsx(Input, { ref: yearRef, size: "xs", numeric: true, className: "o-date-editor-year-box", "data-slot": "vk-date-year", "aria-label": w.year, inputMode: "numeric", maxLength: 4, autofill: false, value: yearText ?? String(sy), onChange: (e) => { const t = e.target.value.replace(/\D/g, "").slice(0, 4), yr = yearTyped(t); setYearText(t); if (yr)
|
|
265
271
|
setKey(addMonths(shownKey, (yr - sy) * 12)); }, onKeyDown: (e) => { if (e.key === "Enter") {
|
|
266
272
|
e.preventDefault();
|
|
@@ -272,7 +278,7 @@ export function useDateEditor(props) {
|
|
|
272
278
|
: _jsx(Button, { kind: "quiet", size: "xs", className: "o-date-editor-year", "data-slot": "vk-date-year", look: STANDS_PRESSED, "aria-pressed": view === "years", onMouseDown: worn.year === "typed" ? hold : undefined, onClick: () => { if (view !== "years") {
|
|
273
279
|
setYearText(null);
|
|
274
280
|
yearFocus.current = worn.year === "typed";
|
|
275
|
-
} setView(view === "years" ? "days" : "years"); }, children: String(sy) })] }),
|
|
281
|
+
} setView(view === "years" ? "days" : "years"); }, children: String(sy) })] }), !calendar && daysShown && _jsx(_Fragment, { children: dayGrid(false, names.week) }), shownView === "months" && (_jsx("div", { className: "o-date-editor-choices", "data-slot": "vk-date-choices", "data-key": "months", role: "group", "aria-label": w.months, children: names.monthsShort.map((name, i) => _jsx("button", { type: "button", className: "o-date-editor-choice", "data-slot": "vk-date-choice", "data-key": String(i), onMouseDown: hold, "data-picked": i === sm ? "" : undefined, onClick: () => { setKey(addMonths(shownKey, i - sm)); setView("days"); refocus(".o-date-editor-day[data-stop]"); }, children: name }, i)) })), shownView === "years" && (_jsx("div", { className: "o-date-editor-choices", "data-slot": "vk-date-choices", "data-key": "years", role: "group", "aria-label": w.years, children: Array.from({ length: 12 }, (_, i) => sy - 5 + i).map((yr) => (_jsx("button", { type: "button", className: "o-date-editor-choice", "data-slot": "vk-date-choice", "data-key": String(yr), onMouseDown: hold, "data-picked": yr === sy ? "" : undefined, "data-today": yr === parts(today)[0] ? "" : undefined, onClick: () => { leaveYear(); setYearText(null); setKey(addMonths(shownKey, (yr - sy) * 12)); setView("months"); refocus(".o-date-editor-choice[data-picked]"); }, children: yr }, yr))) })), view === "time" && !inParts && (_jsx("div", { className: "o-date-editor-quarters", "data-slot": "vk-date-quarters", role: "group", "aria-label": w.time, children: QUARTERS.map((q) => _jsx("button", { type: "button", className: "o-date-editor-quarter", "data-slot": "vk-date-quarter", "data-key": q, onMouseDown: hold, "data-picked": q === clock ? "" : undefined, ref: q === (clock ?? "09:00") ? (el) => { if (el)
|
|
276
282
|
scrollInList(el, { block: "center" }); } : undefined, onClick: () => { setTime(q); setView("days"); refocus(".o-date-editor-time"); }, children: q }, q)) })), inParts && _jsx(DateParts, { form: "computer", words: w, onEnter: () => { if (take())
|
|
277
283
|
keep(dayOfLine(), clock); }, date: date, clock: clock, today: today, shownTyping: props.opens === "time", onDate: (d) => { setDate(d); setKey(d); setTyped(null); setError(null); hand(d, clock); }, onClock: setTime }), worn.picks === "two" && _jsx("div", { className: "o-date-editor-sep", "data-slot": "vk-date-sep" }), quick] }));
|
|
278
284
|
return { body, head: {} };
|
|
@@ -4,6 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { cx } from "../../internal/cx.js";
|
|
5
5
|
import { useViews } from "../../provider/context.js";
|
|
6
6
|
import { useMoment } from "../../provider/moment.js";
|
|
7
|
+
import { markOwnControl } from "../../provider/own-control.js";
|
|
7
8
|
import { Button } from "../button/button.js";
|
|
8
9
|
import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
|
|
9
10
|
import { addMonths, dateNames, parts, todayOf } from "./calendar.js";
|
|
@@ -38,3 +39,4 @@ export function MapCalendar({ value, onChange, min, max, month, onMonthChange, c
|
|
|
38
39
|
const arrows = phone ? "lg" : worn.days === "outlined" ? "2xs" : "xs";
|
|
39
40
|
return (_jsxs("div", { ref: wornRef, className: cx("o-date-editor o-date-calendar", className), "data-slot": "vk-calendar", "data-kit": "date-editor", "data-date-form": phone ? "phone" : "computer", ...phoneMark(phone), "data-date-days": worn.days, "data-date-year": worn.year, "data-date-calendar": worn.calendar, children: [_jsxs("div", { className: "o-date-editor-head", "data-slot": "vk-date-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "data-slot": "vk-date-prev", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => moveTo(addMonths(key, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => moveTo(addMonths(key, 1)) }), _jsx("span", { className: "o-date-editor-caption", "data-slot": "vk-date-month", children: names.months[m] }), _jsx("span", { className: "o-date-editor-space" }), _jsx("span", { className: "o-date-editor-caption o-date-editor-year", "data-slot": "vk-date-year", children: String(y) })] }), _jsx(DateDays, { year: y, month: m, keyDay: key, picked: value, today: today, names: names, weekdays: phone && worn.calendar === "cards" ? names.weekUpper : names.week, big: phone, off: off, onPick: onChange, onKeyMove: moveTo })] }));
|
|
40
41
|
}
|
|
42
|
+
markOwnControl(MapCalendar);
|
|
@@ -6,6 +6,6 @@ import type { DateEditorWords } from "./words.js";
|
|
|
6
6
|
* panel holds the phone's ✕ and ✓. */
|
|
7
7
|
export declare function dateEditorWordsOf(messages: FieldMessageResolver): Partial<DateEditorWords>;
|
|
8
8
|
/** ViewKit's date body's props as the Date editor's, held as a shell that keeps the draft. */
|
|
9
|
-
export declare function dateEditorPropsOf(props: ViewsDateBodyProps, words: Partial<DateEditorWords>, language: string): DateEditorProps;
|
|
9
|
+
export declare function dateEditorPropsOf(props: ViewsDateBodyProps, words: Partial<DateEditorWords>, language: string, locale?: string): DateEditorProps;
|
|
10
10
|
/** ViewKit's date body, drawn as the Date editor in the app's words and language. */
|
|
11
11
|
export declare function MapDateBody(props: ViewsDateBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { useViews } from "../../provider/context.js";
|
|
5
5
|
import { DateEditor } from "./date-editor.js";
|
|
6
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
6
7
|
export function dateEditorWordsOf(messages) {
|
|
7
8
|
const say = (key) => messages({ key });
|
|
8
9
|
return {
|
|
@@ -28,11 +29,14 @@ export function dateEditorWordsOf(messages) {
|
|
|
28
29
|
noSuchDay: (month, day) => messages({ key: "date.no-such-day", values: { month, day } }),
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
|
-
export function dateEditorPropsOf(props, words, language) {
|
|
32
|
-
return { ...props, draft: "shell", words, language };
|
|
32
|
+
export function dateEditorPropsOf(props, words, language, locale) {
|
|
33
|
+
return { ...props, draft: "shell", words, language, ...(locale ? { locale } : {}) };
|
|
33
34
|
}
|
|
34
35
|
export function MapDateBody(props) {
|
|
36
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(DateBodyInner, { ...props }) });
|
|
37
|
+
}
|
|
38
|
+
function DateBodyInner(props) {
|
|
35
39
|
const { conventions } = useViews();
|
|
36
40
|
const words = React.useMemo(() => dateEditorWordsOf(conventions.messages), [conventions.messages]);
|
|
37
|
-
return _jsx(DateEditor, { ...dateEditorPropsOf(props, words, conventions.language) });
|
|
41
|
+
return _jsx(DateEditor, { ...dateEditorPropsOf(props, words, conventions.language, conventions.locale) });
|
|
38
42
|
}
|
|
@@ -16,6 +16,8 @@ export interface FilterOwn {
|
|
|
16
16
|
export interface FilterEditorProps {
|
|
17
17
|
/** What it filters, as its shell names it ("Filter"): the Sheet's title on a phone, and the rules' name to a screen reader. */
|
|
18
18
|
label: string;
|
|
19
|
+
/** Clear all at its foot; default on. Off inside Customize, where its page's Reset stands in its place (VK-1034). */
|
|
20
|
+
clearAll?: boolean;
|
|
19
21
|
/** The fields a list filters by, each typed, a choice's values with it; one leading one level in (a deal's Company) holds its own. */
|
|
20
22
|
fields: FilterField[];
|
|
21
23
|
/** The view's filter: its rules, joined by its join, groups in it. */
|
|
@@ -7,10 +7,8 @@ import { asSelect, DOTS, DOTS_LOOK, DOTS_UP, glyph, MORE_LOOK, PLUS, TRASH, useD
|
|
|
7
7
|
import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
|
|
8
8
|
import { usePanelControls } from "../internal/panel-controls.js";
|
|
9
9
|
import { openerAt, useStepReturn } from "../internal/step-return.js";
|
|
10
|
-
import { NumberField } from "../number-field/number-field.js";
|
|
11
10
|
import { Picker, usePicker } from "../picker/picker.js";
|
|
12
11
|
import { itemLabel } from "../picker/rows.js";
|
|
13
|
-
import { Tooltip } from "../tooltip/tooltip.js";
|
|
14
12
|
import { HOW, wayOf } from "./how.js";
|
|
15
13
|
import { PairValue } from "./parts.js";
|
|
16
14
|
import { BlockHead, GroupMenu, MenuStep } from "./block.js";
|
|
@@ -39,7 +37,7 @@ function OwnValue({ name, own, open, onOpenChange, phone, size, placeholder }) {
|
|
|
39
37
|
export function useFilterEditor(props) {
|
|
40
38
|
const { label, fields, filter, onFilterChange, onDone, standing = false, ids, levels } = props;
|
|
41
39
|
const w = filterWords(props.words), words = w.picker ? { words: w.picker } : {};
|
|
42
|
-
const { Button, Select, Menu, Popover, Input } = usePanelControls();
|
|
40
|
+
const { Button, Select, Menu, Popover, Input, Tooltip, NumberBox } = usePanelControls();
|
|
43
41
|
const screen = React.useContext(PhoneHost), small = usePhone(), way = props.form ?? (screen || small ? "phone" : "computer");
|
|
44
42
|
const phone = way === "phone", stacked = phone || way === "narrow";
|
|
45
43
|
const now = React.useRef(filter);
|
|
@@ -191,7 +189,7 @@ export function useFilterEditor(props) {
|
|
|
191
189
|
return _jsx(DateValue, { name: name, value: typeof r.value === "string" ? r.value : null, onValue: set(r.id), open: !standing && isOpen, onOpenChange: phone ? (o) => { if (o)
|
|
192
190
|
setStep({ list: "value", rule: r.id }); } : onOpenChange, phone: phone, size: size, placeholder: w.chooseDate });
|
|
193
191
|
if (field.type === "number" || field.type === "range")
|
|
194
|
-
return _jsx(
|
|
192
|
+
return _jsx(NumberBox, { size: size, steppers: false, "aria-label": name, placeholder: w.typeNumber, value: typeof r.value === "number" ? r.value : null, onValueChange: (v) => set(r.id)(v ?? null) });
|
|
195
193
|
return _jsx(Input, { size: size, "aria-label": name, placeholder: w.typeValue, value: typeof r.value === "string" ? r.value : "", onChange: (e) => set(r.id)(e.target.value) });
|
|
196
194
|
};
|
|
197
195
|
function groupEntries(g) {
|
|
@@ -236,11 +234,11 @@ export function useFilterEditor(props) {
|
|
|
236
234
|
setAdding(null); }, anchor: adding?.at, className: "w-fit min-w-[calc(var(--vk-spacing,var(--spacing))*48)]", "aria-label": w.add, children: adding && _jsx(Picker, { label: w.add, items: fieldsIn(filter, adding.group, fields), value: null, onValueChange: (v) => add(adding.group, v), onDone: () => setAdding(null), search: w.search, searchShown: true, form: "computer", ...words }) }));
|
|
237
235
|
if (stacked) {
|
|
238
236
|
const body = (_jsx("div", { ref: placeRoot, className: "o-filter-editor", "data-slot": "vk-filter", "data-kit": "filter-editor", "data-filter-form": way, role: phone ? undefined : "group", "aria-label": phone ? undefined : label, tabIndex: -1, style: room ? { paddingBottom: room } : undefined, ...phoneMark(!!screen || small), "data-filter-step": stepTitle !== undefined ? step?.list : undefined, children: stepTitle !== undefined ? stepBody : _jsxs(_Fragment, { children: [top, filter.rules.length ? level(filter, 0)
|
|
239
|
-
: _jsxs("div", { className: "o-filter-editor-none", "data-slot": "vk-filter-none", children: [_jsx("p", { className: "o-filter-editor-none-head", children: w.none }), _jsx("p", { className: "o-filter-editor-none-line", children: w.noneLine })] }), _jsxs("div", { className: "o-filter-editor-acts", "data-slot": "vk-filter-foot", children: [addButton(filter.id, filter.rules.length ? "outline" : "primary", phone ? "44" : "sm"), filter.rules.length > 0 && _jsx(Button, { kind: "quiet", size: phone ? "44" : "sm", className: "o-filter-editor-clear", "data-slot": "vk-filter-clear", onClick: clear, children: w.clearAll }), props.excludable && groupMore(filter)] }), !phone && addingPopover] }) }));
|
|
237
|
+
: _jsxs("div", { className: "o-filter-editor-none", "data-slot": "vk-filter-none", children: [_jsx("p", { className: "o-filter-editor-none-head", children: w.none }), _jsx("p", { className: "o-filter-editor-none-line", children: w.noneLine })] }), _jsxs("div", { className: "o-filter-editor-acts", "data-slot": "vk-filter-foot", children: [addButton(filter.id, filter.rules.length ? "outline" : "primary", phone ? "44" : "sm"), props.clearAll !== false && filter.rules.length > 0 && _jsx(Button, { kind: "quiet", size: phone ? "44" : "sm", className: "o-filter-editor-clear", "data-slot": "vk-filter-clear", onClick: clear, children: w.clearAll }), props.excludable && groupMore(filter)] }), !phone && addingPopover] }) }));
|
|
240
238
|
return { body, head: !phone ? {} : stepTitle !== undefined ? { onBack: back } : decide.head, ...(stepTitle !== undefined ? { title: stepTitle } : {}) };
|
|
241
239
|
}
|
|
242
240
|
const fieldsAlone = !filter.rules.length && !filter.relation;
|
|
243
|
-
const body = (_jsx("div", { ref: placeRoot, className: "o-filter-editor", "data-slot": "vk-filter", "data-kit": "filter-editor", "data-filter-form": "computer", role: "group", "aria-label": label, tabIndex: -1, "data-filter-fields": fieldsAlone ? "" : undefined, style: room ? { paddingBottom: room } : undefined, ...phoneMark(!!screen || small), children: !fieldsAlone ? _jsxs(_Fragment, { children: [top, level(filter, 0), _jsxs("div", { className: "o-filter-editor-foot", "data-slot": "vk-filter-foot", children: [addButton(filter.id, "outline", "sm"), _jsx(Button, { kind: "quiet", size: "sm", className: "o-filter-editor-clear", "data-slot": "vk-filter-clear", onClick: clear, children: w.clearAllFilters }), props.excludable && groupMore(filter)] }), addingPopover] }) : (_jsx(Picker, { label: label, items: fields, value: null, onValueChange: (v) => add(filter.id, v), search: w.search, searchShown: true, form: "computer", ...words })) }));
|
|
241
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-filter-editor", "data-slot": "vk-filter", "data-kit": "filter-editor", "data-filter-form": "computer", role: "group", "aria-label": label, tabIndex: -1, "data-filter-fields": fieldsAlone ? "" : undefined, style: room ? { paddingBottom: room } : undefined, ...phoneMark(!!screen || small), children: !fieldsAlone ? _jsxs(_Fragment, { children: [top, level(filter, 0), _jsxs("div", { className: "o-filter-editor-foot", "data-slot": "vk-filter-foot", children: [addButton(filter.id, "outline", "sm"), props.clearAll !== false && _jsx(Button, { kind: "quiet", size: "sm", className: "o-filter-editor-clear", "data-slot": "vk-filter-clear", onClick: clear, children: w.clearAllFilters }), props.excludable && groupMore(filter)] }), addingPopover] }) : (_jsx(Picker, { label: label, items: fields, value: null, onValueChange: (v) => add(filter.id, v), search: w.search, searchShown: true, form: "computer", ...words })) }));
|
|
244
242
|
return { body, head: {} };
|
|
245
243
|
}
|
|
246
244
|
export const useFilterEditorParts = useFilterEditor;
|
|
@@ -30,5 +30,7 @@ export declare function partOf(rule: ViewKitRule, field: ViewsFilterPartBodyProp
|
|
|
30
30
|
} | null;
|
|
31
31
|
/** The kit filter's one rule as ViewKit's, naming the field and part the rule handed did; null where it holds none. */
|
|
32
32
|
export declare function ruleBack(next: KitGroup, rule: ViewKitRule, kit: KitFields): ViewKitRule | null;
|
|
33
|
+
/** ViewKit's body for one part of a filter on the filter bar, its typed value the app's Input where the provider's `panelControls`
|
|
34
|
+
* names it (VK-1014). */
|
|
33
35
|
export declare function MapFilterPartBody(props: ViewsFilterPartBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
34
36
|
export {};
|
|
@@ -8,11 +8,11 @@ import { useToldStep } from "../internal/told-step.js";
|
|
|
8
8
|
import { HeaderBar } from "../phone-header/header-bar.js";
|
|
9
9
|
import { pickerItemsOf, pickerWordsOf } from "../picker/map-picker.js";
|
|
10
10
|
import { Picker } from "../picker/picker.js";
|
|
11
|
-
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
12
11
|
import { useFilterEditor } from "./filter-editor.js";
|
|
13
12
|
import { kitFieldsOf, kitFilterOf, rulesFor, viewKitFilterOf, writeRules, CHOICE, RELATION_WAY } from "./map-rules.js";
|
|
14
13
|
import { FilterPartBody } from "./parts.js";
|
|
15
14
|
import { changeRule, fieldOf, isOwnWay, rulesOf } from "./rules.js";
|
|
15
|
+
import { PanelHeadButton } from "../internal/head-button.js";
|
|
16
16
|
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
17
17
|
const BACK = ["M5 12l14 0", "M5 12l6 6", "M5 12l6 -6"];
|
|
18
18
|
export function filterWordsOf(say) {
|
|
@@ -152,10 +152,10 @@ function FilterBodyInner(props) {
|
|
|
152
152
|
const { actions } = props;
|
|
153
153
|
if (!actions)
|
|
154
154
|
return _jsx(_Fragment, { children: parts.body });
|
|
155
|
-
const done = actions.done && _jsx(
|
|
155
|
+
const done = actions.done && _jsx(PanelHeadButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": actions.done.label, icon: glyph(TICK), onClick: actions.done.onPress });
|
|
156
156
|
return (_jsxs(_Fragment, { children: [parts.title !== undefined
|
|
157
|
-
? _jsx(BodyHead, { title: parts.title, left: _jsx(
|
|
158
|
-
: _jsx(BodyHead, { title: props.label, left: _jsx(
|
|
157
|
+
? _jsx(BodyHead, { title: parts.title, left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-back", "aria-label": words.back, className: "o-sheet-back", icon: glyph(BACK), onClick: parts.head.onBack }), right: done || _jsx("span", {}) })
|
|
158
|
+
: _jsx(BodyHead, { title: props.label, left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-close", "aria-label": actions.close.label, icon: glyph(X), onClick: actions.close.onPress }), right: done || _jsx("span", {}) }), parts.body] }));
|
|
159
159
|
}
|
|
160
160
|
export function partOf(rule, field, choices) {
|
|
161
161
|
const kit = kitFieldsOf([field], choices), [f] = kit.fields, { filter } = kitFilterOf({ op: "and", items: [rule] }, kit);
|
|
@@ -170,6 +170,9 @@ export function ruleBack(next, rule, kit) {
|
|
|
170
170
|
return { ...only, fieldKey: rule.fieldKey, ...(rule.part !== undefined ? { part: rule.part } : {}) };
|
|
171
171
|
}
|
|
172
172
|
export function MapFilterPartBody(props) {
|
|
173
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(FilterPartBodyInner, { ...props }) });
|
|
174
|
+
}
|
|
175
|
+
function FilterPartBodyInner(props) {
|
|
173
176
|
const views = React.useContext(ViewsContext);
|
|
174
177
|
const say = views?.messages ?? resolveViewsMessage;
|
|
175
178
|
const words = React.useMemo(() => filterWordsOf(say), [say]);
|
|
@@ -35,12 +35,14 @@ export declare const FILTER_SEARCH: string;
|
|
|
35
35
|
export declare function valuePlaceholder(field: FilterField, w?: FilterEditorWords): string;
|
|
36
36
|
/** The body a Popover holds under the part of a filter pressed: the fields, its type's ways, or its value in its type's own. */
|
|
37
37
|
export declare function FilterPartBody({ part, rule: ruleId, label, fields, filter, onFilterChange, onDone, own, form, words: given }: FilterPartProps): import("react/jsx-runtime").JSX.Element | null;
|
|
38
|
-
/** A range's From and To: two
|
|
39
|
-
export declare function PairValue({ name, value, onValue, size, onKeyDown, words: given }: {
|
|
38
|
+
/** A range's From and To: two number boxes, an en dash between, each named by its end; either may be left empty. */
|
|
39
|
+
export declare function PairValue({ name, value, onValue, size, onKeyDown, words: given, slot }: {
|
|
40
40
|
name: string;
|
|
41
41
|
value: [number | null, number | null];
|
|
42
42
|
onValue: (v: [number | null, number | null]) => void;
|
|
43
43
|
size?: "sm" | "lg";
|
|
44
44
|
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
45
45
|
words?: Partial<FilterEditorWords>;
|
|
46
|
+
/** Its public name, on the pair: the filter bar's popover hands `vk-filter-part-pair` (VK-1003). */
|
|
47
|
+
slot?: string;
|
|
46
48
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { DateEditor } from "../date-editor/date-editor.js";
|
|
4
|
-
import {
|
|
5
|
-
import { NumberField } from "../number-field/number-field.js";
|
|
4
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
6
5
|
import { Picker } from "../picker/picker.js";
|
|
7
6
|
import { itemLabel } from "../picker/rows.js";
|
|
8
7
|
import { HOW, wayOf } from "./how.js";
|
|
@@ -52,7 +51,7 @@ export function FilterPartBody({ part, rule: ruleId, label, fields, filter, onFi
|
|
|
52
51
|
return _jsx(Picker, { label: name, items: field.choices, multiple: several, value: value, form: form, onDone: onDone, ...words, onValueChange: (v) => set({ value: several ? (Array.isArray(v) ? v : []) : typeof v === "string" ? v : null }) });
|
|
53
52
|
}
|
|
54
53
|
if (takes === "two")
|
|
55
|
-
return _jsx(PairValue, { name: name, value: isPair(r.value) ? r.value : [null, null], onValue: (v) => set({ value: v }), words: w, onKeyDown: (e) => { if (e.key === "Enter") {
|
|
54
|
+
return _jsx(PairValue, { name: name, value: isPair(r.value) ? r.value : [null, null], onValue: (v) => set({ value: v }), words: w, slot: "vk-filter-part-pair", onKeyDown: (e) => { if (e.key === "Enter") {
|
|
56
55
|
e.preventDefault();
|
|
57
56
|
onDone();
|
|
58
57
|
} } });
|
|
@@ -60,9 +59,10 @@ export function FilterPartBody({ part, rule: ruleId, label, fields, filter, onFi
|
|
|
60
59
|
return _jsx(DateEditor, { label: name, value: typeof r.value === "string" ? r.value : null, onValueChange: (v) => set({ value: v }), onDone: onDone, form: form });
|
|
61
60
|
return _jsx(TypedValue, { rule: r, field: field, name: name, set: set, onDone: onDone, w: w });
|
|
62
61
|
}
|
|
63
|
-
export function PairValue({ name, value, onValue, size, onKeyDown, words: given }) {
|
|
62
|
+
export function PairValue({ name, value, onValue, size, onKeyDown, words: given, slot }) {
|
|
64
63
|
const w = filterWords(given), [from, to] = value;
|
|
65
|
-
|
|
64
|
+
const { NumberBox } = usePanelControls();
|
|
65
|
+
return (_jsxs("div", { className: "o-filter-editor-pair", ...(slot ? { "data-slot": slot } : {}), children: [_jsx(NumberBox, { size: size, steppers: false, "aria-label": w.fromOf(name), placeholder: w.from, value: from, onValueChange: (v) => onValue([v ?? null, to]), onKeyDown: onKeyDown }), _jsx("span", { className: "o-filter-editor-dash", "aria-hidden": "true", children: "\u2013" }), _jsx(NumberBox, { size: size, steppers: false, "aria-label": w.toOf(name), placeholder: w.to, value: to, onValueChange: (v) => onValue([from, v ?? null]), onKeyDown: onKeyDown })] }));
|
|
66
66
|
}
|
|
67
67
|
const WHOLE = { maximumFractionDigits: 0 };
|
|
68
68
|
function TypedValue({ rule: r, field, name, set, onDone, w }) {
|
|
@@ -70,7 +70,8 @@ function TypedValue({ rule: r, field, name, set, onDone, w }) {
|
|
|
70
70
|
e.preventDefault();
|
|
71
71
|
onDone();
|
|
72
72
|
} };
|
|
73
|
+
const { Input, NumberBox } = usePanelControls();
|
|
73
74
|
return field.type === "number" || field.type === "range"
|
|
74
|
-
? _jsx(
|
|
75
|
-
: _jsx(Input, { "aria-label": name, placeholder: valuePlaceholder(field, w), value: typeof r.value === "string" ? r.value : "", onChange: (e) => set({ value: e.target.value }), onKeyDown: enter });
|
|
75
|
+
? _jsx(NumberBox, { "data-slot": "vk-filter-part-value", "aria-label": name, placeholder: valuePlaceholder(field, w), value: typeof r.value === "number" ? r.value : null, format: field.integer ? WHOLE : undefined, onValueChange: (v) => set({ value: v ?? null }), onKeyDown: enter })
|
|
76
|
+
: _jsx(Input, { "data-slot": "vk-filter-part-value", "aria-label": name, placeholder: valuePlaceholder(field, w), value: typeof r.value === "string" ? r.value : "", onChange: (e) => set({ value: e.target.value }), onKeyDown: enter });
|
|
76
77
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
5
5
|
import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
|
|
6
6
|
import { useStepReturn } from "../internal/step-return.js";
|
|
7
7
|
import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
|
|
@@ -18,6 +18,7 @@ function FieldsOnPhone(props) {
|
|
|
18
18
|
}
|
|
19
19
|
export function useGroupEditor(props) {
|
|
20
20
|
const { label, fields, ownOrders = {}, group, values, onGroupChange, opens, orders = {}, manualOrder = true, steps = {} } = props;
|
|
21
|
+
const { Button } = usePanelControls();
|
|
21
22
|
const w = groupWords(props.words), search = props.search ?? w.search;
|
|
22
23
|
const NAMES = { field: w.groupBy, order: w.order, direction: w.direction, step: w.dateStep };
|
|
23
24
|
const LEVEL_OF = Object.fromEntries(Object.entries(NAMES).map(([k, v]) => [v, k]));
|
|
@@ -16,4 +16,5 @@ export declare function kitGroupValuesOf(group: ViewsGroupValue, noValue: string
|
|
|
16
16
|
export declare function viewKitGroupOf(next: ListGroup | null, now: ViewsGroupValue, dated?: boolean): ViewsGroupValue;
|
|
17
17
|
/** ViewKit's group body's props as the group editor's. */
|
|
18
18
|
export declare function groupEditorPropsOf(p: ViewsGroupBodyProps, words: GroupEditorWords): GroupEditorProps;
|
|
19
|
+
/** ViewKit's group editor, drawing the app's controls where the provider's `panelControls` names them (VK-1014). */
|
|
19
20
|
export declare function MapGroupBody(props: ViewsGroupBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { resolveViewsMessage } from "../../contract.js";
|
|
5
5
|
import { ViewsContext } from "../../provider/context.js";
|
|
6
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
6
7
|
import { useToldStep } from "../internal/told-step.js";
|
|
7
8
|
import { pickerWordsOf } from "../picker/map-picker.js";
|
|
8
9
|
import { useGroupEditor } from "./group-editor.js";
|
|
@@ -97,6 +98,9 @@ export function groupEditorPropsOf(p, words) {
|
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
100
|
export function MapGroupBody(props) {
|
|
101
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(GroupBodyInner, { ...props }) });
|
|
102
|
+
}
|
|
103
|
+
function GroupBodyInner(props) {
|
|
100
104
|
const views = React.useContext(ViewsContext);
|
|
101
105
|
const messages = views?.messages ?? resolveViewsMessage;
|
|
102
106
|
const words = React.useMemo(() => groupEditorWordsOf(messages), [messages]);
|
|
@@ -92,7 +92,7 @@ export { QUICK_FILTERS_RULES } from "./quick-filters/rules.js";
|
|
|
92
92
|
export { QUICK_FILTERS_ATTRS, quickFiltersWornOf } from "./quick-filters/looks.js";
|
|
93
93
|
export { QUICK_FILTERS_WORDS, quickFiltersWords, type QuickFiltersWords } from "./quick-filters/words.js";
|
|
94
94
|
export { quickFiltersFieldsOf, quickHoldsOf, quickListHoldOf, type QuickFiltersFieldIn } from "./quick-filters/map-quick-filters-body.js";
|
|
95
|
-
export { ToolbarControl, ToolbarFolds, ToolbarInput, ToolbarSeparatorControl, ToolbarSpacer, toolbarSteps, useToolbarWorn, type ToolbarAt, type ToolbarFoldsProps, type ToolbarInputProps, type ToolbarPlace, type ToolbarProps, } from "./toolbar/toolbar.js";
|
|
95
|
+
export { ToolbarControl, ToolbarFolds, ToolbarInput, ToolbarSeparatorControl, ToolbarSpacer, toolbarSteps, useToolbarWorn, type ToolbarAt, type ToolbarFoldsProps, type ToolbarInputProps, type ToolbarMoreControl, type ToolbarOverflowControl, type ToolbarPlace, type ToolbarProps, } from "./toolbar/toolbar.js";
|
|
96
96
|
export { TOOLBAR_ATTRS, toolbarWornOf } from "./toolbar/looks.js";
|
|
97
97
|
export { TOOLBAR_WORDS, toolbarWords, type ToolbarWords } from "./toolbar/words.js";
|
|
98
98
|
export { QuickFiltersReminderControl, type QuickFiltersReminderProps } from "./quick-filters/reminder.js";
|
|
@@ -17,7 +17,8 @@ export function pressGroup(e) {
|
|
|
17
17
|
const on = e.target;
|
|
18
18
|
if (on.closest(".o-input-segment"))
|
|
19
19
|
return;
|
|
20
|
-
const control = e.currentTarget.querySelector(":scope > .o-input-control") ?? e.currentTarget.querySelector(".o-input-segment")
|
|
20
|
+
const control = e.currentTarget.querySelector(":scope > .o-input-control") ?? e.currentTarget.querySelector(".o-input-segment")
|
|
21
|
+
?? e.currentTarget.querySelector("input:not([type='hidden']):not([type='checkbox']):not([type='radio'])");
|
|
21
22
|
if (e.defaultPrevented || !control || on.closest("a, input, textarea, select"))
|
|
22
23
|
return;
|
|
23
24
|
if (on.closest("button, [role='button']")) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
3
|
+
/** SheetButton's props, and what ViewKit draws in their place when the Button isn't the app's (SheetButton by default). */
|
|
4
|
+
export type PanelHeadButtonProps = React.ComponentProps<typeof SheetButton> & {
|
|
5
|
+
own?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
/** A panel head's ✕, ‹ or ✓: ViewKit's own (`own`, else SheetButton's glass and plain pair), or, where the context holds the app's
|
|
8
|
+
* Button, that Button alone, quiet (primary for a ✓), an icon when it has no words, the part's name on it. */
|
|
9
|
+
export declare function PanelHeadButton({ own, ...props }: PanelHeadButtonProps): React.ReactElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
5
|
+
import { PanelControlsContext, usePanelControls } from "./panel-controls.js";
|
|
6
|
+
export function PanelHeadButton({ own, ...props }) {
|
|
7
|
+
const app = React.useContext(PanelControlsContext).Button;
|
|
8
|
+
const { Button } = usePanelControls();
|
|
9
|
+
if (!app)
|
|
10
|
+
return _jsx(_Fragment, { children: own ?? _jsx(SheetButton, { ...props }) });
|
|
11
|
+
const { kind, children, ...rest } = props;
|
|
12
|
+
return _jsx(Button, { ...rest, kind: kind ?? "quiet", shape: children == null ? "icon" : undefined, children: children });
|
|
13
|
+
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
+
import { parseNumber } from "viewkitjs/fields";
|
|
4
5
|
import { ViewsContext } from "../../provider/context.js";
|
|
5
6
|
import { NO_APP_CONTROLS, PanelControlsContext } from "./panel-controls.js";
|
|
6
7
|
export function useAppPanelControls() {
|
|
7
8
|
const views = React.useContext(ViewsContext);
|
|
8
|
-
const components = views?.components, names = views?.panelControls;
|
|
9
|
+
const components = views?.components, atoms = views?.atoms, names = views?.panelControls, conventions = views?.conventions;
|
|
9
10
|
return React.useMemo(() => {
|
|
10
|
-
if (!components || !names?.size)
|
|
11
|
+
if (!components || !atoms || !names?.size)
|
|
11
12
|
return NO_APP_CONTROLS;
|
|
12
13
|
const out = {};
|
|
13
14
|
for (const name of names)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
if (name !== "RelationChip")
|
|
16
|
+
out[name] = name === "Avatar" ? atoms.Avatar : components[name];
|
|
17
|
+
if (out.Input)
|
|
18
|
+
out.parseNumber = (typed) => parseNumber(typed, conventions);
|
|
19
|
+
return Object.keys(out).length ? out : NO_APP_CONTROLS;
|
|
20
|
+
}, [components, atoms, names, conventions]);
|
|
17
21
|
}
|
|
18
22
|
export function PanelControlsFromViews({ children }) {
|
|
19
23
|
return _jsx(PanelControlsContext.Provider, { value: useAppPanelControls(), children: children });
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ViewsAvatarProps } from "../../atoms/types.js";
|
|
3
|
+
import type { ViewsButtonProps, ViewsCalendarProps, ViewsInputProps, ViewsMenuItem, ViewsMenuProps, ViewsPopoverProps, ViewsSelectProps, ViewsTooltipProps } from "../../provider/components.js";
|
|
3
4
|
import { type ButtonProps } from "../button/button.js";
|
|
5
|
+
import { type GlassButtonProps } from "../glass-button/glass-button.js";
|
|
4
6
|
import { type InputProps } from "../input/input.js";
|
|
5
7
|
import { type MenuProps } from "../menu/menu.js";
|
|
8
|
+
import { type NumberFieldProps } from "../number-field/number-field.js";
|
|
6
9
|
import type { MenuEntry } from "../menu-list/menu-list.js";
|
|
7
10
|
import { type PopoverProps } from "../popover/popover.js";
|
|
8
11
|
import { type SelectListProps, type SelectProps } from "../select/select.js";
|
|
12
|
+
import { type TooltipProps } from "../tooltip/tooltip.js";
|
|
9
13
|
/** The app's own controls the panels draw, by name; a name left out is ViewKit's own. */
|
|
10
14
|
export type AppPanelControls = {
|
|
11
15
|
Button?: React.ComponentType<ViewsButtonProps>;
|
|
@@ -13,6 +17,15 @@ export type AppPanelControls = {
|
|
|
13
17
|
Menu?: React.ComponentType<ViewsMenuProps>;
|
|
14
18
|
Popover?: React.ComponentType<ViewsPopoverProps>;
|
|
15
19
|
Input?: React.ComponentType<ViewsInputProps>;
|
|
20
|
+
/** The date editor's month (VK-1021). */
|
|
21
|
+
Calendar?: React.ComponentType<ViewsCalendarProps>;
|
|
22
|
+
/** The panels' tooltips (VK-1015). */
|
|
23
|
+
Tooltip?: React.ComponentType<ViewsTooltipProps>;
|
|
24
|
+
/** The app's Avatar atom: every record's mark a panel draws (VK-1044, controls/avatar/record-mark.tsx). */
|
|
25
|
+
Avatar?: React.ComponentType<ViewsAvatarProps>;
|
|
26
|
+
/** How a number box drawn by the app's Input reads what is typed (VK-1018): the provider's conventions, handed by the map body
|
|
27
|
+
* with the Input; a plain reading of the digits where none is. */
|
|
28
|
+
parseNumber?: (typed: string) => number | null;
|
|
16
29
|
};
|
|
17
30
|
/** No app control: what a panel drawn alone reads. */
|
|
18
31
|
export declare const NO_APP_CONTROLS: AppPanelControls;
|
|
@@ -24,27 +37,46 @@ type ButtonLike = ButtonProps & {
|
|
|
24
37
|
type InputLike = InputProps & {
|
|
25
38
|
ref?: React.Ref<HTMLInputElement>;
|
|
26
39
|
};
|
|
27
|
-
/** The
|
|
40
|
+
/** The controls a panel or a field editor draws, each taking ViewKit's own props; and the app's Calendar, or none. */
|
|
28
41
|
export type PanelControls = {
|
|
29
42
|
Button: React.ComponentType<ButtonLike>;
|
|
30
43
|
Select: React.ComponentType<SelectProps>;
|
|
31
44
|
Menu: React.ComponentType<MenuProps>;
|
|
32
45
|
Popover: React.ComponentType<PopoverProps>;
|
|
33
46
|
Input: React.ComponentType<InputLike>;
|
|
47
|
+
/** A box group's button (InputGroupButton): ViewKit's, or the app's Button handed it as a quiet one (VK-1021). */
|
|
48
|
+
GroupButton: React.ComponentType<ButtonLike>;
|
|
49
|
+
/** The app's Calendar, or null: the date editor then draws its own month (VK-1021). */
|
|
50
|
+
Calendar: React.ComponentType<ViewsCalendarProps> | null;
|
|
51
|
+
/** The phone's round glass button (the Picker's Back and ⋯): ViewKit's GlassButton, or the app's Button as a quiet one (VK-1022). */
|
|
52
|
+
RoundButton: React.ComponentType<RoundLike>;
|
|
53
|
+
/** A tooltip in a panel: ViewKit's Tooltip, or the app's handed its words, side and whether they are a reason (VK-1015). */
|
|
54
|
+
Tooltip: React.ComponentType<TooltipProps>;
|
|
55
|
+
/** A number's box in a panel (the filter's value, a range's From and To): ViewKit's Number field, or the app's Input with
|
|
56
|
+
* ViewKit reading what is typed (VK-1018). */
|
|
57
|
+
NumberBox: React.ComponentType<NumberFieldProps>;
|
|
58
|
+
};
|
|
59
|
+
type RoundLike = GlassButtonProps & {
|
|
60
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
34
61
|
};
|
|
35
62
|
/** The controls a panel draws: the app's where the context holds them, else ViewKit's own, the same components. */
|
|
36
63
|
export declare function usePanelControls(): PanelControls;
|
|
37
64
|
/** ViewKit's Button props as the map's: its kind a variant, its size and form one of the map's three sizes, its icons in its
|
|
38
65
|
* children; one that can't be used but keeps its focus says so and takes no press. ViewKit's own look is never handed. */
|
|
39
66
|
export declare function buttonPropsOf(p: ButtonLike): ViewsButtonProps;
|
|
67
|
+
/** Whether a component is the hook's app Button: it takes ViewKit's Button props, so the Toolbar holds it as it holds ViewKit's
|
|
68
|
+
* Button, one of its stops (the bulk bar, VK-1023). */
|
|
69
|
+
export declare const isAppButton: (type: unknown) => boolean;
|
|
40
70
|
/** ViewKit's Select props as the map's: its rows, value, pick, name and size, and anything else a ViewKit part hands it (an
|
|
41
71
|
* `aria-describedby`, a handler) on the rest; never its list's width or its own look. */
|
|
42
72
|
export declare function selectPropsOf(p: SelectListProps): ViewsSelectProps;
|
|
43
73
|
/** A menu's rows as the map's: an action, a tick, a pick's choices (under its heading when it has one), a line before the next row.
|
|
44
74
|
* Each row keeps its public name and which one it is. A kind the map has no word for is left out, with a warning. */
|
|
45
|
-
export declare function menuItemsOf(entries: MenuEntry[], label: string): ViewsMenuItem[];
|
|
46
|
-
/** ViewKit's Popover props as the map's: open, where, what closes it, its name
|
|
75
|
+
export declare function menuItemsOf(entries: MenuEntry[], label: string, within?: string): ViewsMenuItem[];
|
|
76
|
+
/** ViewKit's Popover props as the map's: open, where, what closes it, its name, its popup's marks and click (an editor's inner
|
|
77
|
+
* Escape rides those marks, VK-1021); a trigger of its own is opened by TriggeredPopover (VK-1022). A `finalFocus` ref is honoured by AppPopover itself. */
|
|
47
78
|
export declare function popoverPropsOf(p: PopoverProps): ViewsPopoverProps;
|
|
48
|
-
/** ViewKit's Input props as the map's: a value typed handed as its change, in the app's field frame
|
|
49
|
-
|
|
79
|
+
/** ViewKit's Input props as the map's: a value typed handed as its change, in the app's field frame, or bare where a ViewKit box
|
|
80
|
+
* frames it (a box group) or the part says so (VK-1021); never ViewKit's own look. */
|
|
81
|
+
export declare function inputPropsOf(p: InputLike, bare?: boolean): ViewsInputProps;
|
|
50
82
|
export {};
|