@tristan2828/ui-foundation 4.87.0 → 4.89.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/README.md +1 -1
- package/conventions/docs/add-an-entity.md +38 -23
- package/conventions/docs/cell-patterns.md +49 -24
- package/conventions/docs/design-language.md +97 -31
- package/dist/components/app/choice-buttons.d.ts +25 -0
- package/dist/components/app/choice-buttons.js +17 -0
- package/dist/components/app/date-field.d.ts +28 -9
- package/dist/components/app/date-field.js +103 -10
- package/dist/components/app/edit-in-place-controls.d.ts +1 -3
- package/dist/components/app/edit-in-place-controls.js +4 -58
- package/dist/components/app/edit-in-place-presets.d.ts +38 -4
- package/dist/components/app/edit-in-place-presets.js +48 -27
- package/dist/components/app/edit-row.d.ts +7 -0
- package/dist/components/app/edit-row.js +23 -0
- package/dist/components/app/editable-value.d.ts +8 -1
- package/dist/components/app/editable-value.js +36 -4
- package/dist/components/app/entity-view.js +5 -1
- package/dist/components/app/multi-pick.d.ts +8 -1
- package/dist/components/app/multi-pick.js +19 -5
- package/dist/components/app/multi-reference.d.ts +8 -1
- package/dist/components/app/multi-reference.js +44 -6
- package/dist/components/app/overview-page.d.ts +44 -0
- package/dist/components/app/overview-page.js +63 -0
- package/dist/components/app/reference-combobox.d.ts +37 -0
- package/dist/components/app/reference-combobox.js +96 -0
- package/dist/components/app/widget-card.d.ts +15 -2
- package/dist/components/app/widget-card.js +15 -4
- package/dist/components/ui/field.d.ts +2 -2
- package/dist/components/ui/field.js +2 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/dist/lib/names-record.d.ts +4 -0
- package/dist/lib/names-record.js +7 -0
- package/dist/lib/plain-date.d.ts +20 -0
- package/dist/lib/plain-date.js +72 -0
- package/package.json +1 -1
|
@@ -4,19 +4,111 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
// not set, and it's read as a calendar day, never an instant: nothing here
|
|
5
5
|
// goes through the browser's time zone, so Sep 2 is Sep 2 everywhere.
|
|
6
6
|
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
|
|
7
|
+
// Typed (the default, 4.88's F12): a box that reads "3/14", "Mar 14",
|
|
8
|
+
// "2026-03-14" or "today" (`parsePlainDate`), with the package's Calendar
|
|
9
|
+
// on its button. Something it can't read says "Try a date like 3/14 or
|
|
10
|
+
// Mar 14" under the box once it's left, and gives `''`, so a form never
|
|
11
|
+
// keeps the day it had before. `typing={false}` is the button alone,
|
|
12
|
+
// opening the calendar in a Popover. One control for the form (a
|
|
13
|
+
// react-hook-form `Controller`) and for editing in place (`inPlace.date`).
|
|
14
|
+
// `clearable` adds Clear to the calendar for an optional field. Either way
|
|
15
|
+
// the control carries `data-kind="date"`, so two dates keep sharing a row
|
|
16
|
+
// on a phone without their Field saying `kind="date"`.
|
|
17
|
+
import { useId, useRef, useState } from 'react';
|
|
13
18
|
import { CalendarIcon } from 'lucide-react';
|
|
14
19
|
import { cn } from 'cn';
|
|
15
20
|
import { Button } from '../ui/button.js';
|
|
16
21
|
import { Calendar } from '../ui/calendar.js';
|
|
22
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from '../ui/input-group.js';
|
|
17
23
|
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover.js';
|
|
18
|
-
import { formatPlainDate, localToPlainDate, plainDateToLocal } from '../../lib/plain-date.js';
|
|
19
|
-
export function DateField({
|
|
24
|
+
import { formatPlainDate, localToPlainDate, parsePlainDate, plainDateExamples, plainDateToLocal, unreadableDateMessage, } from '../../lib/plain-date.js';
|
|
25
|
+
export function DateField({ typing = true, onProblem, ...props }) {
|
|
26
|
+
return typing ? _jsx(TypedDate, { ...props, onProblem: onProblem }) : _jsx(DateButton, { ...props });
|
|
27
|
+
}
|
|
28
|
+
function TypedDate({ id, value, onChange, onPick, onProblem, placeholder, clearable = false, invalid = false, readOnly = false, defaultOpen = false, modal, onOpenChange, format, locale, className, 'aria-describedby': describedBy, ...aria }) {
|
|
29
|
+
const messageId = useId();
|
|
30
|
+
const [open, setOpen] = useState(defaultOpen && !readOnly);
|
|
31
|
+
const box = useRef(null);
|
|
32
|
+
const group = useRef(null);
|
|
33
|
+
const popup = useRef(null);
|
|
34
|
+
const shown = (day) => formatPlainDate(day, format, locale);
|
|
35
|
+
const [text, setText] = useState(() => shown(value));
|
|
36
|
+
// What's typed can't be read: its message, shown once the box is left (or on Enter).
|
|
37
|
+
const [problem, setProblem] = useState(null);
|
|
38
|
+
const [told, setTold] = useState(false);
|
|
39
|
+
// The value this box last gave. Any other came from outside (the record
|
|
40
|
+
// saved elsewhere, a reset form) and replaces what's typed.
|
|
41
|
+
const [given, setGiven] = useState(value);
|
|
42
|
+
if (value !== given) {
|
|
43
|
+
setGiven(value);
|
|
44
|
+
setText(shown(value));
|
|
45
|
+
setProblem(null);
|
|
46
|
+
setTold(false);
|
|
47
|
+
}
|
|
48
|
+
const report = (next) => {
|
|
49
|
+
if (next !== problem)
|
|
50
|
+
onProblem?.(next);
|
|
51
|
+
setProblem(next);
|
|
52
|
+
};
|
|
53
|
+
const give = (day) => {
|
|
54
|
+
setGiven(day);
|
|
55
|
+
if (day !== value)
|
|
56
|
+
onChange(day);
|
|
57
|
+
};
|
|
58
|
+
const type = (typed) => {
|
|
59
|
+
setText(typed);
|
|
60
|
+
setTold(false);
|
|
61
|
+
const day = parsePlainDate(typed, { locale });
|
|
62
|
+
if (day === null) {
|
|
63
|
+
report(unreadableDateMessage(locale));
|
|
64
|
+
give('');
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
report(null);
|
|
68
|
+
give(day);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
// Leaving the box (or Enter): a day it read reads back the way it's shown.
|
|
72
|
+
const settle = () => {
|
|
73
|
+
if (problem)
|
|
74
|
+
setTold(true);
|
|
75
|
+
else
|
|
76
|
+
setText(shown(given));
|
|
77
|
+
};
|
|
78
|
+
const changeOpen = (next) => {
|
|
79
|
+
if (next && readOnly)
|
|
80
|
+
return;
|
|
81
|
+
setOpen(next);
|
|
82
|
+
onOpenChange?.(next);
|
|
83
|
+
};
|
|
84
|
+
const pick = (day) => {
|
|
85
|
+
setGiven(day);
|
|
86
|
+
setText(shown(day));
|
|
87
|
+
report(null);
|
|
88
|
+
setTold(false);
|
|
89
|
+
changeOpen(false);
|
|
90
|
+
(onPick ?? onChange)(day);
|
|
91
|
+
};
|
|
92
|
+
const onKeyDown = (event) => {
|
|
93
|
+
if (event.key === 'Enter')
|
|
94
|
+
settle();
|
|
95
|
+
// Alt+Down opens the calendar, as it opens a select's list.
|
|
96
|
+
if (event.key === 'ArrowDown' && event.altKey) {
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
changeOpen(true);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const selected = plainDateToLocal(given);
|
|
102
|
+
const showProblem = told && problem !== null;
|
|
103
|
+
return (_jsxs("div", { "data-slot": "date-field", "data-kind": "date", className: cn('flex w-full min-w-0 flex-col gap-1.5', className), children: [_jsxs(InputGroup, { ref: group, children: [_jsx(InputGroupInput, { ref: box, id: id, value: text, onChange: (event) => type(event.target.value), onBlur: settle, onKeyDown: onKeyDown, placeholder: placeholder ?? plainDateExamples(locale), readOnly: readOnly, autoComplete: "off", "aria-invalid": invalid || showProblem || undefined, "aria-describedby": [showProblem ? messageId : null, describedBy].filter(Boolean).join(' ') || undefined, ...aria }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsxs(Popover, { open: open, onOpenChange: changeOpen, modal: modal, children: [_jsx(PopoverTrigger, { render: _jsx(InputGroupButton, { type: "button", size: "icon-xs", variant: "ghost", disabled: readOnly, "aria-label": "Open calendar" }), children: _jsx(CalendarIcon, { "aria-hidden": "true" }) }), _jsxs(PopoverContent, { ref: popup, anchor: group, align: "start", className: "w-auto p-0", "data-slot": "date-field-calendar",
|
|
104
|
+
// The day the keyboard starts from (the chosen one, else today).
|
|
105
|
+
initialFocus: () => popup.current?.querySelector('button[data-day][tabindex="0"]') ?? true,
|
|
106
|
+
// Back to the box, where typing goes on.
|
|
107
|
+
finalFocus: box, children: [_jsx(Calendar, { mode: "single",
|
|
108
|
+
// Picking the chosen day again keeps it (and closes), never unsets it: Clear does that.
|
|
109
|
+
required: true, selected: selected, defaultMonth: selected, onSelect: (date) => pick(localToPlainDate(date)) }), clearable && given && (_jsx("div", { className: "border-t border-border p-2", children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "w-full", onClick: () => pick(''), children: "Clear" }) }))] })] }) })] }), showProblem && (_jsx("p", { id: messageId, "data-slot": "date-field-problem", className: "type-caption text-destructive-text", children: problem }))] }));
|
|
110
|
+
}
|
|
111
|
+
function DateButton({ id, value, onChange, onPick, placeholder = 'Pick a date', clearable = false, invalid = false, readOnly = false, defaultOpen = false, modal, onOpenChange, format, locale, className, ...aria }) {
|
|
20
112
|
const [open, setOpen] = useState(defaultOpen && !readOnly);
|
|
21
113
|
const popup = useRef(null);
|
|
22
114
|
const selected = plainDateToLocal(value);
|
|
@@ -28,10 +120,11 @@ export function DateField({ id, value, onChange, placeholder = 'Pick a date', cl
|
|
|
28
120
|
onOpenChange?.(next);
|
|
29
121
|
};
|
|
30
122
|
const pick = (next) => {
|
|
31
|
-
|
|
123
|
+
;
|
|
124
|
+
(onPick ?? onChange)(next);
|
|
32
125
|
changeOpen(false);
|
|
33
126
|
};
|
|
34
|
-
return (_jsxs(Popover, { open: open, onOpenChange: changeOpen, modal: modal, children: [_jsxs(PopoverTrigger, { render: _jsx(Button, { id: id, type: "button", variant: "outline", "aria-invalid": invalid || undefined, "aria-readonly": readOnly || undefined, className: cn('w-full justify-start font-normal', !shown && 'text-muted-foreground', className), ...aria }), children: [_jsx(CalendarIcon, { "aria-hidden": "true", className: "size-4" }), shown || placeholder] }), _jsxs(PopoverContent, { ref: popup, className: "w-auto p-0", "data-slot": "date-field-calendar",
|
|
127
|
+
return (_jsxs(Popover, { open: open, onOpenChange: changeOpen, modal: modal, children: [_jsxs(PopoverTrigger, { render: _jsx(Button, { id: id, type: "button", variant: "outline", "data-kind": "date", "aria-invalid": invalid || undefined, "aria-readonly": readOnly || undefined, className: cn('w-full justify-start font-normal', !shown && 'text-muted-foreground', className), ...aria }), children: [_jsx(CalendarIcon, { "aria-hidden": "true", className: "size-4" }), shown || placeholder] }), _jsxs(PopoverContent, { ref: popup, className: "w-auto p-0", "data-slot": "date-field-calendar",
|
|
35
128
|
// The day the keyboard starts from (the chosen one, else today):
|
|
36
129
|
// the one day react-day-picker makes tabbable. The popup would
|
|
37
130
|
// otherwise take focus itself, past the Calendar's autoFocus.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
2
|
import type { EditControlProps, EditKind } from './edit-in-place.js';
|
|
3
3
|
import type { InPlacePart, InPlaceReferenceConfig } from './edit-in-place-presets.js';
|
|
4
4
|
export type Checked<TValue> = {
|
|
@@ -16,8 +16,6 @@ export type Kind<TValue, TDraft> = {
|
|
|
16
16
|
control: (props: EditControlProps<TDraft>, alone: boolean) => ReactNode;
|
|
17
17
|
};
|
|
18
18
|
export type AnyKind = Kind<any, any>;
|
|
19
|
-
/** A select's and a combobox's items are strings: the option's position, or this for "Not set". */
|
|
20
|
-
export declare const NONE = "none";
|
|
21
19
|
type ReferencePickerProps<Id extends string | number> = {
|
|
22
20
|
props: EditControlProps<Id | null>;
|
|
23
21
|
alone: boolean;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// The controls behind the `inPlace` presets that hold state or lay out
|
|
3
|
-
// several parts (edit-in-place-presets.tsx), kept in a file of their own
|
|
4
|
-
// so the presets' file exports no components.
|
|
5
|
-
import { useEffect, useRef, useState } from 'react';
|
|
6
|
-
import { Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList } from '../ui/combobox.js';
|
|
7
2
|
import { FieldError } from '../ui/field.js';
|
|
8
|
-
|
|
9
|
-
export const NONE = 'none';
|
|
3
|
+
import { ReferenceCombobox } from './reference-combobox.js';
|
|
10
4
|
function controlAria(props) {
|
|
11
5
|
return {
|
|
12
6
|
'aria-label': props.label,
|
|
@@ -14,58 +8,10 @@ function controlAria(props) {
|
|
|
14
8
|
'aria-invalid': props.invalid || undefined,
|
|
15
9
|
};
|
|
16
10
|
}
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
// The reference's combobox: what's typed searches (through the app's
|
|
20
|
-
// `search`), a pick is the record's id. Names come from the searches and
|
|
21
|
-
// from the saved record's `label`, so a pick the current search no longer
|
|
22
|
-
// returns still shows its name.
|
|
11
|
+
// The reference's combobox (ReferenceCombobox, the form's): alone, its
|
|
12
|
+
// list opens with the field and a pick (or a record created from it) saves.
|
|
23
13
|
export function ReferencePicker({ props, alone, config }) {
|
|
24
|
-
|
|
25
|
-
const [found, setFound] = useState([]);
|
|
26
|
-
const [names] = useState(() => new Map());
|
|
27
|
-
if (props.value != null && config.label !== undefined && !names.has(String(props.value)))
|
|
28
|
-
names.set(String(props.value), { id: props.value, label: config.label });
|
|
29
|
-
for (const record of found)
|
|
30
|
-
names.set(String(record.id), record);
|
|
31
|
-
// The search is the app's, often a new function each render: the
|
|
32
|
-
// latest is called, and only what's typed starts a search.
|
|
33
|
-
const search = useRef(config.search);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
search.current = config.search;
|
|
36
|
-
});
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
let live = true;
|
|
39
|
-
const timer = setTimeout(() => {
|
|
40
|
-
search.current(text).then((records) => {
|
|
41
|
-
if (live)
|
|
42
|
-
setFound(records);
|
|
43
|
-
}, () => {
|
|
44
|
-
if (live)
|
|
45
|
-
setFound([]);
|
|
46
|
-
});
|
|
47
|
-
}, text === '' ? 0 : SEARCH_DELAY_MS);
|
|
48
|
-
return () => {
|
|
49
|
-
live = false;
|
|
50
|
-
clearTimeout(timer);
|
|
51
|
-
};
|
|
52
|
-
}, [text]);
|
|
53
|
-
const picked = props.value == null ? null : String(props.value);
|
|
54
|
-
const items = [...(config.required ? [] : [NONE]), ...found.map((record) => String(record.id))];
|
|
55
|
-
const emptyLabel = config.emptyLabel ?? 'Not set';
|
|
56
|
-
const nameOf = (key) => (key === NONE ? '' : (names.get(key)?.label ?? ''));
|
|
57
|
-
return (_jsxs(Combobox, { items: items, value: picked, onValueChange: (key) => {
|
|
58
|
-
if (key == null)
|
|
59
|
-
return;
|
|
60
|
-
const id = key === NONE ? null : (names.get(key)?.id ?? null);
|
|
61
|
-
if (alone)
|
|
62
|
-
props.commit(id);
|
|
63
|
-
else
|
|
64
|
-
props.onChange(id);
|
|
65
|
-
},
|
|
66
|
-
// The box showing the pick's own name is no search: the list then
|
|
67
|
-
// offers everything, not only the one already picked.
|
|
68
|
-
onInputValueChange: (typed) => setText(picked !== null && typed === nameOf(picked) ? '' : typed), itemToStringLabel: nameOf, filter: null, readOnly: props.disabled, defaultOpen: alone, children: [_jsx(ComboboxInput, { id: props.id, placeholder: config.placeholder ?? 'Search', ...controlAria(props) }), _jsxs(ComboboxContent, { children: [_jsx(ComboboxEmpty, { children: config.emptyText ?? 'No matches.' }), _jsx(ComboboxList, { children: items.map((key) => (_jsx(ComboboxItem, { value: key, children: key === NONE ? emptyLabel : nameOf(key) }, key))) })] })] }));
|
|
14
|
+
return (_jsx(ReferenceCombobox, { id: props.id, value: props.value, onValueChange: (id) => (alone ? props.commit(id) : props.onChange(id)), search: config.search, label: config.label, required: config.required, emptyLabel: config.emptyLabel, placeholder: config.placeholder, emptyText: config.emptyText, onCreate: config.onCreate, readOnly: props.disabled, defaultOpen: alone, ...controlAria(props) }));
|
|
69
15
|
}
|
|
70
16
|
// The parts side by side (stacked when the field is narrow), each with its
|
|
71
17
|
// own label over its control and its own refusal under it. A refusal
|
|
@@ -51,9 +51,16 @@ export type InPlaceMoneyConfig<TRequired extends boolean = boolean> = {
|
|
|
51
51
|
max?: number;
|
|
52
52
|
placeholder?: string;
|
|
53
53
|
};
|
|
54
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* A plain day, `'YYYY-MM-DD'` (DateField). Typed by default ("3/14",
|
|
56
|
+
* "Mar 14", "today"), with the calendar on its button; Enter or leaving
|
|
57
|
+
* saves, a day picked in the calendar saves at once. Not `required`:
|
|
58
|
+
* emptying the box (or Clear) saves `null`.
|
|
59
|
+
*/
|
|
55
60
|
export type InPlaceDateConfig<TRequired extends boolean = boolean> = {
|
|
56
61
|
required?: TRequired;
|
|
62
|
+
/** `false`: DateField's button alone, its calendar opening with the field and a pick saving. */
|
|
63
|
+
typing?: boolean;
|
|
57
64
|
/** How the day reads. Defaults to `{ dateStyle: 'medium' }`. */
|
|
58
65
|
format?: Intl.DateTimeFormatOptions;
|
|
59
66
|
locale?: string;
|
|
@@ -76,9 +83,17 @@ export type InPlaceOption<T> = {
|
|
|
76
83
|
value: T;
|
|
77
84
|
label: string;
|
|
78
85
|
};
|
|
79
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* One of a fixed list. Not `required`: the list starts with "Not set",
|
|
88
|
+
* which saves `null` (as buttons, pressing the picked one again does).
|
|
89
|
+
*/
|
|
80
90
|
export type InPlaceSelectConfig<T extends string | number, TRequired extends boolean = boolean> = {
|
|
81
91
|
required?: TRequired;
|
|
92
|
+
/**
|
|
93
|
+
* `select` (the default): OptionSelect, its list opening with the field.
|
|
94
|
+
* `buttons`: ChoiceButtons, for two to four short options; a press saves.
|
|
95
|
+
*/
|
|
96
|
+
look?: 'select' | 'buttons';
|
|
82
97
|
/** Every option, in the order the list shows them. */
|
|
83
98
|
options: readonly InPlaceOption<T>[];
|
|
84
99
|
/** How an option reads, at rest, on the trigger and in the list (a badge). Defaults to its label. */
|
|
@@ -108,6 +123,14 @@ export type InPlaceReferenceConfig<Id extends string | number, TRequired extends
|
|
|
108
123
|
placeholder?: string;
|
|
109
124
|
/** What the list says when nothing matches. Defaults to "No matches." */
|
|
110
125
|
emptyText?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Offers Create "<typed text>" as the list's last item when what's typed
|
|
128
|
+
* matches no record's name. Called with the typed name: the app opens its
|
|
129
|
+
* small create form (a FormDialog) with the name filled in, and resolves
|
|
130
|
+
* with the record once it's saved, which is then picked (and, in place,
|
|
131
|
+
* saved); `null` if the form was cancelled.
|
|
132
|
+
*/
|
|
133
|
+
onCreate?: (name: string) => Promise<InPlaceRecord<Id> | null>;
|
|
111
134
|
};
|
|
112
135
|
/** A link: its address and an optional label, as the app maps them to its own fields. */
|
|
113
136
|
export type InPlaceLinkValue = {
|
|
@@ -185,9 +208,20 @@ export declare const inPlace: {
|
|
|
185
208
|
* Reads as "Mar 14"; February 29 is a day, February 30 is refused.
|
|
186
209
|
*/
|
|
187
210
|
monthDay<R extends boolean = false>(options: Common<MonthDay | null | undefined, InPlaceSaved<MonthDay, R>> & InPlaceMonthDayConfig<R>): EditInPlace;
|
|
188
|
-
/**
|
|
211
|
+
/**
|
|
212
|
+
* One of a fixed list; its list opens with the field and a pick saves.
|
|
213
|
+
* `look: 'buttons'` draws it as ChoiceButtons (`inPlace.choice`).
|
|
214
|
+
*/
|
|
189
215
|
select<T extends string | number, R extends boolean = false>(options: Common<T | null | undefined, InPlaceSaved<T, R>> & InPlaceSelectConfig<T, R>): EditInPlace;
|
|
190
|
-
/**
|
|
216
|
+
/**
|
|
217
|
+
* Two to four short options as a row of buttons (ChoiceButtons); a press
|
|
218
|
+
* saves. `inPlace.select` with `look: 'buttons'`.
|
|
219
|
+
*/
|
|
220
|
+
choice<T extends string | number, R extends boolean = false>(options: Common<T | null | undefined, InPlaceSaved<T, R>> & Omit<InPlaceSelectConfig<T, R>, "look">): EditInPlace;
|
|
221
|
+
/**
|
|
222
|
+
* Another record, searched as you type through the app's `search`; a
|
|
223
|
+
* pick saves its id. With `onCreate`, Create "<typed>" makes one.
|
|
224
|
+
*/
|
|
191
225
|
reference<Id extends string | number, R extends boolean = false>(options: Common<Id | null | undefined, InPlaceSaved<Id, R>> & InPlaceReferenceConfig<Id, R>): EditInPlace;
|
|
192
226
|
/**
|
|
193
227
|
* A link: at rest its label (or the address's host when it has none),
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Input } from '../ui/input.js';
|
|
3
3
|
import { InputGroup, InputGroupAddon, InputGroupInput, InputGroupText } from '../ui/input-group.js';
|
|
4
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../ui/select.js';
|
|
5
4
|
import { linkHost, linkRule } from '../../lib/link-href.js';
|
|
6
5
|
import { formatMonthDay, monthDayProblem } from '../../lib/month-day.js';
|
|
7
|
-
import { formatPlainDate } from '../../lib/plain-date.js';
|
|
6
|
+
import { formatPlainDate, unreadableDateMessage } from '../../lib/plain-date.js';
|
|
7
|
+
import { ChoiceButtons } from './choice-buttons.js';
|
|
8
8
|
import { DateField } from './date-field.js';
|
|
9
9
|
import { MonthDayField } from './month-day-field.js';
|
|
10
|
-
import {
|
|
10
|
+
import { OptionSelect } from './option-select.js';
|
|
11
|
+
import { Parts, ReferencePicker } from './edit-in-place-controls.js';
|
|
11
12
|
import { LinkOut } from './row-edit-cells.js';
|
|
12
13
|
const REQUIRED = 'Required';
|
|
13
14
|
// The props every control spreads onto its element.
|
|
@@ -115,6 +116,8 @@ function moneyKind(config) {
|
|
|
115
116
|
};
|
|
116
117
|
}
|
|
117
118
|
function dateKind(config) {
|
|
119
|
+
if (config.typing !== false)
|
|
120
|
+
return typedDateKind(config);
|
|
118
121
|
return {
|
|
119
122
|
editKind: 'choice',
|
|
120
123
|
toDraft: (value) => value ?? '',
|
|
@@ -135,6 +138,22 @@ function dateKind(config) {
|
|
|
135
138
|
: undefined, "aria-label": props.label, "aria-describedby": props.describedBy })),
|
|
136
139
|
};
|
|
137
140
|
}
|
|
141
|
+
// Typed: Enter (a one-line field's key) or leaving saves the day typed; a
|
|
142
|
+
// day picked in the calendar saves at once. Something unreadable is the
|
|
143
|
+
// field's problem, so it isn't saved.
|
|
144
|
+
function typedDateKind(config) {
|
|
145
|
+
return {
|
|
146
|
+
editKind: 'text',
|
|
147
|
+
toDraft: (value) => value ?? '',
|
|
148
|
+
check: (draft) => {
|
|
149
|
+
if (draft === '')
|
|
150
|
+
return config.required ? { ok: false, message: REQUIRED } : { ok: true, value: null };
|
|
151
|
+
return formatPlainDate(draft) === '' ? { ok: false, message: unreadableDateMessage(config.locale) } : { ok: true, value: draft };
|
|
152
|
+
},
|
|
153
|
+
show: (value) => (value ? formatPlainDate(value, config.format, config.locale) || value : null),
|
|
154
|
+
control: (props, alone) => (_jsx(DateField, { id: props.id, value: props.value, onChange: props.onChange, onPick: alone ? (day) => props.commit(day) : props.onChange, onProblem: props.onProblem, clearable: !config.required, placeholder: config.placeholder, format: config.format, locale: config.locale, invalid: props.invalid, readOnly: props.disabled, modal: false, "aria-label": props.label, "aria-describedby": props.describedBy })),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
138
157
|
function monthDayKind(config) {
|
|
139
158
|
return {
|
|
140
159
|
editKind: 'choice',
|
|
@@ -161,34 +180,23 @@ function monthDayKind(config) {
|
|
|
161
180
|
function selectKind(config) {
|
|
162
181
|
const labelOf = (value) => config.options.find((option) => option.value === value)?.label ?? String(value);
|
|
163
182
|
const shownOf = (value) => (config.render ? config.render(value, labelOf(value)) : labelOf(value));
|
|
164
|
-
const keyOf = (value) => {
|
|
165
|
-
const at = value == null ? -1 : config.options.findIndex((option) => option.value === value);
|
|
166
|
-
return at === -1 ? null : String(at);
|
|
167
|
-
};
|
|
168
|
-
const valueOf = (key) => (key === null || key === NONE ? null : (config.options[Number(key)]?.value ?? null));
|
|
169
183
|
const emptyLabel = config.emptyLabel ?? 'Not set';
|
|
170
184
|
return {
|
|
171
185
|
editKind: 'choice',
|
|
172
186
|
toDraft: (value) => value,
|
|
173
187
|
check: (draft) => (draft == null && config.required ? { ok: false, message: REQUIRED } : { ok: true, value: draft }),
|
|
174
188
|
show: (value) => (value == null ? null : shownOf(value)),
|
|
175
|
-
control: (props, alone) =>
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
props.cancel();
|
|
187
|
-
}
|
|
188
|
-
: undefined, children: [_jsx(SelectTrigger, { id: props.id, className: "min-w-40", ...controlAria(props), children: _jsx(SelectValue, { placeholder: config.placeholder ?? 'Pick one', children: (key) => {
|
|
189
|
-
const value = valueOf(key);
|
|
190
|
-
return value == null ? (key === NONE ? emptyLabel : (config.placeholder ?? 'Pick one')) : shownOf(value);
|
|
191
|
-
} }) }), _jsxs(SelectContent, { children: [!config.required && _jsx(SelectItem, { value: NONE, children: emptyLabel }), config.options.map((option, index) => (_jsx(SelectItem, { value: String(index), children: shownOf(option.value) }, String(option.value))))] })] })),
|
|
189
|
+
control: (props, alone) => {
|
|
190
|
+
const pick = (picked) => (alone ? props.commit(picked) : props.onChange(picked));
|
|
191
|
+
if (config.look === 'buttons')
|
|
192
|
+
return (_jsx(ChoiceButtons, { id: props.id, options: config.options, value: props.value, onValueChange: pick, render: config.render, clearable: !config.required, disabled: props.disabled, ...controlAria(props) }));
|
|
193
|
+
return (_jsx(OptionSelect, { id: props.id, options: config.options, value: props.value, onValueChange: pick, render: config.render, required: config.required, emptyLabel: emptyLabel, placeholder: config.placeholder, disabled: props.disabled, defaultOpen: alone, modal: false, onOpenChange: alone
|
|
194
|
+
? (open) => {
|
|
195
|
+
if (!open)
|
|
196
|
+
props.cancel();
|
|
197
|
+
}
|
|
198
|
+
: undefined, className: "w-auto min-w-40", ...controlAria(props) }));
|
|
199
|
+
},
|
|
192
200
|
};
|
|
193
201
|
}
|
|
194
202
|
function referenceKind(config) {
|
|
@@ -413,11 +421,24 @@ export const inPlace = {
|
|
|
413
421
|
monthDay(options) {
|
|
414
422
|
return single(monthDayKind(options), { ...options, value: options.value || null });
|
|
415
423
|
},
|
|
416
|
-
/**
|
|
424
|
+
/**
|
|
425
|
+
* One of a fixed list; its list opens with the field and a pick saves.
|
|
426
|
+
* `look: 'buttons'` draws it as ChoiceButtons (`inPlace.choice`).
|
|
427
|
+
*/
|
|
417
428
|
select(options) {
|
|
418
429
|
return single(selectKind(options), { ...options, value: options.value ?? null });
|
|
419
430
|
},
|
|
420
|
-
/**
|
|
431
|
+
/**
|
|
432
|
+
* Two to four short options as a row of buttons (ChoiceButtons); a press
|
|
433
|
+
* saves. `inPlace.select` with `look: 'buttons'`.
|
|
434
|
+
*/
|
|
435
|
+
choice(options) {
|
|
436
|
+
return single(selectKind({ ...options, look: 'buttons' }), { ...options, value: options.value ?? null });
|
|
437
|
+
},
|
|
438
|
+
/**
|
|
439
|
+
* Another record, searched as you type through the app's `search`; a
|
|
440
|
+
* pick saves its id. With `onCreate`, Create "<typed>" makes one.
|
|
441
|
+
*/
|
|
421
442
|
reference(options) {
|
|
422
443
|
return single(referenceKind(options), { ...options, value: options.value ?? null });
|
|
423
444
|
},
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MouseEvent } from 'react';
|
|
2
|
+
/** How long "✓ Saved" stays beside a value once its save lands. */
|
|
3
|
+
export declare const SAVED_FOR_MS = 2000;
|
|
4
|
+
/** The classes that make a field row the target of the `look="row"` EditableValue inside it. */
|
|
5
|
+
export declare const editRowClass: string;
|
|
6
|
+
/** The row's click: anywhere on it but a link, a button or the open control opens its value. */
|
|
7
|
+
export declare function onEditRowClick(event: MouseEvent<HTMLElement>): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** How long "✓ Saved" stays beside a value once its save lands. */
|
|
2
|
+
export const SAVED_FOR_MS = 2000;
|
|
3
|
+
/** The classes that make a field row the target of the `look="row"` EditableValue inside it. */
|
|
4
|
+
export const editRowClass = [
|
|
5
|
+
'group/edit-row cursor-text rounded-md transition-colors',
|
|
6
|
+
'hover:bg-(--table-hover) hover:shadow-[inset_3px_0_0_0_var(--primary)]',
|
|
7
|
+
'has-[[data-edit]:focus-visible]:bg-(--table-hover) has-[[data-edit]:focus-visible]:shadow-[inset_3px_0_0_0_var(--primary)]',
|
|
8
|
+
// Muted words (the label, "Not set") read as foreground on the tint.
|
|
9
|
+
'hover:[&_.text-muted-foreground]:text-foreground has-[[data-edit]:focus-visible]:[&_.text-muted-foreground]:text-foreground',
|
|
10
|
+
// Open, the control has its own look: no row hover over it. (Written
|
|
11
|
+
// out whole: Tailwind finds classes by reading the source.)
|
|
12
|
+
'has-[[data-slot=editable-value][data-state]]:cursor-auto has-[[data-slot=editable-value][data-state]]:bg-transparent has-[[data-slot=editable-value][data-state]]:shadow-none has-[[data-slot=editable-value][data-state]]:[&_.text-muted-foreground]:text-muted-foreground',
|
|
13
|
+
// A finger's target.
|
|
14
|
+
'max-md:min-h-11 pointer-coarse:min-h-11',
|
|
15
|
+
].join(' ');
|
|
16
|
+
// What a click on the row leaves alone: links, buttons and boxes, and the open control.
|
|
17
|
+
const LEAVE_ALONE = 'a[href], button, input, select, textarea, [role="button"], [role="link"], [role="checkbox"], [role="switch"], [role="combobox"], [role="listbox"], [data-slot=editable-value][data-state]';
|
|
18
|
+
/** The row's click: anywhere on it but a link, a button or the open control opens its value. */
|
|
19
|
+
export function onEditRowClick(event) {
|
|
20
|
+
if (event.target.closest(LEAVE_ALONE))
|
|
21
|
+
return;
|
|
22
|
+
event.currentTarget.querySelector('[data-slot="editable-value"] [data-edit]')?.click();
|
|
23
|
+
}
|
|
@@ -9,6 +9,13 @@ export type EditableValueProps = {
|
|
|
9
9
|
children?: ReactNode;
|
|
10
10
|
/** `inline` in a heading or beside badges, `block` in a field row (default). */
|
|
11
11
|
layout?: 'inline' | 'block';
|
|
12
|
+
/**
|
|
13
|
+
* `value` (the default): hover tints the value itself, as in a header's
|
|
14
|
+
* strip or a title. `row`: the field list's row is the target and wears
|
|
15
|
+
* the hover (edit-row.ts's `editRowClass` on it, as EntityView's rows
|
|
16
|
+
* have); under 48rem or on a touch screen a chevron, not the pencil.
|
|
17
|
+
*/
|
|
18
|
+
look?: 'value' | 'row';
|
|
12
19
|
className?: string;
|
|
13
20
|
};
|
|
14
21
|
/** EditableValue's own props, plus what a list's rows and its Add box need (editable-list.tsx). */
|
|
@@ -23,7 +30,7 @@ export type EditableFieldProps = EditableValueProps & {
|
|
|
23
30
|
reopenAfterKeyboardSave?: boolean;
|
|
24
31
|
};
|
|
25
32
|
export declare function EditableValue(props: EditableValueProps): import("react").JSX.Element;
|
|
26
|
-
export declare function EditableField({ label, edit, children, layout, className, trigger, reopenAfterKeyboardSave, }: EditableFieldProps): import("react").JSX.Element;
|
|
33
|
+
export declare function EditableField({ label, edit, children, layout, look, className, trigger, reopenAfterKeyboardSave, }: EditableFieldProps): import("react").JSX.Element;
|
|
27
34
|
/**
|
|
28
35
|
* While a field holds something unsaved, leaving asks first: an in-app
|
|
29
36
|
* link or Back (React Router's blocker, so the app needs a data router),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// A value on a record's view that turns into its form control where it's
|
|
3
3
|
// shown, and saves when you leave it (cell-patterns.md "Editable value").
|
|
4
4
|
// EntityView wraps every field, section and title marked `edit`; a header
|
|
@@ -18,7 +18,13 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
18
18
|
// click to open, and never closes. Ctrl/Cmd+Enter and Esc save now.
|
|
19
19
|
// - `inline`: always editable, and the control is told to look like the
|
|
20
20
|
// value it edits (`inline` among its props).
|
|
21
|
-
|
|
21
|
+
// - Saved (4.88, F16): once a save lands, "✓ Saved" shows beside the value
|
|
22
|
+
// for two seconds (`role="status"`).
|
|
23
|
+
// - `look="row"` (4.88, F15 and F18): in a record's field list the row is
|
|
24
|
+
// the target (edit-row.ts): it wears the list's row hover and the pencil
|
|
25
|
+
// sits at its end; under 48rem or on a touch screen there's a chevron
|
|
26
|
+
// instead of the pencil. The control still opens in the row.
|
|
27
|
+
import { CheckIcon, ChevronRightIcon, PencilIcon } from 'lucide-react';
|
|
22
28
|
import { useCallback, useContext, useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
23
29
|
import { useBlocker } from 'react-router';
|
|
24
30
|
import { cn } from 'cn';
|
|
@@ -27,6 +33,7 @@ import { DiscardChangesDialog } from '../ui/dialog.js';
|
|
|
27
33
|
import { FieldError } from '../ui/field.js';
|
|
28
34
|
import { Spinner } from '../ui/spinner.js';
|
|
29
35
|
import { EditInPlaceContext } from './edit-in-place.js';
|
|
36
|
+
import { SAVED_FOR_MS } from './edit-row.js';
|
|
30
37
|
import { escapePassedThrough } from './escape-passthrough.js';
|
|
31
38
|
// What a click on the shown value must leave alone: links navigate,
|
|
32
39
|
// buttons and boxes do their own thing (a list item's done box ticks it).
|
|
@@ -42,6 +49,9 @@ const FOCUS_ORDER = [
|
|
|
42
49
|
// Focus moving here doesn't save the field: a link that leaves the page
|
|
43
50
|
// (the leave prompt decides what happens to the draft) or the prompt itself.
|
|
44
51
|
const LEAVING = 'a[href]:not([target="_blank"]), [data-leave-guard]';
|
|
52
|
+
// A control holding the field open while something of the app's is in
|
|
53
|
+
// front of it (ReferenceCombobox's create form): leaving doesn't save.
|
|
54
|
+
const HOLD = '[data-edit-hold]';
|
|
45
55
|
// The field's own control, given what it needs.
|
|
46
56
|
function Control({ render, ...props }) {
|
|
47
57
|
return render(props);
|
|
@@ -55,7 +65,7 @@ function useStore() {
|
|
|
55
65
|
export function EditableValue(props) {
|
|
56
66
|
return _jsx(EditableField, { ...props });
|
|
57
67
|
}
|
|
58
|
-
export function EditableField({ label, edit, children, layout = 'block', className, trigger, reopenAfterKeyboardSave = false, }) {
|
|
68
|
+
export function EditableField({ label, edit, children, layout = 'block', look = 'value', className, trigger, reopenAfterKeyboardSave = false, }) {
|
|
59
69
|
const store = useStore();
|
|
60
70
|
const key = useId();
|
|
61
71
|
const controlId = `${key}-control`;
|
|
@@ -70,6 +80,22 @@ export function EditableField({ label, edit, children, layout = 'block', classNa
|
|
|
70
80
|
});
|
|
71
81
|
useEffect(() => store.register(key, () => config.current), [store, key]);
|
|
72
82
|
const state = useSyncExternalStore(store.subscribe, () => store.state(key), () => store.state(key));
|
|
83
|
+
// "✓ Saved" for a moment once a save lands (saving, then closed).
|
|
84
|
+
const [justSaved, setJustSaved] = useState(false);
|
|
85
|
+
const [seenStatus, setSeenStatus] = useState(state.status);
|
|
86
|
+
if (seenStatus !== state.status) {
|
|
87
|
+
setSeenStatus(state.status);
|
|
88
|
+
if (seenStatus === 'saving' && state.status === 'closed')
|
|
89
|
+
setJustSaved(true);
|
|
90
|
+
else if (state.status !== 'closed')
|
|
91
|
+
setJustSaved(false);
|
|
92
|
+
}
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (!justSaved)
|
|
95
|
+
return;
|
|
96
|
+
const timer = window.setTimeout(() => setJustSaved(false), SAVED_FOR_MS);
|
|
97
|
+
return () => window.clearTimeout(timer);
|
|
98
|
+
}, [justSaved]);
|
|
73
99
|
const editButton = useRef(null);
|
|
74
100
|
// Holds a trigger (the list's Add): its button is the one the caret goes back to.
|
|
75
101
|
const triggerBox = useRef(null);
|
|
@@ -196,6 +222,8 @@ export function EditableField({ label, edit, children, layout = 'block', classNa
|
|
|
196
222
|
blurTimer.current = window.setTimeout(() => {
|
|
197
223
|
if (store.state(key).status !== 'open')
|
|
198
224
|
return;
|
|
225
|
+
if (container.current?.querySelector(HOLD))
|
|
226
|
+
return;
|
|
199
227
|
void store.commit(key).then(() => {
|
|
200
228
|
if (always)
|
|
201
229
|
refresh();
|
|
@@ -206,7 +234,11 @@ export function EditableField({ label, edit, children, layout = 'block', classNa
|
|
|
206
234
|
if (state.status === 'closed' && !always) {
|
|
207
235
|
if (trigger)
|
|
208
236
|
return (_jsx("span", { ref: triggerBox, className: "contents", children: trigger(start) }));
|
|
209
|
-
|
|
237
|
+
const row = look === 'row';
|
|
238
|
+
return (_jsxs("span", { "data-slot": "editable-value", "data-look": look, onClick: onShownClick, className: cn('group/editable relative cursor-text items-start gap-1',
|
|
239
|
+
// A row: the row (editRowClass) wears the hover, not the value.
|
|
240
|
+
!row && '-mx-1.5 rounded-md px-1.5 transition-colors hover:bg-muted has-[[data-edit]:focus-visible]:bg-muted', layout === 'block' ? 'flex w-full' : 'inline-flex max-w-full align-top', className), children: [_jsxs("span", { className: cn('min-w-0 flex-1', !row &&
|
|
241
|
+
'group-hover/editable:[&_.text-muted-foreground]:text-foreground group-has-[[data-edit]:focus-visible]/editable:[&_.text-muted-foreground]:text-foreground'), children: [children !== undefined ? children : edit.shown, _jsx("span", { role: "status", "data-slot": "editable-value-saved", className: "ml-2 inline-flex items-center gap-1 align-baseline type-caption text-success-text empty:hidden", children: justSaved && (_jsxs(_Fragment, { children: [_jsx(CheckIcon, { "aria-hidden": "true", className: "size-3.5" }), "Saved"] })) })] }), _jsx(Button, { ref: editButton, "data-edit": "", type: "button", variant: "ghost", size: "icon-xs", "aria-label": `Edit ${label}`, onClick: start, className: cn('shrink-0 text-muted-foreground opacity-0 focus-visible:opacity-100 pointer-coarse:opacity-100', row ? 'group-hover/edit-row:opacity-100 hover:bg-transparent max-md:opacity-100' : 'group-hover/editable:opacity-100'), children: row ? (_jsxs(_Fragment, { children: [_jsx(PencilIcon, { className: "max-md:hidden pointer-coarse:hidden" }), _jsx(ChevronRightIcon, { className: "hidden max-md:block pointer-coarse:block" })] })) : (_jsx(PencilIcon, {})) })] }));
|
|
210
242
|
}
|
|
211
243
|
// Always editable, before the store has it (the first render): the saved value.
|
|
212
244
|
const open = state.status === 'closed' ? { status: 'open', draft: edit.value, error: null, autosave: undefined, revision: 0 } : state;
|
|
@@ -92,6 +92,7 @@ import { PrintNotes } from './entity-view-print.js';
|
|
|
92
92
|
import { EditInPlaceContext } from './edit-in-place.js';
|
|
93
93
|
import { EditInPlaceStore } from './edit-in-place-store.js';
|
|
94
94
|
import { EditableList } from './editable-list.js';
|
|
95
|
+
import { editRowClass, onEditRowClick } from './edit-row.js';
|
|
95
96
|
import { EditableValue, LeaveGuard } from './editable-value.js';
|
|
96
97
|
import { EmptyText } from './empty-value.js';
|
|
97
98
|
import { EMPTY_DASH, isEmptyValue } from '../../lib/empty-value.js';
|
|
@@ -133,7 +134,10 @@ const FIELD_ROW = {
|
|
|
133
134
|
};
|
|
134
135
|
function FieldRow({ field, place }) {
|
|
135
136
|
const value = fieldValue(field);
|
|
136
|
-
|
|
137
|
+
// An editable row is the target as a whole (4.88, F15/F18): the list's
|
|
138
|
+
// row hover, its pencil at the end, a chevron on a phone.
|
|
139
|
+
const editable = Boolean(field.edit);
|
|
140
|
+
return (_jsxs("div", { className: cn('flex flex-col gap-1 py-3 first:pt-0 last:pb-0', FIELD_ROW[place], editable && cn(editRowClass, '-mx-2 px-2 first:pt-2 last:pb-2')), onClick: editable ? onEditRowClick : undefined, children: [_jsx("dt", { className: "type-label text-muted-foreground", children: field.label }), _jsx("dd", { className: "min-w-0 type-body break-words text-foreground", children: field.edit ? (_jsx(EditableValue, { label: field.label, edit: field.edit, look: "row", children: _jsx(OrEmpty, { value: value, emptyLabel: field.emptyLabel }) })) : (_jsx(OrEmpty, { value: value, emptyLabel: field.emptyLabel })) })] }));
|
|
137
141
|
}
|
|
138
142
|
// A fields card's rows. Folded (`emptyFields="fold"`), the filled fields
|
|
139
143
|
// show and the empty ones wait behind "N empty", which opens them in their
|
|
@@ -36,8 +36,15 @@ export type MultiPickProps<Id extends string | number> = {
|
|
|
36
36
|
placeholder?: string;
|
|
37
37
|
/** Shown when there are no options at all. */
|
|
38
38
|
emptyText?: string;
|
|
39
|
+
/**
|
|
40
|
+
* How many options show before "Show all N": past it, the picked ones
|
|
41
|
+
* and the first `limit`. Defaults to 30. A filter always searches them all.
|
|
42
|
+
*/
|
|
43
|
+
limit?: number;
|
|
44
|
+
/** The options are still loading (the app's query of its records): "Loading…" in place of the chips. */
|
|
45
|
+
loading?: boolean;
|
|
39
46
|
/** Shown, not changeable. */
|
|
40
47
|
readOnly?: boolean;
|
|
41
48
|
className?: string;
|
|
42
49
|
};
|
|
43
|
-
export declare function MultiPick<Id extends string | number>({ options, value, onValueChange, onPick, 'aria-label': label, 'aria-describedby': describedBy, id, placeholder, emptyText, readOnly, className, }: MultiPickProps<Id>): import("react").JSX.Element;
|
|
50
|
+
export declare function MultiPick<Id extends string | number>({ options, value, onValueChange, onPick, 'aria-label': label, 'aria-describedby': describedBy, id, placeholder, emptyText, limit, loading, readOnly, className, }: MultiPickProps<Id>): import("react").JSX.Element;
|