vira 32.0.0-beta.0 → 32.1.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 (288) hide show
  1. package/dist/elements/color/vira-all-color-space-sliders.element.d.ts +11 -0
  2. package/dist/elements/color/vira-all-color-space-sliders.element.js +55 -0
  3. package/dist/elements/color/vira-all-spaces-color-picker.element.d.ts +15 -0
  4. package/dist/elements/color/vira-all-spaces-color-picker.element.js +73 -0
  5. package/dist/elements/color/vira-color-details.element.d.ts +14 -0
  6. package/{src/elements/color/vira-color-details.element.ts → dist/elements/color/vira-color-details.element.js} +43 -59
  7. package/dist/elements/color/vira-color-format-sliders.element.d.ts +14 -0
  8. package/dist/elements/color/vira-color-format-sliders.element.js +60 -0
  9. package/dist/elements/color/vira-color-pair-contrast-summary.element.d.ts +9 -0
  10. package/{src/elements/color/vira-color-pair-contrast-summary.element.ts → dist/elements/color/vira-color-pair-contrast-summary.element.js} +68 -100
  11. package/dist/elements/color/vira-color-pair.element.d.ts +17 -0
  12. package/{src/elements/color/vira-color-pair.element.ts → dist/elements/color/vira-color-pair.element.js} +50 -71
  13. package/dist/elements/color/vira-color-picker.element.d.ts +20 -0
  14. package/{src/elements/color/vira-color-picker.element.ts → dist/elements/color/vira-color-picker.element.js} +92 -117
  15. package/dist/elements/color/vira-color-slider.element.d.ts +14 -0
  16. package/dist/elements/color/vira-color-slider.element.js +124 -0
  17. package/dist/elements/color/vira-color-swatch.element.d.ts +20 -0
  18. package/{src/elements/color/vira-color-swatch.element.ts → dist/elements/color/vira-color-swatch.element.js} +6 -16
  19. package/dist/elements/color/vira-contrast-indicator.element.d.ts +10 -0
  20. package/{src/elements/color/vira-contrast-indicator.element.ts → dist/elements/color/vira-contrast-indicator.element.js} +13 -28
  21. package/dist/elements/index.js +39 -0
  22. package/dist/elements/pop-up/vira-menu-item.element.d.ts +38 -0
  23. package/{src/elements/pop-up/vira-menu-item.element.ts → dist/elements/pop-up/vira-menu-item.element.js} +80 -117
  24. package/dist/elements/pop-up/vira-menu-trigger.element.d.ts +45 -0
  25. package/dist/elements/pop-up/vira-menu-trigger.element.js +100 -0
  26. package/dist/elements/pop-up/vira-menu.element.d.ts +36 -0
  27. package/{src/elements/pop-up/vira-menu.element.ts → dist/elements/pop-up/vira-menu.element.js} +28 -31
  28. package/dist/elements/pop-up/vira-pop-up-trigger.element.d.ts +109 -0
  29. package/dist/elements/pop-up/vira-pop-up-trigger.element.js +408 -0
  30. package/dist/elements/vira-absolute-time.element.d.ts +35 -0
  31. package/dist/elements/vira-absolute-time.element.js +43 -0
  32. package/dist/elements/vira-bold-text.element.d.ts +9 -0
  33. package/{src/elements/vira-bold-text.element.ts → dist/elements/vira-bold-text.element.js} +11 -10
  34. package/dist/elements/vira-button.element.d.ts +40 -0
  35. package/{src/elements/vira-button.element.ts → dist/elements/vira-button.element.js} +114 -261
  36. package/dist/elements/vira-card.element.d.ts +18 -0
  37. package/{src/elements/vira-card.element.ts → dist/elements/vira-card.element.js} +19 -18
  38. package/dist/elements/vira-checkbox.element.d.ts +44 -0
  39. package/{src/elements/vira-checkbox.element.ts → dist/elements/vira-checkbox.element.js} +48 -95
  40. package/dist/elements/vira-collapsible-card.element.d.ts +36 -0
  41. package/{src/elements/vira-collapsible-card.element.ts → dist/elements/vira-collapsible-card.element.js} +44 -71
  42. package/dist/elements/vira-collapsible-wrapper.element.d.ts +30 -0
  43. package/{src/elements/vira-collapsible-wrapper.element.ts → dist/elements/vira-collapsible-wrapper.element.js} +47 -59
  44. package/dist/elements/vira-date-input.element.d.ts +47 -0
  45. package/dist/elements/vira-date-input.element.js +142 -0
  46. package/dist/elements/vira-drawer.element.d.ts +24 -0
  47. package/{src/elements/vira-drawer.element.ts → dist/elements/vira-drawer.element.js} +98 -125
  48. package/dist/elements/vira-dropdown.element.d.ts +43 -0
  49. package/dist/elements/vira-dropdown.element.js +247 -0
  50. package/dist/elements/vira-error.element.d.ts +7 -0
  51. package/{src/elements/vira-error.element.ts → dist/elements/vira-error.element.js} +7 -8
  52. package/dist/elements/vira-form.element.d.ts +56 -0
  53. package/dist/elements/vira-form.element.js +376 -0
  54. package/dist/elements/vira-icon.element.d.ts +13 -0
  55. package/{src/elements/vira-icon.element.ts → dist/elements/vira-icon.element.js} +12 -16
  56. package/dist/elements/vira-image.element.d.ts +45 -0
  57. package/{src/elements/vira-image.element.ts → dist/elements/vira-image.element.js} +50 -70
  58. package/dist/elements/vira-input.element.d.ts +64 -0
  59. package/{src/elements/vira-input.element.ts → dist/elements/vira-input.element.js} +112 -167
  60. package/dist/elements/vira-json-form.element.d.ts +35 -0
  61. package/{src/elements/vira-json-form.element.ts → dist/elements/vira-json-form.element.js} +356 -522
  62. package/dist/elements/vira-link.element.d.ts +78 -0
  63. package/{src/elements/vira-link.element.ts → dist/elements/vira-link.element.js} +24 -83
  64. package/dist/elements/vira-modal.element.d.ts +40 -0
  65. package/{src/elements/vira-modal.element.ts → dist/elements/vira-modal.element.js} +68 -104
  66. package/dist/elements/vira-progress.element.d.ts +18 -0
  67. package/{src/elements/vira-progress.element.ts → dist/elements/vira-progress.element.js} +12 -25
  68. package/dist/elements/vira-relative-time.element.d.ts +42 -0
  69. package/dist/elements/vira-relative-time.element.js +96 -0
  70. package/dist/elements/vira-select.element.d.ts +44 -0
  71. package/{src/elements/vira-select.element.ts → dist/elements/vira-select.element.js} +89 -138
  72. package/dist/elements/vira-tabs.element.d.ts +124 -0
  73. package/{src/elements/vira-tabs.element.ts → dist/elements/vira-tabs.element.js} +243 -446
  74. package/dist/elements/vira-tag.element.d.ts +40 -0
  75. package/{src/elements/vira-tag.element.ts → dist/elements/vira-tag.element.js} +152 -266
  76. package/dist/elements/vira-text-area.element.d.ts +48 -0
  77. package/{src/elements/vira-text-area.element.ts → dist/elements/vira-text-area.element.js} +52 -70
  78. package/dist/elements/vira-theme-switcher.element.d.ts +17 -0
  79. package/{src/elements/vira-theme-switcher.element.ts → dist/elements/vira-theme-switcher.element.js} +34 -49
  80. package/dist/icons/colored-icon.d.ts +11 -0
  81. package/{src/icons/colored-icon.ts → dist/icons/colored-icon.js} +17 -24
  82. package/dist/icons/icon-css-vars.d.ts +14 -0
  83. package/{src/icons/icon-css-vars.ts → dist/icons/icon-css-vars.js} +1 -2
  84. package/{src/icons/icon-svg.ts → dist/icons/icon-svg.d.ts} +3 -15
  85. package/dist/icons/icon-svg.js +12 -0
  86. package/dist/icons/icon-svgs/16/check-16.icon.d.ts +8 -0
  87. package/{src/icons/icon-svgs/16/check-16.icon.ts → dist/icons/icon-svgs/16/check-16.icon.js} +4 -5
  88. package/dist/icons/icon-svgs/16/chevron-down-16.icon.d.ts +8 -0
  89. package/{src/icons/icon-svgs/16/chevron-down-16.icon.ts → dist/icons/icon-svgs/16/chevron-down-16.icon.js} +4 -5
  90. package/dist/icons/icon-svgs/16/chevron-up-16.icon.d.ts +8 -0
  91. package/{src/icons/icon-svgs/16/chevron-up-16.icon.ts → dist/icons/icon-svgs/16/chevron-up-16.icon.js} +4 -5
  92. package/dist/icons/icon-svgs/16/dash-16.icon.d.ts +8 -0
  93. package/{src/icons/icon-svgs/16/dash-16.icon.ts → dist/icons/icon-svgs/16/dash-16.icon.js} +4 -5
  94. package/dist/icons/icon-svgs/16/element-16.icon.d.ts +8 -0
  95. package/{src/icons/icon-svgs/16/element-16.icon.ts → dist/icons/icon-svgs/16/element-16.icon.js} +4 -5
  96. package/dist/icons/icon-svgs/16/plus-16.icon.d.ts +8 -0
  97. package/{src/icons/icon-svgs/16/plus-16.icon.ts → dist/icons/icon-svgs/16/plus-16.icon.js} +4 -5
  98. package/dist/icons/icon-svgs/16/upload-16.icon.d.ts +8 -0
  99. package/{src/icons/icon-svgs/16/upload-16.icon.ts → dist/icons/icon-svgs/16/upload-16.icon.js} +4 -5
  100. package/dist/icons/icon-svgs/16/x-16.icon.d.ts +8 -0
  101. package/{src/icons/icon-svgs/16/x-16.icon.ts → dist/icons/icon-svgs/16/x-16.icon.js} +4 -5
  102. package/dist/icons/icon-svgs/24/arrow-down-24.icon.d.ts +8 -0
  103. package/{src/icons/icon-svgs/24/arrow-down-24.icon.ts → dist/icons/icon-svgs/24/arrow-down-24.icon.js} +4 -5
  104. package/dist/icons/icon-svgs/24/arrow-left-24.icon.d.ts +8 -0
  105. package/{src/icons/icon-svgs/24/arrow-left-24.icon.ts → dist/icons/icon-svgs/24/arrow-left-24.icon.js} +4 -5
  106. package/dist/icons/icon-svgs/24/arrow-right-24.icon.d.ts +8 -0
  107. package/{src/icons/icon-svgs/24/arrow-right-24.icon.ts → dist/icons/icon-svgs/24/arrow-right-24.icon.js} +4 -5
  108. package/dist/icons/icon-svgs/24/arrow-up-24.icon.d.ts +8 -0
  109. package/{src/icons/icon-svgs/24/arrow-up-24.icon.ts → dist/icons/icon-svgs/24/arrow-up-24.icon.js} +4 -5
  110. package/dist/icons/icon-svgs/24/auto-theme-24.icon.d.ts +8 -0
  111. package/{src/icons/icon-svgs/24/auto-theme-24.icon.ts → dist/icons/icon-svgs/24/auto-theme-24.icon.js} +4 -5
  112. package/dist/icons/icon-svgs/24/bell-24.icon.d.ts +8 -0
  113. package/{src/icons/icon-svgs/24/bell-24.icon.ts → dist/icons/icon-svgs/24/bell-24.icon.js} +4 -5
  114. package/dist/icons/icon-svgs/24/chat-24.icon.d.ts +8 -0
  115. package/{src/icons/icon-svgs/24/chat-24.icon.ts → dist/icons/icon-svgs/24/chat-24.icon.js} +4 -5
  116. package/dist/icons/icon-svgs/24/check-24.icon.d.ts +8 -0
  117. package/{src/icons/icon-svgs/24/check-24.icon.ts → dist/icons/icon-svgs/24/check-24.icon.js} +4 -5
  118. package/dist/icons/icon-svgs/24/chevron-down-24.icon.d.ts +8 -0
  119. package/{src/icons/icon-svgs/24/chevron-down-24.icon.ts → dist/icons/icon-svgs/24/chevron-down-24.icon.js} +4 -5
  120. package/dist/icons/icon-svgs/24/chevron-up-24.icon.d.ts +8 -0
  121. package/{src/icons/icon-svgs/24/chevron-up-24.icon.ts → dist/icons/icon-svgs/24/chevron-up-24.icon.js} +4 -5
  122. package/dist/icons/icon-svgs/24/close-x-24.icon.d.ts +8 -0
  123. package/{src/icons/icon-svgs/24/close-x-24.icon.ts → dist/icons/icon-svgs/24/close-x-24.icon.js} +4 -5
  124. package/dist/icons/icon-svgs/24/commit-24.icon.d.ts +8 -0
  125. package/{src/icons/icon-svgs/24/commit-24.icon.ts → dist/icons/icon-svgs/24/commit-24.icon.js} +4 -5
  126. package/dist/icons/icon-svgs/24/copy-24.icon.d.ts +8 -0
  127. package/{src/icons/icon-svgs/24/copy-24.icon.ts → dist/icons/icon-svgs/24/copy-24.icon.js} +4 -5
  128. package/dist/icons/icon-svgs/24/document-24.icon.d.ts +8 -0
  129. package/{src/icons/icon-svgs/24/document-24.icon.ts → dist/icons/icon-svgs/24/document-24.icon.js} +4 -5
  130. package/dist/icons/icon-svgs/24/document-search-24.icon.d.ts +8 -0
  131. package/{src/icons/icon-svgs/24/document-search-24.icon.ts → dist/icons/icon-svgs/24/document-search-24.icon.js} +4 -5
  132. package/dist/icons/icon-svgs/24/double-chevron-24.icon.d.ts +8 -0
  133. package/{src/icons/icon-svgs/24/double-chevron-24.icon.ts → dist/icons/icon-svgs/24/double-chevron-24.icon.js} +4 -5
  134. package/dist/icons/icon-svgs/24/element-24.icon.d.ts +8 -0
  135. package/{src/icons/icon-svgs/24/element-24.icon.ts → dist/icons/icon-svgs/24/element-24.icon.js} +4 -5
  136. package/dist/icons/icon-svgs/24/external-link-24.icon.d.ts +8 -0
  137. package/{src/icons/icon-svgs/24/external-link-24.icon.ts → dist/icons/icon-svgs/24/external-link-24.icon.js} +4 -5
  138. package/dist/icons/icon-svgs/24/eye-closed-24.icon.d.ts +8 -0
  139. package/{src/icons/icon-svgs/24/eye-closed-24.icon.ts → dist/icons/icon-svgs/24/eye-closed-24.icon.js} +4 -5
  140. package/dist/icons/icon-svgs/24/eye-open-24.icon.d.ts +8 -0
  141. package/{src/icons/icon-svgs/24/eye-open-24.icon.ts → dist/icons/icon-svgs/24/eye-open-24.icon.js} +4 -5
  142. package/dist/icons/icon-svgs/24/filter-24.icon.d.ts +8 -0
  143. package/{src/icons/icon-svgs/24/filter-24.icon.ts → dist/icons/icon-svgs/24/filter-24.icon.js} +4 -5
  144. package/dist/icons/icon-svgs/24/globe-24.icon.d.ts +8 -0
  145. package/{src/icons/icon-svgs/24/globe-24.icon.ts → dist/icons/icon-svgs/24/globe-24.icon.js} +4 -5
  146. package/dist/icons/icon-svgs/24/link-24.icon.d.ts +8 -0
  147. package/{src/icons/icon-svgs/24/link-24.icon.ts → dist/icons/icon-svgs/24/link-24.icon.js} +4 -5
  148. package/dist/icons/icon-svgs/24/loader-24.icon.d.ts +8 -0
  149. package/{src/icons/icon-svgs/24/loader-24.icon.ts → dist/icons/icon-svgs/24/loader-24.icon.js} +4 -5
  150. package/dist/icons/icon-svgs/24/loader-animated-24.icon.d.ts +8 -0
  151. package/{src/icons/icon-svgs/24/loader-animated-24.icon.ts → dist/icons/icon-svgs/24/loader-animated-24.icon.js} +6 -8
  152. package/dist/icons/icon-svgs/24/lock-24.icon.d.ts +8 -0
  153. package/{src/icons/icon-svgs/24/lock-24.icon.ts → dist/icons/icon-svgs/24/lock-24.icon.js} +4 -5
  154. package/dist/icons/icon-svgs/24/magnifying-glass-24.icon.d.ts +8 -0
  155. package/{src/icons/icon-svgs/24/magnifying-glass-24.icon.ts → dist/icons/icon-svgs/24/magnifying-glass-24.icon.js} +4 -5
  156. package/dist/icons/icon-svgs/24/moon-24.icon.d.ts +8 -0
  157. package/{src/icons/icon-svgs/24/moon-24.icon.ts → dist/icons/icon-svgs/24/moon-24.icon.js} +4 -5
  158. package/dist/icons/icon-svgs/24/options-24.icon.d.ts +8 -0
  159. package/{src/icons/icon-svgs/24/options-24.icon.ts → dist/icons/icon-svgs/24/options-24.icon.js} +4 -5
  160. package/dist/icons/icon-svgs/24/pencil-24.icon.d.ts +8 -0
  161. package/{src/icons/icon-svgs/24/pencil-24.icon.ts → dist/icons/icon-svgs/24/pencil-24.icon.js} +4 -5
  162. package/dist/icons/icon-svgs/24/plus-24.icon.d.ts +8 -0
  163. package/{src/icons/icon-svgs/24/plus-24.icon.ts → dist/icons/icon-svgs/24/plus-24.icon.js} +4 -5
  164. package/dist/icons/icon-svgs/24/printer-24.icon.d.ts +8 -0
  165. package/{src/icons/icon-svgs/24/printer-24.icon.ts → dist/icons/icon-svgs/24/printer-24.icon.js} +4 -5
  166. package/dist/icons/icon-svgs/24/shield-24.icon.d.ts +8 -0
  167. package/{src/icons/icon-svgs/24/shield-24.icon.ts → dist/icons/icon-svgs/24/shield-24.icon.js} +4 -5
  168. package/dist/icons/icon-svgs/24/sort-ascending-24.icon.d.ts +8 -0
  169. package/{src/icons/icon-svgs/24/sort-ascending-24.icon.ts → dist/icons/icon-svgs/24/sort-ascending-24.icon.js} +4 -5
  170. package/dist/icons/icon-svgs/24/sort-descending-24.icon.d.ts +8 -0
  171. package/{src/icons/icon-svgs/24/sort-descending-24.icon.ts → dist/icons/icon-svgs/24/sort-descending-24.icon.js} +4 -5
  172. package/dist/icons/icon-svgs/24/sparkle-24.icon.d.ts +8 -0
  173. package/{src/icons/icon-svgs/24/sparkle-24.icon.ts → dist/icons/icon-svgs/24/sparkle-24.icon.js} +4 -5
  174. package/dist/icons/icon-svgs/24/speaker-loud-24.icon.d.ts +8 -0
  175. package/{src/icons/icon-svgs/24/speaker-loud-24.icon.ts → dist/icons/icon-svgs/24/speaker-loud-24.icon.js} +4 -5
  176. package/dist/icons/icon-svgs/24/speaker-medium-24.icon.d.ts +8 -0
  177. package/{src/icons/icon-svgs/24/speaker-medium-24.icon.ts → dist/icons/icon-svgs/24/speaker-medium-24.icon.js} +4 -5
  178. package/dist/icons/icon-svgs/24/speaker-muted-24.icon.d.ts +8 -0
  179. package/{src/icons/icon-svgs/24/speaker-muted-24.icon.ts → dist/icons/icon-svgs/24/speaker-muted-24.icon.js} +4 -5
  180. package/dist/icons/icon-svgs/24/speaker-quiet-24.icon.d.ts +8 -0
  181. package/{src/icons/icon-svgs/24/speaker-quiet-24.icon.ts → dist/icons/icon-svgs/24/speaker-quiet-24.icon.js} +4 -5
  182. package/dist/icons/icon-svgs/24/star-24.icon.d.ts +8 -0
  183. package/{src/icons/icon-svgs/24/star-24.icon.ts → dist/icons/icon-svgs/24/star-24.icon.js} +4 -5
  184. package/dist/icons/icon-svgs/24/status-failure-24.icon.d.ts +8 -0
  185. package/{src/icons/icon-svgs/24/status-failure-24.icon.ts → dist/icons/icon-svgs/24/status-failure-24.icon.js} +4 -5
  186. package/dist/icons/icon-svgs/24/status-in-progress-24.icon.d.ts +8 -0
  187. package/{src/icons/icon-svgs/24/status-in-progress-24.icon.ts → dist/icons/icon-svgs/24/status-in-progress-24.icon.js} +4 -5
  188. package/dist/icons/icon-svgs/24/status-success-24.icon.d.ts +8 -0
  189. package/{src/icons/icon-svgs/24/status-success-24.icon.ts → dist/icons/icon-svgs/24/status-success-24.icon.js} +4 -5
  190. package/dist/icons/icon-svgs/24/status-unknown-24.icon.d.ts +8 -0
  191. package/{src/icons/icon-svgs/24/status-unknown-24.icon.ts → dist/icons/icon-svgs/24/status-unknown-24.icon.js} +4 -5
  192. package/dist/icons/icon-svgs/24/status-warning-24.icon.d.ts +8 -0
  193. package/{src/icons/icon-svgs/24/status-warning-24.icon.ts → dist/icons/icon-svgs/24/status-warning-24.icon.js} +4 -5
  194. package/dist/icons/icon-svgs/24/sun-24.icon.d.ts +8 -0
  195. package/{src/icons/icon-svgs/24/sun-24.icon.ts → dist/icons/icon-svgs/24/sun-24.icon.js} +4 -5
  196. package/dist/icons/icon-svgs/24/upload-24.icon.d.ts +8 -0
  197. package/{src/icons/icon-svgs/24/upload-24.icon.ts → dist/icons/icon-svgs/24/upload-24.icon.js} +4 -5
  198. package/dist/icons/icon-svgs/24/x-24.icon.d.ts +8 -0
  199. package/{src/icons/icon-svgs/24/x-24.icon.ts → dist/icons/icon-svgs/24/x-24.icon.js} +4 -5
  200. package/dist/icons/index.d.ts +197 -0
  201. package/{src/icons/index.ts → dist/icons/index.js} +60 -65
  202. package/dist/icons/lucide-icons.d.ts +15 -0
  203. package/dist/icons/lucide-icons.js +79 -0
  204. package/dist/icons/sized-icon.d.ts +8 -0
  205. package/{src/icons/sized-icon.ts → dist/icons/sized-icon.js} +1 -3
  206. package/dist/index.js +4 -0
  207. package/dist/styles/disabled.d.ts +6 -0
  208. package/{src/styles/disabled.ts → dist/styles/disabled.js} +2 -3
  209. package/dist/styles/durations.d.ts +22 -0
  210. package/{src/styles/durations.ts → dist/styles/durations.js} +1 -2
  211. package/dist/styles/focus.d.ts +26 -0
  212. package/{src/styles/focus.ts → dist/styles/focus.js} +12 -40
  213. package/dist/styles/font.d.ts +12 -0
  214. package/{src/styles/font.ts → dist/styles/font.js} +1 -3
  215. package/dist/styles/form-styles.d.ts +46 -0
  216. package/dist/styles/form-styles.js +53 -0
  217. package/dist/styles/form-variants.d.ts +117 -0
  218. package/{src/styles/form-variants.ts → dist/styles/form-variants.js} +34 -42
  219. package/{src/styles/index.ts → dist/styles/index.d.ts} +0 -1
  220. package/dist/styles/index.js +14 -0
  221. package/dist/styles/native-styles.d.ts +13 -0
  222. package/{src/styles/native-styles.ts → dist/styles/native-styles.js} +3 -5
  223. package/dist/styles/scrollbar.d.ts +6 -0
  224. package/{src/styles/scrollbar.ts → dist/styles/scrollbar.js} +3 -4
  225. package/dist/styles/shadows.d.ts +19 -0
  226. package/{src/styles/shadows.ts → dist/styles/shadows.js} +5 -7
  227. package/dist/styles/user-select.d.ts +6 -0
  228. package/{src/styles/user-select.ts → dist/styles/user-select.js} +2 -3
  229. package/dist/styles/vira-color-palette.d.ts +178 -0
  230. package/{src/styles/vira-color-palette.ts → dist/styles/vira-color-palette.js} +1 -3
  231. package/dist/styles/vira-color-theme-object.d.ts +65 -0
  232. package/dist/styles/vira-color-theme-object.js +65 -0
  233. package/dist/styles/vira-color-theme.d.ts +2785 -0
  234. package/{src/styles/vira-color-theme.ts → dist/styles/vira-color-theme.js} +1222 -1227
  235. package/dist/util/color-local-storage.client.d.ts +4 -0
  236. package/dist/util/color-local-storage.client.js +6 -0
  237. package/dist/util/define-table.d.ts +115 -0
  238. package/dist/util/define-table.js +115 -0
  239. package/dist/util/define-vira-element.d.ts +18 -0
  240. package/dist/util/define-vira-element.js +19 -0
  241. package/dist/util/dynamic-element.d.ts +62 -0
  242. package/dist/util/dynamic-element.js +61 -0
  243. package/dist/util/index.js +11 -0
  244. package/dist/util/overflow-observer.d.ts +25 -0
  245. package/{src/util/overflow-observer.ts → dist/util/overflow-observer.js} +1 -30
  246. package/dist/util/pop-up-helpers.d.ts +59 -0
  247. package/dist/util/pop-up-helpers.js +66 -0
  248. package/dist/util/pop-up-manager.d.ts +200 -0
  249. package/dist/util/pop-up-manager.js +258 -0
  250. package/dist/util/shared-text-input-logic.d.ts +69 -0
  251. package/dist/util/shared-text-input-logic.js +114 -0
  252. package/dist/util/vira-form-fields.d.ts +145 -0
  253. package/dist/util/vira-form-fields.js +66 -0
  254. package/dist/util/vira-json-schema.d.ts +206 -0
  255. package/{src/util/vira-json-schema.ts → dist/util/vira-json-schema.js} +155 -298
  256. package/{src/util/vira-select-option.ts → dist/util/vira-select-option.d.ts} +2 -9
  257. package/dist/util/vira-select-option.js +8 -0
  258. package/dist/util/vira-theme-client.d.ts +83 -0
  259. package/dist/util/vira-theme-client.js +93 -0
  260. package/package.json +13 -13
  261. package/src/elements/color/vira-all-color-space-sliders.element.ts +0 -66
  262. package/src/elements/color/vira-all-spaces-color-picker.element.ts +0 -85
  263. package/src/elements/color/vira-color-format-sliders.element.ts +0 -78
  264. package/src/elements/color/vira-color-slider.element.ts +0 -169
  265. package/src/elements/pop-up/vira-menu-trigger.element.ts +0 -135
  266. package/src/elements/pop-up/vira-pop-up-trigger.element.ts +0 -539
  267. package/src/elements/vira-absolute-time.element.ts +0 -81
  268. package/src/elements/vira-date-input.element.ts +0 -185
  269. package/src/elements/vira-dropdown.element.ts +0 -310
  270. package/src/elements/vira-form.element.ts +0 -466
  271. package/src/elements/vira-relative-time.element.ts +0 -135
  272. package/src/icons/icon-color.test-helper.ts +0 -9
  273. package/src/icons/lucide-icons.ts +0 -120
  274. package/src/styles/form-styles.ts +0 -86
  275. package/src/styles/vira-color-palette.json +0 -170
  276. package/src/styles/vira-color-theme-object.ts +0 -170
  277. package/src/util/color-local-storage.client.ts +0 -7
  278. package/src/util/define-table.ts +0 -286
  279. package/src/util/define-vira-element.ts +0 -29
  280. package/src/util/dynamic-element.ts +0 -128
  281. package/src/util/pop-up-helpers.ts +0 -133
  282. package/src/util/pop-up-manager.ts +0 -434
  283. package/src/util/shared-text-input-logic.ts +0 -192
  284. package/src/util/vira-form-fields.ts +0 -195
  285. package/src/util/vira-theme-client.ts +0 -140
  286. /package/{src/elements/index.ts → dist/elements/index.d.ts} +0 -0
  287. /package/{src/index.ts → dist/index.d.ts} +0 -0
  288. /package/{src/util/index.ts → dist/util/index.d.ts} +0 -0
@@ -1,108 +1,53 @@
1
- import {check} from '@augment-vir/assert';
2
- import {
3
- arrayToObject,
4
- filterMap,
5
- getObjectTypedKeys,
6
- type PartialWithUndefined,
7
- } from '@augment-vir/common';
8
- import {ContrastLevelName} from '@electrovir/color/dist/data/contrast/contrast.js';
9
- import {
10
- classMap,
11
- css,
12
- defineElementEvent,
13
- html,
14
- listen,
15
- nothing,
16
- onDomCreated,
17
- unsafeCSS,
18
- type CSSResult,
19
- type HTMLTemplateResult,
20
- } from 'element-vir';
21
- import {
22
- routeHasPaths,
23
- type FullSpaRoute,
24
- type GenericTreePaths,
25
- type SpaRouter,
26
- } from 'spa-router-vir';
27
- import {themeDefaultKey} from 'theme-vir/dist/color-theme/color-theme.js';
28
- import {type ViraIconSvg} from '../icons/icon-svg.js';
29
- import {Check24Icon} from '../icons/icon-svgs/24/check-24.icon.js';
30
- import {createFocusStyles} from '../styles/focus.js';
31
- import {viraFontCssVars} from '../styles/font.js';
32
- import {viraFormCssVars} from '../styles/form-styles.js';
33
- import {
34
- standaloneThemeColorNames,
35
- ViraColorVariant,
36
- viraColorVariantToHostClassKey,
37
- } from '../styles/form-variants.js';
38
- import {noNativeFormStyles, noUserSelect, viraDisabledStyles, viraTheme} from '../styles/index.js';
39
- import {viraThemeByKeys, ViraThemeColorName} from '../styles/vira-color-theme-object.js';
40
- import {defineViraElement} from '../util/define-vira-element.js';
41
- import {renderMenuItemEntries, type ViraMenuItemEntry} from '../util/pop-up-helpers.js';
42
- import {ViraMenuTrigger} from './pop-up/vira-menu-trigger.element.js';
43
- import {ViraMenuCornerStyle} from './pop-up/vira-menu.element.js';
44
- import {type HorizontalAnchor, type PopUpOffset} from './pop-up/vira-pop-up-trigger.element.js';
45
- import {ViraBoldText} from './vira-bold-text.element.js';
46
- import {ViraButton} from './vira-button.element.js';
47
- import {ViraIcon} from './vira-icon.element.js';
48
- import {ViraLink} from './vira-link.element.js';
49
-
1
+ import { check } from '@augment-vir/assert';
2
+ import { arrayToObject, filterMap, getObjectTypedKeys, } from '@augment-vir/common';
3
+ import { ContrastLevelName } from '@electrovir/color/dist/data/contrast/contrast.js';
4
+ import { classMap, css, defineElementEvent, html, listen, nothing, onDomCreated, unsafeCSS, } from 'element-vir';
5
+ import { routeHasPaths, } from 'spa-router-vir';
6
+ import { themeDefaultKey } from 'theme-vir/dist/color-theme/color-theme.js';
7
+ import { ChevronDown16Icon } from '../icons/icon-svgs/16/chevron-down-16.icon.js';
8
+ import { Check24Icon } from '../icons/icon-svgs/24/check-24.icon.js';
9
+ import { createFocusStyles } from '../styles/focus.js';
10
+ import { viraFontCssVars } from '../styles/font.js';
11
+ import { viraFormCssVars } from '../styles/form-styles.js';
12
+ import { standaloneThemeColorNames, ViraColorVariant, viraColorVariantToHostClassKey, } from '../styles/form-variants.js';
13
+ import { noNativeFormStyles, noUserSelect, viraDisabledStyles, viraTheme } from '../styles/index.js';
14
+ import { viraThemeByKeys, ViraThemeColorName } from '../styles/vira-color-theme-object.js';
15
+ import { defineViraElement } from '../util/define-vira-element.js';
16
+ import { renderMenuItemEntries } from '../util/pop-up-helpers.js';
17
+ import { ViraMenuTrigger } from './pop-up/vira-menu-trigger.element.js';
18
+ import { ViraMenuCornerStyle } from './pop-up/vira-menu.element.js';
19
+ import { ViraBoldText } from './vira-bold-text.element.js';
20
+ import { ViraButton } from './vira-button.element.js';
21
+ import { ViraIcon } from './vira-icon.element.js';
22
+ import { ViraLink } from './vira-link.element.js';
50
23
  /**
51
24
  * Controls which edge of the tab the selection indicator bar appears on.
52
25
  *
53
26
  * @category Internal
54
27
  */
55
- export enum ViraTabsBarDirection {
56
- Top = 'top',
57
- Bottom = 'bottom',
58
- Left = 'left',
59
- Right = 'right',
60
- }
61
-
28
+ export var ViraTabsBarDirection;
29
+ (function (ViraTabsBarDirection) {
30
+ ViraTabsBarDirection["Top"] = "top";
31
+ ViraTabsBarDirection["Bottom"] = "bottom";
32
+ ViraTabsBarDirection["Left"] = "left";
33
+ ViraTabsBarDirection["Right"] = "right";
34
+ })(ViraTabsBarDirection || (ViraTabsBarDirection = {}));
62
35
  /**
63
36
  * Controls whether tab icons render above/below or beside the label text.
64
37
  *
65
38
  * @category Internal
66
39
  */
67
- export enum ViraTabsIconLayout {
40
+ export var ViraTabsIconLayout;
41
+ (function (ViraTabsIconLayout) {
68
42
  /** Icon renders above (or below) the label. */
69
- Vertical = 'vertical',
43
+ ViraTabsIconLayout["Vertical"] = "vertical";
70
44
  /** Icon renders beside the label. */
71
- Horizontal = 'horizontal',
72
- }
73
-
74
- function measureElementWidth(mirrorElement: Element, selector: string) {
45
+ ViraTabsIconLayout["Horizontal"] = "horizontal";
46
+ })(ViraTabsIconLayout || (ViraTabsIconLayout = {}));
47
+ function measureElementWidth(mirrorElement, selector) {
75
48
  const element = mirrorElement.querySelector(selector);
76
49
  return element ? element.getBoundingClientRect().width : 0;
77
50
  }
78
-
79
- /**
80
- * A single tab entry for {@link ViraTabs}.
81
- *
82
- * @category Internal
83
- */
84
- export type ViraTab = {
85
- label: string;
86
- paths: GenericTreePaths;
87
- } & PartialWithUndefined<{
88
- icon: Readonly<ViraIconSvg>;
89
- isHidden: boolean;
90
- isDisabled: boolean;
91
- /**
92
- * When true, the tab is only considered selected when the current route's paths exactly equal
93
- * `paths.fullPaths`. By default a tab is considered selected when its paths are a prefix of the
94
- * current route.
95
- */
96
- exactMatch: boolean;
97
- /**
98
- * Optional cluster label. Consecutive tabs sharing the same `group` string render together
99
- * under that label, separated from other clusters by an inset vertical divider. Tabs with no
100
- * `group` render standalone (no label, no divider). Grouping only affects rendering when at
101
- * least one tab has a `group`.
102
- */
103
- group: string;
104
- }>;
105
-
106
51
  /**
107
52
  * Groups a flat list of tabs into clusters. Consecutive tabs sharing the same `group` string are
108
53
  * merged into a single cluster; ungrouped tabs (and tabs whose `group` differs from their
@@ -110,13 +55,8 @@ export type ViraTab = {
110
55
  *
111
56
  * @category Internal
112
57
  */
113
- export function buildClusters(tabList: ReadonlyArray<Readonly<ViraTab>>) {
114
- return tabList.reduce<
115
- {
116
- group: string | undefined;
117
- tabs: ReadonlyArray<Readonly<ViraTab>>;
118
- }[]
119
- >((accumulatedClusters, tab) => {
58
+ export function buildClusters(tabList) {
59
+ return tabList.reduce((accumulatedClusters, tab) => {
120
60
  const lastCluster = accumulatedClusters[accumulatedClusters.length - 1];
121
61
  if (tab.group != undefined && lastCluster && lastCluster.group === tab.group) {
122
62
  return [
@@ -139,33 +79,27 @@ export function buildClusters(tabList: ReadonlyArray<Readonly<ViraTab>>) {
139
79
  ];
140
80
  }, []);
141
81
  }
142
-
143
- function renderGroupedContent(
144
- tabList: ReadonlyArray<Readonly<ViraTab>>,
145
- renderItem: (tab: Readonly<ViraTab>) => HTMLTemplateResult,
146
- ) {
82
+ function renderGroupedContent(tabList, renderItem) {
147
83
  const clusters = buildClusters(tabList);
148
84
  return clusters.map((cluster, clusterIndex) => {
149
85
  const previousCluster = clusters[clusterIndex - 1];
150
- const dividerTemplate =
151
- previousCluster && previousCluster.group != undefined && cluster.group != undefined
152
- ? html`
86
+ const dividerTemplate = previousCluster && previousCluster.group != undefined && cluster.group != undefined
87
+ ? html `
153
88
  <span class="tab-cluster-divider"></span>
154
89
  `
155
- : nothing;
156
- const labelTemplate =
157
- cluster.group == undefined
158
- ? nothing
159
- : html`
90
+ : nothing;
91
+ const labelTemplate = cluster.group == undefined
92
+ ? nothing
93
+ : html `
160
94
  <span class="tab-group-label">${cluster.group}</span>
161
95
  `;
162
- return html`
96
+ return html `
163
97
  ${dividerTemplate}
164
98
  <div
165
99
  class=${classMap({
166
- 'tab-cluster': true,
167
- standalone: cluster.group == undefined,
168
- })}
100
+ 'tab-cluster': true,
101
+ standalone: cluster.group == undefined,
102
+ })}
169
103
  >
170
104
  ${labelTemplate}
171
105
  <div class="tab-cluster-tabs">${cluster.tabs.map(renderItem)}</div>
@@ -173,213 +107,124 @@ function renderGroupedContent(
173
107
  `;
174
108
  });
175
109
  }
176
-
177
110
  /**
178
111
  * A tab bar element that renders an array of tabs with an animated selection indicator.
179
112
  *
180
113
  * @category Elements
181
114
  */
182
- export const ViraTabs = defineViraElement<
183
- {
184
- tabs: ReadonlyArray<Readonly<ViraTab>>;
185
- router: Pick<SpaRouter<any, any, any>, 'createRouteUrl' | 'setRouteOnDirectNavigation'>;
186
- currentRoute: Readonly<FullSpaRoute>;
187
- } & PartialWithUndefined<{
188
- /**
189
- * Which edge of the tab the selection bar appears on.
190
- *
191
- * @default ViraTabsBarDirection.Bottom
192
- */
193
- barDirection: ViraTabsBarDirection;
194
- /**
195
- * Color variant for the tab selection indicator and active tab text. Accepts any
196
- * {@link ViraColorVariant} or a {@link ViraThemeColorName} (e.g.,
197
- * `ViraThemeColorName.blue`).
198
- *
199
- * @default ViraColorVariant.Plain
200
- */
201
- color: ViraColorVariant | ViraThemeColorName;
202
- /**
203
- * Layout direction for icons relative to their label text.
204
- *
205
- * @default ViraTabsIconLayout.Vertical
206
- */
207
- iconLayout: ViraTabsIconLayout;
208
- /**
209
- * Horizontal anchor for the dropdown menu. Only used when tabs overflow into a dropdown.
210
- *
211
- * @default HorizontalAnchor.Left
212
- */
213
- menuHorizontalAnchor: HorizontalAnchor;
214
- /** Whether the dropdown trigger is disabled. Only used when tabs overflow into a dropdown. */
215
- menuIsDisabled: boolean;
216
- /** Offset for the dropdown pop-up. Only used when tabs overflow into a dropdown. */
217
- menuPopUpOffset: Readonly<PopUpOffset>;
218
- /**
219
- * Text shown on the overflow "more" trigger when the selected tab is _not_ collapsed into
220
- * the menu. When the selected tab _is_ collapsed, the trigger shows that tab's label (with
221
- * a checkmark) instead. Set this to a localized string; it defaults to `'More'`.
222
- *
223
- * @default 'More'
224
- */
225
- overflowLabel: string;
226
- /** When true, tabs and their container expand to fill all available horizontal space. */
227
- shouldFillWidth: boolean;
228
- }>
229
- >()({
115
+ export const ViraTabs = defineViraElement()({
230
116
  tagName: 'vira-tabs',
231
117
  events: {
232
118
  /** Fires when a tab is clicked with the corresponding tab entry. */
233
- tabSelect: defineElementEvent<Readonly<ViraTab>>(),
119
+ tabSelect: defineElementEvent(),
234
120
  },
235
121
  state() {
236
122
  return {
237
123
  /** How many of the visible tabs are collapsed into the overflow "more" menu. */
238
124
  overflowCount: 0,
239
125
  /** A callback to remove all internal observers. */
240
- cleanupObserver: undefined as undefined | (() => void),
126
+ cleanupObserver: undefined,
241
127
  };
242
128
  },
243
129
  hostClasses: {
244
- 'vira-tabs-bar-top': ({inputs}) => inputs.barDirection === ViraTabsBarDirection.Top,
245
- 'vira-tabs-bar-bottom': ({inputs}) => {
130
+ 'vira-tabs-bar-top'({ inputs }) {
131
+ return inputs.barDirection === ViraTabsBarDirection.Top;
132
+ },
133
+ 'vira-tabs-bar-bottom'({ inputs }) {
246
134
  return !inputs.barDirection || inputs.barDirection === ViraTabsBarDirection.Bottom;
247
135
  },
248
- 'vira-tabs-bar-left': ({inputs}) => inputs.barDirection === ViraTabsBarDirection.Left,
249
- 'vira-tabs-bar-right': ({inputs}) => inputs.barDirection === ViraTabsBarDirection.Right,
250
- ...arrayToObject(
251
- getObjectTypedKeys(viraColorVariantToHostClassKey),
252
- (colorVariant) => {
253
- const colorKey = viraColorVariantToHostClassKey[colorVariant];
254
- return {
255
- key: `vira-tabs-color-${colorKey}` as const,
256
- value: ({
257
- inputs,
258
- }: {
259
- inputs: Readonly<
260
- PartialWithUndefined<{color: ViraColorVariant | ViraThemeColorName}>
261
- >;
262
- }) => {
263
- return inputs.color === colorVariant || inputs.color === colorKey;
264
- },
265
- };
266
- },
267
- {
268
- useRequired: true,
269
- },
270
- ),
271
- 'vira-tabs-color-plain': ({
272
- inputs,
273
- }: {
274
- inputs: Readonly<PartialWithUndefined<{color: ViraColorVariant | ViraThemeColorName}>>;
275
- }) => !inputs.color || inputs.color === ViraColorVariant.Plain,
276
- 'vira-tabs-color-neutral': ({
277
- inputs,
278
- }: {
279
- inputs: Readonly<PartialWithUndefined<{color: ViraColorVariant | ViraThemeColorName}>>;
280
- }) => inputs.color === ViraColorVariant.Neutral,
281
- ...arrayToObject(
282
- standaloneThemeColorNames,
283
- (colorName) => {
284
- return {
285
- key: `vira-tabs-color-${colorName}` as const,
286
- value: ({
287
- inputs,
288
- }: {
289
- inputs: Readonly<
290
- PartialWithUndefined<{color: ViraColorVariant | ViraThemeColorName}>
291
- >;
292
- }) => {
293
- return inputs.color === colorName;
294
- },
295
- };
296
- },
297
- {
298
- useRequired: true,
299
- },
300
- ),
301
- 'vira-tabs-icon-layout-vertical': ({inputs}) => {
136
+ 'vira-tabs-bar-left'({ inputs }) {
137
+ return inputs.barDirection === ViraTabsBarDirection.Left;
138
+ },
139
+ 'vira-tabs-bar-right'({ inputs }) {
140
+ return inputs.barDirection === ViraTabsBarDirection.Right;
141
+ },
142
+ ...arrayToObject(getObjectTypedKeys(viraColorVariantToHostClassKey), (colorVariant) => {
143
+ const colorKey = viraColorVariantToHostClassKey[colorVariant];
144
+ return {
145
+ key: `vira-tabs-color-${colorKey}`,
146
+ value({ inputs, }) {
147
+ return inputs.color === colorVariant || inputs.color === colorKey;
148
+ },
149
+ };
150
+ }, {
151
+ useRequired: true,
152
+ }),
153
+ 'vira-tabs-color-plain'({ inputs, }) {
154
+ return !inputs.color || inputs.color === ViraColorVariant.Plain;
155
+ },
156
+ 'vira-tabs-color-neutral'({ inputs, }) {
157
+ return inputs.color === ViraColorVariant.Neutral;
158
+ },
159
+ ...arrayToObject(standaloneThemeColorNames, (colorName) => {
160
+ return {
161
+ key: `vira-tabs-color-${colorName}`,
162
+ value({ inputs, }) {
163
+ return inputs.color === colorName;
164
+ },
165
+ };
166
+ }, {
167
+ useRequired: true,
168
+ }),
169
+ 'vira-tabs-icon-layout-vertical'({ inputs }) {
302
170
  return !inputs.iconLayout || inputs.iconLayout === ViraTabsIconLayout.Vertical;
303
171
  },
304
- 'vira-tabs-icon-layout-horizontal': ({inputs}) => {
172
+ 'vira-tabs-icon-layout-horizontal'({ inputs }) {
305
173
  return inputs.iconLayout === ViraTabsIconLayout.Horizontal;
306
174
  },
307
- 'vira-tabs-fill-width': ({inputs}) => !!inputs.shouldFillWidth,
175
+ 'vira-tabs-fill-width'({ inputs }) {
176
+ return !!inputs.shouldFillWidth;
177
+ },
308
178
  },
309
179
  cssVars: {
310
- 'vira-tabs-active-color':
311
- viraThemeByKeys[viraColorVariantToHostClassKey[ViraColorVariant.Info]]['behind-bg'][
312
- ContrastLevelName.NonBodyText
313
- ].background.value,
314
- 'vira-tabs-active-hover-color':
315
- viraThemeByKeys[viraColorVariantToHostClassKey[ViraColorVariant.Info]]['behind-bg'][
316
- ContrastLevelName.Header
317
- ].background.value,
180
+ 'vira-tabs-active-color': viraThemeByKeys[viraColorVariantToHostClassKey[ViraColorVariant.Info]]['behind-bg'][ContrastLevelName.NonBodyText].background.value,
181
+ 'vira-tabs-active-hover-color': viraThemeByKeys[viraColorVariantToHostClassKey[ViraColorVariant.Info]]['behind-bg'][ContrastLevelName.Header].background.value,
318
182
  'vira-tabs-inactive-color': viraTheme.colors[themeDefaultKey].foreground.value,
319
183
  'vira-tabs-inactive-hover-color': viraTheme.colors[themeDefaultKey].foreground.value,
320
184
  'vira-tabs-bar-thickness': '2px',
321
185
  },
322
-
323
- styles: ({hostClasses, cssVars}) => {
324
- function buildThemedTabsColors(colorName: ViraThemeColorName) {
186
+ styles({ hostClasses, cssVars }) {
187
+ function buildThemedTabsColors(colorName) {
325
188
  return {
326
189
  active: viraThemeByKeys[colorName]['behind-bg'][ContrastLevelName.NonBodyText]
327
190
  .background,
328
191
  hover: viraThemeByKeys[colorName]['behind-bg'][ContrastLevelName.Header].background,
329
192
  };
330
193
  }
331
-
332
- function buildVariantCssRule(
333
- variantSelector: CSSResult,
334
- colors: {active: {value: CSSResult}; hover: {value: CSSResult}},
335
- ): CSSResult {
336
- return css`
194
+ function buildVariantCssRule(variantSelector, colors) {
195
+ return css `
337
196
  ${variantSelector} {
338
197
  ${cssVars['vira-tabs-active-color'].name}: ${colors.active.value};
339
198
  ${cssVars['vira-tabs-active-hover-color'].name}: ${colors.hover.value};
340
199
  }
341
200
  `;
342
201
  }
343
-
344
- function generateVariantCss(): CSSResult {
202
+ function generateVariantCss() {
345
203
  const plainColors = {
346
204
  active: viraTheme.colors['vira-grey-foreground-small-body'].foreground,
347
205
  hover: viraTheme.colors['vira-grey-foreground-body'].foreground,
348
206
  };
349
-
350
- const themedStyles = getObjectTypedKeys(viraColorVariantToHostClassKey).map(
351
- (colorVariant) => {
352
- const colorKey = viraColorVariantToHostClassKey[colorVariant];
353
- const variantSelector = hostClasses[`vira-tabs-color-${colorKey}`].selector;
354
- const colors = buildThemedTabsColors(colorKey);
355
- return buildVariantCssRule(variantSelector, colors);
356
- },
357
- );
358
- const plainStyle = buildVariantCssRule(
359
- hostClasses['vira-tabs-color-plain'].selector,
360
- plainColors,
361
- );
362
- const neutralStyle = buildVariantCssRule(
363
- hostClasses['vira-tabs-color-neutral'].selector,
364
- buildThemedTabsColors(ViraThemeColorName.grey),
365
- );
207
+ const themedStyles = getObjectTypedKeys(viraColorVariantToHostClassKey).map((colorVariant) => {
208
+ const colorKey = viraColorVariantToHostClassKey[colorVariant];
209
+ const variantSelector = hostClasses[`vira-tabs-color-${colorKey}`].selector;
210
+ const colors = buildThemedTabsColors(colorKey);
211
+ return buildVariantCssRule(variantSelector, colors);
212
+ });
213
+ const plainStyle = buildVariantCssRule(hostClasses['vira-tabs-color-plain'].selector, plainColors);
214
+ const neutralStyle = buildVariantCssRule(hostClasses['vira-tabs-color-neutral'].selector, buildThemedTabsColors(ViraThemeColorName.grey));
366
215
  const standaloneStyles = standaloneThemeColorNames.map((colorName) => {
367
216
  const variantSelector = hostClasses[`vira-tabs-color-${colorName}`].selector;
368
217
  const colors = buildThemedTabsColors(colorName);
369
218
  return buildVariantCssRule(variantSelector, colors);
370
219
  });
371
-
372
- return unsafeCSS(
373
- [
374
- ...themedStyles,
375
- plainStyle,
376
- neutralStyle,
377
- ...standaloneStyles,
378
- ].join('\n'),
379
- );
220
+ return unsafeCSS([
221
+ ...themedStyles,
222
+ plainStyle,
223
+ neutralStyle,
224
+ ...standaloneStyles,
225
+ ].join('\n'));
380
226
  }
381
-
382
- return css`
227
+ return css `
383
228
  :host {
384
229
  display: flex;
385
230
  box-sizing: border-box;
@@ -440,9 +285,9 @@ export const ViraTabs = defineViraElement<
440
285
  font-weight: ${viraFontCssVars['vira-font-weight-medium'].value};
441
286
  text-decoration: none;
442
287
  ${createFocusStyles({
443
- renderInside: true,
444
- elementBorderSize: '0',
445
- })}
288
+ renderInside: true,
289
+ elementBorderSize: '0',
290
+ })}
446
291
 
447
292
  &::after {
448
293
  content: '';
@@ -453,7 +298,7 @@ export const ViraTabs = defineViraElement<
453
298
  &:hover {
454
299
  color: ${cssVars['vira-tabs-inactive-hover-color'].value};
455
300
  background-color: ${viraTheme.colors['vira-grey-on-self-small-body'].background
456
- .value};
301
+ .value};
457
302
  }
458
303
 
459
304
  &.selected {
@@ -606,58 +451,55 @@ export const ViraTabs = defineViraElement<
606
451
  width: 1px;
607
452
  margin: 8px 0;
608
453
  background-color: ${viraTheme.colors['vira-grey-foreground-decoration'].foreground
609
- .value};
454
+ .value};
610
455
  }
611
456
  `;
612
457
  },
613
- cleanup({state}) {
458
+ cleanup({ state }) {
614
459
  state.cleanupObserver?.();
615
460
  },
616
- render({inputs, state, updateState, host, dispatch, events}) {
617
- function renderTabInner(tab: Readonly<ViraTab>, forMeasurement: boolean) {
461
+ render({ inputs, state, updateState, host, dispatch, events }) {
462
+ function renderTabInner(tab, forMeasurement) {
618
463
  const isSelected = routeHasPaths(inputs.currentRoute, tab.paths, {
619
464
  exactMatch: tab.exactMatch,
620
465
  });
621
-
622
466
  const iconTemplate = tab.icon
623
- ? html`
467
+ ? html `
624
468
  <${ViraIcon.assign({
625
- icon: tab.icon,
626
- })}></${ViraIcon}>
469
+ icon: tab.icon,
470
+ })}></${ViraIcon}>
627
471
  `
628
472
  : nothing;
629
-
630
473
  const isInert = isSelected || !!tab.isDisabled;
631
-
632
474
  return {
633
475
  isSelected,
634
- content: html`
476
+ content: html `
635
477
  <${ViraLink.assign({
478
+ route: {
479
+ router: inputs.router,
636
480
  route: {
637
- router: inputs.router,
638
- route: {
639
- paths: tab.paths.fullPaths,
481
+ paths: tab.paths.fullPaths,
482
+ },
483
+ scrollToTop: true,
484
+ },
485
+ disableLinkStyles: true,
486
+ attributePassthrough: forMeasurement
487
+ ? undefined
488
+ : {
489
+ a: {
490
+ role: 'tab',
491
+ 'aria-selected': String(isSelected),
492
+ 'aria-disabled': String(!!tab.isDisabled),
493
+ tabindex: isInert ? '-1' : undefined,
640
494
  },
641
- scrollToTop: true,
642
495
  },
643
- disableLinkStyles: true,
644
- attributePassthrough: forMeasurement
645
- ? undefined
646
- : {
647
- a: {
648
- role: 'tab',
649
- 'aria-selected': String(isSelected),
650
- 'aria-disabled': String(!!tab.isDisabled),
651
- tabindex: isInert ? '-1' : undefined,
652
- },
653
- },
654
- })}>
496
+ })}>
655
497
  <span class="tab-content">
656
498
  ${iconTemplate}
657
499
  <${ViraBoldText.assign({
658
- text: tab.label,
659
- bold: isSelected,
660
- })}
500
+ text: tab.label,
501
+ bold: isSelected,
502
+ })}
661
503
  class="tab-label"
662
504
  ></${ViraBoldText}>
663
505
  </span>
@@ -665,26 +507,22 @@ export const ViraTabs = defineViraElement<
665
507
  `,
666
508
  };
667
509
  }
668
-
669
- function handleTabClick(tab: Readonly<ViraTab>) {
510
+ function handleTabClick(tab) {
670
511
  if (!tab.isDisabled) {
671
- dispatch(
672
- new events.tabSelect({
673
- detail: tab,
674
- }),
675
- );
512
+ dispatch(new events.tabSelect({
513
+ detail: tab,
514
+ }));
676
515
  }
677
516
  }
678
-
679
- function renderTabItem(tab: Readonly<ViraTab>) {
680
- const {isSelected, content} = renderTabInner(tab, false);
681
- return html`
517
+ function renderTabItem(tab) {
518
+ const { isSelected, content } = renderTabInner(tab, false);
519
+ return html `
682
520
  <div
683
521
  class=${classMap({
684
- 'tab-item': true,
685
- selected: isSelected,
686
- disabled: !!tab.isDisabled,
687
- })}
522
+ 'tab-item': true,
523
+ selected: isSelected,
524
+ disabled: !!tab.isDisabled,
525
+ })}
688
526
  role="presentation"
689
527
  ${listen('click', () => handleTabClick(tab))}
690
528
  >
@@ -692,78 +530,66 @@ export const ViraTabs = defineViraElement<
692
530
  </div>
693
531
  `;
694
532
  }
695
-
696
- function renderMeasureTabItem(tab: Readonly<ViraTab>) {
697
- const {isSelected, content} = renderTabInner(tab, true);
698
- return html`
533
+ function renderMeasureTabItem(tab) {
534
+ const { isSelected, content } = renderTabInner(tab, true);
535
+ return html `
699
536
  <div
700
537
  class=${classMap({
701
- 'tab-item': true,
702
- 'measure-selected': isSelected,
703
- })}
538
+ 'tab-item': true,
539
+ 'measure-selected': isSelected,
540
+ })}
704
541
  >
705
542
  ${content}
706
543
  </div>
707
544
  `;
708
545
  }
709
-
710
- function buildMenuItems(tabList: ReadonlyArray<Readonly<ViraTab>>) {
711
- return renderMenuItemEntries(
712
- filterMap(
713
- tabList,
714
- (tab): ViraMenuItemEntry | undefined => {
715
- const isSelected = routeHasPaths(inputs.currentRoute, tab.paths, {
716
- exactMatch: tab.exactMatch,
717
- });
718
-
719
- const iconTemplate = tab.icon
720
- ? html`
546
+ function buildMenuItems(tabList) {
547
+ return renderMenuItemEntries(filterMap(tabList, (tab) => {
548
+ const isSelected = routeHasPaths(inputs.currentRoute, tab.paths, {
549
+ exactMatch: tab.exactMatch,
550
+ });
551
+ const iconTemplate = tab.icon
552
+ ? html `
721
553
  <${ViraIcon.assign({
722
- icon: tab.icon,
723
- })}></${ViraIcon}>
554
+ icon: tab.icon,
555
+ })}></${ViraIcon}>
724
556
  `
725
- : nothing;
726
-
727
- return {
728
- content: html`
557
+ : nothing;
558
+ return {
559
+ content: html `
729
560
  <${ViraLink.assign({
730
- route: {
731
- router: inputs.router,
732
- route: {
733
- paths: tab.paths.fullPaths,
734
- },
735
- scrollToTop: true,
736
- },
737
- disableLinkStyles: true,
738
- stylePassthrough: {
739
- a: css`
561
+ route: {
562
+ router: inputs.router,
563
+ route: {
564
+ paths: tab.paths.fullPaths,
565
+ },
566
+ scrollToTop: true,
567
+ },
568
+ disableLinkStyles: true,
569
+ stylePassthrough: {
570
+ a: css `
740
571
  display: flex;
741
572
  align-items: center;
742
573
  gap: 8px;
743
574
  `,
744
- },
745
- })}>
575
+ },
576
+ })}>
746
577
  ${iconTemplate} ${tab.label}
747
578
  </${ViraLink}>
748
579
  `,
749
- selected: isSelected,
750
- disabled: tab.isDisabled,
751
- onClick() {
752
- handleTabClick(tab);
753
- },
754
- };
580
+ selected: isSelected,
581
+ disabled: tab.isDisabled,
582
+ onClick() {
583
+ handleTabClick(tab);
755
584
  },
756
- check.isTruthy,
757
- ),
758
- );
585
+ };
586
+ }, check.isTruthy));
759
587
  }
760
-
761
- function measureOverflow(mirrorElement: Element) {
588
+ function measureOverflow(mirrorElement) {
762
589
  const availableWidth = host.clientWidth;
763
590
  if (!availableWidth) {
764
591
  return;
765
592
  }
766
-
767
593
  /**
768
594
  * Vertical (left/right) tab bars stack their tabs in a column, so horizontal
769
595
  * width-based overflow does not apply: keep every tab inline.
@@ -779,15 +605,12 @@ export const ViraTabs = defineViraElement<
779
605
  }
780
606
  return;
781
607
  }
782
-
783
608
  const tabElements = Array.from(mirrorElement.querySelectorAll('.tab-item'));
784
609
  const tabCount = tabElements.length;
785
610
  if (!tabCount) {
786
611
  return;
787
612
  }
788
-
789
613
  const tabWidths = tabElements.map((element) => element.getBoundingClientRect().width);
790
-
791
614
  /**
792
615
  * In grouped mode a partially-shown cluster still renders its group label and its
793
616
  * leading divider, so its inline width is `max(labelWidth, shownTabsWidth)` rather than
@@ -802,26 +625,23 @@ export const ViraTabs = defineViraElement<
802
625
  const clusterLabelWidth = labelElement
803
626
  ? labelElement.getBoundingClientRect().width
804
627
  : 0;
805
- return Array.from(clusterElement.querySelectorAll('.tab-item')).map(
806
- (tabElement, indexInCluster) => {
807
- return {
808
- clusterLeft,
809
- clusterLabelWidth,
810
- indexInCluster,
811
- width: tabElement.getBoundingClientRect().width,
812
- };
813
- },
814
- );
628
+ return Array.from(clusterElement.querySelectorAll('.tab-item')).map((tabElement, indexInCluster) => {
629
+ return {
630
+ clusterLeft,
631
+ clusterLabelWidth,
632
+ indexInCluster,
633
+ width: tabElement.getBoundingClientRect().width,
634
+ };
635
+ });
815
636
  });
816
-
817
637
  /** Width of the inline area when the first `count` tabs are shown. */
818
- function inlineWidthForCount(count: number) {
638
+ function inlineWidthForCount(count) {
819
639
  if (count <= 0) {
820
640
  return 0;
821
- } else if (!clusterElements.length) {
641
+ }
642
+ else if (!clusterElements.length) {
822
643
  return tabWidths.slice(0, count).reduce((sum, width) => sum + width, 0);
823
644
  }
824
-
825
645
  const lastInfo = tabClusterInfo[count - 1];
826
646
  if (!lastInfo) {
827
647
  return 0;
@@ -829,25 +649,20 @@ export const ViraTabs = defineViraElement<
829
649
  const inlineTabsInLastCluster = tabClusterInfo
830
650
  .slice(count - 1 - lastInfo.indexInCluster, count)
831
651
  .reduce((sum, info) => sum + info.width, 0);
832
- return (
833
- lastInfo.clusterLeft +
834
- Math.max(lastInfo.clusterLabelWidth, inlineTabsInLastCluster)
835
- );
652
+ return (lastInfo.clusterLeft +
653
+ Math.max(lastInfo.clusterLabelWidth, inlineTabsInLastCluster));
836
654
  }
837
-
838
655
  const totalWidth = inlineWidthForCount(tabCount);
839
-
840
656
  /**
841
657
  * Largest number of leading tabs whose inline width fits within the available width
842
658
  * minus the given reserve (the width the "more" button will occupy). Can return 0.
843
659
  */
844
- function maxInlineForReserve(reservePx: number) {
660
+ function maxInlineForReserve(reservePx) {
845
661
  const limit = availableWidth - reservePx;
846
662
  return tabElements.reduce((fittingCount, _tabElement, index) => {
847
663
  return inlineWidthForCount(index + 1) <= limit ? index + 1 : fittingCount;
848
664
  }, 0);
849
665
  }
850
-
851
666
  /** When every tab fits on its own, there is no overflow and no "more" button. */
852
667
  if (totalWidth <= availableWidth) {
853
668
  if (state.overflowCount !== 0) {
@@ -857,20 +672,16 @@ export const ViraTabs = defineViraElement<
857
672
  }
858
673
  return;
859
674
  }
860
-
861
675
  const defaultButtonWidth = measureElementWidth(mirrorElement, '.measure-more-default');
862
676
  const labeledButtonWidth = measureElementWidth(mirrorElement, '.measure-more-labeled');
863
-
864
677
  const selectedElement = mirrorElement.querySelector('.tab-item.measure-selected');
865
678
  const selectedIndex = selectedElement ? tabElements.indexOf(selectedElement) : -1;
866
-
867
679
  /**
868
680
  * Reserving the default ("more") trigger reveals whether the selected tab would end up
869
681
  * collapsed.
870
682
  */
871
683
  const defaultInlineCount = maxInlineForReserve(defaultButtonWidth);
872
684
  const selectedIsCollapsed = selectedIndex >= 0 && selectedIndex >= defaultInlineCount;
873
-
874
685
  /**
875
686
  * When the selected tab is collapsed, the trigger always shows that tab's own label
876
687
  * (with a checkmark), reserving its width even when it cannot fully fit (it is allowed
@@ -880,20 +691,16 @@ export const ViraTabs = defineViraElement<
880
691
  const inlineCount = selectedIsCollapsed
881
692
  ? maxInlineForReserve(labeledButtonWidth)
882
693
  : defaultInlineCount;
883
-
884
694
  const newOverflowCount = Math.max(1, tabCount - inlineCount);
885
-
886
695
  if (newOverflowCount !== state.overflowCount) {
887
696
  updateState({
888
697
  overflowCount: newOverflowCount,
889
698
  });
890
699
  }
891
700
  }
892
-
893
- function setUpOverflowMeasurement(mirrorElement: Element) {
701
+ function setUpOverflowMeasurement(mirrorElement) {
894
702
  state.cleanupObserver?.();
895
-
896
- let frameId: number | undefined = undefined;
703
+ let frameId = undefined;
897
704
  function scheduleMeasure() {
898
705
  if (frameId != undefined) {
899
706
  return;
@@ -903,7 +710,6 @@ export const ViraTabs = defineViraElement<
903
710
  measureOverflow(mirrorElement);
904
711
  });
905
712
  }
906
-
907
713
  const resizeObserver = new ResizeObserver(scheduleMeasure);
908
714
  resizeObserver.observe(host);
909
715
  /**
@@ -918,7 +724,6 @@ export const ViraTabs = defineViraElement<
918
724
  characterData: true,
919
725
  });
920
726
  scheduleMeasure();
921
-
922
727
  updateState({
923
728
  cleanupObserver() {
924
729
  if (frameId != undefined) {
@@ -929,15 +734,12 @@ export const ViraTabs = defineViraElement<
929
734
  },
930
735
  });
931
736
  }
932
-
933
737
  const visibleTabs = inputs.tabs.filter((tab) => !tab.isHidden);
934
738
  const hasGroups = visibleTabs.some((tab) => tab.group != undefined);
935
-
936
739
  const overflowCount = Math.min(visibleTabs.length, Math.max(0, state.overflowCount));
937
740
  const inlineCount = visibleTabs.length - overflowCount;
938
741
  const inlineTabs = visibleTabs.slice(0, inlineCount);
939
742
  const overflowTabs = visibleTabs.slice(inlineCount);
940
-
941
743
  const selectedIndex = visibleTabs.findIndex((tab) => {
942
744
  return routeHasPaths(inputs.currentRoute, tab.paths, {
943
745
  exactMatch: tab.exactMatch,
@@ -946,59 +748,55 @@ export const ViraTabs = defineViraElement<
946
748
  const selectedTab = selectedIndex >= 0 ? visibleTabs[selectedIndex] : undefined;
947
749
  /** Whether the selected tab is currently collapsed into the overflow menu. */
948
750
  const selectedIsCollapsed = selectedIndex >= 0 && selectedIndex >= inlineCount;
949
-
950
751
  const inlineContent = hasGroups
951
752
  ? renderGroupedContent(inlineTabs, renderTabItem)
952
753
  : inlineTabs.map(renderTabItem);
953
754
  const measureContent = hasGroups
954
755
  ? renderGroupedContent(visibleTabs, renderMeasureTabItem)
955
756
  : visibleTabs.map(renderMeasureTabItem);
956
-
957
757
  const overflowLabel = inputs.overflowLabel || 'More';
958
-
959
758
  /**
960
759
  * Hidden copies of the "more" button in each of its possible shapes, rendered inside the
961
760
  * measurement mirror so their true widths can be measured before choosing which one fits:
962
- * the default overflow label, and the collapsed selected tab's own label (with a
963
- * checkmark).
761
+ * the default overflow label, and the collapsed selected tab's own label (with a checkmark
762
+ * and caret).
964
763
  */
965
- const measureMoreButtons = html`
764
+ const measureMoreButtons = html `
966
765
  <${ViraButton.assign({
967
- text: overflowLabel,
968
- showMenuCaret: true,
969
- color: ViraColorVariant.Neutral,
970
- })}
766
+ text: overflowLabel,
767
+ rightSideIcon: ChevronDown16Icon,
768
+ color: ViraColorVariant.Neutral,
769
+ })}
971
770
  class="measure-more-default"
972
771
  ></${ViraButton}>
973
772
  ${selectedTab
974
- ? html`
773
+ ? html `
975
774
  <${ViraButton.assign({
976
- text: selectedTab.label,
977
- icon: Check24Icon,
978
- showMenuCaret: true,
979
- color: ViraColorVariant.Neutral,
980
- })}
775
+ text: selectedTab.label,
776
+ icon: Check24Icon,
777
+ rightSideIcon: ChevronDown16Icon,
778
+ color: ViraColorVariant.Neutral,
779
+ })}
981
780
  class="measure-more-labeled"
982
781
  ></${ViraButton}>
983
782
  `
984
- : nothing}
783
+ : nothing}
985
784
  `;
986
-
987
785
  const overflowMenuTemplate = overflowTabs.length
988
- ? html`
786
+ ? html `
989
787
  <div class="tab-more">
990
788
  <${ViraMenuTrigger.assign({
991
- horizontalAnchor: inputs.menuHorizontalAnchor,
992
- isDisabled: inputs.menuIsDisabled,
993
- popUpOffset: inputs.menuPopUpOffset,
994
- menuCornerStyle: ViraMenuCornerStyle.AllRounded,
995
- })}>
789
+ horizontalAnchor: inputs.menuHorizontalAnchor,
790
+ isDisabled: inputs.menuIsDisabled,
791
+ popUpOffset: inputs.menuPopUpOffset,
792
+ menuCornerStyle: ViraMenuCornerStyle.AllRounded,
793
+ })}>
996
794
  <${ViraButton.assign({
997
- text: selectedIsCollapsed ? selectedTab?.label : overflowLabel,
998
- icon: selectedIsCollapsed ? Check24Icon : undefined,
999
- showMenuCaret: true,
1000
- color: ViraColorVariant.Neutral,
1001
- })}
795
+ text: selectedIsCollapsed ? selectedTab?.label : overflowLabel,
796
+ icon: selectedIsCollapsed ? Check24Icon : undefined,
797
+ rightSideIcon: ChevronDown16Icon,
798
+ color: ViraColorVariant.Neutral,
799
+ })}
1002
800
  slot=${ViraMenuTrigger.slotNames['vira-menu-trigger-trigger']}
1003
801
  ></${ViraButton}>
1004
802
  ${buildMenuItems(overflowTabs)}
@@ -1006,14 +804,13 @@ export const ViraTabs = defineViraElement<
1006
804
  </div>
1007
805
  `
1008
806
  : nothing;
1009
-
1010
- return html`
807
+ return html `
1011
808
  <div
1012
809
  class=${classMap({
1013
- 'tabs-container': true,
1014
- 'tabs-measure': true,
1015
- grouped: hasGroups,
1016
- })}
810
+ 'tabs-container': true,
811
+ 'tabs-measure': true,
812
+ grouped: hasGroups,
813
+ })}
1017
814
  aria-hidden="true"
1018
815
  ${onDomCreated(setUpOverflowMeasurement)}
1019
816
  >
@@ -1021,9 +818,9 @@ export const ViraTabs = defineViraElement<
1021
818
  </div>
1022
819
  <div
1023
820
  class=${classMap({
1024
- 'tabs-container': true,
1025
- grouped: hasGroups,
1026
- })}
821
+ 'tabs-container': true,
822
+ grouped: hasGroups,
823
+ })}
1027
824
  role="tablist"
1028
825
  >
1029
826
  ${inlineContent} ${overflowMenuTemplate}