@rotki/ui-library 3.1.6 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/dist/components/accordions/accordion/RuiAccordion.js.map +1 -1
  2. package/dist/components/accordions/accordion/RuiAccordion.vue_vue_type_script_setup_true_lang.js +3 -3
  3. package/dist/components/accordions/accordion/RuiAccordion.vue_vue_type_script_setup_true_lang.js.map +1 -1
  4. package/dist/components/accordions/accordion/accordion-styles.d.ts +1 -0
  5. package/dist/components/accordions/accordion/accordion-styles.js +7 -0
  6. package/dist/components/accordions/accordion/accordion-styles.js.map +1 -0
  7. package/dist/components/alerts/RuiAlert.js.map +1 -1
  8. package/dist/components/alerts/RuiAlert.vue_vue_type_script_setup_true_lang.js +1 -65
  9. package/dist/components/alerts/RuiAlert.vue_vue_type_script_setup_true_lang.js.map +1 -1
  10. package/dist/components/alerts/alert-styles.d.ts +145 -0
  11. package/dist/components/alerts/alert-styles.js +70 -0
  12. package/dist/components/alerts/alert-styles.js.map +1 -0
  13. package/dist/components/avatars/RuiAvatar.js.map +1 -1
  14. package/dist/components/avatars/RuiAvatar.vue_vue_type_script_setup_true_lang.js +1 -38
  15. package/dist/components/avatars/RuiAvatar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  16. package/dist/components/avatars/RuiAvatarGroup.js.map +1 -1
  17. package/dist/components/avatars/RuiAvatarGroup.vue_vue_type_script_setup_true_lang.js +1 -13
  18. package/dist/components/avatars/RuiAvatarGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  19. package/dist/components/avatars/avatar-group-styles.d.ts +49 -0
  20. package/dist/components/avatars/avatar-group-styles.js +18 -0
  21. package/dist/components/avatars/avatar-group-styles.js.map +1 -0
  22. package/dist/components/avatars/avatar-styles.d.ts +181 -0
  23. package/dist/components/avatars/avatar-styles.js +43 -0
  24. package/dist/components/avatars/avatar-styles.js.map +1 -0
  25. package/dist/components/buttons/button/button-styles.js +1 -1
  26. package/dist/components/buttons/button/button-styles.js.map +1 -1
  27. package/dist/components/buttons/button-group/RuiButtonGroup.js.map +1 -1
  28. package/dist/components/buttons/button-group/RuiButtonGroup.vue_vue_type_script_setup_true_lang.js +2 -138
  29. package/dist/components/buttons/button-group/RuiButtonGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  30. package/dist/components/buttons/button-group/button-group-styles.d.ts +142 -0
  31. package/dist/components/buttons/button-group/button-group-styles.js +143 -0
  32. package/dist/components/buttons/button-group/button-group-styles.js.map +1 -0
  33. package/dist/components/calendar/RuiCalendar.js.map +1 -1
  34. package/dist/components/calendar/RuiCalendar.vue_vue_type_script_setup_true_lang.js +1 -8
  35. package/dist/components/calendar/RuiCalendar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  36. package/dist/components/calendar/RuiCalendarGrid.js.map +1 -1
  37. package/dist/components/calendar/RuiCalendarGrid.vue_vue_type_script_setup_true_lang.js +2 -22
  38. package/dist/components/calendar/RuiCalendarGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  39. package/dist/components/calendar/RuiCalendarMenu.js.map +1 -1
  40. package/dist/components/calendar/RuiCalendarMenu.vue_vue_type_script_setup_true_lang.js +3 -14
  41. package/dist/components/calendar/RuiCalendarMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  42. package/dist/components/calendar/calendar-grid-styles.d.ts +43 -0
  43. package/dist/components/calendar/calendar-grid-styles.js +26 -0
  44. package/dist/components/calendar/calendar-grid-styles.js.map +1 -0
  45. package/dist/components/calendar/calendar-menu-styles.d.ts +34 -0
  46. package/dist/components/calendar/calendar-menu-styles.js +17 -0
  47. package/dist/components/calendar/calendar-menu-styles.js.map +1 -0
  48. package/dist/components/calendar/calendar-styles.d.ts +16 -0
  49. package/dist/components/calendar/calendar-styles.js +13 -0
  50. package/dist/components/calendar/calendar-styles.js.map +1 -0
  51. package/dist/components/cards/RuiCard.js.map +1 -1
  52. package/dist/components/cards/RuiCard.vue_vue_type_script_setup_true_lang.js +3 -58
  53. package/dist/components/cards/RuiCard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  54. package/dist/components/cards/RuiCardHeader.js.map +1 -1
  55. package/dist/components/cards/RuiCardHeader.vue_vue_type_script_setup_true_lang.js +2 -20
  56. package/dist/components/cards/RuiCardHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  57. package/dist/components/cards/card-header-styles.d.ts +46 -0
  58. package/dist/components/cards/card-header-styles.js +24 -0
  59. package/dist/components/cards/card-header-styles.js.map +1 -0
  60. package/dist/components/cards/card-styles.d.ts +175 -0
  61. package/dist/components/cards/card-styles.js +62 -0
  62. package/dist/components/cards/card-styles.js.map +1 -0
  63. package/dist/components/chips/RuiChip.js.map +1 -1
  64. package/dist/components/chips/RuiChip.vue_vue_type_script_setup_true_lang.js +2 -241
  65. package/dist/components/chips/RuiChip.vue_vue_type_script_setup_true_lang.js.map +1 -1
  66. package/dist/components/chips/chip-styles.d.ts +223 -0
  67. package/dist/components/chips/chip-styles.js +246 -0
  68. package/dist/components/chips/chip-styles.js.map +1 -0
  69. package/dist/components/color-picker/RuiColorBoard.js.map +1 -1
  70. package/dist/components/color-picker/RuiColorBoard.vue_vue_type_script_setup_true_lang.js +3 -3
  71. package/dist/components/color-picker/RuiColorBoard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  72. package/dist/components/color-picker/RuiColorHue.js.map +1 -1
  73. package/dist/components/color-picker/RuiColorHue.vue_vue_type_script_setup_true_lang.js +3 -3
  74. package/dist/components/color-picker/RuiColorHue.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 +3 -3
  77. package/dist/components/color-picker/RuiColorPicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  78. package/dist/components/color-picker/color-board-styles.d.ts +1 -0
  79. package/dist/components/color-picker/color-board-styles.js +7 -0
  80. package/dist/components/color-picker/color-board-styles.js.map +1 -0
  81. package/dist/components/color-picker/color-hue-styles.d.ts +1 -0
  82. package/dist/components/color-picker/color-hue-styles.js +7 -0
  83. package/dist/components/color-picker/color-hue-styles.js.map +1 -0
  84. package/dist/components/color-picker/color-picker-styles.d.ts +1 -0
  85. package/dist/components/color-picker/color-picker-styles.js +7 -0
  86. package/dist/components/color-picker/color-picker-styles.js.map +1 -0
  87. package/dist/components/forms/field-label/RuiFieldLabel.js.map +1 -1
  88. package/dist/components/forms/field-label/RuiFieldLabel.vue_vue_type_script_setup_true_lang.js +1 -11
  89. package/dist/components/forms/field-label/RuiFieldLabel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  90. package/dist/components/forms/field-label/field-label-styles.d.ts +43 -0
  91. package/dist/components/forms/field-label/field-label-styles.js +16 -0
  92. package/dist/components/forms/field-label/field-label-styles.js.map +1 -0
  93. package/dist/components/forms/select/RuiMenuSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
  94. package/dist/components/forms/select/RuiSimpleSelect.js.map +1 -1
  95. package/dist/components/forms/select/RuiSimpleSelect.vue_vue_type_script_setup_true_lang.js +2 -11
  96. package/dist/components/forms/select/RuiSimpleSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
  97. package/dist/components/forms/select/simple-select-styles.d.ts +2 -0
  98. package/dist/components/forms/select/simple-select-styles.js +15 -0
  99. package/dist/components/forms/select/simple-select-styles.js.map +1 -0
  100. package/dist/components/forms/switch/RuiSwitch.js.map +1 -1
  101. package/dist/components/forms/switch/RuiSwitch.vue_vue_type_script_setup_true_lang.js +1 -126
  102. package/dist/components/forms/switch/RuiSwitch.vue_vue_type_script_setup_true_lang.js.map +1 -1
  103. package/dist/components/forms/switch/switch-styles.d.ts +151 -0
  104. package/dist/components/forms/switch/switch-styles.js +131 -0
  105. package/dist/components/forms/switch/switch-styles.js.map +1 -0
  106. package/dist/components/icons/RuiIcon.js.map +1 -1
  107. package/dist/components/icons/RuiIcon.vue_vue_type_script_setup_true_lang.js +2 -28
  108. package/dist/components/icons/RuiIcon.vue_vue_type_script_setup_true_lang.js.map +1 -1
  109. package/dist/components/icons/icon-styles.d.ts +44 -0
  110. package/dist/components/icons/icon-styles.js +33 -0
  111. package/dist/components/icons/icon-styles.js.map +1 -0
  112. package/dist/components/loaders/RuiSkeletonBase.js.map +1 -1
  113. package/dist/components/loaders/RuiSkeletonBase.vue_vue_type_script_setup_true_lang.js +2 -12
  114. package/dist/components/loaders/RuiSkeletonBase.vue_vue_type_script_setup_true_lang.js.map +1 -1
  115. package/dist/components/loaders/RuiSkeletonLoader.js.map +1 -1
  116. package/dist/components/loaders/RuiSkeletonLoader.vue_vue_type_script_setup_true_lang.js +3 -13
  117. package/dist/components/loaders/RuiSkeletonLoader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  118. package/dist/components/loaders/skeleton-base-styles.d.ts +25 -0
  119. package/dist/components/loaders/skeleton-base-styles.js +16 -0
  120. package/dist/components/loaders/skeleton-base-styles.js.map +1 -0
  121. package/dist/components/loaders/skeleton-loader-styles.d.ts +37 -0
  122. package/dist/components/loaders/skeleton-loader-styles.js +18 -0
  123. package/dist/components/loaders/skeleton-loader-styles.js.map +1 -0
  124. package/dist/components/overlays/badge/RuiBadge.js.map +1 -1
  125. package/dist/components/overlays/badge/RuiBadge.vue_vue_type_script_setup_true_lang.js +1 -83
  126. package/dist/components/overlays/badge/RuiBadge.vue_vue_type_script_setup_true_lang.js.map +1 -1
  127. package/dist/components/overlays/badge/badge-styles.d.ts +193 -0
  128. package/dist/components/overlays/badge/badge-styles.js +88 -0
  129. package/dist/components/overlays/badge/badge-styles.js.map +1 -0
  130. package/dist/components/overlays/dialog/RuiDialog.js.map +1 -1
  131. package/dist/components/overlays/dialog/RuiDialog.vue_vue_type_script_setup_true_lang.js +3 -14
  132. package/dist/components/overlays/dialog/RuiDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
  133. package/dist/components/overlays/dialog/dialog-styles.d.ts +40 -0
  134. package/dist/components/overlays/dialog/dialog-styles.js +18 -0
  135. package/dist/components/overlays/dialog/dialog-styles.js.map +1 -0
  136. package/dist/components/overlays/menu/RuiMenu.js.map +1 -1
  137. package/dist/components/overlays/menu/RuiMenu.vue.d.ts +9 -0
  138. package/dist/components/overlays/menu/RuiMenu.vue_vue_type_script_setup_true_lang.js +113 -58
  139. package/dist/components/overlays/menu/RuiMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  140. package/dist/components/overlays/menu/menu-styles.d.ts +58 -0
  141. package/dist/components/overlays/menu/menu-styles.js +25 -0
  142. package/dist/components/overlays/menu/menu-styles.js.map +1 -0
  143. package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.js.map +1 -1
  144. package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.vue_vue_type_script_setup_true_lang.js +4 -69
  145. package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.vue_vue_type_script_setup_true_lang.js.map +1 -1
  146. package/dist/components/overlays/navigation-drawer/navigation-drawer-styles.d.ts +76 -0
  147. package/dist/components/overlays/navigation-drawer/navigation-drawer-styles.js +72 -0
  148. package/dist/components/overlays/navigation-drawer/navigation-drawer-styles.js.map +1 -0
  149. package/dist/components/overlays/notification/RuiNotification.js.map +1 -1
  150. package/dist/components/overlays/notification/RuiNotification.vue_vue_type_script_setup_true_lang.js +3 -3
  151. package/dist/components/overlays/notification/RuiNotification.vue_vue_type_script_setup_true_lang.js.map +1 -1
  152. package/dist/components/overlays/notification/notification-styles.d.ts +1 -0
  153. package/dist/components/overlays/notification/notification-styles.js +7 -0
  154. package/dist/components/overlays/notification/notification-styles.js.map +1 -0
  155. package/dist/components/overlays/tooltip/RuiTooltip.js.map +1 -1
  156. package/dist/components/overlays/tooltip/RuiTooltip.vue.d.ts +4 -2
  157. package/dist/components/overlays/tooltip/RuiTooltip.vue_vue_type_script_setup_true_lang.js +42 -25
  158. package/dist/components/overlays/tooltip/RuiTooltip.vue_vue_type_script_setup_true_lang.js.map +1 -1
  159. package/dist/components/overlays/tooltip/tooltip-styles.d.ts +2 -0
  160. package/dist/components/overlays/tooltip/tooltip-styles.js +3 -1
  161. package/dist/components/overlays/tooltip/tooltip-styles.js.map +1 -1
  162. package/dist/components/progress/RuiProgress.js.map +1 -1
  163. package/dist/components/progress/RuiProgress.vue_vue_type_script_setup_true_lang.js +1 -133
  164. package/dist/components/progress/RuiProgress.vue_vue_type_script_setup_true_lang.js.map +1 -1
  165. package/dist/components/progress/progress-styles.d.ts +181 -0
  166. package/dist/components/progress/progress-styles.js +139 -0
  167. package/dist/components/progress/progress-styles.js.map +1 -0
  168. package/dist/components/steppers/RuiFooterStepper.js.map +1 -1
  169. package/dist/components/steppers/RuiFooterStepper.vue_vue_type_script_setup_true_lang.js +3 -13
  170. package/dist/components/steppers/RuiFooterStepper.vue_vue_type_script_setup_true_lang.js.map +1 -1
  171. package/dist/components/steppers/RuiStepper.js.map +1 -1
  172. package/dist/components/steppers/RuiStepper.vue_vue_type_script_setup_true_lang.js +4 -94
  173. package/dist/components/steppers/RuiStepper.vue_vue_type_script_setup_true_lang.js.map +1 -1
  174. package/dist/components/steppers/RuiStepperIcon.js.map +1 -1
  175. package/dist/components/steppers/RuiStepperIcon.vue_vue_type_script_setup_true_lang.js +2 -34
  176. package/dist/components/steppers/RuiStepperIcon.vue_vue_type_script_setup_true_lang.js.map +1 -1
  177. package/dist/components/steppers/footer-stepper-styles.d.ts +28 -0
  178. package/dist/components/steppers/footer-stepper-styles.js +16 -0
  179. package/dist/components/steppers/footer-stepper-styles.js.map +1 -0
  180. package/dist/components/steppers/stepper-icon-styles.d.ts +60 -0
  181. package/dist/components/steppers/stepper-icon-styles.js +39 -0
  182. package/dist/components/steppers/stepper-icon-styles.js.map +1 -0
  183. package/dist/components/steppers/stepper-styles.d.ts +202 -0
  184. package/dist/components/steppers/stepper-styles.js +98 -0
  185. package/dist/components/steppers/stepper-styles.js.map +1 -0
  186. package/dist/components/tables/RuiTable.js.map +1 -1
  187. package/dist/components/tables/RuiTable.vue_vue_type_script_setup_true_lang.js +1 -32
  188. package/dist/components/tables/RuiTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  189. package/dist/components/tables/RuiTableEmptyState.js.map +1 -1
  190. package/dist/components/tables/RuiTableEmptyState.vue_vue_type_script_setup_true_lang.js +1 -15
  191. package/dist/components/tables/RuiTableEmptyState.vue_vue_type_script_setup_true_lang.js.map +1 -1
  192. package/dist/components/tables/RuiTableErrorState.js.map +1 -1
  193. package/dist/components/tables/RuiTableErrorState.vue_vue_type_script_setup_true_lang.js +2 -5
  194. package/dist/components/tables/RuiTableErrorState.vue_vue_type_script_setup_true_lang.js.map +1 -1
  195. package/dist/components/tables/RuiTableHead.js.map +1 -1
  196. package/dist/components/tables/RuiTableHead.vue_vue_type_script_setup_true_lang.js +1 -34
  197. package/dist/components/tables/RuiTableHead.vue_vue_type_script_setup_true_lang.js.map +1 -1
  198. package/dist/components/tables/RuiTableLoadingState.js.map +1 -1
  199. package/dist/components/tables/RuiTableLoadingState.vue_vue_type_script_setup_true_lang.js +1 -8
  200. package/dist/components/tables/RuiTableLoadingState.vue_vue_type_script_setup_true_lang.js.map +1 -1
  201. package/dist/components/tables/RuiTablePagination.js.map +1 -1
  202. package/dist/components/tables/RuiTablePagination.vue_vue_type_script_setup_true_lang.js +1 -30
  203. package/dist/components/tables/RuiTablePagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  204. package/dist/components/tables/table-empty-state-styles.d.ts +43 -0
  205. package/dist/components/tables/table-empty-state-styles.js +20 -0
  206. package/dist/components/tables/table-empty-state-styles.js.map +1 -0
  207. package/dist/components/tables/table-error-state-styles.d.ts +36 -0
  208. package/dist/components/tables/table-error-state-styles.js +15 -0
  209. package/dist/components/tables/table-error-state-styles.js.map +1 -0
  210. package/dist/components/tables/table-head-styles.d.ts +91 -0
  211. package/dist/components/tables/table-head-styles.js +39 -0
  212. package/dist/components/tables/table-head-styles.js.map +1 -0
  213. package/dist/components/tables/table-loading-state-styles.d.ts +34 -0
  214. package/dist/components/tables/table-loading-state-styles.js +13 -0
  215. package/dist/components/tables/table-loading-state-styles.js.map +1 -0
  216. package/dist/components/tables/table-pagination-styles.d.ts +82 -0
  217. package/dist/components/tables/table-pagination-styles.js +35 -0
  218. package/dist/components/tables/table-pagination-styles.js.map +1 -0
  219. package/dist/components/tables/table-styles.d.ts +62 -0
  220. package/dist/components/tables/table-styles.js +37 -0
  221. package/dist/components/tables/table-styles.js.map +1 -0
  222. package/dist/components/tabs/tab/RuiTab.js.map +1 -1
  223. package/dist/components/tabs/tab/RuiTab.vue_vue_type_script_setup_true_lang.js +3 -84
  224. package/dist/components/tabs/tab/RuiTab.vue_vue_type_script_setup_true_lang.js.map +1 -1
  225. package/dist/components/tabs/tab/tab-styles.d.ts +153 -0
  226. package/dist/components/tabs/tab/tab-styles.js +89 -0
  227. package/dist/components/tabs/tab/tab-styles.js.map +1 -0
  228. package/dist/components/tabs/tabs/RuiTabs.js.map +1 -1
  229. package/dist/components/tabs/tabs/RuiTabs.vue_vue_type_script_setup_true_lang.js +2 -137
  230. package/dist/components/tabs/tabs/RuiTabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
  231. package/dist/components/tabs/tabs/tabs-styles.d.ts +168 -0
  232. package/dist/components/tabs/tabs/tabs-styles.js +142 -0
  233. package/dist/components/tabs/tabs/tabs-styles.js.map +1 -0
  234. package/dist/composables/floating.d.ts +3 -1
  235. package/dist/composables/floating.js +8 -9
  236. package/dist/composables/floating.js.map +1 -1
  237. package/dist/icons/icons_1.d.ts +1 -1
  238. package/dist/icons/icons_1.js +10 -9
  239. package/dist/icons/icons_1.js.map +1 -1
  240. package/dist/icons/icons_2.d.ts +1 -1
  241. package/dist/icons/icons_2.js +9 -11
  242. package/dist/icons/icons_2.js.map +1 -1
  243. package/dist/icons/icons_3.d.ts +1 -1
  244. package/dist/icons/icons_3.js +11 -5
  245. package/dist/icons/icons_3.js.map +1 -1
  246. package/dist/icons/icons_4.d.ts +1 -1
  247. package/dist/icons/icons_4.js +5 -10
  248. package/dist/icons/icons_4.js.map +1 -1
  249. package/dist/icons/icons_5.d.ts +1 -0
  250. package/dist/icons/icons_5.js +10 -1
  251. package/dist/icons/icons_5.js.map +1 -1
  252. package/dist/icons/index.d.ts +1 -1
  253. package/dist/icons/index.js +7 -6
  254. package/dist/icons/index.js.map +1 -1
  255. package/dist/index.js +6 -6
  256. package/dist/style.css +8 -0
  257. package/dist/utils/form-text-detail.d.ts +2 -0
  258. package/dist/utils/form-text-detail.js +5 -1
  259. package/dist/utils/form-text-detail.js.map +1 -1
  260. package/dist/web-types.json +11 -1
  261. package/package.json +1 -1
@@ -0,0 +1,131 @@
1
+ import { tv } from "../../../utils/tv.js";
2
+ //#region src/components/forms/switch/switch-styles.ts
3
+ var switchStyles = tv({
4
+ slots: {
5
+ wrapper: "relative flex gap-3.25 items-start cursor-pointer group/switch",
6
+ inner: "relative w-10 h-5.5 mt-px shrink-0",
7
+ input: "peer appearance-none relative w-full h-full rounded-full bg-rui-outline transition-colors duration-150 cursor-pointer focus-visible:focus-ring",
8
+ toggle: ["absolute size-4.5 transition-all duration-75 ease-in-out -translate-y-1/2 top-1/2 rounded-full pointer-events-none", "bg-white left-0.5 shadow-rui-control"].join(" "),
9
+ label: "text-rui-text text-sm/6",
10
+ details: ""
11
+ },
12
+ variants: {
13
+ underLabel: {
14
+ true: { details: "pl-13.25" },
15
+ false: {}
16
+ },
17
+ checked: {
18
+ true: { toggle: "left-5" },
19
+ false: {}
20
+ },
21
+ disabled: { true: {
22
+ wrapper: "cursor-not-allowed",
23
+ input: "bg-rui-neutral-200! dark:bg-rui-neutral-800! cursor-not-allowed",
24
+ toggle: "bg-rui-neutral-50! dark:bg-rui-neutral-600! shadow-none!",
25
+ label: "text-rui-text-disabled"
26
+ } },
27
+ size: { sm: {
28
+ inner: "w-8.5 h-4.5 mt-0.75",
29
+ toggle: "size-3.5"
30
+ } },
31
+ validation: {
32
+ error: { input: "ring-1 ring-rui-error" },
33
+ success: { input: "ring-1 ring-rui-success" }
34
+ },
35
+ color: {
36
+ primary: {},
37
+ secondary: {},
38
+ error: {},
39
+ warning: {},
40
+ info: {},
41
+ success: {}
42
+ }
43
+ },
44
+ compoundVariants: [
45
+ {
46
+ checked: false,
47
+ disabled: false,
48
+ class: { input: "group-hover/switch:bg-rui-neutral-500 dark:group-hover/switch:bg-rui-neutral-400" }
49
+ },
50
+ {
51
+ checked: true,
52
+ disabled: false,
53
+ class: {
54
+ input: "bg-rui-neutral-900 dark:bg-rui-neutral-100",
55
+ toggle: "dark:bg-rui-neutral-900"
56
+ }
57
+ },
58
+ {
59
+ checked: true,
60
+ disabled: false,
61
+ color: "primary",
62
+ class: {
63
+ input: "bg-rui-primary dark:bg-rui-primary",
64
+ toggle: "dark:bg-white"
65
+ }
66
+ },
67
+ {
68
+ checked: true,
69
+ disabled: false,
70
+ color: "secondary",
71
+ class: {
72
+ input: "bg-rui-secondary dark:bg-rui-secondary",
73
+ toggle: "dark:bg-white"
74
+ }
75
+ },
76
+ {
77
+ checked: true,
78
+ disabled: false,
79
+ color: "error",
80
+ class: {
81
+ input: "bg-rui-error dark:bg-rui-error-darker",
82
+ toggle: "dark:bg-white"
83
+ }
84
+ },
85
+ {
86
+ checked: true,
87
+ disabled: false,
88
+ color: "warning",
89
+ class: {
90
+ input: "bg-rui-warning dark:bg-rui-warning-darker",
91
+ toggle: "dark:bg-white"
92
+ }
93
+ },
94
+ {
95
+ checked: true,
96
+ disabled: false,
97
+ color: "info",
98
+ class: {
99
+ input: "bg-rui-info dark:bg-rui-info-darker",
100
+ toggle: "dark:bg-white"
101
+ }
102
+ },
103
+ {
104
+ checked: true,
105
+ disabled: false,
106
+ color: "success",
107
+ class: {
108
+ input: "bg-rui-success dark:bg-rui-success-darker",
109
+ toggle: "dark:bg-white"
110
+ }
111
+ },
112
+ {
113
+ size: "sm",
114
+ checked: true,
115
+ class: { toggle: "left-4.5" }
116
+ },
117
+ {
118
+ size: "sm",
119
+ underLabel: true,
120
+ class: { details: "pl-11.75" }
121
+ }
122
+ ],
123
+ defaultVariants: {
124
+ checked: false,
125
+ disabled: false
126
+ }
127
+ });
128
+ //#endregion
129
+ export { switchStyles };
130
+
131
+ //# sourceMappingURL=switch-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-styles.js","names":[],"sources":["../../../../src/components/forms/switch/switch-styles.ts"],"sourcesContent":["import { tv } from '@/utils/tv';\n\nexport const switchStyles = tv({\n slots: {\n // 13px to the label, the gap a checkbox or radio leaves, so the focus ring clears the text\n wrapper: 'relative flex gap-3.25 items-start cursor-pointer group/switch',\n // 40 × 22, nudged down a pixel to sit centred on the label's 24px line\n inner: 'relative w-10 h-5.5 mt-px shrink-0',\n // the off track is the control edge color, 3:1 against the page in both themes\n input: 'peer appearance-none relative w-full h-full rounded-full bg-rui-outline transition-colors duration-150 cursor-pointer focus-visible:focus-ring',\n toggle: [\n 'absolute size-4.5 transition-all duration-75 ease-in-out -translate-y-1/2 top-1/2 rounded-full pointer-events-none',\n 'bg-white left-0.5 shadow-rui-control',\n ].join(' '),\n label: 'text-rui-text text-sm/6',\n details: '',\n },\n variants: {\n // indented by the track and the 13px gap, so the message starts where the label does\n underLabel: {\n true: { details: 'pl-13.25' },\n false: {},\n },\n checked: {\n true: {\n toggle: 'left-5',\n },\n false: {},\n },\n disabled: {\n true: {\n wrapper: 'cursor-not-allowed',\n input: 'bg-rui-neutral-200! dark:bg-rui-neutral-800! cursor-not-allowed',\n toggle: 'bg-rui-neutral-50! dark:bg-rui-neutral-600! shadow-none!',\n label: 'text-rui-text-disabled',\n },\n },\n size: {\n sm: {\n inner: 'w-8.5 h-4.5 mt-0.75',\n toggle: 'size-3.5',\n },\n },\n // a ring and the message below mark the state; a filled red or green track would read as \"on\"\n validation: {\n error: {\n input: 'ring-1 ring-rui-error',\n },\n success: {\n input: 'ring-1 ring-rui-success',\n },\n },\n color: {\n primary: {},\n secondary: {},\n error: {},\n warning: {},\n info: {},\n success: {},\n },\n },\n compoundVariants: [\n { checked: false, disabled: false, class: { input: 'group-hover/switch:bg-rui-neutral-500 dark:group-hover/switch:bg-rui-neutral-400' } },\n\n // Checked (no color): an inverted neutral track, with a dark knob in dark mode\n { checked: true, disabled: false, class: { input: 'bg-rui-neutral-900 dark:bg-rui-neutral-100', toggle: 'dark:bg-rui-neutral-900' } },\n\n // Checked + color: a solid track with the white knob, in both themes\n { checked: true, disabled: false, color: 'primary', class: { input: 'bg-rui-primary dark:bg-rui-primary', toggle: 'dark:bg-white' } },\n { checked: true, disabled: false, color: 'secondary', class: { input: 'bg-rui-secondary dark:bg-rui-secondary', toggle: 'dark:bg-white' } },\n // a status color's dark `main` is a text tone, so the track takes the deep `darker` under the white knob\n { checked: true, disabled: false, color: 'error', class: { input: 'bg-rui-error dark:bg-rui-error-darker', toggle: 'dark:bg-white' } },\n { checked: true, disabled: false, color: 'warning', class: { input: 'bg-rui-warning dark:bg-rui-warning-darker', toggle: 'dark:bg-white' } },\n { checked: true, disabled: false, color: 'info', class: { input: 'bg-rui-info dark:bg-rui-info-darker', toggle: 'dark:bg-white' } },\n { checked: true, disabled: false, color: 'success', class: { input: 'bg-rui-success dark:bg-rui-success-darker', toggle: 'dark:bg-white' } },\n\n // Size sm + checked: 34 - 14 - 2\n { size: 'sm', checked: true, class: { toggle: 'left-4.5' } },\n // sm: a 34px track\n { size: 'sm', underLabel: true, class: { details: 'pl-11.75' } },\n ],\n defaultVariants: {\n checked: false,\n disabled: false,\n },\n});\n"],"mappings":";;AAEA,IAAa,eAAe,GAAG;CAC7B,OAAO;EAEL,SAAS;EAET,OAAO;EAEP,OAAO;EACP,QAAQ,CACN,sHACA,sCACF,CAAC,CAAC,KAAK,GAAG;EACV,OAAO;EACP,SAAS;CACX;CACA,UAAU;EAER,YAAY;GACV,MAAM,EAAE,SAAS,WAAW;GAC5B,OAAO,CAAC;EACV;EACA,SAAS;GACP,MAAM,EACJ,QAAQ,SACV;GACA,OAAO,CAAC;EACV;EACA,UAAU,EACR,MAAM;GACJ,SAAS;GACT,OAAO;GACP,QAAQ;GACR,OAAO;EACT,EACF;EACA,MAAM,EACJ,IAAI;GACF,OAAO;GACP,QAAQ;EACV,EACF;EAEA,YAAY;GACV,OAAO,EACL,OAAO,wBACT;GACA,SAAS,EACP,OAAO,0BACT;EACF;EACA,OAAO;GACL,SAAS,CAAC;GACV,WAAW,CAAC;GACZ,OAAO,CAAC;GACR,SAAS,CAAC;GACV,MAAM,CAAC;GACP,SAAS,CAAC;EACZ;CACF;CACA,kBAAkB;EAChB;GAAE,SAAS;GAAO,UAAU;GAAO,OAAO,EAAE,OAAO,mFAAmF;EAAE;EAGxI;GAAE,SAAS;GAAM,UAAU;GAAO,OAAO;IAAE,OAAO;IAA8C,QAAQ;GAA0B;EAAE;EAGpI;GAAE,SAAS;GAAM,UAAU;GAAO,OAAO;GAAW,OAAO;IAAE,OAAO;IAAsC,QAAQ;GAAgB;EAAE;EACpI;GAAE,SAAS;GAAM,UAAU;GAAO,OAAO;GAAa,OAAO;IAAE,OAAO;IAA0C,QAAQ;GAAgB;EAAE;EAE1I;GAAE,SAAS;GAAM,UAAU;GAAO,OAAO;GAAS,OAAO;IAAE,OAAO;IAAyC,QAAQ;GAAgB;EAAE;EACrI;GAAE,SAAS;GAAM,UAAU;GAAO,OAAO;GAAW,OAAO;IAAE,OAAO;IAA6C,QAAQ;GAAgB;EAAE;EAC3I;GAAE,SAAS;GAAM,UAAU;GAAO,OAAO;GAAQ,OAAO;IAAE,OAAO;IAAuC,QAAQ;GAAgB;EAAE;EAClI;GAAE,SAAS;GAAM,UAAU;GAAO,OAAO;GAAW,OAAO;IAAE,OAAO;IAA6C,QAAQ;GAAgB;EAAE;EAG3I;GAAE,MAAM;GAAM,SAAS;GAAM,OAAO,EAAE,QAAQ,WAAW;EAAE;EAE3D;GAAE,MAAM;GAAM,YAAY;GAAM,OAAO,EAAE,SAAS,WAAW;EAAE;CACjE;CACA,iBAAiB;EACf,SAAS;EACT,UAAU;CACZ;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RuiIcon.js","names":["_sfc_main"],"sources":["../../../src/components/icons/RuiIcon.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ClassValue } from 'vue';\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport { objectOmit } from '@vueuse/shared';\nimport { useIcons } from '@/composables/icons';\nimport { cn, tv } from '@/utils/tv';\n\nexport interface Props {\n name: RuiIcons;\n size?: number | string;\n color?: ContextColorsType;\n}\n\ndefineOptions({\n name: 'RuiIcon',\n // A fallthrough class would land beside the variant classes and leave the cascade to break the tie; `ui` merges instead\n inheritAttrs: false,\n});\n\nconst { name, size, color } = defineProps<Props>();\n\nconst { registeredIcons } = useIcons();\n\ntype SvgComponent = [tag: string, attrs: Record<string, string>];\n\n/**\n * The icon's box is always driven by `--rui-icon-size`, so flex shrinking is\n * never wanted: `shrink-0` keeps the size beside a long grow sibling,\n * such as a `w-full` button label in `variant=\"list\"`. Without it the svg is\n * compressed along the main axis while its height stays put, drawing a sliver\n * of a glyph.\n *\n * The stroke is set on the svg as CSS, so `--rui-icon-stroke` can retune it.\n * Lucide's 2 reads heavy beside Inter; 1.5 would draw a 16px glyph at a\n * single, blurry pixel.\n *\n * The svg also carries the default paint, outlined in `currentColor`, and\n * every primitive inherits it unless it sets its own `fill` or `stroke`. That\n * is how lucide draws, so its solid dots (tag, palette) stay solid, and how an\n * icon mixes a stroked outline with a solid mark.\n */\nconst iconStyles = tv({\n base: 'shrink-0 w-(--rui-icon-size,1.5rem) h-(--rui-icon-size,1.5rem) [stroke-width:var(--rui-icon-stroke,1.75)]',\n variants: {\n color: {\n primary: 'text-rui-primary',\n secondary: 'text-rui-secondary',\n error: 'text-rui-error',\n warning: 'text-rui-warning',\n info: 'text-rui-info',\n success: 'text-rui-success',\n },\n },\n});\n\nconst hasExplicitSize = computed<boolean>(() => size !== undefined);\n\nfunction ui(attrsClass: ClassValue): string {\n return iconStyles({ color, class: cn(attrsClass) });\n}\n\n/**\n * The `size` prop as an inline CSS custom property on the svg. Inline style\n * beats any inherited value for the same property on this element, so a\n * consumer's size beats the button's `--rui-icon-size` without !important.\n *\n * A bare number is coerced to px, including the numeric string a template\n * binding like `:size=\"16\"` resolves to, while a value that already carries a\n * unit passes through. CSS needs that coercion; the `width`/`height`\n * presentation attributes this replaced treated bare numbers as px themselves.\n */\nconst sizeStyle = computed<Record<string, string> | undefined>(() => {\n if (!get(hasExplicitSize))\n return undefined;\n const raw = String(size);\n const value = /^\\d+(?:\\.\\d+)?$/.test(raw) ? `${raw}px` : raw;\n return { '--rui-icon-size': value };\n});\n\n/**\n * What is registered is the only thing that matters here. An app may register\n * its own icons through `createRui(\\{ theme: \\{ icons \\} \\})`, brand logos\n * among them since the library carries none, and those names never appear in\n * the generated `RuiIcons` list. Validating against that list warned for\n * precisely the icons the registration API exists to support. A genuinely\n * unknown name is still caught by the check that decides whether anything\n * renders.\n */\nconst components = computed<SvgComponent[] | undefined>(() => {\n const found = registeredIcons[name];\n\n if (!found) {\n console.error(\n `Icons \"${name}\" not found. Make sure that you have register the icon when installing the RuiPlugin`,\n );\n }\n return found;\n});\n</script>\n\n<template>\n <svg\n aria-hidden=\"true\"\n class=\"rui-icon\"\n :class=\"ui($attrs.class)\"\n :style=\"sizeStyle\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n v-bind=\"objectOmit($attrs, ['class'])\"\n >\n <component\n :is=\"component[0]\"\n v-for=\"(component, index) in components\"\n :key=\"index\"\n v-bind=\"component[1]\"\n />\n </svg>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"RuiIcon.js","names":["_sfc_main"],"sources":["../../../src/components/icons/RuiIcon.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ClassValue } from 'vue';\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport { objectOmit } from '@vueuse/shared';\nimport { useIcons } from '@/composables/icons';\nimport { cn } from '@/utils/tv';\nimport { iconStyles } from './icon-styles';\n\nexport interface Props {\n name: RuiIcons;\n size?: number | string;\n color?: ContextColorsType;\n}\n\ndefineOptions({\n name: 'RuiIcon',\n // A fallthrough class would land beside the variant classes and leave the cascade to break the tie; `ui` merges instead\n inheritAttrs: false,\n});\n\nconst { name, size, color } = defineProps<Props>();\n\nconst { registeredIcons } = useIcons();\n\ntype SvgComponent = [tag: string, attrs: Record<string, string>];\n\nconst hasExplicitSize = computed<boolean>(() => size !== undefined);\n\nfunction ui(attrsClass: ClassValue): string {\n return iconStyles({ color, class: cn(attrsClass) });\n}\n\n/**\n * The `size` prop as an inline CSS custom property on the svg. Inline style\n * beats any inherited value for the same property on this element, so a\n * consumer's size beats the button's `--rui-icon-size` without !important.\n *\n * A bare number is coerced to px, including the numeric string a template\n * binding like `:size=\"16\"` resolves to, while a value that already carries a\n * unit passes through. CSS needs that coercion; the `width`/`height`\n * presentation attributes this replaced treated bare numbers as px themselves.\n */\nconst sizeStyle = computed<Record<string, string> | undefined>(() => {\n if (!get(hasExplicitSize))\n return undefined;\n const raw = String(size);\n const value = /^\\d+(?:\\.\\d+)?$/.test(raw) ? `${raw}px` : raw;\n return { '--rui-icon-size': value };\n});\n\n/**\n * What is registered is the only thing that matters here. An app may register\n * its own icons through `createRui(\\{ theme: \\{ icons \\} \\})`, brand logos\n * among them since the library carries none, and those names never appear in\n * the generated `RuiIcons` list. Validating against that list warned for\n * precisely the icons the registration API exists to support. A genuinely\n * unknown name is still caught by the check that decides whether anything\n * renders.\n */\nconst components = computed<SvgComponent[] | undefined>(() => {\n const found = registeredIcons[name];\n\n if (!found) {\n console.error(\n `Icons \"${name}\" not found. Make sure that you have register the icon when installing the RuiPlugin`,\n );\n }\n return found;\n});\n</script>\n\n<template>\n <svg\n aria-hidden=\"true\"\n class=\"rui-icon\"\n :class=\"ui($attrs.class)\"\n :style=\"sizeStyle\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n v-bind=\"objectOmit($attrs, ['class'])\"\n >\n <component\n :is=\"component[0]\"\n v-for=\"(component, index) in components\"\n :key=\"index\"\n v-bind=\"component[1]\"\n />\n </svg>\n</template>\n"],"mappings":""}
@@ -1,24 +1,9 @@
1
1
  import { useIcons } from "../../composables/icons.js";
2
2
  import { get, objectOmit } from "../../vendor/@vueuse/shared/dist/index.js";
3
- import { cn, tv } from "../../utils/tv.js";
3
+ import { cn } from "../../utils/tv.js";
4
+ import { iconStyles } from "./icon-styles.js";
4
5
  import { Fragment, computed, createBlock, createElementBlock, defineComponent, mergeProps, openBlock, renderList, resolveDynamicComponent, unref } from "vue";
5
6
  //#region src/components/icons/RuiIcon.vue?vue&type=script&setup=true&lang.ts
6
- /**
7
- * The icon's box is always driven by `--rui-icon-size`, so flex shrinking is
8
- * never wanted: `shrink-0` keeps the size beside a long grow sibling,
9
- * such as a `w-full` button label in `variant="list"`. Without it the svg is
10
- * compressed along the main axis while its height stays put, drawing a sliver
11
- * of a glyph.
12
- *
13
- * The stroke is set on the svg as CSS, so `--rui-icon-stroke` can retune it.
14
- * Lucide's 2 reads heavy beside Inter; 1.5 would draw a 16px glyph at a
15
- * single, blurry pixel.
16
- *
17
- * The svg also carries the default paint, outlined in `currentColor`, and
18
- * every primitive inherits it unless it sets its own `fill` or `stroke`. That
19
- * is how lucide draws, so its solid dots (tag, palette) stay solid, and how an
20
- * icon mixes a stroked outline with a solid mark.
21
- */
22
7
  var RuiIcon_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
23
8
  name: "RuiIcon",
24
9
  inheritAttrs: false,
@@ -30,17 +15,6 @@ var RuiIcon_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
30
15
  },
31
16
  setup(__props) {
32
17
  const { registeredIcons } = useIcons();
33
- const iconStyles = tv({
34
- base: "shrink-0 w-(--rui-icon-size,1.5rem) h-(--rui-icon-size,1.5rem) [stroke-width:var(--rui-icon-stroke,1.75)]",
35
- variants: { color: {
36
- primary: "text-rui-primary",
37
- secondary: "text-rui-secondary",
38
- error: "text-rui-error",
39
- warning: "text-rui-warning",
40
- info: "text-rui-info",
41
- success: "text-rui-success"
42
- } }
43
- });
44
18
  const hasExplicitSize = computed(() => __props.size !== void 0);
45
19
  function ui(attrsClass) {
46
20
  return iconStyles({
@@ -1 +1 @@
1
- {"version":3,"file":"RuiIcon.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_openBlock","_createElementBlock","_mergeProps","_unref","_Fragment","_renderList","_createBlock","_resolveDynamicComponent"],"sources":["../../../src/components/icons/RuiIcon.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ClassValue } from 'vue';\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport { objectOmit } from '@vueuse/shared';\nimport { useIcons } from '@/composables/icons';\nimport { cn, tv } from '@/utils/tv';\n\nexport interface Props {\n name: RuiIcons;\n size?: number | string;\n color?: ContextColorsType;\n}\n\ndefineOptions({\n name: 'RuiIcon',\n // A fallthrough class would land beside the variant classes and leave the cascade to break the tie; `ui` merges instead\n inheritAttrs: false,\n});\n\nconst { name, size, color } = defineProps<Props>();\n\nconst { registeredIcons } = useIcons();\n\ntype SvgComponent = [tag: string, attrs: Record<string, string>];\n\n/**\n * The icon's box is always driven by `--rui-icon-size`, so flex shrinking is\n * never wanted: `shrink-0` keeps the size beside a long grow sibling,\n * such as a `w-full` button label in `variant=\"list\"`. Without it the svg is\n * compressed along the main axis while its height stays put, drawing a sliver\n * of a glyph.\n *\n * The stroke is set on the svg as CSS, so `--rui-icon-stroke` can retune it.\n * Lucide's 2 reads heavy beside Inter; 1.5 would draw a 16px glyph at a\n * single, blurry pixel.\n *\n * The svg also carries the default paint, outlined in `currentColor`, and\n * every primitive inherits it unless it sets its own `fill` or `stroke`. That\n * is how lucide draws, so its solid dots (tag, palette) stay solid, and how an\n * icon mixes a stroked outline with a solid mark.\n */\nconst iconStyles = tv({\n base: 'shrink-0 w-(--rui-icon-size,1.5rem) h-(--rui-icon-size,1.5rem) [stroke-width:var(--rui-icon-stroke,1.75)]',\n variants: {\n color: {\n primary: 'text-rui-primary',\n secondary: 'text-rui-secondary',\n error: 'text-rui-error',\n warning: 'text-rui-warning',\n info: 'text-rui-info',\n success: 'text-rui-success',\n },\n },\n});\n\nconst hasExplicitSize = computed<boolean>(() => size !== undefined);\n\nfunction ui(attrsClass: ClassValue): string {\n return iconStyles({ color, class: cn(attrsClass) });\n}\n\n/**\n * The `size` prop as an inline CSS custom property on the svg. Inline style\n * beats any inherited value for the same property on this element, so a\n * consumer's size beats the button's `--rui-icon-size` without !important.\n *\n * A bare number is coerced to px, including the numeric string a template\n * binding like `:size=\"16\"` resolves to, while a value that already carries a\n * unit passes through. CSS needs that coercion; the `width`/`height`\n * presentation attributes this replaced treated bare numbers as px themselves.\n */\nconst sizeStyle = computed<Record<string, string> | undefined>(() => {\n if (!get(hasExplicitSize))\n return undefined;\n const raw = String(size);\n const value = /^\\d+(?:\\.\\d+)?$/.test(raw) ? `${raw}px` : raw;\n return { '--rui-icon-size': value };\n});\n\n/**\n * What is registered is the only thing that matters here. An app may register\n * its own icons through `createRui(\\{ theme: \\{ icons \\} \\})`, brand logos\n * among them since the library carries none, and those names never appear in\n * the generated `RuiIcons` list. Validating against that list warned for\n * precisely the icons the registration API exists to support. A genuinely\n * unknown name is still caught by the check that decides whether anything\n * renders.\n */\nconst components = computed<SvgComponent[] | undefined>(() => {\n const found = registeredIcons[name];\n\n if (!found) {\n console.error(\n `Icons \"${name}\" not found. Make sure that you have register the icon when installing the RuiPlugin`,\n );\n }\n return found;\n});\n</script>\n\n<template>\n <svg\n aria-hidden=\"true\"\n class=\"rui-icon\"\n :class=\"ui($attrs.class)\"\n :style=\"sizeStyle\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n v-bind=\"objectOmit($attrs, ['class'])\"\n >\n <component\n :is=\"component[0]\"\n v-for=\"(component, index) in components\"\n :key=\"index\"\n v-bind=\"component[1]\"\n />\n </svg>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBA,MAAM,EAAE,oBAAoB,SAAS;EAoBrC,MAAM,aAAa,GAAG;GACpB,MAAM;GACN,UAAU,EACR,OAAO;IACL,SAAS;IACT,WAAW;IACX,OAAO;IACP,SAAS;IACT,MAAM;IACN,SAAS;GACX,EACF;EACF,CAAC;EAED,MAAM,kBAAkB,eAAwB,QAAA,SAAS,KAAA,CAAS;EAElE,SAAS,GAAG,YAAgC;GAC1C,OAAO,WAAW;IAAE,OAAI,QAAA;IAAG,OAAO,GAAG,UAAU;GAAE,CAAC;EACpD;;;;;;;;;;;EAYA,MAAM,YAAY,eAAmD;GACnE,IAAI,CAAC,IAAI,eAAe,GACtB,OAAO,KAAA;GACT,MAAM,MAAM,OAAO,QAAA,IAAI;GAEvB,OAAO,EAAE,mBADK,kBAAkB,KAAK,GAAG,IAAI,GAAG,IAAI,MAAM,IACvB;EACpC,CAAC;;;;;;;;;;EAWD,MAAM,aAAa,eAA2C;GAC5D,MAAM,QAAQ,gBAAgB,QAAA;GAE9B,IAAI,CAAC,OACH,QAAQ,MACN,UAAU,QAAA,KAAK,qFACjB;GAEF,OAAO;EACT,CAAC;;GAIC,OAAAC,UAAA,GAAAC,mBAmBM,OAnBNC,WAmBM;IAlBJ,eAAY;IACZ,OAAK,CAAC,YACE,GAAGH,KAAAA,OAAO,KAAK,CAAA;IACtB,OAAOI,MAAA,SAAA;IACR,SAAQ;IACR,OAAM;IACN,MAAK;IACL,QAAO;IACP,kBAAe;IACf,mBAAgB;GACR,GAAAA,MAAA,UAAA,CAAU,CAACJ,KAAAA,QAAM,CAAA,OAAA,CAAA,CAAA,GAAA,EAEzBC,UAAA,IAAA,GAAAC,mBAKEG,UAAA,MAAAC,WAH6BF,MAAA,UAAA,IAArB,WAAW,UAAK;IAF1B,OAAAH,UAAA,GAAAM,YAKEC,wBAJK,UAAS,EAAA,GADhBL,WAKE,EAFC,KAAK,MAAK,GAAA,EAAA,SAAA,KAAA,GACH,UAAS,EAAA,GAAA,MAAA,EAAA"}
1
+ {"version":3,"file":"RuiIcon.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_openBlock","_createElementBlock","_mergeProps","_unref","_Fragment","_renderList","_createBlock","_resolveDynamicComponent"],"sources":["../../../src/components/icons/RuiIcon.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ClassValue } from 'vue';\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport { objectOmit } from '@vueuse/shared';\nimport { useIcons } from '@/composables/icons';\nimport { cn } from '@/utils/tv';\nimport { iconStyles } from './icon-styles';\n\nexport interface Props {\n name: RuiIcons;\n size?: number | string;\n color?: ContextColorsType;\n}\n\ndefineOptions({\n name: 'RuiIcon',\n // A fallthrough class would land beside the variant classes and leave the cascade to break the tie; `ui` merges instead\n inheritAttrs: false,\n});\n\nconst { name, size, color } = defineProps<Props>();\n\nconst { registeredIcons } = useIcons();\n\ntype SvgComponent = [tag: string, attrs: Record<string, string>];\n\nconst hasExplicitSize = computed<boolean>(() => size !== undefined);\n\nfunction ui(attrsClass: ClassValue): string {\n return iconStyles({ color, class: cn(attrsClass) });\n}\n\n/**\n * The `size` prop as an inline CSS custom property on the svg. Inline style\n * beats any inherited value for the same property on this element, so a\n * consumer's size beats the button's `--rui-icon-size` without !important.\n *\n * A bare number is coerced to px, including the numeric string a template\n * binding like `:size=\"16\"` resolves to, while a value that already carries a\n * unit passes through. CSS needs that coercion; the `width`/`height`\n * presentation attributes this replaced treated bare numbers as px themselves.\n */\nconst sizeStyle = computed<Record<string, string> | undefined>(() => {\n if (!get(hasExplicitSize))\n return undefined;\n const raw = String(size);\n const value = /^\\d+(?:\\.\\d+)?$/.test(raw) ? `${raw}px` : raw;\n return { '--rui-icon-size': value };\n});\n\n/**\n * What is registered is the only thing that matters here. An app may register\n * its own icons through `createRui(\\{ theme: \\{ icons \\} \\})`, brand logos\n * among them since the library carries none, and those names never appear in\n * the generated `RuiIcons` list. Validating against that list warned for\n * precisely the icons the registration API exists to support. A genuinely\n * unknown name is still caught by the check that decides whether anything\n * renders.\n */\nconst components = computed<SvgComponent[] | undefined>(() => {\n const found = registeredIcons[name];\n\n if (!found) {\n console.error(\n `Icons \"${name}\" not found. Make sure that you have register the icon when installing the RuiPlugin`,\n );\n }\n return found;\n});\n</script>\n\n<template>\n <svg\n aria-hidden=\"true\"\n class=\"rui-icon\"\n :class=\"ui($attrs.class)\"\n :style=\"sizeStyle\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n v-bind=\"objectOmit($attrs, ['class'])\"\n >\n <component\n :is=\"component[0]\"\n v-for=\"(component, index) in components\"\n :key=\"index\"\n v-bind=\"component[1]\"\n />\n </svg>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;EAuBA,MAAM,EAAE,oBAAoB,SAAS;EAIrC,MAAM,kBAAkB,eAAwB,QAAA,SAAS,KAAA,CAAS;EAElE,SAAS,GAAG,YAAgC;GAC1C,OAAO,WAAW;IAAE,OAAI,QAAA;IAAG,OAAO,GAAG,UAAU;GAAE,CAAC;EACpD;;;;;;;;;;;EAYA,MAAM,YAAY,eAAmD;GACnE,IAAI,CAAC,IAAI,eAAe,GACtB,OAAO,KAAA;GACT,MAAM,MAAM,OAAO,QAAA,IAAI;GAEvB,OAAO,EAAE,mBADK,kBAAkB,KAAK,GAAG,IAAI,GAAG,IAAI,MAAM,IACvB;EACpC,CAAC;;;;;;;;;;EAWD,MAAM,aAAa,eAA2C;GAC5D,MAAM,QAAQ,gBAAgB,QAAA;GAE9B,IAAI,CAAC,OACH,QAAQ,MACN,UAAU,QAAA,KAAK,qFACjB;GAEF,OAAO;EACT,CAAC;;GAIC,OAAAC,UAAA,GAAAC,mBAmBM,OAnBNC,WAmBM;IAlBJ,eAAY;IACZ,OAAK,CAAC,YACE,GAAGH,KAAAA,OAAO,KAAK,CAAA;IACtB,OAAOI,MAAA,SAAA;IACR,SAAQ;IACR,OAAM;IACN,MAAK;IACL,QAAO;IACP,kBAAe;IACf,mBAAgB;GACR,GAAAA,MAAA,UAAA,CAAU,CAACJ,KAAAA,QAAM,CAAA,OAAA,CAAA,CAAA,GAAA,EAEzBC,UAAA,IAAA,GAAAC,mBAKEG,UAAA,MAAAC,WAH6BF,MAAA,UAAA,IAArB,WAAW,UAAK;IAF1B,OAAAH,UAAA,GAAAM,YAKEC,wBAJK,UAAS,EAAA,GADhBL,WAKE,EAFC,KAAK,MAAK,GAAA,EAAA,SAAA,KAAA,GACH,UAAS,EAAA,GAAA,MAAA,EAAA"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The icon's box is always driven by `--rui-icon-size`, so flex shrinking is
3
+ * never wanted: `shrink-0` keeps the size beside a long grow sibling,
4
+ * such as a `w-full` button label in `variant="list"`. Without it the svg is
5
+ * compressed along the main axis while its height stays put, drawing a sliver
6
+ * of a glyph.
7
+ *
8
+ * The stroke is set on the svg as CSS, so `--rui-icon-stroke` can retune it.
9
+ * Lucide's 2 reads heavy beside Inter; 1.5 would draw a 16px glyph at a
10
+ * single, blurry pixel.
11
+ *
12
+ * The svg also carries the default paint, outlined in `currentColor`, and
13
+ * every primitive inherits it unless it sets its own `fill` or `stroke`. That
14
+ * is how lucide draws, so its solid dots (tag, palette) stay solid, and how an
15
+ * icon mixes a stroked outline with a solid mark.
16
+ */
17
+ export declare const iconStyles: import("tailwind-variants").TVReturnType<{
18
+ color: {
19
+ primary: "text-rui-primary";
20
+ secondary: "text-rui-secondary";
21
+ error: "text-rui-error";
22
+ warning: "text-rui-warning";
23
+ info: "text-rui-info";
24
+ success: "text-rui-success";
25
+ };
26
+ }, undefined, "shrink-0 w-(--rui-icon-size,1.5rem) h-(--rui-icon-size,1.5rem) [stroke-width:var(--rui-icon-stroke,1.75)]", {
27
+ color: {
28
+ primary: "text-rui-primary";
29
+ secondary: "text-rui-secondary";
30
+ error: "text-rui-error";
31
+ warning: "text-rui-warning";
32
+ info: "text-rui-info";
33
+ success: "text-rui-success";
34
+ };
35
+ }, undefined, import("tailwind-variants").TVReturnTypeLike<{
36
+ color: {
37
+ primary: "text-rui-primary";
38
+ secondary: "text-rui-secondary";
39
+ error: "text-rui-error";
40
+ warning: "text-rui-warning";
41
+ info: "text-rui-info";
42
+ success: "text-rui-success";
43
+ };
44
+ }, undefined>>;
@@ -0,0 +1,33 @@
1
+ import { tv } from "../../utils/tv.js";
2
+ //#region src/components/icons/icon-styles.ts
3
+ /**
4
+ * The icon's box is always driven by `--rui-icon-size`, so flex shrinking is
5
+ * never wanted: `shrink-0` keeps the size beside a long grow sibling,
6
+ * such as a `w-full` button label in `variant="list"`. Without it the svg is
7
+ * compressed along the main axis while its height stays put, drawing a sliver
8
+ * of a glyph.
9
+ *
10
+ * The stroke is set on the svg as CSS, so `--rui-icon-stroke` can retune it.
11
+ * Lucide's 2 reads heavy beside Inter; 1.5 would draw a 16px glyph at a
12
+ * single, blurry pixel.
13
+ *
14
+ * The svg also carries the default paint, outlined in `currentColor`, and
15
+ * every primitive inherits it unless it sets its own `fill` or `stroke`. That
16
+ * is how lucide draws, so its solid dots (tag, palette) stay solid, and how an
17
+ * icon mixes a stroked outline with a solid mark.
18
+ */
19
+ var iconStyles = tv({
20
+ base: "shrink-0 w-(--rui-icon-size,1.5rem) h-(--rui-icon-size,1.5rem) [stroke-width:var(--rui-icon-stroke,1.75)]",
21
+ variants: { color: {
22
+ primary: "text-rui-primary",
23
+ secondary: "text-rui-secondary",
24
+ error: "text-rui-error",
25
+ warning: "text-rui-warning",
26
+ info: "text-rui-info",
27
+ success: "text-rui-success"
28
+ } }
29
+ });
30
+ //#endregion
31
+ export { iconStyles };
32
+
33
+ //# sourceMappingURL=icon-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-styles.js","names":[],"sources":["../../../src/components/icons/icon-styles.ts"],"sourcesContent":["import { tv } from '@/utils/tv';\n\n/**\n * The icon's box is always driven by `--rui-icon-size`, so flex shrinking is\n * never wanted: `shrink-0` keeps the size beside a long grow sibling,\n * such as a `w-full` button label in `variant=\"list\"`. Without it the svg is\n * compressed along the main axis while its height stays put, drawing a sliver\n * of a glyph.\n *\n * The stroke is set on the svg as CSS, so `--rui-icon-stroke` can retune it.\n * Lucide's 2 reads heavy beside Inter; 1.5 would draw a 16px glyph at a\n * single, blurry pixel.\n *\n * The svg also carries the default paint, outlined in `currentColor`, and\n * every primitive inherits it unless it sets its own `fill` or `stroke`. That\n * is how lucide draws, so its solid dots (tag, palette) stay solid, and how an\n * icon mixes a stroked outline with a solid mark.\n */\nexport const iconStyles = tv({\n base: 'shrink-0 w-(--rui-icon-size,1.5rem) h-(--rui-icon-size,1.5rem) [stroke-width:var(--rui-icon-stroke,1.75)]',\n variants: {\n color: {\n primary: 'text-rui-primary',\n secondary: 'text-rui-secondary',\n error: 'text-rui-error',\n warning: 'text-rui-warning',\n info: 'text-rui-info',\n success: 'text-rui-success',\n },\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAa,aAAa,GAAG;CAC3B,MAAM;CACN,UAAU,EACR,OAAO;EACL,SAAS;EACT,WAAW;EACX,OAAO;EACP,SAAS;EACT,MAAM;EACN,SAAS;CACX,EACF;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RuiSkeletonBase.js","names":["_sfc_main"],"sources":["../../../src/components/loaders/RuiSkeletonBase.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { tv } from '@/utils/tv';\n\nexport interface Props {\n rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full';\n}\n\ndefineOptions({\n name: 'RuiSkeletonLoaderBase',\n});\n\nconst { rounded } = defineProps<Props>();\n\nconst skeleton = tv({\n // zinc steps rather than translucent black and white, which in dark came out lighter than any surface\n base: 'animate-pulse bg-rui-neutral-200 dark:bg-rui-neutral-800',\n variants: {\n rounded: {\n none: 'rounded-none',\n sm: 'rounded-xs',\n md: 'rounded-rui-control',\n lg: 'rounded-rui-card',\n full: 'rounded-full',\n },\n },\n});\n\n// the bar is decoration only, so it is aria-hidden: an alert role made a screen reader announce every bar\nconst ui = computed<string>(() => skeleton({ rounded }));\n</script>\n\n<template>\n <div\n :class=\"ui\"\n data-id=\"skeleton\"\n aria-hidden=\"true\"\n />\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"RuiSkeletonBase.js","names":["_sfc_main"],"sources":["../../../src/components/loaders/RuiSkeletonBase.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { skeletonBaseStyles } from './skeleton-base-styles';\n\nexport interface Props {\n rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full';\n}\n\ndefineOptions({\n name: 'RuiSkeletonLoaderBase',\n});\n\nconst { rounded } = defineProps<Props>();\n\n// the bar is decoration only, so it is aria-hidden: an alert role made a screen reader announce every bar\nconst ui = computed<string>(() => skeletonBaseStyles({ rounded }));\n</script>\n\n<template>\n <div\n :class=\"ui\"\n data-id=\"skeleton\"\n aria-hidden=\"true\"\n />\n</template>\n"],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { tv } from "../../utils/tv.js";
1
+ import { skeletonBaseStyles } from "./skeleton-base-styles.js";
2
2
  import { computed, createElementBlock, defineComponent, normalizeClass, openBlock, unref } from "vue";
3
3
  //#region src/components/loaders/RuiSkeletonBase.vue?vue&type=script&setup=true&lang.ts
4
4
  var RuiSkeletonBase_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
@@ -6,17 +6,7 @@ var RuiSkeletonBase_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
6
6
  __name: "RuiSkeletonBase",
7
7
  props: { rounded: {} },
8
8
  setup(__props) {
9
- const skeleton = tv({
10
- base: "animate-pulse bg-rui-neutral-200 dark:bg-rui-neutral-800",
11
- variants: { rounded: {
12
- none: "rounded-none",
13
- sm: "rounded-xs",
14
- md: "rounded-rui-control",
15
- lg: "rounded-rui-card",
16
- full: "rounded-full"
17
- } }
18
- });
19
- const ui = computed(() => skeleton({ rounded: __props.rounded }));
9
+ const ui = computed(() => skeletonBaseStyles({ rounded: __props.rounded }));
20
10
  return (_ctx, _cache) => {
21
11
  return openBlock(), createElementBlock("div", {
22
12
  class: normalizeClass(unref(ui)),
@@ -1 +1 @@
1
- {"version":3,"file":"RuiSkeletonBase.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref"],"sources":["../../../src/components/loaders/RuiSkeletonBase.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { tv } from '@/utils/tv';\n\nexport interface Props {\n rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full';\n}\n\ndefineOptions({\n name: 'RuiSkeletonLoaderBase',\n});\n\nconst { rounded } = defineProps<Props>();\n\nconst skeleton = tv({\n // zinc steps rather than translucent black and white, which in dark came out lighter than any surface\n base: 'animate-pulse bg-rui-neutral-200 dark:bg-rui-neutral-800',\n variants: {\n rounded: {\n none: 'rounded-none',\n sm: 'rounded-xs',\n md: 'rounded-rui-control',\n lg: 'rounded-rui-card',\n full: 'rounded-full',\n },\n },\n});\n\n// the bar is decoration only, so it is aria-hidden: an alert role made a screen reader announce every bar\nconst ui = computed<string>(() => skeleton({ rounded }));\n</script>\n\n<template>\n <div\n :class=\"ui\"\n data-id=\"skeleton\"\n aria-hidden=\"true\"\n />\n</template>\n"],"mappings":";;;;;;;;EAaA,MAAM,WAAW,GAAG;GAElB,MAAM;GACN,UAAU,EACR,SAAS;IACP,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,MAAM;GACR,EACF;EACF,CAAC;EAGD,MAAM,KAAK,eAAuB,SAAS,EAAE,SAAM,QAAA,QAAE,CAAC,CAAC;;GAIrD,OAAAA,UAAA,GAAAC,mBAIE,OAAA;IAHC,OAAKC,eAAEC,MAAA,EAAA,CAAE;IACV,WAAQ;IACR,eAAY"}
1
+ {"version":3,"file":"RuiSkeletonBase.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref"],"sources":["../../../src/components/loaders/RuiSkeletonBase.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { skeletonBaseStyles } from './skeleton-base-styles';\n\nexport interface Props {\n rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full';\n}\n\ndefineOptions({\n name: 'RuiSkeletonLoaderBase',\n});\n\nconst { rounded } = defineProps<Props>();\n\n// the bar is decoration only, so it is aria-hidden: an alert role made a screen reader announce every bar\nconst ui = computed<string>(() => skeletonBaseStyles({ rounded }));\n</script>\n\n<template>\n <div\n :class=\"ui\"\n data-id=\"skeleton\"\n aria-hidden=\"true\"\n />\n</template>\n"],"mappings":";;;;;;;;EAcA,MAAM,KAAK,eAAuB,mBAAmB,EAAE,SAAM,QAAA,QAAE,CAAC,CAAC;;GAI/D,OAAAA,UAAA,GAAAC,mBAIE,OAAA;IAHC,OAAKC,eAAEC,MAAA,EAAA,CAAE;IACV,WAAQ;IACR,eAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"RuiSkeletonLoader.js","names":["_sfc_main"],"sources":["../../../src/components/loaders/RuiSkeletonLoader.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport RuiSkeletonBase, {\n type Props as SkeletonBaseProps,\n} from '@/components/loaders/RuiSkeletonBase.vue';\nimport { SkeletonType } from '@/components/loaders/skeleton-type';\nimport { cn, tv } from '@/utils/tv';\n\nexport interface Props extends SkeletonBaseProps {\n type?: SkeletonType;\n}\n\ndefineOptions({\n name: 'RuiSkeletonLoader',\n inheritAttrs: false,\n});\n\nconst { type = SkeletonType.TEXT, rounded } = defineProps<Props>();\n\nconst multiLineTypes: SkeletonType[] = [SkeletonType.PARAGRAPH, SkeletonType.ARTICLE];\n\nconst skeletonType = tv({\n variants: {\n type: {\n [SkeletonType.CUSTOM]: 'box-border',\n [SkeletonType.TEXT]: 'w-full h-4 rounded-rui-control',\n [SkeletonType.HEADING]: 'w-full h-6 rounded-rui-control',\n [SkeletonType.BUTTON]: 'w-full max-w-24 h-9 rounded-rui-control',\n [SkeletonType.ICON]: 'w-6 h-6 rounded-full',\n [SkeletonType.AVATAR]: 'w-10 h-10 rounded-full',\n [SkeletonType.THUMBNAIL]: 'w-14 h-14 rounded-xs',\n [SkeletonType.PARAGRAPH]: 'flex flex-col gap-2',\n [SkeletonType.ARTICLE]: 'flex flex-col gap-2',\n },\n },\n});\n\nconst attrs = useAttrs();\nconst ui = computed<string>(() => skeletonType({ type, class: cn(attrs.class) }));\nconst isMultiLine = computed<boolean>(() => multiLineTypes.includes(type));\n</script>\n\n<template>\n <RuiSkeletonBase\n v-if=\"!isMultiLine\"\n :class=\"ui\"\n :rounded=\"rounded\"\n v-bind=\"{ ...attrs, class: undefined }\"\n />\n <div\n v-else\n :class=\"ui\"\n v-bind=\"{ ...attrs, class: undefined }\"\n >\n <RuiSkeletonBase\n v-if=\"type === SkeletonType.ARTICLE\"\n class=\"w-full h-6 rounded-rui-control mb-1\"\n :rounded=\"rounded\"\n />\n <RuiSkeletonBase\n class=\"w-full h-3 rounded-rui-control\"\n :rounded=\"rounded\"\n />\n <RuiSkeletonBase\n class=\"w-full h-3 rounded-rui-control max-w-[80%]\"\n :rounded=\"rounded\"\n />\n <RuiSkeletonBase\n class=\"w-full h-3 rounded-rui-control max-w-[90%]\"\n :rounded=\"rounded\"\n />\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"RuiSkeletonLoader.js","names":["_sfc_main"],"sources":["../../../src/components/loaders/RuiSkeletonLoader.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport RuiSkeletonBase, {\n type Props as SkeletonBaseProps,\n} from '@/components/loaders/RuiSkeletonBase.vue';\nimport { SkeletonType } from '@/components/loaders/skeleton-type';\nimport { cn } from '@/utils/tv';\nimport { skeletonLoaderStyles } from './skeleton-loader-styles';\n\nexport interface Props extends SkeletonBaseProps {\n type?: SkeletonType;\n}\n\ndefineOptions({\n name: 'RuiSkeletonLoader',\n inheritAttrs: false,\n});\n\nconst { type = SkeletonType.TEXT, rounded } = defineProps<Props>();\n\nconst multiLineTypes: SkeletonType[] = [SkeletonType.PARAGRAPH, SkeletonType.ARTICLE];\n\nconst attrs = useAttrs();\nconst ui = computed<string>(() => skeletonLoaderStyles({ type, class: cn(attrs.class) }));\nconst isMultiLine = computed<boolean>(() => multiLineTypes.includes(type));\n</script>\n\n<template>\n <RuiSkeletonBase\n v-if=\"!isMultiLine\"\n :class=\"ui\"\n :rounded=\"rounded\"\n v-bind=\"{ ...attrs, class: undefined }\"\n />\n <div\n v-else\n :class=\"ui\"\n v-bind=\"{ ...attrs, class: undefined }\"\n >\n <RuiSkeletonBase\n v-if=\"type === SkeletonType.ARTICLE\"\n class=\"w-full h-6 rounded-rui-control mb-1\"\n :rounded=\"rounded\"\n />\n <RuiSkeletonBase\n class=\"w-full h-3 rounded-rui-control\"\n :rounded=\"rounded\"\n />\n <RuiSkeletonBase\n class=\"w-full h-3 rounded-rui-control max-w-[80%]\"\n :rounded=\"rounded\"\n />\n <RuiSkeletonBase\n class=\"w-full h-3 rounded-rui-control max-w-[90%]\"\n :rounded=\"rounded\"\n />\n </div>\n</template>\n"],"mappings":""}
@@ -1,6 +1,7 @@
1
- import { cn, tv } from "../../utils/tv.js";
1
+ import { cn } from "../../utils/tv.js";
2
2
  import RuiSkeletonBase_default from "./RuiSkeletonBase.js";
3
3
  import { SkeletonType } from "./skeleton-type.js";
4
+ import { skeletonLoaderStyles } from "./skeleton-loader-styles.js";
4
5
  import { computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, mergeProps, openBlock, unref, useAttrs } from "vue";
5
6
  //#region src/components/loaders/RuiSkeletonLoader.vue?vue&type=script&setup=true&lang.ts
6
7
  var RuiSkeletonLoader_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
@@ -13,19 +14,8 @@ var RuiSkeletonLoader_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
13
14
  },
14
15
  setup(__props) {
15
16
  const multiLineTypes = [SkeletonType.PARAGRAPH, SkeletonType.ARTICLE];
16
- const skeletonType = tv({ variants: { type: {
17
- [SkeletonType.CUSTOM]: "box-border",
18
- [SkeletonType.TEXT]: "w-full h-4 rounded-rui-control",
19
- [SkeletonType.HEADING]: "w-full h-6 rounded-rui-control",
20
- [SkeletonType.BUTTON]: "w-full max-w-24 h-9 rounded-rui-control",
21
- [SkeletonType.ICON]: "w-6 h-6 rounded-full",
22
- [SkeletonType.AVATAR]: "w-10 h-10 rounded-full",
23
- [SkeletonType.THUMBNAIL]: "w-14 h-14 rounded-xs",
24
- [SkeletonType.PARAGRAPH]: "flex flex-col gap-2",
25
- [SkeletonType.ARTICLE]: "flex flex-col gap-2"
26
- } } });
27
17
  const attrs = useAttrs();
28
- const ui = computed(() => skeletonType({
18
+ const ui = computed(() => skeletonLoaderStyles({
29
19
  type: __props.type,
30
20
  class: cn(attrs.class)
31
21
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"RuiSkeletonLoader.vue_vue_type_script_setup_true_lang.js","names":["_unref","_openBlock","_createBlock","RuiSkeletonBase","_mergeProps","_createElementBlock","_createCommentVNode","_createVNode"],"sources":["../../../src/components/loaders/RuiSkeletonLoader.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport RuiSkeletonBase, {\n type Props as SkeletonBaseProps,\n} from '@/components/loaders/RuiSkeletonBase.vue';\nimport { SkeletonType } from '@/components/loaders/skeleton-type';\nimport { cn, tv } from '@/utils/tv';\n\nexport interface Props extends SkeletonBaseProps {\n type?: SkeletonType;\n}\n\ndefineOptions({\n name: 'RuiSkeletonLoader',\n inheritAttrs: false,\n});\n\nconst { type = SkeletonType.TEXT, rounded } = defineProps<Props>();\n\nconst multiLineTypes: SkeletonType[] = [SkeletonType.PARAGRAPH, SkeletonType.ARTICLE];\n\nconst skeletonType = tv({\n variants: {\n type: {\n [SkeletonType.CUSTOM]: 'box-border',\n [SkeletonType.TEXT]: 'w-full h-4 rounded-rui-control',\n [SkeletonType.HEADING]: 'w-full h-6 rounded-rui-control',\n [SkeletonType.BUTTON]: 'w-full max-w-24 h-9 rounded-rui-control',\n [SkeletonType.ICON]: 'w-6 h-6 rounded-full',\n [SkeletonType.AVATAR]: 'w-10 h-10 rounded-full',\n [SkeletonType.THUMBNAIL]: 'w-14 h-14 rounded-xs',\n [SkeletonType.PARAGRAPH]: 'flex flex-col gap-2',\n [SkeletonType.ARTICLE]: 'flex flex-col gap-2',\n },\n },\n});\n\nconst attrs = useAttrs();\nconst ui = computed<string>(() => skeletonType({ type, class: cn(attrs.class) }));\nconst isMultiLine = computed<boolean>(() => multiLineTypes.includes(type));\n</script>\n\n<template>\n <RuiSkeletonBase\n v-if=\"!isMultiLine\"\n :class=\"ui\"\n :rounded=\"rounded\"\n v-bind=\"{ ...attrs, class: undefined }\"\n />\n <div\n v-else\n :class=\"ui\"\n v-bind=\"{ ...attrs, class: undefined }\"\n >\n <RuiSkeletonBase\n v-if=\"type === SkeletonType.ARTICLE\"\n class=\"w-full h-6 rounded-rui-control mb-1\"\n :rounded=\"rounded\"\n />\n <RuiSkeletonBase\n class=\"w-full h-3 rounded-rui-control\"\n :rounded=\"rounded\"\n />\n <RuiSkeletonBase\n class=\"w-full h-3 rounded-rui-control max-w-[80%]\"\n :rounded=\"rounded\"\n />\n <RuiSkeletonBase\n class=\"w-full h-3 rounded-rui-control max-w-[90%]\"\n :rounded=\"rounded\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;EAkBA,MAAM,iBAAiC,CAAC,aAAa,WAAW,aAAa,OAAO;EAEpF,MAAM,eAAe,GAAG,EACtB,UAAU,EACR,MAAM;IACH,aAAa,SAAS;IACtB,aAAa,OAAO;IACpB,aAAa,UAAU;IACvB,aAAa,SAAS;IACtB,aAAa,OAAO;IACpB,aAAa,SAAS;IACtB,aAAa,YAAY;IACzB,aAAa,YAAY;IACzB,aAAa,UAAU;EAC1B,EACF,EACF,CAAC;EAED,MAAM,QAAQ,SAAS;EACvB,MAAM,KAAK,eAAuB,aAAa;GAAE,MAAG,QAAA;GAAG,OAAO,GAAG,MAAM,KAAK;EAAE,CAAC,CAAC;EAChF,MAAM,cAAc,eAAwB,eAAe,SAAS,QAAA,IAAI,CAAC;;GAK9D,OAAA,CAAAA,MAAA,WAAA,KADTC,UAAA,GAAAC,YAKEC,yBALFC,WAKE;;IAHC,OAAOJ,MAAA,EAAA;IACP,SAAS,QAAA;GACG,GAAA;IAAA,GAAAA,MAAA,KAAA;IAAK,OAAS,KAAA;GAAS,CAAA,GAAA,MAAA,IAAA,CAAA,SAAA,SAAA,CAAA,MAEtCC,UAAA,GAAAI,mBAsBM,OAtBND,WAsBM;;IApBH,OAAOJ,MAAA,EAAA;GACK,GAAA;IAAA,GAAAA,MAAA,KAAA;IAAK,OAAS,KAAA;GAAS,CAAA,GAAA;IAG5B,QAAA,SAASA,MAAA,YAAA,CAAY,CAAC,WAD9BC,UAAA,GAAAC,YAIEC,yBAAA;;KAFA,OAAM;KACL,SAAS,QAAA;;IAEZI,YAGEJ,yBAAA;KAFA,OAAM;KACL,SAAS,QAAA;;IAEZI,YAGEJ,yBAAA;KAFA,OAAM;KACL,SAAS,QAAA;;IAEZI,YAGEJ,yBAAA;KAFA,OAAM;KACL,SAAS,QAAA"}
1
+ {"version":3,"file":"RuiSkeletonLoader.vue_vue_type_script_setup_true_lang.js","names":["_unref","_openBlock","_createBlock","RuiSkeletonBase","_mergeProps","_createElementBlock","_createCommentVNode","_createVNode"],"sources":["../../../src/components/loaders/RuiSkeletonLoader.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport RuiSkeletonBase, {\n type Props as SkeletonBaseProps,\n} from '@/components/loaders/RuiSkeletonBase.vue';\nimport { SkeletonType } from '@/components/loaders/skeleton-type';\nimport { cn } from '@/utils/tv';\nimport { skeletonLoaderStyles } from './skeleton-loader-styles';\n\nexport interface Props extends SkeletonBaseProps {\n type?: SkeletonType;\n}\n\ndefineOptions({\n name: 'RuiSkeletonLoader',\n inheritAttrs: false,\n});\n\nconst { type = SkeletonType.TEXT, rounded } = defineProps<Props>();\n\nconst multiLineTypes: SkeletonType[] = [SkeletonType.PARAGRAPH, SkeletonType.ARTICLE];\n\nconst attrs = useAttrs();\nconst ui = computed<string>(() => skeletonLoaderStyles({ type, class: cn(attrs.class) }));\nconst isMultiLine = computed<boolean>(() => multiLineTypes.includes(type));\n</script>\n\n<template>\n <RuiSkeletonBase\n v-if=\"!isMultiLine\"\n :class=\"ui\"\n :rounded=\"rounded\"\n v-bind=\"{ ...attrs, class: undefined }\"\n />\n <div\n v-else\n :class=\"ui\"\n v-bind=\"{ ...attrs, class: undefined }\"\n >\n <RuiSkeletonBase\n v-if=\"type === SkeletonType.ARTICLE\"\n class=\"w-full h-6 rounded-rui-control mb-1\"\n :rounded=\"rounded\"\n />\n <RuiSkeletonBase\n class=\"w-full h-3 rounded-rui-control\"\n :rounded=\"rounded\"\n />\n <RuiSkeletonBase\n class=\"w-full h-3 rounded-rui-control max-w-[80%]\"\n :rounded=\"rounded\"\n />\n <RuiSkeletonBase\n class=\"w-full h-3 rounded-rui-control max-w-[90%]\"\n :rounded=\"rounded\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;EAmBA,MAAM,iBAAiC,CAAC,aAAa,WAAW,aAAa,OAAO;EAEpF,MAAM,QAAQ,SAAS;EACvB,MAAM,KAAK,eAAuB,qBAAqB;GAAE,MAAG,QAAA;GAAG,OAAO,GAAG,MAAM,KAAK;EAAE,CAAC,CAAC;EACxF,MAAM,cAAc,eAAwB,eAAe,SAAS,QAAA,IAAI,CAAC;;GAK9D,OAAA,CAAAA,MAAA,WAAA,KADTC,UAAA,GAAAC,YAKEC,yBALFC,WAKE;;IAHC,OAAOJ,MAAA,EAAA;IACP,SAAS,QAAA;GACG,GAAA;IAAA,GAAAA,MAAA,KAAA;IAAK,OAAS,KAAA;GAAS,CAAA,GAAA,MAAA,IAAA,CAAA,SAAA,SAAA,CAAA,MAEtCC,UAAA,GAAAI,mBAsBM,OAtBND,WAsBM;;IApBH,OAAOJ,MAAA,EAAA;GACK,GAAA;IAAA,GAAAA,MAAA,KAAA;IAAK,OAAS,KAAA;GAAS,CAAA,GAAA;IAG5B,QAAA,SAASA,MAAA,YAAA,CAAY,CAAC,WAD9BC,UAAA,GAAAC,YAIEC,yBAAA;;KAFA,OAAM;KACL,SAAS,QAAA;;IAEZI,YAGEJ,yBAAA;KAFA,OAAM;KACL,SAAS,QAAA;;IAEZI,YAGEJ,yBAAA;KAFA,OAAM;KACL,SAAS,QAAA;;IAEZI,YAGEJ,yBAAA;KAFA,OAAM;KACL,SAAS,QAAA"}
@@ -0,0 +1,25 @@
1
+ export declare const skeletonBaseStyles: import("tailwind-variants").TVReturnType<{
2
+ rounded: {
3
+ none: "rounded-none";
4
+ sm: "rounded-xs";
5
+ md: "rounded-rui-control";
6
+ lg: "rounded-rui-card";
7
+ full: "rounded-full";
8
+ };
9
+ }, undefined, "animate-pulse bg-rui-neutral-200 dark:bg-rui-neutral-800", {
10
+ rounded: {
11
+ none: "rounded-none";
12
+ sm: "rounded-xs";
13
+ md: "rounded-rui-control";
14
+ lg: "rounded-rui-card";
15
+ full: "rounded-full";
16
+ };
17
+ }, undefined, import("tailwind-variants").TVReturnTypeLike<{
18
+ rounded: {
19
+ none: "rounded-none";
20
+ sm: "rounded-xs";
21
+ md: "rounded-rui-control";
22
+ lg: "rounded-rui-card";
23
+ full: "rounded-full";
24
+ };
25
+ }, undefined>>;
@@ -0,0 +1,16 @@
1
+ import { tv } from "../../utils/tv.js";
2
+ //#region src/components/loaders/skeleton-base-styles.ts
3
+ var skeletonBaseStyles = tv({
4
+ base: "animate-pulse bg-rui-neutral-200 dark:bg-rui-neutral-800",
5
+ variants: { rounded: {
6
+ none: "rounded-none",
7
+ sm: "rounded-xs",
8
+ md: "rounded-rui-control",
9
+ lg: "rounded-rui-card",
10
+ full: "rounded-full"
11
+ } }
12
+ });
13
+ //#endregion
14
+ export { skeletonBaseStyles };
15
+
16
+ //# sourceMappingURL=skeleton-base-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skeleton-base-styles.js","names":[],"sources":["../../../src/components/loaders/skeleton-base-styles.ts"],"sourcesContent":["import { tv } from '@/utils/tv';\n\nexport const skeletonBaseStyles = tv({\n // zinc steps rather than translucent black and white, which in dark came out lighter than any surface\n base: 'animate-pulse bg-rui-neutral-200 dark:bg-rui-neutral-800',\n variants: {\n rounded: {\n none: 'rounded-none',\n sm: 'rounded-xs',\n md: 'rounded-rui-control',\n lg: 'rounded-rui-card',\n full: 'rounded-full',\n },\n },\n});\n"],"mappings":";;AAEA,IAAa,qBAAqB,GAAG;CAEnC,MAAM;CACN,UAAU,EACR,SAAS;EACP,MAAM;EACN,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,MAAM;CACR,EACF;AACF,CAAC"}
@@ -0,0 +1,37 @@
1
+ export declare const skeletonLoaderStyles: import("tailwind-variants").TVReturnType<{
2
+ type: {
3
+ custom: "box-border";
4
+ text: "w-full h-4 rounded-rui-control";
5
+ heading: "w-full h-6 rounded-rui-control";
6
+ button: "w-full max-w-24 h-9 rounded-rui-control";
7
+ icon: "w-6 h-6 rounded-full";
8
+ avatar: "w-10 h-10 rounded-full";
9
+ thumbnail: "w-14 h-14 rounded-xs";
10
+ paragraph: "flex flex-col gap-2";
11
+ article: "flex flex-col gap-2";
12
+ };
13
+ }, undefined, undefined, {
14
+ type: {
15
+ custom: "box-border";
16
+ text: "w-full h-4 rounded-rui-control";
17
+ heading: "w-full h-6 rounded-rui-control";
18
+ button: "w-full max-w-24 h-9 rounded-rui-control";
19
+ icon: "w-6 h-6 rounded-full";
20
+ avatar: "w-10 h-10 rounded-full";
21
+ thumbnail: "w-14 h-14 rounded-xs";
22
+ paragraph: "flex flex-col gap-2";
23
+ article: "flex flex-col gap-2";
24
+ };
25
+ }, undefined, import("tailwind-variants").TVReturnTypeLike<{
26
+ type: {
27
+ custom: "box-border";
28
+ text: "w-full h-4 rounded-rui-control";
29
+ heading: "w-full h-6 rounded-rui-control";
30
+ button: "w-full max-w-24 h-9 rounded-rui-control";
31
+ icon: "w-6 h-6 rounded-full";
32
+ avatar: "w-10 h-10 rounded-full";
33
+ thumbnail: "w-14 h-14 rounded-xs";
34
+ paragraph: "flex flex-col gap-2";
35
+ article: "flex flex-col gap-2";
36
+ };
37
+ }, undefined>>;
@@ -0,0 +1,18 @@
1
+ import { tv } from "../../utils/tv.js";
2
+ import { SkeletonType } from "./skeleton-type.js";
3
+ //#region src/components/loaders/skeleton-loader-styles.ts
4
+ var skeletonLoaderStyles = tv({ variants: { type: {
5
+ [SkeletonType.CUSTOM]: "box-border",
6
+ [SkeletonType.TEXT]: "w-full h-4 rounded-rui-control",
7
+ [SkeletonType.HEADING]: "w-full h-6 rounded-rui-control",
8
+ [SkeletonType.BUTTON]: "w-full max-w-24 h-9 rounded-rui-control",
9
+ [SkeletonType.ICON]: "w-6 h-6 rounded-full",
10
+ [SkeletonType.AVATAR]: "w-10 h-10 rounded-full",
11
+ [SkeletonType.THUMBNAIL]: "w-14 h-14 rounded-xs",
12
+ [SkeletonType.PARAGRAPH]: "flex flex-col gap-2",
13
+ [SkeletonType.ARTICLE]: "flex flex-col gap-2"
14
+ } } });
15
+ //#endregion
16
+ export { skeletonLoaderStyles };
17
+
18
+ //# sourceMappingURL=skeleton-loader-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skeleton-loader-styles.js","names":[],"sources":["../../../src/components/loaders/skeleton-loader-styles.ts"],"sourcesContent":["import { SkeletonType } from '@/components/loaders/skeleton-type';\nimport { tv } from '@/utils/tv';\n\nexport const skeletonLoaderStyles = tv({\n variants: {\n type: {\n [SkeletonType.CUSTOM]: 'box-border',\n [SkeletonType.TEXT]: 'w-full h-4 rounded-rui-control',\n [SkeletonType.HEADING]: 'w-full h-6 rounded-rui-control',\n [SkeletonType.BUTTON]: 'w-full max-w-24 h-9 rounded-rui-control',\n [SkeletonType.ICON]: 'w-6 h-6 rounded-full',\n [SkeletonType.AVATAR]: 'w-10 h-10 rounded-full',\n [SkeletonType.THUMBNAIL]: 'w-14 h-14 rounded-xs',\n [SkeletonType.PARAGRAPH]: 'flex flex-col gap-2',\n [SkeletonType.ARTICLE]: 'flex flex-col gap-2',\n },\n },\n});\n"],"mappings":";;;AAGA,IAAa,uBAAuB,GAAG,EACrC,UAAU,EACR,MAAM;EACH,aAAa,SAAS;EACtB,aAAa,OAAO;EACpB,aAAa,UAAU;EACvB,aAAa,SAAS;EACtB,aAAa,OAAO;EACpB,aAAa,SAAS;EACtB,aAAa,YAAY;EACzB,aAAa,YAAY;EACzB,aAAa,UAAU;AAC1B,EACF,EACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RuiBadge.js","names":["_sfc_main"],"sources":["../../../../src/components/overlays/badge/RuiBadge.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { BadgePlacement, BadgeRounded, BadgeSize } from '@/components/overlays/badge/badge-props';\nimport { tv } from '@/utils/tv';\n\ntype PosConfig = [left: number, right: string, edge: string, center: number];\n\nexport interface Props {\n text?: string | null;\n icon?: RuiIcons | null;\n modelValue?: boolean;\n dot?: boolean;\n left?: boolean;\n offsetX?: string | number;\n offsetY?: string | number;\n placement?: BadgePlacement;\n size?: BadgeSize;\n rounded?: BadgeRounded;\n color?: 'default' | ContextColorsType;\n}\n\ndefineOptions({\n name: 'RuiBadge',\n});\n\nconst {\n text = null,\n icon = null,\n modelValue = true,\n dot = false,\n placement = BadgePlacement.top,\n left = false,\n size = BadgeSize.md,\n rounded = BadgeRounded.full,\n color = 'primary',\n offsetX = 0,\n offsetY = 0,\n} = defineProps<Props>();\n\nconst slots = defineSlots<{\n default?: () => any;\n badge?: () => any;\n icon?: () => any;\n}>();\n\nconst badgeStyles = tv({\n slots: {\n wrapper: 'relative inline-block',\n badge: 'flex items-center justify-center text-xs font-medium tabular-nums absolute bg-transparent text-rui-text',\n content: 'flex items-center gap-1 px-1.5',\n },\n variants: {\n // `-fill` is `main` in light and, for a status color, the deep `darker` in dark, where `main` is a text tone\n color: {\n default: { badge: 'bg-rui-neutral-200 dark:bg-rui-neutral-700' },\n primary: { badge: 'bg-rui-primary-fill text-rui-primary-foreground' },\n secondary: { badge: 'bg-rui-secondary-fill text-rui-secondary-foreground' },\n error: { badge: 'bg-rui-error-fill text-rui-error-foreground' },\n warning: { badge: 'bg-rui-warning-fill text-rui-warning-foreground' },\n info: { badge: 'bg-rui-info-fill text-rui-info-foreground' },\n success: { badge: 'bg-rui-success-fill text-rui-success-foreground' },\n },\n // the icon is 60% of the badge height, as the text is, rather than filling it\n size: {\n sm: { badge: 'min-h-4 min-w-4 text-caption-2 [--rui-icon-size:0.625rem]' },\n md: { badge: 'min-h-5 min-w-5 [--rui-icon-size:0.75rem]' },\n lg: { badge: 'min-h-6 min-w-6 [--rui-icon-size:0.875rem]' },\n },\n rounded: {\n sm: { badge: 'rounded-xs' },\n md: { badge: 'rounded-rui-control' },\n lg: { badge: 'rounded-rui-card' },\n full: { badge: 'rounded-full' },\n },\n // A surface ring keeps a dot apart from whatever it overlaps, such as an avatar edge\n dot: {\n true: { badge: 'ring-2 ring-rui-surface' },\n },\n // an icon alone needs no side padding, so the badge stays as wide as it is tall\n iconOnly: {\n true: { content: 'px-0' },\n false: {},\n },\n },\n compoundVariants: [\n // the default dot is a step lighter in dark, where neutral-500 nearly vanished against a dark control\n { dot: true, color: 'default', class: { badge: 'bg-rui-neutral-500 dark:bg-rui-neutral-400' } },\n // A dot carries no text, so it keeps the brighter `main`, which reads better as a small mark on a dark page\n { dot: true, color: 'error', class: { badge: 'dark:bg-rui-error' } },\n { dot: true, color: 'warning', class: { badge: 'dark:bg-rui-warning' } },\n { dot: true, color: 'info', class: { badge: 'dark:bg-rui-info' } },\n { dot: true, color: 'success', class: { badge: 'dark:bg-rui-success' } },\n\n // Dot sizes: 8, 10 and 12px, since half of a dot sits off the corner and reads smaller than it is\n { dot: true, size: 'sm', class: { badge: 'min-w-2 min-h-2' } },\n { dot: true, size: 'md', class: { badge: 'min-w-2.5 min-h-2.5' } },\n { dot: true, size: 'lg', class: { badge: 'min-w-3 min-h-3' } },\n ],\n defaultVariants: {\n color: 'primary',\n size: 'md',\n rounded: 'full',\n dot: false,\n },\n});\n\nconst hasText = computed<boolean>(() => !!text || !!slots.badge);\n\nconst hasIconAndText = computed<boolean>(() => (!!icon || !!slots.icon) && get(hasText));\n\nconst ui = computed<ReturnType<typeof badgeStyles>>(() => badgeStyles({\n color,\n size,\n rounded,\n dot,\n iconOnly: (!!icon || !!slots.icon) && !get(hasText),\n}));\n\n/** Dot positions as [leftOffset, rightBase, edgeBase, centerOffset]; a dot's center sits on the corner, so each size moves by half its diameter. */\nconst DOT_POS: Record<BadgeSize, PosConfig> = {\n sm: [-0.25, '100% - 0.25rem', '100% - 0.25rem', 0.25],\n md: [-0.3125, '100% - 0.3125rem', '100% - 0.3125rem', 0.3125],\n lg: [-0.375, '100% - 0.375rem', '100% - 0.375rem', 0.375],\n};\nconst BADGE_POS: Record<BadgeSize, PosConfig> = {\n sm: [-0.85, '100% - 0.375rem', '100% - 0.375rem', 0.55],\n md: [-0.95, '100% - 0.5rem', '100% - 0.5rem', 0.65],\n lg: [-1.05, '100% - 0.5rem', '100% - 0.5rem', 0.75],\n};\n\nconst positionStyle = computed<Record<string, string>>(() => {\n const ox = Number(offsetX) * 0.0625;\n const oy = Number(offsetY) * 0.0625;\n const [l, r, edge, center] = dot ? DOT_POS[size] : BADGE_POS[size];\n\n const horizontal = `calc(${left ? `${l}rem` : r} + ${ox}rem)`;\n const vertical = placement === 'center'\n ? `calc(50% - ${center}rem - ${oy}rem)`\n : `calc(${edge} - ${oy}rem)`;\n\n return {\n left: horizontal,\n [placement === 'top' ? 'bottom' : 'top']: vertical,\n };\n});\n</script>\n\n<template>\n <div :class=\"ui.wrapper()\">\n <slot />\n <!-- under reduced motion the badge appears and leaves at full size, with no scale -->\n <Transition\n appear\n enter-active-class=\"transition-[scale] ease-out duration-200 motion-reduce:transition-none\"\n enter-from-class=\"scale-0 motion-reduce:scale-100\"\n enter-to-class=\"scale-100\"\n leave-active-class=\"transition-[scale] ease-in duration-150 motion-reduce:transition-none\"\n leave-from-class=\"scale-100\"\n leave-to-class=\"scale-0 motion-reduce:scale-100\"\n >\n <div\n v-if=\"modelValue\"\n :class=\"ui.badge()\"\n :style=\"positionStyle\"\n :data-placement=\"placement\"\n :data-dot=\"dot || undefined\"\n :data-left=\"left || undefined\"\n aria-atomic=\"true\"\n aria-live=\"polite\"\n role=\"status\"\n >\n <!-- no aria-label: on a live region it replaced the count, so a reader announced \"Badge\" -->\n <span\n v-if=\"!dot\"\n :class=\"ui.content({ class: hasIconAndText ? 'px-2' : undefined })\"\n >\n <slot name=\"badge\">\n {{ text }}\n </slot>\n <slot name=\"icon\">\n <RuiIcon\n v-if=\"icon\"\n :name=\"icon\"\n />\n </slot>\n </span>\n </div>\n </Transition>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"RuiBadge.js","names":["_sfc_main"],"sources":["../../../../src/components/overlays/badge/RuiBadge.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { BadgePlacement, BadgeRounded, BadgeSize } from '@/components/overlays/badge/badge-props';\nimport { badgeStyles } from './badge-styles';\n\ntype PosConfig = [left: number, right: string, edge: string, center: number];\n\nexport interface Props {\n text?: string | null;\n icon?: RuiIcons | null;\n modelValue?: boolean;\n dot?: boolean;\n left?: boolean;\n offsetX?: string | number;\n offsetY?: string | number;\n placement?: BadgePlacement;\n size?: BadgeSize;\n rounded?: BadgeRounded;\n color?: 'default' | ContextColorsType;\n}\n\ndefineOptions({\n name: 'RuiBadge',\n});\n\nconst {\n text = null,\n icon = null,\n modelValue = true,\n dot = false,\n placement = BadgePlacement.top,\n left = false,\n size = BadgeSize.md,\n rounded = BadgeRounded.full,\n color = 'primary',\n offsetX = 0,\n offsetY = 0,\n} = defineProps<Props>();\n\nconst slots = defineSlots<{\n default?: () => any;\n badge?: () => any;\n icon?: () => any;\n}>();\n\nconst hasText = computed<boolean>(() => !!text || !!slots.badge);\n\nconst hasIconAndText = computed<boolean>(() => (!!icon || !!slots.icon) && get(hasText));\n\nconst ui = computed<ReturnType<typeof badgeStyles>>(() => badgeStyles({\n color,\n size,\n rounded,\n dot,\n iconOnly: (!!icon || !!slots.icon) && !get(hasText),\n}));\n\n/** Dot positions as [leftOffset, rightBase, edgeBase, centerOffset]; a dot's center sits on the corner, so each size moves by half its diameter. */\nconst DOT_POS: Record<BadgeSize, PosConfig> = {\n sm: [-0.25, '100% - 0.25rem', '100% - 0.25rem', 0.25],\n md: [-0.3125, '100% - 0.3125rem', '100% - 0.3125rem', 0.3125],\n lg: [-0.375, '100% - 0.375rem', '100% - 0.375rem', 0.375],\n};\nconst BADGE_POS: Record<BadgeSize, PosConfig> = {\n sm: [-0.85, '100% - 0.375rem', '100% - 0.375rem', 0.55],\n md: [-0.95, '100% - 0.5rem', '100% - 0.5rem', 0.65],\n lg: [-1.05, '100% - 0.5rem', '100% - 0.5rem', 0.75],\n};\n\nconst positionStyle = computed<Record<string, string>>(() => {\n const ox = Number(offsetX) * 0.0625;\n const oy = Number(offsetY) * 0.0625;\n const [l, r, edge, center] = dot ? DOT_POS[size] : BADGE_POS[size];\n\n const horizontal = `calc(${left ? `${l}rem` : r} + ${ox}rem)`;\n const vertical = placement === 'center'\n ? `calc(50% - ${center}rem - ${oy}rem)`\n : `calc(${edge} - ${oy}rem)`;\n\n return {\n left: horizontal,\n [placement === 'top' ? 'bottom' : 'top']: vertical,\n };\n});\n</script>\n\n<template>\n <div :class=\"ui.wrapper()\">\n <slot />\n <!-- under reduced motion the badge appears and leaves at full size, with no scale -->\n <Transition\n appear\n enter-active-class=\"transition-[scale] ease-out duration-200 motion-reduce:transition-none\"\n enter-from-class=\"scale-0 motion-reduce:scale-100\"\n enter-to-class=\"scale-100\"\n leave-active-class=\"transition-[scale] ease-in duration-150 motion-reduce:transition-none\"\n leave-from-class=\"scale-100\"\n leave-to-class=\"scale-0 motion-reduce:scale-100\"\n >\n <div\n v-if=\"modelValue\"\n :class=\"ui.badge()\"\n :style=\"positionStyle\"\n :data-placement=\"placement\"\n :data-dot=\"dot || undefined\"\n :data-left=\"left || undefined\"\n aria-atomic=\"true\"\n aria-live=\"polite\"\n role=\"status\"\n >\n <!-- no aria-label: on a live region it replaced the count, so a reader announced \"Badge\" -->\n <span\n v-if=\"!dot\"\n :class=\"ui.content({ class: hasIconAndText ? 'px-2' : undefined })\"\n >\n <slot name=\"badge\">\n {{ text }}\n </slot>\n <slot name=\"icon\">\n <RuiIcon\n v-if=\"icon\"\n :name=\"icon\"\n />\n </slot>\n </span>\n </div>\n </Transition>\n </div>\n</template>\n"],"mappings":""}