@wordpress/components 40.0.0 → 40.1.1-next.v.202608281122.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/build/context/context-system-provider.cjs +1 -1
  3. package/build/context/context-system-provider.cjs.map +1 -1
  4. package/build/snackbar/index.cjs +8 -5
  5. package/build/snackbar/index.cjs.map +2 -2
  6. package/build/tools-panel/tools-panel-item/hook.cjs +2 -2
  7. package/build/tools-panel/tools-panel-item/hook.cjs.map +2 -2
  8. package/build-module/context/context-system-provider.mjs +1 -1
  9. package/build-module/context/context-system-provider.mjs.map +1 -1
  10. package/build-module/snackbar/index.mjs +8 -5
  11. package/build-module/snackbar/index.mjs.map +2 -2
  12. package/build-module/tools-panel/tools-panel-item/hook.mjs +2 -2
  13. package/build-module/tools-panel/tools-panel-item/hook.mjs.map +2 -2
  14. package/build-types/border-box-control/types.d.ts +6 -2
  15. package/build-types/border-box-control/types.d.ts.map +1 -1
  16. package/build-types/context/context-system-provider.d.ts.map +1 -1
  17. package/build-types/popover/types.d.ts +6 -2
  18. package/build-types/popover/types.d.ts.map +1 -1
  19. package/build-types/snackbar/index.d.ts.map +1 -1
  20. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  21. package/package.json +24 -24
  22. package/src/border-box-control/border-box-control/README.md +2 -2
  23. package/src/border-box-control/types.ts +6 -2
  24. package/src/context/test/__snapshots__/{context-system-provider.js.snap → context-system-provider.jsx.snap} +3 -3
  25. package/src/popover/README.md +2 -2
  26. package/src/popover/test/index.tsx +23 -0
  27. package/src/popover/types.ts +9 -3
  28. package/src/snackbar/index.tsx +10 -6
  29. package/src/snackbar/test/index.tsx +28 -2
  30. package/src/snackbar/test/list.tsx +61 -1
  31. package/src/tools-panel/test/index.tsx +39 -0
  32. package/src/tools-panel/tools-panel-item/hook.ts +4 -1
  33. /package/src/border-control/test/{index.js → index.jsx} +0 -0
  34. /package/src/context/{context-system-provider.js → context-system-provider.jsx} +0 -0
  35. /package/src/context/test/{context-system-provider.js → context-system-provider.jsx} +0 -0
  36. /package/src/input-control/test/__snapshots__/{index.js.snap → index.jsx.snap} +0 -0
  37. /package/src/input-control/test/{index.js → index.jsx} +0 -0
  38. /package/src/item-group/test/__snapshots__/{index.js.snap → index.jsx.snap} +0 -0
  39. /package/src/item-group/test/{index.js → index.jsx} +0 -0
  40. /package/src/menu-item/test/__snapshots__/{index.js.snap → index.jsx.snap} +0 -0
  41. /package/src/menu-item/test/{index.js → index.jsx} +0 -0
  42. /package/src/slot-fill/test/__snapshots__/{slot.js.snap → slot.jsx.snap} +0 -0
  43. /package/src/slot-fill/test/{index.js → index.jsx} +0 -0
  44. /package/src/slot-fill/test/{slot.js → slot.jsx} +0 -0
  45. /package/src/utils/hooks/test/{use-controlled-state.js → use-controlled-state.jsx} +0 -0
  46. /package/src/utils/hooks/test/{use-controlled-value.js → use-controlled-value.jsx} +0 -0
  47. /package/src/utils/hooks/test/{use-cx.js → use-cx.jsx} +0 -0
  48. /package/src/utils/test/{get-node-text.js → get-node-text.jsx} +0 -0
  49. /package/src/view/test/__snapshots__/{index.js.snap → index.jsx.snap} +0 -0
  50. /package/src/view/test/{index.js → index.jsx} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 40.1.0-next.0 (2026-08-28)
6
+
7
+ ### Enhancements
8
+
9
+ - `Popover`: Widen `offset` to also accept an object with separate main and cross axis offsets. The same applies to `BorderBoxControl`'s `popoverOffset` prop ([#82060](https://github.com/WordPress/gutenberg/pull/82060)).
10
+
11
+ ### Bug Fixes
12
+
13
+ - `Snackbar`: Restart the auto-dismiss timer when a notice is recreated with the same ID during removal ([#81764](https://github.com/WordPress/gutenberg/pull/81764)).
14
+ - `ToolsPanel`: Stop a panel item whose `panelId` doesn't match the panel from writing its value into that panel's menu, which could leave an orphaned entry in the dropdown ([#82127](https://github.com/WordPress/gutenberg/pull/82127)).
15
+
16
+ ### Internal
17
+
18
+ - Use the `.jsx` extension for JavaScript source files that contain JSX ([#80990](https://github.com/WordPress/gutenberg/pull/80990)).
19
+ - Remove tsconfig project references to packages that are not dependencies ([#82106](https://github.com/WordPress/gutenberg/pull/82106)).
20
+
5
21
  ## 40.0.0 (2026-08-26)
6
22
 
7
23
  ### Breaking Changes
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/components/src/context/context-system-provider.js
30
+ // packages/components/src/context/context-system-provider.jsx
31
31
  var context_system_provider_exports = {};
32
32
  __export(context_system_provider_exports, {
33
33
  ComponentsContext: () => ComponentsContext,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/context/context-system-provider.js"],
3
+ "sources": ["../../src/context/context-system-provider.jsx"],
4
4
  "sourcesContent": ["import deepmerge from 'deepmerge';\nimport fastDeepEqual from 'fast-deep-equal/es6/index.js';\nimport { isPlainObject } from 'is-plain-object';\nimport { createContext, useContext, useRef, useMemo, memo } from '@wordpress/element';\nimport warn from '@wordpress/warning';\nimport { useUpdateEffect } from '../utils';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ComponentsContext = createContext(/** @type {Record<string, any>} */{});\nComponentsContext.displayName = 'ComponentsContext';\nexport const useComponentsContext = () => useContext(ComponentsContext);\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge({\n value\n}) {\n const parentContext = useComponentsContext();\n const valueRef = useRef(value);\n useUpdateEffect(() => {\n if (\n // Objects are equivalent.\n fastDeepEqual(valueRef.current, value) &&\n // But not the same reference.\n valueRef.current !== value) {\n globalThis.SCRIPT_DEBUG === true ? warn(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;\n }\n }, [value]);\n\n // `parentContext` will always be memoized (i.e., the result of this hook itself)\n // or the default value from when the `ComponentsContext` was originally\n // initialized (which will never change, it's a static variable)\n // so this memoization will prevent `deepmerge()` from rerunning unless\n // the references to `value` change OR the `parentContext` has an actual material change\n // (because again, it's guaranteed to be memoized or a static reference to the empty object\n // so we know that the only changes for `parentContext` are material ones... i.e., why we\n // don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n // need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n // correctly warning when the `value` isn't being properly memoized. All of that to say\n // that this should be super safe to assume that `useMemo` will only run on actual\n // changes to the two dependencies, therefore saving us calls to `deepmerge()`!\n const config = useMemo(() => {\n // Deep clone `parentContext` to avoid mutating it later.\n return deepmerge(parentContext ?? {}, value ?? {}, {\n isMergeableObject: isPlainObject\n });\n }, [parentContext, value]);\n return config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {React.ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {React.JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ({\n children,\n value\n}) => {\n const contextValue = useContextSystemBridge({\n value\n });\n return /*#__PURE__*/_jsx(ComponentsContext.Provider, {\n value: contextValue,\n children: children\n });\n};\nexport const ContextSystemProvider = memo(BaseContextSystemProvider);"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB;AACtB,iBAA0B;AAC1B,6BAA8B;AAC9B,qBAAiE;AACjE,qBAAiB;AACjB,mBAAgC;AAChC,yBAA4B;AACrB,IAAM,wBAAoB;AAAA;AAAA,EAAgD,CAAC;AAAC;AACnF,kBAAkB,cAAc;AACzB,IAAM,uBAAuB,UAAM,2BAAW,iBAAiB;AAWtE,SAAS,uBAAuB;AAAA,EAC9B;AACF,GAAG;AACD,QAAM,gBAAgB,qBAAqB;AAC3C,QAAM,eAAW,uBAAO,KAAK;AAC7B,oCAAgB,MAAM;AACpB;AAAA;AAAA,UAEA,WAAAA,SAAc,SAAS,SAAS,KAAK;AAAA,MAErC,SAAS,YAAY;AAAA,MAAO;AAC1B,iBAAW,iBAAiB,WAAO,eAAAC,SAAK,gCAAgC,KAAK,UAAU,KAAK,CAAC,EAAE,IAAI;AAAA,IACrG;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAcV,QAAM,aAAS,wBAAQ,MAAM;AAE3B,eAAO,iBAAAC,SAAU,iBAAiB,CAAC,GAAG,SAAS,CAAC,GAAG;AAAA,MACjD,mBAAmB;AAAA,IACrB,CAAC;AAAA,EACH,GAAG,CAAC,eAAe,KAAK,CAAC;AACzB,SAAO;AACT;AAmBA,IAAM,4BAA4B,CAAC;AAAA,EACjC;AAAA,EACA;AACF,MAAM;AACJ,QAAM,eAAe,uBAAuB;AAAA,IAC1C;AAAA,EACF,CAAC;AACD,SAAoB,uCAAAC,KAAK,kBAAkB,UAAU;AAAA,IACnD,OAAO;AAAA,IACP;AAAA,EACF,CAAC;AACH;AACO,IAAM,4BAAwB,qBAAK,yBAAyB;",
6
6
  "names": ["fastDeepEqual", "warn", "deepmerge", "_jsx"]
@@ -35,6 +35,7 @@ __export(snackbar_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(snackbar_exports);
37
37
  var import_clsx = __toESM(require("clsx"));
38
+ var import_framer_motion = require("framer-motion");
38
39
  var import_a11y = require("@wordpress/a11y");
39
40
  var import_element = require("@wordpress/element");
40
41
  var import_i18n = require("@wordpress/i18n");
@@ -66,6 +67,7 @@ function UnforwardedSnackbar({
66
67
  onDismiss,
67
68
  listRef
68
69
  }, ref) {
70
+ const isPresent = (0, import_framer_motion.useIsPresent)();
69
71
  function dismissMe(event) {
70
72
  if (event && event.preventDefault) {
71
73
  event.preventDefault();
@@ -93,14 +95,15 @@ function UnforwardedSnackbar({
93
95
  };
94
96
  });
95
97
  (0, import_element.useEffect)(() => {
98
+ if (explicitDismiss || !isPresent) {
99
+ return;
100
+ }
96
101
  const timeoutHandle = setTimeout(() => {
97
- if (!explicitDismiss) {
98
- callbacksRef.current.onDismiss?.();
99
- callbacksRef.current.onRemove?.();
100
- }
102
+ callbacksRef.current.onDismiss?.();
103
+ callbacksRef.current.onRemove?.();
101
104
  }, NOTICE_TIMEOUT);
102
105
  return () => clearTimeout(timeoutHandle);
103
- }, [explicitDismiss]);
106
+ }, [explicitDismiss, isPresent]);
104
107
  const classes = (0, import_clsx.default)(className, "components-snackbar", {
105
108
  "components-snackbar-explicit-dismiss": !!explicitDismiss
106
109
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/snackbar/index.tsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport { speak } from '@wordpress/a11y';\nimport { useEffect, useLayoutEffect, useRef, forwardRef, renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport warning from '@wordpress/warning';\nimport Button from '../button';\nimport ExternalLink from '../external-link';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst NOTICE_TIMEOUT = 6000;\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n *\n * @param message Message to announce.\n * @param politeness Politeness to announce.\n */\nfunction useSpokenMessage(message, politeness) {\n const spokenMessage = typeof message === 'string' ? message : renderToString(message);\n useEffect(() => {\n if (spokenMessage) {\n speak(spokenMessage, politeness);\n }\n }, [spokenMessage, politeness]);\n}\nfunction UnforwardedSnackbar({\n className,\n children,\n spokenMessage = children,\n politeness = 'polite',\n actions = [],\n onRemove,\n icon = null,\n explicitDismiss = false,\n // onDismiss is a callback executed when the snackbar is dismissed.\n // It is distinct from onRemove, which _looks_ like a callback but is\n // actually the function to call to remove the snackbar from the UI.\n onDismiss,\n listRef\n}, ref) {\n function dismissMe(event) {\n if (event && event.preventDefault) {\n event.preventDefault();\n }\n\n // Prevent focus loss by moving it to the list element.\n listRef?.current?.focus();\n onDismiss?.();\n onRemove?.();\n }\n function onActionClick(event, onClick) {\n event.stopPropagation();\n onRemove?.();\n if (onClick) {\n onClick(event);\n }\n }\n useSpokenMessage(spokenMessage, politeness);\n\n // The `onDismiss/onRemove` can have unstable references,\n // trigger side-effect cleanup, and reset timers.\n const callbacksRef = useRef({\n onDismiss,\n onRemove\n });\n useLayoutEffect(() => {\n callbacksRef.current = {\n onDismiss,\n onRemove\n };\n });\n useEffect(() => {\n // Only set up the timeout dismiss if we're not explicitly dismissing.\n const timeoutHandle = setTimeout(() => {\n if (!explicitDismiss) {\n callbacksRef.current.onDismiss?.();\n callbacksRef.current.onRemove?.();\n }\n }, NOTICE_TIMEOUT);\n return () => clearTimeout(timeoutHandle);\n }, [explicitDismiss]);\n const classes = clsx(className, 'components-snackbar', {\n 'components-snackbar-explicit-dismiss': !!explicitDismiss\n });\n if (actions && actions.length > 1) {\n // We need to inform developers that snackbar only accepts 1 action.\n globalThis.SCRIPT_DEBUG === true ? warning('Snackbar can only have one action. Use Notice if your message requires many actions.') : void 0;\n // return first element only while keeping it inside an array\n actions = [actions[0]];\n }\n const snackbarContentClassnames = clsx('components-snackbar__content', {\n 'components-snackbar__content-with-icon': !!icon\n });\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n className: classes,\n onClick: !explicitDismiss ? dismissMe : undefined,\n tabIndex: 0,\n role: !explicitDismiss ? 'button' : undefined,\n onKeyPress: !explicitDismiss ? dismissMe : undefined,\n \"aria-label\": !explicitDismiss ? __('Dismiss this notice') : undefined,\n \"data-testid\": \"snackbar\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: snackbarContentClassnames,\n children: [icon && /*#__PURE__*/_jsx(\"div\", {\n className: \"components-snackbar__icon\",\n children: icon\n }), children, actions.map(({\n label,\n onClick,\n url,\n openInNewTab = false\n }, index) => url !== undefined && openInNewTab ? /*#__PURE__*/_jsx(ExternalLink, {\n href: url,\n onClick: event => onActionClick(event, onClick),\n className: \"components-snackbar__action\",\n children: label\n }, index) : /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n href: url,\n variant: \"link\",\n onClick: event => onActionClick(event, onClick),\n className: \"components-snackbar__action\",\n children: label\n }, index)), explicitDismiss && /*#__PURE__*/_jsx(\"span\", {\n role: \"button\",\n \"aria-label\": __('Dismiss this notice'),\n tabIndex: 0,\n className: \"components-snackbar__dismiss-button\",\n onClick: dismissMe,\n onKeyPress: dismissMe,\n children: \"\\u2715\"\n })]\n })\n });\n}\n\n/**\n * A Snackbar displays a succinct message that is cleared out after a small delay.\n *\n * It can also offer the user options, like viewing a published post.\n * But these options should also be available elsewhere in the UI.\n *\n * ```jsx\n * const MySnackbarNotice = () => (\n * <Snackbar>Post published successfully.</Snackbar>\n * );\n * ```\n */\nexport const Snackbar = forwardRef(UnforwardedSnackbar);\nSnackbar.displayName = 'Snackbar';\nexport default Snackbar;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAsB;AACtB,qBAA+E;AAC/E,kBAAmB;AACnB,qBAAoB;AACpB,oBAAmB;AACnB,2BAAyB;AACzB,yBAA2C;AAC3C,IAAM,iBAAiB;AASvB,SAAS,iBAAiB,SAAS,YAAY;AAC7C,QAAM,gBAAgB,OAAO,YAAY,WAAW,cAAU,+BAAe,OAAO;AACpF,gCAAU,MAAM;AACd,QAAI,eAAe;AACjB,6BAAM,eAAe,UAAU;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,eAAe,UAAU,CAAC;AAChC;AACA,SAAS,oBAAoB;AAAA,EAC3B;AAAA,EACA;A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/a11y';\nimport { useEffect, useLayoutEffect, useRef, forwardRef, renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport warning from '@wordpress/warning';\nimport Button from '../button';\nimport ExternalLink from '../external-link';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst NOTICE_TIMEOUT = 6000;\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n *\n * @param message Message to announce.\n * @param politeness Politeness to announce.\n */\nfunction useSpokenMessage(message, politeness) {\n const spokenMessage = typeof message === 'string' ? message : renderToString(message);\n useEffect(() => {\n if (spokenMessage) {\n speak(spokenMessage, politeness);\n }\n }, [spokenMessage, politeness]);\n}\nfunction UnforwardedSnackbar({\n className,\n children,\n spokenMessage = children,\n politeness = 'polite',\n actions = [],\n onRemove,\n icon = null,\n explicitDismiss = false,\n // onDismiss is a callback executed when the snackbar is dismissed.\n // It is distinct from onRemove, which _looks_ like a callback but is\n // actually the function to call to remove the snackbar from the UI.\n onDismiss,\n listRef\n}, ref) {\n const isPresent = useIsPresent();\n function dismissMe(event) {\n if (event && event.preventDefault) {\n event.preventDefault();\n }\n\n // Prevent focus loss by moving it to the list element.\n listRef?.current?.focus();\n onDismiss?.();\n onRemove?.();\n }\n function onActionClick(event, onClick) {\n event.stopPropagation();\n onRemove?.();\n if (onClick) {\n onClick(event);\n }\n }\n useSpokenMessage(spokenMessage, politeness);\n\n // The `onDismiss/onRemove` can have unstable references,\n // trigger side-effect cleanup, and reset timers.\n const callbacksRef = useRef({\n onDismiss,\n onRemove\n });\n useLayoutEffect(() => {\n callbacksRef.current = {\n onDismiss,\n onRemove\n };\n });\n useEffect(() => {\n if (explicitDismiss || !isPresent) {\n return;\n }\n const timeoutHandle = setTimeout(() => {\n callbacksRef.current.onDismiss?.();\n callbacksRef.current.onRemove?.();\n }, NOTICE_TIMEOUT);\n return () => clearTimeout(timeoutHandle);\n }, [explicitDismiss, isPresent]);\n const classes = clsx(className, 'components-snackbar', {\n 'components-snackbar-explicit-dismiss': !!explicitDismiss\n });\n if (actions && actions.length > 1) {\n // We need to inform developers that snackbar only accepts 1 action.\n globalThis.SCRIPT_DEBUG === true ? warning('Snackbar can only have one action. Use Notice if your message requires many actions.') : void 0;\n // return first element only while keeping it inside an array\n actions = [actions[0]];\n }\n const snackbarContentClassnames = clsx('components-snackbar__content', {\n 'components-snackbar__content-with-icon': !!icon\n });\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n className: classes,\n onClick: !explicitDismiss ? dismissMe : undefined,\n tabIndex: 0,\n role: !explicitDismiss ? 'button' : undefined,\n onKeyPress: !explicitDismiss ? dismissMe : undefined,\n \"aria-label\": !explicitDismiss ? __('Dismiss this notice') : undefined,\n \"data-testid\": \"snackbar\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: snackbarContentClassnames,\n children: [icon && /*#__PURE__*/_jsx(\"div\", {\n className: \"components-snackbar__icon\",\n children: icon\n }), children, actions.map(({\n label,\n onClick,\n url,\n openInNewTab = false\n }, index) => url !== undefined && openInNewTab ? /*#__PURE__*/_jsx(ExternalLink, {\n href: url,\n onClick: event => onActionClick(event, onClick),\n className: \"components-snackbar__action\",\n children: label\n }, index) : /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n href: url,\n variant: \"link\",\n onClick: event => onActionClick(event, onClick),\n className: \"components-snackbar__action\",\n children: label\n }, index)), explicitDismiss && /*#__PURE__*/_jsx(\"span\", {\n role: \"button\",\n \"aria-label\": __('Dismiss this notice'),\n tabIndex: 0,\n className: \"components-snackbar__dismiss-button\",\n onClick: dismissMe,\n onKeyPress: dismissMe,\n children: \"\\u2715\"\n })]\n })\n });\n}\n\n/**\n * A Snackbar displays a succinct message that is cleared out after a small delay.\n *\n * It can also offer the user options, like viewing a published post.\n * But these options should also be available elsewhere in the UI.\n *\n * ```jsx\n * const MySnackbarNotice = () => (\n * <Snackbar>Post published successfully.</Snackbar>\n * );\n * ```\n */\nexport const Snackbar = forwardRef(U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AAG,KAAK,IAAiB,uCAAAF,KAAK,cAAAG,SAAQ;AAAA,QACpC,uBAAuB;AAAA,QACvB,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS,WAAS,cAAc,OAAO,OAAO;AAAA,QAC9C,WAAW;AAAA,QACX,UAAU;AAAA,MACZ,GAAG,KAAK,CAAC,GAAG,mBAAgC,uCAAAH,KAAK,QAAQ;AAAA,QACvD,MAAM;AAAA,QACN,kBAAc,gBAAG,qBAAqB;AAAA,QACtC,UAAU;AAAA,QACV,WAAW;AAAA,QACX,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,UAAU;AAAA,MACZ,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA,EACH,CAAC;AACH;AAcO,IAAM,eAAW,2BAAW,mBAAmB;AACtD,SAAS,cAAc;AACvB,IAAO,mBAAQ;",
6
6
  "names": ["clsx", "warning", "_jsx", "_jsxs", "ExternalLink", "Button"]
7
7
  }
@@ -187,11 +187,11 @@ function useToolsPanelItem(props) {
187
187
  const isRegistered = menuItems?.[menuGroup]?.[label] !== void 0;
188
188
  const isValueSet = hasValue();
189
189
  (0, import_element.useEffect)(() => {
190
- if (!isShownByDefault && !isValueSet) {
190
+ if (!hasMatchingPanel || !isShownByDefault && !isValueSet) {
191
191
  return;
192
192
  }
193
193
  flagItemCustomization(isValueSet, label, menuGroup);
194
- }, [isValueSet, menuGroup, label, flagItemCustomization, isShownByDefault]);
194
+ }, [hasMatchingPanel, isValueSet, menuGroup, label, flagItemCustomization, isShownByDefault]);
195
195
  (0, import_element.useEffect)(() => {
196
196
  if (!isRegistered || isResetting || !hasMatchingPanel) {
197
197
  return;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tools-panel/tools-panel-item/hook.ts", "../../../../style-runtime/src/index.ts", "../../../src/tools-panel/style.module.scss"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport { usePrevious } from '@wordpress/compose';\nimport { useCallback, useEffect, useLayoutEffect } from '@wordpress/element';\nimport styles from '../style.module.scss';\nimport { useToolsPanelContext } from '../context';\nimport { useContextSystem } from '../../context';\nconst noop = () => {};\nexport function useToolsPanelItem(props) {\n const {\n className,\n hasValue,\n isShownByDefault = false,\n label,\n panelId,\n resetAllFilter = noop,\n onDeselect,\n onSelect,\n ...otherProps\n } = useContextSystem(props, 'ToolsPanelItem');\n const {\n panelId: currentPanelId,\n menuItems,\n registerResetAllFilter,\n deregisterResetAllFilter,\n registerPanelItem,\n deregisterPanelItem,\n flagItemCustomization,\n isResetting,\n shouldRenderPlaceholderItems: shouldRenderPlaceholder,\n firstDisplayedItem,\n lastDisplayedItem,\n __experimentalFirstVisibleItemClass,\n __experimentalLastVisibleItemClass\n } = useToolsPanelContext();\n\n // hasValue is a new function on every render, so do not add it as a\n // dependency to the useCallback hook! If needed, we should use a ref.\n const hasValueCallback = useCallback(hasValue, [panelId]);\n // resetAllFilter is a new function on every render, so do not add it as a\n // dependency to the useCallback hook! If needed, we should use a ref.\n const resetAllFilterCallback = useCallback(resetAllFilter, [panelId]);\n const previousPanelId = usePrevious(currentPanelId);\n const hasMatchingPanel = currentPanelId === panelId || currentPanelId === null;\n\n // Registering the panel item allows the panel to include it in its\n // automatically generated menu and determine its initial checked status.\n //\n // This is performed in a layout effect to ensure that the panel item\n // is registered before it is rendered preventing a rendering glitch.\n // See: https://github.com/WordPress/gutenberg/issues/56470\n useLayoutEffect(() => {\n if (hasMatchingPanel && previousPanelId !== null) {\n registerPanelItem({\n hasValue: hasValueCallback,\n isShownByDefault,\n label,\n panelId\n });\n }\n return () => {\n if (previousPanelId === null && !!currentPanelId || currentPanelId === panelId) {\n deregisterPanelItem(label);\n }\n };\n }, [currentPanelId, hasMatchingPanel, isShownByDefault, label, hasValueCallback, panelId, previousPanelId, registerPanelItem, deregisterPanelItem]);\n useEffect(() => {\n if (hasMatchingPanel) {\n registerResetAllFilter(resetAllFilterCallback);\n }\n return () => {\n if (hasMatchingPanel) {\n deregisterResetAllFilter(resetAllFilterCallback);\n }\n };\n }, [registerResetAllFilter, deregisterResetAllFilter, resetAllFilterCallback, hasMatchingPanel]);\n\n // Note: `label` is used as a key when building menu item state in\n // `ToolsPanel`.\n const menuGroup = isShownByDefault ? 'default' : 'optional';\n const isMenuItemChecked = menuItems?.[menuGroup]?.[label];\n const wasMenuItemChecked = usePrevious(isMenuItemChecked);\n const isRegistered = menuItems?.[menuGroup]?.[label] !== undefined;\n const isValueSet = hasValue();\n // Notify the panel when an item's value has changed except for optional\n // items without value because the item should not cause itself to hide.\n useEffect(() => {\n if (!isShownByDefault && !isValueSet) {\n return;\n }\n flagItemCustomization(isValueSet, label, menuGroup);\n }, [isValueSet, menuGroup, label, flagItemCustomization, isShownByDefault]);\n\n // Determine if the panel item's corresponding menu is being toggled and\n // trigger appropriate callback if it is.\n useEffect(() => {\n // We check whether this item is currently registered as items rendered\n // via fills can persist through the parent panel being remounted.\n // See: https://github.com/WordPress/gutenberg/pull/45673\n if (!isRegistered || isResetting || !hasMatchingPanel) {\n return;\n }\n if (isMenuItemChecked && !isValueSet && !wasMenuItemChecked) {\n onSelect?.();\n }\n if (!isMenuItemChecked && isValueSet && wasMenuItemChecked) {\n onDeselect?.();\n }\n }, [hasMatchingPanel, isMenuItemChecked, isRegistered, isResetting, isValueSet, wasMenuItemChecked, onSelect, onDeselect]);\n\n // The item is shown if it is a default control regardless of whether it\n // has a value. Optional items are shown when they are checked or have\n // a value.\n const isShown = isShownByDefault ? menuItems?.[menuGroup]?.[label] !== undefined : isMenuItemChecked;\n const shouldApplyPlaceholderStyles = shouldRenderPlaceholder && !isShown;\n const classes = clsx(styles['tools-panel-item'], shouldApplyPlaceholderStyles && styles['tools-panel-item-placeholder'], !shouldApplyPlaceholderStyles && className, firstDisplayedItem === label && __experimentalFirstVisibleItemClass, lastDisplayedItem === label && __experimentalLastVisibleItemClass);\n return {\n ...otherProps,\n isShown,\n shouldRenderPlaceholder,\n className: classes\n };\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"29b739f451\", \"._62d714739f4dc308__tools-panel{border-top:1px solid #ddd;margin-top:-1px;padding:16px}._40db7f4f897b683d__tools-panel-with-inner-wrapper>div:not(:first-of-type){column-gap:16px;display:grid;grid-column:1/-1;grid-template-columns:repeat(2,minmax(0,1fr));row-gap:16px}._95a15674966f30a3__tools-panel-hidden-inner-wrapper>div:not(:first-of-type){display:none}._322a049b9b7d8674__tools-panel-header{gap:8px;grid-column:1/-1}._322a049b9b7d8674__tools-panel-header .components-dropdown-menu{line-height:0;margin:-4px 0}._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header .components-dropdown-menu__toggle{min-width:24px;padding:0}.b92a382d3b30104d__tools-panel-heading.b92a382d3b30104d__tools-panel-heading{font-size:inherit;line-height:normal;margin:0}._8005d68fffa9db91__tools-panel-item{grid-column:1/-1}._8005d68fffa9db91__tools-panel-item>div,._8005d68fffa9db91__tools-panel-item>fieldset{margin-bottom:0;max-width:100%;padding-bottom:0}._8005d68fffa9db91__tools-panel-item .components-base-control__help,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control .components-base-control__field:last-child{margin-bottom:0}._4f55e1a6e373746e__tools-panel-item-placeholder{display:none}.d40032517bff9e12__dropdown-menu{min-width:200px}.f135b96aa96ca6bb__reset-label{color:var(--wp-components-color-accent-darker-10,var(--wp-admin-theme-color-darker-10,#2145e6));font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:1.4;margin-inline-start:12px;text-transform:uppercase}._69b138dfa5570d9c__default-controls-item{color:#1e1e1e}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]{color:#757575;opacity:1}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]:hover{color:#757575}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true] .f135b96aa96ca6bb__reset-label{opacity:.3}\");\n}\nexport default {\"tools-panel\":\"_62d714739f4dc308__tools-panel\",\"tools-panel-with-inner-wrapper\":\"_40db7f4f897b683d__tools-panel-with-inner-wrapper\",\"tools-panel-hidden-inner-wrapper\":\"_95a15674966f30a3__tools-panel-hidden-inner-wrapper\",\"tools-panel-header\":\"_322a049b9b7d8674__tools-panel-header\",\"tools-panel-heading\":\"b92a382d3b30104d__tools-panel-heading\",\"tools-panel-item\":\"_8005d68fffa9db91__tools-panel-item\",\"tools-panel-item-placeholder\":\"_4f55e1a6e373746e__tools-panel-item-placeholder\",\"dropdown-menu\":\"d40032517bff9e12__dropdown-menu\",\"reset-label\":\"f135b96aa96ca6bb__reset-label\",\"default-controls-item\":\"_69b138dfa5570d9c__default-controls-item\"};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,qBAA4B;AAC5B,qBAAwD;;;ACFxD,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa,oBAAoB,MAAM,MAAM;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAUA,SAAS,YAAY,gBAAgB,MAAM,KAAK;AAC9C,MAAI,CAAC,eAAe,MAAM;AACxB;AAAA,EACF;AACA,QAAM,UAAU,WAAW;AAC3B,MAAI,iBAAiB,QAAQ,eAAe,IAAI,cAAc;AAC9D,MAAI,CAAC,gBAAgB;AACnB,qBAAiB,oBAAI,IAAI;AACzB,YAAQ,eAAe,IAAI,gBAAgB,cAAc;AAAA,EAC3D;AACA,MAAI,eAAe,IAAI,IAAI,GAAG;AAC5B;AAAA,EACF;AAKA,MAAI,0BAA0B,gBAAgB,IAAI,GAAG;AACnD,mBAAe,IAAI,IAAI;AACvB;A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B,4BAAY,iBAAiB;AACxD,QAAM,eAAe,YAAY,SAAS,IAAI,KAAK,MAAM;AACzD,QAAM,aAAa,SAAS;AAG5B,gCAAU,MAAM;AACd,QAAI,CAAC,oBAAoB,CAAC,YAAY;AACpC;AAAA,IACF;AACA,0BAAsB,YAAY,OAAO,SAAS;AAAA,EACpD,GAAG,CAAC,YAAY,WAAW,OAAO,uBAAuB,gBAAgB,CAAC;AAI1E,gCAAU,MAAM;AAId,QAAI,CAAC,gBAAgB,eAAe,CAAC,kBAAkB;AACrD;AAAA,IACF;AACA,QAAI,qBAAqB,CAAC,cAAc,CAAC,oBAAoB;AAC3D,iBAAW;AAAA,IACb;AACA,QAAI,CAAC,qBAAqB,cAAc,oBAAoB;AAC1D,mBAAa;AAAA,IACf;AAAA,EACF,GAAG,CAAC,kBAAkB,mBAAmB,cAAc,aAAa,YAAY,oBAAoB,UAAU,UAAU,CAAC;AAKzH,QAAM,UAAU,mBAAmB,YAAY,SAAS,IAAI,KAAK,MAAM,SAAY;AACnF,QAAM,+BAA+B,2BAA2B,CAAC;AACjE,QAAM,cAAU,YAAAC,SAAK,qBAAO,kBAAkB,GAAG,gCAAgC,qBAAO,8BAA8B,GAAG,CAAC,gCAAgC,WAAW,uBAAuB,SAAS,qCAAqC,sBAAsB,SAAS,kCAAkC;AAC3S,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA,WAAW;AAAA,EACb;AACF;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport { usePrevious } from '@wordpress/compose';\nimport { useCallback, useEffect, useLayoutEffect } from '@wordpress/element';\nimport styles from '../style.module.scss';\nimport { useToolsPanelContext } from '../context';\nimport { useContextSystem } from '../../context';\nconst noop = () => {};\nexport function useToolsPanelItem(props) {\n const {\n className,\n hasValue,\n isShownByDefault = false,\n label,\n panelId,\n resetAllFilter = noop,\n onDeselect,\n onSelect,\n ...otherProps\n } = useContextSystem(props, 'ToolsPanelItem');\n const {\n panelId: currentPanelId,\n menuItems,\n registerResetAllFilter,\n deregisterResetAllFilter,\n registerPanelItem,\n deregisterPanelItem,\n flagItemCustomization,\n isResetting,\n shouldRenderPlaceholderItems: shouldRenderPlaceholder,\n firstDisplayedItem,\n lastDisplayedItem,\n __experimentalFirstVisibleItemClass,\n __experimentalLastVisibleItemClass\n } = useToolsPanelContext();\n\n // hasValue is a new function on every render, so do not add it as a\n // dependency to the useCallback hook! If needed, we should use a ref.\n const hasValueCallback = useCallback(hasValue, [panelId]);\n // resetAllFilter is a new function on every render, so do not add it as a\n // dependency to the useCallback hook! If needed, we should use a ref.\n const resetAllFilterCallback = useCallback(resetAllFilter, [panelId]);\n const previousPanelId = usePrevious(currentPanelId);\n const hasMatchingPanel = currentPanelId === panelId || currentPanelId === null;\n\n // Registering the panel item allows the panel to include it in its\n // automatically generated menu and determine its initial checked status.\n //\n // This is performed in a layout effect to ensure that the panel item\n // is registered before it is rendered preventing a rendering glitch.\n // See: https://github.com/WordPress/gutenberg/issues/56470\n useLayoutEffect(() => {\n if (hasMatchingPanel && previousPanelId !== null) {\n registerPanelItem({\n hasValue: hasValueCallback,\n isShownByDefault,\n label,\n panelId\n });\n }\n return () => {\n if (previousPanelId === null && !!currentPanelId || currentPanelId === panelId) {\n deregisterPanelItem(label);\n }\n };\n }, [currentPanelId, hasMatchingPanel, isShownByDefault, label, hasValueCallback, panelId, previousPanelId, registerPanelItem, deregisterPanelItem]);\n useEffect(() => {\n if (hasMatchingPanel) {\n registerResetAllFilter(resetAllFilterCallback);\n }\n return () => {\n if (hasMatchingPanel) {\n deregisterResetAllFilter(resetAllFilterCallback);\n }\n };\n }, [registerResetAllFilter, deregisterResetAllFilter, resetAllFilterCallback, hasMatchingPanel]);\n\n // Note: `label` is used as a key when building menu item state in\n // `ToolsPanel`.\n const menuGroup = isShownByDefault ? 'default' : 'optional';\n const isMenuItemChecked = menuItems?.[menuGroup]?.[label];\n const wasMenuItemChecked = usePrevious(isMenuItemChecked);\n const isRegistered = menuItems?.[menuGroup]?.[label] !== undefined;\n const isValueSet = hasValue();\n // Notify the panel when an item's value has changed except for optional\n // items without value because the item should not cause itself to hide.\n // Items that don't belong to the panel on screen stay silent, otherwise\n // they would leave an orphaned entry in its menu.\n useEffect(() => {\n if (!hasMatchingPanel || !isShownByDefault && !isValueSet) {\n return;\n }\n flagItemCustomization(isValueSet, label, menuGroup);\n }, [hasMatchingPanel, isValueSet, menuGroup, label, flagItemCustomization, isShownByDefault]);\n\n // Determine if the panel item's corresponding menu is being toggled and\n // trigger appropriate callback if it is.\n useEffect(() => {\n // We check whether this item is currently registered as items rendered\n // via fills can persist through the parent panel being remounted.\n // See: https://github.com/WordPress/gutenberg/pull/45673\n if (!isRegistered || isResetting || !hasMatchingPanel) {\n return;\n }\n if (isMenuItemChecked && !isValueSet && !wasMenuItemChecked) {\n onSelect?.();\n }\n if (!isMenuItemChecked && isValueSet && wasMenuItemChecked) {\n onDeselect?.();\n }\n }, [hasMatchingPanel, isMenuItemChecked, isRegistered, isResetting, isValueSet, wasMenuItemChecked, onSelect, onDeselect]);\n\n // The item is shown if it is a default control regardless of whether it\n // has a value. Optional items are shown when they are checked or have\n // a value.\n const isShown = isShownByDefault ? menuItems?.[menuGroup]?.[label] !== undefined : isMenuItemChecked;\n const shouldApplyPlaceholderStyles = shouldRenderPlaceholder && !isShown;\n const classes = clsx(styles['tools-panel-item'], shouldApplyPlaceholderStyles && styles['tools-panel-item-placeholder'], !shouldApplyPlaceholderStyles && className, firstDisplayedItem === label && __experimentalFirstVisibleItemClass, lastDisplayedItem === label && __experimentalLastVisibleItemClass);\n return {\n ...otherProps,\n isShown,\n shouldRenderPlaceholder,\n className: classes\n };\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"29b739f451\", \"._62d714739f4dc308__tools-panel{border-top:1px solid #ddd;margin-top:-1px;padding:16px}._40db7f4f897b683d__tools-panel-with-inner-wrapper>div:not(:first-of-type){column-gap:16px;display:grid;grid-column:1/-1;grid-template-columns:repeat(2,minmax(0,1fr));row-gap:16px}._95a15674966f30a3__tools-panel-hidden-inner-wrapper>div:not(:first-of-type){display:none}._322a049b9b7d8674__tools-panel-header{gap:8px;grid-column:1/-1}._322a049b9b7d8674__tools-panel-header .components-dropdown-menu{line-height:0;margin:-4px 0}._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header .components-dropdown-menu__toggle{min-width:24px;padding:0}.b92a382d3b30104d__tools-panel-heading.b92a382d3b30104d__tools-panel-heading{font-size:inherit;line-height:normal;margin:0}._8005d68fffa9db91__tools-panel-item{grid-column:1/-1}._8005d68fffa9db91__tools-panel-item>div,._8005d68fffa9db91__tools-panel-item>fieldset{margin-bottom:0;max-width:100%;padding-bottom:0}._8005d68fffa9db91__tools-panel-item .components-base-control__help,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control .components-base-control__field:last-child{margin-bottom:0}._4f55e1a6e373746e__tools-panel-item-placeholder{display:none}.d40032517bff9e12__dropdown-menu{min-width:200px}.f135b96aa96ca6bb__reset-label{color:var(--wp-components-color-accent-darker-10,var(--wp-admin-theme-color-darker-10,#2145e6));font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:1.4;margin-inline-start:12px;text-transform:uppercase}._69b138dfa5570d9c__default-controls-item{color:#1e1e1e}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]{color:#757575;opacity:1}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]:hover{color:#757575}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true] .f135b96aa96ca6bb__reset-label{opacity:.3}\");\n}\nexport default {\"tools-panel\":\"_62d714739f4dc308__tools-panel\",\"tools-panel-with-inner-wrapper\":\"_40db7f4f897b683d__tools-panel-with-inner-wrapper\",\"tools-panel-hidden-inner-wrapper\":\"_95a15674966f30a3__tools-panel-hidden-inner-wrapper\",\"tools-panel-header\":\"_322a049b9b7d8674__tools-panel-header\",\"tools-panel-heading\":\"b92a382d3b30104d__tools-panel-heading\",\"tools-panel-item\":\"_8005d68fffa9db91__tools-panel-item\",\"tools-panel-item-placeholder\":\"_4f55e1a6e373746e__tools-panel-item-placeholder\",\"dropdown-menu\":\"d40032517bff9e12__dropdown-menu\",\"reset-label\":\"f135b96aa96ca6bb__reset-label\",\"default-controls-item\":\"_69b138dfa5570d9c__default-controls-item\"};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;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AA,IACF;AACA,0BAAsB,YAAY,OAAO,SAAS;AAAA,EACpD,GAAG,CAAC,kBAAkB,YAAY,WAAW,OAAO,uBAAuB,gBAAgB,CAAC;AAI5F,gCAAU,MAAM;AAId,QAAI,CAAC,gBAAgB,eAAe,CAAC,kBAAkB;AACrD;AAAA,IACF;AACA,QAAI,qBAAqB,CAAC,cAAc,CAAC,oBAAoB;AAC3D,iBAAW;AAAA,IACb;AACA,QAAI,CAAC,qBAAqB,cAAc,oBAAoB;AAC1D,mBAAa;AAAA,IACf;AAAA,EACF,GAAG,CAAC,kBAAkB,mBAAmB,cAAc,aAAa,YAAY,oBAAoB,UAAU,UAAU,CAAC;AAKzH,QAAM,UAAU,mBAAmB,YAAY,SAAS,IAAI,KAAK,MAAM,SAAY;AACnF,QAAM,+BAA+B,2BAA2B,CAAC;AACjE,QAAM,cAAU,YAAAC,SAAK,qBAAO,kBAAkB,GAAG,gCAAgC,qBAAO,8BAA8B,GAAG,CAAC,gCAAgC,WAAW,uBAAuB,SAAS,qCAAqC,sBAAsB,SAAS,kCAAkC;AAC3S,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA,WAAW;AAAA,EACb;AACF;",
6
6
  "names": ["import_context", "clsx"]
7
7
  }
@@ -1,4 +1,4 @@
1
- // packages/components/src/context/context-system-provider.js
1
+ // packages/components/src/context/context-system-provider.jsx
2
2
  import deepmerge from "deepmerge";
3
3
  import fastDeepEqual from "fast-deep-equal/es6/index.js";
4
4
  import { isPlainObject } from "is-plain-object";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/context/context-system-provider.js"],
3
+ "sources": ["../../src/context/context-system-provider.jsx"],
4
4
  "sourcesContent": ["import deepmerge from 'deepmerge';\nimport fastDeepEqual from 'fast-deep-equal/es6/index.js';\nimport { isPlainObject } from 'is-plain-object';\nimport { createContext, useContext, useRef, useMemo, memo } from '@wordpress/element';\nimport warn from '@wordpress/warning';\nimport { useUpdateEffect } from '../utils';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ComponentsContext = createContext(/** @type {Record<string, any>} */{});\nComponentsContext.displayName = 'ComponentsContext';\nexport const useComponentsContext = () => useContext(ComponentsContext);\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge({\n value\n}) {\n const parentContext = useComponentsContext();\n const valueRef = useRef(value);\n useUpdateEffect(() => {\n if (\n // Objects are equivalent.\n fastDeepEqual(valueRef.current, value) &&\n // But not the same reference.\n valueRef.current !== value) {\n globalThis.SCRIPT_DEBUG === true ? warn(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;\n }\n }, [value]);\n\n // `parentContext` will always be memoized (i.e., the result of this hook itself)\n // or the default value from when the `ComponentsContext` was originally\n // initialized (which will never change, it's a static variable)\n // so this memoization will prevent `deepmerge()` from rerunning unless\n // the references to `value` change OR the `parentContext` has an actual material change\n // (because again, it's guaranteed to be memoized or a static reference to the empty object\n // so we know that the only changes for `parentContext` are material ones... i.e., why we\n // don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n // need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n // correctly warning when the `value` isn't being properly memoized. All of that to say\n // that this should be super safe to assume that `useMemo` will only run on actual\n // changes to the two dependencies, therefore saving us calls to `deepmerge()`!\n const config = useMemo(() => {\n // Deep clone `parentContext` to avoid mutating it later.\n return deepmerge(parentContext ?? {}, value ?? {}, {\n isMergeableObject: isPlainObject\n });\n }, [parentContext, value]);\n return config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {React.ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {React.JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ({\n children,\n value\n}) => {\n const contextValue = useContextSystemBridge({\n value\n });\n return /*#__PURE__*/_jsx(ComponentsContext.Provider, {\n value: contextValue,\n children: children\n });\n};\nexport const ContextSystemProvider = memo(BaseContextSystemProvider);"],
5
5
  "mappings": ";AAAA,OAAO,eAAe;AACtB,OAAO,mBAAmB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,eAAe,YAAY,QAAQ,SAAS,YAAY;AACjE,OAAO,UAAU;AACjB,SAAS,uBAAuB;AAChC,SAAS,OAAO,YAAY;AACrB,IAAM,oBAAoB;AAAA;AAAA,EAAgD,CAAC;AAAC;AACnF,kBAAkB,cAAc;AACzB,IAAM,uBAAuB,MAAM,WAAW,iBAAiB;AAWtE,SAAS,uBAAuB;AAAA,EAC9B;AACF,GAAG;AACD,QAAM,gBAAgB,qBAAqB;AAC3C,QAAM,WAAW,OAAO,KAAK;AAC7B,kBAAgB,MAAM;AACpB;AAAA;AAAA,MAEA,cAAc,SAAS,SAAS,KAAK;AAAA,MAErC,SAAS,YAAY;AAAA,MAAO;AAC1B,iBAAW,iBAAiB,OAAO,KAAK,gCAAgC,KAAK,UAAU,KAAK,CAAC,EAAE,IAAI;AAAA,IACrG;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAcV,QAAM,SAAS,QAAQ,MAAM;AAE3B,WAAO,UAAU,iBAAiB,CAAC,GAAG,SAAS,CAAC,GAAG;AAAA,MACjD,mBAAmB;AAAA,IACrB,CAAC;AAAA,EACH,GAAG,CAAC,eAAe,KAAK,CAAC;AACzB,SAAO;AACT;AAmBA,IAAM,4BAA4B,CAAC;AAAA,EACjC;AAAA,EACA;AACF,MAAM;AACJ,QAAM,eAAe,uBAAuB;AAAA,IAC1C;AAAA,EACF,CAAC;AACD,SAAoB,qBAAK,kBAAkB,UAAU;AAAA,IACnD,OAAO;AAAA,IACP;AAAA,EACF,CAAC;AACH;AACO,IAAM,wBAAwB,KAAK,yBAAyB;",
6
6
  "names": []
@@ -1,5 +1,6 @@
1
1
  // packages/components/src/snackbar/index.tsx
2
2
  import clsx from "clsx";
3
+ import { useIsPresent } from "framer-motion";
3
4
  import { speak } from "@wordpress/a11y";
4
5
  import { useEffect, useLayoutEffect, useRef, forwardRef, renderToString } from "@wordpress/element";
5
6
  import { __ } from "@wordpress/i18n";
@@ -31,6 +32,7 @@ function UnforwardedSnackbar({
31
32
  onDismiss,
32
33
  listRef
33
34
  }, ref) {
35
+ const isPresent = useIsPresent();
34
36
  function dismissMe(event) {
35
37
  if (event && event.preventDefault) {
36
38
  event.preventDefault();
@@ -58,14 +60,15 @@ function UnforwardedSnackbar({
58
60
  };
59
61
  });
60
62
  useEffect(() => {
63
+ if (explicitDismiss || !isPresent) {
64
+ return;
65
+ }
61
66
  const timeoutHandle = setTimeout(() => {
62
- if (!explicitDismiss) {
63
- callbacksRef.current.onDismiss?.();
64
- callbacksRef.current.onRemove?.();
65
- }
67
+ callbacksRef.current.onDismiss?.();
68
+ callbacksRef.current.onRemove?.();
66
69
  }, NOTICE_TIMEOUT);
67
70
  return () => clearTimeout(timeoutHandle);
68
- }, [explicitDismiss]);
71
+ }, [explicitDismiss, isPresent]);
69
72
  const classes = clsx(className, "components-snackbar", {
70
73
  "components-snackbar-explicit-dismiss": !!explicitDismiss
71
74
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/snackbar/index.tsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport { speak } from '@wordpress/a11y';\nimport { useEffect, useLayoutEffect, useRef, forwardRef, renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport warning from '@wordpress/warning';\nimport Button from '../button';\nimport ExternalLink from '../external-link';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst NOTICE_TIMEOUT = 6000;\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n *\n * @param message Message to announce.\n * @param politeness Politeness to announce.\n */\nfunction useSpokenMessage(message, politeness) {\n const spokenMessage = typeof message === 'string' ? message : renderToString(message);\n useEffect(() => {\n if (spokenMessage) {\n speak(spokenMessage, politeness);\n }\n }, [spokenMessage, politeness]);\n}\nfunction UnforwardedSnackbar({\n className,\n children,\n spokenMessage = children,\n politeness = 'polite',\n actions = [],\n onRemove,\n icon = null,\n explicitDismiss = false,\n // onDismiss is a callback executed when the snackbar is dismissed.\n // It is distinct from onRemove, which _looks_ like a callback but is\n // actually the function to call to remove the snackbar from the UI.\n onDismiss,\n listRef\n}, ref) {\n function dismissMe(event) {\n if (event && event.preventDefault) {\n event.preventDefault();\n }\n\n // Prevent focus loss by moving it to the list element.\n listRef?.current?.focus();\n onDismiss?.();\n onRemove?.();\n }\n function onActionClick(event, onClick) {\n event.stopPropagation();\n onRemove?.();\n if (onClick) {\n onClick(event);\n }\n }\n useSpokenMessage(spokenMessage, politeness);\n\n // The `onDismiss/onRemove` can have unstable references,\n // trigger side-effect cleanup, and reset timers.\n const callbacksRef = useRef({\n onDismiss,\n onRemove\n });\n useLayoutEffect(() => {\n callbacksRef.current = {\n onDismiss,\n onRemove\n };\n });\n useEffect(() => {\n // Only set up the timeout dismiss if we're not explicitly dismissing.\n const timeoutHandle = setTimeout(() => {\n if (!explicitDismiss) {\n callbacksRef.current.onDismiss?.();\n callbacksRef.current.onRemove?.();\n }\n }, NOTICE_TIMEOUT);\n return () => clearTimeout(timeoutHandle);\n }, [explicitDismiss]);\n const classes = clsx(className, 'components-snackbar', {\n 'components-snackbar-explicit-dismiss': !!explicitDismiss\n });\n if (actions && actions.length > 1) {\n // We need to inform developers that snackbar only accepts 1 action.\n globalThis.SCRIPT_DEBUG === true ? warning('Snackbar can only have one action. Use Notice if your message requires many actions.') : void 0;\n // return first element only while keeping it inside an array\n actions = [actions[0]];\n }\n const snackbarContentClassnames = clsx('components-snackbar__content', {\n 'components-snackbar__content-with-icon': !!icon\n });\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n className: classes,\n onClick: !explicitDismiss ? dismissMe : undefined,\n tabIndex: 0,\n role: !explicitDismiss ? 'button' : undefined,\n onKeyPress: !explicitDismiss ? dismissMe : undefined,\n \"aria-label\": !explicitDismiss ? __('Dismiss this notice') : undefined,\n \"data-testid\": \"snackbar\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: snackbarContentClassnames,\n children: [icon && /*#__PURE__*/_jsx(\"div\", {\n className: \"components-snackbar__icon\",\n children: icon\n }), children, actions.map(({\n label,\n onClick,\n url,\n openInNewTab = false\n }, index) => url !== undefined && openInNewTab ? /*#__PURE__*/_jsx(ExternalLink, {\n href: url,\n onClick: event => onActionClick(event, onClick),\n className: \"components-snackbar__action\",\n children: label\n }, index) : /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n href: url,\n variant: \"link\",\n onClick: event => onActionClick(event, onClick),\n className: \"components-snackbar__action\",\n children: label\n }, index)), explicitDismiss && /*#__PURE__*/_jsx(\"span\", {\n role: \"button\",\n \"aria-label\": __('Dismiss this notice'),\n tabIndex: 0,\n className: \"components-snackbar__dismiss-button\",\n onClick: dismissMe,\n onKeyPress: dismissMe,\n children: \"\\u2715\"\n })]\n })\n });\n}\n\n/**\n * A Snackbar displays a succinct message that is cleared out after a small delay.\n *\n * It can also offer the user options, like viewing a published post.\n * But these options should also be available elsewhere in the UI.\n *\n * ```jsx\n * const MySnackbarNotice = () => (\n * <Snackbar>Post published successfully.</Snackbar>\n * );\n * ```\n */\nexport const Snackbar = forwardRef(UnforwardedSnackbar);\nSnackbar.displayName = 'Snackbar';\nexport default Snackbar;"],
5
- "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,aAAa;AACtB,SAAS,WAAW,iBAAiB,QAAQ,YAAY,sBAAsB;AAC/E,SAAS,UAAU;AACnB,OAAO,aAAa;AACpB,OAAO,YAAY;AACnB,OAAO,kBAAkB;AAC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Z,UAAU;AAAA,MACZ,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA,EACH,CAAC;AACH;AAcO,IAAM,WAAW,WAAW,mBAAmB;AACtD,SAAS,cAAc;AACvB,IAAO,mBAAQ;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport { useIsPresent } from 'framer-motion';\nimport { speak } from '@wordpress/a11y';\nimport { useEffect, useLayoutEffect, useRef, forwardRef, renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport warning from '@wordpress/warning';\nimport Button from '../button';\nimport ExternalLink from '../external-link';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst NOTICE_TIMEOUT = 6000;\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n *\n * @param message Message to announce.\n * @param politeness Politeness to announce.\n */\nfunction useSpokenMessage(message, politeness) {\n const spokenMessage = typeof message === 'string' ? message : renderToString(message);\n useEffect(() => {\n if (spokenMessage) {\n speak(spokenMessage, politeness);\n }\n }, [spokenMessage, politeness]);\n}\nfunction UnforwardedSnackbar({\n className,\n children,\n spokenMessage = children,\n politeness = 'polite',\n actions = [],\n onRemove,\n icon = null,\n explicitDismiss = false,\n // onDismiss is a callback executed when the snackbar is dismissed.\n // It is distinct from onRemove, which _looks_ like a callback but is\n // actually the function to call to remove the snackbar from the UI.\n onDismiss,\n listRef\n}, ref) {\n const isPresent = useIsPresent();\n function dismissMe(event) {\n if (event && event.preventDefault) {\n event.preventDefault();\n }\n\n // Prevent focus loss by moving it to the list element.\n listRef?.current?.focus();\n onDismiss?.();\n onRemove?.();\n }\n function onActionClick(event, onClick) {\n event.stopPropagation();\n onRemove?.();\n if (onClick) {\n onClick(event);\n }\n }\n useSpokenMessage(spokenMessage, politeness);\n\n // The `onDismiss/onRemove` can have unstable references,\n // trigger side-effect cleanup, and reset timers.\n const callbacksRef = useRef({\n onDismiss,\n onRemove\n });\n useLayoutEffect(() => {\n callbacksRef.current = {\n onDismiss,\n onRemove\n };\n });\n useEffect(() => {\n if (explicitDismiss || !isPresent) {\n return;\n }\n const timeoutHandle = setTimeout(() => {\n callbacksRef.current.onDismiss?.();\n callbacksRef.current.onRemove?.();\n }, NOTICE_TIMEOUT);\n return () => clearTimeout(timeoutHandle);\n }, [explicitDismiss, isPresent]);\n const classes = clsx(className, 'components-snackbar', {\n 'components-snackbar-explicit-dismiss': !!explicitDismiss\n });\n if (actions && actions.length > 1) {\n // We need to inform developers that snackbar only accepts 1 action.\n globalThis.SCRIPT_DEBUG === true ? warning('Snackbar can only have one action. Use Notice if your message requires many actions.') : void 0;\n // return first element only while keeping it inside an array\n actions = [actions[0]];\n }\n const snackbarContentClassnames = clsx('components-snackbar__content', {\n 'components-snackbar__content-with-icon': !!icon\n });\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n className: classes,\n onClick: !explicitDismiss ? dismissMe : undefined,\n tabIndex: 0,\n role: !explicitDismiss ? 'button' : undefined,\n onKeyPress: !explicitDismiss ? dismissMe : undefined,\n \"aria-label\": !explicitDismiss ? __('Dismiss this notice') : undefined,\n \"data-testid\": \"snackbar\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: snackbarContentClassnames,\n children: [icon && /*#__PURE__*/_jsx(\"div\", {\n className: \"components-snackbar__icon\",\n children: icon\n }), children, actions.map(({\n label,\n onClick,\n url,\n openInNewTab = false\n }, index) => url !== undefined && openInNewTab ? /*#__PURE__*/_jsx(ExternalLink, {\n href: url,\n onClick: event => onActionClick(event, onClick),\n className: \"components-snackbar__action\",\n children: label\n }, index) : /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n href: url,\n variant: \"link\",\n onClick: event => onActionClick(event, onClick),\n className: \"components-snackbar__action\",\n children: label\n }, index)), explicitDismiss && /*#__PURE__*/_jsx(\"span\", {\n role: \"button\",\n \"aria-label\": __('Dismiss this notice'),\n tabIndex: 0,\n className: \"components-snackbar__dismiss-button\",\n onClick: dismissMe,\n onKeyPress: dismissMe,\n children: \"\\u2715\"\n })]\n })\n });\n}\n\n/**\n * A Snackbar displays a succinct message that is cleared out after a small delay.\n *\n * It can also offer the user options, like viewing a published post.\n * But these options should also be available elsewhere in the UI.\n *\n * ```jsx\n * const MySnackbarNotice = () => (\n * <Snackbar>Post published successfully.</Snackbar>\n * );\n * ```\n */\nexport const Snackbar = forwardRef(UnforwardedSnackbar);\nSnackbar.displayName = 'Snackbar';\nexport default Snackbar;"],
5
+ "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,oBAAoB;AAC7B,SAAS,aAAa;AACtB,SAAS,WAAW,iBAAiB,QAAQ,YAAY,sBAAsB;AAC/E,SAAS,UAAU;AACnB,OAAO,aAAa;AACpB,OAAO,YAAY;AACnB,OAAO,kBAAkB;AACzB,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,iBAAiB;AASvB,SAAS,iBAAiB,SAAS,YAAY;AAC7C,QAAM,gBAAgB,OAAO,YAAY,WAAW,UAAU,eAAe,OAAO;AACpF,YAAU,MAAM;AACd,QAAI,eAAe;AACjB,YAAM,eAAe,UAAU;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,eAAe,UAAU,CAAC;AAChC;AACA,SAAS,oBAAoB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,UAAU,CAAC;AAAA,EACX;AAAA,EACA,OAAO;AAAA,EACP,kBAAkB;AAAA;AAAA;AAAA;AAAA,EAIlB;AAAA,EACA;AACF,GAAG,KAAK;AACN,QAAM,YAAY,aAAa;AAC/B,WAAS,UAAU,OAAO;AACxB,QAAI,SAAS,MAAM,gBAAgB;AACjC,YAAM,eAAe;AAAA,IACvB;AAGA,aAAS,SAAS,MAAM;AACxB,gBAAY;AACZ,eAAW;AAAA,EACb;AACA,WAAS,cAAc,OAAO,SAAS;AACrC,UAAM,gBAAgB;AACtB,eAAW;AACX,QAAI,SAAS;AACX,cAAQ,KAAK;AAAA,IACf;AAAA,EAC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AAA,MACjB,GAAG,UAAU,QAAQ,UAAa,eAA4B,qBAAK,cAAc;AAAA,QAC/E,MAAM;AAAA,QACN,SAAS,WAAS,cAAc,OAAO,OAAO;AAAA,QAC9C,WAAW;AAAA,QACX,UAAU;AAAA,MACZ,GAAG,KAAK,IAAiB,qBAAK,QAAQ;AAAA,QACpC,uBAAuB;AAAA,QACvB,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS,WAAS,cAAc,OAAO,OAAO;AAAA,QAC9C,WAAW;AAAA,QACX,UAAU;AAAA,MACZ,GAAG,KAAK,CAAC,GAAG,mBAAgC,qBAAK,QAAQ;AAAA,QACvD,MAAM;AAAA,QACN,cAAc,GAAG,qBAAqB;AAAA,QACtC,UAAU;AAAA,QACV,WAAW;AAAA,QACX,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,UAAU;AAAA,MACZ,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA,EACH,CAAC;AACH;AAcO,IAAM,WAAW,WAAW,mBAAmB;AACtD,SAAS,cAAc;AACvB,IAAO,mBAAQ;",
6
6
  "names": []
7
7
  }
@@ -153,11 +153,11 @@ function useToolsPanelItem(props) {
153
153
  const isRegistered = menuItems?.[menuGroup]?.[label] !== void 0;
154
154
  const isValueSet = hasValue();
155
155
  useEffect(() => {
156
- if (!isShownByDefault && !isValueSet) {
156
+ if (!hasMatchingPanel || !isShownByDefault && !isValueSet) {
157
157
  return;
158
158
  }
159
159
  flagItemCustomization(isValueSet, label, menuGroup);
160
- }, [isValueSet, menuGroup, label, flagItemCustomization, isShownByDefault]);
160
+ }, [hasMatchingPanel, isValueSet, menuGroup, label, flagItemCustomization, isShownByDefault]);
161
161
  useEffect(() => {
162
162
  if (!isRegistered || isResetting || !hasMatchingPanel) {
163
163
  return;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tools-panel/tools-panel-item/hook.ts", "../../../../style-runtime/src/index.ts", "../../../src/tools-panel/style.module.scss"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport { usePrevious } from '@wordpress/compose';\nimport { useCallback, useEffect, useLayoutEffect } from '@wordpress/element';\nimport styles from '../style.module.scss';\nimport { useToolsPanelContext } from '../context';\nimport { useContextSystem } from '../../context';\nconst noop = () => {};\nexport function useToolsPanelItem(props) {\n const {\n className,\n hasValue,\n isShownByDefault = false,\n label,\n panelId,\n resetAllFilter = noop,\n onDeselect,\n onSelect,\n ...otherProps\n } = useContextSystem(props, 'ToolsPanelItem');\n const {\n panelId: currentPanelId,\n menuItems,\n registerResetAllFilter,\n deregisterResetAllFilter,\n registerPanelItem,\n deregisterPanelItem,\n flagItemCustomization,\n isResetting,\n shouldRenderPlaceholderItems: shouldRenderPlaceholder,\n firstDisplayedItem,\n lastDisplayedItem,\n __experimentalFirstVisibleItemClass,\n __experimentalLastVisibleItemClass\n } = useToolsPanelContext();\n\n // hasValue is a new function on every render, so do not add it as a\n // dependency to the useCallback hook! If needed, we should use a ref.\n const hasValueCallback = useCallback(hasValue, [panelId]);\n // resetAllFilter is a new function on every render, so do not add it as a\n // dependency to the useCallback hook! If needed, we should use a ref.\n const resetAllFilterCallback = useCallback(resetAllFilter, [panelId]);\n const previousPanelId = usePrevious(currentPanelId);\n const hasMatchingPanel = currentPanelId === panelId || currentPanelId === null;\n\n // Registering the panel item allows the panel to include it in its\n // automatically generated menu and determine its initial checked status.\n //\n // This is performed in a layout effect to ensure that the panel item\n // is registered before it is rendered preventing a rendering glitch.\n // See: https://github.com/WordPress/gutenberg/issues/56470\n useLayoutEffect(() => {\n if (hasMatchingPanel && previousPanelId !== null) {\n registerPanelItem({\n hasValue: hasValueCallback,\n isShownByDefault,\n label,\n panelId\n });\n }\n return () => {\n if (previousPanelId === null && !!currentPanelId || currentPanelId === panelId) {\n deregisterPanelItem(label);\n }\n };\n }, [currentPanelId, hasMatchingPanel, isShownByDefault, label, hasValueCallback, panelId, previousPanelId, registerPanelItem, deregisterPanelItem]);\n useEffect(() => {\n if (hasMatchingPanel) {\n registerResetAllFilter(resetAllFilterCallback);\n }\n return () => {\n if (hasMatchingPanel) {\n deregisterResetAllFilter(resetAllFilterCallback);\n }\n };\n }, [registerResetAllFilter, deregisterResetAllFilter, resetAllFilterCallback, hasMatchingPanel]);\n\n // Note: `label` is used as a key when building menu item state in\n // `ToolsPanel`.\n const menuGroup = isShownByDefault ? 'default' : 'optional';\n const isMenuItemChecked = menuItems?.[menuGroup]?.[label];\n const wasMenuItemChecked = usePrevious(isMenuItemChecked);\n const isRegistered = menuItems?.[menuGroup]?.[label] !== undefined;\n const isValueSet = hasValue();\n // Notify the panel when an item's value has changed except for optional\n // items without value because the item should not cause itself to hide.\n useEffect(() => {\n if (!isShownByDefault && !isValueSet) {\n return;\n }\n flagItemCustomization(isValueSet, label, menuGroup);\n }, [isValueSet, menuGroup, label, flagItemCustomization, isShownByDefault]);\n\n // Determine if the panel item's corresponding menu is being toggled and\n // trigger appropriate callback if it is.\n useEffect(() => {\n // We check whether this item is currently registered as items rendered\n // via fills can persist through the parent panel being remounted.\n // See: https://github.com/WordPress/gutenberg/pull/45673\n if (!isRegistered || isResetting || !hasMatchingPanel) {\n return;\n }\n if (isMenuItemChecked && !isValueSet && !wasMenuItemChecked) {\n onSelect?.();\n }\n if (!isMenuItemChecked && isValueSet && wasMenuItemChecked) {\n onDeselect?.();\n }\n }, [hasMatchingPanel, isMenuItemChecked, isRegistered, isResetting, isValueSet, wasMenuItemChecked, onSelect, onDeselect]);\n\n // The item is shown if it is a default control regardless of whether it\n // has a value. Optional items are shown when they are checked or have\n // a value.\n const isShown = isShownByDefault ? menuItems?.[menuGroup]?.[label] !== undefined : isMenuItemChecked;\n const shouldApplyPlaceholderStyles = shouldRenderPlaceholder && !isShown;\n const classes = clsx(styles['tools-panel-item'], shouldApplyPlaceholderStyles && styles['tools-panel-item-placeholder'], !shouldApplyPlaceholderStyles && className, firstDisplayedItem === label && __experimentalFirstVisibleItemClass, lastDisplayedItem === label && __experimentalLastVisibleItemClass);\n return {\n ...otherProps,\n isShown,\n shouldRenderPlaceholder,\n className: classes\n };\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"29b739f451\", \"._62d714739f4dc308__tools-panel{border-top:1px solid #ddd;margin-top:-1px;padding:16px}._40db7f4f897b683d__tools-panel-with-inner-wrapper>div:not(:first-of-type){column-gap:16px;display:grid;grid-column:1/-1;grid-template-columns:repeat(2,minmax(0,1fr));row-gap:16px}._95a15674966f30a3__tools-panel-hidden-inner-wrapper>div:not(:first-of-type){display:none}._322a049b9b7d8674__tools-panel-header{gap:8px;grid-column:1/-1}._322a049b9b7d8674__tools-panel-header .components-dropdown-menu{line-height:0;margin:-4px 0}._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header .components-dropdown-menu__toggle{min-width:24px;padding:0}.b92a382d3b30104d__tools-panel-heading.b92a382d3b30104d__tools-panel-heading{font-size:inherit;line-height:normal;margin:0}._8005d68fffa9db91__tools-panel-item{grid-column:1/-1}._8005d68fffa9db91__tools-panel-item>div,._8005d68fffa9db91__tools-panel-item>fieldset{margin-bottom:0;max-width:100%;padding-bottom:0}._8005d68fffa9db91__tools-panel-item .components-base-control__help,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control .components-base-control__field:last-child{margin-bottom:0}._4f55e1a6e373746e__tools-panel-item-placeholder{display:none}.d40032517bff9e12__dropdown-menu{min-width:200px}.f135b96aa96ca6bb__reset-label{color:var(--wp-components-color-accent-darker-10,var(--wp-admin-theme-color-darker-10,#2145e6));font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:1.4;margin-inline-start:12px;text-transform:uppercase}._69b138dfa5570d9c__default-controls-item{color:#1e1e1e}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]{color:#757575;opacity:1}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]:hover{color:#757575}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true] .f135b96aa96ca6bb__reset-label{opacity:.3}\");\n}\nexport default {\"tools-panel\":\"_62d714739f4dc308__tools-panel\",\"tools-panel-with-inner-wrapper\":\"_40db7f4f897b683d__tools-panel-with-inner-wrapper\",\"tools-panel-hidden-inner-wrapper\":\"_95a15674966f30a3__tools-panel-hidden-inner-wrapper\",\"tools-panel-header\":\"_322a049b9b7d8674__tools-panel-header\",\"tools-panel-heading\":\"b92a382d3b30104d__tools-panel-heading\",\"tools-panel-item\":\"_8005d68fffa9db91__tools-panel-item\",\"tools-panel-item-placeholder\":\"_4f55e1a6e373746e__tools-panel-item-placeholder\",\"dropdown-menu\":\"d40032517bff9e12__dropdown-menu\",\"reset-label\":\"f135b96aa96ca6bb__reset-label\",\"default-controls-item\":\"_69b138dfa5570d9c__default-controls-item\"};\n"],
5
- "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,mBAAmB;AAC5B,SAAS,aAAa,WAAW,uBAAuB;;;ACFxD,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa,oBAAoB,MAAM,MAAM;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAUA,SAAS,YAAY,gBAAgB,MAAM,KAAK;AAC9C,MAAI,CAAC,eAAe,MAAM;AACxB;AAAA,EACF;AACA,QAAM,UAAU,WAAW;AAC3B,MAAI,iBAAiB,QAAQ,eAAe,IAAI,cAAc;AAC9D,MAAI,CAAC,gBAAgB;AACnB,qBAAiB,oBAAI,IAAI;AACzB,YAAQ,eAAe,IAAI,gBAAgB,cAAc;AAAA,EAC3D;AACA,MAAI,eAAe,IAAI,IAAI,GAAG;AAC5B;AAAA,EACF;AAKA,MAAI,0BAA0B,gBAAgB,IA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YAAY,SAAS,IAAI,KAAK;AACxD,QAAM,qBAAqB,YAAY,iBAAiB;AACxD,QAAM,eAAe,YAAY,SAAS,IAAI,KAAK,MAAM;AACzD,QAAM,aAAa,SAAS;AAG5B,YAAU,MAAM;AACd,QAAI,CAAC,oBAAoB,CAAC,YAAY;AACpC;AAAA,IACF;AACA,0BAAsB,YAAY,OAAO,SAAS;AAAA,EACpD,GAAG,CAAC,YAAY,WAAW,OAAO,uBAAuB,gBAAgB,CAAC;AAI1E,YAAU,MAAM;AAId,QAAI,CAAC,gBAAgB,eAAe,CAAC,kBAAkB;AACrD;AAAA,IACF;AACA,QAAI,qBAAqB,CAAC,cAAc,CAAC,oBAAoB;AAC3D,iBAAW;AAAA,IACb;AACA,QAAI,CAAC,qBAAqB,cAAc,oBAAoB;AAC1D,mBAAa;AAAA,IACf;AAAA,EACF,GAAG,CAAC,kBAAkB,mBAAmB,cAAc,aAAa,YAAY,oBAAoB,UAAU,UAAU,CAAC;AAKzH,QAAM,UAAU,mBAAmB,YAAY,SAAS,IAAI,KAAK,MAAM,SAAY;AACnF,QAAM,+BAA+B,2BAA2B,CAAC;AACjE,QAAM,UAAU,KAAK,qBAAO,kBAAkB,GAAG,gCAAgC,qBAAO,8BAA8B,GAAG,CAAC,gCAAgC,WAAW,uBAAuB,SAAS,qCAAqC,sBAAsB,SAAS,kCAAkC;AAC3S,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA,WAAW;AAAA,EACb;AACF;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport { usePrevious } from '@wordpress/compose';\nimport { useCallback, useEffect, useLayoutEffect } from '@wordpress/element';\nimport styles from '../style.module.scss';\nimport { useToolsPanelContext } from '../context';\nimport { useContextSystem } from '../../context';\nconst noop = () => {};\nexport function useToolsPanelItem(props) {\n const {\n className,\n hasValue,\n isShownByDefault = false,\n label,\n panelId,\n resetAllFilter = noop,\n onDeselect,\n onSelect,\n ...otherProps\n } = useContextSystem(props, 'ToolsPanelItem');\n const {\n panelId: currentPanelId,\n menuItems,\n registerResetAllFilter,\n deregisterResetAllFilter,\n registerPanelItem,\n deregisterPanelItem,\n flagItemCustomization,\n isResetting,\n shouldRenderPlaceholderItems: shouldRenderPlaceholder,\n firstDisplayedItem,\n lastDisplayedItem,\n __experimentalFirstVisibleItemClass,\n __experimentalLastVisibleItemClass\n } = useToolsPanelContext();\n\n // hasValue is a new function on every render, so do not add it as a\n // dependency to the useCallback hook! If needed, we should use a ref.\n const hasValueCallback = useCallback(hasValue, [panelId]);\n // resetAllFilter is a new function on every render, so do not add it as a\n // dependency to the useCallback hook! If needed, we should use a ref.\n const resetAllFilterCallback = useCallback(resetAllFilter, [panelId]);\n const previousPanelId = usePrevious(currentPanelId);\n const hasMatchingPanel = currentPanelId === panelId || currentPanelId === null;\n\n // Registering the panel item allows the panel to include it in its\n // automatically generated menu and determine its initial checked status.\n //\n // This is performed in a layout effect to ensure that the panel item\n // is registered before it is rendered preventing a rendering glitch.\n // See: https://github.com/WordPress/gutenberg/issues/56470\n useLayoutEffect(() => {\n if (hasMatchingPanel && previousPanelId !== null) {\n registerPanelItem({\n hasValue: hasValueCallback,\n isShownByDefault,\n label,\n panelId\n });\n }\n return () => {\n if (previousPanelId === null && !!currentPanelId || currentPanelId === panelId) {\n deregisterPanelItem(label);\n }\n };\n }, [currentPanelId, hasMatchingPanel, isShownByDefault, label, hasValueCallback, panelId, previousPanelId, registerPanelItem, deregisterPanelItem]);\n useEffect(() => {\n if (hasMatchingPanel) {\n registerResetAllFilter(resetAllFilterCallback);\n }\n return () => {\n if (hasMatchingPanel) {\n deregisterResetAllFilter(resetAllFilterCallback);\n }\n };\n }, [registerResetAllFilter, deregisterResetAllFilter, resetAllFilterCallback, hasMatchingPanel]);\n\n // Note: `label` is used as a key when building menu item state in\n // `ToolsPanel`.\n const menuGroup = isShownByDefault ? 'default' : 'optional';\n const isMenuItemChecked = menuItems?.[menuGroup]?.[label];\n const wasMenuItemChecked = usePrevious(isMenuItemChecked);\n const isRegistered = menuItems?.[menuGroup]?.[label] !== undefined;\n const isValueSet = hasValue();\n // Notify the panel when an item's value has changed except for optional\n // items without value because the item should not cause itself to hide.\n // Items that don't belong to the panel on screen stay silent, otherwise\n // they would leave an orphaned entry in its menu.\n useEffect(() => {\n if (!hasMatchingPanel || !isShownByDefault && !isValueSet) {\n return;\n }\n flagItemCustomization(isValueSet, label, menuGroup);\n }, [hasMatchingPanel, isValueSet, menuGroup, label, flagItemCustomization, isShownByDefault]);\n\n // Determine if the panel item's corresponding menu is being toggled and\n // trigger appropriate callback if it is.\n useEffect(() => {\n // We check whether this item is currently registered as items rendered\n // via fills can persist through the parent panel being remounted.\n // See: https://github.com/WordPress/gutenberg/pull/45673\n if (!isRegistered || isResetting || !hasMatchingPanel) {\n return;\n }\n if (isMenuItemChecked && !isValueSet && !wasMenuItemChecked) {\n onSelect?.();\n }\n if (!isMenuItemChecked && isValueSet && wasMenuItemChecked) {\n onDeselect?.();\n }\n }, [hasMatchingPanel, isMenuItemChecked, isRegistered, isResetting, isValueSet, wasMenuItemChecked, onSelect, onDeselect]);\n\n // The item is shown if it is a default control regardless of whether it\n // has a value. Optional items are shown when they are checked or have\n // a value.\n const isShown = isShownByDefault ? menuItems?.[menuGroup]?.[label] !== undefined : isMenuItemChecked;\n const shouldApplyPlaceholderStyles = shouldRenderPlaceholder && !isShown;\n const classes = clsx(styles['tools-panel-item'], shouldApplyPlaceholderStyles && styles['tools-panel-item-placeholder'], !shouldApplyPlaceholderStyles && className, firstDisplayedItem === label && __experimentalFirstVisibleItemClass, lastDisplayedItem === label && __experimentalLastVisibleItemClass);\n return {\n ...otherProps,\n isShown,\n shouldRenderPlaceholder,\n className: classes\n };\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"29b739f451\", \"._62d714739f4dc308__tools-panel{border-top:1px solid #ddd;margin-top:-1px;padding:16px}._40db7f4f897b683d__tools-panel-with-inner-wrapper>div:not(:first-of-type){column-gap:16px;display:grid;grid-column:1/-1;grid-template-columns:repeat(2,minmax(0,1fr));row-gap:16px}._95a15674966f30a3__tools-panel-hidden-inner-wrapper>div:not(:first-of-type){display:none}._322a049b9b7d8674__tools-panel-header{gap:8px;grid-column:1/-1}._322a049b9b7d8674__tools-panel-header .components-dropdown-menu{line-height:0;margin:-4px 0}._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header .components-dropdown-menu__toggle{min-width:24px;padding:0}.b92a382d3b30104d__tools-panel-heading.b92a382d3b30104d__tools-panel-heading{font-size:inherit;line-height:normal;margin:0}._8005d68fffa9db91__tools-panel-item{grid-column:1/-1}._8005d68fffa9db91__tools-panel-item>div,._8005d68fffa9db91__tools-panel-item>fieldset{margin-bottom:0;max-width:100%;padding-bottom:0}._8005d68fffa9db91__tools-panel-item .components-base-control__help,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control .components-base-control__field:last-child{margin-bottom:0}._4f55e1a6e373746e__tools-panel-item-placeholder{display:none}.d40032517bff9e12__dropdown-menu{min-width:200px}.f135b96aa96ca6bb__reset-label{color:var(--wp-components-color-accent-darker-10,var(--wp-admin-theme-color-darker-10,#2145e6));font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:1.4;margin-inline-start:12px;text-transform:uppercase}._69b138dfa5570d9c__default-controls-item{color:#1e1e1e}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]{color:#757575;opacity:1}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]:hover{color:#757575}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true] .f135b96aa96ca6bb__reset-label{opacity:.3}\");\n}\nexport default {\"tools-panel\":\"_62d714739f4dc308__tools-panel\",\"tools-panel-with-inner-wrapper\":\"_40db7f4f897b683d__tools-panel-with-inner-wrapper\",\"tools-panel-hidden-inner-wrapper\":\"_95a15674966f30a3__tools-panel-hidden-inner-wrapper\",\"tools-panel-header\":\"_322a049b9b7d8674__tools-panel-header\",\"tools-panel-heading\":\"b92a382d3b30104d__tools-panel-heading\",\"tools-panel-item\":\"_8005d68fffa9db91__tools-panel-item\",\"tools-panel-item-placeholder\":\"_4f55e1a6e373746e__tools-panel-item-placeholder\",\"dropdown-menu\":\"d40032517bff9e12__dropdown-menu\",\"reset-label\":\"f135b96aa96ca6bb__reset-label\",\"default-controls-item\":\"_69b138dfa5570d9c__default-controls-item\"};\n"],
5
+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AACA,0BAAsB,YAAY,OAAO,SAAS;AAAA,EACpD,GAAG,CAAC,kBAAkB,YAAY,WAAW,OAAO,uBAAuB,gBAAgB,CAAC;AAI5F,YAAU,MAAM;AAId,QAAI,CAAC,gBAAgB,eAAe,CAAC,kBAAkB;AACrD;AAAA,IACF;AACA,QAAI,qBAAqB,CAAC,cAAc,CAAC,oBAAoB;AAC3D,iBAAW;AAAA,IACb;AACA,QAAI,CAAC,qBAAqB,cAAc,oBAAoB;AAC1D,mBAAa;AAAA,IACf;AAAA,EACF,GAAG,CAAC,kBAAkB,mBAAmB,cAAc,aAAa,YAAY,oBAAoB,UAAU,UAAU,CAAC;AAKzH,QAAM,UAAU,mBAAmB,YAAY,SAAS,IAAI,KAAK,MAAM,SAAY;AACnF,QAAM,+BAA+B,2BAA2B,CAAC;AACjE,QAAM,UAAU,KAAK,qBAAO,kBAAkB,GAAG,gCAAgC,qBAAO,8BAA8B,GAAG,CAAC,gCAAgC,WAAW,uBAAuB,SAAS,qCAAqC,sBAAsB,SAAS,kCAAkC;AAC3S,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA,WAAW;AAAA,EACb;AACF;",
6
6
  "names": []
7
7
  }
@@ -21,7 +21,9 @@ export type BorderBoxControlProps = ColorProps & LabelProps & Pick<BorderControl
21
21
  */
22
22
  popoverPlacement?: PopoverProps['placement'];
23
23
  /**
24
- * The space between the popover and the control wrapper.
24
+ * The space between the popover and the control wrapper. A number
25
+ * displaces the popover along its main axis; pass an object to also
26
+ * displace it along its cross axis.
25
27
  */
26
28
  popoverOffset?: PopoverProps['offset'];
27
29
  /**
@@ -66,7 +68,9 @@ export type SplitControlsProps = ColorProps & Pick<BorderBoxControlProps, 'enabl
66
68
  */
67
69
  popoverPlacement?: PopoverProps['placement'];
68
70
  /**
69
- * The space between the popover and the control wrapper.
71
+ * The space between the popover and the control wrapper. A number
72
+ * displaces the popover along its main axis; pass an object to also
73
+ * displace it along its cross axis.
70
74
  */
71
75
  popoverOffset?: PopoverProps['offset'];
72
76
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/border-box-control/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,MAAM,EACN,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,MAAM,OAAO,GAAG;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AACrD,MAAM,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC;AACtC,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAC7C,UAAU,GACV,IAAI,CACH,kBAAkB,EAClB,aAAa,GAAG,uBAAuB,GAAG,MAAM,CAChD,GAAG;IACH;;;;OAIG;IACH,QAAQ,EAAE,CAAE,KAAK,EAAE,SAAS,KAAM,IAAI,CAAC;IACvC;;OAEG;IACH,gBAAgB,CAAC,EAAE,YAAY,CAAE,WAAW,CAAE,CAAC;IAC/C;;OAEG;IACH,aAAa,CAAC,EAAE,YAAY,CAAE,QAAQ,CAAE,CAAC;IACzC;;;;;;OAMG;IACH,KAAK,EAAE,SAAS,CAAC;CACjB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG;IAC/B;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC7B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO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AY,CAAE,WAAW,CAAE,CAAC;IAC/C;;;;OAIG;IACH,aAAa,CAAC,EAAE,YAAY,CAAE,QAAQ,CAAE,CAAC;IACzC;;;;;;OAMG;IACH,KAAK,EAAE,SAAS,CAAC;CACjB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG;IAC/B;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC7B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAC1C,IAAI,CAAE,qBAAqB,EAAE,aAAa,CAAE,GAAG;IAC9C;;;OAGG;IACH,QAAQ,EAAE,CAAE,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,UAAU,KAAM,IAAI,CAAC;IAClE;;OAEG;IACH,gBAAgB,CAAC,EAAE,YAAY,CAAE,WAAW,CAAE,CAAC;IAC/C;;;;OAIG;IACH,aAAa,CAAC,EAAE,YAAY,CAAE,QAAQ,CAAE,CAAC;IACzC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"context-system-provider.d.ts","sourceRoot":"","sources":["../../src/context/context-system-provider.js"],"names":[],"mappings":"AAaA,eAAO,MAAM,iBAAiB,8CAE7B,CAAC;AAGF,eAAO,MAAM,oBAAoB,2BAAwC,CAAC;AAiD1E;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,yBAAyB,GANI,CAAC,SAAtB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAI,uBAEjC;IAAiC,QAAQ,EAAjC,KAAK,CAAC,SAAS,CACvB;IAAiC,KAAK,EAA9B,CAAC,CACT;CAAA,KAAS,KAAK,CAAC,GAAG,CAAC,OAUrB,CAAC;AAEF,eAAO,MAAM,qBAAqB,uEAAoC,CAAC"}
1
+ {"version":3,"file":"context-system-provider.d.ts","sourceRoot":"","sources":["../../src/context/context-system-provider.jsx"],"names":[],"mappings":"AAaA,eAAO,MAAM,iBAAiB,8CAE7B,CAAC;AAGF,eAAO,MAAM,oBAAoB,2BAAwC,CAAC;AAiD1E;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,yBAAyB,GANI,CAAC,SAAtB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAI,uBAEjC;IAAiC,QAAQ,EAAjC,KAAK,CAAC,SAAS,CACvB;IAAiC,KAAK,EAA9B,CAAC,CACT;CAAA,KAAS,KAAK,CAAC,GAAG,CAAC,OAUrB,CAAC;AAEF,eAAO,MAAM,qBAAqB,uEAAoC,CAAC"}
@@ -100,9 +100,13 @@ export type PopoverProps = {
100
100
  */
101
101
  noArrow?: boolean;
102
102
  /**
103
- * The distance (in px) between the anchor and the popover.
103
+ * The distance (in px) between the anchor and the popover. Pass an object to
104
+ * also displace the popover along its cross axis.
104
105
  */
105
- offset?: number;
106
+ offset?: number | {
107
+ mainAxis?: number;
108
+ crossAxis?: number;
109
+ };
106
110
  /**
107
111
  * A callback invoked when the popover should be closed.
108
112
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/popover/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEzE,KAAK,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACjD,KAAK,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AACjD,KAAK,cAAc,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM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,EAAE,MAAM,iBAAiB,CAAC;AAyKpD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;uCAAoC,CAAC;eAG3C,QAAQ"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/snackbar/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA4KpD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;uCAAoC,CAAC;eAG3C,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/tools-panel/tools-panel-item/hook.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAIpD,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,uBAAuB,CAAE,mBAAmB,EAAE,KAAK,CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwK5D"}
1
+ {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/tools-panel/tools-panel-item/hook.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAIpD,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,uBAAuB,CAAE,mBAAmB,EAAE,KAAK,CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2K5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/components",
3
- "version": "40.0.0",
3
+ "version": "40.1.1-next.v.202608281122.0",
4
4
  "description": "UI components for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -62,27 +62,27 @@
62
62
  "@types/gradient-parser": "^1.1.0",
63
63
  "@types/highlight-words-core": "^1.2.1",
64
64
  "@use-gesture/react": "^10.3.1",
65
- "@wordpress/a11y": "^4.54.0",
66
- "@wordpress/base-styles": "^13.0.0",
67
- "@wordpress/compose": "^8.7.0",
68
- "@wordpress/date": "^5.54.0",
69
- "@wordpress/deprecated": "^4.54.0",
70
- "@wordpress/dom": "^4.54.0",
71
- "@wordpress/element": "^8.6.0",
72
- "@wordpress/escape-html": "^3.54.0",
73
- "@wordpress/hooks": "^4.54.0",
74
- "@wordpress/html-entities": "^4.54.0",
75
- "@wordpress/i18n": "^6.27.0",
76
- "@wordpress/icons": "^15.5.0",
77
- "@wordpress/is-shallow-equal": "^5.54.0",
78
- "@wordpress/kebab-case": "^1.1.0",
79
- "@wordpress/keycodes": "^4.54.0",
80
- "@wordpress/primitives": "^4.54.0",
81
- "@wordpress/private-apis": "^1.54.0",
82
- "@wordpress/rich-text": "^7.54.0",
83
- "@wordpress/style-runtime": "^0.10.0",
84
- "@wordpress/ui": "^0.21.0",
85
- "@wordpress/warning": "^3.54.0",
65
+ "@wordpress/a11y": "^4.54.1-next.v.202608281122.0",
66
+ "@wordpress/base-styles": "^13.0.1-next.v.202608281122.0",
67
+ "@wordpress/compose": "^8.7.2-next.v.202608281122.0",
68
+ "@wordpress/date": "^5.54.1-next.v.202608281122.0",
69
+ "@wordpress/deprecated": "^4.54.1-next.v.202608281122.0",
70
+ "@wordpress/dom": "^4.54.1-next.v.202608281122.0",
71
+ "@wordpress/element": "^8.6.2-next.v.202608281122.0",
72
+ "@wordpress/escape-html": "^3.54.1-next.v.202608281122.0",
73
+ "@wordpress/hooks": "^4.54.1-next.v.202608281122.0",
74
+ "@wordpress/html-entities": "^4.54.1-next.v.202608281122.0",
75
+ "@wordpress/i18n": "^6.27.1-next.v.202608281122.0",
76
+ "@wordpress/icons": "^15.5.1-next.v.202608281122.0",
77
+ "@wordpress/is-shallow-equal": "^5.54.1-next.v.202608281122.0",
78
+ "@wordpress/kebab-case": "^1.1.1-next.v.202608281122.0",
79
+ "@wordpress/keycodes": "^4.54.1-next.v.202608281122.0",
80
+ "@wordpress/primitives": "^4.54.2-next.v.202608281122.0",
81
+ "@wordpress/private-apis": "^1.54.1-next.v.202608281122.0",
82
+ "@wordpress/rich-text": "^7.54.1-next.v.202608281122.0",
83
+ "@wordpress/style-runtime": "^0.10.1-next.v.202608281122.0",
84
+ "@wordpress/ui": "^0.22.1-next.v.202608281122.0",
85
+ "@wordpress/warning": "^3.54.1-next.v.202608281122.0",
86
86
  "change-case": "^4.1.2",
87
87
  "clsx": "^2.1.1",
88
88
  "colord": "^2.9.3",
@@ -111,7 +111,7 @@
111
111
  "@testing-library/user-event": "^14.6.1",
112
112
  "@types/jest": "^30.0.0",
113
113
  "@types/react-dom": "^18.3.1",
114
- "@wordpress/jest-console": "^9.2.0",
114
+ "@wordpress/jest-console": "^9.2.1-next.v.202608281122.0",
115
115
  "@wordpress/stylelint-tools": "file:../../tools/stylelint",
116
116
  "snapshot-diff": "^0.10.0",
117
117
  "storybook": "^10.5.3",
@@ -130,5 +130,5 @@
130
130
  "publishConfig": {
131
131
  "access": "public"
132
132
  },
133
- "gitHead": "5ef24f60261976bb198ad035db24bf81c1fb92b4"
133
+ "gitHead": "de479d415171765f7b573c81aeec5334ff506a12"
134
134
  }
@@ -130,9 +130,9 @@ The available base placements are 'top', 'right', 'bottom', 'left'. Each of thes
130
130
 
131
131
  - Required: No
132
132
 
133
- ### `popoverOffset`: `number`
133
+ ### `popoverOffset`: `number | { mainAxis?: number; crossAxis?: number }`
134
134
 
135
- The space between the popover and the control wrapper.
135
+ The space between the popover and the control wrapper. A number displaces the popover along its main axis; pass an object to also displace it along its cross axis.
136
136
 
137
137
  - Required: No
138
138
 
@@ -34,7 +34,9 @@ export type BorderBoxControlProps = ColorProps &
34
34
  */
35
35
  popoverPlacement?: PopoverProps[ 'placement' ];
36
36
  /**
37
- * The space between the popover and the control wrapper.
37
+ * The space between the popover and the control wrapper. A number
38
+ * displaces the popover along its main axis; pass an object to also
39
+ * displace it along its cross axis.
38
40
  */
39
41
  popoverOffset?: PopoverProps[ 'offset' ];
40
42
  /**
@@ -83,7 +85,9 @@ export type SplitControlsProps = ColorProps &
83
85
  */
84
86
  popoverPlacement?: PopoverProps[ 'placement' ];
85
87
  /**
86
- * The space between the popover and the control wrapper.
88
+ * The space between the popover and the control wrapper. A number
89
+ * displaces the popover along its main axis; pass an object to also
90
+ * displace it along its cross axis.
87
91
  */
88
92
  popoverOffset?: PopoverProps[ 'offset' ];
89
93
  /**
@@ -3,7 +3,7 @@
3
3
  exports[`props should render _override props 1`] = `
4
4
  <div>
5
5
  <div
6
- class="components-component test-component css-16wk7jz-View emotion-0"
6
+ class="components-component test-component css-1c3028l-View emotion-0"
7
7
  data-wp-c16t="true"
8
8
  data-wp-component="Component"
9
9
  >
@@ -15,7 +15,7 @@ exports[`props should render _override props 1`] = `
15
15
  exports[`props should render context props 1`] = `
16
16
  <div>
17
17
  <div
18
- class="components-component css-16wk7jz-View emotion-0"
18
+ class="components-component css-1c3028l-View emotion-0"
19
19
  data-wp-c16t="true"
20
20
  data-wp-component="Component"
21
21
  >
@@ -27,7 +27,7 @@ exports[`props should render context props 1`] = `
27
27
  exports[`props should render correctly 1`] = `
28
28
  <div>
29
29
  <div
30
- class="components-component css-16wk7jz-View emotion-0"
30
+ class="components-component css-1c3028l-View emotion-0"
31
31
  data-wp-c16t="true"
32
32
  data-wp-component="Component"
33
33
  />
@@ -183,9 +183,9 @@ Used to show/hide the arrow that points at the popover's anchor.
183
183
  - Required: No
184
184
  - Default: `true`
185
185
 
186
- ### `offset`: `number`
186
+ ### `offset`: `number | { mainAxis?: number; crossAxis?: number }`
187
187
 
188
- The distance (in px) between the anchor and the popover.
188
+ The distance (in px) between the anchor and the popover. A number displaces the popover along its main axis; pass an object to also displace it along its cross axis.
189
189
 
190
190
  - Required: No
191
191
 
@@ -174,6 +174,29 @@ describe( 'Popover', () => {
174
174
  } );
175
175
  } );
176
176
 
177
+ describe( 'offset', () => {
178
+ it( 'should displace the popover along its cross axis when passed an offset object', async () => {
179
+ render(
180
+ <Popover
181
+ placement="right-start"
182
+ offset={ { mainAxis: 16, crossAxis: 24 } }
183
+ animate={ false }
184
+ flip={ false }
185
+ shift={ false }
186
+ data-testid="popover-element"
187
+ >
188
+ Hello
189
+ </Popover>
190
+ );
191
+ const popover = screen.getByTestId( 'popover-element' );
192
+
193
+ await waitFor( () => expect( popover ).toBeVisible() );
194
+ expect( popover ).toHaveStyle(
195
+ 'transform: translateX(16px) translateY(24px)'
196
+ );
197
+ } );
198
+ } );
199
+
177
200
  describe( 'style', () => {
178
201
  it( 'outputs inline styles added through the style prop in addition to built-in popover positioning styles', async () => {
179
202
  render(
@@ -105,9 +105,15 @@ export type PopoverProps = {
105
105
  */
106
106
  noArrow?: boolean;
107
107
  /**
108
- * The distance (in px) between the anchor and the popover.
109
- */
110
- offset?: number;
108
+ * The distance (in px) between the anchor and the popover. Pass an object to
109
+ * also displace the popover along its cross axis.
110
+ */
111
+ offset?:
112
+ | number
113
+ | {
114
+ mainAxis?: number;
115
+ crossAxis?: number;
116
+ };
111
117
  /**
112
118
  * A callback invoked when the popover should be closed.
113
119
  */
@@ -1,5 +1,6 @@
1
1
  import type { ForwardedRef, KeyboardEvent, MouseEvent } from 'react';
2
2
  import clsx from 'clsx';
3
+ import { useIsPresent } from 'framer-motion';
3
4
  import { speak } from '@wordpress/a11y';
4
5
  import {
5
6
  useEffect,
@@ -57,6 +58,8 @@ function UnforwardedSnackbar(
57
58
  }: WordPressComponentProps< SnackbarProps, 'div' >,
58
59
  ref: ForwardedRef< any >
59
60
  ) {
61
+ const isPresent = useIsPresent();
62
+
60
63
  function dismissMe( event: KeyboardEvent | MouseEvent ) {
61
64
  if ( event && event.preventDefault ) {
62
65
  event.preventDefault();
@@ -92,16 +95,17 @@ function UnforwardedSnackbar(
92
95
  } );
93
96
 
94
97
  useEffect( () => {
95
- // Only set up the timeout dismiss if we're not explicitly dismissing.
98
+ if ( explicitDismiss || ! isPresent ) {
99
+ return;
100
+ }
101
+
96
102
  const timeoutHandle = setTimeout( () => {
97
- if ( ! explicitDismiss ) {
98
- callbacksRef.current.onDismiss?.();
99
- callbacksRef.current.onRemove?.();
100
- }
103
+ callbacksRef.current.onDismiss?.();
104
+ callbacksRef.current.onRemove?.();
101
105
  }, NOTICE_TIMEOUT );
102
106
 
103
107
  return () => clearTimeout( timeoutHandle );
104
- }, [ explicitDismiss ] );
108
+ }, [ explicitDismiss, isPresent ] );
105
109
 
106
110
  const classes = clsx( className, 'components-snackbar', {
107
111
  'components-snackbar-explicit-dismiss': !! explicitDismiss,
@@ -1,4 +1,4 @@
1
- import { render, screen, within } from '@testing-library/react';
1
+ import { act, fireEvent, render, screen, within } from '@testing-library/react';
2
2
  import { click } from '@ariakit/test';
3
3
  import { speak } from '@wordpress/a11y';
4
4
  import { SVG, Path } from '@wordpress/primitives';
@@ -14,6 +14,10 @@ describe( 'Snackbar', () => {
14
14
  mockedSpeak.mockReset();
15
15
  } );
16
16
 
17
+ afterEach( () => {
18
+ jest.useRealTimers();
19
+ } );
20
+
17
21
  it( 'should render correctly', () => {
18
22
  render( <Snackbar>Message</Snackbar> );
19
23
 
@@ -44,6 +48,22 @@ describe( 'Snackbar', () => {
44
48
  expect( icon ).toBeVisible();
45
49
  } );
46
50
 
51
+ it( 'should not restart auto-dismissal after an unrelated rerender', async () => {
52
+ jest.useFakeTimers();
53
+ const removeNotice = jest.fn();
54
+ const { rerender } = render(
55
+ <Snackbar onRemove={ () => removeNotice() }>Message</Snackbar>
56
+ );
57
+
58
+ await act( async () => jest.advanceTimersByTime( 5000 ) );
59
+ rerender(
60
+ <Snackbar onRemove={ () => removeNotice() }>Message</Snackbar>
61
+ );
62
+ await act( async () => jest.advanceTimersByTime( 1000 ) );
63
+
64
+ expect( removeNotice ).toHaveBeenCalledTimes( 1 );
65
+ } );
66
+
47
67
  it( 'should be dismissible by clicking the snackbar', async () => {
48
68
  const onRemove = jest.fn();
49
69
  const onDismiss = jest.fn();
@@ -69,6 +89,7 @@ describe( 'Snackbar', () => {
69
89
  } );
70
90
 
71
91
  it( 'should not be dismissible by clicking the snackbar when the `explicitDismiss` prop is set to `true`', async () => {
92
+ jest.useFakeTimers();
72
93
  const onRemove = jest.fn();
73
94
  const onDismiss = jest.fn();
74
95
 
@@ -93,7 +114,12 @@ describe( 'Snackbar', () => {
93
114
  'components-snackbar-explicit-dismiss'
94
115
  );
95
116
 
96
- await click( snackbar );
117
+ fireEvent.click( snackbar );
118
+
119
+ expect( onRemove ).not.toHaveBeenCalled();
120
+ expect( onDismiss ).not.toHaveBeenCalled();
121
+
122
+ await act( async () => jest.advanceTimersByTime( 6000 ) );
97
123
 
98
124
  expect( onRemove ).not.toHaveBeenCalled();
99
125
  expect( onDismiss ).not.toHaveBeenCalled();
@@ -1,12 +1,19 @@
1
- import { render, screen } from '@testing-library/react';
1
+ import { act, render, screen } from '@testing-library/react';
2
2
  import { click } from '@ariakit/test';
3
+ import { useEffect, useState } from '@wordpress/element';
3
4
  import SnackbarList from '../list';
4
5
 
6
+ jest.mock( '@wordpress/compose', () => ( {
7
+ ...jest.requireActual( '@wordpress/compose' ),
8
+ useReducedMotion: () => false,
9
+ } ) );
10
+
5
11
  window.scrollTo = jest.fn();
6
12
 
7
13
  describe( 'SnackbarList', () => {
8
14
  afterEach( () => {
9
15
  jest.resetAllMocks();
16
+ jest.useRealTimers();
10
17
  } );
11
18
 
12
19
  it( 'should get focus after a snackbar is dismissed', async () => {
@@ -36,4 +43,57 @@ describe( 'SnackbarList', () => {
36
43
 
37
44
  expect( screen.getByTestId( 'snackbar-list' ) ).toHaveFocus();
38
45
  } );
46
+
47
+ it( 'should restart auto-dismissal when a notice is replaced with the same ID', async () => {
48
+ jest.useFakeTimers();
49
+ const onRemove = jest.fn();
50
+ const notice = {
51
+ id: 'ID_1',
52
+ content: 'A collaborator joined.',
53
+ };
54
+
55
+ function RecreatedNotice() {
56
+ const [ notices, setNotices ] = useState( [ notice ] );
57
+ const [ shouldRecreate, setShouldRecreate ] = useState( false );
58
+
59
+ useEffect( () => {
60
+ if ( ! shouldRecreate ) {
61
+ return;
62
+ }
63
+
64
+ const timeoutHandle = setTimeout( () => {
65
+ setNotices( [ { ...notice } ] );
66
+ setShouldRecreate( false );
67
+ }, 50 );
68
+
69
+ return () => clearTimeout( timeoutHandle );
70
+ }, [ shouldRecreate ] );
71
+
72
+ return (
73
+ <SnackbarList
74
+ notices={ notices }
75
+ onRemove={ ( id ) => {
76
+ onRemove( id );
77
+ setNotices( [] );
78
+ setShouldRecreate( true );
79
+ } }
80
+ />
81
+ );
82
+ }
83
+
84
+ render( <RecreatedNotice /> );
85
+
86
+ await act( async () => jest.advanceTimersByTime( 6000 ) );
87
+ expect( onRemove ).toHaveBeenCalledTimes( 1 );
88
+
89
+ // Recreate the notice before its 100ms exit animation completes.
90
+ await act( async () => jest.advanceTimersByTime( 50 ) );
91
+
92
+ expect( screen.getByTestId( 'snackbar' ) ).toHaveTextContent(
93
+ notice.content
94
+ );
95
+
96
+ await act( async () => jest.advanceTimersByTime( 6000 ) );
97
+ expect( onRemove ).toHaveBeenCalledTimes( 2 );
98
+ } );
39
99
  } );
@@ -1153,6 +1153,45 @@ describe( 'ToolsPanel', () => {
1153
1153
  expect( altControlProps.onDeselect ).not.toHaveBeenCalled();
1154
1154
  } );
1155
1155
 
1156
+ it( 'should not contain menu items for an item belonging to another panel', async () => {
1157
+ // A fill can mount after the panel it is rendered into has already
1158
+ // settled. An item whose `panelId` doesn't match must stay out of
1159
+ // that panel's menu entirely, including out of the value flagging
1160
+ // that populates it.
1161
+ const Panel = ( { withForeign }: { withForeign: boolean } ) => (
1162
+ <ToolsPanel { ...defaultProps } panelId="1234">
1163
+ <ToolsPanelItem
1164
+ label="Mine"
1165
+ panelId="1234"
1166
+ isShownByDefault
1167
+ hasValue={ () => false }
1168
+ >
1169
+ <div>My control</div>
1170
+ </ToolsPanelItem>
1171
+ { withForeign && (
1172
+ <ToolsPanelItem
1173
+ label="Foreign"
1174
+ panelId="9999"
1175
+ hasValue={ () => true }
1176
+ >
1177
+ <div>Foreign control</div>
1178
+ </ToolsPanelItem>
1179
+ ) }
1180
+ </ToolsPanel>
1181
+ );
1182
+
1183
+ // Let the panel settle with only its own item registered, then
1184
+ // bring in an item that belongs to a different panel.
1185
+ const { rerender } = render( <Panel withForeign={ false } /> );
1186
+ rerender( <Panel withForeign /> );
1187
+
1188
+ await openDropdownMenu();
1189
+
1190
+ expect(
1191
+ screen.queryByRole( 'menuitemcheckbox', { name: /Foreign/i } )
1192
+ ).not.toBeInTheDocument();
1193
+ } );
1194
+
1156
1195
  it( 'should not contain orphaned menu items when panelId changes', async () => {
1157
1196
  // As fills and the panel can update independently this aims to
1158
1197
  // test that no orphaned items appear registered in the panel menu.
@@ -113,13 +113,16 @@ export function useToolsPanelItem(
113
113
  const isValueSet = hasValue();
114
114
  // Notify the panel when an item's value has changed except for optional
115
115
  // items without value because the item should not cause itself to hide.
116
+ // Items that don't belong to the panel on screen stay silent, otherwise
117
+ // they would leave an orphaned entry in its menu.
116
118
  useEffect( () => {
117
- if ( ! isShownByDefault && ! isValueSet ) {
119
+ if ( ! hasMatchingPanel || ( ! isShownByDefault && ! isValueSet ) ) {
118
120
  return;
119
121
  }
120
122
 
121
123
  flagItemCustomization( isValueSet, label, menuGroup );
122
124
  }, [
125
+ hasMatchingPanel,
123
126
  isValueSet,
124
127
  menuGroup,
125
128
  label,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes