@epilot/zenith-react 0.2.0-next.3 → 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/date-range-picker/date-range-picker.js +100 -90
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/date-time-picker/date-time-picker-input.js +118 -108
- package/dist/components/date-time-picker/date-time-picker-input.js.map +1 -1
- package/dist/components/date-time-picker/date-time-picker-panel.js +91 -94
- package/dist/components/date-time-picker/date-time-picker-panel.js.map +1 -1
- package/dist/components/dialog/dialog.js +238 -228
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/drawer/drawer.js +259 -321
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.js +533 -279
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/field/field-combobox.js +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 +28 -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
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs as z, jsx as O } from "react/jsx-runtime";
|
|
2
2
|
import * as R from "react";
|
|
3
|
-
import { mergeClasses as
|
|
4
|
-
import { makeZenithStyles as
|
|
3
|
+
import { mergeClasses as T, SLOT_ATTR as k, shorthands as L } from "@epilot/zenith-runtime/v1";
|
|
4
|
+
import { makeZenithStyles as N } from "../../styles/make-styles.js";
|
|
5
5
|
import { boxModel as c } from "../../styles/host-reset.js";
|
|
6
6
|
import { spacingGroup2 as v, spacingElement1 as u, accentA8 as E, radiusMd as I, spacingElement2 as P, fontWeightBold as A, leadingXs as B, textXs as C } from "../../tokens/index.js";
|
|
7
7
|
import { useZenithPaletteTokensFor as F } from "../../tokens/use-palette-tokens.js";
|
|
8
8
|
import { ClearButton as D } from "../../lib/clear-button.js";
|
|
9
9
|
import { NS as G } from "../../tokens/core.meta.generated.js";
|
|
10
|
-
import { NS as W } from "../../tokens/palette.generated.js";
|
|
10
|
+
import { NS as W } from "../../tokens/palette.meta.generated.js";
|
|
11
11
|
import { isCoreFamily as _ } from "../../packages/tokens/dist/install.js";
|
|
12
12
|
const te = [
|
|
13
13
|
"blue",
|
|
@@ -48,7 +48,7 @@ const te = [
|
|
|
48
48
|
[m]: j(e, "a6"),
|
|
49
49
|
[a]: t(e, "surface-hover")
|
|
50
50
|
})
|
|
51
|
-
}, M =
|
|
51
|
+
}, M = N({
|
|
52
52
|
root: {
|
|
53
53
|
...c,
|
|
54
54
|
display: "inline-flex",
|
|
@@ -67,7 +67,7 @@ const te = [
|
|
|
67
67
|
transitionProperty: "color, box-shadow, background-color",
|
|
68
68
|
// NEVER write a CSS shorthand in a Griffel style object — see Badge. One atom reads one
|
|
69
69
|
// custom property; `border` and a later `borderColor` would both survive.
|
|
70
|
-
...
|
|
70
|
+
...L.border("1px", "solid", `var(${m})`),
|
|
71
71
|
// The whole point: one rule each, colour supplied per instance.
|
|
72
72
|
backgroundColor: `var(${p})`,
|
|
73
73
|
color: `var(${d})`,
|
|
@@ -125,7 +125,7 @@ const te = [
|
|
|
125
125
|
{
|
|
126
126
|
ref: w,
|
|
127
127
|
"data-slot": "pill",
|
|
128
|
-
[
|
|
128
|
+
[k]: "pill",
|
|
129
129
|
"data-disabled": r || void 0,
|
|
130
130
|
role: s ? "button" : void 0,
|
|
131
131
|
tabIndex: s ? 0 : void 0,
|
|
@@ -133,7 +133,7 @@ const te = [
|
|
|
133
133
|
onKeyDown: s ? (l) => {
|
|
134
134
|
(l.key === "Enter" || l.key === " ") && (l.preventDefault(), i == null || i(l));
|
|
135
135
|
} : void 0,
|
|
136
|
-
className:
|
|
136
|
+
className: T(
|
|
137
137
|
n.root,
|
|
138
138
|
s && n.interactive,
|
|
139
139
|
h && n.hasRemove,
|
|
@@ -1,164 +1,260 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
1
|
+
import { jsx as d, jsxs as H, Fragment as Z } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { createPortal as q } from "react-dom";
|
|
4
|
+
import { Popover as p } from "../../_virtual/_zenith-runtime-family_popover.js";
|
|
5
|
+
import { useRender as G } from "../../_virtual/_zenith-runtime-family_use-render.js";
|
|
6
|
+
import { SLOT_ATTR as m, mergeClasses as P, shorthands as g } from "@epilot/zenith-runtime/v1";
|
|
7
|
+
import { useAppearanceAttributes as B } from "../appearance-boundary/appearance-boundary.js";
|
|
8
|
+
import { useDensity as J } from "../density-provider/density-provider.js";
|
|
9
|
+
import { makeZenithStyles as K } from "../../styles/make-styles.js";
|
|
10
|
+
import { boxModel as E, nativeControl as Q } from "../../styles/host-reset.js";
|
|
11
|
+
import { OVERLAY_Z_INDEX as S } from "../../styles/overlay-layer.js";
|
|
12
|
+
import { spacingElement2 as f, grayA12 as U, body as tt, spacingGroup2 as et, grayA1 as ot, radiusXl as rt } from "../../tokens/index.js";
|
|
13
|
+
const nt = "cubic-bezier(0.4, 0, 0.2, 1)", at = "cubic-bezier(0.4, 0, 1, 1)", T = K({
|
|
12
14
|
// For the bare native `<button>` a Trigger/Close renders. Not applied under `asChild`, where the
|
|
13
15
|
// child owns its own element and two atom sets would race for the same properties.
|
|
14
16
|
nativeTrigger: {
|
|
15
|
-
...
|
|
17
|
+
...Q
|
|
18
|
+
},
|
|
19
|
+
// The positioner is what stacks against other layers, as Radix's popper wrapper did; it also
|
|
20
|
+
// keeps that wrapper's `max-content` floor so the content wraps the same way.
|
|
21
|
+
positioner: {
|
|
22
|
+
zIndex: S,
|
|
23
|
+
minWidth: "max-content"
|
|
24
|
+
},
|
|
25
|
+
hideWhenDetached: {
|
|
26
|
+
"&[data-anchor-hidden]": {
|
|
27
|
+
visibility: "hidden",
|
|
28
|
+
pointerEvents: "none"
|
|
29
|
+
}
|
|
16
30
|
},
|
|
17
31
|
popup: {
|
|
18
|
-
...
|
|
19
|
-
backgroundColor:
|
|
20
|
-
color:
|
|
21
|
-
transformOrigin: "var(--
|
|
22
|
-
...
|
|
23
|
-
...
|
|
32
|
+
...E,
|
|
33
|
+
backgroundColor: tt,
|
|
34
|
+
color: U,
|
|
35
|
+
transformOrigin: "var(--transform-origin)",
|
|
36
|
+
...g.borderRadius(rt),
|
|
37
|
+
...g.border("1px", "solid", ot),
|
|
24
38
|
// v1 shadow-md
|
|
25
39
|
boxShadow: "0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a",
|
|
26
40
|
outlineStyle: "none",
|
|
27
|
-
zIndex:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"&[data-state='closed']": {
|
|
35
|
-
animationDuration: "0.01ms"
|
|
36
|
-
}
|
|
41
|
+
zIndex: S,
|
|
42
|
+
transitionProperty: "opacity, transform",
|
|
43
|
+
transitionDuration: "150ms",
|
|
44
|
+
transitionTimingFunction: nt,
|
|
45
|
+
"&[data-starting-style]": {
|
|
46
|
+
opacity: 0,
|
|
47
|
+
transform: "scale(0.95)"
|
|
37
48
|
},
|
|
38
|
-
"&[data-
|
|
39
|
-
|
|
40
|
-
from: { opacity: 0, transform: "scale(0.95)" },
|
|
41
|
-
to: { opacity: 1, transform: "scale(1)" }
|
|
42
|
-
},
|
|
43
|
-
animationDuration: "150ms",
|
|
44
|
-
animationTimingFunction: "cubic-bezier(0.4, 0, 0.2, 1)"
|
|
49
|
+
"&[data-starting-style][data-side='bottom']": {
|
|
50
|
+
transform: `translateY(-${f}) scale(0.95)`
|
|
45
51
|
},
|
|
46
|
-
"&[data-
|
|
47
|
-
|
|
48
|
-
from: {
|
|
49
|
-
opacity: 0,
|
|
50
|
-
transform: `translateY(-${i}) scale(0.95)`
|
|
51
|
-
},
|
|
52
|
-
to: { opacity: 1, transform: "translateY(0) scale(1)" }
|
|
53
|
-
}
|
|
52
|
+
"&[data-starting-style][data-side='left']": {
|
|
53
|
+
transform: `translateX(${f}) scale(0.95)`
|
|
54
54
|
},
|
|
55
|
-
"&[data-
|
|
56
|
-
|
|
57
|
-
from: {
|
|
58
|
-
opacity: 0,
|
|
59
|
-
transform: `translateX(${i}) scale(0.95)`
|
|
60
|
-
},
|
|
61
|
-
to: { opacity: 1, transform: "translateX(0) scale(1)" }
|
|
62
|
-
}
|
|
55
|
+
"&[data-starting-style][data-side='right']": {
|
|
56
|
+
transform: `translateX(-${f}) scale(0.95)`
|
|
63
57
|
},
|
|
64
|
-
"&[data-
|
|
65
|
-
|
|
66
|
-
from: {
|
|
67
|
-
opacity: 0,
|
|
68
|
-
transform: `translateX(-${i}) scale(0.95)`
|
|
69
|
-
},
|
|
70
|
-
to: { opacity: 1, transform: "translateX(0) scale(1)" }
|
|
71
|
-
}
|
|
58
|
+
"&[data-starting-style][data-side='top']": {
|
|
59
|
+
transform: `translateY(${f}) scale(0.95)`
|
|
72
60
|
},
|
|
73
|
-
"&[data-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
to: { opacity: 1, transform: "translateY(0) scale(1)" }
|
|
80
|
-
}
|
|
61
|
+
"&[data-ending-style]": {
|
|
62
|
+
opacity: 0,
|
|
63
|
+
transform: "scale(0.95)",
|
|
64
|
+
transitionDuration: "100ms",
|
|
65
|
+
transitionTimingFunction: at
|
|
81
66
|
},
|
|
82
|
-
"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
animationDuration: "100ms",
|
|
88
|
-
animationTimingFunction: "cubic-bezier(0.4, 0, 1, 1)"
|
|
67
|
+
"@media (prefers-reduced-motion: reduce)": {
|
|
68
|
+
transitionDuration: "0.01ms",
|
|
69
|
+
"&[data-ending-style]": {
|
|
70
|
+
transitionDuration: "0.01ms"
|
|
71
|
+
}
|
|
89
72
|
}
|
|
90
73
|
},
|
|
91
74
|
popupPadding: {
|
|
92
|
-
...
|
|
93
|
-
...
|
|
75
|
+
...E,
|
|
76
|
+
...g.padding(et)
|
|
94
77
|
}
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
|
|
78
|
+
});
|
|
79
|
+
function y(s) {
|
|
80
|
+
const t = o.Children.toArray(s).filter(o.isValidElement);
|
|
81
|
+
return t.length === 1 ? t[0] : void 0;
|
|
82
|
+
}
|
|
83
|
+
function it(s, t, r) {
|
|
84
|
+
const e = s ? y(t) : void 0;
|
|
85
|
+
if (!e)
|
|
86
|
+
return {
|
|
87
|
+
children: /* @__PURE__ */ H(Z, { children: [
|
|
88
|
+
t,
|
|
89
|
+
r
|
|
90
|
+
] })
|
|
91
|
+
};
|
|
92
|
+
if (!r) return { render: e };
|
|
93
|
+
const i = e.props;
|
|
94
|
+
return {
|
|
95
|
+
render: o.cloneElement(e, void 0, i.children, r)
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function I(s) {
|
|
99
|
+
if (s)
|
|
100
|
+
return () => {
|
|
101
|
+
const t = new Event("focus", { cancelable: !0 }), r = document.activeElement;
|
|
102
|
+
s(t);
|
|
103
|
+
const e = document.activeElement;
|
|
104
|
+
return e !== r && e instanceof HTMLElement && queueMicrotask(() => e.focus()), !t.defaultPrevented;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const k = o.createContext(!1), h = o.createContext(null), bt = o.forwardRef(
|
|
108
|
+
function({ onOpenChange: t, ...r }, e) {
|
|
109
|
+
const [i, l] = o.useState(
|
|
110
|
+
null
|
|
111
|
+
), n = o.useMemo(() => ({ anchor: i, setAnchor: l }), [i]);
|
|
112
|
+
return /* @__PURE__ */ d(h.Provider, { value: n, children: /* @__PURE__ */ d(k.Provider, { value: r.modal === !0, children: /* @__PURE__ */ d(
|
|
113
|
+
p.Root,
|
|
114
|
+
{
|
|
115
|
+
"data-slot": "popover",
|
|
116
|
+
onOpenChange: (a, c) => {
|
|
117
|
+
if (c.reason === "escape-key" && c.event.defaultPrevented) {
|
|
118
|
+
c.cancel();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
t == null || t(a, c);
|
|
122
|
+
},
|
|
123
|
+
...r
|
|
124
|
+
}
|
|
125
|
+
) }) });
|
|
98
126
|
}
|
|
99
|
-
),
|
|
100
|
-
const
|
|
101
|
-
return /* @__PURE__ */
|
|
102
|
-
|
|
127
|
+
), Ct = o.forwardRef(function({ asChild: t = !1, children: r, className: e, ...i }, l) {
|
|
128
|
+
const n = T(), a = t ? y(r) : void 0, c = !a || typeof a.type != "string" || a.type === "button";
|
|
129
|
+
return /* @__PURE__ */ d(
|
|
130
|
+
p.Trigger,
|
|
103
131
|
{
|
|
104
|
-
ref:
|
|
132
|
+
ref: l,
|
|
105
133
|
"data-slot": "popover-trigger",
|
|
106
|
-
[
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
...
|
|
134
|
+
[m]: "popover-trigger",
|
|
135
|
+
nativeButton: c,
|
|
136
|
+
...(a == null ? void 0 : a.type) === "input" ? { type: "button" } : {},
|
|
137
|
+
className: P(!t && n.nativeTrigger, e),
|
|
138
|
+
...i,
|
|
139
|
+
...a ? { render: a } : { children: r }
|
|
112
140
|
}
|
|
113
141
|
);
|
|
114
|
-
}),
|
|
115
|
-
function(
|
|
116
|
-
return /* @__PURE__ */
|
|
117
|
-
|
|
142
|
+
}), N = o.createContext(!1), At = o.forwardRef(
|
|
143
|
+
function({ container: t, forceMount: r, ...e }, i) {
|
|
144
|
+
return /* @__PURE__ */ d(N.Provider, { value: !0, children: /* @__PURE__ */ d(
|
|
145
|
+
p.Portal,
|
|
118
146
|
{
|
|
147
|
+
ref: i,
|
|
119
148
|
"data-slot": "popover-portal",
|
|
120
|
-
[
|
|
121
|
-
|
|
149
|
+
[m]: "popover-portal",
|
|
150
|
+
container: t ?? void 0,
|
|
151
|
+
keepMounted: r,
|
|
152
|
+
...e
|
|
122
153
|
}
|
|
123
|
-
);
|
|
154
|
+
) });
|
|
124
155
|
}
|
|
125
|
-
),
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
156
|
+
), Et = o.forwardRef(function({ asChild: t = !1, children: r, virtualRef: e, ...i }, l) {
|
|
157
|
+
var c;
|
|
158
|
+
const n = (c = o.useContext(h)) == null ? void 0 : c.setAnchor, a = t ? y(r) : void 0;
|
|
159
|
+
return o.useEffect(() => {
|
|
160
|
+
e && (n == null || n(e.current));
|
|
161
|
+
}), o.useEffect(() => {
|
|
162
|
+
if (e) return () => n == null ? void 0 : n(null);
|
|
163
|
+
}, [n, e]), G({
|
|
164
|
+
render: a,
|
|
165
|
+
ref: n ? [l, n] : l,
|
|
166
|
+
enabled: !e,
|
|
167
|
+
props: {
|
|
130
168
|
"data-slot": "popover-anchor",
|
|
131
|
-
[
|
|
132
|
-
|
|
133
|
-
...
|
|
169
|
+
[m]: "popover-anchor",
|
|
170
|
+
...i,
|
|
171
|
+
...a ? {} : { children: r }
|
|
134
172
|
}
|
|
135
|
-
);
|
|
136
|
-
}),
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
173
|
+
});
|
|
174
|
+
}), st = {
|
|
175
|
+
side: "none",
|
|
176
|
+
align: "none",
|
|
177
|
+
fallbackAxisSide: "none"
|
|
178
|
+
}, ct = {
|
|
179
|
+
side: "flip",
|
|
180
|
+
align: "flip",
|
|
181
|
+
fallbackAxisSide: "none"
|
|
182
|
+
}, St = o.forwardRef(function({
|
|
183
|
+
asChild: t = !1,
|
|
184
|
+
className: r,
|
|
185
|
+
children: e,
|
|
186
|
+
forceMount: i,
|
|
187
|
+
side: l = "bottom",
|
|
188
|
+
sideOffset: n = 4,
|
|
189
|
+
align: a = "center",
|
|
190
|
+
alignOffset: c = 0,
|
|
191
|
+
arrowPadding: _ = 0,
|
|
192
|
+
avoidCollisions: w = !0,
|
|
193
|
+
collisionBoundary: v = [],
|
|
194
|
+
collisionPadding: D = 0,
|
|
195
|
+
sticky: O = "partial",
|
|
196
|
+
hideWhenDetached: R = !1,
|
|
197
|
+
updatePositionStrategy: dt,
|
|
198
|
+
onOpenAutoFocus: L,
|
|
199
|
+
onCloseAutoFocus: M,
|
|
200
|
+
flush: F = !1,
|
|
201
|
+
...X
|
|
202
|
+
}, $) {
|
|
203
|
+
var A;
|
|
204
|
+
const u = T(), z = o.useContext(N), V = (A = o.useContext(h)) == null ? void 0 : A.anchor, W = o.useContext(k), [x] = o.useState(
|
|
205
|
+
() => typeof document > "u" ? null : document.createElement("div")
|
|
206
|
+
), b = J(), Y = B(), C = /* @__PURE__ */ d(
|
|
207
|
+
p.Positioner,
|
|
140
208
|
{
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
...d !== void 0 ? { "data-density": d } : {},
|
|
145
|
-
...y,
|
|
146
|
-
align: t,
|
|
147
|
-
sideOffset: a,
|
|
148
|
-
className: f(
|
|
149
|
-
c.popup,
|
|
150
|
-
!p && c.popupPadding,
|
|
151
|
-
o
|
|
209
|
+
className: P(
|
|
210
|
+
u.positioner,
|
|
211
|
+
R && u.hideWhenDetached
|
|
152
212
|
),
|
|
153
|
-
|
|
213
|
+
anchor: V ?? void 0,
|
|
214
|
+
side: l,
|
|
215
|
+
sideOffset: n,
|
|
216
|
+
align: a,
|
|
217
|
+
alignOffset: c,
|
|
218
|
+
arrowPadding: _,
|
|
219
|
+
collisionBoundary: (Array.isArray(v) ? v : [v]).filter((j) => j !== null),
|
|
220
|
+
collisionPadding: D,
|
|
221
|
+
collisionAvoidance: w ? ct : st,
|
|
222
|
+
sticky: O === "always",
|
|
223
|
+
children: /* @__PURE__ */ d(
|
|
224
|
+
p.Popup,
|
|
225
|
+
{
|
|
226
|
+
ref: $,
|
|
227
|
+
"data-slot": "popover-content",
|
|
228
|
+
[m]: "popover-content",
|
|
229
|
+
...b !== void 0 ? { "data-density": b } : {},
|
|
230
|
+
...Y,
|
|
231
|
+
initialFocus: I(L),
|
|
232
|
+
finalFocus: I(M),
|
|
233
|
+
className: P(
|
|
234
|
+
u.popup,
|
|
235
|
+
!F && u.popupPadding,
|
|
236
|
+
r
|
|
237
|
+
),
|
|
238
|
+
...X,
|
|
239
|
+
...it(
|
|
240
|
+
t,
|
|
241
|
+
e,
|
|
242
|
+
// Base UI traps Tab in a modal popup and hides the rest of the page from assistive
|
|
243
|
+
// tech only while a Close part is inside it; Radix did both for any modal popover. This
|
|
244
|
+
// one is never seen, focused or announced.
|
|
245
|
+
W && x && q(/* @__PURE__ */ d(p.Close, { hidden: !0 }), x)
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
)
|
|
154
249
|
}
|
|
155
250
|
);
|
|
251
|
+
return z ? C : /* @__PURE__ */ d(p.Portal, { keepMounted: i, children: C });
|
|
156
252
|
});
|
|
157
253
|
export {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
254
|
+
bt as Popover,
|
|
255
|
+
Et as PopoverAnchor,
|
|
256
|
+
St as PopoverContent,
|
|
257
|
+
At as PopoverPortal,
|
|
258
|
+
Ct as PopoverTrigger
|
|
163
259
|
};
|
|
164
260
|
//# sourceMappingURL=popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","sources":["../../../src/components/popover/popover.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { useAppearanceAttributes } from \"../appearance-boundary/appearance-boundary\"\nimport { useDensity } from \"../density-provider/density-provider\"\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport { boxModel, nativeControl } from \"../../styles/host-reset\"\nimport { OVERLAY_Z_INDEX } from \"../../styles/overlay-layer\"\nimport * as tokens from \"../../tokens\"\n\nconst useStyles = makeZenithStyles({\n // For the bare native `<button>` a Trigger/Close renders. Not applied under `asChild`, where the\n // child owns its own element and two atom sets would race for the same properties.\n nativeTrigger: {\n ...nativeControl,\n },\n popup: {\n ...boxModel,\n backgroundColor: tokens.body,\n color: tokens.grayA12,\n transformOrigin: \"var(--radix-popover-content-transform-origin)\",\n ...shorthands.borderRadius(tokens.radiusXl),\n ...shorthands.border(\"1px\", \"solid\", tokens.grayA1),\n // v1 shadow-md\n boxShadow: \"0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a\",\n outlineStyle: \"none\",\n zIndex: OVERLAY_Z_INDEX,\n \"@media (prefers-reduced-motion: reduce)\": {\n animationDuration: \"0.01ms\",\n animationIterationCount: \"1\",\n \"&[data-state='open']\": {\n animationDuration: \"0.01ms\",\n },\n \"&[data-state='closed']\": {\n animationDuration: \"0.01ms\",\n },\n },\n \"&[data-state='open']\": {\n animationName: {\n from: { opacity: 0, transform: \"scale(0.95)\" },\n to: { opacity: 1, transform: \"scale(1)\" },\n },\n animationDuration: \"150ms\",\n animationTimingFunction: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n },\n \"&[data-state='open'][data-side='bottom']\": {\n animationName: {\n from: {\n opacity: 0,\n transform: `translateY(-${tokens.spacingElement2}) scale(0.95)`,\n },\n to: { opacity: 1, transform: \"translateY(0) scale(1)\" },\n },\n },\n \"&[data-state='open'][data-side='left']\": {\n animationName: {\n from: {\n opacity: 0,\n transform: `translateX(${tokens.spacingElement2}) scale(0.95)`,\n },\n to: { opacity: 1, transform: \"translateX(0) scale(1)\" },\n },\n },\n \"&[data-state='open'][data-side='right']\": {\n animationName: {\n from: {\n opacity: 0,\n transform: `translateX(-${tokens.spacingElement2}) scale(0.95)`,\n },\n to: { opacity: 1, transform: \"translateX(0) scale(1)\" },\n },\n },\n \"&[data-state='open'][data-side='top']\": {\n animationName: {\n from: {\n opacity: 0,\n transform: `translateY(${tokens.spacingElement2}) scale(0.95)`,\n },\n to: { opacity: 1, transform: \"translateY(0) scale(1)\" },\n },\n },\n \"&[data-state='closed']\": {\n animationName: {\n from: { opacity: 1, transform: \"scale(1)\" },\n to: { opacity: 0, transform: \"scale(0.95)\" },\n },\n animationDuration: \"100ms\",\n animationTimingFunction: \"cubic-bezier(0.4, 0, 1, 1)\",\n },\n },\n popupPadding: {\n ...boxModel,\n ...shorthands.padding(tokens.spacingGroup2),\n },\n})\n\nexport type PopoverProps = React.ComponentProps<typeof PopoverPrimitive.Root>\n\nexport const Popover = React.forwardRef<HTMLElement, PopoverProps>(\n function Popover(props, _ref) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />\n }\n)\n\nexport type PopoverTriggerProps = React.ComponentProps<\n typeof PopoverPrimitive.Trigger\n>\n\nexport const PopoverTrigger = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Trigger>,\n PopoverTriggerProps\n>(function PopoverTrigger({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <PopoverPrimitive.Trigger\n ref={ref}\n data-slot=\"popover-trigger\"\n {...{ [SLOT_ATTR]: \"popover-trigger\" }}\n className={mergeClasses(\n !props.asChild && styles.nativeTrigger,\n className\n )}\n {...props}\n />\n )\n})\n\nexport type PopoverPortalProps = React.ComponentProps<\n typeof PopoverPrimitive.Portal\n>\n\nexport const PopoverPortal = React.forwardRef<HTMLElement, PopoverPortalProps>(\n function PopoverPortal(props, _ref) {\n return (\n <PopoverPrimitive.Portal\n data-slot=\"popover-portal\"\n {...{ [SLOT_ATTR]: \"popover-portal\" }}\n {...props}\n />\n )\n }\n)\n\nexport type PopoverAnchorProps = React.ComponentProps<\n typeof PopoverPrimitive.Anchor\n>\n\nexport const PopoverAnchor = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Anchor>,\n PopoverAnchorProps\n>(function PopoverAnchor({ className, ...props }, ref) {\n return (\n <PopoverPrimitive.Anchor\n ref={ref}\n data-slot=\"popover-anchor\"\n {...{ [SLOT_ATTR]: \"popover-anchor\" }}\n className={className}\n {...props}\n />\n )\n})\n\nexport type PopoverContentProps = React.ComponentProps<\n typeof PopoverPrimitive.Content\n> & {\n flush?: boolean\n}\n\nexport const PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n PopoverContentProps\n>(function PopoverContent(\n { className, align = \"center\", sideOffset = 4, flush = false, ...props },\n ref\n) {\n const styles = useStyles()\n // DENSITY-SPEC.md §4.4 — portal content boundary; see dialog.tsx's identical comment.\n const override = useDensity()\n // SPEC.md §2 rule 3 — the same portal asymmetry, for the appearance pair: re-stamp the\n // nearest explicit AppearanceBoundary's mode+surface, or neither attribute when there is\n // none, leaving live shell inheritance in place.\n const appearance = useAppearanceAttributes()\n\n return (\n <PopoverPrimitive.Content\n ref={ref}\n data-slot=\"popover-content\"\n {...{ [SLOT_ATTR]: \"popover-content\" }}\n {...(override !== undefined ? { \"data-density\": override } : {})}\n {...appearance}\n align={align}\n sideOffset={sideOffset}\n className={mergeClasses(\n styles.popup,\n !flush && styles.popupPadding,\n className\n )}\n {...props}\n />\n )\n})\n"],"names":["useStyles","makeZenithStyles","nativeControl","boxModel","tokens.body","tokens.grayA12","shorthands","tokens.radiusXl","tokens.grayA1","OVERLAY_Z_INDEX","tokens.spacingElement2","tokens.spacingGroup2","Popover","React","props","_ref","PopoverPrimitive.Root","PopoverTrigger","className","ref","styles","jsx","PopoverPrimitive.Trigger","SLOT_ATTR","mergeClasses","PopoverPortal","PopoverPrimitive.Portal","PopoverAnchor","PopoverPrimitive.Anchor","PopoverContent","align","sideOffset","flush","override","useDensity","appearance","useAppearanceAttributes","PopoverPrimitive.Content"],"mappings":";;;;;;;;;;AAaA,MAAMA,IAAYC,EAAiB;AAAA;AAAA;AAAA,EAGjC,eAAe;AAAA,IACb,GAAGC;AAAA,EAAA;AAAA,EAEL,OAAO;AAAA,IACL,GAAGC;AAAA,IACH,iBAAiBC;AAAAA,IACjB,OAAOC;AAAAA,IACP,iBAAiB;AAAA,IACjB,GAAGC,EAAW,aAAaC,CAAe;AAAA,IAC1C,GAAGD,EAAW,OAAO,OAAO,SAASE,CAAa;AAAA;AAAA,IAElD,WAAW;AAAA,IACX,cAAc;AAAA,IACd,QAAQC;AAAA,IACR,2CAA2C;AAAA,MACzC,mBAAmB;AAAA,MACnB,yBAAyB;AAAA,MACzB,wBAAwB;AAAA,QACtB,mBAAmB;AAAA,MAAA;AAAA,MAErB,0BAA0B;AAAA,QACxB,mBAAmB;AAAA,MAAA;AAAA,IACrB;AAAA,IAEF,wBAAwB;AAAA,MACtB,eAAe;AAAA,QACb,MAAM,EAAE,SAAS,GAAG,WAAW,cAAA;AAAA,QAC/B,IAAI,EAAE,SAAS,GAAG,WAAW,WAAA;AAAA,MAAW;AAAA,MAE1C,mBAAmB;AAAA,MACnB,yBAAyB;AAAA,IAAA;AAAA,IAE3B,4CAA4C;AAAA,MAC1C,eAAe;AAAA,QACb,MAAM;AAAA,UACJ,SAAS;AAAA,UACT,WAAW,eAAeC,CAAsB;AAAA,QAAA;AAAA,QAElD,IAAI,EAAE,SAAS,GAAG,WAAW,yBAAA;AAAA,MAAyB;AAAA,IACxD;AAAA,IAEF,0CAA0C;AAAA,MACxC,eAAe;AAAA,QACb,MAAM;AAAA,UACJ,SAAS;AAAA,UACT,WAAW,cAAcA,CAAsB;AAAA,QAAA;AAAA,QAEjD,IAAI,EAAE,SAAS,GAAG,WAAW,yBAAA;AAAA,MAAyB;AAAA,IACxD;AAAA,IAEF,2CAA2C;AAAA,MACzC,eAAe;AAAA,QACb,MAAM;AA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QACC,aAAU;AAAA,QACJ,CAACH,CAAS,GAAG;AAAA,QAClB,GAAGT;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF,GAMaa,IAAgBd,EAAM,WAGjC,SAAuB,EAAE,WAAAK,GAAW,GAAGJ,EAAA,GAASK,GAAK;AACrD,SACE,gBAAAE;AAAA,IAACO;AAAAA,IAAA;AAAA,MACC,KAAAT;AAAA,MACA,aAAU;AAAA,MACJ,CAACI,CAAS,GAAG;AAAA,MACnB,WAAAL;AAAA,MACC,GAAGJ;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC,GAQYe,IAAiBhB,EAAM,WAGlC,SACA,EAAE,WAAAK,GAAW,OAAAY,IAAQ,UAAU,YAAAC,IAAa,GAAG,OAAAC,IAAQ,IAAO,GAAGlB,EAAA,GACjEK,GACA;AACA,QAAMC,IAASpB,EAAA,GAETiC,IAAWC,EAAA,GAIXC,IAAaC,EAAA;AAEnB,SACE,gBAAAf;AAAA,IAACgB;AAAAA,IAAA;AAAA,MACC,KAAAlB;AAAA,MACA,aAAU;AAAA,MACJ,CAACI,CAAS,GAAG;AAAA,MAClB,GAAIU,MAAa,SAAY,EAAE,gBAAgBA,EAAA,IAAa,CAAA;AAAA,MAC5D,GAAGE;AAAA,MACJ,OAAAL;AAAA,MACA,YAAAC;AAAA,MACA,WAAWP;AAAA,QACTJ,EAAO;AAAA,QACP,CAACY,KAASZ,EAAO;AAAA,QACjBF;AAAA,MAAA;AAAA,MAED,GAAGJ;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;"}
|
|
1
|
+
{"version":3,"file":"popover.js","sources":["../../../src/components/popover/popover.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { createPortal } from \"react-dom\"\n\nimport { Popover as PopoverPrimitive } from \"@base-ui/react/popover\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { useAppearanceAttributes } from \"../appearance-boundary/appearance-boundary\"\nimport { useDensity } from \"../density-provider/density-provider\"\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport { boxModel, nativeControl } from \"../../styles/host-reset\"\nimport { OVERLAY_Z_INDEX } from \"../../styles/overlay-layer\"\nimport * as tokens from \"../../tokens\"\n\nconst easeOut = \"cubic-bezier(0.4, 0, 0.2, 1)\"\nconst easeIn = \"cubic-bezier(0.4, 0, 1, 1)\"\n\nconst useStyles = makeZenithStyles({\n // For the bare native `<button>` a Trigger/Close renders. Not applied under `asChild`, where the\n // child owns its own element and two atom sets would race for the same properties.\n nativeTrigger: {\n ...nativeControl,\n },\n // The positioner is what stacks against other layers, as Radix's popper wrapper did; it also\n // keeps that wrapper's `max-content` floor so the content wraps the same way.\n positioner: {\n zIndex: OVERLAY_Z_INDEX,\n minWidth: \"max-content\",\n },\n hideWhenDetached: {\n \"&[data-anchor-hidden]\": {\n visibility: \"hidden\",\n pointerEvents: \"none\",\n },\n },\n popup: {\n ...boxModel,\n backgroundColor: tokens.body,\n color: tokens.grayA12,\n transformOrigin: \"var(--transform-origin)\",\n ...shorthands.borderRadius(tokens.radiusXl),\n ...shorthands.border(\"1px\", \"solid\", tokens.grayA1),\n // v1 shadow-md\n boxShadow: \"0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a\",\n outlineStyle: \"none\",\n zIndex: OVERLAY_Z_INDEX,\n transitionProperty: \"opacity, transform\",\n transitionDuration: \"150ms\",\n transitionTimingFunction: easeOut,\n \"&[data-starting-style]\": {\n opacity: 0,\n transform: \"scale(0.95)\",\n },\n \"&[data-starting-style][data-side='bottom']\": {\n transform: `translateY(-${tokens.spacingElement2}) scale(0.95)`,\n },\n \"&[data-starting-style][data-side='left']\": {\n transform: `translateX(${tokens.spacingElement2}) scale(0.95)`,\n },\n \"&[data-starting-style][data-side='right']\": {\n transform: `translateX(-${tokens.spacingElement2}) scale(0.95)`,\n },\n \"&[data-starting-style][data-side='top']\": {\n transform: `translateY(${tokens.spacingElement2}) scale(0.95)`,\n },\n \"&[data-ending-style]\": {\n opacity: 0,\n transform: \"scale(0.95)\",\n transitionDuration: \"100ms\",\n transitionTimingFunction: easeIn,\n },\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0.01ms\",\n \"&[data-ending-style]\": {\n transitionDuration: \"0.01ms\",\n },\n },\n },\n popupPadding: {\n ...boxModel,\n ...shorthands.padding(tokens.spacingGroup2),\n },\n})\n\n// A single child can arrive wrapped in a one-element array depending on the JSX runtime (MDX call\n// sites do this). Radix's Slot normalised that, so the `asChild` shim has to as well.\nfunction onlySlotChild(children: React.ReactNode) {\n const elements = React.Children.toArray(children).filter(React.isValidElement)\n return elements.length === 1 ? elements[0] : undefined\n}\n\n/**\n * Radix's `asChild` over Base UI's `render`: the single child element becomes the part and keeps\n * its own children, since Base UI lets the rendered element's props win the merge. `extra` joins\n * the part's children, after the caller's.\n */\nfunction contentSlotProps(\n asChild: boolean,\n children: React.ReactNode,\n extra: React.ReactNode\n) {\n const child = asChild ? onlySlotChild(children) : undefined\n if (!child)\n return {\n children: (\n <>\n {children}\n {extra}\n </>\n ),\n }\n if (!extra) return { render: child }\n const childProps = child.props as { children?: React.ReactNode }\n return {\n render: React.cloneElement(child, undefined, childProps.children, extra),\n }\n}\n\n/**\n * A part's props as they were under Radix: its native element's own (DOM attributes, React's\n * handler types, a `CSSProperties` style, a string `className`, `ref`) plus `asChild`. Base UI's\n * prop types widen `style` and `className` to functions of the part's state, wrap every handler's\n * event in `BaseUIEvent` and add props of their own; none of that reaches the public surface.\n */\ntype NativePartProps<Tag extends \"button\" | \"div\"> =\n React.ComponentProps<Tag> & {\n /** Renders the single child element as this part, merging its props and behaviour onto it. */\n asChild?: boolean\n }\n\n/**\n * Radix-shaped focus interception over Base UI's `initialFocus`/`finalFocus`. `preventDefault()`\n * leaves focus where it is; otherwise the default move happens, because Base UI reads a callback\n * that returns `undefined` as \"move nothing\".\n */\nfunction radixFocusCallback(handler: ((event: Event) => void) | undefined) {\n if (!handler) return undefined\n\n return () => {\n const event = new Event(\"focus\", { cancelable: true })\n const before = document.activeElement\n handler(event)\n const moved = document.activeElement\n // Base UI calls `finalFocus` inside React's commit, and React then restores the focus it saw\n // before the commit. Radix ran this handler after the commit, so a handler that moves focus\n // itself has its move applied again once the commit is done.\n if (moved !== before && moved instanceof HTMLElement) {\n queueMicrotask(() => moved.focus())\n }\n return !event.defaultPrevented\n }\n}\n\n/**\n * What `onOpenChange` receives as its second argument: Base UI's change details, declared in\n * Zenith. Base UI's own type drags its popover store into the published declarations, and\n * TypeScript 4 cannot parse that store. `event` narrows with `reason`, as it does in Base UI.\n */\ntype PopoverOpenChangeDetails = (\n | {\n reason: \"trigger-press\"\n event: MouseEvent | PointerEvent | TouchEvent | KeyboardEvent\n }\n | { reason: \"trigger-hover\"; event: MouseEvent }\n | { reason: \"trigger-focus\"; event: FocusEvent }\n | { reason: \"outside-press\"; event: MouseEvent | PointerEvent | TouchEvent }\n | { reason: \"escape-key\"; event: KeyboardEvent }\n | { reason: \"close-press\"; event: MouseEvent | KeyboardEvent | PointerEvent }\n | { reason: \"focus-out\"; event: FocusEvent | KeyboardEvent }\n | { reason: \"imperative-action\"; event: Event }\n | { reason: \"none\"; event: Event }\n) & {\n /** Keeps the popover in its current state. */\n cancel: () => void\n /** Lets the event propagate where the popover would otherwise stop it. */\n allowPropagation: () => void\n isCanceled: boolean\n isPropagationAllowed: boolean\n /** The element that caused the change, if any. */\n trigger: Element | undefined\n /** Keeps the popover's elements mounted after it closes. */\n preventUnmountOnClose: () => void\n}\n\n// Whether the root is modal, for PopoverContent's close part.\nconst PopoverModalContext = React.createContext(false)\n\n/** Anything with a client rect, which is all positioning reads from an anchor. */\ntype Measurable = { getBoundingClientRect(): DOMRect }\n\n// Radix modelled a custom anchor as a part; Base UI takes the element as the Positioner's\n// `anchor`. PopoverAnchor registers its element here and PopoverContent reads it back.\nconst PopoverAnchorContext = React.createContext<{\n anchor: Element | Measurable | null\n setAnchor: (anchor: Element | Measurable | null) => void\n} | null>(null)\n\nexport type PopoverProps = {\n children?: React.ReactNode\n open?: boolean\n defaultOpen?: boolean\n /**\n * While open, keeps Tab inside the popover, hides the rest of the page from assistive tech,\n * locks page scroll and blocks pointer interaction outside it.\n */\n modal?: boolean\n /**\n * Called when the popover opens or closes. `eventDetails.reason` says why (`trigger-press`,\n * `escape-key`, `outside-press`, `focus-out`) and `eventDetails.cancel()` keeps the popover in\n * its current state.\n */\n onOpenChange?: (open: boolean, eventDetails: PopoverOpenChangeDetails) => void\n}\n\nexport const Popover = React.forwardRef<HTMLElement, PopoverProps>(\n function Popover({ onOpenChange, ...props }, _ref) {\n const [anchor, setAnchor] = React.useState<Element | Measurable | null>(\n null\n )\n const anchorContext = React.useMemo(() => ({ anchor, setAnchor }), [anchor])\n\n return (\n <PopoverAnchorContext.Provider value={anchorContext}>\n <PopoverModalContext.Provider value={props.modal === true}>\n <PopoverPrimitive.Root\n data-slot=\"popover\"\n onOpenChange={(open, eventDetails) => {\n // A layer inside (a Volt select or menu, which run on Radix, or a control\n // handling the key itself) prevents the Escape it consumes, but Base UI\n // dismisses regardless, so one Escape would close both. Honour the handled\n // event. Consumers still mix Zenith with Volt on one page, so this stays\n // after the Radix teardown (D12).\n if (\n eventDetails.reason === \"escape-key\" &&\n eventDetails.event.defaultPrevented\n ) {\n eventDetails.cancel()\n return\n }\n onOpenChange?.(open, eventDetails)\n }}\n {...props}\n />\n </PopoverModalContext.Provider>\n </PopoverAnchorContext.Provider>\n )\n }\n)\n\nexport type PopoverTriggerProps = NativePartProps<\"button\">\n\nexport const PopoverTrigger = React.forwardRef<\n HTMLButtonElement,\n PopoverTriggerProps\n>(function PopoverTrigger(\n { asChild = false, children, className, ...props },\n ref\n) {\n const styles = useStyles()\n const child = asChild ? onlySlotChild(children) : undefined\n // Base UI drives a native <button> unless told otherwise; a child that is another intrinsic\n // element gets the ARIA button behaviour instead. A component child counts as a button: Base UI\n // checks the rendered tag on first mount, before a component's element can be known.\n const nativeButton =\n !child || typeof child.type !== \"string\" || child.type === \"button\"\n\n return (\n <PopoverPrimitive.Trigger\n ref={ref}\n data-slot=\"popover-trigger\"\n {...{ [SLOT_ATTR]: \"popover-trigger\" }}\n nativeButton={nativeButton}\n // Radix stamped type=\"button\" on any child, so an input child stays a button input; Base UI\n // only stamps it on a native button. The child's own type still wins.\n {...(child?.type === \"input\" ? { type: \"button\" } : {})}\n className={mergeClasses(!asChild && styles.nativeTrigger, className)}\n {...props}\n {...(child ? { render: child } : { children })}\n />\n )\n})\n\n// Lets PopoverContent supply Base UI's required Portal itself when no PopoverPortal wraps it.\nconst PopoverPortalPresenceContext = React.createContext(false)\n\nexport type PopoverPortalProps = {\n children?: React.ReactNode\n /** The element the content portals into; `document.body` when omitted or null. */\n container?: Element | DocumentFragment | null\n /** Keeps the content mounted while the popover is closed. */\n forceMount?: true\n}\n\nexport const PopoverPortal = React.forwardRef<HTMLElement, PopoverPortalProps>(\n function PopoverPortal({ container, forceMount, ...props }, ref) {\n return (\n <PopoverPortalPresenceContext.Provider value={true}>\n <PopoverPrimitive.Portal\n // Base UI types the ref as its portal div, which any HTMLElement ref can hold.\n ref={ref as React.Ref<HTMLDivElement>}\n data-slot=\"popover-portal\"\n {...{ [SLOT_ATTR]: \"popover-portal\" }}\n // Radix took any Element or DocumentFragment, null meaning the body. Base UI hands a\n // node straight to createPortal, which takes either, but reads null as \"wait for one\".\n container={(container ?? undefined) as HTMLElement | undefined}\n keepMounted={forceMount}\n {...props}\n />\n </PopoverPortalPresenceContext.Provider>\n )\n }\n)\n\nexport type PopoverAnchorProps = NativePartProps<\"div\"> & {\n /** Anchors the popover to something other than an element, such as a text selection; renders nothing. */\n virtualRef?: React.RefObject<{ getBoundingClientRect(): DOMRect }>\n}\n\nexport const PopoverAnchor = React.forwardRef<\n HTMLDivElement,\n PopoverAnchorProps\n>(function PopoverAnchor(\n { asChild = false, children, virtualRef, ...props },\n ref\n) {\n const setAnchor = React.useContext(PopoverAnchorContext)?.setAnchor\n const child = asChild ? onlySlotChild(children) : undefined\n\n // Read after every commit, as Radix did: the ref's target can change without a render.\n React.useEffect(() => {\n if (virtualRef) setAnchor?.(virtualRef.current)\n })\n React.useEffect(() => {\n if (virtualRef) return () => setAnchor?.(null)\n }, [setAnchor, virtualRef])\n\n return useRender({\n render: child,\n ref: setAnchor ? [ref, setAnchor] : ref,\n enabled: !virtualRef,\n props: {\n \"data-slot\": \"popover-anchor\",\n [SLOT_ATTR]: \"popover-anchor\",\n ...props,\n ...(child ? {} : { children }),\n },\n })\n})\n\ntype Side = \"top\" | \"right\" | \"bottom\" | \"left\"\ntype Boundary = Element | null\n\n// Radix let only `avoidCollisions={false}` switch both flip and shift off.\nconst NO_COLLISION_AVOIDANCE = {\n side: \"none\",\n align: \"none\",\n fallbackAxisSide: \"none\",\n} as const\n// Radix flipped to the opposite side and swapped start/end, never to the perpendicular axis.\nconst RADIX_COLLISION_AVOIDANCE = {\n side: \"flip\",\n align: \"flip\",\n fallbackAxisSide: \"none\",\n} as const\n\nexport type PopoverContentProps = NativePartProps<\"div\"> & {\n /**\n * Keeps the content mounted while the popover is closed. Inside PopoverPortal, the portal's\n * `forceMount` decides.\n */\n forceMount?: true\n side?: \"top\" | \"right\" | \"bottom\" | \"left\"\n sideOffset?: number\n align?: \"start\" | \"center\" | \"end\"\n alignOffset?: number\n arrowPadding?: number\n /** Flips and shifts the content to keep it in view. */\n avoidCollisions?: boolean\n /** The elements the content stays within; the viewport when omitted. */\n collisionBoundary?: Boundary | Boundary[]\n collisionPadding?: number | Partial<Record<Side, number>>\n /**\n * `\"partial\"` keeps the content attached to the trigger while any of it is in view; `\"always\"`\n * keeps the content in view even when that detaches it.\n */\n sticky?: \"partial\" | \"always\"\n /** Hides the content while the trigger is fully out of view. */\n hideWhenDetached?: boolean\n /**\n * Kept for compatibility. The position follows the trigger's resizes, layout shifts and scrolls\n * either way; `\"always\"` no longer re-measures on every animation frame.\n */\n updatePositionStrategy?: \"optimized\" | \"always\"\n /** Called before focus moves into the popover; `preventDefault()` leaves focus where it is. */\n onOpenAutoFocus?: (event: Event) => void\n /** Called before focus returns on close; `preventDefault()` skips the return. */\n onCloseAutoFocus?: (event: Event) => void\n flush?: boolean\n}\n\nexport const PopoverContent = React.forwardRef<\n HTMLDivElement,\n PopoverContentProps\n>(function PopoverContent(\n {\n asChild = false,\n className,\n children,\n forceMount,\n side = \"bottom\",\n sideOffset = 4,\n align = \"center\",\n alignOffset = 0,\n arrowPadding = 0,\n avoidCollisions = true,\n collisionBoundary = [],\n collisionPadding = 0,\n sticky = \"partial\",\n hideWhenDetached = false,\n updatePositionStrategy: _updatePositionStrategy,\n onOpenAutoFocus,\n onCloseAutoFocus,\n flush = false,\n ...props\n },\n ref\n) {\n const styles = useStyles()\n const hasPortal = React.useContext(PopoverPortalPresenceContext)\n const anchor = React.useContext(PopoverAnchorContext)?.anchor\n const modal = React.useContext(PopoverModalContext)\n // Base UI counts a Close part through React context, not DOM containment, so the part renders\n // into a node that is never attached: it takes no place among the caller's children.\n const [closePartHost] = React.useState(() =>\n typeof document === \"undefined\" ? null : document.createElement(\"div\")\n )\n // DENSITY-SPEC.md §4.4 — portal content boundary; see dialog.tsx's identical comment.\n const override = useDensity()\n // SPEC.md §2 rule 3 — the same portal asymmetry, for the appearance pair: re-stamp the\n // nearest explicit AppearanceBoundary's mode+surface, or neither attribute when there is\n // none, leaving live shell inheritance in place.\n const appearance = useAppearanceAttributes()\n\n const positioner = (\n <PopoverPrimitive.Positioner\n className={mergeClasses(\n styles.positioner,\n hideWhenDetached && styles.hideWhenDetached\n )}\n anchor={anchor ?? undefined}\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n arrowPadding={arrowPadding}\n // Radix's default boundary is the viewport alone, not every clipping ancestor.\n collisionBoundary={(Array.isArray(collisionBoundary)\n ? collisionBoundary\n : [collisionBoundary]\n ).filter((element): element is Element => element !== null)}\n collisionPadding={collisionPadding}\n collisionAvoidance={\n avoidCollisions ? RADIX_COLLISION_AVOIDANCE : NO_COLLISION_AVOIDANCE\n }\n sticky={sticky === \"always\"}\n >\n <PopoverPrimitive.Popup\n ref={ref}\n data-slot=\"popover-content\"\n {...{ [SLOT_ATTR]: \"popover-content\" }}\n {...(override !== undefined ? { \"data-density\": override } : {})}\n {...appearance}\n initialFocus={radixFocusCallback(onOpenAutoFocus)}\n finalFocus={radixFocusCallback(onCloseAutoFocus)}\n className={mergeClasses(\n styles.popup,\n !flush && styles.popupPadding,\n className\n )}\n {...props}\n {...contentSlotProps(\n asChild,\n children,\n // Base UI traps Tab in a modal popup and hides the rest of the page from assistive\n // tech only while a Close part is inside it; Radix did both for any modal popover. This\n // one is never seen, focused or announced.\n modal &&\n closePartHost &&\n createPortal(<PopoverPrimitive.Close hidden />, closePartHost)\n )}\n />\n </PopoverPrimitive.Positioner>\n )\n\n // Base UI's Positioner requires a Portal ancestor; Radix rendered inline without one.\n return hasPortal ? (\n positioner\n ) : (\n <PopoverPrimitive.Portal keepMounted={forceMount}>\n {positioner}\n </PopoverPrimitive.Portal>\n )\n})\n"],"names":["easeOut","easeIn","useStyles","makeZenithStyles","nativeControl","OVERLAY_Z_INDEX","boxModel","tokens.body","tokens.grayA12","shorthands","tokens.radiusXl","tokens.grayA1","tokens.spacingElement2","tokens.spacingGroup2","onlySlotChild","children","elements","React","contentSlotProps","asChild","extra","child","jsxs","Fragment","childProps","radixFocusCallback","handler","event","before","moved","PopoverModalContext","PopoverAnchorContext","Popover","onOpenChange","props","_ref","anchor","setAnchor","anchorContext","jsx","PopoverPrimitive","open","eventDetails","PopoverTrigger","className","ref","styles","nativeButton","SLOT_ATTR","mergeClasses","PopoverPortalPresenceContext","PopoverPortal","container","forceMount","PopoverAnchor","virtualRef","_a","useRender","NO_COLLISION_AVOIDANCE","RADIX_COLLISION_AVOIDANCE","PopoverContent","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","_updatePositionStrategy","onOpenAutoFocus","onCloseAutoFocus","flush","hasPortal","modal","closePartHost","override","useDensity","appearance","useAppearanceAttributes","positioner","element","createPortal"],"mappings":";;;;;;;;;;;;AAeA,MAAMA,KAAU,gCACVC,KAAS,8BAETC,IAAYC,EAAiB;AAAA;AAAA;AAAA,EAGjC,eAAe;AAAA,IACb,GAAGC;AAAA,EAAA;AAAA;AAAA;AAAA,EAIL,YAAY;AAAA,IACV,QAAQC;AAAA,IACR,UAAU;AAAA,EAAA;AAAA,EAEZ,kBAAkB;AAAA,IAChB,yBAAyB;AAAA,MACvB,YAAY;AAAA,MACZ,eAAe;AAAA,IAAA;AAAA,EACjB;AAAA,EAEF,OAAO;AAAA,IACL,GAAGC;AAAA,IACH,iBAAiBC;AAAAA,IACjB,OAAOC;AAAAA,IACP,iBAAiB;AAAA,IACjB,GAAGC,EAAW,aAAaC,EAAe;AAAA,IAC1C,GAAGD,EAAW,OAAO,OAAO,SAASE,EAAa;AAAA;AAAA,IAElD,WAAW;AAAA,IACX,cAAc;AAAA,IACd,QAAQN;AAAA,IACR,oBAAoB;AAAA,IACpB,oBAAoB;AAAA,IACpB,0BAA0BL;AAAA,IAC1B,0BAA0B;AAAA,MACxB,SAAS;AAAA,MACT,WAAW;AAAA,IAAA;AAAA,IAEb,8CAA8C;AAAA,MAC5C,WAAW,eAAeY,CAAsB;AAAA,IAAA;AAAA,IAElD,4CAA4C;AAAA,MAC1C,WAAW,cAAcA,CAAsB;AAAA,IAAA;AAAA,IAEjD,6CAA6C;AAAA,MAC3C,WAAW,eAAeA,CAAsB;AAAA,IAAA;AAAA,IAElD,2CAA2C;AAAA,MACzC,WAAW,cAAcA,CAAsB;AAAA,IAAA;AAAA,IAEjD,wBAAwB;AAAA,MACtB,SAAS;AAAA,MACT,WAAW;AAAA,MACX,oBAAoB;AAAA,MACpB,0BAA0BX;AAAA,IAAA;AAAA,IAE5B,2CAA2C;AAAA,MACzC,oBAAoB;AAAA,MACpB,wBAAwB;AAAA,Q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AAgCA,MAAY,IAAI;AAAA,MAC1D,kBAAAf;AAAA,MACA,oBACEF,IAAkBP,KAA4BD;AAAA,MAEhD,QAAQW,MAAW;AAAA,MAEnB,UAAA,gBAAA9B;AAAA,QAACC,EAAiB;AAAA,QAAjB;AAAA,UACC,KAAAK;AAAA,UACA,aAAU;AAAA,UACJ,CAACG,CAAS,GAAG;AAAA,UAClB,GAAI8B,MAAa,SAAY,EAAE,gBAAgBA,EAAA,IAAa,CAAA;AAAA,UAC5D,GAAGE;AAAA,UACJ,cAAcvD,EAAmB+C,CAAe;AAAA,UAChD,YAAY/C,EAAmBgD,CAAgB;AAAA,UAC/C,WAAWxB;AAAA,YACTH,EAAO;AAAA,YACP,CAAC4B,KAAS5B,EAAO;AAAA,YACjBF;AAAA,UAAA;AAAA,UAED,GAAGV;AAAA,UACH,GAAGhB;AAAA,YACFC;AAAA,YACAJ;AAAA;AAAA;AAAA;AAAA,YAIA6D,KACEC,KACAO,EAAa,gBAAA7C,EAACC,EAAiB,OAAjB,EAAuB,QAAM,GAAA,CAAC,GAAIqC,CAAa;AAAA,UAAA;AAAA,QACjE;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAKJ,SAAOF,IACLO,IAEA,gBAAA3C,EAACC,EAAiB,QAAjB,EAAwB,aAAaa,GACnC,UAAA6B,GACH;AAEJ,CAAC;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as k } from "react/jsx-runtime";
|
|
2
|
+
import * as H from "react";
|
|
3
|
+
import { RadioGroup as g } from "../../_virtual/_zenith-runtime-family_radio-group.js";
|
|
4
|
+
import { DirectionProvider as n } from "../../_virtual/_zenith-runtime-family_direction-provider.js";
|
|
5
|
+
const w = "ArrowDown", h = "ArrowUp";
|
|
6
|
+
function B(r, { orientation: i, loop: l, rtl: a }) {
|
|
7
|
+
var A, m, y, R;
|
|
8
|
+
if (r.altKey || r.ctrlKey || r.metaKey || r.shiftKey) return;
|
|
9
|
+
const t = r.key === "Home" || r.key === "End", s = a ? "ArrowLeft" : "ArrowRight", u = a ? "ArrowRight" : "ArrowLeft", f = r.key === w || r.key === s, c = r.key === h || r.key === u;
|
|
10
|
+
if (!t && !f && !c) return;
|
|
11
|
+
if (!t) {
|
|
12
|
+
const d = r.key === w || r.key === h;
|
|
13
|
+
if (i === "horizontal" && d || i === "vertical" && !d) {
|
|
14
|
+
(A = r.preventBaseUIHandler) == null || A.call(r);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const o = Array.from(
|
|
19
|
+
r.currentTarget.querySelectorAll('[role="radio"]')
|
|
20
|
+
).filter(
|
|
21
|
+
(d) => !d.hasAttribute("data-disabled") && !d.disabled
|
|
22
|
+
), p = o.indexOf(r.target);
|
|
23
|
+
if (p !== -1) {
|
|
24
|
+
if (t) {
|
|
25
|
+
r.preventDefault(), (m = r.preventBaseUIHandler) == null || m.call(r), (y = o[r.key === "Home" ? 0 : o.length - 1]) == null || y.focus();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
!l && (f && p === o.length - 1 || c && p === 0) && ((R = r.preventBaseUIHandler) == null || R.call(r));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const x = H.forwardRef(function({ orientation: i, loop: l = !0, dir: a, value: t, onKeyDown: s, ...u }, f) {
|
|
32
|
+
const c = /* @__PURE__ */ k(
|
|
33
|
+
g,
|
|
34
|
+
{
|
|
35
|
+
ref: f,
|
|
36
|
+
"aria-orientation": i,
|
|
37
|
+
dir: a,
|
|
38
|
+
value: t,
|
|
39
|
+
...u,
|
|
40
|
+
onKeyDown: (o) => {
|
|
41
|
+
s == null || s(o), !o.defaultPrevented && B(o, {
|
|
42
|
+
orientation: i,
|
|
43
|
+
loop: l,
|
|
44
|
+
rtl: a === "rtl"
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
return a === void 0 ? c : /* @__PURE__ */ k(n, { direction: a, children: c });
|
|
50
|
+
});
|
|
51
|
+
export {
|
|
52
|
+
x as RadioGroupBase
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=radio-group-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-group-base.js","sources":["../../../src/components/radio/radio-group-base.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { RadioGroup as RadioGroupPrimitive } from \"@base-ui/react/radio-group\"\nimport { DirectionProvider } from \"@base-ui/react/direction-provider\"\n\nexport type RadioGroupOrientation = \"horizontal\" | \"vertical\"\n\ntype KeyboardOptions = {\n orientation: RadioGroupOrientation | undefined\n loop: boolean\n rtl: boolean\n}\n\n// Base UI's merged handlers: the rightmost runs first, and it can keep the group's own from running.\ntype BaseUIKeyboardEvent = React.KeyboardEvent<HTMLElement> & {\n preventBaseUIHandler?: () => void\n}\n\nconst FORWARD_VERTICAL = \"ArrowDown\"\nconst BACKWARD_VERTICAL = \"ArrowUp\"\n\n/**\n * The keyboard model Radix's roving focus gave a radio group and Base UI's does not: Home and End\n * move focus to the first and last enabled option, `orientation` limits the arrow keys to one axis,\n * and `loop={false}` stops at the ends. Arrow selection itself stays Base UI's. Runs before Base\n * UI's handler and keeps it from running for a key the group ignores.\n */\nfunction handleRadioGroupKeyDown(\n event: BaseUIKeyboardEvent,\n { orientation, loop, rtl }: KeyboardOptions\n) {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return\n\n const isHomeEnd = event.key === \"Home\" || event.key === \"End\"\n const forwardHorizontal = rtl ? \"ArrowLeft\" : \"ArrowRight\"\n const backwardHorizontal = rtl ? \"ArrowRight\" : \"ArrowLeft\"\n const isForward =\n event.key === FORWARD_VERTICAL || event.key === forwardHorizontal\n const isBackward =\n event.key === BACKWARD_VERTICAL || event.key === backwardHorizontal\n if (!isHomeEnd && !isForward && !isBackward) return\n\n if (!isHomeEnd) {\n const vertical =\n event.key === FORWARD_VERTICAL || event.key === BACKWARD_VERTICAL\n if (\n (orientation === \"horizontal\" && vertical) ||\n (orientation === \"vertical\" && !vertical)\n ) {\n event.preventBaseUIHandler?.()\n return\n }\n }\n\n const radios = Array.from(\n event.currentTarget.querySelectorAll<HTMLElement>('[role=\"radio\"]')\n ).filter(\n (radio) =>\n !radio.hasAttribute(\"data-disabled\") &&\n !(radio as HTMLButtonElement).disabled\n )\n const index = radios.indexOf(event.target as HTMLElement)\n if (index === -1) return\n\n if (isHomeEnd) {\n event.preventDefault()\n event.preventBaseUIHandler?.()\n radios[event.key === \"Home\" ? 0 : radios.length - 1]?.focus()\n return\n }\n\n if (\n !loop &&\n ((isForward && index === radios.length - 1) || (isBackward && index === 0))\n ) {\n event.preventBaseUIHandler?.()\n }\n}\n\nexport type RadioGroupBaseProps = Omit<\n RadioGroupPrimitive.Props<string>,\n \"onKeyDown\" | \"dir\" | \"value\"\n> & {\n // `null` is a controlled group with nothing selected, which Radix took.\n value?: string | null | undefined\n onKeyDown?: React.KeyboardEventHandler<HTMLDivElement> | undefined\n orientation?: RadioGroupOrientation | undefined\n dir?: \"ltr\" | \"rtl\" | undefined\n loop?: boolean | undefined\n}\n\n/**\n * Base UI's radio group with Radix's keyboard model, `orientation` as `aria-orientation` and `dir`\n * (which Base UI reads from its own provider). Shared by `RadioGroup` and `SegmentedControl`.\n */\nexport const RadioGroupBase = React.forwardRef<\n HTMLDivElement,\n RadioGroupBaseProps\n>(function RadioGroupBase(\n { orientation, loop = true, dir, value, onKeyDown, ...props },\n ref\n) {\n const group = (\n <RadioGroupPrimitive\n ref={ref}\n aria-orientation={orientation}\n dir={dir}\n // Base UI takes `null` as no selection at runtime; its string-typed generic does not say so.\n value={value as string | undefined}\n {...props}\n onKeyDown={(event) => {\n onKeyDown?.(event)\n if (event.defaultPrevented) return\n handleRadioGroupKeyDown(event, {\n orientation,\n loop,\n rtl: dir === \"rtl\",\n })\n }}\n />\n )\n\n return dir === undefined ? (\n group\n ) : (\n <DirectionProvider direction={dir}>{group}</DirectionProvider>\n )\n})\n"],"names":["FORWARD_VERTICAL","BACKWARD_VERTICAL","handleRadioGroupKeyDown","event","orientation","loop","rtl","isHomeEnd","forwardHorizontal","backwardHorizontal","isForward","isBackward","vertical","_a","radios","radio","index","_b","_c","_d","RadioGroupBase","React","dir","value","onKeyDown","props","ref","group","jsx","RadioGroupPrimitive","DirectionProvider"],"mappings":";;;;AAiBA,MAAMA,IAAmB,aACnBC,IAAoB;AAQ1B,SAASC,EACPC,GACA,EAAE,aAAAC,GAAa,MAAAC,GAAM,KAAAC,KACrB;;AACA,MAAIH,EAAM,UAAUA,EAAM,WAAWA,EAAM,WAAWA,EAAM,SAAU;AAEtE,QAAMI,IAAYJ,EAAM,QAAQ,UAAUA,EAAM,QAAQ,OAClDK,IAAoBF,IAAM,cAAc,cACxCG,IAAqBH,IAAM,eAAe,aAC1CI,IACJP,EAAM,QAAQH,KAAoBG,EAAM,QAAQK,GAC5CG,IACJR,EAAM,QAAQF,KAAqBE,EAAM,QAAQM;AACnD,MAAI,CAACF,KAAa,CAACG,KAAa,CAACC,EAAY;AAE7C,MAAI,CAACJ,GAAW;AACd,UAAMK,IACJT,EAAM,QAAQH,KAAoBG,EAAM,QAAQF;AAClD,QACGG,MAAgB,gBAAgBQ,KAChCR,MAAgB,cAAc,CAACQ,GAChC;AACA,OAAAC,IAAAV,EAAM,yBAAN,QAAAU,EAAA,KAAAV;AACA;AAAA,IACF;AAAA,EACF;AAEA,QAAMW,IAAS,MAAM;AAAA,IACnBX,EAAM,cAAc,iBAA8B,gBAAgB;AAAA,EAAA,EAClE;AAAA,IACA,CAACY,MACC,CAACA,EAAM,aAAa,eAAe,KACnC,CAAEA,EAA4B;AAAA,EAAA,GAE5BC,IAAQF,EAAO,QAAQX,EAAM,MAAqB;AACxD,MAAIa,MAAU,IAEd;AAAA,QAAIT,GAAW;AACb,MAAAJ,EAAM,eAAA,IACNc,IAAAd,EAAM,yBAAN,QAAAc,EAAA,KAAAd,KACAe,IAAAJ,EAAOX,EAAM,QAAQ,SAAS,IAA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