@wordpress/ui 0.11.0 → 0.12.1-next.v.202604201441.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 +24 -0
- package/README.md +4 -4
- package/build/alert-dialog/popup.cjs +4 -4
- package/build/alert-dialog/popup.cjs.map +2 -2
- package/build/collapsible-card/header.cjs +10 -0
- package/build/collapsible-card/header.cjs.map +3 -3
- package/build/dialog/context.cjs +21 -9
- package/build/dialog/context.cjs.map +2 -2
- package/build/dialog/footer.cjs +4 -4
- package/build/dialog/footer.cjs.map +2 -2
- package/build/dialog/header.cjs +4 -4
- package/build/dialog/header.cjs.map +2 -2
- package/build/dialog/popup.cjs +4 -4
- package/build/dialog/popup.cjs.map +2 -2
- package/build/dialog/title.cjs +9 -6
- package/build/dialog/title.cjs.map +2 -2
- package/build/form/primitives/select/item.cjs +3 -3
- package/build/form/primitives/select/item.cjs.map +2 -2
- package/build/form/primitives/select/popup.cjs +3 -3
- package/build/form/primitives/select/popup.cjs.map +2 -2
- package/build/link/link.cjs +8 -18
- package/build/link/link.cjs.map +2 -2
- package/build/link/types.cjs.map +1 -1
- package/build/notice/action-button.cjs +3 -3
- package/build/notice/action-button.cjs.map +2 -2
- package/build/notice/action-link.cjs +8 -7
- package/build/notice/action-link.cjs.map +2 -2
- package/build/notice/actions.cjs +3 -3
- package/build/notice/actions.cjs.map +2 -2
- package/build/notice/close-icon.cjs +3 -3
- package/build/notice/close-icon.cjs.map +2 -2
- package/build/notice/description.cjs +3 -3
- package/build/notice/description.cjs.map +2 -2
- package/build/notice/root.cjs +3 -3
- package/build/notice/root.cjs.map +2 -2
- package/build/notice/title.cjs +3 -3
- package/build/notice/title.cjs.map +2 -2
- package/build/popover/arrow.cjs +4 -4
- package/build/popover/arrow.cjs.map +2 -2
- package/build/popover/context.cjs +21 -9
- package/build/popover/context.cjs.map +2 -2
- package/build/popover/description.cjs +4 -4
- package/build/popover/description.cjs.map +2 -2
- package/build/popover/popup.cjs +8 -5
- package/build/popover/popup.cjs.map +2 -2
- package/build/popover/title.cjs +5 -2
- package/build/popover/title.cjs.map +2 -2
- package/build/tabs/context.cjs +9 -22
- package/build/tabs/context.cjs.map +2 -2
- package/build/tabs/list.cjs +4 -4
- package/build/tabs/list.cjs.map +2 -2
- package/build/tabs/panel.cjs +19 -6
- package/build/tabs/panel.cjs.map +3 -3
- package/build/tabs/tab.cjs +4 -4
- package/build/tabs/tab.cjs.map +2 -2
- package/build/tooltip/popup.cjs +4 -4
- package/build/tooltip/popup.cjs.map +2 -2
- package/build/utils/use-schedule-validation.cjs +59 -0
- package/build/utils/use-schedule-validation.cjs.map +7 -0
- package/build-module/alert-dialog/popup.mjs +4 -4
- package/build-module/alert-dialog/popup.mjs.map +2 -2
- package/build-module/collapsible-card/header.mjs +10 -0
- package/build-module/collapsible-card/header.mjs.map +3 -3
- package/build-module/dialog/context.mjs +21 -9
- package/build-module/dialog/context.mjs.map +2 -2
- package/build-module/dialog/footer.mjs +4 -4
- package/build-module/dialog/footer.mjs.map +2 -2
- package/build-module/dialog/header.mjs +4 -4
- package/build-module/dialog/header.mjs.map +2 -2
- package/build-module/dialog/popup.mjs +4 -4
- package/build-module/dialog/popup.mjs.map +2 -2
- package/build-module/dialog/title.mjs +10 -7
- package/build-module/dialog/title.mjs.map +2 -2
- package/build-module/form/primitives/select/item.mjs +3 -3
- package/build-module/form/primitives/select/item.mjs.map +2 -2
- package/build-module/form/primitives/select/popup.mjs +3 -3
- package/build-module/form/primitives/select/popup.mjs.map +2 -2
- package/build-module/link/link.mjs +8 -18
- package/build-module/link/link.mjs.map +2 -2
- package/build-module/notice/action-button.mjs +3 -3
- package/build-module/notice/action-button.mjs.map +2 -2
- package/build-module/notice/action-link.mjs +8 -7
- package/build-module/notice/action-link.mjs.map +2 -2
- package/build-module/notice/actions.mjs +3 -3
- package/build-module/notice/actions.mjs.map +2 -2
- package/build-module/notice/close-icon.mjs +3 -3
- package/build-module/notice/close-icon.mjs.map +2 -2
- package/build-module/notice/description.mjs +3 -3
- package/build-module/notice/description.mjs.map +2 -2
- package/build-module/notice/root.mjs +3 -3
- package/build-module/notice/root.mjs.map +2 -2
- package/build-module/notice/title.mjs +3 -3
- package/build-module/notice/title.mjs.map +2 -2
- package/build-module/popover/arrow.mjs +4 -4
- package/build-module/popover/arrow.mjs.map +2 -2
- package/build-module/popover/context.mjs +21 -9
- package/build-module/popover/context.mjs.map +2 -2
- package/build-module/popover/description.mjs +4 -4
- package/build-module/popover/description.mjs.map +2 -2
- package/build-module/popover/popup.mjs +8 -5
- package/build-module/popover/popup.mjs.map +2 -2
- package/build-module/popover/title.mjs +6 -3
- package/build-module/popover/title.mjs.map +2 -2
- package/build-module/tabs/context.mjs +11 -24
- package/build-module/tabs/context.mjs.map +2 -2
- package/build-module/tabs/list.mjs +4 -4
- package/build-module/tabs/list.mjs.map +2 -2
- package/build-module/tabs/panel.mjs +19 -6
- package/build-module/tabs/panel.mjs.map +3 -3
- package/build-module/tabs/tab.mjs +4 -4
- package/build-module/tabs/tab.mjs.map +2 -2
- package/build-module/tooltip/popup.mjs +4 -4
- package/build-module/tooltip/popup.mjs.map +2 -2
- package/build-module/utils/use-schedule-validation.mjs +34 -0
- package/build-module/utils/use-schedule-validation.mjs.map +7 -0
- package/build-types/alert-dialog/stories/index.story.d.ts +1 -1
- package/build-types/alert-dialog/stories/index.story.d.ts.map +1 -1
- package/build-types/badge/stories/index.story.d.ts.map +1 -1
- package/build-types/collapsible-card/header.d.ts.map +1 -1
- package/build-types/dialog/context.d.ts +1 -1
- package/build-types/dialog/context.d.ts.map +1 -1
- package/build-types/dialog/title.d.ts.map +1 -1
- package/build-types/empty-state/stories/index.story.d.ts +1 -1
- package/build-types/empty-state/stories/index.story.d.ts.map +1 -1
- package/build-types/form/input-control/stories/index.story.d.ts +1 -1
- package/build-types/form/input-control/stories/index.story.d.ts.map +1 -1
- package/build-types/form/primitives/field/stories/index.story.d.ts +1 -1
- package/build-types/form/primitives/field/stories/index.story.d.ts.map +1 -1
- package/build-types/form/primitives/fieldset/stories/index.story.d.ts +1 -1
- package/build-types/form/primitives/fieldset/stories/index.story.d.ts.map +1 -1
- package/build-types/form/primitives/input/stories/index.story.d.ts +1 -1
- package/build-types/form/primitives/input/stories/index.story.d.ts.map +1 -1
- package/build-types/form/primitives/input-layout/stories/index.story.d.ts +1 -1
- package/build-types/form/primitives/input-layout/stories/index.story.d.ts.map +1 -1
- package/build-types/form/primitives/select/stories/index.story.d.ts +1 -1
- package/build-types/form/primitives/select/stories/index.story.d.ts.map +1 -1
- package/build-types/link/link.d.ts.map +1 -1
- package/build-types/link/types.d.ts +1 -2
- package/build-types/link/types.d.ts.map +1 -1
- package/build-types/notice/action-link.d.ts.map +1 -1
- package/build-types/popover/context.d.ts +1 -1
- package/build-types/popover/context.d.ts.map +1 -1
- package/build-types/popover/popup.d.ts.map +1 -1
- package/build-types/popover/stories/index.story.d.ts +1 -1
- package/build-types/popover/stories/index.story.d.ts.map +1 -1
- package/build-types/popover/title.d.ts.map +1 -1
- package/build-types/stack/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/context.d.ts.map +1 -1
- package/build-types/tabs/panel.d.ts.map +1 -1
- package/build-types/tabs/stories/index.story.d.ts +1 -1
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/text/stories/index.story.d.ts.map +1 -1
- package/build-types/tooltip/stories/index.story.d.ts +1 -1
- package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
- package/build-types/tooltip/stories/usage-guidelines.story.d.ts.map +1 -1
- package/build-types/utils/use-schedule-validation.d.ts +13 -0
- package/build-types/utils/use-schedule-validation.d.ts.map +1 -0
- package/package.json +11 -11
- package/src/alert-dialog/stories/index.story.tsx +2 -2
- package/src/badge/stories/choosing-intent.story.tsx +1 -1
- package/src/badge/stories/index.story.tsx +1 -0
- package/src/collapsible-card/header.tsx +2 -0
- package/src/dialog/context.tsx +28 -15
- package/src/dialog/style.module.css +12 -0
- package/src/dialog/test/index.test.tsx +222 -142
- package/src/dialog/title.tsx +6 -4
- package/src/empty-state/stories/index.story.tsx +2 -1
- package/src/form/input-control/stories/index.story.tsx +4 -1
- package/src/form/primitives/field/stories/index.story.tsx +1 -1
- package/src/form/primitives/fieldset/stories/index.story.tsx +1 -1
- package/src/form/primitives/input/stories/index.story.tsx +2 -1
- package/src/form/primitives/input-layout/stories/index.story.tsx +2 -1
- package/src/form/primitives/select/stories/index.story.tsx +1 -1
- package/src/link/link.tsx +12 -26
- package/src/link/style.module.css +4 -16
- package/src/link/test/index.test.tsx +31 -27
- package/src/link/types.ts +1 -2
- package/src/notice/action-link.tsx +7 -4
- package/src/notice/style.module.css +5 -5
- package/src/popover/context.tsx +28 -12
- package/src/popover/popup.tsx +4 -1
- package/src/popover/stories/index.story.tsx +2 -1
- package/src/popover/style.module.css +23 -1
- package/src/popover/test/index.test.tsx +146 -70
- package/src/popover/title.tsx +6 -3
- package/src/stack/stories/index.story.tsx +1 -0
- package/src/tabs/context.tsx +14 -34
- package/src/tabs/panel.tsx +7 -2
- package/src/tabs/stories/index.story.tsx +2 -1
- package/src/tabs/style.module.css +0 -17
- package/src/tabs/test/index.test.tsx +7 -3
- package/src/text/stories/index.story.tsx +1 -0
- package/src/tooltip/stories/index.story.tsx +2 -1
- package/src/tooltip/stories/usage-guidelines.story.tsx +5 -1
- package/src/tooltip/style.module.css +12 -0
- package/src/utils/css/item-popup.module.css +12 -0
- package/src/utils/use-schedule-validation.ts +45 -0
- package/build/types/css-modules.d.cjs +0 -2
- package/build/types/css-modules.d.cjs.map +0 -7
- package/build/types/react.d.cjs +0 -5
- package/build/types/react.d.cjs.map +0 -7
- package/build-module/types/css-modules.d.mjs +0 -1
- package/build-module/types/css-modules.d.mjs.map +0 -7
- package/build-module/types/react.d.mjs +0 -3
- package/build-module/types/react.d.mjs.map +0 -7
- package/src/types/css-modules.d.ts +0 -4
- package/src/types/react.d.ts +0 -7
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
useMemo,
|
|
8
8
|
useRef
|
|
9
9
|
} from "@wordpress/element";
|
|
10
|
+
import { useScheduleValidation } from "../utils/use-schedule-validation.mjs";
|
|
10
11
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
11
12
|
var VALIDATION_ENABLED = process.env.NODE_ENV !== "production";
|
|
12
13
|
var PopoverValidationContext = VALIDATION_ENABLED ? createContext(null) : null;
|
|
@@ -21,14 +22,7 @@ function PopoverValidationProviderDev({
|
|
|
21
22
|
children
|
|
22
23
|
}) {
|
|
23
24
|
const titleElementRef = useRef(null);
|
|
24
|
-
const
|
|
25
|
-
titleElementRef.current = element;
|
|
26
|
-
}, []);
|
|
27
|
-
const contextValue = useMemo(
|
|
28
|
-
() => ({ registerTitle }),
|
|
29
|
-
[registerTitle]
|
|
30
|
-
);
|
|
31
|
-
useEffect(() => {
|
|
25
|
+
const scheduleValidation = useScheduleValidation(() => {
|
|
32
26
|
const titleElement = titleElementRef.current;
|
|
33
27
|
if (!titleElement) {
|
|
34
28
|
throw new Error(
|
|
@@ -41,7 +35,25 @@ function PopoverValidationProviderDev({
|
|
|
41
35
|
"Popover: <Popover.Title> cannot be empty. Provide meaningful text content for the popover title."
|
|
42
36
|
);
|
|
43
37
|
}
|
|
44
|
-
}
|
|
38
|
+
});
|
|
39
|
+
const registerTitle = useCallback(
|
|
40
|
+
(element) => {
|
|
41
|
+
titleElementRef.current = element;
|
|
42
|
+
scheduleValidation();
|
|
43
|
+
return () => {
|
|
44
|
+
titleElementRef.current = null;
|
|
45
|
+
scheduleValidation();
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
[scheduleValidation]
|
|
49
|
+
);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
scheduleValidation();
|
|
52
|
+
}, [scheduleValidation]);
|
|
53
|
+
const contextValue = useMemo(
|
|
54
|
+
() => ({ registerTitle }),
|
|
55
|
+
[registerTitle]
|
|
56
|
+
);
|
|
45
57
|
return /* @__PURE__ */ jsx(PopoverValidationContext.Provider, { value: contextValue, children });
|
|
46
58
|
}
|
|
47
59
|
function PopoverValidationProviderProd({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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
|
|
5
|
-
"mappings": ";AAAA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;
|
|
4
|
+
"sourcesContent": ["import {\n\tcreateContext,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n} from '@wordpress/element';\nimport { useScheduleValidation } from '../utils/use-schedule-validation';\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 scheduleValidation = useScheduleValidation( () => {\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\tconst registerTitle = useCallback(\n\t\t( element: HTMLElement | null ) => {\n\t\t\ttitleElementRef.current = element;\n\t\t\tscheduleValidation();\n\n\t\t\treturn () => {\n\t\t\t\ttitleElementRef.current = null;\n\t\t\t\tscheduleValidation();\n\t\t\t};\n\t\t},\n\t\t[ scheduleValidation ]\n\t);\n\n\t// Schedule an initial validation on mount to catch missing titles\n\t// (when no Title component is rendered, registerTitle is never called).\n\tuseEffect( () => {\n\t\tscheduleValidation();\n\t}, [ scheduleValidation ] );\n\n\tconst contextValue = useMemo(\n\t\t() => ( { registerTitle } ),\n\t\t[ registerTitle ]\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;AACP,SAAS,6BAA6B;AAuFpC,SAWM,UAXN;AAjFF,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,qBAAqB,sBAAuB,MAAM;AACvD,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,CAAE;AAEF,QAAM,gBAAgB;AAAA,IACrB,CAAE,YAAiC;AAClC,sBAAgB,UAAU;AAC1B,yBAAmB;AAEnB,aAAO,MAAM;AACZ,wBAAgB,UAAU;AAC1B,2BAAmB;AAAA,MACpB;AAAA,IACD;AAAA,IACA,CAAE,kBAAmB;AAAA,EACtB;AAIA,YAAW,MAAM;AAChB,uBAAmB;AAAA,EACpB,GAAG,CAAE,kBAAmB,CAAE;AAE1B,QAAM,eAAe;AAAA,IACpB,OAAQ,EAAE,cAAc;AAAA,IACxB,CAAE,aAAc;AAAA,EACjB;AAEA,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,13 +5,13 @@ import { forwardRef } from "@wordpress/element";
|
|
|
5
5
|
import { Text } from "../text/index.mjs";
|
|
6
6
|
|
|
7
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='
|
|
8
|
+
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='39e546228c']")) {
|
|
9
9
|
const style = document.createElement("style");
|
|
10
|
-
style.setAttribute("data-wp-hash", "
|
|
11
|
-
style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides
|
|
10
|
+
style.setAttribute("data-wp-hash", "39e546228c");
|
|
11
|
+
style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;[data-wpds-theme-provider-id]:has(>._84e8f597bcf683b8__popup){display:block}@layer wp-ui-components{._10450722b9676f78__positioner{z-index:var(--wp-ui-popover-z-index,initial)}._39506c52ee874f3b__default{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,#e4e4e4);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-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-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,#e4e4e4)}._42cb9ed02a2f0782__description{color:var(--wpds-color-fg-content-neutral-weak,#707070)}.e4d544aa033f05c6__backdrop{background-color:#00000026;inset:0;position:fixed;z-index:var(--wp-ui-popover-z-index,initial)}}'));
|
|
12
12
|
document.head.appendChild(style);
|
|
13
13
|
}
|
|
14
|
-
var style_default = { "positioner": "_10450722b9676f78__positioner", "
|
|
14
|
+
var style_default = { "popup": "_84e8f597bcf683b8__popup", "positioner": "_10450722b9676f78__positioner", "default": "_39506c52ee874f3b__default", "arrow": "ca05d3eb89321fcd__arrow", "arrow-fill": "_12d8edd9eb946b5f__arrow-fill", "arrow-stroke": "_6ddab482bd929dad__arrow-stroke", "description": "_42cb9ed02a2f0782__description", "backdrop": "e4d544aa033f05c6__backdrop" };
|
|
15
15
|
|
|
16
16
|
// packages/ui/src/popover/description.tsx
|
|
17
17
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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( { className, children, ...props }, ref ) {\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={ <_Popover.Description { ...props } /> }\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='
|
|
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,
|
|
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( { className, children, ...props }, ref ) {\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={ <_Popover.Description { ...props } /> }\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='39e546228c']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"39e546228c\");\n\tstyle.appendChild(document.createTextNode(\"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;[data-wpds-theme-provider-id]:has(>._84e8f597bcf683b8__popup){display:block}@layer wp-ui-components{._10450722b9676f78__positioner{z-index:var(--wp-ui-popover-z-index,initial)}._39506c52ee874f3b__default{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,#e4e4e4);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-typography-font-family-body,-apple-system,system-ui,\\\"Segoe UI\\\",\\\"Roboto\\\",\\\"Oxygen-Sans\\\",\\\"Ubuntu\\\",\\\"Cantarell\\\",\\\"Helvetica Neue\\\",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-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,#e4e4e4)}._42cb9ed02a2f0782__description{color:var(--wpds-color-fg-content-neutral-weak,#707070)}.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 {\"popup\":\"_84e8f597bcf683b8__popup\",\"positioner\":\"_10450722b9676f78__positioner\",\"default\":\"_39506c52ee874f3b__default\",\"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,olDAAgmD,CAAC;AAC3oD,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,gBAAQ,EAAC,SAAQ,4BAA2B,cAAa,iCAAgC,WAAU,8BAA6B,SAAQ,2BAA0B,cAAa,iCAAgC,gBAAe,mCAAkC,eAAc,kCAAiC,YAAW,6BAA4B;;;ADahV;AANb,IAAM,cAAc;AAAA,EACnB,SAAS,mBAAoB,EAAE,WAAW,UAAU,GAAG,MAAM,GAAG,KAAM;AACrE,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,SAAQ;AAAA,QACR,QAAS,oBAAC,SAAS,aAAT,EAAuB,GAAG,OAAQ;AAAA,QAC5C,WAAY,KAAM,cAAO,aAAa,SAAU;AAAA,QAE9C;AAAA;AAAA,IACH;AAAA,EAEF;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,13 +22,13 @@ import { useDeprioritizedInitialFocus } from "../utils/use-deprioritized-initial
|
|
|
22
22
|
import { PopoverValidationProvider } from "./context.mjs";
|
|
23
23
|
|
|
24
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='
|
|
25
|
+
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='39e546228c']")) {
|
|
26
26
|
const style = document.createElement("style");
|
|
27
|
-
style.setAttribute("data-wp-hash", "
|
|
28
|
-
style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides
|
|
27
|
+
style.setAttribute("data-wp-hash", "39e546228c");
|
|
28
|
+
style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;[data-wpds-theme-provider-id]:has(>._84e8f597bcf683b8__popup){display:block}@layer wp-ui-components{._10450722b9676f78__positioner{z-index:var(--wp-ui-popover-z-index,initial)}._39506c52ee874f3b__default{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,#e4e4e4);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-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-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,#e4e4e4)}._42cb9ed02a2f0782__description{color:var(--wpds-color-fg-content-neutral-weak,#707070)}.e4d544aa033f05c6__backdrop{background-color:#00000026;inset:0;position:fixed;z-index:var(--wp-ui-popover-z-index,initial)}}'));
|
|
29
29
|
document.head.appendChild(style);
|
|
30
30
|
}
|
|
31
|
-
var style_default = { "positioner": "_10450722b9676f78__positioner", "
|
|
31
|
+
var style_default = { "popup": "_84e8f597bcf683b8__popup", "positioner": "_10450722b9676f78__positioner", "default": "_39506c52ee874f3b__default", "arrow": "ca05d3eb89321fcd__arrow", "arrow-fill": "_12d8edd9eb946b5f__arrow-fill", "arrow-stroke": "_6ddab482bd929dad__arrow-stroke", "description": "_42cb9ed02a2f0782__description", "backdrop": "e4d544aa033f05c6__backdrop" };
|
|
32
32
|
|
|
33
33
|
// packages/ui/src/popover/popup.tsx
|
|
34
34
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -87,7 +87,10 @@ var Popup = forwardRef(function PopoverPopup({
|
|
|
87
87
|
ref: mergedPopupRef,
|
|
88
88
|
initialFocus: resolvedInitialFocus,
|
|
89
89
|
finalFocus,
|
|
90
|
-
className: clsx(
|
|
90
|
+
className: clsx(
|
|
91
|
+
style_default.popup,
|
|
92
|
+
variant !== "unstyled" && style_default.default
|
|
93
|
+
),
|
|
91
94
|
...props,
|
|
92
95
|
children: /* @__PURE__ */ jsx(PopoverValidationProvider, { children })
|
|
93
96
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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(
|
|
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,
|
|
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(\n\t\t\t\t\t\tstyles.popup,\n\t\t\t\t\t\tvariant !== 'unstyled' && styles.default\n\t\t\t\t\t) }\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='39e546228c']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"39e546228c\");\n\tstyle.appendChild(document.createTextNode(\"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;[data-wpds-theme-provider-id]:has(>._84e8f597bcf683b8__popup){display:block}@layer wp-ui-components{._10450722b9676f78__positioner{z-index:var(--wp-ui-popover-z-index,initial)}._39506c52ee874f3b__default{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,#e4e4e4);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-typography-font-family-body,-apple-system,system-ui,\\\"Segoe UI\\\",\\\"Roboto\\\",\\\"Oxygen-Sans\\\",\\\"Ubuntu\\\",\\\"Cantarell\\\",\\\"Helvetica Neue\\\",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-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,#e4e4e4)}._42cb9ed02a2f0782__description{color:var(--wpds-color-fg-content-neutral-weak,#707070)}.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 {\"popup\":\"_84e8f597bcf683b8__popup\",\"positioner\":\"_10450722b9676f78__positioner\",\"default\":\"_39506c52ee874f3b__default\",\"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,olDAAgmD,CAAC;AAC3oD,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,gBAAQ,EAAC,SAAQ,4BAA2B,cAAa,iCAAgC,WAAU,8BAA6B,SAAQ,2BAA0B,cAAa,iCAAgC,gBAAe,mCAAkC,eAAc,kCAAiC,YAAW,6BAA4B;;;AFqD3V,cA0CA,YA1CA;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;AAAA,YACX,cAAO;AAAA,YACP,YAAY,cAAc,cAAO;AAAA,UAClC;AAAA,UACE,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// packages/ui/src/popover/title.tsx
|
|
2
2
|
import { Popover as _Popover } from "@base-ui/react/popover";
|
|
3
3
|
import { useMergeRefs } from "@wordpress/compose";
|
|
4
|
-
import { forwardRef,
|
|
4
|
+
import { forwardRef, useEffect, useRef } from "@wordpress/element";
|
|
5
5
|
import { Text } from "../text/index.mjs";
|
|
6
6
|
import { usePopoverValidationContext } from "./context.mjs";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -10,8 +10,11 @@ var Title = forwardRef(
|
|
|
10
10
|
const validationContext = usePopoverValidationContext();
|
|
11
11
|
const internalRef = useRef(null);
|
|
12
12
|
const mergedRef = useMergeRefs([internalRef, forwardedRef]);
|
|
13
|
-
|
|
14
|
-
validationContext
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (validationContext) {
|
|
15
|
+
return validationContext.registerTitle(internalRef.current);
|
|
16
|
+
}
|
|
17
|
+
return void 0;
|
|
15
18
|
}, [validationContext]);
|
|
16
19
|
return /* @__PURE__ */ jsx(
|
|
17
20
|
Text,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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,
|
|
5
|
-
"mappings": ";AAAA,SAAS,WAAW,gBAAgB;AACpC,SAAS,oBAAoB;AAC7B,SAAS,YAAY,
|
|
4
|
+
"sourcesContent": ["import { Popover as _Popover } from '@base-ui/react/popover';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useEffect, 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( { className, children, ...props }, forwardedRef ) {\n\t\tconst validationContext = usePopoverValidationContext();\n\t\tconst internalRef = useRef< HTMLHeadingElement >( null );\n\t\tconst mergedRef = useMergeRefs( [ internalRef, forwardedRef ] );\n\n\t\tuseEffect( () => {\n\t\t\tif ( validationContext ) {\n\t\t\t\treturn validationContext.registerTitle( internalRef.current );\n\t\t\t}\n\t\t\treturn undefined;\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 { ...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,WAAW,cAAc;AAC9C,SAAS,YAAY;AACrB,SAAS,mCAAmC;AAoC/B;AAjBb,IAAM,QAAQ;AAAA,EACb,SAAS,aAAc,EAAE,WAAW,UAAU,GAAG,MAAM,GAAG,cAAe;AACxE,UAAM,oBAAoB,4BAA4B;AACtD,UAAM,cAAc,OAA8B,IAAK;AACvD,UAAM,YAAY,aAAc,CAAE,aAAa,YAAa,CAAE;AAE9D,cAAW,MAAM;AAChB,UAAK,mBAAoB;AACxB,eAAO,kBAAkB,cAAe,YAAY,OAAQ;AAAA,MAC7D;AACA,aAAO;AAAA,IACR,GAAG,CAAE,iBAAkB,CAAE;AAEzB,WACC;AAAA,MAAC;AAAA;AAAA,QACA,KAAM;AAAA,QACN,SAAQ;AAAA,QACR,QAAS,oBAAC,SAAS,OAAT,EAAiB,GAAG,OAAQ;AAAA,QACtC;AAAA,QAEE;AAAA;AAAA,IACH;AAAA,EAEF;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,10 +3,11 @@ import {
|
|
|
3
3
|
createContext,
|
|
4
4
|
useContext,
|
|
5
5
|
useCallback,
|
|
6
|
+
useEffect,
|
|
6
7
|
useMemo,
|
|
7
|
-
useRef
|
|
8
|
-
useEffect
|
|
8
|
+
useRef
|
|
9
9
|
} from "@wordpress/element";
|
|
10
|
+
import { useScheduleValidation } from "../utils/use-schedule-validation.mjs";
|
|
10
11
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
11
12
|
var VALIDATION_ENABLED = process.env.NODE_ENV !== "production";
|
|
12
13
|
var TabsValidationContext = VALIDATION_ENABLED ? createContext(null) : null;
|
|
@@ -39,22 +40,15 @@ function TabsValidationProviderDev({
|
|
|
39
40
|
}) {
|
|
40
41
|
const tabCountRef = useRef(0);
|
|
41
42
|
const panelCountRef = useRef(0);
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const scheduleValidation = useScheduleValidation(() => {
|
|
44
|
+
const tabCount = tabCountRef.current;
|
|
45
|
+
const panelCount = panelCountRef.current;
|
|
46
|
+
if (tabCount !== panelCount) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
`Tabs: Tab/Panel count mismatch (${tabCount} Tabs, ${panelCount} Panels). Each Tab must be associated with exactly one Panel. Mismatched or missing associations can break screen reader navigation and violate WAI-ARIA Tabs pattern requirements.`
|
|
49
|
+
);
|
|
46
50
|
}
|
|
47
|
-
|
|
48
|
-
const tabCount = tabCountRef.current;
|
|
49
|
-
const panelCount = panelCountRef.current;
|
|
50
|
-
if (tabCount !== panelCount) {
|
|
51
|
-
throw new Error(
|
|
52
|
-
`Tabs: Tab/Panel count mismatch (${tabCount} Tabs, ${panelCount} Panels). Each Tab must be associated with exactly one Panel. Mismatched or missing associations can break screen reader navigation and violate WAI-ARIA Tabs pattern requirements.`
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
validationScheduledRef.current = null;
|
|
56
|
-
}, 0);
|
|
57
|
-
}, []);
|
|
51
|
+
});
|
|
58
52
|
const registerTab = useCallback(() => {
|
|
59
53
|
tabCountRef.current += 1;
|
|
60
54
|
scheduleValidation();
|
|
@@ -71,13 +65,6 @@ function TabsValidationProviderDev({
|
|
|
71
65
|
scheduleValidation();
|
|
72
66
|
};
|
|
73
67
|
}, [scheduleValidation]);
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
return () => {
|
|
76
|
-
if (validationScheduledRef.current) {
|
|
77
|
-
clearTimeout(validationScheduledRef.current);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}, []);
|
|
81
68
|
const contextValue = useMemo(
|
|
82
69
|
() => ({
|
|
83
70
|
registerTab,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tabs/context.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n\tcreateContext,\n\tuseContext,\n\tuseCallback,\n\
|
|
5
|
-
"mappings": ";AAAA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;
|
|
4
|
+
"sourcesContent": ["import {\n\tcreateContext,\n\tuseContext,\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n} from '@wordpress/element';\nimport { useScheduleValidation } from '../utils/use-schedule-validation';\n\ntype TabsValidationContextType = {\n\tregisterTab: () => () => void;\n\tregisterPanel: () => () => void;\n};\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\nconst TabsValidationContext = VALIDATION_ENABLED\n\t? createContext< TabsValidationContextType | null >( null )\n\t: ( null as unknown as React.Context< TabsValidationContextType | null > );\n\nfunction useRegisterTabDev() {\n\tconst context = useContext( TabsValidationContext );\n\n\tuseEffect( () => {\n\t\tif ( context ) {\n\t\t\treturn context.registerTab();\n\t\t}\n\t\treturn undefined;\n\t}, [ context ] );\n}\n\nfunction useRegisterTabProd() {\n\t// No-op in production.\n}\n\n/**\n * Hook that registers a Tab for count validation in development mode.\n */\nexport const useRegisterTab = VALIDATION_ENABLED\n\t? useRegisterTabDev\n\t: useRegisterTabProd;\n\nfunction useRegisterPanelDev() {\n\tconst context = useContext( TabsValidationContext );\n\n\tuseEffect( () => {\n\t\tif ( context ) {\n\t\t\treturn context.registerPanel();\n\t\t}\n\t\treturn undefined;\n\t}, [ context ] );\n}\n\nfunction useRegisterPanelProd() {\n\t// No-op in production.\n}\n\n/**\n * Hook that registers a Panel for count validation in development mode.\n */\nexport const useRegisterPanel = VALIDATION_ENABLED\n\t? useRegisterPanelDev\n\t: useRegisterPanelProd;\n\n/**\n * Development-only provider that tracks the number of registered tabs and\n * panels, and warns when the counts don't match.\n */\nfunction TabsValidationProviderDev( {\n\tchildren,\n}: {\n\tchildren: React.ReactNode;\n} ) {\n\tconst tabCountRef = useRef( 0 );\n\tconst panelCountRef = useRef( 0 );\n\n\tconst scheduleValidation = useScheduleValidation( () => {\n\t\tconst tabCount = tabCountRef.current;\n\t\tconst panelCount = panelCountRef.current;\n\n\t\tif ( tabCount !== panelCount ) {\n\t\t\tthrow new Error(\n\t\t\t\t`Tabs: Tab/Panel count mismatch (${ tabCount } Tabs, ${ panelCount } Panels). ` +\n\t\t\t\t\t`Each Tab must be associated with exactly one Panel. ` +\n\t\t\t\t\t`Mismatched or missing associations can break screen reader navigation ` +\n\t\t\t\t\t`and violate WAI-ARIA Tabs pattern requirements.`\n\t\t\t);\n\t\t}\n\t} );\n\n\tconst registerTab = useCallback( () => {\n\t\ttabCountRef.current += 1;\n\t\tscheduleValidation();\n\n\t\treturn () => {\n\t\t\ttabCountRef.current -= 1;\n\t\t\tscheduleValidation();\n\t\t};\n\t}, [ scheduleValidation ] );\n\n\tconst registerPanel = useCallback( () => {\n\t\tpanelCountRef.current += 1;\n\t\tscheduleValidation();\n\n\t\treturn () => {\n\t\t\tpanelCountRef.current -= 1;\n\t\t\tscheduleValidation();\n\t\t};\n\t}, [ scheduleValidation ] );\n\n\tconst contextValue = useMemo(\n\t\t() => ( {\n\t\t\tregisterTab,\n\t\t\tregisterPanel,\n\t\t} ),\n\t\t[ registerTab, registerPanel ]\n\t);\n\n\treturn (\n\t\t<TabsValidationContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</TabsValidationContext.Provider>\n\t);\n}\n\n/**\n * Production no-op provider that just renders children.\n */\nfunction TabsValidationProviderProd( {\n\tchildren,\n}: {\n\tchildren: React.ReactNode;\n} ) {\n\treturn <>{ children }</>;\n}\n\n/**\n * Provider component that validates the number of tabs matches the number\n * of panels in development mode.\n *\n * In production, this component is a no-op and just renders children.\n */\nexport const TabsValidationProvider = VALIDATION_ENABLED\n\t? TabsValidationProviderDev\n\t: TabsValidationProviderProd;\n"],
|
|
5
|
+
"mappings": ";AAAA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,6BAA6B;AAoHpC,SAcM,UAdN;AAzGF,IAAM,qBAAqB,QAAQ,IAAI,aAAa;AAEpD,IAAM,wBAAwB,qBAC3B,cAAmD,IAAK,IACtD;AAEL,SAAS,oBAAoB;AAC5B,QAAM,UAAU,WAAY,qBAAsB;AAElD,YAAW,MAAM;AAChB,QAAK,SAAU;AACd,aAAO,QAAQ,YAAY;AAAA,IAC5B;AACA,WAAO;AAAA,EACR,GAAG,CAAE,OAAQ,CAAE;AAChB;AAEA,SAAS,qBAAqB;AAE9B;AAKO,IAAM,iBAAiB,qBAC3B,oBACA;AAEH,SAAS,sBAAsB;AAC9B,QAAM,UAAU,WAAY,qBAAsB;AAElD,YAAW,MAAM;AAChB,QAAK,SAAU;AACd,aAAO,QAAQ,cAAc;AAAA,IAC9B;AACA,WAAO;AAAA,EACR,GAAG,CAAE,OAAQ,CAAE;AAChB;AAEA,SAAS,uBAAuB;AAEhC;AAKO,IAAM,mBAAmB,qBAC7B,sBACA;AAMH,SAAS,0BAA2B;AAAA,EACnC;AACD,GAEI;AACH,QAAM,cAAc,OAAQ,CAAE;AAC9B,QAAM,gBAAgB,OAAQ,CAAE;AAEhC,QAAM,qBAAqB,sBAAuB,MAAM;AACvD,UAAM,WAAW,YAAY;AAC7B,UAAM,aAAa,cAAc;AAEjC,QAAK,aAAa,YAAa;AAC9B,YAAM,IAAI;AAAA,QACT,mCAAoC,QAAS,UAAW,UAAW;AAAA,MAIpE;AAAA,IACD;AAAA,EACD,CAAE;AAEF,QAAM,cAAc,YAAa,MAAM;AACtC,gBAAY,WAAW;AACvB,uBAAmB;AAEnB,WAAO,MAAM;AACZ,kBAAY,WAAW;AACvB,yBAAmB;AAAA,IACpB;AAAA,EACD,GAAG,CAAE,kBAAmB,CAAE;AAE1B,QAAM,gBAAgB,YAAa,MAAM;AACxC,kBAAc,WAAW;AACzB,uBAAmB;AAEnB,WAAO,MAAM;AACZ,oBAAc,WAAW;AACzB,yBAAmB;AAAA,IACpB;AAAA,EACD,GAAG,CAAE,kBAAmB,CAAE;AAE1B,QAAM,eAAe;AAAA,IACpB,OAAQ;AAAA,MACP;AAAA,MACA;AAAA,IACD;AAAA,IACA,CAAE,aAAa,aAAc;AAAA,EAC9B;AAEA,SACC,oBAAC,sBAAsB,UAAtB,EAA+B,OAAQ,cACrC,UACH;AAEF;AAKA,SAAS,2BAA4B;AAAA,EACpC;AACD,GAEI;AACH,SAAO,gCAAI,UAAU;AACtB;AAQO,IAAM,yBAAyB,qBACnC,4BACA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,13 +5,13 @@ import { Tabs as _Tabs } from "@base-ui/react/tabs";
|
|
|
5
5
|
import { useMergeRefs } from "@wordpress/compose";
|
|
6
6
|
|
|
7
7
|
// packages/ui/src/tabs/style.module.css
|
|
8
|
-
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='
|
|
8
|
+
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='b8cf8136a5']")) {
|
|
9
9
|
const style = document.createElement("style");
|
|
10
|
-
style.setAttribute("data-wp-hash", "
|
|
11
|
-
style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._7313adbc8a112e90__tablist{--direction-factor:1;--direction-start:left;--direction-end:right;align-items:stretch;display:flex;overflow-inline:auto;overscroll-behavior-inline:none;position:relative;&:dir(rtl){--direction-factor:-1;--direction-start:right;--direction-end:left}&[data-orientation=horizontal]{--fade-width:4rem;--fade-gradient-base:#0000 0%,#000 var(--fade-width);--fade-gradient-composed:var(--fade-gradient-base),#000 60%,#0000 50%;width:fit-content;&._9f2ac729c68a735a__is-overflowing-first{mask-image:linear-gradient(to var(--direction-end),var(--fade-gradient-base))}&._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to var(--direction-start),var(--fade-gradient-base))}&._9f2ac729c68a735a__is-overflowing-first._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to right,var(--fade-gradient-composed)),linear-gradient(to left,var(--fade-gradient-composed))}&._59228b5227f38a99__is-minimal-variant{gap:1rem}}&[data-orientation=vertical]{flex-direction:column}}._1c37dcfaa1ad8cda__indicator{@media not (prefers-reduced-motion){transition-duration:.2s;transition-property:translate,width,height,border-radius,border-block;transition-timing-function:ease-out}outline:2px solid #0000;outline-offset:-1px;pointer-events:none;position:absolute;&[data-orientation=horizontal]{background-color:var(--wpds-color-stroke-interactive-neutral-strong,#6e6e6e);bottom:0;height:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px));left:0;translate:var(--active-tab-left) 0;width:var(--active-tab-width);z-index:1}&[data-orientation=vertical]{background-color:var(--wpds-color-bg-interactive-neutral-weak-active,#ededed);border-radius:var(--wpds-border-radius-sm,2px);height:var(--active-tab-height);left:50%;top:0;translate:-50% var(--active-tab-top);width:100%;z-index:0}._7313adbc8a112e90__tablist[data-select-on-move=true]:has(:focus-visible)\n &[data-orientation=vertical]{border: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));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:#0000;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;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));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:40px;padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]\n [role=tab]:is([aria-selected=true])\n &{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}
|
|
10
|
+
style.setAttribute("data-wp-hash", "b8cf8136a5");
|
|
11
|
+
style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._7313adbc8a112e90__tablist{--direction-factor:1;--direction-start:left;--direction-end:right;align-items:stretch;display:flex;overflow-inline:auto;overscroll-behavior-inline:none;position:relative;&:dir(rtl){--direction-factor:-1;--direction-start:right;--direction-end:left}&[data-orientation=horizontal]{--fade-width:4rem;--fade-gradient-base:#0000 0%,#000 var(--fade-width);--fade-gradient-composed:var(--fade-gradient-base),#000 60%,#0000 50%;width:fit-content;&._9f2ac729c68a735a__is-overflowing-first{mask-image:linear-gradient(to var(--direction-end),var(--fade-gradient-base))}&._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to var(--direction-start),var(--fade-gradient-base))}&._9f2ac729c68a735a__is-overflowing-first._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to right,var(--fade-gradient-composed)),linear-gradient(to left,var(--fade-gradient-composed))}&._59228b5227f38a99__is-minimal-variant{gap:1rem}}&[data-orientation=vertical]{flex-direction:column}}._1c37dcfaa1ad8cda__indicator{@media not (prefers-reduced-motion){transition-duration:.2s;transition-property:translate,width,height,border-radius,border-block;transition-timing-function:ease-out}outline:2px solid #0000;outline-offset:-1px;pointer-events:none;position:absolute;&[data-orientation=horizontal]{background-color:var(--wpds-color-stroke-interactive-neutral-strong,#6e6e6e);bottom:0;height:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px));left:0;translate:var(--active-tab-left) 0;width:var(--active-tab-width);z-index:1}&[data-orientation=vertical]{background-color:var(--wpds-color-bg-interactive-neutral-weak-active,#ededed);border-radius:var(--wpds-border-radius-sm,2px);height:var(--active-tab-height);left:50%;top:0;translate:-50% var(--active-tab-top);width:100%;z-index:0}._7313adbc8a112e90__tablist[data-select-on-move=true]:has(:focus-visible)\n &[data-orientation=vertical]{border: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));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:#0000;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;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));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:40px;padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]\n [role=tab]:is([aria-selected=true])\n &{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}'));
|
|
12
12
|
document.head.appendChild(style);
|
|
13
13
|
}
|
|
14
|
-
var style_default = { "tablist": "_7313adbc8a112e90__tablist", "is-overflowing-first": "_9f2ac729c68a735a__is-overflowing-first", "is-overflowing-last": "_81c799c1f3cdd261__is-overflowing-last", "is-minimal-variant": "_59228b5227f38a99__is-minimal-variant", "indicator": "_1c37dcfaa1ad8cda__indicator", "tab": "a5fd8814f195aa5e__tab", "tab-children": "_5dfc77e6edd345d4__tab-children", "tab-chevron": "_4a20e969d15e5ac1__tab-chevron"
|
|
14
|
+
var style_default = { "tablist": "_7313adbc8a112e90__tablist", "is-overflowing-first": "_9f2ac729c68a735a__is-overflowing-first", "is-overflowing-last": "_81c799c1f3cdd261__is-overflowing-last", "is-minimal-variant": "_59228b5227f38a99__is-minimal-variant", "indicator": "_1c37dcfaa1ad8cda__indicator", "tab": "a5fd8814f195aa5e__tab", "tab-children": "_5dfc77e6edd345d4__tab-children", "tab-chevron": "_4a20e969d15e5ac1__tab-chevron" };
|
|
15
15
|
|
|
16
16
|
// packages/ui/src/tabs/list.tsx
|
|
17
17
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tabs/list.tsx", "../../src/tabs/style.module.css"],
|
|
4
|
-
"sourcesContent": ["import { forwardRef, useEffect, useState } from '@wordpress/element';\nimport clsx from 'clsx';\nimport { Tabs as _Tabs } from '@base-ui/react/tabs';\nimport { useMergeRefs } from '@wordpress/compose';\nimport styles from './style.module.css';\nimport type { TabListProps } from './types';\n\n// Account for sub-pixel rounding errors.\nconst SCROLL_EPSILON = 1;\n\n/**\n * Groups the individual tab buttons.\n *\n * `Tabs` is a collection of React components that combine to render\n * an [ARIA-compliant tabs pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/).\n */\nexport const List = forwardRef< HTMLDivElement, TabListProps >(\n\tfunction TabList(\n\t\t{\n\t\t\tchildren,\n\t\t\tvariant = 'default',\n\t\t\tclassName,\n\t\t\tactivateOnFocus,\n\t\t\t...otherProps\n\t\t},\n\t\tforwardedRef\n\t) {\n\t\tconst [ listEl, setListEl ] = useState< HTMLDivElement | null >( null );\n\t\tconst [ overflow, setOverflow ] = useState< {\n\t\t\tfirst: boolean;\n\t\t\tlast: boolean;\n\t\t\tisScrolling: boolean;\n\t\t} >( {\n\t\t\tfirst: false,\n\t\t\tlast: false,\n\t\t\tisScrolling: false,\n\t\t} );\n\n\t\t// Check if list is overflowing when it scrolls or resizes.\n\t\tuseEffect( () => {\n\t\t\tif ( ! listEl ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst measureOverflow = () => {\n\t\t\t\tconst { scrollWidth, clientWidth, scrollLeft } = listEl;\n\t\t\t\tconst maxScroll = Math.max( scrollWidth - clientWidth, 0 );\n\t\t\t\tconst direction =\n\t\t\t\t\tlistEl.dir ||\n\t\t\t\t\t( typeof window !== 'undefined'\n\t\t\t\t\t\t? window.getComputedStyle( listEl ).direction\n\t\t\t\t\t\t: 'ltr' );\n\n\t\t\t\tconst scrollFromStart =\n\t\t\t\t\tdirection === 'rtl' && scrollLeft < 0\n\t\t\t\t\t\t? // In RTL layouts, scrollLeft is typically 0 at the visual \"start\"\n\t\t\t\t\t\t // (right edge) and becomes negative toward the \"end\" (left edge).\n\t\t\t\t\t\t // Normalize value for correct first/last detection logic.\n\t\t\t\t\t\t -scrollLeft\n\t\t\t\t\t\t: scrollLeft;\n\n\t\t\t\t// Use SCROLL_EPSILON to handle subpixel rendering differences.\n\t\t\t\tsetOverflow( {\n\t\t\t\t\tfirst: scrollFromStart > SCROLL_EPSILON,\n\t\t\t\t\tlast: scrollFromStart < maxScroll - SCROLL_EPSILON,\n\t\t\t\t\tisScrolling: scrollWidth > clientWidth,\n\t\t\t\t} );\n\t\t\t};\n\n\t\t\tconst resizeObserver = new ResizeObserver( measureOverflow );\n\t\t\tresizeObserver.observe( listEl );\n\n\t\t\tlet scrollTick = false;\n\t\t\tconst throttleMeasureOverflowOnScroll = () => {\n\t\t\t\tif ( ! scrollTick ) {\n\t\t\t\t\trequestAnimationFrame( () => {\n\t\t\t\t\t\tmeasureOverflow();\n\t\t\t\t\t\tscrollTick = false;\n\t\t\t\t\t} );\n\t\t\t\t\tscrollTick = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\tlistEl.addEventListener(\n\t\t\t\t'scroll',\n\t\t\t\tthrottleMeasureOverflowOnScroll,\n\t\t\t\t{ passive: true }\n\t\t\t);\n\n\t\t\t// Initial check.\n\t\t\tmeasureOverflow();\n\n\t\t\treturn () => {\n\t\t\t\tlistEl.removeEventListener(\n\t\t\t\t\t'scroll',\n\t\t\t\t\tthrottleMeasureOverflowOnScroll\n\t\t\t\t);\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t};\n\t\t}, [ listEl ] );\n\n\t\tconst mergedListRef = useMergeRefs( [\n\t\t\tforwardedRef,\n\t\t\t( el: HTMLDivElement | null ) => setListEl( el ),\n\t\t] );\n\n\t\treturn (\n\t\t\t<_Tabs.List\n\t\t\t\tref={ mergedListRef }\n\t\t\t\tactivateOnFocus={ activateOnFocus }\n\t\t\t\tdata-select-on-move={ activateOnFocus ? 'true' : 'false' }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles.tablist,\n\t\t\t\t\toverflow.first && styles[ 'is-overflowing-first' ],\n\t\t\t\t\toverflow.last && styles[ 'is-overflowing-last' ],\n\t\t\t\t\tstyles[ `is-${ variant }-variant` ],\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\t{ ...otherProps }\n\t\t\t\ttabIndex={\n\t\t\t\t\totherProps.tabIndex ??\n\t\t\t\t\t( overflow.isScrolling ? -1 : undefined )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t\t<_Tabs.Indicator className={ styles.indicator } />\n\t\t\t</_Tabs.List>\n\t\t);\n\t}\n);\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='
|
|
5
|
-
"mappings": ";AAAA,SAAS,YAAY,WAAW,gBAAgB;AAChD,OAAO,UAAU;AACjB,SAAS,QAAQ,aAAa;AAC9B,SAAS,oBAAoB;;;ACH7B,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,
|
|
4
|
+
"sourcesContent": ["import { forwardRef, useEffect, useState } from '@wordpress/element';\nimport clsx from 'clsx';\nimport { Tabs as _Tabs } from '@base-ui/react/tabs';\nimport { useMergeRefs } from '@wordpress/compose';\nimport styles from './style.module.css';\nimport type { TabListProps } from './types';\n\n// Account for sub-pixel rounding errors.\nconst SCROLL_EPSILON = 1;\n\n/**\n * Groups the individual tab buttons.\n *\n * `Tabs` is a collection of React components that combine to render\n * an [ARIA-compliant tabs pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/).\n */\nexport const List = forwardRef< HTMLDivElement, TabListProps >(\n\tfunction TabList(\n\t\t{\n\t\t\tchildren,\n\t\t\tvariant = 'default',\n\t\t\tclassName,\n\t\t\tactivateOnFocus,\n\t\t\t...otherProps\n\t\t},\n\t\tforwardedRef\n\t) {\n\t\tconst [ listEl, setListEl ] = useState< HTMLDivElement | null >( null );\n\t\tconst [ overflow, setOverflow ] = useState< {\n\t\t\tfirst: boolean;\n\t\t\tlast: boolean;\n\t\t\tisScrolling: boolean;\n\t\t} >( {\n\t\t\tfirst: false,\n\t\t\tlast: false,\n\t\t\tisScrolling: false,\n\t\t} );\n\n\t\t// Check if list is overflowing when it scrolls or resizes.\n\t\tuseEffect( () => {\n\t\t\tif ( ! listEl ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst measureOverflow = () => {\n\t\t\t\tconst { scrollWidth, clientWidth, scrollLeft } = listEl;\n\t\t\t\tconst maxScroll = Math.max( scrollWidth - clientWidth, 0 );\n\t\t\t\tconst direction =\n\t\t\t\t\tlistEl.dir ||\n\t\t\t\t\t( typeof window !== 'undefined'\n\t\t\t\t\t\t? window.getComputedStyle( listEl ).direction\n\t\t\t\t\t\t: 'ltr' );\n\n\t\t\t\tconst scrollFromStart =\n\t\t\t\t\tdirection === 'rtl' && scrollLeft < 0\n\t\t\t\t\t\t? // In RTL layouts, scrollLeft is typically 0 at the visual \"start\"\n\t\t\t\t\t\t // (right edge) and becomes negative toward the \"end\" (left edge).\n\t\t\t\t\t\t // Normalize value for correct first/last detection logic.\n\t\t\t\t\t\t -scrollLeft\n\t\t\t\t\t\t: scrollLeft;\n\n\t\t\t\t// Use SCROLL_EPSILON to handle subpixel rendering differences.\n\t\t\t\tsetOverflow( {\n\t\t\t\t\tfirst: scrollFromStart > SCROLL_EPSILON,\n\t\t\t\t\tlast: scrollFromStart < maxScroll - SCROLL_EPSILON,\n\t\t\t\t\tisScrolling: scrollWidth > clientWidth,\n\t\t\t\t} );\n\t\t\t};\n\n\t\t\tconst resizeObserver = new ResizeObserver( measureOverflow );\n\t\t\tresizeObserver.observe( listEl );\n\n\t\t\tlet scrollTick = false;\n\t\t\tconst throttleMeasureOverflowOnScroll = () => {\n\t\t\t\tif ( ! scrollTick ) {\n\t\t\t\t\trequestAnimationFrame( () => {\n\t\t\t\t\t\tmeasureOverflow();\n\t\t\t\t\t\tscrollTick = false;\n\t\t\t\t\t} );\n\t\t\t\t\tscrollTick = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\tlistEl.addEventListener(\n\t\t\t\t'scroll',\n\t\t\t\tthrottleMeasureOverflowOnScroll,\n\t\t\t\t{ passive: true }\n\t\t\t);\n\n\t\t\t// Initial check.\n\t\t\tmeasureOverflow();\n\n\t\t\treturn () => {\n\t\t\t\tlistEl.removeEventListener(\n\t\t\t\t\t'scroll',\n\t\t\t\t\tthrottleMeasureOverflowOnScroll\n\t\t\t\t);\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t};\n\t\t}, [ listEl ] );\n\n\t\tconst mergedListRef = useMergeRefs( [\n\t\t\tforwardedRef,\n\t\t\t( el: HTMLDivElement | null ) => setListEl( el ),\n\t\t] );\n\n\t\treturn (\n\t\t\t<_Tabs.List\n\t\t\t\tref={ mergedListRef }\n\t\t\t\tactivateOnFocus={ activateOnFocus }\n\t\t\t\tdata-select-on-move={ activateOnFocus ? 'true' : 'false' }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles.tablist,\n\t\t\t\t\toverflow.first && styles[ 'is-overflowing-first' ],\n\t\t\t\t\toverflow.last && styles[ 'is-overflowing-last' ],\n\t\t\t\t\tstyles[ `is-${ variant }-variant` ],\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\t{ ...otherProps }\n\t\t\t\ttabIndex={\n\t\t\t\t\totherProps.tabIndex ??\n\t\t\t\t\t( overflow.isScrolling ? -1 : undefined )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t\t<_Tabs.Indicator className={ styles.indicator } />\n\t\t\t</_Tabs.List>\n\t\t);\n\t}\n);\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='b8cf8136a5']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"b8cf8136a5\");\n\tstyle.appendChild(document.createTextNode(\"@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._7313adbc8a112e90__tablist{--direction-factor:1;--direction-start:left;--direction-end:right;align-items:stretch;display:flex;overflow-inline:auto;overscroll-behavior-inline:none;position:relative;&:dir(rtl){--direction-factor:-1;--direction-start:right;--direction-end:left}&[data-orientation=horizontal]{--fade-width:4rem;--fade-gradient-base:#0000 0%,#000 var(--fade-width);--fade-gradient-composed:var(--fade-gradient-base),#000 60%,#0000 50%;width:fit-content;&._9f2ac729c68a735a__is-overflowing-first{mask-image:linear-gradient(to var(--direction-end),var(--fade-gradient-base))}&._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to var(--direction-start),var(--fade-gradient-base))}&._9f2ac729c68a735a__is-overflowing-first._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to right,var(--fade-gradient-composed)),linear-gradient(to left,var(--fade-gradient-composed))}&._59228b5227f38a99__is-minimal-variant{gap:1rem}}&[data-orientation=vertical]{flex-direction:column}}._1c37dcfaa1ad8cda__indicator{@media not (prefers-reduced-motion){transition-duration:.2s;transition-property:translate,width,height,border-radius,border-block;transition-timing-function:ease-out}outline:2px solid #0000;outline-offset:-1px;pointer-events:none;position:absolute;&[data-orientation=horizontal]{background-color:var(--wpds-color-stroke-interactive-neutral-strong,#6e6e6e);bottom:0;height:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px));left:0;translate:var(--active-tab-left) 0;width:var(--active-tab-width);z-index:1}&[data-orientation=vertical]{background-color:var(--wpds-color-bg-interactive-neutral-weak-active,#ededed);border-radius:var(--wpds-border-radius-sm,2px);height:var(--active-tab-height);left:50%;top:0;translate:-50% var(--active-tab-top);width:100%;z-index:0}._7313adbc8a112e90__tablist[data-select-on-move=true]:has(:focus-visible)\\n\\t\\t&[data-orientation=vertical]{border: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));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:#0000;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,\\\"Segoe UI\\\",\\\"Roboto\\\",\\\"Oxygen-Sans\\\",\\\"Ubuntu\\\",\\\"Cantarell\\\",\\\"Helvetica Neue\\\",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;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));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:\\\"\\\";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:40px;padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:\\\"\\\";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]\\n\\t\\t\\t[role=tab]:is([aria-selected=true])\\n\\t\\t\\t&{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"tablist\":\"_7313adbc8a112e90__tablist\",\"is-overflowing-first\":\"_9f2ac729c68a735a__is-overflowing-first\",\"is-overflowing-last\":\"_81c799c1f3cdd261__is-overflowing-last\",\"is-minimal-variant\":\"_59228b5227f38a99__is-minimal-variant\",\"indicator\":\"_1c37dcfaa1ad8cda__indicator\",\"tab\":\"a5fd8814f195aa5e__tab\",\"tab-children\":\"_5dfc77e6edd345d4__tab-children\",\"tab-chevron\":\"_4a20e969d15e5ac1__tab-chevron\"};\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,YAAY,WAAW,gBAAgB;AAChD,OAAO,UAAU;AACjB,SAAS,QAAQ,aAAa;AAC9B,SAAS,oBAAoB;;;ACH7B,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,2gJAAmiJ,CAAC;AAC9kJ,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,gBAAQ,EAAC,WAAU,8BAA6B,wBAAuB,2CAA0C,uBAAsB,0CAAyC,sBAAqB,yCAAwC,aAAY,gCAA+B,OAAM,yBAAwB,gBAAe,mCAAkC,eAAc,iCAAgC;;;ADoGzZ,SAkBC,KAlBD;AAlGH,IAAM,iBAAiB;AAQhB,IAAM,OAAO;AAAA,EACnB,SAAS,QACR;AAAA,IACC;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACJ,GACA,cACC;AACD,UAAM,CAAE,QAAQ,SAAU,IAAI,SAAmC,IAAK;AACtE,UAAM,CAAE,UAAU,WAAY,IAAI,SAI7B;AAAA,MACJ,OAAO;AAAA,MACP,MAAM;AAAA,MACN,aAAa;AAAA,IACd,CAAE;AAGF,cAAW,MAAM;AAChB,UAAK,CAAE,QAAS;AACf;AAAA,MACD;AAEA,YAAM,kBAAkB,MAAM;AAC7B,cAAM,EAAE,aAAa,aAAa,WAAW,IAAI;AACjD,cAAM,YAAY,KAAK,IAAK,cAAc,aAAa,CAAE;AACzD,cAAM,YACL,OAAO,QACL,OAAO,WAAW,cACjB,OAAO,iBAAkB,MAAO,EAAE,YAClC;AAEJ,cAAM,kBACL,cAAc,SAAS,aAAa;AAAA;AAAA;AAAA;AAAA,UAIjC,CAAC;AAAA,YACD;AAGJ,oBAAa;AAAA,UACZ,OAAO,kBAAkB;AAAA,UACzB,MAAM,kBAAkB,YAAY;AAAA,UACpC,aAAa,cAAc;AAAA,QAC5B,CAAE;AAAA,MACH;AAEA,YAAM,iBAAiB,IAAI,eAAgB,eAAgB;AAC3D,qBAAe,QAAS,MAAO;AAE/B,UAAI,aAAa;AACjB,YAAM,kCAAkC,MAAM;AAC7C,YAAK,CAAE,YAAa;AACnB,gCAAuB,MAAM;AAC5B,4BAAgB;AAChB,yBAAa;AAAA,UACd,CAAE;AACF,uBAAa;AAAA,QACd;AAAA,MACD;AACA,aAAO;AAAA,QACN;AAAA,QACA;AAAA,QACA,EAAE,SAAS,KAAK;AAAA,MACjB;AAGA,sBAAgB;AAEhB,aAAO,MAAM;AACZ,eAAO;AAAA,UACN;AAAA,UACA;AAAA,QACD;AACA,uBAAe,WAAW;AAAA,MAC3B;AAAA,IACD,GAAG,CAAE,MAAO,CAAE;AAEd,UAAM,gBAAgB,aAAc;AAAA,MACnC;AAAA,MACA,CAAE,OAA+B,UAAW,EAAG;AAAA,IAChD,CAAE;AAEF,WACC;AAAA,MAAC,MAAM;AAAA,MAAN;AAAA,QACA,KAAM;AAAA,QACN;AAAA,QACA,uBAAsB,kBAAkB,SAAS;AAAA,QACjD,WAAY;AAAA,UACX,cAAO;AAAA,UACP,SAAS,SAAS,cAAQ,sBAAuB;AAAA,UACjD,SAAS,QAAQ,cAAQ,qBAAsB;AAAA,UAC/C,cAAQ,MAAO,OAAQ,UAAW;AAAA,UAClC;AAAA,QACD;AAAA,QACE,GAAG;AAAA,QACL,UACC,WAAW,aACT,SAAS,cAAc,KAAK;AAAA,QAG7B;AAAA;AAAA,UACF,oBAAC,MAAM,WAAN,EAAgB,WAAY,cAAO,WAAY;AAAA;AAAA;AAAA,IACjD;AAAA,EAEF;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,14 +4,23 @@ import clsx from "clsx";
|
|
|
4
4
|
import { Tabs as _Tabs } from "@base-ui/react/tabs";
|
|
5
5
|
import { useRegisterPanel } from "./context.mjs";
|
|
6
6
|
|
|
7
|
-
// packages/ui/src/
|
|
8
|
-
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='
|
|
7
|
+
// packages/ui/src/utils/css/global-css-defense.module.css
|
|
8
|
+
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='1fb29d3a3c']")) {
|
|
9
9
|
const style = document.createElement("style");
|
|
10
|
-
style.setAttribute("data-wp-hash", "
|
|
11
|
-
style.appendChild(document.createTextNode(
|
|
10
|
+
style.setAttribute("data-wp-hash", "1fb29d3a3c");
|
|
11
|
+
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,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}}&: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-typography-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)}"));
|
|
12
12
|
document.head.appendChild(style);
|
|
13
13
|
}
|
|
14
|
-
var
|
|
14
|
+
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" };
|
|
15
|
+
|
|
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='2a5ab8f3a7']")) {
|
|
18
|
+
const style = document.createElement("style");
|
|
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
|
+
document.head.appendChild(style);
|
|
22
|
+
}
|
|
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" };
|
|
15
24
|
|
|
16
25
|
// packages/ui/src/tabs/panel.tsx
|
|
17
26
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -22,7 +31,11 @@ var Panel = forwardRef(
|
|
|
22
31
|
_Tabs.Panel,
|
|
23
32
|
{
|
|
24
33
|
ref: forwardedRef,
|
|
25
|
-
className: clsx(
|
|
34
|
+
className: clsx(
|
|
35
|
+
global_css_defense_default.div,
|
|
36
|
+
focus_default["outset-ring--focus-visible"],
|
|
37
|
+
className
|
|
38
|
+
),
|
|
26
39
|
...otherProps
|
|
27
40
|
}
|
|
28
41
|
);
|