@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.
Files changed (128) hide show
  1. package/a11y/index.mjs +26 -2
  2. package/a11y/src/dismiss-stack.d.ts +25 -0
  3. package/a11y/src/error-text.d.ts +41 -0
  4. package/a11y/src/focus-restore.d.ts +116 -0
  5. package/a11y/src/focus-trap.d.ts +69 -0
  6. package/a11y/src/form-associated.d.ts +48 -0
  7. package/a11y/src/host-aria.d.ts +154 -0
  8. package/a11y/src/index.d.ts +16 -0
  9. package/a11y/src/inert-regions.d.ts +52 -0
  10. package/a11y/src/live-announcer.d.ts +8 -0
  11. package/a11y/src/roving-focus.d.ts +118 -0
  12. package/a11y/src/testing/expect-idref-resolves.d.ts +31 -0
  13. package/a11y/src/testing/index.d.ts +1 -0
  14. package/accordion/index.d.ts +1 -0
  15. package/accordion/index.mjs +549 -0
  16. package/accordion/src/components/index.d.ts +3 -0
  17. package/accordion/src/components/mp-accordion-tab.d.ts +30 -0
  18. package/accordion/src/components/mp-accordion.d.ts +66 -0
  19. package/accordion/src/index.d.ts +3 -0
  20. package/accordion/src/styles/index.d.ts +1 -0
  21. package/calendar/index.mjs +1 -1
  22. package/calendar/src/mp-calendar.element.d.ts +2 -0
  23. package/carousel/index.d.ts +1 -0
  24. package/carousel/index.mjs +994 -0
  25. package/carousel/src/components/index.d.ts +1 -0
  26. package/carousel/src/components/mp-carousel.d.ts +58 -0
  27. package/carousel/src/index.d.ts +3 -0
  28. package/carousel/src/styles/index.d.ts +1 -0
  29. package/carousel/src/types/carousel.d.ts +10 -0
  30. package/carousel/src/types/index.d.ts +1 -0
  31. package/checkbox/index.mjs +1 -1
  32. package/checkbox/src/components/mp-checkbox.d.ts +59 -1
  33. package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
  34. package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
  35. package/chunks/form-associated-axmc5sY0.mjs +58 -0
  36. package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
  37. package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
  38. package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
  39. package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
  40. package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
  41. package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
  42. package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
  43. package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
  44. package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
  45. package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
  46. package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
  47. package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
  48. package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
  49. package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
  50. package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
  51. package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
  52. package/chunks/roving-focus-CrL9982a.mjs +129 -0
  53. package/code-snippet/index.mjs +21 -13
  54. package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
  55. package/datatable/index.mjs +1 -1
  56. package/datatable/src/components/mp-datatable.d.ts +50 -0
  57. package/datatable/src/types/index.d.ts +2 -0
  58. package/datatable/src/types/labels.d.ts +30 -0
  59. package/datepicker/index.mjs +45 -22
  60. package/datepicker/src/mp-datepicker.element.d.ts +30 -0
  61. package/datetime-picker/index.mjs +15 -9
  62. package/dock/index.mjs +365 -209
  63. package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
  64. package/dropdown-menu/index.mjs +135 -90
  65. package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
  66. package/file-manager/index.mjs +279 -214
  67. package/file-manager/src/components/mp-file-manager.d.ts +22 -0
  68. package/file-manager/src/types/messages.d.ts +9 -0
  69. package/multi-range/index.mjs +26 -10
  70. package/multi-range/src/mint-multi-range.element.d.ts +7 -0
  71. package/navbar/index.mjs +53 -39
  72. package/navbar/src/components/mp-navbar.d.ts +1 -0
  73. package/otp-input/index.mjs +82 -48
  74. package/otp-input/src/mint-otp-input.element.d.ts +31 -3
  75. package/overlay/index.mjs +2 -258
  76. package/overlay/src/overlay-controller.d.ts +64 -4
  77. package/package.json +21 -1
  78. package/pagination/index.mjs +1 -1
  79. package/query-builder/index.mjs +117 -87
  80. package/query-builder/src/model/messages.d.ts +9 -0
  81. package/radio/index.mjs +2 -160
  82. package/radio/src/components/mp-radio.d.ts +58 -3
  83. package/radio-group/index.d.ts +1 -0
  84. package/radio-group/index.mjs +145 -0
  85. package/radio-group/src/components/mp-radio-group.d.ts +52 -0
  86. package/radio-group/src/index.d.ts +1 -0
  87. package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
  88. package/ribbon/index.mjs +316 -304
  89. package/ribbon/src/mp-ribbon.element.d.ts +16 -0
  90. package/scheduler/index.mjs +219 -132
  91. package/scheduler/src/components/mp-scheduler.d.ts +3 -0
  92. package/scheduler/src/views/base-view.d.ts +23 -0
  93. package/select/index.mjs +1 -1
  94. package/select/src/components/mp-select.d.ts +60 -3
  95. package/shell/index.mjs +142 -31
  96. package/shell/src/components/mp-shell.d.ts +1 -0
  97. package/signature-pad/index.d.ts +1 -0
  98. package/signature-pad/index.mjs +230 -0
  99. package/signature-pad/src/index.d.ts +2 -0
  100. package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
  101. package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
  102. package/signature-pad/src/types/signature.d.ts +12 -0
  103. package/splitter/index.mjs +1 -1
  104. package/splitter/src/components/mp-splitter.d.ts +7 -0
  105. package/splitter/src/index.d.ts +1 -1
  106. package/swiper-core/index.d.ts +1 -0
  107. package/swiper-core/index.mjs +184 -0
  108. package/swiper-core/src/index-machine.d.ts +59 -0
  109. package/swiper-core/src/index.d.ts +4 -0
  110. package/swiper-core/src/keymap.d.ts +2 -0
  111. package/swiper-core/src/models/index.d.ts +1 -0
  112. package/swiper-core/src/models/types.d.ts +99 -0
  113. package/swiper-core/src/pointer-arbiter.d.ts +45 -0
  114. package/tab-control/index.mjs +1 -1
  115. package/tile-manager/index.mjs +110 -93
  116. package/timeline/index.mjs +138 -54
  117. package/timeline/src/components/mp-timeline.d.ts +15 -0
  118. package/timepicker/index.mjs +1 -1
  119. package/timepicker/src/mp-time-list.element.d.ts +13 -4
  120. package/timepicker/src/mp-timepicker.element.d.ts +29 -0
  121. package/toggle-button/index.mjs +1 -1
  122. package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
  123. package/tree-select/index.mjs +233 -121
  124. package/tree-select/src/components/mp-tree-select.d.ts +37 -0
  125. package/treeview/index.mjs +1 -1
  126. package/treeview/src/components/mp-treeview.d.ts +10 -1
  127. package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
  128. 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';