@epilot/zenith-react 0.2.0-next.3 → 0.2.0-next.5

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 (274) hide show
  1. package/README.md +37 -1
  2. package/codemods/README.md +182 -0
  3. package/codemods/format.ts +86 -0
  4. package/codemods/migrate/base-elements/accordion.ts +132 -0
  5. package/codemods/migrate/base-elements/alert.ts +81 -0
  6. package/codemods/migrate/base-elements/avatar.ts +116 -0
  7. package/codemods/migrate/base-elements/button.ts +188 -0
  8. package/codemods/migrate/base-elements/checkbox.ts +17 -0
  9. package/codemods/migrate/base-elements/chip.ts +87 -0
  10. package/codemods/migrate/base-elements/chip360.ts +162 -0
  11. package/codemods/migrate/base-elements/circular-progress.ts +73 -0
  12. package/codemods/migrate/base-elements/dialog.ts +323 -0
  13. package/codemods/migrate/base-elements/divider.ts +61 -0
  14. package/codemods/migrate/base-elements/feedback-message.ts +95 -0
  15. package/codemods/migrate/base-elements/icon-button.ts +203 -0
  16. package/codemods/migrate/base-elements/index.ts +55 -0
  17. package/codemods/migrate/base-elements/mui-props.ts +29 -0
  18. package/codemods/migrate/base-elements/notification.ts +98 -0
  19. package/codemods/migrate/base-elements/paper.ts +78 -0
  20. package/codemods/migrate/base-elements/select.ts +328 -0
  21. package/codemods/migrate/base-elements/shared.ts +910 -0
  22. package/codemods/migrate/base-elements/skeleton.ts +83 -0
  23. package/codemods/migrate/base-elements/switch.ts +19 -0
  24. package/codemods/migrate/base-elements/tabs.ts +222 -0
  25. package/codemods/migrate/base-elements/text-field.ts +425 -0
  26. package/codemods/migrate/base-elements/toggle-button.ts +185 -0
  27. package/codemods/migrate/base-elements/tooltip.ts +231 -0
  28. package/codemods/migrate/base-elements/typography.ts +247 -0
  29. package/codemods/migrate/base-elements/unsupported.ts +277 -0
  30. package/codemods/migrate/from-base-elements.ts +26 -0
  31. package/codemods/migrate/from-volt.ts +26 -0
  32. package/codemods/migrate/lib/imports.ts +399 -0
  33. package/codemods/migrate/lib/jsx.ts +313 -0
  34. package/codemods/migrate/lib/run-migration.ts +528 -0
  35. package/codemods/migrate/lib/source.ts +6 -0
  36. package/codemods/migrate/lib/todo.ts +107 -0
  37. package/codemods/migrate/lib/types.ts +114 -0
  38. package/codemods/migrate/volt/class-helpers.ts +37 -0
  39. package/codemods/migrate/volt/index.ts +18 -0
  40. package/codemods/migrate/volt/pagination.ts +26 -0
  41. package/codemods/migrate/volt/same-name.ts +293 -0
  42. package/codemods/migrate/volt/stylesheets.ts +18 -0
  43. package/codemods/migrate/volt/tanstack-types.ts +20 -0
  44. package/codemods/radix-to-base-ui.ts +677 -0
  45. package/dist/_virtual/_zenith-runtime-family_accordion.js +7 -0
  46. package/dist/_virtual/_zenith-runtime-family_accordion.js.map +1 -0
  47. package/dist/_virtual/_zenith-runtime-family_alert-dialog.js +7 -0
  48. package/dist/_virtual/_zenith-runtime-family_alert-dialog.js.map +1 -0
  49. package/dist/_virtual/_zenith-runtime-family_avatar.js +7 -0
  50. package/dist/_virtual/_zenith-runtime-family_avatar.js.map +1 -0
  51. package/dist/_virtual/_zenith-runtime-family_button.js +7 -0
  52. package/dist/_virtual/_zenith-runtime-family_button.js.map +1 -0
  53. package/dist/_virtual/_zenith-runtime-family_checkbox.js +7 -0
  54. package/dist/_virtual/_zenith-runtime-family_checkbox.js.map +1 -0
  55. package/dist/_virtual/_zenith-runtime-family_csp-provider.js +7 -0
  56. package/dist/_virtual/_zenith-runtime-family_csp-provider.js.map +1 -0
  57. package/dist/_virtual/_zenith-runtime-family_dialog.js +7 -0
  58. package/dist/_virtual/_zenith-runtime-family_dialog.js.map +1 -0
  59. package/dist/_virtual/_zenith-runtime-family_direction-provider.js +8 -0
  60. package/dist/_virtual/_zenith-runtime-family_direction-provider.js.map +1 -0
  61. package/dist/_virtual/_zenith-runtime-family_menu.js +7 -0
  62. package/dist/_virtual/_zenith-runtime-family_menu.js.map +1 -0
  63. package/dist/_virtual/_zenith-runtime-family_merge-props.js +11 -0
  64. package/dist/_virtual/_zenith-runtime-family_merge-props.js.map +1 -0
  65. package/dist/_virtual/_zenith-runtime-family_popover.js +7 -0
  66. package/dist/_virtual/_zenith-runtime-family_popover.js.map +1 -0
  67. package/dist/_virtual/_zenith-runtime-family_radio-group.js +7 -0
  68. package/dist/_virtual/_zenith-runtime-family_radio-group.js.map +1 -0
  69. package/dist/_virtual/_zenith-runtime-family_radio.js +7 -0
  70. package/dist/_virtual/_zenith-runtime-family_radio.js.map +1 -0
  71. package/dist/_virtual/_zenith-runtime-family_scroll-area.js +7 -0
  72. package/dist/_virtual/_zenith-runtime-family_scroll-area.js.map +1 -0
  73. package/dist/_virtual/_zenith-runtime-family_select.js +7 -0
  74. package/dist/_virtual/_zenith-runtime-family_select.js.map +1 -0
  75. package/dist/_virtual/_zenith-runtime-family_separator.js +7 -0
  76. package/dist/_virtual/_zenith-runtime-family_separator.js.map +1 -0
  77. package/dist/_virtual/_zenith-runtime-family_switch.js +7 -0
  78. package/dist/_virtual/_zenith-runtime-family_switch.js.map +1 -0
  79. package/dist/_virtual/_zenith-runtime-family_tabs.js +7 -0
  80. package/dist/_virtual/_zenith-runtime-family_tabs.js.map +1 -0
  81. package/dist/_virtual/_zenith-runtime-family_toast.js +7 -0
  82. package/dist/_virtual/_zenith-runtime-family_toast.js.map +1 -0
  83. package/dist/_virtual/_zenith-runtime-family_toggle-group.js +7 -0
  84. package/dist/_virtual/_zenith-runtime-family_toggle-group.js.map +1 -0
  85. package/dist/_virtual/_zenith-runtime-family_toggle.js +7 -0
  86. package/dist/_virtual/_zenith-runtime-family_toggle.js.map +1 -0
  87. package/dist/_virtual/_zenith-runtime-family_tooltip.js +7 -0
  88. package/dist/_virtual/_zenith-runtime-family_tooltip.js.map +1 -0
  89. package/dist/_virtual/_zenith-runtime-family_use-render.js +7 -0
  90. package/dist/_virtual/_zenith-runtime-family_use-render.js.map +1 -0
  91. package/dist/components/accordion/accordion.js +179 -96
  92. package/dist/components/accordion/accordion.js.map +1 -1
  93. package/dist/components/alert-dialog/alert-dialog.js +243 -206
  94. package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
  95. package/dist/components/avatar/avatar.js +94 -82
  96. package/dist/components/avatar/avatar.js.map +1 -1
  97. package/dist/components/badge/badge.js +11 -11
  98. package/dist/components/breadcrumb/breadcrumb.js +69 -70
  99. package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
  100. package/dist/components/button/button.js +119 -102
  101. package/dist/components/button/button.js.map +1 -1
  102. package/dist/components/checkbox/checkbox.js +68 -51
  103. package/dist/components/checkbox/checkbox.js.map +1 -1
  104. package/dist/components/date-range-picker/date-range-picker.js +100 -90
  105. package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
  106. package/dist/components/date-time-picker/date-time-picker-input.js +118 -108
  107. package/dist/components/date-time-picker/date-time-picker-input.js.map +1 -1
  108. package/dist/components/date-time-picker/date-time-picker-panel.js +91 -94
  109. package/dist/components/date-time-picker/date-time-picker-panel.js.map +1 -1
  110. package/dist/components/dialog/dialog.js +238 -228
  111. package/dist/components/dialog/dialog.js.map +1 -1
  112. package/dist/components/drawer/drawer.js +259 -321
  113. package/dist/components/drawer/drawer.js.map +1 -1
  114. package/dist/components/dropdown-menu/dropdown-menu.js +533 -279
  115. package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
  116. package/dist/components/field/field-combobox.js +205 -186
  117. package/dist/components/field/field-combobox.js.map +1 -1
  118. package/dist/components/field/field-select.js +37 -22
  119. package/dist/components/field/field-select.js.map +1 -1
  120. package/dist/components/list/list-sortable.js +104 -0
  121. package/dist/components/list/list-sortable.js.map +1 -0
  122. package/dist/components/list/list.js +246 -324
  123. package/dist/components/list/list.js.map +1 -1
  124. package/dist/components/option-card/option-card.js +121 -117
  125. package/dist/components/option-card/option-card.js.map +1 -1
  126. package/dist/components/pill/pill.js +7 -7
  127. package/dist/components/popover/popover.js +223 -127
  128. package/dist/components/popover/popover.js.map +1 -1
  129. package/dist/components/radio/radio-group-base.js +54 -0
  130. package/dist/components/radio/radio-group-base.js.map +1 -0
  131. package/dist/components/radio/radio.js +71 -60
  132. package/dist/components/radio/radio.js.map +1 -1
  133. package/dist/components/scroll-area/scroll-area.js +142 -108
  134. package/dist/components/scroll-area/scroll-area.js.map +1 -1
  135. package/dist/components/scroll-overflow/scroll-overflow.js +156 -127
  136. package/dist/components/scroll-overflow/scroll-overflow.js.map +1 -1
  137. package/dist/components/segmented-control/segmented-control.js +93 -81
  138. package/dist/components/segmented-control/segmented-control.js.map +1 -1
  139. package/dist/components/select/select.js +485 -310
  140. package/dist/components/select/select.js.map +1 -1
  141. package/dist/components/separator/separator.js.map +1 -1
  142. package/dist/components/slot/compose-as-child.js +15 -12
  143. package/dist/components/slot/compose-as-child.js.map +1 -1
  144. package/dist/components/switch/switch.js +75 -68
  145. package/dist/components/switch/switch.js.map +1 -1
  146. package/dist/components/table/table-pagination.js +212 -175
  147. package/dist/components/table/table-pagination.js.map +1 -1
  148. package/dist/components/tabs/tabs.js +193 -190
  149. package/dist/components/tabs/tabs.js.map +1 -1
  150. package/dist/components/toast/toast.js +610 -148
  151. package/dist/components/toast/toast.js.map +1 -1
  152. package/dist/components/toggle/toggle-group.js +143 -32
  153. package/dist/components/toggle/toggle-group.js.map +1 -1
  154. package/dist/components/toggle/toggle.js +82 -49
  155. package/dist/components/toggle/toggle.js.map +1 -1
  156. package/dist/components/tooltip/tooltip.js +298 -138
  157. package/dist/components/tooltip/tooltip.js.map +1 -1
  158. package/dist/index.d.ts +2336 -2130
  159. package/dist/index.js +24 -23
  160. package/dist/list/sortable/index.d.ts +29 -0
  161. package/dist/list/sortable/index.js +5 -0
  162. package/dist/{_virtual → list/sortable}/index.js.map +1 -1
  163. package/dist/packages/tokens/dist/delivery/index.js +10 -10
  164. package/dist/packages/tokens/dist/delivery/index.js.map +1 -1
  165. package/dist/packages/tokens/dist/generated/core.generated.js +6 -15
  166. package/dist/packages/tokens/dist/generated/core.generated.js.map +1 -1
  167. package/dist/packages/tokens/dist/generated/palette.generated.js +4 -5
  168. package/dist/packages/tokens/dist/generated/palette.generated.js.map +1 -1
  169. package/dist/packages/tokens/dist/generated/palette.meta.generated.js +5 -0
  170. package/dist/packages/tokens/dist/generated/palette.meta.generated.js.map +1 -0
  171. package/dist/packages/tokens/dist/install.js +40 -17
  172. package/dist/packages/tokens/dist/install.js.map +1 -1
  173. package/dist/renderer/runtime-contract.generated.js +8 -0
  174. package/dist/renderer/runtime-contract.generated.js.map +1 -0
  175. package/dist/renderer/served.js +39 -0
  176. package/dist/renderer/served.js.map +1 -0
  177. package/dist/tokens/core.meta.generated.js +2 -2
  178. package/dist/tokens/core.meta.generated.js.map +1 -1
  179. package/dist/tokens/index.d.ts +1028 -1028
  180. package/dist/tokens/index.js +863 -863
  181. package/dist/tokens/index.js.map +1 -1
  182. package/dist/tokens/palette.meta.generated.js +5 -0
  183. package/dist/tokens/palette.meta.generated.js.map +1 -0
  184. package/dist/tokens.json +1 -1
  185. package/dist/vendor/.bun/@radix-ui_react-dialog@1.1.15_2b23df507bdda662/vendor/@radix-ui/react-dialog/dist/index.js +57 -62
  186. package/dist/vendor/.bun/@radix-ui_react-dialog@1.1.15_2b23df507bdda662/vendor/@radix-ui/react-dialog/dist/index.js.map +1 -1
  187. package/dist/vendor/.bun/@radix-ui_react-slot@1.2.3_0ac650c021fb1b59/vendor/@radix-ui/react-slot/dist/index.js +32 -38
  188. package/dist/vendor/.bun/@radix-ui_react-slot@1.2.3_0ac650c021fb1b59/vendor/@radix-ui/react-slot/dist/index.js.map +1 -1
  189. package/package.json +29 -21
  190. package/scripts/migration-diagnostics-core.mjs +302 -10
  191. package/scripts/migration-diagnostics.mjs +31 -8
  192. package/scripts/migration-sweep.mjs +10 -10
  193. package/testing/setup.cjs +87 -0
  194. package/dist/_virtual/index.js +0 -6
  195. package/dist/_virtual/index2.js +0 -5
  196. package/dist/_virtual/index2.js.map +0 -1
  197. package/dist/_virtual/use-sync-external-store-shim.development.js +0 -5
  198. package/dist/_virtual/use-sync-external-store-shim.development.js.map +0 -1
  199. package/dist/_virtual/use-sync-external-store-shim.production.js +0 -5
  200. package/dist/_virtual/use-sync-external-store-shim.production.js.map +0 -1
  201. package/dist/tokens/palette.generated.js +0 -5
  202. package/dist/tokens/palette.generated.js.map +0 -1
  203. package/dist/vendor/.bun/@floating-ui_core@1.8.0/vendor/@floating-ui/core/dist/floating-ui.core.js +0 -512
  204. package/dist/vendor/.bun/@floating-ui_core@1.8.0/vendor/@floating-ui/core/dist/floating-ui.core.js.map +0 -1
  205. package/dist/vendor/.bun/@floating-ui_dom@1.8.0/vendor/@floating-ui/dom/dist/floating-ui.dom.js +0 -396
  206. package/dist/vendor/.bun/@floating-ui_dom@1.8.0/vendor/@floating-ui/dom/dist/floating-ui.dom.js.map +0 -1
  207. package/dist/vendor/.bun/@floating-ui_react-dom@2.1.9_6f4b9a1cfb20c0ae/vendor/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -233
  208. package/dist/vendor/.bun/@floating-ui_react-dom@2.1.9_6f4b9a1cfb20c0ae/vendor/@floating-ui/react-dom/dist/floating-ui.react-dom.js.map +0 -1
  209. package/dist/vendor/.bun/@floating-ui_utils@0.2.12/vendor/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -137
  210. package/dist/vendor/.bun/@floating-ui_utils@0.2.12/vendor/@floating-ui/utils/dist/floating-ui.utils.dom.js.map +0 -1
  211. package/dist/vendor/.bun/@floating-ui_utils@0.2.12/vendor/@floating-ui/utils/dist/floating-ui.utils.js +0 -129
  212. package/dist/vendor/.bun/@floating-ui_utils@0.2.12/vendor/@floating-ui/utils/dist/floating-ui.utils.js.map +0 -1
  213. package/dist/vendor/.bun/@radix-ui_number@1.1.1/vendor/@radix-ui/number/dist/index.js +0 -7
  214. package/dist/vendor/.bun/@radix-ui_number@1.1.1/vendor/@radix-ui/number/dist/index.js.map +0 -1
  215. package/dist/vendor/.bun/@radix-ui_react-accordion@1.2.12_2b23df507bdda662/vendor/@radix-ui/react-accordion/dist/index.js +0 -240
  216. package/dist/vendor/.bun/@radix-ui_react-accordion@1.2.12_2b23df507bdda662/vendor/@radix-ui/react-accordion/dist/index.js.map +0 -1
  217. package/dist/vendor/.bun/@radix-ui_react-alert-dialog@1.1.15_2b23df507bdda662/vendor/@radix-ui/react-alert-dialog/dist/index.js +0 -128
  218. package/dist/vendor/.bun/@radix-ui_react-alert-dialog@1.1.15_2b23df507bdda662/vendor/@radix-ui/react-alert-dialog/dist/index.js.map +0 -1
  219. package/dist/vendor/.bun/@radix-ui_react-arrow@1.1.7_2b23df507bdda662/vendor/@radix-ui/react-arrow/dist/index.js +0 -25
  220. package/dist/vendor/.bun/@radix-ui_react-arrow@1.1.7_2b23df507bdda662/vendor/@radix-ui/react-arrow/dist/index.js.map +0 -1
  221. package/dist/vendor/.bun/@radix-ui_react-avatar@1.1.10_2b23df507bdda662/vendor/@radix-ui/react-avatar/dist/index.js +0 -76
  222. package/dist/vendor/.bun/@radix-ui_react-avatar@1.1.10_2b23df507bdda662/vendor/@radix-ui/react-avatar/dist/index.js.map +0 -1
  223. package/dist/vendor/.bun/@radix-ui_react-checkbox@1.3.3_2b23df507bdda662/vendor/@radix-ui/react-checkbox/dist/index.js +0 -252
  224. package/dist/vendor/.bun/@radix-ui_react-checkbox@1.3.3_2b23df507bdda662/vendor/@radix-ui/react-checkbox/dist/index.js.map +0 -1
  225. package/dist/vendor/.bun/@radix-ui_react-collapsible@1.1.12_2b23df507bdda662/vendor/@radix-ui/react-collapsible/dist/index.js +0 -121
  226. package/dist/vendor/.bun/@radix-ui_react-collapsible@1.1.12_2b23df507bdda662/vendor/@radix-ui/react-collapsible/dist/index.js.map +0 -1
  227. package/dist/vendor/.bun/@radix-ui_react-collection@1.1.7_2b23df507bdda662/vendor/@radix-ui/react-collection/dist/index.js +0 -49
  228. package/dist/vendor/.bun/@radix-ui_react-collection@1.1.7_2b23df507bdda662/vendor/@radix-ui/react-collection/dist/index.js.map +0 -1
  229. package/dist/vendor/.bun/@radix-ui_react-direction@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-direction/dist/index.js +0 -11
  230. package/dist/vendor/.bun/@radix-ui_react-direction@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-direction/dist/index.js.map +0 -1
  231. package/dist/vendor/.bun/@radix-ui_react-dropdown-menu@2.1.16_2b23df507bdda662/vendor/@radix-ui/react-dropdown-menu/dist/index.js +0 -228
  232. package/dist/vendor/.bun/@radix-ui_react-dropdown-menu@2.1.16_2b23df507bdda662/vendor/@radix-ui/react-dropdown-menu/dist/index.js.map +0 -1
  233. package/dist/vendor/.bun/@radix-ui_react-menu@2.1.16_2b23df507bdda662/vendor/@radix-ui/react-menu/dist/index.js +0 -653
  234. package/dist/vendor/.bun/@radix-ui_react-menu@2.1.16_2b23df507bdda662/vendor/@radix-ui/react-menu/dist/index.js.map +0 -1
  235. package/dist/vendor/.bun/@radix-ui_react-popover@1.1.15_2b23df507bdda662/vendor/@radix-ui/react-popover/dist/index.js +0 -244
  236. package/dist/vendor/.bun/@radix-ui_react-popover@1.1.15_2b23df507bdda662/vendor/@radix-ui/react-popover/dist/index.js.map +0 -1
  237. package/dist/vendor/.bun/@radix-ui_react-popper@1.2.8_2b23df507bdda662/vendor/@radix-ui/react-popper/dist/index.js +0 -222
  238. package/dist/vendor/.bun/@radix-ui_react-popper@1.2.8_2b23df507bdda662/vendor/@radix-ui/react-popper/dist/index.js.map +0 -1
  239. package/dist/vendor/.bun/@radix-ui_react-radio-group@1.3.8_2b23df507bdda662/vendor/@radix-ui/react-radio-group/dist/index.js +0 -239
  240. package/dist/vendor/.bun/@radix-ui_react-radio-group@1.3.8_2b23df507bdda662/vendor/@radix-ui/react-radio-group/dist/index.js.map +0 -1
  241. package/dist/vendor/.bun/@radix-ui_react-roving-focus@1.1.11_2b23df507bdda662/vendor/@radix-ui/react-roving-focus/dist/index.js +0 -184
  242. package/dist/vendor/.bun/@radix-ui_react-roving-focus@1.1.11_2b23df507bdda662/vendor/@radix-ui/react-roving-focus/dist/index.js.map +0 -1
  243. package/dist/vendor/.bun/@radix-ui_react-scroll-area@1.2.10_2b23df507bdda662/vendor/@radix-ui/react-scroll-area/dist/index.js +0 -535
  244. package/dist/vendor/.bun/@radix-ui_react-scroll-area@1.2.10_2b23df507bdda662/vendor/@radix-ui/react-scroll-area/dist/index.js.map +0 -1
  245. package/dist/vendor/.bun/@radix-ui_react-select@2.2.6_2b23df507bdda662/vendor/@radix-ui/react-select/dist/index.js +0 -863
  246. package/dist/vendor/.bun/@radix-ui_react-select@2.2.6_2b23df507bdda662/vendor/@radix-ui/react-select/dist/index.js.map +0 -1
  247. package/dist/vendor/.bun/@radix-ui_react-slot@1.2.4_0ac650c021fb1b59/vendor/@radix-ui/react-slot/dist/index.js +0 -63
  248. package/dist/vendor/.bun/@radix-ui_react-slot@1.2.4_0ac650c021fb1b59/vendor/@radix-ui/react-slot/dist/index.js.map +0 -1
  249. package/dist/vendor/.bun/@radix-ui_react-switch@1.2.6_2b23df507bdda662/vendor/@radix-ui/react-switch/dist/index.js +0 -133
  250. package/dist/vendor/.bun/@radix-ui_react-switch@1.2.6_2b23df507bdda662/vendor/@radix-ui/react-switch/dist/index.js.map +0 -1
  251. package/dist/vendor/.bun/@radix-ui_react-tabs@1.1.13_2b23df507bdda662/vendor/@radix-ui/react-tabs/dist/index.js +0 -164
  252. package/dist/vendor/.bun/@radix-ui_react-tabs@1.1.13_2b23df507bdda662/vendor/@radix-ui/react-tabs/dist/index.js.map +0 -1
  253. package/dist/vendor/.bun/@radix-ui_react-toggle-group@1.1.11_2b23df507bdda662/vendor/@radix-ui/react-toggle-group/dist/index.js +0 -138
  254. package/dist/vendor/.bun/@radix-ui_react-toggle-group@1.1.11_2b23df507bdda662/vendor/@radix-ui/react-toggle-group/dist/index.js.map +0 -1
  255. package/dist/vendor/.bun/@radix-ui_react-toggle@1.1.10_2b23df507bdda662/vendor/@radix-ui/react-toggle/dist/index.js +0 -34
  256. package/dist/vendor/.bun/@radix-ui_react-toggle@1.1.10_2b23df507bdda662/vendor/@radix-ui/react-toggle/dist/index.js.map +0 -1
  257. package/dist/vendor/.bun/@radix-ui_react-tooltip@1.2.8_2b23df507bdda662/vendor/@radix-ui/react-tooltip/dist/index.js +0 -340
  258. package/dist/vendor/.bun/@radix-ui_react-tooltip@1.2.8_2b23df507bdda662/vendor/@radix-ui/react-tooltip/dist/index.js.map +0 -1
  259. package/dist/vendor/.bun/@radix-ui_react-use-is-hydrated@0.1.0_0ac650c021fb1b59/vendor/@radix-ui/react-use-is-hydrated/dist/index.js +0 -16
  260. package/dist/vendor/.bun/@radix-ui_react-use-is-hydrated@0.1.0_0ac650c021fb1b59/vendor/@radix-ui/react-use-is-hydrated/dist/index.js.map +0 -1
  261. package/dist/vendor/.bun/@radix-ui_react-use-previous@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-use-previous/dist/index.js +0 -9
  262. package/dist/vendor/.bun/@radix-ui_react-use-previous@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-use-previous/dist/index.js.map +0 -1
  263. package/dist/vendor/.bun/@radix-ui_react-use-size@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-use-size/dist/index.js +0 -28
  264. package/dist/vendor/.bun/@radix-ui_react-use-size@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-use-size/dist/index.js.map +0 -1
  265. package/dist/vendor/.bun/@radix-ui_react-visually-hidden@1.2.3_2b23df507bdda662/vendor/@radix-ui/react-visually-hidden/dist/index.js +0 -33
  266. package/dist/vendor/.bun/@radix-ui_react-visually-hidden@1.2.3_2b23df507bdda662/vendor/@radix-ui/react-visually-hidden/dist/index.js.map +0 -1
  267. package/dist/vendor/.bun/sonner@2.0.7_6f4b9a1cfb20c0ae/vendor/sonner/dist/index.js +0 -747
  268. package/dist/vendor/.bun/sonner@2.0.7_6f4b9a1cfb20c0ae/vendor/sonner/dist/index.js.map +0 -1
  269. package/dist/vendor/.bun/use-sync-external-store@1.7.0_62547eec5a2188e3/vendor/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -68
  270. package/dist/vendor/.bun/use-sync-external-store@1.7.0_62547eec5a2188e3/vendor/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +0 -1
  271. package/dist/vendor/.bun/use-sync-external-store@1.7.0_62547eec5a2188e3/vendor/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -56
  272. package/dist/vendor/.bun/use-sync-external-store@1.7.0_62547eec5a2188e3/vendor/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +0 -1
  273. package/dist/vendor/.bun/use-sync-external-store@1.7.0_62547eec5a2188e3/vendor/use-sync-external-store/shim/index.js +0 -11
  274. package/dist/vendor/.bun/use-sync-external-store@1.7.0_62547eec5a2188e3/vendor/use-sync-external-store/shim/index.js.map +0 -1
@@ -0,0 +1,425 @@
1
+ /**
2
+ * TextField → Field + FieldLabel + FieldInput | FieldTextarea + FieldDescription | FieldError.
3
+ *
4
+ * - `label` → `<FieldLabel htmlFor={id}>`; MUI generated the id, Zenith does not, so a labelled
5
+ * field without `id` is reported.
6
+ * - `helperText` → `<FieldDescription>`, or `<FieldError>` when `error` is set; a dynamic
7
+ * `error` picks between the two and sets `Field variant="destructive"` and `aria-invalid`.
8
+ * - Input props (`value`, `onChange`, `placeholder`, `type`, `disabled`, `required`, `name`,
9
+ * `id`, …) go to the control; `inputProps={{…}}` is spread onto it, `inputRef` is its `ref`.
10
+ * `multiline` picks `FieldTextarea` (`rows`/`minRows` → `rows`).
11
+ * - Root props (`className`, `style`, `data-*`) stay on `Field`, as MUI put them on its root.
12
+ * - `variant`, `color`, `size`, `fullWidth`, `customBackgroundColor` are theming: dropped.
13
+ * `InputProps` start/end adornments → `FieldGroupAddon`s around the control in a
14
+ * `FieldInputGroup` (an `InputAdornment` wrapper is unwrapped); its `readOnly`/`inputProps`
15
+ * reach the control. `margin`, `maxRows` and the other MUI-only props are dropped and
16
+ * reported. `select` (and a dynamic `multiline`) leaves the element on base-elements.
17
+ */
18
+ import type {
19
+ ASTPath,
20
+ JSXAttribute,
21
+ JSXElement,
22
+ JSXSpreadAttribute,
23
+ } from "jscodeshift"
24
+ import type { MigrateContext } from "../lib/types"
25
+
26
+ type Expression = Parameters<MigrateContext["j"]["expressionStatement"]>[0]
27
+ import {
28
+ attrExpression,
29
+ attrValue,
30
+ element,
31
+ isTrue,
32
+ renamedAttr,
33
+ setChildren,
34
+ stringIn,
35
+ type Child,
36
+ printAttr,
37
+ reportValueUses,
38
+ contentChildren,
39
+ } from "./shared"
40
+
41
+ export const handles = [
42
+ "TextField",
43
+ "TextFieldProps",
44
+ "InputAdornment",
45
+ ] as const
46
+
47
+ const CONTROL = new Set([
48
+ "value",
49
+ "defaultValue",
50
+ "onChange",
51
+ "onBlur",
52
+ "onFocus",
53
+ "onKeyDown",
54
+ "onKeyUp",
55
+ "onKeyPress",
56
+ "onInput",
57
+ "onPaste",
58
+ "placeholder",
59
+ "type",
60
+ "disabled",
61
+ "required",
62
+ "name",
63
+ "id",
64
+ "autoFocus",
65
+ "autoComplete",
66
+ "readOnly",
67
+ "aria-label",
68
+ "aria-describedby",
69
+ ])
70
+ const SILENT = new Set([
71
+ "variant",
72
+ "color",
73
+ "size",
74
+ "fullWidth",
75
+ "customBackgroundColor",
76
+ "multiline",
77
+ "label",
78
+ "helperText",
79
+ "error",
80
+ ])
81
+ const REPORTED: Record<string, string> = {
82
+ InputLabelProps: "style FieldLabel directly",
83
+ FormHelperTextProps: "style FieldDescription/FieldError directly",
84
+ margin: "Field has no outer margin; add spacing in the layout",
85
+ maxRows: "FieldTextarea does not auto-grow",
86
+ rowsMax: "FieldTextarea does not auto-grow",
87
+ classes: "MUI-only",
88
+ hiddenLabel: "MUI-only",
89
+ focused: "MUI-only",
90
+ }
91
+
92
+ export function migrate(ctx: MigrateContext): void {
93
+ let kept = false
94
+ ctx.elements("TextField").forEach((path) => {
95
+ if (!migrateTextField(ctx, path)) kept = true
96
+ })
97
+ const valueUsed = reportValueUses(
98
+ ctx,
99
+ "TextField",
100
+ "rebuild it as Field + FieldLabel + FieldInput (or FieldTextarea) + FieldDescription"
101
+ )
102
+ if (valueUsed && !kept) ctx.keep("TextField")
103
+ else if (kept)
104
+ ctx.keep(
105
+ "TextField",
106
+ "still used where a TextField stayed (select or dynamic multiline): see the TODOs on those elements"
107
+ )
108
+ else ctx.drop("TextField")
109
+ const adornment = ctx.names.InputAdornment
110
+ const adornmentLeft =
111
+ !!adornment &&
112
+ (ctx.elements("InputAdornment").size() > 0 ||
113
+ ctx.valueUses("InputAdornment").size() > 0)
114
+ if (adornmentLeft)
115
+ ctx.keep(
116
+ "InputAdornment",
117
+ 'an adornment is a FieldGroupAddon align="start" | "end" next to the control inside a FieldInputGroup'
118
+ )
119
+ else ctx.drop("InputAdornment")
120
+ ctx.keep(
121
+ "TextFieldProps",
122
+ "type the input props from FieldInputProps and the wrapper's from FieldProps"
123
+ )
124
+ }
125
+
126
+ /** Rewrites one TextField in place; `false` when it has to stay a base-elements TextField. */
127
+ function migrateTextField(
128
+ ctx: MigrateContext,
129
+ path: ASTPath<JSXElement>
130
+ ): boolean {
131
+ const { j, jsx } = ctx
132
+ const el = path.node
133
+ const select = jsx.attr(el, "select")
134
+ const multiline = jsx.attr(el, "multiline")
135
+ if (
136
+ (select && jsx.literal(select) !== false) ||
137
+ (multiline && typeof jsx.literal(multiline) !== "boolean")
138
+ ) {
139
+ ctx.todo(
140
+ path,
141
+ "TextField",
142
+ select
143
+ ? "select TextField stays on base-elements: rebuild it as Field + FieldLabel + Select (SelectTrigger, SelectContent, SelectItem)"
144
+ : `${printAttr(ctx, multiline!)} stays on base-elements: pick FieldInput or FieldTextarea per branch`
145
+ )
146
+ return false
147
+ }
148
+ const textarea = isTrue(ctx, multiline)
149
+
150
+ const label = jsx.attr(el, "label")
151
+ const helper = jsx.attr(el, "helperText")
152
+ const error = jsx.attr(el, "error")
153
+ const id = jsx.attr(el, "id")
154
+ const errorValue = jsx.literal(error)
155
+ const invalid =
156
+ error && errorValue !== false
157
+ ? errorValue === true
158
+ ? ("always" as const)
159
+ : ("dynamic" as const)
160
+ : ("never" as const)
161
+
162
+ const control: (JSXAttribute | JSXSpreadAttribute)[] = []
163
+ const root: (JSXAttribute | JSXSpreadAttribute)[] = []
164
+ const reported: string[] = []
165
+ let hasSpread = false
166
+ let addons: { start?: Child; end?: Child } = {}
167
+ for (const a of el.openingElement.attributes ?? []) {
168
+ if (a.type === "JSXSpreadAttribute") {
169
+ control.push(a)
170
+ hasSpread = true
171
+ continue
172
+ }
173
+ const name = jsx.attrName(a)
174
+ if (CONTROL.has(name)) control.push(a)
175
+ else if (name === "inputRef") control.push(renamedAttr(j, a, "ref"))
176
+ else if (name === "InputProps") {
177
+ const input = inputProps(ctx, a)
178
+ if (input) {
179
+ control.push(...input.control)
180
+ addons = input.addons
181
+ reported.push(...input.reported)
182
+ } else
183
+ reported.push(
184
+ `dropped ${printAttr(ctx, a)} (adornments go in FieldInputGroup + FieldGroupAddon)`
185
+ )
186
+ } else if (name === "inputProps") {
187
+ const spread = spreadObject(ctx, a)
188
+ if (spread) control.push(...spread)
189
+ else
190
+ reported.push(
191
+ `dropped ${printAttr(ctx, a)} (spread it onto the control)`
192
+ )
193
+ } else if (
194
+ textarea &&
195
+ (name === "rows" || name === "minRows" || name === "rowsMin")
196
+ )
197
+ control.push(renamedAttr(j, a, "rows"))
198
+ else if (name in REPORTED)
199
+ reported.push(`dropped ${printAttr(ctx, a)} (${REPORTED[name]})`)
200
+ else if (name === "select" || SILENT.has(name)) continue
201
+ else root.push(a)
202
+ }
203
+ if (invalid === "always")
204
+ control.push(j.jsxAttribute(j.jsxIdentifier("aria-invalid")))
205
+ if (invalid === "dynamic")
206
+ control.push(renamedAttr(j, error!, "aria-invalid"))
207
+ if (invalid === "always") root.push(variantAttr(ctx, "destructive"))
208
+ if (invalid === "dynamic")
209
+ root.push(
210
+ j.jsxAttribute(
211
+ j.jsxIdentifier("variant"),
212
+ j.jsxExpressionContainer(
213
+ j.conditionalExpression(
214
+ attrValue(j, error!) as never,
215
+ stringIn(ctx, "destructive") as never,
216
+ stringIn(ctx, "default") as never
217
+ )
218
+ )
219
+ )
220
+ )
221
+
222
+ const children: Child[] = []
223
+ if (label) {
224
+ const labelAttrs = id ? [renamedAttr(j, id, "htmlFor")] : []
225
+ children.push(
226
+ element(j, ctx.ensureZenith("FieldLabel"), labelAttrs, [
227
+ jsx.childFromValue(label),
228
+ ])
229
+ )
230
+ if (!id)
231
+ reported.push(
232
+ "FieldLabel is not tied to the control: give the control an id and FieldLabel htmlFor (MUI generated them)"
233
+ )
234
+ }
235
+ const controlEl = element(
236
+ j,
237
+ ctx.ensureZenith(textarea ? "FieldTextarea" : "FieldInput"),
238
+ control
239
+ )
240
+ if (addons.start || addons.end) {
241
+ const addon = (align: "start" | "end", child: Child) =>
242
+ element(
243
+ j,
244
+ ctx.ensureZenith("FieldGroupAddon"),
245
+ [j.jsxAttribute(j.jsxIdentifier("align"), jsx.str(align))],
246
+ [child]
247
+ )
248
+ const group: Child[] = []
249
+ if (addons.start) group.push(j.jsxText("\n"), addon("start", addons.start))
250
+ group.push(j.jsxText("\n"), controlEl)
251
+ if (addons.end) group.push(j.jsxText("\n"), addon("end", addons.end))
252
+ group.push(j.jsxText("\n"))
253
+ children.push(element(j, ctx.ensureZenith("FieldInputGroup"), [], group))
254
+ } else children.push(controlEl)
255
+ if (helper) children.push(...helperChildren(ctx, helper, invalid, error))
256
+ if (hasSpread)
257
+ reported.push(
258
+ "spread props went to the control; move wrapper props (className, style) to Field"
259
+ )
260
+
261
+ jsx.rename(el, ctx.ensureZenith("Field"))
262
+ el.openingElement.attributes = root
263
+ setChildren(
264
+ j,
265
+ el,
266
+ children.flatMap((c) => [j.jsxText("\n"), c]).concat(j.jsxText("\n"))
267
+ )
268
+ if (reported.length) ctx.todo(path, "TextField", reported.join("; "))
269
+ return true
270
+ }
271
+
272
+ function helperChildren(
273
+ ctx: MigrateContext,
274
+ helper: JSXAttribute,
275
+ invalid: "always" | "dynamic" | "never",
276
+ error: JSXAttribute | undefined
277
+ ): Child[] {
278
+ const { j, jsx } = ctx
279
+ const part = (name: string) =>
280
+ element(j, ctx.ensureZenith(name), [], [jsx.childFromValue(helper)])
281
+ if (invalid === "always") return [part("FieldError")]
282
+ const description = part("FieldDescription")
283
+ if (invalid === "never") {
284
+ if (typeof jsx.literal(helper) === "string") return [description]
285
+ return [
286
+ j.jsxExpressionContainer(
287
+ j.logicalExpression("&&", attrValue(j, helper) as never, description)
288
+ ),
289
+ ]
290
+ }
291
+ return [
292
+ j.jsxExpressionContainer(
293
+ j.conditionalExpression(
294
+ attrValue(j, error!) as never,
295
+ part("FieldError"),
296
+ description
297
+ )
298
+ ),
299
+ ]
300
+ }
301
+
302
+ /** `inputProps={{ maxLength: 5, "data-testid": id }}` → attributes; `{x}` → `{...x}`. */
303
+ function spreadObject(
304
+ ctx: MigrateContext,
305
+ a: JSXAttribute
306
+ ): (JSXAttribute | JSXSpreadAttribute)[] | undefined {
307
+ const { j } = ctx
308
+ const expression = attrExpression(a)
309
+ if (!expression) return undefined
310
+ if (expression.type !== "ObjectExpression")
311
+ return [j.jsxSpreadAttribute(expression as never)]
312
+ const attrs: JSXAttribute[] = []
313
+ for (const p of expression.properties) {
314
+ if ((p.type !== "ObjectProperty" && p.type !== "Property") || p.computed)
315
+ return undefined
316
+ const key =
317
+ p.key.type === "Identifier"
318
+ ? p.key.name
319
+ : p.key.type === "StringLiteral" || p.key.type === "Literal"
320
+ ? String((p.key as { value: unknown }).value)
321
+ : undefined
322
+ if (!key) return undefined
323
+ const value = p.value as { type: string; value?: unknown }
324
+ attrs.push(
325
+ j.jsxAttribute(
326
+ j.jsxIdentifier(key),
327
+ value.type === "StringLiteral"
328
+ ? ctx.jsx.str(String(value.value))
329
+ : j.jsxExpressionContainer(p.value as never)
330
+ )
331
+ )
332
+ }
333
+ return attrs
334
+ }
335
+
336
+ function variantAttr(ctx: MigrateContext, value: string): JSXAttribute {
337
+ return ctx.j.jsxAttribute(ctx.j.jsxIdentifier("variant"), ctx.jsx.str(value))
338
+ }
339
+
340
+ /**
341
+ * `InputProps={{ startAdornment, endAdornment, readOnly, inputProps }}`: the adornments as addon
342
+ * children (an `InputAdornment` wrapper unwrapped), the rest onto the control. `undefined` when
343
+ * `InputProps` is not an object literal.
344
+ */
345
+ function inputProps(
346
+ ctx: MigrateContext,
347
+ a: JSXAttribute
348
+ ):
349
+ | {
350
+ control: (JSXAttribute | JSXSpreadAttribute)[]
351
+ addons: { start?: Child; end?: Child }
352
+ reported: string[]
353
+ }
354
+ | undefined {
355
+ const { j } = ctx
356
+ const object = attrExpression(a)
357
+ if (object?.type !== "ObjectExpression") return undefined
358
+ const control: (JSXAttribute | JSXSpreadAttribute)[] = []
359
+ const addons: { start?: Child; end?: Child } = {}
360
+ const reported: string[] = []
361
+ for (const p of object.properties) {
362
+ if ((p.type !== "ObjectProperty" && p.type !== "Property") || p.computed)
363
+ return undefined
364
+ const key = p.key.type === "Identifier" ? p.key.name : undefined
365
+ const value = p.value as Expression
366
+ if (key === "startAdornment" || key === "endAdornment")
367
+ addons[key === "startAdornment" ? "start" : "end"] = adornmentChild(
368
+ ctx,
369
+ value
370
+ )
371
+ else if (key === "readOnly")
372
+ control.push(
373
+ j.jsxAttribute(
374
+ j.jsxIdentifier("readOnly"),
375
+ j.jsxExpressionContainer(value as never)
376
+ )
377
+ )
378
+ else if (key === "inputProps") {
379
+ const spread = spreadObject(
380
+ ctx,
381
+ j.jsxAttribute(
382
+ j.jsxIdentifier("inputProps"),
383
+ j.jsxExpressionContainer(value as never)
384
+ )
385
+ )
386
+ if (spread) control.push(...spread)
387
+ else
388
+ reported.push(
389
+ `dropped InputProps.inputProps (spread it onto the control)`
390
+ )
391
+ } else if (key === "disableUnderline") continue
392
+ else
393
+ reported.push(
394
+ `dropped InputProps.${key ?? "…"} (MUI's Input root has no Zenith counterpart)`
395
+ )
396
+ }
397
+ return { control, addons, reported }
398
+ }
399
+
400
+ /** An adornment as an addon child: `<InputAdornment>` wrappers inside it give way to their content. */
401
+ function adornmentChild(ctx: MigrateContext, value: Expression): Child {
402
+ const { j, jsx } = ctx
403
+ const tag = ctx.names.InputAdornment
404
+ const unwrap = (el: JSXElement): Child | undefined => {
405
+ if (!tag || jsx.tagName(el) !== tag) return undefined
406
+ const content = contentChildren(el)
407
+ if (content.length === 1 && content[0].type === "JSXElement")
408
+ return content[0]
409
+ return j.jsxFragment(
410
+ j.jsxOpeningFragment(),
411
+ j.jsxClosingFragment(),
412
+ el.children ?? []
413
+ )
414
+ }
415
+ if (value.type === "JSXElement")
416
+ return unwrap(value as JSXElement) ?? (value as JSXElement)
417
+ j(value as never)
418
+ .find(j.JSXElement)
419
+ .filter((p) => !!tag && jsx.tagName(p.node) === tag)
420
+ .forEach((p) => {
421
+ const inner = unwrap(p.node)
422
+ if (inner) p.replace(inner)
423
+ })
424
+ return j.jsxExpressionContainer(value as never)
425
+ }
@@ -0,0 +1,185 @@
1
+ /**
2
+ * ToggleButtonGroup / ToggleButton → SegmentedControl / SegmentedControlItem (`exclusive`) or
3
+ * ToggleGroup type="multiple" / ToggleGroupItem.
4
+ *
5
+ * - `onChange={(event, value) => …}` → `onValueChange={(value) => …}`. An exclusive MUI group
6
+ * could be cleared (value null); a SegmentedControl always keeps one item selected.
7
+ * - Item values are strings in Radix: a numeric literal is written as a string and reported.
8
+ * - `size` and `color` are theming: dropped. A group whose `exclusive` is dynamic, and a
9
+ * ToggleButton outside a group (Zenith's Toggle: pressed / onPressedChange), stay on
10
+ * base-elements with a TODO.
11
+ */
12
+ import type { ASTPath, JSXElement } from "jscodeshift"
13
+ import type { MigrateContext } from "../lib/types"
14
+ import {
15
+ attrExpression,
16
+ printAttr,
17
+ printAttrs,
18
+ takeAttrs,
19
+ valueHandler,
20
+ familyStays,
21
+ } from "./shared"
22
+
23
+ export const handles = [
24
+ "ToggleButtonGroup",
25
+ "ToggleButtonGroupProps",
26
+ "ToggleButton",
27
+ "ToggleButtonProps",
28
+ ] as const
29
+
30
+ export function migrate(ctx: MigrateContext): void {
31
+ const { j, jsx } = ctx
32
+ if (
33
+ familyStays(
34
+ ctx,
35
+ ["ToggleButtonGroup", "ToggleButton"],
36
+ 'migrate this group by hand: SegmentedControl > SegmentedControlItem (one choice) or ToggleGroup type="multiple" > ToggleGroupItem'
37
+ )
38
+ )
39
+ return
40
+ const itemTag = ctx.names.ToggleButton
41
+ const converted = new Set<JSXElement>()
42
+ const withKeptGroup = new Set<JSXElement>()
43
+ let keptGroup = false
44
+
45
+ ctx.elements("ToggleButtonGroup").forEach((path) => {
46
+ const exclusive = jsx.attr(path.node, "exclusive")
47
+ const mode = !exclusive
48
+ ? "multiple"
49
+ : typeof jsx.literal(exclusive) === "boolean"
50
+ ? jsx.literal(exclusive)
51
+ ? "single"
52
+ : "multiple"
53
+ : undefined
54
+ if (!mode) {
55
+ keptGroup = true
56
+ // Its items stay with it; the group's TODO covers them.
57
+ if (itemTag)
58
+ j(path)
59
+ .find(j.JSXElement)
60
+ .filter((p) => jsx.tagName(p.node) === itemTag)
61
+ .forEach((p) => {
62
+ withKeptGroup.add(p.node)
63
+ })
64
+ ctx.todo(
65
+ path,
66
+ "ToggleButtonGroup",
67
+ `stays on base-elements: ${printAttr(ctx, exclusive!)} picks SegmentedControl (single) or ToggleGroup type="multiple" at runtime; choose one`
68
+ )
69
+ return
70
+ }
71
+ const items = itemTag
72
+ ? j(path)
73
+ .find(j.JSXElement)
74
+ .filter((p) => jsx.tagName(p.node) === itemTag)
75
+ .paths()
76
+ : []
77
+ for (const item of items) {
78
+ converted.add(item.node)
79
+ migrateItem(ctx, item, mode)
80
+ }
81
+ migrateGroup(ctx, path, mode)
82
+ })
83
+
84
+ if (keptGroup)
85
+ ctx.keep(
86
+ "ToggleButtonGroup",
87
+ "still used where a group stayed: see the TODOs on those elements"
88
+ )
89
+ else ctx.drop("ToggleButtonGroup")
90
+ ctx.keep(
91
+ "ToggleButtonGroupProps",
92
+ "SegmentedControlProps for a single choice, ToggleGroupProps for several"
93
+ )
94
+
95
+ let keptItem = false
96
+ ctx.elements("ToggleButton").forEach((path) => {
97
+ if (converted.has(path.node)) return
98
+ keptItem = true
99
+ if (withKeptGroup.has(path.node)) return
100
+ ctx.todo(
101
+ path,
102
+ "ToggleButton",
103
+ "stays on base-elements: a ToggleButton on its own is Zenith's Toggle (selected → pressed, onChange → onPressedChange(pressed))"
104
+ )
105
+ })
106
+ if (keptItem)
107
+ ctx.keep(
108
+ "ToggleButton",
109
+ "still used where a ToggleButton stayed: see the TODOs on those elements"
110
+ )
111
+ else ctx.drop("ToggleButton")
112
+ ctx.keep(
113
+ "ToggleButtonProps",
114
+ "SegmentedControlItemProps or ToggleGroupItemProps"
115
+ )
116
+ }
117
+
118
+ function migrateGroup(
119
+ ctx: MigrateContext,
120
+ path: ASTPath<JSXElement>,
121
+ mode: "single" | "multiple"
122
+ ): void {
123
+ const { j, jsx } = ctx
124
+ const el = path.node
125
+ const reported: string[] = []
126
+ jsx.rename(
127
+ el,
128
+ ctx.ensureZenith(mode === "single" ? "SegmentedControl" : "ToggleGroup")
129
+ )
130
+ jsx.removeAttr(el, "exclusive")
131
+ takeAttrs(ctx, el, ["size", "color"])
132
+ if (mode === "multiple")
133
+ el.openingElement.attributes = [
134
+ j.jsxAttribute(j.jsxIdentifier("type"), jsx.str("multiple")),
135
+ ...(el.openingElement.attributes ?? []),
136
+ ]
137
+
138
+ const onChange = jsx.removeAttr(el, "onChange")
139
+ if (onChange) {
140
+ const handler = valueHandler(j, attrExpression(onChange), {
141
+ valueName: "value",
142
+ })
143
+ if (handler) jsx.setAttr(el, "onValueChange", handler)
144
+ else
145
+ reported.push(
146
+ `dropped ${printAttr(ctx, onChange)} (onValueChange(value) passes only the ${mode === "single" ? "value" : "values"}: call your handler with it)`
147
+ )
148
+ }
149
+ const unsupported = takeAttrs(ctx, el, ["classes"])
150
+ if (unsupported.length)
151
+ reported.push(`dropped ${printAttrs(ctx, unsupported)} (MUI-only)`)
152
+ if (reported.length) ctx.todo(path, "ToggleButtonGroup", reported.join("; "))
153
+ }
154
+
155
+ function migrateItem(
156
+ ctx: MigrateContext,
157
+ path: ASTPath<JSXElement>,
158
+ mode: "single" | "multiple"
159
+ ): void {
160
+ const { jsx } = ctx
161
+ const el = path.node
162
+ const reported: string[] = []
163
+ jsx.rename(
164
+ el,
165
+ ctx.ensureZenith(
166
+ mode === "single" ? "SegmentedControlItem" : "ToggleGroupItem"
167
+ )
168
+ )
169
+ takeAttrs(ctx, el, [
170
+ "size",
171
+ "color",
172
+ "disableRipple",
173
+ "disableFocusRipple",
174
+ "selected",
175
+ ])
176
+ const value = jsx.attr(el, "value")
177
+ const literal = jsx.literal(value)
178
+ if (typeof literal === "number" || typeof literal === "boolean") {
179
+ jsx.setAttr(el, "value", String(literal))
180
+ reported.push(
181
+ `value={${literal}} is now "${literal}": Radix item values are strings; make the group value a string too`
182
+ )
183
+ }
184
+ if (reported.length) ctx.todo(path, "ToggleButton", reported.join("; "))
185
+ }