@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.
- package/README.md +37 -1
- package/codemods/README.md +182 -0
- package/codemods/format.ts +86 -0
- package/codemods/migrate/base-elements/accordion.ts +132 -0
- package/codemods/migrate/base-elements/alert.ts +81 -0
- package/codemods/migrate/base-elements/avatar.ts +116 -0
- package/codemods/migrate/base-elements/button.ts +188 -0
- package/codemods/migrate/base-elements/checkbox.ts +17 -0
- package/codemods/migrate/base-elements/chip.ts +87 -0
- package/codemods/migrate/base-elements/chip360.ts +162 -0
- package/codemods/migrate/base-elements/circular-progress.ts +73 -0
- package/codemods/migrate/base-elements/dialog.ts +323 -0
- package/codemods/migrate/base-elements/divider.ts +61 -0
- package/codemods/migrate/base-elements/feedback-message.ts +95 -0
- package/codemods/migrate/base-elements/icon-button.ts +203 -0
- package/codemods/migrate/base-elements/index.ts +55 -0
- package/codemods/migrate/base-elements/mui-props.ts +29 -0
- package/codemods/migrate/base-elements/notification.ts +98 -0
- package/codemods/migrate/base-elements/paper.ts +78 -0
- package/codemods/migrate/base-elements/select.ts +328 -0
- package/codemods/migrate/base-elements/shared.ts +910 -0
- package/codemods/migrate/base-elements/skeleton.ts +83 -0
- package/codemods/migrate/base-elements/switch.ts +19 -0
- package/codemods/migrate/base-elements/tabs.ts +222 -0
- package/codemods/migrate/base-elements/text-field.ts +425 -0
- package/codemods/migrate/base-elements/toggle-button.ts +185 -0
- package/codemods/migrate/base-elements/tooltip.ts +231 -0
- package/codemods/migrate/base-elements/typography.ts +247 -0
- package/codemods/migrate/base-elements/unsupported.ts +277 -0
- package/codemods/migrate/from-base-elements.ts +26 -0
- package/codemods/migrate/from-volt.ts +26 -0
- package/codemods/migrate/lib/imports.ts +399 -0
- package/codemods/migrate/lib/jsx.ts +313 -0
- package/codemods/migrate/lib/run-migration.ts +528 -0
- package/codemods/migrate/lib/source.ts +6 -0
- package/codemods/migrate/lib/todo.ts +107 -0
- package/codemods/migrate/lib/types.ts +114 -0
- package/codemods/migrate/volt/class-helpers.ts +37 -0
- package/codemods/migrate/volt/index.ts +18 -0
- package/codemods/migrate/volt/pagination.ts +26 -0
- package/codemods/migrate/volt/same-name.ts +293 -0
- package/codemods/migrate/volt/stylesheets.ts +18 -0
- package/codemods/migrate/volt/tanstack-types.ts +20 -0
- package/codemods/radix-to-base-ui.ts +677 -0
- package/dist/_virtual/_zenith-runtime-family_accordion.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_accordion.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_alert-dialog.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_alert-dialog.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_avatar.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_avatar.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_button.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_button.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_checkbox.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_checkbox.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_csp-provider.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_csp-provider.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_dialog.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_dialog.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_direction-provider.js +8 -0
- package/dist/_virtual/_zenith-runtime-family_direction-provider.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_menu.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_menu.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_merge-props.js +11 -0
- package/dist/_virtual/_zenith-runtime-family_merge-props.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_popover.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_popover.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_radio-group.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_radio-group.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_radio.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_radio.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_scroll-area.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_scroll-area.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_select.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_select.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_separator.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_separator.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_switch.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_switch.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_tabs.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_tabs.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_toast.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_toast.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_toggle-group.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_toggle-group.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_toggle.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_toggle.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_tooltip.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_tooltip.js.map +1 -0
- package/dist/_virtual/_zenith-runtime-family_use-render.js +7 -0
- package/dist/_virtual/_zenith-runtime-family_use-render.js.map +1 -0
- package/dist/components/accordion/accordion.js +179 -96
- package/dist/components/accordion/accordion.js.map +1 -1
- package/dist/components/alert-dialog/alert-dialog.js +243 -206
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/avatar/avatar.js +94 -82
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/badge/badge.js +11 -11
- package/dist/components/breadcrumb/breadcrumb.js +69 -70
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/button/button.js +119 -102
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/checkbox/checkbox.js +68 -51
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.js +100 -90
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/date-time-picker/date-time-picker-input.js +118 -108
- package/dist/components/date-time-picker/date-time-picker-input.js.map +1 -1
- package/dist/components/date-time-picker/date-time-picker-panel.js +91 -94
- package/dist/components/date-time-picker/date-time-picker-panel.js.map +1 -1
- package/dist/components/dialog/dialog.js +238 -228
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/drawer/drawer.js +259 -321
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.js +533 -279
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/field/field-combobox.js +205 -186
- package/dist/components/field/field-combobox.js.map +1 -1
- package/dist/components/field/field-select.js +37 -22
- package/dist/components/field/field-select.js.map +1 -1
- package/dist/components/list/list-sortable.js +104 -0
- package/dist/components/list/list-sortable.js.map +1 -0
- package/dist/components/list/list.js +246 -324
- package/dist/components/list/list.js.map +1 -1
- package/dist/components/option-card/option-card.js +121 -117
- package/dist/components/option-card/option-card.js.map +1 -1
- package/dist/components/pill/pill.js +7 -7
- package/dist/components/popover/popover.js +223 -127
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/radio/radio-group-base.js +54 -0
- package/dist/components/radio/radio-group-base.js.map +1 -0
- package/dist/components/radio/radio.js +71 -60
- package/dist/components/radio/radio.js.map +1 -1
- package/dist/components/scroll-area/scroll-area.js +142 -108
- package/dist/components/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/scroll-overflow/scroll-overflow.js +156 -127
- package/dist/components/scroll-overflow/scroll-overflow.js.map +1 -1
- package/dist/components/segmented-control/segmented-control.js +93 -81
- package/dist/components/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/select/select.js +485 -310
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/separator/separator.js.map +1 -1
- package/dist/components/slot/compose-as-child.js +15 -12
- package/dist/components/slot/compose-as-child.js.map +1 -1
- package/dist/components/switch/switch.js +75 -68
- package/dist/components/switch/switch.js.map +1 -1
- package/dist/components/table/table-pagination.js +212 -175
- package/dist/components/table/table-pagination.js.map +1 -1
- package/dist/components/tabs/tabs.js +193 -190
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/toast/toast.js +610 -148
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/toggle/toggle-group.js +143 -32
- package/dist/components/toggle/toggle-group.js.map +1 -1
- package/dist/components/toggle/toggle.js +82 -49
- package/dist/components/toggle/toggle.js.map +1 -1
- package/dist/components/tooltip/tooltip.js +298 -138
- package/dist/components/tooltip/tooltip.js.map +1 -1
- package/dist/index.d.ts +2336 -2130
- package/dist/index.js +24 -23
- package/dist/list/sortable/index.d.ts +29 -0
- package/dist/list/sortable/index.js +5 -0
- package/dist/{_virtual → list/sortable}/index.js.map +1 -1
- package/dist/packages/tokens/dist/delivery/index.js +10 -10
- package/dist/packages/tokens/dist/delivery/index.js.map +1 -1
- package/dist/packages/tokens/dist/generated/core.generated.js +6 -15
- package/dist/packages/tokens/dist/generated/core.generated.js.map +1 -1
- package/dist/packages/tokens/dist/generated/palette.generated.js +4 -5
- package/dist/packages/tokens/dist/generated/palette.generated.js.map +1 -1
- package/dist/packages/tokens/dist/generated/palette.meta.generated.js +5 -0
- package/dist/packages/tokens/dist/generated/palette.meta.generated.js.map +1 -0
- package/dist/packages/tokens/dist/install.js +40 -17
- package/dist/packages/tokens/dist/install.js.map +1 -1
- package/dist/renderer/runtime-contract.generated.js +8 -0
- package/dist/renderer/runtime-contract.generated.js.map +1 -0
- package/dist/renderer/served.js +39 -0
- package/dist/renderer/served.js.map +1 -0
- package/dist/tokens/core.meta.generated.js +2 -2
- package/dist/tokens/core.meta.generated.js.map +1 -1
- package/dist/tokens/index.d.ts +1028 -1028
- package/dist/tokens/index.js +863 -863
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/palette.meta.generated.js +5 -0
- package/dist/tokens/palette.meta.generated.js.map +1 -0
- package/dist/tokens.json +1 -1
- package/dist/vendor/.bun/@radix-ui_react-dialog@1.1.15_2b23df507bdda662/vendor/@radix-ui/react-dialog/dist/index.js +57 -62
- package/dist/vendor/.bun/@radix-ui_react-dialog@1.1.15_2b23df507bdda662/vendor/@radix-ui/react-dialog/dist/index.js.map +1 -1
- package/dist/vendor/.bun/@radix-ui_react-slot@1.2.3_0ac650c021fb1b59/vendor/@radix-ui/react-slot/dist/index.js +32 -38
- package/dist/vendor/.bun/@radix-ui_react-slot@1.2.3_0ac650c021fb1b59/vendor/@radix-ui/react-slot/dist/index.js.map +1 -1
- package/package.json +29 -21
- package/scripts/migration-diagnostics-core.mjs +302 -10
- package/scripts/migration-diagnostics.mjs +31 -8
- package/scripts/migration-sweep.mjs +10 -10
- package/testing/setup.cjs +87 -0
- package/dist/_virtual/index.js +0 -6
- package/dist/_virtual/index2.js +0 -5
- package/dist/_virtual/index2.js.map +0 -1
- package/dist/_virtual/use-sync-external-store-shim.development.js +0 -5
- package/dist/_virtual/use-sync-external-store-shim.development.js.map +0 -1
- package/dist/_virtual/use-sync-external-store-shim.production.js +0 -5
- package/dist/_virtual/use-sync-external-store-shim.production.js.map +0 -1
- package/dist/tokens/palette.generated.js +0 -5
- package/dist/tokens/palette.generated.js.map +0 -1
- package/dist/vendor/.bun/@floating-ui_core@1.8.0/vendor/@floating-ui/core/dist/floating-ui.core.js +0 -512
- package/dist/vendor/.bun/@floating-ui_core@1.8.0/vendor/@floating-ui/core/dist/floating-ui.core.js.map +0 -1
- package/dist/vendor/.bun/@floating-ui_dom@1.8.0/vendor/@floating-ui/dom/dist/floating-ui.dom.js +0 -396
- package/dist/vendor/.bun/@floating-ui_dom@1.8.0/vendor/@floating-ui/dom/dist/floating-ui.dom.js.map +0 -1
- 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
- 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
- package/dist/vendor/.bun/@floating-ui_utils@0.2.12/vendor/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -137
- package/dist/vendor/.bun/@floating-ui_utils@0.2.12/vendor/@floating-ui/utils/dist/floating-ui.utils.dom.js.map +0 -1
- package/dist/vendor/.bun/@floating-ui_utils@0.2.12/vendor/@floating-ui/utils/dist/floating-ui.utils.js +0 -129
- package/dist/vendor/.bun/@floating-ui_utils@0.2.12/vendor/@floating-ui/utils/dist/floating-ui.utils.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_number@1.1.1/vendor/@radix-ui/number/dist/index.js +0 -7
- package/dist/vendor/.bun/@radix-ui_number@1.1.1/vendor/@radix-ui/number/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-accordion@1.2.12_2b23df507bdda662/vendor/@radix-ui/react-accordion/dist/index.js +0 -240
- package/dist/vendor/.bun/@radix-ui_react-accordion@1.2.12_2b23df507bdda662/vendor/@radix-ui/react-accordion/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-alert-dialog@1.1.15_2b23df507bdda662/vendor/@radix-ui/react-alert-dialog/dist/index.js +0 -128
- 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
- package/dist/vendor/.bun/@radix-ui_react-arrow@1.1.7_2b23df507bdda662/vendor/@radix-ui/react-arrow/dist/index.js +0 -25
- package/dist/vendor/.bun/@radix-ui_react-arrow@1.1.7_2b23df507bdda662/vendor/@radix-ui/react-arrow/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-avatar@1.1.10_2b23df507bdda662/vendor/@radix-ui/react-avatar/dist/index.js +0 -76
- package/dist/vendor/.bun/@radix-ui_react-avatar@1.1.10_2b23df507bdda662/vendor/@radix-ui/react-avatar/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-checkbox@1.3.3_2b23df507bdda662/vendor/@radix-ui/react-checkbox/dist/index.js +0 -252
- package/dist/vendor/.bun/@radix-ui_react-checkbox@1.3.3_2b23df507bdda662/vendor/@radix-ui/react-checkbox/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-collapsible@1.1.12_2b23df507bdda662/vendor/@radix-ui/react-collapsible/dist/index.js +0 -121
- package/dist/vendor/.bun/@radix-ui_react-collapsible@1.1.12_2b23df507bdda662/vendor/@radix-ui/react-collapsible/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-collection@1.1.7_2b23df507bdda662/vendor/@radix-ui/react-collection/dist/index.js +0 -49
- package/dist/vendor/.bun/@radix-ui_react-collection@1.1.7_2b23df507bdda662/vendor/@radix-ui/react-collection/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-direction@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-direction/dist/index.js +0 -11
- package/dist/vendor/.bun/@radix-ui_react-direction@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-direction/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-dropdown-menu@2.1.16_2b23df507bdda662/vendor/@radix-ui/react-dropdown-menu/dist/index.js +0 -228
- 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
- package/dist/vendor/.bun/@radix-ui_react-menu@2.1.16_2b23df507bdda662/vendor/@radix-ui/react-menu/dist/index.js +0 -653
- package/dist/vendor/.bun/@radix-ui_react-menu@2.1.16_2b23df507bdda662/vendor/@radix-ui/react-menu/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-popover@1.1.15_2b23df507bdda662/vendor/@radix-ui/react-popover/dist/index.js +0 -244
- package/dist/vendor/.bun/@radix-ui_react-popover@1.1.15_2b23df507bdda662/vendor/@radix-ui/react-popover/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-popper@1.2.8_2b23df507bdda662/vendor/@radix-ui/react-popper/dist/index.js +0 -222
- package/dist/vendor/.bun/@radix-ui_react-popper@1.2.8_2b23df507bdda662/vendor/@radix-ui/react-popper/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-radio-group@1.3.8_2b23df507bdda662/vendor/@radix-ui/react-radio-group/dist/index.js +0 -239
- 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
- package/dist/vendor/.bun/@radix-ui_react-roving-focus@1.1.11_2b23df507bdda662/vendor/@radix-ui/react-roving-focus/dist/index.js +0 -184
- 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
- package/dist/vendor/.bun/@radix-ui_react-scroll-area@1.2.10_2b23df507bdda662/vendor/@radix-ui/react-scroll-area/dist/index.js +0 -535
- 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
- package/dist/vendor/.bun/@radix-ui_react-select@2.2.6_2b23df507bdda662/vendor/@radix-ui/react-select/dist/index.js +0 -863
- package/dist/vendor/.bun/@radix-ui_react-select@2.2.6_2b23df507bdda662/vendor/@radix-ui/react-select/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-slot@1.2.4_0ac650c021fb1b59/vendor/@radix-ui/react-slot/dist/index.js +0 -63
- package/dist/vendor/.bun/@radix-ui_react-slot@1.2.4_0ac650c021fb1b59/vendor/@radix-ui/react-slot/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-switch@1.2.6_2b23df507bdda662/vendor/@radix-ui/react-switch/dist/index.js +0 -133
- package/dist/vendor/.bun/@radix-ui_react-switch@1.2.6_2b23df507bdda662/vendor/@radix-ui/react-switch/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-tabs@1.1.13_2b23df507bdda662/vendor/@radix-ui/react-tabs/dist/index.js +0 -164
- package/dist/vendor/.bun/@radix-ui_react-tabs@1.1.13_2b23df507bdda662/vendor/@radix-ui/react-tabs/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-toggle-group@1.1.11_2b23df507bdda662/vendor/@radix-ui/react-toggle-group/dist/index.js +0 -138
- 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
- package/dist/vendor/.bun/@radix-ui_react-toggle@1.1.10_2b23df507bdda662/vendor/@radix-ui/react-toggle/dist/index.js +0 -34
- package/dist/vendor/.bun/@radix-ui_react-toggle@1.1.10_2b23df507bdda662/vendor/@radix-ui/react-toggle/dist/index.js.map +0 -1
- package/dist/vendor/.bun/@radix-ui_react-tooltip@1.2.8_2b23df507bdda662/vendor/@radix-ui/react-tooltip/dist/index.js +0 -340
- package/dist/vendor/.bun/@radix-ui_react-tooltip@1.2.8_2b23df507bdda662/vendor/@radix-ui/react-tooltip/dist/index.js.map +0 -1
- 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
- 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
- package/dist/vendor/.bun/@radix-ui_react-use-previous@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-use-previous/dist/index.js +0 -9
- 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
- package/dist/vendor/.bun/@radix-ui_react-use-size@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-use-size/dist/index.js +0 -28
- 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
- package/dist/vendor/.bun/@radix-ui_react-visually-hidden@1.2.3_2b23df507bdda662/vendor/@radix-ui/react-visually-hidden/dist/index.js +0 -33
- 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
- package/dist/vendor/.bun/sonner@2.0.7_6f4b9a1cfb20c0ae/vendor/sonner/dist/index.js +0 -747
- package/dist/vendor/.bun/sonner@2.0.7_6f4b9a1cfb20c0ae/vendor/sonner/dist/index.js.map +0 -1
- 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
- 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
- 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
- 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
- package/dist/vendor/.bun/use-sync-external-store@1.7.0_62547eec5a2188e3/vendor/use-sync-external-store/shim/index.js +0 -11
- 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,323 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The MUI Dialog family → Zenith's Dialog.
|
|
3
|
+
*
|
|
4
|
+
* MUI's `DialogContent` is the scrolling BODY between title and actions; Zenith's is the whole
|
|
5
|
+
* PANEL. So the names never map one to one:
|
|
6
|
+
*
|
|
7
|
+
* - `<Dialog open onClose>` → `<Dialog open onOpenChange>` around a `<DialogContent>` panel that
|
|
8
|
+
* takes the dialog's children. With `fullWidth`, `maxWidth` (MUI default sm, 600px) → the
|
|
9
|
+
* nearest panel `size`; without it MUI fitted the content, so the size stops at Zenith's
|
|
10
|
+
* default lg.
|
|
11
|
+
* - `<DialogContent>` (body) → `<div>`.
|
|
12
|
+
* - `<DialogTitle>` → `<DialogHeader><DialogTitle>`; `<DialogActions>` → `<DialogFooter>`;
|
|
13
|
+
* `<DialogContentText>` → `<DialogDescription>`.
|
|
14
|
+
* - `disableBackdropClick` / `disableEscapeKeyDown` → the panel's `onPointerDownOutside` /
|
|
15
|
+
* `onEscapeKeyDown` calling `preventDefault()`. `aria-labelledby`/`aria-describedby` and the
|
|
16
|
+
* ids they point at are dropped: Radix wires the title and description itself.
|
|
17
|
+
*/
|
|
18
|
+
import type { ASTPath, JSXAttribute, JSXElement } from "jscodeshift"
|
|
19
|
+
import type { MigrateContext } from "../lib/types"
|
|
20
|
+
import {
|
|
21
|
+
attrExpression,
|
|
22
|
+
closeAsOpenChange,
|
|
23
|
+
element,
|
|
24
|
+
isTrue,
|
|
25
|
+
mapStringExpression,
|
|
26
|
+
nestChildren,
|
|
27
|
+
onlyChild,
|
|
28
|
+
parseExpression,
|
|
29
|
+
printAttrs,
|
|
30
|
+
stringIn,
|
|
31
|
+
takeAttrs,
|
|
32
|
+
printAttr,
|
|
33
|
+
reportValueUses,
|
|
34
|
+
} from "./shared"
|
|
35
|
+
|
|
36
|
+
export const handles = [
|
|
37
|
+
"Dialog",
|
|
38
|
+
"DialogProps",
|
|
39
|
+
"DialogTitle",
|
|
40
|
+
"DialogTitleProps",
|
|
41
|
+
"DialogContent",
|
|
42
|
+
"DialogContentProps",
|
|
43
|
+
"DialogContentText",
|
|
44
|
+
"DialogContentTextProps",
|
|
45
|
+
"DialogActions",
|
|
46
|
+
"DialogActionsProps",
|
|
47
|
+
] as const
|
|
48
|
+
|
|
49
|
+
/** MUI `maxWidth` → Zenith size (sm 24rem … 5xl 64rem): the nearest at or above MUI's width. */
|
|
50
|
+
const SIZES: Record<string, string> = {
|
|
51
|
+
xs: "md", // 444px → 28rem
|
|
52
|
+
sm: "xl", // 600px → 36rem
|
|
53
|
+
md: "5xl", // 960px → 64rem
|
|
54
|
+
}
|
|
55
|
+
const TOO_WIDE: Record<string, string> = { lg: "1280px", xl: "1920px" }
|
|
56
|
+
const ORDER = ["sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "5xl", "full-width"]
|
|
57
|
+
|
|
58
|
+
const SILENT_ROOT = ["fullWidth"]
|
|
59
|
+
/** Root props that belong on the panel in Zenith. */
|
|
60
|
+
const TO_PANEL = (name: string) =>
|
|
61
|
+
name === "className" ||
|
|
62
|
+
name === "style" ||
|
|
63
|
+
name === "id" ||
|
|
64
|
+
name.startsWith("data-") ||
|
|
65
|
+
name.startsWith("aria-")
|
|
66
|
+
|
|
67
|
+
export function migrate(ctx: MigrateContext): void {
|
|
68
|
+
const { jsx } = ctx
|
|
69
|
+
|
|
70
|
+
// Zenith's parts need Zenith's root (Radix context): a styled(Dialog) keeps the whole family.
|
|
71
|
+
if (
|
|
72
|
+
reportValueUses(
|
|
73
|
+
ctx,
|
|
74
|
+
"Dialog",
|
|
75
|
+
"migrate the dialog and its parts by hand: Dialog open onOpenChange > DialogContent (the panel; style it there) > DialogHeader / DialogFooter"
|
|
76
|
+
)
|
|
77
|
+
) {
|
|
78
|
+
for (const name of handles) ctx.keep(name)
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Radix gives the title and description their ids to link aria-labelledby/-describedby; ids
|
|
83
|
+
// that only existed for MUI's manual labelling go silently, others are reported.
|
|
84
|
+
// Ids on the parts Radix links itself: a dialog pointing at them needs nothing more.
|
|
85
|
+
const partIds = new Set<string>()
|
|
86
|
+
for (const name of ["DialogTitle", "DialogContentText"])
|
|
87
|
+
ctx.elements(name).forEach((path) => {
|
|
88
|
+
const id = jsx.literal(jsx.attr(path.node, "id"))
|
|
89
|
+
if (typeof id === "string") partIds.add(id)
|
|
90
|
+
})
|
|
91
|
+
const labelIds = new Set<string>()
|
|
92
|
+
ctx.elements("Dialog").forEach((path) => {
|
|
93
|
+
for (const name of ["aria-labelledby", "aria-describedby"]) {
|
|
94
|
+
const value = jsx.literal(jsx.attr(path.node, name))
|
|
95
|
+
if (typeof value === "string") labelIds.add(value)
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
const dropId = (path: ASTPath<JSXElement>, component: string) => {
|
|
99
|
+
const id = jsx.removeAttr(path.node, "id")
|
|
100
|
+
const value = jsx.literal(id)
|
|
101
|
+
if (id && !(typeof value === "string" && labelIds.has(value)))
|
|
102
|
+
ctx.todo(
|
|
103
|
+
path,
|
|
104
|
+
component,
|
|
105
|
+
`dropped ${printAttr(ctx, id)}: Radix sets this id to link the dialog's accessible name; select the element by role instead`
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const bodyUsed = reportValueUses(
|
|
110
|
+
ctx,
|
|
111
|
+
"DialogContent",
|
|
112
|
+
"MUI's DialogContent is the dialog body: make it a styled <div> (Zenith's DialogContent is the whole panel)"
|
|
113
|
+
)
|
|
114
|
+
ctx.elements("DialogContent").forEach((path) => migrateBody(ctx, path))
|
|
115
|
+
|
|
116
|
+
const titles = ctx.elements("DialogTitle").paths()
|
|
117
|
+
ctx.moveElements("DialogTitle")
|
|
118
|
+
ctx.move("DialogTitleProps")
|
|
119
|
+
if (titles.length) {
|
|
120
|
+
const header = ctx.ensureZenith("DialogHeader")
|
|
121
|
+
for (const path of titles) {
|
|
122
|
+
jsx.removeAttr(path.node, "disableTypography")
|
|
123
|
+
dropId(path, "DialogTitle")
|
|
124
|
+
path.replace(
|
|
125
|
+
element(ctx.j, header, [], onlyChild(ctx.j, path.node, true))
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const footers = ctx.elements("DialogActions").paths()
|
|
131
|
+
ctx.moveElements("DialogActions", "DialogFooter")
|
|
132
|
+
ctx.move("DialogActionsProps", "DialogFooterProps")
|
|
133
|
+
footers.forEach((path) => {
|
|
134
|
+
jsx.removeAttr(path.node, "disableSpacing")
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
const descriptions = ctx.elements("DialogContentText").paths()
|
|
138
|
+
ctx.moveElements("DialogContentText", "DialogDescription")
|
|
139
|
+
ctx.move("DialogContentTextProps", "DialogDescriptionProps")
|
|
140
|
+
descriptions.forEach((path) => {
|
|
141
|
+
dropId(path, "DialogContentText")
|
|
142
|
+
jsx.removeAttr(path.node, "color")
|
|
143
|
+
const unsupported = takeAttrs(ctx, path.node, ["variant", "classes"])
|
|
144
|
+
if (unsupported.length)
|
|
145
|
+
ctx.todo(
|
|
146
|
+
path,
|
|
147
|
+
"DialogContentText",
|
|
148
|
+
`dropped ${printAttrs(ctx, unsupported)}: DialogDescription has one text style`
|
|
149
|
+
)
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
ctx.move("Dialog")
|
|
153
|
+
ctx.move("DialogProps")
|
|
154
|
+
const dialogs = ctx.elements("Dialog").paths()
|
|
155
|
+
// The legacy body name is free now; an un-aliased one becomes the Zenith panel's binding.
|
|
156
|
+
const reuse =
|
|
157
|
+
ctx.names.DialogContent === "DialogContent" &&
|
|
158
|
+
dialogs.length > 0 &&
|
|
159
|
+
!bodyUsed
|
|
160
|
+
if (bodyUsed) ctx.keep("DialogContent")
|
|
161
|
+
else if (reuse) ctx.move("DialogContent")
|
|
162
|
+
else ctx.drop("DialogContent")
|
|
163
|
+
ctx.keep(
|
|
164
|
+
"DialogContentProps",
|
|
165
|
+
'MUI DialogContent is the dialog body, now a <div>: type it as React.ComponentProps<"div">'
|
|
166
|
+
)
|
|
167
|
+
if (dialogs.length) {
|
|
168
|
+
const panel = reuse ? "DialogContent" : ctx.ensureZenith("DialogContent")
|
|
169
|
+
for (const path of dialogs) migrateDialog(ctx, path, panel, partIds)
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function migrateBody(ctx: MigrateContext, path: ASTPath<JSXElement>): void {
|
|
174
|
+
ctx.jsx.rename(path.node, "div")
|
|
175
|
+
const unsupported = takeAttrs(ctx, path.node, ["dividers", "classes"])
|
|
176
|
+
const dropped = unsupported.length
|
|
177
|
+
? `dropped ${printAttrs(ctx, unsupported)}; `
|
|
178
|
+
: ""
|
|
179
|
+
// MUI's body was the scroll container (overflow-y: auto); Zenith's panel neither caps its
|
|
180
|
+
// height nor scrolls, so a long body runs off the screen.
|
|
181
|
+
ctx.todo(
|
|
182
|
+
path,
|
|
183
|
+
"DialogContent",
|
|
184
|
+
`${dropped}this <div> was MUI's scrolling dialog body: wrap it in ScrollArea or give it a max height and overflowY: "auto" via makeZenithStyles`
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function migrateDialog(
|
|
189
|
+
ctx: MigrateContext,
|
|
190
|
+
path: ASTPath<JSXElement>,
|
|
191
|
+
panel: string,
|
|
192
|
+
partIds: ReadonlySet<string>
|
|
193
|
+
): void {
|
|
194
|
+
const { j, jsx } = ctx
|
|
195
|
+
const el = path.node
|
|
196
|
+
const reported: string[] = []
|
|
197
|
+
const panelAttrs: JSXAttribute[] = []
|
|
198
|
+
|
|
199
|
+
const onClose = jsx.removeAttr(el, "onClose")
|
|
200
|
+
if (onClose) {
|
|
201
|
+
const handler = closeAsOpenChange(j, attrExpression(onClose))
|
|
202
|
+
if (handler) jsx.setAttr(el, "onOpenChange", handler)
|
|
203
|
+
else
|
|
204
|
+
reported.push(
|
|
205
|
+
`dropped ${printAttr(ctx, onClose)} (onOpenChange(open) has no event or reason: close when open is false; to block a reason, preventDefault() in DialogContent onPointerDownOutside / onEscapeKeyDown)`
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Without fullWidth MUI sized the paper to its content, up to maxWidth; a Zenith panel always
|
|
210
|
+
// fills its size, so those dialogs stop at Zenith's default lg (32rem) instead of growing to
|
|
211
|
+
// MUI's maximum.
|
|
212
|
+
const fullWidth = isTrue(ctx, jsx.attr(el, "fullWidth"))
|
|
213
|
+
const fit = (size: string) =>
|
|
214
|
+
fullWidth || ORDER.indexOf(size) <= ORDER.indexOf("lg") ? size : "lg"
|
|
215
|
+
const panelSize = (size: string) => {
|
|
216
|
+
if (fit(size) !== "lg") panelAttrs.push(sizeAttr(ctx, fit(size)))
|
|
217
|
+
}
|
|
218
|
+
const maxWidth = jsx.removeAttr(el, "maxWidth")
|
|
219
|
+
const width = maxWidth ? jsx.literal(maxWidth) : "sm"
|
|
220
|
+
const sizes = mapStringExpression(
|
|
221
|
+
j,
|
|
222
|
+
attrExpression(maxWidth),
|
|
223
|
+
(v) => (SIZES[v] ? fit(SIZES[v]) : undefined),
|
|
224
|
+
(v) => stringIn(ctx, v) as never
|
|
225
|
+
)
|
|
226
|
+
if (sizes)
|
|
227
|
+
panelAttrs.push(
|
|
228
|
+
j.jsxAttribute(j.jsxIdentifier("size"), j.jsxExpressionContainer(sizes))
|
|
229
|
+
)
|
|
230
|
+
else if (width === false) panelSize("full-width")
|
|
231
|
+
else if (typeof width === "string" && SIZES[width]) panelSize(SIZES[width])
|
|
232
|
+
else if (typeof width === "string" && TOO_WIDE[width]) {
|
|
233
|
+
panelSize("5xl")
|
|
234
|
+
reported.push(
|
|
235
|
+
fullWidth
|
|
236
|
+
? `${printAttr(ctx, maxWidth!)} → size="5xl" (MUI's ${TOO_WIDE[width]}; Zenith's widest fixed size is 64rem, else "full-width")`
|
|
237
|
+
: `${printAttr(ctx, maxWidth!)} → Zenith's default size lg (MUI fitted the content up to ${TOO_WIDE[width]}; pick a size up to 5xl or "full-width")`
|
|
238
|
+
)
|
|
239
|
+
} else if (maxWidth)
|
|
240
|
+
reported.push(
|
|
241
|
+
`dropped ${printAttr(ctx, maxWidth)} (DialogContent size: sm | md | lg | xl | 2xl … 5xl | full-width)`
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
for (const [name, handler] of [
|
|
245
|
+
["disableBackdropClick", "onPointerDownOutside"],
|
|
246
|
+
["disableEscapeKeyDown", "onEscapeKeyDown"],
|
|
247
|
+
] as const) {
|
|
248
|
+
const flag = jsx.removeAttr(el, name)
|
|
249
|
+
if (!flag) continue
|
|
250
|
+
if (isTrue(ctx, flag))
|
|
251
|
+
panelAttrs.push(
|
|
252
|
+
j.jsxAttribute(
|
|
253
|
+
j.jsxIdentifier(handler),
|
|
254
|
+
j.jsxExpressionContainer(
|
|
255
|
+
parseExpression(j, "(event) => event.preventDefault()") as never
|
|
256
|
+
)
|
|
257
|
+
)
|
|
258
|
+
)
|
|
259
|
+
else
|
|
260
|
+
reported.push(
|
|
261
|
+
`dropped ${printAttr(ctx, flag)} (DialogContent ${handler}={(event) => event.preventDefault()} when it is set)`
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
takeAttrs(ctx, el, SILENT_ROOT)
|
|
266
|
+
// aria-labelledby / aria-describedby at the title or description Radix already links: dropped.
|
|
267
|
+
// Pointing anywhere else, they move to the panel, where they override Radix's link.
|
|
268
|
+
for (const name of ["aria-labelledby", "aria-describedby"]) {
|
|
269
|
+
const a = jsx.attr(el, name)
|
|
270
|
+
if (!a) continue
|
|
271
|
+
const value = jsx.literal(a)
|
|
272
|
+
jsx.removeAttr(el, name)
|
|
273
|
+
if (typeof value === "string" && partIds.has(value)) continue
|
|
274
|
+
panelAttrs.push(a)
|
|
275
|
+
reported.push(
|
|
276
|
+
`${printAttr(ctx, a)} moved to DialogContent, where it replaces Radix's link to the ${name === "aria-labelledby" ? "DialogTitle" : "DialogDescription"}; drop it if that part already says it`
|
|
277
|
+
)
|
|
278
|
+
}
|
|
279
|
+
const moved = takeAttrs(
|
|
280
|
+
ctx,
|
|
281
|
+
el,
|
|
282
|
+
jsx
|
|
283
|
+
.attrs(el)
|
|
284
|
+
.map((a) => jsx.attrName(a))
|
|
285
|
+
.filter(TO_PANEL)
|
|
286
|
+
)
|
|
287
|
+
panelAttrs.unshift(...moved)
|
|
288
|
+
if (moved.some((a) => ["className", "style"].includes(jsx.attrName(a))))
|
|
289
|
+
reported.push(
|
|
290
|
+
"className/style moved from MUI's backdrop container to the panel; check selectors that reached into .MuiPaper-root"
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
const unsupported = takeAttrs(
|
|
294
|
+
ctx,
|
|
295
|
+
el,
|
|
296
|
+
jsx
|
|
297
|
+
.attrs(el)
|
|
298
|
+
.map((a) => jsx.attrName(a))
|
|
299
|
+
.filter((n) => !["open", "onOpenChange", "key"].includes(n))
|
|
300
|
+
)
|
|
301
|
+
if (unsupported.length)
|
|
302
|
+
reported.push(
|
|
303
|
+
`dropped ${printAttrs(ctx, unsupported)} (no Zenith equivalent)`
|
|
304
|
+
)
|
|
305
|
+
if (jsx.hasSpread(el))
|
|
306
|
+
reported.push(
|
|
307
|
+
"spread props are MUI DialogProps: keep open/onOpenChange here, move the rest to DialogContent"
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
// MUI dialogs have no built-in close button; Zenith's panel shows one unless told not to.
|
|
311
|
+
panelAttrs.push(
|
|
312
|
+
j.jsxAttribute(
|
|
313
|
+
j.jsxIdentifier("showCloseButton"),
|
|
314
|
+
j.jsxExpressionContainer(j.booleanLiteral(false))
|
|
315
|
+
)
|
|
316
|
+
)
|
|
317
|
+
nestChildren(j, el, panel, panelAttrs)
|
|
318
|
+
if (reported.length) ctx.todo(path, "Dialog", reported.join("; "))
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function sizeAttr(ctx: MigrateContext, size: string): JSXAttribute {
|
|
322
|
+
return ctx.j.jsxAttribute(ctx.j.jsxIdentifier("size"), ctx.jsx.str(size))
|
|
323
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Divider → Separator. `orientation` is the same; the MUI layout variants have no equivalent and
|
|
3
|
+
* are reported with the makeZenithStyles replacement. A text child stays (Separator renders a
|
|
4
|
+
* div) but is reported: Zenith draws no label through the line.
|
|
5
|
+
*/
|
|
6
|
+
import type { MigrateContext } from "../lib/types"
|
|
7
|
+
import { dropWithHint } from "./mui-props"
|
|
8
|
+
|
|
9
|
+
export const handles = ["Divider", "DividerProps"] as const
|
|
10
|
+
|
|
11
|
+
export function migrate(ctx: MigrateContext): void {
|
|
12
|
+
const { jsx } = ctx
|
|
13
|
+
const elements = ctx.elements("Divider")
|
|
14
|
+
ctx.moveElements("Divider", "Separator")
|
|
15
|
+
ctx.move("DividerProps", "SeparatorProps")
|
|
16
|
+
|
|
17
|
+
elements.forEach((path) => {
|
|
18
|
+
const el = path.node
|
|
19
|
+
jsx.removeAttr(el, "light")
|
|
20
|
+
jsx.removeAttr(el, "textAlign")
|
|
21
|
+
|
|
22
|
+
const variant = jsx.mapAttrValue(el, "variant", { fullWidth: null })
|
|
23
|
+
if (variant === "unknown" || variant === "dynamic") {
|
|
24
|
+
const printed = jsx.print(jsx.attr(el, "variant")!)
|
|
25
|
+
jsx.removeAttr(el, "variant")
|
|
26
|
+
ctx.todo(
|
|
27
|
+
path,
|
|
28
|
+
"Divider",
|
|
29
|
+
`dropped ${printed}: inset/middle margins go on the Separator via makeZenithStyles (marginLeft: tokens.spacingGroup4)`
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
for (const [name, hint] of [
|
|
34
|
+
[
|
|
35
|
+
"flexItem",
|
|
36
|
+
'give the vertical Separator alignSelf: "stretch" and height: "auto" via makeZenithStyles',
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
"absolute",
|
|
40
|
+
'position the Separator via makeZenithStyles (position: "absolute", bottom: 0, left: 0, width: "100%")',
|
|
41
|
+
],
|
|
42
|
+
] as const) {
|
|
43
|
+
const attr = jsx.attr(el, name)
|
|
44
|
+
if (!attr) continue
|
|
45
|
+
jsx.removeAttr(el, name)
|
|
46
|
+
ctx.todo(path, "Divider", `dropped ${jsx.print(attr)}: ${hint}`)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
dropWithHint(ctx, path, "Divider")
|
|
50
|
+
|
|
51
|
+
const hasText = (el.children ?? []).some(
|
|
52
|
+
(c) => c.type !== "JSXText" || c.value.trim() !== ""
|
|
53
|
+
)
|
|
54
|
+
if (hasText)
|
|
55
|
+
ctx.todo(
|
|
56
|
+
path,
|
|
57
|
+
"Divider",
|
|
58
|
+
"Separator draws no label: move the children next to it (Text between two Separators in a flex row)"
|
|
59
|
+
)
|
|
60
|
+
})
|
|
61
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FeedbackMessage → Callout.
|
|
3
|
+
*
|
|
4
|
+
* - `stateVariant` (a string or `FeedbackMessageStateVariant.x`; default warning) → `variant`:
|
|
5
|
+
* error → destructive, and info, which base-elements drew in the neutral palette, → gray.
|
|
6
|
+
* - `feedbackMessage` → `CalloutDescription`.
|
|
7
|
+
* - `actionIcon` + `onActionButtonClick` (an icon button) are reported: put a ghost icon Button
|
|
8
|
+
* in a `CalloutAction`.
|
|
9
|
+
* - `FeedbackMessageStateVariant` is dropped once no reference to it is left.
|
|
10
|
+
*/
|
|
11
|
+
import type { ASTPath, JSXElement } from "jscodeshift"
|
|
12
|
+
import type { MigrateContext } from "../lib/types"
|
|
13
|
+
import {
|
|
14
|
+
attrExpression,
|
|
15
|
+
fillCallout,
|
|
16
|
+
moveElements,
|
|
17
|
+
printAttrs,
|
|
18
|
+
takeAttrs,
|
|
19
|
+
} from "./shared"
|
|
20
|
+
|
|
21
|
+
export const handles = [
|
|
22
|
+
"FeedbackMessage",
|
|
23
|
+
"FeedbackMessageProps",
|
|
24
|
+
"FeedbackMessageStateVariant",
|
|
25
|
+
] as const
|
|
26
|
+
|
|
27
|
+
const STATES: Record<string, string> = {
|
|
28
|
+
success: "success",
|
|
29
|
+
warning: "warning",
|
|
30
|
+
error: "destructive",
|
|
31
|
+
info: "gray",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function migrate(ctx: MigrateContext): void {
|
|
35
|
+
const { j } = ctx
|
|
36
|
+
moveElements(ctx, "FeedbackMessage", "Callout", (path) =>
|
|
37
|
+
migrateFeedback(ctx, path)
|
|
38
|
+
)
|
|
39
|
+
ctx.move("FeedbackMessageProps", "CalloutProps")
|
|
40
|
+
|
|
41
|
+
const enumLocal = ctx.names.FeedbackMessageStateVariant
|
|
42
|
+
if (!enumLocal) return
|
|
43
|
+
const used = ctx.root
|
|
44
|
+
.find(j.Identifier, { name: enumLocal })
|
|
45
|
+
.filter((p) => p.parent.node.type !== "ImportSpecifier")
|
|
46
|
+
.size()
|
|
47
|
+
if (used)
|
|
48
|
+
ctx.keep(
|
|
49
|
+
"FeedbackMessageStateVariant",
|
|
50
|
+
'use the Callout variant strings: "success" | "warning" | "destructive" | "gray"'
|
|
51
|
+
)
|
|
52
|
+
else ctx.drop("FeedbackMessageStateVariant")
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function migrateFeedback(ctx: MigrateContext, path: ASTPath<JSXElement>): void {
|
|
56
|
+
const { jsx } = ctx
|
|
57
|
+
const el = path.node
|
|
58
|
+
const reported: string[] = []
|
|
59
|
+
|
|
60
|
+
const state = jsx.removeAttr(el, "stateVariant")
|
|
61
|
+
let expression = attrExpression(state)
|
|
62
|
+
while (expression?.type === "TSAsExpression")
|
|
63
|
+
expression = expression.expression as typeof expression
|
|
64
|
+
const literal = !state
|
|
65
|
+
? "warning"
|
|
66
|
+
: expression?.type === "StringLiteral"
|
|
67
|
+
? expression.value
|
|
68
|
+
: jsx.literal(state)
|
|
69
|
+
const member =
|
|
70
|
+
expression?.type === "MemberExpression" &&
|
|
71
|
+
!expression.computed &&
|
|
72
|
+
expression.property.type === "Identifier"
|
|
73
|
+
? expression.property.name
|
|
74
|
+
: undefined
|
|
75
|
+
const key = typeof literal === "string" ? literal : member
|
|
76
|
+
if (key && STATES[key]) jsx.setAttr(el, "variant", STATES[key])
|
|
77
|
+
else
|
|
78
|
+
reported.push(
|
|
79
|
+
`dropped ${printAttrs(ctx, [state!])} (variant: success | warning | destructive | gray)`
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
const action = takeAttrs(ctx, el, ["actionIcon", "onActionButtonClick"])
|
|
83
|
+
if (action.length)
|
|
84
|
+
reported.push(
|
|
85
|
+
`dropped ${printAttrs(ctx, action)} (put a ghost icon Button with that onClick in a CalloutAction)`
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
const message = jsx.removeAttr(el, "feedbackMessage")
|
|
89
|
+
reported.push(
|
|
90
|
+
...fillCallout(ctx, el, {
|
|
91
|
+
description: message ? [jsx.childFromValue(message)] : [],
|
|
92
|
+
})
|
|
93
|
+
)
|
|
94
|
+
if (reported.length) ctx.todo(path, "FeedbackMessage", reported.join("; "))
|
|
95
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IconButton, ElevatedIconButton, TooltipIconButton → Button with an icon size.
|
|
3
|
+
*
|
|
4
|
+
* - `size`: small → icon-xs (base-elements' small is 24px), medium (default) → icon, large →
|
|
5
|
+
* icon-lg.
|
|
6
|
+
* - base-elements' IconButton is transparent by default, filled for `color="primary"` and
|
|
7
|
+
* outlined for `color="secondary"`: ghost, primary, secondary.
|
|
8
|
+
* - ElevatedIconButton (a Paper inside a ButtonBase) → a secondary icon Button; its square or
|
|
9
|
+
* rounded `variant` → `shape="normal"`, the default circle keeps Button's rounded shape.
|
|
10
|
+
* - TooltipIconButton → Tooltip + TooltipTrigger asChild + the Button + TooltipContent, with the
|
|
11
|
+
* title as the button's aria-label too.
|
|
12
|
+
* - An icon-only button needs an accessible name: one without aria-label, aria-labelledby or
|
|
13
|
+
* title is reported.
|
|
14
|
+
*/
|
|
15
|
+
import type { ASTPath, JSXAttribute, JSXElement } from "jscodeshift"
|
|
16
|
+
import type { MigrateContext } from "../lib/types"
|
|
17
|
+
import {
|
|
18
|
+
element,
|
|
19
|
+
mapAttr,
|
|
20
|
+
printAttr,
|
|
21
|
+
printAttrs,
|
|
22
|
+
renamedAttr,
|
|
23
|
+
setChildren,
|
|
24
|
+
takeAttrs,
|
|
25
|
+
moveElements,
|
|
26
|
+
defaultButtonType,
|
|
27
|
+
} from "./shared"
|
|
28
|
+
|
|
29
|
+
export const handles = [
|
|
30
|
+
"IconButton",
|
|
31
|
+
"IconButtonProps",
|
|
32
|
+
"ElevatedIconButton",
|
|
33
|
+
"ElevatedIconButtonProps",
|
|
34
|
+
"TooltipIconButton",
|
|
35
|
+
] as const
|
|
36
|
+
|
|
37
|
+
const SIZES = { small: "icon-xs", medium: "icon", large: "icon-lg" }
|
|
38
|
+
const COLORS = {
|
|
39
|
+
default: "ghost",
|
|
40
|
+
inherit: "ghost",
|
|
41
|
+
primary: "primary",
|
|
42
|
+
secondary: "secondary",
|
|
43
|
+
}
|
|
44
|
+
const SILENT = ["disableRipple", "disableFocusRipple", "elevation", "square"]
|
|
45
|
+
const UNSUPPORTED = [
|
|
46
|
+
"edge",
|
|
47
|
+
"classes",
|
|
48
|
+
"component",
|
|
49
|
+
"href",
|
|
50
|
+
"buttonRef",
|
|
51
|
+
"TouchRippleProps",
|
|
52
|
+
]
|
|
53
|
+
const NAMED = ["aria-label", "aria-labelledby", "title"]
|
|
54
|
+
|
|
55
|
+
export function migrate(ctx: MigrateContext): void {
|
|
56
|
+
moveElements(ctx, "IconButton", "Button", (path) =>
|
|
57
|
+
migrateIconButton(ctx, path, "IconButton")
|
|
58
|
+
)
|
|
59
|
+
ctx.move("IconButtonProps", "ButtonProps")
|
|
60
|
+
|
|
61
|
+
moveElements(ctx, "ElevatedIconButton", "Button", (path) =>
|
|
62
|
+
migrateIconButton(ctx, path, "ElevatedIconButton")
|
|
63
|
+
)
|
|
64
|
+
ctx.keep(
|
|
65
|
+
"ElevatedIconButtonProps",
|
|
66
|
+
'type it as ButtonProps (an elevated icon button is <Button size="icon" variant="secondary">)'
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
let first = true
|
|
70
|
+
moveElements(ctx, "TooltipIconButton", "Tooltip", (path) => {
|
|
71
|
+
migrateTooltipIconButton(ctx, path, first && !ctx.names.Tooltip)
|
|
72
|
+
first = false
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function migrateIconButton(
|
|
77
|
+
ctx: MigrateContext,
|
|
78
|
+
path: ASTPath<JSXElement>,
|
|
79
|
+
component: "IconButton" | "ElevatedIconButton"
|
|
80
|
+
): void {
|
|
81
|
+
const { jsx } = ctx
|
|
82
|
+
const el = path.node
|
|
83
|
+
const reported: string[] = []
|
|
84
|
+
|
|
85
|
+
if (!jsx.attr(el, "size")) jsx.setAttr(el, "size", "icon")
|
|
86
|
+
else if (!mapAttr(ctx, el, "size", SIZES))
|
|
87
|
+
reported.push(
|
|
88
|
+
`dropped ${printAttrs(ctx, takeAttrs(ctx, el, ["size"]))} (small → icon-xs, medium → icon, large → icon-lg)`
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
if (component === "ElevatedIconButton") {
|
|
92
|
+
const variant = jsx.removeAttr(el, "variant")
|
|
93
|
+
const shape = jsx.literal(variant)
|
|
94
|
+
if (shape === "rounded" || shape === "square")
|
|
95
|
+
jsx.setAttr(el, "shape", "normal")
|
|
96
|
+
else if (variant && shape !== "circle")
|
|
97
|
+
reported.push(
|
|
98
|
+
`dropped ${printAttr(ctx, variant)} (shape: "normal" | "rounded")`
|
|
99
|
+
)
|
|
100
|
+
jsx.setAttr(el, "variant", "secondary")
|
|
101
|
+
} else {
|
|
102
|
+
const color = jsx.attr(el, "color")
|
|
103
|
+
if (!color) jsx.setAttr(el, "variant", "ghost")
|
|
104
|
+
else if (
|
|
105
|
+
!mapAttr(ctx, el, "color", COLORS, {
|
|
106
|
+
rename: "variant",
|
|
107
|
+
fallback: "primary",
|
|
108
|
+
})
|
|
109
|
+
) {
|
|
110
|
+
jsx.removeAttr(el, "color")
|
|
111
|
+
jsx.setAttr(el, "variant", "ghost")
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
takeAttrs(ctx, el, SILENT)
|
|
116
|
+
const unsupported = takeAttrs(ctx, el, UNSUPPORTED)
|
|
117
|
+
if (unsupported.length)
|
|
118
|
+
reported.push(
|
|
119
|
+
`dropped ${printAttrs(ctx, unsupported)} (no Zenith equivalent)`
|
|
120
|
+
)
|
|
121
|
+
if (!NAMED.some((n) => jsx.attr(el, n)) && !jsx.hasSpread(el))
|
|
122
|
+
reported.push(
|
|
123
|
+
"add an aria-label: an icon-only Button has no accessible name otherwise"
|
|
124
|
+
)
|
|
125
|
+
defaultButtonType(ctx, el)
|
|
126
|
+
if (reported.length) ctx.todo(path, component, reported.join("; "))
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function migrateTooltipIconButton(
|
|
130
|
+
ctx: MigrateContext,
|
|
131
|
+
path: ASTPath<JSXElement>,
|
|
132
|
+
remindProvider: boolean
|
|
133
|
+
): void {
|
|
134
|
+
const { j, jsx } = ctx
|
|
135
|
+
const el = path.node
|
|
136
|
+
const reported: string[] = []
|
|
137
|
+
|
|
138
|
+
const title = jsx.attr(el, "title")
|
|
139
|
+
const icon = jsx.attr(el, "Icon")
|
|
140
|
+
const button: JSXAttribute[] = [
|
|
141
|
+
j.jsxAttribute(j.jsxIdentifier("type"), jsx.str("button")),
|
|
142
|
+
]
|
|
143
|
+
if (title) button.push(renamedAttr(j, title, "aria-label"))
|
|
144
|
+
for (const name of ["disabled", "onClick"]) {
|
|
145
|
+
const a = jsx.attr(el, name)
|
|
146
|
+
if (a) button.push(a)
|
|
147
|
+
}
|
|
148
|
+
const size = jsx.attr(el, "size")
|
|
149
|
+
const sizeValue = size ? jsx.literal(size) : "small"
|
|
150
|
+
if (typeof sizeValue === "string" && sizeValue in SIZES)
|
|
151
|
+
button.push(
|
|
152
|
+
j.jsxAttribute(
|
|
153
|
+
j.jsxIdentifier("size"),
|
|
154
|
+
jsx.str(SIZES[sizeValue as keyof typeof SIZES])
|
|
155
|
+
)
|
|
156
|
+
)
|
|
157
|
+
else {
|
|
158
|
+
button.push(j.jsxAttribute(j.jsxIdentifier("size"), jsx.str("icon-xs")))
|
|
159
|
+
reported.push(
|
|
160
|
+
`dropped ${printAttr(ctx, size!)} (small → icon-xs, medium → icon)`
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
button.push(j.jsxAttribute(j.jsxIdentifier("variant"), jsx.str("ghost")))
|
|
164
|
+
const onClose = jsx.attr(el, "onClose")
|
|
165
|
+
if (onClose)
|
|
166
|
+
reported.push(
|
|
167
|
+
`dropped ${printAttr(ctx, onClose)} (Tooltip onOpenChange(open) runs on every change: act when open is false)`
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
const buttonEl = element(
|
|
171
|
+
j,
|
|
172
|
+
ctx.ensureZenith("Button"),
|
|
173
|
+
button,
|
|
174
|
+
icon ? [jsx.childFromValue(icon)] : []
|
|
175
|
+
)
|
|
176
|
+
const trigger = element(
|
|
177
|
+
j,
|
|
178
|
+
ctx.ensureZenith("TooltipTrigger"),
|
|
179
|
+
[j.jsxAttribute(j.jsxIdentifier("asChild"))],
|
|
180
|
+
[j.jsxText("\n"), buttonEl, j.jsxText("\n")]
|
|
181
|
+
)
|
|
182
|
+
const content = element(
|
|
183
|
+
j,
|
|
184
|
+
ctx.ensureZenith("TooltipContent"),
|
|
185
|
+
[j.jsxAttribute(j.jsxIdentifier("side"), jsx.str("top"))],
|
|
186
|
+
title ? [jsx.childFromValue(title)] : []
|
|
187
|
+
)
|
|
188
|
+
el.openingElement.attributes = (el.openingElement.attributes ?? []).filter(
|
|
189
|
+
(a) => a.type === "JSXAttribute" && jsx.attrName(a) === "key"
|
|
190
|
+
)
|
|
191
|
+
setChildren(j, el, [
|
|
192
|
+
j.jsxText("\n"),
|
|
193
|
+
trigger,
|
|
194
|
+
j.jsxText("\n"),
|
|
195
|
+
content,
|
|
196
|
+
j.jsxText("\n"),
|
|
197
|
+
])
|
|
198
|
+
if (remindProvider)
|
|
199
|
+
reported.push(
|
|
200
|
+
"Zenith's Tooltip throws without a TooltipProvider above it: add one once at the app root if there is none"
|
|
201
|
+
)
|
|
202
|
+
if (reported.length) ctx.todo(path, "TooltipIconButton", reported.join("; "))
|
|
203
|
+
}
|