@rotki/ui-library 2.27.0 → 3.0.0-beta.2

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 (433) hide show
  1. package/README.md +36 -15
  2. package/dist/components/accordions/accordion/RuiAccordion.js.map +1 -1
  3. package/dist/components/accordions/accordion/RuiAccordion.vue.d.ts +0 -4
  4. package/dist/components/accordions/accordion/RuiAccordion.vue_vue_type_script_setup_true_lang.js +9 -10
  5. package/dist/components/accordions/accordion/RuiAccordion.vue_vue_type_script_setup_true_lang.js.map +1 -1
  6. package/dist/components/accordions/accordions/RuiAccordions.js.map +1 -1
  7. package/dist/components/accordions/accordions/RuiAccordions.vue_vue_type_script_setup_true_lang.js +16 -3
  8. package/dist/components/accordions/accordions/RuiAccordions.vue_vue_type_script_setup_true_lang.js.map +1 -1
  9. package/dist/components/alerts/RuiAlert.js.map +1 -1
  10. package/dist/components/alerts/RuiAlert.vue_vue_type_script_setup_true_lang.js +43 -212
  11. package/dist/components/alerts/RuiAlert.vue_vue_type_script_setup_true_lang.js.map +1 -1
  12. package/dist/components/avatars/RuiAvatar.js.map +1 -1
  13. package/dist/components/avatars/RuiAvatar.vue_vue_type_script_setup_true_lang.js +22 -32
  14. package/dist/components/avatars/RuiAvatar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  15. package/dist/components/avatars/RuiAvatarGroup.js.map +1 -1
  16. package/dist/components/avatars/RuiAvatarGroup.vue.d.ts +6 -0
  17. package/dist/components/avatars/RuiAvatarGroup.vue_vue_type_script_setup_true_lang.js +17 -13
  18. package/dist/components/avatars/RuiAvatarGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  19. package/dist/components/avatars/avatar-props.d.ts +16 -3
  20. package/dist/components/avatars/avatar-props.js +42 -5
  21. package/dist/components/avatars/avatar-props.js.map +1 -1
  22. package/dist/components/buttons/button/RuiButton.js.map +1 -1
  23. package/dist/components/buttons/button/RuiButton.vue.d.ts +0 -1
  24. package/dist/components/buttons/button/RuiButton.vue_vue_type_script_setup_true_lang.js +39 -26
  25. package/dist/components/buttons/button/RuiButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  26. package/dist/components/buttons/button/button-props.d.ts +0 -2
  27. package/dist/components/buttons/button/button-props.js +5 -5
  28. package/dist/components/buttons/button/button-props.js.map +1 -1
  29. package/dist/components/buttons/button/button-styles.d.ts +4 -1
  30. package/dist/components/buttons/button/button-styles.js +136 -55
  31. package/dist/components/buttons/button/button-styles.js.map +1 -1
  32. package/dist/components/buttons/button-group/RuiButtonGroup.js.map +1 -1
  33. package/dist/components/buttons/button-group/RuiButtonGroup.vue.d.ts +8 -2
  34. package/dist/components/buttons/button-group/RuiButtonGroup.vue_vue_type_script_setup_true_lang.js +66 -97
  35. package/dist/components/buttons/button-group/RuiButtonGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  36. package/dist/components/buttons/button-group/button-group-context.d.ts +28 -0
  37. package/dist/components/buttons/button-group/button-group-context.js +22 -0
  38. package/dist/components/buttons/button-group/button-group-context.js.map +1 -0
  39. package/dist/components/calendar/RuiCalendar.js.map +1 -1
  40. package/dist/components/calendar/RuiCalendar.vue_vue_type_script_setup_true_lang.js +6 -3
  41. package/dist/components/calendar/RuiCalendar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  42. package/dist/components/calendar/RuiCalendarGrid.js.map +1 -1
  43. package/dist/components/calendar/RuiCalendarGrid.vue_vue_type_script_setup_true_lang.js +12 -8
  44. package/dist/components/calendar/RuiCalendarGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  45. package/dist/components/calendar/RuiCalendarHeader.js.map +1 -1
  46. package/dist/components/calendar/RuiCalendarHeader.vue_vue_type_script_setup_true_lang.js +21 -22
  47. package/dist/components/calendar/RuiCalendarHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  48. package/dist/components/calendar/RuiCalendarMenu.js.map +1 -1
  49. package/dist/components/calendar/RuiCalendarMenu.vue_vue_type_script_setup_true_lang.js +17 -21
  50. package/dist/components/calendar/RuiCalendarMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  51. package/dist/components/cards/RuiCard.js.map +1 -1
  52. package/dist/components/cards/RuiCard.vue.d.ts +0 -3
  53. package/dist/components/cards/RuiCard.vue_vue_type_script_setup_true_lang.js +31 -19
  54. package/dist/components/cards/RuiCard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  55. package/dist/components/cards/RuiCardHeader.js.map +1 -1
  56. package/dist/components/cards/RuiCardHeader.vue_vue_type_script_setup_true_lang.js +13 -25
  57. package/dist/components/cards/RuiCardHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  58. package/dist/components/chips/RuiChip.js.map +1 -1
  59. package/dist/components/chips/RuiChip.vue.d.ts +5 -2
  60. package/dist/components/chips/RuiChip.vue_vue_type_script_setup_true_lang.js +127 -78
  61. package/dist/components/chips/RuiChip.vue_vue_type_script_setup_true_lang.js.map +1 -1
  62. package/dist/components/chips/chip-props.d.ts +2 -0
  63. package/dist/components/chips/chip-props.js +5 -3
  64. package/dist/components/chips/chip-props.js.map +1 -1
  65. package/dist/components/color-picker/RuiColorBoard.js.map +1 -1
  66. package/dist/components/color-picker/RuiColorBoard.vue_vue_type_script_setup_true_lang.js +5 -5
  67. package/dist/components/color-picker/RuiColorBoard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  68. package/dist/components/color-picker/RuiColorDisplay.vue_vue_type_script_setup_true_lang.js +1 -1
  69. package/dist/components/color-picker/RuiColorHue.js.map +1 -1
  70. package/dist/components/color-picker/RuiColorHue.vue_vue_type_script_setup_true_lang.js +2 -2
  71. package/dist/components/color-picker/RuiColorHue.vue_vue_type_script_setup_true_lang.js.map +1 -1
  72. package/dist/components/color-picker/RuiColorInput.js.map +1 -1
  73. package/dist/components/color-picker/RuiColorInput.vue_vue_type_script_setup_true_lang.js +46 -36
  74. package/dist/components/color-picker/RuiColorInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  75. package/dist/components/color-picker/RuiColorPicker.js.map +1 -1
  76. package/dist/components/color-picker/RuiColorPicker.vue_vue_type_script_setup_true_lang.js +4 -5
  77. package/dist/components/color-picker/RuiColorPicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  78. package/dist/components/date-time-picker/RuiDateTimePicker.js.map +1 -1
  79. package/dist/components/date-time-picker/RuiDateTimePicker.vue.d.ts +3 -2
  80. package/dist/components/date-time-picker/RuiDateTimePicker.vue_vue_type_script_setup_true_lang.js +81 -80
  81. package/dist/components/date-time-picker/RuiDateTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  82. package/dist/components/date-time-picker/RuiDateTimePickerMenu.js.map +1 -1
  83. package/dist/components/date-time-picker/RuiDateTimePickerMenu.vue_vue_type_script_setup_true_lang.js +2 -2
  84. package/dist/components/date-time-picker/RuiDateTimePickerMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  85. package/dist/components/date-time-picker/RuiTimezoneSelect.js.map +1 -1
  86. package/dist/components/date-time-picker/RuiTimezoneSelect.vue.d.ts +4 -3
  87. package/dist/components/date-time-picker/RuiTimezoneSelect.vue_vue_type_script_setup_true_lang.js +3 -3
  88. package/dist/components/date-time-picker/RuiTimezoneSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
  89. package/dist/components/date-time-picker/date-time-picker-styles.d.ts +128 -219
  90. package/dist/components/date-time-picker/date-time-picker-styles.js +1 -2
  91. package/dist/components/date-time-picker/date-time-picker-styles.js.map +1 -1
  92. package/dist/components/date-time-picker/use-date-bounds.js +1 -1
  93. package/dist/components/date-time-picker/use-date-time-selection.js +65 -66
  94. package/dist/components/date-time-picker/use-date-time-selection.js.map +1 -1
  95. package/dist/components/date-time-picker/use-input-handler.js +1 -1
  96. package/dist/components/date-time-picker/use-keyboard-handler.js +29 -30
  97. package/dist/components/date-time-picker/use-keyboard-handler.js.map +1 -1
  98. package/dist/components/forms/auto-complete/RuiAutoComplete.js.map +1 -1
  99. package/dist/components/forms/auto-complete/RuiAutoComplete.vue.d.ts +1 -68
  100. package/dist/components/forms/auto-complete/RuiAutoComplete.vue_vue_type_script_setup_true_lang.js +203 -198
  101. package/dist/components/forms/auto-complete/RuiAutoComplete.vue_vue_type_script_setup_true_lang.js.map +1 -1
  102. package/dist/components/forms/auto-complete/RuiAutoCompleteOption.js.map +1 -1
  103. package/dist/components/forms/auto-complete/RuiAutoCompleteOption.vue_vue_type_script_setup_true_lang.js +1 -0
  104. package/dist/components/forms/auto-complete/RuiAutoCompleteOption.vue_vue_type_script_setup_true_lang.js.map +1 -1
  105. package/dist/components/forms/auto-complete/RuiAutoCompleteOptionList.js.map +1 -1
  106. package/dist/components/forms/auto-complete/RuiAutoCompleteOptionList.vue.d.ts +2 -0
  107. package/dist/components/forms/auto-complete/RuiAutoCompleteOptionList.vue_vue_type_script_setup_true_lang.js +8 -3
  108. package/dist/components/forms/auto-complete/RuiAutoCompleteOptionList.vue_vue_type_script_setup_true_lang.js.map +1 -1
  109. package/dist/components/forms/auto-complete/RuiAutoCompleteSelection.js.map +1 -1
  110. package/dist/components/forms/auto-complete/RuiAutoCompleteSelection.vue.d.ts +4 -0
  111. package/dist/components/forms/auto-complete/RuiAutoCompleteSelection.vue_vue_type_script_setup_true_lang.js +24 -10
  112. package/dist/components/forms/auto-complete/RuiAutoCompleteSelection.vue_vue_type_script_setup_true_lang.js.map +1 -1
  113. package/dist/components/forms/auto-complete/auto-complete-props.d.ts +66 -0
  114. package/dist/components/forms/auto-complete/auto-complete-styles.d.ts +128 -218
  115. package/dist/components/forms/auto-complete/auto-complete-styles.js +4 -2
  116. package/dist/components/forms/auto-complete/auto-complete-styles.js.map +1 -1
  117. package/dist/components/forms/category-picker/RuiCategoryPicker.js.map +1 -1
  118. package/dist/components/forms/category-picker/RuiCategoryPicker.vue.d.ts +3 -6
  119. package/dist/components/forms/category-picker/RuiCategoryPicker.vue_vue_type_script_setup_true_lang.js +154 -154
  120. package/dist/components/forms/category-picker/RuiCategoryPicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  121. package/dist/components/forms/category-picker/category-picker-styles.d.ts +83 -232
  122. package/dist/components/forms/category-picker/category-picker-styles.js +20 -26
  123. package/dist/components/forms/category-picker/category-picker-styles.js.map +1 -1
  124. package/dist/components/forms/check-control-styles.d.ts +61 -2
  125. package/dist/components/forms/check-control-styles.js +53 -46
  126. package/dist/components/forms/check-control-styles.js.map +1 -1
  127. package/dist/components/forms/checkbox/RuiCheckbox.js.map +1 -1
  128. package/dist/components/forms/checkbox/RuiCheckbox.vue_vue_type_script_setup_true_lang.js +32 -19
  129. package/dist/components/forms/checkbox/RuiCheckbox.vue_vue_type_script_setup_true_lang.js.map +1 -1
  130. package/dist/components/forms/checkbox/checkbox-group/RuiCheckboxGroup.js.map +1 -1
  131. package/dist/components/forms/checkbox/checkbox-group/RuiCheckboxGroup.vue_vue_type_script_setup_true_lang.js +4 -4
  132. package/dist/components/forms/checkbox/checkbox-group/RuiCheckboxGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  133. package/dist/components/forms/field-defaults/RuiFieldDefaults.js +7 -0
  134. package/dist/components/forms/field-defaults/RuiFieldDefaults.js.map +1 -0
  135. package/dist/components/forms/field-defaults/RuiFieldDefaults.vue.d.ts +16 -0
  136. package/dist/components/forms/field-defaults/RuiFieldDefaults.vue_vue_type_script_setup_true_lang.js +18 -0
  137. package/dist/components/forms/field-defaults/RuiFieldDefaults.vue_vue_type_script_setup_true_lang.js.map +1 -0
  138. package/dist/components/forms/field-label/RuiFieldLabel.js +7 -0
  139. package/dist/components/forms/field-label/RuiFieldLabel.js.map +1 -0
  140. package/dist/components/forms/field-label/RuiFieldLabel.vue.d.ts +17 -0
  141. package/dist/components/forms/field-label/RuiFieldLabel.vue_vue_type_script_setup_true_lang.js +57 -0
  142. package/dist/components/forms/field-label/RuiFieldLabel.vue_vue_type_script_setup_true_lang.js.map +1 -0
  143. package/dist/components/forms/file-upload/RuiFileUpload.js.map +1 -1
  144. package/dist/components/forms/file-upload/RuiFileUpload.vue.d.ts +1 -1
  145. package/dist/components/forms/file-upload/RuiFileUpload.vue_vue_type_script_setup_true_lang.js +56 -35
  146. package/dist/components/forms/file-upload/RuiFileUpload.vue_vue_type_script_setup_true_lang.js.map +1 -1
  147. package/dist/components/forms/radio-button/radio/RuiRadio.js.map +1 -1
  148. package/dist/components/forms/radio-button/radio/RuiRadio.vue_vue_type_script_setup_true_lang.js +14 -15
  149. package/dist/components/forms/radio-button/radio/RuiRadio.vue_vue_type_script_setup_true_lang.js.map +1 -1
  150. package/dist/components/forms/radio-button/radio-group/RuiRadioGroup.js.map +1 -1
  151. package/dist/components/forms/radio-button/radio-group/RuiRadioGroup.vue_vue_type_script_setup_true_lang.js +3 -3
  152. package/dist/components/forms/radio-button/radio-group/RuiRadioGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  153. package/dist/components/forms/revealable-text-field/RuiRevealableTextField.js.map +1 -1
  154. package/dist/components/forms/revealable-text-field/RuiRevealableTextField.vue_vue_type_script_setup_true_lang.js +6 -6
  155. package/dist/components/forms/revealable-text-field/RuiRevealableTextField.vue_vue_type_script_setup_true_lang.js.map +1 -1
  156. package/dist/components/forms/select/RuiMenuSelect.js.map +1 -1
  157. package/dist/components/forms/select/RuiMenuSelect.vue.d.ts +3 -12
  158. package/dist/components/forms/select/RuiMenuSelect.vue_vue_type_script_setup_true_lang.js +61 -56
  159. package/dist/components/forms/select/RuiMenuSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
  160. package/dist/components/forms/select/RuiSimpleSelect.js.map +1 -1
  161. package/dist/components/forms/select/RuiSimpleSelect.vue.d.ts +0 -1
  162. package/dist/components/forms/select/RuiSimpleSelect.vue_vue_type_script_setup_true_lang.js +13 -20
  163. package/dist/components/forms/select/RuiSimpleSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
  164. package/dist/components/forms/select/menu-select-styles.d.ts +99 -221
  165. package/dist/components/forms/select/menu-select-styles.js +1 -4
  166. package/dist/components/forms/select/menu-select-styles.js.map +1 -1
  167. package/dist/components/forms/slider/RuiSlider.js.map +1 -1
  168. package/dist/components/forms/slider/RuiSlider.vue.d.ts +0 -4
  169. package/dist/components/forms/slider/RuiSlider.vue_vue_type_script_setup_true_lang.js +129 -106
  170. package/dist/components/forms/slider/RuiSlider.vue_vue_type_script_setup_true_lang.js.map +1 -1
  171. package/dist/components/forms/slider/slider-styles.d.ts +40 -40
  172. package/dist/components/forms/slider/slider-styles.js +67 -109
  173. package/dist/components/forms/slider/slider-styles.js.map +1 -1
  174. package/dist/components/forms/switch/RuiSwitch.js.map +1 -1
  175. package/dist/components/forms/switch/RuiSwitch.vue_vue_type_script_setup_true_lang.js +33 -45
  176. package/dist/components/forms/switch/RuiSwitch.vue_vue_type_script_setup_true_lang.js.map +1 -1
  177. package/dist/components/forms/text-area/RuiTextArea.js.map +1 -1
  178. package/dist/components/forms/text-area/RuiTextArea.vue.d.ts +3 -2
  179. package/dist/components/forms/text-area/RuiTextArea.vue_vue_type_script_setup_true_lang.js +138 -117
  180. package/dist/components/forms/text-area/RuiTextArea.vue_vue_type_script_setup_true_lang.js.map +1 -1
  181. package/dist/components/forms/text-area/text-area-styles.d.ts +41 -115
  182. package/dist/components/forms/text-area/text-area-styles.js +34 -194
  183. package/dist/components/forms/text-area/text-area-styles.js.map +1 -1
  184. package/dist/components/forms/text-field/RuiTextField.js.map +1 -1
  185. package/dist/components/forms/text-field/RuiTextField.vue.d.ts +5 -2
  186. package/dist/components/forms/text-field/RuiTextField.vue_vue_type_script_setup_true_lang.js +112 -105
  187. package/dist/components/forms/text-field/RuiTextField.vue_vue_type_script_setup_true_lang.js.map +1 -1
  188. package/dist/components/forms/text-field/text-field-styles.d.ts +37 -145
  189. package/dist/components/forms/text-field/text-field-styles.js +24 -267
  190. package/dist/components/forms/text-field/text-field-styles.js.map +1 -1
  191. package/dist/components/forms/text-input-styles.d.ts +98 -229
  192. package/dist/components/forms/text-input-styles.js +63 -193
  193. package/dist/components/forms/text-input-styles.js.map +1 -1
  194. package/dist/components/helpers/RuiFormTextDetail.js.map +1 -1
  195. package/dist/components/helpers/RuiFormTextDetail.vue.d.ts +11 -1
  196. package/dist/components/helpers/RuiFormTextDetail.vue_vue_type_script_setup_true_lang.js +5 -5
  197. package/dist/components/helpers/RuiFormTextDetail.vue_vue_type_script_setup_true_lang.js.map +1 -1
  198. package/dist/components/icons/RuiIcon.js.map +1 -1
  199. package/dist/components/icons/RuiIcon.vue_vue_type_script_setup_true_lang.js +7 -4
  200. package/dist/components/icons/RuiIcon.vue_vue_type_script_setup_true_lang.js.map +1 -1
  201. package/dist/components/index.d.ts +5 -3
  202. package/dist/components/index.js +4 -3
  203. package/dist/components/loaders/RuiSkeletonBase.js.map +1 -1
  204. package/dist/components/loaders/RuiSkeletonBase.vue_vue_type_script_setup_true_lang.js +6 -5
  205. package/dist/components/loaders/RuiSkeletonBase.vue_vue_type_script_setup_true_lang.js.map +1 -1
  206. package/dist/components/loaders/RuiSkeletonLoader.js.map +1 -1
  207. package/dist/components/loaders/RuiSkeletonLoader.vue_vue_type_script_setup_true_lang.js +8 -8
  208. package/dist/components/loaders/RuiSkeletonLoader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  209. package/dist/components/logos/RuiLogo.js.map +1 -1
  210. package/dist/components/logos/RuiLogo.vue_vue_type_script_setup_true_lang.js +2 -2
  211. package/dist/components/logos/RuiLogo.vue_vue_type_script_setup_true_lang.js.map +1 -1
  212. package/dist/components/overlays/badge/RuiBadge.js.map +1 -1
  213. package/dist/components/overlays/badge/RuiBadge.vue_vue_type_script_setup_true_lang.js +76 -48
  214. package/dist/components/overlays/badge/RuiBadge.vue_vue_type_script_setup_true_lang.js.map +1 -1
  215. package/dist/components/overlays/dialog/RuiDialog.js.map +1 -1
  216. package/dist/components/overlays/dialog/RuiDialog.vue.d.ts +3 -2
  217. package/dist/components/overlays/dialog/RuiDialog.vue_vue_type_script_setup_true_lang.js +17 -13
  218. package/dist/components/overlays/dialog/RuiDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
  219. package/dist/components/overlays/menu/RuiMenu.js.map +1 -1
  220. package/dist/components/overlays/menu/RuiMenu.vue.d.ts +9 -7
  221. package/dist/components/overlays/menu/RuiMenu.vue_vue_type_script_setup_true_lang.js +33 -29
  222. package/dist/components/overlays/menu/RuiMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  223. package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.js.map +1 -1
  224. package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.vue.d.ts +6 -2
  225. package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.vue_vue_type_script_setup_true_lang.js +49 -25
  226. package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.vue_vue_type_script_setup_true_lang.js.map +1 -1
  227. package/dist/components/overlays/notification/RuiNotification.js.map +1 -1
  228. package/dist/components/overlays/notification/RuiNotification.vue_vue_type_script_setup_true_lang.js +7 -8
  229. package/dist/components/overlays/notification/RuiNotification.vue_vue_type_script_setup_true_lang.js.map +1 -1
  230. package/dist/components/overlays/tooltip/RuiTooltip.js.map +1 -1
  231. package/dist/components/overlays/tooltip/RuiTooltip.vue.d.ts +0 -5
  232. package/dist/components/overlays/tooltip/RuiTooltip.vue_vue_type_script_setup_true_lang.js +17 -11
  233. package/dist/components/overlays/tooltip/RuiTooltip.vue_vue_type_script_setup_true_lang.js.map +1 -1
  234. package/dist/components/overlays/tooltip/tooltip-styles.d.ts +5 -12
  235. package/dist/components/overlays/tooltip/tooltip-styles.js +11 -18
  236. package/dist/components/overlays/tooltip/tooltip-styles.js.map +1 -1
  237. package/dist/components/progress/RuiProgress.js.map +1 -1
  238. package/dist/components/progress/RuiProgress.vue.d.ts +4 -0
  239. package/dist/components/progress/RuiProgress.vue_vue_type_script_setup_true_lang.js +73 -47
  240. package/dist/components/progress/RuiProgress.vue_vue_type_script_setup_true_lang.js.map +1 -1
  241. package/dist/components/steppers/RuiFooterStepper.js.map +1 -1
  242. package/dist/components/steppers/RuiFooterStepper.vue_vue_type_script_setup_true_lang.js +28 -29
  243. package/dist/components/steppers/RuiFooterStepper.vue_vue_type_script_setup_true_lang.js.map +1 -1
  244. package/dist/components/steppers/RuiStepper.js.map +1 -1
  245. package/dist/components/steppers/RuiStepper.vue.d.ts +0 -4
  246. package/dist/components/steppers/RuiStepper.vue_vue_type_script_setup_true_lang.js +36 -29
  247. package/dist/components/steppers/RuiStepper.vue_vue_type_script_setup_true_lang.js.map +1 -1
  248. package/dist/components/steppers/RuiStepperIcon.js.map +1 -1
  249. package/dist/components/steppers/RuiStepperIcon.vue.d.ts +2 -0
  250. package/dist/components/steppers/RuiStepperIcon.vue_vue_type_script_setup_true_lang.js +47 -47
  251. package/dist/components/steppers/RuiStepperIcon.vue_vue_type_script_setup_true_lang.js.map +1 -1
  252. package/dist/components/tables/RuiDataTable.js.map +1 -1
  253. package/dist/components/tables/RuiDataTable.vue.d.ts +3 -6
  254. package/dist/components/tables/RuiDataTable.vue_vue_type_script_setup_true_lang.js +85 -67
  255. package/dist/components/tables/RuiDataTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  256. package/dist/components/tables/RuiExpandButton.js.map +1 -1
  257. package/dist/components/tables/RuiExpandButton.vue_vue_type_script_setup_true_lang.js +1 -0
  258. package/dist/components/tables/RuiExpandButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  259. package/dist/components/tables/RuiTable.js.map +1 -1
  260. package/dist/components/tables/RuiTable.vue_vue_type_script_setup_true_lang.js +8 -5
  261. package/dist/components/tables/RuiTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  262. package/dist/components/tables/RuiTableEmptyState.js.map +1 -1
  263. package/dist/components/tables/RuiTableEmptyState.vue_vue_type_script_setup_true_lang.js +1 -1
  264. package/dist/components/tables/RuiTableEmptyState.vue_vue_type_script_setup_true_lang.js.map +1 -1
  265. package/dist/components/tables/RuiTableHead.js.map +1 -1
  266. package/dist/components/tables/RuiTableHead.vue_vue_type_script_setup_true_lang.js +89 -67
  267. package/dist/components/tables/RuiTableHead.vue_vue_type_script_setup_true_lang.js.map +1 -1
  268. package/dist/components/tables/RuiTablePagination.js.map +1 -1
  269. package/dist/components/tables/RuiTablePagination.vue_vue_type_script_setup_true_lang.js +9 -12
  270. package/dist/components/tables/RuiTablePagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  271. package/dist/components/tables/data-table/RuiDataTableCell.vue_vue_type_script_setup_true_lang.js +1 -1
  272. package/dist/components/tables/data-table/RuiDataTableExpandedRow.js.map +1 -1
  273. package/dist/components/tables/data-table/RuiDataTableExpandedRow.vue_vue_type_script_setup_true_lang.js +3 -3
  274. package/dist/components/tables/data-table/RuiDataTableExpandedRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
  275. package/dist/components/tables/data-table/RuiDataTableGroupRow.js.map +1 -1
  276. package/dist/components/tables/data-table/RuiDataTableGroupRow.vue_vue_type_script_setup_true_lang.js +8 -4
  277. package/dist/components/tables/data-table/RuiDataTableGroupRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
  278. package/dist/components/tables/data-table/RuiDataTableMobileSort.js.map +1 -1
  279. package/dist/components/tables/data-table/RuiDataTableMobileSort.vue_vue_type_script_setup_true_lang.js +2 -2
  280. package/dist/components/tables/data-table/RuiDataTableMobileSort.vue_vue_type_script_setup_true_lang.js.map +1 -1
  281. package/dist/components/tables/data-table/RuiDataTableRow.js.map +1 -1
  282. package/dist/components/tables/data-table/RuiDataTableRow.vue_vue_type_script_setup_true_lang.js +47 -8
  283. package/dist/components/tables/data-table/RuiDataTableRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
  284. package/dist/components/tables/data-table-styles.d.ts +24 -0
  285. package/dist/components/tables/data-table-styles.js +35 -20
  286. package/dist/components/tables/data-table-styles.js.map +1 -1
  287. package/dist/components/tables/table_no_data_placeholder.js +1 -1
  288. package/dist/components/tables/table_no_data_placeholder.js.map +1 -1
  289. package/dist/components/tables/table_no_data_placeholder_dark.js +1 -1
  290. package/dist/components/tables/table_no_data_placeholder_dark.js.map +1 -1
  291. package/dist/components/tables/use-pagination-navigation.js +1 -1
  292. package/dist/components/tabs/tab/RuiTab.js.map +1 -1
  293. package/dist/components/tabs/tab/RuiTab.vue.d.ts +2 -5
  294. package/dist/components/tabs/tab/RuiTab.vue_vue_type_script_setup_true_lang.js +95 -69
  295. package/dist/components/tabs/tab/RuiTab.vue_vue_type_script_setup_true_lang.js.map +1 -1
  296. package/dist/components/tabs/tab/use-tab-link.js +1 -1
  297. package/dist/components/tabs/tab-item/RuiTabItem.js.map +1 -1
  298. package/dist/components/tabs/tab-item/RuiTabItem.vue.d.ts +0 -1
  299. package/dist/components/tabs/tab-item/RuiTabItem.vue_vue_type_script_setup_true_lang.js +5 -11
  300. package/dist/components/tabs/tab-item/RuiTabItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  301. package/dist/components/tabs/tab-items/RuiTabItems.js.map +1 -1
  302. package/dist/components/tabs/tab-items/RuiTabItems.vue_vue_type_script_setup_true_lang.js +8 -13
  303. package/dist/components/tabs/tab-items/RuiTabItems.vue_vue_type_script_setup_true_lang.js.map +1 -1
  304. package/dist/components/tabs/tab-props.d.ts +7 -1
  305. package/dist/components/tabs/tab-props.js +7 -1
  306. package/dist/components/tabs/tab-props.js.map +1 -1
  307. package/dist/components/tabs/tabs/RuiTabs.js.map +1 -1
  308. package/dist/components/tabs/tabs/RuiTabs.vue.d.ts +2 -1
  309. package/dist/components/tabs/tabs/RuiTabs.vue_vue_type_script_setup_true_lang.js +188 -43
  310. package/dist/components/tabs/tabs/RuiTabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
  311. package/dist/components/tabs/tabs/use-tab-indicator.d.ts +27 -0
  312. package/dist/components/tabs/tabs/use-tab-indicator.js +67 -0
  313. package/dist/components/tabs/tabs/use-tab-indicator.js.map +1 -0
  314. package/dist/components/tabs/tabs/use-tab-keyboard.d.ts +17 -0
  315. package/dist/components/tabs/tabs/use-tab-keyboard.js +57 -0
  316. package/dist/components/tabs/tabs/use-tab-keyboard.js.map +1 -0
  317. package/dist/components/tabs/tabs/use-tab-routing.js +1 -2
  318. package/dist/components/tabs/tabs/use-tab-routing.js.map +1 -1
  319. package/dist/components/tabs/tabs/use-tab-scroll.js +15 -15
  320. package/dist/components/tabs/tabs/use-tab-scroll.js.map +1 -1
  321. package/dist/components/time-picker/RuiTimePicker.js.map +1 -1
  322. package/dist/components/time-picker/RuiTimePicker.vue_vue_type_script_setup_true_lang.js +95 -93
  323. package/dist/components/time-picker/RuiTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  324. package/dist/components/time-picker/time-picker-styles.d.ts +18 -0
  325. package/dist/components/time-picker/time-picker-styles.js +16 -10
  326. package/dist/components/time-picker/time-picker-styles.js.map +1 -1
  327. package/dist/composables/breakpoint.js +3 -3
  328. package/dist/composables/breakpoint.js.map +1 -1
  329. package/dist/composables/defaults/field.d.ts +22 -0
  330. package/dist/composables/defaults/field.js +29 -0
  331. package/dist/composables/defaults/field.js.map +1 -0
  332. package/dist/composables/dropdown-menu.d.ts +23 -11
  333. package/dist/composables/dropdown-menu.js +44 -34
  334. package/dist/composables/dropdown-menu.js.map +1 -1
  335. package/dist/composables/floating.d.ts +1 -3
  336. package/dist/composables/floating.js +16 -13
  337. package/dist/composables/floating.js.map +1 -1
  338. package/dist/composables/forms/auto-complete/chips.d.ts +22 -0
  339. package/dist/composables/forms/auto-complete/chips.js +42 -0
  340. package/dist/composables/forms/auto-complete/chips.js.map +1 -0
  341. package/dist/composables/forms/auto-complete/combobox.d.ts +25 -0
  342. package/dist/composables/forms/auto-complete/combobox.js +35 -0
  343. package/dist/composables/forms/auto-complete/combobox.js.map +1 -0
  344. package/dist/composables/forms/auto-complete/focus.d.ts +5 -2
  345. package/dist/composables/forms/auto-complete/focus.js +44 -19
  346. package/dist/composables/forms/auto-complete/focus.js.map +1 -1
  347. package/dist/composables/forms/auto-complete/index.d.ts +3 -0
  348. package/dist/composables/forms/auto-complete/keyboard-navigation.d.ts +8 -1
  349. package/dist/composables/forms/auto-complete/keyboard-navigation.js +49 -21
  350. package/dist/composables/forms/auto-complete/keyboard-navigation.js.map +1 -1
  351. package/dist/composables/forms/auto-complete/search.js +6 -7
  352. package/dist/composables/forms/auto-complete/search.js.map +1 -1
  353. package/dist/composables/forms/auto-complete/selection.d.ts +37 -0
  354. package/dist/composables/forms/auto-complete/selection.js +60 -0
  355. package/dist/composables/forms/auto-complete/selection.js.map +1 -0
  356. package/dist/composables/forms/auto-complete/value.js +20 -1
  357. package/dist/composables/forms/auto-complete/value.js.map +1 -1
  358. package/dist/composables/forms/category-picker/use-category-picker.js +1 -1
  359. package/dist/composables/forms/use-prepend-append-width.js +6 -6
  360. package/dist/composables/forms/use-prepend-append-width.js.map +1 -1
  361. package/dist/composables/keyboard-scroll.d.ts +17 -0
  362. package/dist/composables/keyboard-scroll.js +58 -0
  363. package/dist/composables/keyboard-scroll.js.map +1 -0
  364. package/dist/composables/overlay-stack.js +1 -1
  365. package/dist/composables/sticky-header.d.ts +8 -0
  366. package/dist/composables/sticky-header.js +21 -10
  367. package/dist/composables/sticky-header.js.map +1 -1
  368. package/dist/composables/tables/data-table/columns.js +1 -1
  369. package/dist/composables/tables/data-table/expansion.js +1 -1
  370. package/dist/composables/tables/data-table/grouping.js +27 -28
  371. package/dist/composables/tables/data-table/grouping.js.map +1 -1
  372. package/dist/composables/tables/data-table/page-scroll.d.ts +32 -0
  373. package/dist/composables/tables/data-table/page-scroll.js +144 -0
  374. package/dist/composables/tables/data-table/page-scroll.js.map +1 -0
  375. package/dist/composables/tables/data-table/pagination.js +1 -1
  376. package/dist/composables/tables/data-table/selection.js +37 -38
  377. package/dist/composables/tables/data-table/selection.js.map +1 -1
  378. package/dist/composables/tables/data-table/sort.js +1 -1
  379. package/dist/composables/theme.js +12 -12
  380. package/dist/composables/theme.js.map +1 -1
  381. package/dist/composables/timeout-manager.js +1 -1
  382. package/dist/consts/colors.d.ts +4 -0
  383. package/dist/consts/colors.js +1 -37
  384. package/dist/consts/colors.js.map +1 -1
  385. package/dist/consts/tokens.d.ts +56 -0
  386. package/dist/consts/tokens.js +46 -0
  387. package/dist/consts/tokens.js.map +1 -0
  388. package/dist/consts/typography.d.ts +51 -18
  389. package/dist/index.d.ts +7 -2
  390. package/dist/index.js +10 -6
  391. package/dist/index.js.map +1 -1
  392. package/dist/library-icons.json +0 -10
  393. package/dist/style.css +5629 -4678
  394. package/dist/styles/colors.css +315 -0
  395. package/dist/styles/tokens.css +50 -0
  396. package/dist/tailwind.css +145 -0
  397. package/dist/theme/theme.css +403 -0
  398. package/dist/theme.css +403 -0
  399. package/dist/types/dom.d.ts +9 -0
  400. package/dist/types/theme.d.ts +2 -3
  401. package/dist/types/theme.js.map +1 -1
  402. package/dist/utils/form-text-detail.js +1 -1
  403. package/dist/utils/helpers.d.ts +0 -8
  404. package/dist/utils/helpers.js +1 -2
  405. package/dist/utils/helpers.js.map +1 -1
  406. package/dist/utils/tv.js +13 -21
  407. package/dist/utils/tv.js.map +1 -1
  408. package/dist/vendor/@vueuse/core/dist/index.js +1577 -0
  409. package/dist/vendor/@vueuse/core/dist/index.js.map +1 -0
  410. package/dist/vendor/@vueuse/shared/dist/index.js +563 -0
  411. package/dist/vendor/@vueuse/shared/dist/index.js.map +1 -0
  412. package/dist/vite-plugin/index.js +5 -6
  413. package/dist/vite-plugin/index.js.map +1 -1
  414. package/dist/web-types.json +278 -403
  415. package/package.json +17 -19
  416. package/dist/components/icons/LazyIcon.vue.d.ts +0 -8
  417. package/dist/components/steppers/RuiStepperCustomIcon.js +0 -7
  418. package/dist/components/steppers/RuiStepperCustomIcon.js.map +0 -1
  419. package/dist/components/steppers/RuiStepperCustomIcon.vue.d.ts +0 -8
  420. package/dist/components/steppers/RuiStepperCustomIcon.vue_vue_type_script_setup_true_lang.js +0 -43
  421. package/dist/components/steppers/RuiStepperCustomIcon.vue_vue_type_script_setup_true_lang.js.map +0 -1
  422. package/dist/composables/colors/common.d.ts +0 -20
  423. package/dist/composables/colors/index.d.ts +0 -3
  424. package/dist/composables/colors/text-input.d.ts +0 -27
  425. package/dist/composables/forms/use-label-with-quote.d.ts +0 -2
  426. package/dist/composables/popper.d.ts +0 -16
  427. package/dist/composables/popper.js +0 -23
  428. package/dist/composables/popper.js.map +0 -1
  429. package/dist/consts/forms/auto-complete/index.d.ts +0 -4
  430. package/dist/theme/index.d.ts +0 -5
  431. package/dist/theme/index.js +0 -162
  432. package/dist/theme/index.js.map +0 -1
  433. package/dist/utils/forms/auto-complete/index.d.ts +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"button-styles.js","names":[],"sources":["../../../../src/components/buttons/button/button-styles.ts"],"sourcesContent":["import { tv } from '@/utils/tv';\n\n/**\n * The button's classes.\n *\n * Three decisions the class lists cannot state themselves:\n *\n * `position: relative` is not in the base root: it is only a positioning\n * context for the loading spinner, so the `loading` variant applies it.\n * Basing it here would collide with consumers pinning the button with\n * `fixed`/`absolute`, since cascade order picks the later utility, usually\n * `relative`, and turns their `right-*`/`bottom-*` into relative offsets,\n * which misplaces FABs.\n *\n * Icon sizing flows through the `--rui-icon-size` custom property, seeded at\n * the md value in the base root and redefined per size variant with `!` so a\n * variant beats the baseline on the same element regardless of source order.\n * RuiIcon's own `size` prop stamps an inline style on the svg, which beats the\n * inherited value, so a consumer always wins. See rotki/ui-library#512.\n *\n * `disabled` on the element covers two states: actually disabled, and loading,\n * since RuiButton sets `disabled = disabled || loading`. Only the cursor is\n * shared between them; the grey disabled palette lives in the `loading: false`\n * compounds, so a loading button keeps its variant color behind the spinner.\n *\n * An icon-only button matches the height of the text button of the same size,\n * with a 60-70% glyph ratio, which is a larger glyph than the same size gives\n * a prepend/append icon so it does not look lost in the square. xs pads by an\n * arbitrary 0.1875rem because no Tailwind token holds the ratio at a 14px\n * glyph:\n *\n * ```\n * xs p-[0.1875rem] + 0.875rem icon = 1.25rem (20px) 70%\n * sm p-1 + 1.25rem icon = 1.75rem (28px) 71%\n * md (default) p-1.5 + 1.25rem icon = 2rem (32px) 63%\n * lg p-1.5 + 1.5rem icon = 2.25rem (36px) 67%\n * xl p-2 + 1.5rem icon = 2.5rem (40px) 60%\n * 2xl p-2 + 1.75rem icon = 2.75rem (44px) 64%\n * ```\n */\nexport const buttonStyles = tv({\n slots: {\n root: [\n 'text-sm leading-5 font-medium outline outline-1 outline-transparent outline-offset-[-1px]',\n 'flex items-center justify-center gap-x-2',\n 'px-4 py-1.5 rounded transition-all',\n '[--rui-icon-size:1.125rem]',\n 'disabled:cursor-not-allowed',\n 'focus-visible:!ring-2',\n ].join(' '),\n label: 'inline-block text-nowrap',\n spinner: 'absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2',\n },\n variants: {\n variant: {\n default: {},\n outlined: {},\n text: { root: 'px-2' },\n fab: { root: 'rounded-full py-2' },\n // The label's 18px line-box matches the md icon box, so the two share an optical center (rotki/ui-library#515)\n list: { root: 'p-3 px-3 rounded-none w-full justify-start text-left', label: 'w-full leading-[1.125rem]' },\n },\n size: {\n 'xs': { root: 'px-2 py-[0.125rem] text-[.75rem] leading-4 ![--rui-icon-size:0.75rem]' },\n 'sm': { root: 'px-2.5 py-1 text-[.8125rem] leading-5 ![--rui-icon-size:1rem]' },\n 'lg': { root: 'px-6 py-2 text-[1rem] leading-5 ![--rui-icon-size:1.25rem]' },\n // 40px, to line up with RuiTextField / RuiMenuSelect in a toolbar; a 44px jumbo CTA is `2xl`\n 'xl': { root: 'px-6 py-2 text-[1rem] leading-6 ![--rui-icon-size:1.375rem]' },\n '2xl': { root: 'px-6 py-2.5 text-[1rem] leading-6 ![--rui-icon-size:1.375rem]' },\n },\n color: {\n grey: { root: 'bg-rui-grey-200 hover:bg-rui-grey-100 active:bg-rui-grey-50 text-rui-text ring-rui-grey-400 dark:bg-rui-grey-300 dark:text-rui-light-text dark:ring-rui-grey-600' },\n primary: { root: 'bg-rui-primary hover:bg-rui-primary-darker active:bg-rui-primary-darker/90 text-rui-dark-text ring-rui-primary/40 dark:text-rui-text dark:ring-rui-primary/60' },\n secondary: { root: 'bg-rui-secondary hover:bg-rui-secondary-darker active:bg-rui-secondary-darker/90 text-rui-dark-text ring-rui-secondary/40 dark:text-rui-text dark:ring-rui-secondary/60' },\n error: { root: 'bg-rui-error hover:bg-rui-error-darker active:bg-rui-error-darker/90 text-rui-dark-text ring-rui-error/40 dark:text-rui-text dark:ring-rui-error/60' },\n warning: { root: 'bg-rui-warning hover:bg-rui-warning-darker active:bg-rui-warning-darker/90 text-rui-dark-text ring-rui-warning/40 dark:text-rui-text dark:ring-rui-warning/60' },\n info: { root: 'bg-rui-info hover:bg-rui-info-darker active:bg-rui-info-darker/90 text-rui-dark-text ring-rui-info/40 dark:text-rui-text dark:ring-rui-info/60' },\n success: { root: 'bg-rui-success hover:bg-rui-success-darker active:bg-rui-success-darker/90 text-rui-dark-text ring-rui-success/40 dark:text-rui-text dark:ring-rui-success/60' },\n },\n rounded: {\n true: { root: 'rounded-full' },\n },\n icon: {\n // Only the round shape; the `icon + size` compounds below carry padding and icon sizing\n true: { root: 'rounded-full' },\n },\n active: {\n true: {},\n false: {},\n },\n loading: {\n true: { root: 'relative !cursor-progress space-x-0 [&>*:not([data-spinner])]:opacity-0 [&>*:not([data-spinner])]:invisible' },\n false: {},\n },\n hideFocusIndicator: {\n true: { root: 'focus-visible:!ring-0' },\n },\n },\n compoundVariants: [\n // Disabled appearance: the Material disabled palette, skipped while loading so the variant color shows behind the spinner\n { loading: false, class: { root: 'disabled:!bg-black/[.12] dark:disabled:!bg-white/[.12] disabled:!text-rui-text-disabled disabled:active:!text-rui-text-disabled' } },\n { loading: false, variant: 'outlined', class: { root: 'disabled:!bg-transparent dark:disabled:!bg-transparent disabled:active:!bg-transparent disabled:outline-rui-text-disabled' } },\n { loading: false, variant: 'text', class: { root: 'disabled:!bg-transparent dark:disabled:!bg-transparent disabled:active:!bg-transparent' } },\n { loading: false, variant: 'list', class: { root: 'disabled:!bg-transparent dark:disabled:!bg-transparent disabled:active:!bg-transparent' } },\n\n // === Grey color variants ===\n { color: 'grey', active: true, class: { root: 'bg-rui-grey-50' } },\n { color: 'grey', variant: ['outlined', 'text', 'list'], class: { root: 'bg-transparent hover:bg-black/[.04] active:bg-black/10 dark:bg-transparent dark:active:bg-white/10 dark:hover:bg-white/[.04] dark:text-rui-text' } },\n { color: 'grey', variant: ['outlined', 'text', 'list'], active: true, class: { root: 'bg-black/10 dark:bg-white/30' } },\n // Material's 23% outline: at full strength a neutral edge reads as an error state next to the 50% context colours\n { color: 'grey', variant: 'outlined', class: { root: 'outline-black/[0.23] dark:outline-white/[0.23]' } },\n { color: 'grey', variant: 'text', class: { root: 'text-rui-text-secondary' } },\n\n // Context colors: `dark:text-rui-<color>` beats the base variant's `dark:text-rui-text`, which is meant for filled buttons\n { color: 'primary', variant: ['outlined', 'text', 'list'], class: { root: 'bg-transparent hover:bg-rui-primary-lighter/[.04] active:bg-rui-primary-lighter/10 text-rui-primary dark:text-rui-primary' } },\n { color: 'secondary', variant: ['outlined', 'text', 'list'], class: { root: 'bg-transparent hover:bg-rui-secondary-lighter/[.04] active:bg-rui-secondary-lighter/10 text-rui-secondary dark:text-rui-secondary' } },\n { color: 'error', variant: ['outlined', 'text', 'list'], class: { root: 'bg-transparent hover:bg-rui-error-lighter/[.04] active:bg-rui-error-lighter/10 text-rui-error dark:text-rui-error' } },\n { color: 'warning', variant: ['outlined', 'text', 'list'], class: { root: 'bg-transparent hover:bg-rui-warning-lighter/[.04] active:bg-rui-warning-lighter/10 text-rui-warning dark:text-rui-warning' } },\n { color: 'info', variant: ['outlined', 'text', 'list'], class: { root: 'bg-transparent hover:bg-rui-info-lighter/[.04] active:bg-rui-info-lighter/10 text-rui-info dark:text-rui-info' } },\n { color: 'success', variant: ['outlined', 'text', 'list'], class: { root: 'bg-transparent hover:bg-rui-success-lighter/[.04] active:bg-rui-success-lighter/10 text-rui-success dark:text-rui-success' } },\n\n // === Context colors — active default ===\n { color: 'primary', active: true, class: { root: 'bg-rui-primary-darker' } },\n { color: 'secondary', active: true, class: { root: 'bg-rui-secondary-darker' } },\n { color: 'error', active: true, class: { root: 'bg-rui-error-darker' } },\n { color: 'warning', active: true, class: { root: 'bg-rui-warning-darker' } },\n { color: 'info', active: true, class: { root: 'bg-rui-info-darker' } },\n { color: 'success', active: true, class: { root: 'bg-rui-success-darker' } },\n\n // === Context colors — active outlined/text ===\n { color: 'primary', variant: ['outlined', 'text', 'list'], active: true, class: { root: 'bg-rui-primary-lighter/30' } },\n { color: 'secondary', variant: ['outlined', 'text', 'list'], active: true, class: { root: 'bg-rui-secondary-lighter/30' } },\n { color: 'error', variant: ['outlined', 'text', 'list'], active: true, class: { root: 'bg-rui-error-lighter/30' } },\n { color: 'warning', variant: ['outlined', 'text', 'list'], active: true, class: { root: 'bg-rui-warning-lighter/30' } },\n { color: 'info', variant: ['outlined', 'text', 'list'], active: true, class: { root: 'bg-rui-info-lighter/30' } },\n { color: 'success', variant: ['outlined', 'text', 'list'], active: true, class: { root: 'bg-rui-success-lighter/30' } },\n\n // === Context colors — outlined border ===\n { color: 'primary', variant: 'outlined', class: { root: 'outline-rui-primary/[0.5]' } },\n { color: 'secondary', variant: 'outlined', class: { root: 'outline-rui-secondary/[0.5]' } },\n { color: 'error', variant: 'outlined', class: { root: 'outline-rui-error/[0.5]' } },\n { color: 'warning', variant: 'outlined', class: { root: 'outline-rui-warning/[0.5]' } },\n { color: 'info', variant: 'outlined', class: { root: 'outline-rui-info/[0.5]' } },\n { color: 'success', variant: 'outlined', class: { root: 'outline-rui-success/[0.5]' } },\n\n // === Size overrides per variant ===\n { variant: 'text', size: 'xs', class: { root: 'px-1' } },\n { variant: 'text', size: 'sm', class: { root: 'px-1.5' } },\n { variant: 'text', size: 'lg', class: { root: 'px-2.5' } },\n { variant: 'text', size: 'xl', class: { root: 'px-2.5' } },\n { variant: 'text', size: '2xl', class: { root: 'px-2.5' } },\n { variant: 'fab', size: 'xs', class: { root: 'py-1 px-1' } },\n { variant: 'fab', size: 'sm', class: { root: 'py-1.5 px-2' } },\n { variant: 'fab', size: 'lg', class: { root: 'py-3' } },\n { variant: 'list', size: 'xs', class: { root: 'px-3 py-0.5' } },\n { variant: 'list', size: 'sm', class: { root: 'px-3 py-1' } },\n // Icon-only sizing, per the padding and glyph table on buttonStyles above\n { icon: true, class: { root: 'p-1.5 ![--rui-icon-size:1.25rem]' } },\n { icon: true, size: 'xs', class: { root: 'p-[0.1875rem] ![--rui-icon-size:0.875rem]' } },\n { icon: true, size: 'sm', class: { root: 'p-1 ![--rui-icon-size:1.25rem]' } },\n { icon: true, size: 'lg', class: { root: 'p-1.5 ![--rui-icon-size:1.5rem]' } },\n { icon: true, size: 'xl', class: { root: 'p-2 ![--rui-icon-size:1.5rem]' } },\n { icon: true, size: '2xl', class: { root: 'p-2 ![--rui-icon-size:1.75rem]' } },\n { variant: 'fab', icon: true, size: 'sm', class: { root: 'px-2 py-2' } },\n ],\n compoundSlots: [\n // Dark mode default variant text override for warning/success/info\n { slots: ['root'], color: ['warning', 'success', 'info'], variant: 'default', class: 'dark:text-rui-light-text' },\n // Dark mode active outlined/text override for primary/secondary\n { slots: ['root'], color: 'primary', variant: ['outlined', 'text', 'list'], active: true, class: 'dark:bg-rui-primary-darker/60 dark:text-rui-primary-lighter' },\n { slots: ['root'], color: 'secondary', variant: ['outlined', 'text', 'list'], active: true, class: 'dark:bg-rui-secondary-darker/60 dark:text-rui-secondary-lighter' },\n ],\n defaultVariants: {\n variant: 'default',\n color: 'grey',\n active: false,\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAa,eAAe,GAAG;CAC7B,OAAO;EACL,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;EACF,CAAC,CAAC,KAAK,GAAG;EACV,OAAO;EACP,SAAS;CACX;CACA,UAAU;EACR,SAAS;GACP,SAAS,CAAC;GACV,UAAU,CAAC;GACX,MAAM,EAAE,MAAM,OAAO;GACrB,KAAK,EAAE,MAAM,oBAAoB;GAEjC,MAAM;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,SAAS;IAAC;IAAY;IAAQ;GAAM;GAAG,QAAQ;GAAM,OAAO;EAAkE;CACvK;CACA,iBAAiB;EACf,SAAS;EACT,OAAO;EACP,QAAQ;CACV;AACF,CAAC"}
1
+ {"version":3,"file":"button-styles.js","names":[],"sources":["../../../../src/components/buttons/button/button-styles.ts"],"sourcesContent":["import { tv } from '@/utils/tv';\n\n/**\n * The button's classes.\n *\n * Three decisions the class lists cannot state themselves:\n *\n * `position: relative` is not in the base root: it is only a positioning\n * context for the loading spinner, so the `loading` variant applies it.\n * Basing it here would collide with consumers pinning the button with\n * `fixed`/`absolute`, since cascade order picks the later utility, usually\n * `relative`, and turns their `right-*`/`bottom-*` into relative offsets,\n * which misplaces FABs.\n *\n * Icon sizing flows through the `--rui-icon-size` custom property, seeded at\n * the md value in the base root and redefined per size variant with `!` so a\n * variant beats the baseline on the same element regardless of source order.\n * RuiIcon's own `size` prop stamps an inline style on the svg, which beats the\n * inherited value, so a consumer always wins. See rotki/ui-library#512.\n *\n * `disabled` on the element covers two states: actually disabled, and loading,\n * since RuiButton sets `disabled = disabled || loading`. Only the cursor is\n * shared between them; the grey disabled palette lives in the `loading: false`\n * compounds, so a loading button keeps its variant color behind the spinner.\n *\n * An icon-only button matches the height of the text button of the same size,\n * with a 60-70% glyph ratio, which is a larger glyph than the same size gives\n * a prepend/append icon so it does not look lost in the square. xs pads by an\n * arbitrary 0.1875rem because no Tailwind token holds the ratio at a 14px\n * glyph:\n *\n * ```\n * xs p-[0.1875rem] + 0.875rem icon = 1.25rem (20px) 70%\n * sm p-1 + 1.25rem icon = 1.75rem (28px) 71%\n * md (default) p-2 + 1.25rem icon = 2.25rem (36px) 56%\n * lg p-1.5 + 1.5rem icon = 2.25rem (36px) 67%\n * xl p-2 + 1.5rem icon = 2.5rem (40px) 60%\n * 2xl p-2 + 1.75rem icon = 2.75rem (44px) 64%\n * ```\n */\nexport const buttonStyles = tv({\n slots: {\n root: [\n 'text-sm leading-5 font-medium inset-ring inset-ring-transparent',\n 'flex items-center justify-center gap-x-2',\n // md is 36px, the height of a text field or select, so a button lines up with them in a row\n 'px-4 py-2 rounded-rui-control transition-colors duration-150',\n '[--rui-icon-size:1rem]',\n 'disabled:cursor-not-allowed',\n 'focus-visible:focus-ring',\n ].join(' '),\n label: 'inline-block text-nowrap',\n // inline in the prepend icon's place; an icon-only button centers it over its hidden glyph instead\n spinner: 'shrink-0',\n },\n variants: {\n variant: {\n default: {},\n outlined: {},\n text: { root: 'px-2' },\n fab: { root: 'rounded-full py-2 shadow-rui-control disabled:shadow-none' },\n // The label's 16px line-box matches the md icon box, so the two share an optical center (rotki/ui-library#515)\n list: { root: 'p-3 px-3 rounded-rui-sm w-full justify-start text-left', label: 'w-full leading-4' },\n },\n size: {\n 'xs': { root: 'px-2 py-[0.125rem] text-[.75rem] leading-4 ![--rui-icon-size:0.75rem]' },\n 'sm': { root: 'px-2.5 py-1 text-[.8125rem] leading-5 ![--rui-icon-size:0.875rem]' },\n 'lg': { root: 'px-6 py-2 text-[1rem] leading-5 ![--rui-icon-size:1.25rem]' },\n // 40px, to line up with RuiTextField / RuiMenuSelect in a toolbar; a 44px jumbo CTA is `2xl`\n 'xl': { root: 'px-6 py-2 text-[1rem] leading-6 ![--rui-icon-size:1.375rem]' },\n '2xl': { root: 'px-6 py-2.5 text-[1rem] leading-6 ![--rui-icon-size:1.375rem]' },\n },\n color: {\n grey: { root: 'bg-rui-neutral-100 hover:bg-rui-neutral-200 active:bg-rui-neutral-300 text-rui-text dark:bg-rui-neutral-800 dark:hover:bg-rui-neutral-700 dark:active:bg-rui-neutral-600' },\n // hover is a tint laid over the fill (see the filled compound below); pressed sinks to `darker`\n primary: { root: 'bg-rui-primary active:bg-rui-primary-darker text-rui-dark-text dark:text-rui-text' },\n secondary: { root: 'bg-rui-secondary active:bg-rui-secondary-darker text-rui-dark-text dark:text-rui-text' },\n error: { root: 'bg-rui-error active:bg-rui-error-darker text-rui-dark-text dark:text-rui-text' },\n warning: { root: 'bg-rui-warning active:bg-rui-warning-darker text-rui-dark-text dark:text-rui-text' },\n info: { root: 'bg-rui-info active:bg-rui-info-darker text-rui-dark-text dark:text-rui-text' },\n success: { root: 'bg-rui-success active:bg-rui-success-darker text-rui-dark-text dark:text-rui-text' },\n },\n rounded: {\n true: { root: 'rounded-full' },\n },\n icon: {\n /*\n * Only the round shape; the `icon + size` compounds below carry padding and icon sizing. The\n * label holds no text, so it lays out as a flex box: a line box would put a wrapped icon (a\n * badge) on the text baseline and grow the button by the descender gap.\n */\n true: { root: 'rounded-full', label: 'inline-flex' },\n },\n active: {\n true: {},\n false: {},\n },\n loading: {\n true: { root: 'relative !cursor-progress' },\n false: {},\n },\n hideFocusIndicator: {\n true: { root: 'focus-visible:!outline-hidden' },\n },\n },\n compoundVariants: [\n /*\n * Filled hover: the pressed state layer (10% black in light, 12% white in dark) over the fill, a\n * step of about a tenth rather than the jump to `darker`, which stays for the pressed state.\n * `not-disabled:` keeps a disabled or loading button flat; an `<a>` is never `:disabled`.\n */\n { variant: ['default', 'fab'], color: ['primary', 'secondary', 'error', 'warning', 'info', 'success'], class: { root: 'not-disabled:hover:state-layer-pressed' } },\n // An icon-only button has no label to keep, so its glyph goes transparent (still in the accessibility tree) under a centered spinner\n { loading: true, icon: true, class: { root: '[&>*:not([data-spinner])]:opacity-0', spinner: 'absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2' } },\n // Disabled appearance: a flat neutral fill, skipped while loading so the variant color shows behind the spinner\n { loading: false, class: { root: 'disabled:!bg-rui-neutral-100 dark:disabled:!bg-rui-neutral-800 disabled:!text-rui-text-disabled disabled:active:!text-rui-text-disabled' } },\n { loading: false, variant: 'outlined', class: { root: 'disabled:!bg-transparent dark:disabled:!bg-transparent disabled:active:!bg-transparent disabled:inset-ring-rui-text-disabled dark:disabled:inset-ring-rui-text-disabled' } },\n { loading: false, variant: 'text', class: { root: 'disabled:!bg-transparent dark:disabled:!bg-transparent disabled:active:!bg-transparent' } },\n { loading: false, variant: 'list', class: { root: 'disabled:!bg-transparent dark:disabled:!bg-transparent disabled:active:!bg-transparent' } },\n\n // === Grey color variants ===\n { color: 'grey', active: true, class: { root: 'bg-rui-neutral-200 dark:bg-rui-neutral-700' } },\n // the same hover and pressed tints as a highlighted menu option\n { color: 'grey', variant: ['outlined', 'text', 'list'], class: { root: 'bg-transparent hover:bg-rui-hover active:bg-rui-pressed dark:bg-transparent dark:text-rui-text' } },\n { color: 'grey', variant: ['outlined', 'text', 'list'], active: true, class: { root: 'bg-rui-pressed dark:bg-rui-pressed' } },\n // the shared control edge, 3:1 against the page like the 50% context colours beside it\n { color: 'grey', variant: 'outlined', class: { root: 'inset-ring-rui-outline' } },\n { color: 'grey', variant: 'text', class: { root: 'text-rui-text-secondary' } },\n\n // `dark:text-rui-<color>` beats the filled buttons' `dark:text-rui-text`; primary, secondary and error use their lighter tone in dark for 4.5:1\n { color: 'primary', variant: ['outlined', 'text', 'list'], class: { root: 'bg-transparent hover:bg-rui-primary/6 active:bg-rui-primary/10 text-rui-primary dark:text-rui-primary-lighter' } },\n { color: 'secondary', variant: ['outlined', 'text', 'list'], class: { root: 'bg-transparent hover:bg-rui-secondary/6 active:bg-rui-secondary/10 text-rui-secondary dark:text-rui-secondary-lighter' } },\n { color: 'error', variant: ['outlined', 'text', 'list'], class: { root: 'bg-transparent hover:bg-rui-error/6 active:bg-rui-error/10 text-rui-error dark:text-rui-error-lighter' } },\n { color: 'warning', variant: ['outlined', 'text', 'list'], class: { root: 'bg-transparent hover:bg-rui-warning/6 active:bg-rui-warning/10 text-rui-warning dark:text-rui-warning' } },\n { color: 'info', variant: ['outlined', 'text', 'list'], class: { root: 'bg-transparent hover:bg-rui-info/6 active:bg-rui-info/10 text-rui-info dark:text-rui-info' } },\n { color: 'success', variant: ['outlined', 'text', 'list'], class: { root: 'bg-transparent hover:bg-rui-success/6 active:bg-rui-success/10 text-rui-success dark:text-rui-success' } },\n\n // === Context colors — active default ===\n { color: 'primary', active: true, class: { root: 'bg-rui-primary-darker' } },\n { color: 'secondary', active: true, class: { root: 'bg-rui-secondary-darker' } },\n { color: 'error', active: true, class: { root: 'bg-rui-error-darker' } },\n { color: 'warning', active: true, class: { root: 'bg-rui-warning-darker' } },\n { color: 'info', active: true, class: { root: 'bg-rui-info-darker' } },\n { color: 'success', active: true, class: { root: 'bg-rui-success-darker' } },\n\n // Active outlined/text: a quiet tint with the deeper tone as the label, which keeps 4.5:1 for every color\n { color: 'primary', variant: ['outlined', 'text', 'list'], active: true, class: { root: 'bg-rui-primary/[0.08] text-rui-primary-darker' } },\n { color: 'secondary', variant: ['outlined', 'text', 'list'], active: true, class: { root: 'bg-rui-secondary/[0.08] text-rui-secondary-darker' } },\n { color: 'error', variant: ['outlined', 'text', 'list'], active: true, class: { root: 'bg-rui-error/[0.08] text-rui-error-darker' } },\n { color: 'warning', variant: ['outlined', 'text', 'list'], active: true, class: { root: 'bg-rui-warning/[0.08] text-rui-warning-darker' } },\n { color: 'info', variant: ['outlined', 'text', 'list'], active: true, class: { root: 'bg-rui-info/[0.08] text-rui-info-darker' } },\n { color: 'success', variant: ['outlined', 'text', 'list'], active: true, class: { root: 'bg-rui-success/[0.08] text-rui-success-darker' } },\n\n // === Context colors: outlined border (dark draws primary and secondary solid; at 50% their deep fills sink into the page and look alike) ===\n { color: 'primary', variant: 'outlined', class: { root: 'inset-ring-rui-primary/50 dark:inset-ring-rui-primary' } },\n { color: 'secondary', variant: 'outlined', class: { root: 'inset-ring-rui-secondary/50 dark:inset-ring-rui-secondary' } },\n { color: 'error', variant: 'outlined', class: { root: 'inset-ring-rui-error/50' } },\n { color: 'warning', variant: 'outlined', class: { root: 'inset-ring-rui-warning/50' } },\n { color: 'info', variant: 'outlined', class: { root: 'inset-ring-rui-info/50' } },\n { color: 'success', variant: 'outlined', class: { root: 'inset-ring-rui-success/50' } },\n\n // === Size overrides per variant ===\n { variant: 'text', size: 'xs', class: { root: 'px-1' } },\n { variant: 'text', size: 'sm', class: { root: 'px-1.5' } },\n { variant: 'text', size: 'lg', class: { root: 'px-2.5' } },\n { variant: 'text', size: 'xl', class: { root: 'px-2.5' } },\n { variant: 'text', size: '2xl', class: { root: 'px-2.5' } },\n { variant: 'fab', size: 'xs', class: { root: 'py-1 px-1' } },\n { variant: 'fab', size: 'sm', class: { root: 'py-1.5 px-2' } },\n { variant: 'fab', size: 'lg', class: { root: 'py-3' } },\n { variant: 'list', size: 'xs', class: { root: 'px-3 py-0.5' } },\n // 32px: a dense select's option row, which `getOptionHeight` reserves in the virtual list\n { variant: 'list', size: 'sm', class: { root: 'px-3 py-2' } },\n // Icon-only sizing, per the padding and glyph table on buttonStyles above\n { icon: true, class: { root: 'p-2 ![--rui-icon-size:1.25rem]' } },\n { icon: true, size: 'xs', class: { root: 'p-[0.1875rem] ![--rui-icon-size:0.875rem]' } },\n { icon: true, size: 'sm', class: { root: 'p-1 ![--rui-icon-size:1.25rem]' } },\n { icon: true, size: 'lg', class: { root: 'p-1.5 ![--rui-icon-size:1.5rem]' } },\n { icon: true, size: 'xl', class: { root: 'p-2 ![--rui-icon-size:1.5rem]' } },\n { icon: true, size: '2xl', class: { root: 'p-2 ![--rui-icon-size:1.75rem]' } },\n { variant: 'fab', icon: true, size: 'sm', class: { root: 'px-2 py-2' } },\n ],\n compoundSlots: [\n // In dark a status color's `main` is a text tone, so a filled status button takes the deep `darker` fill\n { slots: ['root'], color: 'error', variant: ['default', 'fab'], class: 'dark:bg-rui-error-darker dark:active:bg-rui-error-darker/75' },\n { slots: ['root'], color: 'warning', variant: ['default', 'fab'], class: 'dark:bg-rui-warning-darker dark:active:bg-rui-warning-darker/75' },\n { slots: ['root'], color: 'info', variant: ['default', 'fab'], class: 'dark:bg-rui-info-darker dark:active:bg-rui-info-darker/75' },\n { slots: ['root'], color: 'success', variant: ['default', 'fab'], class: 'dark:bg-rui-success-darker dark:active:bg-rui-success-darker/75' },\n // Dark mode active outlined/text: the same quiet tint, with the lighter tone as the label\n { slots: ['root'], color: 'primary', variant: ['outlined', 'text', 'list'], active: true, class: 'dark:bg-rui-primary/[0.16] dark:text-rui-primary-lighter' },\n { slots: ['root'], color: 'secondary', variant: ['outlined', 'text', 'list'], active: true, class: 'dark:bg-rui-secondary/[0.16] dark:text-rui-secondary-lighter' },\n { slots: ['root'], color: 'error', variant: ['outlined', 'text', 'list'], active: true, class: 'dark:bg-rui-error/[0.16] dark:text-rui-error-lighter' },\n { slots: ['root'], color: 'warning', variant: ['outlined', 'text', 'list'], active: true, class: 'dark:bg-rui-warning/[0.16] dark:text-rui-warning-lighter' },\n { slots: ['root'], color: 'info', variant: ['outlined', 'text', 'list'], active: true, class: 'dark:bg-rui-info/[0.16] dark:text-rui-info-lighter' },\n { slots: ['root'], color: 'success', variant: ['outlined', 'text', 'list'], active: true, class: 'dark:bg-rui-success/[0.16] dark:text-rui-success-lighter' },\n ],\n defaultVariants: {\n variant: 'default',\n color: 'grey',\n active: false,\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAa,eAAe,GAAG;CAC7B,OAAO;EACL,MAAM;GACJ;GACA;GAEA;GACA;GACA;GACA;EACF,CAAC,CAAC,KAAK,GAAG;EACV,OAAO;EAEP,SAAS;CACX;CACA,UAAU;EACR,SAAS;GACP,SAAS,CAAC;GACV,UAAU,CAAC;GACX,MAAM,EAAE,MAAM,OAAO;GACrB,KAAK,EAAE,MAAM,4DAA4D;GAEzE,MAAM;IAAE,MAAM;IAA0D,OAAO;GAAmB;EACpG;EACA,MAAM;GACJ,MAAM,EAAE,MAAM,wEAAwE;GACtF,MAAM,EAAE,MAAM,oEAAoE;GAClF,MAAM,EAAE,MAAM,6DAA6D;GAE3E,MAAM,EAAE,MAAM,8DAA8D;GAC5E,OAAO,EAAE,MAAM,gEAAgE;EACjF;EACA,OAAO;GACL,MAAM,EAAE,MAAM,2KAA2K;GAEzL,SAAS,EAAE,MAAM,oFAAoF;GACrG,WAAW,EAAE,MAAM,wFAAwF;GAC3G,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AE3I;GAAE,OAAO,CAAC,MAAM;GAAG,OAAO;GAAW,SAAS;IAAC;IAAY;IAAQ;GAAM;GAAG,QAAQ;GAAM,OAAO;EAA2D;EAC5J;GAAE,OAAO,CAAC,MAAM;GAAG,OAAO;GAAa,SAAS;IAAC;IAAY;IAAQ;GAAM;GAAG,QAAQ;GAAM,OAAO;EAA+D;EAClK;GAAE,OAAO,CAAC,MAAM;GAAG,OAAO;GAAS,SAAS;IAAC;IAAY;IAAQ;GAAM;GAAG,QAAQ;GAAM,OAAO;EAAuD;EACtJ;GAAE,OAAO,CAAC,MAAM;GAAG,OAAO;GAAW,SAAS;IAAC;IAAY;IAAQ;GAAM;GAAG,QAAQ;GAAM,OAAO;EAA2D;EAC5J;GAAE,OAAO,CAAC,MAAM;GAAG,OAAO;GAAQ,SAAS;IAAC;IAAY;IAAQ;GAAM;GAAG,QAAQ;GAAM,OAAO;EAAqD;EACnJ;GAAE,OAAO,CAAC,MAAM;GAAG,OAAO;GAAW,SAAS;IAAC;IAAY;IAAQ;GAAM;GAAG,QAAQ;GAAM,OAAO;EAA2D;CAC9J;CACA,iBAAiB;EACf,SAAS;EACT,OAAO;EACP,QAAQ;CACV;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RuiButtonGroup.js","names":[],"sources":["../../../../src/components/buttons/button-group/RuiButtonGroup.vue"],"sourcesContent":["<script lang=\"ts\" generic=\"T = undefined\" setup>\nimport type { ButtonSize } from '@/components/buttons/button/button-props';\nimport type { ContextColorsType } from '@/consts/colors';\nimport { Fragment, isVNode } from 'vue';\nimport { tv } from '@/utils/tv';\n\nexport interface Props {\n vertical?: boolean;\n color?: ContextColorsType;\n activeColor?: ContextColorsType;\n variant?: 'default' | 'outlined' | 'text';\n size?: ButtonSize;\n gap?: 'sm' | 'md' | 'lg';\n required?: boolean;\n disabled?: boolean;\n}\n\ndefineOptions({\n name: 'RuiButtonGroup',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<T | T[]>();\n\nconst {\n vertical = false,\n color,\n activeColor,\n variant = 'default',\n size,\n gap,\n required = false,\n disabled = false,\n} = defineProps<Props>();\n\nconst slots = useSlots();\n\nconst buttonGroupStyles = tv({\n slots: {\n root: 'inline-flex rounded divide-x divide-rui-grey-400 outline outline-1 outline-transparent outline-offset-[-1px]',\n button: 'border-0 outline-0 focus:z-[1]',\n },\n variants: {\n vertical: {\n true: {\n root: 'flex-col items-start divide-x-0 divide-y',\n button: 'w-full',\n },\n false: {},\n },\n gap: {\n none: {\n button: '!rounded-none',\n },\n sm: {\n root: 'divide-x-0 divide-y-0 outline-0 gap-2',\n button: 'outline-1',\n },\n md: {\n root: 'divide-x-0 divide-y-0 outline-0 gap-4',\n button: 'outline-1',\n },\n lg: {\n root: 'divide-x-0 divide-y-0 outline-0 gap-6',\n button: 'outline-1',\n },\n },\n variant: {\n default: {},\n outlined: {\n // Material's 23% neutral edge, matching RuiButton's colourless outlined treatment\n root: 'outline-black/[0.23] divide-black/[0.23] dark:outline-white/[0.23] dark:divide-white/[0.23]',\n },\n text: {},\n },\n color: {\n primary: {},\n secondary: {},\n error: {},\n warning: {},\n info: {},\n success: {},\n },\n },\n compoundVariants: [\n // First/last child rounding when not separated (! needed to override RuiButton's CSS module border-radius)\n { gap: 'none', vertical: false, class: { button: 'first:!rounded-l last:!rounded-r' } },\n { gap: 'none', vertical: true, class: { button: 'first:!rounded-t last:!rounded-b' } },\n\n // Color dividers (default variant)\n { color: 'primary', class: { root: 'divide-rui-primary-darker' } },\n { color: 'secondary', class: { root: 'divide-rui-secondary-darker' } },\n { color: 'error', class: { root: 'divide-rui-error-darker' } },\n { color: 'warning', class: { root: 'divide-rui-warning-darker' } },\n { color: 'info', class: { root: 'divide-rui-info-darker' } },\n { color: 'success', class: { root: 'divide-rui-success-darker' } },\n\n // Color dividers for outlined/text (overrides darker dividers above)\n { color: 'primary', variant: ['outlined', 'text'], class: { root: 'divide-rui-primary/[0.5]' } },\n { color: 'secondary', variant: ['outlined', 'text'], class: { root: 'divide-rui-secondary/[0.5]' } },\n { color: 'error', variant: ['outlined', 'text'], class: { root: 'divide-rui-error/[0.5]' } },\n { color: 'warning', variant: ['outlined', 'text'], class: { root: 'divide-rui-warning/[0.5]' } },\n { color: 'info', variant: ['outlined', 'text'], class: { root: 'divide-rui-info/[0.5]' } },\n { color: 'success', variant: ['outlined', 'text'], class: { root: 'divide-rui-success/[0.5]' } },\n\n // Color outline for outlined variant\n { color: 'primary', variant: 'outlined', class: { root: 'outline-rui-primary/[0.5]' } },\n { color: 'secondary', variant: 'outlined', class: { root: 'outline-rui-secondary/[0.5]' } },\n { color: 'error', variant: 'outlined', class: { root: 'outline-rui-error/[0.5]' } },\n { color: 'warning', variant: 'outlined', class: { root: 'outline-rui-warning/[0.5]' } },\n { color: 'info', variant: 'outlined', class: { root: 'outline-rui-info/[0.5]' } },\n { color: 'success', variant: 'outlined', class: { root: 'outline-rui-success/[0.5]' } },\n ],\n defaultVariants: {\n vertical: false,\n gap: 'none',\n variant: 'default',\n },\n});\n\nconst ui = computed<ReturnType<typeof buttonGroupStyles>>(() => buttonGroupStyles({\n vertical,\n gap: gap ?? 'none',\n variant,\n color,\n}));\n\n/**\n * Applies the group's state to one of its buttons: which button is active,\n * the group's disabled flag and colour, and the group's size, that last one\n * only when the button did not set a size of its own, so a consumer can still\n * size a single button.\n *\n * @param child - the button's vnode, whose props are keyed in kebab-case\n * @param index - its place in the group, which stands in for a missing value\n * @param selectedValue - what the group's model currently holds\n * @returns the same vnode, with the group's props written onto it\n */\nfunction applyGroupProps(child: VNode, index: number, selectedValue: T | T[] | undefined): VNode {\n const value = child.props?.['model-value'];\n const active = isActive(value ?? index, selectedValue);\n const resolvedColor = active && activeColor ? activeColor : color;\n const childSize = child.props?.size;\n\n child.props = {\n ...child.props,\n active,\n ...(disabled && { disabled: true }),\n ...(resolvedColor && { color: resolvedColor }),\n ...(!childSize && size && { size }),\n };\n\n return child;\n}\n\nconst children = computed<VNode[]>(() => {\n const selectedValue: T | T[] | undefined = get(modelValue);\n const slotContent = slots.default?.() ?? [];\n\n return flattenSlotContent(slotContent)\n .map((child, index) => applyGroupProps(child, index, selectedValue));\n});\n\n/**\n * Flattens slot content by unwrapping Fragments (created by v-for).\n * Returns only actual VNode children.\n */\nfunction flattenSlotContent(nodes: VNode[]): VNode[] {\n return nodes.flatMap((node) => {\n if (node.type === Fragment && Array.isArray(node.children) && node.children.length > 0)\n return flattenSlotContent(node.children.filter(isVNode));\n\n return [node];\n });\n}\n\nfunction isActive(id: T, selected?: T | T[]): boolean {\n if (Array.isArray(selected))\n return selected.includes(id);\n\n return selected === id;\n}\n\nfunction onClick(id: T): void {\n const selected = get(modelValue);\n\n if (Array.isArray(selected)) {\n const index = selected.indexOf(id);\n if (index >= 0) {\n if (required && selected.length === 1)\n return;\n\n set(modelValue, selected.filter((_, i) => i !== index));\n }\n else {\n set(modelValue, [...selected, id]);\n }\n }\n else if (required) {\n set(modelValue, id);\n }\n else {\n set(modelValue, isActive(id, selected) ? undefined : id);\n }\n}\n</script>\n\n<template>\n <div\n :class=\"ui.root()\"\n v-bind=\"$attrs\"\n >\n <Component\n :is=\"child\"\n v-for=\"(child, i) in children\"\n :key=\"i\"\n :class=\"ui.button()\"\n :variant=\"variant\"\n @update:model-value=\"onClick($event ?? i)\"\n />\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"RuiButtonGroup.js","names":[],"sources":["../../../../src/components/buttons/button-group/RuiButtonGroup.vue"],"sourcesContent":["<script lang=\"ts\" generic=\"T = undefined\" setup>\nimport type { ButtonSize } from '@/components/buttons/button/button-props';\nimport type { ContextColorsType } from '@/consts/colors';\nimport { type ButtonGroupContext, ButtonGroupKey } from '@/components/buttons/button-group/button-group-context';\nimport { cn, tv } from '@/utils/tv';\n\nexport interface Props {\n vertical?: boolean;\n color?: ContextColorsType;\n activeColor?: ContextColorsType;\n /**\n * `segmented` draws the options as `RuiTabs variant=\"segmented\"` does: a neutral track whose active\n * option is a raised surface. It is neutral, so it ignores `color` and `activeColor`.\n */\n variant?: 'default' | 'outlined' | 'text' | 'segmented';\n size?: ButtonSize;\n gap?: 'sm' | 'md' | 'lg';\n required?: boolean;\n disabled?: boolean;\n}\n\ndefineOptions({\n name: 'RuiButtonGroup',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<T | T[]>();\n\nconst {\n vertical = false,\n color,\n activeColor,\n variant = 'default',\n size,\n gap,\n required = false,\n disabled = false,\n} = defineProps<Props>();\n\ndefineSlots<{\n default?: () => any;\n}>();\n\nconst buttonGroupStyles = tv({\n slots: {\n /*\n * `w-fit`: a flex column stretches its children, inline-flex or not, which drew an outlined\n * group's frame across the whole row. A consumer's own width still wins through the class merge.\n * Between filled buttons a separator only needs to part the fills, so it takes the light divider.\n */\n root: 'inline-flex w-fit max-w-full rounded-rui-control between:border-l between:border-r-0 between:border-rui-divider outline-solid outline-1 outline-transparent -outline-offset-1',\n button: 'border-0 inset-ring-0 focus:z-1',\n },\n variants: {\n vertical: {\n true: {\n root: 'flex-col items-start between:border-l-0 between:border-t between:border-b-0 *:w-full',\n button: 'w-full',\n },\n false: {},\n },\n gap: {\n none: {\n button: 'rounded-none!',\n },\n sm: {\n root: 'between:border-0 outline-0 gap-2',\n button: 'inset-ring',\n },\n md: {\n root: 'between:border-0 outline-0 gap-4',\n button: 'inset-ring',\n },\n lg: {\n root: 'between:border-0 outline-0 gap-6',\n button: 'inset-ring',\n },\n },\n variant: {\n default: {},\n outlined: {\n // the control edge, matching RuiButton's colourless outlined treatment\n root: 'outline-rui-outline between:border-rui-outline',\n },\n text: {},\n // the segmented tabs' track and pill; the 32px options make a 36px control, a field's height\n segmented: {\n root: 'rounded-rui-panel bg-rui-neutral-200 p-0.5 gap-0.5 outline-0 between:border-0 dark:bg-rui-neutral-800',\n button: [\n 'h-8 px-3 text-rui-text-secondary transition-colors hover:text-rui-text focus-visible:-outline-offset-2',\n 'data-[active]:bg-rui-surface data-[active]:text-rui-text data-[active]:shadow-rui-control dark:data-[active]:bg-rui-neutral-700',\n ].join(' '),\n },\n },\n color: {\n primary: {},\n secondary: {},\n error: {},\n warning: {},\n info: {},\n success: {},\n },\n },\n compoundVariants: [\n /*\n * The outer corners go to the button that is, or sits inside, the group's first or last item, so a\n * button wrapped in a tooltip or a menu activator rounds like a direct child.\n */\n { gap: 'none', vertical: false, class: { button: '[&:is([data-button-group]>:first-child,[data-button-group]>:first-child_*)]:rounded-l-rui-control! [&:is([data-button-group]>:last-child,[data-button-group]>:last-child_*)]:rounded-r-rui-control!' } },\n { gap: 'none', vertical: true, class: { button: '[&:is([data-button-group]>:first-child,[data-button-group]>:first-child_*)]:rounded-t-rui-control! [&:is([data-button-group]>:last-child,[data-button-group]>:last-child_*)]:rounded-b-rui-control!' } },\n /*\n * In a joined group the focus outline's sides fall on the neighbours, and on a primary neighbour a\n * primary outline vanishes. A surface ring fills the outline's offset, so the raised segment's\n * ring is parted from its neighbours on every side.\n */\n { gap: 'none', variant: ['default', 'outlined', 'text'], class: { button: 'focus-visible:ring-2 focus-visible:ring-rui-surface' } },\n // each segment is its own rounded pill inside the track, not a slice of one joined bar\n { variant: 'segmented', class: { button: 'rounded-rui-control!' } },\n\n // Color dividers for outlined/text (overrides darker dividers above)\n { color: 'primary', variant: ['outlined', 'text'], class: { root: 'between:border-rui-primary/50' } },\n { color: 'secondary', variant: ['outlined', 'text'], class: { root: 'between:border-rui-secondary/50' } },\n { color: 'error', variant: ['outlined', 'text'], class: { root: 'between:border-rui-error/50' } },\n { color: 'warning', variant: ['outlined', 'text'], class: { root: 'between:border-rui-warning/50' } },\n { color: 'info', variant: ['outlined', 'text'], class: { root: 'between:border-rui-info/50' } },\n { color: 'success', variant: ['outlined', 'text'], class: { root: 'between:border-rui-success/50' } },\n\n // Color outline for outlined variant\n { color: 'primary', variant: 'outlined', class: { root: 'outline-rui-primary/50' } },\n { color: 'secondary', variant: 'outlined', class: { root: 'outline-rui-secondary/50' } },\n { color: 'error', variant: 'outlined', class: { root: 'outline-rui-error/50' } },\n { color: 'warning', variant: 'outlined', class: { root: 'outline-rui-warning/50' } },\n { color: 'info', variant: 'outlined', class: { root: 'outline-rui-info/50' } },\n { color: 'success', variant: 'outlined', class: { root: 'outline-rui-success/50' } },\n ],\n defaultVariants: {\n vertical: false,\n gap: 'none',\n variant: 'default',\n },\n});\n\nconst ui = computed<ReturnType<typeof buttonGroupStyles>>(() => buttonGroupStyles({\n vertical,\n gap: gap ?? 'none',\n variant,\n color,\n}));\n\n/**\n * The color a button takes: the pressed one's `activeColor` when set, otherwise the group's. The\n * segmented variant is neutral, like the segmented tabs, so its buttons take none.\n *\n * @param active - whether the button is the pressed one\n * @returns the color to set, or undefined to leave the button grey\n */\nfunction buttonColor(active: boolean): ContextColorsType | undefined {\n if (variant === 'segmented')\n return undefined;\n return active && activeColor ? activeColor : color;\n}\n\nfunction isActive(id: T, selected?: T | T[]): boolean {\n if (Array.isArray(selected))\n return selected.includes(id);\n\n return selected === id;\n}\n\nfunction onClick(id: T): void {\n const selected = get(modelValue);\n\n if (Array.isArray(selected)) {\n const index = selected.indexOf(id);\n if (index >= 0) {\n if (required && selected.length === 1)\n return;\n\n set(modelValue, selected.filter((_, i) => i !== index));\n }\n else {\n set(modelValue, [...selected, id]);\n }\n }\n else if (required) {\n set(modelValue, id);\n }\n else {\n set(modelValue, isActive(id, selected) ? undefined : id);\n }\n}\n\n// a button that sets its own size keeps it; the rest take the group's\nprovide(ButtonGroupKey, {\n variant: () => variant === 'segmented' ? 'text' : variant,\n size: () => size,\n disabled: () => disabled,\n color: buttonColor,\n itemClass: () => get(ui).button(),\n isActive: (value: T) => isActive(value, get(modelValue)),\n toggle: onClick,\n} satisfies ButtonGroupContext<T>);\n</script>\n\n<template>\n <div\n :class=\"ui.root({ class: cn($attrs.class) })\"\n data-button-group\n v-bind=\"{ ...$attrs, class: undefined }\"\n >\n <slot />\n </div>\n</template>\n"],"mappings":""}
@@ -4,7 +4,11 @@ export interface Props {
4
4
  vertical?: boolean;
5
5
  color?: ContextColorsType;
6
6
  activeColor?: ContextColorsType;
7
- variant?: 'default' | 'outlined' | 'text';
7
+ /**
8
+ * `segmented` draws the options as `RuiTabs variant="segmented"` does: a neutral track whose active
9
+ * option is a raised surface. It is neutral, so it ignores `color` and `activeColor`.
10
+ */
11
+ variant?: 'default' | 'outlined' | 'text' | 'segmented';
8
12
  size?: ButtonSize;
9
13
  gap?: 'sm' | 'md' | 'lg';
10
14
  required?: boolean;
@@ -20,7 +24,9 @@ declare const __VLS_export: <T = undefined>(__VLS_props: NonNullable<Awaited<typ
20
24
  } ? P : {});
21
25
  expose: (exposed: {}) => void;
22
26
  attrs: any;
23
- slots: {};
27
+ slots: {
28
+ default?: () => any;
29
+ };
24
30
  emit: (event: "update:modelValue", value: T | T[] | undefined) => void;
25
31
  }>) => import("vue").VNode & {
26
32
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
@@ -1,6 +1,7 @@
1
- import { tv } from "../../../utils/tv.js";
2
- import { Fragment, computed, createBlock, createElementBlock, defineComponent, isVNode, mergeModels, mergeProps, normalizeClass, openBlock, renderList, resolveDynamicComponent, unref, useModel, useSlots } from "vue";
3
- import { get, set } from "@vueuse/shared";
1
+ import { get, set } from "../../../vendor/@vueuse/shared/dist/index.js";
2
+ import { cn, tv } from "../../../utils/tv.js";
3
+ import { ButtonGroupKey } from "./button-group-context.js";
4
+ import { computed, createElementBlock, defineComponent, mergeModels, mergeProps, openBlock, provide, renderSlot, unref, useModel } from "vue";
4
5
  //#region src/components/buttons/button-group/RuiButtonGroup.vue?vue&type=script&setup=true&lang.ts
5
6
  var RuiButtonGroup_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
6
7
  name: "RuiButtonGroup",
@@ -31,39 +32,42 @@ var RuiButtonGroup_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
31
32
  emits: ["update:modelValue"],
32
33
  setup(__props) {
33
34
  const modelValue = useModel(__props, "modelValue");
34
- const slots = useSlots();
35
35
  const buttonGroupStyles = tv({
36
36
  slots: {
37
- root: "inline-flex rounded divide-x divide-rui-grey-400 outline outline-1 outline-transparent outline-offset-[-1px]",
38
- button: "border-0 outline-0 focus:z-[1]"
37
+ root: "inline-flex w-fit max-w-full rounded-rui-control between:border-l between:border-r-0 between:border-rui-divider outline-solid outline-1 outline-transparent -outline-offset-1",
38
+ button: "border-0 inset-ring-0 focus:z-1"
39
39
  },
40
40
  variants: {
41
41
  vertical: {
42
42
  true: {
43
- root: "flex-col items-start divide-x-0 divide-y",
43
+ root: "flex-col items-start between:border-l-0 between:border-t between:border-b-0 *:w-full",
44
44
  button: "w-full"
45
45
  },
46
46
  false: {}
47
47
  },
48
48
  gap: {
49
- none: { button: "!rounded-none" },
49
+ none: { button: "rounded-none!" },
50
50
  sm: {
51
- root: "divide-x-0 divide-y-0 outline-0 gap-2",
52
- button: "outline-1"
51
+ root: "between:border-0 outline-0 gap-2",
52
+ button: "inset-ring"
53
53
  },
54
54
  md: {
55
- root: "divide-x-0 divide-y-0 outline-0 gap-4",
56
- button: "outline-1"
55
+ root: "between:border-0 outline-0 gap-4",
56
+ button: "inset-ring"
57
57
  },
58
58
  lg: {
59
- root: "divide-x-0 divide-y-0 outline-0 gap-6",
60
- button: "outline-1"
59
+ root: "between:border-0 outline-0 gap-6",
60
+ button: "inset-ring"
61
61
  }
62
62
  },
63
63
  variant: {
64
64
  default: {},
65
- outlined: { root: "outline-black/[0.23] divide-black/[0.23] dark:outline-white/[0.23] dark:divide-white/[0.23]" },
66
- text: {}
65
+ outlined: { root: "outline-rui-outline between:border-rui-outline" },
66
+ text: {},
67
+ segmented: {
68
+ root: "rounded-rui-panel bg-rui-neutral-200 p-0.5 gap-0.5 outline-0 between:border-0 dark:bg-rui-neutral-800",
69
+ button: ["h-8 px-3 text-rui-text-secondary transition-colors hover:text-rui-text focus-visible:-outline-offset-2", "data-[active]:bg-rui-surface data-[active]:text-rui-text data-[active]:shadow-rui-control dark:data-[active]:bg-rui-neutral-700"].join(" ")
70
+ }
67
71
  },
68
72
  color: {
69
73
  primary: {},
@@ -78,96 +82,85 @@ var RuiButtonGroup_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
78
82
  {
79
83
  gap: "none",
80
84
  vertical: false,
81
- class: { button: "first:!rounded-l last:!rounded-r" }
85
+ class: { button: "[&:is([data-button-group]>:first-child,[data-button-group]>:first-child_*)]:rounded-l-rui-control! [&:is([data-button-group]>:last-child,[data-button-group]>:last-child_*)]:rounded-r-rui-control!" }
82
86
  },
83
87
  {
84
88
  gap: "none",
85
89
  vertical: true,
86
- class: { button: "first:!rounded-t last:!rounded-b" }
87
- },
88
- {
89
- color: "primary",
90
- class: { root: "divide-rui-primary-darker" }
90
+ class: { button: "[&:is([data-button-group]>:first-child,[data-button-group]>:first-child_*)]:rounded-t-rui-control! [&:is([data-button-group]>:last-child,[data-button-group]>:last-child_*)]:rounded-b-rui-control!" }
91
91
  },
92
92
  {
93
- color: "secondary",
94
- class: { root: "divide-rui-secondary-darker" }
95
- },
96
- {
97
- color: "error",
98
- class: { root: "divide-rui-error-darker" }
99
- },
100
- {
101
- color: "warning",
102
- class: { root: "divide-rui-warning-darker" }
103
- },
104
- {
105
- color: "info",
106
- class: { root: "divide-rui-info-darker" }
93
+ gap: "none",
94
+ variant: [
95
+ "default",
96
+ "outlined",
97
+ "text"
98
+ ],
99
+ class: { button: "focus-visible:ring-2 focus-visible:ring-rui-surface" }
107
100
  },
108
101
  {
109
- color: "success",
110
- class: { root: "divide-rui-success-darker" }
102
+ variant: "segmented",
103
+ class: { button: "rounded-rui-control!" }
111
104
  },
112
105
  {
113
106
  color: "primary",
114
107
  variant: ["outlined", "text"],
115
- class: { root: "divide-rui-primary/[0.5]" }
108
+ class: { root: "between:border-rui-primary/50" }
116
109
  },
117
110
  {
118
111
  color: "secondary",
119
112
  variant: ["outlined", "text"],
120
- class: { root: "divide-rui-secondary/[0.5]" }
113
+ class: { root: "between:border-rui-secondary/50" }
121
114
  },
122
115
  {
123
116
  color: "error",
124
117
  variant: ["outlined", "text"],
125
- class: { root: "divide-rui-error/[0.5]" }
118
+ class: { root: "between:border-rui-error/50" }
126
119
  },
127
120
  {
128
121
  color: "warning",
129
122
  variant: ["outlined", "text"],
130
- class: { root: "divide-rui-warning/[0.5]" }
123
+ class: { root: "between:border-rui-warning/50" }
131
124
  },
132
125
  {
133
126
  color: "info",
134
127
  variant: ["outlined", "text"],
135
- class: { root: "divide-rui-info/[0.5]" }
128
+ class: { root: "between:border-rui-info/50" }
136
129
  },
137
130
  {
138
131
  color: "success",
139
132
  variant: ["outlined", "text"],
140
- class: { root: "divide-rui-success/[0.5]" }
133
+ class: { root: "between:border-rui-success/50" }
141
134
  },
142
135
  {
143
136
  color: "primary",
144
137
  variant: "outlined",
145
- class: { root: "outline-rui-primary/[0.5]" }
138
+ class: { root: "outline-rui-primary/50" }
146
139
  },
147
140
  {
148
141
  color: "secondary",
149
142
  variant: "outlined",
150
- class: { root: "outline-rui-secondary/[0.5]" }
143
+ class: { root: "outline-rui-secondary/50" }
151
144
  },
152
145
  {
153
146
  color: "error",
154
147
  variant: "outlined",
155
- class: { root: "outline-rui-error/[0.5]" }
148
+ class: { root: "outline-rui-error/50" }
156
149
  },
157
150
  {
158
151
  color: "warning",
159
152
  variant: "outlined",
160
- class: { root: "outline-rui-warning/[0.5]" }
153
+ class: { root: "outline-rui-warning/50" }
161
154
  },
162
155
  {
163
156
  color: "info",
164
157
  variant: "outlined",
165
- class: { root: "outline-rui-info/[0.5]" }
158
+ class: { root: "outline-rui-info/50" }
166
159
  },
167
160
  {
168
161
  color: "success",
169
162
  variant: "outlined",
170
- class: { root: "outline-rui-success/[0.5]" }
163
+ class: { root: "outline-rui-success/50" }
171
164
  }
172
165
  ],
173
166
  defaultVariants: {
@@ -183,43 +176,15 @@ var RuiButtonGroup_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
183
176
  color: __props.color
184
177
  }));
185
178
  /**
186
- * Applies the group's state to one of its buttons: which button is active,
187
- * the group's disabled flag and colour, and the group's size, that last one
188
- * only when the button did not set a size of its own, so a consumer can still
189
- * size a single button.
179
+ * The color a button takes: the pressed one's `activeColor` when set, otherwise the group's. The
180
+ * segmented variant is neutral, like the segmented tabs, so its buttons take none.
190
181
  *
191
- * @param child - the button's vnode, whose props are keyed in kebab-case
192
- * @param index - its place in the group, which stands in for a missing value
193
- * @param selectedValue - what the group's model currently holds
194
- * @returns the same vnode, with the group's props written onto it
182
+ * @param active - whether the button is the pressed one
183
+ * @returns the color to set, or undefined to leave the button grey
195
184
  */
196
- function applyGroupProps(child, index, selectedValue) {
197
- const value = child.props?.["model-value"];
198
- const active = isActive(value ?? index, selectedValue);
199
- const resolvedColor = active && __props.activeColor ? __props.activeColor : __props.color;
200
- const childSize = child.props?.size;
201
- child.props = {
202
- ...child.props,
203
- active,
204
- ...__props.disabled && { disabled: true },
205
- ...resolvedColor && { color: resolvedColor },
206
- ...!childSize && __props.size && { size: __props.size }
207
- };
208
- return child;
209
- }
210
- const children = computed(() => {
211
- const selectedValue = get(modelValue);
212
- return flattenSlotContent(slots.default?.() ?? []).map((child, index) => applyGroupProps(child, index, selectedValue));
213
- });
214
- /**
215
- * Flattens slot content by unwrapping Fragments (created by v-for).
216
- * Returns only actual VNode children.
217
- */
218
- function flattenSlotContent(nodes) {
219
- return nodes.flatMap((node) => {
220
- if (node.type === Fragment && Array.isArray(node.children) && node.children.length > 0) return flattenSlotContent(node.children.filter(isVNode));
221
- return [node];
222
- });
185
+ function buttonColor(active) {
186
+ if (__props.variant === "segmented") return void 0;
187
+ return active && __props.activeColor ? __props.activeColor : __props.color;
223
188
  }
224
189
  function isActive(id, selected) {
225
190
  if (Array.isArray(selected)) return selected.includes(id);
@@ -236,19 +201,23 @@ var RuiButtonGroup_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
236
201
  } else if (__props.required) set(modelValue, id);
237
202
  else set(modelValue, isActive(id, selected) ? void 0 : id);
238
203
  }
204
+ provide(ButtonGroupKey, {
205
+ variant: () => __props.variant === "segmented" ? "text" : __props.variant,
206
+ size: () => __props.size,
207
+ disabled: () => __props.disabled,
208
+ color: buttonColor,
209
+ itemClass: () => get(ui).button(),
210
+ isActive: (value) => isActive(value, get(modelValue)),
211
+ toggle: onClick
212
+ });
239
213
  return (_ctx, _cache) => {
240
- return openBlock(), createElementBlock("div", mergeProps({ class: unref(ui).root() }, _ctx.$attrs), [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(children), (child, i) => {
241
- return openBlock(), createBlock(resolveDynamicComponent(child), {
242
- key: i,
243
- class: normalizeClass(unref(ui).button()),
244
- variant: __props.variant,
245
- "onUpdate:modelValue": ($event) => onClick($event ?? i)
246
- }, null, 8, [
247
- "class",
248
- "variant",
249
- "onUpdate:modelValue"
250
- ]);
251
- }), 128))], 16);
214
+ return openBlock(), createElementBlock("div", mergeProps({
215
+ class: unref(ui).root({ class: unref(cn)(_ctx.$attrs.class) }),
216
+ "data-button-group": ""
217
+ }, {
218
+ ..._ctx.$attrs,
219
+ class: void 0
220
+ }), [renderSlot(_ctx.$slots, "default")], 16);
252
221
  };
253
222
  }
254
223
  });
@@ -1 +1 @@
1
- {"version":3,"file":"RuiButtonGroup.vue_vue_type_script_setup_true_lang.js","names":["$attrs"],"sources":["../../../../src/components/buttons/button-group/RuiButtonGroup.vue"],"sourcesContent":["<script lang=\"ts\" generic=\"T = undefined\" setup>\nimport type { ButtonSize } from '@/components/buttons/button/button-props';\nimport type { ContextColorsType } from '@/consts/colors';\nimport { Fragment, isVNode } from 'vue';\nimport { tv } from '@/utils/tv';\n\nexport interface Props {\n vertical?: boolean;\n color?: ContextColorsType;\n activeColor?: ContextColorsType;\n variant?: 'default' | 'outlined' | 'text';\n size?: ButtonSize;\n gap?: 'sm' | 'md' | 'lg';\n required?: boolean;\n disabled?: boolean;\n}\n\ndefineOptions({\n name: 'RuiButtonGroup',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<T | T[]>();\n\nconst {\n vertical = false,\n color,\n activeColor,\n variant = 'default',\n size,\n gap,\n required = false,\n disabled = false,\n} = defineProps<Props>();\n\nconst slots = useSlots();\n\nconst buttonGroupStyles = tv({\n slots: {\n root: 'inline-flex rounded divide-x divide-rui-grey-400 outline outline-1 outline-transparent outline-offset-[-1px]',\n button: 'border-0 outline-0 focus:z-[1]',\n },\n variants: {\n vertical: {\n true: {\n root: 'flex-col items-start divide-x-0 divide-y',\n button: 'w-full',\n },\n false: {},\n },\n gap: {\n none: {\n button: '!rounded-none',\n },\n sm: {\n root: 'divide-x-0 divide-y-0 outline-0 gap-2',\n button: 'outline-1',\n },\n md: {\n root: 'divide-x-0 divide-y-0 outline-0 gap-4',\n button: 'outline-1',\n },\n lg: {\n root: 'divide-x-0 divide-y-0 outline-0 gap-6',\n button: 'outline-1',\n },\n },\n variant: {\n default: {},\n outlined: {\n // Material's 23% neutral edge, matching RuiButton's colourless outlined treatment\n root: 'outline-black/[0.23] divide-black/[0.23] dark:outline-white/[0.23] dark:divide-white/[0.23]',\n },\n text: {},\n },\n color: {\n primary: {},\n secondary: {},\n error: {},\n warning: {},\n info: {},\n success: {},\n },\n },\n compoundVariants: [\n // First/last child rounding when not separated (! needed to override RuiButton's CSS module border-radius)\n { gap: 'none', vertical: false, class: { button: 'first:!rounded-l last:!rounded-r' } },\n { gap: 'none', vertical: true, class: { button: 'first:!rounded-t last:!rounded-b' } },\n\n // Color dividers (default variant)\n { color: 'primary', class: { root: 'divide-rui-primary-darker' } },\n { color: 'secondary', class: { root: 'divide-rui-secondary-darker' } },\n { color: 'error', class: { root: 'divide-rui-error-darker' } },\n { color: 'warning', class: { root: 'divide-rui-warning-darker' } },\n { color: 'info', class: { root: 'divide-rui-info-darker' } },\n { color: 'success', class: { root: 'divide-rui-success-darker' } },\n\n // Color dividers for outlined/text (overrides darker dividers above)\n { color: 'primary', variant: ['outlined', 'text'], class: { root: 'divide-rui-primary/[0.5]' } },\n { color: 'secondary', variant: ['outlined', 'text'], class: { root: 'divide-rui-secondary/[0.5]' } },\n { color: 'error', variant: ['outlined', 'text'], class: { root: 'divide-rui-error/[0.5]' } },\n { color: 'warning', variant: ['outlined', 'text'], class: { root: 'divide-rui-warning/[0.5]' } },\n { color: 'info', variant: ['outlined', 'text'], class: { root: 'divide-rui-info/[0.5]' } },\n { color: 'success', variant: ['outlined', 'text'], class: { root: 'divide-rui-success/[0.5]' } },\n\n // Color outline for outlined variant\n { color: 'primary', variant: 'outlined', class: { root: 'outline-rui-primary/[0.5]' } },\n { color: 'secondary', variant: 'outlined', class: { root: 'outline-rui-secondary/[0.5]' } },\n { color: 'error', variant: 'outlined', class: { root: 'outline-rui-error/[0.5]' } },\n { color: 'warning', variant: 'outlined', class: { root: 'outline-rui-warning/[0.5]' } },\n { color: 'info', variant: 'outlined', class: { root: 'outline-rui-info/[0.5]' } },\n { color: 'success', variant: 'outlined', class: { root: 'outline-rui-success/[0.5]' } },\n ],\n defaultVariants: {\n vertical: false,\n gap: 'none',\n variant: 'default',\n },\n});\n\nconst ui = computed<ReturnType<typeof buttonGroupStyles>>(() => buttonGroupStyles({\n vertical,\n gap: gap ?? 'none',\n variant,\n color,\n}));\n\n/**\n * Applies the group's state to one of its buttons: which button is active,\n * the group's disabled flag and colour, and the group's size, that last one\n * only when the button did not set a size of its own, so a consumer can still\n * size a single button.\n *\n * @param child - the button's vnode, whose props are keyed in kebab-case\n * @param index - its place in the group, which stands in for a missing value\n * @param selectedValue - what the group's model currently holds\n * @returns the same vnode, with the group's props written onto it\n */\nfunction applyGroupProps(child: VNode, index: number, selectedValue: T | T[] | undefined): VNode {\n const value = child.props?.['model-value'];\n const active = isActive(value ?? index, selectedValue);\n const resolvedColor = active && activeColor ? activeColor : color;\n const childSize = child.props?.size;\n\n child.props = {\n ...child.props,\n active,\n ...(disabled && { disabled: true }),\n ...(resolvedColor && { color: resolvedColor }),\n ...(!childSize && size && { size }),\n };\n\n return child;\n}\n\nconst children = computed<VNode[]>(() => {\n const selectedValue: T | T[] | undefined = get(modelValue);\n const slotContent = slots.default?.() ?? [];\n\n return flattenSlotContent(slotContent)\n .map((child, index) => applyGroupProps(child, index, selectedValue));\n});\n\n/**\n * Flattens slot content by unwrapping Fragments (created by v-for).\n * Returns only actual VNode children.\n */\nfunction flattenSlotContent(nodes: VNode[]): VNode[] {\n return nodes.flatMap((node) => {\n if (node.type === Fragment && Array.isArray(node.children) && node.children.length > 0)\n return flattenSlotContent(node.children.filter(isVNode));\n\n return [node];\n });\n}\n\nfunction isActive(id: T, selected?: T | T[]): boolean {\n if (Array.isArray(selected))\n return selected.includes(id);\n\n return selected === id;\n}\n\nfunction onClick(id: T): void {\n const selected = get(modelValue);\n\n if (Array.isArray(selected)) {\n const index = selected.indexOf(id);\n if (index >= 0) {\n if (required && selected.length === 1)\n return;\n\n set(modelValue, selected.filter((_, i) => i !== index));\n }\n else {\n set(modelValue, [...selected, id]);\n }\n }\n else if (required) {\n set(modelValue, id);\n }\n else {\n set(modelValue, isActive(id, selected) ? undefined : id);\n }\n}\n</script>\n\n<template>\n <div\n :class=\"ui.root()\"\n v-bind=\"$attrs\"\n >\n <Component\n :is=\"child\"\n v-for=\"(child, i) in children\"\n :key=\"i\"\n :class=\"ui.button()\"\n :variant=\"variant\"\n @update:model-value=\"onClick($event ?? i)\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBA,MAAM,aAAa,SAAoB,SAAA,YAAC;EAaxC,MAAM,QAAQ,SAAS;EAEvB,MAAM,oBAAoB,GAAG;GAC3B,OAAO;IACL,MAAM;IACN,QAAQ;GACV;GACA,UAAU;IACR,UAAU;KACR,MAAM;MACJ,MAAM;MACN,QAAQ;KACV;KACA,OAAO,CAAC;IACV;IACA,KAAK;KACH,MAAM,EACJ,QAAQ,gBACV;KACA,IAAI;MACF,MAAM;MACN,QAAQ;KACV;KACA,IAAI;MACF,MAAM;MACN,QAAQ;KACV;KACA,IAAI;MACF,MAAM;MACN,QAAQ;KACV;IACF;IACA,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.vue"],"sourcesContent":["<script lang=\"ts\" generic=\"T = undefined\" setup>\nimport type { ButtonSize } from '@/components/buttons/button/button-props';\nimport type { ContextColorsType } from '@/consts/colors';\nimport { type ButtonGroupContext, ButtonGroupKey } from '@/components/buttons/button-group/button-group-context';\nimport { cn, tv } from '@/utils/tv';\n\nexport interface Props {\n vertical?: boolean;\n color?: ContextColorsType;\n activeColor?: ContextColorsType;\n /**\n * `segmented` draws the options as `RuiTabs variant=\"segmented\"` does: a neutral track whose active\n * option is a raised surface. It is neutral, so it ignores `color` and `activeColor`.\n */\n variant?: 'default' | 'outlined' | 'text' | 'segmented';\n size?: ButtonSize;\n gap?: 'sm' | 'md' | 'lg';\n required?: boolean;\n disabled?: boolean;\n}\n\ndefineOptions({\n name: 'RuiButtonGroup',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<T | T[]>();\n\nconst {\n vertical = false,\n color,\n activeColor,\n variant = 'default',\n size,\n gap,\n required = false,\n disabled = false,\n} = defineProps<Props>();\n\ndefineSlots<{\n default?: () => any;\n}>();\n\nconst buttonGroupStyles = tv({\n slots: {\n /*\n * `w-fit`: a flex column stretches its children, inline-flex or not, which drew an outlined\n * group's frame across the whole row. A consumer's own width still wins through the class merge.\n * Between filled buttons a separator only needs to part the fills, so it takes the light divider.\n */\n root: 'inline-flex w-fit max-w-full rounded-rui-control between:border-l between:border-r-0 between:border-rui-divider outline-solid outline-1 outline-transparent -outline-offset-1',\n button: 'border-0 inset-ring-0 focus:z-1',\n },\n variants: {\n vertical: {\n true: {\n root: 'flex-col items-start between:border-l-0 between:border-t between:border-b-0 *:w-full',\n button: 'w-full',\n },\n false: {},\n },\n gap: {\n none: {\n button: 'rounded-none!',\n },\n sm: {\n root: 'between:border-0 outline-0 gap-2',\n button: 'inset-ring',\n },\n md: {\n root: 'between:border-0 outline-0 gap-4',\n button: 'inset-ring',\n },\n lg: {\n root: 'between:border-0 outline-0 gap-6',\n button: 'inset-ring',\n },\n },\n variant: {\n default: {},\n outlined: {\n // the control edge, matching RuiButton's colourless outlined treatment\n root: 'outline-rui-outline between:border-rui-outline',\n },\n text: {},\n // the segmented tabs' track and pill; the 32px options make a 36px control, a field's height\n segmented: {\n root: 'rounded-rui-panel bg-rui-neutral-200 p-0.5 gap-0.5 outline-0 between:border-0 dark:bg-rui-neutral-800',\n button: [\n 'h-8 px-3 text-rui-text-secondary transition-colors hover:text-rui-text focus-visible:-outline-offset-2',\n 'data-[active]:bg-rui-surface data-[active]:text-rui-text data-[active]:shadow-rui-control dark:data-[active]:bg-rui-neutral-700',\n ].join(' '),\n },\n },\n color: {\n primary: {},\n secondary: {},\n error: {},\n warning: {},\n info: {},\n success: {},\n },\n },\n compoundVariants: [\n /*\n * The outer corners go to the button that is, or sits inside, the group's first or last item, so a\n * button wrapped in a tooltip or a menu activator rounds like a direct child.\n */\n { gap: 'none', vertical: false, class: { button: '[&:is([data-button-group]>:first-child,[data-button-group]>:first-child_*)]:rounded-l-rui-control! [&:is([data-button-group]>:last-child,[data-button-group]>:last-child_*)]:rounded-r-rui-control!' } },\n { gap: 'none', vertical: true, class: { button: '[&:is([data-button-group]>:first-child,[data-button-group]>:first-child_*)]:rounded-t-rui-control! [&:is([data-button-group]>:last-child,[data-button-group]>:last-child_*)]:rounded-b-rui-control!' } },\n /*\n * In a joined group the focus outline's sides fall on the neighbours, and on a primary neighbour a\n * primary outline vanishes. A surface ring fills the outline's offset, so the raised segment's\n * ring is parted from its neighbours on every side.\n */\n { gap: 'none', variant: ['default', 'outlined', 'text'], class: { button: 'focus-visible:ring-2 focus-visible:ring-rui-surface' } },\n // each segment is its own rounded pill inside the track, not a slice of one joined bar\n { variant: 'segmented', class: { button: 'rounded-rui-control!' } },\n\n // Color dividers for outlined/text (overrides darker dividers above)\n { color: 'primary', variant: ['outlined', 'text'], class: { root: 'between:border-rui-primary/50' } },\n { color: 'secondary', variant: ['outlined', 'text'], class: { root: 'between:border-rui-secondary/50' } },\n { color: 'error', variant: ['outlined', 'text'], class: { root: 'between:border-rui-error/50' } },\n { color: 'warning', variant: ['outlined', 'text'], class: { root: 'between:border-rui-warning/50' } },\n { color: 'info', variant: ['outlined', 'text'], class: { root: 'between:border-rui-info/50' } },\n { color: 'success', variant: ['outlined', 'text'], class: { root: 'between:border-rui-success/50' } },\n\n // Color outline for outlined variant\n { color: 'primary', variant: 'outlined', class: { root: 'outline-rui-primary/50' } },\n { color: 'secondary', variant: 'outlined', class: { root: 'outline-rui-secondary/50' } },\n { color: 'error', variant: 'outlined', class: { root: 'outline-rui-error/50' } },\n { color: 'warning', variant: 'outlined', class: { root: 'outline-rui-warning/50' } },\n { color: 'info', variant: 'outlined', class: { root: 'outline-rui-info/50' } },\n { color: 'success', variant: 'outlined', class: { root: 'outline-rui-success/50' } },\n ],\n defaultVariants: {\n vertical: false,\n gap: 'none',\n variant: 'default',\n },\n});\n\nconst ui = computed<ReturnType<typeof buttonGroupStyles>>(() => buttonGroupStyles({\n vertical,\n gap: gap ?? 'none',\n variant,\n color,\n}));\n\n/**\n * The color a button takes: the pressed one's `activeColor` when set, otherwise the group's. The\n * segmented variant is neutral, like the segmented tabs, so its buttons take none.\n *\n * @param active - whether the button is the pressed one\n * @returns the color to set, or undefined to leave the button grey\n */\nfunction buttonColor(active: boolean): ContextColorsType | undefined {\n if (variant === 'segmented')\n return undefined;\n return active && activeColor ? activeColor : color;\n}\n\nfunction isActive(id: T, selected?: T | T[]): boolean {\n if (Array.isArray(selected))\n return selected.includes(id);\n\n return selected === id;\n}\n\nfunction onClick(id: T): void {\n const selected = get(modelValue);\n\n if (Array.isArray(selected)) {\n const index = selected.indexOf(id);\n if (index >= 0) {\n if (required && selected.length === 1)\n return;\n\n set(modelValue, selected.filter((_, i) => i !== index));\n }\n else {\n set(modelValue, [...selected, id]);\n }\n }\n else if (required) {\n set(modelValue, id);\n }\n else {\n set(modelValue, isActive(id, selected) ? undefined : id);\n }\n}\n\n// a button that sets its own size keeps it; the rest take the group's\nprovide(ButtonGroupKey, {\n variant: () => variant === 'segmented' ? 'text' : variant,\n size: () => size,\n disabled: () => disabled,\n color: buttonColor,\n itemClass: () => get(ui).button(),\n isActive: (value: T) => isActive(value, get(modelValue)),\n toggle: onClick,\n} satisfies ButtonGroupContext<T>);\n</script>\n\n<template>\n <div\n :class=\"ui.root({ class: cn($attrs.class) })\"\n data-button-group\n v-bind=\"{ ...$attrs, class: undefined }\"\n >\n <slot />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BA,MAAM,aAAa,SAAoB,SAAA,YAAC;EAiBxC,MAAM,oBAAoB,GAAG;GAC3B,OAAO;IAML,MAAM;IACN,QAAQ;GACV;GACA,UAAU;IACR,UAAU;KACR,MAAM;MACJ,MAAM;MACN,QAAQ;KACV;KACA,OAAO,CAAC;IACV;IACA,KAAK;KACH,MAAM,EACJ,QAAQ,gBACV;KACA,IAAI;MACF,MAAM;MACN,QAAQ;KACV;KACA,IAAI;MACF,MAAM;MACN,QAAQ;KACV;KACA,IAAI;MACF,MAAM;MACN,QAAQ;KACV;IACF;IACA,SAAS;KACP,SAAS,CAAC;KACV,UAAU,EAER,MAAM,iDACR;KACA,MAAM,CAAC;KAEP,WAAW;MACT,MAAM;MACN,QAAQ,CACN,0GACA,iIACF,CAAC,CAAC,KAAK,GAAG;KACZ;IACF;IACA,OAAO;KACL,SAAS,CAAC;KACV,WAAW,CAAC;KACZ,OAAO,CAAC;KACR,SAAS,CAAC;KACV,MAAM,CAAC;KACP,SAAS,CAAC;IACZ;GACF;GACA,kBAAkB;IAKhB;KAAE,KAAK;KAAQ,UAAU;KAAO,OAAO,EAAE,QAAQ,sMAAsM;IAAE;IACzP;KAAE,KAAK;KAAQ,UAAU;KAAM,OAAO,EAAE,QAAQ,sMAAsM;IAAE;IAMxP;KAAE,KAAK;KAAQ,SAAS;MAAC;MAAW;MAAY;KAAM;KAAG,OAAO,EAAE,QAAQ,sDAAsD;IAAE;IAElI;KAAE,SAAS;KAAa,OAAO,EAAE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,OAAO,UAAU,QAAA,cAAc,QAAA,cAAc,QAAA;EAC/C;EAEA,SAAS,SAAS,IAAO,UAA6B;GACpD,IAAI,MAAM,QAAQ,QAAQ,GACxB,OAAO,SAAS,SAAS,EAAE;GAE7B,OAAO,aAAa;EACtB;EAEA,SAAS,QAAQ,IAAa;GAC5B,MAAM,WAAW,IAAI,UAAU;GAE/B,IAAI,MAAM,QAAQ,QAAQ,GAAG;IAC3B,MAAM,QAAQ,SAAS,QAAQ,EAAE;IACjC,IAAI,SAAS,GAAG;KACd,IAAI,QAAA,YAAY,SAAS,WAAW,GAClC;KAEF,IAAI,YAAY,SAAS,QAAQ,GAAG,MAAM,MAAM,KAAK,CAAC;IACxD,OAEE,IAAI,YAAY,CAAC,GAAG,UAAU,EAAE,CAAC;GAErC,OACK,IAAI,QAAA,UACP,IAAI,YAAY,EAAE;QAGlB,IAAI,YAAY,SAAS,IAAI,QAAQ,IAAI,KAAA,IAAY,EAAE;EAE3D;EAGA,QAAQ,gBAAgB;GACtB,eAAe,QAAA,YAAY,cAAc,SAAS,QAAA;GAClD,YAAY,QAAA;GACZ,gBAAgB,QAAA;GAChB,OAAO;GACP,iBAAiB,IAAI,EAAE,CAAC,CAAC,OAAO;GAChC,WAAW,UAAa,SAAS,OAAO,IAAI,UAAU,CAAC;GACvD,QAAQ;EACV,CAAiC;;GAI/B,OAAA,UAAA,GAAA,mBAMM,OANN,WAMM;IALH,OAAO,MAAA,EAAA,CAAE,CAAC,KAAI,EAAA,OAAU,MAAA,EAAA,CAAE,CAACA,KAAAA,OAAO,KAAK,EAAA,CAAA;IACxC,qBAAA;GACaA,GAAAA;IAAAA,GAAAA,KAAAA;IAAM,OAAS,KAAA;GAAS,CAAA,GAAA,CAErC,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,EAAA"}
@@ -0,0 +1,28 @@
1
+ import type { ButtonSize, ButtonVariant } from '../button/button-props.js';
2
+ import type { ContextColorsType } from '../../../consts/colors.js';
3
+ import { type InjectionKey } from 'vue';
4
+ /**
5
+ * What a RuiButtonGroup shares with the RuiButtons inside it, at any depth, so a button wrapped in a
6
+ * tooltip or a menu activator joins the group like a direct child.
7
+ */
8
+ export interface ButtonGroupContext<TValue> {
9
+ variant: () => ButtonVariant;
10
+ size: () => ButtonSize | undefined;
11
+ disabled: () => boolean;
12
+ color: (active: boolean) => ContextColorsType | undefined;
13
+ itemClass: () => string;
14
+ isActive: (value: TValue) => boolean;
15
+ toggle: (value: TValue) => void;
16
+ }
17
+ /**
18
+ * A button's value type and its group's are separate generics that only the template ties together,
19
+ * so the key carries `any` for the value.
20
+ */
21
+ export declare const ButtonGroupKey: InjectionKey<ButtonGroupContext<any> | undefined>;
22
+ /**
23
+ * Ends a surrounding group's reach. Overlays wrap their teleported content in it, so the buttons of a
24
+ * split button's menu stay plain buttons.
25
+ */
26
+ export declare const ButtonGroupBoundary: import("vue").DefineComponent<{}, () => globalThis.VNode<import("vue").RendererNode, import("vue").RendererElement, {
27
+ [key: string]: any;
28
+ }>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,22 @@
1
+ import { defineComponent, provide } from "vue";
2
+ //#region src/components/buttons/button-group/button-group-context.ts
3
+ /**
4
+ * A button's value type and its group's are separate generics that only the template ties together,
5
+ * so the key carries `any` for the value.
6
+ */
7
+ var ButtonGroupKey = Symbol("RuiButtonGroup");
8
+ /**
9
+ * Ends a surrounding group's reach. Overlays wrap their teleported content in it, so the buttons of a
10
+ * split button's menu stay plain buttons.
11
+ */
12
+ var ButtonGroupBoundary = defineComponent({
13
+ name: "ButtonGroupBoundary",
14
+ setup(_, { slots }) {
15
+ provide(ButtonGroupKey, void 0);
16
+ return () => slots.default?.();
17
+ }
18
+ });
19
+ //#endregion
20
+ export { ButtonGroupBoundary, ButtonGroupKey };
21
+
22
+ //# sourceMappingURL=button-group-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-group-context.js","names":[],"sources":["../../../../src/components/buttons/button-group/button-group-context.ts"],"sourcesContent":["import type { ButtonSize, ButtonVariant } from '@/components/buttons/button/button-props';\nimport type { ContextColorsType } from '@/consts/colors';\nimport { defineComponent, type InjectionKey, provide } from 'vue';\n\n/**\n * What a RuiButtonGroup shares with the RuiButtons inside it, at any depth, so a button wrapped in a\n * tooltip or a menu activator joins the group like a direct child.\n */\nexport interface ButtonGroupContext<TValue> {\n variant: () => ButtonVariant;\n size: () => ButtonSize | undefined;\n disabled: () => boolean;\n color: (active: boolean) => ContextColorsType | undefined;\n itemClass: () => string;\n isActive: (value: TValue) => boolean;\n toggle: (value: TValue) => void;\n}\n\n/**\n * A button's value type and its group's are separate generics that only the template ties together,\n * so the key carries `any` for the value.\n */\nexport const ButtonGroupKey: InjectionKey<ButtonGroupContext<any> | undefined> = Symbol('RuiButtonGroup');\n\n/**\n * Ends a surrounding group's reach. Overlays wrap their teleported content in it, so the buttons of a\n * split button's menu stay plain buttons.\n */\nexport const ButtonGroupBoundary = defineComponent({\n name: 'ButtonGroupBoundary',\n setup(_, { slots }) {\n provide(ButtonGroupKey, undefined);\n return () => slots.default?.();\n },\n});\n"],"mappings":";;;;;;AAsBA,IAAa,iBAAoE,OAAO,gBAAgB;;;;;AAMxG,IAAa,sBAAsB,gBAAgB;CACjD,MAAM;CACN,MAAM,GAAG,EAAE,SAAS;EAClB,QAAQ,gBAAgB,KAAA,CAAS;EACjC,aAAa,MAAM,UAAU;CAC/B;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RuiCalendar.js","names":[],"sources":["../../../src/components/calendar/RuiCalendar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { get, isDefined, set } from '@vueuse/core';\nimport { computed, provide, ref, watch } from 'vue';\nimport {\n CalendarStateSymbol,\n type MonthYearSelection,\n type RuiCalendarState,\n} from '@/components/calendar/state';\nimport { useRotkiTheme } from '@/composables/theme';\nimport { tv } from '@/utils/tv';\nimport RuiCalendarGrid from './RuiCalendarGrid.vue';\nimport RuiCalendarHeader from './RuiCalendarHeader.vue';\n\nexport interface CalendarProps {\n maxDate?: Date | number;\n minDate?: Date | number;\n allowEmpty?: boolean;\n borderless?: boolean;\n}\n\ndefineOptions({\n name: 'RuiCalendar',\n inheritAttrs: false,\n});\n\nconst model = defineModel<Date | undefined>({ required: false });\nconst isMenuOpen = defineModel<boolean>('menu-open', { required: false, default: false });\n\nconst { maxDate, minDate, allowEmpty = false, borderless = false } = defineProps<CalendarProps>();\n\nconst emit = defineEmits<{\n 'update:pages': [{ title: string }[]];\n}>();\n\nconst currentDate = ref<Date>(isDefined(model) ? new Date(get(model)) : new Date());\nconst selectedDate = ref<Date | undefined>(isDefined(model) ? new Date(get(model)) : undefined);\nconst viewMonth = ref<number>(get(currentDate).getMonth());\nconst viewYear = ref<number>(get(currentDate).getFullYear());\n\nconst { isDark } = useRotkiTheme();\n\nconst calendarStyles = tv({\n base: 'w-[18.75rem] bg-white dark:bg-rui-grey-900 overflow-hidden',\n variants: {\n bordered: {\n true: 'rounded-md shadow-sm border border-rui-grey-200 dark:border-rui-grey-800',\n },\n },\n});\n\nconst ui = computed<string>(() => calendarStyles({ bordered: !borderless }));\n\nconst monthTitle = computed<string>(() => {\n const date = new Date(get(viewYear), get(viewMonth));\n return date.toLocaleString('default', { month: 'long', year: 'numeric' });\n});\n\nprovide(CalendarStateSymbol.valueOf(), {\n viewMonth,\n viewYear,\n selectedDate,\n maxDate: computed(() => (maxDate ? new Date(maxDate) : undefined)),\n minDate: computed(() => (minDate ? new Date(minDate) : undefined)),\n isDark,\n allowEmpty,\n} satisfies RuiCalendarState);\n\n// The grid's keyboard navigation also turns the view, so the title follows the view itself\nwatch(monthTitle, (title) => {\n emit('update:pages', [{ title }]);\n});\n\nfunction moveMonth(delta: number): void {\n let newMonth = get(viewMonth) + delta;\n let newYear = get(viewYear);\n\n if (newMonth > 11) {\n newMonth = 0;\n newYear++;\n }\n else if (newMonth < 0) {\n newMonth = 11;\n newYear--;\n }\n\n set(viewMonth, newMonth);\n set(viewYear, newYear);\n}\n\nfunction move(date: Date | number): void {\n const newDate = new Date(date);\n set(viewMonth, newDate.getMonth());\n set(viewYear, newDate.getFullYear());\n}\n\nfunction selectMonth(selection: MonthYearSelection): void {\n set(viewMonth, selection.month);\n set(viewYear, selection.year);\n\n // If there's a selected date, update it with the new year/month\n if (isDefined(selectedDate)) {\n const current = get(selectedDate);\n const currentDay = current.getDate();\n // Handle day overflow (e.g., Jan 31 -> Feb 28) by checking BEFORE setting month\n const daysInNewMonth = new Date(selection.year, selection.month + 1, 0).getDate();\n const adjustedDay = Math.min(currentDay, daysInNewMonth);\n\n const newDate = new Date(current);\n newDate.setFullYear(selection.year);\n newDate.setDate(1); // Set to 1st to avoid overflow when changing month\n newDate.setMonth(selection.month);\n newDate.setDate(adjustedDay);\n set(selectedDate, newDate);\n }\n}\n\nwatch(selectedDate, (date) => {\n if (!date && !allowEmpty)\n return;\n\n if (date) {\n set(model, new Date(date));\n\n if (get(viewMonth) !== date.getMonth()) {\n set(viewMonth, date.getMonth());\n }\n\n if (get(viewYear) !== date.getFullYear()) {\n set(viewYear, date.getFullYear());\n }\n }\n else {\n set(model, undefined);\n }\n});\n\nwatch(model, (newValue) => {\n if (newValue === undefined) {\n set(selectedDate, undefined);\n return;\n }\n\n const date = new Date(newValue);\n\n if (isDefined(selectedDate) && get(selectedDate).getTime() !== date.getTime()) {\n set(selectedDate, new Date(newValue));\n set(viewMonth, date.getMonth());\n set(viewYear, date.getFullYear());\n }\n});\n\ndefineExpose({\n move,\n});\n</script>\n\n<template>\n <div :class=\"ui\">\n <RuiCalendarHeader\n v-model:menu-open=\"isMenuOpen\"\n :title=\"monthTitle\"\n :view-month=\"viewMonth\"\n :view-year=\"viewYear\"\n @prev-month=\"moveMonth(-1)\"\n @next-month=\"moveMonth(1)\"\n @select-month=\"selectMonth($event)\"\n />\n\n <RuiCalendarGrid\n v-model=\"selectedDate\"\n :view-month=\"viewMonth\"\n :view-year=\"viewYear\"\n />\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"RuiCalendar.js","names":[],"sources":["../../../src/components/calendar/RuiCalendar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { get, isDefined, set } from '@vueuse/core';\nimport { computed, provide, ref, watch } from 'vue';\nimport {\n CalendarStateSymbol,\n type MonthYearSelection,\n type RuiCalendarState,\n} from '@/components/calendar/state';\nimport { useRotkiTheme } from '@/composables/theme';\nimport { tv } from '@/utils/tv';\nimport RuiCalendarGrid from './RuiCalendarGrid.vue';\nimport RuiCalendarHeader from './RuiCalendarHeader.vue';\n\nexport interface CalendarProps {\n maxDate?: Date | number;\n minDate?: Date | number;\n allowEmpty?: boolean;\n borderless?: boolean;\n}\n\ndefineOptions({\n name: 'RuiCalendar',\n inheritAttrs: false,\n});\n\nconst model = defineModel<Date | undefined>({ required: false });\nconst isMenuOpen = defineModel<boolean>('menu-open', { required: false, default: false });\n\nconst { maxDate, minDate, allowEmpty = false, borderless = false } = defineProps<CalendarProps>();\n\nconst emit = defineEmits<{\n 'update:pages': [{ title: string }[]];\n}>();\n\nconst currentDate = ref<Date>(isDefined(model) ? new Date(get(model)) : new Date());\nconst selectedDate = ref<Date | undefined>(isDefined(model) ? new Date(get(model)) : undefined);\nconst viewMonth = ref<number>(get(currentDate).getMonth());\nconst viewYear = ref<number>(get(currentDate).getFullYear());\n\nconst { isDark } = useRotkiTheme();\n\nconst calendarStyles = tv({\n base: 'w-75 overflow-hidden',\n variants: {\n // standalone it sits on the card surface; borderless it lives inside a menu\n bordered: {\n true: 'bg-rui-surface rounded-rui-panel border border-rui-divider',\n false: 'bg-rui-menu',\n },\n },\n});\n\nconst ui = computed<string>(() => calendarStyles({ bordered: !borderless }));\n\nconst monthTitle = computed<string>(() => {\n const date = new Date(get(viewYear), get(viewMonth));\n return date.toLocaleString('default', { month: 'long', year: 'numeric' });\n});\n\nprovide(CalendarStateSymbol.valueOf(), {\n viewMonth,\n viewYear,\n selectedDate,\n maxDate: computed(() => (maxDate ? new Date(maxDate) : undefined)),\n minDate: computed(() => (minDate ? new Date(minDate) : undefined)),\n isDark,\n allowEmpty,\n} satisfies RuiCalendarState);\n\n// The grid's keyboard navigation also turns the view, so the title follows the view itself\nwatch(monthTitle, (title) => {\n emit('update:pages', [{ title }]);\n});\n\nfunction moveMonth(delta: number): void {\n let newMonth = get(viewMonth) + delta;\n let newYear = get(viewYear);\n\n if (newMonth > 11) {\n newMonth = 0;\n newYear++;\n }\n else if (newMonth < 0) {\n newMonth = 11;\n newYear--;\n }\n\n set(viewMonth, newMonth);\n set(viewYear, newYear);\n}\n\nfunction move(date: Date | number): void {\n const newDate = new Date(date);\n set(viewMonth, newDate.getMonth());\n set(viewYear, newDate.getFullYear());\n}\n\nfunction selectMonth(selection: MonthYearSelection): void {\n set(viewMonth, selection.month);\n set(viewYear, selection.year);\n\n // If there's a selected date, update it with the new year/month\n if (isDefined(selectedDate)) {\n const current = get(selectedDate);\n const currentDay = current.getDate();\n // Handle day overflow (e.g., Jan 31 -> Feb 28) by checking BEFORE setting month\n const daysInNewMonth = new Date(selection.year, selection.month + 1, 0).getDate();\n const adjustedDay = Math.min(currentDay, daysInNewMonth);\n\n const newDate = new Date(current);\n newDate.setFullYear(selection.year);\n newDate.setDate(1); // Set to 1st to avoid overflow when changing month\n newDate.setMonth(selection.month);\n newDate.setDate(adjustedDay);\n set(selectedDate, newDate);\n }\n}\n\nwatch(selectedDate, (date) => {\n if (!date && !allowEmpty)\n return;\n\n if (date) {\n set(model, new Date(date));\n\n if (get(viewMonth) !== date.getMonth()) {\n set(viewMonth, date.getMonth());\n }\n\n if (get(viewYear) !== date.getFullYear()) {\n set(viewYear, date.getFullYear());\n }\n }\n else {\n set(model, undefined);\n }\n});\n\nwatch(model, (newValue) => {\n if (newValue === undefined) {\n set(selectedDate, undefined);\n return;\n }\n\n const date = new Date(newValue);\n\n if (isDefined(selectedDate) && get(selectedDate).getTime() !== date.getTime()) {\n set(selectedDate, new Date(newValue));\n set(viewMonth, date.getMonth());\n set(viewYear, date.getFullYear());\n }\n});\n\ndefineExpose({\n move,\n});\n</script>\n\n<template>\n <div :class=\"ui\">\n <RuiCalendarHeader\n v-model:menu-open=\"isMenuOpen\"\n :title=\"monthTitle\"\n :view-month=\"viewMonth\"\n :view-year=\"viewYear\"\n @prev-month=\"moveMonth(-1)\"\n @next-month=\"moveMonth(1)\"\n @select-month=\"selectMonth($event)\"\n />\n\n <RuiCalendarGrid\n v-model=\"selectedDate\"\n :view-month=\"viewMonth\"\n :view-year=\"viewYear\"\n />\n </div>\n</template>\n"],"mappings":""}