@wordpress/components 34.0.0 → 35.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (514) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/build/alignment-matrix-control/cell.cjs +1 -1
  3. package/build/alignment-matrix-control/cell.cjs.map +2 -2
  4. package/build/alignment-matrix-control/index.cjs +1 -1
  5. package/build/alignment-matrix-control/index.cjs.map +2 -2
  6. package/build/border-control/border-control-dropdown/component.cjs +33 -33
  7. package/build/border-control/border-control-dropdown/component.cjs.map +3 -3
  8. package/build/color-palette/index.cjs +3 -0
  9. package/build/color-palette/index.cjs.map +2 -2
  10. package/build/custom-gradient-picker/gradient-bar/index.cjs.map +2 -2
  11. package/build/disabled/index.cjs +1 -1
  12. package/build/disabled/index.cjs.map +2 -2
  13. package/build/draggable/index.cjs +1 -1
  14. package/build/draggable/index.cjs.map +2 -2
  15. package/build/higher-order/with-notices/index.cjs +15 -3
  16. package/build/higher-order/with-notices/index.cjs.map +2 -2
  17. package/build/input-control/input-base.cjs +34 -31
  18. package/build/input-control/input-base.cjs.map +2 -2
  19. package/build/navigable-container/container.cjs +15 -21
  20. package/build/navigable-container/container.cjs.map +2 -2
  21. package/build/responsive-wrapper/index.cjs +3 -4
  22. package/build/responsive-wrapper/index.cjs.map +2 -2
  23. package/build/tooltip/index.cjs +1 -2
  24. package/build/tooltip/index.cjs.map +2 -2
  25. package/build/unit-control/utils.cjs +33 -35
  26. package/build/unit-control/utils.cjs.map +2 -2
  27. package/build-module/alignment-matrix-control/cell.mjs +1 -1
  28. package/build-module/alignment-matrix-control/cell.mjs.map +2 -2
  29. package/build-module/alignment-matrix-control/index.mjs +1 -1
  30. package/build-module/alignment-matrix-control/index.mjs.map +2 -2
  31. package/build-module/border-control/border-control-dropdown/component.mjs +34 -34
  32. package/build-module/border-control/border-control-dropdown/component.mjs.map +2 -2
  33. package/build-module/color-palette/index.mjs +3 -0
  34. package/build-module/color-palette/index.mjs.map +2 -2
  35. package/build-module/custom-gradient-picker/gradient-bar/index.mjs.map +2 -2
  36. package/build-module/disabled/index.mjs +1 -1
  37. package/build-module/disabled/index.mjs.map +2 -2
  38. package/build-module/draggable/index.mjs +1 -1
  39. package/build-module/draggable/index.mjs.map +2 -2
  40. package/build-module/higher-order/with-notices/index.mjs +16 -4
  41. package/build-module/higher-order/with-notices/index.mjs.map +2 -2
  42. package/build-module/input-control/input-base.mjs +34 -31
  43. package/build-module/input-control/input-base.mjs.map +2 -2
  44. package/build-module/navigable-container/container.mjs +16 -22
  45. package/build-module/navigable-container/container.mjs.map +2 -2
  46. package/build-module/responsive-wrapper/index.mjs +3 -4
  47. package/build-module/responsive-wrapper/index.mjs.map +2 -2
  48. package/build-module/tooltip/index.mjs +1 -2
  49. package/build-module/tooltip/index.mjs.map +2 -2
  50. package/build-module/unit-control/utils.mjs +33 -35
  51. package/build-module/unit-control/utils.mjs.map +2 -2
  52. package/build-style/style-rtl.css +41 -10
  53. package/build-style/style.css +41 -10
  54. package/build-types/border-box-control/border-box-control/hook.d.ts +10 -24
  55. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  56. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +12 -26
  57. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  58. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +10 -24
  59. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  60. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +11 -25
  61. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  62. package/build-types/border-control/border-control/hook.d.ts +10 -24
  63. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  64. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  65. package/build-types/border-control/border-control-dropdown/hook.d.ts +9 -23
  66. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  67. package/build-types/box-control/styles/box-control-styles.d.ts +2 -2
  68. package/build-types/card/card/hook.d.ts +11 -25
  69. package/build-types/card/card/hook.d.ts.map +1 -1
  70. package/build-types/card/card-body/hook.d.ts +11 -25
  71. package/build-types/card/card-body/hook.d.ts.map +1 -1
  72. package/build-types/card/card-divider/hook.d.ts +12 -26
  73. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  74. package/build-types/card/card-footer/hook.d.ts +11 -25
  75. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  76. package/build-types/card/card-header/hook.d.ts +11 -25
  77. package/build-types/card/card-header/hook.d.ts.map +1 -1
  78. package/build-types/card/card-media/hook.d.ts +11 -25
  79. package/build-types/card/card-media/hook.d.ts.map +1 -1
  80. package/build-types/card/context.d.ts +3 -0
  81. package/build-types/card/context.d.ts.map +1 -0
  82. package/build-types/color-palette/index.d.ts.map +1 -1
  83. package/build-types/color-picker/styles.d.ts +2 -2
  84. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  85. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
  86. package/build-types/custom-select-control-v2/styles.d.ts +12 -4
  87. package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
  88. package/build-types/date-time/date/index.d.ts +23 -0
  89. package/build-types/date-time/date/index.d.ts.map +1 -0
  90. package/build-types/date-time/date/styles.d.ts +45 -0
  91. package/build-types/date-time/date/styles.d.ts.map +1 -0
  92. package/build-types/date-time/date/test/index.d.ts +2 -0
  93. package/build-types/date-time/date/test/index.d.ts.map +1 -0
  94. package/build-types/date-time/date/test/use-lilius.d.ts +2 -0
  95. package/build-types/date-time/date/test/use-lilius.d.ts.map +1 -0
  96. package/build-types/date-time/date/use-lilius/index.d.ts +169 -0
  97. package/build-types/date-time/date/use-lilius/index.d.ts.map +1 -0
  98. package/build-types/date-time/time/index.d.ts +27 -0
  99. package/build-types/date-time/time/index.d.ts.map +1 -0
  100. package/build-types/date-time/time/styles.d.ts +93 -0
  101. package/build-types/date-time/time/styles.d.ts.map +1 -0
  102. package/build-types/date-time/time/test/index.d.ts +2 -0
  103. package/build-types/date-time/time/test/index.d.ts.map +1 -0
  104. package/build-types/date-time/time/time-input/index.d.ts +4 -0
  105. package/build-types/date-time/time/time-input/index.d.ts.map +1 -0
  106. package/build-types/date-time/time/time-input/test/index.d.ts +2 -0
  107. package/build-types/date-time/time/time-input/test/index.d.ts.map +1 -0
  108. package/build-types/date-time/time/timezone.d.ts +7 -0
  109. package/build-types/date-time/time/timezone.d.ts.map +1 -0
  110. package/build-types/date-time/time-picker/styles.d.ts +4 -4
  111. package/build-types/elevation/hook.d.ts +11 -25
  112. package/build-types/elevation/hook.d.ts.map +1 -1
  113. package/build-types/flex/flex/hook.d.ts +11 -25
  114. package/build-types/flex/flex/hook.d.ts.map +1 -1
  115. package/build-types/flex/flex-block/hook.d.ts +11 -25
  116. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  117. package/build-types/flex/flex-item/hook.d.ts +11 -25
  118. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  119. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  120. package/build-types/grid/hook.d.ts +11 -25
  121. package/build-types/grid/hook.d.ts.map +1 -1
  122. package/build-types/h-stack/hook.d.ts +11 -25
  123. package/build-types/h-stack/hook.d.ts.map +1 -1
  124. package/build-types/heading/hook.d.ts +11 -25
  125. package/build-types/heading/hook.d.ts.map +1 -1
  126. package/build-types/higher-order/with-fallback-styles/index.d.ts +3 -1
  127. package/build-types/higher-order/with-filters/index.d.ts +6 -1
  128. package/build-types/higher-order/with-filters/index.d.ts.map +1 -1
  129. package/build-types/higher-order/with-notices/index.d.ts +4 -2
  130. package/build-types/higher-order/with-notices/index.d.ts.map +1 -1
  131. package/build-types/input-control/reducer/reducer.d.ts +1 -1
  132. package/build-types/item-group/item/hook.d.ts +11 -25
  133. package/build-types/item-group/item/hook.d.ts.map +1 -1
  134. package/build-types/item-group/item-group/hook.d.ts +11 -25
  135. package/build-types/item-group/item-group/hook.d.ts.map +1 -1
  136. package/build-types/menu/stories/index.story.d.ts.map +1 -1
  137. package/build-types/menu/styles.d.ts +21 -7
  138. package/build-types/menu/styles.d.ts.map +1 -1
  139. package/build-types/modal/use-modal-exit-animation.d.ts +1 -1
  140. package/build-types/navigable-container/container.d.ts.map +1 -1
  141. package/build-types/navigation/back-button/index.d.ts +7 -0
  142. package/build-types/navigation/back-button/index.d.ts.map +1 -0
  143. package/build-types/navigation/constants.d.ts +3 -0
  144. package/build-types/navigation/constants.d.ts.map +1 -0
  145. package/build-types/navigation/context.d.ts +4 -0
  146. package/build-types/navigation/context.d.ts.map +1 -0
  147. package/build-types/navigation/group/context.d.ts +7 -0
  148. package/build-types/navigation/group/context.d.ts.map +1 -0
  149. package/build-types/navigation/group/index.d.ts +7 -0
  150. package/build-types/navigation/group/index.d.ts.map +1 -0
  151. package/build-types/navigation/index.d.ts +46 -0
  152. package/build-types/navigation/index.d.ts.map +1 -0
  153. package/build-types/navigation/item/base-content.d.ts +3 -0
  154. package/build-types/navigation/item/base-content.d.ts.map +1 -0
  155. package/build-types/navigation/item/base.d.ts +3 -0
  156. package/build-types/navigation/item/base.d.ts.map +1 -0
  157. package/build-types/navigation/item/index.d.ts +7 -0
  158. package/build-types/navigation/item/index.d.ts.map +1 -0
  159. package/build-types/navigation/item/use-navigation-tree-item.d.ts +3 -0
  160. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -0
  161. package/build-types/navigation/menu/context.d.ts +7 -0
  162. package/build-types/navigation/menu/context.d.ts.map +1 -0
  163. package/build-types/navigation/menu/index.d.ts +7 -0
  164. package/build-types/navigation/menu/index.d.ts.map +1 -0
  165. package/build-types/navigation/menu/menu-title-search.d.ts +3 -0
  166. package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -0
  167. package/build-types/navigation/menu/menu-title.d.ts +3 -0
  168. package/build-types/navigation/menu/menu-title.d.ts.map +1 -0
  169. package/build-types/navigation/menu/search-no-results-found.d.ts +3 -0
  170. package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -0
  171. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +3 -0
  172. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -0
  173. package/build-types/navigation/stories/index.story.d.ts +23 -0
  174. package/build-types/navigation/stories/index.story.d.ts.map +1 -0
  175. package/build-types/navigation/stories/utils/controlled-state.d.ts +7 -0
  176. package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -0
  177. package/build-types/navigation/stories/utils/default.d.ts +10 -0
  178. package/build-types/navigation/stories/utils/default.d.ts.map +1 -0
  179. package/build-types/navigation/stories/utils/group.d.ts +10 -0
  180. package/build-types/navigation/stories/utils/group.d.ts.map +1 -0
  181. package/build-types/navigation/stories/utils/hide-if-empty.d.ts +10 -0
  182. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -0
  183. package/build-types/navigation/stories/utils/more-examples.d.ts +10 -0
  184. package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -0
  185. package/build-types/navigation/stories/utils/search.d.ts +10 -0
  186. package/build-types/navigation/stories/utils/search.d.ts.map +1 -0
  187. package/build-types/navigation/styles/navigation-styles.d.ts +55 -0
  188. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -0
  189. package/build-types/navigation/test/index.d.ts +2 -0
  190. package/build-types/navigation/test/index.d.ts.map +1 -0
  191. package/build-types/navigation/types.d.ts +266 -0
  192. package/build-types/navigation/types.d.ts.map +1 -0
  193. package/build-types/navigation/use-create-navigation-tree.d.ts +15 -0
  194. package/build-types/navigation/use-create-navigation-tree.d.ts.map +1 -0
  195. package/build-types/navigation/use-navigation-tree-nodes.d.ts +10 -0
  196. package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +1 -0
  197. package/build-types/navigation/utils.d.ts +3 -0
  198. package/build-types/navigation/utils.d.ts.map +1 -0
  199. package/build-types/navigator/navigator-back-button/hook.d.ts +12 -26
  200. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  201. package/build-types/navigator/navigator-button/hook.d.ts +12 -26
  202. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  203. package/build-types/number-control/index.d.ts +1 -1
  204. package/build-types/number-control/index.d.ts.map +1 -1
  205. package/build-types/number-control/stories/index.story.d.ts +1 -1
  206. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  207. package/build-types/popover/types.d.ts +2 -2
  208. package/build-types/popover/types.d.ts.map +1 -1
  209. package/build-types/range-control/index.d.ts +1 -1
  210. package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
  211. package/build-types/range-control/types.d.ts +1 -1
  212. package/build-types/range-control/types.d.ts.map +1 -1
  213. package/build-types/responsive-wrapper/index.d.ts.map +1 -1
  214. package/build-types/scrollable/hook.d.ts +11 -25
  215. package/build-types/scrollable/hook.d.ts.map +1 -1
  216. package/build-types/snackbar/index.d.ts +2 -2
  217. package/build-types/snackbar/types.d.ts +2 -2
  218. package/build-types/snackbar/types.d.ts.map +1 -1
  219. package/build-types/spacer/hook.d.ts +11 -25
  220. package/build-types/spacer/hook.d.ts.map +1 -1
  221. package/build-types/surface/hook.d.ts +11 -25
  222. package/build-types/surface/hook.d.ts.map +1 -1
  223. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  224. package/build-types/tabs/styles.d.ts +9 -3
  225. package/build-types/tabs/styles.d.ts.map +1 -1
  226. package/build-types/text/hook.d.ts +11 -25
  227. package/build-types/text/hook.d.ts.map +1 -1
  228. package/build-types/tools-panel/tools-panel/hook.d.ts +11 -25
  229. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  230. package/build-types/tools-panel/tools-panel-header/hook.d.ts +11 -25
  231. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  232. package/build-types/tools-panel/tools-panel-item/hook.d.ts +11 -25
  233. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  234. package/build-types/tooltip/index.d.ts.map +1 -1
  235. package/build-types/truncate/hook.d.ts +11 -25
  236. package/build-types/truncate/hook.d.ts.map +1 -1
  237. package/build-types/unit-control/index.d.ts +1 -1
  238. package/build-types/unit-control/index.d.ts.map +1 -1
  239. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  240. package/build-types/unit-control/utils.d.ts.map +1 -1
  241. package/build-types/utils/get-node-text.d.ts.map +1 -1
  242. package/build-types/v-stack/hook.d.ts +11 -25
  243. package/build-types/v-stack/hook.d.ts.map +1 -1
  244. package/build-types/validated-form-controls/components/combobox-control.d.ts +2 -2
  245. package/build-types/validated-form-controls/components/number-control.d.ts +1 -1
  246. package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -1
  247. package/build-types/validated-form-controls/components/range-control.d.ts +1 -1
  248. package/build-types/validated-form-controls/control-with-error.d.ts +1 -4
  249. package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
  250. package/build-types/visually-hidden/test/index.d.ts +2 -0
  251. package/build-types/visually-hidden/test/index.d.ts.map +1 -0
  252. package/package.json +37 -35
  253. package/src/autocomplete/README.md +1 -1
  254. package/src/border-control/border-control-dropdown/component.tsx +37 -36
  255. package/src/card/card/README.md +4 -4
  256. package/src/checkbox-control/README.md +1 -1
  257. package/src/clipboard-button/README.md +4 -4
  258. package/src/color-palette/index.tsx +5 -0
  259. package/src/color-palette/test/index.tsx +30 -0
  260. package/src/combobox-control/README.md +1 -1
  261. package/src/composite/stories/index.story.tsx +1 -0
  262. package/src/confirm-dialog/README.md +1 -1
  263. package/src/custom-gradient-picker/gradient-bar/index.tsx +1 -1
  264. package/src/disabled/index.tsx +1 -1
  265. package/src/flex/flex/README.md +1 -1
  266. package/src/form-file-upload/README.md +1 -1
  267. package/src/h-stack/hook.tsx +1 -1
  268. package/src/higher-order/with-notices/index.tsx +21 -4
  269. package/src/higher-order/with-notices/test/index.tsx +18 -0
  270. package/src/input-control/input-base.tsx +2 -2
  271. package/src/menu/README.md +7 -7
  272. package/src/menu/stories/index.story.tsx +1 -0
  273. package/src/navigable-container/container.tsx +22 -30
  274. package/src/popover/README.md +1 -1
  275. package/src/popover/index.tsx +1 -1
  276. package/src/popover/types.ts +4 -2
  277. package/src/range-control/types.ts +1 -1
  278. package/src/responsive-wrapper/index.tsx +3 -7
  279. package/src/scrollable/README.md +1 -1
  280. package/src/snackbar/README.md +1 -1
  281. package/src/snackbar/types.ts +2 -2
  282. package/src/tabs/README.md +1 -1
  283. package/src/tabs/stories/index.story.tsx +1 -0
  284. package/src/tabs/tablist.tsx +1 -1
  285. package/src/tooltip/index.tsx +1 -7
  286. package/src/tooltip/style.scss +1 -1
  287. package/src/tree-grid/test/cell.tsx +1 -0
  288. package/src/tree-grid/test/roving-tab-index-item.tsx +1 -0
  289. package/src/tree-select/README.md +1 -1
  290. package/src/unit-control/utils.ts +33 -52
  291. package/src/utils/get-node-text.ts +1 -7
  292. package/src/validated-form-controls/control-with-error.tsx +1 -6
  293. package/build/mobile/image/constants.cjs +0 -34
  294. package/build/mobile/image/constants.cjs.map +0 -7
  295. package/build-module/mobile/image/constants.mjs +0 -9
  296. package/build-module/mobile/image/constants.mjs.map +0 -7
  297. package/src/autocomplete/autocompleter-ui.native.js +0 -211
  298. package/src/autocomplete/background-view.android.js +0 -25
  299. package/src/autocomplete/background-view.ios.js +0 -23
  300. package/src/autocomplete/style.android.scss +0 -7
  301. package/src/autocomplete/style.native.scss +0 -74
  302. package/src/base-control/index.native.js +0 -14
  303. package/src/button/index.native.js +0 -236
  304. package/src/button/style.native.scss +0 -9
  305. package/src/color-control/index.native.js +0 -24
  306. package/src/color-indicator/index.native.js +0 -80
  307. package/src/color-indicator/style.native.scss +0 -51
  308. package/src/color-palette/index.native.js +0 -360
  309. package/src/color-palette/style.native.scss +0 -49
  310. package/src/color-picker/hsv-color-picker.native.js +0 -88
  311. package/src/color-picker/hue-picker.native.js +0 -198
  312. package/src/color-picker/index.native.js +0 -215
  313. package/src/color-picker/saturation-picker.native.js +0 -167
  314. package/src/color-picker/style.native.scss +0 -87
  315. package/src/custom-gradient-picker/index.native.js +0 -110
  316. package/src/custom-gradient-picker/style.native.scss +0 -3
  317. package/src/dashicon/index.native.js +0 -18
  318. package/src/disabled/index.native.js +0 -10
  319. package/src/draggable/index.native.js +0 -234
  320. package/src/draggable/style.native.scss +0 -3
  321. package/src/draggable/test/index.native.js +0 -138
  322. package/src/dropdown/index.native.js +0 -59
  323. package/src/dropdown-menu/index.native.js +0 -152
  324. package/src/external-link/index.native.js +0 -25
  325. package/src/focal-point-picker/focal-point.native.js +0 -30
  326. package/src/focal-point-picker/index.native.js +0 -281
  327. package/src/focal-point-picker/tooltip/index.native.js +0 -144
  328. package/src/focal-point-picker/tooltip/style.native.scss +0 -42
  329. package/src/font-size-picker/index.native.js +0 -190
  330. package/src/font-size-picker/style.native.scss +0 -6
  331. package/src/footer-message-control/index.native.js +0 -14
  332. package/src/higher-order/with-focus-outside/index.native.js +0 -38
  333. package/src/index.native.js +0 -134
  334. package/src/keyboard-shortcuts/index.native.js +0 -2
  335. package/src/mobile/README.md +0 -3
  336. package/src/mobile/autocompletion-items.native.js +0 -11
  337. package/src/mobile/badge/README.md +0 -31
  338. package/src/mobile/badge/index.native.js +0 -27
  339. package/src/mobile/badge/style.scss +0 -18
  340. package/src/mobile/bottom-sheet/borderStyles.android.scss +0 -8
  341. package/src/mobile/bottom-sheet/borderStyles.ios.scss +0 -9
  342. package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +0 -40
  343. package/src/mobile/bottom-sheet/bottom-sheet-navigation/README.md +0 -101
  344. package/src/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js +0 -16
  345. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +0 -193
  346. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +0 -146
  347. package/src/mobile/bottom-sheet/bottom-sheet-navigation/styles.native.scss +0 -11
  348. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +0 -197
  349. package/src/mobile/bottom-sheet/button.native.js +0 -19
  350. package/src/mobile/bottom-sheet/cell.native.js +0 -464
  351. package/src/mobile/bottom-sheet/cellStyles.android.scss +0 -15
  352. package/src/mobile/bottom-sheet/cellStyles.ios.scss +0 -19
  353. package/src/mobile/bottom-sheet/chevron-back.native.js +0 -18
  354. package/src/mobile/bottom-sheet/color-cell.native.js +0 -35
  355. package/src/mobile/bottom-sheet/cycle-picker-cell.native.js +0 -31
  356. package/src/mobile/bottom-sheet/footer-message-cell.native.js +0 -23
  357. package/src/mobile/bottom-sheet/footer-message-link/README.md +0 -37
  358. package/src/mobile/bottom-sheet/footer-message-link/footer-message-link.native.js +0 -26
  359. package/src/mobile/bottom-sheet/footer-message-link/styles.native.scss +0 -7
  360. package/src/mobile/bottom-sheet/index.native.js +0 -646
  361. package/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -125
  362. package/src/mobile/bottom-sheet/link-cell.native.js +0 -35
  363. package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +0 -92
  364. package/src/mobile/bottom-sheet/link-suggestion-styles.native.scss +0 -27
  365. package/src/mobile/bottom-sheet/lock-icon/index.native.js +0 -19
  366. package/src/mobile/bottom-sheet/lock-icon/styles.native.scss +0 -8
  367. package/src/mobile/bottom-sheet/nav-bar/README.md +0 -63
  368. package/src/mobile/bottom-sheet/nav-bar/action-button.native.js +0 -30
  369. package/src/mobile/bottom-sheet/nav-bar/apply-button.native.js +0 -53
  370. package/src/mobile/bottom-sheet/nav-bar/back-button.native.js +0 -94
  371. package/src/mobile/bottom-sheet/nav-bar/heading.native.js +0 -33
  372. package/src/mobile/bottom-sheet/nav-bar/index.native.js +0 -23
  373. package/src/mobile/bottom-sheet/nav-bar/styles.native.scss +0 -69
  374. package/src/mobile/bottom-sheet/picker-cell.native.js +0 -40
  375. package/src/mobile/bottom-sheet/radio-cell.native.js +0 -39
  376. package/src/mobile/bottom-sheet/range-cell.native.js +0 -274
  377. package/src/mobile/bottom-sheet/range-cell.native.scss +0 -40
  378. package/src/mobile/bottom-sheet/range-text-input.native.js +0 -248
  379. package/src/mobile/bottom-sheet/ripple.native.js +0 -83
  380. package/src/mobile/bottom-sheet/ripple.native.scss +0 -11
  381. package/src/mobile/bottom-sheet/stepper-cell/index.native.js +0 -264
  382. package/src/mobile/bottom-sheet/stepper-cell/stepper.android.js +0 -78
  383. package/src/mobile/bottom-sheet/stepper-cell/stepper.ios.js +0 -64
  384. package/src/mobile/bottom-sheet/stepper-cell/style.native.scss +0 -89
  385. package/src/mobile/bottom-sheet/styles.native.scss +0 -333
  386. package/src/mobile/bottom-sheet/sub-sheet/README.md +0 -90
  387. package/src/mobile/bottom-sheet/sub-sheet/index.native.js +0 -49
  388. package/src/mobile/bottom-sheet/switch-cell.native.js +0 -75
  389. package/src/mobile/bottom-sheet/test/index.native.js +0 -24
  390. package/src/mobile/bottom-sheet/test/range-cell.native.js +0 -73
  391. package/src/mobile/bottom-sheet-select-control/README.md +0 -97
  392. package/src/mobile/bottom-sheet-select-control/index.native.js +0 -124
  393. package/src/mobile/bottom-sheet-select-control/style.native.scss +0 -3
  394. package/src/mobile/bottom-sheet-text-control/README.md +0 -98
  395. package/src/mobile/bottom-sheet-text-control/index.native.js +0 -104
  396. package/src/mobile/bottom-sheet-text-control/styles.scss +0 -25
  397. package/src/mobile/clipboard/index.native.js +0 -18
  398. package/src/mobile/color-settings/gradient-picker-screen.native.js +0 -37
  399. package/src/mobile/color-settings/index.native.js +0 -88
  400. package/src/mobile/color-settings/palette.screen.native.js +0 -232
  401. package/src/mobile/color-settings/picker-screen.native.js +0 -60
  402. package/src/mobile/color-settings/style.native.scss +0 -62
  403. package/src/mobile/color-settings/utils.native.js +0 -36
  404. package/src/mobile/cycle-select-control/README.md +0 -3
  405. package/src/mobile/cycle-select-control/index.native.js +0 -39
  406. package/src/mobile/dashicons/index.native.js +0 -22
  407. package/src/mobile/focal-point-settings-panel/index.native.js +0 -84
  408. package/src/mobile/focal-point-settings-panel/styles.native.scss +0 -3
  409. package/src/mobile/gradient/index.native.js +0 -188
  410. package/src/mobile/gradient/style.native.scss +0 -8
  411. package/src/mobile/gradient/test/index.native.js +0 -114
  412. package/src/mobile/gridicons/index.native.js +0 -39
  413. package/src/mobile/html-text-input/index.native.js +0 -169
  414. package/src/mobile/html-text-input/style.android.scss +0 -8
  415. package/src/mobile/html-text-input/style.ios.scss +0 -10
  416. package/src/mobile/html-text-input/style.scss +0 -45
  417. package/src/mobile/html-text-input/test/__snapshots__/index.native.js.snap +0 -48
  418. package/src/mobile/html-text-input/test/index.native.js +0 -118
  419. package/src/mobile/image/constants.js +0 -1
  420. package/src/mobile/image/icon-customize.native.js +0 -10
  421. package/src/mobile/image/icon-retry.native.js +0 -11
  422. package/src/mobile/image/image-editing-button.native.js +0 -63
  423. package/src/mobile/image/index.native.js +0 -401
  424. package/src/mobile/image/style.native.scss +0 -179
  425. package/src/mobile/image/utils/index.native.js +0 -58
  426. package/src/mobile/keyboard-avoiding-view/index.android.js +0 -8
  427. package/src/mobile/keyboard-avoiding-view/index.ios.js +0 -143
  428. package/src/mobile/keyboard-avoiding-view/styles.native.scss +0 -9
  429. package/src/mobile/keyboard-aware-flat-list/index.android.js +0 -81
  430. package/src/mobile/keyboard-aware-flat-list/index.ios.js +0 -147
  431. package/src/mobile/keyboard-aware-flat-list/shared.native.js +0 -26
  432. package/src/mobile/keyboard-aware-flat-list/styles.native.scss +0 -8
  433. package/src/mobile/keyboard-aware-flat-list/test/use-keyboard-offset.native.js +0 -203
  434. package/src/mobile/keyboard-aware-flat-list/test/use-scroll-to-section.native.js +0 -142
  435. package/src/mobile/keyboard-aware-flat-list/test/use-scroll.native.js +0 -71
  436. package/src/mobile/keyboard-aware-flat-list/test/use-text-input-caret-position.native.js +0 -82
  437. package/src/mobile/keyboard-aware-flat-list/test/use-text-input-offset.native.js +0 -147
  438. package/src/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js +0 -87
  439. package/src/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +0 -41
  440. package/src/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +0 -100
  441. package/src/mobile/keyboard-aware-flat-list/use-scroll.native.js +0 -100
  442. package/src/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js +0 -36
  443. package/src/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js +0 -54
  444. package/src/mobile/layout-animation/index.native.js +0 -16
  445. package/src/mobile/link-picker/index.native.js +0 -160
  446. package/src/mobile/link-picker/link-picker-results.native.js +0 -129
  447. package/src/mobile/link-picker/link-picker-screen.native.js +0 -60
  448. package/src/mobile/link-picker/styles.native.scss +0 -45
  449. package/src/mobile/link-picker/test/performance/index.native.js +0 -35
  450. package/src/mobile/link-settings/index.native.js +0 -332
  451. package/src/mobile/link-settings/link-rel.native.js +0 -10
  452. package/src/mobile/link-settings/link-settings-navigation.native.js +0 -50
  453. package/src/mobile/link-settings/link-settings-screen.native.js +0 -44
  454. package/src/mobile/link-settings/style.native.scss +0 -4
  455. package/src/mobile/link-settings/test/edit.native.js +0 -325
  456. package/src/mobile/link-settings/test/link-settings-navigation.native.js +0 -94
  457. package/src/mobile/media-edit/index.native.js +0 -125
  458. package/src/mobile/picker/index.android.js +0 -104
  459. package/src/mobile/picker/index.ios.js +0 -96
  460. package/src/mobile/picker/styles.native.scss +0 -29
  461. package/src/mobile/segmented-control/index.native.js +0 -186
  462. package/src/mobile/segmented-control/style.native.scss +0 -99
  463. package/src/mobile/utils/alignments.native.js +0 -78
  464. package/src/mobile/utils/get-px-from-css-unit.native.js +0 -329
  465. package/src/mobile/utils/index.native.js +0 -12
  466. package/src/mobile/utils/test/get-px-from-css-unit.native.js +0 -172
  467. package/src/mobile/utils/test/index.native.js +0 -134
  468. package/src/mobile/utils/use-is-floating-keyboard.native.js +0 -31
  469. package/src/mobile/utils/use-unit-converter-to-mobile.native.js +0 -90
  470. package/src/notice/index.native.js +0 -123
  471. package/src/notice/list.native.js +0 -55
  472. package/src/notice/style.native.scss +0 -60
  473. package/src/panel/actions.native.js +0 -46
  474. package/src/panel/actions.native.scss +0 -12
  475. package/src/panel/body.native.js +0 -29
  476. package/src/panel/body.native.scss +0 -11
  477. package/src/panel/bottom-separator-cover.native.js +0 -27
  478. package/src/panel/bottom-separator-cover.native.scss +0 -9
  479. package/src/private-apis.native.js +0 -13
  480. package/src/query-controls/index.native.js +0 -103
  481. package/src/radio-control/index.native.js +0 -24
  482. package/src/range-control/index.native.js +0 -73
  483. package/src/resizable-box/index.native.js +0 -32
  484. package/src/resizable-box/style.native.scss +0 -14
  485. package/src/sandbox/index.native.js +0 -392
  486. package/src/sandbox/style.native.scss +0 -7
  487. package/src/search-control/index.native.js +0 -274
  488. package/src/search-control/platform-style.android.scss +0 -57
  489. package/src/search-control/platform-style.ios.scss +0 -43
  490. package/src/search-control/style.native.scss +0 -63
  491. package/src/select-control/index.native.js +0 -41
  492. package/src/slot-fill/index.native.js +0 -25
  493. package/src/spinner/index.native.js +0 -22
  494. package/src/spinner/style.native.scss +0 -4
  495. package/src/style-provider/index.native.js +0 -3
  496. package/src/text/index.native.js +0 -13
  497. package/src/text/styles/emotion-css.native.js +0 -6
  498. package/src/text/styles/font-family.native.js +0 -1
  499. package/src/text/styles/text-mixins.native.js +0 -163
  500. package/src/text-control/index.native.js +0 -41
  501. package/src/textarea-control/index.native.js +0 -26
  502. package/src/toggle-control/index.native.js +0 -31
  503. package/src/toolbar/toolbar/style.native.scss +0 -11
  504. package/src/toolbar/toolbar/toolbar-container.native.js +0 -8
  505. package/src/toolbar/toolbar-button/toolbar-button-container.native.js +0 -8
  506. package/src/toolbar/toolbar-group/style.native.scss +0 -10
  507. package/src/toolbar/toolbar-group/toolbar-group-collapsed.native.js +0 -36
  508. package/src/toolbar/toolbar-group/toolbar-group-container.native.js +0 -26
  509. package/src/toolbar/toolbar-item/index.native.js +0 -17
  510. package/src/tooltip/index.native.js +0 -292
  511. package/src/tooltip/style.native.scss +0 -39
  512. package/src/tooltip/test/index.native.js +0 -98
  513. package/src/unit-control/index.native.js +0 -202
  514. package/src/unit-control/style.native.scss +0 -19
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/border-control/border-control-dropdown/component.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderControlStylePicker from '../border-control-style-picker';\nimport Button from '../../button';\nimport ColorIndicator from '../../color-indicator';\nimport ColorPalette from '../../color-palette';\nimport Dropdown from '../../dropdown';\nimport { VStack } from '../../v-stack';\nimport { contextConnect } from '../../context';\nimport { useBorderControlDropdown } from './hook';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\nimport { isMultiplePaletteArray } from '../../color-palette/utils';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst getAriaLabelColorValue = colorValue => {\n // Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n return colorValue.replace(/^var\\((.+)\\)$/, '$1');\n};\nconst getColorObject = (colorValue, colors) => {\n if (!colorValue || !colors) {\n return;\n }\n if (isMultiplePaletteArray(colors)) {\n // Multiple origins\n let matchedColor;\n colors.some(origin => origin.colors.some(color => {\n if (color.color === colorValue) {\n matchedColor = color;\n return true;\n }\n return false;\n }));\n return matchedColor;\n }\n\n // Single origin\n return colors.find(color => color.color === colorValue);\n};\nconst getToggleAriaLabel = (colorValue, colorObject, style, isStyleEnabled) => {\n if (isStyleEnabled) {\n if (colorObject) {\n const ariaLabelValue = getAriaLabelColorValue(colorObject.color);\n return style ? sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\". 3: The current border style selection e.g. \"solid\".\n __('Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\". The currently selected style is \"%3$s\".'), colorObject.name, ariaLabelValue, style) : sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\".\n __('Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), colorObject.name, ariaLabelValue);\n }\n if (colorValue) {\n const ariaLabelValue = getAriaLabelColorValue(colorValue);\n return style ? sprintf(\n // translators: 1: The color's hex code e.g.: \"#f00:\". 2: The current border style selection e.g. \"solid\".\n __('Border color and style picker. The currently selected color has a value of \"%1$s\". The currently selected style is \"%2$s\".'), ariaLabelValue, style) : sprintf(\n // translators: %s: The color's hex code e.g: \"#f00\".\n __('Border color and style picker. The currently selected color has a value of \"%s\".'), ariaLabelValue);\n }\n return __('Border color and style picker.');\n }\n if (colorObject) {\n return sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g: \"#f00\".\n __('Border color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), colorObject.name, getAriaLabelColorValue(colorObject.color));\n }\n if (colorValue) {\n return sprintf(\n // translators: %s: The color's hex code e.g: \"#f00\".\n __('Border color picker. The currently selected color has a value of \"%s\".'), getAriaLabelColorValue(colorValue));\n }\n return __('Border color picker.');\n};\nconst BorderControlDropdown = (props, forwardedRef) => {\n const {\n __experimentalIsRenderedInSidebar,\n border,\n colors,\n disableCustomColors,\n enableAlpha,\n enableStyle,\n indicatorClassName,\n indicatorWrapperClassName,\n isStyleSettable,\n onReset,\n onColorChange,\n onStyleChange,\n popoverContentClassName,\n popoverControlsClassName,\n resetButtonWrapperClassName,\n size,\n __unstablePopoverProps,\n onToggle: onToggleProp,\n // Remove from `otherProps` to avoid type errors (native HTML `onToggle` vs `Dropdown` `onToggle`).\n ...otherProps\n } = useBorderControlDropdown(props);\n const {\n color,\n style\n } = border || {};\n const colorObject = getColorObject(color, colors);\n const toggleAriaLabel = getToggleAriaLabel(color, colorObject, style, enableStyle);\n const enableResetButton = color || style && style !== 'none';\n const dropdownPosition = __experimentalIsRenderedInSidebar ? 'bottom left' : undefined;\n const renderToggle = ({\n onToggle\n }) => /*#__PURE__*/_jsx(Button, {\n onClick: onToggle,\n variant: \"tertiary\",\n \"aria-label\": toggleAriaLabel,\n tooltipPosition: dropdownPosition,\n label: __('Border color and style picker'),\n showTooltip: true,\n __next40pxDefaultSize: size === '__unstable-large',\n children: /*#__PURE__*/_jsx(\"span\", {\n className: indicatorWrapperClassName,\n children: /*#__PURE__*/_jsx(ColorIndicator, {\n className: indicatorClassName,\n colorValue: color\n })\n })\n });\n const renderContent = () => /*#__PURE__*/_jsxs(DropdownContentWrapper, {\n paddingSize: \"medium\",\n children: [/*#__PURE__*/_jsxs(VStack, {\n className: popoverControlsClassName,\n spacing: 6,\n children: [/*#__PURE__*/_jsx(ColorPalette, {\n className: popoverContentClassName,\n value: color,\n onChange: onColorChange,\n colors,\n disableCustomColors,\n __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,\n clearable: false,\n enableAlpha: enableAlpha\n }), enableStyle && isStyleSettable && /*#__PURE__*/_jsx(BorderControlStylePicker, {\n label: __('Style'),\n value: style,\n onChange: onStyleChange\n })]\n }), /*#__PURE__*/_jsx(\"div\", {\n className: resetButtonWrapperClassName,\n children: /*#__PURE__*/_jsx(Button, {\n variant: \"tertiary\",\n onClick: () => {\n onReset();\n },\n disabled: !enableResetButton,\n accessibleWhenDisabled: true,\n __next40pxDefaultSize: true,\n children: __('Reset')\n })\n })]\n });\n return /*#__PURE__*/_jsx(Dropdown, {\n renderToggle: renderToggle,\n renderContent: renderContent,\n popoverProps: {\n ...__unstablePopoverProps\n },\n ...otherProps,\n ref: forwardedRef\n });\n};\nconst ConnectedBorderControlDropdown = contextConnect(BorderControlDropdown, 'BorderControlDropdown');\nexport default ConnectedBorderControlDropdown;"],
5
- "mappings": ";AAOA,SAAS,IAAI,eAAe;AAK5B,OAAO,8BAA8B;AACrC,OAAO,YAAY;AACnB,OAAO,oBAAoB;AAC3B,OAAO,kBAAkB;AACzB,OAAO,cAAc;AACrB,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAC/B,SAAS,gCAAgC;AACzC,OAAO,4BAA4B;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C,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA,WAAW;AAAA,QACX;AAAA,MACF,CAAC,GAAG,eAAe,mBAAgC,qBAAK,0BAA0B;AAAA,QAChF,OAAO,GAAG,OAAO;AAAA,QACjB,OAAO;AAAA,QACP,UAAU;AAAA,MACZ,CAAC,CAAC;AAAA,IACJ,CAAC,GAAgB,qBAAK,OAAO;AAAA,MAC3B,WAAW;AAAA,MACX,UAAuB,qBAAK,QAAQ;AAAA,QAClC,SAAS;AAAA,QACT,SAAS,MAAM;AACb,kBAAQ;AAAA,QACV;AAAA,QACA,UAAU,CAAC;AAAA,QACX,wBAAwB;AAAA,QACxB,uBAAuB;AAAA,QACvB,UAAU,GAAG,OAAO;AAAA,MACtB,CAAC;AAAA,IACH,CAAC,CAAC;AAAA,EACJ,CAAC;AACD,SAAoB,qBAAK,UAAU;AAAA,IACjC;AAAA,IACA;AAAA,IACA,cAAc;AAAA,MACZ,GAAG;AAAA,IACL;AAAA,IACA,GAAG;AAAA,IACH,KAAK;AAAA,EACP,CAAC;AACH;AACA,IAAM,iCAAiC,eAAe,uBAAuB,uBAAuB;AACpG,IAAO,oBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderControlStylePicker from '../border-control-style-picker';\nimport Button from '../../button';\nimport ColorIndicator from '../../color-indicator';\nimport ColorPalette from '../../color-palette';\nimport Dropdown from '../../dropdown';\nimport { VStack } from '../../v-stack';\nimport { contextConnect } from '../../context';\nimport { useBorderControlDropdown } from './hook';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\nimport { isMultiplePaletteArray } from '../../color-palette/utils';\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst getAriaLabelColorValue = colorValue => {\n // Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n return colorValue.replace(/^var\\((.+)\\)$/, '$1');\n};\nconst getColorObject = (colorValue, colors) => {\n if (!colorValue || !colors) {\n return;\n }\n if (isMultiplePaletteArray(colors)) {\n // Multiple origins\n let matchedColor;\n colors.some(origin => origin.colors.some(color => {\n if (color.color === colorValue) {\n matchedColor = color;\n return true;\n }\n return false;\n }));\n return matchedColor;\n }\n\n // Single origin\n return colors.find(color => color.color === colorValue);\n};\nconst getToggleAriaLabel = (colorValue, colorObject, style, isStyleEnabled) => {\n if (isStyleEnabled) {\n if (colorObject) {\n const ariaLabelValue = getAriaLabelColorValue(colorObject.color);\n return style ? sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\". 3: The current border style selection e.g. \"solid\".\n __('Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\". The currently selected style is \"%3$s\".'), colorObject.name, ariaLabelValue, style) : sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\".\n __('Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), colorObject.name, ariaLabelValue);\n }\n if (colorValue) {\n const ariaLabelValue = getAriaLabelColorValue(colorValue);\n return style ? sprintf(\n // translators: 1: The color's hex code e.g.: \"#f00:\". 2: The current border style selection e.g. \"solid\".\n __('Border color and style picker. The currently selected color has a value of \"%1$s\". The currently selected style is \"%2$s\".'), ariaLabelValue, style) : sprintf(\n // translators: %s: The color's hex code e.g: \"#f00\".\n __('Border color and style picker. The currently selected color has a value of \"%s\".'), ariaLabelValue);\n }\n return __('Border color and style picker.');\n }\n if (colorObject) {\n return sprintf(\n // translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g: \"#f00\".\n __('Border color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), colorObject.name, getAriaLabelColorValue(colorObject.color));\n }\n if (colorValue) {\n return sprintf(\n // translators: %s: The color's hex code e.g: \"#f00\".\n __('Border color picker. The currently selected color has a value of \"%s\".'), getAriaLabelColorValue(colorValue));\n }\n return __('Border color picker.');\n};\nconst BorderControlDropdown = (props, forwardedRef) => {\n const {\n __experimentalIsRenderedInSidebar,\n border,\n colors,\n disableCustomColors,\n enableAlpha,\n enableStyle,\n indicatorClassName,\n indicatorWrapperClassName,\n isStyleSettable,\n onReset,\n onColorChange,\n onStyleChange,\n popoverContentClassName,\n popoverControlsClassName,\n resetButtonWrapperClassName,\n size,\n __unstablePopoverProps,\n ...otherProps\n } = useBorderControlDropdown(props);\n const {\n color,\n style\n } = border || {};\n const colorObject = getColorObject(color, colors);\n const toggleAriaLabel = getToggleAriaLabel(color, colorObject, style, enableStyle);\n const enableResetButton = color || style && style !== 'none';\n const dropdownPosition = __experimentalIsRenderedInSidebar ? 'bottom left' : undefined;\n const renderToggle = ({\n onToggle\n }) => /*#__PURE__*/_jsx(Button, {\n onClick: onToggle,\n variant: \"tertiary\",\n \"aria-label\": toggleAriaLabel,\n tooltipPosition: dropdownPosition,\n label: __('Border color and style picker'),\n showTooltip: true,\n __next40pxDefaultSize: size === '__unstable-large',\n children: /*#__PURE__*/_jsx(\"span\", {\n className: indicatorWrapperClassName,\n children: /*#__PURE__*/_jsx(ColorIndicator, {\n className: indicatorClassName,\n colorValue: color\n })\n })\n });\n const renderContent = () => /*#__PURE__*/_jsx(_Fragment, {\n children: /*#__PURE__*/_jsxs(DropdownContentWrapper, {\n paddingSize: \"medium\",\n children: [/*#__PURE__*/_jsxs(VStack, {\n className: popoverControlsClassName,\n spacing: 6,\n children: [/*#__PURE__*/_jsx(ColorPalette, {\n className: popoverContentClassName,\n value: color,\n onChange: onColorChange,\n colors,\n disableCustomColors,\n __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,\n clearable: false,\n enableAlpha: enableAlpha\n }), enableStyle && isStyleSettable && /*#__PURE__*/_jsx(BorderControlStylePicker, {\n label: __('Style'),\n value: style,\n onChange: onStyleChange\n })]\n }), /*#__PURE__*/_jsx(\"div\", {\n className: resetButtonWrapperClassName,\n children: /*#__PURE__*/_jsx(Button, {\n variant: \"tertiary\",\n onClick: () => {\n onReset();\n },\n disabled: !enableResetButton,\n accessibleWhenDisabled: true,\n __next40pxDefaultSize: true,\n children: __('Reset')\n })\n })]\n })\n });\n return /*#__PURE__*/_jsx(Dropdown, {\n renderToggle: renderToggle,\n renderContent: renderContent,\n popoverProps: {\n ...__unstablePopoverProps\n },\n ...otherProps,\n ref: forwardedRef\n });\n};\nconst ConnectedBorderControlDropdown = contextConnect(BorderControlDropdown, 'BorderControlDropdown');\nexport default ConnectedBorderControlDropdown;"],
5
+ "mappings": ";AAOA,SAAS,IAAI,eAAe;AAK5B,OAAO,8BAA8B;AACrC,OAAO,YAAY;AACnB,OAAO,oBAAoB;AAC3B,OAAO,kBAAkB;AACzB,OAAO,cAAc;AACrB,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAC/B,SAAS,gCAAgC;AACzC,OAAO,4BAA4B;AACnC,SAAS,8BAA8B;AACvC,SAAS,OAAO,MAAM,QAAQ,OAAO,YAAY,iBAAiB;AAClE,IAAM,yBAAyB,gBAAc;AAE3C,SAAO,WAAW,QAAQ,iBAAiB,IAAI;AACjD;AACA,IAAM,iBAAiB,CAAC,YAAY,WAAW;AAC7C,MAAI,CAAC,cAAc,CAAC,QAAQ;AAC1B;AAAA,EACF;AACA,MAAI,uBAAuB,MAAM,GAAG;AAElC,QAAI;AACJ,WAAO,KAAK,YAAU,OAAO,OAAO,KAAK,WAAS;AAChD,UAAI,MAAM,UAAU,YAAY;AAC9B,uBAAe;AACf,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT,CAAC,CAAC;AACF,WAAO;AAAA,EACT;AAGA,SAAO,OAAO,KAAK,WAAS,MAAM,UAAU,UAAU;AACxD;AACA,IAAM,qBAAqB,CAAC,YAAY,aAAa,OAAO,mBAAmB;AAC7E,MAAI,gBAAgB;AAClB,QAAI,aAAa;AACf,YAAM,iBAAi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AAA,IACjC;AAAA,IACA;AAAA,IACA,cAAc;AAAA,MACZ,GAAG;AAAA,IACL;AAAA,IACA,GAAG;AAAA,IACH,KAAK;AAAA,EACP,CAAC;AACH;AACA,IAAM,iCAAiC,eAAe,uBAAuB,uBAAuB;AACpG,IAAO,oBAAQ;",
6
6
  "names": []
7
7
  }
@@ -178,6 +178,9 @@ function UnforwardedColorPalette(props, forwardedRef) {
178
178
  metaProps,
179
179
  labelProps
180
180
  } = getComputeCircularOptionPickerCommonProps(asButtons, loop, ariaLabel, ariaLabelledby);
181
+ if (disableCustomColors && colors.length === 0 && !actions) {
182
+ return null;
183
+ }
181
184
  return /* @__PURE__ */ _jsxs(VStack, {
182
185
  spacing: 3,
183
186
  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": ";AAIA,SAAS,QAAQ,cAAc;AAC/B,OAAO,iBAAiB;AACxB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AAKjB,SAAS,qBAAqB;AAC9B,SAAS,IAAI,eAAe;AAC5B,SAAS,aAAa,SAAS,UAAU,kBAAkB;AAK3D,OAAO,cAAc;AACrB,SAAS,mBAAmB;AAC5B,OAAO,wBAAwB,iDAAiD;AAChF,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,OAAO,4BAA4B;AACnC,SAAS,kCAAkC,wBAAwB,2BAA2B;AAC9F,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,OAAO,CAAC,aAAa,UAAU,CAAC;AAChC,SAAS,cAAc;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,eAAe,QAAQ,MAAM;AACjC,WAAO,OAAO,IAAI,CAAC;AAAA,MACjB;AAAA,MACA;AAAA,MACA;AAAA,IACF,GAAG,UAAU;AACX,YAAM,cAAc,OAAO,KAAK;AAOhC,YAAM,aAAa,eAAe,SAAS,eAAe,UAAU;A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AAA,UACA,MAAM;AAAA,QACR,CAAC,GAAgB,sBAAM,QAAQ;AAAA,UAC7B,WAAW;AAAA,UACX,SAAS;AAAA,UACT,UAAU,CAAc,qBAAK,UAAU;AAAA,YACrC,WAAW;AAAA,YACX,UAAU,QAAQ,kBAAkB,GAAG,mBAAmB;AAAA,UAC5D,CAAC,GAAgB,qBAAK,UAAU;AAAA,YAC9B,WAAW,KAAK,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,qBAAK,sBAAsB;AAAA,MAC5E,GAAG;AAAA,MACH,GAAG;AAAA,MACH;AAAA,MACA,SAAS,0BAAuC,qBAAK,kBAAkB;AAAA,QACrE,GAAG;AAAA,QACH;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC,IAAiB,qBAAK,eAAe;AAAA,QACpC,GAAG;AAAA,QACH;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AA0BO,IAAM,eAAe,WAAW,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": ";AAIA,SAAS,QAAQ,cAAc;AAC/B,OAAO,iBAAiB;AACxB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AAKjB,SAAS,qBAAqB;AAC9B,SAAS,IAAI,eAAe;AAC5B,SAAS,aAAa,SAAS,UAAU,kBAAkB;AAK3D,OAAO,cAAc;AACrB,SAAS,mBAAmB;AAC5B,OAAO,wBAAwB,iDAAiD;AAChF,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,OAAO,4BAA4B;AACnC,SAAS,kCAAkC,wBAAwB,2BAA2B;AAC9F,SAAS,OA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,wBAAQ;",
6
6
  "names": []
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": ";AAGA,OAAO,UAAU;AAIjB,SAAS,QAAQ,kBAAkB;AAKnC,OAAO,mBAAmB;AAC1B,SAAS,6CAA6C;AACtD,SAAS,mDAAmD;AAC5D,SAAS,OAAO,MAAM,QAAQ,aAAa;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;A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,sBAAM,OAAO;AAAA,MAC5B,KAAK;AAAA,MACL,WAAW;AAAA,MACX,UAAU,CAAC,CAAC,oBAAoB,oBAAoB,4BAAyC,qBAAK,cAAc,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,qBAAK,eAAe;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;",
4
+ "sourcesContent": ["/**\n * External 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": ";AAGA,OAAO,UAAU;AAKjB,SAAS,QAAQ,kBAAkB;AAKnC,OAAO,mBAAmB;AAC1B,SAAS,6CAA6C;AACtD,SAAS,mDAAmD;AAC5D,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,2BAA2B,CAAC,OAAO,WAAW;AAClD,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AA2B,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": []
7
7
  }
@@ -18,7 +18,7 @@ function Disabled({
18
18
  value: isDisabled,
19
19
  children: /* @__PURE__ */ _jsx("div", {
20
20
  // @ts-ignore Reason: inert is a recent HTML attribute
21
- inert: isDisabled ? true : void 0,
21
+ inert: isDisabled ? "true" : void 0,
22
22
  className: isDisabled ? cx(disabledStyles, className, "components-disabled") : void 0,
23
23
  ...props,
24
24
  children
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/disabled/index.tsx"],
4
- "sourcesContent": ["import { disabledStyles } from './styles/disabled-styles';\nimport { useCx } from '../utils';\nimport Context from './context';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst {\n Consumer,\n Provider\n} = Context;\n\n/**\n * `Disabled` is a component which disables descendant tabbable elements and\n * prevents pointer interaction.\n *\n * _Note: this component may not behave as expected in browsers that don't\n * support the `inert` HTML attribute. We recommend adding the official WICG\n * polyfill when using this component in your project._\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n *\n * ```jsx\n * import { Button, Disabled, TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDisabled = () => {\n * \tconst [ isDisabled, setIsDisabled ] = useState( true );\n *\n *\tlet input = (\n *\t\t<TextControl\n *\t\t\t__next40pxDefaultSize\n *\t\t\tlabel=\"Input\"\n *\t\t\tonChange={ () => {} }\n *\t\t/>\n *\t);\n * \tif ( isDisabled ) {\n * \t\tinput = <Disabled>{ input }</Disabled>;\n * \t}\n *\n * \tconst toggleDisabled = () => {\n * \t\tsetIsDisabled( ( state ) => ! state );\n * \t};\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t{ input }\n * \t\t\t<Button variant=\"primary\" onClick={ toggleDisabled }>\n * \t\t\t\tToggle Disabled\n * \t\t\t</Button>\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nfunction Disabled({\n className,\n children,\n isDisabled = true,\n ...props\n}) {\n const cx = useCx();\n return /*#__PURE__*/_jsx(Provider, {\n value: isDisabled,\n children: /*#__PURE__*/_jsx(\"div\", {\n // @ts-ignore Reason: inert is a recent HTML attribute\n inert: isDisabled ? true : undefined,\n className: isDisabled ? cx(disabledStyles, className, 'components-disabled') : undefined,\n ...props,\n children: children\n })\n });\n}\nDisabled.Context = Context;\nDisabled.Consumer = Consumer;\nexport default Disabled;"],
5
- "mappings": ";AAAA,SAAS,sBAAsB;AAC/B,SAAS,aAAa;AACtB,OAAO,aAAa;AACpB,SAAS,OAAO,YAAY;AAC5B,IAAM;AAAA,EACJ;AAAA,EACA;AACF,IAAI;AA6CJ,SAAS,SAAS;AAAA,EAChB;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,GAAG;AACL,GAAG;AACD,QAAM,KAAK,MAAM;AACjB,SAAoB,qBAAK,UAAU;AAAA,IACjC,OAAO;AAAA,IACP,UAAuB,qBAAK,OAAO;AAAA;AAAA,MAEjC,OAAO,aAAa,OAAO;AAAA,MAC3B,WAAW,aAAa,GAAG,gBAAgB,WAAW,qBAAqB,IAAI;AAAA,MAC/E,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;AACA,SAAS,UAAU;AACnB,SAAS,WAAW;AACpB,IAAO,mBAAQ;",
4
+ "sourcesContent": ["import { disabledStyles } from './styles/disabled-styles';\nimport { useCx } from '../utils';\nimport Context from './context';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst {\n Consumer,\n Provider\n} = Context;\n\n/**\n * `Disabled` is a component which disables descendant tabbable elements and\n * prevents pointer interaction.\n *\n * _Note: this component may not behave as expected in browsers that don't\n * support the `inert` HTML attribute. We recommend adding the official WICG\n * polyfill when using this component in your project._\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n *\n * ```jsx\n * import { Button, Disabled, TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDisabled = () => {\n * \tconst [ isDisabled, setIsDisabled ] = useState( true );\n *\n *\tlet input = (\n *\t\t<TextControl\n *\t\t\t__next40pxDefaultSize\n *\t\t\tlabel=\"Input\"\n *\t\t\tonChange={ () => {} }\n *\t\t/>\n *\t);\n * \tif ( isDisabled ) {\n * \t\tinput = <Disabled>{ input }</Disabled>;\n * \t}\n *\n * \tconst toggleDisabled = () => {\n * \t\tsetIsDisabled( ( state ) => ! state );\n * \t};\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t{ input }\n * \t\t\t<Button variant=\"primary\" onClick={ toggleDisabled }>\n * \t\t\t\tToggle Disabled\n * \t\t\t</Button>\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nfunction Disabled({\n className,\n children,\n isDisabled = true,\n ...props\n}) {\n const cx = useCx();\n return /*#__PURE__*/_jsx(Provider, {\n value: isDisabled,\n children: /*#__PURE__*/_jsx(\"div\", {\n // @ts-ignore Reason: inert is a recent HTML attribute\n inert: isDisabled ? 'true' : undefined,\n className: isDisabled ? cx(disabledStyles, className, 'components-disabled') : undefined,\n ...props,\n children: children\n })\n });\n}\nDisabled.Context = Context;\nDisabled.Consumer = Consumer;\nexport default Disabled;"],
5
+ "mappings": ";AAAA,SAAS,sBAAsB;AAC/B,SAAS,aAAa;AACtB,OAAO,aAAa;AACpB,SAAS,OAAO,YAAY;AAC5B,IAAM;AAAA,EACJ;AAAA,EACA;AACF,IAAI;AA6CJ,SAAS,SAAS;AAAA,EAChB;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,GAAG;AACL,GAAG;AACD,QAAM,KAAK,MAAM;AACjB,SAAoB,qBAAK,UAAU;AAAA,IACjC,OAAO;AAAA,IACP,UAAuB,qBAAK,OAAO;AAAA;AAAA,MAEjC,OAAO,aAAa,SAAS;AAAA,MAC7B,WAAW,aAAa,GAAG,gBAAgB,WAAW,qBAAqB,IAAI;AAAA,MAC/E,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;AACA,SAAS,UAAU;AACnB,SAAS,WAAW;AACpB,IAAO,mBAAQ;",
6
6
  "names": []
7
7
  }
@@ -82,7 +82,7 @@ function registerStyle(hash, css) {
82
82
 
83
83
  // packages/components/src/draggable/style.module.scss
84
84
  if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
85
- 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}");
85
+ 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}");
86
86
  }
87
87
  var style_module_default = { "invisible-drag-image": "_3476c2e530687f96__invisible-drag-image", "clone": "_6f00e51ab7574306__clone", "is-in-compat-slot": "_664ecd37377558df__is-in-compat-slot" };
88
88
 
@@ -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": ";AAOA,SAAS,gBAAgB;AACzB,SAAS,WAAW,cAAc;AAClC,SAAS,8BAA8B;;;ACTvC,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa,oBAAoB,MAAM,MAAM;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAUA,SAAS,YAAY,gBAAgB,MAAM,KAAK;AAC9C,MAAI,CAAC,eAAe,MAAM;AACxB;AAAA,EACF;AACA,QAAM,UAAU,WAAW;AAC3B,MAAI,iBAAiB,QAAQ,eAAe,IAA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,UAAU;AAC9B,YAAM,QAAQ,IAAI,EAAE,UAAU;AAC9B,mBAAa,MAAM,YAAY,cAAc,KAAK,OAAO,KAAK;AAC9D,mBAAa,EAAE;AACf,kBAAY,EAAE;AACd,UAAI;AACJ,UAAI;AACJ,UAAI,YAAY;AACd,mBAAW,CAAC;AAAA,MACd;AAAA,IACF;AAKA,UAAM,oBAAoB,SAAS,MAAM,EAAE;AAC3C,kBAAc,iBAAiB,YAAY,iBAAiB;AAG5D,kBAAc,KAAK,UAAU,IAAI,SAAS;AAC1C,QAAI,aAAa;AACf,kBAAY,KAAK;AAAA,IACnB;AACA,eAAW,UAAU,MAAM;AAEzB,UAAI,gBAAgB,aAAa,YAAY;AAC3C,qBAAa,WAAW,YAAY,YAAY;AAAA,MAClD;AACA,UAAI,aAAa,UAAU,YAAY;AACrC,kBAAU,WAAW,YAAY,SAAS;AAAA,MAC5C;AAGA,oBAAc,KAAK,UAAU,OAAO,SAAS;AAC7C,oBAAc,oBAAoB,YAAY,iBAAiB;AAAA,IACjE;AAAA,EACF;AACA,YAAU,MAAM,MAAM;AACpB,eAAW,QAAQ;AAAA,EACrB,GAAG,CAAC,CAAC;AACL,SAAoB,sBAAM,WAAW;AAAA,IACnC,UAAU,CAAC,SAAS;AAAA,MAClB,kBAAkB;AAAA,MAClB,gBAAgB;AAAA,IAClB,CAAC,GAAG,iBAA8B,qBAAK,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": ";AAOA,SAAS,gBAAgB;AACzB,SAAS,WAAW,cAAc;AAClC,SAAS,8BAA8B;;;ACTvC,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa,oBAAoB,MAAM,MAAM;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAUA,SAAS,YAAY,gBAAgB,MAAM,KAAK;AAC9C,MAAI,CAAC,eAAe,MAAM;AACxB;AAAA,EACF;AACA,QAAM,UAAU,WAAW;AAC3B,MAAI,iBAAiB,QAAQ,eAAe,IAAI,cAAc;AAC9D,MAAI,CAAC,gB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AAI,EAAE,UAAU;AAC9B,mBAAa,MAAM,YAAY,cAAc,KAAK,OAAO,KAAK;AAC9D,mBAAa,EAAE;AACf,kBAAY,EAAE;AACd,UAAI;AACJ,UAAI;AACJ,UAAI,YAAY;AACd,mBAAW,CAAC;AAAA,MACd;AAAA,IACF;AAKA,UAAM,oBAAoB,SAAS,MAAM,EAAE;AAC3C,kBAAc,iBAAiB,YAAY,iBAAiB;AAG5D,kBAAc,KAAK,UAAU,IAAI,SAAS;AAC1C,QAAI,aAAa;AACf,kBAAY,KAAK;AAAA,IACnB;AACA,eAAW,UAAU,MAAM;AAEzB,UAAI,gBAAgB,aAAa,YAAY;AAC3C,qBAAa,WAAW,YAAY,YAAY;AAAA,MAClD;AACA,UAAI,aAAa,UAAU,YAAY;AACrC,kBAAU,WAAW,YAAY,SAAS;AAAA,MAC5C;AAGA,oBAAc,KAAK,UAAU,OAAO,SAAS;AAC7C,oBAAc,oBAAoB,YAAY,iBAAiB;AAAA,IACjE;AAAA,EACF;AACA,YAAU,MAAM,MAAM;AACpB,eAAW,QAAQ;AAAA,EACrB,GAAG,CAAC,CAAC;AACL,SAAoB,sBAAM,WAAW;AAAA,IACnC,UAAU,CAAC,SAAS;AAAA,MAClB,kBAAkB;AAAA,MAClB,gBAAgB;AAAA,IAClB,CAAC,GAAG,iBAA8B,qBAAK,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": []
7
7
  }
@@ -1,11 +1,11 @@
1
1
  // packages/components/src/higher-order/with-notices/index.tsx
2
2
  import { v4 as uuid } from "uuid";
3
- import { useState, useMemo } from "@wordpress/element";
3
+ import { forwardRef, useState, useMemo } from "@wordpress/element";
4
4
  import { createHigherOrderComponent } from "@wordpress/compose";
5
5
  import NoticeList from "../../notice/list.mjs";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  var with_notices_default = createHigherOrderComponent((OriginalComponent) => {
8
- return function Component(props) {
8
+ function Component(props, ref) {
9
9
  const [noticeList, setNoticeList] = useState([]);
10
10
  const noticeOperations = useMemo(() => {
11
11
  const createNotice = (notice) => {
@@ -41,10 +41,22 @@ var with_notices_default = createHigherOrderComponent((OriginalComponent) => {
41
41
  onRemove: noticeOperations.removeNotice
42
42
  })
43
43
  };
44
- return /* @__PURE__ */ _jsx(OriginalComponent, {
44
+ return isForwardRef ? /* @__PURE__ */ _jsx(OriginalComponent, {
45
+ ...propsOut,
46
+ ref
47
+ }) : /* @__PURE__ */ _jsx(OriginalComponent, {
45
48
  ...propsOut
46
49
  });
47
- };
50
+ }
51
+ let isForwardRef;
52
+ const {
53
+ render
54
+ } = OriginalComponent;
55
+ if (typeof render === "function") {
56
+ isForwardRef = true;
57
+ return forwardRef(Component);
58
+ }
59
+ return Component;
48
60
  }, "withNotices");
49
61
  export {
50
62
  with_notices_default as default
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/higher-order/with-notices/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NoticeList from '../../notice/list';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Override the default edit UI to include notices if supported.\n *\n * Wrapping the original component with `withNotices` encapsulates the component\n * with the additional props `noticeOperations` and `noticeUI`.\n *\n * ```jsx\n * import { withNotices, Button } from '@wordpress/components';\n *\n * const MyComponentWithNotices = withNotices(\n * \t( { noticeOperations, noticeUI } ) => {\n * \t\tconst addError = () =>\n * \t\t\tnoticeOperations.createErrorNotice( 'Error message' );\n * \t\treturn (\n * \t\t\t<div>\n * \t\t\t\t{ noticeUI }\n * \t\t\t\t<Button variant=\"secondary\" onClick={ addError }>\n * \t\t\t\t\tAdd error\n * \t\t\t\t</Button>\n * \t\t\t</div>\n * \t\t);\n * \t}\n * );\n * ```\n *\n * @param OriginalComponent Original component.\n *\n * @return Wrapped component.\n */\nexport default createHigherOrderComponent(OriginalComponent => {\n return function Component(props) {\n const [noticeList, setNoticeList] = useState([]);\n const noticeOperations = useMemo(() => {\n const createNotice = notice => {\n const noticeToAdd = notice.id ? notice : {\n ...notice,\n id: uuid()\n };\n setNoticeList(current => [...current, noticeToAdd]);\n };\n return {\n createNotice,\n createErrorNotice: msg => {\n // @ts-expect-error TODO: Missing `id`, potentially a bug\n createNotice({\n status: 'error',\n content: msg\n });\n },\n removeNotice: id => {\n setNoticeList(current => current.filter(notice => notice.id !== id));\n },\n removeAllNotices: () => {\n setNoticeList([]);\n }\n };\n }, []);\n const propsOut = {\n ...props,\n noticeList,\n noticeOperations,\n noticeUI: noticeList.length > 0 && /*#__PURE__*/_jsx(NoticeList, {\n className: \"components-with-notices-ui\",\n notices: noticeList,\n onRemove: noticeOperations.removeNotice\n })\n };\n return /*#__PURE__*/_jsx(OriginalComponent, {\n ...propsOut\n });\n };\n}, 'withNotices');"],
5
- "mappings": ";AAGA,SAAS,MAAM,YAAY;AAK3B,SAAS,UAAU,eAAe;AAClC,SAAS,kCAAkC;AAK3C,OAAO,gBAAgB;AACvB,SAAS,OAAO,YAAY;AA8B5B,IAAO,uBAAQ,2BAA2B,uBAAqB;AAC7D,SAAO,SAAS,UAAU,OAAO;AAC/B,UAAM,CAAC,YAAY,aAAa,IAAI,SAAS,CAAC,CAAC;AAC/C,UAAM,mBAAmB,QAAQ,MAAM;AACrC,YAAM,eAAe,YAAU;AAC7B,cAAM,cAAc,OAAO,KAAK,SAAS;AAAA,UACvC,GAAG;AAAA,UACH,IAAI,KAAK;AAAA,QACX;AACA,sBAAc,aAAW,CAAC,GAAG,SAAS,WAAW,CAAC;AAAA,MACpD;AACA,aAAO;AAAA,QACL;AAAA,QACA,mBAAmB,SAAO;AAExB,uBAAa;AAAA,YACX,QAAQ;AAAA,YACR,SAAS;AAAA,UACX,CAAC;AAAA,QACH;AAAA,QACA,cAAc,QAAM;AAClB,wBAAc,aAAW,QAAQ,OAAO,YAAU,OAAO,OAAO,EAAE,CAAC;AAAA,QACrE;AAAA,QACA,kBAAkB,MAAM;AACtB,wBAAc,CAAC,CAAC;AAAA,QAClB;AAAA,MACF;AAAA,IACF,GAAG,CAAC,CAAC;AACL,UAAM,WAAW;AAAA,MACf,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,UAAU,WAAW,SAAS,KAAkB,qBAAK,YAAY;AAAA,QAC/D,WAAW;AAAA,QACX,SAAS;AAAA,QACT,UAAU,iBAAiB;AAAA,MAC7B,CAAC;AAAA,IACH;AACA,WAAoB,qBAAK,mBAAmB;AAAA,MAC1C,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF,GAAG,aAAa;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useState, useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport NoticeList from '../../notice/list';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Override the default edit UI to include notices if supported.\n *\n * Wrapping the original component with `withNotices` encapsulates the component\n * with the additional props `noticeOperations` and `noticeUI`.\n *\n * ```jsx\n * import { withNotices, Button } from '@wordpress/components';\n *\n * const MyComponentWithNotices = withNotices(\n * \t( { noticeOperations, noticeUI } ) => {\n * \t\tconst addError = () =>\n * \t\t\tnoticeOperations.createErrorNotice( 'Error message' );\n * \t\treturn (\n * \t\t\t<div>\n * \t\t\t\t{ noticeUI }\n * \t\t\t\t<Button variant=\"secondary\" onClick={ addError }>\n * \t\t\t\t\tAdd error\n * \t\t\t\t</Button>\n * \t\t\t</div>\n * \t\t);\n * \t}\n * );\n * ```\n *\n * @param OriginalComponent Original component.\n *\n * @return Wrapped component.\n */\nexport default createHigherOrderComponent(OriginalComponent => {\n function Component(props, ref) {\n const [noticeList, setNoticeList] = useState([]);\n const noticeOperations = useMemo(() => {\n const createNotice = notice => {\n const noticeToAdd = notice.id ? notice : {\n ...notice,\n id: uuid()\n };\n setNoticeList(current => [...current, noticeToAdd]);\n };\n return {\n createNotice,\n createErrorNotice: msg => {\n // @ts-expect-error TODO: Missing `id`, potentially a bug\n createNotice({\n status: 'error',\n content: msg\n });\n },\n removeNotice: id => {\n setNoticeList(current => current.filter(notice => notice.id !== id));\n },\n removeAllNotices: () => {\n setNoticeList([]);\n }\n };\n }, []);\n const propsOut = {\n ...props,\n noticeList,\n noticeOperations,\n noticeUI: noticeList.length > 0 && /*#__PURE__*/_jsx(NoticeList, {\n className: \"components-with-notices-ui\",\n notices: noticeList,\n onRemove: noticeOperations.removeNotice\n })\n };\n return isForwardRef ? /*#__PURE__*/_jsx(OriginalComponent, {\n ...propsOut,\n ref: ref\n }) : /*#__PURE__*/_jsx(OriginalComponent, {\n ...propsOut\n });\n }\n let isForwardRef;\n // @ts-expect-error - `render` will only be present when OriginalComponent was wrapped with forwardRef().\n const {\n render\n } = OriginalComponent;\n // Returns a forwardRef if OriginalComponent appears to be a forwardRef.\n if (typeof render === 'function') {\n isForwardRef = true;\n return forwardRef(Component);\n }\n return Component;\n}, 'withNotices');"],
5
+ "mappings": ";AAGA,SAAS,MAAM,YAAY;AAK3B,SAAS,YAAY,UAAU,eAAe;AAC9C,SAAS,kCAAkC;AAK3C,OAAO,gBAAgB;AACvB,SAAS,OAAO,YAAY;AA8B5B,IAAO,uBAAQ,2BAA2B,uBAAqB;AAC7D,WAAS,UAAU,OAAO,KAAK;AAC7B,UAAM,CAAC,YAAY,aAAa,IAAI,SAAS,CAAC,CAAC;AAC/C,UAAM,mBAAmB,QAAQ,MAAM;AACrC,YAAM,eAAe,YAAU;AAC7B,cAAM,cAAc,OAAO,KAAK,SAAS;AAAA,UACvC,GAAG;AAAA,UACH,IAAI,KAAK;AAAA,QACX;AACA,sBAAc,aAAW,CAAC,GAAG,SAAS,WAAW,CAAC;AAAA,MACpD;AACA,aAAO;AAAA,QACL;AAAA,QACA,mBAAmB,SAAO;AAExB,uBAAa;AAAA,YACX,QAAQ;AAAA,YACR,SAAS;AAAA,UACX,CAAC;AAAA,QACH;AAAA,QACA,cAAc,QAAM;AAClB,wBAAc,aAAW,QAAQ,OAAO,YAAU,OAAO,OAAO,EAAE,CAAC;AAAA,QACrE;AAAA,QACA,kBAAkB,MAAM;AACtB,wBAAc,CAAC,CAAC;AAAA,QAClB;AAAA,MACF;AAAA,IACF,GAAG,CAAC,CAAC;AACL,UAAM,WAAW;AAAA,MACf,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,UAAU,WAAW,SAAS,KAAkB,qBAAK,YAAY;AAAA,QAC/D,WAAW;AAAA,QACX,SAAS;AAAA,QACT,UAAU,iBAAiB;AAAA,MAC7B,CAAC;AAAA,IACH;AACA,WAAO,eAA4B,qBAAK,mBAAmB;AAAA,MACzD,GAAG;AAAA,MACH;AAAA,IACF,CAAC,IAAiB,qBAAK,mBAAmB;AAAA,MACxC,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACA,MAAI;AAEJ,QAAM;AAAA,IACJ;AAAA,EACF,IAAI;AAEJ,MAAI,OAAO,WAAW,YAAY;AAChC,mBAAe;AACf,WAAO,WAAW,SAAS;AAAA,EAC7B;AACA,SAAO;AACT,GAAG,aAAa;",
6
6
  "names": []
7
7
  }
@@ -62,39 +62,42 @@ function InputBase(props, ref) {
62
62
  }
63
63
  };
64
64
  }, [__next40pxDefaultSize, size]);
65
- return /* @__PURE__ */ _jsxs(Root, {
66
- ...restProps,
67
- ...getUIFlexProps(labelPosition),
68
- className,
69
- gap: 2,
70
- ref,
71
- children: [/* @__PURE__ */ _jsx(Label, {
72
- className: "components-input-control__label",
73
- hideLabelFromVision,
74
- labelPosition,
75
- htmlFor: id,
76
- children: label
77
- }), /* @__PURE__ */ _jsxs(Container, {
78
- __unstableInputWidth,
79
- className: "components-input-control__container",
80
- disabled,
81
- hideLabel,
82
- labelPosition,
83
- children: [/* @__PURE__ */ _jsxs(ContextSystemProvider, {
84
- value: prefixSuffixContextValue,
85
- children: [prefix && /* @__PURE__ */ _jsx(Prefix, {
86
- className: "components-input-control__prefix",
87
- children: prefix
88
- }), children, suffix && /* @__PURE__ */ _jsx(Suffix, {
89
- className: "components-input-control__suffix",
90
- children: suffix
91
- })]
92
- }), /* @__PURE__ */ _jsx(Backdrop, {
65
+ return (
66
+ // @ts-expect-error The `direction` prop from Flex (FlexDirection) conflicts with legacy SVGAttributes `direction` (string) that come from React intrinsic prop definitions.
67
+ /* @__PURE__ */ _jsxs(Root, {
68
+ ...restProps,
69
+ ...getUIFlexProps(labelPosition),
70
+ className,
71
+ gap: 2,
72
+ ref,
73
+ children: [/* @__PURE__ */ _jsx(Label, {
74
+ className: "components-input-control__label",
75
+ hideLabelFromVision,
76
+ labelPosition,
77
+ htmlFor: id,
78
+ children: label
79
+ }), /* @__PURE__ */ _jsxs(Container, {
80
+ __unstableInputWidth,
81
+ className: "components-input-control__container",
93
82
  disabled,
94
- isBorderless
83
+ hideLabel,
84
+ labelPosition,
85
+ children: [/* @__PURE__ */ _jsxs(ContextSystemProvider, {
86
+ value: prefixSuffixContextValue,
87
+ children: [prefix && /* @__PURE__ */ _jsx(Prefix, {
88
+ className: "components-input-control__prefix",
89
+ children: prefix
90
+ }), children, suffix && /* @__PURE__ */ _jsx(Suffix, {
91
+ className: "components-input-control__suffix",
92
+ children: suffix
93
+ })]
94
+ }), /* @__PURE__ */ _jsx(Backdrop, {
95
+ disabled,
96
+ isBorderless
97
+ })]
95
98
  })]
96
- })]
97
- });
99
+ })
100
+ );
98
101
  }
99
102
  var input_base_default = contextConnect(InputBase, "InputBase");
100
103
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/input-control/input-base.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Backdrop from './backdrop';\nimport Label from './label';\nimport { Container, Root, Prefix, Suffix } from './styles/input-control-styles';\nimport { ContextSystemProvider, contextConnect, useContextSystem } from '../context';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction useUniqueId(idProp) {\n const instanceId = useInstanceId(InputBase);\n const id = `input-base-control-${instanceId}`;\n return idProp || id;\n}\n\n// Adapter to map props for the new ui/flex component.\nfunction getUIFlexProps(labelPosition) {\n const props = {};\n switch (labelPosition) {\n case 'top':\n props.direction = 'column';\n props.expanded = false;\n props.gap = 0;\n break;\n case 'bottom':\n props.direction = 'column-reverse';\n props.expanded = false;\n props.gap = 0;\n break;\n case 'edge':\n props.justify = 'space-between';\n break;\n }\n return props;\n}\nfunction InputBase(props, ref) {\n const {\n __next40pxDefaultSize,\n __unstableInputWidth,\n children,\n className,\n disabled = false,\n hideLabelFromVision = false,\n labelPosition,\n id: idProp,\n isBorderless = false,\n label,\n prefix,\n size = 'default',\n suffix,\n ...restProps\n } = useDeprecated36pxDefaultSizeProp(useContextSystem(props, 'InputBase'));\n const id = useUniqueId(idProp);\n const hideLabel = hideLabelFromVision || !label;\n const prefixSuffixContextValue = useMemo(() => {\n return {\n InputControlPrefixWrapper: {\n __next40pxDefaultSize,\n size\n },\n InputControlSuffixWrapper: {\n __next40pxDefaultSize,\n size\n }\n };\n }, [__next40pxDefaultSize, size]);\n return /*#__PURE__*/_jsxs(Root, {\n ...restProps,\n ...getUIFlexProps(labelPosition),\n className: className,\n gap: 2,\n ref: ref,\n children: [/*#__PURE__*/_jsx(Label, {\n className: \"components-input-control__label\",\n hideLabelFromVision: hideLabelFromVision,\n labelPosition: labelPosition,\n htmlFor: id,\n children: label\n }), /*#__PURE__*/_jsxs(Container, {\n __unstableInputWidth: __unstableInputWidth,\n className: \"components-input-control__container\",\n disabled: disabled,\n hideLabel: hideLabel,\n labelPosition: labelPosition,\n children: [/*#__PURE__*/_jsxs(ContextSystemProvider, {\n value: prefixSuffixContextValue,\n children: [prefix && /*#__PURE__*/_jsx(Prefix, {\n className: \"components-input-control__prefix\",\n children: prefix\n }), children, suffix && /*#__PURE__*/_jsx(Suffix, {\n className: \"components-input-control__suffix\",\n children: suffix\n })]\n }), /*#__PURE__*/_jsx(Backdrop, {\n disabled: disabled,\n isBorderless: isBorderless\n })]\n })]\n });\n}\n\n/**\n * `InputBase` is an internal component used to style the standard borders for an input,\n * as well as handle the layout for prefix/suffix elements.\n */\nexport default contextConnect(InputBase, 'InputBase');"],
5
- "mappings": ";AAOA,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AAKxB,OAAO,cAAc;AACrB,OAAO,WAAW;AAClB,SAAS,WAAW,MAAM,QAAQ,cAAc;AAChD,SAAS,uBAAuB,gBAAgB,wBAAwB;AACxE,SAAS,wCAAwC;AACjD,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,SAAS,YAAY,QAAQ;AAC3B,QAAM,aAAa,cAAc,SAAS;AAC1C,QAAM,KAAK,sBAAsB,UAAU;AAC3C,SAAO,UAAU;AACnB;AAGA,SAAS,eAAe,eAAe;AACrC,QAAM,QAAQ,CAAC;AACf,UAAQ,eAAe;AAAA,IACrB,KAAK;AACH,YAAM,YAAY;AAClB,YAAM,WAAW;AACjB,YAAM,MAAM;AACZ;AAAA,IACF,KAAK;AACH,YAAM,YAAY;AAClB,YAAM,WAAW;AACjB,YAAM,MAAM;AACZ;AAAA,IACF,KAAK;AACH,YAAM,UAAU;AAChB;AAAA,EACJ;AACA,SAAO;AACT;AACA,SAAS,UAAU,OAAO,KAAK;AAC7B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAA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/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Backdrop from './backdrop';\nimport Label from './label';\nimport { Container, Root, Prefix, Suffix } from './styles/input-control-styles';\nimport { ContextSystemProvider, contextConnect, useContextSystem } from '../context';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction useUniqueId(idProp) {\n const instanceId = useInstanceId(InputBase);\n const id = `input-base-control-${instanceId}`;\n return idProp || id;\n}\n\n// Adapter to map props for the new ui/flex component.\nfunction getUIFlexProps(labelPosition) {\n const props = {};\n switch (labelPosition) {\n case 'top':\n props.direction = 'column';\n props.expanded = false;\n props.gap = 0;\n break;\n case 'bottom':\n props.direction = 'column-reverse';\n props.expanded = false;\n props.gap = 0;\n break;\n case 'edge':\n props.justify = 'space-between';\n break;\n }\n return props;\n}\nfunction InputBase(props, ref) {\n const {\n __next40pxDefaultSize,\n __unstableInputWidth,\n children,\n className,\n disabled = false,\n hideLabelFromVision = false,\n labelPosition,\n id: idProp,\n isBorderless = false,\n label,\n prefix,\n size = 'default',\n suffix,\n ...restProps\n } = useDeprecated36pxDefaultSizeProp(useContextSystem(props, 'InputBase'));\n const id = useUniqueId(idProp);\n const hideLabel = hideLabelFromVision || !label;\n const prefixSuffixContextValue = useMemo(() => {\n return {\n InputControlPrefixWrapper: {\n __next40pxDefaultSize,\n size\n },\n InputControlSuffixWrapper: {\n __next40pxDefaultSize,\n size\n }\n };\n }, [__next40pxDefaultSize, size]);\n return (\n /*#__PURE__*/\n // @ts-expect-error The `direction` prop from Flex (FlexDirection) conflicts with legacy SVGAttributes `direction` (string) that come from React intrinsic prop definitions.\n _jsxs(Root, {\n ...restProps,\n ...getUIFlexProps(labelPosition),\n className: className,\n gap: 2,\n ref: ref,\n children: [/*#__PURE__*/_jsx(Label, {\n className: \"components-input-control__label\",\n hideLabelFromVision: hideLabelFromVision,\n labelPosition: labelPosition,\n htmlFor: id,\n children: label\n }), /*#__PURE__*/_jsxs(Container, {\n __unstableInputWidth: __unstableInputWidth,\n className: \"components-input-control__container\",\n disabled: disabled,\n hideLabel: hideLabel,\n labelPosition: labelPosition,\n children: [/*#__PURE__*/_jsxs(ContextSystemProvider, {\n value: prefixSuffixContextValue,\n children: [prefix && /*#__PURE__*/_jsx(Prefix, {\n className: \"components-input-control__prefix\",\n children: prefix\n }), children, suffix && /*#__PURE__*/_jsx(Suffix, {\n className: \"components-input-control__suffix\",\n children: suffix\n })]\n }), /*#__PURE__*/_jsx(Backdrop, {\n disabled: disabled,\n isBorderless: isBorderless\n })]\n })]\n })\n );\n}\n\n/**\n * `InputBase` is an internal component used to style the standard borders for an input,\n * as well as handle the layout for prefix/suffix elements.\n */\nexport default contextConnect(InputBase, 'InputBase');"],
5
+ "mappings": ";AAOA,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AAKxB,OAAO,cAAc;AACrB,OAAO,WAAW;AAClB,SAAS,WAAW,MAAM,QAAQ,cAAc;AAChD,SAAS,uBAAuB,gBAAgB,wBAAwB;AACxE,SAAS,wCAAwC;AACjD,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,SAAS,YAAY,QAAQ;AAC3B,QAAM,aAAa,cAAc,SAAS;AAC1C,QAAM,KAAK,sBAAsB,UAAU;AAC3C,SAAO,UAAU;AACnB;AAGA,SAAS,eAAe,eAAe;AACrC,QAAM,QAAQ,CAAC;AACf,UAAQ,eAAe;AAAA,IACrB,KAAK;AACH,YAAM,YAAY;AAClB,YAAM,WAAW;AACjB,YAAM,MAAM;AACZ;AAAA,IACF,KAAK;AACH,YAAM,YAAY;AAClB,YAAM,WAAW;AACjB,YAAM,MAAM;AACZ;AAAA,IACF,KAAK;AACH,YAAM,UAAU;AAChB;AAAA,EACJ;AACA,SAAO;AACT;AACA,SAAS,UAAU,OAAO,KAAK;AAC7B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;AAAA;AAEL;AAMA,IAAO,qBAAQ,eAAe,WAAW,WAAW;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  // packages/components/src/navigable-container/container.tsx
2
- import { forwardRef, useRef, useEffect, useCallback } from "@wordpress/element";
2
+ import { forwardRef, useRef, useEffect } from "@wordpress/element";
3
3
  import { useMergeRefs } from "@wordpress/compose";
4
4
  import { focus } from "@wordpress/dom";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -15,6 +15,19 @@ function cycleValue(value, total, offset) {
15
15
  }
16
16
  return nextValue;
17
17
  }
18
+ function getFocusableContext(container, target, tabbableOnly) {
19
+ const finder = tabbableOnly ? focus.tabbable : focus.focusable;
20
+ const focusables = finder.find(container);
21
+ const index = focusables.indexOf(target);
22
+ if (index > -1) {
23
+ return {
24
+ index,
25
+ target,
26
+ focusables
27
+ };
28
+ }
29
+ return null;
30
+ }
18
31
  function UnforwardedNavigableContainer({
19
32
  children,
20
33
  stopNavigationEvents,
@@ -26,25 +39,6 @@ function UnforwardedNavigableContainer({
26
39
  ...restProps
27
40
  }, ref) {
28
41
  const containerRef = useRef(null);
29
- const getFocusableIndex = useCallback((focusables, target) => {
30
- return focusables.indexOf(target);
31
- }, []);
32
- const getFocusableContext = useCallback((target) => {
33
- if (!containerRef.current) {
34
- return null;
35
- }
36
- const finder = onlyBrowserTabstops ? focus.tabbable : focus.focusable;
37
- const focusables = finder.find(containerRef.current);
38
- const index = getFocusableIndex(focusables, target);
39
- if (index > -1 && target) {
40
- return {
41
- index,
42
- target,
43
- focusables
44
- };
45
- }
46
- return null;
47
- }, [onlyBrowserTabstops, getFocusableIndex]);
48
42
  useEffect(() => {
49
43
  const container = containerRef.current;
50
44
  if (!container) {
@@ -70,7 +64,7 @@ function UnforwardedNavigableContainer({
70
64
  if (!activeElement) {
71
65
  return;
72
66
  }
73
- const context = getFocusableContext(activeElement);
67
+ const context = getFocusableContext(container, activeElement, !!onlyBrowserTabstops);
74
68
  if (!context) {
75
69
  return;
76
70
  }
@@ -91,7 +85,7 @@ function UnforwardedNavigableContainer({
91
85
  return () => {
92
86
  container.removeEventListener("keydown", handleKeyDown);
93
87
  };
94
- }, [onKeyDown, eventToOffset, stopNavigationEvents, cycle, onNavigate, getFocusableContext]);
88
+ }, [onKeyDown, eventToOffset, stopNavigationEvents, cycle, onNavigate, onlyBrowserTabstops]);
95
89
  const mergedRef = useMergeRefs([containerRef, ref]);
96
90
  return /* @__PURE__ */ _jsx("div", {
97
91
  ref: mergedRef,