@epilot/zenith-react 0.2.0-next.1 → 0.2.0-next.4
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 +25 -0
- package/codemods/README.md +168 -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 +20 -0
- package/codemods/migrate/from-volt.ts +20 -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 +389 -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/data-table/data-table-header.js +113 -99
- package/dist/components/data-table/data-table-header.js.map +1 -1
- package/dist/components/data-table/data-table-row.js +49 -40
- package/dist/components/data-table/data-table-row.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 +260 -322
- 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 +87 -77
- package/dist/components/field/field-combobox.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 +83 -53
- 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 +2335 -2129
- 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 +34 -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 +18 -10
- package/scripts/migration-diagnostics.mjs +31 -8
- 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,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button → Button.
|
|
3
|
+
*
|
|
4
|
+
* - `variant` × `color` → Zenith `variant`: contained → primary (Zenith's default, omitted),
|
|
5
|
+
* outlined → secondary, text (MUI's default) → tertiary for an accent `color`, ghost for
|
|
6
|
+
* `default`/`inherit`/none. `color` is theming and dropped.
|
|
7
|
+
* - `size`: small → sm, medium → base (omitted), large → lg.
|
|
8
|
+
* - `startIcon`/`endIcon` → first/last child; Zenith sizes and spaces child icons itself.
|
|
9
|
+
* - `href` or `component` → `asChild` around an `<a>` (or the component), which takes the
|
|
10
|
+
* link props (`href`, `to`, `target`, …).
|
|
11
|
+
* - `fullWidth` → `style={{ width: "100%" }}`.
|
|
12
|
+
* - Ripple and elevation switches are dropped; other MUI-only props are dropped and reported.
|
|
13
|
+
*/
|
|
14
|
+
import type { ASTPath, JSXElement } from "jscodeshift"
|
|
15
|
+
import type { MigrateContext } from "../lib/types"
|
|
16
|
+
import {
|
|
17
|
+
attrExpression,
|
|
18
|
+
nestChildren,
|
|
19
|
+
insertChild,
|
|
20
|
+
isTrue,
|
|
21
|
+
mapAttr,
|
|
22
|
+
parseExpression,
|
|
23
|
+
printAttrs,
|
|
24
|
+
source,
|
|
25
|
+
stringIn,
|
|
26
|
+
takeAttrs,
|
|
27
|
+
printAttr,
|
|
28
|
+
moveElements,
|
|
29
|
+
defaultButtonType,
|
|
30
|
+
} from "./shared"
|
|
31
|
+
|
|
32
|
+
export const handles = ["Button", "ButtonProps"] as const
|
|
33
|
+
|
|
34
|
+
const LINK_PROPS = [
|
|
35
|
+
"href",
|
|
36
|
+
"to",
|
|
37
|
+
"target",
|
|
38
|
+
"rel",
|
|
39
|
+
"download",
|
|
40
|
+
"replace",
|
|
41
|
+
"state",
|
|
42
|
+
"hrefLang",
|
|
43
|
+
"referrerPolicy",
|
|
44
|
+
]
|
|
45
|
+
const SILENT = [
|
|
46
|
+
"color",
|
|
47
|
+
"disableElevation",
|
|
48
|
+
"disableRipple",
|
|
49
|
+
"disableFocusRipple",
|
|
50
|
+
"disableTouchRipple",
|
|
51
|
+
"focusRipple",
|
|
52
|
+
"centerRipple",
|
|
53
|
+
]
|
|
54
|
+
const UNSUPPORTED = [
|
|
55
|
+
"classes",
|
|
56
|
+
"TouchRippleProps",
|
|
57
|
+
"buttonRef",
|
|
58
|
+
"action",
|
|
59
|
+
"focusVisibleClassName",
|
|
60
|
+
"onFocusVisible",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
export function migrate(ctx: MigrateContext): void {
|
|
64
|
+
moveElements(ctx, "Button", "Button", (path) => migrateButton(ctx, path))
|
|
65
|
+
ctx.move("ButtonProps")
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function migrateButton(ctx: MigrateContext, path: ASTPath<JSXElement>): void {
|
|
69
|
+
const { j, jsx } = ctx
|
|
70
|
+
const el = path.node
|
|
71
|
+
const color = jsx.literal(jsx.attr(el, "color"))
|
|
72
|
+
const accent = color === "primary" || color === "secondary"
|
|
73
|
+
const text = accent ? "tertiary" : "ghost"
|
|
74
|
+
const reported: string[] = []
|
|
75
|
+
|
|
76
|
+
if (!jsx.attr(el, "variant")) jsx.setAttr(el, "variant", text)
|
|
77
|
+
else if (
|
|
78
|
+
!mapAttr(
|
|
79
|
+
ctx,
|
|
80
|
+
el,
|
|
81
|
+
"variant",
|
|
82
|
+
{ contained: "primary", outlined: "secondary", text },
|
|
83
|
+
{ fallback: "primary" }
|
|
84
|
+
)
|
|
85
|
+
) {
|
|
86
|
+
reported.push(
|
|
87
|
+
`${printAttrs(ctx, takeAttrs(ctx, el, ["variant"]))} (contained → primary, outlined → secondary, text → ${text})`
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
if (
|
|
91
|
+
!mapAttr(
|
|
92
|
+
ctx,
|
|
93
|
+
el,
|
|
94
|
+
"size",
|
|
95
|
+
{ small: "sm", medium: "base", large: "lg" },
|
|
96
|
+
{ fallback: "base" }
|
|
97
|
+
)
|
|
98
|
+
)
|
|
99
|
+
reported.push(
|
|
100
|
+
`${printAttrs(ctx, takeAttrs(ctx, el, ["size"]))} (small → sm, medium → base, large → lg)`
|
|
101
|
+
)
|
|
102
|
+
takeAttrs(ctx, el, SILENT)
|
|
103
|
+
|
|
104
|
+
for (const [name, at] of [
|
|
105
|
+
["startIcon", "start"],
|
|
106
|
+
["endIcon", "end"],
|
|
107
|
+
] as const) {
|
|
108
|
+
const icon = jsx.removeAttr(el, name)
|
|
109
|
+
if (icon) insertChild(j, el, jsx.childFromValue(icon), at)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const fullWidth = jsx.removeAttr(el, "fullWidth")
|
|
113
|
+
if (fullWidth) {
|
|
114
|
+
const hundred = stringIn(ctx, "100%")
|
|
115
|
+
if (!isTrue(ctx, fullWidth))
|
|
116
|
+
reported.push(
|
|
117
|
+
`${printAttr(ctx, fullWidth)} (set width: 100% in your styles)`
|
|
118
|
+
)
|
|
119
|
+
else if (!jsx.attr(el, "style"))
|
|
120
|
+
jsx.setAttr(
|
|
121
|
+
el,
|
|
122
|
+
"style",
|
|
123
|
+
parseExpression(j, `{ width: ${source(j, hundred)} }`)
|
|
124
|
+
)
|
|
125
|
+
else {
|
|
126
|
+
const style = jsx.styleObject(el)
|
|
127
|
+
if (style) jsx.setObjectKey(style, "width", hundred)
|
|
128
|
+
else
|
|
129
|
+
reported.push(
|
|
130
|
+
`${printAttr(ctx, fullWidth)} (set width: 100% in your styles)`
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const component = jsx.attr(el, "component")
|
|
136
|
+
const link = jsx.attr(el, "href") ?? jsx.attr(el, "to")
|
|
137
|
+
if (component || link) {
|
|
138
|
+
const tag = component ? componentTag(ctx, component) : "a"
|
|
139
|
+
jsx.removeAttr(el, "component")
|
|
140
|
+
if (tag) {
|
|
141
|
+
const child = nestChildren(j, el, tag, takeAttrs(ctx, el, LINK_PROPS))
|
|
142
|
+
if (tag.includes(".")) {
|
|
143
|
+
child.openingElement.name = memberName(ctx, tag)
|
|
144
|
+
if (child.closingElement)
|
|
145
|
+
child.closingElement.name = memberName(ctx, tag)
|
|
146
|
+
}
|
|
147
|
+
jsx.setAttr(el, "asChild", null)
|
|
148
|
+
} else {
|
|
149
|
+
reported.push(
|
|
150
|
+
`${printAttr(ctx, component!)} (render the element inside <Button asChild>)`
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const unsupported = takeAttrs(ctx, el, UNSUPPORTED)
|
|
156
|
+
if (unsupported.length)
|
|
157
|
+
reported.push(`${printAttrs(ctx, unsupported)} (MUI-only)`)
|
|
158
|
+
defaultButtonType(ctx, el)
|
|
159
|
+
if (reported.length)
|
|
160
|
+
ctx.todo(path, "Button", `dropped ${reported.join("; ")}`)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** `component="span"` → `span`, `component={Link}` → `Link`, `{Nav.Link}` → `Nav.Link`. */
|
|
164
|
+
function componentTag(
|
|
165
|
+
ctx: MigrateContext,
|
|
166
|
+
a: NonNullable<ReturnType<MigrateContext["jsx"]["attr"]>>
|
|
167
|
+
): string | undefined {
|
|
168
|
+
const value = ctx.jsx.literal(a)
|
|
169
|
+
if (typeof value === "string") return value
|
|
170
|
+
const expression = attrExpression(a)
|
|
171
|
+
if (expression?.type === "Identifier") return expression.name
|
|
172
|
+
if (
|
|
173
|
+
expression?.type === "MemberExpression" &&
|
|
174
|
+
expression.object.type === "Identifier" &&
|
|
175
|
+
expression.property.type === "Identifier" &&
|
|
176
|
+
!expression.computed
|
|
177
|
+
)
|
|
178
|
+
return `${expression.object.name}.${expression.property.name}`
|
|
179
|
+
return undefined
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function memberName(ctx: MigrateContext, tag: string) {
|
|
183
|
+
const [object, property] = tag.split(".")
|
|
184
|
+
return ctx.j.jsxMemberExpression(
|
|
185
|
+
ctx.j.jsxIdentifier(object),
|
|
186
|
+
ctx.j.jsxIdentifier(property)
|
|
187
|
+
)
|
|
188
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkbox → Checkbox: `onChange(event, checked)` → `onCheckedChange(checked)` with reads of the
|
|
3
|
+
* value as `checked === true` (Radix passes `boolean | "indeterminate"`), `indeterminate` →
|
|
4
|
+
* `checked="indeterminate"`, base-elements' `label`/`labelPlacement` → a wrapping `<Label>`.
|
|
5
|
+
* See `migrateCheckedControl`.
|
|
6
|
+
*/
|
|
7
|
+
import type { MigrateContext } from "../lib/types"
|
|
8
|
+
import { migrateCheckedControl, moveElements } from "./shared"
|
|
9
|
+
|
|
10
|
+
export const handles = ["Checkbox", "CheckboxProps"] as const
|
|
11
|
+
|
|
12
|
+
export function migrate(ctx: MigrateContext): void {
|
|
13
|
+
ctx.move("CheckboxProps")
|
|
14
|
+
moveElements(ctx, "Checkbox", "Checkbox", (path) =>
|
|
15
|
+
migrateCheckedControl(ctx, path, "Checkbox", { tristate: true })
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chip → Pill. `label` becomes children, `onDelete` becomes `onRemove`, MUI's theme colours
|
|
3
|
+
* become Pill colour families and `outlined` the `surface` variant. Avatars, custom delete icons
|
|
4
|
+
* and random colours are reported.
|
|
5
|
+
*/
|
|
6
|
+
import type { MigrateContext } from "../lib/types"
|
|
7
|
+
import { dropWithHint } from "./mui-props"
|
|
8
|
+
|
|
9
|
+
export const handles = ["Chip", "ChipProps", "RandomColoredChip"] as const
|
|
10
|
+
|
|
11
|
+
export const PILL_COLORS =
|
|
12
|
+
"lime | green | teal | cyan | indigo | purple | pink | red | orange | yellow | bronze | gray | accent | warning | success | error"
|
|
13
|
+
|
|
14
|
+
export function migrate(ctx: MigrateContext): void {
|
|
15
|
+
const { jsx } = ctx
|
|
16
|
+
const elements = ctx.elements("Chip")
|
|
17
|
+
ctx.moveElements("Chip", "Pill")
|
|
18
|
+
ctx.move("ChipProps", "PillProps")
|
|
19
|
+
ctx.keep(
|
|
20
|
+
"RandomColoredChip",
|
|
21
|
+
`Pill with a color= you pick (${PILL_COLORS}); there is no random colour`
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
elements.forEach((path) => {
|
|
25
|
+
const el = path.node
|
|
26
|
+
const children: NonNullable<typeof el.children> = []
|
|
27
|
+
|
|
28
|
+
const icon = jsx.attr(el, "icon")
|
|
29
|
+
if (icon) {
|
|
30
|
+
children.push(jsx.childFromValue(icon))
|
|
31
|
+
jsx.removeAttr(el, "icon")
|
|
32
|
+
}
|
|
33
|
+
const label = jsx.attr(el, "label")
|
|
34
|
+
if (label) {
|
|
35
|
+
children.push(jsx.childFromValue(label))
|
|
36
|
+
jsx.removeAttr(el, "label")
|
|
37
|
+
}
|
|
38
|
+
if (children.length) jsx.setChildren(el, children)
|
|
39
|
+
|
|
40
|
+
jsx.renameAttr(el, "onDelete", "onRemove")
|
|
41
|
+
for (const name of ["size", "clickable"]) jsx.removeAttr(el, name)
|
|
42
|
+
|
|
43
|
+
const color = jsx.mapAttrValue(el, "color", {
|
|
44
|
+
primary: "accent",
|
|
45
|
+
secondary: "gray",
|
|
46
|
+
default: null,
|
|
47
|
+
})
|
|
48
|
+
if (color === "unknown" || color === "dynamic") {
|
|
49
|
+
const printed = jsx.print(jsx.attr(el, "color")!)
|
|
50
|
+
jsx.removeAttr(el, "color")
|
|
51
|
+
ctx.todo(
|
|
52
|
+
path,
|
|
53
|
+
"Chip",
|
|
54
|
+
`dropped ${printed}: Pill color is one of ${PILL_COLORS}`
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
const variant = jsx.mapAttrValue(el, "variant", {
|
|
58
|
+
outlined: "surface",
|
|
59
|
+
default: null,
|
|
60
|
+
})
|
|
61
|
+
if (variant === "unknown" || variant === "dynamic") {
|
|
62
|
+
const printed = jsx.print(jsx.attr(el, "variant")!)
|
|
63
|
+
jsx.removeAttr(el, "variant")
|
|
64
|
+
ctx.todo(
|
|
65
|
+
path,
|
|
66
|
+
"Chip",
|
|
67
|
+
`dropped ${printed}: Pill variant is "soft" | "solid" | "surface"`
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
for (const [name, hint] of [
|
|
72
|
+
["avatar", "put the Avatar as the first child of the Pill"],
|
|
73
|
+
["deleteIcon", "onRemove renders Pill's own close button"],
|
|
74
|
+
["randomColor", `pick a color= (${PILL_COLORS})`],
|
|
75
|
+
[
|
|
76
|
+
"href",
|
|
77
|
+
'Pill is a span; wrap it in an <a>, or use Button variant="ghost" for a link',
|
|
78
|
+
],
|
|
79
|
+
] as const) {
|
|
80
|
+
const attr = jsx.attr(el, name)
|
|
81
|
+
if (!attr) continue
|
|
82
|
+
jsx.removeAttr(el, name)
|
|
83
|
+
ctx.todo(path, "Chip", `dropped ${jsx.print(attr)}: ${hint}`)
|
|
84
|
+
}
|
|
85
|
+
dropWithHint(ctx, path, "Chip")
|
|
86
|
+
})
|
|
87
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chip360 → Pill. `label` becomes children, `isDisabled` → `disabled`, `variant` → `color`,
|
|
3
|
+
* `isFilled`/`isBordered` → `variant`, a close `rightIcon` with its handler → `onRemove`.
|
|
4
|
+
* Editable chips, left icons and custom colours are reported.
|
|
5
|
+
*/
|
|
6
|
+
import type { MigrateContext } from "../lib/types"
|
|
7
|
+
import { PILL_COLORS } from "./chip"
|
|
8
|
+
import { dropWithHint } from "./mui-props"
|
|
9
|
+
|
|
10
|
+
export const handles = ["Chip360", "Chip360Props"] as const
|
|
11
|
+
|
|
12
|
+
const COLOR_BY_VARIANT: Record<string, string | null> = {
|
|
13
|
+
primary: "accent",
|
|
14
|
+
secondary: "gray",
|
|
15
|
+
error: "error",
|
|
16
|
+
warning: "warning",
|
|
17
|
+
success: "success",
|
|
18
|
+
"surface-container-lowest": "gray",
|
|
19
|
+
"surface-container-low": "gray",
|
|
20
|
+
"surface-container": "gray",
|
|
21
|
+
"surface-container-high": "gray",
|
|
22
|
+
"surface-container-highest": "gray",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const CUSTOM_COLORS = [
|
|
26
|
+
"color",
|
|
27
|
+
"backgroundColor",
|
|
28
|
+
"borderColor",
|
|
29
|
+
"hoverBgColor",
|
|
30
|
+
"activeBgColor",
|
|
31
|
+
"filledHoverBgColor",
|
|
32
|
+
"filledActiveBgColor",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
export function migrate(ctx: MigrateContext): void {
|
|
36
|
+
const { jsx } = ctx
|
|
37
|
+
const elements = ctx.elements("Chip360")
|
|
38
|
+
ctx.moveElements("Chip360", "Pill")
|
|
39
|
+
ctx.move("Chip360Props", "PillProps")
|
|
40
|
+
|
|
41
|
+
elements.forEach((path) => {
|
|
42
|
+
const el = path.node
|
|
43
|
+
|
|
44
|
+
// Custom colours first: `color` on Chip360 is a CSS colour, on Pill a family.
|
|
45
|
+
const custom = CUSTOM_COLORS.map((n) => jsx.attr(el, n)).filter(
|
|
46
|
+
(a): a is NonNullable<typeof a> => !!a
|
|
47
|
+
)
|
|
48
|
+
if (custom.length) {
|
|
49
|
+
const printed = custom.map((a) => jsx.print(a)).join(" ")
|
|
50
|
+
for (const a of custom) jsx.removeAttr(el, jsx.attrName(a))
|
|
51
|
+
ctx.todo(
|
|
52
|
+
path,
|
|
53
|
+
"Chip360",
|
|
54
|
+
`dropped ${printed}: pick a Pill color= (${PILL_COLORS}); custom colours need makeZenithStyles`
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const label = jsx.attr(el, "label")
|
|
59
|
+
if (label) {
|
|
60
|
+
jsx.setChildren(el, [jsx.childFromValue(label)])
|
|
61
|
+
jsx.removeAttr(el, "label")
|
|
62
|
+
}
|
|
63
|
+
jsx.renameAttr(el, "isDisabled", "disabled")
|
|
64
|
+
for (const name of [
|
|
65
|
+
"isClickable",
|
|
66
|
+
"size",
|
|
67
|
+
"shouldRenderControlsOutsideForm",
|
|
68
|
+
])
|
|
69
|
+
jsx.removeAttr(el, name)
|
|
70
|
+
|
|
71
|
+
const variant = jsx.attr(el, "variant")
|
|
72
|
+
if (variant) {
|
|
73
|
+
const printed = jsx.print(variant)
|
|
74
|
+
const mapped = jsx.mapAttrValue(el, "variant", COLOR_BY_VARIANT)
|
|
75
|
+
if (mapped === "mapped") jsx.renameAttr(el, "variant", "color")
|
|
76
|
+
else {
|
|
77
|
+
jsx.removeAttr(el, "variant")
|
|
78
|
+
ctx.todo(
|
|
79
|
+
path,
|
|
80
|
+
"Chip360",
|
|
81
|
+
`dropped ${printed}: Pill color is one of ${PILL_COLORS}`
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const filled = jsx.attr(el, "isFilled")
|
|
87
|
+
const bordered = jsx.attr(el, "isBordered")
|
|
88
|
+
jsx.removeAttr(el, "isFilled")
|
|
89
|
+
jsx.removeAttr(el, "isBordered")
|
|
90
|
+
if (filled && jsx.literal(filled) !== false)
|
|
91
|
+
jsx.setAttr(el, "variant", "solid")
|
|
92
|
+
else if (bordered && jsx.literal(bordered) !== false)
|
|
93
|
+
jsx.setAttr(el, "variant", "surface")
|
|
94
|
+
else if (filled || bordered) {
|
|
95
|
+
ctx.todo(
|
|
96
|
+
path,
|
|
97
|
+
"Chip360",
|
|
98
|
+
`dropped ${[filled, bordered]
|
|
99
|
+
.filter(Boolean)
|
|
100
|
+
.map((a) => jsx.print(a!))
|
|
101
|
+
.join(" ")}: Pill variant is "soft" | "solid" | "surface"`
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const rightIcon = jsx.attr(el, "rightIcon")
|
|
106
|
+
const rightClick = jsx.attr(el, "onRightIconClick")
|
|
107
|
+
if (rightIcon) {
|
|
108
|
+
jsx.removeAttr(el, "rightIcon")
|
|
109
|
+
if (jsx.literal(rightIcon) === "close" && rightClick) {
|
|
110
|
+
jsx.renameAttr(el, "onRightIconClick", "onRemove")
|
|
111
|
+
} else {
|
|
112
|
+
if (rightClick) jsx.removeAttr(el, "onRightIconClick")
|
|
113
|
+
ctx.todo(
|
|
114
|
+
path,
|
|
115
|
+
"Chip360",
|
|
116
|
+
`dropped ${jsx.print(rightIcon)}${rightClick ? ` ${jsx.print(rightClick)}` : ""}: only a close icon maps (onRemove); render other icons as the last child`
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
} else if (rightClick) {
|
|
120
|
+
jsx.removeAttr(el, "onRightIconClick")
|
|
121
|
+
ctx.todo(
|
|
122
|
+
path,
|
|
123
|
+
"Chip360",
|
|
124
|
+
`dropped ${jsx.print(rightClick)}: no right icon to click; use onRemove or onClick`
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const leftIcon = jsx.attr(el, "leftIcon")
|
|
129
|
+
if (leftIcon) {
|
|
130
|
+
jsx.removeAttr(el, "leftIcon")
|
|
131
|
+
ctx.todo(
|
|
132
|
+
path,
|
|
133
|
+
"Chip360",
|
|
134
|
+
`dropped ${jsx.print(leftIcon)}: render the icon (1rem) as the first child of the Pill`
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const editable = ["isEditable", "onLabelChange"]
|
|
139
|
+
.map((n) => jsx.attr(el, n))
|
|
140
|
+
.filter((a): a is NonNullable<typeof a> => !!a)
|
|
141
|
+
if (editable.length) {
|
|
142
|
+
for (const a of editable) jsx.removeAttr(el, jsx.attrName(a))
|
|
143
|
+
ctx.todo(
|
|
144
|
+
path,
|
|
145
|
+
"Chip360",
|
|
146
|
+
`dropped ${editable.map((a) => jsx.print(a)).join(" ")}: no editable Pill; swap to a FieldInput on click`
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
for (const [name, hint] of [
|
|
151
|
+
["href", "Pill is a span; wrap it in an <a>"],
|
|
152
|
+
["target", "goes on the wrapping <a>"],
|
|
153
|
+
["rel", "goes on the wrapping <a>"],
|
|
154
|
+
] as const) {
|
|
155
|
+
const attr = jsx.attr(el, name)
|
|
156
|
+
if (!attr) continue
|
|
157
|
+
jsx.removeAttr(el, name)
|
|
158
|
+
ctx.todo(path, "Chip360", `dropped ${jsx.print(attr)}: ${hint}`)
|
|
159
|
+
}
|
|
160
|
+
dropWithHint(ctx, path, "Chip360")
|
|
161
|
+
})
|
|
162
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CircularProgress → Spinner.
|
|
3
|
+
*
|
|
4
|
+
* - `size={n}` (MUI: px, default 40) → the nearest Spinner size (sm 16, base 24, lg 40, xl 64,
|
|
5
|
+
* 2xl 96); no size means MUI's 40px, so it becomes `size="lg"` (Spinner's default is 24px);
|
|
6
|
+
* a non-numeric size is dropped and reported.
|
|
7
|
+
* - `color`, `thickness`, `disableShrink` are MUI theming and are dropped: Spinner draws in
|
|
8
|
+
* `currentColor`.
|
|
9
|
+
* - `variant="determinate"|"static"` and `value` have no equivalent (Spinner is indeterminate):
|
|
10
|
+
* dropped and reported.
|
|
11
|
+
*/
|
|
12
|
+
import type { MigrateContext } from "../lib/types"
|
|
13
|
+
|
|
14
|
+
export const handles = ["CircularProgress", "CircularProgressProps"] as const
|
|
15
|
+
|
|
16
|
+
const SIZES: [number, string][] = [
|
|
17
|
+
[16, "sm"],
|
|
18
|
+
[24, "base"],
|
|
19
|
+
[40, "lg"],
|
|
20
|
+
[64, "xl"],
|
|
21
|
+
[96, "2xl"],
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
function nearestSize(px: number): string {
|
|
25
|
+
let best = SIZES[0]
|
|
26
|
+
for (const candidate of SIZES)
|
|
27
|
+
if (Math.abs(candidate[0] - px) < Math.abs(best[0] - px)) best = candidate
|
|
28
|
+
return best[1]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function migrate(ctx: MigrateContext): void {
|
|
32
|
+
const { jsx } = ctx
|
|
33
|
+
const elements = ctx.elements("CircularProgress")
|
|
34
|
+
ctx.moveElements("CircularProgress", "Spinner")
|
|
35
|
+
ctx.move("CircularProgressProps", "SpinnerProps")
|
|
36
|
+
|
|
37
|
+
elements.forEach((path) => {
|
|
38
|
+
const el = path.node
|
|
39
|
+
for (const name of ["color", "thickness", "disableShrink"])
|
|
40
|
+
jsx.removeAttr(el, name)
|
|
41
|
+
|
|
42
|
+
const size = jsx.attr(el, "size")
|
|
43
|
+
if (!size) {
|
|
44
|
+
jsx.setAttr(el, "size", "lg")
|
|
45
|
+
} else {
|
|
46
|
+
const value = jsx.literal(size)
|
|
47
|
+
if (typeof value === "number") {
|
|
48
|
+
jsx.setAttr(el, "size", nearestSize(value))
|
|
49
|
+
} else {
|
|
50
|
+
const printed = jsx.print(size)
|
|
51
|
+
jsx.removeAttr(el, "size")
|
|
52
|
+
ctx.todo(
|
|
53
|
+
path,
|
|
54
|
+
"CircularProgress",
|
|
55
|
+
`dropped ${printed}: Spinner size is "sm" | "base" | "lg" | "xl" | "2xl" (16/24/40/64/96px)`
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const determinate = ["variant", "value"]
|
|
61
|
+
.map((name) => jsx.attr(el, name))
|
|
62
|
+
.filter((a): a is NonNullable<typeof a> => !!a)
|
|
63
|
+
if (determinate.length) {
|
|
64
|
+
const printed = determinate.map((a) => jsx.print(a)).join(" ")
|
|
65
|
+
for (const name of ["variant", "value"]) jsx.removeAttr(el, name)
|
|
66
|
+
ctx.todo(
|
|
67
|
+
path,
|
|
68
|
+
"CircularProgress",
|
|
69
|
+
`dropped ${printed}: Spinner is indeterminate; keep the value in your own progress ring or drop it`
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
}
|