frontile 0.18.3 → 0.18.6
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/declarations/-private/reveal-within.d.ts +19 -0
- package/declarations/-private/reveal-within.d.ts.map +1 -0
- package/declarations/components/collections/calendar/year-grid.d.ts.map +1 -1
- package/declarations/components/forms/autocomplete.d.ts +49 -1
- package/declarations/components/forms/autocomplete.d.ts.map +1 -1
- package/declarations/components/forms/date-input/segment-group.d.ts +2 -1
- package/declarations/components/forms/date-input/segment-group.d.ts.map +1 -1
- package/declarations/components/forms/date-input/segments.d.ts +3 -1
- package/declarations/components/forms/date-input/segments.d.ts.map +1 -1
- package/declarations/components/forms/date-picker/date-picker.d.ts +119 -1
- package/declarations/components/forms/date-picker/date-picker.d.ts.map +1 -1
- package/declarations/components/forms/date-picker/time-columns.d.ts +87 -0
- package/declarations/components/forms/date-picker/time-columns.d.ts.map +1 -0
- package/declarations/components/forms/date-picker/types.d.ts +28 -0
- package/declarations/components/forms/date-picker/types.d.ts.map +1 -1
- package/declarations/components/forms/select/native-mirror.d.ts +3 -2
- package/declarations/components/forms/select/native-mirror.d.ts.map +1 -1
- package/declarations/components/forms/select/select.d.ts +42 -3
- package/declarations/components/forms/select/select.d.ts.map +1 -1
- package/declarations/components/forms/select/types.d.ts +36 -1
- package/declarations/components/forms/select/types.d.ts.map +1 -1
- package/declarations/components/overlays/overlay.d.ts +17 -2
- package/declarations/components/overlays/overlay.d.ts.map +1 -1
- package/declarations/test-support.d.ts.map +1 -1
- package/declarations/utils/filter.d.ts +30 -0
- package/declarations/utils/filter.d.ts.map +1 -1
- package/dist/components/collections/calendar/year-grid.js +1 -30
- package/dist/components/collections/calendar/year-grid.js.map +1 -1
- package/dist/components/forms/autocomplete.js +35 -4
- package/dist/components/forms/autocomplete.js.map +1 -1
- package/dist/components/forms/date-input/segment-group.js +1 -1
- package/dist/components/forms/date-input/segment-group.js.map +1 -1
- package/dist/components/forms/date-input/segments.js +1 -1
- package/dist/components/forms/date-input/segments.js.map +1 -1
- package/dist/components/forms/date-input.js +1 -1
- package/dist/components/forms/date-picker/date-picker.js +57 -6
- package/dist/components/forms/date-picker/date-picker.js.map +1 -1
- package/dist/components/forms/date-picker/time-columns.js +238 -0
- package/dist/components/forms/date-picker/time-columns.js.map +1 -0
- package/dist/components/forms/index.js +1 -1
- package/dist/components/forms/select/native-mirror.js.map +1 -1
- package/dist/components/forms/select/select.js +76 -4
- package/dist/components/forms/select/select.js.map +1 -1
- package/dist/components/overlays/overlay.js +55 -7
- package/dist/components/overlays/overlay.js.map +1 -1
- package/dist/forms.js +1 -1
- package/dist/index.js +1 -1
- package/dist/reveal-within-BcqpOmSI.js +33 -0
- package/dist/reveal-within-BcqpOmSI.js.map +1 -0
- package/dist/test-support.js +3 -1
- package/dist/test-support.js.map +1 -1
- package/dist/utils/filter.js +32 -1
- package/dist/utils/filter.js.map +1 -1
- package/package.json +3 -3
|
@@ -21,6 +21,14 @@ interface DatePickerLabels extends CalendarLabels {
|
|
|
21
21
|
* @defaultValue (label) => label ? `Choose date, ${label}` : 'Choose date'
|
|
22
22
|
*/
|
|
23
23
|
chooseDate: (label: string | undefined) => string;
|
|
24
|
+
/**
|
|
25
|
+
* Accessible name of the group of time columns beside the calendar, under
|
|
26
|
+
* an `hour` or `minute` granularity. Each column is named by its visible
|
|
27
|
+
* heading, which is `@segmentLabels`.
|
|
28
|
+
*
|
|
29
|
+
* @defaultValue 'Time'
|
|
30
|
+
*/
|
|
31
|
+
time: string;
|
|
24
32
|
}
|
|
25
33
|
interface BaseDatePickerArgs extends Pick<CalendarArgs, 'color' | 'minValue' | 'maxValue' | 'isDateUnavailable' | 'locale' | 'weekStartsOn' | 'visibleMonths' | 'captionLayout' | 'fixedWeeks' | 'showOutsideDays' | 'isReadOnly'>, Pick<PopoverSignature['Args'], 'placement' | 'flipOptions' | 'shiftOptions' | 'offsetOptions' | 'strategy' | 'didClose'>, Pick<ContentSignature['Args'], 'renderInPlace' | 'target' | 'closeOnOutsideClick' | 'closeOnEscapeKey' | 'transitionDuration' | 'disableTransitions'>, FormControlSharedArgs {
|
|
26
34
|
/** The unique identifier for the control. */
|
|
@@ -79,6 +87,26 @@ interface BaseDatePickerArgs extends Pick<CalendarArgs, 'color' | 'minValue' | '
|
|
|
79
87
|
* @defaultValue the locale's
|
|
80
88
|
*/
|
|
81
89
|
hourCycle?: 12 | 24;
|
|
90
|
+
/**
|
|
91
|
+
* Whether the popover lists hours and minutes beside the calendar, under
|
|
92
|
+
* an `hour` or `minute` granularity. With them, picking a day leaves the
|
|
93
|
+
* popover open for the time; it closes when an option in the last column
|
|
94
|
+
* is clicked, on Enter in any column, on Escape, or on a click outside.
|
|
95
|
+
* The segments stay editable either way, and both edit the same value.
|
|
96
|
+
*
|
|
97
|
+
* Only on a single, segmented field: `@mode="range"` and
|
|
98
|
+
* `@isEditable={{false}}` show the calendar alone.
|
|
99
|
+
*
|
|
100
|
+
* @defaultValue true
|
|
101
|
+
*/
|
|
102
|
+
showTimeColumns?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* The minutes the minute column offers, as a step from :00. A minute off
|
|
105
|
+
* the step can still be typed into the segments, and then shows as picked.
|
|
106
|
+
*
|
|
107
|
+
* @defaultValue 5
|
|
108
|
+
*/
|
|
109
|
+
minuteStep?: number;
|
|
82
110
|
/** The size of the field. Matches Select's `@inputSize`. */
|
|
83
111
|
inputSize?: DatePickerVariants['size'];
|
|
84
112
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-picker/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,SAAS,EACT,OAAO,EACR,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEpE;;;;GAIG;AACH,UAAU,gBAAiB,SAAQ,cAAc;IAC/C,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/date-picker/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,SAAS,EACT,OAAO,EACR,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEpE;;;;GAIG;AACH,UAAU,gBAAiB,SAAQ,cAAc;IAC/C,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,UAAU,EAAE,C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,sEAAsE;IACtE,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC5C,2DAA2D;IAC3D,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EAClB,CAAC"}
|
|
@@ -3,8 +3,9 @@ import { type ListItem, type NativeSelectSignature } from '../native-select';
|
|
|
3
3
|
interface SelectNativeMirrorSignature<T> {
|
|
4
4
|
Args: {
|
|
5
5
|
/**
|
|
6
|
-
* The **unfiltered** collection
|
|
7
|
-
*
|
|
6
|
+
* The **unfiltered** collection, capped by `@displayLimit` (see
|
|
7
|
+
* `Select#mirroredItems`). The mirror carries the form value, which must
|
|
8
|
+
* not shrink to whatever the listbox filter currently shows, so it is
|
|
8
9
|
* deliberately never handed `filteredItems`.
|
|
9
10
|
*/
|
|
10
11
|
items?: T[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-mirror.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/native-mirror.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"native-mirror.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/native-mirror.gts"],"names":[],"mappings":"AAoGA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,qBAAqB,EAC3B,MAAM,kBAAkB,CAAC;AAI1B,UAAU,2BAA2B,CAAC,CAAC;IACrC,IAAI,EAAE;QACJ;;;;;WAKG;QACH,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;QACZ,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QACxB,aAAa,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;QAEtC,uCAAuC;QACvC,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,qCAAqC;QACrC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAE3B,qDAAqD;QACrD,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;QAC5C,mDAAmD;QACnD,uBAAuB,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;QAEtD,aAAa,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,GAAG,QAAQ,KAAK,IAAI,CAAC;QACrE,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;IACF,MAAM,EAAE;QACN,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC;KACxD,CAAC;CACH;AAED;;;;;;;;GAQG;AACH,cAAM,kBAAkB,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,SAAS,CACrD,2BAA2B,CAAC,CAAC,CAAC,CAC/B;CA0CA;AAED,OAAO,EAAE,kBAAkB,EAAE,KAAK,2BAA2B,EAAE,CAAC;AAChE,eAAe,kBAAkB,CAAC"}
|
|
@@ -2,6 +2,7 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import type Owner from '@ember/owner';
|
|
3
3
|
import type { ListItem } from '../native-select';
|
|
4
4
|
import { ControlBlurTracker } from '../../../-private/control-blur';
|
|
5
|
+
import { type DisplayLimitContentArgs } from '../../../utils/filter';
|
|
5
6
|
import type { ResolvedSelectChipOptions, SelectArgs, SelectChipOptions, SelectSignature, SelectedItem, SelectedItemBlockArg } from './types';
|
|
6
7
|
/**
|
|
7
8
|
* A dropdown selection component: a custom listbox in a popover, backed by a
|
|
@@ -16,8 +17,9 @@ declare class Select<T = unknown> extends Component<SelectSignature<T>> {
|
|
|
16
17
|
*
|
|
17
18
|
* The hidden select is deliberately given the *unfiltered* `@items` — it
|
|
18
19
|
* carries the form value, which must not shrink to the filter — so this
|
|
19
|
-
* covers
|
|
20
|
-
*
|
|
20
|
+
* covers every selected item even while the listbox is filtered down
|
|
21
|
+
* (`mirroredItems` keeps them past `@displayLimit` too). Chips and the
|
|
22
|
+
* joined text value can therefore be resolved straight from it.
|
|
21
23
|
*/
|
|
22
24
|
nodes: ListItem[];
|
|
23
25
|
isOpen: boolean;
|
|
@@ -45,6 +47,10 @@ declare class Select<T = unknown> extends Component<SelectSignature<T>> {
|
|
|
45
47
|
onOpenChange: (isOpen: boolean) => void;
|
|
46
48
|
onFilterChange: (event: Event) => void;
|
|
47
49
|
/**
|
|
50
|
+
* Enter in the open filter picks the active option (the Listbox handles
|
|
51
|
+
* that), so it must not also submit a wrapping form, the same guard
|
|
52
|
+
* Autocomplete has. Closed, Enter is left to the form.
|
|
53
|
+
*
|
|
48
54
|
* Backspace on an empty filter removes the last chip — the familiar tag-input
|
|
49
55
|
* gesture. With text in the filter, Backspace edits the text as usual.
|
|
50
56
|
*/
|
|
@@ -168,6 +174,9 @@ declare class Select<T = unknown> extends Component<SelectSignature<T>> {
|
|
|
168
174
|
* readable anywhere else in that case, so the name carries it: the control
|
|
169
175
|
* name *and* the selected options' text.
|
|
170
176
|
*
|
|
177
|
+
* With nothing selected the placeholder is the trigger's visible text, so
|
|
178
|
+
* it joins the name (`Merchant, All merchants`) rather than being dropped.
|
|
179
|
+
*
|
|
171
180
|
* The two halves are composed so that the separator only appears when both
|
|
172
181
|
* are there. A selected key with no registered option behind it resolves to
|
|
173
182
|
* no text at all, and `"Owner, "` is announced as "Owner comma"; and with
|
|
@@ -304,6 +313,15 @@ declare class Select<T = unknown> extends Component<SelectSignature<T>> {
|
|
|
304
313
|
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
305
314
|
isFilterable?: boolean | undefined;
|
|
306
315
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
316
|
+
displayLimitContent: (slotProps?: ({
|
|
317
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
318
|
+
hasStartContent?: boolean | undefined;
|
|
319
|
+
hasEndContent?: boolean | undefined;
|
|
320
|
+
hasChips?: boolean | undefined;
|
|
321
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
322
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
323
|
+
isFilterable?: boolean | undefined;
|
|
324
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
307
325
|
chipsField: (slotProps?: ({
|
|
308
326
|
size?: "sm" | "md" | "lg" | undefined;
|
|
309
327
|
hasStartContent?: boolean | undefined;
|
|
@@ -353,6 +371,27 @@ declare class Select<T = unknown> extends Component<SelectSignature<T>> {
|
|
|
353
371
|
get filterFieldValue(): string;
|
|
354
372
|
get filteredItems(): T[] | undefined;
|
|
355
373
|
get showEmptyContent(): boolean;
|
|
374
|
+
/**
|
|
375
|
+
* The matches the listbox renders: `filteredItems`, capped by
|
|
376
|
+
* `@displayLimit`.
|
|
377
|
+
*/
|
|
378
|
+
get displayedItems(): T[] | undefined;
|
|
379
|
+
/**
|
|
380
|
+
* The options the hidden native `<select>` holds: the unfiltered `@items`,
|
|
381
|
+
* capped by `@displayLimit` like the listbox, plus every selected option.
|
|
382
|
+
*
|
|
383
|
+
* The form value is the selected options, so it never needs the others.
|
|
384
|
+
* Holding every item instead costs the same rendering the limit saves in
|
|
385
|
+
* the listbox, and it is paid while the Select is closed: a page with a
|
|
386
|
+
* hundred Selects over a thousand items each built a hundred thousand
|
|
387
|
+
* hidden options. Unfiltered, so a filter can't change what the form sees.
|
|
388
|
+
*/
|
|
389
|
+
get mirroredItems(): T[] | undefined;
|
|
390
|
+
/**
|
|
391
|
+
* What the display limit content reports, or `undefined` when nothing is
|
|
392
|
+
* left out.
|
|
393
|
+
*/
|
|
394
|
+
get displayLimitContent(): DisplayLimitContentArgs | undefined;
|
|
356
395
|
get autoActivateMode(): 'first' | 'selected';
|
|
357
396
|
/** Syncs internal `_selectedKeys` whenever `@selectedKeys` changes. */
|
|
358
397
|
updateMultipleSelectValue: import("ember-modifier").FunctionBasedModifier<{
|
|
@@ -371,6 +410,6 @@ declare class Select<T = unknown> extends Component<SelectSignature<T>> {
|
|
|
371
410
|
Element: HTMLDivElement;
|
|
372
411
|
}>;
|
|
373
412
|
}
|
|
374
|
-
export { Select, type SelectSignature, type SelectChipOptions, type SelectedItem, type SelectedItemBlockArg };
|
|
413
|
+
export { Select, type SelectSignature, type SelectChipOptions, type SelectedItem, type SelectedItemBlockArg, type DisplayLimitContentArgs };
|
|
375
414
|
export default Select;
|
|
376
415
|
//# sourceMappingURL=select.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/select.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/select.gts"],"names":[],"mappings":"AA29BA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAE3C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAOtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAMjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAGV,yBAAyB,EACzB,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAYjB;;;;;;GAMG;AACH,cAAM,MAAM,CAAC,CAAC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KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC7B,CAAC;AACF,eAAe,MAAM,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ListboxSignature } from '../../collections/listbox';
|
|
2
|
-
import type { FilterFn } from '../../../utils/filter';
|
|
2
|
+
import type { FilterFn, DisplayLimitContentArgs } from '../../../utils/filter';
|
|
3
3
|
import type { SelectSlots, SelectVariants, SlotsToClasses } from '@frontile/theme';
|
|
4
4
|
import type { useStyles } from '@frontile/theme';
|
|
5
5
|
import type { PopoverSignature, ContentSignature } from '../../overlays/popover';
|
|
@@ -302,6 +302,27 @@ type SelectArgs<T> = (ExplicitSingleSelectArgs<T> | DefaultSingleSelectArgs<T> |
|
|
|
302
302
|
* to filter only, preserving the order of `@items`.
|
|
303
303
|
*/
|
|
304
304
|
filter?: FilterFn;
|
|
305
|
+
/**
|
|
306
|
+
* The most options the dropdown renders at once.
|
|
307
|
+
*
|
|
308
|
+
* Every rendered option is DOM to build, and to rebuild on each keystroke as
|
|
309
|
+
* the matches change, so a list of hundreds of options makes typing in the
|
|
310
|
+
* filter lag. With a limit, only the first `displayLimit` matches are
|
|
311
|
+
* rendered, in the order the filter ranked them, and the
|
|
312
|
+
* `displayLimitContent` block says how many more there are. The rest are
|
|
313
|
+
* reached by typing a narrower query.
|
|
314
|
+
*
|
|
315
|
+
* Selected options are always rendered, even past the limit.
|
|
316
|
+
*
|
|
317
|
+
* Requires `@isFilterable`: without a filter, the options past the limit
|
|
318
|
+
* could not be reached at all. Options passed in block form are not
|
|
319
|
+
* counted or limited. The hidden native `<select>` that carries the form
|
|
320
|
+
* value holds the same number of options, from the unfiltered list, plus
|
|
321
|
+
* every selected one, so the form value is never affected.
|
|
322
|
+
*
|
|
323
|
+
* @defaultValue undefined (every option is rendered)
|
|
324
|
+
*/
|
|
325
|
+
displayLimit?: number;
|
|
305
326
|
/**
|
|
306
327
|
* If true, the select will show a loading spinner instead of the dropdown icon.
|
|
307
328
|
*/
|
|
@@ -346,6 +367,13 @@ type SelectArgs<T> = (ExplicitSingleSelectArgs<T> | DefaultSingleSelectArgs<T> |
|
|
|
346
367
|
* @defaultValue false
|
|
347
368
|
*/
|
|
348
369
|
hideEmptyContent?: boolean;
|
|
370
|
+
/**
|
|
371
|
+
* If true, hides the display limit content when `@displayLimit` leaves
|
|
372
|
+
* options out.
|
|
373
|
+
*
|
|
374
|
+
* @defaultValue false
|
|
375
|
+
*/
|
|
376
|
+
hideDisplayLimitContent?: boolean;
|
|
349
377
|
/**
|
|
350
378
|
* Callback fired when focus leaves the Select.
|
|
351
379
|
*
|
|
@@ -383,6 +411,13 @@ interface SelectSignature<T> {
|
|
|
383
411
|
* If `hideEmptyContent` argument is true, this content will not be shown.
|
|
384
412
|
*/
|
|
385
413
|
emptyContent: [];
|
|
414
|
+
/**
|
|
415
|
+
* The content to display below the options when `@displayLimit` leaves
|
|
416
|
+
* some of them out. Yields how many options are shown and how many match
|
|
417
|
+
* in total. If `hideDisplayLimitContent` argument is true, this content
|
|
418
|
+
* will not be shown.
|
|
419
|
+
*/
|
|
420
|
+
displayLimitContent: [DisplayLimitContentArgs];
|
|
386
421
|
/**
|
|
387
422
|
* Custom content for each *selected* option, in place of its plain text.
|
|
388
423
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/select/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAA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SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAExE;;;GAGG;AACH,UAAU,yBAAyB;IACjC;;;OAGG;IACH,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACtC;;;;OAIG;IACH,UAAU,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC5C;;;;OAIG;IACH,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAClC;;;;OAIG;IACH,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACpC,IAAI,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACpC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { type FocusTrapModifierSignature } from 'ember-focus-trap';
|
|
3
|
-
import { createFocusTrap } from 'focus-trap';
|
|
3
|
+
import { createFocusTrap, type FocusTrap } from 'focus-trap';
|
|
4
4
|
import { type BackdropSignature } from './backdrop';
|
|
5
5
|
import { type PortalSignature } from './portal';
|
|
6
6
|
import type Owner from '@ember/owner';
|
|
@@ -149,6 +149,7 @@ declare class Overlay extends Component<OverlaySignature> {
|
|
|
149
149
|
focusedElement: Element | null | undefined;
|
|
150
150
|
mouseDownContentElement: EventTarget | null;
|
|
151
151
|
didLockBodyScroll: boolean;
|
|
152
|
+
nestedPortalObserver: MutationObserver | undefined;
|
|
152
153
|
cancelPaintWait: (() => void) | undefined;
|
|
153
154
|
constructor(owner: Owner, args: Args);
|
|
154
155
|
willDestroy(): void;
|
|
@@ -188,7 +189,21 @@ declare class Overlay extends Component<OverlaySignature> {
|
|
|
188
189
|
* say so by passing those two as `false`.
|
|
189
190
|
*/
|
|
190
191
|
get focusTrapOptions(): FocusTrapOptions;
|
|
191
|
-
|
|
192
|
+
/**
|
|
193
|
+
* The trap covers the content and the portals nested in this overlay's
|
|
194
|
+
* portal, the same ones `handleOutsideClick` doesn't count as outside.
|
|
195
|
+
*
|
|
196
|
+
* With the content alone as its container, the trap took a press in a
|
|
197
|
+
* nested portal for an outside click and deactivated: from then on Tab
|
|
198
|
+
* walked out of the Drawer. A touch on a Select's list also sent the focus
|
|
199
|
+
* back to where it was when the trap activated, out of the Select's
|
|
200
|
+
* filter. As containers, nested overlays are also part of the Tab cycle,
|
|
201
|
+
* after the content.
|
|
202
|
+
*
|
|
203
|
+
* Nested overlays open and close while this one stays open, so a
|
|
204
|
+
* MutationObserver on the portal keeps the containers current.
|
|
205
|
+
*/
|
|
206
|
+
createFocusTrap: (...[element, options]: Parameters<typeof createFocusTrap>) => FocusTrap;
|
|
192
207
|
get classes(): string;
|
|
193
208
|
get customContentModifier(): ModifierLike<{
|
|
194
209
|
Element: HTMLElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../src/components/overlays/overlay.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../src/components/overlays/overlay.gts"],"names":[],"mappings":"AAoqBA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAO3C,OAAO,EAAa,KAAK,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAY,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAQ9D,OAAO,EAA4B,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AI,CAUnC;IAEF,sBAAsB,GAAI,OAAO,UAAU,KAAG,IAAI,CAIhD;IAEF,aAAa,GAAI,OAAO,aAAa,KAAG,IAAI,CAM1C;IAEF,YAAY;;;;;;OAwDT;IAEH,IACI,mBAAmB;;;;;;MAQtB;IAED,IAAI,gBAAgB,IAAI,OAAO,CAE9B;IAED,IAAI,mBAAmB,IAAI,OAAO,CAEjC;IAED,IAAI,SAAS,IAAI,OAAO,CAMvB;IAED,IAAI,QAAQ,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAKhD;IAED,IAAI,kBAAkB,IAAI,OAAO,CAKhC;IAED;;;;;;;;;;OAUG;IACH,IAAI,gBAAgB,IAAI,gBAAgB,CAMvC;IAED;;;;;;;;;;;;;OAaG;IACH,eAAe,GACb,GAAG,oBAAoB,UAAU,CAAC,OAAO,eAAe,CAAC,KACxD,SAAS,CAsBV;IAEF,IAAI,OAAO,WAQV;IAED,IAAI,qBAAqB;iBA/SuB,WAAW;;;;;;;OAqT1D;IAID,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC;IAIlD,IAAI,kBAAkB;;;;;;;;;;;;MAIrB;IAED,IAAI,UAAU;;;;;;;;;;;;MAWb;CAkDF;AAED,OAAO,EAAE,OAAO,EAAE,KAAK,gBAAgB,EAAE,CAAC;AAC1C,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-support.d.ts","sourceRoot":"","sources":["../src/test-support.ts"],"names":[],"mappings":"AAGA,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAEf;
|
|
1
|
+
{"version":3,"file":"test-support.d.ts","sourceRoot":"","sources":["../src/test-support.ts"],"names":[],"mappings":"AAGA,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAEf;AAqDD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAS/D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,IAAI,GAAG,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,IAAI,GAAG,MAAM,EACpB,GAAG,EAAE,IAAI,GAAG,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -85,4 +85,34 @@ export declare const SECONDARY_FIELD_WEIGHT = 0.6;
|
|
|
85
85
|
* @param filter - Scores one item; defaults to {@link defaultFilter}.
|
|
86
86
|
*/
|
|
87
87
|
export declare function filterAndRankItems<T>(items: T[] | undefined, query: string, labelFor: (item: T) => string | string[], filter?: FilterFn): T[] | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Cap `items` at the first `limit`, for rendering.
|
|
90
|
+
*
|
|
91
|
+
* A long list is cheap to filter but expensive to render: every option is DOM
|
|
92
|
+
* that has to be built, and rebuilt as the matches change on each keystroke.
|
|
93
|
+
* Capping what is rendered keeps that cost proportional to `limit` instead of
|
|
94
|
+
* to `items`. It is meant for lists the user narrows by typing, where the
|
|
95
|
+
* options past the cap are still reachable through the query.
|
|
96
|
+
*
|
|
97
|
+
* Items `isKept` accepts are rendered even past the cap, in their place in
|
|
98
|
+
* `items`, so a cap never hides the current selection. That is why the result
|
|
99
|
+
* can be longer than `limit`.
|
|
100
|
+
*
|
|
101
|
+
* Without a `limit`, or when `items` already fits, `items` is returned as is.
|
|
102
|
+
*
|
|
103
|
+
* @param items - The items to cap, already filtered and ranked.
|
|
104
|
+
* @param limit - The most items to render.
|
|
105
|
+
* @param isKept - Items to render whatever their position.
|
|
106
|
+
*/
|
|
107
|
+
export declare function limitItems<T>(items: T[] | undefined, limit: number | undefined, isKept?: (item: T) => boolean): T[] | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Yielded to the `displayLimitContent` block of a `Select` or `Autocomplete`
|
|
110
|
+
* whose `@displayLimit` left options out.
|
|
111
|
+
*/
|
|
112
|
+
export interface DisplayLimitContentArgs {
|
|
113
|
+
/** How many options are rendered. */
|
|
114
|
+
shown: number;
|
|
115
|
+
/** How many options match, rendered or not. */
|
|
116
|
+
total: number;
|
|
117
|
+
}
|
|
88
118
|
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/utils/filter.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,GAAG,CACrB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,KACf,OAAO,GAAG,MAAM,CAAC;AAStB;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,kBAAuB,GAC/B,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,CAoC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AE,CAAC,KAAK,MAAM,GAAG,MAAM,EAAE,EACxC,MAAM,GAAE,QAAwB,GAC/B,CAAC,EAAE,GAAG,SAAS,CAkBjB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,KAAK,EAAE,CAAC,EAAE,GAAG,SAAS,EACtB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,GAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAqB,GACzC,CAAC,EAAE,GAAG,SAAS,CAMjB;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -2,40 +2,11 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import { on } from '@ember/modifier';
|
|
3
3
|
import { fn } from '@ember/helper';
|
|
4
4
|
import { modifier } from 'ember-modifier';
|
|
5
|
+
import { r as revealWithin } from '../../../reveal-within-BcqpOmSI.js';
|
|
5
6
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
6
7
|
import { setComponentTemplate } from '@ember/component';
|
|
7
8
|
|
|
8
9
|
/** The grid is three columns wide, so vertical movement is by three. */const COLUMNS = 3;
|
|
9
|
-
/**
|
|
10
|
-
* Scroll `target` into view inside `panel` and nowhere else.
|
|
11
|
-
*
|
|
12
|
-
* `scrollIntoView` and a plain `focus()` both scroll *every* scrollable
|
|
13
|
-
* ancestor up to the document, so either one makes the host page jump when the
|
|
14
|
-
* panel opens or when arrow keys walk past its edge. Adjusting `scrollTop`
|
|
15
|
-
* directly keeps the movement inside the panel.
|
|
16
|
-
*
|
|
17
|
-
* The measurements come from `offsetTop`, not `getBoundingClientRect()`:
|
|
18
|
-
* client rects are in transformed pixels, so under any ancestor `scale()` they
|
|
19
|
-
* would not agree with `scrollTop`. This relies on the panel being the
|
|
20
|
-
* `offsetParent` -- the `yearGrid` slot is positioned for exactly that reason.
|
|
21
|
-
*
|
|
22
|
-
* `center` places the target mid-panel, for the opening jump to a year that is
|
|
23
|
-
* usually a long way down the list; otherwise the target is brought just far
|
|
24
|
-
* enough into view, which is what stepping key by key wants.
|
|
25
|
-
*/
|
|
26
|
-
function revealWithin(panel, target, center) {
|
|
27
|
-
const top = target.offsetTop;
|
|
28
|
-
const bottom = top + target.offsetHeight;
|
|
29
|
-
if (center) {
|
|
30
|
-
panel.scrollTop = top - (panel.clientHeight - target.offsetHeight) / 2;
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (top < panel.scrollTop) {
|
|
34
|
-
panel.scrollTop = top;
|
|
35
|
-
} else if (bottom > panel.scrollTop + panel.clientHeight) {
|
|
36
|
-
panel.scrollTop = bottom - panel.clientHeight;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
10
|
class YearGrid extends Component {
|
|
40
11
|
#element;
|
|
41
12
|
isCurrent = year => year === this.args.currentYear;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"year-grid.js","sources":["../../../../src/components/collections/calendar/year-grid.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { on } from '@ember/modifier';\nimport { fn } from '@ember/helper';\nimport { modifier } from 'ember-modifier';\n\nexport interface YearGridSignature {\n Args: {\n years: number[];\n currentYear: number;\n onSelect: (year: number) => void;\n onDismiss: () => void;\n /** The grid's accessible name. */\n label: string;\n classes: { yearGrid: string; yearCell: string };\n };\n Element: HTMLDivElement;\n}\n\n/** The grid is three columns wide, so vertical movement is by three. */\nconst COLUMNS = 3;\n\n/**\n * Scroll `target` into view inside `panel` and nowhere else.\n *\n * `scrollIntoView` and a plain `focus()` both scroll *every* scrollable\n * ancestor up to the document, so either one makes the host page jump when the\n * panel opens or when arrow keys walk past its edge. Adjusting `scrollTop`\n * directly keeps the movement inside the panel.\n *\n * The measurements come from `offsetTop`, not `getBoundingClientRect()`:\n * client rects are in transformed pixels, so under any ancestor `scale()` they\n * would not agree with `scrollTop`. This relies on the panel being the\n * `offsetParent` -- the `yearGrid` slot is positioned for exactly that reason.\n *\n * `center` places the target mid-panel, for the opening jump to a year that is\n * usually a long way down the list; otherwise the target is brought just far\n * enough into view, which is what stepping key by key wants.\n */\nfunction revealWithin(\n panel: HTMLElement,\n target: HTMLElement,\n center: boolean\n): void {\n const top = target.offsetTop;\n const bottom = top + target.offsetHeight;\n\n if (center) {\n panel.scrollTop = top - (panel.clientHeight - target.offsetHeight) / 2;\n return;\n }\n\n if (top < panel.scrollTop) {\n panel.scrollTop = top;\n } else if (bottom > panel.scrollTop + panel.clientHeight) {\n panel.scrollTop = bottom - panel.clientHeight;\n }\n}\n\nexport default class YearGrid extends Component<YearGridSignature> {\n #element: HTMLElement | undefined;\n\n isCurrent = (year: number): boolean => year === this.args.currentYear;\n\n /**\n * A year grid is opened by a deliberate action, so unlike the day grid it\n * *should* take focus -- otherwise a keyboard user opens a panel they cannot\n * reach.\n */\n setup = modifier((element: HTMLElement) => {\n this.#element = element;\n\n // `element` here is the year-grid panel's own container, which carries\n // no `data-component` of its own -- only the enclosing Calendar's root\n // does. So the \"same component\" boundary is that ancestor, not\n // `element` itself; resolve it once and filter against it, rather than\n // comparing against `element` (which would never match and would leave\n // `selected` unfindable for every real render).\n const root = element.closest('[data-component]') ?? element;\n const selected = [\n ...element.querySelectorAll<HTMLElement>(\n '[data-part=\"year-cell\"][data-selected=\"true\"]'\n )\n ].find((el) => el.closest('[data-component]') === root);\n\n // The list spans a century, so the selected year is usually far down a\n // scrolling panel. Bring it into view before focusing, or the panel opens\n // showing whichever decade happens to be at the top.\n if (selected) {\n revealWithin(element, selected, true);\n selected.focus({ preventScroll: true });\n }\n });\n\n /**\n * The panel is a single tab stop: only the year focus currently rests on is\n * tabbable, and arrow keys move both focus and that tabbability together.\n * Without this, tabbing through the calendar walks all hundred-odd years.\n *\n * Written imperatively from the keydown handler rather than derived from\n * tracked state, so focus and `tabindex` change in the same turn and neither\n * waits on a render.\n */\n #setActive(buttons: HTMLElement[], next: HTMLElement): void {\n for (const button of buttons) {\n button.tabIndex = -1;\n }\n next.tabIndex = 0;\n next.focus({ preventScroll: true });\n\n if (this.#element) {\n revealWithin(this.#element, next, false);\n }\n }\n\n handleKeydown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.args.onDismiss();\n return;\n }\n\n const step =\n event.key === 'ArrowRight'\n ? 1\n : event.key === 'ArrowLeft'\n ? -1\n : event.key === 'ArrowDown'\n ? COLUMNS\n : event.key === 'ArrowUp'\n ? -COLUMNS\n : 0;\n\n if (step === 0) {\n return;\n }\n\n event.preventDefault();\n\n // Same reasoning as `setup` above: `this.#element` is the year-grid\n // panel's own container, not the node carrying `data-component`, so the\n // \"same component\" boundary is resolved via `closest` rather than\n // compared directly against `this.#element`.\n const root = this.#element?.closest('[data-component]') ?? this.#element;\n const buttons = root\n ? [\n ...root.querySelectorAll<HTMLElement>('[data-part=\"year-cell\"]')\n ].filter((el) => el.closest('[data-component]') === root)\n : [];\n const index = buttons.indexOf(document.activeElement as HTMLElement);\n\n // `indexOf` returns -1 when focus is not on a year button. Stepping from\n // -1 would land on `buttons[0]` or `buttons[2]` rather than doing nothing,\n // so bail before the arithmetic.\n if (index < 0) {\n return;\n }\n\n const next = buttons[index + step];\n\n if (next) {\n this.#setActive(buttons, next);\n }\n };\n\n <template>\n {{! template-lint-disable no-invalid-interactive }}\n {{! The keydown listener implements the year grid's own roving keyboard\n behavior (arrow keys, Enter, Escape); the container itself stays a\n plain, non-focusable listbox role. }}\n <div\n role=\"listbox\"\n aria-label={{@label}}\n data-part=\"year-grid\"\n class={{@classes.yearGrid}}\n {{this.setup}}\n {{on \"keydown\" this.handleKeydown}}\n ...attributes\n >\n {{#each @years key=\"@identity\" as |year|}}\n <button\n type=\"button\"\n role=\"option\"\n data-part=\"year-cell\"\n data-year={{year}}\n data-selected={{if (this.isCurrent year) \"true\" \"false\"}}\n aria-selected={{if (this.isCurrent year) \"true\" \"false\"}}\n tabindex={{if (this.isCurrent year) \"0\" \"-1\"}}\n class={{@classes.yearCell}}\n {{on \"click\" (fn @onSelect year)}}\n >{{year}}</button>\n {{/each}}\n </div>\n </template>\n}\n\nexport { YearGrid };\n"],"names":["COLUMNS","revealWithin","panel","target","center","top","offsetTop","bottom","offsetHeight","scrollTop","clientHeight","YearGrid","Component","isCurrent","year","args","currentYear","setup","modifier","element","root","closest","selected","querySelectorAll","find","el","focus","preventScroll","#setActive","buttons","next","button","tabIndex","handleKeydown","event","key","preventDefault","onDismiss","step","filter","index","indexOf","document","activeElement","setComponentTemplate","precompileTemplate","strictMode","scope","on","fn"],"mappings":";;;;;;;AAkBA,wEACA,MAAMA,OAAA,GAAU,CAAA;AAEhB;;;;;;;;;;;;;;;;;AAiBA,SAASC,YAAAA,CACPC,KAAkB,EAClBC,MAAmB,EACnBC,MAAe,EACV;AACL,EAAA,MAAMC,GAAA,GAAMF,OAAOG,SAAS;AAC5B,EAAA,MAAMC,MAAA,GAASF,GAAA,GAAMF,MAAA,CAAOK,YAAY;AAExC,EAAA,IAAIJ,MAAA,EAAQ;AACVF,IAAAA,KAAA,CAAMO,SAAS,GAAGJ,GAAA,GAAM,CAACH,MAAMQ,YAAY,GAAGP,MAAA,CAAOK,YAAY,IAAI,CAAA;AACrE,IAAA;AACF,EAAA;AAEA,EAAA,IAAIH,GAAA,GAAMH,KAAA,CAAMO,SAAS,EAAE;IACzBP,KAAA,CAAMO,SAAS,GAAGJ,GAAA;EACpB,CAAA,MAAO,IAAIE,MAAA,GAASL,KAAA,CAAMO,SAAS,GAAGP,KAAA,CAAMQ,YAAY,EAAE;AACxDR,IAAAA,KAAA,CAAMO,SAAS,GAAGF,MAAA,GAASL,KAAA,CAAMQ,YAAY;AAC/C,EAAA;AACF;AAEe,MAAMC,iBAAiBC,SAAA,CAAU;AAC9C,EAAA,QAAQ;EAERC,SAAA,GAAaC,IAAY,IAAcA,IAAA,KAAS,IAAI,CAACC,IAAI,CAACC,WAAW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["import Component from '@glimmer/component';\nimport { on } from '@ember/modifier';\nimport { fn } from '@ember/helper';\nimport { modifier } from 'ember-modifier';\nimport { revealWithin } from '../../../-private/reveal-within';\n\nexport interface YearGridSignature {\n Args: {\n years: number[];\n currentYear: number;\n onSelect: (year: number) => void;\n onDismiss: () => void;\n /** The grid's accessible name. */\n label: string;\n classes: { yearGrid: string; yearCell: string };\n };\n Element: HTMLDivElement;\n}\n\n/** The grid is three columns wide, so vertical movement is by three. */\nconst COLUMNS = 3;\n\nexport default class YearGrid extends Component<YearGridSignature> {\n #element: HTMLElement | undefined;\n\n isCurrent = (year: number): boolean => year === this.args.currentYear;\n\n /**\n * A year grid is opened by a deliberate action, so unlike the day grid it\n * *should* take focus -- otherwise a keyboard user opens a panel they cannot\n * reach.\n */\n setup = modifier((element: HTMLElement) => {\n this.#element = element;\n\n // `element` here is the year-grid panel's own container, which carries\n // no `data-component` of its own -- only the enclosing Calendar's root\n // does. So the \"same component\" boundary is that ancestor, not\n // `element` itself; resolve it once and filter against it, rather than\n // comparing against `element` (which would never match and would leave\n // `selected` unfindable for every real render).\n const root = element.closest('[data-component]') ?? element;\n const selected = [\n ...element.querySelectorAll<HTMLElement>(\n '[data-part=\"year-cell\"][data-selected=\"true\"]'\n )\n ].find((el) => el.closest('[data-component]') === root);\n\n // The list spans a century, so the selected year is usually far down a\n // scrolling panel. Bring it into view before focusing, or the panel opens\n // showing whichever decade happens to be at the top.\n if (selected) {\n revealWithin(element, selected, true);\n selected.focus({ preventScroll: true });\n }\n });\n\n /**\n * The panel is a single tab stop: only the year focus currently rests on is\n * tabbable, and arrow keys move both focus and that tabbability together.\n * Without this, tabbing through the calendar walks all hundred-odd years.\n *\n * Written imperatively from the keydown handler rather than derived from\n * tracked state, so focus and `tabindex` change in the same turn and neither\n * waits on a render.\n */\n #setActive(buttons: HTMLElement[], next: HTMLElement): void {\n for (const button of buttons) {\n button.tabIndex = -1;\n }\n next.tabIndex = 0;\n next.focus({ preventScroll: true });\n\n if (this.#element) {\n revealWithin(this.#element, next, false);\n }\n }\n\n handleKeydown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.args.onDismiss();\n return;\n }\n\n const step =\n event.key === 'ArrowRight'\n ? 1\n : event.key === 'ArrowLeft'\n ? -1\n : event.key === 'ArrowDown'\n ? COLUMNS\n : event.key === 'ArrowUp'\n ? -COLUMNS\n : 0;\n\n if (step === 0) {\n return;\n }\n\n event.preventDefault();\n\n // Same reasoning as `setup` above: `this.#element` is the year-grid\n // panel's own container, not the node carrying `data-component`, so the\n // \"same component\" boundary is resolved via `closest` rather than\n // compared directly against `this.#element`.\n const root = this.#element?.closest('[data-component]') ?? this.#element;\n const buttons = root\n ? [\n ...root.querySelectorAll<HTMLElement>('[data-part=\"year-cell\"]')\n ].filter((el) => el.closest('[data-component]') === root)\n : [];\n const index = buttons.indexOf(document.activeElement as HTMLElement);\n\n // `indexOf` returns -1 when focus is not on a year button. Stepping from\n // -1 would land on `buttons[0]` or `buttons[2]` rather than doing nothing,\n // so bail before the arithmetic.\n if (index < 0) {\n return;\n }\n\n const next = buttons[index + step];\n\n if (next) {\n this.#setActive(buttons, next);\n }\n };\n\n <template>\n {{! template-lint-disable no-invalid-interactive }}\n {{! The keydown listener implements the year grid's own roving keyboard\n behavior (arrow keys, Enter, Escape); the container itself stays a\n plain, non-focusable listbox role. }}\n <div\n role=\"listbox\"\n aria-label={{@label}}\n data-part=\"year-grid\"\n class={{@classes.yearGrid}}\n {{this.setup}}\n {{on \"keydown\" this.handleKeydown}}\n ...attributes\n >\n {{#each @years key=\"@identity\" as |year|}}\n <button\n type=\"button\"\n role=\"option\"\n data-part=\"year-cell\"\n data-year={{year}}\n data-selected={{if (this.isCurrent year) \"true\" \"false\"}}\n aria-selected={{if (this.isCurrent year) \"true\" \"false\"}}\n tabindex={{if (this.isCurrent year) \"0\" \"-1\"}}\n class={{@classes.yearCell}}\n {{on \"click\" (fn @onSelect year)}}\n >{{year}}</button>\n {{/each}}\n </div>\n </template>\n}\n\nexport { YearGrid };\n"],"names":["COLUMNS","YearGrid","Component","isCurrent","year","args","currentYear","setup","modifier","element","root","closest","selected","querySelectorAll","find","el","revealWithin","focus","preventScroll","#setActive","buttons","next","button","tabIndex","handleKeydown","event","key","preventDefault","onDismiss","step","filter","index","indexOf","document","activeElement","setComponentTemplate","precompileTemplate","strictMode","scope","on","fn"],"mappings":";;;;;;;;AAmBA,wEACA,MAAMA,OAAA,GAAU,CAAA;AAED,MAAMC,iBAAiBC,SAAA,CAAU;AAC9C,EAAA,QAAQ;EAERC,SAAA,GAAaC,IAAY,IAAcA,IAAA,KAAS,IAAI,CAACC,IAAI,CAACC,WAAW;AAErE;;;;;AAKAC,EAAAA,KAAA,GAAQC,QAAA,CAAUC,OAAS,IAAA;AACzB,IAAA,IAAI,CAAC,QAAQ,GAAGA,OAAA;AAEhB;AACA;AACA;AACA;AACA;AACA;IACA,MAAMC,IAAA,GAAOD,OAAA,CAAQE,OAAO,CAAC,kBAAA,CAAA,IAAuBF,OAAA;IACpD,MAAMG,QAAA,GAAW,IACZH,OAAA,CAAQI,gBAAgB,CACzB,+CAAA,CAAA,CAEH,CAACC,IAAI,CAAEC,MAAOA,EAAA,CAAGJ,OAAO,CAAC,kBAAA,CAAA,KAAwBD,IAAA,CAAA;AAElD;AACA;AACA;AACA,IAAA,IAAIE,QAAA,EAAU;AACZI,MAAAA,YAAA,CAAaP,SAASG,QAAA,EAAU,IAAA,CAAA;MAChCA,QAAA,CAASK,KAAK,CAAC;AAAEC,QAAAA,aAAA,EAAe;AAAK,OAAA,CAAA;AACvC,IAAA;AACF,EAAA,CAAA,CAAA;AAEA;;;;;;;;;AASA,EAAA,UAAUC,CAACC,OAAsB,EAAEC,IAAiB,EAAO;AACzD,IAAA,KAAK,MAAMC,UAAUF,OAAA,EAAS;AAC5BE,MAAAA,MAAA,CAAOC,QAAQ,GAAG,EAAC;AACrB,IAAA;IACAF,IAAA,CAAKE,QAAQ,GAAG,CA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W,KAAA,GAAQF,IAAA,CAAK;AAElC,IAAA,IAAIR,IAAA,EAAM;AACR,MAAA,IAAI,CAAC,UAAU,CAACD,OAAA,EAASC,IAAA,CAAA;AAC3B,IAAA;EACF,CAAA;AAEA,EAAA;IAAAc,oBAAA,CAAAC,kBAAA,CAAA,+zBAAA,EA4BA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,EAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -14,8 +14,9 @@ import { triggerFormInputEvent } from '../../utils/forms-utils-index.js';
|
|
|
14
14
|
import { CloseButton } from '../buttons/close-button.js';
|
|
15
15
|
import { I as IconChevronUpDown } from '../../icons-DZ61nCzv.js';
|
|
16
16
|
import { keyAndLabelForItem } from '../../utils/listManager.js';
|
|
17
|
-
import { filterAndRankItems } from '../../utils/filter.js';
|
|
17
|
+
import { filterAndRankItems, limitItems } from '../../utils/filter.js';
|
|
18
18
|
import { cancel, debounce } from '@ember/runloop';
|
|
19
|
+
import { assert } from '@ember/debug';
|
|
19
20
|
import { r as renamedArgValue } from '../../deprecated-args-BIUjLA8y.js';
|
|
20
21
|
import { modifier } from 'ember-modifier';
|
|
21
22
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
@@ -342,12 +343,42 @@ class Autocomplete extends Component {
|
|
|
342
343
|
return filterAndRankItems(this.args.items, this.inputValue, item => keyAndLabelForItem(item).label, this.args.filter);
|
|
343
344
|
}
|
|
344
345
|
/**
|
|
345
|
-
*
|
|
346
|
-
*
|
|
346
|
+
* The options the listbox renders: `filteredItems`, capped by
|
|
347
|
+
* `@displayLimit`.
|
|
347
348
|
*/
|
|
348
349
|
static {
|
|
349
350
|
decorateMethodV2(this.prototype, "filteredItems", [cached]);
|
|
350
351
|
}
|
|
352
|
+
get displayedItems() {
|
|
353
|
+
const {
|
|
354
|
+
displayLimit
|
|
355
|
+
} = this.args;
|
|
356
|
+
assert(`Autocomplete: @displayLimit must be a positive integer, received ${String(displayLimit)}`, displayLimit === undefined || Number.isInteger(displayLimit) && displayLimit > 0);
|
|
357
|
+
const selectedKeys = this.selectedKeys;
|
|
358
|
+
return limitItems(this.filteredItems, displayLimit, item => selectedKeys.includes(keyAndLabelForItem(item).key));
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* What the display limit content reports, or `undefined` when nothing is
|
|
362
|
+
* left out.
|
|
363
|
+
*/
|
|
364
|
+
static {
|
|
365
|
+
decorateMethodV2(this.prototype, "displayedItems", [cached]);
|
|
366
|
+
}
|
|
367
|
+
get displayLimitContent() {
|
|
368
|
+
const shown = this.displayedItems?.length ?? 0;
|
|
369
|
+
const total = this.filteredItems?.length ?? 0;
|
|
370
|
+
if (shown === total || this.args.hideDisplayLimitContent) {
|
|
371
|
+
return undefined;
|
|
372
|
+
}
|
|
373
|
+
return {
|
|
374
|
+
shown,
|
|
375
|
+
total
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* True when an async autocomplete is open with a blank query and nothing
|
|
380
|
+
* to show — the moment to prompt the user to start typing.
|
|
381
|
+
*/
|
|
351
382
|
get isSearchPromptState() {
|
|
352
383
|
return typeof this.args.onSearch === 'function' && !this.isFiltering && !this.isLoading && (this.filteredItems?.length ?? 0) === 0;
|
|
353
384
|
}
|
|
@@ -369,7 +400,7 @@ class Autocomplete extends Component {
|
|
|
369
400
|
}
|
|
370
401
|
});
|
|
371
402
|
static {
|
|
372
|
-
setComponentTemplate(precompileTemplate("<div {{this.updateSelectedKey @selectedKey}} {{this.containerRef.setup}} class={{this.classes.base class=@classes.base}} data-component=\"autocomplete\" data-part=\"base\" ...attributes>\n <FormControl @id={{@id}} @size={{@inputSize}} @label={{@label}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{@isInvalid}} as |c|>\n <Popover @placement={{@placement}} @flipOptions={{@flipOptions}} @middleware={{@middleware}} @shiftOptions={{@shiftOptions}} @offsetOptions={{@offsetOptions}} @strategy={{@strategy}} @didClose={{this.didClose}} @isOpen={{this.isOpen}} @onOpenChange={{this.onOpenChange}} as |p|>\n <VisuallyHidden>\n <NativeSelect @items={{this.
|
|
403
|
+
setComponentTemplate(precompileTemplate("<div {{this.updateSelectedKey @selectedKey}} {{this.containerRef.setup}} class={{this.classes.base class=@classes.base}} data-component=\"autocomplete\" data-part=\"base\" ...attributes>\n <FormControl @id={{@id}} @size={{@inputSize}} @label={{@label}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{@isInvalid}} as |c|>\n <Popover @placement={{@placement}} @flipOptions={{@flipOptions}} @middleware={{@middleware}} @shiftOptions={{@shiftOptions}} @offsetOptions={{@offsetOptions}} @strategy={{@strategy}} @didClose={{this.didClose}} @isOpen={{this.isOpen}} @onOpenChange={{this.onOpenChange}} as |p|>\n <VisuallyHidden>\n {{!-- Limited like the listbox: it holds the options the user can\n pick, and a hidden list of every match would cost the same\n rendering @displayLimit saves. The selection is always kept. --}}\n <NativeSelect @items={{this.displayedItems}} @allowEmpty={{@allowEmpty}} @disabledKeys={{@disabledKeys}} @onSelectionChange={{this.onNativeSelectionChange}} @selectedKey={{this._selectedKey}} @selectionMode=\"single\" @onItemsChange={{this.onItemsChange}} @placeholder={{@placeholder}} @id={{c.id}} @name={{@name}} tabindex=\"-1\" disabled={{@isDisabled}}>\n <:item as |l|>\n <l.Item @key={{l.key}}>\n {{l.label}}\n </l.Item>\n </:item>\n <:default as |l|>\n {{!-- @glint-expect-error: the signature of the native select is not the same as the listbox--}}\n {{yield l to=\"default\"}}\n </:default>\n </NativeSelect>\n </VisuallyHidden>\n\n <div class={{this.classes.innerContainer class=@classes.innerContainer}} data-part=\"inner-container\">\n {{#if (has-block \"startContent\")}}\n <div data-part=\"start-content\" class={{this.classes.startContent class=@classes.startContent startContentPointerEvents=(if @startContentPointerEvents @startContentPointerEvents \"auto\")}}>\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n {{!-- aria-expanded and aria-controls are set at runtime by the\n Popover trigger modifier, and role=combobox is not implicit\n on a text input --}}\n {{!-- template-lint-disable no-redundant-role require-mandatory-role-attributes --}}\n <input type=\"text\" role=\"combobox\" aria-autocomplete=\"list\" aria-activedescendant={{this.activeDescendant}} autocomplete=\"off\" autocapitalize=\"off\" autocorrect=\"off\" spellcheck=\"false\" {{p.trigger}} {{p.anchor}} {{this.triggerRef.setup}} data-part=\"input\" disabled={{@isDisabled}} placeholder={{@placeholder}} class={{this.classes.input class=@classes.input hasStartContent=(has-block \"startContent\") hasEndContent=true}} value={{this.inputValue}} {{on \"input\" this.onInput}} {{on \"keydown\" this.onKeyDown}} {{on \"focusout\" this.blurTracker.handleFocusOut}} />\n <div data-part=\"end-content\" class={{this.classes.endContent class=@classes.endContent endContentPointerEvents=(if @endContentPointerEvents @endContentPointerEvents \"none\")}}>\n {{yield to=\"endContent\"}}\n\n {{#if this.isLoading}}\n <Spinner @size={{if (isSm @inputSize) \"xs\" \"sm\"}} />\n {{else if this.isClearable}}\n <CloseButton @title=\"Clear\" @variant=\"soft\" @size=\"xs\" @class={{this.classes.clearButton class=@classes.clearButton}} data-part=\"clear-button\" @onPress={{this.clearSelectedKeys}} />\n {{else}}\n <IconChevronUpDown data-part=\"icon\" class={{this.classes.icon class=@classes.icon}} />\n {{/if}}\n </div>\n </div>\n\n <p.Content @size={{if @popoverSize @popoverSize \"trigger\"}} @target={{@target}} @renderInPlace={{@renderInPlace}} @disableFocusTrap={{this.disableFocusTrap}} @blockScroll={{this.blockScroll}} @transitionDuration={{@transitionDuration}} @backdrop={{this.backdrop}} @disableTransitions={{@disableTransitions}} @focusTrapOptions={{@focusTrapOptions}} @closeOnOutsideClick={{@closeOnOutsideClick}} @closeOnEscapeKey={{@closeOnEscapeKey}} @backdropTransition={{@backdropTransition}} @transition={{@transition}} @preventAutoFocus={{true}}>\n <Listbox @items={{this.displayedItems}} @allowEmpty={{@allowEmpty}} @variant={{this.variant}} @disabledKeys={{@disabledKeys}} @color={{this.color}} @isKeyboardEventsEnabled={{true}} @onAction={{this.onAction}} @onSelectionChange={{this.onSelectionChange}} @onActiveItemChange={{this.onActiveItemChange}} @selectedKeys={{this.selectedKeys}} @selectionMode=\"single\" @type=\"listbox\" @class={{this.classes.listbox class=@classes.listbox}} @elementToAddKeyboardEvents={{this.triggerRef.current}} @autoActivateMode={{this.autoActivateMode}} data-part=\"listbox\">\n <:item as |l|>\n {{#if (has-block \"item\")}}\n {{yield l to=\"item\"}}\n {{else}}\n <l.Item @key={{l.key}} @variant={{this.variant}} @color={{this.color}}>\n {{l.label}}\n </l.Item>\n {{/if}}\n </:item>\n <:default as |l|>\n {{yield l to=\"default\"}}\n </:default>\n </Listbox>\n {{#if (and this.isSearchPromptState (or @searchMessage (has-block \"searchMessage\")))}}\n <div class={{this.classes.emptyContent class=@classes.emptyContent}} data-part=\"empty-content\">\n {{#if (has-block \"searchMessage\")}}\n {{yield to=\"searchMessage\"}}\n {{else}}\n {{@searchMessage}}\n {{/if}}\n </div>\n {{else if this.showEmptyContent}}\n <div class={{this.classes.emptyContent class=@classes.emptyContent}} data-part=\"empty-content\">\n {{#if (has-block \"emptyContent\")}}\n {{yield to=\"emptyContent\"}}\n {{else}}\n No results found.\n {{/if}}\n </div>\n {{/if}}\n {{#if this.displayLimitContent}}\n <div class={{this.classes.displayLimitContent class=@classes.displayLimitContent}} data-part=\"display-limit-content\">\n {{#if (has-block \"displayLimitContent\")}}\n {{yield this.displayLimitContent to=\"displayLimitContent\"}}\n {{else}}\n Showing\n {{this.displayLimitContent.shown}}\n of\n {{this.displayLimitContent.total}}. Type to narrow down.\n {{/if}}\n </div>\n {{/if}}\n </p.Content>\n </Popover>\n </FormControl>\n</div>", {
|
|
373
404
|
strictMode: true,
|
|
374
405
|
scope: () => ({
|
|
375
406
|
FormControl,
|