viewkitjs 0.39.0 → 0.40.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 (179) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/MIGRATION.md +25 -0
  3. package/fields/dist/derived.d.ts +7 -0
  4. package/fields/dist/derived.js +4 -0
  5. package/fields/dist/index.d.ts +1 -1
  6. package/fields/dist/index.js +1 -1
  7. package/fields/dist/messages.d.ts +5 -1
  8. package/fields/dist/messages.js +3 -0
  9. package/fields/dist/query/evaluate.d.ts +7 -1
  10. package/fields/dist/query/evaluate.js +8 -5
  11. package/fields/dist/query/filter.d.ts +7 -0
  12. package/fields/dist/query/filter.js +7 -1
  13. package/fields/dist/query/kit.d.ts +3 -2
  14. package/fields/dist/query/kit.js +1 -1
  15. package/fields/dist/query/layer.d.ts +6 -0
  16. package/fields/dist/query/layer.js +3 -0
  17. package/fields/dist/query/number.d.ts +3 -2
  18. package/fields/dist/query/number.js +5 -3
  19. package/fields/dist/query/read-rule.d.ts +1 -1
  20. package/fields/dist/query/read-rule.js +3 -0
  21. package/fields/docs/guides/queries.md +28 -24
  22. package/fields/docs/reference/fields.md +1 -0
  23. package/fields/docs/reference/query.md +6 -4
  24. package/package.json +2 -4
  25. package/postgres/dist/check.js +3 -1
  26. package/postgres/dist/definitions/storage.d.ts +3 -1
  27. package/postgres/dist/definitions/storage.js +3 -1
  28. package/postgres/dist/definitions/stored.js +13 -2
  29. package/postgres/dist/map.d.ts +5 -1
  30. package/postgres/dist/map.js +4 -0
  31. package/postgres/dist/records.js +6 -1
  32. package/postgres/docs/guides/definitions.md +1 -1
  33. package/postgres/docs/guides/field-map.md +2 -2
  34. package/postgres/docs/reference/postgres.md +1 -1
  35. package/views/dist/contract.d.ts +20 -2
  36. package/views/dist/contract.js +27 -0
  37. package/views/dist/controls/avatar.css +1 -1
  38. package/views/dist/controls/customize/map-customize-body.js +1 -1
  39. package/views/dist/controls/field/field.d.ts +2 -14
  40. package/views/dist/controls/field/field.js +4 -9
  41. package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
  42. package/views/dist/controls/filter-editor/filter-editor.js +5 -2
  43. package/views/dist/controls/filter-editor/how.d.ts +8 -0
  44. package/views/dist/controls/filter-editor/map-filter-body.d.ts +4 -2
  45. package/views/dist/controls/filter-editor/map-filter-body.js +17 -8
  46. package/views/dist/controls/filter-editor/map-rules.d.ts +4 -3
  47. package/views/dist/controls/filter-editor/map-rules.js +5 -2
  48. package/views/dist/controls/filter-editor/parts.d.ts +14 -1
  49. package/views/dist/controls/filter-editor/parts.js +14 -0
  50. package/views/dist/controls/filter-editor.css +4 -1
  51. package/views/dist/controls/index.d.ts +0 -3
  52. package/views/dist/controls/index.js +0 -3
  53. package/views/dist/controls/input.css +1 -1
  54. package/views/dist/controls/menu-list.css +1 -1
  55. package/views/dist/controls/picker/looks.d.ts +1 -1
  56. package/views/dist/controls/picker.css +2 -2
  57. package/views/dist/controls/press.css +0 -1
  58. package/views/dist/controls/radio/radio.d.ts +1 -1
  59. package/views/dist/controls/radio/radio.js +1 -16
  60. package/views/dist/controls/sheet/bottom-sheet.d.ts +2 -2
  61. package/views/dist/controls/sheet/bottom-sheet.js +31 -24
  62. package/views/dist/controls/text-editor.css +5 -3
  63. package/views/dist/controls/tokens.js +0 -6
  64. package/views/dist/controls/toolbar/toolbar.js +2 -2
  65. package/views/dist/field-row/editors/RowTextEditor.js +4 -1
  66. package/views/dist/filters/duration-bound.d.ts +7 -0
  67. package/views/dist/filters/duration-bound.js +9 -0
  68. package/views/dist/filters/filter-model.d.ts +4 -0
  69. package/views/dist/filters/number-refused.d.ts +8 -0
  70. package/views/dist/filters/number-refused.js +4 -0
  71. package/views/dist/grid/chrome/grid-table-props.d.ts +4 -1
  72. package/views/dist/grid/chrome/useGridTableInteractionModel.js +12 -2
  73. package/views/dist/grid/core/clipboard-model.js +42 -8
  74. package/views/dist/grid/core/commit-model.d.ts +3 -0
  75. package/views/dist/grid/core/editing-controller.d.ts +29 -1
  76. package/views/dist/grid/core/editing-controller.js +142 -12
  77. package/views/dist/grid/core/pending-reconciliation.d.ts +14 -0
  78. package/views/dist/grid/core/pending-reconciliation.js +20 -8
  79. package/views/dist/grid/core/save-path.d.ts +4 -2
  80. package/views/dist/grid/core/save-path.js +1 -1
  81. package/views/dist/grid/core/spreadsheet-operations.js +43 -5
  82. package/views/dist/grid/core/useGridEditing.d.ts +5 -1
  83. package/views/dist/grid/core/useGridEditing.js +4 -4
  84. package/views/dist/grid/core/written-alongside.d.ts +16 -0
  85. package/views/dist/grid/core/written-alongside.js +30 -0
  86. package/views/dist/grid/grid.css +1 -1
  87. package/views/dist/grid/index.d.ts +1 -1
  88. package/views/dist/grid/looks.d.ts +2 -2
  89. package/views/dist/internal/before-paint.d.ts +5 -0
  90. package/views/dist/internal/before-paint.js +17 -0
  91. package/views/dist/internal/field-rows.d.ts +0 -8
  92. package/views/dist/internal/field-rows.js +1 -3
  93. package/views/dist/list/bar-keys.d.ts +3 -0
  94. package/views/dist/list/bar-keys.js +1 -0
  95. package/views/dist/list/buttons/clear-save.js +6 -2
  96. package/views/dist/list/buttons/new.d.ts +1 -1
  97. package/views/dist/list/buttons/new.js +14 -2
  98. package/views/dist/list/buttons/shared.d.ts +7 -1
  99. package/views/dist/list/buttons/shared.js +8 -2
  100. package/views/dist/list/buttons/views.js +6 -4
  101. package/views/dist/list/edits.d.ts +3 -1
  102. package/views/dist/list/layer.d.ts +13 -3
  103. package/views/dist/list/layer.js +13 -3
  104. package/views/dist/list/line.d.ts +5 -2
  105. package/views/dist/list/line.js +11 -3
  106. package/views/dist/list/list.d.ts +7 -1
  107. package/views/dist/list/list.js +2 -2
  108. package/views/dist/list/panels/filter-bar.d.ts +1 -1
  109. package/views/dist/list/panels/filter-bar.js +9 -3
  110. package/views/dist/list/panels/shared.d.ts +3 -2
  111. package/views/dist/list/panels/shared.js +5 -2
  112. package/views/dist/list/root-base.d.ts +2 -1
  113. package/views/dist/list/root-base.js +5 -3
  114. package/views/dist/list/root.d.ts +1 -1
  115. package/views/dist/list/store.d.ts +10 -0
  116. package/views/dist/list/store.js +8 -1
  117. package/views/dist/list/toolbar-model.d.ts +4 -0
  118. package/views/dist/list/toolbar-model.js +19 -1
  119. package/views/dist/list/toolbar.js +2 -1
  120. package/views/dist/list/views.d.ts +1 -1
  121. package/views/dist/list/views.js +4 -1
  122. package/views/dist/looks/index.d.ts +0 -1
  123. package/views/dist/looks/index.js +0 -1
  124. package/views/dist/looks/looks.d.ts +1 -1
  125. package/views/dist/looks/pieces.js +0 -2
  126. package/views/dist/model/column-filters.js +10 -3
  127. package/views/dist/model/view-rules.js +1 -0
  128. package/views/dist/panels/filter/NumberFilterBody.js +6 -8
  129. package/views/dist/panels/labels.js +7 -2
  130. package/views/dist/panels/model.d.ts +3 -0
  131. package/views/dist/panels/react/filter/filter-body.js +5 -1
  132. package/views/dist/panels/react/toolbar/ToolbarBarSorts.js +28 -1
  133. package/views/dist/panels/react/toolbar/ToolbarButton.d.ts +1 -1
  134. package/views/dist/panels/react/toolbar/ToolbarButton.js +5 -3
  135. package/views/dist/panels/react/toolbar/context.d.ts +4 -0
  136. package/views/dist/panels/react/toolbar/context.js +1 -0
  137. package/views/dist/panels/react/toolbar/use-give-way.js +2 -2
  138. package/views/dist/panels/settings/filter-groups.js +5 -0
  139. package/views/dist/panels/settings/input.d.ts +11 -0
  140. package/views/dist/panels/settings/layout.js +26 -0
  141. package/views/dist/panels/settings/person.d.ts +15 -0
  142. package/views/dist/panels/settings/person.js +6 -0
  143. package/views/dist/panels/toolbar/page-resets.js +14 -3
  144. package/views/dist/provider/components.d.ts +12 -3
  145. package/views/dist/styles.css +16 -260
  146. package/views/dist/styles.unlayered.css +16 -260
  147. package/views/docs/contract.md +9 -7
  148. package/views/docs/controls/field.md +1 -1
  149. package/views/docs/guides/looks.md +1 -1
  150. package/views/docs/guides/the-grid.md +4 -2
  151. package/views/docs/guides/toolbar-parts.md +337 -0
  152. package/views/docs/index.md +4 -0
  153. package/views/docs/reference/controls.md +3 -41
  154. package/views/docs/reference/grid.md +4 -3
  155. package/views/docs/reference/list.md +24 -13
  156. package/views/docs/reference/looks.md +12 -15
  157. package/views/docs/reference/panels.md +1 -1
  158. package/views/docs/reference/react.md +3 -3
  159. package/views/docs/reference/views.md +1 -1
  160. package/views/dist/controls/setting-row/looks.d.ts +0 -10
  161. package/views/dist/controls/setting-row/looks.js +0 -22
  162. package/views/dist/controls/setting-row/setting-row.d.ts +0 -102
  163. package/views/dist/controls/setting-row/setting-row.js +0 -135
  164. package/views/dist/controls/setting-row/tokens.d.ts +0 -156
  165. package/views/dist/controls/setting-row/tokens.js +0 -41
  166. package/views/dist/controls/setting-row.css +0 -216
  167. package/views/dist/controls/switch-row/switch-row.d.ts +0 -1
  168. package/views/dist/controls/switch-row/switch-row.js +0 -1
  169. package/views/dist/controls/switch-row/tokens.d.ts +0 -39
  170. package/views/dist/controls/switch-row/tokens.js +0 -12
  171. package/views/dist/controls/switch-row.css +0 -35
  172. package/views/dist/controls/tag-field/tag-field.d.ts +0 -24
  173. package/views/dist/controls/tag-field/tag-field.js +0 -25
  174. package/views/dist/controls/tag-field/tokens.d.ts +0 -23
  175. package/views/dist/controls/tag-field/tokens.js +0 -8
  176. package/views/dist/controls/tag-field.css +0 -32
  177. package/views/docs/controls/setting-row.md +0 -44
  178. package/views/docs/controls/switch-row.md +0 -15
  179. package/views/docs/controls/tag-field.md +0 -11
@@ -13,7 +13,7 @@ import { Picker, usePicker } from "../picker/picker.js";
13
13
  import { FieldsFrame } from "../picker/fields-frame.js";
14
14
  import { itemLabel } from "../picker/rows.js";
15
15
  import { HOW, wayOf } from "./how.js";
16
- import { PairValue, WHOLE } from "./parts.js";
16
+ import { DurationValue, PairValue, WHOLE } from "./parts.js";
17
17
  import { BlockHead, GroupMenu, MenuStep } from "./block.js";
18
18
  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";
19
19
  import { filterWords } from "./words.js";
@@ -207,6 +207,8 @@ export function useFilterEditor(props) {
207
207
  if (field.type === "date")
208
208
  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)
209
209
  setStep({ list: "value", rule: r.id }); } : onOpenChange, phone: phone, size: size, placeholder: w.chooseDate });
210
+ if (field.duration)
211
+ return _jsx(DurationValue, { size: size, "aria-label": name, placeholder: w.typeNumber, duration: field.duration, value: typeof r.value === "number" ? r.value : null, onValue: (v) => set(r.id)(v) });
210
212
  if (field.type === "number" || field.type === "range")
211
213
  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) });
212
214
  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) });
@@ -234,6 +236,7 @@ export function useFilterEditor(props) {
234
236
  }
235
237
  const ruleRow = (r) => {
236
238
  const field = fieldOf(fields, r.field), own = ownOf(r), aside = r.aside, name = labelOf(r);
239
+ const note = props.note?.(r) ?? null;
237
240
  const kitWay = field ? wayOf(field.type, r.how) : undefined, takes = kitWay ? kitWay.takes : own && !aside && own.body != null ? "one" : undefined;
238
241
  const ways = field ? waysOf(field) : [];
239
242
  const entries = ruleEntries(r), fieldItems = asSelect(fieldsIn(filter, r.id, fields, deepest));
@@ -241,7 +244,7 @@ export function useFilterEditor(props) {
241
244
  const wayPlaceholder = own && !kitWay ? own.way : w.way(r.how);
242
245
  return (_jsxs("div", { className: "o-filter-editor-rule", "data-slot": "vk-filter-rule", "data-key": field?.key ?? r.field, "data-rule": r.id, "data-whole": (field || own) && isWhole(r, fields) ? "" : undefined, "data-set-aside": aside || (!field && !own) ? "" : undefined, "data-aside": aside ? "" : undefined, children: [_jsxs("div", { className: "o-filter-editor-boxes", children: [_jsx("div", { className: "o-filter-editor-field", children: why(_jsx(Select, { size: size, listWidth: "rows", "aria-label": w.field, "data-slot": "vk-filter-field", items: fieldItems, value: field && !aside ? r.field : null, placeholder: name, search: w.search, ...stepOf({ list: "field", rule: r.id }), onValueChange: (v) => { if (typeof v === "string" && (v !== r.field || aside))
243
246
  pointAt(r.id, v); } })) }), _jsx("div", { className: "o-filter-editor-how", children: why(_jsx(Select, { size: size, listWidth: "rows", "aria-label": w.how, "data-slot": "vk-filter-how", items: ways, value: field && kitWay && !aside ? r.how : null, placeholder: wayPlaceholder, disabled: !!aside || (!field && !!own), ...(field || !own ? stepOf({ list: "how", rule: r.id }) : {}), onValueChange: (v) => { if (typeof v === "string" && v !== r.how)
244
- change(changeRule(now.current, r.id, { how: v }, fields)); } })) }), aside && own?.value != null && (_jsx("div", { className: "o-filter-editor-value", "data-slot": "vk-filter-value", "data-value-of": r.id, "data-value-box": "own", children: why(_jsx(Input, { readOnly: true, disabled: true, size: size, "aria-label": name, value: own.value, className: "o-filter-editor-own-box" })) })), !aside && takes && takes !== "none" && (field || own) && (_jsx("div", { className: "o-filter-editor-value", "data-slot": "vk-filter-value", "data-value-of": r.id, "data-value-box": own ? "own" : field?.choices ? "choice" : takes === "two" ? "pair" : field?.type === "date" ? "date" : "typed", children: valueBox(r, field ?? { value: r.field, label: name, type: "text" }, takes, own) }))] }), shapeActions([{ key: "more", label: w.ruleOf(name), icon: glyph(phone ? DOTS : DOTS_UP), draw: (shown) => {
247
+ change(changeRule(now.current, r.id, { how: v }, fields)); } })) }), aside && own?.value != null && (_jsx("div", { className: "o-filter-editor-value", "data-slot": "vk-filter-value", "data-value-of": r.id, "data-value-box": "own", children: why(_jsx(Input, { readOnly: true, disabled: true, size: size, "aria-label": name, value: own.value, className: "o-filter-editor-own-box" })) })), !aside && takes && takes !== "none" && (field || own) && (_jsx("div", { className: "o-filter-editor-value", "data-slot": "vk-filter-value", "data-value-of": r.id, "data-value-box": own ? "own" : field?.choices ? "choice" : takes === "two" ? "pair" : field?.type === "date" ? "date" : "typed", children: valueBox(r, field ?? { value: r.field, label: name, type: "text" }, takes, own) })), note && !aside && _jsx("p", { className: "o-filter-editor-note", role: "note", "data-slot": "vk-filter-refused", children: note })] }), shapeActions([{ key: "more", label: w.ruleOf(name), icon: glyph(phone ? DOTS : DOTS_UP), draw: (shown) => {
245
248
  const label = shown?.label ?? w.ruleOf(name);
246
249
  if (phone)
247
250
  return shown?.disabled ? greyed(shown.disabled, moreStep(r.id, label, "vk-filter-rule-more", true)) : moreStep(r.id, label, "vk-filter-rule-more");
@@ -18,6 +18,14 @@ export interface FilterField extends PickerItem {
18
18
  level?: FilterField[];
19
19
  integer?: boolean;
20
20
  key?: string;
21
+ /** A number kept as a duration: how its box writes a stored bound (`1m 30s`) and reads what is typed back as one, null for
22
+ * what reads as none (VK-1121). Absent, the Number field. */
23
+ duration?: DurationBox;
24
+ }
25
+ /** How a duration's box writes a stored bound and reads one typed. */
26
+ export interface DurationBox {
27
+ write: (value: number) => string;
28
+ read: (typed: string) => number | null;
21
29
  }
22
30
  /** Each type's ways, in the order they are offered; the first is a new rule's. */
23
31
  export declare const HOW: Record<FieldType, FilterWay[]>;
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import type { FieldConventions } from "viewkitjs/fields";
2
3
  import type { FilterRule as ViewKitRule } from "viewkitjs/fields/query";
3
4
  import { type ViewsMessageResolver } from "../../contract.js";
4
5
  import type { ViewsFilterBodyProps, ViewsFilterPartBodyProps, ViewsMenuItem } from "../../provider/components.js";
@@ -14,18 +15,19 @@ type AppIcon = React.ComponentType<{
14
15
  /** The filter editor's words in the app's messages. */
15
16
  export declare function filterWordsOf(say: ViewsMessageResolver): FilterEditorWords;
16
17
  /** ViewKit's filter body's props as the filter editor's parts, the level turned both ways. */
17
- export declare function useMapFilterBody(p: ViewsFilterBodyProps, words: FilterEditorWords, say: ViewsMessageResolver, AppIcon: AppIcon | undefined, wayWord: (operator: string) => string): {
18
+ export declare function useMapFilterBody(p: ViewsFilterBodyProps, words: FilterEditorWords, say: ViewsMessageResolver, AppIcon: AppIcon | undefined, wayWord: (operator: string) => string, cv?: FieldConventions): {
18
19
  items?: ((is: ViewsMenuItem[], ctx: FilterEditorItemsContext) => ViewsMenuItem[]) | undefined;
19
20
  kit: KitFields;
20
21
  filter: KitGroup;
21
22
  change: (next: KitGroup) => void;
22
23
  own: (rule: KitRule) => FilterOwn | null;
24
+ note: (rule: KitRule) => string | null;
23
25
  };
24
26
  /** ViewKit's filter body, its controls the app's where the provider's `panelControls` names them (VK-1013). */
25
27
  export declare function MapFilterBody(props: ViewsFilterBodyProps): import("react/jsx-runtime").JSX.Element;
26
28
  /** The rule as a one-rule kit filter, with the kit's fields for it; null where the kit draws no rule of it, or where a choice has no
27
29
  * values to offer, which ViewKit's own body then draws. */
28
- export declare function partOf(rule: ViewKitRule, field: ViewsFilterPartBodyProps["field"], choices: ChoicesOf): {
30
+ export declare function partOf(rule: ViewKitRule, field: ViewsFilterPartBodyProps["field"], choices: ChoicesOf, cv?: FieldConventions): {
29
31
  kit: KitFields;
30
32
  filter: KitGroup;
31
33
  } | null;
@@ -80,10 +80,10 @@ function listed(fields, rule, relation) {
80
80
  const at = relation !== undefined ? fields.find((f) => f.far && f.fieldKey === relation)?.far ?? [] : fields.filter((f) => !f.far);
81
81
  return at.some((f) => f.disabled === undefined && f.fieldKey === rule.fieldKey && (f.part ?? undefined) === (rule.part ?? undefined));
82
82
  }
83
- export function useMapFilterBody(p, words, say, AppIcon, wayWord) {
83
+ export function useMapFilterBody(p, words, say, AppIcon, wayWord, cv) {
84
84
  const within = p.relation?.fieldKey;
85
85
  const choices = React.useMemo(() => choicesOf(p.fields, AppIcon), [p.fields, AppIcon]);
86
- const kit = React.useMemo(() => kitFieldsOf(p.fields, choices, within), [p.fields, choices, within]);
86
+ const kit = React.useMemo(() => kitFieldsOf(p.fields, choices, within, cv), [p.fields, choices, within, cv]);
87
87
  const [, redraw] = React.useReducer((n) => n + 1, 0);
88
88
  const own = React.useRef(new Map()).current;
89
89
  const asideWords = (rule, relation) => {
@@ -150,7 +150,16 @@ export function useMapFilterBody(p, words, say, AppIcon, wayWord) {
150
150
  return ctx.menu === "row" ? { menu: "row", ...named, ...(ctx.aside && { aside: true }) } : { menu: ctx.menu, ...named };
151
151
  };
152
152
  const items = p.items && ((is, ctx) => p.items(is, publicOf(ctx)));
153
- return { kit, filter: read.filter, change: (next) => write(next), own: ownOf, ...(items && { items }) };
153
+ const note = (rule) => {
154
+ if (rule.aside || !p.ruleWords)
155
+ return null;
156
+ const as = viewKitFilterOf({ id: "one", join: "and", rules: [rule] }, kit, {}).items[0];
157
+ if (!as)
158
+ return null;
159
+ const inner = isRelation(as) ? as.where.items[0] : as;
160
+ return (inner && p.ruleWords(inner, isRelation(as) ? as.fieldKey : within).refused) ?? null;
161
+ };
162
+ return { kit, filter: read.filter, change: (next) => write(next), own: ownOf, note, ...(items && { items }) };
154
163
  }
155
164
  export function MapFilterBody(props) {
156
165
  return _jsx(PanelControlsFromViews, { children: _jsx(FilterBodyInner, { ...props }) });
@@ -160,9 +169,9 @@ function FilterBodyInner(props) {
160
169
  const say = views?.messages ?? resolveViewsMessage;
161
170
  const words = React.useMemo(() => filterWordsOf(say), [say]);
162
171
  const wayWord = (operator) => (views?.conventions ? views.conventions.messages({ key: "filter.operator", values: { operator } }) : operator.replace(/_/g, " "));
163
- const map = useMapFilterBody(props, words, say, views?.components.AppIcon, wayWord);
172
+ const map = useMapFilterBody(props, words, say, views?.components.AppIcon, wayWord, views?.conventions);
164
173
  const parts = useFilterEditor({ ...(map.items && { items: map.items }), label: props.label, fields: map.kit.fields, filter: map.filter, levels: props.levels, form: props.form, onDone: props.onDone,
165
- onFilterChange: map.change, own: map.own, words, excludable: props.excludable, ...(props.empty && { empty: props.empty }) });
174
+ onFilterChange: map.change, own: map.own, note: map.note, words, excludable: props.excludable, ...(props.empty && { empty: props.empty }) });
166
175
  useToldStep(parts, props.onStepChange);
167
176
  const { actions } = props;
168
177
  if (!actions)
@@ -172,8 +181,8 @@ function FilterBodyInner(props) {
172
181
  ? _jsx(BodyHead, { title: parts.title, left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-back", "aria-label": words.back, className: "o-sheet-back", icon: glyph(BACK), onClick: parts.head.onBack }), right: done || _jsx("span", {}) })
173
182
  : _jsx(BodyHead, { title: props.label, left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-close", "aria-label": actions.close.label, icon: glyph(X), onClick: actions.close.onPress }), right: done || _jsx("span", {}) }), parts.body] }));
174
183
  }
175
- export function partOf(rule, field, choices) {
176
- const kit = kitFieldsOf([field], choices), [f] = kit.fields, { filter } = kitFilterOf({ op: "and", items: [rule] }, kit);
184
+ export function partOf(rule, field, choices, cv) {
185
+ const kit = kitFieldsOf([field], choices, undefined, cv), [f] = kit.fields, { filter } = kitFilterOf({ op: "and", items: [rule] }, kit);
177
186
  if (!f || (CHOICE.has(f.type) && !f.choices))
178
187
  return null;
179
188
  return filter.rules.length === 1 ? { kit, filter } : null;
@@ -193,7 +202,7 @@ function FilterPartBodyInner(props) {
193
202
  const words = React.useMemo(() => filterWordsOf(say), [say]);
194
203
  const { part, label, rule, field, ways, own, form, onRuleChange, onDone } = props;
195
204
  const choices = React.useMemo(() => choicesOf([field], views?.components.AppIcon), [field, views?.components.AppIcon]);
196
- const drawn = partOf(rule, field, choices);
205
+ const drawn = partOf(rule, field, choices, views?.conventions);
197
206
  const pickerWords = words.picker ? { words: words.picker } : {};
198
207
  const theirs = !drawn || isOwnWay(rulesOf(drawn.filter)[0]?.how ?? "");
199
208
  if (theirs && part === "value")
@@ -1,4 +1,4 @@
1
- import type { FieldType } from "viewkitjs/fields";
1
+ import type { FieldConventions, FieldType } from "viewkitjs/fields";
2
2
  import type { FilterGroup, FilterNode, FilterRelationRule, FilterRule } from "viewkitjs/fields/query";
3
3
  import type { ViewsFilterBodyField } from "../../provider/components.js";
4
4
  import { type PickerItem } from "../picker/rows.js";
@@ -62,11 +62,12 @@ export declare const RELATED = "Related records";
62
62
  export declare const pathOf: (relationKey: string, farKey: string) => string;
63
63
  export declare const pathParts: (value: string) => [string, string?];
64
64
  /** The fields ViewKit hands as the kit's filter editor takes them: each of a type it draws, a part by its own type, a choice's values
65
- * from `choices` (a choice with none stays a field, its value ViewKit's to draw), a yes/no's Checked and Unchecked; then each
65
+ * from `choices` (a choice with none stays a field, its value ViewKit's to draw), a yes/no's Checked and Unchecked, a duration its
66
+ * box read and written as one (VK-1121, by the conventions `cv`); then each
66
67
  * relation under Related records, its far fields one level in. A place's part the kit draws no type for is no field of the kit's,
67
68
  * but its place is known, so a rule on it is ViewKit's to word. Open on a relation's where (`relation`, its field key), that
68
69
  * relation's far fields alone, as plain fields. */
69
- export declare function kitFieldsOf(fields: readonly ViewsFilterBodyField[], choices: ChoicesOf, relation?: string): KitFields;
70
+ export declare function kitFieldsOf(fields: readonly ViewsFilterBodyField[], choices: ChoicesOf, relation?: string, cv?: FieldConventions): KitFields;
70
71
  /** The field a rule the kit has no type for names: ViewKit's to word (`own:<fieldKey>~<part>`). */
71
72
  export declare const OWN_FIELD = "own:";
72
73
  /** The way of a relation rule drawn as one row (set aside, or on a relation the fields don't list). */
@@ -1,4 +1,5 @@
1
1
  import { findItem } from "../picker/rows.js";
2
+ import { durationBound, durationDraft } from "../../filters/duration-bound.js";
2
3
  import { CHECKED } from "./how.js";
3
4
  import { isOwnWay, isPair, OWN_WAY, rulesOf } from "./rules.js";
4
5
  const TYPES = {
@@ -26,7 +27,8 @@ export const pathParts = (value) => {
26
27
  return at < 0 ? [value] : [value.slice(0, at), value.slice(at + 1)];
27
28
  };
28
29
  const placeOf = (a) => [a.relation ?? "", a.fieldKey, a.part ?? ""].join(SEP);
29
- export function kitFieldsOf(fields, choices, relation) {
30
+ const durationBox = (unit, cv) => ({ write: (value) => durationDraft(value, unit), read: (typed) => durationBound(typed, unit, cv) });
31
+ export function kitFieldsOf(fields, choices, relation, cv) {
30
32
  const at = new Map();
31
33
  const field = (f, value, place, from, key) => {
32
34
  const type = kitPartTypeOf(f.type, f.part);
@@ -39,7 +41,8 @@ export function kitFieldsOf(fields, choices, relation) {
39
41
  }
40
42
  const values = type === "checkbox" ? CHECKED : CHOICE.has(type) ? choices(f.fieldKey, from, f.part) : undefined;
41
43
  at.set(value, place);
42
- return [{ value, label: f.label, type, ...(values ? { choices: values } : {}), ...(f.integer ? { integer: true } : {}), ...(key !== undefined ? { key } : {}) }];
44
+ return [{ value, label: f.label, type, ...(values ? { choices: values } : {}), ...(f.integer ? { integer: true } : {}), ...(key !== undefined ? { key } : {}),
45
+ ...(f.duration && type === "number" ? { duration: durationBox(f.duration, cv) } : {}) }];
43
46
  };
44
47
  const own = (f, from) => field(f, f.key, { fieldKey: f.fieldKey, ...(f.part !== undefined ? { part: f.part } : {}) }, from);
45
48
  const relations = new Map(), relationLabels = new Map();
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import type { FilterOwn } from "./filter-editor.js";
3
- import { type FilterField } from "./how.js";
3
+ import { type DurationBox, type FilterField } from "./how.js";
4
4
  import { type FilterGroup, type FilterRule } from "./rules.js";
5
5
  import { type FilterEditorWords } from "./words.js";
6
6
  /** Which part of a filter was pressed: its field, how it compares, or its value. */
@@ -46,5 +46,18 @@ 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 duration's box (VK-1121): the Input, the stored bound written as a duration (`1m 30s`), and what is typed handed on with each
50
+ * key as the bound it reads as (`90` and `1m 30s` alike), null for what reads as none. What is typed stays as typed while it means
51
+ * the value; a value from elsewhere (a view switched, Clear all) is written afresh. */
52
+ export declare function DurationValue({ duration, value, onValue, ...rest }: {
53
+ duration: DurationBox;
54
+ value: number | null;
55
+ onValue: (v: number | null) => void;
56
+ "aria-label": string;
57
+ placeholder?: string;
58
+ size?: "sm" | "lg";
59
+ onKeyDown?: (e: React.KeyboardEvent) => void;
60
+ "data-slot"?: string;
61
+ }): import("react/jsx-runtime").JSX.Element;
49
62
  /** A whole number's format: Base UI's Number Field rounds what is typed to it (VK-22). */
50
63
  export declare const WHOLE: Intl.NumberFormatOptions;
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
3
4
  import { DateEditor } from "../date-editor/date-editor.js";
4
5
  import { usePanelControls } from "../internal/panel-controls.js";
5
6
  import { Picker } from "../picker/picker.js";
@@ -65,6 +66,17 @@ export function PairValue({ name, value, onValue, size, onKeyDown, words: given,
65
66
  const { NumberBox } = usePanelControls();
66
67
  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
68
  }
69
+ export function DurationValue({ duration, value, onValue, ...rest }) {
70
+ const { Input } = usePanelControls();
71
+ const written = (v) => (v === null ? "" : duration.write(v));
72
+ const [draft, setDraft] = React.useState(() => written(value));
73
+ if (duration.read(draft) !== value) {
74
+ const now = written(value);
75
+ if (now !== draft)
76
+ setDraft(now);
77
+ }
78
+ return _jsx(Input, { ...rest, value: draft, onChange: (e) => { setDraft(e.target.value); onValue(duration.read(e.target.value)); } });
79
+ }
68
80
  export const WHOLE = { maximumFractionDigits: 0 };
69
81
  function TypedValue({ rule: r, field, name, set, onDone, w }) {
70
82
  const enter = (e) => { if (e.key === "Enter") {
@@ -72,6 +84,8 @@ function TypedValue({ rule: r, field, name, set, onDone, w }) {
72
84
  onDone();
73
85
  } };
74
86
  const { Input, NumberBox } = usePanelControls();
87
+ if (field.duration)
88
+ return _jsx(DurationValue, { "data-slot": "vk-filter-part-value", "aria-label": name, placeholder: valuePlaceholder(field, w), duration: field.duration, value: typeof r.value === "number" ? r.value : null, onValue: (v) => set({ value: v }), onKeyDown: enter });
75
89
  return field.type === "number" || field.type === "range"
76
90
  ? _jsx(NumberBox, { "data-slot": "vk-filter-part-value", "aria-label": name, placeholder: valuePlaceholder(field, w), value: typeof r.value === "number" ? r.value : null, format: field.integer ? WHOLE : undefined, onValueChange: (v) => set({ value: v ?? null }), onKeyDown: enter })
77
91
  : _jsx(Input, { "data-slot": "vk-filter-part-value", "aria-label": name, placeholder: valuePlaceholder(field, w), value: typeof r.value === "string" ? r.value : "", onChange: (e) => set({ value: e.target.value }), onKeyDown: enter });
@@ -125,7 +125,10 @@
125
125
  /* ── VK-827: a group that excludes its matches says so over its rules; a relation rule's block is a group's well with a head, its
126
126
  relation's name and its quantifier's box, laid out as ViewKit's own block (Mihai, 29 Nov 2026: built from the kit's parts); a
127
127
  group's ⋮ ends its foot, after Delete group, as a rule's ends its row ─────────────────────────────────────────────────────── */
128
- .o-filter-editor-excluded {
128
+ /* Why a whole rule filters nothing (VK-17), on a line of its own under the rule's boxes. */
129
+ .o-filter-editor-boxes:has(> .o-filter-editor-note) { flex-wrap: wrap; }
130
+ .o-filter-editor-note { flex: 1 1 100%; }
131
+ .o-filter-editor-excluded, .o-filter-editor-note {
129
132
  margin: 0; color: var(--vk-fg-subtle); font-size: var(--vk-font-size-xs); font-weight: var(--vk-font-weight-medium);
130
133
  line-height: calc(var(--vk-font-size-xs) * var(--vk-line-height-xs));
131
134
  }
@@ -133,7 +133,4 @@ export { VALUES_EDITOR_WORDS, valuesWords, type ValuesEditorWords } from "./valu
133
133
  export { LinksEditor, useLinksEditor, type LinksEditorAction, type LinksEditorLead, type LinksEditorOpens, type LinksEditorParts, type LinksEditorProps, } from "./links-editor/links-editor.js";
134
134
  export { found, heldOf, leadAfter, offered, removed, said, saidShort, setValue, ticked, type LinkChoice, type LinkField, type LinkFieldKind, type LinkValue, } from "./links-editor/links.js";
135
135
  export { LINKS_EDITOR_WORDS, linksWords, type LinksEditorWords } from "./links-editor/words.js";
136
- export { TagField, type TagFieldProps } from "./tag-field/tag-field.js";
137
- export { SettingChevron, SettingIcon, SettingRow, SettingRows, SwitchRow, SwitchRows, useSettingRowWorn, useSettingRowsRow, type SettingAction, type SettingRowProps, type SettingRowsProps, type SettingState, type SwitchRowProps } from "./setting-row/setting-row.js";
138
- export { SETTING_ROW_ATTRS, settingRowWornOf } from "./setting-row/looks.js";
139
136
  export type { PartSlot } from "./internal/part-slot.js";
@@ -125,6 +125,3 @@ export { VALUES_EDITOR_WORDS, valuesWords } from "./values-editor/words.js";
125
125
  export { LinksEditor, useLinksEditor, } from "./links-editor/links-editor.js";
126
126
  export { found, heldOf, leadAfter, offered, removed, said, saidShort, setValue, ticked, } from "./links-editor/links.js";
127
127
  export { LINKS_EDITOR_WORDS, linksWords } from "./links-editor/words.js";
128
- export { TagField } from "./tag-field/tag-field.js";
129
- export { SettingChevron, SettingIcon, SettingRow, SettingRows, SwitchRow, SwitchRows, useSettingRowWorn, useSettingRowsRow } from "./setting-row/setting-row.js";
130
- export { SETTING_ROW_ATTRS, settingRowWornOf } from "./setting-row/looks.js";
@@ -5,7 +5,7 @@
5
5
  drawn round an Input and its addons (at the end of this file). The field around it, its label, note and
6
6
  error, is field.css.
7
7
 
8
- It is the one field: the Select's field and the tag field are .o-input too, so every state and option
8
+ It is the one field: the Select's field is .o-input too, so every state and option
9
9
  here draws them. A Select's open list (data-popup-open) is its focus, and a field's state is read from
10
10
  its control (.o-input-control) wherever inside it sits, among a Select's chips too.
11
11
 
@@ -12,7 +12,7 @@
12
12
 
13
13
  A fifth, data-menu-list-close (hidden · shown), is read by the Menu, not here: a Close row over its rows.
14
14
 
15
- Nothing set draws My preset's: Words, rows 56 high, corners 2xl, lines full width. Each rule keyed on one of those values has a
15
+ Nothing set draws Words, rows 56 high, corners 2xl, lines full width. Each rule keyed on one of those values has a
16
16
  twin on the same subject, :not([data-menu-list-<option>] *), at the same weight, so a frame that sets the option turns it off;
17
17
  the bare rules draw the rest (Card, Inset, 52, xl). The nearest frame wins: each rule keyed on a value stands down inside a
18
18
  frame of another value set within it, by a :where() of no weight, so a piece that pins its own rows (Customize's settings, a
@@ -15,5 +15,5 @@ export type PickerWorn = {
15
15
  };
16
16
  /** The data attributes pickerWornOf reads, for an observer that reads them again as an app's picks change. */
17
17
  export declare const pickerRead: string[];
18
- /** The options worn around `el`, each read off the nearest frame that sets it; outside any frame, the defaults (My preset's). */
18
+ /** The options worn around `el`, each read off the nearest frame that sets it; outside any frame, the defaults (ViewKit's own). */
19
19
  export declare function pickerWornOf(el: Element | null): PickerWorn;
@@ -18,7 +18,7 @@
18
18
  .o-picker .o-list-main { flex: 0 1 auto; }
19
19
  .o-picker .o-list-line { flex: 1 1 0; min-width: 0; }
20
20
  [data-picker-line="below"] .o-picker .o-list-text { display: grid; gap: var(--vk-border-width); }
21
- /* Below is the default (My preset's): where no frame picks a second line, at the picked rule's weight. */
21
+ /* Below is the default: where no frame picks a second line, at the picked rule's weight. */
22
22
  .o-picker:not([data-picker-line] *) .o-list-text { display: grid; gap: var(--vk-border-width); }
23
23
 
24
24
  /* The check in the brand's circle at a row's end (Held: Check, Attio's), seen only on the row the field holds. */
@@ -202,7 +202,7 @@
202
202
  .o-picker-message-text { flex: 0 1 auto; }
203
203
  [data-picker-doing="start"] .o-picker-message { justify-content: flex-start; text-align: left; }
204
204
  [data-picker-doing="start"] .o-picker-message-text { flex: 1; }
205
- /* At the start is the default (My preset's): where no frame picks what the list is doing, at the picked rules' weight. */
205
+ /* At the start is the default: where no frame picks what the list is doing, at the picked rules' weight. */
206
206
  .o-picker-message:not([data-picker-doing] *) { justify-content: flex-start; text-align: left; }
207
207
  .o-picker-message-text:not([data-picker-doing] *) { flex: 1; }
208
208
  .o-picker-more { display: flex; align-items: center; justify-content: center; gap: calc(var(--vk-spacing) * 2); min-height: calc(var(--vk-spacing) * 8); font-size: var(--vk-font-size-xs); color: var(--vk-fg-subtle); }
@@ -37,7 +37,6 @@
37
37
  .o-input-addon:is([data-side="start"], [data-side="end"]) > .o-button { --pressing-room-x: calc(var(--vk-spacing) * 0.75); }
38
38
  .o-input-addon:is([data-side="top"], [data-side="bottom"]) > .o-button { --pressing-room-x: calc(var(--vk-spacing) * 0.5); }
39
39
  :is(.o-check:not(.o-check-row), .o-radio):not(.o-radio-row > *, :has(.o-choice-note)):is(:has(+ :is(.o-check, .o-radio)), :is(.o-check, .o-radio) + *) > :is(.o-check-box, .o-radio-ring) { --pressing-room-y: calc(var(--vk-spacing) * 2); }
40
- .o-tag-field .o-tag-remove { --pressing-room-x: calc(var(--vk-spacing) * 0.75); --pressing-room-y: calc(var(--vk-spacing) * 1.5); }
41
40
  .o-select-chips .o-tag-remove { --pressing-room-x: calc(var(--vk-spacing) * 0.5); --pressing-room-y: calc(var(--vk-spacing) * 1); }
42
41
  /* Options side by side, 6px apart in a row and between their lines: a link half that each way. */
43
42
  .o-options > .o-option[data-link] { --pressing-room-x: calc(var(--vk-spacing) * 0.75); --pressing-room-y: calc(var(--vk-spacing) * 0.75); }
@@ -16,7 +16,7 @@ export interface RadioGroupProps extends Omit<React.ComponentProps<typeof BaseRa
16
16
  }
17
17
  /** Exactly one of a few choices, all of them in sight: its name, then its Radios. With a name, the group is a
18
18
  * FieldSet, its name the legend (Base UI names the radio group by it). */
19
- export declare function RadioGroup(props: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function RadioGroup({ label, row, tiles, className, children, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
20
20
  export interface RadioProps extends Omit<React.ComponentProps<typeof BaseRadio.Root>, "className"> {
21
21
  /** Its public name where a panel names it (VK-988), drawn on its label with `data-key`: `vk-customize-layout`, say. */
22
22
  "data-slot"?: string;
@@ -4,24 +4,9 @@ import * as React from "react";
4
4
  import { Radio as BaseRadio } from "@base-ui/react/radio";
5
5
  import { RadioGroup as BaseRadioGroup } from "@base-ui/react/radio-group";
6
6
  import { cx } from "../../internal/cx.js";
7
- import { AtSettingRowEnd } from "../../internal/field-rows.js";
8
7
  import { FieldSet } from "../field/field.js";
9
8
  import { phoneMark, usePhoneForm } from "../internal/phone.js";
10
- import { Select } from "../select/select.js";
11
- export function RadioGroup(props) {
12
- const end = React.useContext(AtSettingRowEnd), radios = radiosOf(props.children);
13
- if (end && !radios.some((r) => r.props.swatch != null))
14
- return _jsx(RadioSelect, { ...props, radios: radios, name: end.name });
15
- return _jsx(RadioChoices, { ...props });
16
- }
17
- const radiosOf = (children) => React.Children.toArray(children).filter((c) => React.isValidElement(c) && c.type === Radio);
18
- const asWords = (v) => (v == null ? undefined : String(v));
19
- function RadioSelect({ radios, name, value, defaultValue, onValueChange, disabled, className, ...props }) {
20
- const items = radios.map(({ props: r }) => ({ value: String(r.value), label: typeof r.label === "string" ? r.label : String(r.value) }));
21
- return (_jsx(Select, { size: "md", className: cx("o-setting-row-select", className), items: items, value: asWords(value), defaultValue: asWords(defaultValue), disabled: disabled, "aria-label": props["aria-label"] ?? name ?? "Choose", onValueChange: (v) => { if (typeof v === "string")
22
- onValueChange?.(v, undefined); } }));
23
- }
24
- function RadioChoices({ label, row = false, tiles = false, className, children, ...props }) {
9
+ export function RadioGroup({ label, row = false, tiles = false, className, children, ...props }) {
25
10
  const phone = usePhoneForm();
26
11
  const group = (_jsx(BaseRadioGroup, { className: cx("o-radio-group", row && "o-radio-row", tiles && "o-radio-tiles", label == null && className), ...phoneMark(phone), ...props, children: children }));
27
12
  return label != null ? _jsx(FieldSet, { legend: label, disabled: props.disabled, className: className, children: group }) : group;
@@ -2,8 +2,8 @@ import * as React from "react";
2
2
  import { type CloseReason } from "../internal/close-reason.js";
3
3
  import { type SheetForm, type SheetStop } from "./forms.js";
4
4
  export type { SheetForm, SheetStop } from "./forms.js";
5
- /** Closes every sheet open under this one and this one: a choice that finishes the job. A drag, the dim or Back close
6
- * only the top one. */
5
+ /** Closes every sheet open under this one and this one, an app's own sheet or dialog on Base UI under it included: a
6
+ * choice that finishes the job. A drag, the dim or Back close only the top one. */
7
7
  export declare const useSheetCloseAll: () => (() => void) | null;
8
8
  /** A close that is a button of its own: a head's Cancel. */
9
9
  export declare const SheetClose: ({ children }: {
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
+ import { createPortal } from "react-dom";
3
4
  import { Drawer as Base } from "@base-ui/react/drawer";
4
5
  import { cx } from "../../internal/cx.js";
5
6
  import { OutOfFieldRows } from "../../internal/field-rows.js";
@@ -249,7 +250,9 @@ function useKeyboardFoot(popup, on) {
249
250
  }, [typing, popup]);
250
251
  }
251
252
  export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form = "full", stops, openAt, stop, onStopChange, mark: marked = "[data-sheet-mark]", container, standing: stands, risen = false, finalFocus, className, "data-slot": slot, children }) {
252
- const closeBelow = React.useContext(CloseAll), stacked = closeBelow !== null;
253
+ const closeBelow = React.useContext(CloseAll);
254
+ const [overApp, setOverApp] = React.useState(false), appClose = React.useRef(null);
255
+ const stacked = closeBelow !== null || overApp;
253
256
  const standsBelow = React.useContext(Standing), standing = stands || standsBelow;
254
257
  const [armed, setArmed] = React.useState(risen);
255
258
  React.useEffect(() => setArmed(true), []);
@@ -269,6 +272,7 @@ export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form =
269
272
  const [popup, setPopup] = React.useState(null), [viewport, setViewport] = React.useState(null);
270
273
  const backdrop = React.useRef(null), popupRef = React.useRef(null);
271
274
  const bindPopup = React.useCallback((el) => { popupRef.current = el; setPopup(el); }, []);
275
+ React.useLayoutEffect(() => setOverApp(!!popup && closeBelow === null && popup.hasAttribute("data-nested")), [popup, closeBelow]);
272
276
  const list = stops ?? FORMS[form].stops, first = openAt ?? list[0];
273
277
  const [at, setAt] = React.useState(first), [mark, setMark] = React.useState(null);
274
278
  const [wasOpen, setWasOpen] = React.useState(open), [coming, setComing] = React.useState(open && !risen);
@@ -336,7 +340,10 @@ export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form =
336
340
  b.scrollTop = 0;
337
341
  } }, [expanded, popup]);
338
342
  const close = React.useCallback((reason) => onOpenChange(false, { reason }), [onOpenChange]);
339
- const closeAll = React.useCallback(() => { closeBelow?.(); release("closed"); close("item-press"); }, [closeBelow, release, close]);
343
+ const closeAll = React.useCallback(() => { if (closeBelow)
344
+ closeBelow();
345
+ else
346
+ appClose.current?.click(); release("closed"); close("item-press"); }, [closeBelow, release, close]);
340
347
  const body = React.useMemo(() => ({
341
348
  onBodyWheel: (e) => { const s = stopAfterWheel(current, e.deltaY); if (s !== current)
342
349
  moveTo(s); },
@@ -353,27 +360,27 @@ export function Sheet({ open, onOpenChange, onOpenChangeComplete, label, form =
353
360
  document.addEventListener("focusin", on, true);
354
361
  return () => document.removeEventListener("focusin", on, true);
355
362
  }, [open, standing, container, viewport]);
356
- return (_jsx(Base.Root, { open: open && armed, onOpenChangeComplete: (o) => { setComing(false); onOpenChangeComplete?.(o); }, swipeDirection: "down", modal: !standing, disablePointerDismissal: standing, onOpenChange: (o, details) => {
357
- const from = details.event?.target;
358
- const elsewhere = from instanceof Element && (from === document.body ? !focusedIn.current : !(container ?? viewport)?.contains(from));
359
- if (!o && standing && details.reason === "escape-key" && elsewhere) {
360
- details.cancel();
361
- return;
362
- }
363
- if (!o && details.reason !== "swipe")
364
- release("closed");
365
- onOpenChange(o, { reason: closeReasonOf(details.reason) });
366
- }, snapPoints: points, snapPoint: point, snapToSequentialPoints: true, onSnapPointChange: (p, details) => {
367
- if (p === null) {
368
- release("closed", details.event?.timeStamp);
369
- return;
370
- }
371
- if (!open || details.reason !== "swipe")
372
- return;
373
- release(offsetOf(p, popup.offsetHeight, viewport.clientHeight), details.event?.timeStamp);
374
- moveTo(stopOf(p === mark ? "mark" : p, list));
375
- }, children: _jsxs(Base.Portal, { container: container, children: [_jsx(Base.Backdrop, { ref: backdrop, forceRender: stacked, className: "o-sheet-backdrop", "data-stacked": stacked ? "" : undefined }), _jsxs(Base.Viewport, { ref: setViewport, className: "o-sheet-viewport", "data-sheet-form": form, onClick: standing ? (e) => { if (e.target === e.currentTarget) {
363
+ return (_jsxs(_Fragment, { children: [overApp && popup && createPortal(_jsx(Base.Close, { ref: appClose, hidden: true, tabIndex: -1, "aria-hidden": "true" }), popup.ownerDocument.body), _jsx(Base.Root, { open: open && armed, onOpenChangeComplete: (o) => { setComing(false); onOpenChangeComplete?.(o); }, swipeDirection: "down", modal: !standing, disablePointerDismissal: standing, onOpenChange: (o, details) => {
364
+ const from = details.event?.target;
365
+ const elsewhere = from instanceof Element && (from === document.body ? !focusedIn.current : !(container ?? viewport)?.contains(from));
366
+ if (!o && standing && details.reason === "escape-key" && elsewhere) {
367
+ details.cancel();
368
+ return;
369
+ }
370
+ if (!o && details.reason !== "swipe")
376
371
  release("closed");
377
- close("outside-press");
378
- } } : undefined, children: [_jsx(Base.Popup, { ref: bindPopup, initialFocus: popupRef, finalFocus: finalFocus ? () => finalFocus() ?? true : undefined, className: cx("o-sheet o-smooth", className), "data-sheet-form": form, "aria-label": label, "data-slot": slot, "data-kit": "sheet", children: _jsxs("div", { className: "o-sheet-cut", children: [_jsx("div", { className: "o-sheet-handle", "aria-hidden": "true" }), _jsx(Standing.Provider, { value: standing, children: _jsx(Body.Provider, { value: body, children: _jsx(CloseAll.Provider, { value: closeAll, children: _jsx(OutOfFieldRows, { children: children }) }) }) })] }) }), coming && _jsx("div", { className: "o-sheet-shield", "aria-hidden": "true", "data-sheet-shield": "", onPointerDown: (e) => { e.preventDefault(); e.stopPropagation(); }, onMouseDown: (e) => { e.preventDefault(); e.stopPropagation(); }, onClick: (e) => e.stopPropagation() })] })] }) }));
372
+ onOpenChange(o, { reason: closeReasonOf(details.reason) });
373
+ }, snapPoints: points, snapPoint: point, snapToSequentialPoints: true, onSnapPointChange: (p, details) => {
374
+ if (p === null) {
375
+ release("closed", details.event?.timeStamp);
376
+ return;
377
+ }
378
+ if (!open || details.reason !== "swipe")
379
+ return;
380
+ release(offsetOf(p, popup.offsetHeight, viewport.clientHeight), details.event?.timeStamp);
381
+ moveTo(stopOf(p === mark ? "mark" : p, list));
382
+ }, children: _jsxs(Base.Portal, { container: container, children: [_jsx(Base.Backdrop, { ref: backdrop, forceRender: stacked, className: "o-sheet-backdrop", "data-stacked": stacked ? "" : undefined }), _jsxs(Base.Viewport, { ref: setViewport, className: "o-sheet-viewport", "data-sheet-form": form, onClick: standing ? (e) => { if (e.target === e.currentTarget) {
383
+ release("closed");
384
+ close("outside-press");
385
+ } } : undefined, children: [_jsx(Base.Popup, { ref: bindPopup, initialFocus: popupRef, finalFocus: finalFocus ? () => finalFocus() ?? true : undefined, className: cx("o-sheet o-smooth", className), "data-sheet-form": form, "aria-label": label, "data-slot": slot, "data-kit": "sheet", children: _jsxs("div", { className: "o-sheet-cut", children: [_jsx("div", { className: "o-sheet-handle", "aria-hidden": "true" }), _jsx(Standing.Provider, { value: standing, children: _jsx(Body.Provider, { value: body, children: _jsx(CloseAll.Provider, { value: closeAll, children: _jsx(OutOfFieldRows, { children: children }) }) }) })] }) }), coming && _jsx("div", { className: "o-sheet-shield", "aria-hidden": "true", "data-sheet-shield": "", onPointerDown: (e) => { e.preventDefault(); e.stopPropagation(); }, onMouseDown: (e) => { e.preventDefault(); e.stopPropagation(); }, onClick: (e) => e.stopPropagation() })] })] }) })] }));
379
386
  }
@@ -105,9 +105,11 @@
105
105
  row's box (the popover marked data-field-row-long-editor, field-row/editors/RowTextEditor.tsx), the popover its only frame. The
106
106
  box is the popover's whole content: no edge, ring or ground of its own, its words as far from its edge as the row's box holds
107
107
  them (--vk-field-row-box-h and -x, undeclared 32 and 8), so its first line stands where the row's words stood. It is as tall as its
108
- text up to the editor's most height (--vk-editor-max-h, the popover's own cap; undeclared, 320), then it scrolls. (0,5,0): over the
109
- row's place. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────── */
110
- .o-popover[data-field-row-long-editor] { --popover-pad: 0px; }
108
+ text up to the editor's most height (--vk-editor-max-h, the popover's own cap; undeclared, 320), then it scrolls. The popover's
109
+ corners are the row box's own, so nothing of the box shows round them (VK-1110): the box's rounded-md, or under the Field's Box
110
+ (data-field-row-long-editor="box") its corner, --vk-field-row-box-r (undeclared 8). (0,5,0): over the row's place. ──────────── */
111
+ .o-popover[data-field-row-long-editor] { --popover-pad: 0px; --popover-corners: var(--vk-radius-md); }
112
+ .o-popover[data-field-row-long-editor="box"] { --popover-corners: var(--vk-field-row-box-r, calc(var(--vk-spacing) * 2)); }
111
113
  [data-field-row-long-editor] .o-text-editor[data-text-place="row"][data-text-form="computer"] {
112
114
  --inline-input-row: var(--vk-field-row-box-h, calc(var(--vk-spacing) * 8)); --inline-input-edge: 0px; --inline-input-ring: 0px;
113
115
  }
@@ -50,9 +50,6 @@ import { VALUES_EDITOR_PRIVATE, VALUES_EDITOR_TOKENS } from "./values-editor/tok
50
50
  import { LINKS_EDITOR_PRIVATE, LINKS_EDITOR_TOKENS } from "./links-editor/tokens.js";
51
51
  import { PRESS_PRIVATE, PRESS_TOKENS } from "./press/tokens.js";
52
52
  import { CHOICE_PRIVATE, CHOICE_TOKENS } from "./choice/tokens.js";
53
- import { TAG_FIELD_PRIVATE, TAG_FIELD_TOKENS } from "./tag-field/tokens.js";
54
- import { SETTING_ROW_PRIVATE, SETTING_ROW_TOKENS } from "./setting-row/tokens.js";
55
- import { SWITCH_ROW_PRIVATE, SWITCH_ROW_TOKENS } from "./switch-row/tokens.js";
56
53
  const CONTROLS_OWN = {
57
54
  button: { tokens: BUTTON_TOKENS, private: BUTTON_PRIVATE },
58
55
  spinner: { tokens: SPINNER_TOKENS, private: SPINNER_PRIVATE },
@@ -106,9 +103,6 @@ const CONTROLS_OWN = {
106
103
  "links-editor": { tokens: LINKS_EDITOR_TOKENS, private: LINKS_EDITOR_PRIVATE },
107
104
  press: { tokens: PRESS_TOKENS, private: PRESS_PRIVATE },
108
105
  choice: { tokens: CHOICE_TOKENS, private: CHOICE_PRIVATE },
109
- "tag-field": { tokens: TAG_FIELD_TOKENS, private: TAG_FIELD_PRIVATE },
110
- "switch-row": { tokens: SWITCH_ROW_TOKENS, private: SWITCH_ROW_PRIVATE },
111
- "setting-row": { tokens: SETTING_ROW_TOKENS, private: SETTING_ROW_PRIVATE },
112
106
  };
113
107
  export const VK_CONTROL_TOKENS_BY_PIECE = Object.fromEntries(Object.entries(CONTROLS_OWN).map(([piece, own]) => [piece, own.tokens]));
114
108
  export const VK_CONTROL_TOKENS = Object.entries(VK_CONTROL_TOKENS_BY_PIECE)
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
- import { flushSync } from "react-dom";
5
4
  import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
5
+ import { beforePaint } from "../../internal/before-paint.js";
6
6
  import { cx as cn } from "../../internal/cx.js";
7
7
  import { ScreenForms } from "../../internal/screen-forms.js";
8
8
  import { Button, ButtonGroup } from "../button/button.js";
@@ -139,7 +139,7 @@ function useGiveWay(line, max, on, holds = false) {
139
139
  if (!line || !on)
140
140
  return;
141
141
  let width = -1;
142
- const again = () => flushSync(() => look(latest.current.stage, latest.current.max));
142
+ const again = () => beforePaint(() => look(latest.current.stage, latest.current.max));
143
143
  const sized = new ResizeObserver(([e]) => { const w = e.contentRect.width; if (w !== width) {
144
144
  width = w;
145
145
  again();
@@ -18,11 +18,14 @@ export function RowTextEditor({ field, binding, row, initial, anchor, onAttempt,
18
18
  const [over] = useState(() => long && longLine && desktop);
19
19
  const { onBody, ...opens } = useRowBodyPlace(anchorRef, { sideOffset: 4 }, { over: over ? "force" : "auto" });
20
20
  const [edge, setEdge] = useState();
21
+ const [inBox, setInBox] = useState(false);
21
22
  const onAnchor = useCallback((el) => {
22
23
  anchorRef.current = el;
23
24
  const box = el?.querySelector("[data-field-row-anchor]");
24
25
  if (!box)
25
26
  return;
27
+ if (box.closest('[data-field-row-box="box"]'))
28
+ setInBox(true);
26
29
  const s = getComputedStyle(box);
27
30
  const sides = [s.borderTopWidth, s.borderRightWidth, s.borderBottomWidth, s.borderLeftWidth];
28
31
  if (!sides.some((w) => parseFloat(w) > 0))
@@ -40,6 +43,6 @@ export function RowTextEditor({ field, binding, row, initial, anchor, onAttempt,
40
43
  return read.ok ? null : read.reason;
41
44
  };
42
45
  if (over)
43
- return (_jsxs(_Fragment, { children: [_jsx("span", { ref: onAnchor, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { session: session, title: field.label, anchor: anchorRef, align: "start", sideOffset: opens.sideOffset, alignOffset: opens.alignOffset, style: opens.style, initialFocus: false, panelData: { "data-field-row-long-editor": "" }, className: "z-90 max-w-[calc(100vw-2rem)]", children: _jsx("span", { ref: onBody, style: edge ? { display: "flex", flexDirection: "column", flex: "1 1 auto", minHeight: 0, ...edge } : { display: "contents" }, children: _jsx(TextEditorHost, { ref: editorRef, type: field.type, multiline: true, initial: baseline, label: field.label, closeOnBlur: false, onRequestClose: close, check: check, region: region, escapeKeeps: session.keeps ?? false, place: "row" }) }) })] }));
46
+ return (_jsxs(_Fragment, { children: [_jsx("span", { ref: onAnchor, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { session: session, title: field.label, anchor: anchorRef, align: "start", sideOffset: opens.sideOffset, alignOffset: opens.alignOffset, style: opens.style, initialFocus: false, panelData: { "data-field-row-long-editor": inBox ? "box" : "" }, className: "z-90 max-w-[calc(100vw-2rem)]", children: _jsx("span", { ref: onBody, style: edge ? { display: "flex", flexDirection: "column", flex: "1 1 auto", minHeight: 0, ...edge } : { display: "contents" }, children: _jsx(TextEditorHost, { ref: editorRef, type: field.type, multiline: true, initial: baseline, label: field.label, closeOnBlur: false, onRequestClose: close, check: check, region: region, escapeKeeps: session.keeps ?? false, place: "row" }) }) })] }));
44
47
  return (_jsxs(EditorPanel, { session: session, title: field.label, anchor: anchorRef, inPlace: true, children: [_jsx(TextEditorHost, { ref: editorRef, type: field.type, multiline: long, initial: baseline, label: field.label, onRequestClose: close, check: check, region: region, escapeKeeps: session.keeps ?? false, place: "row" }), _jsx(RowRefusal, { text: session.refusal })] }));
45
48
  }
@@ -0,0 +1,7 @@
1
+ import type { FieldConventions } from "viewkitjs/fields";
2
+ import { type DurationUnit } from "viewkitjs/fields/query";
3
+ /** A stored bound as its box shows it: `2m 30s`, never 150000 (or 150, on a column kept in seconds); nothing for none. */
4
+ export declare function durationDraft(value: number | null | undefined, unit: DurationUnit | undefined): string;
5
+ /** What is typed in a duration's box as the bound the rule keeps, in the column's unit: `90` and `1m 30s` are 90000 ms (90 in
6
+ * seconds); null for nothing, or what reads as no duration. */
7
+ export declare function durationBound(typed: string, unit: DurationUnit | undefined, cv?: FieldConventions): number | null;
@@ -0,0 +1,9 @@
1
+ import { formatDurationMs } from "viewkitjs/fields/format/time";
2
+ import { durationUnitToMs, msToDurationUnit, parseDurationInput } from "viewkitjs/fields/query";
3
+ export function durationDraft(value, unit) {
4
+ return value == null ? "" : formatDurationMs(durationUnitToMs(value, unit));
5
+ }
6
+ export function durationBound(typed, unit, cv) {
7
+ const ms = parseDurationInput(typed, cv);
8
+ return ms == null ? null : msToDurationUnit(ms, unit);
9
+ }