@wordpress/ui 0.10.0 → 0.11.1-next.v.202604091042.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 +27 -0
- package/CONTRIBUTING.md +25 -0
- package/README.md +22 -2
- 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/button/button.cjs +16 -6
- package/build/button/button.cjs.map +3 -3
- package/build/card/content.cjs +3 -3
- package/build/card/content.cjs.map +1 -1
- package/build/card/full-bleed.cjs +3 -3
- package/build/card/full-bleed.cjs.map +1 -1
- package/build/card/header.cjs +3 -3
- package/build/card/header.cjs.map +1 -1
- package/build/card/root.cjs +3 -3
- package/build/card/root.cjs.map +1 -1
- package/build/card/title.cjs +3 -3
- package/build/card/title.cjs.map +1 -1
- package/build/collapsible-card/header.cjs +3 -3
- package/build/collapsible-card/header.cjs.map +2 -2
- package/build/empty-state/title.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 +3 -3
- package/build/form/primitives/field/details.cjs.map +2 -2
- package/build/form/primitives/field/label.cjs +3 -3
- package/build/form/primitives/field/label.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 +3 -3
- 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 +10 -0
- package/build/form/primitives/input-layout/input-layout.cjs.map +3 -3
- package/build/form/primitives/select/trigger.cjs +3 -3
- package/build/form/primitives/select/trigger.cjs.map +2 -2
- 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/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/text/text.cjs +20 -5
- package/build/text/text.cjs.map +3 -3
- package/build/utils/use-deprioritized-initial-focus.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/button/button.mjs +16 -6
- package/build-module/button/button.mjs.map +3 -3
- package/build-module/card/content.mjs +3 -3
- package/build-module/card/content.mjs.map +1 -1
- package/build-module/card/full-bleed.mjs +3 -3
- package/build-module/card/full-bleed.mjs.map +1 -1
- package/build-module/card/header.mjs +3 -3
- package/build-module/card/header.mjs.map +1 -1
- package/build-module/card/root.mjs +3 -3
- package/build-module/card/root.mjs.map +1 -1
- package/build-module/card/title.mjs +3 -3
- package/build-module/card/title.mjs.map +1 -1
- package/build-module/collapsible-card/header.mjs +3 -3
- package/build-module/collapsible-card/header.mjs.map +2 -2
- package/build-module/empty-state/title.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 +3 -3
- package/build-module/form/primitives/field/details.mjs.map +2 -2
- package/build-module/form/primitives/field/label.mjs +3 -3
- package/build-module/form/primitives/field/label.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 +3 -3
- 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 +10 -0
- package/build-module/form/primitives/input-layout/input-layout.mjs.map +3 -3
- package/build-module/form/primitives/select/trigger.mjs +3 -3
- 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/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/text/text.mjs +20 -5
- package/build-module/text/text.mjs.map +3 -3
- package/build-module/utils/use-deprioritized-initial-focus.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 +57 -26
- package/build-types/alert-dialog/types.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/empty-state/title.d.ts.map +1 -1
- package/build-types/form/primitives/field/description.d.ts.map +1 -1
- package/build-types/form/primitives/fieldset/description.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/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/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/utils/use-deprioritized-initial-focus.d.ts +6 -5
- package/build-types/utils/use-deprioritized-initial-focus.d.ts.map +1 -1
- package/package.json +11 -11
- 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 +1265 -347
- package/src/alert-dialog/trigger.tsx +2 -2
- package/src/alert-dialog/types.ts +59 -28
- package/src/button/button.tsx +2 -0
- package/src/button/style.module.css +4 -0
- package/src/card/stories/index.story.tsx +0 -1
- package/src/card/style.module.css +1 -1
- package/src/card/test/index.test.tsx +0 -1
- package/src/empty-state/title.tsx +0 -1
- package/src/form/primitives/field/description.tsx +6 -1
- package/src/form/primitives/fieldset/description.tsx +9 -1
- 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/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 +10 -0
- 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 +34 -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 +50 -0
- package/src/popover/trigger.tsx +17 -0
- package/src/popover/types.ts +113 -0
- package/src/text/stories/index.story.tsx +4 -2
- package/src/text/style.module.css +26 -0
- package/src/text/test/index.test.tsx +1 -4
- package/src/text/text.tsx +8 -1
- package/src/utils/css/field.module.css +4 -1
- package/src/utils/css/focus.module.css +7 -5
- package/src/utils/css/global-css-defense.module.css +117 -0
- package/src/utils/use-deprioritized-initial-focus.ts +5 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './badge';\nexport * from './button';\nexport * as Card from './card';\nexport * as Collapsible from './collapsible';\nexport * as CollapsibleCard from './collapsible-card';\nexport * as AlertDialog from './alert-dialog';\nexport * as Dialog from './dialog';\nexport * as EmptyState from './empty-state';\nexport * from './form';\nexport * from './icon';\nexport * from './icon-button';\nexport * from './link';\nexport * as Notice from './notice';\nexport * from './stack';\nexport * as Tabs from './tabs';\nexport * from './text';\nexport * as Tooltip from './tooltip';\nexport * from './visually-hidden';\n"],
|
|
5
|
-
"mappings": ";AAAA,cAAc;AACd,cAAc;AACd,YAAY,UAAU;AACtB,YAAY,iBAAiB;AAC7B,YAAY,qBAAqB;AACjC,YAAY,iBAAiB;AAC7B,YAAY,YAAY;AACxB,YAAY,gBAAgB;AAC5B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,YAAY,YAAY;AACxB,cAAc;AACd,YAAY,UAAU;AACtB,cAAc;AACd,YAAY,aAAa;AACzB,cAAc;",
|
|
4
|
+
"sourcesContent": ["export * from './badge';\nexport * from './button';\nexport * as Card from './card';\nexport * as Collapsible from './collapsible';\nexport * as CollapsibleCard from './collapsible-card';\nexport * as AlertDialog from './alert-dialog';\nexport * as Dialog from './dialog';\nexport * as EmptyState from './empty-state';\nexport * from './form';\nexport * from './icon';\nexport * from './icon-button';\nexport * from './link';\nexport * as Notice from './notice';\nexport * as Popover from './popover';\nexport * from './stack';\nexport * as Tabs from './tabs';\nexport * from './text';\nexport * as Tooltip from './tooltip';\nexport * from './visually-hidden';\n"],
|
|
5
|
+
"mappings": ";AAAA,cAAc;AACd,cAAc;AACd,YAAY,UAAU;AACtB,YAAY,iBAAiB;AAC7B,YAAY,qBAAqB;AACjC,YAAY,iBAAiB;AAC7B,YAAY,YAAY;AACxB,YAAY,gBAAgB;AAC5B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,YAAY,YAAY;AACxB,YAAY,aAAa;AACzB,cAAc;AACd,YAAY,UAAU;AACtB,cAAc;AACd,YAAY,aAAa;AACzB,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -14,23 +14,32 @@ if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !docum
|
|
|
14
14
|
var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
|
|
15
15
|
|
|
16
16
|
// packages/ui/src/utils/css/focus.module.css
|
|
17
|
-
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='
|
|
17
|
+
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='2a5ab8f3a7']")) {
|
|
18
18
|
const style = document.createElement("style");
|
|
19
|
-
style.setAttribute("data-wp-hash", "
|
|
20
|
-
style.appendChild(document.createTextNode("@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){transition:outline .1s ease-out
|
|
19
|
+
style.setAttribute("data-wp-hash", "2a5ab8f3a7");
|
|
20
|
+
style.appendChild(document.createTextNode("@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid #0000;outline-offset:1px}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9))}}"));
|
|
21
21
|
document.head.appendChild(style);
|
|
22
22
|
}
|
|
23
23
|
var focus_default = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" };
|
|
24
24
|
|
|
25
25
|
// packages/ui/src/link/style.module.css
|
|
26
|
-
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='
|
|
26
|
+
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='f197386fe0']")) {
|
|
27
27
|
const style = document.createElement("style");
|
|
28
|
-
style.setAttribute("data-wp-hash", "
|
|
29
|
-
style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.d4250949359b05ce__link{text-decoration-thickness:.5px;text-underline-offset:.2em}.c6055659b8e2cd2c__is-brand,.c6055659b8e2cd2c__is-brand:visited{color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{color:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);text-decoration-color:var(--wpds-color-stroke-interactive-neutral,#8a8a8a)}._92e0dfcaeee15b88__is-neutral:active,._92e0dfcaeee15b88__is-neutral:hover{color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}.cf122a9bf1035d42__is-unstyled{color:inherit;text-decoration:none}.e6ad7c380ee337fe__has-link-icon{text-decoration:none}._8dc7567f9ff415bf__link-contents{text-decoration:underline;text-decoration-color:inherit;text-decoration-thickness:.5px}._0cb411afac4c86c7__link-icon{font-weight:var(--wpds-font-weight-regular,400);margin-inline-start:var(--wpds-dimension-padding-xs,4px)}._0cb411afac4c86c7__link-icon:after{content:"\\2197"}._0cb411afac4c86c7__link-icon:dir(rtl):after{content:"\\2196"}}'));
|
|
28
|
+
style.setAttribute("data-wp-hash", "f197386fe0");
|
|
29
|
+
style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.d4250949359b05ce__link{text-decoration-thickness:.5px;text-underline-offset:.2em}.c6055659b8e2cd2c__is-brand,.c6055659b8e2cd2c__is-brand:visited{--_gcd-a-color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{--_gcd-a-color:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{--_gcd-a-color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);text-decoration-color:var(--wpds-color-stroke-interactive-neutral,#8a8a8a)}._92e0dfcaeee15b88__is-neutral:active,._92e0dfcaeee15b88__is-neutral:hover{--_gcd-a-color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e);color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}.cf122a9bf1035d42__is-unstyled{--_gcd-a-color:inherit;color:inherit;text-decoration:none}.e6ad7c380ee337fe__has-link-icon{text-decoration:none}._8dc7567f9ff415bf__link-contents{text-decoration:underline;text-decoration-color:inherit;text-decoration-thickness:.5px}._0cb411afac4c86c7__link-icon{font-weight:var(--wpds-font-weight-regular,400);margin-inline-start:var(--wpds-dimension-padding-xs,4px)}._0cb411afac4c86c7__link-icon:after{content:"\\2197"}._0cb411afac4c86c7__link-icon:dir(rtl):after{content:"\\2196"}}'));
|
|
30
30
|
document.head.appendChild(style);
|
|
31
31
|
}
|
|
32
32
|
var style_default = { "link": "d4250949359b05ce__link", "is-brand": "c6055659b8e2cd2c__is-brand", "is-neutral": "_92e0dfcaeee15b88__is-neutral", "is-unstyled": "cf122a9bf1035d42__is-unstyled", "has-link-icon": "e6ad7c380ee337fe__has-link-icon", "link-contents": "_8dc7567f9ff415bf__link-contents", "link-icon": "_0cb411afac4c86c7__link-icon" };
|
|
33
33
|
|
|
34
|
+
// packages/ui/src/utils/css/global-css-defense.module.css
|
|
35
|
+
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='3bd1d35622']")) {
|
|
36
|
+
const style = document.createElement("style");
|
|
37
|
+
style.setAttribute("data-wp-hash", "3bd1d35622");
|
|
38
|
+
style.appendChild(document.createTextNode("._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8a8a8a))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-interactive-neutral-disabled,#8a8a8a))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid #0000)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid #0000);transition:var(--_gcd-a-transition,none)}"));
|
|
39
|
+
document.head.appendChild(style);
|
|
40
|
+
}
|
|
41
|
+
var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" };
|
|
42
|
+
|
|
34
43
|
// packages/ui/src/link/link.tsx
|
|
35
44
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
36
45
|
var Link = forwardRef(function Link2({
|
|
@@ -56,6 +65,7 @@ var Link = forwardRef(function Link2({
|
|
|
56
65
|
ref,
|
|
57
66
|
props: mergeProps(props, {
|
|
58
67
|
className: clsx(
|
|
68
|
+
global_css_defense_default.a,
|
|
59
69
|
resets_default["box-sizing"],
|
|
60
70
|
focus_default["outset-ring--focus"],
|
|
61
71
|
variant !== "unstyled" && style_default.link,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/link/link.tsx", "../../src/utils/css/resets.module.css", "../../src/utils/css/focus.module.css", "../../src/link/style.module.css"],
|
|
4
|
-
"sourcesContent": ["import { useRender, mergeProps } from '@base-ui/react';\nimport clsx from 'clsx';\nimport { forwardRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { type LinkProps } from './types';\nimport resetStyles from '../utils/css/resets.module.css';\nimport focusStyles from '../utils/css/focus.module.css';\nimport styles from './style.module.css';\n\n/**\n * A styled anchor element with support for semantic color tones and an\n * unstyled escape hatch.\n */\nexport const Link = forwardRef< HTMLAnchorElement, LinkProps >( function Link(\n\t{\n\t\tchildren,\n\t\tvariant = 'default',\n\t\ttone = 'brand',\n\t\topenInNewTab = false,\n\t\trender,\n\t\tclassName,\n\t\tonClick,\n\t\t...props\n\t},\n\tref\n) {\n\tconst isInternalAnchor = !! props.href?.startsWith( '#' );\n\n\tconst handleClick = ( event: React.MouseEvent< HTMLAnchorElement > ) => {\n\t\tif ( openInNewTab && isInternalAnchor ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tonClick?.( event );\n\t};\n\n\tconst element = useRender( {\n\t\trender,\n\t\tdefaultTagName: 'a',\n\t\tref,\n\t\tprops: mergeProps< 'a' >( props, {\n\t\t\tclassName: clsx(\n\t\t\t\tresetStyles[ 'box-sizing' ],\n\t\t\t\tfocusStyles[ 'outset-ring--focus' ],\n\t\t\t\tvariant !== 'unstyled' && styles.link,\n\t\t\t\tvariant !== 'unstyled' && styles[ `is-${ tone }` ],\n\t\t\t\tvariant === 'unstyled' && styles[ 'is-unstyled' ],\n\t\t\t\topenInNewTab && styles[ 'has-link-icon' ],\n\t\t\t\tclassName\n\t\t\t),\n\t\t\tonClick: handleClick,\n\t\t\ttarget: openInNewTab ? '_blank' : undefined,\n\t\t\tchildren: openInNewTab ? (\n\t\t\t\t<>\n\t\t\t\t\t<span className={ styles[ 'link-contents' ] }>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ styles[ 'link-icon' ] }\n\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t/* translators: accessibility text appended to link text */\n\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\tchildren\n\t\t\t),\n\t\t} ),\n\t} );\n\n\treturn element;\n} );\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='e3ae230cea']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"e3ae230cea\");\n\tstyle.appendChild(document.createTextNode(\"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"box-sizing\":\"_336cd3e4e743482f__box-sizing\"};\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='4acd2b57a1']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"4acd2b57a1\");\n\tstyle.appendChild(document.createTextNode(\"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){transition:outline .1s ease-out}outline-color:#0000;outline-offset:1px;outline-style:solid;outline-width:0}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{outline-color:var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline-width:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"outset-ring--focus\":\"_08e8a2e44959f892__outset-ring--focus\",\"outset-ring--focus-except-active\":\"e25b2bdd7aa21721__outset-ring--focus-except-active\",\"outset-ring--focus-visible\":\"d0541bc9dd9dc7b6__outset-ring--focus-visible\",\"outset-ring--focus-within\":\"cd83dfc2126a0846__outset-ring--focus-within\",\"outset-ring--focus-within-except-active\":\"_970d04df7376df67__outset-ring--focus-within-except-active\",\"outset-ring--focus-within-visible\":\"c5cb3ee4bddaa8e4__outset-ring--focus-within-visible\",\"outset-ring--focus-parent-visible\":\"ecadb9e080e2dfa5__outset-ring--focus-parent-visible\"};\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='ced84b3704']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"ced84b3704\");\n\tstyle.appendChild(document.createTextNode(\"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.d4250949359b05ce__link{text-decoration-thickness:.5px;text-underline-offset:.2em}.c6055659b8e2cd2c__is-brand,.c6055659b8e2cd2c__is-brand:visited{color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{color:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);text-decoration-color:var(--wpds-color-stroke-interactive-neutral,#8a8a8a)}._92e0dfcaeee15b88__is-neutral:active,._92e0dfcaeee15b88__is-neutral:hover{color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}.cf122a9bf1035d42__is-unstyled{color:inherit;text-decoration:none}.e6ad7c380ee337fe__has-link-icon{text-decoration:none}._8dc7567f9ff415bf__link-contents{text-decoration:underline;text-decoration-color:inherit;text-decoration-thickness:.5px}._0cb411afac4c86c7__link-icon{font-weight:var(--wpds-font-weight-regular,400);margin-inline-start:var(--wpds-dimension-padding-xs,4px)}._0cb411afac4c86c7__link-icon:after{content:\\\"\\\\2197\\\"}._0cb411afac4c86c7__link-icon:dir(rtl):after{content:\\\"\\\\2196\\\"}}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"link\":\"d4250949359b05ce__link\",\"is-brand\":\"c6055659b8e2cd2c__is-brand\",\"is-neutral\":\"_92e0dfcaeee15b88__is-neutral\",\"is-unstyled\":\"cf122a9bf1035d42__is-unstyled\",\"has-link-icon\":\"e6ad7c380ee337fe__has-link-icon\",\"link-contents\":\"_8dc7567f9ff415bf__link-contents\",\"link-icon\":\"_0cb411afac4c86c7__link-icon\"};\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,WAAW,kBAAkB;AACtC,OAAO,UAAU;AACjB,SAAS,kBAAkB;AAC3B,SAAS,UAAU;;;ACHnB,IAAI,OAAO,aAAa,eAAe,QAAQ,IAAI,aAAa,UAAU,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AAC3I,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,kMAAkM,CAAC;AAC7O,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,iBAAQ,EAAC,cAAa,gCAA+B;;;ACN5D,IAAI,OAAO,aAAa,eAAe,QAAQ,IAAI,aAAa,UAAU,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AAC3I,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,
|
|
3
|
+
"sources": ["../../src/link/link.tsx", "../../src/utils/css/resets.module.css", "../../src/utils/css/focus.module.css", "../../src/link/style.module.css", "../../src/utils/css/global-css-defense.module.css"],
|
|
4
|
+
"sourcesContent": ["import { useRender, mergeProps } from '@base-ui/react';\nimport clsx from 'clsx';\nimport { forwardRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { type LinkProps } from './types';\nimport resetStyles from '../utils/css/resets.module.css';\nimport focusStyles from '../utils/css/focus.module.css';\nimport styles from './style.module.css';\nimport defenseStyles from '../utils/css/global-css-defense.module.css';\n\n/**\n * A styled anchor element with support for semantic color tones and an\n * unstyled escape hatch.\n */\nexport const Link = forwardRef< HTMLAnchorElement, LinkProps >( function Link(\n\t{\n\t\tchildren,\n\t\tvariant = 'default',\n\t\ttone = 'brand',\n\t\topenInNewTab = false,\n\t\trender,\n\t\tclassName,\n\t\tonClick,\n\t\t...props\n\t},\n\tref\n) {\n\tconst isInternalAnchor = !! props.href?.startsWith( '#' );\n\n\tconst handleClick = ( event: React.MouseEvent< HTMLAnchorElement > ) => {\n\t\tif ( openInNewTab && isInternalAnchor ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tonClick?.( event );\n\t};\n\n\tconst element = useRender( {\n\t\trender,\n\t\tdefaultTagName: 'a',\n\t\tref,\n\t\tprops: mergeProps< 'a' >( props, {\n\t\t\tclassName: clsx(\n\t\t\t\tdefenseStyles.a,\n\t\t\t\tresetStyles[ 'box-sizing' ],\n\t\t\t\tfocusStyles[ 'outset-ring--focus' ],\n\t\t\t\tvariant !== 'unstyled' && styles.link,\n\t\t\t\tvariant !== 'unstyled' && styles[ `is-${ tone }` ],\n\t\t\t\tvariant === 'unstyled' && styles[ 'is-unstyled' ],\n\t\t\t\topenInNewTab && styles[ 'has-link-icon' ],\n\t\t\t\tclassName\n\t\t\t),\n\t\t\tonClick: handleClick,\n\t\t\ttarget: openInNewTab ? '_blank' : undefined,\n\t\t\tchildren: openInNewTab ? (\n\t\t\t\t<>\n\t\t\t\t\t<span className={ styles[ 'link-contents' ] }>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ styles[ 'link-icon' ] }\n\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t/* translators: accessibility text appended to link text */\n\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\tchildren\n\t\t\t),\n\t\t} ),\n\t} );\n\n\treturn element;\n} );\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='e3ae230cea']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"e3ae230cea\");\n\tstyle.appendChild(document.createTextNode(\"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"box-sizing\":\"_336cd3e4e743482f__box-sizing\"};\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='2a5ab8f3a7']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"2a5ab8f3a7\");\n\tstyle.appendChild(document.createTextNode(\"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid #0000;outline-offset:1px}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9))}}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"outset-ring--focus\":\"_08e8a2e44959f892__outset-ring--focus\",\"outset-ring--focus-except-active\":\"e25b2bdd7aa21721__outset-ring--focus-except-active\",\"outset-ring--focus-visible\":\"d0541bc9dd9dc7b6__outset-ring--focus-visible\",\"outset-ring--focus-within\":\"cd83dfc2126a0846__outset-ring--focus-within\",\"outset-ring--focus-within-except-active\":\"_970d04df7376df67__outset-ring--focus-within-except-active\",\"outset-ring--focus-within-visible\":\"c5cb3ee4bddaa8e4__outset-ring--focus-within-visible\",\"outset-ring--focus-parent-visible\":\"ecadb9e080e2dfa5__outset-ring--focus-parent-visible\"};\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='f197386fe0']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"f197386fe0\");\n\tstyle.appendChild(document.createTextNode(\"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.d4250949359b05ce__link{text-decoration-thickness:.5px;text-underline-offset:.2em}.c6055659b8e2cd2c__is-brand,.c6055659b8e2cd2c__is-brand:visited{--_gcd-a-color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{--_gcd-a-color:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{--_gcd-a-color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);text-decoration-color:var(--wpds-color-stroke-interactive-neutral,#8a8a8a)}._92e0dfcaeee15b88__is-neutral:active,._92e0dfcaeee15b88__is-neutral:hover{--_gcd-a-color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e);color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}.cf122a9bf1035d42__is-unstyled{--_gcd-a-color:inherit;color:inherit;text-decoration:none}.e6ad7c380ee337fe__has-link-icon{text-decoration:none}._8dc7567f9ff415bf__link-contents{text-decoration:underline;text-decoration-color:inherit;text-decoration-thickness:.5px}._0cb411afac4c86c7__link-icon{font-weight:var(--wpds-font-weight-regular,400);margin-inline-start:var(--wpds-dimension-padding-xs,4px)}._0cb411afac4c86c7__link-icon:after{content:\\\"\\\\2197\\\"}._0cb411afac4c86c7__link-icon:dir(rtl):after{content:\\\"\\\\2196\\\"}}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"link\":\"d4250949359b05ce__link\",\"is-brand\":\"c6055659b8e2cd2c__is-brand\",\"is-neutral\":\"_92e0dfcaeee15b88__is-neutral\",\"is-unstyled\":\"cf122a9bf1035d42__is-unstyled\",\"has-link-icon\":\"e6ad7c380ee337fe__has-link-icon\",\"link-contents\":\"_8dc7567f9ff415bf__link-contents\",\"link-icon\":\"_0cb411afac4c86c7__link-icon\"};\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='3bd1d35622']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"3bd1d35622\");\n\tstyle.appendChild(document.createTextNode(\"._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8a8a8a))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-interactive-neutral-disabled,#8a8a8a))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid #0000)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid #0000);transition:var(--_gcd-a-transition,none)}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"button\":\"_6defc79820e382c6__button\",\"input\":\"d2cff2e5dea83bd1__input\",\"textarea\":\"_547d86373d02e108__textarea\",\"div\":\"_8c15fd0ed9f28ba4__div\",\"p\":\"_43cec3e1eec1066d__p\",\"heading\":\"e97669c6d9a38497__heading\",\"a\":\"_2c0831b0499dbd6e__a\"};\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,WAAW,kBAAkB;AACtC,OAAO,UAAU;AACjB,SAAS,kBAAkB;AAC3B,SAAS,UAAU;;;ACHnB,IAAI,OAAO,aAAa,eAAe,QAAQ,IAAI,aAAa,UAAU,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AAC3I,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,kMAAkM,CAAC;AAC7O,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,iBAAQ,EAAC,cAAa,gCAA+B;;;ACN5D,IAAI,OAAO,aAAa,eAAe,QAAQ,IAAI,aAAa,UAAU,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AAC3I,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,siDAAsiD,CAAC;AACjlD,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,gBAAQ,EAAC,sBAAqB,yCAAwC,oCAAmC,sDAAqD,8BAA6B,gDAA+C,6BAA4B,+CAA8C,2CAA0C,8DAA6D,qCAAoC,uDAAsD,qCAAoC,sDAAqD;;;ACNrlB,IAAI,OAAO,aAAa,eAAe,QAAQ,IAAI,aAAa,UAAU,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AAC3I,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,8nDAAkoD,CAAC;AAC7qD,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,gBAAQ,EAAC,QAAO,0BAAyB,YAAW,8BAA6B,cAAa,iCAAgC,eAAc,iCAAgC,iBAAgB,mCAAkC,iBAAgB,oCAAmC,aAAY,+BAA8B;;;ACNlU,IAAI,OAAO,aAAa,eAAe,QAAQ,IAAI,aAAa,UAAU,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AAC3I,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,gvFAAgvF,CAAC;AAC3xF,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,6BAAQ,EAAC,UAAS,6BAA4B,SAAQ,2BAA0B,YAAW,+BAA8B,OAAM,0BAAyB,KAAI,wBAAuB,WAAU,6BAA4B,KAAI,uBAAsB;;;AJgDtP,mBACC,KADD;AAxCG,IAAM,OAAO,WAA4C,SAASA,MACxE;AAAA,EACC;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GACA,KACC;AACD,QAAM,mBAAmB,CAAC,CAAE,MAAM,MAAM,WAAY,GAAI;AAExD,QAAM,cAAc,CAAE,UAAkD;AACvE,QAAK,gBAAgB,kBAAmB;AACvC,YAAM,eAAe;AAAA,IACtB;AACA,cAAW,KAAM;AAAA,EAClB;AAEA,QAAM,UAAU,UAAW;AAAA,IAC1B;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA,OAAO,WAAmB,OAAO;AAAA,MAChC,WAAW;AAAA,QACV,2BAAc;AAAA,QACd,eAAa,YAAa;AAAA,QAC1B,cAAa,oBAAqB;AAAA,QAClC,YAAY,cAAc,cAAO;AAAA,QACjC,YAAY,cAAc,cAAQ,MAAO,IAAK,EAAG;AAAA,QACjD,YAAY,cAAc,cAAQ,aAAc;AAAA,QAChD,gBAAgB,cAAQ,eAAgB;AAAA,QACxC;AAAA,MACD;AAAA,MACA,SAAS;AAAA,MACT,QAAQ,eAAe,WAAW;AAAA,MAClC,UAAU,eACT,iCACC;AAAA,4BAAC,UAAK,WAAY,cAAQ,eAAgB,GACvC,UACH;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,WAAY,cAAQ,WAAY;AAAA,YAChC,MAAK;AAAA,YACL;AAAA;AAAA,cAEC,GAAI,sBAAuB;AAAA;AAAA;AAAA,QAE7B;AAAA,SACD,IAEA;AAAA,IAEF,CAAE;AAAA,EACH,CAAE;AAEF,SAAO;AACR,CAAE;",
|
|
6
6
|
"names": ["Link"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// packages/ui/src/popover/arrow.tsx
|
|
2
|
+
import { Popover as _Popover } from "@base-ui/react/popover";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { forwardRef } from "@wordpress/element";
|
|
5
|
+
|
|
6
|
+
// packages/ui/src/popover/style.module.css
|
|
7
|
+
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='3b666a02be']")) {
|
|
8
|
+
const style = document.createElement("style");
|
|
9
|
+
style.setAttribute("data-wp-hash", "3b666a02be");
|
|
10
|
+
style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._10450722b9676f78__positioner{z-index:var(--wp-ui-popover-z-index,initial)}._84e8f597bcf683b8__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e0e0e0);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);color:var(--wpds-color-fg-content-neutral,#1e1e1e);font-family:var(--wpds-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-font-size-md,13px);line-height:var(--wpds-font-line-height-md,24px);outline:0;padding:var(--wpds-dimension-padding-lg,16px)}.ca05d3eb89321fcd__arrow{display:flex;&[data-side=top]{bottom:-8px;rotate:180deg}&[data-side=bottom]{rotate:0deg;top:-8px}&[data-side=left]{inset-inline-end:-13px;rotate:90deg}&[data-side=right]{inset-inline-start:-13px;rotate:-90deg}}._12d8edd9eb946b5f__arrow-fill{fill:var(--wpds-color-bg-surface-neutral-strong,#fff)}._6ddab482bd929dad__arrow-stroke{fill:var(--wpds-color-stroke-surface-neutral-weak,#e0e0e0)}._42cb9ed02a2f0782__description{color:var(--wpds-color-fg-content-neutral-weak,#6d6d6d)}.e4d544aa033f05c6__backdrop{background-color:#00000026;inset:0;position:fixed;z-index:var(--wp-ui-popover-z-index,initial)}}'));
|
|
11
|
+
document.head.appendChild(style);
|
|
12
|
+
}
|
|
13
|
+
var style_default = { "positioner": "_10450722b9676f78__positioner", "popup": "_84e8f597bcf683b8__popup", "arrow": "ca05d3eb89321fcd__arrow", "arrow-fill": "_12d8edd9eb946b5f__arrow-fill", "arrow-stroke": "_6ddab482bd929dad__arrow-stroke", "description": "_42cb9ed02a2f0782__description", "backdrop": "e4d544aa033f05c6__backdrop" };
|
|
14
|
+
|
|
15
|
+
// packages/ui/src/popover/arrow.tsx
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
function DefaultArrowSvg(props) {
|
|
18
|
+
return /* @__PURE__ */ jsxs(
|
|
19
|
+
"svg",
|
|
20
|
+
{
|
|
21
|
+
width: "20",
|
|
22
|
+
height: "10",
|
|
23
|
+
viewBox: "0 0 20 10",
|
|
24
|
+
fill: "none",
|
|
25
|
+
...props,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx(
|
|
28
|
+
"path",
|
|
29
|
+
{
|
|
30
|
+
d: "M20 10H0V8h1.465a4 4 0 0 0 2.676-1.027l5.19-4.388c.378-.341.96-.341 1.338 0l5.19 4.388A4 4 0 0 0 18.535 8H20z",
|
|
31
|
+
className: style_default["arrow-fill"]
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
"path",
|
|
36
|
+
{
|
|
37
|
+
d: "M10 3.097 4.81 7.486A5 5 0 0 1 1.465 8.77H0V8h1.465a4 4 0 0 0 2.676-1.027l5.19-4.388c.378-.341.96-.341 1.338 0l5.19 4.388A4 4 0 0 0 18.535 8H20v.77h-1.465a5 5 0 0 1-3.345-1.284z",
|
|
38
|
+
className: style_default["arrow-stroke"]
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
var Arrow = forwardRef(function PopoverArrow({ children, className, ...props }, ref) {
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
_Popover.Arrow,
|
|
48
|
+
{
|
|
49
|
+
ref,
|
|
50
|
+
className: clsx(style_default.arrow, className),
|
|
51
|
+
...props,
|
|
52
|
+
children: children ?? /* @__PURE__ */ jsx(DefaultArrowSvg, {})
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
export {
|
|
57
|
+
Arrow
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=arrow.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/popover/arrow.tsx", "../../src/popover/style.module.css"],
|
|
4
|
+
"sourcesContent": ["import { Popover as _Popover } from '@base-ui/react/popover';\nimport clsx from 'clsx';\nimport { forwardRef } from '@wordpress/element';\nimport styles from './style.module.css';\nimport type { ArrowProps } from './types';\n\nfunction DefaultArrowSvg( props: React.ComponentProps< 'svg' > ) {\n\treturn (\n\t\t<svg\n\t\t\twidth=\"20\"\n\t\t\theight=\"10\"\n\t\t\tviewBox=\"0 0 20 10\"\n\t\t\tfill=\"none\"\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<path\n\t\t\t\td=\"M20 10H0V8h1.465a4 4 0 0 0 2.676-1.027l5.19-4.388c.378-.341.96-.341 1.338 0l5.19 4.388A4 4 0 0 0 18.535 8H20z\"\n\t\t\t\tclassName={ styles[ 'arrow-fill' ] }\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M10 3.097 4.81 7.486A5 5 0 0 1 1.465 8.77H0V8h1.465a4 4 0 0 0 2.676-1.027l5.19-4.388c.378-.341.96-.341 1.338 0l5.19 4.388A4 4 0 0 0 18.535 8H20v.77h-1.465a5 5 0 0 1-3.345-1.284z\"\n\t\t\t\tclassName={ styles[ 'arrow-stroke' ] }\n\t\t\t/>\n\t\t</svg>\n\t);\n}\n\n/**\n * Renders an optional arrow element that points toward the anchor.\n *\n * Must be placed inside `Popover.Popup`. The arrow automatically rotates\n * to match the current placement side.\n */\nconst Arrow = forwardRef< HTMLDivElement, ArrowProps >( function PopoverArrow(\n\t{ children, className, ...props },\n\tref\n) {\n\treturn (\n\t\t<_Popover.Arrow\n\t\t\tref={ ref }\n\t\t\tclassName={ clsx( styles.arrow, className ) }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children ?? <DefaultArrowSvg /> }\n\t\t</_Popover.Arrow>\n\t);\n} );\n\nexport { Arrow };\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='3b666a02be']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"3b666a02be\");\n\tstyle.appendChild(document.createTextNode(\"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._10450722b9676f78__positioner{z-index:var(--wp-ui-popover-z-index,initial)}._84e8f597bcf683b8__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e0e0e0);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);color:var(--wpds-color-fg-content-neutral,#1e1e1e);font-family:var(--wpds-font-family-body,-apple-system,system-ui,\\\"Segoe UI\\\",\\\"Roboto\\\",\\\"Oxygen-Sans\\\",\\\"Ubuntu\\\",\\\"Cantarell\\\",\\\"Helvetica Neue\\\",sans-serif);font-size:var(--wpds-font-size-md,13px);line-height:var(--wpds-font-line-height-md,24px);outline:0;padding:var(--wpds-dimension-padding-lg,16px)}.ca05d3eb89321fcd__arrow{display:flex;&[data-side=top]{bottom:-8px;rotate:180deg}&[data-side=bottom]{rotate:0deg;top:-8px}&[data-side=left]{inset-inline-end:-13px;rotate:90deg}&[data-side=right]{inset-inline-start:-13px;rotate:-90deg}}._12d8edd9eb946b5f__arrow-fill{fill:var(--wpds-color-bg-surface-neutral-strong,#fff)}._6ddab482bd929dad__arrow-stroke{fill:var(--wpds-color-stroke-surface-neutral-weak,#e0e0e0)}._42cb9ed02a2f0782__description{color:var(--wpds-color-fg-content-neutral-weak,#6d6d6d)}.e4d544aa033f05c6__backdrop{background-color:#00000026;inset:0;position:fixed;z-index:var(--wp-ui-popover-z-index,initial)}}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"positioner\":\"_10450722b9676f78__positioner\",\"popup\":\"_84e8f597bcf683b8__popup\",\"arrow\":\"ca05d3eb89321fcd__arrow\",\"arrow-fill\":\"_12d8edd9eb946b5f__arrow-fill\",\"arrow-stroke\":\"_6ddab482bd929dad__arrow-stroke\",\"description\":\"_42cb9ed02a2f0782__description\",\"backdrop\":\"e4d544aa033f05c6__backdrop\"};\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,WAAW,gBAAgB;AACpC,OAAO,UAAU;AACjB,SAAS,kBAAkB;;;ACF3B,IAAI,OAAO,aAAa,eAAe,QAAQ,IAAI,aAAa,UAAU,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AAC3I,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,0+CAAs/C,CAAC;AACjiD,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,gBAAQ,EAAC,cAAa,iCAAgC,SAAQ,4BAA2B,SAAQ,2BAA0B,cAAa,iCAAgC,gBAAe,mCAAkC,eAAc,kCAAiC,YAAW,6BAA4B;;;ADEpT,SAOC,KAPD;AAFF,SAAS,gBAAiB,OAAuC;AAChE,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACH,GAAG;AAAA,MAEL;AAAA;AAAA,UAAC;AAAA;AAAA,YACA,GAAE;AAAA,YACF,WAAY,cAAQ,YAAa;AAAA;AAAA,QAClC;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,GAAE;AAAA,YACF,WAAY,cAAQ,cAAe;AAAA;AAAA,QACpC;AAAA;AAAA;AAAA,EACD;AAEF;AAQA,IAAM,QAAQ,WAA0C,SAAS,aAChE,EAAE,UAAU,WAAW,GAAG,MAAM,GAChC,KACC;AACD,SACC;AAAA,IAAC,SAAS;AAAA,IAAT;AAAA,MACA;AAAA,MACA,WAAY,KAAM,cAAO,OAAO,SAAU;AAAA,MACxC,GAAG;AAAA,MAEH,sBAAY,oBAAC,mBAAgB;AAAA;AAAA,EAChC;AAEF,CAAE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// packages/ui/src/popover/close.tsx
|
|
2
|
+
import { Popover as _Popover } from "@base-ui/react/popover";
|
|
3
|
+
import { forwardRef } from "@wordpress/element";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var Close = forwardRef(
|
|
6
|
+
function PopoverClose(props, ref) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
_Popover.Close,
|
|
9
|
+
{
|
|
10
|
+
ref,
|
|
11
|
+
"data-wp-ui-popover-close": "",
|
|
12
|
+
...props
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
export {
|
|
18
|
+
Close
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=close.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/popover/close.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Popover as _Popover } from '@base-ui/react/popover';\nimport { forwardRef } from '@wordpress/element';\nimport type { CloseProps } from './types';\n\n/**\n * Renders a button that closes the popover when clicked.\n *\n * When the popover opens, initial focus skips this button in favor of\n * the first interactive element inside the popup (unless `initialFocus`\n * on `Popover.Popup` overrides this behavior).\n */\nconst Close = forwardRef< HTMLButtonElement, CloseProps >(\n\tfunction PopoverClose( props, ref ) {\n\t\treturn (\n\t\t\t<_Popover.Close\n\t\t\t\tref={ ref }\n\t\t\t\tdata-wp-ui-popover-close=\"\"\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t}\n);\n\nexport { Close };\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,WAAW,gBAAgB;AACpC,SAAS,kBAAkB;AAaxB;AAHH,IAAM,QAAQ;AAAA,EACb,SAAS,aAAc,OAAO,KAAM;AACnC,WACC;AAAA,MAAC,SAAS;AAAA,MAAT;AAAA,QACA;AAAA,QACA,4BAAyB;AAAA,QACvB,GAAG;AAAA;AAAA,IACN;AAAA,EAEF;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// packages/ui/src/popover/context.tsx
|
|
2
|
+
import {
|
|
3
|
+
createContext,
|
|
4
|
+
useCallback,
|
|
5
|
+
useContext,
|
|
6
|
+
useEffect,
|
|
7
|
+
useMemo,
|
|
8
|
+
useRef
|
|
9
|
+
} from "@wordpress/element";
|
|
10
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
11
|
+
var VALIDATION_ENABLED = process.env.NODE_ENV !== "production";
|
|
12
|
+
var PopoverValidationContext = VALIDATION_ENABLED ? createContext(null) : null;
|
|
13
|
+
function usePopoverValidationContextDev() {
|
|
14
|
+
return useContext(PopoverValidationContext);
|
|
15
|
+
}
|
|
16
|
+
function usePopoverValidationContextProd() {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
var usePopoverValidationContext = VALIDATION_ENABLED ? usePopoverValidationContextDev : usePopoverValidationContextProd;
|
|
20
|
+
function PopoverValidationProviderDev({
|
|
21
|
+
children
|
|
22
|
+
}) {
|
|
23
|
+
const titleElementRef = useRef(null);
|
|
24
|
+
const registerTitle = useCallback((element) => {
|
|
25
|
+
titleElementRef.current = element;
|
|
26
|
+
}, []);
|
|
27
|
+
const contextValue = useMemo(
|
|
28
|
+
() => ({ registerTitle }),
|
|
29
|
+
[registerTitle]
|
|
30
|
+
);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const titleElement = titleElementRef.current;
|
|
33
|
+
if (!titleElement) {
|
|
34
|
+
throw new Error(
|
|
35
|
+
"Popover: Missing <Popover.Title>. For accessibility, every popover requires a title. If needed, the title can be visually hidden but must not be omitted."
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
const textContent = titleElement.textContent?.trim();
|
|
39
|
+
if (!textContent) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
"Popover: <Popover.Title> cannot be empty. Provide meaningful text content for the popover title."
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}, []);
|
|
45
|
+
return /* @__PURE__ */ jsx(PopoverValidationContext.Provider, { value: contextValue, children });
|
|
46
|
+
}
|
|
47
|
+
function PopoverValidationProviderProd({
|
|
48
|
+
children
|
|
49
|
+
}) {
|
|
50
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
51
|
+
}
|
|
52
|
+
var PopoverValidationProvider = VALIDATION_ENABLED ? PopoverValidationProviderDev : PopoverValidationProviderProd;
|
|
53
|
+
export {
|
|
54
|
+
PopoverValidationProvider,
|
|
55
|
+
usePopoverValidationContext
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=context.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/popover/context.tsx"],
|
|
4
|
+
"sourcesContent": ["import {\n\tcreateContext,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n} from '@wordpress/element';\n\n/**\n * Whether validation is enabled. This is a build-time constant that allows\n * bundlers to tree-shake all validation code in production builds.\n */\nconst VALIDATION_ENABLED = process.env.NODE_ENV !== 'production';\n\ntype PopoverValidationContextType = {\n\tregisterTitle: ( element: HTMLElement | null ) => void;\n};\n\nconst PopoverValidationContext = VALIDATION_ENABLED\n\t? createContext< PopoverValidationContextType | null >( null )\n\t: ( null as unknown as React.Context< PopoverValidationContextType | null > );\n\nfunction usePopoverValidationContextDev() {\n\treturn useContext( PopoverValidationContext );\n}\n\nfunction usePopoverValidationContextProd() {\n\treturn null;\n}\n\n/**\n * Hook to access the popover validation context.\n * Returns null in production or if not within a Popover.Popup.\n */\nexport const usePopoverValidationContext = VALIDATION_ENABLED\n\t? usePopoverValidationContextDev\n\t: usePopoverValidationContextProd;\n\n/**\n * Development-only provider that tracks whether Popover.Title is rendered.\n */\nfunction PopoverValidationProviderDev( {\n\tchildren,\n}: {\n\tchildren: React.ReactNode;\n} ) {\n\tconst titleElementRef = useRef< HTMLElement | null >( null );\n\n\tconst registerTitle = useCallback( ( element: HTMLElement | null ) => {\n\t\ttitleElementRef.current = element;\n\t}, [] );\n\n\tconst contextValue = useMemo(\n\t\t() => ( { registerTitle } ),\n\t\t[ registerTitle ]\n\t);\n\n\tuseEffect( () => {\n\t\tconst titleElement = titleElementRef.current;\n\n\t\tif ( ! titleElement ) {\n\t\t\tthrow new Error(\n\t\t\t\t'Popover: Missing <Popover.Title>. ' +\n\t\t\t\t\t'For accessibility, every popover requires a title. ' +\n\t\t\t\t\t'If needed, the title can be visually hidden but must not be omitted.'\n\t\t\t);\n\t\t}\n\n\t\tconst textContent = titleElement.textContent?.trim();\n\t\tif ( ! textContent ) {\n\t\t\tthrow new Error(\n\t\t\t\t'Popover: <Popover.Title> cannot be empty. ' +\n\t\t\t\t\t'Provide meaningful text content for the popover title.'\n\t\t\t);\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<PopoverValidationContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</PopoverValidationContext.Provider>\n\t);\n}\n\nfunction PopoverValidationProviderProd( {\n\tchildren,\n}: {\n\tchildren: React.ReactNode;\n} ) {\n\treturn <>{ children }</>;\n}\n\n/**\n * Provider component that validates Popover.Title presence in development mode.\n * In production, this component is a no-op and just renders children.\n */\nexport const PopoverValidationProvider = VALIDATION_ENABLED\n\t? PopoverValidationProviderDev\n\t: PopoverValidationProviderProd;\n"],
|
|
5
|
+
"mappings": ";AAAA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAwEL,SAWM,UAXN;AAlEF,IAAM,qBAAqB,QAAQ,IAAI,aAAa;AAMpD,IAAM,2BAA2B,qBAC9B,cAAsD,IAAK,IACzD;AAEL,SAAS,iCAAiC;AACzC,SAAO,WAAY,wBAAyB;AAC7C;AAEA,SAAS,kCAAkC;AAC1C,SAAO;AACR;AAMO,IAAM,8BAA8B,qBACxC,iCACA;AAKH,SAAS,6BAA8B;AAAA,EACtC;AACD,GAEI;AACH,QAAM,kBAAkB,OAA8B,IAAK;AAE3D,QAAM,gBAAgB,YAAa,CAAE,YAAiC;AACrE,oBAAgB,UAAU;AAAA,EAC3B,GAAG,CAAC,CAAE;AAEN,QAAM,eAAe;AAAA,IACpB,OAAQ,EAAE,cAAc;AAAA,IACxB,CAAE,aAAc;AAAA,EACjB;AAEA,YAAW,MAAM;AAChB,UAAM,eAAe,gBAAgB;AAErC,QAAK,CAAE,cAAe;AACrB,YAAM,IAAI;AAAA,QACT;AAAA,MAGD;AAAA,IACD;AAEA,UAAM,cAAc,aAAa,aAAa,KAAK;AACnD,QAAK,CAAE,aAAc;AACpB,YAAM,IAAI;AAAA,QACT;AAAA,MAED;AAAA,IACD;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,SACC,oBAAC,yBAAyB,UAAzB,EAAkC,OAAQ,cACxC,UACH;AAEF;AAEA,SAAS,8BAA+B;AAAA,EACvC;AACD,GAEI;AACH,SAAO,gCAAI,UAAU;AACtB;AAMO,IAAM,4BAA4B,qBACtC,+BACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// packages/ui/src/popover/description.tsx
|
|
2
|
+
import { Popover as _Popover } from "@base-ui/react/popover";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { forwardRef } from "@wordpress/element";
|
|
5
|
+
import { Text } from "../text/index.mjs";
|
|
6
|
+
|
|
7
|
+
// packages/ui/src/popover/style.module.css
|
|
8
|
+
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='3b666a02be']")) {
|
|
9
|
+
const style = document.createElement("style");
|
|
10
|
+
style.setAttribute("data-wp-hash", "3b666a02be");
|
|
11
|
+
style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._10450722b9676f78__positioner{z-index:var(--wp-ui-popover-z-index,initial)}._84e8f597bcf683b8__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e0e0e0);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);color:var(--wpds-color-fg-content-neutral,#1e1e1e);font-family:var(--wpds-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-font-size-md,13px);line-height:var(--wpds-font-line-height-md,24px);outline:0;padding:var(--wpds-dimension-padding-lg,16px)}.ca05d3eb89321fcd__arrow{display:flex;&[data-side=top]{bottom:-8px;rotate:180deg}&[data-side=bottom]{rotate:0deg;top:-8px}&[data-side=left]{inset-inline-end:-13px;rotate:90deg}&[data-side=right]{inset-inline-start:-13px;rotate:-90deg}}._12d8edd9eb946b5f__arrow-fill{fill:var(--wpds-color-bg-surface-neutral-strong,#fff)}._6ddab482bd929dad__arrow-stroke{fill:var(--wpds-color-stroke-surface-neutral-weak,#e0e0e0)}._42cb9ed02a2f0782__description{color:var(--wpds-color-fg-content-neutral-weak,#6d6d6d)}.e4d544aa033f05c6__backdrop{background-color:#00000026;inset:0;position:fixed;z-index:var(--wp-ui-popover-z-index,initial)}}'));
|
|
12
|
+
document.head.appendChild(style);
|
|
13
|
+
}
|
|
14
|
+
var style_default = { "positioner": "_10450722b9676f78__positioner", "popup": "_84e8f597bcf683b8__popup", "arrow": "ca05d3eb89321fcd__arrow", "arrow-fill": "_12d8edd9eb946b5f__arrow-fill", "arrow-stroke": "_6ddab482bd929dad__arrow-stroke", "description": "_42cb9ed02a2f0782__description", "backdrop": "e4d544aa033f05c6__backdrop" };
|
|
15
|
+
|
|
16
|
+
// packages/ui/src/popover/description.tsx
|
|
17
|
+
import { jsx } from "react/jsx-runtime";
|
|
18
|
+
var Description = forwardRef(
|
|
19
|
+
function PopoverDescription({ className, children, render, ...props }, ref) {
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
Text,
|
|
22
|
+
{
|
|
23
|
+
ref,
|
|
24
|
+
variant: "body-md",
|
|
25
|
+
render: /* @__PURE__ */ jsx(_Popover.Description, { render, ...props }),
|
|
26
|
+
className: clsx(style_default.description, className),
|
|
27
|
+
children
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
export {
|
|
33
|
+
Description
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=description.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/popover/description.tsx", "../../src/popover/style.module.css"],
|
|
4
|
+
"sourcesContent": ["import { Popover as _Popover } from '@base-ui/react/popover';\nimport clsx from 'clsx';\nimport { forwardRef } from '@wordpress/element';\nimport { Text } from '../text';\nimport styles from './style.module.css';\nimport type { DescriptionProps } from './types';\n\n/**\n * Renders an optional paragraph that describes the popover content.\n *\n * The rendered element is linked to the popup via `aria-describedby`.\n * Uses the `body-md` text variant by default.\n */\nconst Description = forwardRef< HTMLParagraphElement, DescriptionProps >(\n\tfunction PopoverDescription(\n\t\t{ className, children, render, ...props },\n\t\tref\n\t) {\n\t\treturn (\n\t\t\t<Text\n\t\t\t\tref={ ref }\n\t\t\t\tvariant=\"body-md\"\n\t\t\t\trender={\n\t\t\t\t\t<_Popover.Description render={ render } { ...props } />\n\t\t\t\t}\n\t\t\t\tclassName={ clsx( styles.description, className ) }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Text>\n\t\t);\n\t}\n);\n\nexport { Description };\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='3b666a02be']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"3b666a02be\");\n\tstyle.appendChild(document.createTextNode(\"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._10450722b9676f78__positioner{z-index:var(--wp-ui-popover-z-index,initial)}._84e8f597bcf683b8__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e0e0e0);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);color:var(--wpds-color-fg-content-neutral,#1e1e1e);font-family:var(--wpds-font-family-body,-apple-system,system-ui,\\\"Segoe UI\\\",\\\"Roboto\\\",\\\"Oxygen-Sans\\\",\\\"Ubuntu\\\",\\\"Cantarell\\\",\\\"Helvetica Neue\\\",sans-serif);font-size:var(--wpds-font-size-md,13px);line-height:var(--wpds-font-line-height-md,24px);outline:0;padding:var(--wpds-dimension-padding-lg,16px)}.ca05d3eb89321fcd__arrow{display:flex;&[data-side=top]{bottom:-8px;rotate:180deg}&[data-side=bottom]{rotate:0deg;top:-8px}&[data-side=left]{inset-inline-end:-13px;rotate:90deg}&[data-side=right]{inset-inline-start:-13px;rotate:-90deg}}._12d8edd9eb946b5f__arrow-fill{fill:var(--wpds-color-bg-surface-neutral-strong,#fff)}._6ddab482bd929dad__arrow-stroke{fill:var(--wpds-color-stroke-surface-neutral-weak,#e0e0e0)}._42cb9ed02a2f0782__description{color:var(--wpds-color-fg-content-neutral-weak,#6d6d6d)}.e4d544aa033f05c6__backdrop{background-color:#00000026;inset:0;position:fixed;z-index:var(--wp-ui-popover-z-index,initial)}}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"positioner\":\"_10450722b9676f78__positioner\",\"popup\":\"_84e8f597bcf683b8__popup\",\"arrow\":\"ca05d3eb89321fcd__arrow\",\"arrow-fill\":\"_12d8edd9eb946b5f__arrow-fill\",\"arrow-stroke\":\"_6ddab482bd929dad__arrow-stroke\",\"description\":\"_42cb9ed02a2f0782__description\",\"backdrop\":\"e4d544aa033f05c6__backdrop\"};\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,WAAW,gBAAgB;AACpC,OAAO,UAAU;AACjB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;;;ACHrB,IAAI,OAAO,aAAa,eAAe,QAAQ,IAAI,aAAa,UAAU,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AAC3I,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,0+CAAs/C,CAAC;AACjiD,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,gBAAQ,EAAC,cAAa,iCAAgC,SAAQ,4BAA2B,SAAQ,2BAA0B,cAAa,iCAAgC,gBAAe,mCAAkC,eAAc,kCAAiC,YAAW,6BAA4B;;;ADiBjT;AAVL,IAAM,cAAc;AAAA,EACnB,SAAS,mBACR,EAAE,WAAW,UAAU,QAAQ,GAAG,MAAM,GACxC,KACC;AACD,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,SAAQ;AAAA,QACR,QACC,oBAAC,SAAS,aAAT,EAAqB,QAAoB,GAAG,OAAQ;AAAA,QAEtD,WAAY,KAAM,cAAO,aAAa,SAAU;AAAA,QAE9C;AAAA;AAAA,IACH;AAAA,EAEF;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// packages/ui/src/popover/index.ts
|
|
2
|
+
import { Arrow } from "./arrow.mjs";
|
|
3
|
+
import { Close } from "./close.mjs";
|
|
4
|
+
import { Description } from "./description.mjs";
|
|
5
|
+
import { Popup } from "./popup.mjs";
|
|
6
|
+
import { Root } from "./root.mjs";
|
|
7
|
+
import { Title } from "./title.mjs";
|
|
8
|
+
import { Trigger } from "./trigger.mjs";
|
|
9
|
+
export {
|
|
10
|
+
Arrow,
|
|
11
|
+
Close,
|
|
12
|
+
Description,
|
|
13
|
+
Popup,
|
|
14
|
+
Root,
|
|
15
|
+
Title,
|
|
16
|
+
Trigger
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/popover/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { Arrow } from './arrow';\nimport { Close } from './close';\nimport { Description } from './description';\nimport { Popup } from './popup';\nimport { Root } from './root';\nimport { Title } from './title';\nimport { Trigger } from './trigger';\n\nexport { Arrow, Close, Description, Popup, Root, Title, Trigger };\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// packages/ui/src/popover/popup.tsx
|
|
2
|
+
import { Popover as _Popover } from "@base-ui/react/popover";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { forwardRef } from "@wordpress/element";
|
|
5
|
+
import { useMergeRefs } from "@wordpress/compose";
|
|
6
|
+
import {
|
|
7
|
+
privateApis as themePrivateApis
|
|
8
|
+
} from "@wordpress/theme";
|
|
9
|
+
import { unlock } from "../lock-unlock.mjs";
|
|
10
|
+
|
|
11
|
+
// packages/ui/src/utils/css/resets.module.css
|
|
12
|
+
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='e3ae230cea']")) {
|
|
13
|
+
const style = document.createElement("style");
|
|
14
|
+
style.setAttribute("data-wp-hash", "e3ae230cea");
|
|
15
|
+
style.appendChild(document.createTextNode("@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}"));
|
|
16
|
+
document.head.appendChild(style);
|
|
17
|
+
}
|
|
18
|
+
var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
|
|
19
|
+
|
|
20
|
+
// packages/ui/src/popover/popup.tsx
|
|
21
|
+
import { useDeprioritizedInitialFocus } from "../utils/use-deprioritized-initial-focus.mjs";
|
|
22
|
+
import { PopoverValidationProvider } from "./context.mjs";
|
|
23
|
+
|
|
24
|
+
// packages/ui/src/popover/style.module.css
|
|
25
|
+
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='3b666a02be']")) {
|
|
26
|
+
const style = document.createElement("style");
|
|
27
|
+
style.setAttribute("data-wp-hash", "3b666a02be");
|
|
28
|
+
style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._10450722b9676f78__positioner{z-index:var(--wp-ui-popover-z-index,initial)}._84e8f597bcf683b8__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e0e0e0);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);color:var(--wpds-color-fg-content-neutral,#1e1e1e);font-family:var(--wpds-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-font-size-md,13px);line-height:var(--wpds-font-line-height-md,24px);outline:0;padding:var(--wpds-dimension-padding-lg,16px)}.ca05d3eb89321fcd__arrow{display:flex;&[data-side=top]{bottom:-8px;rotate:180deg}&[data-side=bottom]{rotate:0deg;top:-8px}&[data-side=left]{inset-inline-end:-13px;rotate:90deg}&[data-side=right]{inset-inline-start:-13px;rotate:-90deg}}._12d8edd9eb946b5f__arrow-fill{fill:var(--wpds-color-bg-surface-neutral-strong,#fff)}._6ddab482bd929dad__arrow-stroke{fill:var(--wpds-color-stroke-surface-neutral-weak,#e0e0e0)}._42cb9ed02a2f0782__description{color:var(--wpds-color-fg-content-neutral-weak,#6d6d6d)}.e4d544aa033f05c6__backdrop{background-color:#00000026;inset:0;position:fixed;z-index:var(--wp-ui-popover-z-index,initial)}}'));
|
|
29
|
+
document.head.appendChild(style);
|
|
30
|
+
}
|
|
31
|
+
var style_default = { "positioner": "_10450722b9676f78__positioner", "popup": "_84e8f597bcf683b8__popup", "arrow": "ca05d3eb89321fcd__arrow", "arrow-fill": "_12d8edd9eb946b5f__arrow-fill", "arrow-stroke": "_6ddab482bd929dad__arrow-stroke", "description": "_42cb9ed02a2f0782__description", "backdrop": "e4d544aa033f05c6__backdrop" };
|
|
32
|
+
|
|
33
|
+
// packages/ui/src/popover/popup.tsx
|
|
34
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
35
|
+
var ThemeProvider = unlock(themePrivateApis).ThemeProvider;
|
|
36
|
+
var CLOSE_ATTR = "data-wp-ui-popover-close";
|
|
37
|
+
var Popup = forwardRef(function PopoverPopup({
|
|
38
|
+
align = "center",
|
|
39
|
+
alignOffset,
|
|
40
|
+
anchor,
|
|
41
|
+
// Matches the popup's border-radius (--wpds-border-radius-md).
|
|
42
|
+
arrowPadding = 8,
|
|
43
|
+
backdrop = false,
|
|
44
|
+
children,
|
|
45
|
+
className,
|
|
46
|
+
collisionAvoidance,
|
|
47
|
+
collisionBoundary,
|
|
48
|
+
collisionPadding,
|
|
49
|
+
container,
|
|
50
|
+
finalFocus,
|
|
51
|
+
initialFocus,
|
|
52
|
+
side = "bottom",
|
|
53
|
+
sideOffset = 8,
|
|
54
|
+
sticky,
|
|
55
|
+
style,
|
|
56
|
+
variant = "default",
|
|
57
|
+
...props
|
|
58
|
+
}, ref) {
|
|
59
|
+
const { resolvedInitialFocus, popupRef } = useDeprioritizedInitialFocus({
|
|
60
|
+
initialFocus,
|
|
61
|
+
deprioritizedAttribute: CLOSE_ATTR
|
|
62
|
+
});
|
|
63
|
+
const mergedPopupRef = useMergeRefs([ref, popupRef]);
|
|
64
|
+
const backdropElement = backdrop ? /* @__PURE__ */ jsx(_Popover.Backdrop, { className: style_default.backdrop }) : null;
|
|
65
|
+
const positioner = /* @__PURE__ */ jsx(
|
|
66
|
+
_Popover.Positioner,
|
|
67
|
+
{
|
|
68
|
+
align,
|
|
69
|
+
alignOffset,
|
|
70
|
+
anchor,
|
|
71
|
+
arrowPadding,
|
|
72
|
+
collisionAvoidance,
|
|
73
|
+
collisionBoundary,
|
|
74
|
+
collisionPadding,
|
|
75
|
+
side,
|
|
76
|
+
sideOffset,
|
|
77
|
+
sticky,
|
|
78
|
+
style,
|
|
79
|
+
className: clsx(
|
|
80
|
+
resets_default["box-sizing"],
|
|
81
|
+
style_default.positioner,
|
|
82
|
+
className
|
|
83
|
+
),
|
|
84
|
+
children: /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(
|
|
85
|
+
_Popover.Popup,
|
|
86
|
+
{
|
|
87
|
+
ref: mergedPopupRef,
|
|
88
|
+
initialFocus: resolvedInitialFocus,
|
|
89
|
+
finalFocus,
|
|
90
|
+
className: clsx(variant !== "unstyled" && style_default.popup),
|
|
91
|
+
...props,
|
|
92
|
+
children: /* @__PURE__ */ jsx(PopoverValidationProvider, { children })
|
|
93
|
+
}
|
|
94
|
+
) })
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
return /* @__PURE__ */ jsxs(_Popover.Portal, { container, children: [
|
|
98
|
+
backdropElement,
|
|
99
|
+
positioner
|
|
100
|
+
] });
|
|
101
|
+
});
|
|
102
|
+
export {
|
|
103
|
+
Popup
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=popup.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/popover/popup.tsx", "../../src/utils/css/resets.module.css", "../../src/popover/style.module.css"],
|
|
4
|
+
"sourcesContent": ["import { Popover as _Popover } from '@base-ui/react/popover';\nimport clsx from 'clsx';\nimport { forwardRef } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport {\n\ttype ThemeProvider as ThemeProviderType,\n\tprivateApis as themePrivateApis,\n} from '@wordpress/theme';\nimport { unlock } from '../lock-unlock';\nimport resetStyles from '../utils/css/resets.module.css';\nimport { useDeprioritizedInitialFocus } from '../utils/use-deprioritized-initial-focus';\nimport { PopoverValidationProvider } from './context';\nimport styles from './style.module.css';\nimport type { PopupProps } from './types';\n\nconst ThemeProvider: typeof ThemeProviderType =\n\tunlock( themePrivateApis ).ThemeProvider;\n\nconst CLOSE_ATTR = 'data-wp-ui-popover-close';\n\n/**\n * Renders the floating popup container for the popover content.\n *\n * Handles portal rendering, positioning relative to the anchor, collision\n * avoidance, focus management, and optional backdrop. Supply a `container`\n * element for cross-document scenarios such as iframes.\n */\nconst Popup = forwardRef< HTMLDivElement, PopupProps >( function PopoverPopup(\n\t{\n\t\talign = 'center',\n\t\talignOffset,\n\t\tanchor,\n\t\t// Matches the popup's border-radius (--wpds-border-radius-md).\n\t\tarrowPadding = 8,\n\t\tbackdrop = false,\n\t\tchildren,\n\t\tclassName,\n\t\tcollisionAvoidance,\n\t\tcollisionBoundary,\n\t\tcollisionPadding,\n\t\tcontainer,\n\t\tfinalFocus,\n\t\tinitialFocus,\n\t\tside = 'bottom',\n\t\tsideOffset = 8,\n\t\tsticky,\n\t\tstyle,\n\t\tvariant = 'default',\n\t\t...props\n\t},\n\tref\n) {\n\tconst { resolvedInitialFocus, popupRef } = useDeprioritizedInitialFocus( {\n\t\tinitialFocus,\n\t\tdeprioritizedAttribute: CLOSE_ATTR,\n\t} );\n\tconst mergedPopupRef = useMergeRefs( [ ref, popupRef ] );\n\n\tconst backdropElement = backdrop ? (\n\t\t<_Popover.Backdrop className={ styles.backdrop } />\n\t) : null;\n\n\tconst positioner = (\n\t\t<_Popover.Positioner\n\t\t\talign={ align }\n\t\t\talignOffset={ alignOffset }\n\t\t\tanchor={ anchor }\n\t\t\tarrowPadding={ arrowPadding }\n\t\t\tcollisionAvoidance={ collisionAvoidance }\n\t\t\tcollisionBoundary={ collisionBoundary }\n\t\t\tcollisionPadding={ collisionPadding }\n\t\t\tside={ side }\n\t\t\tsideOffset={ sideOffset }\n\t\t\tsticky={ sticky }\n\t\t\tstyle={ style }\n\t\t\tclassName={ clsx(\n\t\t\t\tresetStyles[ 'box-sizing' ],\n\t\t\t\tstyles.positioner,\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<ThemeProvider>\n\t\t\t\t<_Popover.Popup\n\t\t\t\t\tref={ mergedPopupRef }\n\t\t\t\t\tinitialFocus={ resolvedInitialFocus }\n\t\t\t\t\tfinalFocus={ finalFocus }\n\t\t\t\t\tclassName={ clsx( variant !== 'unstyled' && styles.popup ) }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<PopoverValidationProvider>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</PopoverValidationProvider>\n\t\t\t\t</_Popover.Popup>\n\t\t\t</ThemeProvider>\n\t\t</_Popover.Positioner>\n\t);\n\n\treturn (\n\t\t<_Popover.Portal container={ container }>\n\t\t\t{ backdropElement }\n\t\t\t{ positioner }\n\t\t</_Popover.Portal>\n\t);\n} );\n\nexport { Popup };\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='e3ae230cea']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"e3ae230cea\");\n\tstyle.appendChild(document.createTextNode(\"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"box-sizing\":\"_336cd3e4e743482f__box-sizing\"};\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='3b666a02be']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"3b666a02be\");\n\tstyle.appendChild(document.createTextNode(\"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._10450722b9676f78__positioner{z-index:var(--wp-ui-popover-z-index,initial)}._84e8f597bcf683b8__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e0e0e0);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);color:var(--wpds-color-fg-content-neutral,#1e1e1e);font-family:var(--wpds-font-family-body,-apple-system,system-ui,\\\"Segoe UI\\\",\\\"Roboto\\\",\\\"Oxygen-Sans\\\",\\\"Ubuntu\\\",\\\"Cantarell\\\",\\\"Helvetica Neue\\\",sans-serif);font-size:var(--wpds-font-size-md,13px);line-height:var(--wpds-font-line-height-md,24px);outline:0;padding:var(--wpds-dimension-padding-lg,16px)}.ca05d3eb89321fcd__arrow{display:flex;&[data-side=top]{bottom:-8px;rotate:180deg}&[data-side=bottom]{rotate:0deg;top:-8px}&[data-side=left]{inset-inline-end:-13px;rotate:90deg}&[data-side=right]{inset-inline-start:-13px;rotate:-90deg}}._12d8edd9eb946b5f__arrow-fill{fill:var(--wpds-color-bg-surface-neutral-strong,#fff)}._6ddab482bd929dad__arrow-stroke{fill:var(--wpds-color-stroke-surface-neutral-weak,#e0e0e0)}._42cb9ed02a2f0782__description{color:var(--wpds-color-fg-content-neutral-weak,#6d6d6d)}.e4d544aa033f05c6__backdrop{background-color:#00000026;inset:0;position:fixed;z-index:var(--wp-ui-popover-z-index,initial)}}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"positioner\":\"_10450722b9676f78__positioner\",\"popup\":\"_84e8f597bcf683b8__popup\",\"arrow\":\"ca05d3eb89321fcd__arrow\",\"arrow-fill\":\"_12d8edd9eb946b5f__arrow-fill\",\"arrow-stroke\":\"_6ddab482bd929dad__arrow-stroke\",\"description\":\"_42cb9ed02a2f0782__description\",\"backdrop\":\"e4d544aa033f05c6__backdrop\"};\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,WAAW,gBAAgB;AACpC,OAAO,UAAU;AACjB,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B;AAAA,EAEC,eAAe;AAAA,OACT;AACP,SAAS,cAAc;;;ACRvB,IAAI,OAAO,aAAa,eAAe,QAAQ,IAAI,aAAa,UAAU,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AAC3I,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,kMAAkM,CAAC;AAC7O,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,iBAAQ,EAAC,cAAa,gCAA+B;;;ADI5D,SAAS,oCAAoC;AAC7C,SAAS,iCAAiC;;;AEX1C,IAAI,OAAO,aAAa,eAAe,QAAQ,IAAI,aAAa,UAAU,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AAC3I,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,0+CAAs/C,CAAC;AACjiD,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,gBAAQ,EAAC,cAAa,iCAAgC,SAAQ,4BAA2B,SAAQ,2BAA0B,cAAa,iCAAgC,gBAAe,mCAAkC,eAAc,kCAAiC,YAAW,6BAA4B;;;AFqDpT,cAuCA,YAvCA;AA5CF,IAAM,gBACL,OAAQ,gBAAiB,EAAE;AAE5B,IAAM,aAAa;AASnB,IAAM,QAAQ,WAA0C,SAAS,aAChE;AAAA,EACC,QAAQ;AAAA,EACR;AAAA,EACA;AAAA;AAAA,EAEA,eAAe;AAAA,EACf,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACJ,GACA,KACC;AACD,QAAM,EAAE,sBAAsB,SAAS,IAAI,6BAA8B;AAAA,IACxE;AAAA,IACA,wBAAwB;AAAA,EACzB,CAAE;AACF,QAAM,iBAAiB,aAAc,CAAE,KAAK,QAAS,CAAE;AAEvD,QAAM,kBAAkB,WACvB,oBAAC,SAAS,UAAT,EAAkB,WAAY,cAAO,UAAW,IAC9C;AAEJ,QAAM,aACL;AAAA,IAAC,SAAS;AAAA,IAAT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAY;AAAA,QACX,eAAa,YAAa;AAAA,QAC1B,cAAO;AAAA,QACP;AAAA,MACD;AAAA,MAEA,8BAAC,iBACA;AAAA,QAAC,SAAS;AAAA,QAAT;AAAA,UACA,KAAM;AAAA,UACN,cAAe;AAAA,UACf;AAAA,UACA,WAAY,KAAM,YAAY,cAAc,cAAO,KAAM;AAAA,UACvD,GAAG;AAAA,UAEL,8BAAC,6BACE,UACH;AAAA;AAAA,MACD,GACD;AAAA;AAAA,EACD;AAGD,SACC,qBAAC,SAAS,QAAT,EAAgB,WACd;AAAA;AAAA,IACA;AAAA,KACH;AAEF,CAAE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// packages/ui/src/popover/root.tsx
|
|
2
|
+
import { Popover as _Popover } from "@base-ui/react/popover";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
function Root(props) {
|
|
5
|
+
return /* @__PURE__ */ jsx(_Popover.Root, { ...props });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
Root
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=root.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/popover/root.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Popover as _Popover } from '@base-ui/react/popover';\nimport type { RootProps } from './types';\n\n/**\n * An accessible popup anchored to a trigger element.\n *\n * Popover renders ARIA-compliant floating content that appears next to its\n * trigger. It can contain interactive content such as form controls, menus,\n * and rich descriptions.\n *\n * Compose the compound components to build a popover:\n *\n * - `Popover.Root` \u2014 provides open state and context to all sub-components.\n * - `Popover.Trigger` \u2014 the button that toggles the popup.\n * - `Popover.Popup` \u2014 the floating container (portal, positioning, collision\n * avoidance).\n * - `Popover.Arrow` \u2014 an optional arrow pointing toward the anchor.\n * - `Popover.Title` \u2014 **required** heading that labels the popover for\n * accessibility (can be visually hidden).\n * - `Popover.Description` \u2014 optional paragraph linked via `aria-describedby`.\n * - `Popover.Close` \u2014 a button that closes the popover when clicked.\n * **Required** when `modal` is `true` or `'trap-focus'` so that focus\n * can cycle correctly and the user can dismiss the popover.\n *\n * ```jsx\n * <Popover.Root>\n * <Popover.Trigger>Open</Popover.Trigger>\n * <Popover.Popup>\n * <Popover.Arrow />\n * <Popover.Title>Popover title</Popover.Title>\n * <Popover.Description>Popover description</Popover.Description>\n * <Popover.Close>Close</Popover.Close>\n * </Popover.Popup>\n * </Popover.Root>\n * ```\n */\nfunction Root( props: RootProps ) {\n\treturn <_Popover.Root { ...props } />;\n}\n\nexport { Root };\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,WAAW,gBAAgB;AAqC5B;AADR,SAAS,KAAM,OAAmB;AACjC,SAAO,oBAAC,SAAS,MAAT,EAAgB,GAAG,OAAQ;AACpC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// packages/ui/src/popover/title.tsx
|
|
2
|
+
import { Popover as _Popover } from "@base-ui/react/popover";
|
|
3
|
+
import { useMergeRefs } from "@wordpress/compose";
|
|
4
|
+
import { forwardRef, useLayoutEffect, useRef } from "@wordpress/element";
|
|
5
|
+
import { Text } from "../text/index.mjs";
|
|
6
|
+
import { usePopoverValidationContext } from "./context.mjs";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var Title = forwardRef(
|
|
9
|
+
function PopoverTitle({ className, children, render, ...props }, forwardedRef) {
|
|
10
|
+
const validationContext = usePopoverValidationContext();
|
|
11
|
+
const internalRef = useRef(null);
|
|
12
|
+
const mergedRef = useMergeRefs([internalRef, forwardedRef]);
|
|
13
|
+
useLayoutEffect(() => {
|
|
14
|
+
validationContext?.registerTitle(internalRef.current);
|
|
15
|
+
}, [validationContext]);
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
Text,
|
|
18
|
+
{
|
|
19
|
+
ref: mergedRef,
|
|
20
|
+
variant: "heading-xl",
|
|
21
|
+
render: /* @__PURE__ */ jsx(_Popover.Title, { render, ...props }),
|
|
22
|
+
className,
|
|
23
|
+
children
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
export {
|
|
29
|
+
Title
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=title.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/popover/title.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Popover as _Popover } from '@base-ui/react/popover';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useLayoutEffect, useRef } from '@wordpress/element';\nimport { Text } from '../text';\nimport { usePopoverValidationContext } from './context';\nimport type { TitleProps } from './types';\n\n/**\n * Renders a heading that labels the popover for accessibility.\n *\n * **Required** \u2014 every popover must include a `Popover.Title`, even if\n * visually hidden. The rendered element is linked to the popup via\n * `aria-labelledby`. Uses the `heading-xl` text variant, matching Dialog.\n *\n * To visually hide the title while keeping it accessible, wrap it with\n * `VisuallyHidden` using the `render` prop:\n *\n * ```jsx\n * <VisuallyHidden render={ <Popover.Title /> }>\n * Accessible title text\n * </VisuallyHidden>\n * ```\n */\nconst Title = forwardRef< HTMLHeadingElement, TitleProps >(\n\tfunction PopoverTitle(\n\t\t{ className, children, render, ...props },\n\t\tforwardedRef\n\t) {\n\t\tconst validationContext = usePopoverValidationContext();\n\t\tconst internalRef = useRef< HTMLHeadingElement >( null );\n\t\tconst mergedRef = useMergeRefs( [ internalRef, forwardedRef ] );\n\n\t\tuseLayoutEffect( () => {\n\t\t\tvalidationContext?.registerTitle( internalRef.current );\n\t\t}, [ validationContext ] );\n\n\t\treturn (\n\t\t\t<Text\n\t\t\t\tref={ mergedRef }\n\t\t\t\tvariant=\"heading-xl\"\n\t\t\t\trender={ <_Popover.Title render={ render } { ...props } /> }\n\t\t\t\tclassName={ className }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Text>\n\t\t);\n\t}\n);\n\nexport { Title };\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,WAAW,gBAAgB;AACpC,SAAS,oBAAoB;AAC7B,SAAS,YAAY,iBAAiB,cAAc;AACpD,SAAS,YAAY;AACrB,SAAS,mCAAmC;AAoC/B;AAjBb,IAAM,QAAQ;AAAA,EACb,SAAS,aACR,EAAE,WAAW,UAAU,QAAQ,GAAG,MAAM,GACxC,cACC;AACD,UAAM,oBAAoB,4BAA4B;AACtD,UAAM,cAAc,OAA8B,IAAK;AACvD,UAAM,YAAY,aAAc,CAAE,aAAa,YAAa,CAAE;AAE9D,oBAAiB,MAAM;AACtB,yBAAmB,cAAe,YAAY,OAAQ;AAAA,IACvD,GAAG,CAAE,iBAAkB,CAAE;AAEzB,WACC;AAAA,MAAC;AAAA;AAAA,QACA,KAAM;AAAA,QACN,SAAQ;AAAA,QACR,QAAS,oBAAC,SAAS,OAAT,EAAe,QAAoB,GAAG,OAAQ;AAAA,QACxD;AAAA,QAEE;AAAA;AAAA,IACH;AAAA,EAEF;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|