@wordpress/components 30.2.1-next.f34ab90e9.0 → 30.3.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 (176) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/build/card/context.js +1 -0
  3. package/build/card/context.js.map +1 -1
  4. package/build/circular-option-picker/circular-option-picker-context.js +1 -0
  5. package/build/circular-option-picker/circular-option-picker-context.js.map +1 -1
  6. package/build/composite/context.js +1 -0
  7. package/build/composite/context.js.map +1 -1
  8. package/build/context/context-connect.js.map +1 -1
  9. package/build/context/context-system-provider.js +1 -0
  10. package/build/context/context-system-provider.js.map +1 -1
  11. package/build/custom-select-control-v2/custom-select.js +1 -0
  12. package/build/custom-select-control-v2/custom-select.js.map +1 -1
  13. package/build/disabled/index.js +1 -0
  14. package/build/disabled/index.js.map +1 -1
  15. package/build/item-group/context.js +1 -0
  16. package/build/item-group/context.js.map +1 -1
  17. package/build/menu/context.js +1 -0
  18. package/build/menu/context.js.map +1 -1
  19. package/build/modal/index.js +1 -0
  20. package/build/modal/index.js.map +1 -1
  21. package/build/navigation/context.js +1 -0
  22. package/build/navigation/context.js.map +1 -1
  23. package/build/navigation/group/context.js +1 -0
  24. package/build/navigation/group/context.js.map +1 -1
  25. package/build/navigation/menu/context.js +1 -0
  26. package/build/navigation/menu/context.js.map +1 -1
  27. package/build/navigator/context.js +1 -0
  28. package/build/navigator/context.js.map +1 -1
  29. package/build/popover/index.js +1 -0
  30. package/build/popover/index.js.map +1 -1
  31. package/build/radio-group/context.js +1 -0
  32. package/build/radio-group/context.js.map +1 -1
  33. package/build/slot-fill/bubbles-virtually/slot-fill-context.js +1 -0
  34. package/build/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
  35. package/build/slot-fill/context.js +1 -0
  36. package/build/slot-fill/context.js.map +1 -1
  37. package/build/tabs/context.js +1 -0
  38. package/build/tabs/context.js.map +1 -1
  39. package/build/tabs/styles.js +5 -5
  40. package/build/tabs/styles.js.map +1 -1
  41. package/build/toggle-group-control/context.js +1 -0
  42. package/build/toggle-group-control/context.js.map +1 -1
  43. package/build/toolbar/toolbar-context/index.js +1 -0
  44. package/build/toolbar/toolbar-context/index.js.map +1 -1
  45. package/build/tools-panel/context.js +1 -0
  46. package/build/tools-panel/context.js.map +1 -1
  47. package/build/tooltip/index.js +1 -0
  48. package/build/tooltip/index.js.map +1 -1
  49. package/build/tree-grid/roving-tab-index-context.js +1 -0
  50. package/build/tree-grid/roving-tab-index-context.js.map +1 -1
  51. package/build/utils/font-size.js.map +1 -1
  52. package/build/utils/get-valid-children.js.map +1 -1
  53. package/build/validated-form-controls/control-with-error.js +16 -16
  54. package/build/validated-form-controls/control-with-error.js.map +1 -1
  55. package/build-module/card/context.js +1 -0
  56. package/build-module/card/context.js.map +1 -1
  57. package/build-module/circular-option-picker/circular-option-picker-context.js +1 -0
  58. package/build-module/circular-option-picker/circular-option-picker-context.js.map +1 -1
  59. package/build-module/composite/context.js +1 -0
  60. package/build-module/composite/context.js.map +1 -1
  61. package/build-module/context/context-connect.js.map +1 -1
  62. package/build-module/context/context-system-provider.js +1 -0
  63. package/build-module/context/context-system-provider.js.map +1 -1
  64. package/build-module/custom-select-control-v2/custom-select.js +1 -0
  65. package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
  66. package/build-module/disabled/index.js +1 -0
  67. package/build-module/disabled/index.js.map +1 -1
  68. package/build-module/item-group/context.js +1 -0
  69. package/build-module/item-group/context.js.map +1 -1
  70. package/build-module/menu/context.js +1 -0
  71. package/build-module/menu/context.js.map +1 -1
  72. package/build-module/modal/index.js +1 -0
  73. package/build-module/modal/index.js.map +1 -1
  74. package/build-module/navigation/context.js +1 -0
  75. package/build-module/navigation/context.js.map +1 -1
  76. package/build-module/navigation/group/context.js +1 -0
  77. package/build-module/navigation/group/context.js.map +1 -1
  78. package/build-module/navigation/menu/context.js +1 -0
  79. package/build-module/navigation/menu/context.js.map +1 -1
  80. package/build-module/navigator/context.js +1 -0
  81. package/build-module/navigator/context.js.map +1 -1
  82. package/build-module/popover/index.js +1 -0
  83. package/build-module/popover/index.js.map +1 -1
  84. package/build-module/radio-group/context.js +1 -0
  85. package/build-module/radio-group/context.js.map +1 -1
  86. package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js +1 -0
  87. package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
  88. package/build-module/slot-fill/context.js +1 -0
  89. package/build-module/slot-fill/context.js.map +1 -1
  90. package/build-module/tabs/context.js +1 -0
  91. package/build-module/tabs/context.js.map +1 -1
  92. package/build-module/tabs/styles.js +6 -6
  93. package/build-module/tabs/styles.js.map +1 -1
  94. package/build-module/toggle-group-control/context.js +1 -0
  95. package/build-module/toggle-group-control/context.js.map +1 -1
  96. package/build-module/toolbar/toolbar-context/index.js +1 -0
  97. package/build-module/toolbar/toolbar-context/index.js.map +1 -1
  98. package/build-module/tools-panel/context.js +1 -0
  99. package/build-module/tools-panel/context.js.map +1 -1
  100. package/build-module/tooltip/index.js +1 -0
  101. package/build-module/tooltip/index.js.map +1 -1
  102. package/build-module/tree-grid/roving-tab-index-context.js +1 -0
  103. package/build-module/tree-grid/roving-tab-index-context.js.map +1 -1
  104. package/build-module/utils/font-size.js.map +1 -1
  105. package/build-module/utils/get-valid-children.js.map +1 -1
  106. package/build-module/validated-form-controls/control-with-error.js +16 -16
  107. package/build-module/validated-form-controls/control-with-error.js.map +1 -1
  108. package/build-types/calendar/stories/date-calendar.story.d.ts.map +1 -1
  109. package/build-types/calendar/stories/date-range-calendar.story.d.ts.map +1 -1
  110. package/build-types/card/context.d.ts.map +1 -1
  111. package/build-types/composite/context.d.ts.map +1 -1
  112. package/build-types/context/context-connect.d.ts +2 -2
  113. package/build-types/context/context-connect.d.ts.map +1 -1
  114. package/build-types/context/context-system-provider.d.ts.map +1 -1
  115. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
  116. package/build-types/disabled/index.d.ts.map +1 -1
  117. package/build-types/item-group/context.d.ts.map +1 -1
  118. package/build-types/modal/index.d.ts.map +1 -1
  119. package/build-types/navigation/context.d.ts.map +1 -1
  120. package/build-types/navigation/group/context.d.ts.map +1 -1
  121. package/build-types/navigation/menu/context.d.ts.map +1 -1
  122. package/build-types/popover/index.d.ts +1 -1
  123. package/build-types/popover/index.d.ts.map +1 -1
  124. package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
  125. package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts.map +1 -1
  126. package/build-types/slot-fill/context.d.ts.map +1 -1
  127. package/build-types/tabs/context.d.ts.map +1 -1
  128. package/build-types/tabs/styles.d.ts.map +1 -1
  129. package/build-types/toggle-group-control/context.d.ts.map +1 -1
  130. package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -1
  131. package/build-types/tools-panel/context.d.ts.map +1 -1
  132. package/build-types/tooltip/index.d.ts.map +1 -1
  133. package/build-types/tree-grid/roving-tab-index-context.d.ts.map +1 -1
  134. package/build-types/utils/font-size.d.ts +2 -2
  135. package/build-types/utils/font-size.d.ts.map +1 -1
  136. package/build-types/utils/get-valid-children.d.ts +2 -2
  137. package/build-types/utils/get-valid-children.d.ts.map +1 -1
  138. package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -1
  139. package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
  140. package/build-types/validated-form-controls/test/control-with-error.d.ts +2 -0
  141. package/build-types/validated-form-controls/test/control-with-error.d.ts.map +1 -0
  142. package/package.json +20 -20
  143. package/src/calendar/stories/date-calendar.story.tsx +1 -0
  144. package/src/calendar/stories/date-range-calendar.story.tsx +1 -0
  145. package/src/card/context.ts +2 -0
  146. package/src/circular-option-picker/circular-option-picker-context.tsx +1 -0
  147. package/src/composite/context.tsx +1 -0
  148. package/src/context/context-connect.ts +2 -2
  149. package/src/context/context-system-provider.js +2 -0
  150. package/src/custom-select-control-v2/custom-select.tsx +1 -0
  151. package/src/disabled/index.tsx +2 -0
  152. package/src/item-group/context.ts +1 -0
  153. package/src/menu/context.tsx +1 -0
  154. package/src/modal/index.tsx +1 -0
  155. package/src/navigation/context.tsx +3 -0
  156. package/src/navigation/group/context.tsx +1 -0
  157. package/src/navigation/menu/context.tsx +2 -0
  158. package/src/navigator/context.ts +1 -0
  159. package/src/popover/index.tsx +1 -0
  160. package/src/radio-group/context.tsx +1 -0
  161. package/src/slot-fill/bubbles-virtually/slot-fill-context.ts +1 -0
  162. package/src/slot-fill/context.ts +1 -0
  163. package/src/tabs/context.ts +1 -0
  164. package/src/tabs/styles.ts +2 -1
  165. package/src/toggle-group-control/context.ts +2 -0
  166. package/src/toolbar/toolbar-context/index.ts +1 -0
  167. package/src/tools-panel/context.ts +1 -0
  168. package/src/tools-panel/stories/index.story.tsx +3 -3
  169. package/src/tooltip/index.tsx +1 -0
  170. package/src/tree-grid/roving-tab-index-context.ts +2 -0
  171. package/src/utils/font-size.ts +2 -2
  172. package/src/utils/get-valid-children.ts +4 -2
  173. package/src/validated-form-controls/components/stories/overview.story.tsx +109 -27
  174. package/src/validated-form-controls/control-with-error.tsx +19 -18
  175. package/src/validated-form-controls/test/control-with-error.tsx +224 -0
  176. package/tsconfig.tsbuildinfo +1 -1
@@ -14,6 +14,7 @@ var _element = require("@wordpress/element");
14
14
  */
15
15
 
16
16
  const ToggleGroupControlContext = (0, _element.createContext)({});
17
+ ToggleGroupControlContext.displayName = 'ToggleGroupControlContext';
17
18
  const useToggleGroupControlContext = () => (0, _element.useContext)(ToggleGroupControlContext);
18
19
  exports.useToggleGroupControlContext = useToggleGroupControlContext;
19
20
  var _default = exports.default = ToggleGroupControlContext;
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","ToggleGroupControlContext","createContext","useToggleGroupControlContext","useContext","exports","_default","default"],"sources":["@wordpress/components/src/toggle-group-control/context.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ToggleGroupControlContextProps } from './types';\n\nconst ToggleGroupControlContext = createContext(\n\t{} as ToggleGroupControlContextProps\n);\nexport const useToggleGroupControlContext = () =>\n\tuseContext( ToggleGroupControlContext );\nexport default ToggleGroupControlContext;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMC,yBAAyB,GAAG,IAAAC,sBAAa,EAC9C,CAAC,CACF,CAAC;AACM,MAAMC,4BAA4B,GAAGA,CAAA,KAC3C,IAAAC,mBAAU,EAAEH,yBAA0B,CAAC;AAACI,OAAA,CAAAF,4BAAA,GAAAA,4BAAA;AAAA,IAAAG,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAC1BN,yBAAyB","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","ToggleGroupControlContext","createContext","displayName","useToggleGroupControlContext","useContext","exports","_default","default"],"sources":["@wordpress/components/src/toggle-group-control/context.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ToggleGroupControlContextProps } from './types';\n\nconst ToggleGroupControlContext = createContext(\n\t{} as ToggleGroupControlContextProps\n);\nToggleGroupControlContext.displayName = 'ToggleGroupControlContext';\n\nexport const useToggleGroupControlContext = () =>\n\tuseContext( ToggleGroupControlContext );\nexport default ToggleGroupControlContext;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMC,yBAAyB,GAAG,IAAAC,sBAAa,EAC9C,CAAC,CACF,CAAC;AACDD,yBAAyB,CAACE,WAAW,GAAG,2BAA2B;AAE5D,MAAMC,4BAA4B,GAAGA,CAAA,KAC3C,IAAAC,mBAAU,EAAEJ,yBAA0B,CAAC;AAACK,OAAA,CAAAF,4BAAA,GAAAA,4BAAA;AAAA,IAAAG,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAC1BP,yBAAyB","ignoreList":[]}
@@ -14,5 +14,6 @@ var _element = require("@wordpress/element");
14
14
  */
15
15
 
16
16
  const ToolbarContext = (0, _element.createContext)(undefined);
17
+ ToolbarContext.displayName = 'ToolbarContext';
17
18
  var _default = exports.default = ToolbarContext;
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","ToolbarContext","createContext","undefined","_default","exports","default"],"sources":["@wordpress/components/src/toolbar/toolbar-context/index.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nconst ToolbarContext = createContext< Ariakit.ToolbarStore | undefined >(\n\tundefined\n);\n\nexport default ToolbarContext;\n"],"mappings":";;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMC,cAAc,GAAG,IAAAC,sBAAa,EACnCC,SACD,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaL,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","ToolbarContext","createContext","undefined","displayName","_default","exports","default"],"sources":["@wordpress/components/src/toolbar/toolbar-context/index.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nconst ToolbarContext = createContext< Ariakit.ToolbarStore | undefined >(\n\tundefined\n);\nToolbarContext.displayName = 'ToolbarContext';\n\nexport default ToolbarContext;\n"],"mappings":";;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMC,cAAc,GAAG,IAAAC,sBAAa,EACnCC,SACD,CAAC;AACDF,cAAc,CAACG,WAAW,GAAG,gBAAgB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE/BN,cAAc","ignoreList":[]}
@@ -29,6 +29,7 @@ const ToolsPanelContext = exports.ToolsPanelContext = (0, _element.createContext
29
29
  deregisterResetAllFilter: noop,
30
30
  areAllOptionalControlsHidden: true
31
31
  });
32
+ ToolsPanelContext.displayName = 'ToolsPanelContext';
32
33
  const useToolsPanelContext = () => (0, _element.useContext)(ToolsPanelContext);
33
34
  exports.useToolsPanelContext = useToolsPanelContext;
34
35
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","noop","undefined","ToolsPanelContext","exports","createContext","menuItems","default","optional","hasMenuItems","isResetting","shouldRenderPlaceholderItems","registerPanelItem","deregisterPanelItem","flagItemCustomization","registerResetAllFilter","deregisterResetAllFilter","areAllOptionalControlsHidden","useToolsPanelContext","useContext"],"sources":["@wordpress/components/src/tools-panel/context.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ToolsPanelContext as ToolsPanelContextType } from './types';\n\nconst noop = () => undefined;\n\nexport const ToolsPanelContext = createContext< ToolsPanelContextType >( {\n\tmenuItems: { default: {}, optional: {} },\n\thasMenuItems: false,\n\tisResetting: false,\n\tshouldRenderPlaceholderItems: false,\n\tregisterPanelItem: noop,\n\tderegisterPanelItem: noop,\n\tflagItemCustomization: noop,\n\tregisterResetAllFilter: noop,\n\tderegisterResetAllFilter: noop,\n\tareAllOptionalControlsHidden: true,\n} );\n\nexport const useToolsPanelContext = () =>\n\tuseContext< ToolsPanelContextType >( ToolsPanelContext );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMC,IAAI,GAAGA,CAAA,KAAMC,SAAS;AAErB,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,IAAAE,sBAAa,EAA2B;EACxEC,SAAS,EAAE;IAAEC,OAAO,EAAE,CAAC,CAAC;IAAEC,QAAQ,EAAE,CAAC;EAAE,CAAC;EACxCC,YAAY,EAAE,KAAK;EACnBC,WAAW,EAAE,KAAK;EAClBC,4BAA4B,EAAE,KAAK;EACnCC,iBAAiB,EAAEX,IAAI;EACvBY,mBAAmB,EAAEZ,IAAI;EACzBa,qBAAqB,EAAEb,IAAI;EAC3Bc,sBAAsB,EAAEd,IAAI;EAC5Be,wBAAwB,EAAEf,IAAI;EAC9BgB,4BAA4B,EAAE;AAC/B,CAAE,CAAC;AAEI,MAAMC,oBAAoB,GAAGA,CAAA,KACnC,IAAAC,mBAAU,EAA2BhB,iBAAkB,CAAC;AAACC,OAAA,CAAAc,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","noop","undefined","ToolsPanelContext","exports","createContext","menuItems","default","optional","hasMenuItems","isResetting","shouldRenderPlaceholderItems","registerPanelItem","deregisterPanelItem","flagItemCustomization","registerResetAllFilter","deregisterResetAllFilter","areAllOptionalControlsHidden","displayName","useToolsPanelContext","useContext"],"sources":["@wordpress/components/src/tools-panel/context.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ToolsPanelContext as ToolsPanelContextType } from './types';\n\nconst noop = () => undefined;\n\nexport const ToolsPanelContext = createContext< ToolsPanelContextType >( {\n\tmenuItems: { default: {}, optional: {} },\n\thasMenuItems: false,\n\tisResetting: false,\n\tshouldRenderPlaceholderItems: false,\n\tregisterPanelItem: noop,\n\tderegisterPanelItem: noop,\n\tflagItemCustomization: noop,\n\tregisterResetAllFilter: noop,\n\tderegisterResetAllFilter: noop,\n\tareAllOptionalControlsHidden: true,\n} );\nToolsPanelContext.displayName = 'ToolsPanelContext';\n\nexport const useToolsPanelContext = () =>\n\tuseContext< ToolsPanelContextType >( ToolsPanelContext );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMC,IAAI,GAAGA,CAAA,KAAMC,SAAS;AAErB,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,IAAAE,sBAAa,EAA2B;EACxEC,SAAS,EAAE;IAAEC,OAAO,EAAE,CAAC,CAAC;IAAEC,QAAQ,EAAE,CAAC;EAAE,CAAC;EACxCC,YAAY,EAAE,KAAK;EACnBC,WAAW,EAAE,KAAK;EAClBC,4BAA4B,EAAE,KAAK;EACnCC,iBAAiB,EAAEX,IAAI;EACvBY,mBAAmB,EAAEZ,IAAI;EACzBa,qBAAqB,EAAEb,IAAI;EAC3Bc,sBAAsB,EAAEd,IAAI;EAC5Be,wBAAwB,EAAEf,IAAI;EAC9BgB,4BAA4B,EAAE;AAC/B,CAAE,CAAC;AACHd,iBAAiB,CAACe,WAAW,GAAG,mBAAmB;AAE5C,MAAMC,oBAAoB,GAAGA,CAAA,KACnC,IAAAC,mBAAU,EAA2BjB,iBAAkB,CAAC;AAACC,OAAA,CAAAe,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -30,6 +30,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
30
30
  const TooltipInternalContext = (0, _element.createContext)({
31
31
  isNestedInTooltip: false
32
32
  });
33
+ TooltipInternalContext.displayName = 'TooltipInternalContext';
33
34
 
34
35
  /**
35
36
  * Time over anchor to wait before showing tooltip
@@ -1 +1 @@
1
- {"version":3,"names":["Ariakit","_interopRequireWildcard","require","_clsx","_interopRequireDefault","_compose","_element","_deprecated","_shortcut","_utils","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","TooltipInternalContext","createContext","isNestedInTooltip","TOOLTIP_DELAY","exports","CONTEXT_VALUE","UnforwardedTooltip","props","ref","children","className","delay","hideOnClick","placement","position","shortcut","text","restProps","useContext","baseId","useInstanceId","Tooltip","describedById","undefined","isOnlyChild","Children","count","process","env","NODE_ENV","console","error","computedPlacement","positionToPlacement","deprecated","since","alternative","tooltipStore","useTooltipStore","showTimeout","mounted","useStoreState","jsx","Role","render","addDescribedById","element","cloneElement","jsxs","Provider","value","TooltipAnchor","onClick","hide","store","clsx","unmountOnHide","gutter","id","overflowPadding","forwardRef","_default"],"sources":["@wordpress/components/src/tooltip/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tChildren,\n\tuseContext,\n\tcreateContext,\n\tforwardRef,\n\tcloneElement,\n} from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tTooltipProps,\n\tTooltipInternalContext as TooltipInternalContextType,\n} from './types';\nimport Shortcut from '../shortcut';\nimport { positionToPlacement } from '../popover/utils';\n\nconst TooltipInternalContext = createContext< TooltipInternalContextType >( {\n\tisNestedInTooltip: false,\n} );\n\n/**\n * Time over anchor to wait before showing tooltip\n */\nexport const TOOLTIP_DELAY = 700;\n\nconst CONTEXT_VALUE = {\n\tisNestedInTooltip: true,\n};\n\nfunction UnforwardedTooltip(\n\tprops: TooltipProps,\n\tref: React.ForwardedRef< any >\n) {\n\tconst {\n\t\tchildren,\n\t\tclassName,\n\t\tdelay = TOOLTIP_DELAY,\n\t\thideOnClick = true,\n\t\tplacement,\n\t\tposition,\n\t\tshortcut,\n\t\ttext,\n\n\t\t...restProps\n\t} = props;\n\n\tconst { isNestedInTooltip } = useContext( TooltipInternalContext );\n\n\tconst baseId = useInstanceId( Tooltip, 'tooltip' );\n\tconst describedById = text || shortcut ? baseId : undefined;\n\n\tconst isOnlyChild = Children.count( children ) === 1;\n\t// console error if more than one child element is added\n\tif ( ! isOnlyChild ) {\n\t\tif ( 'development' === process.env.NODE_ENV ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'wp-components.Tooltip should be called with only a single child element.'\n\t\t\t);\n\t\t}\n\t}\n\n\t// Compute tooltip's placement:\n\t// - give priority to `placement` prop, if defined\n\t// - otherwise, compute it from the legacy `position` prop (if defined)\n\t// - finally, fallback to the default placement: 'bottom'\n\tlet computedPlacement;\n\tif ( placement !== undefined ) {\n\t\tcomputedPlacement = placement;\n\t} else if ( position !== undefined ) {\n\t\tcomputedPlacement = positionToPlacement( position );\n\t\tdeprecated( '`position` prop in wp.components.tooltip', {\n\t\t\tsince: '6.4',\n\t\t\talternative: '`placement` prop',\n\t\t} );\n\t}\n\tcomputedPlacement = computedPlacement || 'bottom';\n\n\tconst tooltipStore = Ariakit.useTooltipStore( {\n\t\tplacement: computedPlacement,\n\t\tshowTimeout: delay,\n\t} );\n\tconst mounted = Ariakit.useStoreState( tooltipStore, 'mounted' );\n\n\tif ( isNestedInTooltip ) {\n\t\treturn isOnlyChild ? (\n\t\t\t<Ariakit.Role { ...restProps } render={ children } />\n\t\t) : (\n\t\t\tchildren\n\t\t);\n\t}\n\n\t// TODO: this is a temporary workaround to minimize the effects of the\n\t// Ariakit upgrade. Ariakit doesn't pass the `aria-describedby` prop to\n\t// the tooltip anchor anymore since 0.4.0, so we need to add it manually.\n\t// The `aria-describedby` attribute is added only if the anchor doesn't have\n\t// one already, and if the tooltip text is not the same as the anchor's\n\t// `aria-label`\n\t// See: https://github.com/WordPress/gutenberg/pull/64066\n\t// See: https://github.com/WordPress/gutenberg/pull/65989\n\tfunction addDescribedById( element: React.ReactElement ) {\n\t\treturn describedById &&\n\t\t\tmounted &&\n\t\t\telement.props[ 'aria-describedby' ] === undefined &&\n\t\t\telement.props[ 'aria-label' ] !== text\n\t\t\t? cloneElement( element, { 'aria-describedby': describedById } )\n\t\t\t: element;\n\t}\n\n\treturn (\n\t\t<TooltipInternalContext.Provider value={ CONTEXT_VALUE }>\n\t\t\t<Ariakit.TooltipAnchor\n\t\t\t\tonClick={ hideOnClick ? tooltipStore.hide : undefined }\n\t\t\t\tstore={ tooltipStore }\n\t\t\t\trender={\n\t\t\t\t\tisOnlyChild ? addDescribedById( children ) : undefined\n\t\t\t\t}\n\t\t\t\tref={ ref }\n\t\t\t>\n\t\t\t\t{ isOnlyChild ? undefined : children }\n\t\t\t</Ariakit.TooltipAnchor>\n\t\t\t{ isOnlyChild && ( text || shortcut ) && (\n\t\t\t\t<Ariakit.Tooltip\n\t\t\t\t\t{ ...restProps }\n\t\t\t\t\tclassName={ clsx( 'components-tooltip', className ) }\n\t\t\t\t\tunmountOnHide\n\t\t\t\t\tgutter={ 4 }\n\t\t\t\t\tid={ describedById }\n\t\t\t\t\toverflowPadding={ 0.5 }\n\t\t\t\t\tstore={ tooltipStore }\n\t\t\t\t>\n\t\t\t\t\t{ text }\n\t\t\t\t\t{ shortcut && (\n\t\t\t\t\t\t<Shortcut\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\ttext ? 'components-tooltip__shortcut' : ''\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Ariakit.Tooltip>\n\t\t\t) }\n\t\t</TooltipInternalContext.Provider>\n\t);\n}\nexport const Tooltip = forwardRef( UnforwardedTooltip );\n\nexport default Tooltip;\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAOA,IAAAK,WAAA,GAAAH,sBAAA,CAAAF,OAAA;AASA,IAAAM,SAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAuD,IAAAQ,WAAA,GAAAR,OAAA;AAAA,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YA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C,aAAa;MACbC,MAAM,EAAG,CAAG;MACZC,EAAE,EAAGpC,aAAe;MACpBqC,eAAe,EAAG,GAAK;MACvBL,KAAK,EAAGjB,YAAc;MAAA5B,QAAA,GAEpBO,IAAI,EACJD,QAAQ,iBACT,IAAApC,WAAA,CAAA+D,GAAA,EAACjE,SAAA,CAAAS,OAAQ;QACRwB,SAAS,EACRM,IAAI,GAAG,8BAA8B,GAAG,EACxC;QACDD,QAAQ,EAAGA;MAAU,CACrB,CACD;IAAA,CACe,CACjB;EAAA,CAC+B,CAAC;AAEpC;AACO,MAAMM,OAAO,GAAAjB,OAAA,CAAAiB,OAAA,GAAG,IAAAuC,mBAAU,EAAEtD,kBAAmB,CAAC;AAAC,IAAAuD,QAAA,GAAAzD,OAAA,CAAAlB,OAAA,GAEzCmC,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["Ariakit","_interopRequireWildcard","require","_clsx","_interopRequireDefault","_compose","_element","_deprecated","_shortcut","_utils","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","TooltipInternalContext","createContext","isNestedInTooltip","displayName","TOOLTIP_DELAY","exports","CONTEXT_VALUE","UnforwardedTooltip","props","ref","children","className","delay","hideOnClick","placement","position","shortcut","text","restProps","useContext","baseId","useInstanceId","Tooltip","describedById","undefined","isOnlyChild","Children","count","process","env","NODE_ENV","console","error","computedPlacement","positionToPlacement","deprecated","since","alternative","tooltipStore","useTooltipStore","showTimeout","mounted","useStoreState","jsx","Role","render","addDescribedById","element","cloneElement","jsxs","Provider","value","TooltipAnchor","onClick","hide","store","clsx","unmountOnHide","gutter","id","overflowPadding","forwardRef","_default"],"sources":["@wordpress/components/src/tooltip/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tChildren,\n\tuseContext,\n\tcreateContext,\n\tforwardRef,\n\tcloneElement,\n} from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tTooltipProps,\n\tTooltipInternalContext as TooltipInternalContextType,\n} from './types';\nimport Shortcut from '../shortcut';\nimport { positionToPlacement } from '../popover/utils';\n\nconst TooltipInternalContext = createContext< TooltipInternalContextType >( {\n\tisNestedInTooltip: false,\n} );\nTooltipInternalContext.displayName = 'TooltipInternalContext';\n\n/**\n * Time over anchor to wait before showing tooltip\n */\nexport const TOOLTIP_DELAY = 700;\n\nconst CONTEXT_VALUE = {\n\tisNestedInTooltip: true,\n};\n\nfunction UnforwardedTooltip(\n\tprops: TooltipProps,\n\tref: React.ForwardedRef< any >\n) {\n\tconst {\n\t\tchildren,\n\t\tclassName,\n\t\tdelay = TOOLTIP_DELAY,\n\t\thideOnClick = true,\n\t\tplacement,\n\t\tposition,\n\t\tshortcut,\n\t\ttext,\n\n\t\t...restProps\n\t} = props;\n\n\tconst { isNestedInTooltip } = useContext( TooltipInternalContext );\n\n\tconst baseId = useInstanceId( Tooltip, 'tooltip' );\n\tconst describedById = text || shortcut ? baseId : undefined;\n\n\tconst isOnlyChild = Children.count( children ) === 1;\n\t// console error if more than one child element is added\n\tif ( ! isOnlyChild ) {\n\t\tif ( 'development' === process.env.NODE_ENV ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'wp-components.Tooltip should be called with only a single child element.'\n\t\t\t);\n\t\t}\n\t}\n\n\t// Compute tooltip's placement:\n\t// - give priority to `placement` prop, if defined\n\t// - otherwise, compute it from the legacy `position` prop (if defined)\n\t// - finally, fallback to the default placement: 'bottom'\n\tlet computedPlacement;\n\tif ( placement !== undefined ) {\n\t\tcomputedPlacement = placement;\n\t} else if ( position !== undefined ) {\n\t\tcomputedPlacement = positionToPlacement( position );\n\t\tdeprecated( '`position` prop in wp.components.tooltip', {\n\t\t\tsince: '6.4',\n\t\t\talternative: '`placement` prop',\n\t\t} );\n\t}\n\tcomputedPlacement = computedPlacement || 'bottom';\n\n\tconst tooltipStore = Ariakit.useTooltipStore( {\n\t\tplacement: computedPlacement,\n\t\tshowTimeout: delay,\n\t} );\n\tconst mounted = Ariakit.useStoreState( tooltipStore, 'mounted' );\n\n\tif ( isNestedInTooltip ) {\n\t\treturn isOnlyChild ? (\n\t\t\t<Ariakit.Role { ...restProps } render={ children } />\n\t\t) : (\n\t\t\tchildren\n\t\t);\n\t}\n\n\t// TODO: this is a temporary workaround to minimize the effects of the\n\t// Ariakit upgrade. Ariakit doesn't pass the `aria-describedby` prop to\n\t// the tooltip anchor anymore since 0.4.0, so we need to add it manually.\n\t// The `aria-describedby` attribute is added only if the anchor doesn't have\n\t// one already, and if the tooltip text is not the same as the anchor's\n\t// `aria-label`\n\t// See: https://github.com/WordPress/gutenberg/pull/64066\n\t// See: https://github.com/WordPress/gutenberg/pull/65989\n\tfunction addDescribedById( element: React.ReactElement ) {\n\t\treturn describedById &&\n\t\t\tmounted &&\n\t\t\telement.props[ 'aria-describedby' ] === undefined &&\n\t\t\telement.props[ 'aria-label' ] !== text\n\t\t\t? cloneElement( element, { 'aria-describedby': describedById } )\n\t\t\t: element;\n\t}\n\n\treturn (\n\t\t<TooltipInternalContext.Provider value={ CONTEXT_VALUE }>\n\t\t\t<Ariakit.TooltipAnchor\n\t\t\t\tonClick={ hideOnClick ? tooltipStore.hide : undefined }\n\t\t\t\tstore={ tooltipStore }\n\t\t\t\trender={\n\t\t\t\t\tisOnlyChild ? addDescribedById( children ) : undefined\n\t\t\t\t}\n\t\t\t\tref={ ref }\n\t\t\t>\n\t\t\t\t{ isOnlyChild ? undefined : children }\n\t\t\t</Ariakit.TooltipAnchor>\n\t\t\t{ isOnlyChild && ( text || shortcut ) && (\n\t\t\t\t<Ariakit.Tooltip\n\t\t\t\t\t{ ...restProps }\n\t\t\t\t\tclassName={ clsx( 'components-tooltip', className ) }\n\t\t\t\t\tunmountOnHide\n\t\t\t\t\tgutter={ 4 }\n\t\t\t\t\tid={ describedById }\n\t\t\t\t\toverflowPadding={ 0.5 }\n\t\t\t\t\tstore={ tooltipStore }\n\t\t\t\t>\n\t\t\t\t\t{ text }\n\t\t\t\t\t{ shortcut && (\n\t\t\t\t\t\t<Shortcut\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\ttext ? 'components-tooltip__shortcut' : ''\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Ariakit.Tooltip>\n\t\t\t) }\n\t\t</TooltipInternalContext.Provider>\n\t);\n}\nexport const Tooltip = forwardRef( UnforwardedTooltip );\n\nexport default Tooltip;\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAOA,IAAAK,WAAA,GAAAH,sBAAA,CAAAF,OAAA;AASA,IAAAM,SAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAuD,IAAAQ,WAAA,GAAAR,OAAA;AAAA,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAX,wBAAAW,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,C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,GAAG,EACxC;QACDD,QAAQ,EAAGA;MAAU,CACrB,CACD;IAAA,CACe,CACjB;EAAA,CAC+B,CAAC;AAEpC;AACO,MAAMM,OAAO,GAAAjB,OAAA,CAAAiB,OAAA,GAAG,IAAAuC,mBAAU,EAAEtD,kBAAmB,CAAC;AAAC,IAAAuD,QAAA,GAAAzD,OAAA,CAAAnB,OAAA,GAEzCoC,OAAO","ignoreList":[]}
@@ -10,6 +10,7 @@ var _element = require("@wordpress/element");
10
10
  */
11
11
 
12
12
  const RovingTabIndexContext = (0, _element.createContext)(undefined);
13
+ RovingTabIndexContext.displayName = 'RovingTabIndexContext';
13
14
  const useRovingTabIndexContext = () => (0, _element.useContext)(RovingTabIndexContext);
14
15
  exports.useRovingTabIndexContext = useRovingTabIndexContext;
15
16
  const RovingTabIndexProvider = exports.RovingTabIndexProvider = RovingTabIndexContext.Provider;
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","RovingTabIndexContext","createContext","undefined","useRovingTabIndexContext","useContext","exports","RovingTabIndexProvider","Provider"],"sources":["@wordpress/components/src/tree-grid/roving-tab-index-context.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\nconst RovingTabIndexContext = createContext<\n\t| {\n\t\t\tlastFocusedElement: HTMLElement | undefined;\n\t\t\tsetLastFocusedElement: React.Dispatch<\n\t\t\t\tReact.SetStateAction< HTMLElement | undefined >\n\t\t\t>;\n\t }\n\t| undefined\n>( undefined );\nexport const useRovingTabIndexContext = () =>\n\tuseContext( RovingTabIndexContext );\nexport const RovingTabIndexProvider = RovingTabIndexContext.Provider;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,qBAAqB,GAAG,IAAAC,sBAAa,EAQxCC,SAAU,CAAC;AACP,MAAMC,wBAAwB,GAAGA,CAAA,KACvC,IAAAC,mBAAU,EAAEJ,qBAAsB,CAAC;AAACK,OAAA,CAAAF,wBAAA,GAAAA,wBAAA;AAC9B,MAAMG,sBAAsB,GAAAD,OAAA,CAAAC,sBAAA,GAAGN,qBAAqB,CAACO,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","RovingTabIndexContext","createContext","undefined","displayName","useRovingTabIndexContext","useContext","exports","RovingTabIndexProvider","Provider"],"sources":["@wordpress/components/src/tree-grid/roving-tab-index-context.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\nconst RovingTabIndexContext = createContext<\n\t| {\n\t\t\tlastFocusedElement: HTMLElement | undefined;\n\t\t\tsetLastFocusedElement: React.Dispatch<\n\t\t\t\tReact.SetStateAction< HTMLElement | undefined >\n\t\t\t>;\n\t }\n\t| undefined\n>( undefined );\nRovingTabIndexContext.displayName = 'RovingTabIndexContext';\n\nexport const useRovingTabIndexContext = () =>\n\tuseContext( RovingTabIndexContext );\nexport const RovingTabIndexProvider = RovingTabIndexContext.Provider;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,qBAAqB,GAAG,IAAAC,sBAAa,EAQxCC,SAAU,CAAC;AACdF,qBAAqB,CAACG,WAAW,GAAG,uBAAuB;AAEpD,MAAMC,wBAAwB,GAAGA,CAAA,KACvC,IAAAC,mBAAU,EAAEL,qBAAsB,CAAC;AAACM,OAAA,CAAAF,wBAAA,GAAAA,wBAAA;AAC9B,MAAMG,sBAAsB,GAAAD,OAAA,CAAAC,sBAAA,GAAGP,qBAAqB,CAACQ,QAAQ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_configValues","_interopRequireDefault","require","BASE_FONT_SIZE","exports","PRESET_FONT_SIZES","body","caption","footnote","largeTitle","subheadline","title","HEADING_FONT_SIZES","flatMap","n","toString","getFontSize","size","parsed","parseFloat","Number","isNaN","ratio","CONFIG","fontSize","getHeadingFontSize","includes","headingSize"],"sources":["@wordpress/components/src/utils/font-size.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { CSSProperties, ReactText } from 'react';\n\n/**\n * Internal dependencies\n */\nimport CONFIG from './config-values';\n\nexport type HeadingSize =\n\t| 1\n\t| 2\n\t| 3\n\t| 4\n\t| 5\n\t| 6\n\t| '1'\n\t| '2'\n\t| '3'\n\t| '4'\n\t| '5'\n\t| '6';\n\nexport const BASE_FONT_SIZE = 13;\n\nexport const PRESET_FONT_SIZES = {\n\tbody: BASE_FONT_SIZE,\n\tcaption: 10,\n\tfootnote: 11,\n\tlargeTitle: 28,\n\tsubheadline: 12,\n\ttitle: 20,\n};\n\nexport const HEADING_FONT_SIZES = [ 1, 2, 3, 4, 5, 6 ].flatMap( ( n ) => [\n\tn as HeadingSize,\n\tn.toString() as HeadingSize,\n] );\n\nexport function getFontSize(\n\tsize:\n\t\t| CSSProperties[ 'fontSize' ]\n\t\t| keyof typeof PRESET_FONT_SIZES = BASE_FONT_SIZE\n): string {\n\tif ( size in PRESET_FONT_SIZES ) {\n\t\treturn getFontSize(\n\t\t\tPRESET_FONT_SIZES[ size as keyof typeof PRESET_FONT_SIZES ]\n\t\t);\n\t}\n\n\tif ( typeof size !== 'number' ) {\n\t\tconst parsed = parseFloat( size );\n\t\tif ( Number.isNaN( parsed ) ) {\n\t\t\treturn size;\n\t\t}\n\t\tsize = parsed;\n\t}\n\n\tconst ratio = `(${ size } / ${ BASE_FONT_SIZE })`;\n\treturn `calc(${ ratio } * ${ CONFIG.fontSize })`;\n}\n\nexport function getHeadingFontSize( size: ReactText = 3 ): string {\n\tif ( ! HEADING_FONT_SIZES.includes( size as HeadingSize ) ) {\n\t\treturn getFontSize( size );\n\t}\n\n\tconst headingSize = `fontSizeH${ size }` as `fontSizeH${ HeadingSize }`;\n\treturn CONFIG[ headingSize ];\n}\n"],"mappings":";;;;;;;;;AAQA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAiBO,MAAMC,cAAc,G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[]}
1
+ {"version":3,"names":["_configValues","_interopRequireDefault","require","BASE_FONT_SIZE","exports","PRESET_FONT_SIZES","body","caption","footnote","largeTitle","subheadline","title","HEADING_FONT_SIZES","flatMap","n","toString","getFontSize","size","parsed","parseFloat","Number","isNaN","ratio","CONFIG","fontSize","getHeadingFontSize","includes","headingSize"],"sources":["@wordpress/components/src/utils/font-size.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\n/**\n * Internal dependencies\n */\nimport CONFIG from './config-values';\n\nexport type HeadingSize =\n\t| 1\n\t| 2\n\t| 3\n\t| 4\n\t| 5\n\t| 6\n\t| '1'\n\t| '2'\n\t| '3'\n\t| '4'\n\t| '5'\n\t| '6';\n\nexport const BASE_FONT_SIZE = 13;\n\nexport const PRESET_FONT_SIZES = {\n\tbody: BASE_FONT_SIZE,\n\tcaption: 10,\n\tfootnote: 11,\n\tlargeTitle: 28,\n\tsubheadline: 12,\n\ttitle: 20,\n};\n\nexport const HEADING_FONT_SIZES = [ 1, 2, 3, 4, 5, 6 ].flatMap( ( n ) => [\n\tn as HeadingSize,\n\tn.toString() as HeadingSize,\n] );\n\nexport function getFontSize(\n\tsize:\n\t\t| CSSProperties[ 'fontSize' ]\n\t\t| keyof typeof PRESET_FONT_SIZES = BASE_FONT_SIZE\n): string {\n\tif ( size in PRESET_FONT_SIZES ) {\n\t\treturn getFontSize(\n\t\t\tPRESET_FONT_SIZES[ size as keyof typeof PRESET_FONT_SIZES ]\n\t\t);\n\t}\n\n\tif ( typeof size !== 'number' ) {\n\t\tconst parsed = parseFloat( size );\n\t\tif ( Number.isNaN( parsed ) ) {\n\t\t\treturn size;\n\t\t}\n\t\tsize = parsed;\n\t}\n\n\tconst ratio = `(${ size } / ${ BASE_FONT_SIZE })`;\n\treturn `calc(${ ratio } * ${ CONFIG.fontSize })`;\n}\n\nexport function getHeadingFontSize( size: number | string = 3 ): string {\n\tif ( ! HEADING_FONT_SIZES.includes( size as HeadingSize ) ) {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AG,CAAC,EAAW;EACvE,IAAK,CAAEL,kBAAkB,CAACc,QAAQ,CAAET,IAAoB,CAAC,EAAG;IAC3D,OAAOD,WAAW,CAAEC,IAAK,CAAC;EAC3B;EAEA,MAAMU,WAAW,GAAG,YAAaV,IAAI,EAAkC;EACvE,OAAOM,qBAAM,CAAEI,WAAW,CAAE;AAC7B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","getValidChildren","children","Children","toArray","filter","child","isValidElement"],"sources":["@wordpress/components/src/utils/get-valid-children.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, ReactChild, ReactFragment, ReactPortal } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { Children, isValidElement } from '@wordpress/element';\n\n/**\n * Gets a collection of available children elements from a React component's children prop.\n *\n * @param children\n *\n * @return An array of available children.\n */\nexport function getValidChildren(\n\tchildren: ReactNode\n): Array< ReactChild | ReactFragment | ReactPortal > {\n\tif ( typeof children === 'string' ) {\n\t\treturn [ children ];\n\t}\n\n\treturn Children.toArray( children ).filter( ( child ) =>\n\t\tisValidElement( child )\n\t);\n}\n"],"mappings":";;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAC/BC,QAAmB,EACiC;EACpD,IAAK,OAAOA,QAAQ,KAAK,QAAQ,EAAG;IACnC,OAAO,CAAEA,QAAQ,CAAE;EACpB;EAEA,OAAOC,iBAAQ,CAACC,OAAO,CAAEF,QAAS,CAAC,CAACG,MAAM,CAAIC,KAAK,IAClD,IAAAC,uBAAc,EAAED,KAAM,CACvB,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","getValidChildren","children","Children","toArray","filter","child","isValidElement"],"sources":["@wordpress/components/src/utils/get-valid-children.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, ReactElement, ReactPortal } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { Children, isValidElement } from '@wordpress/element';\n\n/**\n * Gets a collection of available children elements from a React component's children prop.\n *\n * @param children\n *\n * @return An array of available children.\n */\nexport function getValidChildren(\n\tchildren: ReactNode\n): Array<\n\tReactElement | number | string | Iterable< ReactNode > | ReactPortal\n> {\n\tif ( typeof children === 'string' ) {\n\t\treturn [ children ];\n\t}\n\n\treturn Children.toArray( children ).filter( ( child ) =>\n\t\tisValidElement( child )\n\t);\n}\n"],"mappings":";;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAC/BC,QAAmB,EAGlB;EACD,IAAK,OAAOA,QAAQ,KAAK,QAAQ,EAAG;IACnC,OAAO,CAAEA,QAAQ,CAAE;EACpB;EAEA,OAAOC,iBAAQ,CAACC,OAAO,CAAEF,QAAS,CAAC,CAACG,MAAM,CAAIC,KAAK,IAClD,IAAAC,uBAAc,EAAED,KAAM,CACvB,CAAC;AACF","ignoreList":[]}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ControlWithError = void 0;
7
+ var _compose = require("@wordpress/compose");
7
8
  var _i18n = require("@wordpress/i18n");
8
9
  var _element = require("@wordpress/element");
9
10
  var _withIgnoreImeEvents = require("../utils/with-ignore-ime-events");
@@ -13,10 +14,6 @@ var _jsxRuntime = require("react/jsx-runtime");
13
14
  * WordPress dependencies
14
15
  */
15
16
 
16
- /**
17
- * External dependencies
18
- */
19
-
20
17
  /**
21
18
  * Internal dependencies
22
19
  */
@@ -55,6 +52,7 @@ function UnforwardedControlWithError({
55
52
  const [errorMessage, setErrorMessage] = (0, _element.useState)();
56
53
  const [statusMessage, setStatusMessage] = (0, _element.useState)();
57
54
  const [isTouched, setIsTouched] = (0, _element.useState)(false);
55
+ const previousCustomValidityType = (0, _compose.usePrevious)(customValidity?.type);
58
56
 
59
57
  // Ensure that error messages are visible after user attemps to submit a form
60
58
  // with multiple invalid fields.
@@ -82,6 +80,8 @@ function UnforwardedControlWithError({
82
80
  {
83
81
  // Wait before showing a validating state.
84
82
  const timer = setTimeout(() => {
83
+ validityTarget?.setCustomValidity('');
84
+ setErrorMessage(undefined);
85
85
  setStatusMessage({
86
86
  type: 'validating',
87
87
  message: customValidity.message
@@ -91,13 +91,18 @@ function UnforwardedControlWithError({
91
91
  }
92
92
  case 'valid':
93
93
  {
94
+ // Ensures that we wait for any async responses before showing
95
+ // a synchronously valid state.
96
+ if (previousCustomValidityType === 'valid') {
97
+ break;
98
+ }
94
99
  validityTarget?.setCustomValidity('');
95
100
  setErrorMessage(validityTarget?.validationMessage);
96
101
  setStatusMessage({
97
102
  type: 'valid',
98
103
  message: customValidity.message
99
104
  });
100
- return;
105
+ break;
101
106
  }
102
107
  case 'invalid':
103
108
  {
@@ -105,24 +110,19 @@ function UnforwardedControlWithError({
105
110
  validityTarget?.setCustomValidity((_customValidity$messa = customValidity.message) !== null && _customValidity$messa !== void 0 ? _customValidity$messa : '');
106
111
  setErrorMessage(validityTarget?.validationMessage);
107
112
  setStatusMessage(undefined);
108
- return undefined;
113
+ break;
109
114
  }
110
115
  }
111
- }, [isTouched, customValidity?.type, customValidity?.message, getValidityTarget]);
116
+ }, [isTouched, customValidity?.type, customValidity?.message, getValidityTarget, previousCustomValidityType]);
112
117
  const onBlur = event => {
118
+ if (isTouched) {
119
+ return;
120
+ }
121
+
113
122
  // Only consider "blurred from the component" if focus has fully left the wrapping div.
114
123
  // This prevents unnecessary blurs from components with multiple focusable elements.
115
124
  if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {
116
125
  setIsTouched(true);
117
- const validityTarget = getValidityTarget();
118
-
119
- // Prevents a double flash of the native error tooltip when the control is already showing one.
120
- if (!validityTarget?.validity.valid) {
121
- if (!errorMessage) {
122
- setErrorMessage(validityTarget?.validationMessage);
123
- }
124
- return;
125
- }
126
126
  onValidate?.();
127
127
  }
128
128
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_withIgnoreImeEvents","_validityIndicator","_jsxRuntime","appendRequiredIndicator","label","required","markWhenOptional","jsxs","Fragment","children","__","UnforwardedControlWithError","onValidate","customValidity","getValidityTarget","forwardedRef","errorMessage","setErrorMessage","useState","statusMessage","setStatusMessage","isTouched","setIsTouched","useEffect","validityTarget","showValidationMessage","validationMessage","addEventListener","removeEventListener","type","setCustomValidity","undefined","timer","setTimeout","message","clearTimeout","_customValidity$messa","onBlur","event","relatedTarget","currentTarget","contains","validity","valid","onChange","args","props","onKeyDown","key","className","ref","withIgnoreIMEEvents","cloneElement","jsx","ValidityIndicator","ControlWithError","exports","forwardRef"],"sources":["@wordpress/components/src/validated-form-controls/control-with-error.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * External dependencies\n */\nimport {\n\tcloneElement,\n\tforwardRef,\n\tuseEffect,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport type { ValidatedControlProps } from './components/types';\nimport { ValidityIndicator } from './validity-indicator';\n\nfunction appendRequiredIndicator(\n\tlabel: React.ReactNode,\n\trequired: boolean | undefined,\n\tmarkWhenOptional: boolean | undefined\n) {\n\tif ( required && ! markWhenOptional ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ label } { `(${ __( 'Required' ) })` }\n\t\t\t</>\n\t\t);\n\t}\n\tif ( ! required && markWhenOptional ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ label } { `(${ __( 'Optional' ) })` }\n\t\t\t</>\n\t\t);\n\t}\n\treturn label;\n}\n\n/**\n * HTML elements that support the Constraint Validation API.\n *\n * Here, we exclude HTMLButtonElement because although it does technically support the API,\n * normal buttons are actually exempted from any validation.\n * @see https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Forms/Form_validation\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/willValidate\n */\ntype ValidityTarget =\n\t| HTMLFieldSetElement\n\t| HTMLInputElement\n\t| HTMLSelectElement\n\t| HTMLTextAreaElement;\n\nfunction UnforwardedControlWithError< C extends React.ReactElement >(\n\t{\n\t\trequired,\n\t\tmarkWhenOptional,\n\t\tonValidate,\n\t\tcustomValidity,\n\t\tgetValidityTarget,\n\t\tchildren,\n\t}: {\n\t\t/**\n\t\t * Whether the control is required.\n\t\t */\n\t\trequired?: boolean;\n\t\t/**\n\t\t * Label the control as \"optional\" when _not_ `required`, instead of the inverse.\n\t\t */\n\t\tmarkWhenOptional?: boolean;\n\t\t/**\n\t\t * The callback to run when the input should be validated.\n\t\t */\n\t\tonValidate?: () => void;\n\t\tcustomValidity?: ValidatedControlProps< unknown >[ 'customValidity' ];\n\t\t/**\n\t\t * A function that returns the actual element on which the validity data should be applied.\n\t\t */\n\t\tgetValidityTarget: () => ValidityTarget | null | undefined;\n\t\t/**\n\t\t * The control component to apply validation to.\n\t\t */\n\t\tchildren: C;\n\t},\n\tforwardedRef: React.ForwardedRef< HTMLDivElement >\n) {\n\tconst [ errorMessage, setErrorMessage ] = useState< string | undefined >();\n\tconst [ statusMessage, setStatusMessage ] = useState<\n\t\t| {\n\t\t\t\ttype: 'validating' | 'valid';\n\t\t\t\tmessage?: string;\n\t\t }\n\t\t| undefined\n\t>();\n\tconst [ isTouched, setIsTouched ] = useState( false );\n\n\t// Ensure that error messages are visible after user attemps to submit a form\n\t// with multiple invalid fields.\n\tuseEffect( () => {\n\t\tconst validityTarget = getValidityTarget();\n\t\tconst showValidationMessage = () =>\n\t\t\tsetErrorMessage( validityTarget?.validationMessage );\n\n\t\tvalidityTarget?.addEventListener( 'invalid', showValidationMessage );\n\n\t\treturn () => {\n\t\t\tvalidityTarget?.removeEventListener(\n\t\t\t\t'invalid',\n\t\t\t\tshowValidationMessage\n\t\t\t);\n\t\t};\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( ! isTouched ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst validityTarget = getValidityTarget();\n\n\t\tif ( ! customValidity?.type ) {\n\t\t\tvalidityTarget?.setCustomValidity( '' );\n\t\t\tsetErrorMessage( validityTarget?.validationMessage );\n\t\t\tsetStatusMessage( undefined );\n\t\t\treturn;\n\t\t}\n\n\t\tswitch ( customValidity.type ) {\n\t\t\tcase 'validating': {\n\t\t\t\t// Wait before showing a validating state.\n\t\t\t\tconst timer = setTimeout( () => {\n\t\t\t\t\tsetStatusMessage( {\n\t\t\t\t\t\ttype: 'validating',\n\t\t\t\t\t\tmessage: customValidity.message,\n\t\t\t\t\t} );\n\t\t\t\t}, 1000 );\n\n\t\t\t\treturn () => clearTimeout( timer );\n\t\t\t}\n\t\t\tcase 'valid': {\n\t\t\t\tvalidityTarget?.setCustomValidity( '' );\n\t\t\t\tsetErrorMessage( validityTarget?.validationMessage );\n\n\t\t\t\tsetStatusMessage( {\n\t\t\t\t\ttype: 'valid',\n\t\t\t\t\tmessage: customValidity.message,\n\t\t\t\t} );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase 'invalid': {\n\t\t\t\tvalidityTarget?.setCustomValidity(\n\t\t\t\t\tcustomValidity.message ?? ''\n\t\t\t\t);\n\t\t\t\tsetErrorMessage( validityTarget?.validationMessage );\n\n\t\t\t\tsetStatusMessage( undefined );\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t}, [\n\t\tisTouched,\n\t\tcustomValidity?.type,\n\t\tcustomValidity?.message,\n\t\tgetValidityTarget,\n\t] );\n\n\tconst onBlur = ( event: React.FocusEvent< HTMLDivElement > ) => {\n\t\t// Only consider \"blurred from the component\" if focus has fully left the wrapping div.\n\t\t// This prevents unnecessary blurs from components with multiple focusable elements.\n\t\tif (\n\t\t\t! event.relatedTarget ||\n\t\t\t! event.currentTarget.contains( event.relatedTarget )\n\t\t) {\n\t\t\tsetIsTouched( true );\n\n\t\t\tconst validityTarget = getValidityTarget();\n\n\t\t\t// Prevents a double flash of the native error tooltip when the control is already showing one.\n\t\t\tif ( ! validityTarget?.validity.valid ) {\n\t\t\t\tif ( ! errorMessage ) {\n\t\t\t\t\tsetErrorMessage( validityTarget?.validationMessage );\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tonValidate?.();\n\t\t}\n\t};\n\n\tconst onChange = ( ...args: unknown[] ) => {\n\t\tchildren.props.onChange?.( ...args );\n\n\t\t// Only validate incrementally if the field has blurred at least once,\n\t\t// or currently has an error message.\n\t\tif ( isTouched || errorMessage ) {\n\t\t\tonValidate?.();\n\t\t}\n\t};\n\n\tconst onKeyDown = ( event: React.KeyboardEvent< HTMLDivElement > ) => {\n\t\t// Ensures that custom validators are triggered when the user submits by pressing Enter,\n\t\t// without ever blurring the control.\n\t\tif ( event.key === 'Enter' ) {\n\t\t\tonValidate?.();\n\t\t}\n\t};\n\n\treturn (\n\t\t// Disable reason: Just listening to a bubbled event, not for interaction.\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"components-validated-control\"\n\t\t\tref={ forwardedRef }\n\t\t\tonBlur={ onBlur }\n\t\t\tonKeyDown={ withIgnoreIMEEvents( onKeyDown ) }\n\t\t>\n\t\t\t{ cloneElement( children, {\n\t\t\t\tlabel: appendRequiredIndicator(\n\t\t\t\t\tchildren.props.label,\n\t\t\t\t\trequired,\n\t\t\t\t\tmarkWhenOptional\n\t\t\t\t),\n\t\t\t\tonChange,\n\t\t\t\trequired,\n\t\t\t} ) }\n\t\t\t<div aria-live=\"polite\">\n\t\t\t\t{ errorMessage && (\n\t\t\t\t\t<ValidityIndicator\n\t\t\t\t\t\ttype=\"invalid\"\n\t\t\t\t\t\tmessage={ errorMessage }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! errorMessage && statusMessage && (\n\t\t\t\t\t<ValidityIndicator\n\t\t\t\t\t\ttype={ statusMessage.type }\n\t\t\t\t\t\tmessage={ statusMessage.message }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport const ControlWithError = forwardRef( UnforwardedControlWithError );\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAUA,IAAAE,oBAAA,GAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAH,OAAA;AAAyD,IAAAI,WAAA,GAAAJ,OAAA;AApBzD;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAKA,SAASK,uBAAuBA,CAC/BC,KAAsB,EACtBC,QAA6B,EAC7BC,gBAAqC,EACpC;EACD,IAAKD,QAAQ,IAAI,CAAEC,gBAAgB,EAAG;IACrC,oBACC,IAAAJ,WAAA,CAAAK,IAAA,EAAAL,WAAA,CAAAM,QAAA;MAAAC,QAAA,GACGL,KAAK,EAAE,GAAC,EAAE,IAAK,IAAAM,QAAE,EAAE,UAAW,CAAC,GAAI;IAAA,CACpC,CAAC;EAEL;EACA,IAAK,CAAEL,QAAQ,IAAIC,gBAAgB,EAAG;IACrC,oBACC,IAAAJ,WAAA,CAAAK,IAAA,EAAAL,WAAA,CAAAM,QAAA;MAAAC,QAAA,GACGL,KAAK,EAAE,GAAC,EAAE,IAAK,IAAAM,QAAE,EAAE,UAAW,CAAC,GAAI;IAAA,CACpC,CAAC;EAEL;EACA,OAAON,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,SAASO,2BAA2BA,CACnC;EACCN,QAAQ;EACRC,gBAAgB;EAChBM,UAAU;EACVC,cAAc;EACdC,iBAAiB;EACjBL;AAuBD,CAAC,EACDM,YAAkD,EACjD;EACD,MAAM,CAAEC,YAAY,EAAEC,eAAe,CAAE,GAAG,IAAAC,iBAAQ,EAAuB,CAAC;EAC1E,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CA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,CAAC;IACf;EACD,CAAC;EAED;IAAA;IACC;IACA;IACA,IAAAV,WAAA,CAAAK,IAAA;MACC0C,SAAS,EAAC,8BAA8B;MACxCC,GAAG,EAAGnC,YAAc;MACpBsB,MAAM,EAAGA,MAAQ;MACjBU,SAAS,EAAG,IAAAI,wCAAmB,EAAEJ,SAAU,CAAG;MAAAtC,QAAA,GAE5C,IAAA2C,qBAAY,EAAE3C,QAAQ,EAAE;QACzBL,KAAK,EAAED,uBAAuB,CAC7BM,QAAQ,CAACqC,KAAK,CAAC1C,KAAK,EACpBC,QAAQ,EACRC,gBACD,CAAC;QACDsC,QAAQ;QACRvC;MACD,CAAE,CAAC,eACH,IAAAH,WAAA,CAAAK,IAAA;QAAK,aAAU,QAAQ;QAAAE,QAAA,GACpBO,YAAY,iBACb,IAAAd,WAAA,CAAAmD,GAAA,EAACpD,kBAAA,CAAAqD,iBAAiB;UACjBzB,IAAI,EAAC,SAAS;UACdK,OAAO,EAAGlB;QAAc,CACxB,CACD,EACC,CAAEA,YAAY,IAAIG,aAAa,iBAChC,IAAAjB,WAAA,CAAAmD,GAAA,EAACpD,kBAAA,CAAAqD,iBAAiB;UACjBzB,IAAI,EAAGV,aAAa,CAACU,IAAM;UAC3BK,OAAO,EAAGf,aAAa,CAACe;QAAS,CACjC,CACD;MAAA,CACG,CAAC;IAAA,CACF;EAAC;AAER;AAEO,MAAMqB,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,IAAAE,mBAAU,EAAE9C,2BAA4B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_compose","require","_i18n","_element","_withIgnoreImeEvents","_validityIndicator","_jsxRuntime","appendRequiredIndicator","label","required","markWhenOptional","jsxs","Fragment","children","__","UnforwardedControlWithError","onValidate","customValidity","getValidityTarget","forwardedRef","errorMessage","setErrorMessage","useState","statusMessage","setStatusMessage","isTouched","setIsTouched","previousCustomValidityType","usePrevious","type","useEffect","validityTarget","showValidationMessage","validationMessage","addEventListener","removeEventListener","setCustomValidity","undefined","timer","setTimeout","message","clearTimeout","_customValidity$messa","onBlur","event","relatedTarget","currentTarget","contains","onChange","args","props","onKeyDown","key","className","ref","withIgnoreIMEEvents","cloneElement","jsx","ValidityIndicator","ControlWithError","exports","forwardRef"],"sources":["@wordpress/components/src/validated-form-controls/control-with-error.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tcloneElement,\n\tforwardRef,\n\tuseEffect,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport type { ValidatedControlProps } from './components/types';\nimport { ValidityIndicator } from './validity-indicator';\n\nfunction appendRequiredIndicator(\n\tlabel: React.ReactNode,\n\trequired: boolean | undefined,\n\tmarkWhenOptional: boolean | undefined\n) {\n\tif ( required && ! markWhenOptional ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ label } { `(${ __( 'Required' ) })` }\n\t\t\t</>\n\t\t);\n\t}\n\tif ( ! required && markWhenOptional ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ label } { `(${ __( 'Optional' ) })` }\n\t\t\t</>\n\t\t);\n\t}\n\treturn label;\n}\n\n/**\n * HTML elements that support the Constraint Validation API.\n *\n * Here, we exclude HTMLButtonElement because although it does technically support the API,\n * normal buttons are actually exempted from any validation.\n * @see https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Forms/Form_validation\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/willValidate\n */\ntype ValidityTarget =\n\t| HTMLFieldSetElement\n\t| HTMLInputElement\n\t| HTMLSelectElement\n\t| HTMLTextAreaElement;\n\nfunction UnforwardedControlWithError< C extends React.ReactElement >(\n\t{\n\t\trequired,\n\t\tmarkWhenOptional,\n\t\tonValidate,\n\t\tcustomValidity,\n\t\tgetValidityTarget,\n\t\tchildren,\n\t}: {\n\t\t/**\n\t\t * Whether the control is required.\n\t\t */\n\t\trequired?: boolean;\n\t\t/**\n\t\t * Label the control as \"optional\" when _not_ `required`, instead of the inverse.\n\t\t */\n\t\tmarkWhenOptional?: boolean;\n\t\t/**\n\t\t * The callback to run when the input should be validated.\n\t\t */\n\t\tonValidate?: () => void;\n\t\tcustomValidity?: ValidatedControlProps< unknown >[ 'customValidity' ];\n\t\t/**\n\t\t * A function that returns the actual element on which the validity data should be applied.\n\t\t */\n\t\tgetValidityTarget: () => ValidityTarget | null | undefined;\n\t\t/**\n\t\t * The control component to apply validation to.\n\t\t */\n\t\tchildren: C;\n\t},\n\tforwardedRef: React.ForwardedRef< HTMLDivElement >\n) {\n\tconst [ errorMessage, setErrorMessage ] = useState< string | undefined >();\n\tconst [ statusMessage, setStatusMessage ] = useState<\n\t\t| {\n\t\t\t\ttype: 'validating' | 'valid';\n\t\t\t\tmessage?: string;\n\t\t }\n\t\t| undefined\n\t>();\n\tconst [ isTouched, setIsTouched ] = useState( false );\n\tconst previousCustomValidityType = usePrevious( customValidity?.type );\n\n\t// Ensure that error messages are visible after user attemps to submit a form\n\t// with multiple invalid fields.\n\tuseEffect( () => {\n\t\tconst validityTarget = getValidityTarget();\n\t\tconst showValidationMessage = () =>\n\t\t\tsetErrorMessage( validityTarget?.validationMessage );\n\n\t\tvalidityTarget?.addEventListener( 'invalid', showValidationMessage );\n\n\t\treturn () => {\n\t\t\tvalidityTarget?.removeEventListener(\n\t\t\t\t'invalid',\n\t\t\t\tshowValidationMessage\n\t\t\t);\n\t\t};\n\t} );\n\n\tuseEffect( (): ReturnType< React.EffectCallback > => {\n\t\tif ( ! isTouched ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst validityTarget = getValidityTarget();\n\n\t\tif ( ! customValidity?.type ) {\n\t\t\tvalidityTarget?.setCustomValidity( '' );\n\t\t\tsetErrorMessage( validityTarget?.validationMessage );\n\t\t\tsetStatusMessage( undefined );\n\t\t\treturn;\n\t\t}\n\n\t\tswitch ( customValidity.type ) {\n\t\t\tcase 'validating': {\n\t\t\t\t// Wait before showing a validating state.\n\t\t\t\tconst timer = setTimeout( () => {\n\t\t\t\t\tvalidityTarget?.setCustomValidity( '' );\n\t\t\t\t\tsetErrorMessage( undefined );\n\n\t\t\t\t\tsetStatusMessage( {\n\t\t\t\t\t\ttype: 'validating',\n\t\t\t\t\t\tmessage: customValidity.message,\n\t\t\t\t\t} );\n\t\t\t\t}, 1000 );\n\n\t\t\t\treturn () => clearTimeout( timer );\n\t\t\t}\n\t\t\tcase 'valid': {\n\t\t\t\t// Ensures that we wait for any async responses before showing\n\t\t\t\t// a synchronously valid state.\n\t\t\t\tif ( previousCustomValidityType === 'valid' ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tvalidityTarget?.setCustomValidity( '' );\n\t\t\t\tsetErrorMessage( validityTarget?.validationMessage );\n\n\t\t\t\tsetStatusMessage( {\n\t\t\t\t\ttype: 'valid',\n\t\t\t\t\tmessage: customValidity.message,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'invalid': {\n\t\t\t\tvalidityTarget?.setCustomValidity(\n\t\t\t\t\tcustomValidity.message ?? ''\n\t\t\t\t);\n\t\t\t\tsetErrorMessage( validityTarget?.validationMessage );\n\n\t\t\t\tsetStatusMessage( undefined );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}, [\n\t\tisTouched,\n\t\tcustomValidity?.type,\n\t\tcustomValidity?.message,\n\t\tgetValidityTarget,\n\t\tpreviousCustomValidityType,\n\t] );\n\n\tconst onBlur = ( event: React.FocusEvent< HTMLDivElement > ) => {\n\t\tif ( isTouched ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Only consider \"blurred from the component\" if focus has fully left the wrapping div.\n\t\t// This prevents unnecessary blurs from components with multiple focusable elements.\n\t\tif (\n\t\t\t! event.relatedTarget ||\n\t\t\t! event.currentTarget.contains( event.relatedTarget )\n\t\t) {\n\t\t\tsetIsTouched( true );\n\t\t\tonValidate?.();\n\t\t}\n\t};\n\n\tconst onChange = ( ...args: unknown[] ) => {\n\t\tchildren.props.onChange?.( ...args );\n\n\t\t// Only validate incrementally if the field has blurred at least once,\n\t\t// or currently has an error message.\n\t\tif ( isTouched || errorMessage ) {\n\t\t\tonValidate?.();\n\t\t}\n\t};\n\n\tconst onKeyDown = ( event: React.KeyboardEvent< HTMLDivElement > ) => {\n\t\t// Ensures that custom validators are triggered when the user submits by pressing Enter,\n\t\t// without ever blurring the control.\n\t\tif ( event.key === 'Enter' ) {\n\t\t\tonValidate?.();\n\t\t}\n\t};\n\n\treturn (\n\t\t// Disable reason: Just listening to a bubbled event, not for interaction.\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"components-validated-control\"\n\t\t\tref={ forwardedRef }\n\t\t\tonBlur={ onBlur }\n\t\t\tonKeyDown={ withIgnoreIMEEvents( onKeyDown ) }\n\t\t>\n\t\t\t{ cloneElement( children, {\n\t\t\t\tlabel: appendRequiredIndicator(\n\t\t\t\t\tchildren.props.label,\n\t\t\t\t\trequired,\n\t\t\t\t\tmarkWhenOptional\n\t\t\t\t),\n\t\t\t\tonChange,\n\t\t\t\trequired,\n\t\t\t} ) }\n\t\t\t<div aria-live=\"polite\">\n\t\t\t\t{ errorMessage && (\n\t\t\t\t\t<ValidityIndicator\n\t\t\t\t\t\ttype=\"invalid\"\n\t\t\t\t\t\tmessage={ errorMessage }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! errorMessage && statusMessage && (\n\t\t\t\t\t<ValidityIndicator\n\t\t\t\t\t\ttype={ statusMessage.type }\n\t\t\t\t\t\tmessage={ statusMessage.message }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport const ControlWithError = forwardRef( UnforwardedControlWithError );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAA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EAAGA,MAAQ;MACjBQ,SAAS,EAAG,IAAAI,wCAAmB,EAAEJ,SAAU,CAAG;MAAAtC,QAAA,GAE5C,IAAA2C,qBAAY,EAAE3C,QAAQ,EAAE;QACzBL,KAAK,EAAED,uBAAuB,CAC7BM,QAAQ,CAACqC,KAAK,CAAC1C,KAAK,EACpBC,QAAQ,EACRC,gBACD,CAAC;QACDsC,QAAQ;QACRvC;MACD,CAAE,CAAC,eACH,IAAAH,WAAA,CAAAK,IAAA;QAAK,aAAU,QAAQ;QAAAE,QAAA,GACpBO,YAAY,iBACb,IAAAd,WAAA,CAAAmD,GAAA,EAACpD,kBAAA,CAAAqD,iBAAiB;UACjB7B,IAAI,EAAC,SAAS;UACdW,OAAO,EAAGpB;QAAc,CACxB,CACD,EACC,CAAEA,YAAY,IAAIG,aAAa,iBAChC,IAAAjB,WAAA,CAAAmD,GAAA,EAACpD,kBAAA,CAAAqD,iBAAiB;UACjB7B,IAAI,EAAGN,aAAa,CAACM,IAAM;UAC3BW,OAAO,EAAGjB,aAAa,CAACiB;QAAS,CACjC,CACD;MAAA,CACG,CAAC;IAAA,CACF;EAAC;AAER;AAEO,MAAMmB,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,IAAAE,mBAAU,EAAE9C,2BAA4B,CAAC","ignoreList":[]}
@@ -3,5 +3,6 @@
3
3
  */
4
4
  import { createContext, useContext } from '@wordpress/element';
5
5
  export const CardContext = createContext({});
6
+ CardContext.displayName = 'CardContext';
6
7
  export const useCardContext = () => useContext(CardContext);
7
8
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","useContext","CardContext","useCardContext"],"sources":["@wordpress/components/src/card/context.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\nexport const CardContext = createContext( {} );\nexport const useCardContext = () => useContext( CardContext );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,oBAAoB;AAE9D,OAAO,MAAMC,WAAW,GAAGF,aAAa,CAAE,CAAC,CAAE,CAAC;AAC9C,OAAO,MAAMG,cAAc,GAAGA,CAAA,KAAMF,UAAU,CAAEC,WAAY,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createContext","useContext","CardContext","displayName","useCardContext"],"sources":["@wordpress/components/src/card/context.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\nexport const CardContext = createContext( {} );\nCardContext.displayName = 'CardContext';\n\nexport const useCardContext = () => useContext( CardContext );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,oBAAoB;AAE9D,OAAO,MAAMC,WAAW,GAAGF,aAAa,CAAE,CAAC,CAAE,CAAC;AAC9CE,WAAW,CAACC,WAAW,GAAG,aAAa;AAEvC,OAAO,MAAMC,cAAc,GAAGA,CAAA,KAAMH,UAAU,CAAEC,WAAY,CAAC","ignoreList":[]}
@@ -8,4 +8,5 @@ import { createContext } from '@wordpress/element';
8
8
  */
9
9
 
10
10
  export const CircularOptionPickerContext = createContext({});
11
+ CircularOptionPickerContext.displayName = 'CircularOptionPickerContext';
11
12
  //# sourceMappingURL=circular-option-picker-context.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","CircularOptionPickerContext"],"sources":["@wordpress/components/src/circular-option-picker/circular-option-picker-context.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { CircularOptionPickerContextProps } from './types';\n\nexport const CircularOptionPickerContext =\n\tcreateContext< CircularOptionPickerContextProps >( {} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;;AAGA,OAAO,MAAMC,2BAA2B,GACvCD,aAAa,CAAsC,CAAC,CAAE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createContext","CircularOptionPickerContext","displayName"],"sources":["@wordpress/components/src/circular-option-picker/circular-option-picker-context.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { CircularOptionPickerContextProps } from './types';\n\nexport const CircularOptionPickerContext =\n\tcreateContext< CircularOptionPickerContextProps >( {} );\nCircularOptionPickerContext.displayName = 'CircularOptionPickerContext';\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;;AAGA,OAAO,MAAMC,2BAA2B,GACvCD,aAAa,CAAsC,CAAC,CAAE,CAAC;AACxDC,2BAA2B,CAACC,WAAW,GAAG,6BAA6B","ignoreList":[]}
@@ -8,5 +8,6 @@ import { createContext, useContext } from '@wordpress/element';
8
8
  */
9
9
 
10
10
  export const CompositeContext = createContext({});
11
+ CompositeContext.displayName = 'CompositeContext';
11
12
  export const useCompositeContext = () => useContext(CompositeContext);
12
13
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","useContext","CompositeContext","useCompositeContext"],"sources":["@wordpress/components/src/composite/context.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { CompositeContextProps } from './types';\n\nexport const CompositeContext = createContext< CompositeContextProps >( {} );\n\nexport const useCompositeContext = () => useContext( CompositeContext );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,oBAAoB;;AAE9D;AACA;AACA;;AAGA,OAAO,MAAMC,gBAAgB,GAAGF,aAAa,CAA2B,CAAC,CAAE,CAAC;AAE5E,OAAO,MAAMG,mBAAmB,GAAGA,CAAA,KAAMF,UAAU,CAAEC,gBAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createContext","useContext","CompositeContext","displayName","useCompositeContext"],"sources":["@wordpress/components/src/composite/context.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { CompositeContextProps } from './types';\n\nexport const CompositeContext = createContext< CompositeContextProps >( {} );\nCompositeContext.displayName = 'CompositeContext';\n\nexport const useCompositeContext = () => useContext( CompositeContext );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,oBAAoB;;AAE9D;AACA;AACA;;AAGA,OAAO,MAAMC,gBAAgB,GAAGF,aAAa,CAA2B,CAAC,CAAE,CAAC;AAC5EE,gBAAgB,CAACC,WAAW,GAAG,kBAAkB;AAEjD,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAMH,UAAU,CAAEC,gBAAiB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","warn","CONNECT_STATIC_NAMESPACE","getStyledClassNameFromKey","contextConnect","Component","namespace","_contextConnect","forwardsRef","contextConnectWithoutRef","options","WrappedComponent","globalThis","SCRIPT_DEBUG","mergedNamespace","Array","isArray","Object","assign","Set","displayName","selector","getConnectNamespace","namespaces","type","hasConnectNamespace","match","includes","some","result"],"sources":["@wordpress/components/src/context/context-connect.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, ReactChild, ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONNECT_STATIC_NAMESPACE } from './constants';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport type { WordPressComponentFromProps } from '.';\n\ntype AcceptsTwoArgs<\n\tF extends ( ...args: any ) => any,\n\tErrorMessage = never,\n> = Parameters< F >[ 'length' ] extends 2 ? {} : ErrorMessage;\n\ntype ContextConnectOptions = {\n\tforwardsRef?: boolean;\n};\n\n/**\n * Forwards ref (React.ForwardRef) and \"Connects\" (or registers) a component\n * within the Context system under a specified namespace.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n>(\n\tComponent: C &\n\t\tAcceptsTwoArgs<\n\t\t\tC,\n\t\t\t'Warning: Your component function does not take a ref as the second argument. Did you mean to use `contextConnectWithoutRef`?'\n\t\t>,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace, { forwardsRef: true } );\n}\n\n/**\n * \"Connects\" (or registers) a component within the Context system under a specified namespace.\n * Does not forward a ref.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnectWithoutRef< P >(\n\tComponent: ( props: P ) => JSX.Element | null,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace );\n}\n\n// This is an (experimental) evolution of the initial connect() HOC.\n// The hope is that we can improve render performance by removing functional\n// component wrappers.\nfunction _contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n\tO extends ContextConnectOptions,\n>(\n\tComponent: C,\n\tnamespace: string,\n\toptions?: O\n): WordPressComponentFromProps<\n\tParameters< C >[ 0 ],\n\tO[ 'forwardsRef' ] extends true ? true : false\n> {\n\tconst WrappedComponent = options?.forwardsRef\n\t\t? forwardRef< any, Parameters< C >[ 0 ] >( Component )\n\t\t: Component;\n\n\tif ( typeof namespace === 'undefined' ) {\n\t\twarn( 'contextConnect: Please provide a namespace' );\n\t}\n\n\t// @ts-expect-error internal property\n\tlet mergedNamespace = WrappedComponent[ CONNECT_STATIC_NAMESPACE ] || [\n\t\tnamespace,\n\t];\n\n\t/**\n\t * Consolidate (merge) namespaces before attaching it to the WrappedComponent.\n\t */\n\tif ( Array.isArray( namespace ) ) {\n\t\tmergedNamespace = [ ...mergedNamespace, ...namespace ];\n\t}\n\tif ( typeof namespace === 'string' ) {\n\t\tmergedNamespace = [ ...mergedNamespace, namespace ];\n\t}\n\n\t// @ts-expect-error We can't rely on inferred types here because of the\n\t// `as` prop polymorphism we're handling in https://github.com/WordPress/gutenberg/blob/4f3a11243c365f94892e479bff0b922ccc4ccda3/packages/components/src/context/wordpress-component.ts#L32-L33\n\treturn Object.assign( WrappedComponent, {\n\t\t[ CONNECT_STATIC_NAMESPACE ]: [ ...new Set( mergedNamespace ) ],\n\t\tdisplayName: namespace,\n\t\tselector: `.${ getStyledClassNameFromKey( namespace ) }`,\n\t} );\n}\n\n/**\n * Attempts to retrieve the connected namespace from a component.\n *\n * @param Component The component to retrieve a namespace from.\n * @return The connected namespaces.\n */\nexport function getConnectNamespace(\n\tComponent: ReactChild | undefined | {}\n): string[] {\n\tif ( ! Component ) {\n\t\treturn [];\n\t}\n\n\tlet namespaces = [];\n\n\t// @ts-ignore internal property\n\tif ( Component[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore internal property\n\t\tnamespaces = Component[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\t// @ts-ignore\n\tif ( Component.type && Component.type[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore\n\t\tnamespaces = Component.type[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\treturn namespaces;\n}\n\n/**\n * Checks to see if a component is connected within the Context system.\n *\n * @param Component The component to retrieve a namespace from.\n * @param match The namespace to check.\n */\nexport function hasConnectNamespace(\n\tComponent: ReactNode,\n\tmatch: string[] | string\n): boolean {\n\tif ( ! Component ) {\n\t\treturn false;\n\t}\n\n\tif ( typeof match === 'string' ) {\n\t\treturn getConnectNamespace( Component ).includes( match );\n\t}\n\tif ( Array.isArray( match ) ) {\n\t\treturn match.some( ( result ) =>\n\t\t\tgetConnectNamespace( Component ).includes( result )\n\t\t);\n\t}\n\n\treturn false;\n}\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,OAAOC,IAAI,MAAM,oBAAoB;;AAErC;AACA;AACA;A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AAE,IAAKlB,yBAAyB,CAAEG,SAAU,CAAC;EACtD,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASgB,mBAAmBA,CAClCjB,SAAsC,EAC3B;EACX,IAAK,CAAEA,SAAS,EAAG;IAClB,OAAO,EAAE;EACV;EAEA,IAAIkB,UAAU,GAAG,EAAE;;EAEnB;EACA,IAAKlB,SAAS,CAAEH,wBAAwB,CAAE,EAAG;IAC5C;IACAqB,UAAU,GAAGlB,SAAS,CAAEH,wBAAwB,CAAE;EACnD;;EAEA;EACA,IAAKG,SAAS,CAACmB,IAAI,IAAInB,SAAS,CAACmB,IAAI,CAAEtB,wBAAwB,CAAE,EAAG;IACnE;IACAqB,UAAU,GAAGlB,SAAS,CAACmB,IAAI,CAAEtB,wBAAwB,CAAE;EACxD;EAEA,OAAOqB,UAAU;AAClB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,mBAAmBA,CAClCpB,SAAoB,EACpBqB,KAAwB,EACd;EACV,IAAK,CAAErB,SAAS,EAAG;IAClB,OAAO,KAAK;EACb;EAEA,IAAK,OAAOqB,KAAK,KAAK,QAAQ,EAAG;IAChC,OAAOJ,mBAAmB,CAAEjB,SAAU,CAAC,CAACsB,QAAQ,CAAED,KAAM,CAAC;EAC1D;EACA,IAAKX,KAAK,CAACC,OAAO,CAAEU,KAAM,CAAC,EAAG;IAC7B,OAAOA,KAAK,CAACE,IAAI,CAAIC,MAAM,IAC1BP,mBAAmB,CAAEjB,SAAU,CAAC,CAACsB,QAAQ,CAAEE,MAAO,CACnD,CAAC;EACF;EAEA,OAAO,KAAK;AACb","ignoreList":[]}
1
+ {"version":3,"names":["forwardRef","warn","CONNECT_STATIC_NAMESPACE","getStyledClassNameFromKey","contextConnect","Component","namespace","_contextConnect","forwardsRef","contextConnectWithoutRef","options","WrappedComponent","globalThis","SCRIPT_DEBUG","mergedNamespace","Array","isArray","Object","assign","Set","displayName","selector","getConnectNamespace","namespaces","type","hasConnectNamespace","match","includes","some","result"],"sources":["@wordpress/components/src/context/context-connect.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, ReactElement, ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONNECT_STATIC_NAMESPACE } from './constants';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport type { WordPressComponentFromProps } from '.';\n\ntype AcceptsTwoArgs<\n\tF extends ( ...args: any ) => any,\n\tErrorMessage = never,\n> = Parameters< F >[ 'length' ] extends 2 ? {} : ErrorMessage;\n\ntype ContextConnectOptions = {\n\tforwardsRef?: boolean;\n};\n\n/**\n * Forwards ref (React.ForwardRef) and \"Connects\" (or registers) a component\n * within the Context system under a specified namespace.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n>(\n\tComponent: C &\n\t\tAcceptsTwoArgs<\n\t\t\tC,\n\t\t\t'Warning: Your component function does not take a ref as the second argument. Did you mean to use `contextConnectWithoutRef`?'\n\t\t>,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace, { forwardsRef: true } );\n}\n\n/**\n * \"Connects\" (or registers) a component within the Context system under a specified namespace.\n * Does not forward a ref.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnectWithoutRef< P >(\n\tComponent: ( props: P ) => JSX.Element | null,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace );\n}\n\n// This is an (experimental) evolution of the initial connect() HOC.\n// The hope is that we can improve render performance by removing functional\n// component wrappers.\nfunction _contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n\tO extends ContextConnectOptions,\n>(\n\tComponent: C,\n\tnamespace: string,\n\toptions?: O\n): WordPressComponentFromProps<\n\tParameters< C >[ 0 ],\n\tO[ 'forwardsRef' ] extends true ? true : false\n> {\n\tconst WrappedComponent = options?.forwardsRef\n\t\t? forwardRef< any, Parameters< C >[ 0 ] >( Component )\n\t\t: Component;\n\n\tif ( typeof namespace === 'undefined' ) {\n\t\twarn( 'contextConnect: Please provide a namespace' );\n\t}\n\n\t// @ts-expect-error internal property\n\tlet mergedNamespace = WrappedComponent[ CONNECT_STATIC_NAMESPACE ] || [\n\t\tnamespace,\n\t];\n\n\t/**\n\t * Consolidate (merge) namespaces before attaching it to the WrappedComponent.\n\t */\n\tif ( Array.isArray( namespace ) ) {\n\t\tmergedNamespace = [ ...mergedNamespace, ...namespace ];\n\t}\n\tif ( typeof namespace === 'string' ) {\n\t\tmergedNamespace = [ ...mergedNamespace, namespace ];\n\t}\n\n\t// @ts-expect-error We can't rely on inferred types here because of the\n\t// `as` prop polymorphism we're handling in https://github.com/WordPress/gutenberg/blob/4f3a11243c365f94892e479bff0b922ccc4ccda3/packages/components/src/context/wordpress-component.ts#L32-L33\n\treturn Object.assign( WrappedComponent, {\n\t\t[ CONNECT_STATIC_NAMESPACE ]: [ ...new Set( mergedNamespace ) ],\n\t\tdisplayName: namespace,\n\t\tselector: `.${ getStyledClassNameFromKey( namespace ) }`,\n\t} );\n}\n\n/**\n * Attempts to retrieve the connected namespace from a component.\n *\n * @param Component The component to retrieve a namespace from.\n * @return The connected namespaces.\n */\nexport function getConnectNamespace(\n\tComponent: ReactElement | number | string | undefined | {}\n): string[] {\n\tif ( ! Component ) {\n\t\treturn [];\n\t}\n\n\tlet namespaces = [];\n\n\t// @ts-ignore internal property\n\tif ( Component[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore internal property\n\t\tnamespaces = Component[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\t// @ts-ignore\n\tif ( Component.type && Component.type[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore\n\t\tnamespaces = Component.type[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\treturn namespaces;\n}\n\n/**\n * Checks to see if a component is connected within the Context system.\n *\n * @param Component The component to retrieve a namespace from.\n * @param match The namespace to check.\n */\nexport function hasConnectNamespace(\n\tComponent: ReactNode,\n\tmatch: string[] | string\n): boolean {\n\tif ( ! Component ) {\n\t\treturn false;\n\t}\n\n\tif ( typeof match === 'string' ) {\n\t\treturn getConnectNamespace( Component ).includes( match );\n\t}\n\tif ( Array.isArray( match ) ) {\n\t\treturn match.some( ( result ) =>\n\t\t\tgetConnectNamespace( Component ).includes( result )\n\t\t);\n\t}\n\n\treturn false;\n}\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,OAAOC,IAAI,MAAM,oBAAoB;;AAErC;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,aAAa;AACtD,SAASC,yBAAyB,QAAQ,kCAAkC;AAY5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAG7BC,SAIE,EACFC,SAAiB,EAChB;EACD,OAAOC,eAAe,CAAEF,SAAS,EAAEC,SAAS,EAAE;IAAEE,WAAW,EAAE;EAAK,CAAE,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CACvCJ,SAA6C,EAC7CC,SAAiB,EAChB;EACD,OAAOC,eAAe,CAAEF,SAAS,EAAEC,SAAU,CAAC;AAC/C;;AAEA;AACA;AACA;AACA,SAASC,eAAeA,CAIvBF,SAAY,EACZC,SAAiB,EACjBI,OAAW,EAIV;EACD,MAAMC,gBAAgB,GAAGD,OAAO,EAAEF,WAAW,GAC1CR,UAAU,CAA+BK,SAAU,CAAC,GACpDA,SAAS;EAEZ,IAAK,OAAOC,SAAS,KAAK,WAAW,EAAG;IACvCM,UAAA,CAAAC,YAAA,YAAAZ,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AO,KAAK;EACb;EAEA,IAAK,OAAOqB,KAAK,KAAK,QAAQ,EAAG;IAChC,OAAOJ,mBAAmB,CAAEjB,SAAU,CAAC,CAACsB,QAAQ,CAAED,KAAM,CAAC;EAC1D;EACA,IAAKX,KAAK,CAACC,OAAO,CAAEU,KAAM,CAAC,EAAG;IAC7B,OAAOA,KAAK,CAACE,IAAI,CAAIC,MAAM,IAC1BP,mBAAmB,CAAEjB,SAAU,CAAC,CAACsB,QAAQ,CAAEE,MAAO,CACnD,CAAC;EACF;EAEA,OAAO,KAAK;AACb","ignoreList":[]}
@@ -17,6 +17,7 @@ import warn from '@wordpress/warning';
17
17
  import { useUpdateEffect } from '../utils';
18
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
19
  export const ComponentsContext = createContext(/** @type {Record<string, any>} */{});
20
+ ComponentsContext.displayName = 'ComponentsContext';
20
21
  export const useComponentsContext = () => useContext(ComponentsContext);
21
22
 
22
23
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["deepmerge","fastDeepEqual","isPlainObject","createContext","useContext","useRef","useMemo","memo","warn","useUpdateEffect","jsx","_jsx","ComponentsContext","useComponentsContext","useContextSystemBridge","value","parentContext","valueRef","current","globalThis","SCRIPT_DEBUG","JSON","stringify","config","isMergeableObject","BaseContextSystemProvider","children","contextValue","Provider","ContextSystemProvider"],"sources":["@wordpress/components/src/context/context-system-provider.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseRef,\n\tuseMemo,\n\tmemo,\n} from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { useUpdateEffect } from '../utils';\n\nexport const ComponentsContext = createContext(\n\t/** @type {Record<string, any>} */ ( {} )\n);\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( { value } ) {\n\tconst parentContext = useComponentsContext();\n\n\tconst valueRef = useRef( value );\n\n\tuseUpdateEffect( () => {\n\t\tif (\n\t\t\t// Objects are equivalent.\n\t\t\tfastDeepEqual( valueRef.current, value ) &&\n\t\t\t// But not the same reference.\n\t\t\tvalueRef.current !== value\n\t\t) {\n\t\t\twarn( `Please memoize your context: ${ JSON.stringify( value ) }` );\n\t\t}\n\t}, [ value ] );\n\n\t// `parentContext` will always be memoized (i.e., the result of this hook itself)\n\t// or the default value from when the `ComponentsContext` was originally\n\t// initialized (which will never change, it's a static variable)\n\t// so this memoization will prevent `deepmerge()` from rerunning unless\n\t// the references to `value` change OR the `parentContext` has an actual material change\n\t// (because again, it's guaranteed to be memoized or a static reference to the empty object\n\t// so we know that the only changes for `parentContext` are material ones... i.e., why we\n\t// don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n\t// need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n\t// correctly warning when the `value` isn't being properly memoized. All of that to say\n\t// that this should be super safe to assume that `useMemo` will only run on actual\n\t// changes to the two dependencies, therefore saving us calls to `deepmerge()`!\n\tconst config = useMemo( () => {\n\t\t// Deep clone `parentContext` to avoid mutating it later.\n\t\treturn deepmerge( parentContext ?? {}, value ?? {}, {\n\t\t\tisMergeableObject: isPlainObject,\n\t\t} );\n\t}, [ parentContext, value ] );\n\n\treturn 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 {import('react').ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ( { children, value } ) => {\n\tconst contextValue = useContextSystemBridge( { value } );\n\n\treturn (\n\t\t<ComponentsContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</ComponentsContext.Provider>\n\t);\n};\n\nexport const ContextSystemProvider = memo( BaseContextSystemProvider );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,WAAW;AACjC,OAAOC,aAAa,MAAM,qBAAqB;AAC/C,SAASC,aAAa,QAAQ,iBAAiB;;AAE/C;AACA;AACA;AACA,SACCC,aAAa,EACbC,UAAU,EACVC,MAAM,EACNC,OAAO,EACPC,IAAI,QACE,oBAAoB;AAC3B,OAAOC,IAAI,MAAM,oBAAoB;;AAErC;AACA;AACA;AACA,SAASC,eAAe,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,OAAO,MAAMC,iBAAiB,GAAGT,aAAa,CAC7C,kCAAqC,CAAC,CACvC,CAAC;AACD,OAAO,MAAMU,oBAAoB,GAAGA,CAAA,KAAMT,UAAU,CAAEQ,iBAAkB,CAAC;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,sBAAsBA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAC5C,MAAMC,aAAa,GAAGH,oBAAoB,CAAC,CAAC;EAE5C,MAAMI,QAAQ,GAAGZ,MAAM,CAAEU,KAAM,CAAC;EAEhCN,eAAe,CAAE,MAAM;IACtB;IACC;IACAR,aAAa,CAAEgB,QAAQ,CAACC,OAAO,EAAEH,KAAM,CAAC;IACxC;IACAE,QAAQ,CAACC,OAAO,KAAKH,KAAK,EACzB;MACDI,UAAA,CAAAC,YAAA,YAAAZ,IAAI,CAAE,gCAAiCa,IAAI,CAACC,SAAS,CAAEP,KAAM,CAAC,EAAI,CAAC;IACpE;EACD,CAAC,EAAE,CAAEA,KAAK,CAAG,CAAC;;EAEd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMQ,MAAM,GAAGjB,OAAO,CAAE,MAAM;IAC7B;IACA,OAAON,SAAS,CAAEgB,aAAa,aAAbA,aAAa,cAAbA,aAAa,GAAI,CAAC,CAAC,EAAED,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,CAAC,EAAE;MACnDS,iBAAiB,EAAEtB;IACpB,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEc,aAAa,EAAED,KAAK,CAAG,CAAC;EAE7B,OAAOQ,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,yBAAyB,GAAGA,CAAE;EAAEC,QAAQ;EAAEX;AAAM,CAAC,KAAM;EAC5D,MAAMY,YAAY,GAAGb,sBAAsB,CAAE;IAAEC;EAAM,CAAE,CAAC;EAExD,oBACCJ,IAAA,CAACC,iBAAiB,CAACgB,QAAQ;IAACb,KAAK,EAAGY,YAAc;IAAAD,QAAA,EAC/CA;EAAQ,CACiB,CAAC;AAE/B,CAAC;AAED,OAAO,MAAMG,qBAAqB,GAAGtB,IAAI,CAAEkB,yBAA0B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["deepmerge","fastDeepEqual","isPlainObject","createContext","useContext","useRef","useMemo","memo","warn","useUpdateEffect","jsx","_jsx","ComponentsContext","displayName","useComponentsContext","useContextSystemBridge","value","parentContext","valueRef","current","globalThis","SCRIPT_DEBUG","JSON","stringify","config","isMergeableObject","BaseContextSystemProvider","children","contextValue","Provider","ContextSystemProvider"],"sources":["@wordpress/components/src/context/context-system-provider.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseRef,\n\tuseMemo,\n\tmemo,\n} from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { useUpdateEffect } from '../utils';\n\nexport const ComponentsContext = createContext(\n\t/** @type {Record<string, any>} */ ( {} )\n);\nComponentsContext.displayName = 'ComponentsContext';\n\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( { value } ) {\n\tconst parentContext = useComponentsContext();\n\n\tconst valueRef = useRef( value );\n\n\tuseUpdateEffect( () => {\n\t\tif (\n\t\t\t// Objects are equivalent.\n\t\t\tfastDeepEqual( valueRef.current, value ) &&\n\t\t\t// But not the same reference.\n\t\t\tvalueRef.current !== value\n\t\t) {\n\t\t\twarn( `Please memoize your context: ${ JSON.stringify( value ) }` );\n\t\t}\n\t}, [ value ] );\n\n\t// `parentContext` will always be memoized (i.e., the result of this hook itself)\n\t// or the default value from when the `ComponentsContext` was originally\n\t// initialized (which will never change, it's a static variable)\n\t// so this memoization will prevent `deepmerge()` from rerunning unless\n\t// the references to `value` change OR the `parentContext` has an actual material change\n\t// (because again, it's guaranteed to be memoized or a static reference to the empty object\n\t// so we know that the only changes for `parentContext` are material ones... i.e., why we\n\t// don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n\t// need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n\t// correctly warning when the `value` isn't being properly memoized. All of that to say\n\t// that this should be super safe to assume that `useMemo` will only run on actual\n\t// changes to the two dependencies, therefore saving us calls to `deepmerge()`!\n\tconst config = useMemo( () => {\n\t\t// Deep clone `parentContext` to avoid mutating it later.\n\t\treturn deepmerge( parentContext ?? {}, value ?? {}, {\n\t\t\tisMergeableObject: isPlainObject,\n\t\t} );\n\t}, [ parentContext, value ] );\n\n\treturn 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 {import('react').ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ( { children, value } ) => {\n\tconst contextValue = useContextSystemBridge( { value } );\n\n\treturn (\n\t\t<ComponentsContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</ComponentsContext.Provider>\n\t);\n};\n\nexport const ContextSystemProvider = memo( BaseContextSystemProvider );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,WAAW;AACjC,OAAOC,aAAa,MAAM,qBAAqB;AAC/C,SAASC,aAAa,QAAQ,iBAAiB;;AAE/C;AACA;AACA;AACA,SACCC,aAAa,EACbC,UAAU,EACVC,MAAM,EACNC,OAAO,EACPC,IAAI,QACE,oBAAoB;AAC3B,OAAOC,IAAI,MAAM,oBAAoB;;AAErC;AACA;AACA;AACA,SAASC,eAAe,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,OAAO,MAAMC,iBAAiB,GAAGT,aAAa,CAC7C,kCAAqC,CAAC,CACvC,CAAC;AACDS,iBAAiB,CAACC,WAAW,GAAG,mBAAmB;AAEnD,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAMV,UAAU,CAAEQ,iBAAkB,CAAC;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,sBAAsBA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAC5C,MAAMC,aAAa,GAAGH,oBAAoB,CAAC,CAAC;EAE5C,MAAMI,QAAQ,GAAGb,MAAM,CAAEW,KAAM,CAAC;EAEhCP,eAAe,CAAE,MAAM;IACtB;IACC;IACAR,aAAa,CAAEiB,QAAQ,CAACC,OAAO,EAAEH,KAAM,CAAC;IACxC;IACAE,QAAQ,CAACC,OAAO,KAAKH,KAAK,EACzB;MACDI,UAAA,CAAAC,YAAA,YAAAb,IAAI,CAAE,gCAAiCc,IAAI,CAACC,SAAS,CAAEP,KAAM,CAAC,EAAI,CAAC;IACpE;EACD,CAAC,EAAE,CAAEA,KAAK,CAAG,CAAC;;EAEd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMQ,MAAM,GAAGlB,OAAO,CAAE,MAAM;IAC7B;IACA,OAAON,SAAS,CAAEiB,aAAa,aAAbA,aAAa,cAAbA,aAAa,GAAI,CAAC,CAAC,EAAED,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,CAAC,EAAE;MACnDS,iBAAiB,EAAEvB;IACpB,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEe,aAAa,EAAED,KAAK,CAAG,CAAC;EAE7B,OAAOQ,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,yBAAyB,GAAGA,CAAE;EAAEC,QAAQ;EAAEX;AAAM,CAAC,KAAM;EAC5D,MAAMY,YAAY,GAAGb,sBAAsB,CAAE;IAAEC;EAAM,CAAE,CAAC;EAExD,oBACCL,IAAA,CAACC,iBAAiB,CAACiB,QAAQ;IAACb,KAAK,EAAGY,YAAc;IAAAD,QAAA,EAC/CA;EAAQ,CACiB,CAAC;AAE/B,CAAC;AAED,OAAO,MAAMG,qBAAqB,GAAGvB,IAAI,CAAEmB,yBAA0B,CAAC","ignoreList":[]}
@@ -19,6 +19,7 @@ import SelectControlChevronDown from '../select-control/chevron-down';
19
19
  import BaseControl from '../base-control';
20
20
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
21
  export const CustomSelectContext = createContext(undefined);
22
+ CustomSelectContext.displayName = 'CustomSelectContext';
22
23
  function defaultRenderSelectedValue(value) {
23
24
  const isValueEmpty = Array.isArray(value) ? value.length === 0 : value === undefined || value === null;
24
25
  if (isValueEmpty) {
@@ -1 +1 @@
1
- {"version":3,"names":["Ariakit","createContext","useCallback","useMemo","__","_n","sprintf","VisuallyHidden","Styled","InputBase","SelectControlChevronDown","BaseControl","jsx","_jsx","jsxs","_jsxs","CustomSelectContext","undefined","defaultRenderSelectedValue","value","isValueEmpty","Array","isArray","length","CustomSelectButton","renderSelectedValue","size","store","restProps","currentValue","useStoreState","computedRenderSelectedValue","Select","hasCustomRenderProp","children","_CustomSelect","props","hideLabelFromVision","label","className","isLegacy","onSelectPopoverKeyDown","e","stopPropagation","contextValue","SelectLabel","render","VisualLabel","as","__next40pxDefaultSize","suffix","showOnKeyDown","SelectPopover","gutter","sameWidth","slide","onKeyDown","flip","Provider"],"sources":["@wordpress/components/src/custom-select-control-v2/custom-select.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { createContext, useCallback, useMemo } from '@wordpress/element';\nimport { __, _n, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { VisuallyHidden } from '..';\nimport * as Styled from './styles';\nimport type {\n\tCustomSelectContext as CustomSelectContextType,\n\tCustomSelectStore,\n\tCustomSelectButtonProps,\n\tCustomSelectButtonSize,\n\t_CustomSelectInternalProps,\n\t_CustomSelectProps,\n} from './types';\nimport InputBase from '../input-control/input-base';\nimport SelectControlChevronDown from '../select-control/chevron-down';\nimport BaseControl from '../base-control';\n\nexport const CustomSelectContext =\n\tcreateContext< CustomSelectContextType >( undefined );\n\nfunction defaultRenderSelectedValue(\n\tvalue: CustomSelectButtonProps[ 'value' ]\n) {\n\tconst isValueEmpty = Array.isArray( value )\n\t\t? value.length === 0\n\t\t: value === undefined || value === null;\n\n\tif ( isValueEmpty ) {\n\t\treturn __( 'Select an item' );\n\t}\n\n\tif ( Array.isArray( value ) ) {\n\t\treturn value.length === 1\n\t\t\t? value[ 0 ]\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %d: number of items selected (it will always be 2 or more items)\n\t\t\t\t\t_n( '%d item selected', '%d items selected', value.length ),\n\t\t\t\t\tvalue.length\n\t\t\t );\n\t}\n\n\treturn value;\n}\n\nconst CustomSelectButton = ( {\n\trenderSelectedValue,\n\tsize = 'default',\n\tstore,\n\t...restProps\n}: Omit<\n\tReact.ComponentProps< typeof Ariakit.Select > &\n\t\tCustomSelectButtonProps &\n\t\tCustomSelectButtonSize &\n\t\tCustomSelectStore,\n\t'onChange'\n> ) => {\n\tconst { value: currentValue } = Ariakit.useStoreState( store );\n\n\tconst computedRenderSelectedValue = useMemo(\n\t\t() => renderSelectedValue ?? defaultRenderSelectedValue,\n\t\t[ renderSelectedValue ]\n\t);\n\n\treturn (\n\t\t<Styled.Select\n\t\t\t{ ...restProps }\n\t\t\tsize={ size }\n\t\t\thasCustomRenderProp={ !! renderSelectedValue }\n\t\t\tstore={ store }\n\t\t>\n\t\t\t{ computedRenderSelectedValue( currentValue ) }\n\t\t</Styled.Select>\n\t);\n};\n\nfunction _CustomSelect(\n\tprops: _CustomSelectInternalProps &\n\t\t_CustomSelectProps &\n\t\tCustomSelectStore &\n\t\tCustomSelectButtonSize\n) {\n\tconst {\n\t\tchildren,\n\t\thideLabelFromVision = false,\n\t\tlabel,\n\t\tsize,\n\t\tstore,\n\t\tclassName,\n\t\tisLegacy = false,\n\t\t...restProps\n\t} = props;\n\n\tconst onSelectPopoverKeyDown: React.KeyboardEventHandler< HTMLDivElement > =\n\t\tuseCallback(\n\t\t\t( e ) => {\n\t\t\t\tif ( isLegacy ) {\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ isLegacy ]\n\t\t);\n\n\tconst contextValue = useMemo( () => ( { store, size } ), [ store, size ] );\n\n\treturn (\n\t\t// Where should `restProps` be forwarded to?\n\t\t<div className={ className }>\n\t\t\t<Ariakit.SelectLabel\n\t\t\t\tstore={ store }\n\t\t\t\trender={\n\t\t\t\t\thideLabelFromVision ? (\n\t\t\t\t\t\t// @ts-expect-error `children` are passed via the render prop\n\t\t\t\t\t\t<VisuallyHidden />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// @ts-expect-error `children` are passed via the render prop\n\t\t\t\t\t\t<BaseControl.VisualLabel as=\"div\" />\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ label }\n\t\t\t</Ariakit.SelectLabel>\n\t\t\t<InputBase\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tsize={ size }\n\t\t\t\tsuffix={ <SelectControlChevronDown /> }\n\t\t\t>\n\t\t\t\t<CustomSelectButton\n\t\t\t\t\t{ ...restProps }\n\t\t\t\t\tsize={ size }\n\t\t\t\t\tstore={ store }\n\t\t\t\t\t// Match legacy behavior (move selection rather than open the popover)\n\t\t\t\t\tshowOnKeyDown={ ! isLegacy }\n\t\t\t\t/>\n\t\t\t\t<Styled.SelectPopover\n\t\t\t\t\tgutter={ 12 }\n\t\t\t\t\tstore={ store }\n\t\t\t\t\tsameWidth\n\t\t\t\t\tslide={ false }\n\t\t\t\t\tonKeyDown={ onSelectPopoverKeyDown }\n\t\t\t\t\t// Match legacy behavior\n\t\t\t\t\tflip={ ! isLegacy }\n\t\t\t\t>\n\t\t\t\t\t<CustomSelectContext.Provider value={ contextValue }>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</CustomSelectContext.Provider>\n\t\t\t\t</Styled.SelectPopover>\n\t\t\t</InputBase>\n\t\t</div>\n\t);\n}\n\nexport default _CustomSelect;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,SAASC,aAAa,EAAEC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACxE,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA,SAASC,cA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,EAAGA,IAAM;UACbC,KAAK,EAAGA;UACR;UAAA;UACAwB,aAAa,EAAG,CAAEX;QAAU,CAC5B,CAAC,eACF3B,IAAA,CAACL,MAAM,CAAC4C,aAAa;UACpBC,MAAM,EAAG,EAAI;UACb1B,KAAK,EAAGA,KAAO;UACf2B,SAAS;UACTC,KAAK,EAAG,KAAO;UACfC,SAAS,EAAGf;UACZ;UAAA;UACAgB,IAAI,EAAG,CAAEjB,QAAU;UAAAN,QAAA,eAEnBrB,IAAA,CAACG,mBAAmB,CAAC0C,QAAQ;YAACvC,KAAK,EAAGyB,YAAc;YAAAV,QAAA,EACjDA;UAAQ,CACmB;QAAC,CACV,CAAC;MAAA,CACb,CAAC;IAAA,CACR;EAAC;AAER;AAEA,eAAeC,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["Ariakit","createContext","useCallback","useMemo","__","_n","sprintf","VisuallyHidden","Styled","InputBase","SelectControlChevronDown","BaseControl","jsx","_jsx","jsxs","_jsxs","CustomSelectContext","undefined","displayName","defaultRenderSelectedValue","value","isValueEmpty","Array","isArray","length","CustomSelectButton","renderSelectedValue","size","store","restProps","currentValue","useStoreState","computedRenderSelectedValue","Select","hasCustomRenderProp","children","_CustomSelect","props","hideLabelFromVision","label","className","isLegacy","onSelectPopoverKeyDown","e","stopPropagation","contextValue","SelectLabel","render","VisualLabel","as","__next40pxDefaultSize","suffix","showOnKeyDown","SelectPopover","gutter","sameWidth","slide","onKeyDown","flip","Provider"],"sources":["@wordpress/components/src/custom-select-control-v2/custom-select.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { createContext, useCallback, useMemo } from '@wordpress/element';\nimport { __, _n, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { VisuallyHidden } from '..';\nimport * as Styled from './styles';\nimport type {\n\tCustomSelectContext as CustomSelectContextType,\n\tCustomSelectStore,\n\tCustomSelectButtonProps,\n\tCustomSelectButtonSize,\n\t_CustomSelectInternalProps,\n\t_CustomSelectProps,\n} from './types';\nimport InputBase from '../input-control/input-base';\nimport SelectControlChevronDown from '../select-control/chevron-down';\nimport BaseControl from '../base-control';\n\nexport const CustomSelectContext =\n\tcreateContext< CustomSelectContextType >( undefined );\nCustomSelectContext.displayName = 'CustomSelectContext';\n\nfunction defaultRenderSelectedValue(\n\tvalue: CustomSelectButtonProps[ 'value' ]\n) {\n\tconst isValueEmpty = Array.isArray( value )\n\t\t? value.length === 0\n\t\t: value === undefined || value === null;\n\n\tif ( isValueEmpty ) {\n\t\treturn __( 'Select an item' );\n\t}\n\n\tif ( Array.isArray( value ) ) {\n\t\treturn value.length === 1\n\t\t\t? value[ 0 ]\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %d: number of items selected (it will always be 2 or more items)\n\t\t\t\t\t_n( '%d item selected', '%d items selected', value.length ),\n\t\t\t\t\tvalue.length\n\t\t\t );\n\t}\n\n\treturn value;\n}\n\nconst CustomSelectButton = ( {\n\trenderSelectedValue,\n\tsize = 'default',\n\tstore,\n\t...restProps\n}: Omit<\n\tReact.ComponentProps< typeof Ariakit.Select > &\n\t\tCustomSelectButtonProps &\n\t\tCustomSelectButtonSize &\n\t\tCustomSelectStore,\n\t'onChange'\n> ) => {\n\tconst { value: currentValue } = Ariakit.useStoreState( store );\n\n\tconst computedRenderSelectedValue = useMemo(\n\t\t() => renderSelectedValue ?? defaultRenderSelectedValue,\n\t\t[ renderSelectedValue ]\n\t);\n\n\treturn (\n\t\t<Styled.Select\n\t\t\t{ ...restProps }\n\t\t\tsize={ size }\n\t\t\thasCustomRenderProp={ !! renderSelectedValue }\n\t\t\tstore={ store }\n\t\t>\n\t\t\t{ computedRenderSelectedValue( currentValue ) }\n\t\t</Styled.Select>\n\t);\n};\n\nfunction _CustomSelect(\n\tprops: _CustomSelectInternalProps &\n\t\t_CustomSelectProps &\n\t\tCustomSelectStore &\n\t\tCustomSelectButtonSize\n) {\n\tconst {\n\t\tchildren,\n\t\thideLabelFromVision = false,\n\t\tlabel,\n\t\tsize,\n\t\tstore,\n\t\tclassName,\n\t\tisLegacy = false,\n\t\t...restProps\n\t} = props;\n\n\tconst onSelectPopoverKeyDown: React.KeyboardEventHandler< HTMLDivElement > =\n\t\tuseCallback(\n\t\t\t( e ) => {\n\t\t\t\tif ( isLegacy ) {\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ isLegacy ]\n\t\t);\n\n\tconst contextValue = useMemo( () => ( { store, size } ), [ store, size ] );\n\n\treturn (\n\t\t// Where should `restProps` be forwarded to?\n\t\t<div className={ className }>\n\t\t\t<Ariakit.SelectLabel\n\t\t\t\tstore={ store }\n\t\t\t\trender={\n\t\t\t\t\thideLabelFromVision ? (\n\t\t\t\t\t\t// @ts-expect-error `children` are passed via the render prop\n\t\t\t\t\t\t<VisuallyHidden />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// @ts-expect-error `children` are passed via the render prop\n\t\t\t\t\t\t<BaseControl.VisualLabel as=\"div\" />\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ label }\n\t\t\t</Ariakit.SelectLabel>\n\t\t\t<InputBase\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tsize={ size }\n\t\t\t\tsuffix={ <SelectControlChevronDown /> }\n\t\t\t>\n\t\t\t\t<CustomSelectButton\n\t\t\t\t\t{ ...restProps }\n\t\t\t\t\tsize={ size }\n\t\t\t\t\tstore={ store }\n\t\t\t\t\t// Match legacy behavior (move selection rather than open the popover)\n\t\t\t\t\tshowOnKeyDown={ ! isLegacy }\n\t\t\t\t/>\n\t\t\t\t<Styled.SelectPopover\n\t\t\t\t\tgutter={ 12 }\n\t\t\t\t\tstore={ store }\n\t\t\t\t\tsameWidth\n\t\t\t\t\tslide={ false }\n\t\t\t\t\tonKeyDown={ onSelectPopoverKeyDown }\n\t\t\t\t\t// Match legacy behavior\n\t\t\t\t\tflip={ ! isLegacy }\n\t\t\t\t>\n\t\t\t\t\t<CustomSelectContext.Provider value={ contextValue }>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</CustomSelectContext.Provider>\n\t\t\t\t</Styled.SelectPopover>\n\t\t\t</InputBase>\n\t\t</div>\n\t);\n}\n\nexport default _CustomSelect;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,SAASC,aAAa,EAAEC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACxE,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA,SAASC,cAAc,QAAQ,IAAI;AACnC,OAAO,KAAKC,MAAM,MAAM,UAAU;AASlC,OAAOC,SAAS,MAAM,6BAA6B;AACnD,OAAOC,wBAAwB,MAAM,gCAAgC;AACrE,OAAOC,WAAW,MAAM,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE1C,OAAO,MAAMC,mBAAmB,GAC/Bf,aAAa,CAA6BgB,SAAU,CAAC;AACtDD,mBAAmB,CAACE,WAAW,GAAG,qBAAqB;AAEvD,SAASC,0BAA0BA,CAClCC,KAAyC,EACxC;EACD,MAAMC,YAAY,GAAGC,KAAK,CAACC,OAAO,CAAEH,KAAM,CAAC,GACxCA,KAAK,CAACI,MAAM,KAAK,CAAC,GAClBJ,KAAK,KAAKH,SAAS,IAAIG,KAAK,KAAK,IAAI;EAExC,IAAKC,YAAY,EAAG;IACnB,OAAOjB,EAAE,CAAE,gBAAiB,CAAC;EAC9B;EAEA,IAAKkB,KAAK,CAACC,OAAO,CAAEH,KAAM,CAAC,EAAG;IAC7B,OAAOA,KAAK,CAACI,MAAM,KAAK,CAAC,GACtBJ,KAAK,CAAE,CAAC,CAAE,GACVd,OAAO;IACP;IACAD,EAAE,CAAE,kBAAkB,EAAE,mBAAmB,EAAEe,KAAK,C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A,gBAC3BtB,IAAA,CAACb,OAAO,CAAC8C,WAAW;QACnBlB,KAAK,EAAGA,KAAO;QACfmB,MAAM,EACLT,mBAAmB;QAAA;QAClB;QACAzB,IAAA,CAACN,cAAc,IAAE,CAAC;QAAA;QAElB;QACAM,IAAA,CAACF,WAAW,CAACqC,WAAW;UAACC,EAAE,EAAC;QAAK,CAAE,CAEpC;QAAAd,QAAA,EAECI;MAAK,CACa,CAAC,eACtBxB,KAAA,CAACN,SAAS;QACTyC,qBAAqB;QACrBvB,IAAI,EAAGA,IAAM;QACbwB,MAAM,eAAGtC,IAAA,CAACH,wBAAwB,IAAE,CAAG;QAAAyB,QAAA,gBAEvCtB,IAAA,CAACY,kBAAkB;UAAA,GACbI,SAAS;UACdF,IAAI,EAAGA,IAAM;UACbC,KAAK,EAAGA;UACR;UAAA;UACAwB,aAAa,EAAG,CAAEX;QAAU,CAC5B,CAAC,eACF5B,IAAA,CAACL,MAAM,CAAC6C,aAAa;UACpBC,MAAM,EAAG,EAAI;UACb1B,KAAK,EAAGA,KAAO;UACf2B,SAAS;UACTC,KAAK,EAAG,KAAO;UACfC,SAAS,EAAGf;UACZ;UAAA;UACAgB,IAAI,EAAG,CAAEjB,QAAU;UAAAN,QAAA,eAEnBtB,IAAA,CAACG,mBAAmB,CAAC2C,QAAQ;YAACvC,KAAK,EAAGyB,YAAc;YAAAV,QAAA,EACjDA;UAAQ,CACmB;QAAC,CACV,CAAC;MAAA,CACb,CAAC;IAAA,CACR;EAAC;AAER;AAEA,eAAeC,aAAa","ignoreList":[]}
@@ -10,6 +10,7 @@ import { disabledStyles } from './styles/disabled-styles';
10
10
  import { useCx } from '../utils';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  const Context = createContext(false);
13
+ Context.displayName = 'DisabledContext';
13
14
  const {
14
15
  Consumer,
15
16
  Provider
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","disabledStyles","useCx","jsx","_jsx","Context","Consumer","Provider","Disabled","className","children","isDisabled","props","cx","value","inert","undefined"],"sources":["@wordpress/components/src/disabled/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { disabledStyles } from './styles/disabled-styles';\nimport type { DisabledProps } from './types';\nimport type { WordPressComponentProps } from '../context';\nimport { useCx } from '../utils';\n\nconst Context = createContext< boolean >( false );\nconst { Consumer, Provider } = Context;\n\n/**\n * `Disabled` is a component which disables descendant tabbable elements and\n * prevents pointer interaction.\n *\n * _Note: this component may not behave as expected in browsers that don't\n * support the `inert` HTML attribute. We recommend adding the official WICG\n * polyfill when using this component in your project._\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n *\n * ```jsx\n * import { Button, Disabled, TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDisabled = () => {\n * \tconst [ isDisabled, setIsDisabled ] = useState( true );\n *\n *\tlet input = (\n *\t\t<TextControl\n *\t\t\t__next40pxDefaultSize\n *\t\t\t__nextHasNoMarginBottom\n *\t\t\tlabel=\"Input\"\n *\t\t\tonChange={ () => {} }\n *\t\t/>\n *\t);\n * \tif ( isDisabled ) {\n * \t\tinput = <Disabled>{ input }</Disabled>;\n * \t}\n *\n * \tconst toggleDisabled = () => {\n * \t\tsetIsDisabled( ( state ) => ! state );\n * \t};\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t{ input }\n * \t\t\t<Button variant=\"primary\" onClick={ toggleDisabled }>\n * \t\t\t\tToggle Disabled\n * \t\t\t</Button>\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nfunction Disabled( {\n\tclassName,\n\tchildren,\n\tisDisabled = true,\n\t...props\n}: WordPressComponentProps< DisabledProps, 'div' > ) {\n\tconst cx = useCx();\n\n\treturn (\n\t\t<Provider value={ isDisabled }>\n\t\t\t<div\n\t\t\t\t// @ts-ignore Reason: inert is a recent HTML attribute\n\t\t\t\tinert={ isDisabled ? 'true' : undefined }\n\t\t\t\tclassName={\n\t\t\t\t\tisDisabled\n\t\t\t\t\t\t? cx( disabledStyles, className, 'components-disabled' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</Provider>\n\t);\n}\n\nDisabled.Context = Context;\nDisabled.Consumer = Consumer;\n\nexport default Disabled;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;AACA,SAASC,cAAc,QAAQ,0BAA0B;AAGzD,SAASC,KAAK,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEjC,MAAMC,OAAO,GAAGL,aAAa,CAAa,KAAM,CAAC;AACjD,MAAM;EAAEM,QAAQ;EAAEC;AAAS,CAAC,GAAGF,OAAO;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,QAAQA,CAAE;EAClBC,SAAS;EACTC,QAAQ;EACRC,UAAU,GAAG,IAAI;EACjB,GAAGC;AAC6C,CAAC,EAAG;EACpD,MAAMC,EAAE,GAAGX,KAAK,CAAC,CAAC;EAElB,oBACCE,IAAA,CAACG,QAAQ;IAACO,KAAK,EAAGH,UAAY;IAAAD,QAAA,eAC7BN,IAAA;MACC;MACAW,KAAK,EAAGJ,UAAU,GAAG,MAAM,GAAGK,SAAW;MACzCP,SAAS,EACRE,UAAU,GACPE,EAAE,CAAEZ,cAAc,EAAEQ,SAAS,EAAE,qBAAsB,CAAC,GACtDO,SACH;MAAA,GACIJ,KAAK;MAAAF,QAAA,EAERA;IAAQ,CACN;EAAC,CACG,CAAC;AAEb;AAEAF,QAAQ,CAACH,OAAO,GAAGA,OAAO;AAC1BG,QAAQ,CAACF,QAAQ,GAAGA,QAAQ;AAE5B,eAAeE,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["createContext","disabledStyles","useCx","jsx","_jsx","Context","displayName","Consumer","Provider","Disabled","className","children","isDisabled","props","cx","value","inert","undefined"],"sources":["@wordpress/components/src/disabled/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { disabledStyles } from './styles/disabled-styles';\nimport type { DisabledProps } from './types';\nimport type { WordPressComponentProps } from '../context';\nimport { useCx } from '../utils';\n\nconst Context = createContext< boolean >( false );\nContext.displayName = 'DisabledContext';\n\nconst { Consumer, Provider } = Context;\n\n/**\n * `Disabled` is a component which disables descendant tabbable elements and\n * prevents pointer interaction.\n *\n * _Note: this component may not behave as expected in browsers that don't\n * support the `inert` HTML attribute. We recommend adding the official WICG\n * polyfill when using this component in your project._\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n *\n * ```jsx\n * import { Button, Disabled, TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDisabled = () => {\n * \tconst [ isDisabled, setIsDisabled ] = useState( true );\n *\n *\tlet input = (\n *\t\t<TextControl\n *\t\t\t__next40pxDefaultSize\n *\t\t\t__nextHasNoMarginBottom\n *\t\t\tlabel=\"Input\"\n *\t\t\tonChange={ () => {} }\n *\t\t/>\n *\t);\n * \tif ( isDisabled ) {\n * \t\tinput = <Disabled>{ input }</Disabled>;\n * \t}\n *\n * \tconst toggleDisabled = () => {\n * \t\tsetIsDisabled( ( state ) => ! state );\n * \t};\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t{ input }\n * \t\t\t<Button variant=\"primary\" onClick={ toggleDisabled }>\n * \t\t\t\tToggle Disabled\n * \t\t\t</Button>\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nfunction Disabled( {\n\tclassName,\n\tchildren,\n\tisDisabled = true,\n\t...props\n}: WordPressComponentProps< DisabledProps, 'div' > ) {\n\tconst cx = useCx();\n\n\treturn (\n\t\t<Provider value={ isDisabled }>\n\t\t\t<div\n\t\t\t\t// @ts-ignore Reason: inert is a recent HTML attribute\n\t\t\t\tinert={ isDisabled ? 'true' : undefined }\n\t\t\t\tclassName={\n\t\t\t\t\tisDisabled\n\t\t\t\t\t\t? cx( disabledStyles, className, 'components-disabled' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</Provider>\n\t);\n}\n\nDisabled.Context = Context;\nDisabled.Consumer = Consumer;\n\nexport default Disabled;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;AACA,SAASC,cAAc,QAAQ,0BAA0B;AAGzD,SAASC,KAAK,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEjC,MAAMC,OAAO,GAAGL,aAAa,CAAa,KAAM,CAAC;AACjDK,OAAO,CAACC,WAAW,GAAG,iBAAiB;AAEvC,MAAM;EAAEC,QAAQ;EAAEC;AAAS,CAAC,GAAGH,OAAO;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,QAAQA,CAAE;EAClBC,SAAS;EACTC,QAAQ;EACRC,UAAU,GAAG,IAAI;EACjB,GAAGC;AAC6C,CAAC,EAAG;EACpD,MAAMC,EAAE,GAAGZ,KAAK,CAAC,CAAC;EAElB,oBACCE,IAAA,CAACI,QAAQ;IAACO,KAAK,EAAGH,UAAY;IAAAD,QAAA,eAC7BP,IAAA;MACC;MACAY,KAAK,EAAGJ,UAAU,GAAG,MAAM,GAAGK,SAAW;MACzCP,SAAS,EACRE,UAAU,GACPE,EAAE,CAAEb,cAAc,EAAES,SAAS,EAAE,qBAAsB,CAAC,GACtDO,SACH;MAAA,GACIJ,KAAK;MAAAF,QAAA,EAERA;IAAQ,CACN;EAAC,CACG,CAAC;AAEb;AAEAF,QAAQ,CAACJ,OAAO,GAAGA,OAAO;AAC1BI,QAAQ,CAACF,QAAQ,GAAGA,QAAQ;AAE5B,eAAeE,QAAQ","ignoreList":[]}
@@ -10,5 +10,6 @@ import { createContext, useContext } from '@wordpress/element';
10
10
  export const ItemGroupContext = createContext({
11
11
  size: 'medium'
12
12
  });
13
+ ItemGroupContext.displayName = 'ItemGroupContext';
13
14
  export const useItemGroupContext = () => useContext(ItemGroupContext);
14
15
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","useContext","ItemGroupContext","size","useItemGroupContext"],"sources":["@wordpress/components/src/item-group/context.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ItemGroupContext as Context } from './types';\n\nexport const ItemGroupContext = createContext( {\n\tsize: 'medium',\n} as Context );\n\nexport const useItemGroupContext = () => useContext( ItemGroupContext );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,oBAAoB;;AAE9D;AACA;AACA;;AAGA,OAAO,MAAMC,gBAAgB,GAAGF,aAAa,CAAE;EAC9CG,IAAI,EAAE;AACP,CAAa,CAAC;AAEd,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAMH,UAAU,CAAEC,gBAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createContext","useContext","ItemGroupContext","size","displayName","useItemGroupContext"],"sources":["@wordpress/components/src/item-group/context.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ItemGroupContext as Context } from './types';\n\nexport const ItemGroupContext = createContext( {\n\tsize: 'medium',\n} as Context );\nItemGroupContext.displayName = 'ItemGroupContext';\n\nexport const useItemGroupContext = () => useContext( ItemGroupContext );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,UAAU,QAAQ,oBAAoB;;AAE9D;AACA;AACA;;AAGA,OAAO,MAAMC,gBAAgB,GAAGF,aAAa,CAAE;EAC9CG,IAAI,EAAE;AACP,CAAa,CAAC;AACdD,gBAAgB,CAACE,WAAW,GAAG,kBAAkB;AAEjD,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAMJ,UAAU,CAAEC,gBAAiB,CAAC","ignoreList":[]}
@@ -8,4 +8,5 @@ import { createContext } from '@wordpress/element';
8
8
  */
9
9
 
10
10
  export const Context = createContext(undefined);
11
+ Context.displayName = 'MenuContext';
11
12
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","Context","undefined"],"sources":["@wordpress/components/src/menu/context.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ContextProps } from './types';\n\nexport const Context = createContext< ContextProps | undefined >( undefined );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;;AAGA,OAAO,MAAMC,OAAO,GAAGD,aAAa,CAA8BE,SAAU,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createContext","Context","undefined","displayName"],"sources":["@wordpress/components/src/menu/context.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ContextProps } from './types';\n\nexport const Context = createContext< ContextProps | undefined >( undefined );\nContext.displayName = 'MenuContext';\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;;AAGA,OAAO,MAAMC,OAAO,GAAGD,aAAa,CAA8BE,SAAU,CAAC;AAC7ED,OAAO,CAACE,WAAW,GAAG,aAAa","ignoreList":[]}
@@ -25,6 +25,7 @@ import { useModalExitAnimation } from './use-modal-exit-animation';
25
25
  // Used to track and dismiss the prior modal when another opens unless nested.
26
26
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
27
27
  const ModalContext = createContext(new Set());
28
+ ModalContext.displayName = 'ModalContext';
28
29
 
29
30
  // Used to track body class names applied while modals are open.
30
31
  const bodyOpenClasses = new Map();