@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
package/README.md
CHANGED
|
@@ -39,6 +39,14 @@ Application styles that need a design token import a named binding from
|
|
|
39
39
|
`@epilot/zenith-react/tokens`. Do not add the token CSS as a second stylesheet,
|
|
40
40
|
and do not write generated `--zenith-<hash>-*` names by hand.
|
|
41
41
|
|
|
42
|
+
Drag-and-drop reordering for `List` is a separate entry, so apps that render a plain
|
|
43
|
+
`List` do not bundle dnd-kit:
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { ListItem } from "@epilot/zenith-react"
|
|
47
|
+
import { SortableList } from "@epilot/zenith-react/list/sortable"
|
|
48
|
+
```
|
|
49
|
+
|
|
42
50
|
Zenith ships no `.css` files, and its `exports` map has no stylesheet entry:
|
|
43
51
|
there is nothing to import. Porting from Volt, drop its `style.css`,
|
|
44
52
|
`preflight.css` and `font.css` imports and add no replacement — the token CSS
|
|
@@ -124,6 +132,23 @@ Replace `https://main.d8s2wyuq7fsgk.amplifyapp.com` with your custom domain if
|
|
|
124
132
|
configured. All queries and tools are strictly read-only and require no
|
|
125
133
|
credentials.
|
|
126
134
|
|
|
135
|
+
## Agents
|
|
136
|
+
|
|
137
|
+
A Zenith skill teaches a coding agent to use the MCP above. It has `compose`,
|
|
138
|
+
`review`, `tokens`, `migrate` and `setup` modes. In Claude Code, one plugin
|
|
139
|
+
install adds the skill and the MCP connection:
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
claude plugin marketplace add https://gitlab.com/e-pilot/product/frontend/zenith.git
|
|
143
|
+
claude plugin install zenith@zenith
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Then run `/zenith:compose <screen>` or `/zenith:review`. For Codex, Cursor,
|
|
147
|
+
Copilot and OpenCode, install the skill with
|
|
148
|
+
`npx skills add https://gitlab.com/e-pilot/product/frontend/zenith --skill zenith`
|
|
149
|
+
and add the MCP endpoint to the agent's configuration. The "Coding agents"
|
|
150
|
+
page in the documentation's setup section has the steps for each agent.
|
|
151
|
+
|
|
127
152
|
## Which version you get
|
|
128
153
|
|
|
129
154
|
`npm install @epilot/zenith-react` resolves the `latest` dist-tag, which points
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Consumer codemods
|
|
2
|
+
|
|
3
|
+
`radix-to-base-ui.ts` moves consumer code across the Base UI port (DECISIONS.md D12: only overlay
|
|
4
|
+
dismissal interceptors left the surface). It is one transform for every family; consumers run it
|
|
5
|
+
once on code that imports `@epilot/zenith-react`:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
bunx jscodeshift@17.3.0 --parser=tsx -t node_modules/@epilot/zenith-react/codemods/radix-to-base-ui.ts src/
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
What it rewrites:
|
|
12
|
+
|
|
13
|
+
| Content part | Root whose `onOpenChange` takes the handlers | Props moved |
|
|
14
|
+
| ------------------------ | -------------------------------------------- | -------------------------------------------------------------------------------- |
|
|
15
|
+
| `DialogContent` | `Dialog` | `onEscapeKeyDown`, `onPointerDownOutside`, `onInteractOutside`, `onFocusOutside` |
|
|
16
|
+
| `AlertDialogContent` | `AlertDialog` | `onEscapeKeyDown`, `onFocusOutside` |
|
|
17
|
+
| `DrawerContent` | `Drawer` | all four |
|
|
18
|
+
| `PopoverContent` | `Popover` | all four |
|
|
19
|
+
| `FieldComboboxContent` | `FieldCombobox` | all four |
|
|
20
|
+
| `DropdownMenuContent` | `DropdownMenu` | all four |
|
|
21
|
+
| `DropdownMenuSubContent` | `DropdownMenuSub` | all four |
|
|
22
|
+
| `SelectContent` | `Select` | `onEscapeKeyDown`, `onPointerDownOutside` |
|
|
23
|
+
| `TooltipContent` | `Tooltip` | `onEscapeKeyDown`, `onPointerDownOutside` |
|
|
24
|
+
|
|
25
|
+
Each handler becomes a check on Base UI's `eventDetails.reason` (`escape-key`, `outside-press`,
|
|
26
|
+
`focus-out`), and one that calls `preventDefault()` keeps the overlay open through
|
|
27
|
+
`eventDetails.cancel()`, as it did under Radix. A DropdownMenu item whose `onSelect` calls
|
|
28
|
+
`preventDefault()` to keep the menu open is reported: the menu closes regardless under Base UI. Props
|
|
29
|
+
a wrapper can still translate, such as `forceMount`, stay on the surface and need no rule.
|
|
30
|
+
|
|
31
|
+
Each port added its own `<family>-base-ui.ts`; the Radix teardown (#97) folded them into this one
|
|
32
|
+
before any release shipped them, with every family's fixtures.
|
|
33
|
+
|
|
34
|
+
Rules for a transform:
|
|
35
|
+
|
|
36
|
+
- Only touch named imports from `@epilot/zenith-react` (aliases resolved); leave Volt imports alone.
|
|
37
|
+
- Each rule is a local, syntactic rewrite with no hand edits afterwards. Anything else gets a
|
|
38
|
+
`/* TODO(zenith-base-ui): … */` comment and an `api.report` line, so the run's output is the
|
|
39
|
+
list of places a human has to look.
|
|
40
|
+
- Fixtures: `__testfixtures__/radix-to-base-ui-<family>-<case>.input.tsx` and `.output.tsx`, the
|
|
41
|
+
output being exactly what `--dry --print` emits (no report lines, no absolute paths). Cover, per
|
|
42
|
+
family: the plain case, aliased imports, an inline handler, a handler reference, and one
|
|
43
|
+
unsupported shape that gets the TODO.
|
|
44
|
+
- `./run-fixtures.sh radix-to-base-ui` diffs every fixture of the transform. `fixtures.test.ts`
|
|
45
|
+
also reruns the transform over each expected output and requires a no-op, and typechecks the
|
|
46
|
+
outputs against the public types; the `-unsupported` fixtures keep the prop the transform cannot
|
|
47
|
+
rewrite and are the only outputs not typechecked.
|
|
48
|
+
|
|
49
|
+
## Migrating to Zenith
|
|
50
|
+
|
|
51
|
+
Two entry transforms in `migrate/` move consumer code onto `@epilot/zenith-react` from the
|
|
52
|
+
predecessor libraries. Run one, work the report, then run `radix-to-base-ui.ts` (it is not
|
|
53
|
+
chained: the predecessor APIs are the Radix-era ones):
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
bunx jscodeshift@17.3.0 --parser=tsx -t node_modules/@epilot/zenith-react/codemods/migrate/from-volt.ts src/
|
|
57
|
+
bunx jscodeshift@17.3.0 --parser=tsx -t node_modules/@epilot/zenith-react/codemods/migrate/from-base-elements.ts src/
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The run's output is the TODO list. Every place a human has to look is one line,
|
|
61
|
+
` REP <file> <line> <Component>: <fix>`, and the same text sits in the code as a
|
|
62
|
+
`TODO(zenith-migrate): <Component>: <fix>` comment. The fix is concrete ("dropped `value={p}`:
|
|
63
|
+
Spinner is indeterminate…"), so the reader needs no mapping document; look a component up only
|
|
64
|
+
when its line says so. `rg 'TODO\(zenith-migrate\)'` lists what is left.
|
|
65
|
+
|
|
66
|
+
### What each transform does
|
|
67
|
+
|
|
68
|
+
`from-volt` (Volt 1.7): every name Zenith kept (279, the whole barrel minus the list below)
|
|
69
|
+
moves onto the Zenith import unchanged; the `style.css`, `preflight.css` and `font.css` imports
|
|
70
|
+
are deleted; `ColumnFiltersState`, `ColumnOrderState`, `ColumnPinningState`, `FilterFn` and
|
|
71
|
+
`PaginationState` come from `@tanstack/react-table`; `cn`, `CloseIcon`, the `*Variants` helpers
|
|
72
|
+
and `useClientPagination` stay on the Volt import with the replacement in their TODO
|
|
73
|
+
(`mergeClasses` + `makeZenithStyles`; `calculatePagination`/`clampPage`). Then run the
|
|
74
|
+
`radix-to-base-ui` transform: the Volt API is Radix-era.
|
|
75
|
+
|
|
76
|
+
`from-base-elements` (3.10, MUI v4): syntactic renames with prop maps for `CircularProgress` →
|
|
77
|
+
`Spinner`, `Divider` → `Separator`, `Skeleton`, `Avatar`/`AvatarGroup`, `Paper` → `Surface`,
|
|
78
|
+
`Chip`/`Chip360` → `Pill`, structural rewrites for the button, form, dialog, typography,
|
|
79
|
+
navigation and feedback families (the table below), and a one-line hint for everything else
|
|
80
|
+
(`unsupported.ts`: Grid, Box, the spacing components, Icon, theme and `makeStyles`, MUI's count
|
|
81
|
+
Badge, masked fields, LinearProgress, Drawer360, react-beautiful-dnd, transitions, and the
|
|
82
|
+
same-name-different-API families such as Table and List). MUI theming props (`color="primary"`
|
|
83
|
+
on a spinner, `classes`) are dropped and, where they change behaviour, reported. A legacy
|
|
84
|
+
binding that is also used as a value (`styled(Paper)`, `component={Paper}`) stays on the legacy
|
|
85
|
+
import with one TODO per use; only its JSX elements move. Re-exports, `import()`, `require` and
|
|
86
|
+
`jest.mock`/`vi.mock` of the legacy package are reported, never rewritten.
|
|
87
|
+
|
|
88
|
+
Dry run first and read the report (`--dry` writes nothing; add `--print` to see the output).
|
|
89
|
+
Line numbers in the report are the input file's; after a write run, find each place by its
|
|
90
|
+
`TODO(zenith-migrate)` comment instead. The `tsx` parser rejects the `<T>x` cast in `.ts`
|
|
91
|
+
files: rewrite those as `x as T` before running.
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
bunx jscodeshift@17.3.0 --parser=tsx --extensions=tsx,ts,jsx,js --dry \
|
|
95
|
+
-t node_modules/@epilot/zenith-react/codemods/migrate/from-base-elements.ts src/ | grep ' REP '
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### base-elements structural rules
|
|
99
|
+
|
|
100
|
+
One module per family in `migrate/base-elements/` (shared helpers in `shared.ts`). Simple
|
|
101
|
+
shapes are rewritten onto the Zenith parts; anything else still compiles and gets a TODO.
|
|
102
|
+
|
|
103
|
+
| base-elements | Zenith | Rewritten | Reported |
|
|
104
|
+
| ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
105
|
+
| `Button` | `Button` | variant × color (contained → primary, outlined → secondary, text → tertiary or ghost), size, `startIcon`/`endIcon` as children, `href`/`component` → `asChild`, `fullWidth` → `width: 100%`, `type="button"` when MUI rendered a native button | a dynamic variant or size, MUI-only props |
|
|
106
|
+
| `IconButton`, `ElevatedIconButton`, `TooltipIconButton` | `Button size="icon…"` | small → `icon-xs`, medium → `icon`, large → `icon-lg`; ghost, primary or secondary; TooltipIconButton → Tooltip parts with its title as `aria-label` | no accessible name, `edge` |
|
|
107
|
+
| `Dialog`, `DialogTitle`, `DialogContent`, `DialogActions`, `DialogContentText` | `Dialog` > `DialogContent` (the panel) > `DialogHeader`/`DialogTitle`, `DialogFooter`, `DialogDescription` | `onClose` → `onOpenChange`, `maxWidth` → panel `size` (nearest with `fullWidth`, else at most `lg`), `disableBackdropClick`/`disableEscapeKeyDown` → `preventDefault()` handlers, `showCloseButton={false}`; MUI's `DialogContent` is the body and becomes a `<div>` | the body's scrolling, an `onClose` that reads `(event, reason)`, ids Radix owns, `aria-labelledby` pointing elsewhere |
|
|
108
|
+
| `TextField` | `Field` + `FieldLabel` + `FieldInput`/`FieldTextarea` + `FieldDescription`/`FieldError` | input props, `inputProps`, `inputRef`, `multiline`/`rows`, `error` + `helperText`, `InputProps` adornments → `FieldInputGroup` + `FieldGroupAddon` | a label without an `id` to tie it to, `select`, a dynamic `multiline`, `margin` |
|
|
109
|
+
| `Typography`, `H1`–`H6`, `DisplayText`, `LargeText`, `BodyText`, `SmallText` | `Text` | variant by the epilot theme's sizes (h1–h4 → title3 … caption → body1), `textSecondary` → helper2/helper1, `gutterBottom`/`noWrap`/`align`/`customColor` → inline style | a lost heading level, block → inline next to siblings, colours Text has no variant for |
|
|
110
|
+
| `Tooltip` | `Tooltip` > `TooltipTrigger asChild` + `TooltipContent` | `placement` → `side`/`align` (MUI's bottom default written out), `enterDelay` → `delayDuration` | the TooltipProvider Radix needs (once per file), a title that can be empty, MUI timing props |
|
|
111
|
+
| `Switch`, `Checkbox` | `Switch`, `Checkbox` | `onChange(event, checked)` → `onCheckedChange(checked)`, `indeterminate` → `checked="indeterminate"`, `label` → a wrapping `Label` | handler references, spread props (`{...field}`) |
|
|
112
|
+
| `TabContext`, `Tabs`, `TabList`, `PrimaryTabs`, `Tab`, `TabPanel` | `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent` | the list's `onChange` → the root's `onValueChange`, `label` → children | numeric or missing tab values |
|
|
113
|
+
| `Select` + `MenuItem` | `Select` > `SelectTrigger` > `SelectValue`, `SelectContent` > `SelectItem` | static or `.map` items, `event.target.value` handlers, `placeholder`, `label` → `Field` + `FieldLabel` | other children, empty or null values, `renderValue`, `multiple`, a `MenuItem` outside a Select |
|
|
114
|
+
| `Alert`, `Notification` (and Info/Error/Success), `FeedbackMessage` | `Callout` + `CalloutTitle`/`CalloutDescription`/`CalloutAction` | `severity`/`stateVariant` → `variant`, `onClose` → `dismissible onDismiss`, `visible` → a render condition | a dynamic severity, the feedback icon action |
|
|
115
|
+
| `Accordion`, `AccordionSummary`, `AccordionDetails` | `Accordion type="single" collapsible` > `AccordionItem` > `AccordionTrigger` + `AccordionContent` | `defaultExpanded`/`expanded`/`onChange` → `defaultValue`/`value`/`onValueChange` | `AccordionActions`, handler references |
|
|
116
|
+
| `ToggleButtonGroup`, `ToggleButton` | `SegmentedControl` (exclusive) or `ToggleGroup type="multiple"` | `onChange` → `onValueChange` | a dynamic `exclusive`, a `ToggleButton` on its own |
|
|
117
|
+
|
|
118
|
+
An inline MUI handler `(event, value) => …` becomes `(value) => …` when it reads only the value
|
|
119
|
+
or `event.target.<prop>`; a handler reference keeps MUI's signature, so it is dropped and
|
|
120
|
+
reported. Where Zenith's parts need Zenith's root (Dialog, Tabs, Accordion, ToggleButtonGroup),
|
|
121
|
+
a family member used as a value (`styled(Dialog)`) keeps the whole family on base-elements: a
|
|
122
|
+
Zenith part inside an MUI root breaks at runtime.
|
|
123
|
+
|
|
124
|
+
### Rule contract
|
|
125
|
+
|
|
126
|
+
One module per legacy component, listed in its source's registry (`migrate/volt/index.ts`,
|
|
127
|
+
`migrate/base-elements/index.ts`). The contract is `migrate/lib/types.ts`:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
export const handles = ["CircularProgress", "CircularProgressProps"] as const
|
|
131
|
+
export function migrate(ctx: MigrateContext) {
|
|
132
|
+
ctx.move("CircularProgress", "Spinner") // onto the Zenith import; un-aliased bindings are renamed
|
|
133
|
+
ctx.move("CircularProgressProps", "SpinnerProps")
|
|
134
|
+
ctx.elements("CircularProgress").forEach((path) => {
|
|
135
|
+
ctx.jsx.removeAttr(path.node, "color")
|
|
136
|
+
const value = ctx.jsx.attr(path.node, "value")
|
|
137
|
+
if (value) {
|
|
138
|
+
ctx.jsx.removeAttr(path.node, "value")
|
|
139
|
+
ctx.todo(
|
|
140
|
+
path,
|
|
141
|
+
"CircularProgress",
|
|
142
|
+
`dropped ${ctx.jsx.print(value)}: Spinner is indeterminate`
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
- `ctx.move(name, target?)` puts the legacy export on the Zenith import (merged into an existing
|
|
150
|
+
one); `ctx.keep(name, fix)` leaves it on the legacy import with one TODO at the import. A name
|
|
151
|
+
the rule neither moves nor keeps is kept with a generic TODO. A rule never edits imports itself.
|
|
152
|
+
- `ctx.todo(path, component, fix)` adds the comment (a `{/* */}` sibling inside JSX children)
|
|
153
|
+
and the report line. `ctx.ensureZenith(name)` imports a Zenith export for a per-element rewrite
|
|
154
|
+
(`ctx.jsx.rename(el, ctx.ensureZenith("Spinner"))`) when only some elements can move.
|
|
155
|
+
- `ctx.jsx` has the prop helpers: `attr`, `literal`, `removeAttr`, `renameAttr`, `setAttr`,
|
|
156
|
+
`mapAttrValue`, `wrapChildren`, `wrap`, `rename`, `styleObject`, `print`.
|
|
157
|
+
- A moved element must compile against Zenith's types: drop what has no equivalent and name it
|
|
158
|
+
in the TODO, or keep the whole name on the legacy import. Theming-only props (`color="primary"`)
|
|
159
|
+
are dropped silently; anything that changes behaviour or layout is reported.
|
|
160
|
+
- A rule that owns a bare module specifier (a stylesheet import) lists it in `handlesModules`.
|
|
161
|
+
- Fixtures: `__testfixtures__/from-<source>-<component>-<case>.{input,output}.tsx`, with `plain`,
|
|
162
|
+
`aliased`, `partial` (names left on the legacy import) and one `todo` shape. `fixtures.test.ts`
|
|
163
|
+
runs every transform on its fixtures, asserts one report per TODO and a no-op rerun, and
|
|
164
|
+
typechecks the outputs against Zenith's public types (`tsconfig.fixtures.json`, with
|
|
165
|
+
`legacy-modules.d.ts` stubbing the predecessors) the way a consumer ends up with them: a
|
|
166
|
+
`from-*` output is first run through the `radix-to-base-ui` transform, since its Zenith
|
|
167
|
+
API is the Radix-era one. `./run-fixtures.sh <transform>` is the
|
|
168
|
+
per-transform CLI over the same test.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accordion / AccordionSummary / AccordionDetails → Accordion / AccordionItem /
|
|
3
|
+
* AccordionTrigger / AccordionContent.
|
|
4
|
+
*
|
|
5
|
+
* An MUI Accordion is one collapsible item; Zenith's Accordion is the group. Each MUI Accordion
|
|
6
|
+
* becomes `<Accordion type="single" collapsible>` around one `<AccordionItem value="item">`:
|
|
7
|
+
*
|
|
8
|
+
* - `defaultExpanded` → `defaultValue="item"`; `expanded={open}` → `value={open ? "item" : ""}`;
|
|
9
|
+
* `onChange={(event, expanded) => …}` → `onValueChange={(expanded) => …}` with each read of
|
|
10
|
+
* `expanded` as `expanded === "item"`. `disabled` goes to the item.
|
|
11
|
+
* - `expandIcon` is dropped (the trigger draws its own chevron), as are MUI's paper and
|
|
12
|
+
* transition props. AccordionActions has no part: it stays, reported.
|
|
13
|
+
*/
|
|
14
|
+
import type { ASTPath, JSXElement } from "jscodeshift"
|
|
15
|
+
import type { MigrateContext } from "../lib/types"
|
|
16
|
+
import {
|
|
17
|
+
attrExpression,
|
|
18
|
+
attrValue,
|
|
19
|
+
isTrue,
|
|
20
|
+
nestChildren,
|
|
21
|
+
printAttr,
|
|
22
|
+
renamedAttr,
|
|
23
|
+
stringIn,
|
|
24
|
+
takeAttrs,
|
|
25
|
+
valueHandler,
|
|
26
|
+
familyStays,
|
|
27
|
+
} from "./shared"
|
|
28
|
+
|
|
29
|
+
export const handles = [
|
|
30
|
+
"Accordion",
|
|
31
|
+
"AccordionProps",
|
|
32
|
+
"AccordionSummary",
|
|
33
|
+
"AccordionSummaryProps",
|
|
34
|
+
"AccordionDetails",
|
|
35
|
+
"AccordionDetailsProps",
|
|
36
|
+
"AccordionActions",
|
|
37
|
+
"AccordionActionsProps",
|
|
38
|
+
] as const
|
|
39
|
+
|
|
40
|
+
const ITEM = "item"
|
|
41
|
+
const SILENT = [
|
|
42
|
+
"TransitionComponent",
|
|
43
|
+
"TransitionProps",
|
|
44
|
+
"square",
|
|
45
|
+
"elevation",
|
|
46
|
+
"variant",
|
|
47
|
+
"classes",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
export function migrate(ctx: MigrateContext): void {
|
|
51
|
+
if (
|
|
52
|
+
familyStays(
|
|
53
|
+
ctx,
|
|
54
|
+
["Accordion", "AccordionSummary", "AccordionDetails", "AccordionActions"],
|
|
55
|
+
'migrate this accordion by hand: Accordion type="single" collapsible > AccordionItem > AccordionTrigger + AccordionContent'
|
|
56
|
+
)
|
|
57
|
+
)
|
|
58
|
+
return
|
|
59
|
+
ctx.move("Accordion")
|
|
60
|
+
ctx.move("AccordionProps")
|
|
61
|
+
ctx.move("AccordionSummary", "AccordionTrigger")
|
|
62
|
+
ctx.move("AccordionSummaryProps", "AccordionTriggerProps")
|
|
63
|
+
ctx.move("AccordionDetails", "AccordionContent")
|
|
64
|
+
ctx.move("AccordionDetailsProps", "AccordionContentProps")
|
|
65
|
+
const actions = "no part for actions: put them at the end of AccordionContent"
|
|
66
|
+
ctx.keep("AccordionActions", actions)
|
|
67
|
+
ctx.keep("AccordionActionsProps", actions)
|
|
68
|
+
|
|
69
|
+
ctx.elements("Accordion").forEach((path) => migrateAccordion(ctx, path))
|
|
70
|
+
ctx.elements("AccordionSummary").forEach((path) => {
|
|
71
|
+
takeAttrs(ctx, path.node, [
|
|
72
|
+
"expandIcon",
|
|
73
|
+
"IconButtonProps",
|
|
74
|
+
"aria-controls",
|
|
75
|
+
"id",
|
|
76
|
+
])
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function migrateAccordion(
|
|
81
|
+
ctx: MigrateContext,
|
|
82
|
+
path: ASTPath<JSXElement>
|
|
83
|
+
): void {
|
|
84
|
+
const { j, jsx } = ctx
|
|
85
|
+
const el = path.node
|
|
86
|
+
const reported: string[] = []
|
|
87
|
+
const item = () => stringIn(ctx, ITEM)
|
|
88
|
+
|
|
89
|
+
const expanded = jsx.removeAttr(el, "expanded")
|
|
90
|
+
const defaultExpanded = jsx.removeAttr(el, "defaultExpanded")
|
|
91
|
+
const onChange = jsx.removeAttr(el, "onChange")
|
|
92
|
+
const disabled = jsx.removeAttr(el, "disabled")
|
|
93
|
+
takeAttrs(ctx, el, SILENT)
|
|
94
|
+
|
|
95
|
+
const openWhen = (a: NonNullable<typeof expanded>) =>
|
|
96
|
+
isTrue(ctx, a)
|
|
97
|
+
? ITEM
|
|
98
|
+
: j.conditionalExpression(
|
|
99
|
+
attrValue(j, a) as never,
|
|
100
|
+
item() as never,
|
|
101
|
+
stringIn(ctx, "") as never
|
|
102
|
+
)
|
|
103
|
+
const attrs = [
|
|
104
|
+
j.jsxAttribute(j.jsxIdentifier("type"), jsx.str("single")),
|
|
105
|
+
j.jsxAttribute(j.jsxIdentifier("collapsible")),
|
|
106
|
+
]
|
|
107
|
+
el.openingElement.attributes = [
|
|
108
|
+
...attrs,
|
|
109
|
+
...(el.openingElement.attributes ?? []),
|
|
110
|
+
]
|
|
111
|
+
if (expanded) jsx.setAttr(el, "value", openWhen(expanded))
|
|
112
|
+
else if (defaultExpanded && jsx.literal(defaultExpanded) !== false)
|
|
113
|
+
jsx.setAttr(el, "defaultValue", openWhen(defaultExpanded))
|
|
114
|
+
|
|
115
|
+
if (onChange) {
|
|
116
|
+
const handler = valueHandler(j, attrExpression(onChange), {
|
|
117
|
+
valueName: "value",
|
|
118
|
+
mapValue: (value) =>
|
|
119
|
+
j.binaryExpression("===", value as never, item() as never),
|
|
120
|
+
})
|
|
121
|
+
if (handler) jsx.setAttr(el, "onValueChange", handler)
|
|
122
|
+
else
|
|
123
|
+
reported.push(
|
|
124
|
+
`dropped ${printAttr(ctx, onChange)} (onValueChange(value) passes "item" when it opens and "" when it closes)`
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const itemAttrs = [j.jsxAttribute(j.jsxIdentifier("value"), jsx.str(ITEM))]
|
|
129
|
+
if (disabled) itemAttrs.push(renamedAttr(j, disabled, "disabled"))
|
|
130
|
+
nestChildren(j, el, ctx.ensureZenith("AccordionItem"), itemAttrs)
|
|
131
|
+
if (reported.length) ctx.todo(path, "Accordion", reported.join("; "))
|
|
132
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alert → Callout.
|
|
3
|
+
*
|
|
4
|
+
* - `severity` → `variant` (error → destructive); MUI's default is success, Callout's info, so an
|
|
5
|
+
* absent severity is written as `variant="success"`.
|
|
6
|
+
* - Children → `CalloutDescription`; `action` → a trailing `CalloutAction`; `onClose` →
|
|
7
|
+
* `dismissible onDismiss`.
|
|
8
|
+
* - `icon={false}` → `hideIcon`, another icon → `customIcon`.
|
|
9
|
+
* - MUI's `variant`, `color`, `elevation` and base-elements' `isSmall` are theming: dropped.
|
|
10
|
+
*/
|
|
11
|
+
import type { ASTPath, JSXElement } from "jscodeshift"
|
|
12
|
+
import type { MigrateContext } from "../lib/types"
|
|
13
|
+
import {
|
|
14
|
+
SEVERITY,
|
|
15
|
+
fillCallout,
|
|
16
|
+
mapAttr,
|
|
17
|
+
printAttr,
|
|
18
|
+
printAttrs,
|
|
19
|
+
renamedAttr,
|
|
20
|
+
takeAttrs,
|
|
21
|
+
moveElements,
|
|
22
|
+
} from "./shared"
|
|
23
|
+
|
|
24
|
+
export const handles = ["Alert", "AlertProps"] as const
|
|
25
|
+
|
|
26
|
+
export function migrate(ctx: MigrateContext): void {
|
|
27
|
+
moveElements(ctx, "Alert", "Callout", (path) => migrateAlert(ctx, path))
|
|
28
|
+
ctx.move("AlertProps", "CalloutProps")
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function migrateAlert(ctx: MigrateContext, path: ASTPath<JSXElement>): void {
|
|
32
|
+
const { j, jsx } = ctx
|
|
33
|
+
const el = path.node
|
|
34
|
+
const reported: string[] = []
|
|
35
|
+
|
|
36
|
+
if (!jsx.attr(el, "severity")) jsx.setAttr(el, "variant", "success")
|
|
37
|
+
else if (
|
|
38
|
+
!mapAttr(ctx, el, "severity", SEVERITY, {
|
|
39
|
+
rename: "variant",
|
|
40
|
+
fallback: "info",
|
|
41
|
+
})
|
|
42
|
+
)
|
|
43
|
+
reported.push(
|
|
44
|
+
`dropped ${printAttr(ctx, takeAttrs(ctx, el, ["severity"])[0])} (variant: success | info | warning | destructive)`
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
const icon = jsx.removeAttr(el, "icon")
|
|
48
|
+
if (icon && jsx.literal(icon) === false) jsx.setAttr(el, "hideIcon", null)
|
|
49
|
+
else if (icon)
|
|
50
|
+
el.openingElement.attributes = [
|
|
51
|
+
...(el.openingElement.attributes ?? []),
|
|
52
|
+
renamedAttr(j, icon, "customIcon"),
|
|
53
|
+
]
|
|
54
|
+
takeAttrs(ctx, el, ["color", "isSmall", "elevation", "square"])
|
|
55
|
+
const variant = jsx.attr(el, "variant")
|
|
56
|
+
if (
|
|
57
|
+
variant &&
|
|
58
|
+
!["success", "info", "warning", "destructive"].includes(
|
|
59
|
+
String(jsx.literal(variant))
|
|
60
|
+
)
|
|
61
|
+
)
|
|
62
|
+
takeAttrs(ctx, el, ["variant"])
|
|
63
|
+
const unsupported = takeAttrs(ctx, el, [
|
|
64
|
+
"iconMapping",
|
|
65
|
+
"closeText",
|
|
66
|
+
"classes",
|
|
67
|
+
])
|
|
68
|
+
if (unsupported.length)
|
|
69
|
+
reported.push(
|
|
70
|
+
`dropped ${printAttrs(ctx, unsupported)} (no Callout equivalent)`
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
reported.push(
|
|
74
|
+
...fillCallout(ctx, el, {
|
|
75
|
+
description: el.children ?? [],
|
|
76
|
+
onClose: jsx.removeAttr(el, "onClose"),
|
|
77
|
+
action: jsx.removeAttr(el, "action"),
|
|
78
|
+
})
|
|
79
|
+
)
|
|
80
|
+
if (reported.length) ctx.todo(path, "Alert", reported.join("; "))
|
|
81
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Avatar and AvatarGroup keep their names. MUI's initials are children; Zenith's are `initials`.
|
|
3
|
+
* Custom colours become the `color` family or a TODO; shapes other than round are reported.
|
|
4
|
+
*/
|
|
5
|
+
import type { MigrateContext } from "../lib/types"
|
|
6
|
+
import { dropWithHint } from "./mui-props"
|
|
7
|
+
|
|
8
|
+
export const handles = [
|
|
9
|
+
"Avatar",
|
|
10
|
+
"AvatarProps",
|
|
11
|
+
"AvatarGroup",
|
|
12
|
+
"AvatarGroupProps",
|
|
13
|
+
] as const
|
|
14
|
+
|
|
15
|
+
const COLORS =
|
|
16
|
+
"gray | blue | sky | cyan | teal | mint | green | lime | yellow | orange | bronze | red | pink | purple | indigo"
|
|
17
|
+
|
|
18
|
+
export function migrate(ctx: MigrateContext): void {
|
|
19
|
+
const { jsx } = ctx
|
|
20
|
+
const avatars = ctx.elements("Avatar")
|
|
21
|
+
const groups = ctx.elements("AvatarGroup")
|
|
22
|
+
ctx.moveElements("Avatar")
|
|
23
|
+
ctx.moveElements("AvatarGroup")
|
|
24
|
+
ctx.move("AvatarProps")
|
|
25
|
+
ctx.move("AvatarGroupProps")
|
|
26
|
+
|
|
27
|
+
avatars.forEach((path) => {
|
|
28
|
+
const el = path.node
|
|
29
|
+
const children = (el.children ?? []).filter(
|
|
30
|
+
(c) => !(c.type === "JSXText" && c.value.trim() === "")
|
|
31
|
+
)
|
|
32
|
+
if (children.length === 1) {
|
|
33
|
+
const [child] = children
|
|
34
|
+
if (child.type === "JSXText") {
|
|
35
|
+
jsx.setAttr(el, "initials", child.value.trim())
|
|
36
|
+
jsx.setChildren(el, [])
|
|
37
|
+
} else if (
|
|
38
|
+
child.type === "JSXExpressionContainer" &&
|
|
39
|
+
child.expression.type !== "JSXEmptyExpression"
|
|
40
|
+
) {
|
|
41
|
+
const literal =
|
|
42
|
+
child.expression.type === "StringLiteral"
|
|
43
|
+
? child.expression.value
|
|
44
|
+
: undefined
|
|
45
|
+
jsx.setAttr(el, "initials", literal ?? (child.expression as never))
|
|
46
|
+
jsx.setChildren(el, [])
|
|
47
|
+
} else {
|
|
48
|
+
const printed = ctx.j(child as never).toSource()
|
|
49
|
+
jsx.setChildren(el, [])
|
|
50
|
+
ctx.todo(
|
|
51
|
+
path,
|
|
52
|
+
"Avatar",
|
|
53
|
+
`dropped child ${printed}: Avatar shows src= or initials= only; an icon avatar is a styled span`
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
} else if (children.length > 1) {
|
|
57
|
+
jsx.setChildren(el, [])
|
|
58
|
+
ctx.todo(
|
|
59
|
+
path,
|
|
60
|
+
"Avatar",
|
|
61
|
+
"dropped children: Avatar shows src= or initials= only (one text child becomes initials=)"
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const variant = jsx.mapAttrValue(el, "variant", {
|
|
66
|
+
circle: null,
|
|
67
|
+
circular: null,
|
|
68
|
+
})
|
|
69
|
+
if (variant === "unknown" || variant === "dynamic") {
|
|
70
|
+
const printed = jsx.print(jsx.attr(el, "variant")!)
|
|
71
|
+
jsx.removeAttr(el, "variant")
|
|
72
|
+
ctx.todo(
|
|
73
|
+
path,
|
|
74
|
+
"Avatar",
|
|
75
|
+
`dropped ${printed}: Avatar is round; a square one is a styled span`
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
for (const name of ["backgroundColor", "borderColor"]) {
|
|
80
|
+
const attr = jsx.attr(el, name)
|
|
81
|
+
if (!attr) continue
|
|
82
|
+
jsx.removeAttr(el, name)
|
|
83
|
+
ctx.todo(
|
|
84
|
+
path,
|
|
85
|
+
"Avatar",
|
|
86
|
+
`dropped ${jsx.print(attr)}: pick color= (${COLORS}), or leave it unset to hash alt/initials`
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
for (const name of ["sizes", "srcSet", "imgProps"]) {
|
|
90
|
+
const attr = jsx.attr(el, name)
|
|
91
|
+
if (!attr) continue
|
|
92
|
+
jsx.removeAttr(el, name)
|
|
93
|
+
ctx.todo(
|
|
94
|
+
path,
|
|
95
|
+
"Avatar",
|
|
96
|
+
`dropped ${jsx.print(attr)}: Avatar takes src and alt only`
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
dropWithHint(ctx, path, "Avatar")
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
groups.forEach((path) => {
|
|
103
|
+
const el = path.node
|
|
104
|
+
jsx.removeAttr(el, "spacing")
|
|
105
|
+
const variant = jsx.attr(el, "variant")
|
|
106
|
+
if (variant) {
|
|
107
|
+
jsx.removeAttr(el, "variant")
|
|
108
|
+
ctx.todo(
|
|
109
|
+
path,
|
|
110
|
+
"AvatarGroup",
|
|
111
|
+
`dropped ${jsx.print(variant)}: avatars are round`
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
dropWithHint(ctx, path, "AvatarGroup")
|
|
115
|
+
})
|
|
116
|
+
}
|