@carbon/web-components 2.25.2 → 2.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 (308) hide show
  1. package/custom-elements.json +859 -39
  2. package/dist/16-10c4fb8b.js +8 -2
  3. package/dist/16-4855278a.js +8 -2
  4. package/dist/16-4be295f9.js +8 -2
  5. package/dist/16-65aac4b2.js +81 -0
  6. package/dist/16-6a577b04.js +8 -2
  7. package/dist/16-8449b4fa.js +8 -2
  8. package/dist/16-87933b87.js +8 -2
  9. package/dist/16-b826e67b.js +8 -2
  10. package/dist/16-e32fa89f.js +8 -2
  11. package/dist/16-eeb178ee.js +81 -0
  12. package/dist/16-f4420493.js +8 -2
  13. package/dist/16-fbe09c57.js +8 -2
  14. package/dist/20-68c1a445.js +8 -2
  15. package/dist/20-a9fc419f.js +8 -2
  16. package/dist/accordion.min.js +8 -2
  17. package/dist/ai-label.min.js +9 -3
  18. package/dist/ai-skeleton.min.js +8 -2
  19. package/dist/badge-indicator.min.js +8 -2
  20. package/dist/breadcrumb.min.js +18 -12
  21. package/dist/{button-882e4021.js → button-74696aa8.js} +9 -3
  22. package/dist/{button-set-470bff4f.js → button-set-6c836da5.js} +11 -5
  23. package/dist/{button-skeleton-c0570c01.js → button-skeleton-97434162.js} +20 -14
  24. package/dist/button.min.js +9 -3
  25. package/dist/carbon-element-017b212d.js +8 -2
  26. package/dist/chat-button.min.js +10 -4
  27. package/dist/checkbox-88e7237c.js +8 -2
  28. package/dist/checkbox-skeleton-d396e413.js +8 -2
  29. package/dist/checkbox.min.js +8 -2
  30. package/dist/class-map-e4ba9e2b.js +8 -2
  31. package/dist/code-snippet.min.js +9 -3
  32. package/dist/collection-helpers-8b117611.js +8 -2
  33. package/dist/combo-box.min.js +9 -3
  34. package/dist/content-switcher-item-787ef698.js +8 -2
  35. package/dist/content-switcher.min.js +8 -2
  36. package/dist/{copy-button-17009e29.js → copy-button-6ae3beb9.js} +9 -3
  37. package/dist/copy-button.min.js +9 -3
  38. package/dist/data-table.min.js +8 -2
  39. package/dist/date-picker.min.js +8 -2
  40. package/dist/defs-eaf95cbc.js +8 -2
  41. package/dist/directive-e2d48b9c.js +8 -2
  42. package/dist/{dropdown-item-6995171a.js → dropdown-item-c76d25fb.js} +36 -31
  43. package/dist/dropdown.min.js +9 -3
  44. package/dist/file-uploader.min.js +9 -3
  45. package/dist/floating-menu-381b1978.js +8 -2
  46. package/dist/floating-menu.min.js +8 -2
  47. package/dist/focus-969beaed.js +8 -2
  48. package/dist/form-a750a2ac.js +8 -2
  49. package/dist/form-group.min.js +8 -2
  50. package/dist/form.min.js +8 -2
  51. package/dist/heading.min.js +8 -2
  52. package/dist/host-listener-69c546a1.js +8 -2
  53. package/dist/{icon-button-8b63f6e9.js → icon-button-83bfdd07.js} +10 -4
  54. package/dist/icon-button.min.js +9 -3
  55. package/dist/icon-indicator.min.js +8 -2
  56. package/dist/if-defined-446d5754.js +8 -2
  57. package/dist/if-non-empty-0ab1b89b.js +8 -2
  58. package/dist/inline-loading.min.js +8 -2
  59. package/dist/{layer-f3ead524.js → layer-955eb55a.js} +9 -3
  60. package/dist/layer.min.js +9 -3
  61. package/dist/link-95fb4386.js +8 -2
  62. package/dist/link.min.js +8 -2
  63. package/dist/list.min.js +17 -15
  64. package/dist/loading-8f238aae.js +8 -2
  65. package/dist/loading-icon-502d6837.js +8 -2
  66. package/dist/loading.min.js +8 -2
  67. package/dist/menu.min.js +240 -0
  68. package/dist/{modal-label-54f55140.js → modal-label-fc9d6962.js} +13 -7
  69. package/dist/modal.min.js +9 -3
  70. package/dist/multi-select.min.js +9 -3
  71. package/dist/notification.min.js +9 -3
  72. package/dist/number-input.min.js +8 -2
  73. package/dist/on-8707857f.js +8 -2
  74. package/dist/overflow-menu.min.js +17 -9
  75. package/dist/pagination.min.js +39 -33
  76. package/dist/popover-content-d4ec4412.js +8 -2
  77. package/dist/popover-controller-97c2d68e.js +8 -2
  78. package/dist/popover.min.js +8 -2
  79. package/dist/progress-bar.min.js +8 -2
  80. package/dist/progress-indicator.min.js +8 -2
  81. package/dist/property-4de26c93.js +8 -2
  82. package/dist/query-602de8af.js +8 -2
  83. package/dist/query-assigned-elements-1bd68a6e.js +8 -2
  84. package/dist/radio-button-skeleton-67c6a836.js +8 -2
  85. package/dist/radio-button.min.js +8 -2
  86. package/dist/radio-group-manager-9b128b9b.js +8 -2
  87. package/dist/search-7f28fde3.js +8 -2
  88. package/dist/search.min.js +8 -2
  89. package/dist/select-01725ae4.js +8 -2
  90. package/dist/select.min.js +8 -2
  91. package/dist/settings-a9cb5e4b.js +8 -2
  92. package/dist/shape-indicator.min.js +8 -2
  93. package/dist/shared-enums-562e6b51.js +8 -2
  94. package/dist/side-panel.min.js +9 -3
  95. package/dist/skeleton-icon-60c9d437.js +8 -2
  96. package/dist/skeleton-icon.min.js +8 -2
  97. package/dist/skeleton-placeholder-3f62f258.js +8 -2
  98. package/dist/skeleton-placeholder.min.js +8 -2
  99. package/dist/skeleton-text-a37622a0.js +8 -2
  100. package/dist/skeleton-text.min.js +8 -2
  101. package/dist/skip-to-content.min.js +8 -2
  102. package/dist/slider.min.js +8 -2
  103. package/dist/slug.min.js +9 -3
  104. package/dist/spread-279bf949.js +8 -2
  105. package/dist/stack.min.js +8 -2
  106. package/dist/state-225ff428.js +8 -2
  107. package/dist/structured-list.min.js +8 -2
  108. package/dist/tabs.min.js +8 -2
  109. package/dist/tag.min.js +8 -2
  110. package/dist/tearsheet.min.js +11 -5
  111. package/dist/text-input-a7541a8d.js +8 -2
  112. package/dist/text-input.min.js +8 -2
  113. package/dist/textarea.min.js +8 -2
  114. package/dist/tile.min.js +8 -2
  115. package/dist/time-picker.min.js +158 -0
  116. package/dist/toggle-tip.min.js +8 -2
  117. package/dist/toggle.min.js +8 -2
  118. package/dist/toggletip-383477dd.js +8 -2
  119. package/dist/tooltip-content-3e3b3f8c.js +8 -2
  120. package/dist/tooltip.min.js +8 -2
  121. package/dist/ui-shell.min.js +9 -3
  122. package/dist/validity-45b7794a.js +8 -2
  123. package/es/components/breadcrumb/breadcrumb-item.d.ts +4 -0
  124. package/es/components/breadcrumb/breadcrumb-item.js +16 -1
  125. package/es/components/breadcrumb/breadcrumb-item.js.map +1 -1
  126. package/es/components/breadcrumb/breadcrumb.scss.js +1 -1
  127. package/es/components/button/button-set.d.ts +4 -0
  128. package/es/components/button/button-set.js +18 -1
  129. package/es/components/button/button-set.js.map +1 -1
  130. package/es/components/button/button.scss.js +1 -1
  131. package/es/components/chat-button/chat-button.scss.js +1 -1
  132. package/es/components/icon-button/icon-button.scss.js +1 -1
  133. package/es/components/layer/layer.d.ts +7 -0
  134. package/es/components/layer/layer.js +9 -2
  135. package/es/components/layer/layer.js.map +1 -1
  136. package/es/components/list/list-item.d.ts +0 -11
  137. package/es/components/list/list-item.js +1 -21
  138. package/es/components/list/list-item.js.map +1 -1
  139. package/es/components/list/list.scss.js +1 -1
  140. package/es/components/list/ordered-list.js +1 -1
  141. package/es/components/list/ordered-list.js.map +1 -1
  142. package/es/components/list/unordered-list.d.ts +5 -1
  143. package/es/components/list/unordered-list.js +11 -4
  144. package/es/components/list/unordered-list.js.map +1 -1
  145. package/es/components/menu/defs.d.ts +42 -0
  146. package/es/components/menu/defs.js +54 -0
  147. package/es/components/menu/defs.js.map +1 -0
  148. package/es/components/menu/index.d.ts +14 -0
  149. package/es/components/menu/index.js +14 -0
  150. package/es/components/menu/index.js.map +1 -0
  151. package/es/components/menu/menu-context.d.ts +18 -0
  152. package/es/components/menu/menu-context.js +27 -0
  153. package/es/components/menu/menu-context.js.map +1 -0
  154. package/es/components/menu/menu-item-divider.d.ts +19 -0
  155. package/es/components/menu/menu-item-divider.js +42 -0
  156. package/es/components/menu/menu-item-divider.js.map +1 -0
  157. package/es/components/menu/menu-item-group.d.ts +23 -0
  158. package/es/components/menu/menu-item-group.js +48 -0
  159. package/es/components/menu/menu-item-group.js.map +1 -0
  160. package/es/components/menu/menu-item-radio-group.d.ts +42 -0
  161. package/es/components/menu/menu-item-radio-group.js +104 -0
  162. package/es/components/menu/menu-item-radio-group.js.map +1 -0
  163. package/es/components/menu/menu-item-selectable.d.ts +39 -0
  164. package/es/components/menu/menu-item-selectable.js +98 -0
  165. package/es/components/menu/menu-item-selectable.js.map +1 -0
  166. package/es/components/menu/menu-item.d.ts +771 -0
  167. package/es/components/menu/menu-item.js +309 -0
  168. package/es/components/menu/menu-item.js.map +1 -0
  169. package/es/components/menu/menu-item.scss.js +13 -0
  170. package/es/components/menu/menu-item.scss.js.map +1 -0
  171. package/es/components/menu/menu.d.ts +471 -0
  172. package/es/components/menu/menu.js +469 -0
  173. package/es/components/menu/menu.js.map +1 -0
  174. package/es/components/menu/menu.scss.js +13 -0
  175. package/es/components/menu/menu.scss.js.map +1 -0
  176. package/es/components/overflow-menu/overflow-menu-item.d.ts +9 -0
  177. package/es/components/overflow-menu/overflow-menu-item.js +24 -2
  178. package/es/components/overflow-menu/overflow-menu-item.js.map +1 -1
  179. package/es/components/overflow-menu/overflow-menu.scss.js +1 -1
  180. package/es/components/tag/tag.d.ts +1 -1
  181. package/es/components/tag/tag.js +1 -1
  182. package/es/components/time-picker/defs.d.ts +26 -0
  183. package/es/components/time-picker/defs.js +38 -0
  184. package/es/components/time-picker/defs.js.map +1 -0
  185. package/es/components/time-picker/index.d.ts +10 -0
  186. package/es/components/time-picker/index.js +10 -0
  187. package/es/components/time-picker/index.js.map +1 -0
  188. package/es/components/time-picker/time-picker-select.d.ts +426 -0
  189. package/es/components/time-picker/time-picker-select.js +218 -0
  190. package/es/components/time-picker/time-picker-select.js.map +1 -0
  191. package/es/components/time-picker/time-picker.d.ts +802 -0
  192. package/es/components/time-picker/time-picker.js +288 -0
  193. package/es/components/time-picker/time-picker.js.map +1 -0
  194. package/es/components/time-picker/time-picker.scss.js +13 -0
  195. package/es/components/time-picker/time-picker.scss.js.map +1 -0
  196. package/es/index.d.ts +2 -0
  197. package/es/index.js +2 -0
  198. package/es/index.js.map +1 -1
  199. package/es-custom/components/breadcrumb/breadcrumb-item.d.ts +4 -0
  200. package/es-custom/components/breadcrumb/breadcrumb-item.js +16 -1
  201. package/es-custom/components/breadcrumb/breadcrumb-item.js.map +1 -1
  202. package/es-custom/components/breadcrumb/breadcrumb.scss.js +1 -1
  203. package/es-custom/components/button/button-set.d.ts +4 -0
  204. package/es-custom/components/button/button-set.js +18 -1
  205. package/es-custom/components/button/button-set.js.map +1 -1
  206. package/es-custom/components/button/button.scss.js +1 -1
  207. package/es-custom/components/chat-button/chat-button.scss.js +1 -1
  208. package/es-custom/components/icon-button/icon-button.scss.js +1 -1
  209. package/es-custom/components/layer/layer.d.ts +7 -0
  210. package/es-custom/components/layer/layer.js +9 -2
  211. package/es-custom/components/layer/layer.js.map +1 -1
  212. package/es-custom/components/list/list-item.d.ts +0 -11
  213. package/es-custom/components/list/list-item.js +1 -21
  214. package/es-custom/components/list/list-item.js.map +1 -1
  215. package/es-custom/components/list/list.scss.js +1 -1
  216. package/es-custom/components/list/ordered-list.js +1 -1
  217. package/es-custom/components/list/ordered-list.js.map +1 -1
  218. package/es-custom/components/list/unordered-list.d.ts +5 -1
  219. package/es-custom/components/list/unordered-list.js +11 -4
  220. package/es-custom/components/list/unordered-list.js.map +1 -1
  221. package/es-custom/components/menu/defs.d.ts +42 -0
  222. package/es-custom/components/menu/defs.js +54 -0
  223. package/es-custom/components/menu/defs.js.map +1 -0
  224. package/es-custom/components/menu/index.d.ts +14 -0
  225. package/es-custom/components/menu/index.js +14 -0
  226. package/es-custom/components/menu/index.js.map +1 -0
  227. package/es-custom/components/menu/menu-context.d.ts +18 -0
  228. package/es-custom/components/menu/menu-context.js +27 -0
  229. package/es-custom/components/menu/menu-context.js.map +1 -0
  230. package/es-custom/components/menu/menu-item-divider.d.ts +19 -0
  231. package/es-custom/components/menu/menu-item-divider.js +42 -0
  232. package/es-custom/components/menu/menu-item-divider.js.map +1 -0
  233. package/es-custom/components/menu/menu-item-group.d.ts +23 -0
  234. package/es-custom/components/menu/menu-item-group.js +48 -0
  235. package/es-custom/components/menu/menu-item-group.js.map +1 -0
  236. package/es-custom/components/menu/menu-item-radio-group.d.ts +42 -0
  237. package/es-custom/components/menu/menu-item-radio-group.js +104 -0
  238. package/es-custom/components/menu/menu-item-radio-group.js.map +1 -0
  239. package/es-custom/components/menu/menu-item-selectable.d.ts +39 -0
  240. package/es-custom/components/menu/menu-item-selectable.js +98 -0
  241. package/es-custom/components/menu/menu-item-selectable.js.map +1 -0
  242. package/es-custom/components/menu/menu-item.d.ts +771 -0
  243. package/es-custom/components/menu/menu-item.js +309 -0
  244. package/es-custom/components/menu/menu-item.js.map +1 -0
  245. package/es-custom/components/menu/menu-item.scss.js +13 -0
  246. package/es-custom/components/menu/menu-item.scss.js.map +1 -0
  247. package/es-custom/components/menu/menu.d.ts +471 -0
  248. package/es-custom/components/menu/menu.js +469 -0
  249. package/es-custom/components/menu/menu.js.map +1 -0
  250. package/es-custom/components/menu/menu.scss.js +13 -0
  251. package/es-custom/components/menu/menu.scss.js.map +1 -0
  252. package/es-custom/components/overflow-menu/overflow-menu-item.d.ts +9 -0
  253. package/es-custom/components/overflow-menu/overflow-menu-item.js +24 -2
  254. package/es-custom/components/overflow-menu/overflow-menu-item.js.map +1 -1
  255. package/es-custom/components/overflow-menu/overflow-menu.scss.js +1 -1
  256. package/es-custom/components/tag/tag.d.ts +1 -1
  257. package/es-custom/components/tag/tag.js +1 -1
  258. package/es-custom/components/time-picker/defs.d.ts +26 -0
  259. package/es-custom/components/time-picker/defs.js +38 -0
  260. package/es-custom/components/time-picker/defs.js.map +1 -0
  261. package/es-custom/components/time-picker/index.d.ts +10 -0
  262. package/es-custom/components/time-picker/index.js +10 -0
  263. package/es-custom/components/time-picker/index.js.map +1 -0
  264. package/es-custom/components/time-picker/time-picker-select.d.ts +426 -0
  265. package/es-custom/components/time-picker/time-picker-select.js +218 -0
  266. package/es-custom/components/time-picker/time-picker-select.js.map +1 -0
  267. package/es-custom/components/time-picker/time-picker.d.ts +802 -0
  268. package/es-custom/components/time-picker/time-picker.js +288 -0
  269. package/es-custom/components/time-picker/time-picker.js.map +1 -0
  270. package/es-custom/components/time-picker/time-picker.scss.js +13 -0
  271. package/es-custom/components/time-picker/time-picker.scss.js.map +1 -0
  272. package/es-custom/index.d.ts +2 -0
  273. package/es-custom/index.js +2 -0
  274. package/es-custom/index.js.map +1 -1
  275. package/lib/components/breadcrumb/breadcrumb-item.d.ts +4 -0
  276. package/lib/components/button/button-set.d.ts +4 -0
  277. package/lib/components/layer/layer.d.ts +7 -0
  278. package/lib/components/list/list-item.d.ts +0 -11
  279. package/lib/components/list/unordered-list.d.ts +5 -1
  280. package/lib/components/menu/defs.d.ts +42 -0
  281. package/lib/components/menu/defs.js +56 -0
  282. package/lib/components/menu/defs.js.map +1 -0
  283. package/lib/components/menu/index.d.ts +14 -0
  284. package/lib/components/menu/menu-context.d.ts +18 -0
  285. package/lib/components/menu/menu-item-divider.d.ts +19 -0
  286. package/lib/components/menu/menu-item-group.d.ts +23 -0
  287. package/lib/components/menu/menu-item-radio-group.d.ts +42 -0
  288. package/lib/components/menu/menu-item-selectable.d.ts +39 -0
  289. package/lib/components/menu/menu-item.d.ts +771 -0
  290. package/lib/components/menu/menu.d.ts +471 -0
  291. package/lib/components/overflow-menu/overflow-menu-item.d.ts +9 -0
  292. package/lib/components/tag/tag.d.ts +1 -1
  293. package/lib/components/time-picker/defs.d.ts +26 -0
  294. package/lib/components/time-picker/defs.js +45 -0
  295. package/lib/components/time-picker/defs.js.map +1 -0
  296. package/lib/components/time-picker/index.d.ts +10 -0
  297. package/lib/components/time-picker/time-picker-select.d.ts +426 -0
  298. package/lib/components/time-picker/time-picker.d.ts +802 -0
  299. package/lib/index.d.ts +2 -0
  300. package/package.json +5 -4
  301. package/scss/components/breadcrumb/breadcrumb.scss +5 -0
  302. package/scss/components/button/button.scss +4 -0
  303. package/scss/components/list/list.scss +7 -5
  304. package/scss/components/menu/menu-item.scss +109 -0
  305. package/scss/components/menu/menu-variables.scss +15 -0
  306. package/scss/components/menu/menu.scss +72 -0
  307. package/scss/components/overflow-menu/overflow-menu.scss +69 -14
  308. package/scss/components/time-picker/time-picker.scss +50 -0
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { __decorate } from 'tslib';
9
+ import { LitElement, html } from 'lit';
10
+ import { property } from 'lit/decorators.js';
11
+ import { prefix } from '../../globals/settings.js';
12
+ import styles from './menu-item.scss.js';
13
+ import { carbonElement } from '../../globals/decorators/carbon-element.js';
14
+ import { consume } from '@lit/context';
15
+ import { MenuContext } from './menu-context.js';
16
+
17
+ /**
18
+ * @license
19
+ *
20
+ * Copyright IBM Corp. 2024
21
+ *
22
+ * This source code is licensed under the Apache-2.0 license found in the
23
+ * LICENSE file in the root directory of this source tree.
24
+ */
25
+ /**
26
+ * Menu Item.
27
+ *
28
+ * @element cds-custom-menu-item-radio-group
29
+ */
30
+ let CDSmenuItemRadioGroup = class CDSmenuItemRadioGroup extends LitElement {
31
+ constructor() {
32
+ super(...arguments);
33
+ /**
34
+ * List of items in the radio group.
35
+ */
36
+ this.items = [];
37
+ }
38
+ /**
39
+ * The name of the custom event fired when the selection state changes.
40
+ */
41
+ static get eventOnChange() {
42
+ return `${prefix}-item-changed`;
43
+ }
44
+ firstUpdated() {
45
+ this.context.updateFromChild({ hasSelectableItems: true });
46
+ this.addEventListener(`click`, (e) => {
47
+ this.selectedItem = e.target;
48
+ const init = {
49
+ bubbles: true,
50
+ cancelable: true,
51
+ composed: true,
52
+ detail: {
53
+ triggeredBy: e.target,
54
+ },
55
+ };
56
+ if (this.dispatchEvent(new CustomEvent(this.constructor.eventOnChange, init))) {
57
+ this.dispatchEvent(new CustomEvent(this.constructor.eventOnChange, init));
58
+ }
59
+ });
60
+ }
61
+ updated(_changedProperties) {
62
+ if (_changedProperties.has('selectedItem')) {
63
+ this.querySelectorAll(`${prefix}-menu-item`).forEach((item) => {
64
+ if (item === this.selectedItem) {
65
+ item.setAttribute('aria-checked', 'true');
66
+ }
67
+ else {
68
+ item.setAttribute('aria-checked', 'false');
69
+ }
70
+ });
71
+ }
72
+ }
73
+ render() {
74
+ const { label } = this;
75
+ return html `
76
+ <ul role="group" aria-label="${label}">
77
+ <slot></slot>
78
+ </ul>
79
+ `;
80
+ }
81
+ };
82
+ CDSmenuItemRadioGroup.styles = styles; // `styles` here is a `CSSResult` generated by custom Vite loader
83
+ __decorate([
84
+ consume({ context: MenuContext })
85
+ ], CDSmenuItemRadioGroup.prototype, "context", void 0);
86
+ __decorate([
87
+ property({ type: String })
88
+ ], CDSmenuItemRadioGroup.prototype, "label", void 0);
89
+ __decorate([
90
+ property({ type: Array })
91
+ ], CDSmenuItemRadioGroup.prototype, "items", void 0);
92
+ __decorate([
93
+ property({ type: String, attribute: true })
94
+ ], CDSmenuItemRadioGroup.prototype, "selectedItem", void 0);
95
+ __decorate([
96
+ property()
97
+ ], CDSmenuItemRadioGroup.prototype, "itemToString", void 0);
98
+ CDSmenuItemRadioGroup = __decorate([
99
+ carbonElement(`${prefix}-menu-item-radio-group`)
100
+ ], CDSmenuItemRadioGroup);
101
+ var CDSmenuItemRadioGroup$1 = CDSmenuItemRadioGroup;
102
+
103
+ export { CDSmenuItemRadioGroup$1 as default };
104
+ //# sourceMappingURL=menu-item-radio-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu-item-radio-group.js","sources":["../../../src/components/menu/menu-item-radio-group.ts"],"sourcesContent":[null],"names":["customElement"],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAUH;;;;AAIG;AAEH,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU,CAAA;AAA9C,IAAA,WAAA,GAAA;;AASE;;AAEG;QAEH,IAAK,CAAA,KAAA,GAAG,EAAE,CAAC;KAwEZ;AA3DC;;AAEG;AACH,IA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, 2023
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ import { LitElement } from 'lit';
10
+ /**
11
+ * Menu Item.
12
+ *
13
+ * @element cds-custom-menu-item
14
+ */
15
+ declare class CDSmenuItemSelectable extends LitElement {
16
+ context: any;
17
+ /**
18
+ * Label for the menu item selectable.
19
+ */
20
+ label: any;
21
+ /**
22
+ * Whether the menu item is selected or not.
23
+ */
24
+ selected: boolean;
25
+ /**
26
+ * The name of the custom event fired when the selection state changes.
27
+ */
28
+ static get eventOnChange(): string;
29
+ /**
30
+ * Sets the menu item's icon.
31
+ */
32
+ renderIcon?: () => void;
33
+ shortcut: any;
34
+ _handleClick: (e: any) => void;
35
+ firstUpdated(): void;
36
+ render(): import("lit-html").TemplateResult<1>;
37
+ static styles: any;
38
+ }
39
+ export default CDSmenuItemSelectable;
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { __decorate } from 'tslib';
9
+ import { LitElement, html } from 'lit';
10
+ import { property } from 'lit/decorators.js';
11
+ import { prefix } from '../../globals/settings.js';
12
+ import styles from './menu-item.scss.js';
13
+ import { carbonElement } from '../../globals/decorators/carbon-element.js';
14
+ import { consume } from '@lit/context';
15
+ import { MenuContext } from './menu-context.js';
16
+
17
+ /**
18
+ * @license
19
+ *
20
+ * Copyright IBM Corp. 2019, 2023
21
+ *
22
+ * This source code is licensed under the Apache-2.0 license found in the
23
+ * LICENSE file in the root directory of this source tree.
24
+ */
25
+ /**
26
+ * Menu Item.
27
+ *
28
+ * @element cds-custom-menu-item
29
+ */
30
+ let CDSmenuItemSelectable = class CDSmenuItemSelectable extends LitElement {
31
+ constructor() {
32
+ super(...arguments);
33
+ /**
34
+ * Whether the menu item is selected or not.
35
+ */
36
+ this.selected = false;
37
+ this._handleClick = (e) => {
38
+ this.selected = !this.selected;
39
+ const init = {
40
+ bubbles: true,
41
+ cancelable: true,
42
+ composed: true,
43
+ detail: {
44
+ triggeredBy: e.target,
45
+ },
46
+ };
47
+ if (this.dispatchEvent(new CustomEvent(this.constructor.eventOnChange, init))) {
48
+ this.dispatchEvent(new CustomEvent(this.constructor.eventOnChange, init));
49
+ }
50
+ };
51
+ }
52
+ /**
53
+ * The name of the custom event fired when the selection state changes.
54
+ */
55
+ static get eventOnChange() {
56
+ return `${prefix}-item-changed`;
57
+ }
58
+ firstUpdated() {
59
+ this.context.updateFromChild({ hasSelectableItems: true });
60
+ }
61
+ render() {
62
+ const { label, selected, _handleClick: handleClick } = this;
63
+ return html `
64
+ <cds-custom-menu-item
65
+ label="${label}"
66
+ class="${prefix}--menu-item-selectable--selected"
67
+ role="menuitemcheckbox"
68
+ shortcut=${this.shortcut}
69
+ aria-checked="${selected}"
70
+ @click="${handleClick}">
71
+ <slot slot="render-icon" name="render-icon"></slot>
72
+ </cds-custom-menu-item>
73
+ `;
74
+ }
75
+ };
76
+ CDSmenuItemSelectable.styles = styles; // `styles` here is a `CSSResult` generated by custom Vite loader
77
+ __decorate([
78
+ consume({ context: MenuContext })
79
+ ], CDSmenuItemSelectable.prototype, "context", void 0);
80
+ __decorate([
81
+ property({ type: String })
82
+ ], CDSmenuItemSelectable.prototype, "label", void 0);
83
+ __decorate([
84
+ property({ type: Boolean })
85
+ ], CDSmenuItemSelectable.prototype, "selected", void 0);
86
+ __decorate([
87
+ property()
88
+ ], CDSmenuItemSelectable.prototype, "renderIcon", void 0);
89
+ __decorate([
90
+ property()
91
+ ], CDSmenuItemSelectable.prototype, "shortcut", void 0);
92
+ CDSmenuItemSelectable = __decorate([
93
+ carbonElement(`${prefix}-menu-item-selectable`)
94
+ ], CDSmenuItemSelectable);
95
+ var CDSmenuItemSelectable$1 = CDSmenuItemSelectable;
96
+
97
+ export { CDSmenuItemSelectable$1 as default };
98
+ //# sourceMappingURL=menu-item-selectable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu-item-selectable.js","sources":["../../../src/components/menu/menu-item-selectable.ts"],"sourcesContent":[null],"names":["customElement"],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AASH;;;;AAIG;AAEH,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU,CAAA;AAA9C,IAAA,WAAA,GAAA;;AAQE;;AAEG;QAEH,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AAkBjB,QAAA,IAAA,CAAA,YAAY,GAAG,CAAC,CAAC,KAAI;AACnB,YAAA,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;AAC/B,YAAA,MAAM,IAAI,GAAG;AACX,gBAAA,OAAO,EAAE,IAAI;AACb,gBAAA,UAAU,EAAE,IAAI;AAChB,gBAAA,QAAQ,EAAE,IAAI;AACd,gBAAA,MAAM,EAAE;oBACN,WAAW,EAAE,CAAC,CAAC,MAAM;AACtB,iBAAA;aACF,CAAC;AACF,YAAA,IACE,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CACZ,IAAI,CAAC,WAA4C,CAAC,aAAa,EAChE,IAAI,CACL,CACF,EACD;AACA,gBAAA,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CACZ,IAAI,CAAC,WAA4C,CAAC,aAAa,EAChE,IAAI,CACL,CACF,CAAC;aACH;AACH,SAAC,CAAC;KAqBH;AA9DC;;AAEG;AACH,IAAA,WAAW,aAAa,GAAA;QACtB,OAAO,CAAA,EAAG,MAAM,CAAA,aAAA,CAAe,CAAC;KACjC;IAsCD,YAAY,GAAA;QACV,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;KAC5D;IACD,MAAM,GAAA;QACJ,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;AAE5D,QAAA,OA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