@carbon/web-components 1.26.0-rc.2 → 1.26.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 (623) hide show
  1. package/dist/accordion.min.js +2 -2
  2. package/dist/accordion.rtl.min.js +2 -2
  3. package/dist/breadcrumb.min.js +1 -1
  4. package/dist/breadcrumb.rtl.min.js +1 -1
  5. package/dist/{button-0eeac278.js → button-c71594fa.js} +2 -2
  6. package/dist/{button-4b4837f0.js → button-e31ba29e.js} +2 -2
  7. package/dist/button.min.js +1 -1
  8. package/dist/button.rtl.min.js +1 -1
  9. package/dist/{decorators-0a905d41.js → carbon-element-18175602.js} +9 -1
  10. package/dist/checkbox-3fc0ced9.js +65 -0
  11. package/dist/checkbox-a740039c.js +65 -0
  12. package/dist/checkbox.min.js +1 -1
  13. package/dist/checkbox.rtl.min.js +1 -1
  14. package/dist/code-snippet.min.js +2 -2
  15. package/dist/code-snippet.rtl.min.js +2 -2
  16. package/dist/combo-box.min.js +1 -1
  17. package/dist/combo-box.rtl.min.js +1 -1
  18. package/dist/{content-switcher-item-d37071b9.js → content-switcher-item-77b690a9.js} +2 -2
  19. package/dist/{content-switcher-item-db96b7e3.js → content-switcher-item-96395561.js} +2 -2
  20. package/dist/content-switcher.min.js +1 -1
  21. package/dist/content-switcher.rtl.min.js +1 -1
  22. package/dist/copy-button-50221d0f.js +65 -0
  23. package/dist/copy-button-9cb9a0c6.js +65 -0
  24. package/dist/copy-button.min.js +1 -1
  25. package/dist/copy-button.rtl.min.js +1 -1
  26. package/dist/data-table.min.js +2 -2
  27. package/dist/data-table.rtl.min.js +2 -2
  28. package/dist/date-picker.min.js +3 -3
  29. package/dist/date-picker.rtl.min.js +3 -3
  30. package/dist/decorators-56213c84.js +78 -0
  31. package/dist/{dropdown-item-1630cdb0.js → dropdown-item-62abeaa7.js} +2 -2
  32. package/dist/{dropdown-item-8c9136d9.js → dropdown-item-97eb5366.js} +2 -2
  33. package/dist/dropdown.min.js +1 -1
  34. package/dist/dropdown.rtl.min.js +1 -1
  35. package/dist/file-uploader.min.js +2 -2
  36. package/dist/file-uploader.rtl.min.js +2 -2
  37. package/dist/form.min.js +1 -1
  38. package/dist/form.rtl.min.js +1 -1
  39. package/dist/inline-loading.min.js +2 -2
  40. package/dist/inline-loading.rtl.min.js +2 -2
  41. package/dist/{input-1583283e.js → input-254c34ac.js} +2 -2
  42. package/dist/{input-b817aa3d.js → input-bb75e577.js} +2 -2
  43. package/dist/input.min.js +1 -1
  44. package/dist/input.rtl.min.js +1 -1
  45. package/dist/link-3c734b06.js +65 -0
  46. package/dist/link-aecb4d2a.js +65 -0
  47. package/dist/link.min.js +1 -1
  48. package/dist/link.rtl.min.js +1 -1
  49. package/dist/list.min.js +1 -1
  50. package/dist/list.rtl.min.js +1 -1
  51. package/dist/loading-9ce928f0.js +65 -0
  52. package/dist/loading-c77e0b8d.js +65 -0
  53. package/dist/loading.min.js +1 -1
  54. package/dist/loading.rtl.min.js +1 -1
  55. package/dist/modal.min.js +2 -2
  56. package/dist/modal.rtl.min.js +2 -2
  57. package/dist/multi-select.min.js +1 -1
  58. package/dist/multi-select.rtl.min.js +1 -1
  59. package/dist/notification.min.js +2 -2
  60. package/dist/notification.rtl.min.js +2 -2
  61. package/dist/number-input.min.js +2 -2
  62. package/dist/number-input.rtl.min.js +2 -2
  63. package/dist/overflow-menu.min.js +2 -2
  64. package/dist/overflow-menu.rtl.min.js +2 -2
  65. package/dist/pagination.min.js +1 -1
  66. package/dist/pagination.rtl.min.js +1 -1
  67. package/dist/progress-indicator.min.js +2 -2
  68. package/dist/progress-indicator.rtl.min.js +2 -2
  69. package/dist/radio-button.min.js +2 -2
  70. package/dist/radio-button.rtl.min.js +2 -2
  71. package/dist/search-99e65bb6.js +65 -0
  72. package/dist/search-dfddc65c.js +65 -0
  73. package/dist/search.min.js +1 -1
  74. package/dist/search.rtl.min.js +1 -1
  75. package/dist/select.min.js +1 -1
  76. package/dist/select.rtl.min.js +1 -1
  77. package/dist/skeleton-placeholder.min.js +1 -1
  78. package/dist/skeleton-placeholder.rtl.min.js +1 -1
  79. package/dist/skeleton-text.min.js +2 -2
  80. package/dist/skeleton-text.rtl.min.js +2 -2
  81. package/dist/skip-to-content.min.js +1 -1
  82. package/dist/skip-to-content.rtl.min.js +1 -1
  83. package/dist/slider.min.js +1 -1
  84. package/dist/slider.rtl.min.js +1 -1
  85. package/dist/structured-list.min.js +1 -1
  86. package/dist/structured-list.rtl.min.js +1 -1
  87. package/dist/tabs.min.js +2 -2
  88. package/dist/tabs.rtl.min.js +2 -2
  89. package/dist/tag.min.js +2 -2
  90. package/dist/tag.rtl.min.js +2 -2
  91. package/dist/textarea.min.js +1 -1
  92. package/dist/textarea.rtl.min.js +1 -1
  93. package/dist/tile.min.js +1 -1
  94. package/dist/tile.rtl.min.js +1 -1
  95. package/dist/toggle.min.js +2 -2
  96. package/dist/toggle.rtl.min.js +2 -2
  97. package/dist/tooltip.min.js +2 -2
  98. package/dist/tooltip.rtl.min.js +2 -2
  99. package/dist/ui-shell.min.js +2 -2
  100. package/dist/ui-shell.rtl.min.js +2 -2
  101. package/es/components/accordion/accordion-item.d.ts +1 -1
  102. package/es/components/accordion/accordion-item.d.ts.map +1 -1
  103. package/es/components/accordion/accordion-item.js +4 -3
  104. package/es/components/accordion/accordion-item.js.map +1 -1
  105. package/es/components/accordion/accordion.d.ts +1 -1
  106. package/es/components/accordion/accordion.d.ts.map +1 -1
  107. package/es/components/accordion/accordion.js +3 -2
  108. package/es/components/accordion/accordion.js.map +1 -1
  109. package/es/components/breadcrumb/breadcrumb-item.d.ts +1 -1
  110. package/es/components/breadcrumb/breadcrumb-item.d.ts.map +1 -1
  111. package/es/components/breadcrumb/breadcrumb-item.js +3 -2
  112. package/es/components/breadcrumb/breadcrumb-item.js.map +1 -1
  113. package/es/components/breadcrumb/breadcrumb-link.d.ts +1 -1
  114. package/es/components/breadcrumb/breadcrumb-link.d.ts.map +1 -1
  115. package/es/components/breadcrumb/breadcrumb-link.js +2 -2
  116. package/es/components/breadcrumb/breadcrumb-link.js.map +1 -1
  117. package/es/components/breadcrumb/breadcrumb-overflow-menu.d.ts +1 -1
  118. package/es/components/breadcrumb/breadcrumb-overflow-menu.d.ts.map +1 -1
  119. package/es/components/breadcrumb/breadcrumb-overflow-menu.js +3 -2
  120. package/es/components/breadcrumb/breadcrumb-overflow-menu.js.map +1 -1
  121. package/es/components/breadcrumb/breadcrumb.d.ts +1 -1
  122. package/es/components/breadcrumb/breadcrumb.d.ts.map +1 -1
  123. package/es/components/breadcrumb/breadcrumb.js +3 -2
  124. package/es/components/breadcrumb/breadcrumb.js.map +1 -1
  125. package/es/components/button/button-skeleton.d.ts +1 -1
  126. package/es/components/button/button-skeleton.d.ts.map +1 -1
  127. package/es/components/button/button-skeleton.js +3 -2
  128. package/es/components/button/button-skeleton.js.map +1 -1
  129. package/es/components/button/button.d.ts +1 -1
  130. package/es/components/button/button.d.ts.map +1 -1
  131. package/es/components/button/button.js +3 -2
  132. package/es/components/button/button.js.map +1 -1
  133. package/es/components/checkbox/checkbox.d.ts +1 -1
  134. package/es/components/checkbox/checkbox.d.ts.map +1 -1
  135. package/es/components/checkbox/checkbox.js +3 -2
  136. package/es/components/checkbox/checkbox.js.map +1 -1
  137. package/es/components/code-snippet/code-snippet-skeleton.d.ts +1 -1
  138. package/es/components/code-snippet/code-snippet-skeleton.d.ts.map +1 -1
  139. package/es/components/code-snippet/code-snippet-skeleton.js +3 -2
  140. package/es/components/code-snippet/code-snippet-skeleton.js.map +1 -1
  141. package/es/components/code-snippet/code-snippet.d.ts +1 -1
  142. package/es/components/code-snippet/code-snippet.d.ts.map +1 -1
  143. package/es/components/code-snippet/code-snippet.js +3 -2
  144. package/es/components/code-snippet/code-snippet.js.map +1 -1
  145. package/es/components/combo-box/combo-box-item.d.ts +1 -1
  146. package/es/components/combo-box/combo-box-item.d.ts.map +1 -1
  147. package/es/components/combo-box/combo-box-item.js +2 -2
  148. package/es/components/combo-box/combo-box-item.js.map +1 -1
  149. package/es/components/combo-box/combo-box.d.ts +1 -1
  150. package/es/components/combo-box/combo-box.d.ts.map +1 -1
  151. package/es/components/combo-box/combo-box.js +3 -2
  152. package/es/components/combo-box/combo-box.js.map +1 -1
  153. package/es/components/content-switcher/content-switcher-item.d.ts +1 -1
  154. package/es/components/content-switcher/content-switcher-item.d.ts.map +1 -1
  155. package/es/components/content-switcher/content-switcher-item.js +3 -2
  156. package/es/components/content-switcher/content-switcher-item.js.map +1 -1
  157. package/es/components/content-switcher/content-switcher.d.ts +1 -1
  158. package/es/components/content-switcher/content-switcher.d.ts.map +1 -1
  159. package/es/components/content-switcher/content-switcher.js +3 -2
  160. package/es/components/content-switcher/content-switcher.js.map +1 -1
  161. package/es/components/copy-button/copy-button.d.ts +1 -1
  162. package/es/components/copy-button/copy-button.d.ts.map +1 -1
  163. package/es/components/copy-button/copy-button.js +3 -2
  164. package/es/components/copy-button/copy-button.js.map +1 -1
  165. package/es/components/data-table/table-batch-actions.d.ts +1 -1
  166. package/es/components/data-table/table-batch-actions.d.ts.map +1 -1
  167. package/es/components/data-table/table-batch-actions.js +3 -2
  168. package/es/components/data-table/table-batch-actions.js.map +1 -1
  169. package/es/components/data-table/table-body.d.ts +1 -1
  170. package/es/components/data-table/table-body.d.ts.map +1 -1
  171. package/es/components/data-table/table-body.js +3 -2
  172. package/es/components/data-table/table-body.js.map +1 -1
  173. package/es/components/data-table/table-cell-skeleton.d.ts +1 -1
  174. package/es/components/data-table/table-cell-skeleton.d.ts.map +1 -1
  175. package/es/components/data-table/table-cell-skeleton.js +3 -2
  176. package/es/components/data-table/table-cell-skeleton.js.map +1 -1
  177. package/es/components/data-table/table-cell.d.ts +1 -1
  178. package/es/components/data-table/table-cell.d.ts.map +1 -1
  179. package/es/components/data-table/table-cell.js +3 -2
  180. package/es/components/data-table/table-cell.js.map +1 -1
  181. package/es/components/data-table/table-expand-row.d.ts +1 -1
  182. package/es/components/data-table/table-expand-row.d.ts.map +1 -1
  183. package/es/components/data-table/table-expand-row.js +3 -2
  184. package/es/components/data-table/table-expand-row.js.map +1 -1
  185. package/es/components/data-table/table-expanded-row.d.ts +1 -1
  186. package/es/components/data-table/table-expanded-row.d.ts.map +1 -1
  187. package/es/components/data-table/table-expanded-row.js +3 -2
  188. package/es/components/data-table/table-expanded-row.js.map +1 -1
  189. package/es/components/data-table/table-head.d.ts +1 -1
  190. package/es/components/data-table/table-head.d.ts.map +1 -1
  191. package/es/components/data-table/table-head.js +3 -2
  192. package/es/components/data-table/table-head.js.map +1 -1
  193. package/es/components/data-table/table-header-cell-skeleton.d.ts +1 -1
  194. package/es/components/data-table/table-header-cell-skeleton.d.ts.map +1 -1
  195. package/es/components/data-table/table-header-cell-skeleton.js +2 -2
  196. package/es/components/data-table/table-header-cell-skeleton.js.map +1 -1
  197. package/es/components/data-table/table-header-cell.d.ts +1 -1
  198. package/es/components/data-table/table-header-cell.d.ts.map +1 -1
  199. package/es/components/data-table/table-header-cell.js +3 -2
  200. package/es/components/data-table/table-header-cell.js.map +1 -1
  201. package/es/components/data-table/table-header-expand-row.d.ts +1 -1
  202. package/es/components/data-table/table-header-expand-row.d.ts.map +1 -1
  203. package/es/components/data-table/table-header-expand-row.js +2 -2
  204. package/es/components/data-table/table-header-expand-row.js.map +1 -1
  205. package/es/components/data-table/table-header-row.d.ts +1 -1
  206. package/es/components/data-table/table-header-row.d.ts.map +1 -1
  207. package/es/components/data-table/table-header-row.js +2 -2
  208. package/es/components/data-table/table-header-row.js.map +1 -1
  209. package/es/components/data-table/table-row.d.ts +1 -1
  210. package/es/components/data-table/table-row.d.ts.map +1 -1
  211. package/es/components/data-table/table-row.js +3 -2
  212. package/es/components/data-table/table-row.js.map +1 -1
  213. package/es/components/data-table/table-toolbar-content.d.ts +1 -1
  214. package/es/components/data-table/table-toolbar-content.d.ts.map +1 -1
  215. package/es/components/data-table/table-toolbar-content.js +3 -2
  216. package/es/components/data-table/table-toolbar-content.js.map +1 -1
  217. package/es/components/data-table/table-toolbar-search.d.ts +1 -1
  218. package/es/components/data-table/table-toolbar-search.d.ts.map +1 -1
  219. package/es/components/data-table/table-toolbar-search.js +3 -2
  220. package/es/components/data-table/table-toolbar-search.js.map +1 -1
  221. package/es/components/data-table/table-toolbar.d.ts +1 -1
  222. package/es/components/data-table/table-toolbar.d.ts.map +1 -1
  223. package/es/components/data-table/table-toolbar.js +3 -2
  224. package/es/components/data-table/table-toolbar.js.map +1 -1
  225. package/es/components/data-table/table.d.ts +1 -1
  226. package/es/components/data-table/table.d.ts.map +1 -1
  227. package/es/components/data-table/table.js +3 -2
  228. package/es/components/data-table/table.js.map +1 -1
  229. package/es/components/date-picker/date-picker-input-skeleton.d.ts +1 -1
  230. package/es/components/date-picker/date-picker-input-skeleton.d.ts.map +1 -1
  231. package/es/components/date-picker/date-picker-input-skeleton.js +3 -2
  232. package/es/components/date-picker/date-picker-input-skeleton.js.map +1 -1
  233. package/es/components/date-picker/date-picker-input.d.ts +3 -7
  234. package/es/components/date-picker/date-picker-input.d.ts.map +1 -1
  235. package/es/components/date-picker/date-picker-input.js +3 -2
  236. package/es/components/date-picker/date-picker-input.js.map +1 -1
  237. package/es/components/date-picker/date-picker.d.ts +2 -4
  238. package/es/components/date-picker/date-picker.d.ts.map +1 -1
  239. package/es/components/date-picker/date-picker.js +3 -2
  240. package/es/components/date-picker/date-picker.js.map +1 -1
  241. package/es/components/dropdown/dropdown-item.d.ts +1 -1
  242. package/es/components/dropdown/dropdown-item.d.ts.map +1 -1
  243. package/es/components/dropdown/dropdown-item.js +3 -2
  244. package/es/components/dropdown/dropdown-item.js.map +1 -1
  245. package/es/components/dropdown/dropdown-skeleton.d.ts +1 -1
  246. package/es/components/dropdown/dropdown-skeleton.d.ts.map +1 -1
  247. package/es/components/dropdown/dropdown-skeleton.js +3 -2
  248. package/es/components/dropdown/dropdown-skeleton.js.map +1 -1
  249. package/es/components/dropdown/dropdown.d.ts.map +1 -1
  250. package/es/components/dropdown/dropdown.js +2 -1
  251. package/es/components/dropdown/dropdown.js.map +1 -1
  252. package/es/components/file-uploader/drop-container.d.ts +4 -1
  253. package/es/components/file-uploader/drop-container.d.ts.map +1 -1
  254. package/es/components/file-uploader/drop-container.js +3 -2
  255. package/es/components/file-uploader/drop-container.js.map +1 -1
  256. package/es/components/file-uploader/file-uploader-item.d.ts +1 -1
  257. package/es/components/file-uploader/file-uploader-item.d.ts.map +1 -1
  258. package/es/components/file-uploader/file-uploader-item.js +3 -2
  259. package/es/components/file-uploader/file-uploader-item.js.map +1 -1
  260. package/es/components/file-uploader/file-uploader.d.ts +1 -1
  261. package/es/components/file-uploader/file-uploader.d.ts.map +1 -1
  262. package/es/components/file-uploader/file-uploader.js +3 -2
  263. package/es/components/file-uploader/file-uploader.js.map +1 -1
  264. package/es/components/form/form-item.d.ts +1 -1
  265. package/es/components/form/form-item.d.ts.map +1 -1
  266. package/es/components/form/form-item.js +3 -2
  267. package/es/components/form/form-item.js.map +1 -1
  268. package/es/components/inline-loading/inline-loading.d.ts +1 -1
  269. package/es/components/inline-loading/inline-loading.d.ts.map +1 -1
  270. package/es/components/inline-loading/inline-loading.js +3 -2
  271. package/es/components/inline-loading/inline-loading.js.map +1 -1
  272. package/es/components/input/input.d.ts +1 -4
  273. package/es/components/input/input.d.ts.map +1 -1
  274. package/es/components/input/input.js +3 -2
  275. package/es/components/input/input.js.map +1 -1
  276. package/es/components/link/link.d.ts +1 -1
  277. package/es/components/link/link.d.ts.map +1 -1
  278. package/es/components/link/link.js +3 -2
  279. package/es/components/link/link.js.map +1 -1
  280. package/es/components/list/list-item.d.ts +1 -1
  281. package/es/components/list/list-item.d.ts.map +1 -1
  282. package/es/components/list/list-item.js +3 -2
  283. package/es/components/list/list-item.js.map +1 -1
  284. package/es/components/list/ordered-list.d.ts +1 -1
  285. package/es/components/list/ordered-list.d.ts.map +1 -1
  286. package/es/components/list/ordered-list.js +3 -2
  287. package/es/components/list/ordered-list.js.map +1 -1
  288. package/es/components/list/unordered-list.d.ts +1 -1
  289. package/es/components/list/unordered-list.d.ts.map +1 -1
  290. package/es/components/list/unordered-list.js +3 -2
  291. package/es/components/list/unordered-list.js.map +1 -1
  292. package/es/components/loading/loading.d.ts +1 -1
  293. package/es/components/loading/loading.d.ts.map +1 -1
  294. package/es/components/loading/loading.js +3 -2
  295. package/es/components/loading/loading.js.map +1 -1
  296. package/es/components/modal/modal-body.d.ts +1 -1
  297. package/es/components/modal/modal-body.d.ts.map +1 -1
  298. package/es/components/modal/modal-body.js +3 -2
  299. package/es/components/modal/modal-body.js.map +1 -1
  300. package/es/components/modal/modal-close-button.d.ts +1 -1
  301. package/es/components/modal/modal-close-button.d.ts.map +1 -1
  302. package/es/components/modal/modal-close-button.js +3 -2
  303. package/es/components/modal/modal-close-button.js.map +1 -1
  304. package/es/components/modal/modal-footer-button.d.ts +1 -1
  305. package/es/components/modal/modal-footer-button.d.ts.map +1 -1
  306. package/es/components/modal/modal-footer-button.js +2 -2
  307. package/es/components/modal/modal-footer-button.js.map +1 -1
  308. package/es/components/modal/modal-footer.d.ts +1 -1
  309. package/es/components/modal/modal-footer.d.ts.map +1 -1
  310. package/es/components/modal/modal-footer.js +3 -2
  311. package/es/components/modal/modal-footer.js.map +1 -1
  312. package/es/components/modal/modal-header.d.ts +1 -1
  313. package/es/components/modal/modal-header.d.ts.map +1 -1
  314. package/es/components/modal/modal-header.js +3 -2
  315. package/es/components/modal/modal-header.js.map +1 -1
  316. package/es/components/modal/modal-heading.d.ts +1 -1
  317. package/es/components/modal/modal-heading.d.ts.map +1 -1
  318. package/es/components/modal/modal-heading.js +3 -2
  319. package/es/components/modal/modal-heading.js.map +1 -1
  320. package/es/components/modal/modal-label.d.ts +1 -1
  321. package/es/components/modal/modal-label.d.ts.map +1 -1
  322. package/es/components/modal/modal-label.js +3 -2
  323. package/es/components/modal/modal-label.js.map +1 -1
  324. package/es/components/modal/modal.d.ts +1 -1
  325. package/es/components/modal/modal.d.ts.map +1 -1
  326. package/es/components/modal/modal.js +3 -2
  327. package/es/components/modal/modal.js.map +1 -1
  328. package/es/components/multi-select/multi-select-item.d.ts +1 -1
  329. package/es/components/multi-select/multi-select-item.d.ts.map +1 -1
  330. package/es/components/multi-select/multi-select-item.js +3 -2
  331. package/es/components/multi-select/multi-select-item.js.map +1 -1
  332. package/es/components/multi-select/multi-select.d.ts +1 -1
  333. package/es/components/multi-select/multi-select.d.ts.map +1 -1
  334. package/es/components/multi-select/multi-select.js +3 -2
  335. package/es/components/multi-select/multi-select.js.map +1 -1
  336. package/es/components/notification/inline-notification.d.ts +1 -1
  337. package/es/components/notification/inline-notification.d.ts.map +1 -1
  338. package/es/components/notification/inline-notification.js +4 -3
  339. package/es/components/notification/inline-notification.js.map +1 -1
  340. package/es/components/notification/toast-notification.d.ts +1 -1
  341. package/es/components/notification/toast-notification.d.ts.map +1 -1
  342. package/es/components/notification/toast-notification.js +3 -2
  343. package/es/components/notification/toast-notification.js.map +1 -1
  344. package/es/components/number-input/number-input-skeleton.d.ts +1 -1
  345. package/es/components/number-input/number-input-skeleton.d.ts.map +1 -1
  346. package/es/components/number-input/number-input-skeleton.js +3 -2
  347. package/es/components/number-input/number-input-skeleton.js.map +1 -1
  348. package/es/components/number-input/number-input.d.ts +1 -1
  349. package/es/components/number-input/number-input.d.ts.map +1 -1
  350. package/es/components/number-input/number-input.js +3 -2
  351. package/es/components/number-input/number-input.js.map +1 -1
  352. package/es/components/overflow-menu/overflow-menu-body.d.ts +1 -1
  353. package/es/components/overflow-menu/overflow-menu-body.d.ts.map +1 -1
  354. package/es/components/overflow-menu/overflow-menu-body.js +3 -2
  355. package/es/components/overflow-menu/overflow-menu-body.js.map +1 -1
  356. package/es/components/overflow-menu/overflow-menu-item.d.ts +1 -1
  357. package/es/components/overflow-menu/overflow-menu-item.d.ts.map +1 -1
  358. package/es/components/overflow-menu/overflow-menu-item.js +3 -2
  359. package/es/components/overflow-menu/overflow-menu-item.js.map +1 -1
  360. package/es/components/overflow-menu/overflow-menu.d.ts +4 -1
  361. package/es/components/overflow-menu/overflow-menu.d.ts.map +1 -1
  362. package/es/components/overflow-menu/overflow-menu.js +3 -2
  363. package/es/components/overflow-menu/overflow-menu.js.map +1 -1
  364. package/es/components/pagination/page-sizes-select.d.ts +1 -1
  365. package/es/components/pagination/page-sizes-select.d.ts.map +1 -1
  366. package/es/components/pagination/page-sizes-select.js +3 -2
  367. package/es/components/pagination/page-sizes-select.js.map +1 -1
  368. package/es/components/pagination/pages-select.d.ts +1 -1
  369. package/es/components/pagination/pages-select.d.ts.map +1 -1
  370. package/es/components/pagination/pages-select.js +3 -2
  371. package/es/components/pagination/pages-select.js.map +1 -1
  372. package/es/components/pagination/pagination.d.ts +1 -1
  373. package/es/components/pagination/pagination.d.ts.map +1 -1
  374. package/es/components/pagination/pagination.js +3 -2
  375. package/es/components/pagination/pagination.js.map +1 -1
  376. package/es/components/progress-indicator/progress-indicator-skeleton.d.ts +1 -1
  377. package/es/components/progress-indicator/progress-indicator-skeleton.d.ts.map +1 -1
  378. package/es/components/progress-indicator/progress-indicator-skeleton.js +3 -2
  379. package/es/components/progress-indicator/progress-indicator-skeleton.js.map +1 -1
  380. package/es/components/progress-indicator/progress-indicator.d.ts +1 -1
  381. package/es/components/progress-indicator/progress-indicator.d.ts.map +1 -1
  382. package/es/components/progress-indicator/progress-indicator.js +3 -2
  383. package/es/components/progress-indicator/progress-indicator.js.map +1 -1
  384. package/es/components/progress-indicator/progress-step-skeleton.d.ts +1 -1
  385. package/es/components/progress-indicator/progress-step-skeleton.d.ts.map +1 -1
  386. package/es/components/progress-indicator/progress-step-skeleton.js +3 -2
  387. package/es/components/progress-indicator/progress-step-skeleton.js.map +1 -1
  388. package/es/components/progress-indicator/progress-step.d.ts +1 -1
  389. package/es/components/progress-indicator/progress-step.d.ts.map +1 -1
  390. package/es/components/progress-indicator/progress-step.js +3 -2
  391. package/es/components/progress-indicator/progress-step.js.map +1 -1
  392. package/es/components/radio-button/radio-button-group.d.ts +1 -1
  393. package/es/components/radio-button/radio-button-group.d.ts.map +1 -1
  394. package/es/components/radio-button/radio-button-group.js +3 -2
  395. package/es/components/radio-button/radio-button-group.js.map +1 -1
  396. package/es/components/radio-button/radio-button-skeleton.d.ts +1 -1
  397. package/es/components/radio-button/radio-button-skeleton.d.ts.map +1 -1
  398. package/es/components/radio-button/radio-button-skeleton.js +3 -2
  399. package/es/components/radio-button/radio-button-skeleton.js.map +1 -1
  400. package/es/components/radio-button/radio-button.d.ts +1 -1
  401. package/es/components/radio-button/radio-button.d.ts.map +1 -1
  402. package/es/components/radio-button/radio-button.js +3 -2
  403. package/es/components/radio-button/radio-button.js.map +1 -1
  404. package/es/components/search/search-skeleton.d.ts +1 -1
  405. package/es/components/search/search-skeleton.d.ts.map +1 -1
  406. package/es/components/search/search-skeleton.js +3 -2
  407. package/es/components/search/search-skeleton.js.map +1 -1
  408. package/es/components/search/search.d.ts +1 -1
  409. package/es/components/search/search.d.ts.map +1 -1
  410. package/es/components/search/search.js +3 -2
  411. package/es/components/search/search.js.map +1 -1
  412. package/es/components/select/select-item-group.d.ts +1 -1
  413. package/es/components/select/select-item-group.d.ts.map +1 -1
  414. package/es/components/select/select-item-group.js +3 -2
  415. package/es/components/select/select-item-group.js.map +1 -1
  416. package/es/components/select/select-item.d.ts +1 -1
  417. package/es/components/select/select-item.d.ts.map +1 -1
  418. package/es/components/select/select-item.js +3 -2
  419. package/es/components/select/select-item.js.map +1 -1
  420. package/es/components/select/select.d.ts +6 -2
  421. package/es/components/select/select.d.ts.map +1 -1
  422. package/es/components/select/select.js +3 -2
  423. package/es/components/select/select.js.map +1 -1
  424. package/es/components/skeleton-placeholder/skeleton-placeholder.d.ts +1 -1
  425. package/es/components/skeleton-placeholder/skeleton-placeholder.d.ts.map +1 -1
  426. package/es/components/skeleton-placeholder/skeleton-placeholder.js +3 -2
  427. package/es/components/skeleton-placeholder/skeleton-placeholder.js.map +1 -1
  428. package/es/components/skeleton-text/skeleton-text.d.ts +1 -1
  429. package/es/components/skeleton-text/skeleton-text.d.ts.map +1 -1
  430. package/es/components/skeleton-text/skeleton-text.js +3 -2
  431. package/es/components/skeleton-text/skeleton-text.js.map +1 -1
  432. package/es/components/skip-to-content/skip-to-content.d.ts +1 -1
  433. package/es/components/skip-to-content/skip-to-content.d.ts.map +1 -1
  434. package/es/components/skip-to-content/skip-to-content.js +3 -2
  435. package/es/components/skip-to-content/skip-to-content.js.map +1 -1
  436. package/es/components/slider/slider-input.d.ts +1 -1
  437. package/es/components/slider/slider-input.d.ts.map +1 -1
  438. package/es/components/slider/slider-input.js +3 -2
  439. package/es/components/slider/slider-input.js.map +1 -1
  440. package/es/components/slider/slider-skeleton.d.ts +1 -1
  441. package/es/components/slider/slider-skeleton.d.ts.map +1 -1
  442. package/es/components/slider/slider-skeleton.js +3 -2
  443. package/es/components/slider/slider-skeleton.js.map +1 -1
  444. package/es/components/slider/slider.d.ts +1 -1
  445. package/es/components/slider/slider.d.ts.map +1 -1
  446. package/es/components/slider/slider.js +3 -2
  447. package/es/components/slider/slider.js.map +1 -1
  448. package/es/components/structured-list/structured-list-body.d.ts +1 -1
  449. package/es/components/structured-list/structured-list-body.d.ts.map +1 -1
  450. package/es/components/structured-list/structured-list-body.js +3 -2
  451. package/es/components/structured-list/structured-list-body.js.map +1 -1
  452. package/es/components/structured-list/structured-list-cell.d.ts +1 -1
  453. package/es/components/structured-list/structured-list-cell.d.ts.map +1 -1
  454. package/es/components/structured-list/structured-list-cell.js +3 -2
  455. package/es/components/structured-list/structured-list-cell.js.map +1 -1
  456. package/es/components/structured-list/structured-list-head.d.ts +1 -1
  457. package/es/components/structured-list/structured-list-head.d.ts.map +1 -1
  458. package/es/components/structured-list/structured-list-head.js +3 -2
  459. package/es/components/structured-list/structured-list-head.js.map +1 -1
  460. package/es/components/structured-list/structured-list-header-cell-skeleton.d.ts +1 -1
  461. package/es/components/structured-list/structured-list-header-cell-skeleton.d.ts.map +1 -1
  462. package/es/components/structured-list/structured-list-header-cell-skeleton.js +3 -2
  463. package/es/components/structured-list/structured-list-header-cell-skeleton.js.map +1 -1
  464. package/es/components/structured-list/structured-list-header-cell.d.ts +1 -1
  465. package/es/components/structured-list/structured-list-header-cell.d.ts.map +1 -1
  466. package/es/components/structured-list/structured-list-header-cell.js +3 -2
  467. package/es/components/structured-list/structured-list-header-cell.js.map +1 -1
  468. package/es/components/structured-list/structured-list-header-row.d.ts +1 -1
  469. package/es/components/structured-list/structured-list-header-row.d.ts.map +1 -1
  470. package/es/components/structured-list/structured-list-header-row.js +3 -2
  471. package/es/components/structured-list/structured-list-header-row.js.map +1 -1
  472. package/es/components/structured-list/structured-list-row.d.ts +1 -1
  473. package/es/components/structured-list/structured-list-row.d.ts.map +1 -1
  474. package/es/components/structured-list/structured-list-row.js +3 -2
  475. package/es/components/structured-list/structured-list-row.js.map +1 -1
  476. package/es/components/structured-list/structured-list.d.ts +1 -1
  477. package/es/components/structured-list/structured-list.d.ts.map +1 -1
  478. package/es/components/structured-list/structured-list.js +3 -2
  479. package/es/components/structured-list/structured-list.js.map +1 -1
  480. package/es/components/tabs/tab-skeleton.d.ts +1 -1
  481. package/es/components/tabs/tab-skeleton.d.ts.map +1 -1
  482. package/es/components/tabs/tab-skeleton.js +3 -2
  483. package/es/components/tabs/tab-skeleton.js.map +1 -1
  484. package/es/components/tabs/tab.d.ts +1 -1
  485. package/es/components/tabs/tab.d.ts.map +1 -1
  486. package/es/components/tabs/tab.js +3 -2
  487. package/es/components/tabs/tab.js.map +1 -1
  488. package/es/components/tabs/tabs-skeleton.d.ts +1 -1
  489. package/es/components/tabs/tabs-skeleton.d.ts.map +1 -1
  490. package/es/components/tabs/tabs-skeleton.js +3 -2
  491. package/es/components/tabs/tabs-skeleton.js.map +1 -1
  492. package/es/components/tabs/tabs.d.ts +3 -3
  493. package/es/components/tabs/tabs.d.ts.map +1 -1
  494. package/es/components/tabs/tabs.js +5 -4
  495. package/es/components/tabs/tabs.js.map +1 -1
  496. package/es/components/tag/filter-tag.d.ts +5 -2
  497. package/es/components/tag/filter-tag.d.ts.map +1 -1
  498. package/es/components/tag/filter-tag.js +3 -2
  499. package/es/components/tag/filter-tag.js.map +1 -1
  500. package/es/components/tag/tag.d.ts +1 -1
  501. package/es/components/tag/tag.d.ts.map +1 -1
  502. package/es/components/tag/tag.js +3 -2
  503. package/es/components/tag/tag.js.map +1 -1
  504. package/es/components/textarea/textarea-skeleton.d.ts +1 -1
  505. package/es/components/textarea/textarea-skeleton.d.ts.map +1 -1
  506. package/es/components/textarea/textarea-skeleton.js +3 -2
  507. package/es/components/textarea/textarea-skeleton.js.map +1 -1
  508. package/es/components/textarea/textarea.d.ts +1 -1
  509. package/es/components/textarea/textarea.d.ts.map +1 -1
  510. package/es/components/textarea/textarea.js +3 -2
  511. package/es/components/textarea/textarea.js.map +1 -1
  512. package/es/components/tile/clickable-tile.d.ts +1 -1
  513. package/es/components/tile/clickable-tile.d.ts.map +1 -1
  514. package/es/components/tile/clickable-tile.js +3 -2
  515. package/es/components/tile/clickable-tile.js.map +1 -1
  516. package/es/components/tile/expandable-tile.d.ts +1 -1
  517. package/es/components/tile/expandable-tile.d.ts.map +1 -1
  518. package/es/components/tile/expandable-tile.js +3 -2
  519. package/es/components/tile/expandable-tile.js.map +1 -1
  520. package/es/components/tile/radio-tile.d.ts +1 -1
  521. package/es/components/tile/radio-tile.d.ts.map +1 -1
  522. package/es/components/tile/radio-tile.js +2 -2
  523. package/es/components/tile/radio-tile.js.map +1 -1
  524. package/es/components/tile/selectable-tile.d.ts.map +1 -1
  525. package/es/components/tile/selectable-tile.js +2 -1
  526. package/es/components/tile/selectable-tile.js.map +1 -1
  527. package/es/components/tile/tile-group.d.ts +1 -1
  528. package/es/components/tile/tile-group.d.ts.map +1 -1
  529. package/es/components/tile/tile-group.js +3 -2
  530. package/es/components/tile/tile-group.js.map +1 -1
  531. package/es/components/tile/tile.d.ts +1 -1
  532. package/es/components/tile/tile.d.ts.map +1 -1
  533. package/es/components/tile/tile.js +3 -2
  534. package/es/components/tile/tile.js.map +1 -1
  535. package/es/components/toggle/toggle.d.ts +1 -1
  536. package/es/components/toggle/toggle.d.ts.map +1 -1
  537. package/es/components/toggle/toggle.js +3 -2
  538. package/es/components/toggle/toggle.js.map +1 -1
  539. package/es/components/tooltip/tooltip-body.d.ts.map +1 -1
  540. package/es/components/tooltip/tooltip-body.js +2 -1
  541. package/es/components/tooltip/tooltip-body.js.map +1 -1
  542. package/es/components/tooltip/tooltip-definition.d.ts +1 -1
  543. package/es/components/tooltip/tooltip-definition.d.ts.map +1 -1
  544. package/es/components/tooltip/tooltip-definition.js +3 -2
  545. package/es/components/tooltip/tooltip-definition.js.map +1 -1
  546. package/es/components/tooltip/tooltip-footer.d.ts +1 -1
  547. package/es/components/tooltip/tooltip-footer.d.ts.map +1 -1
  548. package/es/components/tooltip/tooltip-footer.js +3 -2
  549. package/es/components/tooltip/tooltip-footer.js.map +1 -1
  550. package/es/components/tooltip/tooltip-icon.d.ts +1 -1
  551. package/es/components/tooltip/tooltip-icon.d.ts.map +1 -1
  552. package/es/components/tooltip/tooltip-icon.js +3 -2
  553. package/es/components/tooltip/tooltip-icon.js.map +1 -1
  554. package/es/components/tooltip/tooltip.d.ts.map +1 -1
  555. package/es/components/tooltip/tooltip.js +2 -1
  556. package/es/components/tooltip/tooltip.js.map +1 -1
  557. package/es/components/ui-shell/header-menu-button.d.ts +1 -1
  558. package/es/components/ui-shell/header-menu-button.d.ts.map +1 -1
  559. package/es/components/ui-shell/header-menu-button.js +3 -2
  560. package/es/components/ui-shell/header-menu-button.js.map +1 -1
  561. package/es/components/ui-shell/header-menu-item.d.ts +1 -1
  562. package/es/components/ui-shell/header-menu-item.d.ts.map +1 -1
  563. package/es/components/ui-shell/header-menu-item.js +2 -2
  564. package/es/components/ui-shell/header-menu-item.js.map +1 -1
  565. package/es/components/ui-shell/header-menu.d.ts +1 -1
  566. package/es/components/ui-shell/header-menu.d.ts.map +1 -1
  567. package/es/components/ui-shell/header-menu.js +3 -2
  568. package/es/components/ui-shell/header-menu.js.map +1 -1
  569. package/es/components/ui-shell/header-name.d.ts +1 -1
  570. package/es/components/ui-shell/header-name.d.ts.map +1 -1
  571. package/es/components/ui-shell/header-name.js +3 -2
  572. package/es/components/ui-shell/header-name.js.map +1 -1
  573. package/es/components/ui-shell/header-nav-item.d.ts +1 -1
  574. package/es/components/ui-shell/header-nav-item.d.ts.map +1 -1
  575. package/es/components/ui-shell/header-nav-item.js +3 -2
  576. package/es/components/ui-shell/header-nav-item.js.map +1 -1
  577. package/es/components/ui-shell/header-nav.d.ts +1 -1
  578. package/es/components/ui-shell/header-nav.d.ts.map +1 -1
  579. package/es/components/ui-shell/header-nav.js +3 -2
  580. package/es/components/ui-shell/header-nav.js.map +1 -1
  581. package/es/components/ui-shell/header.d.ts +1 -1
  582. package/es/components/ui-shell/header.d.ts.map +1 -1
  583. package/es/components/ui-shell/header.js +3 -2
  584. package/es/components/ui-shell/header.js.map +1 -1
  585. package/es/components/ui-shell/side-nav-divider.d.ts +1 -1
  586. package/es/components/ui-shell/side-nav-divider.d.ts.map +1 -1
  587. package/es/components/ui-shell/side-nav-divider.js +3 -2
  588. package/es/components/ui-shell/side-nav-divider.js.map +1 -1
  589. package/es/components/ui-shell/side-nav-items.d.ts +1 -1
  590. package/es/components/ui-shell/side-nav-items.d.ts.map +1 -1
  591. package/es/components/ui-shell/side-nav-items.js +3 -2
  592. package/es/components/ui-shell/side-nav-items.js.map +1 -1
  593. package/es/components/ui-shell/side-nav-link.d.ts +1 -1
  594. package/es/components/ui-shell/side-nav-link.d.ts.map +1 -1
  595. package/es/components/ui-shell/side-nav-link.js +3 -2
  596. package/es/components/ui-shell/side-nav-link.js.map +1 -1
  597. package/es/components/ui-shell/side-nav-menu-item.d.ts +1 -1
  598. package/es/components/ui-shell/side-nav-menu-item.d.ts.map +1 -1
  599. package/es/components/ui-shell/side-nav-menu-item.js +3 -2
  600. package/es/components/ui-shell/side-nav-menu-item.js.map +1 -1
  601. package/es/components/ui-shell/side-nav-menu.d.ts +1 -1
  602. package/es/components/ui-shell/side-nav-menu.d.ts.map +1 -1
  603. package/es/components/ui-shell/side-nav-menu.js +3 -2
  604. package/es/components/ui-shell/side-nav-menu.js.map +1 -1
  605. package/es/components/ui-shell/side-nav.d.ts +1 -1
  606. package/es/components/ui-shell/side-nav.d.ts.map +1 -1
  607. package/es/components/ui-shell/side-nav.js +3 -2
  608. package/es/components/ui-shell/side-nav.js.map +1 -1
  609. package/es/globals/decorators/carbon-element.d.ts +235 -0
  610. package/es/globals/decorators/carbon-element.d.ts.map +1 -0
  611. package/es/globals/decorators/carbon-element.js +429 -0
  612. package/es/globals/decorators/carbon-element.js.map +1 -0
  613. package/package.json +2 -2
  614. package/dist/checkbox-0edcc860.js +0 -65
  615. package/dist/checkbox-155d2e12.js +0 -65
  616. package/dist/copy-button-d50482da.js +0 -65
  617. package/dist/copy-button-e0c0c272.js +0 -65
  618. package/dist/link-5cef0608.js +0 -65
  619. package/dist/link-c666ff67.js +0 -65
  620. package/dist/loading-3754cb83.js +0 -65
  621. package/dist/loading-a86f38a0.js +0 -65
  622. package/dist/search-11f3a241.js +0 -65
  623. package/dist/search-487b4714.js +0 -65
@@ -7,18 +7,19 @@ let _ = t => t,
7
7
  /**
8
8
  * @license
9
9
  *
10
- * Copyright IBM Corp. 2019, 2022
10
+ * Copyright IBM Corp. 2019, 2023
11
11
  *
12
12
  * This source code is licensed under the Apache-2.0 license found in the
13
13
  * LICENSE file in the root directory of this source tree.
14
14
  */
15
15
 
16
16
  import settings from 'carbon-components/es/globals/js/settings';
17
- import { html, property, query, customElement } from 'lit-element';
17
+ import { html, property, query } from 'lit-element';
18
18
  import Close16 from "../../icons/close/16";
19
19
  import { findIndex, forEach } from '../../globals/internal/collection-helpers';
20
20
  import BXDropdown, { DROPDOWN_KEYBOARD_ACTION } from '../dropdown/dropdown';
21
21
  import styles from "././combo-box.css.js";
22
+ import { carbonElement as customElement } from '../../globals/decorators/carbon-element';
22
23
  export { DROPDOWN_COLOR_SCHEME, DROPDOWN_SIZE, DROPDOWN_TYPE } from '../dropdown/dropdown';
23
24
  const {
24
25
  prefix
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box.js","names":["settings","html","property","query","customElement","Close16","findIndex","forEach","BXDropdown","DROPDOWN_KEYBOARD_ACTION","styles","DROPDOWN_COLOR_SCHEME","DROPDOWN_SIZE","DROPDOWN_TYPE","prefix","BXComboBox","_decorate","_initialize","_BXDropdown","constructor","args","F","d","kind","key","value","decorators","_testItemWithQueryText","item","itemMatches","_defaultItemMatches","_filterInputNode","queryText","textContent","toLowerCase","indexOf","_handleInput","items","querySelectorAll","selectorItem","index","i","_this$_itemMenu","menuRect","_itemMenu","getBoundingClientRect","itemRect","isViewable","top","bottom","clientHeight","scrollTop","scrollBot","Math","abs","highlighted","filterInput","_filterInputValue","open","requestUpdate","_handleClickInner","event","_this$_selectionButto","_selectionButtonNode","contains","target","_handleUserInitiatedClearInput","_get","_getPrototypeOf","prototype","call","_handleKeypressInner","_this$_selectionButto2","action","getAction","TRIGGERING","focus","_handleUserInitiatedSelectItem","_selectionShouldChange","_selectionDidChange","itemToSelect","selectorItemSelected","selected","_assistiveStatusText","selectedItemAssistiveText","_handleUserInitiatedToggle","_renderTriggerContent","disabled","inputLabel","triggerContent","filterInputValue","handleInput","_t","_","_renderFollowingTriggerContent","clearSelectionLabel","length","undefined","_t2","attribute","shouldUpdate","changedProperties","_selectedItemContent","selectedItemContent","has","updated","_listBoxNode","listBoxNode","classList","add","static","Set","selectorItemHighlighted","eventBeforeToggle","eventToggle","eventBeforeSelect","eventSelect"],"sources":["components/combo-box/combo-box.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2022\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport settings from 'carbon-components/es/globals/js/settings';\nimport { TemplateResult } from 'lit-html';\nimport { html, property, query, customElement } from 'lit-element';\nimport Close16 from '@carbon/icons/lib/close/16';\nimport { findIndex, forEach } from '../../globals/internal/collection-helpers';\nimport BXDropdown, { DROPDOWN_KEYBOARD_ACTION } from '../dropdown/dropdown';\nimport BXComboBoxItem from './combo-box-item';\nimport styles from './combo-box.scss';\n\nexport {\n DROPDOWN_COLOR_SCHEME,\n DROPDOWN_SIZE,\n DROPDOWN_TYPE,\n} from '../dropdown/dropdown';\n\nconst { prefix } = settings;\n\n/**\n * Combo box.\n *\n * @element bx-combo-box\n * @fires bx-combo-box-beingselected\n * The custom event fired before a combo box item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n * @fires bx-combo-box-beingtoggled\n * The custom event fired before the open state of this combo box is toggled upon a user gesture.\n * Cancellation of this event stops the user-initiated toggling.\n * @fires bx-combo-box-selected - The custom event fired after a combo box item is selected upon a user gesture.\n * @fires bx-combo-box-toggled - The custom event fired after the open state of this combo box is toggled upon a user gesture.\n */\n@customElement(`${prefix}-combo-box`)\nclass BXComboBox extends BXDropdown {\n /**\n * The text content that should be set to the `<input>` for filtering.\n */\n protected _filterInputValue = '';\n\n protected _shouldTriggerBeFocusable = false;\n\n /**\n * The `<input>` for filtering.\n */\n @query('input')\n private _filterInputNode!: HTMLInputElement;\n\n /**\n * The menu containing all selectable items.\n */\n @query('#menu-body')\n private _itemMenu!: HTMLElement;\n\n /**\n * The selection button.\n */\n @query('#selection-button')\n private _selectionButtonNode!: HTMLElement;\n\n /**\n * @param item A combo box item.\n * @returns `true` if the given combo box item matches the query text user types.\n */\n protected _testItemWithQueryText(item) {\n return (this.itemMatches || this._defaultItemMatches)(\n item,\n this._filterInputNode.value\n );\n }\n\n /* eslint-disable class-methods-use-this */\n /**\n * The default item matching callback.\n *\n * @param item The combo box item.\n * @param queryText The query text user types.\n * @returns `true` if the given combo box item matches the given query text.\n */\n protected _defaultItemMatches(\n item: BXComboBoxItem,\n queryText: string\n ): boolean {\n return (\n item.textContent!.toLowerCase().indexOf(queryText.toLowerCase()) >= 0\n );\n }\n /* eslint-enable class-methods-use-this */\n\n /**\n * Handles `input` event on the `<input>` for filtering.\n */\n protected _handleInput() {\n const items = this.querySelectorAll(\n (this.constructor as typeof BXComboBox).selectorItem\n );\n const index = !this._filterInputNode.value\n ? -1\n : findIndex(items, this._testItemWithQueryText, this);\n forEach(items, (item, i) => {\n if (i === index) {\n const menuRect = this._itemMenu?.getBoundingClientRect();\n const itemRect = item.getBoundingClientRect();\n\n if (menuRect && itemRect) {\n const isViewable =\n menuRect!.top <= itemRect?.top &&\n itemRect?.bottom <= menuRect?.top + this._itemMenu!.clientHeight;\n if (!isViewable) {\n const scrollTop = itemRect?.top - menuRect?.top;\n const scrollBot = itemRect?.bottom - menuRect?.bottom;\n\n if (Math.abs(scrollTop) < Math.abs(scrollBot)) {\n this._itemMenu!.scrollTop += scrollTop;\n } else {\n this._itemMenu!.scrollTop += scrollBot;\n }\n }\n }\n }\n (item as BXComboBoxItem).highlighted = i === index;\n });\n const { _filterInputNode: filterInput } = this;\n this._filterInputValue = !filterInput ? '' : filterInput.value;\n this.open = true;\n this.requestUpdate(); // If the only change is to `_filterInputValue`, auto-update doesn't happen\n }\n\n protected _handleClickInner(event: MouseEvent) {\n if (this._selectionButtonNode?.contains(event.target as Node)) {\n this._handleUserInitiatedClearInput();\n } else {\n super._handleClickInner(event);\n }\n }\n\n protected _handleKeypressInner(event: KeyboardEvent) {\n const { key } = event;\n const action = (this.constructor as typeof BXDropdown).getAction(key);\n const { TRIGGERING } = DROPDOWN_KEYBOARD_ACTION;\n if (\n this._selectionButtonNode?.contains(event.target as Node) &&\n // Space key should be handled by `<input>` unless \"clear selection\" button has focus\n (action === TRIGGERING || key === ' ')\n ) {\n this._handleUserInitiatedClearInput();\n } else {\n super._handleKeypressInner(event);\n }\n }\n\n /**\n * Handles user-initiated clearing the `<input>` for filtering.\n */\n protected _handleUserInitiatedClearInput() {\n forEach(\n this.querySelectorAll(\n (this.constructor as typeof BXComboBox).selectorItem\n ),\n (item) => {\n (item as BXComboBoxItem).highlighted = false;\n }\n );\n this._filterInputValue = '';\n this._filterInputNode.focus();\n this._handleUserInitiatedSelectItem();\n }\n\n protected _handleUserInitiatedSelectItem(item?: BXComboBoxItem) {\n if (item && !this._selectionShouldChange(item)) {\n // Escape hatch for `shouldUpdate()` logic that updates `._filterInputValue()` when selection changes,\n // given we want to update the `<input>` and close the dropdown even if selection doesn't update.\n // Use case:\n // 1. Select the 2nd item in combo box drop down\n // 2. Type some text in the `<input>`\n // 3. Re-select the 2nd item in combo box drop down,\n // the `<input>` has to updated with the 2nd item and the dropdown should be closed,\n // even if there is no change in the selected value\n this._filterInputValue = item.textContent || '';\n this.open = false;\n this.requestUpdate();\n }\n super._handleUserInitiatedSelectItem(item);\n }\n\n protected _selectionDidChange(itemToSelect?: BXComboBoxItem) {\n this.value = !itemToSelect ? '' : itemToSelect.value;\n forEach(\n this.querySelectorAll(\n (this.constructor as typeof BXDropdown).selectorItemSelected\n ),\n (item) => {\n (item as BXComboBoxItem).selected = false;\n }\n );\n if (itemToSelect) {\n itemToSelect.selected = true;\n this._assistiveStatusText = this.selectedItemAssistiveText;\n }\n this._handleUserInitiatedToggle(false);\n }\n\n protected _renderTriggerContent(): TemplateResult {\n const {\n disabled,\n inputLabel,\n triggerContent,\n _filterInputValue: filterInputValue,\n _handleInput: handleInput,\n } = this;\n return html`\n <input\n id=\"trigger-label\"\n class=\"${prefix}--text-input\"\n ?disabled=${disabled}\n placeholder=\"${triggerContent}\"\n .value=${filterInputValue}\n role=\"combobox\"\n aria-label=\"${inputLabel}\"\n aria-controls=\"menu-body\"\n aria-autocomplete=\"list\"\n @input=${handleInput} />\n `;\n }\n\n protected _renderFollowingTriggerContent(): TemplateResult | void {\n const { clearSelectionLabel, _filterInputValue: filterInputValue } = this;\n return filterInputValue.length === 0\n ? undefined\n : html`\n <div\n id=\"selection-button\"\n role=\"button\"\n class=\"${prefix}--list-box__selection\"\n tabindex=\"0\"\n title=\"${clearSelectionLabel}\">\n ${Close16({ 'aria-label': clearSelectionLabel })}\n </div>\n `;\n }\n\n /**\n * The `aria-label` attribute for the icon to clear selection.\n */\n @property({ attribute: 'clear-selection-label' })\n clearSelectionLabel = '';\n\n /**\n * The `aria-label` attribute for the `<input>` for filtering.\n */\n @property({ attribute: 'input-label' })\n inputLabel = '';\n\n /**\n * The custom item matching callback.\n */\n @property({ attribute: false })\n itemMatches!: (item: BXComboBoxItem, queryText: string) => boolean;\n\n shouldUpdate(changedProperties) {\n super.shouldUpdate(changedProperties);\n const { _selectedItemContent: selectedItemContent } = this;\n if (selectedItemContent && changedProperties.has('value')) {\n this._filterInputValue = selectedItemContent?.textContent || '';\n }\n return true;\n }\n\n updated() {\n const { _listBoxNode: listBoxNode } = this;\n if (listBoxNode) {\n listBoxNode.classList.add(`${prefix}--combo-box`);\n }\n }\n\n // For combo box, open/selection with space key is disabled given the input box should take it over\n static TRIGGER_KEYS = new Set(['Enter']);\n\n /**\n * A selector that will return highlighted items.\n */\n static get selectorItemHighlighted() {\n return `${prefix}-combo-box-item[highlighted]`;\n }\n\n /**\n * A selector that will return combo box items.\n */\n static get selectorItem() {\n return `${prefix}-combo-box-item`;\n }\n\n /**\n * A selector that will return selected items.\n */\n static get selectorItemSelected() {\n return `${prefix}-combo-box-item[selected]`;\n }\n\n /**\n * The name of the custom event fired before this combo box item is being toggled upon a user gesture.\n * Cancellation of this event stops the user-initiated action of toggling this combo box item.\n */\n static get eventBeforeToggle() {\n return `${prefix}-combo-box-beingtoggled`;\n }\n\n /**\n * The name of the custom event fired after this combo box item is toggled upon a user gesture.\n */\n static get eventToggle() {\n return `${prefix}-combo-box-toggled`;\n }\n\n /**\n * The name of the custom event fired before a combo box item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n */\n static get eventBeforeSelect() {\n return `${prefix}-combo-box-beingselected`;\n }\n\n /**\n * The name of the custom event fired after a a combo box item is selected upon a user gesture.\n */\n static get eventSelect() {\n return `${prefix}-combo-box-selected`;\n }\n\n static styles = styles;\n}\n\nexport default BXComboBox;\n"],"m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AA;MAAAuF,MAAA;MAAAtF,GAAA;MAAAC,KAAA,EAIA,SAAA0F,kBAAA,EAA+B;QAC7B,OAAQ,GAAErG,MAAO,0BAAyB;MAC5C;;MAEA;AACF;AACA;IAFE;MAAAS,IAAA;MAAAuF,MAAA;MAAAtF,GAAA;MAAAC,KAAA,EAGA,SAAA2F,YAAA,EAAyB;QACvB,OAAQ,GAAEtG,MAAO,qBAAoB;MACvC;IAAC;MAAAS,IAAA;MAAAuF,MAAA;MAAAtF,GAAA;MAAAC,MAAA;QAAA,OAEef,MAAM;MAAA;IAAA;EAAA;AAAA,GAvSCF,UAAU;AA0SnC,eAAeO,UAAU"}
1
+ {"version":3,"file":"combo-box.js","names":["settings","html","property","query","Close16","findIndex","forEach","BXDropdown","DROPDOWN_KEYBOARD_ACTION","styles","carbonElement","customElement","DROPDOWN_COLOR_SCHEME","DROPDOWN_SIZE","DROPDOWN_TYPE","prefix","BXComboBox","_decorate","_initialize","_BXDropdown","constructor","args","F","d","kind","key","value","decorators","_testItemWithQueryText","item","itemMatches","_defaultItemMatches","_filterInputNode","queryText","textContent","toLowerCase","indexOf","_handleInput","items","querySelectorAll","selectorItem","index","i","_this$_itemMenu","menuRect","_itemMenu","getBoundingClientRect","itemRect","isViewable","top","bottom","clientHeight","scrollTop","scrollBot","Math","abs","highlighted","filterInput","_filterInputValue","open","requestUpdate","_handleClickInner","event","_this$_selectionButto","_selectionButtonNode","contains","target","_handleUserInitiatedClearInput","_get","_getPrototypeOf","prototype","call","_handleKeypressInner","_this$_selectionButto2","action","getAction","TRIGGERING","focus","_handleUserInitiatedSelectItem","_selectionShouldChange","_selectionDidChange","itemToSelect","selectorItemSelected","selected","_assistiveStatusText","selectedItemAssistiveText","_handleUserInitiatedToggle","_renderTriggerContent","disabled","inputLabel","triggerContent","filterInputValue","handleInput","_t","_","_renderFollowingTriggerContent","clearSelectionLabel","length","undefined","_t2","attribute","shouldUpdate","changedProperties","_selectedItemContent","selectedItemContent","has","updated","_listBoxNode","listBoxNode","classList","add","static","Set","selectorItemHighlighted","eventBeforeToggle","eventToggle","eventBeforeSelect","eventSelect"],"sources":["components/combo-box/combo-box.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport settings from 'carbon-components/es/globals/js/settings';\nimport { TemplateResult } from 'lit-html';\nimport { html, property, query } from 'lit-element';\nimport Close16 from '@carbon/icons/lib/close/16';\nimport { findIndex, forEach } from '../../globals/internal/collection-helpers';\nimport BXDropdown, { DROPDOWN_KEYBOARD_ACTION } from '../dropdown/dropdown';\nimport BXComboBoxItem from './combo-box-item';\nimport styles from './combo-box.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nexport {\n DROPDOWN_COLOR_SCHEME,\n DROPDOWN_SIZE,\n DROPDOWN_TYPE,\n} from '../dropdown/dropdown';\n\nconst { prefix } = settings;\n\n/**\n * Combo box.\n *\n * @element bx-combo-box\n * @fires bx-combo-box-beingselected\n * The custom event fired before a combo box item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n * @fires bx-combo-box-beingtoggled\n * The custom event fired before the open state of this combo box is toggled upon a user gesture.\n * Cancellation of this event stops the user-initiated toggling.\n * @fires bx-combo-box-selected - The custom event fired after a combo box item is selected upon a user gesture.\n * @fires bx-combo-box-toggled - The custom event fired after the open state of this combo box is toggled upon a user gesture.\n */\n@customElement(`${prefix}-combo-box`)\nclass BXComboBox extends BXDropdown {\n /**\n * The text content that should be set to the `<input>` for filtering.\n */\n protected _filterInputValue = '';\n\n protected _shouldTriggerBeFocusable = false;\n\n /**\n * The `<input>` for filtering.\n */\n @query('input')\n private _filterInputNode!: HTMLInputElement;\n\n /**\n * The menu containing all selectable items.\n */\n @query('#menu-body')\n private _itemMenu!: HTMLElement;\n\n /**\n * The selection button.\n */\n @query('#selection-button')\n private _selectionButtonNode!: HTMLElement;\n\n /**\n * @param item A combo box item.\n * @returns `true` if the given combo box item matches the query text user types.\n */\n protected _testItemWithQueryText(item) {\n return (this.itemMatches || this._defaultItemMatches)(\n item,\n this._filterInputNode.value\n );\n }\n\n /* eslint-disable class-methods-use-this */\n /**\n * The default item matching callback.\n *\n * @param item The combo box item.\n * @param queryText The query text user types.\n * @returns `true` if the given combo box item matches the given query text.\n */\n protected _defaultItemMatches(\n item: BXComboBoxItem,\n queryText: string\n ): boolean {\n return (\n item.textContent!.toLowerCase().indexOf(queryText.toLowerCase()) >= 0\n );\n }\n /* eslint-enable class-methods-use-this */\n\n /**\n * Handles `input` event on the `<input>` for filtering.\n */\n protected _handleInput() {\n const items = this.querySelectorAll(\n (this.constructor as typeof BXComboBox).selectorItem\n );\n const index = !this._filterInputNode.value\n ? -1\n : findIndex(items, this._testItemWithQueryText, this);\n forEach(items, (item, i) => {\n if (i === index) {\n const menuRect = this._itemMenu?.getBoundingClientRect();\n const itemRect = item.getBoundingClientRect();\n\n if (menuRect && itemRect) {\n const isViewable =\n menuRect!.top <= itemRect?.top &&\n itemRect?.bottom <= menuRect?.top + this._itemMenu!.clientHeight;\n if (!isViewable) {\n const scrollTop = itemRect?.top - menuRect?.top;\n const scrollBot = itemRect?.bottom - menuRect?.bottom;\n\n if (Math.abs(scrollTop) < Math.abs(scrollBot)) {\n this._itemMenu!.scrollTop += scrollTop;\n } else {\n this._itemMenu!.scrollTop += scrollBot;\n }\n }\n }\n }\n (item as BXComboBoxItem).highlighted = i === index;\n });\n const { _filterInputNode: filterInput } = this;\n this._filterInputValue = !filterInput ? '' : filterInput.value;\n this.open = true;\n this.requestUpdate(); // If the only change is to `_filterInputValue`, auto-update doesn't happen\n }\n\n protected _handleClickInner(event: MouseEvent) {\n if (this._selectionButtonNode?.contains(event.target as Node)) {\n this._handleUserInitiatedClearInput();\n } else {\n super._handleClickInner(event);\n }\n }\n\n protected _handleKeypressInner(event: KeyboardEvent) {\n const { key } = event;\n const action = (this.constructor as typeof BXDropdown).getAction(key);\n const { TRIGGERING } = DROPDOWN_KEYBOARD_ACTION;\n if (\n this._selectionButtonNode?.contains(event.target as Node) &&\n // Space key should be handled by `<input>` unless \"clear selection\" button has focus\n (action === TRIGGERING || key === ' ')\n ) {\n this._handleUserInitiatedClearInput();\n } else {\n super._handleKeypressInner(event);\n }\n }\n\n /**\n * Handles user-initiated clearing the `<input>` for filtering.\n */\n protected _handleUserInitiatedClearInput() {\n forEach(\n this.querySelectorAll(\n (this.constructor as typeof BXComboBox).selectorItem\n ),\n (item) => {\n (item as BXComboBoxItem).highlighted = false;\n }\n );\n this._filterInputValue = '';\n this._filterInputNode.focus();\n this._handleUserInitiatedSelectItem();\n }\n\n protected _handleUserInitiatedSelectItem(item?: BXComboBoxItem) {\n if (item && !this._selectionShouldChange(item)) {\n // Escape hatch for `shouldUpdate()` logic that updates `._filterInputValue()` when selection changes,\n // given we want to update the `<input>` and close the dropdown even if selection doesn't update.\n // Use case:\n // 1. Select the 2nd item in combo box drop down\n // 2. Type some text in the `<input>`\n // 3. Re-select the 2nd item in combo box drop down,\n // the `<input>` has to updated with the 2nd item and the dropdown should be closed,\n // even if there is no change in the selected value\n this._filterInputValue = item.textContent || '';\n this.open = false;\n this.requestUpdate();\n }\n super._handleUserInitiatedSelectItem(item);\n }\n\n protected _selectionDidChange(itemToSelect?: BXComboBoxItem) {\n this.value = !itemToSelect ? '' : itemToSelect.value;\n forEach(\n this.querySelectorAll(\n (this.constructor as typeof BXDropdown).selectorItemSelected\n ),\n (item) => {\n (item as BXComboBoxItem).selected = false;\n }\n );\n if (itemToSelect) {\n itemToSelect.selected = true;\n this._assistiveStatusText = this.selectedItemAssistiveText;\n }\n this._handleUserInitiatedToggle(false);\n }\n\n protected _renderTriggerContent(): TemplateResult {\n const {\n disabled,\n inputLabel,\n triggerContent,\n _filterInputValue: filterInputValue,\n _handleInput: handleInput,\n } = this;\n return html`\n <input\n id=\"trigger-label\"\n class=\"${prefix}--text-input\"\n ?disabled=${disabled}\n placeholder=\"${triggerContent}\"\n .value=${filterInputValue}\n role=\"combobox\"\n aria-label=\"${inputLabel}\"\n aria-controls=\"menu-body\"\n aria-autocomplete=\"list\"\n @input=${handleInput} />\n `;\n }\n\n protected _renderFollowingTriggerContent(): TemplateResult | void {\n const { clearSelectionLabel, _filterInputValue: filterInputValue } = this;\n return filterInputValue.length === 0\n ? undefined\n : html`\n <div\n id=\"selection-button\"\n role=\"button\"\n class=\"${prefix}--list-box__selection\"\n tabindex=\"0\"\n title=\"${clearSelectionLabel}\">\n ${Close16({ 'aria-label': clearSelectionLabel })}\n </div>\n `;\n }\n\n /**\n * The `aria-label` attribute for the icon to clear selection.\n */\n @property({ attribute: 'clear-selection-label' })\n clearSelectionLabel = '';\n\n /**\n * The `aria-label` attribute for the `<input>` for filtering.\n */\n @property({ attribute: 'input-label' })\n inputLabel = '';\n\n /**\n * The custom item matching callback.\n */\n @property({ attribute: false })\n itemMatches!: (item: BXComboBoxItem, queryText: string) => boolean;\n\n shouldUpdate(changedProperties) {\n super.shouldUpdate(changedProperties);\n const { _selectedItemContent: selectedItemContent } = this;\n if (selectedItemContent && changedProperties.has('value')) {\n this._filterInputValue = selectedItemContent?.textContent || '';\n }\n return true;\n }\n\n updated() {\n const { _listBoxNode: listBoxNode } = this;\n if (listBoxNode) {\n listBoxNode.classList.add(`${prefix}--combo-box`);\n }\n }\n\n // For combo box, open/selection with space key is disabled given the input box should take it over\n static TRIGGER_KEYS = new Set(['Enter']);\n\n /**\n * A selector that will return highlighted items.\n */\n static get selectorItemHighlighted() {\n return `${prefix}-combo-box-item[highlighted]`;\n }\n\n /**\n * A selector that will return combo box items.\n */\n static get selectorItem() {\n return `${prefix}-combo-box-item`;\n }\n\n /**\n * A selector that will return selected items.\n */\n static get selectorItemSelected() {\n return `${prefix}-combo-box-item[selected]`;\n }\n\n /**\n * The name of the custom event fired before this combo box item is being toggled upon a user gesture.\n * Cancellation of this event stops the user-initiated action of toggling this combo box item.\n */\n static get eventBeforeToggle() {\n return `${prefix}-combo-box-beingtoggled`;\n }\n\n /**\n * The name of the custom event fired after this combo box item is toggled upon a user gesture.\n */\n static get eventToggle() {\n return `${prefix}-combo-box-toggled`;\n }\n\n /**\n * The name of the custom event fired before a combo box item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n */\n static get eventBeforeSelect() {\n return `${prefix}-combo-box-beingselected`;\n }\n\n /**\n * The name of the custom event fired after a a combo box item is selected upon a user gesture.\n */\n static get eventSelect() {\n return `${prefix}-combo-box-selected`;\n }\n\n static styles = styles;\n}\n\nexport default BXComboBox;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,QAAQ,MAAM,0CAA0C;AAE/D,SAASC,IAAI,EAAEC,QAAQ,EAAEC,KAAK,QAAQ,aAAa;AACnD,OAAOC,OAAO,MAAM,sBAA4B;AAChD,SAASC,SAAS,EAAEC,OAAO,QAAQ,2CAA2C;AAC9E,OAAOC,UAAU,IAAIC,wBAAwB,QAAQ,sBAAsB;AAE3E,OAAOC,MAAM,MAAM,sBAAkB;AACrC,SAASC,aAAa,IAAIC,aAAa,QAAQ,yCAAyC;AAExF,SACEC,qBAAqB,EACrBC,aAAa,EACbC,aAAa,QACR,sBAAsB;AAE7B,MAAM;EAAEC;AAAO,CAAC,GAAGf,QAAQ;;AAE3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA,IAcMgB,UAAU,GAAAC,SAAA,EADfN,aAAa,CAAE,GAAEI,MAAO,YAAW,CAAC,aAAAG,WAAA,EAAAC,WAAA;EAArC,MACMH,UAAU,SAAAG,WAAA,CAAoB;IAAAC,YAAA,GAAAC,IAAA;MAAA,SAAAA,IAAA;MAAAH,WAAA;IAAA;EAwSpC;EAAC;IAAAI,CAAA,EAxSKN,UAAU;IAAAO,CAAA;MAAAC,IAAA;MAAAC,GAAA;MAAAC,MAAA;QAAA,OAIgB,EAAE;MAAA;IAAA;MA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,EAAkC;QAChC,OAAQ,GAAEnE,MAAO,2BAA0B;MAC7C;;MAEA;AACF;AACA;AACA;IAHE;MAAAS,IAAA;MAAAuF,MAAA;MAAAtF,GAAA;MAAAC,KAAA,EAIA,SAAAwF,kBAAA,EAA+B;QAC7B,OAAQ,GAAEnG,MAAO,yBAAwB;MAC3C;;MAEA;AACF;AACA;IAFE;MAAAS,IAAA;MAAAuF,MAAA;MAAAtF,GAAA;MAAAC,KAAA,EAGA,SAAAyF,YAAA,EAAyB;QACvB,OAAQ,GAAEpG,MAAO,oBAAmB;MACtC;;MAEA;AACF;AACA;AACA;IAHE;MAAAS,IAAA;MAAAuF,MAAA;MAAAtF,GAAA;MAAAC,KAAA,EAIA,SAAA0F,kBAAA,EAA+B;QAC7B,OAAQ,GAAErG,MAAO,0BAAyB;MAC5C;;MAEA;AACF;AACA;IAFE;MAAAS,IAAA;MAAAuF,MAAA;MAAAtF,GAAA;MAAAC,KAAA,EAGA,SAAA2F,YAAA,EAAyB;QACvB,OAAQ,GAAEtG,MAAO,qBAAoB;MACvC;IAAC;MAAAS,IAAA;MAAAuF,MAAA;MAAAtF,GAAA;MAAAC,MAAA;QAAA,OAEejB,MAAM;MAAA;IAAA;EAAA;AAAA,GAvSCF,UAAU;AA0SnC,eAAeS,UAAU"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  *
4
- * Copyright IBM Corp. 2019, 2022
4
+ * Copyright IBM Corp. 2019, 2023
5
5
  *
6
6
  * This source code is licensed under the Apache-2.0 license found in the
7
7
  * LICENSE file in the root directory of this source tree.
@@ -1 +1 @@
1
- {"version":3,"sources":["components/content-switcher/content-switcher-item.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAiC,UAAU,EAAE,MAAM,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQxE;;;;GAIG;AACH,cACM,qBAAsB,SAAQ,0BAAsB;IACxD;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;;;OAIG;IAEH,WAAW,UAAS;IAEpB;;;;OAIG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,MAAM,EAAG,MAAM,CAAC;IAEhB;;OAEG;IAEH,KAAK,SAAM;IAEX,gBAAgB;IAShB,YAAY,CAAC,iBAAiB,KAAA;IAe9B,MAAM;IAmBN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,qBAAqB,CAAC","file":"content-switcher-item.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2022\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { classMap } from 'lit-html/directives/class-map';\nimport { html, property, customElement, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport ifNonNull from '../../globals/directives/if-non-null';\nimport FocusMixin from '../../globals/mixins/focus';\nimport styles from './content-switcher.scss';\n\nconst { prefix } = settings;\n\n/**\n * Content switcher button.\n *\n * @element bx-content-switcher-item\n */\n@customElement(`${prefix}-content-switcher-item`)\nclass BXContentSwitcherItem extends FocusMixin(LitElement) {\n /**\n * `true` if this content switcher item should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * `true` to hide the divider at the left.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-divider' })\n hideDivider = false;\n\n /**\n * `true` if the content switcher button should be selected.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n /**\n * The element ID of target panel.\n */\n @property()\n target!: string;\n\n /**\n * The `value` attribute that is set to the parent `<bx-content-switcher>` when this content switcher item is selected.\n */\n @property()\n value = '';\n\n createRenderRoot() {\n return this.attachShadow({\n mode: 'open',\n delegatesFocus:\n Number((/Safari\\/(\\d+)/.exec(navigator.userAgent) ?? ['', 0])[1]) <=\n 537,\n });\n }\n\n shouldUpdate(changedProperties) {\n if (changedProperties.has('selected') || changedProperties.has('target')) {\n const { selected, target } = this;\n if (target) {\n const doc = this.getRootNode() as HTMLDocument;\n // `doc` can be an element if such element is orphaned\n const targetNode = doc.getElementById && doc.getElementById(target);\n if (targetNode) {\n targetNode.toggleAttribute('hidden', !selected);\n }\n }\n }\n return true;\n }\n\n render() {\n const { disabled, selected, target } = this;\n const className = classMap({\n [`${prefix}--content-switcher-btn`]: true,\n [`${prefix}--content-switcher--selected`]: selected,\n });\n return html`\n <button\n type=\"button\"\n role=\"tab\"\n class=\"${className}\"\n ?disabled=\"${disabled}\"\n aria-controls=\"${ifNonNull(target)}\"\n aria-selected=\"${Boolean(selected)}\">\n <span class=\"${prefix}--content-switcher__label\"><slot></slot></span>\n </button>\n `;\n }\n\n static styles = styles;\n}\n\nexport default BXContentSwitcherItem;\n"]}
1
+ {"version":3,"sources":["components/content-switcher/content-switcher-item.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAkB,UAAU,EAAE,MAAM,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASzD;;;;GAIG;AACH,cACM,qBAAsB,SAAQ,0BAAsB;IACxD;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;;;OAIG;IAEH,WAAW,UAAS;IAEpB;;;;OAIG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,MAAM,EAAG,MAAM,CAAC;IAEhB;;OAEG;IAEH,KAAK,SAAM;IAEX,gBAAgB;IAShB,YAAY,CAAC,iBAAiB,KAAA;IAe9B,MAAM;IAmBN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,qBAAqB,CAAC","file":"content-switcher-item.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { classMap } from 'lit-html/directives/class-map';\nimport { html, property, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport ifNonNull from '../../globals/directives/if-non-null';\nimport FocusMixin from '../../globals/mixins/focus';\nimport styles from './content-switcher.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nconst { prefix } = settings;\n\n/**\n * Content switcher button.\n *\n * @element bx-content-switcher-item\n */\n@customElement(`${prefix}-content-switcher-item`)\nclass BXContentSwitcherItem extends FocusMixin(LitElement) {\n /**\n * `true` if this content switcher item should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * `true` to hide the divider at the left.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-divider' })\n hideDivider = false;\n\n /**\n * `true` if the content switcher button should be selected.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n /**\n * The element ID of target panel.\n */\n @property()\n target!: string;\n\n /**\n * The `value` attribute that is set to the parent `<bx-content-switcher>` when this content switcher item is selected.\n */\n @property()\n value = '';\n\n createRenderRoot() {\n return this.attachShadow({\n mode: 'open',\n delegatesFocus:\n Number((/Safari\\/(\\d+)/.exec(navigator.userAgent) ?? ['', 0])[1]) <=\n 537,\n });\n }\n\n shouldUpdate(changedProperties) {\n if (changedProperties.has('selected') || changedProperties.has('target')) {\n const { selected, target } = this;\n if (target) {\n const doc = this.getRootNode() as HTMLDocument;\n // `doc` can be an element if such element is orphaned\n const targetNode = doc.getElementById && doc.getElementById(target);\n if (targetNode) {\n targetNode.toggleAttribute('hidden', !selected);\n }\n }\n }\n return true;\n }\n\n render() {\n const { disabled, selected, target } = this;\n const className = classMap({\n [`${prefix}--content-switcher-btn`]: true,\n [`${prefix}--content-switcher--selected`]: selected,\n });\n return html`\n <button\n type=\"button\"\n role=\"tab\"\n class=\"${className}\"\n ?disabled=\"${disabled}\"\n aria-controls=\"${ifNonNull(target)}\"\n aria-selected=\"${Boolean(selected)}\">\n <span class=\"${prefix}--content-switcher__label\"><slot></slot></span>\n </button>\n `;\n }\n\n static styles = styles;\n}\n\nexport default BXContentSwitcherItem;\n"]}
@@ -4,18 +4,19 @@ let _ = t => t,
4
4
  /**
5
5
  * @license
6
6
  *
7
- * Copyright IBM Corp. 2019, 2022
7
+ * Copyright IBM Corp. 2019, 2023
8
8
  *
9
9
  * This source code is licensed under the Apache-2.0 license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
12
 
13
13
  import { classMap } from 'lit-html/directives/class-map';
14
- import { html, property, customElement, LitElement } from 'lit-element';
14
+ import { html, property, LitElement } from 'lit-element';
15
15
  import settings from 'carbon-components/es/globals/js/settings';
16
16
  import ifNonNull from '../../globals/directives/if-non-null';
17
17
  import FocusMixin from '../../globals/mixins/focus';
18
18
  import styles from "././content-switcher.css.js";
19
+ import { carbonElement as customElement } from '../../globals/decorators/carbon-element';
19
20
  const {
20
21
  prefix
21
22
  } = settings;
@@ -1 +1 @@
1
- {"version":3,"file":"content-switcher-item.js","names":["classMap","html","property","customElement","LitElement","settings","ifNonNull","FocusMixin","styles","prefix","BXContentSwitcherItem","_decorate","_initialize","_FocusMixin","constructor","args","F","d","kind","decorators","type","Boolean","reflect","key","value","attribute","createRenderRoot","_exec","attachShadow","mode","delegatesFocus","Number","exec","navigator","userAgent","shouldUpdate","changedProperties","has","selected","target","doc","getRootNode","targetNode","getElementById","toggleAttribute","render","disabled","className","_t","_","static"],"sources":["components/content-switcher/content-switcher-item.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2022\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { classMap } from 'lit-html/directives/class-map';\nimport { html, property, customElement, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport ifNonNull from '../../globals/directives/if-non-null';\nimport FocusMixin from '../../globals/mixins/focus';\nimport styles from './content-switcher.scss';\n\nconst { prefix } = settings;\n\n/**\n * Content switcher button.\n *\n * @element bx-content-switcher-item\n */\n@customElement(`${prefix}-content-switcher-item`)\nclass BXContentSwitcherItem extends FocusMixin(LitElement) {\n /**\n * `true` if this content switcher item should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * `true` to hide the divider at the left.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-divider' })\n hideDivider = false;\n\n /**\n * `true` if the content switcher button should be selected.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n /**\n * The element ID of target panel.\n */\n @property()\n target!: string;\n\n /**\n * The `value` attribute that is set to the parent `<bx-content-switcher>` when this content switcher item is selected.\n */\n @property()\n value = '';\n\n createRenderRoot() {\n return this.attachShadow({\n mode: 'open',\n delegatesFocus:\n Number((/Safari\\/(\\d+)/.exec(navigator.userAgent) ?? ['', 0])[1]) <=\n 537,\n });\n }\n\n shouldUpdate(changedProperties) {\n if (changedProperties.has('selected') || changedProperties.has('target')) {\n const { selected, target } = this;\n if (target) {\n const doc = this.getRootNode() as HTMLDocument;\n // `doc` can be an element if such element is orphaned\n const targetNode = doc.getElementById && doc.getElementById(target);\n if (targetNode) {\n targetNode.toggleAttribute('hidden', !selected);\n }\n }\n }\n return true;\n }\n\n render() {\n const { disabled, selected, target } = this;\n const className = classMap({\n [`${prefix}--content-switcher-btn`]: true,\n [`${prefix}--content-switcher--selected`]: selected,\n });\n return html`\n <button\n type=\"button\"\n role=\"tab\"\n class=\"${className}\"\n ?disabled=\"${disabled}\"\n aria-controls=\"${ifNonNull(target)}\"\n aria-selected=\"${Boolean(selected)}\">\n <span class=\"${prefix}--content-switcher__label\"><slot></slot></span>\n </button>\n `;\n }\n\n static styles = styles;\n}\n\nexport default BXContentSwitcherItem;\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,+BAA+B;AACxD,SAASC,IAAI,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,UAAU,QAAQ,aAAa;AACvE,OAAOC,QAAQ,MAAM,0CAA0C;AAC/D,OAAOC,SAAS,MAAM,sCAAsC;AAC5D,OAAOC,UAAU,MAAM,4BAA4B;AACnD,OAAOC,MAAM,MAAM,6BAAyB;AAE5C,MAAM;EAAEC;AAAO,CAAC,GAAGJ,QAAQ;;AAE3B;AACA;AACA;AACA;AACA;AAJA,IAMMK,qBAAqB,GAAAC,SAAA,EAD1BR,aAAa,CAAE,GAAEM,MAAO,wBAAuB,CAAC,aAAAG,WAAA,EAAAC,WAAA;EAAjD,MACMH,qBAAqB,SAAAG,WAAA,CAAgC;IAAAC,YAAA,GAAAC,IAAA;MAAA,SAAAA,IAAA;MAAAH,WAAA;IAAA;EA+E3D;EAAC;IAAAI,CAAA,EA/EKN,qBAAqB;IAAAO,CAAA;MAAAC,IAAA;MAAAC,UAAA,GAIxBjB,QAAQ,CAAC;QAAEkB,IAAI,EAAEC,OAAO;QAAEC,OAAO,EAAE;MAAK,CAAC,CAAC;MAAAC,GAAA;MAAAC,MAAA;QAAA,OAChC,KAAK;MAAA;I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Q;YAAEC;UAAO,CAAC,GAAG,IAAI;UACjC,IAAIA,MAAM,EAAE;YACV,MAAMC,GAAG,GAAG,IAAI,CAACC,WAAW,EAAkB;YAC9C;YACA,MAAMC,UAAU,GAAGF,GAAG,CAACG,cAAc,IAAIH,GAAG,CAACG,cAAc,CAACJ,MAAM,CAAC;YACnE,IAAIG,UAAU,EAAE;cACdA,UAAU,CAACE,eAAe,CAAC,QAAQ,EAAE,CAACN,QAAQ,CAAC;YACjD;UACF;QACF;QACA,OAAO,IAAI;MACb;IAAC;MAAApB,IAAA;MAAAK,GAAA;MAAAC,KAAA,EAED,SAAAqB,OAAA,EAAS;QACP,MAAM;UAAEC,QAAQ;UAAER,QAAQ;UAAEC;QAAO,CAAC,GAAG,IAAI;QAC3C,MAAMQ,SAAS,GAAG/C,QAAQ,CAAC;UACzB,CAAE,GAAES,MAAO,wBAAuB,GAAG,IAAI;UACzC,CAAE,GAAEA,MAAO,8BAA6B,GAAG6B;QAC7C,CAAC,CAAC;QACF,OAAOrC,IAAI,CAAA+C,EAAA,KAAAA,EAAA,GAAAC,CAAA,2LAIEF,SAAS,EACLD,QAAQ,EACJxC,SAAS,CAACiC,MAAM,CAAC,EACjBlB,OAAO,CAACiB,QAAQ,CAAC,EACnB7B,MAAM;MAG3B;IAAC;MAAAS,IAAA;MAAAgC,MAAA;MAAA3B,GAAA;MAAAC,MAAA;QAAA,OAEehB,MAAM;MAAA;IAAA;EAAA;AAAA,GA9EYD,UAAU,CAACH,UAAU,CAAC;AAiF1D,eAAeM,qBAAqB"}
1
+ {"version":3,"file":"content-switcher-item.js","names":["classMap","html","property","LitElement","settings","ifNonNull","FocusMixin","styles","carbonElement","customElement","prefix","BXContentSwitcherItem","_decorate","_initialize","_FocusMixin","constructor","args","F","d","kind","decorators","type","Boolean","reflect","key","value","attribute","createRenderRoot","_exec","attachShadow","mode","delegatesFocus","Number","exec","navigator","userAgent","shouldUpdate","changedProperties","has","selected","target","doc","getRootNode","targetNode","getElementById","toggleAttribute","render","disabled","className","_t","_","static"],"sources":["components/content-switcher/content-switcher-item.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { classMap } from 'lit-html/directives/class-map';\nimport { html, property, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport ifNonNull from '../../globals/directives/if-non-null';\nimport FocusMixin from '../../globals/mixins/focus';\nimport styles from './content-switcher.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nconst { prefix } = settings;\n\n/**\n * Content switcher button.\n *\n * @element bx-content-switcher-item\n */\n@customElement(`${prefix}-content-switcher-item`)\nclass BXContentSwitcherItem extends FocusMixin(LitElement) {\n /**\n * `true` if this content switcher item should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * `true` to hide the divider at the left.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-divider' })\n hideDivider = false;\n\n /**\n * `true` if the content switcher button should be selected.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n /**\n * The element ID of target panel.\n */\n @property()\n target!: string;\n\n /**\n * The `value` attribute that is set to the parent `<bx-content-switcher>` when this content switcher item is selected.\n */\n @property()\n value = '';\n\n createRenderRoot() {\n return this.attachShadow({\n mode: 'open',\n delegatesFocus:\n Number((/Safari\\/(\\d+)/.exec(navigator.userAgent) ?? ['', 0])[1]) <=\n 537,\n });\n }\n\n shouldUpdate(changedProperties) {\n if (changedProperties.has('selected') || changedProperties.has('target')) {\n const { selected, target } = this;\n if (target) {\n const doc = this.getRootNode() as HTMLDocument;\n // `doc` can be an element if such element is orphaned\n const targetNode = doc.getElementById && doc.getElementById(target);\n if (targetNode) {\n targetNode.toggleAttribute('hidden', !selected);\n }\n }\n }\n return true;\n }\n\n render() {\n const { disabled, selected, target } = this;\n const className = classMap({\n [`${prefix}--content-switcher-btn`]: true,\n [`${prefix}--content-switcher--selected`]: selected,\n });\n return html`\n <button\n type=\"button\"\n role=\"tab\"\n class=\"${className}\"\n ?disabled=\"${disabled}\"\n aria-controls=\"${ifNonNull(target)}\"\n aria-selected=\"${Boolean(selected)}\">\n <span class=\"${prefix}--content-switcher__label\"><slot></slot></span>\n </button>\n `;\n }\n\n static styles = styles;\n}\n\nexport default BXContentSwitcherItem;\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,+BAA+B;AACxD,SAASC,IAAI,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,aAAa;AACxD,OAAOC,QAAQ,MAAM,0CAA0C;AAC/D,OAAOC,SAAS,MAAM,sCAAsC;AAC5D,OAAOC,UAAU,MAAM,4BAA4B;AACnD,OAAOC,MAAM,MAAM,6BAAyB;AAC5C,SAASC,aAAa,IAAIC,aAAa,QAAQ,yCAAyC;AAExF,MAAM;EAAEC;AAAO,CAAC,GAAGN,QAAQ;;AAE3B;AACA;AACA;AACA;AACA;AAJA,IAMMO,qBAAqB,GAAAC,SAAA,EAD1BH,aAAa,CAAE,GAAEC,MAAO,wBAAuB,CAAC,aAAAG,WAAA,EAAAC,WAAA;EAAjD,MACMH,qBAAqB,SAAAG,WAAA,CAAgC;IAAAC,YAAA,GAAAC,IAAA;MAAA,SAAAA,IAAA;MAAAH,WAAA;IAAA;EA+E3D;EAAC;IAAAI,CAAA,EA/EKN,qBAAqB;IAAAO,CAAA;MAAAC,IAAA;MAAAC,UAAA,GAIxBlB,QAAQ,CAAC;QAAEmB,IAAI,EAAEC,OAAO;QAAEC,OAAO,EAAE;MAAK,CAAC,CAAC;MAAAC,GAAA;MAAAC,MAAA;QAAA,OAChC,KAAK;MAAA;IAAA;MAAAN,IAAA;MAAAC,UAAA,GAOflB,QAAQ,CAAC;QAAEmB,IAAI,EAAEC,OAAO;QAAEC,OAAO,EAAE,IAAI;QAAEG,SAAS,EAA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AMC,UAAU,GAAGF,GAAG,CAACG,cAAc,IAAIH,GAAG,CAACG,cAAc,CAACJ,MAAM,CAAC;YACnE,IAAIG,UAAU,EAAE;cACdA,UAAU,CAACE,eAAe,CAAC,QAAQ,EAAE,CAACN,QAAQ,CAAC;YACjD;UACF;QACF;QACA,OAAO,IAAI;MACb;IAAC;MAAApB,IAAA;MAAAK,GAAA;MAAAC,KAAA,EAED,SAAAqB,OAAA,EAAS;QACP,MAAM;UAAEC,QAAQ;UAAER,QAAQ;UAAEC;QAAO,CAAC,GAAG,IAAI;QAC3C,MAAMQ,SAAS,GAAGhD,QAAQ,CAAC;UACzB,CAAE,GAAEU,MAAO,wBAAuB,GAAG,IAAI;UACzC,CAAE,GAAEA,MAAO,8BAA6B,GAAG6B;QAC7C,CAAC,CAAC;QACF,OAAOtC,IAAI,CAAAgD,EAAA,KAAAA,EAAA,GAAAC,CAAA,2LAIEF,SAAS,EACLD,QAAQ,EACJ1C,SAAS,CAACmC,MAAM,CAAC,EACjBlB,OAAO,CAACiB,QAAQ,CAAC,EACnB7B,MAAM;MAG3B;IAAC;MAAAS,IAAA;MAAAgC,MAAA;MAAA3B,GAAA;MAAAC,MAAA;QAAA,OAEelB,MAAM;MAAA;IAAA;EAAA;AAAA,GA9EYD,UAAU,CAACH,UAAU,CAAC;AAiF1D,eAAeQ,qBAAqB"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  *
4
- * Copyright IBM Corp. 2019, 2022
4
+ * Copyright IBM Corp. 2019, 2023
5
5
  *
6
6
  * This source code is licensed under the Apache-2.0 license found in the
7
7
  * LICENSE file in the root directory of this source tree.
@@ -1 +1 @@
1
- {"version":3,"sources":["components/content-switcher/content-switcher.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAiC,UAAU,EAAE,MAAM,aAAa,CAAC;AAGxE,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAG/C,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC;AAmBvD;;;;;;;;GAQG;AACH,cACM,iBAAkB,SAAQ,UAAU;IACxC;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAepB;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM;IAS/D;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,UAAU;IAI7C;;;;OAIG;IACH,SAAS,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,EAAE,aAAa;IAM/C;;;;OAIG;IACH,SAAS,CAAC,8BAA8B,CAAC,IAAI,EAAE,QAAQ;IAsBvD;;;;OAIG;IACH,SAAS,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM;IAarC;;;;OAIG;IACH,SAAS,CAAC,mBAAmB,CAAC,YAAY,EAAE,QAAQ;IAiBpD;;OAEG;IAEH,KAAK,SAAM;IAEX;;OAEG;IAEH,IAAI,wBAAiC;IAErC,YAAY,CAAC,iBAAiB,KAAA;IAU9B;;OAEG;IACH,MAAM,KAAK,YAAY,WAEtB;IAED;;OAEG;IACH,MAAM,KAAK,mBAAmB,WAE7B;IAED;;OAEG;IACH,MAAM,KAAK,oBAAoB,WAE9B;IAED;;;OAGG;IACH,MAAM,KAAK,iBAAiB,WAE3B;IAED;;OAEG;IACH,MAAM,KAAK,WAAW,WAErB;IAED,MAAM;IAWN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,iBAAiB,CAAC","file":"content-switcher.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2022\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, property, customElement, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport { forEach, indexOf } from '../../globals/internal/collection-helpers';\nimport { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE } from './defs';\nimport BXSwitch from './content-switcher-item';\nimport styles from './content-switcher.scss';\n\nexport { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE };\n\nconst { prefix } = settings;\n\n/**\n * @param index The index\n * @param length The length of the array.\n * @returns The new index, adjusting overflow/underflow.\n */\nconst capIndex = (index: number, length: number) => {\n if (index < 0) {\n return length - 1;\n }\n if (index >= length) {\n return 0;\n }\n return index;\n};\n\n/**\n * Content switcher.\n *\n * @element bx-content-switcher\n * @fires bx-content-switcher-beingselected\n * The custom event fired before a content switcher item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n * @fires bx-content-switcher-selected - The custom event fired after a a content switcher item is selected upon a user gesture.\n */\n@customElement(`${prefix}-content-switcher`)\nclass BXContentSwitcher extends LitElement {\n /**\n * Handles `mouseover`/`mouseout` events on `<slot>`.\n *\n * @param event The event.\n */\n private _handleHover({ target, type }: MouseEvent) {\n const { selectorItem } = this.constructor as typeof BXContentSwitcher;\n const items = this.querySelectorAll(selectorItem);\n const index =\n type !== 'mouseover'\n ? -1\n : indexOf(items, (target as Element).closest(selectorItem)!);\n const nextIndex = index < 0 ? index : index + 1;\n forEach(this.querySelectorAll(selectorItem), (elem, i) => {\n // Specifies child `<bx-content-switcher-item>` to hide its divider instead of using CSS,\n // until `:host-context()` gets supported in all major browsers\n (elem as BXSwitch).hideDivider = i === nextIndex;\n });\n }\n\n /**\n * @param currentItem The currently selected item.\n * @param direction The navigation direction.\n * @returns The item to be selected.\n */\n protected _getNextItem(currentItem: BXSwitch, direction: number) {\n const items = this.querySelectorAll(\n (this.constructor as typeof BXContentSwitcher).selectorItemEnabled\n );\n const currentIndex = indexOf(items, currentItem);\n const nextIndex = capIndex(currentIndex + direction, items.length);\n return nextIndex === currentIndex ? null : items[nextIndex];\n }\n\n /**\n * Handles `click` event on the top-level element in the shadow DOM.\n *\n * @param event The event.\n */\n protected _handleClick({ target }: MouseEvent) {\n this._handleUserInitiatedSelectItem(target as BXSwitch);\n }\n\n /**\n * Handles `keydown` event on the top-level element in the shadow DOM.\n *\n * @param event The event.\n */\n protected _handleKeydown({ key }: KeyboardEvent) {\n if (key in NAVIGATION_DIRECTION) {\n this._navigate(NAVIGATION_DIRECTION[key]);\n }\n }\n\n /**\n * Handles user-initiated selection of a content switcher item.\n *\n * @param [item] The content switcher item user wants to select.\n */\n protected _handleUserInitiatedSelectItem(item: BXSwitch) {\n if (!item.disabled && item.value !== this.value) {\n const init = {\n bubbles: true,\n composed: true,\n detail: {\n item,\n },\n };\n const constructor = this.constructor as typeof BXContentSwitcher;\n const beforeSelectEvent = new CustomEvent(constructor.eventBeforeSelect, {\n ...init,\n cancelable: true,\n });\n if (this.dispatchEvent(beforeSelectEvent)) {\n this._selectionDidChange(item);\n const afterSelectEvent = new CustomEvent(constructor.eventSelect, init);\n this.dispatchEvent(afterSelectEvent);\n }\n }\n }\n\n /**\n * Navigates through content switcher items.\n *\n * @param direction `-1` to navigate backward, `1` to navigate forward.\n */\n protected _navigate(direction: number) {\n const { selectorItemSelected } = this\n .constructor as typeof BXContentSwitcher;\n const nextItem = this._getNextItem(\n this.querySelector(selectorItemSelected) as BXSwitch,\n direction\n );\n if (nextItem) {\n this._handleUserInitiatedSelectItem(nextItem as BXSwitch);\n this.requestUpdate();\n }\n }\n\n /**\n * A callback that runs after change in content switcher selection upon user interaction is confirmed.\n *\n * @param itemToSelect A content switcher item.\n */\n protected _selectionDidChange(itemToSelect: BXSwitch) {\n this.value = itemToSelect.value;\n forEach(\n this.querySelectorAll(\n (this.constructor as typeof BXContentSwitcher).selectorItemSelected\n ),\n (item) => {\n (item as BXSwitch).selected = false;\n }\n );\n itemToSelect.selected = true;\n // Waits for rendering with the new state that updates `tabindex`\n Promise.resolve().then(() => {\n itemToSelect.focus();\n });\n }\n\n /**\n * The value of the selected item.\n */\n @property({ reflect: true })\n value = '';\n\n /**\n * Content switcher size.\n */\n @property({ reflect: true })\n size = CONTENT_SWITCHER_SIZE.REGULAR;\n\n shouldUpdate(changedProperties) {\n if (changedProperties.has('value')) {\n const { selectorItem } = this.constructor as typeof BXContentSwitcher;\n forEach(this.querySelectorAll(selectorItem), (elem) => {\n (elem as BXSwitch).selected = (elem as BXSwitch).value === this.value;\n });\n }\n return true;\n }\n\n /**\n * A selector that will return content switcher items.\n */\n static get selectorItem() {\n return `${prefix}-content-switcher-item`;\n }\n\n /**\n * A selector that will return enabled content switcher items.\n */\n static get selectorItemEnabled() {\n return `${prefix}-content-switcher-item:not([disabled])`;\n }\n\n /**\n * A selector that will return selected items.\n */\n static get selectorItemSelected() {\n return `${prefix}-content-switcher-item[selected]`;\n }\n\n /**\n * The name of the custom event fired before a content switcher item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n */\n static get eventBeforeSelect() {\n return `${prefix}-content-switcher-beingselected`;\n }\n\n /**\n * The name of the custom event fired after a a content switcher item is selected upon a user gesture.\n */\n static get eventSelect() {\n return `${prefix}-content-switcher-selected`;\n }\n\n render() {\n const { _handleHover: handleHover, _handleKeydown: handleKeydown } = this;\n return html`\n <slot\n @click=\"${this._handleClick}\"\n @keydown=\"${handleKeydown}\"\n @mouseover=\"${handleHover}\"\n @mouseout=\"${handleHover}\"></slot>\n `;\n }\n\n static styles = styles;\n}\n\nexport default BXContentSwitcher;\n"]}
1
+ {"version":3,"sources":["components/content-switcher/content-switcher.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAkB,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAI/C,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC;AAmBvD;;;;;;;;GAQG;AACH,cACM,iBAAkB,SAAQ,UAAU;IACxC;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAepB;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM;IAS/D;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,UAAU;IAI7C;;;;OAIG;IACH,SAAS,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,EAAE,aAAa;IAM/C;;;;OAIG;IACH,SAAS,CAAC,8BAA8B,CAAC,IAAI,EAAE,QAAQ;IAsBvD;;;;OAIG;IACH,SAAS,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM;IAarC;;;;OAIG;IACH,SAAS,CAAC,mBAAmB,CAAC,YAAY,EAAE,QAAQ;IAiBpD;;OAEG;IAEH,KAAK,SAAM;IAEX;;OAEG;IAEH,IAAI,wBAAiC;IAErC,YAAY,CAAC,iBAAiB,KAAA;IAU9B;;OAEG;IACH,MAAM,KAAK,YAAY,WAEtB;IAED;;OAEG;IACH,MAAM,KAAK,mBAAmB,WAE7B;IAED;;OAEG;IACH,MAAM,KAAK,oBAAoB,WAE9B;IAED;;;OAGG;IACH,MAAM,KAAK,iBAAiB,WAE3B;IAED;;OAEG;IACH,MAAM,KAAK,WAAW,WAErB;IAED,MAAM;IAWN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,iBAAiB,CAAC","file":"content-switcher.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, property, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport { forEach, indexOf } from '../../globals/internal/collection-helpers';\nimport { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE } from './defs';\nimport BXSwitch from './content-switcher-item';\nimport styles from './content-switcher.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nexport { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE };\n\nconst { prefix } = settings;\n\n/**\n * @param index The index\n * @param length The length of the array.\n * @returns The new index, adjusting overflow/underflow.\n */\nconst capIndex = (index: number, length: number) => {\n if (index < 0) {\n return length - 1;\n }\n if (index >= length) {\n return 0;\n }\n return index;\n};\n\n/**\n * Content switcher.\n *\n * @element bx-content-switcher\n * @fires bx-content-switcher-beingselected\n * The custom event fired before a content switcher item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n * @fires bx-content-switcher-selected - The custom event fired after a a content switcher item is selected upon a user gesture.\n */\n@customElement(`${prefix}-content-switcher`)\nclass BXContentSwitcher extends LitElement {\n /**\n * Handles `mouseover`/`mouseout` events on `<slot>`.\n *\n * @param event The event.\n */\n private _handleHover({ target, type }: MouseEvent) {\n const { selectorItem } = this.constructor as typeof BXContentSwitcher;\n const items = this.querySelectorAll(selectorItem);\n const index =\n type !== 'mouseover'\n ? -1\n : indexOf(items, (target as Element).closest(selectorItem)!);\n const nextIndex = index < 0 ? index : index + 1;\n forEach(this.querySelectorAll(selectorItem), (elem, i) => {\n // Specifies child `<bx-content-switcher-item>` to hide its divider instead of using CSS,\n // until `:host-context()` gets supported in all major browsers\n (elem as BXSwitch).hideDivider = i === nextIndex;\n });\n }\n\n /**\n * @param currentItem The currently selected item.\n * @param direction The navigation direction.\n * @returns The item to be selected.\n */\n protected _getNextItem(currentItem: BXSwitch, direction: number) {\n const items = this.querySelectorAll(\n (this.constructor as typeof BXContentSwitcher).selectorItemEnabled\n );\n const currentIndex = indexOf(items, currentItem);\n const nextIndex = capIndex(currentIndex + direction, items.length);\n return nextIndex === currentIndex ? null : items[nextIndex];\n }\n\n /**\n * Handles `click` event on the top-level element in the shadow DOM.\n *\n * @param event The event.\n */\n protected _handleClick({ target }: MouseEvent) {\n this._handleUserInitiatedSelectItem(target as BXSwitch);\n }\n\n /**\n * Handles `keydown` event on the top-level element in the shadow DOM.\n *\n * @param event The event.\n */\n protected _handleKeydown({ key }: KeyboardEvent) {\n if (key in NAVIGATION_DIRECTION) {\n this._navigate(NAVIGATION_DIRECTION[key]);\n }\n }\n\n /**\n * Handles user-initiated selection of a content switcher item.\n *\n * @param [item] The content switcher item user wants to select.\n */\n protected _handleUserInitiatedSelectItem(item: BXSwitch) {\n if (!item.disabled && item.value !== this.value) {\n const init = {\n bubbles: true,\n composed: true,\n detail: {\n item,\n },\n };\n const constructor = this.constructor as typeof BXContentSwitcher;\n const beforeSelectEvent = new CustomEvent(constructor.eventBeforeSelect, {\n ...init,\n cancelable: true,\n });\n if (this.dispatchEvent(beforeSelectEvent)) {\n this._selectionDidChange(item);\n const afterSelectEvent = new CustomEvent(constructor.eventSelect, init);\n this.dispatchEvent(afterSelectEvent);\n }\n }\n }\n\n /**\n * Navigates through content switcher items.\n *\n * @param direction `-1` to navigate backward, `1` to navigate forward.\n */\n protected _navigate(direction: number) {\n const { selectorItemSelected } = this\n .constructor as typeof BXContentSwitcher;\n const nextItem = this._getNextItem(\n this.querySelector(selectorItemSelected) as BXSwitch,\n direction\n );\n if (nextItem) {\n this._handleUserInitiatedSelectItem(nextItem as BXSwitch);\n this.requestUpdate();\n }\n }\n\n /**\n * A callback that runs after change in content switcher selection upon user interaction is confirmed.\n *\n * @param itemToSelect A content switcher item.\n */\n protected _selectionDidChange(itemToSelect: BXSwitch) {\n this.value = itemToSelect.value;\n forEach(\n this.querySelectorAll(\n (this.constructor as typeof BXContentSwitcher).selectorItemSelected\n ),\n (item) => {\n (item as BXSwitch).selected = false;\n }\n );\n itemToSelect.selected = true;\n // Waits for rendering with the new state that updates `tabindex`\n Promise.resolve().then(() => {\n itemToSelect.focus();\n });\n }\n\n /**\n * The value of the selected item.\n */\n @property({ reflect: true })\n value = '';\n\n /**\n * Content switcher size.\n */\n @property({ reflect: true })\n size = CONTENT_SWITCHER_SIZE.REGULAR;\n\n shouldUpdate(changedProperties) {\n if (changedProperties.has('value')) {\n const { selectorItem } = this.constructor as typeof BXContentSwitcher;\n forEach(this.querySelectorAll(selectorItem), (elem) => {\n (elem as BXSwitch).selected = (elem as BXSwitch).value === this.value;\n });\n }\n return true;\n }\n\n /**\n * A selector that will return content switcher items.\n */\n static get selectorItem() {\n return `${prefix}-content-switcher-item`;\n }\n\n /**\n * A selector that will return enabled content switcher items.\n */\n static get selectorItemEnabled() {\n return `${prefix}-content-switcher-item:not([disabled])`;\n }\n\n /**\n * A selector that will return selected items.\n */\n static get selectorItemSelected() {\n return `${prefix}-content-switcher-item[selected]`;\n }\n\n /**\n * The name of the custom event fired before a content switcher item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n */\n static get eventBeforeSelect() {\n return `${prefix}-content-switcher-beingselected`;\n }\n\n /**\n * The name of the custom event fired after a a content switcher item is selected upon a user gesture.\n */\n static get eventSelect() {\n return `${prefix}-content-switcher-selected`;\n }\n\n render() {\n const { _handleHover: handleHover, _handleKeydown: handleKeydown } = this;\n return html`\n <slot\n @click=\"${this._handleClick}\"\n @keydown=\"${handleKeydown}\"\n @mouseover=\"${handleHover}\"\n @mouseout=\"${handleHover}\"></slot>\n `;\n }\n\n static styles = styles;\n}\n\nexport default BXContentSwitcher;\n"]}
@@ -5,17 +5,18 @@ let _ = t => t,
5
5
  /**
6
6
  * @license
7
7
  *
8
- * Copyright IBM Corp. 2019, 2022
8
+ * Copyright IBM Corp. 2019, 2023
9
9
  *
10
10
  * This source code is licensed under the Apache-2.0 license found in the
11
11
  * LICENSE file in the root directory of this source tree.
12
12
  */
13
13
 
14
- import { html, property, customElement, LitElement } from 'lit-element';
14
+ import { html, property, LitElement } from 'lit-element';
15
15
  import settings from 'carbon-components/es/globals/js/settings';
16
16
  import { forEach, indexOf } from '../../globals/internal/collection-helpers';
17
17
  import { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE } from './defs';
18
18
  import styles from "././content-switcher.css.js";
19
+ import { carbonElement as customElement } from '../../globals/decorators/carbon-element';
19
20
  export { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE };
20
21
  const {
21
22
  prefix
@@ -1 +1 @@
1
- {"version":3,"file":"content-switcher.js","names":["html","property","customElement","LitElement","settings","forEach","indexOf","NAVIGATION_DIRECTION","CONTENT_SWITCHER_SIZE","styles","prefix","capIndex","index","length","BXContentSwitcher","_decorate","_initialize","_LitElement","constructor","args","F","d","kind","key","value","_handleHover","target","type","selectorItem","items","querySelectorAll","closest","nextIndex","elem","i","hideDivider","_getNextItem","currentItem","direction","selectorItemEnabled","currentIndex","_handleClick","_handleUserInitiatedSelectItem","_handleKeydown","_navigate","item","disabled","init","bubbles","composed","detail","beforeSelectEvent","CustomEvent","eventBeforeSelect","_objectSpread","cancelable","dispatchEvent","_selectionDidChange","afterSelectEvent","eventSelect","selectorItemSelected","nextItem","querySelector","requestUpdate","itemToSelect","selected","Promise","resolve","then","focus","decorators","reflect","REGULAR","shouldUpdate","changedProperties","has","static","render","handleHover","handleKeydown","_t","_"],"sources":["components/content-switcher/content-switcher.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2022\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, property, customElement, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport { forEach, indexOf } from '../../globals/internal/collection-helpers';\nimport { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE } from './defs';\nimport BXSwitch from './content-switcher-item';\nimport styles from './content-switcher.scss';\n\nexport { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE };\n\nconst { prefix } = settings;\n\n/**\n * @param index The index\n * @param length The length of the array.\n * @returns The new index, adjusting overflow/underflow.\n */\nconst capIndex = (index: number, length: number) => {\n if (index < 0) {\n return length - 1;\n }\n if (index >= length) {\n return 0;\n }\n return index;\n};\n\n/**\n * Content switcher.\n *\n * @element bx-content-switcher\n * @fires bx-content-switcher-beingselected\n * The custom event fired before a content switcher item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n * @fires bx-content-switcher-selected - The custom event fired after a a content switcher item is selected upon a user gesture.\n */\n@customElement(`${prefix}-content-switcher`)\nclass BXContentSwitcher extends LitElement {\n /**\n * Handles `mouseover`/`mouseout` events on `<slot>`.\n *\n * @param event The event.\n */\n private _handleHover({ target, type }: MouseEvent) {\n const { selectorItem } = this.constructor as typeof BXContentSwitcher;\n const items = this.querySelectorAll(selectorItem);\n const index =\n type !== 'mouseover'\n ? -1\n : indexOf(items, (target as Element).closest(selectorItem)!);\n const nextIndex = index < 0 ? index : index + 1;\n forEach(this.querySelectorAll(selectorItem), (elem, i) => {\n // Specifies child `<bx-content-switcher-item>` to hide its divider instead of using CSS,\n // until `:host-context()` gets supported in all major browsers\n (elem as BXSwitch).hideDivider = i === nextIndex;\n });\n }\n\n /**\n * @param currentItem The currently selected item.\n * @param direction The navigation direction.\n * @returns The item to be selected.\n */\n protected _getNextItem(currentItem: BXSwitch, direction: number) {\n const items = this.querySelectorAll(\n (this.constructor as typeof BXContentSwitcher).selectorItemEnabled\n );\n const currentIndex = indexOf(items, currentItem);\n const nextIndex = capIndex(currentIndex + direction, items.length);\n return nextIndex === currentIndex ? null : items[nextIndex];\n }\n\n /**\n * Handles `click` event on the top-level element in the shadow DOM.\n *\n * @param event The event.\n */\n protected _handleClick({ target }: MouseEvent) {\n this._handleUserInitiatedSelectItem(target as BXSwitch);\n }\n\n /**\n * Handles `keydown` event on the top-level element in the shadow DOM.\n *\n * @param event The event.\n */\n protected _handleKeydown({ key }: KeyboardEvent) {\n if (key in NAVIGATION_DIRECTION) {\n this._navigate(NAVIGATION_DIRECTION[key]);\n }\n }\n\n /**\n * Handles user-initiated selection of a content switcher item.\n *\n * @param [item] The content switcher item user wants to select.\n */\n protected _handleUserInitiatedSelectItem(item: BXSwitch) {\n if (!item.disabled && item.value !== this.value) {\n const init = {\n bubbles: true,\n composed: true,\n detail: {\n item,\n },\n };\n const constructor = this.constructor as typeof BXContentSwitcher;\n const beforeSelectEvent = new CustomEvent(constructor.eventBeforeSelect, {\n ...init,\n cancelable: true,\n });\n if (this.dispatchEvent(beforeSelectEvent)) {\n this._selectionDidChange(item);\n const afterSelectEvent = new CustomEvent(constructor.eventSelect, init);\n this.dispatchEvent(afterSelectEvent);\n }\n }\n }\n\n /**\n * Navigates through content switcher items.\n *\n * @param direction `-1` to navigate backward, `1` to navigate forward.\n */\n protected _navigate(direction: number) {\n const { selectorItemSelected } = this\n .constructor as typeof BXContentSwitcher;\n const nextItem = this._getNextItem(\n this.querySelector(selectorItemSelected) as BXSwitch,\n direction\n );\n if (nextItem) {\n this._handleUserInitiatedSelectItem(nextItem as BXSwitch);\n this.requestUpdate();\n }\n }\n\n /**\n * A callback that runs after change in content switcher selection upon user interaction is confirmed.\n *\n * @param itemToSelect A content switcher item.\n */\n protected _selectionDidChange(itemToSelect: BXSwitch) {\n this.value = itemToSelect.value;\n forEach(\n this.querySelectorAll(\n (this.constructor as typeof BXContentSwitcher).selectorItemSelected\n ),\n (item) => {\n (item as BXSwitch).selected = false;\n }\n );\n itemToSelect.selected = true;\n // Waits for rendering with the new state that updates `tabindex`\n Promise.resolve().then(() => {\n itemToSelect.focus();\n });\n }\n\n /**\n * The value of the selected item.\n */\n @property({ reflect: true })\n value = '';\n\n /**\n * Content switcher size.\n */\n @property({ reflect: true })\n size = CONTENT_SWITCHER_SIZE.REGULAR;\n\n shouldUpdate(changedProperties) {\n if (changedProperties.has('value')) {\n const { selectorItem } = this.constructor as typeof BXContentSwitcher;\n forEach(this.querySelectorAll(selectorItem), (elem) => {\n (elem as BXSwitch).selected = (elem as BXSwitch).value === this.value;\n });\n }\n return true;\n }\n\n /**\n * A selector that will return content switcher items.\n */\n static get selectorItem() {\n return `${prefix}-content-switcher-item`;\n }\n\n /**\n * A selector that will return enabled content switcher items.\n */\n static get selectorItemEnabled() {\n return `${prefix}-content-switcher-item:not([disabled])`;\n }\n\n /**\n * A selector that will return selected items.\n */\n static get selectorItemSelected() {\n return `${prefix}-content-switcher-item[selected]`;\n }\n\n /**\n * The name of the custom event fired before a content switcher item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n */\n static get eventBeforeSelect() {\n return `${prefix}-content-switcher-beingselected`;\n }\n\n /**\n * The name of the custom event fired after a a content switcher item is selected upon a user gesture.\n */\n static get eventSelect() {\n return `${prefix}-content-switcher-selected`;\n }\n\n render() {\n const { _handleHover: handleHover, _handleKeydown: handleKeydown } = this;\n return html`\n <slot\n @click=\"${this._handleClick}\"\n @keydown=\"${handleKeydown}\"\n @mouseover=\"${handleHover}\"\n @mouseout=\"${handleHover}\"></slot>\n `;\n }\n\n static styles = styles;\n}\n\nexport default BXContentSwitcher;\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,UAAU,QAAQ,aAAa;AACvE,OAAOC,QAAQ,MAAM,0CAA0C;AAC/D,SAASC,OAAO,EAAEC,OAAO,QAAQ,2CAA2C;AAC5E,SAASC,oBAAoB,EAAEC,qBAAqB,QAAQ,QAAQ;AAEpE,OAAOC,MAAM,MAAM,6BAAyB;AAE5C,SAASF,oBAAoB,EAAEC,qBAAqB;AAEpD,MAAM;EAAEE;AAAO,CAAC,GAAGN,QAAQ;;AAE3B;AACA;AACA;AACA;AACA;AACA,MAAMO,QAAQ,GAAGA,CAACC,KAAa,EAAEC,MAAc,KAAK;EAClD,IAAID,KAAK,GAAG,CAAC,EAAE;IACb,OAAOC,MAAM,GAAG,CAAC;EACnB;EACA,IAAID,KAAK,IAAIC,MAAM,EAAE;IACnB,OAAO,CAAC;EACV;EACA,OAAOD,KAAK;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,IAUME,iBAAiB,GAAAC,SAAA,EADtBb,aAAa,CAAE,GAAEQ,MAAO,mBAAkB,CAAC,aAAAM,WAAA,EAAAC,WAAA;EAA5C,MACMH,iBAAiB,SAAAG,WAAA,CAAoB;IAAAC,YAAA,GAAAC,I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E,OAAO/E,IAAI,CAAAgF,EAAA,KAAAA,EAAA,GAAAC,CAAA,qFAEG,IAAI,CAACxC,YAAY,EACfsC,aAAa,EACXD,WAAW,EACZA,WAAW;MAE9B;IAAC;MAAAxD,IAAA;MAAAsD,MAAA;MAAArD,GAAA;MAAAC,MAAA;QAAA,OAEef,MAAM;MAAA;IAAA;EAAA;AAAA,GA/LQN,UAAU;AAkM1C,eAAeW,iBAAiB"}
1
+ {"version":3,"file":"content-switcher.js","names":["html","property","LitElement","settings","forEach","indexOf","NAVIGATION_DIRECTION","CONTENT_SWITCHER_SIZE","styles","carbonElement","customElement","prefix","capIndex","index","length","BXContentSwitcher","_decorate","_initialize","_LitElement","constructor","args","F","d","kind","key","value","_handleHover","target","type","selectorItem","items","querySelectorAll","closest","nextIndex","elem","i","hideDivider","_getNextItem","currentItem","direction","selectorItemEnabled","currentIndex","_handleClick","_handleUserInitiatedSelectItem","_handleKeydown","_navigate","item","disabled","init","bubbles","composed","detail","beforeSelectEvent","CustomEvent","eventBeforeSelect","_objectSpread","cancelable","dispatchEvent","_selectionDidChange","afterSelectEvent","eventSelect","selectorItemSelected","nextItem","querySelector","requestUpdate","itemToSelect","selected","Promise","resolve","then","focus","decorators","reflect","REGULAR","shouldUpdate","changedProperties","has","static","render","handleHover","handleKeydown","_t","_"],"sources":["components/content-switcher/content-switcher.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, property, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport { forEach, indexOf } from '../../globals/internal/collection-helpers';\nimport { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE } from './defs';\nimport BXSwitch from './content-switcher-item';\nimport styles from './content-switcher.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nexport { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE };\n\nconst { prefix } = settings;\n\n/**\n * @param index The index\n * @param length The length of the array.\n * @returns The new index, adjusting overflow/underflow.\n */\nconst capIndex = (index: number, length: number) => {\n if (index < 0) {\n return length - 1;\n }\n if (index >= length) {\n return 0;\n }\n return index;\n};\n\n/**\n * Content switcher.\n *\n * @element bx-content-switcher\n * @fires bx-content-switcher-beingselected\n * The custom event fired before a content switcher item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n * @fires bx-content-switcher-selected - The custom event fired after a a content switcher item is selected upon a user gesture.\n */\n@customElement(`${prefix}-content-switcher`)\nclass BXContentSwitcher extends LitElement {\n /**\n * Handles `mouseover`/`mouseout` events on `<slot>`.\n *\n * @param event The event.\n */\n private _handleHover({ target, type }: MouseEvent) {\n const { selectorItem } = this.constructor as typeof BXContentSwitcher;\n const items = this.querySelectorAll(selectorItem);\n const index =\n type !== 'mouseover'\n ? -1\n : indexOf(items, (target as Element).closest(selectorItem)!);\n const nextIndex = index < 0 ? index : index + 1;\n forEach(this.querySelectorAll(selectorItem), (elem, i) => {\n // Specifies child `<bx-content-switcher-item>` to hide its divider instead of using CSS,\n // until `:host-context()` gets supported in all major browsers\n (elem as BXSwitch).hideDivider = i === nextIndex;\n });\n }\n\n /**\n * @param currentItem The currently selected item.\n * @param direction The navigation direction.\n * @returns The item to be selected.\n */\n protected _getNextItem(currentItem: BXSwitch, direction: number) {\n const items = this.querySelectorAll(\n (this.constructor as typeof BXContentSwitcher).selectorItemEnabled\n );\n const currentIndex = indexOf(items, currentItem);\n const nextIndex = capIndex(currentIndex + direction, items.length);\n return nextIndex === currentIndex ? null : items[nextIndex];\n }\n\n /**\n * Handles `click` event on the top-level element in the shadow DOM.\n *\n * @param event The event.\n */\n protected _handleClick({ target }: MouseEvent) {\n this._handleUserInitiatedSelectItem(target as BXSwitch);\n }\n\n /**\n * Handles `keydown` event on the top-level element in the shadow DOM.\n *\n * @param event The event.\n */\n protected _handleKeydown({ key }: KeyboardEvent) {\n if (key in NAVIGATION_DIRECTION) {\n this._navigate(NAVIGATION_DIRECTION[key]);\n }\n }\n\n /**\n * Handles user-initiated selection of a content switcher item.\n *\n * @param [item] The content switcher item user wants to select.\n */\n protected _handleUserInitiatedSelectItem(item: BXSwitch) {\n if (!item.disabled && item.value !== this.value) {\n const init = {\n bubbles: true,\n composed: true,\n detail: {\n item,\n },\n };\n const constructor = this.constructor as typeof BXContentSwitcher;\n const beforeSelectEvent = new CustomEvent(constructor.eventBeforeSelect, {\n ...init,\n cancelable: true,\n });\n if (this.dispatchEvent(beforeSelectEvent)) {\n this._selectionDidChange(item);\n const afterSelectEvent = new CustomEvent(constructor.eventSelect, init);\n this.dispatchEvent(afterSelectEvent);\n }\n }\n }\n\n /**\n * Navigates through content switcher items.\n *\n * @param direction `-1` to navigate backward, `1` to navigate forward.\n */\n protected _navigate(direction: number) {\n const { selectorItemSelected } = this\n .constructor as typeof BXContentSwitcher;\n const nextItem = this._getNextItem(\n this.querySelector(selectorItemSelected) as BXSwitch,\n direction\n );\n if (nextItem) {\n this._handleUserInitiatedSelectItem(nextItem as BXSwitch);\n this.requestUpdate();\n }\n }\n\n /**\n * A callback that runs after change in content switcher selection upon user interaction is confirmed.\n *\n * @param itemToSelect A content switcher item.\n */\n protected _selectionDidChange(itemToSelect: BXSwitch) {\n this.value = itemToSelect.value;\n forEach(\n this.querySelectorAll(\n (this.constructor as typeof BXContentSwitcher).selectorItemSelected\n ),\n (item) => {\n (item as BXSwitch).selected = false;\n }\n );\n itemToSelect.selected = true;\n // Waits for rendering with the new state that updates `tabindex`\n Promise.resolve().then(() => {\n itemToSelect.focus();\n });\n }\n\n /**\n * The value of the selected item.\n */\n @property({ reflect: true })\n value = '';\n\n /**\n * Content switcher size.\n */\n @property({ reflect: true })\n size = CONTENT_SWITCHER_SIZE.REGULAR;\n\n shouldUpdate(changedProperties) {\n if (changedProperties.has('value')) {\n const { selectorItem } = this.constructor as typeof BXContentSwitcher;\n forEach(this.querySelectorAll(selectorItem), (elem) => {\n (elem as BXSwitch).selected = (elem as BXSwitch).value === this.value;\n });\n }\n return true;\n }\n\n /**\n * A selector that will return content switcher items.\n */\n static get selectorItem() {\n return `${prefix}-content-switcher-item`;\n }\n\n /**\n * A selector that will return enabled content switcher items.\n */\n static get selectorItemEnabled() {\n return `${prefix}-content-switcher-item:not([disabled])`;\n }\n\n /**\n * A selector that will return selected items.\n */\n static get selectorItemSelected() {\n return `${prefix}-content-switcher-item[selected]`;\n }\n\n /**\n * The name of the custom event fired before a content switcher item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n */\n static get eventBeforeSelect() {\n return `${prefix}-content-switcher-beingselected`;\n }\n\n /**\n * The name of the custom event fired after a a content switcher item is selected upon a user gesture.\n */\n static get eventSelect() {\n return `${prefix}-content-switcher-selected`;\n }\n\n render() {\n const { _handleHover: handleHover, _handleKeydown: handleKeydown } = this;\n return html`\n <slot\n @click=\"${this._handleClick}\"\n @keydown=\"${handleKeydown}\"\n @mouseover=\"${handleHover}\"\n @mouseout=\"${handleHover}\"></slot>\n `;\n }\n\n static styles = styles;\n}\n\nexport default BXContentSwitcher;\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,aAAa;AACxD,OAAOC,QAAQ,MAAM,0CAA0C;AAC/D,SAASC,OAAO,EAAEC,OAAO,QAAQ,2CAA2C;AAC5E,SAASC,oBAAoB,EAAEC,qBAAqB,QAAQ,QAAQ;AAEpE,OAAOC,MAAM,MAAM,6BAAyB;AAC5C,SAASC,aAAa,IAAIC,aAAa,QAAQ,yCAAyC;AAExF,SAASJ,oBAAoB,EAAEC,qBAAqB;AAEpD,MAAM;EAAEI;AAAO,CAAC,GAAGR,QAAQ;;AAE3B;AACA;AACA;AACA;AACA;AACA,MAAMS,QAAQ,GAAGA,CAACC,KAAa,EAAEC,MAAc,KAAK;EAClD,IAAID,KAAK,GAAG,CAAC,EA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OAAQ,GAAE3C,MAAO,iCAAgC;MACnD;;MAEA;AACF;AACA;IAFE;MAAAY,IAAA;MAAAsD,MAAA;MAAArD,GAAA;MAAAC,KAAA,EAGA,SAAAmC,YAAA,EAAyB;QACvB,OAAQ,GAAEjD,MAAO,4BAA2B;MAC9C;IAAC;MAAAY,IAAA;MAAAC,GAAA;MAAAC,KAAA,EAED,SAAAqD,OAAA,EAAS;QACP,MAAM;UAAEpD,YAAY,EAAEqD,WAAW;UAAEnC,cAAc,EAAEoC;QAAc,CAAC,GAAG,IAAI;QACzE,OAAOhF,IAAI,CAAAiF,EAAA,KAAAA,EAAA,GAAAC,CAAA,qFAEG,IAAI,CAACxC,YAAY,EACfsC,aAAa,EACXD,WAAW,EACZA,WAAW;MAE9B;IAAC;MAAAxD,IAAA;MAAAsD,MAAA;MAAArD,GAAA;MAAAC,MAAA;QAAA,OAEejB,MAAM;MAAA;IAAA;EAAA;AAAA,GA/LQN,UAAU;AAkM1C,eAAea,iBAAiB"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  *
4
- * Copyright IBM Corp. 2019, 2022
4
+ * Copyright IBM Corp. 2019, 2023
5
5
  *
6
6
  * This source code is licensed under the Apache-2.0 license found in the
7
7
  * LICENSE file in the root directory of this source tree.
@@ -1 +1 @@
1
- {"version":3,"sources":["components/copy-button/copy-button.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAiC,UAAU,EAAE,MAAM,aAAa,CAAC;AAQxE;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,wBAClB;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,eAGvC,MAAM,SAUxB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;mBAUT,MAAM;kBACP,MAAM;;;;uBAID,aAAa;oBAkBjC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF;;;;GAIG;AACH,cACM,YAAa,SAAQ,iBAAsB;IAC/C;;OAEG;IACH,OAAO,CAAC,sBAAsB,CAK5B;IAEF;;OAEG;IACH,OAAO,CAAC,aAAa,CAAS;IAE9B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;IAEH,mBAAmB,SAAuB;IAE1C;;OAEG;IAEH,YAAY,SAAa;IAEzB;;OAEG;IAEH,eAAe,SAAQ;IAEvB,gBAAgB;IAShB,MAAM;IAeN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,YAAY,CAAC","file":"copy-button.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2022\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { classMap } from 'lit-html/directives/class-map';\nimport { TemplateResult } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, property, customElement, LitElement } from 'lit-element';\nimport Copy16 from '@carbon/icons/lib/copy/16';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport FocusMixin from '../../globals/mixins/focus';\nimport styles from './copy-button.scss';\n\nconst { prefix } = settings;\n\n/**\n * Note: For `<bx-code-snippet>` only. The API is subject to change/removal.\n *\n * @param update The callback function that dictates how to update the DOM with new feedback tooltip state.\n * @returns A function that shows the feedback tooltip for the given duration.\n * @private\n */\nexport const _createHandleFeedbackTooltip = (\n update: (properties: { showFeedback?: boolean }) => void\n) => {\n let timeoutId: number | void;\n return (timeout: number) => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n update({ showFeedback: true });\n timeoutId = setTimeout(() => {\n update({ showFeedback: false });\n }, timeout) as unknown as number;\n };\n};\n\n/**\n * Note: For `<bx-code-snippet>` only. The API is subject to change/removal.\n *\n * @param properties The properties to render.\n * @returns The template result for copy button from the given properties.\n * @private\n */\nexport const _renderButton = ({\n assistiveText,\n feedbackText,\n showFeedback = false,\n className = `${prefix}--snippet-button`,\n children = html`\n <slot>${Copy16({ class: `${prefix}--snippet__icon` })}</slot>\n `,\n handleClickButton,\n}: {\n assistiveText: string;\n feedbackText: string;\n showFeedback?: boolean;\n className?: string;\n children?: TemplateResult;\n handleClickButton: EventListener;\n}) => {\n const feedbackClasses = classMap({\n [`${prefix}--btn--copy__feedback`]: true,\n [`${prefix}--btn--copy__feedback--displayed`]: showFeedback,\n });\n return html`\n <button\n type=\"button\"\n class=\"${className}\"\n title=\"${ifDefined(assistiveText)}\"\n @click=\"${handleClickButton}\">\n ${children}\n <div\n class=\"${feedbackClasses}\"\n data-feedback=\"${ifDefined(feedbackText)}\"></div>\n </button>\n `;\n};\n\n/**\n * Copy button.\n *\n * @element bx-copy-button\n */\n@customElement(`${prefix}-copy-button`)\nclass BXCopyButton extends FocusMixin(LitElement) {\n /**\n * Handles showing/hiding the feedback tooltip.\n */\n private _handleFeedbackTooltip = _createHandleFeedbackTooltip(\n ({ showFeedback = false }: { showFeedback?: boolean }) => {\n this._showFeedback = showFeedback;\n this.requestUpdate();\n }\n );\n\n /**\n * `true` to show the feedback tooltip.\n */\n private _showFeedback = false;\n\n /**\n * Handles `click` event on the copy button.\n */\n private _handleClickButton() {\n this._handleFeedbackTooltip(this.feedbackTimeout);\n }\n\n /**\n * An assistive text for screen reader to announce, telling that the button copies the content to the clipboard.\n */\n @property({ attribute: 'button-assistive-text' })\n buttonAssistiveText = 'Copy to clipboard';\n\n /**\n * The feedback text.\n */\n @property({ attribute: 'feedback-text' })\n feedbackText = 'Copied!';\n\n /**\n * The number in milliseconds to determine how long the tooltip should remain.\n */\n @property({ type: Number, attribute: 'feedback-timeout' })\n feedbackTimeout = 2000;\n\n createRenderRoot() {\n return this.attachShadow({\n mode: 'open',\n delegatesFocus:\n Number((/Safari\\/(\\d+)/.exec(navigator.userAgent) ?? ['', 0])[1]) <=\n 537,\n });\n }\n\n render() {\n const {\n buttonAssistiveText,\n feedbackText,\n _handleClickButton: handleClickButton,\n _showFeedback: showFeedback,\n } = this;\n return _renderButton({\n assistiveText: buttonAssistiveText,\n feedbackText,\n showFeedback,\n handleClickButton,\n });\n }\n\n static styles = styles;\n}\n\nexport default BXCopyButton;\n"]}
1
+ {"version":3,"sources":["components/copy-button/copy-button.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAkB,UAAU,EAAE,MAAM,aAAa,CAAC;AASzD;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,wBAClB;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,eAGvC,MAAM,SAUxB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;mBAUT,MAAM;kBACP,MAAM;;;;uBAID,aAAa;oBAkBjC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF;;;;GAIG;AACH,cACM,YAAa,SAAQ,iBAAsB;IAC/C;;OAEG;IACH,OAAO,CAAC,sBAAsB,CAK5B;IAEF;;OAEG;IACH,OAAO,CAAC,aAAa,CAAS;IAE9B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;IAEH,mBAAmB,SAAuB;IAE1C;;OAEG;IAEH,YAAY,SAAa;IAEzB;;OAEG;IAEH,eAAe,SAAQ;IAEvB,gBAAgB;IAShB,MAAM;IAeN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,YAAY,CAAC","file":"copy-button.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { classMap } from 'lit-html/directives/class-map';\nimport { TemplateResult } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, property, LitElement } from 'lit-element';\nimport Copy16 from '@carbon/icons/lib/copy/16';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport FocusMixin from '../../globals/mixins/focus';\nimport styles from './copy-button.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nconst { prefix } = settings;\n\n/**\n * Note: For `<bx-code-snippet>` only. The API is subject to change/removal.\n *\n * @param update The callback function that dictates how to update the DOM with new feedback tooltip state.\n * @returns A function that shows the feedback tooltip for the given duration.\n * @private\n */\nexport const _createHandleFeedbackTooltip = (\n update: (properties: { showFeedback?: boolean }) => void\n) => {\n let timeoutId: number | void;\n return (timeout: number) => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n update({ showFeedback: true });\n timeoutId = setTimeout(() => {\n update({ showFeedback: false });\n }, timeout) as unknown as number;\n };\n};\n\n/**\n * Note: For `<bx-code-snippet>` only. The API is subject to change/removal.\n *\n * @param properties The properties to render.\n * @returns The template result for copy button from the given properties.\n * @private\n */\nexport const _renderButton = ({\n assistiveText,\n feedbackText,\n showFeedback = false,\n className = `${prefix}--snippet-button`,\n children = html`\n <slot>${Copy16({ class: `${prefix}--snippet__icon` })}</slot>\n `,\n handleClickButton,\n}: {\n assistiveText: string;\n feedbackText: string;\n showFeedback?: boolean;\n className?: string;\n children?: TemplateResult;\n handleClickButton: EventListener;\n}) => {\n const feedbackClasses = classMap({\n [`${prefix}--btn--copy__feedback`]: true,\n [`${prefix}--btn--copy__feedback--displayed`]: showFeedback,\n });\n return html`\n <button\n type=\"button\"\n class=\"${className}\"\n title=\"${ifDefined(assistiveText)}\"\n @click=\"${handleClickButton}\">\n ${children}\n <div\n class=\"${feedbackClasses}\"\n data-feedback=\"${ifDefined(feedbackText)}\"></div>\n </button>\n `;\n};\n\n/**\n * Copy button.\n *\n * @element bx-copy-button\n */\n@customElement(`${prefix}-copy-button`)\nclass BXCopyButton extends FocusMixin(LitElement) {\n /**\n * Handles showing/hiding the feedback tooltip.\n */\n private _handleFeedbackTooltip = _createHandleFeedbackTooltip(\n ({ showFeedback = false }: { showFeedback?: boolean }) => {\n this._showFeedback = showFeedback;\n this.requestUpdate();\n }\n );\n\n /**\n * `true` to show the feedback tooltip.\n */\n private _showFeedback = false;\n\n /**\n * Handles `click` event on the copy button.\n */\n private _handleClickButton() {\n this._handleFeedbackTooltip(this.feedbackTimeout);\n }\n\n /**\n * An assistive text for screen reader to announce, telling that the button copies the content to the clipboard.\n */\n @property({ attribute: 'button-assistive-text' })\n buttonAssistiveText = 'Copy to clipboard';\n\n /**\n * The feedback text.\n */\n @property({ attribute: 'feedback-text' })\n feedbackText = 'Copied!';\n\n /**\n * The number in milliseconds to determine how long the tooltip should remain.\n */\n @property({ type: Number, attribute: 'feedback-timeout' })\n feedbackTimeout = 2000;\n\n createRenderRoot() {\n return this.attachShadow({\n mode: 'open',\n delegatesFocus:\n Number((/Safari\\/(\\d+)/.exec(navigator.userAgent) ?? ['', 0])[1]) <=\n 537,\n });\n }\n\n render() {\n const {\n buttonAssistiveText,\n feedbackText,\n _handleClickButton: handleClickButton,\n _showFeedback: showFeedback,\n } = this;\n return _renderButton({\n assistiveText: buttonAssistiveText,\n feedbackText,\n showFeedback,\n handleClickButton,\n });\n }\n\n static styles = styles;\n}\n\nexport default BXCopyButton;\n"]}
@@ -5,7 +5,7 @@ let _ = t => t,
5
5
  /**
6
6
  * @license
7
7
  *
8
- * Copyright IBM Corp. 2019, 2022
8
+ * Copyright IBM Corp. 2019, 2023
9
9
  *
10
10
  * This source code is licensed under the Apache-2.0 license found in the
11
11
  * LICENSE file in the root directory of this source tree.
@@ -13,11 +13,12 @@ let _ = t => t,
13
13
 
14
14
  import { classMap } from 'lit-html/directives/class-map';
15
15
  import { ifDefined } from 'lit-html/directives/if-defined';
16
- import { html, property, customElement, LitElement } from 'lit-element';
16
+ import { html, property, LitElement } from 'lit-element';
17
17
  import Copy16 from "../../icons/copy/16";
18
18
  import settings from 'carbon-components/es/globals/js/settings';
19
19
  import FocusMixin from '../../globals/mixins/focus';
20
20
  import styles from "././copy-button.css.js";
21
+ import { carbonElement as customElement } from '../../globals/decorators/carbon-element';
21
22
  const {
22
23
  prefix
23
24
  } = settings;
@@ -1 +1 @@
1
- {"version":3,"file":"copy-button.js","names":["classMap","ifDefined","html","property","customElement","LitElement","Copy16","settings","FocusMixin","styles","prefix","_createHandleFeedbackTooltip","update","timeoutId","timeout","clearTimeout","undefined","showFeedback","setTimeout","_renderButton","assistiveText","feedbackText","className","children","_t","_","class","handleClickButton","feedbackClasses","_t2","BXCopyButton","_decorate","_initialize","_FocusMixin","constructor","args","F","d","kind","key","value","_showFeedback","requestUpdate","_handleClickButton","_handleFeedbackTooltip","feedbackTimeout","decorators","attribute","type","Number","createRenderRoot","_exec","attachShadow","mode","delegatesFocus","exec","navigator","userAgent","render","buttonAssistiveText","static"],"sources":["components/copy-button/copy-button.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2022\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { classMap } from 'lit-html/directives/class-map';\nimport { TemplateResult } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, property, customElement, LitElement } from 'lit-element';\nimport Copy16 from '@carbon/icons/lib/copy/16';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport FocusMixin from '../../globals/mixins/focus';\nimport styles from './copy-button.scss';\n\nconst { prefix } = settings;\n\n/**\n * Note: For `<bx-code-snippet>` only. The API is subject to change/removal.\n *\n * @param update The callback function that dictates how to update the DOM with new feedback tooltip state.\n * @returns A function that shows the feedback tooltip for the given duration.\n * @private\n */\nexport const _createHandleFeedbackTooltip = (\n update: (properties: { showFeedback?: boolean }) => void\n) => {\n let timeoutId: number | void;\n return (timeout: number) => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n update({ showFeedback: true });\n timeoutId = setTimeout(() => {\n update({ showFeedback: false });\n }, timeout) as unknown as number;\n };\n};\n\n/**\n * Note: For `<bx-code-snippet>` only. The API is subject to change/removal.\n *\n * @param properties The properties to render.\n * @returns The template result for copy button from the given properties.\n * @private\n */\nexport const _renderButton = ({\n assistiveText,\n feedbackText,\n showFeedback = false,\n className = `${prefix}--snippet-button`,\n children = html`\n <slot>${Copy16({ class: `${prefix}--snippet__icon` })}</slot>\n `,\n handleClickButton,\n}: {\n assistiveText: string;\n feedbackText: string;\n showFeedback?: boolean;\n className?: string;\n children?: TemplateResult;\n handleClickButton: EventListener;\n}) => {\n const feedbackClasses = classMap({\n [`${prefix}--btn--copy__feedback`]: true,\n [`${prefix}--btn--copy__feedback--displayed`]: showFeedback,\n });\n return html`\n <button\n type=\"button\"\n class=\"${className}\"\n title=\"${ifDefined(assistiveText)}\"\n @click=\"${handleClickButton}\">\n ${children}\n <div\n class=\"${feedbackClasses}\"\n data-feedback=\"${ifDefined(feedbackText)}\"></div>\n </button>\n `;\n};\n\n/**\n * Copy button.\n *\n * @element bx-copy-button\n */\n@customElement(`${prefix}-copy-button`)\nclass BXCopyButton extends FocusMixin(LitElement) {\n /**\n * Handles showing/hiding the feedback tooltip.\n */\n private _handleFeedbackTooltip = _createHandleFeedbackTooltip(\n ({ showFeedback = false }: { showFeedback?: boolean }) => {\n this._showFeedback = showFeedback;\n this.requestUpdate();\n }\n );\n\n /**\n * `true` to show the feedback tooltip.\n */\n private _showFeedback = false;\n\n /**\n * Handles `click` event on the copy button.\n */\n private _handleClickButton() {\n this._handleFeedbackTooltip(this.feedbackTimeout);\n }\n\n /**\n * An assistive text for screen reader to announce, telling that the button copies the content to the clipboard.\n */\n @property({ attribute: 'button-assistive-text' })\n buttonAssistiveText = 'Copy to clipboard';\n\n /**\n * The feedback text.\n */\n @property({ attribute: 'feedback-text' })\n feedbackText = 'Copied!';\n\n /**\n * The number in milliseconds to determine how long the tooltip should remain.\n */\n @property({ type: Number, attribute: 'feedback-timeout' })\n feedbackTimeout = 2000;\n\n createRenderRoot() {\n return this.attachShadow({\n mode: 'open',\n delegatesFocus:\n Number((/Safari\\/(\\d+)/.exec(navigator.userAgent) ?? ['', 0])[1]) <=\n 537,\n });\n }\n\n render() {\n const {\n buttonAssistiveText,\n feedbackText,\n _handleClickButton: handleClickButton,\n _showFeedback: showFeedback,\n } = this;\n return _renderButton({\n assistiveText: buttonAssistiveText,\n feedbackText,\n showFeedback,\n handleClickButton,\n });\n }\n\n static styles = styles;\n}\n\nexport default BXCopyButton;\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,+BAA+B;AAExD,SAASC,SAAS,QAAQ,gCAAgC;AAC1D,SAASC,IAAI,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,UAAU,QAAQ,aAAa;AACvE,OAAOC,MAAM,MAAM,qBAA2B;AAC9C,OAAOC,QAAQ,MAAM,0CAA0C;AAC/D,OAAOC,UAAU,MAAM,4BAA4B;AACnD,OAAOC,MAAM,MAAM,wBAAoB;AAEvC,MAA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;MAAAC,GAAA;MAAAC,KAAA;MAVtB;AACF;AACA;MAIE;AACF;AACA;MAIE,SAAAU,iBAAA,EAAmB;QAAA,IAAAC,KAAA;QACjB,OAAO,IAAI,CAACC,YAAY,CAAC;UACvBC,IAAI,EAAE,MAAM;UACZC,cAAc,EACZL,MAAM,CAAC,EAAAE,KAAA,GAAC,eAAe,CAACI,IAAI,CAACC,SAAS,CAACC,SAAS,CAAC,cAAAN,KAAA,cAAAA,KAAA,GAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IACjE;QACJ,CAAC,CAAC;MACJ;IAAC;MAAAb,IAAA;MAAAC,GAAA;MAAAC,KAAA,EAED,SAAAkB,OAAA,EAAS;QACP,MAAM;UACJC,mBAAmB;UACnBtC,YAAY;UACZsB,kBAAkB,EAAEhB,iBAAiB;UACrCc,aAAa,EAAExB;QACjB,CAAC,GAAG,IAAI;QACR,OAAOE,aAAa,CAAC;UACnBC,aAAa,EAAEuC,mBAAmB;UAClCtC,YAAY;UACZJ,YAAY;UACZU;QACF,CAAC,CAAC;MACJ;IAAC;MAAAW,IAAA;MAAAsB,MAAA;MAAArB,GAAA;MAAAC,MAAA;QAAA,OAEe/B,MAAM;MAAA;IAAA;EAAA;AAAA,GAjEGD,UAAU,CAACH,UAAU,CAAC;AAoEjD,eAAeyB,YAAY"}
1
+ {"version":3,"file":"copy-button.js","names":["classMap","ifDefined","html","property","LitElement","Copy16","settings","FocusMixin","styles","carbonElement","customElement","prefix","_createHandleFeedbackTooltip","update","timeoutId","timeout","clearTimeout","undefined","showFeedback","setTimeout","_renderButton","assistiveText","feedbackText","className","children","_t","_","class","handleClickButton","feedbackClasses","_t2","BXCopyButton","_decorate","_initialize","_FocusMixin","constructor","args","F","d","kind","key","value","_showFeedback","requestUpdate","_handleClickButton","_handleFeedbackTooltip","feedbackTimeout","decorators","attribute","type","Number","createRenderRoot","_exec","attachShadow","mode","delegatesFocus","exec","navigator","userAgent","render","buttonAssistiveText","static"],"sources":["components/copy-button/copy-button.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { classMap } from 'lit-html/directives/class-map';\nimport { TemplateResult } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, property, LitElement } from 'lit-element';\nimport Copy16 from '@carbon/icons/lib/copy/16';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport FocusMixin from '../../globals/mixins/focus';\nimport styles from './copy-button.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nconst { prefix } = settings;\n\n/**\n * Note: For `<bx-code-snippet>` only. The API is subject to change/removal.\n *\n * @param update The callback function that dictates how to update the DOM with new feedback tooltip state.\n * @returns A function that shows the feedback tooltip for the given duration.\n * @private\n */\nexport const _createHandleFeedbackTooltip = (\n update: (properties: { showFeedback?: boolean }) => void\n) => {\n let timeoutId: number | void;\n return (timeout: number) => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n update({ showFeedback: true });\n timeoutId = setTimeout(() => {\n update({ showFeedback: false });\n }, timeout) as unknown as number;\n };\n};\n\n/**\n * Note: For `<bx-code-snippet>` only. The API is subject to change/removal.\n *\n * @param properties The properties to render.\n * @returns The template result for copy button from the given properties.\n * @private\n */\nexport const _renderButton = ({\n assistiveText,\n feedbackText,\n showFeedback = false,\n className = `${prefix}--snippet-button`,\n children = html`\n <slot>${Copy16({ class: `${prefix}--snippet__icon` })}</slot>\n `,\n handleClickButton,\n}: {\n assistiveText: string;\n feedbackText: string;\n showFeedback?: boolean;\n className?: string;\n children?: TemplateResult;\n handleClickButton: EventListener;\n}) => {\n const feedbackClasses = classMap({\n [`${prefix}--btn--copy__feedback`]: true,\n [`${prefix}--btn--copy__feedback--displayed`]: showFeedback,\n });\n return html`\n <button\n type=\"button\"\n class=\"${className}\"\n title=\"${ifDefined(assistiveText)}\"\n @click=\"${handleClickButton}\">\n ${children}\n <div\n class=\"${feedbackClasses}\"\n data-feedback=\"${ifDefined(feedbackText)}\"></div>\n </button>\n `;\n};\n\n/**\n * Copy button.\n *\n * @element bx-copy-button\n */\n@customElement(`${prefix}-copy-button`)\nclass BXCopyButton extends FocusMixin(LitElement) {\n /**\n * Handles showing/hiding the feedback tooltip.\n */\n private _handleFeedbackTooltip = _createHandleFeedbackTooltip(\n ({ showFeedback = false }: { showFeedback?: boolean }) => {\n this._showFeedback = showFeedback;\n this.requestUpdate();\n }\n );\n\n /**\n * `true` to show the feedback tooltip.\n */\n private _showFeedback = false;\n\n /**\n * Handles `click` event on the copy button.\n */\n private _handleClickButton() {\n this._handleFeedbackTooltip(this.feedbackTimeout);\n }\n\n /**\n * An assistive text for screen reader to announce, telling that the button copies the content to the clipboard.\n */\n @property({ attribute: 'button-assistive-text' })\n buttonAssistiveText = 'Copy to clipboard';\n\n /**\n * The feedback text.\n */\n @property({ attribute: 'feedback-text' })\n feedbackText = 'Copied!';\n\n /**\n * The number in milliseconds to determine how long the tooltip should remain.\n */\n @property({ type: Number, attribute: 'feedback-timeout' })\n feedbackTimeout = 2000;\n\n createRenderRoot() {\n return this.attachShadow({\n mode: 'open',\n delegatesFocus:\n Number((/Safari\\/(\\d+)/.exec(navigator.userAgent) ?? ['', 0])[1]) <=\n 537,\n });\n }\n\n render() {\n const {\n buttonAssistiveText,\n feedbackText,\n _handleClickButton: handleClickButton,\n _showFeedback: showFeedback,\n } = this;\n return _renderButton({\n assistiveText: buttonAssistiveText,\n feedbackText,\n showFeedback,\n handleClickButton,\n });\n }\n\n static styles = styles;\n}\n\nexport default BXCopyButton;\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,+BAA+B;AAExD,SAASC,SAAS,QAAQ,gCAAgC;AAC1D,SAASC,IAAI,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,aAAa;AACxD,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AAA;MAAAF,IAAA;MAAAQ,UAAA,GAKvB5C,QAAQ,CAAC;QAAE8C,IAAI,EAAEC,MAAM;QAAEF,SAAS,EAAE;MAAmB,CAAC,CAAC;MAAAR,GAAA;MAAAC,MAAA;QAAA,OACxC,IAAI;MAAA;IAAA;MAAAF,IAAA;MAAAC,GAAA;MAAAC,KAAA;MAVtB;AACF;AACA;MAIE;AACF;AACA;MAIE,SAAAU,iBAAA,EAAmB;QAAA,IAAAC,KAAA;QACjB,OAAO,IAAI,CAACC,YAAY,CAAC;UACvBC,IAAI,EAAE,MAAM;UACZC,cAAc,EACZL,MAAM,CAAC,EAAAE,KAAA,GAAC,eAAe,CAACI,IAAI,CAACC,SAAS,CAACC,SAAS,CAAC,cAAAN,KAAA,cAAAA,KAAA,GAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IACjE;QACJ,CAAC,CAAC;MACJ;IAAC;MAAAb,IAAA;MAAAC,GAAA;MAAAC,KAAA,EAED,SAAAkB,OAAA,EAAS;QACP,MAAM;UACJC,mBAAmB;UACnBtC,YAAY;UACZsB,kBAAkB,EAAEhB,iBAAiB;UACrCc,aAAa,EAAExB;QACjB,CAAC,GAAG,IAAI;QACR,OAAOE,aAAa,CAAC;UACnBC,aAAa,EAAEuC,mBAAmB;UAClCtC,YAAY;UACZJ,YAAY;UACZU;QACF,CAAC,CAAC;MACJ;IAAC;MAAAW,IAAA;MAAAsB,MAAA;MAAArB,GAAA;MAAAC,MAAA;QAAA,OAEejC,MAAM;MAAA;IAAA;EAAA;AAAA,GAjEGD,UAAU,CAACH,UAAU,CAAC;AAoEjD,eAAe2B,YAAY"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  *
4
- * Copyright IBM Corp. 2019, 2022
4
+ * Copyright IBM Corp. 2019, 2023
5
5
  *
6
6
  * This source code is licensed under the Apache-2.0 license found in the
7
7
  * LICENSE file in the root directory of this source tree.
@@ -1 +1 @@
1
- {"version":3,"sources":["components/data-table/table-batch-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAiC,UAAU,EAAE,MAAM,aAAa,CAAC;AAMxE;;;;;GAKG;AACH,cACM,mBAAoB,SAAQ,UAAU;IAC1C;;OAEG;IACH,OAAO,CAAC,aAAa;IAOrB;;OAEG;IAEH,MAAM,UAAS;IAEf;;OAEG;IAEH,wBAAwB;;iBAC2B;IAEnD;;;OAGG;IAEH,iBAAiB,SAAK;IAEtB,OAAO,CAAC,iBAAiB,KAAA;IAMzB,MAAM;IAuBN;;OAEG;IACH,MAAM,KAAK,gBAAgB,WAE1B;IAED,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,mBAAmB,CAAC","file":"table-batch-actions.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2022\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, property, customElement, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport styles from './data-table.scss';\n\nconst { prefix } = settings;\n\n/**\n * Table batch actions.\n *\n * @element bx-table-batch-actions\n * @fires bx-table-batch-actions-cancel-clicked - The custom event fired after the Cancel button is clicked.\n */\n@customElement(`${prefix}-table-batch-actions`)\nclass BXTableBatchActions extends LitElement {\n /**\n * Handles `click` event on the Cancel button.\n */\n private _handleCancel() {\n const { eventClickCancel } = this.constructor as typeof BXTableBatchActions;\n this.dispatchEvent(\n new CustomEvent(eventClickCancel, { bubbles: true, composed: true })\n );\n }\n\n /**\n * `true` if this batch actions bar should be active.\n */\n @property({ type: Boolean, reflect: true })\n active = false;\n\n /**\n * The formatter for selected items. Should be changed upon the locale the UI is rendered with.\n */\n @property({ attribute: false })\n formatSelectedItemsCount = ({ count }) =>\n `${count} item${count <= 1 ? '' : 's'} selected`;\n\n /**\n * Numeric representation of the total number of items selected in a table.\n * This number is used to derive the selection message.\n */\n @property({ type: Number, attribute: 'selected-rows-count' })\n selectedRowsCount = 0;\n\n updated(changedProperties) {\n if (changedProperties.has('active')) {\n this.setAttribute('tabindex', `${this.active ? '' : '-1'}`);\n }\n }\n\n render() {\n const {\n formatSelectedItemsCount,\n selectedRowsCount,\n _handleCancel: handleCancel,\n } = this;\n return html`\n <div class=\"${prefix}--batch-summary\">\n <p class=\"${prefix}--batch-summary__para\">\n ${formatSelectedItemsCount({ count: selectedRowsCount })}\n </p>\n </div>\n <div class=\"${prefix}--action-list\">\n <slot></slot>\n <button\n class=\"${prefix}--btn ${prefix}--btn--primary ${prefix}--batch-summary__cancel\"\n @click=${handleCancel}>\n <slot name=\"cancel-button-content\">Cancel</slot>\n </button>\n </div>\n `;\n }\n\n /**\n * The name of the custom event fired after the Cancel button is clicked.\n */\n static get eventClickCancel() {\n return `${prefix}-table-batch-actions-cancel-clicked`;\n }\n\n static styles = styles;\n}\n\nexport default BXTableBatchActions;\n"]}
1
+ {"version":3,"sources":["components/data-table/table-batch-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAkB,UAAU,EAAE,MAAM,aAAa,CAAC;AAOzD;;;;;GAKG;AACH,cACM,mBAAoB,SAAQ,UAAU;IAC1C;;OAEG;IACH,OAAO,CAAC,aAAa;IAOrB;;OAEG;IAEH,MAAM,UAAS;IAEf;;OAEG;IAEH,wBAAwB;;iBAC2B;IAEnD;;;OAGG;IAEH,iBAAiB,SAAK;IAEtB,OAAO,CAAC,iBAAiB,KAAA;IAMzB,MAAM;IAuBN;;OAEG;IACH,MAAM,KAAK,gBAAgB,WAE1B;IAED,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,mBAAmB,CAAC","file":"table-batch-actions.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, property, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport styles from './data-table.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nconst { prefix } = settings;\n\n/**\n * Table batch actions.\n *\n * @element bx-table-batch-actions\n * @fires bx-table-batch-actions-cancel-clicked - The custom event fired after the Cancel button is clicked.\n */\n@customElement(`${prefix}-table-batch-actions`)\nclass BXTableBatchActions extends LitElement {\n /**\n * Handles `click` event on the Cancel button.\n */\n private _handleCancel() {\n const { eventClickCancel } = this.constructor as typeof BXTableBatchActions;\n this.dispatchEvent(\n new CustomEvent(eventClickCancel, { bubbles: true, composed: true })\n );\n }\n\n /**\n * `true` if this batch actions bar should be active.\n */\n @property({ type: Boolean, reflect: true })\n active = false;\n\n /**\n * The formatter for selected items. Should be changed upon the locale the UI is rendered with.\n */\n @property({ attribute: false })\n formatSelectedItemsCount = ({ count }) =>\n `${count} item${count <= 1 ? '' : 's'} selected`;\n\n /**\n * Numeric representation of the total number of items selected in a table.\n * This number is used to derive the selection message.\n */\n @property({ type: Number, attribute: 'selected-rows-count' })\n selectedRowsCount = 0;\n\n updated(changedProperties) {\n if (changedProperties.has('active')) {\n this.setAttribute('tabindex', `${this.active ? '' : '-1'}`);\n }\n }\n\n render() {\n const {\n formatSelectedItemsCount,\n selectedRowsCount,\n _handleCancel: handleCancel,\n } = this;\n return html`\n <div class=\"${prefix}--batch-summary\">\n <p class=\"${prefix}--batch-summary__para\">\n ${formatSelectedItemsCount({ count: selectedRowsCount })}\n </p>\n </div>\n <div class=\"${prefix}--action-list\">\n <slot></slot>\n <button\n class=\"${prefix}--btn ${prefix}--btn--primary ${prefix}--batch-summary__cancel\"\n @click=${handleCancel}>\n <slot name=\"cancel-button-content\">Cancel</slot>\n </button>\n </div>\n `;\n }\n\n /**\n * The name of the custom event fired after the Cancel button is clicked.\n */\n static get eventClickCancel() {\n return `${prefix}-table-batch-actions-cancel-clicked`;\n }\n\n static styles = styles;\n}\n\nexport default BXTableBatchActions;\n"]}
@@ -4,15 +4,16 @@ let _ = t => t,
4
4
  /**
5
5
  * @license
6
6
  *
7
- * Copyright IBM Corp. 2019, 2022
7
+ * Copyright IBM Corp. 2019, 2023
8
8
  *
9
9
  * This source code is licensed under the Apache-2.0 license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
12
 
13
- import { html, property, customElement, LitElement } from 'lit-element';
13
+ import { html, property, LitElement } from 'lit-element';
14
14
  import settings from 'carbon-components/es/globals/js/settings';
15
15
  import styles from "././data-table.css.js";
16
+ import { carbonElement as customElement } from '../../globals/decorators/carbon-element';
16
17
  const {
17
18
  prefix
18
19
  } = settings;
@@ -1 +1 @@
1
- {"version":3,"file":"table-batch-actions.js","names":["html","property","customElement","LitElement","settings","styles","prefix","BXTableBatchActions","_decorate","_initialize","_LitElement","constructor","args","F","d","kind","key","value","_handleCancel","eventClickCancel","dispatchEvent","CustomEvent","bubbles","composed","decorators","type","Boolean","reflect","attribute","count","Number","updated","changedProperties","has","setAttribute","active","render","formatSelectedItemsCount","selectedRowsCount","handleCancel","_t","_","static"],"sources":["components/data-table/table-batch-actions.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2022\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, property, customElement, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport styles from './data-table.scss';\n\nconst { prefix } = settings;\n\n/**\n * Table batch actions.\n *\n * @element bx-table-batch-actions\n * @fires bx-table-batch-actions-cancel-clicked - The custom event fired after the Cancel button is clicked.\n */\n@customElement(`${prefix}-table-batch-actions`)\nclass BXTableBatchActions extends LitElement {\n /**\n * Handles `click` event on the Cancel button.\n */\n private _handleCancel() {\n const { eventClickCancel } = this.constructor as typeof BXTableBatchActions;\n this.dispatchEvent(\n new CustomEvent(eventClickCancel, { bubbles: true, composed: true })\n );\n }\n\n /**\n * `true` if this batch actions bar should be active.\n */\n @property({ type: Boolean, reflect: true })\n active = false;\n\n /**\n * The formatter for selected items. Should be changed upon the locale the UI is rendered with.\n */\n @property({ attribute: false })\n formatSelectedItemsCount = ({ count }) =>\n `${count} item${count <= 1 ? '' : 's'} selected`;\n\n /**\n * Numeric representation of the total number of items selected in a table.\n * This number is used to derive the selection message.\n */\n @property({ type: Number, attribute: 'selected-rows-count' })\n selectedRowsCount = 0;\n\n updated(changedProperties) {\n if (changedProperties.has('active')) {\n this.setAttribute('tabindex', `${this.active ? '' : '-1'}`);\n }\n }\n\n render() {\n const {\n formatSelectedItemsCount,\n selectedRowsCount,\n _handleCancel: handleCancel,\n } = this;\n return html`\n <div class=\"${prefix}--batch-summary\">\n <p class=\"${prefix}--batch-summary__para\">\n ${formatSelectedItemsCount({ count: selectedRowsCount })}\n </p>\n </div>\n <div class=\"${prefix}--action-list\">\n <slot></slot>\n <button\n class=\"${prefix}--btn ${prefix}--btn--primary ${prefix}--batch-summary__cancel\"\n @click=${handleCancel}>\n <slot name=\"cancel-button-content\">Cancel</slot>\n </button>\n </div>\n `;\n }\n\n /**\n * The name of the custom event fired after the Cancel button is clicked.\n */\n static get eventClickCancel() {\n return `${prefix}-table-batch-actions-cancel-clicked`;\n }\n\n static styles = styles;\n}\n\nexport default BXTableBatchActions;\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,UAAU,QAAQ,aAAa;AACvE,OAAOC,QAAQ,MAAM,0CAA0C;AAC/D,OAAOC,MAAM,MAAM,uBAAmB;AAEtC,MAAM;EAAEC;AAAO,CAAC,GAAGF,QAAQ;;AAE3B;AACA;AACA;AACA;AACA;AACA;AALA,IAOMG,mBAAmB,GAAAC,SAAA,EADxBN,aAAa,CAAE,GAAEI,MAAO,sBAAqB,CAAC,aAAAG,WAAA,EAAAC,WAAA;EAA/C,MACMH,mBAAmB,SAAAG,WAAA,CAAoB;IAAAC,YAAA,GAAAC,IAAA;MAAA,SAAAA,IAAA;MAAAH,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ACF;IAAC;MAAApB,IAAA;MAAAC,GAAA;MAAAC,KAAA,EAED,SAAAmB,OAAA,EAAS;QACP,MAAM;UACJC,wBAAwB;UACxBC,iBAAiB;UACjBpB,aAAa,EAAEqB;QACjB,CAAC,GAAG,IAAI;QACR,OAAOvC,IAAI,CAAAwC,EAAA,KAAAA,EAAA,GAAAC,CAAA,uSACKnC,MAAM,EACNA,MAAM,EACd+B,wBAAwB,CAAC;UAAER,KAAK,EAAES;QAAkB,CAAC,CAAC,EAG9ChC,MAAM,EAGPA,MAAM,EAASA,MAAM,EAAkBA,MAAM,EAC7CiC,YAAY;MAK7B;;MAEA;AACF;AACA;IAFE;MAAAxB,IAAA;MAAA2B,MAAA;MAAA1B,GAAA;MAAAC,KAAA,EAGA,SAAAE,iBAAA,EAA8B;QAC5B,OAAQ,GAAEb,MAAO,qCAAoC;MACvD;IAAC;MAAAS,IAAA;MAAA2B,MAAA;MAAA1B,GAAA;MAAAC,MAAA;QAAA,OAEeZ,MAAM;MAAA;IAAA;EAAA;AAAA,GAnEUF,UAAU;AAsE5C,eAAeI,mBAAmB"}
1
+ {"version":3,"file":"table-batch-actions.js","names":["html","property","LitElement","settings","styles","carbonElement","customElement","prefix","BXTableBatchActions","_decorate","_initialize","_LitElement","constructor","args","F","d","kind","key","value","_handleCancel","eventClickCancel","dispatchEvent","CustomEvent","bubbles","composed","decorators","type","Boolean","reflect","attribute","count","Number","updated","changedProperties","has","setAttribute","active","render","formatSelectedItemsCount","selectedRowsCount","handleCancel","_t","_","static"],"sources":["components/data-table/table-batch-actions.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, property, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport styles from './data-table.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nconst { prefix } = settings;\n\n/**\n * Table batch actions.\n *\n * @element bx-table-batch-actions\n * @fires bx-table-batch-actions-cancel-clicked - The custom event fired after the Cancel button is clicked.\n */\n@customElement(`${prefix}-table-batch-actions`)\nclass BXTableBatchActions extends LitElement {\n /**\n * Handles `click` event on the Cancel button.\n */\n private _handleCancel() {\n const { eventClickCancel } = this.constructor as typeof BXTableBatchActions;\n this.dispatchEvent(\n new CustomEvent(eventClickCancel, { bubbles: true, composed: true })\n );\n }\n\n /**\n * `true` if this batch actions bar should be active.\n */\n @property({ type: Boolean, reflect: true })\n active = false;\n\n /**\n * The formatter for selected items. Should be changed upon the locale the UI is rendered with.\n */\n @property({ attribute: false })\n formatSelectedItemsCount = ({ count }) =>\n `${count} item${count <= 1 ? '' : 's'} selected`;\n\n /**\n * Numeric representation of the total number of items selected in a table.\n * This number is used to derive the selection message.\n */\n @property({ type: Number, attribute: 'selected-rows-count' })\n selectedRowsCount = 0;\n\n updated(changedProperties) {\n if (changedProperties.has('active')) {\n this.setAttribute('tabindex', `${this.active ? '' : '-1'}`);\n }\n }\n\n render() {\n const {\n formatSelectedItemsCount,\n selectedRowsCount,\n _handleCancel: handleCancel,\n } = this;\n return html`\n <div class=\"${prefix}--batch-summary\">\n <p class=\"${prefix}--batch-summary__para\">\n ${formatSelectedItemsCount({ count: selectedRowsCount })}\n </p>\n </div>\n <div class=\"${prefix}--action-list\">\n <slot></slot>\n <button\n class=\"${prefix}--btn ${prefix}--btn--primary ${prefix}--batch-summary__cancel\"\n @click=${handleCancel}>\n <slot name=\"cancel-button-content\">Cancel</slot>\n </button>\n </div>\n `;\n }\n\n /**\n * The name of the custom event fired after the Cancel button is clicked.\n */\n static get eventClickCancel() {\n return `${prefix}-table-batch-actions-cancel-clicked`;\n }\n\n static styles = styles;\n}\n\nexport default BXTableBatchActions;\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,aAAa;AACxD,OAAOC,QAAQ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M;QAAEF,SAAS,EAAE;MAAsB,CAAC,CAAC;MAAAZ,GAAA;MAAAC,MAAA;QAAA,OACzC,CAAC;MAAA;IAAA;MAAAF,IAAA;MAAAC,GAAA;MAAAC,KAAA;MAZrB;AACF;AACA;MAKE;AACF;AACA;AACA;MAIE,SAAAc,QAAQC,iBAAiB,EAAE;QACzB,IAAIA,iBAAiB,CAACC,GAAG,CAAC,QAAQ,CAAC,EAAE;UACnC,IAAI,CAACC,YAAY,CAAC,UAAU,EAAG,GAAE,IAAI,CAACC,MAAM,GAAG,EAAE,GAAG,IAAK,EAAC,CAAC;QAC7D;MACF;IAAC;MAAApB,IAAA;MAAAC,GAAA;MAAAC,KAAA,EAED,SAAAmB,OAAA,EAAS;QACP,MAAM;UACJC,wBAAwB;UACxBC,iBAAiB;UACjBpB,aAAa,EAAEqB;QACjB,CAAC,GAAG,IAAI;QACR,OAAOxC,IAAI,CAAAyC,EAAA,KAAAA,EAAA,GAAAC,CAAA,uSACKnC,MAAM,EACNA,MAAM,EACd+B,wBAAwB,CAAC;UAAER,KAAK,EAAES;QAAkB,CAAC,CAAC,EAG9ChC,MAAM,EAGPA,MAAM,EAASA,MAAM,EAAkBA,MAAM,EAC7CiC,YAAY;MAK7B;;MAEA;AACF;AACA;IAFE;MAAAxB,IAAA;MAAA2B,MAAA;MAAA1B,GAAA;MAAAC,KAAA,EAGA,SAAAE,iBAAA,EAA8B;QAC5B,OAAQ,GAAEb,MAAO,qCAAoC;MACvD;IAAC;MAAAS,IAAA;MAAA2B,MAAA;MAAA1B,GAAA;MAAAC,MAAA;QAAA,OAEed,MAAM;MAAA;IAAA;EAAA;AAAA,GAnEUF,UAAU;AAsE5C,eAAeM,mBAAmB"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  *
4
- * Copyright IBM Corp. 2019, 2022
4
+ * Copyright IBM Corp. 2019, 2023
5
5
  *
6
6
  * This source code is licensed under the Apache-2.0 license found in the
7
7
  * LICENSE file in the root directory of this source tree.