viewkitjs 0.36.0 → 0.37.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.
Files changed (151) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/package.json +1 -1
  3. package/views/dist/atoms/types.d.ts +32 -4
  4. package/views/dist/contract.d.ts +14 -8
  5. package/views/dist/contract.js +14 -1
  6. package/views/dist/controls/button/own-look-moved.d.ts +11 -0
  7. package/views/dist/controls/button/own-look-moved.js +3 -0
  8. package/views/dist/controls/date-editor/date-behaviour.d.ts +80 -0
  9. package/views/dist/controls/date-editor/date-behaviour.js +187 -0
  10. package/views/dist/controls/date-editor/date-editor.d.ts +3 -2
  11. package/views/dist/controls/date-editor/date-editor.js +29 -166
  12. package/views/dist/controls/field/field.d.ts +3 -2
  13. package/views/dist/controls/field/field.js +7 -2
  14. package/views/dist/controls/field/looks.d.ts +1 -1
  15. package/views/dist/controls/field/looks.js +5 -4
  16. package/views/dist/controls/field.css +4 -0
  17. package/views/dist/controls/filter-editor/filter-editor.js +2 -2
  18. package/views/dist/controls/filter-editor/parts.d.ts +2 -0
  19. package/views/dist/controls/filter-editor/parts.js +1 -1
  20. package/views/dist/controls/index.d.ts +3 -1
  21. package/views/dist/controls/index.js +3 -1
  22. package/views/dist/controls/inline-input.css +9 -0
  23. package/views/dist/controls/internal/phone.d.ts +1 -1
  24. package/views/dist/controls/internal/phone.js +3 -2
  25. package/views/dist/controls/list/tokens.d.ts +1 -1
  26. package/views/dist/controls/list/tokens.js +1 -1
  27. package/views/dist/controls/list.css +5 -2
  28. package/views/dist/controls/menu-list/menu-list.js +3 -2
  29. package/views/dist/controls/menu.css +4 -4
  30. package/views/dist/controls/pane.css +1 -1
  31. package/views/dist/controls/picker.css +5 -3
  32. package/views/dist/controls/popover/looks.d.ts +1 -1
  33. package/views/dist/controls/popover/looks.js +5 -0
  34. package/views/dist/controls/popover/tokens.d.ts +13 -1
  35. package/views/dist/controls/popover/tokens.js +4 -1
  36. package/views/dist/controls/popover.css +59 -8
  37. package/views/dist/controls/select/select.js +1 -1
  38. package/views/dist/controls/sort-editor.css +4 -2
  39. package/views/dist/controls/text-editor.css +6 -0
  40. package/views/dist/controls/toolbar/toolbar.d.ts +4 -2
  41. package/views/dist/controls/toolbar/toolbar.js +7 -2
  42. package/views/dist/controls/toolbar-button/atom-toolbar-button.js +1 -1
  43. package/views/dist/controls/toolbar.css +5 -0
  44. package/views/dist/controls/tooltip/tokens.d.ts +1 -1
  45. package/views/dist/controls/tooltip/tokens.js +1 -1
  46. package/views/dist/controls/tooltip.css +5 -3
  47. package/views/dist/controls/values-editor.css +20 -5
  48. package/views/dist/display/entity-chip.d.ts +7 -1
  49. package/views/dist/display/entity-chip.js +2 -1
  50. package/views/dist/field-row/FieldRow.js +12 -8
  51. package/views/dist/grid/chrome/GridCellEditors.d.ts +4 -1
  52. package/views/dist/grid/chrome/GridCellEditors.js +3 -2
  53. package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -5
  54. package/views/dist/grid/chrome/GridCellOutline.js +3 -5
  55. package/views/dist/grid/chrome/GridChipsEditor.js +1 -1
  56. package/views/dist/grid/chrome/GridDateEditor.d.ts +1 -1
  57. package/views/dist/grid/chrome/GridDateEditor.js +1 -1
  58. package/views/dist/grid/chrome/GridLongTextEditor.d.ts +1 -1
  59. package/views/dist/grid/chrome/GridLongTextEditor.js +8 -5
  60. package/views/dist/grid/chrome/GridNameEditor.d.ts +1 -1
  61. package/views/dist/grid/chrome/GridNameEditor.js +1 -1
  62. package/views/dist/grid/chrome/GridNumberEditor.d.ts +1 -1
  63. package/views/dist/grid/chrome/GridNumberEditor.js +2 -2
  64. package/views/dist/grid/chrome/GridPlaceEditor.d.ts +1 -1
  65. package/views/dist/grid/chrome/GridPlaceEditor.js +1 -1
  66. package/views/dist/grid/chrome/GridRangeEditor.d.ts +2 -2
  67. package/views/dist/grid/chrome/GridRangeEditor.js +1 -1
  68. package/views/dist/grid/chrome/GridRelationEditor.js +2 -2
  69. package/views/dist/grid/chrome/GridRowCells.js +6 -5
  70. package/views/dist/grid/chrome/GridSelectEditor.js +1 -1
  71. package/views/dist/grid/chrome/GridTable.d.ts +2 -1
  72. package/views/dist/grid/chrome/GridTable.js +7 -2
  73. package/views/dist/grid/chrome/GridTextEditor.d.ts +1 -1
  74. package/views/dist/grid/chrome/GridTextEditor.js +2 -2
  75. package/views/dist/grid/chrome/GridValueListEditor.d.ts +1 -1
  76. package/views/dist/grid/chrome/GridValueListEditor.js +1 -1
  77. package/views/dist/grid/chrome/grid-body-place.d.ts +7 -2
  78. package/views/dist/grid/chrome/grid-body-place.js +8 -4
  79. package/views/dist/grid/chrome/grid-cell-classes.js +2 -2
  80. package/views/dist/grid/chrome/grid-edit-session.d.ts +4 -0
  81. package/views/dist/grid/chrome/grid-edit-session.js +10 -1
  82. package/views/dist/grid/chrome/grid-editor-layer.d.ts +10 -0
  83. package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
  84. package/views/dist/grid/chrome/grid-fitted-box.d.ts +4 -4
  85. package/views/dist/grid/chrome/grid-fitted-box.js +1 -3
  86. package/views/dist/grid/chrome/grid-hover.d.ts +3 -3
  87. package/views/dist/grid/chrome/grid-hover.js +2 -3
  88. package/views/dist/grid/chrome/grid-row-props.d.ts +6 -2
  89. package/views/dist/grid/chrome/grid-styles.d.ts +1 -5
  90. package/views/dist/grid/chrome/grid-styles.js +0 -1
  91. package/views/dist/grid/chrome/useGridKeyboard.d.ts +0 -1
  92. package/views/dist/grid/chrome/useGridKeyboard.js +2 -10
  93. package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +3 -1
  94. package/views/dist/grid/chrome/useGridTableInteractionModel.js +24 -1
  95. package/views/dist/grid/core/useGridEditing.d.ts +3 -0
  96. package/views/dist/grid/core/useGridEditing.js +2 -0
  97. package/views/dist/grid/grid.css +4 -19
  98. package/views/dist/internal/screen-forms.d.ts +11 -0
  99. package/views/dist/internal/screen-forms.js +31 -0
  100. package/views/dist/list/list.js +2 -1
  101. package/views/dist/list/parts.d.ts +8 -2
  102. package/views/dist/list/parts.js +31 -7
  103. package/views/dist/list/toolbar.js +7 -3
  104. package/views/dist/looks/index.d.ts +1 -0
  105. package/views/dist/looks/index.js +1 -0
  106. package/views/dist/panels/react/popover.d.ts +3 -1
  107. package/views/dist/panels/react/popover.js +2 -2
  108. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +6 -3
  109. package/views/dist/panels/react/toolbar/Toolbar.d.ts +12 -1
  110. package/views/dist/panels/react/toolbar/Toolbar.js +5 -1
  111. package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
  112. package/views/dist/panels/react/toolbar/ToolbarButton.js +3 -2
  113. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -3
  114. package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
  115. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +1 -1
  116. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
  117. package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
  118. package/views/dist/panels/react/toolbar/ToolbarSave.js +28 -20
  119. package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
  120. package/views/dist/panels/react/toolbar/context.d.ts +3 -2
  121. package/views/dist/panels/react/views-row/FoldingViewRow.js +24 -7
  122. package/views/dist/panels/react/views-row/ViewPicker.js +1 -1
  123. package/views/dist/panels/react/views-row/more-views.d.ts +2 -0
  124. package/views/dist/panels/react/views-row/more-views.js +3 -0
  125. package/views/dist/panels/react.d.ts +1 -1
  126. package/views/dist/panels/toolbar/model.d.ts +2 -2
  127. package/views/dist/provider/components.d.ts +6 -6
  128. package/views/dist/provider/desktop.d.ts +2 -1
  129. package/views/dist/provider/desktop.js +5 -2
  130. package/views/dist/styles.css +181 -80
  131. package/views/dist/styles.unlayered.css +181 -80
  132. package/views/docs/contract.md +68 -20
  133. package/views/docs/controls/list.md +2 -0
  134. package/views/docs/controls/menu.md +2 -0
  135. package/views/docs/controls/picker.md +2 -0
  136. package/views/docs/controls/popover.md +7 -0
  137. package/views/docs/controls/tooltip.md +2 -0
  138. package/views/docs/guides/atoms.md +11 -10
  139. package/views/docs/guides/the-grid.md +7 -5
  140. package/views/docs/guides/the-provider.md +2 -2
  141. package/views/docs/reference/controls.md +11 -6
  142. package/views/docs/reference/display.md +1 -1
  143. package/views/docs/reference/field-row.md +1 -1
  144. package/views/docs/reference/list.md +5 -6
  145. package/views/docs/reference/looks.md +4 -1
  146. package/views/docs/reference/panels-react.md +5 -4
  147. package/views/docs/reference/panels.md +1 -1
  148. package/views/docs/reference/react.md +6 -6
  149. package/views/docs/reference/views.md +2 -2
  150. package/views/docs/reshaping.md +2 -2
  151. package/views/skills/views/SKILL.md +1 -1
@@ -8,19 +8,18 @@ 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";
10
10
  import { SheetButton } from "../sheet/bottom-sheet.js";
11
- import { addMonths, dateNames, lineDay, lineText, parts, QUARTERS, quickPick, readDate, todayOf } from "./calendar.js";
11
+ import { addMonths, lineText, parts, QUARTERS } from "./calendar.js";
12
12
  import { DateDays } from "./date-days.js";
13
13
  import { DateParts } from "./date-parts.js";
14
14
  import { DATE_EDITOR_ATTIO, DATE_EDITOR_ATTRS, DATE_EDITOR_LOOKS, dateEditorWornOf } from "./looks.js";
15
15
  import { yearTyped } from "./segments.js";
16
- import { dateWords } from "./words.js";
16
+ import { useDateBehaviour } from "./date-behaviour.js";
17
17
  export const glyph = (paths, className) => (_jsx("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths.map((d) => _jsx("path", { d: d }, d)) }));
18
18
  const CAL = ["M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z", "M16 3v4", "M8 3v4", "M4 11h16"];
19
19
  const CLOCK = ["M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", "M12 7v5l3 3"];
20
20
  export const LEFT = ["M15 6l-6 6l6 6"], RIGHT = ["M9 6l6 6l-6 6"];
21
21
  const DOWN = ["M6 9l6 6l6 -6"], X = ["M18 6l-12 12", "M6 6l12 12"], TICK = ["M5 12l5 5l10 -10"];
22
22
  const CAL_WEEK = [...CAL, "M8 15h8"];
23
- const PICK_WORD = { today: "today", tomorrow: "tomorrow", "next-week": "nextWeek", "in-a-week": "inAWeek", "next-monday": "nextMonday", none: "none" };
24
23
  const PICKS = {
25
24
  today: { icon: [...CAL, "M8 15h2v2h-2z"] },
26
25
  tomorrow: { icon: ["M5 12h14", "M13 18l6 -6", "M13 6l6 6"] },
@@ -75,165 +74,48 @@ const wheelOf = (opens) => (opens === "years" || opens === "months" ? "date" : o
75
74
  export function useDateEditor(props) {
76
75
  const { Button, Input, Calendar } = usePanelControls();
77
76
  const [wornRef, worn] = useDateEditorWorn(props.worn);
78
- const w = dateWords(props.words), names = dateNames(props.language);
79
- const root = React.useRef(null);
80
- const rootRef = React.useCallback((el) => { root.current = el; wornRef(el); }, [wornRef]);
81
- const { label, value, onValueChange, onDone, time = false, empty = false, days = "any", autoFocus = true } = props;
77
+ const { label } = props;
82
78
  const host = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (host || small ? "phone" : "computer")) === "phone";
83
- const today = props.today ?? todayOf();
84
- const picks = props.picks ?? ["today", "tomorrow", "next-week", ...(empty ? ["none"] : [])];
85
- const [date, setDate] = React.useState(value ? value.slice(0, 10) : null);
86
- const [clock, setClock] = React.useState(value && value.length > 10 ? value.slice(11, 16) : null);
87
- const [key, setKey] = React.useState(date ?? today), [view, setView] = React.useState(viewOf(props.opens));
88
- const [typed, setTyped] = React.useState(props.typed ?? null);
89
- const [error, setError] = React.useState(() => { const r = props.typed != null && props.typed.length > 1 ? readDate(props.typed, today, names, w) : null; return r && "error" in r ? r.error : null; });
79
+ const [view, setView] = React.useState(viewOf(props.opens));
90
80
  const [wheel, setWheel] = React.useState(wheelOf(props.opens));
91
- const settled = React.useRef(false), line = React.useRef(null);
92
- const off = (day) => (days === "from-today" && day < today) || (days === "until-today" && day > today);
93
- const reading = typed != null ? readDate(typed, today, names, w) : null;
94
81
  const lineBox = phone ? worn.calendar === "plain" : worn.line === "box";
95
- const blank = (t) => t == null || (lineBox && !t.trim());
96
- const clears = empty && !lineBox;
82
+ const b = useDateBehaviour({ ...props, line: lineBox ? "box" : "written" }, () => { setView(viewOf(props.opens)); setWheel(wheelOf(props.opens)); });
83
+ const { date, clock, error, today, words: w, names } = b;
84
+ const time = props.time ?? false;
97
85
  const inParts = time && worn.time === "parts";
98
86
  const [yearText, setYearText] = React.useState(null), yearFocus = React.useRef(false);
99
- const valueOf = (d, t) => (d ? (time && t ? `${d}T${t}` : d) : null);
100
- const shell = props.draft === "shell";
101
- const handed = React.useRef(value);
102
- const hand = (d, t) => {
103
- if (!shell)
104
- return;
105
- const next = valueOf(d, t);
106
- if (next === handed.current)
107
- return;
108
- handed.current = next;
109
- onValueChange(next);
110
- };
111
- const dayOfLine = () => lineDay(typed, date, today, clears, names);
112
- const handTyped = (text) => { if (shell)
113
- hand(lineDay(text, date, today, clears, names), clock); };
114
- const setTime = (t) => { setClock(t); hand(dayOfLine(), t); };
115
- const keep = (d = date, t = clock) => {
116
- settled.current = true;
117
- if (shell) {
118
- hand(d, t);
119
- onDone?.();
120
- return;
121
- }
122
- const next = valueOf(d, t);
123
- if (next !== value)
124
- onValueChange(next);
125
- onDone?.();
126
- };
127
- const leave = () => { settled.current = true; reset(); onDone?.(); };
128
- function reset() { const v = value; setDate(v ? v.slice(0, 10) : null); setClock(v && v.length > 10 ? v.slice(11, 16) : null); setKey(v ? v.slice(0, 10) : today); setTyped(null); setError(null); setView(viewOf(props.opens)); setWheel(wheelOf(props.opens)); }
129
- const [placed, setPlaced] = React.useState(null), left = React.useRef(false);
130
- const placeRoot = React.useCallback((el) => { wornRef(el); setPlaced(el); if (!el) {
131
- left.current = true;
132
- settled.current = false;
133
- } }, [wornRef]);
134
- React.useLayoutEffect(() => {
135
- if (!placed || !left.current)
136
- return;
137
- left.current = false;
138
- reset();
139
- }, [placed]);
140
- const focusOnce = React.useRef(autoFocus);
141
- const seeded = React.useRef(props.typed != null);
142
- const first = React.useCallback((el) => {
143
- if (!el || !focusOnce.current)
144
- return;
145
- focusOnce.current = false;
146
- requestAnimationFrame(() => {
147
- const to = el.isConnected ? el : root.current?.querySelector(".o-date-editor-input");
148
- to?.focus({ preventScroll: true });
149
- if (seeded.current && to instanceof HTMLInputElement)
150
- to.setSelectionRange(to.value.length, to.value.length);
151
- });
152
- }, []);
153
- const lineRef = React.useCallback((el) => { line.current = el; first(el); }, [first]);
154
- const pick = (day) => {
155
- setDate(day);
156
- setTyped(null);
157
- setError(null);
158
- hand(day, clock);
159
- if (day)
160
- setKey(day);
161
- if (!phone && (!time || day === null))
162
- keep(day, clock);
163
- };
164
- const take = () => {
165
- if (typed == null)
166
- return true;
167
- if (!typed.trim()) {
168
- setTyped(null);
169
- if (clears) {
170
- setDate(null);
171
- hand(null, clock);
172
- }
173
- return true;
174
- }
175
- if (reading && "date" in reading) {
176
- setDate(reading.date);
177
- setKey(reading.date);
178
- setTyped(null);
179
- setError(null);
180
- hand(reading.date, clock);
181
- return true;
182
- }
183
- setError(reading && "error" in reading ? reading.error : null);
184
- return false;
185
- };
186
- const shownKey = reading && "date" in reading ? reading.date : key;
87
+ const root = React.useRef(null), line = React.useRef(null);
88
+ const bRoot = b.root.ref, bLine = b.line.ref;
89
+ const rootRef = React.useCallback((el) => { root.current = el; bRoot(el); wornRef(el); }, [bRoot, wornRef]);
90
+ const lineRef = React.useCallback((el) => { line.current = el; bLine(el); }, [bLine]);
91
+ const pick = b.pick, setTime = b.setTime, keep = b.keep;
92
+ const shownKey = b.keyDay;
187
93
  const [sy, sm] = parts(shownKey);
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)
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)
94
+ const dayGrid = (big, weekdays) => (_jsx(DateDays, { year: sy, month: sm, keyDay: shownKey, picked: date, today: today, names: names, weekdays: weekdays, big: big, off: b.off, reads: b.reads, onPick: pick, onKeyMove: b.moveKey, onEnter: b.enterDay }));
95
+ 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) => b.moveKey(`${m}-01`), onChange: (day) => { const to = day ?? date; if (to)
191
96
  pick(to); } }));
192
97
  const row = phone ? worn.calendar === "plain" : worn.picks === "row";
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))) }));
98
+ const quick = (_jsx("div", { className: "o-date-editor-picks", "data-slot": "vk-date-picks", children: b.picks.map(({ key: p, day, word }) => (_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(day), children: word }, p))) }));
194
99
  if (phone) {
195
100
  const months = names.months.map((name, i) => ({ value: String(i), label: name }));
196
101
  const years = Array.from({ length: 41 }, (_, i) => String(sy - 20 + i)).map((v) => ({ value: v, label: v }));
197
102
  const hours = Array.from({ length: 24 }, (_, i) => String(i).padStart(2, "0")).map((v) => ({ value: v, label: v }));
198
103
  const mins = ["00", "15", "30", "45"].map((v) => ({ value: v, label: v }));
199
104
  const [hh, mm] = (clock ?? "09:00").split(":");
200
- const head = { left: _jsx(SheetButton, { "data-slot": "vk-editor-close", "aria-label": w.close, icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": w.save, icon: glyph(TICK), onClick: () => { if (take())
201
- keep(dayOfLine(), clock); } }) };
202
- const wheels = 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")] })) : 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")] })) : null;
105
+ const head = { left: _jsx(SheetButton, { "data-slot": "vk-editor-close", "aria-label": w.close, icon: glyph(X), onClick: b.leave }), right: _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": w.save, icon: glyph(TICK), onClick: keep }) };
106
+ const wheels = 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) => b.moveKey(addMonths(shownKey, Number(v) - sm)) }, "month"), _jsx(Wheel, { name: "year", label: w.year, items: years, value: String(sy), onChange: (v) => b.moveKey(addMonths(shownKey, (Number(v) - sy) * 12)) }, "year")] })) : 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")] })) : null;
203
107
  if (worn.calendar === "plain") {
204
108
  const toggle = (w) => { if (w === "time" && !clock)
205
109
  setTime("09:00"); setWheel(wheel === w ? "none" : w); };
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)
207
- return; e.preventDefault(); if (take())
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] }));
211
- return { body: plain, head: shell ? {} : head };
110
+ const plain = (_jsxs("div", { ...b.root, ref: rootRef, 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, { ...b.line, ref: lineRef, className: "o-date-editor-input", "aria-label": label, placeholder: `${w.type}…`, autofill: false, spellCheck: false, enterKeyHint: "done" }), b.reads && _jsx(InputGroupAddon, { side: "end", children: _jsx("span", { className: "o-date-editor-reads", "data-slot": "vk-date-reads", children: lineText(b.reads, 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: () => b.moveKey(addMonths(shownKey, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => b.moveKey(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: keep, date: date, clock: clock, today: today, wheel: wheel, onWheel: calendar ? (which) => { if (which === "time")
111
+ toggle(which); } : toggle, onDate: b.setDay, onClock: setTime }), quick] }));
112
+ return { body: plain, head: props.draft === "shell" ? {} : head };
212
113
  }
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)
114
+ const body = (_jsxs("div", { ...b.root, ref: rootRef, 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: () => b.moveKey(addMonths(shownKey, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => b.moveKey(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) => b.moveKey(addMonths(shownKey, Number(v) - sm)) }, "month"), _jsx(Wheel, { name: "year", label: w.year, items: years, value: String(sy), onChange: (v) => b.moveKey(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)
214
115
  setTime("09:00"); setWheel("time"); } })) })), quick] }));
215
- return { body, head: shell ? {} : head };
116
+ return { body, head: props.draft === "shell" ? {} : head };
216
117
  }
217
- const onBlur = (e) => {
218
- if (shell || settled.current || (e.relatedTarget instanceof Node && e.currentTarget.contains(e.relatedTarget)))
219
- return;
220
- if (take())
221
- keep(dayOfLine(), clock);
222
- };
223
- const escape = () => keep(dayOfLine(), clock);
224
- const lineKeys = (e) => {
225
- if (e.key !== "Enter" || e.nativeEvent.isComposing)
226
- return;
227
- e.preventDefault();
228
- if (blank(typed)) {
229
- setTyped(null);
230
- keep();
231
- return;
232
- }
233
- if (take())
234
- keep(dayOfLine(), clock);
235
- };
236
- const moveMonth = (n) => setKey(addMonths(shownKey, n));
118
+ const moveMonth = b.moveMonth;
237
119
  const hold = (e) => e.preventDefault();
238
120
  const arrows = worn.days === "outlined" ? "2xs" : "xs";
239
121
  const leaveYear = () => { if (document.activeElement?.closest(".o-date-editor-year-box"))
@@ -244,31 +126,13 @@ export function useDateEditor(props) {
244
126
  el.select();
245
127
  } };
246
128
  const timeButton = _jsx(Button, { kind: "quiet", size: lineBox ? "2xs" : "xs", className: "o-date-editor-time", "data-slot": "vk-date-time", look: TIME, "aria-pressed": view === "time", "data-empty": clock ? undefined : "", icon: glyph(CLOCK), onClick: () => setView(view === "time" ? "days" : "time"), children: clock ?? w.addTime });
247
- const boxLine = (_jsxs(InputGroup, { size: "sm", className: "o-date-editor-line", "data-slot": "vk-date-line", "data-bad": error ? "" : undefined, children: [_jsx(Input, { ref: lineRef, className: "o-date-editor-input", "aria-label": label, placeholder: `${w.type}…`, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? "", onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onKeyDown: (e) => { if (blank(typed) && (e.key === "Backspace" || e.key === "Delete")) {
248
- e.preventDefault();
249
- return;
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 })] }));
129
+ const boxLine = (_jsxs(InputGroup, { size: "sm", className: "o-date-editor-line", "data-slot": "vk-date-line", "data-bad": error ? "" : undefined, children: [_jsx(Input, { ...b.line, ref: lineRef, className: "o-date-editor-input", "aria-label": label, placeholder: `${w.type}…`, autofill: false, spellCheck: false }), b.reads && _jsx(InputGroupAddon, { side: "end", children: _jsx("span", { className: "o-date-editor-reads", "data-slot": "vk-date-reads", children: lineText(b.reads, names) }) }), time && !inParts && _jsx(InputGroupAddon, { side: "end", flush: true, children: timeButton })] }));
251
130
  const shownView = calendar && (view === "months" || view === "years") ? "days" : view;
252
131
  const daysShown = shownView === "days" || (inParts && shownView === "time");
253
132
  const refocus = (sel) => requestAnimationFrame(() => root.current?.querySelector(sel)?.focus({ preventScroll: true }));
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") {
255
- e.preventDefault();
256
- e.stopPropagation();
257
- escape();
258
- } }, children: [lineBox ? boxLine : _jsxs("div", { className: "o-date-editor-line o-popup-line", "data-slot": "vk-date-line", "data-bad": error ? "" : undefined, children: [glyph(CAL), _jsx(Input, { chrome: "bare", ref: (el) => { line.current = el; first(el); }, className: "o-date-editor-input", "aria-label": label, placeholder: w.type, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? (date ? lineText(date, names) : ""), onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onBeforeInput: (e) => { if (typed == null) {
259
- e.preventDefault();
260
- const d = e.nativeEvent.data ?? "";
261
- setTyped(d);
262
- setError(null);
263
- handTyped(d);
264
- } }, onKeyDown: (e) => { if (typed == null && (e.key === "Backspace" || e.key === "Delete")) {
265
- e.preventDefault();
266
- setTyped("");
267
- handTyped("");
268
- return;
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"
133
+ const body = (_jsxs("div", { ...b.root, ref: rootRef, className: "o-date-editor", "data-slot": "vk-date", "data-kit": "date-editor", "data-date-form": "computer", ...phoneMark(!!host || small), ...wornAttrs(worn), children: [lineBox ? boxLine : _jsxs("div", { className: "o-date-editor-line o-popup-line", "data-slot": "vk-date-line", "data-bad": error ? "" : undefined, children: [glyph(CAL), _jsx(Input, { chrome: "bare", ...b.line, ref: lineRef, className: "o-date-editor-input", "aria-label": label, placeholder: w.type, autofill: false, spellCheck: false }), b.reads && _jsx("span", { className: "o-date-editor-reads", "data-slot": "vk-date-reads", children: lineText(b.reads, 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"
270
134
  ? _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)
271
- setKey(addMonths(shownKey, (yr - sy) * 12)); }, onKeyDown: (e) => { if (e.key === "Enter") {
135
+ b.moveKey(addMonths(shownKey, (yr - sy) * 12)); }, onKeyDown: (e) => { if (e.key === "Enter") {
272
136
  e.preventDefault();
273
137
  leaveYear();
274
138
  setYearText(null);
@@ -278,9 +142,8 @@ export function useDateEditor(props) {
278
142
  : _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") {
279
143
  setYearText(null);
280
144
  yearFocus.current = worn.year === "typed";
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)
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())
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] }));
145
+ } 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: () => { b.moveKey(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); b.moveKey(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)
146
+ 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: keep, date: date, clock: clock, today: today, shownTyping: props.opens === "time", onDate: (d) => { b.setDay(d); b.type(null); }, onClock: setTime }), worn.picks === "two" && _jsx("div", { className: "o-date-editor-sep", "data-slot": "vk-date-sep" }), quick] }));
284
147
  return { body, head: {} };
285
148
  }
286
149
  function Wheel({ name, label, items, value, onChange }) {
@@ -82,8 +82,9 @@ export interface FieldRowsProps extends React.HTMLAttributes<HTMLDivElement> {
82
82
  }
83
83
  /** Field rows' card: fields that belong together, as rows of one card on a phone, or each its own card. Its rows are FieldRowsRows,
84
84
  * or Fields, each then the card's row (VK-960), their notes and errors under the card; anything else stands in it as its place
85
- * puts it. */
86
- export declare function FieldRows({ look, className, children, ...props }: FieldRowsProps): import("react/jsx-runtime").JSX.Element;
85
+ * puts it. Server-rendered outside a PhoneHost and a ComputerHost, the card stands whole once for each screen, CSS showing the
86
+ * screen's until the page comes alive (`ScreenForms`, VK-1074), so a record's rows paint the phone's form on a phone. */
87
+ export declare function FieldRows(props: FieldRowsProps): import("react/jsx-runtime").JSX.Element;
87
88
  /** Field rows' card as its Fields see it, and the foot to draw after it: FieldRows', and a setting rows' card on a phone (VK-979).
88
89
  * Its Fields in the order they came (VK-960), and those with a note or an error to show; while any has one, its foot stands
89
90
  * after the card, the card first, so a foot coming or going never redraws the card or moves the focus in it. In the foot each
@@ -6,7 +6,8 @@ import { Fieldset as BaseFieldset } from "@base-ui/react/fieldset";
6
6
  import { FieldRootContext, useFieldRootContext } from "@base-ui/react/internals/field-root-context";
7
7
  import { cx } from "../../internal/cx.js";
8
8
  import { AtSettingRowEnd, FieldRowsCardContext, InFieldRow, OutOfFieldRows, SettingRowField } from "../../internal/field-rows.js";
9
- import { phoneMark, usePhoneForm } from "../internal/phone.js";
9
+ import { ScreenForms } from "../../internal/screen-forms.js";
10
+ import { ComputerHost, PhoneHost, phoneMark, usePhoneForm } from "../internal/phone.js";
10
11
  import { fieldRowsAttrs } from "./looks.js";
11
12
  export function errorsOf(error) {
12
13
  const all = (Array.isArray(error) ? error : [error]).filter((e) => e != null && e !== false && e !== "");
@@ -52,7 +53,11 @@ export function FieldSet({ legend, required = false, note, error, keepNote = fal
52
53
  export function FieldSeparator({ children, className }) {
53
54
  return (_jsxs("div", { className: cx("o-field-sep", className), role: "separator", children: [_jsx("span", { className: "o-field-sep-line" }), children != null && _jsxs(_Fragment, { children: [_jsx("span", { className: "o-field-sep-words", children: children }), _jsx("span", { className: "o-field-sep-line" })] })] }));
54
55
  }
55
- export function FieldRows({ look, className, children, ...props }) {
56
+ export function FieldRows(props) {
57
+ const host = React.useContext(PhoneHost), computer = React.useContext(ComputerHost);
58
+ return (_jsx(ScreenForms, { off: host != null || computer, children: _jsx(FieldRowsCardOf, { ...props }) }));
59
+ }
60
+ function FieldRowsCardOf({ look, className, children, ...props }) {
56
61
  const { card, foot } = useFieldRowsCard();
57
62
  return (_jsxs(FieldRowsCardContext.Provider, { value: card, children: [_jsx("div", { className: cx("o-field-rows", className), "data-kit": "field", ...(look ? fieldRowsAttrs(look) : {}), ...props, children: children }), foot] }));
58
63
  }
@@ -1,5 +1,5 @@
1
1
  import type { PieceLooks } from "../../looks/looks.js";
2
- export type FieldLookOptionId = "rows-cards" | "rows-edge" | "rows-height" | "rows-label" | "rows-lines";
2
+ export type FieldLookOptionId = "rows-cards" | "rows-edge" | "rows-height" | "rows-label" | "rows-lines" | "row-icon";
3
3
  /** A card's own look, handed by its place (an editor's look): each option, an option left out taking its default. */
4
4
  export type FieldRowsLook = Partial<{
5
5
  cards: "one" | "each";
@@ -4,19 +4,20 @@ const options = [
4
4
  { id: "rows-height", name: "Height", def: "52", device: "phone", demo: false, values: [{ id: "48", name: "48" }, { id: "52", name: "52" }, { id: "56", name: "56" }] },
5
5
  { id: "rows-label", name: "Label", def: "104", device: "phone", demo: false, values: [{ id: "104", name: "104" }, { id: "none", name: "None" }] },
6
6
  { id: "rows-lines", name: "Lines", def: "words", device: "phone", demo: false, values: [{ id: "words", name: "From the words" }, { id: "across", name: "Across" }, { id: "none", name: "None" }] },
7
+ { id: "row-icon", name: "Icon", def: "on", device: "desktop", demo: false, values: [{ id: "on", name: "On" }, { id: "off", name: "Off" }] },
7
8
  ];
8
9
  export const FIELD_LOOKS = {
9
10
  id: "field",
10
11
  name: "Field",
11
12
  options,
12
13
  looks: [
13
- { id: "card", name: "Card", device: "phone", picks: { "rows-cards": "one", "rows-edge": "on", "rows-height": "52", "rows-label": "104", "rows-lines": "words" } },
14
- { id: "each", name: "A card each", device: "phone", picks: { "rows-cards": "each", "rows-edge": "on", "rows-height": "56", "rows-label": "104", "rows-lines": "none" } },
15
- { id: "rows", name: "Rows in a card", device: "phone", picks: { "rows-cards": "one", "rows-edge": "off", "rows-height": "48", "rows-label": "104", "rows-lines": "across" } },
14
+ { id: "card", name: "Card", device: "phone", picks: { "rows-cards": "one", "rows-edge": "on", "rows-height": "52", "rows-label": "104", "rows-lines": "words", "row-icon": "on" } },
15
+ { id: "each", name: "A card each", device: "phone", picks: { "rows-cards": "each", "rows-edge": "on", "rows-height": "56", "rows-label": "104", "rows-lines": "none", "row-icon": "on" } },
16
+ { id: "rows", name: "Rows in a card", device: "phone", picks: { "rows-cards": "one", "rows-edge": "off", "rows-height": "48", "rows-label": "104", "rows-lines": "across", "row-icon": "on" } },
16
17
  ],
17
18
  };
18
19
  const known = (o, v) => (v && o.values.some((x) => x.id === v) ? v : o.def);
19
20
  export function fieldRowsAttrs(look) {
20
21
  const picks = look;
21
- return Object.fromEntries(options.map((o) => [`data-field-${o.id}`, known(o, picks[o.id.slice("rows-".length)])]));
22
+ return Object.fromEntries(options.filter((o) => o.id.startsWith("rows-")).map((o) => [`data-field-${o.id}`, known(o, picks[o.id.slice("rows-".length)])]));
22
23
  }
@@ -114,4 +114,8 @@ button.o-field-row { cursor: pointer; }
114
114
  .o-field-rows-slot + .o-field-rows-slot::before { content: " "; }
115
115
  .o-field-rows-slot > .o-field-error { color: var(--vk-danger); }
116
116
  .o-field-rows-foot:has(.o-field-error) .o-field-note { display: none; }
117
+ /* A phone's first paint: server-rendered, Field rows' card stands twice, the phone's form and the computer's (`ScreenForms`,
118
+ internal/screen-forms.tsx), and this shows the screen's at ViewKit's own line, as the toolbar's stylesheet does: here for an app
119
+ that imports this card's stylesheet alone, on a page whose policy refuses an inline style. Kept on one line, as screenFormsCss writes it. */
120
+ [data-vk-screen-forms]{display:contents}[data-vk-twin="computer"][data-vk-twin-line="(min-width: 1024px)"]{display:none}@media (min-width: 1024px){[data-vk-twin="computer"][data-vk-twin-line="(min-width: 1024px)"]{display:contents}[data-vk-twin="phone"][data-vk-twin-line="(min-width: 1024px)"]{display:none}}
117
121
  }
@@ -12,7 +12,7 @@ import { Picker, usePicker } from "../picker/picker.js";
12
12
  import { FieldsFrame } from "../picker/fields-frame.js";
13
13
  import { itemLabel } from "../picker/rows.js";
14
14
  import { HOW, wayOf } from "./how.js";
15
- import { PairValue } from "./parts.js";
15
+ import { PairValue, WHOLE } from "./parts.js";
16
16
  import { BlockHead, GroupMenu, MenuStep } from "./block.js";
17
17
  import { addRule, blockAround, canExclude, setExclude, canGroup, changeRule, clearAll, everyFits, fieldOf, fieldsIn, FILTER_DEPTH, isBlock, isGroup, isOwnWay, isPair, isWhole, itemOf, putBack, QUANTIFIERS, relationOf, removeRule, rulesOf, setJoin, setQuantifier, toBlock, toGroup } from "./rules.js";
18
18
  import { filterWords } from "./words.js";
@@ -194,7 +194,7 @@ export function useFilterEditor(props) {
194
194
  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)
195
195
  setStep({ list: "value", rule: r.id }); } : onOpenChange, phone: phone, size: size, placeholder: w.chooseDate });
196
196
  if (field.type === "number" || field.type === "range")
197
- 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) });
197
+ return _jsx(NumberBox, { size: size, steppers: false, "aria-label": name, placeholder: w.typeNumber, value: typeof r.value === "number" ? r.value : null, format: field.integer ? WHOLE : undefined, onValueChange: (v) => set(r.id)(v ?? null) });
198
198
  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) });
199
199
  };
200
200
  function groupEntries(g) {
@@ -46,3 +46,5 @@ export declare function PairValue({ name, value, onValue, size, onKeyDown, words
46
46
  /** Its public name, on the pair: the filter bar's popover hands `vk-filter-part-pair` (VK-1003). */
47
47
  slot?: string;
48
48
  }): import("react/jsx-runtime").JSX.Element;
49
+ /** A whole number's format: Base UI's Number Field rounds what is typed to it (VK-22). */
50
+ export declare const WHOLE: Intl.NumberFormatOptions;
@@ -65,7 +65,7 @@ export function PairValue({ name, value, onValue, size, onKeyDown, words: given,
65
65
  const { NumberBox } = usePanelControls();
66
66
  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 })] }));
67
67
  }
68
- const WHOLE = { maximumFractionDigits: 0 };
68
+ export const WHOLE = { maximumFractionDigits: 0 };
69
69
  function TypedValue({ rule: r, field, name, set, onDone, w }) {
70
70
  const enter = (e) => { if (e.key === "Enter") {
71
71
  e.preventDefault();
@@ -7,7 +7,7 @@
7
7
  export { CONTROLS } from "./controls.js";
8
8
  export { Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonClass, type ButtonKind, type ButtonProps, type ButtonShape, type ButtonSize, } from "./button/button.js";
9
9
  export { leadingGlyph } from "./button/map-button.js";
10
- export { buttonOwnAttrs, buttonOwnOptions, type ButtonOwnLook } from "./button/own-look.js";
10
+ export { buttonOwnAttrs, buttonOwnOptions, type ButtonOwnLook } from "./button/own-look-moved.js";
11
11
  export { LoadingBar, Spinner, type LoadingBarProps, type SpinnerProps } from "./spinner/spinner.js";
12
12
  export { CONTROL_ICONS } from "./glyphs/glyphs.js";
13
13
  export { POPUP_HOST, popupHostOf } from "./internal/popup-host.js";
@@ -107,6 +107,8 @@ export { TEXT_EDITOR_ATTRS, textEditorWornOf, type TextEditorWorn } from "./text
107
107
  export { TEXT_EDITOR_WORDS, textWords, type TextEditorWords } from "./text-editor/words.js";
108
108
  export { pickerItemsOf } from "./picker/map-picker.js";
109
109
  export { DateEditor, useDateEditor, useDateEditorWorn, type DateEditorParts, type DateEditorProps } from "./date-editor/date-editor.js";
110
+ export { dateEditorWordsOf } from "./date-editor/map-date-body.js";
111
+ export { useDateEditorBehaviour, type DateEditorBehaviour, type DateEditorBehaviourProps, type DateEditorLineProps, type DateEditorRootProps } from "./date-editor/date-behaviour.js";
110
112
  export { DateParts, type DatePartsProps } from "./date-editor/date-parts.js";
111
113
  export { DateDays, type DateDaysProps } from "./date-editor/date-days.js";
112
114
  export { DATE_ERROR_WORDS, MONTH_NAMES, QUARTERS, WEEK, addDays, addMonths, cellText, dateNames, iso, lineDay, lineText, monthGrid, parts, quickPick, readDate, readTime, todayOf, weekday, type DateErrorWords, type DateNames, type DatePick } from "./date-editor/calendar.js";
@@ -2,7 +2,7 @@
2
2
  export { CONTROLS } from "./controls.js";
3
3
  export { Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonClass, } from "./button/button.js";
4
4
  export { leadingGlyph } from "./button/map-button.js";
5
- export { buttonOwnAttrs, buttonOwnOptions } from "./button/own-look.js";
5
+ export { buttonOwnAttrs, buttonOwnOptions } from "./button/own-look-moved.js";
6
6
  export { LoadingBar, Spinner } from "./spinner/spinner.js";
7
7
  export { CONTROL_ICONS } from "./glyphs/glyphs.js";
8
8
  export { POPUP_HOST, popupHostOf } from "./internal/popup-host.js";
@@ -100,6 +100,8 @@ export { TEXT_EDITOR_ATTRS, textEditorWornOf } from "./text-editor/looks.js";
100
100
  export { TEXT_EDITOR_WORDS, textWords } from "./text-editor/words.js";
101
101
  export { pickerItemsOf } from "./picker/map-picker.js";
102
102
  export { DateEditor, useDateEditor, useDateEditorWorn } from "./date-editor/date-editor.js";
103
+ export { dateEditorWordsOf } from "./date-editor/map-date-body.js";
104
+ export { useDateEditorBehaviour } from "./date-editor/date-behaviour.js";
103
105
  export { DateParts } from "./date-editor/date-parts.js";
104
106
  export { DateDays } from "./date-editor/date-days.js";
105
107
  export { DATE_ERROR_WORDS, MONTH_NAMES, QUARTERS, WEEK, addDays, addMonths, cellText, dateNames, iso, lineDay, lineText, monthGrid, parts, quickPick, readDate, readTime, todayOf, weekday } from "./date-editor/calendar.js";
@@ -42,6 +42,15 @@
42
42
  [data-inline-input-tint="10"] { --inline-input-tint: 100%; }
43
43
  [data-inline-input-ground="none"] { --inline-input-ground: var(--vk-input); }
44
44
 
45
+ /* ── In a grid's cell: only the caret ─────────────────────────────────────────────────────────────────────────────────────
46
+ Where the grid says its box stands in a cell (data-inline-input-place="cell", on its type-in's layer), the cell itself is the
47
+ box: no edge, no ring and no ground, whatever a frame picks, so the cell shows as it was. Grown past its cell (data-grown, on
48
+ the body or the box that fits it), it takes the plain ground, so the values it stands over don't show through. */
49
+ [data-inline-input-place="cell"] { --inline-input-edge: 0px; --inline-input-ring: 0px; --inline-input-ground: transparent; }
50
+ [data-inline-input-place="cell"] [data-grown] { --inline-input-ground: var(--vk-overlay); }
51
+ /* Refused there, it takes its ring back, red, so the box says what the line under it explains. */
52
+ [data-inline-input-place="cell"] .o-inline-input:is([aria-invalid="true"], :has(.o-input-control[aria-invalid="true"])) { --inline-input-ring: var(--vk-focus-width); }
53
+
45
54
  /* ── The box ──────────────────────────────────────────────────────────────────────────────────────────────────────────── */
46
55
  .o-inline-input.o-inline-input {
47
56
  --inline-input-at: var(--inline-input-row, calc(var(--vk-spacing) * 9));
@@ -9,7 +9,7 @@ export declare const COMPUTER_HOST = "data-computer-host";
9
9
  /** Inside a computer host: usePhone is false there. A PhoneHost screen inside it is still a phone's. */
10
10
  export declare const ComputerHost: React.Context<boolean>;
11
11
  /** True where the app's line doesn't match, outside a computer host; false through the server's first draw and where the
12
- * window can't be asked. `asked` false: false, the window never asked (a chip that marks a phone only while it is a link). */
12
+ * window can't be asked, unless a `ScreenForms` twin tells it its screen while the page comes alive (VK-1038). `asked` false: false, the window never asked (a chip that marks a phone only while it is a link). */
13
13
  export declare const usePhone: (asked?: boolean) => boolean;
14
14
  /** A control's form: the one it is told, else the phone's in a PhoneHost screen or below the line. `asked` false: the
15
15
  * computer's, the window never asked. */
@@ -1,12 +1,13 @@
1
1
  import * as React from "react";
2
2
  import { PhoneLine } from "../../internal/phone-line.js";
3
+ import { ScreenTold } from "../../internal/screen-forms.js";
3
4
  export { PhoneLine };
4
5
  const canAsk = () => typeof window !== "undefined" && typeof window.matchMedia === "function";
5
6
  export const PhoneHost = React.createContext(null);
6
7
  export const COMPUTER_HOST = "data-computer-host";
7
8
  export const ComputerHost = React.createContext(false);
8
9
  export const usePhone = (asked = true) => {
9
- const line = React.useContext(PhoneLine), computer = React.useContext(ComputerHost);
10
+ const line = React.useContext(PhoneLine), computer = React.useContext(ComputerHost), told = React.useContext(ScreenTold);
10
11
  const subscribe = React.useCallback((change) => {
11
12
  if (!asked || !canAsk())
12
13
  return () => { };
@@ -15,7 +16,7 @@ export const usePhone = (asked = true) => {
15
16
  return () => m.removeEventListener("change", change);
16
17
  }, [line, asked]);
17
18
  const narrow = React.useSyncExternalStore(subscribe, () => asked && canAsk() && !matchMedia(line).matches, () => false);
18
- return narrow && !computer;
19
+ return (told && asked ? told === "phone" : narrow) && !computer;
19
20
  };
20
21
  export function usePhoneForm(form, asked = true) {
21
22
  const host = React.useContext(PhoneHost), small = usePhone(asked);
@@ -136,4 +136,4 @@ export declare const LIST_TOKENS: readonly [{
136
136
  readonly outright: "--ease-out";
137
137
  }];
138
138
  /** The list's own machinery: its options' values set on the frame, its rows' and panel's measures, and the lines between groups. */
139
- export declare const LIST_PRIVATE: readonly ["--list-", "--divider-", "--dividers-"];
139
+ export declare const LIST_PRIVATE: readonly ["--list-", "--divider-", "--dividers-", "--transform-origin"];
@@ -34,4 +34,4 @@ export const LIST_TOKENS = [
34
34
  { name: "--vk-duration-fast", kind: "motion", outright: "--duration-fast" },
35
35
  { name: "--vk-ease-out", kind: "motion", outright: "--ease-out" },
36
36
  ];
37
- export const LIST_PRIVATE = ["--list-", "--divider-", "--dividers-"];
37
+ export const LIST_PRIVATE = ["--list-", "--divider-", "--dividers-", "--transform-origin"];
@@ -79,9 +79,12 @@
79
79
  box-sizing: border-box; display: grid; padding: var(--list-pad, calc(var(--vk-spacing) * 1.5));
80
80
  border: var(--vk-border-width) solid var(--list-edge, var(--vk-border)); border-radius: calc(min(var(--list-box-r, var(--vk-radius-lg)), var(--vk-radius-2xl)) + var(--list-pad, calc(var(--vk-spacing) * 1.5)));
81
81
  background-color: var(--vk-overlay); box-shadow: var(--list-shadow, var(--vk-shadow-xl)); color: var(--vk-fg); outline: none;
82
- transition: opacity var(--vk-duration-fast) var(--vk-ease-out), translate var(--vk-duration-fast) var(--vk-ease-out);
82
+ transform-origin: var(--transform-origin); transition-property: opacity, translate, scale;
83
+ transition-duration: var(--vk-popup-open-duration, var(--vk-duration-fast)); transition-timing-function: var(--vk-popup-open-ease, var(--vk-ease-out));
83
84
  }
84
- .o-list:is([data-starting-style], [data-ending-style]) { opacity: 0; translate: 0 calc(var(--vk-spacing) * -1); }
85
+ /* As every popup moves (popover.css): in 150ms each way, easing out both ways, or as the popup motion names say. */
86
+ .o-list[data-ending-style] { transition-duration: var(--vk-popup-close-duration, var(--vk-duration-fast)); transition-timing-function: var(--vk-popup-close-ease, var(--vk-ease-out)); }
87
+ .o-list:is([data-starting-style], [data-ending-style]) { opacity: 0; translate: 0 calc(var(--vk-popup-nudge, var(--vk-spacing)) * -1); scale: var(--vk-popup-scale, none); }
85
88
  .o-list-positioner { z-index: var(--vk-layer-popup); outline: none; }
86
89
 
87
90
  /* ── A row: 32px, the radius's corners, text-sm; under the pointer or the keyboard the overlay's hover ─ */