@funstack/ui 0.1.0-alpha.15 → 0.1.0-alpha.16
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 +22 -1
- package/dist/accordion/accordion-item.d.mts +19 -0
- package/dist/accordion/accordion-item.d.mts.map +1 -1
- package/dist/accordion/accordion-item.mjs +2 -0
- package/dist/accordion/accordion-item.mjs.map +1 -1
- package/dist/accordion/accordion-panel.d.mts +16 -0
- package/dist/accordion/accordion-panel.d.mts.map +1 -1
- package/dist/accordion/accordion-panel.mjs +2 -0
- package/dist/accordion/accordion-panel.mjs.map +1 -1
- package/dist/accordion/accordion-root.d.mts +36 -2
- package/dist/accordion/accordion-root.d.mts.map +1 -1
- package/dist/accordion/accordion-root.mjs +2 -0
- package/dist/accordion/accordion-root.mjs.map +1 -1
- package/dist/accordion/accordion-trigger.d.mts +9 -0
- package/dist/accordion/accordion-trigger.d.mts.map +1 -1
- package/dist/accordion/accordion-trigger.mjs +2 -0
- package/dist/accordion/accordion-trigger.mjs.map +1 -1
- package/dist/accordion/index.d.mts +2 -0
- package/dist/accordion/index.d.mts.map +1 -1
- package/dist/accordion/index.mjs +2 -0
- package/dist/accordion/index.mjs.map +1 -1
- package/dist/bin/skill-installer.d.mts +1 -0
- package/dist/bin/skill-installer.mjs +12 -0
- package/dist/bin/skill-installer.mjs.map +1 -0
- package/dist/button/button.d.mts +25 -7
- package/dist/button/button.d.mts.map +1 -1
- package/dist/button/button.mjs +2 -0
- package/dist/button/button.mjs.map +1 -1
- package/dist/checkbox/checkbox.d.mts +25 -3
- package/dist/checkbox/checkbox.d.mts.map +1 -1
- package/dist/checkbox/checkbox.mjs +2 -0
- package/dist/checkbox/checkbox.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.d.mts +15 -0
- package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.mjs +2 -0
- package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-label.d.mts +10 -0
- package/dist/checkbox-group/checkbox-group-label.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-label.mjs +2 -0
- package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.d.mts +19 -1
- package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.mjs +2 -0
- package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.d.mts +31 -4
- package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.mjs +2 -0
- package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
- package/dist/checkbox-group/index.d.mts +2 -0
- package/dist/checkbox-group/index.d.mts.map +1 -1
- package/dist/checkbox-group/index.mjs +2 -0
- package/dist/checkbox-group/index.mjs.map +1 -1
- package/dist/combobox/combobox-clear.d.mts +18 -0
- package/dist/combobox/combobox-clear.d.mts.map +1 -1
- package/dist/combobox/combobox-clear.mjs +2 -0
- package/dist/combobox/combobox-clear.mjs.map +1 -1
- package/dist/combobox/combobox-group.d.mts +49 -1
- package/dist/combobox/combobox-group.d.mts.map +1 -1
- package/dist/combobox/combobox-group.mjs +11 -1
- package/dist/combobox/combobox-group.mjs.map +1 -1
- package/dist/combobox/combobox-input.d.mts +11 -0
- package/dist/combobox/combobox-input.d.mts.map +1 -1
- package/dist/combobox/combobox-input.mjs +2 -0
- package/dist/combobox/combobox-input.mjs.map +1 -1
- package/dist/combobox/combobox-label.d.mts +16 -0
- package/dist/combobox/combobox-label.d.mts.map +1 -1
- package/dist/combobox/combobox-label.mjs +2 -0
- package/dist/combobox/combobox-label.mjs.map +1 -1
- package/dist/combobox/combobox-list.d.mts +14 -0
- package/dist/combobox/combobox-list.d.mts.map +1 -1
- package/dist/combobox/combobox-list.mjs +2 -0
- package/dist/combobox/combobox-list.mjs.map +1 -1
- package/dist/combobox/combobox-option.d.mts +25 -3
- package/dist/combobox/combobox-option.d.mts.map +1 -1
- package/dist/combobox/combobox-option.mjs +2 -0
- package/dist/combobox/combobox-option.mjs.map +1 -1
- package/dist/combobox/combobox-popup.d.mts +16 -0
- package/dist/combobox/combobox-popup.d.mts.map +1 -1
- package/dist/combobox/combobox-popup.mjs +2 -0
- package/dist/combobox/combobox-popup.mjs.map +1 -1
- package/dist/combobox/combobox-root.d.mts +49 -12
- package/dist/combobox/combobox-root.d.mts.map +1 -1
- package/dist/combobox/combobox-root.mjs +2 -0
- package/dist/combobox/combobox-root.mjs.map +1 -1
- package/dist/combobox/combobox-trigger.d.mts +16 -0
- package/dist/combobox/combobox-trigger.d.mts.map +1 -1
- package/dist/combobox/combobox-trigger.mjs +2 -0
- package/dist/combobox/combobox-trigger.mjs.map +1 -1
- package/dist/combobox/index.d.mts +2 -0
- package/dist/combobox/index.d.mts.map +1 -1
- package/dist/combobox/index.mjs +2 -0
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/csp/csp-provider.d.mts +8 -0
- package/dist/csp/csp-provider.d.mts.map +1 -1
- package/dist/csp/csp-provider.mjs +2 -0
- package/dist/csp/csp-provider.mjs.map +1 -1
- package/dist/csp/style-hashes.d.mts +2 -0
- package/dist/csp/style-hashes.d.mts.map +1 -1
- package/dist/csp/style-hashes.mjs +2 -0
- package/dist/csp/style-hashes.mjs.map +1 -1
- package/dist/dialog/dialog-close.d.mts +18 -0
- package/dist/dialog/dialog-close.d.mts.map +1 -1
- package/dist/dialog/dialog-close.mjs +2 -0
- package/dist/dialog/dialog-close.mjs.map +1 -1
- package/dist/dialog/dialog-description.d.mts +12 -0
- package/dist/dialog/dialog-description.d.mts.map +1 -1
- package/dist/dialog/dialog-description.mjs +2 -0
- package/dist/dialog/dialog-description.mjs.map +1 -1
- package/dist/dialog/dialog-form.d.mts +18 -1
- package/dist/dialog/dialog-form.d.mts.map +1 -1
- package/dist/dialog/dialog-form.mjs +2 -0
- package/dist/dialog/dialog-form.mjs.map +1 -1
- package/dist/dialog/dialog-popup.d.mts +25 -4
- package/dist/dialog/dialog-popup.d.mts.map +1 -1
- package/dist/dialog/dialog-popup.mjs +2 -0
- package/dist/dialog/dialog-popup.mjs.map +1 -1
- package/dist/dialog/dialog-root.d.mts +15 -1
- package/dist/dialog/dialog-root.d.mts.map +1 -1
- package/dist/dialog/dialog-root.mjs +2 -0
- package/dist/dialog/dialog-root.mjs.map +1 -1
- package/dist/dialog/dialog-title.d.mts +11 -0
- package/dist/dialog/dialog-title.d.mts.map +1 -1
- package/dist/dialog/dialog-title.mjs +2 -0
- package/dist/dialog/dialog-title.mjs.map +1 -1
- package/dist/dialog/dialog-trigger.d.mts +16 -0
- package/dist/dialog/dialog-trigger.d.mts.map +1 -1
- package/dist/dialog/dialog-trigger.mjs +2 -0
- package/dist/dialog/dialog-trigger.mjs.map +1 -1
- package/dist/dialog/index.d.mts +2 -0
- package/dist/dialog/index.d.mts.map +1 -1
- package/dist/dialog/index.mjs +2 -0
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/docs/components/accordion.md +426 -0
- package/dist/docs/components/button.md +464 -0
- package/dist/docs/components/checkbox-group.md +474 -0
- package/dist/docs/components/checkbox.md +373 -0
- package/dist/docs/components/combobox.md +635 -0
- package/dist/docs/components/context-menu.md +524 -0
- package/dist/docs/components/dialog.md +686 -0
- package/dist/docs/components/field.md +587 -0
- package/dist/docs/components/menu.md +589 -0
- package/dist/docs/components/meter.md +313 -0
- package/dist/docs/components/number-field.md +528 -0
- package/dist/docs/components/popover.md +591 -0
- package/dist/docs/components/progress.md +450 -0
- package/dist/docs/components/radio-group.md +457 -0
- package/dist/docs/components/select.md +662 -0
- package/dist/docs/components/slider.md +558 -0
- package/dist/docs/components/switch.md +311 -0
- package/dist/docs/components/tabs.md +473 -0
- package/dist/docs/components/toast.md +576 -0
- package/dist/docs/components/toggle-group.md +341 -0
- package/dist/docs/components/toggle.md +245 -0
- package/dist/docs/components/toolbar.md +389 -0
- package/dist/docs/components/tooltip.md +494 -0
- package/dist/docs/concepts/action-props.md +251 -0
- package/dist/docs/concepts/ai-agents.md +56 -0
- package/dist/docs/concepts/browser-owned-state.md +118 -0
- package/dist/docs/concepts/content-security-policy.md +69 -0
- package/dist/docs/concepts/experimental.md +36 -0
- package/dist/docs/concepts/pending-and-optimistic.md +250 -0
- package/dist/docs/concepts/server-components.md +118 -0
- package/dist/docs/concepts/suspense.md +124 -0
- package/dist/docs/concepts/transitions.md +118 -0
- package/dist/docs/getting-started.md +115 -0
- package/dist/docs/index.md +181 -0
- package/dist/docs/roadmap.md +74 -0
- package/dist/docs/why.md +100 -0
- package/dist/field/field-control.d.mts +26 -3
- package/dist/field/field-control.d.mts.map +1 -1
- package/dist/field/field-control.mjs +2 -0
- package/dist/field/field-control.mjs.map +1 -1
- package/dist/field/field-description.d.mts +11 -0
- package/dist/field/field-description.d.mts.map +1 -1
- package/dist/field/field-description.mjs +2 -0
- package/dist/field/field-description.mjs.map +1 -1
- package/dist/field/field-error.d.mts +14 -2
- package/dist/field/field-error.d.mts.map +1 -1
- package/dist/field/field-error.mjs +2 -0
- package/dist/field/field-error.mjs.map +1 -1
- package/dist/field/field-label.d.mts +10 -0
- package/dist/field/field-label.d.mts.map +1 -1
- package/dist/field/field-label.mjs +2 -0
- package/dist/field/field-label.mjs.map +1 -1
- package/dist/field/field-root.d.mts +21 -2
- package/dist/field/field-root.d.mts.map +1 -1
- package/dist/field/field-root.mjs +2 -0
- package/dist/field/field-root.mjs.map +1 -1
- package/dist/field/index.d.mts +9 -0
- package/dist/field/index.d.mts.map +1 -1
- package/dist/field/index.mjs +9 -0
- package/dist/field/index.mjs.map +1 -1
- package/dist/form/form-root.d.mts +17 -1
- package/dist/form/form-root.d.mts.map +1 -1
- package/dist/form/form-root.mjs +2 -0
- package/dist/form/form-root.mjs.map +1 -1
- package/dist/form/form-submit.d.mts +18 -0
- package/dist/form/form-submit.d.mts.map +1 -1
- package/dist/form/form-submit.mjs +2 -0
- package/dist/form/form-submit.mjs.map +1 -1
- package/dist/form/index.d.mts +7 -0
- package/dist/form/index.d.mts.map +1 -1
- package/dist/form/index.mjs +7 -0
- package/dist/form/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/internal/types.d.mts +3 -0
- package/dist/internal/types.d.mts.map +1 -1
- package/dist/internal/use-popover-trigger.d.mts +1 -0
- package/dist/internal/use-popover-trigger.d.mts.map +1 -1
- package/dist/internal/use-popover-trigger.mjs.map +1 -1
- package/dist/internal/validity.d.mts +11 -0
- package/dist/internal/validity.d.mts.map +1 -1
- package/dist/internal/validity.mjs.map +1 -1
- package/dist/menu/index.d.mts +2 -0
- package/dist/menu/index.d.mts.map +1 -1
- package/dist/menu/index.mjs +2 -0
- package/dist/menu/index.mjs.map +1 -1
- package/dist/menu/menu-checkbox-item.d.mts +26 -2
- package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
- package/dist/menu/menu-checkbox-item.mjs +2 -0
- package/dist/menu/menu-checkbox-item.mjs.map +1 -1
- package/dist/menu/menu-context-trigger.d.mts +24 -2
- package/dist/menu/menu-context-trigger.d.mts.map +1 -1
- package/dist/menu/menu-context-trigger.mjs +2 -0
- package/dist/menu/menu-context-trigger.mjs.map +1 -1
- package/dist/menu/menu-group.d.mts +36 -1
- package/dist/menu/menu-group.d.mts.map +1 -1
- package/dist/menu/menu-group.mjs +9 -1
- package/dist/menu/menu-group.mjs.map +1 -1
- package/dist/menu/menu-item.d.mts +23 -1
- package/dist/menu/menu-item.d.mts.map +1 -1
- package/dist/menu/menu-item.mjs +2 -0
- package/dist/menu/menu-item.mjs.map +1 -1
- package/dist/menu/menu-popup.d.mts +33 -8
- package/dist/menu/menu-popup.d.mts.map +1 -1
- package/dist/menu/menu-popup.mjs +2 -0
- package/dist/menu/menu-popup.mjs.map +1 -1
- package/dist/menu/menu-radio-group.d.mts +20 -1
- package/dist/menu/menu-radio-group.d.mts.map +1 -1
- package/dist/menu/menu-radio-group.mjs +2 -0
- package/dist/menu/menu-radio-group.mjs.map +1 -1
- package/dist/menu/menu-radio-item.d.mts +16 -0
- package/dist/menu/menu-radio-item.d.mts.map +1 -1
- package/dist/menu/menu-radio-item.mjs +2 -0
- package/dist/menu/menu-radio-item.mjs.map +1 -1
- package/dist/menu/menu-root.d.mts +22 -3
- package/dist/menu/menu-root.d.mts.map +1 -1
- package/dist/menu/menu-root.mjs +2 -0
- package/dist/menu/menu-root.mjs.map +1 -1
- package/dist/menu/menu-submenu-trigger.d.mts +13 -0
- package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-submenu-trigger.mjs +2 -0
- package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
- package/dist/menu/menu-trigger.d.mts +15 -0
- package/dist/menu/menu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-trigger.mjs +2 -0
- package/dist/menu/menu-trigger.mjs.map +1 -1
- package/dist/meter/index.d.mts +2 -0
- package/dist/meter/index.d.mts.map +1 -1
- package/dist/meter/index.mjs +2 -0
- package/dist/meter/index.mjs.map +1 -1
- package/dist/meter/meter-indicator.d.mts +11 -0
- package/dist/meter/meter-indicator.d.mts.map +1 -1
- package/dist/meter/meter-indicator.mjs +2 -0
- package/dist/meter/meter-indicator.mjs.map +1 -1
- package/dist/meter/meter-label.d.mts +11 -0
- package/dist/meter/meter-label.d.mts.map +1 -1
- package/dist/meter/meter-label.mjs +2 -0
- package/dist/meter/meter-label.mjs.map +1 -1
- package/dist/meter/meter-region.d.mts +5 -0
- package/dist/meter/meter-region.d.mts.map +1 -1
- package/dist/meter/meter-region.mjs.map +1 -1
- package/dist/meter/meter-root.d.mts +52 -10
- package/dist/meter/meter-root.d.mts.map +1 -1
- package/dist/meter/meter-root.mjs +2 -0
- package/dist/meter/meter-root.mjs.map +1 -1
- package/dist/meter/meter-track.d.mts +11 -0
- package/dist/meter/meter-track.d.mts.map +1 -1
- package/dist/meter/meter-track.mjs +2 -0
- package/dist/meter/meter-track.mjs.map +1 -1
- package/dist/meter/meter-value.d.mts +15 -1
- package/dist/meter/meter-value.d.mts.map +1 -1
- package/dist/meter/meter-value.mjs +2 -0
- package/dist/meter/meter-value.mjs.map +1 -1
- package/dist/number-field/index.d.mts +2 -0
- package/dist/number-field/index.d.mts.map +1 -1
- package/dist/number-field/index.mjs +2 -0
- package/dist/number-field/index.mjs.map +1 -1
- package/dist/number-field/number-field-decrement.d.mts +2 -0
- package/dist/number-field/number-field-decrement.d.mts.map +1 -1
- package/dist/number-field/number-field-decrement.mjs +2 -0
- package/dist/number-field/number-field-decrement.mjs.map +1 -1
- package/dist/number-field/number-field-increment.d.mts +2 -0
- package/dist/number-field/number-field-increment.d.mts.map +1 -1
- package/dist/number-field/number-field-increment.mjs +2 -0
- package/dist/number-field/number-field-increment.mjs.map +1 -1
- package/dist/number-field/number-field-input.d.mts +9 -0
- package/dist/number-field/number-field-input.d.mts.map +1 -1
- package/dist/number-field/number-field-input.mjs +2 -0
- package/dist/number-field/number-field-input.mjs.map +1 -1
- package/dist/number-field/number-field-label.d.mts +10 -0
- package/dist/number-field/number-field-label.d.mts.map +1 -1
- package/dist/number-field/number-field-label.mjs +2 -0
- package/dist/number-field/number-field-label.mjs.map +1 -1
- package/dist/number-field/number-field-root.d.mts +62 -14
- package/dist/number-field/number-field-root.d.mts.map +1 -1
- package/dist/number-field/number-field-root.mjs +2 -0
- package/dist/number-field/number-field-root.mjs.map +1 -1
- package/dist/number-field/use-step-button.d.mts +20 -0
- package/dist/number-field/use-step-button.d.mts.map +1 -1
- package/dist/number-field/use-step-button.mjs.map +1 -1
- package/dist/popover/index.d.mts +2 -0
- package/dist/popover/index.d.mts.map +1 -1
- package/dist/popover/index.mjs +2 -0
- package/dist/popover/index.mjs.map +1 -1
- package/dist/popover/popover-close.d.mts +18 -0
- package/dist/popover/popover-close.d.mts.map +1 -1
- package/dist/popover/popover-close.mjs +2 -0
- package/dist/popover/popover-close.mjs.map +1 -1
- package/dist/popover/popover-description.d.mts +12 -0
- package/dist/popover/popover-description.d.mts.map +1 -1
- package/dist/popover/popover-description.mjs +2 -0
- package/dist/popover/popover-description.mjs.map +1 -1
- package/dist/popover/popover-popup.d.mts +30 -4
- package/dist/popover/popover-popup.d.mts.map +1 -1
- package/dist/popover/popover-popup.mjs +2 -0
- package/dist/popover/popover-popup.mjs.map +1 -1
- package/dist/popover/popover-root.d.mts +9 -0
- package/dist/popover/popover-root.d.mts.map +1 -1
- package/dist/popover/popover-root.mjs +2 -0
- package/dist/popover/popover-root.mjs.map +1 -1
- package/dist/popover/popover-title.d.mts +11 -0
- package/dist/popover/popover-title.d.mts.map +1 -1
- package/dist/popover/popover-title.mjs +2 -0
- package/dist/popover/popover-title.mjs.map +1 -1
- package/dist/popover/popover-trigger.d.mts +15 -0
- package/dist/popover/popover-trigger.d.mts.map +1 -1
- package/dist/popover/popover-trigger.mjs +2 -0
- package/dist/popover/popover-trigger.mjs.map +1 -1
- package/dist/progress/index.d.mts +2 -0
- package/dist/progress/index.d.mts.map +1 -1
- package/dist/progress/index.mjs +2 -0
- package/dist/progress/index.mjs.map +1 -1
- package/dist/progress/progress-indicator.d.mts +11 -0
- package/dist/progress/progress-indicator.d.mts.map +1 -1
- package/dist/progress/progress-indicator.mjs +2 -0
- package/dist/progress/progress-indicator.mjs.map +1 -1
- package/dist/progress/progress-label.d.mts +11 -0
- package/dist/progress/progress-label.d.mts.map +1 -1
- package/dist/progress/progress-label.mjs +2 -0
- package/dist/progress/progress-label.mjs.map +1 -1
- package/dist/progress/progress-root.d.mts +36 -8
- package/dist/progress/progress-root.d.mts.map +1 -1
- package/dist/progress/progress-root.mjs +2 -0
- package/dist/progress/progress-root.mjs.map +1 -1
- package/dist/progress/progress-track.d.mts +11 -0
- package/dist/progress/progress-track.d.mts.map +1 -1
- package/dist/progress/progress-track.mjs +2 -0
- package/dist/progress/progress-track.mjs.map +1 -1
- package/dist/progress/progress-value.d.mts +15 -1
- package/dist/progress/progress-value.d.mts.map +1 -1
- package/dist/progress/progress-value.mjs +2 -0
- package/dist/progress/progress-value.mjs.map +1 -1
- package/dist/radio-group/index.d.mts +2 -0
- package/dist/radio-group/index.d.mts.map +1 -1
- package/dist/radio-group/index.mjs +2 -0
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/radio-group/radio-group-item.d.mts +18 -1
- package/dist/radio-group/radio-group-item.d.mts.map +1 -1
- package/dist/radio-group/radio-group-item.mjs +2 -0
- package/dist/radio-group/radio-group-item.mjs.map +1 -1
- package/dist/radio-group/radio-group-label.d.mts +10 -0
- package/dist/radio-group/radio-group-label.d.mts.map +1 -1
- package/dist/radio-group/radio-group-label.mjs +2 -0
- package/dist/radio-group/radio-group-label.mjs.map +1 -1
- package/dist/radio-group/radio-group-root.d.mts +29 -5
- package/dist/radio-group/radio-group-root.d.mts.map +1 -1
- package/dist/radio-group/radio-group-root.mjs +2 -0
- package/dist/radio-group/radio-group-root.mjs.map +1 -1
- package/dist/select/index.d.mts +2 -0
- package/dist/select/index.d.mts.map +1 -1
- package/dist/select/index.mjs +2 -0
- package/dist/select/index.mjs.map +1 -1
- package/dist/select/select-group-label.d.mts +10 -0
- package/dist/select/select-group-label.d.mts.map +1 -1
- package/dist/select/select-group-label.mjs +2 -0
- package/dist/select/select-group-label.mjs.map +1 -1
- package/dist/select/select-group.d.mts +15 -1
- package/dist/select/select-group.d.mts.map +1 -1
- package/dist/select/select-group.mjs +2 -0
- package/dist/select/select-group.mjs.map +1 -1
- package/dist/select/select-option.d.mts +19 -1
- package/dist/select/select-option.d.mts.map +1 -1
- package/dist/select/select-option.mjs +2 -0
- package/dist/select/select-option.mjs.map +1 -1
- package/dist/select/select-root.d.mts +24 -1
- package/dist/select/select-root.d.mts.map +1 -1
- package/dist/select/select-root.mjs +2 -0
- package/dist/select/select-root.mjs.map +1 -1
- package/dist/select/select-separator.d.mts +9 -0
- package/dist/select/select-separator.d.mts.map +1 -1
- package/dist/select/select-separator.mjs +2 -0
- package/dist/select/select-separator.mjs.map +1 -1
- package/dist/select/select-trigger.d.mts +9 -0
- package/dist/select/select-trigger.d.mts.map +1 -1
- package/dist/select/select-trigger.mjs +2 -0
- package/dist/select/select-trigger.mjs.map +1 -1
- package/dist/select/select-value.d.mts +9 -0
- package/dist/select/select-value.d.mts.map +1 -1
- package/dist/select/select-value.mjs +2 -0
- package/dist/select/select-value.mjs.map +1 -1
- package/dist/slider/index.d.mts +2 -0
- package/dist/slider/index.d.mts.map +1 -1
- package/dist/slider/index.mjs +2 -0
- package/dist/slider/index.mjs.map +1 -1
- package/dist/slider/slider-indicator.d.mts +12 -0
- package/dist/slider/slider-indicator.d.mts.map +1 -1
- package/dist/slider/slider-indicator.mjs +2 -0
- package/dist/slider/slider-indicator.mjs.map +1 -1
- package/dist/slider/slider-label.d.mts +11 -1
- package/dist/slider/slider-label.d.mts.map +1 -1
- package/dist/slider/slider-label.mjs +2 -0
- package/dist/slider/slider-label.mjs.map +1 -1
- package/dist/slider/slider-root.d.mts +53 -9
- package/dist/slider/slider-root.d.mts.map +1 -1
- package/dist/slider/slider-root.mjs +2 -0
- package/dist/slider/slider-root.mjs.map +1 -1
- package/dist/slider/slider-thumb.d.mts +32 -3
- package/dist/slider/slider-thumb.d.mts.map +1 -1
- package/dist/slider/slider-thumb.mjs +2 -0
- package/dist/slider/slider-thumb.mjs.map +1 -1
- package/dist/slider/slider-track.d.mts +17 -0
- package/dist/slider/slider-track.d.mts.map +1 -1
- package/dist/slider/slider-track.mjs +2 -0
- package/dist/slider/slider-track.mjs.map +1 -1
- package/dist/slider/slider-value.d.mts +11 -0
- package/dist/slider/slider-value.d.mts.map +1 -1
- package/dist/slider/slider-value.mjs +2 -0
- package/dist/slider/slider-value.mjs.map +1 -1
- package/dist/switch/switch.d.mts +23 -3
- package/dist/switch/switch.d.mts.map +1 -1
- package/dist/switch/switch.mjs +2 -0
- package/dist/switch/switch.mjs.map +1 -1
- package/dist/tabs/index.d.mts +2 -0
- package/dist/tabs/index.d.mts.map +1 -1
- package/dist/tabs/index.mjs +2 -0
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/tabs/tabs-context.d.mts +5 -0
- package/dist/tabs/tabs-context.d.mts.map +1 -1
- package/dist/tabs/tabs-context.mjs.map +1 -1
- package/dist/tabs/tabs-indicator.d.mts +17 -0
- package/dist/tabs/tabs-indicator.d.mts.map +1 -1
- package/dist/tabs/tabs-indicator.mjs +2 -0
- package/dist/tabs/tabs-indicator.mjs.map +1 -1
- package/dist/tabs/tabs-list.d.mts +19 -1
- package/dist/tabs/tabs-list.d.mts.map +1 -1
- package/dist/tabs/tabs-list.mjs +2 -0
- package/dist/tabs/tabs-list.mjs.map +1 -1
- package/dist/tabs/tabs-panel.d.mts +19 -0
- package/dist/tabs/tabs-panel.d.mts.map +1 -1
- package/dist/tabs/tabs-panel.mjs +2 -0
- package/dist/tabs/tabs-panel.mjs.map +1 -1
- package/dist/tabs/tabs-root.d.mts +39 -5
- package/dist/tabs/tabs-root.d.mts.map +1 -1
- package/dist/tabs/tabs-root.mjs +2 -0
- package/dist/tabs/tabs-root.mjs.map +1 -1
- package/dist/tabs/tabs-tab.d.mts +22 -1
- package/dist/tabs/tabs-tab.d.mts.map +1 -1
- package/dist/tabs/tabs-tab.mjs +2 -0
- package/dist/tabs/tabs-tab.mjs.map +1 -1
- package/dist/toast/index.d.mts +2 -0
- package/dist/toast/index.d.mts.map +1 -1
- package/dist/toast/index.mjs +2 -0
- package/dist/toast/index.mjs.map +1 -1
- package/dist/toast/toast-action.d.mts +28 -3
- package/dist/toast/toast-action.d.mts.map +1 -1
- package/dist/toast/toast-action.mjs +2 -0
- package/dist/toast/toast-action.mjs.map +1 -1
- package/dist/toast/toast-close.d.mts +16 -0
- package/dist/toast/toast-close.d.mts.map +1 -1
- package/dist/toast/toast-close.mjs +2 -0
- package/dist/toast/toast-close.mjs.map +1 -1
- package/dist/toast/toast-description.d.mts +16 -1
- package/dist/toast/toast-description.d.mts.map +1 -1
- package/dist/toast/toast-description.mjs +2 -0
- package/dist/toast/toast-description.mjs.map +1 -1
- package/dist/toast/toast-root.d.mts +20 -0
- package/dist/toast/toast-root.d.mts.map +1 -1
- package/dist/toast/toast-root.mjs +2 -0
- package/dist/toast/toast-root.mjs.map +1 -1
- package/dist/toast/toast-title.d.mts +15 -1
- package/dist/toast/toast-title.d.mts.map +1 -1
- package/dist/toast/toast-title.mjs +2 -0
- package/dist/toast/toast-title.mjs.map +1 -1
- package/dist/toast/toast-viewport.d.mts +34 -5
- package/dist/toast/toast-viewport.d.mts.map +1 -1
- package/dist/toast/toast-viewport.mjs +2 -0
- package/dist/toast/toast-viewport.mjs.map +1 -1
- package/dist/toast/toast.d.mts +46 -6
- package/dist/toast/toast.d.mts.map +1 -1
- package/dist/toast/toast.mjs +4 -0
- package/dist/toast/toast.mjs.map +1 -1
- package/dist/toggle/toggle.d.mts +20 -2
- package/dist/toggle/toggle.d.mts.map +1 -1
- package/dist/toggle/toggle.mjs +2 -0
- package/dist/toggle/toggle.mjs.map +1 -1
- package/dist/toggle-group/index.d.mts +2 -0
- package/dist/toggle-group/index.d.mts.map +1 -1
- package/dist/toggle-group/index.mjs +2 -0
- package/dist/toggle-group/index.mjs.map +1 -1
- package/dist/toggle-group/toggle-group-context.d.mts +1 -0
- package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
- package/dist/toggle-group/toggle-group-item.d.mts +16 -0
- package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-item.mjs +2 -0
- package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
- package/dist/toggle-group/toggle-group-root.d.mts +73 -12
- package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-root.mjs +2 -0
- package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
- package/dist/toolbar/index.d.mts +2 -0
- package/dist/toolbar/index.d.mts.map +1 -1
- package/dist/toolbar/index.mjs +2 -0
- package/dist/toolbar/index.mjs.map +1 -1
- package/dist/toolbar/toolbar-root.d.mts +30 -3
- package/dist/toolbar/toolbar-root.d.mts.map +1 -1
- package/dist/toolbar/toolbar-root.mjs +2 -0
- package/dist/toolbar/toolbar-root.mjs.map +1 -1
- package/dist/toolbar/toolbar-separator.d.mts +13 -0
- package/dist/toolbar/toolbar-separator.d.mts.map +1 -1
- package/dist/toolbar/toolbar-separator.mjs +2 -0
- package/dist/toolbar/toolbar-separator.mjs.map +1 -1
- package/dist/tooltip/index.d.mts +2 -0
- package/dist/tooltip/index.d.mts.map +1 -1
- package/dist/tooltip/index.mjs +2 -0
- package/dist/tooltip/index.mjs.map +1 -1
- package/dist/tooltip/tooltip-arrow.d.mts +16 -0
- package/dist/tooltip/tooltip-arrow.d.mts.map +1 -1
- package/dist/tooltip/tooltip-arrow.mjs +2 -0
- package/dist/tooltip/tooltip-arrow.mjs.map +1 -1
- package/dist/tooltip/tooltip-context.d.mts +4 -0
- package/dist/tooltip/tooltip-context.d.mts.map +1 -1
- package/dist/tooltip/tooltip-context.mjs.map +1 -1
- package/dist/tooltip/tooltip-popup.d.mts +24 -3
- package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
- package/dist/tooltip/tooltip-popup.mjs +2 -0
- package/dist/tooltip/tooltip-popup.mjs.map +1 -1
- package/dist/tooltip/tooltip-root.d.mts +24 -2
- package/dist/tooltip/tooltip-root.d.mts.map +1 -1
- package/dist/tooltip/tooltip-root.mjs +2 -0
- package/dist/tooltip/tooltip-root.mjs.map +1 -1
- package/dist/tooltip/tooltip-trigger.d.mts +18 -1
- package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
- package/dist/tooltip/tooltip-trigger.mjs +2 -0
- package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
- package/package.json +9 -1
- package/skills/funstack-ui-knowledge/SKILL.md +75 -0
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
# Context menu
|
|
2
|
+
|
|
3
|
+
A context menu is a [Menu](menu.md) opened from a different trigger. `Menu.ContextTrigger` is a region (any element) whose `contextmenu` event (right-click, Ctrl+click on macOS, Shift+F10 or the ContextMenu key) or touch long-press opens the Root's `Menu.Popup` at the pointer. Everything inside the popup is Menu's: items whose `action` runs with `data-pending`, checkbox and radio items, submenus, typeahead, Escape and Tab. The library fills the three gaps the platform leaves: touch on iOS (which never fires `contextmenu`), placing a popover at a point, and the light dismiss that would close a just-opened menu in Firefox and Safari.
|
|
4
|
+
|
|
5
|
+
```tsx title="ContextMenuFiles.tsx"
|
|
6
|
+
"use client";
|
|
7
|
+
import { startTransition, useState } from "react";
|
|
8
|
+
import { Menu } from "@funstack/ui/menu";
|
|
9
|
+
import { fakeSave } from "./fake-api.js";
|
|
10
|
+
|
|
11
|
+
interface File {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly size: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const initialFiles: readonly File[] = [
|
|
18
|
+
{ id: "1", name: "Report.pdf", size: "1.2 MB" },
|
|
19
|
+
{ id: "2", name: "Budget.xlsx", size: "84 KB" },
|
|
20
|
+
{ id: "3", name: "Notes.md", size: "3 KB" },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
// One Menu.Root per row with two ways in: the "⋯" button opens the menu anchored below it, a
|
|
24
|
+
// right-click anywhere on the row (or Shift+F10 on the button, or a long-press on touch) opens
|
|
25
|
+
// the same menu at the pointer. The button is also the required alternate path: a context menu
|
|
26
|
+
// is never the only way to an action. Archive is a fake 1.2 s server call: the item shows
|
|
27
|
+
// "Archiving…" (data-pending) and the menu closes when it settles.
|
|
28
|
+
export function ContextMenuFiles() {
|
|
29
|
+
const [files, setFiles] = useState(initialFiles);
|
|
30
|
+
const [log, setLog] = useState("Right-click a row, or use its ⋯ button.");
|
|
31
|
+
const remove = (id: string) =>
|
|
32
|
+
startTransition(() => setFiles((f) => f.filter((x) => x.id !== id)));
|
|
33
|
+
const rename = (id: string) =>
|
|
34
|
+
startTransition(() =>
|
|
35
|
+
setFiles((f) => f.map((x) => (x.id === id ? { ...x, name: `Renamed ${x.name}` } : x))),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div className="demo-stack">
|
|
40
|
+
<table className="demo-files">
|
|
41
|
+
<thead>
|
|
42
|
+
<tr>
|
|
43
|
+
<th scope="col">Name</th>
|
|
44
|
+
<th scope="col">Size</th>
|
|
45
|
+
<th scope="col">
|
|
46
|
+
<span className="demo-cm-hidden">Actions</span>
|
|
47
|
+
</th>
|
|
48
|
+
</tr>
|
|
49
|
+
</thead>
|
|
50
|
+
<tbody>
|
|
51
|
+
{files.map((file) => (
|
|
52
|
+
<Menu.Root
|
|
53
|
+
key={file.id}
|
|
54
|
+
openChangeAction={(open, { reason }) => {
|
|
55
|
+
if (open) setLog(`Opened the menu of ${file.name} (${reason}).`);
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
<Menu.ContextTrigger render={<tr className="demo-file-row" />}>
|
|
59
|
+
<td>{file.name}</td>
|
|
60
|
+
<td>{file.size}</td>
|
|
61
|
+
<td>
|
|
62
|
+
<Menu.Trigger
|
|
63
|
+
className="demo-icon-button"
|
|
64
|
+
aria-label={`Actions for ${file.name}`}
|
|
65
|
+
>
|
|
66
|
+
{({ pending }) =>
|
|
67
|
+
pending ? <span className="demo-spinner" aria-hidden /> : "⋯"
|
|
68
|
+
}
|
|
69
|
+
</Menu.Trigger>
|
|
70
|
+
{/* In a table the Popup goes inside a cell (a <div> cannot sit next to a <tr>);
|
|
71
|
+
its clicks and keys then bubble to the row: check event.target there. */}
|
|
72
|
+
<Menu.Popup className="demo-menu" align="end">
|
|
73
|
+
<Menu.Item action={() => rename(file.id)}>Rename</Menu.Item>
|
|
74
|
+
<Menu.Item
|
|
75
|
+
action={async () => {
|
|
76
|
+
await fakeSave("the archive", { ms: 1200 });
|
|
77
|
+
remove(file.id);
|
|
78
|
+
startTransition(() => setLog(`Archived ${file.name}.`));
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
{({ pending }) => (pending ? "Archiving…" : "Archive")}
|
|
82
|
+
</Menu.Item>
|
|
83
|
+
<Menu.Separator />
|
|
84
|
+
<Menu.Item className="demo-menu-danger" action={() => remove(file.id)}>
|
|
85
|
+
Delete
|
|
86
|
+
</Menu.Item>
|
|
87
|
+
</Menu.Popup>
|
|
88
|
+
</td>
|
|
89
|
+
</Menu.ContextTrigger>
|
|
90
|
+
</Menu.Root>
|
|
91
|
+
))}
|
|
92
|
+
</tbody>
|
|
93
|
+
</table>
|
|
94
|
+
{files.length === 0 && (
|
|
95
|
+
<button type="button" className="demo-button" onClick={() => setFiles(initialFiles)}>
|
|
96
|
+
Restore the files
|
|
97
|
+
</button>
|
|
98
|
+
)}
|
|
99
|
+
<p className="demo-readout">{log}</p>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```css title="context-menu.css"
|
|
106
|
+
/* Context menu: the region (Menu.ContextTrigger) carries `data-open` while its menu is open and
|
|
107
|
+
`data-pending` while the open is in flight. The popup uses the Menu styles (menu.css); a
|
|
108
|
+
context open is `[data-context]` and is placed at the pointer by the library, so it gets no
|
|
109
|
+
anchored gap (menu.css only adds one for `[data-side]`). */
|
|
110
|
+
|
|
111
|
+
.demo-files {
|
|
112
|
+
inline-size: 100%;
|
|
113
|
+
max-inline-size: 28rem;
|
|
114
|
+
border-collapse: collapse;
|
|
115
|
+
}
|
|
116
|
+
.demo-files th,
|
|
117
|
+
.demo-files td {
|
|
118
|
+
padding: 6px 10px;
|
|
119
|
+
border-block-end: 1px solid var(--color-border);
|
|
120
|
+
text-align: start;
|
|
121
|
+
}
|
|
122
|
+
.demo-files td:last-child {
|
|
123
|
+
inline-size: 1%;
|
|
124
|
+
white-space: nowrap;
|
|
125
|
+
}
|
|
126
|
+
/* The row whose menu is open. */
|
|
127
|
+
.demo-file-row[data-open] {
|
|
128
|
+
background: color-mix(in srgb, var(--color-primary) 12%, transparent);
|
|
129
|
+
}
|
|
130
|
+
.demo-file-row[data-pending] {
|
|
131
|
+
cursor: progress;
|
|
132
|
+
}
|
|
133
|
+
/* Touch: no text selection or loupe during the long-press. A trade-off (the row's text is not
|
|
134
|
+
selectable by touch), so it is the page's choice, not a library default. */
|
|
135
|
+
.demo-file-row {
|
|
136
|
+
-webkit-user-select: none;
|
|
137
|
+
user-select: none;
|
|
138
|
+
}
|
|
139
|
+
.demo-cm-hidden {
|
|
140
|
+
position: absolute;
|
|
141
|
+
inline-size: 1px;
|
|
142
|
+
block-size: 1px;
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
clip-path: inset(50%);
|
|
145
|
+
white-space: nowrap;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.demo-canvas {
|
|
149
|
+
display: block;
|
|
150
|
+
max-inline-size: 100%;
|
|
151
|
+
border: 1px solid var(--color-border);
|
|
152
|
+
border-radius: 8px;
|
|
153
|
+
background: var(--color-bg);
|
|
154
|
+
-webkit-user-select: none;
|
|
155
|
+
user-select: none;
|
|
156
|
+
}
|
|
157
|
+
.demo-canvas:focus-visible {
|
|
158
|
+
outline: 2px solid var(--color-primary);
|
|
159
|
+
outline-offset: 2px;
|
|
160
|
+
}
|
|
161
|
+
.demo-canvas[data-open] {
|
|
162
|
+
border-color: var(--color-primary);
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
A file list: each row is a region with a ⋯ button in the same Root, so a right-click, a long-press and the button open one menu. Archive is a slow action: the item shows `data-pending` and the menu closes when it settles.
|
|
167
|
+
|
|
168
|
+
```tsx title="ContextMenuCanvas.tsx"
|
|
169
|
+
"use client";
|
|
170
|
+
import { startTransition, useEffect, useRef, useState } from "react";
|
|
171
|
+
import { Menu } from "@funstack/ui/menu";
|
|
172
|
+
import { sleep } from "./fake-api.js";
|
|
173
|
+
|
|
174
|
+
// A focusable canvas as the region: right-click it, long-press it on touch, or focus it (Tab)
|
|
175
|
+
// and press Shift+F10 / the ContextMenu key. The checkbox and radio items keep the menu open and
|
|
176
|
+
// show data-pending while their (fake) save runs; "Export" is a submenu. The same options sit in
|
|
177
|
+
// the toolbar above: a context menu is never the only way to an action. A second right-click
|
|
178
|
+
// elsewhere on the canvas moves the open menu there.
|
|
179
|
+
export function ContextMenuCanvas() {
|
|
180
|
+
const [grid, setGrid] = useState(true);
|
|
181
|
+
const [zoom, setZoom] = useState("fit");
|
|
182
|
+
const [exported, setExported] = useState("(nothing exported yet)");
|
|
183
|
+
const canvas = useRef<HTMLCanvasElement>(null);
|
|
184
|
+
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
const element = canvas.current;
|
|
187
|
+
const context = element?.getContext("2d");
|
|
188
|
+
if (!element || !context) return;
|
|
189
|
+
const { width, height } = element;
|
|
190
|
+
context.clearRect(0, 0, width, height);
|
|
191
|
+
const step = zoom === "fit" ? 20 : 40;
|
|
192
|
+
if (grid) {
|
|
193
|
+
context.strokeStyle = "rgb(128 128 128 / 0.35)";
|
|
194
|
+
for (let x = 0; x <= width; x += step) {
|
|
195
|
+
context.beginPath();
|
|
196
|
+
context.moveTo(x, 0);
|
|
197
|
+
context.lineTo(x, height);
|
|
198
|
+
context.stroke();
|
|
199
|
+
}
|
|
200
|
+
for (let y = 0; y <= height; y += step) {
|
|
201
|
+
context.beginPath();
|
|
202
|
+
context.moveTo(0, y);
|
|
203
|
+
context.lineTo(width, y);
|
|
204
|
+
context.stroke();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
context.fillStyle = "rgb(99 102 241)";
|
|
208
|
+
const size = step * 3;
|
|
209
|
+
context.fillRect(width / 2 - size / 2, height / 2 - size / 2, size, size);
|
|
210
|
+
}, [grid, zoom]);
|
|
211
|
+
|
|
212
|
+
const saveGrid = async (next: boolean) => {
|
|
213
|
+
await sleep(500);
|
|
214
|
+
startTransition(() => setGrid(next));
|
|
215
|
+
};
|
|
216
|
+
const saveZoom = async (next: string) => {
|
|
217
|
+
await sleep(500);
|
|
218
|
+
startTransition(() => setZoom(next));
|
|
219
|
+
};
|
|
220
|
+
const exportAs = (format: string) => async () => {
|
|
221
|
+
await sleep(800);
|
|
222
|
+
startTransition(() => setExported(`Exported diagram.${format}`));
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<div className="demo-stack">
|
|
227
|
+
<div className="demo-row" role="group" aria-label="View">
|
|
228
|
+
<label className="demo-row">
|
|
229
|
+
<input
|
|
230
|
+
type="checkbox"
|
|
231
|
+
checked={grid}
|
|
232
|
+
onChange={(e) => startTransition(() => setGrid(e.target.checked))}
|
|
233
|
+
/>
|
|
234
|
+
Grid
|
|
235
|
+
</label>
|
|
236
|
+
<select
|
|
237
|
+
aria-label="Zoom"
|
|
238
|
+
value={zoom}
|
|
239
|
+
onChange={(e) => startTransition(() => setZoom(e.target.value))}
|
|
240
|
+
>
|
|
241
|
+
<option value="fit">Fit</option>
|
|
242
|
+
<option value="100">100%</option>
|
|
243
|
+
</select>
|
|
244
|
+
</div>
|
|
245
|
+
<Menu.Root>
|
|
246
|
+
<Menu.ContextTrigger
|
|
247
|
+
render={
|
|
248
|
+
<canvas ref={canvas} width={320} height={160} tabIndex={0} aria-label="Diagram" />
|
|
249
|
+
}
|
|
250
|
+
className="demo-canvas"
|
|
251
|
+
/>
|
|
252
|
+
<Menu.Popup
|
|
253
|
+
className="demo-menu"
|
|
254
|
+
aria-label="Diagram options"
|
|
255
|
+
transition={{
|
|
256
|
+
"fsui-menu-open": "menu-in",
|
|
257
|
+
"fsui-menu-close": "menu-out",
|
|
258
|
+
default: "none",
|
|
259
|
+
}}
|
|
260
|
+
>
|
|
261
|
+
<Menu.CheckboxItem checked={grid} checkedChangeAction={saveGrid}>
|
|
262
|
+
Show grid
|
|
263
|
+
</Menu.CheckboxItem>
|
|
264
|
+
<Menu.RadioGroup value={zoom} valueChangeAction={saveZoom}>
|
|
265
|
+
<Menu.GroupLabel className="demo-menu-label">Zoom</Menu.GroupLabel>
|
|
266
|
+
<Menu.RadioItem value="fit">Fit</Menu.RadioItem>
|
|
267
|
+
<Menu.RadioItem value="100">100%</Menu.RadioItem>
|
|
268
|
+
</Menu.RadioGroup>
|
|
269
|
+
<Menu.Separator />
|
|
270
|
+
<Menu.Root>
|
|
271
|
+
<Menu.SubmenuTrigger>Export</Menu.SubmenuTrigger>
|
|
272
|
+
<Menu.Popup className="demo-menu">
|
|
273
|
+
<Menu.Item action={exportAs("svg")}>
|
|
274
|
+
{({ pending }) => (pending ? "Exporting…" : "SVG")}
|
|
275
|
+
</Menu.Item>
|
|
276
|
+
<Menu.Item action={exportAs("png")}>
|
|
277
|
+
{({ pending }) => (pending ? "Exporting…" : "PNG")}
|
|
278
|
+
</Menu.Item>
|
|
279
|
+
</Menu.Popup>
|
|
280
|
+
</Menu.Root>
|
|
281
|
+
</Menu.Popup>
|
|
282
|
+
</Menu.Root>
|
|
283
|
+
<p className="demo-readout">{exported}</p>
|
|
284
|
+
</div>
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
`context-menu.css`: the same file as above.
|
|
290
|
+
|
|
291
|
+
A focusable canvas as the region: right-click, long-press, or Tab to it and press Shift+F10. The checkbox and radio items keep the menu open; a second right-click moves the open menu.
|
|
292
|
+
|
|
293
|
+
## Anatomy
|
|
294
|
+
|
|
295
|
+
```tsx
|
|
296
|
+
import { Menu } from "@funstack/ui/menu";
|
|
297
|
+
|
|
298
|
+
<Menu.Root> {/* no DOM; as Menu */}
|
|
299
|
+
<Menu.ContextTrigger render={<div className="card" />}> {/* the region: any element, no ARIA */}
|
|
300
|
+
<h3>{file.name}</h3>
|
|
301
|
+
<Menu.Trigger aria-label={`Actions for ${file.name}`}>⋯</Menu.Trigger> {/* optional: the same menu as a button */}
|
|
302
|
+
</Menu.ContextTrigger>
|
|
303
|
+
<Menu.Popup aria-label="File actions"> {/* a sibling of the region */}
|
|
304
|
+
<Menu.Item action={rename}>Rename</Menu.Item>
|
|
305
|
+
<Menu.Item action={archive}>Archive</Menu.Item>
|
|
306
|
+
<Menu.Root>
|
|
307
|
+
<Menu.SubmenuTrigger>Move to</Menu.SubmenuTrigger>
|
|
308
|
+
<Menu.Popup>…</Menu.Popup>
|
|
309
|
+
</Menu.Root>
|
|
310
|
+
</Menu.Popup>
|
|
311
|
+
</Menu.Root>
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
- **One new part** in the Menu namespace. There is no `ContextMenu` namespace: Root, Popup, items and submenus are Menu's.
|
|
315
|
+
- **The region is a plain element**: no role (a `tr`, `li` or `canvas` through `render` keeps its own), no `aria-haspopup` (not allowed on generic elements) and no `aria-expanded`. ARIA has no way to say "this has a context menu". `tabIndex` is yours ([rule 2](#accessibility-rules)).
|
|
316
|
+
- **Render the Popup next to the region**, so the reading order is natural. In a table row (`render={<tr />}`) put it inside a cell instead: a `<div>` cannot be a sibling of a `<tr>`. Right-clicks and long-presses inside a menu (this one, or any other `Menu.Popup` inside the region) are never the region's. Other events inside the menu do bubble to the row, in the DOM and in React: a row `onClick` (selection) also sees item clicks, and selectors such as `.row:hover *` reach the menu. Check `event.target` in row handlers.
|
|
317
|
+
- A right-click inside a popup that is not a menu (a `Popover.Popup`, a Select picker) rendered inside the region is the region's: its menu opens and the other popup closes, as any `popover="auto"` would. Keep such popups outside the region, or give them `onContextMenu={(e) => e.preventDefault()}`, which keeps the region quiet there.
|
|
318
|
+
- A `Menu.ContextTrigger` belongs to a top-level Root; inside a `Menu.Popup` a Root is a submenu (development warning).
|
|
319
|
+
|
|
320
|
+
## How it works
|
|
321
|
+
|
|
322
|
+
### Opening
|
|
323
|
+
|
|
324
|
+
| Input | Where | What opens |
|
|
325
|
+
| - | - | - |
|
|
326
|
+
| Right-click; Ctrl+click on macOS | the region | The menu at the pointer, first item focused without a focus ring |
|
|
327
|
+
| Shift+F10, the ContextMenu key; Ctrl+Return on macOS; VO+Shift+M | a focused element in the region | The menu inside the focused element (the browser puts the event there), first item focused with the ring |
|
|
328
|
+
| Long-press (touch, pen) | the region | After `longPressDelay` (500 ms) held within 10 px: the menu 16 px above the touch point (so the finger does not cover it), first item focused quietly |
|
|
329
|
+
|
|
330
|
+
- The open is Menu's: `openChangeAction(true, { reason: "activate" })` with `details.event` the `contextmenu` event (the `pointerdown` of a long-press), in the Root's transition. Items that suspend hold the open with `data-pending` on the region (and on a Trigger in the same Root); a rejection rolls `data-open` back.
|
|
331
|
+
- The long-press runs on every platform for touch and pen pointers, because iOS fires no `contextmenu`. Where the platform fires its own (Android, Windows pen), whichever comes first opens once. The page stays scrollable: a pan cancels the press. The one click a release may synthesise is swallowed. Keep the finger down to slide onto an item (see Press-drag-release).
|
|
332
|
+
- **Before hydration** the browser's own menu shows. Nothing is half-open and nothing is replayed after hydration; the custom menu works from then on.
|
|
333
|
+
|
|
334
|
+
### Placement
|
|
335
|
+
|
|
336
|
+
A mouse or keyboard open puts the menu's top-left corner at the point; a touch or pen open puts the menu **above** the point with a 16 px gap, so the finger does not cover it. Either flips when it does not fit: upward (touch: downward, below the finger) at the edge, leftward at the right edge, both in the corner. CSS anchor positioning anchors to elements, not points, so the Popup renders the point inline (`--menu-point-x`, `--menu-point-y`, and the gap as `--menu-point-gap`: `0px` for a mouse, `16px` for touch), puts the insets there and names three `@position-try` options that mirror it. A right-to-left menu mirrors all of it (see below). The menu lives in the top layer, so a transformed or filtered ancestor of the region does not move it.
|
|
337
|
+
|
|
338
|
+
Those options are shipped CSS: a `<style>` React hoists into `<head>` once per page on the first context open (`data-href="@funstack/ui/menu-point"`). It is functional only: eight named at-rules (a menu names the three that apply to its direction and pointer kind), no selectors, nothing visual.
|
|
339
|
+
|
|
340
|
+
```css
|
|
341
|
+
@position-try --fsui-menu-up { top: auto; bottom: calc(100% - var(--menu-point-y) + var(--menu-point-gap)); }
|
|
342
|
+
@position-try --fsui-menu-down { bottom: auto; top: calc(var(--menu-point-y) + var(--menu-point-gap)); }
|
|
343
|
+
@position-try --fsui-menu-left { left: auto; right: calc(100% - var(--menu-point-x)); }
|
|
344
|
+
@position-try --fsui-menu-right { right: auto; left: var(--menu-point-x); }
|
|
345
|
+
/* and the four corners: --fsui-menu-up-left, -up-right, -down-left, -down-right */
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
| Open | Inline placement | Fallbacks (LTR; RTL mirrors left and right) |
|
|
349
|
+
| - | - | - |
|
|
350
|
+
| Mouse, keyboard | `top: calc(var(--menu-point-y) + var(--menu-point-gap))`, `left: var(--menu-point-x)`; gap `0px` | `--fsui-menu-up`, `--fsui-menu-left`, `--fsui-menu-up-left` |
|
|
351
|
+
| Touch, pen | `bottom: calc(100% - var(--menu-point-y) + var(--menu-point-gap))`, `left: var(--menu-point-x)`; gap `16px` | `--fsui-menu-left`, `--fsui-menu-down`, `--fsui-menu-down-left` |
|
|
352
|
+
|
|
353
|
+
- **Adjust** with the Popup's `style`, which wins over the inline placement (your own `position-try-fallbacks`, a `margin`, a different touch gap: `style={{ "--menu-point-gap": "24px" }}`).
|
|
354
|
+
- **Opt out** with `side={null}` on the Popup: no inline placement and no `<style>` on either path; a context open still sets `--menu-point-x` / `--menu-point-y` / `--menu-point-gap` and `data-context` for your stylesheet.
|
|
355
|
+
- **Content Security Policy:** under a strict `style-src` the stylesheet needs its hash or a nonce (see [Content Security Policy](#content-security-policy) below). Blocked, the menu still opens at the point but never flips.
|
|
356
|
+
- **Right-to-left:** when the popup's computed `direction` is `rtl` (an RTL page, or a `dir="rtl"` ancestor of the Popup), the menu's **right** edge sits at the point (`right: calc(100% - var(--menu-point-x))`) and it flips rightward at the left edge, as native menus do under a right-to-left UI. The library reads the direction once per open or move; nothing is read on the server. The point placement uses insets, so the Firefox RTL-container bug of the anchored popups (Mozilla 2019601) does not apply.
|
|
357
|
+
|
|
358
|
+
```tsx
|
|
359
|
+
<Menu.Popup side={null} className="menu">…</Menu.Popup>
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
```css
|
|
363
|
+
.menu[data-context] {
|
|
364
|
+
inset: auto;
|
|
365
|
+
left: var(--menu-point-x);
|
|
366
|
+
top: var(--menu-point-y);
|
|
367
|
+
position-try-fallbacks: --mine;
|
|
368
|
+
}
|
|
369
|
+
@position-try --mine { top: auto; bottom: calc(100% - var(--menu-point-y)); }
|
|
370
|
+
/* A touch open: bottom: calc(100% - var(--menu-point-y) + var(--menu-point-gap)). */
|
|
371
|
+
/* self-*: follows the menu's direction (a plain logical keyword would follow the root's only). */
|
|
372
|
+
.menu:not([data-context]) { position-area: bottom span-self-x-end; }
|
|
373
|
+
/* An RTL menu at a point: right: calc(100% - var(--menu-point-x)) instead of left. */
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Moving and closing
|
|
377
|
+
|
|
378
|
+
| Input | What happens | reason |
|
|
379
|
+
| - | - | - |
|
|
380
|
+
| Right-click elsewhere in the region while open | The menu moves to the new point: no `openChangeAction`, items keep their state, a pending item action keeps running, the first item is focused again | – |
|
|
381
|
+
| Right-click or middle-click outside the menu | Closes at once, for every menu (a Menu opened from its button too): the browser's own light dismiss ignores those buttons in Chromium, and native menus close on any click | `"dismiss"` |
|
|
382
|
+
| Right-click inside the menu | Nothing: the browser's menu is suppressed, the menu stays where it is | – |
|
|
383
|
+
| Release of the held button or finger over an item, after sliding onto it | The item is activated, as a click would (see Press-drag-release) | `"activate"` |
|
|
384
|
+
| Release of the held button outside the menu, after moving, at least 500 ms after the menu appeared | Closes at once | `"dismiss"` |
|
|
385
|
+
| A scroll of the page, or of a scroller around the region | Closes at once (a menu at a point only; see Scrolling) | `"dismiss"` |
|
|
386
|
+
| An item's activation, Escape, Tab, a left click outside | As Menu | `"activate"` / `"dismiss"` |
|
|
387
|
+
|
|
388
|
+
Focus after a close is the platform's: the element focused when the menu opened. A right-click on a region that cannot take focus leaves focus on `<body>` (the right-button press already moved it there, as with native menus); with a `Menu.Trigger` in the same Root, focus goes to that button instead.
|
|
389
|
+
|
|
390
|
+
### Press-drag-release
|
|
391
|
+
|
|
392
|
+
On Linux and macOS the browser fires `contextmenu` on the button press, and native menus let you keep the button down, slide onto an item and release to choose it. The library does the same: the popup holds the pointer it captured at the open, and while the button is down the item under the pointer gets focus (quietly, as with hover).
|
|
393
|
+
|
|
394
|
+
| Release | What happens |
|
|
395
|
+
| - | - |
|
|
396
|
+
| Over an enabled item, more than 4 px from where the menu opened | The item is activated through its `click()`: its `action`, `closeOnActivate`, checkbox and radio toggling behave exactly as a click |
|
|
397
|
+
| Outside the menu (and its submenus), after moving more than 4 px, at least 500 ms after the menu appeared | The menu closes (`"dismiss"`) |
|
|
398
|
+
| Anything else: in place, quick, over a disabled item, a separator or a submenu trigger | Nothing: the menu stays open and works with clicks and keys |
|
|
399
|
+
|
|
400
|
+
- Time alone never chooses anything: the menu's corner is under the pointer, so a long, still press must not activate the first item, and a menu that flipped away from the pointer stays open after a still release. A submenu trigger opens its submenu while the pointer rests on it, as with hover.
|
|
401
|
+
- Windows fires `contextmenu` after the release and the keyboard holds no pointer, so neither runs the gesture.
|
|
402
|
+
- **Touch**: after a long-press, keep the finger down and slide onto an item; lift to choose it (10 px slop). While that finger is down the page does not pan, and the lift synthesises no click. A plain lift never closes the menu, which sits above the finger. This is **verified under Chromium's touch emulation; iOS and Android pending ([#90](https://github.com/uhyo/funstack-ui/issues/90))**.
|
|
403
|
+
- During the drag the items do not match `:hover` (the popup holds the pointer): style the current item with `:focus`, as for the keyboard.
|
|
404
|
+
|
|
405
|
+
### Scrolling
|
|
406
|
+
|
|
407
|
+
- **A menu at a point closes when the page scrolls** (`"dismiss"`): a scroll of the document or of a scroller that contains the region. The point means nothing once the content under it has moved. Scrolls of other scrollers (a log elsewhere) and inside the menu are ignored. A menu opened from its `Menu.Trigger` stays open and follows its button.
|
|
408
|
+
- **A scroll already running at the open does not count**: a smooth scroll (for example a Tab under `scroll-behavior: smooth` followed at once by Shift+F10) or trackpad momentum. Scroll events are ignored until the first frame without one; the next scroll closes the menu. A scroll that never pauses keeps the menu open until it does.
|
|
409
|
+
- **A wheel over any menu never scrolls the page** (a menu opened from its button too): the library prevents it unless the menu under the pointer can scroll that way itself. Zooming is left alone: Ctrl+wheel and a trackpad pinch work over a menu.
|
|
410
|
+
- There is no scroll lock, which would fight your app's own and cannot stop a scrollbar drag. To block page scrolling while a context menu is open, as native menus do, add:
|
|
411
|
+
|
|
412
|
+
```css
|
|
413
|
+
html:has([role="menu"][data-context]:popover-open) {
|
|
414
|
+
overflow: hidden;
|
|
415
|
+
scrollbar-gutter: stable;
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### Nested regions and editable targets
|
|
420
|
+
|
|
421
|
+
- **The innermost region wins.** A region opens only when the `contextmenu` event reaches it not yet `defaultPrevented`, and opening prevents it, so an outer region stays quiet. A `disabled` region lets the event through to an outer one. The library never calls `stopPropagation()`, so your document-level listeners still see the event.
|
|
422
|
+
- Your own handler on an element inside the region decides for that element: `preventDefault()` keeps both the browser's menu and the region quiet (a canvas that draws its own); `stopPropagation()` gives the browser's menu (and leaves an open menu of the region open under it).
|
|
423
|
+
- **Text fields keep the browser's menu** (copy, paste, spell-check): a right-click or long-press on a text-taking `<input>`, a `<textarea>` or editable content opens nothing custom. An editor whose menu has its own clipboard items sets `editableTargets="menu"`.
|
|
424
|
+
|
|
425
|
+
```tsx
|
|
426
|
+
<Menu.ContextTrigger editableTargets="menu" render={<div contentEditable />} />
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### Sharing items with a Menu button
|
|
430
|
+
|
|
431
|
+
One Root may hold a `Menu.Trigger` and a `Menu.ContextTrigger`: the button opens the menu anchored below it (`side` / `align`), a right-click opens the same menu at the pointer. It is one menu: while it is open from a right-click the button is exposed as expanded (the browser's state for its `popovertarget`) and shows `data-open`, and a click on it closes the menu. That is the recommended way to satisfy [rule 1](#accessibility-rules), and it gives keyboard users a focusable target inside the region. Use one Root per target (a row, a card); several ContextTriggers in one Root are allowed but all show `data-open` together.
|
|
432
|
+
|
|
433
|
+
## Props
|
|
434
|
+
|
|
435
|
+
### `Menu.ContextTrigger`
|
|
436
|
+
|
|
437
|
+
| Prop | Type | Default | Description |
|
|
438
|
+
| - | - | - | - |
|
|
439
|
+
| `disabled` | `boolean` | `false` | The region does nothing: the browser's menu shows, or an outer region opens. `data-disabled`. |
|
|
440
|
+
| `editableTargets` | `"native" \| "menu"` | `"native"` | What a right-click or long-press on a text-taking `<input>`, a `<textarea>` or editable content inside the region opens: the browser's menu, or this one. |
|
|
441
|
+
| `longPressDelay` | `number` | `500` | Milliseconds a touch or pen pointer must stay down (within 10 px) to open. A development warning when negative. |
|
|
442
|
+
| `className` | `string \| ((state: MenuContextTriggerState) => string \| undefined)` | – | A class name, or a function of the part's state. |
|
|
443
|
+
| `style` | `CSSProperties \| ((state: MenuContextTriggerState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
|
|
444
|
+
| `children` | `ReactNode \| ((state: MenuContextTriggerState) => ReactNode)` | – | Content, or a function of the part's state. |
|
|
445
|
+
| `render` | `ReactElement \| ((props, state: MenuContextTriggerState) => ReactNode)` | – | Replace the default \<div> (element form) or take over rendering (function form). |
|
|
446
|
+
|
|
447
|
+
- **State**: `MenuContextTriggerState` is `{ open, pending, disabled }`; `open` is optimistic, the Root's.
|
|
448
|
+
- **Owned**: `onContextMenu`, `onPointerDown`, `onPointerMove`, `onPointerUp`, `onPointerCancel`, `data-open`, `data-pending`, `data-disabled`, and `-webkit-touch-callout: none` in `style` (your `style` wins).
|
|
449
|
+
|
|
450
|
+
`onKeyDown` and `onClick` pass through. No `id`, `tabIndex` or ARIA. Every prop is serialisable, so a Server Component can render the region.
|
|
451
|
+
|
|
452
|
+
## Data attributes
|
|
453
|
+
|
|
454
|
+
| Hook or prop | On | Meaning |
|
|
455
|
+
| - | - | - |
|
|
456
|
+
| `data-context`, `state.context` | `Menu.Popup` | The current open came from a ContextTrigger and is placed at a point (committed). `data-side` / `data-align` are absent then, and `state.side` is `null`. |
|
|
457
|
+
| `--menu-point-x`, `--menu-point-y` | `Menu.Popup` | The point, inline, in viewport pixels (also with `side={null}`). |
|
|
458
|
+
| `--menu-point-gap` | `Menu.Popup` | The vertical gap between the point and the menu: `0px` for a mouse or keyboard open, `16px` for a touch or pen open, which is placed above the point. Inline; your `style` wins (also with `side={null}`). |
|
|
459
|
+
| `side`, `align` | `Menu.Popup` | Apply to opens from a `Menu.Trigger`; ignored for a context open. `side={null}` opts out of the inline placement on both paths. |
|
|
460
|
+
| `onContextMenu` (owned) | `Menu.Popup` | Prevents the browser's menu over the custom one. |
|
|
461
|
+
| `state.context` | `Menu.Root` | The current open (optimistic) came from a ContextTrigger. |
|
|
462
|
+
|
|
463
|
+
## Keyboard and ARIA
|
|
464
|
+
|
|
465
|
+
> <a id="accessibility-rules"></a>**Three rules for an accessible context menu**
|
|
466
|
+
>
|
|
467
|
+
> 1. **A context menu is a shortcut, never the only path to an action.** iOS (with or without VoiceOver) may never open it, nothing announces it, and users do not discover it. Every item must also be reachable through a visible control: a `Menu.Trigger` in the same Root (the first example), a toolbar (the second), or a keyboard shortcut.
|
|
468
|
+
> 2. **Targets must be focusable** for keyboard and screen-reader users: the browser fires `contextmenu` at the focused element, so a region with no focusable content cannot be opened from the keyboard. Windows screen readers pass the Applications key and Shift+F10 through to the page.
|
|
469
|
+
> 3. **Name the menu** with `aria-label` on the Popup when the Root has no `Menu.Trigger` (the Popup's `aria-labelledby` points at the Trigger's id).
|
|
470
|
+
|
|
471
|
+
The [Opening](#how-it-works) table above lists every input that opens the menu; once it is open, the keys are [Menu](menu.md#keyboard-and-aria)'s.
|
|
472
|
+
|
|
473
|
+
## Transition types
|
|
474
|
+
|
|
475
|
+
Concept: [Transitions & ViewTransition](../concepts/transitions.md#transition-types)
|
|
476
|
+
|
|
477
|
+
Those of the [Menu](menu.md) it opens: `fsui-menu` plus `fsui-menu-open` or `fsui-menu-close`, and the item types.
|
|
478
|
+
|
|
479
|
+
## Optimistic and pending
|
|
480
|
+
|
|
481
|
+
Concept: [Pending & optimistic state](../concepts/pending-and-optimistic.md)
|
|
482
|
+
|
|
483
|
+
As in Menu: the open state is optimistic (`data-open` on the region), and a rejection rolls it back. Items render from the committed open state.
|
|
484
|
+
|
|
485
|
+
## Suspense
|
|
486
|
+
|
|
487
|
+
Concept: [Suspense](../concepts/suspense.md)
|
|
488
|
+
|
|
489
|
+
Items that suspend hold the open, with `data-pending` on the region (and on a Trigger in the same Root).
|
|
490
|
+
|
|
491
|
+
## Browser-owned state
|
|
492
|
+
|
|
493
|
+
Concept: [Browser-owned state](../concepts/browser-owned-state.md)
|
|
494
|
+
|
|
495
|
+
As in Menu: light dismiss and Escape are the browser's; a dismissal is notified with `reason: "dismiss"`.
|
|
496
|
+
|
|
497
|
+
## Before hydration
|
|
498
|
+
|
|
499
|
+
Concept: [Server Components](../concepts/server-components.md#before-hydration)
|
|
500
|
+
|
|
501
|
+
The browser's own context menu shows. Nothing is half-open and nothing is replayed after hydration; the custom menu works from then on.
|
|
502
|
+
|
|
503
|
+
## Styling
|
|
504
|
+
|
|
505
|
+
```css
|
|
506
|
+
.row[data-open] { background: var(--accent-weak); } /* the region of the open menu */
|
|
507
|
+
.row[data-pending] { cursor: progress; }
|
|
508
|
+
.row { -webkit-user-select: none; user-select: none; } /* touch: optional, see below */
|
|
509
|
+
.menu[data-context] { margin: 0; } /* point-placed: no anchored gap */
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
- The Menu styles apply as they are (`margin: 0; inset: auto` on the popup is what a point-placed menu wants too). Enter and exit CSS and `transition` as Menu: the open and library-driven closes animate with `transition`; dismissals and the outside right-click with CSS; a move is instant.
|
|
513
|
+
- On iOS a long-press over text starts a selection and the loupe. Only a `user-select: none` that applies before the touch starts prevents it, and then the text cannot be selected by touch, so it is your choice, not a library default. The region already suppresses the link and image callout inline.
|
|
514
|
+
|
|
515
|
+
## Browser notes
|
|
516
|
+
|
|
517
|
+
- **iOS Safari** never fires `contextmenu` for touch; the library's long-press opens the menu there. VoiceOver on iOS cannot open it ([rule 1](#accessibility-rules)). On iPadOS with a trackpad, Safari shows its own menu over the custom one (WebKit bug 260722).
|
|
518
|
+
- **Firefox**: Shift+right-click forces the browser's menu and fires no event, a built-in escape hatch.
|
|
519
|
+
- **Windows** fires `contextmenu` after the button is released; Linux and macOS on the press. The library captures the pointer on the popup in the latter case, so the release does not light-dismiss the new menu in Firefox and Safari.
|
|
520
|
+
- **Safari** does not fire a keyboard `contextmenu` on a target with `border-radius` (WebKit bug 317496): keep a square focus target, or offer the Menu button.
|
|
521
|
+
|
|
522
|
+
### Content Security Policy
|
|
523
|
+
|
|
524
|
+
The point rules are a `<style>` element inserted by script, which a `style-src` with nonces or hashes blocks (unlike the inline `style` attributes the library sets from the client, which it allows). Either allow its hash, `STYLE_SHA256["@funstack/ui/menu-point"]` from `@funstack/ui/csp`, or wrap the app in `<CSPProvider nonce>`, which puts your nonce on the element. Details and the hash values: [Content Security Policy](../concepts/content-security-policy.md).
|