@kato-lee/cdk 14.2.7

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 (374) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +8 -0
  3. package/_index.scss +8 -0
  4. package/a11y/_index.import.scss +2 -0
  5. package/a11y/_index.scss +102 -0
  6. package/a11y/index.d.ts +1212 -0
  7. package/a11y-prebuilt.css +1 -0
  8. package/accordion/index.d.ts +140 -0
  9. package/bidi/index.d.ts +80 -0
  10. package/clipboard/index.d.ts +115 -0
  11. package/coercion/index.d.ts +67 -0
  12. package/collections/index.d.ts +374 -0
  13. package/dialog/index.d.ts +469 -0
  14. package/drag-drop/index.d.ts +1614 -0
  15. package/esm2020/a11y/a11y-module.mjs +32 -0
  16. package/esm2020/a11y/a11y_public_index.mjs +5 -0
  17. package/esm2020/a11y/aria-describer/aria-describer.mjs +232 -0
  18. package/esm2020/a11y/aria-describer/aria-reference.mjs +44 -0
  19. package/esm2020/a11y/fake-event-detection.mjs +31 -0
  20. package/esm2020/a11y/focus-monitor/focus-monitor.mjs +451 -0
  21. package/esm2020/a11y/focus-trap/configurable-focus-trap-config.mjs +9 -0
  22. package/esm2020/a11y/focus-trap/configurable-focus-trap-factory.mjs +53 -0
  23. package/esm2020/a11y/focus-trap/configurable-focus-trap.mjs +51 -0
  24. package/esm2020/a11y/focus-trap/event-listener-inert-strategy.mjs +61 -0
  25. package/esm2020/a11y/focus-trap/focus-trap-inert-strategy.mjs +11 -0
  26. package/esm2020/a11y/focus-trap/focus-trap-manager.mjs +53 -0
  27. package/esm2020/a11y/focus-trap/focus-trap.mjs +402 -0
  28. package/esm2020/a11y/high-contrast-mode/high-contrast-mode-detector.mjs +109 -0
  29. package/esm2020/a11y/index.mjs +9 -0
  30. package/esm2020/a11y/input-modality/input-modality-detector.mjs +176 -0
  31. package/esm2020/a11y/interactivity-checker/interactivity-checker.mjs +238 -0
  32. package/esm2020/a11y/key-manager/activedescendant-key-manager.mjs +20 -0
  33. package/esm2020/a11y/key-manager/focus-key-manager.mjs +29 -0
  34. package/esm2020/a11y/key-manager/list-key-manager.mjs +321 -0
  35. package/esm2020/a11y/live-announcer/live-announcer-tokens.mjs +19 -0
  36. package/esm2020/a11y/live-announcer/live-announcer.mjs +178 -0
  37. package/esm2020/a11y/public-api.mjs +26 -0
  38. package/esm2020/accordion/accordion-item.mjs +167 -0
  39. package/esm2020/accordion/accordion-module.mjs +24 -0
  40. package/esm2020/accordion/accordion.mjs +70 -0
  41. package/esm2020/accordion/accordion_public_index.mjs +5 -0
  42. package/esm2020/accordion/index.mjs +9 -0
  43. package/esm2020/accordion/public-api.mjs +11 -0
  44. package/esm2020/bidi/bidi-module.mjs +23 -0
  45. package/esm2020/bidi/bidi_public_index.mjs +5 -0
  46. package/esm2020/bidi/dir-document-token.mjs +33 -0
  47. package/esm2020/bidi/dir.mjs +69 -0
  48. package/esm2020/bidi/directionality.mjs +52 -0
  49. package/esm2020/bidi/index.mjs +9 -0
  50. package/esm2020/bidi/public-api.mjs +12 -0
  51. package/esm2020/clipboard/clipboard-module.mjs +23 -0
  52. package/esm2020/clipboard/clipboard.mjs +53 -0
  53. package/esm2020/clipboard/clipboard_public_index.mjs +5 -0
  54. package/esm2020/clipboard/copy-to-clipboard.mjs +99 -0
  55. package/esm2020/clipboard/index.mjs +9 -0
  56. package/esm2020/clipboard/pending-copy.mjs +69 -0
  57. package/esm2020/clipboard/public-api.mjs +12 -0
  58. package/esm2020/coercion/array.mjs +11 -0
  59. package/esm2020/coercion/boolean-property.mjs +12 -0
  60. package/esm2020/coercion/css-pixel-value.mjs +15 -0
  61. package/esm2020/coercion/element.mjs +16 -0
  62. package/esm2020/coercion/index.mjs +9 -0
  63. package/esm2020/coercion/number-property.mjs +21 -0
  64. package/esm2020/coercion/public-api.mjs +14 -0
  65. package/esm2020/coercion/string-array.mjs +38 -0
  66. package/esm2020/collections/array-data-source.mjs +21 -0
  67. package/esm2020/collections/collection-viewer.mjs +9 -0
  68. package/esm2020/collections/collections_public_index.mjs +5 -0
  69. package/esm2020/collections/data-source.mjs +19 -0
  70. package/esm2020/collections/dispose-view-repeater-strategy.mjs +47 -0
  71. package/esm2020/collections/index.mjs +9 -0
  72. package/esm2020/collections/public-api.mjs +17 -0
  73. package/esm2020/collections/recycle-view-repeater-strategy.mjs +128 -0
  74. package/esm2020/collections/selection-model.mjs +216 -0
  75. package/esm2020/collections/tree-adapter.mjs +9 -0
  76. package/esm2020/collections/unique-selection-dispatcher.mjs +55 -0
  77. package/esm2020/collections/view-repeater.mjs +14 -0
  78. package/esm2020/dialog/dialog-config.mjs +63 -0
  79. package/esm2020/dialog/dialog-container.mjs +278 -0
  80. package/esm2020/dialog/dialog-injectors.mjs +26 -0
  81. package/esm2020/dialog/dialog-module.mjs +42 -0
  82. package/esm2020/dialog/dialog-ref.mjs +76 -0
  83. package/esm2020/dialog/dialog.mjs +301 -0
  84. package/esm2020/dialog/dialog_public_index.mjs +5 -0
  85. package/esm2020/dialog/index.mjs +9 -0
  86. package/esm2020/dialog/public-api.mjs +14 -0
  87. package/esm2020/drag-drop/directives/assertions.mjs +18 -0
  88. package/esm2020/drag-drop/directives/config.mjs +14 -0
  89. package/esm2020/drag-drop/directives/drag-handle.mjs +66 -0
  90. package/esm2020/drag-drop/directives/drag-placeholder.mjs +36 -0
  91. package/esm2020/drag-drop/directives/drag-preview.mjs +47 -0
  92. package/esm2020/drag-drop/directives/drag.mjs +487 -0
  93. package/esm2020/drag-drop/directives/drop-list-group.mjs +53 -0
  94. package/esm2020/drag-drop/directives/drop-list.mjs +345 -0
  95. package/esm2020/drag-drop/dom/client-rect.mjs +64 -0
  96. package/esm2020/drag-drop/dom/clone-node.mjs +65 -0
  97. package/esm2020/drag-drop/dom/parent-position-tracker.mjs +76 -0
  98. package/esm2020/drag-drop/dom/styling.mjs +69 -0
  99. package/esm2020/drag-drop/dom/transition-duration.mjs +36 -0
  100. package/esm2020/drag-drop/drag-drop-module.mjs +57 -0
  101. package/esm2020/drag-drop/drag-drop-registry.mjs +231 -0
  102. package/esm2020/drag-drop/drag-drop.mjs +57 -0
  103. package/esm2020/drag-drop/drag-drop_public_index.mjs +5 -0
  104. package/esm2020/drag-drop/drag-events.mjs +9 -0
  105. package/esm2020/drag-drop/drag-parent.mjs +16 -0
  106. package/esm2020/drag-drop/drag-ref.mjs +1146 -0
  107. package/esm2020/drag-drop/drag-utils.mjs +60 -0
  108. package/esm2020/drag-drop/drop-list-ref.mjs +577 -0
  109. package/esm2020/drag-drop/index.mjs +9 -0
  110. package/esm2020/drag-drop/public-api.mjs +23 -0
  111. package/esm2020/drag-drop/sorting/drop-list-sort-strategy.mjs +9 -0
  112. package/esm2020/drag-drop/sorting/single-axis-sort-strategy.mjs +341 -0
  113. package/esm2020/index.mjs +9 -0
  114. package/esm2020/keycodes/index.mjs +9 -0
  115. package/esm2020/keycodes/keycodes.mjs +127 -0
  116. package/esm2020/keycodes/keycodes_public_index.mjs +5 -0
  117. package/esm2020/keycodes/modifiers.mjs +18 -0
  118. package/esm2020/keycodes/public-api.mjs +10 -0
  119. package/esm2020/layout/breakpoints-observer.mjs +105 -0
  120. package/esm2020/layout/breakpoints.mjs +29 -0
  121. package/esm2020/layout/index.mjs +9 -0
  122. package/esm2020/layout/layout-module.mjs +19 -0
  123. package/esm2020/layout/layout_public_index.mjs +5 -0
  124. package/esm2020/layout/media-matcher.mjs +85 -0
  125. package/esm2020/layout/public-api.mjs +12 -0
  126. package/esm2020/listbox/index.mjs +9 -0
  127. package/esm2020/listbox/listbox-module.mjs +24 -0
  128. package/esm2020/listbox/listbox.mjs +872 -0
  129. package/esm2020/listbox/listbox_public_index.mjs +5 -0
  130. package/esm2020/listbox/public-api.mjs +10 -0
  131. package/esm2020/menu/context-menu-trigger.mjs +212 -0
  132. package/esm2020/menu/index.mjs +9 -0
  133. package/esm2020/menu/menu-aim.mjs +203 -0
  134. package/esm2020/menu/menu-bar.mjs +133 -0
  135. package/esm2020/menu/menu-base.mjs +187 -0
  136. package/esm2020/menu/menu-errors.mjs +22 -0
  137. package/esm2020/menu/menu-group.mjs +30 -0
  138. package/esm2020/menu/menu-interface.mjs +11 -0
  139. package/esm2020/menu/menu-item-checkbox.mjs +49 -0
  140. package/esm2020/menu/menu-item-radio.mjs +71 -0
  141. package/esm2020/menu/menu-item-selectable.mjs +42 -0
  142. package/esm2020/menu/menu-item.mjs +267 -0
  143. package/esm2020/menu/menu-module.mjs +62 -0
  144. package/esm2020/menu/menu-stack.mjs +156 -0
  145. package/esm2020/menu/menu-trigger-base.mjs +107 -0
  146. package/esm2020/menu/menu-trigger.mjs +291 -0
  147. package/esm2020/menu/menu.mjs +134 -0
  148. package/esm2020/menu/menu_public_index.mjs +5 -0
  149. package/esm2020/menu/pointer-focus-tracker.mjs +51 -0
  150. package/esm2020/menu/public-api.mjs +24 -0
  151. package/esm2020/observers/index.mjs +9 -0
  152. package/esm2020/observers/observe-content.mjs +187 -0
  153. package/esm2020/observers/observers_public_index.mjs +5 -0
  154. package/esm2020/observers/public-api.mjs +9 -0
  155. package/esm2020/overlay/dispatchers/base-overlay-dispatcher.mjs +52 -0
  156. package/esm2020/overlay/dispatchers/index.mjs +10 -0
  157. package/esm2020/overlay/dispatchers/overlay-keyboard-dispatcher.mjs +81 -0
  158. package/esm2020/overlay/dispatchers/overlay-outside-click-dispatcher.mjs +138 -0
  159. package/esm2020/overlay/fullscreen-overlay-container.mjs +94 -0
  160. package/esm2020/overlay/index.mjs +9 -0
  161. package/esm2020/overlay/overlay-config.mjs +45 -0
  162. package/esm2020/overlay/overlay-container.mjs +81 -0
  163. package/esm2020/overlay/overlay-directives.mjs +427 -0
  164. package/esm2020/overlay/overlay-module.mjs +29 -0
  165. package/esm2020/overlay/overlay-ref.mjs +427 -0
  166. package/esm2020/overlay/overlay-reference.mjs +9 -0
  167. package/esm2020/overlay/overlay.mjs +125 -0
  168. package/esm2020/overlay/overlay_public_index.mjs +5 -0
  169. package/esm2020/overlay/position/connected-position.mjs +88 -0
  170. package/esm2020/overlay/position/flexible-connected-position-strategy.mjs +985 -0
  171. package/esm2020/overlay/position/global-position-strategy.mjs +237 -0
  172. package/esm2020/overlay/position/overlay-position-builder.mjs +50 -0
  173. package/esm2020/overlay/position/position-strategy.mjs +9 -0
  174. package/esm2020/overlay/position/scroll-clip.mjs +40 -0
  175. package/esm2020/overlay/public-api.mjs +22 -0
  176. package/esm2020/overlay/scroll/block-scroll-strategy.mjs +80 -0
  177. package/esm2020/overlay/scroll/close-scroll-strategy.mjs +61 -0
  178. package/esm2020/overlay/scroll/index.mjs +14 -0
  179. package/esm2020/overlay/scroll/noop-scroll-strategy.mjs +17 -0
  180. package/esm2020/overlay/scroll/reposition-scroll-strategy.mjs +61 -0
  181. package/esm2020/overlay/scroll/scroll-strategy-options.mjs +55 -0
  182. package/esm2020/overlay/scroll/scroll-strategy.mjs +14 -0
  183. package/esm2020/platform/features/input-types.mjs +59 -0
  184. package/esm2020/platform/features/passive-listeners.mjs +36 -0
  185. package/esm2020/platform/features/scrolling.mjs +85 -0
  186. package/esm2020/platform/features/shadow-dom.mjs +54 -0
  187. package/esm2020/platform/features/test-environment.mjs +24 -0
  188. package/esm2020/platform/index.mjs +9 -0
  189. package/esm2020/platform/platform-module.mjs +19 -0
  190. package/esm2020/platform/platform.mjs +85 -0
  191. package/esm2020/platform/platform_public_index.mjs +5 -0
  192. package/esm2020/platform/public-api.mjs +15 -0
  193. package/esm2020/portal/dom-portal-outlet.mjs +158 -0
  194. package/esm2020/portal/index.mjs +9 -0
  195. package/esm2020/portal/portal-directives.mjs +246 -0
  196. package/esm2020/portal/portal-errors.mjs +51 -0
  197. package/esm2020/portal/portal-injector.mjs +28 -0
  198. package/esm2020/portal/portal.mjs +188 -0
  199. package/esm2020/portal/portal_public_index.mjs +5 -0
  200. package/esm2020/portal/public-api.mjs +12 -0
  201. package/esm2020/public-api.mjs +9 -0
  202. package/esm2020/scrolling/fixed-size-virtual-scroll.mjs +217 -0
  203. package/esm2020/scrolling/index.mjs +9 -0
  204. package/esm2020/scrolling/public-api.mjs +20 -0
  205. package/esm2020/scrolling/scroll-dispatcher.mjs +163 -0
  206. package/esm2020/scrolling/scrollable.mjs +176 -0
  207. package/esm2020/scrolling/scrolling-module.mjs +67 -0
  208. package/esm2020/scrolling/scrolling_public_index.mjs +5 -0
  209. package/esm2020/scrolling/viewport-ruler.mjs +146 -0
  210. package/esm2020/scrolling/virtual-for-of.mjs +298 -0
  211. package/esm2020/scrolling/virtual-scroll-repeater.mjs +9 -0
  212. package/esm2020/scrolling/virtual-scroll-strategy.mjs +11 -0
  213. package/esm2020/scrolling/virtual-scroll-viewport.mjs +437 -0
  214. package/esm2020/scrolling/virtual-scrollable-element.mjs +41 -0
  215. package/esm2020/scrolling/virtual-scrollable-window.mjs +40 -0
  216. package/esm2020/scrolling/virtual-scrollable.mjs +40 -0
  217. package/esm2020/stepper/index.mjs +9 -0
  218. package/esm2020/stepper/public-api.mjs +13 -0
  219. package/esm2020/stepper/step-header.mjs +30 -0
  220. package/esm2020/stepper/step-label.mjs +23 -0
  221. package/esm2020/stepper/stepper-button.mjs +56 -0
  222. package/esm2020/stepper/stepper-module.mjs +40 -0
  223. package/esm2020/stepper/stepper.mjs +458 -0
  224. package/esm2020/stepper/stepper_public_index.mjs +5 -0
  225. package/esm2020/table/can-stick.mjs +44 -0
  226. package/esm2020/table/cell.mjs +217 -0
  227. package/esm2020/table/coalesced-style-scheduler.mjs +91 -0
  228. package/esm2020/table/index.mjs +9 -0
  229. package/esm2020/table/public-api.mjs +20 -0
  230. package/esm2020/table/row.mjs +262 -0
  231. package/esm2020/table/sticky-position-listener.mjs +11 -0
  232. package/esm2020/table/sticky-styler.mjs +345 -0
  233. package/esm2020/table/table-errors.mjs +67 -0
  234. package/esm2020/table/table-module.mjs +94 -0
  235. package/esm2020/table/table.mjs +1065 -0
  236. package/esm2020/table/table_public_index.mjs +5 -0
  237. package/esm2020/table/text-column.mjs +153 -0
  238. package/esm2020/table/tokens.mjs +16 -0
  239. package/esm2020/text-field/autofill.mjs +113 -0
  240. package/esm2020/text-field/autosize.mjs +309 -0
  241. package/esm2020/text-field/index.mjs +9 -0
  242. package/esm2020/text-field/public-api.mjs +11 -0
  243. package/esm2020/text-field/text-field-module.mjs +24 -0
  244. package/esm2020/text-field/text-field_public_index.mjs +5 -0
  245. package/esm2020/tree/control/base-tree-control.mjs +57 -0
  246. package/esm2020/tree/control/flat-tree-control.mjs +51 -0
  247. package/esm2020/tree/control/nested-tree-control.mjs +58 -0
  248. package/esm2020/tree/control/tree-control.mjs +2 -0
  249. package/esm2020/tree/index.mjs +9 -0
  250. package/esm2020/tree/nested-node.mjs +112 -0
  251. package/esm2020/tree/node.mjs +35 -0
  252. package/esm2020/tree/outlet.mjs +39 -0
  253. package/esm2020/tree/padding.mjs +131 -0
  254. package/esm2020/tree/public-api.mjs +20 -0
  255. package/esm2020/tree/toggle.mjs +50 -0
  256. package/esm2020/tree/tree-errors.mjs +43 -0
  257. package/esm2020/tree/tree-module.mjs +49 -0
  258. package/esm2020/tree/tree.mjs +347 -0
  259. package/esm2020/tree/tree_public_index.mjs +5 -0
  260. package/esm2020/version.mjs +11 -0
  261. package/fesm2015/a11y.mjs +2473 -0
  262. package/fesm2015/a11y.mjs.map +1 -0
  263. package/fesm2015/accordion.mjs +414 -0
  264. package/fesm2015/accordion.mjs.map +1 -0
  265. package/fesm2015/bidi.mjs +194 -0
  266. package/fesm2015/bidi.mjs.map +1 -0
  267. package/fesm2015/cdk.mjs +30 -0
  268. package/fesm2015/cdk.mjs.map +1 -0
  269. package/fesm2015/clipboard.mjs +263 -0
  270. package/fesm2015/clipboard.mjs.map +1 -0
  271. package/fesm2015/coercion.mjs +132 -0
  272. package/fesm2015/coercion.mjs.map +1 -0
  273. package/fesm2015/collections.mjs +519 -0
  274. package/fesm2015/collections.mjs.map +1 -0
  275. package/fesm2015/dialog.mjs +1050 -0
  276. package/fesm2015/dialog.mjs.map +1 -0
  277. package/fesm2015/drag-drop.mjs +3812 -0
  278. package/fesm2015/drag-drop.mjs.map +1 -0
  279. package/fesm2015/keycodes.mjs +167 -0
  280. package/fesm2015/keycodes.mjs.map +1 -0
  281. package/fesm2015/layout.mjs +337 -0
  282. package/fesm2015/layout.mjs.map +1 -0
  283. package/fesm2015/listbox.mjs +1200 -0
  284. package/fesm2015/listbox.mjs.map +1 -0
  285. package/fesm2015/menu.mjs +2719 -0
  286. package/fesm2015/menu.mjs.map +1 -0
  287. package/fesm2015/observers.mjs +326 -0
  288. package/fesm2015/observers.mjs.map +1 -0
  289. package/fesm2015/overlay.mjs +3137 -0
  290. package/fesm2015/overlay.mjs.map +1 -0
  291. package/fesm2015/platform.mjs +385 -0
  292. package/fesm2015/platform.mjs.map +1 -0
  293. package/fesm2015/portal.mjs +691 -0
  294. package/fesm2015/portal.mjs.map +1 -0
  295. package/fesm2015/scrolling.mjs +1558 -0
  296. package/fesm2015/scrolling.mjs.map +1 -0
  297. package/fesm2015/stepper.mjs +989 -0
  298. package/fesm2015/stepper.mjs.map +1 -0
  299. package/fesm2015/table.mjs +2356 -0
  300. package/fesm2015/table.mjs.map +1 -0
  301. package/fesm2015/testing.mjs +833 -0
  302. package/fesm2015/testing.mjs.map +1 -0
  303. package/fesm2015/text-field.mjs +461 -0
  304. package/fesm2015/text-field.mjs.map +1 -0
  305. package/fesm2015/tree.mjs +1303 -0
  306. package/fesm2015/tree.mjs.map +1 -0
  307. package/fesm2020/a11y.mjs +2476 -0
  308. package/fesm2020/a11y.mjs.map +1 -0
  309. package/fesm2020/accordion.mjs +414 -0
  310. package/fesm2020/accordion.mjs.map +1 -0
  311. package/fesm2020/bidi.mjs +192 -0
  312. package/fesm2020/bidi.mjs.map +1 -0
  313. package/fesm2020/cdk.mjs +30 -0
  314. package/fesm2020/cdk.mjs.map +1 -0
  315. package/fesm2020/clipboard.mjs +259 -0
  316. package/fesm2020/clipboard.mjs.map +1 -0
  317. package/fesm2020/coercion.mjs +132 -0
  318. package/fesm2020/coercion.mjs.map +1 -0
  319. package/fesm2020/collections.mjs +535 -0
  320. package/fesm2020/collections.mjs.map +1 -0
  321. package/fesm2020/dialog.mjs +787 -0
  322. package/fesm2020/dialog.mjs.map +1 -0
  323. package/fesm2020/drag-drop.mjs +3808 -0
  324. package/fesm2020/drag-drop.mjs.map +1 -0
  325. package/fesm2020/keycodes.mjs +167 -0
  326. package/fesm2020/keycodes.mjs.map +1 -0
  327. package/fesm2020/layout.mjs +337 -0
  328. package/fesm2020/layout.mjs.map +1 -0
  329. package/fesm2020/listbox.mjs +1164 -0
  330. package/fesm2020/listbox.mjs.map +1 -0
  331. package/fesm2020/menu.mjs +2615 -0
  332. package/fesm2020/menu.mjs.map +1 -0
  333. package/fesm2020/observers.mjs +325 -0
  334. package/fesm2020/observers.mjs.map +1 -0
  335. package/fesm2020/overlay.mjs +3145 -0
  336. package/fesm2020/overlay.mjs.map +1 -0
  337. package/fesm2020/platform.mjs +383 -0
  338. package/fesm2020/platform.mjs.map +1 -0
  339. package/fesm2020/portal.mjs +689 -0
  340. package/fesm2020/portal.mjs.map +1 -0
  341. package/fesm2020/scrolling.mjs +1591 -0
  342. package/fesm2020/scrolling.mjs.map +1 -0
  343. package/fesm2020/stepper.mjs +985 -0
  344. package/fesm2020/stepper.mjs.map +1 -0
  345. package/fesm2020/table.mjs +2348 -0
  346. package/fesm2020/table.mjs.map +1 -0
  347. package/fesm2020/testing.mjs +797 -0
  348. package/fesm2020/testing.mjs.map +1 -0
  349. package/fesm2020/text-field.mjs +459 -0
  350. package/fesm2020/text-field.mjs.map +1 -0
  351. package/fesm2020/tree.mjs +1305 -0
  352. package/fesm2020/tree.mjs.map +1 -0
  353. package/index.d.ts +6 -0
  354. package/keycodes/index.d.ts +249 -0
  355. package/layout/index.d.ts +90 -0
  356. package/listbox/index.d.ts +419 -0
  357. package/menu/index.d.ts +1013 -0
  358. package/observers/index.d.ts +109 -0
  359. package/overlay/_index-deprecated.scss +13 -0
  360. package/overlay/_index.import.scss +13 -0
  361. package/overlay/_index.scss +152 -0
  362. package/overlay/index.d.ts +1343 -0
  363. package/overlay-prebuilt.css +1 -0
  364. package/package.json +232 -0
  365. package/platform/index.d.ts +106 -0
  366. package/portal/index.d.ts +328 -0
  367. package/scrolling/index.d.ts +849 -0
  368. package/stepper/index.d.ts +419 -0
  369. package/table/index.d.ts +1483 -0
  370. package/text-field/_index.import.scss +2 -0
  371. package/text-field/_index.scss +89 -0
  372. package/text-field/index.d.ts +203 -0
  373. package/text-field-prebuilt.css +1 -0
  374. package/tree/index.d.ts +593 -0
@@ -0,0 +1,1200 @@
1
+ import * as i0 from '@angular/core';
2
+ import {
3
+ inject,
4
+ ElementRef,
5
+ Directive,
6
+ Input,
7
+ ChangeDetectorRef,
8
+ InjectFlags,
9
+ forwardRef,
10
+ Output,
11
+ ContentChildren,
12
+ NgModule,
13
+ } from '@angular/core';
14
+ import { ActiveDescendantKeyManager } from '@kato-lee/cdk/a11y';
15
+ import {
16
+ A,
17
+ hasModifierKey,
18
+ SPACE,
19
+ ENTER,
20
+ HOME,
21
+ END,
22
+ UP_ARROW,
23
+ DOWN_ARROW,
24
+ LEFT_ARROW,
25
+ RIGHT_ARROW,
26
+ } from '@kato-lee/cdk/keycodes';
27
+ import { coerceBooleanProperty, coerceArray } from '@kato-lee/cdk/coercion';
28
+ import { SelectionModel } from '@kato-lee/cdk/collections';
29
+ import { Subject, defer, merge } from 'rxjs';
30
+ import { startWith, switchMap, map, takeUntil, filter } from 'rxjs/operators';
31
+ import { Validators, NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
32
+ import { Directionality } from '@kato-lee/cdk/bidi';
33
+
34
+ /**
35
+ * @license
36
+ * Copyright Google LLC All Rights Reserved.
37
+ *
38
+ * Use of this source code is governed by an MIT-style license that can be
39
+ * found in the LICENSE file at https://angular.io/license
40
+ */
41
+ /** The next id to use for creating unique DOM IDs. */
42
+ let nextId = 0;
43
+ /**
44
+ * An implementation of SelectionModel that internally always represents the selection as a
45
+ * multi-selection. This is necessary so that we can recover the full selection if the user
46
+ * switches the listbox from single-selection to multi-selection after initialization.
47
+ *
48
+ * This selection model may report multiple selected values, even if it is in single-selection
49
+ * mode. It is up to the user (CdkListbox) to check for invalid selections.
50
+ */
51
+ class ListboxSelectionModel extends SelectionModel {
52
+ constructor(multiple = false, initiallySelectedValues, emitChanges = true, compareWith) {
53
+ super(true, initiallySelectedValues, emitChanges, compareWith);
54
+ this.multiple = multiple;
55
+ }
56
+ isMultipleSelection() {
57
+ return this.multiple;
58
+ }
59
+ select(...values) {
60
+ // The super class is always in multi-selection mode, so we need to override the behavior if
61
+ // this selection model actually belongs to a single-selection listbox.
62
+ if (this.multiple) {
63
+ return super.select(...values);
64
+ } else {
65
+ return super.setSelection(...values);
66
+ }
67
+ }
68
+ }
69
+ /** A selectable option in a listbox. */
70
+ class CdkOption {
71
+ constructor() {
72
+ this._generatedId = `cdk-option-${nextId++}`;
73
+ this._disabled = false;
74
+ /** The option's host element */
75
+ this.element = inject(ElementRef).nativeElement;
76
+ /** The parent listbox this option belongs to. */
77
+ this.listbox = inject(CdkListbox);
78
+ /** Emits when the option is destroyed. */
79
+ this.destroyed = new Subject();
80
+ /** Emits when the option is clicked. */
81
+ this._clicked = new Subject();
82
+ /** Whether the option is currently active. */
83
+ this._active = false;
84
+ }
85
+ /** The id of the option's host element. */
86
+ get id() {
87
+ return this._id || this._generatedId;
88
+ }
89
+ set id(value) {
90
+ this._id = value;
91
+ }
92
+ /** Whether this option is disabled. */
93
+ get disabled() {
94
+ return this.listbox.disabled || this._disabled;
95
+ }
96
+ set disabled(value) {
97
+ this._disabled = coerceBooleanProperty(value);
98
+ }
99
+ /** The tabindex of the option when it is enabled. */
100
+ get enabledTabIndex() {
101
+ return this._enabledTabIndex === undefined
102
+ ? this.listbox.enabledTabIndex
103
+ : this._enabledTabIndex;
104
+ }
105
+ set enabledTabIndex(value) {
106
+ this._enabledTabIndex = value;
107
+ }
108
+ ngOnDestroy() {
109
+ this.destroyed.next();
110
+ this.destroyed.complete();
111
+ }
112
+ /** Whether this option is selected. */
113
+ isSelected() {
114
+ return this.listbox.isSelected(this);
115
+ }
116
+ /** Whether this option is active. */
117
+ isActive() {
118
+ return this._active;
119
+ }
120
+ /** Toggle the selected state of this option. */
121
+ toggle() {
122
+ this.listbox.toggle(this);
123
+ }
124
+ /** Select this option if it is not selected. */
125
+ select() {
126
+ this.listbox.select(this);
127
+ }
128
+ /** Deselect this option if it is selected. */
129
+ deselect() {
130
+ this.listbox.deselect(this);
131
+ }
132
+ /** Focus this option. */
133
+ focus() {
134
+ this.element.focus();
135
+ }
136
+ /** Get the label for this element which is required by the FocusableOption interface. */
137
+ getLabel() {
138
+ var _a, _b;
139
+ return (
140
+ ((_a = this.typeaheadLabel) !== null && _a !== void 0
141
+ ? _a
142
+ : (_b = this.element.textContent) === null || _b === void 0
143
+ ? void 0
144
+ : _b.trim()) || ''
145
+ );
146
+ }
147
+ /**
148
+ * Set the option as active.
149
+ * @docs-private
150
+ */
151
+ setActiveStyles() {
152
+ this._active = true;
153
+ }
154
+ /**
155
+ * Set the option as inactive.
156
+ * @docs-private
157
+ */
158
+ setInactiveStyles() {
159
+ this._active = false;
160
+ }
161
+ /** Handle focus events on the option. */
162
+ _handleFocus() {
163
+ // Options can wind up getting focused in active descendant mode if the user clicks on them.
164
+ // In this case, we push focus back to the parent listbox to prevent an extra tab stop when
165
+ // the user performs a shift+tab.
166
+ if (this.listbox.useActiveDescendant) {
167
+ this.listbox._setActiveOption(this);
168
+ this.listbox.focus();
169
+ }
170
+ }
171
+ /** Get the tabindex for this option. */
172
+ _getTabIndex() {
173
+ if (this.listbox.useActiveDescendant || this.disabled) {
174
+ return -1;
175
+ }
176
+ return this.isActive() ? this.enabledTabIndex : -1;
177
+ }
178
+ }
179
+ CdkOption.ɵfac = i0.ɵɵngDeclareFactory({
180
+ minVersion: '12.0.0',
181
+ version: '14.2.0',
182
+ ngImport: i0,
183
+ type: CdkOption,
184
+ deps: [],
185
+ target: i0.ɵɵFactoryTarget.Directive,
186
+ });
187
+ CdkOption.ɵdir = i0.ɵɵngDeclareDirective({
188
+ minVersion: '14.0.0',
189
+ version: '14.2.0',
190
+ type: CdkOption,
191
+ selector: '[cdkOption]',
192
+ inputs: {
193
+ id: 'id',
194
+ value: ['cdkOption', 'value'],
195
+ typeaheadLabel: ['cdkOptionTypeaheadLabel', 'typeaheadLabel'],
196
+ disabled: ['cdkOptionDisabled', 'disabled'],
197
+ enabledTabIndex: ['tabindex', 'enabledTabIndex'],
198
+ },
199
+ host: {
200
+ attributes: { role: 'option' },
201
+ listeners: { click: '_clicked.next($event)', focus: '_handleFocus()' },
202
+ properties: {
203
+ id: 'id',
204
+ 'attr.aria-selected': 'isSelected()',
205
+ 'attr.tabindex': '_getTabIndex()',
206
+ 'attr.aria-disabled': 'disabled',
207
+ 'class.cdk-option-active': 'isActive()',
208
+ },
209
+ classAttribute: 'cdk-option',
210
+ },
211
+ exportAs: ['cdkOption'],
212
+ ngImport: i0,
213
+ });
214
+ i0.ɵɵngDeclareClassMetadata({
215
+ minVersion: '12.0.0',
216
+ version: '14.2.0',
217
+ ngImport: i0,
218
+ type: CdkOption,
219
+ decorators: [
220
+ {
221
+ type: Directive,
222
+ args: [
223
+ {
224
+ selector: '[cdkOption]',
225
+ exportAs: 'cdkOption',
226
+ host: {
227
+ role: 'option',
228
+ class: 'cdk-option',
229
+ '[id]': 'id',
230
+ '[attr.aria-selected]': 'isSelected()',
231
+ '[attr.tabindex]': '_getTabIndex()',
232
+ '[attr.aria-disabled]': 'disabled',
233
+ '[class.cdk-option-active]': 'isActive()',
234
+ '(click)': '_clicked.next($event)',
235
+ '(focus)': '_handleFocus()',
236
+ },
237
+ },
238
+ ],
239
+ },
240
+ ],
241
+ propDecorators: {
242
+ id: [
243
+ {
244
+ type: Input,
245
+ },
246
+ ],
247
+ value: [
248
+ {
249
+ type: Input,
250
+ args: ['cdkOption'],
251
+ },
252
+ ],
253
+ typeaheadLabel: [
254
+ {
255
+ type: Input,
256
+ args: ['cdkOptionTypeaheadLabel'],
257
+ },
258
+ ],
259
+ disabled: [
260
+ {
261
+ type: Input,
262
+ args: ['cdkOptionDisabled'],
263
+ },
264
+ ],
265
+ enabledTabIndex: [
266
+ {
267
+ type: Input,
268
+ args: ['tabindex'],
269
+ },
270
+ ],
271
+ },
272
+ });
273
+ class CdkListbox {
274
+ constructor() {
275
+ this._generatedId = `cdk-listbox-${nextId++}`;
276
+ this._disabled = false;
277
+ this._useActiveDescendant = false;
278
+ this._orientation = 'vertical';
279
+ this._navigationWrapDisabled = false;
280
+ this._navigateDisabledOptions = false;
281
+ /** Emits when the selected value(s) in the listbox change. */
282
+ this.valueChange = new Subject();
283
+ /** The selection model used by the listbox. */
284
+ this.selectionModel = new ListboxSelectionModel();
285
+ /** Emits when the listbox is destroyed. */
286
+ this.destroyed = new Subject();
287
+ /** The host element of the listbox. */
288
+ this.element = inject(ElementRef).nativeElement;
289
+ /** The change detector for this listbox. */
290
+ this.changeDetectorRef = inject(ChangeDetectorRef);
291
+ /** Whether the currently selected value in the selection model is invalid. */
292
+ this._invalid = false;
293
+ /** The last user-triggered option. */
294
+ this._lastTriggered = null;
295
+ /** Callback called when the listbox has been touched */
296
+ this._onTouched = () => {};
297
+ /** Callback called when the listbox value changes */
298
+ this._onChange = () => {};
299
+ /** Callback called when the form validator changes. */
300
+ this._onValidatorChange = () => {};
301
+ /** Emits when an option has been clicked. */
302
+ this._optionClicked = defer(() =>
303
+ this.options.changes.pipe(
304
+ startWith(this.options),
305
+ switchMap(options =>
306
+ merge(...options.map(option => option._clicked.pipe(map(event => ({ option, event })))))
307
+ )
308
+ )
309
+ );
310
+ /** The directionality of the page. */
311
+ this._dir = inject(Directionality, InjectFlags.Optional);
312
+ /** A predicate that skips disabled options. */
313
+ this._skipDisabledPredicate = option => option.disabled;
314
+ /** A predicate that does not skip any options. */
315
+ this._skipNonePredicate = () => false;
316
+ /**
317
+ * Validator that produces an error if multiple values are selected in a single selection
318
+ * listbox.
319
+ * @param control The control to validate
320
+ * @return A validation error or null
321
+ */
322
+ this._validateUnexpectedMultipleValues = control => {
323
+ const controlValue = this._coerceValue(control.value);
324
+ if (!this.multiple && controlValue.length > 1) {
325
+ return { cdkListboxUnexpectedMultipleValues: true };
326
+ }
327
+ return null;
328
+ };
329
+ /**
330
+ * Validator that produces an error if any selected values are not valid options for this listbox.
331
+ * @param control The control to validate
332
+ * @return A validation error or null
333
+ */
334
+ this._validateUnexpectedOptionValues = control => {
335
+ const controlValue = this._coerceValue(control.value);
336
+ const invalidValues = this._getInvalidOptionValues(controlValue);
337
+ if (invalidValues.length) {
338
+ return { cdkListboxUnexpectedOptionValues: { values: invalidValues } };
339
+ }
340
+ return null;
341
+ };
342
+ /** The combined set of validators for this listbox. */
343
+ this._validators = Validators.compose([
344
+ this._validateUnexpectedMultipleValues,
345
+ this._validateUnexpectedOptionValues,
346
+ ]);
347
+ }
348
+ /** The id of the option's host element. */
349
+ get id() {
350
+ return this._id || this._generatedId;
351
+ }
352
+ set id(value) {
353
+ this._id = value;
354
+ }
355
+ /** The tabindex to use when the listbox is enabled. */
356
+ get enabledTabIndex() {
357
+ return this._enabledTabIndex === undefined ? 0 : this._enabledTabIndex;
358
+ }
359
+ set enabledTabIndex(value) {
360
+ this._enabledTabIndex = value;
361
+ }
362
+ /** The value selected in the listbox, represented as an array of option values. */
363
+ get value() {
364
+ return this._invalid ? [] : this.selectionModel.selected;
365
+ }
366
+ set value(value) {
367
+ this._setSelection(value);
368
+ }
369
+ /**
370
+ * Whether the listbox allows multiple options to be selected. If the value switches from `true`
371
+ * to `false`, and more than one option is selected, all options are deselected.
372
+ */
373
+ get multiple() {
374
+ return this.selectionModel.multiple;
375
+ }
376
+ set multiple(value) {
377
+ this.selectionModel.multiple = coerceBooleanProperty(value);
378
+ if (this.options) {
379
+ this._updateInternalValue();
380
+ }
381
+ }
382
+ /** Whether the listbox is disabled. */
383
+ get disabled() {
384
+ return this._disabled;
385
+ }
386
+ set disabled(value) {
387
+ this._disabled = coerceBooleanProperty(value);
388
+ }
389
+ /** Whether the listbox will use active descendant or will move focus onto the options. */
390
+ get useActiveDescendant() {
391
+ return this._useActiveDescendant;
392
+ }
393
+ set useActiveDescendant(shouldUseActiveDescendant) {
394
+ this._useActiveDescendant = coerceBooleanProperty(shouldUseActiveDescendant);
395
+ }
396
+ /** The orientation of the listbox. Only affects keyboard interaction, not visual layout. */
397
+ get orientation() {
398
+ return this._orientation;
399
+ }
400
+ set orientation(value) {
401
+ var _a, _b, _c;
402
+ this._orientation = value === 'horizontal' ? 'horizontal' : 'vertical';
403
+ if (value === 'horizontal') {
404
+ (_a = this.listKeyManager) === null || _a === void 0
405
+ ? void 0
406
+ : _a.withHorizontalOrientation(
407
+ ((_b = this._dir) === null || _b === void 0 ? void 0 : _b.value) || 'ltr'
408
+ );
409
+ } else {
410
+ (_c = this.listKeyManager) === null || _c === void 0 ? void 0 : _c.withVerticalOrientation();
411
+ }
412
+ }
413
+ /** The function used to compare option values. */
414
+ get compareWith() {
415
+ return this.selectionModel.compareWith;
416
+ }
417
+ set compareWith(fn) {
418
+ this.selectionModel.compareWith = fn;
419
+ }
420
+ /**
421
+ * Whether the keyboard navigation should wrap when the user presses arrow down on the last item
422
+ * or arrow up on the first item.
423
+ */
424
+ get navigationWrapDisabled() {
425
+ return this._navigationWrapDisabled;
426
+ }
427
+ set navigationWrapDisabled(wrap) {
428
+ var _a;
429
+ this._navigationWrapDisabled = coerceBooleanProperty(wrap);
430
+ (_a = this.listKeyManager) === null || _a === void 0
431
+ ? void 0
432
+ : _a.withWrap(!this._navigationWrapDisabled);
433
+ }
434
+ /** Whether keyboard navigation should skip over disabled items. */
435
+ get navigateDisabledOptions() {
436
+ return this._navigateDisabledOptions;
437
+ }
438
+ set navigateDisabledOptions(skip) {
439
+ var _a;
440
+ this._navigateDisabledOptions = coerceBooleanProperty(skip);
441
+ (_a = this.listKeyManager) === null || _a === void 0
442
+ ? void 0
443
+ : _a.skipPredicate(
444
+ this._navigateDisabledOptions ? this._skipNonePredicate : this._skipDisabledPredicate
445
+ );
446
+ }
447
+ ngAfterContentInit() {
448
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
449
+ this._verifyNoOptionValueCollisions();
450
+ }
451
+ this._initKeyManager();
452
+ // Update the internal value whenever the options or the model value changes.
453
+ merge(this.selectionModel.changed, this.options.changes)
454
+ .pipe(startWith(null), takeUntil(this.destroyed))
455
+ .subscribe(() => this._updateInternalValue());
456
+ this._optionClicked
457
+ .pipe(
458
+ filter(({ option }) => !option.disabled),
459
+ takeUntil(this.destroyed)
460
+ )
461
+ .subscribe(({ option, event }) => this._handleOptionClicked(option, event));
462
+ }
463
+ ngOnDestroy() {
464
+ this.listKeyManager.change.complete();
465
+ this.destroyed.next();
466
+ this.destroyed.complete();
467
+ }
468
+ /**
469
+ * Toggle the selected state of the given option.
470
+ * @param option The option to toggle
471
+ */
472
+ toggle(option) {
473
+ this.toggleValue(option.value);
474
+ }
475
+ /**
476
+ * Toggle the selected state of the given value.
477
+ * @param value The value to toggle
478
+ */
479
+ toggleValue(value) {
480
+ if (this._invalid) {
481
+ this.selectionModel.clear(false);
482
+ }
483
+ this.selectionModel.toggle(value);
484
+ }
485
+ /**
486
+ * Select the given option.
487
+ * @param option The option to select
488
+ */
489
+ select(option) {
490
+ this.selectValue(option.value);
491
+ }
492
+ /**
493
+ * Select the given value.
494
+ * @param value The value to select
495
+ */
496
+ selectValue(value) {
497
+ if (this._invalid) {
498
+ this.selectionModel.clear(false);
499
+ }
500
+ this.selectionModel.select(value);
501
+ }
502
+ /**
503
+ * Deselect the given option.
504
+ * @param option The option to deselect
505
+ */
506
+ deselect(option) {
507
+ this.deselectValue(option.value);
508
+ }
509
+ /**
510
+ * Deselect the given value.
511
+ * @param value The value to deselect
512
+ */
513
+ deselectValue(value) {
514
+ if (this._invalid) {
515
+ this.selectionModel.clear(false);
516
+ }
517
+ this.selectionModel.deselect(value);
518
+ }
519
+ /**
520
+ * Set the selected state of all options.
521
+ * @param isSelected The new selected state to set
522
+ */
523
+ setAllSelected(isSelected) {
524
+ if (!isSelected) {
525
+ this.selectionModel.clear();
526
+ } else {
527
+ if (this._invalid) {
528
+ this.selectionModel.clear(false);
529
+ }
530
+ this.selectionModel.select(...this.options.map(option => option.value));
531
+ }
532
+ }
533
+ /**
534
+ * Get whether the given option is selected.
535
+ * @param option The option to get the selected state of
536
+ */
537
+ isSelected(option) {
538
+ return this.isValueSelected(option.value);
539
+ }
540
+ /**
541
+ * Get whether the given value is selected.
542
+ * @param value The value to get the selected state of
543
+ */
544
+ isValueSelected(value) {
545
+ if (this._invalid) {
546
+ return false;
547
+ }
548
+ return this.selectionModel.isSelected(value);
549
+ }
550
+ /**
551
+ * Registers a callback to be invoked when the listbox's value changes from user input.
552
+ * @param fn The callback to register
553
+ * @docs-private
554
+ */
555
+ registerOnChange(fn) {
556
+ this._onChange = fn;
557
+ }
558
+ /**
559
+ * Registers a callback to be invoked when the listbox is blurred by the user.
560
+ * @param fn The callback to register
561
+ * @docs-private
562
+ */
563
+ registerOnTouched(fn) {
564
+ this._onTouched = fn;
565
+ }
566
+ /**
567
+ * Sets the listbox's value.
568
+ * @param value The new value of the listbox
569
+ * @docs-private
570
+ */
571
+ writeValue(value) {
572
+ this._setSelection(value);
573
+ }
574
+ /**
575
+ * Sets the disabled state of the listbox.
576
+ * @param isDisabled The new disabled state
577
+ * @docs-private
578
+ */
579
+ setDisabledState(isDisabled) {
580
+ this.disabled = isDisabled;
581
+ }
582
+ /**
583
+ * Validate the given control
584
+ * @docs-private
585
+ */
586
+ validate(control) {
587
+ return this._validators(control);
588
+ }
589
+ /**
590
+ * Registers a callback to be called when the form validator changes.
591
+ * @param fn The callback to call
592
+ * @docs-private
593
+ */
594
+ registerOnValidatorChange(fn) {
595
+ this._onValidatorChange = fn;
596
+ }
597
+ /** Focus the listbox's host element. */
598
+ focus() {
599
+ this.element.focus();
600
+ }
601
+ /**
602
+ * Triggers the given option in response to user interaction.
603
+ * - In single selection mode: selects the option and deselects any other selected option.
604
+ * - In multi selection mode: toggles the selected state of the option.
605
+ * @param option The option to trigger
606
+ */
607
+ triggerOption(option) {
608
+ if (option && !option.disabled) {
609
+ this._lastTriggered = option;
610
+ const changed = this.multiple
611
+ ? this.selectionModel.toggle(option.value)
612
+ : this.selectionModel.select(option.value);
613
+ if (changed) {
614
+ this._onChange(this.value);
615
+ this.valueChange.next({
616
+ value: this.value,
617
+ listbox: this,
618
+ option: option,
619
+ });
620
+ }
621
+ }
622
+ }
623
+ /**
624
+ * Trigger the given range of options in response to user interaction.
625
+ * Should only be called in multi-selection mode.
626
+ * @param trigger The option that was triggered
627
+ * @param from The start index of the options to toggle
628
+ * @param to The end index of the options to toggle
629
+ * @param on Whether to toggle the option range on
630
+ */
631
+ triggerRange(trigger, from, to, on) {
632
+ var _a;
633
+ if (this.disabled || (trigger && trigger.disabled)) {
634
+ return;
635
+ }
636
+ this._lastTriggered = trigger;
637
+ const isEqual = (_a = this.compareWith) !== null && _a !== void 0 ? _a : Object.is;
638
+ const updateValues = [...this.options]
639
+ .slice(Math.max(0, Math.min(from, to)), Math.min(this.options.length, Math.max(from, to) + 1))
640
+ .filter(option => !option.disabled)
641
+ .map(option => option.value);
642
+ const selected = [...this.value];
643
+ for (const updateValue of updateValues) {
644
+ const selectedIndex = selected.findIndex(selectedValue =>
645
+ isEqual(selectedValue, updateValue)
646
+ );
647
+ if (on && selectedIndex === -1) {
648
+ selected.push(updateValue);
649
+ } else if (!on && selectedIndex !== -1) {
650
+ selected.splice(selectedIndex, 1);
651
+ }
652
+ }
653
+ let changed = this.selectionModel.setSelection(...selected);
654
+ if (changed) {
655
+ this._onChange(this.value);
656
+ this.valueChange.next({
657
+ value: this.value,
658
+ listbox: this,
659
+ option: trigger,
660
+ });
661
+ }
662
+ }
663
+ /**
664
+ * Sets the given option as active.
665
+ * @param option The option to make active
666
+ */
667
+ _setActiveOption(option) {
668
+ this.listKeyManager.setActiveItem(option);
669
+ }
670
+ /** Called when the listbox receives focus. */
671
+ _handleFocus() {
672
+ if (!this.useActiveDescendant) {
673
+ this.listKeyManager.setNextItemActive();
674
+ this._focusActiveOption();
675
+ }
676
+ }
677
+ /** Called when the user presses keydown on the listbox. */
678
+ _handleKeydown(event) {
679
+ var _a;
680
+ if (this._disabled) {
681
+ return;
682
+ }
683
+ const { keyCode } = event;
684
+ const previousActiveIndex = this.listKeyManager.activeItemIndex;
685
+ const ctrlKeys = ['ctrlKey', 'metaKey'];
686
+ if (this.multiple && keyCode === A && hasModifierKey(event, ...ctrlKeys)) {
687
+ // Toggle all options off if they're all selected, otherwise toggle them all on.
688
+ this.triggerRange(
689
+ null,
690
+ 0,
691
+ this.options.length - 1,
692
+ this.options.length !== this.value.length
693
+ );
694
+ event.preventDefault();
695
+ return;
696
+ }
697
+ if (
698
+ this.multiple &&
699
+ (keyCode === SPACE || keyCode === ENTER) &&
700
+ hasModifierKey(event, 'shiftKey')
701
+ ) {
702
+ if (this.listKeyManager.activeItem && this.listKeyManager.activeItemIndex != null) {
703
+ this.triggerRange(
704
+ this.listKeyManager.activeItem,
705
+ (_a = this._getLastTriggeredIndex()) !== null && _a !== void 0
706
+ ? _a
707
+ : this.listKeyManager.activeItemIndex,
708
+ this.listKeyManager.activeItemIndex,
709
+ !this.listKeyManager.activeItem.isSelected()
710
+ );
711
+ }
712
+ event.preventDefault();
713
+ return;
714
+ }
715
+ if (
716
+ this.multiple &&
717
+ keyCode === HOME &&
718
+ hasModifierKey(event, ...ctrlKeys) &&
719
+ hasModifierKey(event, 'shiftKey')
720
+ ) {
721
+ const trigger = this.listKeyManager.activeItem;
722
+ if (trigger) {
723
+ const from = this.listKeyManager.activeItemIndex;
724
+ this.listKeyManager.setFirstItemActive();
725
+ this.triggerRange(
726
+ trigger,
727
+ from,
728
+ this.listKeyManager.activeItemIndex,
729
+ !trigger.isSelected()
730
+ );
731
+ }
732
+ event.preventDefault();
733
+ return;
734
+ }
735
+ if (
736
+ this.multiple &&
737
+ keyCode === END &&
738
+ hasModifierKey(event, ...ctrlKeys) &&
739
+ hasModifierKey(event, 'shiftKey')
740
+ ) {
741
+ const trigger = this.listKeyManager.activeItem;
742
+ if (trigger) {
743
+ const from = this.listKeyManager.activeItemIndex;
744
+ this.listKeyManager.setLastItemActive();
745
+ this.triggerRange(
746
+ trigger,
747
+ from,
748
+ this.listKeyManager.activeItemIndex,
749
+ !trigger.isSelected()
750
+ );
751
+ }
752
+ event.preventDefault();
753
+ return;
754
+ }
755
+ if (keyCode === SPACE || keyCode === ENTER) {
756
+ this.triggerOption(this.listKeyManager.activeItem);
757
+ event.preventDefault();
758
+ return;
759
+ }
760
+ const isNavKey =
761
+ keyCode === UP_ARROW ||
762
+ keyCode === DOWN_ARROW ||
763
+ keyCode === LEFT_ARROW ||
764
+ keyCode === RIGHT_ARROW ||
765
+ keyCode === HOME ||
766
+ keyCode === END;
767
+ this.listKeyManager.onKeydown(event);
768
+ // Will select an option if shift was pressed while navigating to the option
769
+ if (isNavKey && event.shiftKey && previousActiveIndex !== this.listKeyManager.activeItemIndex) {
770
+ this.triggerOption(this.listKeyManager.activeItem);
771
+ }
772
+ }
773
+ /**
774
+ * Called when the focus leaves an element in the listbox.
775
+ * @param event The focusout event
776
+ */
777
+ _handleFocusOut(event) {
778
+ const otherElement = event.relatedTarget;
779
+ if (this.element !== otherElement && !this.element.contains(otherElement)) {
780
+ this._onTouched();
781
+ }
782
+ }
783
+ /** Get the id of the active option if active descendant is being used. */
784
+ _getAriaActiveDescendant() {
785
+ var _a, _b;
786
+ return this._useActiveDescendant
787
+ ? (_b = (_a = this.listKeyManager) === null || _a === void 0 ? void 0 : _a.activeItem) ===
788
+ null || _b === void 0
789
+ ? void 0
790
+ : _b.id
791
+ : null;
792
+ }
793
+ /** Get the tabindex for the listbox. */
794
+ _getTabIndex() {
795
+ if (this.disabled) {
796
+ return -1;
797
+ }
798
+ return this.useActiveDescendant || !this.listKeyManager.activeItem ? this.enabledTabIndex : -1;
799
+ }
800
+ /** Initialize the key manager. */
801
+ _initKeyManager() {
802
+ var _a;
803
+ this.listKeyManager = new ActiveDescendantKeyManager(this.options)
804
+ .withWrap(!this._navigationWrapDisabled)
805
+ .withTypeAhead()
806
+ .withHomeAndEnd()
807
+ .withAllowedModifierKeys(['shiftKey'])
808
+ .skipPredicate(
809
+ this._navigateDisabledOptions ? this._skipNonePredicate : this._skipDisabledPredicate
810
+ );
811
+ if (this.orientation === 'vertical') {
812
+ this.listKeyManager.withVerticalOrientation();
813
+ } else {
814
+ this.listKeyManager.withHorizontalOrientation(
815
+ ((_a = this._dir) === null || _a === void 0 ? void 0 : _a.value) || 'ltr'
816
+ );
817
+ }
818
+ this.listKeyManager.change
819
+ .pipe(takeUntil(this.destroyed))
820
+ .subscribe(() => this._focusActiveOption());
821
+ }
822
+ /** Focus the active option. */
823
+ _focusActiveOption() {
824
+ var _a;
825
+ if (!this.useActiveDescendant) {
826
+ (_a = this.listKeyManager.activeItem) === null || _a === void 0 ? void 0 : _a.focus();
827
+ }
828
+ this.changeDetectorRef.markForCheck();
829
+ }
830
+ /**
831
+ * Set the selected values.
832
+ * @param value The list of new selected values.
833
+ */
834
+ _setSelection(value) {
835
+ if (this._invalid) {
836
+ this.selectionModel.clear(false);
837
+ }
838
+ this.selectionModel.setSelection(...this._coerceValue(value));
839
+ }
840
+ /** Update the internal value of the listbox based on the selection model. */
841
+ _updateInternalValue() {
842
+ const indexCache = new Map();
843
+ this.selectionModel.sort((a, b) => {
844
+ const aIndex = this._getIndexForValue(indexCache, a);
845
+ const bIndex = this._getIndexForValue(indexCache, b);
846
+ return aIndex - bIndex;
847
+ });
848
+ const selected = this.selectionModel.selected;
849
+ this._invalid =
850
+ (!this.multiple && selected.length > 1) || !!this._getInvalidOptionValues(selected).length;
851
+ this._onValidatorChange();
852
+ this.changeDetectorRef.markForCheck();
853
+ }
854
+ /**
855
+ * Gets the index of the given value in the given list of options.
856
+ * @param cache The cache of indices found so far
857
+ * @param value The value to find
858
+ * @return The index of the value in the options list
859
+ */
860
+ _getIndexForValue(cache, value) {
861
+ const isEqual = this.compareWith || Object.is;
862
+ if (!cache.has(value)) {
863
+ let index = -1;
864
+ for (let i = 0; i < this.options.length; i++) {
865
+ if (isEqual(value, this.options.get(i).value)) {
866
+ index = i;
867
+ break;
868
+ }
869
+ }
870
+ cache.set(value, index);
871
+ }
872
+ return cache.get(value);
873
+ }
874
+ /**
875
+ * Handle the user clicking an option.
876
+ * @param option The option that was clicked.
877
+ */
878
+ _handleOptionClicked(option, event) {
879
+ var _a;
880
+ this.listKeyManager.setActiveItem(option);
881
+ if (event.shiftKey && this.multiple) {
882
+ this.triggerRange(
883
+ option,
884
+ (_a = this._getLastTriggeredIndex()) !== null && _a !== void 0
885
+ ? _a
886
+ : this.listKeyManager.activeItemIndex,
887
+ this.listKeyManager.activeItemIndex,
888
+ !option.isSelected()
889
+ );
890
+ } else {
891
+ this.triggerOption(option);
892
+ }
893
+ }
894
+ /** Verifies that no two options represent the same value under the compareWith function. */
895
+ _verifyNoOptionValueCollisions() {
896
+ this.options.changes.pipe(startWith(this.options), takeUntil(this.destroyed)).subscribe(() => {
897
+ var _a;
898
+ const isEqual = (_a = this.compareWith) !== null && _a !== void 0 ? _a : Object.is;
899
+ for (let i = 0; i < this.options.length; i++) {
900
+ const option = this.options.get(i);
901
+ let duplicate = null;
902
+ for (let j = i + 1; j < this.options.length; j++) {
903
+ const other = this.options.get(j);
904
+ if (isEqual(option.value, other.value)) {
905
+ duplicate = other;
906
+ break;
907
+ }
908
+ }
909
+ if (duplicate) {
910
+ // TODO(mmalerba): Link to docs about this.
911
+ if (this.compareWith) {
912
+ console.warn(
913
+ `Found multiple CdkOption representing the same value under the given compareWith function`,
914
+ {
915
+ option1: option.element,
916
+ option2: duplicate.element,
917
+ compareWith: this.compareWith,
918
+ }
919
+ );
920
+ } else {
921
+ console.warn(`Found multiple CdkOption with the same value`, {
922
+ option1: option.element,
923
+ option2: duplicate.element,
924
+ });
925
+ }
926
+ return;
927
+ }
928
+ }
929
+ });
930
+ }
931
+ /**
932
+ * Coerces a value into an array representing a listbox selection.
933
+ * @param value The value to coerce
934
+ * @return An array
935
+ */
936
+ _coerceValue(value) {
937
+ return value == null ? [] : coerceArray(value);
938
+ }
939
+ /**
940
+ * Get the sublist of values that do not represent valid option values in this listbox.
941
+ * @param values The list of values
942
+ * @return The sublist of values that are not valid option values
943
+ */
944
+ _getInvalidOptionValues(values) {
945
+ const isEqual = this.compareWith || Object.is;
946
+ const validValues = (this.options || []).map(option => option.value);
947
+ return values.filter(value => !validValues.some(validValue => isEqual(value, validValue)));
948
+ }
949
+ /** Get the index of the last triggered option. */
950
+ _getLastTriggeredIndex() {
951
+ const index = this.options.toArray().indexOf(this._lastTriggered);
952
+ return index === -1 ? null : index;
953
+ }
954
+ }
955
+ CdkListbox.ɵfac = i0.ɵɵngDeclareFactory({
956
+ minVersion: '12.0.0',
957
+ version: '14.2.0',
958
+ ngImport: i0,
959
+ type: CdkListbox,
960
+ deps: [],
961
+ target: i0.ɵɵFactoryTarget.Directive,
962
+ });
963
+ CdkListbox.ɵdir = i0.ɵɵngDeclareDirective({
964
+ minVersion: '14.0.0',
965
+ version: '14.2.0',
966
+ type: CdkListbox,
967
+ selector: '[cdkListbox]',
968
+ inputs: {
969
+ id: 'id',
970
+ enabledTabIndex: ['tabindex', 'enabledTabIndex'],
971
+ value: ['cdkListboxValue', 'value'],
972
+ multiple: ['cdkListboxMultiple', 'multiple'],
973
+ disabled: ['cdkListboxDisabled', 'disabled'],
974
+ useActiveDescendant: ['cdkListboxUseActiveDescendant', 'useActiveDescendant'],
975
+ orientation: ['cdkListboxOrientation', 'orientation'],
976
+ compareWith: ['cdkListboxCompareWith', 'compareWith'],
977
+ navigationWrapDisabled: ['cdkListboxNavigationWrapDisabled', 'navigationWrapDisabled'],
978
+ navigateDisabledOptions: ['cdkListboxNavigatesDisabledOptions', 'navigateDisabledOptions'],
979
+ },
980
+ outputs: { valueChange: 'cdkListboxValueChange' },
981
+ host: {
982
+ attributes: { role: 'listbox' },
983
+ listeners: {
984
+ focus: '_handleFocus()',
985
+ keydown: '_handleKeydown($event)',
986
+ focusout: '_handleFocusOut($event)',
987
+ },
988
+ properties: {
989
+ id: 'id',
990
+ 'attr.tabindex': '_getTabIndex()',
991
+ 'attr.aria-disabled': 'disabled',
992
+ 'attr.aria-multiselectable': 'multiple',
993
+ 'attr.aria-activedescendant': '_getAriaActiveDescendant()',
994
+ 'attr.aria-orientation': 'orientation',
995
+ },
996
+ classAttribute: 'cdk-listbox',
997
+ },
998
+ providers: [
999
+ {
1000
+ provide: NG_VALUE_ACCESSOR,
1001
+ useExisting: forwardRef(() => CdkListbox),
1002
+ multi: true,
1003
+ },
1004
+ {
1005
+ provide: NG_VALIDATORS,
1006
+ useExisting: forwardRef(() => CdkListbox),
1007
+ multi: true,
1008
+ },
1009
+ ],
1010
+ queries: [{ propertyName: 'options', predicate: CdkOption, descendants: true }],
1011
+ exportAs: ['cdkListbox'],
1012
+ ngImport: i0,
1013
+ });
1014
+ i0.ɵɵngDeclareClassMetadata({
1015
+ minVersion: '12.0.0',
1016
+ version: '14.2.0',
1017
+ ngImport: i0,
1018
+ type: CdkListbox,
1019
+ decorators: [
1020
+ {
1021
+ type: Directive,
1022
+ args: [
1023
+ {
1024
+ selector: '[cdkListbox]',
1025
+ exportAs: 'cdkListbox',
1026
+ host: {
1027
+ role: 'listbox',
1028
+ class: 'cdk-listbox',
1029
+ '[id]': 'id',
1030
+ '[attr.tabindex]': '_getTabIndex()',
1031
+ '[attr.aria-disabled]': 'disabled',
1032
+ '[attr.aria-multiselectable]': 'multiple',
1033
+ '[attr.aria-activedescendant]': '_getAriaActiveDescendant()',
1034
+ '[attr.aria-orientation]': 'orientation',
1035
+ '(focus)': '_handleFocus()',
1036
+ '(keydown)': '_handleKeydown($event)',
1037
+ '(focusout)': '_handleFocusOut($event)',
1038
+ },
1039
+ providers: [
1040
+ {
1041
+ provide: NG_VALUE_ACCESSOR,
1042
+ useExisting: forwardRef(() => CdkListbox),
1043
+ multi: true,
1044
+ },
1045
+ {
1046
+ provide: NG_VALIDATORS,
1047
+ useExisting: forwardRef(() => CdkListbox),
1048
+ multi: true,
1049
+ },
1050
+ ],
1051
+ },
1052
+ ],
1053
+ },
1054
+ ],
1055
+ propDecorators: {
1056
+ id: [
1057
+ {
1058
+ type: Input,
1059
+ },
1060
+ ],
1061
+ enabledTabIndex: [
1062
+ {
1063
+ type: Input,
1064
+ args: ['tabindex'],
1065
+ },
1066
+ ],
1067
+ value: [
1068
+ {
1069
+ type: Input,
1070
+ args: ['cdkListboxValue'],
1071
+ },
1072
+ ],
1073
+ multiple: [
1074
+ {
1075
+ type: Input,
1076
+ args: ['cdkListboxMultiple'],
1077
+ },
1078
+ ],
1079
+ disabled: [
1080
+ {
1081
+ type: Input,
1082
+ args: ['cdkListboxDisabled'],
1083
+ },
1084
+ ],
1085
+ useActiveDescendant: [
1086
+ {
1087
+ type: Input,
1088
+ args: ['cdkListboxUseActiveDescendant'],
1089
+ },
1090
+ ],
1091
+ orientation: [
1092
+ {
1093
+ type: Input,
1094
+ args: ['cdkListboxOrientation'],
1095
+ },
1096
+ ],
1097
+ compareWith: [
1098
+ {
1099
+ type: Input,
1100
+ args: ['cdkListboxCompareWith'],
1101
+ },
1102
+ ],
1103
+ navigationWrapDisabled: [
1104
+ {
1105
+ type: Input,
1106
+ args: ['cdkListboxNavigationWrapDisabled'],
1107
+ },
1108
+ ],
1109
+ navigateDisabledOptions: [
1110
+ {
1111
+ type: Input,
1112
+ args: ['cdkListboxNavigatesDisabledOptions'],
1113
+ },
1114
+ ],
1115
+ valueChange: [
1116
+ {
1117
+ type: Output,
1118
+ args: ['cdkListboxValueChange'],
1119
+ },
1120
+ ],
1121
+ options: [
1122
+ {
1123
+ type: ContentChildren,
1124
+ args: [CdkOption, { descendants: true }],
1125
+ },
1126
+ ],
1127
+ },
1128
+ });
1129
+
1130
+ /**
1131
+ * @license
1132
+ * Copyright Google LLC All Rights Reserved.
1133
+ *
1134
+ * Use of this source code is governed by an MIT-style license that can be
1135
+ * found in the LICENSE file at https://angular.io/license
1136
+ */
1137
+ const EXPORTED_DECLARATIONS = [CdkListbox, CdkOption];
1138
+ class CdkListboxModule {}
1139
+ CdkListboxModule.ɵfac = i0.ɵɵngDeclareFactory({
1140
+ minVersion: '12.0.0',
1141
+ version: '14.2.0',
1142
+ ngImport: i0,
1143
+ type: CdkListboxModule,
1144
+ deps: [],
1145
+ target: i0.ɵɵFactoryTarget.NgModule,
1146
+ });
1147
+ CdkListboxModule.ɵmod = i0.ɵɵngDeclareNgModule({
1148
+ minVersion: '14.0.0',
1149
+ version: '14.2.0',
1150
+ ngImport: i0,
1151
+ type: CdkListboxModule,
1152
+ declarations: [CdkListbox, CdkOption],
1153
+ exports: [CdkListbox, CdkOption],
1154
+ });
1155
+ CdkListboxModule.ɵinj = i0.ɵɵngDeclareInjector({
1156
+ minVersion: '12.0.0',
1157
+ version: '14.2.0',
1158
+ ngImport: i0,
1159
+ type: CdkListboxModule,
1160
+ });
1161
+ i0.ɵɵngDeclareClassMetadata({
1162
+ minVersion: '12.0.0',
1163
+ version: '14.2.0',
1164
+ ngImport: i0,
1165
+ type: CdkListboxModule,
1166
+ decorators: [
1167
+ {
1168
+ type: NgModule,
1169
+ args: [
1170
+ {
1171
+ exports: EXPORTED_DECLARATIONS,
1172
+ declarations: EXPORTED_DECLARATIONS,
1173
+ },
1174
+ ],
1175
+ },
1176
+ ],
1177
+ });
1178
+
1179
+ /**
1180
+ * @license
1181
+ * Copyright Google LLC All Rights Reserved.
1182
+ *
1183
+ * Use of this source code is governed by an MIT-style license that can be
1184
+ * found in the LICENSE file at https://angular.io/license
1185
+ */
1186
+
1187
+ /**
1188
+ * @license
1189
+ * Copyright Google LLC All Rights Reserved.
1190
+ *
1191
+ * Use of this source code is governed by an MIT-style license that can be
1192
+ * found in the LICENSE file at https://angular.io/license
1193
+ */
1194
+
1195
+ /**
1196
+ * Generated bundle index. Do not edit.
1197
+ */
1198
+
1199
+ export { CdkListbox, CdkListboxModule, CdkOption };
1200
+ //# sourceMappingURL=listbox.mjs.map