@rotki/ui-library 3.1.7 → 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 (257) 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-group/RuiButtonGroup.js.map +1 -1
  26. package/dist/components/buttons/button-group/RuiButtonGroup.vue_vue_type_script_setup_true_lang.js +2 -138
  27. package/dist/components/buttons/button-group/RuiButtonGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  28. package/dist/components/buttons/button-group/button-group-styles.d.ts +142 -0
  29. package/dist/components/buttons/button-group/button-group-styles.js +143 -0
  30. package/dist/components/buttons/button-group/button-group-styles.js.map +1 -0
  31. package/dist/components/calendar/RuiCalendar.js.map +1 -1
  32. package/dist/components/calendar/RuiCalendar.vue_vue_type_script_setup_true_lang.js +1 -8
  33. package/dist/components/calendar/RuiCalendar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  34. package/dist/components/calendar/RuiCalendarGrid.js.map +1 -1
  35. package/dist/components/calendar/RuiCalendarGrid.vue_vue_type_script_setup_true_lang.js +2 -22
  36. package/dist/components/calendar/RuiCalendarGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  37. package/dist/components/calendar/RuiCalendarMenu.js.map +1 -1
  38. package/dist/components/calendar/RuiCalendarMenu.vue_vue_type_script_setup_true_lang.js +3 -14
  39. package/dist/components/calendar/RuiCalendarMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  40. package/dist/components/calendar/calendar-grid-styles.d.ts +43 -0
  41. package/dist/components/calendar/calendar-grid-styles.js +26 -0
  42. package/dist/components/calendar/calendar-grid-styles.js.map +1 -0
  43. package/dist/components/calendar/calendar-menu-styles.d.ts +34 -0
  44. package/dist/components/calendar/calendar-menu-styles.js +17 -0
  45. package/dist/components/calendar/calendar-menu-styles.js.map +1 -0
  46. package/dist/components/calendar/calendar-styles.d.ts +16 -0
  47. package/dist/components/calendar/calendar-styles.js +13 -0
  48. package/dist/components/calendar/calendar-styles.js.map +1 -0
  49. package/dist/components/cards/RuiCard.js.map +1 -1
  50. package/dist/components/cards/RuiCard.vue_vue_type_script_setup_true_lang.js +3 -58
  51. package/dist/components/cards/RuiCard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  52. package/dist/components/cards/RuiCardHeader.js.map +1 -1
  53. package/dist/components/cards/RuiCardHeader.vue_vue_type_script_setup_true_lang.js +2 -20
  54. package/dist/components/cards/RuiCardHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  55. package/dist/components/cards/card-header-styles.d.ts +46 -0
  56. package/dist/components/cards/card-header-styles.js +24 -0
  57. package/dist/components/cards/card-header-styles.js.map +1 -0
  58. package/dist/components/cards/card-styles.d.ts +175 -0
  59. package/dist/components/cards/card-styles.js +62 -0
  60. package/dist/components/cards/card-styles.js.map +1 -0
  61. package/dist/components/chips/RuiChip.js.map +1 -1
  62. package/dist/components/chips/RuiChip.vue_vue_type_script_setup_true_lang.js +2 -241
  63. package/dist/components/chips/RuiChip.vue_vue_type_script_setup_true_lang.js.map +1 -1
  64. package/dist/components/chips/chip-styles.d.ts +223 -0
  65. package/dist/components/chips/chip-styles.js +246 -0
  66. package/dist/components/chips/chip-styles.js.map +1 -0
  67. package/dist/components/color-picker/RuiColorBoard.js.map +1 -1
  68. package/dist/components/color-picker/RuiColorBoard.vue_vue_type_script_setup_true_lang.js +3 -3
  69. package/dist/components/color-picker/RuiColorBoard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  70. package/dist/components/color-picker/RuiColorHue.js.map +1 -1
  71. package/dist/components/color-picker/RuiColorHue.vue_vue_type_script_setup_true_lang.js +3 -3
  72. package/dist/components/color-picker/RuiColorHue.vue_vue_type_script_setup_true_lang.js.map +1 -1
  73. package/dist/components/color-picker/RuiColorPicker.js.map +1 -1
  74. package/dist/components/color-picker/RuiColorPicker.vue_vue_type_script_setup_true_lang.js +3 -3
  75. package/dist/components/color-picker/RuiColorPicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  76. package/dist/components/color-picker/color-board-styles.d.ts +1 -0
  77. package/dist/components/color-picker/color-board-styles.js +7 -0
  78. package/dist/components/color-picker/color-board-styles.js.map +1 -0
  79. package/dist/components/color-picker/color-hue-styles.d.ts +1 -0
  80. package/dist/components/color-picker/color-hue-styles.js +7 -0
  81. package/dist/components/color-picker/color-hue-styles.js.map +1 -0
  82. package/dist/components/color-picker/color-picker-styles.d.ts +1 -0
  83. package/dist/components/color-picker/color-picker-styles.js +7 -0
  84. package/dist/components/color-picker/color-picker-styles.js.map +1 -0
  85. package/dist/components/forms/field-label/RuiFieldLabel.js.map +1 -1
  86. package/dist/components/forms/field-label/RuiFieldLabel.vue_vue_type_script_setup_true_lang.js +1 -11
  87. package/dist/components/forms/field-label/RuiFieldLabel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  88. package/dist/components/forms/field-label/field-label-styles.d.ts +43 -0
  89. package/dist/components/forms/field-label/field-label-styles.js +16 -0
  90. package/dist/components/forms/field-label/field-label-styles.js.map +1 -0
  91. package/dist/components/forms/select/RuiSimpleSelect.js.map +1 -1
  92. package/dist/components/forms/select/RuiSimpleSelect.vue_vue_type_script_setup_true_lang.js +2 -11
  93. package/dist/components/forms/select/RuiSimpleSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
  94. package/dist/components/forms/select/simple-select-styles.d.ts +2 -0
  95. package/dist/components/forms/select/simple-select-styles.js +15 -0
  96. package/dist/components/forms/select/simple-select-styles.js.map +1 -0
  97. package/dist/components/forms/switch/RuiSwitch.js.map +1 -1
  98. package/dist/components/forms/switch/RuiSwitch.vue_vue_type_script_setup_true_lang.js +1 -126
  99. package/dist/components/forms/switch/RuiSwitch.vue_vue_type_script_setup_true_lang.js.map +1 -1
  100. package/dist/components/forms/switch/switch-styles.d.ts +151 -0
  101. package/dist/components/forms/switch/switch-styles.js +131 -0
  102. package/dist/components/forms/switch/switch-styles.js.map +1 -0
  103. package/dist/components/icons/RuiIcon.js.map +1 -1
  104. package/dist/components/icons/RuiIcon.vue_vue_type_script_setup_true_lang.js +2 -28
  105. package/dist/components/icons/RuiIcon.vue_vue_type_script_setup_true_lang.js.map +1 -1
  106. package/dist/components/icons/icon-styles.d.ts +44 -0
  107. package/dist/components/icons/icon-styles.js +33 -0
  108. package/dist/components/icons/icon-styles.js.map +1 -0
  109. package/dist/components/loaders/RuiSkeletonBase.js.map +1 -1
  110. package/dist/components/loaders/RuiSkeletonBase.vue_vue_type_script_setup_true_lang.js +2 -12
  111. package/dist/components/loaders/RuiSkeletonBase.vue_vue_type_script_setup_true_lang.js.map +1 -1
  112. package/dist/components/loaders/RuiSkeletonLoader.js.map +1 -1
  113. package/dist/components/loaders/RuiSkeletonLoader.vue_vue_type_script_setup_true_lang.js +3 -13
  114. package/dist/components/loaders/RuiSkeletonLoader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  115. package/dist/components/loaders/skeleton-base-styles.d.ts +25 -0
  116. package/dist/components/loaders/skeleton-base-styles.js +16 -0
  117. package/dist/components/loaders/skeleton-base-styles.js.map +1 -0
  118. package/dist/components/loaders/skeleton-loader-styles.d.ts +37 -0
  119. package/dist/components/loaders/skeleton-loader-styles.js +18 -0
  120. package/dist/components/loaders/skeleton-loader-styles.js.map +1 -0
  121. package/dist/components/overlays/badge/RuiBadge.js.map +1 -1
  122. package/dist/components/overlays/badge/RuiBadge.vue_vue_type_script_setup_true_lang.js +1 -83
  123. package/dist/components/overlays/badge/RuiBadge.vue_vue_type_script_setup_true_lang.js.map +1 -1
  124. package/dist/components/overlays/badge/badge-styles.d.ts +193 -0
  125. package/dist/components/overlays/badge/badge-styles.js +88 -0
  126. package/dist/components/overlays/badge/badge-styles.js.map +1 -0
  127. package/dist/components/overlays/dialog/RuiDialog.js.map +1 -1
  128. package/dist/components/overlays/dialog/RuiDialog.vue_vue_type_script_setup_true_lang.js +3 -14
  129. package/dist/components/overlays/dialog/RuiDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
  130. package/dist/components/overlays/dialog/dialog-styles.d.ts +40 -0
  131. package/dist/components/overlays/dialog/dialog-styles.js +18 -0
  132. package/dist/components/overlays/dialog/dialog-styles.js.map +1 -0
  133. package/dist/components/overlays/menu/RuiMenu.js.map +1 -1
  134. package/dist/components/overlays/menu/RuiMenu.vue.d.ts +9 -0
  135. package/dist/components/overlays/menu/RuiMenu.vue_vue_type_script_setup_true_lang.js +113 -58
  136. package/dist/components/overlays/menu/RuiMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  137. package/dist/components/overlays/menu/menu-styles.d.ts +58 -0
  138. package/dist/components/overlays/menu/menu-styles.js +25 -0
  139. package/dist/components/overlays/menu/menu-styles.js.map +1 -0
  140. package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.js.map +1 -1
  141. package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.vue_vue_type_script_setup_true_lang.js +4 -69
  142. package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.vue_vue_type_script_setup_true_lang.js.map +1 -1
  143. package/dist/components/overlays/navigation-drawer/navigation-drawer-styles.d.ts +76 -0
  144. package/dist/components/overlays/navigation-drawer/navigation-drawer-styles.js +72 -0
  145. package/dist/components/overlays/navigation-drawer/navigation-drawer-styles.js.map +1 -0
  146. package/dist/components/overlays/notification/RuiNotification.js.map +1 -1
  147. package/dist/components/overlays/notification/RuiNotification.vue_vue_type_script_setup_true_lang.js +3 -3
  148. package/dist/components/overlays/notification/RuiNotification.vue_vue_type_script_setup_true_lang.js.map +1 -1
  149. package/dist/components/overlays/notification/notification-styles.d.ts +1 -0
  150. package/dist/components/overlays/notification/notification-styles.js +7 -0
  151. package/dist/components/overlays/notification/notification-styles.js.map +1 -0
  152. package/dist/components/overlays/tooltip/RuiTooltip.js.map +1 -1
  153. package/dist/components/overlays/tooltip/RuiTooltip.vue.d.ts +4 -2
  154. package/dist/components/overlays/tooltip/RuiTooltip.vue_vue_type_script_setup_true_lang.js +42 -25
  155. package/dist/components/overlays/tooltip/RuiTooltip.vue_vue_type_script_setup_true_lang.js.map +1 -1
  156. package/dist/components/overlays/tooltip/tooltip-styles.d.ts +2 -0
  157. package/dist/components/overlays/tooltip/tooltip-styles.js +3 -1
  158. package/dist/components/overlays/tooltip/tooltip-styles.js.map +1 -1
  159. package/dist/components/progress/RuiProgress.js.map +1 -1
  160. package/dist/components/progress/RuiProgress.vue_vue_type_script_setup_true_lang.js +1 -133
  161. package/dist/components/progress/RuiProgress.vue_vue_type_script_setup_true_lang.js.map +1 -1
  162. package/dist/components/progress/progress-styles.d.ts +181 -0
  163. package/dist/components/progress/progress-styles.js +139 -0
  164. package/dist/components/progress/progress-styles.js.map +1 -0
  165. package/dist/components/steppers/RuiFooterStepper.js.map +1 -1
  166. package/dist/components/steppers/RuiFooterStepper.vue_vue_type_script_setup_true_lang.js +3 -13
  167. package/dist/components/steppers/RuiFooterStepper.vue_vue_type_script_setup_true_lang.js.map +1 -1
  168. package/dist/components/steppers/RuiStepper.js.map +1 -1
  169. package/dist/components/steppers/RuiStepper.vue_vue_type_script_setup_true_lang.js +4 -94
  170. package/dist/components/steppers/RuiStepper.vue_vue_type_script_setup_true_lang.js.map +1 -1
  171. package/dist/components/steppers/RuiStepperIcon.js.map +1 -1
  172. package/dist/components/steppers/RuiStepperIcon.vue_vue_type_script_setup_true_lang.js +2 -34
  173. package/dist/components/steppers/RuiStepperIcon.vue_vue_type_script_setup_true_lang.js.map +1 -1
  174. package/dist/components/steppers/footer-stepper-styles.d.ts +28 -0
  175. package/dist/components/steppers/footer-stepper-styles.js +16 -0
  176. package/dist/components/steppers/footer-stepper-styles.js.map +1 -0
  177. package/dist/components/steppers/stepper-icon-styles.d.ts +60 -0
  178. package/dist/components/steppers/stepper-icon-styles.js +39 -0
  179. package/dist/components/steppers/stepper-icon-styles.js.map +1 -0
  180. package/dist/components/steppers/stepper-styles.d.ts +202 -0
  181. package/dist/components/steppers/stepper-styles.js +98 -0
  182. package/dist/components/steppers/stepper-styles.js.map +1 -0
  183. package/dist/components/tables/RuiTable.js.map +1 -1
  184. package/dist/components/tables/RuiTable.vue_vue_type_script_setup_true_lang.js +1 -32
  185. package/dist/components/tables/RuiTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  186. package/dist/components/tables/RuiTableEmptyState.js.map +1 -1
  187. package/dist/components/tables/RuiTableEmptyState.vue_vue_type_script_setup_true_lang.js +1 -15
  188. package/dist/components/tables/RuiTableEmptyState.vue_vue_type_script_setup_true_lang.js.map +1 -1
  189. package/dist/components/tables/RuiTableErrorState.js.map +1 -1
  190. package/dist/components/tables/RuiTableErrorState.vue_vue_type_script_setup_true_lang.js +2 -5
  191. package/dist/components/tables/RuiTableErrorState.vue_vue_type_script_setup_true_lang.js.map +1 -1
  192. package/dist/components/tables/RuiTableHead.js.map +1 -1
  193. package/dist/components/tables/RuiTableHead.vue_vue_type_script_setup_true_lang.js +1 -34
  194. package/dist/components/tables/RuiTableHead.vue_vue_type_script_setup_true_lang.js.map +1 -1
  195. package/dist/components/tables/RuiTableLoadingState.js.map +1 -1
  196. package/dist/components/tables/RuiTableLoadingState.vue_vue_type_script_setup_true_lang.js +1 -8
  197. package/dist/components/tables/RuiTableLoadingState.vue_vue_type_script_setup_true_lang.js.map +1 -1
  198. package/dist/components/tables/RuiTablePagination.js.map +1 -1
  199. package/dist/components/tables/RuiTablePagination.vue_vue_type_script_setup_true_lang.js +1 -30
  200. package/dist/components/tables/RuiTablePagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  201. package/dist/components/tables/table-empty-state-styles.d.ts +43 -0
  202. package/dist/components/tables/table-empty-state-styles.js +20 -0
  203. package/dist/components/tables/table-empty-state-styles.js.map +1 -0
  204. package/dist/components/tables/table-error-state-styles.d.ts +36 -0
  205. package/dist/components/tables/table-error-state-styles.js +15 -0
  206. package/dist/components/tables/table-error-state-styles.js.map +1 -0
  207. package/dist/components/tables/table-head-styles.d.ts +91 -0
  208. package/dist/components/tables/table-head-styles.js +39 -0
  209. package/dist/components/tables/table-head-styles.js.map +1 -0
  210. package/dist/components/tables/table-loading-state-styles.d.ts +34 -0
  211. package/dist/components/tables/table-loading-state-styles.js +13 -0
  212. package/dist/components/tables/table-loading-state-styles.js.map +1 -0
  213. package/dist/components/tables/table-pagination-styles.d.ts +82 -0
  214. package/dist/components/tables/table-pagination-styles.js +35 -0
  215. package/dist/components/tables/table-pagination-styles.js.map +1 -0
  216. package/dist/components/tables/table-styles.d.ts +62 -0
  217. package/dist/components/tables/table-styles.js +37 -0
  218. package/dist/components/tables/table-styles.js.map +1 -0
  219. package/dist/components/tabs/tab/RuiTab.js.map +1 -1
  220. package/dist/components/tabs/tab/RuiTab.vue_vue_type_script_setup_true_lang.js +3 -84
  221. package/dist/components/tabs/tab/RuiTab.vue_vue_type_script_setup_true_lang.js.map +1 -1
  222. package/dist/components/tabs/tab/tab-styles.d.ts +153 -0
  223. package/dist/components/tabs/tab/tab-styles.js +89 -0
  224. package/dist/components/tabs/tab/tab-styles.js.map +1 -0
  225. package/dist/components/tabs/tabs/RuiTabs.js.map +1 -1
  226. package/dist/components/tabs/tabs/RuiTabs.vue_vue_type_script_setup_true_lang.js +2 -137
  227. package/dist/components/tabs/tabs/RuiTabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
  228. package/dist/components/tabs/tabs/tabs-styles.d.ts +168 -0
  229. package/dist/components/tabs/tabs/tabs-styles.js +142 -0
  230. package/dist/components/tabs/tabs/tabs-styles.js.map +1 -0
  231. package/dist/composables/floating.d.ts +3 -1
  232. package/dist/composables/floating.js +8 -9
  233. package/dist/composables/floating.js.map +1 -1
  234. package/dist/icons/icons_1.d.ts +1 -1
  235. package/dist/icons/icons_1.js +10 -9
  236. package/dist/icons/icons_1.js.map +1 -1
  237. package/dist/icons/icons_2.d.ts +1 -1
  238. package/dist/icons/icons_2.js +9 -11
  239. package/dist/icons/icons_2.js.map +1 -1
  240. package/dist/icons/icons_3.d.ts +1 -1
  241. package/dist/icons/icons_3.js +11 -5
  242. package/dist/icons/icons_3.js.map +1 -1
  243. package/dist/icons/icons_4.d.ts +1 -1
  244. package/dist/icons/icons_4.js +5 -10
  245. package/dist/icons/icons_4.js.map +1 -1
  246. package/dist/icons/icons_5.d.ts +1 -0
  247. package/dist/icons/icons_5.js +10 -1
  248. package/dist/icons/icons_5.js.map +1 -1
  249. package/dist/icons/index.d.ts +1 -1
  250. package/dist/icons/index.js +7 -6
  251. package/dist/icons/index.js.map +1 -1
  252. package/dist/index.js +6 -6
  253. package/dist/utils/form-text-detail.d.ts +2 -0
  254. package/dist/utils/form-text-detail.js +5 -1
  255. package/dist/utils/form-text-detail.js.map +1 -1
  256. package/dist/web-types.json +11 -1
  257. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
1
  import { get, set, whenever } from "../../vendor/@vueuse/shared/dist/index.js";
2
- import { cn, tv } from "../../utils/tv.js";
2
+ import { cn } from "../../utils/tv.js";
3
3
  import { Color } from "./utils.js";
4
4
  import RuiColorBoard_default from "./RuiColorBoard.js";
5
5
  import RuiColorDisplay_default from "./RuiColorDisplay.js";
6
6
  import RuiColorHue_default from "./RuiColorHue.js";
7
7
  import RuiColorInput_default from "./RuiColorInput.js";
8
+ import { colorPickerStyles } from "./color-picker-styles.js";
8
9
  import { createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, openBlock, reactive, unref, useModel, watch } from "vue";
9
10
  //#region src/components/color-picker/RuiColorPicker.vue?vue&type=script&setup=true&lang.ts
10
11
  var _hoisted_1 = { class: "flex flex-col gap-5 p-4" };
@@ -31,13 +32,12 @@ var RuiColorPicker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
31
32
  watch(() => state.color.hex, (hex) => {
32
33
  set(modelValue, hex);
33
34
  }, { immediate: true });
34
- const rootStyle = tv({ base: "relative select-none" });
35
35
  return (_ctx, _cache) => {
36
36
  return openBlock(), createElementBlock("div", mergeProps({
37
37
  role: "application",
38
38
  "aria-label": "Color picker",
39
39
  "data-id": "color-picker",
40
- class: unref(rootStyle)({ class: unref(cn)(_ctx.$attrs.class) })
40
+ class: unref(colorPickerStyles)({ class: unref(cn)(_ctx.$attrs.class) })
41
41
  }, {
42
42
  ..._ctx.$attrs,
43
43
  class: void 0
@@ -1 +1 @@
1
- {"version":3,"file":"RuiColorPicker.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useModel","_openBlock","_createElementBlock","_mergeProps","_unref","_createVNode","RuiColorBoard","_createElementVNode","RuiColorDisplay","RuiColorHue","RuiColorInput"],"sources":["../../../src/components/color-picker/RuiColorPicker.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n// Inspired by https://github.com/aesoper101/vue3-colorpicker/\nimport RuiColorBoard from '@/components/color-picker/RuiColorBoard.vue';\nimport RuiColorDisplay from '@/components/color-picker/RuiColorDisplay.vue';\nimport RuiColorHue from '@/components/color-picker/RuiColorHue.vue';\nimport RuiColorInput from '@/components/color-picker/RuiColorInput.vue';\nimport { cn, tv } from '@/utils/tv';\nimport { Color } from './utils';\n\ndefineOptions({\n name: 'RuiColorPicker',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<string>({ default: '' });\n\nconst state = reactive({\n color: new Color(get(modelValue)),\n});\n\nfunction onBoardChange({\n saturation,\n brightness,\n}: {\n saturation: number;\n brightness: number;\n}): void {\n state.color.saturation = saturation;\n state.color.brightness = brightness;\n}\n\nwhenever(\n modelValue,\n (value: string) => {\n if (state.color.hex !== value)\n state.color = new Color(value);\n },\n);\n\nwatch(\n () => state.color.hex,\n (hex: string) => {\n set(modelValue, hex);\n },\n { immediate: true },\n);\n\nconst rootStyle = tv({ base: 'relative select-none' });\n</script>\n\n<template>\n <div\n role=\"application\"\n aria-label=\"Color picker\"\n data-id=\"color-picker\"\n :class=\"rootStyle({ class: cn($attrs.class) })\"\n v-bind=\"{ ...$attrs, class: undefined }\"\n >\n <RuiColorBoard\n :color=\"state.color\"\n @update:board=\"onBoardChange($event)\"\n />\n <div class=\"flex flex-col gap-5 p-4\">\n <div class=\"flex items-center gap-4\">\n <RuiColorDisplay :color=\"state.color.hexString\" />\n <RuiColorHue\n v-model=\"state.color.hue\"\n class=\"flex-1\"\n />\n </div>\n\n <RuiColorInput v-model=\"state.color\" />\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAcA,MAAM,aAAaC,SAAmB,SAAA,YAAgB;EAEtD,MAAM,QAAQ,SAAS,EACrB,OAAO,IAAI,MAAM,IAAI,UAAU,CAAC,EAClC,CAAC;EAED,SAAS,cAAc,EACrB,YACA,cAIO;GACP,MAAM,MAAM,aAAa;GACzB,MAAM,MAAM,aAAa;EAC3B;EAEA,SACE,aACC,UAAkB;GACjB,IAAI,MAAM,MAAM,QAAQ,OACtB,MAAM,QAAQ,IAAI,MAAM,KAAK;EACjC,CACF;EAEA,YACQ,MAAM,MAAM,MACjB,QAAgB;GACf,IAAI,YAAY,GAAG;EACrB,GACA,EAAE,WAAW,KAAK,CACpB;EAEA,MAAM,YAAY,GAAG,EAAE,MAAM,uBAAuB,CAAC;;GAInD,OAAAC,UAAA,GAAAC,mBAsBM,OAtBNC,WAsBM;IArBJ,MAAK;IACL,cAAW;IACX,WAAQ;IACP,OAAOC,MAAA,SAAA,CAAS,CAAA,EAAA,OAAUA,MAAA,EAAA,CAAE,CAACL,KAAAA,OAAO,KAAK,EAAA,CAAA;GAC7BA,GAAAA;IAAAA,GAAAA,KAAAA;IAAM,OAAS,KAAA;GAAS,CAAA,GAAA,CAErCM,YAGEC,uBAAA;IAFC,OAAOF,MAAA,KAAA,CAAK,CAAC;IACb,kBAAY,OAAA,OAAA,OAAA,MAAA,WAAE,cAAc,MAAM;GAErCG,GAAAA,MAAAA,GAAAA,CAAAA,OAAAA,CAAAA,GAAAA,mBAUM,OAVN,YAUM,CATJA,mBAMM,OANN,YAMM,CALJF,YAAkDG,yBAAA,EAAhC,OAAOJ,MAAA,KAAA,CAAK,CAAC,MAAM,UAAA,GAAA,MAAA,GAAA,CAAA,OAAA,CAAA,GACrCC,YAGEI,qBAAA;IAFS,YAAAL,MAAA,KAAA,CAAK,CAAC,MAAM;IAAZ,uBAAA,OAAA,OAAA,OAAA,MAAA,WAAA,MAAA,KAAA,CAAK,CAAC,MAAM,MAAG;IACxB,OAAM;GAIVC,GAAAA,MAAAA,GAAAA,CAAAA,YAAAA,CAAAA,CAAAA,CAAAA,GAAAA,YAAuCK,uBAAA;IAAf,YAAAN,MAAA,KAAA,CAAK,CAAC;IAAN,uBAAA,OAAA,OAAA,OAAA,MAAA,WAAA,MAAA,KAAA,CAAK,CAAC,QAAK"}
1
+ {"version":3,"file":"RuiColorPicker.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useModel","_openBlock","_createElementBlock","_mergeProps","_unref","_createVNode","RuiColorBoard","_createElementVNode","RuiColorDisplay","RuiColorHue","RuiColorInput"],"sources":["../../../src/components/color-picker/RuiColorPicker.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n// Inspired by https://github.com/aesoper101/vue3-colorpicker/\nimport RuiColorBoard from '@/components/color-picker/RuiColorBoard.vue';\nimport RuiColorDisplay from '@/components/color-picker/RuiColorDisplay.vue';\nimport RuiColorHue from '@/components/color-picker/RuiColorHue.vue';\nimport RuiColorInput from '@/components/color-picker/RuiColorInput.vue';\nimport { cn } from '@/utils/tv';\nimport { colorPickerStyles } from './color-picker-styles';\nimport { Color } from './utils';\n\ndefineOptions({\n name: 'RuiColorPicker',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<string>({ default: '' });\n\nconst state = reactive({\n color: new Color(get(modelValue)),\n});\n\nfunction onBoardChange({\n saturation,\n brightness,\n}: {\n saturation: number;\n brightness: number;\n}): void {\n state.color.saturation = saturation;\n state.color.brightness = brightness;\n}\n\nwhenever(\n modelValue,\n (value: string) => {\n if (state.color.hex !== value)\n state.color = new Color(value);\n },\n);\n\nwatch(\n () => state.color.hex,\n (hex: string) => {\n set(modelValue, hex);\n },\n { immediate: true },\n);\n</script>\n\n<template>\n <div\n role=\"application\"\n aria-label=\"Color picker\"\n data-id=\"color-picker\"\n :class=\"colorPickerStyles({ class: cn($attrs.class) })\"\n v-bind=\"{ ...$attrs, class: undefined }\"\n >\n <RuiColorBoard\n :color=\"state.color\"\n @update:board=\"onBoardChange($event)\"\n />\n <div class=\"flex flex-col gap-5 p-4\">\n <div class=\"flex items-center gap-4\">\n <RuiColorDisplay :color=\"state.color.hexString\" />\n <RuiColorHue\n v-model=\"state.color.hue\"\n class=\"flex-1\"\n />\n </div>\n\n <RuiColorInput v-model=\"state.color\" />\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAeA,MAAM,aAAaC,SAAmB,SAAA,YAAgB;EAEtD,MAAM,QAAQ,SAAS,EACrB,OAAO,IAAI,MAAM,IAAI,UAAU,CAAC,EAClC,CAAC;EAED,SAAS,cAAc,EACrB,YACA,cAIO;GACP,MAAM,MAAM,aAAa;GACzB,MAAM,MAAM,aAAa;EAC3B;EAEA,SACE,aACC,UAAkB;GACjB,IAAI,MAAM,MAAM,QAAQ,OACtB,MAAM,QAAQ,IAAI,MAAM,KAAK;EACjC,CACF;EAEA,YACQ,MAAM,MAAM,MACjB,QAAgB;GACf,IAAI,YAAY,GAAG;EACrB,GACA,EAAE,WAAW,KAAK,CACpB;;GAIE,OAAAC,UAAA,GAAAC,mBAsBM,OAtBNC,WAsBM;IArBJ,MAAK;IACL,cAAW;IACX,WAAQ;IACP,OAAOC,MAAA,iBAAA,CAAiB,CAAA,EAAA,OAAUA,MAAA,EAAA,CAAE,CAACL,KAAAA,OAAO,KAAK,EAAA,CAAA;GACrCA,GAAAA;IAAAA,GAAAA,KAAAA;IAAM,OAAS,KAAA;GAAS,CAAA,GAAA,CAErCM,YAGEC,uBAAA;IAFC,OAAOF,MAAA,KAAA,CAAK,CAAC;IACb,kBAAY,OAAA,OAAA,OAAA,MAAA,WAAE,cAAc,MAAM;GAErCG,GAAAA,MAAAA,GAAAA,CAAAA,OAAAA,CAAAA,GAAAA,mBAUM,OAVN,YAUM,CATJA,mBAMM,OANN,YAMM,CALJF,YAAkDG,yBAAA,EAAhC,OAAOJ,MAAA,KAAA,CAAK,CAAC,MAAM,UAAA,GAAA,MAAA,GAAA,CAAA,OAAA,CAAA,GACrCC,YAGEI,qBAAA;IAFS,YAAAL,MAAA,KAAA,CAAK,CAAC,MAAM;IAAZ,uBAAA,OAAA,OAAA,OAAA,MAAA,WAAA,MAAA,KAAA,CAAK,CAAC,MAAM,MAAG;IACxB,OAAM;GAIVC,GAAAA,MAAAA,GAAAA,CAAAA,YAAAA,CAAAA,CAAAA,CAAAA,GAAAA,YAAuCK,uBAAA;IAAf,YAAAN,MAAA,KAAA,CAAK,CAAC;IAAN,uBAAA,OAAA,OAAA,OAAA,MAAA,WAAA,MAAA,KAAA,CAAK,CAAC,QAAK"}
@@ -0,0 +1 @@
1
+ export declare const colorBoardStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "relative w-full h-40 overflow-hidden cursor-pointer rounded-rui-control", {} | {}, undefined, import("tailwind-variants").TVReturnTypeLike<unknown, undefined>>;
@@ -0,0 +1,7 @@
1
+ import { tv } from "../../utils/tv.js";
2
+ //#region src/components/color-picker/color-board-styles.ts
3
+ var colorBoardStyles = tv({ base: "relative w-full h-40 overflow-hidden cursor-pointer rounded-rui-control" });
4
+ //#endregion
5
+ export { colorBoardStyles };
6
+
7
+ //# sourceMappingURL=color-board-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-board-styles.js","names":[],"sources":["../../../src/components/color-picker/color-board-styles.ts"],"sourcesContent":["import { tv } from '@/utils/tv';\n\nexport const colorBoardStyles = tv({ base: 'relative w-full h-40 overflow-hidden cursor-pointer rounded-rui-control' });\n"],"mappings":";;AAEA,IAAa,mBAAmB,GAAG,EAAE,MAAM,0EAA0E,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const colorHueStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "relative w-full h-3.5 rounded-full cursor-pointer bg-hue-spectrum", {} | {}, undefined, import("tailwind-variants").TVReturnTypeLike<unknown, undefined>>;
@@ -0,0 +1,7 @@
1
+ import { tv } from "../../utils/tv.js";
2
+ //#region src/components/color-picker/color-hue-styles.ts
3
+ var colorHueStyles = tv({ base: "relative w-full h-3.5 rounded-full cursor-pointer bg-hue-spectrum" });
4
+ //#endregion
5
+ export { colorHueStyles };
6
+
7
+ //# sourceMappingURL=color-hue-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-hue-styles.js","names":[],"sources":["../../../src/components/color-picker/color-hue-styles.ts"],"sourcesContent":["import { tv } from '@/utils/tv';\n\nexport const colorHueStyles = tv({ base: 'relative w-full h-3.5 rounded-full cursor-pointer bg-hue-spectrum' });\n"],"mappings":";;AAEA,IAAa,iBAAiB,GAAG,EAAE,MAAM,oEAAoE,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const colorPickerStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "relative select-none", {} | {}, undefined, import("tailwind-variants").TVReturnTypeLike<unknown, undefined>>;
@@ -0,0 +1,7 @@
1
+ import { tv } from "../../utils/tv.js";
2
+ //#region src/components/color-picker/color-picker-styles.ts
3
+ var colorPickerStyles = tv({ base: "relative select-none" });
4
+ //#endregion
5
+ export { colorPickerStyles };
6
+
7
+ //# sourceMappingURL=color-picker-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-picker-styles.js","names":[],"sources":["../../../src/components/color-picker/color-picker-styles.ts"],"sourcesContent":["import { tv } from '@/utils/tv';\n\nexport const colorPickerStyles = tv({ base: 'relative select-none' });\n"],"mappings":";;AAEA,IAAa,oBAAoB,GAAG,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RuiFieldLabel.js","names":["_sfc_main"],"sources":["../../../../src/components/forms/field-label/RuiFieldLabel.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { tv } from '@/utils/tv';\n\n/**\n * The label a field shows above itself when its label placement is `top`, or\n * keeps for screen readers alone when it is `hidden`. A text input links it\n * through `for`; a select or picker, whose activator is not a labelable\n * element, points at its `id` with `aria-labelledby` instead.\n */\nexport interface FieldLabelProps {\n text: string;\n hidden?: boolean;\n required?: boolean;\n disabled?: boolean;\n for?: string;\n id?: string;\n}\n\ndefineOptions({\n name: 'RuiFieldLabel',\n});\n\nconst {\n text,\n hidden = false,\n required = false,\n disabled = false,\n for: forId = undefined,\n id = undefined,\n} = defineProps<FieldLabelProps>();\n\nconst labelStyles = tv({\n slots: {\n root: 'block mb-1 text-sm leading-5 font-medium text-rui-text',\n required: 'text-rui-error',\n },\n variants: {\n hidden: {\n true: { root: 'sr-only' },\n },\n disabled: {\n true: { root: 'text-rui-text-disabled' },\n },\n },\n});\n\nconst ui = computed<ReturnType<typeof labelStyles>>(() => labelStyles({ hidden, disabled }));\n</script>\n\n<template>\n <label\n :id=\"id\"\n :for=\"forId\"\n :class=\"ui.root()\"\n data-id=\"field-label\"\n >\n {{ text }}\n <span\n v-if=\"required\"\n :class=\"ui.required()\"\n aria-hidden=\"true\"\n >\n *\n </span>\n </label>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"RuiFieldLabel.js","names":["_sfc_main"],"sources":["../../../../src/components/forms/field-label/RuiFieldLabel.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { labelStyles } from './field-label-styles';\n\n/**\n * The label a field shows above itself when its label placement is `top`, or\n * keeps for screen readers alone when it is `hidden`. A text input links it\n * through `for`; a select or picker, whose activator is not a labelable\n * element, points at its `id` with `aria-labelledby` instead.\n */\nexport interface FieldLabelProps {\n text: string;\n hidden?: boolean;\n required?: boolean;\n disabled?: boolean;\n for?: string;\n id?: string;\n}\n\ndefineOptions({\n name: 'RuiFieldLabel',\n});\n\nconst {\n text,\n hidden = false,\n required = false,\n disabled = false,\n for: forId = undefined,\n id = undefined,\n} = defineProps<FieldLabelProps>();\n\nconst ui = computed<ReturnType<typeof labelStyles>>(() => labelStyles({ hidden, disabled }));\n</script>\n\n<template>\n <label\n :id=\"id\"\n :for=\"forId\"\n :class=\"ui.root()\"\n data-id=\"field-label\"\n >\n {{ text }}\n <span\n v-if=\"required\"\n :class=\"ui.required()\"\n aria-hidden=\"true\"\n >\n *\n </span>\n </label>\n</template>\n"],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { tv } from "../../../utils/tv.js";
1
+ import { labelStyles } from "./field-label-styles.js";
2
2
  import { computed, createCommentVNode, createElementBlock, createTextVNode, defineComponent, normalizeClass, openBlock, toDisplayString, unref } from "vue";
3
3
  //#region src/components/forms/field-label/RuiFieldLabel.vue?vue&type=script&setup=true&lang.ts
4
4
  var _hoisted_1 = ["id", "for"];
@@ -23,16 +23,6 @@ var RuiFieldLabel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
23
23
  id: { default: () => void 0 }
24
24
  },
25
25
  setup(__props) {
26
- const labelStyles = tv({
27
- slots: {
28
- root: "block mb-1 text-sm leading-5 font-medium text-rui-text",
29
- required: "text-rui-error"
30
- },
31
- variants: {
32
- hidden: { true: { root: "sr-only" } },
33
- disabled: { true: { root: "text-rui-text-disabled" } }
34
- }
35
- });
36
26
  const ui = computed(() => labelStyles({
37
27
  hidden: __props.hidden,
38
28
  disabled: __props.disabled
@@ -1 +1 @@
1
- {"version":3,"file":"RuiFieldLabel.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_createTextVNode","_toDisplayString","_createCommentVNode"],"sources":["../../../../src/components/forms/field-label/RuiFieldLabel.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { tv } from '@/utils/tv';\n\n/**\n * The label a field shows above itself when its label placement is `top`, or\n * keeps for screen readers alone when it is `hidden`. A text input links it\n * through `for`; a select or picker, whose activator is not a labelable\n * element, points at its `id` with `aria-labelledby` instead.\n */\nexport interface FieldLabelProps {\n text: string;\n hidden?: boolean;\n required?: boolean;\n disabled?: boolean;\n for?: string;\n id?: string;\n}\n\ndefineOptions({\n name: 'RuiFieldLabel',\n});\n\nconst {\n text,\n hidden = false,\n required = false,\n disabled = false,\n for: forId = undefined,\n id = undefined,\n} = defineProps<FieldLabelProps>();\n\nconst labelStyles = tv({\n slots: {\n root: 'block mb-1 text-sm leading-5 font-medium text-rui-text',\n required: 'text-rui-error',\n },\n variants: {\n hidden: {\n true: { root: 'sr-only' },\n },\n disabled: {\n true: { root: 'text-rui-text-disabled' },\n },\n },\n});\n\nconst ui = computed<ReturnType<typeof labelStyles>>(() => labelStyles({ hidden, disabled }));\n</script>\n\n<template>\n <label\n :id=\"id\"\n :for=\"forId\"\n :class=\"ui.root()\"\n data-id=\"field-label\"\n >\n {{ text }}\n <span\n v-if=\"required\"\n :class=\"ui.required()\"\n aria-hidden=\"true\"\n >\n *\n </span>\n </label>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EA+BA,MAAM,cAAc,GAAG;GACrB,OAAO;IACL,MAAM;IACN,UAAU;GACZ;GACA,UAAU;IACR,QAAQ,EACN,MAAM,EAAE,MAAM,UAAU,EAC1B;IACA,UAAU,EACR,MAAM,EAAE,MAAM,yBAAyB,EACzC;GACF;EACF,CAAC;EAED,MAAM,KAAK,eAA+C,YAAY;GAAE,QAAK,QAAA;GAAG,UAAO,QAAA;EAAE,CAAC,CAAC;;GAIzF,OAAAA,UAAA,GAAAC,mBAcQ,SAAA;IAbL,IAAI,QAAA;IACJ,KAAK,QAAA;IACL,OAAKC,eAAEC,MAAA,EAAA,CAAE,CAAC,KAAI,CAAA;IACf,WAAQ;GAELC,GAAAA,CAAAA,gBAAAC,gBAAA,QAAA,IAAI,IAAG,KACV,CAAA,GACQ,QAAA,YADRL,UAAA,GAAAC,mBAMO,QAAA;;IAJJ,OAAKC,eAAEC,MAAA,EAAA,CAAE,CAAC,SAAQ,CAAA;IACnB,eAAY;GACb,GAAA,OAED,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,IAAA,UAAA"}
1
+ {"version":3,"file":"RuiFieldLabel.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_createTextVNode","_toDisplayString","_createCommentVNode"],"sources":["../../../../src/components/forms/field-label/RuiFieldLabel.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { labelStyles } from './field-label-styles';\n\n/**\n * The label a field shows above itself when its label placement is `top`, or\n * keeps for screen readers alone when it is `hidden`. A text input links it\n * through `for`; a select or picker, whose activator is not a labelable\n * element, points at its `id` with `aria-labelledby` instead.\n */\nexport interface FieldLabelProps {\n text: string;\n hidden?: boolean;\n required?: boolean;\n disabled?: boolean;\n for?: string;\n id?: string;\n}\n\ndefineOptions({\n name: 'RuiFieldLabel',\n});\n\nconst {\n text,\n hidden = false,\n required = false,\n disabled = false,\n for: forId = undefined,\n id = undefined,\n} = defineProps<FieldLabelProps>();\n\nconst ui = computed<ReturnType<typeof labelStyles>>(() => labelStyles({ hidden, disabled }));\n</script>\n\n<template>\n <label\n :id=\"id\"\n :for=\"forId\"\n :class=\"ui.root()\"\n data-id=\"field-label\"\n >\n {{ text }}\n <span\n v-if=\"required\"\n :class=\"ui.required()\"\n aria-hidden=\"true\"\n >\n *\n </span>\n </label>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EA+BA,MAAM,KAAK,eAA+C,YAAY;GAAE,QAAK,QAAA;GAAG,UAAO,QAAA;EAAE,CAAC,CAAC;;GAIzF,OAAAA,UAAA,GAAAC,mBAcQ,SAAA;IAbL,IAAI,QAAA;IACJ,KAAK,QAAA;IACL,OAAKC,eAAEC,MAAA,EAAA,CAAE,CAAC,KAAI,CAAA;IACf,WAAQ;GAELC,GAAAA,CAAAA,gBAAAC,gBAAA,QAAA,IAAI,IAAG,KACV,CAAA,GACQ,QAAA,YADRL,UAAA,GAAAC,mBAMO,QAAA;;IAJJ,OAAKC,eAAEC,MAAA,EAAA,CAAE,CAAC,SAAQ,CAAA;IACnB,eAAY;GACb,GAAA,OAED,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,IAAA,UAAA"}
@@ -0,0 +1,43 @@
1
+ export declare const labelStyles: import("tailwind-variants").TVReturnType<{
2
+ hidden: {
3
+ true: {
4
+ root: string;
5
+ };
6
+ };
7
+ disabled: {
8
+ true: {
9
+ root: string;
10
+ };
11
+ };
12
+ }, {
13
+ root: string;
14
+ required: string;
15
+ }, undefined, {
16
+ hidden: {
17
+ true: {
18
+ root: string;
19
+ };
20
+ };
21
+ disabled: {
22
+ true: {
23
+ root: string;
24
+ };
25
+ };
26
+ }, {
27
+ root: string;
28
+ required: string;
29
+ }, import("tailwind-variants").TVReturnTypeLike<{
30
+ hidden: {
31
+ true: {
32
+ root: string;
33
+ };
34
+ };
35
+ disabled: {
36
+ true: {
37
+ root: string;
38
+ };
39
+ };
40
+ }, {
41
+ root: string;
42
+ required: string;
43
+ }>>;
@@ -0,0 +1,16 @@
1
+ import { tv } from "../../../utils/tv.js";
2
+ //#region src/components/forms/field-label/field-label-styles.ts
3
+ var labelStyles = tv({
4
+ slots: {
5
+ root: "block mb-1 text-sm leading-5 font-medium text-rui-text",
6
+ required: "text-rui-error"
7
+ },
8
+ variants: {
9
+ hidden: { true: { root: "sr-only" } },
10
+ disabled: { true: { root: "text-rui-text-disabled" } }
11
+ }
12
+ });
13
+ //#endregion
14
+ export { labelStyles };
15
+
16
+ //# sourceMappingURL=field-label-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-label-styles.js","names":[],"sources":["../../../../src/components/forms/field-label/field-label-styles.ts"],"sourcesContent":["import { tv } from '@/utils/tv';\n\nexport const labelStyles = tv({\n slots: {\n root: 'block mb-1 text-sm leading-5 font-medium text-rui-text',\n required: 'text-rui-error',\n },\n variants: {\n hidden: {\n true: { root: 'sr-only' },\n },\n disabled: {\n true: { root: 'text-rui-text-disabled' },\n },\n },\n});\n"],"mappings":";;AAEA,IAAa,cAAc,GAAG;CAC5B,OAAO;EACL,MAAM;EACN,UAAU;CACZ;CACA,UAAU;EACR,QAAQ,EACN,MAAM,EAAE,MAAM,UAAU,EAC1B;EACA,UAAU,EACR,MAAM,EAAE,MAAM,yBAAyB,EACzC;CACF;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RuiSimpleSelect.js","names":["_sfc_main"],"sources":["../../../../src/components/forms/select/RuiSimpleSelect.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { tv } from '@/utils/tv';\n\nexport interface Props {\n options: string[] | number[];\n disabled?: boolean;\n label?: string;\n name?: string;\n}\n\ndefineOptions({\n name: 'RuiSimpleSelect',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<string | number>({ required: true });\n\nconst { options, disabled = false, label, name = '' } = defineProps<Props>();\n\n/** The native select dressed as the other fields: a 36px bordered box with their hover, focus and disabled looks. */\nconst selectClass = tv({\n base: [\n 'appearance-none cursor-pointer m-0 w-full h-9 pl-3 pr-8 rounded-rui-control [font:inherit] text-sm text-rui-text',\n 'border border-rui-outline bg-transparent transition-colors',\n 'hover:border-rui-neutral-500 dark:hover:border-rui-neutral-400',\n 'outline-hidden focus-visible:border-rui-primary focus-visible:ring-3 focus-visible:ring-rui-primary/20',\n 'disabled:cursor-default disabled:border-rui-divider disabled:bg-rui-neutral-50 disabled:text-rui-text-disabled',\n 'dark:disabled:bg-rui-neutral-900',\n ].join(' '),\n});\n\nconst ui = computed<string>(() => selectClass());\n</script>\n\n<template>\n <div\n class=\"relative inline-flex\"\n v-bind=\"$attrs\"\n >\n <select\n v-model=\"modelValue\"\n :class=\"ui\"\n :name=\"name\"\n :disabled=\"disabled\"\n :aria-label=\"label\"\n data-id=\"select\"\n >\n <option\n v-for=\"option in options\"\n :key=\"option\"\n :value=\"option\"\n >\n {{ option }}\n </option>\n </select>\n <span\n class=\"flex items-center justify-end absolute right-3 inset-y-0 pointer-events-none\"\n aria-hidden=\"true\"\n >\n <RuiIcon\n class=\"text-rui-text-secondary pointer-events-none\"\n name=\"lu-chevron-down\"\n size=\"16\"\n />\n </span>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"RuiSimpleSelect.js","names":["_sfc_main"],"sources":["../../../../src/components/forms/select/RuiSimpleSelect.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { simpleSelectStyles } from './simple-select-styles';\n\nexport interface Props {\n options: string[] | number[];\n disabled?: boolean;\n label?: string;\n name?: string;\n}\n\ndefineOptions({\n name: 'RuiSimpleSelect',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<string | number>({ required: true });\n\nconst { options, disabled = false, label, name = '' } = defineProps<Props>();\n\nconst ui = computed<string>(() => simpleSelectStyles());\n</script>\n\n<template>\n <div\n class=\"relative inline-flex\"\n v-bind=\"$attrs\"\n >\n <select\n v-model=\"modelValue\"\n :class=\"ui\"\n :name=\"name\"\n :disabled=\"disabled\"\n :aria-label=\"label\"\n data-id=\"select\"\n >\n <option\n v-for=\"option in options\"\n :key=\"option\"\n :value=\"option\"\n >\n {{ option }}\n </option>\n </select>\n <span\n class=\"flex items-center justify-end absolute right-3 inset-y-0 pointer-events-none\"\n aria-hidden=\"true\"\n >\n <RuiIcon\n class=\"text-rui-text-secondary pointer-events-none\"\n name=\"lu-chevron-down\"\n size=\"16\"\n />\n </span>\n </div>\n</template>\n"],"mappings":""}
@@ -1,5 +1,5 @@
1
- import { tv } from "../../../utils/tv.js";
2
1
  import RuiIcon_default from "../../icons/RuiIcon.js";
2
+ import { simpleSelectStyles } from "./simple-select-styles.js";
3
3
  import { Fragment, computed, createElementBlock, createElementVNode, createVNode, defineComponent, mergeModels, mergeProps, normalizeClass, openBlock, renderList, toDisplayString, unref, useModel, vModelSelect, withDirectives } from "vue";
4
4
  //#region src/components/forms/select/RuiSimpleSelect.vue?vue&type=script&setup=true&lang.ts
5
5
  var _hoisted_1 = [
@@ -31,16 +31,7 @@ var RuiSimpleSelect_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
31
31
  emits: ["update:modelValue"],
32
32
  setup(__props) {
33
33
  const modelValue = useModel(__props, "modelValue");
34
- /** The native select dressed as the other fields: a 36px bordered box with their hover, focus and disabled looks. */
35
- const selectClass = tv({ base: [
36
- "appearance-none cursor-pointer m-0 w-full h-9 pl-3 pr-8 rounded-rui-control [font:inherit] text-sm text-rui-text",
37
- "border border-rui-outline bg-transparent transition-colors",
38
- "hover:border-rui-neutral-500 dark:hover:border-rui-neutral-400",
39
- "outline-hidden focus-visible:border-rui-primary focus-visible:ring-3 focus-visible:ring-rui-primary/20",
40
- "disabled:cursor-default disabled:border-rui-divider disabled:bg-rui-neutral-50 disabled:text-rui-text-disabled",
41
- "dark:disabled:bg-rui-neutral-900"
42
- ].join(" ") });
43
- const ui = computed(() => selectClass());
34
+ const ui = computed(() => simpleSelectStyles());
44
35
  return (_ctx, _cache) => {
45
36
  return openBlock(), createElementBlock("div", mergeProps({ class: "relative inline-flex" }, _ctx.$attrs), [withDirectives(createElementVNode("select", {
46
37
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
@@ -1 +1 @@
1
- {"version":3,"file":"RuiSimpleSelect.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useModel","_openBlock","_createElementBlock","_mergeProps","_withDirectives","_createElementVNode","_normalizeClass","_unref","_Fragment","_renderList","_toDisplayString","_vModelSelect","_createVNode","RuiIcon"],"sources":["../../../../src/components/forms/select/RuiSimpleSelect.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { tv } from '@/utils/tv';\n\nexport interface Props {\n options: string[] | number[];\n disabled?: boolean;\n label?: string;\n name?: string;\n}\n\ndefineOptions({\n name: 'RuiSimpleSelect',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<string | number>({ required: true });\n\nconst { options, disabled = false, label, name = '' } = defineProps<Props>();\n\n/** The native select dressed as the other fields: a 36px bordered box with their hover, focus and disabled looks. */\nconst selectClass = tv({\n base: [\n 'appearance-none cursor-pointer m-0 w-full h-9 pl-3 pr-8 rounded-rui-control [font:inherit] text-sm text-rui-text',\n 'border border-rui-outline bg-transparent transition-colors',\n 'hover:border-rui-neutral-500 dark:hover:border-rui-neutral-400',\n 'outline-hidden focus-visible:border-rui-primary focus-visible:ring-3 focus-visible:ring-rui-primary/20',\n 'disabled:cursor-default disabled:border-rui-divider disabled:bg-rui-neutral-50 disabled:text-rui-text-disabled',\n 'dark:disabled:bg-rui-neutral-900',\n ].join(' '),\n});\n\nconst ui = computed<string>(() => selectClass());\n</script>\n\n<template>\n <div\n class=\"relative inline-flex\"\n v-bind=\"$attrs\"\n >\n <select\n v-model=\"modelValue\"\n :class=\"ui\"\n :name=\"name\"\n :disabled=\"disabled\"\n :aria-label=\"label\"\n data-id=\"select\"\n >\n <option\n v-for=\"option in options\"\n :key=\"option\"\n :value=\"option\"\n >\n {{ option }}\n </option>\n </select>\n <span\n class=\"flex items-center justify-end absolute right-3 inset-y-0 pointer-events-none\"\n aria-hidden=\"true\"\n >\n <RuiIcon\n class=\"text-rui-text-secondary pointer-events-none\"\n name=\"lu-chevron-down\"\n size=\"16\"\n />\n </span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBA,MAAM,aAAaC,SAA4B,SAAA,YAAmB;;EAKlE,MAAM,cAAc,GAAG,EACrB,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;EACF,CAAC,CAAC,KAAK,GAAG,EACZ,CAAC;EAED,MAAM,KAAK,eAAuB,YAAY,CAAC;;GAI7C,OAAAC,UAAA,GAAAC,mBA8BM,OA9BNC,WA8BM,EA7BJ,OAAM,uBAAsB,GACpBJ,KAAAA,MAAM,GAAA,CAEdK,eAAAC,mBAeS,UAAA;IAdE,uBAAA,OAAA,OAAA,OAAA,MAAA,WAAA,WAAU,QAAA;IAClB,OAAKC,eAAEC,MAAA,EAAA,CAAE;IACT,MAAM,QAAA;IACN,UAAU,QAAA;IACV,cAAY,QAAA;IACb,WAAQ;GAERN,GAAAA,EAAAA,UAAA,IAAA,GAAAC,mBAMSM,UAAA,MAAAC,WALU,QAAA,UAAV,WAAM;IADf,OAAAR,UAAA,GAAAC,mBAMS,UAAA;KAJN,KAAK;KACL,OAAO;IAEL,GAAAQ,gBAAA,MAAM,GAAA,GAAA,UAAA;GAZF,CAAA,GAAA,GAAA,EAAA,GAAA,IAAA,UAAA,GAAA,CAAA,CAAAC,cAAA,WAAA,KAAU,CAAA,CAAA,GAerBN,mBASO,QATP,YASO,CALLO,YAIEC,iBAAA;IAHA,OAAM;IACN,MAAK;IACL,MAAK"}
1
+ {"version":3,"file":"RuiSimpleSelect.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useModel","_openBlock","_createElementBlock","_mergeProps","_withDirectives","_createElementVNode","_normalizeClass","_unref","_Fragment","_renderList","_toDisplayString","_vModelSelect","_createVNode","RuiIcon"],"sources":["../../../../src/components/forms/select/RuiSimpleSelect.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { simpleSelectStyles } from './simple-select-styles';\n\nexport interface Props {\n options: string[] | number[];\n disabled?: boolean;\n label?: string;\n name?: string;\n}\n\ndefineOptions({\n name: 'RuiSimpleSelect',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<string | number>({ required: true });\n\nconst { options, disabled = false, label, name = '' } = defineProps<Props>();\n\nconst ui = computed<string>(() => simpleSelectStyles());\n</script>\n\n<template>\n <div\n class=\"relative inline-flex\"\n v-bind=\"$attrs\"\n >\n <select\n v-model=\"modelValue\"\n :class=\"ui\"\n :name=\"name\"\n :disabled=\"disabled\"\n :aria-label=\"label\"\n data-id=\"select\"\n >\n <option\n v-for=\"option in options\"\n :key=\"option\"\n :value=\"option\"\n >\n {{ option }}\n </option>\n </select>\n <span\n class=\"flex items-center justify-end absolute right-3 inset-y-0 pointer-events-none\"\n aria-hidden=\"true\"\n >\n <RuiIcon\n class=\"text-rui-text-secondary pointer-events-none\"\n name=\"lu-chevron-down\"\n size=\"16\"\n />\n </span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBA,MAAM,aAAaC,SAA4B,SAAA,YAAmB;EAIlE,MAAM,KAAK,eAAuB,mBAAmB,CAAC;;GAIpD,OAAAC,UAAA,GAAAC,mBA8BM,OA9BNC,WA8BM,EA7BJ,OAAM,uBAAsB,GACpBJ,KAAAA,MAAM,GAAA,CAEdK,eAAAC,mBAeS,UAAA;IAdE,uBAAA,OAAA,OAAA,OAAA,MAAA,WAAA,WAAU,QAAA;IAClB,OAAKC,eAAEC,MAAA,EAAA,CAAE;IACT,MAAM,QAAA;IACN,UAAU,QAAA;IACV,cAAY,QAAA;IACb,WAAQ;GAERN,GAAAA,EAAAA,UAAA,IAAA,GAAAC,mBAMSM,UAAA,MAAAC,WALU,QAAA,UAAV,WAAM;IADf,OAAAR,UAAA,GAAAC,mBAMS,UAAA;KAJN,KAAK;KACL,OAAO;IAEL,GAAAQ,gBAAA,MAAM,GAAA,GAAA,UAAA;GAZF,CAAA,GAAA,GAAA,EAAA,GAAA,IAAA,UAAA,GAAA,CAAA,CAAAC,cAAA,WAAA,KAAU,CAAA,CAAA,GAerBN,mBASO,QATP,YASO,CALLO,YAIEC,iBAAA;IAHA,OAAM;IACN,MAAK;IACL,MAAK"}
@@ -0,0 +1,2 @@
1
+ /** The native select dressed as the other fields: a 36px bordered box with their hover, focus and disabled looks. */
2
+ export declare const simpleSelectStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string, {} | {}, undefined, import("tailwind-variants").TVReturnTypeLike<unknown, undefined>>;
@@ -0,0 +1,15 @@
1
+ import { tv } from "../../../utils/tv.js";
2
+ //#region src/components/forms/select/simple-select-styles.ts
3
+ /** The native select dressed as the other fields: a 36px bordered box with their hover, focus and disabled looks. */
4
+ var simpleSelectStyles = tv({ base: [
5
+ "appearance-none cursor-pointer m-0 w-full h-9 pl-3 pr-8 rounded-rui-control [font:inherit] text-sm text-rui-text",
6
+ "border border-rui-outline bg-transparent transition-colors",
7
+ "hover:border-rui-neutral-500 dark:hover:border-rui-neutral-400",
8
+ "outline-hidden focus-visible:border-rui-primary focus-visible:ring-3 focus-visible:ring-rui-primary/20",
9
+ "disabled:cursor-default disabled:border-rui-divider disabled:bg-rui-neutral-50 disabled:text-rui-text-disabled",
10
+ "dark:disabled:bg-rui-neutral-900"
11
+ ].join(" ") });
12
+ //#endregion
13
+ export { simpleSelectStyles };
14
+
15
+ //# sourceMappingURL=simple-select-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-select-styles.js","names":[],"sources":["../../../../src/components/forms/select/simple-select-styles.ts"],"sourcesContent":["import { tv } from '@/utils/tv';\n\n/** The native select dressed as the other fields: a 36px bordered box with their hover, focus and disabled looks. */\nexport const simpleSelectStyles = tv({\n base: [\n 'appearance-none cursor-pointer m-0 w-full h-9 pl-3 pr-8 rounded-rui-control [font:inherit] text-sm text-rui-text',\n 'border border-rui-outline bg-transparent transition-colors',\n 'hover:border-rui-neutral-500 dark:hover:border-rui-neutral-400',\n 'outline-hidden focus-visible:border-rui-primary focus-visible:ring-3 focus-visible:ring-rui-primary/20',\n 'disabled:cursor-default disabled:border-rui-divider disabled:bg-rui-neutral-50 disabled:text-rui-text-disabled',\n 'dark:disabled:bg-rui-neutral-900',\n ].join(' '),\n});\n"],"mappings":";;;AAGA,IAAa,qBAAqB,GAAG,EACnC,MAAM;CACJ;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,GAAG,EACZ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RuiSwitch.js","names":["_sfc_main"],"sources":["../../../../src/components/forms/switch/RuiSwitch.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ContextColorsType } from '@/consts/colors';\nimport RuiFormTextDetail from '@/components/helpers/RuiFormTextDetail.vue';\nimport { type FormDetails, useFormDetails, useFormTextDetail } from '@/utils/form-text-detail';\nimport { getNonRootAttrs, getRootAttrs } from '@/utils/helpers';\nimport { tv } from '@/utils/tv';\n\nexport interface Props {\n disabled?: boolean;\n color?: ContextColorsType;\n size?: 'sm';\n label?: string;\n hint?: string;\n errorMessages?: string | string[];\n successMessages?: string | string[];\n /** The line under the control for its hint and messages: `reserve`, `auto` or `hidden`; falls back to the nearest `RuiFieldDefaults`, then the app default, then `reserve`. */\n details?: FormDetails;\n /** @deprecated Use `details=\"hidden\"`. Removed in 4.0. */\n hideDetails?: boolean;\n /** Puts the hint or message under the label text instead of under the track, so a list of switches keeps one text column. */\n detailsUnderLabel?: boolean;\n required?: boolean;\n}\n\ndefineOptions({\n name: 'RuiSwitch',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<boolean>({ default: false });\n\nconst {\n disabled = false,\n color = undefined,\n size = undefined,\n label = '',\n hint = '',\n errorMessages = [],\n successMessages = [],\n details = undefined,\n hideDetails = false,\n detailsUnderLabel = false,\n required = false,\n} = defineProps<Props>();\n\ndefineSlots<{\n default?: () => any;\n}>();\n\nconst 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\nconst { hasError, validation } = useFormTextDetail(\n () => errorMessages,\n () => successMessages,\n);\nconst detailsMode = useFormDetails(() => details, () => hideDetails);\n\nconst ui = computed<ReturnType<typeof switchStyles>>(() => switchStyles({\n checked: get(modelValue),\n disabled,\n size,\n validation: get(validation),\n color,\n underLabel: detailsUnderLabel,\n}));\n\nfunction input(event: Event): void {\n const target = event.target;\n if (target instanceof HTMLInputElement)\n set(modelValue, target.checked);\n}\n</script>\n\n<template>\n <div v-bind=\"getRootAttrs($attrs)\">\n <label\n :class=\"ui.wrapper()\"\n :data-disabled=\"disabled || undefined\"\n :data-checked=\"modelValue || undefined\"\n :data-error=\"hasError ? '' : undefined\"\n >\n <div :class=\"ui.inner()\">\n <input\n :checked=\"modelValue\"\n type=\"checkbox\"\n :class=\"ui.input()\"\n :disabled=\"disabled\"\n :aria-invalid=\"hasError\"\n v-bind=\"getNonRootAttrs($attrs)\"\n @input=\"input($event)\"\n />\n <div :class=\"ui.toggle()\" />\n </div>\n <span\n v-if=\"label || $slots.default\"\n :class=\"ui.label()\"\n >\n <slot>{{ label }}</slot>\n <span\n v-if=\"required\"\n class=\"text-rui-error\"\n >\n *\n </span>\n </span>\n </label>\n <RuiFormTextDetail\n v-if=\"detailsMode !== 'hidden'\"\n :class=\"ui.details()\"\n :details=\"detailsMode\"\n :error-messages=\"errorMessages\"\n :success-messages=\"successMessages\"\n :hint=\"hint\"\n />\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"RuiSwitch.js","names":["_sfc_main"],"sources":["../../../../src/components/forms/switch/RuiSwitch.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ContextColorsType } from '@/consts/colors';\nimport RuiFormTextDetail from '@/components/helpers/RuiFormTextDetail.vue';\nimport { type FormDetails, useFormDetails, useFormTextDetail } from '@/utils/form-text-detail';\nimport { getNonRootAttrs, getRootAttrs } from '@/utils/helpers';\nimport { switchStyles } from './switch-styles';\n\nexport interface Props {\n disabled?: boolean;\n color?: ContextColorsType;\n size?: 'sm';\n label?: string;\n hint?: string;\n errorMessages?: string | string[];\n successMessages?: string | string[];\n /** The line under the control for its hint and messages: `reserve`, `auto` or `hidden`; falls back to the nearest `RuiFieldDefaults`, then the app default, then `reserve`. */\n details?: FormDetails;\n /** @deprecated Use `details=\"hidden\"`. Removed in 4.0. */\n hideDetails?: boolean;\n /** Puts the hint or message under the label text instead of under the track, so a list of switches keeps one text column. */\n detailsUnderLabel?: boolean;\n required?: boolean;\n}\n\ndefineOptions({\n name: 'RuiSwitch',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<boolean>({ default: false });\n\nconst {\n disabled = false,\n color = undefined,\n size = undefined,\n label = '',\n hint = '',\n errorMessages = [],\n successMessages = [],\n details = undefined,\n hideDetails = false,\n detailsUnderLabel = false,\n required = false,\n} = defineProps<Props>();\n\ndefineSlots<{\n default?: () => any;\n}>();\n\nconst { hasError, validation } = useFormTextDetail(\n () => errorMessages,\n () => successMessages,\n);\nconst detailsMode = useFormDetails(() => details, () => hideDetails);\n\nconst ui = computed<ReturnType<typeof switchStyles>>(() => switchStyles({\n checked: get(modelValue),\n disabled,\n size,\n validation: get(validation),\n color,\n underLabel: detailsUnderLabel,\n}));\n\nfunction input(event: Event): void {\n const target = event.target;\n if (target instanceof HTMLInputElement)\n set(modelValue, target.checked);\n}\n</script>\n\n<template>\n <div v-bind=\"getRootAttrs($attrs)\">\n <label\n :class=\"ui.wrapper()\"\n :data-disabled=\"disabled || undefined\"\n :data-checked=\"modelValue || undefined\"\n :data-error=\"hasError ? '' : undefined\"\n >\n <div :class=\"ui.inner()\">\n <input\n :checked=\"modelValue\"\n type=\"checkbox\"\n :class=\"ui.input()\"\n :disabled=\"disabled\"\n :aria-invalid=\"hasError\"\n v-bind=\"getNonRootAttrs($attrs)\"\n @input=\"input($event)\"\n />\n <div :class=\"ui.toggle()\" />\n </div>\n <span\n v-if=\"label || $slots.default\"\n :class=\"ui.label()\"\n >\n <slot>{{ label }}</slot>\n <span\n v-if=\"required\"\n class=\"text-rui-error\"\n >\n *\n </span>\n </span>\n </label>\n <RuiFormTextDetail\n v-if=\"detailsMode !== 'hidden'\"\n :class=\"ui.details()\"\n :details=\"detailsMode\"\n :error-messages=\"errorMessages\"\n :success-messages=\"successMessages\"\n :hint=\"hint\"\n />\n </div>\n</template>\n"],"mappings":""}
@@ -1,8 +1,8 @@
1
1
  import { get, set } from "../../../vendor/@vueuse/shared/dist/index.js";
2
- import { tv } from "../../../utils/tv.js";
3
2
  import { useFormDetails, useFormTextDetail } from "../../../utils/form-text-detail.js";
4
3
  import RuiFormTextDetail_default from "../../helpers/RuiFormTextDetail.js";
5
4
  import { getNonRootAttrs, getRootAttrs } from "../../../utils/helpers.js";
5
+ import { switchStyles } from "./switch-styles.js";
6
6
  import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeClass, normalizeProps, openBlock, renderSlot, toDisplayString, unref, useModel } from "vue";
7
7
  //#region src/components/forms/switch/RuiSwitch.vue?vue&type=script&setup=true&lang.ts
8
8
  var _hoisted_1 = [
@@ -57,131 +57,6 @@ var RuiSwitch_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
57
57
  emits: ["update:modelValue"],
58
58
  setup(__props) {
59
59
  const modelValue = useModel(__props, "modelValue");
60
- const switchStyles = tv({
61
- slots: {
62
- wrapper: "relative flex gap-3.25 items-start cursor-pointer group/switch",
63
- inner: "relative w-10 h-5.5 mt-px shrink-0",
64
- input: "peer appearance-none relative w-full h-full rounded-full bg-rui-outline transition-colors duration-150 cursor-pointer focus-visible:focus-ring",
65
- 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(" "),
66
- label: "text-rui-text text-sm/6",
67
- details: ""
68
- },
69
- variants: {
70
- underLabel: {
71
- true: { details: "pl-13.25" },
72
- false: {}
73
- },
74
- checked: {
75
- true: { toggle: "left-5" },
76
- false: {}
77
- },
78
- disabled: { true: {
79
- wrapper: "cursor-not-allowed",
80
- input: "bg-rui-neutral-200! dark:bg-rui-neutral-800! cursor-not-allowed",
81
- toggle: "bg-rui-neutral-50! dark:bg-rui-neutral-600! shadow-none!",
82
- label: "text-rui-text-disabled"
83
- } },
84
- size: { sm: {
85
- inner: "w-8.5 h-4.5 mt-0.75",
86
- toggle: "size-3.5"
87
- } },
88
- validation: {
89
- error: { input: "ring-1 ring-rui-error" },
90
- success: { input: "ring-1 ring-rui-success" }
91
- },
92
- color: {
93
- primary: {},
94
- secondary: {},
95
- error: {},
96
- warning: {},
97
- info: {},
98
- success: {}
99
- }
100
- },
101
- compoundVariants: [
102
- {
103
- checked: false,
104
- disabled: false,
105
- class: { input: "group-hover/switch:bg-rui-neutral-500 dark:group-hover/switch:bg-rui-neutral-400" }
106
- },
107
- {
108
- checked: true,
109
- disabled: false,
110
- class: {
111
- input: "bg-rui-neutral-900 dark:bg-rui-neutral-100",
112
- toggle: "dark:bg-rui-neutral-900"
113
- }
114
- },
115
- {
116
- checked: true,
117
- disabled: false,
118
- color: "primary",
119
- class: {
120
- input: "bg-rui-primary dark:bg-rui-primary",
121
- toggle: "dark:bg-white"
122
- }
123
- },
124
- {
125
- checked: true,
126
- disabled: false,
127
- color: "secondary",
128
- class: {
129
- input: "bg-rui-secondary dark:bg-rui-secondary",
130
- toggle: "dark:bg-white"
131
- }
132
- },
133
- {
134
- checked: true,
135
- disabled: false,
136
- color: "error",
137
- class: {
138
- input: "bg-rui-error dark:bg-rui-error-darker",
139
- toggle: "dark:bg-white"
140
- }
141
- },
142
- {
143
- checked: true,
144
- disabled: false,
145
- color: "warning",
146
- class: {
147
- input: "bg-rui-warning dark:bg-rui-warning-darker",
148
- toggle: "dark:bg-white"
149
- }
150
- },
151
- {
152
- checked: true,
153
- disabled: false,
154
- color: "info",
155
- class: {
156
- input: "bg-rui-info dark:bg-rui-info-darker",
157
- toggle: "dark:bg-white"
158
- }
159
- },
160
- {
161
- checked: true,
162
- disabled: false,
163
- color: "success",
164
- class: {
165
- input: "bg-rui-success dark:bg-rui-success-darker",
166
- toggle: "dark:bg-white"
167
- }
168
- },
169
- {
170
- size: "sm",
171
- checked: true,
172
- class: { toggle: "left-4.5" }
173
- },
174
- {
175
- size: "sm",
176
- underLabel: true,
177
- class: { details: "pl-11.75" }
178
- }
179
- ],
180
- defaultVariants: {
181
- checked: false,
182
- disabled: false
183
- }
184
- });
185
60
  const { hasError, validation } = useFormTextDetail(() => __props.errorMessages, () => __props.successMessages);
186
61
  const detailsMode = useFormDetails(() => __props.details, () => __props.hideDetails);
187
62
  const ui = computed(() => switchStyles({
@@ -1 +1 @@
1
- {"version":3,"file":"RuiSwitch.vue_vue_type_script_setup_true_lang.js","names":["$attrs","$slots","_useModel","_openBlock","_createElementBlock","_normalizeProps","_guardReactiveProps","_unref","_createElementVNode","_normalizeClass","_mergeProps","_renderSlot","_createTextVNode","_toDisplayString","_createCommentVNode","_createBlock","RuiFormTextDetail"],"sources":["../../../../src/components/forms/switch/RuiSwitch.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ContextColorsType } from '@/consts/colors';\nimport RuiFormTextDetail from '@/components/helpers/RuiFormTextDetail.vue';\nimport { type FormDetails, useFormDetails, useFormTextDetail } from '@/utils/form-text-detail';\nimport { getNonRootAttrs, getRootAttrs } from '@/utils/helpers';\nimport { tv } from '@/utils/tv';\n\nexport interface Props {\n disabled?: boolean;\n color?: ContextColorsType;\n size?: 'sm';\n label?: string;\n hint?: string;\n errorMessages?: string | string[];\n successMessages?: string | string[];\n /** The line under the control for its hint and messages: `reserve`, `auto` or `hidden`; falls back to the nearest `RuiFieldDefaults`, then the app default, then `reserve`. */\n details?: FormDetails;\n /** @deprecated Use `details=\"hidden\"`. Removed in 4.0. */\n hideDetails?: boolean;\n /** Puts the hint or message under the label text instead of under the track, so a list of switches keeps one text column. */\n detailsUnderLabel?: boolean;\n required?: boolean;\n}\n\ndefineOptions({\n name: 'RuiSwitch',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<boolean>({ default: false });\n\nconst {\n disabled = false,\n color = undefined,\n size = undefined,\n label = '',\n hint = '',\n errorMessages = [],\n successMessages = [],\n details = undefined,\n hideDetails = false,\n detailsUnderLabel = false,\n required = false,\n} = defineProps<Props>();\n\ndefineSlots<{\n default?: () => any;\n}>();\n\nconst 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\nconst { hasError, validation } = useFormTextDetail(\n () => errorMessages,\n () => successMessages,\n);\nconst detailsMode = useFormDetails(() => details, () => hideDetails);\n\nconst ui = computed<ReturnType<typeof switchStyles>>(() => switchStyles({\n checked: get(modelValue),\n disabled,\n size,\n validation: get(validation),\n color,\n underLabel: detailsUnderLabel,\n}));\n\nfunction input(event: Event): void {\n const target = event.target;\n if (target instanceof HTMLInputElement)\n set(modelValue, target.checked);\n}\n</script>\n\n<template>\n <div v-bind=\"getRootAttrs($attrs)\">\n <label\n :class=\"ui.wrapper()\"\n :data-disabled=\"disabled || undefined\"\n :data-checked=\"modelValue || undefined\"\n :data-error=\"hasError ? '' : undefined\"\n >\n <div :class=\"ui.inner()\">\n <input\n :checked=\"modelValue\"\n type=\"checkbox\"\n :class=\"ui.input()\"\n :disabled=\"disabled\"\n :aria-invalid=\"hasError\"\n v-bind=\"getNonRootAttrs($attrs)\"\n @input=\"input($event)\"\n />\n <div :class=\"ui.toggle()\" />\n </div>\n <span\n v-if=\"label || $slots.default\"\n :class=\"ui.label()\"\n >\n <slot>{{ label }}</slot>\n <span\n v-if=\"required\"\n class=\"text-rui-error\"\n >\n *\n </span>\n </span>\n </label>\n <RuiFormTextDetail\n v-if=\"detailsMode !== 'hidden'\"\n :class=\"ui.details()\"\n :details=\"detailsMode\"\n :error-messages=\"errorMessages\"\n :success-messages=\"successMessages\"\n :hint=\"hint\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BA,MAAM,aAAaE,SAAoB,SAAA,YAAmB;EAoB1D,MAAM,eAAe,GAAG;GACtB,OAAO;IAEL,SAAS;IAET,OAAO;IAEP,OAAO;IACP,QAAQ,CACN,sHACA,sCACF,CAAC,CAAC,KAAK,GAAG;IACV,OAAO;IACP,SAAS;GACX;GACA,UAAU;IAER,YAAY;KACV,MAAM,EAAE,SAAS,WAAW;KAC5B,OAAO,CAAC;IACV;IACA,SAAS;KACP,MAAM,EACJ,QAAQ,SACV;KACA,OAAO,CAAC;IACV;IACA,UAAU,EACR,MAAM;KACJ,SAAS;KACT,OAAO;KACP,QAAQ;KACR,OAAO;IACT,EACF;IACA,MAAM,EACJ,IAAI;KACF,OAAO;KACP,QAAQ;IACV,EACF;IAEA,YAAY;KACV,OAAO,EACL,OAAO,wBACT;KACA,SAAS,EACP,OAAO,0BACT;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;IAChB;KAAE,SAAS;KAAO,UAAU;KAAO,OAAO,EAAE,OAAO,mFAAmF;IAAE;IAGxI;KAAE,SAAS;KAAM,UAAU;KAAO,OAAO;MAAE,OAAO;MAA8C,QAAQ;KAA0B;IAAE;IAGpI;KAAE,SAAS;KAAM,UAAU;KAAO,OAAO;KAAW,OAAO;MAAE,OAAO;MAAsC,QAAQ;KAAgB;IAAE;IACpI;KAAE,SAAS;KAAM,UAAU;KAAO,OAAO;KAAa,OAAO;MAAE,OAAO;MAA0C,QAAQ;KAAgB;IAAE;IAE1I;KAAE,SAAS;KAAM,UAAU;KAAO,OAAO;KAAS,OAAO;MAAE,OAAO;MAAyC,QAAQ;KAAgB;IAAE;IACrI;KAAE,SAAS;KAAM,UAAU;KAAO,OAAO;KAAW,OAAO;MAAE,OAAO;MAA6C,QAAQ;KAAgB;IAAE;IAC3I;KAAE,SAAS;KAAM,UAAU;KAAO,OAAO;KAAQ,OAAO;MAAE,OAAO;MAAuC,QAAQ;KAAgB;IAAE;IAClI;KAAE,SAAS;KAAM,UAAU;KAAO,OAAO;KAAW,OAAO;MAAE,OAAO;MAA6C,QAAQ;KAAgB;IAAE;IAG3I;KAAE,MAAM;KAAM,SAAS;KAAM,OAAO,EAAE,QAAQ,WAAW;IAAE;IAE3D;KAAE,MAAM;KAAM,YAAY;KAAM,OAAO,EAAE,SAAS,WAAW;IAAE;GACjE;GACA,iBAAiB;IACf,SAAS;IACT,UAAU;GACZ;EACF,CAAC;EAED,MAAM,EAAE,UAAU,eAAe,wBACzB,QAAA,qBACA,QAAA,eACR;EACA,MAAM,cAAc,qBAAqB,QAAA,eAAe,QAAA,WAAW;EAEnE,MAAM,KAAK,eAAgD,aAAa;GACtE,SAAS,IAAI,UAAU;GACvB,UAAO,QAAA;GACP,MAAG,QAAA;GACH,YAAY,IAAI,UAAU;GAC1B,OAAI,QAAA;GACJ,YAAY,QAAA;EACd,CAAC,CAAC;EAEF,SAAS,MAAM,OAAoB;GACjC,MAAM,SAAS,MAAM;GACrB,IAAI,kBAAkB,kBACpB,IAAI,YAAY,OAAO,OAAO;EAClC;;GAIE,OAAAC,UAAA,GAAAC,mBAwCM,OAAAC,eAAAC,mBAxCOC,MAAA,YAAA,CAAY,CAACP,KAAAA,MAAM,CAAA,CAAA,GAAA,CAC9BQ,mBA8BQ,SAAA;IA7BL,OAAKC,eAAEF,MAAA,EAAA,CAAE,CAAC,QAAO,CAAA;IACjB,iBAAe,QAAA,YAAY,KAAA;IAC3B,gBAAc,WAAA,SAAc,KAAA;IAC5B,cAAYA,MAAA,QAAA,IAAQ,KAAQ,KAAA;GAE7BC,GAAAA,CAAAA,mBAWM,OAAA,EAXA,OAAKC,eAAEF,MAAA,EAAA,CAAE,CAAC,MAAK,CAAA,EAAA,GAAA,CACnBC,mBAQE,SARFE,WAQE;IAPC,SAAS,WAAA;IACV,MAAK;IACJ,OAAOH,MAAA,EAAA,CAAE,CAAC,MAAK;IACf,UAAU,QAAA;IACV,gBAAcA,MAAA,QAAA;GACP,GAAAA,MAAA,eAAA,CAAe,CAACP,KAAAA,MAAM,GAAA,EAC7B,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAM,MAAM,GAAA,CAAA,GAAA,MAAA,IAAA,UAAA,GAEtBQ,mBAA4B,OAAA,EAAtB,OAAKC,eAAEF,MAAA,EAAA,CAAE,CAAC,OAAM,CAAA,EAAA,GAAA,MAAA,CAAA,CAAA,GAAA,CAAA,GAGhB,QAAA,SAASN,KAAAA,OAAO,WADxBE,UAAA,GAAAC,mBAWO,QAAA;;IATJ,OAAKK,eAAEF,MAAA,EAAA,CAAE,CAAC,MAAK,CAAA;GAEhBI,GAAAA,CAAAA,WAAwB,KAAA,QAAA,WAAA,CAAA,SAAA,CAAfC,gBAAAC,gBAAA,QAAA,KAAK,GAAA,CAAA,CAAA,CAAA,GAEN,QAAA,YADRV,UAAA,GAAAC,mBAKO,QALP,YAGC,KAED,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,IAAA,UAAA,GAIIG,MAAA,WAAA,MAAW,YADnBJ,UAAA,GAAAY,YAOEC,2BAAA;;IALC,OAAKP,eAAEF,MAAA,EAAA,CAAE,CAAC,QAAO,CAAA;IACjB,SAASA,MAAA,WAAA;IACT,kBAAgB,QAAA;IAChB,oBAAkB,QAAA;IAClB,MAAM,QAAA"}
1
+ {"version":3,"file":"RuiSwitch.vue_vue_type_script_setup_true_lang.js","names":["$attrs","$slots","_useModel","_openBlock","_createElementBlock","_normalizeProps","_guardReactiveProps","_unref","_createElementVNode","_normalizeClass","_mergeProps","_renderSlot","_createTextVNode","_toDisplayString","_createCommentVNode","_createBlock","RuiFormTextDetail"],"sources":["../../../../src/components/forms/switch/RuiSwitch.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ContextColorsType } from '@/consts/colors';\nimport RuiFormTextDetail from '@/components/helpers/RuiFormTextDetail.vue';\nimport { type FormDetails, useFormDetails, useFormTextDetail } from '@/utils/form-text-detail';\nimport { getNonRootAttrs, getRootAttrs } from '@/utils/helpers';\nimport { switchStyles } from './switch-styles';\n\nexport interface Props {\n disabled?: boolean;\n color?: ContextColorsType;\n size?: 'sm';\n label?: string;\n hint?: string;\n errorMessages?: string | string[];\n successMessages?: string | string[];\n /** The line under the control for its hint and messages: `reserve`, `auto` or `hidden`; falls back to the nearest `RuiFieldDefaults`, then the app default, then `reserve`. */\n details?: FormDetails;\n /** @deprecated Use `details=\"hidden\"`. Removed in 4.0. */\n hideDetails?: boolean;\n /** Puts the hint or message under the label text instead of under the track, so a list of switches keeps one text column. */\n detailsUnderLabel?: boolean;\n required?: boolean;\n}\n\ndefineOptions({\n name: 'RuiSwitch',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<boolean>({ default: false });\n\nconst {\n disabled = false,\n color = undefined,\n size = undefined,\n label = '',\n hint = '',\n errorMessages = [],\n successMessages = [],\n details = undefined,\n hideDetails = false,\n detailsUnderLabel = false,\n required = false,\n} = defineProps<Props>();\n\ndefineSlots<{\n default?: () => any;\n}>();\n\nconst { hasError, validation } = useFormTextDetail(\n () => errorMessages,\n () => successMessages,\n);\nconst detailsMode = useFormDetails(() => details, () => hideDetails);\n\nconst ui = computed<ReturnType<typeof switchStyles>>(() => switchStyles({\n checked: get(modelValue),\n disabled,\n size,\n validation: get(validation),\n color,\n underLabel: detailsUnderLabel,\n}));\n\nfunction input(event: Event): void {\n const target = event.target;\n if (target instanceof HTMLInputElement)\n set(modelValue, target.checked);\n}\n</script>\n\n<template>\n <div v-bind=\"getRootAttrs($attrs)\">\n <label\n :class=\"ui.wrapper()\"\n :data-disabled=\"disabled || undefined\"\n :data-checked=\"modelValue || undefined\"\n :data-error=\"hasError ? '' : undefined\"\n >\n <div :class=\"ui.inner()\">\n <input\n :checked=\"modelValue\"\n type=\"checkbox\"\n :class=\"ui.input()\"\n :disabled=\"disabled\"\n :aria-invalid=\"hasError\"\n v-bind=\"getNonRootAttrs($attrs)\"\n @input=\"input($event)\"\n />\n <div :class=\"ui.toggle()\" />\n </div>\n <span\n v-if=\"label || $slots.default\"\n :class=\"ui.label()\"\n >\n <slot>{{ label }}</slot>\n <span\n v-if=\"required\"\n class=\"text-rui-error\"\n >\n *\n </span>\n </span>\n </label>\n <RuiFormTextDetail\n v-if=\"detailsMode !== 'hidden'\"\n :class=\"ui.details()\"\n :details=\"detailsMode\"\n :error-messages=\"errorMessages\"\n :success-messages=\"successMessages\"\n :hint=\"hint\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BA,MAAM,aAAaE,SAAoB,SAAA,YAAmB;EAoB1D,MAAM,EAAE,UAAU,eAAe,wBACzB,QAAA,qBACA,QAAA,eACR;EACA,MAAM,cAAc,qBAAqB,QAAA,eAAe,QAAA,WAAW;EAEnE,MAAM,KAAK,eAAgD,aAAa;GACtE,SAAS,IAAI,UAAU;GACvB,UAAO,QAAA;GACP,MAAG,QAAA;GACH,YAAY,IAAI,UAAU;GAC1B,OAAI,QAAA;GACJ,YAAY,QAAA;EACd,CAAC,CAAC;EAEF,SAAS,MAAM,OAAoB;GACjC,MAAM,SAAS,MAAM;GACrB,IAAI,kBAAkB,kBACpB,IAAI,YAAY,OAAO,OAAO;EAClC;;GAIE,OAAAC,UAAA,GAAAC,mBAwCM,OAAAC,eAAAC,mBAxCOC,MAAA,YAAA,CAAY,CAACP,KAAAA,MAAM,CAAA,CAAA,GAAA,CAC9BQ,mBA8BQ,SAAA;IA7BL,OAAKC,eAAEF,MAAA,EAAA,CAAE,CAAC,QAAO,CAAA;IACjB,iBAAe,QAAA,YAAY,KAAA;IAC3B,gBAAc,WAAA,SAAc,KAAA;IAC5B,cAAYA,MAAA,QAAA,IAAQ,KAAQ,KAAA;GAE7BC,GAAAA,CAAAA,mBAWM,OAAA,EAXA,OAAKC,eAAEF,MAAA,EAAA,CAAE,CAAC,MAAK,CAAA,EAAA,GAAA,CACnBC,mBAQE,SARFE,WAQE;IAPC,SAAS,WAAA;IACV,MAAK;IACJ,OAAOH,MAAA,EAAA,CAAE,CAAC,MAAK;IACf,UAAU,QAAA;IACV,gBAAcA,MAAA,QAAA;GACP,GAAAA,MAAA,eAAA,CAAe,CAACP,KAAAA,MAAM,GAAA,EAC7B,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAM,MAAM,GAAA,CAAA,GAAA,MAAA,IAAA,UAAA,GAEtBQ,mBAA4B,OAAA,EAAtB,OAAKC,eAAEF,MAAA,EAAA,CAAE,CAAC,OAAM,CAAA,EAAA,GAAA,MAAA,CAAA,CAAA,GAAA,CAAA,GAGhB,QAAA,SAASN,KAAAA,OAAO,WADxBE,UAAA,GAAAC,mBAWO,QAAA;;IATJ,OAAKK,eAAEF,MAAA,EAAA,CAAE,CAAC,MAAK,CAAA;GAEhBI,GAAAA,CAAAA,WAAwB,KAAA,QAAA,WAAA,CAAA,SAAA,CAAfC,gBAAAC,gBAAA,QAAA,KAAK,GAAA,CAAA,CAAA,CAAA,GAEN,QAAA,YADRV,UAAA,GAAAC,mBAKO,QALP,YAGC,KAED,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,IAAA,UAAA,GAIIG,MAAA,WAAA,MAAW,YADnBJ,UAAA,GAAAY,YAOEC,2BAAA;;IALC,OAAKP,eAAEF,MAAA,EAAA,CAAE,CAAC,QAAO,CAAA;IACjB,SAASA,MAAA,WAAA;IACT,kBAAgB,QAAA;IAChB,oBAAkB,QAAA;IAClB,MAAM,QAAA"}