@wordpress/components 34.0.0 → 35.0.1

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 (514) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/build/alignment-matrix-control/cell.cjs +1 -1
  3. package/build/alignment-matrix-control/cell.cjs.map +2 -2
  4. package/build/alignment-matrix-control/index.cjs +1 -1
  5. package/build/alignment-matrix-control/index.cjs.map +2 -2
  6. package/build/border-control/border-control-dropdown/component.cjs +33 -33
  7. package/build/border-control/border-control-dropdown/component.cjs.map +3 -3
  8. package/build/color-palette/index.cjs +3 -0
  9. package/build/color-palette/index.cjs.map +2 -2
  10. package/build/custom-gradient-picker/gradient-bar/index.cjs.map +2 -2
  11. package/build/disabled/index.cjs +1 -1
  12. package/build/disabled/index.cjs.map +2 -2
  13. package/build/draggable/index.cjs +1 -1
  14. package/build/draggable/index.cjs.map +2 -2
  15. package/build/higher-order/with-notices/index.cjs +15 -3
  16. package/build/higher-order/with-notices/index.cjs.map +2 -2
  17. package/build/input-control/input-base.cjs +34 -31
  18. package/build/input-control/input-base.cjs.map +2 -2
  19. package/build/navigable-container/container.cjs +15 -21
  20. package/build/navigable-container/container.cjs.map +2 -2
  21. package/build/responsive-wrapper/index.cjs +3 -4
  22. package/build/responsive-wrapper/index.cjs.map +2 -2
  23. package/build/tooltip/index.cjs +1 -2
  24. package/build/tooltip/index.cjs.map +2 -2
  25. package/build/unit-control/utils.cjs +33 -35
  26. package/build/unit-control/utils.cjs.map +2 -2
  27. package/build-module/alignment-matrix-control/cell.mjs +1 -1
  28. package/build-module/alignment-matrix-control/cell.mjs.map +2 -2
  29. package/build-module/alignment-matrix-control/index.mjs +1 -1
  30. package/build-module/alignment-matrix-control/index.mjs.map +2 -2
  31. package/build-module/border-control/border-control-dropdown/component.mjs +34 -34
  32. package/build-module/border-control/border-control-dropdown/component.mjs.map +2 -2
  33. package/build-module/color-palette/index.mjs +3 -0
  34. package/build-module/color-palette/index.mjs.map +2 -2
  35. package/build-module/custom-gradient-picker/gradient-bar/index.mjs.map +2 -2
  36. package/build-module/disabled/index.mjs +1 -1
  37. package/build-module/disabled/index.mjs.map +2 -2
  38. package/build-module/draggable/index.mjs +1 -1
  39. package/build-module/draggable/index.mjs.map +2 -2
  40. package/build-module/higher-order/with-notices/index.mjs +16 -4
  41. package/build-module/higher-order/with-notices/index.mjs.map +2 -2
  42. package/build-module/input-control/input-base.mjs +34 -31
  43. package/build-module/input-control/input-base.mjs.map +2 -2
  44. package/build-module/navigable-container/container.mjs +16 -22
  45. package/build-module/navigable-container/container.mjs.map +2 -2
  46. package/build-module/responsive-wrapper/index.mjs +3 -4
  47. package/build-module/responsive-wrapper/index.mjs.map +2 -2
  48. package/build-module/tooltip/index.mjs +1 -2
  49. package/build-module/tooltip/index.mjs.map +2 -2
  50. package/build-module/unit-control/utils.mjs +33 -35
  51. package/build-module/unit-control/utils.mjs.map +2 -2
  52. package/build-style/style-rtl.css +41 -10
  53. package/build-style/style.css +41 -10
  54. package/build-types/border-box-control/border-box-control/hook.d.ts +10 -24
  55. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  56. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +12 -26
  57. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  58. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +10 -24
  59. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  60. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +11 -25
  61. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  62. package/build-types/border-control/border-control/hook.d.ts +10 -24
  63. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  64. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  65. package/build-types/border-control/border-control-dropdown/hook.d.ts +9 -23
  66. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  67. package/build-types/box-control/styles/box-control-styles.d.ts +2 -2
  68. package/build-types/card/card/hook.d.ts +11 -25
  69. package/build-types/card/card/hook.d.ts.map +1 -1
  70. package/build-types/card/card-body/hook.d.ts +11 -25
  71. package/build-types/card/card-body/hook.d.ts.map +1 -1
  72. package/build-types/card/card-divider/hook.d.ts +12 -26
  73. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  74. package/build-types/card/card-footer/hook.d.ts +11 -25
  75. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  76. package/build-types/card/card-header/hook.d.ts +11 -25
  77. package/build-types/card/card-header/hook.d.ts.map +1 -1
  78. package/build-types/card/card-media/hook.d.ts +11 -25
  79. package/build-types/card/card-media/hook.d.ts.map +1 -1
  80. package/build-types/card/context.d.ts +3 -0
  81. package/build-types/card/context.d.ts.map +1 -0
  82. package/build-types/color-palette/index.d.ts.map +1 -1
  83. package/build-types/color-picker/styles.d.ts +2 -2
  84. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  85. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
  86. package/build-types/custom-select-control-v2/styles.d.ts +12 -4
  87. package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
  88. package/build-types/date-time/date/index.d.ts +23 -0
  89. package/build-types/date-time/date/index.d.ts.map +1 -0
  90. package/build-types/date-time/date/styles.d.ts +45 -0
  91. package/build-types/date-time/date/styles.d.ts.map +1 -0
  92. package/build-types/date-time/date/test/index.d.ts +2 -0
  93. package/build-types/date-time/date/test/index.d.ts.map +1 -0
  94. package/build-types/date-time/date/test/use-lilius.d.ts +2 -0
  95. package/build-types/date-time/date/test/use-lilius.d.ts.map +1 -0
  96. package/build-types/date-time/date/use-lilius/index.d.ts +169 -0
  97. package/build-types/date-time/date/use-lilius/index.d.ts.map +1 -0
  98. package/build-types/date-time/time/index.d.ts +27 -0
  99. package/build-types/date-time/time/index.d.ts.map +1 -0
  100. package/build-types/date-time/time/styles.d.ts +93 -0
  101. package/build-types/date-time/time/styles.d.ts.map +1 -0
  102. package/build-types/date-time/time/test/index.d.ts +2 -0
  103. package/build-types/date-time/time/test/index.d.ts.map +1 -0
  104. package/build-types/date-time/time/time-input/index.d.ts +4 -0
  105. package/build-types/date-time/time/time-input/index.d.ts.map +1 -0
  106. package/build-types/date-time/time/time-input/test/index.d.ts +2 -0
  107. package/build-types/date-time/time/time-input/test/index.d.ts.map +1 -0
  108. package/build-types/date-time/time/timezone.d.ts +7 -0
  109. package/build-types/date-time/time/timezone.d.ts.map +1 -0
  110. package/build-types/date-time/time-picker/styles.d.ts +4 -4
  111. package/build-types/elevation/hook.d.ts +11 -25
  112. package/build-types/elevation/hook.d.ts.map +1 -1
  113. package/build-types/flex/flex/hook.d.ts +11 -25
  114. package/build-types/flex/flex/hook.d.ts.map +1 -1
  115. package/build-types/flex/flex-block/hook.d.ts +11 -25
  116. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  117. package/build-types/flex/flex-item/hook.d.ts +11 -25
  118. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  119. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  120. package/build-types/grid/hook.d.ts +11 -25
  121. package/build-types/grid/hook.d.ts.map +1 -1
  122. package/build-types/h-stack/hook.d.ts +11 -25
  123. package/build-types/h-stack/hook.d.ts.map +1 -1
  124. package/build-types/heading/hook.d.ts +11 -25
  125. package/build-types/heading/hook.d.ts.map +1 -1
  126. package/build-types/higher-order/with-fallback-styles/index.d.ts +3 -1
  127. package/build-types/higher-order/with-filters/index.d.ts +6 -1
  128. package/build-types/higher-order/with-filters/index.d.ts.map +1 -1
  129. package/build-types/higher-order/with-notices/index.d.ts +4 -2
  130. package/build-types/higher-order/with-notices/index.d.ts.map +1 -1
  131. package/build-types/input-control/reducer/reducer.d.ts +1 -1
  132. package/build-types/item-group/item/hook.d.ts +11 -25
  133. package/build-types/item-group/item/hook.d.ts.map +1 -1
  134. package/build-types/item-group/item-group/hook.d.ts +11 -25
  135. package/build-types/item-group/item-group/hook.d.ts.map +1 -1
  136. package/build-types/menu/stories/index.story.d.ts.map +1 -1
  137. package/build-types/menu/styles.d.ts +21 -7
  138. package/build-types/menu/styles.d.ts.map +1 -1
  139. package/build-types/modal/use-modal-exit-animation.d.ts +1 -1
  140. package/build-types/navigable-container/container.d.ts.map +1 -1
  141. package/build-types/navigation/back-button/index.d.ts +7 -0
  142. package/build-types/navigation/back-button/index.d.ts.map +1 -0
  143. package/build-types/navigation/constants.d.ts +3 -0
  144. package/build-types/navigation/constants.d.ts.map +1 -0
  145. package/build-types/navigation/context.d.ts +4 -0
  146. package/build-types/navigation/context.d.ts.map +1 -0
  147. package/build-types/navigation/group/context.d.ts +7 -0
  148. package/build-types/navigation/group/context.d.ts.map +1 -0
  149. package/build-types/navigation/group/index.d.ts +7 -0
  150. package/build-types/navigation/group/index.d.ts.map +1 -0
  151. package/build-types/navigation/index.d.ts +46 -0
  152. package/build-types/navigation/index.d.ts.map +1 -0
  153. package/build-types/navigation/item/base-content.d.ts +3 -0
  154. package/build-types/navigation/item/base-content.d.ts.map +1 -0
  155. package/build-types/navigation/item/base.d.ts +3 -0
  156. package/build-types/navigation/item/base.d.ts.map +1 -0
  157. package/build-types/navigation/item/index.d.ts +7 -0
  158. package/build-types/navigation/item/index.d.ts.map +1 -0
  159. package/build-types/navigation/item/use-navigation-tree-item.d.ts +3 -0
  160. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -0
  161. package/build-types/navigation/menu/context.d.ts +7 -0
  162. package/build-types/navigation/menu/context.d.ts.map +1 -0
  163. package/build-types/navigation/menu/index.d.ts +7 -0
  164. package/build-types/navigation/menu/index.d.ts.map +1 -0
  165. package/build-types/navigation/menu/menu-title-search.d.ts +3 -0
  166. package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -0
  167. package/build-types/navigation/menu/menu-title.d.ts +3 -0
  168. package/build-types/navigation/menu/menu-title.d.ts.map +1 -0
  169. package/build-types/navigation/menu/search-no-results-found.d.ts +3 -0
  170. package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -0
  171. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +3 -0
  172. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -0
  173. package/build-types/navigation/stories/index.story.d.ts +23 -0
  174. package/build-types/navigation/stories/index.story.d.ts.map +1 -0
  175. package/build-types/navigation/stories/utils/controlled-state.d.ts +7 -0
  176. package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -0
  177. package/build-types/navigation/stories/utils/default.d.ts +10 -0
  178. package/build-types/navigation/stories/utils/default.d.ts.map +1 -0
  179. package/build-types/navigation/stories/utils/group.d.ts +10 -0
  180. package/build-types/navigation/stories/utils/group.d.ts.map +1 -0
  181. package/build-types/navigation/stories/utils/hide-if-empty.d.ts +10 -0
  182. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -0
  183. package/build-types/navigation/stories/utils/more-examples.d.ts +10 -0
  184. package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -0
  185. package/build-types/navigation/stories/utils/search.d.ts +10 -0
  186. package/build-types/navigation/stories/utils/search.d.ts.map +1 -0
  187. package/build-types/navigation/styles/navigation-styles.d.ts +55 -0
  188. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -0
  189. package/build-types/navigation/test/index.d.ts +2 -0
  190. package/build-types/navigation/test/index.d.ts.map +1 -0
  191. package/build-types/navigation/types.d.ts +266 -0
  192. package/build-types/navigation/types.d.ts.map +1 -0
  193. package/build-types/navigation/use-create-navigation-tree.d.ts +15 -0
  194. package/build-types/navigation/use-create-navigation-tree.d.ts.map +1 -0
  195. package/build-types/navigation/use-navigation-tree-nodes.d.ts +10 -0
  196. package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +1 -0
  197. package/build-types/navigation/utils.d.ts +3 -0
  198. package/build-types/navigation/utils.d.ts.map +1 -0
  199. package/build-types/navigator/navigator-back-button/hook.d.ts +12 -26
  200. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  201. package/build-types/navigator/navigator-button/hook.d.ts +12 -26
  202. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  203. package/build-types/number-control/index.d.ts +1 -1
  204. package/build-types/number-control/index.d.ts.map +1 -1
  205. package/build-types/number-control/stories/index.story.d.ts +1 -1
  206. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  207. package/build-types/popover/types.d.ts +2 -2
  208. package/build-types/popover/types.d.ts.map +1 -1
  209. package/build-types/range-control/index.d.ts +1 -1
  210. package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
  211. package/build-types/range-control/types.d.ts +1 -1
  212. package/build-types/range-control/types.d.ts.map +1 -1
  213. package/build-types/responsive-wrapper/index.d.ts.map +1 -1
  214. package/build-types/scrollable/hook.d.ts +11 -25
  215. package/build-types/scrollable/hook.d.ts.map +1 -1
  216. package/build-types/snackbar/index.d.ts +2 -2
  217. package/build-types/snackbar/types.d.ts +2 -2
  218. package/build-types/snackbar/types.d.ts.map +1 -1
  219. package/build-types/spacer/hook.d.ts +11 -25
  220. package/build-types/spacer/hook.d.ts.map +1 -1
  221. package/build-types/surface/hook.d.ts +11 -25
  222. package/build-types/surface/hook.d.ts.map +1 -1
  223. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  224. package/build-types/tabs/styles.d.ts +9 -3
  225. package/build-types/tabs/styles.d.ts.map +1 -1
  226. package/build-types/text/hook.d.ts +11 -25
  227. package/build-types/text/hook.d.ts.map +1 -1
  228. package/build-types/tools-panel/tools-panel/hook.d.ts +11 -25
  229. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  230. package/build-types/tools-panel/tools-panel-header/hook.d.ts +11 -25
  231. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  232. package/build-types/tools-panel/tools-panel-item/hook.d.ts +11 -25
  233. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  234. package/build-types/tooltip/index.d.ts.map +1 -1
  235. package/build-types/truncate/hook.d.ts +11 -25
  236. package/build-types/truncate/hook.d.ts.map +1 -1
  237. package/build-types/unit-control/index.d.ts +1 -1
  238. package/build-types/unit-control/index.d.ts.map +1 -1
  239. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  240. package/build-types/unit-control/utils.d.ts.map +1 -1
  241. package/build-types/utils/get-node-text.d.ts.map +1 -1
  242. package/build-types/v-stack/hook.d.ts +11 -25
  243. package/build-types/v-stack/hook.d.ts.map +1 -1
  244. package/build-types/validated-form-controls/components/combobox-control.d.ts +2 -2
  245. package/build-types/validated-form-controls/components/number-control.d.ts +1 -1
  246. package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -1
  247. package/build-types/validated-form-controls/components/range-control.d.ts +1 -1
  248. package/build-types/validated-form-controls/control-with-error.d.ts +1 -4
  249. package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
  250. package/build-types/visually-hidden/test/index.d.ts +2 -0
  251. package/build-types/visually-hidden/test/index.d.ts.map +1 -0
  252. package/package.json +37 -35
  253. package/src/autocomplete/README.md +1 -1
  254. package/src/border-control/border-control-dropdown/component.tsx +37 -36
  255. package/src/card/card/README.md +4 -4
  256. package/src/checkbox-control/README.md +1 -1
  257. package/src/clipboard-button/README.md +4 -4
  258. package/src/color-palette/index.tsx +5 -0
  259. package/src/color-palette/test/index.tsx +30 -0
  260. package/src/combobox-control/README.md +1 -1
  261. package/src/composite/stories/index.story.tsx +1 -0
  262. package/src/confirm-dialog/README.md +1 -1
  263. package/src/custom-gradient-picker/gradient-bar/index.tsx +1 -1
  264. package/src/disabled/index.tsx +1 -1
  265. package/src/flex/flex/README.md +1 -1
  266. package/src/form-file-upload/README.md +1 -1
  267. package/src/h-stack/hook.tsx +1 -1
  268. package/src/higher-order/with-notices/index.tsx +21 -4
  269. package/src/higher-order/with-notices/test/index.tsx +18 -0
  270. package/src/input-control/input-base.tsx +2 -2
  271. package/src/menu/README.md +7 -7
  272. package/src/menu/stories/index.story.tsx +1 -0
  273. package/src/navigable-container/container.tsx +22 -30
  274. package/src/popover/README.md +1 -1
  275. package/src/popover/index.tsx +1 -1
  276. package/src/popover/types.ts +4 -2
  277. package/src/range-control/types.ts +1 -1
  278. package/src/responsive-wrapper/index.tsx +3 -7
  279. package/src/scrollable/README.md +1 -1
  280. package/src/snackbar/README.md +1 -1
  281. package/src/snackbar/types.ts +2 -2
  282. package/src/tabs/README.md +1 -1
  283. package/src/tabs/stories/index.story.tsx +1 -0
  284. package/src/tabs/tablist.tsx +1 -1
  285. package/src/tooltip/index.tsx +1 -7
  286. package/src/tooltip/style.scss +1 -1
  287. package/src/tree-grid/test/cell.tsx +1 -0
  288. package/src/tree-grid/test/roving-tab-index-item.tsx +1 -0
  289. package/src/tree-select/README.md +1 -1
  290. package/src/unit-control/utils.ts +33 -52
  291. package/src/utils/get-node-text.ts +1 -7
  292. package/src/validated-form-controls/control-with-error.tsx +1 -6
  293. package/build/mobile/image/constants.cjs +0 -34
  294. package/build/mobile/image/constants.cjs.map +0 -7
  295. package/build-module/mobile/image/constants.mjs +0 -9
  296. package/build-module/mobile/image/constants.mjs.map +0 -7
  297. package/src/autocomplete/autocompleter-ui.native.js +0 -211
  298. package/src/autocomplete/background-view.android.js +0 -25
  299. package/src/autocomplete/background-view.ios.js +0 -23
  300. package/src/autocomplete/style.android.scss +0 -7
  301. package/src/autocomplete/style.native.scss +0 -74
  302. package/src/base-control/index.native.js +0 -14
  303. package/src/button/index.native.js +0 -236
  304. package/src/button/style.native.scss +0 -9
  305. package/src/color-control/index.native.js +0 -24
  306. package/src/color-indicator/index.native.js +0 -80
  307. package/src/color-indicator/style.native.scss +0 -51
  308. package/src/color-palette/index.native.js +0 -360
  309. package/src/color-palette/style.native.scss +0 -49
  310. package/src/color-picker/hsv-color-picker.native.js +0 -88
  311. package/src/color-picker/hue-picker.native.js +0 -198
  312. package/src/color-picker/index.native.js +0 -215
  313. package/src/color-picker/saturation-picker.native.js +0 -167
  314. package/src/color-picker/style.native.scss +0 -87
  315. package/src/custom-gradient-picker/index.native.js +0 -110
  316. package/src/custom-gradient-picker/style.native.scss +0 -3
  317. package/src/dashicon/index.native.js +0 -18
  318. package/src/disabled/index.native.js +0 -10
  319. package/src/draggable/index.native.js +0 -234
  320. package/src/draggable/style.native.scss +0 -3
  321. package/src/draggable/test/index.native.js +0 -138
  322. package/src/dropdown/index.native.js +0 -59
  323. package/src/dropdown-menu/index.native.js +0 -152
  324. package/src/external-link/index.native.js +0 -25
  325. package/src/focal-point-picker/focal-point.native.js +0 -30
  326. package/src/focal-point-picker/index.native.js +0 -281
  327. package/src/focal-point-picker/tooltip/index.native.js +0 -144
  328. package/src/focal-point-picker/tooltip/style.native.scss +0 -42
  329. package/src/font-size-picker/index.native.js +0 -190
  330. package/src/font-size-picker/style.native.scss +0 -6
  331. package/src/footer-message-control/index.native.js +0 -14
  332. package/src/higher-order/with-focus-outside/index.native.js +0 -38
  333. package/src/index.native.js +0 -134
  334. package/src/keyboard-shortcuts/index.native.js +0 -2
  335. package/src/mobile/README.md +0 -3
  336. package/src/mobile/autocompletion-items.native.js +0 -11
  337. package/src/mobile/badge/README.md +0 -31
  338. package/src/mobile/badge/index.native.js +0 -27
  339. package/src/mobile/badge/style.scss +0 -18
  340. package/src/mobile/bottom-sheet/borderStyles.android.scss +0 -8
  341. package/src/mobile/bottom-sheet/borderStyles.ios.scss +0 -9
  342. package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +0 -40
  343. package/src/mobile/bottom-sheet/bottom-sheet-navigation/README.md +0 -101
  344. package/src/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js +0 -16
  345. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +0 -193
  346. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +0 -146
  347. package/src/mobile/bottom-sheet/bottom-sheet-navigation/styles.native.scss +0 -11
  348. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +0 -197
  349. package/src/mobile/bottom-sheet/button.native.js +0 -19
  350. package/src/mobile/bottom-sheet/cell.native.js +0 -464
  351. package/src/mobile/bottom-sheet/cellStyles.android.scss +0 -15
  352. package/src/mobile/bottom-sheet/cellStyles.ios.scss +0 -19
  353. package/src/mobile/bottom-sheet/chevron-back.native.js +0 -18
  354. package/src/mobile/bottom-sheet/color-cell.native.js +0 -35
  355. package/src/mobile/bottom-sheet/cycle-picker-cell.native.js +0 -31
  356. package/src/mobile/bottom-sheet/footer-message-cell.native.js +0 -23
  357. package/src/mobile/bottom-sheet/footer-message-link/README.md +0 -37
  358. package/src/mobile/bottom-sheet/footer-message-link/footer-message-link.native.js +0 -26
  359. package/src/mobile/bottom-sheet/footer-message-link/styles.native.scss +0 -7
  360. package/src/mobile/bottom-sheet/index.native.js +0 -646
  361. package/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -125
  362. package/src/mobile/bottom-sheet/link-cell.native.js +0 -35
  363. package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +0 -92
  364. package/src/mobile/bottom-sheet/link-suggestion-styles.native.scss +0 -27
  365. package/src/mobile/bottom-sheet/lock-icon/index.native.js +0 -19
  366. package/src/mobile/bottom-sheet/lock-icon/styles.native.scss +0 -8
  367. package/src/mobile/bottom-sheet/nav-bar/README.md +0 -63
  368. package/src/mobile/bottom-sheet/nav-bar/action-button.native.js +0 -30
  369. package/src/mobile/bottom-sheet/nav-bar/apply-button.native.js +0 -53
  370. package/src/mobile/bottom-sheet/nav-bar/back-button.native.js +0 -94
  371. package/src/mobile/bottom-sheet/nav-bar/heading.native.js +0 -33
  372. package/src/mobile/bottom-sheet/nav-bar/index.native.js +0 -23
  373. package/src/mobile/bottom-sheet/nav-bar/styles.native.scss +0 -69
  374. package/src/mobile/bottom-sheet/picker-cell.native.js +0 -40
  375. package/src/mobile/bottom-sheet/radio-cell.native.js +0 -39
  376. package/src/mobile/bottom-sheet/range-cell.native.js +0 -274
  377. package/src/mobile/bottom-sheet/range-cell.native.scss +0 -40
  378. package/src/mobile/bottom-sheet/range-text-input.native.js +0 -248
  379. package/src/mobile/bottom-sheet/ripple.native.js +0 -83
  380. package/src/mobile/bottom-sheet/ripple.native.scss +0 -11
  381. package/src/mobile/bottom-sheet/stepper-cell/index.native.js +0 -264
  382. package/src/mobile/bottom-sheet/stepper-cell/stepper.android.js +0 -78
  383. package/src/mobile/bottom-sheet/stepper-cell/stepper.ios.js +0 -64
  384. package/src/mobile/bottom-sheet/stepper-cell/style.native.scss +0 -89
  385. package/src/mobile/bottom-sheet/styles.native.scss +0 -333
  386. package/src/mobile/bottom-sheet/sub-sheet/README.md +0 -90
  387. package/src/mobile/bottom-sheet/sub-sheet/index.native.js +0 -49
  388. package/src/mobile/bottom-sheet/switch-cell.native.js +0 -75
  389. package/src/mobile/bottom-sheet/test/index.native.js +0 -24
  390. package/src/mobile/bottom-sheet/test/range-cell.native.js +0 -73
  391. package/src/mobile/bottom-sheet-select-control/README.md +0 -97
  392. package/src/mobile/bottom-sheet-select-control/index.native.js +0 -124
  393. package/src/mobile/bottom-sheet-select-control/style.native.scss +0 -3
  394. package/src/mobile/bottom-sheet-text-control/README.md +0 -98
  395. package/src/mobile/bottom-sheet-text-control/index.native.js +0 -104
  396. package/src/mobile/bottom-sheet-text-control/styles.scss +0 -25
  397. package/src/mobile/clipboard/index.native.js +0 -18
  398. package/src/mobile/color-settings/gradient-picker-screen.native.js +0 -37
  399. package/src/mobile/color-settings/index.native.js +0 -88
  400. package/src/mobile/color-settings/palette.screen.native.js +0 -232
  401. package/src/mobile/color-settings/picker-screen.native.js +0 -60
  402. package/src/mobile/color-settings/style.native.scss +0 -62
  403. package/src/mobile/color-settings/utils.native.js +0 -36
  404. package/src/mobile/cycle-select-control/README.md +0 -3
  405. package/src/mobile/cycle-select-control/index.native.js +0 -39
  406. package/src/mobile/dashicons/index.native.js +0 -22
  407. package/src/mobile/focal-point-settings-panel/index.native.js +0 -84
  408. package/src/mobile/focal-point-settings-panel/styles.native.scss +0 -3
  409. package/src/mobile/gradient/index.native.js +0 -188
  410. package/src/mobile/gradient/style.native.scss +0 -8
  411. package/src/mobile/gradient/test/index.native.js +0 -114
  412. package/src/mobile/gridicons/index.native.js +0 -39
  413. package/src/mobile/html-text-input/index.native.js +0 -169
  414. package/src/mobile/html-text-input/style.android.scss +0 -8
  415. package/src/mobile/html-text-input/style.ios.scss +0 -10
  416. package/src/mobile/html-text-input/style.scss +0 -45
  417. package/src/mobile/html-text-input/test/__snapshots__/index.native.js.snap +0 -48
  418. package/src/mobile/html-text-input/test/index.native.js +0 -118
  419. package/src/mobile/image/constants.js +0 -1
  420. package/src/mobile/image/icon-customize.native.js +0 -10
  421. package/src/mobile/image/icon-retry.native.js +0 -11
  422. package/src/mobile/image/image-editing-button.native.js +0 -63
  423. package/src/mobile/image/index.native.js +0 -401
  424. package/src/mobile/image/style.native.scss +0 -179
  425. package/src/mobile/image/utils/index.native.js +0 -58
  426. package/src/mobile/keyboard-avoiding-view/index.android.js +0 -8
  427. package/src/mobile/keyboard-avoiding-view/index.ios.js +0 -143
  428. package/src/mobile/keyboard-avoiding-view/styles.native.scss +0 -9
  429. package/src/mobile/keyboard-aware-flat-list/index.android.js +0 -81
  430. package/src/mobile/keyboard-aware-flat-list/index.ios.js +0 -147
  431. package/src/mobile/keyboard-aware-flat-list/shared.native.js +0 -26
  432. package/src/mobile/keyboard-aware-flat-list/styles.native.scss +0 -8
  433. package/src/mobile/keyboard-aware-flat-list/test/use-keyboard-offset.native.js +0 -203
  434. package/src/mobile/keyboard-aware-flat-list/test/use-scroll-to-section.native.js +0 -142
  435. package/src/mobile/keyboard-aware-flat-list/test/use-scroll.native.js +0 -71
  436. package/src/mobile/keyboard-aware-flat-list/test/use-text-input-caret-position.native.js +0 -82
  437. package/src/mobile/keyboard-aware-flat-list/test/use-text-input-offset.native.js +0 -147
  438. package/src/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js +0 -87
  439. package/src/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +0 -41
  440. package/src/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +0 -100
  441. package/src/mobile/keyboard-aware-flat-list/use-scroll.native.js +0 -100
  442. package/src/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js +0 -36
  443. package/src/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js +0 -54
  444. package/src/mobile/layout-animation/index.native.js +0 -16
  445. package/src/mobile/link-picker/index.native.js +0 -160
  446. package/src/mobile/link-picker/link-picker-results.native.js +0 -129
  447. package/src/mobile/link-picker/link-picker-screen.native.js +0 -60
  448. package/src/mobile/link-picker/styles.native.scss +0 -45
  449. package/src/mobile/link-picker/test/performance/index.native.js +0 -35
  450. package/src/mobile/link-settings/index.native.js +0 -332
  451. package/src/mobile/link-settings/link-rel.native.js +0 -10
  452. package/src/mobile/link-settings/link-settings-navigation.native.js +0 -50
  453. package/src/mobile/link-settings/link-settings-screen.native.js +0 -44
  454. package/src/mobile/link-settings/style.native.scss +0 -4
  455. package/src/mobile/link-settings/test/edit.native.js +0 -325
  456. package/src/mobile/link-settings/test/link-settings-navigation.native.js +0 -94
  457. package/src/mobile/media-edit/index.native.js +0 -125
  458. package/src/mobile/picker/index.android.js +0 -104
  459. package/src/mobile/picker/index.ios.js +0 -96
  460. package/src/mobile/picker/styles.native.scss +0 -29
  461. package/src/mobile/segmented-control/index.native.js +0 -186
  462. package/src/mobile/segmented-control/style.native.scss +0 -99
  463. package/src/mobile/utils/alignments.native.js +0 -78
  464. package/src/mobile/utils/get-px-from-css-unit.native.js +0 -329
  465. package/src/mobile/utils/index.native.js +0 -12
  466. package/src/mobile/utils/test/get-px-from-css-unit.native.js +0 -172
  467. package/src/mobile/utils/test/index.native.js +0 -134
  468. package/src/mobile/utils/use-is-floating-keyboard.native.js +0 -31
  469. package/src/mobile/utils/use-unit-converter-to-mobile.native.js +0 -90
  470. package/src/notice/index.native.js +0 -123
  471. package/src/notice/list.native.js +0 -55
  472. package/src/notice/style.native.scss +0 -60
  473. package/src/panel/actions.native.js +0 -46
  474. package/src/panel/actions.native.scss +0 -12
  475. package/src/panel/body.native.js +0 -29
  476. package/src/panel/body.native.scss +0 -11
  477. package/src/panel/bottom-separator-cover.native.js +0 -27
  478. package/src/panel/bottom-separator-cover.native.scss +0 -9
  479. package/src/private-apis.native.js +0 -13
  480. package/src/query-controls/index.native.js +0 -103
  481. package/src/radio-control/index.native.js +0 -24
  482. package/src/range-control/index.native.js +0 -73
  483. package/src/resizable-box/index.native.js +0 -32
  484. package/src/resizable-box/style.native.scss +0 -14
  485. package/src/sandbox/index.native.js +0 -392
  486. package/src/sandbox/style.native.scss +0 -7
  487. package/src/search-control/index.native.js +0 -274
  488. package/src/search-control/platform-style.android.scss +0 -57
  489. package/src/search-control/platform-style.ios.scss +0 -43
  490. package/src/search-control/style.native.scss +0 -63
  491. package/src/select-control/index.native.js +0 -41
  492. package/src/slot-fill/index.native.js +0 -25
  493. package/src/spinner/index.native.js +0 -22
  494. package/src/spinner/style.native.scss +0 -4
  495. package/src/style-provider/index.native.js +0 -3
  496. package/src/text/index.native.js +0 -13
  497. package/src/text/styles/emotion-css.native.js +0 -6
  498. package/src/text/styles/font-family.native.js +0 -1
  499. package/src/text/styles/text-mixins.native.js +0 -163
  500. package/src/text-control/index.native.js +0 -41
  501. package/src/textarea-control/index.native.js +0 -26
  502. package/src/toggle-control/index.native.js +0 -31
  503. package/src/toolbar/toolbar/style.native.scss +0 -11
  504. package/src/toolbar/toolbar/toolbar-container.native.js +0 -8
  505. package/src/toolbar/toolbar-button/toolbar-button-container.native.js +0 -8
  506. package/src/toolbar/toolbar-group/style.native.scss +0 -10
  507. package/src/toolbar/toolbar-group/toolbar-group-collapsed.native.js +0 -36
  508. package/src/toolbar/toolbar-group/toolbar-group-container.native.js +0 -26
  509. package/src/toolbar/toolbar-item/index.native.js +0 -17
  510. package/src/tooltip/index.native.js +0 -292
  511. package/src/tooltip/style.native.scss +0 -39
  512. package/src/tooltip/test/index.native.js +0 -98
  513. package/src/unit-control/index.native.js +0 -202
  514. package/src/unit-control/style.native.scss +0 -19
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/draggable/index.tsx", "../../../style-runtime/src/index.ts", "../../src/draggable/style.module.scss"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { throttle } from '@wordpress/compose';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { getWpCompatOverlaySlot } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\n\nimport styles from './style.module.scss';\n\n// Legacy class names preserved alongside the CSS-module hashed ones for\n// backwards compatibility. `filter(Boolean)` strips `undefined` from Jest's\n// CSS-module mock.\nimport { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst dragImageClasses = [styles['invisible-drag-image'], 'components-draggable__invisible-drag-image'].filter(Boolean);\nconst cloneWrapperClasses = [styles.clone, 'components-draggable__clone'].filter(Boolean);\n// Global class \u2014 shared with external code (e.g. block-editor keyboard drag).\nconst bodyClass = 'is-dragging-components-draggable';\nconst clonePadding = 0;\n\n/**\n * `Draggable` is a Component that provides a way to set up a cross-browser\n * (including IE) customizable drag image and the transfer data for the drag\n * event. It decouples the drag handle and the element to drag: use it by\n * wrapping the component that will become the drag handle and providing the DOM\n * ID of the element to drag.\n *\n * Note that the drag handle needs to declare the `draggable=\"true\"` property\n * and bind the `Draggable`s `onDraggableStart` and `onDraggableEnd` event\n * handlers to its own `onDragStart` and `onDragEnd` respectively. `Draggable`\n * takes care of the logic to setup the drag image and the transfer data, but is\n * not concerned with creating an actual DOM element that is draggable.\n *\n * ```jsx\n * import { Draggable, Panel, PanelBody } from '@wordpress/components';\n * import { Icon, more } from '@wordpress/icons';\n *\n * const MyDraggable = () => (\n * <div id=\"draggable-panel\">\n * <Panel header=\"Draggable panel\">\n * <PanelBody>\n * <Draggable elementId=\"draggable-panel\" transferData={ {} }>\n * { ( { onDraggableStart, onDraggableEnd } ) => (\n * <div\n * className=\"example-drag-handle\"\n * draggable\n * onDragStart={ onDraggableStart }\n * onDragEnd={ onDraggableEnd }\n * >\n * <Icon icon={ more } />\n * </div>\n * ) }\n * </Draggable>\n * </PanelBody>\n * </Panel>\n * </div>\n * );\n * ```\n */\nexport function Draggable({\n children,\n onDragStart,\n onDragOver,\n onDragEnd,\n appendToOwnerDocument = false,\n cloneClassname,\n elementId,\n transferData,\n __experimentalTransferDataType: transferDataType = 'text',\n __experimentalDragComponent: dragComponent\n}) {\n const dragComponentRef = useRef(null);\n const cleanupRef = useRef(() => {});\n\n /**\n * Removes the element clone, resets cursor, and removes drag listener.\n *\n * @param event The non-custom DragEvent.\n */\n function end(event) {\n event.preventDefault();\n cleanupRef.current();\n if (onDragEnd) {\n onDragEnd(event);\n }\n }\n\n /**\n * This method does a couple of things:\n *\n * - Clones the current element and spawns clone over original element.\n * - Adds a fake temporary drag image to avoid browser defaults.\n * - Sets transfer data.\n * - Adds dragover listener.\n *\n * @param event The non-custom DragEvent.\n */\n function start(event) {\n const {\n ownerDocument\n } = event.target;\n // Only use the slot when it lives in the same document as the\n // dragged element, so coordinate resolution stays in one space.\n const slot = getWpCompatOverlaySlot();\n const compatSlot = slot?.ownerDocument === ownerDocument ? slot : null;\n event.dataTransfer.setData(transferDataType, JSON.stringify(transferData));\n const cloneWrapper = ownerDocument.createElement('div');\n // Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.\n cloneWrapper.style.top = '0';\n cloneWrapper.style.left = '0';\n const dragImage = ownerDocument.createElement('div');\n\n // Set a fake drag image to avoid browser defaults. Remove from DOM\n // right after. event.dataTransfer.setDragImage is not supported yet in\n // IE, we need to check for its existence first.\n if ('function' === typeof event.dataTransfer.setDragImage) {\n dragImage.classList.add(...dragImageClasses);\n // Invisible \u2014 stays at the document body, no slot needed.\n ownerDocument.body.appendChild(dragImage);\n event.dataTransfer.setDragImage(dragImage, 0, 0);\n }\n cloneWrapper.classList.add(...cloneWrapperClasses);\n const inSlotClass = styles['is-in-compat-slot'];\n if (compatSlot && inSlotClass) {\n cloneWrapper.classList.add(inSlotClass);\n }\n if (cloneClassname) {\n cloneWrapper.classList.add(cloneClassname);\n }\n let x = 0;\n let y = 0;\n // If a dragComponent is defined, the following logic will clone the\n // HTML node and inject it into the cloneWrapper.\n if (dragComponentRef.current) {\n // Position dragComponent at the same position as the cursor.\n x = event.clientX;\n y = event.clientY;\n cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`;\n const clonedDragComponent = ownerDocument.createElement('div');\n clonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;\n cloneWrapper.appendChild(clonedDragComponent);\n (compatSlot ?? ownerDocument.body).appendChild(cloneWrapper);\n } else {\n const element = ownerDocument.getElementById(elementId);\n\n // Prepare element clone and append to element wrapper.\n const elementRect = element.getBoundingClientRect();\n const elementWrapper = element.parentNode;\n const elementTopOffset = elementRect.top;\n const elementLeftOffset = elementRect.left;\n cloneWrapper.style.width = `${elementRect.width + clonePadding * 2}px`;\n const clone = element.cloneNode(true);\n clone.id = `clone-${elementId}`;\n\n // Position clone right over the original element (20px padding).\n x = elementLeftOffset - clonePadding;\n y = elementTopOffset - clonePadding;\n cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`;\n\n // Hack: Remove iFrames as it's causing the embeds drag clone to freeze.\n Array.from(clone.querySelectorAll('iframe')).forEach(child => child.parentNode?.removeChild(child));\n cloneWrapper.appendChild(clone);\n if (compatSlot) {\n compatSlot.appendChild(cloneWrapper);\n } else if (appendToOwnerDocument) {\n ownerDocument.body.appendChild(cloneWrapper);\n } else {\n elementWrapper?.appendChild(cloneWrapper);\n }\n }\n\n // Mark the current cursor coordinates.\n let cursorLeft = event.clientX;\n let cursorTop = event.clientY;\n function over(e) {\n // Skip doing any work if mouse has not moved.\n if (cursorLeft === e.clientX && cursorTop === e.clientY) {\n return;\n }\n const nextX = x + e.clientX - cursorLeft;\n const nextY = y + e.clientY - cursorTop;\n cloneWrapper.style.transform = `translate( ${nextX}px, ${nextY}px )`;\n cursorLeft = e.clientX;\n cursorTop = e.clientY;\n x = nextX;\n y = nextY;\n if (onDragOver) {\n onDragOver(e);\n }\n }\n\n // Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,\n // note that browsers may throttle raf below 60fps in certain conditions.\n // @ts-ignore\n const throttledDragOver = throttle(over, 16);\n ownerDocument.addEventListener('dragover', throttledDragOver);\n\n // Update cursor to 'grabbing', document wide.\n ownerDocument.body.classList.add(bodyClass);\n if (onDragStart) {\n onDragStart(event);\n }\n cleanupRef.current = () => {\n // Remove drag clone.\n if (cloneWrapper && cloneWrapper.parentNode) {\n cloneWrapper.parentNode.removeChild(cloneWrapper);\n }\n if (dragImage && dragImage.parentNode) {\n dragImage.parentNode.removeChild(dragImage);\n }\n\n // Reset cursor.\n ownerDocument.body.classList.remove(bodyClass);\n ownerDocument.removeEventListener('dragover', throttledDragOver);\n };\n }\n useEffect(() => () => {\n cleanupRef.current();\n }, []);\n return /*#__PURE__*/_jsxs(_Fragment, {\n children: [children({\n onDraggableStart: start,\n onDraggableEnd: end\n }), dragComponent && /*#__PURE__*/_jsx(\"div\", {\n className: \"components-draggable-drag-component-root\",\n style: {\n display: 'none'\n },\n ref: dragComponentRef,\n children: dragComponent\n })]\n });\n}\nexport default Draggable;", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"f8d1257e92\", \"._3476c2e530687f96__invisible-drag-image{height:50px;left:-1000px;position:fixed;width:50px}._6f00e51ab7574306__clone{background:#0000;padding:0;pointer-events:none;position:fixed}._6f00e51ab7574306__clone:not(._664ecd37377558df__is-in-compat-slot){z-index:1000000000}body.is-dragging-components-draggable{cursor:move;cursor:grabbing!important}\");\n}\nexport default {\"invisible-drag-image\":\"_3476c2e530687f96__invisible-drag-image\",\"clone\":\"_6f00e51ab7574306__clone\",\"is-in-compat-slot\":\"_664ecd37377558df__is-in-compat-slot\"};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAAyB;AACzB,qBAAkC;AAClC,gBAAuC;;;ACTvC,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;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WAAW;AAAA,MACX,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,MACA,KAAK;AAAA,MACL,UAAU;AAAA,IACZ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACA,IAAO,oBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { throttle } from '@wordpress/compose';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { getWpCompatOverlaySlot } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\n\nimport styles from './style.module.scss';\n\n// Legacy class names preserved alongside the CSS-module hashed ones for\n// backwards compatibility. `filter(Boolean)` strips `undefined` from Jest's\n// CSS-module mock.\nimport { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst dragImageClasses = [styles['invisible-drag-image'], 'components-draggable__invisible-drag-image'].filter(Boolean);\nconst cloneWrapperClasses = [styles.clone, 'components-draggable__clone'].filter(Boolean);\n// Global class \u2014 shared with external code (e.g. block-editor keyboard drag).\nconst bodyClass = 'is-dragging-components-draggable';\nconst clonePadding = 0;\n\n/**\n * `Draggable` is a Component that provides a way to set up a cross-browser\n * (including IE) customizable drag image and the transfer data for the drag\n * event. It decouples the drag handle and the element to drag: use it by\n * wrapping the component that will become the drag handle and providing the DOM\n * ID of the element to drag.\n *\n * Note that the drag handle needs to declare the `draggable=\"true\"` property\n * and bind the `Draggable`s `onDraggableStart` and `onDraggableEnd` event\n * handlers to its own `onDragStart` and `onDragEnd` respectively. `Draggable`\n * takes care of the logic to setup the drag image and the transfer data, but is\n * not concerned with creating an actual DOM element that is draggable.\n *\n * ```jsx\n * import { Draggable, Panel, PanelBody } from '@wordpress/components';\n * import { Icon, more } from '@wordpress/icons';\n *\n * const MyDraggable = () => (\n * <div id=\"draggable-panel\">\n * <Panel header=\"Draggable panel\">\n * <PanelBody>\n * <Draggable elementId=\"draggable-panel\" transferData={ {} }>\n * { ( { onDraggableStart, onDraggableEnd } ) => (\n * <div\n * className=\"example-drag-handle\"\n * draggable\n * onDragStart={ onDraggableStart }\n * onDragEnd={ onDraggableEnd }\n * >\n * <Icon icon={ more } />\n * </div>\n * ) }\n * </Draggable>\n * </PanelBody>\n * </Panel>\n * </div>\n * );\n * ```\n */\nexport function Draggable({\n children,\n onDragStart,\n onDragOver,\n onDragEnd,\n appendToOwnerDocument = false,\n cloneClassname,\n elementId,\n transferData,\n __experimentalTransferDataType: transferDataType = 'text',\n __experimentalDragComponent: dragComponent\n}) {\n const dragComponentRef = useRef(null);\n const cleanupRef = useRef(() => {});\n\n /**\n * Removes the element clone, resets cursor, and removes drag listener.\n *\n * @param event The non-custom DragEvent.\n */\n function end(event) {\n event.preventDefault();\n cleanupRef.current();\n if (onDragEnd) {\n onDragEnd(event);\n }\n }\n\n /**\n * This method does a couple of things:\n *\n * - Clones the current element and spawns clone over original element.\n * - Adds a fake temporary drag image to avoid browser defaults.\n * - Sets transfer data.\n * - Adds dragover listener.\n *\n * @param event The non-custom DragEvent.\n */\n function start(event) {\n const {\n ownerDocument\n } = event.target;\n // Only use the slot when it lives in the same document as the\n // dragged element, so coordinate resolution stays in one space.\n const slot = getWpCompatOverlaySlot();\n const compatSlot = slot?.ownerDocument === ownerDocument ? slot : null;\n event.dataTransfer.setData(transferDataType, JSON.stringify(transferData));\n const cloneWrapper = ownerDocument.createElement('div');\n // Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.\n cloneWrapper.style.top = '0';\n cloneWrapper.style.left = '0';\n const dragImage = ownerDocument.createElement('div');\n\n // Set a fake drag image to avoid browser defaults. Remove from DOM\n // right after. event.dataTransfer.setDragImage is not supported yet in\n // IE, we need to check for its existence first.\n if ('function' === typeof event.dataTransfer.setDragImage) {\n dragImage.classList.add(...dragImageClasses);\n // Invisible \u2014 stays at the document body, no slot needed.\n ownerDocument.body.appendChild(dragImage);\n event.dataTransfer.setDragImage(dragImage, 0, 0);\n }\n cloneWrapper.classList.add(...cloneWrapperClasses);\n const inSlotClass = styles['is-in-compat-slot'];\n if (compatSlot && inSlotClass) {\n cloneWrapper.classList.add(inSlotClass);\n }\n if (cloneClassname) {\n cloneWrapper.classList.add(cloneClassname);\n }\n let x = 0;\n let y = 0;\n // If a dragComponent is defined, the following logic will clone the\n // HTML node and inject it into the cloneWrapper.\n if (dragComponentRef.current) {\n // Position dragComponent at the same position as the cursor.\n x = event.clientX;\n y = event.clientY;\n cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`;\n const clonedDragComponent = ownerDocument.createElement('div');\n clonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;\n cloneWrapper.appendChild(clonedDragComponent);\n (compatSlot ?? ownerDocument.body).appendChild(cloneWrapper);\n } else {\n const element = ownerDocument.getElementById(elementId);\n\n // Prepare element clone and append to element wrapper.\n const elementRect = element.getBoundingClientRect();\n const elementWrapper = element.parentNode;\n const elementTopOffset = elementRect.top;\n const elementLeftOffset = elementRect.left;\n cloneWrapper.style.width = `${elementRect.width + clonePadding * 2}px`;\n const clone = element.cloneNode(true);\n clone.id = `clone-${elementId}`;\n\n // Position clone right over the original element (20px padding).\n x = elementLeftOffset - clonePadding;\n y = elementTopOffset - clonePadding;\n cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`;\n\n // Hack: Remove iFrames as it's causing the embeds drag clone to freeze.\n Array.from(clone.querySelectorAll('iframe')).forEach(child => child.parentNode?.removeChild(child));\n cloneWrapper.appendChild(clone);\n if (compatSlot) {\n compatSlot.appendChild(cloneWrapper);\n } else if (appendToOwnerDocument) {\n ownerDocument.body.appendChild(cloneWrapper);\n } else {\n elementWrapper?.appendChild(cloneWrapper);\n }\n }\n\n // Mark the current cursor coordinates.\n let cursorLeft = event.clientX;\n let cursorTop = event.clientY;\n function over(e) {\n // Skip doing any work if mouse has not moved.\n if (cursorLeft === e.clientX && cursorTop === e.clientY) {\n return;\n }\n const nextX = x + e.clientX - cursorLeft;\n const nextY = y + e.clientY - cursorTop;\n cloneWrapper.style.transform = `translate( ${nextX}px, ${nextY}px )`;\n cursorLeft = e.clientX;\n cursorTop = e.clientY;\n x = nextX;\n y = nextY;\n if (onDragOver) {\n onDragOver(e);\n }\n }\n\n // Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,\n // note that browsers may throttle raf below 60fps in certain conditions.\n // @ts-ignore\n const throttledDragOver = throttle(over, 16);\n ownerDocument.addEventListener('dragover', throttledDragOver);\n\n // Update cursor to 'grabbing', document wide.\n ownerDocument.body.classList.add(bodyClass);\n if (onDragStart) {\n onDragStart(event);\n }\n cleanupRef.current = () => {\n // Remove drag clone.\n if (cloneWrapper && cloneWrapper.parentNode) {\n cloneWrapper.parentNode.removeChild(cloneWrapper);\n }\n if (dragImage && dragImage.parentNode) {\n dragImage.parentNode.removeChild(dragImage);\n }\n\n // Reset cursor.\n ownerDocument.body.classList.remove(bodyClass);\n ownerDocument.removeEventListener('dragover', throttledDragOver);\n };\n }\n useEffect(() => () => {\n cleanupRef.current();\n }, []);\n return /*#__PURE__*/_jsxs(_Fragment, {\n children: [children({\n onDraggableStart: start,\n onDraggableEnd: end\n }), dragComponent && /*#__PURE__*/_jsx(\"div\", {\n className: \"components-draggable-drag-component-root\",\n style: {\n display: 'none'\n },\n ref: dragComponentRef,\n children: dragComponent\n })]\n });\n}\nexport default Draggable;", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"e7e88c1781\", \"._3476c2e530687f96__invisible-drag-image{height:50px;left:-1000px;position:fixed;width:50px}._6f00e51ab7574306__clone{background:transparent;padding:0;pointer-events:none;position:fixed}._6f00e51ab7574306__clone:not(._664ecd37377558df__is-in-compat-slot){z-index:1000000000}body.is-dragging-components-draggable{cursor:move;cursor:grabbing!important}\");\n}\nexport default {\"invisible-drag-image\":\"_3476c2e530687f96__invisible-drag-image\",\"clone\":\"_6f00e51ab7574306__clone\",\"is-in-compat-slot\":\"_664ecd37377558df__is-in-compat-slot\"};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAAyB;AACzB,qBAAkC;AAClC,gBAAuC;;;ACTvC,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM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C,WAAW;AAAA,MACX,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,MACA,KAAK;AAAA,MACL,UAAU;AAAA,IACZ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACA,IAAO,oBAAQ;",
6
6
  "names": ["_jsxs", "_Fragment", "_jsx"]
7
7
  }
@@ -39,7 +39,7 @@ var import_compose = require("@wordpress/compose");
39
39
  var import_list = __toESM(require("../../notice/list.cjs"));
40
40
  var import_jsx_runtime = require("react/jsx-runtime");
41
41
  var with_notices_default = (0, import_compose.createHigherOrderComponent)((OriginalComponent) => {
42
- return function Component(props) {
42
+ function Component(props, ref) {
43
43
  const [noticeList, setNoticeList] = (0, import_element.useState)([]);
44
44
  const noticeOperations = (0, import_element.useMemo)(() => {
45
45
  const createNotice = (notice) => {
@@ -75,9 +75,21 @@ var with_notices_default = (0, import_compose.createHigherOrderComponent)((Origi
75
75
  onRemove: noticeOperations.removeNotice
76
76
  })
77
77
  };
78
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OriginalComponent, {
78
+ return isForwardRef ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OriginalComponent, {
79
+ ...propsOut,
80
+ ref
81
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OriginalComponent, {
79
82
  ...propsOut
80
83
  });
81
- };
84
+ }
85
+ let isForwardRef;
86
+ const {
87
+ render
88
+ } = OriginalComponent;
89
+ if (typeof render === "function") {
90
+ isForwardRef = true;
91
+ return (0, import_element.forwardRef)(Component);
92
+ }
93
+ return Component;
82
94
  }, "withNotices");
83
95
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/higher-order/with-notices/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NoticeList from '../../notice/list';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Override the default edit UI to include notices if supported.\n *\n * Wrapping the original component with `withNotices` encapsulates the component\n * with the additional props `noticeOperations` and `noticeUI`.\n *\n * ```jsx\n * import { withNotices, Button } from '@wordpress/components';\n *\n * const MyComponentWithNotices = withNotices(\n * \t( { noticeOperations, noticeUI } ) => {\n * \t\tconst addError = () =>\n * \t\t\tnoticeOperations.createErrorNotice( 'Error message' );\n * \t\treturn (\n * \t\t\t<div>\n * \t\t\t\t{ noticeUI }\n * \t\t\t\t<Button variant=\"secondary\" onClick={ addError }>\n * \t\t\t\t\tAdd error\n * \t\t\t\t</Button>\n * \t\t\t</div>\n * \t\t);\n * \t}\n * );\n * ```\n *\n * @param OriginalComponent Original component.\n *\n * @return Wrapped component.\n */\nexport default createHigherOrderComponent(OriginalComponent => {\n return function Component(props) {\n const [noticeList, setNoticeList] = useState([]);\n const noticeOperations = useMemo(() => {\n const createNotice = notice => {\n const noticeToAdd = notice.id ? notice : {\n ...notice,\n id: uuid()\n };\n setNoticeList(current => [...current, noticeToAdd]);\n };\n return {\n createNotice,\n createErrorNotice: msg => {\n // @ts-expect-error TODO: Missing `id`, potentially a bug\n createNotice({\n status: 'error',\n content: msg\n });\n },\n removeNotice: id => {\n setNoticeList(current => current.filter(notice => notice.id !== id));\n },\n removeAllNotices: () => {\n setNoticeList([]);\n }\n };\n }, []);\n const propsOut = {\n ...props,\n noticeList,\n noticeOperations,\n noticeUI: noticeList.length > 0 && /*#__PURE__*/_jsx(NoticeList, {\n className: \"components-with-notices-ui\",\n notices: noticeList,\n onRemove: noticeOperations.removeNotice\n })\n };\n return /*#__PURE__*/_jsx(OriginalComponent, {\n ...propsOut\n });\n };\n}, 'withNotices');"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA2B;AAK3B,qBAAkC;AAClC,qBAA2C;AAK3C,kBAAuB;AACvB,yBAA4B;AA8B5B,IAAO,2BAAQ,2CAA2B,uBAAqB;AAC7D,SAAO,SAAS,UAAU,OAAO;AAC/B,UAAM,CAAC,YAAY,aAAa,QAAI,yBAAS,CAAC,CAAC;AAC/C,UAAM,uBAAmB,wBAAQ,MAAM;AACrC,YAAM,eAAe,YAAU;AAC7B,cAAM,cAAc,OAAO,KAAK,SAAS;AAAA,UACvC,GAAG;AAAA,UACH,QAAI,YAAAA,IAAK;AAAA,QACX;AACA,sBAAc,aAAW,CAAC,GAAG,SAAS,WAAW,CAAC;AAAA,MACpD;AACA,aAAO;AAAA,QACL;AAAA,QACA,mBAAmB,SAAO;AAExB,uBAAa;AAAA,YACX,QAAQ;AAAA,YACR,SAAS;AAAA,UACX,CAAC;AAAA,QACH;AAAA,QACA,cAAc,QAAM;AAClB,wBAAc,aAAW,QAAQ,OAAO,YAAU,OAAO,OAAO,EAAE,CAAC;AAAA,QACrE;AAAA,QACA,kBAAkB,MAAM;AACtB,wBAAc,CAAC,CAAC;AAAA,QAClB;AAAA,MACF;AAAA,IACF,GAAG,CAAC,CAAC;AACL,UAAM,WAAW;AAAA,MACf,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,UAAU,WAAW,SAAS,KAAkB,uCAAAC,KAAK,YAAAC,SAAY;AAAA,QAC/D,WAAW;AAAA,QACX,SAAS;AAAA,QACT,UAAU,iBAAiB;AAAA,MAC7B,CAAC;AAAA,IACH;AACA,WAAoB,uCAAAD,KAAK,mBAAmB;AAAA,MAC1C,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF,GAAG,aAAa;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useState, useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NoticeList from '../../notice/list';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Override the default edit UI to include notices if supported.\n *\n * Wrapping the original component with `withNotices` encapsulates the component\n * with the additional props `noticeOperations` and `noticeUI`.\n *\n * ```jsx\n * import { withNotices, Button } from '@wordpress/components';\n *\n * const MyComponentWithNotices = withNotices(\n * \t( { noticeOperations, noticeUI } ) => {\n * \t\tconst addError = () =>\n * \t\t\tnoticeOperations.createErrorNotice( 'Error message' );\n * \t\treturn (\n * \t\t\t<div>\n * \t\t\t\t{ noticeUI }\n * \t\t\t\t<Button variant=\"secondary\" onClick={ addError }>\n * \t\t\t\t\tAdd error\n * \t\t\t\t</Button>\n * \t\t\t</div>\n * \t\t);\n * \t}\n * );\n * ```\n *\n * @param OriginalComponent Original component.\n *\n * @return Wrapped component.\n */\nexport default createHigherOrderComponent(OriginalComponent => {\n function Component(props, ref) {\n const [noticeList, setNoticeList] = useState([]);\n const noticeOperations = useMemo(() => {\n const createNotice = notice => {\n const noticeToAdd = notice.id ? notice : {\n ...notice,\n id: uuid()\n };\n setNoticeList(current => [...current, noticeToAdd]);\n };\n return {\n createNotice,\n createErrorNotice: msg => {\n // @ts-expect-error TODO: Missing `id`, potentially a bug\n createNotice({\n status: 'error',\n content: msg\n });\n },\n removeNotice: id => {\n setNoticeList(current => current.filter(notice => notice.id !== id));\n },\n removeAllNotices: () => {\n setNoticeList([]);\n }\n };\n }, []);\n const propsOut = {\n ...props,\n noticeList,\n noticeOperations,\n noticeUI: noticeList.length > 0 && /*#__PURE__*/_jsx(NoticeList, {\n className: \"components-with-notices-ui\",\n notices: noticeList,\n onRemove: noticeOperations.removeNotice\n })\n };\n return isForwardRef ? /*#__PURE__*/_jsx(OriginalComponent, {\n ...propsOut,\n ref: ref\n }) : /*#__PURE__*/_jsx(OriginalComponent, {\n ...propsOut\n });\n }\n let isForwardRef;\n // @ts-expect-error - `render` will only be present when OriginalComponent was wrapped with forwardRef().\n const {\n render\n } = OriginalComponent;\n // Returns a forwardRef if OriginalComponent appears to be a forwardRef.\n if (typeof render === 'function') {\n isForwardRef = true;\n return forwardRef(Component);\n }\n return Component;\n}, 'withNotices');"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA2B;AAK3B,qBAA8C;AAC9C,qBAA2C;AAK3C,kBAAuB;AACvB,yBAA4B;AA8B5B,IAAO,2BAAQ,2CAA2B,uBAAqB;AAC7D,WAAS,UAAU,OAAO,KAAK;AAC7B,UAAM,CAAC,YAAY,aAAa,QAAI,yBAAS,CAAC,CAAC;AAC/C,UAAM,uBAAmB,wBAAQ,MAAM;AACrC,YAAM,eAAe,YAAU;AAC7B,cAAM,cAAc,OAAO,KAAK,SAAS;AAAA,UACvC,GAAG;AAAA,UACH,QAAI,YAAAA,IAAK;AAAA,QACX;AACA,sBAAc,aAAW,CAAC,GAAG,SAAS,WAAW,CAAC;AAAA,MACpD;AACA,aAAO;AAAA,QACL;AAAA,QACA,mBAAmB,SAAO;AAExB,uBAAa;AAAA,YACX,QAAQ;AAAA,YACR,SAAS;AAAA,UACX,CAAC;AAAA,QACH;AAAA,QACA,cAAc,QAAM;AAClB,wBAAc,aAAW,QAAQ,OAAO,YAAU,OAAO,OAAO,EAAE,CAAC;AAAA,QACrE;AAAA,QACA,kBAAkB,MAAM;AACtB,wBAAc,CAAC,CAAC;AAAA,QAClB;AAAA,MACF;AAAA,IACF,GAAG,CAAC,CAAC;AACL,UAAM,WAAW;AAAA,MACf,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,UAAU,WAAW,SAAS,KAAkB,uCAAAC,KAAK,YAAAC,SAAY;AAAA,QAC/D,WAAW;AAAA,QACX,SAAS;AAAA,QACT,UAAU,iBAAiB;AAAA,MAC7B,CAAC;AAAA,IACH;AACA,WAAO,eAA4B,uCAAAD,KAAK,mBAAmB;AAAA,MACzD,GAAG;AAAA,MACH;AAAA,IACF,CAAC,IAAiB,uCAAAA,KAAK,mBAAmB;AAAA,MACxC,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACA,MAAI;AAEJ,QAAM;AAAA,IACJ;AAAA,EACF,IAAI;AAEJ,MAAI,OAAO,WAAW,YAAY;AAChC,mBAAe;AACf,eAAO,2BAAW,SAAS;AAAA,EAC7B;AACA,SAAO;AACT,GAAG,aAAa;",
6
6
  "names": ["uuid", "_jsx", "NoticeList"]
7
7
  }
@@ -96,39 +96,42 @@ function InputBase(props, ref) {
96
96
  }
97
97
  };
98
98
  }, [__next40pxDefaultSize, size]);
99
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_input_control_styles.Root, {
100
- ...restProps,
101
- ...getUIFlexProps(labelPosition),
102
- className,
103
- gap: 2,
104
- ref,
105
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.default, {
106
- className: "components-input-control__label",
107
- hideLabelFromVision,
108
- labelPosition,
109
- htmlFor: id,
110
- children: label
111
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_input_control_styles.Container, {
112
- __unstableInputWidth,
113
- className: "components-input-control__container",
114
- disabled,
115
- hideLabel,
116
- labelPosition,
117
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_context.ContextSystemProvider, {
118
- value: prefixSuffixContextValue,
119
- children: [prefix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_control_styles.Prefix, {
120
- className: "components-input-control__prefix",
121
- children: prefix
122
- }), children, suffix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_control_styles.Suffix, {
123
- className: "components-input-control__suffix",
124
- children: suffix
125
- })]
126
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_backdrop.default, {
99
+ return (
100
+ // @ts-expect-error The `direction` prop from Flex (FlexDirection) conflicts with legacy SVGAttributes `direction` (string) that come from React intrinsic prop definitions.
101
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_input_control_styles.Root, {
102
+ ...restProps,
103
+ ...getUIFlexProps(labelPosition),
104
+ className,
105
+ gap: 2,
106
+ ref,
107
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.default, {
108
+ className: "components-input-control__label",
109
+ hideLabelFromVision,
110
+ labelPosition,
111
+ htmlFor: id,
112
+ children: label
113
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_input_control_styles.Container, {
114
+ __unstableInputWidth,
115
+ className: "components-input-control__container",
127
116
  disabled,
128
- isBorderless
117
+ hideLabel,
118
+ labelPosition,
119
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_context.ContextSystemProvider, {
120
+ value: prefixSuffixContextValue,
121
+ children: [prefix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_control_styles.Prefix, {
122
+ className: "components-input-control__prefix",
123
+ children: prefix
124
+ }), children, suffix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_control_styles.Suffix, {
125
+ className: "components-input-control__suffix",
126
+ children: suffix
127
+ })]
128
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_backdrop.default, {
129
+ disabled,
130
+ isBorderless
131
+ })]
129
132
  })]
130
- })]
131
- });
133
+ })
134
+ );
132
135
  }
133
136
  var input_base_default = (0, import_context.contextConnect)(InputBase, "InputBase");
134
137
  //# sourceMappingURL=input-base.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/input-control/input-base.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Backdrop from './backdrop';\nimport Label from './label';\nimport { Container, Root, Prefix, Suffix } from './styles/input-control-styles';\nimport { ContextSystemProvider, contextConnect, useContextSystem } from '../context';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction useUniqueId(idProp) {\n const instanceId = useInstanceId(InputBase);\n const id = `input-base-control-${instanceId}`;\n return idProp || id;\n}\n\n// Adapter to map props for the new ui/flex component.\nfunction getUIFlexProps(labelPosition) {\n const props = {};\n switch (labelPosition) {\n case 'top':\n props.direction = 'column';\n props.expanded = false;\n props.gap = 0;\n break;\n case 'bottom':\n props.direction = 'column-reverse';\n props.expanded = false;\n props.gap = 0;\n break;\n case 'edge':\n props.justify = 'space-between';\n break;\n }\n return props;\n}\nfunction InputBase(props, ref) {\n const {\n __next40pxDefaultSize,\n __unstableInputWidth,\n children,\n className,\n disabled = false,\n hideLabelFromVision = false,\n labelPosition,\n id: idProp,\n isBorderless = false,\n label,\n prefix,\n size = 'default',\n suffix,\n ...restProps\n } = useDeprecated36pxDefaultSizeProp(useContextSystem(props, 'InputBase'));\n const id = useUniqueId(idProp);\n const hideLabel = hideLabelFromVision || !label;\n const prefixSuffixContextValue = useMemo(() => {\n return {\n InputControlPrefixWrapper: {\n __next40pxDefaultSize,\n size\n },\n InputControlSuffixWrapper: {\n __next40pxDefaultSize,\n size\n }\n };\n }, [__next40pxDefaultSize, size]);\n return /*#__PURE__*/_jsxs(Root, {\n ...restProps,\n ...getUIFlexProps(labelPosition),\n className: className,\n gap: 2,\n ref: ref,\n children: [/*#__PURE__*/_jsx(Label, {\n className: \"components-input-control__label\",\n hideLabelFromVision: hideLabelFromVision,\n labelPosition: labelPosition,\n htmlFor: id,\n children: label\n }), /*#__PURE__*/_jsxs(Container, {\n __unstableInputWidth: __unstableInputWidth,\n className: \"components-input-control__container\",\n disabled: disabled,\n hideLabel: hideLabel,\n labelPosition: labelPosition,\n children: [/*#__PURE__*/_jsxs(ContextSystemProvider, {\n value: prefixSuffixContextValue,\n children: [prefix && /*#__PURE__*/_jsx(Prefix, {\n className: \"components-input-control__prefix\",\n children: prefix\n }), children, suffix && /*#__PURE__*/_jsx(Suffix, {\n className: \"components-input-control__suffix\",\n children: suffix\n })]\n }), /*#__PURE__*/_jsx(Backdrop, {\n disabled: disabled,\n isBorderless: isBorderless\n })]\n })]\n });\n}\n\n/**\n * `InputBase` is an internal component used to style the standard borders for an input,\n * as well as handle the layout for prefix/suffix elements.\n */\nexport default contextConnect(InputBase, 'InputBase');"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAA8B;AAC9B,qBAAwB;AAKxB,sBAAqB;AACrB,mBAAkB;AAClB,kCAAgD;AAChD,qBAAwE;AACxE,kCAAiD;AACjD,yBAA2C;AAC3C,SAAS,YAAY,QAAQ;AAC3B,QAAM,iBAAa,8BAAc,SAAS;AAC1C,QAAM,KAAK,sBAAsB,UAAU;AAC3C,SAAO,UAAU;AACnB;AAGA,SAAS,eAAe,eAAe;AACrC,QAAM,QAAQ,CAAC;AACf,UAAQ,eAAe;AAAA,IACrB,KAAK;AACH,YAAM,YAAY;AAClB,YAAM,WAAW;AACjB,YAAM,MAAM;AACZ;AAAA,IACF,KAAK;AACH,YAAM,YAAY;AAClB,YAAM,WAAW;AACjB,YAAM,MAAM;AACZ;AAAA,IACF,KAAK;AACH,YAAM,UAAU;AAChB;AAAA,EACJ;AACA,SAAO;AACT;AACA,SAAS,UAAU,OAAO,KAAK;AAC7B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,sBAAsB;AAAA,IACtB;AAAA,IACA,IAAI;AAAA,IACJ,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,GAAG;AAAA,EACL,QAAI,kEAAiC,iCAAiB,OAAO,WAAW,CAAC;AACzE,QAAM,KAAK,YAAY,MAAM;AAC7B,QAAM,YAAY,uBAAuB,CAAC;AAC1C,QAAM,+BAA2B,wBAAQ,MAAM;AAC7C,WAAO;AAAA,MACL,2BAA2B;AAAA,QACzB;AAAA,QACA;AAAA,MACF;AAAA,MACA,2BAA2B;AAAA,QACzB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAAG,CAAC,uBAAuB,IAAI,CAAC;AAChC,SAAoB,uCAAAA,MAAM,kCAAM;AAAA,IAC9B,GAAG;AAAA,IACH,GAAG,eAAe,aAAa;AAAA,IAC/B;AAAA,IACA,KAAK;AAAA,IACL;AAAA,IACA,UAAU,CAAc,uCAAAC,KAAK,aAAAC,SAAO;AAAA,MAClC,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT,UAAU;AAAA,IACZ,CAAC,GAAgB,uCAAAF,MAAM,uCAAW;AAAA,MAChC;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU,CAAc,uCAAAA,MAAM,sCAAuB;AAAA,QACnD,OAAO;AAAA,QACP,UAAU,CAAC,UAAuB,uCAAAC,KAAK,oCAAQ;AAAA,UAC7C,WAAW;AAAA,UACX,UAAU;AAAA,QACZ,CAAC,GAAG,UAAU,UAAuB,uCAAAA,KAAK,oCAAQ;AAAA,UAChD,WAAW;AAAA,UACX,UAAU;AAAA,QACZ,CAAC,CAAC;AAAA,MACJ,CAAC,GAAgB,uCAAAA,KAAK,gBAAAE,SAAU;AAAA,QAC9B;AAAA,QACA;AAAA,MACF,CAAC,CAAC;AAAA,IACJ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AAMA,IAAO,yBAAQ,+BAAe,WAAW,WAAW;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Backdrop from './backdrop';\nimport Label from './label';\nimport { Container, Root, Prefix, Suffix } from './styles/input-control-styles';\nimport { ContextSystemProvider, contextConnect, useContextSystem } from '../context';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction useUniqueId(idProp) {\n const instanceId = useInstanceId(InputBase);\n const id = `input-base-control-${instanceId}`;\n return idProp || id;\n}\n\n// Adapter to map props for the new ui/flex component.\nfunction getUIFlexProps(labelPosition) {\n const props = {};\n switch (labelPosition) {\n case 'top':\n props.direction = 'column';\n props.expanded = false;\n props.gap = 0;\n break;\n case 'bottom':\n props.direction = 'column-reverse';\n props.expanded = false;\n props.gap = 0;\n break;\n case 'edge':\n props.justify = 'space-between';\n break;\n }\n return props;\n}\nfunction InputBase(props, ref) {\n const {\n __next40pxDefaultSize,\n __unstableInputWidth,\n children,\n className,\n disabled = false,\n hideLabelFromVision = false,\n labelPosition,\n id: idProp,\n isBorderless = false,\n label,\n prefix,\n size = 'default',\n suffix,\n ...restProps\n } = useDeprecated36pxDefaultSizeProp(useContextSystem(props, 'InputBase'));\n const id = useUniqueId(idProp);\n const hideLabel = hideLabelFromVision || !label;\n const prefixSuffixContextValue = useMemo(() => {\n return {\n InputControlPrefixWrapper: {\n __next40pxDefaultSize,\n size\n },\n InputControlSuffixWrapper: {\n __next40pxDefaultSize,\n size\n }\n };\n }, [__next40pxDefaultSize, size]);\n return (\n /*#__PURE__*/\n // @ts-expect-error The `direction` prop from Flex (FlexDirection) conflicts with legacy SVGAttributes `direction` (string) that come from React intrinsic prop definitions.\n _jsxs(Root, {\n ...restProps,\n ...getUIFlexProps(labelPosition),\n className: className,\n gap: 2,\n ref: ref,\n children: [/*#__PURE__*/_jsx(Label, {\n className: \"components-input-control__label\",\n hideLabelFromVision: hideLabelFromVision,\n labelPosition: labelPosition,\n htmlFor: id,\n children: label\n }), /*#__PURE__*/_jsxs(Container, {\n __unstableInputWidth: __unstableInputWidth,\n className: \"components-input-control__container\",\n disabled: disabled,\n hideLabel: hideLabel,\n labelPosition: labelPosition,\n children: [/*#__PURE__*/_jsxs(ContextSystemProvider, {\n value: prefixSuffixContextValue,\n children: [prefix && /*#__PURE__*/_jsx(Prefix, {\n className: \"components-input-control__prefix\",\n children: prefix\n }), children, suffix && /*#__PURE__*/_jsx(Suffix, {\n className: \"components-input-control__suffix\",\n children: suffix\n })]\n }), /*#__PURE__*/_jsx(Backdrop, {\n disabled: disabled,\n isBorderless: isBorderless\n })]\n })]\n })\n );\n}\n\n/**\n * `InputBase` is an internal component used to style the standard borders for an input,\n * as well as handle the layout for prefix/suffix elements.\n */\nexport default contextConnect(InputBase, 'InputBase');"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAA8B;AAC9B,qBAAwB;AAKxB,sBAAqB;AACrB,mBAAkB;AAClB,kCAAgD;AAChD,qBAAwE;AACxE,kCAAiD;AACjD,yBAA2C;AAC3C,SAAS,YAAY,QAAQ;AAC3B,QAAM,iBAAa,8BAAc,SAAS;AAC1C,QAAM,KAAK,sBAAsB,UAAU;AAC3C,SAAO,UAAU;AACnB;AAGA,SAAS,eAAe,eAAe;AACrC,QAAM,QAAQ,CAAC;AACf,UAAQ,eAAe;AAAA,IACrB,KAAK;AACH,YAAM,YAAY;AAClB,YAAM,WAAW;AACjB,YAAM,MAAM;AACZ;AAAA,IACF,KAAK;AACH,YAAM,YAAY;AAClB,YAAM,WAAW;AACjB,YAAM,MAAM;AACZ;AAAA,IACF,KAAK;AACH,YAAM,UAAU;AAChB;AAAA,EACJ;AACA,SAAO;AACT;AACA,SAAS,UAAU,OAAO,KAAK;AAC7B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,sBAAsB;AAAA,IACtB;AAAA,IACA,IAAI;AAAA,IACJ,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,GAAG;AAAA,EACL,QAAI,kEAAiC,iCAAiB,OAAO,WAAW,CAAC;AACzE,QAAM,KAAK,YAAY,MAAM;AAC7B,QAAM,YAAY,uBAAuB,CAAC;AAC1C,QAAM,+BAA2B,wBAAQ,MAAM;AAC7C,WAAO;AAAA,MACL,2BAA2B;AAAA,QACzB;AAAA,QACA;AAAA,MACF;AAAA,MACA,2BAA2B;AAAA,QACzB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAAG,CAAC,uBAAuB,IAAI,CAAC;AAChC;AAAA;AAAA,IAGE,uCAAAA,MAAM,kCAAM;AAAA,MACV,GAAG;AAAA,MACH,GAAG,eAAe,aAAa;AAAA,MAC/B;AAAA,MACA,KAAK;AAAA,MACL;AAAA,MACA,UAAU,CAAc,uCAAAC,KAAK,aAAAC,SAAO;AAAA,QAClC,WAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA,SAAS;AAAA,QACT,UAAU;AAAA,MACZ,CAAC,GAAgB,uCAAAF,MAAM,uCAAW;AAAA,QAChC;AAAA,QACA,WAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU,CAAc,uCAAAA,MAAM,sCAAuB;AAAA,UACnD,OAAO;AAAA,UACP,UAAU,CAAC,UAAuB,uCAAAC,KAAK,oCAAQ;AAAA,YAC7C,WAAW;AAAA,YACX,UAAU;AAAA,UACZ,CAAC,GAAG,UAAU,UAAuB,uCAAAA,KAAK,oCAAQ;AAAA,YAChD,WAAW;AAAA,YACX,UAAU;AAAA,UACZ,CAAC,CAAC;AAAA,QACJ,CAAC,GAAgB,uCAAAA,KAAK,gBAAAE,SAAU;AAAA,UAC9B;AAAA,UACA;AAAA,QACF,CAAC,CAAC;AAAA,MACJ,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA;AAEL;AAMA,IAAO,yBAAQ,+BAAe,WAAW,WAAW;",
6
6
  "names": ["_jsxs", "_jsx", "Label", "Backdrop"]
7
7
  }
@@ -39,6 +39,19 @@ function cycleValue(value, total, offset) {
39
39
  }
40
40
  return nextValue;
41
41
  }
42
+ function getFocusableContext(container, target, tabbableOnly) {
43
+ const finder = tabbableOnly ? import_dom.focus.tabbable : import_dom.focus.focusable;
44
+ const focusables = finder.find(container);
45
+ const index = focusables.indexOf(target);
46
+ if (index > -1) {
47
+ return {
48
+ index,
49
+ target,
50
+ focusables
51
+ };
52
+ }
53
+ return null;
54
+ }
42
55
  function UnforwardedNavigableContainer({
43
56
  children,
44
57
  stopNavigationEvents,
@@ -50,25 +63,6 @@ function UnforwardedNavigableContainer({
50
63
  ...restProps
51
64
  }, ref) {
52
65
  const containerRef = (0, import_element.useRef)(null);
53
- const getFocusableIndex = (0, import_element.useCallback)((focusables, target) => {
54
- return focusables.indexOf(target);
55
- }, []);
56
- const getFocusableContext = (0, import_element.useCallback)((target) => {
57
- if (!containerRef.current) {
58
- return null;
59
- }
60
- const finder = onlyBrowserTabstops ? import_dom.focus.tabbable : import_dom.focus.focusable;
61
- const focusables = finder.find(containerRef.current);
62
- const index = getFocusableIndex(focusables, target);
63
- if (index > -1 && target) {
64
- return {
65
- index,
66
- target,
67
- focusables
68
- };
69
- }
70
- return null;
71
- }, [onlyBrowserTabstops, getFocusableIndex]);
72
66
  (0, import_element.useEffect)(() => {
73
67
  const container = containerRef.current;
74
68
  if (!container) {
@@ -94,7 +88,7 @@ function UnforwardedNavigableContainer({
94
88
  if (!activeElement) {
95
89
  return;
96
90
  }
97
- const context = getFocusableContext(activeElement);
91
+ const context = getFocusableContext(container, activeElement, !!onlyBrowserTabstops);
98
92
  if (!context) {
99
93
  return;
100
94
  }
@@ -115,7 +109,7 @@ function UnforwardedNavigableContainer({
115
109
  return () => {
116
110
  container.removeEventListener("keydown", handleKeyDown);
117
111
  };
118
- }, [onKeyDown, eventToOffset, stopNavigationEvents, cycle, onNavigate, getFocusableContext]);
112
+ }, [onKeyDown, eventToOffset, stopNavigationEvents, cycle, onNavigate, onlyBrowserTabstops]);
119
113
  const mergedRef = (0, import_compose.useMergeRefs)([containerRef, ref]);
120
114
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
121
115
  ref: mergedRef,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/navigable-container/container.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef, useEffect, useCallback } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst noop = () => {};\nconst MENU_ITEM_ROLES = ['menuitem', 'menuitemradio', 'menuitemcheckbox'];\nfunction cycleValue(value, total, offset) {\n const nextValue = value + offset;\n if (nextValue < 0) {\n return total + nextValue;\n } else if (nextValue >= total) {\n return nextValue - total;\n }\n return nextValue;\n}\nfunction UnforwardedNavigableContainer({\n children,\n stopNavigationEvents,\n eventToOffset,\n onNavigate = noop,\n onKeyDown,\n cycle = true,\n onlyBrowserTabstops,\n ...restProps\n}, ref) {\n const containerRef = useRef(null);\n const getFocusableIndex = useCallback((focusables, target) => {\n return focusables.indexOf(target);\n }, []);\n const getFocusableContext = useCallback(target => {\n if (!containerRef.current) {\n return null;\n }\n const finder = onlyBrowserTabstops ? focus.tabbable : focus.focusable;\n const focusables = finder.find(containerRef.current);\n const index = getFocusableIndex(focusables, target);\n if (index > -1 && target) {\n return {\n index,\n target,\n focusables\n };\n }\n return null;\n }, [onlyBrowserTabstops, getFocusableIndex]);\n useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return;\n }\n function handleKeyDown(event) {\n if (onKeyDown) {\n onKeyDown(event);\n }\n const offset = eventToOffset(event);\n\n // eventToOffset returns undefined if the event is not handled by the component.\n if (offset !== undefined && stopNavigationEvents) {\n // Prevents arrow key handlers bound to the document directly interfering.\n event.stopImmediatePropagation();\n\n // When navigating a collection of items, prevent scroll containers\n // from scrolling. The preventDefault also prevents Voiceover from\n // 'handling' the event, as voiceover will try to use arrow keys\n // for highlighting text.\n const targetRole = event.target?.getAttribute('role');\n const targetHasMenuItemRole = !!targetRole && MENU_ITEM_ROLES.includes(targetRole);\n if (targetHasMenuItemRole) {\n event.preventDefault();\n }\n }\n if (!offset) {\n return;\n }\n const activeElement = event.target?.ownerDocument?.activeElement;\n if (!activeElement) {\n return;\n }\n const context = getFocusableContext(activeElement);\n if (!context) {\n return;\n }\n const {\n index,\n focusables\n } = context;\n const nextIndex = cycle ? cycleValue(index, focusables.length, offset) : index + offset;\n if (nextIndex >= 0 && nextIndex < focusables.length) {\n focusables[nextIndex].focus();\n onNavigate(nextIndex, focusables[nextIndex]);\n\n // `preventDefault()` on tab to avoid having the browser move the focus\n // after this component has already moved it.\n if (event.code === 'Tab') {\n event.preventDefault();\n }\n }\n }\n\n // We use DOM event listeners instead of React event listeners\n // because we want to catch events from the underlying DOM tree.\n // The React Tree can be different from the DOM tree when using\n // portals. Block Toolbars for instance are rendered in a separate\n // React Trees.\n container.addEventListener('keydown', handleKeyDown);\n return () => {\n container.removeEventListener('keydown', handleKeyDown);\n };\n }, [onKeyDown, eventToOffset, stopNavigationEvents, cycle, onNavigate, getFocusableContext]);\n const mergedRef = useMergeRefs([containerRef, ref]);\n return /*#__PURE__*/_jsx(\"div\", {\n ref: mergedRef,\n ...restProps,\n children: children\n });\n}\nconst NavigableContainer = forwardRef(UnforwardedNavigableContainer);\nNavigableContainer.displayName = 'NavigableContainer';\nexport default NavigableContainer;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAA2D;AAC3D,qBAA6B;AAC7B,iBAAsB;AAKtB,yBAA4B;AAC5B,IAAM,OAAO,MAAM;AAAC;AACpB,IAAM,kBAAkB,CAAC,YAAY,iBAAiB,kBAAkB;AACxE,SAAS,WAAW,OAAO,OAAO,QAAQ;AACxC,QAAM,YAAY,QAAQ;AAC1B,MAAI,YAAY,GAAG;AACjB,WAAO,QAAQ;AAAA,EACjB,WAAW,aAAa,OAAO;AAC7B,WAAO,YAAY;AAAA,EACrB;AACA,SAAO;AACT;AACA,SAAS,8BAA8B;AAAA,EACrC;AAAA,EACA;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AAA,QACA;AAAA,MACF,IAAI;AACJ,YAAM,YAAY,QAAQ,WAAW,OAAO,WAAW,QAAQ,MAAM,IAAI,QAAQ;AACjF,UAAI,aAAa,KAAK,YAAY,WAAW,QAAQ;AACnD,mBAAW,SAAS,EAAE,MAAM;AAC5B,mBAAW,WAAW,WAAW,SAAS,CAAC;AAI3C,YAAI,MAAM,SAAS,OAAO;AACxB,gBAAM,eAAe;AAAA,QACvB;AAAA,MACF;AAAA,IACF;AAOA,cAAU,iBAAiB,WAAW,aAAa;AACnD,WAAO,MAAM;AACX,gBAAU,oBAAoB,WAAW,aAAa;AAAA,IACxD;AAAA,EACF,GAAG,CAAC,WAAW,eAAe,sBAAsB,OAAO,YAAY,mBAAmB,CAAC;AAC3F,QAAM,gBAAY,6BAAa,CAAC,cAAc,GAAG,CAAC;AAClD,SAAoB,uCAAAA,KAAK,OAAO;AAAA,IAC9B,KAAK;AAAA,IACL,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;AACA,IAAM,yBAAqB,2BAAW,6BAA6B;AACnE,mBAAmB,cAAc;AACjC,IAAO,oBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef, useEffect } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst noop = () => {};\nconst MENU_ITEM_ROLES = ['menuitem', 'menuitemradio', 'menuitemcheckbox'];\nfunction cycleValue(value, total, offset) {\n const nextValue = value + offset;\n if (nextValue < 0) {\n return total + nextValue;\n } else if (nextValue >= total) {\n return nextValue - total;\n }\n return nextValue;\n}\nfunction getFocusableContext(container, target, tabbableOnly) {\n const finder = tabbableOnly ? focus.tabbable : focus.focusable;\n const focusables = finder.find(container);\n const index = focusables.indexOf(target);\n if (index > -1) {\n return {\n index,\n target,\n focusables\n };\n }\n return null;\n}\nfunction UnforwardedNavigableContainer({\n children,\n stopNavigationEvents,\n eventToOffset,\n onNavigate = noop,\n onKeyDown,\n cycle = true,\n onlyBrowserTabstops,\n ...restProps\n}, ref) {\n const containerRef = useRef(null);\n useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return;\n }\n function handleKeyDown(event) {\n if (onKeyDown) {\n onKeyDown(event);\n }\n const offset = eventToOffset(event);\n\n // eventToOffset returns undefined if the event is not handled by the component.\n if (offset !== undefined && stopNavigationEvents) {\n // Prevents arrow key handlers bound to the document directly interfering.\n event.stopImmediatePropagation();\n\n // When navigating a collection of items, prevent scroll containers\n // from scrolling. The preventDefault also prevents Voiceover from\n // 'handling' the event, as voiceover will try to use arrow keys\n // for highlighting text.\n const targetRole = event.target?.getAttribute('role');\n const targetHasMenuItemRole = !!targetRole && MENU_ITEM_ROLES.includes(targetRole);\n if (targetHasMenuItemRole) {\n event.preventDefault();\n }\n }\n if (!offset) {\n return;\n }\n const activeElement = event.target?.ownerDocument?.activeElement;\n if (!activeElement) {\n return;\n }\n const context = getFocusableContext(container, activeElement, !!onlyBrowserTabstops);\n if (!context) {\n return;\n }\n const {\n index,\n focusables\n } = context;\n const nextIndex = cycle ? cycleValue(index, focusables.length, offset) : index + offset;\n if (nextIndex >= 0 && nextIndex < focusables.length) {\n focusables[nextIndex].focus();\n onNavigate(nextIndex, focusables[nextIndex]);\n\n // `preventDefault()` on tab to avoid having the browser move the focus\n // after this component has already moved it.\n if (event.code === 'Tab') {\n event.preventDefault();\n }\n }\n }\n\n // We use DOM event listeners instead of React event listeners\n // because we want to catch events from the underlying DOM tree.\n // The React Tree can be different from the DOM tree when using\n // portals. Block Toolbars for instance are rendered in a separate\n // React Trees.\n container.addEventListener('keydown', handleKeyDown);\n return () => {\n container.removeEventListener('keydown', handleKeyDown);\n };\n }, [onKeyDown, eventToOffset, stopNavigationEvents, cycle, onNavigate, onlyBrowserTabstops]);\n const mergedRef = useMergeRefs([containerRef, ref]);\n return /*#__PURE__*/_jsx(\"div\", {\n ref: mergedRef,\n ...restProps,\n children: children\n });\n}\nconst NavigableContainer = forwardRef(UnforwardedNavigableContainer);\nNavigableContainer.displayName = 'NavigableContainer';\nexport default NavigableContainer;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAA8C;AAC9C,qBAA6B;AAC7B,iBAAsB;AAKtB,yBAA4B;AAC5B,IAAM,OAAO,MAAM;AAAC;AACpB,IAAM,kBAAkB,CAAC,YAAY,iBAAiB,kBAAkB;AACxE,SAAS,WAAW,OAAO,OAAO,QAAQ;AACxC,QAAM,YAAY,QAAQ;AAC1B,MAAI,YAAY,GAAG;AACjB,WAAO,QAAQ;AAAA,EACjB,WAAW,aAAa,OAAO;AAC7B,WAAO,YAAY;AAAA,EACrB;AACA,SAAO;AACT;AACA,SAAS,oBAAoB,WAAW,QAAQ,cAAc;AAC5D,QAAM,SAAS,eAAe,iBAAM,WAAW,iBAAM;AACrD,QAAM,aAAa,OAAO,KAAK,SAAS;AACxC,QAAM,QAAQ,WAAW,QAAQ,MAAM;AACvC,MAAI,QAAQ,IAAI;AACd,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AACA,SAAS,8BAA8B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAAG,KAAK;AACN,QAAM,mBAAe,uBAAO,IAAI;AAChC,gCAAU,MAAM;AACd,UAAM,YAAY,aAAa;AAC/B,QAAI,CAAC,WAAW;AACd;AAAA,IACF;AACA,aAAS,cAAc,OAAO;AAC5B,UAAI,WAAW;AACb,kBAAU,KAAK;AAAA,MACjB;AACA,YAAM,SAAS,cAAc,KAAK;AAGlC,UAAI,WAAW,UAAa,sBAAsB;AAEhD,cAAM,yBAAyB;AAM/B,cAAM,aAAa,MAAM,QAAQ,aAAa,MAAM;AACpD,cAAM,wBAAwB,CAAC,CAAC,cAAc,gBAAgB,SAAS,UAAU;AACjF,YAAI,uBAAuB;AACzB,gBAAM,eAAe;AAAA,QACvB;AAAA,MACF;AACA,UAAI,CAAC,QAAQ;AACX;AAAA,MACF;AACA,YAAM,gBAAgB,MAAM,QAAQ,eAAe;AACnD,UAAI,CAAC,eAAe;AAClB;AAAA,MACF;AACA,YAAM,UAAU,oBAAoB,WAAW,eAAe,CAAC,CAAC,mBAAmB;AACnF,UAAI,CAAC,SAAS;AACZ;AAAA,MACF;AACA,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,MACF,IAAI;AACJ,YAAM,YAAY,QAAQ,WAAW,OAAO,WAAW,QAAQ,MAAM,IAAI,QAAQ;AACjF,UAAI,aAAa,KAAK,YAAY,WAAW,QAAQ;AACnD,mBAAW,SAAS,EAAE,MAAM;AAC5B,mBAAW,WAAW,WAAW,SAAS,CAAC;AAI3C,YAAI,MAAM,SAAS,OAAO;AACxB,gBAAM,eAAe;AAAA,QACvB;AAAA,MACF;AAAA,IACF;AAOA,cAAU,iBAAiB,WAAW,aAAa;AACnD,WAAO,MAAM;AACX,gBAAU,oBAAoB,WAAW,aAAa;AAAA,IACxD;AAAA,EACF,GAAG,CAAC,WAAW,eAAe,sBAAsB,OAAO,YAAY,mBAAmB,CAAC;AAC3F,QAAM,gBAAY,6BAAa,CAAC,cAAc,GAAG,CAAC;AAClD,SAAoB,uCAAAA,KAAK,OAAO;AAAA,IAC9B,KAAK;AAAA,IACL,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;AACA,IAAM,yBAAqB,2BAAW,6BAA6B;AACnE,mBAAmB,cAAc;AACjC,IAAO,oBAAQ;",
6
6
  "names": ["_jsx"]
7
7
  }
@@ -50,14 +50,13 @@ function ResponsiveWrapper({
50
50
  if (naturalWidth && naturalHeight) {
51
51
  aspectRatio = `${naturalWidth} / ${naturalHeight}`;
52
52
  }
53
- const ch = children;
54
53
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TagName, {
55
54
  className: "components-responsive-wrapper",
56
55
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
57
- children: (0, import_element.cloneElement)(ch, {
58
- className: (0, import_clsx.default)("components-responsive-wrapper__content", ch.props.className),
56
+ children: (0, import_element.cloneElement)(children, {
57
+ className: (0, import_clsx.default)("components-responsive-wrapper__content", children.props.className),
59
58
  style: {
60
- ...ch.props.style,
59
+ ...children.props.style,
61
60
  aspectRatio
62
61
  }
63
62
  })
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/responsive-wrapper/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { cloneElement, Children } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * A wrapper component that maintains its aspect ratio when resized.\n *\n * ```jsx\n * import { ResponsiveWrapper } from '@wordpress/components';\n *\n * const MyResponsiveWrapper = () => (\n * \t<ResponsiveWrapper naturalWidth={ 2000 } naturalHeight={ 680 }>\n * \t\t<img\n * \t\t\tsrc=\"https://s.w.org/style/images/about/WordPress-logotype-standard.png\"\n * \t\t\talt=\"WordPress\"\n * \t\t/>\n * \t</ResponsiveWrapper>\n * );\n * ```\n */\nfunction ResponsiveWrapper({\n naturalWidth,\n naturalHeight,\n children,\n isInline = false\n}) {\n if (Children.count(children) !== 1) {\n return null;\n }\n const TagName = isInline ? 'span' : 'div';\n let aspectRatio;\n if (naturalWidth && naturalHeight) {\n aspectRatio = `${naturalWidth} / ${naturalHeight}`;\n }\n const ch = children;\n return /*#__PURE__*/_jsx(TagName, {\n className: \"components-responsive-wrapper\",\n children: /*#__PURE__*/_jsx(\"div\", {\n children: cloneElement(ch, {\n className: clsx('components-responsive-wrapper__content', ch.props.className),\n style: {\n ...ch.props.style,\n aspectRatio\n }\n })\n })\n });\n}\nexport default ResponsiveWrapper;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAuC;AAKvC,yBAA4B;AAiB5B,SAAS,kBAAkB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAAG;AACD,MAAI,wBAAS,MAAM,QAAQ,MAAM,GAAG;AAClC,WAAO;AAAA,EACT;AACA,QAAM,UAAU,WAAW,SAAS;AACpC,MAAI;AACJ,MAAI,gBAAgB,eAAe;AACjC,kBAAc,GAAG,YAAY,MAAM,aAAa;AAAA,EAClD;AACA,QAAM,KAAK;AACX,SAAoB,uCAAAA,KAAK,SAAS;AAAA,IAChC,WAAW;AAAA,IACX,UAAuB,uCAAAA,KAAK,OAAO;AAAA,MACjC,cAAU,6BAAa,IAAI;AAAA,QACzB,eAAW,YAAAC,SAAK,0CAA0C,GAAG,MAAM,SAAS;AAAA,QAC5E,OAAO;AAAA,UACL,GAAG,GAAG,MAAM;AAAA,UACZ;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH;AACA,IAAO,6BAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { cloneElement, Children } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * A wrapper component that maintains its aspect ratio when resized.\n *\n * ```jsx\n * import { ResponsiveWrapper } from '@wordpress/components';\n *\n * const MyResponsiveWrapper = () => (\n * \t<ResponsiveWrapper naturalWidth={ 2000 } naturalHeight={ 680 }>\n * \t\t<img\n * \t\t\tsrc=\"https://s.w.org/style/images/about/WordPress-logotype-standard.png\"\n * \t\t\talt=\"WordPress\"\n * \t\t/>\n * \t</ResponsiveWrapper>\n * );\n * ```\n */\nfunction ResponsiveWrapper({\n naturalWidth,\n naturalHeight,\n children,\n isInline = false\n}) {\n if (Children.count(children) !== 1) {\n return null;\n }\n const TagName = isInline ? 'span' : 'div';\n let aspectRatio;\n if (naturalWidth && naturalHeight) {\n aspectRatio = `${naturalWidth} / ${naturalHeight}`;\n }\n return /*#__PURE__*/_jsx(TagName, {\n className: \"components-responsive-wrapper\",\n children: /*#__PURE__*/_jsx(\"div\", {\n children: cloneElement(children, {\n className: clsx('components-responsive-wrapper__content', children.props.className),\n style: {\n ...children.props.style,\n aspectRatio\n }\n })\n })\n });\n}\nexport default ResponsiveWrapper;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAuC;AAKvC,yBAA4B;AAiB5B,SAAS,kBAAkB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAAG;AACD,MAAI,wBAAS,MAAM,QAAQ,MAAM,GAAG;AAClC,WAAO;AAAA,EACT;AACA,QAAM,UAAU,WAAW,SAAS;AACpC,MAAI;AACJ,MAAI,gBAAgB,eAAe;AACjC,kBAAc,GAAG,YAAY,MAAM,aAAa;AAAA,EAClD;AACA,SAAoB,uCAAAA,KAAK,SAAS;AAAA,IAChC,WAAW;AAAA,IACX,UAAuB,uCAAAA,KAAK,OAAO;AAAA,MACjC,cAAU,6BAAa,UAAU;AAAA,QAC/B,eAAW,YAAAC,SAAK,0CAA0C,SAAS,MAAM,SAAS;AAAA,QAClF,OAAO;AAAA,UACL,GAAG,SAAS,MAAM;AAAA,UAClB;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH;AACA,IAAO,6BAAQ;",
6
6
  "names": ["_jsx", "clsx"]
7
7
  }
@@ -93,8 +93,7 @@ function UnforwardedTooltip(props, ref) {
93
93
  render: children
94
94
  }) : children;
95
95
  }
96
- function addDescribedById(el) {
97
- const element = el;
96
+ function addDescribedById(element) {
98
97
  return describedById && mounted && element.props["aria-describedby"] === void 0 && element.props["aria-label"] !== text ? (0, import_element.cloneElement)(element, {
99
98
  "aria-describedby": describedById
100
99
  }) : element;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/tooltip/index.tsx"],
4
- "sourcesContent": ["import * as Ariakit from '@ariakit/react';\nimport clsx from 'clsx';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Children, useContext, forwardRef, cloneElement } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\nimport Shortcut from '../shortcut';\nimport { positionToPlacement } from '../popover/utils';\nimport { TooltipInternalContext } from './context';\n\n/**\n * Time over anchor to wait before showing tooltip\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const TOOLTIP_DELAY = 700;\nconst CONTEXT_VALUE = {\n isNestedInTooltip: true\n};\nfunction UnforwardedTooltip(props, ref) {\n const {\n children,\n className,\n delay = TOOLTIP_DELAY,\n hideOnClick = true,\n placement,\n position,\n shortcut,\n text,\n ...restProps\n } = props;\n const {\n isNestedInTooltip\n } = useContext(TooltipInternalContext);\n const baseId = useInstanceId(Tooltip, 'tooltip');\n const describedById = text || shortcut ? baseId : undefined;\n const isOnlyChild = Children.count(children) === 1;\n // console error if more than one child element is added\n if (!isOnlyChild) {\n if ('development' === process.env.NODE_ENV) {\n // eslint-disable-next-line no-console\n console.error('wp-components.Tooltip should be called with only a single child element.');\n }\n }\n\n // Compute tooltip's placement:\n // - give priority to `placement` prop, if defined\n // - otherwise, compute it from the legacy `position` prop (if defined)\n // - finally, fallback to the default placement: 'top'\n let computedPlacement;\n if (placement !== undefined) {\n computedPlacement = placement;\n } else if (position !== undefined) {\n computedPlacement = positionToPlacement(position);\n deprecated('`position` prop in wp.components.tooltip', {\n since: '6.4',\n alternative: '`placement` prop'\n });\n }\n computedPlacement = computedPlacement || 'top';\n const tooltipStore = Ariakit.useTooltipStore({\n placement: computedPlacement,\n showTimeout: delay\n });\n const mounted = Ariakit.useStoreState(tooltipStore, 'mounted');\n if (isNestedInTooltip) {\n return isOnlyChild ? /*#__PURE__*/_jsx(Ariakit.Role, {\n ...restProps,\n render: children\n }) : children;\n }\n\n // TODO: this is a temporary workaround to minimize the effects of the\n // Ariakit upgrade. Ariakit doesn't pass the `aria-describedby` prop to\n // the tooltip anchor anymore since 0.4.0, so we need to add it manually.\n // The `aria-describedby` attribute is added only if the anchor doesn't have\n // one already, and if the tooltip text is not the same as the anchor's\n // `aria-label`\n // See: https://github.com/WordPress/gutenberg/pull/64066\n // See: https://github.com/WordPress/gutenberg/pull/65989\n function addDescribedById(el) {\n const element = el;\n return describedById && mounted && element.props['aria-describedby'] === undefined && element.props['aria-label'] !== text ? cloneElement(element, {\n 'aria-describedby': describedById\n }) : element;\n }\n return /*#__PURE__*/_jsxs(TooltipInternalContext.Provider, {\n value: CONTEXT_VALUE,\n children: [/*#__PURE__*/_jsx(Ariakit.TooltipAnchor, {\n onClick: hideOnClick ? tooltipStore.hide : undefined,\n store: tooltipStore,\n render: isOnlyChild ? addDescribedById(children) : undefined,\n ref: ref,\n children: isOnlyChild ? undefined : children\n }), isOnlyChild && (text || shortcut) && /*#__PURE__*/_jsxs(Ariakit.Tooltip, {\n ...restProps,\n className: clsx('components-tooltip', className),\n unmountOnHide: true,\n gutter: 4,\n id: describedById,\n overflowPadding: 0.5,\n store: tooltipStore,\n children: [text, shortcut && /*#__PURE__*/_jsx(Shortcut, {\n className: text ? 'components-tooltip__shortcut' : '',\n shortcut: shortcut\n })]\n })]\n });\n}\nexport const Tooltip = forwardRef(UnforwardedTooltip);\nexport default Tooltip;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,iBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA,cAAyB;AACzB,kBAAiB;AACjB,qBAA8B;AAC9B,qBAA+D;AAC/D,wBAAuB;AACvB,sBAAqB;AACrB,mBAAoC;AACp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AC,IAAI;AAAA,EACP;AACA,SAAoB,uCAAAC,MAAM,sCAAuB,UAAU;AAAA,IACzD,OAAO;AAAA,IACP,UAAU,CAAc,uCAAAD,KAAa,uBAAe;AAAA,MAClD,SAAS,cAAc,aAAa,OAAO;AAAA,MAC3C,OAAO;AAAA,MACP,QAAQ,cAAc,iBAAiB,QAAQ,IAAI;AAAA,MACnD;AAAA,MACA,UAAU,cAAc,SAAY;AAAA,IACtC,CAAC,GAAG,gBAAgB,QAAQ,aAA0B,uCAAAC,MAAc,iBAAS;AAAA,MAC3E,GAAG;AAAA,MACH,eAAW,YAAAC,SAAK,sBAAsB,SAAS;AAAA,MAC/C,eAAe;AAAA,MACf,QAAQ;AAAA,MACR,IAAI;AAAA,MACJ,iBAAiB;AAAA,MACjB,OAAO;AAAA,MACP,UAAU,CAAC,MAAM,YAAyB,uCAAAF,KAAK,gBAAAG,SAAU;AAAA,QACvD,WAAW,OAAO,iCAAiC;AAAA,QACnD;AAAA,MACF,CAAC,CAAC;AAAA,IACJ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACO,IAAML,eAAU,2BAAW,kBAAkB;AACpD,IAAO,kBAAQA;",
4
+ "sourcesContent": ["import * as Ariakit from '@ariakit/react';\nimport clsx from 'clsx';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Children, useContext, forwardRef, cloneElement } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\nimport Shortcut from '../shortcut';\nimport { positionToPlacement } from '../popover/utils';\nimport { TooltipInternalContext } from './context';\n\n/**\n * Time over anchor to wait before showing tooltip\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const TOOLTIP_DELAY = 700;\nconst CONTEXT_VALUE = {\n isNestedInTooltip: true\n};\nfunction UnforwardedTooltip(props, ref) {\n const {\n children,\n className,\n delay = TOOLTIP_DELAY,\n hideOnClick = true,\n placement,\n position,\n shortcut,\n text,\n ...restProps\n } = props;\n const {\n isNestedInTooltip\n } = useContext(TooltipInternalContext);\n const baseId = useInstanceId(Tooltip, 'tooltip');\n const describedById = text || shortcut ? baseId : undefined;\n const isOnlyChild = Children.count(children) === 1;\n // console error if more than one child element is added\n if (!isOnlyChild) {\n if ('development' === process.env.NODE_ENV) {\n // eslint-disable-next-line no-console\n console.error('wp-components.Tooltip should be called with only a single child element.');\n }\n }\n\n // Compute tooltip's placement:\n // - give priority to `placement` prop, if defined\n // - otherwise, compute it from the legacy `position` prop (if defined)\n // - finally, fallback to the default placement: 'top'\n let computedPlacement;\n if (placement !== undefined) {\n computedPlacement = placement;\n } else if (position !== undefined) {\n computedPlacement = positionToPlacement(position);\n deprecated('`position` prop in wp.components.tooltip', {\n since: '6.4',\n alternative: '`placement` prop'\n });\n }\n computedPlacement = computedPlacement || 'top';\n const tooltipStore = Ariakit.useTooltipStore({\n placement: computedPlacement,\n showTimeout: delay\n });\n const mounted = Ariakit.useStoreState(tooltipStore, 'mounted');\n if (isNestedInTooltip) {\n return isOnlyChild ? /*#__PURE__*/_jsx(Ariakit.Role, {\n ...restProps,\n render: children\n }) : children;\n }\n\n // TODO: this is a temporary workaround to minimize the effects of the\n // Ariakit upgrade. Ariakit doesn't pass the `aria-describedby` prop to\n // the tooltip anchor anymore since 0.4.0, so we need to add it manually.\n // The `aria-describedby` attribute is added only if the anchor doesn't have\n // one already, and if the tooltip text is not the same as the anchor's\n // `aria-label`\n // See: https://github.com/WordPress/gutenberg/pull/64066\n // See: https://github.com/WordPress/gutenberg/pull/65989\n function addDescribedById(element) {\n return describedById && mounted && element.props['aria-describedby'] === undefined && element.props['aria-label'] !== text ? cloneElement(element, {\n 'aria-describedby': describedById\n }) : element;\n }\n return /*#__PURE__*/_jsxs(TooltipInternalContext.Provider, {\n value: CONTEXT_VALUE,\n children: [/*#__PURE__*/_jsx(Ariakit.TooltipAnchor, {\n onClick: hideOnClick ? tooltipStore.hide : undefined,\n store: tooltipStore,\n render: isOnlyChild ? addDescribedById(children) : undefined,\n ref: ref,\n children: isOnlyChild ? undefined : children\n }), isOnlyChild && (text || shortcut) && /*#__PURE__*/_jsxs(Ariakit.Tooltip, {\n ...restProps,\n className: clsx('components-tooltip', className),\n unmountOnHide: true,\n gutter: 4,\n id: describedById,\n overflowPadding: 0.5,\n store: tooltipStore,\n children: [text, shortcut && /*#__PURE__*/_jsx(Shortcut, {\n className: text ? 'components-tooltip__shortcut' : '',\n shortcut: shortcut\n })]\n })]\n });\n}\nexport const Tooltip = forwardRef(UnforwardedTooltip);\nexport default Tooltip;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,iBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA,cAAyB;AACzB,kBAAiB;AACjB,qBAA8B;AAC9B,qBAA+D;AAC/D,wBAAuB;AACvB,sBAAqB;AACrB,mBAAoC;AACpC,qBAAuC;AAKvC,yBAA2C;AACpC,IAAM,gBAAgB;AAC7B,IAAM,gBAAgB;AAAA,EACpB,mBAAmB;AACrB;AACA,SAAS,mBAAmB,OAAO,KAAK;AACtC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM;AAAA,IACJ;AAAA,EACF,QAAI,2BAAW,qCAAsB;AACrC,QAAM,aAAS,8BAAcA,UAAS,SAAS;AAC/C,QAAM,gBAAgB,QAAQ,WAAW,SAAS;AAClD,QAAM,cAAc,wBAAS,MAAM,QAAQ,MAAM;AAEjD,MAAI,CAAC,aAAa;AAChB,QAAI,kBAAkB,QAAQ,IAAI,UAAU;AAE1C,cAAQ,MAAM,0EAA0E;AAAA,IAC1F;AAAA,EACF;AAMA,MAAI;AACJ,MAAI,cAAc,QAAW;AAC3B,wBAAoB;AAAA,EACtB,WAAW,aAAa,QAAW;AACjC,4BAAoB,kCAAoB,QAAQ;AAChD,0BAAAC,SAAW,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