@mintplayer/web-components 2.1.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/index.mjs +26 -2
- package/a11y/src/dismiss-stack.d.ts +25 -0
- package/a11y/src/error-text.d.ts +41 -0
- package/a11y/src/focus-restore.d.ts +116 -0
- package/a11y/src/focus-trap.d.ts +69 -0
- package/a11y/src/form-associated.d.ts +48 -0
- package/a11y/src/host-aria.d.ts +154 -0
- package/a11y/src/index.d.ts +16 -0
- package/a11y/src/inert-regions.d.ts +52 -0
- package/a11y/src/live-announcer.d.ts +8 -0
- package/a11y/src/roving-focus.d.ts +118 -0
- package/a11y/src/testing/expect-idref-resolves.d.ts +31 -0
- package/a11y/src/testing/index.d.ts +1 -0
- package/accordion/index.d.ts +1 -0
- package/accordion/index.mjs +549 -0
- package/accordion/src/components/index.d.ts +3 -0
- package/accordion/src/components/mp-accordion-tab.d.ts +30 -0
- package/accordion/src/components/mp-accordion.d.ts +66 -0
- package/accordion/src/index.d.ts +3 -0
- package/accordion/src/styles/index.d.ts +1 -0
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +2 -0
- package/carousel/index.d.ts +1 -0
- package/carousel/index.mjs +994 -0
- package/carousel/src/components/index.d.ts +1 -0
- package/carousel/src/components/mp-carousel.d.ts +58 -0
- package/carousel/src/index.d.ts +3 -0
- package/carousel/src/styles/index.d.ts +1 -0
- package/carousel/src/types/carousel.d.ts +10 -0
- package/carousel/src/types/index.d.ts +1 -0
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +59 -1
- package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
- package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
- package/chunks/form-associated-axmc5sY0.mjs +58 -0
- package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
- package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
- package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
- package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
- package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
- package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
- package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
- package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
- package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
- package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
- package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
- package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
- package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
- package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
- package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
- package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
- package/chunks/roving-focus-CrL9982a.mjs +129 -0
- package/code-snippet/index.mjs +21 -13
- package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/mp-datatable.d.ts +50 -0
- package/datatable/src/types/index.d.ts +2 -0
- package/datatable/src/types/labels.d.ts +30 -0
- package/datepicker/index.mjs +45 -22
- package/datepicker/src/mp-datepicker.element.d.ts +30 -0
- package/datetime-picker/index.mjs +15 -9
- package/dock/index.mjs +365 -209
- package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
- package/dropdown-menu/index.mjs +135 -90
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
- package/file-manager/index.mjs +279 -214
- package/file-manager/src/components/mp-file-manager.d.ts +22 -0
- package/file-manager/src/types/messages.d.ts +9 -0
- package/multi-range/index.mjs +26 -10
- package/multi-range/src/mint-multi-range.element.d.ts +7 -0
- package/navbar/index.mjs +53 -39
- package/navbar/src/components/mp-navbar.d.ts +1 -0
- package/otp-input/index.mjs +82 -48
- package/otp-input/src/mint-otp-input.element.d.ts +31 -3
- package/overlay/index.mjs +2 -258
- package/overlay/src/overlay-controller.d.ts +64 -4
- package/package.json +21 -1
- package/pagination/index.mjs +1 -1
- package/query-builder/index.mjs +117 -87
- package/query-builder/src/model/messages.d.ts +9 -0
- package/radio/index.mjs +2 -160
- package/radio/src/components/mp-radio.d.ts +58 -3
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.mjs +145 -0
- package/radio-group/src/components/mp-radio-group.d.ts +52 -0
- package/radio-group/src/index.d.ts +1 -0
- package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
- package/ribbon/index.mjs +316 -304
- package/ribbon/src/mp-ribbon.element.d.ts +16 -0
- package/scheduler/index.mjs +219 -132
- package/scheduler/src/components/mp-scheduler.d.ts +3 -0
- package/scheduler/src/views/base-view.d.ts +23 -0
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +60 -3
- package/shell/index.mjs +142 -31
- package/shell/src/components/mp-shell.d.ts +1 -0
- package/signature-pad/index.d.ts +1 -0
- package/signature-pad/index.mjs +230 -0
- package/signature-pad/src/index.d.ts +2 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
- package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
- package/signature-pad/src/types/signature.d.ts +12 -0
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +7 -0
- package/splitter/src/index.d.ts +1 -1
- package/swiper-core/index.d.ts +1 -0
- package/swiper-core/index.mjs +184 -0
- package/swiper-core/src/index-machine.d.ts +59 -0
- package/swiper-core/src/index.d.ts +4 -0
- package/swiper-core/src/keymap.d.ts +2 -0
- package/swiper-core/src/models/index.d.ts +1 -0
- package/swiper-core/src/models/types.d.ts +99 -0
- package/swiper-core/src/pointer-arbiter.d.ts +45 -0
- package/tab-control/index.mjs +1 -1
- package/tile-manager/index.mjs +110 -93
- package/timeline/index.mjs +138 -54
- package/timeline/src/components/mp-timeline.d.ts +15 -0
- package/timepicker/index.mjs +1 -1
- package/timepicker/src/mp-time-list.element.d.ts +13 -4
- package/timepicker/src/mp-timepicker.element.d.ts +29 -0
- package/toggle-button/index.mjs +1 -1
- package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
- package/tree-select/index.mjs +233 -121
- package/tree-select/src/components/mp-tree-select.d.ts +37 -0
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +10 -1
- package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
- package/dropdown/src/styles/dropdown.styles.d.ts +0 -2
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export type RovingFocusOrientation = 'vertical' | 'horizontal' | 'both';
|
|
2
|
+
/**
|
|
3
|
+
* Index arithmetic for roving navigation, with no DOM and no framework in it.
|
|
4
|
+
*
|
|
5
|
+
* Extracted so the Angular `BsRovingFocusDirective` can share it rather than
|
|
6
|
+
* keep a second copy. That directive predates this controller and the two had
|
|
7
|
+
* independently identical `step` / `firstEnabled` / `lastEnabled` logic — and
|
|
8
|
+
* they had already drifted on the wrap-vs-clamp default, which is precisely the
|
|
9
|
+
* inconsistency a shared primitive exists to remove.
|
|
10
|
+
*
|
|
11
|
+
* Only the arithmetic is shared. The adapters stay separate on purpose: Angular
|
|
12
|
+
* discovers items through `contentChildren`, exposes `activeIndex` as a signal,
|
|
13
|
+
* and writes `tabindex` through a host binding on each item directive, while
|
|
14
|
+
* this controller takes a callback and writes `tabIndex` imperatively. Making
|
|
15
|
+
* Angular delegate to the class below would put two writers on one attribute —
|
|
16
|
+
* the hazard the workspace has already been bitten by once (see
|
|
17
|
+
* `otp-input.component.ts:124-131`).
|
|
18
|
+
*
|
|
19
|
+
* @param count number of candidate items
|
|
20
|
+
* @param from current index
|
|
21
|
+
* @param delta +1 or -1
|
|
22
|
+
* @param wrap pass the ends, or stop at them
|
|
23
|
+
* @param isDisabled by index, so callers can consult signals or attributes
|
|
24
|
+
* @returns the next enabled index, or `-1` when there is nowhere to go
|
|
25
|
+
*/
|
|
26
|
+
export declare function nextEnabledIndex(count: number, from: number, delta: 1 | -1, wrap: boolean, isDisabled: (index: number) => boolean): number;
|
|
27
|
+
/** First enabled index, or `-1` when every item is disabled. */
|
|
28
|
+
export declare function firstEnabledIndex(count: number, isDisabled: (index: number) => boolean): number;
|
|
29
|
+
/** Last enabled index, or `-1` when every item is disabled. */
|
|
30
|
+
export declare function lastEnabledIndex(count: number, isDisabled: (index: number) => boolean): number;
|
|
31
|
+
export interface RovingFocusOptions {
|
|
32
|
+
/**
|
|
33
|
+
* The navigable items, in tab order, recomputed on every interaction.
|
|
34
|
+
*
|
|
35
|
+
* A callback rather than a static list because these components rebuild their
|
|
36
|
+
* DOM constantly, and because items may live in the shadow root **or** be
|
|
37
|
+
* slotted light DOM — so no single query can be baked in.
|
|
38
|
+
*/
|
|
39
|
+
items: () => HTMLElement[];
|
|
40
|
+
/** Which arrow keys navigate. Default `'vertical'`. */
|
|
41
|
+
orientation?: RovingFocusOrientation;
|
|
42
|
+
/**
|
|
43
|
+
* Wrap past the ends. Default **false** — clamping is the APG default for
|
|
44
|
+
* grids and trees, and the audit found existing hand-rolled implementations
|
|
45
|
+
* split roughly evenly between the two, which is exactly the inconsistency
|
|
46
|
+
* this primitive exists to remove. Opt in per component where the pattern
|
|
47
|
+
* calls for it (menus wrap).
|
|
48
|
+
*/
|
|
49
|
+
wrap?: boolean;
|
|
50
|
+
/** Treated as skippable. Default: `[aria-disabled="true"]` or `:disabled`. */
|
|
51
|
+
isDisabled?: (el: HTMLElement) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Invert Left/Right under RTL. Default true — reading direction is read from
|
|
54
|
+
* the item's computed `direction`, so a mirrored layout navigates the way it
|
|
55
|
+
* looks.
|
|
56
|
+
*/
|
|
57
|
+
rtlAware?: boolean;
|
|
58
|
+
/** Called after the active item changes, for `aria-activedescendant` mirroring or announcements. */
|
|
59
|
+
onActiveChange?: (item: HTMLElement, index: number) => void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* APG roving-tabindex container: exactly one item is tabbable, arrow keys move
|
|
63
|
+
* both DOM focus and the tab stop.
|
|
64
|
+
*
|
|
65
|
+
* Fourteen components hand-rolled this, and they drifted — some wrap at the
|
|
66
|
+
* ends, some clamp; some activate on focus, some on Enter — so a user who
|
|
67
|
+
* learns one composite widget's keyboard model cannot transfer it to the next.
|
|
68
|
+
* The point of this primitive is less any individual fix than that the next
|
|
69
|
+
* component does not add a fifteenth variant.
|
|
70
|
+
*
|
|
71
|
+
* `aria-activedescendant` is **not** offered as a mode, unlike the Angular
|
|
72
|
+
* directive it is ported from. Inside a shadow root that attribute is a trap:
|
|
73
|
+
* it is an IDREF, so it resolves only within the holder's own tree, and the
|
|
74
|
+
* audit found the one component that tried it (`mp-time-list`) had a
|
|
75
|
+
* permanently dangling reference — the host held the attribute while the option
|
|
76
|
+
* ids lived in its shadow root, so arrow keys announced nothing at all. Moving
|
|
77
|
+
* real DOM focus crosses shadow boundaries where IDREFs cannot, so
|
|
78
|
+
* roving-tabindex is the only mechanism that works here.
|
|
79
|
+
*/
|
|
80
|
+
export declare class RovingFocus {
|
|
81
|
+
private readonly options;
|
|
82
|
+
private activeIndex;
|
|
83
|
+
constructor(options: RovingFocusOptions);
|
|
84
|
+
/**
|
|
85
|
+
* Apply `tabindex` across the items so exactly one is tabbable.
|
|
86
|
+
*
|
|
87
|
+
* Call from the host's `updated()`. Vital for a rebuilt DOM: if the active
|
|
88
|
+
* item disappears, something must still be tabbable or the whole widget drops
|
|
89
|
+
* out of the tab order and can never be entered again — the failure the audit
|
|
90
|
+
* found in `mp-treeview` (collapse the focused node's ancestor and the tree
|
|
91
|
+
* becomes unreachable) and in `bs-rating` (no value set, so no star is
|
|
92
|
+
* tabbable).
|
|
93
|
+
*/
|
|
94
|
+
sync(): void;
|
|
95
|
+
/** Index of the current tab stop. */
|
|
96
|
+
get index(): number;
|
|
97
|
+
get activeItem(): HTMLElement | null;
|
|
98
|
+
/**
|
|
99
|
+
* Handle a keydown. Returns true when the key was consumed, so the caller can
|
|
100
|
+
* `preventDefault()` and stop there.
|
|
101
|
+
*
|
|
102
|
+
* Only acts when the event originated on one of the items — a key typed into
|
|
103
|
+
* an input nested inside an item must reach the input, not be reinterpreted
|
|
104
|
+
* as navigation. That guard is the bug the audit found in `mp-treeview`,
|
|
105
|
+
* where a consumer's node template could not be typed into at all.
|
|
106
|
+
*/
|
|
107
|
+
onKeydown(event: KeyboardEvent): boolean;
|
|
108
|
+
/** Move the tab stop to `index` and focus it. Returns false if it could not move. */
|
|
109
|
+
moveTo(index: number): boolean;
|
|
110
|
+
/** Point the tab stop at a specific element, without focusing it. */
|
|
111
|
+
setActiveItem(item: HTMLElement): void;
|
|
112
|
+
private step;
|
|
113
|
+
/** First enabled index, falling back to 0 so a fully-disabled set still has a tab stop. */
|
|
114
|
+
private firstEnabledIndex;
|
|
115
|
+
private lastEnabledIndex;
|
|
116
|
+
private isDisabled;
|
|
117
|
+
private rtl;
|
|
118
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assert that every token of an IDREF attribute resolves in the tree the
|
|
3
|
+
* *browser* would search.
|
|
4
|
+
*
|
|
5
|
+
* The bug this catches, and why it needs a helper rather than a convention: an
|
|
6
|
+
* IDREF attribute resolves only within the containing tree of the element that
|
|
7
|
+
* **holds** it — its shadow root if it is inside one, otherwise the document. It
|
|
8
|
+
* never crosses a shadow boundary in either direction, and a dangling reference
|
|
9
|
+
* fails completely silently: no console warning, no visual change, and the
|
|
10
|
+
* attribute sits there in devtools looking correct.
|
|
11
|
+
*
|
|
12
|
+
* Three tests in this repo were green while asserting relationships that resolve
|
|
13
|
+
* to nothing, because they checked the attribute's *string value*
|
|
14
|
+
* (`expect(el.getAttribute('aria-controls')).toBe('panel-1')`) or resolved the id
|
|
15
|
+
* in the wrong root (`shadowRoot.querySelector('#' + id)` for an attribute held
|
|
16
|
+
* on the host). Both pass regardless of whether a screen reader can follow the
|
|
17
|
+
* reference.
|
|
18
|
+
*
|
|
19
|
+
* Applied across the ~26 IDREF sites in the library this fails on exactly the
|
|
20
|
+
* six known-dead ones: `mp-time-list`'s `aria-activedescendant`, `mp-ribbon` ↔
|
|
21
|
+
* `mp-ribbon-tab` in both directions, `mp-checkbox`'s two forwarded attributes,
|
|
22
|
+
* and `mp-dropdown-menu`'s `label-id`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function expectIdrefResolves(el: Element, attribute: string): void;
|
|
25
|
+
/** Assert that an IDREF attribute is absent, or present and fully resolvable. */
|
|
26
|
+
export declare function expectNoDanglingIdref(el: Element, attribute: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Walk a subtree (crossing shadow roots) and assert that no IDREF attribute
|
|
29
|
+
* anywhere dangles. Use as a blanket regression net in a component's ARIA spec.
|
|
30
|
+
*/
|
|
31
|
+
export declare function expectNoDanglingIdrefsIn(root: Element | ShadowRoot): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { expectIdrefResolves, expectNoDanglingIdref, expectNoDanglingIdrefsIn } from './expect-idref-resolves';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src';
|