@vonage/vivid 5.1.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (386) hide show
  1. package/accordion-item/definition.cjs +2 -1
  2. package/accordion-item/definition.js +2 -1
  3. package/alert/index.cjs +1 -1
  4. package/alert/index.js +1 -1
  5. package/audio-player/definition.cjs +41 -6
  6. package/audio-player/definition.js +41 -6
  7. package/audio-player/index.cjs +27 -25
  8. package/audio-player/index.js +88 -62
  9. package/badge/index.cjs +2 -2
  10. package/badge/index.js +4 -4
  11. package/banner/index.cjs +3 -3
  12. package/banner/index.js +6 -6
  13. package/breadcrumb-item/index.cjs +1 -1
  14. package/breadcrumb-item/index.js +1 -1
  15. package/bundled/affix.cjs +7 -7
  16. package/bundled/affix.js +5 -5
  17. package/bundled/anchored.cjs +1 -1
  18. package/bundled/anchored.js +6 -6
  19. package/bundled/attribute-binding-behaviour.cjs +1 -1
  20. package/bundled/attribute-binding-behaviour.js +15 -13
  21. package/bundled/base-color-picker.cjs +13 -0
  22. package/bundled/base-color-picker.js +194 -0
  23. package/bundled/button.cjs +1 -1
  24. package/bundled/button.js +2 -2
  25. package/bundled/calendar-picker.template.cjs +1 -1
  26. package/bundled/calendar-picker.template.js +21 -21
  27. package/bundled/char-count.cjs +1 -1
  28. package/bundled/char-count.js +1 -1
  29. package/bundled/children.cjs +1 -1
  30. package/bundled/children.js +28 -20
  31. package/bundled/definition.cjs +3 -3
  32. package/bundled/definition.js +38 -38
  33. package/bundled/definition10.cjs +72 -18
  34. package/bundled/definition10.js +351 -65
  35. package/bundled/definition11.cjs +19 -10
  36. package/bundled/definition11.js +66 -37
  37. package/bundled/definition12.cjs +10 -1
  38. package/bundled/definition12.js +38 -14
  39. package/bundled/definition13.cjs +1 -73
  40. package/bundled/definition13.js +15 -354
  41. package/bundled/definition15.cjs +1 -1
  42. package/bundled/definition15.js +1 -1
  43. package/bundled/definition16.cjs +2 -2
  44. package/bundled/definition16.js +8 -8
  45. package/bundled/definition17.cjs +7 -7
  46. package/bundled/definition17.js +17 -17
  47. package/bundled/definition19.cjs +17 -14
  48. package/bundled/definition19.js +85 -77
  49. package/bundled/definition2.cjs +9 -5
  50. package/bundled/definition2.js +21 -17
  51. package/bundled/definition22.cjs +9 -9
  52. package/bundled/definition22.js +31 -31
  53. package/bundled/definition3.cjs +1 -1
  54. package/bundled/definition3.js +1 -1
  55. package/bundled/definition6.cjs +6 -6
  56. package/bundled/definition6.js +34 -31
  57. package/bundled/definition7.cjs +1 -1
  58. package/bundled/definition7.js +6 -6
  59. package/bundled/definition8.cjs +2 -2
  60. package/bundled/definition8.js +4 -4
  61. package/bundled/definition9.cjs +1 -1
  62. package/bundled/definition9.js +1 -1
  63. package/bundled/delegates-aria.cjs +1 -1
  64. package/bundled/delegates-aria.js +59 -46
  65. package/bundled/form-associated.cjs +1 -1
  66. package/bundled/form-associated.js +3 -3
  67. package/bundled/host-semantics.cjs +1 -1
  68. package/bundled/host-semantics.js +48 -34
  69. package/bundled/localized.cjs +1 -1
  70. package/bundled/localized.js +43 -31
  71. package/bundled/mixins.cjs +18 -18
  72. package/bundled/mixins.js +99 -93
  73. package/bundled/normalize.cjs +1 -0
  74. package/bundled/normalize.js +7 -0
  75. package/bundled/picker-field.template.cjs +18 -13
  76. package/bundled/picker-field.template.js +45 -37
  77. package/bundled/ref.cjs +1 -1
  78. package/bundled/ref.js +8 -25
  79. package/bundled/repeat.cjs +1 -1
  80. package/bundled/repeat.js +459 -233
  81. package/bundled/slider.template.cjs +1 -1
  82. package/bundled/slider.template.js +2 -2
  83. package/bundled/slotted.cjs +1 -1
  84. package/bundled/slotted.js +62 -45
  85. package/bundled/text-field.cjs +1 -1
  86. package/bundled/text-field.js +1 -1
  87. package/bundled/time-selection-picker.template.cjs +1 -1
  88. package/bundled/time-selection-picker.template.js +5 -5
  89. package/bundled/vivid-element.cjs +1 -1
  90. package/bundled/vivid-element.js +2126 -1172
  91. package/bundled/when.cjs +1 -1
  92. package/bundled/when.js +8 -7
  93. package/bundled/with-contextual-help.cjs +1 -1
  94. package/bundled/with-contextual-help.js +17 -7
  95. package/calendar/definition.cjs +1 -1
  96. package/calendar/definition.js +2 -2
  97. package/calendar/index.cjs +1 -1
  98. package/calendar/index.js +6 -6
  99. package/calendar-event/index.cjs +1 -1
  100. package/calendar-event/index.js +1 -1
  101. package/card/definition.cjs +10 -2
  102. package/card/definition.js +10 -2
  103. package/card/index.cjs +19 -11
  104. package/card/index.js +35 -27
  105. package/color-picker/definition.cjs +1079 -0
  106. package/color-picker/definition.js +1073 -0
  107. package/color-picker/index.cjs +127 -0
  108. package/color-picker/index.js +726 -0
  109. package/combobox/definition.cjs +13 -6
  110. package/combobox/definition.js +14 -7
  111. package/combobox/index.cjs +15 -11
  112. package/combobox/index.js +82 -75
  113. package/contextual-help/index.cjs +1 -1
  114. package/contextual-help/index.js +1 -1
  115. package/custom-elements.json +1621 -325
  116. package/data-grid/definition.cjs +862 -27
  117. package/data-grid/definition.js +863 -28
  118. package/data-grid/index.cjs +25 -25
  119. package/data-grid/index.js +175 -168
  120. package/date-picker/index.cjs +1 -1
  121. package/date-picker/index.js +2 -2
  122. package/date-range-picker/index.cjs +1 -1
  123. package/date-range-picker/index.js +2 -2
  124. package/date-time-picker/index.cjs +1 -1
  125. package/date-time-picker/index.js +2 -2
  126. package/dial-pad/definition.cjs +55 -1
  127. package/dial-pad/definition.js +56 -2
  128. package/dial-pad/index.cjs +21 -18
  129. package/dial-pad/index.js +138 -104
  130. package/dialog/definition.cjs +4 -1
  131. package/dialog/definition.js +4 -1
  132. package/dialog/index.cjs +21 -18
  133. package/dialog/index.js +43 -40
  134. package/empty-state/definition.cjs +7 -2
  135. package/empty-state/definition.js +7 -2
  136. package/empty-state/index.cjs +10 -5
  137. package/empty-state/index.js +18 -13
  138. package/fab/index.cjs +2 -2
  139. package/fab/index.js +4 -4
  140. package/file-picker/definition.cjs +16 -7
  141. package/file-picker/definition.js +17 -8
  142. package/file-picker/index.cjs +12 -9
  143. package/file-picker/index.js +103 -93
  144. package/icon/definition.cjs +10 -6
  145. package/icon/definition.js +10 -6
  146. package/index.cjs +4 -0
  147. package/index.js +1 -0
  148. package/lib/accordion-item/accordion-item.d.ts +2 -2
  149. package/lib/action-group/action-group.d.ts +2 -2
  150. package/lib/alert/alert.d.ts +4 -4
  151. package/lib/audio-player/audio-player.d.ts +6 -2
  152. package/lib/avatar/avatar.d.ts +2 -2
  153. package/lib/badge/badge.d.ts +2 -2
  154. package/lib/banner/banner.d.ts +6 -6
  155. package/lib/breadcrumb/breadcrumb.d.ts +2 -2
  156. package/lib/breadcrumb-item/breadcrumb-item.d.ts +2 -2
  157. package/lib/button/button.d.ts +6 -6
  158. package/lib/button/button.template.d.ts +2 -1
  159. package/lib/calendar/calendar.d.ts +1 -1
  160. package/lib/calendar-event/calendar-event.d.ts +2 -2
  161. package/lib/card/card.d.ts +2 -2
  162. package/lib/checkbox/checkbox.d.ts +12 -12
  163. package/lib/color-picker/color-picker.d.ts +2420 -0
  164. package/lib/color-picker/color-picker.template.d.ts +3 -0
  165. package/lib/color-picker/definition.d.ts +4 -0
  166. package/lib/color-picker/locale.d.ts +9 -0
  167. package/lib/combobox/combobox.d.ts +495 -78
  168. package/lib/components.d.ts +1 -0
  169. package/lib/data-grid/data-grid-cell.d.ts +4 -4
  170. package/lib/data-grid/data-grid-row.d.ts +3 -4
  171. package/lib/data-grid/data-grid.d.ts +1 -2
  172. package/lib/date-picker/date-picker.d.ts +906 -894
  173. package/lib/date-range-picker/date-range-picker.d.ts +596 -590
  174. package/lib/date-time-picker/date-time-picker.d.ts +907 -895
  175. package/lib/dial-pad/dial-pad.d.ts +3 -2
  176. package/lib/dial-pad/dial-pad.template.d.ts +1 -1
  177. package/lib/dial-pad/locale.d.ts +1 -0
  178. package/lib/dialog/dialog.d.ts +4 -4
  179. package/lib/divider/divider.d.ts +2 -2
  180. package/lib/fab/fab.d.ts +2 -2
  181. package/lib/file-picker/file-picker.d.ts +495 -78
  182. package/lib/header/header.d.ts +2 -2
  183. package/lib/menu/menu.d.ts +5 -4
  184. package/lib/menu-item/menu-item.d.ts +4 -4
  185. package/lib/nav/nav.d.ts +2 -2
  186. package/lib/nav-disclosure/nav-disclosure.d.ts +4 -4
  187. package/lib/nav-item/nav-item.d.ts +4 -4
  188. package/lib/note/note.d.ts +2 -2
  189. package/lib/number-field/number-field.d.ts +19 -18
  190. package/lib/option/option.d.ts +4 -4
  191. package/lib/pagination/pagination.d.ts +2 -2
  192. package/lib/progress/progress.d.ts +2 -2
  193. package/lib/progress-ring/progress-ring.d.ts +2 -2
  194. package/lib/radio/radio.d.ts +6 -6
  195. package/lib/radio-group/radio-group.d.ts +2 -2
  196. package/lib/range-slider/range-slider.d.ts +6 -6
  197. package/lib/rich-text-editor/menubar/menubar.d.ts +2 -2
  198. package/lib/rich-text-editor/rich-text-editor.d.ts +2 -2
  199. package/lib/searchable-select/option-tag.d.ts +2 -2
  200. package/lib/searchable-select/searchable-select.d.ts +521 -104
  201. package/lib/select/select.d.ts +484 -67
  202. package/lib/selectable-box/selectable-box.d.ts +2 -2
  203. package/lib/simple-color-picker/locale.d.ts +0 -1
  204. package/lib/simple-color-picker/simple-color-picker.d.ts +47 -821
  205. package/lib/slider/slider.d.ts +6 -6
  206. package/lib/split-button/split-button.d.ts +6 -6
  207. package/lib/switch/switch.d.ts +4 -4
  208. package/lib/tab/tab.d.ts +6 -6
  209. package/lib/tab-panel/tab-panel.d.ts +2 -2
  210. package/lib/tag/tag.d.ts +6 -6
  211. package/lib/tag-group/tag-group.d.ts +2 -2
  212. package/lib/tag-name-map.d.ts +2 -1
  213. package/lib/text-area/text-area.d.ts +17 -16
  214. package/lib/text-field/text-field.d.ts +19 -18
  215. package/lib/time-picker/time-picker.d.ts +579 -573
  216. package/lib/toggletip/toggletip.d.ts +4 -4
  217. package/lib/tooltip/tooltip.d.ts +2 -2
  218. package/lib/tree-item/tree-item.d.ts +4 -4
  219. package/lib/tree-view/tree-view.d.ts +2 -2
  220. package/lib/video-player/video-player.d.ts +2 -2
  221. package/locales/de-DE.cjs +15 -3
  222. package/locales/de-DE.js +15 -3
  223. package/locales/en-GB.cjs +15 -3
  224. package/locales/en-GB.js +15 -3
  225. package/locales/en-US.cjs +15 -3
  226. package/locales/en-US.js +15 -3
  227. package/locales/ja-JP.cjs +15 -3
  228. package/locales/ja-JP.js +15 -3
  229. package/locales/zh-CN.cjs +15 -3
  230. package/locales/zh-CN.js +15 -3
  231. package/menu/definition.cjs +8 -4
  232. package/menu/definition.js +9 -5
  233. package/note/index.cjs +2 -2
  234. package/note/index.js +4 -4
  235. package/number-field/definition.cjs +3 -3
  236. package/number-field/definition.js +4 -4
  237. package/number-field/index.cjs +8 -8
  238. package/number-field/index.js +41 -40
  239. package/option/index.cjs +1 -1
  240. package/option/index.js +1 -1
  241. package/package.json +5 -5
  242. package/pagination/definition.cjs +2 -1
  243. package/pagination/definition.js +2 -1
  244. package/pagination/index.cjs +12 -12
  245. package/pagination/index.js +59 -59
  246. package/progress/index.cjs +1 -1
  247. package/progress/index.js +1 -1
  248. package/radio/definition.cjs +9 -9
  249. package/radio/definition.js +10 -10
  250. package/radio-group/definition.cjs +2 -1
  251. package/radio-group/definition.js +2 -1
  252. package/radio-group/index.cjs +5 -5
  253. package/radio-group/index.js +80 -77
  254. package/range-slider/index.cjs +1 -1
  255. package/range-slider/index.js +1 -1
  256. package/rich-text-editor/definition.cjs +1 -1
  257. package/rich-text-editor/definition.js +2 -2
  258. package/rich-text-editor/index.cjs +2 -2
  259. package/rich-text-editor/index.js +3 -3
  260. package/searchable-select/definition.cjs +30 -21
  261. package/searchable-select/definition.js +31 -22
  262. package/searchable-select/index.cjs +28 -25
  263. package/searchable-select/index.js +149 -140
  264. package/select/definition.cjs +15 -7
  265. package/select/definition.js +16 -8
  266. package/selectable-box/definition.cjs +1 -1
  267. package/selectable-box/definition.js +1 -1
  268. package/selectable-box/index.cjs +3 -3
  269. package/selectable-box/index.js +20 -20
  270. package/shared/aria/aria-change-subscription.d.ts +0 -1
  271. package/shared/aria/aria-mixin.d.ts +2 -2
  272. package/shared/aria/delegate-aria-behavior.d.ts +5 -10
  273. package/shared/aria/delegates-aria.d.ts +3 -3
  274. package/shared/aria/host-semantics-behavior.d.ts +5 -8
  275. package/shared/aria/host-semantics.d.ts +3 -3
  276. package/shared/color-picker/base-color-picker.d.ts +436 -0
  277. package/shared/color-picker/index.d.ts +1 -0
  278. package/shared/color-picker/locale.d.ts +3 -0
  279. package/shared/color-picker/utils.d.ts +1 -0
  280. package/shared/deprecation/replaced-props.d.ts +317 -2
  281. package/shared/design-system/defineVividComponent.d.ts +2 -2
  282. package/shared/feedback/feedback-message.d.ts +2 -2
  283. package/shared/feedback/mixins.d.ts +4 -4
  284. package/shared/foundation/button/button.d.ts +4 -4
  285. package/shared/foundation/form-associated/form-associated.d.ts +4 -4
  286. package/shared/foundation/vivid-element/vivid-element.d.ts +335 -8
  287. package/shared/localization/Locale.d.ts +4 -0
  288. package/shared/patterns/affix.d.ts +4 -4
  289. package/shared/patterns/anchored.d.ts +4 -4
  290. package/shared/patterns/char-count/char-count.d.ts +2 -2
  291. package/shared/patterns/form-elements/form-element.d.ts +4 -4
  292. package/shared/patterns/form-elements/index.d.ts +1 -0
  293. package/shared/patterns/form-elements/with-contextual-help.d.ts +7 -6
  294. package/shared/patterns/form-elements/with-error-text.d.ts +6 -6
  295. package/shared/patterns/form-elements/with-success-text.d.ts +2 -2
  296. package/shared/patterns/linkable.d.ts +2 -2
  297. package/shared/patterns/localized.d.ts +2 -2
  298. package/shared/patterns/trapped-focus.d.ts +2 -2
  299. package/shared/picker-field/mixins/calendar-picker.d.ts +454 -451
  300. package/shared/picker-field/mixins/calendar-picker.template.d.ts +454 -451
  301. package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +2 -2
  302. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +600 -594
  303. package/shared/picker-field/mixins/single-date-picker.d.ts +746 -737
  304. package/shared/picker-field/mixins/single-value-picker.d.ts +451 -448
  305. package/shared/picker-field/mixins/time-selection-picker.d.ts +580 -574
  306. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +579 -573
  307. package/shared/picker-field/picker-field.d.ts +495 -78
  308. package/shared/templating/attribute-binding-behaviour.d.ts +3 -4
  309. package/shared/templating/render-in-light-dom.d.ts +13 -12
  310. package/side-drawer/index.cjs +1 -1
  311. package/side-drawer/index.js +1 -1
  312. package/simple-color-picker/definition.cjs +28 -215
  313. package/simple-color-picker/definition.js +29 -216
  314. package/simple-color-picker/index.cjs +9 -21
  315. package/simple-color-picker/index.js +71 -185
  316. package/styles/core/all.css +1 -1
  317. package/styles/core/theme.css +1 -1
  318. package/styles/core/typography.css +1 -1
  319. package/styles/tokens/theme-dark.css +4 -4
  320. package/styles/tokens/theme-light.css +4 -4
  321. package/styles/tokens/vivid-2-compat.css +1 -1
  322. package/switch/index.cjs +2 -2
  323. package/switch/index.js +4 -4
  324. package/tabs/definition.cjs +1 -1
  325. package/tabs/definition.js +2 -2
  326. package/tabs/index.cjs +2 -2
  327. package/tabs/index.js +16 -16
  328. package/tag/index.cjs +1 -1
  329. package/tag/index.js +1 -1
  330. package/text-area/definition.cjs +1 -1
  331. package/text-area/definition.js +1 -1
  332. package/text-area/index.cjs +3 -3
  333. package/text-area/index.js +9 -9
  334. package/text-field/definition.cjs +3 -3
  335. package/text-field/definition.js +4 -4
  336. package/text-field/index.cjs +1 -1
  337. package/text-field/index.js +1 -1
  338. package/time-picker/index.cjs +1 -1
  339. package/time-picker/index.js +2 -2
  340. package/toggletip/definition.cjs +1 -1
  341. package/toggletip/definition.js +2 -2
  342. package/tree-view/definition.cjs +1 -1
  343. package/tree-view/definition.js +2 -2
  344. package/tree-view/index.cjs +2 -2
  345. package/tree-view/index.js +6 -6
  346. package/unbundled/_commonjsHelpers.cjs +36 -0
  347. package/unbundled/_commonjsHelpers.js +32 -0
  348. package/unbundled/affix.cjs +1 -1
  349. package/unbundled/affix.js +1 -1
  350. package/unbundled/attribute-binding-behaviour.cjs +11 -10
  351. package/unbundled/attribute-binding-behaviour.js +11 -10
  352. package/unbundled/base-color-picker.cjs +278 -0
  353. package/unbundled/base-color-picker.js +275 -0
  354. package/unbundled/button.cjs +1 -1
  355. package/unbundled/button.js +2 -2
  356. package/unbundled/calendar-picker.template.cjs +3 -3
  357. package/unbundled/calendar-picker.template.js +4 -4
  358. package/unbundled/definition2.cjs +1 -1
  359. package/unbundled/definition2.js +2 -2
  360. package/unbundled/definition3.cjs +2 -1
  361. package/unbundled/definition3.js +2 -1
  362. package/unbundled/delegates-aria.cjs +67 -33
  363. package/unbundled/delegates-aria.js +69 -35
  364. package/unbundled/form-associated.cjs +2 -2
  365. package/unbundled/form-associated.js +3 -3
  366. package/unbundled/host-semantics.cjs +47 -22
  367. package/unbundled/host-semantics.js +48 -23
  368. package/unbundled/mixins.cjs +34 -27
  369. package/unbundled/mixins.js +35 -28
  370. package/unbundled/picker-field.template.cjs +13 -5
  371. package/unbundled/picker-field.template.js +14 -6
  372. package/unbundled/text-field.cjs +1 -1
  373. package/unbundled/text-field.js +1 -1
  374. package/unbundled/time-selection-picker.template.cjs +4 -4
  375. package/unbundled/time-selection-picker.template.js +5 -5
  376. package/unbundled/vivid-element.cjs +22 -15
  377. package/unbundled/vivid-element.js +23 -15
  378. package/unbundled/with-contextual-help.cjs +11 -0
  379. package/unbundled/with-contextual-help.js +11 -0
  380. package/video-player/definition.cjs +69007 -1
  381. package/video-player/definition.js +69007 -1
  382. package/video-player/index.cjs +35 -35
  383. package/video-player/index.js +1358 -1384
  384. package/visually-hidden/index.cjs +1 -1
  385. package/visually-hidden/index.js +1 -1
  386. package/vivid.api.json +347 -69
@@ -1,46 +1,13 @@
1
1
  import { V as VividElement, d as defineVividComponent, c as createRegisterFunction } from '../unbundled/vivid-element.js';
2
2
  import { P as Popup, p as popupDefinition } from '../unbundled/definition4.js';
3
3
  import { VwcIconElement as Icon, iconDefinition } from '../icon/definition.js';
4
- import { DOM, attr, observable, nullableNumberConverter, repeat, when, html } from '@microsoft/fast-element';
4
+ import { Updates, attr, nullableNumberConverter, repeat, html } from '@microsoft/fast-element';
5
5
  import { A as Anchored, a as anchorSlotTemplateFactory } from '../unbundled/anchored.js';
6
- import { F as FormAssociated } from '../unbundled/form-associated.js';
7
- import { L as Localized } from '../unbundled/localized.js';
8
- import { F as FormElement } from '../unbundled/form-element.js';
6
+ import { B as BaseColorPicker } from '../unbundled/base-color-picker.js';
9
7
  import { classNames } from '@microsoft/fast-web-utilities';
10
8
  import { h as handleEscapeKeyAndStopPropogation } from '../unbundled/index.js';
11
9
 
12
- const styles = ":host :host{display:var(--_popup-display, inline)}:host :host([slotted-anchor]){--_popup-display: contents}.palette{display:grid;padding:var(--_color-palette-spacing, 16px);gap:var(--_color-palette-gap, 12px);grid-template-columns:repeat(var(--swatches-per-row, 7),1fr)}.swatch{position:relative;padding:0;border:none;border-radius:4px;background-color:var(--swatch-color);block-size:var(--_color-swatch-size, 24px);color:var(--vvd-color-canvas);cursor:pointer;inline-size:var(--_color-swatch-size, 24px)}.swatch.contrast{color:var(--vvd-color-canvas-text)}.swatch:focus-visible{outline:none;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;--focus-inset: -3px}::part(popup-base){block-size:max-content;inline-size:max-content;max-block-size:100vh;max-inline-size:100vw;min-block-size:var(--_color-swatch-size, 24px);min-inline-size:var(--_color-swatch-size, 24px)}";
13
-
14
- function parseHexColor(input) {
15
- if (!input) return null;
16
- const hex = input.trim().replace(/^#/, "");
17
- if (/^[0-9a-fA-F]{6}$/.test(hex)) return hex.toLowerCase();
18
- return null;
19
- }
20
- function getLuminance(hexColor) {
21
- const hex = parseHexColor(hexColor);
22
- if (!hex) return 0;
23
- const r = parseInt(hex.slice(0, 2), 16) / 255;
24
- const g = parseInt(hex.slice(2, 4), 16) / 255;
25
- const b = parseInt(hex.slice(4, 6), 16) / 255;
26
- const sR = r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4);
27
- const sG = g <= 0.03928 ? g / 12.92 : Math.pow((g + 0.055) / 1.055, 2.4);
28
- const sB = b <= 0.03928 ? b / 12.92 : Math.pow((b + 0.055) / 1.055, 2.4);
29
- return 0.2126 * sR + 0.7152 * sG + 0.0722 * sB;
30
- }
31
- function getContrastRatio(color1, color2) {
32
- const lum1 = getLuminance(color1);
33
- const lum2 = getLuminance(color2);
34
- const brightest = Math.max(lum1, lum2);
35
- const darkest = Math.min(lum1, lum2);
36
- return (brightest + 0.05) / (darkest + 0.05);
37
- }
38
- function getCSSCustomProperty(propertyName, element) {
39
- if (!element) {
40
- element = document.querySelector(".vvd-root") || document.documentElement;
41
- }
42
- return getComputedStyle(element).getPropertyValue(propertyName).trim();
43
- }
10
+ const styles = ".palette{display:grid;grid-template-columns:repeat(var(--swatches-per-row, 7),var(--_color-swatch-size, 24px))}.swatch{position:relative;padding:0;border:none;border-radius:4px;background-color:var(--swatch-color);block-size:var(--_color-swatch-size, 24px);color:var(--vvd-color-canvas);cursor:pointer;inline-size:var(--_color-swatch-size, 24px)}.swatch.contrast{color:var(--vvd-color-canvas-text)}.swatch:focus-visible{outline:none;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;--focus-inset: -3px}:host :host{display:var(--_popup-display, inline)}:host :host([slotted-anchor]){--_popup-display: contents}.palette{padding:var(--_color-palette-spacing, 16px);gap:var(--_color-palette-gap, 12px)}::part(popup-base){block-size:max-content;inline-size:max-content;max-block-size:100vh;max-inline-size:100vw;min-block-size:var(--_color-swatch-size, 24px);min-inline-size:var(--_color-swatch-size, 24px)}";
44
11
 
45
12
  var __defProp = Object.defineProperty;
46
13
  var __decorateClass = (decorators, target, key, kind) => {
@@ -51,28 +18,16 @@ var __decorateClass = (decorators, target, key, kind) => {
51
18
  if (result) __defProp(target, key, result);
52
19
  return result;
53
20
  };
54
- class SimpleColorPicker extends Localized(
55
- Anchored(FormElement(FormAssociated(VividElement)))
56
- ) {
21
+ class SimpleColorPicker extends Anchored(BaseColorPicker(VividElement)) {
57
22
  constructor() {
58
23
  super(...arguments);
59
- /**
60
- * @internal
61
- */
62
- this.proxy = document.createElement("input");
63
- this.open = false;
64
24
  this.placement = "top-start";
65
- this.swatches = [];
66
25
  this.swatchesPerRow = 7;
67
- /**
68
- * @internal
69
- */
70
- this._canvasColor = "";
71
26
  /**
72
27
  * @internal
73
28
  */
74
29
  this.#openPopup = () => {
75
- if (!this.open) DOM.queueUpdate(() => this.open = true);
30
+ if (!this.open) Updates.enqueue(() => this.open = true);
76
31
  };
77
32
  /**
78
33
  * @internal
@@ -80,7 +35,7 @@ class SimpleColorPicker extends Localized(
80
35
  this.#handleAnchorKeydown = (event) => {
81
36
  if (event.key === "Enter" || event.key === " ") {
82
37
  if (!this.open) {
83
- DOM.queueUpdate(() => this.open = true);
38
+ Updates.enqueue(() => this.open = true);
84
39
  }
85
40
  event.preventDefault();
86
41
  }
@@ -88,7 +43,7 @@ class SimpleColorPicker extends Localized(
88
43
  /**
89
44
  * @internal
90
45
  */
91
- this.#closeOnClickOutside = (e) => {
46
+ this._closeOnClickOutside = (e) => {
92
47
  const clickedOutside = !this.contains(e.target);
93
48
  const clickedOnAnchor = this._anchorEl?.contains(e.target);
94
49
  if (clickedOutside || clickedOnAnchor) this.open = false;
@@ -96,108 +51,17 @@ class SimpleColorPicker extends Localized(
96
51
  /**
97
52
  * @internal
98
53
  */
99
- this.#closeOnEscape = (e) => {
54
+ this._closeOnEscape = (e) => {
100
55
  if (e.key === "Escape") {
101
56
  this.open = false;
102
57
  }
103
58
  };
104
- /**
105
- * @internal
106
- */
107
- this._handleSwatchSelection = (swatch) => {
108
- if (this.value === swatch.value) {
109
- this.value = "";
110
- } else {
111
- this.value = swatch.value;
112
- }
113
- this.$emit("change");
114
- this.open = false;
115
- };
116
- /**
117
- * @internal
118
- */
119
- this._handleSwatchKeydown = (event, swatch, index) => {
120
- const rowLength = this.swatchesPerRow;
121
- const totalCells = this.swatches.length;
122
- const currentRow = Math.floor(index / rowLength);
123
- const currentCol = index % rowLength;
124
- const totalRows = Math.ceil(totalCells / rowLength);
125
- switch (event.key) {
126
- case "ArrowRight":
127
- if (currentCol < rowLength - 1 && index + 1 < totalCells) {
128
- this.#focusSwatchByIndex(index + 1);
129
- }
130
- return false;
131
- case "ArrowLeft":
132
- if (currentCol > 0) {
133
- this.#focusSwatchByIndex(index - 1);
134
- }
135
- return false;
136
- case "ArrowDown":
137
- if (currentRow < totalRows - 1 && index + rowLength < totalCells) {
138
- this.#focusSwatchByIndex(index + rowLength);
139
- }
140
- return false;
141
- case "ArrowUp":
142
- if (currentRow > 0) {
143
- this.#focusSwatchByIndex(index - rowLength);
144
- }
145
- return false;
146
- case "PageDown": {
147
- const lastRowStart = (totalRows - 1) * rowLength;
148
- const targetIndex = Math.min(lastRowStart + currentCol, totalCells - 1);
149
- if (index !== targetIndex) {
150
- this.#focusSwatchByIndex(targetIndex);
151
- }
152
- return false;
153
- }
154
- case "PageUp": {
155
- const targetIndex = Math.min(currentCol, totalCells - 1);
156
- if (index !== targetIndex) {
157
- this.#focusSwatchByIndex(targetIndex);
158
- }
159
- return false;
160
- }
161
- case "Home":
162
- if (event.ctrlKey) {
163
- this.#focusSwatchByIndex(0);
164
- } else {
165
- this.#focusSwatchByIndex(currentRow * rowLength);
166
- }
167
- return false;
168
- case "End":
169
- if (event.ctrlKey) {
170
- this.#focusSwatchByIndex(totalCells - 1);
171
- } else {
172
- const rowEnd = Math.min(
173
- (currentRow + 1) * rowLength - 1,
174
- totalCells - 1
175
- );
176
- this.#focusSwatchByIndex(rowEnd);
177
- }
178
- return false;
179
- case "Enter":
180
- case " ":
181
- this._handleSwatchSelection(swatch);
182
- this.#returnFocusToAnchor();
183
- return false;
184
- case "Escape":
185
- this.open = false;
186
- this.#returnFocusToAnchor();
187
- return false;
188
- case "Tab":
189
- this.open = false;
190
- return true;
191
- default:
192
- return true;
193
- }
194
- };
195
59
  }
196
60
  /**
197
61
  * @internal
198
62
  */
199
63
  openChanged() {
200
- this.#updateListeners();
64
+ this._updateListeners();
201
65
  if (this._anchorEl) {
202
66
  this.#updateAnchor(this._anchorEl);
203
67
  }
@@ -208,43 +72,40 @@ class SimpleColorPicker extends Localized(
208
72
  (swatch) => swatch.value === this.value
209
73
  );
210
74
  const targetIndex = selectedIndex >= 0 ? selectedIndex : 0;
211
- this.#focusSwatchByIndex(targetIndex);
75
+ this._focusSwatchByIndex(targetIndex);
212
76
  });
213
77
  }
214
78
  }
79
+ /**
80
+ * @internal
81
+ */
82
+ _getRowLength() {
83
+ return this.swatchesPerRow;
84
+ }
215
85
  connectedCallback() {
216
86
  super.connectedCallback();
217
- this.#updateListeners();
218
- this._refreshCanvasColor();
87
+ this._updateListeners();
219
88
  }
220
89
  disconnectedCallback() {
221
90
  super.disconnectedCallback();
222
- this.#updateListeners();
91
+ this._updateListeners();
223
92
  }
224
93
  /**
225
94
  * @internal
226
95
  */
227
- #updateListeners() {
228
- document.removeEventListener("click", this.#closeOnClickOutside);
229
- document.removeEventListener("keydown", this.#closeOnEscape);
96
+ _updateListeners() {
97
+ document.removeEventListener("click", this._closeOnClickOutside);
98
+ document.removeEventListener("keydown", this._closeOnEscape);
230
99
  if (this.open && this.isConnected) {
231
- document.addEventListener("click", this.#closeOnClickOutside);
232
- document.addEventListener("keydown", this.#closeOnEscape);
100
+ document.addEventListener("click", this._closeOnClickOutside);
101
+ document.addEventListener("keydown", this._closeOnEscape);
233
102
  }
234
103
  }
235
104
  /**
236
105
  * @internal
237
106
  */
238
- _refreshCanvasColor() {
239
- this._canvasColor = getCSSCustomProperty("--vvd-color-canvas", this);
240
- }
241
- /**
242
- * @internal
243
- */
244
- _applyContrastClass(swatchColor, threshold = 3) {
245
- if (!swatchColor || !this._canvasColor) return false;
246
- const ratio = getContrastRatio(swatchColor, this._canvasColor);
247
- return ratio < threshold;
107
+ _getFocusReturnEl() {
108
+ return this._anchorEl ?? null;
248
109
  }
249
110
  /**
250
111
  * @internal
@@ -281,32 +142,10 @@ class SimpleColorPicker extends Localized(
281
142
  }
282
143
  #openPopup;
283
144
  #handleAnchorKeydown;
284
- #closeOnClickOutside;
285
- #closeOnEscape;
286
- /**
287
- * @internal
288
- */
289
- #focusSwatchByIndex(index) {
290
- if (index < 0 || index >= this.swatches.length) return;
291
- const element = this.shadowRoot?.querySelectorAll('[role="gridcell"]')?.[index];
292
- element?.focus();
293
- }
294
- /**
295
- * @internal
296
- */
297
- #returnFocusToAnchor() {
298
- DOM.queueUpdate(() => this._anchorEl?.focus());
299
- }
300
145
  }
301
- __decorateClass([
302
- attr({ mode: "boolean" })
303
- ], SimpleColorPicker.prototype, "open");
304
146
  __decorateClass([
305
147
  attr({ mode: "fromView" })
306
148
  ], SimpleColorPicker.prototype, "placement");
307
- __decorateClass([
308
- observable
309
- ], SimpleColorPicker.prototype, "swatches");
310
149
  __decorateClass([
311
150
  attr({
312
151
  attribute: "swatches-per-row",
@@ -336,39 +175,13 @@ const SimpleColorPickerTemplate = (context) => {
336
175
  }}"
337
176
  >
338
177
  <div class="palette" role="grid"
339
- aria-rowcount="${(x) => Math.ceil(x.swatches.length / x.swatchesPerRow)}"
340
- aria-colcount="${(x) => x.swatchesPerRow}"
341
- style="--swatches-per-row: ${(x) => x.swatchesPerRow};"
178
+ aria-rowcount="${(x) => Math.ceil(x.swatches.length / x._getRowLength())}"
179
+ aria-colcount="${(x) => x._getRowLength()}"
180
+ style="--swatches-per-row: ${(x) => x._getRowLength()};"
342
181
  aria-label="${(x) => x.locale.simpleColorPicker.colorPaletteLabel}">
343
182
  ${repeat(
344
183
  (x) => x.swatches,
345
- html`
346
- <button
347
- class="swatch ${(x, c) => classNames(
348
- c.parent.value === x.value ? "selected" : "",
349
- c.parent._applyContrastClass(x.value) ? "contrast" : ""
350
- )}"
351
- role="gridcell"
352
- style="--swatch-color: ${(x) => x.value};"
353
- tabindex="${(x, c) => c.index === 0 ? "0" : "-1"}"
354
- aria-label="${(x, c) => c.parent.locale.simpleColorPicker.colorSwatchLabel(
355
- x.value,
356
- x.label,
357
- c.parent.value === x.value
358
- )}"
359
- @click="${(x, c) => c.parent._handleSwatchSelection(x)}"
360
- @keydown="${(x, c) => c.parent._handleSwatchKeydown(
361
- c.event,
362
- x,
363
- c.index
364
- )}"
365
- >
366
- ${when(
367
- (x, c) => c.parent.value === x.value,
368
- html`<${iconTag} size="-6" name="check-solid" aria-hidden="true"></${iconTag}>`
369
- )}
370
- </button>
371
- `,
184
+ (x) => x._renderColorSwatch(iconTag),
372
185
  { positioning: true }
373
186
  )}
374
187
  </div>
@@ -1,31 +1,19 @@
1
- "use strict";const a=require("../bundled/vivid-element.cjs"),v=require("../bundled/definition9.cjs"),m=require("../bundled/definition2.cjs"),w=require("../bundled/anchored.cjs"),C=require("../bundled/form-associated.cjs"),b=require("../bundled/localized.cjs"),k=require("../bundled/form-element.cjs"),y=require("../bundled/index.cjs"),g=require("../bundled/class-names.cjs"),_=require("../bundled/repeat.cjs"),E=require("../bundled/when.cjs"),x=":host :host{display:var(--_popup-display, inline)}:host :host([slotted-anchor]){--_popup-display: contents}.palette{display:grid;padding:var(--_color-palette-spacing, 16px);gap:var(--_color-palette-gap, 12px);grid-template-columns:repeat(var(--swatches-per-row, 7),1fr)}.swatch{position:relative;padding:0;border:none;border-radius:4px;background-color:var(--swatch-color);block-size:var(--_color-swatch-size, 24px);color:var(--vvd-color-canvas);cursor:pointer;inline-size:var(--_color-swatch-size, 24px)}.swatch.contrast{color:var(--vvd-color-canvas-text)}.swatch:focus-visible{outline:none;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;--focus-inset: -3px}::part(popup-base){block-size:max-content;inline-size:max-content;max-block-size:100vh;max-inline-size:100vw;min-block-size:var(--_color-swatch-size, 24px);min-inline-size:var(--_color-swatch-size, 24px)}";function $(n){if(!n)return null;const e=n.trim().replace(/^#/,"");return/^[0-9a-fA-F]{6}$/.test(e)?e.toLowerCase():null}function f(n){const e=$(n);if(!e)return 0;const r=parseInt(e.slice(0,2),16)/255,o=parseInt(e.slice(2,4),16)/255,t=parseInt(e.slice(4,6),16)/255,s=r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4),i=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4);return .2126*s+.7152*i+.0722*c}function S(n,e){const r=f(n),o=f(e),t=Math.max(r,o),s=Math.min(r,o);return(t+.05)/(s+.05)}function A(n,e){return e||(e=document.querySelector(".vvd-root")||document.documentElement),getComputedStyle(e).getPropertyValue(n).trim()}var P=Object.defineProperty,p=(n,e,r,o)=>{for(var t=void 0,s=n.length-1,i;s>=0;s--)(i=n[s])&&(t=i(e,r,t)||t);return t&&P(e,r,t),t};class h extends b.Localized(w.Anchored(k.FormElement(C.FormAssociated(a.VividElement)))){constructor(){super(...arguments),this.proxy=document.createElement("input"),this.open=!1,this.placement="top-start",this.swatches=[],this.swatchesPerRow=7,this._canvasColor="",this.#s=()=>{this.open||a.DOM.queueUpdate(()=>this.open=!0)},this.#o=e=>{(e.key==="Enter"||e.key===" ")&&(this.open||a.DOM.queueUpdate(()=>this.open=!0),e.preventDefault())},this.#r=e=>{const r=!this.contains(e.target),o=this._anchorEl?.contains(e.target);(r||o)&&(this.open=!1)},this.#n=e=>{e.key==="Escape"&&(this.open=!1)},this._handleSwatchSelection=e=>{this.value===e.value?this.value="":this.value=e.value,this.$emit("change"),this.open=!1},this._handleSwatchKeydown=(e,r,o)=>{const t=this.swatchesPerRow,s=this.swatches.length,i=Math.floor(o/t),c=o%t,u=Math.ceil(s/t);switch(e.key){case"ArrowRight":return c<t-1&&o+1<s&&this.#e(o+1),!1;case"ArrowLeft":return c>0&&this.#e(o-1),!1;case"ArrowDown":return i<u-1&&o+t<s&&this.#e(o+t),!1;case"ArrowUp":return i>0&&this.#e(o-t),!1;case"PageDown":{const l=(u-1)*t,d=Math.min(l+c,s-1);return o!==d&&this.#e(d),!1}case"PageUp":{const l=Math.min(c,s-1);return o!==l&&this.#e(l),!1}case"Home":return e.ctrlKey?this.#e(0):this.#e(i*t),!1;case"End":if(e.ctrlKey)this.#e(s-1);else{const l=Math.min((i+1)*t-1,s-1);this.#e(l)}return!1;case"Enter":case" ":return this._handleSwatchSelection(r),this.#i(),!1;case"Escape":return this.open=!1,this.#i(),!1;case"Tab":return this.open=!1,!0;default:return!0}}}openChanged(){this.#t(),this._anchorEl&&this.#a(this._anchorEl),this.open&&(this._refreshCanvasColor(),requestAnimationFrame(()=>{const e=this.swatches.findIndex(o=>o.value===this.value),r=e>=0?e:0;this.#e(r)}))}connectedCallback(){super.connectedCallback(),this.#t(),this._refreshCanvasColor()}disconnectedCallback(){super.disconnectedCallback(),this.#t()}#t(){document.removeEventListener("click",this.#r),document.removeEventListener("keydown",this.#n),this.open&&this.isConnected&&(document.addEventListener("click",this.#r),document.addEventListener("keydown",this.#n))}_refreshCanvasColor(){this._canvasColor=A("--vvd-color-canvas",this)}_applyContrastClass(e,r=3){return!e||!this._canvasColor?!1:S(e,this._canvasColor)<r}_anchorElChanged(e,r){e&&this.#l(e),r&&this.#c(r)}#a(e){e.setAttribute("aria-expanded",this.open.toString()),e.setAttribute("data-expanded",this.open.toString())}#c(e){this.#a(e),e.addEventListener("click",this.#s,!0),e.addEventListener("keydown",this.#o),e.setAttribute("aria-haspopup","true")}#l(e){e.removeEventListener("click",this.#s,!0),e.removeEventListener("keydown",this.#o),e.removeAttribute("aria-expanded"),e.removeAttribute("data-expanded"),e.removeAttribute("aria-haspopup")}#s;#o;#r;#n;#e(e){if(e<0||e>=this.swatches.length)return;this.shadowRoot?.querySelectorAll('[role="gridcell"]')?.[e]?.focus()}#i(){a.DOM.queueUpdate(()=>this._anchorEl?.focus())}}p([a.attr({mode:"boolean"})],h.prototype,"open");p([a.attr({mode:"fromView"})],h.prototype,"placement");p([a.observable],h.prototype,"swatches");p([a.attr({attribute:"swatches-per-row",mode:"fromView",converter:a.nullableNumberConverter})],h.prototype,"swatchesPerRow");const q=n=>g.classNames("control"),L=n=>{const e=n.tagFor(v.Popup),r=n.tagFor(m.Icon),o=w.anchorSlotTemplateFactory();return a.html`
2
- ${o}
1
+ "use strict";const s=require("../bundled/vivid-element.cjs"),l=require("../bundled/definition9.cjs"),p=require("../bundled/definition2.cjs"),h=require("../bundled/anchored.cjs"),u=require("../bundled/base-color-picker.cjs"),v=require("../bundled/index.cjs"),m=require("../bundled/repeat.cjs"),f=require("../bundled/class-names.cjs"),w=".palette{display:grid;grid-template-columns:repeat(var(--swatches-per-row, 7),var(--_color-swatch-size, 24px))}.swatch{position:relative;padding:0;border:none;border-radius:4px;background-color:var(--swatch-color);block-size:var(--_color-swatch-size, 24px);color:var(--vvd-color-canvas);cursor:pointer;inline-size:var(--_color-swatch-size, 24px)}.swatch.contrast{color:var(--vvd-color-canvas-text)}.swatch:focus-visible{outline:none;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;--focus-inset: -3px}:host :host{display:var(--_popup-display, inline)}:host :host([slotted-anchor]){--_popup-display: contents}.palette{padding:var(--_color-palette-spacing, 16px);gap:var(--_color-palette-gap, 12px)}::part(popup-base){block-size:max-content;inline-size:max-content;max-block-size:100vh;max-inline-size:100vw;min-block-size:var(--_color-swatch-size, 24px);min-inline-size:var(--_color-swatch-size, 24px)}";var g=Object.defineProperty,d=(r,e,o,n)=>{for(var t=void 0,i=r.length-1,c;i>=0;i--)(c=r[i])&&(t=c(e,o,t)||t);return t&&g(e,o,t),t};class a extends h.Anchored(u.BaseColorPicker(s.VividElement)){constructor(){super(...arguments),this.placement="top-start",this.swatchesPerRow=7,this.#e=()=>{this.open||s.Updates.enqueue(()=>this.open=!0)},this.#t=e=>{(e.key==="Enter"||e.key===" ")&&(this.open||s.Updates.enqueue(()=>this.open=!0),e.preventDefault())},this._closeOnClickOutside=e=>{const o=!this.contains(e.target),n=this._anchorEl?.contains(e.target);(o||n)&&(this.open=!1)},this._closeOnEscape=e=>{e.key==="Escape"&&(this.open=!1)}}openChanged(){this._updateListeners(),this._anchorEl&&this.#o(this._anchorEl),this.open&&(this._refreshCanvasColor(),requestAnimationFrame(()=>{const e=this.swatches.findIndex(n=>n.value===this.value),o=e>=0?e:0;this._focusSwatchByIndex(o)}))}_getRowLength(){return this.swatchesPerRow}connectedCallback(){super.connectedCallback(),this._updateListeners()}disconnectedCallback(){super.disconnectedCallback(),this._updateListeners()}_updateListeners(){document.removeEventListener("click",this._closeOnClickOutside),document.removeEventListener("keydown",this._closeOnEscape),this.open&&this.isConnected&&(document.addEventListener("click",this._closeOnClickOutside),document.addEventListener("keydown",this._closeOnEscape))}_getFocusReturnEl(){return this._anchorEl??null}_anchorElChanged(e,o){e&&this.#r(e),o&&this.#s(o)}#o(e){e.setAttribute("aria-expanded",this.open.toString()),e.setAttribute("data-expanded",this.open.toString())}#s(e){this.#o(e),e.addEventListener("click",this.#e,!0),e.addEventListener("keydown",this.#t),e.setAttribute("aria-haspopup","true")}#r(e){e.removeEventListener("click",this.#e,!0),e.removeEventListener("keydown",this.#t),e.removeAttribute("aria-expanded"),e.removeAttribute("data-expanded"),e.removeAttribute("aria-haspopup")}#e;#t}d([s.attr({mode:"fromView"})],a.prototype,"placement");d([s.attr({attribute:"swatches-per-row",mode:"fromView",converter:s.nullableNumberConverter})],a.prototype,"swatchesPerRow");const _=r=>f.classNames("control"),k=r=>{const e=r.tagFor(l.Popup),o=r.tagFor(p.Icon),n=h.anchorSlotTemplateFactory();return s.html`
2
+ ${n}
3
3
  <${e}
4
- class="${q}"
4
+ class="${_}"
5
5
  :anchor="${t=>t._anchorEl}"
6
6
  :open="${t=>t.open}"
7
7
  placement="${t=>t.placement}"
8
8
  offset="4"
9
- @keydown="${(t,{event:s})=>!(t.open&&y.handleEscapeKeyAndStopPropogation(s))}"
9
+ @keydown="${(t,{event:i})=>!(t.open&&v.handleEscapeKeyAndStopPropogation(i))}"
10
10
  >
11
11
  <div class="palette" role="grid"
12
- aria-rowcount="${t=>Math.ceil(t.swatches.length/t.swatchesPerRow)}"
13
- aria-colcount="${t=>t.swatchesPerRow}"
14
- style="--swatches-per-row: ${t=>t.swatchesPerRow};"
12
+ aria-rowcount="${t=>Math.ceil(t.swatches.length/t._getRowLength())}"
13
+ aria-colcount="${t=>t._getRowLength()}"
14
+ style="--swatches-per-row: ${t=>t._getRowLength()};"
15
15
  aria-label="${t=>t.locale.simpleColorPicker.colorPaletteLabel}">
16
- ${_.repeat(t=>t.swatches,a.html`
17
- <button
18
- class="swatch ${(t,s)=>g.classNames(s.parent.value===t.value?"selected":"",s.parent._applyContrastClass(t.value)?"contrast":"")}"
19
- role="gridcell"
20
- style="--swatch-color: ${t=>t.value};"
21
- tabindex="${(t,s)=>s.index===0?"0":"-1"}"
22
- aria-label="${(t,s)=>s.parent.locale.simpleColorPicker.colorSwatchLabel(t.value,t.label,s.parent.value===t.value)}"
23
- @click="${(t,s)=>s.parent._handleSwatchSelection(t)}"
24
- @keydown="${(t,s)=>s.parent._handleSwatchKeydown(s.event,t,s.index)}"
25
- >
26
- ${E.when((t,s)=>s.parent.value===t.value,a.html`<${r} size="-6" name="check-solid" aria-hidden="true"></${r}>`)}
27
- </button>
28
- `,{positioning:!0})}
16
+ ${m.repeat(t=>t.swatches,t=>t._renderColorSwatch(o),{positioning:!0})}
29
17
  </div>
30
18
  </${e}>
31
- `},z=a.defineVividComponent("simple-color-picker",h,L,[v.popupDefinition,m.iconDefinition],{styles:x}),M=a.createRegisterFunction(z);M();
19
+ `},x=s.defineVividComponent("simple-color-picker",a,k,[l.popupDefinition,p.iconDefinition],{styles:w}),b=s.createRegisterFunction(x);b();