@redvars/peacock 3.8.1 → 3.8.3

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 (501) hide show
  1. package/dist/{BaseInput-14YmcfK7.js → BaseInput-CU1zZYKc.js} +3 -3
  2. package/dist/{BaseInput-14YmcfK7.js.map → BaseInput-CU1zZYKc.js.map} +1 -1
  3. package/dist/ButtonConstants-CahP2_NA.js +4 -0
  4. package/dist/ButtonConstants-CahP2_NA.js.map +1 -0
  5. package/dist/{IndividualComponent-DUINtMGK.js → IndividualComponent-Bdwyrvd6.js} +2 -2
  6. package/dist/{IndividualComponent-DUINtMGK.js.map → IndividualComponent-Bdwyrvd6.js.map} +1 -1
  7. package/dist/{NativeHyperlinkMixin-DrYXyfMQ.js → NativeHyperlinkMixin-D9J4aBTy.js} +4 -30
  8. package/dist/NativeHyperlinkMixin-D9J4aBTy.js.map +1 -0
  9. package/dist/accordion-item.js +338 -0
  10. package/dist/accordion-item.js.map +1 -0
  11. package/dist/accordion.js +159 -0
  12. package/dist/accordion.js.map +1 -0
  13. package/dist/alert.js +190 -0
  14. package/dist/alert.js.map +1 -0
  15. package/dist/app-bar.js +324 -0
  16. package/dist/app-bar.js.map +1 -0
  17. package/dist/assets/components.css +1 -1
  18. package/dist/assets/components.css.map +1 -1
  19. package/dist/assets/styles.css +1 -1
  20. package/dist/assets/styles.css.map +1 -1
  21. package/dist/attachable-controller-CAKVrfcG.js +119 -0
  22. package/dist/attachable-controller-CAKVrfcG.js.map +1 -0
  23. package/dist/avatar.js +114 -0
  24. package/dist/avatar.js.map +1 -0
  25. package/dist/babel-DBsfpl3B.js +18 -0
  26. package/dist/babel-DBsfpl3B.js.map +1 -0
  27. package/dist/badge.js +91 -0
  28. package/dist/badge.js.map +1 -0
  29. package/dist/base-Cl6v8-BZ.js +9 -0
  30. package/dist/base-Cl6v8-BZ.js.map +1 -0
  31. package/dist/bottom-sheet.js +14 -5
  32. package/dist/bottom-sheet.js.map +1 -1
  33. package/dist/breadcrumb-item.js +163 -0
  34. package/dist/breadcrumb-item.js.map +1 -0
  35. package/dist/breadcrumb.js +95 -0
  36. package/dist/breadcrumb.js.map +1 -0
  37. package/dist/button-group.js +87 -137
  38. package/dist/button-group.js.map +1 -1
  39. package/dist/button.js +863 -133
  40. package/dist/button.js.map +1 -1
  41. package/dist/calendar-column-view.js +8 -4
  42. package/dist/calendar-column-view.js.map +1 -1
  43. package/dist/calendar-month-view.js +8 -4
  44. package/dist/calendar-month-view.js.map +1 -1
  45. package/dist/calendar.js +8 -4
  46. package/dist/calendar.js.map +1 -1
  47. package/dist/canvas.js +8 -4
  48. package/dist/canvas.js.map +1 -1
  49. package/dist/card-content.js +1 -1
  50. package/dist/card.js +45 -52
  51. package/dist/card.js.map +1 -1
  52. package/dist/cb-compound-expression.js +6 -2
  53. package/dist/cb-compound-expression.js.map +1 -1
  54. package/dist/cb-divider.js +7 -3
  55. package/dist/cb-divider.js.map +1 -1
  56. package/dist/cb-expression.js +6 -2
  57. package/dist/cb-expression.js.map +1 -1
  58. package/dist/cb-predicate.js +7 -3
  59. package/dist/cb-predicate.js.map +1 -1
  60. package/dist/{chart-bar-cn6rrna-.js → chart-bar-CYoGNXnK.js} +6 -2
  61. package/dist/{chart-bar-cn6rrna-.js.map → chart-bar-CYoGNXnK.js.map} +1 -1
  62. package/dist/chart-bar.js +7 -6
  63. package/dist/chart-bar.js.map +1 -1
  64. package/dist/chart-doughnut.js +8 -3
  65. package/dist/chart-doughnut.js.map +1 -1
  66. package/dist/chart-pie.js +8 -3
  67. package/dist/chart-pie.js.map +1 -1
  68. package/dist/chart-stacked-bar.js +7 -6
  69. package/dist/chart-stacked-bar.js.map +1 -1
  70. package/dist/checkbox.js +526 -0
  71. package/dist/checkbox.js.map +1 -0
  72. package/dist/chip.js +459 -0
  73. package/dist/chip.js.map +1 -0
  74. package/dist/{class-map-YU7g0o3B.js → class-map-DG7CA1et.js} +2 -2
  75. package/dist/{class-map-YU7g0o3B.js.map → class-map-DG7CA1et.js.map} +1 -1
  76. package/dist/clock.js +6 -2
  77. package/dist/clock.js.map +1 -1
  78. package/dist/code-editor.js +45 -30
  79. package/dist/code-editor.js.map +1 -1
  80. package/dist/code-highlighter.js +82 -11216
  81. package/dist/code-highlighter.js.map +1 -1
  82. package/dist/color-picker.js +701 -0
  83. package/dist/color-picker.js.map +1 -0
  84. package/dist/condition-builder.js +5 -1
  85. package/dist/condition-builder.js.map +1 -1
  86. package/dist/container.js +141 -0
  87. package/dist/container.js.map +1 -0
  88. package/dist/custom-elements-jsdocs.json +823 -778
  89. package/dist/custom-elements.json +4067 -2207
  90. package/dist/datasource-B2eRh6Or.js +108 -0
  91. package/dist/datasource-B2eRh6Or.js.map +1 -0
  92. package/dist/dispatch-event-utils-CuEqjlPT.js.map +1 -1
  93. package/dist/divider.js +135 -0
  94. package/dist/divider.js.map +1 -0
  95. package/dist/dropdown-button.js +11 -6
  96. package/dist/dropdown-button.js.map +1 -1
  97. package/dist/element-internals-2CMts_0M.js +290 -0
  98. package/dist/element-internals-2CMts_0M.js.map +1 -0
  99. package/dist/elevation.js +94 -0
  100. package/dist/elevation.js.map +1 -0
  101. package/dist/empty-state.js +194 -0
  102. package/dist/empty-state.js.map +1 -0
  103. package/dist/estree-C2LDzX4U.js +47 -0
  104. package/dist/estree-C2LDzX4U.js.map +1 -0
  105. package/dist/{event-manager-D-QCmUgR.js → event-manager-DTyX2uYD.js} +2 -2
  106. package/dist/{event-manager-D-QCmUgR.js.map → event-manager-DTyX2uYD.js.map} +1 -1
  107. package/dist/fab.js +139 -148
  108. package/dist/fab.js.map +1 -1
  109. package/dist/field.js +461 -0
  110. package/dist/field.js.map +1 -0
  111. package/dist/{popover-DUPmMVWS.js → floating-controller-CnUZnOhK.js} +2 -171
  112. package/dist/floating-controller-CnUZnOhK.js.map +1 -0
  113. package/dist/{flow-designer-node-BWrPuxAR.js → flow-designer-node-DsVwQTac.js} +7 -3
  114. package/dist/{flow-designer-node-BWrPuxAR.js.map → flow-designer-node-DsVwQTac.js.map} +1 -1
  115. package/dist/flow-designer-node.js +3 -3
  116. package/dist/flow-designer.js +19 -12
  117. package/dist/flow-designer.js.map +1 -1
  118. package/dist/focus-ring.js +126 -0
  119. package/dist/focus-ring.js.map +1 -0
  120. package/dist/form-associated-BXADnjOB.js +388 -0
  121. package/dist/form-associated-BXADnjOB.js.map +1 -0
  122. package/dist/html-D22sQuVy.js +27 -0
  123. package/dist/html-D22sQuVy.js.map +1 -0
  124. package/dist/html-editor.js +21 -9
  125. package/dist/html-editor.js.map +1 -1
  126. package/dist/hyperlink-DLvb6MXE.js +98 -0
  127. package/dist/hyperlink-DLvb6MXE.js.map +1 -0
  128. package/dist/icon-button.js +1064 -0
  129. package/dist/icon-button.js.map +1 -0
  130. package/dist/icon.js +170 -0
  131. package/dist/icon.js.map +1 -0
  132. package/dist/if-defined-BXZpRQ4P.js +10 -0
  133. package/dist/if-defined-BXZpRQ4P.js.map +1 -0
  134. package/dist/image.js +201 -0
  135. package/dist/image.js.map +1 -0
  136. package/dist/index-_g_oLekF.js +14095 -0
  137. package/dist/index-_g_oLekF.js.map +1 -0
  138. package/dist/index.js +74 -20
  139. package/dist/index.js.map +1 -1
  140. package/dist/is-dark-mode-DOcaw4Yq.js.map +1 -1
  141. package/dist/is-link-Dk2OV3PM.js +6 -0
  142. package/dist/is-link-Dk2OV3PM.js.map +1 -0
  143. package/dist/item.js +213 -0
  144. package/dist/item.js.map +1 -0
  145. package/dist/link.js +75 -0
  146. package/dist/link.js.map +1 -0
  147. package/dist/list-H0itjRte.js +526 -0
  148. package/dist/list-H0itjRte.js.map +1 -0
  149. package/dist/list.js +14 -0
  150. package/dist/list.js.map +1 -0
  151. package/dist/{peacock-loader.js → loader.js} +87 -22
  152. package/dist/loader.js.map +1 -0
  153. package/dist/menu-item.js +388 -0
  154. package/dist/menu-item.js.map +1 -0
  155. package/dist/menu.js +520 -0
  156. package/dist/menu.js.map +1 -0
  157. package/dist/modal.js +9 -5
  158. package/dist/modal.js.map +1 -1
  159. package/dist/navigation-rail-item.js +400 -0
  160. package/dist/navigation-rail-item.js.map +1 -0
  161. package/dist/navigation-rail.js +219 -0
  162. package/dist/navigation-rail.js.map +1 -0
  163. package/dist/notification-manager.js +8 -4
  164. package/dist/notification-manager.js.map +1 -1
  165. package/dist/notification.js +8 -4
  166. package/dist/notification.js.map +1 -1
  167. package/dist/number-counter.js +7 -3
  168. package/dist/number-counter.js.map +1 -1
  169. package/dist/{observe-slot-change-D8Xg-kSS.js → observe-slot-change-DPxaZrZF.js} +3 -4
  170. package/dist/observe-slot-change-DPxaZrZF.js.map +1 -0
  171. package/dist/option.js +121 -0
  172. package/dist/option.js.map +1 -0
  173. package/dist/pagination.js +255 -0
  174. package/dist/pagination.js.map +1 -0
  175. package/dist/pierre-dark-DFWl0m-C.js +4 -0
  176. package/dist/pierre-dark-DFWl0m-C.js.map +1 -0
  177. package/dist/pierre-light-BEkAPImt.js +4 -0
  178. package/dist/pierre-light-BEkAPImt.js.map +1 -0
  179. package/dist/popover-content.js +7 -3
  180. package/dist/popover-content.js.map +1 -1
  181. package/dist/popover.js +175 -3
  182. package/dist/popover.js.map +1 -1
  183. package/dist/postcss-BhbitHaI.js +64 -0
  184. package/dist/postcss-BhbitHaI.js.map +1 -0
  185. package/dist/{property-1psGvXOq.js → property-B49QQ8pS.js} +2 -2
  186. package/dist/{property-1psGvXOq.js.map → property-B49QQ8pS.js.map} +1 -1
  187. package/dist/query-CHb9Ft_d.js +10 -0
  188. package/dist/query-CHb9Ft_d.js.map +1 -0
  189. package/dist/query-assigned-elements-BJaGSqM0.js +10 -0
  190. package/dist/query-assigned-elements-BJaGSqM0.js.map +1 -0
  191. package/dist/radio.js +476 -0
  192. package/dist/radio.js.map +1 -0
  193. package/dist/ripple.js +506 -0
  194. package/dist/ripple.js.map +1 -0
  195. package/dist/search.js +12 -7
  196. package/dist/search.js.map +1 -1
  197. package/dist/segmented-button-group.js +137 -0
  198. package/dist/segmented-button-group.js.map +1 -0
  199. package/dist/segmented-button.js +289 -0
  200. package/dist/segmented-button.js.map +1 -0
  201. package/dist/select-CspawZ18.js +3944 -0
  202. package/dist/select-CspawZ18.js.map +1 -0
  203. package/dist/side-sheet.js +9 -5
  204. package/dist/side-sheet.js.map +1 -1
  205. package/dist/skeleton.js +122 -0
  206. package/dist/skeleton.js.map +1 -0
  207. package/dist/slider.js +346 -0
  208. package/dist/slider.js.map +1 -0
  209. package/dist/snackbar.js +335 -0
  210. package/dist/snackbar.js.map +1 -0
  211. package/dist/spinner.js +100 -0
  212. package/dist/spinner.js.map +1 -0
  213. package/dist/split-button.js +10 -5
  214. package/dist/split-button.js.map +1 -1
  215. package/dist/spread-B5cgadZl.js +32 -0
  216. package/dist/spread-B5cgadZl.js.map +1 -0
  217. package/dist/src/__internal/aria/aria.d.ts +98 -0
  218. package/dist/src/__internal/aria/delegate.d.ts +54 -0
  219. package/dist/src/__internal/events/dispatch-hooks.d.ts +80 -0
  220. package/dist/src/__internal/mixins/element-internals.d.ts +40 -0
  221. package/dist/src/__internal/mixins/form-associated.d.ts +174 -0
  222. package/dist/src/__internal/mixins/form-submitter.d.ts +59 -0
  223. package/dist/src/__internal/mixins/hyperlink.d.ts +42 -0
  224. package/dist/src/__internal/mixins/mixin.d.ts +49 -0
  225. package/dist/src/{__utils → __internal/utils}/observe-slot-change.d.ts +1 -0
  226. package/dist/src/accordion/accordion-item.d.ts +3 -1
  227. package/dist/src/accordion/accordion.d.ts +1 -1
  228. package/dist/src/alert/alert.d.ts +43 -0
  229. package/dist/src/alert/index.d.ts +1 -0
  230. package/dist/src/app-bar/app-bar.d.ts +92 -0
  231. package/dist/src/app-bar/index.d.ts +1 -0
  232. package/dist/src/avatar/avatar.d.ts +2 -0
  233. package/dist/src/bottom-sheet/bottom-sheet.d.ts +1 -1
  234. package/dist/src/breadcrumb/breadcrumb-item/breadcrumb-item.d.ts +1 -0
  235. package/dist/src/button/ButtonTypes.d.ts +5 -0
  236. package/dist/src/button/base-button/base-button.d.ts +18 -0
  237. package/dist/src/button/button/button.d.ts +29 -37
  238. package/dist/src/button/button-group/button-group.d.ts +17 -18
  239. package/dist/src/{fab → button/fab}/fab.d.ts +8 -26
  240. package/dist/src/button/icon-button/icon-button.d.ts +20 -27
  241. package/dist/src/button/index.d.ts +1 -0
  242. package/dist/src/calendar/calendar.d.ts +1 -1
  243. package/dist/src/canvas/canvas.d.ts +1 -1
  244. package/dist/src/card/card.d.ts +5 -6
  245. package/dist/src/chart-bar/chart-bar.d.ts +1 -1
  246. package/dist/src/chart-bar/chart-stacked-bar.d.ts +1 -1
  247. package/dist/src/checkbox/checkbox.d.ts +5 -1
  248. package/dist/src/chip/chip/chip.d.ts +9 -8
  249. package/dist/src/code-highlighter/code-highlighter.d.ts +2 -2
  250. package/dist/src/color-picker/color-picker.d.ts +85 -0
  251. package/dist/src/color-picker/index.d.ts +1 -0
  252. package/dist/src/container/container.d.ts +5 -1
  253. package/dist/src/divider/divider.d.ts +2 -0
  254. package/dist/src/empty-state/empty-state.d.ts +1 -0
  255. package/dist/src/field/field.d.ts +19 -1
  256. package/dist/src/focus-ring/focus-ring.d.ts +3 -7
  257. package/dist/src/html-editor/html-editor.d.ts +1 -1
  258. package/dist/src/icon/icon.d.ts +9 -4
  259. package/dist/src/image/image.d.ts +4 -0
  260. package/dist/src/index.d.ts +8 -6
  261. package/dist/src/item/item.d.ts +19 -29
  262. package/dist/src/link/link.d.ts +1 -1
  263. package/dist/src/list/list-item.d.ts +10 -6
  264. package/dist/src/list/list.d.ts +27 -2
  265. package/dist/src/menu/menu/menu.d.ts +14 -0
  266. package/dist/src/menu/menu-item/menu-item.d.ts +11 -4
  267. package/dist/src/modal/modal.d.ts +1 -1
  268. package/dist/src/navigation-rail/navigation-rail-item.d.ts +5 -4
  269. package/dist/src/navigation-rail/navigation-rail.d.ts +1 -1
  270. package/dist/src/radio/radio.d.ts +5 -0
  271. package/dist/src/ripple/ripple.d.ts +10 -1
  272. package/dist/src/search/search.d.ts +1 -1
  273. package/dist/src/segmented-button/segmented-button-group.d.ts +2 -2
  274. package/dist/src/segmented-button/segmented-button.d.ts +2 -0
  275. package/dist/src/side-sheet/side-sheet.d.ts +1 -1
  276. package/dist/src/skeleton/skeleton.d.ts +1 -0
  277. package/dist/src/slider/slider.d.ts +1 -0
  278. package/dist/src/snackbar/snackbar.d.ts +12 -2
  279. package/dist/src/svg/svg.d.ts +5 -0
  280. package/dist/src/table/table.d.ts +5 -0
  281. package/dist/src/tabs/tab.d.ts +2 -7
  282. package/dist/src/toolbar/toolbar.d.ts +2 -2
  283. package/dist/standalone-Ccq0tWwA.js +32 -0
  284. package/dist/standalone-Ccq0tWwA.js.map +1 -0
  285. package/dist/{state-DwbEjqVk.js → state-DkTK9EGF.js} +2 -2
  286. package/dist/{state-DwbEjqVk.js.map → state-DkTK9EGF.js.map} +1 -1
  287. package/dist/{style-map-DVmWOuYy.js → style-map-BQD5Et1D.js} +2 -2
  288. package/dist/{style-map-DVmWOuYy.js.map → style-map-BQD5Et1D.js.map} +1 -1
  289. package/dist/sub-menu.js +246 -0
  290. package/dist/sub-menu.js.map +1 -0
  291. package/dist/svg.js +273 -0
  292. package/dist/svg.js.map +1 -0
  293. package/dist/tab-group.js +188 -0
  294. package/dist/tab-group.js.map +1 -0
  295. package/dist/tab-panel.js +61 -0
  296. package/dist/tab-panel.js.map +1 -0
  297. package/dist/tab.js +658 -0
  298. package/dist/tab.js.map +1 -0
  299. package/dist/table.js +620 -0
  300. package/dist/table.js.map +1 -0
  301. package/dist/tabs.js +240 -0
  302. package/dist/tabs.js.map +1 -0
  303. package/dist/throttle-C7ZAPqtu.js +24 -0
  304. package/dist/throttle-C7ZAPqtu.js.map +1 -0
  305. package/dist/toolbar.js +9 -5
  306. package/dist/toolbar.js.map +1 -1
  307. package/dist/tooltip.js +270 -0
  308. package/dist/tooltip.js.map +1 -0
  309. package/dist/tsconfig.tsbuildinfo +1 -1
  310. package/dist/{unsafe-html-BsGUjx94.js → unsafe-html-Ct0N2_UU.js} +2 -2
  311. package/dist/{unsafe-html-BsGUjx94.js.map → unsafe-html-Ct0N2_UU.js.map} +1 -1
  312. package/dist/when-DEJm_QN9.js +9 -0
  313. package/dist/when-DEJm_QN9.js.map +1 -0
  314. package/package.json +4 -2
  315. package/readme.md +4 -4
  316. package/scss/mixin.scss +9 -6
  317. package/src/__internal/aria/aria.ts +293 -0
  318. package/src/__internal/aria/delegate.ts +206 -0
  319. package/src/__internal/events/dispatch-hooks.ts +182 -0
  320. package/src/__internal/mixins/element-internals.ts +73 -0
  321. package/src/__internal/mixins/form-associated.ts +295 -0
  322. package/src/__internal/mixins/form-submitter.ts +133 -0
  323. package/src/__internal/mixins/hyperlink.ts +71 -0
  324. package/src/__internal/mixins/mixin.ts +58 -0
  325. package/src/{__utils → __internal/utils}/observe-slot-change.ts +2 -5
  326. package/src/accordion/accordion-item.ts +6 -2
  327. package/src/accordion/accordion.ts +4 -2
  328. package/src/accordion/demo/index.html +95 -90
  329. package/src/alert/alert.scss +82 -0
  330. package/src/{banner/banner.ts → alert/alert.ts} +22 -22
  331. package/src/alert/index.ts +1 -0
  332. package/src/app-bar/app-bar-colors.scss +17 -0
  333. package/src/app-bar/app-bar.scss +165 -0
  334. package/src/app-bar/app-bar.ts +155 -0
  335. package/src/app-bar/index.ts +1 -0
  336. package/src/avatar/avatar.ts +4 -0
  337. package/src/badge/badge.ts +2 -0
  338. package/src/bottom-sheet/bottom-sheet.ts +8 -2
  339. package/src/breadcrumb/breadcrumb/breadcrumb.ts +2 -0
  340. package/src/breadcrumb/breadcrumb-item/breadcrumb-item.ts +3 -0
  341. package/src/button/ButtonTypes.ts +17 -0
  342. package/src/button/base-button/base-button.ts +85 -0
  343. package/src/button/button/button-base.scss +307 -0
  344. package/src/button/button/button-colors.scss +27 -32
  345. package/src/button/button/button-layers.scss +126 -43
  346. package/src/button/button/button-shapes.scss +73 -0
  347. package/src/button/button/button.scss +12 -286
  348. package/src/button/button/button.ts +174 -194
  349. package/src/button/button-group/button-group.scss +43 -36
  350. package/src/button/button-group/button-group.ts +26 -137
  351. package/src/{fab → button/fab}/fab-colors.scss +0 -10
  352. package/src/button/fab/fab-sizes.scss +37 -0
  353. package/src/button/fab/fab.scss +172 -0
  354. package/src/{fab → button/fab}/fab.ts +69 -109
  355. package/src/button/icon-button/icon-button-sizes.scss +18 -3
  356. package/src/button/icon-button/icon-button.scss +5 -0
  357. package/src/button/icon-button/icon-button.ts +111 -141
  358. package/src/button/index.ts +7 -0
  359. package/src/calendar/calendar.ts +2 -2
  360. package/src/canvas/canvas.ts +2 -2
  361. package/src/card/card.scss +21 -8
  362. package/src/card/card.ts +20 -40
  363. package/src/chart-bar/chart-bar.ts +2 -2
  364. package/src/chart-bar/chart-stacked-bar.ts +2 -2
  365. package/src/checkbox/checkbox.ts +12 -4
  366. package/src/chip/chip/chip.scss +1 -1
  367. package/src/chip/chip/chip.ts +35 -55
  368. package/src/chip/demo/index.html +30 -26
  369. package/src/code-editor/code-editor.ts +68 -58
  370. package/src/code-editor/demo/index.html +32 -27
  371. package/src/code-highlighter/code-highlighter.ts +95 -40
  372. package/src/code-highlighter/demo/index.html +24 -21
  373. package/src/color-picker/color-picker.scss +217 -0
  374. package/src/color-picker/color-picker.ts +478 -0
  375. package/src/color-picker/index.ts +1 -0
  376. package/src/container/container.ts +8 -2
  377. package/src/date-picker/date-picker.ts +2 -3
  378. package/src/divider/divider.ts +5 -1
  379. package/src/dropdown-button/demo/index.html +106 -101
  380. package/src/dropdown-button/dropdown-button.ts +1 -1
  381. package/src/elevation/elevation.ts +2 -0
  382. package/src/empty-state/empty-state.ts +3 -0
  383. package/src/field/field.ts +52 -33
  384. package/src/focus-ring/focus-ring.ts +5 -7
  385. package/src/html-editor/html-editor.ts +28 -16
  386. package/src/icon/datasource.ts +1 -1
  387. package/src/icon/icon.ts +27 -15
  388. package/src/image/image.ts +18 -6
  389. package/src/index.ts +25 -6
  390. package/src/input/input.ts +2 -2
  391. package/src/item/item.scss +127 -161
  392. package/src/item/item.ts +69 -323
  393. package/src/link/link.ts +3 -1
  394. package/src/list/list-item.scss +48 -32
  395. package/src/list/list-item.ts +109 -79
  396. package/src/list/list.scss +1 -13
  397. package/src/list/list.ts +170 -5
  398. package/src/{peacock-loader.ts → loader.ts} +95 -79
  399. package/src/menu/menu/menu.scss +15 -26
  400. package/src/menu/menu/menu.ts +20 -9
  401. package/src/menu/menu-item/menu-item.scss +82 -20
  402. package/src/menu/menu-item/menu-item.ts +85 -46
  403. package/src/menu/sub-menu/sub-menu.scss +5 -1
  404. package/src/menu/sub-menu/sub-menu.ts +3 -0
  405. package/src/modal/modal.ts +2 -2
  406. package/src/navigation-rail/navigation-rail-item.scss +25 -8
  407. package/src/navigation-rail/navigation-rail-item.ts +21 -36
  408. package/src/navigation-rail/navigation-rail.scss +25 -21
  409. package/src/navigation-rail/navigation-rail.ts +4 -2
  410. package/src/number-field/number-field.ts +2 -2
  411. package/src/pagination/pagination.ts +2 -0
  412. package/src/popover/popover.ts +3 -3
  413. package/src/radio/radio.ts +13 -5
  414. package/src/ripple/ripple.ts +14 -1
  415. package/src/search/search.ts +3 -3
  416. package/src/segmented-button/segmented-button-group.ts +8 -4
  417. package/src/segmented-button/segmented-button.ts +4 -0
  418. package/src/select/option.ts +2 -0
  419. package/src/side-sheet/side-sheet.ts +3 -3
  420. package/src/sidebar-menu/sidebar-menu-item.scss +12 -6
  421. package/src/sidebar-menu/sidebar-menu-item.ts +3 -2
  422. package/src/skeleton/skeleton.ts +3 -0
  423. package/src/slider/slider.ts +4 -1
  424. package/src/snackbar/snackbar.ts +40 -25
  425. package/src/spinner/spinner.ts +2 -0
  426. package/src/svg/svg.ts +27 -9
  427. package/src/switch/switch.ts +1 -1
  428. package/src/table/table.ts +16 -3
  429. package/src/tabs/demo/index.html +79 -79
  430. package/src/tabs/tab-group.ts +2 -0
  431. package/src/tabs/tab-panel.ts +2 -0
  432. package/src/tabs/tab.scss +4 -4
  433. package/src/tabs/tab.ts +16 -39
  434. package/src/tabs/tabs.ts +2 -0
  435. package/src/textarea/textarea.ts +2 -2
  436. package/src/time-picker/time-picker.ts +2 -2
  437. package/src/toolbar/toolbar.ts +3 -3
  438. package/src/tooltip/tooltip.ts +14 -8
  439. package/src/url-field/url-field.ts +2 -3
  440. package/dist/ButtonConstants-D06bY4uy.js +0 -114
  441. package/dist/ButtonConstants-D06bY4uy.js.map +0 -1
  442. package/dist/NativeHyperlinkMixin-DrYXyfMQ.js.map +0 -1
  443. package/dist/banner.js +0 -186
  444. package/dist/banner.js.map +0 -1
  445. package/dist/button-colors-D7sJyPy8.js +0 -586
  446. package/dist/button-colors-D7sJyPy8.js.map +0 -1
  447. package/dist/icon-CueRR7wx.js +0 -260
  448. package/dist/icon-CueRR7wx.js.map +0 -1
  449. package/dist/icon-button-CAzYr_qr.js +0 -318
  450. package/dist/icon-button-CAzYr_qr.js.map +0 -1
  451. package/dist/navigation-rail-CM_svs5_.js +0 -14184
  452. package/dist/navigation-rail-CM_svs5_.js.map +0 -1
  453. package/dist/observe-slot-change-D8Xg-kSS.js.map +0 -1
  454. package/dist/peacock-loader.js.map +0 -1
  455. package/dist/popover-DUPmMVWS.js.map +0 -1
  456. package/dist/query-QBcUV-L_.js +0 -15
  457. package/dist/query-QBcUV-L_.js.map +0 -1
  458. package/dist/src/banner/banner.d.ts +0 -43
  459. package/dist/src/banner/index.d.ts +0 -1
  460. package/dist/src/button/GroupButtonInterface.d.ts +0 -4
  461. package/src/banner/banner.scss +0 -82
  462. package/src/banner/index.ts +0 -1
  463. package/src/button/GroupButtonInterface.ts +0 -4
  464. package/src/button/button/only-button.scss +0 -13
  465. package/src/fab/fab-sizes.scss +0 -37
  466. package/src/fab/fab.scss +0 -143
  467. /package/dist/src/{__controllers → __internal/controllers}/attachable-controller.d.ts +0 -0
  468. /package/dist/src/{__controllers → __internal/controllers}/floating-controller.d.ts +0 -0
  469. /package/dist/src/{__directive → __internal/directive}/spread.d.ts +0 -0
  470. /package/dist/src/{__mixins → __internal/mixins}/MixinConstructor.d.ts +0 -0
  471. /package/dist/src/{__mixins → __internal/mixins}/NativeButtonMixin.d.ts +0 -0
  472. /package/dist/src/{__mixins → __internal/mixins}/NativeHyperlinkMixin.d.ts +0 -0
  473. /package/dist/src/{__utils → __internal/utils}/cache-fetch.d.ts +0 -0
  474. /package/dist/src/{__utils → __internal/utils}/copy-to-clipboard.d.ts +0 -0
  475. /package/dist/src/{__utils → __internal/utils}/dispatch-event-utils.d.ts +0 -0
  476. /package/dist/src/{__utils → __internal/utils}/is-dark-mode.d.ts +0 -0
  477. /package/dist/src/{__utils → __internal/utils}/is-in-viewport.d.ts +0 -0
  478. /package/dist/src/{__utils → __internal/utils}/is-link.d.ts +0 -0
  479. /package/dist/src/{__utils → __internal/utils}/observe-theme-change.d.ts +0 -0
  480. /package/dist/src/{__utils → __internal/utils}/sanitize-svg.d.ts +0 -0
  481. /package/dist/src/{__utils → __internal/utils}/throttle.d.ts +0 -0
  482. /package/dist/src/{fab → button/fab}/index.d.ts +0 -0
  483. /package/dist/src/{peacock-loader.d.ts → loader.d.ts} +0 -0
  484. /package/dist/test/{banner.test.d.ts → alert.test.d.ts} +0 -0
  485. /package/src/{__controllers → __internal/controllers}/attachable-controller.ts +0 -0
  486. /package/src/{__controllers → __internal/controllers}/floating-controller.ts +0 -0
  487. /package/src/{__directive → __internal/directive}/spread.ts +0 -0
  488. /package/src/{__mixins → __internal/mixins}/MixinConstructor.ts +0 -0
  489. /package/src/{__mixins → __internal/mixins}/NativeButtonMixin.ts +0 -0
  490. /package/src/{__mixins → __internal/mixins}/NativeHyperlinkMixin.ts +0 -0
  491. /package/src/{__mixins → __internal/mixins}/README.md +0 -0
  492. /package/src/{__utils → __internal/utils}/cache-fetch.ts +0 -0
  493. /package/src/{__utils → __internal/utils}/copy-to-clipboard.ts +0 -0
  494. /package/src/{__utils → __internal/utils}/dispatch-event-utils.ts +0 -0
  495. /package/src/{__utils → __internal/utils}/is-dark-mode.ts +0 -0
  496. /package/src/{__utils → __internal/utils}/is-in-viewport.ts +0 -0
  497. /package/src/{__utils → __internal/utils}/is-link.ts +0 -0
  498. /package/src/{__utils → __internal/utils}/observe-theme-change.ts +0 -0
  499. /package/src/{__utils → __internal/utils}/sanitize-svg.ts +0 -0
  500. /package/src/{__utils → __internal/utils}/throttle.ts +0 -0
  501. /package/src/{fab → button/fab}/index.ts +0 -0
@@ -1,4 +1,4 @@
1
- import { A, E } from './IndividualComponent-DUINtMGK.js';
1
+ import { A, E } from './IndividualComponent-Bdwyrvd6.js';
2
2
  import { e as e$1, i, t } from './directive-ZPhl09Yt.js';
3
3
 
4
4
  /**
@@ -8,4 +8,4 @@ import { e as e$1, i, t } from './directive-ZPhl09Yt.js';
8
8
  */class e extends i{constructor(i){if(super(i),this.it=A,i.type!==t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===A||null==r)return this._t=void 0,this.it=r;if(r===E)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName="unsafeHTML",e.resultType=1;const o=e$1(e);
9
9
 
10
10
  export { e, o };
11
- //# sourceMappingURL=unsafe-html-BsGUjx94.js.map
11
+ //# sourceMappingURL=unsafe-html-Ct0N2_UU.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unsafe-html-BsGUjx94.js","sources":["../node_modules/lit-html/directives/unsafe-html.js"],"sourcesContent":["import{nothing as t,noChange as i}from\"../lit-html.js\";import{directive as r,Directive as s,PartType as n}from\"../directive.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */class e extends s{constructor(i){if(super(i),this.it=t,i.type!==n.CHILD)throw Error(this.constructor.directiveName+\"() can only be used in child bindings\")}render(r){if(r===t||null==r)return this._t=void 0,this.it=r;if(r===i)return r;if(\"string\"!=typeof r)throw Error(this.constructor.directiveName+\"() called with a non-string value\");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName=\"unsafeHTML\",e.resultType=1;const o=r(e);export{e as UnsafeHTMLDirective,o as unsafeHTML};\n//# sourceMappingURL=unsafe-html.js.map\n"],"names":["s","t","n","i","r"],"mappings":";;;AACA;AACA;AACA;AACA;AACA,GAAG,MAAM,CAAC,SAASA,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAACC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAGC,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,uCAAuC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGD,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGE,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,mCAAmC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAM,MAAC,CAAC,CAACC,GAAC,CAAC,CAAC;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"unsafe-html-Ct0N2_UU.js","sources":["../node_modules/lit-html/directives/unsafe-html.js"],"sourcesContent":["import{nothing as t,noChange as i}from\"../lit-html.js\";import{directive as r,Directive as s,PartType as n}from\"../directive.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */class e extends s{constructor(i){if(super(i),this.it=t,i.type!==n.CHILD)throw Error(this.constructor.directiveName+\"() can only be used in child bindings\")}render(r){if(r===t||null==r)return this._t=void 0,this.it=r;if(r===i)return r;if(\"string\"!=typeof r)throw Error(this.constructor.directiveName+\"() called with a non-string value\");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName=\"unsafeHTML\",e.resultType=1;const o=r(e);export{e as UnsafeHTMLDirective,o as unsafeHTML};\n//# sourceMappingURL=unsafe-html.js.map\n"],"names":["s","t","n","i","r"],"mappings":";;;AACA;AACA;AACA;AACA;AACA,GAAG,MAAM,CAAC,SAASA,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAACC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAGC,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,uCAAuC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGD,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGE,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,mCAAmC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAM,MAAC,CAAC,CAACC,GAAC,CAAC,CAAC;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ function n(n,r,t){return n?r(n):t?.(n)}
7
+
8
+ export { n };
9
+ //# sourceMappingURL=when-DEJm_QN9.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when-DEJm_QN9.js","sources":["../node_modules/lit-html/directives/when.js"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nfunction n(n,r,t){return n?r(n):t?.(n)}export{n as when};\n//# sourceMappingURL=when.js.map\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;;;;","x_google_ignoreList":[0]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@redvars/peacock",
3
3
  "description": "The foundation for beautiful user interfaces",
4
4
  "license": "Apache-2.0",
5
- "version": "3.8.1",
5
+ "version": "3.8.3",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
@@ -31,6 +31,7 @@
31
31
  "scripts": {
32
32
  "analyze": "cem analyze --config \"./custom-elements-manifest.config.mjs\" && node bin/typedoc-gen.mjs",
33
33
  "start": "rollup -c && concurrently -k -r \"rollup -c -w\" \"web-dev-server\"",
34
+ "start:for-docs": "rollup -c -w",
34
35
  "build": "npm run build:lit && npm run analyze -- --exclude dist && npm run build:scss",
35
36
  "build:lit": "rollup -c",
36
37
  "build:scss": "node ./bin/scss-build.mjs",
@@ -126,7 +127,8 @@
126
127
  {
127
128
  "ignorePackages": true
128
129
  }
129
- ]
130
+ ],
131
+ "class-methods-use-this": "off"
130
132
  }
131
133
  },
132
134
  "prettier": {
package/readme.md CHANGED
@@ -44,9 +44,9 @@ Visit [https://peacock.redvars.com](https://peacock.redvars.com) to view the doc
44
44
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
45
45
  <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
46
46
 
47
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.8.1/dist/assets/styles.css"></link>
47
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.8.3/dist/assets/styles.css"></link>
48
48
  <script type='module'
49
- src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.8.1/dist/peacock-loader.js'></script>
49
+ src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.8.3/dist/loader.js'></script>
50
50
  </head>
51
51
 
52
52
  <wc-button>Button</wc-button>
@@ -69,7 +69,7 @@ menus, checkboxes, and radio buttons.
69
69
  |---------------------------------------------------------------------|-----------------|-------|
70
70
  | [Checkbox](https://peacock.redvars.com/components/checkbox) | wc-checkbox | 🟢 |
71
71
  | [Code editor](https://peacock.redvars.com/components/code-editor) | wc-code-editor | 🟢 |
72
- | Color picker | color-picker | 🔴 |
72
+ | [Color picker](https://peacock.redvars.com/components/color-picker) | wc-color-picker | 🟡 |
73
73
  | [Date picker](https://peacock.redvars.com/components/date-picker) | wc-date-picker | 🟡 |
74
74
  | Date time picker | datetime-picker | 🔴 |
75
75
  | [Field / Form control](https://peacock.redvars.com/components/field) | wc-field | 🟡 |
@@ -109,7 +109,7 @@ include notifications, tooltips, and progress bars.
109
109
  | Name | Component | State |
110
110
  |-------------------------------------------------------------------------------|----------------------|-------|
111
111
  | [Badge](https://peacock.redvars.com/components/badge) | wc-badge | 🟢 |
112
- | [Banner](https://peacock.redvars.com/components/banner) | wc-banner | 🟡 |
112
+ | [Alert](https://peacock.redvars.com/components/alert) | wc-alert | 🟡 |
113
113
  | [Circular Progress](https://peacock.redvars.com/components/circular-progress) | wc-circular-progress | 🟢 |
114
114
  | [Linear Progress](https://peacock.redvars.com/components/linear-progress) | wc-linear-progress | 🟢 |
115
115
  | [Notification](https://peacock.redvars.com/components/notification) | wc-notification | 🟢 |
package/scss/mixin.scss CHANGED
@@ -6,6 +6,10 @@
6
6
  .screen-reader-only {
7
7
  display: none !important;
8
8
  }
9
+
10
+ [hidden] {
11
+ display: none !important;
12
+ }
9
13
  }
10
14
 
11
15
  @mixin reset-button-styles {
@@ -21,6 +25,7 @@
21
25
  text-decoration: none;
22
26
  color: inherit;
23
27
  cursor: pointer;
28
+ outline: none;
24
29
 
25
30
  &:link,
26
31
  &:visited,
@@ -33,7 +38,7 @@
33
38
 
34
39
  @mixin get-typography($name) {
35
40
  font-family: var(--typography-#{$name}-font-family) !important;
36
- font-size: var(--typography-#{$name}-font-size) !important;
41
+ font-size: var(--typography-#{$name}-font-size) !important;
37
42
  font-weight: var(--typography-#{$name}-font-weight) !important;
38
43
  line-height: var(--typography-#{$name}-line-height) !important;
39
44
  letter-spacing: var(--typography-#{$name}-letter-spacing) !important;
@@ -41,13 +46,13 @@
41
46
 
42
47
  @mixin get-typography-not-important($name) {
43
48
  font-family: var(--typography-#{$name}-font-family);
44
- font-size: var(--typography-#{$name}-font-size);
49
+ font-size: var(--typography-#{$name}-font-size);
45
50
  font-weight: var(--typography-#{$name}-font-weight);
46
51
  line-height: var(--typography-#{$name}-line-height);
47
52
  letter-spacing: var(--typography-#{$name}-letter-spacing);
48
53
  }
49
54
 
50
- @mixin focus-ring($color:var(--color-black)) {
55
+ @mixin focus-ring($color: var(--color-black)) {
51
56
  outline: 2px solid $color;
52
57
  }
53
58
 
@@ -81,13 +86,11 @@
81
86
  }
82
87
  }
83
88
 
84
-
85
89
  // Layers
86
90
  @mixin layer-background {
87
-
88
91
  }
89
92
 
90
- // NOTE: `apply-container-shape` and `copy-container-shape` were removed.
93
+ // NOTE: `apply-container-shape` and `copy-container-shape` were removed.
91
94
  // These helpers previously copied container-shape custom properties and
92
95
  // applied them as physical border radii. They are intentionally deleted
93
96
  // because the loader now manages container shape via CSS custom properties
@@ -0,0 +1,293 @@
1
+ /**
2
+ * Accessibility Object Model reflective aria property name types.
3
+ */
4
+ // eslint-disable-next-line no-undef
5
+ export type ARIAProperty = keyof ARIAMixin;
6
+
7
+ /**
8
+ * Accessibility Object Model reflective aria properties.
9
+ */
10
+ export const ARIA_PROPERTIES: ARIAProperty[] = [
11
+ 'role',
12
+ 'ariaAtomic',
13
+ 'ariaAutoComplete',
14
+ 'ariaBusy',
15
+ 'ariaChecked',
16
+ 'ariaColCount',
17
+ 'ariaColIndex',
18
+ 'ariaColSpan',
19
+ 'ariaCurrent',
20
+ 'ariaDisabled',
21
+ 'ariaExpanded',
22
+ 'ariaHasPopup',
23
+ 'ariaHidden',
24
+ 'ariaInvalid',
25
+ 'ariaKeyShortcuts',
26
+ 'ariaLabel',
27
+ 'ariaLevel',
28
+ 'ariaLive',
29
+ 'ariaModal',
30
+ 'ariaMultiLine',
31
+ 'ariaMultiSelectable',
32
+ 'ariaOrientation',
33
+ 'ariaPlaceholder',
34
+ 'ariaPosInSet',
35
+ 'ariaPressed',
36
+ 'ariaReadOnly',
37
+ 'ariaRequired',
38
+ 'ariaRoleDescription',
39
+ 'ariaRowCount',
40
+ 'ariaRowIndex',
41
+ 'ariaRowSpan',
42
+ 'ariaSelected',
43
+ 'ariaSetSize',
44
+ 'ariaSort',
45
+ 'ariaValueMax',
46
+ 'ariaValueMin',
47
+ 'ariaValueNow',
48
+ 'ariaValueText',
49
+ ];
50
+
51
+ /**
52
+ * Accessibility Object Model aria attribute name types.
53
+ */
54
+ // eslint-disable-next-line no-use-before-define
55
+ export type ARIAAttribute = ARIAPropertyToAttribute<ARIAProperty>;
56
+
57
+ /**
58
+ * Accessibility Object Model aria attributes.
59
+ */
60
+ // eslint-disable-next-line no-use-before-define
61
+ export const ARIA_ATTRIBUTES = ARIA_PROPERTIES.map(ariaPropertyToAttribute);
62
+
63
+ /**
64
+ * Checks if an attribute is one of the AOM aria attributes.
65
+ *
66
+ * @example
67
+ * isAriaAttribute('aria-label'); // true
68
+ *
69
+ * @param attribute The attribute to check.
70
+ * @return True if the attribute is an aria attribute, or false if not.
71
+ */
72
+ export function isAriaAttribute(attribute: string): attribute is ARIAAttribute {
73
+ return ARIA_ATTRIBUTES.includes(attribute as ARIAAttribute);
74
+ }
75
+
76
+ /**
77
+ * Converts an AOM aria property into its corresponding attribute.
78
+ *
79
+ * @example
80
+ * ariaPropertyToAttribute('ariaLabel'); // 'aria-label'
81
+ *
82
+ * @param property The aria property.
83
+ * @return The aria attribute.
84
+ */
85
+ export function ariaPropertyToAttribute<K extends ARIAProperty>(property: K) {
86
+ return (
87
+ property
88
+ .replace('aria', 'aria-')
89
+ // IDREF attributes also include an "Element" or "Elements" suffix
90
+ .replace(/Elements?/g, '')
91
+ // eslint-disable-next-line no-use-before-define
92
+ .toLowerCase() as ARIAPropertyToAttribute<K>
93
+ );
94
+ }
95
+
96
+ // Converts an `ariaFoo` string type to an `aria-foo` string type.
97
+ // eslint-disable-next-line no-unused-vars
98
+ type ARIAPropertyToAttribute<K extends string> =
99
+ K extends `aria${infer Suffix}Element${infer OptS}` // eslint-disable-line
100
+ ? `aria-${Lowercase<Suffix>}`
101
+ : K extends `aria${infer Suffix}`
102
+ ? `aria-${Lowercase<Suffix>}`
103
+ : K;
104
+
105
+ /**
106
+ * An extension of `ARIAMixin` that enforces strict value types for aria
107
+ * properties.
108
+ *
109
+ * This is needed for correct typing in render functions with lit analyzer.
110
+ *
111
+ * @example
112
+ * render() {
113
+ * const {ariaLabel} = this as ARIAMixinStrict;
114
+ * return html`
115
+ * <button aria-label=${ariaLabel || nothing}>
116
+ * <slot></slot>
117
+ * </button>
118
+ * `;
119
+ * }
120
+ */
121
+ // eslint-disable-next-line no-undef
122
+ export interface ARIAMixinStrict extends ARIAMixin {
123
+ ariaAtomic: 'true' | 'false' | null;
124
+ ariaAutoComplete: 'none' | 'inline' | 'list' | 'both' | null;
125
+ ariaBusy: 'true' | 'false' | null;
126
+ ariaChecked: 'true' | 'false' | null;
127
+ ariaColCount: `${number}` | null;
128
+ ariaColIndex: `${number}` | null;
129
+ ariaColSpan: `${number}` | null;
130
+ ariaCurrent:
131
+ | 'page'
132
+ | 'step'
133
+ | 'location'
134
+ | 'date'
135
+ | 'time'
136
+ | 'true'
137
+ | 'false'
138
+ | null;
139
+ ariaDisabled: 'true' | 'false' | null;
140
+ ariaExpanded: 'true' | 'false' | null;
141
+ ariaHasPopup:
142
+ | 'false'
143
+ | 'true'
144
+ | 'menu'
145
+ | 'listbox'
146
+ | 'tree'
147
+ | 'grid'
148
+ | 'dialog'
149
+ | null;
150
+ ariaHidden: 'true' | 'false' | null;
151
+ ariaInvalid: 'true' | 'false' | null;
152
+ ariaKeyShortcuts: string | null;
153
+ ariaLabel: string | null;
154
+ ariaLevel: `${number}` | null;
155
+ ariaLive: 'assertive' | 'off' | 'polite' | null;
156
+ ariaModal: 'true' | 'false' | null;
157
+ ariaMultiLine: 'true' | 'false' | null;
158
+ ariaMultiSelectable: 'true' | 'false' | null;
159
+ ariaOrientation: 'horizontal' | 'vertical' | 'undefined' | null;
160
+ ariaPlaceholder: string | null;
161
+ ariaPosInSet: `${number}` | null;
162
+ ariaPressed: 'true' | 'false' | null;
163
+ ariaReadOnly: 'true' | 'false' | null;
164
+ ariaRequired: 'true' | 'false' | null;
165
+ ariaRoleDescription: string | null;
166
+ ariaRowCount: `${number}` | null;
167
+ ariaRowIndex: `${number}` | null;
168
+ ariaRowSpan: `${number}` | null;
169
+ ariaSelected: 'true' | 'false' | null;
170
+ ariaSetSize: `${number}` | null;
171
+ ariaSort: 'ascending' | 'descending' | 'none' | 'other' | null;
172
+ ariaValueMax: `${number}` | null;
173
+ ariaValueMin: `${number}` | null;
174
+ ariaValueNow: `${number}` | null;
175
+ ariaValueText: string | null;
176
+ // eslint-disable-next-line no-use-before-define
177
+ role: ARIARole | null;
178
+ }
179
+
180
+ /**
181
+ * Valid values for `role`.
182
+ */
183
+ export type ARIARole =
184
+ | 'alert'
185
+ | 'alertdialog'
186
+ | 'button'
187
+ | 'checkbox'
188
+ | 'dialog'
189
+ | 'gridcell'
190
+ | 'link'
191
+ | 'log'
192
+ | 'marquee'
193
+ | 'menuitem'
194
+ | 'menuitemcheckbox'
195
+ | 'menuitemradio'
196
+ | 'option'
197
+ | 'progressbar'
198
+ | 'radio'
199
+ | 'scrollbar'
200
+ | 'searchbox'
201
+ | 'slider'
202
+ | 'spinbutton'
203
+ | 'status'
204
+ | 'switch'
205
+ | 'tab'
206
+ | 'tabpanel'
207
+ | 'textbox'
208
+ | 'timer'
209
+ | 'tooltip'
210
+ | 'treeitem'
211
+ | 'combobox'
212
+ | 'grid'
213
+ | 'listbox'
214
+ | 'menu'
215
+ | 'menubar'
216
+ | 'radiogroup'
217
+ | 'tablist'
218
+ | 'tree'
219
+ | 'treegrid'
220
+ | 'application'
221
+ | 'article'
222
+ | 'cell'
223
+ | 'columnheader'
224
+ | 'definition'
225
+ | 'directory'
226
+ | 'document'
227
+ | 'feed'
228
+ | 'figure'
229
+ | 'group'
230
+ | 'heading'
231
+ | 'img'
232
+ | 'list'
233
+ | 'listitem'
234
+ | 'math'
235
+ | 'none'
236
+ | 'note'
237
+ | 'presentation'
238
+ | 'region'
239
+ | 'row'
240
+ | 'rowgroup'
241
+ | 'rowheader'
242
+ | 'separator'
243
+ | 'table'
244
+ | 'term'
245
+ | 'text'
246
+ | 'toolbar'
247
+ | 'banner'
248
+ | 'complementary'
249
+ | 'contentinfo'
250
+ | 'form'
251
+ | 'main'
252
+ | 'navigation'
253
+ | 'region'
254
+ | 'search'
255
+ | 'doc-abstract'
256
+ | 'doc-acknowledgments'
257
+ | 'doc-afterword'
258
+ | 'doc-appendix'
259
+ | 'doc-backlink'
260
+ | 'doc-biblioentry'
261
+ | 'doc-bibliography'
262
+ | 'doc-biblioref'
263
+ | 'doc-chapter'
264
+ | 'doc-colophon'
265
+ | 'doc-conclusion'
266
+ | 'doc-cover'
267
+ | 'doc-credit'
268
+ | 'doc-credits'
269
+ | 'doc-dedication'
270
+ | 'doc-endnote'
271
+ | 'doc-endnotes'
272
+ | 'doc-epigraph'
273
+ | 'doc-epilogue'
274
+ | 'doc-errata'
275
+ | 'doc-example'
276
+ | 'doc-footnote'
277
+ | 'doc-foreword'
278
+ | 'doc-glossary'
279
+ | 'doc-glossref'
280
+ | 'doc-index'
281
+ | 'doc-introduction'
282
+ | 'doc-noteref'
283
+ | 'doc-notice'
284
+ | 'doc-pagebreak'
285
+ | 'doc-pagelist'
286
+ | 'doc-part'
287
+ | 'doc-preface'
288
+ | 'doc-prologue'
289
+ | 'doc-pullquote'
290
+ | 'doc-qna'
291
+ | 'doc-subtitle'
292
+ | 'doc-tip'
293
+ | 'doc-toc';
@@ -0,0 +1,206 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ import { LitElement, ReactiveElement, isServer } from 'lit';
8
+
9
+ import { MixinBase, MixinReturn } from '../mixins/mixin.js';
10
+ import {
11
+ ARIA_PROPERTIES,
12
+ ariaPropertyToAttribute,
13
+ isAriaAttribute,
14
+ } from './aria.js';
15
+
16
+ // Private symbols
17
+ const privateIgnoreAttributeChangesFor = Symbol(
18
+ 'privateIgnoreAttributeChangesFor',
19
+ );
20
+
21
+ function ariaAttributeToDataAttribute(ariaAttribute: string) {
22
+ // aria-haspopup -> data-aria-haspopup
23
+ return `data-${ariaAttribute}`;
24
+ }
25
+
26
+ function ariaAttributeToDataProperty(ariaAttribute: string) {
27
+ // aria-haspopup -> dataset.ariaHaspopup
28
+ return ariaAttribute.replace(/-\w/, dashLetter =>
29
+ dashLetter[1].toUpperCase(),
30
+ );
31
+ }
32
+
33
+ /**
34
+ * Overrides the constructor's native `ARIAMixin` properties to ensure that
35
+ * aria properties reflect the values that were shifted to a data attribute.
36
+ *
37
+ * @param ctor The `ReactiveElement` constructor to patch.
38
+ */
39
+ function setupDelegatesAriaProperties(ctor: typeof ReactiveElement) {
40
+ for (const ariaProperty of ARIA_PROPERTIES) {
41
+ // The casing between ariaProperty and the dataProperty may be different.
42
+ // ex: aria-haspopup -> ariaHasPopup
43
+ const ariaAttribute = ariaPropertyToAttribute(ariaProperty);
44
+ // ex: aria-haspopup -> data-aria-haspopup
45
+ const dataAttribute = ariaAttributeToDataAttribute(ariaAttribute);
46
+ // ex: aria-haspopup -> dataset.ariaHaspopup
47
+ const dataProperty = ariaAttributeToDataProperty(ariaAttribute);
48
+
49
+ // Call `ReactiveElement.createProperty()` so that the `aria-*` and `data-*`
50
+ // attributes are added to the `static observedAttributes` array. This
51
+ // triggers `attributeChangedCallback` for the delegates aria mixin to
52
+ // handle.
53
+ ctor.createProperty(ariaProperty, {
54
+ attribute: ariaAttribute,
55
+ noAccessor: true,
56
+ });
57
+ ctor.createProperty(Symbol(dataAttribute), {
58
+ attribute: dataAttribute,
59
+ noAccessor: true,
60
+ });
61
+
62
+ // Re-define the `ARIAMixin` properties to handle data attribute shifting.
63
+ // It is safe to use `Object.defineProperty` here because the properties
64
+ // are native and not renamed.
65
+ // tslint:disable-next-line:ban-unsafe-reflection
66
+ Object.defineProperty(ctor.prototype, ariaProperty, {
67
+ configurable: true,
68
+ enumerable: true,
69
+ get(this: ReactiveElement): string | null {
70
+ return this.dataset[dataProperty] ?? null;
71
+ },
72
+ set(this: ReactiveElement, value: string | null): void {
73
+ const prevValue = this.dataset[dataProperty] ?? null;
74
+ if (value === prevValue) {
75
+ return;
76
+ }
77
+
78
+ if (value === null) {
79
+ delete this.dataset[dataProperty];
80
+ } else {
81
+ this.dataset[dataProperty] = value;
82
+ }
83
+
84
+ this.requestUpdate(ariaProperty, prevValue);
85
+ },
86
+ });
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Mixes in aria delegation for elements that delegate focus and aria to inner
92
+ * shadow root elements.
93
+ *
94
+ * This mixin fixes invalid aria announcements with shadow roots, caused by
95
+ * duplicate aria attributes on both the host and the inner shadow root element.
96
+ *
97
+ * Note: this mixin **does not yet support** ID reference attributes, such as
98
+ * `aria-labelledby` or `aria-controls`.
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * class MyButton extends mixinDelegatesAria(LitElement) {
103
+ * static shadowRootOptions = {mode: 'open', delegatesFocus: true};
104
+ *
105
+ * render() {
106
+ * return html`
107
+ * <button aria-label=${this.ariaLabel || nothing}>
108
+ * <slot></slot>
109
+ * </button>
110
+ * `;
111
+ * }
112
+ * }
113
+ * ```
114
+ * ```html
115
+ * <my-button aria-label="Plus one">+1</my-button>
116
+ * ```
117
+ *
118
+ * Use `ARIAMixinStrict` for lit analyzer strict types, such as the "role"
119
+ * attribute.
120
+ *
121
+ * @example
122
+ * ```ts
123
+ * return html`
124
+ * <button role=${(this as ARIAMixinStrict).role || nothing}>
125
+ * <slot></slot>
126
+ * </button>
127
+ * `;
128
+ * ```
129
+ *
130
+ * In the future, updates to the Accessibility Object Model (AOM) will provide
131
+ * built-in aria delegation features that will replace this mixin.
132
+ *
133
+ * @param base The class to mix functionality into.
134
+ * @return The provided class with aria delegation mixed in.
135
+ */
136
+ export function mixinDelegatesAria<T extends MixinBase<LitElement>>(
137
+ base: T,
138
+ ): MixinReturn<T> {
139
+ if (isServer) {
140
+ // Don't shift attributes when running with lit-ssr. The SSR renderer
141
+ // implements a subset of DOM APIs, including the methods this mixin
142
+ // overrides, causing errors. We don't need to shift on the server anyway
143
+ // since elements will shift attributes immediately once they hydrate.
144
+ return base;
145
+ }
146
+
147
+ abstract class WithDelegatesAriaElement extends base {
148
+ [privateIgnoreAttributeChangesFor] = new Set();
149
+
150
+ override attributeChangedCallback(
151
+ name: string,
152
+ oldValue: string | null,
153
+ newValue: string | null,
154
+ ) {
155
+ if (!isAriaAttribute(name)) {
156
+ super.attributeChangedCallback(name, oldValue, newValue);
157
+ return;
158
+ }
159
+
160
+ if (this[privateIgnoreAttributeChangesFor].has(name)) {
161
+ return;
162
+ }
163
+
164
+ // Don't trigger another `attributeChangedCallback` once we remove the
165
+ // aria attribute from the host. We check the explicit name of the
166
+ // attribute to ignore since `attributeChangedCallback` can be called
167
+ // multiple times out of an expected order when hydrating an element with
168
+ // multiple attributes.
169
+ this[privateIgnoreAttributeChangesFor].add(name);
170
+ this.removeAttribute(name);
171
+ this[privateIgnoreAttributeChangesFor].delete(name);
172
+ const dataProperty = ariaAttributeToDataProperty(name);
173
+ if (newValue === null) {
174
+ delete this.dataset[dataProperty];
175
+ } else {
176
+ this.dataset[dataProperty] = newValue;
177
+ }
178
+
179
+ this.requestUpdate(ariaAttributeToDataProperty(name), oldValue);
180
+ }
181
+
182
+ override getAttribute(name: string) {
183
+ if (isAriaAttribute(name)) {
184
+ return super.getAttribute(ariaAttributeToDataAttribute(name));
185
+ }
186
+
187
+ return super.getAttribute(name);
188
+ }
189
+
190
+ override removeAttribute(name: string) {
191
+ super.removeAttribute(name);
192
+ if (isAriaAttribute(name)) {
193
+ super.removeAttribute(ariaAttributeToDataAttribute(name));
194
+ // Since `aria-*` attributes are already removed`, we need to request
195
+ // an update because `attributeChangedCallback` will not be called.
196
+ this.requestUpdate();
197
+ }
198
+ }
199
+ }
200
+
201
+ setupDelegatesAriaProperties(
202
+ WithDelegatesAriaElement as unknown as typeof ReactiveElement,
203
+ );
204
+
205
+ return WithDelegatesAriaElement;
206
+ }