@lotics/ui 46.8.2 → 46.9.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/docs/catalog.md +8 -1
- package/package.json +1 -1
- package/src/inline_select.tsx +12 -1
package/docs/catalog.md
CHANGED
|
@@ -1032,7 +1032,14 @@ source (`src/<module>.tsx`/`.ts`) is the API reference.
|
|
|
1032
1032
|
differs from the visible text is what breaks label-in-name.
|
|
1033
1033
|
- **`select`** — `Select`: rich/custom-rendered, single/multi, select-all, chips via
|
|
1034
1034
|
`renderSelected(item, { remove })` + `searchable` + `allowCustom` — the tag field is just
|
|
1035
|
-
a multi Select; opens `OptionList`.
|
|
1035
|
+
a multi Select; opens `OptionList`. **`emptyText` replaces the list's "No results" when the
|
|
1036
|
+
caller knows what the reader should DO about it** — where the missing thing gets created, why the
|
|
1037
|
+
set is narrowed. A select cannot know that; the reader is stuck at exactly that moment, and it is
|
|
1038
|
+
the one place a list may speak without becoming permanent furniture, since it shows only when the
|
|
1039
|
+
search finds nothing. Reach for it instead of a create-in-place row wherever the missing record
|
|
1040
|
+
cannot be validly made from this screen: a vehicle needs its documents, a party needs its tax id,
|
|
1041
|
+
and a stub minted here is a record that fails the next gate it meets.
|
|
1042
|
+
**Set `searchPlaceholder` whenever `allowCustom` is on**:
|
|
1036
1043
|
the create row only exists once there is a query, so on an untyped menu the placeholder is the
|
|
1037
1044
|
only always-visible place that can say a new value is allowed. `customOptionLabel` names what
|
|
1038
1045
|
the create row will
|
package/package.json
CHANGED
package/src/inline_select.tsx
CHANGED
|
@@ -45,6 +45,13 @@ interface InlineSelectBaseProps<T extends string, D = unknown> {
|
|
|
45
45
|
accessibilityLabel?: string;
|
|
46
46
|
/** Show an in-menu search box; default false. */
|
|
47
47
|
searchable?: boolean;
|
|
48
|
+
/** What the list says when it has nothing to offer — no options at all, or a
|
|
49
|
+
* search that matched none. The default states the fact ("No results"); pass
|
|
50
|
+
* this when the caller knows what the reader should DO about it, which the
|
|
51
|
+
* list cannot know: where the missing thing is created, why the set is
|
|
52
|
+
* narrowed. It is the one moment a select may speak without becoming
|
|
53
|
+
* permanent furniture, because it appears only when the reader is stuck. */
|
|
54
|
+
emptyText?: string;
|
|
48
55
|
/** Offer a "create" row when the query matches no option — picking it commits the
|
|
49
56
|
* typed value (single) / adds it to the set (multi). Implies `searchable`. */
|
|
50
57
|
allowCustom?: boolean;
|
|
@@ -150,7 +157,7 @@ function InlineSelectShell(props: {
|
|
|
150
157
|
}
|
|
151
158
|
|
|
152
159
|
export function InlineSelect<T extends string, D = unknown>(props: InlineSelectProps<T, D>) {
|
|
153
|
-
const { options, renderOptionContent, getOptionDescription, placeholder, disabled, accessibilityLabel, searchable = false, allowCustom = false, customOptionLabel, customOptionPlacement, variant, actions, autoFocus = false } = props;
|
|
160
|
+
const { options, renderOptionContent, getOptionDescription, placeholder, disabled, accessibilityLabel, searchable = false, emptyText, allowCustom = false, customOptionLabel, customOptionPlacement, variant, actions, autoFocus = false } = props;
|
|
154
161
|
const labels = useLoticsLocale().inline;
|
|
155
162
|
const [open, setOpen] = useState(autoFocus);
|
|
156
163
|
const [saving, setSaving] = useState(false);
|
|
@@ -239,6 +246,8 @@ export function InlineSelect<T extends string, D = unknown>(props: InlineSelectP
|
|
|
239
246
|
<OptionList<T, true, D>
|
|
240
247
|
multi
|
|
241
248
|
getOptionDescription={getOptionDescription}
|
|
249
|
+
emptyText={emptyText}
|
|
250
|
+
|
|
242
251
|
search={{ mode: searchMode }}
|
|
243
252
|
options={options}
|
|
244
253
|
value={draft}
|
|
@@ -286,6 +295,8 @@ export function InlineSelect<T extends string, D = unknown>(props: InlineSelectP
|
|
|
286
295
|
>
|
|
287
296
|
<OptionList<T, false, D>
|
|
288
297
|
getOptionDescription={getOptionDescription}
|
|
298
|
+
emptyText={emptyText}
|
|
299
|
+
|
|
289
300
|
search={{ mode: searchMode }}
|
|
290
301
|
options={options}
|
|
291
302
|
value={value}
|