@funstack/ui 0.1.0-alpha.14 → 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 +7 -4
- 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 +6 -5
- 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-context.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 +18 -6
- package/dist/combobox/combobox-input.d.mts.map +1 -1
- package/dist/combobox/combobox-input.mjs +8 -5
- package/dist/combobox/combobox-input.mjs.map +1 -1
- package/dist/combobox/combobox-label.d.mts +18 -1
- package/dist/combobox/combobox-label.d.mts.map +1 -1
- package/dist/combobox/combobox-label.mjs +4 -1
- 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 +17 -1
- package/dist/combobox/combobox-popup.d.mts.map +1 -1
- package/dist/combobox/combobox-popup.mjs +5 -15
- 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 +11 -80
- package/dist/combobox/combobox-root.mjs.map +1 -1
- package/dist/combobox/combobox-trigger.d.mts +26 -8
- package/dist/combobox/combobox-trigger.d.mts.map +1 -1
- package/dist/combobox/combobox-trigger.mjs +23 -17
- package/dist/combobox/combobox-trigger.mjs.map +1 -1
- package/dist/combobox/index.d.mts +4 -2
- package/dist/combobox/index.d.mts.map +1 -1
- package/dist/combobox/index.mjs +4 -2
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/combobox/use-deferred-leave.mjs +105 -0
- package/dist/combobox/use-deferred-leave.mjs.map +1 -0
- 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-context.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 +4 -2
- 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 +3 -1
- 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/announce.mjs +12 -7
- package/dist/internal/announce.mjs.map +1 -1
- package/dist/internal/focus-first-invalid.mjs +2 -11
- package/dist/internal/focus-first-invalid.mjs.map +1 -1
- package/dist/internal/focus-visible.mjs +26 -0
- package/dist/internal/focus-visible.mjs.map +1 -0
- package/dist/internal/{invoker-press.mjs → invokers.mjs} +22 -5
- package/dist/internal/invokers.mjs.map +1 -0
- package/dist/internal/platform-attributes.d.mts +1 -1
- package/dist/internal/pointer-capture.mjs +1 -1
- package/dist/internal/pointer-capture.mjs.map +1 -1
- package/dist/internal/trigger-ref.mjs +1 -1
- package/dist/internal/trigger-ref.mjs.map +1 -1
- package/dist/internal/types.d.mts +3 -0
- package/dist/internal/types.d.mts.map +1 -1
- package/dist/internal/use-interest-dismiss.mjs +84 -0
- package/dist/internal/use-interest-dismiss.mjs.map +1 -0
- package/dist/internal/use-overlay-root.mjs.map +1 -1
- package/dist/internal/use-popover-popup.mjs +43 -108
- package/dist/internal/use-popover-popup.mjs.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 +29 -10
- package/dist/internal/use-popover-trigger.mjs.map +1 -1
- package/dist/internal/use-value-set.mjs +20 -0
- package/dist/internal/use-value-set.mjs.map +1 -0
- 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 +34 -9
- package/dist/menu/menu-popup.d.mts.map +1 -1
- package/dist/menu/menu-popup.mjs +15 -27
- 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 +21 -8
- package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-submenu-trigger.mjs +11 -10
- package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
- package/dist/menu/menu-trigger.d.mts +23 -7
- package/dist/menu/menu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-trigger.mjs +8 -12
- 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 +3 -1
- 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 +21 -3
- package/dist/popover/popover-close.d.mts.map +1 -1
- package/dist/popover/popover-close.mjs +3 -1
- 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 +24 -9
- package/dist/popover/popover-trigger.d.mts.map +1 -1
- package/dist/popover/popover-trigger.mjs +11 -9
- 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 +6 -5
- 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 +6 -5
- 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
- package/dist/internal/invoker-press.mjs.map +0 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Getting started
|
|
2
|
+
|
|
3
|
+
Install the package, import a component from its subpath, and style it with CSS. There is no provider, no theme and no stylesheet to import.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @funstack/ui@alpha
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
> **Alpha**
|
|
12
|
+
>
|
|
13
|
+
> `@funstack/ui` is published as alpha releases under the `alpha` dist-tag; there is no `latest` release yet. APIs change without notice.
|
|
14
|
+
|
|
15
|
+
React **19.3 or later** is a peer dependency (`react` and `react-dom` `>=19.3.0`). The library relies on React 19.3 features such as `<ViewTransition>` and `addTransitionType`. The package is ESM only and has no other runtime dependencies.
|
|
16
|
+
|
|
17
|
+
## Imports
|
|
18
|
+
|
|
19
|
+
Every component has its own subpath, which is the documented form. The root entry re-exports everything, and both resolve to the same files.
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { Toggle } from "@funstack/ui/toggle";
|
|
23
|
+
import { Tabs } from "@funstack/ui/tabs";
|
|
24
|
+
import { Accordion } from "@funstack/ui/accordion";
|
|
25
|
+
import { Tooltip } from "@funstack/ui/tooltip";
|
|
26
|
+
|
|
27
|
+
// Also works:
|
|
28
|
+
import { Tabs, Toggle } from "@funstack/ui";
|
|
29
|
+
|
|
30
|
+
// Shared types live in the root entry.
|
|
31
|
+
import type { ActionDetails, ChangeAction } from "@funstack/ui";
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Single-element components are plain components (`Toggle`). Compound components are a namespace of parts (`Tabs.Root`, `Tabs.Tab`, ...). The namespace itself is not a component.
|
|
35
|
+
|
|
36
|
+
A <a id="part"></a>part is one piece of a component that you render yourself and that usually renders one element: `Tabs.Tab` is a part, and so is a whole `Toggle`. The Root is the part of a compound component that holds its state (and its transition, when it has one) and provides them to the other parts through context; it is usually, not always, the outermost part. Other recurring words (trigger, content region, optimistic and committed value) are defined on [Pending & optimistic state](concepts/pending-and-optimistic.md#terms).
|
|
37
|
+
|
|
38
|
+
## A first component
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
"use client";
|
|
42
|
+
import { Toggle } from "@funstack/ui/toggle";
|
|
43
|
+
import { saveFavorite } from "./api";
|
|
44
|
+
|
|
45
|
+
export function FavoriteButton({ postId, initial }: { postId: string; initial: boolean }) {
|
|
46
|
+
return (
|
|
47
|
+
<Toggle
|
|
48
|
+
className="favorite"
|
|
49
|
+
defaultPressed={initial}
|
|
50
|
+
pressedChangeAction={(pressed) => saveFavorite(postId, pressed)}
|
|
51
|
+
>
|
|
52
|
+
Favorite
|
|
53
|
+
</Toggle>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`pressedChangeAction` is an [action](concepts/action-props.md#action): it runs inside a transition. While the returned promise is pending, the button already shows the new pressed state ([optimistic](concepts/pending-and-optimistic.md#optimistic)) and carries `data-pending`. If it rejects, the pressed state rolls back and the error goes to the nearest Error Boundary. The [Action props](concepts/action-props.md) page explains the details.
|
|
59
|
+
|
|
60
|
+
## Styling: data attributes and CSS
|
|
61
|
+
|
|
62
|
+
Components render plain, accessible HTML and ship no styles. Library state appears as `data-*` attributes, emitted by presence (`data-pending=""` when true, absent when false). Enum-like states carry a value (`data-orientation="vertical"`).
|
|
63
|
+
|
|
64
|
+
```css
|
|
65
|
+
.favorite[data-pressed] { background: gold; }
|
|
66
|
+
.favorite[data-pending] { cursor: progress; opacity: 0.8; }
|
|
67
|
+
.favorite[data-disabled] { opacity: 0.5; }
|
|
68
|
+
|
|
69
|
+
/* Interaction state comes from the platform, not from attributes. */
|
|
70
|
+
.favorite:hover { filter: brightness(1.05); }
|
|
71
|
+
.favorite:focus-visible { outline: 2px solid; }
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Hover, focus and active state are deliberately not attributes: use `:hover`, `:focus-visible` and `:active`. Tailwind's `data-*` variants work as is: `data-pressed:bg-amber-300 data-pending:opacity-80`.
|
|
75
|
+
|
|
76
|
+
When CSS is not enough, `className`, `style` and `children` also accept a function of the part's state:
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
<Toggle
|
|
80
|
+
className={({ pressed, pending }) => (pending ? "fav busy" : pressed ? "fav on" : "fav")}
|
|
81
|
+
>
|
|
82
|
+
{({ pressed, pending }) => (pending ? <Spinner /> : pressed ? <StarFilled /> : <StarOutline />)}
|
|
83
|
+
</Toggle>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Replacing the element: `render`
|
|
87
|
+
|
|
88
|
+
Every part that renders an element accepts `render`. The element form replaces the default element and merges the library's props into it; the function form hands you the props and the state.
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
// Element form: a design-system button. It must accept `ref` and spread its props.
|
|
92
|
+
<Toggle render={<MyButton variant="ghost" />}>Bold</Toggle>
|
|
93
|
+
|
|
94
|
+
// Function form: full control.
|
|
95
|
+
<Toggle render={(props, state) => <button {...props}>{state.pressed ? "On" : "Off"}</button>} />
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
On every component page, each part's props table is followed by two fixed lines: **State**, the object the function props and `render` receive, and **Owned**, the props the part sets itself, which a `render` element cannot override. Everything not listed passes through to the element.
|
|
99
|
+
|
|
100
|
+
Merge rules for the element form:
|
|
101
|
+
|
|
102
|
+
- `className` values are concatenated; `style` objects are merged (the element wins). Event handlers the part installs run after the element's own.
|
|
103
|
+
- Attributes the part computes (its `role`, ARIA state, ids, `data-*` state) always win. ARIA id lists (`aria-describedby`, `aria-labelledby`, `aria-controls`) are merged instead.
|
|
104
|
+
- Everything else, the element wins. `type="button"` is only added when the rendered element is a `<button>`.
|
|
105
|
+
|
|
106
|
+
## What the components share
|
|
107
|
+
|
|
108
|
+
| Pattern | Meaning |
|
|
109
|
+
| - | - |
|
|
110
|
+
| `x` / `defaultX` / `xChangeAction` | Controlled value, initial uncontrolled value, and the action called on every change. |
|
|
111
|
+
| `data-pending` | An action dispatched through this component is in flight. |
|
|
112
|
+
| `transition` | On parts whose content is driven by library state: forwarded to the part's `<ViewTransition default>`. Without it the part renders no `<ViewTransition>`. |
|
|
113
|
+
| `render` | Element polymorphism (no `asChild`, no `as`). |
|
|
114
|
+
| `ref` | An ordinary prop on every part that renders an element. |
|
|
115
|
+
| `experimental_*` | Opt-in use of a platform feature that is not in every engine yet. |
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# FUNSTACK UI
|
|
2
|
+
|
|
3
|
+
Headless React components, and the first UI library that is **Async React**-native.
|
|
4
|
+
|
|
5
|
+
> **Experimental**
|
|
6
|
+
>
|
|
7
|
+
> APIs change without notice. Releases are on npm under the `alpha` dist-tag. Feedback is welcome on [GitHub](https://github.com/uhyo/funstack-ui/issues).
|
|
8
|
+
|
|
9
|
+
## Try it
|
|
10
|
+
|
|
11
|
+
The star flips at once, the button shows a spinner while the fake save runs, and a second click while it is pending wins. The code is one `Toggle` with an async action.
|
|
12
|
+
|
|
13
|
+
```tsx title="ToggleFavorite.tsx"
|
|
14
|
+
"use client";
|
|
15
|
+
import { Toggle } from "@funstack/ui/toggle";
|
|
16
|
+
import { fakeSave } from "./fake-api.js";
|
|
17
|
+
|
|
18
|
+
// Uncontrolled Toggle with an async action. The star flips at once (optimistic), the button
|
|
19
|
+
// carries data-pending for the 800 ms the save takes, and a second click while pending wins.
|
|
20
|
+
export function ToggleFavorite() {
|
|
21
|
+
return (
|
|
22
|
+
<Toggle className="demo-toggle" pressedChangeAction={(next) => fakeSave(`favorite=${next}`)}>
|
|
23
|
+
{({ pressed, pending }) => (
|
|
24
|
+
<>
|
|
25
|
+
{pending ? (
|
|
26
|
+
<span className="demo-spinner" aria-hidden />
|
|
27
|
+
) : (
|
|
28
|
+
<span aria-hidden>{pressed ? "★" : "☆"}</span>
|
|
29
|
+
)}
|
|
30
|
+
Favorite
|
|
31
|
+
</>
|
|
32
|
+
)}
|
|
33
|
+
</Toggle>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```css title="toggle.css"
|
|
39
|
+
/* Toggle: data attributes carry library state; :hover / :focus-visible come from the platform. */
|
|
40
|
+
.demo-toggle {
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
gap: 0.4em;
|
|
44
|
+
padding: 0.4em 0.9em;
|
|
45
|
+
border: 1px solid var(--color-border);
|
|
46
|
+
border-radius: 999px;
|
|
47
|
+
background: var(--color-bg);
|
|
48
|
+
color: var(--color-text);
|
|
49
|
+
font: inherit;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
/* The optimistic flip is a sync commit, so it animates with a plain CSS transition. */
|
|
52
|
+
transition:
|
|
53
|
+
background-color 120ms,
|
|
54
|
+
color 120ms,
|
|
55
|
+
border-color 120ms;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.demo-toggle[data-pressed] {
|
|
59
|
+
background: var(--color-primary);
|
|
60
|
+
border-color: var(--color-primary);
|
|
61
|
+
color: var(--color-on-primary);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.demo-toggle[data-pending] {
|
|
65
|
+
cursor: progress;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.demo-toggle[data-disabled] {
|
|
69
|
+
opacity: 0.5;
|
|
70
|
+
cursor: not-allowed;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.demo-toggle:focus-visible {
|
|
74
|
+
outline: 2px solid var(--color-primary);
|
|
75
|
+
outline-offset: 2px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media (prefers-reduced-motion: reduce) {
|
|
79
|
+
.demo-toggle {
|
|
80
|
+
transition: none;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The components are headless: accessible HTML with data attributes, no styles. You bring the CSS. [Why FUNSTACK UI](why.md) shows what this saves you.
|
|
86
|
+
|
|
87
|
+
## Principles
|
|
88
|
+
|
|
89
|
+
- **[Suspense-native](concepts/suspense.md)**
|
|
90
|
+
|
|
91
|
+
Content that suspends is the normal case. The old content stays on screen while the new content loads.
|
|
92
|
+
|
|
93
|
+
- **[Transition by default](concepts/transitions.md)**
|
|
94
|
+
|
|
95
|
+
Every state change the library makes is a React transition. You do not opt in.
|
|
96
|
+
|
|
97
|
+
- **[Action props, not event handlers](concepts/action-props.md)**
|
|
98
|
+
|
|
99
|
+
Pass an async function (`pressedChangeAction`, `valueChangeAction`); the component shows the new value at once and `data-pending` until it is done.
|
|
100
|
+
|
|
101
|
+
- **[\<ViewTransition> built in](concepts/transitions.md#transition-prop)**
|
|
102
|
+
|
|
103
|
+
Give a part a `transition` prop and its changes animate with React's `<ViewTransition>`.
|
|
104
|
+
|
|
105
|
+
- **[Greedy about the platform](concepts/browser-owned-state.md)**
|
|
106
|
+
|
|
107
|
+
Popover API, `<dialog>`, CSS Anchor Positioning, `<details>`, native form controls. Where HTML can do the job, it does.
|
|
108
|
+
|
|
109
|
+
- **Accessibility is not optional**
|
|
110
|
+
|
|
111
|
+
Components follow the WAI-ARIA Authoring Practices and are tested for keyboard and assistive-technology behaviour.
|
|
112
|
+
|
|
113
|
+
## Install
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npm install @funstack/ui@alpha
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
React 19.3 or later. Supported browsers: **the latest stable Blink, WebKit and Gecko. No fallbacks.** Platform features not yet in all three are opt-in [experimental props](concepts/experimental.md).
|
|
120
|
+
|
|
121
|
+
Components: [Button](components/button.md), [Toggle](components/toggle.md), [ToggleGroup](components/toggle-group.md), [Toolbar](components/toolbar.md), [Tabs](components/tabs.md), [Accordion](components/accordion.md), [Tooltip](components/tooltip.md), [Popover](components/popover.md), [Dialog](components/dialog.md), [Menu](components/menu.md), [Context menu (Menu)](components/context-menu.md), [Toast](components/toast.md), [Field and Form](components/field.md), [Checkbox](components/checkbox.md), [CheckboxGroup](components/checkbox-group.md), [RadioGroup](components/radio-group.md), [Switch](components/switch.md), [Select](components/select.md), [Combobox](components/combobox.md), [Slider](components/slider.md), [NumberField](components/number-field.md), [Progress](components/progress.md) and [Meter](components/meter.md). More are coming; see the [roadmap](roadmap.md).
|
|
122
|
+
|
|
123
|
+
## The FUNSTACK family
|
|
124
|
+
|
|
125
|
+
FUNSTACK UI is part of the FUNSTACK family, which aims to be the most modern React stack:
|
|
126
|
+
|
|
127
|
+
- [FUNSTACK Router](https://router.funstack.work): a React router built on the Navigation API.
|
|
128
|
+
- [FUNSTACK Static](https://static.funstack.work): a React Server Components static site framework. This site is built with it.
|
|
129
|
+
|
|
130
|
+
## All pages
|
|
131
|
+
|
|
132
|
+
### Introduction
|
|
133
|
+
|
|
134
|
+
- [Why FUNSTACK UI](why.md): Why choose FUNSTACK UI: headless React components that already do the async work React 19 asks for. Pending and optimistic state, Suspense, transitions and the platform, built in.
|
|
135
|
+
- [Overview](index.md): FUNSTACK UI is a headless React component library and the first UI library that is Async React-native: Suspense-native, transition by default, action props, and \<ViewTransition> built in.
|
|
136
|
+
- [Getting started](getting-started.md): Install @funstack/ui, import a component from its subpath, and style it with data attributes and CSS.
|
|
137
|
+
|
|
138
|
+
### Concepts
|
|
139
|
+
|
|
140
|
+
- [Action props](concepts/action-props.md): FUNSTACK UI components take action props instead of event handlers. Actions run inside the component's transition, may be async, and report errors to Error Boundaries.
|
|
141
|
+
- [Pending & optimistic state](concepts/pending-and-optimistic.md): A state owner keeps a committed, an optimistic and a pending value. Triggers render the optimistic value, content regions the committed one, and data-pending marks an action in flight.
|
|
142
|
+
- [Transitions & ViewTransition](concepts/transitions.md): Every state change in FUNSTACK UI is a transition. Parts whose content is driven by library state take a transition prop that renders a \<ViewTransition>, and changes are tagged with fsui-\* transition types.
|
|
143
|
+
- [Suspense](concepts/suspense.md): FUNSTACK UI content regions keep old content on screen while new content suspends. You own the Suspense boundaries.
|
|
144
|
+
- [Browser-owned state](concepts/browser-owned-state.md): Some state belongs to the browser: the popover top layer, \<details open>, dismissing a \<dialog>, a native input before React hears about it. FUNSTACK UI observes it instead of driving it.
|
|
145
|
+
- [Server Components](concepts/server-components.md): FUNSTACK UI parts are client modules that Server Components can render directly. Some behaviour works before hydration.
|
|
146
|
+
|
|
147
|
+
### Guides
|
|
148
|
+
|
|
149
|
+
- [Experimental features](concepts/experimental.md): Platform features that are not in every engine yet are opt-in through experimental\_\* props on the part that uses them.
|
|
150
|
+
- [Content Security Policy](concepts/content-security-policy.md): What a strict style-src needs for FUNSTACK UI: the SHA-256 of the two shipped stylesheets (STYLE_SHA256) or a nonce through CSPProvider, and style-src-attr for server-rendered inline styles.
|
|
151
|
+
- [Using with AI agents](concepts/ai-agents.md): Give a coding agent FUNSTACK UI knowledge: install the funstack-ui-knowledge skill from the npm package, or point the agent at the Markdown docs bundled in the package and published as llms.txt.
|
|
152
|
+
|
|
153
|
+
### Components
|
|
154
|
+
|
|
155
|
+
- [Button](components/button.md): A button whose click is a transition: action in its own transition, data-pending, a second click ignored while pending, formAction with per-submitter pending.
|
|
156
|
+
- [Toggle](components/toggle.md): A two-state button with an async pressedChangeAction, optimistic aria-pressed and data-pending.
|
|
157
|
+
- [ToggleGroup](components/toggle-group.md): A set of aria-pressed toggle buttons sharing one value: several pressed, or at most one with exclusive. Optimistic, with pending state.
|
|
158
|
+
- [Toolbar](components/toolbar.md): A WAI-ARIA toolbar with one Tab stop and arrow keys over any focusable children: toggles, menu buttons, links, inputs. No wrapper parts.
|
|
159
|
+
- [Tabs](components/tabs.md): Tabs with optimistic selection, committed panels that may suspend, automatic or manual activation, an anchor-positioned indicator, and find-in-page support.
|
|
160
|
+
- [Accordion](components/accordion.md): An accordion built on \<details>/\<summary>: no JavaScript when you need no state; actions, optimistic data-open and Suspense-friendly panels when you do.
|
|
161
|
+
- [Tooltip](components/tooltip.md): A tooltip built on the Popover API and CSS Anchor Positioning, with a native interestfor path in Chromium. Open state belongs to the browser.
|
|
162
|
+
- [Popover](components/popover.md): A non-modal popover on the Popover API: JS-free when you need no state; a transition-driven open, library-owned closes with a ViewTransition exit in every engine, and Suspense-ready content when you do.
|
|
163
|
+
- [Dialog](components/dialog.md): A dialog built on \<dialog> and Invoker Commands: JS-free when you need no state; a transition-driven open with a pending trigger, Suspense-ready content, and library-owned closes with a ViewTransition exit in every engine when you do.
|
|
164
|
+
- [Menu](components/menu.md): A menu button on the Popover API: items whose actions run in their own transition with pending state, optimistic checkbox and radio items, the APG keyboard model with typeahead, and submenus with hover intent.
|
|
165
|
+
- [Context menu (Menu)](components/context-menu.md): Menu.ContextTrigger: a region whose right-click, Shift+F10 or touch long-press opens a Menu at the pointer, with the menu's pending items, optimistic checkbox and radio items and submenus unchanged.
|
|
166
|
+
- [Toast](components/toast.md): Notifications fed by a toast() function and rendered by your own Viewport: an urgent queue that shows while the action it reports on is still pending, promise toasts, an Undo action prop, closeAction for the Undo window, ariaNotify announcements, and a region that stays interactive above modal dialogs.
|
|
167
|
+
- [Field and Form](components/field.md): Labelled, described, validated form fields on top of native constraint validation and :user-invalid, and a Form that runs its action in a transition, routes server errors to fields and resets only on success.
|
|
168
|
+
- [Checkbox](components/checkbox.md): A native \<input type=checkbox> with an async checkedChangeAction, optimistic checked state, a controlled indeterminate state and native form participation.
|
|
169
|
+
- [CheckboxGroup](components/checkbox-group.md): A group of native \<input type=checkbox> in a \<fieldset> with a set value, a mixed-state select-all Parent, group-level required, an async valueChangeAction and data-pending.
|
|
170
|
+
- [RadioGroup](components/radio-group.md): A radio group of native \<input type=radio> in a \<fieldset>: native keyboard and forms, an async valueChangeAction, optimistic checked state and data-pending.
|
|
171
|
+
- [Switch](components/switch.md): An on/off switch rendered as a native \<input type=checkbox role=switch>: optimistic checked state, data-pending while checkedChangeAction runs, native form participation.
|
|
172
|
+
- [Select](components/select.md): A real \<select>, progressively enhanced with customizable select (appearance: base-select): native forms, keyboard and pickers, an async valueChangeAction, optimistic selection and data-pending.
|
|
173
|
+
- [Combobox](components/combobox.md): An editable combobox with list autocomplete: urgent typing, results from a deferred query inside Suspense, aria-activedescendant, an async valueChangeAction with the option pending, free text, forms and ariaNotify.
|
|
174
|
+
- [Slider](components/slider.md): A slider on a visually hidden native \<input type=range> per thumb: every step a transition, each gesture saved once with rollback, multi-thumb, vertical and RTL.
|
|
175
|
+
- [NumberField](components/number-field.md): A text field that holds a number: typed in the user's locale, stepped with keys and press-and-hold buttons, posted as a plain number through a hidden native number input, saved once per gesture with rollback.
|
|
176
|
+
- [Progress](components/progress.md): A progress bar on div\[role=progressbar]: the display of someone else's action, correct in every lane, localised aria-valuetext, and a Root that is itself a Server Component.
|
|
177
|
+
- [Meter](components/meter.md): A gauge on div\[role=meter] with the platform's low / high / optimum regions, localised aria-valuetext, and a Root that is itself a Server Component.
|
|
178
|
+
|
|
179
|
+
### Resources
|
|
180
|
+
|
|
181
|
+
- [Roadmap & changelog](roadmap.md): Where FUNSTACK UI is heading, and where to follow changes.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Roadmap & changelog
|
|
2
|
+
|
|
3
|
+
FUNSTACK UI is experimental; alpha releases are on npm. Planning happens in [GitHub issues](https://github.com/uhyo/funstack-ui/issues); this page is a short summary.
|
|
4
|
+
|
|
5
|
+
## Changelog
|
|
6
|
+
|
|
7
|
+
Alpha releases (`0.1.0-alpha.N`) are published on npm under the `alpha` dist-tag: `npm install @funstack/ui@alpha`. Each release is listed on [GitHub Releases](https://github.com/uhyo/funstack-ui/releases); between releases, the [commit history](https://github.com/uhyo/funstack-ui/commits/master) is the changelog.
|
|
8
|
+
|
|
9
|
+
## Behaviour changes
|
|
10
|
+
|
|
11
|
+
Changes an upgrade may notice, newest first. Each component page documents the current behaviour.
|
|
12
|
+
|
|
13
|
+
- **Breaking (types):** `Combobox.Input` owns `onFocus`, which is no longer in its props type; use `onFocusCapture` to react to focus ([#132](https://github.com/uhyo/funstack-ui/issues/132)).
|
|
14
|
+
- A `Combobox.Trigger` that is disabled but stays focusable (a component `render` with `aria-disabled`) is no invoker, like the other overlay Triggers: it renders `aria-expanded` and no `popovertarget`, and pressing it while the listbox is shown light-dismisses it ([#132](https://github.com/uhyo/funstack-ui/issues/132)).
|
|
15
|
+
- A Popover opened by an `interestfor` button that is not its Trigger (Chromium) hides when interest is lost, reported as `"dismiss"` ([#127](https://github.com/uhyo/funstack-ui/issues/127)).
|
|
16
|
+
- Pressing a button of yours that targets an open Menu or Combobox (a [foreign invoker](concepts/browser-owned-state.md#foreign-invoker)) no longer moves focus out of it first; the button's own close is the only close ([#126](https://github.com/uhyo/funstack-ui/issues/126)).
|
|
17
|
+
- A foreign `popovertarget` button that closes a Popover, Menu or Combobox is reported as `"activate"` instead of `"dismiss"` ([#125](https://github.com/uhyo/funstack-ui/issues/125)).
|
|
18
|
+
- **Breaking:** `Popover.Trigger`, `Menu.Trigger`, `Menu.SubmenuTrigger` and `Combobox.Trigger` name their popup with `popovertarget` instead of `commandfor` + `command="toggle-popover"`, and a `<button>` Trigger renders no `aria-expanded`: every browser exposes the popup's state on it. Move CSS from `[aria-expanded="true"]` to `[data-open]` (now also written in Popover's JS-free mode), or to `:has(+ :popover-open)` on a page that never hydrates. A Trigger rendered as a link or another element through `render` keeps `aria-expanded`. Replace `[commandfor]` selectors on these Triggers with `[data-open]` or a class of your own. `commandfor`, `command`, `popoverTarget` and `popoverTargetAction` are owned by these Triggers ([#121](https://github.com/uhyo/funstack-ui/issues/121)).
|
|
19
|
+
- Clicking the Trigger of an open Menu or Combobox is a library-owned close on every engine: the popup stays shown with `data-pending` until `openChangeAction(false)` settles, and the exit view transition runs ([#110](https://github.com/uhyo/funstack-ui/issues/110), [#112](https://github.com/uhyo/funstack-ui/issues/112)).
|
|
20
|
+
- An overlay Trigger's `aria-expanded` and the Combobox input's report whether the popup is actually shown; `data-open` stays optimistic. With `defaultOpen` the server HTML has `aria-expanded="false"` until the popup is shown after hydration ([#118](https://github.com/uhyo/funstack-ui/issues/118)).
|
|
21
|
+
- A Trigger click on an open non-modal `lightDismiss` Dialog dismisses it on every engine ([#116](https://github.com/uhyo/funstack-ui/issues/116)).
|
|
22
|
+
- Popover and Menu Triggers rendered as something other than a `<button>` are no longer invokers; a development warning explains that they close through light dismiss ([#115](https://github.com/uhyo/funstack-ui/issues/115)).
|
|
23
|
+
- The fallback live region is removed: announcements use `ariaNotify` only ([#113](https://github.com/uhyo/funstack-ui/issues/113)).
|
|
24
|
+
- Combobox: a press on the input while the listbox is open no longer closes it ([#123](https://github.com/uhyo/funstack-ui/issues/123)); pressing a label while typing no longer discards or commits the typed text ([#111](https://github.com/uhyo/funstack-ui/issues/111)).
|
|
25
|
+
- Toast: ArrowUp and ArrowDown inside a text field in a toast move the caret instead of switching toasts ([#113](https://github.com/uhyo/funstack-ui/issues/113)).
|
|
26
|
+
- **Breaking:** `MenuTriggerProps` no longer accepts `onMouseDown` ([#110](https://github.com/uhyo/funstack-ui/issues/110)); `ComboboxTriggerProps` no longer accepts `commandfor` or `command` ([#112](https://github.com/uhyo/funstack-ui/issues/112)); `Combobox.Input` owns `onPointerDown` ([#123](https://github.com/uhyo/funstack-ui/issues/123)).
|
|
27
|
+
- CheckboxGroup compares a controlled `value` by content, so an inline array with the same items does not re-render every Item ([#108](https://github.com/uhyo/funstack-ui/issues/108)).
|
|
28
|
+
- Slider and NumberField: when a newer action supersedes one that then rejects, the rejection reaches the Error Boundary at once instead of waiting for the action on the other channel (step or commit) to settle ([#105](https://github.com/uhyo/funstack-ui/issues/105)).
|
|
29
|
+
- **Breaking:** `TabsValueChangeDetails.reason` and `AccordionValueChangeDetails.reason` are the shared `ChangeReason` type ([#102](https://github.com/uhyo/funstack-ui/issues/102)).
|
|
30
|
+
- **Breaking:** `Combobox.Root`'s `inputValueChangeAction` is renamed `onInputValueChange` and the type `UrgentChangeAction` is renamed `UrgentChangeHandler`; an action prop always means a transition ([#96](https://github.com/uhyo/funstack-ui/issues/96)).
|
|
31
|
+
- While a tooltip is showing, the next one opens at once ([#21](https://github.com/uhyo/funstack-ui/issues/21)).
|
|
32
|
+
- **Breaking:** `data-side` / `data-align` on Tooltip, Popover and Menu report the side the browser chose while shown, not the requested one; the `side` type gains `"inline-start"` / `"inline-end"` and `align` start / end mirror under RTL; a submenu opens on the inline-end side (the left in RTL) ([#20](https://github.com/uhyo/funstack-ui/issues/20), [#53](https://github.com/uhyo/funstack-ui/issues/53)).
|
|
33
|
+
- Every Menu closes on a right- or middle-click outside; a wheel over a menu never scrolls the page ([#45](https://github.com/uhyo/funstack-ui/issues/45), [#88](https://github.com/uhyo/funstack-ui/issues/88)).
|
|
34
|
+
- `disabled` on a link or component `render` renders `aria-disabled="true"` instead of native `disabled` on Toggle, ToggleGroup.Item, Menu.Trigger, Combobox.Trigger and Clear, NumberField.Increment and Decrement, and the Dialog and Popover Trigger and Close parts where they handle the click; a disabled link ToggleGroup.Item is reached by the arrow keys. Form.Submit keeps native `disabled` ([#83](https://github.com/uhyo/funstack-ui/issues/83)).
|
|
35
|
+
- `Dialog.Close`, `Popover.Close`, `Menu.Item` and `Toast.Action` ignore a second click while their own action is pending, with `aria-disabled` meanwhile; before, a second click ran the action again ([#81](https://github.com/uhyo/funstack-ui/issues/81)).
|
|
36
|
+
- **Breaking:** `Toolbar.Button` is removed; use [Button](components/button.md), which behaves the same inside a toolbar ([#79](https://github.com/uhyo/funstack-ui/issues/79)).
|
|
37
|
+
|
|
38
|
+
## Done
|
|
39
|
+
|
|
40
|
+
- Library-wide API conventions: action props, pending and optimistic state, Suspense, ViewTransition, composition.
|
|
41
|
+
- [Toggle](components/toggle.md), [Tabs](components/tabs.md), [Accordion](components/accordion.md) and [Tooltip](components/tooltip.md): the first four primitives.
|
|
42
|
+
- [Dialog](components/dialog.md), [Switch](components/switch.md), [Checkbox](components/checkbox.md) and [RadioGroup](components/radio-group.md), with the shared form-reset and hydration handling.
|
|
43
|
+
- Browser-mode tests (Playwright) in Chromium, Firefox and WebKit for Popover, anchor positioning, `<dialog>`, native inputs and ViewTransition.
|
|
44
|
+
- A conditional `<ViewTransition>` boundary ([#35](https://github.com/uhyo/funstack-ui/issues/35)).
|
|
45
|
+
- The first npm release, `0.1.0-alpha.0` (dist-tag `alpha`).
|
|
46
|
+
- [CheckboxGroup](components/checkbox-group.md) ([#33](https://github.com/uhyo/funstack-ui/issues/33)).
|
|
47
|
+
- [Popover](components/popover.md) ([#38](https://github.com/uhyo/funstack-ui/issues/38), [#40](https://github.com/uhyo/funstack-ui/issues/40)).
|
|
48
|
+
- [Menu](components/menu.md) ([#39](https://github.com/uhyo/funstack-ui/issues/39), [#41](https://github.com/uhyo/funstack-ui/issues/41), [#47](https://github.com/uhyo/funstack-ui/issues/47)).
|
|
49
|
+
- [Select](components/select.md) and [Combobox](components/combobox.md), the library's first urgent state, `onInputValueChange` ([#50](https://github.com/uhyo/funstack-ui/issues/50)).
|
|
50
|
+
- [Toast](components/toast.md), [Slider](components/slider.md) and [Field and Form](components/field.md) ([#54](https://github.com/uhyo/funstack-ui/issues/54)).
|
|
51
|
+
- [Progress](components/progress.md) and [Meter](components/meter.md), the first output-only components ([#68](https://github.com/uhyo/funstack-ui/issues/68)).
|
|
52
|
+
- [ToggleGroup](components/toggle-group.md) and [Toolbar](components/toolbar.md) ([#66](https://github.com/uhyo/funstack-ui/issues/66)).
|
|
53
|
+
- [NumberField](components/number-field.md) ([#67](https://github.com/uhyo/funstack-ui/issues/67)).
|
|
54
|
+
- [Button](components/button.md) ([#79](https://github.com/uhyo/funstack-ui/issues/79)), and re-entry handling for every pure trigger ([#81](https://github.com/uhyo/funstack-ui/issues/81), [#83](https://github.com/uhyo/funstack-ui/issues/83)).
|
|
55
|
+
- [Context menu](components/context-menu.md): `Menu.ContextTrigger`, press-drag-release, touch long-press and the library's first shipped (positioning-only) CSS ([#45](https://github.com/uhyo/funstack-ui/issues/45), [#88](https://github.com/uhyo/funstack-ui/issues/88)). Touch is verified under Chromium's emulation; iOS and Android pending ([#90](https://github.com/uhyo/funstack-ui/issues/90)).
|
|
56
|
+
- Resolved placement (`data-side` is where the popup is), [Tooltip.Arrow](components/tooltip.md#arrow), logical sides and RTL ([#20](https://github.com/uhyo/funstack-ui/issues/20), [#53](https://github.com/uhyo/funstack-ui/issues/53), [#88](https://github.com/uhyo/funstack-ui/issues/88)). Firefox misplaces anchored popups in a direction island ([#89](https://github.com/uhyo/funstack-ui/issues/89)).
|
|
57
|
+
- [Tooltip skip-delay](components/tooltip.md#skip-delay) ([#21](https://github.com/uhyo/funstack-ui/issues/21)).
|
|
58
|
+
- [Content Security Policy](concepts/content-security-policy.md): `STYLE_SHA256` and `<CSPProvider nonce>` ([#88](https://github.com/uhyo/funstack-ui/issues/88)).
|
|
59
|
+
- Directive-free variants of platform-native parts: considered and not built ([#19](https://github.com/uhyo/funstack-ui/issues/19)); [Server Components](concepts/server-components.md#js-free) defines "JS-free" and the form-control pages show the plain HTML alternative.
|
|
60
|
+
|
|
61
|
+
## Next
|
|
62
|
+
|
|
63
|
+
- More components toward a full set.
|
|
64
|
+
|
|
65
|
+
## Deferred
|
|
66
|
+
|
|
67
|
+
- A directive-free Accordion (`@funstack/ui/accordion/native`): a ready plan, not scheduled ([#19](https://github.com/uhyo/funstack-ui/issues/19)).
|
|
68
|
+
|
|
69
|
+
## Upstream
|
|
70
|
+
|
|
71
|
+
- react-dom renders `hidden="until-found"` as a boolean ([#16](https://github.com/uhyo/funstack-ui/issues/16)).
|
|
72
|
+
- Chromium does not match `:checked` on a checkbox that is both checked and indeterminate; jsdom toggles instead of restoring a checkbox after a cancelled click ([#34](https://github.com/uhyo/funstack-ui/issues/34)).
|
|
73
|
+
|
|
74
|
+
Ideas and bug reports are welcome as [new issues](https://github.com/uhyo/funstack-ui/issues/new).
|
package/dist/docs/why.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Why FUNSTACK UI
|
|
2
|
+
|
|
3
|
+
React 19 added actions, transitions, `useOptimistic`, Suspense for data and `<ViewTransition>`. FUNSTACK UI is a headless component library that uses them for you, so the async work around every button, tab and dialog is already done.
|
|
4
|
+
|
|
5
|
+
## What you stop writing
|
|
6
|
+
|
|
7
|
+
- **[No pending flags](concepts/pending-and-optimistic.md)**
|
|
8
|
+
|
|
9
|
+
Every component with an action sets `data-pending` while the action runs, until its result is on screen. Style it in CSS.
|
|
10
|
+
|
|
11
|
+
- **[No onChange + useTransition + useOptimistic](concepts/action-props.md)**
|
|
12
|
+
|
|
13
|
+
Pass an async function as an action prop. The component runs it in a transition, shows the new value at once, and rolls it back if the action fails. Errors go to your Error Boundary.
|
|
14
|
+
|
|
15
|
+
- **[No races between fast clicks](concepts/action-props.md#overlapping-actions)**
|
|
16
|
+
|
|
17
|
+
The display always shows the latest click. Uncontrolled state commits only the latest one, so a slow response to an older click never overwrites a newer choice.
|
|
18
|
+
|
|
19
|
+
- **[No fallback flashes](concepts/suspense.md)**
|
|
20
|
+
|
|
21
|
+
When the next tab, accordion item or dialog loads data, the current screen stays as it is and the trigger shows pending until the new content is ready.
|
|
22
|
+
|
|
23
|
+
- **[No JavaScript copies of the browser](concepts/browser-owned-state.md)**
|
|
24
|
+
|
|
25
|
+
Popups use the Popover API, `<dialog>` and CSS Anchor Positioning; form controls are native inputs. The browser handles the top layer and Escape, and popovers close on a click outside natively.
|
|
26
|
+
|
|
27
|
+
- **[No animation glue](concepts/transitions.md)**
|
|
28
|
+
|
|
29
|
+
Pass `transition` to a part and it renders React's `<ViewTransition>`. Each change is tagged with a transition type, such as `fsui-tabs-next`, so you can animate by direction.
|
|
30
|
+
|
|
31
|
+
## Before and after
|
|
32
|
+
|
|
33
|
+
A favourite button that saves to a server. By hand:
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
const [pressed, setPressed] = useState(initial);
|
|
37
|
+
const [optimistic, setOptimistic] = useOptimistic(pressed);
|
|
38
|
+
const [isPending, startTransition] = useTransition();
|
|
39
|
+
|
|
40
|
+
<button
|
|
41
|
+
aria-pressed={optimistic}
|
|
42
|
+
data-pending={isPending ? "" : undefined}
|
|
43
|
+
onClick={() => {
|
|
44
|
+
const next = !optimistic;
|
|
45
|
+
startTransition(async () => {
|
|
46
|
+
setOptimistic(next);
|
|
47
|
+
await saveFavorite(next);
|
|
48
|
+
startTransition(() => setPressed(next));
|
|
49
|
+
});
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
Favorite
|
|
53
|
+
</button>
|
|
54
|
+
// ...and a slow save from an earlier click can still overwrite a later one.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
With FUNSTACK UI:
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<Toggle defaultPressed={initial} pressedChangeAction={(next) => saveFavorite(next)}>
|
|
61
|
+
Favorite
|
|
62
|
+
</Toggle>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Same optimistic flip and `data-pending`, plus latest-click-wins and transition types for animation. Try it on the [home page](index.md).
|
|
66
|
+
|
|
67
|
+
## Compared with other headless libraries
|
|
68
|
+
|
|
69
|
+
Most established headless React libraries were designed before React's async features, and support a wide range of browsers. They are mature and a safe choice. FUNSTACK UI takes a different approach:
|
|
70
|
+
|
|
71
|
+
| | Typical headless library | FUNSTACK UI |
|
|
72
|
+
| - | - | - |
|
|
73
|
+
| **Callbacks** | Event handlers (`onValueChange`, `onOpenChange`). Transitions, optimistic state and pending flags are yours to add. | [Action props](concepts/action-props.md): run in a transition, may be async. Optimistic and pending state built in. |
|
|
74
|
+
| **Content that loads data** | Usually updated urgently, so content that suspends shows its fallback unless you add a transition. | [Old content stays on screen](concepts/suspense.md) until the new content is ready. |
|
|
75
|
+
| **Popups** | JavaScript for positioning, layering and dismissal, so older browsers work too. | The [platform](concepts/browser-owned-state.md): Popover API, `<dialog>`, CSS Anchor Positioning. Some components work before hydration. |
|
|
76
|
+
| **Animation** | CSS, with exit-animation states built in. No `<ViewTransition>` integration. | CSS, plus `<ViewTransition>` through the parts' `transition` prop ([Transitions](concepts/transitions.md)). |
|
|
77
|
+
| **Browsers** | Wide support, including older versions. | Latest stable Chrome, Edge, Safari and Firefox. No fallbacks. |
|
|
78
|
+
| **Maturity** | Stable APIs, large component sets. | Experimental alpha. APIs change without notice. |
|
|
79
|
+
|
|
80
|
+
## Who it is for
|
|
81
|
+
|
|
82
|
+
### Choose it if
|
|
83
|
+
|
|
84
|
+
- Your app uses React 19.3 or later, with actions, Suspense or [Server Components](concepts/server-components.md).
|
|
85
|
+
- Your controls save to a server and should feel instant.
|
|
86
|
+
- You only need to support current browsers.
|
|
87
|
+
- You want to write your own CSS: no styles, no theme, no provider.
|
|
88
|
+
|
|
89
|
+
### Look elsewhere (for now) if
|
|
90
|
+
|
|
91
|
+
- You need older browsers or older Safari versions.
|
|
92
|
+
- You need a stable API today.
|
|
93
|
+
- You want styled components out of the box.
|
|
94
|
+
- You need a component that is not here yet (see the [roadmap](roadmap.md)).
|
|
95
|
+
|
|
96
|
+
## Next
|
|
97
|
+
|
|
98
|
+
- [Getting started](getting-started.md): install, import, style.
|
|
99
|
+
- [Action props](concepts/action-props.md): the idea everything else builds on.
|
|
100
|
+
- [Using with AI agents](concepts/ai-agents.md): give your coding agent the full docs.
|
|
@@ -2,14 +2,35 @@ import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
|
2
2
|
import { FieldState } from "../internal/field-context.mjs";
|
|
3
3
|
import { CSSProperties, ComponentPropsWithRef } from "react";
|
|
4
4
|
//#region src/field/field-control.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Props of `Field.Control`.
|
|
7
|
+
*
|
|
8
|
+
* @see https://ui.funstack.work/components/field
|
|
9
|
+
*/
|
|
5
10
|
export interface FieldControlProps extends Omit<ComponentPropsWithRef<"input">, "id" | "aria-invalid" | "className" | "style" | "children"> {
|
|
6
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Native `name`.
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue the Field's `name`
|
|
15
|
+
*/
|
|
7
16
|
name?: string;
|
|
8
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Native `disabled`. Owned. Also `true` when the Field is disabled: an explicit `false` does not
|
|
19
|
+
* override the Field.
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue `false`
|
|
22
|
+
*/
|
|
9
23
|
disabled?: boolean;
|
|
10
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Native `required`. Owned. Also `true` when the Field is required: an explicit `false` does not
|
|
26
|
+
* override the Field.
|
|
27
|
+
*
|
|
28
|
+
* @defaultValue `false`
|
|
29
|
+
*/
|
|
11
30
|
required?: boolean;
|
|
31
|
+
/** Class name, or a function of the part's state that returns one. */
|
|
12
32
|
className?: StateValue<string | undefined, FieldState>;
|
|
33
|
+
/** Inline style, or a function of the part's state that returns one. */
|
|
13
34
|
style?: StateValue<CSSProperties | undefined, FieldState>;
|
|
14
35
|
/** Must render an `<input>`, `<textarea>` or `<select>`: `render={<textarea rows={3} />}`. */
|
|
15
36
|
render?: RenderProp<ComponentPropsWithRef<"input">, FieldState>;
|
|
@@ -24,6 +45,8 @@ export interface FieldControlProps extends Omit<ComponentPropsWithRef<"input">,
|
|
|
24
45
|
* Owned keys (conventions 1.2): `id`, `name`, `disabled`, `required`, `aria-invalid`,
|
|
25
46
|
* `aria-describedby` (token-merged), `data-invalid`, `data-disabled`, `data-required`,
|
|
26
47
|
* `data-pending`.
|
|
48
|
+
*
|
|
49
|
+
* @see https://ui.funstack.work/components/field
|
|
27
50
|
*/
|
|
28
51
|
export declare function FieldControl({ name, disabled, required, className, style, render, ...rest }: FieldControlProps): import("react").ReactNode;
|
|
29
52
|
export declare namespace FieldControl {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-control.d.mts","names":[],"sources":["../../src/field/field-control.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"field-control.d.mts","names":[],"sources":["../../src/field/field-control.tsx"],"mappings":";;;;;;;;;iBAiBiB,0BAA0B,KACzC;;;;;;EAQA;;;;;;;EAOA;;;;;;;EAOA;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,SAAS,WAAW,gCAAgC;;;;;;;;;;;;;;;wBAkBtC,eACd,MACA,UACA,UACA,WACA,OACA,WACG,QACF,oCAAiB;yBARJ"}
|
|
@@ -21,6 +21,8 @@ const CONTROL_TAGS = /* @__PURE__ */ new Set([
|
|
|
21
21
|
* Owned keys (conventions 1.2): `id`, `name`, `disabled`, `required`, `aria-invalid`,
|
|
22
22
|
* `aria-describedby` (token-merged), `data-invalid`, `data-disabled`, `data-required`,
|
|
23
23
|
* `data-pending`.
|
|
24
|
+
*
|
|
25
|
+
* @see https://ui.funstack.work/components/field
|
|
24
26
|
*/
|
|
25
27
|
function FieldControl({ name, disabled, required, className, style, render, ...rest }) {
|
|
26
28
|
const ctx = useFieldContext("Field.Control");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-control.mjs","names":[],"sources":["../../src/field/field-control.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties } from \"react\";\nimport { fieldDataAttributes, useFieldContext } from \"../internal/field-context.js\";\nimport type { FieldState } from \"../internal/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { useFieldControl } from \"../internal/use-field-control.js\";\nimport { useMergedRefs } from \"../internal/use-merged-refs.js\";\nimport { useRender } from \"../internal/use-render.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface FieldControlProps extends Omit<\n ComponentPropsWithRef<\"input\">,\n \"id\" | \"aria-invalid\" | \"className\" | \"style\" | \"children\"\n> {\n
|
|
1
|
+
{"version":3,"file":"field-control.mjs","names":[],"sources":["../../src/field/field-control.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties } from \"react\";\nimport { fieldDataAttributes, useFieldContext } from \"../internal/field-context.js\";\nimport type { FieldState } from \"../internal/field-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { useFieldControl } from \"../internal/use-field-control.js\";\nimport { useMergedRefs } from \"../internal/use-merged-refs.js\";\nimport { useRender } from \"../internal/use-render.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * Props of `Field.Control`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport interface FieldControlProps extends Omit<\n ComponentPropsWithRef<\"input\">,\n \"id\" | \"aria-invalid\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Native `name`.\n *\n * @defaultValue the Field's `name`\n */\n name?: string;\n /**\n * Native `disabled`. Owned. Also `true` when the Field is disabled: an explicit `false` does not\n * override the Field.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /**\n * Native `required`. Owned. Also `true` when the Field is required: an explicit `false` does not\n * override the Field.\n *\n * @defaultValue `false`\n */\n required?: boolean;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, FieldState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, FieldState>;\n /** Must render an `<input>`, `<textarea>` or `<select>`: `render={<textarea rows={3} />}`. */\n render?: RenderProp<ComponentPropsWithRef<\"input\">, FieldState>;\n}\n\nconst CONTROL_TAGS = new Set([\"INPUT\", \"TEXTAREA\", \"SELECT\"]);\n\n/**\n * The field's native control: an `<input>` (or a `<textarea>` / `<select>` through `render`)\n * wired to the Field: `id` for the Label, `aria-describedby` (the consumer's tokens, the\n * description, the error while shown), an explicit `aria-invalid`, and `name` / `disabled` /\n * `required` from the Field unless given. Everything else passes through, including `onChange`\n * / `value` for a controlled input; the Field's listeners are native and run independently.\n *\n * Owned keys (conventions 1.2): `id`, `name`, `disabled`, `required`, `aria-invalid`,\n * `aria-describedby` (token-merged), `data-invalid`, `data-disabled`, `data-required`,\n * `data-pending`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport function FieldControl({\n name,\n disabled,\n required,\n className,\n style,\n render,\n ...rest\n}: FieldControlProps) {\n const ctx = useFieldContext(\"Field.Control\");\n // `id` is not in the props type (the Field owns it); a JS caller's is ignored with a warning.\n const { id: consumerId, ...props } = rest as typeof rest & { id?: string };\n const field = useFieldControl({\n labelable: true,\n name,\n disabled,\n required,\n id: consumerId,\n component: \"Field.Control\",\n });\n const checkElement = useElementCheck(\n isDev &&\n ((el) =>\n !CONTROL_TAGS.has(el.tagName)\n ? \"Field.Control: expected to render an <input>, <textarea> or <select> but got \" +\n `<${el.tagName.toLowerCase()}>. Validation, labelling and form participation need a ` +\n \"native form control.\"\n : null),\n );\n const ref = useMergedRefs<HTMLElement>(checkElement, field.ref);\n\n return useRender<ComponentPropsWithRef<\"input\">, FieldState>({\n defaultElement: \"input\",\n render,\n state: ctx.state,\n className,\n style,\n children: undefined,\n props,\n libraryProps: {\n id: field.id,\n name: field.name,\n disabled: field.disabled,\n required: field.required,\n ...field.attributes,\n ...fieldDataAttributes(ctx.state),\n },\n ref,\n });\n}\n\nFieldControl.displayName = \"FieldControl\";\n"],"mappings":";;;;;;;AAUA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAuCvC,MAAM,+BAAe,IAAI,IAAI;CAAC;CAAS;CAAY;AAAQ,CAAC;;;;;;;;;;;;;;AAe5D,SAAgB,aAAa,EAC3B,MACA,UACA,UACA,WACA,OACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,gBAAgB,eAAe;CAE3C,MAAM,EAAE,IAAI,YAAY,GAAG,UAAU;CACrC,MAAM,QAAQ,gBAAgB;EAC5B,WAAW;EACX;EACA;EACA;EACA,IAAI;EACJ,WAAW;CACb,CAAC;CACD,MAAM,eAAe,gBACnB,WACI,OACA,CAAC,aAAa,IAAI,GAAG,OAAO,IACxB,iFACI,GAAG,QAAQ,YAAY,EAAE,+EAE7B,KACV;CACA,MAAM,MAAM,cAA2B,cAAc,MAAM,GAAG;CAE9D,OAAO,UAAsD;EAC3D,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA,UAAU,KAAA;EACV;EACA,cAAc;GACZ,IAAI,MAAM;GACV,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB,UAAU,MAAM;GAChB,GAAG,MAAM;GACT,GAAG,oBAAoB,IAAI,KAAK;EAClC;EACA;CACF,CAAC;AACH;AAEA,aAAa,cAAc"}
|
|
@@ -2,10 +2,19 @@ import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
|
2
2
|
import { FieldState } from "../internal/field-context.mjs";
|
|
3
3
|
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
4
|
//#region src/field/field-description.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Props of `Field.Description`.
|
|
7
|
+
*
|
|
8
|
+
* @see https://ui.funstack.work/components/field
|
|
9
|
+
*/
|
|
5
10
|
export interface FieldDescriptionProps extends Omit<ComponentPropsWithRef<"p">, "id" | "className" | "style" | "children"> {
|
|
11
|
+
/** Class name, or a function of the part's state that returns one. */
|
|
6
12
|
className?: StateValue<string | undefined, FieldState>;
|
|
13
|
+
/** Inline style, or a function of the part's state that returns one. */
|
|
7
14
|
style?: StateValue<CSSProperties | undefined, FieldState>;
|
|
15
|
+
/** Content, or a function of the part's state. */
|
|
8
16
|
children?: StateValue<ReactNode, FieldState>;
|
|
17
|
+
/** Replace the default `<p>` (element form) or take over rendering (function form). */
|
|
9
18
|
render?: RenderProp<ComponentPropsWithRef<"p">, FieldState>;
|
|
10
19
|
}
|
|
11
20
|
/**
|
|
@@ -15,6 +24,8 @@ export interface FieldDescriptionProps extends Omit<ComponentPropsWithRef<"p">,
|
|
|
15
24
|
*
|
|
16
25
|
* Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,
|
|
17
26
|
* `data-pending`.
|
|
27
|
+
*
|
|
28
|
+
* @see https://ui.funstack.work/components/field
|
|
18
29
|
*/
|
|
19
30
|
export declare function FieldDescription({ className, style, children, render, ...rest }: FieldDescriptionProps): ReactNode;
|
|
20
31
|
export declare namespace FieldDescription {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-description.d.mts","names":[],"sources":["../../src/field/field-description.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"field-description.d.mts","names":[],"sources":["../../src/field/field-description.tsx"],"mappings":";;;;;;;;;iBAYiB,8BAA8B,KAC7C;;EAIA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,4BAA4B;;;;;;;;;;;;wBAalC,mBACd,WACA,OACA,UACA,WACG,QACF,wBAAqB;yBANR"}
|
|
@@ -9,6 +9,8 @@ import { fieldDataAttributes, useFieldContext } from "../internal/field-context.
|
|
|
9
9
|
*
|
|
10
10
|
* Owned keys (conventions 1.2): `id`, `data-invalid`, `data-disabled`, `data-required`,
|
|
11
11
|
* `data-pending`.
|
|
12
|
+
*
|
|
13
|
+
* @see https://ui.funstack.work/components/field
|
|
12
14
|
*/
|
|
13
15
|
function FieldDescription({ className, style, children, render, ...rest }) {
|
|
14
16
|
const ctx = useFieldContext("Field.Description");
|