@wordpress/ui 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/CONTRIBUTING.md +149 -0
- package/README.md +34 -6
- package/build/alert-dialog/context.cjs +6 -1
- package/build/alert-dialog/context.cjs.map +2 -2
- package/build/alert-dialog/popup.cjs +105 -33
- package/build/alert-dialog/popup.cjs.map +4 -4
- package/build/alert-dialog/root.cjs +106 -6
- package/build/alert-dialog/root.cjs.map +2 -2
- package/build/alert-dialog/trigger.cjs +4 -14
- package/build/alert-dialog/trigger.cjs.map +3 -3
- package/build/alert-dialog/types.cjs.map +1 -1
- package/build/badge/badge.cjs +14 -14
- package/build/badge/badge.cjs.map +2 -2
- package/build/button/button.cjs +16 -6
- package/build/button/button.cjs.map +3 -3
- package/build/card/content.cjs +4 -4
- package/build/card/content.cjs.map +2 -2
- package/build/card/full-bleed.cjs +4 -4
- package/build/card/full-bleed.cjs.map +2 -2
- package/build/card/header.cjs +4 -4
- package/build/card/header.cjs.map +2 -2
- package/build/card/root.cjs +4 -4
- package/build/card/root.cjs.map +2 -2
- package/build/card/title.cjs +5 -25
- package/build/card/title.cjs.map +4 -4
- package/build/collapsible-card/content.cjs +3 -3
- package/build/collapsible-card/content.cjs.map +1 -1
- package/build/collapsible-card/header.cjs +6 -6
- package/build/collapsible-card/header.cjs.map +2 -2
- package/build/dialog/footer.cjs +3 -3
- package/build/dialog/footer.cjs.map +2 -2
- package/build/dialog/header.cjs +3 -3
- package/build/dialog/header.cjs.map +2 -2
- package/build/dialog/popup.cjs +5 -4
- package/build/dialog/popup.cjs.map +2 -2
- package/build/dialog/title.cjs +10 -19
- package/build/dialog/title.cjs.map +3 -3
- package/build/dialog/types.cjs.map +1 -1
- package/build/empty-state/actions.cjs +3 -3
- package/build/empty-state/actions.cjs.map +2 -2
- package/build/empty-state/description.cjs +8 -5
- package/build/empty-state/description.cjs.map +2 -2
- package/build/empty-state/icon.cjs +3 -3
- package/build/empty-state/icon.cjs.map +2 -2
- package/build/empty-state/root.cjs +3 -3
- package/build/empty-state/root.cjs.map +2 -2
- package/build/empty-state/title.cjs +8 -5
- package/build/empty-state/title.cjs.map +2 -2
- package/build/empty-state/visual.cjs +3 -3
- package/build/empty-state/visual.cjs.map +2 -2
- package/build/form/primitives/field/description.cjs +17 -4
- package/build/form/primitives/field/description.cjs.map +3 -3
- package/build/form/primitives/field/details.cjs +4 -4
- package/build/form/primitives/field/details.cjs.map +2 -2
- package/build/form/primitives/field/label.cjs +8 -8
- package/build/form/primitives/field/label.cjs.map +2 -2
- package/build/form/primitives/field/root.cjs +2 -2
- package/build/form/primitives/field/root.cjs.map +2 -2
- package/build/form/primitives/fieldset/description.cjs +20 -4
- package/build/form/primitives/fieldset/description.cjs.map +3 -3
- package/build/form/primitives/fieldset/details.cjs +3 -3
- package/build/form/primitives/fieldset/details.cjs.map +2 -2
- package/build/form/primitives/fieldset/legend.cjs +8 -7
- package/build/form/primitives/fieldset/legend.cjs.map +2 -2
- package/build/form/primitives/input/input.cjs +23 -7
- package/build/form/primitives/input/input.cjs.map +3 -3
- package/build/form/primitives/input-layout/input-layout.cjs +13 -3
- package/build/form/primitives/input-layout/input-layout.cjs.map +3 -3
- package/build/form/primitives/input-layout/slot.cjs +3 -3
- package/build/form/primitives/input-layout/slot.cjs.map +2 -2
- package/build/form/primitives/select/item.cjs +3 -3
- package/build/form/primitives/select/item.cjs.map +2 -2
- package/build/form/primitives/select/popup.cjs +5 -5
- package/build/form/primitives/select/popup.cjs.map +2 -2
- package/build/form/primitives/select/trigger.cjs +6 -6
- package/build/form/primitives/select/trigger.cjs.map +2 -2
- package/build/form/primitives/select/types.cjs.map +1 -1
- package/build/form/primitives/textarea/textarea.cjs +20 -1
- package/build/form/primitives/textarea/textarea.cjs.map +3 -3
- package/build/index.cjs +3 -0
- package/build/index.cjs.map +2 -2
- package/build/link/link.cjs +16 -6
- package/build/link/link.cjs.map +3 -3
- package/build/notice/action-button.cjs +3 -3
- package/build/notice/action-button.cjs.map +2 -2
- package/build/notice/action-link.cjs +3 -3
- package/build/notice/action-link.cjs.map +2 -2
- package/build/notice/actions.cjs +3 -3
- package/build/notice/actions.cjs.map +2 -2
- package/build/notice/close-icon.cjs +3 -3
- package/build/notice/close-icon.cjs.map +2 -2
- package/build/notice/description.cjs +3 -3
- package/build/notice/description.cjs.map +2 -2
- package/build/notice/root.cjs +3 -3
- package/build/notice/root.cjs.map +2 -2
- package/build/notice/title.cjs +3 -3
- package/build/notice/title.cjs.map +2 -2
- package/build/popover/arrow.cjs +94 -0
- package/build/popover/arrow.cjs.map +7 -0
- package/build/popover/close.cjs +45 -0
- package/build/popover/close.cjs.map +7 -0
- package/build/popover/context.cjs +76 -0
- package/build/popover/context.cjs.map +7 -0
- package/build/popover/description.cjs +70 -0
- package/build/popover/description.cjs.map +7 -0
- package/build/popover/index.cjs +49 -0
- package/build/popover/index.cjs.map +7 -0
- package/build/popover/popup.cjs +138 -0
- package/build/popover/popup.cjs.map +7 -0
- package/build/popover/root.cjs +35 -0
- package/build/popover/root.cjs.map +7 -0
- package/build/popover/title.cjs +56 -0
- package/build/popover/title.cjs.map +7 -0
- package/build/popover/trigger.cjs +38 -0
- package/build/popover/trigger.cjs.map +7 -0
- package/build/popover/types.cjs +19 -0
- package/build/popover/types.cjs.map +7 -0
- package/build/tabs/list.cjs +3 -4
- package/build/tabs/list.cjs.map +2 -2
- package/build/tabs/panel.cjs +3 -3
- package/build/tabs/panel.cjs.map +2 -2
- package/build/tabs/tab.cjs +3 -3
- package/build/tabs/tab.cjs.map +2 -2
- package/build/text/text.cjs +20 -5
- package/build/text/text.cjs.map +3 -3
- package/build/tooltip/popup.cjs +5 -4
- package/build/tooltip/popup.cjs.map +2 -2
- package/build/tooltip/root.cjs.map +2 -2
- package/build/tooltip/types.cjs.map +1 -1
- package/build/utils/types.cjs.map +1 -1
- package/build/utils/use-deprioritized-initial-focus.cjs.map +2 -2
- package/build/visually-hidden/visually-hidden.cjs.map +2 -2
- package/build-module/alert-dialog/context.mjs +6 -1
- package/build-module/alert-dialog/context.mjs.map +2 -2
- package/build-module/alert-dialog/popup.mjs +107 -33
- package/build-module/alert-dialog/popup.mjs.map +4 -4
- package/build-module/alert-dialog/root.mjs +113 -7
- package/build-module/alert-dialog/root.mjs.map +2 -2
- package/build-module/alert-dialog/trigger.mjs +4 -4
- package/build-module/alert-dialog/trigger.mjs.map +3 -3
- package/build-module/badge/badge.mjs +14 -14
- package/build-module/badge/badge.mjs.map +2 -2
- package/build-module/button/button.mjs +16 -6
- package/build-module/button/button.mjs.map +3 -3
- package/build-module/card/content.mjs +4 -4
- package/build-module/card/content.mjs.map +2 -2
- package/build-module/card/full-bleed.mjs +4 -4
- package/build-module/card/full-bleed.mjs.map +2 -2
- package/build-module/card/header.mjs +4 -4
- package/build-module/card/header.mjs.map +2 -2
- package/build-module/card/root.mjs +4 -4
- package/build-module/card/root.mjs.map +2 -2
- package/build-module/card/title.mjs +5 -15
- package/build-module/card/title.mjs.map +3 -3
- package/build-module/collapsible-card/content.mjs +3 -3
- package/build-module/collapsible-card/content.mjs.map +1 -1
- package/build-module/collapsible-card/header.mjs +6 -6
- package/build-module/collapsible-card/header.mjs.map +2 -2
- package/build-module/dialog/footer.mjs +3 -3
- package/build-module/dialog/footer.mjs.map +2 -2
- package/build-module/dialog/header.mjs +3 -3
- package/build-module/dialog/header.mjs.map +2 -2
- package/build-module/dialog/popup.mjs +5 -4
- package/build-module/dialog/popup.mjs.map +2 -2
- package/build-module/dialog/title.mjs +10 -9
- package/build-module/dialog/title.mjs.map +2 -2
- package/build-module/empty-state/actions.mjs +3 -3
- package/build-module/empty-state/actions.mjs.map +2 -2
- package/build-module/empty-state/description.mjs +8 -5
- package/build-module/empty-state/description.mjs.map +2 -2
- package/build-module/empty-state/icon.mjs +3 -3
- package/build-module/empty-state/icon.mjs.map +2 -2
- package/build-module/empty-state/root.mjs +3 -3
- package/build-module/empty-state/root.mjs.map +2 -2
- package/build-module/empty-state/title.mjs +8 -5
- package/build-module/empty-state/title.mjs.map +2 -2
- package/build-module/empty-state/visual.mjs +3 -3
- package/build-module/empty-state/visual.mjs.map +2 -2
- package/build-module/form/primitives/field/description.mjs +17 -4
- package/build-module/form/primitives/field/description.mjs.map +3 -3
- package/build-module/form/primitives/field/details.mjs +4 -4
- package/build-module/form/primitives/field/details.mjs.map +2 -2
- package/build-module/form/primitives/field/label.mjs +8 -8
- package/build-module/form/primitives/field/label.mjs.map +2 -2
- package/build-module/form/primitives/field/root.mjs +2 -2
- package/build-module/form/primitives/field/root.mjs.map +2 -2
- package/build-module/form/primitives/fieldset/description.mjs +20 -4
- package/build-module/form/primitives/fieldset/description.mjs.map +3 -3
- package/build-module/form/primitives/fieldset/details.mjs +3 -3
- package/build-module/form/primitives/fieldset/details.mjs.map +2 -2
- package/build-module/form/primitives/fieldset/legend.mjs +8 -7
- package/build-module/form/primitives/fieldset/legend.mjs.map +2 -2
- package/build-module/form/primitives/input/input.mjs +23 -7
- package/build-module/form/primitives/input/input.mjs.map +3 -3
- package/build-module/form/primitives/input-layout/input-layout.mjs +13 -3
- package/build-module/form/primitives/input-layout/input-layout.mjs.map +3 -3
- package/build-module/form/primitives/input-layout/slot.mjs +3 -3
- package/build-module/form/primitives/input-layout/slot.mjs.map +2 -2
- package/build-module/form/primitives/select/item.mjs +3 -3
- package/build-module/form/primitives/select/item.mjs.map +2 -2
- package/build-module/form/primitives/select/popup.mjs +5 -5
- package/build-module/form/primitives/select/popup.mjs.map +2 -2
- package/build-module/form/primitives/select/trigger.mjs +6 -6
- package/build-module/form/primitives/select/trigger.mjs.map +2 -2
- package/build-module/form/primitives/textarea/textarea.mjs +20 -1
- package/build-module/form/primitives/textarea/textarea.mjs.map +3 -3
- package/build-module/index.mjs +2 -0
- package/build-module/index.mjs.map +2 -2
- package/build-module/link/link.mjs +16 -6
- package/build-module/link/link.mjs.map +3 -3
- package/build-module/notice/action-button.mjs +3 -3
- package/build-module/notice/action-button.mjs.map +2 -2
- package/build-module/notice/action-link.mjs +3 -3
- package/build-module/notice/action-link.mjs.map +2 -2
- package/build-module/notice/actions.mjs +3 -3
- package/build-module/notice/actions.mjs.map +2 -2
- package/build-module/notice/close-icon.mjs +3 -3
- package/build-module/notice/close-icon.mjs.map +2 -2
- package/build-module/notice/description.mjs +3 -3
- package/build-module/notice/description.mjs.map +2 -2
- package/build-module/notice/root.mjs +3 -3
- package/build-module/notice/root.mjs.map +2 -2
- package/build-module/notice/title.mjs +3 -3
- package/build-module/notice/title.mjs.map +2 -2
- package/build-module/popover/arrow.mjs +59 -0
- package/build-module/popover/arrow.mjs.map +7 -0
- package/build-module/popover/close.mjs +20 -0
- package/build-module/popover/close.mjs.map +7 -0
- package/build-module/popover/context.mjs +57 -0
- package/build-module/popover/context.mjs.map +7 -0
- package/build-module/popover/description.mjs +35 -0
- package/build-module/popover/description.mjs.map +7 -0
- package/build-module/popover/index.mjs +18 -0
- package/build-module/popover/index.mjs.map +7 -0
- package/build-module/popover/popup.mjs +105 -0
- package/build-module/popover/popup.mjs.map +7 -0
- package/build-module/popover/root.mjs +10 -0
- package/build-module/popover/root.mjs.map +7 -0
- package/build-module/popover/title.mjs +31 -0
- package/build-module/popover/title.mjs.map +7 -0
- package/build-module/popover/trigger.mjs +13 -0
- package/build-module/popover/trigger.mjs.map +7 -0
- package/build-module/popover/types.mjs +1 -0
- package/build-module/popover/types.mjs.map +7 -0
- package/build-module/tabs/list.mjs +3 -4
- package/build-module/tabs/list.mjs.map +2 -2
- package/build-module/tabs/panel.mjs +3 -3
- package/build-module/tabs/panel.mjs.map +2 -2
- package/build-module/tabs/tab.mjs +3 -3
- package/build-module/tabs/tab.mjs.map +2 -2
- package/build-module/text/text.mjs +20 -5
- package/build-module/text/text.mjs.map +3 -3
- package/build-module/tooltip/popup.mjs +5 -4
- package/build-module/tooltip/popup.mjs.map +2 -2
- package/build-module/tooltip/root.mjs.map +2 -2
- package/build-module/utils/use-deprioritized-initial-focus.mjs.map +2 -2
- package/build-module/visually-hidden/visually-hidden.mjs.map +2 -2
- package/build-types/alert-dialog/context.d.ts +6 -3
- package/build-types/alert-dialog/context.d.ts.map +1 -1
- package/build-types/alert-dialog/popup.d.ts.map +1 -1
- package/build-types/alert-dialog/root.d.ts +2 -8
- package/build-types/alert-dialog/root.d.ts.map +1 -1
- package/build-types/alert-dialog/stories/index.story.d.ts +18 -6
- package/build-types/alert-dialog/stories/index.story.d.ts.map +1 -1
- package/build-types/alert-dialog/trigger.d.ts +2 -1
- package/build-types/alert-dialog/trigger.d.ts.map +1 -1
- package/build-types/alert-dialog/types.d.ts +61 -26
- package/build-types/alert-dialog/types.d.ts.map +1 -1
- package/build-types/badge/badge.d.ts.map +1 -1
- package/build-types/button/button.d.ts.map +1 -1
- package/build-types/card/stories/index.story.d.ts.map +1 -1
- package/build-types/card/title.d.ts.map +1 -1
- package/build-types/collapsible/panel.d.ts +2 -1
- package/build-types/collapsible/panel.d.ts.map +1 -1
- package/build-types/collapsible/root.d.ts +2 -1
- package/build-types/collapsible/root.d.ts.map +1 -1
- package/build-types/collapsible/trigger.d.ts +2 -1
- package/build-types/collapsible/trigger.d.ts.map +1 -1
- package/build-types/dialog/popup.d.ts.map +1 -1
- package/build-types/dialog/stories/index.story.d.ts +8 -0
- package/build-types/dialog/stories/index.story.d.ts.map +1 -1
- package/build-types/dialog/title.d.ts +12 -2
- package/build-types/dialog/title.d.ts.map +1 -1
- package/build-types/dialog/types.d.ts +8 -1
- package/build-types/dialog/types.d.ts.map +1 -1
- package/build-types/empty-state/description.d.ts.map +1 -1
- package/build-types/empty-state/title.d.ts.map +1 -1
- package/build-types/form/primitives/field/description.d.ts +2 -1
- package/build-types/form/primitives/field/description.d.ts.map +1 -1
- package/build-types/form/primitives/field/details.d.ts +2 -1
- package/build-types/form/primitives/field/details.d.ts.map +1 -1
- package/build-types/form/primitives/field/label.d.ts +2 -1
- package/build-types/form/primitives/field/label.d.ts.map +1 -1
- package/build-types/form/primitives/fieldset/description.d.ts +2 -1
- package/build-types/form/primitives/fieldset/description.d.ts.map +1 -1
- package/build-types/form/primitives/fieldset/details.d.ts +2 -1
- package/build-types/form/primitives/fieldset/details.d.ts.map +1 -1
- package/build-types/form/primitives/fieldset/legend.d.ts +2 -1
- package/build-types/form/primitives/fieldset/legend.d.ts.map +1 -1
- package/build-types/form/primitives/fieldset/root.d.ts +2 -1
- package/build-types/form/primitives/fieldset/root.d.ts.map +1 -1
- package/build-types/form/primitives/input/input.d.ts.map +1 -1
- package/build-types/form/primitives/input-layout/input-layout.d.ts.map +1 -1
- package/build-types/form/primitives/select/item.d.ts +6 -2
- package/build-types/form/primitives/select/item.d.ts.map +1 -1
- package/build-types/form/primitives/select/popup.d.ts +11 -1
- package/build-types/form/primitives/select/popup.d.ts.map +1 -1
- package/build-types/form/primitives/select/trigger.d.ts +12 -2
- package/build-types/form/primitives/select/trigger.d.ts.map +1 -1
- package/build-types/form/primitives/select/types.d.ts +13 -3
- package/build-types/form/primitives/select/types.d.ts.map +1 -1
- package/build-types/form/primitives/textarea/textarea.d.ts.map +1 -1
- package/build-types/form/stories/shared.d.ts.map +1 -1
- package/build-types/index.d.ts +1 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/link/link.d.ts.map +1 -1
- package/build-types/popover/arrow.d.ts +10 -0
- package/build-types/popover/arrow.d.ts.map +1 -0
- package/build-types/popover/close.d.ts +11 -0
- package/build-types/popover/close.d.ts.map +1 -0
- package/build-types/popover/context.d.ts +22 -0
- package/build-types/popover/context.d.ts.map +1 -0
- package/build-types/popover/description.d.ts +10 -0
- package/build-types/popover/description.d.ts.map +1 -0
- package/build-types/popover/index.d.ts +9 -0
- package/build-types/popover/index.d.ts.map +1 -0
- package/build-types/popover/popup.d.ts +11 -0
- package/build-types/popover/popup.d.ts.map +1 -0
- package/build-types/popover/root.d.ts +37 -0
- package/build-types/popover/root.d.ts.map +1 -0
- package/build-types/popover/stories/index.story.d.ts +211 -0
- package/build-types/popover/stories/index.story.d.ts.map +1 -0
- package/build-types/popover/stories/utils.d.ts +25 -0
- package/build-types/popover/stories/utils.d.ts.map +1 -0
- package/build-types/popover/test/index.test.d.ts +2 -0
- package/build-types/popover/test/index.test.d.ts.map +1 -0
- package/build-types/popover/title.d.ts +20 -0
- package/build-types/popover/title.d.ts.map +1 -0
- package/build-types/popover/trigger.d.ts +10 -0
- package/build-types/popover/trigger.d.ts.map +1 -0
- package/build-types/popover/types.d.ts +83 -0
- package/build-types/popover/types.d.ts.map +1 -0
- package/build-types/tabs/list.d.ts +2 -1
- package/build-types/tabs/list.d.ts.map +1 -1
- package/build-types/tabs/panel.d.ts +2 -1
- package/build-types/tabs/panel.d.ts.map +1 -1
- package/build-types/tabs/root.d.ts +2 -1
- package/build-types/tabs/root.d.ts.map +1 -1
- package/build-types/tabs/tab.d.ts +2 -1
- package/build-types/tabs/tab.d.ts.map +1 -1
- package/build-types/text/stories/index.story.d.ts +4 -0
- package/build-types/text/stories/index.story.d.ts.map +1 -1
- package/build-types/text/text.d.ts.map +1 -1
- package/build-types/tooltip/popup.d.ts.map +1 -1
- package/build-types/tooltip/root.d.ts +9 -8
- package/build-types/tooltip/root.d.ts.map +1 -1
- package/build-types/tooltip/stories/usage-guidelines.story.d.ts +21 -0
- package/build-types/tooltip/stories/usage-guidelines.story.d.ts.map +1 -0
- package/build-types/tooltip/types.d.ts +4 -0
- package/build-types/tooltip/types.d.ts.map +1 -1
- package/build-types/utils/types.d.ts +6 -2
- package/build-types/utils/types.d.ts.map +1 -1
- package/build-types/utils/use-deprioritized-initial-focus.d.ts +6 -5
- package/build-types/utils/use-deprioritized-initial-focus.d.ts.map +1 -1
- package/build-types/visually-hidden/stories/index.story.d.ts +7 -0
- package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -1
- package/build-types/visually-hidden/visually-hidden.d.ts +34 -0
- package/build-types/visually-hidden/visually-hidden.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/alert-dialog/context.tsx +12 -4
- package/src/alert-dialog/popup.tsx +91 -33
- package/src/alert-dialog/root.tsx +191 -13
- package/src/alert-dialog/stories/index.story.tsx +116 -65
- package/src/alert-dialog/style.module.css +11 -0
- package/src/alert-dialog/test/index.test.tsx +1319 -347
- package/src/alert-dialog/trigger.tsx +2 -2
- package/src/alert-dialog/types.ts +64 -28
- package/src/badge/badge.tsx +11 -14
- package/src/badge/style.module.css +0 -4
- package/src/button/button.tsx +2 -0
- package/src/button/style.module.css +7 -3
- package/src/card/stories/index.story.tsx +4 -5
- package/src/card/style.module.css +1 -5
- package/src/card/test/index.test.tsx +17 -1
- package/src/card/title.tsx +6 -5
- package/src/collapsible-card/stories/index.story.tsx +5 -5
- package/src/dialog/popup.tsx +2 -1
- package/src/dialog/stories/index.story.tsx +33 -0
- package/src/dialog/style.module.css +13 -9
- package/src/dialog/test/index.test.tsx +63 -4
- package/src/dialog/title.tsx +21 -9
- package/src/dialog/types.ts +9 -1
- package/src/empty-state/description.tsx +6 -2
- package/src/empty-state/style.module.css +1 -1
- package/src/empty-state/test/description.test.tsx +13 -0
- package/src/empty-state/test/title.test.tsx +13 -0
- package/src/empty-state/title.tsx +9 -3
- package/src/form/primitives/field/description.tsx +6 -1
- package/src/form/primitives/field/details.tsx +4 -2
- package/src/form/primitives/field/label.tsx +9 -5
- package/src/form/primitives/field/root.tsx +2 -2
- package/src/form/primitives/field/test/index.test.tsx +11 -0
- package/src/form/primitives/fieldset/description.tsx +9 -1
- package/src/form/primitives/fieldset/legend.tsx +9 -4
- package/src/form/primitives/fieldset/test/index.test.tsx +22 -0
- package/src/form/primitives/input/input.tsx +6 -1
- package/src/form/primitives/input/style.module.css +4 -0
- package/src/form/primitives/input-layout/input-layout.tsx +2 -0
- package/src/form/primitives/input-layout/style.module.css +3 -3
- package/src/form/primitives/select/popup.tsx +5 -2
- package/src/form/primitives/select/test/index.test.tsx +60 -1
- package/src/form/primitives/select/types.ts +14 -4
- package/src/form/primitives/textarea/textarea.tsx +10 -1
- package/src/form/stories/shared.tsx +4 -2
- package/src/index.ts +1 -0
- package/src/link/link.tsx +2 -0
- package/src/link/style.module.css +11 -1
- package/src/notice/style.module.css +5 -5
- package/src/popover/arrow.tsx +49 -0
- package/src/popover/close.tsx +24 -0
- package/src/popover/context.tsx +100 -0
- package/src/popover/description.tsx +29 -0
- package/src/popover/index.ts +9 -0
- package/src/popover/popup.tsx +106 -0
- package/src/popover/root.tsx +41 -0
- package/src/popover/stories/index.story.tsx +1315 -0
- package/src/popover/stories/utils.tsx +91 -0
- package/src/popover/style.module.css +64 -0
- package/src/popover/test/index.test.tsx +727 -0
- package/src/popover/title.tsx +47 -0
- package/src/popover/trigger.tsx +17 -0
- package/src/popover/types.ts +113 -0
- package/src/tabs/list.tsx +0 -1
- package/src/tabs/style.module.css +2 -2
- package/src/text/stories/index.story.tsx +4 -2
- package/src/text/style.module.css +62 -36
- package/src/text/test/index.test.tsx +1 -4
- package/src/text/text.tsx +8 -1
- package/src/tooltip/popup.tsx +2 -1
- package/src/tooltip/root.tsx +9 -8
- package/src/tooltip/stories/usage-guidelines.mdx +91 -0
- package/src/tooltip/stories/usage-guidelines.story.tsx +119 -0
- package/src/tooltip/style.module.css +2 -2
- package/src/tooltip/test/index.test.tsx +61 -0
- package/src/tooltip/types.ts +5 -0
- package/src/utils/css/field.module.css +12 -9
- package/src/utils/css/focus.module.css +7 -5
- package/src/utils/css/global-css-defense.module.css +117 -0
- package/src/utils/css/item-popup.module.css +2 -2
- package/src/utils/types.ts +7 -2
- package/src/utils/use-deprioritized-initial-focus.ts +5 -4
- package/src/visually-hidden/stories/index.story.tsx +25 -0
- package/src/visually-hidden/visually-hidden.tsx +34 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useCallback,
|
|
4
|
+
useContext,
|
|
5
|
+
useEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef,
|
|
8
|
+
} from '@wordpress/element';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Whether validation is enabled. This is a build-time constant that allows
|
|
12
|
+
* bundlers to tree-shake all validation code in production builds.
|
|
13
|
+
*/
|
|
14
|
+
const VALIDATION_ENABLED = process.env.NODE_ENV !== 'production';
|
|
15
|
+
|
|
16
|
+
type PopoverValidationContextType = {
|
|
17
|
+
registerTitle: ( element: HTMLElement | null ) => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const PopoverValidationContext = VALIDATION_ENABLED
|
|
21
|
+
? createContext< PopoverValidationContextType | null >( null )
|
|
22
|
+
: ( null as unknown as React.Context< PopoverValidationContextType | null > );
|
|
23
|
+
|
|
24
|
+
function usePopoverValidationContextDev() {
|
|
25
|
+
return useContext( PopoverValidationContext );
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function usePopoverValidationContextProd() {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Hook to access the popover validation context.
|
|
34
|
+
* Returns null in production or if not within a Popover.Popup.
|
|
35
|
+
*/
|
|
36
|
+
export const usePopoverValidationContext = VALIDATION_ENABLED
|
|
37
|
+
? usePopoverValidationContextDev
|
|
38
|
+
: usePopoverValidationContextProd;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Development-only provider that tracks whether Popover.Title is rendered.
|
|
42
|
+
*/
|
|
43
|
+
function PopoverValidationProviderDev( {
|
|
44
|
+
children,
|
|
45
|
+
}: {
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
} ) {
|
|
48
|
+
const titleElementRef = useRef< HTMLElement | null >( null );
|
|
49
|
+
|
|
50
|
+
const registerTitle = useCallback( ( element: HTMLElement | null ) => {
|
|
51
|
+
titleElementRef.current = element;
|
|
52
|
+
}, [] );
|
|
53
|
+
|
|
54
|
+
const contextValue = useMemo(
|
|
55
|
+
() => ( { registerTitle } ),
|
|
56
|
+
[ registerTitle ]
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
useEffect( () => {
|
|
60
|
+
const titleElement = titleElementRef.current;
|
|
61
|
+
|
|
62
|
+
if ( ! titleElement ) {
|
|
63
|
+
throw new Error(
|
|
64
|
+
'Popover: Missing <Popover.Title>. ' +
|
|
65
|
+
'For accessibility, every popover requires a title. ' +
|
|
66
|
+
'If needed, the title can be visually hidden but must not be omitted.'
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const textContent = titleElement.textContent?.trim();
|
|
71
|
+
if ( ! textContent ) {
|
|
72
|
+
throw new Error(
|
|
73
|
+
'Popover: <Popover.Title> cannot be empty. ' +
|
|
74
|
+
'Provide meaningful text content for the popover title.'
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}, [] );
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<PopoverValidationContext.Provider value={ contextValue }>
|
|
81
|
+
{ children }
|
|
82
|
+
</PopoverValidationContext.Provider>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function PopoverValidationProviderProd( {
|
|
87
|
+
children,
|
|
88
|
+
}: {
|
|
89
|
+
children: React.ReactNode;
|
|
90
|
+
} ) {
|
|
91
|
+
return <>{ children }</>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Provider component that validates Popover.Title presence in development mode.
|
|
96
|
+
* In production, this component is a no-op and just renders children.
|
|
97
|
+
*/
|
|
98
|
+
export const PopoverValidationProvider = VALIDATION_ENABLED
|
|
99
|
+
? PopoverValidationProviderDev
|
|
100
|
+
: PopoverValidationProviderProd;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Popover as _Popover } from '@base-ui/react/popover';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { forwardRef } from '@wordpress/element';
|
|
4
|
+
import { Text } from '../text';
|
|
5
|
+
import styles from './style.module.css';
|
|
6
|
+
import type { DescriptionProps } from './types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Renders an optional paragraph that describes the popover content.
|
|
10
|
+
*
|
|
11
|
+
* The rendered element is linked to the popup via `aria-describedby`.
|
|
12
|
+
* Uses the `body-md` text variant by default.
|
|
13
|
+
*/
|
|
14
|
+
const Description = forwardRef< HTMLParagraphElement, DescriptionProps >(
|
|
15
|
+
function PopoverDescription( { className, children, ...props }, ref ) {
|
|
16
|
+
return (
|
|
17
|
+
<Text
|
|
18
|
+
ref={ ref }
|
|
19
|
+
variant="body-md"
|
|
20
|
+
render={ <_Popover.Description { ...props } /> }
|
|
21
|
+
className={ clsx( styles.description, className ) }
|
|
22
|
+
>
|
|
23
|
+
{ children }
|
|
24
|
+
</Text>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export { Description };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Arrow } from './arrow';
|
|
2
|
+
import { Close } from './close';
|
|
3
|
+
import { Description } from './description';
|
|
4
|
+
import { Popup } from './popup';
|
|
5
|
+
import { Root } from './root';
|
|
6
|
+
import { Title } from './title';
|
|
7
|
+
import { Trigger } from './trigger';
|
|
8
|
+
|
|
9
|
+
export { Arrow, Close, Description, Popup, Root, Title, Trigger };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Popover as _Popover } from '@base-ui/react/popover';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { forwardRef } from '@wordpress/element';
|
|
4
|
+
import { useMergeRefs } from '@wordpress/compose';
|
|
5
|
+
import {
|
|
6
|
+
type ThemeProvider as ThemeProviderType,
|
|
7
|
+
privateApis as themePrivateApis,
|
|
8
|
+
} from '@wordpress/theme';
|
|
9
|
+
import { unlock } from '../lock-unlock';
|
|
10
|
+
import resetStyles from '../utils/css/resets.module.css';
|
|
11
|
+
import { useDeprioritizedInitialFocus } from '../utils/use-deprioritized-initial-focus';
|
|
12
|
+
import { PopoverValidationProvider } from './context';
|
|
13
|
+
import styles from './style.module.css';
|
|
14
|
+
import type { PopupProps } from './types';
|
|
15
|
+
|
|
16
|
+
const ThemeProvider: typeof ThemeProviderType =
|
|
17
|
+
unlock( themePrivateApis ).ThemeProvider;
|
|
18
|
+
|
|
19
|
+
const CLOSE_ATTR = 'data-wp-ui-popover-close';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Renders the floating popup container for the popover content.
|
|
23
|
+
*
|
|
24
|
+
* Handles portal rendering, positioning relative to the anchor, collision
|
|
25
|
+
* avoidance, focus management, and optional backdrop. Supply a `container`
|
|
26
|
+
* element for cross-document scenarios such as iframes.
|
|
27
|
+
*/
|
|
28
|
+
const Popup = forwardRef< HTMLDivElement, PopupProps >( function PopoverPopup(
|
|
29
|
+
{
|
|
30
|
+
align = 'center',
|
|
31
|
+
alignOffset,
|
|
32
|
+
anchor,
|
|
33
|
+
// Matches the popup's border-radius (--wpds-border-radius-md).
|
|
34
|
+
arrowPadding = 8,
|
|
35
|
+
backdrop = false,
|
|
36
|
+
children,
|
|
37
|
+
className,
|
|
38
|
+
collisionAvoidance,
|
|
39
|
+
collisionBoundary,
|
|
40
|
+
collisionPadding,
|
|
41
|
+
container,
|
|
42
|
+
finalFocus,
|
|
43
|
+
initialFocus,
|
|
44
|
+
side = 'bottom',
|
|
45
|
+
sideOffset = 8,
|
|
46
|
+
sticky,
|
|
47
|
+
style,
|
|
48
|
+
variant = 'default',
|
|
49
|
+
...props
|
|
50
|
+
},
|
|
51
|
+
ref
|
|
52
|
+
) {
|
|
53
|
+
const { resolvedInitialFocus, popupRef } = useDeprioritizedInitialFocus( {
|
|
54
|
+
initialFocus,
|
|
55
|
+
deprioritizedAttribute: CLOSE_ATTR,
|
|
56
|
+
} );
|
|
57
|
+
const mergedPopupRef = useMergeRefs( [ ref, popupRef ] );
|
|
58
|
+
|
|
59
|
+
const backdropElement = backdrop ? (
|
|
60
|
+
<_Popover.Backdrop className={ styles.backdrop } />
|
|
61
|
+
) : null;
|
|
62
|
+
|
|
63
|
+
const positioner = (
|
|
64
|
+
<_Popover.Positioner
|
|
65
|
+
align={ align }
|
|
66
|
+
alignOffset={ alignOffset }
|
|
67
|
+
anchor={ anchor }
|
|
68
|
+
arrowPadding={ arrowPadding }
|
|
69
|
+
collisionAvoidance={ collisionAvoidance }
|
|
70
|
+
collisionBoundary={ collisionBoundary }
|
|
71
|
+
collisionPadding={ collisionPadding }
|
|
72
|
+
side={ side }
|
|
73
|
+
sideOffset={ sideOffset }
|
|
74
|
+
sticky={ sticky }
|
|
75
|
+
style={ style }
|
|
76
|
+
className={ clsx(
|
|
77
|
+
resetStyles[ 'box-sizing' ],
|
|
78
|
+
styles.positioner,
|
|
79
|
+
className
|
|
80
|
+
) }
|
|
81
|
+
>
|
|
82
|
+
<ThemeProvider>
|
|
83
|
+
<_Popover.Popup
|
|
84
|
+
ref={ mergedPopupRef }
|
|
85
|
+
initialFocus={ resolvedInitialFocus }
|
|
86
|
+
finalFocus={ finalFocus }
|
|
87
|
+
className={ clsx( variant !== 'unstyled' && styles.popup ) }
|
|
88
|
+
{ ...props }
|
|
89
|
+
>
|
|
90
|
+
<PopoverValidationProvider>
|
|
91
|
+
{ children }
|
|
92
|
+
</PopoverValidationProvider>
|
|
93
|
+
</_Popover.Popup>
|
|
94
|
+
</ThemeProvider>
|
|
95
|
+
</_Popover.Positioner>
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<_Popover.Portal container={ container }>
|
|
100
|
+
{ backdropElement }
|
|
101
|
+
{ positioner }
|
|
102
|
+
</_Popover.Portal>
|
|
103
|
+
);
|
|
104
|
+
} );
|
|
105
|
+
|
|
106
|
+
export { Popup };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Popover as _Popover } from '@base-ui/react/popover';
|
|
2
|
+
import type { RootProps } from './types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* An accessible popup anchored to a trigger element.
|
|
6
|
+
*
|
|
7
|
+
* Popover renders ARIA-compliant floating content that appears next to its
|
|
8
|
+
* trigger. It can contain interactive content such as form controls, menus,
|
|
9
|
+
* and rich descriptions.
|
|
10
|
+
*
|
|
11
|
+
* Compose the compound components to build a popover:
|
|
12
|
+
*
|
|
13
|
+
* - `Popover.Root` — provides open state and context to all sub-components.
|
|
14
|
+
* - `Popover.Trigger` — the button that toggles the popup.
|
|
15
|
+
* - `Popover.Popup` — the floating container (portal, positioning, collision
|
|
16
|
+
* avoidance).
|
|
17
|
+
* - `Popover.Arrow` — an optional arrow pointing toward the anchor.
|
|
18
|
+
* - `Popover.Title` — **required** heading that labels the popover for
|
|
19
|
+
* accessibility (can be visually hidden).
|
|
20
|
+
* - `Popover.Description` — optional paragraph linked via `aria-describedby`.
|
|
21
|
+
* - `Popover.Close` — a button that closes the popover when clicked.
|
|
22
|
+
* **Required** when `modal` is `true` or `'trap-focus'` so that focus
|
|
23
|
+
* can cycle correctly and the user can dismiss the popover.
|
|
24
|
+
*
|
|
25
|
+
* ```jsx
|
|
26
|
+
* <Popover.Root>
|
|
27
|
+
* <Popover.Trigger>Open</Popover.Trigger>
|
|
28
|
+
* <Popover.Popup>
|
|
29
|
+
* <Popover.Arrow />
|
|
30
|
+
* <Popover.Title>Popover title</Popover.Title>
|
|
31
|
+
* <Popover.Description>Popover description</Popover.Description>
|
|
32
|
+
* <Popover.Close>Close</Popover.Close>
|
|
33
|
+
* </Popover.Popup>
|
|
34
|
+
* </Popover.Root>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
function Root( props: RootProps ) {
|
|
38
|
+
return <_Popover.Root { ...props } />;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { Root };
|