aeon-ui-engine 1.5.1 → 1.9.0
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/CHANGELOG.md +140 -0
- package/package.json +6 -3
- package/packages/core/dist/index.d.ts +116 -1
- package/packages/core/dist/index.js +202 -1
- package/packages/core/src/anatomy.ts +13 -1
- package/packages/core/src/index.ts +2 -0
- package/packages/core/src/list-window.ts +149 -0
- package/packages/core/src/sound.ts +154 -0
- package/packages/panda/package.json +6 -3
- package/packages/panda/panda.config.ts +12 -0
- package/packages/panda/src/recipes/clipboard.ts +40 -0
- package/packages/panda/src/recipes/composer.ts +4 -3
- package/packages/panda/src/recipes/index.ts +4 -0
- package/packages/panda/src/recipes/prose.ts +110 -0
- package/packages/panda/src/recipes/segment-group.ts +50 -0
- package/packages/panda/src/recipes/textarea.ts +60 -0
- package/packages/panda/styled-system/css/conditions.d.ts +7 -0
- package/packages/panda/styled-system/css/conditions.js +32 -0
- package/packages/panda/styled-system/css/css.d.ts +6 -6
- package/packages/panda/styled-system/css/css.js +63 -0
- package/packages/panda/styled-system/css/cva.d.ts +2 -3
- package/packages/panda/styled-system/css/cva.js +51 -0
- package/packages/panda/styled-system/css/cx.d.ts +5 -4
- package/packages/panda/styled-system/css/{cx.mjs → cx.js} +5 -4
- package/packages/panda/styled-system/css/first-that-works.d.ts +22 -0
- package/packages/panda/styled-system/css/first-that-works.js +1 -0
- package/packages/panda/styled-system/css/index.d.ts +6 -3
- package/packages/panda/styled-system/css/index.js +8 -0
- package/packages/panda/styled-system/css/keyframes.d.ts +5 -0
- package/packages/panda/styled-system/css/keyframes.js +8 -0
- package/packages/panda/styled-system/css/position-try.d.ts +5 -0
- package/packages/panda/styled-system/css/position-try.js +11 -0
- package/packages/panda/styled-system/css/sva.d.ts +1 -2
- package/packages/panda/styled-system/css/sva.js +49 -0
- package/packages/panda/styled-system/css/view-transition.d.ts +7 -0
- package/packages/panda/styled-system/css/view-transition.js +18 -0
- package/packages/panda/styled-system/helpers.d.ts +67 -0
- package/packages/panda/styled-system/helpers.js +624 -0
- package/packages/panda/styled-system/jsx/aspect-ratio.d.ts +3 -6
- package/packages/panda/styled-system/jsx/aspect-ratio.js +11 -0
- package/packages/panda/styled-system/jsx/bleed.d.ts +4 -7
- package/packages/panda/styled-system/jsx/bleed.js +11 -0
- package/packages/panda/styled-system/jsx/box.d.ts +4 -7
- package/packages/panda/styled-system/jsx/box.js +11 -0
- package/packages/panda/styled-system/jsx/center.d.ts +4 -7
- package/packages/panda/styled-system/jsx/center.js +11 -0
- package/packages/panda/styled-system/jsx/circle.d.ts +4 -7
- package/packages/panda/styled-system/jsx/circle.js +11 -0
- package/packages/panda/styled-system/jsx/container.d.ts +4 -7
- package/packages/panda/styled-system/jsx/container.js +11 -0
- package/packages/panda/styled-system/jsx/cq.d.ts +4 -7
- package/packages/panda/styled-system/jsx/cq.js +11 -0
- package/packages/panda/styled-system/jsx/create-recipe-context.d.ts +31 -0
- package/packages/panda/styled-system/jsx/create-recipe-context.js +38 -0
- package/packages/panda/styled-system/jsx/create-slot-recipe-context.d.ts +49 -0
- package/packages/panda/styled-system/jsx/create-slot-recipe-context.js +124 -0
- package/packages/panda/styled-system/jsx/divider.d.ts +4 -7
- package/packages/panda/styled-system/jsx/divider.js +11 -0
- package/packages/panda/styled-system/jsx/factory.d.ts +2 -2
- package/packages/panda/styled-system/jsx/factory.js +91 -0
- package/packages/panda/styled-system/jsx/flex.d.ts +4 -7
- package/packages/panda/styled-system/jsx/flex.js +11 -0
- package/packages/panda/styled-system/jsx/float.d.ts +4 -7
- package/packages/panda/styled-system/jsx/float.js +11 -0
- package/packages/panda/styled-system/jsx/grid-item.d.ts +4 -7
- package/packages/panda/styled-system/jsx/grid-item.js +11 -0
- package/packages/panda/styled-system/jsx/grid.d.ts +4 -7
- package/packages/panda/styled-system/jsx/grid.js +11 -0
- package/packages/panda/styled-system/jsx/helper.d.ts +34 -0
- package/packages/panda/styled-system/jsx/helper.js +92 -0
- package/packages/panda/styled-system/jsx/hstack.d.ts +4 -7
- package/packages/panda/styled-system/jsx/hstack.js +11 -0
- package/packages/panda/styled-system/jsx/index.d.ts +17 -17
- package/packages/panda/styled-system/jsx/index.js +24 -0
- package/packages/panda/styled-system/jsx/is-valid-prop.d.ts +5 -10
- package/packages/panda/styled-system/jsx/is-valid-prop.js +12 -0
- package/packages/panda/styled-system/jsx/link-overlay.d.ts +4 -7
- package/packages/panda/styled-system/jsx/link-overlay.js +11 -0
- package/packages/panda/styled-system/jsx/spacer.d.ts +4 -7
- package/packages/panda/styled-system/jsx/spacer.js +11 -0
- package/packages/panda/styled-system/jsx/square.d.ts +4 -7
- package/packages/panda/styled-system/jsx/square.js +11 -0
- package/packages/panda/styled-system/jsx/stack.d.ts +4 -7
- package/packages/panda/styled-system/jsx/stack.js +11 -0
- package/packages/panda/styled-system/jsx/visually-hidden.d.ts +4 -7
- package/packages/panda/styled-system/jsx/visually-hidden.js +11 -0
- package/packages/panda/styled-system/jsx/vstack.d.ts +4 -7
- package/packages/panda/styled-system/jsx/vstack.js +11 -0
- package/packages/panda/styled-system/jsx/wrap.d.ts +4 -7
- package/packages/panda/styled-system/jsx/wrap.js +11 -0
- package/packages/panda/styled-system/patterns/aspect-ratio.d.ts +8 -9
- package/packages/panda/styled-system/patterns/aspect-ratio.js +37 -0
- package/packages/panda/styled-system/patterns/bleed.d.ts +9 -10
- package/packages/panda/styled-system/patterns/bleed.js +30 -0
- package/packages/panda/styled-system/patterns/box.d.ts +8 -11
- package/packages/panda/styled-system/patterns/box.js +16 -0
- package/packages/panda/styled-system/patterns/center.d.ts +8 -9
- package/packages/panda/styled-system/patterns/center.js +22 -0
- package/packages/panda/styled-system/patterns/circle.d.ts +8 -9
- package/packages/panda/styled-system/patterns/circle.js +26 -0
- package/packages/panda/styled-system/patterns/container.d.ts +8 -11
- package/packages/panda/styled-system/patterns/container.js +26 -0
- package/packages/panda/styled-system/patterns/cq.d.ts +10 -10
- package/packages/panda/styled-system/patterns/cq.js +24 -0
- package/packages/panda/styled-system/patterns/divider.d.ts +11 -11
- package/packages/panda/styled-system/patterns/divider.js +31 -0
- package/packages/panda/styled-system/patterns/flex.d.ts +14 -15
- package/packages/panda/styled-system/patterns/flex.js +27 -0
- package/packages/panda/styled-system/patterns/float.d.ts +12 -12
- package/packages/panda/styled-system/patterns/float.js +84 -0
- package/packages/panda/styled-system/patterns/grid-item.d.ts +13 -14
- package/packages/panda/styled-system/patterns/grid-item.js +26 -0
- package/packages/panda/styled-system/patterns/grid.d.ts +13 -13
- package/packages/panda/styled-system/patterns/grid.js +30 -0
- package/packages/panda/styled-system/patterns/hstack.d.ts +9 -10
- package/packages/panda/styled-system/patterns/hstack.js +27 -0
- package/packages/panda/styled-system/patterns/index.d.ts +14 -15
- package/packages/panda/styled-system/patterns/index.js +20 -0
- package/packages/panda/styled-system/patterns/link-overlay.d.ts +8 -11
- package/packages/panda/styled-system/patterns/link-overlay.js +25 -0
- package/packages/panda/styled-system/patterns/runtime.js +25 -0
- package/packages/panda/styled-system/patterns/spacer.d.ts +9 -9
- package/packages/panda/styled-system/patterns/spacer.js +26 -0
- package/packages/panda/styled-system/patterns/square.d.ts +8 -9
- package/packages/panda/styled-system/patterns/square.js +25 -0
- package/packages/panda/styled-system/patterns/stack.d.ts +11 -12
- package/packages/panda/styled-system/patterns/stack.js +30 -0
- package/packages/panda/styled-system/patterns/visually-hidden.d.ts +8 -11
- package/packages/panda/styled-system/patterns/visually-hidden.js +19 -0
- package/packages/panda/styled-system/patterns/vstack.d.ts +9 -10
- package/packages/panda/styled-system/patterns/vstack.js +27 -0
- package/packages/panda/styled-system/patterns/wrap.d.ts +12 -13
- package/packages/panda/styled-system/patterns/wrap.js +26 -0
- package/packages/panda/styled-system/recipes/aeon-accordion.d.ts +9 -26
- package/packages/panda/styled-system/recipes/aeon-accordion.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-app-shell.d.ts +10 -26
- package/packages/panda/styled-system/recipes/aeon-app-shell.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-async.d.ts +9 -26
- package/packages/panda/styled-system/recipes/aeon-async.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-avatar.d.ts +10 -28
- package/packages/panda/styled-system/recipes/aeon-avatar.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-badge.d.ts +8 -26
- package/packages/panda/styled-system/recipes/aeon-badge.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-bar.d.ts +13 -32
- package/packages/panda/styled-system/recipes/aeon-bar.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-button-group.d.ts +10 -33
- package/packages/panda/styled-system/recipes/aeon-button-group.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-button.d.ts +10 -33
- package/packages/panda/styled-system/recipes/aeon-button.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-checkbox.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-checkbox.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-clipboard.d.ts +16 -0
- package/packages/panda/styled-system/recipes/aeon-clipboard.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-combobox.d.ts +9 -26
- package/packages/panda/styled-system/recipes/aeon-combobox.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-composer.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-composer.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-content.d.ts +10 -26
- package/packages/panda/styled-system/recipes/aeon-content.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-conversation.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-conversation.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-dialog.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-dialog.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-entry.d.ts +11 -30
- package/packages/panda/styled-system/recipes/aeon-entry.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-field.d.ts +9 -26
- package/packages/panda/styled-system/recipes/aeon-field.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-file-upload.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-file-upload.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-identity.d.ts +10 -28
- package/packages/panda/styled-system/recipes/aeon-identity.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-list-row.d.ts +9 -26
- package/packages/panda/styled-system/recipes/aeon-list-row.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-menu.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-menu.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-metric-strip.d.ts +10 -28
- package/packages/panda/styled-system/recipes/aeon-metric-strip.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-nav.d.ts +11 -30
- package/packages/panda/styled-system/recipes/aeon-nav.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-panel.d.ts +10 -26
- package/packages/panda/styled-system/recipes/aeon-panel.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-pin-input.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-pin-input.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-popover.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-popover.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-profile-header.d.ts +10 -28
- package/packages/panda/styled-system/recipes/aeon-profile-header.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-progress.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-progress.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-prose.d.ts +16 -0
- package/packages/panda/styled-system/recipes/aeon-prose.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-radio-group.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-radio-group.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-range-slider.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-range-slider.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-scroll.d.ts +12 -36
- package/packages/panda/styled-system/recipes/aeon-scroll.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-segment-group.d.ts +18 -0
- package/packages/panda/styled-system/recipes/aeon-segment-group.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-select.d.ts +9 -26
- package/packages/panda/styled-system/recipes/aeon-select.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-separator.d.ts +10 -26
- package/packages/panda/styled-system/recipes/aeon-separator.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-slider.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-slider.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-switch.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-switch.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-tabs.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-tabs.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-textarea.d.ts +18 -0
- package/packages/panda/styled-system/recipes/aeon-textarea.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-theme-switcher.d.ts +10 -26
- package/packages/panda/styled-system/recipes/aeon-theme-switcher.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-thread.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-thread.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-toast.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-toast.js +5 -0
- package/packages/panda/styled-system/recipes/aeon-tooltip.d.ts +9 -24
- package/packages/panda/styled-system/recipes/aeon-tooltip.js +5 -0
- package/packages/panda/styled-system/recipes/index.d.ts +31 -28
- package/packages/panda/styled-system/recipes/index.js +43 -0
- package/packages/panda/styled-system/recipes/runtime.js +133 -0
- package/packages/panda/styled-system/styles.css +1899 -2110
- package/packages/panda/styled-system/tokens/index.d.ts +4 -5
- package/packages/panda/styled-system/tokens/index.js +18 -0
- package/packages/panda/styled-system/types/index.d.ts +3 -6
- package/packages/panda/styled-system/types/jsx.d.ts +36 -27
- package/packages/panda/styled-system/types/pattern.d.ts +18 -70
- package/packages/panda/styled-system/types/recipe.d.ts +50 -154
- package/packages/panda/styled-system/types/system.d.ts +1826 -0
- package/packages/panda/styled-system/types/tokens.d.ts +65 -0
- package/packages/panda/tsconfig.json +3 -1
- package/packages/primitives/dist/chunk-5BNAV4S2.js +258 -0
- package/packages/primitives/dist/chunk-HYHCIMHC.js +45 -0
- package/packages/primitives/dist/index.d.ts +2 -0
- package/packages/primitives/dist/index.js +30 -12
- package/packages/primitives/dist/machines/app-nav.d.ts +3 -3
- package/packages/primitives/dist/machines/cache.d.ts +223 -0
- package/packages/primitives/dist/machines/cache.js +14 -0
- package/packages/primitives/dist/machines/clipboard.d.ts +46 -0
- package/packages/primitives/dist/machines/clipboard.js +8 -0
- package/packages/primitives/dist/machines/tabs.d.ts +2 -2
- package/packages/primitives/src/index.ts +2 -0
- package/packages/primitives/src/machines/cache.ts +395 -0
- package/packages/primitives/src/machines/clipboard.ts +56 -0
- package/packages/react/dist/index.d.ts +134 -13
- package/packages/react/dist/index.js +1429 -1016
- package/packages/react/src/clipboard/index.tsx +117 -0
- package/packages/react/src/composer/index.tsx +14 -5
- package/packages/react/src/dialog/index.tsx +11 -3
- package/packages/react/src/floating/FloatingPositioner.tsx +11 -1
- package/packages/react/src/index.ts +4 -0
- package/packages/react/src/menu/index.tsx +8 -3
- package/packages/react/src/popover/index.tsx +25 -4
- package/packages/react/src/prose/index.tsx +11 -0
- package/packages/react/src/radio-group/index.tsx +2 -1
- package/packages/react/src/scroll/index.tsx +1 -0
- package/packages/react/src/scroll/use-windowed-range.ts +118 -0
- package/packages/react/src/segment-group/index.tsx +171 -0
- package/packages/react/src/select/index.tsx +11 -2
- package/packages/react/src/slider/index.tsx +13 -6
- package/packages/react/src/tabs/index.tsx +19 -7
- package/packages/react/src/textarea/index.tsx +75 -0
- package/packages/react/src/utils/assign-ref.ts +7 -0
- package/packages/schemas/dist/index.d.ts +8 -0
- package/packages/schemas/dist/index.js +62 -1
- package/packages/schemas/json/catalog.json +493 -0
- package/packages/schemas/json/clipboard.json +136 -0
- package/packages/schemas/json/prose.json +103 -0
- package/packages/schemas/json/segmentGroup.json +131 -0
- package/packages/schemas/json/textarea.json +119 -0
- package/packages/schemas/prompts/statecharts.md +1 -1
- package/packages/schemas/registry/catalog.json +34 -0
- package/packages/schemas/registry/components/clipboard.json +136 -0
- package/packages/schemas/registry/components/prose.json +103 -0
- package/packages/schemas/registry/components/segmentGroup.json +131 -0
- package/packages/schemas/registry/components/textarea.json +119 -0
- package/packages/schemas/registry/machines/clipboard.json +110 -0
- package/packages/schemas/registry/machines/slider.json +18 -1
- package/packages/schemas/scripts/emit.ts +2 -0
- package/packages/schemas/src/components.ts +63 -0
- package/packages/tree/README.md +29 -0
- package/packages/tree/dist/index.d.ts +97 -0
- package/packages/tree/dist/index.js +107 -0
- package/packages/tree/package.json +42 -0
- package/packages/tree/src/exclusive-action.ts +104 -0
- package/packages/tree/src/index.ts +7 -0
- package/packages/tree/src/interpret.tsx +45 -0
- package/packages/tree/src/totality.ts +20 -0
- package/packages/tree/src/widget.ts +31 -0
- package/packages/tree/tsconfig.json +8 -0
- package/packages/tree/vitest.config.ts +8 -0
- package/packages/ui/dist/index.d.ts +27 -3
- package/packages/ui/dist/index.js +232 -165
- package/packages/ui/src/clipboard.tsx +51 -0
- package/packages/ui/src/index.ts +4 -0
- package/packages/ui/src/prose.tsx +15 -0
- package/packages/ui/src/segment-group.tsx +28 -0
- package/packages/ui/src/textarea.tsx +17 -0
- package/scripts/vite-aliases.mjs +5 -2
- package/packages/cli/node_modules/.bin/esbuild +0 -21
- package/packages/cli/node_modules/.bin/jiti +0 -21
- package/packages/cli/node_modules/.bin/tsc +0 -21
- package/packages/cli/node_modules/.bin/tsserver +0 -21
- package/packages/cli/node_modules/.bin/tsup +0 -21
- package/packages/cli/node_modules/.bin/tsup-node +0 -21
- package/packages/cli/node_modules/.bin/tsx +0 -21
- package/packages/cli/node_modules/.bin/vite +0 -21
- package/packages/cli/node_modules/.bin/vitest +0 -21
- package/packages/core/node_modules/.bin/esbuild +0 -21
- package/packages/core/node_modules/.bin/jiti +0 -21
- package/packages/core/node_modules/.bin/tsc +0 -21
- package/packages/core/node_modules/.bin/tsserver +0 -21
- package/packages/core/node_modules/.bin/tsup +0 -21
- package/packages/core/node_modules/.bin/tsup-node +0 -21
- package/packages/core/node_modules/.bin/tsx +0 -21
- package/packages/core/node_modules/.bin/vite +0 -21
- package/packages/core/node_modules/.bin/vitest +0 -21
- package/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/core/src/identicon.test.ts +0 -39
- package/packages/core/src/machine.test.ts +0 -79
- package/packages/core/src/theme.test.ts +0 -14
- package/packages/geometry/node_modules/.bin/esbuild +0 -21
- package/packages/geometry/node_modules/.bin/jiti +0 -21
- package/packages/geometry/node_modules/.bin/tsc +0 -21
- package/packages/geometry/node_modules/.bin/tsserver +0 -21
- package/packages/geometry/node_modules/.bin/tsup +0 -21
- package/packages/geometry/node_modules/.bin/tsup-node +0 -21
- package/packages/geometry/node_modules/.bin/tsx +0 -21
- package/packages/panda/styled-system/css/conditions.mjs +0 -36
- package/packages/panda/styled-system/css/css.mjs +0 -45
- package/packages/panda/styled-system/css/cva.mjs +0 -87
- package/packages/panda/styled-system/css/index.mjs +0 -4
- package/packages/panda/styled-system/css/sva.mjs +0 -46
- package/packages/panda/styled-system/helpers.mjs +0 -328
- package/packages/panda/styled-system/jsx/aspect-ratio.mjs +0 -14
- package/packages/panda/styled-system/jsx/bleed.mjs +0 -14
- package/packages/panda/styled-system/jsx/box.mjs +0 -14
- package/packages/panda/styled-system/jsx/center.mjs +0 -14
- package/packages/panda/styled-system/jsx/circle.mjs +0 -14
- package/packages/panda/styled-system/jsx/container.mjs +0 -14
- package/packages/panda/styled-system/jsx/cq.mjs +0 -14
- package/packages/panda/styled-system/jsx/create-style-context.d.ts +0 -54
- package/packages/panda/styled-system/jsx/create-style-context.mjs +0 -121
- package/packages/panda/styled-system/jsx/divider.mjs +0 -14
- package/packages/panda/styled-system/jsx/factory-helper.mjs +0 -22
- package/packages/panda/styled-system/jsx/factory.mjs +0 -89
- package/packages/panda/styled-system/jsx/flex.mjs +0 -14
- package/packages/panda/styled-system/jsx/float.mjs +0 -14
- package/packages/panda/styled-system/jsx/grid-item.mjs +0 -14
- package/packages/panda/styled-system/jsx/grid.mjs +0 -14
- package/packages/panda/styled-system/jsx/hstack.mjs +0 -14
- package/packages/panda/styled-system/jsx/index.mjs +0 -23
- package/packages/panda/styled-system/jsx/is-valid-prop.mjs +0 -17
- package/packages/panda/styled-system/jsx/link-overlay.mjs +0 -14
- package/packages/panda/styled-system/jsx/spacer.mjs +0 -14
- package/packages/panda/styled-system/jsx/square.mjs +0 -14
- package/packages/panda/styled-system/jsx/stack.mjs +0 -14
- package/packages/panda/styled-system/jsx/visually-hidden.mjs +0 -14
- package/packages/panda/styled-system/jsx/vstack.mjs +0 -14
- package/packages/panda/styled-system/jsx/wrap.mjs +0 -14
- package/packages/panda/styled-system/patterns/aspect-ratio.mjs +0 -38
- package/packages/panda/styled-system/patterns/bleed.mjs +0 -24
- package/packages/panda/styled-system/patterns/box.mjs +0 -15
- package/packages/panda/styled-system/patterns/center.mjs +0 -21
- package/packages/panda/styled-system/patterns/circle.mjs +0 -25
- package/packages/panda/styled-system/patterns/container.mjs +0 -21
- package/packages/panda/styled-system/patterns/cq.mjs +0 -21
- package/packages/panda/styled-system/patterns/divider.mjs +0 -25
- package/packages/panda/styled-system/patterns/flex.mjs +0 -26
- package/packages/panda/styled-system/patterns/float.mjs +0 -52
- package/packages/panda/styled-system/patterns/grid-item.mjs +0 -25
- package/packages/panda/styled-system/patterns/grid.mjs +0 -27
- package/packages/panda/styled-system/patterns/hstack.mjs +0 -24
- package/packages/panda/styled-system/patterns/index.mjs +0 -20
- package/packages/panda/styled-system/patterns/link-overlay.mjs +0 -24
- package/packages/panda/styled-system/patterns/spacer.mjs +0 -25
- package/packages/panda/styled-system/patterns/square.mjs +0 -24
- package/packages/panda/styled-system/patterns/stack.mjs +0 -24
- package/packages/panda/styled-system/patterns/visually-hidden.mjs +0 -18
- package/packages/panda/styled-system/patterns/vstack.mjs +0 -24
- package/packages/panda/styled-system/patterns/wrap.mjs +0 -25
- package/packages/panda/styled-system/recipes/aeon-accordion.mjs +0 -49
- package/packages/panda/styled-system/recipes/aeon-app-shell.mjs +0 -70
- package/packages/panda/styled-system/recipes/aeon-async.mjs +0 -57
- package/packages/panda/styled-system/recipes/aeon-avatar.mjs +0 -57
- package/packages/panda/styled-system/recipes/aeon-badge.mjs +0 -32
- package/packages/panda/styled-system/recipes/aeon-bar.mjs +0 -77
- package/packages/panda/styled-system/recipes/aeon-button-group.mjs +0 -37
- package/packages/panda/styled-system/recipes/aeon-button.mjs +0 -39
- package/packages/panda/styled-system/recipes/aeon-checkbox.mjs +0 -49
- package/packages/panda/styled-system/recipes/aeon-combobox.mjs +0 -53
- package/packages/panda/styled-system/recipes/aeon-composer.mjs +0 -57
- package/packages/panda/styled-system/recipes/aeon-content.mjs +0 -70
- package/packages/panda/styled-system/recipes/aeon-conversation.mjs +0 -61
- package/packages/panda/styled-system/recipes/aeon-dialog.mjs +0 -61
- package/packages/panda/styled-system/recipes/aeon-entry.mjs +0 -100
- package/packages/panda/styled-system/recipes/aeon-field.mjs +0 -53
- package/packages/panda/styled-system/recipes/aeon-file-upload.mjs +0 -61
- package/packages/panda/styled-system/recipes/aeon-identity.mjs +0 -63
- package/packages/panda/styled-system/recipes/aeon-list-row.mjs +0 -49
- package/packages/panda/styled-system/recipes/aeon-menu.mjs +0 -53
- package/packages/panda/styled-system/recipes/aeon-metric-strip.mjs +0 -54
- package/packages/panda/styled-system/recipes/aeon-nav.mjs +0 -69
- package/packages/panda/styled-system/recipes/aeon-panel.mjs +0 -58
- package/packages/panda/styled-system/recipes/aeon-pin-input.mjs +0 -37
- package/packages/panda/styled-system/recipes/aeon-popover.mjs +0 -53
- package/packages/panda/styled-system/recipes/aeon-profile-header.mjs +0 -62
- package/packages/panda/styled-system/recipes/aeon-progress.mjs +0 -45
- package/packages/panda/styled-system/recipes/aeon-radio-group.mjs +0 -49
- package/packages/panda/styled-system/recipes/aeon-range-slider.mjs +0 -49
- package/packages/panda/styled-system/recipes/aeon-scroll.mjs +0 -64
- package/packages/panda/styled-system/recipes/aeon-select.mjs +0 -57
- package/packages/panda/styled-system/recipes/aeon-separator.mjs +0 -42
- package/packages/panda/styled-system/recipes/aeon-slider.mjs +0 -49
- package/packages/panda/styled-system/recipes/aeon-switch.mjs +0 -49
- package/packages/panda/styled-system/recipes/aeon-tabs.mjs +0 -49
- package/packages/panda/styled-system/recipes/aeon-theme-switcher.mjs +0 -59
- package/packages/panda/styled-system/recipes/aeon-thread.mjs +0 -73
- package/packages/panda/styled-system/recipes/aeon-toast.mjs +0 -49
- package/packages/panda/styled-system/recipes/aeon-tooltip.mjs +0 -49
- package/packages/panda/styled-system/recipes/create-recipe.mjs +0 -82
- package/packages/panda/styled-system/recipes/index.mjs +0 -39
- package/packages/panda/styled-system/tokens/index.mjs +0 -2224
- package/packages/panda/styled-system/tokens/tokens.d.ts +0 -60
- package/packages/panda/styled-system/types/composition.d.ts +0 -227
- package/packages/panda/styled-system/types/conditions.d.ts +0 -346
- package/packages/panda/styled-system/types/csstype.d.ts +0 -22570
- package/packages/panda/styled-system/types/global.d.ts +0 -20
- package/packages/panda/styled-system/types/parts.d.ts +0 -8
- package/packages/panda/styled-system/types/prop-type.d.ts +0 -250
- package/packages/panda/styled-system/types/selectors.d.ts +0 -59
- package/packages/panda/styled-system/types/static-css.d.ts +0 -56
- package/packages/panda/styled-system/types/style-props.d.ts +0 -8089
- package/packages/panda/styled-system/types/system-types.d.ts +0 -151
- package/packages/primitives/node_modules/.bin/esbuild +0 -21
- package/packages/primitives/node_modules/.bin/jiti +0 -21
- package/packages/primitives/node_modules/.bin/tsc +0 -21
- package/packages/primitives/node_modules/.bin/tsserver +0 -21
- package/packages/primitives/node_modules/.bin/tsup +0 -21
- package/packages/primitives/node_modules/.bin/tsup-node +0 -21
- package/packages/primitives/node_modules/.bin/tsx +0 -21
- package/packages/primitives/node_modules/.bin/vite +0 -21
- package/packages/primitives/node_modules/.bin/vitest +0 -21
- package/packages/primitives/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/primitives/src/__tests__/app-nav.test.ts +0 -30
- package/packages/primitives/src/__tests__/file-upload.test.ts +0 -25
- package/packages/primitives/src/__tests__/floating-surface.test.ts +0 -29
- package/packages/primitives/src/__tests__/range-slider.test.ts +0 -39
- package/packages/react/node_modules/.bin/esbuild +0 -21
- package/packages/react/node_modules/.bin/jiti +0 -21
- package/packages/react/node_modules/.bin/tsc +0 -21
- package/packages/react/node_modules/.bin/tsserver +0 -21
- package/packages/react/node_modules/.bin/tsup +0 -21
- package/packages/react/node_modules/.bin/tsup-node +0 -21
- package/packages/react/node_modules/.bin/tsx +0 -21
- package/packages/react/node_modules/.bin/vite +0 -21
- package/packages/react/node_modules/.bin/vitest +0 -21
- package/packages/react/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/react/src/avatar/avatar.test.tsx +0 -27
- package/packages/react/src/dialog/dialog.test.tsx +0 -50
- package/packages/react/src/select/select.test.tsx +0 -81
- package/packages/react/src/toast/toast.test.tsx +0 -40
- package/packages/react/src/tooltip/tooltip.test.tsx +0 -122
- package/packages/react-scene/node_modules/.bin/jiti +0 -21
- package/packages/react-scene/node_modules/.bin/tsc +0 -21
- package/packages/react-scene/node_modules/.bin/tsserver +0 -21
- package/packages/react-scene/node_modules/.bin/tsup +0 -21
- package/packages/react-scene/node_modules/.bin/tsup-node +0 -21
- package/packages/react-scene/node_modules/.bin/tsx +0 -21
- package/packages/scene/node_modules/.bin/jiti +0 -21
- package/packages/scene/node_modules/.bin/tsc +0 -21
- package/packages/scene/node_modules/.bin/tsserver +0 -21
- package/packages/scene/node_modules/.bin/tsup +0 -21
- package/packages/scene/node_modules/.bin/tsup-node +0 -21
- package/packages/scene/node_modules/.bin/tsx +0 -21
- package/packages/schemas/node_modules/.bin/esbuild +0 -21
- package/packages/schemas/node_modules/.bin/jiti +0 -21
- package/packages/schemas/node_modules/.bin/tsc +0 -21
- package/packages/schemas/node_modules/.bin/tsserver +0 -21
- package/packages/schemas/node_modules/.bin/tsup +0 -21
- package/packages/schemas/node_modules/.bin/tsup-node +0 -21
- package/packages/schemas/node_modules/.bin/tsx +0 -21
- package/packages/schemas/node_modules/.bin/vite +0 -21
- package/packages/schemas/node_modules/.bin/vitest +0 -21
- package/packages/schemas/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/packages/schemas/src/aeon-to-schema.test.ts +0 -70
- package/packages/schemas/src/index.test.ts +0 -108
- package/packages/signal/node_modules/.bin/jiti +0 -21
- package/packages/signal/node_modules/.bin/tsc +0 -21
- package/packages/signal/node_modules/.bin/tsserver +0 -21
- package/packages/signal/node_modules/.bin/tsup +0 -21
- package/packages/signal/node_modules/.bin/tsup-node +0 -21
- package/packages/signal/node_modules/.bin/tsx +0 -21
- package/packages/site/node_modules/.bin/jiti +0 -21
- package/packages/site/node_modules/.bin/tsc +0 -21
- package/packages/site/node_modules/.bin/tsserver +0 -21
- package/packages/site/node_modules/.bin/tsup +0 -21
- package/packages/site/node_modules/.bin/tsup-node +0 -21
- package/packages/site/node_modules/.bin/tsx +0 -21
- package/packages/solid/node_modules/.bin/jiti +0 -21
- package/packages/solid/node_modules/.bin/tsc +0 -21
- package/packages/solid/node_modules/.bin/tsserver +0 -21
- package/packages/solid/node_modules/.bin/tsup +0 -21
- package/packages/solid/node_modules/.bin/tsup-node +0 -21
- package/packages/solid/node_modules/.bin/tsx +0 -21
- package/packages/surface/node_modules/.bin/jiti +0 -21
- package/packages/surface/node_modules/.bin/tsc +0 -21
- package/packages/surface/node_modules/.bin/tsserver +0 -21
- package/packages/surface/node_modules/.bin/tsup +0 -21
- package/packages/surface/node_modules/.bin/tsup-node +0 -21
- package/packages/surface/node_modules/.bin/tsx +0 -21
- package/packages/svelte/node_modules/.bin/acorn +0 -21
- package/packages/svelte/node_modules/.bin/esbuild +0 -21
- package/packages/svelte/node_modules/.bin/jiti +0 -21
- package/packages/svelte/node_modules/.bin/svelte-check +0 -21
- package/packages/svelte/node_modules/.bin/tsc +0 -21
- package/packages/svelte/node_modules/.bin/tsserver +0 -21
- package/packages/svelte/node_modules/.bin/tsup +0 -21
- package/packages/svelte/node_modules/.bin/tsup-node +0 -21
- package/packages/svelte/node_modules/.bin/tsx +0 -21
- package/packages/svelte/node_modules/.bin/vite +0 -21
- package/packages/ui/node_modules/.bin/jiti +0 -21
- package/packages/ui/node_modules/.bin/tsc +0 -21
- package/packages/ui/node_modules/.bin/tsserver +0 -21
- package/packages/ui/node_modules/.bin/tsup +0 -21
- package/packages/ui/node_modules/.bin/tsup-node +0 -21
- package/packages/ui/node_modules/.bin/tsx +0 -21
- package/packages/vue/node_modules/.bin/jiti +0 -21
- package/packages/vue/node_modules/.bin/tsc +0 -21
- package/packages/vue/node_modules/.bin/tsserver +0 -21
- package/packages/vue/node_modules/.bin/tsup +0 -21
- package/packages/vue/node_modules/.bin/tsup-node +0 -21
- package/packages/vue/node_modules/.bin/tsx +0 -21
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { clipboardAnatomy, partAttrs, partOnlyAttrs } from '@aeon-ui/core'
|
|
2
|
+
import { clipboardMachine, type ClipboardStatus } from '@aeon-ui/primitives'
|
|
3
|
+
import {
|
|
4
|
+
createContext,
|
|
5
|
+
forwardRef,
|
|
6
|
+
useContext,
|
|
7
|
+
useMemo,
|
|
8
|
+
type ButtonHTMLAttributes,
|
|
9
|
+
type CSSProperties,
|
|
10
|
+
type HTMLAttributes,
|
|
11
|
+
type MouseEvent,
|
|
12
|
+
type ReactNode,
|
|
13
|
+
} from 'react'
|
|
14
|
+
import { useAeonMachine } from '../hooks/use-aeon-machine.js'
|
|
15
|
+
import { mergeProps } from '../utils/merge-props.js'
|
|
16
|
+
|
|
17
|
+
interface ClipboardContextValue {
|
|
18
|
+
status: ClipboardStatus
|
|
19
|
+
copy: () => void
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const ClipboardCtx = createContext<ClipboardContextValue | null>(null)
|
|
23
|
+
|
|
24
|
+
function useClipboardCtx() {
|
|
25
|
+
const ctx = useContext(ClipboardCtx)
|
|
26
|
+
if (!ctx) throw new Error('Clipboard parts must be used within Clipboard.Root')
|
|
27
|
+
return ctx
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Read the copy status from any part inside Clipboard.Root. */
|
|
31
|
+
export const useClipboardStatus = () => useClipboardCtx().status
|
|
32
|
+
|
|
33
|
+
const visuallyHidden: CSSProperties = {
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
width: 1,
|
|
36
|
+
height: 1,
|
|
37
|
+
margin: -1,
|
|
38
|
+
padding: 0,
|
|
39
|
+
overflow: 'hidden',
|
|
40
|
+
clip: 'rect(0 0 0 0)',
|
|
41
|
+
whiteSpace: 'nowrap',
|
|
42
|
+
border: 0,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const ANNOUNCE: Partial<Record<ClipboardStatus, string>> = { copied: 'Copied', failed: 'Copy failed' }
|
|
46
|
+
|
|
47
|
+
export interface ClipboardRootProps extends HTMLAttributes<HTMLDivElement> {
|
|
48
|
+
/** Text written to the clipboard; read at the moment of copying. */
|
|
49
|
+
value: string
|
|
50
|
+
/** How long copied / failed show, in ms. */
|
|
51
|
+
timeout?: number
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const Root = forwardRef<HTMLDivElement, ClipboardRootProps>(function ClipboardRoot(
|
|
55
|
+
{ value, timeout, children, ...rest },
|
|
56
|
+
ref,
|
|
57
|
+
) {
|
|
58
|
+
const [snapshot, send] = useAeonMachine(clipboardMachine, { input: { timeout } })
|
|
59
|
+
const status = snapshot.value as ClipboardStatus
|
|
60
|
+
const ctx = useMemo(() => ({ status, copy: () => send({ type: 'COPY', value }) }), [status, send, value])
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<ClipboardCtx.Provider value={ctx}>
|
|
64
|
+
<div ref={ref} {...mergeProps(partAttrs(clipboardAnatomy.scope, clipboardAnatomy.root, { state: status }), rest)}>
|
|
65
|
+
{children}
|
|
66
|
+
<span role="status" style={visuallyHidden} {...partOnlyAttrs(clipboardAnatomy.status)}>
|
|
67
|
+
{ANNOUNCE[status] ?? ''}
|
|
68
|
+
</span>
|
|
69
|
+
</div>
|
|
70
|
+
</ClipboardCtx.Provider>
|
|
71
|
+
)
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const Trigger = forwardRef<HTMLButtonElement, ButtonHTMLAttributes<HTMLButtonElement>>(function ClipboardTrigger(
|
|
75
|
+
{ onClick, ...rest },
|
|
76
|
+
ref,
|
|
77
|
+
) {
|
|
78
|
+
const { status, copy } = useClipboardCtx()
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<button
|
|
82
|
+
ref={ref}
|
|
83
|
+
type="button"
|
|
84
|
+
aria-label="Copy"
|
|
85
|
+
{...mergeProps(
|
|
86
|
+
partOnlyAttrs(clipboardAnatomy.trigger, { state: status }),
|
|
87
|
+
{
|
|
88
|
+
onClick: (e: MouseEvent<HTMLButtonElement>) => {
|
|
89
|
+
onClick?.(e)
|
|
90
|
+
if (!e.defaultPrevented) copy()
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
rest,
|
|
94
|
+
)}
|
|
95
|
+
/>
|
|
96
|
+
)
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
export interface ClipboardIndicatorProps extends HTMLAttributes<HTMLSpanElement> {
|
|
100
|
+
/** Shown while copied; `children` show otherwise. */
|
|
101
|
+
copied?: ReactNode
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const Indicator = forwardRef<HTMLSpanElement, ClipboardIndicatorProps>(function ClipboardIndicator(
|
|
105
|
+
{ copied, children, ...rest },
|
|
106
|
+
ref,
|
|
107
|
+
) {
|
|
108
|
+
const { status } = useClipboardCtx()
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<span ref={ref} aria-hidden {...mergeProps(partOnlyAttrs(clipboardAnatomy.indicator, { state: status }), rest)}>
|
|
112
|
+
{status === 'copied' && copied !== undefined ? copied : children}
|
|
113
|
+
</span>
|
|
114
|
+
)
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
export const Clipboard = { Root, Trigger, Indicator }
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
type ReactNode,
|
|
8
8
|
type TextareaHTMLAttributes,
|
|
9
9
|
} from 'react'
|
|
10
|
+
import { rowLimits, useAutoGrow } from '../textarea/index.js'
|
|
10
11
|
import { mergeProps } from '../utils/merge-props.js'
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -48,13 +49,21 @@ const Root = forwardRef<HTMLFormElement, ComposerRootProps>(function ComposerRoo
|
|
|
48
49
|
)
|
|
49
50
|
})
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
export interface ComposerInputProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
53
|
+
/** Height floor in lines (default 1). */
|
|
54
|
+
minRows?: number
|
|
55
|
+
/** Height ceiling in lines before the input scrolls (default 4). */
|
|
56
|
+
maxRows?: number
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const Input = forwardRef<HTMLTextAreaElement, ComposerInputProps>(
|
|
60
|
+
function ComposerInput({ minRows, maxRows, style, ...props }, ref) {
|
|
61
|
+
const grow = useAutoGrow(ref, props.value)
|
|
53
62
|
return (
|
|
54
63
|
<textarea
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{...mergeProps(partAttrs(composerAnatomy.scope, composerAnatomy.input), props)}
|
|
64
|
+
rows={minRows ?? 1}
|
|
65
|
+
style={{ ...rowLimits(minRows, maxRows), ...style }}
|
|
66
|
+
{...mergeProps(partAttrs(composerAnatomy.scope, composerAnatomy.input), grow, props)}
|
|
58
67
|
/>
|
|
59
68
|
)
|
|
60
69
|
},
|
|
@@ -52,12 +52,20 @@ const Root = forwardRef<HTMLDivElement, DialogRootProps>(function DialogRoot(
|
|
|
52
52
|
input: { open: defaultOpen },
|
|
53
53
|
})
|
|
54
54
|
|
|
55
|
-
const
|
|
55
|
+
const machineOpen = snapshot.context.open
|
|
56
|
+
const resolvedOpen = open ?? machineOpen
|
|
56
57
|
const contentRef = useRef<HTMLDivElement>(null)
|
|
57
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Report the machine's intent, not the resolved value: a controlled owner
|
|
61
|
+
* holding `open` would otherwise never hear about its own trigger or escape.
|
|
62
|
+
*/
|
|
63
|
+
const reportedOpen = useRef(machineOpen)
|
|
58
64
|
useEffect(() => {
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
if (reportedOpen.current === machineOpen) return
|
|
66
|
+
reportedOpen.current = machineOpen
|
|
67
|
+
onOpenChange?.(machineOpen)
|
|
68
|
+
}, [machineOpen, onOpenChange])
|
|
61
69
|
|
|
62
70
|
useEffect(() => {
|
|
63
71
|
if (open !== undefined) {
|
|
@@ -10,6 +10,15 @@ export interface FloatingPositionerProps extends HTMLAttributes<HTMLDivElement>
|
|
|
10
10
|
part: string
|
|
11
11
|
triggerRef: RefObject<HTMLElement | null>
|
|
12
12
|
positionerRef: RefObject<HTMLDivElement | null>
|
|
13
|
+
/**
|
|
14
|
+
* Position against this element instead of the trigger.
|
|
15
|
+
*
|
|
16
|
+
* A trigger is often a small icon button pinned to one edge of a much larger
|
|
17
|
+
* region. Aligning to the button then throws a wide surface off-screen, and
|
|
18
|
+
* clamping only slides it back to the viewport edge. Anchoring to the region
|
|
19
|
+
* the surface belongs to puts it where the eye already is.
|
|
20
|
+
*/
|
|
21
|
+
anchorRef?: RefObject<HTMLElement | null>
|
|
13
22
|
portalled?: boolean
|
|
14
23
|
placement?: AnchorPlacement
|
|
15
24
|
matchAnchorWidth?: boolean
|
|
@@ -28,6 +37,7 @@ export const FloatingPositioner = forwardRef<HTMLDivElement, FloatingPositionerP
|
|
|
28
37
|
part,
|
|
29
38
|
triggerRef,
|
|
30
39
|
positionerRef,
|
|
40
|
+
anchorRef,
|
|
31
41
|
portalled = true,
|
|
32
42
|
placement = 'bottom-start',
|
|
33
43
|
matchAnchorWidth = false,
|
|
@@ -40,7 +50,7 @@ export const FloatingPositioner = forwardRef<HTMLDivElement, FloatingPositionerP
|
|
|
40
50
|
ref,
|
|
41
51
|
) {
|
|
42
52
|
const mounted = usePortalledMount()
|
|
43
|
-
useAnchorPosition(triggerRef, positionerRef, open && portalled, placement, {
|
|
53
|
+
useAnchorPosition(anchorRef ?? triggerRef, positionerRef, open && portalled, placement, {
|
|
44
54
|
matchWidth: matchAnchorWidth,
|
|
45
55
|
gutter,
|
|
46
56
|
zIndex,
|
|
@@ -6,6 +6,10 @@ export * from './prompt/index.js'
|
|
|
6
6
|
export * from './status-banner/index.js'
|
|
7
7
|
export * from './tabs/index.js'
|
|
8
8
|
export * from './separator/index.js'
|
|
9
|
+
export * from './prose/index.js'
|
|
10
|
+
export * from './textarea/index.js'
|
|
11
|
+
export * from './segment-group/index.js'
|
|
12
|
+
export * from './clipboard/index.js'
|
|
9
13
|
export * from './progress/index.js'
|
|
10
14
|
export * from './radio-group/index.js'
|
|
11
15
|
export * from './slider/index.js'
|
|
@@ -51,16 +51,21 @@ const Root = forwardRef<HTMLDivElement, MenuRootProps>(function MenuRoot(
|
|
|
51
51
|
ref,
|
|
52
52
|
) {
|
|
53
53
|
const [snapshot, send] = useAeonMachine(popoverMachine, { input: { open: defaultOpen } })
|
|
54
|
-
const
|
|
54
|
+
const machineOpen = snapshot.context.open
|
|
55
|
+
const resolvedOpen = open ?? machineOpen
|
|
55
56
|
const rootRef = useRef<HTMLDivElement>(null)
|
|
56
57
|
const triggerRef = useRef<HTMLButtonElement>(null)
|
|
57
58
|
const positionerRef = useRef<HTMLDivElement>(null)
|
|
58
59
|
const triggerId = useId()
|
|
59
60
|
const menuId = useId()
|
|
60
61
|
|
|
62
|
+
/** Machine intent, so a controlled owner still hears its own trigger. */
|
|
63
|
+
const reportedOpen = useRef(machineOpen)
|
|
61
64
|
useEffect(() => {
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
if (reportedOpen.current === machineOpen) return
|
|
66
|
+
reportedOpen.current = machineOpen
|
|
67
|
+
onOpenChange?.(machineOpen)
|
|
68
|
+
}, [machineOpen, onOpenChange])
|
|
64
69
|
|
|
65
70
|
useEffect(() => {
|
|
66
71
|
if (open !== undefined) send({ type: 'SET_OPEN', open })
|
|
@@ -53,16 +53,21 @@ const Root = forwardRef<HTMLDivElement, PopoverRootProps>(function PopoverRoot(
|
|
|
53
53
|
const [snapshot, send] = useAeonMachine(popoverMachine, {
|
|
54
54
|
input: { open: defaultOpen },
|
|
55
55
|
})
|
|
56
|
-
const
|
|
56
|
+
const machineOpen = snapshot.context.open
|
|
57
|
+
const resolvedOpen = open ?? machineOpen
|
|
57
58
|
const rootRef = useRef<HTMLDivElement>(null)
|
|
58
59
|
const triggerRef = useRef<HTMLButtonElement>(null)
|
|
59
60
|
const positionerRef = useRef<HTMLDivElement>(null)
|
|
60
61
|
const triggerId = useId()
|
|
61
62
|
const contentId = useId()
|
|
62
63
|
|
|
64
|
+
/** Machine intent, so a controlled owner still hears its own trigger. */
|
|
65
|
+
const reportedOpen = useRef(machineOpen)
|
|
63
66
|
useEffect(() => {
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
if (reportedOpen.current === machineOpen) return
|
|
68
|
+
reportedOpen.current = machineOpen
|
|
69
|
+
onOpenChange?.(machineOpen)
|
|
70
|
+
}, [machineOpen, onOpenChange])
|
|
66
71
|
|
|
67
72
|
useEffect(() => {
|
|
68
73
|
if (open !== undefined) send({ type: 'SET_OPEN', open })
|
|
@@ -132,6 +137,10 @@ export interface PopoverPositionerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
132
137
|
/** Mount panel in document.body (default true). */
|
|
133
138
|
portalled?: boolean
|
|
134
139
|
placement?: AnchorPlacement
|
|
140
|
+
/** Align to this region rather than the trigger. See `FloatingPositioner`. */
|
|
141
|
+
anchorRef?: React.RefObject<HTMLElement | null>
|
|
142
|
+
/** Size the panel to the anchor, so it spans the region it belongs to. */
|
|
143
|
+
matchAnchorWidth?: boolean
|
|
135
144
|
/** Gap between trigger and panel (default 4). */
|
|
136
145
|
gutter?: number
|
|
137
146
|
/** Stack level for the portalled surface (default 50). */
|
|
@@ -140,7 +149,17 @@ export interface PopoverPositionerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
140
149
|
}
|
|
141
150
|
|
|
142
151
|
const Positioner = forwardRef<HTMLDivElement, PopoverPositionerProps>(function PopoverPositioner(
|
|
143
|
-
{
|
|
152
|
+
{
|
|
153
|
+
portalled = true,
|
|
154
|
+
placement = 'bottom-start',
|
|
155
|
+
anchorRef,
|
|
156
|
+
matchAnchorWidth = false,
|
|
157
|
+
gutter,
|
|
158
|
+
zIndex,
|
|
159
|
+
children,
|
|
160
|
+
className,
|
|
161
|
+
...rest
|
|
162
|
+
},
|
|
144
163
|
ref,
|
|
145
164
|
) {
|
|
146
165
|
const { open, triggerRef, positionerRef } = usePopoverCtx()
|
|
@@ -153,6 +172,8 @@ const Positioner = forwardRef<HTMLDivElement, PopoverPositionerProps>(function P
|
|
|
153
172
|
part={popoverAnatomy.positioner}
|
|
154
173
|
triggerRef={triggerRef}
|
|
155
174
|
positionerRef={positionerRef}
|
|
175
|
+
anchorRef={anchorRef}
|
|
176
|
+
matchAnchorWidth={matchAnchorWidth}
|
|
156
177
|
portalled={portalled}
|
|
157
178
|
placement={placement}
|
|
158
179
|
gutter={gutter}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { partAttrs, proseAnatomy } from '@aeon-ui/core'
|
|
2
|
+
import { forwardRef, type HTMLAttributes } from 'react'
|
|
3
|
+
import { mergeProps } from '../utils/merge-props.js'
|
|
4
|
+
|
|
5
|
+
export type ProseRootProps = HTMLAttributes<HTMLDivElement>
|
|
6
|
+
|
|
7
|
+
const Root = forwardRef<HTMLDivElement, ProseRootProps>(function ProseRoot(props, ref) {
|
|
8
|
+
return <div ref={ref} {...mergeProps(partAttrs(proseAnatomy.scope, proseAnatomy.root), props)} />
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const Prose = { Root }
|
|
@@ -43,7 +43,8 @@ function useRadioGroupItemCtx() {
|
|
|
43
43
|
return ctx
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export interface RadioGroupRootProps
|
|
46
|
+
export interface RadioGroupRootProps
|
|
47
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange' | 'children'> {
|
|
47
48
|
value?: string
|
|
48
49
|
defaultValue?: string
|
|
49
50
|
onValueChange?: (value: string) => void
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computeListWindow,
|
|
3
|
+
fullListWindow,
|
|
4
|
+
LIST_WINDOW_MIN_ITEMS,
|
|
5
|
+
measureListColumns,
|
|
6
|
+
measureListRowExtent,
|
|
7
|
+
resolveScrollRoot,
|
|
8
|
+
sameListWindow,
|
|
9
|
+
scrollRootExtent,
|
|
10
|
+
scrollRootScrolledPast,
|
|
11
|
+
type ListWindow,
|
|
12
|
+
type ListWindowAxis,
|
|
13
|
+
} from '@aeon-ui/core'
|
|
14
|
+
import { useLayoutEffect, useState, type RefObject } from 'react'
|
|
15
|
+
|
|
16
|
+
export interface UseWindowedRangeOptions {
|
|
17
|
+
total: number
|
|
18
|
+
/** Fallback row pitch, used until a row can be measured. */
|
|
19
|
+
itemExtent: number
|
|
20
|
+
/** Fallback column count for grids; the real count is read from the grid. */
|
|
21
|
+
columns?: number
|
|
22
|
+
overscan?: number
|
|
23
|
+
/** Restrict measuring to real rows when the list also holds other chrome. */
|
|
24
|
+
rowSelector?: string
|
|
25
|
+
minItems?: number
|
|
26
|
+
/** `x` windows a horizontal strip by item width; columns do not apply. */
|
|
27
|
+
axis?: ListWindowAxis
|
|
28
|
+
/** The list element itself; its scrollable ancestor drives the window. */
|
|
29
|
+
scrollRef: RefObject<HTMLElement | null>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function hintedWindow(o: UseWindowedRangeOptions): ListWindow {
|
|
33
|
+
return computeListWindow({
|
|
34
|
+
total: o.total,
|
|
35
|
+
rowExtent: o.itemExtent,
|
|
36
|
+
columns: o.axis === 'x' ? 1 : o.columns,
|
|
37
|
+
overscan: o.overscan,
|
|
38
|
+
scrolledPast: 0,
|
|
39
|
+
viewportHeight: typeof window === 'undefined' ? 0 : o.axis === 'x' ? window.innerWidth : window.innerHeight,
|
|
40
|
+
minItems: o.minItems,
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Windowed slice for long lists and grids. Render `items.slice(start, end)`
|
|
46
|
+
* between spacers of `padStart` / `padEnd` (spread `listWindowPadAttrs`) or
|
|
47
|
+
* as list padding; each row keeps its own data-aeon-* projection.
|
|
48
|
+
*
|
|
49
|
+
* The first render windows from the hints, so a long list never mounts whole.
|
|
50
|
+
* Measuring reads layout, so it runs at most once per frame, and the window is
|
|
51
|
+
* published only when it moves: a scroll inside the current window renders
|
|
52
|
+
* nothing.
|
|
53
|
+
*/
|
|
54
|
+
export function useWindowedRange(options: UseWindowedRangeOptions): ListWindow {
|
|
55
|
+
const {
|
|
56
|
+
total,
|
|
57
|
+
itemExtent,
|
|
58
|
+
columns = 1,
|
|
59
|
+
overscan = 8,
|
|
60
|
+
rowSelector,
|
|
61
|
+
minItems = LIST_WINDOW_MIN_ITEMS,
|
|
62
|
+
axis = 'y',
|
|
63
|
+
scrollRef,
|
|
64
|
+
} = options
|
|
65
|
+
const [range, setRange] = useState<ListWindow>(() => hintedWindow(options))
|
|
66
|
+
|
|
67
|
+
useLayoutEffect(() => {
|
|
68
|
+
const keep = (next: ListWindow) => setRange((current) => (sameListWindow(current, next) ? current : next))
|
|
69
|
+
if (total < minItems) {
|
|
70
|
+
keep(fullListWindow(total))
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
const list = scrollRef.current
|
|
74
|
+
if (!list) {
|
|
75
|
+
keep(hintedWindow({ total, itemExtent, columns, overscan, minItems, axis, scrollRef }))
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
const root = resolveScrollRoot(list, axis)
|
|
79
|
+
let frame = 0
|
|
80
|
+
let cancelled = false
|
|
81
|
+
|
|
82
|
+
const measureNow = () => {
|
|
83
|
+
const style = getComputedStyle(list)
|
|
84
|
+
keep(
|
|
85
|
+
computeListWindow({
|
|
86
|
+
total,
|
|
87
|
+
rowExtent: measureListRowExtent(list, style, itemExtent, rowSelector, axis),
|
|
88
|
+
columns: axis === 'x' ? 1 : measureListColumns(style, columns),
|
|
89
|
+
overscan,
|
|
90
|
+
scrolledPast: scrollRootScrolledPast(root, list, axis),
|
|
91
|
+
viewportHeight: scrollRootExtent(root, axis),
|
|
92
|
+
minItems,
|
|
93
|
+
}),
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const measure = () => {
|
|
98
|
+
if (cancelled || frame) return
|
|
99
|
+
frame = window.requestAnimationFrame(() => {
|
|
100
|
+
frame = 0
|
|
101
|
+
if (!cancelled) measureNow()
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
measureNow()
|
|
106
|
+
const target: EventTarget = root === window ? window : root
|
|
107
|
+
target.addEventListener('scroll', measure, { passive: true })
|
|
108
|
+
window.addEventListener('resize', measure)
|
|
109
|
+
return () => {
|
|
110
|
+
cancelled = true
|
|
111
|
+
window.cancelAnimationFrame(frame)
|
|
112
|
+
target.removeEventListener('scroll', measure)
|
|
113
|
+
window.removeEventListener('resize', measure)
|
|
114
|
+
}
|
|
115
|
+
}, [total, itemExtent, columns, overscan, rowSelector, minItems, axis, scrollRef])
|
|
116
|
+
|
|
117
|
+
return range
|
|
118
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { partAttrs, partOnlyAttrs, segmentGroupAnatomy } from '@aeon-ui/core'
|
|
2
|
+
import { tabsMachine } from '@aeon-ui/primitives'
|
|
3
|
+
import {
|
|
4
|
+
createContext,
|
|
5
|
+
forwardRef,
|
|
6
|
+
useCallback,
|
|
7
|
+
useContext,
|
|
8
|
+
useEffect,
|
|
9
|
+
useLayoutEffect,
|
|
10
|
+
useMemo,
|
|
11
|
+
useRef,
|
|
12
|
+
useState,
|
|
13
|
+
type ButtonHTMLAttributes,
|
|
14
|
+
type HTMLAttributes,
|
|
15
|
+
type KeyboardEvent,
|
|
16
|
+
type MouseEvent,
|
|
17
|
+
} from 'react'
|
|
18
|
+
import { useAeonMachine } from '../hooks/use-aeon-machine.js'
|
|
19
|
+
import { assignRef } from '../utils/assign-ref.js'
|
|
20
|
+
import { mergeProps } from '../utils/merge-props.js'
|
|
21
|
+
|
|
22
|
+
interface SegmentGroupContextValue {
|
|
23
|
+
value: string
|
|
24
|
+
disabled: boolean
|
|
25
|
+
/** The one item Tab lands on: the selected item, or the first enabled one when that is missing or disabled. */
|
|
26
|
+
tabStop: string | null
|
|
27
|
+
selectValue: (next: string) => void
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const SegmentGroupCtx = createContext<SegmentGroupContextValue | null>(null)
|
|
31
|
+
|
|
32
|
+
function useSegmentGroupCtx() {
|
|
33
|
+
const ctx = useContext(SegmentGroupCtx)
|
|
34
|
+
if (!ctx) throw new Error('SegmentGroup parts must be used within SegmentGroup.Root')
|
|
35
|
+
return ctx
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const ROOT = `[data-aeon-scope="${segmentGroupAnatomy.scope}"]`
|
|
39
|
+
|
|
40
|
+
/** This group's enabled items in DOM order, leaving out items of nested groups. */
|
|
41
|
+
function enabledItems(root: HTMLElement): HTMLButtonElement[] {
|
|
42
|
+
return Array.from(
|
|
43
|
+
root.querySelectorAll<HTMLButtonElement>(`[data-aeon-part="${segmentGroupAnatomy.item}"]:not(:disabled)`),
|
|
44
|
+
).filter((item) => item.closest(ROOT) === root)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface SegmentGroupRootProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
48
|
+
value?: string
|
|
49
|
+
defaultValue?: string
|
|
50
|
+
onValueChange?: (value: string) => void
|
|
51
|
+
disabled?: boolean
|
|
52
|
+
orientation?: 'horizontal' | 'vertical'
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const Root = forwardRef<HTMLDivElement, SegmentGroupRootProps>(function SegmentGroupRoot(
|
|
56
|
+
{ value, defaultValue = '', onValueChange, disabled = false, orientation = 'horizontal', ...rest },
|
|
57
|
+
ref,
|
|
58
|
+
) {
|
|
59
|
+
const [snapshot, send] = useAeonMachine(tabsMachine, {
|
|
60
|
+
input: { value: value ?? defaultValue, disabled },
|
|
61
|
+
})
|
|
62
|
+
const controlled = value !== undefined
|
|
63
|
+
const resolvedValue = value ?? snapshot.context.value
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (controlled) send({ type: 'SET_VALUE', value })
|
|
67
|
+
}, [controlled, value, send])
|
|
68
|
+
|
|
69
|
+
const selectValue = useCallback(
|
|
70
|
+
(next: string) => {
|
|
71
|
+
if (disabled || next === resolvedValue) return
|
|
72
|
+
if (!controlled) send({ type: 'SELECT', value: next })
|
|
73
|
+
onValueChange?.(next)
|
|
74
|
+
},
|
|
75
|
+
[disabled, resolvedValue, controlled, send, onValueChange],
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
const node = useRef<HTMLDivElement | null>(null)
|
|
79
|
+
const setRef = useCallback(
|
|
80
|
+
(el: HTMLDivElement | null) => {
|
|
81
|
+
node.current = el
|
|
82
|
+
assignRef(ref, el)
|
|
83
|
+
},
|
|
84
|
+
[ref],
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
/* Items can be added, removed or disabled at any render, so the tab stop is re-read from the DOM each time. */
|
|
88
|
+
const [tabStop, setTabStop] = useState<string | null>(null)
|
|
89
|
+
useLayoutEffect(() => {
|
|
90
|
+
const items = node.current ? enabledItems(node.current) : []
|
|
91
|
+
const next = (items.find((item) => item.dataset.value === resolvedValue) ?? items[0])?.dataset.value ?? null
|
|
92
|
+
setTabStop((prev) => (prev === next ? prev : next))
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
const ctx = useMemo(
|
|
96
|
+
() => ({ value: resolvedValue, disabled, tabStop, selectValue }),
|
|
97
|
+
[resolvedValue, disabled, tabStop, selectValue],
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<SegmentGroupCtx.Provider value={ctx}>
|
|
102
|
+
<div
|
|
103
|
+
ref={setRef}
|
|
104
|
+
role="radiogroup"
|
|
105
|
+
aria-orientation={orientation}
|
|
106
|
+
aria-disabled={disabled || undefined}
|
|
107
|
+
data-orientation={orientation}
|
|
108
|
+
{...mergeProps(partAttrs(segmentGroupAnatomy.scope, segmentGroupAnatomy.root, { disabled }), rest)}
|
|
109
|
+
/>
|
|
110
|
+
</SegmentGroupCtx.Provider>
|
|
111
|
+
)
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
const KEY_STEP: Record<string, number> = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 }
|
|
115
|
+
|
|
116
|
+
export interface SegmentGroupItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value'> {
|
|
117
|
+
value: string
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const Item = forwardRef<HTMLButtonElement, SegmentGroupItemProps>(function SegmentGroupItem(
|
|
121
|
+
{ value: itemValue, disabled: itemDisabled, onClick, onKeyDown, ...rest },
|
|
122
|
+
ref,
|
|
123
|
+
) {
|
|
124
|
+
const { value, disabled: groupDisabled, tabStop, selectValue } = useSegmentGroupCtx()
|
|
125
|
+
const selected = value === itemValue
|
|
126
|
+
const disabled = groupDisabled || Boolean(itemDisabled)
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<button
|
|
130
|
+
ref={ref}
|
|
131
|
+
type="button"
|
|
132
|
+
role="radio"
|
|
133
|
+
aria-checked={selected}
|
|
134
|
+
data-value={itemValue}
|
|
135
|
+
disabled={disabled}
|
|
136
|
+
tabIndex={itemValue === tabStop ? 0 : -1}
|
|
137
|
+
{...mergeProps(
|
|
138
|
+
partOnlyAttrs(segmentGroupAnatomy.item, {
|
|
139
|
+
state: selected ? 'selected' : 'unselected',
|
|
140
|
+
disabled,
|
|
141
|
+
}),
|
|
142
|
+
{
|
|
143
|
+
onClick: (e: MouseEvent<HTMLButtonElement>) => {
|
|
144
|
+
onClick?.(e)
|
|
145
|
+
if (!e.defaultPrevented) selectValue(itemValue)
|
|
146
|
+
},
|
|
147
|
+
onKeyDown: (e: KeyboardEvent<HTMLButtonElement>) => {
|
|
148
|
+
onKeyDown?.(e)
|
|
149
|
+
if (e.defaultPrevented) return
|
|
150
|
+
const root = e.currentTarget.closest<HTMLElement>(ROOT)
|
|
151
|
+
const items = root ? enabledItems(root) : []
|
|
152
|
+
const at = items.indexOf(e.currentTarget)
|
|
153
|
+
const step = KEY_STEP[e.key]
|
|
154
|
+
const target =
|
|
155
|
+
e.key === 'Home' ? items[0]
|
|
156
|
+
: e.key === 'End' ? items[items.length - 1]
|
|
157
|
+
: step === undefined || at < 0 ? undefined
|
|
158
|
+
: items[(at + step + items.length) % items.length]
|
|
159
|
+
if (!target) return
|
|
160
|
+
e.preventDefault()
|
|
161
|
+
target.focus()
|
|
162
|
+
selectValue(target.dataset.value ?? '')
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
rest,
|
|
166
|
+
)}
|
|
167
|
+
/>
|
|
168
|
+
)
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
export const SegmentGroup = { Root, Item }
|
|
@@ -14,8 +14,10 @@ import {
|
|
|
14
14
|
type KeyboardEvent,
|
|
15
15
|
type MouseEvent,
|
|
16
16
|
type ReactNode,
|
|
17
|
+
type RefObject,
|
|
17
18
|
} from 'react'
|
|
18
19
|
import { FloatingPositioner } from '../floating/FloatingPositioner.js'
|
|
20
|
+
import type { AnchorPlacement } from '../hooks/use-anchor-position.js'
|
|
19
21
|
import { useAeonMachine } from '../hooks/use-aeon-machine.js'
|
|
20
22
|
import { useOutsideClick } from '../hooks/use-outside-click.js'
|
|
21
23
|
import { mergeProps } from '../utils/merge-props.js'
|
|
@@ -257,11 +259,16 @@ const Trigger = forwardRef<HTMLButtonElement, ButtonHTMLAttributes<HTMLButtonEle
|
|
|
257
259
|
export interface SelectPositionerProps extends HTMLAttributes<HTMLDivElement> {
|
|
258
260
|
/** Mount listbox in document.body (default true). */
|
|
259
261
|
portalled?: boolean
|
|
262
|
+
placement?: AnchorPlacement
|
|
263
|
+
/** Align to this region rather than the trigger. See `FloatingPositioner`. */
|
|
264
|
+
anchorRef?: RefObject<HTMLElement | null>
|
|
265
|
+
/** Size the listbox to the anchor (default true). */
|
|
266
|
+
matchAnchorWidth?: boolean
|
|
260
267
|
children?: ReactNode
|
|
261
268
|
}
|
|
262
269
|
|
|
263
270
|
const Positioner = forwardRef<HTMLDivElement, SelectPositionerProps>(function SelectPositioner(
|
|
264
|
-
{ portalled = true, children, className, ...rest },
|
|
271
|
+
{ portalled = true, placement, anchorRef, matchAnchorWidth = true, children, className, ...rest },
|
|
265
272
|
ref,
|
|
266
273
|
) {
|
|
267
274
|
const { open, triggerRef, positionerRef } = useSelectCtx()
|
|
@@ -275,8 +282,10 @@ const Positioner = forwardRef<HTMLDivElement, SelectPositionerProps>(function Se
|
|
|
275
282
|
part={selectAnatomy.positioner}
|
|
276
283
|
triggerRef={triggerRef}
|
|
277
284
|
positionerRef={positionerRef}
|
|
285
|
+
anchorRef={anchorRef}
|
|
278
286
|
portalled={portalled}
|
|
279
|
-
|
|
287
|
+
placement={placement}
|
|
288
|
+
matchAnchorWidth={matchAnchorWidth}
|
|
280
289
|
className={className}
|
|
281
290
|
{...rest}
|
|
282
291
|
>
|