@lotics/ui 11.2.0 → 11.3.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/AGENTS.md CHANGED
@@ -227,7 +227,18 @@ clicking floats a multi `OptionList` (checkbox rows), CLOSING commits the new se
227
227
  `onSave` — never a borderless `Select` posing as an inline field) — all
228
228
  on `useInlineEdit` + `InlineEditView` (custom inputs join via those). `onSave` is async: the
229
229
  saving spinner sits INSIDE the control (never a sibling — that reflows); an error shows inline
230
- without losing the edit. A STACK of rows lives in a `DetailTable` (label ·
230
+ without losing the edit. To let a value be UNSET (a diff-write CLEAR — unassign, remove a due
231
+ date, drop a select), pass **`onClear`** to `InlineSelect` / `InlineMemberSelect` /
232
+ `InlineDatePicker`. It surfaces through each popover's OWN clear affordance — `InlineSelect` renders
233
+ a compact left-aligned "Clear" `Button` below the `OptionList` (only while a value is set);
234
+ `InlineDatePicker` reuses the calendar's own footer "Clear" button. NOT a bolted-on sibling row: that
235
+ can't reach the option list's active-highlight (so the last-hovered option stays lit) and would
236
+ double the footer hairline;
237
+ and never a persistent ✕ on the resting cell (noise on a dense board, and a pressable nested in the
238
+ view's button trigger is invalid DOM). `onSave`'s `next` stays non-null so a caller opts in per field;
239
+ the clear fires `onClear`, which writes `null` (the app workflow must ACCEPT null on that input — a
240
+ `select`/`date`/`member` field clears on null). `InlineTagSelect` (multi) needs no `onClear` — an
241
+ empty set is already a valid `onSave`. A STACK of rows lives in a `DetailTable` (label ·
231
242
  value · trailing laid out like a TABLE: `labelWidth` / `trailingWidth` /
232
243
  `minHeight` set ONCE on the parent, plus the 6px row gap the zinc-50 chips
233
244
  need) holding `DetailRow`s — set `trailingWidth` when ANY row carries a
@@ -265,8 +265,8 @@ export function TplTaskBoard() {
265
265
  }
266
266
 
267
267
  const propertyCols: DataGridColumn<Task>[] = [
268
- { key: "assignee", label: "Assignee", width: 160, sortable: true, cell: (t) => <InlineMemberSelect background="transparent" members={MEMBERS} value={t.ownerId} onSave={(id) => patch(t.id, { ownerId: id })} placeholder="Unassigned" accessibilityLabel="Assignee" /> },
269
- { key: "due", label: "Due", width: 140, sortable: true, cell: (t) => <InlineDatePicker background="transparent" value={t.due} optionalTime onSave={(v) => patch(t.id, { due: v })} placeholder="No date" accessibilityLabel="Due date" /> },
268
+ { key: "assignee", label: "Assignee", width: 160, sortable: true, cell: (t) => <InlineMemberSelect background="transparent" members={MEMBERS} value={t.ownerId} onSave={(id) => patch(t.id, { ownerId: id })} onClear={() => patch(t.id, { ownerId: null })} placeholder="Unassigned" accessibilityLabel="Assignee" /> },
269
+ { key: "due", label: "Due", width: 140, sortable: true, cell: (t) => <InlineDatePicker background="transparent" value={t.due} optionalTime onSave={(v) => patch(t.id, { due: v })} onClear={() => patch(t.id, { due: null })} placeholder="No date" accessibilityLabel="Due date" /> },
270
270
  { key: "status", label: "Status", width: 130, sortable: true, cell: (t) => <InlineSelect background="transparent" value={t.status} options={STATUS_OPTIONS} onSave={(s) => patch(t.id, { status: s })} renderSelected={renderStatusBadge} renderOptionContent={renderStatusBadge} accessibilityLabel="Status" /> },
271
271
  { key: "tags", label: "Tags", width: 168, cell: (t) => <Select multi searchable allowCustom value={t.tags.map((tag) => tag.value)} onValueChange={(next) => patch(t.id, { tags: next.map(tagOf) })} options={TAG_OPTIONS} renderSelected={renderTagBadge} renderOptionContent={renderTagBadge} style={{ borderColor: "transparent" }} placeholder="Add tags" accessibilityLabel="Tags" /> },
272
272
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/ui",
3
- "version": "11.2.0",
3
+ "version": "11.3.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./tokens": "./src/tokens.ts",
@@ -7,6 +7,15 @@ import { Picker, PickerOption } from "./picker";
7
7
  import { IconButton } from "./icon_button";
8
8
  import { FOCUS_RING } from "./control_surface";
9
9
  import { useFocusRing } from "./use_focus_ring";
10
+ import { useLoticsLocale } from "./locale";
11
+
12
+ /** Accessible names for the calendar's month-navigation arrows. Backs the
13
+ * `calendar` locale slice. (The month/weekday NAMES come from `Intl` + the
14
+ * `locale` prop, not from here.) */
15
+ export interface CalendarLabels {
16
+ previousMonth: string;
17
+ nextMonth: string;
18
+ }
10
19
 
11
20
  function DayCell(props: {
12
21
  day: number;
@@ -237,6 +246,7 @@ function CalendarMonth(props: CalendarMonthProps) {
237
246
  firstDayOfWeek = 1, // Default to Monday
238
247
  locale,
239
248
  } = props;
249
+ const navLabels = useLoticsLocale().calendar;
240
250
 
241
251
  const names = getLocalizedNames(locale);
242
252
  const daysInMonth = getDaysInMonth(year, month);
@@ -314,14 +324,14 @@ function CalendarMonth(props: CalendarMonthProps) {
314
324
  {showNavigation && (
315
325
  <IconButton
316
326
  icon="chevron-left"
317
- accessibilityLabel="Previous month"
327
+ accessibilityLabel={navLabels.previousMonth}
318
328
  onPress={handlePrevMonth}
319
329
  />
320
330
  )}
321
331
  {showLeftArrow && onPrevMonth && (
322
332
  <IconButton
323
333
  icon="chevron-left"
324
- accessibilityLabel="Previous month"
334
+ accessibilityLabel={navLabels.previousMonth}
325
335
  onPress={onPrevMonth}
326
336
  />
327
337
  )}
@@ -348,14 +358,14 @@ function CalendarMonth(props: CalendarMonthProps) {
348
358
  {showNavigation && (
349
359
  <IconButton
350
360
  icon="chevron-right"
351
- accessibilityLabel="Next month"
361
+ accessibilityLabel={navLabels.nextMonth}
352
362
  onPress={handleNextMonth}
353
363
  />
354
364
  )}
355
365
  {showRightArrow && onNextMonth && (
356
366
  <IconButton
357
367
  icon="chevron-right"
358
- accessibilityLabel="Next month"
368
+ accessibilityLabel={navLabels.nextMonth}
359
369
  onPress={onNextMonth}
360
370
  />
361
371
  )}
@@ -7,6 +7,7 @@ import { Calendar, CalendarRangeValue } from "./date_calendar";
7
7
  import { TimePicker } from "./time_picker";
8
8
  import { DateField } from "./date_field";
9
9
  import { SegmentLabels } from "./date_segments";
10
+ import { useLoticsLocale } from "./locale";
10
11
  import { Icon } from "./icon";
11
12
  import { Button } from "./button";
12
13
  import { IconButton } from "./icon_button";
@@ -28,6 +29,10 @@ import {
28
29
  // Types
29
30
  // =============================================================================
30
31
 
32
+ /** All translatable strings the date picker renders — the calendar popover's
33
+ * quick actions + accessible names, plus the segmented field's per-segment
34
+ * labels ({@link SegmentLabels}). Backs the `datePicker` locale slice; a caller
35
+ * may still override per-instance via a `labels` prop. */
31
36
  export interface DatePickerLabels extends SegmentLabels {
32
37
  /** Quick action: set the value to today. Shown for the `date` format. */
33
38
  today: string;
@@ -51,25 +56,6 @@ export interface DatePickerLabels extends SegmentLabels {
51
56
  removeTime: string;
52
57
  }
53
58
 
54
- const DEFAULT_LABELS: DatePickerLabels = {
55
- today: "Today",
56
- now: "Now",
57
- clear: "Clear",
58
- done: "Done",
59
- openCalendar: "Open calendar",
60
- time: "Time",
61
- startTime: "Start time",
62
- endTime: "End time",
63
- addTime: "Add time",
64
- removeTime: "Remove time",
65
- year: "Year",
66
- month: "Month",
67
- day: "Day",
68
- hour: "Hour",
69
- minute: "Minute",
70
- dayPeriod: "AM/PM",
71
- };
72
-
73
59
  export interface DatePickerProps {
74
60
  value?: string | null;
75
61
  onValueChange: (value: string) => void;
@@ -82,7 +68,9 @@ export interface DatePickerProps {
82
68
  /** Fires when the text input loses focus, after any typed value is committed. */
83
69
  onBlur?: () => void;
84
70
  testID?: string;
85
- /** Translated labels for the popover quick actions and accessible names. Defaults to English. */
71
+ /** Per-instance label overrides (quick actions + accessible names). Anything
72
+ * omitted resolves from the `datePicker` locale slice — English by default, or
73
+ * the active `LoticsLocaleProvider` pack. */
86
74
  labels?: Partial<DatePickerLabels>;
87
75
  /** BCP-47 locale for the calendar's weekday/month names. Defaults to "en-US". */
88
76
  locale?: string;
@@ -119,7 +107,7 @@ export function DatePickerPanel(props: DatePickerPanelProps) {
119
107
  const optTime = !!optionalTime && !isRange;
120
108
  const valueHasTime = isoHasTime(value);
121
109
  const hasTime = optTime ? valueHasTime : hasTimeFormat(format);
122
- const mergedLabels = { ...DEFAULT_LABELS, ...labels };
110
+ const mergedLabels = { ...useLoticsLocale().datePicker, ...labels };
123
111
 
124
112
  const [startIso, endIso] = useMemo<[string, string]>(() => {
125
113
  if (!value) return ["", ""];
@@ -342,9 +330,10 @@ export function DatePicker(props: DatePickerProps) {
342
330
  const optTime = !!optionalTime && !isRange;
343
331
  // The trigger's segments follow the value's shape in optionalTime mode.
344
332
  const hasTime = optTime ? isoHasTime(value) : hasTimeFormat(format);
333
+ const datePickerLabels = useLoticsLocale().datePicker;
345
334
  const mergedLabels = useMemo<DatePickerLabels>(
346
- () => ({ ...DEFAULT_LABELS, ...labels }),
347
- [labels],
335
+ () => ({ ...datePickerLabels, ...labels }),
336
+ [datePickerLabels, labels],
348
337
  );
349
338
 
350
339
  const [open, setOpen] = useState(false);
@@ -15,6 +15,11 @@ export interface InlineDatePickerProps {
15
15
  /** ISO date (`2026-05-22`) or datetime (`2026-05-22T14:30`). */
16
16
  value: string | null;
17
17
  onSave: (next: string) => void | Promise<void>;
18
+ /** Unset the date to empty. Provide it to make the value clearable: the
19
+ * calendar's own "Clear" button then unsets the field through this callback
20
+ * (without `onClear` an empty selection is ignored — a required date can't be
21
+ * emptied). Kept separate from `onSave` (whose next is a non-empty string). */
22
+ onClear?: () => void | Promise<void>;
18
23
  /** "date" (default) or "datetime". */
19
24
  format?: "date" | "datetime";
20
25
  /** Let the user OPTIONALLY add a time to a date (the value's shape decides — date
@@ -37,7 +42,7 @@ export interface InlineDatePickerProps {
37
42
  * dismissing without a change reverts.
38
43
  */
39
44
  export function InlineDatePicker(props: InlineDatePickerProps) {
40
- const { value, onSave, format = "date", optionalTime, placeholder, locale, disabled, accessibilityLabel , background } = props;
45
+ const { value, onSave, onClear, format = "date", optionalTime, placeholder, locale, disabled, accessibilityLabel , background } = props;
41
46
  const labels = useLoticsLocale().inline;
42
47
  const [open, setOpen] = useState(false);
43
48
  const [draft, setDraft] = useState<string | null>(value);
@@ -49,7 +54,23 @@ export function InlineDatePicker(props: InlineDatePickerProps) {
49
54
 
50
55
  const commit = useCallback(async () => {
51
56
  const next = draftRef.current;
52
- if (next === value || !next) return;
57
+ if (next === value) return;
58
+ // The panel's "Clear" empties the draft (onValueChange("")). Treat that as an
59
+ // explicit unset when the field is clearable (onClear + a current value);
60
+ // otherwise ignore an empty draft — a required date can't be emptied.
61
+ if (!next) {
62
+ if (!onClear || !value) return;
63
+ setSaving(true);
64
+ setError(null);
65
+ try {
66
+ await onClear();
67
+ } catch (e) {
68
+ setError(e instanceof Error && e.message ? e.message : labels.saveError);
69
+ } finally {
70
+ setSaving(false);
71
+ }
72
+ return;
73
+ }
53
74
  setSaving(true);
54
75
  setError(null);
55
76
  try {
@@ -59,7 +80,7 @@ export function InlineDatePicker(props: InlineDatePickerProps) {
59
80
  } finally {
60
81
  setSaving(false);
61
82
  }
62
- }, [value, onSave]);
83
+ }, [value, onSave, onClear, labels.saveError]);
63
84
 
64
85
  const onOpenChange = useCallback(
65
86
  (next: boolean) => {
@@ -108,7 +129,11 @@ export function InlineDatePicker(props: InlineDatePickerProps) {
108
129
  format={format}
109
130
  optionalTime={optionalTime}
110
131
  locale={locale}
111
- onRequestClose={() => setOpen(false)}
132
+ // Commit on panel close. A single-date pick and the "Today" button
133
+ // auto-close through here — route it through onOpenChange so commit
134
+ // runs. A bare setOpen(false) is a controlled close the Popover never
135
+ // reports to onOpenChange, so the pick/clear would be silently dropped.
136
+ onRequestClose={() => onOpenChange(false)}
112
137
  />
113
138
  </PopoverContent>
114
139
  </Popover>
@@ -16,6 +16,10 @@ interface InlineMemberSelectProps {
16
16
  /** Commit a new assignment (the picked member id). Throwing surfaces the
17
17
  * inline error and reverts, like every inline editor. */
18
18
  onSave: (memberId: string) => void | Promise<void>;
19
+ /** Unassign — unset the field to empty. Provide it to make the assignment
20
+ * clearable: a compact "Clear" button appears below the picker options when a
21
+ * member is set. Kept separate from `onSave` (whose id is non-null). */
22
+ onClear?: () => void | Promise<void>;
19
23
  placeholder?: string;
20
24
  disabled?: boolean;
21
25
  accessibilityLabel?: string;
@@ -13,6 +13,11 @@ import { useLoticsLocale } from "./locale";
13
13
  export interface InlineSelectProps<T extends string> {
14
14
  value: T | null;
15
15
  onSave: (next: T) => void | Promise<void>;
16
+ /** Unset the field to empty. Provide it to make the value clearable: a compact
17
+ * "Clear" button appears below the options whenever there IS a value. Kept
18
+ * separate from `onSave` (whose next is a non-null `T`) so an app opts in
19
+ * without every caller having to handle null. */
20
+ onClear?: () => void | Promise<void>;
16
21
  options: PickerOption<T>[];
17
22
  /** Custom option content in the dropdown (icon + label, two-line, a badge…).
18
23
  * Omit for a plain label list — both render through the same `OptionList`. */
@@ -39,7 +44,7 @@ export interface InlineSelectProps<T extends string> {
39
44
  * Pass `renderOptionContent` for rich options, or omit it for a plain label list.
40
45
  */
41
46
  export function InlineSelect<T extends string>(props: InlineSelectProps<T>) {
42
- const { value, onSave, options, renderOptionContent, renderSelected, placeholder, disabled, accessibilityLabel, searchable = false, background } = props;
47
+ const { value, onSave, onClear, options, renderOptionContent, renderSelected, placeholder, disabled, accessibilityLabel, searchable = false, background } = props;
43
48
  const labels = useLoticsLocale().inline;
44
49
  const [open, setOpen] = useState(false);
45
50
  const [saving, setSaving] = useState(false);
@@ -64,6 +69,20 @@ export function InlineSelect<T extends string>(props: InlineSelectProps<T>) {
64
69
  [value, onSave],
65
70
  );
66
71
 
72
+ const clear = useCallback(async () => {
73
+ setOpen(false);
74
+ if (value == null || !onClear) return;
75
+ setSaving(true);
76
+ setError(null);
77
+ try {
78
+ await onClear();
79
+ } catch (e) {
80
+ setError(e instanceof Error && e.message ? e.message : labels.saveError);
81
+ } finally {
82
+ setSaving(false);
83
+ }
84
+ }, [value, onClear]);
85
+
67
86
  return (
68
87
  <View>
69
88
  <Popover open={open && !disabled} onOpenChange={setOpen} side="bottom" align="start" inheritTriggerWidth>
@@ -90,6 +109,7 @@ export function InlineSelect<T extends string>(props: InlineSelectProps<T>) {
90
109
  options={options}
91
110
  value={value}
92
111
  onValueChange={(next) => void pick(next)}
112
+ onClear={onClear ? () => void clear() : undefined}
93
113
  onRequestClose={() => setOpen(false)}
94
114
  renderOptionContent={renderOptionContent}
95
115
  />
package/src/locale.tsx CHANGED
@@ -1,4 +1,6 @@
1
1
  import { createContext, useContext, type ReactNode } from "react";
2
+ import { type DatePickerLabels } from "./date_picker";
3
+ import { type CalendarLabels } from "./date_calendar";
2
4
  import { type PaginationLabels } from "./pagination";
3
5
  import { type SortHeaderLabels } from "./sort_header";
4
6
  import { type ConfidenceLabels } from "./confidence";
@@ -28,7 +30,9 @@ export interface LoticsLocale {
28
30
  /** `OptionList` (and everything built on it — `Select`, `Combobox`, the
29
31
  * in-cell editors): the select-all/deselect-all links, the empty state, the
30
32
  * internal search-field placeholder, and the `Combobox` recents header. */
31
- optionList: { selectAll: string; deselectAll: string; noResults: string; recent: string; searchPlaceholder: string };
33
+ optionList: { selectAll: string; deselectAll: string; clear: string; noResults: string; recent: string; searchPlaceholder: string };
34
+ datePicker: DatePickerLabels;
35
+ calendar: CalendarLabels;
32
36
  /** `FilterChip` (and `ColumnFilter`): the generic clear affordance, used when
33
37
  * a call site doesn't pass a dimension-specific `clearLabel`. */
34
38
  filterChip: { clear: string };
@@ -99,7 +103,9 @@ export const en: LoticsLocale = {
99
103
  ascending: ", ascending",
100
104
  descending: ", descending",
101
105
  },
102
- optionList: { selectAll: "Select all", deselectAll: "Deselect all", noResults: "No results", recent: "Recent", searchPlaceholder: "Search…" },
106
+ optionList: { selectAll: "Select all", deselectAll: "Deselect all", clear: "Clear", noResults: "No results", recent: "Recent", searchPlaceholder: "Search…" },
107
+ datePicker: { today: "Today", now: "Now", clear: "Clear", done: "Done", openCalendar: "Open calendar", time: "Time", startTime: "Start time", endTime: "End time", addTime: "Add time", removeTime: "Remove time", year: "Year", month: "Month", day: "Day", hour: "Hour", minute: "Minute", dayPeriod: "AM/PM" },
108
+ calendar: { previousMonth: "Previous month", nextMonth: "Next month" },
103
109
  filterChip: { clear: "Clear" },
104
110
  formField: { optional: "Optional" },
105
111
  drawer: { previous: "Previous record", next: "Next record", close: "Close" },
@@ -176,7 +182,9 @@ export const vi: LoticsLocale = {
176
182
  ascending: " (tăng dần)",
177
183
  descending: " (giảm dần)",
178
184
  },
179
- optionList: { selectAll: "Chọn tất cả", deselectAll: "Bỏ chọn tất cả", noResults: "Không có kết quả", recent: "Gần đây", searchPlaceholder: "Tìm…" },
185
+ optionList: { selectAll: "Chọn tất cả", deselectAll: "Bỏ chọn tất cả", clear: "Xóa", noResults: "Không có kết quả", recent: "Gần đây", searchPlaceholder: "Tìm…" },
186
+ datePicker: { today: "Hôm nay", now: "Bây giờ", clear: "Xóa", done: "Xong", openCalendar: "Mở lịch", time: "Giờ", startTime: "Giờ bắt đầu", endTime: "Giờ kết thúc", addTime: "Thêm giờ", removeTime: "Bỏ giờ", year: "Năm", month: "Tháng", day: "Ngày", hour: "Giờ", minute: "Phút", dayPeriod: "SA/CH" },
187
+ calendar: { previousMonth: "Tháng trước", nextMonth: "Tháng sau" },
180
188
  filterChip: { clear: "Xóa" },
181
189
  formField: { optional: "Tùy chọn" },
182
190
  drawer: { previous: "Bản ghi trước", next: "Bản ghi sau", close: "Đóng" },
@@ -5,6 +5,7 @@ import { Text } from "./text";
5
5
  import { Icon } from "./icon";
6
6
  import { Checkbox } from "./checkbox";
7
7
  import { MenuButton } from "./menu_button";
8
+ import { Button } from "./button";
8
9
  import { TextLink } from "./text_link";
9
10
  import { ActivityIndicator } from "./activity_indicator";
10
11
  import { TextInputField } from "./text_input_field";
@@ -25,6 +26,11 @@ export interface OptionListProps<T extends string = string, MULTI extends boolea
25
26
  accessibilityLabel?: string;
26
27
  selectAllLabel?: string;
27
28
  deselectAllLabel?: string;
29
+ /** Single-select only: unset the value. When provided AND a value is selected, a
30
+ * "Clear" row shows below the options (a real `MenuButton`, so it shares the
31
+ * option rows' height/hover/a11y). Hovering it moves the active highlight OFF
32
+ * the options — hence it lives inside the list, not as a sibling. */
33
+ onClear?: () => void;
28
34
  }
29
35
 
30
36
  /**
@@ -39,7 +45,7 @@ export interface OptionListProps<T extends string = string, MULTI extends boolea
39
45
  export function OptionList<T extends string, MULTI extends boolean = false, D = unknown>(
40
46
  props: OptionListProps<T, MULTI, D>,
41
47
  ) {
42
- const { testID, renderOptionContent, getOptionDescription, loading = false, accessibilityLabel, search } = props;
48
+ const { testID, renderOptionContent, getOptionDescription, loading = false, accessibilityLabel, search, onClear } = props;
43
49
  const loc = useLoticsLocale().optionList;
44
50
  const emptyText = props.emptyText ?? loc.noResults;
45
51
  const selectAllLabel = props.selectAllLabel ?? loc.selectAll;
@@ -47,6 +53,12 @@ export function OptionList<T extends string, MULTI extends boolean = false, D =
47
53
  const list = useOptionList(props);
48
54
  const { small } = useScreenSize();
49
55
 
56
+ // The option rows set `activeIndex` on hover but have no hover-OUT, so entering
57
+ // the Clear footer clears it here — otherwise the last-hovered option stays lit
58
+ // while the pointer is on Clear. RN's types don't declare mouse handlers;
59
+ // rn-web forwards them to the DOM (the boundary cast pressable_row.tsx uses).
60
+ const clearHover = { onMouseEnter: () => list.setActiveIndex(-1, false) } as object;
61
+
50
62
  const onSearchKeyPress = (e: { nativeEvent: { key: string }; preventDefault: () => void }) => {
51
63
  if (list.handleKey(e.nativeEvent.key)) e.preventDefault();
52
64
  };
@@ -157,6 +169,14 @@ export function OptionList<T extends string, MULTI extends boolean = false, D =
157
169
  )}
158
170
  </ScrollView>
159
171
 
172
+ {onClear && !props.multi && list.hasSelection ? (
173
+ // A plain compact Button (matches the inline date picker's footer "Clear"),
174
+ // not a full-width row.
175
+ <View style={styles.clearRow} {...clearHover}>
176
+ <Button title={loc.clear} color="muted" onPress={onClear} />
177
+ </View>
178
+ ) : null}
179
+
160
180
  {list.showSelectAll || list.showDeselectAll ? (
161
181
  <View style={styles.selectAllContainer}>
162
182
  {list.showSelectAll ? <TextLink onPress={list.selectAll}>{selectAllLabel}</TextLink> : null}
@@ -192,6 +212,14 @@ const styles = StyleSheet.create({
192
212
  option: {
193
213
  marginHorizontal: 0,
194
214
  },
215
+ // The single-select "Clear" footer — a left-aligned compact button, set off from
216
+ // the options above by the same hairline the select-all/deselect-all footer uses.
217
+ clearRow: {
218
+ flexDirection: "row",
219
+ paddingTop: 4,
220
+ borderTopWidth: 1,
221
+ borderTopColor: colors.border,
222
+ },
195
223
  statusRow: {
196
224
  alignItems: "center",
197
225
  justifyContent: "center",
@@ -86,6 +86,8 @@ export interface UseOptionList<T extends string, D> {
86
86
  deselectAll: () => void;
87
87
  showSelectAll: boolean;
88
88
  showDeselectAll: boolean;
89
+ /** Whether anything is selected — single: a non-empty value; multi: ≥1. */
90
+ hasSelection: boolean;
89
91
  listboxId: string;
90
92
  scrollRef: React.RefObject<ScrollView | null>;
91
93
  }
@@ -351,6 +353,7 @@ export function useOptionList<T extends string, MULTI extends boolean = false, D
351
353
  deselectAll,
352
354
  showSelectAll,
353
355
  showDeselectAll,
356
+ hasSelection,
354
357
  listboxId,
355
358
  scrollRef,
356
359
  };