@vonage/vivid 4.24.0 → 4.25.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 (392) hide show
  1. package/custom-elements.json +12314 -4711
  2. package/elevation/index.cjs +1 -1
  3. package/elevation/index.js +1 -1
  4. package/index.cjs +112 -150
  5. package/index.js +37 -35
  6. package/lib/accordion-item/accordion-item.d.ts +6 -0
  7. package/lib/action-group/action-group.d.ts +6 -0
  8. package/lib/alert/alert.d.ts +20 -0
  9. package/lib/audio-player/audio-player.d.ts +6 -0
  10. package/lib/badge/badge.d.ts +9 -1
  11. package/lib/banner/banner.d.ts +25 -0
  12. package/lib/breadcrumb/breadcrumb.d.ts +6 -0
  13. package/lib/breadcrumb-item/breadcrumb-item.d.ts +63 -7
  14. package/lib/button/button.d.ts +732 -7
  15. package/lib/button/locale.d.ts +3 -0
  16. package/lib/calendar-event/calendar-event.d.ts +6 -0
  17. package/lib/card/card.d.ts +394 -2
  18. package/lib/card/card.template.d.ts +2 -1
  19. package/lib/checkbox/checkbox.d.ts +1822 -5
  20. package/lib/combobox/combobox.d.ts +1827 -20
  21. package/lib/data-grid/data-grid-cell.d.ts +339 -1
  22. package/lib/data-grid/locale.d.ts +5 -0
  23. package/lib/date-picker/date-picker.d.ts +1676 -207
  24. package/lib/date-range-picker/date-range-picker.d.ts +840 -107
  25. package/lib/date-time-picker/date-time-picker.d.ts +1678 -209
  26. package/lib/dial-pad/dial-pad.d.ts +8 -0
  27. package/lib/dialog/dialog.d.ts +12 -0
  28. package/lib/divider/divider.d.ts +6 -0
  29. package/lib/fab/fab.d.ts +6 -0
  30. package/lib/file-picker/file-picker.d.ts +1508 -30
  31. package/lib/header/header.d.ts +6 -0
  32. package/lib/icon/icon.d.ts +1 -0
  33. package/lib/icon/icon.template.d.ts +2 -1
  34. package/lib/menu/menu.d.ts +16 -7
  35. package/lib/menu/name.d.ts +1 -0
  36. package/lib/menu-item/menu-item.d.ts +14 -2
  37. package/lib/nav/nav.d.ts +6 -0
  38. package/lib/nav-disclosure/nav-disclosure.d.ts +13 -0
  39. package/lib/nav-item/nav-item.d.ts +405 -3
  40. package/lib/note/note.d.ts +6 -0
  41. package/lib/number-field/number-field.d.ts +1857 -36
  42. package/lib/option/option.d.ts +12 -0
  43. package/lib/progress/progress.d.ts +6 -0
  44. package/lib/progress-ring/progress-ring.d.ts +6 -0
  45. package/lib/radio/radio.d.ts +1137 -4
  46. package/lib/radio-group/radio-group.d.ts +20 -2
  47. package/lib/range-slider/range-slider.d.ts +752 -5
  48. package/lib/rich-text-editor/definition.d.ts +2 -2
  49. package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +3 -1
  50. package/lib/rich-text-editor/locale.d.ts +1 -0
  51. package/lib/rich-text-editor/menubar/menubar.d.ts +6 -0
  52. package/lib/rich-text-editor/rich-text-editor.d.ts +352 -2
  53. package/lib/searchable-select/option-tag.d.ts +6 -0
  54. package/lib/searchable-select/searchable-select.d.ts +1857 -36
  55. package/lib/select/select.d.ts +1843 -28
  56. package/lib/selectable-box/selectable-box.d.ts +6 -0
  57. package/lib/slider/slider.d.ts +384 -2
  58. package/lib/split-button/split-button.d.ts +18 -0
  59. package/lib/switch/switch.d.ts +386 -3
  60. package/lib/tab/tab.d.ts +18 -1
  61. package/lib/tab-panel/tab-panel.d.ts +6 -0
  62. package/lib/tag/tag.d.ts +12 -0
  63. package/lib/tag-group/tag-group.d.ts +6 -0
  64. package/lib/text-area/text-area.d.ts +2174 -19
  65. package/lib/text-field/text-field.d.ts +2195 -31
  66. package/lib/time-picker/time-picker.d.ts +839 -106
  67. package/lib/toggletip/toggletip.d.ts +10 -4
  68. package/lib/tooltip/tooltip.d.ts +10 -4
  69. package/lib/tree-item/tree-item.d.ts +12 -0
  70. package/lib/tree-view/tree-view.d.ts +6 -0
  71. package/lib/video-player/video-player.d.ts +6 -0
  72. package/lib/visually-hidden/definition.d.ts +4 -0
  73. package/lib/visually-hidden/visually-hidden.d.ts +3 -0
  74. package/lib/visually-hidden/visually-hidden.template.d.ts +3 -0
  75. package/locales/de-DE.cjs +33 -1
  76. package/locales/de-DE.js +33 -1
  77. package/locales/en-GB.cjs +33 -1
  78. package/locales/en-GB.js +33 -1
  79. package/locales/en-US.cjs +33 -1
  80. package/locales/en-US.js +33 -1
  81. package/locales/ja-JP.cjs +33 -1
  82. package/locales/ja-JP.js +33 -1
  83. package/locales/zh-CN.cjs +33 -1
  84. package/locales/zh-CN.js +33 -1
  85. package/menu/index.cjs +1 -1
  86. package/menu/index.js +1 -1
  87. package/nav/index.cjs +1 -1
  88. package/nav/index.js +1 -1
  89. package/nav-disclosure/index.cjs +1 -1
  90. package/nav-disclosure/index.js +1 -1
  91. package/nav-item/index.cjs +1 -1
  92. package/nav-item/index.js +1 -1
  93. package/note/index.cjs +1 -1
  94. package/note/index.js +1 -1
  95. package/number-field/index.cjs +1 -1
  96. package/number-field/index.js +1 -1
  97. package/option/index.cjs +1 -1
  98. package/option/index.js +1 -1
  99. package/package.json +1 -1
  100. package/pagination/index.cjs +1 -1
  101. package/pagination/index.js +1 -1
  102. package/popup/index.cjs +1 -1
  103. package/popup/index.js +1 -1
  104. package/progress/index.cjs +1 -1
  105. package/progress/index.js +1 -1
  106. package/progress-ring/index.cjs +1 -1
  107. package/progress-ring/index.js +1 -1
  108. package/radio/index.cjs +1 -1
  109. package/radio/index.js +1 -1
  110. package/radio-group/index.cjs +1 -1
  111. package/radio-group/index.js +1 -1
  112. package/range-slider/index.cjs +1 -1
  113. package/range-slider/index.js +1 -1
  114. package/rich-text-editor/index.cjs +1 -1
  115. package/rich-text-editor/index.js +1 -1
  116. package/searchable-select/index.cjs +1 -1
  117. package/searchable-select/index.js +1 -1
  118. package/select/index.cjs +1 -1
  119. package/select/index.js +1 -1
  120. package/selectable-box/index.cjs +1 -1
  121. package/selectable-box/index.js +1 -1
  122. package/shared/affix.cjs +13 -7
  123. package/shared/affix.js +13 -8
  124. package/shared/aria/delegates-aria.d.ts +6 -0
  125. package/shared/aria/host-semantics.d.ts +6 -0
  126. package/shared/breadcrumb-item.cjs +2 -5
  127. package/shared/breadcrumb-item.js +2 -5
  128. package/shared/button.cjs +13 -11
  129. package/shared/button.js +13 -11
  130. package/shared/calendar-picker.template.cjs +3 -3
  131. package/shared/calendar-picker.template.js +1 -1
  132. package/shared/char-count.cjs +92 -0
  133. package/shared/char-count.js +90 -0
  134. package/shared/definition.js +1 -1
  135. package/shared/definition10.js +1 -1
  136. package/shared/definition11.cjs +27 -44
  137. package/shared/definition11.js +28 -45
  138. package/shared/definition12.js +1 -1
  139. package/shared/definition13.js +1 -1
  140. package/shared/definition14.cjs +53 -22
  141. package/shared/definition14.js +54 -23
  142. package/shared/definition15.cjs +31 -36
  143. package/shared/definition15.js +30 -36
  144. package/shared/definition16.cjs +43 -63
  145. package/shared/definition16.js +42 -63
  146. package/shared/definition17.cjs +8 -4
  147. package/shared/definition17.js +8 -4
  148. package/shared/definition18.cjs +10 -14
  149. package/shared/definition18.js +9 -14
  150. package/shared/definition19.cjs +85 -100
  151. package/shared/definition19.js +75 -91
  152. package/shared/definition2.js +1 -1
  153. package/shared/definition20.cjs +15 -20
  154. package/shared/definition20.js +14 -20
  155. package/shared/definition21.cjs +22 -3
  156. package/shared/definition21.js +23 -4
  157. package/shared/definition22.cjs +4 -4
  158. package/shared/definition22.js +5 -5
  159. package/shared/definition23.cjs +5 -38
  160. package/shared/definition23.js +5 -37
  161. package/shared/definition24.cjs +2 -7
  162. package/shared/definition24.js +3 -8
  163. package/shared/definition25.js +1 -1
  164. package/shared/definition26.cjs +157 -171
  165. package/shared/definition26.js +156 -171
  166. package/shared/definition27.cjs +1 -1
  167. package/shared/definition27.js +2 -2
  168. package/shared/definition28.cjs +32 -17
  169. package/shared/definition28.js +33 -18
  170. package/shared/definition29.js +1 -1
  171. package/shared/definition3.js +1 -1
  172. package/shared/definition30.cjs +96 -482
  173. package/shared/definition30.js +99 -482
  174. package/shared/definition31.cjs +334 -57
  175. package/shared/definition31.js +333 -56
  176. package/shared/definition32.cjs +104 -19
  177. package/shared/definition32.js +105 -20
  178. package/shared/definition33.cjs +67 -15
  179. package/shared/definition33.js +66 -14
  180. package/shared/definition34.cjs +15 -50
  181. package/shared/definition34.js +14 -49
  182. package/shared/definition35.cjs +28 -397
  183. package/shared/definition35.js +27 -397
  184. package/shared/definition36.cjs +404 -54
  185. package/shared/definition36.js +404 -55
  186. package/shared/definition37.cjs +57 -234
  187. package/shared/definition37.js +57 -233
  188. package/shared/definition38.cjs +221 -66
  189. package/shared/definition38.js +220 -65
  190. package/shared/definition39.cjs +52 -44
  191. package/shared/definition39.js +51 -43
  192. package/shared/definition4.cjs +31 -24
  193. package/shared/definition4.js +33 -26
  194. package/shared/definition40.cjs +56 -266
  195. package/shared/definition40.js +55 -265
  196. package/shared/definition41.cjs +285 -142
  197. package/shared/definition41.js +285 -142
  198. package/shared/definition42.cjs +156 -564
  199. package/shared/definition42.js +156 -565
  200. package/shared/definition43.cjs +554 -14378
  201. package/shared/definition43.js +553 -14377
  202. package/shared/definition44.cjs +14418 -1155
  203. package/shared/definition44.js +14417 -1156
  204. package/shared/definition45.cjs +1049 -677
  205. package/shared/definition45.js +1050 -678
  206. package/shared/definition46.cjs +848 -113
  207. package/shared/definition46.js +847 -112
  208. package/shared/definition47.cjs +125 -90
  209. package/shared/definition47.js +124 -89
  210. package/shared/definition48.cjs +88 -455
  211. package/shared/definition48.js +87 -454
  212. package/shared/definition49.cjs +466 -109
  213. package/shared/definition49.js +466 -109
  214. package/shared/definition5.cjs +8 -7
  215. package/shared/definition5.js +6 -5
  216. package/shared/definition50.cjs +106 -106
  217. package/shared/definition50.js +105 -105
  218. package/shared/definition51.cjs +136 -15
  219. package/shared/definition51.js +135 -14
  220. package/shared/definition52.cjs +16 -115
  221. package/shared/definition52.js +15 -114
  222. package/shared/definition53.cjs +78 -412
  223. package/shared/definition53.js +77 -410
  224. package/shared/definition54.cjs +445 -23
  225. package/shared/definition54.js +443 -22
  226. package/shared/definition55.cjs +22 -136
  227. package/shared/definition55.js +21 -135
  228. package/shared/definition56.cjs +95 -291
  229. package/shared/definition56.js +95 -292
  230. package/shared/definition57.cjs +192 -480
  231. package/shared/definition57.js +190 -479
  232. package/shared/definition58.cjs +411 -24
  233. package/shared/definition58.js +410 -24
  234. package/shared/definition59.cjs +27 -144
  235. package/shared/definition59.js +27 -143
  236. package/shared/definition6.js +1 -1
  237. package/shared/definition60.cjs +83 -54
  238. package/shared/definition60.js +82 -53
  239. package/shared/definition61.cjs +78 -166
  240. package/shared/definition61.js +77 -164
  241. package/shared/definition62.cjs +143 -232
  242. package/shared/definition62.js +141 -231
  243. package/shared/definition63.cjs +234 -69417
  244. package/shared/definition63.js +233 -69416
  245. package/shared/definition64.cjs +69454 -28
  246. package/shared/definition64.js +69453 -27
  247. package/shared/definition65.cjs +28 -2168
  248. package/shared/definition65.js +27 -2166
  249. package/shared/definition66.cjs +27 -0
  250. package/shared/definition66.js +23 -0
  251. package/shared/definition67.cjs +2195 -0
  252. package/shared/definition67.js +2190 -0
  253. package/shared/definition7.cjs +11 -2
  254. package/shared/definition7.js +12 -3
  255. package/shared/definition8.cjs +24 -11
  256. package/shared/definition8.js +26 -13
  257. package/shared/definition9.cjs +1 -2
  258. package/shared/definition9.js +2 -3
  259. package/shared/delegates-aria.js +1 -1
  260. package/shared/deprecation/replaced-props.d.ts +20 -0
  261. package/shared/divider.cjs +41 -0
  262. package/shared/divider.js +38 -0
  263. package/shared/feedback/feedback-message.d.ts +345 -0
  264. package/shared/feedback/locale.d.ts +4 -0
  265. package/{lib/text-anchor/text-anchor.d.ts → shared/feedback/mixins.d.ts} +62 -39
  266. package/shared/form-associated.cjs +124 -100
  267. package/shared/form-associated.js +125 -101
  268. package/shared/form-element.cjs +84 -0
  269. package/shared/form-element.js +82 -0
  270. package/shared/foundation/button/button.d.ts +378 -2
  271. package/shared/foundation/form-associated/form-associated.d.ts +753 -49
  272. package/shared/foundation/listbox/listbox.d.ts +1 -1
  273. package/shared/foundation/vivid-element/vivid-element.d.ts +14 -0
  274. package/shared/host-semantics.js +1 -1
  275. package/shared/key-codes.js +1 -1
  276. package/shared/linkable.cjs +70 -0
  277. package/shared/linkable.js +68 -0
  278. package/shared/localization/Locale.d.ts +14 -0
  279. package/shared/mixins.cjs +306 -0
  280. package/shared/mixins.js +300 -0
  281. package/shared/patterns/affix.d.ts +16 -1
  282. package/shared/patterns/anchored.d.ts +20 -8
  283. package/shared/patterns/char-count/char-count.d.ts +351 -0
  284. package/shared/patterns/char-count/index.d.ts +1 -0
  285. package/shared/patterns/char-count/locale.d.ts +4 -0
  286. package/shared/patterns/form-elements/form-element.d.ts +744 -0
  287. package/shared/patterns/form-elements/index.d.ts +3 -1
  288. package/shared/patterns/form-elements/with-error-text.d.ts +1122 -0
  289. package/shared/patterns/form-elements/with-success-text.d.ts +341 -0
  290. package/shared/patterns/index.d.ts +2 -0
  291. package/shared/patterns/linkable.d.ts +394 -0
  292. package/shared/patterns/localized.d.ts +6 -0
  293. package/shared/patterns/trapped-focus.d.ts +6 -0
  294. package/shared/picker-field/mixins/calendar-picker.d.ts +420 -52
  295. package/shared/picker-field/mixins/calendar-picker.template.d.ts +420 -52
  296. package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +6 -0
  297. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +843 -107
  298. package/shared/picker-field/mixins/single-date-picker.d.ts +1259 -155
  299. package/shared/picker-field/mixins/single-value-picker.d.ts +417 -49
  300. package/shared/picker-field/mixins/time-selection-picker.d.ts +842 -106
  301. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +839 -103
  302. package/shared/picker-field/picker-field.d.ts +1491 -15
  303. package/shared/picker-field.template.cjs +13 -22
  304. package/shared/picker-field.template.js +14 -23
  305. package/shared/repeat.js +1 -1
  306. package/shared/slider.template.cjs +1 -1
  307. package/shared/slider.template.js +1 -1
  308. package/shared/time-selection-picker.template.cjs +10 -15
  309. package/shared/time-selection-picker.template.js +10 -16
  310. package/shared/vivid-element.cjs +53 -4
  311. package/shared/vivid-element.js +53 -3
  312. package/shared/with-error-text.cjs +56 -0
  313. package/shared/with-error-text.js +54 -0
  314. package/shared/with-success-text.cjs +23 -0
  315. package/shared/with-success-text.js +21 -0
  316. package/side-drawer/index.cjs +1 -1
  317. package/side-drawer/index.js +1 -1
  318. package/slider/index.cjs +1 -1
  319. package/slider/index.js +1 -1
  320. package/split-button/index.cjs +1 -1
  321. package/split-button/index.js +1 -1
  322. package/styles/core/all.css +1 -1
  323. package/styles/core/theme.css +1 -1
  324. package/styles/core/typography.css +1 -1
  325. package/styles/tokens/theme-dark.css +4 -4
  326. package/styles/tokens/theme-light.css +4 -4
  327. package/styles/tokens/vivid-2-compat.css +1 -1
  328. package/switch/index.cjs +1 -1
  329. package/switch/index.js +1 -1
  330. package/tab/index.cjs +1 -1
  331. package/tab/index.js +1 -1
  332. package/tab-panel/index.cjs +1 -1
  333. package/tab-panel/index.js +1 -1
  334. package/tabs/index.cjs +1 -1
  335. package/tabs/index.js +1 -1
  336. package/tag/index.cjs +1 -1
  337. package/tag/index.js +1 -1
  338. package/tag-group/index.cjs +1 -1
  339. package/tag-group/index.js +1 -1
  340. package/text-area/index.cjs +1 -1
  341. package/text-area/index.js +1 -1
  342. package/text-field/index.cjs +1 -1
  343. package/text-field/index.js +1 -1
  344. package/time-picker/index.cjs +1 -1
  345. package/time-picker/index.js +1 -1
  346. package/toggletip/index.cjs +1 -1
  347. package/toggletip/index.js +1 -1
  348. package/tooltip/index.cjs +1 -1
  349. package/tooltip/index.js +1 -1
  350. package/tree-item/index.cjs +1 -1
  351. package/tree-item/index.js +1 -1
  352. package/tree-view/index.cjs +1 -1
  353. package/tree-view/index.js +1 -1
  354. package/video-player/index.cjs +1 -1
  355. package/video-player/index.js +1 -1
  356. package/visually-hidden/index.cjs +5 -0
  357. package/visually-hidden/index.js +3 -0
  358. package/vivid.api.json +744 -1490
  359. package/lib/checkbox/checkbox.form-associated.d.ts +0 -11
  360. package/lib/file-picker/file-picker.form-associated.d.ts +0 -11
  361. package/lib/number-field/number-field.form-associated.d.ts +0 -11
  362. package/lib/radio/radio.form-associated.d.ts +0 -13
  363. package/lib/range-slider/range-slider.form-associated.d.ts +0 -11
  364. package/lib/searchable-select/searchable-select.form-associated.d.ts +0 -11
  365. package/lib/select/select.form-associated.d.ts +0 -11
  366. package/lib/slider/slider.form-associated.d.ts +0 -11
  367. package/lib/switch/switch.form-associated.d.ts +0 -11
  368. package/lib/text-anchor/definition.d.ts +0 -2
  369. package/lib/text-anchor/text-anchor.template.d.ts +0 -3
  370. package/lib/text-area/text-area.form-associated.d.ts +0 -11
  371. package/lib/text-field/text-field.form-associated.d.ts +0 -11
  372. package/shared/anchor.cjs +0 -49
  373. package/shared/anchor.js +0 -47
  374. package/shared/apply-mixins.cjs +0 -23
  375. package/shared/apply-mixins.js +0 -21
  376. package/shared/applyMixinsWithObservables.cjs +0 -15
  377. package/shared/applyMixinsWithObservables.js +0 -13
  378. package/shared/direction.cjs +0 -17
  379. package/shared/direction.js +0 -15
  380. package/shared/form-elements.cjs +0 -209
  381. package/shared/form-elements.js +0 -202
  382. package/shared/foundation/anchor/anchor.d.ts +0 -11
  383. package/shared/foundation/utilities/apply-mixins.d.ts +0 -1
  384. package/shared/patterns/form-elements/form-elements.d.ts +0 -58
  385. package/shared/picker-field/picker-field.form-associated.d.ts +0 -11
  386. package/shared/text-anchor.cjs +0 -38
  387. package/shared/text-anchor.js +0 -36
  388. package/shared/text-anchor.template.cjs +0 -35
  389. package/shared/text-anchor.template.js +0 -33
  390. package/shared/utils/applyMixinsWithObservables.d.ts +0 -1
  391. package/text-anchor/index.cjs +0 -17
  392. package/text-anchor/index.js +0 -15
@@ -1,34 +1,455 @@
1
- import { V as VividElement, h as html, g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
2
- import { D as DelegatesAria, d as delegateAria } from './delegates-aria.js';
1
+ import { T as Tab, t as tabDefinition } from './definition53.js';
2
+ import { t as tabPanelDefinition } from './definition52.js';
3
+ import { V as VividElement, D as DOM, a as attr, o as observable, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
4
+ import { i as keyArrowLeft, h as keyArrowRight, e as keyArrowUp, f as keyArrowDown, d as keyEnd, g as keyHome } from './key-codes.js';
5
+ import { u as uniqueId } from './strings.js';
6
+ import { l as limit } from './numbers.js';
3
7
  import { c as classNames } from './class-names.js';
8
+ import { r as ref } from './ref.js';
9
+ import { s as slotted } from './slotted.js';
4
10
 
5
- const styles = ".base{display:flex;flex-wrap:wrap;gap:8px}";
11
+ const styles = ":host{display:block}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base.connotation-cta{--_connotation-color-firm: var(--vvd-tabs-cta-firm, var(--vvd-color-cta-600))}.base:not(.connotation-cta){--_connotation-color-firm: var(--vvd-tabs-accent-firm, var(--vvd-color-canvas-text))}.base{--_tabs-tablist-gutter: 8px;--_tabs-active-indicator-stroke-width: 2px;display:grid;box-sizing:border-box}.base.orientation-vertical{overflow:hidden;block-size:inherit;grid-template-columns:auto 1fr;grid-template-rows:1fr}.base:not(.orientation-vertical){block-size:var(--tabs-block-size, auto);grid-template-columns:1fr;grid-template-rows:auto 1fr;max-block-size:100%}.base.layout-stretch .scroll-shadow{flex:1}.base:not(.orientation-vertical) .scroll-shadow{position:relative;overflow:hidden;isolation:isolate}.base:not(.orientation-vertical) .scroll-shadow.start-scroll:before,.base:not(.orientation-vertical) .scroll-shadow.start-scroll:after,.base:not(.orientation-vertical) .scroll-shadow.end-scroll:before,.base:not(.orientation-vertical) .scroll-shadow.end-scroll:after{position:absolute;content:\"\";inline-size:10px;inset-block:0;opacity:0;transition:opacity .1s}.base:not(.orientation-vertical) .scroll-shadow.start-scroll:before{z-index:1;box-shadow:inset 7px 1px 5px -3px var(--vvd-color-neutral-950);inset-inline-start:0;opacity:.2}.base:not(.orientation-vertical) .scroll-shadow.end-scroll:after{box-shadow:inset -7px 1px 5px -3px var(--vvd-color-neutral-950);inset-inline-end:0;opacity:.2}.tabs{display:flex;overflow:hidden}.base.orientation-vertical .tabs{flex-direction:column;box-shadow:1px 0 0 0 var(--vvd-color-neutral-300)}.base.orientation-horizontal .tabs{flex-direction:row;border-bottom:1px solid var(--vvd-color-neutral-300)}.tablist{position:relative;display:grid;overflow:hidden;box-sizing:border-box;color:var(--_appearance-color-text)}.base.layout-stretch .tablist{--_tab-justify-content: center;--_tabs-tablist-column: 1fr}.tablist .base:not(.layout-stretch){--_tabs-tablist-column: auto}.base.orientation-vertical .tablist{padding:var(--_tabs-tablist-gutter);block-size:fit-content;grid-row:1/2;grid-template-columns:auto 1fr;grid-template-rows:auto;inline-size:100%;min-block-size:100%;place-self:flex-start end;row-gap:var(--_tabs-tablist-gutter)}.base:not(.orientation-vertical) .tablist{justify-content:flex-start;column-gap:var(--_tabs-tablist-gutter);grid-auto-columns:var(--_tabs-tablist-column);grid-auto-flow:column;grid-template-rows:auto auto;inline-size:fit-content;min-inline-size:100%;padding-inline:var(--_tabs-tablist-gutter)}.base.has-action-items.orientation-vertical .tablist{padding-block-end:0}.base.has-action-items:not(.orientation-vertical) .tablist{padding-inline-end:0}.tablist-wrapper{--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.tablist-wrapper{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.tablist-wrapper ::-webkit-scrollbar{width:4px}.tablist-wrapper ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.tablist-wrapper ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-fallback-track-color, var(--scrollbar-thumb-color))}.base:not(.orientation-vertical) .tablist-wrapper{overflow:auto hidden;align-self:end;inline-size:100%}.base.orientation-vertical .tablist-wrapper{overflow:hidden auto;block-size:100%}.tablist-wrapper::-webkit-scrollbar{display:none}slot[name=action-items]{display:flex}.base.has-action-items.orientation-horizontal slot[name=action-items]{align-items:center;margin-inline:var(--_tabs-tablist-gutter)}.base.has-action-items.orientation-vertical slot[name=action-items]{margin-block:var(--_tabs-tablist-gutter)}.tabpanel{box-sizing:border-box;block-size:100%;min-block-size:0;min-inline-size:0}.base.scroll .tabpanel{overflow-y:auto;--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.base.scroll .tabpanel{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.base.scroll .tabpanel ::-webkit-scrollbar{width:4px}.base.scroll .tabpanel ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.base.scroll .tabpanel ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-fallback-track-color, var(--scrollbar-thumb-color))}.base.gutters-small .tabpanel{padding:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)) - (1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2))))}.active-indicator{background:currentColor;margin-inline-start:calc(var(--_tabs-tablist-gutter) * -1)}.base.orientation-vertical .active-indicator{align-self:center;border-radius:2px;block-size:80%;grid-area:1/1;inline-size:var(--_tabs-active-indicator-stroke-width)}.base:not(.orientation-vertical) .active-indicator{position:absolute;z-index:1;border-radius:2px;block-size:var(--_tabs-active-indicator-stroke-width);grid-area:2/1;inline-size:calc(var(--_tabs-active-tab-inline-size));inset-block-end:0;inset-inline-start:8px}.activeIndicatorTransition{transition:transform .2s ease-out 0s,inline-size .2s ease-out 0s}";
6
12
 
7
- class TagGroup extends DelegatesAria(VividElement) {
13
+ var __defProp = Object.defineProperty;
14
+ var __decorateClass = (decorators, target, key, kind) => {
15
+ var result = void 0 ;
16
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
17
+ if (decorator = decorators[i])
18
+ result = (decorator(target, key, result) ) || result;
19
+ if (result) __defProp(target, key, result);
20
+ return result;
21
+ };
22
+ const ACTIVE_TAB_WIDTH = "--_tabs-active-tab-inline-size";
23
+ const TabsGutters = {
24
+ None: "none",
25
+ Small: "small"
26
+ };
27
+ const TabsOrientation = {
28
+ vertical: "vertical",
29
+ horizontal: "horizontal"
30
+ };
31
+ const oppositeOrientation = (orientation) => orientation === TabsOrientation.horizontal ? TabsOrientation.vertical : TabsOrientation.horizontal;
32
+ const gridProperty = (orientation) => orientation === TabsOrientation.horizontal ? "gridColumn" : "gridRow";
33
+ const translateProperty = (orientation) => orientation === TabsOrientation.horizontal ? "translateX" : "translateY";
34
+ const offsetProperty = (orientation) => orientation === TabsOrientation.horizontal ? "offsetLeft" : "offsetTop";
35
+ const isFocusableElement = (el) => el.getAttribute("aria-disabled") !== "true" && !el.hasAttribute("hidden");
36
+ class Tabs extends VividElement {
37
+ constructor() {
38
+ super(...arguments);
39
+ // eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
40
+ this.orientation = TabsOrientation.horizontal;
41
+ this.tabs = [];
42
+ this.tabpanels = [];
43
+ this.#isTabsChangeQueued = false;
44
+ this.#lastActiveId = void 0;
45
+ this.#onTabClick = (event) => {
46
+ const selectedTab = event.currentTarget;
47
+ if (this._validTabs.includes(selectedTab)) {
48
+ this.#setActiveTabDueToUserInteraction(selectedTab);
49
+ }
50
+ };
51
+ this.#onTabKeyDown = (event) => {
52
+ const tabs = this._validTabs;
53
+ const activeTab = this.activetab;
54
+ if (!activeTab) {
55
+ return;
56
+ }
57
+ const [arrowKeyPrev, arrowKeyNext] = this.orientation === TabsOrientation.horizontal ? [keyArrowLeft, keyArrowRight] : [keyArrowUp, keyArrowDown];
58
+ const keyToNextTab = {
59
+ [arrowKeyPrev]: () => tabs[(tabs.indexOf(activeTab) - 1 + tabs.length) % tabs.length],
60
+ [arrowKeyNext]: () => tabs[(tabs.indexOf(activeTab) + 1) % tabs.length],
61
+ [keyHome]: () => tabs[0],
62
+ [keyEnd]: () => tabs[tabs.length - 1]
63
+ };
64
+ if (keyToNextTab[event.key]) {
65
+ event.preventDefault();
66
+ this.#setActiveTabDueToUserInteraction(keyToNextTab[event.key]());
67
+ }
68
+ };
69
+ this.#isTransitioningTransform = false;
70
+ this.scrollablePanel = false;
71
+ this._actionItemsSlottedContent = [];
72
+ // eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
73
+ this.activeindicator = true;
74
+ }
75
+ /**
76
+ * @internal
77
+ */
78
+ orientationChanged() {
79
+ this._registerTabsChange();
80
+ if (this.$fastController.isConnected) {
81
+ DOM.queueUpdate(() => this.#moveActiveIndicator(false));
82
+ }
83
+ }
84
+ /**
85
+ * @internal
86
+ */
87
+ tabsChanged() {
88
+ for (const tab of this.tabs) {
89
+ if (!tab.id) {
90
+ tab.id = `tab-${uniqueId()}`;
91
+ }
92
+ tab.addEventListener("click", this.#onTabClick);
93
+ tab.addEventListener("keydown", this.#onTabKeyDown);
94
+ }
95
+ this._registerTabsChange();
96
+ }
97
+ /**
98
+ * @internal
99
+ */
100
+ tabpanelsChanged() {
101
+ for (const panel of this.tabpanels) {
102
+ if (!panel.id) {
103
+ panel.id = `panel-${uniqueId()}`;
104
+ }
105
+ }
106
+ this._registerTabsChange();
107
+ }
108
+ /**
109
+ * Tabs that are paired with a tabpanel. Ignore any excess tabs or panels.
110
+ */
111
+ get _pairedTabs() {
112
+ return this.tabs.slice(
113
+ 0,
114
+ Math.min(this.tabs.length, this.tabpanels.length)
115
+ );
116
+ }
117
+ /**
118
+ * Tabs that are eligible to become active.
119
+ */
120
+ get _validTabs() {
121
+ return this._pairedTabs.filter(isFocusableElement);
122
+ }
123
+ /**
124
+ * @internal
125
+ */
126
+ activeidChanged() {
127
+ this._registerTabsChange();
128
+ }
129
+ /**
130
+ * A reference to the active tab
131
+ * @public
132
+ */
133
+ get activetab() {
134
+ return this._validTabs.find((tab) => tab.id === this.activeid) ?? null;
135
+ }
136
+ #setActiveTabDueToUserInteraction(tab) {
137
+ this.activeid = tab.id;
138
+ tab.focus();
139
+ this.$emit("change", tab);
140
+ }
141
+ #isTabsChangeQueued;
142
+ /**
143
+ * Defer actual processing of changes into a microtask to wait for all DOM changes to complete. E.g. when tabs and
144
+ * active id are updated at the same time.
145
+ */
146
+ _registerTabsChange() {
147
+ if (this.#isTabsChangeQueued) {
148
+ return;
149
+ }
150
+ this.#isTabsChangeQueued = true;
151
+ window.queueMicrotask(() => {
152
+ if (this.$fastController.isConnected) {
153
+ this.#handleTabsChange();
154
+ }
155
+ this.#isTabsChangeQueued = false;
156
+ });
157
+ }
158
+ #lastActiveId;
159
+ #handleTabsChange() {
160
+ const validTabs = this._validTabs;
161
+ let newActiveId = this.activeid;
162
+ if (!validTabs.length || newActiveId && !validTabs.find((t) => t.id === newActiveId)) {
163
+ newActiveId = void 0;
164
+ }
165
+ if (!newActiveId && validTabs.length) {
166
+ newActiveId = validTabs[0].id;
167
+ }
168
+ if (this.activeid !== newActiveId) {
169
+ this.activeid = newActiveId;
170
+ this.$emit("change", this.activetab);
171
+ }
172
+ this.#updateSlottedChildren();
173
+ if (this.activeid !== this.#lastActiveId) {
174
+ if (this.activetab) {
175
+ const shouldAnimate = this.#lastActiveId !== void 0;
176
+ this.#scrollToTab(this.activetab, shouldAnimate);
177
+ this.#moveActiveIndicator(shouldAnimate);
178
+ }
179
+ this.#lastActiveId = this.activeid;
180
+ } else {
181
+ this.#moveActiveIndicator(this.#isTransitioningTransform);
182
+ }
183
+ }
184
+ /**
185
+ * Updates the tabs and their panels according to the current state of the component.
186
+ */
187
+ #updateSlottedChildren() {
188
+ for (const [index, tab] of this._pairedTabs.entries()) {
189
+ const panel = this.tabpanels[index];
190
+ const isActiveTab = tab.id === this.activeid;
191
+ if (tab instanceof Tab) {
192
+ tab.active = isActiveTab;
193
+ }
194
+ tab.setAttribute("aria-controls", panel.id);
195
+ tab.setAttribute("tabindex", isActiveTab ? "0" : "-1");
196
+ if (isActiveTab && this.connotation) {
197
+ tab.setAttribute("connotation", this.connotation);
198
+ } else {
199
+ tab.removeAttribute("connotation");
200
+ }
201
+ tab.classList.toggle(
202
+ "vertical",
203
+ this.orientation === TabsOrientation.vertical
204
+ );
205
+ tab.style[gridProperty(oppositeOrientation(this.orientation))] = "";
206
+ tab.style[gridProperty(this.orientation)] = `${index + 1}`;
207
+ panel.setAttribute("aria-labelledby", tab.id);
208
+ panel.hidden = !isActiveTab;
209
+ }
210
+ }
211
+ #onTabClick;
212
+ #onTabKeyDown;
213
+ /**
214
+ * Adjusts the active index by numerical increments.
215
+ * Only enabled tabs are considered.
216
+ * @public
217
+ * @remarks
218
+ */
219
+ adjust(adjustment) {
220
+ const focusableTabs = this._validTabs;
221
+ const currentActiveTabIndex = focusableTabs.findIndex(
222
+ (t) => t.id === this.activeid
223
+ );
224
+ if (currentActiveTabIndex === -1) {
225
+ return;
226
+ }
227
+ const nextTabIndex = limit(
228
+ 0,
229
+ focusableTabs.length - 1,
230
+ currentActiveTabIndex + adjustment
231
+ );
232
+ this.#setActiveTabDueToUserInteraction(focusableTabs[nextTabIndex]);
233
+ }
234
+ #isTransitioningTransform;
235
+ /**
236
+ * @internal
237
+ */
238
+ _onActiveIndicatorTransitionend(event) {
239
+ if (event.propertyName === "transform") {
240
+ this.#isTransitioningTransform = false;
241
+ }
242
+ }
243
+ #cancelAnimationIfNeeded() {
244
+ this.#isTransitioningTransform = false;
245
+ this.activeIndicatorRef.classList.remove("activeIndicatorTransition");
246
+ }
247
+ #moveActiveIndicator(shouldAnimate) {
248
+ const activeTabIndex = this._pairedTabs.findIndex(
249
+ (tab) => tab.id === this.activeid
250
+ );
251
+ if (activeTabIndex === -1) {
252
+ return;
253
+ }
254
+ const indicatorEl = this.activeIndicatorRef;
255
+ const currentOffset = indicatorEl[offsetProperty(this.orientation)];
256
+ indicatorEl.style[gridProperty(this.orientation)] = `${activeTabIndex + 1}`;
257
+ const targetOffset = indicatorEl[offsetProperty(this.orientation)];
258
+ indicatorEl.style[gridProperty(this.orientation)] = "";
259
+ const relativeOffset = targetOffset - currentOffset;
260
+ const currentTransform = indicatorEl.style.transform;
261
+ const targetTransform = `${translateProperty(
262
+ this.orientation
263
+ )}(${relativeOffset}px)`;
264
+ if (shouldAnimate) {
265
+ indicatorEl.classList.add("activeIndicatorTransition");
266
+ if (currentTransform !== targetTransform) {
267
+ this.#isTransitioningTransform = true;
268
+ }
269
+ } else {
270
+ this.#cancelAnimationIfNeeded();
271
+ }
272
+ indicatorEl.style.transform = targetTransform;
273
+ indicatorEl.style.setProperty(
274
+ ACTIVE_TAB_WIDTH,
275
+ this.tabs[activeTabIndex].getBoundingClientRect().width + "px"
276
+ );
277
+ }
278
+ /**
279
+ * @internal
280
+ */
281
+ connotationChanged() {
282
+ this._registerTabsChange();
283
+ }
284
+ #updateScrollStatus() {
285
+ this.#tabListScrollWrapper.dispatchEvent(new Event("scroll"));
286
+ }
287
+ #resizeObserver;
288
+ connectedCallback() {
289
+ super.connectedCallback();
290
+ this._registerTabsChange();
291
+ requestAnimationFrame(() => this.#updateScrollStatus());
292
+ this.#resizeObserver = new ResizeObserver(() => {
293
+ this.#moveActiveIndicator(this.#isTransitioningTransform);
294
+ this.#updateScrollStatus();
295
+ });
296
+ this.#resizeObserver.observe(this.#tabListScrollWrapper);
297
+ this.#resizeObserver.observe(this.tablist);
298
+ }
299
+ disconnectedCallback() {
300
+ super.disconnectedCallback();
301
+ this.#resizeObserver.disconnect();
302
+ }
303
+ get #tabListWrapper() {
304
+ return this.shadowRoot.querySelector(".tablist-wrapper");
305
+ }
306
+ get #tabListScrollWrapper() {
307
+ return this.tablist.parentElement;
308
+ }
309
+ #scrollToTab(tab, shouldAnimate = true) {
310
+ const index = this.tabs.findIndex((t) => t === tab);
311
+ let left = 0;
312
+ let top = 0;
313
+ if (this.orientation === TabsOrientation.vertical) {
314
+ if (index === this.tabs.length - 1) {
315
+ top = this.#tabListWrapper.scrollHeight;
316
+ }
317
+ if (index > 0 && index < this.tabs.length - 1) {
318
+ top = tab.offsetTop - this.#tabListWrapper.offsetHeight / 2 + tab.offsetHeight / 2;
319
+ }
320
+ } else {
321
+ if (index === this.tabs.length - 1) {
322
+ left = this.#tabListWrapper.scrollWidth;
323
+ }
324
+ if (index > 0 && index < this.tabs.length - 1) {
325
+ left = tab.offsetLeft - this.#tabListWrapper.offsetWidth / 2 + tab.offsetWidth / 2;
326
+ }
327
+ }
328
+ this.#tabListWrapper.scrollTo({
329
+ top,
330
+ left,
331
+ behavior: shouldAnimate ? "smooth" : "instant"
332
+ });
333
+ }
8
334
  }
335
+ __decorateClass([
336
+ attr
337
+ ], Tabs.prototype, "orientation");
338
+ __decorateClass([
339
+ observable
340
+ ], Tabs.prototype, "tabs");
341
+ __decorateClass([
342
+ observable
343
+ ], Tabs.prototype, "tabpanels");
344
+ __decorateClass([
345
+ attr
346
+ ], Tabs.prototype, "activeid");
347
+ __decorateClass([
348
+ observable
349
+ ], Tabs.prototype, "activeIndicatorRef");
350
+ __decorateClass([
351
+ observable
352
+ ], Tabs.prototype, "tablist");
353
+ __decorateClass([
354
+ attr
355
+ ], Tabs.prototype, "connotation");
356
+ __decorateClass([
357
+ attr
358
+ ], Tabs.prototype, "gutters");
359
+ __decorateClass([
360
+ attr({ mode: "boolean", attribute: "scrollable-panel" })
361
+ ], Tabs.prototype, "scrollablePanel");
362
+ __decorateClass([
363
+ attr({ attribute: "tabs-layout" })
364
+ ], Tabs.prototype, "tabsLayout");
365
+ __decorateClass([
366
+ observable
367
+ ], Tabs.prototype, "_actionItemsSlottedContent");
368
+ __decorateClass([
369
+ attr({ mode: "boolean" })
370
+ ], Tabs.prototype, "activeindicator");
9
371
 
10
- const getClasses = (_) => classNames("base");
11
- const TagGroupTemplate = html`
12
- <div
13
- class="${getClasses}"
14
- ${delegateAria({
15
- role: "listbox",
16
- ariaOrientation: "horizontal"
17
- })}
18
- >
19
- <slot></slot>
20
- </div>
372
+ const getClasses = ({
373
+ connotation,
374
+ orientation,
375
+ gutters,
376
+ scrollablePanel,
377
+ tabsLayout,
378
+ _actionItemsSlottedContent
379
+ }) => classNames(
380
+ "base",
381
+ `layout-${tabsLayout ?? "align-start"}`,
382
+ [`connotation-${connotation}`, Boolean(connotation)],
383
+ [`orientation-${orientation}`, Boolean(orientation)],
384
+ `gutters-${gutters ?? "small"}`,
385
+ ["scroll", Boolean(scrollablePanel)],
386
+ ["has-action-items", Boolean(_actionItemsSlottedContent.length)]
387
+ );
388
+ function setNoScrollState(scrollShadow, scrollWrapper) {
389
+ if (scrollWrapper.scrollWidth <= scrollWrapper.clientWidth) {
390
+ scrollShadow.classList.toggle("start-scroll", false);
391
+ scrollShadow.classList.toggle("end-scroll", false);
392
+ return true;
393
+ }
394
+ return false;
395
+ }
396
+ function addStartShadow(scrollShadow, scrollWrapper) {
397
+ scrollShadow.classList.toggle("start-scroll", scrollWrapper.scrollLeft > 0);
398
+ }
399
+ function addEndShadow(scrollShadow, scrollWrapper) {
400
+ scrollShadow.classList.toggle(
401
+ "end-scroll",
402
+ scrollWrapper.scrollLeft + 1 < scrollWrapper.scrollWidth - scrollWrapper.clientWidth
403
+ );
404
+ }
405
+ function setShadowWhenScrollTabs(_, { event }) {
406
+ const scrollWrapper = event.currentTarget;
407
+ const scrollShadow = scrollWrapper.parentElement;
408
+ if (setNoScrollState(scrollShadow, scrollWrapper)) {
409
+ return;
410
+ }
411
+ addStartShadow(scrollShadow, scrollWrapper);
412
+ addEndShadow(scrollShadow, scrollWrapper);
413
+ }
414
+ const TabsTemplate = html`
415
+ <template>
416
+ <div class="${getClasses}">
417
+ <div class="tabs">
418
+ <div class="scroll-shadow">
419
+ <div class="tablist-wrapper" @scroll="${setShadowWhenScrollTabs}">
420
+ <div class="tablist" role="tablist" ${ref("tablist")}>
421
+ <slot name="tab" ${slotted("tabs")}></slot>
422
+ <div
423
+ ${ref("activeIndicatorRef")}
424
+ class="active-indicator"
425
+ @transitionend="${(x, c) => x._onActiveIndicatorTransitionend(
426
+ c.event
427
+ )}"
428
+ ></div>
429
+ </div>
430
+ </div>
431
+ </div>
432
+ <slot
433
+ name="action-items"
434
+ ${slotted("_actionItemsSlottedContent")}
435
+ ></slot>
436
+ </div>
437
+ <div class="tabpanel" part="tab-panel">
438
+ <slot name="tabpanel" ${slotted("tabpanels")}></slot>
439
+ </div>
440
+ </div>
441
+ </template>
21
442
  `;
22
443
 
23
- const tagGroupDefinition = defineVividComponent(
24
- "tag-group",
25
- TagGroup,
26
- TagGroupTemplate,
27
- [],
444
+ const tabsDefinition = defineVividComponent(
445
+ "tabs",
446
+ Tabs,
447
+ TabsTemplate,
448
+ [tabDefinition, tabPanelDefinition],
28
449
  {
29
450
  styles
30
451
  }
31
452
  );
32
- const registerTagGroup = createRegisterFunction(tagGroupDefinition);
453
+ const registerTabs = createRegisterFunction(tabsDefinition);
33
454
 
34
- export { TagGroup as T, registerTagGroup as r, tagGroupDefinition as t };
455
+ export { Tabs as T, TabsGutters as a, registerTabs as r, tabsDefinition as t };
@@ -1,152 +1,38 @@
1
1
  'use strict';
2
2
 
3
- const definition = require('./definition28.cjs');
4
3
  const vividElement = require('./vivid-element.cjs');
5
- const affix = require('./affix.cjs');
6
4
  const delegatesAria = require('./delegates-aria.cjs');
7
5
  const classNames = require('./class-names.cjs');
8
- const when = require('./when.cjs');
9
6
 
10
- var __defProp = Object.defineProperty;
11
- var __decorateClass = (decorators, target, key, kind) => {
12
- var result = void 0 ;
13
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
14
- if (decorator = decorators[i])
15
- result = (decorator(target, key, result) ) || result;
16
- if (result) __defProp(target, key, result);
17
- return result;
18
- };
19
- class Tag extends delegatesAria.DelegatesAria(affix.AffixIcon(vividElement.VividElement)) {
20
- constructor() {
21
- super(...arguments);
22
- this.removable = false;
23
- this.disabled = false;
24
- this.selectable = false;
25
- this.selected = false;
26
- this.#select = () => {
27
- if (!this.selectable || this.disabled) {
28
- return;
29
- }
30
- this.selected = !this.selected;
31
- this.$emit("selected-change");
32
- };
33
- }
34
- remove() {
35
- if (!this.removable || this.selectable) {
36
- return;
37
- }
38
- this.$emit("removed");
39
- this.parentElement && this.parentElement.removeChild(this);
40
- }
41
- #select;
42
- handleKeydown(e) {
43
- if (e.key === "Enter") {
44
- this.#select();
45
- }
46
- if (e.key === "Delete" || e.key === "Backspace") {
47
- this.remove();
48
- }
49
- return true;
50
- }
51
- handleClick() {
52
- this.#select();
53
- }
54
- }
55
- __decorateClass([
56
- vividElement.attr
57
- ], Tag.prototype, "connotation");
58
- __decorateClass([
59
- vividElement.attr
60
- ], Tag.prototype, "shape");
61
- __decorateClass([
62
- vividElement.attr
63
- ], Tag.prototype, "appearance");
64
- __decorateClass([
65
- vividElement.attr
66
- ], Tag.prototype, "label");
67
- __decorateClass([
68
- vividElement.attr({ mode: "boolean" })
69
- ], Tag.prototype, "removable");
70
- __decorateClass([
71
- vividElement.attr({ mode: "boolean" })
72
- ], Tag.prototype, "disabled");
73
- __decorateClass([
74
- vividElement.attr({ mode: "boolean" })
75
- ], Tag.prototype, "selectable");
76
- __decorateClass([
77
- vividElement.attr({ mode: "boolean" })
78
- ], Tag.prototype, "selected");
79
-
80
- const styles = ".base.connotation-cta{--_connotation-color-contrast: var(--vvd-tag-cta-contrast, var(--vvd-color-cta-800));--_connotation-color-soft: var(--vvd-tag-cta-soft, var(--vvd-color-cta-100));--_connotation-color-pale: var(--vvd-tag-cta-pale, var(--vvd-color-cta-300));--_connotation-color-fierce: var(--vvd-tag-cta-fierce, var(--vvd-color-cta-700));--_connotation-color-firm-all: var(--vvd-tag-cta-firm-all, var(--vvd-color-cta-600));--_connotation-color-faint: var(--vvd-tag-cta-faint, var(--vvd-color-cta-50));--_connotation-color-dim: var(--vvd-tag-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-contrast: var(--vvd-tag-accent-contrast, var(--vvd-color-neutral-800));--_connotation-color-soft: var(--vvd-tag-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-tag-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-fierce: var(--vvd-tag-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-firm-all: var(--vvd-tag-accent-firm-all, var(--vvd-color-neutral-600));--_connotation-color-faint: var(--vvd-tag-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-dim: var(--vvd-tag-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-contrast);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base.appearance-duotone{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-pale)}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-contrast);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-duotone{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-firm-all)}.base:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-contrast);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base:where(.active,:active):where(:not(.disabled,:disabled)).appearance-duotone{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: var(--_connotation-color-pale)}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled).appearance-duotone{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--vvd-color-neutral-100)}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-contrast);--_appearance-color-fill: var(--_connotation-color-pale);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)).appearance-duotone{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: var(--_connotation-color-pale)}.base{--tag-block-size: calc(1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;position:relative;display:inline-flex;box-sizing:border-box;align-items:center;background-color:var(--_appearance-color-fill);block-size:var(--tag-block-size);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);column-gap:8px;font:var(--vvd-typography-base-bold);max-inline-size:100%;padding-inline:8px;vertical-align:middle}.base:not(.shape-pill){border-radius:4px}.base.shape-pill{border-radius:16px}.base:focus-visible{--focus-stroke-gap-color: transparent;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))}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){cursor:pointer}.base.disabled{cursor:not-allowed;pointer-events:none}.base.removable{cursor:auto}.label{overflow:hidden;max-inline-size:100%;text-overflow:ellipsis;white-space:nowrap}slot[name=icon]{font-size:calc(var(--tag-block-size) / 1.5);line-height:1}.dismiss-button{display:flex;align-items:center;border-radius:inherit;background-color:var(--_appearance-color-fill);cursor:pointer}";
7
+ const styles = ".base{display:flex;flex-wrap:wrap;gap:8px}";
81
8
 
82
- const getClasses = ({
83
- connotation,
84
- appearance,
85
- shape,
86
- disabled,
87
- selectable,
88
- removable,
89
- selected
90
- }) => classNames.classNames(
91
- "base",
92
- ["disabled", disabled],
93
- ["selectable", selectable],
94
- ["selected", selectable && selected],
95
- ["removable", removable && !selectable],
96
- [`connotation-${connotation}`, Boolean(connotation)],
97
- [`appearance-${appearance}`, Boolean(appearance)],
98
- [`shape-${shape}`, Boolean(shape)]
99
- );
100
- function renderDismissButton(iconTag) {
101
- return vividElement.html`
102
- <span
103
- aria-hidden="true"
104
- class="dismiss-button"
105
- @click="${(x) => x.remove()}">
106
- <${iconTag} name="close-line"></${iconTag}>
107
- </span>`;
9
+ class TagGroup extends delegatesAria.DelegatesAria(vividElement.VividElement) {
108
10
  }
109
- const tagTemplate = (context) => {
110
- const affixIconTemplate = affix.affixIconTemplateFactory(context);
111
- const iconTag = context.tagFor(definition.Icon);
112
- return vividElement.html` <span
11
+
12
+ const getClasses = (_) => classNames.classNames("base");
13
+ const TagGroupTemplate = vividElement.html`
14
+ <div
113
15
  class="${getClasses}"
114
16
  ${delegatesAria.delegateAria({
115
- role: "option",
116
- ariaDisabled: (x) => x.disabled,
117
- ariaSelected: (x) => x.selectable
118
- })}
119
- tabindex="${(x) => x.disabled ? null : 0}"
120
- @keydown="${(x, c) => x.handleKeydown(c.event)}"
121
- @click="${(x) => x.handleClick()}"
17
+ role: "listbox",
18
+ ariaOrientation: "horizontal"
19
+ })}
122
20
  >
123
- ${(x) => affixIconTemplate(x.icon, affix.IconWrapper.Slot)}
124
- ${when.when(
125
- (x) => x.label,
126
- (x) => vividElement.html`<span class="label">${x.label}</span>`
127
- )}
128
- ${when.when((x) => x.removable && !x.selectable, renderDismissButton(iconTag))}
129
- ${when.when(
130
- (x) => x.selectable && x.selected,
131
- vividElement.html`<${iconTag} class="selectable-icon" name="check-circle-solid"></${iconTag}>`
132
- )}
133
- </span>`;
134
- };
21
+ <slot></slot>
22
+ </div>
23
+ `;
135
24
 
136
- const tagDefinition = vividElement.defineVividComponent(
137
- "tag",
138
- Tag,
139
- tagTemplate,
140
- [definition.iconDefinition],
25
+ const tagGroupDefinition = vividElement.defineVividComponent(
26
+ "tag-group",
27
+ TagGroup,
28
+ TagGroupTemplate,
29
+ [],
141
30
  {
142
- styles,
143
- shadowOptions: {
144
- delegatesFocus: true
145
- }
31
+ styles
146
32
  }
147
33
  );
148
- const registerTag = vividElement.createRegisterFunction(tagDefinition);
34
+ const registerTagGroup = vividElement.createRegisterFunction(tagGroupDefinition);
149
35
 
150
- exports.Tag = Tag;
151
- exports.registerTag = registerTag;
152
- exports.tagDefinition = tagDefinition;
36
+ exports.TagGroup = TagGroup;
37
+ exports.registerTagGroup = registerTagGroup;
38
+ exports.tagGroupDefinition = tagGroupDefinition;