viewkitjs 0.36.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +75 -0
- package/package.json +1 -1
- package/views/dist/atoms/types.d.ts +32 -4
- package/views/dist/contract.d.ts +18 -9
- package/views/dist/contract.js +18 -1
- package/views/dist/controls/button/own-look-moved.d.ts +11 -0
- package/views/dist/controls/button/own-look-moved.js +3 -0
- package/views/dist/controls/date-editor/date-behaviour.d.ts +80 -0
- package/views/dist/controls/date-editor/date-behaviour.js +187 -0
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -2
- package/views/dist/controls/date-editor/date-editor.js +29 -166
- package/views/dist/controls/field/field.d.ts +3 -2
- package/views/dist/controls/field/field.js +7 -2
- package/views/dist/controls/field/looks.d.ts +1 -1
- package/views/dist/controls/field/looks.js +7 -4
- package/views/dist/controls/field.css +64 -1
- package/views/dist/controls/filter-editor/filter-editor.js +2 -2
- package/views/dist/controls/filter-editor/parts.d.ts +2 -0
- package/views/dist/controls/filter-editor/parts.js +1 -1
- package/views/dist/controls/glyphs/glyphs.js +2 -0
- package/views/dist/controls/index.d.ts +3 -1
- package/views/dist/controls/index.js +3 -1
- package/views/dist/controls/inline-input.css +10 -0
- package/views/dist/controls/internal/phone.d.ts +1 -1
- package/views/dist/controls/internal/phone.js +3 -2
- package/views/dist/controls/internal/read-token.d.ts +2 -1
- package/views/dist/controls/internal/read-token.js +2 -1
- package/views/dist/controls/list/tokens.d.ts +1 -1
- package/views/dist/controls/list/tokens.js +1 -1
- package/views/dist/controls/list.css +5 -2
- package/views/dist/controls/menu-list/menu-list.js +3 -2
- package/views/dist/controls/menu.css +4 -4
- package/views/dist/controls/number-editor/tokens.d.ts +8 -0
- package/views/dist/controls/number-editor/tokens.js +2 -0
- package/views/dist/controls/number-editor.css +20 -0
- package/views/dist/controls/pane.css +1 -1
- package/views/dist/controls/picker.css +5 -3
- package/views/dist/controls/popover/looks.d.ts +1 -1
- package/views/dist/controls/popover/looks.js +5 -0
- package/views/dist/controls/popover/tokens.d.ts +13 -1
- package/views/dist/controls/popover/tokens.js +4 -1
- package/views/dist/controls/popover.css +59 -8
- package/views/dist/controls/select/select.js +1 -1
- package/views/dist/controls/sort-editor.css +4 -2
- package/views/dist/controls/text-editor/tokens.d.ts +8 -0
- package/views/dist/controls/text-editor/tokens.js +2 -0
- package/views/dist/controls/text-editor.css +28 -0
- package/views/dist/controls/toolbar/toolbar.d.ts +4 -2
- package/views/dist/controls/toolbar/toolbar.js +7 -2
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +1 -1
- package/views/dist/controls/toolbar.css +5 -0
- package/views/dist/controls/tooltip/tokens.d.ts +1 -1
- package/views/dist/controls/tooltip/tokens.js +1 -1
- package/views/dist/controls/tooltip/tooltip.js +2 -1
- package/views/dist/controls/tooltip.css +5 -3
- package/views/dist/controls/values-editor.css +20 -5
- package/views/dist/display/entity-chip.d.ts +7 -1
- package/views/dist/display/entity-chip.js +2 -1
- package/views/dist/field-row/FieldRow.js +25 -12
- package/views/dist/field-row/field-row-button.d.ts +12 -0
- package/views/dist/field-row/field-row-button.js +5 -0
- package/views/dist/fields/binding.d.ts +4 -0
- package/views/dist/grid/chrome/GridCellEditors.d.ts +4 -1
- package/views/dist/grid/chrome/GridCellEditors.js +3 -2
- package/views/dist/grid/chrome/GridCellOutline.d.ts +15 -5
- package/views/dist/grid/chrome/GridCellOutline.js +20 -5
- package/views/dist/grid/chrome/GridChipsEditor.js +1 -1
- package/views/dist/grid/chrome/GridDateEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridDateEditor.js +1 -1
- package/views/dist/grid/chrome/GridLongTextEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridLongTextEditor.js +8 -5
- package/views/dist/grid/chrome/GridNameEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridNameEditor.js +1 -1
- package/views/dist/grid/chrome/GridNumberEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridNumberEditor.js +3 -2
- package/views/dist/grid/chrome/GridPlaceEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridPlaceEditor.js +1 -1
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +2 -2
- package/views/dist/grid/chrome/GridRangeEditor.js +1 -1
- package/views/dist/grid/chrome/GridRelationEditor.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +6 -5
- package/views/dist/grid/chrome/GridSelectEditor.js +1 -1
- package/views/dist/grid/chrome/GridStructure.js +3 -3
- package/views/dist/grid/chrome/GridTable.d.ts +2 -1
- package/views/dist/grid/chrome/GridTable.js +7 -2
- package/views/dist/grid/chrome/GridTextEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridTextEditor.js +4 -2
- package/views/dist/grid/chrome/GridValueListEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridValueListEditor.js +1 -1
- package/views/dist/grid/chrome/grid-body-place.d.ts +7 -2
- package/views/dist/grid/chrome/grid-body-place.js +9 -4
- package/views/dist/grid/chrome/grid-cell-classes.js +2 -2
- package/views/dist/grid/chrome/grid-edit-session.d.ts +8 -0
- package/views/dist/grid/chrome/grid-edit-session.js +21 -3
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +11 -0
- package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
- package/views/dist/grid/chrome/grid-fitted-box.d.ts +4 -4
- package/views/dist/grid/chrome/grid-fitted-box.js +1 -3
- package/views/dist/grid/chrome/grid-hover.d.ts +3 -3
- package/views/dist/grid/chrome/grid-hover.js +2 -3
- package/views/dist/grid/chrome/grid-row-props.d.ts +6 -2
- package/views/dist/grid/chrome/grid-styles.d.ts +1 -5
- package/views/dist/grid/chrome/grid-styles.js +0 -1
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +5 -2
- package/views/dist/grid/chrome/useGridKeyboard.js +11 -15
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +3 -1
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +30 -2
- package/views/dist/grid/core/useGridEditing.d.ts +3 -0
- package/views/dist/grid/core/useGridEditing.js +2 -0
- package/views/dist/grid/grid.css +4 -19
- package/views/dist/internal/length.d.ts +2 -0
- package/views/dist/internal/length.js +16 -0
- package/views/dist/internal/screen-forms.d.ts +11 -0
- package/views/dist/internal/screen-forms.js +31 -0
- package/views/dist/list/list.js +2 -1
- package/views/dist/list/parts.d.ts +8 -2
- package/views/dist/list/parts.js +31 -7
- package/views/dist/list/toolbar.js +7 -3
- package/views/dist/looks/index.d.ts +1 -0
- package/views/dist/looks/index.js +1 -0
- package/views/dist/panels/react/popover.d.ts +3 -1
- package/views/dist/panels/react/popover.js +2 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +6 -3
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +12 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +5 -1
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarButton.js +3 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -3
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +28 -20
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/context.d.ts +3 -2
- package/views/dist/panels/react/views-row/FoldingViewRow.js +24 -7
- package/views/dist/panels/react/views-row/ViewPicker.js +1 -1
- package/views/dist/panels/react/views-row/more-views.d.ts +2 -0
- package/views/dist/panels/react/views-row/more-views.js +3 -0
- package/views/dist/panels/react.d.ts +1 -1
- package/views/dist/panels/toolbar/model.d.ts +2 -2
- package/views/dist/provider/components.d.ts +8 -7
- package/views/dist/provider/desktop.d.ts +2 -1
- package/views/dist/provider/desktop.js +5 -2
- package/views/dist/selection/bar-overflow.d.ts +2 -0
- package/views/dist/selection/bar-overflow.js +2 -1
- package/views/dist/selection/bar-props.d.ts +1 -1
- package/views/dist/selection/verbs.d.ts +2 -2
- package/views/dist/styles.css +341 -80
- package/views/dist/styles.unlayered.css +341 -80
- package/views/docs/contract.md +77 -23
- package/views/docs/controls/list.md +2 -0
- package/views/docs/controls/menu.md +2 -0
- package/views/docs/controls/number-editor.md +2 -0
- package/views/docs/controls/picker.md +2 -0
- package/views/docs/controls/popover.md +7 -0
- package/views/docs/controls/text-editor.md +2 -0
- package/views/docs/controls/tooltip.md +2 -0
- package/views/docs/guides/atoms.md +11 -10
- package/views/docs/guides/selection.md +1 -1
- package/views/docs/guides/the-grid.md +7 -5
- package/views/docs/guides/the-provider.md +2 -2
- package/views/docs/reference/controls.md +11 -6
- package/views/docs/reference/display.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/list.md +5 -6
- package/views/docs/reference/looks.md +4 -1
- package/views/docs/reference/panels-react.md +5 -4
- package/views/docs/reference/panels.md +1 -1
- package/views/docs/reference/react.md +6 -6
- package/views/docs/reference/selection.md +1 -1
- package/views/docs/reference/views.md +3 -3
- package/views/docs/reshaping.md +2 -2
- 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,
|
|
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 {
|
|
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
|
|
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
|
|
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
|
|
96
|
-
const
|
|
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
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
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:
|
|
189
|
-
|
|
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(
|
|
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:
|
|
201
|
-
|
|
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:
|
|
207
|
-
|
|
208
|
-
|
|
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:
|
|
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
|
|
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,
|
|
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),
|
|
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
|
-
|
|
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: () => {
|
|
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: () => {
|
|
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
|
-
|
|
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 {
|
|
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(
|
|
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" | "row-box" | "row-action";
|
|
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,22 @@ 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" }] },
|
|
8
|
+
{ id: "row-box", name: "Box", def: "target", device: "desktop", demo: false, values: [{ id: "target", name: "Target" }, { id: "box", name: "Box" }] },
|
|
9
|
+
{ id: "row-action", name: "Action", def: "none", device: "desktop", demo: false, values: [{ id: "none", name: "None" }, { id: "icon", name: "Icon" }] },
|
|
7
10
|
];
|
|
8
11
|
export const FIELD_LOOKS = {
|
|
9
12
|
id: "field",
|
|
10
13
|
name: "Field",
|
|
11
14
|
options,
|
|
12
15
|
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" } },
|
|
16
|
+
{ 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", "row-box": "target", "row-action": "none" } },
|
|
17
|
+
{ 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", "row-box": "target", "row-action": "none" } },
|
|
18
|
+
{ 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", "row-box": "target", "row-action": "none" } },
|
|
16
19
|
],
|
|
17
20
|
};
|
|
18
21
|
const known = (o, v) => (v && o.values.some((x) => x.id === v) ? v : o.def);
|
|
19
22
|
export function fieldRowsAttrs(look) {
|
|
20
23
|
const picks = look;
|
|
21
|
-
return Object.fromEntries(options.map((o) => [`data-field-${o.id}`, known(o, picks[o.id.slice("rows-".length)])]));
|
|
24
|
+
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
25
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
fields, and a field beside its label, as shadcn's Field draws them, on public names. A field's label and a group's
|
|
3
3
|
legend (which reads as one) are both .o-field-label; a field's label can be quiet instead.
|
|
4
4
|
|
|
5
|
-
The rules sit in the components layer, so a utility class still wins
|
|
5
|
+
The rules sit in the components layer, so a utility class still wins, but for the Field's Box's and the Field's Action's
|
|
6
|
+
geometry, which is !important (the Box's section says why). */
|
|
6
7
|
@layer components {
|
|
7
8
|
|
|
8
9
|
/* ── A field: its label, then its control, then its note or its error ──────────────────────────────── */
|
|
@@ -114,4 +115,66 @@ button.o-field-row { cursor: pointer; }
|
|
|
114
115
|
.o-field-rows-slot + .o-field-rows-slot::before { content: " "; }
|
|
115
116
|
.o-field-rows-slot > .o-field-error { color: var(--vk-danger); }
|
|
116
117
|
.o-field-rows-foot:has(.o-field-error) .o-field-note { display: none; }
|
|
118
|
+
/* ── The Field's Box (row-box: box, looks.ts; data-field-row-box="box" on a frame round the rows): a record's field row outside a
|
|
119
|
+
card (data-field-row, field-row/FieldRow.tsx) draws one rectangle for its hover, its press, its in-place input and the value
|
|
120
|
+
an open picker keeps in its place, so its words never move and it keeps its height. The row reads the app's three names
|
|
121
|
+
(--vk-field-row-box-h, -x, -r; undeclared 32, 8 and 8) into its own, and how far the box stands above and below its one 20px
|
|
122
|
+
line (y). Its target (the app's Button, data-key="vk-field-row-target", -beside beside a link's action, -under under a rich text;
|
|
123
|
+
and data-field-row-anchor, the value an open picker keeps in its place) stands where it stood, pulled out by that reach and
|
|
124
|
+
that y, as tall as the box, no edge of its own (the words stand x from the box's edge whatever the app's Button draws), its
|
|
125
|
+
corner, no press. The
|
|
126
|
+
in-place text and number editors read the same names round data-field-row-editor (text-editor.css, number-editor.css). Below
|
|
127
|
+
the desktop line the gap under the label is y, so the box meets the label's line without covering it. Its geometry is
|
|
128
|
+
!important: the row's own classes are Tailwind's, and an app that compiles them into its own utilities layer (Tailwind's source scanning), or
|
|
129
|
+
whose own Tailwind writes the same names, puts them in a later layer, which no specificity here would outweigh. Nothing of it
|
|
130
|
+
applies without the attribute. ──────────────────────────────────────────────────────────────────────────────────────── */
|
|
131
|
+
:where([data-field-row-box="box"]) [data-field-row] {
|
|
132
|
+
--field-row-box-h: var(--vk-field-row-box-h, calc(var(--vk-spacing) * 8));
|
|
133
|
+
--field-row-box-x: var(--vk-field-row-box-x, calc(var(--vk-spacing) * 2));
|
|
134
|
+
--field-row-box-r: var(--vk-field-row-box-r, calc(var(--vk-spacing) * 2));
|
|
135
|
+
--field-row-box-y: calc((var(--field-row-box-h) - var(--vk-spacing) * 5) / 2);
|
|
136
|
+
}
|
|
137
|
+
:where([data-field-row-box="box"]) [data-field-row][data-form="phone"] { row-gap: var(--field-row-box-y) !important; }
|
|
138
|
+
:where([data-field-row-box="box"]) :is([data-key="vk-field-row-target"], [data-key="vk-field-row-beside"], [data-key="vk-field-row-under"], [data-field-row-anchor]) {
|
|
139
|
+
box-sizing: border-box !important; min-height: var(--field-row-box-h) !important;
|
|
140
|
+
padding: var(--field-row-box-y) var(--field-row-box-x) !important;
|
|
141
|
+
margin: calc(var(--field-row-box-y) * -1) calc(var(--field-row-box-x) * -1) !important;
|
|
142
|
+
width: calc(100% + var(--field-row-box-x) * 2) !important;
|
|
143
|
+
border-width: 0 !important; border-radius: var(--field-row-box-r) !important; --button-r: var(--field-row-box-r); --vk-press-scale: 1;
|
|
144
|
+
}
|
|
145
|
+
/* Beside a link's open action: its left edge only, the action keeping its place. */
|
|
146
|
+
:where([data-field-row-box="box"]) [data-key="vk-field-row-beside"] { margin-right: 0 !important; width: auto !important; }
|
|
147
|
+
/* Under a rich text: laid over the value's footprint, pulled out by the box's reach and its y. */
|
|
148
|
+
:where([data-field-row-box="box"]) [data-key="vk-field-row-under"] {
|
|
149
|
+
inset: calc(var(--field-row-box-y) * -1) calc(var(--field-row-box-x) * -1) !important; margin: 0 !important; padding: 0 !important;
|
|
150
|
+
width: auto !important; min-height: 0 !important;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* ── The Field's Action (row-action: icon, looks.ts; data-field-row-action="icon" on a frame round the rows): a record's field row
|
|
154
|
+
outside a card shows one icon at its box's right end, on the box's hover and keyboard focus, saying what a click does. The row
|
|
155
|
+
draws it inside its target and inside the value an open picker keeps in its place (data-field-row-act: edit or expand, none
|
|
156
|
+
drawn where the box is the input; field-row/FieldRow.tsx), hidden by its class until this lays it out: 24 square, 4 in from the
|
|
157
|
+
box's end, centred on the value's first line (the box's y above it, or the target's 4), its glyph 15. The box keeps the icon's
|
|
158
|
+
room at its end (32, the icon and 4 either side), so the value ends there, cut with its "…" where it can't wrap, its label
|
|
159
|
+
allowed to shrink to the box; the words laid over a rich text's empty target keep the same room. It stands, never moving the
|
|
160
|
+
words, so the box draws the same rectangle at rest, hovered, pressed and while a picker is open, where it stays hidden. As the
|
|
161
|
+
box's, the geometry is !important: the frame's classes are Tailwind's (the Field's Box, above, says why). ───────────────── */
|
|
162
|
+
:where([data-field-row-action="icon"]) [data-field-row] :is([data-key="vk-field-row-target"], [data-key="vk-field-row-beside"], [data-field-row-anchor]):has([data-field-row-act]) {
|
|
163
|
+
position: relative; padding-right: calc(var(--vk-spacing) * 8) !important;
|
|
164
|
+
}
|
|
165
|
+
:where([data-field-row-action="icon"]) [data-field-row] :is([data-key="vk-field-row-target"], [data-key="vk-field-row-beside"], [data-field-row-anchor]):has([data-field-row-act]) > * { min-width: 0; }
|
|
166
|
+
:where([data-field-row-action="icon"]) [data-field-row] [data-key="vk-field-row-under"]:has([data-field-row-act]) + [data-slot="vk-row-value-layer"] {
|
|
167
|
+
padding-right: calc(var(--vk-spacing) * 8 - var(--field-row-box-x, var(--vk-spacing) * 2));
|
|
168
|
+
}
|
|
169
|
+
:where([data-field-row-action="icon"]) [data-field-row] [data-field-row-act] {
|
|
170
|
+
display: grid !important; place-items: center; position: absolute; right: var(--vk-spacing);
|
|
171
|
+
top: calc(var(--field-row-box-y, var(--vk-spacing)) + var(--vk-spacing) * 2.5); translate: 0 -50%;
|
|
172
|
+
width: calc(var(--vk-spacing) * 6); height: calc(var(--vk-spacing) * 6); color: var(--vk-fg-subtle); pointer-events: none; visibility: hidden;
|
|
173
|
+
}
|
|
174
|
+
:where([data-field-row-action="icon"]) [data-field-row] :is([data-key="vk-field-row-target"], [data-key="vk-field-row-beside"], [data-key="vk-field-row-under"]):is(:hover, :focus-visible) [data-field-row-act] { visibility: visible; }
|
|
175
|
+
|
|
176
|
+
/* A phone's first paint: server-rendered, Field rows' card stands twice, the phone's form and the computer's (`ScreenForms`,
|
|
177
|
+
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
|
|
178
|
+
that imports this card's stylesheet alone, on a page whose policy refuses an inline style. Kept on one line, as screenFormsCss writes it. */
|
|
179
|
+
[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
180
|
}
|
|
@@ -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();
|
|
@@ -64,6 +64,7 @@ const IconCheck = glyph(["M5 12l5 5l10 -10"]);
|
|
|
64
64
|
const IconAlertTriangle = glyph(["M12 9v4", "M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0", "M12 16h.01"]);
|
|
65
65
|
const IconGripVertical = glyph(["M8 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M8 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M14 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M14 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"]);
|
|
66
66
|
const IconArrowUpRight = glyph(["M17 7l-10 10", "M8 7l9 0l0 9"]);
|
|
67
|
+
const IconArrowsDiagonal = glyph(["M16 4l4 0l0 4", "M14 10l6 -6", "M8 20l-4 0l0 -4", "M4 20l6 -6"]);
|
|
67
68
|
const IconSquareCheck = glyph(["M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14", "M9 12l2 2l4 -4"]);
|
|
68
69
|
const IconChevronDown = glyph(["M6 9l6 6l6 -6"]);
|
|
69
70
|
const IconChevronRight = glyph(["M9 6l6 6l-6 6"]);
|
|
@@ -131,6 +132,7 @@ export const CONTROL_ICONS = {
|
|
|
131
132
|
drag: IconGripVertical,
|
|
132
133
|
resize: IconArrowsHorizontal,
|
|
133
134
|
open: IconArrowUpRight,
|
|
135
|
+
expand: IconArrowsDiagonal,
|
|
134
136
|
selectRow: IconSquareCheck,
|
|
135
137
|
chevronDown: IconChevronDown,
|
|
136
138
|
chevronRight: IconChevronRight,
|
|
@@ -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,16 @@
|
|
|
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: the cell itself ────────────────────────────────────────────────────────────────────────────────────
|
|
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 of its own, whatever a frame picks, so the cell shows as it was, the grid's own selected
|
|
48
|
+
ring round it (the grid draws that ring on the box). Grown past its cell (data-grown, on
|
|
49
|
+
the body or the box that fits it), it takes the plain ground, so the values it stands over don't show through. */
|
|
50
|
+
[data-inline-input-place="cell"] { --inline-input-edge: 0px; --inline-input-ring: 0px; --inline-input-ground: transparent; }
|
|
51
|
+
[data-inline-input-place="cell"] [data-grown] { --inline-input-ground: var(--vk-overlay); }
|
|
52
|
+
/* Refused there, it takes its ring back, red, so the box says what the line under it explains. */
|
|
53
|
+
[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); }
|
|
54
|
+
|
|
45
55
|
/* ── The box ──────────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
46
56
|
.o-inline-input.o-inline-input {
|
|
47
57
|
--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. */
|