@mantine/core 9.6.2 → 9.7.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 (436) hide show
  1. package/cjs/components/ActionBar/ActionBar.cjs +0 -3
  2. package/cjs/components/ActionBar/ActionBar.cjs.map +1 -1
  3. package/cjs/components/ActionBar/ActionBar.module.cjs.map +1 -1
  4. package/cjs/components/AppShell/AppShell.cjs +33 -6
  5. package/cjs/components/AppShell/AppShell.cjs.map +1 -1
  6. package/cjs/components/AppShell/AppShell.context.cjs.map +1 -1
  7. package/cjs/components/AppShell/AppShell.module.cjs +2 -1
  8. package/cjs/components/AppShell/AppShell.module.cjs.map +1 -1
  9. package/cjs/components/AppShell/AppShellAside/AppShellAside.cjs +28 -7
  10. package/cjs/components/AppShell/AppShellAside/AppShellAside.cjs.map +1 -1
  11. package/cjs/components/AppShell/AppShellFooter/AppShellFooter.cjs +28 -7
  12. package/cjs/components/AppShell/AppShellFooter/AppShellFooter.cjs.map +1 -1
  13. package/cjs/components/AppShell/AppShellHeader/AppShellHeader.cjs +28 -7
  14. package/cjs/components/AppShell/AppShellHeader/AppShellHeader.cjs.map +1 -1
  15. package/cjs/components/AppShell/AppShellMediaStyles/AppShellMediaStyles.cjs +3 -2
  16. package/cjs/components/AppShell/AppShellMediaStyles/AppShellMediaStyles.cjs.map +1 -1
  17. package/cjs/components/AppShell/AppShellMediaStyles/assign-aside-variables/assign-aside-variables.cjs +27 -16
  18. package/cjs/components/AppShell/AppShellMediaStyles/assign-aside-variables/assign-aside-variables.cjs.map +1 -1
  19. package/cjs/components/AppShell/AppShellMediaStyles/assign-footer-variables/assign-footer-variables.cjs +24 -16
  20. package/cjs/components/AppShell/AppShellMediaStyles/assign-footer-variables/assign-footer-variables.cjs.map +1 -1
  21. package/cjs/components/AppShell/AppShellMediaStyles/assign-header-variables/assign-header-variables.cjs +24 -16
  22. package/cjs/components/AppShell/AppShellMediaStyles/assign-header-variables/assign-header-variables.cjs.map +1 -1
  23. package/cjs/components/AppShell/AppShellMediaStyles/assign-navbar-variables/assign-navbar-variables.cjs +30 -19
  24. package/cjs/components/AppShell/AppShellMediaStyles/assign-navbar-variables/assign-navbar-variables.cjs.map +1 -1
  25. package/cjs/components/AppShell/AppShellMediaStyles/escape-css-id/escape-css-id.cjs +26 -0
  26. package/cjs/components/AppShell/AppShellMediaStyles/escape-css-id/escape-css-id.cjs.map +1 -0
  27. package/cjs/components/AppShell/AppShellMediaStyles/get-resized-value/get-resized-value.cjs +10 -0
  28. package/cjs/components/AppShell/AppShellMediaStyles/get-resized-value/get-resized-value.cjs.map +1 -0
  29. package/cjs/components/AppShell/AppShellMediaStyles/get-variables/get-variables.cjs +13 -5
  30. package/cjs/components/AppShell/AppShellMediaStyles/get-variables/get-variables.cjs.map +1 -1
  31. package/cjs/components/AppShell/AppShellNavbar/AppShellNavbar.cjs +28 -7
  32. package/cjs/components/AppShell/AppShellNavbar/AppShellNavbar.cjs.map +1 -1
  33. package/cjs/components/AppShell/AppShellResizeHandle/AppShellResizeHandle.cjs +270 -0
  34. package/cjs/components/AppShell/AppShellResizeHandle/AppShellResizeHandle.cjs.map +1 -0
  35. package/cjs/components/AppShell/use-app-shell-resize/clamp-resize-size.cjs +15 -0
  36. package/cjs/components/AppShell/use-app-shell-resize/clamp-resize-size.cjs.map +1 -0
  37. package/cjs/components/AppShell/use-app-shell-resize/resize-section-config.cjs +51 -0
  38. package/cjs/components/AppShell/use-app-shell-resize/resize-section-config.cjs.map +1 -0
  39. package/cjs/components/AppShell/use-app-shell-resize/safe-area-inset.cjs +12 -0
  40. package/cjs/components/AppShell/use-app-shell-resize/safe-area-inset.cjs.map +1 -0
  41. package/cjs/components/AppShell/use-app-shell-resize/use-app-shell-resize.cjs +127 -0
  42. package/cjs/components/AppShell/use-app-shell-resize/use-app-shell-resize.cjs.map +1 -0
  43. package/cjs/components/AppShell/use-resizing/use-resizing.cjs +20 -2
  44. package/cjs/components/AppShell/use-resizing/use-resizing.cjs.map +1 -1
  45. package/cjs/components/Checkbox/Checkbox.cjs +10 -2
  46. package/cjs/components/Checkbox/Checkbox.cjs.map +1 -1
  47. package/cjs/components/Checkbox/Checkbox.module.cjs +1 -0
  48. package/cjs/components/Checkbox/Checkbox.module.cjs.map +1 -1
  49. package/cjs/components/Checkbox/CheckboxIndicator/CheckboxIndicator.cjs +10 -2
  50. package/cjs/components/Checkbox/CheckboxIndicator/CheckboxIndicator.cjs.map +1 -1
  51. package/cjs/components/Checkbox/CheckboxIndicator/CheckboxIndicator.module.cjs +1 -0
  52. package/cjs/components/Checkbox/CheckboxIndicator/CheckboxIndicator.module.cjs.map +1 -1
  53. package/cjs/components/ComboboxPopover/ComboboxPopover.cjs.map +1 -1
  54. package/cjs/components/Dialog/Dialog.cjs +0 -1
  55. package/cjs/components/Dialog/Dialog.cjs.map +1 -1
  56. package/cjs/components/Dialog/Dialog.module.cjs.map +1 -1
  57. package/cjs/components/HoverCard/HoverCard.cjs +34 -5
  58. package/cjs/components/HoverCard/HoverCard.cjs.map +1 -1
  59. package/cjs/components/HoverCard/HoverCard.context.cjs.map +1 -1
  60. package/cjs/components/HoverCard/HoverCardDropdown/HoverCardDropdown.cjs +13 -18
  61. package/cjs/components/HoverCard/HoverCardDropdown/HoverCardDropdown.cjs.map +1 -1
  62. package/cjs/components/HoverCard/HoverCardTarget/HoverCardTarget.cjs +6 -23
  63. package/cjs/components/HoverCard/HoverCardTarget/HoverCardTarget.cjs.map +1 -1
  64. package/cjs/components/HoverCard/use-hover-card.cjs +26 -12
  65. package/cjs/components/HoverCard/use-hover-card.cjs.map +1 -1
  66. package/cjs/components/Input/InputWrapper/InputWrapper.cjs +1 -1
  67. package/cjs/components/Input/InputWrapper/InputWrapper.cjs.map +1 -1
  68. package/cjs/components/Marquee/Marquee.cjs.map +1 -1
  69. package/cjs/components/Marquee/Marquee.module.cjs.map +1 -1
  70. package/cjs/components/PasswordInput/PasswordInput.cjs +10 -5
  71. package/cjs/components/PasswordInput/PasswordInput.cjs.map +1 -1
  72. package/cjs/components/PinInput/PinInput.cjs.map +1 -1
  73. package/cjs/components/Portal/Portal.cjs +10 -1
  74. package/cjs/components/Portal/Portal.cjs.map +1 -1
  75. package/cjs/components/Radio/Radio.cjs +10 -2
  76. package/cjs/components/Radio/Radio.cjs.map +1 -1
  77. package/cjs/components/Radio/Radio.module.cjs +1 -0
  78. package/cjs/components/Radio/Radio.module.cjs.map +1 -1
  79. package/cjs/components/Radio/RadioIndicator/RadioIndicator.cjs +10 -2
  80. package/cjs/components/Radio/RadioIndicator/RadioIndicator.cjs.map +1 -1
  81. package/cjs/components/Radio/RadioIndicator/RadioIndicator.module.cjs +1 -0
  82. package/cjs/components/Radio/RadioIndicator/RadioIndicator.module.cjs.map +1 -1
  83. package/cjs/components/Rating/Rating.cjs +35 -12
  84. package/cjs/components/Rating/Rating.cjs.map +1 -1
  85. package/cjs/components/Select/Select.cjs +1 -1
  86. package/cjs/components/Select/Select.cjs.map +1 -1
  87. package/cjs/components/Slider/Thumb/Thumb.cjs +7 -2
  88. package/cjs/components/Slider/Thumb/Thumb.cjs.map +1 -1
  89. package/cjs/components/Table/Table.cjs +23 -10
  90. package/cjs/components/Table/Table.cjs.map +1 -1
  91. package/cjs/components/Toggle/Toggle.cjs +80 -0
  92. package/cjs/components/Toggle/Toggle.cjs.map +1 -0
  93. package/cjs/components/Toggle/Toggle.module.cjs +7 -0
  94. package/cjs/components/Toggle/Toggle.module.cjs.map +1 -0
  95. package/cjs/components/Toolbar/Toolbar.cjs +107 -0
  96. package/cjs/components/Toolbar/Toolbar.cjs.map +1 -0
  97. package/cjs/components/Toolbar/Toolbar.context.cjs +8 -0
  98. package/cjs/components/Toolbar/Toolbar.context.cjs.map +1 -0
  99. package/cjs/components/Toolbar/Toolbar.module.cjs +12 -0
  100. package/cjs/components/Toolbar/Toolbar.module.cjs.map +1 -0
  101. package/cjs/components/Toolbar/ToolbarDivider/ToolbarDivider.cjs +31 -0
  102. package/cjs/components/Toolbar/ToolbarDivider/ToolbarDivider.cjs.map +1 -0
  103. package/cjs/components/Toolbar/ToolbarGroup/ToolbarGroup.cjs +31 -0
  104. package/cjs/components/Toolbar/ToolbarGroup/ToolbarGroup.cjs.map +1 -0
  105. package/cjs/components/Toolbar/ToolbarToggle/ToolbarToggle.cjs +47 -0
  106. package/cjs/components/Toolbar/ToolbarToggle/ToolbarToggle.cjs.map +1 -0
  107. package/cjs/components/Toolbar/ToolbarToggleGroup/ToolbarToggleGroup.cjs +61 -0
  108. package/cjs/components/Toolbar/ToolbarToggleGroup/ToolbarToggleGroup.cjs.map +1 -0
  109. package/cjs/components/Toolbar/ToolbarToggleGroup/ToolbarToggleGroup.context.cjs +8 -0
  110. package/cjs/components/Toolbar/ToolbarToggleGroup/ToolbarToggleGroup.context.cjs.map +1 -0
  111. package/cjs/components/Toolbar/ToolbarToggleItem/ToolbarToggleItem.cjs +51 -0
  112. package/cjs/components/Toolbar/ToolbarToggleItem/ToolbarToggleItem.cjs.map +1 -0
  113. package/cjs/components/Toolbar/use-toolbar-navigation.cjs +76 -0
  114. package/cjs/components/Toolbar/use-toolbar-navigation.cjs.map +1 -0
  115. package/cjs/components/Tooltip/Tooltip.cjs +9 -5
  116. package/cjs/components/Tooltip/Tooltip.cjs.map +1 -1
  117. package/cjs/components/Tooltip/use-tooltip.cjs +6 -3
  118. package/cjs/components/Tooltip/use-tooltip.cjs.map +1 -1
  119. package/cjs/components/Tour/Tour.cjs +283 -0
  120. package/cjs/components/Tour/Tour.cjs.map +1 -0
  121. package/cjs/components/Tour/Tour.context.cjs +25 -0
  122. package/cjs/components/Tour/Tour.context.cjs.map +1 -0
  123. package/cjs/components/Tour/Tour.module.cjs +19 -0
  124. package/cjs/components/Tour/Tour.module.cjs.map +1 -0
  125. package/cjs/components/Tour/TourBeacon/TourBeacon.cjs +54 -0
  126. package/cjs/components/Tour/TourBeacon/TourBeacon.cjs.map +1 -0
  127. package/cjs/components/Tour/TourBeaconPositioned.cjs +46 -0
  128. package/cjs/components/Tour/TourBeaconPositioned.cjs.map +1 -0
  129. package/cjs/components/Tour/TourBody/TourBody.cjs +37 -0
  130. package/cjs/components/Tour/TourBody/TourBody.cjs.map +1 -0
  131. package/cjs/components/Tour/TourCloseButton/TourCloseButton.cjs +26 -0
  132. package/cjs/components/Tour/TourCloseButton/TourCloseButton.cjs.map +1 -0
  133. package/cjs/components/Tour/TourNavigation/TourNavigation.cjs +63 -0
  134. package/cjs/components/Tour/TourNavigation/TourNavigation.cjs.map +1 -0
  135. package/cjs/components/Tour/TourOverlay/TourOverlay.cjs +70 -0
  136. package/cjs/components/Tour/TourOverlay/TourOverlay.cjs.map +1 -0
  137. package/cjs/components/Tour/TourRoot/TourRoot.cjs +125 -0
  138. package/cjs/components/Tour/TourRoot/TourRoot.cjs.map +1 -0
  139. package/cjs/components/Tour/TourStep/TourStep.cjs +10 -0
  140. package/cjs/components/Tour/TourStep/TourStep.cjs.map +1 -0
  141. package/cjs/components/Tour/TourTitle/TourTitle.cjs +38 -0
  142. package/cjs/components/Tour/TourTitle/TourTitle.cjs.map +1 -0
  143. package/cjs/components/Tour/TourTooltip/TourTooltip.cjs +87 -0
  144. package/cjs/components/Tour/TourTooltip/TourTooltip.cjs.map +1 -0
  145. package/cjs/components/Tour/get-overlay-hit-path.cjs +17 -0
  146. package/cjs/components/Tour/get-overlay-hit-path.cjs.map +1 -0
  147. package/cjs/components/Tour/is-element-in-view.cjs +30 -0
  148. package/cjs/components/Tour/is-element-in-view.cjs.map +1 -0
  149. package/cjs/components/Tour/press-aware-auto-update.cjs +38 -0
  150. package/cjs/components/Tour/press-aware-auto-update.cjs.map +1 -0
  151. package/cjs/components/Tour/use-target-rect.cjs +61 -0
  152. package/cjs/components/Tour/use-target-rect.cjs.map +1 -0
  153. package/cjs/components/Tour/use-tooltip-auto-focus.cjs +34 -0
  154. package/cjs/components/Tour/use-tooltip-auto-focus.cjs.map +1 -0
  155. package/cjs/components/Tour/use-tour-state.cjs +102 -0
  156. package/cjs/components/Tour/use-tour-state.cjs.map +1 -0
  157. package/cjs/components/Tour/use-tour.cjs +155 -0
  158. package/cjs/components/Tour/use-tour.cjs.map +1 -0
  159. package/cjs/components/TreeSelect/TreeSelect.cjs +29 -16
  160. package/cjs/components/TreeSelect/TreeSelect.cjs.map +1 -1
  161. package/cjs/core/Box/Box.cjs +1 -1
  162. package/cjs/core/Box/Box.cjs.map +1 -1
  163. package/cjs/core/Box/style-props/style-props-data.cjs +2 -2
  164. package/cjs/core/Box/style-props/style-props-data.cjs.map +1 -1
  165. package/cjs/core/styles-api/use-styles/use-styles.cjs +32 -2
  166. package/cjs/core/styles-api/use-styles/use-styles.cjs.map +1 -1
  167. package/cjs/core/utils/shallow-equal/shallow-equal.cjs +19 -0
  168. package/cjs/core/utils/shallow-equal/shallow-equal.cjs.map +1 -0
  169. package/cjs/index.cjs +42 -2
  170. package/esm/components/ActionBar/ActionBar.mjs +0 -3
  171. package/esm/components/ActionBar/ActionBar.mjs.map +1 -1
  172. package/esm/components/ActionBar/ActionBar.module.mjs.map +1 -1
  173. package/esm/components/AppShell/AppShell.context.mjs.map +1 -1
  174. package/esm/components/AppShell/AppShell.mjs +35 -8
  175. package/esm/components/AppShell/AppShell.mjs.map +1 -1
  176. package/esm/components/AppShell/AppShell.module.mjs +2 -1
  177. package/esm/components/AppShell/AppShell.module.mjs.map +1 -1
  178. package/esm/components/AppShell/AppShellAside/AppShellAside.mjs +29 -8
  179. package/esm/components/AppShell/AppShellAside/AppShellAside.mjs.map +1 -1
  180. package/esm/components/AppShell/AppShellFooter/AppShellFooter.mjs +29 -8
  181. package/esm/components/AppShell/AppShellFooter/AppShellFooter.mjs.map +1 -1
  182. package/esm/components/AppShell/AppShellHeader/AppShellHeader.mjs +29 -8
  183. package/esm/components/AppShell/AppShellHeader/AppShellHeader.mjs.map +1 -1
  184. package/esm/components/AppShell/AppShellMediaStyles/AppShellMediaStyles.mjs +3 -2
  185. package/esm/components/AppShell/AppShellMediaStyles/AppShellMediaStyles.mjs.map +1 -1
  186. package/esm/components/AppShell/AppShellMediaStyles/assign-aside-variables/assign-aside-variables.mjs +27 -16
  187. package/esm/components/AppShell/AppShellMediaStyles/assign-aside-variables/assign-aside-variables.mjs.map +1 -1
  188. package/esm/components/AppShell/AppShellMediaStyles/assign-footer-variables/assign-footer-variables.mjs +24 -16
  189. package/esm/components/AppShell/AppShellMediaStyles/assign-footer-variables/assign-footer-variables.mjs.map +1 -1
  190. package/esm/components/AppShell/AppShellMediaStyles/assign-header-variables/assign-header-variables.mjs +24 -16
  191. package/esm/components/AppShell/AppShellMediaStyles/assign-header-variables/assign-header-variables.mjs.map +1 -1
  192. package/esm/components/AppShell/AppShellMediaStyles/assign-navbar-variables/assign-navbar-variables.mjs +30 -19
  193. package/esm/components/AppShell/AppShellMediaStyles/assign-navbar-variables/assign-navbar-variables.mjs.map +1 -1
  194. package/esm/components/AppShell/AppShellMediaStyles/escape-css-id/escape-css-id.mjs +26 -0
  195. package/esm/components/AppShell/AppShellMediaStyles/escape-css-id/escape-css-id.mjs.map +1 -0
  196. package/esm/components/AppShell/AppShellMediaStyles/get-resized-value/get-resized-value.mjs +10 -0
  197. package/esm/components/AppShell/AppShellMediaStyles/get-resized-value/get-resized-value.mjs.map +1 -0
  198. package/esm/components/AppShell/AppShellMediaStyles/get-variables/get-variables.mjs +13 -5
  199. package/esm/components/AppShell/AppShellMediaStyles/get-variables/get-variables.mjs.map +1 -1
  200. package/esm/components/AppShell/AppShellNavbar/AppShellNavbar.mjs +29 -8
  201. package/esm/components/AppShell/AppShellNavbar/AppShellNavbar.mjs.map +1 -1
  202. package/esm/components/AppShell/AppShellResizeHandle/AppShellResizeHandle.mjs +270 -0
  203. package/esm/components/AppShell/AppShellResizeHandle/AppShellResizeHandle.mjs.map +1 -0
  204. package/esm/components/AppShell/use-app-shell-resize/clamp-resize-size.mjs +14 -0
  205. package/esm/components/AppShell/use-app-shell-resize/clamp-resize-size.mjs.map +1 -0
  206. package/esm/components/AppShell/use-app-shell-resize/resize-section-config.mjs +49 -0
  207. package/esm/components/AppShell/use-app-shell-resize/resize-section-config.mjs.map +1 -0
  208. package/esm/components/AppShell/use-app-shell-resize/safe-area-inset.mjs +12 -0
  209. package/esm/components/AppShell/use-app-shell-resize/safe-area-inset.mjs.map +1 -0
  210. package/esm/components/AppShell/use-app-shell-resize/use-app-shell-resize.mjs +127 -0
  211. package/esm/components/AppShell/use-app-shell-resize/use-app-shell-resize.mjs.map +1 -0
  212. package/esm/components/AppShell/use-resizing/use-resizing.mjs +21 -3
  213. package/esm/components/AppShell/use-resizing/use-resizing.mjs.map +1 -1
  214. package/esm/components/Checkbox/Checkbox.mjs +10 -2
  215. package/esm/components/Checkbox/Checkbox.mjs.map +1 -1
  216. package/esm/components/Checkbox/Checkbox.module.mjs +1 -0
  217. package/esm/components/Checkbox/Checkbox.module.mjs.map +1 -1
  218. package/esm/components/Checkbox/CheckboxIndicator/CheckboxIndicator.mjs +10 -2
  219. package/esm/components/Checkbox/CheckboxIndicator/CheckboxIndicator.mjs.map +1 -1
  220. package/esm/components/Checkbox/CheckboxIndicator/CheckboxIndicator.module.mjs +1 -0
  221. package/esm/components/Checkbox/CheckboxIndicator/CheckboxIndicator.module.mjs.map +1 -1
  222. package/esm/components/ComboboxPopover/ComboboxPopover.mjs.map +1 -1
  223. package/esm/components/Dialog/Dialog.mjs +0 -1
  224. package/esm/components/Dialog/Dialog.mjs.map +1 -1
  225. package/esm/components/Dialog/Dialog.module.mjs.map +1 -1
  226. package/esm/components/HoverCard/HoverCard.context.mjs.map +1 -1
  227. package/esm/components/HoverCard/HoverCard.mjs +34 -5
  228. package/esm/components/HoverCard/HoverCard.mjs.map +1 -1
  229. package/esm/components/HoverCard/HoverCardDropdown/HoverCardDropdown.mjs +13 -18
  230. package/esm/components/HoverCard/HoverCardDropdown/HoverCardDropdown.mjs.map +1 -1
  231. package/esm/components/HoverCard/HoverCardTarget/HoverCardTarget.mjs +7 -24
  232. package/esm/components/HoverCard/HoverCardTarget/HoverCardTarget.mjs.map +1 -1
  233. package/esm/components/HoverCard/use-hover-card.mjs +27 -13
  234. package/esm/components/HoverCard/use-hover-card.mjs.map +1 -1
  235. package/esm/components/Input/InputWrapper/InputWrapper.mjs +1 -1
  236. package/esm/components/Input/InputWrapper/InputWrapper.mjs.map +1 -1
  237. package/esm/components/Marquee/Marquee.mjs.map +1 -1
  238. package/esm/components/Marquee/Marquee.module.mjs.map +1 -1
  239. package/esm/components/PasswordInput/PasswordInput.mjs +12 -7
  240. package/esm/components/PasswordInput/PasswordInput.mjs.map +1 -1
  241. package/esm/components/PinInput/PinInput.mjs.map +1 -1
  242. package/esm/components/Portal/Portal.mjs +10 -1
  243. package/esm/components/Portal/Portal.mjs.map +1 -1
  244. package/esm/components/Radio/Radio.mjs +10 -2
  245. package/esm/components/Radio/Radio.mjs.map +1 -1
  246. package/esm/components/Radio/Radio.module.mjs +1 -0
  247. package/esm/components/Radio/Radio.module.mjs.map +1 -1
  248. package/esm/components/Radio/RadioIndicator/RadioIndicator.mjs +10 -2
  249. package/esm/components/Radio/RadioIndicator/RadioIndicator.mjs.map +1 -1
  250. package/esm/components/Radio/RadioIndicator/RadioIndicator.module.mjs +1 -0
  251. package/esm/components/Radio/RadioIndicator/RadioIndicator.module.mjs.map +1 -1
  252. package/esm/components/Rating/Rating.mjs +35 -12
  253. package/esm/components/Rating/Rating.mjs.map +1 -1
  254. package/esm/components/Select/Select.mjs +1 -1
  255. package/esm/components/Select/Select.mjs.map +1 -1
  256. package/esm/components/Slider/Thumb/Thumb.mjs +7 -2
  257. package/esm/components/Slider/Thumb/Thumb.mjs.map +1 -1
  258. package/esm/components/Table/Table.mjs +23 -10
  259. package/esm/components/Table/Table.mjs.map +1 -1
  260. package/esm/components/Toggle/Toggle.mjs +80 -0
  261. package/esm/components/Toggle/Toggle.mjs.map +1 -0
  262. package/esm/components/Toggle/Toggle.module.mjs +7 -0
  263. package/esm/components/Toggle/Toggle.module.mjs.map +1 -0
  264. package/esm/components/Toolbar/Toolbar.context.mjs +8 -0
  265. package/esm/components/Toolbar/Toolbar.context.mjs.map +1 -0
  266. package/esm/components/Toolbar/Toolbar.mjs +107 -0
  267. package/esm/components/Toolbar/Toolbar.mjs.map +1 -0
  268. package/esm/components/Toolbar/Toolbar.module.mjs +12 -0
  269. package/esm/components/Toolbar/Toolbar.module.mjs.map +1 -0
  270. package/esm/components/Toolbar/ToolbarDivider/ToolbarDivider.mjs +31 -0
  271. package/esm/components/Toolbar/ToolbarDivider/ToolbarDivider.mjs.map +1 -0
  272. package/esm/components/Toolbar/ToolbarGroup/ToolbarGroup.mjs +31 -0
  273. package/esm/components/Toolbar/ToolbarGroup/ToolbarGroup.mjs.map +1 -0
  274. package/esm/components/Toolbar/ToolbarToggle/ToolbarToggle.mjs +47 -0
  275. package/esm/components/Toolbar/ToolbarToggle/ToolbarToggle.mjs.map +1 -0
  276. package/esm/components/Toolbar/ToolbarToggleGroup/ToolbarToggleGroup.context.mjs +8 -0
  277. package/esm/components/Toolbar/ToolbarToggleGroup/ToolbarToggleGroup.context.mjs.map +1 -0
  278. package/esm/components/Toolbar/ToolbarToggleGroup/ToolbarToggleGroup.mjs +61 -0
  279. package/esm/components/Toolbar/ToolbarToggleGroup/ToolbarToggleGroup.mjs.map +1 -0
  280. package/esm/components/Toolbar/ToolbarToggleItem/ToolbarToggleItem.mjs +51 -0
  281. package/esm/components/Toolbar/ToolbarToggleItem/ToolbarToggleItem.mjs.map +1 -0
  282. package/esm/components/Toolbar/use-toolbar-navigation.mjs +76 -0
  283. package/esm/components/Toolbar/use-toolbar-navigation.mjs.map +1 -0
  284. package/esm/components/Tooltip/Tooltip.mjs +9 -5
  285. package/esm/components/Tooltip/Tooltip.mjs.map +1 -1
  286. package/esm/components/Tooltip/use-tooltip.mjs +7 -4
  287. package/esm/components/Tooltip/use-tooltip.mjs.map +1 -1
  288. package/esm/components/Tour/Tour.context.mjs +22 -0
  289. package/esm/components/Tour/Tour.context.mjs.map +1 -0
  290. package/esm/components/Tour/Tour.mjs +283 -0
  291. package/esm/components/Tour/Tour.mjs.map +1 -0
  292. package/esm/components/Tour/Tour.module.mjs +19 -0
  293. package/esm/components/Tour/Tour.module.mjs.map +1 -0
  294. package/esm/components/Tour/TourBeacon/TourBeacon.mjs +54 -0
  295. package/esm/components/Tour/TourBeacon/TourBeacon.mjs.map +1 -0
  296. package/esm/components/Tour/TourBeaconPositioned.mjs +46 -0
  297. package/esm/components/Tour/TourBeaconPositioned.mjs.map +1 -0
  298. package/esm/components/Tour/TourBody/TourBody.mjs +37 -0
  299. package/esm/components/Tour/TourBody/TourBody.mjs.map +1 -0
  300. package/esm/components/Tour/TourCloseButton/TourCloseButton.mjs +26 -0
  301. package/esm/components/Tour/TourCloseButton/TourCloseButton.mjs.map +1 -0
  302. package/esm/components/Tour/TourNavigation/TourNavigation.mjs +63 -0
  303. package/esm/components/Tour/TourNavigation/TourNavigation.mjs.map +1 -0
  304. package/esm/components/Tour/TourOverlay/TourOverlay.mjs +70 -0
  305. package/esm/components/Tour/TourOverlay/TourOverlay.mjs.map +1 -0
  306. package/esm/components/Tour/TourRoot/TourRoot.mjs +125 -0
  307. package/esm/components/Tour/TourRoot/TourRoot.mjs.map +1 -0
  308. package/esm/components/Tour/TourStep/TourStep.mjs +10 -0
  309. package/esm/components/Tour/TourStep/TourStep.mjs.map +1 -0
  310. package/esm/components/Tour/TourTitle/TourTitle.mjs +38 -0
  311. package/esm/components/Tour/TourTitle/TourTitle.mjs.map +1 -0
  312. package/esm/components/Tour/TourTooltip/TourTooltip.mjs +87 -0
  313. package/esm/components/Tour/TourTooltip/TourTooltip.mjs.map +1 -0
  314. package/esm/components/Tour/get-overlay-hit-path.mjs +17 -0
  315. package/esm/components/Tour/get-overlay-hit-path.mjs.map +1 -0
  316. package/esm/components/Tour/is-element-in-view.mjs +30 -0
  317. package/esm/components/Tour/is-element-in-view.mjs.map +1 -0
  318. package/esm/components/Tour/press-aware-auto-update.mjs +38 -0
  319. package/esm/components/Tour/press-aware-auto-update.mjs.map +1 -0
  320. package/esm/components/Tour/use-target-rect.mjs +59 -0
  321. package/esm/components/Tour/use-target-rect.mjs.map +1 -0
  322. package/esm/components/Tour/use-tooltip-auto-focus.mjs +34 -0
  323. package/esm/components/Tour/use-tooltip-auto-focus.mjs.map +1 -0
  324. package/esm/components/Tour/use-tour-state.mjs +102 -0
  325. package/esm/components/Tour/use-tour-state.mjs.map +1 -0
  326. package/esm/components/Tour/use-tour.mjs +155 -0
  327. package/esm/components/Tour/use-tour.mjs.map +1 -0
  328. package/esm/components/TreeSelect/TreeSelect.mjs +30 -17
  329. package/esm/components/TreeSelect/TreeSelect.mjs.map +1 -1
  330. package/esm/core/Box/Box.mjs +2 -2
  331. package/esm/core/Box/Box.mjs.map +1 -1
  332. package/esm/core/Box/style-props/style-props-data.mjs +2 -2
  333. package/esm/core/Box/style-props/style-props-data.mjs.map +1 -1
  334. package/esm/core/styles-api/use-styles/use-styles.mjs +32 -2
  335. package/esm/core/styles-api/use-styles/use-styles.mjs.map +1 -1
  336. package/esm/core/utils/shallow-equal/shallow-equal.mjs +19 -0
  337. package/esm/core/utils/shallow-equal/shallow-equal.mjs.map +1 -0
  338. package/esm/index.mjs +22 -3
  339. package/lib/components/ActionBar/ActionBar.d.ts +1 -1
  340. package/lib/components/AppShell/AppShell.context.d.ts +4 -0
  341. package/lib/components/AppShell/AppShell.d.ts +5 -3
  342. package/lib/components/AppShell/AppShell.types.d.ts +70 -0
  343. package/lib/components/AppShell/AppShellMediaStyles/AppShellMediaStyles.d.ts +6 -1
  344. package/lib/components/AppShell/AppShellMediaStyles/assign-aside-variables/assign-aside-variables.d.ts +3 -1
  345. package/lib/components/AppShell/AppShellMediaStyles/assign-footer-variables/assign-footer-variables.d.ts +3 -1
  346. package/lib/components/AppShell/AppShellMediaStyles/assign-header-variables/assign-header-variables.d.ts +3 -1
  347. package/lib/components/AppShell/AppShellMediaStyles/assign-navbar-variables/assign-navbar-variables.d.ts +3 -1
  348. package/lib/components/AppShell/AppShellMediaStyles/escape-css-id/escape-css-id.d.ts +2 -0
  349. package/lib/components/AppShell/AppShellMediaStyles/get-resized-value/get-resized-value.d.ts +1 -0
  350. package/lib/components/AppShell/AppShellMediaStyles/get-variables/get-variables.d.ts +6 -1
  351. package/lib/components/AppShell/AppShellResizeHandle/AppShellResizeHandle.d.ts +10 -0
  352. package/lib/components/AppShell/index.d.ts +3 -2
  353. package/lib/components/AppShell/use-app-shell-resize/clamp-resize-size.d.ts +9 -0
  354. package/lib/components/AppShell/use-app-shell-resize/resize-section-config.d.ts +29 -0
  355. package/lib/components/AppShell/use-app-shell-resize/safe-area-inset.d.ts +1 -0
  356. package/lib/components/AppShell/use-app-shell-resize/use-app-shell-resize.d.ts +2 -0
  357. package/lib/components/AppShell/use-resizing/use-resizing.d.ts +2 -1
  358. package/lib/components/Checkbox/Checkbox.d.ts +2 -2
  359. package/lib/components/Checkbox/CheckboxIndicator/CheckboxIndicator.d.ts +2 -2
  360. package/lib/components/Combobox/Combobox.types.d.ts +1 -1
  361. package/lib/components/ComboboxPopover/ComboboxPopover.d.ts +1 -1
  362. package/lib/components/HoverCard/HoverCard.context.d.ts +8 -4
  363. package/lib/components/HoverCard/HoverCard.d.ts +41 -0
  364. package/lib/components/HoverCard/index.d.ts +1 -1
  365. package/lib/components/HoverCard/use-hover-card.d.ts +11 -0
  366. package/lib/components/Marquee/Marquee.d.ts +1 -1
  367. package/lib/components/PinInput/PinInput.d.ts +1 -1
  368. package/lib/components/Radio/Radio.d.ts +2 -2
  369. package/lib/components/Radio/RadioIndicator/RadioIndicator.d.ts +2 -2
  370. package/lib/components/Slider/Thumb/Thumb.d.ts +1 -1
  371. package/lib/components/Toggle/Toggle.d.ts +73 -0
  372. package/lib/components/Toggle/index.d.ts +7 -0
  373. package/lib/components/Toolbar/Toolbar.context.d.ts +7 -0
  374. package/lib/components/Toolbar/Toolbar.d.ts +58 -0
  375. package/lib/components/Toolbar/ToolbarDivider/ToolbarDivider.d.ts +16 -0
  376. package/lib/components/Toolbar/ToolbarGroup/ToolbarGroup.d.ts +16 -0
  377. package/lib/components/Toolbar/ToolbarToggle/ToolbarToggle.d.ts +44 -0
  378. package/lib/components/Toolbar/ToolbarToggleGroup/ToolbarToggleGroup.context.d.ts +7 -0
  379. package/lib/components/Toolbar/ToolbarToggleGroup/ToolbarToggleGroup.d.ts +42 -0
  380. package/lib/components/Toolbar/ToolbarToggleItem/ToolbarToggleItem.d.ts +22 -0
  381. package/lib/components/Toolbar/index.d.ts +32 -0
  382. package/lib/components/Toolbar/use-toolbar-navigation.d.ts +11 -0
  383. package/lib/components/Tooltip/Tooltip.d.ts +3 -1
  384. package/lib/components/Tooltip/use-tooltip.d.ts +2 -0
  385. package/lib/components/Tour/Tour.context.d.ts +66 -0
  386. package/lib/components/Tour/Tour.d.ts +144 -0
  387. package/lib/components/Tour/TourBeacon/TourBeacon.d.ts +23 -0
  388. package/lib/components/Tour/TourBeaconPositioned.d.ts +13 -0
  389. package/lib/components/Tour/TourBody/TourBody.d.ts +19 -0
  390. package/lib/components/Tour/TourCloseButton/TourCloseButton.d.ts +12 -0
  391. package/lib/components/Tour/TourNavigation/TourNavigation.d.ts +11 -0
  392. package/lib/components/Tour/TourOverlay/TourOverlay.d.ts +22 -0
  393. package/lib/components/Tour/TourRoot/TourRoot.d.ts +72 -0
  394. package/lib/components/Tour/TourStep/TourStep.d.ts +30 -0
  395. package/lib/components/Tour/TourTitle/TourTitle.d.ts +19 -0
  396. package/lib/components/Tour/TourTooltip/TourTooltip.d.ts +29 -0
  397. package/lib/components/Tour/get-overlay-hit-path.d.ts +2 -0
  398. package/lib/components/Tour/index.d.ts +23 -0
  399. package/lib/components/Tour/is-element-in-view.d.ts +1 -0
  400. package/lib/components/Tour/press-aware-auto-update.d.ts +2 -0
  401. package/lib/components/Tour/use-target-rect.d.ts +13 -0
  402. package/lib/components/Tour/use-tooltip-auto-focus.d.ts +7 -0
  403. package/lib/components/Tour/use-tour-state.d.ts +23 -0
  404. package/lib/components/Tour/use-tour.d.ts +40 -0
  405. package/lib/components/TreeSelect/TreeSelect.d.ts +14 -0
  406. package/lib/components/TreeSelect/index.d.ts +2 -2
  407. package/lib/components/index.d.ts +3 -0
  408. package/lib/core/Box/style-props/index.d.ts +1 -1
  409. package/lib/core/Box/style-props/style-props-data.d.ts +1 -1
  410. package/lib/core/styles-api/use-styles/use-styles.d.ts +2 -1
  411. package/lib/core/utils/shallow-equal/shallow-equal.d.ts +1 -0
  412. package/package.json +5 -5
  413. package/styles/ActionBar.css +1 -0
  414. package/styles/ActionBar.layer.css +1 -0
  415. package/styles/AppShell.css +68 -0
  416. package/styles/AppShell.layer.css +68 -0
  417. package/styles/Checkbox.css +20 -0
  418. package/styles/Checkbox.layer.css +20 -0
  419. package/styles/CheckboxIndicator.css +16 -0
  420. package/styles/CheckboxIndicator.layer.css +16 -0
  421. package/styles/Dialog.css +1 -0
  422. package/styles/Dialog.layer.css +1 -0
  423. package/styles/Marquee.css +1 -1
  424. package/styles/Marquee.layer.css +1 -1
  425. package/styles/Radio.css +10 -0
  426. package/styles/Radio.layer.css +10 -0
  427. package/styles/RadioIndicator.css +11 -0
  428. package/styles/RadioIndicator.layer.css +11 -0
  429. package/styles/Toggle.css +98 -0
  430. package/styles/Toggle.layer.css +99 -0
  431. package/styles/Toolbar.css +220 -0
  432. package/styles/Toolbar.layer.css +221 -0
  433. package/styles/Tour.css +127 -0
  434. package/styles/Tour.layer.css +128 -0
  435. package/styles.css +576 -1
  436. package/styles.layer.css +576 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.cjs","names":["createVarsResolver","parseThemeColor","getSize","getRadius","getThemeColor","getAutoContrastValue","getContrastColor","factory","useProps","RadioIcon","useStyles","use","RadioGroupContext","extractStyleProps","useId","InlineInput","Box","classes","RadioGroup","RadioCard","RadioIndicator"],"sources":["../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import { use } from 'react';\nimport { useId } from '@mantine/hooks';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n extractStyleProps,\n factory,\n Factory,\n getAutoContrastValue,\n getContrastColor,\n getRadius,\n getSize,\n getThemeColor,\n MantineColor,\n MantineRadius,\n MantineSize,\n parseThemeColor,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { InlineInput, InlineInputStylesNames } from '../../utils/InlineInput';\nimport {\n RadioCard,\n type RadioCardProps,\n type RadioCardStylesNames,\n type RadioCardFactory,\n type RadioCardCssVariables,\n type RadioCardContextValue,\n} from './RadioCard/RadioCard';\nimport {\n RadioGroup,\n RadioGroupContext,\n type RadioGroupProps,\n type RadioGroupStylesNames,\n type RadioGroupFactory,\n type RadioGroupContextValue,\n} from './RadioGroup/RadioGroup';\nimport { RadioIcon, RadioIconProps } from './RadioIcon';\nimport {\n RadioIndicator,\n type RadioIndicatorProps,\n type RadioIndicatorStylesNames,\n type RadioIndicatorFactory,\n type RadioIndicatorCssVariables,\n type RadioIndicatorVariant,\n} from './RadioIndicator/RadioIndicator';\nimport classes from './Radio.module.css';\nexport type RadioVariant = 'filled' | 'outline';\nexport type RadioStylesNames = InlineInputStylesNames | 'inner' | 'radio' | 'icon';\nexport type RadioCssVariables = {\n root:\n | '--radio-size'\n | '--radio-radius'\n | '--radio-color'\n | '--radio-icon-color'\n | '--radio-icon-size';\n};\n\nexport interface RadioProps\n extends BoxProps, StylesApiProps<RadioFactory>, ElementProps<'input', 'size' | 'children'> {\n /** Content of the `label` associated with the radio */\n label?: React.ReactNode;\n\n /** Key of theme.colors or any valid CSS color to set radio background color in checked state @default theme.primaryColor */\n color?: MantineColor;\n\n /** Controls size of the component @default 'sm' */\n size?: MantineSize | (string & {});\n\n /** A component that replaces the default radio icon (centered dot) */\n icon?: React.FC<RadioIconProps>;\n\n /** Props passed down to the root element */\n wrapperProps?: React.ComponentProps<'div'> & DataAttributes;\n\n /** Position of the label relative to the input @default 'right' */\n labelPosition?: 'left' | 'right';\n\n /** Description displayed below the label */\n description?: React.ReactNode;\n\n /** Error displayed below the label */\n error?: React.ReactNode;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default 'xl' */\n radius?: MantineRadius;\n\n /** Assigns ref of the root element */\n rootRef?: React.Ref<HTMLDivElement>;\n\n /** Key of theme.colors or any valid CSS color to set icon color. When not set, icon color is determined automatically based on theme.autoContrast setting */\n iconColor?: MantineColor;\n\n /** If set, adjusts text color based on background color for `filled` variant */\n autoContrast?: boolean;\n\n /** If set, applies error styles to the radio when `error` prop is set @default true */\n withErrorStyles?: boolean;\n}\n\nexport type RadioFactory = Factory<{\n props: RadioProps;\n ref: HTMLInputElement;\n stylesNames: RadioStylesNames;\n vars: RadioCssVariables;\n variant: RadioVariant;\n staticComponents: {\n Group: typeof RadioGroup;\n Card: typeof RadioCard;\n Indicator: typeof RadioIndicator;\n };\n}>;\n\nconst defaultProps = {\n labelPosition: 'right',\n withErrorStyles: true,\n} satisfies Partial<RadioProps>;\n\nconst varsResolver = createVarsResolver<RadioFactory>(\n (theme, { size, radius, color, iconColor, variant, autoContrast }) => {\n const parsedColor = parseThemeColor({ color: color || theme.primaryColor, theme });\n const outlineColor =\n parsedColor.isThemeColor && parsedColor.shade === undefined\n ? `var(--mantine-color-${parsedColor.color}-outline)`\n : parsedColor.color;\n\n return {\n root: {\n '--radio-size': getSize(size, 'radio-size'),\n '--radio-radius': radius === undefined ? undefined : getRadius(radius),\n '--radio-color': variant === 'outline' ? outlineColor : getThemeColor(color, theme),\n '--radio-icon-color': iconColor\n ? getThemeColor(iconColor, theme)\n : getAutoContrastValue(autoContrast, theme)\n ? getContrastColor({ color, theme, autoContrast })\n : undefined,\n '--radio-icon-size': getSize(size, 'radio-icon-size'),\n },\n };\n }\n);\n\nexport const Radio = factory<RadioFactory>((_props) => {\n const props = useProps('Radio', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n id,\n size,\n label,\n labelPosition,\n description,\n error,\n radius,\n color,\n variant,\n disabled,\n wrapperProps,\n icon: Icon = RadioIcon,\n rootRef,\n iconColor,\n onChange,\n mod,\n attributes,\n withErrorStyles,\n checked,\n ...others\n } = props;\n\n const getStyles = useStyles<RadioFactory>({\n name: 'Radio',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const ctx = use(RadioGroupContext);\n\n const contextSize = ctx?.size ?? size;\n const componentSize = props.size ? size : contextSize;\n\n const { styleProps, rest } = extractStyleProps(others);\n const uuid = useId(id);\n const descriptionId = description ? `${uuid}-description` : undefined;\n const errorId = error && typeof error !== 'boolean' ? `${uuid}-error` : undefined;\n const describedBy =\n [descriptionId, errorId, rest['aria-describedby']].filter(Boolean).join(' ') || undefined;\n\n const contextChecked = ctx ? ctx.value === rest.value : undefined;\n\n const withContextProps = {\n checked: contextChecked ?? checked,\n name: rest.name ?? ctx?.name,\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => {\n ctx?.onChange(event);\n onChange?.(event);\n },\n disabled: ctx?.disabled ?? disabled,\n };\n\n return (\n <InlineInput\n {...getStyles('root')}\n __staticSelector=\"Radio\"\n __stylesApiProps={props}\n id={uuid}\n size={componentSize}\n labelPosition={labelPosition}\n label={label}\n description={description}\n error={error}\n disabled={withContextProps.disabled}\n classNames={classNames}\n styles={styles}\n unstyled={unstyled}\n data-checked={(contextChecked ?? checked) || undefined}\n variant={variant}\n ref={rootRef}\n mod={mod}\n attributes={attributes}\n {...styleProps}\n {...wrapperProps}\n >\n <Box {...getStyles('inner')} mod={{ 'label-position': labelPosition }}>\n <Box\n {...getStyles('radio', { focusable: true, variant })}\n {...rest}\n {...withContextProps}\n component=\"input\"\n mod={{ error: !!error, 'with-error-styles': withErrorStyles }}\n id={uuid}\n type=\"radio\"\n aria-describedby={describedBy}\n />\n <Icon {...getStyles('icon')} aria-hidden />\n </Box>\n </InlineInput>\n );\n});\n\nRadio.classes = classes;\nRadio.varsResolver = varsResolver;\nRadio.displayName = '@mantine/core/Radio';\nRadio.Group = RadioGroup;\nRadio.Card = RadioCard;\nRadio.Indicator = RadioIndicator;\n\nexport namespace Radio {\n export type Props = RadioProps;\n export type StylesNames = RadioStylesNames;\n export type Factory = RadioFactory;\n export type Variant = RadioVariant;\n\n export namespace Group {\n export type Props = RadioGroupProps;\n export type StylesNames = RadioGroupStylesNames;\n export type Factory = RadioGroupFactory;\n export type ContextValue = RadioGroupContextValue;\n }\n\n export namespace Card {\n export type Props = RadioCardProps;\n export type StylesNames = RadioCardStylesNames;\n export type Factory = RadioCardFactory;\n export type CssVariables = RadioCardCssVariables;\n export type ContextValue = RadioCardContextValue;\n }\n\n export namespace Indicator {\n export type Props = RadioIndicatorProps;\n export type StylesNames = RadioIndicatorStylesNames;\n export type Factory = RadioIndicatorFactory;\n export type CssVariables = RadioIndicatorCssVariables;\n export type Variant = RadioIndicatorVariant;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqHA,MAAM,eAAe;CACnB,eAAe;CACf,iBAAiB;AACnB;AAEA,MAAM,eAAeA,6BAAAA,oBAClB,OAAO,EAAE,MAAM,QAAQ,OAAO,WAAW,SAAS,mBAAmB;CACpE,MAAM,cAAcC,0BAAAA,gBAAgB;EAAE,OAAO,SAAS,MAAM;EAAc;CAAM,CAAC;CACjF,MAAM,eACJ,YAAY,gBAAgB,YAAY,UAAU,KAAA,IAC9C,uBAAuB,YAAY,MAAM,aACzC,YAAY;CAElB,OAAO,EACL,MAAM;EACJ,gBAAgBC,iBAAAA,QAAQ,MAAM,YAAY;EAC1C,kBAAkB,WAAW,KAAA,IAAY,KAAA,IAAYC,iBAAAA,UAAU,MAAM;EACrE,iBAAiB,YAAY,YAAY,eAAeC,wBAAAA,cAAc,OAAO,KAAK;EAClF,sBAAsB,YAClBA,wBAAAA,cAAc,WAAW,KAAK,IAC9BC,gCAAAA,qBAAqB,cAAc,KAAK,IACtCC,2BAAAA,iBAAiB;GAAE;GAAO;GAAO;EAAa,CAAC,IAC/C,KAAA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AAI;EACJ,MAAM;EACS;EACR;EACM;EACN;EACP,UAAU,iBAAiB;EACf;EACJ;EACE;EACV,iBAAe,kBAAkB,YAAY,KAAA;EACpC;EACT,KAAK;EACA;EACO;EACZ,GAAI;EACJ,GAAI;EAEJ,UAAA,iBAAA,GAAA,kBAAA,KAAA,CAACC,YAAAA,KAAD;GAAK,GAAI,UAAU,OAAO;GAAG,KAAK,EAAE,kBAAkB,cAAc;GAApE,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,YAAAA,KAAD;IACE,GAAI,UAAU,SAAS;KAAE,WAAW;KAAM;IAAQ,CAAC;IACnD,GAAI;IACJ,GAAI;IACJ,WAAU;IACV,KAAK;KAAE,OAAO,CAAC,CAAC;KAAO,qBAAqB;IAAgB;IAC5D,IAAI;IACJ,MAAK;IACL,oBAAkB;GACnB,CAAA,GACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;IAAM,GAAI,UAAU,MAAM;IAAG,eAAA;GAAa,CAAA,CACvC;;CACM,CAAA;AAEjB,CAAC;AAED,MAAM,UAAUC,qBAAAA;AAChB,MAAM,eAAe;AACrB,MAAM,cAAc;AACpB,MAAM,QAAQC,mBAAAA;AACd,MAAM,OAAOC,kBAAAA;AACb,MAAM,YAAYC,uBAAAA"}
1
+ {"version":3,"file":"Radio.cjs","names":["createVarsResolver","parseThemeColor","getThemeColor","getSize","getRadius","getAutoContrastValue","getContrastColor","factory","useProps","RadioIcon","useStyles","use","RadioGroupContext","extractStyleProps","useId","InlineInput","Box","classes","RadioGroup","RadioCard","RadioIndicator"],"sources":["../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import { use } from 'react';\nimport { useId } from '@mantine/hooks';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n extractStyleProps,\n factory,\n Factory,\n getAutoContrastValue,\n getContrastColor,\n getRadius,\n getSize,\n getThemeColor,\n MantineColor,\n MantineRadius,\n MantineSize,\n parseThemeColor,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport { InlineInput, InlineInputStylesNames } from '../../utils/InlineInput';\nimport {\n RadioCard,\n type RadioCardProps,\n type RadioCardStylesNames,\n type RadioCardFactory,\n type RadioCardCssVariables,\n type RadioCardContextValue,\n} from './RadioCard/RadioCard';\nimport {\n RadioGroup,\n RadioGroupContext,\n type RadioGroupProps,\n type RadioGroupStylesNames,\n type RadioGroupFactory,\n type RadioGroupContextValue,\n} from './RadioGroup/RadioGroup';\nimport { RadioIcon, RadioIconProps } from './RadioIcon';\nimport {\n RadioIndicator,\n type RadioIndicatorProps,\n type RadioIndicatorStylesNames,\n type RadioIndicatorFactory,\n type RadioIndicatorCssVariables,\n type RadioIndicatorVariant,\n} from './RadioIndicator/RadioIndicator';\nimport classes from './Radio.module.css';\n\nexport type RadioVariant = 'filled' | 'outline' | 'light';\nexport type RadioStylesNames = InlineInputStylesNames | 'inner' | 'radio' | 'icon';\nexport type RadioCssVariables = {\n root:\n | '--radio-size'\n | '--radio-radius'\n | '--radio-color'\n | '--radio-icon-color'\n | '--radio-icon-size'\n | '--radio-bg';\n};\n\nexport interface RadioProps\n extends BoxProps, StylesApiProps<RadioFactory>, ElementProps<'input', 'size' | 'children'> {\n /** Content of the `label` associated with the radio */\n label?: React.ReactNode;\n\n /** Key of theme.colors or any valid CSS color to set radio background color in checked state @default theme.primaryColor */\n color?: MantineColor;\n\n /** Controls size of the component @default 'sm' */\n size?: MantineSize | (string & {});\n\n /** A component that replaces the default radio icon (centered dot) */\n icon?: React.FC<RadioIconProps>;\n\n /** Props passed down to the root element */\n wrapperProps?: React.ComponentProps<'div'> & DataAttributes;\n\n /** Position of the label relative to the input @default 'right' */\n labelPosition?: 'left' | 'right';\n\n /** Description displayed below the label */\n description?: React.ReactNode;\n\n /** Error displayed below the label */\n error?: React.ReactNode;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default 'xl' */\n radius?: MantineRadius;\n\n /** Assigns ref of the root element */\n rootRef?: React.Ref<HTMLDivElement>;\n\n /** Key of theme.colors or any valid CSS color to set icon color. When not set, icon color is determined automatically based on theme.autoContrast setting */\n iconColor?: MantineColor;\n\n /** If set, adjusts text color based on background color for `filled` variant */\n autoContrast?: boolean;\n\n /** If set, applies error styles to the radio when `error` prop is set @default true */\n withErrorStyles?: boolean;\n}\n\nexport type RadioFactory = Factory<{\n props: RadioProps;\n ref: HTMLInputElement;\n stylesNames: RadioStylesNames;\n vars: RadioCssVariables;\n variant: RadioVariant;\n staticComponents: {\n Group: typeof RadioGroup;\n Card: typeof RadioCard;\n Indicator: typeof RadioIndicator;\n };\n}>;\n\nconst defaultProps = {\n labelPosition: 'right',\n withErrorStyles: true,\n} satisfies Partial<RadioProps>;\n\nconst varsResolver = createVarsResolver<RadioFactory>(\n (theme, { size, radius, color, iconColor, variant, autoContrast }) => {\n const parsedColor = parseThemeColor({ color: color || theme.primaryColor, theme });\n const outlineColor =\n parsedColor.isThemeColor && parsedColor.shade === undefined\n ? `var(--mantine-color-${parsedColor.color}-outline)`\n : parsedColor.color;\n\n const lightColors =\n variant === 'light'\n ? theme.variantColorResolver({\n color: color || theme.primaryColor,\n theme,\n variant: 'light',\n autoContrast,\n })\n : undefined;\n\n const resolvedColor =\n variant === 'outline'\n ? outlineColor\n : lightColors\n ? lightColors.color\n : getThemeColor(color, theme);\n\n return {\n root: {\n '--radio-size': getSize(size, 'radio-size'),\n '--radio-radius': radius === undefined ? undefined : getRadius(radius),\n '--radio-color': resolvedColor,\n '--radio-bg': lightColors?.background,\n '--radio-icon-color': iconColor\n ? getThemeColor(iconColor, theme)\n : lightColors\n ? lightColors.color\n : getAutoContrastValue(autoContrast, theme)\n ? getContrastColor({ color, theme, autoContrast })\n : undefined,\n '--radio-icon-size': getSize(size, 'radio-icon-size'),\n },\n };\n }\n);\n\nexport const Radio = factory<RadioFactory>((_props) => {\n const props = useProps('Radio', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n id,\n size,\n label,\n labelPosition,\n description,\n error,\n radius,\n color,\n variant,\n disabled,\n wrapperProps,\n icon: Icon = RadioIcon,\n rootRef,\n iconColor,\n onChange,\n mod,\n attributes,\n withErrorStyles,\n checked,\n ...others\n } = props;\n\n const getStyles = useStyles<RadioFactory>({\n name: 'Radio',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const ctx = use(RadioGroupContext);\n\n const contextSize = ctx?.size ?? size;\n const componentSize = props.size ? size : contextSize;\n\n const { styleProps, rest } = extractStyleProps(others);\n const uuid = useId(id);\n const descriptionId = description ? `${uuid}-description` : undefined;\n const errorId = error && typeof error !== 'boolean' ? `${uuid}-error` : undefined;\n const describedBy =\n [descriptionId, errorId, rest['aria-describedby']].filter(Boolean).join(' ') || undefined;\n\n const contextChecked = ctx ? ctx.value === rest.value : undefined;\n\n const withContextProps = {\n checked: contextChecked ?? checked,\n name: rest.name ?? ctx?.name,\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => {\n ctx?.onChange(event);\n onChange?.(event);\n },\n disabled: ctx?.disabled ?? disabled,\n };\n\n return (\n <InlineInput\n {...getStyles('root')}\n __staticSelector=\"Radio\"\n __stylesApiProps={props}\n id={uuid}\n size={componentSize}\n labelPosition={labelPosition}\n label={label}\n description={description}\n error={error}\n disabled={withContextProps.disabled}\n classNames={classNames}\n styles={styles}\n unstyled={unstyled}\n data-checked={(contextChecked ?? checked) || undefined}\n variant={variant}\n ref={rootRef}\n mod={mod}\n attributes={attributes}\n {...styleProps}\n {...wrapperProps}\n >\n <Box {...getStyles('inner')} mod={{ 'label-position': labelPosition }}>\n <Box\n {...getStyles('radio', { focusable: true, variant })}\n {...rest}\n {...withContextProps}\n component=\"input\"\n mod={{ error: !!error, 'with-error-styles': withErrorStyles }}\n id={uuid}\n type=\"radio\"\n aria-describedby={describedBy}\n />\n <Icon {...getStyles('icon')} aria-hidden />\n </Box>\n </InlineInput>\n );\n});\n\nRadio.classes = classes;\nRadio.varsResolver = varsResolver;\nRadio.displayName = '@mantine/core/Radio';\nRadio.Group = RadioGroup;\nRadio.Card = RadioCard;\nRadio.Indicator = RadioIndicator;\n\nexport namespace Radio {\n export type Props = RadioProps;\n export type StylesNames = RadioStylesNames;\n export type Factory = RadioFactory;\n export type Variant = RadioVariant;\n\n export namespace Group {\n export type Props = RadioGroupProps;\n export type StylesNames = RadioGroupStylesNames;\n export type Factory = RadioGroupFactory;\n export type ContextValue = RadioGroupContextValue;\n }\n\n export namespace Card {\n export type Props = RadioCardProps;\n export type StylesNames = RadioCardStylesNames;\n export type Factory = RadioCardFactory;\n export type CssVariables = RadioCardCssVariables;\n export type ContextValue = RadioCardContextValue;\n }\n\n export namespace Indicator {\n export type Props = RadioIndicatorProps;\n export type StylesNames = RadioIndicatorStylesNames;\n export type Factory = RadioIndicatorFactory;\n export type CssVariables = RadioIndicatorCssVariables;\n export type Variant = RadioIndicatorVariant;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuHA,MAAM,eAAe;CACnB,eAAe;CACf,iBAAiB;AACnB;AAEA,MAAM,eAAeA,6BAAAA,oBAClB,OAAO,EAAE,MAAM,QAAQ,OAAO,WAAW,SAAS,mBAAmB;CACpE,MAAM,cAAcC,0BAAAA,gBAAgB;EAAE,OAAO,SAAS,MAAM;EAAc;CAAM,CAAC;CACjF,MAAM,eACJ,YAAY,gBAAgB,YAAY,UAAU,KAAA,IAC9C,uBAAuB,YAAY,MAAM,aACzC,YAAY;CAElB,MAAM,cACJ,YAAY,UACR,MAAM,qBAAqB;EACzB,OAAO,SAAS,MAAM;EACtB;EACA,SAAS;EACT;CACF,CAAC,IACD,KAAA;CAEN,MAAM,gBACJ,YAAY,YACR,eACA,cACE,YAAY,QACZC,wBAAAA,cAAc,OAAO,KAAK;CAElC,OAAO,EACL,MAAM;EACJ,gBAAgBC,iBAAAA,QAAQ,MAAM,YAAY;EAC1C,kBAAkB,WAAW,KAAA,IAAY,KAAA,IAA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Q,KAAK;EACxB,WAAW,UAA+C;GACxD,KAAK,SAAS,KAAK;GACnB,WAAW,KAAK;EAClB;EACA,UAAU,KAAK,YAAY;CAC7B;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,aAAD;EACE,GAAI,UAAU,MAAM;EACpB,kBAAiB;EACjB,kBAAkB;EAClB,IAAI;EACJ,MAAM;EACS;EACR;EACM;EACN;EACP,UAAU,iBAAiB;EACf;EACJ;EACE;EACV,iBAAe,kBAAkB,YAAY,KAAA;EACpC;EACT,KAAK;EACA;EACO;EACZ,GAAI;EACJ,GAAI;EAEJ,UAAA,iBAAA,GAAA,kBAAA,KAAA,CAACC,YAAAA,KAAD;GAAK,GAAI,UAAU,OAAO;GAAG,KAAK,EAAE,kBAAkB,cAAc;GAApE,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,YAAAA,KAAD;IACE,GAAI,UAAU,SAAS;KAAE,WAAW;KAAM;IAAQ,CAAC;IACnD,GAAI;IACJ,GAAI;IACJ,WAAU;IACV,KAAK;KAAE,OAAO,CAAC,CAAC;KAAO,qBAAqB;IAAgB;IAC5D,IAAI;IACJ,MAAK;IACL,oBAAkB;GACnB,CAAA,GACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;IAAM,GAAI,UAAU,MAAM;IAAG,eAAA;GAAa,CAAA,CACvC;;CACM,CAAA;AAEjB,CAAC;AAED,MAAM,UAAUC,qBAAAA;AAChB,MAAM,eAAe;AACrB,MAAM,cAAc;AACpB,MAAM,QAAQC,mBAAAA;AACd,MAAM,OAAOC,kBAAAA;AACb,MAAM,YAAYC,uBAAAA"}
@@ -5,6 +5,7 @@ var Radio_module_default = {
5
5
  "inner": "m_89c4f5e4",
6
6
  "icon": "m_f3ed6b2b",
7
7
  "radio": "m_8a3dbb89",
8
+ "radio--light": "m_99d09bcd",
8
9
  "radio--outline": "m_1bfe9d39"
9
10
  };
10
11
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.module.cjs","names":[],"sources":["../../../src/components/Radio/Radio.module.css"],"sourcesContent":[".root {\n --radio-size-xs: 16px;\n --radio-size-sm: 20px;\n --radio-size-md: 24px;\n --radio-size-lg: 30px;\n --radio-size-xl: 36px;\n --radio-size: var(--radio-size-sm);\n\n --radio-icon-size-xs: 6px;\n --radio-icon-size-sm: 8px;\n --radio-icon-size-md: 10px;\n --radio-icon-size-lg: 14px;\n --radio-icon-size-xl: 16px;\n --radio-icon-size: var(--radio-icon-size-sm);\n --radio-icon-color: var(--mantine-color-white);\n}\n\n.inner {\n position: relative;\n width: var(--radio-size);\n height: var(--radio-size);\n order: 1;\n\n &:where([data-label-position='left']) {\n order: 2;\n }\n}\n\n.icon {\n color: var(--radio-icon-color);\n opacity: var(--radio-icon-opacity, 0);\n translate: -50% -50%;\n transform: var(--radio-icon-transform, scale(0.2) translateY(rem(10px)));\n transition:\n opacity 100ms ease,\n transform 200ms ease;\n pointer-events: none;\n width: var(--radio-icon-size);\n height: var(--radio-icon-size);\n position: absolute;\n top: 50%;\n left: 50%;\n}\n\n.radio {\n border: 1px solid;\n position: relative;\n appearance: none;\n width: var(--radio-size);\n height: var(--radio-size);\n border-radius: var(--radio-radius, var(--radio-size));\n margin: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n transition-property: background-color, border-color;\n transition-timing-function: ease;\n transition-duration: 100ms;\n cursor: var(--mantine-cursor-type);\n -webkit-tap-highlight-color: transparent;\n\n @mixin where-light {\n background-color: var(--mantine-color-white);\n border-color: var(--mantine-color-gray-4);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-dark-6);\n border-color: var(--mantine-color-dark-4);\n }\n\n &:checked {\n background-color: var(--radio-color, var(--mantine-primary-color-filled));\n border-color: var(--radio-color, var(--mantine-primary-color-filled));\n\n & + .icon {\n --radio-icon-opacity: 1;\n --radio-icon-transform: scale(1);\n }\n }\n\n &:disabled {\n cursor: not-allowed;\n background-color: var(--mantine-color-disabled);\n border-color: var(--mantine-color-disabled-border);\n\n & + .icon {\n --radio-icon-color: var(--mantine-color-disabled-color);\n }\n }\n\n &:where([data-with-error-styles][data-error]) {\n border-color: var(--mantine-color-error);\n }\n}\n\n.radio--outline {\n & + .icon {\n --radio-icon-color: var(--radio-color);\n }\n\n &:checked:not(:disabled) {\n background-color: transparent;\n border-color: var(--radio-color);\n\n & + .icon {\n --radio-icon-color: var(--radio-color);\n --radio-icon-opacity: 1;\n --radio-icon-transform: none;\n }\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"Radio.module.cjs","names":[],"sources":["../../../src/components/Radio/Radio.module.css"],"sourcesContent":[".root {\n --radio-size-xs: 16px;\n --radio-size-sm: 20px;\n --radio-size-md: 24px;\n --radio-size-lg: 30px;\n --radio-size-xl: 36px;\n --radio-size: var(--radio-size-sm);\n\n --radio-icon-size-xs: 6px;\n --radio-icon-size-sm: 8px;\n --radio-icon-size-md: 10px;\n --radio-icon-size-lg: 14px;\n --radio-icon-size-xl: 16px;\n --radio-icon-size: var(--radio-icon-size-sm);\n --radio-icon-color: var(--mantine-color-white);\n}\n\n.inner {\n position: relative;\n width: var(--radio-size);\n height: var(--radio-size);\n order: 1;\n\n &:where([data-label-position='left']) {\n order: 2;\n }\n}\n\n.icon {\n color: var(--radio-icon-color);\n opacity: var(--radio-icon-opacity, 0);\n translate: -50% -50%;\n transform: var(--radio-icon-transform, scale(0.2) translateY(rem(10px)));\n transition:\n opacity 100ms ease,\n transform 200ms ease;\n pointer-events: none;\n width: var(--radio-icon-size);\n height: var(--radio-icon-size);\n position: absolute;\n top: 50%;\n left: 50%;\n}\n\n.radio {\n border: 1px solid;\n position: relative;\n appearance: none;\n width: var(--radio-size);\n height: var(--radio-size);\n border-radius: var(--radio-radius, var(--radio-size));\n margin: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n transition-property: background-color, border-color;\n transition-timing-function: ease;\n transition-duration: 100ms;\n cursor: var(--mantine-cursor-type);\n -webkit-tap-highlight-color: transparent;\n\n @mixin where-light {\n background-color: var(--mantine-color-white);\n border-color: var(--mantine-color-gray-4);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-dark-6);\n border-color: var(--mantine-color-dark-4);\n }\n\n &:checked {\n background-color: var(--radio-color, var(--mantine-primary-color-filled));\n border-color: var(--radio-color, var(--mantine-primary-color-filled));\n\n & + .icon {\n --radio-icon-opacity: 1;\n --radio-icon-transform: scale(1);\n }\n }\n\n &:disabled {\n cursor: not-allowed;\n background-color: var(--mantine-color-disabled);\n border-color: var(--mantine-color-disabled-border);\n\n & + .icon {\n --radio-icon-color: var(--mantine-color-disabled-color);\n }\n }\n\n &:where([data-with-error-styles][data-error]) {\n border-color: var(--mantine-color-error);\n }\n}\n\n.radio--light {\n &:checked:not(:disabled) {\n background-color: var(--radio-bg);\n border-color: transparent;\n\n & + .icon {\n --radio-icon-opacity: 1;\n --radio-icon-transform: none;\n }\n }\n}\n\n.radio--outline {\n & + .icon {\n --radio-icon-color: var(--radio-color);\n }\n\n &:checked:not(:disabled) {\n background-color: transparent;\n border-color: var(--radio-color);\n\n & + .icon {\n --radio-icon-color: var(--radio-color);\n --radio-icon-opacity: 1;\n --radio-icon-transform: none;\n }\n }\n}\n"],"mappings":""}
@@ -22,12 +22,20 @@ const varsResolver = require_create_vars_resolver.createVarsResolver((theme, { r
22
22
  theme
23
23
  });
24
24
  const outlineColor = parsedColor.isThemeColor && parsedColor.shade === void 0 ? `var(--mantine-color-${parsedColor.color}-outline)` : parsedColor.color;
25
+ const lightColors = variant === "light" ? theme.variantColorResolver({
26
+ color: color || theme.primaryColor,
27
+ theme,
28
+ variant: "light",
29
+ autoContrast
30
+ }) : void 0;
31
+ const resolvedColor = variant === "outline" ? outlineColor : lightColors ? lightColors.color : require_get_theme_color.getThemeColor(color, theme);
25
32
  return { indicator: {
26
33
  "--radio-size": require_get_size.getSize(size, "radio-size"),
27
34
  "--radio-radius": radius === void 0 ? void 0 : require_get_size.getRadius(radius),
28
- "--radio-color": variant === "outline" ? outlineColor : require_get_theme_color.getThemeColor(color, theme),
35
+ "--radio-color": resolvedColor,
36
+ "--radio-bg": lightColors?.background,
29
37
  "--radio-icon-size": typeof size === "number" ? `calc(${require_get_size.getSize(size, "radio-size")} * 0.4)` : require_get_size.getSize(size, "radio-icon-size"),
30
- "--radio-icon-color": iconColor ? require_get_theme_color.getThemeColor(iconColor, theme) : require_get_auto_contrast_value.getAutoContrastValue(autoContrast, theme) ? require_get_contrast_color.getContrastColor({
38
+ "--radio-icon-color": iconColor ? require_get_theme_color.getThemeColor(iconColor, theme) : lightColors ? lightColors.color : require_get_auto_contrast_value.getAutoContrastValue(autoContrast, theme) ? require_get_contrast_color.getContrastColor({
31
39
  color,
32
40
  theme,
33
41
  autoContrast
@@ -1 +1 @@
1
- {"version":3,"file":"RadioIndicator.cjs","names":["RadioIcon","createVarsResolver","parseThemeColor","getSize","getRadius","getThemeColor","getAutoContrastValue","getContrastColor","factory","useProps","useStyles","use","RadioCardContext","Box","classes"],"sources":["../../../../src/components/Radio/RadioIndicator/RadioIndicator.tsx"],"sourcesContent":["import { use } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getAutoContrastValue,\n getContrastColor,\n getRadius,\n getSize,\n getThemeColor,\n MantineColor,\n MantineRadius,\n MantineSize,\n parseThemeColor,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../../core';\nimport { RadioCardContext } from '../RadioCard/RadioCard';\nimport { RadioIcon, RadioIconProps } from '../RadioIcon';\nimport classes from './RadioIndicator.module.css';\n\nexport type RadioIndicatorStylesNames = 'indicator' | 'icon';\nexport type RadioIndicatorVariant = 'filled' | 'outline';\nexport type RadioIndicatorCssVariables = {\n indicator:\n | '--radio-size'\n | '--radio-radius'\n | '--radio-color'\n | '--radio-icon-color'\n | '--radio-icon-size';\n};\n\nexport interface RadioIndicatorProps\n extends BoxProps, StylesApiProps<RadioIndicatorFactory>, ElementProps<'div'> {\n /** Key of theme.colors or any valid CSS color to set indicator background color in checked state @default theme.primaryColor */\n color?: MantineColor;\n\n /** Controls size of the component @default 'sm' */\n size?: MantineSize | (string & {}) | number;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Key of theme.colors or any valid CSS color to set icon color. When not set, icon color is determined automatically based on theme.autoContrast setting */\n iconColor?: MantineColor;\n\n /** If set, adjusts text color based on background color for `filled` variant */\n autoContrast?: boolean;\n\n /** A component that replaces the default radio icon (centered dot) */\n icon?: React.FC<RadioIconProps>;\n\n /** Checked state */\n checked?: boolean;\n\n /** Disabled state */\n disabled?: boolean;\n}\n\nexport type RadioIndicatorFactory = Factory<{\n props: RadioIndicatorProps;\n ref: HTMLDivElement;\n stylesNames: RadioIndicatorStylesNames;\n vars: RadioIndicatorCssVariables;\n variant: RadioIndicatorVariant;\n}>;\n\nconst defaultProps = {\n icon: RadioIcon,\n} satisfies Partial<RadioIndicatorProps>;\n\nconst varsResolver = createVarsResolver<RadioIndicatorFactory>(\n (theme, { radius, color, size, iconColor, variant, autoContrast }) => {\n const parsedColor = parseThemeColor({ color: color || theme.primaryColor, theme });\n const outlineColor =\n parsedColor.isThemeColor && parsedColor.shade === undefined\n ? `var(--mantine-color-${parsedColor.color}-outline)`\n : parsedColor.color;\n\n return {\n indicator: {\n '--radio-size': getSize(size, 'radio-size'),\n '--radio-radius': radius === undefined ? undefined : getRadius(radius),\n '--radio-color': variant === 'outline' ? outlineColor : getThemeColor(color, theme),\n '--radio-icon-size':\n typeof size === 'number'\n ? `calc(${getSize(size, 'radio-size')} * 0.4)`\n : getSize(size, 'radio-icon-size'),\n '--radio-icon-color': iconColor\n ? getThemeColor(iconColor, theme)\n : getAutoContrastValue(autoContrast, theme)\n ? getContrastColor({ color, theme, autoContrast })\n : undefined,\n },\n };\n }\n);\n\nexport const RadioIndicator = factory<RadioIndicatorFactory>((_props) => {\n const props = useProps('RadioIndicator', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n icon: Icon,\n radius,\n color,\n iconColor,\n autoContrast,\n checked,\n mod,\n variant,\n disabled,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<RadioIndicatorFactory>({\n name: 'RadioIndicator',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n rootSelector: 'indicator',\n });\n\n const ctx = use(RadioCardContext);\n const _checked = typeof checked === 'boolean' ? checked : ctx?.checked || false;\n\n return (\n <Box\n {...getStyles('indicator', { variant })}\n variant={variant}\n mod={[{ checked: _checked, disabled }, mod]}\n {...others}\n >\n <Icon {...getStyles('icon')} />\n </Box>\n );\n});\n\nRadioIndicator.displayName = '@mantine/core/RadioIndicator';\nRadioIndicator.classes = classes;\nRadioIndicator.varsResolver = varsResolver;\n"],"mappings":";;;;;;;;;;;;;;;;;AAuEA,MAAM,eAAe,EACnB,MAAMA,kBAAAA,UACR;AAEA,MAAM,eAAeC,6BAAAA,oBAClB,OAAO,EAAE,QAAQ,OAAO,MAAM,WAAW,SAAS,mBAAmB;CACpE,MAAM,cAAcC,0BAAAA,gBAAgB;EAAE,OAAO,SAAS,MAAM;EAAc;CAAM,CAAC;CACjF,MAAM,eACJ,YAAY,gBAAgB,YAAY,UAAU,KAAA,IAC9C,uBAAuB,YAAY,MAAM,aACzC,YAAY;CAElB,OAAO,EACL,WAAW;EACT,gBAAgBC,iBAAAA,QAAQ,MAAM,YAAY;EAC1C,kBAAkB,WAAW,KAAA,IAAY,KAAA,IAAYC,iBAAAA,UAAU,MAAM;EACrE,iBAAiB,YAAY,YAAY,eAAeC,wBAAAA,cAAc,OAAO,KAAK;EAClF,qBACE,OAAO,SAAS,WACZ,QAAQF,iBAAAA,QAAQ,MAAM,YAAY,EAAE,WACpCA,iBAAAA,QAAQ,MAAM,iBAAiB;EACrC,sBAAsB,YAClBE,wBAAAA,cAAc,WAAW,KAAK,IAC9BC,gCAAAA,qBAAqB,cAAc,KAAK,IACtCC,2BAAAA,iBAAiB;GAAE;GAAO;GAAO;EAAa,CAAC,IAC/C,KAAA;CACR,EACF;AACF,CACF;AAEA,MAAa,iBAAiBC,gBAAAA,SAAgC,WAAW;CACvE,MAAM,QAAQC,kBAAAA,SAAS,kBAAkB,cAAc,MAAM;CAC7D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,MAAM,MACN,QACA,OACA,WACA,cACA,SACA,KACA,SACA,UACA,YACA,GAAG,WACD;CAEJ,MAAM,YAAYC,mBAAAA,UAAiC;EACjD,MAAM;EACN,SAAA,8BAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;CAChB,CAAC;CAED,MAAM,OAAA,GAAMC,MAAAA,IAAAA,CAAIC,kBAAAA,gBAAgB;CAChC,MAAM,WAAW,OAAO,YAAY,YAAY,UAAU,KAAK,WAAW;CAE1E,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,YAAAA,KAAD;EACE,GAAI,UAAU,aAAa,EAAE,QAAQ,CAAC;EAC7B;EACT,KAAK,CAAC;GAAE,SAAS;GAAU;EAAS,GAAG,GAAG;EAC1C,GAAI;EAEJ,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAM,GAAI,UAAU,MAAM,EAAI,CAAA;CAC3B,CAAA;AAET,CAAC;AAED,eAAe,cAAc;AAC7B,eAAe,UAAUC,8BAAAA;AACzB,eAAe,eAAe"}
1
+ {"version":3,"file":"RadioIndicator.cjs","names":["RadioIcon","createVarsResolver","parseThemeColor","getThemeColor","getSize","getRadius","getAutoContrastValue","getContrastColor","factory","useProps","useStyles","use","RadioCardContext","Box","classes"],"sources":["../../../../src/components/Radio/RadioIndicator/RadioIndicator.tsx"],"sourcesContent":["import { use } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getAutoContrastValue,\n getContrastColor,\n getRadius,\n getSize,\n getThemeColor,\n MantineColor,\n MantineRadius,\n MantineSize,\n parseThemeColor,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../../core';\nimport { RadioCardContext } from '../RadioCard/RadioCard';\nimport { RadioIcon, RadioIconProps } from '../RadioIcon';\nimport classes from './RadioIndicator.module.css';\n\nexport type RadioIndicatorStylesNames = 'indicator' | 'icon';\nexport type RadioIndicatorVariant = 'filled' | 'outline' | 'light';\nexport type RadioIndicatorCssVariables = {\n indicator:\n | '--radio-size'\n | '--radio-radius'\n | '--radio-color'\n | '--radio-icon-color'\n | '--radio-icon-size'\n | '--radio-bg';\n};\n\nexport interface RadioIndicatorProps\n extends BoxProps, StylesApiProps<RadioIndicatorFactory>, ElementProps<'div'> {\n /** Key of theme.colors or any valid CSS color to set indicator background color in checked state @default theme.primaryColor */\n color?: MantineColor;\n\n /** Controls size of the component @default 'sm' */\n size?: MantineSize | (string & {}) | number;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Key of theme.colors or any valid CSS color to set icon color. When not set, icon color is determined automatically based on theme.autoContrast setting */\n iconColor?: MantineColor;\n\n /** If set, adjusts text color based on background color for `filled` variant */\n autoContrast?: boolean;\n\n /** A component that replaces the default radio icon (centered dot) */\n icon?: React.FC<RadioIconProps>;\n\n /** Checked state */\n checked?: boolean;\n\n /** Disabled state */\n disabled?: boolean;\n}\n\nexport type RadioIndicatorFactory = Factory<{\n props: RadioIndicatorProps;\n ref: HTMLDivElement;\n stylesNames: RadioIndicatorStylesNames;\n vars: RadioIndicatorCssVariables;\n variant: RadioIndicatorVariant;\n}>;\n\nconst defaultProps = {\n icon: RadioIcon,\n} satisfies Partial<RadioIndicatorProps>;\n\nconst varsResolver = createVarsResolver<RadioIndicatorFactory>(\n (theme, { radius, color, size, iconColor, variant, autoContrast }) => {\n const parsedColor = parseThemeColor({ color: color || theme.primaryColor, theme });\n const outlineColor =\n parsedColor.isThemeColor && parsedColor.shade === undefined\n ? `var(--mantine-color-${parsedColor.color}-outline)`\n : parsedColor.color;\n\n const lightColors =\n variant === 'light'\n ? theme.variantColorResolver({\n color: color || theme.primaryColor,\n theme,\n variant: 'light',\n autoContrast,\n })\n : undefined;\n\n const resolvedColor =\n variant === 'outline'\n ? outlineColor\n : lightColors\n ? lightColors.color\n : getThemeColor(color, theme);\n\n return {\n indicator: {\n '--radio-size': getSize(size, 'radio-size'),\n '--radio-radius': radius === undefined ? undefined : getRadius(radius),\n '--radio-color': resolvedColor,\n '--radio-bg': lightColors?.background,\n '--radio-icon-size':\n typeof size === 'number'\n ? `calc(${getSize(size, 'radio-size')} * 0.4)`\n : getSize(size, 'radio-icon-size'),\n '--radio-icon-color': iconColor\n ? getThemeColor(iconColor, theme)\n : lightColors\n ? lightColors.color\n : getAutoContrastValue(autoContrast, theme)\n ? getContrastColor({ color, theme, autoContrast })\n : undefined,\n },\n };\n }\n);\n\nexport const RadioIndicator = factory<RadioIndicatorFactory>((_props) => {\n const props = useProps('RadioIndicator', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n icon: Icon,\n radius,\n color,\n iconColor,\n autoContrast,\n checked,\n mod,\n variant,\n disabled,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<RadioIndicatorFactory>({\n name: 'RadioIndicator',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n rootSelector: 'indicator',\n });\n\n const ctx = use(RadioCardContext);\n const _checked = typeof checked === 'boolean' ? checked : ctx?.checked || false;\n\n return (\n <Box\n {...getStyles('indicator', { variant })}\n variant={variant}\n mod={[{ checked: _checked, disabled }, mod]}\n {...others}\n >\n <Icon {...getStyles('icon')} />\n </Box>\n );\n});\n\nRadioIndicator.displayName = '@mantine/core/RadioIndicator';\nRadioIndicator.classes = classes;\nRadioIndicator.varsResolver = varsResolver;\n"],"mappings":";;;;;;;;;;;;;;;;;AAwEA,MAAM,eAAe,EACnB,MAAMA,kBAAAA,UACR;AAEA,MAAM,eAAeC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AED,MAAM,OAAA,GAAMC,MAAAA,IAAAA,CAAIC,kBAAAA,gBAAgB;CAChC,MAAM,WAAW,OAAO,YAAY,YAAY,UAAU,KAAK,WAAW;CAE1E,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,YAAAA,KAAD;EACE,GAAI,UAAU,aAAa,EAAE,QAAQ,CAAC;EAC7B;EACT,KAAK,CAAC;GAAE,SAAS;GAAU;EAAS,GAAG,GAAG;EAC1C,GAAI;EAEJ,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAM,GAAI,UAAU,MAAM,EAAI,CAAA;CAC3B,CAAA;AAET,CAAC;AAED,eAAe,cAAc;AAC7B,eAAe,UAAUC,8BAAAA;AACzB,eAAe,eAAe"}
@@ -3,6 +3,7 @@
3
3
  var RadioIndicator_module_default = {
4
4
  "indicator": "m_717d7ff6",
5
5
  "icon": "m_3e4da632",
6
+ "indicator--light": "m_7eec72c0",
6
7
  "indicator--outline": "m_2980836c"
7
8
  };
8
9
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"RadioIndicator.module.cjs","names":[],"sources":["../../../../src/components/Radio/RadioIndicator/RadioIndicator.module.css"],"sourcesContent":[".indicator {\n --radio-size-xs: 16px;\n --radio-size-sm: 20px;\n --radio-size-md: 24px;\n --radio-size-lg: 30px;\n --radio-size-xl: 36px;\n\n --radio-icon-size-xs: 6px;\n --radio-icon-size-sm: 8px;\n --radio-icon-size-md: 10px;\n --radio-icon-size-lg: 14px;\n --radio-icon-size-xl: 16px;\n\n --radio-icon-size: var(--radio-icon-size-sm);\n --radio-size: var(--radio-size-sm);\n --radio-color: var(--mantine-primary-color-filled);\n --radio-icon-color: var(--mantine-color-white);\n\n position: relative;\n border: 1px solid transparent;\n width: var(--radio-size);\n min-width: var(--radio-size);\n height: var(--radio-size);\n min-height: var(--radio-size);\n border-radius: var(--radio-radius, 10000px);\n transition:\n border-color 100ms ease,\n background-color 100ms ease;\n cursor: var(--mantine-cursor-type);\n -webkit-tap-highlight-color: transparent;\n display: flex;\n align-items: center;\n justify-content: center;\n\n @mixin where-light {\n background-color: var(--mantine-color-white);\n border-color: var(--mantine-color-gray-4);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-dark-6);\n border-color: var(--mantine-color-dark-4);\n }\n\n &[data-checked] {\n background-color: var(--radio-color);\n border-color: var(--radio-color);\n\n & > .icon {\n opacity: 1;\n transform: none;\n color: var(--radio-icon-color);\n }\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n background-color: var(--mantine-color-disabled);\n border-color: var(--mantine-color-disabled-border);\n\n &[data-checked] > .icon {\n color: var(--mantine-color-disabled-color);\n }\n }\n}\n\n.indicator--outline {\n &[data-checked]:not([data-disabled]) {\n background-color: transparent;\n border-color: var(--radio-color);\n\n & > .icon {\n color: var(--radio-color);\n opacity: 1;\n transform: none;\n }\n }\n}\n\n.icon {\n display: block;\n width: var(--radio-icon-size);\n height: var(--radio-icon-size);\n color: transparent;\n pointer-events: none;\n transform: translateY(rem(5px)) scale(0.5);\n opacity: 1;\n transition:\n transform 100ms ease,\n opacity 100ms ease;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"RadioIndicator.module.cjs","names":[],"sources":["../../../../src/components/Radio/RadioIndicator/RadioIndicator.module.css"],"sourcesContent":[".indicator {\n --radio-size-xs: 16px;\n --radio-size-sm: 20px;\n --radio-size-md: 24px;\n --radio-size-lg: 30px;\n --radio-size-xl: 36px;\n\n --radio-icon-size-xs: 6px;\n --radio-icon-size-sm: 8px;\n --radio-icon-size-md: 10px;\n --radio-icon-size-lg: 14px;\n --radio-icon-size-xl: 16px;\n\n --radio-icon-size: var(--radio-icon-size-sm);\n --radio-size: var(--radio-size-sm);\n --radio-color: var(--mantine-primary-color-filled);\n --radio-icon-color: var(--mantine-color-white);\n\n position: relative;\n border: 1px solid transparent;\n width: var(--radio-size);\n min-width: var(--radio-size);\n height: var(--radio-size);\n min-height: var(--radio-size);\n border-radius: var(--radio-radius, 10000px);\n transition:\n border-color 100ms ease,\n background-color 100ms ease;\n cursor: var(--mantine-cursor-type);\n -webkit-tap-highlight-color: transparent;\n display: flex;\n align-items: center;\n justify-content: center;\n\n @mixin where-light {\n background-color: var(--mantine-color-white);\n border-color: var(--mantine-color-gray-4);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-dark-6);\n border-color: var(--mantine-color-dark-4);\n }\n\n &[data-checked] {\n background-color: var(--radio-color);\n border-color: var(--radio-color);\n\n & > .icon {\n opacity: 1;\n transform: none;\n color: var(--radio-icon-color);\n }\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n background-color: var(--mantine-color-disabled);\n border-color: var(--mantine-color-disabled-border);\n\n &[data-checked] > .icon {\n color: var(--mantine-color-disabled-color);\n }\n }\n}\n\n.indicator--light {\n &[data-checked]:not([data-disabled]) {\n background-color: var(--radio-bg);\n border-color: transparent;\n\n & > .icon {\n color: var(--radio-icon-color);\n opacity: 1;\n transform: none;\n }\n }\n}\n\n.indicator--outline {\n &[data-checked]:not([data-disabled]) {\n background-color: transparent;\n border-color: var(--radio-color);\n\n & > .icon {\n color: var(--radio-color);\n opacity: 1;\n transform: none;\n }\n }\n}\n\n.icon {\n display: block;\n width: var(--radio-icon-size);\n height: var(--radio-icon-size);\n color: transparent;\n pointer-events: none;\n transform: translateY(rem(5px)) scale(0.5);\n opacity: 1;\n transition:\n transform 100ms ease,\n opacity 100ms ease;\n}\n"],"mappings":""}
@@ -19,6 +19,8 @@ function roundValueTo(value, to) {
19
19
  const precision = `${to}`.split(".")[1]?.length || 0;
20
20
  return Number(rounded.toFixed(precision));
21
21
  }
22
+ const TOUCH_MOVE_THRESHOLD = 10;
23
+ const EMULATED_CLICK_TIMEOUT = 500;
22
24
  const defaultProps = {
23
25
  size: "sm",
24
26
  getSymbolLabel: (value) => `${value}`,
@@ -32,7 +34,7 @@ const varsResolver = require_create_vars_resolver.createVarsResolver((theme, { s
32
34
  } }));
33
35
  const Rating = require_factory.factory((_props) => {
34
36
  const props = require_use_props.useProps("Rating", defaultProps, _props);
35
- const { classNames, className, style, styles, unstyled, vars, name, id, value, defaultValue, onChange, fractions, count, onMouseEnter, readOnly, allowClear, onMouseMove, onHover, onMouseLeave, onTouchStart, onTouchEnd, size, variant, getSymbolLabel, color, emptySymbol, fullSymbol, highlightSelectedOnly, attributes, ref, ...others } = props;
37
+ const { classNames, className, style, styles, unstyled, vars, name, id, value, defaultValue, onChange, fractions, count, onMouseEnter, readOnly, allowClear, onMouseMove, onHover, onMouseLeave, onTouchStart, onTouchMove, onTouchCancel, onTouchEnd, size, variant, getSymbolLabel, color, emptySymbol, fullSymbol, highlightSelectedOnly, attributes, ref, ...others } = props;
36
38
  const getStyles = require_use_styles.useStyles({
37
39
  name: "Rating",
38
40
  classes: require_Rating_module.default,
@@ -50,6 +52,8 @@ const Rating = require_factory.factory((_props) => {
50
52
  const _name = (0, _mantine_hooks.useId)(name);
51
53
  const _id = (0, _mantine_hooks.useId)(id);
52
54
  const rootRef = (0, react.useRef)(null);
55
+ const touchStartPosition = (0, react.useRef)(null);
56
+ const lastTouchTimestamp = (0, react.useRef)(0);
53
57
  const [_value, setValue] = (0, _mantine_hooks.useUncontrolled)({
54
58
  value,
55
59
  defaultValue,
@@ -70,6 +74,10 @@ const Rating = require_factory.factory((_props) => {
70
74
  const hoverValue = (dir === "rtl" ? right - x : x - left) / symbolWidth;
71
75
  return (0, _mantine_hooks.clamp)(roundValueTo(hoverValue + decimalUnit / 2, decimalUnit), decimalUnit, _count);
72
76
  };
77
+ const applyValue = (newValue) => {
78
+ if (allowClear && newValue === stableValueRounded) setValue(0);
79
+ else setValue(newValue);
80
+ };
73
81
  const handleMouseEnter = (event) => {
74
82
  onMouseEnter?.(event);
75
83
  !readOnly && setOutside(false);
@@ -90,15 +98,31 @@ const Rating = require_factory.factory((_props) => {
90
98
  };
91
99
  const handleTouchStart = (event) => {
92
100
  const { touches } = event;
93
- if (touches.length !== 1) return;
94
- if (!readOnly) {
95
- const touch = touches[0];
96
- setValue(getRatingFromCoordinates(touch.clientX));
97
- }
101
+ touchStartPosition.current = touches.length === 1 ? {
102
+ x: touches[0].clientX,
103
+ y: touches[0].clientY
104
+ } : null;
98
105
  onTouchStart?.(event);
99
106
  };
107
+ const handleTouchMove = (event) => {
108
+ const startPosition = touchStartPosition.current;
109
+ const touch = event.touches[0];
110
+ if (startPosition && touch && Math.hypot(touch.clientX - startPosition.x, touch.clientY - startPosition.y) > TOUCH_MOVE_THRESHOLD) touchStartPosition.current = null;
111
+ onTouchMove?.(event);
112
+ };
113
+ const handleTouchCancel = (event) => {
114
+ touchStartPosition.current = null;
115
+ onTouchCancel?.(event);
116
+ };
100
117
  const handleTouchEnd = (event) => {
101
- event.preventDefault();
118
+ const startPosition = touchStartPosition.current;
119
+ const touch = event.changedTouches[0];
120
+ touchStartPosition.current = null;
121
+ if (startPosition && touch && !readOnly) {
122
+ event.preventDefault();
123
+ applyValue(getRatingFromCoordinates(touch.clientX));
124
+ lastTouchTimestamp.current = Date.now();
125
+ }
102
126
  onTouchEnd?.(event);
103
127
  };
104
128
  const handleItemBlur = () => isOutside && setHovered(-1);
@@ -109,11 +133,8 @@ const Rating = require_factory.factory((_props) => {
109
133
  }
110
134
  };
111
135
  const handleChange = (event) => {
112
- if (!readOnly) {
113
- const newValue = typeof event === "number" ? event : parseFloat(event.target.value);
114
- if (allowClear && newValue === stableValueRounded) setValue(0);
115
- else setValue(newValue);
116
- }
136
+ if (readOnly || Date.now() - lastTouchTimestamp.current < EMULATED_CLICK_TIMEOUT) return;
137
+ applyValue(typeof event === "number" ? event : parseFloat(event.target.value));
117
138
  };
118
139
  const items = Array(_count).fill(0).map((_, index) => {
119
140
  const integerValue = index + 1;
@@ -152,6 +173,8 @@ const Rating = require_factory.factory((_props) => {
152
173
  onMouseEnter: handleMouseEnter,
153
174
  onMouseLeave: handleMouseLeave,
154
175
  onTouchStart: handleTouchStart,
176
+ onTouchMove: handleTouchMove,
177
+ onTouchCancel: handleTouchCancel,
155
178
  onTouchEnd: handleTouchEnd,
156
179
  variant,
157
180
  size,
@@ -1 +1 @@
1
- {"version":3,"file":"Rating.cjs","names":["createVarsResolver","getSize","getThemeColor","factory","useProps","useStyles","useDirection","useId","useRef","useUncontrolled","useState","clamp","RatingItem","RatingProvider","Box","useMergedRef","classes"],"sources":["../../../src/components/Rating/Rating.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { clamp, useId, useMergedRef, useUncontrolled } from '@mantine/hooks';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getSize,\n getThemeColor,\n MantineColor,\n MantineSize,\n StylesApiProps,\n useDirection,\n useProps,\n useStyles,\n} from '../../core';\nimport { RatingProvider } from './Rating.context';\nimport { RatingItem } from './RatingItem/RatingItem';\nimport classes from './Rating.module.css';\n\nfunction roundValueTo(value: number, to: number) {\n const rounded = Math.round(value / to) * to;\n const precision = `${to}`.split('.')[1]?.length || 0;\n return Number(rounded.toFixed(precision));\n}\n\nexport type RatingStylesNames =\n | 'root'\n | 'starSymbol'\n | 'input'\n | 'label'\n | 'symbolBody'\n | 'symbolGroup';\n\nexport type RatingCssVariables = {\n root: '--rating-size' | '--rating-color';\n};\n\nexport interface RatingProps\n extends BoxProps, StylesApiProps<RatingFactory>, ElementProps<'div', 'onChange'> {\n /** Uncontrolled component default value */\n defaultValue?: number;\n\n /** Controlled component value */\n value?: number;\n\n /** Called when value changes */\n onChange?: (value: number) => void;\n\n /** Icon displayed for unselected rating items. Can be a function that receives the rating value. */\n emptySymbol?: React.ReactNode | ((value: number) => React.ReactNode);\n\n /** Icon displayed for selected rating items. Can be a function that receives the rating value. */\n fullSymbol?: React.ReactNode | ((value: number) => React.ReactNode);\n\n /** Number of fractions each item can be divided into, default is 1 */\n fractions?: number;\n\n /** Controls component size @default 'sm' */\n size?: MantineSize | number | (string & {});\n\n /** Number of rating items (stars), default is 5 */\n count?: number;\n\n /** Called when rating item is hovered. Receives -1 when hover ends. */\n onHover?: (value: number) => void;\n\n /** Function to generate aria-label for each rating value. Receives the rating value as argument, default is (value) => String(value) */\n getSymbolLabel?: (index: number) => string;\n\n /** Name attribute for form submission. If not provided, a unique id will be generated. */\n name?: string;\n\n /** When true, rating cannot be changed by user interaction, default is false */\n readOnly?: boolean;\n\n /** When true, clicking the same rating value clears the rating to 0, default is false */\n allowClear?: boolean;\n\n /** When true, only the clicked rating item is highlighted, not all items up to the selected value, default is false */\n highlightSelectedOnly?: boolean;\n\n /** Key of theme.colors or any CSS color value, default is 'yellow' */\n color?: MantineColor;\n}\n\nexport type RatingFactory = Factory<{\n props: RatingProps;\n ref: HTMLDivElement;\n stylesNames: RatingStylesNames;\n vars: RatingCssVariables;\n}>;\n\nconst defaultProps = {\n size: 'sm',\n getSymbolLabel: (value) => `${value}`,\n count: 5,\n fractions: 1,\n color: 'yellow',\n} satisfies Partial<RatingProps>;\n\nconst varsResolver = createVarsResolver<RatingFactory>((theme, { size, color }) => ({\n root: {\n '--rating-size': getSize(size, 'rating-size'),\n '--rating-color': getThemeColor(color, theme),\n },\n}));\n\nexport const Rating = factory<RatingFactory>((_props) => {\n const props = useProps('Rating', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n name,\n id,\n value,\n defaultValue,\n onChange,\n fractions,\n count,\n onMouseEnter,\n readOnly,\n allowClear,\n onMouseMove,\n onHover,\n onMouseLeave,\n onTouchStart,\n onTouchEnd,\n size,\n variant,\n getSymbolLabel,\n color,\n emptySymbol,\n fullSymbol,\n highlightSelectedOnly,\n attributes,\n ref,\n ...others\n } = props;\n\n const getStyles = useStyles<RatingFactory>({\n name: 'Rating',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const { dir } = useDirection();\n\n const _name = useId(name);\n const _id = useId(id);\n const rootRef = useRef<HTMLDivElement>(null);\n\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: 0,\n onChange,\n });\n\n const [hovered, setHovered] = useState(-1);\n const [isOutside, setOutside] = useState(true);\n\n const _fractions = Math.floor(fractions);\n const _count = Math.floor(count);\n\n const decimalUnit = 1 / _fractions;\n const stableValueRounded = roundValueTo(_value, decimalUnit);\n const finalValue = hovered !== -1 ? hovered : stableValueRounded;\n\n const getRatingFromCoordinates = (x: number) => {\n if (!rootRef.current) {\n return 0;\n }\n\n const { left, right, width } = rootRef.current.getBoundingClientRect();\n const symbolWidth = width / _count;\n\n const hoverPosition = dir === 'rtl' ? right - x : x - left;\n const hoverValue = hoverPosition / symbolWidth;\n\n return clamp(roundValueTo(hoverValue + decimalUnit / 2, decimalUnit), decimalUnit, _count);\n };\n\n const handleMouseEnter = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseEnter?.(event);\n !readOnly && setOutside(false);\n };\n\n const handleMouseMove = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseMove?.(event);\n\n if (readOnly) {\n return;\n }\n\n const rounded = getRatingFromCoordinates(event.clientX);\n\n setHovered(rounded);\n rounded !== hovered && onHover?.(rounded);\n };\n\n const handleMouseLeave = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseLeave?.(event);\n\n if (readOnly) {\n return;\n }\n\n setHovered(-1);\n setOutside(true);\n hovered !== -1 && onHover?.(-1);\n };\n\n const handleTouchStart = (event: React.TouchEvent<HTMLDivElement>) => {\n const { touches } = event;\n if (touches.length !== 1) {\n return;\n }\n\n if (!readOnly) {\n const touch = touches[0];\n setValue(getRatingFromCoordinates(touch.clientX));\n }\n\n onTouchStart?.(event);\n };\n\n const handleTouchEnd = (event: React.TouchEvent<HTMLDivElement>) => {\n event.preventDefault();\n\n onTouchEnd?.(event);\n };\n\n const handleItemBlur = () => isOutside && setHovered(-1);\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement> | number) => {\n if (!readOnly) {\n if (typeof event === 'number') {\n setHovered(event);\n } else {\n setHovered(parseFloat(event.target.value));\n }\n }\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement> | number) => {\n if (!readOnly) {\n const newValue = typeof event === 'number' ? event : parseFloat(event.target.value);\n\n // If allowClear is true and clicking the same value, reset to 0\n if (allowClear && newValue === stableValueRounded) {\n setValue(0);\n } else {\n setValue(newValue);\n }\n }\n };\n\n const items = Array(_count)\n .fill(0)\n .map((_, index) => {\n const integerValue = index + 1;\n const fractionItems = Array.from(new Array(index === 0 ? _fractions + 1 : _fractions));\n const isGroupActive = !readOnly && Math.ceil(hovered) === integerValue;\n\n return (\n <div\n key={integerValue}\n data-active={isGroupActive || undefined}\n {...getStyles('symbolGroup')}\n >\n {fractionItems.map((__, fractionIndex) => {\n const fractionValue = decimalUnit * (index === 0 ? fractionIndex : fractionIndex + 1);\n const symbolValue = roundValueTo(integerValue - 1 + fractionValue, decimalUnit);\n\n return (\n <RatingItem\n key={`${integerValue}-${symbolValue}`}\n getSymbolLabel={getSymbolLabel}\n emptyIcon={emptySymbol}\n fullIcon={fullSymbol}\n full={\n highlightSelectedOnly ? symbolValue === finalValue : symbolValue <= finalValue\n }\n active={symbolValue === finalValue}\n checked={symbolValue === stableValueRounded}\n readOnly={readOnly}\n fractionValue={fractionValue}\n value={symbolValue}\n name={_name}\n onChange={handleChange}\n onBlur={handleItemBlur}\n onInputChange={handleInputChange}\n id={`${_id}-${index}-${fractionIndex}`}\n />\n );\n })}\n </div>\n );\n });\n\n return (\n <RatingProvider value={{ getStyles }}>\n <Box\n ref={useMergedRef(rootRef, ref)}\n {...getStyles('root')}\n onMouseMove={handleMouseMove}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onTouchStart={handleTouchStart}\n onTouchEnd={handleTouchEnd}\n variant={variant}\n size={size}\n id={_id}\n {...others}\n >\n {items}\n </Box>\n </RatingProvider>\n );\n});\n\nRating.classes = classes;\nRating.varsResolver = varsResolver;\nRating.displayName = '@mantine/core/Rating';\n\nexport namespace Rating {\n export type Props = RatingProps;\n export type StylesNames = RatingStylesNames;\n export type Factory = RatingFact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,IAAA,CAACC,uBAAAA,gBAAD;EAAgB,OAAO,EAAE,UAAU;EACjC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,YAAAA,KAAD;GACE,MAAA,GAAKC,eAAAA,aAAAA,CAAa,SAAS,GAAG;GAC9B,GAAI,UAAU,MAAM;GACpB,aAAa;GACb,cAAc;GACd,cAAc;GACd,cAAc;GACd,YAAY;GACH;GACH;GACN,IAAI;GACJ,GAAI;GAEH,UAAA;EACE,CAAA;CACS,CAAA;AAEpB,CAAC;AAED,OAAO,UAAUC,sBAAAA;AACjB,OAAO,eAAe;AACtB,OAAO,cAAc"}
1
+ {"version":3,"file":"Rating.cjs","names":["createVarsResolver","getSize","getThemeColor","factory","useProps","useStyles","useDirection","useId","useRef","useUncontrolled","useState","clamp","RatingItem","RatingProvider","Box","useMergedRef","classes"],"sources":["../../../src/components/Rating/Rating.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { clamp, useId, useMergedRef, useUncontrolled } from '@mantine/hooks';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getSize,\n getThemeColor,\n MantineColor,\n MantineSize,\n StylesApiProps,\n useDirection,\n useProps,\n useStyles,\n} from '../../core';\nimport { RatingProvider } from './Rating.context';\nimport { RatingItem } from './RatingItem/RatingItem';\nimport classes from './Rating.module.css';\n\nfunction roundValueTo(value: number, to: number) {\n const rounded = Math.round(value / to) * to;\n const precision = `${to}`.split('.')[1]?.length || 0;\n return Number(rounded.toFixed(precision));\n}\n\nconst TOUCH_MOVE_THRESHOLD = 10;\nconst EMULATED_CLICK_TIMEOUT = 500;\n\nexport type RatingStylesNames =\n | 'root'\n | 'starSymbol'\n | 'input'\n | 'label'\n | 'symbolBody'\n | 'symbolGroup';\n\nexport type RatingCssVariables = {\n root: '--rating-size' | '--rating-color';\n};\n\nexport interface RatingProps\n extends BoxProps, StylesApiProps<RatingFactory>, ElementProps<'div', 'onChange'> {\n /** Uncontrolled component default value */\n defaultValue?: number;\n\n /** Controlled component value */\n value?: number;\n\n /** Called when value changes */\n onChange?: (value: number) => void;\n\n /** Icon displayed for unselected rating items. Can be a function that receives the rating value. */\n emptySymbol?: React.ReactNode | ((value: number) => React.ReactNode);\n\n /** Icon displayed for selected rating items. Can be a function that receives the rating value. */\n fullSymbol?: React.ReactNode | ((value: number) => React.ReactNode);\n\n /** Number of fractions each item can be divided into, default is 1 */\n fractions?: number;\n\n /** Controls component size @default 'sm' */\n size?: MantineSize | number | (string & {});\n\n /** Number of rating items (stars), default is 5 */\n count?: number;\n\n /** Called when rating item is hovered. Receives -1 when hover ends. */\n onHover?: (value: number) => void;\n\n /** Function to generate aria-label for each rating value. Receives the rating value as argument, default is (value) => String(value) */\n getSymbolLabel?: (index: number) => string;\n\n /** Name attribute for form submission. If not provided, a unique id will be generated. */\n name?: string;\n\n /** When true, rating cannot be changed by user interaction, default is false */\n readOnly?: boolean;\n\n /** When true, clicking the same rating value clears the rating to 0, default is false */\n allowClear?: boolean;\n\n /** When true, only the clicked rating item is highlighted, not all items up to the selected value, default is false */\n highlightSelectedOnly?: boolean;\n\n /** Key of theme.colors or any CSS color value, default is 'yellow' */\n color?: MantineColor;\n}\n\nexport type RatingFactory = Factory<{\n props: RatingProps;\n ref: HTMLDivElement;\n stylesNames: RatingStylesNames;\n vars: RatingCssVariables;\n}>;\n\nconst defaultProps = {\n size: 'sm',\n getSymbolLabel: (value) => `${value}`,\n count: 5,\n fractions: 1,\n color: 'yellow',\n} satisfies Partial<RatingProps>;\n\nconst varsResolver = createVarsResolver<RatingFactory>((theme, { size, color }) => ({\n root: {\n '--rating-size': getSize(size, 'rating-size'),\n '--rating-color': getThemeColor(color, theme),\n },\n}));\n\nexport const Rating = factory<RatingFactory>((_props) => {\n const props = useProps('Rating', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n name,\n id,\n value,\n defaultValue,\n onChange,\n fractions,\n count,\n onMouseEnter,\n readOnly,\n allowClear,\n onMouseMove,\n onHover,\n onMouseLeave,\n onTouchStart,\n onTouchMove,\n onTouchCancel,\n onTouchEnd,\n size,\n variant,\n getSymbolLabel,\n color,\n emptySymbol,\n fullSymbol,\n highlightSelectedOnly,\n attributes,\n ref,\n ...others\n } = props;\n\n const getStyles = useStyles<RatingFactory>({\n name: 'Rating',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const { dir } = useDirection();\n\n const _name = useId(name);\n const _id = useId(id);\n const rootRef = useRef<HTMLDivElement>(null);\n const touchStartPosition = useRef<{ x: number; y: number } | null>(null);\n const lastTouchTimestamp = useRef(0);\n\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: 0,\n onChange,\n });\n\n const [hovered, setHovered] = useState(-1);\n const [isOutside, setOutside] = useState(true);\n\n const _fractions = Math.floor(fractions);\n const _count = Math.floor(count);\n\n const decimalUnit = 1 / _fractions;\n const stableValueRounded = roundValueTo(_value, decimalUnit);\n const finalValue = hovered !== -1 ? hovered : stableValueRounded;\n\n const getRatingFromCoordinates = (x: number) => {\n if (!rootRef.current) {\n return 0;\n }\n\n const { left, right, width } = rootRef.current.getBoundingClientRect();\n const symbolWidth = width / _count;\n\n const hoverPosition = dir === 'rtl' ? right - x : x - left;\n const hoverValue = hoverPosition / symbolWidth;\n\n return clamp(roundValueTo(hoverValue + decimalUnit / 2, decimalUnit), decimalUnit, _count);\n };\n\n const applyValue = (newValue: number) => {\n // If allowClear is true and selecting the same value, reset to 0\n if (allowClear && newValue === stableValueRounded) {\n setValue(0);\n } else {\n setValue(newValue);\n }\n };\n\n const handleMouseEnter = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseEnter?.(event);\n !readOnly && setOutside(false);\n };\n\n const handleMouseMove = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseMove?.(event);\n\n if (readOnly) {\n return;\n }\n\n const rounded = getRatingFromCoordinates(event.clientX);\n\n setHovered(rounded);\n rounded !== hovered && onHover?.(rounded);\n };\n\n const handleMouseLeave = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseLeave?.(event);\n\n if (readOnly) {\n return;\n }\n\n setHovered(-1);\n setOutside(true);\n hovered !== -1 && onHover?.(-1);\n };\n\n const handleTouchStart = (event: React.TouchEvent<HTMLDivElement>) => {\n const { touches } = event;\n\n touchStartPosition.current =\n touches.length === 1 ? { x: touches[0].clientX, y: touches[0].clientY } : null;\n\n onTouchStart?.(event);\n };\n\n const handleTouchMove = (event: React.TouchEvent<HTMLDivElement>) => {\n const startPosition = touchStartPosition.current;\n const touch = event.touches[0];\n\n if (\n startPosition &&\n touch &&\n Math.hypot(touch.clientX - startPosition.x, touch.clientY - startPosition.y) >\n TOUCH_MOVE_THRESHOLD\n ) {\n touchStartPosition.current = null;\n }\n\n onTouchMove?.(event);\n };\n\n const handleTouchCancel = (event: React.TouchEvent<HTMLDivElement>) => {\n touchStartPosition.current = null;\n\n onTouchCancel?.(event);\n };\n\n const handleTouchEnd = (event: React.TouchEvent<HTMLDivElement>) => {\n const startPosition = touchStartPosition.current;\n const touch = event.changedTouches[0];\n touchStartPosition.current = null;\n\n if (startPosition && touch && !readOnly) {\n event.preventDefault();\n applyValue(getRatingFromCoordinates(touch.clientX));\n lastTouchTimestamp.current = Date.now();\n }\n\n onTouchEnd?.(event);\n };\n\n const handleItemBlur = () => isOutside && setHovered(-1);\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement> | number) => {\n if (!readOnly) {\n if (typeof event === 'number') {\n setHovered(event);\n } else {\n setHovered(parseFloat(event.target.value));\n }\n }\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement> | number) => {\n if (readOnly || Date.now() - lastTouchTimestamp.current < EMULATED_CLICK_TIMEOUT) {\n return;\n }\n\n applyValue(typeof event === 'number' ? event : parseFloat(event.target.value));\n };\n\n const items = Array(_count)\n .fill(0)\n .map((_, index) => {\n const integerValue = index + 1;\n const fractionItems = Array.from(new Array(index === 0 ? _fractions + 1 : _fractions));\n const isGroupActive = !readOnly && Math.ceil(hovered) === integerValue;\n\n return (\n <div\n key={integerValue}\n data-active={isGroupActive || undefined}\n {...getStyles('symbolGroup')}\n >\n {fractionItems.map((__, fractionIndex) => {\n const fractionValue = decimalUnit * (index === 0 ? fractionIndex : fractionIndex + 1);\n const symbolValue = roundValueTo(integerValue - 1 + fractionValue, decimalUnit);\n\n return (\n <RatingItem\n key={`${integerValue}-${symbolValue}`}\n getSymbolLabel={getSymbolLabel}\n emptyIcon={emptySymbol}\n fullIcon={fullSymbol}\n full={\n highlightSelectedOnly ? symbolValue === finalValue : symbolValue <= finalValue\n }\n active={symbolValue === finalValue}\n checked={symbolValue === stableValueRounded}\n readOnly={readOnly}\n fractionValue={fractionValue}\n value={symbolValue}\n name={_name}\n onChange={handleChange}\n onBlur={handleItemBlur}\n onInputChange={handleInputChange}\n id={`${_id}-${index}-${fractionIndex}`}\n />\n );\n })}\n </div>\n );\n });\n\n return (\n <RatingProvider value={{ getStyles }}>\n <Box\n ref={useMergedRef(rootRef, ref)}\n {...getStyles('root')}\n onMouseMove={handleMouseMove}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onTouchStart={handleTouchStart}\n onTouchMove={handleTouchMove}\n onTouchCancel={handleTouchCancel}\n onTouchEnd={handleTouchEnd}\n variant={variant}\n size={size}\n id={_id}\n {...others}\n >\n {items}\n </Box>\n </RatingProvider>\n );\n});\n\nRating.classes = classes;\nRating.varsResolver = varsResolver;\nRating.displayName = '@mantine/core/Rating';\n\nexport namespace Rating {\n export type Props = RatingProps;\n export type StylesNames = RatingStylesNames;\n export type Factory = RatingFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,SAAS,aAAa,OAAe,IAAY;CAC/C,MAAM,UAAU,KAAK,MAAM,QAAQ,EAAE,IAAI;CACzC,MAAM,YAAY,GAAG,KAAK,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,UAAU;CACnD,OAAO,O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,KAAK,IAAI,kBAAkB;IACxC,MAAM,gBAAgB,eAAe,UAAU,IAAI,gBAAgB,gBAAgB;IACnF,MAAM,cAAc,aAAa,eAAe,IAAI,eAAe,WAAW;IAE9E,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,YAAD;KAEkB;KAChB,WAAW;KACX,UAAU;KACV,MACE,wBAAwB,gBAAgB,aAAa,eAAe;KAEtE,QAAQ,gBAAgB;KACxB,SAAS,gBAAgB;KACf;KACK;KACf,OAAO;KACP,MAAM;KACN,UAAU;KACV,QAAQ;KACR,eAAe;KACf,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG;IACxB,GAjBM,GAAG,aAAa,GAAG,aAiBzB;GAEL,CAAC;EACE,GA9BE,YA8BF;CAET,CAAC;CAEH,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,uBAAAA,gBAAD;EAAgB,OAAO,EAAE,UAAU;EACjC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,YAAAA,KAAD;GACE,MAAA,GAAKC,eAAAA,aAAAA,CAAa,SAAS,GAAG;GAC9B,GAAI,UAAU,MAAM;GACpB,aAAa;GACb,cAAc;GACd,cAAc;GACd,cAAc;GACd,aAAa;GACb,eAAe;GACf,YAAY;GACH;GACH;GACN,IAAI;GACJ,GAAI;GAEH,UAAA;EACE,CAAA;CACS,CAAA;AAEpB,CAAC;AAED,OAAO,UAAUC,sBAAAA;AACjB,OAAO,eAAe;AACtB,OAAO,cAAc"}
@@ -156,7 +156,7 @@ const Select = require_factory.genericFactory((_props) => {
156
156
  },
157
157
  onBlur: (event) => {
158
158
  if (autoSelectOnBlur) combobox.clickSelectedOption();
159
- searchable && combobox.closeDropdown();
159
+ combobox.closeDropdown();
160
160
  const optionLockup = _value != null && (`${_value}` in optionsLockup ? optionsLockup[`${_value}`] : retainedSelectedOptions.current[`${_value}`]);
161
161
  handleSearchChange(optionLockup ? optionLockup.label || "" : "");
162
162
  onBlur?.(event);
@@ -1 +1 @@
1
- {"version":3,"file":"Select.cjs","names":["genericFactory","useProps","useMemo","getParsedComboboxData","useRef","getOptionsLockup","useId","useUncontrolled","usePrevious","useCombobox","useResolvedStylesApi","Combobox","InputBase","isExternalInputChange","getOptionByLabel","OptionsDropdown"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\nimport { useId, usePrevious, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n Factory,\n genericFactory,\n MantineColor,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n} from '../../core';\nimport {\n Combobox,\n ComboboxItem,\n ComboboxLikeProps,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n getOptionsLockup,\n getParsedComboboxData,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n} from '../Combobox';\nimport { getOptionByLabel } from '../Combobox/get-options-lockup/get-option-by-label';\nimport { isExternalInputChange } from '../Combobox/is-external-input-change/is-external-input-change';\nimport {\n __BaseInputProps,\n __InputStylesNames,\n ClearSectionMode,\n InputClearButtonProps,\n InputVariant,\n} from '../Input';\nimport { InputBase } from '../InputBase';\nimport { ScrollAreaProps } from '../ScrollArea';\n\nexport type SelectStylesNames = __InputStylesNames | ComboboxLikeStylesNames;\n\nexport interface SelectProps<Value extends Primitive = string>\n extends\n BoxProps,\n __BaseInputProps,\n ComboboxLikeProps<Value>,\n StylesApiProps<SelectFactory>,\n ElementProps<'input', 'onChange' | 'size' | 'value' | 'defaultValue'> {\n /** Controlled component value */\n value?: Value | null;\n\n /** Uncontrolled component default value */\n defaultValue?: Value | null;\n\n /** Called when value changes */\n onChange?: (value: Value | null, option: ComboboxItem<Value>) => void;\n\n /** Called when the clear button is clicked */\n onClear?: () => void;\n\n /** Determines whether the select should be searchable @default false */\n searchable?: boolean;\n\n /** Displays check icon near the selected option label @default true */\n withCheckIcon?: boolean;\n\n /** Aligns unchecked labels with the checked one @default false */\n withAlignedLabels?: boolean;\n\n /** Position of the check icon relative to the option label @default 'left' */\n checkIconPosition?: 'left' | 'right';\n\n /** Message displayed when no options match the search query or when there is no data */\n nothingFoundMessage?: React.ReactNode;\n\n /** Controlled search value */\n searchValue?: string;\n\n /** Default search value */\n defaultSearchValue?: string;\n\n /** Called when search changes */\n onSearchChange?: (value: string) => void;\n\n /** Allows deselecting the selected option by clicking it @default true */\n allowDeselect?: boolean;\n\n /** Displays clear button in the right section when component has value @default false */\n clearable?: boolean;\n\n /** Determines how the clear button and rightSection are rendered @default 'both' */\n clearSectionMode?: ClearSectionMode;\n\n /** Props passed down to the clear button */\n clearButtonProps?: InputClearButtonProps;\n\n /** Props passed down to the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** A function to render content of the option, replaces the default content of the option */\n renderOption?: (item: ComboboxLikeRenderOptionInput<ComboboxItem<Value>>) => React.ReactNode;\n\n /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Controls color of the default chevron, by default depends on the color scheme */\n chevronColor?: MantineColor;\n\n /** Automatically selects the highlighted option when input loses focus @default false */\n autoSelectOnBlur?: boolean;\n\n /** Opens dropdown when input receives focus (requires searchable={true}) @default true */\n openOnFocus?: boolean;\n}\n\nexport type SelectFactory = Factory<{\n props: SelectProps;\n ref: HTMLInputElement;\n stylesNames: SelectStylesNames;\n variant: InputVariant;\n signature: <Value extends Primitive = string>(props: SelectProps<Value>) => React.JSX.Element;\n}>;\n\nconst defaultProps = {\n size: 'sm',\n withCheckIcon: true,\n allowDeselect: true,\n checkIconPosition: 'left',\n openOnFocus: true,\n} satisfies Partial<SelectProps>;\n\nexport const Select = genericFactory<SelectFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'Select'], defaultProps, _props);\n const {\n classNames,\n styles,\n unstyled,\n vars,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownClose,\n onDropdownOpen,\n onFocus,\n onBlur,\n onClick,\n onChange,\n data,\n value,\n defaultValue,\n selectFirstOptionOnChange,\n selectFirstOptionOnDropdownOpen,\n onOptionSubmit,\n comboboxProps,\n readOnly,\n disabled,\n filter,\n limit,\n withScrollArea,\n maxDropdownHeight,\n floatingHeight,\n size,\n searchable,\n rightSection,\n checkIconPosition,\n withCheckIcon,\n withAlignedLabels,\n nothingFoundMessage,\n name,\n form,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n allowDeselect,\n error,\n rightSectionPointerEvents,\n id,\n clearable,\n clearSectionMode,\n clearButtonProps,\n hiddenInputProps,\n renderOption,\n onClear,\n autoComplete,\n scrollAreaProps,\n __defaultRightSection,\n __clearSection,\n __clearable,\n chevronColor,\n autoSelectOnBlur,\n openOnFocus,\n attributes,\n ...others\n } = props;\n\n const parsedData = useMemo(() => getParsedComboboxData(data), [data]);\n const retainedSelectedOptions = useRef<Record<string, ComboboxItem<Primitive>>>({});\n const optionsLockup = useMemo(() => getOptionsLockup(parsedData), [parsedData]);\n const _id = useId(id);\n\n const [_value, setValue, controlled] = useUncontrolled({\n value,\n defaultValue,\n finalValue: null,\n onChange,\n });\n\n const selectedOption =\n _value != null\n ? `${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]\n : retainedSelectedOptions.current[`${_value}`]\n : undefined;\n const previousSelectedOption = usePrevious(selectedOption);\n\n const [search, setSearch, searchControlled] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: selectedOption ? selectedOption.label : '',\n onChange: onSearchChange,\n });\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (selectFirstOptionOnDropdownOpen) {\n combobox.selectFirstOption();\n } else {\n combobox.updateSelectedOptionIndex('active', { scrollIntoView: true });\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n // Required for autoSelectOnBlur to work correctly\n setTimeout(combobox.resetSelectedOption, 0);\n },\n });\n\n const handleSearchChange = (value: string) => {\n setSearch(value);\n combobox.resetSelectedOption();\n };\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<SelectFactory>({\n props,\n styles,\n classNames,\n });\n\n useEffect(() => {\n if (selectFirstOptionOnChange) {\n combobox.selectFirstOption();\n }\n }, [selectFirstOptionOnChange, search]);\n\n useEffect(() => {\n if (value === null) {\n handleSearchChange('');\n }\n\n if (\n value != null &&\n selectedOption &&\n (previousSelectedOption?.value !== selectedOption.value ||\n previousSelectedOption?.label !== selectedOption.label)\n ) {\n handleSearchChange(selectedOption.label);\n }\n }, [value, selectedOption]);\n\n useEffect(() => {\n if (!controlled && !searchControlled) {\n handleSearchChange(\n _value != null\n ? `${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]?.label\n : retainedSelectedOptions.current[`${_value}`]?.label || ''\n : ''\n );\n }\n }, [optionsLockup, _value]);\n\n useEffect(() => {\n if (_value) {\n if (`${_value}` in optionsLockup) {\n retainedSelectedOptions.current[`${_value}`] = optionsLockup[`${_value}`];\n }\n }\n }, [optionsLockup, _value]);\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n setValue(null, null);\n handleSearchChange('');\n onClear?.();\n }}\n />\n );\n\n const _clearable = clearable && _value != null && !disabled && !readOnly;\n\n return (\n <>\n <Combobox\n store={combobox}\n __staticSelector=\"Select\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n readOnly={readOnly}\n size={size}\n attributes={attributes}\n floatingHeight={floatingHeight}\n keepMounted={autoSelectOnBlur}\n onOptionSubmit={(val) => {\n onOptionSubmit?.(val as any);\n const optionLockup = allowDeselect\n ? `${optionsLockup[val].value}` === `${_value}`\n ? null\n : optionsLockup[val]\n : optionsLockup[val];\n\n const nextValue = optionLockup ? optionLockup.value : null;\n\n nextValue !== _value && setValue(nextValue as any, optionLockup);\n !controlled && handleSearchChange(nextValue != null ? optionLockup?.label || '' : '');\n combobox.closeDropdown();\n }}\n {...comboboxProps}\n >\n <Combobox.Target\n targetType={searchable ? 'input' : 'button'}\n autoComplete={autoComplete}\n withExpandedAttribute\n >\n <InputBase\n id={_id}\n __defaultRightSection={\n <Combobox.Chevron\n size={size}\n error={error}\n unstyled={unstyled}\n color={chevronColor}\n />\n }\n __clearSection={clearButton}\n __clearable={_clearable}\n __clearSectionMode={clearSectionMode}\n rightSection={rightSection}\n rightSectionPointerEvents={rightSectionPointerEvents || 'none'}\n {...others}\n size={size}\n __staticSelector=\"Select\"\n disabled={disabled}\n readOnly={readOnly || !searchable}\n value={search}\n onChange={(event) => {\n if (isExternalInputChange(event)) {\n if (!readOnly) {\n const externalOption = getOptionByLabel(optionsLockup, event.currentTarget.value);\n\n if (externalOption && `${externalOption.value}` !== `${_value}`) {\n setValue(externalOption.value as any, externalOption);\n !controlled && handleSearchChange(externalOption.label);\n }\n }\n\n return;\n }\n\n handleSearchChange(event.currentTarget.value);\n combobox.openDropdown();\n selectFirstOptionOnChange && combobox.selectFirstOption();\n }}\n onFocus={(event) => {\n openOnFocus && !!searchable && combobox.openDropdown();\n onFocus?.(event);\n }}\n onBlur={(event) => {\n if (autoSelectOnBlur) {\n combobox.clickSelectedOption();\n }\n\n !!searchable && combobox.closeDropdown();\n const optionLockup =\n _value != null &&\n (`${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]\n : retainedSelectedOptions.current[`${_value}`]);\n handleSearchChange(optionLockup ? optionLockup.label || '' : '');\n onBlur?.(event);\n }}\n onClick={(event) => {\n searchable ? combobox.openDropdown() : combobox.toggleDropdown();\n onClick?.(event);\n }}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n pointer={!searchable}\n error={error}\n attributes={attributes}\n />\n </Combobox.Target>\n <OptionsDropdown\n data={parsedData as any}\n hidden={readOnly || disabled}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={search}\n limit={limit}\n hiddenWhenEmpty={!nothingFoundMessage}\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n filterOptions={!!searchable && selectedOption?.label !== search}\n value={_value}\n checkIconPosition={checkIconPosition}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n nothingFoundMessage={nothingFoundMessage}\n unstyled={unstyled}\n labelId={others.label ? `${_id}-label` : undefined}\n aria-label={others.label ? undefined : others['aria-label']}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n />\n </Combobox>\n <Combobox.HiddenInput\n value={_value}\n name={name}\n form={form}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nSelect.classes = { ...InputBase.classes, ...Combobox.classes };\nSelect.displayName = '@mantine/core/Select';\n\nexport namespace Select {\n export type Props<Value extends Primitive = string> = SelectProps<Value>;\n export type StylesNames = SelectStylesNames;\n export type Factory = SelectFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyHA,MAAM,eAAe;CACnB,MAAM;CACN,eAAe;CACf,eAAe;CACf,mBAAmB;CACnB,aAAa;AACf;AAEA,MAAa,SAASA,gBAAAA,gBAA+B,WAAW;CAC9D,MAAM,QAAQC,kBAAAA,SAAS;EAAC;EAAS;EAAgB;CAAQ,GAAG,cAAc,MAAM;CAChF,MAAM,EACJ,YACA,QACA,UACA,MACA,gBACA,uBACA,iBACA,gBACA,SACA,QACA,SACA,UACA,MACA,OACA,cACA,2BACA,iCACA,gBACA,eACA,UACA,UACA,QACA,OACA,gBACA,mBACA,gBACA,MACA,YACA,cACA,mBACA,eACA,mBACA,qBACA,MACA,MACA,aACA,oBACA,gBACA,eACA,OACA,2BACA,IACA,WACA,kBACA,kBACA,kBACA,cACA,SACA,cACA,iBACA,uBACA,gBACA,aACA,cACA,kBACA,aACA,YACA,GAAG,WACD;CAEJ,MAAM,cAAA,GAAaC,MAAAA,QAAAA,OAAcC,iCAAAA,sBAAsB,IAAI,GAAG,CAAC,IAAI,CAAC;CACpE,MAAM,2BAAA,GAA0BC,MAAAA,OAAAA,CAAgD,CAAC,CAAC;CAClF,MAAM,iBAAA,G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CAACC,wBAAAA,iBAAD;GACE,MAAM;GACN,QAAQ,YAAY;GACZ;GACA;GACD;GACP,iBAAiB,CAAC;GACF;GACG;GACnB,eAAe,CAAC,CAAC,cAAc,gBAAgB,UAAU;GACzD,OAAO;GACY;GACJ;GACI;GACE;GACX;GACV,SAAS,OAAO,QAAQ,GAAG,IAAI,UAAU,KAAA;GACzC,cAAY,OAAO,QAAQ,KAAA,IAAY,OAAO;GAChC;GACG;EAClB,CAAA,CACO;CACV,CAAA,GAAA,iBAAA,GAAA,kBAAA,IAAA,CAACJ,iBAAAA,SAAS,aAAV;EACE,OAAO;EACD;EACA;EACI;EACV,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,OAAO,UAAU;CAAE,GAAGC,kBAAAA,UAAU;CAAS,GAAGD,iBAAAA,SAAS;AAAQ;AAC7D,OAAO,cAAc"}
1
+ {"version":3,"file":"Select.cjs","names":["genericFactory","useProps","useMemo","getParsedComboboxData","useRef","getOptionsLockup","useId","useUncontrolled","usePrevious","useCombobox","useResolvedStylesApi","Combobox","InputBase","isExternalInputChange","getOptionByLabel","OptionsDropdown"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\nimport { useId, usePrevious, useUncontrolled } from '@mantine/hooks';\nimport {\n BoxProps,\n ElementProps,\n Factory,\n genericFactory,\n MantineColor,\n Primitive,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n} from '../../core';\nimport {\n Combobox,\n ComboboxItem,\n ComboboxLikeProps,\n ComboboxLikeRenderOptionInput,\n ComboboxLikeStylesNames,\n getOptionsLockup,\n getParsedComboboxData,\n OptionsDropdown,\n OptionsFilter,\n useCombobox,\n} from '../Combobox';\nimport { getOptionByLabel } from '../Combobox/get-options-lockup/get-option-by-label';\nimport { isExternalInputChange } from '../Combobox/is-external-input-change/is-external-input-change';\nimport {\n __BaseInputProps,\n __InputStylesNames,\n ClearSectionMode,\n InputClearButtonProps,\n InputVariant,\n} from '../Input';\nimport { InputBase } from '../InputBase';\nimport { ScrollAreaProps } from '../ScrollArea';\n\nexport type SelectStylesNames = __InputStylesNames | ComboboxLikeStylesNames;\n\nexport interface SelectProps<Value extends Primitive = string>\n extends\n BoxProps,\n __BaseInputProps,\n ComboboxLikeProps<Value>,\n StylesApiProps<SelectFactory>,\n ElementProps<'input', 'onChange' | 'size' | 'value' | 'defaultValue'> {\n /** Controlled component value */\n value?: Value | null;\n\n /** Uncontrolled component default value */\n defaultValue?: Value | null;\n\n /** Called when value changes */\n onChange?: (value: Value | null, option: ComboboxItem<Value>) => void;\n\n /** Called when the clear button is clicked */\n onClear?: () => void;\n\n /** Determines whether the select should be searchable @default false */\n searchable?: boolean;\n\n /** Displays check icon near the selected option label @default true */\n withCheckIcon?: boolean;\n\n /** Aligns unchecked labels with the checked one @default false */\n withAlignedLabels?: boolean;\n\n /** Position of the check icon relative to the option label @default 'left' */\n checkIconPosition?: 'left' | 'right';\n\n /** Message displayed when no options match the search query or when there is no data */\n nothingFoundMessage?: React.ReactNode;\n\n /** Controlled search value */\n searchValue?: string;\n\n /** Default search value */\n defaultSearchValue?: string;\n\n /** Called when search changes */\n onSearchChange?: (value: string) => void;\n\n /** Allows deselecting the selected option by clicking it @default true */\n allowDeselect?: boolean;\n\n /** Displays clear button in the right section when component has value @default false */\n clearable?: boolean;\n\n /** Determines how the clear button and rightSection are rendered @default 'both' */\n clearSectionMode?: ClearSectionMode;\n\n /** Props passed down to the clear button */\n clearButtonProps?: InputClearButtonProps;\n\n /** Props passed down to the hidden input */\n hiddenInputProps?: Omit<React.ComponentProps<'input'>, 'value'>;\n\n /** A function to render content of the option, replaces the default content of the option */\n renderOption?: (item: ComboboxLikeRenderOptionInput<ComboboxItem<Value>>) => React.ReactNode;\n\n /** Props passed down to the underlying `ScrollArea` component in the dropdown */\n scrollAreaProps?: ScrollAreaProps;\n\n /** Controls color of the default chevron, by default depends on the color scheme */\n chevronColor?: MantineColor;\n\n /** Automatically selects the highlighted option when input loses focus @default false */\n autoSelectOnBlur?: boolean;\n\n /** Opens dropdown when input receives focus (requires searchable={true}) @default true */\n openOnFocus?: boolean;\n}\n\nexport type SelectFactory = Factory<{\n props: SelectProps;\n ref: HTMLInputElement;\n stylesNames: SelectStylesNames;\n variant: InputVariant;\n signature: <Value extends Primitive = string>(props: SelectProps<Value>) => React.JSX.Element;\n}>;\n\nconst defaultProps = {\n size: 'sm',\n withCheckIcon: true,\n allowDeselect: true,\n checkIconPosition: 'left',\n openOnFocus: true,\n} satisfies Partial<SelectProps>;\n\nexport const Select = genericFactory<SelectFactory>((_props) => {\n const props = useProps(['Input', 'InputWrapper', 'Select'], defaultProps, _props);\n const {\n classNames,\n styles,\n unstyled,\n vars,\n dropdownOpened,\n defaultDropdownOpened,\n onDropdownClose,\n onDropdownOpen,\n onFocus,\n onBlur,\n onClick,\n onChange,\n data,\n value,\n defaultValue,\n selectFirstOptionOnChange,\n selectFirstOptionOnDropdownOpen,\n onOptionSubmit,\n comboboxProps,\n readOnly,\n disabled,\n filter,\n limit,\n withScrollArea,\n maxDropdownHeight,\n floatingHeight,\n size,\n searchable,\n rightSection,\n checkIconPosition,\n withCheckIcon,\n withAlignedLabels,\n nothingFoundMessage,\n name,\n form,\n searchValue,\n defaultSearchValue,\n onSearchChange,\n allowDeselect,\n error,\n rightSectionPointerEvents,\n id,\n clearable,\n clearSectionMode,\n clearButtonProps,\n hiddenInputProps,\n renderOption,\n onClear,\n autoComplete,\n scrollAreaProps,\n __defaultRightSection,\n __clearSection,\n __clearable,\n chevronColor,\n autoSelectOnBlur,\n openOnFocus,\n attributes,\n ...others\n } = props;\n\n const parsedData = useMemo(() => getParsedComboboxData(data), [data]);\n const retainedSelectedOptions = useRef<Record<string, ComboboxItem<Primitive>>>({});\n const optionsLockup = useMemo(() => getOptionsLockup(parsedData), [parsedData]);\n const _id = useId(id);\n\n const [_value, setValue, controlled] = useUncontrolled({\n value,\n defaultValue,\n finalValue: null,\n onChange,\n });\n\n const selectedOption =\n _value != null\n ? `${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]\n : retainedSelectedOptions.current[`${_value}`]\n : undefined;\n const previousSelectedOption = usePrevious(selectedOption);\n\n const [search, setSearch, searchControlled] = useUncontrolled({\n value: searchValue,\n defaultValue: defaultSearchValue,\n finalValue: selectedOption ? selectedOption.label : '',\n onChange: onSearchChange,\n });\n\n const combobox = useCombobox({\n opened: dropdownOpened,\n defaultOpened: defaultDropdownOpened,\n onDropdownOpen: () => {\n onDropdownOpen?.();\n if (selectFirstOptionOnDropdownOpen) {\n combobox.selectFirstOption();\n } else {\n combobox.updateSelectedOptionIndex('active', { scrollIntoView: true });\n }\n },\n onDropdownClose: () => {\n onDropdownClose?.();\n // Required for autoSelectOnBlur to work correctly\n setTimeout(combobox.resetSelectedOption, 0);\n },\n });\n\n const handleSearchChange = (value: string) => {\n setSearch(value);\n combobox.resetSelectedOption();\n };\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<SelectFactory>({\n props,\n styles,\n classNames,\n });\n\n useEffect(() => {\n if (selectFirstOptionOnChange) {\n combobox.selectFirstOption();\n }\n }, [selectFirstOptionOnChange, search]);\n\n useEffect(() => {\n if (value === null) {\n handleSearchChange('');\n }\n\n if (\n value != null &&\n selectedOption &&\n (previousSelectedOption?.value !== selectedOption.value ||\n previousSelectedOption?.label !== selectedOption.label)\n ) {\n handleSearchChange(selectedOption.label);\n }\n }, [value, selectedOption]);\n\n useEffect(() => {\n if (!controlled && !searchControlled) {\n handleSearchChange(\n _value != null\n ? `${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]?.label\n : retainedSelectedOptions.current[`${_value}`]?.label || ''\n : ''\n );\n }\n }, [optionsLockup, _value]);\n\n useEffect(() => {\n if (_value) {\n if (`${_value}` in optionsLockup) {\n retainedSelectedOptions.current[`${_value}`] = optionsLockup[`${_value}`];\n }\n }\n }, [optionsLockup, _value]);\n\n const clearButton = (\n <Combobox.ClearButton\n {...clearButtonProps}\n onClear={() => {\n setValue(null, null);\n handleSearchChange('');\n onClear?.();\n }}\n />\n );\n\n const _clearable = clearable && _value != null && !disabled && !readOnly;\n\n return (\n <>\n <Combobox\n store={combobox}\n __staticSelector=\"Select\"\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n readOnly={readOnly}\n size={size}\n attributes={attributes}\n floatingHeight={floatingHeight}\n keepMounted={autoSelectOnBlur}\n onOptionSubmit={(val) => {\n onOptionSubmit?.(val as any);\n const optionLockup = allowDeselect\n ? `${optionsLockup[val].value}` === `${_value}`\n ? null\n : optionsLockup[val]\n : optionsLockup[val];\n\n const nextValue = optionLockup ? optionLockup.value : null;\n\n nextValue !== _value && setValue(nextValue as any, optionLockup);\n !controlled && handleSearchChange(nextValue != null ? optionLockup?.label || '' : '');\n combobox.closeDropdown();\n }}\n {...comboboxProps}\n >\n <Combobox.Target\n targetType={searchable ? 'input' : 'button'}\n autoComplete={autoComplete}\n withExpandedAttribute\n >\n <InputBase\n id={_id}\n __defaultRightSection={\n <Combobox.Chevron\n size={size}\n error={error}\n unstyled={unstyled}\n color={chevronColor}\n />\n }\n __clearSection={clearButton}\n __clearable={_clearable}\n __clearSectionMode={clearSectionMode}\n rightSection={rightSection}\n rightSectionPointerEvents={rightSectionPointerEvents || 'none'}\n {...others}\n size={size}\n __staticSelector=\"Select\"\n disabled={disabled}\n readOnly={readOnly || !searchable}\n value={search}\n onChange={(event) => {\n if (isExternalInputChange(event)) {\n if (!readOnly) {\n const externalOption = getOptionByLabel(optionsLockup, event.currentTarget.value);\n\n if (externalOption && `${externalOption.value}` !== `${_value}`) {\n setValue(externalOption.value as any, externalOption);\n !controlled && handleSearchChange(externalOption.label);\n }\n }\n\n return;\n }\n\n handleSearchChange(event.currentTarget.value);\n combobox.openDropdown();\n selectFirstOptionOnChange && combobox.selectFirstOption();\n }}\n onFocus={(event) => {\n openOnFocus && !!searchable && combobox.openDropdown();\n onFocus?.(event);\n }}\n onBlur={(event) => {\n if (autoSelectOnBlur) {\n combobox.clickSelectedOption();\n }\n\n combobox.closeDropdown();\n const optionLockup =\n _value != null &&\n (`${_value}` in optionsLockup\n ? optionsLockup[`${_value}`]\n : retainedSelectedOptions.current[`${_value}`]);\n handleSearchChange(optionLockup ? optionLockup.label || '' : '');\n onBlur?.(event);\n }}\n onClick={(event) => {\n searchable ? combobox.openDropdown() : combobox.toggleDropdown();\n onClick?.(event);\n }}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n unstyled={unstyled}\n pointer={!searchable}\n error={error}\n attributes={attributes}\n />\n </Combobox.Target>\n <OptionsDropdown\n data={parsedData as any}\n hidden={readOnly || disabled}\n filter={filter as OptionsFilter<Primitive> | undefined}\n search={search}\n limit={limit}\n hiddenWhenEmpty={!nothingFoundMessage}\n withScrollArea={withScrollArea}\n maxDropdownHeight={maxDropdownHeight}\n filterOptions={!!searchable && selectedOption?.label !== search}\n value={_value}\n checkIconPosition={checkIconPosition}\n withCheckIcon={withCheckIcon}\n withAlignedLabels={withAlignedLabels}\n nothingFoundMessage={nothingFoundMessage}\n unstyled={unstyled}\n labelId={others.label ? `${_id}-label` : undefined}\n aria-label={others.label ? undefined : others['aria-label']}\n renderOption={renderOption}\n scrollAreaProps={scrollAreaProps}\n />\n </Combobox>\n <Combobox.HiddenInput\n value={_value}\n name={name}\n form={form}\n disabled={disabled}\n {...hiddenInputProps}\n />\n </>\n );\n});\n\nSelect.classes = { ...InputBase.classes, ...Combobox.classes };\nSelect.displayName = '@mantine/core/Select';\n\nexport namespace Select {\n export type Props<Value extends Primitive = string> = SelectProps<Value>;\n export type StylesNames = SelectStylesNames;\n export type Factory = SelectFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyHA,MAAM,eAAe;CACnB,MAAM;CACN,eAAe;CACf,eAAe;CACf,mBAAmB;CACnB,aAAa;AACf;AAEA,MAAa,SAASA,gBAAAA,gBAA+B,WAAW;CAC9D,MAAM,QAAQC,kBAAAA,SAAS;EAAC;EAAS;EAA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;KACtB,6BAA6B,SAAS,kBAAkB;IAC1D;IACA,UAAU,UAAU;KAClB,eAAiB,cAAc,SAAS,aAAa;KACrD,UAAU,KAAK;IACjB;IACA,SAAS,UAAU;KACjB,IAAI,kBACF,SAAS,oBAAoB;KAG/B,SAAS,cAAc;KACvB,MAAM,eACJ,UAAU,SACT,GAAG,YAAY,gBACZ,cAAc,GAAG,YACjB,wBAAwB,QAAQ,GAAG;KACzC,mBAAmB,eAAe,aAAa,SAAS,KAAK,EAAE;KAC/D,SAAS,KAAK;IAChB;IACA,UAAU,UAAU;KAClB,aAAa,SAAS,aAAa,IAAI,SAAS,eAAe;KAC/D,UAAU,KAAK;IACjB;IACA,YAAY;IACZ,QAAQ;IACE;IACV,SAAS,CAAC;IACH;IACK;GACb,CAAA;EACc,CAAA,GACjB,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,iBAAD;GACE,MAAM;GACN,QAAQ,YAAY;GACZ;GACA;GACD;GACP,iBAAiB,CAAC;GACF;GACG;GACnB,eAAe,CAAC,CAAC,cAAc,gBAAgB,UAAU;GACzD,OAAO;GACY;GACJ;GACI;GACE;GACX;GACV,SAAS,OAAO,QAAQ,GAAG,IAAI,UAAU,KAAA;GACzC,cAAY,OAAO,QAAQ,KAAA,IAAY,OAAO;GAChC;GACG;EAClB,CAAA,CACO;CACV,CAAA,GAAA,iBAAA,GAAA,kBAAA,IAAA,CAACJ,iBAAAA,SAAS,aAAV;EACE,OAAO;EACD;EACA;EACI;EACV,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN,CAAC;AAED,OAAO,UAAU;CAAE,GAAGC,kBAAAA,UAAU;CAAS,GAAGD,iBAAAA,SAAS;AAAQ;AAC7D,OAAO,cAAc"}
@@ -5,12 +5,13 @@ const require_Slider_context = require("../Slider.context.cjs");
5
5
  let react = require("react");
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
7
  //#region packages/@mantine/core/src/components/Slider/Thumb/Thumb.tsx
8
- function Thumb({ max, min, value, position, label, dragging, onMouseDown, onKeyDownCapture, labelTransitionProps, labelAlwaysOn, thumbLabel, thumbValueText, onFocus, onBlur, showLabelOnHover, isHovered, children = null, disabled, orientation = "horizontal", ref }) {
8
+ function Thumb({ max, min, value, position, label, dragging, onMouseDown, onKeyDownCapture, labelTransitionProps, labelAlwaysOn, thumbLabel, thumbValueText, onFocus, onBlur, showLabelOnHover, isHovered, children = null, disabled, orientation = "horizontal", className, style, ref, ...others }) {
9
9
  const { getStyles } = require_Slider_context.useSliderContext();
10
10
  const [focused, setFocused] = (0, react.useState)(false);
11
11
  const isVisible = labelAlwaysOn || dragging || focused || showLabelOnHover && isHovered;
12
12
  const valueText = typeof thumbValueText === "function" ? thumbValueText(value) : thumbValueText;
13
13
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box.Box, {
14
+ ...others,
14
15
  tabIndex: disabled ? -1 : 0,
15
16
  role: "slider",
16
17
  "aria-label": thumbLabel,
@@ -22,7 +23,11 @@ function Thumb({ max, min, value, position, label, dragging, onMouseDown, onKeyD
22
23
  "aria-orientation": orientation,
23
24
  ref,
24
25
  __vars: { "--slider-thumb-offset": `${position}%` },
25
- ...getStyles("thumb", { focusable: true }),
26
+ ...getStyles("thumb", {
27
+ focusable: true,
28
+ className,
29
+ style
30
+ }),
26
31
  mod: {
27
32
  dragging,
28
33
  disabled
@@ -1 +1 @@
1
- {"version":3,"file":"Thumb.cjs","names":["useSliderContext","useState","Box","Transition"],"sources":["../../../../src/components/Slider/Thumb/Thumb.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Box } from '../../../core';\nimport { Transition, TransitionOverride } from '../../Transition';\nimport { useSliderContext } from '../Slider.context';\n\nexport interface ThumbProps extends Omit<React.ComponentProps<'div'>, 'value'> {\n max: number;\n min: number;\n value: number;\n position: number;\n dragging: boolean;\n label: React.ReactNode;\n thumbValueText?: string | ((value: number) => string);\n onKeyDownCapture?: (event: React.KeyboardEvent<HTMLDivElement>) => void;\n onMouseDown?: (event: any) => void;\n labelTransitionProps: TransitionOverride | undefined;\n labelAlwaysOn: boolean | undefined;\n thumbLabel: string | undefined;\n showLabelOnHover: boolean | undefined;\n isHovered?: boolean;\n children?: React.ReactNode;\n disabled: boolean | undefined;\n orientation?: 'horizontal' | 'vertical';\n className?: string | undefined;\n style?: React.CSSProperties;\n}\n\nexport function Thumb({\n max,\n min,\n value,\n position,\n label,\n dragging,\n onMouseDown,\n onKeyDownCapture,\n labelTransitionProps,\n labelAlwaysOn,\n thumbLabel,\n thumbValueText,\n onFocus,\n onBlur,\n showLabelOnHover,\n isHovered,\n children = null,\n disabled,\n orientation = 'horizontal',\n ref,\n}: ThumbProps) {\n const { getStyles } = useSliderContext();\n\n const [focused, setFocused] = useState(false);\n\n const isVisible = labelAlwaysOn || dragging || focused || (showLabelOnHover && isHovered);\n const valueText = typeof thumbValueText === 'function' ? thumbValueText(value) : thumbValueText;\n\n return (\n <Box<'div'>\n tabIndex={disabled ? -1 : 0}\n role=\"slider\"\n aria-label={thumbLabel}\n aria-valuemax={max}\n aria-valuemin={min}\n aria-valuenow={value}\n aria-valuetext={valueText}\n aria-disabled={disabled}\n aria-orientation={orientation}\n ref={ref}\n __vars={{ '--slider-thumb-offset': `${position}%` }}\n {...getStyles('thumb', { focusable: true })}\n mod={{ dragging, disabled }}\n onFocus={(event) => {\n setFocused(true);\n typeof onFocus === 'function' && onFocus(event);\n }}\n onBlur={(event) => {\n setFocused(false);\n typeof onBlur === 'function' && onBlur(event);\n }}\n onTouchStart={onMouseDown}\n onMouseDown={onMouseDown}\n onKeyDownCapture={onKeyDownCapture}\n onClick={(event) => event.stopPropagation()}\n >\n {children}\n <Transition\n mounted={label != null && !!isVisible}\n transition=\"fade\"\n duration={0}\n {...labelTransitionProps}\n >\n {(transitionStyles) => (\n <div {...getStyles('label', { style: transitionStyles })}>{label}</div>\n )}\n </Transition>\n </Box>\n );\n}\n\nThumb.displayName = '@mantine/core/SliderThumb';\n"],"mappings":";;;;;;;AA2B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box","Transition"],"sources":["../../../../src/components/Slider/Thumb/Thumb.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Box } from '../../../core';\nimport { Transition, TransitionOverride } from '../../Transition';\nimport { useSliderContext } from '../Slider.context';\n\nexport interface ThumbProps extends Omit<React.ComponentProps<'div'>, 'value'> {\n max: number;\n min: number;\n value: number;\n position: number;\n dragging: boolean;\n label: React.ReactNode;\n thumbValueText?: string | ((value: number) => string);\n onKeyDownCapture?: (event: React.KeyboardEvent<HTMLDivElement>) => void;\n onMouseDown?: (event: any) => void;\n labelTransitionProps: TransitionOverride | undefined;\n labelAlwaysOn: boolean | undefined;\n thumbLabel: string | undefined;\n showLabelOnHover: boolean | undefined;\n isHovered?: boolean;\n children?: React.ReactNode;\n disabled: boolean | undefined;\n orientation?: 'horizontal' | 'vertical';\n className?: string | undefined;\n style?: React.CSSProperties;\n}\n\nexport function Thumb({\n max,\n min,\n value,\n position,\n label,\n dragging,\n onMouseDown,\n onKeyDownCapture,\n labelTransitionProps,\n labelAlwaysOn,\n thumbLabel,\n thumbValueText,\n onFocus,\n onBlur,\n showLabelOnHover,\n isHovered,\n children = null,\n disabled,\n orientation = 'horizontal',\n className,\n style,\n ref,\n ...others\n}: ThumbProps) {\n const { getStyles } = useSliderContext();\n\n const [focused, setFocused] = useState(false);\n\n const isVisible = labelAlwaysOn || dragging || focused || (showLabelOnHover && isHovered);\n const valueText = typeof thumbValueText === 'function' ? thumbValueText(value) : thumbValueText;\n\n return (\n <Box<'div'>\n {...others}\n tabIndex={disabled ? -1 : 0}\n role=\"slider\"\n aria-label={thumbLabel}\n aria-valuemax={max}\n aria-valuemin={min}\n aria-valuenow={value}\n aria-valuetext={valueText}\n aria-disabled={disabled}\n aria-orientation={orientation}\n ref={ref}\n __vars={{ '--slider-thumb-offset': `${position}%` }}\n {...getStyles('thumb', { focusable: true, className, style })}\n mod={{ dragging, disabled }}\n onFocus={(event) => {\n setFocused(true);\n typeof onFocus === 'function' && onFocus(event);\n }}\n onBlur={(event) => {\n setFocused(false);\n typeof onBlur === 'function' && onBlur(event);\n }}\n onTouchStart={onMouseDown}\n onMouseDown={onMouseDown}\n onKeyDownCapture={onKeyDownCapture}\n onClick={(event) => event.stopPropagation()}\n >\n {children}\n <Transition\n mounted={label != null && !!isVisible}\n transition=\"fade\"\n duration={0}\n {...labelTransitionProps}\n >\n {(transitionStyles) => (\n <div {...getStyles('label', { style: transitionStyles })}>{label}</div>\n )}\n </Transition>\n </Box>\n );\n}\n\nThumb.displayName = '@mantine/core/SliderThumb';\n"],"mappings":";;;;;;;AA2BA,SAAgB,MAAM,EACpB,KACA,KACA,OACA,UACA,OACA,UACA,aACA,kBACA,sBACA,eACA,YACA,gBACA,SACA,QACA,kBACA,WACA,WAAW,MACX,UACA,cAAc,cACd,WACA,OACA,KACA,GAAG,UACU;CACb,MAAM,EAAE,cAAcA,uBAAAA,iBAAiB;CAEvC,MAAM,CAAC,SAAS,eAAA,GAAcC,MAAAA,SAAAA,CAAS,KAAK;CAE5C,MAAM,YAAY,iBAAiB,YAAY,WAAY,oBAAoB;CAC/E,MAAM,YAAY,OAAO,mBAAmB,aAAa,eAAe,KAAK,IAAI;CAEjF,OACE,iBAAA,GAAA,kBAAA,KAAA,CAACC,YAAAA,KAAD;EACE,GAAI;EACJ,UAAU,WAAW,KAAK;EAC1B,MAAK;EACL,cAAY;EACZ,iBAAe;EACf,iBAAe;EACf,iBAAe;EACf,kBAAgB;EAChB,iBAAe;EACf,oBAAkB;EACb;EACL,QAAQ,EAAE,yBAAyB,GAAG,SAAS,GAAG;EAClD,GAAI,UAAU,SAAS;GAAE,WAAW;GAAM;GAAW;EAAM,CAAC;EAC5D,KAAK;GAAE;GAAU;EAAS;EAC1B,UAAU,UAAU;GAClB,WAAW,IAAI;GACf,OAAO,YAAY,cAAc,QAAQ,KAAK;EAChD;EACA,SAAS,UAAU;GACjB,WAAW,KAAK;GAChB,OAAO,WAAW,cAAc,OAAO,KAAK;EAC9C;EACA,cAAc;EACD;EACK;EAClB,UAAU,UAAU,MAAM,gBAAgB;EA1B5C,UAAA,CA4BG,UACD,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,YAAD;GACE,SAAS,SAAS,QAAQ,CAAC,CAAC;GAC5B,YAAW;GACX,UAAU;GACV,GAAI;GAEF,WAAA,qBACA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,GAAI,UAAU,SAAS,EAAE,OAAO,iBAAiB,CAAC;IAAI,UAAA;GAAW,CAAA;EAE9D,CAAA,CACT;;AAET;AAEA,MAAM,cAAc"}
@@ -12,6 +12,7 @@ const require_Table_module = require("./Table.module.cjs");
12
12
  const require_Table_components = require("./Table.components.cjs");
13
13
  const require_TableDataRenderer = require("./TableDataRenderer.cjs");
14
14
  const require_TableScrollContainer = require("./TableScrollContainer.cjs");
15
+ let react = require("react");
15
16
  let react_jsx_runtime = require("react/jsx-runtime");
16
17
  //#region packages/@mantine/core/src/components/Table/Table.tsx
17
18
  const defaultProps = {
@@ -43,18 +44,30 @@ const Table = require_factory.factory((_props) => {
43
44
  attributes,
44
45
  rootSelector: "table",
45
46
  vars,
46
- varsResolver
47
+ varsResolver,
48
+ stable: true
47
49
  });
50
+ const stripedValue = striped === true ? "odd" : striped || void 0;
51
+ const resolvedCaptionSide = captionSide || "bottom";
52
+ const contextValue = (0, react.useMemo)(() => ({
53
+ getStyles,
54
+ stickyHeader,
55
+ striped: stripedValue,
56
+ highlightOnHover,
57
+ withColumnBorders,
58
+ withRowBorders,
59
+ captionSide: resolvedCaptionSide
60
+ }), [
61
+ getStyles,
62
+ stickyHeader,
63
+ stripedValue,
64
+ highlightOnHover,
65
+ withColumnBorders,
66
+ withRowBorders,
67
+ resolvedCaptionSide
68
+ ]);
48
69
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Table_context.TableProvider, {
49
- value: {
50
- getStyles,
51
- stickyHeader,
52
- striped: striped === true ? "odd" : striped || void 0,
53
- highlightOnHover,
54
- withColumnBorders,
55
- withRowBorders,
56
- captionSide: captionSide || "bottom"
57
- },
70
+ value: contextValue,
58
71
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
59
72
  component: "table",
60
73
  mod: [{
@@ -1 +1 @@
1
- {"version":3,"file":"Table.cjs","names":["createVarsResolver","getSpacing","getThemeColor","rem","factory","useProps","useStyles","TableProvider","Box","TableDataRenderer","classes","TableTd","TableTh","TableTr","TableThead","TableTbody","TableTfoot","TableCaption","TableScrollContainer"],"sources":["../../../src/components/Table/Table.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getSpacing,\n getThemeColor,\n MantineColor,\n MantineSpacing,\n rem,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport {\n TableCaption,\n TableTbody,\n TableTd,\n TableTfoot,\n TableTh,\n TableThead,\n TableTr,\n type TableCaptionProps,\n type TableTbodyProps,\n type TableTdProps,\n type TableThProps,\n type TableTrProps,\n type TableTheadProps,\n type TableTfootProps,\n} from './Table.components';\nimport { TableProvider, type TableContextValue } from './Table.context';\nimport { TableDataRenderer } from './TableDataRenderer';\nimport { TableScrollContainer, type TableScrollContainerProps } from './TableScrollContainer';\nimport classes from './Table.module.css';\nexport type TableVariant = 'default' | 'vertical';\n\nexport type TableStylesNames =\n | 'table'\n | 'thead'\n | 'tbody'\n | 'tfoot'\n | 'tr'\n | 'th'\n | 'td'\n | 'caption';\n\nexport type TableCssVariables = {\n table:\n | '--table-layout'\n | '--table-border-color'\n | '--table-caption-side'\n | '--table-horizontal-spacing'\n | '--table-vertical-spacing'\n | '--table-striped-color'\n | '--table-highlight-on-hover-color'\n | '--table-sticky-header-offset';\n};\n\nexport interface TableData {\n head?: React.ReactNode[];\n body?: React.ReactNode[][];\n foot?: React.ReactNode[];\n caption?: string;\n}\n\nexport interface TableProps extends BoxProps, StylesApiProps<TableFactory>, ElementProps<'table'> {\n /** Value of `table-layout` style @default auto */\n layout?: React.CSSProperties['tableLayout'];\n\n /** Side of the `Table.Caption` @default bottom */\n captionSide?: 'top' | 'bottom';\n\n /** Color of table borders, key of `theme.colors` or any valid CSS color */\n borderColor?: MantineColor;\n\n /** If set, the table has the outer border @default false */\n withTableBorder?: boolean;\n\n /** If set, the table has borders between columns @default false */\n withColumnBorders?: boolean;\n\n /** If set, the table has borders between rows @default true */\n withRowBorders?: boolean;\n\n /** Horizontal cells spacing, key of `theme.spacing` or any valid CSS value for padding, numbers are converted to rem @default xs */\n horizontalSpacing?: MantineSpacing;\n\n /** Vertical cells spacing, key of `theme.spacing` or any valid CSS value for padding, numbers are converted to rem @default xs */\n verticalSpacing?: MantineSpacing;\n\n /** If set, every odd/even row background changes to `stripedColor`, if set to `true`, then `odd` value will be used @default false */\n striped?: boolean | 'odd' | 'even';\n\n /** Background color of striped rows, key of `theme.colors` or any valid CSS color */\n stripedColor?: MantineColor;\n\n /** If set, table rows background changes to `highlightOnHoverColor` when hovered @default false */\n highlightOnHover?: boolean;\n\n /** Background color of table rows when hovered, key of `theme.colors` or any valid CSS color */\n highlightOnHoverColor?: MantineColor;\n\n /** Data used to generate table, ignored if `children` prop is set */\n data?: TableData;\n\n /** If set, `Table.Thead` is sticky @default false */\n stickyHeader?: boolean;\n\n /** Offset from top at which `Table.Thead` should become sticky @default 0 */\n stickyHeaderOffset?: number | string;\n\n /** If set, `font-variant-numeric: tabular-nums` style is applied @default false */\n tabularNums?: boolean;\n}\n\nexport type TableFactory = Factory<{\n props: TableProps;\n ref: HTMLTableElement;\n stylesNames: TableStylesNames;\n vars: TableCssVariables;\n variant: TableVariant;\n staticComponents: {\n Thead: typeof TableThead;\n Tbody: typeof TableTbody;\n Tfoot: typeof TableTfoot;\n Td: typeof TableTd;\n Th: typeof TableTh;\n Tr: typeof TableTr;\n Caption: typeof TableCaption;\n ScrollContainer: typeof TableScrollContainer;\n DataRenderer: typeof TableDataRenderer;\n };\n}>;\n\nconst defaultProps = {\n withRowBorders: true,\n verticalSpacing: 7,\n} satisfies Partial<TableProps>;\n\nconst varsResolver = createVarsResolver<TableFactory>(\n (\n theme,\n {\n layout,\n captionSide,\n horizontalSpacing,\n verticalSpacing,\n borderColor,\n stripedColor,\n highlightOnHoverColor,\n striped,\n highlightOnHover,\n stickyHeaderOffset,\n stickyHeader,\n }\n ) => ({\n table: {\n '--table-layout': layout,\n '--table-caption-side': captionSide,\n '--table-horizontal-spacing': getSpacing(horizontalSpacing),\n '--table-vertical-spacing': getSpacing(verticalSpacing),\n '--table-border-color': borderColor ? getThemeColor(borderColor, theme) : undefined,\n '--table-striped-color':\n striped && stripedColor ? getThemeColor(stripedColor, theme) : undefined,\n '--table-highlight-on-hover-color':\n highlightOnHover && highlightOnHoverColor\n ? getThemeColor(highlightOnHoverColor, theme)\n : undefined,\n '--table-sticky-header-offset': stickyHeader ? rem(stickyHeaderOffset) : undefined,\n },\n })\n);\n\nexport const Table = factory<TableFactory>((_props) => {\n const props = useProps('Table', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n horizontalSpacing,\n verticalSpacing,\n captionSide,\n stripedColor,\n highlightOnHoverColor,\n striped,\n highlightOnHover,\n withColumnBorders,\n withRowBorders,\n withTableBorder,\n borderColor,\n layout,\n data,\n children,\n stickyHeader,\n stickyHeaderOffset,\n mod,\n tabularNums,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<TableFactory>({\n name: 'Table',\n props,\n className,\n style,\n classes,\n classNames,\n styles,\n unstyled,\n attributes,\n rootSelector: 'table',\n vars,\n varsResolver,\n });\n\n return (\n <TableProvider\n value={{\n getStyles,\n stickyHeader,\n striped: striped === true ? 'odd' : striped || undefined,\n highlightOnHover,\n withColumnBorders,\n withRowBorders,\n captionSide: captionSide || 'bottom',\n }}\n >\n <Box\n component=\"table\"\n mod={[{ withTableBorder, tabularNums }, mod]}\n {...getStyles('table')}\n {...others}\n >\n {children || (!!data && <TableDataRenderer data={data} />)}\n </Box>\n </TableProvider>\n );\n});\n\nTable.classes = classes;\nTable.varsResolver = varsResolver;\nTable.displayName = '@mantine/core/Table';\nTable.Td = TableTd;\nTable.Th = TableTh;\nTable.Tr = TableTr;\nTable.Thead = TableThead;\nTable.Tbody = TableTbody;\nTable.Tfoot = TableTfoot;\nTable.Caption = TableCaption;\nTable.ScrollContainer = TableScrollContainer;\nTable.DataRenderer = TableDataRenderer;\n\nexport namespace Table {\n export type Props = TableProps;\n export type StylesNames = TableStylesNames;\n export type CssVariables = TableCssVariables;\n export type Factory = TableFactory;\n export type Data = TableData;\n export type ContextValue = TableContextValue;\n\n export namespace Caption {\n export type Props = TableCaptionProps;\n }\n\n export namespace Tbody {\n export type Props = TableTbodyProps;\n }\n\n export namespace Td {\n export type Props = TableTdProps;\n }\n\n export namespace Th {\n export type Props = TableThProps;\n }\n\n export namespace Tr {\n export type Props = TableTrProps;\n }\n\n export namespace Thead {\n export type Props = TableTheadProps;\n }\n\n export namespace Tfoot {\n export type Props = TableTfootProps;\n }\n\n export namespace ScrollContainer {\n export type Props = TableScrollContainerProps;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwIA,MAAM,eAAe;CACnB,gBAAgB;CAChB,iBAAiB;AACnB;AAEA,MAAM,eAAeA,6BAAAA,oBAEjB,OACA,EACE,QACA,aACA,mBACA,iBACA,aACA,cACA,uBACA,SACA,kBACA,oBACA,oBAEE,EACJ,OAAO;CACL,kBAAkB;CAClB,wBAAwB;CACxB,8BAA8BC,iBAAAA,WAAW,iBAAiB;CAC1D,4BAA4BA,iBAAAA,WAAW,eAAe;CACtD,wBAAwB,cAAcC,wBAAAA,cAAc,aAAa,KAAK,IAAI,KAAA;CAC1E,yBACE,WAAW,eAAeA,wBAAAA,cAAc,cAAc,KAAK,IAAI,KAAA;CACjE,oCACE,oBAAoB,wBAChBA,wBAAAA,cAAc,uBAAuB,KAAK,IAC1C,KAAA;CACN,gCAAgC,eAAeC,YAAAA,IAAI,kBAAkB,IAAI,KAAA;AAC3E,EACF,EACF;AAEA,MAAa,QAAQC,gBAAAA,SAAuB,WAAW;CACrD,MAAM,QAAQC,kBAAAA,SAAS,SAAS,cAAc,MAAM;CACpD,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,mBACA,iBACA,aACA,cACA,uBACA,SACA,kBACA,mBACA,gBACA,iBACA,aACA,QACA,MACA,UACA,cACA,oBACA,KACA,aACA,YACA,GAAG,WACD;CAEJ,MAAM,YAAYC,mBAAAA,UAAwB;EACxC,MAAM;EACN;EACA;EACA;EACA,SAAA,qBAAA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd;EACA;CACF,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,eAAD;EACE,OAAO;GACL;GACA;GACA,SAAS,YAAY,OAAO,QAAQ,WAAW,KAAA;GAC/C;GACA;GACA;GACA,aAAa,eAAe;EAC9B;EAEA,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,YAAAA,KAAD;GACE,WAAU;GACV,KAAK,CAAC;IAAE;IAAiB;GAAY,GAAG,GAAG;GAC3C,GAAI,UAAU,OAAO;GACrB,GAAI;GAEH,UAAA,YAAa,CAAC,CAAC,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAACC,0BAAAA,mBAAD,EAAyB,KAAO,CAAA;EACrD,CAAA;CACQ,CAAA;AAEnB,CAAC;AAED,MAAM,UAAUC,qBAAAA;AAChB,MAAM,eAAe;AACrB,MAAM,cAAc;AACpB,MAAM,KAAKC,yBAAAA;AACX,MAAM,KAAKC,yBAAAA;AACX,MAAM,KAAKC,yBAAAA;AACX,MAAM,QAAQC,yBAAAA;AACd,MAAM,QAAQC,yBAAAA;AACd,MAAM,QAAQC,yBAAAA;AACd,MAAM,UAAUC,yBAAAA;AAChB,MAAM,kBAAkBC,6BAAAA;AACxB,MAAM,eAAeT,0BAAAA"}
1
+ {"version":3,"file":"Table.cjs","names":["createVarsResolver","getSpacing","getThemeColor","rem","factory","useProps","useStyles","useMemo","TableProvider","Box","TableDataRenderer","classes","TableTd","TableTh","TableTr","TableThead","TableTbody","TableTfoot","TableCaption","TableScrollContainer"],"sources":["../../../src/components/Table/Table.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getSpacing,\n getThemeColor,\n MantineColor,\n MantineSpacing,\n rem,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../core';\nimport {\n TableCaption,\n TableTbody,\n TableTd,\n TableTfoot,\n TableTh,\n TableThead,\n TableTr,\n type TableCaptionProps,\n type TableTbodyProps,\n type TableTdProps,\n type TableThProps,\n type TableTrProps,\n type TableTheadProps,\n type TableTfootProps,\n} from './Table.components';\nimport { TableProvider, type TableContextValue } from './Table.context';\nimport { TableDataRenderer } from './TableDataRenderer';\nimport { TableScrollContainer, type TableScrollContainerProps } from './TableScrollContainer';\nimport classes from './Table.module.css';\nexport type TableVariant = 'default' | 'vertical';\n\nexport type TableStylesNames =\n | 'table'\n | 'thead'\n | 'tbody'\n | 'tfoot'\n | 'tr'\n | 'th'\n | 'td'\n | 'caption';\n\nexport type TableCssVariables = {\n table:\n | '--table-layout'\n | '--table-border-color'\n | '--table-caption-side'\n | '--table-horizontal-spacing'\n | '--table-vertical-spacing'\n | '--table-striped-color'\n | '--table-highlight-on-hover-color'\n | '--table-sticky-header-offset';\n};\n\nexport interface TableData {\n head?: React.ReactNode[];\n body?: React.ReactNode[][];\n foot?: React.ReactNode[];\n caption?: string;\n}\n\nexport interface TableProps extends BoxProps, StylesApiProps<TableFactory>, ElementProps<'table'> {\n /** Value of `table-layout` style @default auto */\n layout?: React.CSSProperties['tableLayout'];\n\n /** Side of the `Table.Caption` @default bottom */\n captionSide?: 'top' | 'bottom';\n\n /** Color of table borders, key of `theme.colors` or any valid CSS color */\n borderColor?: MantineColor;\n\n /** If set, the table has the outer border @default false */\n withTableBorder?: boolean;\n\n /** If set, the table has borders between columns @default false */\n withColumnBorders?: boolean;\n\n /** If set, the table has borders between rows @default true */\n withRowBorders?: boolean;\n\n /** Horizontal cells spacing, key of `theme.spacing` or any valid CSS value for padding, numbers are converted to rem @default xs */\n horizontalSpacing?: MantineSpacing;\n\n /** Vertical cells spacing, key of `theme.spacing` or any valid CSS value for padding, numbers are converted to rem @default xs */\n verticalSpacing?: MantineSpacing;\n\n /** If set, every odd/even row background changes to `stripedColor`, if set to `true`, then `odd` value will be used @default false */\n striped?: boolean | 'odd' | 'even';\n\n /** Background color of striped rows, key of `theme.colors` or any valid CSS color */\n stripedColor?: MantineColor;\n\n /** If set, table rows background changes to `highlightOnHoverColor` when hovered @default false */\n highlightOnHover?: boolean;\n\n /** Background color of table rows when hovered, key of `theme.colors` or any valid CSS color */\n highlightOnHoverColor?: MantineColor;\n\n /** Data used to generate table, ignored if `children` prop is set */\n data?: TableData;\n\n /** If set, `Table.Thead` is sticky @default false */\n stickyHeader?: boolean;\n\n /** Offset from top at which `Table.Thead` should become sticky @default 0 */\n stickyHeaderOffset?: number | string;\n\n /** If set, `font-variant-numeric: tabular-nums` style is applied @default false */\n tabularNums?: boolean;\n}\n\nexport type TableFactory = Factory<{\n props: TableProps;\n ref: HTMLTableElement;\n stylesNames: TableStylesNames;\n vars: TableCssVariables;\n variant: TableVariant;\n staticComponents: {\n Thead: typeof TableThead;\n Tbody: typeof TableTbody;\n Tfoot: typeof TableTfoot;\n Td: typeof TableTd;\n Th: typeof TableTh;\n Tr: typeof TableTr;\n Caption: typeof TableCaption;\n ScrollContainer: typeof TableScrollContainer;\n DataRenderer: typeof TableDataRenderer;\n };\n}>;\n\nconst defaultProps = {\n withRowBorders: true,\n verticalSpacing: 7,\n} satisfies Partial<TableProps>;\n\nconst varsResolver = createVarsResolver<TableFactory>(\n (\n theme,\n {\n layout,\n captionSide,\n horizontalSpacing,\n verticalSpacing,\n borderColor,\n stripedColor,\n highlightOnHoverColor,\n striped,\n highlightOnHover,\n stickyHeaderOffset,\n stickyHeader,\n }\n ) => ({\n table: {\n '--table-layout': layout,\n '--table-caption-side': captionSide,\n '--table-horizontal-spacing': getSpacing(horizontalSpacing),\n '--table-vertical-spacing': getSpacing(verticalSpacing),\n '--table-border-color': borderColor ? getThemeColor(borderColor, theme) : undefined,\n '--table-striped-color':\n striped && stripedColor ? getThemeColor(stripedColor, theme) : undefined,\n '--table-highlight-on-hover-color':\n highlightOnHover && highlightOnHoverColor\n ? getThemeColor(highlightOnHoverColor, theme)\n : undefined,\n '--table-sticky-header-offset': stickyHeader ? rem(stickyHeaderOffset) : undefined,\n },\n })\n);\n\nexport const Table = factory<TableFactory>((_props) => {\n const props = useProps('Table', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n horizontalSpacing,\n verticalSpacing,\n captionSide,\n stripedColor,\n highlightOnHoverColor,\n striped,\n highlightOnHover,\n withColumnBorders,\n withRowBorders,\n withTableBorder,\n borderColor,\n layout,\n data,\n children,\n stickyHeader,\n stickyHeaderOffset,\n mod,\n tabularNums,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<TableFactory>({\n name: 'Table',\n props,\n className,\n style,\n classes,\n classNames,\n styles,\n unstyled,\n attributes,\n rootSelector: 'table',\n vars,\n varsResolver,\n stable: true,\n });\n\n const stripedValue = striped === true ? 'odd' : striped || undefined;\n const resolvedCaptionSide = captionSide || 'bottom';\n\n const contextValue = useMemo<TableContextValue>(\n () => ({\n getStyles,\n stickyHeader,\n striped: stripedValue,\n highlightOnHover,\n withColumnBorders,\n withRowBorders,\n captionSide: resolvedCaptionSide,\n }),\n [\n getStyles,\n stickyHeader,\n stripedValue,\n highlightOnHover,\n withColumnBorders,\n withRowBorders,\n resolvedCaptionSide,\n ]\n );\n\n return (\n <TableProvider value={contextValue}>\n <Box\n component=\"table\"\n mod={[{ withTableBorder, tabularNums }, mod]}\n {...getStyles('table')}\n {...others}\n >\n {children || (!!data && <TableDataRenderer data={data} />)}\n </Box>\n </TableProvider>\n );\n});\n\nTable.classes = classes;\nTable.varsResolver = varsResolver;\nTable.displayName = '@mantine/core/Table';\nTable.Td = TableTd;\nTable.Th = TableTh;\nTable.Tr = TableTr;\nTable.Thead = TableThead;\nTable.Tbody = TableTbody;\nTable.Tfoot = TableTfoot;\nTable.Caption = TableCaption;\nTable.ScrollContainer = TableScrollContainer;\nTable.DataRenderer = TableDataRenderer;\n\nexport namespace Table {\n export type Props = TableProps;\n export type StylesNames = TableStylesNames;\n export type CssVariables = TableCssVariables;\n export type Factory = TableFactory;\n export type Data = TableData;\n export type ContextValue = TableContextValue;\n\n export namespace Caption {\n export type Props = TableCaptionProps;\n }\n\n export namespace Tbody {\n export type Props = TableTbodyProps;\n }\n\n export namespace Td {\n export type Props = TableTdProps;\n }\n\n export namespace Th {\n export type Props = TableThProps;\n }\n\n export namespace Tr {\n export type Props = TableTrProps;\n }\n\n export namespace Thead {\n export type Props = TableTheadProps;\n }\n\n export namespace Tfoot {\n export type Props = TableTfootProps;\n }\n\n export namespace ScrollContainer {\n export type Props = TableScrollContainerProps;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyIA,MAAM,eAAe;CACnB,gBAAgB;CAChB,iBAAiB;AACnB;AAEA,MAAM,eAAeA,6BAAAA,oBAEjB,OACA,EACE,QACA,aACA,mBACA,iBACA,aACA,cACA,uBACA,SACA,kBACA,oBACA,oBAEE,EACJ,OAAO;CACL,kBAAkB;CAClB,wBAAwB;CACxB,8BAA8BC,iBAAAA,WAAW,iBAAiB;CAC1D,4BAA4BA,iBAAAA,WAAW,eAAe;CACtD,wBAAwB,cAAcC,wBAAAA,cAAc,aAAa,KAAK,IAAI,KAAA;CAC1E,yBACE,WAAW,eAAeA,wBAAAA,cAAc,cAAc,KAAK,IAAI,KAAA;CACjE,oCACE,oBAAoB,wBAChBA,wBAAAA,cAAc,uBAAuB,KAAK,IAC1C,KAAA;CACN,gCAAgC,eAAeC,YAAAA,IAAI,kBAAkB,IAAI,KAAA;AAC3E,EACF,EACF;AAEA,MAAa,QAAQC,gBAAA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