@speles7172/controls 0.3.3 → 0.5.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 +38 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/Calendar.d.ts +63 -0
- package/dist/Calendar.d.ts.map +1 -0
- package/dist/Calendar.js +220 -0
- package/dist/Calendar.js.map +1 -0
- package/dist/DateRangeFilter.d.ts +113 -0
- package/dist/DateRangeFilter.d.ts.map +1 -0
- package/dist/DateRangeFilter.js +247 -0
- package/dist/DateRangeFilter.js.map +1 -0
- package/dist/SearchableMultiSelect.d.ts +34 -1
- package/dist/SearchableMultiSelect.d.ts.map +1 -1
- package/dist/SearchableMultiSelect.js +20 -11
- package/dist/SearchableMultiSelect.js.map +1 -1
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/styles.css +319 -11
- package/dist/useAnchoredPopover.d.ts +71 -0
- package/dist/useAnchoredPopover.d.ts.map +1 -0
- package/dist/useAnchoredPopover.js +314 -0
- package/dist/useAnchoredPopover.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Calendar.js","sourceRoot":"","sources":["../src/Calendar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAsB,MAAM,OAAO,CAAC;AAC9F,OAAO,EACL,cAAc,EACd,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,eAAe,EACf,WAAW,GAGZ,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAyD/D,SAAS,UAAU,CACjB,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AC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,QAAQ,GAAG,EAAE,YAErE,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAC5B,GACN,CACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { type DateRangeCalendar, type DateRangeLabels, type DateRangePreset, type DateRangeUnit, type DateRangeValue, type HebrewLanguage } from '@speles7172/controls-client/core';
|
|
2
|
+
import type { ControlTheme } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Every word this control renders, so an application can say them in its own
|
|
5
|
+
* language.
|
|
6
|
+
*
|
|
7
|
+
* An object rather than fifteen props, which is where `SearchableMultiSelect`
|
|
8
|
+
* put its six: past a handful, a flat signature stops being a signature and
|
|
9
|
+
* becomes a list to scroll past. Each field defaults to the English it would
|
|
10
|
+
* otherwise hardcode, so a caller that passes none sees no difference.
|
|
11
|
+
*/
|
|
12
|
+
export interface DateRangeFilterLabels extends DateRangeLabels {
|
|
13
|
+
/** The heading over the list of named ranges. */
|
|
14
|
+
presetsHeading?: string;
|
|
15
|
+
relativeHeading?: string;
|
|
16
|
+
customHeading?: string;
|
|
17
|
+
calendarHeading?: string;
|
|
18
|
+
/** The number box of the "last N" row. */
|
|
19
|
+
amountLabel?: string;
|
|
20
|
+
/** What each unit is called, in the plural the row reads with. */
|
|
21
|
+
units?: Partial<Record<DateRangeUnit, string>>;
|
|
22
|
+
/** The two directions of a relative range. */
|
|
23
|
+
lastLabel?: string;
|
|
24
|
+
nextLabel?: string;
|
|
25
|
+
/** The two ends of a custom range. */
|
|
26
|
+
fromLabel?: string;
|
|
27
|
+
toLabel?: string;
|
|
28
|
+
/** What each calendar is called, for the switch between them. */
|
|
29
|
+
calendars?: Partial<Record<DateRangeCalendar, string>>;
|
|
30
|
+
/** The button that clears the range back to "any time". */
|
|
31
|
+
clearLabel?: string;
|
|
32
|
+
/** The button that closes the popover. */
|
|
33
|
+
doneLabel?: string;
|
|
34
|
+
/** Names the grid and its two steppers, for a screen reader. */
|
|
35
|
+
calendarLabel?: string;
|
|
36
|
+
previousMonthLabel?: string;
|
|
37
|
+
nextMonthLabel?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface DateRangeFilterProps {
|
|
40
|
+
value: DateRangeValue;
|
|
41
|
+
onChange(value: DateRangeValue): void;
|
|
42
|
+
/** The field label, rendered above the control. */
|
|
43
|
+
label?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Which named ranges to offer, in the order they are offered.
|
|
46
|
+
*
|
|
47
|
+
* Defaults to the ones that mean something in the chosen calendar and do not
|
|
48
|
+
* run into the future — a log console filtering by "tomorrow" is offering a
|
|
49
|
+
* range that cannot contain anything. Pass `includeFuture` for a screen about
|
|
50
|
+
* what is *going* to happen, or an explicit list for anything else.
|
|
51
|
+
*/
|
|
52
|
+
presets?: readonly DateRangePreset[];
|
|
53
|
+
includeFuture?: boolean;
|
|
54
|
+
/** Offer an absolute range picked on a calendar. On by default. */
|
|
55
|
+
allowCustom?: boolean;
|
|
56
|
+
/** Offer "the last N hours / days / weeks / months / years". On by default. */
|
|
57
|
+
allowRelative?: boolean;
|
|
58
|
+
/** Which units that row offers. */
|
|
59
|
+
units?: readonly DateRangeUnit[];
|
|
60
|
+
/**
|
|
61
|
+
* The calendars on offer.
|
|
62
|
+
*
|
|
63
|
+
* One calendar and the control simply uses it; two and it renders a switch,
|
|
64
|
+
* which is the shape an organisation that keeps its books by the Hebrew year
|
|
65
|
+
* and reports to a bank by the Gregorian one actually needs.
|
|
66
|
+
*/
|
|
67
|
+
calendars?: readonly DateRangeCalendar[];
|
|
68
|
+
/** Whether Hebrew months and dates are written in Hebrew or transliterated. */
|
|
69
|
+
hebrewLanguage?: HebrewLanguage;
|
|
70
|
+
/** For the Gregorian grid's month and weekday names. */
|
|
71
|
+
locale?: string;
|
|
72
|
+
/** 0 is Sunday, and is the default. */
|
|
73
|
+
weekStartsOn?: number;
|
|
74
|
+
/** Days outside these bounds cannot be picked. */
|
|
75
|
+
min?: string;
|
|
76
|
+
max?: string;
|
|
77
|
+
/** Which day the grid marks as today. Defaults to the machine's. */
|
|
78
|
+
today?: string;
|
|
79
|
+
/** Offer "any time", which is a range over everything. On by default. */
|
|
80
|
+
clearable?: boolean;
|
|
81
|
+
labels?: DateRangeFilterLabels;
|
|
82
|
+
disabled?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Emit the value as a hidden input under this name, so the control works
|
|
85
|
+
* inside a plain `<form>` that reads `FormData`. It is the same token
|
|
86
|
+
* `serializeDateRange` produces, which is what the endpoint parses.
|
|
87
|
+
*/
|
|
88
|
+
name?: string;
|
|
89
|
+
className?: string;
|
|
90
|
+
theme?: ControlTheme;
|
|
91
|
+
'data-testid'?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A date range, as one control.
|
|
95
|
+
*
|
|
96
|
+
* The filter every screen in this organisation was building out of two date
|
|
97
|
+
* inputs and a `<select>` of "last 7 days" — which is three controls that have
|
|
98
|
+
* to agree with each other, one of which is a native picker nobody can restyle
|
|
99
|
+
* and none of which knows what a Hebrew month is.
|
|
100
|
+
*
|
|
101
|
+
* What it holds is a {@link DateRangeValue}: a *description* of a range rather
|
|
102
|
+
* than two instants, so that "this month" is still this month tomorrow, and so
|
|
103
|
+
* that the endpoint behind the screen resolves the same words to the same two
|
|
104
|
+
* timestamps. `@speles7172/controls-client` compiles the `WHERE`. Everything
|
|
105
|
+
* about which instants those are — the time zone, the calendar, whether a week
|
|
106
|
+
* starts on Sunday — is settled in one place, `resolveDateRange`, and the
|
|
107
|
+
* reasoning is written up there.
|
|
108
|
+
*
|
|
109
|
+
* Markup is plain semantic HTML with `ctl-` class names and no styling
|
|
110
|
+
* dependency, the same as every other control here.
|
|
111
|
+
*/
|
|
112
|
+
export declare function DateRangeFilter({ value, onChange, label, presets, includeFuture, allowCustom, allowRelative, units, calendars, hebrewLanguage, locale, weekStartsOn, min, max, today, clearable, labels, disabled, name, className, theme, 'data-testid': testId, }: DateRangeFilterProps): import("react").JSX.Element;
|
|
113
|
+
//# sourceMappingURL=DateRangeFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateRangeFilter.d.ts","sourceRoot":"","sources":["../src/DateRangeFilter.tsx"],"names":[],"mappings":"AACA,OAAO,EASL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,kCAAkC,CAAC;AAI1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAA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AAO,EACP,aAAqB,EACrB,WAAkB,EAClB,aAAoB,EACpB,KAAqB,EACrB,SAAyB,EACzB,cAAqB,EACrB,MAAM,EACN,YAAgB,EAChB,GAAG,EACH,GAAG,EACH,KAAK,EACL,SAAgB,EAChB,MAAW,EACX,QAAgB,EAChB,IAAI,EACJ,SAAS,EACT,KAAe,EACf,aAAa,EAAE,MAAM,GACtB,EAAE,oBAAoB,+BAqVtB"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useId, useRef, useState } from 'react';
|
|
3
|
+
import { MAX_RELATIVE_AMOUNT, describeDateRange, fixedFromIso, formatHebrewDate, hebrewFromFixed, isSameDateRange, presetsFor, serializeDateRange, } from '@speles7172/controls-client/core';
|
|
4
|
+
import { Calendar } from './Calendar.js';
|
|
5
|
+
import { ChevronDownIcon, ICON_SIZE, ScheduleIcon } from './icons.js';
|
|
6
|
+
import { useAnchoredPopover } from './useAnchoredPopover.js';
|
|
7
|
+
const DEFAULT_UNITS = ['hour', 'day', 'week', 'month', 'year'];
|
|
8
|
+
const DEFAULT_UNIT_LABELS = {
|
|
9
|
+
hour: 'hours',
|
|
10
|
+
day: 'days',
|
|
11
|
+
week: 'weeks',
|
|
12
|
+
month: 'months',
|
|
13
|
+
year: 'years',
|
|
14
|
+
};
|
|
15
|
+
const DEFAULT_CALENDAR_LABELS = {
|
|
16
|
+
gregorian: 'Gregorian',
|
|
17
|
+
hebrew: 'Hebrew',
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* A date range, as one control.
|
|
21
|
+
*
|
|
22
|
+
* The filter every screen in this organisation was building out of two date
|
|
23
|
+
* inputs and a `<select>` of "last 7 days" — which is three controls that have
|
|
24
|
+
* to agree with each other, one of which is a native picker nobody can restyle
|
|
25
|
+
* and none of which knows what a Hebrew month is.
|
|
26
|
+
*
|
|
27
|
+
* What it holds is a {@link DateRangeValue}: a *description* of a range rather
|
|
28
|
+
* than two instants, so that "this month" is still this month tomorrow, and so
|
|
29
|
+
* that the endpoint behind the screen resolves the same words to the same two
|
|
30
|
+
* timestamps. `@speles7172/controls-client` compiles the `WHERE`. Everything
|
|
31
|
+
* about which instants those are — the time zone, the calendar, whether a week
|
|
32
|
+
* starts on Sunday — is settled in one place, `resolveDateRange`, and the
|
|
33
|
+
* reasoning is written up there.
|
|
34
|
+
*
|
|
35
|
+
* Markup is plain semantic HTML with `ctl-` class names and no styling
|
|
36
|
+
* dependency, the same as every other control here.
|
|
37
|
+
*/
|
|
38
|
+
export function DateRangeFilter({ value, onChange, label, presets, includeFuture = false, allowCustom = true, allowRelative = true, units = DEFAULT_UNITS, calendars = ['gregorian'], hebrewLanguage = 'he', locale, weekStartsOn = 0, min, max, today, clearable = true, labels = {}, disabled = false, name, className, theme = 'light', 'data-testid': testId, }) {
|
|
39
|
+
const ids = useId();
|
|
40
|
+
const rootRef = useRef(null);
|
|
41
|
+
const [open, setOpen] = useState(false);
|
|
42
|
+
const popoverRef = useAnchoredPopover(open, rootRef);
|
|
43
|
+
/**
|
|
44
|
+
* Which calendar is on screen.
|
|
45
|
+
*
|
|
46
|
+
* Read off the value first, because the value is the thing that travels — a
|
|
47
|
+
* link carrying `this_month@hebrew` has to open in Hebrew. A Gregorian value
|
|
48
|
+
* carries no tag at all (that is what keeps the token clean), so the switch's
|
|
49
|
+
* own state is what remembers a deliberate switch *back*.
|
|
50
|
+
*/
|
|
51
|
+
const [chosen, setChosen] = useState(null);
|
|
52
|
+
const calendar = (value.kind === 'all' ? undefined : value.calendar) ?? chosen ?? calendars[0] ?? 'gregorian';
|
|
53
|
+
/**
|
|
54
|
+
* The half-picked custom range.
|
|
55
|
+
*
|
|
56
|
+
* Held here rather than pushed through `onChange` on the first click: a range
|
|
57
|
+
* with only one end is not a filter anybody asked for, and emitting it would
|
|
58
|
+
* reload the screen behind the popover with a range over everything since
|
|
59
|
+
* that day.
|
|
60
|
+
*/
|
|
61
|
+
const [draft, setDraft] = useState(() => draftOf(value));
|
|
62
|
+
/**
|
|
63
|
+
* …and re-derived when the value is changed from outside.
|
|
64
|
+
*
|
|
65
|
+
* A "clear filters" button, a link opened into the page, a second control
|
|
66
|
+
* resetting the range — the host writes a new value and this draft would
|
|
67
|
+
* otherwise still hold the last one. That is not only a stale highlight in
|
|
68
|
+
* the grid: the next edit of one bound emits `{ from: <the old day>, to:
|
|
69
|
+
* <the new one> }`, a range nobody picked, from a control that looked right.
|
|
70
|
+
*
|
|
71
|
+
* During the render rather than in an effect, for the reason
|
|
72
|
+
* `<RoutingConsole>` gives at length: an effect runs after paint, so the
|
|
73
|
+
* stale draft is briefly on screen and briefly clickable. Compared by what
|
|
74
|
+
* the value *is* rather than by identity, so a host that rebuilds an equal
|
|
75
|
+
* literal every render does not wipe a range being picked.
|
|
76
|
+
*/
|
|
77
|
+
const [seen, setSeen] = useState(value);
|
|
78
|
+
if (!isSameDateRange(seen, value)) {
|
|
79
|
+
setSeen(value);
|
|
80
|
+
setDraft(draftOf(value));
|
|
81
|
+
}
|
|
82
|
+
const commit = useCallback((next) => {
|
|
83
|
+
onChange(next);
|
|
84
|
+
setOpen(false);
|
|
85
|
+
}, [onChange]);
|
|
86
|
+
/** The calendar tag, written only when it is not the default. */
|
|
87
|
+
const tag = calendar === 'gregorian' ? {} : { calendar };
|
|
88
|
+
const choosePreset = (preset) => commit({ kind: 'preset', preset, ...tag });
|
|
89
|
+
const chooseRelative = (amount, unit, direction) => {
|
|
90
|
+
// Not closed: the amount and the unit are two decisions, and closing on the
|
|
91
|
+
// first of them is a control that has to be reopened to finish a sentence.
|
|
92
|
+
onChange({ kind: direction, amount, unit, ...tag });
|
|
93
|
+
};
|
|
94
|
+
const chooseDay = (iso) => {
|
|
95
|
+
// The first click starts a range and the second finishes it; a third starts
|
|
96
|
+
// a new one, which is what a picker with two ends can do with one gesture.
|
|
97
|
+
if (draft.from === null || draft.to !== null) {
|
|
98
|
+
setDraft({ from: iso, to: null });
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const [from, to] = iso < draft.from ? [iso, draft.from] : [draft.from, iso];
|
|
102
|
+
setDraft({ from, to });
|
|
103
|
+
commit({ kind: 'custom', from, to, ...tag });
|
|
104
|
+
};
|
|
105
|
+
const setBound = (side, iso) => {
|
|
106
|
+
const next = { ...draft, [side]: iso === '' ? null : iso };
|
|
107
|
+
setDraft(next);
|
|
108
|
+
if (next.from === null && next.to === null)
|
|
109
|
+
return;
|
|
110
|
+
onChange({ kind: 'custom', from: next.from, to: next.to, ...tag });
|
|
111
|
+
};
|
|
112
|
+
const switchCalendar = (next) => {
|
|
113
|
+
setChosen(next);
|
|
114
|
+
const nextTag = next === 'gregorian' ? {} : { calendar: next };
|
|
115
|
+
// The same range, counted in the other calendar. Re-emitted rather than
|
|
116
|
+
// cleared, because "this month" in one calendar is a sentence in the other
|
|
117
|
+
// — and a custom range's days are Gregorian ISO whichever calendar picked
|
|
118
|
+
// them, so they survive the switch untouched and only their labels change.
|
|
119
|
+
switch (value.kind) {
|
|
120
|
+
case 'preset':
|
|
121
|
+
onChange({ kind: 'preset', preset: value.preset, ...nextTag });
|
|
122
|
+
break;
|
|
123
|
+
case 'last':
|
|
124
|
+
case 'next':
|
|
125
|
+
onChange({ kind: value.kind, amount: value.amount, unit: value.unit, ...nextTag });
|
|
126
|
+
break;
|
|
127
|
+
case 'custom':
|
|
128
|
+
onChange({ kind: 'custom', from: value.from, to: value.to, ...nextTag });
|
|
129
|
+
break;
|
|
130
|
+
case 'all':
|
|
131
|
+
// Nothing to re-count, and nowhere on the value to record the choice —
|
|
132
|
+
// which is what `chosen` above is for.
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
/** Close on a click elsewhere, the same way the pickers do. */
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (!open)
|
|
139
|
+
return;
|
|
140
|
+
const onPointerDown = (event) => {
|
|
141
|
+
if (rootRef.current !== null && !rootRef.current.contains(event.target)) {
|
|
142
|
+
setOpen(false);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
document.addEventListener('mousedown', onPointerDown);
|
|
146
|
+
return () => document.removeEventListener('mousedown', onPointerDown);
|
|
147
|
+
}, [open]);
|
|
148
|
+
const onKeyDown = (event) => {
|
|
149
|
+
if (event.key === 'Escape' && open) {
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
setOpen(false);
|
|
152
|
+
// Focus goes back to the trigger, or Escape leaves the keyboard nowhere.
|
|
153
|
+
rootRef.current?.querySelector('.ctl-trigger')?.focus();
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const offered = presets ??
|
|
157
|
+
presetsFor(calendar, { includeFuture }).map((entry) => entry.id);
|
|
158
|
+
const describe = (candidate) => describeDateRange(candidate, {
|
|
159
|
+
...(labels.presets === undefined ? {} : { labels: { presets: labels.presets } }),
|
|
160
|
+
language: hebrewLanguage,
|
|
161
|
+
});
|
|
162
|
+
const summary = describeDateRange(value, { labels, language: hebrewLanguage });
|
|
163
|
+
return (_jsxs("div", { ref: rootRef, className: `ctl ctl-daterange${className === undefined ? '' : ` ${className}`}`, "data-ctl-theme": theme, "data-testid": testId, onKeyDown: onKeyDown, children: [label !== undefined && (_jsx("span", { className: "ctl-label", id: `${ids}-label`, children: label })), _jsxs("button", { type: "button", className: "ctl-trigger", disabled: disabled, "aria-haspopup": "dialog", "aria-expanded": open, "aria-labelledby": `${label === undefined ? '' : `${ids}-label `}${ids}-value`, onClick: () => setOpen(!open), "data-testid": testId === undefined ? undefined : `${testId}-trigger`, children: [_jsx("span", { className: "ctl-daterange-icon", "aria-hidden": "true", children: _jsx(ScheduleIcon, { size: ICON_SIZE }) }), _jsx("span", { id: `${ids}-value`, className: "ctl-value", children: summary }), _jsx("span", { className: "ctl-trigger-icons", children: _jsx("span", { "aria-hidden": "true", className: "ctl-caret", children: _jsx(ChevronDownIcon, { size: ICON_SIZE }) }) })] }), open && (_jsxs("div", { className: "ctl-popover ctl-daterange-popover", ref: popoverRef, role: "dialog", "aria-label": label ?? labels.calendarLabel, children: [_jsxs("div", { className: "ctl-daterange-panels", children: [offered.length > 0 && (_jsxs("div", { className: "ctl-daterange-presets", children: [labels.presetsHeading !== undefined && (_jsx("p", { className: "ctl-group-label", children: labels.presetsHeading })), _jsxs("ul", { className: "ctl-daterange-preset-list", children: [offered.map((preset) => {
|
|
164
|
+
const candidate = { kind: 'preset', preset, ...tag };
|
|
165
|
+
return (_jsx("li", { children: _jsx("button", { type: "button", className: "ctl-daterange-preset", "aria-pressed": isSameDateRange(value, candidate), onClick: () => choosePreset(preset), "data-testid": testId === undefined ? undefined : `${testId}-preset-${preset}`, children: describe(candidate) }) }, preset));
|
|
166
|
+
}), clearable && (_jsx("li", { children: _jsx("button", { type: "button", className: "ctl-daterange-preset", "aria-pressed": value.kind === 'all', onClick: () => commit({ kind: 'all' }), "data-testid": testId === undefined ? undefined : `${testId}-clear`, children: labels.clearLabel ?? labels.all ?? 'Any time' }) }))] })] })), _jsxs("div", { className: "ctl-daterange-detail", children: [calendars.length > 1 && (_jsx("div", { className: "ctl-daterange-row", role: "group", "aria-label": labels.calendarHeading, children: calendars.map((entry) => (_jsx("button", { type: "button", className: "ctl-daterange-chip", "aria-pressed": entry === calendar, onClick: () => switchCalendar(entry), "data-testid": testId === undefined ? undefined : `${testId}-calendar-${entry}`, children: labels.calendars?.[entry] ?? DEFAULT_CALENDAR_LABELS[entry] }, entry))) })), allowRelative && (_jsx(RelativeRow, { value: value, units: units, labels: labels, includeFuture: includeFuture, ids: ids, onChoose: chooseRelative, testId: testId })), allowCustom && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "ctl-daterange-row", children: [_jsxs("label", { className: "ctl-daterange-field", children: [_jsx("span", { className: "ctl-label", children: labels.fromLabel ?? 'From' }), _jsx(BoundInput, { iso: draft.from, calendar: calendar, language: hebrewLanguage, ...(min === undefined ? {} : { min }), ...(max === undefined ? {} : { max }), onChange: (iso) => setBound('from', iso), testId: testId === undefined ? undefined : `${testId}-from` })] }), _jsxs("label", { className: "ctl-daterange-field", children: [_jsx("span", { className: "ctl-label", children: labels.toLabel ?? 'To' }), _jsx(BoundInput, { iso: draft.to, calendar: calendar, language: hebrewLanguage, ...(min === undefined ? {} : { min }), ...(max === undefined ? {} : { max }), onChange: (iso) => setBound('to', iso), testId: testId === undefined ? undefined : `${testId}-to` })] })] }), _jsx(Calendar, { calendar: calendar, hebrewLanguage: hebrewLanguage, ...(locale === undefined ? {} : { locale }), from: draft.from, to: draft.to, onSelect: chooseDay, ...(min === undefined ? {} : { min }), ...(max === undefined ? {} : { max }), ...(today === undefined ? {} : { today }), weekStartsOn: weekStartsOn, ...(labels.calendarLabel === undefined ? {} : { label: labels.calendarLabel }), ...(labels.previousMonthLabel === undefined
|
|
167
|
+
? {}
|
|
168
|
+
: { previousLabel: labels.previousMonthLabel }), ...(labels.nextMonthLabel === undefined
|
|
169
|
+
? {}
|
|
170
|
+
: { nextLabel: labels.nextMonthLabel }), theme: theme, ...(testId === undefined ? {} : { 'data-testid': `${testId}-calendar` }) })] }))] })] }), _jsxs("div", { className: "ctl-popover-footer", children: [clearable && value.kind !== 'all' && (_jsx("button", { type: "button", className: "ctl-link", onClick: () => {
|
|
171
|
+
setDraft({ from: null, to: null });
|
|
172
|
+
commit({ kind: 'all' });
|
|
173
|
+
}, children: labels.clearLabel ?? 'Clear' })), _jsx("button", { type: "button", className: "ctl-link", onClick: () => setOpen(false), children: labels.doneLabel ?? 'Done' })] })] })), name !== undefined && _jsx("input", { type: "hidden", name: name, value: serializeDateRange(value) })] }));
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* "The last N days", as a number and a unit.
|
|
177
|
+
*
|
|
178
|
+
* The amount is held as *text* rather than as a number, because a number input
|
|
179
|
+
* is empty for a moment while somebody replaces what is in it — and a control
|
|
180
|
+
* that reads that moment as zero rewrites the field under the cursor, which is
|
|
181
|
+
* the single most irritating thing a form can do.
|
|
182
|
+
*/
|
|
183
|
+
function RelativeRow({ value, units, labels, includeFuture, ids, onChoose, testId, }) {
|
|
184
|
+
const relative = value.kind === 'last' || value.kind === 'next' ? value : null;
|
|
185
|
+
const incoming = relative === null ? null : String(relative.amount);
|
|
186
|
+
const [amount, setAmount] = useState(incoming ?? '7');
|
|
187
|
+
/*
|
|
188
|
+
* The box follows the value when the value moves under it — a host loading a
|
|
189
|
+
* saved filter of `last:30d` must not leave a 7 in the field the next click
|
|
190
|
+
* on a unit would then apply. Compared against the last incoming amount
|
|
191
|
+
* rather than against what is typed, so clearing the box (see above) is not
|
|
192
|
+
* immediately undone, and so a host that ignores `onChange` does not fight
|
|
193
|
+
* the cursor.
|
|
194
|
+
*/
|
|
195
|
+
const [seenAmount, setSeenAmount] = useState(incoming);
|
|
196
|
+
if (incoming !== null && incoming !== seenAmount) {
|
|
197
|
+
setSeenAmount(incoming);
|
|
198
|
+
setAmount(incoming);
|
|
199
|
+
}
|
|
200
|
+
const unit = relative?.unit ?? units[0] ?? 'day';
|
|
201
|
+
const direction = value.kind === 'next' ? 'next' : 'last';
|
|
202
|
+
const parsed = Math.min(Math.max(Math.trunc(Number(amount)), 1), MAX_RELATIVE_AMOUNT);
|
|
203
|
+
const usable = Number.isFinite(Number(amount)) && amount.trim() !== '';
|
|
204
|
+
/*
|
|
205
|
+
* "Last [7] [days]" is a sentence, and the row needs its first word: with the
|
|
206
|
+
* direction chips hidden — which is the common case, since most filters look
|
|
207
|
+
* backwards — a number box beside a row of units says nothing about what it
|
|
208
|
+
* is counting. Where both directions are offered, the chips are that word.
|
|
209
|
+
*/
|
|
210
|
+
const heading = labels.relativeHeading ?? (includeFuture ? undefined : (labels.lastLabel ?? 'Last'));
|
|
211
|
+
return (_jsxs("div", { className: "ctl-daterange-relative", children: [heading !== undefined && _jsx("p", { className: "ctl-group-label", children: heading }), _jsxs("div", { className: "ctl-daterange-row", children: [includeFuture && (_jsx("div", { className: "ctl-daterange-directions", role: "group", children: ['last', 'next'].map((entry) => (_jsx("button", { type: "button", className: "ctl-daterange-chip", "aria-pressed": relative !== null && direction === entry, onClick: () => usable && onChoose(parsed, unit, entry), "data-testid": testId === undefined ? undefined : `${testId}-direction-${entry}`, children: entry === 'last' ? (labels.lastLabel ?? 'Last') : (labels.nextLabel ?? 'Next') }, entry))) })), _jsx("input", { type: "number", className: "ctl-input ctl-daterange-amount", id: `${ids}-amount`, min: 1, max: MAX_RELATIVE_AMOUNT, value: amount, "aria-label": labels.amountLabel ?? labels.lastLabel ?? 'Last', onChange: (event) => {
|
|
212
|
+
setAmount(event.target.value);
|
|
213
|
+
const next = Number(event.target.value);
|
|
214
|
+
if (event.target.value.trim() !== '' && Number.isFinite(next) && next >= 1) {
|
|
215
|
+
onChoose(Math.min(Math.trunc(next), MAX_RELATIVE_AMOUNT), unit, direction);
|
|
216
|
+
}
|
|
217
|
+
}, "data-testid": testId === undefined ? undefined : `${testId}-amount` }), _jsx("div", { className: "ctl-daterange-units", role: "group", children: units.map((entry) => (_jsx("button", { type: "button", className: "ctl-daterange-chip", "aria-pressed": relative !== null && entry === unit, onClick: () => usable && onChoose(parsed, entry, direction), "data-testid": testId === undefined ? undefined : `${testId}-unit-${entry}`, children: labels.units?.[entry] ?? DEFAULT_UNIT_LABELS[entry] }, entry))) })] })] }));
|
|
218
|
+
}
|
|
219
|
+
/** The two ends a value contributes to the picker, which only a custom one has. */
|
|
220
|
+
function draftOf(value) {
|
|
221
|
+
return value.kind === 'custom' ? { from: value.from, to: value.to } : { from: null, to: null };
|
|
222
|
+
}
|
|
223
|
+
/** That day, written the way the Hebrew calendar writes it. */
|
|
224
|
+
function hebrewText(iso, language) {
|
|
225
|
+
const fixed = fixedFromIso(iso);
|
|
226
|
+
return fixed === null ? iso : formatHebrewDate(hebrewFromFixed(fixed), { language });
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* One end of a custom range.
|
|
230
|
+
*
|
|
231
|
+
* A native `<input type="date">` in Gregorian mode — it is the control the
|
|
232
|
+
* browser and the platform already agree on, it has a keyboard and a locale
|
|
233
|
+
* this package could not improve on, and typing a date is faster than clicking
|
|
234
|
+
* one for anybody who knows which date they want.
|
|
235
|
+
*
|
|
236
|
+
* In Hebrew mode there is no native equivalent, and a text box would need a
|
|
237
|
+
* parser for `ט״ו בשבט תשפ״ו` — including the several ways people abbreviate
|
|
238
|
+
* it. So it shows the date and the grid below sets it, which is honest about
|
|
239
|
+
* what it can do. The clear button is what keeps an end removable without one.
|
|
240
|
+
*/
|
|
241
|
+
function BoundInput({ iso, calendar, language, min, max, onChange, testId, }) {
|
|
242
|
+
if (calendar === 'gregorian') {
|
|
243
|
+
return (_jsx("input", { type: "date", className: "ctl-input", value: iso ?? '', min: min, max: max, onChange: (event) => onChange(event.target.value), "data-testid": testId }));
|
|
244
|
+
}
|
|
245
|
+
return (_jsx("input", { type: "text", className: "ctl-input", readOnly: true, value: iso === null ? '' : hebrewText(iso, language), "data-testid": testId }));
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=DateRangeFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateRangeFilter.js","sourceRoot":"","sources":["../src/DateRangeFilter.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAsB,MAAM,OAAO,CAAC;AAC5F,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,UAAU,EACV,kBAAkB,GAOnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AA+F7D,MAAM,aAAa,GAA6B,CAAC,MAAM,EA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jG,CAAC;AAED,+DAA+D;AAC/D,SAAS,UAAU,CAAC,GAAW,EAAE,QAAwB;IACvD,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IAChC,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAgB,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;AACvF,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,UAAU,CAAC,EAClB,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,GAAG,EACH,QAAQ,EACR,MAAM,GASP;IACC,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;QAC7B,OAAO,CACL,gBACE,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,WAAW,EACrB,KAAK,EAAE,GAAG,IAAI,EAAE,EAChB,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,iBACpC,MAAM,GACnB,CACH,CAAC;IACJ,CAAC;IAED,OAAO,CACL,gBACE,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,WAAW,EACrB,QAAQ,QACR,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,iBACvC,MAAM,GACnB,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -36,6 +36,39 @@ export interface SearchableMultiSelectProps extends UseOptionSelectOptions {
|
|
|
36
36
|
* you how many you picked and not one of what they were — and re-opening the
|
|
37
37
|
* list to find out is the thing that makes multi-selects tiring.
|
|
38
38
|
*/
|
|
39
|
+
/**
|
|
40
|
+
* The footer link that loads the next page of options.
|
|
41
|
+
*
|
|
42
|
+
* These six exist for the same reason as the labels above them: this control
|
|
43
|
+
* renders text, and an application that does not read English cannot
|
|
44
|
+
* translate a string compiled into the bundle. Each defaults to the English
|
|
45
|
+
* it used to hardcode, so nothing changes for a caller that ignores them.
|
|
46
|
+
*/
|
|
47
|
+
showMoreLabel?: string;
|
|
48
|
+
/** The footer link that selects every option currently listed. */
|
|
49
|
+
selectListedLabel?: string;
|
|
50
|
+
/** The footer link that clears the selection. Distinct from `clearLabel`, which names the trigger's own clear button. */
|
|
51
|
+
clearAllLabel?: string;
|
|
52
|
+
/** The link offered beside a failed search. */
|
|
53
|
+
retryLabel?: string;
|
|
54
|
+
/** Shown while the first page of a search is in flight. */
|
|
55
|
+
loadingLabel?: string;
|
|
56
|
+
/** Shown when a search returns nothing. */
|
|
57
|
+
emptyLabel?: string;
|
|
58
|
+
/**
|
|
59
|
+
* What the trigger says when several values are selected, given how many.
|
|
60
|
+
*
|
|
61
|
+
* A function, and for the reason `removeLabel` is one: a count inside a
|
|
62
|
+
* sentence is the translation's business — where the number goes, and what
|
|
63
|
+
* agrees with it, is not this component's decision.
|
|
64
|
+
*/
|
|
65
|
+
selectedLabel?(count: number): string;
|
|
66
|
+
/**
|
|
67
|
+
* What the list says while the term is shorter than `minSearchLength`, given
|
|
68
|
+
* that minimum. A function for the same reason as `selectedLabel`, with the
|
|
69
|
+
* added one that English pluralises on the number and many languages do not.
|
|
70
|
+
*/
|
|
71
|
+
minSearchLabel?(minLength: number): string;
|
|
39
72
|
chips?: boolean;
|
|
40
73
|
/**
|
|
41
74
|
* Emit hidden inputs under this name, so the control works inside a plain
|
|
@@ -65,5 +98,5 @@ export interface SearchableMultiSelectProps extends UseOptionSelectOptions {
|
|
|
65
98
|
* or write your own against the same classes. An application with its own
|
|
66
99
|
* design system should use {@link useOptionSelect} directly.
|
|
67
100
|
*/
|
|
68
|
-
export declare function SearchableMultiSelect({ label, placeholder, searchPlaceholder, clearLabel, searchLabel, removeLabel, chips, name, className, theme, renderOption, 'data-testid': testId, ...options }: SearchableMultiSelectProps): import("react").JSX.Element;
|
|
101
|
+
export declare function SearchableMultiSelect({ label, placeholder, searchPlaceholder, clearLabel, searchLabel, removeLabel, showMoreLabel, selectListedLabel, clearAllLabel, retryLabel, loadingLabel, emptyLabel, selectedLabel, minSearchLabel, chips, name, className, theme, renderOption, 'data-testid': testId, ...options }: SearchableMultiSelectProps): import("react").JSX.Element;
|
|
69
102
|
//# sourceMappingURL=SearchableMultiSelect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchableMultiSelect.d.ts","sourceRoot":"","sources":["../src/SearchableMultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6D,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchableMultiSelect.d.ts","sourceRoot":"","sources":["../src/SearchableMultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6D,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlG,OAAO,EAA2C,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC5G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;IACxE,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,WAAW,CAAC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1C;;;;;;OAMG;IACH;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,yHAAyH;IACzH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC;;;;OAIG;IACH,cAAc,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,8EAA8E;IAC9E,YAAY,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACvD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,WAAmB,EACnB,iBAA6B,EAC7B,UAA8B,EAC9B,WAAW,EACX,WAA8D,EAC9D,aAA2B,EAC3B,iBAAkC,EAClC,aAAuB,EACvB,UAAoB,EACpB,YAA2B,EAC3B,UAA0B,EAC1B,aAAsD,EACtD,cACgF,EAChF,KAAK,EACL,IAAI,EACJ,SAAS,EACT,KAAe,EACf,YAAY,EACZ,aAAa,EAAE,MAAM,EACrB,GAAG,OAAO,EACX,EAAE,0BAA0B,+BAoP5B"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useCallback, useEffect, useId, useRef } from 'react';
|
|
3
3
|
import { groupOptions, highlightParts } from '@speles7172/controls-client/core';
|
|
4
4
|
import { CheckedIcon, ChevronDownIcon, CloseIcon, UncheckedIcon, ICON_SIZE } from './icons.js';
|
|
5
|
+
import { useAnchoredPopover } from './useAnchoredPopover.js';
|
|
5
6
|
import { useOptionSelect } from './useOptionSelect.js';
|
|
6
7
|
/**
|
|
7
8
|
* A multi-select you can search.
|
|
@@ -17,13 +18,21 @@ import { useOptionSelect } from './useOptionSelect.js';
|
|
|
17
18
|
* or write your own against the same classes. An application with its own
|
|
18
19
|
* design system should use {@link useOptionSelect} directly.
|
|
19
20
|
*/
|
|
20
|
-
export function SearchableMultiSelect({ label, placeholder = 'All', searchPlaceholder = 'Search…', clearLabel = 'Clear selection', searchLabel, removeLabel = (optionLabel) => `Remove ${optionLabel}`, chips, name, className, theme = 'light', renderOption, 'data-testid': testId, ...options }) {
|
|
21
|
+
export function SearchableMultiSelect({ label, placeholder = 'All', searchPlaceholder = 'Search…', clearLabel = 'Clear selection', searchLabel, removeLabel = (optionLabel) => `Remove ${optionLabel}`, showMoreLabel = 'Show more', selectListedLabel = 'Select these', clearAllLabel = 'Clear', retryLabel = 'Retry', loadingLabel = 'Searching…', emptyLabel = 'No matches.', selectedLabel = (count) => `${count} selected`, minSearchLabel = (minLength) => `Type at least ${minLength} character${minLength === 1 ? '' : 's'} to search.`, chips, name, className, theme = 'light', renderOption, 'data-testid': testId, ...options }) {
|
|
21
22
|
const state = useOptionSelect(options);
|
|
22
23
|
const ids = useId();
|
|
23
24
|
const rootRef = useRef(null);
|
|
24
25
|
const searchRef = useRef(null);
|
|
25
26
|
const listRef = useRef(null);
|
|
26
27
|
const { open, setOpen, activeIndex } = state;
|
|
28
|
+
/*
|
|
29
|
+
* Placed against the control in viewport coordinates rather than laid out
|
|
30
|
+
* under it, so the list is not part of whatever scrolls around the control —
|
|
31
|
+
* a dialog body, most of all. It watches the popover's own size, so a
|
|
32
|
+
* transport's first page landing re-places a list that was measured while it
|
|
33
|
+
* still said "Searching…". See `useAnchoredPopover`.
|
|
34
|
+
*/
|
|
35
|
+
const popoverRef = useAnchoredPopover(open, rootRef);
|
|
27
36
|
const showChips = chips ?? !options.single;
|
|
28
37
|
/** Close on a click elsewhere, or on Escape from anywhere in the control. */
|
|
29
38
|
useEffect(() => {
|
|
@@ -110,31 +119,31 @@ export function SearchableMultiSelect({ label, placeholder = 'All', searchPlaceh
|
|
|
110
119
|
break;
|
|
111
120
|
}
|
|
112
121
|
}, [open, setOpen, state]);
|
|
113
|
-
const summary = summarize(state.selected, placeholder, options.single === true);
|
|
122
|
+
const summary = summarize(state.selected, placeholder, options.single === true, selectedLabel);
|
|
114
123
|
return (_jsxs("div", { ref: rootRef, className: `ctl ctl-select${className === undefined ? '' : ` ${className}`}`, "data-ctl-theme": theme, "data-testid": testId, onKeyDown: onKeyDown, children: [label !== undefined && (_jsx("span", { className: "ctl-label", id: `${ids}-label`, children: label })), _jsxs("button", { type: "button", className: "ctl-trigger", disabled: state.disabled, "aria-haspopup": "listbox", "aria-expanded": open, "aria-controls": `${ids}-list`, "aria-labelledby": `${label === undefined ? '' : `${ids}-label `}${ids}-value`, onClick: () => setOpen(!open), "data-testid": testId === undefined ? undefined : `${testId}-trigger`, children: [_jsx("span", { id: `${ids}-value`, className: `ctl-value${state.selected.length === 0 ? ' ctl-muted' : ''}`, children: summary }), _jsxs("span", { className: "ctl-trigger-icons", children: [state.selected.length > 0 && !state.disabled && state.clearable && (_jsx("span", { role: "button", tabIndex: -1, className: "ctl-icon-button", "aria-label": clearLabel, title: clearLabel, onClick: (event) => {
|
|
115
124
|
// The clear sits inside the trigger, so without this it opens
|
|
116
125
|
// the popover it just emptied.
|
|
117
126
|
event.stopPropagation();
|
|
118
127
|
state.clear();
|
|
119
|
-
}, children: _jsx(CloseIcon, { size: 14, "aria-hidden": "true" }) })), _jsx("span", { "aria-hidden": "true", className: "ctl-caret", children: _jsx(ChevronDownIcon, { size: ICON_SIZE }) })] })] }), showChips && state.selected.length > 1 && (_jsx("ul", { className: "ctl-chips", "data-testid": testId === undefined ? undefined : `${testId}-chips`, children: state.selected.map((option) => (_jsxs("li", { className: "ctl-chip", children: [_jsx("span", { className: "ctl-chip-label", title: option.description ?? option.label, children: option.label }), _jsx("button", { type: "button", className: "ctl-chip-remove", "aria-label": removeLabel(option.label), disabled: state.disabled, onClick: () => state.toggle(option.value), children: _jsx(CloseIcon, { size: 12, "aria-hidden": "true" }) })] }, option.value))) })), open && (_jsxs("div", { className: "ctl-popover", children: [_jsx("div", { className: "ctl-search", children: _jsx("input", { ref: searchRef, type: "text", className: "ctl-search-input", value: state.term, placeholder: searchPlaceholder, "aria-label": searchLabel ?? (label === undefined ? 'Search options' : `Search ${label}`),
|
|
128
|
+
}, children: _jsx(CloseIcon, { size: 14, "aria-hidden": "true" }) })), _jsx("span", { "aria-hidden": "true", className: "ctl-caret", children: _jsx(ChevronDownIcon, { size: ICON_SIZE }) })] })] }), showChips && state.selected.length > 1 && (_jsx("ul", { className: "ctl-chips", "data-testid": testId === undefined ? undefined : `${testId}-chips`, children: state.selected.map((option) => (_jsxs("li", { className: "ctl-chip", children: [_jsx("span", { className: "ctl-chip-label", title: option.description ?? option.label, children: option.label }), _jsx("button", { type: "button", className: "ctl-chip-remove", "aria-label": removeLabel(option.label), disabled: state.disabled, onClick: () => state.toggle(option.value), children: _jsx(CloseIcon, { size: 12, "aria-hidden": "true" }) })] }, option.value))) })), open && (_jsxs("div", { className: "ctl-popover", ref: popoverRef, children: [_jsx("div", { className: "ctl-search", children: _jsx("input", { ref: searchRef, type: "text", className: "ctl-search-input", value: state.term, placeholder: searchPlaceholder, "aria-label": searchLabel ?? (label === undefined ? 'Search options' : `Search ${label}`),
|
|
120
129
|
// The combobox is the search box while the popover is open: it is
|
|
121
130
|
// what has focus, so it is what must own `aria-activedescendant`.
|
|
122
|
-
role: "combobox", "aria-autocomplete": "list", "aria-expanded": true, "aria-controls": `${ids}-list`, "aria-activedescendant": activeIndex >= 0 ? cssId(ids, activeIndex) : undefined, onChange: (event) => state.setTerm(event.target.value), "data-testid": testId === undefined ? undefined : `${testId}-search` }) }), _jsx(OptionList, { state: state, ids: ids, listRef: listRef, renderOption: renderOption, testId: testId }), _jsxs("div", { className: "ctl-popover-footer", children: [state.hasMore && (_jsx("button", { type: "button", className: "ctl-link", onClick: state.showMore, children:
|
|
131
|
+
role: "combobox", "aria-autocomplete": "list", "aria-expanded": true, "aria-controls": `${ids}-list`, "aria-activedescendant": activeIndex >= 0 ? cssId(ids, activeIndex) : undefined, onChange: (event) => state.setTerm(event.target.value), "data-testid": testId === undefined ? undefined : `${testId}-search` }) }), _jsx(OptionList, { state: state, ids: ids, listRef: listRef, renderOption: renderOption, testId: testId, retryLabel: retryLabel, loadingLabel: loadingLabel, emptyLabel: emptyLabel, minSearchLabel: minSearchLabel }), _jsxs("div", { className: "ctl-popover-footer", children: [state.hasMore && (_jsx("button", { type: "button", className: "ctl-link", onClick: state.showMore, children: showMoreLabel })), !options.single && state.options.length > 0 && !state.atLimit && (_jsx("button", { type: "button", className: "ctl-link", onClick: state.selectListed, children: selectListedLabel })), state.selected.length > 0 && state.clearable && (_jsx("button", { type: "button", className: "ctl-link", onClick: state.clear, children: clearAllLabel }))] })] })), name !== undefined &&
|
|
123
132
|
state.selected.map((option) => (_jsx("input", { type: "hidden", name: name, value: option.value }, option.value)))] }));
|
|
124
133
|
}
|
|
125
134
|
/** The listbox, its states, and its groups. */
|
|
126
|
-
function OptionList({ state, ids, listRef, renderOption, testId, }) {
|
|
135
|
+
function OptionList({ state, ids, listRef, renderOption, testId, retryLabel, loadingLabel, emptyLabel, minSearchLabel, }) {
|
|
127
136
|
if (state.needsMoreInput) {
|
|
128
|
-
return (_jsx("p", { className: "ctl-note", id: `${ids}-list`, children:
|
|
137
|
+
return (_jsx("p", { className: "ctl-note", id: `${ids}-list`, children: minSearchLabel(state.minSearchLength) }));
|
|
129
138
|
}
|
|
130
139
|
if (state.status === 'error') {
|
|
131
|
-
return (_jsxs("p", { className: "ctl-note ctl-error", id: `${ids}-list`, role: "alert", children: [state.error, ' ', _jsx("button", { type: "button", className: "ctl-link", onClick: state.refresh, children:
|
|
140
|
+
return (_jsxs("p", { className: "ctl-note ctl-error", id: `${ids}-list`, role: "alert", children: [state.error, ' ', _jsx("button", { type: "button", className: "ctl-link", onClick: state.refresh, children: retryLabel })] }));
|
|
132
141
|
}
|
|
133
142
|
if (state.status === 'loading' && state.options.length === 0) {
|
|
134
|
-
return (_jsx("p", { className: "ctl-note", id: `${ids}-list`, children:
|
|
143
|
+
return (_jsx("p", { className: "ctl-note", id: `${ids}-list`, children: loadingLabel }));
|
|
135
144
|
}
|
|
136
145
|
if (state.options.length === 0) {
|
|
137
|
-
return (_jsx("p", { className: "ctl-note", id: `${ids}-list`, children:
|
|
146
|
+
return (_jsx("p", { className: "ctl-note", id: `${ids}-list`, children: emptyLabel }));
|
|
138
147
|
}
|
|
139
148
|
// Rendered flat but grouped visually, so the index the keyboard moves through
|
|
140
149
|
// is the index in `state.options` — a separate per-group index is how an
|
|
@@ -174,11 +183,11 @@ function highlight(text, term) {
|
|
|
174
183
|
function cssId(ids, index) {
|
|
175
184
|
return `ctl-${ids.replace(/[^a-zA-Z0-9_-]/g, '')}-option-${index}`;
|
|
176
185
|
}
|
|
177
|
-
function summarize(selected, placeholder, single) {
|
|
186
|
+
function summarize(selected, placeholder, single, selectedLabel) {
|
|
178
187
|
if (selected.length === 0)
|
|
179
188
|
return placeholder;
|
|
180
189
|
if (selected.length === 1 || single)
|
|
181
190
|
return selected[0]?.label ?? placeholder;
|
|
182
|
-
return
|
|
191
|
+
return selectedLabel(selected.length);
|
|
183
192
|
}
|
|
184
193
|
//# sourceMappingURL=SearchableMultiSelect.js.map
|