@wordpress/components 35.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 (355) hide show
  1. package/CHANGELOG.md +20 -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/color-palette/index.cjs +3 -0
  7. package/build/color-palette/index.cjs.map +2 -2
  8. package/build/custom-gradient-picker/gradient-bar/index.cjs.map +2 -2
  9. package/build/draggable/index.cjs +1 -1
  10. package/build/draggable/index.cjs.map +2 -2
  11. package/build/navigable-container/container.cjs +15 -21
  12. package/build/navigable-container/container.cjs.map +2 -2
  13. package/build/unit-control/utils.cjs +33 -35
  14. package/build/unit-control/utils.cjs.map +2 -2
  15. package/build-module/alignment-matrix-control/cell.mjs +1 -1
  16. package/build-module/alignment-matrix-control/cell.mjs.map +2 -2
  17. package/build-module/alignment-matrix-control/index.mjs +1 -1
  18. package/build-module/alignment-matrix-control/index.mjs.map +2 -2
  19. package/build-module/color-palette/index.mjs +3 -0
  20. package/build-module/color-palette/index.mjs.map +2 -2
  21. package/build-module/custom-gradient-picker/gradient-bar/index.mjs.map +2 -2
  22. package/build-module/draggable/index.mjs +1 -1
  23. package/build-module/draggable/index.mjs.map +2 -2
  24. package/build-module/navigable-container/container.mjs +16 -22
  25. package/build-module/navigable-container/container.mjs.map +2 -2
  26. package/build-module/unit-control/utils.mjs +33 -35
  27. package/build-module/unit-control/utils.mjs.map +2 -2
  28. package/build-style/style-rtl.css +41 -10
  29. package/build-style/style.css +41 -10
  30. package/build-types/card/context.d.ts +3 -0
  31. package/build-types/card/context.d.ts.map +1 -0
  32. package/build-types/color-palette/index.d.ts.map +1 -1
  33. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
  34. package/build-types/date-time/date/index.d.ts +23 -0
  35. package/build-types/date-time/date/index.d.ts.map +1 -0
  36. package/build-types/date-time/date/styles.d.ts +45 -0
  37. package/build-types/date-time/date/styles.d.ts.map +1 -0
  38. package/build-types/date-time/date/test/index.d.ts +2 -0
  39. package/build-types/date-time/date/test/index.d.ts.map +1 -0
  40. package/build-types/date-time/date/test/use-lilius.d.ts +2 -0
  41. package/build-types/date-time/date/test/use-lilius.d.ts.map +1 -0
  42. package/build-types/date-time/date/use-lilius/index.d.ts +169 -0
  43. package/build-types/date-time/date/use-lilius/index.d.ts.map +1 -0
  44. package/build-types/date-time/time/index.d.ts +27 -0
  45. package/build-types/date-time/time/index.d.ts.map +1 -0
  46. package/build-types/date-time/time/styles.d.ts +93 -0
  47. package/build-types/date-time/time/styles.d.ts.map +1 -0
  48. package/build-types/date-time/time/test/index.d.ts +2 -0
  49. package/build-types/date-time/time/test/index.d.ts.map +1 -0
  50. package/build-types/date-time/time/time-input/index.d.ts +4 -0
  51. package/build-types/date-time/time/time-input/index.d.ts.map +1 -0
  52. package/build-types/date-time/time/time-input/test/index.d.ts +2 -0
  53. package/build-types/date-time/time/time-input/test/index.d.ts.map +1 -0
  54. package/build-types/date-time/time/timezone.d.ts +7 -0
  55. package/build-types/date-time/time/timezone.d.ts.map +1 -0
  56. package/build-types/navigable-container/container.d.ts.map +1 -1
  57. package/build-types/navigation/back-button/index.d.ts +7 -0
  58. package/build-types/navigation/back-button/index.d.ts.map +1 -0
  59. package/build-types/navigation/constants.d.ts +3 -0
  60. package/build-types/navigation/constants.d.ts.map +1 -0
  61. package/build-types/navigation/context.d.ts +4 -0
  62. package/build-types/navigation/context.d.ts.map +1 -0
  63. package/build-types/navigation/group/context.d.ts +7 -0
  64. package/build-types/navigation/group/context.d.ts.map +1 -0
  65. package/build-types/navigation/group/index.d.ts +7 -0
  66. package/build-types/navigation/group/index.d.ts.map +1 -0
  67. package/build-types/navigation/index.d.ts +46 -0
  68. package/build-types/navigation/index.d.ts.map +1 -0
  69. package/build-types/navigation/item/base-content.d.ts +3 -0
  70. package/build-types/navigation/item/base-content.d.ts.map +1 -0
  71. package/build-types/navigation/item/base.d.ts +3 -0
  72. package/build-types/navigation/item/base.d.ts.map +1 -0
  73. package/build-types/navigation/item/index.d.ts +7 -0
  74. package/build-types/navigation/item/index.d.ts.map +1 -0
  75. package/build-types/navigation/item/use-navigation-tree-item.d.ts +3 -0
  76. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -0
  77. package/build-types/navigation/menu/context.d.ts +7 -0
  78. package/build-types/navigation/menu/context.d.ts.map +1 -0
  79. package/build-types/navigation/menu/index.d.ts +7 -0
  80. package/build-types/navigation/menu/index.d.ts.map +1 -0
  81. package/build-types/navigation/menu/menu-title-search.d.ts +3 -0
  82. package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -0
  83. package/build-types/navigation/menu/menu-title.d.ts +3 -0
  84. package/build-types/navigation/menu/menu-title.d.ts.map +1 -0
  85. package/build-types/navigation/menu/search-no-results-found.d.ts +3 -0
  86. package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -0
  87. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +3 -0
  88. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -0
  89. package/build-types/navigation/stories/index.story.d.ts +23 -0
  90. package/build-types/navigation/stories/index.story.d.ts.map +1 -0
  91. package/build-types/navigation/stories/utils/controlled-state.d.ts +7 -0
  92. package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -0
  93. package/build-types/navigation/stories/utils/default.d.ts +10 -0
  94. package/build-types/navigation/stories/utils/default.d.ts.map +1 -0
  95. package/build-types/navigation/stories/utils/group.d.ts +10 -0
  96. package/build-types/navigation/stories/utils/group.d.ts.map +1 -0
  97. package/build-types/navigation/stories/utils/hide-if-empty.d.ts +10 -0
  98. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -0
  99. package/build-types/navigation/stories/utils/more-examples.d.ts +10 -0
  100. package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -0
  101. package/build-types/navigation/stories/utils/search.d.ts +10 -0
  102. package/build-types/navigation/stories/utils/search.d.ts.map +1 -0
  103. package/build-types/navigation/styles/navigation-styles.d.ts +55 -0
  104. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -0
  105. package/build-types/navigation/test/index.d.ts +2 -0
  106. package/build-types/navigation/test/index.d.ts.map +1 -0
  107. package/build-types/navigation/types.d.ts +266 -0
  108. package/build-types/navigation/types.d.ts.map +1 -0
  109. package/build-types/navigation/use-create-navigation-tree.d.ts +15 -0
  110. package/build-types/navigation/use-create-navigation-tree.d.ts.map +1 -0
  111. package/build-types/navigation/use-navigation-tree-nodes.d.ts +10 -0
  112. package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +1 -0
  113. package/build-types/navigation/utils.d.ts +3 -0
  114. package/build-types/navigation/utils.d.ts.map +1 -0
  115. package/build-types/unit-control/utils.d.ts.map +1 -1
  116. package/build-types/validated-form-controls/components/combobox-control.d.ts +2 -2
  117. package/build-types/visually-hidden/test/index.d.ts +2 -0
  118. package/build-types/visually-hidden/test/index.d.ts.map +1 -0
  119. package/package.json +34 -32
  120. package/src/card/card/README.md +4 -4
  121. package/src/checkbox-control/README.md +1 -1
  122. package/src/clipboard-button/README.md +4 -4
  123. package/src/color-palette/index.tsx +5 -0
  124. package/src/color-palette/test/index.tsx +30 -0
  125. package/src/combobox-control/README.md +1 -1
  126. package/src/confirm-dialog/README.md +1 -1
  127. package/src/custom-gradient-picker/gradient-bar/index.tsx +1 -1
  128. package/src/flex/flex/README.md +1 -1
  129. package/src/navigable-container/container.tsx +22 -30
  130. package/src/popover/README.md +1 -1
  131. package/src/scrollable/README.md +1 -1
  132. package/src/tooltip/style.scss +1 -1
  133. package/src/unit-control/utils.ts +33 -52
  134. package/build/mobile/image/constants.cjs +0 -34
  135. package/build/mobile/image/constants.cjs.map +0 -7
  136. package/build-module/mobile/image/constants.mjs +0 -9
  137. package/build-module/mobile/image/constants.mjs.map +0 -7
  138. package/src/autocomplete/autocompleter-ui.native.js +0 -211
  139. package/src/autocomplete/background-view.android.js +0 -25
  140. package/src/autocomplete/background-view.ios.js +0 -23
  141. package/src/autocomplete/style.android.scss +0 -7
  142. package/src/autocomplete/style.native.scss +0 -74
  143. package/src/base-control/index.native.js +0 -14
  144. package/src/button/index.native.js +0 -236
  145. package/src/button/style.native.scss +0 -9
  146. package/src/color-control/index.native.js +0 -24
  147. package/src/color-indicator/index.native.js +0 -80
  148. package/src/color-indicator/style.native.scss +0 -51
  149. package/src/color-palette/index.native.js +0 -360
  150. package/src/color-palette/style.native.scss +0 -49
  151. package/src/color-picker/hsv-color-picker.native.js +0 -88
  152. package/src/color-picker/hue-picker.native.js +0 -198
  153. package/src/color-picker/index.native.js +0 -215
  154. package/src/color-picker/saturation-picker.native.js +0 -167
  155. package/src/color-picker/style.native.scss +0 -87
  156. package/src/custom-gradient-picker/index.native.js +0 -110
  157. package/src/custom-gradient-picker/style.native.scss +0 -3
  158. package/src/dashicon/index.native.js +0 -18
  159. package/src/disabled/index.native.js +0 -10
  160. package/src/draggable/index.native.js +0 -234
  161. package/src/draggable/style.native.scss +0 -3
  162. package/src/draggable/test/index.native.js +0 -138
  163. package/src/dropdown/index.native.js +0 -59
  164. package/src/dropdown-menu/index.native.js +0 -152
  165. package/src/external-link/index.native.js +0 -25
  166. package/src/focal-point-picker/focal-point.native.js +0 -30
  167. package/src/focal-point-picker/index.native.js +0 -281
  168. package/src/focal-point-picker/tooltip/index.native.js +0 -144
  169. package/src/focal-point-picker/tooltip/style.native.scss +0 -42
  170. package/src/font-size-picker/index.native.js +0 -190
  171. package/src/font-size-picker/style.native.scss +0 -6
  172. package/src/footer-message-control/index.native.js +0 -14
  173. package/src/higher-order/with-focus-outside/index.native.js +0 -38
  174. package/src/index.native.js +0 -134
  175. package/src/keyboard-shortcuts/index.native.js +0 -2
  176. package/src/mobile/README.md +0 -3
  177. package/src/mobile/autocompletion-items.native.js +0 -11
  178. package/src/mobile/badge/README.md +0 -31
  179. package/src/mobile/badge/index.native.js +0 -27
  180. package/src/mobile/badge/style.scss +0 -18
  181. package/src/mobile/bottom-sheet/borderStyles.android.scss +0 -8
  182. package/src/mobile/bottom-sheet/borderStyles.ios.scss +0 -9
  183. package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +0 -40
  184. package/src/mobile/bottom-sheet/bottom-sheet-navigation/README.md +0 -101
  185. package/src/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js +0 -16
  186. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +0 -193
  187. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +0 -146
  188. package/src/mobile/bottom-sheet/bottom-sheet-navigation/styles.native.scss +0 -11
  189. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +0 -197
  190. package/src/mobile/bottom-sheet/button.native.js +0 -19
  191. package/src/mobile/bottom-sheet/cell.native.js +0 -464
  192. package/src/mobile/bottom-sheet/cellStyles.android.scss +0 -15
  193. package/src/mobile/bottom-sheet/cellStyles.ios.scss +0 -19
  194. package/src/mobile/bottom-sheet/chevron-back.native.js +0 -18
  195. package/src/mobile/bottom-sheet/color-cell.native.js +0 -35
  196. package/src/mobile/bottom-sheet/cycle-picker-cell.native.js +0 -31
  197. package/src/mobile/bottom-sheet/footer-message-cell.native.js +0 -23
  198. package/src/mobile/bottom-sheet/footer-message-link/README.md +0 -37
  199. package/src/mobile/bottom-sheet/footer-message-link/footer-message-link.native.js +0 -26
  200. package/src/mobile/bottom-sheet/footer-message-link/styles.native.scss +0 -7
  201. package/src/mobile/bottom-sheet/index.native.js +0 -646
  202. package/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -125
  203. package/src/mobile/bottom-sheet/link-cell.native.js +0 -35
  204. package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +0 -92
  205. package/src/mobile/bottom-sheet/link-suggestion-styles.native.scss +0 -27
  206. package/src/mobile/bottom-sheet/lock-icon/index.native.js +0 -19
  207. package/src/mobile/bottom-sheet/lock-icon/styles.native.scss +0 -8
  208. package/src/mobile/bottom-sheet/nav-bar/README.md +0 -63
  209. package/src/mobile/bottom-sheet/nav-bar/action-button.native.js +0 -30
  210. package/src/mobile/bottom-sheet/nav-bar/apply-button.native.js +0 -53
  211. package/src/mobile/bottom-sheet/nav-bar/back-button.native.js +0 -94
  212. package/src/mobile/bottom-sheet/nav-bar/heading.native.js +0 -33
  213. package/src/mobile/bottom-sheet/nav-bar/index.native.js +0 -23
  214. package/src/mobile/bottom-sheet/nav-bar/styles.native.scss +0 -69
  215. package/src/mobile/bottom-sheet/picker-cell.native.js +0 -40
  216. package/src/mobile/bottom-sheet/radio-cell.native.js +0 -39
  217. package/src/mobile/bottom-sheet/range-cell.native.js +0 -274
  218. package/src/mobile/bottom-sheet/range-cell.native.scss +0 -40
  219. package/src/mobile/bottom-sheet/range-text-input.native.js +0 -248
  220. package/src/mobile/bottom-sheet/ripple.native.js +0 -83
  221. package/src/mobile/bottom-sheet/ripple.native.scss +0 -11
  222. package/src/mobile/bottom-sheet/stepper-cell/index.native.js +0 -264
  223. package/src/mobile/bottom-sheet/stepper-cell/stepper.android.js +0 -78
  224. package/src/mobile/bottom-sheet/stepper-cell/stepper.ios.js +0 -64
  225. package/src/mobile/bottom-sheet/stepper-cell/style.native.scss +0 -89
  226. package/src/mobile/bottom-sheet/styles.native.scss +0 -333
  227. package/src/mobile/bottom-sheet/sub-sheet/README.md +0 -90
  228. package/src/mobile/bottom-sheet/sub-sheet/index.native.js +0 -49
  229. package/src/mobile/bottom-sheet/switch-cell.native.js +0 -75
  230. package/src/mobile/bottom-sheet/test/index.native.js +0 -24
  231. package/src/mobile/bottom-sheet/test/range-cell.native.js +0 -73
  232. package/src/mobile/bottom-sheet-select-control/README.md +0 -97
  233. package/src/mobile/bottom-sheet-select-control/index.native.js +0 -124
  234. package/src/mobile/bottom-sheet-select-control/style.native.scss +0 -3
  235. package/src/mobile/bottom-sheet-text-control/README.md +0 -98
  236. package/src/mobile/bottom-sheet-text-control/index.native.js +0 -104
  237. package/src/mobile/bottom-sheet-text-control/styles.scss +0 -25
  238. package/src/mobile/clipboard/index.native.js +0 -18
  239. package/src/mobile/color-settings/gradient-picker-screen.native.js +0 -37
  240. package/src/mobile/color-settings/index.native.js +0 -88
  241. package/src/mobile/color-settings/palette.screen.native.js +0 -232
  242. package/src/mobile/color-settings/picker-screen.native.js +0 -60
  243. package/src/mobile/color-settings/style.native.scss +0 -62
  244. package/src/mobile/color-settings/utils.native.js +0 -36
  245. package/src/mobile/cycle-select-control/README.md +0 -3
  246. package/src/mobile/cycle-select-control/index.native.js +0 -39
  247. package/src/mobile/dashicons/index.native.js +0 -22
  248. package/src/mobile/focal-point-settings-panel/index.native.js +0 -84
  249. package/src/mobile/focal-point-settings-panel/styles.native.scss +0 -3
  250. package/src/mobile/gradient/index.native.js +0 -188
  251. package/src/mobile/gradient/style.native.scss +0 -8
  252. package/src/mobile/gradient/test/index.native.js +0 -114
  253. package/src/mobile/gridicons/index.native.js +0 -39
  254. package/src/mobile/html-text-input/index.native.js +0 -169
  255. package/src/mobile/html-text-input/style.android.scss +0 -8
  256. package/src/mobile/html-text-input/style.ios.scss +0 -10
  257. package/src/mobile/html-text-input/style.scss +0 -45
  258. package/src/mobile/html-text-input/test/__snapshots__/index.native.js.snap +0 -48
  259. package/src/mobile/html-text-input/test/index.native.js +0 -118
  260. package/src/mobile/image/constants.js +0 -1
  261. package/src/mobile/image/icon-customize.native.js +0 -10
  262. package/src/mobile/image/icon-retry.native.js +0 -11
  263. package/src/mobile/image/image-editing-button.native.js +0 -63
  264. package/src/mobile/image/index.native.js +0 -401
  265. package/src/mobile/image/style.native.scss +0 -179
  266. package/src/mobile/image/utils/index.native.js +0 -58
  267. package/src/mobile/keyboard-avoiding-view/index.android.js +0 -8
  268. package/src/mobile/keyboard-avoiding-view/index.ios.js +0 -143
  269. package/src/mobile/keyboard-avoiding-view/styles.native.scss +0 -9
  270. package/src/mobile/keyboard-aware-flat-list/index.android.js +0 -81
  271. package/src/mobile/keyboard-aware-flat-list/index.ios.js +0 -147
  272. package/src/mobile/keyboard-aware-flat-list/shared.native.js +0 -26
  273. package/src/mobile/keyboard-aware-flat-list/styles.native.scss +0 -8
  274. package/src/mobile/keyboard-aware-flat-list/test/use-keyboard-offset.native.js +0 -203
  275. package/src/mobile/keyboard-aware-flat-list/test/use-scroll-to-section.native.js +0 -142
  276. package/src/mobile/keyboard-aware-flat-list/test/use-scroll.native.js +0 -71
  277. package/src/mobile/keyboard-aware-flat-list/test/use-text-input-caret-position.native.js +0 -82
  278. package/src/mobile/keyboard-aware-flat-list/test/use-text-input-offset.native.js +0 -147
  279. package/src/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js +0 -87
  280. package/src/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +0 -41
  281. package/src/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +0 -100
  282. package/src/mobile/keyboard-aware-flat-list/use-scroll.native.js +0 -100
  283. package/src/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js +0 -36
  284. package/src/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js +0 -54
  285. package/src/mobile/layout-animation/index.native.js +0 -16
  286. package/src/mobile/link-picker/index.native.js +0 -160
  287. package/src/mobile/link-picker/link-picker-results.native.js +0 -129
  288. package/src/mobile/link-picker/link-picker-screen.native.js +0 -60
  289. package/src/mobile/link-picker/styles.native.scss +0 -45
  290. package/src/mobile/link-picker/test/performance/index.native.js +0 -35
  291. package/src/mobile/link-settings/index.native.js +0 -332
  292. package/src/mobile/link-settings/link-rel.native.js +0 -10
  293. package/src/mobile/link-settings/link-settings-navigation.native.js +0 -50
  294. package/src/mobile/link-settings/link-settings-screen.native.js +0 -44
  295. package/src/mobile/link-settings/style.native.scss +0 -4
  296. package/src/mobile/link-settings/test/edit.native.js +0 -325
  297. package/src/mobile/link-settings/test/link-settings-navigation.native.js +0 -94
  298. package/src/mobile/media-edit/index.native.js +0 -125
  299. package/src/mobile/picker/index.android.js +0 -104
  300. package/src/mobile/picker/index.ios.js +0 -96
  301. package/src/mobile/picker/styles.native.scss +0 -29
  302. package/src/mobile/segmented-control/index.native.js +0 -186
  303. package/src/mobile/segmented-control/style.native.scss +0 -99
  304. package/src/mobile/utils/alignments.native.js +0 -78
  305. package/src/mobile/utils/get-px-from-css-unit.native.js +0 -329
  306. package/src/mobile/utils/index.native.js +0 -12
  307. package/src/mobile/utils/test/get-px-from-css-unit.native.js +0 -172
  308. package/src/mobile/utils/test/index.native.js +0 -134
  309. package/src/mobile/utils/use-is-floating-keyboard.native.js +0 -31
  310. package/src/mobile/utils/use-unit-converter-to-mobile.native.js +0 -90
  311. package/src/notice/index.native.js +0 -123
  312. package/src/notice/list.native.js +0 -55
  313. package/src/notice/style.native.scss +0 -60
  314. package/src/panel/actions.native.js +0 -46
  315. package/src/panel/actions.native.scss +0 -12
  316. package/src/panel/body.native.js +0 -29
  317. package/src/panel/body.native.scss +0 -11
  318. package/src/panel/bottom-separator-cover.native.js +0 -27
  319. package/src/panel/bottom-separator-cover.native.scss +0 -9
  320. package/src/private-apis.native.js +0 -13
  321. package/src/query-controls/index.native.js +0 -103
  322. package/src/radio-control/index.native.js +0 -24
  323. package/src/range-control/index.native.js +0 -73
  324. package/src/resizable-box/index.native.js +0 -32
  325. package/src/resizable-box/style.native.scss +0 -14
  326. package/src/sandbox/index.native.js +0 -392
  327. package/src/sandbox/style.native.scss +0 -7
  328. package/src/search-control/index.native.js +0 -274
  329. package/src/search-control/platform-style.android.scss +0 -57
  330. package/src/search-control/platform-style.ios.scss +0 -43
  331. package/src/search-control/style.native.scss +0 -63
  332. package/src/select-control/index.native.js +0 -41
  333. package/src/slot-fill/index.native.js +0 -25
  334. package/src/spinner/index.native.js +0 -22
  335. package/src/spinner/style.native.scss +0 -4
  336. package/src/style-provider/index.native.js +0 -3
  337. package/src/text/index.native.js +0 -13
  338. package/src/text/styles/emotion-css.native.js +0 -6
  339. package/src/text/styles/font-family.native.js +0 -1
  340. package/src/text/styles/text-mixins.native.js +0 -163
  341. package/src/text-control/index.native.js +0 -41
  342. package/src/textarea-control/index.native.js +0 -26
  343. package/src/toggle-control/index.native.js +0 -31
  344. package/src/toolbar/toolbar/style.native.scss +0 -11
  345. package/src/toolbar/toolbar/toolbar-container.native.js +0 -8
  346. package/src/toolbar/toolbar-button/toolbar-button-container.native.js +0 -8
  347. package/src/toolbar/toolbar-group/style.native.scss +0 -10
  348. package/src/toolbar/toolbar-group/toolbar-group-collapsed.native.js +0 -36
  349. package/src/toolbar/toolbar-group/toolbar-group-container.native.js +0 -26
  350. package/src/toolbar/toolbar-item/index.native.js +0 -17
  351. package/src/tooltip/index.native.js +0 -292
  352. package/src/tooltip/style.native.scss +0 -39
  353. package/src/tooltip/test/index.native.js +0 -98
  354. package/src/unit-control/index.native.js +0 -202
  355. package/src/unit-control/style.native.scss +0 -19
package/CHANGELOG.md CHANGED
@@ -2,12 +2,31 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- ## 35.0.0 (2026-06-04)
5
+ ## 35.0.1 (2026-06-16)
6
+
7
+ ## 35.0.0 (2026-06-10)
6
8
 
7
9
  ### Breaking Changes
8
10
 
9
11
  - Revert React back to v18 [#78940](https://github.com/WordPress/gutenberg/pull/78940).
10
12
 
13
+ ### Documentation
14
+
15
+ - Fix documentation typos and grammar ([#78686](https://github.com/WordPress/gutenberg/pull/78686)).
16
+
17
+ ### Enhancements
18
+
19
+ - `Tooltip`: Use `--wpds-border-radius-md` for portaled popup surfaces, aligning with menus and popovers ([#78983](https://github.com/WordPress/gutenberg/pull/78983)).
20
+
21
+ ### Bug Fixes
22
+
23
+ - `ColorPalette`: Avoid rendering an empty palette when custom colors are disabled and no color presets are available ([#72402](https://github.com/WordPress/gutenberg/pull/72402)).
24
+
25
+ ### Internal
26
+
27
+ - `UnitControl`: Remove dead native code branches now that `Platform.OS` is always `'web'` following the React Native removal ([#79031](https://github.com/WordPress/gutenberg/pull/79031)).
28
+ - Dependency updates ([#77954](https://github.com/WordPress/gutenberg/pull/77954)).
29
+
11
30
  ## 34.0.0 (2026-05-27)
12
31
 
13
32
  ### Breaking Changes
@@ -118,7 +118,7 @@ function registerStyle(hash, css) {
118
118
 
119
119
  // packages/components/src/alignment-matrix-control/style.module.scss
120
120
  if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
121
- registerStyle("9251e317a9", "._02e2af5803bf5bda__grid-container{aspect-ratio:1;border:1px solid #0000;border-radius:4px;box-sizing:border-box;cursor:var(--wpds-cursor-control,pointer);direction:ltr;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);outline:none}.c421f8ed08c23077__grid-row{box-sizing:border-box;display:grid;grid-column:1/-1;grid-template-columns:repeat(3,1fr)}._3af769f755097fdb__cell{align-items:center;appearance:none;border:none;box-sizing:border-box;display:flex;justify-content:center;margin:0;outline:none;padding:0;position:relative}._37ef12d4fb6d6131__point{aspect-ratio:1;border:3px solid;box-sizing:border-box;color:var(--wp-components-color-gray-400,#ccc);contain:strict;display:block;margin:auto;width:6px}._3af769f755097fdb__cell[data-active-item] ._37ef12d4fb6d6131__point{color:var(--wp-components-color-foreground,#1e1e1e);transform:scale(1.6666666667)}._3af769f755097fdb__cell:not([data-active-item]):hover ._37ef12d4fb6d6131__point{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}._3af769f755097fdb__cell[data-focus-visible] ._37ef12d4fb6d6131__point{outline:1px solid var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));outline-offset:1px}@media not (prefers-reduced-motion){._37ef12d4fb6d6131__point{transition-duration:.12s;transition-property:color,transform;transition-timing-function:linear}}");
121
+ registerStyle("0cdd5d4fc6", "._02e2af5803bf5bda__grid-container{aspect-ratio:1;border:1px solid transparent;border-radius:4px;box-sizing:border-box;cursor:var(--wpds-cursor-control,pointer);direction:ltr;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);outline:none}.c421f8ed08c23077__grid-row{box-sizing:border-box;display:grid;grid-column:1/-1;grid-template-columns:repeat(3,1fr)}._3af769f755097fdb__cell{align-items:center;appearance:none;border:none;box-sizing:border-box;display:flex;justify-content:center;margin:0;outline:none;padding:0;position:relative}._37ef12d4fb6d6131__point{aspect-ratio:1;border:3px solid;box-sizing:border-box;color:var(--wp-components-color-gray-400,#ccc);contain:strict;display:block;margin:auto;width:6px}._3af769f755097fdb__cell[data-active-item] ._37ef12d4fb6d6131__point{color:var(--wp-components-color-foreground,#1e1e1e);transform:scale(1.6666666667)}._3af769f755097fdb__cell:not([data-active-item]):hover ._37ef12d4fb6d6131__point{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}._3af769f755097fdb__cell[data-focus-visible] ._37ef12d4fb6d6131__point{outline:1px solid var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));outline-offset:1px}@media not (prefers-reduced-motion){._37ef12d4fb6d6131__point{transition-duration:.12s;transition-property:color,transform;transition-timing-function:linear}}");
122
122
  }
123
123
  var style_module_default = { "grid-container": "_02e2af5803bf5bda__grid-container", "grid-row": "c421f8ed08c23077__grid-row", "cell": "_3af769f755097fdb__cell", "point": "_37ef12d4fb6d6131__point" };
124
124
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/alignment-matrix-control/cell.tsx", "../../../style-runtime/src/index.ts", "../../src/alignment-matrix-control/style.module.scss"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { Composite } from '../composite';\nimport Tooltip from '../tooltip';\nimport { VisuallyHidden } from '../visually-hidden';\n\n/**\n * Internal dependencies\n */\nimport { ALIGNMENT_LABEL } from './utils';\nimport styles from './style.module.scss';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport default function Cell({\n id,\n value,\n ...props\n}) {\n return /*#__PURE__*/_jsx(Tooltip, {\n text: ALIGNMENT_LABEL[value],\n children: /*#__PURE__*/_jsxs(Composite.Item, {\n id: id,\n render: /*#__PURE__*/_jsx(\"span\", {\n ...props,\n className: clsx(styles.cell, props.className),\n role: \"gridcell\"\n }),\n children: [/*#__PURE__*/_jsx(VisuallyHidden, {\n children: value\n }), /*#__PURE__*/_jsx(\"span\", {\n className: styles.point,\n role: \"presentation\"\n })]\n })\n });\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"9251e317a9\", \"._02e2af5803bf5bda__grid-container{aspect-ratio:1;border:1px solid #0000;border-radius:4px;box-sizing:border-box;cursor:var(--wpds-cursor-control,pointer);direction:ltr;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);outline:none}.c421f8ed08c23077__grid-row{box-sizing:border-box;display:grid;grid-column:1/-1;grid-template-columns:repeat(3,1fr)}._3af769f755097fdb__cell{align-items:center;appearance:none;border:none;box-sizing:border-box;display:flex;justify-content:center;margin:0;outline:none;padding:0;position:relative}._37ef12d4fb6d6131__point{aspect-ratio:1;border:3px solid;box-sizing:border-box;color:var(--wp-components-color-gray-400,#ccc);contain:strict;display:block;margin:auto;width:6px}._3af769f755097fdb__cell[data-active-item] ._37ef12d4fb6d6131__point{color:var(--wp-components-color-foreground,#1e1e1e);transform:scale(1.6666666667)}._3af769f755097fdb__cell:not([data-active-item]):hover ._37ef12d4fb6d6131__point{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}._3af769f755097fdb__cell[data-focus-visible] ._37ef12d4fb6d6131__point{outline:1px solid var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));outline-offset:1px}@media not (prefers-reduced-motion){._37ef12d4fb6d6131__point{transition-duration:.12s;transition-property:color,transform;transition-timing-function:linear}}\");\n}\nexport default {\"grid-container\":\"_02e2af5803bf5bda__grid-container\",\"grid-row\":\"c421f8ed08c23077__grid-row\",\"cell\":\"_3af769f755097fdb__cell\",\"point\":\"_37ef12d4fb6d6131__point\"};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,uBAA0B;AAC1B,qBAAoB;AACpB,6BAA+B;AAK/B,mBAAgC;;;ACfhC,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,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SAAS,GAAG;AACd,cAAQ,UAAU,OAAO,cAAc;AACvC;AAAA,IACF;AACA,YAAQ,UAAU,IAAI,gBAAgB,QAAQ,CAAC;AAAA,EACjD;AACF;AAaO,SAAS,cAAc,MAAM,KAAK;AACvC,QAAM,UAAU,WAAW;AAC3B,UAAQ,OAAO,IAAI,MAAM,GAAG;AAC5B,aAAW,kBAAkB,QAAQ,UAAU,KAAK,GAAG;AACrD,gBAAY,gBAAgB,MAAM,GAAG;AAAA,EACvC;AACF;;;AChIA,IAAI,OAAO,YAAY,eAAe,QAAQ,IAAI,aAAa,QAAQ;AACtE,gBAAc,cAAc,w2CAAw2C;AACr4C;AACA,IAAO,uBAAQ,EAAC,kBAAiB,qCAAoC,YAAW,8BAA6B,QAAO,2BAA0B,SAAQ,2BAA0B;;;AFahL,yBAA2C;AAC5B,SAAR,KAAsB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG;AACD,SAAoB,uCAAAA,KAAK,eAAAC,SAAS;AAAA,IAChC,MAAM,6BAAgB,KAAK;AAAA,IAC3B,UAAuB,uCAAAC,MAAM,2BAAU,MAAM;AAAA,MAC3C;AAAA,MACA,QAAqB,uCAAAF,KAAK,QAAQ;AAAA,QAChC,GAAG;AAAA,QACH,eAAW,YAAAG,SAAK,qBAAO,MAAM,MAAM,SAAS;AAAA,QAC5C,MAAM;AAAA,MACR,CAAC;AAAA,MACD,UAAU,CAAc,uCAAAH,KAAK,uCAAgB;AAAA,QAC3C,UAAU;AAAA,MACZ,CAAC,GAAgB,uCAAAA,KAAK,QAAQ;AAAA,QAC5B,WAAW,qBAAO;AAAA,QAClB,MAAM;AAAA,MACR,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA,EACH,CAAC;AACH;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { Composite } from '../composite';\nimport Tooltip from '../tooltip';\nimport { VisuallyHidden } from '../visually-hidden';\n\n/**\n * Internal dependencies\n */\nimport { ALIGNMENT_LABEL } from './utils';\nimport styles from './style.module.scss';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport default function Cell({\n id,\n value,\n ...props\n}) {\n return /*#__PURE__*/_jsx(Tooltip, {\n text: ALIGNMENT_LABEL[value],\n children: /*#__PURE__*/_jsxs(Composite.Item, {\n id: id,\n render: /*#__PURE__*/_jsx(\"span\", {\n ...props,\n className: clsx(styles.cell, props.className),\n role: \"gridcell\"\n }),\n children: [/*#__PURE__*/_jsx(VisuallyHidden, {\n children: value\n }), /*#__PURE__*/_jsx(\"span\", {\n className: styles.point,\n role: \"presentation\"\n })]\n })\n });\n}", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"0cdd5d4fc6\", \"._02e2af5803bf5bda__grid-container{aspect-ratio:1;border:1px solid transparent;border-radius:4px;box-sizing:border-box;cursor:var(--wpds-cursor-control,pointer);direction:ltr;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);outline:none}.c421f8ed08c23077__grid-row{box-sizing:border-box;display:grid;grid-column:1/-1;grid-template-columns:repeat(3,1fr)}._3af769f755097fdb__cell{align-items:center;appearance:none;border:none;box-sizing:border-box;display:flex;justify-content:center;margin:0;outline:none;padding:0;position:relative}._37ef12d4fb6d6131__point{aspect-ratio:1;border:3px solid;box-sizing:border-box;color:var(--wp-components-color-gray-400,#ccc);contain:strict;display:block;margin:auto;width:6px}._3af769f755097fdb__cell[data-active-item] ._37ef12d4fb6d6131__point{color:var(--wp-components-color-foreground,#1e1e1e);transform:scale(1.6666666667)}._3af769f755097fdb__cell:not([data-active-item]):hover ._37ef12d4fb6d6131__point{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}._3af769f755097fdb__cell[data-focus-visible] ._37ef12d4fb6d6131__point{outline:1px solid var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));outline-offset:1px}@media not (prefers-reduced-motion){._37ef12d4fb6d6131__point{transition-duration:.12s;transition-property:color,transform;transition-timing-function:linear}}\");\n}\nexport default {\"grid-container\":\"_02e2af5803bf5bda__grid-container\",\"grid-row\":\"c421f8ed08c23077__grid-row\",\"cell\":\"_3af769f755097fdb__cell\",\"point\":\"_37ef12d4fb6d6131__point\"};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,uBAA0B;AAC1B,qBAAoB;AACpB,6BAA+B;AAK/B,mBAAgC;;;ACfhC,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY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H,CAAC;AACH;",
6
6
  "names": ["_jsx", "Tooltip", "_jsxs", "clsx"]
7
7
  }
@@ -122,7 +122,7 @@ function registerStyle(hash, css) {
122
122
 
123
123
  // packages/components/src/alignment-matrix-control/style.module.scss
124
124
  if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
125
- registerStyle("9251e317a9", "._02e2af5803bf5bda__grid-container{aspect-ratio:1;border:1px solid #0000;border-radius:4px;box-sizing:border-box;cursor:var(--wpds-cursor-control,pointer);direction:ltr;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);outline:none}.c421f8ed08c23077__grid-row{box-sizing:border-box;display:grid;grid-column:1/-1;grid-template-columns:repeat(3,1fr)}._3af769f755097fdb__cell{align-items:center;appearance:none;border:none;box-sizing:border-box;display:flex;justify-content:center;margin:0;outline:none;padding:0;position:relative}._37ef12d4fb6d6131__point{aspect-ratio:1;border:3px solid;box-sizing:border-box;color:var(--wp-components-color-gray-400,#ccc);contain:strict;display:block;margin:auto;width:6px}._3af769f755097fdb__cell[data-active-item] ._37ef12d4fb6d6131__point{color:var(--wp-components-color-foreground,#1e1e1e);transform:scale(1.6666666667)}._3af769f755097fdb__cell:not([data-active-item]):hover ._37ef12d4fb6d6131__point{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}._3af769f755097fdb__cell[data-focus-visible] ._37ef12d4fb6d6131__point{outline:1px solid var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));outline-offset:1px}@media not (prefers-reduced-motion){._37ef12d4fb6d6131__point{transition-duration:.12s;transition-property:color,transform;transition-timing-function:linear}}");
125
+ registerStyle("0cdd5d4fc6", "._02e2af5803bf5bda__grid-container{aspect-ratio:1;border:1px solid transparent;border-radius:4px;box-sizing:border-box;cursor:var(--wpds-cursor-control,pointer);direction:ltr;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);outline:none}.c421f8ed08c23077__grid-row{box-sizing:border-box;display:grid;grid-column:1/-1;grid-template-columns:repeat(3,1fr)}._3af769f755097fdb__cell{align-items:center;appearance:none;border:none;box-sizing:border-box;display:flex;justify-content:center;margin:0;outline:none;padding:0;position:relative}._37ef12d4fb6d6131__point{aspect-ratio:1;border:3px solid;box-sizing:border-box;color:var(--wp-components-color-gray-400,#ccc);contain:strict;display:block;margin:auto;width:6px}._3af769f755097fdb__cell[data-active-item] ._37ef12d4fb6d6131__point{color:var(--wp-components-color-foreground,#1e1e1e);transform:scale(1.6666666667)}._3af769f755097fdb__cell:not([data-active-item]):hover ._37ef12d4fb6d6131__point{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}._3af769f755097fdb__cell[data-focus-visible] ._37ef12d4fb6d6131__point{outline:1px solid var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));outline-offset:1px}@media not (prefers-reduced-motion){._37ef12d4fb6d6131__point{transition-duration:.12s;transition-property:color,transform;transition-timing-function:linear}}");
126
126
  }
127
127
  var style_module_default = { "grid-container": "_02e2af5803bf5bda__grid-container", "grid-row": "c421f8ed08c23077__grid-row", "cell": "_3af769f755097fdb__cell", "point": "_37ef12d4fb6d6131__point" };
128
128
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/alignment-matrix-control/index.tsx", "../../../style-runtime/src/index.ts", "../../src/alignment-matrix-control/style.module.scss"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Cell from './cell';\nimport { Composite } from '../composite';\nimport AlignmentMatrixControlIcon from './icon';\nimport { GRID, getItemId, getItemValue } from './utils';\nimport styles from './style.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction UnforwardedAlignmentMatrixControl({\n className,\n id,\n label = __('Alignment Matrix Control'),\n defaultValue = 'center center',\n value,\n onChange,\n width = 92,\n ...props\n}) {\n const baseId = useInstanceId(UnforwardedAlignmentMatrixControl, 'alignment-matrix-control', id);\n const setActiveId = useCallback(nextActiveId => {\n const nextValue = getItemValue(baseId, nextActiveId);\n if (nextValue) {\n onChange?.(nextValue);\n }\n }, [baseId, onChange]);\n const classes = clsx('component-alignment-matrix-control', styles['grid-container'], className);\n return /*#__PURE__*/_jsx(Composite, {\n defaultActiveId: getItemId(baseId, defaultValue),\n activeId: getItemId(baseId, value),\n setActiveId: setActiveId,\n rtl: isRTL(),\n render: /*#__PURE__*/_jsx(\"div\", {\n ...props,\n className: classes,\n \"aria-label\": label,\n id: baseId,\n role: \"grid\",\n style: {\n width: `${width}px`\n }\n }),\n children: GRID.map((cells, index) => /*#__PURE__*/_jsx(Composite.Row, {\n render: /*#__PURE__*/_jsx(\"div\", {\n className: styles['grid-row'],\n role: \"row\"\n }),\n children: cells.map(cell => /*#__PURE__*/_jsx(Cell, {\n id: getItemId(baseId, cell),\n value: cell\n }, cell))\n }, index))\n });\n}\n\n/**\n * AlignmentMatrixControl components enable adjustments to horizontal and vertical alignments for UI.\n *\n * ```jsx\n * import { AlignmentMatrixControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * \tconst [ alignment, setAlignment ] = useState( 'center center' );\n *\n * \treturn (\n * \t\t<AlignmentMatrixControl\n * \t\t\tvalue={ alignment }\n * \t\t\tonChange={ setAlignment }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport const AlignmentMatrixControl = Object.assign(UnforwardedAlignmentMatrixControl, {\n /**\n * Render an alignment matrix as an icon.\n *\n * ```jsx\n * import { AlignmentMatrixControl } from '@wordpress/components';\n *\n * <Icon icon={<AlignmentMatrixControl.Icon value=\"top left\" />} />\n * ```\n */\n Icon: Object.assign(AlignmentMatrixControlIcon, {\n displayName: 'AlignmentMatrixControl.Icon'\n })\n});\nexport default AlignmentMatrixControl;", "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(\"9251e317a9\", \"._02e2af5803bf5bda__grid-container{aspect-ratio:1;border:1px solid #0000;border-radius:4px;box-sizing:border-box;cursor:var(--wpds-cursor-control,pointer);direction:ltr;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);outline:none}.c421f8ed08c23077__grid-row{box-sizing:border-box;display:grid;grid-column:1/-1;grid-template-columns:repeat(3,1fr)}._3af769f755097fdb__cell{align-items:center;appearance:none;border:none;box-sizing:border-box;display:flex;justify-content:center;margin:0;outline:none;padding:0;position:relative}._37ef12d4fb6d6131__point{aspect-ratio:1;border:3px solid;box-sizing:border-box;color:var(--wp-components-color-gray-400,#ccc);contain:strict;display:block;margin:auto;width:6px}._3af769f755097fdb__cell[data-active-item] ._37ef12d4fb6d6131__point{color:var(--wp-components-color-foreground,#1e1e1e);transform:scale(1.6666666667)}._3af769f755097fdb__cell:not([data-active-item]):hover ._37ef12d4fb6d6131__point{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}._3af769f755097fdb__cell[data-focus-visible] ._37ef12d4fb6d6131__point{outline:1px solid var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));outline-offset:1px}@media not (prefers-reduced-motion){._37ef12d4fb6d6131__point{transition-duration:.12s;transition-property:color,transform;transition-timing-function:linear}}\");\n}\nexport default {\"grid-container\":\"_02e2af5803bf5bda__grid-container\",\"grid-row\":\"c421f8ed08c23077__grid-row\",\"cell\":\"_3af769f755097fdb__cell\",\"point\":\"_37ef12d4fb6d6131__point\"};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAA0B;AAC1B,qBAA8B;AAC9B,qBAA4B;AAK5B,kBAAiB;AACjB,uBAA0B;AAC1B,kBAAuC;AACvC,mBAA8C;;;AClB9C,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa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AAM;AAAA,MACR,CAAC;AAAA,MACD,UAAU,MAAM,IAAI,UAAqB,uCAAAA,KAAK,YAAAC,SAAM;AAAA,QAClD,QAAI,wBAAU,QAAQ,IAAI;AAAA,QAC1B,OAAO;AAAA,MACT,GAAG,IAAI,CAAC;AAAA,IACV,GAAG,KAAK,CAAC;AAAA,EACX,CAAC;AACH;AAqBO,IAAM,yBAAyB,OAAO,OAAO,mCAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUrF,MAAM,OAAO,OAAO,YAAAC,SAA4B;AAAA,IAC9C,aAAa;AAAA,EACf,CAAC;AACH,CAAC;AACD,IAAO,mCAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Cell from './cell';\nimport { Composite } from '../composite';\nimport AlignmentMatrixControlIcon from './icon';\nimport { GRID, getItemId, getItemValue } from './utils';\nimport styles from './style.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction UnforwardedAlignmentMatrixControl({\n className,\n id,\n label = __('Alignment Matrix Control'),\n defaultValue = 'center center',\n value,\n onChange,\n width = 92,\n ...props\n}) {\n const baseId = useInstanceId(UnforwardedAlignmentMatrixControl, 'alignment-matrix-control', id);\n const setActiveId = useCallback(nextActiveId => {\n const nextValue = getItemValue(baseId, nextActiveId);\n if (nextValue) {\n onChange?.(nextValue);\n }\n }, [baseId, onChange]);\n const classes = clsx('component-alignment-matrix-control', styles['grid-container'], className);\n return /*#__PURE__*/_jsx(Composite, {\n defaultActiveId: getItemId(baseId, defaultValue),\n activeId: getItemId(baseId, value),\n setActiveId: setActiveId,\n rtl: isRTL(),\n render: /*#__PURE__*/_jsx(\"div\", {\n ...props,\n className: classes,\n \"aria-label\": label,\n id: baseId,\n role: \"grid\",\n style: {\n width: `${width}px`\n }\n }),\n children: GRID.map((cells, index) => /*#__PURE__*/_jsx(Composite.Row, {\n render: /*#__PURE__*/_jsx(\"div\", {\n className: styles['grid-row'],\n role: \"row\"\n }),\n children: cells.map(cell => /*#__PURE__*/_jsx(Cell, {\n id: getItemId(baseId, cell),\n value: cell\n }, cell))\n }, index))\n });\n}\n\n/**\n * AlignmentMatrixControl components enable adjustments to horizontal and vertical alignments for UI.\n *\n * ```jsx\n * import { AlignmentMatrixControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * \tconst [ alignment, setAlignment ] = useState( 'center center' );\n *\n * \treturn (\n * \t\t<AlignmentMatrixControl\n * \t\t\tvalue={ alignment }\n * \t\t\tonChange={ setAlignment }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport const AlignmentMatrixControl = Object.assign(UnforwardedAlignmentMatrixControl, {\n /**\n * Render an alignment matrix as an icon.\n *\n * ```jsx\n * import { AlignmentMatrixControl } from '@wordpress/components';\n *\n * <Icon icon={<AlignmentMatrixControl.Icon value=\"top left\" />} />\n * ```\n */\n Icon: Object.assign(AlignmentMatrixControlIcon, {\n displayName: 'AlignmentMatrixControl.Icon'\n })\n});\nexport default AlignmentMatrixControl;", "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(\"0cdd5d4fc6\", \"._02e2af5803bf5bda__grid-container{aspect-ratio:1;border:1px solid transparent;border-radius:4px;box-sizing:border-box;cursor:var(--wpds-cursor-control,pointer);direction:ltr;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);outline:none}.c421f8ed08c23077__grid-row{box-sizing:border-box;display:grid;grid-column:1/-1;grid-template-columns:repeat(3,1fr)}._3af769f755097fdb__cell{align-items:center;appearance:none;border:none;box-sizing:border-box;display:flex;justify-content:center;margin:0;outline:none;padding:0;position:relative}._37ef12d4fb6d6131__point{aspect-ratio:1;border:3px solid;box-sizing:border-box;color:var(--wp-components-color-gray-400,#ccc);contain:strict;display:block;margin:auto;width:6px}._3af769f755097fdb__cell[data-active-item] ._37ef12d4fb6d6131__point{color:var(--wp-components-color-foreground,#1e1e1e);transform:scale(1.6666666667)}._3af769f755097fdb__cell:not([data-active-item]):hover ._37ef12d4fb6d6131__point{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}._3af769f755097fdb__cell[data-focus-visible] ._37ef12d4fb6d6131__point{outline:1px solid var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));outline-offset:1px}@media not (prefers-reduced-motion){._37ef12d4fb6d6131__point{transition-duration:.12s;transition-property:color,transform;transition-timing-function:linear}}\");\n}\nexport default {\"grid-container\":\"_02e2af5803bf5b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;AACD,IAAO,mCAAQ;",
6
6
  "names": ["clsx", "_jsx", "Cell", "AlignmentMatrixControlIcon"]
7
7
  }
@@ -214,6 +214,9 @@ function UnforwardedColorPalette(props, forwardedRef) {
214
214
  metaProps,
215
215
  labelProps
216
216
  } = (0, import_circular_option_picker.getComputeCircularOptionPickerCommonProps)(asButtons, loop, ariaLabel, ariaLabelledby);
217
+ if (disableCustomColors && colors.length === 0 && !actions) {
218
+ return null;
219
+ }
217
220
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_v_stack.VStack, {
218
221
  spacing: 3,
219
222
  ref: forwardedRef,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/color-palette/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\n\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Dropdown from '../dropdown';\nimport { ColorPicker } from '../color-picker';\nimport CircularOptionPicker, { getComputeCircularOptionPickerCommonProps } from '../circular-option-picker';\nimport { VStack } from '../v-stack';\nimport { Truncate } from '../truncate';\nimport { ColorHeading } from './styles';\nimport DropdownContentWrapper from '../dropdown/dropdown-content-wrapper';\nimport { extractColorNameFromCurrentValue, isMultiplePaletteArray, normalizeColorValue } from './utils';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nextend([namesPlugin, a11yPlugin]);\nfunction SinglePalette({\n className,\n clearColor,\n colors,\n onChange,\n value,\n selectedSlug,\n ...additionalProps\n}) {\n const colorOptions = useMemo(() => {\n return colors.map(({\n color,\n name,\n slug\n }, index) => {\n const colordColor = colord(color);\n // When a non-empty selectedSlug is provided, selection is decided\n // strictly by slug \u2014 entries without a slug or with a different slug\n // are not selected, even when their color value matches `value`.\n // This correctly handles mixed palettes where some entries have slugs\n // and others don't. Fall back to color value matching otherwise\n // (including when selectedSlug is an empty string).\n const isSelected = selectedSlug ? slug === selectedSlug : value === color;\n return /*#__PURE__*/_jsx(CircularOptionPicker.Option, {\n isSelected: isSelected,\n selectedIconProps: isSelected ? {\n fill: colordColor.contrast() > colordColor.contrast('#000') ? '#fff' : '#000'\n } : {},\n tooltipText: name ||\n // translators: %s: color hex code e.g: \"#f00\".\n sprintf(__('Color code: %s'), color),\n style: {\n backgroundColor: color,\n color\n },\n onClick: isSelected ? clearColor : () => onChange(color, index, slug)\n }, slug ?? `${color}-${index}`);\n });\n }, [colors, value, selectedSlug, onChange, clearColor]);\n return /*#__PURE__*/_jsx(CircularOptionPicker.OptionGroup, {\n className: className,\n options: colorOptions,\n ...additionalProps\n });\n}\nfunction MultiplePalettes({\n className,\n clearColor,\n colors,\n onChange,\n value,\n selectedSlug,\n headingLevel\n}) {\n const instanceId = useInstanceId(MultiplePalettes, 'color-palette');\n if (colors.length === 0) {\n return null;\n }\n return /*#__PURE__*/_jsx(VStack, {\n spacing: 3,\n className: className,\n children: colors.map(({\n name,\n colors: colorPalette\n }, index) => {\n const id = `${instanceId}-${index}`;\n return /*#__PURE__*/_jsxs(VStack, {\n spacing: 2,\n children: [/*#__PURE__*/_jsx(ColorHeading, {\n id: id,\n level: headingLevel,\n children: name\n }), /*#__PURE__*/_jsx(SinglePalette, {\n clearColor: clearColor,\n colors: colorPalette,\n onChange: (newColor, _colorIndex, slug) => onChange(newColor, index, slug),\n value: value,\n selectedSlug: selectedSlug,\n \"aria-labelledby\": id\n })]\n }, index);\n })\n });\n}\nexport function CustomColorPickerDropdown({\n isRenderedInSidebar,\n popoverProps: receivedPopoverProps,\n ...props\n}) {\n const popoverProps = useMemo(() => ({\n shift: true,\n // Disabling resize as it would otherwise cause the popover to show\n // scrollbars while dragging the color picker's handle close to the\n // popover edge.\n resize: false,\n ...(isRenderedInSidebar ? {\n // When in the sidebar: open to the left (stacking),\n // leaving the same gap as the parent popover.\n placement: 'left-start',\n offset: 34\n } : {\n // Default behavior: open below the anchor\n placement: 'bottom',\n offset: 8\n }),\n ...receivedPopoverProps\n }), [isRenderedInSidebar, receivedPopoverProps]);\n return /*#__PURE__*/_jsx(Dropdown, {\n contentClassName: \"components-color-palette__custom-color-dropdown-content\",\n popoverProps: popoverProps,\n ...props\n });\n}\nfunction UnforwardedColorPalette(props, forwardedRef) {\n const {\n asButtons,\n loop,\n clearable = true,\n colors = [],\n disableCustomColors = false,\n enableAlpha = false,\n onChange,\n value,\n selectedSlug,\n __experimentalIsRenderedInSidebar = false,\n headingLevel = 2,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n ...additionalProps\n } = props;\n const [normalizedColorValue, setNormalizedColorValue] = useState(value);\n const clearColor = useCallback(() => onChange(undefined), [onChange]);\n const customColorPaletteCallbackRef = useCallback(node => {\n setNormalizedColorValue(normalizeColorValue(value, node));\n }, [value]);\n const hasMultipleColorOrigins = isMultiplePaletteArray(colors);\n const buttonLabelName = useMemo(() => extractColorNameFromCurrentValue(value, colors, hasMultipleColorOrigins, selectedSlug), [value, colors, hasMultipleColorOrigins, selectedSlug]);\n const renderCustomColorPicker = () => /*#__PURE__*/_jsx(DropdownContentWrapper, {\n paddingSize: \"none\",\n children: /*#__PURE__*/_jsx(ColorPicker, {\n color: normalizedColorValue,\n onChange: color => onChange(color),\n enableAlpha: enableAlpha\n })\n });\n const isHex = value?.startsWith('#');\n\n // Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n const displayValue = value?.replace(/^var\\((.+)\\)$/, '$1');\n const customColorAccessibleLabel = !!displayValue ? sprintf(\n // translators: 1: The name of the color e.g: \"vivid red\". 2: The color's hex code e.g: \"#f00\".\n __('Custom color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), buttonLabelName, displayValue) : __('Custom color picker');\n const paletteCommonProps = {\n clearColor,\n onChange,\n value,\n selectedSlug\n };\n const actions = !!clearable && /*#__PURE__*/_jsx(CircularOptionPicker.ButtonAction, {\n onClick: clearColor,\n accessibleWhenDisabled: true,\n disabled: !value,\n children: __('Clear')\n });\n const {\n metaProps,\n labelProps\n } = getComputeCircularOptionPickerCommonProps(asButtons, loop, ariaLabel, ariaLabelledby);\n return /*#__PURE__*/_jsxs(VStack, {\n spacing: 3,\n ref: forwardedRef,\n ...additionalProps,\n children: [!disableCustomColors && /*#__PURE__*/_jsx(CustomColorPickerDropdown, {\n isRenderedInSidebar: __experimentalIsRenderedInSidebar,\n renderContent: renderCustomColorPicker,\n renderToggle: ({\n isOpen,\n onToggle\n }) => /*#__PURE__*/_jsxs(VStack, {\n className: \"components-color-palette__custom-color-wrapper\",\n spacing: 0,\n children: [/*#__PURE__*/_jsx(\"button\", {\n ref: customColorPaletteCallbackRef,\n className: \"components-color-palette__custom-color-button\",\n \"aria-expanded\": isOpen,\n \"aria-haspopup\": \"true\",\n onClick: onToggle,\n \"aria-label\": customColorAccessibleLabel,\n style: {\n background: value\n },\n type: \"button\"\n }), /*#__PURE__*/_jsxs(VStack, {\n className: \"components-color-palette__custom-color-text-wrapper\",\n spacing: 0.5,\n children: [/*#__PURE__*/_jsx(Truncate, {\n className: \"components-color-palette__custom-color-name\",\n children: value ? buttonLabelName : __('No color selected')\n }), /*#__PURE__*/_jsx(Truncate, {\n className: clsx('components-color-palette__custom-color-value', {\n 'components-color-palette__custom-color-value--is-hex': isHex\n }),\n children: displayValue\n })]\n })]\n })\n }), (colors.length > 0 || actions) && /*#__PURE__*/_jsx(CircularOptionPicker, {\n ...metaProps,\n ...labelProps,\n actions: actions,\n options: hasMultipleColorOrigins ? /*#__PURE__*/_jsx(MultiplePalettes, {\n ...paletteCommonProps,\n headingLevel: headingLevel,\n colors: colors,\n value: value\n }) : /*#__PURE__*/_jsx(SinglePalette, {\n ...paletteCommonProps,\n colors: colors,\n value: value\n })\n })]\n });\n}\n\n/**\n * Allows the user to pick a color from a list of pre-defined color entries.\n *\n * ```jsx\n * import { ColorPalette } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyColorPalette = () => {\n * const [ color, setColor ] = useState ( '#f00' )\n * const colors = [\n * { name: 'red', color: '#f00' },\n * { name: 'white', color: '#fff' },\n * { name: 'blue', color: '#00f' },\n * ];\n * return (\n * <ColorPalette\n * colors={ colors }\n * value={ color }\n * onChange={ ( color ) => setColor( color ) }\n * />\n * );\n * } );\n * ```\n */\nexport const ColorPalette = forwardRef(UnforwardedColorPalette);\nColorPalette.displayName = 'ColorPalette';\nexport default ColorPalette;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oBAA+B;AAC/B,mBAAwB;AACxB,kBAAuB;AACvB,kBAAiB;AAKjB,qBAA8B;AAC9B,kBAA4B;AAC5B,qBAA2D;AAK3D,sBAAqB;AACrB,0BAA4B;AAC5B,oCAAgF;AAChF,qBAAuB;AACvB,sBAAyB;AACzB,oBAA6B;AAC7B,sCAAmC;AACnC,mBAA8F;AAC9F,yBAA2C;AAAA,IAC3C,sBAAO,CAAC,aAAAA,SAAa,YAAAC,OAAU,CAAC;AAChC,SAAS,cAAc;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,mBAAe,wBAAQ,MAAM;AACjC,WAAO,OAAO,IAAI,CAAC;AAAA,MACjB;AAAA,MACA;AAAA,MACA;AAAA,IACF,GAAG,UAAU;AACX,YAAM,kBAAc,sBAAO,KAAK;AAOhC,YAAM,aAAa,eAAe,SAAS,eAAe,UAAU;AACpE,aAAoB,uCAAAC,KAAK,8BAAAC,QAAqB,QAAQ;AAAA,QACpD;AAAA,QACA,mBAAmB,aAAa;AAAA,UAC9B,MAAM,YAAY,SAAS,IAAI,YAAY,SAAS,MA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AA,YACL,YAAY;AAAA,UACd;AAAA,UACA,MAAM;AAAA,QACR,CAAC,GAAgB,uCAAAE,MAAM,uBAAQ;AAAA,UAC7B,WAAW;AAAA,UACX,SAAS;AAAA,UACT,UAAU,CAAc,uCAAAF,KAAK,0BAAU;AAAA,YACrC,WAAW;AAAA,YACX,UAAU,QAAQ,sBAAkB,gBAAG,mBAAmB;AAAA,UAC5D,CAAC,GAAgB,uCAAAA,KAAK,0BAAU;AAAA,YAC9B,eAAW,YAAAK,SAAK,gDAAgD;AAAA,cAC9D,wDAAwD;AAAA,YAC1D,CAAC;AAAA,YACD,UAAU;AAAA,UACZ,CAAC,CAAC;AAAA,QACJ,CAAC,CAAC;AAAA,MACJ,CAAC;AAAA,IACH,CAAC,IAAI,OAAO,SAAS,KAAK,YAAyB,uCAAAL,KAAK,8BAAAC,SAAsB;AAAA,MAC5E,GAAG;AAAA,MACH,GAAG;AAAA,MACH;AAAA,MACA,SAAS,0BAAuC,uCAAAD,KAAK,kBAAkB;AAAA,QACrE,GAAG;AAAA,QACH;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC,IAAiB,uCAAAA,KAAK,eAAe;AAAA,QACpC,GAAG;AAAA,QACH;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AA0BO,IAAM,mBAAe,2BAAW,uBAAuB;AAC9D,aAAa,cAAc;AAC3B,IAAO,wBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\n\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Dropdown from '../dropdown';\nimport { ColorPicker } from '../color-picker';\nimport CircularOptionPicker, { getComputeCircularOptionPickerCommonProps } from '../circular-option-picker';\nimport { VStack } from '../v-stack';\nimport { Truncate } from '../truncate';\nimport { ColorHeading } from './styles';\nimport DropdownContentWrapper from '../dropdown/dropdown-content-wrapper';\nimport { extractColorNameFromCurrentValue, isMultiplePaletteArray, normalizeColorValue } from './utils';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nextend([namesPlugin, a11yPlugin]);\nfunction SinglePalette({\n className,\n clearColor,\n colors,\n onChange,\n value,\n selectedSlug,\n ...additionalProps\n}) {\n const colorOptions = useMemo(() => {\n return colors.map(({\n color,\n name,\n slug\n }, index) => {\n const colordColor = colord(color);\n // When a non-empty selectedSlug is provided, selection is decided\n // strictly by slug \u2014 entries without a slug or with a different slug\n // are not selected, even when their color value matches `value`.\n // This correctly handles mixed palettes where some entries have slugs\n // and others don't. Fall back to color value matching otherwise\n // (including when selectedSlug is an empty string).\n const isSelected = selectedSlug ? slug === selectedSlug : value === color;\n return /*#__PURE__*/_jsx(CircularOptionPicker.Option, {\n isSelected: isSelected,\n selectedIconProps: isSelected ? {\n fill: colordColor.contrast() > colordColor.contrast('#000') ? '#fff' : '#000'\n } : {},\n tooltipText: name ||\n // translators: %s: color hex code e.g: \"#f00\".\n sprintf(__('Color code: %s'), color),\n style: {\n backgroundColor: color,\n color\n },\n onClick: isSelected ? clearColor : () => onChange(color, index, slug)\n }, slug ?? `${color}-${index}`);\n });\n }, [colors, value, selectedSlug, onChange, clearColor]);\n return /*#__PURE__*/_jsx(CircularOptionPicker.OptionGroup, {\n className: className,\n options: colorOptions,\n ...additionalProps\n });\n}\nfunction MultiplePalettes({\n className,\n clearColor,\n colors,\n onChange,\n value,\n selectedSlug,\n headingLevel\n}) {\n const instanceId = useInstanceId(MultiplePalettes, 'color-palette');\n if (colors.length === 0) {\n return null;\n }\n return /*#__PURE__*/_jsx(VStack, {\n spacing: 3,\n className: className,\n children: colors.map(({\n name,\n colors: colorPalette\n }, index) => {\n const id = `${instanceId}-${index}`;\n return /*#__PURE__*/_jsxs(VStack, {\n spacing: 2,\n children: [/*#__PURE__*/_jsx(ColorHeading, {\n id: id,\n level: headingLevel,\n children: name\n }), /*#__PURE__*/_jsx(SinglePalette, {\n clearColor: clearColor,\n colors: colorPalette,\n onChange: (newColor, _colorIndex, slug) => onChange(newColor, index, slug),\n value: value,\n selectedSlug: selectedSlug,\n \"aria-labelledby\": id\n })]\n }, index);\n })\n });\n}\nexport function CustomColorPickerDropdown({\n isRenderedInSidebar,\n popoverProps: receivedPopoverProps,\n ...props\n}) {\n const popoverProps = useMemo(() => ({\n shift: true,\n // Disabling resize as it would otherwise cause the popover to show\n // scrollbars while dragging the color picker's handle close to the\n // popover edge.\n resize: false,\n ...(isRenderedInSidebar ? {\n // When in the sidebar: open to the left (stacking),\n // leaving the same gap as the parent popover.\n placement: 'left-start',\n offset: 34\n } : {\n // Default behavior: open below the anchor\n placement: 'bottom',\n offset: 8\n }),\n ...receivedPopoverProps\n }), [isRenderedInSidebar, receivedPopoverProps]);\n return /*#__PURE__*/_jsx(Dropdown, {\n contentClassName: \"components-color-palette__custom-color-dropdown-content\",\n popoverProps: popoverProps,\n ...props\n });\n}\nfunction UnforwardedColorPalette(props, forwardedRef) {\n const {\n asButtons,\n loop,\n clearable = true,\n colors = [],\n disableCustomColors = false,\n enableAlpha = false,\n onChange,\n value,\n selectedSlug,\n __experimentalIsRenderedInSidebar = false,\n headingLevel = 2,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n ...additionalProps\n } = props;\n const [normalizedColorValue, setNormalizedColorValue] = useState(value);\n const clearColor = useCallback(() => onChange(undefined), [onChange]);\n const customColorPaletteCallbackRef = useCallback(node => {\n setNormalizedColorValue(normalizeColorValue(value, node));\n }, [value]);\n const hasMultipleColorOrigins = isMultiplePaletteArray(colors);\n const buttonLabelName = useMemo(() => extractColorNameFromCurrentValue(value, colors, hasMultipleColorOrigins, selectedSlug), [value, colors, hasMultipleColorOrigins, selectedSlug]);\n const renderCustomColorPicker = () => /*#__PURE__*/_jsx(DropdownContentWrapper, {\n paddingSize: \"none\",\n children: /*#__PURE__*/_jsx(ColorPicker, {\n color: normalizedColorValue,\n onChange: color => onChange(color),\n enableAlpha: enableAlpha\n })\n });\n const isHex = value?.startsWith('#');\n\n // Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n const displayValue = value?.replace(/^var\\((.+)\\)$/, '$1');\n const customColorAccessibleLabel = !!displayValue ? sprintf(\n // translators: 1: The name of the color e.g: \"vivid red\". 2: The color's hex code e.g: \"#f00\".\n __('Custom color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), buttonLabelName, displayValue) : __('Custom color picker');\n const paletteCommonProps = {\n clearColor,\n onChange,\n value,\n selectedSlug\n };\n const actions = !!clearable && /*#__PURE__*/_jsx(CircularOptionPicker.ButtonAction, {\n onClick: clearColor,\n accessibleWhenDisabled: true,\n disabled: !value,\n children: __('Clear')\n });\n const {\n metaProps,\n labelProps\n } = getComputeCircularOptionPickerCommonProps(asButtons, loop, ariaLabel, ariaLabelledby);\n\n // If disableCustomColors is true and colors.length is 0, return null to avoid rendering an empty palette wrapper.\n if (disableCustomColors && colors.length === 0 && !actions) {\n return null;\n }\n return /*#__PURE__*/_jsxs(VStack, {\n spacing: 3,\n ref: forwardedRef,\n ...additionalProps,\n children: [!disableCustomColors && /*#__PURE__*/_jsx(CustomColorPickerDropdown, {\n isRenderedInSidebar: __experimentalIsRenderedInSidebar,\n renderContent: renderCustomColorPicker,\n renderToggle: ({\n isOpen,\n onToggle\n }) => /*#__PURE__*/_jsxs(VStack, {\n className: \"components-color-palette__custom-color-wrapper\",\n spacing: 0,\n children: [/*#__PURE__*/_jsx(\"button\", {\n ref: customColorPaletteCallbackRef,\n className: \"components-color-palette__custom-color-button\",\n \"aria-expanded\": isOpen,\n \"aria-haspopup\": \"true\",\n onClick: onToggle,\n \"aria-label\": customColorAccessibleLabel,\n style: {\n background: value\n },\n type: \"button\"\n }), /*#__PURE__*/_jsxs(VStack, {\n className: \"components-color-palette__custom-color-text-wrapper\",\n spacing: 0.5,\n children: [/*#__PURE__*/_jsx(Truncate, {\n className: \"components-color-palette__custom-color-name\",\n children: value ? buttonLabelName : __('No color selected')\n }), /*#__PURE__*/_jsx(Truncate, {\n className: clsx('components-color-palette__custom-color-value', {\n 'components-color-palette__custom-color-value--is-hex': isHex\n }),\n children: displayValue\n })]\n })]\n })\n }), (colors.length > 0 || actions) && /*#__PURE__*/_jsx(CircularOptionPicker, {\n ...metaProps,\n ...labelProps,\n actions: actions,\n options: hasMultipleColorOrigins ? /*#__PURE__*/_jsx(MultiplePalettes, {\n ...paletteCommonProps,\n headingLevel: headingLevel,\n colors: colors,\n value: value\n }) : /*#__PURE__*/_jsx(SinglePalette, {\n ...paletteCommonProps,\n colors: colors,\n value: value\n })\n })]\n });\n}\n\n/**\n * Allows the user to pick a color from a list of pre-defined color entries.\n *\n * ```jsx\n * import { ColorPalette } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyColorPalette = () => {\n * const [ color, setColor ] = useState ( '#f00' )\n * const colors = [\n * { name: 'red', color: '#f00' },\n * { name: 'white', color: '#fff' },\n * { name: 'blue', color: '#00f' },\n * ];\n * return (\n * <ColorPalette\n * colors={ colors }\n * value={ color }\n * onChange={ ( color ) => setColor( color ) }\n * />\n * );\n * } );\n * ```\n */\nexport const ColorPalette = forwardRef(UnforwardedColorPalette);\nColorPalette.displayName = 'ColorPalette';\nexport default ColorPalette;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oBAA+B;AAC/B,mBAAwB;AACxB,kBAAuB;AACvB,kBAAiB;AAKjB,qBAA8B;AAC9B,kBAA4B;AAC5B,qBAA2D;AAK3D,sBAAqB;AACrB,0BAA4B;AAC5B,oCAAgF;AAChF,qBAAuB;AACvB,sBAAyB;AACzB,oBAA6B;AAC7B,sCAA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B;AAAA,QACrE,GAAG;AAAA,QACH;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC,IAAiB,uCAAAA,KAAK,eAAe;AAAA,QACpC,GAAG;AAAA,QACH;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AA0BO,IAAM,mBAAe,2BAAW,uBAAuB;AAC9D,aAAa,cAAc;AAC3B,IAAO,wBAAQ;",
6
6
  "names": ["namesPlugin", "a11yPlugin", "_jsx", "CircularOptionPicker", "_jsxs", "Dropdown", "DropdownContentWrapper", "clsx"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/custom-gradient-picker/gradient-bar/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { useRef, useReducer } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ControlPoints from './control-points';\nimport { getHorizontalRelativeGradientPosition } from './utils';\nimport { MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT } from './constants';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst customGradientBarReducer = (state, action) => {\n switch (action.type) {\n case 'MOVE_INSERTER':\n if (state.id === 'IDLE' || state.id === 'MOVING_INSERTER') {\n return {\n id: 'MOVING_INSERTER',\n insertPosition: action.insertPosition\n };\n }\n break;\n case 'STOP_INSERTER_MOVE':\n if (state.id === 'MOVING_INSERTER') {\n return {\n id: 'IDLE'\n };\n }\n break;\n case 'OPEN_INSERTER':\n if (state.id === 'MOVING_INSERTER') {\n return {\n id: 'INSERTING_CONTROL_POINT',\n insertPosition: state.insertPosition\n };\n }\n break;\n case 'CLOSE_INSERTER':\n if (state.id === 'INSERTING_CONTROL_POINT') {\n return {\n id: 'IDLE'\n };\n }\n break;\n case 'START_CONTROL_CHANGE':\n if (state.id === 'IDLE') {\n return {\n id: 'MOVING_CONTROL_POINT'\n };\n }\n break;\n case 'STOP_CONTROL_CHANGE':\n if (state.id === 'MOVING_CONTROL_POINT') {\n return {\n id: 'IDLE'\n };\n }\n break;\n }\n return state;\n};\nconst customGradientBarReducerInitialState = {\n id: 'IDLE'\n};\nexport default function CustomGradientBar({\n background,\n hasGradient,\n value: controlPoints,\n onChange,\n disableInserter = false,\n disableAlpha = false,\n __experimentalIsRenderedInSidebar = false\n}) {\n const gradientMarkersContainerDomRef = useRef(null);\n const [gradientBarState, gradientBarStateDispatch] = useReducer(customGradientBarReducer, customGradientBarReducerInitialState);\n const onMouseEnterAndMove = event => {\n if (!gradientMarkersContainerDomRef.current) {\n return;\n }\n const insertPosition = getHorizontalRelativeGradientPosition(event.clientX, gradientMarkersContainerDomRef.current);\n\n // If the insert point is close to an existing control point don't show it.\n if (controlPoints.some(({\n position\n }) => {\n return Math.abs(insertPosition - position) < MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;\n })) {\n if (gradientBarState.id === 'MOVING_INSERTER') {\n gradientBarStateDispatch({\n type: 'STOP_INSERTER_MOVE'\n });\n }\n return;\n }\n gradientBarStateDispatch({\n type: 'MOVE_INSERTER',\n insertPosition\n });\n };\n const onMouseLeave = () => {\n gradientBarStateDispatch({\n type: 'STOP_INSERTER_MOVE'\n });\n };\n const isMovingInserter = gradientBarState.id === 'MOVING_INSERTER';\n const isInsertingControlPoint = gradientBarState.id === 'INSERTING_CONTROL_POINT';\n return /*#__PURE__*/_jsxs(\"div\", {\n className: clsx('components-custom-gradient-picker__gradient-bar', {\n 'has-gradient': hasGradient\n }),\n onMouseEnter: onMouseEnterAndMove,\n onMouseMove: onMouseEnterAndMove,\n onMouseLeave: onMouseLeave,\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"components-custom-gradient-picker__gradient-bar-background\",\n style: {\n background,\n opacity: hasGradient ? 1 : 0.4\n }\n }), /*#__PURE__*/_jsxs(\"div\", {\n ref: gradientMarkersContainerDomRef,\n className: \"components-custom-gradient-picker__markers-container\",\n children: [!disableInserter && (isMovingInserter || isInsertingControlPoint) && /*#__PURE__*/_jsx(ControlPoints.InsertPoint, {\n __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,\n disableAlpha: disableAlpha,\n insertPosition: gradientBarState.insertPosition,\n value: controlPoints,\n onChange: onChange,\n onOpenInserter: () => {\n gradientBarStateDispatch({\n type: 'OPEN_INSERTER'\n });\n },\n onCloseInserter: () => {\n gradientBarStateDispatch({\n type: 'CLOSE_INSERTER'\n });\n }\n }), /*#__PURE__*/_jsx(ControlPoints, {\n __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,\n disableAlpha: disableAlpha,\n disableRemove: disableInserter,\n gradientPickerDomRef: gradientMarkersContainerDomRef,\n ignoreMarkerPosition: isInsertingControlPoint ? gradientBarState.insertPosition : undefined,\n value: controlPoints,\n onChange: onChange,\n onStartControlPointChange: () => {\n gradientBarStateDispatch({\n type: 'START_CONTROL_CHANGE'\n });\n },\n onStopControlPointChange: () => {\n gradientBarStateDispatch({\n type: 'STOP_CONTROL_CHANGE'\n });\n }\n })]\n })]\n });\n}"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAIjB,qBAAmC;AAKnC,4BAA0B;AAC1B,mBAAsD;AACtD,uBAA4D;AAC5D,yBAA2C;AAC3C,IAAM,2BAA2B,CAAC,OAAO,WAAW;AAClD,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK;AACH,UAAI,MAAM,OAAO,UAAU,MAAM,OAAO,mBAAmB;AACzD,eAAO;AAAA,UACL,IAAI;AAAA,UACJ,gBAAgB,OAAO;AAAA,QACzB;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,UAAI,MAAM,OAAO,mBAAmB;AAClC,eAAO;AAAA,UACL,IAAI;AAAA,QACN;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,UAAI,MAAM,OAAO,mBAAm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dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useReducer } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ControlPoints from './control-points';\nimport { getHorizontalRelativeGradientPosition } from './utils';\nimport { MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT } from './constants';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst customGradientBarReducer = (state, action) => {\n switch (action.type) {\n case 'MOVE_INSERTER':\n if (state.id === 'IDLE' || state.id === 'MOVING_INSERTER') {\n return {\n id: 'MOVING_INSERTER',\n insertPosition: action.insertPosition\n };\n }\n break;\n case 'STOP_INSERTER_MOVE':\n if (state.id === 'MOVING_INSERTER') {\n return {\n id: 'IDLE'\n };\n }\n break;\n case 'OPEN_INSERTER':\n if (state.id === 'MOVING_INSERTER') {\n return {\n id: 'INSERTING_CONTROL_POINT',\n insertPosition: state.insertPosition\n };\n }\n break;\n case 'CLOSE_INSERTER':\n if (state.id === 'INSERTING_CONTROL_POINT') {\n return {\n id: 'IDLE'\n };\n }\n break;\n case 'START_CONTROL_CHANGE':\n if (state.id === 'IDLE') {\n return {\n id: 'MOVING_CONTROL_POINT'\n };\n }\n break;\n case 'STOP_CONTROL_CHANGE':\n if (state.id === 'MOVING_CONTROL_POINT') {\n return {\n id: 'IDLE'\n };\n }\n break;\n }\n return state;\n};\nconst customGradientBarReducerInitialState = {\n id: 'IDLE'\n};\nexport default function CustomGradientBar({\n background,\n hasGradient,\n value: controlPoints,\n onChange,\n disableInserter = false,\n disableAlpha = false,\n __experimentalIsRenderedInSidebar = false\n}) {\n const gradientMarkersContainerDomRef = useRef(null);\n const [gradientBarState, gradientBarStateDispatch] = useReducer(customGradientBarReducer, customGradientBarReducerInitialState);\n const onMouseEnterAndMove = event => {\n if (!gradientMarkersContainerDomRef.current) {\n return;\n }\n const insertPosition = getHorizontalRelativeGradientPosition(event.clientX, gradientMarkersContainerDomRef.current);\n\n // If the insert point is close to an existing control point don't show it.\n if (controlPoints.some(({\n position\n }) => {\n return Math.abs(insertPosition - position) < MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;\n })) {\n if (gradientBarState.id === 'MOVING_INSERTER') {\n gradientBarStateDispatch({\n type: 'STOP_INSERTER_MOVE'\n });\n }\n return;\n }\n gradientBarStateDispatch({\n type: 'MOVE_INSERTER',\n insertPosition\n });\n };\n const onMouseLeave = () => {\n gradientBarStateDispatch({\n type: 'STOP_INSERTER_MOVE'\n });\n };\n const isMovingInserter = gradientBarState.id === 'MOVING_INSERTER';\n const isInsertingControlPoint = gradientBarState.id === 'INSERTING_CONTROL_POINT';\n return /*#__PURE__*/_jsxs(\"div\", {\n className: clsx('components-custom-gradient-picker__gradient-bar', {\n 'has-gradient': hasGradient\n }),\n onMouseEnter: onMouseEnterAndMove,\n onMouseMove: onMouseEnterAndMove,\n onMouseLeave: onMouseLeave,\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: \"components-custom-gradient-picker__gradient-bar-background\",\n style: {\n background,\n opacity: hasGradient ? 1 : 0.4\n }\n }), /*#__PURE__*/_jsxs(\"div\", {\n ref: gradientMarkersContainerDomRef,\n className: \"components-custom-gradient-picker__markers-container\",\n children: [!disableInserter && (isMovingInserter || isInsertingControlPoint) && /*#__PURE__*/_jsx(ControlPoints.InsertPoint, {\n __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,\n disableAlpha: disableAlpha,\n insertPosition: gradientBarState.insertPosition,\n value: controlPoints,\n onChange: onChange,\n onOpenInserter: () => {\n gradientBarStateDispatch({\n type: 'OPEN_INSERTER'\n });\n },\n onCloseInserter: () => {\n gradientBarStateDispatch({\n type: 'CLOSE_INSERTER'\n });\n }\n }), /*#__PURE__*/_jsx(ControlPoints, {\n __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,\n disableAlpha: disableAlpha,\n disableRemove: disableInserter,\n gradientPickerDomRef: gradientMarkersContainerDomRef,\n ignoreMarkerPosition: isInsertingControlPoint ? gradientBarState.insertPosition : undefined,\n value: controlPoints,\n onChange: onChange,\n onStartControlPointChange: () => {\n gradientBarStateDispatch({\n type: 'START_CONTROL_CHANGE'\n });\n },\n onStopControlPointChange: () => {\n gradientBarStateDispatch({\n type: 'STOP_CONTROL_CHANGE'\n });\n }\n })]\n })]\n });\n}"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAmC;AAKnC,4BAA0B;AAC1B,mBAAsD;AACtD,uBAA4D;AAC5D,yBAA2C;AAC3C,IAAM,2BAA2B,CAAC,OAAO,WAAW;AAClD,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK;AACH,UAAI,MAAM,OAAO,UAAU,MAAM,OAAO,mBAAmB;AACzD,eAAO;AAAA,UACL,IAAI;AAAA,UACJ,gBAAgB,OAAO;AAAA,QACzB;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,UAAI,MAAM,OAAO,mBAAmB;AAClC,eAAO;AAAA,UACL,IAAI;AAAA,QACN;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,UAAI,MAAM,OAAO,mBAAmB;AAClC,eAAO;AAAA,UACL,IAAI;AAAA,UACJ,gBAAgB,MAAM;AAAA,QACxB;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,UAAI,MAAM,OAAO,2BAA2B;AAC1C,eAAO;AAAA,UACL,IAAI;AAAA,QACN;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,UAAI,MAAM,OAAO,QAAQ;AACvB,eAAO;AAAA,UACL,IAAI;AAAA,QACN;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,UAAI,MAAM,OAAO,wBAAwB;AACvC,eAAO;AAAA,UACL,IAAI;AAAA,QACN;AAAA,MACF;AACA;AAAA,EACJ;AACA,SAAO;AACT;AACA,IAAM,uCAAuC;AAAA,EAC3C,IAAI;AACN;AACe,SAAR,kBAAmC;AAA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uCAAAE,KAAK,sBAAAC,QAAc,aAAa;AAAA,QAC3H;AAAA,QACA;AAAA,QACA,gBAAgB,iBAAiB;AAAA,QACjC,OAAO;AAAA,QACP;AAAA,QACA,gBAAgB,MAAM;AACpB,mCAAyB;AAAA,YACvB,MAAM;AAAA,UACR,CAAC;AAAA,QACH;AAAA,QACA,iBAAiB,MAAM;AACrB,mCAAyB;AAAA,YACvB,MAAM;AAAA,UACR,CAAC;AAAA,QACH;AAAA,MACF,CAAC,GAAgB,uCAAAD,KAAK,sBAAAC,SAAe;AAAA,QACnC;AAAA,QACA;AAAA,QACA,eAAe;AAAA,QACf,sBAAsB;AAAA,QACtB,sBAAsB,0BAA0B,iBAAiB,iBAAiB;AAAA,QAClF,OAAO;AAAA,QACP;AAAA,QACA,2BAA2B,MAAM;AAC/B,mCAAyB;AAAA,YACvB,MAAM;AAAA,UACR,CAAC;AAAA,QACH;AAAA,QACA,0BAA0B,MAAM;AAC9B,mCAAyB;AAAA,YACvB,MAAM;AAAA,UACR,CAAC;AAAA,QACH;AAAA,MACF,CAAC,CAAC;AAAA,IACJ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;",
6
6
  "names": ["_jsxs", "clsx", "_jsx", "ControlPoints"]
7
7
  }
@@ -107,7 +107,7 @@ function registerStyle(hash, css) {
107
107
 
108
108
  // packages/components/src/draggable/style.module.scss
109
109
  if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
110
- registerStyle("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}");
110
+ registerStyle("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}");
111
111
  }
112
112
  var style_module_default = { "invisible-drag-image": "_3476c2e530687f96__invisible-drag-image", "clone": "_6f00e51ab7574306__clone", "is-in-compat-slot": "_664ecd37377558df__is-in-compat-slot" };
113
113
 
@@ -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,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AAC;AACL,SAAoB,uCAAAA,MAAM,mBAAAC,UAAW;AAAA,IACnC,UAAU,CAAC,SAAS;AAAA,MAClB,kBAAkB;AAAA,MAClB,gBAAgB;AAAA,IAClB,CAAC,GAAG,iBAA8B,uCAAAC,KAAK,OAAO;AAAA,MAC5C,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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,CAAC;AACL,SAAoB,uCAAAA,MAAM,mBAAAC,UAAW;AAAA,IACnC,UAAU,CAAC,SAAS;AAAA,MAClB,kBAAkB;AAAA,MAClB,gBAAgB;AAAA,IAClB,CAAC,GAAG,iBAA8B,uCAAAC,KAAK,OAAO;AAAA,MAC5C,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,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;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAAG,KAAK;AACN,QAAM,mBAAe,uBAAO,IAAI;AAChC,QAAM,wBAAoB,4BAAY,CAAC,YAAY,WAAW;AAC5D,WAAO,WAAW,QAAQ,MAAM;AAAA,EAClC,GAAG,CAAC,CAAC;AACL,QAAM,0BAAsB,4BAAY,YAAU;AAChD,QAAI,CAAC,aAAa,SAAS;AACzB,aAAO;AAAA,IACT;AACA,UAAM,SAAS,sBAAsB,iBAAM,WAAW,iBAAM;AAC5D,UAAM,aAAa,OAAO,KAAK,aAAa,OAAO;AACnD,UAAM,QAAQ,kBAAkB,YAAY,MAAM;AAClD,QAAI,QAAQ,MAAM,QAAQ;AACxB,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,qBAAqB,iBAAiB,CAAC;AAC3C,gCAAU,MAAM;AACd,UAAM,YAAY,aAAa;AAC/B,QAAI,CAAC,WAAW;AACd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AAQ;",
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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