@keenmate/web-multiselect 2.0.0-rc09 → 2.0.0-rc10
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 +16 -6
- package/custom-elements.json +195 -3
- package/dist/index.d.ts +114 -0
- package/dist/multiselect.js +1482 -1203
- package/dist/multiselect.umd.js +12 -11
- package/dist/style.css +1 -1
- package/docs/accessibility.md +1 -1
- package/docs/examples.md +5 -4
- package/package.json +2 -2
- package/src/css/badges.css +14 -0
- package/src/css/floating.css +16 -2
- package/src/css/states.css +10 -0
- package/src/css/variables.css +7 -0
- package/vscode.html-custom-data.json +11 -1
- package/web-types.json +28 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { BlissElement } from '@keenmate/web-components-core';
|
|
2
|
+
import { BreakpointMap } from '@keenmate/web-components-core';
|
|
3
|
+
import { classifyDevice } from '@keenmate/web-components-core';
|
|
4
|
+
import { configureBreakpoints } from '@keenmate/web-components-core';
|
|
5
|
+
import { DeviceClass } from '@keenmate/web-components-core';
|
|
6
|
+
import { ElementSize } from '@keenmate/web-components-core';
|
|
2
7
|
import { EnvironmentSnapshot } from '@keenmate/web-components-core';
|
|
8
|
+
import { getEnvironment } from '@keenmate/web-components-core';
|
|
3
9
|
import { InputDef } from '@keenmate/web-components-core';
|
|
4
10
|
import { Logger } from '@keenmate/web-components-core';
|
|
5
11
|
import { LogLevelDesc } from '@keenmate/web-components-core';
|
|
12
|
+
import { observeEnvironment } from '@keenmate/web-components-core';
|
|
13
|
+
import { observeViewport } from '@keenmate/web-components-core';
|
|
14
|
+
import { Orientation } from '@keenmate/web-components-core';
|
|
15
|
+
import { OS } from '@keenmate/web-components-core';
|
|
6
16
|
import { Placement } from '@keenmate/web-components-core/positioning';
|
|
17
|
+
import { PointerType } from '@keenmate/web-components-core';
|
|
7
18
|
import { PresentationContext } from '@keenmate/web-components-core';
|
|
19
|
+
import { TABLET_MIN_SHORT_SIDE } from '@keenmate/web-components-core';
|
|
8
20
|
|
|
9
21
|
/**
|
|
10
22
|
* Action button configuration for dropdown actions (Select All, Clear All, custom actions)
|
|
@@ -82,14 +94,26 @@ export declare type BadgesPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
|
82
94
|
*/
|
|
83
95
|
export declare type BadgesThresholdMode = 'count' | 'partial';
|
|
84
96
|
|
|
97
|
+
export { BreakpointMap }
|
|
98
|
+
|
|
99
|
+
export { classifyDevice }
|
|
100
|
+
|
|
101
|
+
export { configureBreakpoints }
|
|
102
|
+
|
|
85
103
|
export declare const dataLogger: Logger;
|
|
86
104
|
|
|
105
|
+
export { DeviceClass }
|
|
106
|
+
|
|
87
107
|
/** Disable all logging (silent). */
|
|
88
108
|
export declare function disableLogging(): void;
|
|
89
109
|
|
|
90
110
|
/** Enable all logging (debug level). */
|
|
91
111
|
export declare function enableLogging(): void;
|
|
92
112
|
|
|
113
|
+
export { EnvironmentSnapshot }
|
|
114
|
+
|
|
115
|
+
export { getEnvironment }
|
|
116
|
+
|
|
93
117
|
export declare const initLogger: Logger;
|
|
94
118
|
|
|
95
119
|
export declare const interactionLogger: Logger;
|
|
@@ -256,6 +280,17 @@ declare interface MultiSelectConfig<T = any> {
|
|
|
256
280
|
renderOptionContentCallback?: (item: T, context: OptionContentRenderContext) => string | HTMLElement;
|
|
257
281
|
/** Custom renderer for badge content (main badges area) - return HTML string or HTMLElement */
|
|
258
282
|
renderBadgeContentCallback?: (item: T, context: BadgeContentRenderContext) => string | HTMLElement;
|
|
283
|
+
/**
|
|
284
|
+
* Custom renderer for the WHOLE badge (main badges area) — return HTML string or HTMLElement
|
|
285
|
+
* for the entire pill/card, not just its content. Unlike renderBadgeContentCallback (which fills
|
|
286
|
+
* the built-in pill), this replaces the badge markup entirely. The component wraps your output in
|
|
287
|
+
* a `.ms__badge.ms__badge--custom` element carrying `data-value`, and delegates removal to any
|
|
288
|
+
* element inside it with `data-action="remove"` (or the built-in `.ms__badge-remove` class) — so
|
|
289
|
+
* put a remove control in your markup and the component handles the deselect. Falls back to the
|
|
290
|
+
* default pill for a given item if the callback returns null/empty. Main badges area only (the
|
|
291
|
+
* selected-items popover keeps using renderSelectedItemContentCallback).
|
|
292
|
+
*/
|
|
293
|
+
renderBadgeCallback?: (item: T, context: BadgeContentRenderContext) => string | HTMLElement | null | undefined;
|
|
259
294
|
/** Custom renderer for selected item content in popover - return HTML string or HTMLElement */
|
|
260
295
|
renderSelectedItemContentCallback?: (item: T) => string | HTMLElement;
|
|
261
296
|
/** Callback to add custom CSS classes to selected items in popover - return string or array of class names */
|
|
@@ -301,6 +336,14 @@ declare interface MultiSelectConfig<T = any> {
|
|
|
301
336
|
isAddNewAllowed?: boolean;
|
|
302
337
|
/** Show count badge next to toggle icon (internal: isCounterShown) */
|
|
303
338
|
isCounterShown?: boolean;
|
|
339
|
+
/**
|
|
340
|
+
* Allow the selected-items popover to open. Defaults to `true`. The popover is triggered by
|
|
341
|
+
* the count / compact / "+X more" badge and by the in-input counter (`isCounterShown`). Set
|
|
342
|
+
* to `false` when you render your own selection UI (e.g. an external container fed by the
|
|
343
|
+
* `change` event) — the badge and counter still show the count, but clicking them does nothing
|
|
344
|
+
* and they lose the pointer cursor. (internal: isSelectedPopoverEnabled)
|
|
345
|
+
*/
|
|
346
|
+
isSelectedPopoverEnabled?: boolean;
|
|
304
347
|
/**
|
|
305
348
|
* Make badges display each option's `fullTitleMember` / `getFullTitleCallback` value
|
|
306
349
|
* instead of its display value. Falls back to the display value for options without a
|
|
@@ -581,6 +624,15 @@ export declare class MultiSelectElement<T = any> extends BlissElement<MultiSelec
|
|
|
581
624
|
* set before the dropdown can open.
|
|
582
625
|
*/
|
|
583
626
|
protected environmentChanged(env: EnvironmentSnapshot): void;
|
|
627
|
+
/**
|
|
628
|
+
* This element's own border box changed (core §12.9 `resized`). Overriding the
|
|
629
|
+
* hook opts us into a shared page-wide ResizeObserver, subscribed on connect and
|
|
630
|
+
* dropped on disconnect. Unlike `environmentChanged`/`viewportChanged` (the
|
|
631
|
+
* WINDOW), this is our OWN box — a picker in a 400px sidebar on a 2560px monitor
|
|
632
|
+
* reflows on its width, not the viewport's. We only act when `collapse-badges-
|
|
633
|
+
* below` is set; otherwise it's a cheap no-op.
|
|
634
|
+
*/
|
|
635
|
+
protected resized({ width }: ElementSize): void;
|
|
584
636
|
/** Form field name (mirrors the `name` attribute → `formFieldId`). */
|
|
585
637
|
get name(): string | null;
|
|
586
638
|
set name(value: string | null);
|
|
@@ -732,6 +784,10 @@ export declare interface MultiSelectOptions extends MultiSelectConfig<MultiSelec
|
|
|
732
784
|
*/
|
|
733
785
|
declare type NodeId = string | number;
|
|
734
786
|
|
|
787
|
+
export { observeEnvironment }
|
|
788
|
+
|
|
789
|
+
export { observeViewport }
|
|
790
|
+
|
|
735
791
|
/**
|
|
736
792
|
* Context provided to renderOptionContentCallback.
|
|
737
793
|
*
|
|
@@ -783,6 +839,10 @@ export declare const OPTIONS_FORMATS: readonly ["json", "csv", "plain"];
|
|
|
783
839
|
|
|
784
840
|
export declare type OptionsFormat = (typeof OPTIONS_FORMATS)[number];
|
|
785
841
|
|
|
842
|
+
export { Orientation }
|
|
843
|
+
|
|
844
|
+
export { OS }
|
|
845
|
+
|
|
786
846
|
export declare interface ParsedOptions {
|
|
787
847
|
/** Parsed options: objects for `json`/`csv`, `[value, label]` tuples for `plain`. */
|
|
788
848
|
options: unknown[];
|
|
@@ -809,6 +869,8 @@ declare interface ParseOptionsOptions {
|
|
|
809
869
|
rowSplitter?: string;
|
|
810
870
|
}
|
|
811
871
|
|
|
872
|
+
export { PointerType }
|
|
873
|
+
|
|
812
874
|
/**
|
|
813
875
|
* Search input display mode
|
|
814
876
|
*/
|
|
@@ -831,6 +893,8 @@ export declare function setCategoryLevel(category: string, level: LogLevelDesc):
|
|
|
831
893
|
/** Set the same level on every category. */
|
|
832
894
|
export declare function setLogLevel(level: LogLevelDesc): void;
|
|
833
895
|
|
|
896
|
+
export { TABLET_MIN_SHORT_SIDE }
|
|
897
|
+
|
|
834
898
|
export declare const uiLogger: Logger;
|
|
835
899
|
|
|
836
900
|
/**
|
|
@@ -867,6 +931,7 @@ export declare class WebMultiSelect<T = any> {
|
|
|
867
931
|
private justClosedViaClick;
|
|
868
932
|
private justOpenedViaClick;
|
|
869
933
|
private positioningDriftWarned;
|
|
934
|
+
private fullscreenContainingBlockWarned;
|
|
870
935
|
private presentationMode;
|
|
871
936
|
private fullscreenHeader;
|
|
872
937
|
private fullscreenSearchInput;
|
|
@@ -1048,6 +1113,24 @@ export declare class WebMultiSelect<T = any> {
|
|
|
1048
1113
|
*/
|
|
1049
1114
|
private hasGroups;
|
|
1050
1115
|
private renderDropdown;
|
|
1116
|
+
/**
|
|
1117
|
+
* Round the OUTER corners of the row at the very top and the row at the very
|
|
1118
|
+
* bottom of the list so a focused/selected row's background — and crucially its
|
|
1119
|
+
* focus `outline`, which traces the row's OWN box and follows its border-radius
|
|
1120
|
+
* but NOT an ancestor's overflow clip — curves with the panel instead of poking a
|
|
1121
|
+
* square corner past it.
|
|
1122
|
+
*
|
|
1123
|
+
* Keyed off DOM order, not option index, so grouping works: when grouped the top
|
|
1124
|
+
* row is a `.ms__group-label` (not the first option, which sits below it), so we
|
|
1125
|
+
* round whichever element is physically first/last. VirtualScroll renders rows in
|
|
1126
|
+
* index order into one innerHTML, so DOM order == visual order there too.
|
|
1127
|
+
*
|
|
1128
|
+
* Logical corners (`border-start-*` / `border-end-*`) so it mirrors in RTL. A
|
|
1129
|
+
* space-taking vertical scrollbar occupies the inline-END gutter, so the END-side
|
|
1130
|
+
* corners stay square then (the panel's rounded end corner is the scrollbar
|
|
1131
|
+
* track's). The radius is 0 in the fullscreen sheet (that scope zeroes the var).
|
|
1132
|
+
*/
|
|
1133
|
+
private applyEdgeOptionRadii;
|
|
1051
1134
|
/**
|
|
1052
1135
|
* Render dropdown with virtual scrolling
|
|
1053
1136
|
*/
|
|
@@ -1199,6 +1282,23 @@ export declare class WebMultiSelect<T = any> {
|
|
|
1199
1282
|
* owns the measurement + culprit-finding + CB-CSS diagnostic (`detectFixedDrift`).
|
|
1200
1283
|
*/
|
|
1201
1284
|
private warnDrift;
|
|
1285
|
+
/**
|
|
1286
|
+
* Fullscreen counterpart of {@link warnDrift}. The overlay is a `position: fixed`,
|
|
1287
|
+
* full-viewport sheet — but if an ancestor of the host establishes a fixed-positioning
|
|
1288
|
+
* containing block (`transform` / `perspective` / `filter` / `backdrop-filter` / a
|
|
1289
|
+
* qualifying `will-change`), the browser anchors the sheet to THAT ancestor's box instead
|
|
1290
|
+
* of the viewport, so it no longer covers the screen (offset, clipped, or mis-sized).
|
|
1291
|
+
*
|
|
1292
|
+
* Unlike the floating path — where core measures real drift after positioning — nothing
|
|
1293
|
+
* anchors the sheet, so there's no drift to observe. Instead we ask core's shared
|
|
1294
|
+
* heuristic (`getFixedPositionOffsetParent`, the same one that feeds the floating platform)
|
|
1295
|
+
* whether the sheet's true offset parent is the viewport (`window`) or an element. An
|
|
1296
|
+
* element means it WILL be mis-anchored; warn once, pointing at the culprit. We only check
|
|
1297
|
+
* the reliably-honoured properties core lists (transform family) — `contain` /
|
|
1298
|
+
* `container-type` are omitted because browsers don't honour them for fixed positioning,
|
|
1299
|
+
* so they don't actually break the sheet.
|
|
1300
|
+
*/
|
|
1301
|
+
private warnFullscreenContainingBlock;
|
|
1202
1302
|
private positionDropdown;
|
|
1203
1303
|
/**
|
|
1204
1304
|
* Switch how the open panels are presented. 'floating' anchors them to the input
|
|
@@ -1364,6 +1464,20 @@ export declare class WebMultiSelect<T = any> {
|
|
|
1364
1464
|
private hideSelectedPopover;
|
|
1365
1465
|
private renderSelectedPopover;
|
|
1366
1466
|
private renderSelectedPopoverVirtual;
|
|
1467
|
+
/**
|
|
1468
|
+
* Coerce a render-callback result to an HTML string. Callbacks may return a string
|
|
1469
|
+
* (HTML) or an HTMLElement (serialized via `outerHTML`); null/undefined → ''. Used by
|
|
1470
|
+
* every "return string | HTMLElement" content callback that builds into an innerHTML
|
|
1471
|
+
* string. (DOM sinks that hold a live node instead — the reveal/message panels — use
|
|
1472
|
+
* textContent/appendChild directly and intentionally don't go through here.)
|
|
1473
|
+
*/
|
|
1474
|
+
private toHtml;
|
|
1475
|
+
/**
|
|
1476
|
+
* Normalize a class callback result (`string | string[] | null`) to a single
|
|
1477
|
+
* space-joined string with falsy entries dropped — e.g. `['a', '', 'b'] → "a b"`,
|
|
1478
|
+
* `null → ""`. Callers add their own leading space / base class as needed.
|
|
1479
|
+
*/
|
|
1480
|
+
private classSuffix;
|
|
1367
1481
|
/**
|
|
1368
1482
|
* Render a removable badge for a selected option (used by the badges/partial display modes
|
|
1369
1483
|
* and by the selected-items popover).
|