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
|
@@ -4,8 +4,9 @@ import { DisabledReason } from "./DisabledReason.js";
|
|
|
4
4
|
import { cx } from "../internal/cx.js";
|
|
5
5
|
import { ELEMENT_RESET } from "../internal/reset.js";
|
|
6
6
|
import { useViews } from "../provider/context.js";
|
|
7
|
+
import { isFramePart } from "./frame-parts.js";
|
|
7
8
|
const flag = (on) => (on ? "" : undefined);
|
|
8
|
-
export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, current, part, onContextMenu, onClick, onPointerDown, ref, }) {
|
|
9
|
+
export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, current, part, className, onContextMenu, onClick, onPointerDown, ref, }) {
|
|
9
10
|
const { messages, icons } = useViews();
|
|
10
11
|
const Chevron = icons.chevronDown;
|
|
11
12
|
const chevron = part === "views-chip" || part === "views-more";
|
|
@@ -13,7 +14,7 @@ export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, o
|
|
|
13
14
|
const reasoned = !!disabled && !!disabledReason;
|
|
14
15
|
const worded = children != null && !iconAlone;
|
|
15
16
|
const shownMore = iconAlone ? undefined : more;
|
|
16
|
-
const button = (describedBy) => (_jsxs("span", { className: cx("relative inline-flex shrink-0", worded && "min-w-0 max-w-full"), children: [_jsxs("button", { ref: ref, type: "button", "aria-describedby": describedBy, "aria-label": worded ? undefined : label, "aria-haspopup": popup, "aria-expanded": popup ? Boolean(open) : undefined, "aria-disabled": reasoned ? true : undefined, disabled: disabled && !reasoned, "aria-current": current ? "true" : undefined, "data-slot": part ? PART_SLOT[part] : "vk-toolbar-button", "data-tab": current !== undefined ? "" : undefined, "data-current": flag(current), "data-open": flag(open), "data-changed": flag(changed), "data-edge": flag(edge), "data-disabled": flag(disabled), "data-empty": flag(empty), "data-icon-alone": flag(iconAlone), "data-aside": flag(aside), "data-foot": flag(foot), "data-joined": joined, "data-waits": flag(waits), onClick: reasoned ? (event) => event.preventDefault() : onClick, onPointerDown: reasoned ? undefined : onPointerDown, onContextMenu: reasoned ? undefined : onContextMenu, className: cx(ELEMENT_RESET, "inline-flex shrink-0 items-center justify-center transition-colors duration-150", joined ? JOINED_CLASS[joined] : "rounded-full", worded && "min-w-0 max-w-full", foot
|
|
17
|
+
const button = (describedBy) => (_jsxs("span", { className: cx("relative inline-flex shrink-0", worded && "min-w-0 max-w-full"), children: [_jsxs("button", { ref: ref, type: "button", "aria-describedby": describedBy, "aria-label": worded ? undefined : label, "aria-haspopup": popup, "aria-expanded": popup ? Boolean(open) : undefined, "aria-disabled": reasoned ? true : undefined, disabled: disabled && !reasoned, "aria-current": current ? "true" : undefined, "data-slot": isFramePart(part) ? PART_SLOT[part] : "vk-toolbar-button", "data-tab": current !== undefined ? "" : undefined, "data-current": flag(current), "data-open": flag(open), "data-changed": flag(changed), "data-edge": flag(edge), "data-disabled": flag(disabled), "data-empty": flag(empty), "data-icon-alone": flag(iconAlone), "data-aside": flag(aside), "data-foot": flag(foot), "data-joined": joined, "data-waits": flag(waits), onClick: reasoned ? (event) => event.preventDefault() : onClick, onPointerDown: reasoned ? undefined : onPointerDown, onContextMenu: reasoned ? undefined : onContextMenu, className: cx(ELEMENT_RESET, "inline-flex shrink-0 items-center justify-center transition-colors duration-150", joined ? JOINED_CLASS[joined] : "rounded-full", worded && "min-w-0 max-w-full", foot
|
|
17
18
|
? "h-11 w-11"
|
|
18
19
|
: worded || shownMore
|
|
19
20
|
? cx("gap-1.5 px-3", size === "sm" ? "h-8" : "h-9")
|
|
@@ -26,7 +27,7 @@ export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, o
|
|
|
26
27
|
? "bg-(color:--vk-pressed) text-(color:--vk-fg)"
|
|
27
28
|
: current
|
|
28
29
|
? "bg-(color:--vk-selected,var(--vk-neutral)) text-(color:--vk-fg)"
|
|
29
|
-
: cx("hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)", aside || part === "save" ? undefined : changed ? "text-(color:--vk-fg-brand)" : "text-(color:--vk-fg-subtle)"), disabled && "pointer-events-none opacity-40"), children: [icon, worded ? (_jsx("span", { "data-slot": "vk-toolbar-words", className: cx("min-w-0 truncate whitespace-nowrap text-sm", waits && "text-(color:--vk-fg-subtlest)"), children: children })) : (word !== null &&
|
|
30
|
+
: cx("hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)", aside || part === "save" ? undefined : changed ? "text-(color:--vk-fg-brand)" : "text-(color:--vk-fg-subtle)"), disabled && "pointer-events-none opacity-40", className), children: [icon, worded ? (_jsx("span", { "data-slot": "vk-toolbar-words", className: cx("min-w-0 truncate whitespace-nowrap text-sm", waits && "text-(color:--vk-fg-subtlest)"), children: children })) : (word !== null &&
|
|
30
31
|
!iconAlone && (_jsx("span", { "data-slot": "vk-toolbar-word", className: "hidden text-sm font-medium", children: word ?? label }))), worded && shownMore && " ", shownMore && (_jsx("span", { "data-slot": "vk-toolbar-more", className: "text-sm tabular-nums text-(color:--vk-fg-subtle)", children: shownMore })), chevron && (_jsx("span", { "aria-hidden": true, "data-slot": "vk-toolbar-chevron", className: "inline-flex shrink-0 opacity-60", children: _jsx(Chevron, { className: "h-3.5 w-3.5" }) }))] }), dot && (_jsx("span", { "aria-hidden": true, "data-slot": "vk-toolbar-dot", className: "pointer-events-none absolute right-1.5 top-1.5 h-1.5 w-1.5 rounded-full bg-(color:--vk-brand)" })), counted &&
|
|
31
32
|
(onClear ? (_jsx("button", { type: "button", "data-slot": "vk-toolbar-count", "aria-label": messages({ key: "views.panels.toolbar-clear" }), disabled: disabled, onClick: (event) => {
|
|
32
33
|
event.stopPropagation();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ViewsFramePart, ViewsToolbarButtonPart } from "./types.js";
|
|
2
|
+
/** One of the six an app's own frame hands: the views row's parts, Clear and Save. */
|
|
3
|
+
export declare const isFramePart: (part: ViewsToolbarButtonPart | undefined) => part is ViewsFramePart;
|
|
4
|
+
/** The place's key as a part's name, where it names one of the toolbar's own places; else nothing (an app's own key, or
|
|
5
|
+
* no place: an app's own frame). */
|
|
6
|
+
export declare const placePart: (key: string | undefined) => ViewsToolbarButtonPart | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const FRAME_PARTS = new Set(["views-chip", "views-tab", "views-more", "views-add", "clear", "save"]);
|
|
2
|
+
export const isFramePart = (part) => part !== undefined && FRAME_PARTS.has(part);
|
|
3
|
+
const PLACE_PARTS = new Set([
|
|
4
|
+
"options",
|
|
5
|
+
"search",
|
|
6
|
+
"quick",
|
|
7
|
+
"new",
|
|
8
|
+
"sort",
|
|
9
|
+
"filter",
|
|
10
|
+
"filter-add",
|
|
11
|
+
"filters",
|
|
12
|
+
"advanced-filters",
|
|
13
|
+
"sort-pill",
|
|
14
|
+
]);
|
|
15
|
+
export const placePart = (key) => key !== undefined && PLACE_PARTS.has(key) ? key : undefined;
|
|
@@ -455,20 +455,29 @@ export type ViewsToolbarButtonProps = {
|
|
|
455
455
|
popup?: "menu" | "dialog";
|
|
456
456
|
/** A view tab: one of a row where one is open. `true`, the open one, `aria-current="true"`. */
|
|
457
457
|
current?: boolean;
|
|
458
|
-
/** Which of the toolbar's
|
|
459
|
-
*
|
|
460
|
-
*
|
|
461
|
-
*
|
|
458
|
+
/** Which of the toolbar's buttons it stands for (VK-984): every button the toolbar draws hands one, named after the
|
|
459
|
+
* `toolbarParts` place it stands in (`options`, `search`, `quick`, `new`, `sort`, `filter`, `filter-add`, `filters`,
|
|
460
|
+
* `advanced-filters`, `sort-pill`), a place's second kind of button by a name of its own (`sort-add`, `more-filters`), and
|
|
461
|
+
* ⋯ `more`. In an app's own frame also the views chip (a switcher: it names the view open and opens the rest), a view
|
|
462
|
+
* tab, the views row's "+N" and "+", Clear, and Save (the bar's keep-this-change), the frame's parts
|
|
463
|
+
* (`ViewsFramePart`): draw those as their `data-slot`, `vk-views-chip`, `vk-views-tab`, `vk-views-more`, `vk-views-add`,
|
|
464
|
+
* `vk-toolbar-clear`, `vk-toolbar-save-button`. An atom that spreads its leftover props onto its element takes `part`
|
|
465
|
+
* out first. */
|
|
462
466
|
part?: ViewsToolbarButtonPart;
|
|
467
|
+
/** The class its toolbar place hands (`ToolbarPartPlace.className`, VK-984): put it on the button itself. */
|
|
468
|
+
className?: string;
|
|
463
469
|
/** A right-click: a tab's verbs open on it. */
|
|
464
470
|
onContextMenu?: (event: ReactMouseEvent<HTMLButtonElement>) => void;
|
|
465
471
|
onClick?: (event: ReactMouseEvent<HTMLButtonElement>) => void;
|
|
466
472
|
onPointerDown?: (event: ReactPointerEvent<HTMLButtonElement>) => void;
|
|
467
473
|
ref?: Ref<HTMLButtonElement>;
|
|
468
474
|
};
|
|
469
|
-
/**
|
|
470
|
-
*
|
|
471
|
-
export type
|
|
475
|
+
/** The toolbar's buttons a `ToolbarButton` stands for only where an app's own frame draws them (VK-629): its kind and its
|
|
476
|
+
* hook. */
|
|
477
|
+
export type ViewsFramePart = "views-chip" | "views-tab" | "views-more" | "views-add" | "clear" | "save";
|
|
478
|
+
/** Which of the toolbar's buttons a `ToolbarButton` stands for (VK-984): the frame's parts, and every other button by the
|
|
479
|
+
* key of the place it stands in, or, a place's second kind of button, by a name of its own. */
|
|
480
|
+
export type ViewsToolbarButtonPart = ViewsFramePart | "options" | "search" | "quick" | "new" | "sort" | "filter" | "filter-add" | "filters" | "advanced-filters" | "sort-pill" | "sort-add" | "more-filters" | "more";
|
|
472
481
|
export type ViewsAtoms = {
|
|
473
482
|
List: ComponentType<ViewsListProps>;
|
|
474
483
|
Row: ComponentType<ViewsRowProps>;
|
|
@@ -17,4 +17,6 @@ export declare function renderTitleCell<Row>(col: ListColumn<Row>, row: Row, con
|
|
|
17
17
|
/** The surface's part on the name link: the grid hands `vk-grid-title`; elsewhere none. */
|
|
18
18
|
data?: {
|
|
19
19
|
readonly "data-slot": string;
|
|
20
|
-
}
|
|
20
|
+
},
|
|
21
|
+
/** The value the cell shows, handed to the column's indicator; absent, what `accessor` reads. */
|
|
22
|
+
value?: unknown): ReactNode;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cellTextClass } from "../display/text-class.js";
|
|
4
4
|
import { cx } from "../internal/cx.js";
|
|
5
|
-
export function renderTitleCell(col, row, content, data) {
|
|
6
|
-
const indicator = col.indicator?.(row);
|
|
5
|
+
export function renderTitleCell(col, row, content, data, value = col.accessor?.(row)) {
|
|
6
|
+
const indicator = col.indicator?.(row, { value });
|
|
7
7
|
return (_jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: [_jsx("span", { ...data, "data-cell-open": true, className: cx("min-w-0 cursor-pointer font-medium text-(color:--vk-fg)", cellTextClass()), children: content }), indicator] }));
|
|
8
8
|
}
|
|
@@ -22,7 +22,7 @@ export function renderTypedCellValue(col, row, opts) {
|
|
|
22
22
|
if (!col.type)
|
|
23
23
|
return null;
|
|
24
24
|
if (col.type === "title")
|
|
25
|
-
return renderTitleCell(col, row, identityContent(col, row, value, opts), opts?.titleData);
|
|
25
|
+
return renderTitleCell(col, row, identityContent(col, row, value, opts), opts?.titleData, value);
|
|
26
26
|
const field = col.field ?? legacyFieldFromColumn(col);
|
|
27
27
|
const drawOpts = verbs && col.type === "user" ? { ...opts, slotOwnsClick: true } : opts;
|
|
28
28
|
const cell = renderFieldValue(field, value, displayOptionsFor(col, row, drawOpts));
|
|
@@ -70,7 +70,7 @@ function CommandCell({ col, cell, items, }) {
|
|
|
70
70
|
}
|
|
71
71
|
return (_jsx(CommandMenu, { items: verbs, align: "start", label: columnLabel(col), trigger: drawGridButton(views, {
|
|
72
72
|
"aria-label": columnLabel(col),
|
|
73
|
-
frame: "h-auto min-w-0 max-w-
|
|
73
|
+
frame: "h-auto min-w-0 max-w-[calc(100%+0.5rem)] justify-start gap-1 -mx-1 px-1 py-0 text-left [font:inherit]",
|
|
74
74
|
variant: "ghost",
|
|
75
75
|
size: "sm",
|
|
76
76
|
children: (_jsxs(_Fragment, { children: [cell, _jsx(Chevron, { className: "h-3 w-3 opacity-60" })] })),
|
package/views/dist/contract.d.ts
CHANGED
|
@@ -103,27 +103,52 @@ export { GRID_TOKENS as VK_GRID_TOKENS } from "./grid-tokens.js";
|
|
|
103
103
|
export declare const COMPONENT_NAMES: readonly ["Button", "Popover", "Tooltip", "Checkbox", "Menu", "Collapse", "Sheet", "AppIcon", "Markdown", "TextBody", "NumberBody", "Picker", "LinksBody", "DateBody", "PartsBody", "ValuesBody", "CustomizeBody", "SortBody", "FilterBody", "FilterPartBody", "FieldsBody", "QuickFiltersBody", "ViewsListBody"];
|
|
104
104
|
export type ComponentName = (typeof COMPONENT_NAMES)[number];
|
|
105
105
|
/** The primitives an app may leave out, apart from `COMPONENT_NAMES`, which lists the ones it must hand
|
|
106
|
-
* in: `Input` has a plain default; `Command` and `Calendar`, reached without one, throw an error naming
|
|
106
|
+
* in: `Input` has a plain default; `Select` is drawn only inside the panels, under the provider's `panelControls`; `Command` and `Calendar`, reached without one, throw an error naming
|
|
107
107
|
* it (the filter's month draws through `Calendar`); without `RowsWait`, a grid waiting for new rows draws Loading in
|
|
108
108
|
* place of its body; `GroupBody` is read by nothing (deprecated: a `CustomizeBody` holds its own group editor); without
|
|
109
109
|
* `SearchField`, the toolbar's search draws its own field; without `PortsHost`, an app that hands no `confirm` gets the
|
|
110
110
|
* browser's and one that hands no `toast` sees
|
|
111
111
|
* nothing; without `SelectionBar`, a selection draws ViewKit's own bar; without `ViewMenu`, a views row's pill opens
|
|
112
112
|
* its view's `menu` rows. */
|
|
113
|
-
export declare const OPTIONAL_COMPONENT_NAMES: readonly ["Input", "Command", "Calendar", "RowsWait", "GroupBody", "SearchField", "PortsHost", "SelectionBar", "ViewMenu"];
|
|
113
|
+
export declare const OPTIONAL_COMPONENT_NAMES: readonly ["Input", "Select", "Command", "Calendar", "RowsWait", "GroupBody", "SearchField", "PortsHost", "SelectionBar", "ViewMenu"];
|
|
114
114
|
export type OptionalComponentName = (typeof OPTIONAL_COMPONENT_NAMES)[number];
|
|
115
115
|
/** The pieces the rendering is built from, and the app's own pieces it cannot draw itself (a command cell's verb menu, the row's right-click menu, where a relation goes, a wait, how a list asks for more), and the rows the panels draw with. Each ships as a default; an app swaps any of them through the provider's `atoms`. */
|
|
116
116
|
export declare const ATOM_NAMES: readonly ["Row", "RowContent", "TickBox", "StatusBadge", "StatusMarker", "Tag", "List", "CommandMenu", "RelationLink", "RelationRoles", "CellMore", "Loading", "LoadMore", "PlatformMark", "RowMenu", "SelectionSheet", "ChoiceRow", "CheckRow", "RadioRow", "DirectionButton", "MenuRow", "ToggleRow", "PanelSearch", "Pill", "RangeCalendar", "ToolbarButton", "Avatar"];
|
|
117
117
|
export type AtomName = (typeof ATOM_NAMES)[number];
|
|
118
|
+
/** The parts inside the default panels, by panel (VK-988): each its public `data-slot`, prefixed with the panel's own short name.
|
|
119
|
+
* A part that repeats also says which one it is (`data-key`) and, a sort or filter rule, its place (`data-index`). */
|
|
120
|
+
export declare const PANEL_SLOTS: {
|
|
121
|
+
readonly sort: readonly ["vk-sort", "vk-sort-rules", "vk-sort-rule", "vk-sort-grip", "vk-sort-field", "vk-sort-direction", "vk-sort-remove", "vk-sort-rule-open", "vk-sort-rule-more", "vk-sort-rule-action", "vk-sort-direction-option", "vk-sort-add", "vk-sort-clear", "vk-sort-foot", "vk-sort-none", "vk-sort-head"];
|
|
122
|
+
readonly filter: readonly ["vk-filter", "vk-filter-rules", "vk-filter-item", "vk-filter-rule", "vk-filter-where", "vk-filter-joined", "vk-filter-join", "vk-filter-field", "vk-filter-how", "vk-filter-value", "vk-filter-rule-more", "vk-filter-rule-action", "vk-filter-group", "vk-filter-group-head", "vk-filter-quantifier", "vk-filter-group-more", "vk-filter-group-action", "vk-filter-delete", "vk-filter-add", "vk-filter-clear", "vk-filter-foot", "vk-filter-none", "vk-filter-excluded", "vk-filter-head"];
|
|
123
|
+
readonly group: readonly ["vk-group", "vk-group-setting", "vk-group-choice", "vk-group-heading", "vk-group-value", "vk-group-hide-all", "vk-group-remove"];
|
|
124
|
+
readonly customize: readonly ["vk-customize", "vk-customize-head", "vk-customize-title", "vk-customize-back", "vk-customize-close", "vk-customize-layout-button", "vk-customize-name", "vk-customize-heading", "vk-customize-section", "vk-customize-field", "vk-customize-toggle", "vk-customize-toggle-reset", "vk-customize-choice", "vk-customize-option", "vk-customize-layout", "vk-customize-column", "vk-customize-search", "vk-customize-columns-action", "vk-customize-foot", "vk-customize-changes", "vk-customize-action", "vk-customize-stale"];
|
|
125
|
+
readonly viewsList: readonly ["vk-views-list", "vk-views-list-row", "vk-views-list-head"];
|
|
126
|
+
readonly viewMenu: readonly ["vk-view-menu", "vk-view-menu-row", "vk-view-menu-name", "vk-view-menu-layout", "vk-view-menu-columns", "vk-view-menu-act"];
|
|
127
|
+
readonly quick: readonly ["vk-quick", "vk-quick-field", "vk-quick-search", "vk-quick-value", "vk-quick-count", "vk-quick-clear", "vk-quick-none", "vk-quick-head"];
|
|
128
|
+
};
|
|
129
|
+
export type PanelSlot = (typeof PANEL_SLOTS)[keyof typeof PANEL_SLOTS][number];
|
|
118
130
|
/** The default atoms' `data-slot` values: prefixed, like the grid's. */
|
|
119
|
-
export declare const ATOM_SLOTS: readonly ["vk-row", "vk-row-content", "vk-tick", "vk-avatar", "vk-status", "vk-marker", "vk-tag", "vk-list", "vk-command-menu", "vk-relation-link", "vk-relation-roles", "vk-loading", "vk-load-more", "vk-platform", "vk-row-menu", "vk-choice-row", "vk-check-row", "vk-radio-row", "vk-direction", "vk-menu-row", "vk-toggle-row", "vk-panel-search", "vk-selection-sheet", "vk-pill", "vk-views-row", "vk-views-more", "vk-cell-more", "vk-show-more", "vk-phone", "vk-conversion", "vk-field-retry", "vk-views-chip", "vk-views-add", "vk-range-calendar", "vk-toolbar-button", "vk-toolbar-word", "vk-toolbar-count", "vk-toolbar-dot", "vk-toolbar-words", "vk-toolbar-more", "vk-toolbar-chevron", "vk-toolbar", "vk-toolbar-line", "vk-toolbar-cluster", "vk-toolbar-search", "vk-toolbar-search-field", "vk-toolbar-search-clear", "vk-toolbar-search-spinner", "vk-toolbar-new", "vk-toolbar-options", "vk-toolbar-options-panel", "vk-toolbar-sort", "vk-toolbar-sort-panel", "vk-toolbar-sort-pill", "vk-toolbar-sort-add", "vk-sort-head", "vk-filter-head", "vk-toolbar-quick", "vk-toolbar-quick-panel", "vk-quick-filters-reminder", "vk-quick-filters-reminder-open", "vk-quick-filters-reminder-clear", "vk-toolbar-filter", "vk-toolbar-filter-panel", "vk-toolbar-advanced-filter", "vk-toolbar-advanced-filter-panel", "vk-toolbar-filters", "vk-toolbar-filter-rule", "vk-toolbar-filter-aside", "vk-toolbar-filter-add", "vk-toolbar-more-filters", "vk-toolbar-filters-panel", "vk-toolbar-overflow", "vk-toolbar-separator", "vk-toolbar-save", "vk-toolbar-clear", "vk-toolbar-save-button", "vk-filter-convert"];
|
|
131
|
+
export declare const ATOM_SLOTS: readonly ["vk-row", "vk-row-content", "vk-tick", "vk-avatar", "vk-status", "vk-marker", "vk-tag", "vk-list", "vk-command-menu", "vk-relation-link", "vk-relation-roles", "vk-loading", "vk-load-more", "vk-platform", "vk-row-menu", "vk-choice-row", "vk-check-row", "vk-radio-row", "vk-direction", "vk-menu-row", "vk-toggle-row", "vk-panel-search", "vk-selection-sheet", "vk-pill", "vk-views-row", "vk-views-more", "vk-cell-more", "vk-show-more", "vk-phone", "vk-conversion", "vk-field-retry", "vk-views-chip", "vk-views-add", "vk-range-calendar", "vk-toolbar-button", "vk-toolbar-word", "vk-toolbar-count", "vk-toolbar-dot", "vk-toolbar-words", "vk-toolbar-more", "vk-toolbar-chevron", "vk-toolbar", "vk-toolbar-line", "vk-toolbar-cluster", "vk-toolbar-search", "vk-toolbar-search-field", "vk-toolbar-search-clear", "vk-toolbar-search-spinner", "vk-toolbar-new", "vk-toolbar-options", "vk-toolbar-options-panel", "vk-toolbar-sort", "vk-toolbar-sort-panel", "vk-toolbar-sort-pill", "vk-toolbar-sort-add", "vk-sort-head", "vk-filter-head", "vk-toolbar-quick", "vk-toolbar-quick-panel", "vk-quick-filters-reminder", "vk-quick-filters-reminder-open", "vk-quick-filters-reminder-clear", "vk-toolbar-filter", "vk-toolbar-filter-panel", "vk-toolbar-advanced-filter", "vk-toolbar-advanced-filter-panel", "vk-toolbar-filters", "vk-toolbar-filter-rule", "vk-toolbar-filter-aside", "vk-toolbar-filter-add", "vk-toolbar-more-filters", "vk-toolbar-filters-panel", "vk-toolbar-overflow", "vk-toolbar-separator", "vk-toolbar-save", "vk-toolbar-clear", "vk-toolbar-save-button", "vk-filter-convert", "vk-sort", "vk-sort-rules", "vk-sort-rule", "vk-sort-grip", "vk-sort-field", "vk-sort-direction", "vk-sort-remove", "vk-sort-rule-open", "vk-sort-rule-more", "vk-sort-rule-action", "vk-sort-direction-option", "vk-sort-add", "vk-sort-clear", "vk-sort-foot", "vk-sort-none", "vk-filter", "vk-filter-rules", "vk-filter-item", "vk-filter-rule", "vk-filter-where", "vk-filter-joined", "vk-filter-join", "vk-filter-field", "vk-filter-how", "vk-filter-value", "vk-filter-rule-more", "vk-filter-rule-action", "vk-filter-group", "vk-filter-group-head", "vk-filter-group-more", "vk-filter-quantifier", "vk-filter-group-action", "vk-filter-delete", "vk-filter-add", "vk-filter-clear", "vk-filter-foot", "vk-filter-none", "vk-filter-excluded", "vk-group", "vk-group-setting", "vk-group-choice", "vk-group-heading", "vk-group-value", "vk-group-hide-all", "vk-group-remove", "vk-customize", "vk-customize-head", "vk-customize-title", "vk-customize-back", "vk-customize-close", "vk-customize-layout-button", "vk-customize-name", "vk-customize-heading", "vk-customize-section", "vk-customize-field", "vk-customize-toggle", "vk-customize-toggle-reset", "vk-customize-choice", "vk-customize-option", "vk-customize-layout", "vk-customize-column", "vk-customize-search", "vk-customize-columns-action", "vk-customize-foot", "vk-customize-changes", "vk-customize-action", "vk-customize-stale", "vk-views-list", "vk-views-list-row", "vk-views-list-head", "vk-view-menu", "vk-view-menu-row", "vk-view-menu-name", "vk-view-menu-layout", "vk-view-menu-columns", "vk-view-menu-act", "vk-quick", "vk-quick-field", "vk-quick-search", "vk-quick-value", "vk-quick-count", "vk-quick-clear", "vk-quick-none", "vk-quick-head"];
|
|
120
132
|
export type AtomSlot = (typeof ATOM_SLOTS)[number];
|
|
121
133
|
/** The selection bar's `data-slot` values: prefixed, like the grid's. The fixed box the app places,
|
|
122
134
|
* the pill inside it, and the count that clears the selection. */
|
|
123
135
|
export declare const SELECTION_SLOTS: readonly ["vk-selection-bar", "vk-selection-pill", "vk-selection-chip"];
|
|
124
136
|
export type SelectionSlot = (typeof SELECTION_SLOTS)[number];
|
|
125
|
-
/** The editor
|
|
126
|
-
|
|
137
|
+
/** The parts inside the default field editors (VK-989), by editor: each part's public `data-slot`, the box a person sees. The
|
|
138
|
+
* shared ones are every editor's ✕, ✓, ‹ and Cancel, wherever ViewKit draws them. */
|
|
139
|
+
export declare const EDITOR_PART_SLOTS: {
|
|
140
|
+
readonly shared: readonly ["vk-editor-close", "vk-editor-save", "vk-editor-back", "vk-editor-cancel"];
|
|
141
|
+
readonly date: readonly ["vk-date", "vk-calendar", "vk-date-line", "vk-date-reads", "vk-date-error", "vk-date-time", "vk-date-head", "vk-date-prev", "vk-date-next", "vk-date-month", "vk-date-year", "vk-date-days", "vk-date-weekdays", "vk-date-day", "vk-date-choices", "vk-date-choice", "vk-date-quarters", "vk-date-quarter", "vk-date-parts", "vk-date-part", "vk-date-segment", "vk-date-sep", "vk-date-picks", "vk-date-pick", "vk-date-card", "vk-date-wheels", "vk-date-wheel", "vk-date-wheel-row"];
|
|
142
|
+
readonly text: readonly ["vk-text", "vk-text-box", "vk-text-country", "vk-text-dial", "vk-text-note"];
|
|
143
|
+
readonly number: readonly ["vk-number", "vk-number-box", "vk-number-currency", "vk-number-unit"];
|
|
144
|
+
readonly parts: readonly ["vk-parts", "vk-parts-field", "vk-parts-box", "vk-parts-line", "vk-parts-own", "vk-parts-card", "vk-parts-pair", "vk-parts-note", "vk-parts-bands"];
|
|
145
|
+
readonly values: readonly ["vk-values", "vk-values-rows", "vk-values-row", "vk-values-value", "vk-values-edit", "vk-values-label", "vk-values-main", "vk-values-pill", "vk-values-acts", "vk-values-grip", "vk-values-copy", "vk-values-open", "vk-values-remove", "vk-values-line", "vk-values-code", "vk-values-prefix", "vk-values-add", "vk-values-back", "vk-values-error"];
|
|
146
|
+
readonly links: readonly ["vk-links", "vk-links-search", "vk-links-list", "vk-links-head", "vk-links-rows", "vk-links-row", "vk-links-name", "vk-links-field", "vk-links-value", "vk-links-control", "vk-links-pop", "vk-links-lead", "vk-links-remove", "vk-links-config", "vk-links-more", "vk-links-action", "vk-links-step", "vk-links-back", "vk-links-unlink", "vk-links-offers", "vk-links-offer", "vk-links-offer-action", "vk-links-note", "vk-links-retry"];
|
|
147
|
+
readonly picker: readonly ["vk-picker", "vk-picker-search", "vk-picker-list", "vk-picker-chips", "vk-picker-chip", "vk-picker-option", "vk-picker-parent", "vk-picker-empty", "vk-picker-add", "vk-picker-create", "vk-picker-action", "vk-picker-group", "vk-picker-heading", "vk-picker-card", "vk-picker-selected", "vk-picker-tick", "vk-picker-row-more", "vk-picker-more", "vk-picker-back", "vk-picker-count", "vk-picker-clear", "vk-picker-lead", "vk-picker-lead-make", "vk-picker-message", "vk-picker-retry", "vk-picker-loading", "vk-picker-foot"];
|
|
148
|
+
};
|
|
149
|
+
/** The editor panel's `data-slot` values: prefixed, like the grid's. Then the frames an app's body or a read-only editor stands
|
|
150
|
+
* in, and the parts inside the default field editors. */
|
|
151
|
+
export declare const EDITOR_SLOTS: readonly ["vk-editor-panel", "vk-editor-bar", "vk-editor-refusal", "vk-text-editor", "vk-date-editor", "vk-text-body", "vk-number-body", "vk-parts-body", "vk-values-body", "vk-links-body", ...("vk-editor-close" | "vk-editor-save" | "vk-editor-back" | "vk-editor-cancel" | "vk-date" | "vk-calendar" | "vk-date-line" | "vk-date-reads" | "vk-date-error" | "vk-date-time" | "vk-date-head" | "vk-date-prev" | "vk-date-next" | "vk-date-month" | "vk-date-year" | "vk-date-days" | "vk-date-weekdays" | "vk-date-day" | "vk-date-choices" | "vk-date-choice" | "vk-date-quarters" | "vk-date-quarter" | "vk-date-parts" | "vk-date-part" | "vk-date-segment" | "vk-date-sep" | "vk-date-picks" | "vk-date-pick" | "vk-date-card" | "vk-date-wheels" | "vk-date-wheel" | "vk-date-wheel-row" | "vk-text" | "vk-text-box" | "vk-text-country" | "vk-text-dial" | "vk-text-note" | "vk-number" | "vk-number-box" | "vk-number-currency" | "vk-number-unit" | "vk-parts" | "vk-parts-field" | "vk-parts-box" | "vk-parts-line" | "vk-parts-own" | "vk-parts-card" | "vk-parts-pair" | "vk-parts-note" | "vk-parts-bands" | "vk-values" | "vk-values-rows" | "vk-values-row" | "vk-values-value" | "vk-values-edit" | "vk-values-label" | "vk-values-main" | "vk-values-pill" | "vk-values-acts" | "vk-values-grip" | "vk-values-copy" | "vk-values-open" | "vk-values-remove" | "vk-values-line" | "vk-values-code" | "vk-values-prefix" | "vk-values-add" | "vk-values-back" | "vk-values-error" | "vk-links" | "vk-links-search" | "vk-links-list" | "vk-links-head" | "vk-links-rows" | "vk-links-row" | "vk-links-name" | "vk-links-field" | "vk-links-value" | "vk-links-control" | "vk-links-pop" | "vk-links-lead" | "vk-links-remove" | "vk-links-config" | "vk-links-more" | "vk-links-action" | "vk-links-step" | "vk-links-back" | "vk-links-unlink" | "vk-links-offers" | "vk-links-offer" | "vk-links-offer-action" | "vk-links-note" | "vk-links-retry" | "vk-picker" | "vk-picker-search" | "vk-picker-list" | "vk-picker-chips" | "vk-picker-chip" | "vk-picker-option" | "vk-picker-parent" | "vk-picker-empty" | "vk-picker-add" | "vk-picker-create" | "vk-picker-action" | "vk-picker-group" | "vk-picker-heading" | "vk-picker-card" | "vk-picker-selected" | "vk-picker-tick" | "vk-picker-row-more" | "vk-picker-more" | "vk-picker-back" | "vk-picker-count" | "vk-picker-clear" | "vk-picker-lead" | "vk-picker-lead-make" | "vk-picker-message" | "vk-picker-retry" | "vk-picker-loading" | "vk-picker-foot")[]];
|
|
127
152
|
export type EditorSlot = (typeof EDITOR_SLOTS)[number];
|
|
128
153
|
/** The editor panel's states. `vk-body` names the app's own body a popover holds (`picker`, `parts`, `values` or `links`). */
|
|
129
154
|
export declare const EDITOR_STATES: readonly ["vk-body"];
|
|
@@ -136,7 +161,7 @@ export type EditorState = (typeof EDITOR_STATES)[number];
|
|
|
136
161
|
* The display marks a phone it draws as typed, not read as international, `as-typed`; a money figure shown in another
|
|
137
162
|
* currency than its record's `converted`; a breakdown's bar for a period not yet complete `partial`; a link whose
|
|
138
163
|
* plain click the host owns `cell-link`; and a value whose press is its own, not the row's, `no-nav`. */
|
|
139
|
-
export declare const ATOM_STATES: readonly ["chosen", "disabled", "muted", "checked", "open", "status", "platform", "as-typed", "converted", "partial", "cell-link", "no-nav", "changed", "edge", "empty", "expanded", "form", "line", "fold", "icon-alone", "aside", "sort-step", "filter-step", "foot", "at", "joined", "waits", "tab", "current"];
|
|
164
|
+
export declare const ATOM_STATES: readonly ["chosen", "disabled", "muted", "checked", "open", "status", "platform", "as-typed", "converted", "partial", "cell-link", "no-nav", "changed", "edge", "empty", "expanded", "form", "line", "fold", "icon-alone", "aside", "sort-step", "filter-step", "foot", "at", "joined", "waits", "tab", "current", "key", "index", "held", "toolbar-item", "today", "picked", "highlighted"];
|
|
140
165
|
export type AtomState = (typeof ATOM_STATES)[number];
|
|
141
166
|
/** The runtime services an app hands in through the provider. */
|
|
142
167
|
export declare const PORT_NAMES: readonly ["toast", "haptics", "clipboard", "viewPrefs", "confirm"];
|
package/views/dist/contract.js
CHANGED
|
@@ -231,6 +231,7 @@ export const COMPONENT_NAMES = [
|
|
|
231
231
|
];
|
|
232
232
|
export const OPTIONAL_COMPONENT_NAMES = [
|
|
233
233
|
"Input",
|
|
234
|
+
"Select",
|
|
234
235
|
"Command",
|
|
235
236
|
"Calendar",
|
|
236
237
|
"RowsWait",
|
|
@@ -269,6 +270,15 @@ export const ATOM_NAMES = [
|
|
|
269
270
|
"ToolbarButton",
|
|
270
271
|
"Avatar",
|
|
271
272
|
];
|
|
273
|
+
export const PANEL_SLOTS = {
|
|
274
|
+
sort: ["vk-sort", "vk-sort-rules", "vk-sort-rule", "vk-sort-grip", "vk-sort-field", "vk-sort-direction", "vk-sort-remove", "vk-sort-rule-open", "vk-sort-rule-more", "vk-sort-rule-action", "vk-sort-direction-option", "vk-sort-add", "vk-sort-clear", "vk-sort-foot", "vk-sort-none", "vk-sort-head"],
|
|
275
|
+
filter: ["vk-filter", "vk-filter-rules", "vk-filter-item", "vk-filter-rule", "vk-filter-where", "vk-filter-joined", "vk-filter-join", "vk-filter-field", "vk-filter-how", "vk-filter-value", "vk-filter-rule-more", "vk-filter-rule-action", "vk-filter-group", "vk-filter-group-head", "vk-filter-quantifier", "vk-filter-group-more", "vk-filter-group-action", "vk-filter-delete", "vk-filter-add", "vk-filter-clear", "vk-filter-foot", "vk-filter-none", "vk-filter-excluded", "vk-filter-head"],
|
|
276
|
+
group: ["vk-group", "vk-group-setting", "vk-group-choice", "vk-group-heading", "vk-group-value", "vk-group-hide-all", "vk-group-remove"],
|
|
277
|
+
customize: ["vk-customize", "vk-customize-head", "vk-customize-title", "vk-customize-back", "vk-customize-close", "vk-customize-layout-button", "vk-customize-name", "vk-customize-heading", "vk-customize-section", "vk-customize-field", "vk-customize-toggle", "vk-customize-toggle-reset", "vk-customize-choice", "vk-customize-option", "vk-customize-layout", "vk-customize-column", "vk-customize-search", "vk-customize-columns-action", "vk-customize-foot", "vk-customize-changes", "vk-customize-action", "vk-customize-stale"],
|
|
278
|
+
viewsList: ["vk-views-list", "vk-views-list-row", "vk-views-list-head"],
|
|
279
|
+
viewMenu: ["vk-view-menu", "vk-view-menu-row", "vk-view-menu-name", "vk-view-menu-layout", "vk-view-menu-columns", "vk-view-menu-act"],
|
|
280
|
+
quick: ["vk-quick", "vk-quick-field", "vk-quick-search", "vk-quick-value", "vk-quick-count", "vk-quick-clear", "vk-quick-none", "vk-quick-head"],
|
|
281
|
+
};
|
|
272
282
|
export const ATOM_SLOTS = [
|
|
273
283
|
"vk-row",
|
|
274
284
|
"vk-row-content",
|
|
@@ -348,17 +358,123 @@ export const ATOM_SLOTS = [
|
|
|
348
358
|
"vk-toolbar-clear",
|
|
349
359
|
"vk-toolbar-save-button",
|
|
350
360
|
"vk-filter-convert",
|
|
361
|
+
"vk-sort",
|
|
362
|
+
"vk-sort-rules",
|
|
363
|
+
"vk-sort-rule",
|
|
364
|
+
"vk-sort-grip",
|
|
365
|
+
"vk-sort-field",
|
|
366
|
+
"vk-sort-direction",
|
|
367
|
+
"vk-sort-remove",
|
|
368
|
+
"vk-sort-rule-open",
|
|
369
|
+
"vk-sort-rule-more",
|
|
370
|
+
"vk-sort-rule-action",
|
|
371
|
+
"vk-sort-direction-option",
|
|
372
|
+
"vk-sort-add",
|
|
373
|
+
"vk-sort-clear",
|
|
374
|
+
"vk-sort-foot",
|
|
375
|
+
"vk-sort-none",
|
|
376
|
+
"vk-filter",
|
|
377
|
+
"vk-filter-rules",
|
|
378
|
+
"vk-filter-item",
|
|
379
|
+
"vk-filter-rule",
|
|
380
|
+
"vk-filter-where",
|
|
381
|
+
"vk-filter-joined",
|
|
382
|
+
"vk-filter-join",
|
|
383
|
+
"vk-filter-field",
|
|
384
|
+
"vk-filter-how",
|
|
385
|
+
"vk-filter-value",
|
|
386
|
+
"vk-filter-rule-more",
|
|
387
|
+
"vk-filter-rule-action",
|
|
388
|
+
"vk-filter-group",
|
|
389
|
+
"vk-filter-group-head",
|
|
390
|
+
"vk-filter-group-more",
|
|
391
|
+
"vk-filter-quantifier",
|
|
392
|
+
"vk-filter-group-action",
|
|
393
|
+
"vk-filter-delete",
|
|
394
|
+
"vk-filter-add",
|
|
395
|
+
"vk-filter-clear",
|
|
396
|
+
"vk-filter-foot",
|
|
397
|
+
"vk-filter-none",
|
|
398
|
+
"vk-filter-excluded",
|
|
399
|
+
"vk-group",
|
|
400
|
+
"vk-group-setting",
|
|
401
|
+
"vk-group-choice",
|
|
402
|
+
"vk-group-heading",
|
|
403
|
+
"vk-group-value",
|
|
404
|
+
"vk-group-hide-all",
|
|
405
|
+
"vk-group-remove",
|
|
406
|
+
"vk-customize",
|
|
407
|
+
"vk-customize-head",
|
|
408
|
+
"vk-customize-title",
|
|
409
|
+
"vk-customize-back",
|
|
410
|
+
"vk-customize-close",
|
|
411
|
+
"vk-customize-layout-button",
|
|
412
|
+
"vk-customize-name",
|
|
413
|
+
"vk-customize-heading",
|
|
414
|
+
"vk-customize-section",
|
|
415
|
+
"vk-customize-field",
|
|
416
|
+
"vk-customize-toggle",
|
|
417
|
+
"vk-customize-toggle-reset",
|
|
418
|
+
"vk-customize-choice",
|
|
419
|
+
"vk-customize-option",
|
|
420
|
+
"vk-customize-layout",
|
|
421
|
+
"vk-customize-column",
|
|
422
|
+
"vk-customize-search",
|
|
423
|
+
"vk-customize-columns-action",
|
|
424
|
+
"vk-customize-foot",
|
|
425
|
+
"vk-customize-changes",
|
|
426
|
+
"vk-customize-action",
|
|
427
|
+
"vk-customize-stale",
|
|
428
|
+
"vk-views-list",
|
|
429
|
+
"vk-views-list-row",
|
|
430
|
+
"vk-views-list-head",
|
|
431
|
+
"vk-view-menu",
|
|
432
|
+
"vk-view-menu-row",
|
|
433
|
+
"vk-view-menu-name",
|
|
434
|
+
"vk-view-menu-layout",
|
|
435
|
+
"vk-view-menu-columns",
|
|
436
|
+
"vk-view-menu-act",
|
|
437
|
+
"vk-quick",
|
|
438
|
+
"vk-quick-field",
|
|
439
|
+
"vk-quick-search",
|
|
440
|
+
"vk-quick-value",
|
|
441
|
+
"vk-quick-count",
|
|
442
|
+
"vk-quick-clear",
|
|
443
|
+
"vk-quick-none",
|
|
444
|
+
"vk-quick-head",
|
|
351
445
|
];
|
|
352
446
|
export const SELECTION_SLOTS = [
|
|
353
447
|
"vk-selection-bar",
|
|
354
448
|
"vk-selection-pill",
|
|
355
449
|
"vk-selection-chip",
|
|
356
450
|
];
|
|
451
|
+
export const EDITOR_PART_SLOTS = {
|
|
452
|
+
shared: ["vk-editor-close", "vk-editor-save", "vk-editor-back", "vk-editor-cancel"],
|
|
453
|
+
date: [
|
|
454
|
+
"vk-date", "vk-calendar", "vk-date-line", "vk-date-reads", "vk-date-error", "vk-date-time", "vk-date-head", "vk-date-prev",
|
|
455
|
+
"vk-date-next", "vk-date-month", "vk-date-year", "vk-date-days", "vk-date-weekdays", "vk-date-day", "vk-date-choices",
|
|
456
|
+
"vk-date-choice", "vk-date-quarters", "vk-date-quarter", "vk-date-parts", "vk-date-part", "vk-date-segment", "vk-date-sep",
|
|
457
|
+
"vk-date-picks", "vk-date-pick", "vk-date-card", "vk-date-wheels", "vk-date-wheel", "vk-date-wheel-row",
|
|
458
|
+
],
|
|
459
|
+
text: ["vk-text", "vk-text-box", "vk-text-country", "vk-text-dial", "vk-text-note"],
|
|
460
|
+
number: ["vk-number", "vk-number-box", "vk-number-currency", "vk-number-unit"],
|
|
461
|
+
parts: ["vk-parts", "vk-parts-field", "vk-parts-box", "vk-parts-line", "vk-parts-own", "vk-parts-card", "vk-parts-pair", "vk-parts-note", "vk-parts-bands"],
|
|
462
|
+
values: ["vk-values", "vk-values-rows", "vk-values-row", "vk-values-value", "vk-values-edit", "vk-values-label", "vk-values-main", "vk-values-pill", "vk-values-acts", "vk-values-grip", "vk-values-copy", "vk-values-open", "vk-values-remove", "vk-values-line", "vk-values-code", "vk-values-prefix", "vk-values-add", "vk-values-back", "vk-values-error"],
|
|
463
|
+
links: ["vk-links", "vk-links-search", "vk-links-list", "vk-links-head", "vk-links-rows", "vk-links-row", "vk-links-name", "vk-links-field", "vk-links-value", "vk-links-control", "vk-links-pop", "vk-links-lead", "vk-links-remove", "vk-links-config", "vk-links-more", "vk-links-action", "vk-links-step", "vk-links-back", "vk-links-unlink", "vk-links-offers", "vk-links-offer", "vk-links-offer-action", "vk-links-note", "vk-links-retry"],
|
|
464
|
+
picker: ["vk-picker", "vk-picker-search", "vk-picker-list", "vk-picker-chips", "vk-picker-chip", "vk-picker-option", "vk-picker-parent", "vk-picker-empty", "vk-picker-add", "vk-picker-create", "vk-picker-action", "vk-picker-group", "vk-picker-heading", "vk-picker-card", "vk-picker-selected", "vk-picker-tick", "vk-picker-row-more", "vk-picker-more", "vk-picker-back", "vk-picker-count", "vk-picker-clear", "vk-picker-lead", "vk-picker-lead-make", "vk-picker-message", "vk-picker-retry", "vk-picker-loading", "vk-picker-foot"],
|
|
465
|
+
};
|
|
357
466
|
export const EDITOR_SLOTS = [
|
|
358
467
|
"vk-editor-panel",
|
|
359
468
|
"vk-editor-bar",
|
|
360
469
|
"vk-editor-refusal",
|
|
361
470
|
"vk-text-editor",
|
|
471
|
+
"vk-date-editor",
|
|
472
|
+
"vk-text-body",
|
|
473
|
+
"vk-number-body",
|
|
474
|
+
"vk-parts-body",
|
|
475
|
+
"vk-values-body",
|
|
476
|
+
"vk-links-body",
|
|
477
|
+
...Object.values(EDITOR_PART_SLOTS).flat(),
|
|
362
478
|
];
|
|
363
479
|
export const EDITOR_STATES = ["vk-body"];
|
|
364
480
|
export const ATOM_STATES = [
|
|
@@ -391,6 +507,13 @@ export const ATOM_STATES = [
|
|
|
391
507
|
"waits",
|
|
392
508
|
"tab",
|
|
393
509
|
"current",
|
|
510
|
+
"key",
|
|
511
|
+
"index",
|
|
512
|
+
"held",
|
|
513
|
+
"toolbar-item",
|
|
514
|
+
"today",
|
|
515
|
+
"picked",
|
|
516
|
+
"highlighted",
|
|
394
517
|
];
|
|
395
518
|
export const PORT_NAMES = ["toast", "haptics", "clipboard", "viewPrefs", "confirm"];
|
|
396
519
|
export const ICON_NAMES = [
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { ViewsContext } from "../../provider/context.js";
|
|
4
4
|
import { Button } from "./button.js";
|
|
5
|
+
import { markOwnControl } from "../../provider/own-control.js";
|
|
5
6
|
const KIND = {
|
|
6
7
|
default: "primary", ghost: "quiet", outline: "outline", destructive: "danger", secondary: "soft",
|
|
7
8
|
};
|
|
@@ -25,3 +26,4 @@ export function MapButton({ variant = "default", size = "default", type = "butto
|
|
|
25
26
|
const { icon, label, iconEnd } = size === "icon" ? { icon: undefined, label: children, iconEnd: undefined } : leadingGlyph(children, glyphs);
|
|
26
27
|
return _jsx(Button, { kind: KIND[variant], size: size === "default" ? "md" : "sm", shape: size === "icon" ? "icon" : "default", type: type, icon: icon, iconEnd: iconEnd, ...rest, children: label });
|
|
27
28
|
}
|
|
29
|
+
markOwnControl(MapButton);
|
|
@@ -18,8 +18,9 @@ export declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProp
|
|
|
18
18
|
/** The Checkbox's box alone, for a row of a list that is pressed as a whole (a list's row where several can be chosen):
|
|
19
19
|
* ticked when its row is chosen, greyed when its row is off, as the Checkbox draws it. The row carries the choice for the
|
|
20
20
|
* keyboard and screen readers. */
|
|
21
|
-
export declare function CheckboxMark({ className }: {
|
|
22
|
-
className?: string;
|
|
21
|
+
export declare function CheckboxMark({ className, "data-slot": slot }: {
|
|
22
|
+
className?: string; /** Its public name (VK-989): a Picker row's tick, several held. */
|
|
23
|
+
"data-slot"?: string;
|
|
23
24
|
}): import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
export type CheckboxListProps = Omit<React.ComponentProps<typeof BaseCheckboxGroup>, "className"> & {
|
|
25
26
|
className?: string;
|
|
@@ -9,8 +9,8 @@ export const Checkbox = React.forwardRef(function Checkbox({ label, note, row =
|
|
|
9
9
|
const phone = usePhoneForm();
|
|
10
10
|
return (_jsxs("label", { className: cx("o-check", row && "o-check-row", card && "o-choice-card", className), "data-kit": "checkbox", ...phoneMark(phone), children: [_jsxs(BaseCheckbox.Root, { ref: ref, className: "o-check-box", ...props, children: [_jsx(Cut, {}), _jsx(BaseCheckbox.Indicator, { keepMounted: true, className: "o-check-mark", children: _jsxs("svg", { viewBox: "0 0 24 24", strokeWidth: 2.75, "aria-hidden": "true", children: [_jsx("path", { className: "o-check-tick", d: "M5 12l5 5l10 -10", pathLength: 1 }), _jsx("path", { className: "o-check-dash", d: "M6 12h12" })] }) })] }), (label != null || note != null) && (_jsxs("span", { className: "o-choice-text", children: [label != null && _jsx("span", { className: "o-choice-label", children: label }), note != null && _jsx("span", { className: "o-choice-note", children: note })] }))] }));
|
|
11
11
|
});
|
|
12
|
-
export function CheckboxMark({ className }) {
|
|
13
|
-
return (_jsxs("span", { className: cx("o-check-box o-check-in-row", className), "aria-hidden": "true", children: [_jsx(Cut, {}), _jsx("span", { className: "o-check-mark", children: _jsx("svg", { viewBox: "0 0 24 24", strokeWidth: 2.75, children: _jsx("path", { className: "o-check-tick", d: "M5 12l5 5l10 -10", pathLength: 1 }) }) })] }));
|
|
12
|
+
export function CheckboxMark({ className, "data-slot": slot }) {
|
|
13
|
+
return (_jsxs("span", { className: cx("o-check-box o-check-in-row", className), "data-slot": slot, "aria-hidden": "true", children: [_jsx(Cut, {}), _jsx("span", { className: "o-check-mark", children: _jsx("svg", { viewBox: "0 0 24 24", strokeWidth: 2.75, children: _jsx("path", { className: "o-check-tick", d: "M5 12l5 5l10 -10", pathLength: 1 }) }) })] }));
|
|
14
14
|
}
|
|
15
15
|
export function CheckboxList({ className, ...props }) {
|
|
16
16
|
return _jsx(BaseCheckboxGroup, { className: cx("o-check-list o-smooth o-smooth-ease", className), ...props });
|
|
@@ -78,7 +78,7 @@ export type RangePartsProps = Extract<CompoundEditorProps, {
|
|
|
78
78
|
export interface CompoundEditorParts {
|
|
79
79
|
body: React.ReactNode;
|
|
80
80
|
/** On a phone, the Sheet head's ✕ and ✓, or Back on a list's step; on a computer, nothing. */
|
|
81
|
-
head: Pick<SheetHeadProps, "left" | "right" | "onBack" | "close">;
|
|
81
|
+
head: Pick<SheetHeadProps, "left" | "right" | "onBack" | "backSlot" | "close">;
|
|
82
82
|
/** On a phone, the Sheet's title while it is on a list's step (Country, State). */
|
|
83
83
|
title?: string;
|
|
84
84
|
}
|
|
@@ -76,10 +76,10 @@ export function useNameParts(props, worn, wornAt) {
|
|
|
76
76
|
then();
|
|
77
77
|
} };
|
|
78
78
|
const toLast = () => last.current?.focus({ preventScroll: true });
|
|
79
|
-
const body = fields ? (_jsxs("div", { ref: root, className: "o-compound-editor", "data-kit": "compound-editor", ...kit, "data-parts-form": "phone", ...device, children: [_jsxs(FieldRows, { look: MIHAI_CARD, className: "o-compound-editor-card", children: [_jsx(FieldRow, { label: w.first, className: "o-compound-editor-card-row", labelClassName: "o-compound-editor-card-label", children: _jsx(Input, { chrome: "bare", ref: first, className: "o-compound-editor-card-input", value: given, autofill: false, enterKeyHint: "next", ...words, onChange: (e) => part("given", e.target.value), onKeyDown: (e) => enter(toLast)(e) }) }), _jsx(FieldRow, { label: w.last, className: "o-compound-editor-card-row", labelClassName: "o-compound-editor-card-label", children: _jsx(Input, { chrome: "bare", ref: last, className: "o-compound-editor-card-input", value: family, autofill: false, enterKeyHint: "done", ...words, onChange: (e) => part("family", e.target.value), onKeyDown: (e) => enter(keep)(e) }) })] }), shownAs && _jsxs("div", { className: "o-compound-editor-shown", children: [_jsx(FieldRows, { look: MIHAI_CARD, className: "o-compound-editor-card", children: _jsx(FieldRow, { label: w.shownAs, className: "o-compound-editor-card-row", labelClassName: "o-compound-editor-card-label", children: _jsx(Input, { chrome: "bare", className: "o-compound-editor-card-input", value: line ?? joined, placeholder: joined || label, "data-follows": own ? undefined : "", autofill: false, enterKeyHint: "done", ...words, onChange: (e) => typeLine(e.target.value), onKeyDown: (e) => enter(keep)(e) }) }) }), _jsx("p", { className: "o-compound-editor-caption", "data-bad": note ? "" : undefined, role: note ? "alert" : undefined, children: note ?? (own ? w.own : w.follows) })] }), !shownAs && note && _jsx("p", { className: "o-compound-editor-caption", "data-bad": "", role: "alert", children: note })] })) : (_jsxs("div", { ref: root, className: "o-compound-editor", "data-kit": "compound-editor", ...kit, "data-parts-form": "phone", ...device, children: [_jsxs(PartsRow, { children: [_jsx(QuietField, { label: w.first, form: "phone", children: _jsx(Input, { ref: first, size: "lg", value: given, autofill: false, enterKeyHint: "next", ...words, onChange: (e) => part("given", e.target.value), onKeyDown: (e) => enter(toLast)(e) }) }), _jsx(QuietField, { label: w.last, form: "phone", children: _jsx(Input, { ref: last, size: "lg", value: family, autofill: false, enterKeyHint: "done", ...words, onChange: (e) => part("family", e.target.value), onKeyDown: (e) => enter(keep)(e) }) })] }), shownAs && _jsx(QuietField, { label: w.shownAs, form: "phone", children: _jsx(Input, { size: "lg", value: line ?? joined, placeholder: joined || label, "data-follows": own ? undefined : "", autofill: false, enterKeyHint: "done", ...words, onChange: (e) => typeLine(e.target.value), onKeyDown: (e) => enter(keep)(e) }) }), note && _jsx("p", { className: "o-compound-editor-note", "data-bad": "", role: "alert", children: note })] }));
|
|
79
|
+
const body = fields ? (_jsxs("div", { ref: root, className: "o-compound-editor", "data-slot": "vk-parts", "data-kit": "compound-editor", ...kit, "data-parts-form": "phone", ...device, children: [_jsxs(FieldRows, { look: MIHAI_CARD, className: "o-compound-editor-card", "data-slot": "vk-parts-card", children: [_jsx(FieldRow, { label: w.first, className: "o-compound-editor-card-row", "data-slot": "vk-parts-field", "data-key": "given", labelClassName: "o-compound-editor-card-label", children: _jsx(Input, { chrome: "bare", ref: first, className: "o-compound-editor-card-input", "data-slot": "vk-parts-box", "data-key": "given", value: given, autofill: false, enterKeyHint: "next", ...words, onChange: (e) => part("given", e.target.value), onKeyDown: (e) => enter(toLast)(e) }) }), _jsx(FieldRow, { label: w.last, className: "o-compound-editor-card-row", "data-slot": "vk-parts-field", "data-key": "family", labelClassName: "o-compound-editor-card-label", children: _jsx(Input, { chrome: "bare", ref: last, className: "o-compound-editor-card-input", "data-slot": "vk-parts-box", "data-key": "family", value: family, autofill: false, enterKeyHint: "done", ...words, onChange: (e) => part("family", e.target.value), onKeyDown: (e) => enter(keep)(e) }) })] }), shownAs && _jsxs("div", { className: "o-compound-editor-shown", children: [_jsx(FieldRows, { look: MIHAI_CARD, className: "o-compound-editor-card", "data-slot": "vk-parts-card", children: _jsx(FieldRow, { label: w.shownAs, className: "o-compound-editor-card-row", "data-slot": "vk-parts-field", "data-key": "shown", labelClassName: "o-compound-editor-card-label", children: _jsx(Input, { chrome: "bare", className: "o-compound-editor-card-input", "data-slot": "vk-parts-box", "data-key": "shown", value: line ?? joined, placeholder: joined || label, "data-follows": own ? undefined : "", autofill: false, enterKeyHint: "done", ...words, onChange: (e) => typeLine(e.target.value), onKeyDown: (e) => enter(keep)(e) }) }) }), _jsx("p", { className: "o-compound-editor-caption", "data-slot": "vk-parts-note", "data-bad": note ? "" : undefined, role: note ? "alert" : undefined, children: note ?? (own ? w.own : w.follows) })] }), !shownAs && note && _jsx("p", { className: "o-compound-editor-caption", "data-slot": "vk-parts-note", "data-bad": "", role: "alert", children: note })] })) : (_jsxs("div", { ref: root, className: "o-compound-editor", "data-slot": "vk-parts", "data-kit": "compound-editor", ...kit, "data-parts-form": "phone", ...device, children: [_jsxs(PartsRow, { children: [_jsx(QuietField, { label: w.first, form: "phone", "data-slot": "vk-parts-field", "data-key": "given", children: _jsx(Input, { ref: first, size: "lg", "data-slot": "vk-parts-box", "data-key": "given", value: given, autofill: false, enterKeyHint: "next", ...words, onChange: (e) => part("given", e.target.value), onKeyDown: (e) => enter(toLast)(e) }) }), _jsx(QuietField, { label: w.last, form: "phone", "data-slot": "vk-parts-field", "data-key": "family", children: _jsx(Input, { ref: last, size: "lg", "data-slot": "vk-parts-box", "data-key": "family", value: family, autofill: false, enterKeyHint: "done", ...words, onChange: (e) => part("family", e.target.value), onKeyDown: (e) => enter(keep)(e) }) })] }), shownAs && _jsx(QuietField, { label: w.shownAs, form: "phone", "data-slot": "vk-parts-field", "data-key": "shown", children: _jsx(Input, { size: "lg", "data-slot": "vk-parts-box", "data-key": "shown", value: line ?? joined, placeholder: joined || label, "data-follows": own ? undefined : "", autofill: false, enterKeyHint: "done", ...words, onChange: (e) => typeLine(e.target.value), onKeyDown: (e) => enter(keep)(e) }) }), note && _jsx("p", { className: "o-compound-editor-note", "data-slot": "vk-parts-note", "data-bad": "", role: "alert", children: note })] }));
|
|
80
80
|
if (shell)
|
|
81
81
|
return { body, head: {} };
|
|
82
|
-
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 }) } };
|
|
82
|
+
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 }) } };
|
|
83
83
|
}
|
|
84
84
|
const onKeyDown = (e) => {
|
|
85
85
|
if (midWord(e.nativeEvent))
|
|
@@ -101,7 +101,7 @@ export function useNameParts(props, worn, wornAt) {
|
|
|
101
101
|
keep();
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
const theLine = shownAs && (_jsxs("div", { className: "o-compound-editor-line o-popup-line", "data-own": own ? "" : undefined, children: [glyph(USER), _jsx(Input, { chrome: "bare", className: "o-compound-editor-line-input", "aria-label": label, placeholder: joined || label, autofill: false, ...words, value: line ?? joined, onChange: (e) => typeLine(e.target.value) }), own && _jsx("span", { className: "o-compound-editor-own", children: w.ownMark })] }));
|
|
105
|
-
const body = (_jsxs("div", { ref: root, className: "o-compound-editor", "data-kit": "compound-editor", ...kit, "data-parts-form": "computer", ...device, onBlur: shell ? undefined : (e) => blurKeeps(settled, keep)(e), onFocus: () => { settled.current = false; }, onKeyDown: onKeyDown, children: [theLine, fields ? (_jsxs("div", { className: "o-compound-editor-pair", children: [_jsx(Input, { ref: first, size: "sm", "aria-label": w.first, placeholder: w.first, autofill: false, ...words, value: given, onChange: (e) => part("given", e.target.value) }), _jsx(Input, { size: "sm", "aria-label": w.last, placeholder: w.last, autofill: false, ...words, value: family, onChange: (e) => part("family", e.target.value) })] })) : (_jsxs(PartsRow, { children: [_jsx(QuietField, { label: w.first, form: "computer", children: _jsx(Input, { ref: first, size: "sm", autofill: false, ...words, value: given, onChange: (e) => part("given", e.target.value) }) }), _jsx(QuietField, { label: w.last, form: "computer", children: _jsx(Input, { size: "sm", autofill: false, ...words, value: family, onChange: (e) => part("family", e.target.value) }) })] })), note && _jsx("p", { className: "o-compound-editor-note", "data-bad": "", role: "alert", children: note })] }));
|
|
104
|
+
const theLine = shownAs && (_jsxs("div", { className: "o-compound-editor-line o-popup-line", "data-slot": "vk-parts-line", "data-own": own ? "" : undefined, children: [glyph(USER), _jsx(Input, { chrome: "bare", className: "o-compound-editor-line-input", "aria-label": label, placeholder: joined || label, autofill: false, ...words, value: line ?? joined, onChange: (e) => typeLine(e.target.value) }), own && _jsx("span", { className: "o-compound-editor-own", "data-slot": "vk-parts-own", children: w.ownMark })] }));
|
|
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, onBlur: shell ? undefined : (e) => blurKeeps(settled, keep)(e), onFocus: () => { settled.current = false; }, onKeyDown: onKeyDown, children: [theLine, fields ? (_jsxs("div", { className: "o-compound-editor-pair", "data-slot": "vk-parts-pair", children: [_jsx(Input, { ref: first, size: "sm", "data-slot": "vk-parts-box", "data-key": "given", "aria-label": w.first, placeholder: w.first, autofill: false, ...words, value: given, onChange: (e) => part("given", e.target.value) }), _jsx(Input, { size: "sm", "data-slot": "vk-parts-box", "data-key": "family", "aria-label": w.last, placeholder: w.last, autofill: false, ...words, value: family, onChange: (e) => part("family", e.target.value) })] })) : (_jsxs(PartsRow, { children: [_jsx(QuietField, { label: w.first, form: "computer", "data-slot": "vk-parts-field", "data-key": "given", children: _jsx(Input, { ref: first, size: "sm", "data-slot": "vk-parts-box", "data-key": "given", autofill: false, ...words, value: given, onChange: (e) => part("given", e.target.value) }) }), _jsx(QuietField, { label: w.last, form: "computer", "data-slot": "vk-parts-field", "data-key": "family", children: _jsx(Input, { size: "sm", "data-slot": "vk-parts-box", "data-key": "family", autofill: false, ...words, value: family, onChange: (e) => part("family", e.target.value) }) })] })), note && _jsx("p", { className: "o-compound-editor-note", "data-slot": "vk-parts-note", "data-bad": "", role: "alert", children: note })] }));
|
|
106
106
|
return { body, head: {} };
|
|
107
107
|
}
|